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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

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

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

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

\n

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

\n

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

\n

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

\n
GET /api/users\n
\n

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

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

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

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

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

\n

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

\n

Security and Authentication

\n

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

\n

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

\n

Basic authentication

\n

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

\n

Example:

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

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

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

\n

Example:

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

API Key

\n

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

\n

Example:

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

Request Format

\n

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

\n

Response Format

\n

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

\n

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

\n

200 range

\n

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

\n

400 range

\n

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

\n

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

\n

500 range

\n

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

\n

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

\n

Data Types

\n

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

\n

ID integers

\n

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

\n

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

\n

Time stamps

\n

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

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2020-08-27T15:43:47.694Z", "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 916bff7..a87af4e 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 _0x0329=['action','STRING','contactManager','motionbar','jscripty','urlForward','browser','bot','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x2903d4,_0x35d7c1){var _0x2d966f=function(_0x2a10c5){while(--_0x2a10c5){_0x2903d4['push'](_0x2903d4['shift']());}};_0x2d966f(++_0x35d7c1);}(_0x0329,0x6c));var _0x9032=function(_0x1f3aec,_0x24c18e){_0x1f3aec=_0x1f3aec-0x0;var _0x409f0d=_0x0329[_0x1f3aec];return _0x409f0d;};'use strict';var Sequelize=require(_0x9032('0x0'));module[_0x9032('0x1')]={'name':{'type':Sequelize[_0x9032('0x2')],'get':function(_0x52cd77){return this[_0x9032('0x3')](_0x9032('0x4'));}},'action':{'type':Sequelize[_0x9032('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x9032('0x6'),'integration',_0x9032('0x7'),_0x9032('0x8'),_0x9032('0x9'),_0x9032('0xa'),_0x9032('0xb'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x9032('0x5')](0x1000),'comment':_0x9032('0xc')},'data2':{'type':Sequelize[_0x9032('0x5')](0x1000),'comment':_0x9032('0xd')},'data3':{'type':Sequelize[_0x9032('0x5')](0x1000),'comment':_0x9032('0xe')},'data4':{'type':Sequelize[_0x9032('0x5')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x9032('0x5')]},'data7':{'type':Sequelize[_0x9032('0xf')]}}; \ No newline at end of file +var _0xbaec=['TEXT','VIRTUAL','getDataValue','STRING','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]'];(function(_0x210cd5,_0x11c0b8){var _0x3a592b=function(_0x7b8724){while(--_0x7b8724){_0x210cd5['push'](_0x210cd5['shift']());}};_0x3a592b(++_0x11c0b8);}(_0xbaec,0x121));var _0xcbae=function(_0x53c33c,_0x27223d){_0x53c33c=_0x53c33c-0x0;var _0x277750=_0xbaec[_0x53c33c];return _0x277750;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xcbae('0x0')],'get':function(_0x452699){return this[_0xcbae('0x1')]('action');}},'action':{'type':Sequelize[_0xcbae('0x2')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration',_0xcbae('0x3'),_0xcbae('0x4'),_0xcbae('0x5'),_0xcbae('0x6'),_0xcbae('0x7'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xcbae('0x8')},'data1':{'type':Sequelize[_0xcbae('0x2')](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[_0xcbae('0x2')](0x1000),'comment':_0xcbae('0x9')},'data3':{'type':Sequelize[_0xcbae('0x2')](0x1000),'comment':_0xcbae('0xa')},'data4':{'type':Sequelize[_0xcbae('0x2')](0x1000)},'data5':{'type':Sequelize[_0xcbae('0x2')](0x1000)},'data6':{'type':Sequelize[_0xcbae('0x2')]},'data7':{'type':Sequelize[_0xcbae('0xb')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index f230a4a..4929497 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 _0x6971=['destroy','error','stack','name','body','Action','find','params','catch','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','save','update','then'];(function(_0xabf685,_0x2894a7){var _0x2ff8e7=function(_0x59afcb){while(--_0x59afcb){_0xabf685['push'](_0xabf685['shift']());}};_0x2ff8e7(++_0x2894a7);}(_0x6971,0x1ed));var _0x1697=function(_0x1fffb4,_0x4ff820){_0x1fffb4=_0x1fffb4-0x0;var _0x5e6336=_0x6971[_0x1fffb4];return _0x5e6336;};'use strict';var pdf=require(_0x1697('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1697('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1697('0x2'));var moment=require(_0x1697('0x3'));var BPromise=require(_0x1697('0x4'));var Mustache=require(_0x1697('0x5'));var util=require(_0x1697('0x6'));var path=require(_0x1697('0x7'));var sox=require(_0x1697('0x8'));var csv=require(_0x1697('0x9'));var ejs=require(_0x1697('0xa'));var fs=require('fs');var _=require(_0x1697('0xb'));var squel=require(_0x1697('0xc'));var crypto=require('crypto');var jsforce=require(_0x1697('0xd'));var deskjs=require(_0x1697('0xe'));var toCsv=require(_0x1697('0x9'));var querystring=require(_0x1697('0xf'));var Papa=require(_0x1697('0x10'));var Redis=require(_0x1697('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1697('0x12'));var logger=require(_0x1697('0x13'))(_0x1697('0x14'));var utils=require(_0x1697('0x15'));var config=require(_0x1697('0x16'));var db=require(_0x1697('0x17'))['db'];function respondWithStatusCode(_0x5544d8,_0x126d62){_0x126d62=_0x126d62||0xcc;return function(_0x355922){if(_0x355922){return _0x5544d8[_0x1697('0x18')](_0x126d62);}return _0x5544d8[_0x1697('0x19')](_0x126d62)[_0x1697('0x1a')]();};}function respondWithResult(_0x2f9062,_0x1b0b42){_0x1b0b42=_0x1b0b42||0xc8;return function(_0x542a94){if(_0x542a94){return _0x2f9062[_0x1697('0x19')](_0x1b0b42)[_0x1697('0x1b')](_0x542a94);}};}function respondWithFilteredResult(_0x4b4141,_0x2be316){return function(_0x2a9b33){if(_0x2a9b33){var _0x2ee297=_0x2a9b33[_0x1697('0x1c')],_0x17a962=_0x2be316[_0x1697('0x1d')],_0x5adb3e=_0x2be316[_0x1697('0x1d')]+_0x2be316[_0x1697('0x1e')],_0x115f10;if(_0x5adb3e>=_0x2ee297){_0x5adb3e=_0x2ee297;_0x115f10=0xc8;}else{_0x115f10=0xce;}_0x4b4141['status'](_0x115f10);return _0x4b4141[_0x1697('0x1f')]('Content-Range',_0x17a962+'-'+_0x5adb3e+'/'+_0x2ee297)['json'](_0x2a9b33);}return null;};}function patchUpdates(_0x1b29ef){return function(_0x481b96){try{jsonpatch['apply'](_0x481b96,_0x1b29ef,!![]);}catch(_0x486346){return BPromise['reject'](_0x486346);}return _0x481b96[_0x1697('0x20')]();};}function saveUpdates(_0x2aa84b,_0xa02953){return function(_0x39e960){if(_0x39e960){return _0x39e960[_0x1697('0x21')](_0x2aa84b)[_0x1697('0x22')](function(_0xf87eda){return _0xf87eda;});}return null;};}function removeEntity(_0x5a5edc,_0x1764a3){return function(_0x169bb3){if(_0x169bb3){return _0x169bb3[_0x1697('0x23')]()[_0x1697('0x22')](function(){_0x5a5edc['status'](0xcc)[_0x1697('0x1a')]();});}};}function handleEntityNotFound(_0x49308a,_0x35f246){return function(_0x555b32){if(!_0x555b32){_0x49308a[_0x1697('0x18')](0x194);}return _0x555b32;};}function handleError(_0x5d57a5,_0x47bceb){_0x47bceb=_0x47bceb||0x1f4;return function(_0x1e8d1f){logger[_0x1697('0x24')](_0x1e8d1f[_0x1697('0x25')]);if(_0x1e8d1f[_0x1697('0x26')]){delete _0x1e8d1f[_0x1697('0x26')];}_0x5d57a5[_0x1697('0x19')](_0x47bceb)['send'](_0x1e8d1f);};}exports[_0x1697('0x21')]=function(_0xa65d99,_0x5cf33d){if(_0xa65d99[_0x1697('0x27')]['id']){delete _0xa65d99[_0x1697('0x27')]['id'];}return db[_0x1697('0x28')][_0x1697('0x29')]({'where':{'id':_0xa65d99[_0x1697('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5cf33d,null))[_0x1697('0x22')](saveUpdates(_0xa65d99[_0x1697('0x27')],null))['then'](respondWithResult(_0x5cf33d,null))[_0x1697('0x2b')](handleError(_0x5cf33d,null));};exports[_0x1697('0x23')]=function(_0x10cc35,_0x2796ae){return db[_0x1697('0x28')][_0x1697('0x29')]({'where':{'id':_0x10cc35['params']['id']}})['then'](handleEntityNotFound(_0x2796ae,null))['then'](removeEntity(_0x2796ae,null))[_0x1697('0x2b')](handleError(_0x2796ae,null));}; \ No newline at end of file +var _0x464c=['Action','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','update','then','end','stack','name','send','body','find','params','catch','destroy'];(function(_0x3a815e,_0x5e449e){var _0x3f5fe3=function(_0x3ee2c1){while(--_0x3ee2c1){_0x3a815e['push'](_0x3a815e['shift']());}};_0x3f5fe3(++_0x5e449e);}(_0x464c,0xc1));var _0xc464=function(_0x5d0609,_0x127562){_0x5d0609=_0x5d0609-0x0;var _0xaa3fd1=_0x464c[_0x5d0609];return _0xaa3fd1;};'use strict';var pdf=require(_0xc464('0x0'));var emlformat=require(_0xc464('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc464('0x2'));var jsonpatch=require(_0xc464('0x3'));var rp=require(_0xc464('0x4'));var moment=require(_0xc464('0x5'));var BPromise=require(_0xc464('0x6'));var Mustache=require(_0xc464('0x7'));var util=require('util');var path=require(_0xc464('0x8'));var sox=require(_0xc464('0x9'));var csv=require(_0xc464('0xa'));var ejs=require(_0xc464('0xb'));var fs=require('fs');var _=require(_0xc464('0xc'));var squel=require(_0xc464('0xd'));var crypto=require(_0xc464('0xe'));var jsforce=require(_0xc464('0xf'));var deskjs=require(_0xc464('0x10'));var toCsv=require(_0xc464('0xa'));var querystring=require(_0xc464('0x11'));var Papa=require(_0xc464('0x12'));var Redis=require(_0xc464('0x13'));var authService=require(_0xc464('0x14'));var qs=require(_0xc464('0x15'));var as=require(_0xc464('0x16'));var hardwareService=require(_0xc464('0x17'));var logger=require(_0xc464('0x18'))(_0xc464('0x19'));var utils=require(_0xc464('0x1a'));var config=require(_0xc464('0x1b'));var db=require(_0xc464('0x1c'))['db'];function respondWithStatusCode(_0x24cd2f,_0x5ada6a){_0x5ada6a=_0x5ada6a||0xcc;return function(_0x441378){if(_0x441378){return _0x24cd2f[_0xc464('0x1d')](_0x5ada6a);}return _0x24cd2f[_0xc464('0x1e')](_0x5ada6a)['end']();};}function respondWithResult(_0x39ae13,_0x5dd02f){_0x5dd02f=_0x5dd02f||0xc8;return function(_0x1dafab){if(_0x1dafab){return _0x39ae13['status'](_0x5dd02f)[_0xc464('0x1f')](_0x1dafab);}};}function respondWithFilteredResult(_0x250773,_0x36e30f){return function(_0x11914a){if(_0x11914a){var _0x2cd23d=_0x11914a['count'],_0x124366=_0x36e30f[_0xc464('0x20')],_0x347284=_0x36e30f['offset']+_0x36e30f[_0xc464('0x21')],_0x5171a5;if(_0x347284>=_0x2cd23d){_0x347284=_0x2cd23d;_0x5171a5=0xc8;}else{_0x5171a5=0xce;}_0x250773[_0xc464('0x1e')](_0x5171a5);return _0x250773[_0xc464('0x22')](_0xc464('0x23'),_0x124366+'-'+_0x347284+'/'+_0x2cd23d)[_0xc464('0x1f')](_0x11914a);}return null;};}function patchUpdates(_0x35fbc6){return function(_0x49f4ca){try{jsonpatch['apply'](_0x49f4ca,_0x35fbc6,!![]);}catch(_0x41dfd8){return BPromise['reject'](_0x41dfd8);}return _0x49f4ca['save']();};}function saveUpdates(_0x39c3f2,_0x332bb9){return function(_0x41b8f6){if(_0x41b8f6){return _0x41b8f6[_0xc464('0x24')](_0x39c3f2)[_0xc464('0x25')](function(_0x439a58){return _0x439a58;});}return null;};}function removeEntity(_0x1b2db7,_0x2b7752){return function(_0x1654ee){if(_0x1654ee){return _0x1654ee['destroy']()[_0xc464('0x25')](function(){_0x1b2db7[_0xc464('0x1e')](0xcc)[_0xc464('0x26')]();});}};}function handleEntityNotFound(_0x74e202,_0x5b6c13){return function(_0x360f15){if(!_0x360f15){_0x74e202[_0xc464('0x1d')](0x194);}return _0x360f15;};}function handleError(_0x18139e,_0x25c29e){_0x25c29e=_0x25c29e||0x1f4;return function(_0x35ceee){logger['error'](_0x35ceee[_0xc464('0x27')]);if(_0x35ceee[_0xc464('0x28')]){delete _0x35ceee[_0xc464('0x28')];}_0x18139e['status'](_0x25c29e)[_0xc464('0x29')](_0x35ceee);};}exports[_0xc464('0x24')]=function(_0x37f559,_0xe2eedf){if(_0x37f559[_0xc464('0x2a')]['id']){delete _0x37f559['body']['id'];}return db['Action'][_0xc464('0x2b')]({'where':{'id':_0x37f559[_0xc464('0x2c')]['id']}})[_0xc464('0x25')](handleEntityNotFound(_0xe2eedf,null))['then'](saveUpdates(_0x37f559['body'],null))[_0xc464('0x25')](respondWithResult(_0xe2eedf,null))[_0xc464('0x2d')](handleError(_0xe2eedf,null));};exports[_0xc464('0x2e')]=function(_0x29079a,_0x19cf2a){return db[_0xc464('0x2f')][_0xc464('0x2b')]({'where':{'id':_0x29079a[_0xc464('0x2c')]['id']}})[_0xc464('0x25')](handleEntityNotFound(_0x19cf2a,null))[_0xc464('0x25')](removeEntity(_0x19cf2a,null))[_0xc464('0x2d')](handleError(_0x19cf2a,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 3ef710b..deac726 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 _0xec9d=['../../config/environment','./action.attributes','define','Action','tools_actions','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3a35fd,_0x28dee1){var _0x4bf833=function(_0x57ee75){while(--_0x57ee75){_0x3a35fd['push'](_0x3a35fd['shift']());}};_0x4bf833(++_0x28dee1);}(_0xec9d,0x1d3));var _0xdec9=function(_0x3b428b,_0xaf2f38){_0x3b428b=_0x3b428b-0x0;var _0x11a0c4=_0xec9d[_0x3b428b];return _0x11a0c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdec9('0x0'))(_0xdec9('0x1'));var moment=require(_0xdec9('0x2'));var BPromise=require(_0xdec9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdec9('0x4'));var rimraf=require(_0xdec9('0x5'));var config=require(_0xdec9('0x6'));var attributes=require(_0xdec9('0x7'));module['exports']=function(_0x35152b,_0x316caa){return _0x35152b[_0xdec9('0x8')](_0xdec9('0x9'),attributes,{'tableName':_0xdec9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe872=['../../config/environment','./action.attributes','exports','Action','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x282f9a,_0x63dff){var _0x52528c=function(_0xcf1c4c){while(--_0xcf1c4c){_0x282f9a['push'](_0x282f9a['shift']());}};_0x52528c(++_0x63dff);}(_0xe872,0x1e4));var _0x2e87=function(_0x54929d,_0x2412dc){_0x54929d=_0x54929d-0x0;var _0x3f19ff=_0xe872[_0x54929d];return _0x3f19ff;};'use strict';var _=require(_0x2e87('0x0'));var util=require('util');var logger=require(_0x2e87('0x1'))(_0x2e87('0x2'));var moment=require(_0x2e87('0x3'));var BPromise=require(_0x2e87('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e87('0x5'));var rimraf=require('rimraf');var config=require(_0x2e87('0x6'));var attributes=require(_0x2e87('0x7'));module[_0x2e87('0x8')]=function(_0xf7ba9e,_0x424539){return _0xf7ba9e['define'](_0x2e87('0x9'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index e3ac554..d018354 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 _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(_0x50d78a,_0x1039c6){var _0x250b1d=function(_0x10c93a){while(--_0x10c93a){_0x50d78a['push'](_0x50d78a['shift']());}};_0x250b1d(++_0x1039c6);}(_0xe706,0xa3));var _0x6e70=function(_0x24c55d,_0x35e9f0){_0x24c55d=_0x24c55d-0x0;var _0x3776ba=_0xe706[_0x24c55d];return _0x3776ba;};'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 +var _0x70e0=['code','Action,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x61f1c2,_0x547805){var _0x259881=function(_0x1e90d4){while(--_0x1e90d4){_0x61f1c2['push'](_0x61f1c2['shift']());}};_0x259881(++_0x547805);}(_0x70e0,0x17b));var _0x070e=function(_0x5bcb07,_0xad9e2c){_0x5bcb07=_0x5bcb07-0x0;var _0x372b1a=_0x70e0[_0x5bcb07];return _0x372b1a;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('Action,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('Action,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 646740a..8e81f7a 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 _0xc25a=['../../config/environment','./action.controller','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4d6e55,_0x59afcc){var _0x2184c6=function(_0x59729b){while(--_0x59729b){_0x4d6e55['push'](_0x4d6e55['shift']());}};_0x2184c6(++_0x59afcc);}(_0xc25a,0x170));var _0xac25=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xc25a[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0xac25('0x0'));var util=require(_0xac25('0x1'));var path=require(_0xac25('0x2'));var timeout=require(_0xac25('0x3'));var express=require(_0xac25('0x4'));var router=express[_0xac25('0x5')]();var auth=require(_0xac25('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xac25('0x7'));var controller=require(_0xac25('0x8'));router['put'](_0xac25('0x9'),auth[_0xac25('0xa')](),controller[_0xac25('0xb')]);router[_0xac25('0xc')](_0xac25('0x9'),auth[_0xac25('0xa')](),controller[_0xac25('0xd')]);module[_0xac25('0xe')]=router; \ No newline at end of file +var _0x0f88=['Router','../../components/auth/service','../../config/environment','./action.controller','put','isAuthenticated','delete','/:id','destroy','util','path','connect-timeout','express'];(function(_0xbaf699,_0x4aa945){var _0x55a131=function(_0x219dd7){while(--_0x219dd7){_0xbaf699['push'](_0xbaf699['shift']());}};_0x55a131(++_0x4aa945);}(_0x0f88,0x10d));var _0x80f8=function(_0x482431,_0x22caff){_0x482431=_0x482431-0x0;var _0x484ade=_0x0f88[_0x482431];return _0x484ade;};'use strict';var multer=require('multer');var util=require(_0x80f8('0x0'));var path=require(_0x80f8('0x1'));var timeout=require(_0x80f8('0x2'));var express=require(_0x80f8('0x3'));var router=express[_0x80f8('0x4')]();var auth=require(_0x80f8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x80f8('0x6'));var controller=require(_0x80f8('0x7'));router[_0x80f8('0x8')]('/:id',auth[_0x80f8('0x9')](),controller['update']);router[_0x80f8('0xa')](_0x80f8('0xb'),auth[_0x80f8('0x9')](),controller[_0x80f8('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 4aaaf9b..a2ec28f 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 _0xaa88=['TEXT','sequelize','exports','STRING'];(function(_0x973ff3,_0x5906d2){var _0x4b2993=function(_0x3ddbff){while(--_0x3ddbff){_0x973ff3['push'](_0x973ff3['shift']());}};_0x4b2993(++_0x5906d2);}(_0xaa88,0x199));var _0x8aa8=function(_0x4ef734,_0x5826d){_0x4ef734=_0x4ef734-0x0;var _0x33a7cb=_0xaa88[_0x4ef734];return _0x33a7cb;};'use strict';var Sequelize=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]={'name':{'type':Sequelize[_0x8aa8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8aa8('0x2')]},'parent':{'type':Sequelize[_0x8aa8('0x2')]},'table':{'type':Sequelize[_0x8aa8('0x2')]},'conditions':{'type':Sequelize[_0x8aa8('0x3')]},'joins':{'type':Sequelize[_0x8aa8('0x3')]}}; \ No newline at end of file +var _0xc0d9=['sequelize','STRING','TEXT'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc0d9,0x13e));var _0x9c0d=function(_0x46dbf9,_0x1e517e){_0x46dbf9=_0x46dbf9-0x0;var _0x24572d=_0xc0d9[_0x46dbf9];return _0x24572d;};'use strict';var Sequelize=require(_0x9c0d('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c0d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9c0d('0x1')]},'parent':{'type':Sequelize[_0x9c0d('0x1')]},'table':{'type':Sequelize[_0x9c0d('0x1')]},'conditions':{'type':Sequelize[_0x9c0d('0x2')]},'joins':{'type':Sequelize[_0x9c0d('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index e5adb11..78d5889 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 _0xaf79=['reject','save','update','then','destroy','UserProfileResource','stack','name','send','fieldName','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','type','merge','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','role','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','IS\x20EMPTY','IS\x20NOT\x20EMPTY','getFields','DESC','clone','ValidationErrorItem','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','select','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0xaf79,0x82));var _0x9af7=function(_0x3a69c8,_0xf641ce){_0x3a69c8=_0x3a69c8-0x0;var _0x17896b=_0xaf79[_0x3a69c8];return _0x17896b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9af7('0x0'));var rimraf=require(_0x9af7('0x1'));var zipdir=require(_0x9af7('0x2'));var jsonpatch=require(_0x9af7('0x3'));var rp=require(_0x9af7('0x4'));var moment=require(_0x9af7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9af7('0x6'));var util=require(_0x9af7('0x7'));var path=require(_0x9af7('0x8'));var sox=require(_0x9af7('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9af7('0xa'));var squel=require(_0x9af7('0xb'));var crypto=require(_0x9af7('0xc'));var jsforce=require(_0x9af7('0xd'));var deskjs=require(_0x9af7('0xe'));var toCsv=require(_0x9af7('0xf'));var querystring=require(_0x9af7('0x10'));var Papa=require(_0x9af7('0x11'));var Redis=require(_0x9af7('0x12'));var authService=require(_0x9af7('0x13'));var qs=require(_0x9af7('0x14'));var as=require(_0x9af7('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9af7('0x16'))(_0x9af7('0x17'));var utils=require(_0x9af7('0x18'));var config=require(_0x9af7('0x19'));var db=require(_0x9af7('0x1a'))['db'];function respondWithStatusCode(_0x1f76b3,_0x70c042){_0x70c042=_0x70c042||0xcc;return function(_0x10ef85){if(_0x10ef85){return _0x1f76b3['sendStatus'](_0x70c042);}return _0x1f76b3['status'](_0x70c042)[_0x9af7('0x1b')]();};}function respondWithResult(_0x3f7b70,_0x1bf989){_0x1bf989=_0x1bf989||0xc8;return function(_0x264344){if(_0x264344){return _0x3f7b70[_0x9af7('0x1c')](_0x1bf989)[_0x9af7('0x1d')](_0x264344);}};}function respondWithFilteredResult(_0x37e741,_0x539cd5){return function(_0x5cd00e){if(_0x5cd00e){var _0x471c1a=_0x5cd00e[_0x9af7('0x1e')],_0x197f67=_0x539cd5[_0x9af7('0x1f')],_0x4e0cf3=_0x539cd5[_0x9af7('0x1f')]+_0x539cd5[_0x9af7('0x20')],_0x229e2f;if(_0x4e0cf3>=_0x471c1a){_0x4e0cf3=_0x471c1a;_0x229e2f=0xc8;}else{_0x229e2f=0xce;}_0x37e741[_0x9af7('0x1c')](_0x229e2f);return _0x37e741['set']('Content-Range',_0x197f67+'-'+_0x4e0cf3+'/'+_0x471c1a)['json'](_0x5cd00e);}return null;};}function patchUpdates(_0x3da4ec){return function(_0x8b1434){try{jsonpatch['apply'](_0x8b1434,_0x3da4ec,!![]);}catch(_0x45d0d7){return BPromise[_0x9af7('0x21')](_0x45d0d7);}return _0x8b1434[_0x9af7('0x22')]();};}function saveUpdates(_0x1302f9,_0x52a0bf){return function(_0x5cf9fc){if(_0x5cf9fc){return _0x5cf9fc[_0x9af7('0x23')](_0x1302f9)[_0x9af7('0x24')](function(_0x443a5b){return _0x443a5b;});}return null;};}function removeEntity(_0x42c957,_0x221c35){return function(_0x5ae169){if(_0x5ae169){return _0x5ae169[_0x9af7('0x25')]()[_0x9af7('0x24')](function(){var _0x517072=_0x5ae169['get']({'plain':!![]});var _0x3c20c2='CustomReports';return db[_0x9af7('0x26')][_0x9af7('0x25')]({'where':{'type':_0x3c20c2,'resourceId':_0x517072['id']}})['then'](function(){return _0x5ae169;});})['then'](function(){_0x42c957['status'](0xcc)[_0x9af7('0x1b')]();});}};}function handleEntityNotFound(_0x142890,_0x5ded35){return function(_0x4ab9ba){if(!_0x4ab9ba){_0x142890['sendStatus'](0x194);}return _0x4ab9ba;};}function handleError(_0x42cc55,_0x4ddbad){_0x4ddbad=_0x4ddbad||0x1f4;return function(_0x19f20c){logger['error'](_0x19f20c[_0x9af7('0x27')]);if(_0x19f20c[_0x9af7('0x28')]){delete _0x19f20c[_0x9af7('0x28')];}_0x42cc55[_0x9af7('0x1c')](_0x4ddbad)[_0x9af7('0x29')](_0x19f20c);};}exports['index']=function(_0x1f69da,_0x1edad2){var _0x4a74bd={},_0x167b05={},_0x45d6f2={'count':0x0,'rows':[]};var _0x509157=_['map'](db['AnalyticCustomReport']['rawAttributes'],function(_0x785a6c){return{'name':_0x785a6c[_0x9af7('0x2a')],'type':_0x785a6c['type'][_0x9af7('0x2b')]};});_0x167b05[_0x9af7('0x2c')]=_[_0x9af7('0x2d')](_0x509157,_0x9af7('0x28'));_0x167b05['query']=_[_0x9af7('0x2e')](_0x1f69da['query']);_0x167b05['filters']=_['intersection'](_0x167b05['model'],_0x167b05[_0x9af7('0x2f')]);_0x4a74bd['attributes']=_[_0x9af7('0x30')](_0x167b05['model'],qs['fields'](_0x1f69da[_0x9af7('0x2f')][_0x9af7('0x31')]));_0x4a74bd['attributes']=_0x4a74bd[_0x9af7('0x32')][_0x9af7('0x33')]?_0x4a74bd['attributes']:_0x167b05[_0x9af7('0x2c')];if(!_0x1f69da['query'][_0x9af7('0x34')](_0x9af7('0x35'))){_0x4a74bd['limit']=qs[_0x9af7('0x20')](_0x1f69da[_0x9af7('0x2f')][_0x9af7('0x20')]);_0x4a74bd[_0x9af7('0x1f')]=qs[_0x9af7('0x1f')](_0x1f69da[_0x9af7('0x2f')]['offset']);}_0x4a74bd[_0x9af7('0x36')]=qs[_0x9af7('0x37')](_0x1f69da[_0x9af7('0x2f')][_0x9af7('0x37')]);_0x4a74bd['where']=qs['filters'](_[_0x9af7('0x38')](_0x1f69da[_0x9af7('0x2f')],_0x167b05[_0x9af7('0x39')]));if(_0x1f69da['query']['filter']){_0x4a74bd[_0x9af7('0x3a')]=_['merge'](_0x4a74bd[_0x9af7('0x3a')],{'$or':_[_0x9af7('0x2d')](_0x509157,function(_0x53891c){if(_0x53891c[_0x9af7('0x3b')]!=='VIRTUAL'){var _0x64e2b1={};_0x64e2b1[_0x53891c[_0x9af7('0x28')]]={'$like':'%'+_0x1f69da[_0x9af7('0x2f')]['filter']+'%'};return _0x64e2b1;}})});}_0x4a74bd=_[_0x9af7('0x3c')]({},_0x4a74bd,_0x1f69da[_0x9af7('0x3d')]);var _0x30909c={'where':_0x4a74bd['where']};return db[_0x9af7('0x3e')][_0x9af7('0x1e')](_0x30909c)[_0x9af7('0x24')](function(_0x328828){_0x45d6f2[_0x9af7('0x1e')]=_0x328828;if(_0x1f69da[_0x9af7('0x2f')][_0x9af7('0x3f')]){_0x4a74bd[_0x9af7('0x40')]=[{'all':!![]}];}return db[_0x9af7('0x3e')][_0x9af7('0x41')](_0x4a74bd);})['then'](function(_0x1ad12d){_0x45d6f2[_0x9af7('0x42')]=_0x1ad12d;return _0x45d6f2;})[_0x9af7('0x24')](respondWithFilteredResult(_0x1edad2,_0x4a74bd))[_0x9af7('0x43')](handleError(_0x1edad2,null));};exports[_0x9af7('0x44')]=function(_0x22d8b7,_0xb0ea84){var _0x20261e={'raw':![],'where':{'id':_0x22d8b7[_0x9af7('0x45')]['id']}},_0x3241dc={};_0x3241dc[_0x9af7('0x2c')]=_['keys'](db[_0x9af7('0x3e')]['rawAttributes']);_0x3241dc['query']=_[_0x9af7('0x2e')](_0x22d8b7[_0x9af7('0x2f')]);_0x3241dc[_0x9af7('0x39')]=_['intersection'](_0x3241dc['model'],_0x3241dc['query']);_0x20261e[_0x9af7('0x32')]=_[_0x9af7('0x30')](_0x3241dc['model'],qs[_0x9af7('0x31')](_0x22d8b7[_0x9af7('0x2f')][_0x9af7('0x31')]));_0x20261e[_0x9af7('0x32')]=_0x20261e['attributes'][_0x9af7('0x33')]?_0x20261e['attributes']:_0x3241dc[_0x9af7('0x2c')];if(_0x22d8b7['query'][_0x9af7('0x3f')]){_0x20261e[_0x9af7('0x40')]=[{'all':!![]}];}_0x20261e=_[_0x9af7('0x3c')]({},_0x20261e,_0x22d8b7[_0x9af7('0x3d')]);return db[_0x9af7('0x3e')][_0x9af7('0x46')](_0x20261e)['then'](handleEntityNotFound(_0xb0ea84,null))[_0x9af7('0x24')](respondWithResult(_0xb0ea84,null))[_0x9af7('0x43')](handleError(_0xb0ea84,null));};exports[_0x9af7('0x47')]=function(_0x36bdd8,_0x340bf2){return db[_0x9af7('0x3e')][_0x9af7('0x47')](_0x36bdd8[_0x9af7('0x48')],{})['then'](function(_0x560862){var _0x2f5fa4=_0x36bdd8[_0x9af7('0x49')][_0x9af7('0x4a')]({'plain':!![]});if(!_0x2f5fa4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f5fa4[_0x9af7('0x4b')]===_0x9af7('0x49')){var _0x288af6=_0x560862[_0x9af7('0x4a')]({'plain':!![]});var _0x406a05=_0x9af7('0x4c');return db[_0x9af7('0x4d')]['find']({'where':{'name':_0x406a05,'userProfileId':_0x2f5fa4[_0x9af7('0x4e')]},'raw':!![]})[_0x9af7('0x24')](function(_0x448eb0){if(_0x448eb0&&_0x448eb0[_0x9af7('0x4f')]===0x0){return db[_0x9af7('0x26')]['create']({'name':_0x288af6[_0x9af7('0x28')],'resourceId':_0x288af6['id'],'type':_0x9af7('0x50'),'sectionId':_0x448eb0['id']},{})[_0x9af7('0x24')](function(){return _0x560862;});}else{return _0x560862;}})[_0x9af7('0x43')](function(_0x560181){logger[_0x9af7('0x51')](_0x9af7('0x52'),_0x560181);throw _0x560181;});}return _0x560862;})[_0x9af7('0x24')](respondWithResult(_0x340bf2,0xc9))[_0x9af7('0x43')](handleError(_0x340bf2,null));};exports[_0x9af7('0x23')]=function(_0x311ac0,_0x33b121){if(_0x311ac0[_0x9af7('0x48')]['id']){delete _0x311ac0[_0x9af7('0x48')]['id'];}return db['AnalyticCustomReport'][_0x9af7('0x46')]({'where':{'id':_0x311ac0[_0x9af7('0x45')]['id']}})['then'](handleEntityNotFound(_0x33b121,null))[_0x9af7('0x24')](saveUpdates(_0x311ac0[_0x9af7('0x48')],null))[_0x9af7('0x24')](respondWithResult(_0x33b121,null))[_0x9af7('0x43')](handleError(_0x33b121,null));};exports['destroy']=function(_0x1fe94f,_0x193b5e){return db[_0x9af7('0x3e')][_0x9af7('0x46')]({'where':{'id':_0x1fe94f[_0x9af7('0x45')]['id']}})[_0x9af7('0x24')](handleEntityNotFound(_0x193b5e,null))[_0x9af7('0x24')](removeEntity(_0x193b5e,null))['catch'](handleError(_0x193b5e,null));};exports[_0x9af7('0x53')]=function(_0x46d532,_0x58957a){var _0x4b9507=0xa;var _0x4d9f8f=[_0x9af7('0x54'),_0x9af7('0x55'),_0x9af7('0x56'),'cross_join'];var _0x4f2da6={'SUM':_0x9af7('0x57'),'COUNT':_0x9af7('0x58'),'COUNT DISTINCT':_0x9af7('0x59'),'MAX':_0x9af7('0x5a'),'MIN':_0x9af7('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9af7('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9af7('0x5d')};var _0x157c76={'SEC_TO_TIME':_0x9af7('0x5e'),'DATE':'DATE(%s)','HOUR':_0x9af7('0x5f'),'ROUND':_0x9af7('0x60'),'UNIX_TIMESTAMP':_0x9af7('0x61')};var _0x1bda65=function(_0x300288){return!_[_0x9af7('0x62')]([_0x9af7('0x63'),_0x9af7('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x300288);};var _0x5c917b=function(_0x54d3c8){if(!_0x54d3c8||!_0x54d3c8[_0x9af7('0x65')][_0x9af7('0x33')]){return'';}for(var _0x2569a9='(',_0x2114c9=0x0;_0x2114c9<_0x54d3c8[_0x9af7('0x65')][_0x9af7('0x33')];_0x2114c9+=0x1){_0x2114c9>0x0&&(_0x2569a9+='\x20'+_0x54d3c8[_0x9af7('0x66')]+'\x20');_0x2569a9+=_0x54d3c8['rules'][_0x2114c9][_0x9af7('0x67')]?_0x5c917b(_0x54d3c8[_0x9af7('0x65')][_0x2114c9]['group']):_0x54d3c8[_0x9af7('0x65')][_0x2114c9][_0x9af7('0x68')]+'\x20'+_0x54d3c8['rules'][_0x2114c9][_0x9af7('0x69')]+(_0x1bda65(_0x54d3c8['rules'][_0x2114c9][_0x9af7('0x69')])?'\x20'+_0x54d3c8[_0x9af7('0x65')][_0x2114c9][_0x9af7('0x6a')]:'');}return _0x2569a9+')';};var _0x5f1fe1={'where':{'id':_0x46d532['params']['id']}},_0x460a86,_0x44579a,_0xf3dbc8,_0x199786,_0x17ef34;_0x5f1fe1=_[_0x9af7('0x3c')]({},_0x5f1fe1,_0x46d532[_0x9af7('0x3d')]);return db[_0x9af7('0x3e')][_0x9af7('0x46')](_0x5f1fe1)[_0x9af7('0x24')](function(_0x5c98f6){if(_0x5c98f6){_0x460a86=_0x5c98f6;return _0x5c98f6['getFields']();}return null;})[_0x9af7('0x24')](function(_0x10a0cd){if(_0x10a0cd){if(!_0x10a0cd[_0x9af7('0x33')]){throw new db[(_0x9af7('0x6b'))]['ValidationErrorItem'](_0x9af7('0x6c'),0x193);}_0x44579a=_0x10a0cd;return db[_0x9af7('0x6d')][_0x9af7('0x41')]({'raw':!![]});}return null;})['then'](function(_0x3275a5){if(_0x3275a5){_0xf3dbc8=_[_0x9af7('0x6e')](_0x3275a5,'id');var _0x112bf3;var _0x47cda9=squel['select']();_0x47cda9[_0x9af7('0x6f')](_0x460a86[_0x9af7('0x70')]);for(var _0x340b60=0x0;_0x340b60<_0x44579a[_0x9af7('0x33')];_0x340b60+=0x1){_0x112bf3=_0x44579a[_0x340b60][_0x9af7('0x71')]?_0xf3dbc8[_0x44579a[_0x340b60][_0x9af7('0x71')]][_0x9af7('0x72')]:_0x44579a[_0x340b60][_0x9af7('0x68')];_0x112bf3=_0x44579a[_0x340b60][_0x9af7('0x73')]?_[_0x9af7('0x74')](_0x4f2da6[_0x44579a[_0x340b60][_0x9af7('0x73')]],'%s',_0x112bf3):_0x112bf3;_0x112bf3=_0x44579a[_0x340b60][_0x9af7('0x75')]?_[_0x9af7('0x74')](_0x157c76[_0x44579a[_0x340b60][_0x9af7('0x75')]],'%s',_0x112bf3):_0x112bf3;if(_0x44579a[_0x340b60][_0x9af7('0x76')]){_0x47cda9[_0x9af7('0x67')](_0x112bf3);}_0x44579a[_0x340b60][_0x9af7('0x77')]&&_0x47cda9[_0x9af7('0x36')](_0x112bf3,_0x44579a[_0x340b60][_0x9af7('0x77')]==='DESC'?![]:!![]);_0x47cda9[_0x9af7('0x68')](_0x112bf3,_0x44579a[_0x340b60][_0x9af7('0x78')]||_0x112bf3);}if(_0x460a86['joins']){_0x460a86[_0x9af7('0x79')]=JSON[_0x9af7('0x7a')](_0x460a86[_0x9af7('0x79')]);for(var _0x30bade=0x0;_0x30bade<_0x460a86[_0x9af7('0x79')]['length'];_0x30bade+=0x1){if(_0x460a86[_0x9af7('0x79')][_0x30bade][_0x9af7('0x3b')]&&_[_0x9af7('0x62')](_0x4d9f8f,_0x460a86[_0x9af7('0x79')][_0x30bade][_0x9af7('0x3b')])&&_0x460a86[_0x9af7('0x79')][_0x30bade]['parentKey']&&_0x460a86['joins'][_0x30bade][_0x9af7('0x7b')]&&_0x460a86[_0x9af7('0x79')][_0x30bade][_0x9af7('0x7c')]){_0x47cda9[_0x460a86[_0x9af7('0x79')][_0x30bade][_0x9af7('0x3b')]](_0x460a86[_0x9af7('0x79')][_0x30bade][_0x9af7('0x7b')],null,util[_0x9af7('0x75')](_0x9af7('0x7d'),_0x460a86['table'],_0x460a86[_0x9af7('0x79')][_0x30bade][_0x9af7('0x7e')],_0x460a86[_0x9af7('0x79')][_0x30bade][_0x9af7('0x7b')],_0x460a86[_0x9af7('0x79')][_0x30bade][_0x9af7('0x7c')]));}}}if(_0x460a86[_0x9af7('0x7f')]){_0x460a86[_0x9af7('0x7f')]=JSON[_0x9af7('0x7a')](_0x460a86[_0x9af7('0x7f')]);_0x47cda9[_0x9af7('0x3a')](_0x5c917b(_0x460a86['conditions'][_0x9af7('0x67')]));}_0x17ef34=_0x47cda9['clone']();_0x47cda9[_0x9af7('0x20')](_0x4b9507);_0x47cda9[_0x9af7('0x1f')](0x0);logger[_0x9af7('0x80')](_0x9af7('0x81'),_0x47cda9[_0x9af7('0x82')]());return db['sequelize'][_0x9af7('0x2f')](_0x47cda9['toString'](),{'type':db[_0x9af7('0x83')][_0x9af7('0x84')][_0x9af7('0x85')]});}})[_0x9af7('0x24')](respondWithResult(_0x58957a,null))[_0x9af7('0x43')](handleError(_0x58957a,null));};function runReport(_0x359c78,_0xd5e1e9,_0x42f79c){var _0x5a94d7=_0xd5e1e9[_0x9af7('0x28')];var _0x2552c5=0xa;var _0x226001=['join',_0x9af7('0x55'),'right_join',_0x9af7('0x86')];var _0x45ff30={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x9af7('0x59'),'MAX':_0x9af7('0x5a'),'MIN':_0x9af7('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9af7('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9af7('0x5d')};var _0x24c10a={'SEC_TO_TIME':_0x9af7('0x5e'),'DATE':'DATE(%s)','HOUR':_0x9af7('0x5f'),'ROUND':_0x9af7('0x60'),'UNIX_TIMESTAMP':_0x9af7('0x61')};var _0xada9fe=function(_0x2d29b7){return!_['includes']([_0x9af7('0x63'),_0x9af7('0x64'),_0x9af7('0x87'),_0x9af7('0x88')],_0x2d29b7);};var _0x4ca5ac=function(_0x167712){if(!_0x167712||!_0x167712['rules'][_0x9af7('0x33')]){return'';}for(var _0x33852d='(',_0xae0ba0=0x0;_0xae0ba0<_0x167712[_0x9af7('0x65')][_0x9af7('0x33')];_0xae0ba0+=0x1){_0xae0ba0>0x0&&(_0x33852d+='\x20'+_0x167712[_0x9af7('0x66')]+'\x20');_0x33852d+=_0x167712[_0x9af7('0x65')][_0xae0ba0][_0x9af7('0x67')]?_0x4ca5ac(_0x167712['rules'][_0xae0ba0]['group']):_0x167712[_0x9af7('0x65')][_0xae0ba0][_0x9af7('0x68')]+'\x20'+_0x167712[_0x9af7('0x65')][_0xae0ba0][_0x9af7('0x69')]+(_0xada9fe(_0x167712[_0x9af7('0x65')][_0xae0ba0]['condition'])?'\x20'+_0x167712[_0x9af7('0x65')][_0xae0ba0][_0x9af7('0x6a')]:'');}return _0x33852d+')';};var _0x2755bf={'where':{'id':_0x359c78['id']}},_0x2e456c,_0xf5252f,_0x62f707,_0x54e2e2,_0x4f7bb4;_0x2755bf=_['merge']({},_0x2755bf,_0x42f79c);return db['AnalyticCustomReport'][_0x9af7('0x46')](_0x2755bf)[_0x9af7('0x24')](function(_0x49d473){if(_0x49d473){_0x2e456c=_0x49d473;return _0x49d473[_0x9af7('0x89')]();}return null;})[_0x9af7('0x24')](function(_0x476275){if(_0x476275){if(!_0x476275['length']){throw new db[(_0x9af7('0x6b'))]['ValidationErrorItem'](_0x9af7('0x6c'),0x193);}_0xf5252f=_0x476275;return db[_0x9af7('0x6d')][_0x9af7('0x41')]({'raw':!![]});}return null;})['then'](function(_0x535cdd){if(_0x535cdd){_0x62f707=_[_0x9af7('0x6e')](_0x535cdd,'id');var _0x3019fa;var _0x1c02e7=squel['select']();_0x1c02e7[_0x9af7('0x6f')](_0x2e456c[_0x9af7('0x70')]);for(var _0x245e89=0x0;_0x245e89<_0xf5252f[_0x9af7('0x33')];_0x245e89+=0x1){_0x3019fa=_0xf5252f[_0x245e89][_0x9af7('0x71')]?_0x62f707[_0xf5252f[_0x245e89][_0x9af7('0x71')]][_0x9af7('0x72')]:_0xf5252f[_0x245e89]['field'];_0x3019fa=_0xf5252f[_0x245e89][_0x9af7('0x73')]?_[_0x9af7('0x74')](_0x45ff30[_0xf5252f[_0x245e89][_0x9af7('0x73')]],'%s',_0x3019fa):_0x3019fa;_0x3019fa=_0xf5252f[_0x245e89][_0x9af7('0x75')]?_[_0x9af7('0x74')](_0x24c10a[_0xf5252f[_0x245e89][_0x9af7('0x75')]],'%s',_0x3019fa):_0x3019fa;if(_0xf5252f[_0x245e89][_0x9af7('0x76')]){_0x1c02e7[_0x9af7('0x67')](_0x3019fa);}_0xf5252f[_0x245e89][_0x9af7('0x77')]&&_0x1c02e7[_0x9af7('0x36')](_0x3019fa,_0xf5252f[_0x245e89][_0x9af7('0x77')]===_0x9af7('0x8a')?![]:!![]);_0x1c02e7[_0x9af7('0x68')](_0x3019fa,_0xf5252f[_0x245e89][_0x9af7('0x78')]||_0x3019fa);}if(_0x2e456c[_0x9af7('0x79')]){_0x2e456c[_0x9af7('0x79')]=JSON[_0x9af7('0x7a')](_0x2e456c[_0x9af7('0x79')]);for(var _0x45f49d=0x0;_0x45f49d<_0x2e456c['joins'][_0x9af7('0x33')];_0x45f49d+=0x1){if(_0x2e456c['joins'][_0x45f49d][_0x9af7('0x3b')]&&_['includes'](_0x226001,_0x2e456c[_0x9af7('0x79')][_0x45f49d]['type'])&&_0x2e456c[_0x9af7('0x79')][_0x45f49d][_0x9af7('0x7e')]&&_0x2e456c[_0x9af7('0x79')][_0x45f49d][_0x9af7('0x7b')]&&_0x2e456c[_0x9af7('0x79')][_0x45f49d]['foreignKey']){_0x1c02e7[_0x2e456c[_0x9af7('0x79')][_0x45f49d]['type']](_0x2e456c[_0x9af7('0x79')][_0x45f49d][_0x9af7('0x7b')],null,util['format'](_0x9af7('0x7d'),_0x2e456c[_0x9af7('0x70')],_0x2e456c[_0x9af7('0x79')][_0x45f49d][_0x9af7('0x7e')],_0x2e456c[_0x9af7('0x79')][_0x45f49d]['foreignTable'],_0x2e456c['joins'][_0x45f49d][_0x9af7('0x7c')]));}}}if(_0x2e456c['conditions']){_0x2e456c['conditions']=JSON[_0x9af7('0x7a')](_0x2e456c[_0x9af7('0x7f')]);_0x1c02e7['where'](_0x4ca5ac(_0x2e456c['conditions'][_0x9af7('0x67')]));}_0x4f7bb4=_0x1c02e7[_0x9af7('0x8b')]();_0x1c02e7[_0x9af7('0x20')](_0x2552c5);_0x1c02e7[_0x9af7('0x1f')](0x0);logger[_0x9af7('0x80')](_0x9af7('0x81'),_0x1c02e7[_0x9af7('0x82')]());return db[_0x9af7('0x83')][_0x9af7('0x2f')](_0x1c02e7[_0x9af7('0x82')](),{'type':db[_0x9af7('0x83')][_0x9af7('0x84')][_0x9af7('0x85')]});}})[_0x9af7('0x24')](function(_0x53ba6f){if(!_0x53ba6f[_0x9af7('0x33')]){throw new db[(_0x9af7('0x6b'))][(_0x9af7('0x8c'))]('No\x20available\x20data',0xcc);}if(_0xd5e1e9[_0x9af7('0x8d')]===_0x9af7('0x8e')){return null;}var _0x3239e6=_['merge'](_0xd5e1e9,{'name':_0xd5e1e9[_0x9af7('0x8f')]||_0xd5e1e9[_0x9af7('0x28')]||_0x2e456c[_0x9af7('0x28')],'basename':_0x5a94d7,'savename':util[_0x9af7('0x75')]('%s-%s.%s',_0xd5e1e9[_0x9af7('0x28')]||_0x2e456c[_0x9af7('0x28')],require(_0x9af7('0x90'))[_0x9af7('0x91')](0x4),_0xd5e1e9[_0x9af7('0x8d')]||_0x9af7('0x92')),'reportId':_0x2e456c['id'],'reportType':_0x9af7('0x93')});return db[_0x9af7('0x94')]['create'](_0x3239e6,{'raw':!![]});})[_0x9af7('0x24')](function(_0x543669){if(_0x2e456c[_0x9af7('0x70')]===_0x9af7('0x95')){_0x4f7bb4[_0x9af7('0x3a')](_0x2e456c['table']+_0x9af7('0x96'),_0xd5e1e9[_0x9af7('0x97')],_0xd5e1e9[_0x9af7('0x98')]);}else{_0x4f7bb4[_0x9af7('0x3a')](_0x2e456c[_0x9af7('0x70')]+_0x9af7('0x99'),_0xd5e1e9[_0x9af7('0x97')],_0xd5e1e9[_0x9af7('0x98')]);}if(_0x543669){logger[_0x9af7('0x9a')]('Run\x20Query:',_0x4f7bb4[_0x9af7('0x82')]());require(_0x9af7('0x9b'))[_0x9af7('0x9c')](path[_0x9af7('0x54')](__dirname,_0x9af7('0x9d'),_0x543669['output']),[_0x543669['id'],_0x4f7bb4[_0x9af7('0x82')](),path[_0x9af7('0x54')](__dirname,_0x9af7('0x9e'),_0x543669['savename']),_0x5a94d7]);return _0x543669;}else{var _0x5eebfe=squel[_0x9af7('0x9f')]();_0x5eebfe['from']('('+_0x4f7bb4['toString']()+')','countTable');_0x5eebfe[_0x9af7('0x68')]('COUNT(*)',_0x9af7('0x1e'));_0x4f7bb4[_0x9af7('0x20')](_0xd5e1e9[_0x9af7('0x20')]||_0x2552c5);_0x4f7bb4[_0x9af7('0x1f')](_0xd5e1e9[_0x9af7('0x1f')]||0x0);return db['sequelize'][_0x9af7('0x2f')](_0x5eebfe['toString'](),{'type':db[_0x9af7('0x83')]['QueryTypes'][_0x9af7('0x85')]})[_0x9af7('0x24')](function(_0x2bb910){if(!_0x2bb910[_0x9af7('0x33')]){_0x54e2e2=0x0;}else{_0x54e2e2=_0x2bb910[0x0][_0x9af7('0x1e')]||0x0;}return db[_0x9af7('0x83')]['query'](_0x4f7bb4[_0x9af7('0x82')](),{'type':db['sequelize'][_0x9af7('0x84')][_0x9af7('0x85')]});})['then'](function(_0x38a0a3){return{'rows':_0x38a0a3||[],'count':_0x54e2e2};});}});}exports['run']=function(_0x49daa9,_0x1505f7){return runReport(_0x49daa9['params'],_0x49daa9[_0x9af7('0x2f')],_0x49daa9[_0x9af7('0x3d')])[_0x9af7('0x24')](respondWithResult(_0x1505f7,null))[_0x9af7('0x43')](handleError(_0x1505f7,null));};exports[_0x9af7('0xa0')]=runReport;exports['query']=function(_0x5b02aa,_0x349b6d){var _0x23968d=0xa;var _0x11c60a=[_0x9af7('0x54'),_0x9af7('0x55'),'right_join','cross_join'];var _0x32460b={'SUM':_0x9af7('0x57'),'COUNT':_0x9af7('0x58'),'COUNT DISTINCT':_0x9af7('0x59'),'MAX':_0x9af7('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x9af7('0x5c'),'GROUP_CONCAT ASC':_0x9af7('0xa1'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x58f920={'SEC_TO_TIME':_0x9af7('0x5e'),'DATE':_0x9af7('0xa2'),'HOUR':'HOUR(%s)','ROUND':_0x9af7('0x60'),'UNIX_TIMESTAMP':_0x9af7('0x61')};var _0x142e97=function(_0x8f6056){return!_[_0x9af7('0x62')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0x9af7('0x88')],_0x8f6056);};var _0x5e36b7=function(_0x44a4dd){if(!_0x44a4dd||!_0x44a4dd[_0x9af7('0x65')]['length']){return'';}for(var _0x207ad6='(',_0x5f04e7=0x0;_0x5f04e7<_0x44a4dd[_0x9af7('0x65')]['length'];_0x5f04e7+=0x1){_0x5f04e7>0x0&&(_0x207ad6+='\x20'+_0x44a4dd[_0x9af7('0x66')]+'\x20');_0x207ad6+=_0x44a4dd['rules'][_0x5f04e7][_0x9af7('0x67')]?_0x5e36b7(_0x44a4dd[_0x9af7('0x65')][_0x5f04e7][_0x9af7('0x67')]):_0x44a4dd['rules'][_0x5f04e7][_0x9af7('0x68')]+'\x20'+_0x44a4dd[_0x9af7('0x65')][_0x5f04e7][_0x9af7('0x69')]+(_0x142e97(_0x44a4dd[_0x9af7('0x65')][_0x5f04e7][_0x9af7('0x69')])?'\x20'+_0x44a4dd[_0x9af7('0x65')][_0x5f04e7][_0x9af7('0x6a')]:'');}return _0x207ad6+')';};var _0x5cd0c5={'where':{'id':_0x5b02aa[_0x9af7('0x45')]['id']}},_0x161bc1,_0x4800ce,_0x44e04d,_0x40adda,_0x59eb55;_0x5cd0c5=_[_0x9af7('0x3c')]({},_0x5cd0c5,_0x5b02aa['options']);return db[_0x9af7('0x3e')][_0x9af7('0x46')](_0x5cd0c5)[_0x9af7('0x24')](function(_0x40014b){if(_0x40014b){_0x161bc1=_0x40014b;return _0x40014b[_0x9af7('0x89')]();}return null;})[_0x9af7('0x24')](function(_0x3d5ce1){if(_0x3d5ce1){if(!_0x3d5ce1[_0x9af7('0x33')]){throw new db[(_0x9af7('0x6b'))]['ValidationErrorItem'](_0x9af7('0x6c'),0x193);}_0x4800ce=_0x3d5ce1;return db[_0x9af7('0x6d')]['findAll']({'raw':!![]});}return null;})[_0x9af7('0x24')](function(_0x1b5a9e){if(_0x1b5a9e){_0x44e04d=_['keyBy'](_0x1b5a9e,'id');var _0x1d2b05;var _0xf2c615=squel[_0x9af7('0x9f')]();_0xf2c615[_0x9af7('0x6f')](_0x161bc1[_0x9af7('0x70')]);for(var _0x5255a4=0x0;_0x5255a4<_0x4800ce[_0x9af7('0x33')];_0x5255a4+=0x1){_0x1d2b05=_0x4800ce[_0x5255a4][_0x9af7('0x71')]?_0x44e04d[_0x4800ce[_0x5255a4]['MetricId']][_0x9af7('0x72')]:_0x4800ce[_0x5255a4]['field'];_0x1d2b05=_0x4800ce[_0x5255a4]['function']?_[_0x9af7('0x74')](_0x32460b[_0x4800ce[_0x5255a4]['function']],'%s',_0x1d2b05):_0x1d2b05;_0x1d2b05=_0x4800ce[_0x5255a4][_0x9af7('0x75')]?_['replace'](_0x58f920[_0x4800ce[_0x5255a4][_0x9af7('0x75')]],'%s',_0x1d2b05):_0x1d2b05;if(_0x4800ce[_0x5255a4]['groupBy']){_0xf2c615['group'](_0x1d2b05);}_0x4800ce[_0x5255a4][_0x9af7('0x77')]&&_0xf2c615[_0x9af7('0x36')](_0x1d2b05,_0x4800ce[_0x5255a4][_0x9af7('0x77')]==='DESC'?![]:!![]);_0xf2c615[_0x9af7('0x68')](_0x1d2b05,_0x4800ce[_0x5255a4][_0x9af7('0x78')]||_0x1d2b05);}if(_0x161bc1['joins']){_0x161bc1[_0x9af7('0x79')]=JSON['parse'](_0x161bc1[_0x9af7('0x79')]);for(var _0x1204f7=0x0;_0x1204f7<_0x161bc1[_0x9af7('0x79')][_0x9af7('0x33')];_0x1204f7+=0x1){if(_0x161bc1['joins'][_0x1204f7][_0x9af7('0x3b')]&&_['includes'](_0x11c60a,_0x161bc1['joins'][_0x1204f7]['type'])&&_0x161bc1[_0x9af7('0x79')][_0x1204f7]['parentKey']&&_0x161bc1[_0x9af7('0x79')][_0x1204f7][_0x9af7('0x7b')]&&_0x161bc1[_0x9af7('0x79')][_0x1204f7][_0x9af7('0x7c')]){_0xf2c615[_0x161bc1[_0x9af7('0x79')][_0x1204f7][_0x9af7('0x3b')]](_0x161bc1['joins'][_0x1204f7][_0x9af7('0x7b')],null,util[_0x9af7('0x75')](_0x9af7('0x7d'),_0x161bc1[_0x9af7('0x70')],_0x161bc1[_0x9af7('0x79')][_0x1204f7]['parentKey'],_0x161bc1[_0x9af7('0x79')][_0x1204f7]['foreignTable'],_0x161bc1[_0x9af7('0x79')][_0x1204f7][_0x9af7('0x7c')]));}}}if(_0x161bc1['conditions']){_0x161bc1[_0x9af7('0x7f')]=JSON[_0x9af7('0x7a')](_0x161bc1[_0x9af7('0x7f')]);_0xf2c615['where'](_0x5e36b7(_0x161bc1['conditions'][_0x9af7('0x67')]));}_0x59eb55=_0xf2c615[_0x9af7('0x8b')]();_0xf2c615[_0x9af7('0x20')](_0x23968d);_0xf2c615[_0x9af7('0x1f')](0x0);logger['debug'](_0x9af7('0x81'),_0xf2c615[_0x9af7('0x82')]());return db[_0x9af7('0x83')]['query'](_0xf2c615[_0x9af7('0x82')](),{'type':db['sequelize'][_0x9af7('0x84')][_0x9af7('0x85')]});}})['then'](function(){return{'sql':_0x59eb55['toString']()};})[_0x9af7('0x24')](respondWithResult(_0x349b6d,null))[_0x9af7('0x43')](handleError(_0x349b6d,null));}; \ No newline at end of file +var _0x7ed2=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','DESC','alias','SELECT','No\x20available\x20data','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','runReport','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','save','update','then','destroy','get','stack','name','send','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','left_join','right_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','AnalyticMetric','findAll','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','COUNT(%s)','COUNT(DISTINCT\x20%s)','includes','getFields'];(function(_0x3af542,_0x3d4e5f){var _0x5f1716=function(_0x1990e6){while(--_0x1990e6){_0x3af542['push'](_0x3af542['shift']());}};_0x5f1716(++_0x3d4e5f);}(_0x7ed2,0x16b));var _0x27ed=function(_0x59a488,_0x2475ae){_0x59a488=_0x59a488-0x0;var _0x1ad526=_0x7ed2[_0x59a488];return _0x1ad526;};'use strict';var pdf=require(_0x27ed('0x0'));var emlformat=require(_0x27ed('0x1'));var rimraf=require(_0x27ed('0x2'));var zipdir=require(_0x27ed('0x3'));var jsonpatch=require(_0x27ed('0x4'));var rp=require(_0x27ed('0x5'));var moment=require(_0x27ed('0x6'));var BPromise=require(_0x27ed('0x7'));var Mustache=require(_0x27ed('0x8'));var util=require(_0x27ed('0x9'));var path=require(_0x27ed('0xa'));var sox=require(_0x27ed('0xb'));var csv=require('to-csv');var ejs=require(_0x27ed('0xc'));var fs=require('fs');var _=require(_0x27ed('0xd'));var squel=require(_0x27ed('0xe'));var crypto=require(_0x27ed('0xf'));var jsforce=require(_0x27ed('0x10'));var deskjs=require(_0x27ed('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x27ed('0x12'));var Redis=require('ioredis');var authService=require(_0x27ed('0x13'));var qs=require(_0x27ed('0x14'));var as=require(_0x27ed('0x15'));var hardwareService=require(_0x27ed('0x16'));var logger=require(_0x27ed('0x17'))(_0x27ed('0x18'));var utils=require(_0x27ed('0x19'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d5d08,_0x40b1b8){_0x40b1b8=_0x40b1b8||0xcc;return function(_0x3e2ed3){if(_0x3e2ed3){return _0x5d5d08[_0x27ed('0x1a')](_0x40b1b8);}return _0x5d5d08[_0x27ed('0x1b')](_0x40b1b8)[_0x27ed('0x1c')]();};}function respondWithResult(_0x2622ab,_0x23e1cc){_0x23e1cc=_0x23e1cc||0xc8;return function(_0x24c0bb){if(_0x24c0bb){return _0x2622ab['status'](_0x23e1cc)[_0x27ed('0x1d')](_0x24c0bb);}};}function respondWithFilteredResult(_0x50840b,_0x19bdf5){return function(_0x4c7aa3){if(_0x4c7aa3){var _0x1ba62b=_0x4c7aa3[_0x27ed('0x1e')],_0x38789c=_0x19bdf5[_0x27ed('0x1f')],_0x395935=_0x19bdf5['offset']+_0x19bdf5[_0x27ed('0x20')],_0x1d8cad;if(_0x395935>=_0x1ba62b){_0x395935=_0x1ba62b;_0x1d8cad=0xc8;}else{_0x1d8cad=0xce;}_0x50840b[_0x27ed('0x1b')](_0x1d8cad);return _0x50840b[_0x27ed('0x21')]('Content-Range',_0x38789c+'-'+_0x395935+'/'+_0x1ba62b)[_0x27ed('0x1d')](_0x4c7aa3);}return null;};}function patchUpdates(_0x576732){return function(_0x371846){try{jsonpatch['apply'](_0x371846,_0x576732,!![]);}catch(_0x355bd0){return BPromise['reject'](_0x355bd0);}return _0x371846[_0x27ed('0x22')]();};}function saveUpdates(_0x2e05ee,_0x5e2df9){return function(_0x41e4cd){if(_0x41e4cd){return _0x41e4cd[_0x27ed('0x23')](_0x2e05ee)[_0x27ed('0x24')](function(_0x5b1645){return _0x5b1645;});}return null;};}function removeEntity(_0x1add8b,_0x19179e){return function(_0x1e1cab){if(_0x1e1cab){return _0x1e1cab[_0x27ed('0x25')]()[_0x27ed('0x24')](function(){var _0xee150a=_0x1e1cab[_0x27ed('0x26')]({'plain':!![]});var _0x24cd8f='CustomReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x24cd8f,'resourceId':_0xee150a['id']}})[_0x27ed('0x24')](function(){return _0x1e1cab;});})['then'](function(){_0x1add8b[_0x27ed('0x1b')](0xcc)[_0x27ed('0x1c')]();});}};}function handleEntityNotFound(_0x43f900,_0x5dba37){return function(_0x4462a7){if(!_0x4462a7){_0x43f900['sendStatus'](0x194);}return _0x4462a7;};}function handleError(_0x156496,_0x5d1099){_0x5d1099=_0x5d1099||0x1f4;return function(_0xe73c91){logger['error'](_0xe73c91[_0x27ed('0x27')]);if(_0xe73c91[_0x27ed('0x28')]){delete _0xe73c91[_0x27ed('0x28')];}_0x156496[_0x27ed('0x1b')](_0x5d1099)[_0x27ed('0x29')](_0xe73c91);};}exports['index']=function(_0x295690,_0x554a89){var _0x2b0b6d={},_0x451b8e={},_0x31b91d={'count':0x0,'rows':[]};var _0x10874a=_['map'](db[_0x27ed('0x2a')][_0x27ed('0x2b')],function(_0x448835){return{'name':_0x448835[_0x27ed('0x2c')],'type':_0x448835[_0x27ed('0x2d')][_0x27ed('0x2e')]};});_0x451b8e[_0x27ed('0x2f')]=_[_0x27ed('0x30')](_0x10874a,_0x27ed('0x28'));_0x451b8e['query']=_[_0x27ed('0x31')](_0x295690[_0x27ed('0x32')]);_0x451b8e[_0x27ed('0x33')]=_[_0x27ed('0x34')](_0x451b8e[_0x27ed('0x2f')],_0x451b8e['query']);_0x2b0b6d[_0x27ed('0x35')]=_[_0x27ed('0x34')](_0x451b8e['model'],qs['fields'](_0x295690[_0x27ed('0x32')][_0x27ed('0x36')]));_0x2b0b6d[_0x27ed('0x35')]=_0x2b0b6d[_0x27ed('0x35')]['length']?_0x2b0b6d[_0x27ed('0x35')]:_0x451b8e[_0x27ed('0x2f')];if(!_0x295690[_0x27ed('0x32')][_0x27ed('0x37')](_0x27ed('0x38'))){_0x2b0b6d[_0x27ed('0x20')]=qs[_0x27ed('0x20')](_0x295690['query'][_0x27ed('0x20')]);_0x2b0b6d[_0x27ed('0x1f')]=qs[_0x27ed('0x1f')](_0x295690[_0x27ed('0x32')][_0x27ed('0x1f')]);}_0x2b0b6d[_0x27ed('0x39')]=qs[_0x27ed('0x3a')](_0x295690[_0x27ed('0x32')]['sort']);_0x2b0b6d[_0x27ed('0x3b')]=qs[_0x27ed('0x33')](_['pick'](_0x295690[_0x27ed('0x32')],_0x451b8e[_0x27ed('0x33')]));if(_0x295690[_0x27ed('0x32')][_0x27ed('0x3c')]){_0x2b0b6d[_0x27ed('0x3b')]=_[_0x27ed('0x3d')](_0x2b0b6d[_0x27ed('0x3b')],{'$or':_['map'](_0x10874a,function(_0x32c846){if(_0x32c846[_0x27ed('0x2d')]!=='VIRTUAL'){var _0x318f86={};_0x318f86[_0x32c846[_0x27ed('0x28')]]={'$like':'%'+_0x295690[_0x27ed('0x32')][_0x27ed('0x3c')]+'%'};return _0x318f86;}})});}_0x2b0b6d=_[_0x27ed('0x3d')]({},_0x2b0b6d,_0x295690[_0x27ed('0x3e')]);var _0x764fc7={'where':_0x2b0b6d[_0x27ed('0x3b')]};return db[_0x27ed('0x2a')][_0x27ed('0x1e')](_0x764fc7)[_0x27ed('0x24')](function(_0x5b7f35){_0x31b91d['count']=_0x5b7f35;if(_0x295690['query'][_0x27ed('0x3f')]){_0x2b0b6d[_0x27ed('0x40')]=[{'all':!![]}];}return db[_0x27ed('0x2a')]['findAll'](_0x2b0b6d);})[_0x27ed('0x24')](function(_0x67d58b){_0x31b91d[_0x27ed('0x41')]=_0x67d58b;return _0x31b91d;})[_0x27ed('0x24')](respondWithFilteredResult(_0x554a89,_0x2b0b6d))[_0x27ed('0x42')](handleError(_0x554a89,null));};exports[_0x27ed('0x43')]=function(_0x3647c2,_0x4500ce){var _0x4c7f58={'raw':![],'where':{'id':_0x3647c2[_0x27ed('0x44')]['id']}},_0x5a0914={};_0x5a0914[_0x27ed('0x2f')]=_[_0x27ed('0x31')](db[_0x27ed('0x2a')][_0x27ed('0x2b')]);_0x5a0914[_0x27ed('0x32')]=_['keys'](_0x3647c2['query']);_0x5a0914['filters']=_[_0x27ed('0x34')](_0x5a0914['model'],_0x5a0914[_0x27ed('0x32')]);_0x4c7f58[_0x27ed('0x35')]=_['intersection'](_0x5a0914[_0x27ed('0x2f')],qs[_0x27ed('0x36')](_0x3647c2[_0x27ed('0x32')][_0x27ed('0x36')]));_0x4c7f58[_0x27ed('0x35')]=_0x4c7f58[_0x27ed('0x35')][_0x27ed('0x45')]?_0x4c7f58[_0x27ed('0x35')]:_0x5a0914[_0x27ed('0x2f')];if(_0x3647c2[_0x27ed('0x32')][_0x27ed('0x3f')]){_0x4c7f58[_0x27ed('0x40')]=[{'all':!![]}];}_0x4c7f58=_[_0x27ed('0x3d')]({},_0x4c7f58,_0x3647c2[_0x27ed('0x3e')]);return db[_0x27ed('0x2a')][_0x27ed('0x46')](_0x4c7f58)[_0x27ed('0x24')](handleEntityNotFound(_0x4500ce,null))[_0x27ed('0x24')](respondWithResult(_0x4500ce,null))[_0x27ed('0x42')](handleError(_0x4500ce,null));};exports['create']=function(_0x3ca87e,_0x43797c){return db[_0x27ed('0x2a')]['create'](_0x3ca87e[_0x27ed('0x47')],{})['then'](function(_0x28a75d){var _0x5c6829=_0x3ca87e[_0x27ed('0x48')]['get']({'plain':!![]});if(!_0x5c6829)throw new Error(_0x27ed('0x49'));if(_0x5c6829[_0x27ed('0x4a')]===_0x27ed('0x48')){var _0x43d1b5=_0x28a75d[_0x27ed('0x26')]({'plain':!![]});var _0x4005bd=_0x27ed('0x4b');return db[_0x27ed('0x4c')]['find']({'where':{'name':_0x4005bd,'userProfileId':_0x5c6829[_0x27ed('0x4d')]},'raw':!![]})[_0x27ed('0x24')](function(_0x3b5803){if(_0x3b5803&&_0x3b5803[_0x27ed('0x4e')]===0x0){return db[_0x27ed('0x4f')][_0x27ed('0x50')]({'name':_0x43d1b5[_0x27ed('0x28')],'resourceId':_0x43d1b5['id'],'type':_0x27ed('0x51'),'sectionId':_0x3b5803['id']},{})[_0x27ed('0x24')](function(){return _0x28a75d;});}else{return _0x28a75d;}})[_0x27ed('0x42')](function(_0x5071ab){logger[_0x27ed('0x52')](_0x27ed('0x53'),_0x5071ab);throw _0x5071ab;});}return _0x28a75d;})['then'](respondWithResult(_0x43797c,0xc9))[_0x27ed('0x42')](handleError(_0x43797c,null));};exports[_0x27ed('0x23')]=function(_0x444548,_0x115017){if(_0x444548[_0x27ed('0x47')]['id']){delete _0x444548['body']['id'];}return db['AnalyticCustomReport'][_0x27ed('0x46')]({'where':{'id':_0x444548[_0x27ed('0x44')]['id']}})[_0x27ed('0x24')](handleEntityNotFound(_0x115017,null))[_0x27ed('0x24')](saveUpdates(_0x444548['body'],null))[_0x27ed('0x24')](respondWithResult(_0x115017,null))['catch'](handleError(_0x115017,null));};exports[_0x27ed('0x25')]=function(_0x3a97a2,_0x131913){return db[_0x27ed('0x2a')][_0x27ed('0x46')]({'where':{'id':_0x3a97a2['params']['id']}})[_0x27ed('0x24')](handleEntityNotFound(_0x131913,null))[_0x27ed('0x24')](removeEntity(_0x131913,null))[_0x27ed('0x42')](handleError(_0x131913,null));};exports['preview']=function(_0x1003fe,_0xf488be){var _0x3640f6=0xa;var _0x6513f5=['join',_0x27ed('0x54'),_0x27ed('0x55'),_0x27ed('0x56')];var _0x1713bb={'SUM':_0x27ed('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x27ed('0x58'),'MIN':_0x27ed('0x59'),'AVG':_0x27ed('0x5a'),'GROUP_CONCAT':_0x27ed('0x5b'),'GROUP_CONCAT ASC':_0x27ed('0x5c'),'GROUP_CONCAT DESC':_0x27ed('0x5d')};var _0x12631d={'SEC_TO_TIME':_0x27ed('0x5e'),'DATE':_0x27ed('0x5f'),'HOUR':_0x27ed('0x60'),'ROUND':_0x27ed('0x61'),'UNIX_TIMESTAMP':_0x27ed('0x62')};var _0x3caf22=function(_0x1c6f79){return!_['includes']([_0x27ed('0x63'),_0x27ed('0x64'),_0x27ed('0x65'),_0x27ed('0x66')],_0x1c6f79);};var _0x50d562=function(_0x2dd075){if(!_0x2dd075||!_0x2dd075[_0x27ed('0x67')]['length']){return'';}for(var _0x57ec73='(',_0x1c3d7d=0x0;_0x1c3d7d<_0x2dd075[_0x27ed('0x67')]['length'];_0x1c3d7d+=0x1){_0x1c3d7d>0x0&&(_0x57ec73+='\x20'+_0x2dd075[_0x27ed('0x68')]+'\x20');_0x57ec73+=_0x2dd075[_0x27ed('0x67')][_0x1c3d7d][_0x27ed('0x69')]?_0x50d562(_0x2dd075[_0x27ed('0x67')][_0x1c3d7d][_0x27ed('0x69')]):_0x2dd075[_0x27ed('0x67')][_0x1c3d7d][_0x27ed('0x6a')]+'\x20'+_0x2dd075[_0x27ed('0x67')][_0x1c3d7d][_0x27ed('0x6b')]+(_0x3caf22(_0x2dd075[_0x27ed('0x67')][_0x1c3d7d][_0x27ed('0x6b')])?'\x20'+_0x2dd075[_0x27ed('0x67')][_0x1c3d7d][_0x27ed('0x6c')]:'');}return _0x57ec73+')';};var _0x3e05ea={'where':{'id':_0x1003fe[_0x27ed('0x44')]['id']}},_0x2315e4,_0x3bfb6d,_0xc72d9a,_0x38bb68,_0x2b0031;_0x3e05ea=_['merge']({},_0x3e05ea,_0x1003fe['options']);return db[_0x27ed('0x2a')][_0x27ed('0x46')](_0x3e05ea)[_0x27ed('0x24')](function(_0x391936){if(_0x391936){_0x2315e4=_0x391936;return _0x391936['getFields']();}return null;})[_0x27ed('0x24')](function(_0x22489f){if(_0x22489f){if(!_0x22489f[_0x27ed('0x45')]){throw new db[(_0x27ed('0x6d'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3bfb6d=_0x22489f;return db[_0x27ed('0x6e')][_0x27ed('0x6f')]({'raw':!![]});}return null;})[_0x27ed('0x24')](function(_0x395fe1){if(_0x395fe1){_0xc72d9a=_[_0x27ed('0x70')](_0x395fe1,'id');var _0x4447ca;var _0x1a8289=squel[_0x27ed('0x71')]();_0x1a8289[_0x27ed('0x72')](_0x2315e4['table']);for(var _0x2ce823=0x0;_0x2ce823<_0x3bfb6d[_0x27ed('0x45')];_0x2ce823+=0x1){_0x4447ca=_0x3bfb6d[_0x2ce823][_0x27ed('0x73')]?_0xc72d9a[_0x3bfb6d[_0x2ce823][_0x27ed('0x73')]][_0x27ed('0x74')]:_0x3bfb6d[_0x2ce823][_0x27ed('0x6a')];_0x4447ca=_0x3bfb6d[_0x2ce823][_0x27ed('0x75')]?_[_0x27ed('0x76')](_0x1713bb[_0x3bfb6d[_0x2ce823][_0x27ed('0x75')]],'%s',_0x4447ca):_0x4447ca;_0x4447ca=_0x3bfb6d[_0x2ce823][_0x27ed('0x77')]?_['replace'](_0x12631d[_0x3bfb6d[_0x2ce823][_0x27ed('0x77')]],'%s',_0x4447ca):_0x4447ca;if(_0x3bfb6d[_0x2ce823][_0x27ed('0x78')]){_0x1a8289[_0x27ed('0x69')](_0x4447ca);}_0x3bfb6d[_0x2ce823][_0x27ed('0x79')]&&_0x1a8289[_0x27ed('0x39')](_0x4447ca,_0x3bfb6d[_0x2ce823][_0x27ed('0x79')]==='DESC'?![]:!![]);_0x1a8289[_0x27ed('0x6a')](_0x4447ca,_0x3bfb6d[_0x2ce823]['alias']||_0x4447ca);}if(_0x2315e4[_0x27ed('0x7a')]){_0x2315e4[_0x27ed('0x7a')]=JSON[_0x27ed('0x7b')](_0x2315e4[_0x27ed('0x7a')]);for(var _0x2cf948=0x0;_0x2cf948<_0x2315e4[_0x27ed('0x7a')]['length'];_0x2cf948+=0x1){if(_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x2d')]&&_['includes'](_0x6513f5,_0x2315e4[_0x27ed('0x7a')][_0x2cf948]['type'])&&_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x7c')]&&_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x7d')]&&_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x7e')]){_0x1a8289[_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x2d')]](_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x7d')],null,util[_0x27ed('0x77')](_0x27ed('0x7f'),_0x2315e4[_0x27ed('0x80')],_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x7c')],_0x2315e4[_0x27ed('0x7a')][_0x2cf948]['foreignTable'],_0x2315e4[_0x27ed('0x7a')][_0x2cf948][_0x27ed('0x7e')]));}}}if(_0x2315e4[_0x27ed('0x81')]){_0x2315e4[_0x27ed('0x81')]=JSON[_0x27ed('0x7b')](_0x2315e4['conditions']);_0x1a8289['where'](_0x50d562(_0x2315e4['conditions'][_0x27ed('0x69')]));}_0x2b0031=_0x1a8289[_0x27ed('0x82')]();_0x1a8289[_0x27ed('0x20')](_0x3640f6);_0x1a8289['offset'](0x0);logger[_0x27ed('0x83')](_0x27ed('0x84'),_0x1a8289[_0x27ed('0x85')]());return db[_0x27ed('0x86')]['query'](_0x1a8289[_0x27ed('0x85')](),{'type':db[_0x27ed('0x86')][_0x27ed('0x87')]['SELECT']});}})[_0x27ed('0x24')](respondWithResult(_0xf488be,null))[_0x27ed('0x42')](handleError(_0xf488be,null));};function runReport(_0x59c722,_0x72e5e4,_0x15d3f4){var _0x176076=_0x72e5e4['name'];var _0x14d9b9=0xa;var _0x3a8524=[_0x27ed('0x88'),_0x27ed('0x54'),'right_join','cross_join'];var _0x3eac89={'SUM':'SUM(%s)','COUNT':_0x27ed('0x89'),'COUNT DISTINCT':_0x27ed('0x8a'),'MAX':_0x27ed('0x58'),'MIN':_0x27ed('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x27ed('0x5b'),'GROUP_CONCAT ASC':_0x27ed('0x5c'),'GROUP_CONCAT DESC':_0x27ed('0x5d')};var _0x74ef32={'SEC_TO_TIME':_0x27ed('0x5e'),'DATE':'DATE(%s)','HOUR':_0x27ed('0x60'),'ROUND':_0x27ed('0x61'),'UNIX_TIMESTAMP':_0x27ed('0x62')};var _0x259534=function(_0x55b62e){return!_[_0x27ed('0x8b')]([_0x27ed('0x63'),_0x27ed('0x64'),_0x27ed('0x65'),_0x27ed('0x66')],_0x55b62e);};var _0x4ad2be=function(_0x550b3d){if(!_0x550b3d||!_0x550b3d[_0x27ed('0x67')][_0x27ed('0x45')]){return'';}for(var _0x3e6af3='(',_0x1acb74=0x0;_0x1acb74<_0x550b3d[_0x27ed('0x67')][_0x27ed('0x45')];_0x1acb74+=0x1){_0x1acb74>0x0&&(_0x3e6af3+='\x20'+_0x550b3d[_0x27ed('0x68')]+'\x20');_0x3e6af3+=_0x550b3d[_0x27ed('0x67')][_0x1acb74][_0x27ed('0x69')]?_0x4ad2be(_0x550b3d[_0x27ed('0x67')][_0x1acb74][_0x27ed('0x69')]):_0x550b3d['rules'][_0x1acb74][_0x27ed('0x6a')]+'\x20'+_0x550b3d[_0x27ed('0x67')][_0x1acb74][_0x27ed('0x6b')]+(_0x259534(_0x550b3d[_0x27ed('0x67')][_0x1acb74]['condition'])?'\x20'+_0x550b3d[_0x27ed('0x67')][_0x1acb74][_0x27ed('0x6c')]:'');}return _0x3e6af3+')';};var _0x527b71={'where':{'id':_0x59c722['id']}},_0x4668a6,_0x1e245d,_0x128cb0,_0x5e3ea4,_0x243e27;_0x527b71=_[_0x27ed('0x3d')]({},_0x527b71,_0x15d3f4);return db[_0x27ed('0x2a')][_0x27ed('0x46')](_0x527b71)[_0x27ed('0x24')](function(_0x23662e){if(_0x23662e){_0x4668a6=_0x23662e;return _0x23662e[_0x27ed('0x8c')]();}return null;})[_0x27ed('0x24')](function(_0x52826a){if(_0x52826a){if(!_0x52826a['length']){throw new db['Sequelize'][(_0x27ed('0x8d'))](_0x27ed('0x8e'),0x193);}_0x1e245d=_0x52826a;return db[_0x27ed('0x6e')][_0x27ed('0x6f')]({'raw':!![]});}return null;})[_0x27ed('0x24')](function(_0x3663b6){if(_0x3663b6){_0x128cb0=_[_0x27ed('0x70')](_0x3663b6,'id');var _0x2426d4;var _0x36bd72=squel[_0x27ed('0x71')]();_0x36bd72['from'](_0x4668a6[_0x27ed('0x80')]);for(var _0x297c98=0x0;_0x297c98<_0x1e245d['length'];_0x297c98+=0x1){_0x2426d4=_0x1e245d[_0x297c98][_0x27ed('0x73')]?_0x128cb0[_0x1e245d[_0x297c98]['MetricId']][_0x27ed('0x74')]:_0x1e245d[_0x297c98][_0x27ed('0x6a')];_0x2426d4=_0x1e245d[_0x297c98][_0x27ed('0x75')]?_[_0x27ed('0x76')](_0x3eac89[_0x1e245d[_0x297c98][_0x27ed('0x75')]],'%s',_0x2426d4):_0x2426d4;_0x2426d4=_0x1e245d[_0x297c98][_0x27ed('0x77')]?_[_0x27ed('0x76')](_0x74ef32[_0x1e245d[_0x297c98][_0x27ed('0x77')]],'%s',_0x2426d4):_0x2426d4;if(_0x1e245d[_0x297c98][_0x27ed('0x78')]){_0x36bd72[_0x27ed('0x69')](_0x2426d4);}_0x1e245d[_0x297c98]['orderBy']&&_0x36bd72['order'](_0x2426d4,_0x1e245d[_0x297c98][_0x27ed('0x79')]===_0x27ed('0x8f')?![]:!![]);_0x36bd72[_0x27ed('0x6a')](_0x2426d4,_0x1e245d[_0x297c98][_0x27ed('0x90')]||_0x2426d4);}if(_0x4668a6['joins']){_0x4668a6[_0x27ed('0x7a')]=JSON[_0x27ed('0x7b')](_0x4668a6[_0x27ed('0x7a')]);for(var _0x4564a1=0x0;_0x4564a1<_0x4668a6[_0x27ed('0x7a')]['length'];_0x4564a1+=0x1){if(_0x4668a6[_0x27ed('0x7a')][_0x4564a1][_0x27ed('0x2d')]&&_['includes'](_0x3a8524,_0x4668a6[_0x27ed('0x7a')][_0x4564a1]['type'])&&_0x4668a6[_0x27ed('0x7a')][_0x4564a1]['parentKey']&&_0x4668a6['joins'][_0x4564a1]['foreignTable']&&_0x4668a6['joins'][_0x4564a1]['foreignKey']){_0x36bd72[_0x4668a6[_0x27ed('0x7a')][_0x4564a1][_0x27ed('0x2d')]](_0x4668a6[_0x27ed('0x7a')][_0x4564a1][_0x27ed('0x7d')],null,util[_0x27ed('0x77')]('%s.%s\x20=\x20%s.%s',_0x4668a6[_0x27ed('0x80')],_0x4668a6['joins'][_0x4564a1][_0x27ed('0x7c')],_0x4668a6['joins'][_0x4564a1][_0x27ed('0x7d')],_0x4668a6[_0x27ed('0x7a')][_0x4564a1][_0x27ed('0x7e')]));}}}if(_0x4668a6[_0x27ed('0x81')]){_0x4668a6[_0x27ed('0x81')]=JSON['parse'](_0x4668a6[_0x27ed('0x81')]);_0x36bd72['where'](_0x4ad2be(_0x4668a6['conditions'][_0x27ed('0x69')]));}_0x243e27=_0x36bd72['clone']();_0x36bd72[_0x27ed('0x20')](_0x14d9b9);_0x36bd72[_0x27ed('0x1f')](0x0);logger['debug'](_0x27ed('0x84'),_0x36bd72['toString']());return db[_0x27ed('0x86')][_0x27ed('0x32')](_0x36bd72[_0x27ed('0x85')](),{'type':db['sequelize'][_0x27ed('0x87')][_0x27ed('0x91')]});}})[_0x27ed('0x24')](function(_0x3b4d80){if(!_0x3b4d80[_0x27ed('0x45')]){throw new db['Sequelize'][(_0x27ed('0x8d'))](_0x27ed('0x92'),0xcc);}if(_0x72e5e4[_0x27ed('0x93')]==='web'){return null;}var _0x2e2deb=_[_0x27ed('0x3d')](_0x72e5e4,{'name':_0x72e5e4[_0x27ed('0x94')]||_0x72e5e4[_0x27ed('0x28')]||_0x4668a6[_0x27ed('0x28')],'basename':_0x176076,'savename':util['format'](_0x27ed('0x95'),_0x72e5e4[_0x27ed('0x28')]||_0x4668a6[_0x27ed('0x28')],require(_0x27ed('0x96'))[_0x27ed('0x97')](0x4),_0x72e5e4[_0x27ed('0x93')]||_0x27ed('0x98')),'reportId':_0x4668a6['id'],'reportType':_0x27ed('0x99')});return db[_0x27ed('0x9a')][_0x27ed('0x50')](_0x2e2deb,{'raw':!![]});})[_0x27ed('0x24')](function(_0x459f2f){if(_0x4668a6[_0x27ed('0x80')]==='cdr'){_0x243e27[_0x27ed('0x3b')](_0x4668a6['table']+_0x27ed('0x9b'),_0x72e5e4[_0x27ed('0x9c')],_0x72e5e4['endDate']);}else{_0x243e27[_0x27ed('0x3b')](_0x4668a6[_0x27ed('0x80')]+_0x27ed('0x9d'),_0x72e5e4['startDate'],_0x72e5e4[_0x27ed('0x9e')]);}if(_0x459f2f){logger[_0x27ed('0x9f')](_0x27ed('0xa0'),_0x243e27[_0x27ed('0x85')]());require(_0x27ed('0xa1'))[_0x27ed('0xa2')](path['join'](__dirname,'../../components/export/',_0x459f2f[_0x27ed('0x93')]),[_0x459f2f['id'],_0x243e27[_0x27ed('0x85')](),path['join'](__dirname,_0x27ed('0xa3'),_0x459f2f[_0x27ed('0xa4')]),_0x176076]);return _0x459f2f;}else{var _0xcaf6ed=squel[_0x27ed('0x71')]();_0xcaf6ed[_0x27ed('0x72')]('('+_0x243e27[_0x27ed('0x85')]()+')',_0x27ed('0xa5'));_0xcaf6ed['field'](_0x27ed('0xa6'),_0x27ed('0x1e'));_0x243e27['limit'](_0x72e5e4[_0x27ed('0x20')]||_0x14d9b9);_0x243e27[_0x27ed('0x1f')](_0x72e5e4['offset']||0x0);return db[_0x27ed('0x86')][_0x27ed('0x32')](_0xcaf6ed[_0x27ed('0x85')](),{'type':db[_0x27ed('0x86')][_0x27ed('0x87')]['SELECT']})[_0x27ed('0x24')](function(_0x17636d){if(!_0x17636d[_0x27ed('0x45')]){_0x5e3ea4=0x0;}else{_0x5e3ea4=_0x17636d[0x0][_0x27ed('0x1e')]||0x0;}return db[_0x27ed('0x86')]['query'](_0x243e27[_0x27ed('0x85')](),{'type':db[_0x27ed('0x86')][_0x27ed('0x87')][_0x27ed('0x91')]});})[_0x27ed('0x24')](function(_0x1addc9){return{'rows':_0x1addc9||[],'count':_0x5e3ea4};});}});}exports['run']=function(_0x325e61,_0x4e6e23){return runReport(_0x325e61[_0x27ed('0x44')],_0x325e61[_0x27ed('0x32')],_0x325e61[_0x27ed('0x3e')])[_0x27ed('0x24')](respondWithResult(_0x4e6e23,null))['catch'](handleError(_0x4e6e23,null));};exports[_0x27ed('0xa7')]=runReport;exports[_0x27ed('0x32')]=function(_0x41d190,_0x343d0a){var _0x338107=0xa;var _0x4afed6=[_0x27ed('0x88'),_0x27ed('0x54'),_0x27ed('0x55'),_0x27ed('0x56')];var _0x499037={'SUM':_0x27ed('0x57'),'COUNT':_0x27ed('0x89'),'COUNT DISTINCT':_0x27ed('0x8a'),'MAX':_0x27ed('0x58'),'MIN':_0x27ed('0x59'),'AVG':_0x27ed('0x5a'),'GROUP_CONCAT':_0x27ed('0x5b'),'GROUP_CONCAT ASC':_0x27ed('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x20cf87={'SEC_TO_TIME':_0x27ed('0x5e'),'DATE':_0x27ed('0x5f'),'HOUR':_0x27ed('0x60'),'ROUND':_0x27ed('0x61'),'UNIX_TIMESTAMP':_0x27ed('0x62')};var _0x429b96=function(_0x7104bd){return!_[_0x27ed('0x8b')]([_0x27ed('0x63'),_0x27ed('0x64'),_0x27ed('0x65'),_0x27ed('0x66')],_0x7104bd);};var _0x2e71c6=function(_0xe328ef){if(!_0xe328ef||!_0xe328ef[_0x27ed('0x67')]['length']){return'';}for(var _0x3c3f3f='(',_0x2811b2=0x0;_0x2811b2<_0xe328ef['rules'][_0x27ed('0x45')];_0x2811b2+=0x1){_0x2811b2>0x0&&(_0x3c3f3f+='\x20'+_0xe328ef[_0x27ed('0x68')]+'\x20');_0x3c3f3f+=_0xe328ef[_0x27ed('0x67')][_0x2811b2][_0x27ed('0x69')]?_0x2e71c6(_0xe328ef[_0x27ed('0x67')][_0x2811b2][_0x27ed('0x69')]):_0xe328ef[_0x27ed('0x67')][_0x2811b2][_0x27ed('0x6a')]+'\x20'+_0xe328ef['rules'][_0x2811b2]['condition']+(_0x429b96(_0xe328ef[_0x27ed('0x67')][_0x2811b2]['condition'])?'\x20'+_0xe328ef['rules'][_0x2811b2][_0x27ed('0x6c')]:'');}return _0x3c3f3f+')';};var _0x3974eb={'where':{'id':_0x41d190[_0x27ed('0x44')]['id']}},_0x37f3bc,_0x5c31cf,_0x58a279,_0x429e67,_0x3b0c03;_0x3974eb=_['merge']({},_0x3974eb,_0x41d190[_0x27ed('0x3e')]);return db[_0x27ed('0x2a')][_0x27ed('0x46')](_0x3974eb)[_0x27ed('0x24')](function(_0x3c4cb5){if(_0x3c4cb5){_0x37f3bc=_0x3c4cb5;return _0x3c4cb5[_0x27ed('0x8c')]();}return null;})['then'](function(_0x4a05df){if(_0x4a05df){if(!_0x4a05df['length']){throw new db[(_0x27ed('0x6d'))]['ValidationErrorItem'](_0x27ed('0x8e'),0x193);}_0x5c31cf=_0x4a05df;return db[_0x27ed('0x6e')][_0x27ed('0x6f')]({'raw':!![]});}return null;})[_0x27ed('0x24')](function(_0x4e37ef){if(_0x4e37ef){_0x58a279=_[_0x27ed('0x70')](_0x4e37ef,'id');var _0x5ead8d;var _0x192eb4=squel[_0x27ed('0x71')]();_0x192eb4[_0x27ed('0x72')](_0x37f3bc[_0x27ed('0x80')]);for(var _0xf6c494=0x0;_0xf6c494<_0x5c31cf[_0x27ed('0x45')];_0xf6c494+=0x1){_0x5ead8d=_0x5c31cf[_0xf6c494]['MetricId']?_0x58a279[_0x5c31cf[_0xf6c494][_0x27ed('0x73')]][_0x27ed('0x74')]:_0x5c31cf[_0xf6c494][_0x27ed('0x6a')];_0x5ead8d=_0x5c31cf[_0xf6c494][_0x27ed('0x75')]?_[_0x27ed('0x76')](_0x499037[_0x5c31cf[_0xf6c494]['function']],'%s',_0x5ead8d):_0x5ead8d;_0x5ead8d=_0x5c31cf[_0xf6c494]['format']?_[_0x27ed('0x76')](_0x20cf87[_0x5c31cf[_0xf6c494][_0x27ed('0x77')]],'%s',_0x5ead8d):_0x5ead8d;if(_0x5c31cf[_0xf6c494][_0x27ed('0x78')]){_0x192eb4['group'](_0x5ead8d);}_0x5c31cf[_0xf6c494][_0x27ed('0x79')]&&_0x192eb4['order'](_0x5ead8d,_0x5c31cf[_0xf6c494]['orderBy']===_0x27ed('0x8f')?![]:!![]);_0x192eb4[_0x27ed('0x6a')](_0x5ead8d,_0x5c31cf[_0xf6c494]['alias']||_0x5ead8d);}if(_0x37f3bc['joins']){_0x37f3bc['joins']=JSON[_0x27ed('0x7b')](_0x37f3bc['joins']);for(var _0x2e626c=0x0;_0x2e626c<_0x37f3bc[_0x27ed('0x7a')][_0x27ed('0x45')];_0x2e626c+=0x1){if(_0x37f3bc[_0x27ed('0x7a')][_0x2e626c][_0x27ed('0x2d')]&&_[_0x27ed('0x8b')](_0x4afed6,_0x37f3bc['joins'][_0x2e626c][_0x27ed('0x2d')])&&_0x37f3bc['joins'][_0x2e626c][_0x27ed('0x7c')]&&_0x37f3bc[_0x27ed('0x7a')][_0x2e626c][_0x27ed('0x7d')]&&_0x37f3bc[_0x27ed('0x7a')][_0x2e626c][_0x27ed('0x7e')]){_0x192eb4[_0x37f3bc[_0x27ed('0x7a')][_0x2e626c]['type']](_0x37f3bc['joins'][_0x2e626c][_0x27ed('0x7d')],null,util[_0x27ed('0x77')]('%s.%s\x20=\x20%s.%s',_0x37f3bc['table'],_0x37f3bc['joins'][_0x2e626c][_0x27ed('0x7c')],_0x37f3bc[_0x27ed('0x7a')][_0x2e626c]['foreignTable'],_0x37f3bc['joins'][_0x2e626c][_0x27ed('0x7e')]));}}}if(_0x37f3bc[_0x27ed('0x81')]){_0x37f3bc[_0x27ed('0x81')]=JSON[_0x27ed('0x7b')](_0x37f3bc[_0x27ed('0x81')]);_0x192eb4[_0x27ed('0x3b')](_0x2e71c6(_0x37f3bc[_0x27ed('0x81')][_0x27ed('0x69')]));}_0x3b0c03=_0x192eb4[_0x27ed('0x82')]();_0x192eb4['limit'](_0x338107);_0x192eb4[_0x27ed('0x1f')](0x0);logger[_0x27ed('0x83')](_0x27ed('0x84'),_0x192eb4[_0x27ed('0x85')]());return db[_0x27ed('0x86')][_0x27ed('0x32')](_0x192eb4['toString'](),{'type':db['sequelize'][_0x27ed('0x87')][_0x27ed('0x91')]});}})[_0x27ed('0x24')](function(){return{'sql':_0x3b0c03['toString']()};})[_0x27ed('0x24')](respondWithResult(_0x343d0a,null))[_0x27ed('0x42')](handleError(_0x343d0a,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 8aeb226..00ae4c1 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 _0x5499=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','../../config/logger','api'];(function(_0xfbc04c,_0x2471a6){var _0x528dd3=function(_0x27f202){while(--_0x27f202){_0xfbc04c['push'](_0xfbc04c['shift']());}};_0x528dd3(++_0x2471a6);}(_0x5499,0x1ca));var _0x9549=function(_0x174833,_0x4f5b0a){_0x174833=_0x174833-0x0;var _0x2b2f9c=_0x5499[_0x174833];return _0x2b2f9c;};'use strict';var _=require(_0x9549('0x0'));var util=require(_0x9549('0x1'));var logger=require(_0x9549('0x2'))(_0x9549('0x3'));var moment=require(_0x9549('0x4'));var BPromise=require(_0x9549('0x5'));var rp=require(_0x9549('0x6'));var fs=require('fs');var path=require(_0x9549('0x7'));var rimraf=require(_0x9549('0x8'));var config=require(_0x9549('0x9'));var attributes=require(_0x9549('0xa'));module[_0x9549('0xb')]=function(_0x3c2fd4,_0x5422d7){return _0x3c2fd4[_0x9549('0xc')](_0x9549('0xd'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59d0=['../../config/logger','api','bluebird','request-promise','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x59d0,0x99));var _0x059d=function(_0x28bdc0,_0x29a707){_0x28bdc0=_0x28bdc0-0x0;var _0x89a93=_0x59d0[_0x28bdc0];return _0x89a93;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x059d('0x0'))(_0x059d('0x1'));var moment=require('moment');var BPromise=require(_0x059d('0x2'));var rp=require(_0x059d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x059d('0x4'));module[_0x059d('0x5')]=function(_0x2738c0,_0x4c96a5){return _0x2738c0[_0x059d('0x6')](_0x059d('0x7'),attributes,{'tableName':_0x059d('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 8eba14d..610ab10 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 _0xa44d=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0xa44d,0x1d5));var _0xda44=function(_0x28669c,_0x1f62c4){_0x28669c=_0x28669c-0x0;var _0x4a3af6=_0xa44d[_0x28669c];return _0x4a3af6;};'use strict';var _=require('lodash');var util=require(_0xda44('0x0'));var moment=require(_0xda44('0x1'));var BPromise=require(_0xda44('0x2'));var rs=require(_0xda44('0x3'));var fs=require('fs');var Redis=require(_0xda44('0x4'));var db=require(_0xda44('0x5'))['db'];var utils=require(_0xda44('0x6'));var logger=require(_0xda44('0x7'))(_0xda44('0x8'));var config=require(_0xda44('0x9'));var jayson=require(_0xda44('0xa'));var client=jayson[_0xda44('0xb')][_0xda44('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x154780,_0x54393f,_0x531604){return new BPromise(function(_0x56e8b3,_0x3e06a3){return client[_0xda44('0xd')](_0x154780,_0x531604)[_0xda44('0xe')](function(_0x2375b7){logger[_0xda44('0xf')](_0xda44('0x10'),_0x54393f,'request\x20sent');logger[_0xda44('0x11')](_0xda44('0x12'),_0x54393f,_0xda44('0x13'),JSON[_0xda44('0x14')](_0x2375b7));if(_0x2375b7[_0xda44('0x15')]){if(_0x2375b7['error'][_0xda44('0x16')]===0x1f4){logger[_0xda44('0x15')](_0xda44('0x10'),_0x54393f,_0x2375b7[_0xda44('0x15')][_0xda44('0x17')]);return _0x3e06a3(_0x2375b7[_0xda44('0x15')][_0xda44('0x17')]);}logger[_0xda44('0x15')]('AnalyticCustomReport,\x20%s,\x20%s',_0x54393f,_0x2375b7[_0xda44('0x15')][_0xda44('0x17')]);return _0x56e8b3(_0x2375b7[_0xda44('0x15')]['message']);}else{logger[_0xda44('0xf')](_0xda44('0x10'),_0x54393f,_0xda44('0x13'));_0x56e8b3(_0x2375b7[_0xda44('0x18')]['message']);}})[_0xda44('0x19')](function(_0x2b9ea1){logger[_0xda44('0x15')](_0xda44('0x10'),_0x54393f,_0x2b9ea1);_0x3e06a3(_0x2b9ea1);});});} \ No newline at end of file +var _0xf06f=['request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xf06f,0x1cb));var _0xff06=function(_0x482f97,_0x569929){_0x482f97=_0x482f97-0x0;var _0x4870eb=_0xf06f[_0x482f97];return _0x4870eb;};'use strict';var _=require(_0xff06('0x0'));var util=require(_0xff06('0x1'));var moment=require(_0xff06('0x2'));var BPromise=require(_0xff06('0x3'));var rs=require(_0xff06('0x4'));var fs=require('fs');var Redis=require(_0xff06('0x5'));var db=require(_0xff06('0x6'))['db'];var utils=require(_0xff06('0x7'));var logger=require(_0xff06('0x8'))(_0xff06('0x9'));var config=require('../../config/environment');var jayson=require(_0xff06('0xa'));var client=jayson[_0xff06('0xb')][_0xff06('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2621b0,_0xa4ddcc,_0xfecd1b){return new BPromise(function(_0x5037c5,_0x1587a7){return client[_0xff06('0xd')](_0x2621b0,_0xfecd1b)[_0xff06('0xe')](function(_0x34f5fd){logger['info'](_0xff06('0xf'),_0xa4ddcc,_0xff06('0x10'));logger[_0xff06('0x11')](_0xff06('0x12'),_0xa4ddcc,'request\x20sent',JSON[_0xff06('0x13')](_0x34f5fd));if(_0x34f5fd['error']){if(_0x34f5fd[_0xff06('0x14')]['code']===0x1f4){logger[_0xff06('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0xa4ddcc,_0x34f5fd[_0xff06('0x14')][_0xff06('0x15')]);return _0x1587a7(_0x34f5fd[_0xff06('0x14')][_0xff06('0x15')]);}logger[_0xff06('0x14')](_0xff06('0xf'),_0xa4ddcc,_0x34f5fd[_0xff06('0x14')][_0xff06('0x15')]);return _0x5037c5(_0x34f5fd[_0xff06('0x14')]['message']);}else{logger[_0xff06('0x16')](_0xff06('0xf'),_0xa4ddcc,'request\x20sent');_0x5037c5(_0x34f5fd[_0xff06('0x17')][_0xff06('0x15')]);}})[_0xff06('0x18')](function(_0x411ff9){logger[_0xff06('0x14')](_0xff06('0xf'),_0xa4ddcc,_0x411ff9);_0x1587a7(_0x411ff9);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 8244c31..c32f332 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 _0xf2fb=['Router','../../config/environment','get','isAuthenticated','index','/:id/preview','preview','/:id/run','run','/:id/query','post','update','delete','/:id','destroy','exports','multer','util','express'];(function(_0x50f657,_0x4db384){var _0x51db4a=function(_0xf898db){while(--_0xf898db){_0x50f657['push'](_0x50f657['shift']());}};_0x51db4a(++_0x4db384);}(_0xf2fb,0x12d));var _0xbf2f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf2fb[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xbf2f('0x0'));var util=require(_0xbf2f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbf2f('0x2'));var router=express[_0xbf2f('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf2f('0x4'));var controller=require('./analyticCustomReport.controller');router[_0xbf2f('0x5')]('/',auth[_0xbf2f('0x6')](),controller[_0xbf2f('0x7')]);router['get']('/:id',auth[_0xbf2f('0x6')](),controller['show']);router[_0xbf2f('0x5')](_0xbf2f('0x8'),auth[_0xbf2f('0x6')](),controller[_0xbf2f('0x9')]);router[_0xbf2f('0x5')](_0xbf2f('0xa'),auth[_0xbf2f('0x6')](),controller[_0xbf2f('0xb')]);router[_0xbf2f('0x5')](_0xbf2f('0xc'),auth[_0xbf2f('0x6')](),controller['query']);router[_0xbf2f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xbf2f('0xe')]);router[_0xbf2f('0xf')](_0xbf2f('0x10'),auth[_0xbf2f('0x6')](),controller[_0xbf2f('0x11')]);module[_0xbf2f('0x12')]=router; \ No newline at end of file +var _0xcc05=['run','query','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','/:id/preview','/:id/run'];(function(_0x22e0dd,_0x204e12){var _0x21f71b=function(_0x5aec1a){while(--_0x5aec1a){_0x22e0dd['push'](_0x22e0dd['shift']());}};_0x21f71b(++_0x204e12);}(_0xcc05,0x102));var _0x5cc0=function(_0x53c506,_0x1c0fe8){_0x53c506=_0x53c506-0x0;var _0x165888=_0xcc05[_0x53c506];return _0x165888;};'use strict';var multer=require(_0x5cc0('0x0'));var util=require(_0x5cc0('0x1'));var path=require(_0x5cc0('0x2'));var timeout=require(_0x5cc0('0x3'));var express=require(_0x5cc0('0x4'));var router=express['Router']();var auth=require(_0x5cc0('0x5'));var interaction=require(_0x5cc0('0x6'));var config=require(_0x5cc0('0x7'));var controller=require(_0x5cc0('0x8'));router['get']('/',auth[_0x5cc0('0x9')](),controller[_0x5cc0('0xa')]);router[_0x5cc0('0xb')](_0x5cc0('0xc'),auth[_0x5cc0('0x9')](),controller['show']);router[_0x5cc0('0xb')](_0x5cc0('0xd'),auth['isAuthenticated'](),controller['preview']);router[_0x5cc0('0xb')](_0x5cc0('0xe'),auth[_0x5cc0('0x9')](),controller[_0x5cc0('0xf')]);router[_0x5cc0('0xb')]('/:id/query',auth[_0x5cc0('0x9')](),controller[_0x5cc0('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5cc0('0x11')](_0x5cc0('0xc'),auth[_0x5cc0('0x9')](),controller[_0x5cc0('0x12')]);router[_0x5cc0('0x13')](_0x5cc0('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5cc0('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 8b39364..b692509 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 _0xf868=['sequelize','exports','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf868,0xb0));var _0x8f86=function(_0x4ea8ed,_0x3dcbb7){_0x4ea8ed=_0x4ea8ed-0x0;var _0x6ab44e=_0xf868[_0x4ea8ed];return _0x6ab44e;};'use strict';var Sequelize=require(_0x8f86('0x0'));module[_0x8f86('0x1')]={'name':{'type':Sequelize[_0x8f86('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8f86('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x8f86('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x8f86('0x3')]}}; \ No newline at end of file +var _0x7ac3=['STRING','TEXT','sequelize','exports'];(function(_0x43e914,_0x5774df){var _0x34b8e2=function(_0x9da7ab){while(--_0x9da7ab){_0x43e914['push'](_0x43e914['shift']());}};_0x34b8e2(++_0x5774df);}(_0x7ac3,0x136));var _0x37ac=function(_0x2a0139,_0x42d2e0){_0x2a0139=_0x2a0139-0x0;var _0x2462d9=_0x7ac3[_0x2a0139];return _0x2462d9;};'use strict';var Sequelize=require(_0x37ac('0x0'));module[_0x37ac('0x1')]={'name':{'type':Sequelize[_0x37ac('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x37ac('0x2')]},'table':{'type':Sequelize[_0x37ac('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x37ac('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 6a1a7ca..ce75f33 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 _0xd1da=['format','groupBy','orderBy','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','toString','sequelize','QueryTypes','SELECT','cross_join','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','value','getFields','Sequelize','replace','DESC','field','debug','No\x20available\x20data','output','web','fullPath','randomstring','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','savename','COUNT(*)','run','left_join','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','end','json','count','offset','limit','status','set','reject','update','then','DefaultReports','UserProfileResource','destroy','sendStatus','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','AnalyticDefaultReport','include','findAll','rows','catch','show','length','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','preview','join','right_join','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','rules','operator','group','condition','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function'];(function(_0x3667a2,_0x53e630){var _0x10c6ba=function(_0x364527){while(--_0x364527){_0x3667a2['push'](_0x3667a2['shift']());}};_0x10c6ba(++_0x53e630);}(_0xd1da,0xca));var _0xad1d=function(_0x1bd2a6,_0x45f0fc){_0x1bd2a6=_0x1bd2a6-0x0;var _0x525206=_0xd1da[_0x1bd2a6];return _0x525206;};'use strict';var pdf=require(_0xad1d('0x0'));var emlformat=require(_0xad1d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xad1d('0x2'));var jsonpatch=require(_0xad1d('0x3'));var rp=require(_0xad1d('0x4'));var moment=require(_0xad1d('0x5'));var BPromise=require(_0xad1d('0x6'));var Mustache=require(_0xad1d('0x7'));var util=require(_0xad1d('0x8'));var path=require(_0xad1d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xad1d('0xa'));var fs=require('fs');var _=require(_0xad1d('0xb'));var squel=require(_0xad1d('0xc'));var crypto=require(_0xad1d('0xd'));var jsforce=require(_0xad1d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xad1d('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xad1d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xad1d('0x11'));var hardwareService=require(_0xad1d('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xad1d('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1afc3a,_0x5d47be){_0x5d47be=_0x5d47be||0xcc;return function(_0x22bcf2){if(_0x22bcf2){return _0x1afc3a['sendStatus'](_0x5d47be);}return _0x1afc3a['status'](_0x5d47be)[_0xad1d('0x14')]();};}function respondWithResult(_0x18354f,_0xb0c130){_0xb0c130=_0xb0c130||0xc8;return function(_0x4931d9){if(_0x4931d9){return _0x18354f['status'](_0xb0c130)[_0xad1d('0x15')](_0x4931d9);}};}function respondWithFilteredResult(_0x409102,_0x21171d){return function(_0x4ae2b6){if(_0x4ae2b6){var _0x4d1db9=_0x4ae2b6[_0xad1d('0x16')],_0x8d0cf1=_0x21171d['offset'],_0x1561fb=_0x21171d[_0xad1d('0x17')]+_0x21171d[_0xad1d('0x18')],_0x43f3c3;if(_0x1561fb>=_0x4d1db9){_0x1561fb=_0x4d1db9;_0x43f3c3=0xc8;}else{_0x43f3c3=0xce;}_0x409102[_0xad1d('0x19')](_0x43f3c3);return _0x409102[_0xad1d('0x1a')]('Content-Range',_0x8d0cf1+'-'+_0x1561fb+'/'+_0x4d1db9)[_0xad1d('0x15')](_0x4ae2b6);}return null;};}function patchUpdates(_0x569fba){return function(_0x5e0da6){try{jsonpatch['apply'](_0x5e0da6,_0x569fba,!![]);}catch(_0x349af1){return BPromise[_0xad1d('0x1b')](_0x349af1);}return _0x5e0da6['save']();};}function saveUpdates(_0x43c412,_0x511e0e){return function(_0x55c47b){if(_0x55c47b){return _0x55c47b[_0xad1d('0x1c')](_0x43c412)[_0xad1d('0x1d')](function(_0x5760d9){return _0x5760d9;});}return null;};}function removeEntity(_0xd57449,_0x1934ab){return function(_0x2e66c2){if(_0x2e66c2){return _0x2e66c2['destroy']()[_0xad1d('0x1d')](function(){var _0x342e0a=_0x2e66c2['get']({'plain':!![]});var _0x4781da=_0xad1d('0x1e');return db[_0xad1d('0x1f')][_0xad1d('0x20')]({'where':{'type':_0x4781da,'resourceId':_0x342e0a['id']}})[_0xad1d('0x1d')](function(){return _0x2e66c2;});})[_0xad1d('0x1d')](function(){_0xd57449[_0xad1d('0x19')](0xcc)[_0xad1d('0x14')]();});}};}function handleEntityNotFound(_0x643b96,_0x4bf491){return function(_0x580b28){if(!_0x580b28){_0x643b96[_0xad1d('0x21')](0x194);}return _0x580b28;};}function handleError(_0x54a225,_0x5de64f){_0x5de64f=_0x5de64f||0x1f4;return function(_0x156cd1){logger['error'](_0x156cd1['stack']);if(_0x156cd1['name']){delete _0x156cd1[_0xad1d('0x22')];}_0x54a225['status'](_0x5de64f)[_0xad1d('0x23')](_0x156cd1);};}exports[_0xad1d('0x24')]=function(_0x577e4c,_0xfb80c6){var _0x48bec2={},_0x1fee01={},_0x24264b={'count':0x0,'rows':[]};var _0x270217=_[_0xad1d('0x25')](db['AnalyticDefaultReport']['rawAttributes'],function(_0x3d6710){return{'name':_0x3d6710[_0xad1d('0x26')],'type':_0x3d6710['type'][_0xad1d('0x27')]};});_0x1fee01[_0xad1d('0x28')]=_[_0xad1d('0x25')](_0x270217,_0xad1d('0x22'));_0x1fee01[_0xad1d('0x29')]=_[_0xad1d('0x2a')](_0x577e4c[_0xad1d('0x29')]);_0x1fee01[_0xad1d('0x2b')]=_[_0xad1d('0x2c')](_0x1fee01['model'],_0x1fee01[_0xad1d('0x29')]);_0x48bec2[_0xad1d('0x2d')]=_['intersection'](_0x1fee01[_0xad1d('0x28')],qs[_0xad1d('0x2e')](_0x577e4c['query'][_0xad1d('0x2e')]));_0x48bec2[_0xad1d('0x2d')]=_0x48bec2['attributes']['length']?_0x48bec2[_0xad1d('0x2d')]:_0x1fee01[_0xad1d('0x28')];if(!_0x577e4c[_0xad1d('0x29')][_0xad1d('0x2f')](_0xad1d('0x30'))){_0x48bec2['limit']=qs[_0xad1d('0x18')](_0x577e4c['query'][_0xad1d('0x18')]);_0x48bec2[_0xad1d('0x17')]=qs[_0xad1d('0x17')](_0x577e4c['query'][_0xad1d('0x17')]);}_0x48bec2[_0xad1d('0x31')]=qs['sort'](_0x577e4c[_0xad1d('0x29')]['sort']);_0x48bec2[_0xad1d('0x32')]=qs['filters'](_[_0xad1d('0x33')](_0x577e4c[_0xad1d('0x29')],_0x1fee01['filters']));if(_0x577e4c[_0xad1d('0x29')][_0xad1d('0x34')]){_0x48bec2[_0xad1d('0x32')]=_[_0xad1d('0x35')](_0x48bec2['where'],{'$or':_[_0xad1d('0x25')](_0x270217,function(_0xff8a98){if(_0xff8a98[_0xad1d('0x36')]!==_0xad1d('0x37')){var _0x4c1caf={};_0x4c1caf[_0xff8a98['name']]={'$like':'%'+_0x577e4c[_0xad1d('0x29')][_0xad1d('0x34')]+'%'};return _0x4c1caf;}})});}_0x48bec2=_[_0xad1d('0x35')]({},_0x48bec2,_0x577e4c[_0xad1d('0x38')]);var _0x1c4439={'where':_0x48bec2[_0xad1d('0x32')]};return db[_0xad1d('0x39')][_0xad1d('0x16')](_0x1c4439)[_0xad1d('0x1d')](function(_0x1d5bef){_0x24264b[_0xad1d('0x16')]=_0x1d5bef;if(_0x577e4c[_0xad1d('0x29')]['includeAll']){_0x48bec2[_0xad1d('0x3a')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0xad1d('0x3b')](_0x48bec2);})['then'](function(_0xa3310a){_0x24264b[_0xad1d('0x3c')]=_0xa3310a;return _0x24264b;})[_0xad1d('0x1d')](respondWithFilteredResult(_0xfb80c6,_0x48bec2))[_0xad1d('0x3d')](handleError(_0xfb80c6,null));};exports[_0xad1d('0x3e')]=function(_0x3d4d0b,_0x1318cc){var _0x122f2d={'raw':!![],'where':{'id':_0x3d4d0b['params']['id']}},_0x120953={};_0x120953[_0xad1d('0x28')]=_[_0xad1d('0x2a')](db[_0xad1d('0x39')]['rawAttributes']);_0x120953[_0xad1d('0x29')]=_[_0xad1d('0x2a')](_0x3d4d0b[_0xad1d('0x29')]);_0x120953[_0xad1d('0x2b')]=_[_0xad1d('0x2c')](_0x120953[_0xad1d('0x28')],_0x120953[_0xad1d('0x29')]);_0x122f2d[_0xad1d('0x2d')]=_[_0xad1d('0x2c')](_0x120953['model'],qs[_0xad1d('0x2e')](_0x3d4d0b['query'][_0xad1d('0x2e')]));_0x122f2d[_0xad1d('0x2d')]=_0x122f2d['attributes'][_0xad1d('0x3f')]?_0x122f2d[_0xad1d('0x2d')]:_0x120953['model'];if(_0x3d4d0b['query'][_0xad1d('0x40')]){_0x122f2d['include']=[{'all':!![]}];}_0x122f2d=_[_0xad1d('0x35')]({},_0x122f2d,_0x3d4d0b['options']);return db['AnalyticDefaultReport'][_0xad1d('0x41')](_0x122f2d)[_0xad1d('0x1d')](handleEntityNotFound(_0x1318cc,null))['then'](respondWithResult(_0x1318cc,null))[_0xad1d('0x3d')](handleError(_0x1318cc,null));};exports[_0xad1d('0x42')]=function(_0x1be210,_0x568544){return db[_0xad1d('0x39')][_0xad1d('0x42')](_0x1be210['body'],{})[_0xad1d('0x1d')](function(_0x48aa16){var _0x1a61ec=_0x1be210['user'][_0xad1d('0x43')]({'plain':!![]});if(!_0x1a61ec)throw new Error(_0xad1d('0x44'));if(_0x1a61ec['role']===_0xad1d('0x45')){var _0x2918b7=_0x48aa16[_0xad1d('0x43')]({'plain':!![]});var _0x4075c3='Reports';return db['UserProfileSection'][_0xad1d('0x41')]({'where':{'name':_0x4075c3,'userProfileId':_0x1a61ec['userProfileId']},'raw':!![]})[_0xad1d('0x1d')](function(_0xd43152){if(_0xd43152&&_0xd43152[_0xad1d('0x46')]===0x0){return db[_0xad1d('0x1f')][_0xad1d('0x42')]({'name':_0x2918b7['name'],'resourceId':_0x2918b7['id'],'type':'DefaultReports','sectionId':_0xd43152['id']},{})[_0xad1d('0x1d')](function(){return _0x48aa16;});}else{return _0x48aa16;}})[_0xad1d('0x3d')](function(_0x3ccb36){logger['error'](_0xad1d('0x47'),_0x3ccb36);throw _0x3ccb36;});}return _0x48aa16;})[_0xad1d('0x1d')](respondWithResult(_0x568544,0xc9))[_0xad1d('0x3d')](handleError(_0x568544,null));};exports[_0xad1d('0x1c')]=function(_0x2e3799,_0x2e0469){if(_0x2e3799[_0xad1d('0x48')]['id']){delete _0x2e3799['body']['id'];}return db[_0xad1d('0x39')]['find']({'where':{'id':_0x2e3799['params']['id']}})[_0xad1d('0x1d')](handleEntityNotFound(_0x2e0469,null))[_0xad1d('0x1d')](saveUpdates(_0x2e3799[_0xad1d('0x48')],null))[_0xad1d('0x1d')](respondWithResult(_0x2e0469,null))[_0xad1d('0x3d')](handleError(_0x2e0469,null));};exports['destroy']=function(_0x50aa2c,_0x76c12d){return db['AnalyticDefaultReport'][_0xad1d('0x41')]({'where':{'id':_0x50aa2c[_0xad1d('0x49')]['id']}})[_0xad1d('0x1d')](handleEntityNotFound(_0x76c12d,null))['then'](removeEntity(_0x76c12d,null))[_0xad1d('0x3d')](handleError(_0x76c12d,null));};exports[_0xad1d('0x4a')]=function(_0x55f538,_0x516d61){var _0x206c96=0xa;var _0x36a13c=[_0xad1d('0x4b'),'left_join',_0xad1d('0x4c'),'cross_join'];var _0x554c6b={'SUM':'SUM(%s)','COUNT':_0xad1d('0x4d'),'COUNT DISTINCT':_0xad1d('0x4e'),'MAX':_0xad1d('0x4f'),'MIN':_0xad1d('0x50'),'AVG':_0xad1d('0x51'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xad1d('0x52'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2d58ac={'SEC_TO_TIME':_0xad1d('0x53'),'DATE':_0xad1d('0x54'),'HOUR':_0xad1d('0x55'),'ROUND':_0xad1d('0x56'),'UNIX_TIMESTAMP':_0xad1d('0x57')};var _0x244ffc=function(_0x27424a){return!_[_0xad1d('0x58')]([_0xad1d('0x59'),_0xad1d('0x5a'),_0xad1d('0x5b'),'IS\x20NOT\x20EMPTY'],_0x27424a);};var _0x143dd9=function(_0x3010f8){if(!_0x3010f8||!_0x3010f8[_0xad1d('0x5c')]['length']){return'';}for(var _0x300073='(',_0x271223=0x0;_0x271223<_0x3010f8[_0xad1d('0x5c')][_0xad1d('0x3f')];_0x271223+=0x1){_0x271223>0x0&&(_0x300073+='\x20'+_0x3010f8[_0xad1d('0x5d')]+'\x20');_0x300073+=_0x3010f8[_0xad1d('0x5c')][_0x271223][_0xad1d('0x5e')]?_0x143dd9(_0x3010f8[_0xad1d('0x5c')][_0x271223][_0xad1d('0x5e')]):_0x3010f8[_0xad1d('0x5c')][_0x271223]['field']+'\x20'+_0x3010f8[_0xad1d('0x5c')][_0x271223]['condition']+(_0x244ffc(_0x3010f8['rules'][_0x271223][_0xad1d('0x5f')])?'\x20'+_0x3010f8[_0xad1d('0x5c')][_0x271223]['value']:'');}return _0x300073+')';};var _0x250b01={'where':{'id':_0x55f538[_0xad1d('0x49')]['id']}},_0x16902c,_0x153fac,_0x3e6d3a,_0x55bc81,_0x2a0e83;_0x250b01=_[_0xad1d('0x35')]({},_0x250b01,_0x55f538[_0xad1d('0x38')]);return db['AnalyticDefaultReport'][_0xad1d('0x41')](_0x250b01)[_0xad1d('0x1d')](function(_0x35b719){if(_0x35b719){_0x16902c=_0x35b719;return _0x35b719['getFields']();}return null;})[_0xad1d('0x1d')](function(_0x3a1210){if(_0x3a1210){if(!_0x3a1210[_0xad1d('0x3f')]){throw new db['Sequelize'][(_0xad1d('0x60'))](_0xad1d('0x61'),0x193);}_0x153fac=_0x3a1210;return db[_0xad1d('0x62')][_0xad1d('0x3b')]({'raw':!![]});}return null;})[_0xad1d('0x1d')](function(_0x131141){if(_0x131141){_0x3e6d3a=_[_0xad1d('0x63')](_0x131141,'id');var _0x45f642;var _0x4435a5=squel[_0xad1d('0x64')]();_0x4435a5[_0xad1d('0x65')](_0x16902c[_0xad1d('0x66')]);for(var _0x34ee92=0x0;_0x34ee92<_0x153fac['length'];_0x34ee92+=0x1){_0x45f642=_0x153fac[_0x34ee92][_0xad1d('0x67')]?_0x3e6d3a[_0x153fac[_0x34ee92]['MetricId']][_0xad1d('0x68')]:_0x153fac[_0x34ee92]['field'];_0x45f642=_0x153fac[_0x34ee92][_0xad1d('0x69')]?_['replace'](_0x554c6b[_0x153fac[_0x34ee92][_0xad1d('0x69')]],'%s',_0x45f642):_0x45f642;_0x45f642=_0x153fac[_0x34ee92][_0xad1d('0x6a')]?_['replace'](_0x2d58ac[_0x153fac[_0x34ee92][_0xad1d('0x6a')]],'%s',_0x45f642):_0x45f642;if(_0x153fac[_0x34ee92][_0xad1d('0x6b')]){_0x4435a5[_0xad1d('0x5e')](_0x45f642);}_0x153fac[_0x34ee92][_0xad1d('0x6c')]&&_0x4435a5['order'](_0x45f642,_0x153fac[_0x34ee92][_0xad1d('0x6c')]==='DESC'?![]:!![]);_0x4435a5['field'](_0x45f642,_0x153fac[_0x34ee92][_0xad1d('0x6d')]||_0x45f642);}if(_0x16902c[_0xad1d('0x6e')]){_0x16902c[_0xad1d('0x6e')]=JSON[_0xad1d('0x6f')](_0x16902c[_0xad1d('0x6e')]);for(var _0x5586de=0x0;_0x5586de<_0x16902c[_0xad1d('0x6e')]['length'];_0x5586de+=0x1){if(_0x16902c[_0xad1d('0x6e')][_0x5586de]['type']&&_[_0xad1d('0x58')](_0x36a13c,_0x16902c[_0xad1d('0x6e')][_0x5586de]['type'])&&_0x16902c[_0xad1d('0x6e')][_0x5586de][_0xad1d('0x70')]&&_0x16902c[_0xad1d('0x6e')][_0x5586de]['foreignTable']&&_0x16902c[_0xad1d('0x6e')][_0x5586de][_0xad1d('0x71')]){_0x4435a5[_0x16902c[_0xad1d('0x6e')][_0x5586de][_0xad1d('0x36')]](_0x16902c[_0xad1d('0x6e')][_0x5586de][_0xad1d('0x72')],null,util[_0xad1d('0x6a')](_0xad1d('0x73'),_0x16902c[_0xad1d('0x66')],_0x16902c[_0xad1d('0x6e')][_0x5586de][_0xad1d('0x70')],_0x16902c[_0xad1d('0x6e')][_0x5586de]['foreignTable'],_0x16902c['joins'][_0x5586de][_0xad1d('0x71')]));}}}if(_0x16902c[_0xad1d('0x74')]){_0x16902c['conditions']=JSON['parse'](_0x16902c['conditions']);_0x4435a5['where'](_0x143dd9(_0x16902c[_0xad1d('0x74')][_0xad1d('0x5e')]));}_0x2a0e83=_0x4435a5[_0xad1d('0x75')]();_0x4435a5[_0xad1d('0x18')](_0x206c96);_0x4435a5[_0xad1d('0x17')](0x0);logger['debug']('Limited\x20Query:',_0x4435a5[_0xad1d('0x76')]());return db[_0xad1d('0x77')][_0xad1d('0x29')](_0x4435a5['toString'](),{'type':db['sequelize'][_0xad1d('0x78')][_0xad1d('0x79')]});}})[_0xad1d('0x1d')](respondWithResult(_0x516d61,null))[_0xad1d('0x3d')](handleError(_0x516d61,null));};function runReport(_0x4798f0,_0x859f04,_0x1ce5f5){var _0x44784e=_0x859f04[_0xad1d('0x22')];var _0x756e9f=0xa;var _0x18f1da=[_0xad1d('0x4b'),'left_join',_0xad1d('0x4c'),_0xad1d('0x7a')];var _0x239ab5={'SUM':_0xad1d('0x7b'),'COUNT':_0xad1d('0x4d'),'COUNT DISTINCT':_0xad1d('0x4e'),'MAX':'MAX(%s)','MIN':_0xad1d('0x50'),'AVG':_0xad1d('0x51'),'GROUP_CONCAT':_0xad1d('0x7c'),'GROUP_CONCAT ASC':_0xad1d('0x52'),'GROUP_CONCAT DESC':_0xad1d('0x7d')};var _0xa62d9f={'SEC_TO_TIME':_0xad1d('0x53'),'DATE':_0xad1d('0x54'),'HOUR':_0xad1d('0x55'),'ROUND':_0xad1d('0x56'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1a0e44=function(_0x689d04){return!_[_0xad1d('0x58')]([_0xad1d('0x59'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xad1d('0x7e')],_0x689d04);};var _0x5689c7=function(_0x11920a){if(!_0x11920a||!_0x11920a[_0xad1d('0x5c')][_0xad1d('0x3f')]){return'';}for(var _0x41683b='(',_0x5b6ef2=0x0;_0x5b6ef2<_0x11920a[_0xad1d('0x5c')]['length'];_0x5b6ef2+=0x1){_0x5b6ef2>0x0&&(_0x41683b+='\x20'+_0x11920a[_0xad1d('0x5d')]+'\x20');_0x41683b+=_0x11920a[_0xad1d('0x5c')][_0x5b6ef2][_0xad1d('0x5e')]?_0x5689c7(_0x11920a[_0xad1d('0x5c')][_0x5b6ef2]['group']):_0x11920a[_0xad1d('0x5c')][_0x5b6ef2]['field']+'\x20'+_0x11920a[_0xad1d('0x5c')][_0x5b6ef2][_0xad1d('0x5f')]+(_0x1a0e44(_0x11920a[_0xad1d('0x5c')][_0x5b6ef2][_0xad1d('0x5f')])?'\x20'+_0x11920a['rules'][_0x5b6ef2][_0xad1d('0x7f')]:'');}return _0x41683b+')';};var _0x4bf2a1={'where':{'id':_0x4798f0['id']}},_0x1e8a46,_0x23b56f,_0xc3f532,_0x4dd453,_0x442b88;_0x4bf2a1=_[_0xad1d('0x35')]({},_0x4bf2a1,_0x1ce5f5);return db[_0xad1d('0x39')][_0xad1d('0x41')](_0x4bf2a1)[_0xad1d('0x1d')](function(_0x33672a){if(_0x33672a){_0x1e8a46=_0x33672a;return _0x33672a[_0xad1d('0x80')]();}return null;})[_0xad1d('0x1d')](function(_0x1914f6){if(_0x1914f6){if(!_0x1914f6['length']){throw new db[(_0xad1d('0x81'))]['ValidationErrorItem'](_0xad1d('0x61'),0x193);}_0x23b56f=_0x1914f6;return db[_0xad1d('0x62')][_0xad1d('0x3b')]({'raw':!![]});}return null;})[_0xad1d('0x1d')](function(_0x3fab7b){if(_0x3fab7b){_0xc3f532=_[_0xad1d('0x63')](_0x3fab7b,'id');var _0x21008f;var _0x311e2b=squel[_0xad1d('0x64')]();_0x311e2b['from'](_0x1e8a46[_0xad1d('0x66')]);for(var _0x151691=0x0;_0x151691<_0x23b56f[_0xad1d('0x3f')];_0x151691+=0x1){_0x21008f=_0x23b56f[_0x151691][_0xad1d('0x67')]?_0xc3f532[_0x23b56f[_0x151691]['MetricId']]['metric']:_0x23b56f[_0x151691]['field'];_0x21008f=_0x23b56f[_0x151691]['function']?_[_0xad1d('0x82')](_0x239ab5[_0x23b56f[_0x151691][_0xad1d('0x69')]],'%s',_0x21008f):_0x21008f;_0x21008f=_0x23b56f[_0x151691][_0xad1d('0x6a')]?_[_0xad1d('0x82')](_0xa62d9f[_0x23b56f[_0x151691][_0xad1d('0x6a')]],'%s',_0x21008f):_0x21008f;if(_0x23b56f[_0x151691]['groupBy']){_0x311e2b[_0xad1d('0x5e')](_0x21008f);}_0x23b56f[_0x151691][_0xad1d('0x6c')]&&_0x311e2b[_0xad1d('0x31')](_0x21008f,_0x23b56f[_0x151691][_0xad1d('0x6c')]===_0xad1d('0x83')?![]:!![]);_0x311e2b[_0xad1d('0x84')](_0x21008f,_0x23b56f[_0x151691][_0xad1d('0x6d')]||_0x21008f);}if(_0x1e8a46[_0xad1d('0x6e')]){_0x1e8a46[_0xad1d('0x6e')]=JSON[_0xad1d('0x6f')](_0x1e8a46[_0xad1d('0x6e')]);for(var _0x5a864c=0x0;_0x5a864c<_0x1e8a46[_0xad1d('0x6e')][_0xad1d('0x3f')];_0x5a864c+=0x1){if(_0x1e8a46[_0xad1d('0x6e')][_0x5a864c][_0xad1d('0x36')]&&_[_0xad1d('0x58')](_0x18f1da,_0x1e8a46[_0xad1d('0x6e')][_0x5a864c][_0xad1d('0x36')])&&_0x1e8a46[_0xad1d('0x6e')][_0x5a864c][_0xad1d('0x70')]&&_0x1e8a46['joins'][_0x5a864c]['foreignTable']&&_0x1e8a46[_0xad1d('0x6e')][_0x5a864c]['foreignKey']){_0x311e2b[_0x1e8a46[_0xad1d('0x6e')][_0x5a864c]['type']](_0x1e8a46[_0xad1d('0x6e')][_0x5a864c][_0xad1d('0x72')],null,util[_0xad1d('0x6a')](_0xad1d('0x73'),_0x1e8a46['table'],_0x1e8a46[_0xad1d('0x6e')][_0x5a864c][_0xad1d('0x70')],_0x1e8a46[_0xad1d('0x6e')][_0x5a864c]['foreignTable'],_0x1e8a46[_0xad1d('0x6e')][_0x5a864c]['foreignKey']));}}}if(_0x1e8a46[_0xad1d('0x74')]){_0x1e8a46[_0xad1d('0x74')]=JSON['parse'](_0x1e8a46[_0xad1d('0x74')]);_0x311e2b[_0xad1d('0x32')](_0x5689c7(_0x1e8a46[_0xad1d('0x74')][_0xad1d('0x5e')]));}_0x442b88=_0x311e2b[_0xad1d('0x75')]();_0x311e2b[_0xad1d('0x18')](_0x756e9f);_0x311e2b['offset'](0x0);logger[_0xad1d('0x85')]('Limited\x20Query:',_0x311e2b[_0xad1d('0x76')]());return db[_0xad1d('0x77')][_0xad1d('0x29')](_0x311e2b[_0xad1d('0x76')](),{'type':db[_0xad1d('0x77')][_0xad1d('0x78')][_0xad1d('0x79')]});}})[_0xad1d('0x1d')](function(_0x36a419){if(!_0x36a419[_0xad1d('0x3f')]){throw new db[(_0xad1d('0x81'))][(_0xad1d('0x60'))](_0xad1d('0x86'),0xcc);}if(_0x859f04[_0xad1d('0x87')]===_0xad1d('0x88')){return null;}var _0x196c54=_[_0xad1d('0x35')](_0x859f04,{'name':_0x859f04[_0xad1d('0x89')]||_0x859f04['name']||_0x1e8a46[_0xad1d('0x22')],'basename':_0x44784e,'savename':util[_0xad1d('0x6a')]('%s-%s.%s',_0x859f04[_0xad1d('0x22')]||_0x1e8a46[_0xad1d('0x22')],require(_0xad1d('0x8a'))['generate'](0x4),_0x859f04['output']||_0xad1d('0x8b')),'reportId':_0x1e8a46['id'],'reportType':_0xad1d('0x8c')});return db[_0xad1d('0x8d')]['create'](_0x196c54,{'raw':!![]});})[_0xad1d('0x1d')](function(_0x5c5cce){if(_0x1e8a46[_0xad1d('0x66')]===_0xad1d('0x8e')){_0x442b88['where'](_0x1e8a46[_0xad1d('0x66')]+_0xad1d('0x8f'),_0x859f04[_0xad1d('0x90')],_0x859f04['endDate']);}else{_0x442b88[_0xad1d('0x32')](_0x1e8a46['table']+_0xad1d('0x91'),_0x859f04[_0xad1d('0x90')],_0x859f04[_0xad1d('0x92')]);}if(_0x5c5cce){logger[_0xad1d('0x93')](_0xad1d('0x94'),_0x442b88[_0xad1d('0x76')]());require('child_process')[_0xad1d('0x95')](path[_0xad1d('0x4b')](__dirname,'../../components/export/',_0x5c5cce[_0xad1d('0x87')]),[_0x5c5cce['id'],_0x442b88['toString'](),path[_0xad1d('0x4b')](__dirname,'../../files/reports',_0x5c5cce[_0xad1d('0x96')]),_0x44784e]);return _0x5c5cce;}else{var _0xa02543=squel['select']();_0xa02543[_0xad1d('0x65')]('('+_0x442b88['toString']()+')','countTable');_0xa02543[_0xad1d('0x84')](_0xad1d('0x97'),_0xad1d('0x16'));_0x442b88[_0xad1d('0x18')](_0x859f04[_0xad1d('0x18')]||_0x756e9f);_0x442b88[_0xad1d('0x17')](_0x859f04['offset']||0x0);return db[_0xad1d('0x77')][_0xad1d('0x29')](_0xa02543[_0xad1d('0x76')](),{'type':db['sequelize']['QueryTypes'][_0xad1d('0x79')]})['then'](function(_0x163bd5){if(!_0x163bd5[_0xad1d('0x3f')]){_0x4dd453=0x0;}else{_0x4dd453=_0x163bd5[0x0][_0xad1d('0x16')]||0x0;}return db['sequelize'][_0xad1d('0x29')](_0x442b88['toString'](),{'type':db[_0xad1d('0x77')][_0xad1d('0x78')][_0xad1d('0x79')]});})[_0xad1d('0x1d')](function(_0x13f335){return{'rows':_0x13f335||[],'count':_0x4dd453};});}});}exports[_0xad1d('0x98')]=function(_0x5b823c,_0x521b95){return runReport(_0x5b823c[_0xad1d('0x49')],_0x5b823c[_0xad1d('0x29')],_0x5b823c[_0xad1d('0x38')])['then'](respondWithResult(_0x521b95,null))[_0xad1d('0x3d')](handleError(_0x521b95,null));};exports['runReport']=runReport;exports['query']=function(_0x257ca8,_0x24989f){var _0xd112e7=0xa;var _0x1030c8=[_0xad1d('0x4b'),_0xad1d('0x99'),_0xad1d('0x4c'),_0xad1d('0x7a')];var _0x3f41f1={'SUM':_0xad1d('0x7b'),'COUNT':_0xad1d('0x4d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xad1d('0x4f'),'MIN':'MIN(%s)','AVG':_0xad1d('0x51'),'GROUP_CONCAT':_0xad1d('0x7c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xad1d('0x7d')};var _0x394419={'SEC_TO_TIME':_0xad1d('0x53'),'DATE':_0xad1d('0x54'),'HOUR':_0xad1d('0x55'),'ROUND':_0xad1d('0x56'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xf80f9c=function(_0x179eab){return!_[_0xad1d('0x58')]([_0xad1d('0x59'),'IS\x20NOT\x20NULL',_0xad1d('0x5b'),_0xad1d('0x7e')],_0x179eab);};var _0x1b386e=function(_0x45a113){if(!_0x45a113||!_0x45a113[_0xad1d('0x5c')][_0xad1d('0x3f')]){return'';}for(var _0x408139='(',_0x432113=0x0;_0x432113<_0x45a113[_0xad1d('0x5c')][_0xad1d('0x3f')];_0x432113+=0x1){_0x432113>0x0&&(_0x408139+='\x20'+_0x45a113['operator']+'\x20');_0x408139+=_0x45a113[_0xad1d('0x5c')][_0x432113][_0xad1d('0x5e')]?_0x1b386e(_0x45a113[_0xad1d('0x5c')][_0x432113][_0xad1d('0x5e')]):_0x45a113[_0xad1d('0x5c')][_0x432113]['field']+'\x20'+_0x45a113[_0xad1d('0x5c')][_0x432113][_0xad1d('0x5f')]+(_0xf80f9c(_0x45a113['rules'][_0x432113]['condition'])?'\x20'+_0x45a113[_0xad1d('0x5c')][_0x432113]['value']:'');}return _0x408139+')';};var _0x34c2f1={'where':{'id':_0x257ca8[_0xad1d('0x49')]['id']}},_0x377ca8,_0x40d2bc,_0x351b2f,_0xe82649,_0x56f1c0;_0x34c2f1=_[_0xad1d('0x35')]({},_0x34c2f1,_0x257ca8[_0xad1d('0x38')]);return db[_0xad1d('0x39')]['find'](_0x34c2f1)[_0xad1d('0x1d')](function(_0x3e9959){if(_0x3e9959){_0x377ca8=_0x3e9959;return _0x3e9959[_0xad1d('0x80')]();}return null;})['then'](function(_0x30a7c3){if(_0x30a7c3){if(!_0x30a7c3[_0xad1d('0x3f')]){throw new db[(_0xad1d('0x81'))]['ValidationErrorItem'](_0xad1d('0x61'),0x193);}_0x40d2bc=_0x30a7c3;return db[_0xad1d('0x62')][_0xad1d('0x3b')]({'raw':!![]});}return null;})['then'](function(_0x2f7124){if(_0x2f7124){_0x351b2f=_[_0xad1d('0x63')](_0x2f7124,'id');var _0x50c8d5;var _0x38f721=squel['select']();_0x38f721[_0xad1d('0x65')](_0x377ca8[_0xad1d('0x66')]);for(var _0x97a42f=0x0;_0x97a42f<_0x40d2bc['length'];_0x97a42f+=0x1){_0x50c8d5=_0x40d2bc[_0x97a42f][_0xad1d('0x67')]?_0x351b2f[_0x40d2bc[_0x97a42f]['MetricId']][_0xad1d('0x68')]:_0x40d2bc[_0x97a42f][_0xad1d('0x84')];_0x50c8d5=_0x40d2bc[_0x97a42f][_0xad1d('0x69')]?_[_0xad1d('0x82')](_0x3f41f1[_0x40d2bc[_0x97a42f][_0xad1d('0x69')]],'%s',_0x50c8d5):_0x50c8d5;_0x50c8d5=_0x40d2bc[_0x97a42f][_0xad1d('0x6a')]?_['replace'](_0x394419[_0x40d2bc[_0x97a42f]['format']],'%s',_0x50c8d5):_0x50c8d5;if(_0x40d2bc[_0x97a42f][_0xad1d('0x6b')]){_0x38f721['group'](_0x50c8d5);}_0x40d2bc[_0x97a42f][_0xad1d('0x6c')]&&_0x38f721[_0xad1d('0x31')](_0x50c8d5,_0x40d2bc[_0x97a42f][_0xad1d('0x6c')]===_0xad1d('0x83')?![]:!![]);_0x38f721[_0xad1d('0x84')](_0x50c8d5,_0x40d2bc[_0x97a42f][_0xad1d('0x6d')]||_0x50c8d5);}if(_0x377ca8['joins']){_0x377ca8['joins']=JSON[_0xad1d('0x6f')](_0x377ca8[_0xad1d('0x6e')]);for(var _0x190fd2=0x0;_0x190fd2<_0x377ca8[_0xad1d('0x6e')][_0xad1d('0x3f')];_0x190fd2+=0x1){if(_0x377ca8[_0xad1d('0x6e')][_0x190fd2][_0xad1d('0x36')]&&_[_0xad1d('0x58')](_0x1030c8,_0x377ca8['joins'][_0x190fd2][_0xad1d('0x36')])&&_0x377ca8[_0xad1d('0x6e')][_0x190fd2]['parentKey']&&_0x377ca8[_0xad1d('0x6e')][_0x190fd2][_0xad1d('0x72')]&&_0x377ca8[_0xad1d('0x6e')][_0x190fd2][_0xad1d('0x71')]){_0x38f721[_0x377ca8[_0xad1d('0x6e')][_0x190fd2][_0xad1d('0x36')]](_0x377ca8[_0xad1d('0x6e')][_0x190fd2][_0xad1d('0x72')],null,util[_0xad1d('0x6a')](_0xad1d('0x73'),_0x377ca8[_0xad1d('0x66')],_0x377ca8[_0xad1d('0x6e')][_0x190fd2][_0xad1d('0x70')],_0x377ca8[_0xad1d('0x6e')][_0x190fd2]['foreignTable'],_0x377ca8[_0xad1d('0x6e')][_0x190fd2][_0xad1d('0x71')]));}}}if(_0x377ca8['conditions']){_0x377ca8[_0xad1d('0x74')]=JSON[_0xad1d('0x6f')](_0x377ca8['conditions']);_0x38f721[_0xad1d('0x32')](_0x1b386e(_0x377ca8[_0xad1d('0x74')][_0xad1d('0x5e')]));}_0x56f1c0=_0x38f721[_0xad1d('0x75')]();_0x38f721['limit'](_0xd112e7);_0x38f721[_0xad1d('0x17')](0x0);logger[_0xad1d('0x85')]('Limited\x20Query:',_0x38f721[_0xad1d('0x76')]());return db[_0xad1d('0x77')]['query'](_0x38f721[_0xad1d('0x76')](),{'type':db[_0xad1d('0x77')][_0xad1d('0x78')][_0xad1d('0x79')]});}})['then'](function(){return{'sql':_0x56f1c0[_0xad1d('0x76')]()};})[_0xad1d('0x1d')](respondWithResult(_0x24989f,null))[_0xad1d('0x3d')](handleError(_0x24989f,null));}; \ No newline at end of file +var _0x0b3b=['conditions','group','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','join','left_join','SUM(%s)','operator','AnalyticMetric','order','QueryTypes','No\x20available\x20data','output','web','fullPath','randomstring','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','fork','../../files/reports','savename','countTable','COUNT(*)','run','runReport','COUNT(DISTINCT\x20%s)','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','DefaultReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','findAll','rows','show','params','rawAttributes','length','include','options','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s'];(function(_0x1abb4d,_0x13e318){var _0x55686e=function(_0x56b6e4){while(--_0x56b6e4){_0x1abb4d['push'](_0x1abb4d['shift']());}};_0x55686e(++_0x13e318);}(_0x0b3b,0xcd));var _0xb0b3=function(_0x1d174c,_0xd71a94){_0x1d174c=_0x1d174c-0x0;var _0x193cbf=_0x0b3b[_0x1d174c];return _0x193cbf;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb0b3('0x0'));var rimraf=require(_0xb0b3('0x1'));var zipdir=require(_0xb0b3('0x2'));var jsonpatch=require(_0xb0b3('0x3'));var rp=require(_0xb0b3('0x4'));var moment=require(_0xb0b3('0x5'));var BPromise=require(_0xb0b3('0x6'));var Mustache=require(_0xb0b3('0x7'));var util=require(_0xb0b3('0x8'));var path=require(_0xb0b3('0x9'));var sox=require(_0xb0b3('0xa'));var csv=require('to-csv');var ejs=require(_0xb0b3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb0b3('0xc'));var crypto=require(_0xb0b3('0xd'));var jsforce=require(_0xb0b3('0xe'));var deskjs=require(_0xb0b3('0xf'));var toCsv=require(_0xb0b3('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb0b3('0x11'));var qs=require(_0xb0b3('0x12'));var as=require(_0xb0b3('0x13'));var hardwareService=require(_0xb0b3('0x14'));var logger=require(_0xb0b3('0x15'))(_0xb0b3('0x16'));var utils=require(_0xb0b3('0x17'));var config=require('../../config/environment');var db=require(_0xb0b3('0x18'))['db'];function respondWithStatusCode(_0x442ab8,_0x5d9f21){_0x5d9f21=_0x5d9f21||0xcc;return function(_0x46ff50){if(_0x46ff50){return _0x442ab8['sendStatus'](_0x5d9f21);}return _0x442ab8[_0xb0b3('0x19')](_0x5d9f21)[_0xb0b3('0x1a')]();};}function respondWithResult(_0x315d5b,_0x2f654d){_0x2f654d=_0x2f654d||0xc8;return function(_0x3692ac){if(_0x3692ac){return _0x315d5b[_0xb0b3('0x19')](_0x2f654d)[_0xb0b3('0x1b')](_0x3692ac);}};}function respondWithFilteredResult(_0x2c284d,_0x7bfb7){return function(_0x49a115){if(_0x49a115){var _0xd13b9d=_0x49a115[_0xb0b3('0x1c')],_0x4299bb=_0x7bfb7['offset'],_0x5baf49=_0x7bfb7[_0xb0b3('0x1d')]+_0x7bfb7[_0xb0b3('0x1e')],_0x411543;if(_0x5baf49>=_0xd13b9d){_0x5baf49=_0xd13b9d;_0x411543=0xc8;}else{_0x411543=0xce;}_0x2c284d['status'](_0x411543);return _0x2c284d['set'](_0xb0b3('0x1f'),_0x4299bb+'-'+_0x5baf49+'/'+_0xd13b9d)['json'](_0x49a115);}return null;};}function patchUpdates(_0x55a2b3){return function(_0x27b06e){try{jsonpatch[_0xb0b3('0x20')](_0x27b06e,_0x55a2b3,!![]);}catch(_0xdf1655){return BPromise[_0xb0b3('0x21')](_0xdf1655);}return _0x27b06e[_0xb0b3('0x22')]();};}function saveUpdates(_0x1a5ee2,_0x3b48bf){return function(_0x59f3b4){if(_0x59f3b4){return _0x59f3b4[_0xb0b3('0x23')](_0x1a5ee2)[_0xb0b3('0x24')](function(_0x570dd9){return _0x570dd9;});}return null;};}function removeEntity(_0x1d87f1,_0x472076){return function(_0x1ce586){if(_0x1ce586){return _0x1ce586[_0xb0b3('0x25')]()[_0xb0b3('0x24')](function(){var _0x48e07c=_0x1ce586['get']({'plain':!![]});var _0x2f24df=_0xb0b3('0x26');return db[_0xb0b3('0x27')]['destroy']({'where':{'type':_0x2f24df,'resourceId':_0x48e07c['id']}})[_0xb0b3('0x24')](function(){return _0x1ce586;});})[_0xb0b3('0x24')](function(){_0x1d87f1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10eba9,_0x18763f){return function(_0xb3266c){if(!_0xb3266c){_0x10eba9[_0xb0b3('0x28')](0x194);}return _0xb3266c;};}function handleError(_0x28b41f,_0x551a1a){_0x551a1a=_0x551a1a||0x1f4;return function(_0xbdfb12){logger[_0xb0b3('0x29')](_0xbdfb12[_0xb0b3('0x2a')]);if(_0xbdfb12[_0xb0b3('0x2b')]){delete _0xbdfb12[_0xb0b3('0x2b')];}_0x28b41f[_0xb0b3('0x19')](_0x551a1a)[_0xb0b3('0x2c')](_0xbdfb12);};}exports[_0xb0b3('0x2d')]=function(_0x2aab3c,_0x1ddf24){var _0x4487ee={},_0x154f2c={},_0x38f838={'count':0x0,'rows':[]};var _0x40f453=_[_0xb0b3('0x2e')](db[_0xb0b3('0x2f')]['rawAttributes'],function(_0x21d503){return{'name':_0x21d503[_0xb0b3('0x30')],'type':_0x21d503[_0xb0b3('0x31')][_0xb0b3('0x32')]};});_0x154f2c[_0xb0b3('0x33')]=_[_0xb0b3('0x2e')](_0x40f453,'name');_0x154f2c[_0xb0b3('0x34')]=_[_0xb0b3('0x35')](_0x2aab3c[_0xb0b3('0x34')]);_0x154f2c[_0xb0b3('0x36')]=_[_0xb0b3('0x37')](_0x154f2c[_0xb0b3('0x33')],_0x154f2c[_0xb0b3('0x34')]);_0x4487ee[_0xb0b3('0x38')]=_[_0xb0b3('0x37')](_0x154f2c[_0xb0b3('0x33')],qs[_0xb0b3('0x39')](_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x39')]));_0x4487ee['attributes']=_0x4487ee[_0xb0b3('0x38')]['length']?_0x4487ee[_0xb0b3('0x38')]:_0x154f2c[_0xb0b3('0x33')];if(!_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x3a')](_0xb0b3('0x3b'))){_0x4487ee[_0xb0b3('0x1e')]=qs[_0xb0b3('0x1e')](_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x1e')]);_0x4487ee[_0xb0b3('0x1d')]=qs[_0xb0b3('0x1d')](_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x1d')]);}_0x4487ee['order']=qs[_0xb0b3('0x3c')](_0x2aab3c[_0xb0b3('0x34')]['sort']);_0x4487ee['where']=qs[_0xb0b3('0x36')](_[_0xb0b3('0x3d')](_0x2aab3c[_0xb0b3('0x34')],_0x154f2c[_0xb0b3('0x36')]));if(_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x3e')]){_0x4487ee[_0xb0b3('0x3f')]=_['merge'](_0x4487ee[_0xb0b3('0x3f')],{'$or':_[_0xb0b3('0x2e')](_0x40f453,function(_0x38bd10){if(_0x38bd10[_0xb0b3('0x31')]!==_0xb0b3('0x40')){var _0x515d39={};_0x515d39[_0x38bd10[_0xb0b3('0x2b')]]={'$like':'%'+_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x3e')]+'%'};return _0x515d39;}})});}_0x4487ee=_[_0xb0b3('0x41')]({},_0x4487ee,_0x2aab3c['options']);var _0x31a3c4={'where':_0x4487ee[_0xb0b3('0x3f')]};return db[_0xb0b3('0x2f')][_0xb0b3('0x1c')](_0x31a3c4)[_0xb0b3('0x24')](function(_0x31a082){_0x38f838['count']=_0x31a082;if(_0x2aab3c[_0xb0b3('0x34')][_0xb0b3('0x42')]){_0x4487ee['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0xb0b3('0x43')](_0x4487ee);})[_0xb0b3('0x24')](function(_0x286f2c){_0x38f838[_0xb0b3('0x44')]=_0x286f2c;return _0x38f838;})[_0xb0b3('0x24')](respondWithFilteredResult(_0x1ddf24,_0x4487ee))['catch'](handleError(_0x1ddf24,null));};exports[_0xb0b3('0x45')]=function(_0x2bccb3,_0x4772a2){var _0x2737a4={'raw':!![],'where':{'id':_0x2bccb3[_0xb0b3('0x46')]['id']}},_0x25448c={};_0x25448c[_0xb0b3('0x33')]=_[_0xb0b3('0x35')](db[_0xb0b3('0x2f')][_0xb0b3('0x47')]);_0x25448c[_0xb0b3('0x34')]=_['keys'](_0x2bccb3['query']);_0x25448c[_0xb0b3('0x36')]=_[_0xb0b3('0x37')](_0x25448c[_0xb0b3('0x33')],_0x25448c[_0xb0b3('0x34')]);_0x2737a4['attributes']=_[_0xb0b3('0x37')](_0x25448c[_0xb0b3('0x33')],qs['fields'](_0x2bccb3['query'][_0xb0b3('0x39')]));_0x2737a4['attributes']=_0x2737a4['attributes'][_0xb0b3('0x48')]?_0x2737a4[_0xb0b3('0x38')]:_0x25448c[_0xb0b3('0x33')];if(_0x2bccb3[_0xb0b3('0x34')][_0xb0b3('0x42')]){_0x2737a4[_0xb0b3('0x49')]=[{'all':!![]}];}_0x2737a4=_['merge']({},_0x2737a4,_0x2bccb3[_0xb0b3('0x4a')]);return db[_0xb0b3('0x2f')][_0xb0b3('0x4b')](_0x2737a4)[_0xb0b3('0x24')](handleEntityNotFound(_0x4772a2,null))[_0xb0b3('0x24')](respondWithResult(_0x4772a2,null))[_0xb0b3('0x4c')](handleError(_0x4772a2,null));};exports[_0xb0b3('0x4d')]=function(_0x13464f,_0x32c859){return db['AnalyticDefaultReport'][_0xb0b3('0x4d')](_0x13464f['body'],{})['then'](function(_0x599eae){var _0x1260be=_0x13464f[_0xb0b3('0x4e')][_0xb0b3('0x4f')]({'plain':!![]});if(!_0x1260be)throw new Error(_0xb0b3('0x50'));if(_0x1260be['role']==='user'){var _0x787cf3=_0x599eae[_0xb0b3('0x4f')]({'plain':!![]});var _0x1732dd=_0xb0b3('0x51');return db[_0xb0b3('0x52')][_0xb0b3('0x4b')]({'where':{'name':_0x1732dd,'userProfileId':_0x1260be['userProfileId']},'raw':!![]})[_0xb0b3('0x24')](function(_0x5ec8db){if(_0x5ec8db&&_0x5ec8db[_0xb0b3('0x53')]===0x0){return db[_0xb0b3('0x27')][_0xb0b3('0x4d')]({'name':_0x787cf3[_0xb0b3('0x2b')],'resourceId':_0x787cf3['id'],'type':_0xb0b3('0x26'),'sectionId':_0x5ec8db['id']},{})[_0xb0b3('0x24')](function(){return _0x599eae;});}else{return _0x599eae;}})[_0xb0b3('0x4c')](function(_0x1e96d0){logger[_0xb0b3('0x29')](_0xb0b3('0x54'),_0x1e96d0);throw _0x1e96d0;});}return _0x599eae;})['then'](respondWithResult(_0x32c859,0xc9))[_0xb0b3('0x4c')](handleError(_0x32c859,null));};exports[_0xb0b3('0x23')]=function(_0x4ca7c7,_0x5914d3){if(_0x4ca7c7['body']['id']){delete _0x4ca7c7[_0xb0b3('0x55')]['id'];}return db[_0xb0b3('0x2f')][_0xb0b3('0x4b')]({'where':{'id':_0x4ca7c7[_0xb0b3('0x46')]['id']}})[_0xb0b3('0x24')](handleEntityNotFound(_0x5914d3,null))[_0xb0b3('0x24')](saveUpdates(_0x4ca7c7['body'],null))[_0xb0b3('0x24')](respondWithResult(_0x5914d3,null))[_0xb0b3('0x4c')](handleError(_0x5914d3,null));};exports[_0xb0b3('0x25')]=function(_0x4e61ba,_0xcd1787){return db['AnalyticDefaultReport'][_0xb0b3('0x4b')]({'where':{'id':_0x4e61ba['params']['id']}})[_0xb0b3('0x24')](handleEntityNotFound(_0xcd1787,null))[_0xb0b3('0x24')](removeEntity(_0xcd1787,null))[_0xb0b3('0x4c')](handleError(_0xcd1787,null));};exports['preview']=function(_0x5f356e,_0x180a3f){var _0x5b4f4b=0xa;var _0x112273=['join','left_join',_0xb0b3('0x56'),_0xb0b3('0x57')];var _0x3e294e={'SUM':'SUM(%s)','COUNT':_0xb0b3('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb0b3('0x59'),'MIN':_0xb0b3('0x5a'),'AVG':_0xb0b3('0x5b'),'GROUP_CONCAT':_0xb0b3('0x5c'),'GROUP_CONCAT ASC':_0xb0b3('0x5d'),'GROUP_CONCAT DESC':_0xb0b3('0x5e')};var _0xdbedb8={'SEC_TO_TIME':_0xb0b3('0x5f'),'DATE':_0xb0b3('0x60'),'HOUR':_0xb0b3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb0b3('0x62')};var _0x225d39=function(_0x52e602){return!_['includes']([_0xb0b3('0x63'),_0xb0b3('0x64'),_0xb0b3('0x65'),_0xb0b3('0x66')],_0x52e602);};var _0x537b24=function(_0x5b77b1){if(!_0x5b77b1||!_0x5b77b1[_0xb0b3('0x67')][_0xb0b3('0x48')]){return'';}for(var _0x49f9e3='(',_0x39c309=0x0;_0x39c309<_0x5b77b1[_0xb0b3('0x67')]['length'];_0x39c309+=0x1){_0x39c309>0x0&&(_0x49f9e3+='\x20'+_0x5b77b1['operator']+'\x20');_0x49f9e3+=_0x5b77b1[_0xb0b3('0x67')][_0x39c309]['group']?_0x537b24(_0x5b77b1[_0xb0b3('0x67')][_0x39c309]['group']):_0x5b77b1[_0xb0b3('0x67')][_0x39c309][_0xb0b3('0x68')]+'\x20'+_0x5b77b1[_0xb0b3('0x67')][_0x39c309][_0xb0b3('0x69')]+(_0x225d39(_0x5b77b1[_0xb0b3('0x67')][_0x39c309]['condition'])?'\x20'+_0x5b77b1['rules'][_0x39c309][_0xb0b3('0x6a')]:'');}return _0x49f9e3+')';};var _0x22d404={'where':{'id':_0x5f356e[_0xb0b3('0x46')]['id']}},_0x4ed4b0,_0x25dc43,_0x18d2db,_0x284889,_0x2f5d3e;_0x22d404=_[_0xb0b3('0x41')]({},_0x22d404,_0x5f356e[_0xb0b3('0x4a')]);return db['AnalyticDefaultReport'][_0xb0b3('0x4b')](_0x22d404)[_0xb0b3('0x24')](function(_0x312495){if(_0x312495){_0x4ed4b0=_0x312495;return _0x312495[_0xb0b3('0x6b')]();}return null;})[_0xb0b3('0x24')](function(_0x2d06ad){if(_0x2d06ad){if(!_0x2d06ad['length']){throw new db[(_0xb0b3('0x6c'))][(_0xb0b3('0x6d'))](_0xb0b3('0x6e'),0x193);}_0x25dc43=_0x2d06ad;return db['AnalyticMetric'][_0xb0b3('0x43')]({'raw':!![]});}return null;})[_0xb0b3('0x24')](function(_0x4fda97){if(_0x4fda97){_0x18d2db=_[_0xb0b3('0x6f')](_0x4fda97,'id');var _0x18c58c;var _0x2da0db=squel[_0xb0b3('0x70')]();_0x2da0db[_0xb0b3('0x71')](_0x4ed4b0[_0xb0b3('0x72')]);for(var _0xcb0a4a=0x0;_0xcb0a4a<_0x25dc43[_0xb0b3('0x48')];_0xcb0a4a+=0x1){_0x18c58c=_0x25dc43[_0xcb0a4a][_0xb0b3('0x73')]?_0x18d2db[_0x25dc43[_0xcb0a4a][_0xb0b3('0x73')]][_0xb0b3('0x74')]:_0x25dc43[_0xcb0a4a][_0xb0b3('0x68')];_0x18c58c=_0x25dc43[_0xcb0a4a][_0xb0b3('0x75')]?_[_0xb0b3('0x76')](_0x3e294e[_0x25dc43[_0xcb0a4a][_0xb0b3('0x75')]],'%s',_0x18c58c):_0x18c58c;_0x18c58c=_0x25dc43[_0xcb0a4a][_0xb0b3('0x77')]?_['replace'](_0xdbedb8[_0x25dc43[_0xcb0a4a]['format']],'%s',_0x18c58c):_0x18c58c;if(_0x25dc43[_0xcb0a4a][_0xb0b3('0x78')]){_0x2da0db['group'](_0x18c58c);}_0x25dc43[_0xcb0a4a][_0xb0b3('0x79')]&&_0x2da0db['order'](_0x18c58c,_0x25dc43[_0xcb0a4a][_0xb0b3('0x79')]===_0xb0b3('0x7a')?![]:!![]);_0x2da0db[_0xb0b3('0x68')](_0x18c58c,_0x25dc43[_0xcb0a4a][_0xb0b3('0x7b')]||_0x18c58c);}if(_0x4ed4b0[_0xb0b3('0x7c')]){_0x4ed4b0[_0xb0b3('0x7c')]=JSON[_0xb0b3('0x7d')](_0x4ed4b0[_0xb0b3('0x7c')]);for(var _0x118bd2=0x0;_0x118bd2<_0x4ed4b0['joins'][_0xb0b3('0x48')];_0x118bd2+=0x1){if(_0x4ed4b0['joins'][_0x118bd2]['type']&&_[_0xb0b3('0x7e')](_0x112273,_0x4ed4b0['joins'][_0x118bd2]['type'])&&_0x4ed4b0['joins'][_0x118bd2][_0xb0b3('0x7f')]&&_0x4ed4b0[_0xb0b3('0x7c')][_0x118bd2][_0xb0b3('0x80')]&&_0x4ed4b0['joins'][_0x118bd2][_0xb0b3('0x81')]){_0x2da0db[_0x4ed4b0[_0xb0b3('0x7c')][_0x118bd2][_0xb0b3('0x31')]](_0x4ed4b0[_0xb0b3('0x7c')][_0x118bd2][_0xb0b3('0x80')],null,util[_0xb0b3('0x77')](_0xb0b3('0x82'),_0x4ed4b0[_0xb0b3('0x72')],_0x4ed4b0[_0xb0b3('0x7c')][_0x118bd2]['parentKey'],_0x4ed4b0[_0xb0b3('0x7c')][_0x118bd2][_0xb0b3('0x80')],_0x4ed4b0[_0xb0b3('0x7c')][_0x118bd2][_0xb0b3('0x81')]));}}}if(_0x4ed4b0[_0xb0b3('0x83')]){_0x4ed4b0[_0xb0b3('0x83')]=JSON[_0xb0b3('0x7d')](_0x4ed4b0[_0xb0b3('0x83')]);_0x2da0db[_0xb0b3('0x3f')](_0x537b24(_0x4ed4b0['conditions'][_0xb0b3('0x84')]));}_0x2f5d3e=_0x2da0db[_0xb0b3('0x85')]();_0x2da0db[_0xb0b3('0x1e')](_0x5b4f4b);_0x2da0db['offset'](0x0);logger[_0xb0b3('0x86')](_0xb0b3('0x87'),_0x2da0db[_0xb0b3('0x88')]());return db['sequelize'][_0xb0b3('0x34')](_0x2da0db[_0xb0b3('0x88')](),{'type':db[_0xb0b3('0x89')]['QueryTypes'][_0xb0b3('0x8a')]});}})[_0xb0b3('0x24')](respondWithResult(_0x180a3f,null))[_0xb0b3('0x4c')](handleError(_0x180a3f,null));};function runReport(_0x3e6352,_0x697f82,_0x51719b){var _0x4a8f09=_0x697f82[_0xb0b3('0x2b')];var _0x35619f=0xa;var _0x386221=[_0xb0b3('0x8b'),_0xb0b3('0x8c'),_0xb0b3('0x56'),_0xb0b3('0x57')];var _0x3e313a={'SUM':_0xb0b3('0x8d'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb0b3('0x59'),'MIN':_0xb0b3('0x5a'),'AVG':_0xb0b3('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb0b3('0x5d'),'GROUP_CONCAT DESC':_0xb0b3('0x5e')};var _0x558782={'SEC_TO_TIME':_0xb0b3('0x5f'),'DATE':_0xb0b3('0x60'),'HOUR':_0xb0b3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5e34ab=function(_0x3eab04){return!_['includes']([_0xb0b3('0x63'),_0xb0b3('0x64'),_0xb0b3('0x65'),'IS\x20NOT\x20EMPTY'],_0x3eab04);};var _0x15eee7=function(_0x2a864a){if(!_0x2a864a||!_0x2a864a[_0xb0b3('0x67')][_0xb0b3('0x48')]){return'';}for(var _0x4cf013='(',_0xf8aa6c=0x0;_0xf8aa6c<_0x2a864a[_0xb0b3('0x67')][_0xb0b3('0x48')];_0xf8aa6c+=0x1){_0xf8aa6c>0x0&&(_0x4cf013+='\x20'+_0x2a864a[_0xb0b3('0x8e')]+'\x20');_0x4cf013+=_0x2a864a[_0xb0b3('0x67')][_0xf8aa6c][_0xb0b3('0x84')]?_0x15eee7(_0x2a864a[_0xb0b3('0x67')][_0xf8aa6c][_0xb0b3('0x84')]):_0x2a864a['rules'][_0xf8aa6c][_0xb0b3('0x68')]+'\x20'+_0x2a864a['rules'][_0xf8aa6c][_0xb0b3('0x69')]+(_0x5e34ab(_0x2a864a[_0xb0b3('0x67')][_0xf8aa6c][_0xb0b3('0x69')])?'\x20'+_0x2a864a[_0xb0b3('0x67')][_0xf8aa6c]['value']:'');}return _0x4cf013+')';};var _0x37f7d3={'where':{'id':_0x3e6352['id']}},_0x350621,_0x7cbe68,_0x349355,_0x390b30,_0x4fb3e0;_0x37f7d3=_[_0xb0b3('0x41')]({},_0x37f7d3,_0x51719b);return db[_0xb0b3('0x2f')][_0xb0b3('0x4b')](_0x37f7d3)[_0xb0b3('0x24')](function(_0x4dffed){if(_0x4dffed){_0x350621=_0x4dffed;return _0x4dffed[_0xb0b3('0x6b')]();}return null;})['then'](function(_0x13fca9){if(_0x13fca9){if(!_0x13fca9[_0xb0b3('0x48')]){throw new db[(_0xb0b3('0x6c'))][(_0xb0b3('0x6d'))](_0xb0b3('0x6e'),0x193);}_0x7cbe68=_0x13fca9;return db[_0xb0b3('0x8f')][_0xb0b3('0x43')]({'raw':!![]});}return null;})[_0xb0b3('0x24')](function(_0x5947b1){if(_0x5947b1){_0x349355=_['keyBy'](_0x5947b1,'id');var _0x301ec6;var _0x591db5=squel[_0xb0b3('0x70')]();_0x591db5['from'](_0x350621[_0xb0b3('0x72')]);for(var _0x5a186a=0x0;_0x5a186a<_0x7cbe68[_0xb0b3('0x48')];_0x5a186a+=0x1){_0x301ec6=_0x7cbe68[_0x5a186a][_0xb0b3('0x73')]?_0x349355[_0x7cbe68[_0x5a186a][_0xb0b3('0x73')]][_0xb0b3('0x74')]:_0x7cbe68[_0x5a186a][_0xb0b3('0x68')];_0x301ec6=_0x7cbe68[_0x5a186a]['function']?_['replace'](_0x3e313a[_0x7cbe68[_0x5a186a][_0xb0b3('0x75')]],'%s',_0x301ec6):_0x301ec6;_0x301ec6=_0x7cbe68[_0x5a186a]['format']?_[_0xb0b3('0x76')](_0x558782[_0x7cbe68[_0x5a186a][_0xb0b3('0x77')]],'%s',_0x301ec6):_0x301ec6;if(_0x7cbe68[_0x5a186a]['groupBy']){_0x591db5[_0xb0b3('0x84')](_0x301ec6);}_0x7cbe68[_0x5a186a][_0xb0b3('0x79')]&&_0x591db5[_0xb0b3('0x90')](_0x301ec6,_0x7cbe68[_0x5a186a][_0xb0b3('0x79')]===_0xb0b3('0x7a')?![]:!![]);_0x591db5[_0xb0b3('0x68')](_0x301ec6,_0x7cbe68[_0x5a186a][_0xb0b3('0x7b')]||_0x301ec6);}if(_0x350621[_0xb0b3('0x7c')]){_0x350621['joins']=JSON[_0xb0b3('0x7d')](_0x350621[_0xb0b3('0x7c')]);for(var _0x3de7d9=0x0;_0x3de7d9<_0x350621[_0xb0b3('0x7c')][_0xb0b3('0x48')];_0x3de7d9+=0x1){if(_0x350621[_0xb0b3('0x7c')][_0x3de7d9][_0xb0b3('0x31')]&&_[_0xb0b3('0x7e')](_0x386221,_0x350621['joins'][_0x3de7d9][_0xb0b3('0x31')])&&_0x350621[_0xb0b3('0x7c')][_0x3de7d9][_0xb0b3('0x7f')]&&_0x350621[_0xb0b3('0x7c')][_0x3de7d9]['foreignTable']&&_0x350621[_0xb0b3('0x7c')][_0x3de7d9][_0xb0b3('0x81')]){_0x591db5[_0x350621[_0xb0b3('0x7c')][_0x3de7d9]['type']](_0x350621[_0xb0b3('0x7c')][_0x3de7d9][_0xb0b3('0x80')],null,util['format'](_0xb0b3('0x82'),_0x350621[_0xb0b3('0x72')],_0x350621[_0xb0b3('0x7c')][_0x3de7d9][_0xb0b3('0x7f')],_0x350621[_0xb0b3('0x7c')][_0x3de7d9]['foreignTable'],_0x350621[_0xb0b3('0x7c')][_0x3de7d9]['foreignKey']));}}}if(_0x350621['conditions']){_0x350621[_0xb0b3('0x83')]=JSON['parse'](_0x350621[_0xb0b3('0x83')]);_0x591db5[_0xb0b3('0x3f')](_0x15eee7(_0x350621['conditions'][_0xb0b3('0x84')]));}_0x4fb3e0=_0x591db5['clone']();_0x591db5['limit'](_0x35619f);_0x591db5[_0xb0b3('0x1d')](0x0);logger[_0xb0b3('0x86')]('Limited\x20Query:',_0x591db5[_0xb0b3('0x88')]());return db[_0xb0b3('0x89')][_0xb0b3('0x34')](_0x591db5[_0xb0b3('0x88')](),{'type':db[_0xb0b3('0x89')][_0xb0b3('0x91')]['SELECT']});}})[_0xb0b3('0x24')](function(_0x3c80b1){if(!_0x3c80b1['length']){throw new db['Sequelize'][(_0xb0b3('0x6d'))](_0xb0b3('0x92'),0xcc);}if(_0x697f82[_0xb0b3('0x93')]===_0xb0b3('0x94')){return null;}var _0x70674f=_[_0xb0b3('0x41')](_0x697f82,{'name':_0x697f82[_0xb0b3('0x95')]||_0x697f82['name']||_0x350621[_0xb0b3('0x2b')],'basename':_0x4a8f09,'savename':util[_0xb0b3('0x77')]('%s-%s.%s',_0x697f82[_0xb0b3('0x2b')]||_0x350621[_0xb0b3('0x2b')],require(_0xb0b3('0x96'))['generate'](0x4),_0x697f82['output']||_0xb0b3('0x97')),'reportId':_0x350621['id'],'reportType':_0xb0b3('0x98')});return db[_0xb0b3('0x99')][_0xb0b3('0x4d')](_0x70674f,{'raw':!![]});})[_0xb0b3('0x24')](function(_0x3d76fd){if(_0x350621['table']===_0xb0b3('0x9a')){_0x4fb3e0[_0xb0b3('0x3f')](_0x350621[_0xb0b3('0x72')]+_0xb0b3('0x9b'),_0x697f82['startDate'],_0x697f82['endDate']);}else{_0x4fb3e0[_0xb0b3('0x3f')](_0x350621[_0xb0b3('0x72')]+_0xb0b3('0x9c'),_0x697f82[_0xb0b3('0x9d')],_0x697f82[_0xb0b3('0x9e')]);}if(_0x3d76fd){logger[_0xb0b3('0x9f')]('Run\x20Query:',_0x4fb3e0[_0xb0b3('0x88')]());require('child_process')[_0xb0b3('0xa0')](path[_0xb0b3('0x8b')](__dirname,'../../components/export/',_0x3d76fd[_0xb0b3('0x93')]),[_0x3d76fd['id'],_0x4fb3e0[_0xb0b3('0x88')](),path[_0xb0b3('0x8b')](__dirname,_0xb0b3('0xa1'),_0x3d76fd[_0xb0b3('0xa2')]),_0x4a8f09]);return _0x3d76fd;}else{var _0x12f0df=squel[_0xb0b3('0x70')]();_0x12f0df[_0xb0b3('0x71')]('('+_0x4fb3e0[_0xb0b3('0x88')]()+')',_0xb0b3('0xa3'));_0x12f0df[_0xb0b3('0x68')](_0xb0b3('0xa4'),'count');_0x4fb3e0[_0xb0b3('0x1e')](_0x697f82[_0xb0b3('0x1e')]||_0x35619f);_0x4fb3e0[_0xb0b3('0x1d')](_0x697f82[_0xb0b3('0x1d')]||0x0);return db[_0xb0b3('0x89')][_0xb0b3('0x34')](_0x12f0df[_0xb0b3('0x88')](),{'type':db['sequelize'][_0xb0b3('0x91')][_0xb0b3('0x8a')]})[_0xb0b3('0x24')](function(_0xf87322){if(!_0xf87322[_0xb0b3('0x48')]){_0x390b30=0x0;}else{_0x390b30=_0xf87322[0x0][_0xb0b3('0x1c')]||0x0;}return db['sequelize'][_0xb0b3('0x34')](_0x4fb3e0['toString'](),{'type':db['sequelize'][_0xb0b3('0x91')][_0xb0b3('0x8a')]});})[_0xb0b3('0x24')](function(_0x57db83){return{'rows':_0x57db83||[],'count':_0x390b30};});}});}exports[_0xb0b3('0xa5')]=function(_0xaef851,_0x3fc7a5){return runReport(_0xaef851[_0xb0b3('0x46')],_0xaef851[_0xb0b3('0x34')],_0xaef851['options'])[_0xb0b3('0x24')](respondWithResult(_0x3fc7a5,null))[_0xb0b3('0x4c')](handleError(_0x3fc7a5,null));};exports[_0xb0b3('0xa6')]=runReport;exports['query']=function(_0x560a3a,_0x25d8b3){var _0x42b143=0xa;var _0x396eaa=['join',_0xb0b3('0x8c'),_0xb0b3('0x56'),_0xb0b3('0x57')];var _0x2ce535={'SUM':_0xb0b3('0x8d'),'COUNT':_0xb0b3('0x58'),'COUNT DISTINCT':_0xb0b3('0xa7'),'MAX':_0xb0b3('0x59'),'MIN':_0xb0b3('0x5a'),'AVG':_0xb0b3('0x5b'),'GROUP_CONCAT':_0xb0b3('0x5c'),'GROUP_CONCAT ASC':_0xb0b3('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5c4d4b={'SEC_TO_TIME':_0xb0b3('0x5f'),'DATE':_0xb0b3('0x60'),'HOUR':_0xb0b3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb0b3('0x62')};var _0x3dfd3c=function(_0x2d03eb){return!_[_0xb0b3('0x7e')]([_0xb0b3('0x63'),_0xb0b3('0x64'),_0xb0b3('0x65'),_0xb0b3('0x66')],_0x2d03eb);};var _0x366470=function(_0x3694ba){if(!_0x3694ba||!_0x3694ba['rules'][_0xb0b3('0x48')]){return'';}for(var _0x59c406='(',_0x1ad80f=0x0;_0x1ad80f<_0x3694ba['rules']['length'];_0x1ad80f+=0x1){_0x1ad80f>0x0&&(_0x59c406+='\x20'+_0x3694ba['operator']+'\x20');_0x59c406+=_0x3694ba[_0xb0b3('0x67')][_0x1ad80f][_0xb0b3('0x84')]?_0x366470(_0x3694ba['rules'][_0x1ad80f][_0xb0b3('0x84')]):_0x3694ba[_0xb0b3('0x67')][_0x1ad80f][_0xb0b3('0x68')]+'\x20'+_0x3694ba['rules'][_0x1ad80f][_0xb0b3('0x69')]+(_0x3dfd3c(_0x3694ba[_0xb0b3('0x67')][_0x1ad80f]['condition'])?'\x20'+_0x3694ba[_0xb0b3('0x67')][_0x1ad80f][_0xb0b3('0x6a')]:'');}return _0x59c406+')';};var _0x4b765a={'where':{'id':_0x560a3a[_0xb0b3('0x46')]['id']}},_0x440306,_0x1ae5c6,_0x409172,_0x442000,_0x41947d;_0x4b765a=_[_0xb0b3('0x41')]({},_0x4b765a,_0x560a3a[_0xb0b3('0x4a')]);return db[_0xb0b3('0x2f')][_0xb0b3('0x4b')](_0x4b765a)['then'](function(_0x155bca){if(_0x155bca){_0x440306=_0x155bca;return _0x155bca[_0xb0b3('0x6b')]();}return null;})['then'](function(_0x55b35d){if(_0x55b35d){if(!_0x55b35d['length']){throw new db[(_0xb0b3('0x6c'))][(_0xb0b3('0x6d'))](_0xb0b3('0x6e'),0x193);}_0x1ae5c6=_0x55b35d;return db[_0xb0b3('0x8f')][_0xb0b3('0x43')]({'raw':!![]});}return null;})[_0xb0b3('0x24')](function(_0x2315f3){if(_0x2315f3){_0x409172=_[_0xb0b3('0x6f')](_0x2315f3,'id');var _0x90925c;var _0x45602d=squel[_0xb0b3('0x70')]();_0x45602d[_0xb0b3('0x71')](_0x440306[_0xb0b3('0x72')]);for(var _0x4ea665=0x0;_0x4ea665<_0x1ae5c6[_0xb0b3('0x48')];_0x4ea665+=0x1){_0x90925c=_0x1ae5c6[_0x4ea665][_0xb0b3('0x73')]?_0x409172[_0x1ae5c6[_0x4ea665][_0xb0b3('0x73')]][_0xb0b3('0x74')]:_0x1ae5c6[_0x4ea665]['field'];_0x90925c=_0x1ae5c6[_0x4ea665][_0xb0b3('0x75')]?_[_0xb0b3('0x76')](_0x2ce535[_0x1ae5c6[_0x4ea665][_0xb0b3('0x75')]],'%s',_0x90925c):_0x90925c;_0x90925c=_0x1ae5c6[_0x4ea665][_0xb0b3('0x77')]?_[_0xb0b3('0x76')](_0x5c4d4b[_0x1ae5c6[_0x4ea665][_0xb0b3('0x77')]],'%s',_0x90925c):_0x90925c;if(_0x1ae5c6[_0x4ea665][_0xb0b3('0x78')]){_0x45602d[_0xb0b3('0x84')](_0x90925c);}_0x1ae5c6[_0x4ea665][_0xb0b3('0x79')]&&_0x45602d['order'](_0x90925c,_0x1ae5c6[_0x4ea665][_0xb0b3('0x79')]===_0xb0b3('0x7a')?![]:!![]);_0x45602d[_0xb0b3('0x68')](_0x90925c,_0x1ae5c6[_0x4ea665]['alias']||_0x90925c);}if(_0x440306[_0xb0b3('0x7c')]){_0x440306['joins']=JSON['parse'](_0x440306['joins']);for(var _0x46f0bf=0x0;_0x46f0bf<_0x440306['joins'][_0xb0b3('0x48')];_0x46f0bf+=0x1){if(_0x440306[_0xb0b3('0x7c')][_0x46f0bf][_0xb0b3('0x31')]&&_[_0xb0b3('0x7e')](_0x396eaa,_0x440306[_0xb0b3('0x7c')][_0x46f0bf][_0xb0b3('0x31')])&&_0x440306[_0xb0b3('0x7c')][_0x46f0bf][_0xb0b3('0x7f')]&&_0x440306['joins'][_0x46f0bf][_0xb0b3('0x80')]&&_0x440306[_0xb0b3('0x7c')][_0x46f0bf]['foreignKey']){_0x45602d[_0x440306[_0xb0b3('0x7c')][_0x46f0bf]['type']](_0x440306[_0xb0b3('0x7c')][_0x46f0bf][_0xb0b3('0x80')],null,util['format'](_0xb0b3('0x82'),_0x440306[_0xb0b3('0x72')],_0x440306['joins'][_0x46f0bf][_0xb0b3('0x7f')],_0x440306[_0xb0b3('0x7c')][_0x46f0bf][_0xb0b3('0x80')],_0x440306[_0xb0b3('0x7c')][_0x46f0bf][_0xb0b3('0x81')]));}}}if(_0x440306[_0xb0b3('0x83')]){_0x440306[_0xb0b3('0x83')]=JSON['parse'](_0x440306[_0xb0b3('0x83')]);_0x45602d[_0xb0b3('0x3f')](_0x366470(_0x440306[_0xb0b3('0x83')][_0xb0b3('0x84')]));}_0x41947d=_0x45602d[_0xb0b3('0x85')]();_0x45602d['limit'](_0x42b143);_0x45602d[_0xb0b3('0x1d')](0x0);logger['debug'](_0xb0b3('0x87'),_0x45602d[_0xb0b3('0x88')]());return db['sequelize'][_0xb0b3('0x34')](_0x45602d[_0xb0b3('0x88')](),{'type':db[_0xb0b3('0x89')][_0xb0b3('0x91')][_0xb0b3('0x8a')]});}})[_0xb0b3('0x24')](function(){return{'sql':_0x41947d['toString']()};})[_0xb0b3('0x24')](respondWithResult(_0x25d8b3,null))[_0xb0b3('0x4c')](handleError(_0x25d8b3,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 1faf875..3c6b1b9 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 _0x12c9=['AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define'];(function(_0x239a62,_0x3e82e6){var _0x4e1358=function(_0x208c53){while(--_0x208c53){_0x239a62['push'](_0x239a62['shift']());}};_0x4e1358(++_0x3e82e6);}(_0x12c9,0x1c9));var _0x912c=function(_0xc2cae7,_0x420ba5){_0xc2cae7=_0xc2cae7-0x0;var _0x3d907c=_0x12c9[_0xc2cae7];return _0x3d907c;};'use strict';var _=require(_0x912c('0x0'));var util=require(_0x912c('0x1'));var logger=require(_0x912c('0x2'))(_0x912c('0x3'));var moment=require(_0x912c('0x4'));var BPromise=require('bluebird');var rp=require(_0x912c('0x5'));var fs=require('fs');var path=require(_0x912c('0x6'));var rimraf=require(_0x912c('0x7'));var config=require(_0x912c('0x8'));var attributes=require(_0x912c('0x9'));module['exports']=function(_0x584a27,_0xe29019){return _0x584a27[_0x912c('0xa')](_0x912c('0xb'),attributes,{'tableName':_0x912c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcebd=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','lodash','../../config/logger','api','moment'];(function(_0x157fef,_0x14ef86){var _0x1f4c1c=function(_0x2c0a56){while(--_0x2c0a56){_0x157fef['push'](_0x157fef['shift']());}};_0x1f4c1c(++_0x14ef86);}(_0xcebd,0x15c));var _0xdceb=function(_0x2c78d0,_0x424bcf){_0x2c78d0=_0x2c78d0-0x0;var _0xec6dfa=_0xcebd[_0x2c78d0];return _0xec6dfa;};'use strict';var _=require(_0xdceb('0x0'));var util=require('util');var logger=require(_0xdceb('0x1'))(_0xdceb('0x2'));var moment=require(_0xdceb('0x3'));var BPromise=require('bluebird');var rp=require(_0xdceb('0x4'));var fs=require('fs');var path=require(_0xdceb('0x5'));var rimraf=require(_0xdceb('0x6'));var config=require(_0xdceb('0x7'));var attributes=require(_0xdceb('0x8'));module['exports']=function(_0x5ea0cf,_0x2fdd32){return _0x5ea0cf[_0xdceb('0x9')](_0xdceb('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 b8d5ba7..4c364bf 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 _0x8868=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','lodash','util'];(function(_0x2a77e4,_0x12b49e){var _0x182c30=function(_0x1a88b1){while(--_0x1a88b1){_0x2a77e4['push'](_0x2a77e4['shift']());}};_0x182c30(++_0x12b49e);}(_0x8868,0x1ca));var _0x8886=function(_0x47d54a,_0x1e96b5){_0x47d54a=_0x47d54a-0x0;var _0xe6da4b=_0x8868[_0x47d54a];return _0xe6da4b;};'use strict';var _=require(_0x8886('0x0'));var util=require(_0x8886('0x1'));var moment=require(_0x8886('0x2'));var BPromise=require(_0x8886('0x3'));var rs=require(_0x8886('0x4'));var fs=require('fs');var Redis=require(_0x8886('0x5'));var db=require(_0x8886('0x6'))['db'];var utils=require(_0x8886('0x7'));var logger=require(_0x8886('0x8'))(_0x8886('0x9'));var config=require(_0x8886('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8886('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26b94d,_0x5e2a73,_0x1a85e1){return new BPromise(function(_0x56b9fa,_0x147fc9){return client[_0x8886('0xc')](_0x26b94d,_0x1a85e1)[_0x8886('0xd')](function(_0x39036d){logger[_0x8886('0xe')](_0x8886('0xf'),_0x5e2a73,'request\x20sent');logger[_0x8886('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x5e2a73,'request\x20sent',JSON[_0x8886('0x11')](_0x39036d));if(_0x39036d['error']){if(_0x39036d[_0x8886('0x12')][_0x8886('0x13')]===0x1f4){logger[_0x8886('0x12')](_0x8886('0xf'),_0x5e2a73,_0x39036d['error'][_0x8886('0x14')]);return _0x147fc9(_0x39036d[_0x8886('0x12')]['message']);}logger[_0x8886('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5e2a73,_0x39036d[_0x8886('0x12')][_0x8886('0x14')]);return _0x56b9fa(_0x39036d[_0x8886('0x12')][_0x8886('0x14')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x5e2a73,_0x8886('0x15'));_0x56b9fa(_0x39036d[_0x8886('0x16')]['message']);}})['catch'](function(_0x563a82){logger['error'](_0x8886('0xf'),_0x5e2a73,_0x563a82);_0x147fc9(_0x563a82);});});} \ No newline at end of file +var _0x4a1d=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x3b7c3a,_0x31249f){var _0x395dba=function(_0x3418cb){while(--_0x3418cb){_0x3b7c3a['push'](_0x3b7c3a['shift']());}};_0x395dba(++_0x31249f);}(_0x4a1d,0x77));var _0xd4a1=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4a1d[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0xd4a1('0x0'));var util=require(_0xd4a1('0x1'));var moment=require(_0xd4a1('0x2'));var BPromise=require(_0xd4a1('0x3'));var rs=require(_0xd4a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd4a1('0x5'))['db'];var utils=require(_0xd4a1('0x6'));var logger=require(_0xd4a1('0x7'))(_0xd4a1('0x8'));var config=require(_0xd4a1('0x9'));var jayson=require(_0xd4a1('0xa'));var client=jayson[_0xd4a1('0xb')][_0xd4a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5cfa45,_0x3140b8,_0x1c2e6f){return new BPromise(function(_0x2b91a6,_0x3a9ecc){return client[_0xd4a1('0xd')](_0x5cfa45,_0x1c2e6f)['then'](function(_0x503a27){logger[_0xd4a1('0xe')](_0xd4a1('0xf'),_0x3140b8,_0xd4a1('0x10'));logger[_0xd4a1('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x3140b8,_0xd4a1('0x10'),JSON[_0xd4a1('0x12')](_0x503a27));if(_0x503a27[_0xd4a1('0x13')]){if(_0x503a27['error'][_0xd4a1('0x14')]===0x1f4){logger[_0xd4a1('0x13')](_0xd4a1('0xf'),_0x3140b8,_0x503a27[_0xd4a1('0x13')]['message']);return _0x3a9ecc(_0x503a27[_0xd4a1('0x13')][_0xd4a1('0x15')]);}logger[_0xd4a1('0x13')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3140b8,_0x503a27[_0xd4a1('0x13')][_0xd4a1('0x15')]);return _0x2b91a6(_0x503a27[_0xd4a1('0x13')][_0xd4a1('0x15')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x3140b8,_0xd4a1('0x10'));_0x2b91a6(_0x503a27[_0xd4a1('0x16')][_0xd4a1('0x15')]);}})[_0xd4a1('0x17')](function(_0x212d0c){logger['error'](_0xd4a1('0xf'),_0x3140b8,_0x212d0c);_0x3a9ecc(_0x212d0c);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 293801f..5924661 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 _0x6a24=['index','/:id','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','put','update','delete','destroy','util','path','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated'];(function(_0x261188,_0x2258e7){var _0x1c3caa=function(_0x54c559){while(--_0x54c559){_0x261188['push'](_0x261188['shift']());}};_0x1c3caa(++_0x2258e7);}(_0x6a24,0x8c));var _0x46a2=function(_0x109bd0,_0xaddf0b){_0x109bd0=_0x109bd0-0x0;var _0x3c0466=_0x6a24[_0x109bd0];return _0x3c0466;};'use strict';var multer=require('multer');var util=require(_0x46a2('0x0'));var path=require(_0x46a2('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x46a2('0x2'));var interaction=require(_0x46a2('0x3'));var config=require('../../config/environment');var controller=require(_0x46a2('0x4'));router[_0x46a2('0x5')]('/',auth[_0x46a2('0x6')](),controller[_0x46a2('0x7')]);router[_0x46a2('0x5')](_0x46a2('0x8'),auth[_0x46a2('0x6')](),controller[_0x46a2('0x9')]);router['get'](_0x46a2('0xa'),auth['isAuthenticated'](),controller[_0x46a2('0xb')]);router[_0x46a2('0x5')](_0x46a2('0xc'),auth[_0x46a2('0x6')](),controller[_0x46a2('0xd')]);router[_0x46a2('0x5')](_0x46a2('0xe'),auth['isAuthenticated'](),controller[_0x46a2('0xf')]);router[_0x46a2('0x10')]('/',auth[_0x46a2('0x6')](),controller['create']);router[_0x46a2('0x11')](_0x46a2('0x8'),auth[_0x46a2('0x6')](),controller[_0x46a2('0x12')]);router[_0x46a2('0x13')]('/:id',auth[_0x46a2('0x6')](),controller[_0x46a2('0x14')]);module['exports']=router; \ No newline at end of file +var _0x869f=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete','multer'];(function(_0x285d34,_0x42dd2d){var _0x59e21d=function(_0x386777){while(--_0x386777){_0x285d34['push'](_0x285d34['shift']());}};_0x59e21d(++_0x42dd2d);}(_0x869f,0xa7));var _0xf869=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x869f[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xf869('0x0'));var util=require(_0xf869('0x1'));var path=require(_0xf869('0x2'));var timeout=require(_0xf869('0x3'));var express=require(_0xf869('0x4'));var router=express[_0xf869('0x5')]();var auth=require(_0xf869('0x6'));var interaction=require(_0xf869('0x7'));var config=require('../../config/environment');var controller=require(_0xf869('0x8'));router['get']('/',auth[_0xf869('0x9')](),controller[_0xf869('0xa')]);router[_0xf869('0xb')](_0xf869('0xc'),auth[_0xf869('0x9')](),controller[_0xf869('0xd')]);router[_0xf869('0xb')](_0xf869('0xe'),auth[_0xf869('0x9')](),controller[_0xf869('0xf')]);router['get'](_0xf869('0x10'),auth[_0xf869('0x9')](),controller['run']);router[_0xf869('0xb')](_0xf869('0x11'),auth[_0xf869('0x9')](),controller[_0xf869('0x12')]);router[_0xf869('0x13')]('/',auth[_0xf869('0x9')](),controller[_0xf869('0x14')]);router[_0xf869('0x15')](_0xf869('0xc'),auth[_0xf869('0x9')](),controller[_0xf869('0x16')]);router[_0xf869('0x17')]('/:id',auth[_0xf869('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 1d4882a..12805d5 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 _0x2755=['sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER','UNSIGNED'];(function(_0xc9a3f3,_0x2bcfe7){var _0x1cbfbe=function(_0x192a0f){while(--_0x192a0f){_0xc9a3f3['push'](_0xc9a3f3['shift']());}};_0x1cbfbe(++_0x2bcfe7);}(_0x2755,0x150));var _0x5275=function(_0x15b14d,_0x4c34f5){_0x15b14d=_0x15b14d-0x0;var _0x30f46b=_0x2755[_0x15b14d];return _0x30f46b;};'use strict';var Sequelize=require(_0x5275('0x0'));var moment=require(_0x5275('0x1'));module[_0x5275('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x5275('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x5275('0x4')](_0x5275('0x5'),_0x5275('0x6'),_0x5275('0x7')),'allowNull':![],'defaultValue':_0x5275('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x5275('0x8')]},'endDate':{'type':Sequelize[_0x5275('0x8')]},'status':{'type':Sequelize[_0x5275('0x3')],'defaultValue':_0x5275('0x9')},'type':{'type':Sequelize['ENUM'](_0x5275('0xa'),_0x5275('0xb')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x5275('0xc')](0xb)[_0x5275('0xd')]},'reportType':{'type':Sequelize[_0x5275('0x3')]}}; \ No newline at end of file +var _0xced1=['moment','STRING','csv','pdf','DATE','Loading','ENUM','scheduled','manual','INTEGER','sequelize'];(function(_0x460e05,_0x37f195){var _0x48dcd9=function(_0x29712d){while(--_0x29712d){_0x460e05['push'](_0x460e05['shift']());}};_0x48dcd9(++_0x37f195);}(_0xced1,0x128));var _0x1ced=function(_0x412e27,_0x20a978){_0x412e27=_0x412e27-0x0;var _0x53da42=_0xced1[_0x412e27];return _0x53da42;};'use strict';var Sequelize=require(_0x1ced('0x0'));var moment=require(_0x1ced('0x1'));module['exports']={'name':{'type':Sequelize[_0x1ced('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x1ced('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x1ced('0x3'),_0x1ced('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0x1ced('0x3')},'savename':{'type':Sequelize[_0x1ced('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x1ced('0x5')]},'status':{'type':Sequelize[_0x1ced('0x2')],'defaultValue':_0x1ced('0x6')},'type':{'type':Sequelize[_0x1ced('0x7')]('manual',_0x1ced('0x8')),'allowNull':![],'defaultValue':_0x1ced('0x9')},'reportId':{'type':Sequelize[_0x1ced('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x1ced('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 11fa969..a44bece 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 _0xcfe3=['create','body','user','role','userProfileId','autoAssociation','UserProfileResource','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','format','%s.%s','toLowerCase','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','ExtractedReports','error','stack','name','send','index','map','AnalyticExtractedReport','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','filters','include','find'];(function(_0x5b9cc5,_0x18e69b){var _0x2d679f=function(_0x3fdb98){while(--_0x3fdb98){_0x5b9cc5['push'](_0x5b9cc5['shift']());}};_0x2d679f(++_0x18e69b);}(_0xcfe3,0x1ef));var _0x3cfe=function(_0x424e32,_0xf238d5){_0x424e32=_0x424e32-0x0;var _0x565782=_0xcfe3[_0x424e32];return _0x565782;};'use strict';var pdf=require(_0x3cfe('0x0'));var emlformat=require(_0x3cfe('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3cfe('0x2'));var jsonpatch=require(_0x3cfe('0x3'));var rp=require(_0x3cfe('0x4'));var moment=require(_0x3cfe('0x5'));var BPromise=require(_0x3cfe('0x6'));var Mustache=require(_0x3cfe('0x7'));var util=require('util');var path=require(_0x3cfe('0x8'));var sox=require('sox');var csv=require(_0x3cfe('0x9'));var ejs=require(_0x3cfe('0xa'));var fs=require('fs');var _=require(_0x3cfe('0xb'));var squel=require(_0x3cfe('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3cfe('0xd'));var toCsv=require(_0x3cfe('0x9'));var querystring=require(_0x3cfe('0xe'));var Papa=require(_0x3cfe('0xf'));var Redis=require(_0x3cfe('0x10'));var authService=require(_0x3cfe('0x11'));var qs=require(_0x3cfe('0x12'));var as=require(_0x3cfe('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cfe('0x14'))(_0x3cfe('0x15'));var utils=require(_0x3cfe('0x16'));var config=require(_0x3cfe('0x17'));var db=require(_0x3cfe('0x18'))['db'];function respondWithStatusCode(_0x342d13,_0x4a58b5){_0x4a58b5=_0x4a58b5||0xcc;return function(_0x182881){if(_0x182881){return _0x342d13[_0x3cfe('0x19')](_0x4a58b5);}return _0x342d13['status'](_0x4a58b5)[_0x3cfe('0x1a')]();};}function respondWithResult(_0x522501,_0x4b298c){_0x4b298c=_0x4b298c||0xc8;return function(_0x792142){if(_0x792142){return _0x522501[_0x3cfe('0x1b')](_0x4b298c)[_0x3cfe('0x1c')](_0x792142);}};}function respondWithFilteredResult(_0x294bf5,_0x28b1a9){return function(_0x1d6136){if(_0x1d6136){var _0x1b0c1a=_0x1d6136[_0x3cfe('0x1d')],_0x560c95=_0x28b1a9[_0x3cfe('0x1e')],_0xa3c181=_0x28b1a9[_0x3cfe('0x1e')]+_0x28b1a9[_0x3cfe('0x1f')],_0x38cd35;if(_0xa3c181>=_0x1b0c1a){_0xa3c181=_0x1b0c1a;_0x38cd35=0xc8;}else{_0x38cd35=0xce;}_0x294bf5[_0x3cfe('0x1b')](_0x38cd35);return _0x294bf5[_0x3cfe('0x20')](_0x3cfe('0x21'),_0x560c95+'-'+_0xa3c181+'/'+_0x1b0c1a)[_0x3cfe('0x1c')](_0x1d6136);}return null;};}function patchUpdates(_0x2c7fb7){return function(_0x1eb606){try{jsonpatch[_0x3cfe('0x22')](_0x1eb606,_0x2c7fb7,!![]);}catch(_0x3fbc4c){return BPromise['reject'](_0x3fbc4c);}return _0x1eb606[_0x3cfe('0x23')]();};}function saveUpdates(_0x180867,_0x251365){return function(_0x539803){if(_0x539803){return _0x539803[_0x3cfe('0x24')](_0x180867)[_0x3cfe('0x25')](function(_0x44d92b){return _0x44d92b;});}return null;};}function removeEntity(_0x2651f5,_0x3ff70c){return function(_0x4c5aa4){if(_0x4c5aa4){return _0x4c5aa4[_0x3cfe('0x26')]()[_0x3cfe('0x25')](function(){var _0x5706c5=_0x4c5aa4[_0x3cfe('0x27')]({'plain':!![]});var _0x417605=_0x3cfe('0x28');return db['UserProfileResource'][_0x3cfe('0x26')]({'where':{'type':_0x417605,'resourceId':_0x5706c5['id']}})[_0x3cfe('0x25')](function(){return _0x4c5aa4;});})['then'](function(){_0x2651f5[_0x3cfe('0x1b')](0xcc)[_0x3cfe('0x1a')]();});}};}function handleEntityNotFound(_0xae06a2,_0x5c462e){return function(_0x414098){if(!_0x414098){_0xae06a2[_0x3cfe('0x19')](0x194);}return _0x414098;};}function handleError(_0x103cfa,_0x1c9813){_0x1c9813=_0x1c9813||0x1f4;return function(_0x4c4ce4){logger[_0x3cfe('0x29')](_0x4c4ce4[_0x3cfe('0x2a')]);if(_0x4c4ce4[_0x3cfe('0x2b')]){delete _0x4c4ce4[_0x3cfe('0x2b')];}_0x103cfa[_0x3cfe('0x1b')](_0x1c9813)[_0x3cfe('0x2c')](_0x4c4ce4);};}exports[_0x3cfe('0x2d')]=function(_0x3154b7,_0x484489){var _0x98a0a0={},_0xdefc0b={},_0x5df9b7={'count':0x0,'rows':[]};var _0x234989=_[_0x3cfe('0x2e')](db[_0x3cfe('0x2f')]['rawAttributes'],function(_0x57a0f6){return{'name':_0x57a0f6[_0x3cfe('0x30')],'type':_0x57a0f6[_0x3cfe('0x31')]['key']};});_0xdefc0b[_0x3cfe('0x32')]=_[_0x3cfe('0x2e')](_0x234989,_0x3cfe('0x2b'));_0xdefc0b[_0x3cfe('0x33')]=_[_0x3cfe('0x34')](_0x3154b7[_0x3cfe('0x33')]);_0xdefc0b['filters']=_['intersection'](_0xdefc0b['model'],_0xdefc0b[_0x3cfe('0x33')]);_0x98a0a0['attributes']=_[_0x3cfe('0x35')](_0xdefc0b[_0x3cfe('0x32')],qs[_0x3cfe('0x36')](_0x3154b7[_0x3cfe('0x33')][_0x3cfe('0x36')]));_0x98a0a0[_0x3cfe('0x37')]=_0x98a0a0[_0x3cfe('0x37')][_0x3cfe('0x38')]?_0x98a0a0['attributes']:_0xdefc0b[_0x3cfe('0x32')];if(!_0x3154b7[_0x3cfe('0x33')][_0x3cfe('0x39')]('nolimit')){_0x98a0a0[_0x3cfe('0x1f')]=qs['limit'](_0x3154b7[_0x3cfe('0x33')]['limit']);_0x98a0a0[_0x3cfe('0x1e')]=qs[_0x3cfe('0x1e')](_0x3154b7[_0x3cfe('0x33')][_0x3cfe('0x1e')]);}_0x98a0a0[_0x3cfe('0x3a')]=qs[_0x3cfe('0x3b')](_0x3154b7[_0x3cfe('0x33')][_0x3cfe('0x3b')]);_0x98a0a0[_0x3cfe('0x3c')]=qs['filters'](_[_0x3cfe('0x3d')](_0x3154b7[_0x3cfe('0x33')],_0xdefc0b['filters']));if(_0x3154b7[_0x3cfe('0x33')]['filter']){_0x98a0a0[_0x3cfe('0x3c')]=_[_0x3cfe('0x3e')](_0x98a0a0['where'],{'$or':_[_0x3cfe('0x2e')](_0x234989,function(_0x80e828){if(_0x80e828[_0x3cfe('0x31')]!==_0x3cfe('0x3f')){var _0xcf412d={};_0xcf412d[_0x80e828[_0x3cfe('0x2b')]]={'$like':'%'+_0x3154b7[_0x3cfe('0x33')][_0x3cfe('0x40')]+'%'};return _0xcf412d;}})});}_0x98a0a0=_[_0x3cfe('0x3e')]({},_0x98a0a0,_0x3154b7[_0x3cfe('0x41')]);var _0x1a7370={'where':_0x98a0a0[_0x3cfe('0x3c')]};return db[_0x3cfe('0x2f')]['count'](_0x1a7370)[_0x3cfe('0x25')](function(_0x2b732b){_0x5df9b7[_0x3cfe('0x1d')]=_0x2b732b;if(_0x3154b7[_0x3cfe('0x33')][_0x3cfe('0x42')]){_0x98a0a0['include']=[{'all':!![]}];}return db[_0x3cfe('0x2f')][_0x3cfe('0x43')](_0x98a0a0);})[_0x3cfe('0x25')](function(_0x2a908c){_0x5df9b7[_0x3cfe('0x44')]=_0x2a908c;return _0x5df9b7;})[_0x3cfe('0x25')](respondWithFilteredResult(_0x484489,_0x98a0a0))[_0x3cfe('0x45')](handleError(_0x484489,null));};exports[_0x3cfe('0x46')]=function(_0x1dbe5d,_0x29a30f){var _0x4613d3={'raw':!![],'where':{'id':_0x1dbe5d[_0x3cfe('0x47')]['id']}},_0x40f97d={};_0x40f97d[_0x3cfe('0x32')]=_[_0x3cfe('0x34')](db[_0x3cfe('0x2f')]['rawAttributes']);_0x40f97d['query']=_[_0x3cfe('0x34')](_0x1dbe5d[_0x3cfe('0x33')]);_0x40f97d[_0x3cfe('0x48')]=_[_0x3cfe('0x35')](_0x40f97d[_0x3cfe('0x32')],_0x40f97d[_0x3cfe('0x33')]);_0x4613d3['attributes']=_['intersection'](_0x40f97d[_0x3cfe('0x32')],qs[_0x3cfe('0x36')](_0x1dbe5d[_0x3cfe('0x33')]['fields']));_0x4613d3['attributes']=_0x4613d3[_0x3cfe('0x37')][_0x3cfe('0x38')]?_0x4613d3['attributes']:_0x40f97d[_0x3cfe('0x32')];if(_0x1dbe5d[_0x3cfe('0x33')][_0x3cfe('0x42')]){_0x4613d3[_0x3cfe('0x49')]=[{'all':!![]}];}_0x4613d3=_['merge']({},_0x4613d3,_0x1dbe5d[_0x3cfe('0x41')]);return db[_0x3cfe('0x2f')][_0x3cfe('0x4a')](_0x4613d3)[_0x3cfe('0x25')](handleEntityNotFound(_0x29a30f,null))['then'](respondWithResult(_0x29a30f,null))['catch'](handleError(_0x29a30f,null));};exports['create']=function(_0x12bbb6,_0x28f450){return db[_0x3cfe('0x2f')][_0x3cfe('0x4b')](_0x12bbb6[_0x3cfe('0x4c')],{})[_0x3cfe('0x25')](function(_0x29266f){var _0x43b622=_0x12bbb6[_0x3cfe('0x4d')][_0x3cfe('0x27')]({'plain':!![]});if(!_0x43b622)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43b622[_0x3cfe('0x4e')]===_0x3cfe('0x4d')){var _0x44a0dc=_0x29266f[_0x3cfe('0x27')]({'plain':!![]});var _0x43c403=_0x3cfe('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x43c403,'userProfileId':_0x43b622[_0x3cfe('0x4f')]},'raw':!![]})[_0x3cfe('0x25')](function(_0x2a74b3){if(_0x2a74b3&&_0x2a74b3[_0x3cfe('0x50')]===0x0){return db[_0x3cfe('0x51')]['create']({'name':_0x44a0dc[_0x3cfe('0x2b')],'resourceId':_0x44a0dc['id'],'type':_0x2a74b3[_0x3cfe('0x2b')],'sectionId':_0x2a74b3['id']},{})[_0x3cfe('0x25')](function(){return _0x29266f;});}else{return _0x29266f;}})['catch'](function(_0x1c4762){logger[_0x3cfe('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c4762);throw _0x1c4762;});}return _0x29266f;})[_0x3cfe('0x25')](respondWithResult(_0x28f450,0xc9))['catch'](handleError(_0x28f450,null));};exports['update']=function(_0x4d38ce,_0x5bb4dc){if(_0x4d38ce['body']['id']){delete _0x4d38ce[_0x3cfe('0x4c')]['id'];}return db[_0x3cfe('0x2f')][_0x3cfe('0x4a')]({'where':{'id':_0x4d38ce[_0x3cfe('0x47')]['id']}})[_0x3cfe('0x25')](handleEntityNotFound(_0x5bb4dc,null))[_0x3cfe('0x25')](saveUpdates(_0x4d38ce['body'],null))[_0x3cfe('0x25')](respondWithResult(_0x5bb4dc,null))['catch'](handleError(_0x5bb4dc,null));};exports[_0x3cfe('0x26')]=function(_0x33f8ae,_0x1094ef){return db['AnalyticExtractedReport'][_0x3cfe('0x4a')]({'where':{'id':_0x33f8ae[_0x3cfe('0x47')]['id']}})['then'](handleEntityNotFound(_0x1094ef,null))[_0x3cfe('0x25')](removeEntity(_0x1094ef,null))[_0x3cfe('0x45')](handleError(_0x1094ef,null));};exports[_0x3cfe('0x52')]=function(_0x41dc43,_0x5b2e4c,_0x29241d){return db[_0x3cfe('0x2f')][_0x3cfe('0x4a')]({'where':{'id':_0x41dc43[_0x3cfe('0x47')]['id']},'attributes':['name',_0x3cfe('0x53'),_0x3cfe('0x54'),_0x3cfe('0x55')],'raw':!![]})[_0x3cfe('0x25')](handleEntityNotFound(_0x5b2e4c,null))[_0x3cfe('0x25')](function(_0x2473cc){if(_0x2473cc){if(!fs[_0x3cfe('0x56')](path[_0x3cfe('0x57')](config[_0x3cfe('0x58')],_0x3cfe('0x59'),_0x2473cc[_0x3cfe('0x54')]))){throw new db[(_0x3cfe('0x5a'))]['ValidationError'](_0x3cfe('0x5b'));}if(_0x41dc43[_0x3cfe('0x33')]['exists']){return _0x5b2e4c[_0x3cfe('0x19')](0xc8);}return _0x5b2e4c[_0x3cfe('0x52')](path['join'](config[_0x3cfe('0x58')],'server/files/reports',_0x2473cc['savename']),util[_0x3cfe('0x5c')](_0x3cfe('0x5d'),_0x2473cc[_0x3cfe('0x53')]||_0x2473cc[_0x3cfe('0x2b')],_0x2473cc[_0x3cfe('0x55')][_0x3cfe('0x5e')]()));}})[_0x3cfe('0x45')](handleError(_0x5b2e4c,null));}; \ No newline at end of file +var _0x34e7=['path','sox','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','json','offset','status','set','Content-Range','reject','save','update','then','destroy','get','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','filter','where','VIRTUAL','merge','options','AnalyticExtractedReport','count','includeAll','include','findAll','rows','catch','show','params','model','intersection','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ExtractedReports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','download','basename','savename','output','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','join','format','%s.%s','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x461bca,_0x524ccd){var _0x5f4579=function(_0x508ff6){while(--_0x508ff6){_0x461bca['push'](_0x461bca['shift']());}};_0x5f4579(++_0x524ccd);}(_0x34e7,0x120));var _0x734e=function(_0x15b539,_0x4ece18){_0x15b539=_0x15b539-0x0;var _0x2b6dbe=_0x34e7[_0x15b539];return _0x2b6dbe;};'use strict';var pdf=require(_0x734e('0x0'));var emlformat=require(_0x734e('0x1'));var rimraf=require(_0x734e('0x2'));var zipdir=require(_0x734e('0x3'));var jsonpatch=require(_0x734e('0x4'));var rp=require(_0x734e('0x5'));var moment=require('moment');var BPromise=require(_0x734e('0x6'));var Mustache=require(_0x734e('0x7'));var util=require(_0x734e('0x8'));var path=require(_0x734e('0x9'));var sox=require(_0x734e('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x734e('0xb'));var crypto=require(_0x734e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x734e('0xd'));var toCsv=require(_0x734e('0xe'));var querystring=require('querystring');var Papa=require(_0x734e('0xf'));var Redis=require(_0x734e('0x10'));var authService=require(_0x734e('0x11'));var qs=require(_0x734e('0x12'));var as=require(_0x734e('0x13'));var hardwareService=require(_0x734e('0x14'));var logger=require(_0x734e('0x15'))(_0x734e('0x16'));var utils=require(_0x734e('0x17'));var config=require(_0x734e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2edd16,_0x41a0ec){_0x41a0ec=_0x41a0ec||0xcc;return function(_0x47a6ec){if(_0x47a6ec){return _0x2edd16[_0x734e('0x19')](_0x41a0ec);}return _0x2edd16['status'](_0x41a0ec)['end']();};}function respondWithResult(_0x2bc09c,_0x32de1d){_0x32de1d=_0x32de1d||0xc8;return function(_0x199396){if(_0x199396){return _0x2bc09c['status'](_0x32de1d)[_0x734e('0x1a')](_0x199396);}};}function respondWithFilteredResult(_0x30378b,_0x1c0255){return function(_0x23b83c){if(_0x23b83c){var _0x36ec06=_0x23b83c['count'],_0x41e1a4=_0x1c0255[_0x734e('0x1b')],_0x37a592=_0x1c0255['offset']+_0x1c0255['limit'],_0x395ebf;if(_0x37a592>=_0x36ec06){_0x37a592=_0x36ec06;_0x395ebf=0xc8;}else{_0x395ebf=0xce;}_0x30378b[_0x734e('0x1c')](_0x395ebf);return _0x30378b[_0x734e('0x1d')](_0x734e('0x1e'),_0x41e1a4+'-'+_0x37a592+'/'+_0x36ec06)['json'](_0x23b83c);}return null;};}function patchUpdates(_0x2fca3b){return function(_0x23f6b3){try{jsonpatch['apply'](_0x23f6b3,_0x2fca3b,!![]);}catch(_0x238d82){return BPromise[_0x734e('0x1f')](_0x238d82);}return _0x23f6b3[_0x734e('0x20')]();};}function saveUpdates(_0x2378c0,_0x2c59bd){return function(_0x1edfc0){if(_0x1edfc0){return _0x1edfc0[_0x734e('0x21')](_0x2378c0)[_0x734e('0x22')](function(_0x2c4465){return _0x2c4465;});}return null;};}function removeEntity(_0x221e5f,_0x2cd19c){return function(_0xfbb12){if(_0xfbb12){return _0xfbb12[_0x734e('0x23')]()[_0x734e('0x22')](function(){var _0x4edfb9=_0xfbb12[_0x734e('0x24')]({'plain':!![]});var _0x3a31f6='ExtractedReports';return db['UserProfileResource'][_0x734e('0x23')]({'where':{'type':_0x3a31f6,'resourceId':_0x4edfb9['id']}})[_0x734e('0x22')](function(){return _0xfbb12;});})[_0x734e('0x22')](function(){_0x221e5f[_0x734e('0x1c')](0xcc)[_0x734e('0x25')]();});}};}function handleEntityNotFound(_0x231799,_0x1aa9d7){return function(_0x59f395){if(!_0x59f395){_0x231799[_0x734e('0x19')](0x194);}return _0x59f395;};}function handleError(_0x1199c2,_0x46dd9f){_0x46dd9f=_0x46dd9f||0x1f4;return function(_0x20f1e7){logger[_0x734e('0x26')](_0x20f1e7[_0x734e('0x27')]);if(_0x20f1e7[_0x734e('0x28')]){delete _0x20f1e7['name'];}_0x1199c2['status'](_0x46dd9f)[_0x734e('0x29')](_0x20f1e7);};}exports[_0x734e('0x2a')]=function(_0x4e43d1,_0xaae8bd){var _0x54ee94={},_0x234b1b={},_0x5ab522={'count':0x0,'rows':[]};var _0x2e1b0e=_[_0x734e('0x2b')](db['AnalyticExtractedReport'][_0x734e('0x2c')],function(_0x4573d8){return{'name':_0x4573d8[_0x734e('0x2d')],'type':_0x4573d8[_0x734e('0x2e')][_0x734e('0x2f')]};});_0x234b1b['model']=_[_0x734e('0x2b')](_0x2e1b0e,_0x734e('0x28'));_0x234b1b[_0x734e('0x30')]=_[_0x734e('0x31')](_0x4e43d1[_0x734e('0x30')]);_0x234b1b[_0x734e('0x32')]=_['intersection'](_0x234b1b['model'],_0x234b1b[_0x734e('0x30')]);_0x54ee94[_0x734e('0x33')]=_['intersection'](_0x234b1b['model'],qs[_0x734e('0x34')](_0x4e43d1['query']['fields']));_0x54ee94['attributes']=_0x54ee94[_0x734e('0x33')][_0x734e('0x35')]?_0x54ee94[_0x734e('0x33')]:_0x234b1b['model'];if(!_0x4e43d1[_0x734e('0x30')][_0x734e('0x36')]('nolimit')){_0x54ee94[_0x734e('0x37')]=qs[_0x734e('0x37')](_0x4e43d1[_0x734e('0x30')][_0x734e('0x37')]);_0x54ee94['offset']=qs[_0x734e('0x1b')](_0x4e43d1[_0x734e('0x30')]['offset']);}_0x54ee94[_0x734e('0x38')]=qs['sort'](_0x4e43d1[_0x734e('0x30')][_0x734e('0x39')]);_0x54ee94['where']=qs[_0x734e('0x32')](_['pick'](_0x4e43d1[_0x734e('0x30')],_0x234b1b[_0x734e('0x32')]));if(_0x4e43d1[_0x734e('0x30')][_0x734e('0x3a')]){_0x54ee94[_0x734e('0x3b')]=_['merge'](_0x54ee94[_0x734e('0x3b')],{'$or':_['map'](_0x2e1b0e,function(_0x5d0c5b){if(_0x5d0c5b[_0x734e('0x2e')]!==_0x734e('0x3c')){var _0x4a583b={};_0x4a583b[_0x5d0c5b['name']]={'$like':'%'+_0x4e43d1[_0x734e('0x30')]['filter']+'%'};return _0x4a583b;}})});}_0x54ee94=_[_0x734e('0x3d')]({},_0x54ee94,_0x4e43d1[_0x734e('0x3e')]);var _0x459de4={'where':_0x54ee94[_0x734e('0x3b')]};return db[_0x734e('0x3f')]['count'](_0x459de4)[_0x734e('0x22')](function(_0x485ab){_0x5ab522[_0x734e('0x40')]=_0x485ab;if(_0x4e43d1[_0x734e('0x30')][_0x734e('0x41')]){_0x54ee94[_0x734e('0x42')]=[{'all':!![]}];}return db[_0x734e('0x3f')][_0x734e('0x43')](_0x54ee94);})[_0x734e('0x22')](function(_0x388d87){_0x5ab522[_0x734e('0x44')]=_0x388d87;return _0x5ab522;})['then'](respondWithFilteredResult(_0xaae8bd,_0x54ee94))[_0x734e('0x45')](handleError(_0xaae8bd,null));};exports[_0x734e('0x46')]=function(_0x17c6ae,_0x4246ee){var _0x4d090c={'raw':!![],'where':{'id':_0x17c6ae[_0x734e('0x47')]['id']}},_0x276218={};_0x276218[_0x734e('0x48')]=_[_0x734e('0x31')](db[_0x734e('0x3f')][_0x734e('0x2c')]);_0x276218[_0x734e('0x30')]=_[_0x734e('0x31')](_0x17c6ae[_0x734e('0x30')]);_0x276218[_0x734e('0x32')]=_[_0x734e('0x49')](_0x276218[_0x734e('0x48')],_0x276218['query']);_0x4d090c[_0x734e('0x33')]=_[_0x734e('0x49')](_0x276218[_0x734e('0x48')],qs[_0x734e('0x34')](_0x17c6ae[_0x734e('0x30')][_0x734e('0x34')]));_0x4d090c[_0x734e('0x33')]=_0x4d090c['attributes'][_0x734e('0x35')]?_0x4d090c[_0x734e('0x33')]:_0x276218[_0x734e('0x48')];if(_0x17c6ae[_0x734e('0x30')]['includeAll']){_0x4d090c[_0x734e('0x42')]=[{'all':!![]}];}_0x4d090c=_[_0x734e('0x3d')]({},_0x4d090c,_0x17c6ae[_0x734e('0x3e')]);return db['AnalyticExtractedReport']['find'](_0x4d090c)['then'](handleEntityNotFound(_0x4246ee,null))[_0x734e('0x22')](respondWithResult(_0x4246ee,null))[_0x734e('0x45')](handleError(_0x4246ee,null));};exports[_0x734e('0x4a')]=function(_0x5cb2de,_0x4f9ad5){return db[_0x734e('0x3f')][_0x734e('0x4a')](_0x5cb2de['body'],{})[_0x734e('0x22')](function(_0x2643d4){var _0x2a2ddb=_0x5cb2de[_0x734e('0x4b')][_0x734e('0x24')]({'plain':!![]});if(!_0x2a2ddb)throw new Error(_0x734e('0x4c'));if(_0x2a2ddb[_0x734e('0x4d')]==='user'){var _0x239632=_0x2643d4['get']({'plain':!![]});var _0x4d161e=_0x734e('0x4e');return db[_0x734e('0x4f')]['find']({'where':{'name':_0x4d161e,'userProfileId':_0x2a2ddb['userProfileId']},'raw':!![]})[_0x734e('0x22')](function(_0x137a9b){if(_0x137a9b&&_0x137a9b[_0x734e('0x50')]===0x0){return db[_0x734e('0x51')][_0x734e('0x4a')]({'name':_0x239632[_0x734e('0x28')],'resourceId':_0x239632['id'],'type':_0x137a9b['name'],'sectionId':_0x137a9b['id']},{})[_0x734e('0x22')](function(){return _0x2643d4;});}else{return _0x2643d4;}})[_0x734e('0x45')](function(_0x2b1598){logger[_0x734e('0x26')](_0x734e('0x52'),_0x2b1598);throw _0x2b1598;});}return _0x2643d4;})[_0x734e('0x22')](respondWithResult(_0x4f9ad5,0xc9))[_0x734e('0x45')](handleError(_0x4f9ad5,null));};exports['update']=function(_0x4fdb47,_0x29c932){if(_0x4fdb47[_0x734e('0x53')]['id']){delete _0x4fdb47['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x4fdb47[_0x734e('0x47')]['id']}})[_0x734e('0x22')](handleEntityNotFound(_0x29c932,null))[_0x734e('0x22')](saveUpdates(_0x4fdb47[_0x734e('0x53')],null))[_0x734e('0x22')](respondWithResult(_0x29c932,null))[_0x734e('0x45')](handleError(_0x29c932,null));};exports[_0x734e('0x23')]=function(_0x417faa,_0x25713b){return db[_0x734e('0x3f')][_0x734e('0x54')]({'where':{'id':_0x417faa[_0x734e('0x47')]['id']}})[_0x734e('0x22')](handleEntityNotFound(_0x25713b,null))[_0x734e('0x22')](removeEntity(_0x25713b,null))[_0x734e('0x45')](handleError(_0x25713b,null));};exports[_0x734e('0x55')]=function(_0x380735,_0x36664a,_0x4d97a3){return db['AnalyticExtractedReport'][_0x734e('0x54')]({'where':{'id':_0x380735[_0x734e('0x47')]['id']},'attributes':['name',_0x734e('0x56'),_0x734e('0x57'),_0x734e('0x58')],'raw':!![]})[_0x734e('0x22')](handleEntityNotFound(_0x36664a,null))[_0x734e('0x22')](function(_0x34d600){if(_0x34d600){if(!fs[_0x734e('0x59')](path['join'](config[_0x734e('0x5a')],_0x734e('0x5b'),_0x34d600[_0x734e('0x57')]))){throw new db[(_0x734e('0x5c'))][(_0x734e('0x5d'))](_0x734e('0x5e'));}if(_0x380735[_0x734e('0x30')]['exists']){return _0x36664a[_0x734e('0x19')](0xc8);}return _0x36664a[_0x734e('0x55')](path[_0x734e('0x5f')](config[_0x734e('0x5a')],_0x734e('0x5b'),_0x34d600[_0x734e('0x57')]),util[_0x734e('0x60')](_0x734e('0x61'),_0x34d600[_0x734e('0x56')]||_0x34d600[_0x734e('0x28')],_0x34d600[_0x734e('0x58')][_0x734e('0x62')]()));}})[_0x734e('0x45')](handleError(_0x36664a,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 2c85d6f..69029d0 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 _0xa79e=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','api','bluebird','request-promise'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa79e,0x11e));var _0xea79=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0xa79e[_0x4bacb6];return _0x58c029;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea79('0x0'))(_0xea79('0x1'));var moment=require('moment');var BPromise=require(_0xea79('0x2'));var rp=require(_0xea79('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea79('0x4'));var config=require(_0xea79('0x5'));var attributes=require(_0xea79('0x6'));module[_0xea79('0x7')]=function(_0x271635,_0x310d2e){return _0x271635['define'](_0xea79('0x8'),attributes,{'tableName':_0xea79('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf958=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','api','moment','bluebird','request-promise','path'];(function(_0x444dd9,_0x3af3ec){var _0x1f646a=function(_0x1b6ddc){while(--_0x1b6ddc){_0x444dd9['push'](_0x444dd9['shift']());}};_0x1f646a(++_0x3af3ec);}(_0xf958,0x1db));var _0x8f95=function(_0x22ae54,_0x5d0b55){_0x22ae54=_0x22ae54-0x0;var _0x14005c=_0xf958[_0x22ae54];return _0x14005c;};'use strict';var _=require(_0x8f95('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8f95('0x1'));var moment=require(_0x8f95('0x2'));var BPromise=require(_0x8f95('0x3'));var rp=require(_0x8f95('0x4'));var fs=require('fs');var path=require(_0x8f95('0x5'));var rimraf=require(_0x8f95('0x6'));var config=require(_0x8f95('0x7'));var attributes=require(_0x8f95('0x8'));module[_0x8f95('0x9')]=function(_0x13261a,_0x38d4ad){return _0x13261a[_0x8f95('0xa')](_0x8f95('0xb'),attributes,{'tableName':_0x8f95('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 0b065e4..d01358f 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 _0x9034=['code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x237f9e,_0x360aa9){var _0x3b9a9c=function(_0x1453d2){while(--_0x1453d2){_0x237f9e['push'](_0x237f9e['shift']());}};_0x3b9a9c(++_0x360aa9);}(_0x9034,0xc4));var _0x4903=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9034[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x4903('0x0'));var util=require('util');var moment=require(_0x4903('0x1'));var BPromise=require(_0x4903('0x2'));var rs=require(_0x4903('0x3'));var fs=require('fs');var Redis=require(_0x4903('0x4'));var db=require(_0x4903('0x5'))['db'];var utils=require(_0x4903('0x6'));var logger=require(_0x4903('0x7'))(_0x4903('0x8'));var config=require(_0x4903('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4903('0xa')][_0x4903('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x181012,_0x1746e9,_0x4131ae){return new BPromise(function(_0x450078,_0x500726){return client['request'](_0x181012,_0x4131ae)[_0x4903('0xc')](function(_0x46474){logger[_0x4903('0xd')](_0x4903('0xe'),_0x1746e9,_0x4903('0xf'));logger[_0x4903('0x10')](_0x4903('0x11'),_0x1746e9,_0x4903('0xf'),JSON[_0x4903('0x12')](_0x46474));if(_0x46474[_0x4903('0x13')]){if(_0x46474[_0x4903('0x13')][_0x4903('0x14')]===0x1f4){logger[_0x4903('0x13')](_0x4903('0xe'),_0x1746e9,_0x46474[_0x4903('0x13')][_0x4903('0x15')]);return _0x500726(_0x46474[_0x4903('0x13')][_0x4903('0x15')]);}logger[_0x4903('0x13')](_0x4903('0xe'),_0x1746e9,_0x46474['error'][_0x4903('0x15')]);return _0x450078(_0x46474[_0x4903('0x13')]['message']);}else{logger[_0x4903('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1746e9,_0x4903('0xf'));_0x450078(_0x46474[_0x4903('0x16')][_0x4903('0x15')]);}})[_0x4903('0x17')](function(_0x5eeaf2){logger[_0x4903('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1746e9,_0x5eeaf2);_0x500726(_0x5eeaf2);});});} \ No newline at end of file +var _0x6526=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6526,0x1df));var _0x6652=function(_0x28edda,_0xbd447a){_0x28edda=_0x28edda-0x0;var _0x21f4a4=_0x6526[_0x28edda];return _0x21f4a4;};'use strict';var _=require(_0x6652('0x0'));var util=require(_0x6652('0x1'));var moment=require(_0x6652('0x2'));var BPromise=require(_0x6652('0x3'));var rs=require(_0x6652('0x4'));var fs=require('fs');var Redis=require(_0x6652('0x5'));var db=require(_0x6652('0x6'))['db'];var utils=require(_0x6652('0x7'));var logger=require(_0x6652('0x8'))(_0x6652('0x9'));var config=require('../../config/environment');var jayson=require(_0x6652('0xa'));var client=jayson[_0x6652('0xb')][_0x6652('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3db347,_0x4bb65a,_0x1e14ff){return new BPromise(function(_0x53e9b9,_0x41e150){return client[_0x6652('0xd')](_0x3db347,_0x1e14ff)['then'](function(_0xa9385){logger['info'](_0x6652('0xe'),_0x4bb65a,_0x6652('0xf'));logger['debug'](_0x6652('0x10'),_0x4bb65a,'request\x20sent',JSON['stringify'](_0xa9385));if(_0xa9385[_0x6652('0x11')]){if(_0xa9385[_0x6652('0x11')][_0x6652('0x12')]===0x1f4){logger[_0x6652('0x11')](_0x6652('0xe'),_0x4bb65a,_0xa9385[_0x6652('0x11')][_0x6652('0x13')]);return _0x41e150(_0xa9385[_0x6652('0x11')]['message']);}logger[_0x6652('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x4bb65a,_0xa9385[_0x6652('0x11')][_0x6652('0x13')]);return _0x53e9b9(_0xa9385[_0x6652('0x11')]['message']);}else{logger[_0x6652('0x14')](_0x6652('0xe'),_0x4bb65a,'request\x20sent');_0x53e9b9(_0xa9385[_0x6652('0x15')][_0x6652('0x13')]);}})[_0x6652('0x16')](function(_0xa4170c){logger[_0x6652('0x11')](_0x6652('0xe'),_0x4bb65a,_0xa4170c);_0x41e150(_0xa4170c);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index aa84e7e..8ef43dc 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 _0xfa1e=['isAuthenticated','index','show','/:id/download','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0xfa1e,0x102));var _0xefa1=function(_0x4ffa64,_0x271035){_0x4ffa64=_0x4ffa64-0x0;var _0x5da001=_0xfa1e[_0x4ffa64];return _0x5da001;};'use strict';var multer=require(_0xefa1('0x0'));var util=require(_0xefa1('0x1'));var path=require(_0xefa1('0x2'));var timeout=require(_0xefa1('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xefa1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xefa1('0x5'));var controller=require(_0xefa1('0x6'));router[_0xefa1('0x7')]('/',auth[_0xefa1('0x8')](),controller[_0xefa1('0x9')]);router['get']('/:id',auth[_0xefa1('0x8')](),controller[_0xefa1('0xa')]);router[_0xefa1('0x7')](_0xefa1('0xb'),auth['isAuthenticated'](),controller['download']);router[_0xefa1('0xc')]('/',auth[_0xefa1('0x8')](),controller[_0xefa1('0xd')]);router[_0xefa1('0xe')](_0xefa1('0xf'),auth[_0xefa1('0x8')](),controller[_0xefa1('0x10')]);router[_0xefa1('0x11')](_0xefa1('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xefa1('0x12')]=router; \ No newline at end of file +var _0xe361=['get','isAuthenticated','index','/:id','show','/:id/download','download','put','delete','util','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x36f99f,_0x10dfa2){var _0x85cb3b=function(_0x26d6b7){while(--_0x26d6b7){_0x36f99f['push'](_0x36f99f['shift']());}};_0x85cb3b(++_0x10dfa2);}(_0xe361,0x7e));var _0x1e36=function(_0x25d2fa,_0x1d35c6){_0x25d2fa=_0x25d2fa-0x0;var _0x42d4aa=_0xe361[_0x25d2fa];return _0x42d4aa;};'use strict';var multer=require('multer');var util=require(_0x1e36('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1e36('0x1'));var config=require(_0x1e36('0x2'));var controller=require(_0x1e36('0x3'));router[_0x1e36('0x4')]('/',auth[_0x1e36('0x5')](),controller[_0x1e36('0x6')]);router[_0x1e36('0x4')](_0x1e36('0x7'),auth[_0x1e36('0x5')](),controller[_0x1e36('0x8')]);router[_0x1e36('0x4')](_0x1e36('0x9'),auth[_0x1e36('0x5')](),controller[_0x1e36('0xa')]);router['post']('/',auth[_0x1e36('0x5')](),controller['create']);router[_0x1e36('0xb')](_0x1e36('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x1e36('0xc')](_0x1e36('0x7'),auth[_0x1e36('0x5')](),controller['destroy']);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 5e96552..f69c0b5 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 _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x2d19ea,_0x3193d8){var _0x4346c6=function(_0x950715){while(--_0x950715){_0x2d19ea['push'](_0x2d19ea['shift']());}};_0x4346c6(++_0x3193d8);}(_0x1261,0x144));var _0x1126=function(_0x160cd5,_0x19c58e){_0x160cd5=_0x160cd5-0x0;var _0x366763=_0x1261[_0x160cd5];return _0x366763;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7217=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x49640b,_0x591a40){var _0x3b382c=function(_0x58dd52){while(--_0x58dd52){_0x49640b['push'](_0x49640b['shift']());}};_0x3b382c(++_0x591a40);}(_0x7217,0x19e));var _0x7721=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x7217[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'field':{'type':Sequelize[_0x7721('0x1')]},'alias':{'type':Sequelize[_0x7721('0x2')]},'function':{'type':Sequelize[_0x7721('0x2')]},'format':{'type':Sequelize[_0x7721('0x2')]},'groupBy':{'type':Sequelize[_0x7721('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 3421057..592c190 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 _0x9672=['squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','count','offset','limit','set','Content-Range','json','apply','reject','destroy','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','AnalyticFieldReport','includeAll','include','findAll','catch','show','create','bulkCreate','body','update','find','params','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash'];(function(_0x434346,_0x375bc0){var _0x4beb29=function(_0x4bca4e){while(--_0x4bca4e){_0x434346['push'](_0x434346['shift']());}};_0x4beb29(++_0x375bc0);}(_0x9672,0xee));var _0x2967=function(_0x28d7f4,_0x1a67b1){_0x28d7f4=_0x28d7f4-0x0;var _0x3953c3=_0x9672[_0x28d7f4];return _0x3953c3;};'use strict';var pdf=require(_0x2967('0x0'));var emlformat=require(_0x2967('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2967('0x2'));var jsonpatch=require(_0x2967('0x3'));var rp=require(_0x2967('0x4'));var moment=require(_0x2967('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2967('0x6'));var util=require(_0x2967('0x7'));var path=require(_0x2967('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2967('0x9'));var fs=require('fs');var _=require(_0x2967('0xa'));var squel=require(_0x2967('0xb'));var crypto=require(_0x2967('0xc'));var jsforce=require(_0x2967('0xd'));var deskjs=require(_0x2967('0xe'));var toCsv=require(_0x2967('0xf'));var querystring=require(_0x2967('0x10'));var Papa=require('papaparse');var Redis=require(_0x2967('0x11'));var authService=require(_0x2967('0x12'));var qs=require(_0x2967('0x13'));var as=require(_0x2967('0x14'));var hardwareService=require(_0x2967('0x15'));var logger=require(_0x2967('0x16'))('api');var utils=require(_0x2967('0x17'));var config=require('../../config/environment');var db=require(_0x2967('0x18'))['db'];function respondWithStatusCode(_0x595fdb,_0x207630){_0x207630=_0x207630||0xcc;return function(_0x298f58){if(_0x298f58){return _0x595fdb['sendStatus'](_0x207630);}return _0x595fdb[_0x2967('0x19')](_0x207630)['end']();};}function respondWithResult(_0x142200,_0x313b5c){_0x313b5c=_0x313b5c||0xc8;return function(_0x3ea4b3){if(_0x3ea4b3){return _0x142200['status'](_0x313b5c)['json'](_0x3ea4b3);}};}function respondWithFilteredResult(_0xa2e896,_0x9a4e11){return function(_0x42296c){if(_0x42296c){var _0x4e1d34=_0x42296c[_0x2967('0x1a')],_0x574a9f=_0x9a4e11[_0x2967('0x1b')],_0x2fff79=_0x9a4e11[_0x2967('0x1b')]+_0x9a4e11[_0x2967('0x1c')],_0x12910a;if(_0x2fff79>=_0x4e1d34){_0x2fff79=_0x4e1d34;_0x12910a=0xc8;}else{_0x12910a=0xce;}_0xa2e896[_0x2967('0x19')](_0x12910a);return _0xa2e896[_0x2967('0x1d')](_0x2967('0x1e'),_0x574a9f+'-'+_0x2fff79+'/'+_0x4e1d34)[_0x2967('0x1f')](_0x42296c);}return null;};}function patchUpdates(_0x57bf2c){return function(_0x298de0){try{jsonpatch[_0x2967('0x20')](_0x298de0,_0x57bf2c,!![]);}catch(_0xff84a1){return BPromise[_0x2967('0x21')](_0xff84a1);}return _0x298de0['save']();};}function saveUpdates(_0x321e36,_0x1cb5e4){return function(_0x33bb91){if(_0x33bb91){return _0x33bb91['update'](_0x321e36)['then'](function(_0x13f924){return _0x13f924;});}return null;};}function removeEntity(_0x13d498,_0x258eca){return function(_0x10788e){if(_0x10788e){return _0x10788e[_0x2967('0x22')]()[_0x2967('0x23')](function(){_0x13d498[_0x2967('0x19')](0xcc)[_0x2967('0x24')]();});}};}function handleEntityNotFound(_0x46ab4a,_0x5bd687){return function(_0x436b45){if(!_0x436b45){_0x46ab4a[_0x2967('0x25')](0x194);}return _0x436b45;};}function handleError(_0x3c47e2,_0x197763){_0x197763=_0x197763||0x1f4;return function(_0x57f715){logger[_0x2967('0x26')](_0x57f715[_0x2967('0x27')]);if(_0x57f715['name']){delete _0x57f715[_0x2967('0x28')];}_0x3c47e2[_0x2967('0x19')](_0x197763)[_0x2967('0x29')](_0x57f715);};}exports[_0x2967('0x2a')]=function(_0x2355f2,_0x36c1d9){var _0x1a3d42={},_0x4e0603={},_0x1966b4={'count':0x0,'rows':[]};var _0x2a0ad8=_[_0x2967('0x2b')](db['AnalyticFieldReport'][_0x2967('0x2c')],function(_0x30ba97){return{'name':_0x30ba97[_0x2967('0x2d')],'type':_0x30ba97['type'][_0x2967('0x2e')]};});_0x4e0603[_0x2967('0x2f')]=_['map'](_0x2a0ad8,_0x2967('0x28'));_0x4e0603[_0x2967('0x30')]=_[_0x2967('0x31')](_0x2355f2['query']);_0x4e0603[_0x2967('0x32')]=_[_0x2967('0x33')](_0x4e0603[_0x2967('0x2f')],_0x4e0603['query']);_0x1a3d42[_0x2967('0x34')]=_[_0x2967('0x33')](_0x4e0603[_0x2967('0x2f')],qs[_0x2967('0x35')](_0x2355f2[_0x2967('0x30')][_0x2967('0x35')]));_0x1a3d42[_0x2967('0x34')]=_0x1a3d42[_0x2967('0x34')][_0x2967('0x36')]?_0x1a3d42[_0x2967('0x34')]:_0x4e0603[_0x2967('0x2f')];if(!_0x2355f2[_0x2967('0x30')][_0x2967('0x37')](_0x2967('0x38'))){_0x1a3d42[_0x2967('0x1c')]=qs[_0x2967('0x1c')](_0x2355f2['query']['limit']);_0x1a3d42[_0x2967('0x1b')]=qs[_0x2967('0x1b')](_0x2355f2[_0x2967('0x30')][_0x2967('0x1b')]);}_0x1a3d42['order']=qs[_0x2967('0x39')](_0x2355f2['query'][_0x2967('0x39')]);_0x1a3d42[_0x2967('0x3a')]=qs[_0x2967('0x32')](_['pick'](_0x2355f2[_0x2967('0x30')],_0x4e0603['filters']));if(_0x2355f2[_0x2967('0x30')]['filter']){_0x1a3d42[_0x2967('0x3a')]=_[_0x2967('0x3b')](_0x1a3d42['where'],{'$or':_[_0x2967('0x2b')](_0x2a0ad8,function(_0x397e37){if(_0x397e37[_0x2967('0x3c')]!==_0x2967('0x3d')){var _0x235ffb={};_0x235ffb[_0x397e37[_0x2967('0x28')]]={'$like':'%'+_0x2355f2[_0x2967('0x30')][_0x2967('0x3e')]+'%'};return _0x235ffb;}})});}_0x1a3d42=_[_0x2967('0x3b')]({},_0x1a3d42,_0x2355f2[_0x2967('0x3f')]);var _0x166b0f={'where':_0x1a3d42[_0x2967('0x3a')]};return db[_0x2967('0x40')][_0x2967('0x1a')](_0x166b0f)[_0x2967('0x23')](function(_0x2cf2c7){_0x1966b4[_0x2967('0x1a')]=_0x2cf2c7;if(_0x2355f2[_0x2967('0x30')][_0x2967('0x41')]){_0x1a3d42[_0x2967('0x42')]=[{'all':!![]}];}return db[_0x2967('0x40')][_0x2967('0x43')](_0x1a3d42);})[_0x2967('0x23')](function(_0xed0b3a){_0x1966b4['rows']=_0xed0b3a;return _0x1966b4;})['then'](respondWithFilteredResult(_0x36c1d9,_0x1a3d42))[_0x2967('0x44')](handleError(_0x36c1d9,null));};exports[_0x2967('0x45')]=function(_0x3ca0ea,_0xfc8471){var _0x3ce06d={'raw':![],'where':{'id':_0x3ca0ea['params']['id']}},_0x3a4b5c={};_0x3a4b5c['model']=_[_0x2967('0x31')](db['AnalyticFieldReport'][_0x2967('0x2c')]);_0x3a4b5c[_0x2967('0x30')]=_[_0x2967('0x31')](_0x3ca0ea['query']);_0x3a4b5c[_0x2967('0x32')]=_[_0x2967('0x33')](_0x3a4b5c['model'],_0x3a4b5c['query']);_0x3ce06d[_0x2967('0x34')]=_[_0x2967('0x33')](_0x3a4b5c[_0x2967('0x2f')],qs['fields'](_0x3ca0ea[_0x2967('0x30')][_0x2967('0x35')]));_0x3ce06d[_0x2967('0x34')]=_0x3ce06d[_0x2967('0x34')]['length']?_0x3ce06d['attributes']:_0x3a4b5c[_0x2967('0x2f')];if(_0x3ca0ea['query'][_0x2967('0x41')]){_0x3ce06d['include']=[{'all':!![]}];}_0x3ce06d=_['merge']({},_0x3ce06d,_0x3ca0ea[_0x2967('0x3f')]);return db[_0x2967('0x40')]['find'](_0x3ce06d)[_0x2967('0x23')](handleEntityNotFound(_0xfc8471,null))[_0x2967('0x23')](respondWithResult(_0xfc8471,null))['catch'](handleError(_0xfc8471,null));};exports[_0x2967('0x46')]=function(_0x1acf1a,_0x34cce0){return db['AnalyticFieldReport'][_0x2967('0x46')](_0x1acf1a['body'],{})[_0x2967('0x23')](respondWithResult(_0x34cce0,0xc9))[_0x2967('0x44')](handleError(_0x34cce0,null));};exports[_0x2967('0x47')]=function(_0x286869,_0x331c02){return db[_0x2967('0x40')]['bulkCreate'](_0x286869[_0x2967('0x48')],{'raw':![],'individualHooks':!![]})[_0x2967('0x23')](respondWithResult(_0x331c02,0xc9))['catch'](handleError(_0x331c02,null));};exports[_0x2967('0x49')]=function(_0x27bbac,_0x4aa7f4){if(_0x27bbac['body']['id']){delete _0x27bbac['body']['id'];}return db['AnalyticFieldReport'][_0x2967('0x4a')]({'where':{'id':_0x27bbac[_0x2967('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4aa7f4,null))[_0x2967('0x23')](saveUpdates(_0x27bbac[_0x2967('0x48')],null))[_0x2967('0x23')](respondWithResult(_0x4aa7f4,null))[_0x2967('0x44')](handleError(_0x4aa7f4,null));};exports[_0x2967('0x22')]=function(_0x304f6f,_0x4d119d){return db['AnalyticFieldReport'][_0x2967('0x4a')]({'where':{'id':_0x304f6f[_0x2967('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4d119d,null))['then'](removeEntity(_0x4d119d,null))[_0x2967('0x44')](handleError(_0x4d119d,null));};exports['bulkDestroy']=function(_0x201cf3,_0x24c4a9){return db['AnalyticFieldReport'][_0x2967('0x22')]({'where':{'id':_0x201cf3['query'][_0x2967('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x2967('0x23')](respondWithResult(_0x24c4a9,0xcc))[_0x2967('0x44')](handleError(_0x24c4a9,null));};exports[_0x2967('0x4d')]=function(_0x2f49d5,_0xe65fa2,_0x1d864f){return db[_0x2967('0x4e')][_0x2967('0x4f')]({'where':{'id':_0x2f49d5['params']['id']}})[_0x2967('0x23')](handleEntityNotFound(_0xe65fa2,null))[_0x2967('0x23')](function(_0x4362c2){if(_0x4362c2){return db[_0x2967('0x50')][_0x2967('0x51')](function(_0xb47141){return db['AnalyticFieldReport'][_0x2967('0x22')]({'where':{'CustomReportId':_0x2f49d5[_0x2967('0x4b')]['id']},'transaction':_0xb47141})[_0x2967('0x23')](function(_0x2c61a8){var _0x2e53bc=_[_0x2967('0x2b')](_0x2f49d5[_0x2967('0x48')],function(_0x2d6214){delete _0x2d6214['id'];_0x2d6214[_0x2967('0x52')]=_0x2f49d5['params']['id'];return _0x2d6214;});return db[_0x2967('0x40')][_0x2967('0x47')](_0x2e53bc,{'transaction':_0xb47141});});})[_0x2967('0x23')](function(){return db[_0x2967('0x40')][_0x2967('0x43')]({'where':{'CustomReportId':_0x2f49d5[_0x2967('0x4b')]['id']}});});}})['then'](respondWithResult(_0xe65fa2,null))['catch'](handleError(_0xe65fa2,null));}; \ No newline at end of file +var _0xb511=['../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','reject','then','stack','name','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','AnalyticFieldReport','include','rows','catch','show','params','includeAll','options','find','create','body','bulkCreate','update','destroy','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0xc144be,_0x385142){var _0x4ffd89=function(_0x4d5ca1){while(--_0x4d5ca1){_0xc144be['push'](_0xc144be['shift']());}};_0x4ffd89(++_0x385142);}(_0xb511,0x165));var _0x1b51=function(_0x5b13a8,_0x2f7062){_0x5b13a8=_0x5b13a8-0x0;var _0x2887d3=_0xb511[_0x5b13a8];return _0x2887d3;};'use strict';var pdf=require(_0x1b51('0x0'));var emlformat=require(_0x1b51('0x1'));var rimraf=require(_0x1b51('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1b51('0x3'));var rp=require(_0x1b51('0x4'));var moment=require('moment');var BPromise=require(_0x1b51('0x5'));var Mustache=require(_0x1b51('0x6'));var util=require(_0x1b51('0x7'));var path=require('path');var sox=require(_0x1b51('0x8'));var csv=require(_0x1b51('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1b51('0xa'));var squel=require(_0x1b51('0xb'));var crypto=require('crypto');var jsforce=require(_0x1b51('0xc'));var deskjs=require(_0x1b51('0xd'));var toCsv=require(_0x1b51('0x9'));var querystring=require(_0x1b51('0xe'));var Papa=require(_0x1b51('0xf'));var Redis=require(_0x1b51('0x10'));var authService=require(_0x1b51('0x11'));var qs=require(_0x1b51('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b51('0x13'));var logger=require(_0x1b51('0x14'))(_0x1b51('0x15'));var utils=require(_0x1b51('0x16'));var config=require(_0x1b51('0x17'));var db=require(_0x1b51('0x18'))['db'];function respondWithStatusCode(_0x4bf4eb,_0xfa36a5){_0xfa36a5=_0xfa36a5||0xcc;return function(_0x11e29e){if(_0x11e29e){return _0x4bf4eb[_0x1b51('0x19')](_0xfa36a5);}return _0x4bf4eb[_0x1b51('0x1a')](_0xfa36a5)[_0x1b51('0x1b')]();};}function respondWithResult(_0x46c991,_0x159c9a){_0x159c9a=_0x159c9a||0xc8;return function(_0x58a1db){if(_0x58a1db){return _0x46c991[_0x1b51('0x1a')](_0x159c9a)['json'](_0x58a1db);}};}function respondWithFilteredResult(_0x5db91e,_0x46b28f){return function(_0x3c427a){if(_0x3c427a){var _0x4bfe72=_0x3c427a['count'],_0x231475=_0x46b28f[_0x1b51('0x1c')],_0x3ece8d=_0x46b28f[_0x1b51('0x1c')]+_0x46b28f[_0x1b51('0x1d')],_0x3f3850;if(_0x3ece8d>=_0x4bfe72){_0x3ece8d=_0x4bfe72;_0x3f3850=0xc8;}else{_0x3f3850=0xce;}_0x5db91e[_0x1b51('0x1a')](_0x3f3850);return _0x5db91e['set'](_0x1b51('0x1e'),_0x231475+'-'+_0x3ece8d+'/'+_0x4bfe72)[_0x1b51('0x1f')](_0x3c427a);}return null;};}function patchUpdates(_0x153c33){return function(_0x556762){try{jsonpatch['apply'](_0x556762,_0x153c33,!![]);}catch(_0x1d67f3){return BPromise[_0x1b51('0x20')](_0x1d67f3);}return _0x556762['save']();};}function saveUpdates(_0x2c9e54,_0x695f55){return function(_0x527647){if(_0x527647){return _0x527647['update'](_0x2c9e54)[_0x1b51('0x21')](function(_0xb4ddf6){return _0xb4ddf6;});}return null;};}function removeEntity(_0x15e196,_0x17381b){return function(_0x5628cf){if(_0x5628cf){return _0x5628cf['destroy']()[_0x1b51('0x21')](function(){_0x15e196[_0x1b51('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cfab4,_0x4ba07e){return function(_0x4a2e45){if(!_0x4a2e45){_0x2cfab4[_0x1b51('0x19')](0x194);}return _0x4a2e45;};}function handleError(_0x4b43c8,_0x1eac36){_0x1eac36=_0x1eac36||0x1f4;return function(_0x2a720f){logger['error'](_0x2a720f[_0x1b51('0x22')]);if(_0x2a720f[_0x1b51('0x23')]){delete _0x2a720f[_0x1b51('0x23')];}_0x4b43c8[_0x1b51('0x1a')](_0x1eac36)['send'](_0x2a720f);};}exports['index']=function(_0x3544ad,_0x1a6c68){var _0x9f3268={},_0x46797d={},_0x25cb80={'count':0x0,'rows':[]};var _0x23cfcd=_[_0x1b51('0x24')](db['AnalyticFieldReport'][_0x1b51('0x25')],function(_0x1108ba){return{'name':_0x1108ba[_0x1b51('0x26')],'type':_0x1108ba['type'][_0x1b51('0x27')]};});_0x46797d[_0x1b51('0x28')]=_[_0x1b51('0x24')](_0x23cfcd,_0x1b51('0x23'));_0x46797d[_0x1b51('0x29')]=_[_0x1b51('0x2a')](_0x3544ad[_0x1b51('0x29')]);_0x46797d['filters']=_[_0x1b51('0x2b')](_0x46797d[_0x1b51('0x28')],_0x46797d[_0x1b51('0x29')]);_0x9f3268[_0x1b51('0x2c')]=_[_0x1b51('0x2b')](_0x46797d[_0x1b51('0x28')],qs[_0x1b51('0x2d')](_0x3544ad[_0x1b51('0x29')][_0x1b51('0x2d')]));_0x9f3268['attributes']=_0x9f3268[_0x1b51('0x2c')][_0x1b51('0x2e')]?_0x9f3268['attributes']:_0x46797d[_0x1b51('0x28')];if(!_0x3544ad['query'][_0x1b51('0x2f')](_0x1b51('0x30'))){_0x9f3268[_0x1b51('0x1d')]=qs[_0x1b51('0x1d')](_0x3544ad['query'][_0x1b51('0x1d')]);_0x9f3268[_0x1b51('0x1c')]=qs[_0x1b51('0x1c')](_0x3544ad[_0x1b51('0x29')]['offset']);}_0x9f3268['order']=qs[_0x1b51('0x31')](_0x3544ad[_0x1b51('0x29')][_0x1b51('0x31')]);_0x9f3268[_0x1b51('0x32')]=qs[_0x1b51('0x33')](_['pick'](_0x3544ad[_0x1b51('0x29')],_0x46797d[_0x1b51('0x33')]));if(_0x3544ad[_0x1b51('0x29')][_0x1b51('0x34')]){_0x9f3268[_0x1b51('0x32')]=_[_0x1b51('0x35')](_0x9f3268['where'],{'$or':_[_0x1b51('0x24')](_0x23cfcd,function(_0x2137e5){if(_0x2137e5[_0x1b51('0x36')]!==_0x1b51('0x37')){var _0x5a936a={};_0x5a936a[_0x2137e5[_0x1b51('0x23')]]={'$like':'%'+_0x3544ad[_0x1b51('0x29')][_0x1b51('0x34')]+'%'};return _0x5a936a;}})});}_0x9f3268=_[_0x1b51('0x35')]({},_0x9f3268,_0x3544ad['options']);var _0x2861c3={'where':_0x9f3268[_0x1b51('0x32')]};return db[_0x1b51('0x38')]['count'](_0x2861c3)['then'](function(_0x12bdce){_0x25cb80['count']=_0x12bdce;if(_0x3544ad[_0x1b51('0x29')]['includeAll']){_0x9f3268[_0x1b51('0x39')]=[{'all':!![]}];}return db[_0x1b51('0x38')]['findAll'](_0x9f3268);})[_0x1b51('0x21')](function(_0x5d32d0){_0x25cb80[_0x1b51('0x3a')]=_0x5d32d0;return _0x25cb80;})[_0x1b51('0x21')](respondWithFilteredResult(_0x1a6c68,_0x9f3268))[_0x1b51('0x3b')](handleError(_0x1a6c68,null));};exports[_0x1b51('0x3c')]=function(_0x12a00f,_0x14328f){var _0x488c1b={'raw':![],'where':{'id':_0x12a00f[_0x1b51('0x3d')]['id']}},_0xab381f={};_0xab381f[_0x1b51('0x28')]=_[_0x1b51('0x2a')](db[_0x1b51('0x38')][_0x1b51('0x25')]);_0xab381f['query']=_[_0x1b51('0x2a')](_0x12a00f[_0x1b51('0x29')]);_0xab381f[_0x1b51('0x33')]=_[_0x1b51('0x2b')](_0xab381f[_0x1b51('0x28')],_0xab381f[_0x1b51('0x29')]);_0x488c1b['attributes']=_[_0x1b51('0x2b')](_0xab381f[_0x1b51('0x28')],qs['fields'](_0x12a00f[_0x1b51('0x29')][_0x1b51('0x2d')]));_0x488c1b[_0x1b51('0x2c')]=_0x488c1b[_0x1b51('0x2c')][_0x1b51('0x2e')]?_0x488c1b[_0x1b51('0x2c')]:_0xab381f[_0x1b51('0x28')];if(_0x12a00f[_0x1b51('0x29')][_0x1b51('0x3e')]){_0x488c1b[_0x1b51('0x39')]=[{'all':!![]}];}_0x488c1b=_[_0x1b51('0x35')]({},_0x488c1b,_0x12a00f[_0x1b51('0x3f')]);return db[_0x1b51('0x38')][_0x1b51('0x40')](_0x488c1b)['then'](handleEntityNotFound(_0x14328f,null))[_0x1b51('0x21')](respondWithResult(_0x14328f,null))[_0x1b51('0x3b')](handleError(_0x14328f,null));};exports[_0x1b51('0x41')]=function(_0x1bf9ba,_0x1a15b3){return db[_0x1b51('0x38')]['create'](_0x1bf9ba[_0x1b51('0x42')],{})[_0x1b51('0x21')](respondWithResult(_0x1a15b3,0xc9))[_0x1b51('0x3b')](handleError(_0x1a15b3,null));};exports[_0x1b51('0x43')]=function(_0x2b9105,_0xcce418){return db['AnalyticFieldReport'][_0x1b51('0x43')](_0x2b9105[_0x1b51('0x42')],{'raw':![],'individualHooks':!![]})[_0x1b51('0x21')](respondWithResult(_0xcce418,0xc9))['catch'](handleError(_0xcce418,null));};exports[_0x1b51('0x44')]=function(_0x122ee3,_0x34a17f){if(_0x122ee3[_0x1b51('0x42')]['id']){delete _0x122ee3[_0x1b51('0x42')]['id'];}return db[_0x1b51('0x38')][_0x1b51('0x40')]({'where':{'id':_0x122ee3[_0x1b51('0x3d')]['id']}})['then'](handleEntityNotFound(_0x34a17f,null))['then'](saveUpdates(_0x122ee3['body'],null))[_0x1b51('0x21')](respondWithResult(_0x34a17f,null))[_0x1b51('0x3b')](handleError(_0x34a17f,null));};exports['destroy']=function(_0x481a9c,_0x56736b){return db[_0x1b51('0x38')][_0x1b51('0x40')]({'where':{'id':_0x481a9c['params']['id']}})[_0x1b51('0x21')](handleEntityNotFound(_0x56736b,null))[_0x1b51('0x21')](removeEntity(_0x56736b,null))[_0x1b51('0x3b')](handleError(_0x56736b,null));};exports['bulkDestroy']=function(_0x18c1ee,_0xdc909){return db[_0x1b51('0x38')][_0x1b51('0x45')]({'where':{'id':_0x18c1ee['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0x1b51('0x21')](respondWithResult(_0xdc909,0xcc))[_0x1b51('0x3b')](handleError(_0xdc909,null));};exports['addFields']=function(_0x2b0d49,_0x18707e,_0xe4b27a){return db[_0x1b51('0x46')][_0x1b51('0x47')]({'where':{'id':_0x2b0d49[_0x1b51('0x3d')]['id']}})['then'](handleEntityNotFound(_0x18707e,null))['then'](function(_0x1b9eab){if(_0x1b9eab){return db[_0x1b51('0x48')][_0x1b51('0x49')](function(_0x373e70){return db[_0x1b51('0x38')]['destroy']({'where':{'CustomReportId':_0x2b0d49['params']['id']},'transaction':_0x373e70})[_0x1b51('0x21')](function(_0x4b8dea){var _0x49ae18=_['map'](_0x2b0d49[_0x1b51('0x42')],function(_0x21d579){delete _0x21d579['id'];_0x21d579[_0x1b51('0x4a')]=_0x2b0d49[_0x1b51('0x3d')]['id'];return _0x21d579;});return db[_0x1b51('0x38')][_0x1b51('0x43')](_0x49ae18,{'transaction':_0x373e70});});})[_0x1b51('0x21')](function(){return db[_0x1b51('0x38')][_0x1b51('0x4b')]({'where':{'CustomReportId':_0x2b0d49[_0x1b51('0x3d')]['id']}});});}})[_0x1b51('0x21')](respondWithResult(_0x18707e,null))[_0x1b51('0x3b')](handleError(_0x18707e,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 8930226..012531b 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 _0x5079=['api','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','../../config/logger'];(function(_0x326723,_0x42580d){var _0x54dcc9=function(_0x28b666){while(--_0x28b666){_0x326723['push'](_0x326723['shift']());}};_0x54dcc9(++_0x42580d);}(_0x5079,0x174));var _0x9507=function(_0x38c699,_0x56fea7){_0x38c699=_0x38c699-0x0;var _0x3b1ded=_0x5079[_0x38c699];return _0x3b1ded;};'use strict';var _=require(_0x9507('0x0'));var util=require('util');var logger=require(_0x9507('0x1'))(_0x9507('0x2'));var moment=require('moment');var BPromise=require(_0x9507('0x3'));var rp=require(_0x9507('0x4'));var fs=require('fs');var path=require(_0x9507('0x5'));var rimraf=require(_0x9507('0x6'));var config=require('../../config/environment');var attributes=require(_0x9507('0x7'));module[_0x9507('0x8')]=function(_0x5b4098,_0x122f8b){return _0x5b4098[_0x9507('0x9')](_0x9507('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23ad=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x23ad,0x13e));var _0xd23a=function(_0x251f43,_0x4cec62){_0x251f43=_0x251f43-0x0;var _0xab1edc=_0x23ad[_0x251f43];return _0xab1edc;};'use strict';var _=require(_0xd23a('0x0'));var util=require(_0xd23a('0x1'));var logger=require(_0xd23a('0x2'))(_0xd23a('0x3'));var moment=require(_0xd23a('0x4'));var BPromise=require(_0xd23a('0x5'));var rp=require(_0xd23a('0x6'));var fs=require('fs');var path=require(_0xd23a('0x7'));var rimraf=require(_0xd23a('0x8'));var config=require(_0xd23a('0x9'));var attributes=require(_0xd23a('0xa'));module[_0xd23a('0xb')]=function(_0x432314,_0xe0aa6f){return _0x432314['define'](_0xd23a('0xc'),attributes,{'tableName':_0xd23a('0xd'),'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 cd7c232..a4101f9 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 _0x0fb3=['lodash','util','moment','bluebird','../../config/utils','../../config/logger','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','stringify','error','message','result','catch'];(function(_0x4fb0eb,_0x4c273e){var _0x17d2b4=function(_0x290b1c){while(--_0x290b1c){_0x4fb0eb['push'](_0x4fb0eb['shift']());}};_0x17d2b4(++_0x4c273e);}(_0x0fb3,0x1b5));var _0x30fb=function(_0x550b4d,_0x283591){_0x550b4d=_0x550b4d-0x0;var _0x1f73c0=_0x0fb3[_0x550b4d];return _0x1f73c0;};'use strict';var _=require(_0x30fb('0x0'));var util=require(_0x30fb('0x1'));var moment=require(_0x30fb('0x2'));var BPromise=require(_0x30fb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x30fb('0x4'));var logger=require(_0x30fb('0x5'))(_0x30fb('0x6'));var config=require(_0x30fb('0x7'));var jayson=require(_0x30fb('0x8'));var client=jayson[_0x30fb('0x9')][_0x30fb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xea25f9,_0x482585,_0x465c8d){return new BPromise(function(_0x169b1d,_0x196483){return client[_0x30fb('0xb')](_0xea25f9,_0x465c8d)[_0x30fb('0xc')](function(_0x2110a1){logger[_0x30fb('0xd')](_0x30fb('0xe'),_0x482585,_0x30fb('0xf'));logger[_0x30fb('0x10')](_0x30fb('0x11'),_0x482585,_0x30fb('0xf'),JSON[_0x30fb('0x12')](_0x2110a1));if(_0x2110a1['error']){if(_0x2110a1[_0x30fb('0x13')]['code']===0x1f4){logger[_0x30fb('0x13')](_0x30fb('0xe'),_0x482585,_0x2110a1[_0x30fb('0x13')]['message']);return _0x196483(_0x2110a1[_0x30fb('0x13')][_0x30fb('0x14')]);}logger[_0x30fb('0x13')](_0x30fb('0xe'),_0x482585,_0x2110a1[_0x30fb('0x13')][_0x30fb('0x14')]);return _0x169b1d(_0x2110a1[_0x30fb('0x13')][_0x30fb('0x14')]);}else{logger['info'](_0x30fb('0xe'),_0x482585,_0x30fb('0xf'));_0x169b1d(_0x2110a1[_0x30fb('0x15')]['message']);}})[_0x30fb('0x16')](function(_0xe1b9bb){logger['error'](_0x30fb('0xe'),_0x482585,_0xe1b9bb);_0x196483(_0xe1b9bb);});});} \ No newline at end of file +var _0x0c54=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','then','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x24026c,_0x1cb315){var _0x30a89e=function(_0x487334){while(--_0x487334){_0x24026c['push'](_0x24026c['shift']());}};_0x30a89e(++_0x1cb315);}(_0x0c54,0x1cc));var _0x40c5=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0x0c54[_0x5eaa0b];return _0x28b295;};'use strict';var _=require(_0x40c5('0x0'));var util=require(_0x40c5('0x1'));var moment=require('moment');var BPromise=require(_0x40c5('0x2'));var rs=require(_0x40c5('0x3'));var fs=require('fs');var Redis=require(_0x40c5('0x4'));var db=require(_0x40c5('0x5'))['db'];var utils=require(_0x40c5('0x6'));var logger=require('../../config/logger')(_0x40c5('0x7'));var config=require(_0x40c5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x40c5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5acbdd,_0x3e2799,_0x39e8cf){return new BPromise(function(_0x4a6021,_0x19bea0){return client['request'](_0x5acbdd,_0x39e8cf)[_0x40c5('0xa')](function(_0x1a73dc){logger[_0x40c5('0xb')](_0x40c5('0xc'),_0x3e2799,'request\x20sent');logger[_0x40c5('0xd')](_0x40c5('0xe'),_0x3e2799,_0x40c5('0xf'),JSON[_0x40c5('0x10')](_0x1a73dc));if(_0x1a73dc[_0x40c5('0x11')]){if(_0x1a73dc[_0x40c5('0x11')][_0x40c5('0x12')]===0x1f4){logger[_0x40c5('0x11')](_0x40c5('0xc'),_0x3e2799,_0x1a73dc[_0x40c5('0x11')][_0x40c5('0x13')]);return _0x19bea0(_0x1a73dc['error'][_0x40c5('0x13')]);}logger[_0x40c5('0x11')](_0x40c5('0xc'),_0x3e2799,_0x1a73dc['error']['message']);return _0x4a6021(_0x1a73dc[_0x40c5('0x11')][_0x40c5('0x13')]);}else{logger[_0x40c5('0xb')](_0x40c5('0xc'),_0x3e2799,'request\x20sent');_0x4a6021(_0x1a73dc[_0x40c5('0x14')][_0x40c5('0x13')]);}})[_0x40c5('0x15')](function(_0x17b6f3){logger['error'](_0x40c5('0xc'),_0x3e2799,_0x17b6f3);_0x19bea0(_0x17b6f3);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index a721b58..a7d6c4d 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 _0xe14b=['addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','/create_many','bulkCreate'];(function(_0x505bd4,_0x4eaf7c){var _0x416478=function(_0x2e0b21){while(--_0x2e0b21){_0x505bd4['push'](_0x505bd4['shift']());}};_0x416478(++_0x4eaf7c);}(_0xe14b,0x93));var _0xbe14=function(_0x44e302,_0x573ee6){_0x44e302=_0x44e302-0x0;var _0x26d46d=_0xe14b[_0x44e302];return _0x26d46d;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xbe14('0x4'));var config=require('../../config/environment');var controller=require('./analyticFieldReport.controller');router[_0xbe14('0x5')]('/',auth[_0xbe14('0x6')](),controller[_0xbe14('0x7')]);router[_0xbe14('0x5')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xbe14('0xa')](_0xbe14('0xb'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xc')]);router['post']('/:id/create_many',auth[_0xbe14('0x6')](),controller[_0xbe14('0xd')]);router['put'](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0xe')]);router[_0xbe14('0xf')](_0xbe14('0x10'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x11')]);router[_0xbe14('0xf')](_0xbe14('0x8'),auth[_0xbe14('0x6')](),controller[_0xbe14('0x12')]);module[_0xbe14('0x13')]=router; \ No newline at end of file +var _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4f7239,_0x317962){var _0x1f1a78=function(_0x504ece){while(--_0x504ece){_0x4f7239['push'](_0x4f7239['shift']());}};_0x1f1a78(++_0x317962);}(_0x814b,0x1a2));var _0xb814=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0x814b[_0x2c96f6];return _0x6d4808;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index edb6496..83cf4d6 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 _0x9861=['STRING','TEXT','sequelize','name'];(function(_0x5b91ee,_0x3ba2f0){var _0x1e5e7d=function(_0xce3742){while(--_0xce3742){_0x5b91ee['push'](_0x5b91ee['shift']());}};_0x1e5e7d(++_0x3ba2f0);}(_0x9861,0x176));var _0x1986=function(_0x3fd515,_0x1eb68f){_0x3fd515=_0x3fd515-0x0;var _0x441a28=_0x9861[_0x3fd515];return _0x441a28;};'use strict';var Sequelize=require(_0x1986('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1986('0x1')},'table':{'type':Sequelize[_0x1986('0x2')]},'metric':{'type':Sequelize[_0x1986('0x3')]},'description':{'type':Sequelize[_0x1986('0x2')]}}; \ No newline at end of file +var _0xff30=['sequelize','exports','STRING','name','TEXT'];(function(_0x1f45a9,_0x42ac06){var _0xcdcf39=function(_0x125c6c){while(--_0x125c6c){_0x1f45a9['push'](_0x1f45a9['shift']());}};_0xcdcf39(++_0x42ac06);}(_0xff30,0x104));var _0x0ff3=function(_0x461e43,_0xc57f71){_0x461e43=_0x461e43-0x0;var _0x52919c=_0xff30[_0x461e43];return _0x52919c;};'use strict';var Sequelize=require(_0x0ff3('0x0'));module[_0x0ff3('0x1')]={'name':{'type':Sequelize[_0x0ff3('0x2')],'allowNull':![],'unique':_0x0ff3('0x3')},'table':{'type':Sequelize[_0x0ff3('0x2')]},'metric':{'type':Sequelize[_0x0ff3('0x4')]},'description':{'type':Sequelize[_0x0ff3('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index a1377b5..3d90714 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 _0xa51b=['include','rows','catch','show','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','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','set','reject','save','update','destroy','Metrics','UserProfileResource','then','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filter','merge','where','VIRTUAL','options','includeAll'];(function(_0xcd24b0,_0x33bfd2){var _0x548db5=function(_0x1fa761){while(--_0x1fa761){_0xcd24b0['push'](_0xcd24b0['shift']());}};_0x548db5(++_0x33bfd2);}(_0xa51b,0x102));var _0xba51=function(_0x39c34f,_0x29679f){_0x39c34f=_0x39c34f-0x0;var _0x237098=_0xa51b[_0x39c34f];return _0x237098;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xba51('0x0'));var rimraf=require(_0xba51('0x1'));var zipdir=require(_0xba51('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba51('0x3'));var BPromise=require(_0xba51('0x4'));var Mustache=require(_0xba51('0x5'));var util=require(_0xba51('0x6'));var path=require(_0xba51('0x7'));var sox=require('sox');var csv=require(_0xba51('0x8'));var ejs=require(_0xba51('0x9'));var fs=require('fs');var _=require(_0xba51('0xa'));var squel=require(_0xba51('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xba51('0xc'));var toCsv=require(_0xba51('0x8'));var querystring=require(_0xba51('0xd'));var Papa=require('papaparse');var Redis=require(_0xba51('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xba51('0xf'));var as=require(_0xba51('0x10'));var hardwareService=require(_0xba51('0x11'));var logger=require(_0xba51('0x12'))(_0xba51('0x13'));var utils=require(_0xba51('0x14'));var config=require(_0xba51('0x15'));var db=require(_0xba51('0x16'))['db'];function respondWithStatusCode(_0xf5cb00,_0x218cc0){_0x218cc0=_0x218cc0||0xcc;return function(_0x129255){if(_0x129255){return _0xf5cb00[_0xba51('0x17')](_0x218cc0);}return _0xf5cb00[_0xba51('0x18')](_0x218cc0)[_0xba51('0x19')]();};}function respondWithResult(_0x1f1e1c,_0x10e06d){_0x10e06d=_0x10e06d||0xc8;return function(_0x1625ab){if(_0x1625ab){return _0x1f1e1c[_0xba51('0x18')](_0x10e06d)[_0xba51('0x1a')](_0x1625ab);}};}function respondWithFilteredResult(_0x2462d4,_0x505a69){return function(_0x3387e2){if(_0x3387e2){var _0x3c06bf=_0x3387e2[_0xba51('0x1b')],_0x2cfd28=_0x505a69[_0xba51('0x1c')],_0x19de86=_0x505a69[_0xba51('0x1c')]+_0x505a69['limit'],_0x11906f;if(_0x19de86>=_0x3c06bf){_0x19de86=_0x3c06bf;_0x11906f=0xc8;}else{_0x11906f=0xce;}_0x2462d4[_0xba51('0x18')](_0x11906f);return _0x2462d4[_0xba51('0x1d')]('Content-Range',_0x2cfd28+'-'+_0x19de86+'/'+_0x3c06bf)['json'](_0x3387e2);}return null;};}function patchUpdates(_0x5e2db6){return function(_0x1b13c4){try{jsonpatch['apply'](_0x1b13c4,_0x5e2db6,!![]);}catch(_0x695e03){return BPromise[_0xba51('0x1e')](_0x695e03);}return _0x1b13c4[_0xba51('0x1f')]();};}function saveUpdates(_0x5abf68,_0x161348){return function(_0x3d46e9){if(_0x3d46e9){return _0x3d46e9[_0xba51('0x20')](_0x5abf68)['then'](function(_0x4a9feb){return _0x4a9feb;});}return null;};}function removeEntity(_0x24df61,_0x49e69f){return function(_0x4e478e){if(_0x4e478e){return _0x4e478e[_0xba51('0x21')]()['then'](function(){var _0x107be0=_0x4e478e['get']({'plain':!![]});var _0x406108=_0xba51('0x22');return db[_0xba51('0x23')]['destroy']({'where':{'type':_0x406108,'resourceId':_0x107be0['id']}})[_0xba51('0x24')](function(){return _0x4e478e;});})[_0xba51('0x24')](function(){_0x24df61[_0xba51('0x18')](0xcc)[_0xba51('0x19')]();});}};}function handleEntityNotFound(_0x36285d,_0x25f809){return function(_0x46a15e){if(!_0x46a15e){_0x36285d['sendStatus'](0x194);}return _0x46a15e;};}function handleError(_0x235447,_0x4050c9){_0x4050c9=_0x4050c9||0x1f4;return function(_0x32f3a4){logger[_0xba51('0x25')](_0x32f3a4[_0xba51('0x26')]);if(_0x32f3a4[_0xba51('0x27')]){delete _0x32f3a4[_0xba51('0x27')];}_0x235447[_0xba51('0x18')](_0x4050c9)[_0xba51('0x28')](_0x32f3a4);};}exports[_0xba51('0x29')]=function(_0x18a3e9,_0x4ce3b1){var _0x50520b={},_0x11734f={},_0x1fb103={'count':0x0,'rows':[]};var _0x82b61d=_['map'](db[_0xba51('0x2a')][_0xba51('0x2b')],function(_0x485066){return{'name':_0x485066[_0xba51('0x2c')],'type':_0x485066[_0xba51('0x2d')][_0xba51('0x2e')]};});_0x11734f[_0xba51('0x2f')]=_[_0xba51('0x30')](_0x82b61d,_0xba51('0x27'));_0x11734f[_0xba51('0x31')]=_['keys'](_0x18a3e9['query']);_0x11734f[_0xba51('0x32')]=_[_0xba51('0x33')](_0x11734f[_0xba51('0x2f')],_0x11734f[_0xba51('0x31')]);_0x50520b[_0xba51('0x34')]=_[_0xba51('0x33')](_0x11734f['model'],qs['fields'](_0x18a3e9[_0xba51('0x31')][_0xba51('0x35')]));_0x50520b[_0xba51('0x34')]=_0x50520b[_0xba51('0x34')][_0xba51('0x36')]?_0x50520b[_0xba51('0x34')]:_0x11734f[_0xba51('0x2f')];if(!_0x18a3e9[_0xba51('0x31')][_0xba51('0x37')](_0xba51('0x38'))){_0x50520b[_0xba51('0x39')]=qs[_0xba51('0x39')](_0x18a3e9[_0xba51('0x31')][_0xba51('0x39')]);_0x50520b['offset']=qs['offset'](_0x18a3e9[_0xba51('0x31')][_0xba51('0x1c')]);}_0x50520b[_0xba51('0x3a')]=qs[_0xba51('0x3b')](_0x18a3e9['query'][_0xba51('0x3b')]);_0x50520b['where']=qs['filters'](_['pick'](_0x18a3e9[_0xba51('0x31')],_0x11734f[_0xba51('0x32')]));if(_0x18a3e9[_0xba51('0x31')][_0xba51('0x3c')]){_0x50520b['where']=_[_0xba51('0x3d')](_0x50520b[_0xba51('0x3e')],{'$or':_[_0xba51('0x30')](_0x82b61d,function(_0x155c40){if(_0x155c40[_0xba51('0x2d')]!==_0xba51('0x3f')){var _0x5102ea={};_0x5102ea[_0x155c40[_0xba51('0x27')]]={'$like':'%'+_0x18a3e9[_0xba51('0x31')][_0xba51('0x3c')]+'%'};return _0x5102ea;}})});}_0x50520b=_[_0xba51('0x3d')]({},_0x50520b,_0x18a3e9[_0xba51('0x40')]);var _0x15eccb={'where':_0x50520b[_0xba51('0x3e')]};return db[_0xba51('0x2a')][_0xba51('0x1b')](_0x15eccb)['then'](function(_0x4012d7){_0x1fb103['count']=_0x4012d7;if(_0x18a3e9[_0xba51('0x31')][_0xba51('0x41')]){_0x50520b[_0xba51('0x42')]=[{'all':!![]}];}return db[_0xba51('0x2a')]['findAll'](_0x50520b);})[_0xba51('0x24')](function(_0x525967){_0x1fb103[_0xba51('0x43')]=_0x525967;return _0x1fb103;})[_0xba51('0x24')](respondWithFilteredResult(_0x4ce3b1,_0x50520b))[_0xba51('0x44')](handleError(_0x4ce3b1,null));};exports[_0xba51('0x45')]=function(_0x3a65fd,_0x1dc17c){var _0x3e350b={'raw':!![],'where':{'id':_0x3a65fd['params']['id']}},_0xe6d96b={};_0xe6d96b[_0xba51('0x2f')]=_[_0xba51('0x46')](db[_0xba51('0x2a')][_0xba51('0x2b')]);_0xe6d96b[_0xba51('0x31')]=_[_0xba51('0x46')](_0x3a65fd[_0xba51('0x31')]);_0xe6d96b[_0xba51('0x32')]=_[_0xba51('0x33')](_0xe6d96b[_0xba51('0x2f')],_0xe6d96b[_0xba51('0x31')]);_0x3e350b[_0xba51('0x34')]=_[_0xba51('0x33')](_0xe6d96b[_0xba51('0x2f')],qs['fields'](_0x3a65fd[_0xba51('0x31')][_0xba51('0x35')]));_0x3e350b[_0xba51('0x34')]=_0x3e350b[_0xba51('0x34')][_0xba51('0x36')]?_0x3e350b[_0xba51('0x34')]:_0xe6d96b[_0xba51('0x2f')];if(_0x3a65fd[_0xba51('0x31')][_0xba51('0x41')]){_0x3e350b[_0xba51('0x42')]=[{'all':!![]}];}_0x3e350b=_[_0xba51('0x3d')]({},_0x3e350b,_0x3a65fd['options']);return db[_0xba51('0x2a')][_0xba51('0x47')](_0x3e350b)['then'](handleEntityNotFound(_0x1dc17c,null))['then'](respondWithResult(_0x1dc17c,null))[_0xba51('0x44')](handleError(_0x1dc17c,null));};exports[_0xba51('0x48')]=function(_0x591b4b,_0x5c029d){return db[_0xba51('0x2a')][_0xba51('0x48')](_0x591b4b['body'],{})[_0xba51('0x24')](function(_0x42829c){var _0x388aa4=_0x591b4b[_0xba51('0x49')][_0xba51('0x4a')]({'plain':!![]});if(!_0x388aa4)throw new Error(_0xba51('0x4b'));if(_0x388aa4['role']===_0xba51('0x49')){var _0x17ea3f=_0x42829c[_0xba51('0x4a')]({'plain':!![]});var _0x4b796e='Metrics';return db[_0xba51('0x4c')]['find']({'where':{'name':_0x4b796e,'userProfileId':_0x388aa4[_0xba51('0x4d')]},'raw':!![]})[_0xba51('0x24')](function(_0x11b7a3){if(_0x11b7a3&&_0x11b7a3[_0xba51('0x4e')]===0x0){return db[_0xba51('0x23')][_0xba51('0x48')]({'name':_0x17ea3f[_0xba51('0x27')],'resourceId':_0x17ea3f['id'],'type':_0x11b7a3['name'],'sectionId':_0x11b7a3['id']},{})[_0xba51('0x24')](function(){return _0x42829c;});}else{return _0x42829c;}})[_0xba51('0x44')](function(_0x4d44f5){logger[_0xba51('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d44f5);throw _0x4d44f5;});}return _0x42829c;})['then'](respondWithResult(_0x5c029d,0xc9))[_0xba51('0x44')](handleError(_0x5c029d,null));};exports[_0xba51('0x20')]=function(_0x35f528,_0x277b96){if(_0x35f528['body']['id']){delete _0x35f528[_0xba51('0x4f')]['id'];}return db[_0xba51('0x2a')][_0xba51('0x47')]({'where':{'id':_0x35f528[_0xba51('0x50')]['id']}})[_0xba51('0x24')](handleEntityNotFound(_0x277b96,null))[_0xba51('0x24')](saveUpdates(_0x35f528[_0xba51('0x4f')],null))[_0xba51('0x24')](respondWithResult(_0x277b96,null))[_0xba51('0x44')](handleError(_0x277b96,null));};exports[_0xba51('0x21')]=function(_0x37b9ec,_0x6747a3){return db[_0xba51('0x2a')][_0xba51('0x47')]({'where':{'id':_0x37b9ec[_0xba51('0x50')]['id']}})[_0xba51('0x24')](handleEntityNotFound(_0x6747a3,null))['then'](removeEntity(_0x6747a3,null))[_0xba51('0x44')](handleError(_0x6747a3,null));}; \ No newline at end of file +var _0xb49f=['map','AnalyticMetric','rawAttributes','type','query','filters','attributes','intersection','model','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','options','includeAll','findAll','rows','show','params','keys','length','include','merge','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','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','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','apply','save','update','then','destroy','get','Metrics','error','stack','name','send'];(function(_0x20c5f8,_0xea1b44){var _0x34fde0=function(_0x364b98){while(--_0x364b98){_0x20c5f8['push'](_0x20c5f8['shift']());}};_0x34fde0(++_0xea1b44);}(_0xb49f,0x75));var _0xfb49=function(_0x49ecf7,_0x5a6d71){_0x49ecf7=_0x49ecf7-0x0;var _0x217540=_0xb49f[_0x49ecf7];return _0x217540;};'use strict';var pdf=require(_0xfb49('0x0'));var emlformat=require(_0xfb49('0x1'));var rimraf=require(_0xfb49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb49('0x3'));var rp=require(_0xfb49('0x4'));var moment=require(_0xfb49('0x5'));var BPromise=require(_0xfb49('0x6'));var Mustache=require(_0xfb49('0x7'));var util=require(_0xfb49('0x8'));var path=require('path');var sox=require(_0xfb49('0x9'));var csv=require('to-csv');var ejs=require(_0xfb49('0xa'));var fs=require('fs');var _=require(_0xfb49('0xb'));var squel=require(_0xfb49('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfb49('0xd'));var toCsv=require(_0xfb49('0xe'));var querystring=require('querystring');var Papa=require(_0xfb49('0xf'));var Redis=require(_0xfb49('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xfb49('0x11'));var as=require(_0xfb49('0x12'));var hardwareService=require(_0xfb49('0x13'));var logger=require(_0xfb49('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xfb49('0x15'))['db'];function respondWithStatusCode(_0x399689,_0x4913dc){_0x4913dc=_0x4913dc||0xcc;return function(_0x121724){if(_0x121724){return _0x399689[_0xfb49('0x16')](_0x4913dc);}return _0x399689[_0xfb49('0x17')](_0x4913dc)[_0xfb49('0x18')]();};}function respondWithResult(_0x2fedf8,_0x1aaa73){_0x1aaa73=_0x1aaa73||0xc8;return function(_0x23b52d){if(_0x23b52d){return _0x2fedf8['status'](_0x1aaa73)['json'](_0x23b52d);}};}function respondWithFilteredResult(_0x45c4e9,_0x1b71a8){return function(_0x135f55){if(_0x135f55){var _0x6ed728=_0x135f55[_0xfb49('0x19')],_0x526cbf=_0x1b71a8['offset'],_0x106645=_0x1b71a8['offset']+_0x1b71a8[_0xfb49('0x1a')],_0x1a0cab;if(_0x106645>=_0x6ed728){_0x106645=_0x6ed728;_0x1a0cab=0xc8;}else{_0x1a0cab=0xce;}_0x45c4e9[_0xfb49('0x17')](_0x1a0cab);return _0x45c4e9[_0xfb49('0x1b')](_0xfb49('0x1c'),_0x526cbf+'-'+_0x106645+'/'+_0x6ed728)[_0xfb49('0x1d')](_0x135f55);}return null;};}function patchUpdates(_0xc2b91a){return function(_0x4c7280){try{jsonpatch[_0xfb49('0x1e')](_0x4c7280,_0xc2b91a,!![]);}catch(_0x44d962){return BPromise['reject'](_0x44d962);}return _0x4c7280[_0xfb49('0x1f')]();};}function saveUpdates(_0x11c335,_0x2d7cf2){return function(_0x55a1b2){if(_0x55a1b2){return _0x55a1b2[_0xfb49('0x20')](_0x11c335)[_0xfb49('0x21')](function(_0x5d9848){return _0x5d9848;});}return null;};}function removeEntity(_0x40fa6b,_0x38a051){return function(_0x402b9d){if(_0x402b9d){return _0x402b9d[_0xfb49('0x22')]()['then'](function(){var _0x247a16=_0x402b9d[_0xfb49('0x23')]({'plain':!![]});var _0xdc2870=_0xfb49('0x24');return db['UserProfileResource'][_0xfb49('0x22')]({'where':{'type':_0xdc2870,'resourceId':_0x247a16['id']}})['then'](function(){return _0x402b9d;});})[_0xfb49('0x21')](function(){_0x40fa6b['status'](0xcc)[_0xfb49('0x18')]();});}};}function handleEntityNotFound(_0x2faabc,_0x3866ad){return function(_0x3dca70){if(!_0x3dca70){_0x2faabc['sendStatus'](0x194);}return _0x3dca70;};}function handleError(_0x575d51,_0x32fadd){_0x32fadd=_0x32fadd||0x1f4;return function(_0x40a136){logger[_0xfb49('0x25')](_0x40a136[_0xfb49('0x26')]);if(_0x40a136[_0xfb49('0x27')]){delete _0x40a136['name'];}_0x575d51[_0xfb49('0x17')](_0x32fadd)[_0xfb49('0x28')](_0x40a136);};}exports['index']=function(_0xa20643,_0x42e6fb){var _0x17c7b5={},_0x48a8e3={},_0xb3bd9b={'count':0x0,'rows':[]};var _0x1b5979=_[_0xfb49('0x29')](db[_0xfb49('0x2a')][_0xfb49('0x2b')],function(_0x50b4fa){return{'name':_0x50b4fa['fieldName'],'type':_0x50b4fa[_0xfb49('0x2c')]['key']};});_0x48a8e3['model']=_[_0xfb49('0x29')](_0x1b5979,'name');_0x48a8e3[_0xfb49('0x2d')]=_['keys'](_0xa20643['query']);_0x48a8e3[_0xfb49('0x2e')]=_['intersection'](_0x48a8e3['model'],_0x48a8e3[_0xfb49('0x2d')]);_0x17c7b5[_0xfb49('0x2f')]=_[_0xfb49('0x30')](_0x48a8e3[_0xfb49('0x31')],qs[_0xfb49('0x32')](_0xa20643[_0xfb49('0x2d')]['fields']));_0x17c7b5['attributes']=_0x17c7b5['attributes']['length']?_0x17c7b5[_0xfb49('0x2f')]:_0x48a8e3['model'];if(!_0xa20643[_0xfb49('0x2d')][_0xfb49('0x33')](_0xfb49('0x34'))){_0x17c7b5[_0xfb49('0x1a')]=qs['limit'](_0xa20643['query']['limit']);_0x17c7b5[_0xfb49('0x35')]=qs['offset'](_0xa20643[_0xfb49('0x2d')]['offset']);}_0x17c7b5[_0xfb49('0x36')]=qs[_0xfb49('0x37')](_0xa20643['query'][_0xfb49('0x37')]);_0x17c7b5['where']=qs[_0xfb49('0x2e')](_[_0xfb49('0x38')](_0xa20643[_0xfb49('0x2d')],_0x48a8e3[_0xfb49('0x2e')]));if(_0xa20643['query'][_0xfb49('0x39')]){_0x17c7b5[_0xfb49('0x3a')]=_['merge'](_0x17c7b5['where'],{'$or':_[_0xfb49('0x29')](_0x1b5979,function(_0xecb577){if(_0xecb577[_0xfb49('0x2c')]!=='VIRTUAL'){var _0xea8c26={};_0xea8c26[_0xecb577['name']]={'$like':'%'+_0xa20643[_0xfb49('0x2d')][_0xfb49('0x39')]+'%'};return _0xea8c26;}})});}_0x17c7b5=_['merge']({},_0x17c7b5,_0xa20643[_0xfb49('0x3b')]);var _0x17fa21={'where':_0x17c7b5[_0xfb49('0x3a')]};return db[_0xfb49('0x2a')][_0xfb49('0x19')](_0x17fa21)[_0xfb49('0x21')](function(_0x48473a){_0xb3bd9b['count']=_0x48473a;if(_0xa20643[_0xfb49('0x2d')][_0xfb49('0x3c')]){_0x17c7b5['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xfb49('0x3d')](_0x17c7b5);})[_0xfb49('0x21')](function(_0x286efd){_0xb3bd9b[_0xfb49('0x3e')]=_0x286efd;return _0xb3bd9b;})[_0xfb49('0x21')](respondWithFilteredResult(_0x42e6fb,_0x17c7b5))['catch'](handleError(_0x42e6fb,null));};exports[_0xfb49('0x3f')]=function(_0x22381d,_0x24b917){var _0x1b14cd={'raw':!![],'where':{'id':_0x22381d[_0xfb49('0x40')]['id']}},_0x46eaf6={};_0x46eaf6[_0xfb49('0x31')]=_[_0xfb49('0x41')](db['AnalyticMetric'][_0xfb49('0x2b')]);_0x46eaf6[_0xfb49('0x2d')]=_[_0xfb49('0x41')](_0x22381d[_0xfb49('0x2d')]);_0x46eaf6['filters']=_[_0xfb49('0x30')](_0x46eaf6[_0xfb49('0x31')],_0x46eaf6[_0xfb49('0x2d')]);_0x1b14cd[_0xfb49('0x2f')]=_[_0xfb49('0x30')](_0x46eaf6[_0xfb49('0x31')],qs[_0xfb49('0x32')](_0x22381d['query'][_0xfb49('0x32')]));_0x1b14cd[_0xfb49('0x2f')]=_0x1b14cd[_0xfb49('0x2f')][_0xfb49('0x42')]?_0x1b14cd[_0xfb49('0x2f')]:_0x46eaf6[_0xfb49('0x31')];if(_0x22381d[_0xfb49('0x2d')][_0xfb49('0x3c')]){_0x1b14cd[_0xfb49('0x43')]=[{'all':!![]}];}_0x1b14cd=_[_0xfb49('0x44')]({},_0x1b14cd,_0x22381d[_0xfb49('0x3b')]);return db[_0xfb49('0x2a')][_0xfb49('0x45')](_0x1b14cd)['then'](handleEntityNotFound(_0x24b917,null))['then'](respondWithResult(_0x24b917,null))[_0xfb49('0x46')](handleError(_0x24b917,null));};exports[_0xfb49('0x47')]=function(_0x55b211,_0x2a21af){return db[_0xfb49('0x2a')][_0xfb49('0x47')](_0x55b211[_0xfb49('0x48')],{})[_0xfb49('0x21')](function(_0x2da3d0){var _0x2a3ad4=_0x55b211['user'][_0xfb49('0x23')]({'plain':!![]});if(!_0x2a3ad4)throw new Error(_0xfb49('0x49'));if(_0x2a3ad4[_0xfb49('0x4a')]===_0xfb49('0x4b')){var _0x2eabb9=_0x2da3d0[_0xfb49('0x23')]({'plain':!![]});var _0x288424=_0xfb49('0x24');return db[_0xfb49('0x4c')][_0xfb49('0x45')]({'where':{'name':_0x288424,'userProfileId':_0x2a3ad4['userProfileId']},'raw':!![]})[_0xfb49('0x21')](function(_0x263b21){if(_0x263b21&&_0x263b21['autoAssociation']===0x0){return db[_0xfb49('0x4d')][_0xfb49('0x47')]({'name':_0x2eabb9[_0xfb49('0x27')],'resourceId':_0x2eabb9['id'],'type':_0x263b21[_0xfb49('0x27')],'sectionId':_0x263b21['id']},{})[_0xfb49('0x21')](function(){return _0x2da3d0;});}else{return _0x2da3d0;}})[_0xfb49('0x46')](function(_0x186109){logger[_0xfb49('0x25')](_0xfb49('0x4e'),_0x186109);throw _0x186109;});}return _0x2da3d0;})[_0xfb49('0x21')](respondWithResult(_0x2a21af,0xc9))[_0xfb49('0x46')](handleError(_0x2a21af,null));};exports[_0xfb49('0x20')]=function(_0x49d81e,_0x3af9be){if(_0x49d81e[_0xfb49('0x48')]['id']){delete _0x49d81e[_0xfb49('0x48')]['id'];}return db[_0xfb49('0x2a')][_0xfb49('0x45')]({'where':{'id':_0x49d81e[_0xfb49('0x40')]['id']}})[_0xfb49('0x21')](handleEntityNotFound(_0x3af9be,null))['then'](saveUpdates(_0x49d81e[_0xfb49('0x48')],null))[_0xfb49('0x21')](respondWithResult(_0x3af9be,null))['catch'](handleError(_0x3af9be,null));};exports[_0xfb49('0x22')]=function(_0x4cd477,_0x201209){return db[_0xfb49('0x2a')][_0xfb49('0x45')]({'where':{'id':_0x4cd477[_0xfb49('0x40')]['id']}})[_0xfb49('0x21')](handleEntityNotFound(_0x201209,null))[_0xfb49('0x21')](removeEntity(_0x201209,null))[_0xfb49('0x46')](handleError(_0x201209,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 0de1cd0..772e82d 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 _0x1e4b=['api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','lodash','util'];(function(_0x4cbfc1,_0x212705){var _0x4260f8=function(_0x255cef){while(--_0x255cef){_0x4cbfc1['push'](_0x4cbfc1['shift']());}};_0x4260f8(++_0x212705);}(_0x1e4b,0x82));var _0xb1e4=function(_0x181f8f,_0x2775d6){_0x181f8f=_0x181f8f-0x0;var _0x5b3bea=_0x1e4b[_0x181f8f];return _0x5b3bea;};'use strict';var _=require(_0xb1e4('0x0'));var util=require(_0xb1e4('0x1'));var logger=require('../../config/logger')(_0xb1e4('0x2'));var moment=require('moment');var BPromise=require(_0xb1e4('0x3'));var rp=require(_0xb1e4('0x4'));var fs=require('fs');var path=require(_0xb1e4('0x5'));var rimraf=require(_0xb1e4('0x6'));var config=require(_0xb1e4('0x7'));var attributes=require(_0xb1e4('0x8'));module[_0xb1e4('0x9')]=function(_0x49ed29,_0x1ff3ad){return _0x49ed29['define'](_0xb1e4('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa4ff=['exports','define','AnalyticMetric','lodash','../../config/logger','bluebird','request-promise','../../config/environment','./analyticMetric.attributes'];(function(_0x80bed5,_0x49f0d0){var _0x12e325=function(_0x6937e3){while(--_0x6937e3){_0x80bed5['push'](_0x80bed5['shift']());}};_0x12e325(++_0x49f0d0);}(_0xa4ff,0xa5));var _0xfa4f=function(_0x11a0a0,_0x4e8dcb){_0x11a0a0=_0x11a0a0-0x0;var _0x57d04f=_0xa4ff[_0x11a0a0];return _0x57d04f;};'use strict';var _=require(_0xfa4f('0x0'));var util=require('util');var logger=require(_0xfa4f('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfa4f('0x2'));var rp=require(_0xfa4f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfa4f('0x4'));var attributes=require(_0xfa4f('0x5'));module[_0xfa4f('0x6')]=function(_0x2b10d4,_0x23d930){return _0x2b10d4[_0xfa4f('0x7')](_0xfa4f('0x8'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 286db71..fc9a4d9 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 _0xdb10=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x3df20b,_0x591d64){var _0x11c63b=function(_0x180845){while(--_0x180845){_0x3df20b['push'](_0x3df20b['shift']());}};_0x11c63b(++_0x591d64);}(_0xdb10,0x164));var _0x0db1=function(_0x59bcb1,_0x5a4b6c){_0x59bcb1=_0x59bcb1-0x0;var _0x4a737f=_0xdb10[_0x59bcb1];return _0x4a737f;};'use strict';var _=require(_0x0db1('0x0'));var util=require(_0x0db1('0x1'));var moment=require(_0x0db1('0x2'));var BPromise=require(_0x0db1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0db1('0x4'))['db'];var utils=require(_0x0db1('0x5'));var logger=require(_0x0db1('0x6'))(_0x0db1('0x7'));var config=require(_0x0db1('0x8'));var jayson=require(_0x0db1('0x9'));var client=jayson[_0x0db1('0xa')][_0x0db1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e3b67,_0x15111a,_0x2b1024){return new BPromise(function(_0x2e10a0,_0x397425){return client[_0x0db1('0xc')](_0x4e3b67,_0x2b1024)[_0x0db1('0xd')](function(_0x386849){logger[_0x0db1('0xe')](_0x0db1('0xf'),_0x15111a,_0x0db1('0x10'));logger[_0x0db1('0x11')](_0x0db1('0x12'),_0x15111a,_0x0db1('0x10'),JSON[_0x0db1('0x13')](_0x386849));if(_0x386849['error']){if(_0x386849[_0x0db1('0x14')][_0x0db1('0x15')]===0x1f4){logger[_0x0db1('0x14')](_0x0db1('0xf'),_0x15111a,_0x386849['error'][_0x0db1('0x16')]);return _0x397425(_0x386849[_0x0db1('0x14')]['message']);}logger[_0x0db1('0x14')](_0x0db1('0xf'),_0x15111a,_0x386849[_0x0db1('0x14')]['message']);return _0x2e10a0(_0x386849[_0x0db1('0x14')]['message']);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x15111a,'request\x20sent');_0x2e10a0(_0x386849[_0x0db1('0x17')][_0x0db1('0x16')]);}})[_0x0db1('0x18')](function(_0x391ff2){logger[_0x0db1('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x15111a,_0x391ff2);_0x397425(_0x391ff2);});});} \ No newline at end of file +var _0x6904=['AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info'];(function(_0x44b3f6,_0x2f0b79){var _0x4a6207=function(_0x5835fb){while(--_0x5835fb){_0x44b3f6['push'](_0x44b3f6['shift']());}};_0x4a6207(++_0x2f0b79);}(_0x6904,0x15d));var _0x4690=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x6904[_0x2f71f6];return _0x2b23ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4690('0x0'));var BPromise=require(_0x4690('0x1'));var rs=require(_0x4690('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4690('0x3'))['db'];var utils=require(_0x4690('0x4'));var logger=require(_0x4690('0x5'))('rpc');var config=require(_0x4690('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4690('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x28eea2,_0x3ef5e8,_0x4be107){return new BPromise(function(_0x47c234,_0x564fe5){return client[_0x4690('0x8')](_0x28eea2,_0x4be107)[_0x4690('0x9')](function(_0x21bf06){logger[_0x4690('0xa')](_0x4690('0xb'),_0x3ef5e8,'request\x20sent');logger[_0x4690('0xc')](_0x4690('0xd'),_0x3ef5e8,_0x4690('0xe'),JSON[_0x4690('0xf')](_0x21bf06));if(_0x21bf06[_0x4690('0x10')]){if(_0x21bf06[_0x4690('0x10')][_0x4690('0x11')]===0x1f4){logger[_0x4690('0x10')](_0x4690('0xb'),_0x3ef5e8,_0x21bf06['error'][_0x4690('0x12')]);return _0x564fe5(_0x21bf06['error'][_0x4690('0x12')]);}logger[_0x4690('0x10')](_0x4690('0xb'),_0x3ef5e8,_0x21bf06['error'][_0x4690('0x12')]);return _0x47c234(_0x21bf06['error'][_0x4690('0x12')]);}else{logger['info'](_0x4690('0xb'),_0x3ef5e8,_0x4690('0xe'));_0x47c234(_0x21bf06['result'][_0x4690('0x12')]);}})[_0x4690('0x13')](function(_0x3e5d69){logger[_0x4690('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x3ef5e8,_0x3e5d69);_0x564fe5(_0x3e5d69);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 3ac24d3..9bdab8a 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 _0x2ef3=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x49fb18,_0x3f22b8){var _0x217172=function(_0x17c866){while(--_0x17c866){_0x49fb18['push'](_0x49fb18['shift']());}};_0x217172(++_0x3f22b8);}(_0x2ef3,0xba));var _0x32ef=function(_0x34fb2b,_0x584763){_0x34fb2b=_0x34fb2b-0x0;var _0x1e8a59=_0x2ef3[_0x34fb2b];return _0x1e8a59;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var controller=require('./analyticMetric.controller');router[_0x32ef('0x8')]('/',auth[_0x32ef('0x9')](),controller['index']);router['get'](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xb')]);router[_0x32ef('0xc')]('/',auth[_0x32ef('0x9')](),controller[_0x32ef('0xd')]);router[_0x32ef('0xe')](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xf')]);router['delete']('/:id',auth[_0x32ef('0x9')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file +var _0x1967=['get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x565c79,_0x13391b){var _0x492b07=function(_0x1398bc){while(--_0x1398bc){_0x565c79['push'](_0x565c79['shift']());}};_0x492b07(++_0x13391b);}(_0x1967,0x173));var _0x7196=function(_0x33c69b,_0x39d9f2){_0x33c69b=_0x33c69b-0x0;var _0x1794de=_0x1967[_0x33c69b];return _0x1794de;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var auth=require(_0x7196('0x5'));var interaction=require(_0x7196('0x6'));var config=require(_0x7196('0x7'));var controller=require(_0x7196('0x8'));router[_0x7196('0x9')]('/',auth['isAuthenticated'](),controller[_0x7196('0xa')]);router[_0x7196('0x9')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0xd')]);router[_0x7196('0xe')]('/',auth['isAuthenticated'](),controller[_0x7196('0xf')]);router[_0x7196('0x10')](_0x7196('0xb'),auth[_0x7196('0xc')](),controller[_0x7196('0x11')]);router['delete']('/:id',auth[_0x7196('0xc')](),controller[_0x7196('0x12')]);module[_0x7196('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 216835a..4f4213f 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 _0x3e31=['sequelize'];(function(_0x297805,_0x1b3d4d){var _0x435776=function(_0x4d0f9f){while(--_0x4d0f9f){_0x297805['push'](_0x297805['shift']());}};_0x435776(++_0x1b3d4d);}(_0x3e31,0x8c));var _0x13e3=function(_0x45eb65,_0x2df6ef){_0x45eb65=_0x45eb65-0x0;var _0x2e707c=_0x3e31[_0x45eb65];return _0x2e707c;};'use strict';var Sequelize=require(_0x13e3('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x5fcf=['TEXT','sequelize'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x5fcf,0x1d1));var _0xf5fc=function(_0x2e47b8,_0x4d86c0){_0x2e47b8=_0x2e47b8-0x0;var _0xf66803=_0x5fcf[_0x2e47b8];return _0xf66803;};'use strict';var Sequelize=require(_0xf5fc('0x0'));module['exports']={'tree':{'type':Sequelize[_0xf5fc('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index b1b0ad8..62fe947 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 _0x0713=['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','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','findAll','catch','show','params','includeAll','include','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x3dfea0,_0x434790){var _0x8aa8c6=function(_0x554744){while(--_0x554744){_0x3dfea0['push'](_0x3dfea0['shift']());}};_0x8aa8c6(++_0x434790);}(_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={},_0x163604={},_0x950fde={'count':0x0,'rows':[]};var _0x3fa3b8=_[_0x3071('0x2d')](db[_0x3071('0x2e')][_0x3071('0x2f')],function(_0x32f1b4){return{'name':_0x32f1b4[_0x3071('0x30')],'type':_0x32f1b4[_0x3071('0x31')]['key']};});_0x163604['model']=_[_0x3071('0x2d')](_0x3fa3b8,_0x3071('0x2a'));_0x163604[_0x3071('0x32')]=_[_0x3071('0x33')](_0x4d5c4b[_0x3071('0x32')]);_0x163604[_0x3071('0x34')]=_[_0x3071('0x35')](_0x163604[_0x3071('0x36')],_0x163604['query']);_0x28792d['attributes']=_['intersection'](_0x163604[_0x3071('0x36')],qs[_0x3071('0x37')](_0x4d5c4b['query'][_0x3071('0x37')]));_0x28792d[_0x3071('0x38')]=_0x28792d[_0x3071('0x38')][_0x3071('0x39')]?_0x28792d['attributes']:_0x163604[_0x3071('0x36')];if(!_0x4d5c4b[_0x3071('0x32')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x28792d[_0x3071('0x1f')]=qs[_0x3071('0x1f')](_0x4d5c4b[_0x3071('0x32')][_0x3071('0x1f')]);_0x28792d['offset']=qs[_0x3071('0x1e')](_0x4d5c4b['query']['offset']);}_0x28792d[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x4d5c4b['query'][_0x3071('0x3d')]);_0x28792d[_0x3071('0x3e')]=qs[_0x3071('0x34')](_[_0x3071('0x3f')](_0x4d5c4b[_0x3071('0x32')],_0x163604[_0x3071('0x34')]));if(_0x4d5c4b['query'][_0x3071('0x40')]){_0x28792d[_0x3071('0x3e')]=_['merge'](_0x28792d[_0x3071('0x3e')],{'$or':_['map'](_0x3fa3b8,function(_0x28f855){if(_0x28f855[_0x3071('0x31')]!=='VIRTUAL'){var _0x593c99={};_0x593c99[_0x28f855[_0x3071('0x2a')]]={'$like':'%'+_0x4d5c4b[_0x3071('0x32')][_0x3071('0x40')]+'%'};return _0x593c99;}})});}_0x28792d=_['merge']({},_0x28792d,_0x4d5c4b[_0x3071('0x41')]);var _0x534a77={'where':_0x28792d[_0x3071('0x3e')]};return db['AnalyticTreeReport'][_0x3071('0x1d')](_0x534a77)[_0x3071('0x26')](function(_0x1fcc52){_0x950fde[_0x3071('0x1d')]=_0x1fcc52;if(_0x4d5c4b[_0x3071('0x32')]['includeAll']){_0x28792d['include']=[{'all':!![]}];}return db[_0x3071('0x2e')][_0x3071('0x42')](_0x28792d);})[_0x3071('0x26')](function(_0x1f69a6){_0x950fde['rows']=_0x1f69a6;return _0x950fde;})[_0x3071('0x26')](respondWithFilteredResult(_0x4fb1ca,_0x28792d))[_0x3071('0x43')](handleError(_0x4fb1ca,null));};exports[_0x3071('0x44')]=function(_0x25c29f,_0x277104){var _0xb9a4b8={'raw':!![],'where':{'id':_0x25c29f[_0x3071('0x45')]['id']}},_0x56a9d8={};_0x56a9d8['model']=_['keys'](db['AnalyticTreeReport']['rawAttributes']);_0x56a9d8[_0x3071('0x32')]=_[_0x3071('0x33')](_0x25c29f[_0x3071('0x32')]);_0x56a9d8[_0x3071('0x34')]=_[_0x3071('0x35')](_0x56a9d8[_0x3071('0x36')],_0x56a9d8[_0x3071('0x32')]);_0xb9a4b8[_0x3071('0x38')]=_['intersection'](_0x56a9d8[_0x3071('0x36')],qs[_0x3071('0x37')](_0x25c29f[_0x3071('0x32')][_0x3071('0x37')]));_0xb9a4b8[_0x3071('0x38')]=_0xb9a4b8['attributes']['length']?_0xb9a4b8[_0x3071('0x38')]:_0x56a9d8[_0x3071('0x36')];if(_0x25c29f[_0x3071('0x32')][_0x3071('0x46')]){_0xb9a4b8[_0x3071('0x47')]=[{'all':!![]}];}_0xb9a4b8=_['merge']({},_0xb9a4b8,_0x25c29f[_0x3071('0x41')]);return db['AnalyticTreeReport'][_0x3071('0x48')](_0xb9a4b8)['then'](handleEntityNotFound(_0x277104,null))['then'](respondWithResult(_0x277104,null))[_0x3071('0x43')](handleError(_0x277104,null));};exports['create']=function(_0x1862ea,_0x5a0a69){return db[_0x3071('0x2e')][_0x3071('0x49')](_0x1862ea[_0x3071('0x4a')],{})[_0x3071('0x26')](respondWithResult(_0x5a0a69,0xc9))['catch'](handleError(_0x5a0a69,null));};exports[_0x3071('0x4b')]=function(_0x575c12,_0xd273ec){if(_0x575c12['body']['id']){delete _0x575c12[_0x3071('0x4a')]['id'];}return db[_0x3071('0x2e')]['find']({'where':{'id':_0x575c12[_0x3071('0x45')]['id']}})[_0x3071('0x26')](handleEntityNotFound(_0xd273ec,null))[_0x3071('0x26')](saveUpdates(_0x575c12[_0x3071('0x4a')],null))[_0x3071('0x26')](respondWithResult(_0xd273ec,null))[_0x3071('0x43')](handleError(_0xd273ec,null));};exports[_0x3071('0x27')]=function(_0x577060,_0x2c6e4c){return db[_0x3071('0x2e')][_0x3071('0x48')]({'where':{'id':_0x577060[_0x3071('0x45')]['id']}})['then'](handleEntityNotFound(_0x2c6e4c,null))[_0x3071('0x26')](removeEntity(_0x2c6e4c,null))[_0x3071('0x43')](handleError(_0x2c6e4c,null));}; \ No newline at end of file +var _0xb10b=['where','merge','AnalyticTreeReport','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(_0x5201c9,_0xea0b21){var _0x3de224=function(_0x18bd6e){while(--_0x18bd6e){_0x5201c9['push'](_0x5201c9['shift']());}};_0x3de224(++_0xea0b21);}(_0xb10b,0x12a));var _0xbb10=function(_0x132b71,_0x25f23e){_0x132b71=_0x132b71-0x0;var _0x224664=_0xb10b[_0x132b71];return _0x224664;};'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['AnalyticTreeReport'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]));if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));};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/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index d9efab2..90ce45c 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 _0x6afc=['lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x1b3ef5,_0x130efc){var _0x3078a1=function(_0x1f41ff){while(--_0x1f41ff){_0x1b3ef5['push'](_0x1b3ef5['shift']());}};_0x3078a1(++_0x130efc);}(_0x6afc,0x16b));var _0xc6af=function(_0x39f615,_0xf7942b){_0x39f615=_0x39f615-0x0;var _0x34d59b=_0x6afc[_0x39f615];return _0x34d59b;};'use strict';var _=require(_0xc6af('0x0'));var util=require('util');var logger=require(_0xc6af('0x1'))('api');var moment=require(_0xc6af('0x2'));var BPromise=require(_0xc6af('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6af('0x4'));var rimraf=require(_0xc6af('0x5'));var config=require(_0xc6af('0x6'));var attributes=require(_0xc6af('0x7'));module['exports']=function(_0x3beacd,_0x2bca8e){return _0x3beacd[_0xc6af('0x8')](_0xc6af('0x9'),attributes,{'tableName':_0xc6af('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d2f=['exports','define','AnalyticTreeReport','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a0fe7,_0xbbee84){var _0xc0734b=function(_0x1af95a){while(--_0x1af95a){_0x4a0fe7['push'](_0x4a0fe7['shift']());}};_0xc0734b(++_0xbbee84);}(_0x3d2f,0x18f));var _0xf3d2=function(_0x455a49,_0x441ef7){_0x455a49=_0x455a49-0x0;var _0x2c1e7a=_0x3d2f[_0x455a49];return _0x2c1e7a;};'use strict';var _=require(_0xf3d2('0x0'));var util=require(_0xf3d2('0x1'));var logger=require('../../config/logger')(_0xf3d2('0x2'));var moment=require(_0xf3d2('0x3'));var BPromise=require(_0xf3d2('0x4'));var rp=require(_0xf3d2('0x5'));var fs=require('fs');var path=require(_0xf3d2('0x6'));var rimraf=require(_0xf3d2('0x7'));var config=require(_0xf3d2('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0xf3d2('0x9')]=function(_0xcd029e,_0x1a1317){return _0xcd029e[_0xf3d2('0xa')](_0xf3d2('0xb'),attributes,{'tableName':'analytics_report_trees','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 240dba4..4812120 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 _0xa496=['info','request\x20sent','debug','stringify','error','code','AnalyticTreeReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x338f45,_0x3b28c6){var _0xc327b9=function(_0x510aa1){while(--_0x510aa1){_0x338f45['push'](_0x338f45['shift']());}};_0xc327b9(++_0x3b28c6);}(_0xa496,0x82));var _0x6a49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa496[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6a49('0x0'));var util=require(_0x6a49('0x1'));var moment=require(_0x6a49('0x2'));var BPromise=require(_0x6a49('0x3'));var rs=require(_0x6a49('0x4'));var fs=require('fs');var Redis=require(_0x6a49('0x5'));var db=require(_0x6a49('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a49('0x7'))('rpc');var config=require(_0x6a49('0x8'));var jayson=require(_0x6a49('0x9'));var client=jayson[_0x6a49('0xa')][_0x6a49('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ad013,_0x397326,_0x225421){return new BPromise(function(_0x59a8e7,_0x260089){return client[_0x6a49('0xc')](_0x5ad013,_0x225421)[_0x6a49('0xd')](function(_0x278212){logger[_0x6a49('0xe')]('AnalyticTreeReport,\x20%s,\x20%s',_0x397326,_0x6a49('0xf'));logger[_0x6a49('0x10')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x397326,_0x6a49('0xf'),JSON[_0x6a49('0x11')](_0x278212));if(_0x278212[_0x6a49('0x12')]){if(_0x278212[_0x6a49('0x12')][_0x6a49('0x13')]===0x1f4){logger[_0x6a49('0x12')](_0x6a49('0x14'),_0x397326,_0x278212[_0x6a49('0x12')][_0x6a49('0x15')]);return _0x260089(_0x278212[_0x6a49('0x12')][_0x6a49('0x15')]);}logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x397326,_0x278212[_0x6a49('0x12')][_0x6a49('0x15')]);return _0x59a8e7(_0x278212[_0x6a49('0x12')][_0x6a49('0x15')]);}else{logger[_0x6a49('0xe')](_0x6a49('0x14'),_0x397326,_0x6a49('0xf'));_0x59a8e7(_0x278212[_0x6a49('0x16')][_0x6a49('0x15')]);}})[_0x6a49('0x17')](function(_0x40c3a5){logger[_0x6a49('0x12')](_0x6a49('0x14'),_0x397326,_0x40c3a5);_0x260089(_0x40c3a5);});});} \ No newline at end of file +var _0x6fc5=['debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x6fc5,0x14c));var _0x56fc=function(_0x5dd612,_0x2f439a){_0x5dd612=_0x5dd612-0x0;var _0x3ba967=_0x6fc5[_0x5dd612];return _0x3ba967;};'use strict';var _=require(_0x56fc('0x0'));var util=require(_0x56fc('0x1'));var moment=require(_0x56fc('0x2'));var BPromise=require(_0x56fc('0x3'));var rs=require(_0x56fc('0x4'));var fs=require('fs');var Redis=require(_0x56fc('0x5'));var db=require(_0x56fc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x56fc('0x7'))(_0x56fc('0x8'));var config=require(_0x56fc('0x9'));var jayson=require(_0x56fc('0xa'));var client=jayson[_0x56fc('0xb')][_0x56fc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb07207,_0x497d06,_0x389924){return new BPromise(function(_0x1134a1,_0xdd43cd){return client[_0x56fc('0xd')](_0xb07207,_0x389924)[_0x56fc('0xe')](function(_0x3df5ea){logger[_0x56fc('0xf')](_0x56fc('0x10'),_0x497d06,_0x56fc('0x11'));logger[_0x56fc('0x12')](_0x56fc('0x13'),_0x497d06,_0x56fc('0x11'),JSON[_0x56fc('0x14')](_0x3df5ea));if(_0x3df5ea['error']){if(_0x3df5ea[_0x56fc('0x15')][_0x56fc('0x16')]===0x1f4){logger['error'](_0x56fc('0x10'),_0x497d06,_0x3df5ea['error'][_0x56fc('0x17')]);return _0xdd43cd(_0x3df5ea[_0x56fc('0x15')]['message']);}logger[_0x56fc('0x15')](_0x56fc('0x10'),_0x497d06,_0x3df5ea[_0x56fc('0x15')][_0x56fc('0x17')]);return _0x1134a1(_0x3df5ea[_0x56fc('0x15')][_0x56fc('0x17')]);}else{logger[_0x56fc('0xf')](_0x56fc('0x10'),_0x497d06,_0x56fc('0x11'));_0x1134a1(_0x3df5ea[_0x56fc('0x18')]['message']);}})['catch'](function(_0x42d0af){logger[_0x56fc('0x15')](_0x56fc('0x10'),_0x497d06,_0x42d0af);_0xdd43cd(_0x42d0af);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index e587b98..175d574 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 _0xd6bd=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','/:id','show','post','isAuthenticated','create','update','delete','destroy','multer','path','express'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd6bd,0x1cd));var _0xdd6b=function(_0x833c18,_0x3a5613){_0x833c18=_0x833c18-0x0;var _0x2e627=_0xd6bd[_0x833c18];return _0x2e627;};'use strict';var multer=require(_0xdd6b('0x0'));var util=require('util');var path=require(_0xdd6b('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd6b('0x2'));var router=express['Router']();var auth=require(_0xdd6b('0x3'));var interaction=require(_0xdd6b('0x4'));var config=require(_0xdd6b('0x5'));var controller=require(_0xdd6b('0x6'));router[_0xdd6b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdd6b('0x7')](_0xdd6b('0x8'),auth['isAuthenticated'](),controller[_0xdd6b('0x9')]);router[_0xdd6b('0xa')]('/',auth[_0xdd6b('0xb')](),controller[_0xdd6b('0xc')]);router['put']('/:id',auth[_0xdd6b('0xb')](),controller[_0xdd6b('0xd')]);router[_0xdd6b('0xe')](_0xdd6b('0x8'),auth[_0xdd6b('0xb')](),controller[_0xdd6b('0xf')]);module['exports']=router; \ No newline at end of file +var _0x93d2=['express','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0x93d2,0x19b));var _0x293d=function(_0x52ab8a,_0xee034b){_0x52ab8a=_0x52ab8a-0x0;var _0x5d6ddc=_0x93d2[_0x52ab8a];return _0x5d6ddc;};'use strict';var multer=require(_0x293d('0x0'));var util=require('util');var path=require(_0x293d('0x1'));var timeout=require(_0x293d('0x2'));var express=require(_0x293d('0x3'));var router=express[_0x293d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x293d('0x5'));var config=require(_0x293d('0x6'));var controller=require(_0x293d('0x7'));router[_0x293d('0x8')]('/',auth[_0x293d('0x9')](),controller[_0x293d('0xa')]);router[_0x293d('0x8')](_0x293d('0xb'),auth[_0x293d('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x293d('0xc')]);router[_0x293d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x293d('0xe')]);router[_0x293d('0xf')]('/:id',auth[_0x293d('0x9')](),controller[_0x293d('0x10')]);module[_0x293d('0x11')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 9305662..e56a199 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 _0x0187=['STRING'];(function(_0x2f870b,_0x2f5c67){var _0x227a43=function(_0x16f970){while(--_0x16f970){_0x2f870b['push'](_0x2f870b['shift']());}};_0x227a43(++_0x2f5c67);}(_0x0187,0x1f3));var _0x7018=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0x0187[_0x20e7e3];return _0x14b9de;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7018('0x0')]},'basename':{'type':Sequelize[_0x7018('0x0')]},'type':{'type':Sequelize[_0x7018('0x0')]}}; \ No newline at end of file +var _0x1dcf=['sequelize','exports','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x1dcf,0x7e));var _0xf1dc=function(_0x30d7dd,_0x278e33){_0x30d7dd=_0x30d7dd-0x0;var _0x3d442a=_0x1dcf[_0x30d7dd];return _0x3d442a;};'use strict';var Sequelize=require(_0xf1dc('0x0'));module[_0xf1dc('0x1')]={'name':{'type':Sequelize[_0xf1dc('0x2')]},'basename':{'type':Sequelize[_0xf1dc('0x2')]},'type':{'type':Sequelize[_0xf1dc('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 612e7b6..1ce7012 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 _0xbae6=['../../config/environment','end','json','count','set','save','destroy','then','status','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','length','includeAll','find','clone','params','options','get','omit','createdAt','updatedAt','body','create','update','file','originalname','basename','filename','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1f6a6a,_0x406f02){var _0x2b648d=function(_0x461312){while(--_0x461312){_0x1f6a6a['push'](_0x1f6a6a['shift']());}};_0x2b648d(++_0x406f02);}(_0xbae6,0x98));var _0x6bae=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0xbae6[_0x5712f8];return _0x14a364;};'use strict';var pdf=require(_0x6bae('0x0'));var emlformat=require(_0x6bae('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6bae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6bae('0x3'));var moment=require(_0x6bae('0x4'));var BPromise=require(_0x6bae('0x5'));var Mustache=require(_0x6bae('0x6'));var util=require(_0x6bae('0x7'));var path=require(_0x6bae('0x8'));var sox=require(_0x6bae('0x9'));var csv=require(_0x6bae('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6bae('0xb'));var squel=require('squel');var crypto=require(_0x6bae('0xc'));var jsforce=require(_0x6bae('0xd'));var deskjs=require(_0x6bae('0xe'));var toCsv=require(_0x6bae('0xa'));var querystring=require(_0x6bae('0xf'));var Papa=require(_0x6bae('0x10'));var Redis=require(_0x6bae('0x11'));var authService=require(_0x6bae('0x12'));var qs=require(_0x6bae('0x13'));var as=require(_0x6bae('0x14'));var hardwareService=require(_0x6bae('0x15'));var logger=require(_0x6bae('0x16'))(_0x6bae('0x17'));var utils=require('../../config/utils');var config=require(_0x6bae('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x377564,_0x4a35c4){_0x4a35c4=_0x4a35c4||0xcc;return function(_0x4b454d){if(_0x4b454d){return _0x377564['sendStatus'](_0x4a35c4);}return _0x377564['status'](_0x4a35c4)[_0x6bae('0x19')]();};}function respondWithResult(_0x5e61d5,_0x71e75b){_0x71e75b=_0x71e75b||0xc8;return function(_0x5e7162){if(_0x5e7162){return _0x5e61d5['status'](_0x71e75b)[_0x6bae('0x1a')](_0x5e7162);}};}function respondWithFilteredResult(_0x58bcb7,_0x59a60e){return function(_0x3787ac){if(_0x3787ac){var _0x3f17ee=_0x3787ac[_0x6bae('0x1b')],_0x40fa23=_0x59a60e['offset'],_0x49370f=_0x59a60e['offset']+_0x59a60e['limit'],_0x1915c5;if(_0x49370f>=_0x3f17ee){_0x49370f=_0x3f17ee;_0x1915c5=0xc8;}else{_0x1915c5=0xce;}_0x58bcb7['status'](_0x1915c5);return _0x58bcb7[_0x6bae('0x1c')]('Content-Range',_0x40fa23+'-'+_0x49370f+'/'+_0x3f17ee)[_0x6bae('0x1a')](_0x3787ac);}return null;};}function patchUpdates(_0x9f2fa5){return function(_0x1f7497){try{jsonpatch['apply'](_0x1f7497,_0x9f2fa5,!![]);}catch(_0x3dd6f6){return BPromise['reject'](_0x3dd6f6);}return _0x1f7497[_0x6bae('0x1d')]();};}function saveUpdates(_0x17610f,_0x1da588){return function(_0x491cd6){if(_0x491cd6){return _0x491cd6['update'](_0x17610f)['then'](function(_0x3e1ea9){return _0x3e1ea9;});}return null;};}function removeEntity(_0x3edc3b,_0x2a3b66){return function(_0x478285){if(_0x478285){return _0x478285[_0x6bae('0x1e')]()[_0x6bae('0x1f')](function(){_0x3edc3b[_0x6bae('0x20')](0xcc)[_0x6bae('0x19')]();});}};}function handleEntityNotFound(_0x2d0c0e,_0x296053){return function(_0x14d899){if(!_0x14d899){_0x2d0c0e['sendStatus'](0x194);}return _0x14d899;};}function handleError(_0x137355,_0x1520b0){_0x1520b0=_0x1520b0||0x1f4;return function(_0x233031){logger[_0x6bae('0x21')](_0x233031[_0x6bae('0x22')]);if(_0x233031['name']){delete _0x233031[_0x6bae('0x23')];}_0x137355[_0x6bae('0x20')](_0x1520b0)[_0x6bae('0x24')](_0x233031);};}exports[_0x6bae('0x25')]=function(_0x17e35d,_0x43449a){var _0x2d1d2e={},_0x1c832a={},_0x41c21e={'count':0x0,'rows':[]};var _0x2c0907=_[_0x6bae('0x26')](db[_0x6bae('0x27')][_0x6bae('0x28')],function(_0x49e0f9){return{'name':_0x49e0f9[_0x6bae('0x29')],'type':_0x49e0f9[_0x6bae('0x2a')][_0x6bae('0x2b')]};});_0x1c832a['model']=_['map'](_0x2c0907,_0x6bae('0x23'));_0x1c832a[_0x6bae('0x2c')]=_[_0x6bae('0x2d')](_0x17e35d['query']);_0x1c832a[_0x6bae('0x2e')]=_[_0x6bae('0x2f')](_0x1c832a[_0x6bae('0x30')],_0x1c832a[_0x6bae('0x2c')]);_0x2d1d2e[_0x6bae('0x31')]=_[_0x6bae('0x2f')](_0x1c832a[_0x6bae('0x30')],qs[_0x6bae('0x32')](_0x17e35d[_0x6bae('0x2c')][_0x6bae('0x32')]));_0x2d1d2e[_0x6bae('0x31')]=_0x2d1d2e[_0x6bae('0x31')]['length']?_0x2d1d2e[_0x6bae('0x31')]:_0x1c832a[_0x6bae('0x30')];if(!_0x17e35d['query'][_0x6bae('0x33')](_0x6bae('0x34'))){_0x2d1d2e[_0x6bae('0x35')]=qs[_0x6bae('0x35')](_0x17e35d[_0x6bae('0x2c')][_0x6bae('0x35')]);_0x2d1d2e[_0x6bae('0x36')]=qs[_0x6bae('0x36')](_0x17e35d[_0x6bae('0x2c')]['offset']);}_0x2d1d2e[_0x6bae('0x37')]=qs['sort'](_0x17e35d['query'][_0x6bae('0x38')]);_0x2d1d2e['where']=qs[_0x6bae('0x2e')](_[_0x6bae('0x39')](_0x17e35d[_0x6bae('0x2c')],_0x1c832a[_0x6bae('0x2e')]));if(_0x17e35d[_0x6bae('0x2c')][_0x6bae('0x3a')]){_0x2d1d2e[_0x6bae('0x3b')]=_[_0x6bae('0x3c')](_0x2d1d2e[_0x6bae('0x3b')],{'$or':_[_0x6bae('0x26')](_0x2c0907,function(_0x3378ce){if(_0x3378ce[_0x6bae('0x2a')]!==_0x6bae('0x3d')){var _0x1eada0={};_0x1eada0[_0x3378ce['name']]={'$like':'%'+_0x17e35d[_0x6bae('0x2c')][_0x6bae('0x3a')]+'%'};return _0x1eada0;}})});}_0x2d1d2e=_['merge']({},_0x2d1d2e,_0x17e35d['options']);var _0x1deba2={'where':_0x2d1d2e['where']};return db[_0x6bae('0x27')][_0x6bae('0x1b')](_0x1deba2)['then'](function(_0x30a2c3){_0x41c21e[_0x6bae('0x1b')]=_0x30a2c3;if(_0x17e35d[_0x6bae('0x2c')]['includeAll']){_0x2d1d2e[_0x6bae('0x3e')]=[{'all':!![]}];}return db[_0x6bae('0x27')][_0x6bae('0x3f')](_0x2d1d2e);})[_0x6bae('0x1f')](function(_0x5cc309){_0x41c21e[_0x6bae('0x40')]=_0x5cc309;return _0x41c21e;})['then'](respondWithFilteredResult(_0x43449a,_0x2d1d2e))[_0x6bae('0x41')](handleError(_0x43449a,null));};exports['show']=function(_0x27bcc4,_0x20a9a5){var _0x1bd25d={'raw':!![],'where':{'id':_0x27bcc4['params']['id']}},_0x2daf1a={};_0x2daf1a['model']=_[_0x6bae('0x2d')](db[_0x6bae('0x27')][_0x6bae('0x28')]);_0x2daf1a[_0x6bae('0x2c')]=_[_0x6bae('0x2d')](_0x27bcc4[_0x6bae('0x2c')]);_0x2daf1a['filters']=_[_0x6bae('0x2f')](_0x2daf1a[_0x6bae('0x30')],_0x2daf1a[_0x6bae('0x2c')]);_0x1bd25d['attributes']=_['intersection'](_0x2daf1a[_0x6bae('0x30')],qs[_0x6bae('0x32')](_0x27bcc4['query'][_0x6bae('0x32')]));_0x1bd25d['attributes']=_0x1bd25d[_0x6bae('0x31')][_0x6bae('0x42')]?_0x1bd25d[_0x6bae('0x31')]:_0x2daf1a['model'];if(_0x27bcc4[_0x6bae('0x2c')][_0x6bae('0x43')]){_0x1bd25d[_0x6bae('0x3e')]=[{'all':!![]}];}_0x1bd25d=_[_0x6bae('0x3c')]({},_0x1bd25d,_0x27bcc4['options']);return db[_0x6bae('0x27')][_0x6bae('0x44')](_0x1bd25d)['then'](handleEntityNotFound(_0x20a9a5,null))[_0x6bae('0x1f')](respondWithResult(_0x20a9a5,null))[_0x6bae('0x41')](handleError(_0x20a9a5,null));};exports[_0x6bae('0x45')]=function(_0x3e9531,_0x484992){var _0x3512b7={'where':{'id':_0x3e9531[_0x6bae('0x46')]['id']}},_0x521aa8={};_0x521aa8[_0x6bae('0x30')]=_[_0x6bae('0x2d')](db['Attachment']['rawAttributes']);_0x3512b7[_0x6bae('0x31')]=_[_0x6bae('0x2f')](_0x521aa8[_0x6bae('0x30')],qs['fields'](_0x3e9531['query'][_0x6bae('0x32')]));_0x3512b7['attributes']=_0x3512b7['attributes'][_0x6bae('0x42')]?_0x3512b7['attributes']:_0x521aa8['model'];if(_0x3e9531[_0x6bae('0x2c')]['includeAll']){_0x3512b7[_0x6bae('0x3e')]=[{'all':!![]}];}_0x3512b7=_[_0x6bae('0x3c')]({},_0x3512b7,_0x3e9531[_0x6bae('0x47')]);return db[_0x6bae('0x27')][_0x6bae('0x44')](_0x3512b7)['then'](handleEntityNotFound(_0x484992,null))[_0x6bae('0x1f')](function(_0x103c32){if(_0x103c32){var _0x51fe10=_0x103c32[_0x6bae('0x48')]({'plain':!![]});_0x51fe10=qs[_0x6bae('0x49')](_0x51fe10,['id',_0x6bae('0x4a'),_0x6bae('0x4b')]);_0x3e9531[_0x6bae('0x4c')]=_[_0x6bae('0x49')](_0x3e9531['body'],['id',_0x6bae('0x4a'),'updatedAt']);return db[_0x6bae('0x27')][_0x6bae('0x4d')](_[_0x6bae('0x3c')](_0x51fe10,_0x3e9531['body']),{'include':_0x3e9531['query'][_0x6bae('0x43')]?[{'all':!![]}]:undefined});}})[_0x6bae('0x1f')](respondWithResult(_0x484992,0xc9))[_0x6bae('0x41')](handleError(_0x484992,null));};exports[_0x6bae('0x4e')]=function(_0x1e1503,_0x3a27dc){if(_0x1e1503['body']['id']){delete _0x1e1503['body']['id'];}return db[_0x6bae('0x27')]['find']({'where':{'id':_0x1e1503['params']['id']}})[_0x6bae('0x1f')](handleEntityNotFound(_0x3a27dc,null))[_0x6bae('0x1f')](saveUpdates(_0x1e1503[_0x6bae('0x4c')],null))[_0x6bae('0x1f')](respondWithResult(_0x3a27dc,null))['catch'](handleError(_0x3a27dc,null));};exports[_0x6bae('0x1e')]=function(_0x365ef3,_0xf57340){return db[_0x6bae('0x27')][_0x6bae('0x44')]({'where':{'id':_0x365ef3[_0x6bae('0x46')]['id']}})[_0x6bae('0x1f')](handleEntityNotFound(_0xf57340,null))[_0x6bae('0x1f')](removeEntity(_0xf57340,null))[_0x6bae('0x41')](handleError(_0xf57340,null));};exports[_0x6bae('0x4d')]=function(_0x218069,_0x4d2ded,_0x398f60){_0x218069[_0x6bae('0x4c')][_0x6bae('0x23')]=_0x218069[_0x6bae('0x4f')][_0x6bae('0x50')];_0x218069[_0x6bae('0x4c')][_0x6bae('0x51')]=_0x218069['file'][_0x6bae('0x52')];_0x218069['body'][_0x6bae('0x2a')]=_0x218069[_0x6bae('0x4f')]['mimetype'];return db['Attachment'][_0x6bae('0x4d')](_0x218069[_0x6bae('0x4c')])[_0x6bae('0x1f')](respondWithResult(_0x4d2ded,0xc9))['catch'](handleError(_0x4d2ded,null));};exports[_0x6bae('0x53')]=function(_0x4de8b7,_0x19dd3a,_0xf2e346){return db[_0x6bae('0x27')][_0x6bae('0x54')]({'where':{'id':_0x4de8b7[_0x6bae('0x46')]['id']},'raw':!![]})[_0x6bae('0x1f')](handleEntityNotFound(_0x19dd3a,null))['then'](function(_0x54c116){if(_0x54c116){return _0x19dd3a['download'](path[_0x6bae('0x55')](config[_0x6bae('0x56')],_0x6bae('0x57'),_0x54c116[_0x6bae('0x51')]));}})[_0x6bae('0x41')](handleError(_0x19dd3a,null));}; \ No newline at end of file +var _0xd8ef=['squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','Attachment','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','catch','params','length','include','find','clone','get','omit','updatedAt','body','createdAt','file','originalname','basename','filename','mimetype','create','download','findOne','join','root','server/files/attachments/','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash'];(function(_0x4419f4,_0x2f3600){var _0x227861=function(_0x3ce929){while(--_0x3ce929){_0x4419f4['push'](_0x4419f4['shift']());}};_0x227861(++_0x2f3600);}(_0xd8ef,0x1a7));var _0xfd8e=function(_0x555d1a,_0x302602){_0x555d1a=_0x555d1a-0x0;var _0xfabb41=_0xd8ef[_0x555d1a];return _0xfabb41;};'use strict';var pdf=require(_0xfd8e('0x0'));var emlformat=require(_0xfd8e('0x1'));var rimraf=require(_0xfd8e('0x2'));var zipdir=require(_0xfd8e('0x3'));var jsonpatch=require(_0xfd8e('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfd8e('0x5'));var util=require(_0xfd8e('0x6'));var path=require(_0xfd8e('0x7'));var sox=require(_0xfd8e('0x8'));var csv=require(_0xfd8e('0x9'));var ejs=require(_0xfd8e('0xa'));var fs=require('fs');var _=require(_0xfd8e('0xb'));var squel=require(_0xfd8e('0xc'));var crypto=require(_0xfd8e('0xd'));var jsforce=require(_0xfd8e('0xe'));var deskjs=require(_0xfd8e('0xf'));var toCsv=require(_0xfd8e('0x9'));var querystring=require(_0xfd8e('0x10'));var Papa=require('papaparse');var Redis=require(_0xfd8e('0x11'));var authService=require(_0xfd8e('0x12'));var qs=require(_0xfd8e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfd8e('0x14'));var logger=require('../../config/logger')(_0xfd8e('0x15'));var utils=require(_0xfd8e('0x16'));var config=require(_0xfd8e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1916ab,_0x39f630){_0x39f630=_0x39f630||0xcc;return function(_0x4c3f96){if(_0x4c3f96){return _0x1916ab[_0xfd8e('0x18')](_0x39f630);}return _0x1916ab[_0xfd8e('0x19')](_0x39f630)[_0xfd8e('0x1a')]();};}function respondWithResult(_0x3e14fb,_0x447a7a){_0x447a7a=_0x447a7a||0xc8;return function(_0x3fca54){if(_0x3fca54){return _0x3e14fb[_0xfd8e('0x19')](_0x447a7a)[_0xfd8e('0x1b')](_0x3fca54);}};}function respondWithFilteredResult(_0xe46425,_0x213aef){return function(_0x26f38a){if(_0x26f38a){var _0x406c4=_0x26f38a[_0xfd8e('0x1c')],_0x156606=_0x213aef['offset'],_0x1c8a5d=_0x213aef['offset']+_0x213aef[_0xfd8e('0x1d')],_0x1d1728;if(_0x1c8a5d>=_0x406c4){_0x1c8a5d=_0x406c4;_0x1d1728=0xc8;}else{_0x1d1728=0xce;}_0xe46425['status'](_0x1d1728);return _0xe46425[_0xfd8e('0x1e')](_0xfd8e('0x1f'),_0x156606+'-'+_0x1c8a5d+'/'+_0x406c4)[_0xfd8e('0x1b')](_0x26f38a);}return null;};}function patchUpdates(_0x4d3ea8){return function(_0x427ec9){try{jsonpatch[_0xfd8e('0x20')](_0x427ec9,_0x4d3ea8,!![]);}catch(_0x5df91d){return BPromise[_0xfd8e('0x21')](_0x5df91d);}return _0x427ec9[_0xfd8e('0x22')]();};}function saveUpdates(_0x41d315,_0x556f1d){return function(_0x15a34b){if(_0x15a34b){return _0x15a34b[_0xfd8e('0x23')](_0x41d315)['then'](function(_0x3f02d0){return _0x3f02d0;});}return null;};}function removeEntity(_0x141fdd,_0x1326fd){return function(_0x2da0e9){if(_0x2da0e9){return _0x2da0e9[_0xfd8e('0x24')]()[_0xfd8e('0x25')](function(){_0x141fdd[_0xfd8e('0x19')](0xcc)[_0xfd8e('0x1a')]();});}};}function handleEntityNotFound(_0x10b945,_0x2e1059){return function(_0x3dabb9){if(!_0x3dabb9){_0x10b945[_0xfd8e('0x18')](0x194);}return _0x3dabb9;};}function handleError(_0x13dacd,_0x1e78ee){_0x1e78ee=_0x1e78ee||0x1f4;return function(_0x70a828){logger['error'](_0x70a828[_0xfd8e('0x26')]);if(_0x70a828['name']){delete _0x70a828[_0xfd8e('0x27')];}_0x13dacd[_0xfd8e('0x19')](_0x1e78ee)[_0xfd8e('0x28')](_0x70a828);};}exports[_0xfd8e('0x29')]=function(_0x3f79c2,_0x312594){var _0x4d8b52={},_0x58e3be={},_0x469796={'count':0x0,'rows':[]};var _0xd93a34=_[_0xfd8e('0x2a')](db[_0xfd8e('0x2b')][_0xfd8e('0x2c')],function(_0x59ea5d){return{'name':_0x59ea5d['fieldName'],'type':_0x59ea5d[_0xfd8e('0x2d')][_0xfd8e('0x2e')]};});_0x58e3be[_0xfd8e('0x2f')]=_[_0xfd8e('0x2a')](_0xd93a34,'name');_0x58e3be[_0xfd8e('0x30')]=_[_0xfd8e('0x31')](_0x3f79c2[_0xfd8e('0x30')]);_0x58e3be['filters']=_[_0xfd8e('0x32')](_0x58e3be[_0xfd8e('0x2f')],_0x58e3be[_0xfd8e('0x30')]);_0x4d8b52[_0xfd8e('0x33')]=_[_0xfd8e('0x32')](_0x58e3be[_0xfd8e('0x2f')],qs[_0xfd8e('0x34')](_0x3f79c2[_0xfd8e('0x30')]['fields']));_0x4d8b52[_0xfd8e('0x33')]=_0x4d8b52['attributes']['length']?_0x4d8b52[_0xfd8e('0x33')]:_0x58e3be[_0xfd8e('0x2f')];if(!_0x3f79c2[_0xfd8e('0x30')][_0xfd8e('0x35')]('nolimit')){_0x4d8b52[_0xfd8e('0x1d')]=qs[_0xfd8e('0x1d')](_0x3f79c2[_0xfd8e('0x30')][_0xfd8e('0x1d')]);_0x4d8b52[_0xfd8e('0x36')]=qs[_0xfd8e('0x36')](_0x3f79c2[_0xfd8e('0x30')]['offset']);}_0x4d8b52[_0xfd8e('0x37')]=qs[_0xfd8e('0x38')](_0x3f79c2[_0xfd8e('0x30')][_0xfd8e('0x38')]);_0x4d8b52[_0xfd8e('0x39')]=qs[_0xfd8e('0x3a')](_[_0xfd8e('0x3b')](_0x3f79c2[_0xfd8e('0x30')],_0x58e3be[_0xfd8e('0x3a')]));if(_0x3f79c2[_0xfd8e('0x30')][_0xfd8e('0x3c')]){_0x4d8b52[_0xfd8e('0x39')]=_[_0xfd8e('0x3d')](_0x4d8b52[_0xfd8e('0x39')],{'$or':_['map'](_0xd93a34,function(_0x3e2852){if(_0x3e2852[_0xfd8e('0x2d')]!==_0xfd8e('0x3e')){var _0x3b6164={};_0x3b6164[_0x3e2852[_0xfd8e('0x27')]]={'$like':'%'+_0x3f79c2[_0xfd8e('0x30')]['filter']+'%'};return _0x3b6164;}})});}_0x4d8b52=_[_0xfd8e('0x3d')]({},_0x4d8b52,_0x3f79c2[_0xfd8e('0x3f')]);var _0x4569e2={'where':_0x4d8b52[_0xfd8e('0x39')]};return db['Attachment'][_0xfd8e('0x1c')](_0x4569e2)[_0xfd8e('0x25')](function(_0x359ce6){_0x469796[_0xfd8e('0x1c')]=_0x359ce6;if(_0x3f79c2['query'][_0xfd8e('0x40')]){_0x4d8b52['include']=[{'all':!![]}];}return db[_0xfd8e('0x2b')]['findAll'](_0x4d8b52);})['then'](function(_0x480cd4){_0x469796['rows']=_0x480cd4;return _0x469796;})[_0xfd8e('0x25')](respondWithFilteredResult(_0x312594,_0x4d8b52))[_0xfd8e('0x41')](handleError(_0x312594,null));};exports['show']=function(_0x51d02d,_0x338aac){var _0x183b9a={'raw':!![],'where':{'id':_0x51d02d[_0xfd8e('0x42')]['id']}},_0x46e88f={};_0x46e88f['model']=_[_0xfd8e('0x31')](db[_0xfd8e('0x2b')]['rawAttributes']);_0x46e88f[_0xfd8e('0x30')]=_['keys'](_0x51d02d[_0xfd8e('0x30')]);_0x46e88f[_0xfd8e('0x3a')]=_[_0xfd8e('0x32')](_0x46e88f['model'],_0x46e88f[_0xfd8e('0x30')]);_0x183b9a[_0xfd8e('0x33')]=_['intersection'](_0x46e88f[_0xfd8e('0x2f')],qs['fields'](_0x51d02d[_0xfd8e('0x30')][_0xfd8e('0x34')]));_0x183b9a[_0xfd8e('0x33')]=_0x183b9a[_0xfd8e('0x33')][_0xfd8e('0x43')]?_0x183b9a[_0xfd8e('0x33')]:_0x46e88f[_0xfd8e('0x2f')];if(_0x51d02d[_0xfd8e('0x30')][_0xfd8e('0x40')]){_0x183b9a[_0xfd8e('0x44')]=[{'all':!![]}];}_0x183b9a=_['merge']({},_0x183b9a,_0x51d02d['options']);return db['Attachment'][_0xfd8e('0x45')](_0x183b9a)[_0xfd8e('0x25')](handleEntityNotFound(_0x338aac,null))['then'](respondWithResult(_0x338aac,null))['catch'](handleError(_0x338aac,null));};exports[_0xfd8e('0x46')]=function(_0x3a25d9,_0x55c5ba){var _0x1fccd3={'where':{'id':_0x3a25d9[_0xfd8e('0x42')]['id']}},_0xe16697={};_0xe16697[_0xfd8e('0x2f')]=_['keys'](db[_0xfd8e('0x2b')][_0xfd8e('0x2c')]);_0x1fccd3['attributes']=_[_0xfd8e('0x32')](_0xe16697[_0xfd8e('0x2f')],qs['fields'](_0x3a25d9[_0xfd8e('0x30')][_0xfd8e('0x34')]));_0x1fccd3[_0xfd8e('0x33')]=_0x1fccd3[_0xfd8e('0x33')][_0xfd8e('0x43')]?_0x1fccd3[_0xfd8e('0x33')]:_0xe16697[_0xfd8e('0x2f')];if(_0x3a25d9['query']['includeAll']){_0x1fccd3[_0xfd8e('0x44')]=[{'all':!![]}];}_0x1fccd3=_[_0xfd8e('0x3d')]({},_0x1fccd3,_0x3a25d9[_0xfd8e('0x3f')]);return db[_0xfd8e('0x2b')][_0xfd8e('0x45')](_0x1fccd3)[_0xfd8e('0x25')](handleEntityNotFound(_0x55c5ba,null))[_0xfd8e('0x25')](function(_0x527000){if(_0x527000){var _0x1243b8=_0x527000[_0xfd8e('0x47')]({'plain':!![]});_0x1243b8=qs[_0xfd8e('0x48')](_0x1243b8,['id','createdAt',_0xfd8e('0x49')]);_0x3a25d9[_0xfd8e('0x4a')]=_[_0xfd8e('0x48')](_0x3a25d9[_0xfd8e('0x4a')],['id',_0xfd8e('0x4b'),_0xfd8e('0x49')]);return db[_0xfd8e('0x2b')]['create'](_['merge'](_0x1243b8,_0x3a25d9[_0xfd8e('0x4a')]),{'include':_0x3a25d9[_0xfd8e('0x30')][_0xfd8e('0x40')]?[{'all':!![]}]:undefined});}})[_0xfd8e('0x25')](respondWithResult(_0x55c5ba,0xc9))[_0xfd8e('0x41')](handleError(_0x55c5ba,null));};exports[_0xfd8e('0x23')]=function(_0x5326ea,_0x1009ba){if(_0x5326ea[_0xfd8e('0x4a')]['id']){delete _0x5326ea[_0xfd8e('0x4a')]['id'];}return db[_0xfd8e('0x2b')][_0xfd8e('0x45')]({'where':{'id':_0x5326ea[_0xfd8e('0x42')]['id']}})[_0xfd8e('0x25')](handleEntityNotFound(_0x1009ba,null))[_0xfd8e('0x25')](saveUpdates(_0x5326ea['body'],null))[_0xfd8e('0x25')](respondWithResult(_0x1009ba,null))['catch'](handleError(_0x1009ba,null));};exports['destroy']=function(_0x58f0d8,_0x4cb324){return db[_0xfd8e('0x2b')][_0xfd8e('0x45')]({'where':{'id':_0x58f0d8[_0xfd8e('0x42')]['id']}})[_0xfd8e('0x25')](handleEntityNotFound(_0x4cb324,null))[_0xfd8e('0x25')](removeEntity(_0x4cb324,null))[_0xfd8e('0x41')](handleError(_0x4cb324,null));};exports['create']=function(_0x1bf02d,_0x2f256c,_0x6cd429){_0x1bf02d[_0xfd8e('0x4a')][_0xfd8e('0x27')]=_0x1bf02d[_0xfd8e('0x4c')][_0xfd8e('0x4d')];_0x1bf02d['body'][_0xfd8e('0x4e')]=_0x1bf02d[_0xfd8e('0x4c')][_0xfd8e('0x4f')];_0x1bf02d['body'][_0xfd8e('0x2d')]=_0x1bf02d['file'][_0xfd8e('0x50')];return db['Attachment'][_0xfd8e('0x51')](_0x1bf02d['body'])['then'](respondWithResult(_0x2f256c,0xc9))[_0xfd8e('0x41')](handleError(_0x2f256c,null));};exports[_0xfd8e('0x52')]=function(_0x490001,_0x1a6886,_0xc12528){return db['Attachment'][_0xfd8e('0x53')]({'where':{'id':_0x490001[_0xfd8e('0x42')]['id']},'raw':!![]})[_0xfd8e('0x25')](handleEntityNotFound(_0x1a6886,null))[_0xfd8e('0x25')](function(_0x182bc2){if(_0x182bc2){return _0x1a6886[_0xfd8e('0x52')](path[_0xfd8e('0x54')](config[_0xfd8e('0x55')],_0xfd8e('0x56'),_0x182bc2[_0xfd8e('0x4e')]));}})['catch'](handleError(_0x1a6886,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 00c760e..64eaf04 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 _0x8357=['path','rimraf','exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xe17838,_0x11a9a0){var _0x5a518c=function(_0x542ffb){while(--_0x542ffb){_0xe17838['push'](_0xe17838['shift']());}};_0x5a518c(++_0x11a9a0);}(_0x8357,0x1e4));var _0x7835=function(_0x5e10b4,_0x22590b){_0x5e10b4=_0x5e10b4-0x0;var _0x2c00d3=_0x8357[_0x5e10b4];return _0x2c00d3;};'use strict';var _=require(_0x7835('0x0'));var util=require(_0x7835('0x1'));var logger=require(_0x7835('0x2'))('api');var moment=require(_0x7835('0x3'));var BPromise=require(_0x7835('0x4'));var rp=require(_0x7835('0x5'));var fs=require('fs');var path=require(_0x7835('0x6'));var rimraf=require(_0x7835('0x7'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0x7835('0x8')]=function(_0x492061,_0x3bd4a8){return _0x492061[_0x7835('0x9')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf894=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash','util'];(function(_0x85fbb2,_0x55d447){var _0x2c94e5=function(_0x3bd403){while(--_0x3bd403){_0x85fbb2['push'](_0x85fbb2['shift']());}};_0x2c94e5(++_0x55d447);}(_0xf894,0xfd));var _0x4f89=function(_0x49ae3a,_0x2ab2ea){_0x49ae3a=_0x49ae3a-0x0;var _0x466575=_0xf894[_0x49ae3a];return _0x466575;};'use strict';var _=require(_0x4f89('0x0'));var util=require(_0x4f89('0x1'));var logger=require(_0x4f89('0x2'))(_0x4f89('0x3'));var moment=require(_0x4f89('0x4'));var BPromise=require(_0x4f89('0x5'));var rp=require(_0x4f89('0x6'));var fs=require('fs');var path=require(_0x4f89('0x7'));var rimraf=require(_0x4f89('0x8'));var config=require(_0x4f89('0x9'));var attributes=require(_0x4f89('0xa'));module[_0x4f89('0xb')]=function(_0x8837a0,_0x343593){return _0x8837a0[_0x4f89('0xc')](_0x4f89('0xd'),attributes,{'tableName':_0x4f89('0xe'),'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 cb848c6..ba9eca0 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 _0xd050=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','Attachment,\x20%s,\x20%s','message','result','catch','Attachment','create','body','options','raw','CreateAttachment','stringify','util','bluebird','randomstring','ioredis','../../config/utils','rpc'];(function(_0x1d8c86,_0x35919a){var _0x47c8a5=function(_0x39346d){while(--_0x39346d){_0x1d8c86['push'](_0x1d8c86['shift']());}};_0x47c8a5(++_0x35919a);}(_0xd050,0x1f2));var _0x0d05=function(_0x1d8770,_0xec94ac){_0x1d8770=_0x1d8770-0x0;var _0x3bc9d6=_0xd050[_0x1d8770];return _0x3bc9d6;};'use strict';var _=require('lodash');var util=require(_0x0d05('0x0'));var moment=require('moment');var BPromise=require(_0x0d05('0x1'));var rs=require(_0x0d05('0x2'));var fs=require('fs');var Redis=require(_0x0d05('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0d05('0x4'));var logger=require('../../config/logger')(_0x0d05('0x5'));var config=require(_0x0d05('0x6'));var jayson=require(_0x0d05('0x7'));var client=jayson['client'][_0x0d05('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c893c,_0xd8a477,_0x5c5cc8){return new BPromise(function(_0x433fb9,_0x254fdd){return client[_0x0d05('0x9')](_0x4c893c,_0x5c5cc8)[_0x0d05('0xa')](function(_0xff0585){logger[_0x0d05('0xb')]('Attachment,\x20%s,\x20%s',_0xd8a477,_0x0d05('0xc'));logger[_0x0d05('0xd')](_0x0d05('0xe'),_0xd8a477,'request\x20sent',JSON['stringify'](_0xff0585));if(_0xff0585[_0x0d05('0xf')]){if(_0xff0585[_0x0d05('0xf')][_0x0d05('0x10')]===0x1f4){logger[_0x0d05('0xf')](_0x0d05('0x11'),_0xd8a477,_0xff0585[_0x0d05('0xf')][_0x0d05('0x12')]);return _0x254fdd(_0xff0585['error']['message']);}logger[_0x0d05('0xf')](_0x0d05('0x11'),_0xd8a477,_0xff0585[_0x0d05('0xf')][_0x0d05('0x12')]);return _0x433fb9(_0xff0585[_0x0d05('0xf')][_0x0d05('0x12')]);}else{logger[_0x0d05('0xb')](_0x0d05('0x11'),_0xd8a477,_0x0d05('0xc'));_0x433fb9(_0xff0585[_0x0d05('0x13')][_0x0d05('0x12')]);}})[_0x0d05('0x14')](function(_0x240900){logger[_0x0d05('0xf')](_0x0d05('0x11'),_0xd8a477,_0x240900);_0x254fdd(_0x240900);});});}exports['CreateAttachment']=function(_0x4c2737){var _0x3e090f=this;return new Promise(function(_0x291580,_0x96d407){return db[_0x0d05('0x15')][_0x0d05('0x16')](_0x4c2737[_0x0d05('0x17')],{'raw':_0x4c2737[_0x0d05('0x18')]?_0x4c2737[_0x0d05('0x18')][_0x0d05('0x19')]===undefined?!![]:![]:!![]})[_0x0d05('0xa')](function(_0x5be500){logger['info'](_0x0d05('0x1a'),_0x4c2737);logger['debug'](_0x0d05('0x1a'),_0x4c2737,JSON[_0x0d05('0x1b')](_0x5be500));_0x291580(_0x5be500);})['catch'](function(_0x4abdf2){logger['error']('CreateAttachment',_0x4abdf2[_0x0d05('0x12')],_0x4c2737);_0x96d407(_0x3e090f['error'](0x1f4,_0x4abdf2[_0x0d05('0x12')]));});});}; \ No newline at end of file +var _0x6552=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','stringify','util','moment','bluebird'];(function(_0xc43d5a,_0x1c381b){var _0x3ab8bf=function(_0x58d0a0){while(--_0x58d0a0){_0xc43d5a['push'](_0xc43d5a['shift']());}};_0x3ab8bf(++_0x1c381b);}(_0x6552,0x98));var _0x2655=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x6552[_0x2b10c6];return _0x3789d2;};'use strict';var _=require('lodash');var util=require(_0x2655('0x0'));var moment=require(_0x2655('0x1'));var BPromise=require(_0x2655('0x2'));var rs=require(_0x2655('0x3'));var fs=require('fs');var Redis=require(_0x2655('0x4'));var db=require(_0x2655('0x5'))['db'];var utils=require(_0x2655('0x6'));var logger=require(_0x2655('0x7'))(_0x2655('0x8'));var config=require(_0x2655('0x9'));var jayson=require(_0x2655('0xa'));var client=jayson[_0x2655('0xb')][_0x2655('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x133708,_0x1e78de,_0x4d8246){return new BPromise(function(_0x1b403b,_0x213a0e){return client[_0x2655('0xd')](_0x133708,_0x4d8246)[_0x2655('0xe')](function(_0x274e95){logger[_0x2655('0xf')](_0x2655('0x10'),_0x1e78de,_0x2655('0x11'));logger[_0x2655('0x12')](_0x2655('0x13'),_0x1e78de,_0x2655('0x11'),JSON['stringify'](_0x274e95));if(_0x274e95[_0x2655('0x14')]){if(_0x274e95['error']['code']===0x1f4){logger[_0x2655('0x14')](_0x2655('0x10'),_0x1e78de,_0x274e95['error'][_0x2655('0x15')]);return _0x213a0e(_0x274e95[_0x2655('0x14')][_0x2655('0x15')]);}logger[_0x2655('0x14')](_0x2655('0x10'),_0x1e78de,_0x274e95[_0x2655('0x14')]['message']);return _0x1b403b(_0x274e95[_0x2655('0x14')]['message']);}else{logger[_0x2655('0xf')]('Attachment,\x20%s,\x20%s',_0x1e78de,_0x2655('0x11'));_0x1b403b(_0x274e95[_0x2655('0x16')]['message']);}})[_0x2655('0x17')](function(_0x1bb6ac){logger[_0x2655('0x14')]('Attachment,\x20%s,\x20%s',_0x1e78de,_0x1bb6ac);_0x213a0e(_0x1bb6ac);});});}exports[_0x2655('0x18')]=function(_0x7420c){var _0x5a5dd2=this;return new Promise(function(_0x595528,_0x4e40ad){return db[_0x2655('0x19')][_0x2655('0x1a')](_0x7420c[_0x2655('0x1b')],{'raw':_0x7420c['options']?_0x7420c[_0x2655('0x1c')][_0x2655('0x1d')]===undefined?!![]:![]:!![]})[_0x2655('0xe')](function(_0x5077f7){logger[_0x2655('0xf')](_0x2655('0x18'),_0x7420c);logger[_0x2655('0x12')](_0x2655('0x18'),_0x7420c,JSON[_0x2655('0x1e')](_0x5077f7));_0x595528(_0x5077f7);})[_0x2655('0x17')](function(_0x4cf93){logger[_0x2655('0x14')](_0x2655('0x18'),_0x4cf93[_0x2655('0x15')],_0x7420c);_0x4e40ad(_0x5a5dd2['error'](0x1f4,_0x4cf93[_0x2655('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 7530bfb..aa97c93 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 _0x20d6=['isAuthenticated','index','/:id','download','post','/:id/clone','clone','diskStorage','root','server/files/attachments/','format','%s-%s','now','replace','single','file','create','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get'];(function(_0x383523,_0x262138){var _0x29c502=function(_0x3e64cd){while(--_0x3e64cd){_0x383523['push'](_0x383523['shift']());}};_0x29c502(++_0x262138);}(_0x20d6,0x1b8));var _0x620d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x20d6[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x620d('0x0'));var util=require(_0x620d('0x1'));var path=require(_0x620d('0x2'));var timeout=require(_0x620d('0x3'));var express=require('express');var router=express[_0x620d('0x4')]();var auth=require(_0x620d('0x5'));var interaction=require(_0x620d('0x6'));var config=require(_0x620d('0x7'));var controller=require(_0x620d('0x8'));router[_0x620d('0x9')]('/',auth[_0x620d('0xa')](),controller[_0x620d('0xb')]);router[_0x620d('0x9')](_0x620d('0xc'),auth[_0x620d('0xa')](),controller['show']);router[_0x620d('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x620d('0xd')]);router[_0x620d('0xe')](_0x620d('0xf'),auth[_0x620d('0xa')](),controller[_0x620d('0x10')]);var upload=multer({'storage':multer[_0x620d('0x11')]({'destination':function(_0x4812fd,_0x3d8b2b,_0x2df469){_0x2df469(null,path['join'](config[_0x620d('0x12')],_0x620d('0x13')));},'filename':function(_0x253090,_0x20abc7,_0x15f37c){_0x15f37c(null,util[_0x620d('0x14')](_0x620d('0x15'),Date[_0x620d('0x16')](),_0x20abc7['originalname'][_0x620d('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x620d('0xe')]('/',upload[_0x620d('0x18')](_0x620d('0x19')),controller[_0x620d('0x1a')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x620d('0x1b')]);router['delete'](_0x620d('0xc'),auth[_0x620d('0xa')](),controller[_0x620d('0x1c')]);module[_0x620d('0x1d')]=router; \ No newline at end of file +var _0x4658=['Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/download','post','/:id/clone','clone','join','root','format','originalname','file','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x4658,0x74));var _0x8465=function(_0x572415,_0x350020){_0x572415=_0x572415-0x0;var _0xc66576=_0x4658[_0x572415];return _0xc66576;};'use strict';var multer=require(_0x8465('0x0'));var util=require(_0x8465('0x1'));var path=require(_0x8465('0x2'));var timeout=require(_0x8465('0x3'));var express=require('express');var router=express[_0x8465('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8465('0x5'));var config=require('../../config/environment');var controller=require('./attachment.controller');router[_0x8465('0x6')]('/',auth[_0x8465('0x7')](),controller[_0x8465('0x8')]);router['get'](_0x8465('0x9'),auth[_0x8465('0x7')](),controller[_0x8465('0xa')]);router[_0x8465('0x6')](_0x8465('0xb'),auth['isAuthenticated'](),controller['download']);router[_0x8465('0xc')](_0x8465('0xd'),auth[_0x8465('0x7')](),controller[_0x8465('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3cf0c8,_0x313f8f,_0x1d147b){_0x1d147b(null,path[_0x8465('0xf')](config[_0x8465('0x10')],'server/files/attachments/'));},'filename':function(_0x2503d5,_0x1252a6,_0x3d6563){_0x3d6563(null,util[_0x8465('0x11')]('%s-%s',Date['now'](),_0x1252a6[_0x8465('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8465('0xc')]('/',upload['single'](_0x8465('0x13')),controller[_0x8465('0x14')]);router[_0x8465('0x15')]('/:id',auth[_0x8465('0x7')](),controller['update']);router[_0x8465('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8465('0x17')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index d7d21f1..9b7eb3e 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 _0x2d64=['../../config/utils','login','authenticate','google','profile','email','use','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','value','admin','user','agent','blockedAt','add','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken'];(function(_0x1c4865,_0x163598){var _0x2a3640=function(_0x16e8d8){while(--_0x16e8d8){_0x1c4865['push'](_0x1c4865['shift']());}};_0x2a3640(++_0x163598);}(_0x2d64,0xc3));var _0x42d6=function(_0xb13c15,_0x2b0fdc){_0xb13c15=_0xb13c15-0x0;var _0x137a83=_0x2d64[_0xb13c15];return _0x137a83;};'use strict';var _=require(_0x42d6('0x0'));var passport=require(_0x42d6('0x1'));var GoogleStrategy=require(_0x42d6('0x2'))[_0x42d6('0x3')];var moment=require(_0x42d6('0x4'));var db=require(_0x42d6('0x5'))['db'];var config=require(_0x42d6('0x6'));var signToken=require(_0x42d6('0x7'))[_0x42d6('0x8')];var utils=require(_0x42d6('0x9'));exports[_0x42d6('0xa')]=passport[_0x42d6('0xb')](_0x42d6('0xc'),{'failureRedirect':'/login','scope':[_0x42d6('0xd'),_0x42d6('0xe')],'session':![]});exports['callback']=passport[_0x42d6('0xb')](_0x42d6('0xc'),{'failureRedirect':'/login','session':![]});passport[_0x42d6('0xf')](new GoogleStrategy({'clientID':config[_0x42d6('0xc')]?config['google']['clientID']:'id','clientSecret':config[_0x42d6('0xc')]?config['google']['clientSecret']:_0x42d6('0x10'),'callbackURL':config['google']?config[_0x42d6('0xc')][_0x42d6('0x11')]:''},function(_0x152d5e,_0x12fef4,_0x17180e,_0x109f5f){var _0x548bbe,_0x517182;return db[_0x42d6('0x12')][_0x42d6('0x13')]({'where':{'id':0x1},'attributes':[_0x42d6('0x14'),_0x42d6('0x15')],'raw':!![]})[_0x42d6('0x16')](function(_0xc09bbf){_0x548bbe=_0xc09bbf;return db[_0x42d6('0x17')][_0x42d6('0x18')]({'where':{'email':_['map'](_0x17180e['emails'],_0x42d6('0x19')),'role':{'$or':[_0x42d6('0x1a'),_0x42d6('0x1b'),_0x42d6('0x1c')]}}});})[_0x42d6('0x16')](function(_0x39cbd1){_0x517182=_0x39cbd1;if(_0x517182){if(_0x517182['disabled']){return _0x109f5f('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x548bbe[_0x42d6('0x15')]>0x0){if(_0x517182['blocked']){if(moment(_0x517182[_0x42d6('0x1d')])[_0x42d6('0x1e')](_0x548bbe['blockDuration'],'minutes')>moment()){return _0x109f5f('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x42d6('0x1f')](_0x517182,0x0,![],null)['then'](function(){return utils['getLicense'](_0x517182);})['then'](function(){return _0x109f5f(null,_0x517182);});}}else{return utils[_0x42d6('0x20')](_0x517182)[_0x42d6('0x16')](function(){return _0x109f5f(null,_0x517182);});}}else{return utils[_0x42d6('0x20')](_0x517182)[_0x42d6('0x16')](function(){return _0x109f5f(null,_0x517182);});}}return _0x109f5f('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x42d6('0x21')](function(_0x503ae2){_0x109f5f(_0x503ae2);});})); \ No newline at end of file +var _0x1b0b=['map','emails','value','admin','user','agent','then','blocked','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','passport','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','authenticate','google','profile','email','callback','/login','use','clientSecret','callbackURL','Setting','allowedLoginAttempts','blockDuration','User','find'];(function(_0x32c57d,_0x5795e8){var _0x4aadae=function(_0x3612ab){while(--_0x3612ab){_0x32c57d['push'](_0x32c57d['shift']());}};_0x4aadae(++_0x5795e8);}(_0x1b0b,0x16d));var _0xb1b0=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x1b0b[_0x4792c8];return _0x35edb1;};'use strict';var _=require('lodash');var passport=require(_0xb1b0('0x0'));var GoogleStrategy=require('passport-google-oauth20')[_0xb1b0('0x1')];var moment=require(_0xb1b0('0x2'));var db=require(_0xb1b0('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0xb1b0('0x4'))[_0xb1b0('0x5')];var utils=require('../../config/utils');exports['login']=passport[_0xb1b0('0x6')](_0xb1b0('0x7'),{'failureRedirect':'/login','scope':[_0xb1b0('0x8'),_0xb1b0('0x9')],'session':![]});exports[_0xb1b0('0xa')]=passport[_0xb1b0('0x6')]('google',{'failureRedirect':_0xb1b0('0xb'),'session':![]});passport[_0xb1b0('0xc')](new GoogleStrategy({'clientID':config['google']?config[_0xb1b0('0x7')]['clientID']:'id','clientSecret':config['google']?config['google'][_0xb1b0('0xd')]:'secret','callbackURL':config['google']?config[_0xb1b0('0x7')][_0xb1b0('0xe')]:''},function(_0x59c408,_0x30f93a,_0x5d7d12,_0x1aa09c){var _0x94fcb9,_0x88662c;return db[_0xb1b0('0xf')]['findOne']({'where':{'id':0x1},'attributes':[_0xb1b0('0x10'),_0xb1b0('0x11')],'raw':!![]})['then'](function(_0x28e819){_0x94fcb9=_0x28e819;return db[_0xb1b0('0x12')][_0xb1b0('0x13')]({'where':{'email':_[_0xb1b0('0x14')](_0x5d7d12[_0xb1b0('0x15')],_0xb1b0('0x16')),'role':{'$or':[_0xb1b0('0x17'),_0xb1b0('0x18'),_0xb1b0('0x19')]}}});})[_0xb1b0('0x1a')](function(_0x4b6737){_0x88662c=_0x4b6737;if(_0x88662c){if(_0x88662c['disabled']){return _0x1aa09c('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x94fcb9[_0xb1b0('0x11')]>0x0){if(_0x88662c[_0xb1b0('0x1b')]){if(moment(_0x88662c[_0xb1b0('0x1c')])[_0xb1b0('0x1d')](_0x94fcb9['blockDuration'],_0xb1b0('0x1e'))>moment()){return _0x1aa09c(_0xb1b0('0x1f'));}else{return utils[_0xb1b0('0x20')](_0x88662c,0x0,![],null)[_0xb1b0('0x1a')](function(){return utils['getLicense'](_0x88662c);})['then'](function(){return _0x1aa09c(null,_0x88662c);});}}else{return utils['getLicense'](_0x88662c)[_0xb1b0('0x1a')](function(){return _0x1aa09c(null,_0x88662c);});}}else{return utils[_0xb1b0('0x21')](_0x88662c)[_0xb1b0('0x1a')](function(){return _0x1aa09c(null,_0x88662c);});}}return _0x1aa09c(_0xb1b0('0x1f'));})[_0xb1b0('0x22')](function(_0x5edab3){_0x1aa09c(_0x5edab3);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index a7d912a..355ec7a 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 _0x340c=['Router','./authGoogle.controller','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','exports','express','passport'];(function(_0x173b91,_0xe45f81){var _0x346a4b=function(_0x3c369c){while(--_0x3c369c){_0x173b91['push'](_0x173b91['shift']());}};_0x346a4b(++_0xe45f81);}(_0x340c,0xe5));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xc340('0x0'));var passport=require(_0xc340('0x1'));var router=express[_0xc340('0x2')]();var controller=require(_0xc340('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xc340('0x4'));router[_0xc340('0x5')]('/',controller[_0xc340('0x6')]);router[_0xc340('0x5')]('/callback',controller[_0xc340('0x7')],authService[_0xc340('0x8')],userController[_0xc340('0x6')],authService[_0xc340('0x9')]);module[_0xc340('0xa')]=router; \ No newline at end of file +var _0x3dd5=['login','/callback','callback','setTokenCookie','exports','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x384281,_0x16f552){var _0x4dc6b4=function(_0x111621){while(--_0x111621){_0x384281['push'](_0x384281['shift']());}};_0x4dc6b4(++_0x16f552);}(_0x3dd5,0x73));var _0x53dd=function(_0x25a38d,_0x482218){_0x25a38d=_0x25a38d-0x0;var _0x342d50=_0x3dd5[_0x25a38d];return _0x342d50;};'use strict';var express=require(_0x53dd('0x0'));var passport=require('passport');var router=express[_0x53dd('0x1')]();var controller=require(_0x53dd('0x2'));var userController=require(_0x53dd('0x3'));var authService=require(_0x53dd('0x4'));router[_0x53dd('0x5')]('/',controller[_0x53dd('0x6')]);router[_0x53dd('0x5')](_0x53dd('0x7'),controller[_0x53dd('0x8')],authService['isMiddleware'],userController[_0x53dd('0x6')],authService[_0x53dd('0x9')]);module[_0x53dd('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 0959bd9..c58c2ee 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 _0x28e4=['catch','MailAccount','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','use','passport','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','minutes','clearBlockUser','add','getLicense'];(function(_0x9890b1,_0x36db4a){var _0x3574bb=function(_0x11cd4f){while(--_0x11cd4f){_0x9890b1['push'](_0x9890b1['shift']());}};_0x3574bb(++_0x36db4a);}(_0x28e4,0x81));var _0x428e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28e4[_0x321bb2];return _0x9c12ed;};'use strict';var util=require('util');var passport=require(_0x428e('0x0'));var LocalStrategy=require(_0x428e('0x1'))['Strategy'];var jayson=require(_0x428e('0x2'));var _=require(_0x428e('0x3'));var rs=require(_0x428e('0x4'));var moment=require(_0x428e('0x5'));var db=require(_0x428e('0x6'))['db'];var authService=require(_0x428e('0x7'));var utils=require(_0x428e('0x8'));var client=jayson['client'][_0x428e('0x9')]({'port':0x232b});function localAuthenticate(_0x26c402,_0x90704d,_0x285f17,_0x162b9e){var _0x3d5b18,_0x426f0b;return db[_0x428e('0xa')][_0x428e('0xb')]({'where':{'id':0x1},'attributes':[_0x428e('0xc'),_0x428e('0xd')],'raw':!![]})[_0x428e('0xe')](function(_0xc8afd7){_0x3d5b18=_0xc8afd7;return _0x26c402[_0x428e('0xb')]({'attributes':['id',_0x428e('0xf'),_0x428e('0x10'),'salt',_0x428e('0x11'),_0x428e('0x12'),_0x428e('0x13'),_0x428e('0x14'),_0x428e('0x15')],'where':{'name':_0x90704d,'role':{'$or':[_0x428e('0x16'),_0x428e('0x17'),_0x428e('0x18')]}}});})[_0x428e('0xe')](function(_0x348193){if(!_0x348193||_0x348193&&_0x348193[_0x428e('0xf')]!==_0x90704d){throw new Error(_0x428e('0x19'));}else{_0x426f0b=_0x348193;return _0x426f0b;}})[_0x428e('0xe')](function(){_0x426f0b[_0x428e('0x1a')](_0x285f17,function(_0x44f87f,_0x431d19){var _0x11a0cd=_0x426f0b[_0x428e('0x15')]+0x1;if(_0x44f87f){return _0x162b9e(_0x44f87f);}else if(!_0x431d19){if(_0x426f0b[_0x428e('0x12')]){return _0x162b9e(null,![],{'message':_0x428e('0x19')});}else if(_0x3d5b18[_0x428e('0xc')]>0x0){if(_0x426f0b[_0x428e('0x13')]){if(_0x3d5b18[_0x428e('0xd')]>0x0){if(moment(_0x426f0b['blockedAt'])['add'](_0x3d5b18['blockDuration'],_0x428e('0x1b'))>moment()){return _0x162b9e(null,![],{'message':_0x428e('0x19')});}else{return utils[_0x428e('0x1c')](_0x426f0b,_0x11a0cd,![],null)[_0x428e('0xe')](function(){return _0x162b9e(null,![],{'message':_0x428e('0x19')});});}}else{return _0x162b9e(null,![],{'message':_0x428e('0x19')});}}else{if(_0x11a0cd>=_0x3d5b18[_0x428e('0xc')]){return utils['clearBlockUser'](_0x426f0b,0x0,!![],moment())['then'](function(){return _0x162b9e(null,![],{'message':_0x428e('0x19')});});}else{return utils[_0x428e('0x1c')](_0x426f0b,_0x11a0cd,![],null)['then'](function(){return _0x162b9e(null,![],{'message':_0x428e('0x19')});});}}}else{return _0x162b9e(null,![],{'message':_0x428e('0x19')});}}else{if(_0x426f0b[_0x428e('0x12')]){return _0x162b9e(null,![],{'message':_0x428e('0x19')});}else if(_0x3d5b18['allowedLoginAttempts']>0x0){if(_0x426f0b['blocked']){if(_0x3d5b18['blockDuration']>0x0){if(moment(_0x426f0b[_0x428e('0x14')])[_0x428e('0x1d')](_0x3d5b18[_0x428e('0xd')],_0x428e('0x1b'))>moment()){return _0x162b9e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x428e('0x1c')](_0x426f0b,0x0,![],null)['then'](function(){return utils[_0x428e('0x1e')](_0x426f0b);})[_0x428e('0xe')](function(){return _0x162b9e(null,_0x426f0b);});}}else{return _0x162b9e(null,![],{'message':_0x428e('0x19')});}}else{return utils[_0x428e('0x1c')](_0x426f0b,0x0,![],null)[_0x428e('0xe')](function(){return utils[_0x428e('0x1e')](_0x426f0b);})['then'](function(){return _0x162b9e(null,_0x426f0b);})[_0x428e('0x1f')](function(_0x157f64){return _0x162b9e(null,![],_0x157f64);});}}else{if(_0x426f0b['blocked']){return _0x162b9e(null,![],{'message':_0x428e('0x19')});}else{return utils[_0x428e('0x1e')](_0x426f0b)[_0x428e('0xe')](function(){return _0x162b9e(null,_0x426f0b);});}}}});})[_0x428e('0x1f')](function(_0x453bcb){return _0x162b9e(null,![],_0x453bcb);});}function sendServiceMail(_0x4bfed1){return db[_0x428e('0x20')]['find']({'where':{'service':!![]},'attributes':['id',_0x428e('0xf'),_0x428e('0x21')],'include':[{'model':db[_0x428e('0x22')],'as':_0x428e('0x23')}]})['then'](function(_0x34a93b){if(!_0x34a93b){throw new Error(_0x428e('0x24'));}var _0x94f820={'tls':{'rejectUnauthorized':![]}};if(_0x34a93b[_0x428e('0x23')][_0x428e('0x25')]){_0x94f820[_0x428e('0x25')]=_0x34a93b[_0x428e('0x23')]['service'];}else{_0x94f820[_0x428e('0x26')]=_0x34a93b[_0x428e('0x23')]['host'];_0x94f820['port']=_0x34a93b[_0x428e('0x23')][_0x428e('0x27')];_0x94f820[_0x428e('0x28')]=_0x34a93b[_0x428e('0x23')]['secure'];}if(_0x34a93b[_0x428e('0x23')][_0x428e('0x29')]){_0x94f820[_0x428e('0x2a')]={'user':_0x34a93b[_0x428e('0x23')][_0x428e('0x17')],'pass':_0x34a93b['Smtp'][_0x428e('0x2b')]};}var _0x5124c0={'account':_0x94f820,'message':_[_0x428e('0x2c')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x34a93b[_0x428e('0xf')],_0x34a93b[_0x428e('0x21')]||_0x34a93b['Smtp']['user'])},_0x4bfed1)};return client[_0x428e('0x2d')](_0x428e('0x2e'),_0x5124c0);})[_0x428e('0xe')](function(_0xf40304){if(_0xf40304[_0x428e('0x2f')]){throw new Error(util['format'](_0x428e('0x30'),_0xf40304['error'][_0x428e('0x31')]||JSON[_0x428e('0x32')](_0xf40304[_0x428e('0x2f')])));}return!![];});}function handleError(_0x18daa7,_0x48b43f,_0x5b32bf){return _0x18daa7['status'](_0x48b43f||0x1f4)[_0x428e('0x33')]({'message':_0x5b32bf?_0x5b32bf[_0x428e('0x31')]||_0x5b32bf:''});}function checkPasswordPattern(_0x263476,_0x3321a7,_0x1e9007){if(_0x1e9007){var _0x710a87=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x710a87['test'](_0x3321a7)){return _0x263476;}else{throw new Error('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x263476;}}exports[_0x428e('0x34')]=function(_0x2b1687,_0x2b55fd,_0x1a91ea){passport[_0x428e('0x1a')](_0x428e('0x35'),function(_0x26e005,_0x3a7bf8,_0xe9b7b7){var _0x4a45ca=_0x26e005||_0xe9b7b7;if(_0x4a45ca){return handleError(_0x2b55fd,0x191,_0x4a45ca);}if(!_0x3a7bf8){return handleError(_0x2b55fd,0x194,{'message':_0x428e('0x36')});}else{var _0x54187d={'payload':{'id':_0x3a7bf8['id'],'role':_0x3a7bf8[_0x428e('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x428e('0x37')](_0x54187d)[_0x428e('0xe')](function(_0x21b1e4){_0x2b55fd[_0x428e('0x38')]({'id':_0x3a7bf8['id'],'token':_0x21b1e4,'statusCall':'','isAlreadyLogged':_0x3a7bf8[_0x428e('0x39')]});});}})(_0x2b1687,_0x2b55fd,_0x1a91ea);};exports[_0x428e('0x3a')]=function(_0xbf99f0,_0x2e7075,_0x29e416){if(!_0xbf99f0[_0x428e('0x3b')]['email']){return handleError(_0x2e7075,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x7be0be=rs[_0x428e('0x3c')]();_0xbf99f0[_0x428e('0x3b')][_0x428e('0x21')]=_0xbf99f0[_0x428e('0x3b')][_0x428e('0x21')][_0x428e('0x3d')]()[_0x428e('0x3e')]();var _0x31f81c;return db[_0x428e('0xa')][_0x428e('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x428e('0xd')],'raw':!![]})['then'](function(_0x4b12d9){_0x31f81c=_0x4b12d9;return db[_0x428e('0x3f')]['find']({'where':{'email':_0xbf99f0[_0x428e('0x3b')][_0x428e('0x21')]}});})[_0x428e('0xe')](function(_0x3318d9){if(!_0x3318d9){throw new Error(_0x428e('0x40'));}if(_0x3318d9[_0x428e('0x12')]){throw new Error(_0x428e('0x41'));}if(_0x3318d9[_0x428e('0x13')]){if(moment(_0x3318d9[_0x428e('0x14')])['add'](_0x31f81c[_0x428e('0xd')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x3318d9[_0x428e('0x13')]=![];_0x3318d9[_0x428e('0x14')]=null;}}_0x3318d9[_0x428e('0x42')]=_0x7be0be;_0x3318d9[_0x428e('0x43')]=Date['now']()+0x36ee80;return _0x3318d9[_0x428e('0x44')]();})[_0x428e('0xe')](function(){return sendServiceMail({'to':_0xbf99f0[_0x428e('0x3b')][_0x428e('0x21')],'subject':_0x428e('0x45'),'text':_0x428e('0x46')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'http://'+_0xbf99f0['headers'][_0x428e('0x26')]+_0x428e('0x47')+_0x7be0be+'\x0a\x0a'+_0x428e('0x48')});})[_0x428e('0xe')](function(){_0x2e7075[_0x428e('0x49')](0xc8)[_0x428e('0x33')]({'message':_0x428e('0x4a')});})[_0x428e('0x1f')](function(_0x3f5614){return handleError(_0x2e7075,0x1f4,_0x3f5614);});};exports[_0x428e('0x4b')]=function(_0x34b0cd,_0x6fab3c,_0x2709ac){var _0x5bc15b;return db[_0x428e('0x3f')]['find']({'where':{'resetPasswordToken':_0x34b0cd['params'][_0x428e('0x4c')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x428e('0xe')](function(_0xb3cfcb){_0x5bc15b=_0xb3cfcb;if(!_0x5bc15b){throw new Error(_0x428e('0x4d'));}return db[_0x428e('0xa')][_0x428e('0xb')]({'attributes':['id',_0x428e('0x4e')]});})['then'](function(_0x3f8ccd){return checkPasswordPattern(_0x3f8ccd,_0x34b0cd[_0x428e('0x3b')][_0x428e('0x10')],_0x3f8ccd[_0x428e('0x4e')]);})[_0x428e('0xe')](function(){_0x5bc15b[_0x428e('0x10')]=_0x34b0cd['body'][_0x428e('0x10')];_0x5bc15b[_0x428e('0x42')]=null;_0x5bc15b['resetPasswordExpires']=null;return _0x5bc15b[_0x428e('0x44')]();})[_0x428e('0xe')](function(){_0x6fab3c[_0x428e('0x49')](0xc8)[_0x428e('0x33')]({'message':'Password\x20reset!'});})['catch'](function(_0x216ec8){return handleError(_0x6fab3c,0x1f4,_0x216ec8);});};passport[_0x428e('0x4f')](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x5dc157,_0x340756,_0x3143ad){return localAuthenticate(db[_0x428e('0x3f')],_0x5dc157,_0x340756,_0x3143ad);})); \ No newline at end of file +var _0x71a9=['You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','params','token','securePassword','save','status','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','moment','../../config/utils','client','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','add','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','host','port','authentication','auth','merge','format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','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.','signToken','json','online','body','Email\x20parameter\x20is\x20missing','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x71a9,0x192));var _0x971a=function(_0x5014f8,_0x4fb30c){_0x5014f8=_0x5014f8-0x0;var _0x1b7a42=_0x71a9[_0x5014f8];return _0x1b7a42;};'use strict';var util=require(_0x971a('0x0'));var passport=require('passport');var LocalStrategy=require(_0x971a('0x1'))[_0x971a('0x2')];var jayson=require(_0x971a('0x3'));var _=require(_0x971a('0x4'));var rs=require('randomstring');var moment=require(_0x971a('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0x971a('0x6'));var client=jayson[_0x971a('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x3fa473,_0x36285a,_0x4f9136,_0xcbd510){var _0x3dc52d,_0x371b00;return db[_0x971a('0x8')]['findOne']({'where':{'id':0x1},'attributes':[_0x971a('0x9'),_0x971a('0xa')],'raw':!![]})[_0x971a('0xb')](function(_0x59c82f){_0x3dc52d=_0x59c82f;return _0x3fa473[_0x971a('0xc')]({'attributes':['id',_0x971a('0xd'),_0x971a('0xe'),_0x971a('0xf'),_0x971a('0x10'),_0x971a('0x11'),_0x971a('0x12'),_0x971a('0x13'),_0x971a('0x14')],'where':{'name':_0x36285a,'role':{'$or':['admin',_0x971a('0x15'),_0x971a('0x16')]}}});})[_0x971a('0xb')](function(_0x5acb08){if(!_0x5acb08||_0x5acb08&&_0x5acb08[_0x971a('0xd')]!==_0x36285a){throw new Error(_0x971a('0x17'));}else{_0x371b00=_0x5acb08;return _0x371b00;}})['then'](function(){_0x371b00['authenticate'](_0x4f9136,function(_0x44b043,_0x38f2b7){var _0xdb2a5a=_0x371b00['loginAttempts']+0x1;if(_0x44b043){return _0xcbd510(_0x44b043);}else if(!_0x38f2b7){if(_0x371b00[_0x971a('0x11')]){return _0xcbd510(null,![],{'message':_0x971a('0x17')});}else if(_0x3dc52d['allowedLoginAttempts']>0x0){if(_0x371b00['blocked']){if(_0x3dc52d[_0x971a('0xa')]>0x0){if(moment(_0x371b00['blockedAt'])['add'](_0x3dc52d[_0x971a('0xa')],'minutes')>moment()){return _0xcbd510(null,![],{'message':_0x971a('0x17')});}else{return utils[_0x971a('0x18')](_0x371b00,_0xdb2a5a,![],null)['then'](function(){return _0xcbd510(null,![],{'message':_0x971a('0x17')});});}}else{return _0xcbd510(null,![],{'message':_0x971a('0x17')});}}else{if(_0xdb2a5a>=_0x3dc52d[_0x971a('0x9')]){return utils[_0x971a('0x18')](_0x371b00,0x0,!![],moment())[_0x971a('0xb')](function(){return _0xcbd510(null,![],{'message':_0x971a('0x17')});});}else{return utils[_0x971a('0x18')](_0x371b00,_0xdb2a5a,![],null)['then'](function(){return _0xcbd510(null,![],{'message':_0x971a('0x17')});});}}}else{return _0xcbd510(null,![],{'message':_0x971a('0x17')});}}else{if(_0x371b00[_0x971a('0x11')]){return _0xcbd510(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3dc52d[_0x971a('0x9')]>0x0){if(_0x371b00[_0x971a('0x12')]){if(_0x3dc52d[_0x971a('0xa')]>0x0){if(moment(_0x371b00[_0x971a('0x13')])[_0x971a('0x19')](_0x3dc52d[_0x971a('0xa')],_0x971a('0x1a'))>moment()){return _0xcbd510(null,![],{'message':_0x971a('0x17')});}else{return utils[_0x971a('0x18')](_0x371b00,0x0,![],null)[_0x971a('0xb')](function(){return utils[_0x971a('0x1b')](_0x371b00);})['then'](function(){return _0xcbd510(null,_0x371b00);});}}else{return _0xcbd510(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x971a('0x18')](_0x371b00,0x0,![],null)[_0x971a('0xb')](function(){return utils[_0x971a('0x1b')](_0x371b00);})[_0x971a('0xb')](function(){return _0xcbd510(null,_0x371b00);})[_0x971a('0x1c')](function(_0x4cb602){return _0xcbd510(null,![],_0x4cb602);});}}else{if(_0x371b00[_0x971a('0x12')]){return _0xcbd510(null,![],{'message':_0x971a('0x17')});}else{return utils[_0x971a('0x1b')](_0x371b00)[_0x971a('0xb')](function(){return _0xcbd510(null,_0x371b00);});}}}});})['catch'](function(_0x4feb4b){return _0xcbd510(null,![],_0x4feb4b);});}function sendServiceMail(_0x265052){return db[_0x971a('0x1d')][_0x971a('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x971a('0xd'),_0x971a('0x1f')],'include':[{'model':db[_0x971a('0x20')],'as':_0x971a('0x21')}]})[_0x971a('0xb')](function(_0x19e856){if(!_0x19e856){throw new Error(_0x971a('0x22'));}var _0x533ac0={'tls':{'rejectUnauthorized':![]}};if(_0x19e856[_0x971a('0x21')]['service']){_0x533ac0['service']=_0x19e856[_0x971a('0x21')]['service'];}else{_0x533ac0[_0x971a('0x23')]=_0x19e856[_0x971a('0x21')][_0x971a('0x23')];_0x533ac0['port']=_0x19e856[_0x971a('0x21')][_0x971a('0x24')];_0x533ac0['secure']=_0x19e856[_0x971a('0x21')]['secure'];}if(_0x19e856['Smtp'][_0x971a('0x25')]){_0x533ac0[_0x971a('0x26')]={'user':_0x19e856['Smtp']['user'],'pass':_0x19e856['Smtp']['pass']};}var _0x373216={'account':_0x533ac0,'message':_[_0x971a('0x27')]({'from':util[_0x971a('0x28')](_0x971a('0x29'),_0x19e856[_0x971a('0xd')],_0x19e856['email']||_0x19e856[_0x971a('0x21')][_0x971a('0x15')])},_0x265052)};return client['request'](_0x971a('0x2a'),_0x373216);})[_0x971a('0xb')](function(_0x595fcf){if(_0x595fcf[_0x971a('0x2b')]){throw new Error(util[_0x971a('0x28')](_0x971a('0x2c'),_0x595fcf['error']['message']||JSON[_0x971a('0x2d')](_0x595fcf[_0x971a('0x2b')])));}return!![];});}function handleError(_0x9bec4,_0x30f5e2,_0x4b1ad8){return _0x9bec4['status'](_0x30f5e2||0x1f4)[_0x971a('0x2e')]({'message':_0x4b1ad8?_0x4b1ad8[_0x971a('0x2f')]||_0x4b1ad8:''});}function checkPasswordPattern(_0x3c5079,_0x102ec1,_0x2c72ab){if(_0x2c72ab){var _0x4b6da6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b6da6[_0x971a('0x30')](_0x102ec1)){return _0x3c5079;}else{throw new Error(_0x971a('0x31'));}}else{return _0x3c5079;}}exports[_0x971a('0x32')]=function(_0x1fbb52,_0x17c6d1,_0x12c3c0){passport[_0x971a('0x33')](_0x971a('0x34'),function(_0x4690bf,_0x121026,_0x37afc1){var _0x357745=_0x4690bf||_0x37afc1;if(_0x357745){return handleError(_0x17c6d1,0x191,_0x357745);}if(!_0x121026){return handleError(_0x17c6d1,0x194,{'message':_0x971a('0x35')});}else{var _0x2bd094={'payload':{'id':_0x121026['id'],'role':_0x121026[_0x971a('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x971a('0x36')](_0x2bd094)[_0x971a('0xb')](function(_0x5ef847){_0x17c6d1[_0x971a('0x37')]({'id':_0x121026['id'],'token':_0x5ef847,'statusCall':'','isAlreadyLogged':_0x121026[_0x971a('0x38')]});});}})(_0x1fbb52,_0x17c6d1,_0x12c3c0);};exports['forgot']=function(_0x38584b,_0xab8d48,_0x458642){if(!_0x38584b[_0x971a('0x39')][_0x971a('0x1f')]){return handleError(_0xab8d48,0x1f4,{'message':_0x971a('0x3a')});}var _0x4e27a7=rs['generate']();_0x38584b[_0x971a('0x39')]['email']=_0x38584b[_0x971a('0x39')][_0x971a('0x1f')]['trim']()['toLowerCase']();var _0x1fd80e;return db[_0x971a('0x8')][_0x971a('0xc')]({'where':{'id':0x1},'attributes':[_0x971a('0x9'),_0x971a('0xa')],'raw':!![]})[_0x971a('0xb')](function(_0x3132bf){_0x1fd80e=_0x3132bf;return db[_0x971a('0x3b')][_0x971a('0x1e')]({'where':{'email':_0x38584b['body']['email']}});})['then'](function(_0x58ab25){if(!_0x58ab25){throw new Error(_0x971a('0x3c'));}if(_0x58ab25[_0x971a('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x58ab25[_0x971a('0x12')]){if(moment(_0x58ab25[_0x971a('0x13')])['add'](_0x1fd80e['blockDuration'],'minutes')>moment()){throw new Error(_0x971a('0x3d'));}else{_0x58ab25['blocked']=![];_0x58ab25['blockedAt']=null;}}_0x58ab25[_0x971a('0x3e')]=_0x4e27a7;_0x58ab25[_0x971a('0x3f')]=Date[_0x971a('0x40')]()+0x36ee80;return _0x58ab25['save']();})[_0x971a('0xb')](function(){return sendServiceMail({'to':_0x38584b['body'][_0x971a('0x1f')],'subject':_0x971a('0x41'),'text':_0x971a('0x42')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x971a('0x43')+_0x38584b[_0x971a('0x44')][_0x971a('0x23')]+_0x971a('0x45')+_0x4e27a7+'\x0a\x0a'+_0x971a('0x46')});})[_0x971a('0xb')](function(){_0xab8d48['status'](0xc8)[_0x971a('0x2e')]({'message':'Reset\x20Email\x20sent!'});})[_0x971a('0x1c')](function(_0x167ffa){return handleError(_0xab8d48,0x1f4,_0x167ffa);});};exports['reset']=function(_0xe65d03,_0x29282f,_0x19240b){var _0x30b745;return db[_0x971a('0x3b')]['find']({'where':{'resetPasswordToken':_0xe65d03[_0x971a('0x47')][_0x971a('0x48')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x971a('0xb')](function(_0xdaf0a0){_0x30b745=_0xdaf0a0;if(!_0x30b745){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x971a('0x8')][_0x971a('0xc')]({'attributes':['id',_0x971a('0x49')]});})[_0x971a('0xb')](function(_0x49a41d){return checkPasswordPattern(_0x49a41d,_0xe65d03[_0x971a('0x39')][_0x971a('0xe')],_0x49a41d['securePassword']);})[_0x971a('0xb')](function(){_0x30b745['password']=_0xe65d03[_0x971a('0x39')][_0x971a('0xe')];_0x30b745[_0x971a('0x3e')]=null;_0x30b745[_0x971a('0x3f')]=null;return _0x30b745[_0x971a('0x4a')]();})[_0x971a('0xb')](function(){_0x29282f[_0x971a('0x4b')](0xc8)[_0x971a('0x2e')]({'message':_0x971a('0x4c')});})[_0x971a('0x1c')](function(_0x6c41b6){return handleError(_0x29282f,0x1f4,_0x6c41b6);});};passport[_0x971a('0x4d')](new LocalStrategy({'usernameField':_0x971a('0xd'),'passwordField':_0x971a('0xe')},function(_0xfd9a6d,_0x20a52a,_0x7e2bfa){return localAuthenticate(db['User'],_0xfd9a6d,_0x20a52a,_0x7e2bfa);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 918be6f..8abecf3 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 _0xe49c=['exports','express','Router','post','login','/forgot','forgot','/reset/:token','reset'];(function(_0x3abb9f,_0x5142b8){var _0x473a93=function(_0x59940e){while(--_0x59940e){_0x3abb9f['push'](_0x3abb9f['shift']());}};_0x473a93(++_0x5142b8);}(_0xe49c,0x91));var _0xce49=function(_0x3ef45e,_0xe84f33){_0x3ef45e=_0x3ef45e-0x0;var _0x69e7c=_0xe49c[_0x3ef45e];return _0x69e7c;};'use strict';var express=require(_0xce49('0x0'));var router=express[_0xce49('0x1')]();var controller=require('./authLocal.controller');router[_0xce49('0x2')]('/',controller[_0xce49('0x3')]);router[_0xce49('0x2')](_0xce49('0x4'),controller[_0xce49('0x5')]);router[_0xce49('0x2')](_0xce49('0x6'),controller[_0xce49('0x7')]);module[_0xce49('0x8')]=router; \ No newline at end of file +var _0x50c6=['reset','express','Router','post','login','forgot','/reset/:token'];(function(_0x36a5c9,_0x7b3c53){var _0xa02505=function(_0x253920){while(--_0x253920){_0x36a5c9['push'](_0x36a5c9['shift']());}};_0xa02505(++_0x7b3c53);}(_0x50c6,0x71));var _0x650c=function(_0x3aa3c1,_0x57fef1){_0x3aa3c1=_0x3aa3c1-0x0;var _0xf24090=_0x50c6[_0x3aa3c1];return _0xf24090;};'use strict';var express=require(_0x650c('0x0'));var router=express[_0x650c('0x1')]();var controller=require('./authLocal.controller');router[_0x650c('0x2')]('/',controller[_0x650c('0x3')]);router[_0x650c('0x2')]('/forgot',controller[_0x650c('0x4')]);router[_0x650c('0x2')](_0x650c('0x5'),controller[_0x650c('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 9fb1170..7bf2e7b 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 _0xede1=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x2c5255,_0x4340c3){var _0x30d0ea=function(_0x131ba1){while(--_0x131ba1){_0x2c5255['push'](_0x2c5255['shift']());}};_0x30d0ea(++_0x4340c3);}(_0xede1,0x195));var _0x1ede=function(_0x590a00,_0x50fdb9){_0x590a00=_0x590a00-0x0;var _0x1f963a=_0xede1[_0x590a00];return _0x1f963a;};'use strict';var Sequelize=require(_0x1ede('0x0'));module[_0x1ede('0x1')]={'name':{'type':Sequelize[_0x1ede('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x1ede('0x2')]},'description':{'type':Sequelize[_0x1ede('0x2')]},'status':{'type':Sequelize[_0x1ede('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x1ede('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x46e5=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x3063f4,_0x3a2dde){var _0x57fa53=function(_0x10ff4a){while(--_0x10ff4a){_0x3063f4['push'](_0x3063f4['shift']());}};_0x57fa53(++_0x3a2dde);}(_0x46e5,0xbd));var _0x546e=function(_0x54112f,_0x597d77){_0x54112f=_0x54112f-0x0;var _0x106968=_0x46e5[_0x54112f];return _0x106968;};'use strict';var Sequelize=require(_0x546e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x546e('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x546e('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x546e('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index bfe5e29..c1b303e 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 _0xc4d7=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Automation','includeAll','include','findAll','rows','catch','show','params','find','create','body','addConditions','Condition','ids','omit','findOne','order','getConditions','Action','addActions','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','index','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes'];(function(_0x126b87,_0x2febe3){var _0x58f020=function(_0x8cf789){while(--_0x8cf789){_0x126b87['push'](_0x126b87['shift']());}};_0x58f020(++_0x2febe3);}(_0xc4d7,0x1d3));var _0x7c4d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc4d7[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x7c4d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7c4d('0x1'));var zipdir=require(_0x7c4d('0x2'));var jsonpatch=require(_0x7c4d('0x3'));var rp=require(_0x7c4d('0x4'));var moment=require(_0x7c4d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7c4d('0x6'));var util=require(_0x7c4d('0x7'));var path=require(_0x7c4d('0x8'));var sox=require(_0x7c4d('0x9'));var csv=require(_0x7c4d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7c4d('0xb'));var squel=require(_0x7c4d('0xc'));var crypto=require(_0x7c4d('0xd'));var jsforce=require(_0x7c4d('0xe'));var deskjs=require(_0x7c4d('0xf'));var toCsv=require(_0x7c4d('0xa'));var querystring=require(_0x7c4d('0x10'));var Papa=require(_0x7c4d('0x11'));var Redis=require(_0x7c4d('0x12'));var authService=require(_0x7c4d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7c4d('0x14'));var hardwareService=require(_0x7c4d('0x15'));var logger=require(_0x7c4d('0x16'))(_0x7c4d('0x17'));var utils=require(_0x7c4d('0x18'));var config=require(_0x7c4d('0x19'));var db=require(_0x7c4d('0x1a'))['db'];function respondWithStatusCode(_0x509ce5,_0x57f90e){_0x57f90e=_0x57f90e||0xcc;return function(_0x47e853){if(_0x47e853){return _0x509ce5[_0x7c4d('0x1b')](_0x57f90e);}return _0x509ce5['status'](_0x57f90e)[_0x7c4d('0x1c')]();};}function respondWithResult(_0x6544a1,_0x12265c){_0x12265c=_0x12265c||0xc8;return function(_0x34e940){if(_0x34e940){return _0x6544a1['status'](_0x12265c)[_0x7c4d('0x1d')](_0x34e940);}};}function respondWithFilteredResult(_0x5c6eb7,_0x2eb61e){return function(_0x51d07a){if(_0x51d07a){var _0x4ebffa=_0x51d07a['count'],_0x48c57e=_0x2eb61e['offset'],_0x3ad7fd=_0x2eb61e[_0x7c4d('0x1e')]+_0x2eb61e[_0x7c4d('0x1f')],_0x20ad37;if(_0x3ad7fd>=_0x4ebffa){_0x3ad7fd=_0x4ebffa;_0x20ad37=0xc8;}else{_0x20ad37=0xce;}_0x5c6eb7[_0x7c4d('0x20')](_0x20ad37);return _0x5c6eb7[_0x7c4d('0x21')](_0x7c4d('0x22'),_0x48c57e+'-'+_0x3ad7fd+'/'+_0x4ebffa)[_0x7c4d('0x1d')](_0x51d07a);}return null;};}function patchUpdates(_0xd2a24f){return function(_0x2c914b){try{jsonpatch[_0x7c4d('0x23')](_0x2c914b,_0xd2a24f,!![]);}catch(_0x423346){return BPromise[_0x7c4d('0x24')](_0x423346);}return _0x2c914b[_0x7c4d('0x25')]();};}function saveUpdates(_0x331a1a,_0xdcffd3){return function(_0x12a558){if(_0x12a558){return _0x12a558[_0x7c4d('0x26')](_0x331a1a)[_0x7c4d('0x27')](function(_0x5310be){return _0x5310be;});}return null;};}function removeEntity(_0x37cd0c,_0x848ba5){return function(_0x150d16){if(_0x150d16){return _0x150d16[_0x7c4d('0x28')]()[_0x7c4d('0x27')](function(){_0x37cd0c[_0x7c4d('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40e5f8,_0x5402bd){return function(_0x3d6105){if(!_0x3d6105){_0x40e5f8[_0x7c4d('0x1b')](0x194);}return _0x3d6105;};}function handleError(_0xaf2ff4,_0x265e27){_0x265e27=_0x265e27||0x1f4;return function(_0x261581){logger[_0x7c4d('0x29')](_0x261581['stack']);if(_0x261581['name']){delete _0x261581['name'];}_0xaf2ff4[_0x7c4d('0x20')](_0x265e27)['send'](_0x261581);};}exports[_0x7c4d('0x2a')]=function(_0x3c304b,_0x5dad8f){var _0x56f186={},_0x2e2eeb={},_0x1d29bc={'count':0x0,'rows':[]};var _0x4de0ba=_[_0x7c4d('0x2b')](db['Automation'][_0x7c4d('0x2c')],function(_0x3bd28b){return{'name':_0x3bd28b[_0x7c4d('0x2d')],'type':_0x3bd28b[_0x7c4d('0x2e')][_0x7c4d('0x2f')]};});_0x2e2eeb[_0x7c4d('0x30')]=_[_0x7c4d('0x2b')](_0x4de0ba,_0x7c4d('0x31'));_0x2e2eeb['query']=_[_0x7c4d('0x32')](_0x3c304b[_0x7c4d('0x33')]);_0x2e2eeb[_0x7c4d('0x34')]=_[_0x7c4d('0x35')](_0x2e2eeb[_0x7c4d('0x30')],_0x2e2eeb[_0x7c4d('0x33')]);_0x56f186[_0x7c4d('0x36')]=_[_0x7c4d('0x35')](_0x2e2eeb[_0x7c4d('0x30')],qs[_0x7c4d('0x37')](_0x3c304b[_0x7c4d('0x33')][_0x7c4d('0x37')]));_0x56f186['attributes']=_0x56f186[_0x7c4d('0x36')][_0x7c4d('0x38')]?_0x56f186[_0x7c4d('0x36')]:_0x2e2eeb[_0x7c4d('0x30')];if(!_0x3c304b['query'][_0x7c4d('0x39')](_0x7c4d('0x3a'))){_0x56f186['limit']=qs['limit'](_0x3c304b['query'][_0x7c4d('0x1f')]);_0x56f186[_0x7c4d('0x1e')]=qs[_0x7c4d('0x1e')](_0x3c304b[_0x7c4d('0x33')][_0x7c4d('0x1e')]);}_0x56f186['order']=qs['sort'](_0x3c304b['query'][_0x7c4d('0x3b')]);_0x56f186[_0x7c4d('0x3c')]=qs[_0x7c4d('0x34')](_[_0x7c4d('0x3d')](_0x3c304b[_0x7c4d('0x33')],_0x2e2eeb[_0x7c4d('0x34')]));if(_0x3c304b[_0x7c4d('0x33')][_0x7c4d('0x3e')]){_0x56f186[_0x7c4d('0x3c')]=_[_0x7c4d('0x3f')](_0x56f186[_0x7c4d('0x3c')],{'$or':_[_0x7c4d('0x2b')](_0x4de0ba,function(_0x521601){if(_0x521601[_0x7c4d('0x2e')]!==_0x7c4d('0x40')){var _0x30d181={};_0x30d181[_0x521601[_0x7c4d('0x31')]]={'$like':'%'+_0x3c304b[_0x7c4d('0x33')][_0x7c4d('0x3e')]+'%'};return _0x30d181;}})});}_0x56f186=_[_0x7c4d('0x3f')]({},_0x56f186,_0x3c304b[_0x7c4d('0x41')]);var _0x812738={'where':_0x56f186[_0x7c4d('0x3c')]};return db[_0x7c4d('0x42')]['count'](_0x812738)['then'](function(_0x329f35){_0x1d29bc['count']=_0x329f35;if(_0x3c304b['query'][_0x7c4d('0x43')]){_0x56f186[_0x7c4d('0x44')]=[{'all':!![]}];}return db[_0x7c4d('0x42')][_0x7c4d('0x45')](_0x56f186);})[_0x7c4d('0x27')](function(_0x1ff479){_0x1d29bc[_0x7c4d('0x46')]=_0x1ff479;return _0x1d29bc;})[_0x7c4d('0x27')](respondWithFilteredResult(_0x5dad8f,_0x56f186))[_0x7c4d('0x47')](handleError(_0x5dad8f,null));};exports[_0x7c4d('0x48')]=function(_0x5423bb,_0x37a902){var _0x8c664d={'raw':![],'where':{'id':_0x5423bb[_0x7c4d('0x49')]['id']}},_0x11582f={};_0x11582f[_0x7c4d('0x30')]=_[_0x7c4d('0x32')](db[_0x7c4d('0x42')]['rawAttributes']);_0x11582f[_0x7c4d('0x33')]=_[_0x7c4d('0x32')](_0x5423bb[_0x7c4d('0x33')]);_0x11582f[_0x7c4d('0x34')]=_[_0x7c4d('0x35')](_0x11582f['model'],_0x11582f[_0x7c4d('0x33')]);_0x8c664d[_0x7c4d('0x36')]=_[_0x7c4d('0x35')](_0x11582f[_0x7c4d('0x30')],qs[_0x7c4d('0x37')](_0x5423bb[_0x7c4d('0x33')][_0x7c4d('0x37')]));_0x8c664d[_0x7c4d('0x36')]=_0x8c664d['attributes'][_0x7c4d('0x38')]?_0x8c664d[_0x7c4d('0x36')]:_0x11582f[_0x7c4d('0x30')];if(_0x5423bb[_0x7c4d('0x33')]['includeAll']){_0x8c664d[_0x7c4d('0x44')]=[{'all':!![]}];}_0x8c664d=_[_0x7c4d('0x3f')]({},_0x8c664d,_0x5423bb['options']);return db[_0x7c4d('0x42')][_0x7c4d('0x4a')](_0x8c664d)[_0x7c4d('0x27')](handleEntityNotFound(_0x37a902,null))[_0x7c4d('0x27')](respondWithResult(_0x37a902,null))['catch'](handleError(_0x37a902,null));};exports[_0x7c4d('0x4b')]=function(_0x1ce290,_0x2448fe){return db['Automation'][_0x7c4d('0x4b')](_0x1ce290['body'],{})[_0x7c4d('0x27')](respondWithResult(_0x2448fe,0xc9))['catch'](handleError(_0x2448fe,null));};exports[_0x7c4d('0x26')]=function(_0x1adf21,_0x48dcb3){if(_0x1adf21[_0x7c4d('0x4c')]['id']){delete _0x1adf21[_0x7c4d('0x4c')]['id'];}return db[_0x7c4d('0x42')][_0x7c4d('0x4a')]({'where':{'id':_0x1adf21[_0x7c4d('0x49')]['id']}})['then'](handleEntityNotFound(_0x48dcb3,null))['then'](saveUpdates(_0x1adf21['body'],null))['then'](respondWithResult(_0x48dcb3,null))['catch'](handleError(_0x48dcb3,null));};exports[_0x7c4d('0x28')]=function(_0x8d4870,_0x2b2034){return db[_0x7c4d('0x42')][_0x7c4d('0x4a')]({'where':{'id':_0x8d4870['params']['id']}})[_0x7c4d('0x27')](handleEntityNotFound(_0x2b2034,null))[_0x7c4d('0x27')](removeEntity(_0x2b2034,null))[_0x7c4d('0x47')](handleError(_0x2b2034,null));};exports[_0x7c4d('0x4d')]=function(_0x5c176b,_0x62ce97,_0x36a23c){return db[_0x7c4d('0x4e')]['find']({'where':{'id':_0x5c176b[_0x7c4d('0x49')]['id']}})[_0x7c4d('0x27')](handleEntityNotFound(_0x62ce97,null))[_0x7c4d('0x27')](function(_0x2123a0){if(_0x2123a0){return _0x2123a0[_0x7c4d('0x4d')](_0x5c176b[_0x7c4d('0x4c')][_0x7c4d('0x4f')],_[_0x7c4d('0x50')](_0x5c176b['body'],[_0x7c4d('0x4f'),'id'])||{});}})[_0x7c4d('0x27')](respondWithResult(_0x62ce97,null))['catch'](handleError(_0x62ce97,null));};exports['getConditions']=function(_0x11667f,_0x5a0b81,_0x3fe15c){var _0x3795c0={};var _0x4600af={};var _0x799d75;var _0x7beb2;return db['Automation'][_0x7c4d('0x51')]({'where':{'id':_0x11667f[_0x7c4d('0x49')]['id']}})[_0x7c4d('0x27')](handleEntityNotFound(_0x5a0b81,null))[_0x7c4d('0x27')](function(_0x2cc715){if(_0x2cc715){_0x799d75=_0x2cc715;_0x4600af[_0x7c4d('0x30')]=_['keys'](db[_0x7c4d('0x4e')][_0x7c4d('0x2c')]);_0x4600af[_0x7c4d('0x33')]=_[_0x7c4d('0x32')](_0x11667f[_0x7c4d('0x33')]);_0x4600af[_0x7c4d('0x34')]=_['intersection'](_0x4600af[_0x7c4d('0x30')],_0x4600af[_0x7c4d('0x33')]);_0x3795c0['attributes']=_[_0x7c4d('0x35')](_0x4600af['model'],qs[_0x7c4d('0x37')](_0x11667f['query'][_0x7c4d('0x37')]));_0x3795c0[_0x7c4d('0x36')]=_0x3795c0['attributes'][_0x7c4d('0x38')]?_0x3795c0[_0x7c4d('0x36')]:_0x4600af[_0x7c4d('0x30')];_0x3795c0[_0x7c4d('0x52')]=qs[_0x7c4d('0x3b')](_0x11667f[_0x7c4d('0x33')][_0x7c4d('0x3b')]);_0x3795c0[_0x7c4d('0x3c')]=qs[_0x7c4d('0x34')](_[_0x7c4d('0x3d')](_0x11667f[_0x7c4d('0x33')],_0x4600af[_0x7c4d('0x34')]));if(_0x11667f['query'][_0x7c4d('0x3e')]){_0x3795c0[_0x7c4d('0x3c')]=_[_0x7c4d('0x3f')](_0x3795c0[_0x7c4d('0x3c')],{'$or':_[_0x7c4d('0x2b')](_0x3795c0[_0x7c4d('0x36')],function(_0x217513){var _0x1eac94={};_0x1eac94[_0x217513]={'$like':'%'+_0x11667f[_0x7c4d('0x33')][_0x7c4d('0x3e')]+'%'};return _0x1eac94;})});}_0x3795c0=_[_0x7c4d('0x3f')]({},_0x3795c0,_0x11667f[_0x7c4d('0x41')]);return _0x799d75[_0x7c4d('0x53')](_0x3795c0);}})[_0x7c4d('0x27')](function(_0x98a589){if(_0x98a589){_0x7beb2=_0x98a589[_0x7c4d('0x38')];if(!_0x11667f[_0x7c4d('0x33')][_0x7c4d('0x39')]('nolimit')){_0x3795c0['limit']=qs[_0x7c4d('0x1f')](_0x11667f['query']['limit']);_0x3795c0[_0x7c4d('0x1e')]=qs[_0x7c4d('0x1e')](_0x11667f[_0x7c4d('0x33')][_0x7c4d('0x1e')]);}return _0x799d75[_0x7c4d('0x53')](_0x3795c0);}})[_0x7c4d('0x27')](function(_0x1be6c8){if(_0x1be6c8){return _0x1be6c8?{'count':_0x7beb2,'rows':_0x1be6c8}:null;}})[_0x7c4d('0x27')](respondWithResult(_0x5a0b81,null))['catch'](handleError(_0x5a0b81,null));};exports['addActions']=function(_0x2da5ff,_0x47f770,_0x40cdf0){return db[_0x7c4d('0x54')][_0x7c4d('0x4a')]({'where':{'id':_0x2da5ff[_0x7c4d('0x49')]['id']}})[_0x7c4d('0x27')](handleEntityNotFound(_0x47f770,null))[_0x7c4d('0x27')](function(_0x4322fe){if(_0x4322fe){return _0x4322fe[_0x7c4d('0x55')](_0x2da5ff['body'][_0x7c4d('0x4f')],_[_0x7c4d('0x50')](_0x2da5ff[_0x7c4d('0x4c')],[_0x7c4d('0x4f'),'id'])||{});}})[_0x7c4d('0x27')](respondWithResult(_0x47f770,null))[_0x7c4d('0x47')](handleError(_0x47f770,null));};exports[_0x7c4d('0x56')]=function(_0x627340,_0x5ef85b,_0x229b66){var _0x5524b0={};var _0x521375={};var _0x45523b;var _0x4ad1d0;return db['Automation'][_0x7c4d('0x51')]({'where':{'id':_0x627340[_0x7c4d('0x49')]['id']}})[_0x7c4d('0x27')](handleEntityNotFound(_0x5ef85b,null))[_0x7c4d('0x27')](function(_0x4b14dd){if(_0x4b14dd){_0x45523b=_0x4b14dd;_0x521375['model']=_[_0x7c4d('0x32')](db[_0x7c4d('0x54')][_0x7c4d('0x2c')]);_0x521375[_0x7c4d('0x33')]=_[_0x7c4d('0x32')](_0x627340['query']);_0x521375['filters']=_[_0x7c4d('0x35')](_0x521375['model'],_0x521375[_0x7c4d('0x33')]);_0x5524b0['attributes']=_[_0x7c4d('0x35')](_0x521375[_0x7c4d('0x30')],qs[_0x7c4d('0x37')](_0x627340['query'][_0x7c4d('0x37')]));_0x5524b0['attributes']=_0x5524b0[_0x7c4d('0x36')][_0x7c4d('0x38')]?_0x5524b0['attributes']:_0x521375['model'];_0x5524b0[_0x7c4d('0x52')]=qs[_0x7c4d('0x3b')](_0x627340[_0x7c4d('0x33')][_0x7c4d('0x3b')]);_0x5524b0[_0x7c4d('0x3c')]=qs['filters'](_[_0x7c4d('0x3d')](_0x627340[_0x7c4d('0x33')],_0x521375['filters']));if(_0x627340[_0x7c4d('0x33')][_0x7c4d('0x3e')]){_0x5524b0['where']=_[_0x7c4d('0x3f')](_0x5524b0[_0x7c4d('0x3c')],{'$or':_[_0x7c4d('0x2b')](_0x5524b0[_0x7c4d('0x36')],function(_0x51ba9f){var _0x58cd90={};_0x58cd90[_0x51ba9f]={'$like':'%'+_0x627340[_0x7c4d('0x33')][_0x7c4d('0x3e')]+'%'};return _0x58cd90;})});}_0x5524b0=_[_0x7c4d('0x3f')]({},_0x5524b0,_0x627340[_0x7c4d('0x41')]);return _0x45523b[_0x7c4d('0x56')](_0x5524b0);}})[_0x7c4d('0x27')](function(_0x1c3329){if(_0x1c3329){_0x4ad1d0=_0x1c3329[_0x7c4d('0x38')];if(!_0x627340['query'][_0x7c4d('0x39')]('nolimit')){_0x5524b0[_0x7c4d('0x1f')]=qs[_0x7c4d('0x1f')](_0x627340[_0x7c4d('0x33')][_0x7c4d('0x1f')]);_0x5524b0[_0x7c4d('0x1e')]=qs[_0x7c4d('0x1e')](_0x627340[_0x7c4d('0x33')][_0x7c4d('0x1e')]);}return _0x45523b['getActions'](_0x5524b0);}})['then'](function(_0xf036b7){if(_0xf036b7){return _0xf036b7?{'count':_0x4ad1d0,'rows':_0xf036b7}:null;}})[_0x7c4d('0x27')](respondWithResult(_0x5ef85b,null))[_0x7c4d('0x47')](handleError(_0x5ef85b,null));}; \ No newline at end of file +var _0x7e10=['lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Automation','includeAll','catch','show','params','include','find','create','body','destroy','addConditions','Condition','ids','getConditions','findOne','addActions','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs'];(function(_0x5ad294,_0x1477c7){var _0x20a450=function(_0x3fa506){while(--_0x3fa506){_0x5ad294['push'](_0x5ad294['shift']());}};_0x20a450(++_0x1477c7);}(_0x7e10,0x9c));var _0x07e1=function(_0xff1909,_0x5bc502){_0xff1909=_0xff1909-0x0;var _0x579767=_0x7e10[_0xff1909];return _0x579767;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x07e1('0x0'));var rimraf=require(_0x07e1('0x1'));var zipdir=require(_0x07e1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x07e1('0x3'));var moment=require(_0x07e1('0x4'));var BPromise=require(_0x07e1('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x07e1('0x6'));var sox=require(_0x07e1('0x7'));var csv=require(_0x07e1('0x8'));var ejs=require(_0x07e1('0x9'));var fs=require('fs');var _=require(_0x07e1('0xa'));var squel=require(_0x07e1('0xb'));var crypto=require('crypto');var jsforce=require(_0x07e1('0xc'));var deskjs=require(_0x07e1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x07e1('0xe'));var Papa=require(_0x07e1('0xf'));var Redis=require('ioredis');var authService=require(_0x07e1('0x10'));var qs=require(_0x07e1('0x11'));var as=require(_0x07e1('0x12'));var hardwareService=require(_0x07e1('0x13'));var logger=require(_0x07e1('0x14'))(_0x07e1('0x15'));var utils=require(_0x07e1('0x16'));var config=require('../../config/environment');var db=require(_0x07e1('0x17'))['db'];function respondWithStatusCode(_0x444b9d,_0x494443){_0x494443=_0x494443||0xcc;return function(_0x42a806){if(_0x42a806){return _0x444b9d[_0x07e1('0x18')](_0x494443);}return _0x444b9d[_0x07e1('0x19')](_0x494443)[_0x07e1('0x1a')]();};}function respondWithResult(_0x26f5ff,_0x5173d4){_0x5173d4=_0x5173d4||0xc8;return function(_0x60260c){if(_0x60260c){return _0x26f5ff[_0x07e1('0x19')](_0x5173d4)[_0x07e1('0x1b')](_0x60260c);}};}function respondWithFilteredResult(_0x2cc8a7,_0x5907aa){return function(_0x43a7d4){if(_0x43a7d4){var _0x505ac6=_0x43a7d4[_0x07e1('0x1c')],_0x1b9547=_0x5907aa[_0x07e1('0x1d')],_0x448ea5=_0x5907aa[_0x07e1('0x1d')]+_0x5907aa[_0x07e1('0x1e')],_0x191c14;if(_0x448ea5>=_0x505ac6){_0x448ea5=_0x505ac6;_0x191c14=0xc8;}else{_0x191c14=0xce;}_0x2cc8a7[_0x07e1('0x19')](_0x191c14);return _0x2cc8a7[_0x07e1('0x1f')](_0x07e1('0x20'),_0x1b9547+'-'+_0x448ea5+'/'+_0x505ac6)[_0x07e1('0x1b')](_0x43a7d4);}return null;};}function patchUpdates(_0x484bb6){return function(_0x519cd5){try{jsonpatch[_0x07e1('0x21')](_0x519cd5,_0x484bb6,!![]);}catch(_0x22049b){return BPromise[_0x07e1('0x22')](_0x22049b);}return _0x519cd5[_0x07e1('0x23')]();};}function saveUpdates(_0x70eb19,_0x5c2772){return function(_0x2e8d02){if(_0x2e8d02){return _0x2e8d02[_0x07e1('0x24')](_0x70eb19)[_0x07e1('0x25')](function(_0x1c4878){return _0x1c4878;});}return null;};}function removeEntity(_0x2dde20,_0x4f980b){return function(_0x109ef6){if(_0x109ef6){return _0x109ef6['destroy']()[_0x07e1('0x25')](function(){_0x2dde20[_0x07e1('0x19')](0xcc)[_0x07e1('0x1a')]();});}};}function handleEntityNotFound(_0xbc4f65,_0x96ca84){return function(_0x3c01c0){if(!_0x3c01c0){_0xbc4f65[_0x07e1('0x18')](0x194);}return _0x3c01c0;};}function handleError(_0x3cfe35,_0x4d1e06){_0x4d1e06=_0x4d1e06||0x1f4;return function(_0x1984b7){logger[_0x07e1('0x26')](_0x1984b7['stack']);if(_0x1984b7['name']){delete _0x1984b7[_0x07e1('0x27')];}_0x3cfe35[_0x07e1('0x19')](_0x4d1e06)[_0x07e1('0x28')](_0x1984b7);};}exports[_0x07e1('0x29')]=function(_0x3a13c4,_0x1ce134){var _0x38ad81={},_0x205fe1={},_0x30934a={'count':0x0,'rows':[]};var _0x37a0a7=_['map'](db['Automation'][_0x07e1('0x2a')],function(_0x57823e){return{'name':_0x57823e[_0x07e1('0x2b')],'type':_0x57823e[_0x07e1('0x2c')][_0x07e1('0x2d')]};});_0x205fe1[_0x07e1('0x2e')]=_[_0x07e1('0x2f')](_0x37a0a7,_0x07e1('0x27'));_0x205fe1[_0x07e1('0x30')]=_[_0x07e1('0x31')](_0x3a13c4[_0x07e1('0x30')]);_0x205fe1[_0x07e1('0x32')]=_[_0x07e1('0x33')](_0x205fe1[_0x07e1('0x2e')],_0x205fe1['query']);_0x38ad81[_0x07e1('0x34')]=_[_0x07e1('0x33')](_0x205fe1[_0x07e1('0x2e')],qs[_0x07e1('0x35')](_0x3a13c4[_0x07e1('0x30')][_0x07e1('0x35')]));_0x38ad81[_0x07e1('0x34')]=_0x38ad81['attributes'][_0x07e1('0x36')]?_0x38ad81[_0x07e1('0x34')]:_0x205fe1['model'];if(!_0x3a13c4['query'][_0x07e1('0x37')](_0x07e1('0x38'))){_0x38ad81[_0x07e1('0x1e')]=qs[_0x07e1('0x1e')](_0x3a13c4[_0x07e1('0x30')][_0x07e1('0x1e')]);_0x38ad81['offset']=qs['offset'](_0x3a13c4['query'][_0x07e1('0x1d')]);}_0x38ad81[_0x07e1('0x39')]=qs[_0x07e1('0x3a')](_0x3a13c4[_0x07e1('0x30')][_0x07e1('0x3a')]);_0x38ad81[_0x07e1('0x3b')]=qs[_0x07e1('0x32')](_[_0x07e1('0x3c')](_0x3a13c4[_0x07e1('0x30')],_0x205fe1['filters']));if(_0x3a13c4[_0x07e1('0x30')][_0x07e1('0x3d')]){_0x38ad81[_0x07e1('0x3b')]=_[_0x07e1('0x3e')](_0x38ad81[_0x07e1('0x3b')],{'$or':_[_0x07e1('0x2f')](_0x37a0a7,function(_0x578684){if(_0x578684[_0x07e1('0x2c')]!==_0x07e1('0x3f')){var _0x28a714={};_0x28a714[_0x578684[_0x07e1('0x27')]]={'$like':'%'+_0x3a13c4['query'][_0x07e1('0x3d')]+'%'};return _0x28a714;}})});}_0x38ad81=_['merge']({},_0x38ad81,_0x3a13c4[_0x07e1('0x40')]);var _0x2c6944={'where':_0x38ad81['where']};return db[_0x07e1('0x41')][_0x07e1('0x1c')](_0x2c6944)['then'](function(_0x1fa9b7){_0x30934a['count']=_0x1fa9b7;if(_0x3a13c4['query'][_0x07e1('0x42')]){_0x38ad81['include']=[{'all':!![]}];}return db[_0x07e1('0x41')]['findAll'](_0x38ad81);})['then'](function(_0x3f3090){_0x30934a['rows']=_0x3f3090;return _0x30934a;})['then'](respondWithFilteredResult(_0x1ce134,_0x38ad81))[_0x07e1('0x43')](handleError(_0x1ce134,null));};exports[_0x07e1('0x44')]=function(_0x3b1acc,_0x539760){var _0x489e94={'raw':![],'where':{'id':_0x3b1acc[_0x07e1('0x45')]['id']}},_0x207434={};_0x207434[_0x07e1('0x2e')]=_['keys'](db[_0x07e1('0x41')][_0x07e1('0x2a')]);_0x207434['query']=_[_0x07e1('0x31')](_0x3b1acc[_0x07e1('0x30')]);_0x207434[_0x07e1('0x32')]=_[_0x07e1('0x33')](_0x207434['model'],_0x207434[_0x07e1('0x30')]);_0x489e94[_0x07e1('0x34')]=_[_0x07e1('0x33')](_0x207434[_0x07e1('0x2e')],qs[_0x07e1('0x35')](_0x3b1acc[_0x07e1('0x30')]['fields']));_0x489e94[_0x07e1('0x34')]=_0x489e94['attributes'][_0x07e1('0x36')]?_0x489e94[_0x07e1('0x34')]:_0x207434[_0x07e1('0x2e')];if(_0x3b1acc[_0x07e1('0x30')][_0x07e1('0x42')]){_0x489e94[_0x07e1('0x46')]=[{'all':!![]}];}_0x489e94=_[_0x07e1('0x3e')]({},_0x489e94,_0x3b1acc[_0x07e1('0x40')]);return db['Automation'][_0x07e1('0x47')](_0x489e94)[_0x07e1('0x25')](handleEntityNotFound(_0x539760,null))['then'](respondWithResult(_0x539760,null))[_0x07e1('0x43')](handleError(_0x539760,null));};exports[_0x07e1('0x48')]=function(_0x1ff48f,_0x49b8d0){return db[_0x07e1('0x41')][_0x07e1('0x48')](_0x1ff48f['body'],{})[_0x07e1('0x25')](respondWithResult(_0x49b8d0,0xc9))[_0x07e1('0x43')](handleError(_0x49b8d0,null));};exports['update']=function(_0x1b67c3,_0x4960fd){if(_0x1b67c3[_0x07e1('0x49')]['id']){delete _0x1b67c3[_0x07e1('0x49')]['id'];}return db[_0x07e1('0x41')][_0x07e1('0x47')]({'where':{'id':_0x1b67c3[_0x07e1('0x45')]['id']}})[_0x07e1('0x25')](handleEntityNotFound(_0x4960fd,null))[_0x07e1('0x25')](saveUpdates(_0x1b67c3[_0x07e1('0x49')],null))[_0x07e1('0x25')](respondWithResult(_0x4960fd,null))[_0x07e1('0x43')](handleError(_0x4960fd,null));};exports[_0x07e1('0x4a')]=function(_0x175186,_0x5456ce){return db[_0x07e1('0x41')][_0x07e1('0x47')]({'where':{'id':_0x175186[_0x07e1('0x45')]['id']}})[_0x07e1('0x25')](handleEntityNotFound(_0x5456ce,null))[_0x07e1('0x25')](removeEntity(_0x5456ce,null))['catch'](handleError(_0x5456ce,null));};exports[_0x07e1('0x4b')]=function(_0xd478dd,_0x1c5cbe,_0x39b880){return db[_0x07e1('0x4c')][_0x07e1('0x47')]({'where':{'id':_0xd478dd[_0x07e1('0x45')]['id']}})[_0x07e1('0x25')](handleEntityNotFound(_0x1c5cbe,null))[_0x07e1('0x25')](function(_0x51ed3f){if(_0x51ed3f){return _0x51ed3f[_0x07e1('0x4b')](_0xd478dd[_0x07e1('0x49')][_0x07e1('0x4d')],_['omit'](_0xd478dd[_0x07e1('0x49')],[_0x07e1('0x4d'),'id'])||{});}})[_0x07e1('0x25')](respondWithResult(_0x1c5cbe,null))[_0x07e1('0x43')](handleError(_0x1c5cbe,null));};exports[_0x07e1('0x4e')]=function(_0x2049db,_0x2cadc4,_0x16bc54){var _0x50540b={};var _0x38d65d={};var _0x4f852f;var _0x4743fe;return db['Automation'][_0x07e1('0x4f')]({'where':{'id':_0x2049db[_0x07e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x2cadc4,null))[_0x07e1('0x25')](function(_0x131cfa){if(_0x131cfa){_0x4f852f=_0x131cfa;_0x38d65d['model']=_[_0x07e1('0x31')](db[_0x07e1('0x4c')]['rawAttributes']);_0x38d65d[_0x07e1('0x30')]=_[_0x07e1('0x31')](_0x2049db['query']);_0x38d65d[_0x07e1('0x32')]=_[_0x07e1('0x33')](_0x38d65d[_0x07e1('0x2e')],_0x38d65d['query']);_0x50540b[_0x07e1('0x34')]=_[_0x07e1('0x33')](_0x38d65d[_0x07e1('0x2e')],qs[_0x07e1('0x35')](_0x2049db['query'][_0x07e1('0x35')]));_0x50540b[_0x07e1('0x34')]=_0x50540b[_0x07e1('0x34')]['length']?_0x50540b[_0x07e1('0x34')]:_0x38d65d[_0x07e1('0x2e')];_0x50540b[_0x07e1('0x39')]=qs[_0x07e1('0x3a')](_0x2049db[_0x07e1('0x30')]['sort']);_0x50540b[_0x07e1('0x3b')]=qs[_0x07e1('0x32')](_[_0x07e1('0x3c')](_0x2049db['query'],_0x38d65d['filters']));if(_0x2049db[_0x07e1('0x30')][_0x07e1('0x3d')]){_0x50540b[_0x07e1('0x3b')]=_['merge'](_0x50540b[_0x07e1('0x3b')],{'$or':_[_0x07e1('0x2f')](_0x50540b[_0x07e1('0x34')],function(_0x42cf10){var _0x47d07e={};_0x47d07e[_0x42cf10]={'$like':'%'+_0x2049db['query'][_0x07e1('0x3d')]+'%'};return _0x47d07e;})});}_0x50540b=_[_0x07e1('0x3e')]({},_0x50540b,_0x2049db[_0x07e1('0x40')]);return _0x4f852f[_0x07e1('0x4e')](_0x50540b);}})[_0x07e1('0x25')](function(_0x259feb){if(_0x259feb){_0x4743fe=_0x259feb['length'];if(!_0x2049db['query'][_0x07e1('0x37')](_0x07e1('0x38'))){_0x50540b[_0x07e1('0x1e')]=qs[_0x07e1('0x1e')](_0x2049db[_0x07e1('0x30')][_0x07e1('0x1e')]);_0x50540b[_0x07e1('0x1d')]=qs['offset'](_0x2049db['query'][_0x07e1('0x1d')]);}return _0x4f852f[_0x07e1('0x4e')](_0x50540b);}})[_0x07e1('0x25')](function(_0x1d1654){if(_0x1d1654){return _0x1d1654?{'count':_0x4743fe,'rows':_0x1d1654}:null;}})[_0x07e1('0x25')](respondWithResult(_0x2cadc4,null))['catch'](handleError(_0x2cadc4,null));};exports[_0x07e1('0x50')]=function(_0x4dab2c,_0x5bd529,_0x4c7ea6){return db[_0x07e1('0x51')][_0x07e1('0x47')]({'where':{'id':_0x4dab2c[_0x07e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x5bd529,null))['then'](function(_0x5ae227){if(_0x5ae227){return _0x5ae227['addActions'](_0x4dab2c['body'][_0x07e1('0x4d')],_['omit'](_0x4dab2c['body'],[_0x07e1('0x4d'),'id'])||{});}})[_0x07e1('0x25')](respondWithResult(_0x5bd529,null))[_0x07e1('0x43')](handleError(_0x5bd529,null));};exports['getActions']=function(_0x16b279,_0x4fa9b3,_0x3f0c13){var _0x4c5ef2={};var _0x25f393={};var _0x5a0ffb;var _0x125f3e;return db['Automation']['findOne']({'where':{'id':_0x16b279[_0x07e1('0x45')]['id']}})[_0x07e1('0x25')](handleEntityNotFound(_0x4fa9b3,null))[_0x07e1('0x25')](function(_0x320dbb){if(_0x320dbb){_0x5a0ffb=_0x320dbb;_0x25f393[_0x07e1('0x2e')]=_[_0x07e1('0x31')](db['Action'][_0x07e1('0x2a')]);_0x25f393['query']=_[_0x07e1('0x31')](_0x16b279[_0x07e1('0x30')]);_0x25f393[_0x07e1('0x32')]=_[_0x07e1('0x33')](_0x25f393[_0x07e1('0x2e')],_0x25f393['query']);_0x4c5ef2[_0x07e1('0x34')]=_[_0x07e1('0x33')](_0x25f393['model'],qs[_0x07e1('0x35')](_0x16b279['query'][_0x07e1('0x35')]));_0x4c5ef2[_0x07e1('0x34')]=_0x4c5ef2[_0x07e1('0x34')][_0x07e1('0x36')]?_0x4c5ef2[_0x07e1('0x34')]:_0x25f393[_0x07e1('0x2e')];_0x4c5ef2[_0x07e1('0x39')]=qs['sort'](_0x16b279['query'][_0x07e1('0x3a')]);_0x4c5ef2[_0x07e1('0x3b')]=qs[_0x07e1('0x32')](_[_0x07e1('0x3c')](_0x16b279[_0x07e1('0x30')],_0x25f393[_0x07e1('0x32')]));if(_0x16b279[_0x07e1('0x30')][_0x07e1('0x3d')]){_0x4c5ef2[_0x07e1('0x3b')]=_[_0x07e1('0x3e')](_0x4c5ef2[_0x07e1('0x3b')],{'$or':_['map'](_0x4c5ef2[_0x07e1('0x34')],function(_0x36fea5){var _0x19a444={};_0x19a444[_0x36fea5]={'$like':'%'+_0x16b279[_0x07e1('0x30')][_0x07e1('0x3d')]+'%'};return _0x19a444;})});}_0x4c5ef2=_['merge']({},_0x4c5ef2,_0x16b279['options']);return _0x5a0ffb[_0x07e1('0x52')](_0x4c5ef2);}})[_0x07e1('0x25')](function(_0x27a229){if(_0x27a229){_0x125f3e=_0x27a229[_0x07e1('0x36')];if(!_0x16b279[_0x07e1('0x30')][_0x07e1('0x37')](_0x07e1('0x38'))){_0x4c5ef2[_0x07e1('0x1e')]=qs['limit'](_0x16b279['query']['limit']);_0x4c5ef2[_0x07e1('0x1d')]=qs['offset'](_0x16b279[_0x07e1('0x30')]['offset']);}return _0x5a0ffb[_0x07e1('0x52')](_0x4c5ef2);}})['then'](function(_0x5ca14e){if(_0x5ca14e){return _0x5ca14e?{'count':_0x125f3e,'rows':_0x5ca14e}:null;}})['then'](respondWithResult(_0x4fa9b3,null))[_0x07e1('0x43')](handleError(_0x4fa9b3,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 3232b8a..0e3623a 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 _0x0aa8=['../../config/environment','exports','Automation','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0aa8,0xae));var _0x80aa=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0x0aa8[_0x5f1617];return _0x3af5da;};'use strict';var _=require(_0x80aa('0x0'));var util=require(_0x80aa('0x1'));var logger=require(_0x80aa('0x2'))(_0x80aa('0x3'));var moment=require('moment');var BPromise=require(_0x80aa('0x4'));var rp=require(_0x80aa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x80aa('0x6'));var attributes=require('./automation.attributes');module[_0x80aa('0x7')]=function(_0x1b52a4,_0x13e7bf){return _0x1b52a4['define'](_0x80aa('0x8'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e03=['path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util','api','moment'];(function(_0x7a30ab,_0x316099){var _0x5cc7d6=function(_0x9ef2df){while(--_0x9ef2df){_0x7a30ab['push'](_0x7a30ab['shift']());}};_0x5cc7d6(++_0x316099);}(_0x2e03,0xa2));var _0x32e0=function(_0x3485c3,_0x5f1a7f){_0x3485c3=_0x3485c3-0x0;var _0x44723e=_0x2e03[_0x3485c3];return _0x44723e;};'use strict';var _=require('lodash');var util=require(_0x32e0('0x0'));var logger=require('../../config/logger')(_0x32e0('0x1'));var moment=require(_0x32e0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x32e0('0x3'));var rimraf=require(_0x32e0('0x4'));var config=require(_0x32e0('0x5'));var attributes=require(_0x32e0('0x6'));module[_0x32e0('0x7')]=function(_0x4a2534,_0x49dc2e){return _0x4a2534[_0x32e0('0x8')](_0x32e0('0x9'),attributes,{'tableName':_0x32e0('0xa'),'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 b43744f..5092620 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 _0xa0f4=['then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5e3da6,_0x1a27bb){var _0x596897=function(_0x1073e5){while(--_0x1073e5){_0x5e3da6['push'](_0x5e3da6['shift']());}};_0x596897(++_0x1a27bb);}(_0xa0f4,0x15f));var _0x4a0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4a0f('0x0'));var util=require('util');var moment=require(_0x4a0f('0x1'));var BPromise=require(_0x4a0f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a0f('0x3'));var db=require(_0x4a0f('0x4'))['db'];var utils=require(_0x4a0f('0x5'));var logger=require(_0x4a0f('0x6'))(_0x4a0f('0x7'));var config=require(_0x4a0f('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c3da9,_0x5643fa,_0x1ec602){return new BPromise(function(_0x516d48,_0x2a8658){return client['request'](_0x3c3da9,_0x1ec602)[_0x4a0f('0x9')](function(_0x5e9140){logger['info'](_0x4a0f('0xa'),_0x5643fa,_0x4a0f('0xb'));logger['debug'](_0x4a0f('0xc'),_0x5643fa,'request\x20sent',JSON[_0x4a0f('0xd')](_0x5e9140));if(_0x5e9140['error']){if(_0x5e9140[_0x4a0f('0xe')][_0x4a0f('0xf')]===0x1f4){logger[_0x4a0f('0xe')](_0x4a0f('0xa'),_0x5643fa,_0x5e9140['error'][_0x4a0f('0x10')]);return _0x2a8658(_0x5e9140[_0x4a0f('0xe')][_0x4a0f('0x10')]);}logger[_0x4a0f('0xe')]('Automation,\x20%s,\x20%s',_0x5643fa,_0x5e9140[_0x4a0f('0xe')]['message']);return _0x516d48(_0x5e9140[_0x4a0f('0xe')][_0x4a0f('0x10')]);}else{logger[_0x4a0f('0x11')]('Automation,\x20%s,\x20%s',_0x5643fa,_0x4a0f('0xb'));_0x516d48(_0x5e9140[_0x4a0f('0x12')][_0x4a0f('0x10')]);}})[_0x4a0f('0x13')](function(_0x551b2d){logger[_0x4a0f('0xe')](_0x4a0f('0xa'),_0x5643fa,_0x551b2d);_0x2a8658(_0x551b2d);});});} \ No newline at end of file +var _0x78ef=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78ef,0x162));var _0xf78e=function(_0x30858e,_0xbde112){_0x30858e=_0x30858e-0x0;var _0x2255e0=_0x78ef[_0x30858e];return _0x2255e0;};'use strict';var _=require('lodash');var util=require(_0xf78e('0x0'));var moment=require('moment');var BPromise=require(_0xf78e('0x1'));var rs=require(_0xf78e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf78e('0x3'))['db'];var utils=require(_0xf78e('0x4'));var logger=require(_0xf78e('0x5'))(_0xf78e('0x6'));var config=require(_0xf78e('0x7'));var jayson=require(_0xf78e('0x8'));var client=jayson[_0xf78e('0x9')][_0xf78e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3125a5,_0x4b902f,_0x27092f){return new BPromise(function(_0x9819e1,_0x146085){return client['request'](_0x3125a5,_0x27092f)[_0xf78e('0xb')](function(_0x490c9c){logger[_0xf78e('0xc')](_0xf78e('0xd'),_0x4b902f,_0xf78e('0xe'));logger[_0xf78e('0xf')]('Automation,\x20%s,\x20%s,\x20%s',_0x4b902f,'request\x20sent',JSON['stringify'](_0x490c9c));if(_0x490c9c[_0xf78e('0x10')]){if(_0x490c9c[_0xf78e('0x10')][_0xf78e('0x11')]===0x1f4){logger[_0xf78e('0x10')](_0xf78e('0xd'),_0x4b902f,_0x490c9c[_0xf78e('0x10')][_0xf78e('0x12')]);return _0x146085(_0x490c9c['error']['message']);}logger['error']('Automation,\x20%s,\x20%s',_0x4b902f,_0x490c9c['error'][_0xf78e('0x12')]);return _0x9819e1(_0x490c9c[_0xf78e('0x10')][_0xf78e('0x12')]);}else{logger['info'](_0xf78e('0xd'),_0x4b902f,'request\x20sent');_0x9819e1(_0x490c9c[_0xf78e('0x13')][_0xf78e('0x12')]);}})[_0xf78e('0x14')](function(_0x4ce606){logger[_0xf78e('0x10')](_0xf78e('0xd'),_0x4b902f,_0x4ce606);_0x146085(_0x4ce606);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 62d3411..54fd508 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 _0x287b=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','addConditions','addActions','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x287b,0x96));var _0xb287=function(_0x4ca6a4,_0x5e9694){_0x4ca6a4=_0x4ca6a4-0x0;var _0x120555=_0x287b[_0x4ca6a4];return _0x120555;};'use strict';var multer=require(_0xb287('0x0'));var util=require('util');var path=require(_0xb287('0x1'));var timeout=require(_0xb287('0x2'));var express=require(_0xb287('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xb287('0x4'));var config=require('../../config/environment');var controller=require(_0xb287('0x5'));router['get']('/',auth[_0xb287('0x6')](),controller[_0xb287('0x7')]);router[_0xb287('0x8')](_0xb287('0x9'),auth[_0xb287('0x6')](),controller[_0xb287('0xa')]);router[_0xb287('0x8')](_0xb287('0xb'),auth[_0xb287('0x6')](),controller[_0xb287('0xc')]);router[_0xb287('0x8')](_0xb287('0xd'),auth[_0xb287('0x6')](),controller[_0xb287('0xe')]);router['post']('/',auth[_0xb287('0x6')](),controller['create']);router['post'](_0xb287('0xb'),auth['isAuthenticated'](),controller[_0xb287('0xf')]);router['post']('/:id/actions',auth[_0xb287('0x6')](),controller[_0xb287('0x10')]);router[_0xb287('0x11')](_0xb287('0x9'),auth[_0xb287('0x6')](),controller['update']);router[_0xb287('0x12')](_0xb287('0x9'),auth[_0xb287('0x6')](),controller[_0xb287('0x13')]);module[_0xb287('0x14')]=router; \ No newline at end of file +var _0x56d3=['create','addConditions','post','addActions','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','show','/:id/conditions','getConditions','getActions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56d3,0x191));var _0x356d=function(_0x3fc237,_0x531b37){_0x3fc237=_0x3fc237-0x0;var _0x5ae25b=_0x56d3[_0x3fc237];return _0x5ae25b;};'use strict';var multer=require(_0x356d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x356d('0x1'));var express=require(_0x356d('0x2'));var router=express['Router']();var auth=require(_0x356d('0x3'));var interaction=require(_0x356d('0x4'));var config=require(_0x356d('0x5'));var controller=require(_0x356d('0x6'));router[_0x356d('0x7')]('/',auth[_0x356d('0x8')](),controller['index']);router[_0x356d('0x7')]('/:id',auth[_0x356d('0x8')](),controller[_0x356d('0x9')]);router[_0x356d('0x7')](_0x356d('0xa'),auth[_0x356d('0x8')](),controller[_0x356d('0xb')]);router[_0x356d('0x7')]('/:id/actions',auth[_0x356d('0x8')](),controller[_0x356d('0xc')]);router['post']('/',auth[_0x356d('0x8')](),controller[_0x356d('0xd')]);router['post'](_0x356d('0xa'),auth[_0x356d('0x8')](),controller[_0x356d('0xe')]);router[_0x356d('0xf')]('/:id/actions',auth[_0x356d('0x8')](),controller[_0x356d('0x10')]);router[_0x356d('0x11')](_0x356d('0x12'),auth[_0x356d('0x8')](),controller[_0x356d('0x13')]);router[_0x356d('0x14')]('/:id',auth[_0x356d('0x8')](),controller[_0x356d('0x15')]);module[_0x356d('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 194a707..a92a1e1 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 _0x1f74=['onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never'];(function(_0x9dbbdb,_0x17d677){var _0x9dcf45=function(_0x119ae7){while(--_0x119ae7){_0x9dbbdb['push'](_0x9dbbdb['shift']());}};_0x9dcf45(++_0x17d677);}(_0x1f74,0x1df));var _0x41f7=function(_0x87e0dc,_0x577dce){_0x87e0dc=_0x87e0dc-0x0;var _0x2cd2d1=_0x1f74[_0x87e0dc];return _0x2cd2d1;};'use strict';var Sequelize=require(_0x41f7('0x0'));module['exports']={'name':{'type':Sequelize[_0x41f7('0x1')],'unique':_0x41f7('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x41f7('0x3')](_0x41f7('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x41f7('0x1')]},'active':{'type':Sequelize[_0x41f7('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x41f7('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x41f7('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x41f7('0x6')](0x3)[_0x41f7('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x41f7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x41f7('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41f7('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0x41f7('0x6')](0x3)[_0x41f7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41f7('0x9')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41f7('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x41f7('0x6')](0x3)[_0x41f7('0x7')],'defaultValue':0x3,'comment':_0x41f7('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x41f7('0x6')](0x5)[_0x41f7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x41f7('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x41f7('0xc')},'dialTimezone':{'type':Sequelize[_0x41f7('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x41f7('0x1')],'defaultValue':_0x41f7('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0x41f7('0x3')](_0x41f7('0xe'),_0x41f7('0xf'),_0x41f7('0x10')),'defaultValue':_0x41f7('0xe')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x41f7('0x6')](0x9)[_0x41f7('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x41f7('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x41f7('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x41f7('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x41f7('0x6')](0x9)[_0x41f7('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x41f7('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x41f7('0x6')](0x9)[_0x41f7('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x41f7('0x6')](0x9)[_0x41f7('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x41f7('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x41f7('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x41f7('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x41f7('0x6')](0x9)[_0x41f7('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x41f7('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x41f7('0x6')](0x5)[_0x41f7('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x41f7('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x41f7('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x41f7('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x41f7('0x3')]('DESC','ASC'),'defaultValue':_0x41f7('0x19')},'dialPrefix':{'type':Sequelize[_0x41f7('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x41f7('0x6')](0x3)[_0x41f7('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x41f7('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x41f7('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x41f7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41f7('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x41f7('0x6')](0x5)[_0x41f7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x41f7('0x6')](0x3)[_0x41f7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41f7('0x1c')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x41f7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x41f7('0x6')](0x3)[_0x41f7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41f7('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x41f7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41f7('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0x41f7('0x6')](0x3)[_0x41f7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x41f7('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x41f7('0x6')](0x5)[_0x41f7('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x41f7('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x41f7('0x6')](0x3)[_0x41f7('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x41f7('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x04e2=['#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting'];(function(_0x214edc,_0x49c42c){var _0x3f5c00=function(_0x4da394){while(--_0x4da394){_0x214edc['push'](_0x214edc['shift']());}};_0x3f5c00(++_0x49c42c);}(_0x04e2,0xfe));var _0x204e=function(_0x57b323,_0x39fd47){_0x57b323=_0x57b323-0x0;var _0x2d165c=_0x04e2[_0x57b323];return _0x2d165c;};'use strict';var Sequelize=require(_0x204e('0x0'));module[_0x204e('0x1')]={'name':{'type':Sequelize[_0x204e('0x2')],'unique':_0x204e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x204e('0x4')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x204e('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x204e('0x5')},'limitCalls':{'type':Sequelize[_0x204e('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x204e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x204e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x204e('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x204e('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x204e('0x9')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x204e('0xa')},'dialGlobalMaxRetry':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x204e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x204e('0xb')},'dialCheckDuplicateType':{'type':Sequelize[_0x204e('0x4')]('always',_0x204e('0xc'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x204e('0xd')},'dialAMDInitialSilence':{'type':Sequelize[_0x204e('0x6')](0x9)[_0x204e('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x204e('0xe')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x204e('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x204e('0xf')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x204e('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x204e('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x204e('0x10')},'dialAMDMinWordLength':{'type':Sequelize[_0x204e('0x6')](0x9)[_0x204e('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x204e('0x11')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x204e('0x6')](0x9)[_0x204e('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x204e('0x6')](0x9)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x204e('0x12')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x204e('0x6')](0x5)[_0x204e('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x204e('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x204e('0x13')},'dialOrderByScheduledAt':{'type':Sequelize[_0x204e('0x4')](_0x204e('0x14'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x204e('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x204e('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x204e('0x15')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x204e('0x16')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x204e('0x6')](0x5)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x204e('0x17')},'dialDropMaxRetry':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x204e('0x18')},'dialDropRetryFrequency':{'type':Sequelize[_0x204e('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x204e('0x6')](0x5)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x204e('0x19')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x204e('0x1a')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x204e('0x1b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x204e('0x6')](0x3)[_0x204e('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x204e('0x1c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x204e('0x6')](0x5)[_0x204e('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x204e('0x1d')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 7cfe39d..2dc2b92 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 _0x2dae=['UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','omit','createdAt','updatedAt','body','getHoppers','findOne','CmHopper','order','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','nolimit','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','push','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','Campaign','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','keys','find','create','role','user'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2dae,0xc3));var _0xe2da=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x2dae[_0x53ccf2];return _0x5a2964;};'use strict';var pdf=require(_0xe2da('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe2da('0x1'));var zipdir=require(_0xe2da('0x2'));var jsonpatch=require(_0xe2da('0x3'));var rp=require(_0xe2da('0x4'));var moment=require(_0xe2da('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe2da('0x6'));var util=require(_0xe2da('0x7'));var path=require(_0xe2da('0x8'));var sox=require(_0xe2da('0x9'));var csv=require('to-csv');var ejs=require(_0xe2da('0xa'));var fs=require('fs');var _=require(_0xe2da('0xb'));var squel=require(_0xe2da('0xc'));var crypto=require(_0xe2da('0xd'));var jsforce=require(_0xe2da('0xe'));var deskjs=require(_0xe2da('0xf'));var toCsv=require(_0xe2da('0x10'));var querystring=require(_0xe2da('0x11'));var Papa=require(_0xe2da('0x12'));var Redis=require('ioredis');var authService=require(_0xe2da('0x13'));var qs=require(_0xe2da('0x14'));var as=require(_0xe2da('0x15'));var hardwareService=require(_0xe2da('0x16'));var logger=require(_0xe2da('0x17'))(_0xe2da('0x18'));var utils=require(_0xe2da('0x19'));var config=require(_0xe2da('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb98909,_0x5200b1){_0x5200b1=_0x5200b1||0xcc;return function(_0x4377c6){if(_0x4377c6){return _0xb98909[_0xe2da('0x1b')](_0x5200b1);}return _0xb98909[_0xe2da('0x1c')](_0x5200b1)[_0xe2da('0x1d')]();};}function respondWithResult(_0xfab73e,_0x5660b5){_0x5660b5=_0x5660b5||0xc8;return function(_0x295a86){if(_0x295a86){return _0xfab73e['status'](_0x5660b5)[_0xe2da('0x1e')](_0x295a86);}};}function respondWithFilteredResult(_0x5e1702,_0x586b27){return function(_0x403d1c){if(_0x403d1c){var _0x3dfc52=_0x403d1c[_0xe2da('0x1f')],_0x33f919=_0x586b27[_0xe2da('0x20')],_0x4dc58b=_0x586b27[_0xe2da('0x20')]+_0x586b27['limit'],_0x25d4fa;if(_0x4dc58b>=_0x3dfc52){_0x4dc58b=_0x3dfc52;_0x25d4fa=0xc8;}else{_0x25d4fa=0xce;}_0x5e1702[_0xe2da('0x1c')](_0x25d4fa);return _0x5e1702[_0xe2da('0x21')](_0xe2da('0x22'),_0x33f919+'-'+_0x4dc58b+'/'+_0x3dfc52)[_0xe2da('0x1e')](_0x403d1c);}return null;};}function patchUpdates(_0x329ffe){return function(_0x4c03a7){try{jsonpatch[_0xe2da('0x23')](_0x4c03a7,_0x329ffe,!![]);}catch(_0x2e16b2){return BPromise['reject'](_0x2e16b2);}return _0x4c03a7[_0xe2da('0x24')]();};}function saveUpdates(_0x254b37,_0x332193){return function(_0x203d36){if(_0x203d36){return _0x203d36[_0xe2da('0x25')](_0x254b37)[_0xe2da('0x26')](function(_0x5a9ffe){return _0x5a9ffe;});}return null;};}function removeEntity(_0x467cd6,_0x53cc4e){return function(_0x30efdc){if(_0x30efdc){return _0x30efdc[_0xe2da('0x27')]()[_0xe2da('0x26')](function(){var _0x28f1d3=_0x30efdc[_0xe2da('0x28')]({'plain':!![]});var _0x1e45e9=_0xe2da('0x29');return db[_0xe2da('0x2a')]['destroy']({'where':{'type':_0x1e45e9,'resourceId':_0x28f1d3['id']}})[_0xe2da('0x26')](function(){return _0x30efdc;});})[_0xe2da('0x26')](function(){_0x467cd6[_0xe2da('0x1c')](0xcc)[_0xe2da('0x1d')]();});}};}function handleEntityNotFound(_0x3778dc,_0x230fb8){return function(_0x124d93){if(!_0x124d93){_0x3778dc['sendStatus'](0x194);}return _0x124d93;};}function handleError(_0x2adc49,_0x3e23d7){_0x3e23d7=_0x3e23d7||0x1f4;return function(_0x1dc228){logger[_0xe2da('0x2b')](_0x1dc228[_0xe2da('0x2c')]);if(_0x1dc228[_0xe2da('0x2d')]){delete _0x1dc228[_0xe2da('0x2d')];}_0x2adc49[_0xe2da('0x1c')](_0x3e23d7)['send'](_0x1dc228);};}exports['index']=function(_0x5e259a,_0x3c4845){var _0x8c91db={},_0x4146ad={},_0x1ab91a={'count':0x0,'rows':[]};var _0x5de7fb=_['map'](db[_0xe2da('0x2e')][_0xe2da('0x2f')],function(_0x262d40){return{'name':_0x262d40[_0xe2da('0x30')],'type':_0x262d40[_0xe2da('0x31')][_0xe2da('0x32')]};});_0x4146ad[_0xe2da('0x33')]=_[_0xe2da('0x34')](_0x5de7fb,_0xe2da('0x2d'));_0x4146ad['query']=_['keys'](_0x5e259a[_0xe2da('0x35')]);_0x4146ad[_0xe2da('0x36')]=_[_0xe2da('0x37')](_0x4146ad[_0xe2da('0x33')],_0x4146ad[_0xe2da('0x35')]);_0x8c91db[_0xe2da('0x38')]=_[_0xe2da('0x37')](_0x4146ad[_0xe2da('0x33')],qs[_0xe2da('0x39')](_0x5e259a[_0xe2da('0x35')][_0xe2da('0x39')]));_0x8c91db[_0xe2da('0x38')]=_0x8c91db[_0xe2da('0x38')][_0xe2da('0x3a')]?_0x8c91db[_0xe2da('0x38')]:_0x4146ad[_0xe2da('0x33')];if(!_0x5e259a[_0xe2da('0x35')][_0xe2da('0x3b')]('nolimit')){_0x8c91db[_0xe2da('0x3c')]=qs[_0xe2da('0x3c')](_0x5e259a[_0xe2da('0x35')]['limit']);_0x8c91db[_0xe2da('0x20')]=qs[_0xe2da('0x20')](_0x5e259a[_0xe2da('0x35')]['offset']);}_0x8c91db['order']=qs[_0xe2da('0x3d')](_0x5e259a[_0xe2da('0x35')]['sort']);_0x8c91db[_0xe2da('0x3e')]=qs[_0xe2da('0x36')](_[_0xe2da('0x3f')](_0x5e259a[_0xe2da('0x35')],_0x4146ad[_0xe2da('0x36')]));if(_0x5e259a['query'][_0xe2da('0x40')]){_0x8c91db['where']=_['merge'](_0x8c91db[_0xe2da('0x3e')],{'$or':_['map'](_0x5de7fb,function(_0x2aa22c){if(_0x2aa22c[_0xe2da('0x31')]!=='VIRTUAL'){var _0x365968={};_0x365968[_0x2aa22c[_0xe2da('0x2d')]]={'$like':'%'+_0x5e259a['query']['filter']+'%'};return _0x365968;}})});}_0x8c91db=_['merge']({},_0x8c91db,_0x5e259a[_0xe2da('0x41')]);var _0xfe0812={'where':_0x8c91db[_0xe2da('0x3e')]};return db[_0xe2da('0x2e')][_0xe2da('0x1f')](_0xfe0812)[_0xe2da('0x26')](function(_0x14c30f){_0x1ab91a['count']=_0x14c30f;if(_0x5e259a[_0xe2da('0x35')][_0xe2da('0x42')]){_0x8c91db[_0xe2da('0x43')]=[{'all':!![]}];}return db[_0xe2da('0x2e')][_0xe2da('0x44')](_0x8c91db);})['then'](function(_0x4495fc){_0x1ab91a[_0xe2da('0x45')]=_0x4495fc;return _0x1ab91a;})[_0xe2da('0x26')](respondWithFilteredResult(_0x3c4845,_0x8c91db))['catch'](handleError(_0x3c4845,null));};exports[_0xe2da('0x46')]=function(_0x279f67,_0x1529f4){var _0x4096c5={'raw':![],'where':{'id':_0x279f67[_0xe2da('0x47')]['id']}},_0x2b229f={};_0x2b229f[_0xe2da('0x33')]=_[_0xe2da('0x48')](db['Campaign'][_0xe2da('0x2f')]);_0x2b229f[_0xe2da('0x35')]=_[_0xe2da('0x48')](_0x279f67[_0xe2da('0x35')]);_0x2b229f[_0xe2da('0x36')]=_['intersection'](_0x2b229f[_0xe2da('0x33')],_0x2b229f[_0xe2da('0x35')]);_0x4096c5[_0xe2da('0x38')]=_[_0xe2da('0x37')](_0x2b229f[_0xe2da('0x33')],qs[_0xe2da('0x39')](_0x279f67[_0xe2da('0x35')]['fields']));_0x4096c5[_0xe2da('0x38')]=_0x4096c5['attributes'][_0xe2da('0x3a')]?_0x4096c5[_0xe2da('0x38')]:_0x2b229f[_0xe2da('0x33')];if(_0x279f67['query'][_0xe2da('0x42')]){_0x4096c5[_0xe2da('0x43')]=[{'all':!![]}];}_0x4096c5=_['merge']({},_0x4096c5,_0x279f67[_0xe2da('0x41')]);return db[_0xe2da('0x2e')][_0xe2da('0x49')](_0x4096c5)['then'](handleEntityNotFound(_0x1529f4,null))[_0xe2da('0x26')](respondWithResult(_0x1529f4,null))['catch'](handleError(_0x1529f4,null));};exports['create']=function(_0x16a393,_0x55afef){return db[_0xe2da('0x2e')][_0xe2da('0x4a')](_0x16a393['body'],{})[_0xe2da('0x26')](function(_0x1464b7){var _0x482547=_0x16a393['user'][_0xe2da('0x28')]({'plain':!![]});if(!_0x482547)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x482547[_0xe2da('0x4b')]===_0xe2da('0x4c')){var _0x259546=_0x1464b7[_0xe2da('0x28')]({'plain':!![]});var _0x3e46b=_0xe2da('0x29');return db[_0xe2da('0x4d')][_0xe2da('0x49')]({'where':{'name':_0x3e46b,'userProfileId':_0x482547[_0xe2da('0x4e')]},'raw':!![]})['then'](function(_0x3ce9a8){if(_0x3ce9a8&&_0x3ce9a8[_0xe2da('0x4f')]===0x0){return db[_0xe2da('0x2a')]['create']({'name':_0x259546[_0xe2da('0x2d')],'resourceId':_0x259546['id'],'type':_0x3ce9a8[_0xe2da('0x2d')],'sectionId':_0x3ce9a8['id']},{})[_0xe2da('0x26')](function(){return _0x1464b7;});}else{return _0x1464b7;}})[_0xe2da('0x50')](function(_0x242049){logger[_0xe2da('0x2b')](_0xe2da('0x51'),_0x242049);throw _0x242049;});}return _0x1464b7;})['then'](respondWithResult(_0x55afef,0xc9))['catch'](handleError(_0x55afef,null));};exports[_0xe2da('0x52')]=function(_0x39c33b,_0x28f916){var _0x5cf8db={'where':{'id':_0x39c33b[_0xe2da('0x47')]['id']}},_0x572690={};_0x572690['model']=_[_0xe2da('0x48')](db[_0xe2da('0x2e')][_0xe2da('0x2f')]);_0x5cf8db[_0xe2da('0x38')]=_[_0xe2da('0x37')](_0x572690[_0xe2da('0x33')],qs[_0xe2da('0x39')](_0x39c33b[_0xe2da('0x35')][_0xe2da('0x39')]));_0x5cf8db['attributes']=_0x5cf8db[_0xe2da('0x38')][_0xe2da('0x3a')]?_0x5cf8db[_0xe2da('0x38')]:_0x572690[_0xe2da('0x33')];if(_0x39c33b['query'][_0xe2da('0x42')]){_0x5cf8db[_0xe2da('0x43')]=[{'all':!![]}];}_0x5cf8db=_[_0xe2da('0x53')]({},_0x5cf8db,_0x39c33b['options']);return db[_0xe2da('0x2e')][_0xe2da('0x49')](_0x5cf8db)[_0xe2da('0x26')](handleEntityNotFound(_0x28f916,null))[_0xe2da('0x26')](function(_0x188bb0){if(_0x188bb0){var _0x22a571=_0x188bb0[_0xe2da('0x28')]({'plain':!![]});_0x22a571=qs[_0xe2da('0x54')](_0x22a571,['id',_0xe2da('0x55'),_0xe2da('0x56')]);_0x39c33b[_0xe2da('0x57')]=_[_0xe2da('0x54')](_0x39c33b['body'],['id',_0xe2da('0x55'),_0xe2da('0x56')]);return db[_0xe2da('0x2e')][_0xe2da('0x4a')](_[_0xe2da('0x53')](_0x22a571,_0x39c33b[_0xe2da('0x57')]),{'include':_0x39c33b[_0xe2da('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0xe2da('0x26')](function(_0x4b1562){var _0x3abde9=_0x39c33b[_0xe2da('0x4c')]['get']({'plain':!![]});if(!_0x3abde9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abde9[_0xe2da('0x4b')]==='user'){var _0x48e2b1=_0x4b1562['get']({'plain':!![]});var _0x148615=_0xe2da('0x29');return db[_0xe2da('0x4d')]['find']({'where':{'name':_0x148615,'userProfileId':_0x3abde9['userProfileId']},'raw':!![]})['then'](function(_0x3ef7c7){if(_0x3ef7c7&&_0x3ef7c7[_0xe2da('0x4f')]===0x0){return db[_0xe2da('0x2a')][_0xe2da('0x4a')]({'name':_0x48e2b1['name'],'resourceId':_0x48e2b1['id'],'type':_0x3ef7c7[_0xe2da('0x2d')],'sectionId':_0x3ef7c7['id']},{})[_0xe2da('0x26')](function(){return _0x4b1562;});}else{return _0x4b1562;}})[_0xe2da('0x50')](function(_0x1adf15){logger[_0xe2da('0x2b')](_0xe2da('0x51'),_0x1adf15);throw _0x1adf15;});}return _0x4b1562;});}})[_0xe2da('0x26')](respondWithResult(_0x28f916,0xc9))['catch'](handleError(_0x28f916,null));};exports[_0xe2da('0x25')]=function(_0x4666b3,_0x3f0a4b){if(_0x4666b3[_0xe2da('0x57')]['id']){delete _0x4666b3[_0xe2da('0x57')]['id'];}return db['Campaign'][_0xe2da('0x49')]({'where':{'id':_0x4666b3['params']['id']}})[_0xe2da('0x26')](handleEntityNotFound(_0x3f0a4b,null))['then'](saveUpdates(_0x4666b3[_0xe2da('0x57')],null))['then'](respondWithResult(_0x3f0a4b,null))['catch'](handleError(_0x3f0a4b,null));};exports[_0xe2da('0x27')]=function(_0x405743,_0x2cff55){return db[_0xe2da('0x2e')][_0xe2da('0x49')]({'where':{'id':_0x405743[_0xe2da('0x47')]['id']}})[_0xe2da('0x26')](handleEntityNotFound(_0x2cff55,null))[_0xe2da('0x26')](removeEntity(_0x2cff55,null))[_0xe2da('0x50')](handleError(_0x2cff55,null));};exports[_0xe2da('0x58')]=function(_0x5d7317,_0x430a65,_0x1474b7){var _0x3eb2c3={'raw':!![],'where':{}};var _0x346a38={};var _0x4ea2a6={'count':0x0,'rows':[]};return db[_0xe2da('0x2e')][_0xe2da('0x59')]({'where':{'id':_0x5d7317[_0xe2da('0x47')]['id']}})[_0xe2da('0x26')](handleEntityNotFound(_0x430a65,null))['then'](function(_0x455bb2){if(_0x455bb2){_0x346a38['model']=_[_0xe2da('0x48')](db[_0xe2da('0x5a')]['rawAttributes']);_0x346a38[_0xe2da('0x35')]=_[_0xe2da('0x48')](_0x5d7317[_0xe2da('0x35')]);_0x346a38[_0xe2da('0x36')]=_[_0xe2da('0x37')](_0x346a38['model'],_0x346a38[_0xe2da('0x35')]);_0x3eb2c3['attributes']=_['intersection'](_0x346a38['model'],qs['fields'](_0x5d7317[_0xe2da('0x35')][_0xe2da('0x39')]));_0x3eb2c3[_0xe2da('0x38')]=_0x3eb2c3[_0xe2da('0x38')][_0xe2da('0x3a')]?_0x3eb2c3[_0xe2da('0x38')]:_0x346a38[_0xe2da('0x33')];if(!_0x5d7317[_0xe2da('0x35')][_0xe2da('0x3b')]('nolimit')){_0x3eb2c3[_0xe2da('0x3c')]=qs[_0xe2da('0x3c')](_0x5d7317[_0xe2da('0x35')][_0xe2da('0x3c')]);_0x3eb2c3[_0xe2da('0x20')]=qs[_0xe2da('0x20')](_0x5d7317[_0xe2da('0x35')][_0xe2da('0x20')]);}_0x3eb2c3[_0xe2da('0x5b')]=qs[_0xe2da('0x3d')](_0x5d7317['query'][_0xe2da('0x3d')]);_0x3eb2c3[_0xe2da('0x3e')]=qs[_0xe2da('0x36')](_[_0xe2da('0x3f')](_0x5d7317[_0xe2da('0x35')],_0x346a38[_0xe2da('0x36')]));_0x3eb2c3[_0xe2da('0x3e')][_0xe2da('0x5c')]=_0x455bb2['id'];if(_0x5d7317[_0xe2da('0x35')][_0xe2da('0x40')]){_0x3eb2c3[_0xe2da('0x3e')]=_[_0xe2da('0x53')](_0x3eb2c3['where'],{'$or':_[_0xe2da('0x34')](_0x3eb2c3['attributes'],function(_0x2c16a1){var _0x6babeb={};_0x6babeb[_0x2c16a1]={'$like':'%'+_0x5d7317[_0xe2da('0x35')][_0xe2da('0x40')]+'%'};return _0x6babeb;})});}_0x3eb2c3=_[_0xe2da('0x53')]({},_0x3eb2c3,_0x5d7317[_0xe2da('0x41')]);return db[_0xe2da('0x5a')]['count']({'where':_0x3eb2c3[_0xe2da('0x3e')]})[_0xe2da('0x26')](function(_0x140daa){_0x4ea2a6[_0xe2da('0x1f')]=_0x140daa;if(_0x5d7317[_0xe2da('0x35')][_0xe2da('0x42')]){_0x3eb2c3['include']=[{'all':!![]}];}return db[_0xe2da('0x5a')][_0xe2da('0x44')](_0x3eb2c3);})[_0xe2da('0x26')](function(_0x96caa5){_0x4ea2a6[_0xe2da('0x45')]=_0x96caa5;return _0x4ea2a6;});}})[_0xe2da('0x26')](respondWithFilteredResult(_0x430a65,_0x3eb2c3))[_0xe2da('0x50')](handleError(_0x430a65,null));};exports['getHopperHistories']=function(_0x298511,_0x2937f2,_0x3934f2){var _0x172745={'raw':!![],'where':{}};var _0x158940={};var _0xc3088a={'count':0x0,'rows':[]};return db['Campaign'][_0xe2da('0x59')]({'where':{'id':_0x298511['params']['id']}})['then'](handleEntityNotFound(_0x2937f2,null))[_0xe2da('0x26')](function(_0x6b5a99){if(_0x6b5a99){_0x158940[_0xe2da('0x33')]=_['keys'](db[_0xe2da('0x5d')][_0xe2da('0x2f')]);_0x158940[_0xe2da('0x35')]=_[_0xe2da('0x48')](_0x298511['query']);_0x158940[_0xe2da('0x36')]=_['intersection'](_0x158940['model'],_0x158940[_0xe2da('0x35')]);_0x172745[_0xe2da('0x38')]=_[_0xe2da('0x37')](_0x158940[_0xe2da('0x33')],qs[_0xe2da('0x39')](_0x298511[_0xe2da('0x35')]['fields']));_0x172745[_0xe2da('0x38')]=_0x172745[_0xe2da('0x38')][_0xe2da('0x3a')]?_0x172745['attributes']:_0x158940[_0xe2da('0x33')];if(!_0x298511[_0xe2da('0x35')][_0xe2da('0x3b')]('nolimit')){_0x172745[_0xe2da('0x3c')]=qs[_0xe2da('0x3c')](_0x298511[_0xe2da('0x35')][_0xe2da('0x3c')]);_0x172745[_0xe2da('0x20')]=qs['offset'](_0x298511[_0xe2da('0x35')][_0xe2da('0x20')]);}_0x172745[_0xe2da('0x5b')]=qs[_0xe2da('0x3d')](_0x298511[_0xe2da('0x35')][_0xe2da('0x3d')]);_0x172745[_0xe2da('0x3e')]=qs[_0xe2da('0x36')](_[_0xe2da('0x3f')](_0x298511['query'],_0x158940[_0xe2da('0x36')]));_0x172745[_0xe2da('0x3e')]['CampaignId']=_0x6b5a99['id'];if(_0x298511[_0xe2da('0x35')]['filter']){_0x172745['where']=_['merge'](_0x172745[_0xe2da('0x3e')],{'$or':_[_0xe2da('0x34')](_0x172745['attributes'],function(_0x34344d){var _0x5484f5={};_0x5484f5[_0x34344d]={'$like':'%'+_0x298511[_0xe2da('0x35')][_0xe2da('0x40')]+'%'};return _0x5484f5;})});}_0x172745=_[_0xe2da('0x53')]({},_0x172745,_0x298511[_0xe2da('0x41')]);return db[_0xe2da('0x5d')][_0xe2da('0x1f')]({'where':_0x172745[_0xe2da('0x3e')]})['then'](function(_0x5f2971){_0xc3088a[_0xe2da('0x1f')]=_0x5f2971;if(_0x298511[_0xe2da('0x35')][_0xe2da('0x42')]){_0x172745[_0xe2da('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xe2da('0x44')](_0x172745);})['then'](function(_0x80a3e8){_0xc3088a[_0xe2da('0x45')]=_0x80a3e8;return _0xc3088a;});}})[_0xe2da('0x26')](respondWithFilteredResult(_0x2937f2,_0x172745))[_0xe2da('0x50')](handleError(_0x2937f2,null));};exports[_0xe2da('0x5e')]=function(_0x414fa3,_0x5102b6,_0x315939){var _0xe20312={'raw':!![],'where':{}};var _0x38ed03={};var _0x35caec={'count':0x0,'rows':[]};return db[_0xe2da('0x2e')][_0xe2da('0x59')]({'where':{'id':_0x414fa3[_0xe2da('0x47')]['id']}})[_0xe2da('0x26')](handleEntityNotFound(_0x5102b6,null))['then'](function(_0x260c58){if(_0x260c58){_0x38ed03['model']=_[_0xe2da('0x48')](db[_0xe2da('0x5f')]['rawAttributes']);_0x38ed03['query']=_[_0xe2da('0x48')](_0x414fa3['query']);_0x38ed03[_0xe2da('0x36')]=_[_0xe2da('0x37')](_0x38ed03[_0xe2da('0x33')],_0x38ed03['query']);_0xe20312[_0xe2da('0x38')]=_['intersection'](_0x38ed03['model'],qs[_0xe2da('0x39')](_0x414fa3[_0xe2da('0x35')]['fields']));_0xe20312[_0xe2da('0x38')]=_0xe20312['attributes'][_0xe2da('0x3a')]?_0xe20312[_0xe2da('0x38')]:_0x38ed03[_0xe2da('0x33')];if(!_0x414fa3[_0xe2da('0x35')][_0xe2da('0x3b')]('nolimit')){_0xe20312[_0xe2da('0x3c')]=qs[_0xe2da('0x3c')](_0x414fa3[_0xe2da('0x35')]['limit']);_0xe20312[_0xe2da('0x20')]=qs[_0xe2da('0x20')](_0x414fa3[_0xe2da('0x35')][_0xe2da('0x20')]);}_0xe20312[_0xe2da('0x5b')]=qs[_0xe2da('0x3d')](_0x414fa3[_0xe2da('0x35')][_0xe2da('0x3d')]);_0xe20312['where']=qs['filters'](_[_0xe2da('0x3f')](_0x414fa3['query'],_0x38ed03[_0xe2da('0x36')]));_0xe20312[_0xe2da('0x3e')][_0xe2da('0x5c')]=_0x260c58['id'];if(_0x414fa3[_0xe2da('0x35')][_0xe2da('0x40')]){_0xe20312[_0xe2da('0x3e')]=_[_0xe2da('0x53')](_0xe20312['where'],{'$or':_[_0xe2da('0x34')](_0xe20312['attributes'],function(_0x1d8a75){var _0x5d5bc6={};_0x5d5bc6[_0x1d8a75]={'$like':'%'+_0x414fa3['query'][_0xe2da('0x40')]+'%'};return _0x5d5bc6;})});}_0xe20312=_[_0xe2da('0x53')]({},_0xe20312,_0x414fa3[_0xe2da('0x41')]);return db[_0xe2da('0x5f')][_0xe2da('0x1f')]({'where':_0xe20312[_0xe2da('0x3e')]})[_0xe2da('0x26')](function(_0x52f25b){_0x35caec[_0xe2da('0x1f')]=_0x52f25b;if(_0x414fa3[_0xe2da('0x35')][_0xe2da('0x42')]){_0xe20312['include']=[{'all':!![]}];}return db[_0xe2da('0x5f')]['findAll'](_0xe20312);})['then'](function(_0x17c7da){_0x35caec[_0xe2da('0x45')]=_0x17c7da;return _0x35caec;});}})['then'](respondWithFilteredResult(_0x5102b6,_0xe20312))['catch'](handleError(_0x5102b6,null));};exports[_0xe2da('0x60')]=function(_0x51653d,_0x37cf4b,_0x2da9ab){var _0x3cca50={'raw':!![],'where':{}};var _0x2b7b18={};var _0x2b399e={'count':0x0,'rows':[]};return db[_0xe2da('0x2e')]['findOne']({'where':{'id':_0x51653d[_0xe2da('0x47')]['id']}})[_0xe2da('0x26')](handleEntityNotFound(_0x37cf4b,null))[_0xe2da('0x26')](function(_0x329413){if(_0x329413){_0x2b7b18[_0xe2da('0x33')]=_[_0xe2da('0x48')](db['CmHopperBlack'][_0xe2da('0x2f')]);_0x2b7b18[_0xe2da('0x35')]=_[_0xe2da('0x48')](_0x51653d['query']);_0x2b7b18[_0xe2da('0x36')]=_[_0xe2da('0x37')](_0x2b7b18[_0xe2da('0x33')],_0x2b7b18[_0xe2da('0x35')]);_0x3cca50[_0xe2da('0x38')]=_[_0xe2da('0x37')](_0x2b7b18['model'],qs['fields'](_0x51653d[_0xe2da('0x35')][_0xe2da('0x39')]));_0x3cca50['attributes']=_0x3cca50['attributes'][_0xe2da('0x3a')]?_0x3cca50['attributes']:_0x2b7b18[_0xe2da('0x33')];if(!_0x51653d[_0xe2da('0x35')]['hasOwnProperty'](_0xe2da('0x61'))){_0x3cca50[_0xe2da('0x3c')]=qs[_0xe2da('0x3c')](_0x51653d[_0xe2da('0x35')][_0xe2da('0x3c')]);_0x3cca50[_0xe2da('0x20')]=qs['offset'](_0x51653d[_0xe2da('0x35')]['offset']);}_0x3cca50[_0xe2da('0x5b')]=qs[_0xe2da('0x3d')](_0x51653d[_0xe2da('0x35')]['sort']);_0x3cca50[_0xe2da('0x3e')]=qs['filters'](_[_0xe2da('0x3f')](_0x51653d['query'],_0x2b7b18['filters']));_0x3cca50[_0xe2da('0x3e')]['CampaignId']=_0x329413['id'];if(_0x51653d[_0xe2da('0x35')][_0xe2da('0x40')]){_0x3cca50[_0xe2da('0x3e')]=_[_0xe2da('0x53')](_0x3cca50[_0xe2da('0x3e')],{'$or':_[_0xe2da('0x34')](_0x3cca50[_0xe2da('0x38')],function(_0x593a09){var _0x5207e5={};_0x5207e5[_0x593a09]={'$like':'%'+_0x51653d[_0xe2da('0x35')][_0xe2da('0x40')]+'%'};return _0x5207e5;})});}_0x3cca50=_[_0xe2da('0x53')]({},_0x3cca50,_0x51653d[_0xe2da('0x41')]);return db[_0xe2da('0x62')][_0xe2da('0x1f')]({'where':_0x3cca50['where']})['then'](function(_0x446fe1){_0x2b399e[_0xe2da('0x1f')]=_0x446fe1;if(_0x51653d[_0xe2da('0x35')]['includeAll']){_0x3cca50[_0xe2da('0x43')]=[{'all':!![]}];}return db[_0xe2da('0x62')][_0xe2da('0x44')](_0x3cca50);})[_0xe2da('0x26')](function(_0x53e7d8){_0x2b399e[_0xe2da('0x45')]=_0x53e7d8;return _0x2b399e;});}})['then'](respondWithFilteredResult(_0x37cf4b,_0x3cca50))['catch'](handleError(_0x37cf4b,null));};exports[_0xe2da('0x63')]=function(_0x4d4e9c,_0x51905b,_0xb7c12){var _0x7a762c={};var _0x378852={};var _0x316c03;var _0x4be1fe;return db[_0xe2da('0x2e')]['findOne']({'where':{'id':_0x4d4e9c['params']['id']}})['then'](handleEntityNotFound(_0x51905b,null))[_0xe2da('0x26')](function(_0x2597d9){if(_0x2597d9){_0x316c03=_0x2597d9;_0x378852['model']=_[_0xe2da('0x48')](db[_0xe2da('0x64')]['rawAttributes']);_0x378852[_0xe2da('0x35')]=_[_0xe2da('0x48')](_0x4d4e9c['query']);_0x378852[_0xe2da('0x36')]=_['intersection'](_0x378852[_0xe2da('0x33')],_0x378852[_0xe2da('0x35')]);_0x7a762c['attributes']=_['intersection'](_0x378852[_0xe2da('0x33')],qs[_0xe2da('0x39')](_0x4d4e9c[_0xe2da('0x35')]['fields']));_0x7a762c['attributes']=_0x7a762c['attributes']['length']?_0x7a762c[_0xe2da('0x38')]:_0x378852[_0xe2da('0x33')];_0x7a762c[_0xe2da('0x5b')]=qs[_0xe2da('0x3d')](_0x4d4e9c[_0xe2da('0x35')][_0xe2da('0x3d')]);_0x7a762c[_0xe2da('0x3e')]=qs[_0xe2da('0x36')](_[_0xe2da('0x3f')](_0x4d4e9c[_0xe2da('0x35')],_0x378852[_0xe2da('0x36')]));if(_0x4d4e9c[_0xe2da('0x35')]['filter']){_0x7a762c[_0xe2da('0x3e')]=_[_0xe2da('0x53')](_0x7a762c['where'],{'$or':_[_0xe2da('0x34')](_0x7a762c[_0xe2da('0x38')],function(_0xe6181a){var _0x16b8c4={};_0x16b8c4[_0xe6181a]={'$like':'%'+_0x4d4e9c['query'][_0xe2da('0x40')]+'%'};return _0x16b8c4;})});}_0x7a762c=_[_0xe2da('0x53')]({},_0x7a762c,_0x4d4e9c[_0xe2da('0x41')]);return _0x316c03[_0xe2da('0x63')](_0x7a762c);}})[_0xe2da('0x26')](function(_0x3dd581){if(_0x3dd581){_0x4be1fe=_0x3dd581[_0xe2da('0x3a')];if(!_0x4d4e9c[_0xe2da('0x35')][_0xe2da('0x3b')](_0xe2da('0x61'))){_0x7a762c[_0xe2da('0x3c')]=qs[_0xe2da('0x3c')](_0x4d4e9c['query'][_0xe2da('0x3c')]);_0x7a762c[_0xe2da('0x20')]=qs[_0xe2da('0x20')](_0x4d4e9c['query'][_0xe2da('0x20')]);}return _0x316c03[_0xe2da('0x63')](_0x7a762c);}})[_0xe2da('0x26')](function(_0xbb17d8){if(_0xbb17d8){return _0xbb17d8?{'count':_0x4be1fe,'rows':_0xbb17d8}:null;}})[_0xe2da('0x26')](respondWithResult(_0x51905b,null))[_0xe2da('0x50')](handleError(_0x51905b,null));};exports['addLists']=function(_0x1535e3,_0x1b8217,_0x540e77){var _0x3a19ab,_0x428a58;return db['Campaign']['find']({'where':{'id':_0x1535e3[_0xe2da('0x47')]['id']}})[_0xe2da('0x26')](handleEntityNotFound(_0x1b8217,null))['then'](function(_0x283e89){if(_0x283e89){_0x428a58=_0x283e89;return _0x283e89[_0xe2da('0x65')](_0x1535e3[_0xe2da('0x57')][_0xe2da('0x66')],_[_0xe2da('0x54')](_0x1535e3['body'],[_0xe2da('0x66'),'id'])||{});}return null;})[_0xe2da('0x67')](function(_0x4bb2a8){var _0x501068;_0x3a19ab=_0x4bb2a8||[];var _0x47d1e4=[];if(_0x4bb2a8){for(var _0x6e59db=0x0;_0x6e59db<_0x4bb2a8['length'];_0x6e59db+=0x1){var _0x4e7bc3=_0x4bb2a8[_0x6e59db]['get']({'plain':!![]});_0x428a58[_0xe2da('0x68')]=_0x1535e3['body'][_0xe2da('0x68')]?_0x1535e3[_0xe2da('0x57')][_0xe2da('0x68')]:_0x428a58[_0xe2da('0x68')];switch(_0x428a58['dialCheckDuplicateType']){case _0xe2da('0x69'):_0x501068=squel[_0xe2da('0x6a')]()[_0xe2da('0x6b')](_0xe2da('0x6c'))[_0xe2da('0x6d')]([_0xe2da('0x6e'),_0xe2da('0x6f'),_0xe2da('0x70'),_0xe2da('0x71'),_0xe2da('0x5c'),_0xe2da('0x55'),_0xe2da('0x56')],squel[_0xe2da('0x72')]()[_0xe2da('0x73')]('phone',_0xe2da('0x6e'))['field'](_0xe2da('0x74'),_0xe2da('0x6f'))[_0xe2da('0x73')]('id','ContactId')[_0xe2da('0x73')](_0x4e7bc3[_0xe2da('0x75')][_0xe2da('0x76')](),_0xe2da('0x71'))[_0xe2da('0x73')](_0x1535e3[_0xe2da('0x47')]['id']['toString'](),_0xe2da('0x5c'))[_0xe2da('0x73')](_0xe2da('0x74'),_0xe2da('0x55'))[_0xe2da('0x73')](_0xe2da('0x74'),'updatedAt')[_0xe2da('0x77')](_0xe2da('0x78'))[_0xe2da('0x3e')]('deletedAt\x20IS\x20NULL')[_0xe2da('0x3e')]('ListId\x20=\x20?',_0x4e7bc3[_0xe2da('0x75')][_0xe2da('0x76')]())[_0xe2da('0x3e')](_0xe2da('0x79'))[_0xe2da('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe2da('0x72')]()[_0xe2da('0x73')](_0xe2da('0x7a'))[_0xe2da('0x77')]('cm_hopper_final')[_0xe2da('0x3e')](_0xe2da('0x7b'),_0x1535e3['params']['id'][_0xe2da('0x76')]()))[_0xe2da('0x3e')](_0xe2da('0x7c'),squel[_0xe2da('0x72')]()[_0xe2da('0x73')](_0xe2da('0x7d'))['from'](_0xe2da('0x6c'))[_0xe2da('0x3e')]('CampaignId\x20=\x20?',_0x1535e3['params']['id']['toString']())))['toString']();break;case'onlyIfOpen':_0x501068=squel[_0xe2da('0x6a')]()[_0xe2da('0x6b')]('cm_hopper')[_0xe2da('0x6d')]([_0xe2da('0x6e'),_0xe2da('0x6f'),_0xe2da('0x70'),_0xe2da('0x71'),_0xe2da('0x5c'),_0xe2da('0x55'),_0xe2da('0x56')],squel[_0xe2da('0x72')]()[_0xe2da('0x73')](_0xe2da('0x6e'),_0xe2da('0x6e'))[_0xe2da('0x73')](_0xe2da('0x74'),_0xe2da('0x6f'))['field']('id','ContactId')[_0xe2da('0x73')](_0x4e7bc3[_0xe2da('0x75')]['toString'](),_0xe2da('0x71'))['field'](_0x1535e3[_0xe2da('0x47')]['id'][_0xe2da('0x76')](),_0xe2da('0x5c'))[_0xe2da('0x73')]('NOW()',_0xe2da('0x55'))[_0xe2da('0x73')](_0xe2da('0x74'),_0xe2da('0x56'))[_0xe2da('0x77')](_0xe2da('0x78'))[_0xe2da('0x3e')](_0xe2da('0x7e'))[_0xe2da('0x3e')](_0xe2da('0x7f'),_0x4e7bc3[_0xe2da('0x75')][_0xe2da('0x76')]())[_0xe2da('0x3e')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xe2da('0x7c'),squel[_0xe2da('0x72')]()['field'](_0xe2da('0x7d'))[_0xe2da('0x77')](_0xe2da('0x6c'))[_0xe2da('0x3e')](_0xe2da('0x7b'),_0x1535e3['params']['id'][_0xe2da('0x76')]())))[_0xe2da('0x76')]();break;default:_0x501068=squel[_0xe2da('0x6a')]()[_0xe2da('0x6b')](_0xe2da('0x6c'))[_0xe2da('0x6d')]([_0xe2da('0x6e'),_0xe2da('0x6f'),'ContactId','ListId',_0xe2da('0x5c'),_0xe2da('0x55'),_0xe2da('0x56')],squel[_0xe2da('0x72')]()['field'](_0xe2da('0x6e'),_0xe2da('0x6e'))['field'](_0xe2da('0x74'),_0xe2da('0x6f'))[_0xe2da('0x73')]('id',_0xe2da('0x70'))[_0xe2da('0x73')](_0x4e7bc3['CmListId'][_0xe2da('0x76')](),_0xe2da('0x71'))[_0xe2da('0x73')](_0x1535e3[_0xe2da('0x47')]['id']['toString'](),_0xe2da('0x5c'))[_0xe2da('0x73')](_0xe2da('0x74'),'createdAt')['field'](_0xe2da('0x74'),_0xe2da('0x56'))[_0xe2da('0x77')](_0xe2da('0x78'))['where'](_0xe2da('0x7e'))[_0xe2da('0x3e')](_0xe2da('0x7f'),_0x4e7bc3[_0xe2da('0x75')][_0xe2da('0x76')]())[_0xe2da('0x3e')](_0xe2da('0x79')))[_0xe2da('0x76')]();}_0x47d1e4['push'](db[_0xe2da('0x80')][_0xe2da('0x35')](_0x501068));}return BPromise[_0xe2da('0x81')](_0x47d1e4);}})[_0xe2da('0x26')](function(){return _0x3a19ab;})['then'](respondWithResult(_0x1b8217,null))[_0xe2da('0x50')](handleError(_0x1b8217,null));};exports[_0xe2da('0x82')]=function(_0x40636b,_0x1a26e5,_0x2d0d7a){return db[_0xe2da('0x2e')][_0xe2da('0x49')]({'where':{'id':_0x40636b[_0xe2da('0x47')]['id']}})[_0xe2da('0x26')](handleEntityNotFound(_0x1a26e5,null))[_0xe2da('0x26')](function(_0x5c25ee){if(_0x5c25ee){return _0x5c25ee[_0xe2da('0x82')](_0x40636b[_0xe2da('0x35')]['ids']);}})[_0xe2da('0x26')](function(_0x1e6ec1){if(_0x1e6ec1){return db[_0xe2da('0x5a')][_0xe2da('0x27')]({'where':{'ListId':_0x40636b[_0xe2da('0x35')][_0xe2da('0x66')],'CampaignId':_0x40636b[_0xe2da('0x47')]['id']}})[_0xe2da('0x26')](function(){return _0x1e6ec1;});}})[_0xe2da('0x26')](respondWithStatusCode(_0x1a26e5,null))[_0xe2da('0x50')](handleError(_0x1a26e5,null));};exports[_0xe2da('0x83')]=function(_0x34feeb,_0xb819b7,_0x354821){var _0x1a07a9={'raw':!![],'where':{}};var _0x103e74={};var _0x22c905={'count':0x0,'rows':[]};return db[_0xe2da('0x2e')][_0xe2da('0x59')]({'where':{'id':_0x34feeb[_0xe2da('0x47')]['id']}})[_0xe2da('0x26')](handleEntityNotFound(_0xb819b7,null))[_0xe2da('0x26')](function(_0x1ea6a5){if(_0x1ea6a5){_0x103e74[_0xe2da('0x33')]=_[_0xe2da('0x48')](db['CmList'][_0xe2da('0x2f')]);_0x103e74[_0xe2da('0x35')]=_[_0xe2da('0x48')](_0x34feeb['query']);_0x103e74[_0xe2da('0x36')]=_[_0xe2da('0x37')](_0x103e74[_0xe2da('0x33')],_0x103e74[_0xe2da('0x35')]);_0x1a07a9[_0xe2da('0x38')]=_[_0xe2da('0x37')](_0x103e74[_0xe2da('0x33')],qs[_0xe2da('0x39')](_0x34feeb['query'][_0xe2da('0x39')]));_0x1a07a9['attributes']=_0x1a07a9['attributes'][_0xe2da('0x3a')]?_0x1a07a9['attributes']:_0x103e74[_0xe2da('0x33')];if(!_0x34feeb[_0xe2da('0x35')][_0xe2da('0x3b')](_0xe2da('0x61'))){_0x1a07a9['limit']=qs['limit'](_0x34feeb[_0xe2da('0x35')][_0xe2da('0x3c')]);_0x1a07a9[_0xe2da('0x20')]=qs[_0xe2da('0x20')](_0x34feeb[_0xe2da('0x35')][_0xe2da('0x20')]);}_0x1a07a9[_0xe2da('0x5b')]=qs[_0xe2da('0x3d')](_0x34feeb[_0xe2da('0x35')][_0xe2da('0x3d')]);_0x1a07a9[_0xe2da('0x3e')]=qs[_0xe2da('0x36')](_[_0xe2da('0x3f')](_0x34feeb['query'],_0x103e74[_0xe2da('0x36')]));_0x1a07a9[_0xe2da('0x3e')][_0xe2da('0x5c')]=_0x1ea6a5['id'];if(_0x34feeb[_0xe2da('0x35')][_0xe2da('0x40')]){_0x1a07a9[_0xe2da('0x3e')]=_[_0xe2da('0x53')](_0x1a07a9[_0xe2da('0x3e')],{'$or':_[_0xe2da('0x34')](_0x1a07a9[_0xe2da('0x38')],function(_0x303a97){var _0x1295b8={};_0x1295b8[_0x303a97]={'$like':'%'+_0x34feeb[_0xe2da('0x35')]['filter']+'%'};return _0x1295b8;})});}_0x1a07a9=_['merge']({},_0x1a07a9,_0x34feeb[_0xe2da('0x41')]);return db[_0xe2da('0x64')][_0xe2da('0x1f')]({'where':_0x1a07a9['where']})['then'](function(_0x2306c2){_0x22c905['count']=_0x2306c2;if(_0x34feeb[_0xe2da('0x35')]['includeAll']){_0x1a07a9[_0xe2da('0x43')]=[{'all':!![]}];}return db[_0xe2da('0x64')][_0xe2da('0x44')](_0x1a07a9);})[_0xe2da('0x26')](function(_0x13fd89){_0x22c905[_0xe2da('0x45')]=_0x13fd89;return _0x22c905;});}})[_0xe2da('0x26')](respondWithFilteredResult(_0xb819b7,_0x1a07a9))[_0xe2da('0x50')](handleError(_0xb819b7,null));};exports[_0xe2da('0x84')]=function(_0x50ee87,_0x1c0df3,_0x21f2c7){var _0x6eb17,_0x41913c;return db[_0xe2da('0x2e')]['find']({'where':{'id':_0x50ee87['params']['id']}})['then'](handleEntityNotFound(_0x1c0df3,null))[_0xe2da('0x26')](function(_0xe2e9d4){if(_0xe2e9d4){_0x41913c=_0xe2e9d4;return _0xe2e9d4[_0xe2da('0x84')](_0x50ee87['body'][_0xe2da('0x66')],_[_0xe2da('0x54')](_0x50ee87[_0xe2da('0x57')],[_0xe2da('0x66'),'id'])||{});}return null;})[_0xe2da('0x67')](function(_0x3ac749){var _0x2cfe3f;_0x6eb17=_0x3ac749||[];var _0x16664d=[];if(_0x3ac749){for(var _0x2d41a9=0x0;_0x2d41a9<_0x3ac749[_0xe2da('0x3a')];_0x2d41a9+=0x1){var _0x436e1e=_0x3ac749[_0x2d41a9][_0xe2da('0x28')]({'plain':!![]});_0x2cfe3f=squel['insert']()[_0xe2da('0x6b')](_0xe2da('0x85'))['fromQuery']([_0xe2da('0x6e'),_0xe2da('0x70'),_0xe2da('0x71'),_0xe2da('0x5c'),_0xe2da('0x55'),_0xe2da('0x56')],squel[_0xe2da('0x72')]()[_0xe2da('0x73')]('phone',_0xe2da('0x6e'))['field']('id',_0xe2da('0x70'))['field'](_0x436e1e['CmListId']['toString'](),_0xe2da('0x71'))[_0xe2da('0x73')](_0x50ee87[_0xe2da('0x47')]['id']['toString'](),_0xe2da('0x5c'))[_0xe2da('0x73')](_0xe2da('0x74'),_0xe2da('0x55'))[_0xe2da('0x73')](_0xe2da('0x74'),_0xe2da('0x56'))[_0xe2da('0x77')]('cm_contacts')[_0xe2da('0x3e')](_0xe2da('0x7e'))[_0xe2da('0x3e')]('ListId\x20=\x20?',_0x436e1e[_0xe2da('0x75')][_0xe2da('0x76')]())[_0xe2da('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0xe2da('0x76')]();_0x16664d[_0xe2da('0x86')](db[_0xe2da('0x80')][_0xe2da('0x35')](_0x2cfe3f));}return BPromise['all'](_0x16664d);}})[_0xe2da('0x26')](function(){return _0x6eb17;})[_0xe2da('0x26')](respondWithResult(_0x1c0df3,null))[_0xe2da('0x50')](handleError(_0x1c0df3,null));};exports['removeBlackLists']=function(_0x56c318,_0x4ce9e2,_0x1c3c81){return db[_0xe2da('0x2e')][_0xe2da('0x49')]({'where':{'id':_0x56c318[_0xe2da('0x47')]['id']}})[_0xe2da('0x26')](handleEntityNotFound(_0x4ce9e2,null))[_0xe2da('0x26')](function(_0x140150){if(_0x140150){return _0x140150[_0xe2da('0x87')](_0x56c318[_0xe2da('0x35')]['ids']);}})[_0xe2da('0x26')](function(_0xb06cc6){if(_0xb06cc6){return db[_0xe2da('0x62')]['destroy']({'where':{'ListId':_0x56c318[_0xe2da('0x35')][_0xe2da('0x66')],'CampaignId':_0x56c318['params']['id']}})[_0xe2da('0x26')](function(){return _0xb06cc6;});}})['then'](respondWithStatusCode(_0x4ce9e2,null))[_0xe2da('0x50')](handleError(_0x4ce9e2,null));}; \ No newline at end of file +var _0x9c44=['../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','IvrCampaigns','UserProfileResource','destroy','error','name','send','map','Campaign','rawAttributes','fieldName','query','keys','intersection','model','attributes','fields','order','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','sort','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','into','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','CampaignId\x20=\x20?','onlyIfOpen','insert','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','ids','addBlackLists','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x506d2f,_0x5ab76e){var _0x101255=function(_0x1596b1){while(--_0x1596b1){_0x506d2f['push'](_0x506d2f['shift']());}};_0x101255(++_0x5ab76e);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){var _0x4f0b62=_0x527126['get']({'plain':!![]});var _0x2263ae=_0x49c4('0x21');return db[_0x49c4('0x22')][_0x49c4('0x23')]({'where':{'type':_0x2263ae,'resourceId':_0x4f0b62['id']}})['then'](function(){return _0x527126;});})['then'](function(){_0x2197d2[_0x49c4('0x16')](0xcc)[_0x49c4('0x15')]();});}};}function handleEntityNotFound(_0x565423,_0x207358){return function(_0x43e014){if(!_0x43e014){_0x565423[_0x49c4('0x14')](0x194);}return _0x43e014;};}function handleError(_0xa7a826,_0x531d92){_0x531d92=_0x531d92||0x1f4;return function(_0x543ea2){logger[_0x49c4('0x24')](_0x543ea2['stack']);if(_0x543ea2[_0x49c4('0x25')]){delete _0x543ea2[_0x49c4('0x25')];}_0xa7a826[_0x49c4('0x16')](_0x531d92)[_0x49c4('0x26')](_0x543ea2);};}exports['index']=function(_0x889909,_0x2b2793){var _0x46e04d={},_0x4f28a2={},_0x6329b3={'count':0x0,'rows':[]};var _0x29f835=_[_0x49c4('0x27')](db[_0x49c4('0x28')][_0x49c4('0x29')],function(_0x2cbd88){return{'name':_0x2cbd88[_0x49c4('0x2a')],'type':_0x2cbd88['type']['key']};});_0x4f28a2['model']=_[_0x49c4('0x27')](_0x29f835,_0x49c4('0x25'));_0x4f28a2[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x889909[_0x49c4('0x2b')]);_0x4f28a2['filters']=_[_0x49c4('0x2d')](_0x4f28a2[_0x49c4('0x2e')],_0x4f28a2[_0x49c4('0x2b')]);_0x46e04d[_0x49c4('0x2f')]=_['intersection'](_0x4f28a2['model'],qs[_0x49c4('0x30')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x30')]));_0x46e04d[_0x49c4('0x2f')]=_0x46e04d[_0x49c4('0x2f')]['length']?_0x46e04d[_0x49c4('0x2f')]:_0x4f28a2[_0x49c4('0x2e')];if(!_0x889909[_0x49c4('0x2b')]['hasOwnProperty']('nolimit')){_0x46e04d[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x1a')]);_0x46e04d[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x889909[_0x49c4('0x2b')][_0x49c4('0x19')]);}_0x46e04d[_0x49c4('0x31')]=qs['sort'](_0x889909[_0x49c4('0x2b')]['sort']);_0x46e04d[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_[_0x49c4('0x34')](_0x889909[_0x49c4('0x2b')],_0x4f28a2['filters']));if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]){_0x46e04d[_0x49c4('0x32')]=_['merge'](_0x46e04d[_0x49c4('0x32')],{'$or':_[_0x49c4('0x27')](_0x29f835,function(_0x178987){if(_0x178987[_0x49c4('0x36')]!==_0x49c4('0x37')){var _0x24c177={};_0x24c177[_0x178987[_0x49c4('0x25')]]={'$like':'%'+_0x889909[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0x24c177;}})});}_0x46e04d=_[_0x49c4('0x38')]({},_0x46e04d,_0x889909[_0x49c4('0x39')]);var _0x4e0663={'where':_0x46e04d[_0x49c4('0x32')]};return db[_0x49c4('0x28')][_0x49c4('0x18')](_0x4e0663)[_0x49c4('0x20')](function(_0x41ad28){_0x6329b3[_0x49c4('0x18')]=_0x41ad28;if(_0x889909[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x46e04d[_0x49c4('0x3b')]=[{'all':!![]}];}return db[_0x49c4('0x28')][_0x49c4('0x3c')](_0x46e04d);})[_0x49c4('0x20')](function(_0x326142){_0x6329b3['rows']=_0x326142;return _0x6329b3;})[_0x49c4('0x20')](respondWithFilteredResult(_0x2b2793,_0x46e04d))['catch'](handleError(_0x2b2793,null));};exports[_0x49c4('0x3d')]=function(_0x4915bc,_0x28d4fb){var _0x1480da={'raw':![],'where':{'id':_0x4915bc[_0x49c4('0x3e')]['id']}},_0x239327={};_0x239327['model']=_['keys'](db[_0x49c4('0x28')][_0x49c4('0x29')]);_0x239327[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x4915bc['query']);_0x239327[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],_0x239327[_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2f')]=_[_0x49c4('0x2d')](_0x239327[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0x4915bc[_0x49c4('0x2b')]['fields']));_0x1480da[_0x49c4('0x2f')]=_0x1480da['attributes'][_0x49c4('0x3f')]?_0x1480da[_0x49c4('0x2f')]:_0x239327[_0x49c4('0x2e')];if(_0x4915bc[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x1480da['include']=[{'all':!![]}];}_0x1480da=_[_0x49c4('0x38')]({},_0x1480da,_0x4915bc[_0x49c4('0x39')]);return db[_0x49c4('0x28')][_0x49c4('0x40')](_0x1480da)[_0x49c4('0x20')](handleEntityNotFound(_0x28d4fb,null))[_0x49c4('0x20')](respondWithResult(_0x28d4fb,null))[_0x49c4('0x41')](handleError(_0x28d4fb,null));};exports['create']=function(_0x3bac1b,_0x5cfff9){return db[_0x49c4('0x28')][_0x49c4('0x42')](_0x3bac1b[_0x49c4('0x43')],{})[_0x49c4('0x20')](function(_0x2d8087){var _0x30bea5=_0x3bac1b[_0x49c4('0x44')]['get']({'plain':!![]});if(!_0x30bea5)throw new Error(_0x49c4('0x45'));if(_0x30bea5[_0x49c4('0x46')]==='user'){var _0x1e1ac4=_0x2d8087[_0x49c4('0x47')]({'plain':!![]});var _0xfbe179=_0x49c4('0x21');return db['UserProfileSection']['find']({'where':{'name':_0xfbe179,'userProfileId':_0x30bea5[_0x49c4('0x48')]},'raw':!![]})['then'](function(_0x4597c3){if(_0x4597c3&&_0x4597c3[_0x49c4('0x49')]===0x0){return db[_0x49c4('0x22')][_0x49c4('0x42')]({'name':_0x1e1ac4[_0x49c4('0x25')],'resourceId':_0x1e1ac4['id'],'type':_0x4597c3[_0x49c4('0x25')],'sectionId':_0x4597c3['id']},{})[_0x49c4('0x20')](function(){return _0x2d8087;});}else{return _0x2d8087;}})['catch'](function(_0x1f26c2){logger[_0x49c4('0x24')](_0x49c4('0x4a'),_0x1f26c2);throw _0x1f26c2;});}return _0x2d8087;})[_0x49c4('0x20')](respondWithResult(_0x5cfff9,0xc9))[_0x49c4('0x41')](handleError(_0x5cfff9,null));};exports[_0x49c4('0x4b')]=function(_0x156748,_0x25d174){var _0x1e0b4f={'where':{'id':_0x156748['params']['id']}},_0x1856be={};_0x1856be['model']=_[_0x49c4('0x2c')](db[_0x49c4('0x28')]['rawAttributes']);_0x1e0b4f['attributes']=_[_0x49c4('0x2d')](_0x1856be['model'],qs['fields'](_0x156748[_0x49c4('0x2b')][_0x49c4('0x30')]));_0x1e0b4f[_0x49c4('0x2f')]=_0x1e0b4f[_0x49c4('0x2f')][_0x49c4('0x3f')]?_0x1e0b4f[_0x49c4('0x2f')]:_0x1856be[_0x49c4('0x2e')];if(_0x156748['query'][_0x49c4('0x3a')]){_0x1e0b4f[_0x49c4('0x3b')]=[{'all':!![]}];}_0x1e0b4f=_[_0x49c4('0x38')]({},_0x1e0b4f,_0x156748[_0x49c4('0x39')]);return db[_0x49c4('0x28')][_0x49c4('0x40')](_0x1e0b4f)['then'](handleEntityNotFound(_0x25d174,null))['then'](function(_0x1ef0c1){if(_0x1ef0c1){var _0x155c43=_0x1ef0c1[_0x49c4('0x47')]({'plain':!![]});_0x155c43=qs[_0x49c4('0x4c')](_0x155c43,['id',_0x49c4('0x4d'),_0x49c4('0x4e')]);_0x156748[_0x49c4('0x43')]=_['omit'](_0x156748[_0x49c4('0x43')],['id',_0x49c4('0x4d'),'updatedAt']);return db[_0x49c4('0x28')]['create'](_[_0x49c4('0x38')](_0x155c43,_0x156748[_0x49c4('0x43')]),{'include':_0x156748[_0x49c4('0x2b')][_0x49c4('0x3a')]?[{'all':!![]}]:undefined})[_0x49c4('0x20')](function(_0x3e44d7){var _0x3eb66d=_0x156748[_0x49c4('0x44')]['get']({'plain':!![]});if(!_0x3eb66d)throw new Error(_0x49c4('0x45'));if(_0x3eb66d[_0x49c4('0x46')]==='user'){var _0x10dec7=_0x3e44d7[_0x49c4('0x47')]({'plain':!![]});var _0x4fefbd=_0x49c4('0x21');return db[_0x49c4('0x4f')]['find']({'where':{'name':_0x4fefbd,'userProfileId':_0x3eb66d['userProfileId']},'raw':!![]})['then'](function(_0x513879){if(_0x513879&&_0x513879[_0x49c4('0x49')]===0x0){return db['UserProfileResource'][_0x49c4('0x42')]({'name':_0x10dec7[_0x49c4('0x25')],'resourceId':_0x10dec7['id'],'type':_0x513879['name'],'sectionId':_0x513879['id']},{})[_0x49c4('0x20')](function(){return _0x3e44d7;});}else{return _0x3e44d7;}})[_0x49c4('0x41')](function(_0x5ac9f0){logger[_0x49c4('0x24')](_0x49c4('0x4a'),_0x5ac9f0);throw _0x5ac9f0;});}return _0x3e44d7;});}})[_0x49c4('0x20')](respondWithResult(_0x25d174,0xc9))[_0x49c4('0x41')](handleError(_0x25d174,null));};exports['update']=function(_0x431921,_0x16d0e1){if(_0x431921[_0x49c4('0x43')]['id']){delete _0x431921[_0x49c4('0x43')]['id'];}return db['Campaign'][_0x49c4('0x40')]({'where':{'id':_0x431921['params']['id']}})['then'](handleEntityNotFound(_0x16d0e1,null))['then'](saveUpdates(_0x431921['body'],null))[_0x49c4('0x20')](respondWithResult(_0x16d0e1,null))[_0x49c4('0x41')](handleError(_0x16d0e1,null));};exports[_0x49c4('0x23')]=function(_0x28bbf3,_0x5b056e){return db['Campaign'][_0x49c4('0x40')]({'where':{'id':_0x28bbf3[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x5b056e,null))[_0x49c4('0x20')](removeEntity(_0x5b056e,null))[_0x49c4('0x41')](handleError(_0x5b056e,null));};exports[_0x49c4('0x50')]=function(_0x3ba0d6,_0x3b949d,_0x4d49e0){var _0x2276db={'raw':!![],'where':{}};var _0x55e2ba={};var _0x25e8be={'count':0x0,'rows':[]};return db[_0x49c4('0x28')][_0x49c4('0x51')]({'where':{'id':_0x3ba0d6[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x3b949d,null))[_0x49c4('0x20')](function(_0x13d657){if(_0x13d657){_0x55e2ba[_0x49c4('0x2e')]=_[_0x49c4('0x2c')](db[_0x49c4('0x52')][_0x49c4('0x29')]);_0x55e2ba[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x3ba0d6[_0x49c4('0x2b')]);_0x55e2ba[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0x55e2ba[_0x49c4('0x2e')],_0x55e2ba[_0x49c4('0x2b')]);_0x2276db['attributes']=_['intersection'](_0x55e2ba[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0x3ba0d6['query'][_0x49c4('0x30')]));_0x2276db[_0x49c4('0x2f')]=_0x2276db[_0x49c4('0x2f')][_0x49c4('0x3f')]?_0x2276db['attributes']:_0x55e2ba['model'];if(!_0x3ba0d6['query'][_0x49c4('0x53')](_0x49c4('0x54'))){_0x2276db[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x3ba0d6[_0x49c4('0x2b')][_0x49c4('0x1a')]);_0x2276db[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x3ba0d6[_0x49c4('0x2b')]['offset']);}_0x2276db[_0x49c4('0x31')]=qs[_0x49c4('0x55')](_0x3ba0d6[_0x49c4('0x2b')]['sort']);_0x2276db[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_[_0x49c4('0x34')](_0x3ba0d6[_0x49c4('0x2b')],_0x55e2ba[_0x49c4('0x33')]));_0x2276db[_0x49c4('0x32')][_0x49c4('0x56')]=_0x13d657['id'];if(_0x3ba0d6[_0x49c4('0x2b')]['filter']){_0x2276db[_0x49c4('0x32')]=_[_0x49c4('0x38')](_0x2276db[_0x49c4('0x32')],{'$or':_[_0x49c4('0x27')](_0x2276db[_0x49c4('0x2f')],function(_0x4a204d){var _0x57a8d8={};_0x57a8d8[_0x4a204d]={'$like':'%'+_0x3ba0d6[_0x49c4('0x2b')]['filter']+'%'};return _0x57a8d8;})});}_0x2276db=_[_0x49c4('0x38')]({},_0x2276db,_0x3ba0d6['options']);return db[_0x49c4('0x52')][_0x49c4('0x18')]({'where':_0x2276db[_0x49c4('0x32')]})[_0x49c4('0x20')](function(_0x4eb9f7){_0x25e8be[_0x49c4('0x18')]=_0x4eb9f7;if(_0x3ba0d6[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x2276db[_0x49c4('0x3b')]=[{'all':!![]}];}return db[_0x49c4('0x52')][_0x49c4('0x3c')](_0x2276db);})[_0x49c4('0x20')](function(_0x23bb1c){_0x25e8be[_0x49c4('0x57')]=_0x23bb1c;return _0x25e8be;});}})[_0x49c4('0x20')](respondWithFilteredResult(_0x3b949d,_0x2276db))['catch'](handleError(_0x3b949d,null));};exports[_0x49c4('0x58')]=function(_0x46e4fd,_0x549719,_0x15bee0){var _0x5c7e8c={'raw':!![],'where':{}};var _0x1e6644={};var _0x1bfb8d={'count':0x0,'rows':[]};return db[_0x49c4('0x28')][_0x49c4('0x51')]({'where':{'id':_0x46e4fd[_0x49c4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x549719,null))[_0x49c4('0x20')](function(_0x2329b6){if(_0x2329b6){_0x1e6644['model']=_[_0x49c4('0x2c')](db[_0x49c4('0x59')]['rawAttributes']);_0x1e6644[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x46e4fd['query']);_0x1e6644[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0x1e6644[_0x49c4('0x2e')],_0x1e6644[_0x49c4('0x2b')]);_0x5c7e8c['attributes']=_[_0x49c4('0x2d')](_0x1e6644[_0x49c4('0x2e')],qs['fields'](_0x46e4fd[_0x49c4('0x2b')]['fields']));_0x5c7e8c['attributes']=_0x5c7e8c[_0x49c4('0x2f')]['length']?_0x5c7e8c['attributes']:_0x1e6644[_0x49c4('0x2e')];if(!_0x46e4fd[_0x49c4('0x2b')]['hasOwnProperty'](_0x49c4('0x54'))){_0x5c7e8c['limit']=qs['limit'](_0x46e4fd['query'][_0x49c4('0x1a')]);_0x5c7e8c[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x46e4fd[_0x49c4('0x2b')]['offset']);}_0x5c7e8c['order']=qs[_0x49c4('0x55')](_0x46e4fd['query'][_0x49c4('0x55')]);_0x5c7e8c['where']=qs[_0x49c4('0x33')](_[_0x49c4('0x34')](_0x46e4fd[_0x49c4('0x2b')],_0x1e6644[_0x49c4('0x33')]));_0x5c7e8c[_0x49c4('0x32')][_0x49c4('0x56')]=_0x2329b6['id'];if(_0x46e4fd[_0x49c4('0x2b')]['filter']){_0x5c7e8c[_0x49c4('0x32')]=_[_0x49c4('0x38')](_0x5c7e8c[_0x49c4('0x32')],{'$or':_[_0x49c4('0x27')](_0x5c7e8c[_0x49c4('0x2f')],function(_0x4fe16a){var _0xdb366f={};_0xdb366f[_0x4fe16a]={'$like':'%'+_0x46e4fd[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0xdb366f;})});}_0x5c7e8c=_['merge']({},_0x5c7e8c,_0x46e4fd['options']);return db[_0x49c4('0x59')][_0x49c4('0x18')]({'where':_0x5c7e8c[_0x49c4('0x32')]})[_0x49c4('0x20')](function(_0x432b71){_0x1bfb8d['count']=_0x432b71;if(_0x46e4fd[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x5c7e8c[_0x49c4('0x3b')]=[{'all':!![]}];}return db[_0x49c4('0x59')]['findAll'](_0x5c7e8c);})['then'](function(_0x2ca918){_0x1bfb8d[_0x49c4('0x57')]=_0x2ca918;return _0x1bfb8d;});}})[_0x49c4('0x20')](respondWithFilteredResult(_0x549719,_0x5c7e8c))[_0x49c4('0x41')](handleError(_0x549719,null));};exports[_0x49c4('0x5a')]=function(_0x5413d8,_0x389edb,_0x3c869e){var _0x44f20d={'raw':!![],'where':{}};var _0x1b0111={};var _0x2cddc1={'count':0x0,'rows':[]};return db[_0x49c4('0x28')]['findOne']({'where':{'id':_0x5413d8[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x389edb,null))[_0x49c4('0x20')](function(_0x2dd3f2){if(_0x2dd3f2){_0x1b0111['model']=_['keys'](db[_0x49c4('0x5b')]['rawAttributes']);_0x1b0111[_0x49c4('0x2b')]=_['keys'](_0x5413d8[_0x49c4('0x2b')]);_0x1b0111[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0x1b0111[_0x49c4('0x2e')],_0x1b0111['query']);_0x44f20d['attributes']=_[_0x49c4('0x2d')](_0x1b0111[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0x5413d8['query']['fields']));_0x44f20d[_0x49c4('0x2f')]=_0x44f20d['attributes']['length']?_0x44f20d[_0x49c4('0x2f')]:_0x1b0111['model'];if(!_0x5413d8[_0x49c4('0x2b')][_0x49c4('0x53')]('nolimit')){_0x44f20d[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x5413d8['query']['limit']);_0x44f20d[_0x49c4('0x19')]=qs['offset'](_0x5413d8[_0x49c4('0x2b')][_0x49c4('0x19')]);}_0x44f20d[_0x49c4('0x31')]=qs[_0x49c4('0x55')](_0x5413d8[_0x49c4('0x2b')][_0x49c4('0x55')]);_0x44f20d[_0x49c4('0x32')]=qs['filters'](_[_0x49c4('0x34')](_0x5413d8[_0x49c4('0x2b')],_0x1b0111[_0x49c4('0x33')]));_0x44f20d[_0x49c4('0x32')][_0x49c4('0x56')]=_0x2dd3f2['id'];if(_0x5413d8['query'][_0x49c4('0x35')]){_0x44f20d['where']=_[_0x49c4('0x38')](_0x44f20d[_0x49c4('0x32')],{'$or':_[_0x49c4('0x27')](_0x44f20d[_0x49c4('0x2f')],function(_0x5acbf7){var _0x293e47={};_0x293e47[_0x5acbf7]={'$like':'%'+_0x5413d8[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0x293e47;})});}_0x44f20d=_[_0x49c4('0x38')]({},_0x44f20d,_0x5413d8[_0x49c4('0x39')]);return db[_0x49c4('0x5b')]['count']({'where':_0x44f20d[_0x49c4('0x32')]})['then'](function(_0xac53ad){_0x2cddc1[_0x49c4('0x18')]=_0xac53ad;if(_0x5413d8[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x44f20d['include']=[{'all':!![]}];}return db[_0x49c4('0x5b')][_0x49c4('0x3c')](_0x44f20d);})['then'](function(_0x1e0b7d){_0x2cddc1[_0x49c4('0x57')]=_0x1e0b7d;return _0x2cddc1;});}})['then'](respondWithFilteredResult(_0x389edb,_0x44f20d))['catch'](handleError(_0x389edb,null));};exports[_0x49c4('0x5c')]=function(_0x3e5915,_0x35b7e6,_0x1aa3a3){var _0x32afd4={'raw':!![],'where':{}};var _0x15e403={};var _0x184d47={'count':0x0,'rows':[]};return db[_0x49c4('0x28')][_0x49c4('0x51')]({'where':{'id':_0x3e5915[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x35b7e6,null))['then'](function(_0x58692b){if(_0x58692b){_0x15e403[_0x49c4('0x2e')]=_[_0x49c4('0x2c')](db[_0x49c4('0x5d')]['rawAttributes']);_0x15e403[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x3e5915['query']);_0x15e403[_0x49c4('0x33')]=_['intersection'](_0x15e403[_0x49c4('0x2e')],_0x15e403[_0x49c4('0x2b')]);_0x32afd4[_0x49c4('0x2f')]=_[_0x49c4('0x2d')](_0x15e403['model'],qs[_0x49c4('0x30')](_0x3e5915[_0x49c4('0x2b')][_0x49c4('0x30')]));_0x32afd4[_0x49c4('0x2f')]=_0x32afd4[_0x49c4('0x2f')]['length']?_0x32afd4['attributes']:_0x15e403['model'];if(!_0x3e5915[_0x49c4('0x2b')][_0x49c4('0x53')](_0x49c4('0x54'))){_0x32afd4[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x3e5915['query'][_0x49c4('0x1a')]);_0x32afd4[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x3e5915[_0x49c4('0x2b')]['offset']);}_0x32afd4[_0x49c4('0x31')]=qs[_0x49c4('0x55')](_0x3e5915[_0x49c4('0x2b')][_0x49c4('0x55')]);_0x32afd4[_0x49c4('0x32')]=qs['filters'](_[_0x49c4('0x34')](_0x3e5915[_0x49c4('0x2b')],_0x15e403[_0x49c4('0x33')]));_0x32afd4['where'][_0x49c4('0x56')]=_0x58692b['id'];if(_0x3e5915[_0x49c4('0x2b')][_0x49c4('0x35')]){_0x32afd4['where']=_[_0x49c4('0x38')](_0x32afd4['where'],{'$or':_['map'](_0x32afd4[_0x49c4('0x2f')],function(_0x14d930){var _0x4ef4aa={};_0x4ef4aa[_0x14d930]={'$like':'%'+_0x3e5915[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0x4ef4aa;})});}_0x32afd4=_[_0x49c4('0x38')]({},_0x32afd4,_0x3e5915[_0x49c4('0x39')]);return db[_0x49c4('0x5d')][_0x49c4('0x18')]({'where':_0x32afd4[_0x49c4('0x32')]})[_0x49c4('0x20')](function(_0x59dbef){_0x184d47['count']=_0x59dbef;if(_0x3e5915[_0x49c4('0x2b')][_0x49c4('0x3a')]){_0x32afd4[_0x49c4('0x3b')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x32afd4);})[_0x49c4('0x20')](function(_0x3222ec){_0x184d47[_0x49c4('0x57')]=_0x3222ec;return _0x184d47;});}})[_0x49c4('0x20')](respondWithFilteredResult(_0x35b7e6,_0x32afd4))[_0x49c4('0x41')](handleError(_0x35b7e6,null));};exports[_0x49c4('0x5e')]=function(_0xbabd3b,_0x49809d,_0x318008){var _0x1e2dd3={};var _0xa42e74={};var _0x3e504b;var _0x352b67;return db[_0x49c4('0x28')]['findOne']({'where':{'id':_0xbabd3b[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x49809d,null))[_0x49c4('0x20')](function(_0x318aaf){if(_0x318aaf){_0x3e504b=_0x318aaf;_0xa42e74['model']=_['keys'](db[_0x49c4('0x5f')]['rawAttributes']);_0xa42e74[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0xbabd3b[_0x49c4('0x2b')]);_0xa42e74[_0x49c4('0x33')]=_[_0x49c4('0x2d')](_0xa42e74[_0x49c4('0x2e')],_0xa42e74[_0x49c4('0x2b')]);_0x1e2dd3[_0x49c4('0x2f')]=_[_0x49c4('0x2d')](_0xa42e74[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0xbabd3b[_0x49c4('0x2b')]['fields']));_0x1e2dd3[_0x49c4('0x2f')]=_0x1e2dd3[_0x49c4('0x2f')][_0x49c4('0x3f')]?_0x1e2dd3['attributes']:_0xa42e74[_0x49c4('0x2e')];_0x1e2dd3['order']=qs[_0x49c4('0x55')](_0xbabd3b[_0x49c4('0x2b')][_0x49c4('0x55')]);_0x1e2dd3[_0x49c4('0x32')]=qs['filters'](_[_0x49c4('0x34')](_0xbabd3b['query'],_0xa42e74['filters']));if(_0xbabd3b[_0x49c4('0x2b')][_0x49c4('0x35')]){_0x1e2dd3[_0x49c4('0x32')]=_['merge'](_0x1e2dd3['where'],{'$or':_[_0x49c4('0x27')](_0x1e2dd3[_0x49c4('0x2f')],function(_0x2d3845){var _0x330512={};_0x330512[_0x2d3845]={'$like':'%'+_0xbabd3b[_0x49c4('0x2b')][_0x49c4('0x35')]+'%'};return _0x330512;})});}_0x1e2dd3=_[_0x49c4('0x38')]({},_0x1e2dd3,_0xbabd3b[_0x49c4('0x39')]);return _0x3e504b[_0x49c4('0x5e')](_0x1e2dd3);}})['then'](function(_0x3466ef){if(_0x3466ef){_0x352b67=_0x3466ef[_0x49c4('0x3f')];if(!_0xbabd3b['query']['hasOwnProperty'](_0x49c4('0x54'))){_0x1e2dd3['limit']=qs[_0x49c4('0x1a')](_0xbabd3b['query'][_0x49c4('0x1a')]);_0x1e2dd3['offset']=qs[_0x49c4('0x19')](_0xbabd3b[_0x49c4('0x2b')][_0x49c4('0x19')]);}return _0x3e504b[_0x49c4('0x5e')](_0x1e2dd3);}})['then'](function(_0x57a3b1){if(_0x57a3b1){return _0x57a3b1?{'count':_0x352b67,'rows':_0x57a3b1}:null;}})[_0x49c4('0x20')](respondWithResult(_0x49809d,null))[_0x49c4('0x41')](handleError(_0x49809d,null));};exports[_0x49c4('0x60')]=function(_0x5737b4,_0x367d3d,_0x1814c4){var _0x5ae29d,_0x5f2411;return db[_0x49c4('0x28')][_0x49c4('0x40')]({'where':{'id':_0x5737b4[_0x49c4('0x3e')]['id']}})['then'](handleEntityNotFound(_0x367d3d,null))[_0x49c4('0x20')](function(_0x3da1a3){if(_0x3da1a3){_0x5f2411=_0x3da1a3;return _0x3da1a3[_0x49c4('0x60')](_0x5737b4[_0x49c4('0x43')]['ids'],_[_0x49c4('0x4c')](_0x5737b4['body'],['ids','id'])||{});}return null;})[_0x49c4('0x61')](function(_0x171530){var _0x12fda9;_0x5ae29d=_0x171530||[];var _0x24ff20=[];if(_0x171530){for(var _0x5adb90=0x0;_0x5adb90<_0x171530[_0x49c4('0x3f')];_0x5adb90+=0x1){var _0x947dd8=_0x171530[_0x5adb90][_0x49c4('0x47')]({'plain':!![]});_0x5f2411[_0x49c4('0x62')]=_0x5737b4['body'][_0x49c4('0x62')]?_0x5737b4['body']['dialCheckDuplicateType']:_0x5f2411[_0x49c4('0x62')];switch(_0x5f2411[_0x49c4('0x62')]){case _0x49c4('0x63'):_0x12fda9=squel['insert']()[_0x49c4('0x64')]('cm_hopper')[_0x49c4('0x65')]([_0x49c4('0x66'),_0x49c4('0x67'),_0x49c4('0x68'),_0x49c4('0x69'),_0x49c4('0x56'),_0x49c4('0x4d'),'updatedAt'],squel[_0x49c4('0x6a')]()[_0x49c4('0x6b')](_0x49c4('0x66'),_0x49c4('0x66'))['field']('NOW()','scheduledAt')[_0x49c4('0x6b')]('id',_0x49c4('0x68'))[_0x49c4('0x6b')](_0x947dd8[_0x49c4('0x6c')][_0x49c4('0x6d')](),_0x49c4('0x69'))[_0x49c4('0x6b')](_0x5737b4['params']['id'][_0x49c4('0x6d')](),_0x49c4('0x56'))['field']('NOW()','createdAt')[_0x49c4('0x6b')](_0x49c4('0x6e'),_0x49c4('0x4e'))[_0x49c4('0x6f')](_0x49c4('0x70'))[_0x49c4('0x32')](_0x49c4('0x71'))['where'](_0x49c4('0x72'),_0x947dd8[_0x49c4('0x6c')][_0x49c4('0x6d')]())[_0x49c4('0x32')]('phone\x20IS\x20NOT\x20NULL')[_0x49c4('0x32')](_0x49c4('0x73'),squel[_0x49c4('0x6a')]()[_0x49c4('0x6b')](_0x49c4('0x74'))['from'](_0x49c4('0x75'))['where']('CampaignId\x20=\x20?',_0x5737b4[_0x49c4('0x3e')]['id'][_0x49c4('0x6d')]()))[_0x49c4('0x32')](_0x49c4('0x73'),squel[_0x49c4('0x6a')]()['field'](_0x49c4('0x76'))[_0x49c4('0x6f')](_0x49c4('0x77'))['where'](_0x49c4('0x78'),_0x5737b4[_0x49c4('0x3e')]['id']['toString']())))[_0x49c4('0x6d')]();break;case _0x49c4('0x79'):_0x12fda9=squel[_0x49c4('0x7a')]()[_0x49c4('0x64')](_0x49c4('0x77'))[_0x49c4('0x65')]([_0x49c4('0x66'),'scheduledAt',_0x49c4('0x68'),_0x49c4('0x69'),_0x49c4('0x56'),_0x49c4('0x4d'),_0x49c4('0x4e')],squel['select']()[_0x49c4('0x6b')](_0x49c4('0x66'),_0x49c4('0x66'))[_0x49c4('0x6b')](_0x49c4('0x6e'),'scheduledAt')[_0x49c4('0x6b')]('id',_0x49c4('0x68'))[_0x49c4('0x6b')](_0x947dd8[_0x49c4('0x6c')][_0x49c4('0x6d')](),_0x49c4('0x69'))[_0x49c4('0x6b')](_0x5737b4[_0x49c4('0x3e')]['id'][_0x49c4('0x6d')](),_0x49c4('0x56'))['field'](_0x49c4('0x6e'),_0x49c4('0x4d'))[_0x49c4('0x6b')](_0x49c4('0x6e'),_0x49c4('0x4e'))['from']('cm_contacts')[_0x49c4('0x32')](_0x49c4('0x71'))[_0x49c4('0x32')](_0x49c4('0x72'),_0x947dd8[_0x49c4('0x6c')][_0x49c4('0x6d')]())['where'](_0x49c4('0x7b'))[_0x49c4('0x32')]('phone\x20NOT\x20IN\x20(?)',squel[_0x49c4('0x6a')]()['field'](_0x49c4('0x76'))[_0x49c4('0x6f')](_0x49c4('0x77'))['where'](_0x49c4('0x78'),_0x5737b4['params']['id'][_0x49c4('0x6d')]())))['toString']();break;default:_0x12fda9=squel['insert']()[_0x49c4('0x64')](_0x49c4('0x77'))[_0x49c4('0x65')]([_0x49c4('0x66'),_0x49c4('0x67'),_0x49c4('0x68'),'ListId','CampaignId',_0x49c4('0x4d'),_0x49c4('0x4e')],squel[_0x49c4('0x6a')]()[_0x49c4('0x6b')](_0x49c4('0x66'),_0x49c4('0x66'))[_0x49c4('0x6b')]('NOW()','scheduledAt')['field']('id','ContactId')[_0x49c4('0x6b')](_0x947dd8['CmListId'][_0x49c4('0x6d')](),_0x49c4('0x69'))[_0x49c4('0x6b')](_0x5737b4['params']['id']['toString'](),_0x49c4('0x56'))[_0x49c4('0x6b')]('NOW()',_0x49c4('0x4d'))[_0x49c4('0x6b')](_0x49c4('0x6e'),_0x49c4('0x4e'))[_0x49c4('0x6f')](_0x49c4('0x70'))['where'](_0x49c4('0x71'))[_0x49c4('0x32')](_0x49c4('0x72'),_0x947dd8['CmListId'][_0x49c4('0x6d')]())[_0x49c4('0x32')](_0x49c4('0x7b')))[_0x49c4('0x6d')]();}_0x24ff20[_0x49c4('0x7c')](db[_0x49c4('0x7d')][_0x49c4('0x2b')](_0x12fda9));}return BPromise[_0x49c4('0x7e')](_0x24ff20);}})['then'](function(){return _0x5ae29d;})[_0x49c4('0x20')](respondWithResult(_0x367d3d,null))[_0x49c4('0x41')](handleError(_0x367d3d,null));};exports[_0x49c4('0x7f')]=function(_0xa87ddd,_0x19175d,_0x471ec6){return db['Campaign'][_0x49c4('0x40')]({'where':{'id':_0xa87ddd[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x19175d,null))[_0x49c4('0x20')](function(_0x4462ec){if(_0x4462ec){return _0x4462ec[_0x49c4('0x7f')](_0xa87ddd[_0x49c4('0x2b')][_0x49c4('0x80')]);}})[_0x49c4('0x20')](function(_0xc641bc){if(_0xc641bc){return db[_0x49c4('0x52')][_0x49c4('0x23')]({'where':{'ListId':_0xa87ddd[_0x49c4('0x2b')][_0x49c4('0x80')],'CampaignId':_0xa87ddd['params']['id']}})['then'](function(){return _0xc641bc;});}})[_0x49c4('0x20')](respondWithStatusCode(_0x19175d,null))[_0x49c4('0x41')](handleError(_0x19175d,null));};exports['getBlackLists']=function(_0x5c46f5,_0x452cbb,_0x57062c){var _0x125fa4={'raw':!![],'where':{}};var _0x8a4230={};var _0x1ac2c0={'count':0x0,'rows':[]};return db[_0x49c4('0x28')][_0x49c4('0x51')]({'where':{'id':_0x5c46f5[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x452cbb,null))[_0x49c4('0x20')](function(_0x58b96c){if(_0x58b96c){_0x8a4230[_0x49c4('0x2e')]=_[_0x49c4('0x2c')](db[_0x49c4('0x5f')][_0x49c4('0x29')]);_0x8a4230[_0x49c4('0x2b')]=_['keys'](_0x5c46f5[_0x49c4('0x2b')]);_0x8a4230[_0x49c4('0x33')]=_['intersection'](_0x8a4230[_0x49c4('0x2e')],_0x8a4230[_0x49c4('0x2b')]);_0x125fa4['attributes']=_[_0x49c4('0x2d')](_0x8a4230[_0x49c4('0x2e')],qs[_0x49c4('0x30')](_0x5c46f5['query'][_0x49c4('0x30')]));_0x125fa4[_0x49c4('0x2f')]=_0x125fa4[_0x49c4('0x2f')][_0x49c4('0x3f')]?_0x125fa4['attributes']:_0x8a4230[_0x49c4('0x2e')];if(!_0x5c46f5['query'][_0x49c4('0x53')](_0x49c4('0x54'))){_0x125fa4[_0x49c4('0x1a')]=qs[_0x49c4('0x1a')](_0x5c46f5['query'][_0x49c4('0x1a')]);_0x125fa4[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5c46f5[_0x49c4('0x2b')][_0x49c4('0x19')]);}_0x125fa4[_0x49c4('0x31')]=qs['sort'](_0x5c46f5['query'][_0x49c4('0x55')]);_0x125fa4[_0x49c4('0x32')]=qs[_0x49c4('0x33')](_[_0x49c4('0x34')](_0x5c46f5[_0x49c4('0x2b')],_0x8a4230[_0x49c4('0x33')]));_0x125fa4[_0x49c4('0x32')][_0x49c4('0x56')]=_0x58b96c['id'];if(_0x5c46f5[_0x49c4('0x2b')][_0x49c4('0x35')]){_0x125fa4[_0x49c4('0x32')]=_[_0x49c4('0x38')](_0x125fa4['where'],{'$or':_[_0x49c4('0x27')](_0x125fa4[_0x49c4('0x2f')],function(_0x491203){var _0x154017={};_0x154017[_0x491203]={'$like':'%'+_0x5c46f5['query'][_0x49c4('0x35')]+'%'};return _0x154017;})});}_0x125fa4=_[_0x49c4('0x38')]({},_0x125fa4,_0x5c46f5['options']);return db[_0x49c4('0x5f')][_0x49c4('0x18')]({'where':_0x125fa4[_0x49c4('0x32')]})[_0x49c4('0x20')](function(_0x29ae49){_0x1ac2c0['count']=_0x29ae49;if(_0x5c46f5[_0x49c4('0x2b')]['includeAll']){_0x125fa4[_0x49c4('0x3b')]=[{'all':!![]}];}return db[_0x49c4('0x5f')][_0x49c4('0x3c')](_0x125fa4);})['then'](function(_0x236111){_0x1ac2c0[_0x49c4('0x57')]=_0x236111;return _0x1ac2c0;});}})[_0x49c4('0x20')](respondWithFilteredResult(_0x452cbb,_0x125fa4))['catch'](handleError(_0x452cbb,null));};exports['addBlackLists']=function(_0x256d6b,_0x590586,_0x30dfdc){var _0x3dfc99,_0x3900a6;return db[_0x49c4('0x28')]['find']({'where':{'id':_0x256d6b['params']['id']}})['then'](handleEntityNotFound(_0x590586,null))[_0x49c4('0x20')](function(_0x417cef){if(_0x417cef){_0x3900a6=_0x417cef;return _0x417cef[_0x49c4('0x81')](_0x256d6b[_0x49c4('0x43')]['ids'],_[_0x49c4('0x4c')](_0x256d6b[_0x49c4('0x43')],[_0x49c4('0x80'),'id'])||{});}return null;})[_0x49c4('0x61')](function(_0x2e2f80){var _0xe3af68;_0x3dfc99=_0x2e2f80||[];var _0xc2f3d0=[];if(_0x2e2f80){for(var _0x1d2931=0x0;_0x1d2931<_0x2e2f80[_0x49c4('0x3f')];_0x1d2931+=0x1){var _0x39e6f5=_0x2e2f80[_0x1d2931][_0x49c4('0x47')]({'plain':!![]});_0xe3af68=squel['insert']()[_0x49c4('0x64')]('cm_hopper_black')[_0x49c4('0x65')]([_0x49c4('0x66'),_0x49c4('0x68'),_0x49c4('0x69'),'CampaignId',_0x49c4('0x4d'),'updatedAt'],squel['select']()['field'](_0x49c4('0x66'),_0x49c4('0x66'))[_0x49c4('0x6b')]('id','ContactId')[_0x49c4('0x6b')](_0x39e6f5['CmListId'][_0x49c4('0x6d')](),_0x49c4('0x69'))[_0x49c4('0x6b')](_0x256d6b['params']['id'][_0x49c4('0x6d')](),_0x49c4('0x56'))[_0x49c4('0x6b')](_0x49c4('0x6e'),_0x49c4('0x4d'))['field'](_0x49c4('0x6e'),_0x49c4('0x4e'))[_0x49c4('0x6f')](_0x49c4('0x70'))['where']('deletedAt\x20IS\x20NULL')[_0x49c4('0x32')](_0x49c4('0x72'),_0x39e6f5['CmListId'][_0x49c4('0x6d')]())[_0x49c4('0x32')](_0x49c4('0x7b')))[_0x49c4('0x6d')]();_0xc2f3d0['push'](db[_0x49c4('0x7d')][_0x49c4('0x2b')](_0xe3af68));}return BPromise['all'](_0xc2f3d0);}})['then'](function(){return _0x3dfc99;})[_0x49c4('0x20')](respondWithResult(_0x590586,null))[_0x49c4('0x41')](handleError(_0x590586,null));};exports[_0x49c4('0x82')]=function(_0x56fe72,_0x1241b6,_0x5ee9f1){return db[_0x49c4('0x28')]['find']({'where':{'id':_0x56fe72[_0x49c4('0x3e')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x1241b6,null))[_0x49c4('0x20')](function(_0x13e8e2){if(_0x13e8e2){return _0x13e8e2['removeBlackLists'](_0x56fe72['query']['ids']);}})[_0x49c4('0x20')](function(_0x96bce0){if(_0x96bce0){return db[_0x49c4('0x5d')][_0x49c4('0x23')]({'where':{'ListId':_0x56fe72['query']['ids'],'CampaignId':_0x56fe72[_0x49c4('0x3e')]['id']}})['then'](function(){return _0x96bce0;});}})[_0x49c4('0x20')](respondWithStatusCode(_0x1241b6,null))[_0x49c4('0x41')](handleError(_0x1241b6,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 41313f1..ef93470 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 _0x109c=['request-promise','path','rimraf','../../config/environment','./campaign.attributes','exports','define','Campaign','campaigns','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x109c,0x1cb));var _0xc109=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x109c[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xc109('0x0'));var util=require(_0xc109('0x1'));var logger=require(_0xc109('0x2'))(_0xc109('0x3'));var moment=require(_0xc109('0x4'));var BPromise=require(_0xc109('0x5'));var rp=require(_0xc109('0x6'));var fs=require('fs');var path=require(_0xc109('0x7'));var rimraf=require(_0xc109('0x8'));var config=require(_0xc109('0x9'));var attributes=require(_0xc109('0xa'));module[_0xc109('0xb')]=function(_0x40a41b,_0x3b0f44){return _0x40a41b[_0xc109('0xc')](_0xc109('0xd'),attributes,{'tableName':_0xc109('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8dd7=['define','Campaign','campaigns','lodash','util','api','path','rimraf','../../config/environment','./campaign.attributes','exports'];(function(_0x506090,_0x44d91c){var _0x152fc3=function(_0x660ab1){while(--_0x660ab1){_0x506090['push'](_0x506090['shift']());}};_0x152fc3(++_0x44d91c);}(_0x8dd7,0xc9));var _0x78dd=function(_0x8712b7,_0x35660a){_0x8712b7=_0x8712b7-0x0;var _0x45d4ee=_0x8dd7[_0x8712b7];return _0x45d4ee;};'use strict';var _=require(_0x78dd('0x0'));var util=require(_0x78dd('0x1'));var logger=require('../../config/logger')(_0x78dd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x78dd('0x3'));var rimraf=require(_0x78dd('0x4'));var config=require(_0x78dd('0x5'));var attributes=require(_0x78dd('0x6'));module[_0x78dd('0x7')]=function(_0x398660,_0x122996){return _0x398660[_0x78dd('0x8')](_0x78dd('0x9'),attributes,{'tableName':_0x78dd('0xa'),'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 c20cf46..d4a9682 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(_0x47da8d,_0x517e13){var _0x5aabef=function(_0x2528d7){while(--_0x2528d7){_0x47da8d['push'](_0x47da8d['shift']());}};_0x5aabef(++_0x517e13);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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(_0x1f6012,_0xaa905b){var _0x2eec52=function(_0x443065){while(--_0x443065){_0x1f6012['push'](_0x1f6012['shift']());}};_0x2eec52(++_0xaa905b);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 154ada4..b02bfa1 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 _0xd447=['removeBlackLists','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','create','/:id/clone','clone','post','addBlackLists','put','update','delete'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0xd447,0xc8));var _0x7d44=function(_0x3ab6d4,_0xa65d39){_0x3ab6d4=_0x3ab6d4-0x0;var _0xf7a29b=_0xd447[_0x3ab6d4];return _0xf7a29b;};'use strict';var multer=require('multer');var util=require(_0x7d44('0x0'));var path=require('path');var timeout=require(_0x7d44('0x1'));var express=require(_0x7d44('0x2'));var router=express[_0x7d44('0x3')]();var auth=require(_0x7d44('0x4'));var interaction=require(_0x7d44('0x5'));var config=require(_0x7d44('0x6'));var controller=require('./campaign.controller');router[_0x7d44('0x7')]('/',auth['isAuthenticated'](),controller[_0x7d44('0x8')]);router[_0x7d44('0x7')](_0x7d44('0x9'),auth[_0x7d44('0xa')](),controller[_0x7d44('0xb')]);router[_0x7d44('0x7')](_0x7d44('0xc'),auth[_0x7d44('0xa')](),controller[_0x7d44('0xd')]);router[_0x7d44('0x7')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x7d44('0xe')]);router['get'](_0x7d44('0xf'),auth[_0x7d44('0xa')](),controller[_0x7d44('0x10')]);router[_0x7d44('0x7')](_0x7d44('0x11'),auth[_0x7d44('0xa')](),controller[_0x7d44('0x12')]);router[_0x7d44('0x7')](_0x7d44('0x13'),auth[_0x7d44('0xa')](),controller[_0x7d44('0x14')]);router[_0x7d44('0x7')](_0x7d44('0x15'),auth[_0x7d44('0xa')](),controller[_0x7d44('0x16')]);router['post']('/',auth[_0x7d44('0xa')](),controller[_0x7d44('0x17')]);router['post'](_0x7d44('0x18'),auth[_0x7d44('0xa')](),controller[_0x7d44('0x19')]);router[_0x7d44('0x1a')](_0x7d44('0x13'),auth[_0x7d44('0xa')](),controller['addLists']);router[_0x7d44('0x1a')](_0x7d44('0x15'),auth[_0x7d44('0xa')](),controller[_0x7d44('0x1b')]);router[_0x7d44('0x1c')]('/:id',auth[_0x7d44('0xa')](),controller[_0x7d44('0x1d')]);router[_0x7d44('0x1e')](_0x7d44('0x9'),auth[_0x7d44('0xa')](),controller['destroy']);router['delete'](_0x7d44('0x13'),auth[_0x7d44('0xa')](),controller['removeLists']);router[_0x7d44('0x1e')]('/:id/blacklists',auth[_0x7d44('0xa')](),controller[_0x7d44('0x1f')]);module[_0x7d44('0x20')]=router; \ No newline at end of file +var _0xc9b3=['post','create','/:id/clone','clone','update','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists'];(function(_0x541a45,_0x12c03c){var _0xba45dc=function(_0x337419){while(--_0x337419){_0x541a45['push'](_0x541a45['shift']());}};_0xba45dc(++_0x12c03c);}(_0xc9b3,0x152));var _0x3c9b=function(_0x5d5c9f,_0x470088){_0x5d5c9f=_0x5d5c9f-0x0;var _0xd8ccdf=_0xc9b3[_0x5d5c9f];return _0xd8ccdf;};'use strict';var multer=require(_0x3c9b('0x0'));var util=require(_0x3c9b('0x1'));var path=require(_0x3c9b('0x2'));var timeout=require(_0x3c9b('0x3'));var express=require(_0x3c9b('0x4'));var router=express[_0x3c9b('0x5')]();var auth=require(_0x3c9b('0x6'));var interaction=require(_0x3c9b('0x7'));var config=require('../../config/environment');var controller=require('./campaign.controller');router[_0x3c9b('0x8')]('/',auth[_0x3c9b('0x9')](),controller['index']);router[_0x3c9b('0x8')](_0x3c9b('0xa'),auth[_0x3c9b('0x9')](),controller[_0x3c9b('0xb')]);router[_0x3c9b('0x8')](_0x3c9b('0xc'),auth[_0x3c9b('0x9')](),controller[_0x3c9b('0xd')]);router[_0x3c9b('0x8')](_0x3c9b('0xe'),auth['isAuthenticated'](),controller[_0x3c9b('0xf')]);router[_0x3c9b('0x8')]('/:id/hopper_finals',auth[_0x3c9b('0x9')](),controller['getHopperFinals']);router[_0x3c9b('0x8')](_0x3c9b('0x10'),auth['isAuthenticated'](),controller[_0x3c9b('0x11')]);router['get'](_0x3c9b('0x12'),auth[_0x3c9b('0x9')](),controller[_0x3c9b('0x13')]);router[_0x3c9b('0x8')](_0x3c9b('0x14'),auth[_0x3c9b('0x9')](),controller[_0x3c9b('0x15')]);router[_0x3c9b('0x16')]('/',auth[_0x3c9b('0x9')](),controller[_0x3c9b('0x17')]);router[_0x3c9b('0x16')](_0x3c9b('0x18'),auth['isAuthenticated'](),controller[_0x3c9b('0x19')]);router['post'](_0x3c9b('0x12'),auth['isAuthenticated'](),controller['addLists']);router[_0x3c9b('0x16')]('/:id/blacklists',auth[_0x3c9b('0x9')](),controller['addBlackLists']);router['put'](_0x3c9b('0xa'),auth[_0x3c9b('0x9')](),controller[_0x3c9b('0x1a')]);router['delete'](_0x3c9b('0xa'),auth[_0x3c9b('0x9')](),controller['destroy']);router['delete'](_0x3c9b('0x12'),auth[_0x3c9b('0x9')](),controller['removeLists']);router[_0x3c9b('0x1b')](_0x3c9b('0x14'),auth[_0x3c9b('0x9')](),controller[_0x3c9b('0x1c')]);module[_0x3c9b('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 2810d3e..f7bd700 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 _0xe264=['exports','STRING','TEXT','VIRTUAL','getDataValue','key','sequelize'];(function(_0x890a92,_0x2c36ce){var _0x223def=function(_0x2c1ef8){while(--_0x2c1ef8){_0x890a92['push'](_0x890a92['shift']());}};_0x223def(++_0x2c36ce);}(_0xe264,0x187));var _0x4e26=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xe264[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require(_0x4e26('0x0'));module[_0x4e26('0x1')]={'key':{'type':Sequelize[_0x4e26('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x4e26('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x4e26('0x2')]},'name':{'type':Sequelize[_0x4e26('0x4')],'get':function(){return this[_0x4e26('0x5')](_0x4e26('0x6'));}}}; \ No newline at end of file +var _0x8787=['STRING','key','sequelize','exports','TEXT'];(function(_0x5db2f6,_0x3f213b){var _0x541835=function(_0x2f8faa){while(--_0x2f8faa){_0x5db2f6['push'](_0x5db2f6['shift']());}};_0x541835(++_0x3f213b);}(_0x8787,0x70));var _0x7878=function(_0x3bdaa3,_0x399889){_0x3bdaa3=_0x3bdaa3-0x0;var _0x5611a4=_0x8787[_0x3bdaa3];return _0x5611a4;};'use strict';var Sequelize=require(_0x7878('0x0'));module[_0x7878('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x7878('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7878('0x3')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x7878('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 1b13763..909ff29 100644 --- a/server/api/cannedAnswer/cannedAnswer.controller.js +++ b/server/api/cannedAnswer/cannedAnswer.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','includeAll','find','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','CannedAnswers','destroy','sendStatus','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x50c350,_0x5a29f2){var _0x4f92df=function(_0x95e3e){while(--_0x95e3e){_0x50c350['push'](_0x50c350['shift']());}};_0x4f92df(++_0x5a29f2);}(_0x34e8,0x12c));var _0x834e=function(_0x1280d5,_0x53ef9b){_0x1280d5=_0x1280d5-0x0;var _0x23f5ec=_0x34e8[_0x1280d5];return _0x23f5ec;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];function respondWithStatusCode(_0x538bb3,_0x5e5b6d){_0x5e5b6d=_0x5e5b6d||0xcc;return function(_0x6cd9b9){if(_0x6cd9b9){return _0x538bb3['sendStatus'](_0x5e5b6d);}return _0x538bb3[_0x834e('0x1d')](_0x5e5b6d)[_0x834e('0x1e')]();};}function respondWithResult(_0x28e659,_0x21cc0a){_0x21cc0a=_0x21cc0a||0xc8;return function(_0x50e860){if(_0x50e860){return _0x28e659[_0x834e('0x1d')](_0x21cc0a)[_0x834e('0x1f')](_0x50e860);}};}function respondWithFilteredResult(_0x57274a,_0x316205){return function(_0x4a9cdc){if(_0x4a9cdc){var _0x38a8cd=_0x4a9cdc[_0x834e('0x20')],_0x36d443=_0x316205[_0x834e('0x21')],_0x478afe=_0x316205['offset']+_0x316205[_0x834e('0x22')],_0x43ac41;if(_0x478afe>=_0x38a8cd){_0x478afe=_0x38a8cd;_0x43ac41=0xc8;}else{_0x43ac41=0xce;}_0x57274a[_0x834e('0x1d')](_0x43ac41);return _0x57274a[_0x834e('0x23')](_0x834e('0x24'),_0x36d443+'-'+_0x478afe+'/'+_0x38a8cd)[_0x834e('0x1f')](_0x4a9cdc);}return null;};}function patchUpdates(_0x254677){return function(_0x1dd214){try{jsonpatch['apply'](_0x1dd214,_0x254677,!![]);}catch(_0x2545b4){return BPromise[_0x834e('0x25')](_0x2545b4);}return _0x1dd214[_0x834e('0x26')]();};}function saveUpdates(_0x325a99,_0x4ab05d){return function(_0x45a630){if(_0x45a630){return _0x45a630[_0x834e('0x27')](_0x325a99)['then'](function(_0x1b4bdf){return _0x1b4bdf;});}return null;};}function removeEntity(_0x28d687,_0x8d406e){return function(_0x5c55ca){if(_0x5c55ca){return _0x5c55ca['destroy']()[_0x834e('0x28')](function(){var _0x34563b=_0x5c55ca['get']({'plain':!![]});var _0x25ee1d=_0x834e('0x29');return db['UserProfileResource'][_0x834e('0x2a')]({'where':{'type':_0x25ee1d,'resourceId':_0x34563b['id']}})[_0x834e('0x28')](function(){return _0x5c55ca;});})[_0x834e('0x28')](function(){_0x28d687['status'](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3e310f,_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x3e310f[_0x834e('0x2b')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x2c')](_0x3f1b0b[_0x834e('0x2d')]);if(_0x3f1b0b[_0x834e('0x2e')]){delete _0x3f1b0b[_0x834e('0x2e')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={},_0x106d6a={},_0x5dacc1={'count':0x0,'rows':[]};var _0xb5bc06=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x4551f5){return{'name':_0x4551f5[_0x834e('0x32')],'type':_0x4551f5[_0x834e('0x33')][_0x834e('0x34')]};});_0x106d6a[_0x834e('0x35')]=_['map'](_0xb5bc06,_0x834e('0x2e'));_0x106d6a['query']=_[_0x834e('0x36')](_0x58c1d7[_0x834e('0x37')]);_0x106d6a[_0x834e('0x38')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],_0x106d6a[_0x834e('0x37')]);_0x567cea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],qs[_0x834e('0x3b')](_0x58c1d7['query'][_0x834e('0x3b')]));_0x567cea[_0x834e('0x3a')]=_0x567cea[_0x834e('0x3a')][_0x834e('0x3c')]?_0x567cea['attributes']:_0x106d6a[_0x834e('0x35')];if(!_0x58c1d7[_0x834e('0x37')]['hasOwnProperty']('nolimit')){_0x567cea['limit']=qs[_0x834e('0x22')](_0x58c1d7[_0x834e('0x37')][_0x834e('0x22')]);_0x567cea[_0x834e('0x21')]=qs[_0x834e('0x21')](_0x58c1d7[_0x834e('0x37')]['offset']);}_0x567cea[_0x834e('0x3d')]=qs['sort'](_0x58c1d7[_0x834e('0x37')][_0x834e('0x3e')]);_0x567cea['where']=qs[_0x834e('0x38')](_[_0x834e('0x3f')](_0x58c1d7['query'],_0x106d6a['filters']));if(_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]){_0x567cea[_0x834e('0x41')]=_[_0x834e('0x42')](_0x567cea[_0x834e('0x41')],{'$or':_['map'](_0xb5bc06,function(_0x1c5ed6){if(_0x1c5ed6['type']!=='VIRTUAL'){var _0x1b2edf={};_0x1b2edf[_0x1c5ed6['name']]={'$like':'%'+_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]+'%'};return _0x1b2edf;}})});}_0x567cea=_[_0x834e('0x42')]({},_0x567cea,_0x58c1d7[_0x834e('0x43')]);var _0x2b7933={'where':_0x567cea['where']};return db[_0x834e('0x30')][_0x834e('0x20')](_0x2b7933)[_0x834e('0x28')](function(_0x58c5fb){_0x5dacc1[_0x834e('0x20')]=_0x58c5fb;if(_0x58c1d7[_0x834e('0x37')]['includeAll']){_0x567cea[_0x834e('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0x834e('0x45')](_0x567cea);})[_0x834e('0x28')](function(_0x4a18bb){_0x5dacc1['rows']=_0x4a18bb;return _0x5dacc1;})[_0x834e('0x28')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x46')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x47')]=function(_0xbc1571,_0x8ad264){var _0x23feea={'raw':!![],'where':{'id':_0xbc1571['params']['id']}},_0x195204={};_0x195204[_0x834e('0x35')]=_['keys'](db[_0x834e('0x30')]['rawAttributes']);_0x195204[_0x834e('0x37')]=_['keys'](_0xbc1571[_0x834e('0x37')]);_0x195204[_0x834e('0x38')]=_['intersection'](_0x195204[_0x834e('0x35')],_0x195204[_0x834e('0x37')]);_0x23feea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x195204[_0x834e('0x35')],qs[_0x834e('0x3b')](_0xbc1571[_0x834e('0x37')][_0x834e('0x3b')]));_0x23feea[_0x834e('0x3a')]=_0x23feea[_0x834e('0x3a')]['length']?_0x23feea[_0x834e('0x3a')]:_0x195204[_0x834e('0x35')];if(_0xbc1571['query'][_0x834e('0x48')]){_0x23feea[_0x834e('0x44')]=[{'all':!![]}];}_0x23feea=_[_0x834e('0x42')]({},_0x23feea,_0xbc1571[_0x834e('0x43')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x23feea)['then'](handleEntityNotFound(_0x8ad264,null))['then'](respondWithResult(_0x8ad264,null))[_0x834e('0x46')](handleError(_0x8ad264,null));};exports[_0x834e('0x27')]=function(_0x30568e,_0x40ff5a){if(_0x30568e[_0x834e('0x4a')]['id']){delete _0x30568e[_0x834e('0x4a')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x30568e[_0x834e('0x4b')]['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x40ff5a,null))[_0x834e('0x28')](saveUpdates(_0x30568e[_0x834e('0x4a')],null))[_0x834e('0x28')](respondWithResult(_0x40ff5a,null))[_0x834e('0x46')](handleError(_0x40ff5a,null));};exports[_0x834e('0x2a')]=function(_0x1a3855,_0x3df078){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1a3855[_0x834e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3df078,null))[_0x834e('0x28')](removeEntity(_0x3df078,null))[_0x834e('0x46')](handleError(_0x3df078,null));};exports['create']=function(_0x3c00a3,_0x3b0988){var _0x55d491={'key':_0x3c00a3[_0x834e('0x4a')][_0x834e('0x34')]};if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')]){_0x55d491[_0x834e('0x4c')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')];}else if(_0x3c00a3['body'][_0x834e('0x4d')]){_0x55d491[_0x834e('0x4d')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4d')];}else if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4e')]){_0x55d491[_0x834e('0x4e')]=_0x3c00a3[_0x834e('0x4a')]['OpenchannelAccountId'];}else if(_0x3c00a3[_0x834e('0x4a')]['ChatWebsiteId']){_0x55d491[_0x834e('0x4f')]=_0x3c00a3['body'][_0x834e('0x4f')];}return db['CannedAnswer']['find']({'where':_0x55d491})[_0x834e('0x28')](function(_0x3e1bee){if(_0x3e1bee){throw new db['Sequelize']['ValidationError'](_0x834e('0x50'));}return db[_0x834e('0x30')][_0x834e('0x51')](_0x3c00a3[_0x834e('0x4a')]);})[_0x834e('0x28')](function(_0x315858){var _0x3d3f2b=_0x3c00a3[_0x834e('0x52')]['get']({'plain':!![]});if(!_0x3d3f2b)throw new Error(_0x834e('0x53'));if(_0x3d3f2b[_0x834e('0x54')]==='user'){var _0x281342=_0x315858['get']({'plain':!![]});return db[_0x834e('0x55')][_0x834e('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x3d3f2b[_0x834e('0x56')]},'raw':!![]})[_0x834e('0x28')](function(_0x2de29a){if(_0x2de29a&&_0x2de29a[_0x834e('0x57')]===0x0){return db['UserProfileResource'][_0x834e('0x51')]({'name':_0x281342[_0x834e('0x2e')],'resourceId':_0x281342['id'],'type':_0x2de29a[_0x834e('0x2e')],'sectionId':_0x2de29a['id']},{})['then'](function(){return _0x315858;});}else{return _0x315858;}})[_0x834e('0x46')](function(_0x1fcae9){logger[_0x834e('0x2c')](_0x834e('0x58'),_0x1fcae9);throw _0x1fcae9;});}return _0x315858;})[_0x834e('0x28')](respondWithResult(_0x3b0988,0xc9))[_0x834e('0x46')](handleError(_0x3b0988,null));}; \ No newline at end of file +var _0x9957=['limit','set','Content-Range','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','CannedAnswer','count','include','catch','show','params','keys','length','includeAll','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','sendStatus','status','end','json','offset'];(function(_0x32482f,_0x3a031b){var _0x52106c=function(_0x1a6859){while(--_0x1a6859){_0x32482f['push'](_0x32482f['shift']());}};_0x52106c(++_0x3a031b);}(_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'];function respondWithStatusCode(_0x2cb37a,_0x19a27e){_0x19a27e=_0x19a27e||0xcc;return function(_0x385f00){if(_0x385f00){return _0x2cb37a[_0x7995('0x1a')](_0x19a27e);}return _0x2cb37a[_0x7995('0x1b')](_0x19a27e)[_0x7995('0x1c')]();};}function respondWithResult(_0x4cc004,_0x58f5ad){_0x58f5ad=_0x58f5ad||0xc8;return function(_0x2b4e94){if(_0x2b4e94){return _0x4cc004[_0x7995('0x1b')](_0x58f5ad)[_0x7995('0x1d')](_0x2b4e94);}};}function respondWithFilteredResult(_0x321ae8,_0x3f1d3e){return function(_0x1a5310){if(_0x1a5310){var _0x2202ce=_0x1a5310['count'],_0x41cbf0=_0x3f1d3e[_0x7995('0x1e')],_0x5377e5=_0x3f1d3e[_0x7995('0x1e')]+_0x3f1d3e[_0x7995('0x1f')],_0x2eeacc;if(_0x5377e5>=_0x2202ce){_0x5377e5=_0x2202ce;_0x2eeacc=0xc8;}else{_0x2eeacc=0xce;}_0x321ae8[_0x7995('0x1b')](_0x2eeacc);return _0x321ae8[_0x7995('0x20')](_0x7995('0x21'),_0x41cbf0+'-'+_0x5377e5+'/'+_0x2202ce)['json'](_0x1a5310);}return null;};}function patchUpdates(_0x54c9ae){return function(_0x2536c8){try{jsonpatch['apply'](_0x2536c8,_0x54c9ae,!![]);}catch(_0x555f74){return BPromise[_0x7995('0x22')](_0x555f74);}return _0x2536c8[_0x7995('0x23')]();};}function saveUpdates(_0x4cbe10,_0x3a9b54){return function(_0x51f276){if(_0x51f276){return _0x51f276['update'](_0x4cbe10)[_0x7995('0x24')](function(_0x327b1f){return _0x327b1f;});}return null;};}function removeEntity(_0x350fd9,_0x1a8568){return function(_0x460924){if(_0x460924){return _0x460924[_0x7995('0x25')]()['then'](function(){var _0x32a09a=_0x460924[_0x7995('0x26')]({'plain':!![]});var _0x204507=_0x7995('0x27');return db[_0x7995('0x28')][_0x7995('0x25')]({'where':{'type':_0x204507,'resourceId':_0x32a09a['id']}})[_0x7995('0x24')](function(){return _0x460924;});})[_0x7995('0x24')](function(){_0x350fd9['status'](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1a')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x29')]);if(_0x47625f[_0x7995('0x2a')]){delete _0x47625f[_0x7995('0x2a')];}_0x2a307e[_0x7995('0x1b')](_0x56691a)[_0x7995('0x2b')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['CannedAnswer'][_0x7995('0x2c')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2d')],'type':_0xe6b0b3[_0x7995('0x2e')][_0x7995('0x2f')]};});_0x3250e0[_0x7995('0x30')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x31')]=_['keys'](_0x9b2a15[_0x7995('0x31')]);_0x3250e0[_0x7995('0x32')]=_[_0x7995('0x33')](_0x3250e0[_0x7995('0x30')],_0x3250e0[_0x7995('0x31')]);_0x456a28['attributes']=_[_0x7995('0x33')](_0x3250e0[_0x7995('0x30')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x34')]=_0x456a28[_0x7995('0x34')]['length']?_0x456a28[_0x7995('0x34')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x31')][_0x7995('0x35')](_0x7995('0x36'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x31')]['limit']);_0x456a28['offset']=qs[_0x7995('0x1e')](_0x9b2a15[_0x7995('0x31')]['offset']);}_0x456a28[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x9b2a15[_0x7995('0x31')][_0x7995('0x38')]);_0x456a28[_0x7995('0x39')]=qs['filters'](_[_0x7995('0x3a')](_0x9b2a15[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]));if(_0x9b2a15[_0x7995('0x31')]['filter']){_0x456a28[_0x7995('0x39')]=_[_0x7995('0x3b')](_0x456a28[_0x7995('0x39')],{'$or':_[_0x7995('0x3c')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2e')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2a')]]={'$like':'%'+_0x9b2a15[_0x7995('0x31')][_0x7995('0x3d')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3b')]({},_0x456a28,_0x9b2a15[_0x7995('0x3e')]);var _0x14d638={'where':_0x456a28[_0x7995('0x39')]};return db[_0x7995('0x3f')][_0x7995('0x40')](_0x14d638)[_0x7995('0x24')](function(_0x270d52){_0x4253e5[_0x7995('0x40')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x41')]=[{'all':!![]}];}return db[_0x7995('0x3f')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x42')](handleError(_0x514445,null));};exports[_0x7995('0x43')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':!![],'where':{'id':_0x35c8ff[_0x7995('0x44')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x3f')][_0x7995('0x2c')]);_0x5e85b9[_0x7995('0x31')]=_[_0x7995('0x45')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x33')](_0x5e85b9[_0x7995('0x30')],_0x5e85b9[_0x7995('0x31')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x30')],qs['fields'](_0x35c8ff[_0x7995('0x31')]['fields']));_0x46ac4f[_0x7995('0x34')]=_0x46ac4f['attributes'][_0x7995('0x46')]?_0x46ac4f[_0x7995('0x34')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x31')][_0x7995('0x47')]){_0x46ac4f[_0x7995('0x41')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3b')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x3f')][_0x7995('0x48')](_0x46ac4f)[_0x7995('0x24')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x42')](handleError(_0x576b96,null));};exports[_0x7995('0x49')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x4a')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3f')][_0x7995('0x48')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x42')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3f')]['find']({'where':{'id':_0xddf537[_0x7995('0x44')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x4b')]=function(_0x1fe77e,_0x12d4b8){var _0x47d1d8={'key':_0x1fe77e['body']['key']};if(_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4c')]){_0x47d1d8['MailAccountId']=_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4c')];}else if(_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4d')]){_0x47d1d8[_0x7995('0x4d')]=_0x1fe77e['body'][_0x7995('0x4d')];}else if(_0x1fe77e['body'][_0x7995('0x4e')]){_0x47d1d8[_0x7995('0x4e')]=_0x1fe77e[_0x7995('0x4a')]['OpenchannelAccountId'];}else if(_0x1fe77e['body']['ChatWebsiteId']){_0x47d1d8['ChatWebsiteId']=_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4f')];}return db[_0x7995('0x3f')][_0x7995('0x48')]({'where':_0x47d1d8})[_0x7995('0x24')](function(_0x357e60){if(_0x357e60){throw new db[(_0x7995('0x50'))][(_0x7995('0x51'))](_0x7995('0x52'));}return db[_0x7995('0x3f')][_0x7995('0x4b')](_0x1fe77e[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x35bea3){var _0x1ea1dc=_0x1fe77e[_0x7995('0x53')][_0x7995('0x26')]({'plain':!![]});if(!_0x1ea1dc)throw new Error(_0x7995('0x54'));if(_0x1ea1dc[_0x7995('0x55')]==='user'){var _0x56a374=_0x35bea3[_0x7995('0x26')]({'plain':!![]});return db[_0x7995('0x56')][_0x7995('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x1ea1dc['userProfileId']},'raw':!![]})[_0x7995('0x24')](function(_0x197b52){if(_0x197b52&&_0x197b52[_0x7995('0x57')]===0x0){return db[_0x7995('0x28')]['create']({'name':_0x56a374[_0x7995('0x2a')],'resourceId':_0x56a374['id'],'type':_0x197b52[_0x7995('0x2a')],'sectionId':_0x197b52['id']},{})[_0x7995('0x24')](function(){return _0x35bea3;});}else{return _0x35bea3;}})[_0x7995('0x42')](function(_0x502d43){logger['error'](_0x7995('0x58'),_0x502d43);throw _0x502d43;});}return _0x35bea3;})[_0x7995('0x24')](respondWithResult(_0x12d4b8,0xc9))[_0x7995('0x42')](handleError(_0x12d4b8,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 99ed341..64e340f 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 _0xe7b9=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment'];(function(_0x5aa20c,_0x28b6ca){var _0x5d0a3a=function(_0x4b6cc8){while(--_0x4b6cc8){_0x5aa20c['push'](_0x5aa20c['shift']());}};_0x5d0a3a(++_0x28b6ca);}(_0xe7b9,0x170));var _0x9e7b=function(_0x37ed70,_0x5132e5){_0x37ed70=_0x37ed70-0x0;var _0x155596=_0xe7b9[_0x37ed70];return _0x155596;};'use strict';var _=require(_0x9e7b('0x0'));var util=require(_0x9e7b('0x1'));var logger=require(_0x9e7b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9e7b('0x3'));var rp=require(_0x9e7b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9e7b('0x5'));var attributes=require('./cannedAnswer.attributes');module[_0x9e7b('0x6')]=function(_0x543b7e,_0x4dda21){return _0x543b7e[_0x9e7b('0x7')](_0x9e7b('0x8'),attributes,{'tableName':_0x9e7b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9e7b('0xa')});}; \ No newline at end of file +var _0x69d5=['tools_canned_answers','utf8mb4','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports'];(function(_0x26d406,_0x2ff7d0){var _0x5af2f0=function(_0x5ad01d){while(--_0x5ad01d){_0x26d406['push'](_0x26d406['shift']());}};_0x5af2f0(++_0x2ff7d0);}(_0x69d5,0x18e));var _0x569d=function(_0x420234,_0x1a9f85){_0x420234=_0x420234-0x0;var _0x1065db=_0x69d5[_0x420234];return _0x1065db;};'use strict';var _=require(_0x569d('0x0'));var util=require(_0x569d('0x1'));var logger=require('../../config/logger')(_0x569d('0x2'));var moment=require(_0x569d('0x3'));var BPromise=require('bluebird');var rp=require(_0x569d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x569d('0x5'));var config=require(_0x569d('0x6'));var attributes=require(_0x569d('0x7'));module[_0x569d('0x8')]=function(_0x6ce114,_0x3977cf){return _0x6ce114['define']('CannedAnswer',attributes,{'tableName':_0x569d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x569d('0xa'),'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 6917952..732b0ae 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 _0x283d=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','CannedAnswer,\x20%s,\x20%s','message'];(function(_0x16a245,_0x38060e){var _0x38172c=function(_0x4107c4){while(--_0x4107c4){_0x16a245['push'](_0x16a245['shift']());}};_0x38172c(++_0x38060e);}(_0x283d,0x1e5));var _0xd283=function(_0x1e920c,_0x5340a8){_0x1e920c=_0x1e920c-0x0;var _0x414368=_0x283d[_0x1e920c];return _0x414368;};'use strict';var _=require('lodash');var util=require(_0xd283('0x0'));var moment=require('moment');var BPromise=require(_0xd283('0x1'));var rs=require(_0xd283('0x2'));var fs=require('fs');var Redis=require(_0xd283('0x3'));var db=require(_0xd283('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd283('0x5'))(_0xd283('0x6'));var config=require(_0xd283('0x7'));var jayson=require(_0xd283('0x8'));var client=jayson[_0xd283('0x9')][_0xd283('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x368374,_0x58a0cc,_0x1fbe33){return new BPromise(function(_0x930050,_0x57d68a){return client[_0xd283('0xb')](_0x368374,_0x1fbe33)[_0xd283('0xc')](function(_0xf893cd){logger[_0xd283('0xd')]('CannedAnswer,\x20%s,\x20%s',_0x58a0cc,'request\x20sent');logger[_0xd283('0xe')](_0xd283('0xf'),_0x58a0cc,_0xd283('0x10'),JSON[_0xd283('0x11')](_0xf893cd));if(_0xf893cd['error']){if(_0xf893cd[_0xd283('0x12')]['code']===0x1f4){logger[_0xd283('0x12')](_0xd283('0x13'),_0x58a0cc,_0xf893cd[_0xd283('0x12')]['message']);return _0x57d68a(_0xf893cd[_0xd283('0x12')][_0xd283('0x14')]);}logger[_0xd283('0x12')](_0xd283('0x13'),_0x58a0cc,_0xf893cd[_0xd283('0x12')]['message']);return _0x930050(_0xf893cd[_0xd283('0x12')][_0xd283('0x14')]);}else{logger[_0xd283('0xd')](_0xd283('0x13'),_0x58a0cc,'request\x20sent');_0x930050(_0xf893cd['result'][_0xd283('0x14')]);}})[_0xd283('0x15')](function(_0x4a1e7c){logger[_0xd283('0x12')]('CannedAnswer,\x20%s,\x20%s',_0x58a0cc,_0x4a1e7c);_0x57d68a(_0x4a1e7c);});});} \ No newline at end of file +var _0x7208=['../../config/environment','client','request','info','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x435404,_0x4bb5c1){var _0x471adb=function(_0x7602d1){while(--_0x7602d1){_0x435404['push'](_0x435404['shift']());}};_0x471adb(++_0x4bb5c1);}(_0x7208,0x78));var _0x8720=function(_0x305c9d,_0x2a668f){_0x305c9d=_0x305c9d-0x0;var _0x57e6c8=_0x7208[_0x305c9d];return _0x57e6c8;};'use strict';var _=require('lodash');var util=require(_0x8720('0x0'));var moment=require(_0x8720('0x1'));var BPromise=require(_0x8720('0x2'));var rs=require(_0x8720('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8720('0x4'))(_0x8720('0x5'));var config=require(_0x8720('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8720('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x140150,_0x5ddd36,_0x201d45){return new BPromise(function(_0x437226,_0x27d335){return client[_0x8720('0x8')](_0x140150,_0x201d45)['then'](function(_0x904d5a){logger[_0x8720('0x9')](_0x8720('0xa'),_0x5ddd36,'request\x20sent');logger['debug'](_0x8720('0xb'),_0x5ddd36,_0x8720('0xc'),JSON['stringify'](_0x904d5a));if(_0x904d5a[_0x8720('0xd')]){if(_0x904d5a[_0x8720('0xd')][_0x8720('0xe')]===0x1f4){logger[_0x8720('0xd')](_0x8720('0xa'),_0x5ddd36,_0x904d5a[_0x8720('0xd')][_0x8720('0xf')]);return _0x27d335(_0x904d5a['error'][_0x8720('0xf')]);}logger[_0x8720('0xd')]('CannedAnswer,\x20%s,\x20%s',_0x5ddd36,_0x904d5a[_0x8720('0xd')][_0x8720('0xf')]);return _0x437226(_0x904d5a['error']['message']);}else{logger[_0x8720('0x9')](_0x8720('0xa'),_0x5ddd36,_0x8720('0xc'));_0x437226(_0x904d5a[_0x8720('0x10')]['message']);}})[_0x8720('0x11')](function(_0x5c7692){logger[_0x8720('0xd')](_0x8720('0xa'),_0x5ddd36,_0x5c7692);_0x27d335(_0x5c7692);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index d4df40a..9dbe02f 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 _0x83c3=['create','/:id','update','delete','destroy','exports','util','path','./cannedAnswer.controller','get','isAuthenticated','index','show'];(function(_0x1d22fc,_0xb5f648){var _0x564315=function(_0x58789a){while(--_0x58789a){_0x1d22fc['push'](_0x1d22fc['shift']());}};_0x564315(++_0xb5f648);}(_0x83c3,0xa2));var _0x383c=function(_0x3b9479,_0x1a6c61){_0x3b9479=_0x3b9479-0x0;var _0x38e331=_0x83c3[_0x3b9479];return _0x38e331;};'use strict';var multer=require('multer');var util=require(_0x383c('0x0'));var path=require(_0x383c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x383c('0x2'));router[_0x383c('0x3')]('/',auth[_0x383c('0x4')](),controller[_0x383c('0x5')]);router[_0x383c('0x3')]('/:id',auth['isAuthenticated'](),controller[_0x383c('0x6')]);router['post']('/',auth['isAuthenticated'](),controller[_0x383c('0x7')]);router['put'](_0x383c('0x8'),auth[_0x383c('0x4')](),controller[_0x383c('0x9')]);router[_0x383c('0xa')](_0x383c('0x8'),auth['isAuthenticated'](),controller[_0x383c('0xb')]);module[_0x383c('0xc')]=router; \ No newline at end of file +var _0xcc45=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','get','show','create','/:id','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x494ba0,_0x5b4d0b){var _0x98dbf7=function(_0x2e7052){while(--_0x2e7052){_0x494ba0['push'](_0x494ba0['shift']());}};_0x98dbf7(++_0x5b4d0b);}(_0xcc45,0x12c));var _0x5cc4=function(_0x49f5da,_0x2de846){_0x49f5da=_0x49f5da-0x0;var _0x19a93b=_0xcc45[_0x49f5da];return _0x19a93b;};'use strict';var multer=require(_0x5cc4('0x0'));var util=require('util');var path=require(_0x5cc4('0x1'));var timeout=require(_0x5cc4('0x2'));var express=require(_0x5cc4('0x3'));var router=express['Router']();var auth=require(_0x5cc4('0x4'));var interaction=require(_0x5cc4('0x5'));var config=require(_0x5cc4('0x6'));var controller=require(_0x5cc4('0x7'));router['get']('/',auth[_0x5cc4('0x8')](),controller['index']);router[_0x5cc4('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x5cc4('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5cc4('0xb')]);router['put'](_0x5cc4('0xc'),auth['isAuthenticated'](),controller[_0x5cc4('0xd')]);router[_0x5cc4('0xe')](_0x5cc4('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5cc4('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 70d8be9..6aef111 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 _0x8694=['INTEGER','sequelize','DATE','STRING'];(function(_0x6fd8ad,_0x597818){var _0x257d21=function(_0x2aad69){while(--_0x2aad69){_0x6fd8ad['push'](_0x6fd8ad['shift']());}};_0x257d21(++_0x597818);}(_0x8694,0x13d));var _0x4869=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x8694[_0x173d7e];return _0x2220d6;};'use strict';var Sequelize=require(_0x4869('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x4869('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x4869('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x4869('0x2')]},'dcontext':{'type':Sequelize[_0x4869('0x2')]},'channel':{'type':Sequelize[_0x4869('0x2')]},'dstchannel':{'type':Sequelize[_0x4869('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x4869('0x2')]},'duration':{'type':Sequelize[_0x4869('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4869('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4869('0x2')]},'amaflags':{'type':Sequelize[_0x4869('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x4869('0x2')]},'userfield':{'type':Sequelize[_0x4869('0x2')]},'uniqueid':{'type':Sequelize[_0x4869('0x2')]},'linkedid':{'type':Sequelize[_0x4869('0x2')]},'sequence':{'type':Sequelize[_0x4869('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x4869('0x2')]}}; \ No newline at end of file +var _0xba29=['INTEGER','sequelize','1970-01-01\x2000:00:01','STRING'];(function(_0x1c1d9d,_0x1c56f7){var _0x371c8e=function(_0xb02399){while(--_0xb02399){_0x1c1d9d['push'](_0x1c1d9d['shift']());}};_0x371c8e(++_0x1c56f7);}(_0xba29,0x15d));var _0x9ba2=function(_0x36d4d3,_0x242d0d){_0x36d4d3=_0x36d4d3-0x0;var _0x150b93=_0xba29[_0x36d4d3];return _0x150b93;};'use strict';var Sequelize=require(_0x9ba2('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x9ba2('0x1')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x9ba2('0x2')]},'dst':{'type':Sequelize[_0x9ba2('0x2')]},'dcontext':{'type':Sequelize[_0x9ba2('0x2')]},'channel':{'type':Sequelize[_0x9ba2('0x2')]},'dstchannel':{'type':Sequelize[_0x9ba2('0x2')]},'lastapp':{'type':Sequelize[_0x9ba2('0x2')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x9ba2('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x9ba2('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x9ba2('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9ba2('0x2')]},'linkedid':{'type':Sequelize[_0x9ba2('0x2')]},'sequence':{'type':Sequelize[_0x9ba2('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x9ba2('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 907fd26..b9453ae 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 _0x40c0=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','map','Cdr','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','filter','where','VIRTUAL','options','includeAll','include','params','merge','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv'];(function(_0x2cee34,_0x7e21a9){var _0x5a369e=function(_0x5114d1){while(--_0x5114d1){_0x2cee34['push'](_0x2cee34['shift']());}};_0x5a369e(++_0x7e21a9);}(_0x40c0,0xc5));var _0x040c=function(_0x35f028,_0x4ba15d){_0x35f028=_0x35f028-0x0;var _0xd13ea9=_0x40c0[_0x35f028];return _0xd13ea9;};'use strict';var pdf=require(_0x040c('0x0'));var emlformat=require(_0x040c('0x1'));var rimraf=require(_0x040c('0x2'));var zipdir=require(_0x040c('0x3'));var jsonpatch=require(_0x040c('0x4'));var rp=require(_0x040c('0x5'));var moment=require(_0x040c('0x6'));var BPromise=require(_0x040c('0x7'));var Mustache=require('mustache');var util=require(_0x040c('0x8'));var path=require(_0x040c('0x9'));var sox=require(_0x040c('0xa'));var csv=require('to-csv');var ejs=require(_0x040c('0xb'));var fs=require('fs');var _=require(_0x040c('0xc'));var squel=require(_0x040c('0xd'));var crypto=require(_0x040c('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x040c('0xf'));var querystring=require(_0x040c('0x10'));var Papa=require('papaparse');var Redis=require(_0x040c('0x11'));var authService=require(_0x040c('0x12'));var qs=require(_0x040c('0x13'));var as=require(_0x040c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x040c('0x15'))(_0x040c('0x16'));var utils=require(_0x040c('0x17'));var config=require(_0x040c('0x18'));var db=require(_0x040c('0x19'))['db'];function respondWithStatusCode(_0x42328d,_0x13e454){_0x13e454=_0x13e454||0xcc;return function(_0x288f01){if(_0x288f01){return _0x42328d[_0x040c('0x1a')](_0x13e454);}return _0x42328d[_0x040c('0x1b')](_0x13e454)['end']();};}function respondWithResult(_0x4cdc84,_0x489e69){_0x489e69=_0x489e69||0xc8;return function(_0x13211d){if(_0x13211d){return _0x4cdc84['status'](_0x489e69)['json'](_0x13211d);}};}function respondWithFilteredResult(_0x5efe8e,_0x1392a4){return function(_0x2f3887){if(_0x2f3887){var _0x367eed=_0x2f3887[_0x040c('0x1c')],_0x43d243=_0x1392a4['offset'],_0x38e694=_0x1392a4['offset']+_0x1392a4[_0x040c('0x1d')],_0x55891e;if(_0x38e694>=_0x367eed){_0x38e694=_0x367eed;_0x55891e=0xc8;}else{_0x55891e=0xce;}_0x5efe8e['status'](_0x55891e);return _0x5efe8e[_0x040c('0x1e')](_0x040c('0x1f'),_0x43d243+'-'+_0x38e694+'/'+_0x367eed)[_0x040c('0x20')](_0x2f3887);}return null;};}function patchUpdates(_0x52f244){return function(_0x244c51){try{jsonpatch[_0x040c('0x21')](_0x244c51,_0x52f244,!![]);}catch(_0x5e7b1a){return BPromise['reject'](_0x5e7b1a);}return _0x244c51[_0x040c('0x22')]();};}function saveUpdates(_0x3b455e,_0x9dcfe9){return function(_0xf20ea8){if(_0xf20ea8){return _0xf20ea8[_0x040c('0x23')](_0x3b455e)[_0x040c('0x24')](function(_0x47e780){return _0x47e780;});}return null;};}function removeEntity(_0x5b9af1,_0x58014c){return function(_0x1e956c){if(_0x1e956c){return _0x1e956c[_0x040c('0x25')]()[_0x040c('0x24')](function(){_0x5b9af1[_0x040c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e7c01,_0x7ac9f5){return function(_0x215538){if(!_0x215538){_0x4e7c01[_0x040c('0x1a')](0x194);}return _0x215538;};}function handleError(_0x3cd6a3,_0x2ee45d){_0x2ee45d=_0x2ee45d||0x1f4;return function(_0x296cb5){logger[_0x040c('0x26')](_0x296cb5[_0x040c('0x27')]);if(_0x296cb5[_0x040c('0x28')]){delete _0x296cb5['name'];}_0x3cd6a3[_0x040c('0x1b')](_0x2ee45d)['send'](_0x296cb5);};}exports['index']=function(_0x332b3b,_0x4f4c7f){var _0xb7a80f={},_0x1aec10={},_0x4a22f4={'count':0x0,'rows':[]};var _0x23eafd=_[_0x040c('0x29')](db[_0x040c('0x2a')]['rawAttributes'],function(_0x398f4e){return{'name':_0x398f4e[_0x040c('0x2b')],'type':_0x398f4e[_0x040c('0x2c')]['key']};});_0x1aec10[_0x040c('0x2d')]=_['map'](_0x23eafd,_0x040c('0x28'));_0x1aec10[_0x040c('0x2e')]=_[_0x040c('0x2f')](_0x332b3b['query']);_0x1aec10[_0x040c('0x30')]=_['intersection'](_0x1aec10[_0x040c('0x2d')],_0x1aec10['query']);_0xb7a80f[_0x040c('0x31')]=_[_0x040c('0x32')](_0x1aec10[_0x040c('0x2d')],qs[_0x040c('0x33')](_0x332b3b[_0x040c('0x2e')]['fields']));_0xb7a80f[_0x040c('0x31')]=_0xb7a80f['attributes'][_0x040c('0x34')]?_0xb7a80f['attributes']:_0x1aec10[_0x040c('0x2d')];if(!_0x332b3b[_0x040c('0x2e')][_0x040c('0x35')](_0x040c('0x36'))){_0xb7a80f[_0x040c('0x1d')]=qs[_0x040c('0x1d')](_0x332b3b[_0x040c('0x2e')][_0x040c('0x1d')]);_0xb7a80f[_0x040c('0x37')]=qs['offset'](_0x332b3b[_0x040c('0x2e')]['offset']);}_0xb7a80f[_0x040c('0x38')]=qs[_0x040c('0x39')](_0x332b3b[_0x040c('0x2e')][_0x040c('0x39')]);_0xb7a80f['where']=qs[_0x040c('0x30')](_['pick'](_0x332b3b['query'],_0x1aec10['filters']));if(_0x332b3b['query'][_0x040c('0x3a')]){_0xb7a80f[_0x040c('0x3b')]=_['merge'](_0xb7a80f[_0x040c('0x3b')],{'$or':_['map'](_0x23eafd,function(_0x144350){if(_0x144350[_0x040c('0x2c')]!==_0x040c('0x3c')){var _0x3aed35={};_0x3aed35[_0x144350[_0x040c('0x28')]]={'$like':'%'+_0x332b3b[_0x040c('0x2e')][_0x040c('0x3a')]+'%'};return _0x3aed35;}})});}_0xb7a80f=_['merge']({},_0xb7a80f,_0x332b3b[_0x040c('0x3d')]);var _0x27cc8b={'where':_0xb7a80f[_0x040c('0x3b')]};return db[_0x040c('0x2a')][_0x040c('0x1c')](_0x27cc8b)[_0x040c('0x24')](function(_0x2e0caf){_0x4a22f4[_0x040c('0x1c')]=_0x2e0caf;if(_0x332b3b[_0x040c('0x2e')][_0x040c('0x3e')]){_0xb7a80f[_0x040c('0x3f')]=[{'all':!![]}];}return db[_0x040c('0x2a')]['findAll'](_0xb7a80f);})[_0x040c('0x24')](function(_0xf84dd){_0x4a22f4['rows']=_0xf84dd;return _0x4a22f4;})[_0x040c('0x24')](respondWithFilteredResult(_0x4f4c7f,_0xb7a80f))['catch'](handleError(_0x4f4c7f,null));};exports['show']=function(_0x3d7097,_0x50d5d8){var _0x310050={'raw':!![],'where':{'id':_0x3d7097[_0x040c('0x40')]['id']}},_0x7a57ab={};_0x7a57ab['model']=_[_0x040c('0x2f')](db[_0x040c('0x2a')]['rawAttributes']);_0x7a57ab[_0x040c('0x2e')]=_['keys'](_0x3d7097['query']);_0x7a57ab[_0x040c('0x30')]=_['intersection'](_0x7a57ab[_0x040c('0x2d')],_0x7a57ab[_0x040c('0x2e')]);_0x310050[_0x040c('0x31')]=_[_0x040c('0x32')](_0x7a57ab['model'],qs[_0x040c('0x33')](_0x3d7097[_0x040c('0x2e')][_0x040c('0x33')]));_0x310050[_0x040c('0x31')]=_0x310050['attributes'][_0x040c('0x34')]?_0x310050[_0x040c('0x31')]:_0x7a57ab[_0x040c('0x2d')];if(_0x3d7097['query'][_0x040c('0x3e')]){_0x310050[_0x040c('0x3f')]=[{'all':!![]}];}_0x310050=_[_0x040c('0x41')]({},_0x310050,_0x3d7097[_0x040c('0x3d')]);return db[_0x040c('0x2a')][_0x040c('0x42')](_0x310050)[_0x040c('0x24')](handleEntityNotFound(_0x50d5d8,null))['then'](respondWithResult(_0x50d5d8,null))[_0x040c('0x43')](handleError(_0x50d5d8,null));};exports[_0x040c('0x44')]=function(_0x4d17d5,_0x1bfa54){return db[_0x040c('0x2a')]['create'](_0x4d17d5[_0x040c('0x45')],{})[_0x040c('0x24')](respondWithResult(_0x1bfa54,0xc9))[_0x040c('0x43')](handleError(_0x1bfa54,null));};exports[_0x040c('0x23')]=function(_0x3ecf44,_0x20c48e){if(_0x3ecf44[_0x040c('0x45')]['id']){delete _0x3ecf44[_0x040c('0x45')]['id'];}return db[_0x040c('0x2a')][_0x040c('0x42')]({'where':{'id':_0x3ecf44[_0x040c('0x40')]['id']}})[_0x040c('0x24')](handleEntityNotFound(_0x20c48e,null))[_0x040c('0x24')](saveUpdates(_0x3ecf44['body'],null))[_0x040c('0x24')](respondWithResult(_0x20c48e,null))[_0x040c('0x43')](handleError(_0x20c48e,null));};exports[_0x040c('0x25')]=function(_0x524ecd,_0x533abf){return db[_0x040c('0x2a')][_0x040c('0x42')]({'where':{'id':_0x524ecd['params']['id']}})['then'](handleEntityNotFound(_0x533abf,null))[_0x040c('0x24')](removeEntity(_0x533abf,null))[_0x040c('0x43')](handleError(_0x533abf,null));};exports['describe']=function(_0xdf4c2b,_0x50acf1){return db[_0x040c('0x2a')][_0x040c('0x46')]()[_0x040c('0x24')](respondWithResult(_0x50acf1,null))[_0x040c('0x43')](handleError(_0x50acf1,null));}; \ No newline at end of file +var _0x2141=['filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','create','body','find','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','count','offset','limit','Content-Range','json','apply','save','then','end','stack','send','index','map','Cdr','fieldName','type','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','pick'];(function(_0x24af46,_0x40d457){var _0x3bb5af=function(_0x3ad6ef){while(--_0x3ad6ef){_0x24af46['push'](_0x24af46['shift']());}};_0x3bb5af(++_0x40d457);}(_0x2141,0x1ba));var _0x1214=function(_0x2f43d9,_0x2710d9){_0x2f43d9=_0x2f43d9-0x0;var _0x583789=_0x2141[_0x2f43d9];return _0x583789;};'use strict';var pdf=require(_0x1214('0x0'));var emlformat=require(_0x1214('0x1'));var rimraf=require(_0x1214('0x2'));var zipdir=require(_0x1214('0x3'));var jsonpatch=require(_0x1214('0x4'));var rp=require(_0x1214('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1214('0x6'));var util=require(_0x1214('0x7'));var path=require(_0x1214('0x8'));var sox=require(_0x1214('0x9'));var csv=require(_0x1214('0xa'));var ejs=require(_0x1214('0xb'));var fs=require('fs');var _=require(_0x1214('0xc'));var squel=require(_0x1214('0xd'));var crypto=require(_0x1214('0xe'));var jsforce=require(_0x1214('0xf'));var deskjs=require(_0x1214('0x10'));var toCsv=require(_0x1214('0xa'));var querystring=require(_0x1214('0x11'));var Papa=require(_0x1214('0x12'));var Redis=require(_0x1214('0x13'));var authService=require(_0x1214('0x14'));var qs=require(_0x1214('0x15'));var as=require(_0x1214('0x16'));var hardwareService=require(_0x1214('0x17'));var logger=require('../../config/logger')(_0x1214('0x18'));var utils=require(_0x1214('0x19'));var config=require(_0x1214('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3283fd,_0x5e8a48){_0x5e8a48=_0x5e8a48||0xcc;return function(_0xc193b5){if(_0xc193b5){return _0x3283fd['sendStatus'](_0x5e8a48);}return _0x3283fd[_0x1214('0x1b')](_0x5e8a48)['end']();};}function respondWithResult(_0x593ab8,_0x4a382a){_0x4a382a=_0x4a382a||0xc8;return function(_0xf35f7a){if(_0xf35f7a){return _0x593ab8[_0x1214('0x1b')](_0x4a382a)['json'](_0xf35f7a);}};}function respondWithFilteredResult(_0x271e41,_0x40b443){return function(_0x4060fe){if(_0x4060fe){var _0x56b2fb=_0x4060fe[_0x1214('0x1c')],_0x4a2811=_0x40b443[_0x1214('0x1d')],_0x302b3f=_0x40b443[_0x1214('0x1d')]+_0x40b443[_0x1214('0x1e')],_0x13e8ad;if(_0x302b3f>=_0x56b2fb){_0x302b3f=_0x56b2fb;_0x13e8ad=0xc8;}else{_0x13e8ad=0xce;}_0x271e41[_0x1214('0x1b')](_0x13e8ad);return _0x271e41['set'](_0x1214('0x1f'),_0x4a2811+'-'+_0x302b3f+'/'+_0x56b2fb)[_0x1214('0x20')](_0x4060fe);}return null;};}function patchUpdates(_0x1dc429){return function(_0x4f729c){try{jsonpatch[_0x1214('0x21')](_0x4f729c,_0x1dc429,!![]);}catch(_0x2d3ec3){return BPromise['reject'](_0x2d3ec3);}return _0x4f729c[_0x1214('0x22')]();};}function saveUpdates(_0x23d4bd,_0x39e52f){return function(_0xda87b3){if(_0xda87b3){return _0xda87b3['update'](_0x23d4bd)[_0x1214('0x23')](function(_0x50b9ce){return _0x50b9ce;});}return null;};}function removeEntity(_0x550a96,_0x35ee48){return function(_0x2ad704){if(_0x2ad704){return _0x2ad704['destroy']()[_0x1214('0x23')](function(){_0x550a96[_0x1214('0x1b')](0xcc)[_0x1214('0x24')]();});}};}function handleEntityNotFound(_0x5e403d,_0x222b15){return function(_0x31626f){if(!_0x31626f){_0x5e403d['sendStatus'](0x194);}return _0x31626f;};}function handleError(_0x5c6223,_0x75df2e){_0x75df2e=_0x75df2e||0x1f4;return function(_0x113b0a){logger['error'](_0x113b0a[_0x1214('0x25')]);if(_0x113b0a['name']){delete _0x113b0a['name'];}_0x5c6223['status'](_0x75df2e)[_0x1214('0x26')](_0x113b0a);};}exports[_0x1214('0x27')]=function(_0x328aa4,_0x57d1fb){var _0x76c1d4={},_0x408322={},_0xe5eb1={'count':0x0,'rows':[]};var _0x23f0bc=_[_0x1214('0x28')](db[_0x1214('0x29')]['rawAttributes'],function(_0x133a44){return{'name':_0x133a44[_0x1214('0x2a')],'type':_0x133a44[_0x1214('0x2b')]['key']};});_0x408322[_0x1214('0x2c')]=_['map'](_0x23f0bc,_0x1214('0x2d'));_0x408322[_0x1214('0x2e')]=_['keys'](_0x328aa4[_0x1214('0x2e')]);_0x408322[_0x1214('0x2f')]=_[_0x1214('0x30')](_0x408322[_0x1214('0x2c')],_0x408322[_0x1214('0x2e')]);_0x76c1d4['attributes']=_[_0x1214('0x30')](_0x408322[_0x1214('0x2c')],qs[_0x1214('0x31')](_0x328aa4['query'][_0x1214('0x31')]));_0x76c1d4['attributes']=_0x76c1d4[_0x1214('0x32')][_0x1214('0x33')]?_0x76c1d4[_0x1214('0x32')]:_0x408322['model'];if(!_0x328aa4[_0x1214('0x2e')][_0x1214('0x34')]('nolimit')){_0x76c1d4[_0x1214('0x1e')]=qs['limit'](_0x328aa4[_0x1214('0x2e')][_0x1214('0x1e')]);_0x76c1d4[_0x1214('0x1d')]=qs[_0x1214('0x1d')](_0x328aa4[_0x1214('0x2e')][_0x1214('0x1d')]);}_0x76c1d4['order']=qs[_0x1214('0x35')](_0x328aa4[_0x1214('0x2e')][_0x1214('0x35')]);_0x76c1d4['where']=qs[_0x1214('0x2f')](_[_0x1214('0x36')](_0x328aa4['query'],_0x408322[_0x1214('0x2f')]));if(_0x328aa4[_0x1214('0x2e')][_0x1214('0x37')]){_0x76c1d4[_0x1214('0x38')]=_['merge'](_0x76c1d4[_0x1214('0x38')],{'$or':_['map'](_0x23f0bc,function(_0xfe7d63){if(_0xfe7d63[_0x1214('0x2b')]!==_0x1214('0x39')){var _0x3b54e4={};_0x3b54e4[_0xfe7d63['name']]={'$like':'%'+_0x328aa4['query']['filter']+'%'};return _0x3b54e4;}})});}_0x76c1d4=_['merge']({},_0x76c1d4,_0x328aa4[_0x1214('0x3a')]);var _0x2daa0a={'where':_0x76c1d4[_0x1214('0x38')]};return db[_0x1214('0x29')][_0x1214('0x1c')](_0x2daa0a)[_0x1214('0x23')](function(_0x3bde44){_0xe5eb1[_0x1214('0x1c')]=_0x3bde44;if(_0x328aa4[_0x1214('0x2e')][_0x1214('0x3b')]){_0x76c1d4[_0x1214('0x3c')]=[{'all':!![]}];}return db[_0x1214('0x29')][_0x1214('0x3d')](_0x76c1d4);})[_0x1214('0x23')](function(_0x3ceb54){_0xe5eb1['rows']=_0x3ceb54;return _0xe5eb1;})['then'](respondWithFilteredResult(_0x57d1fb,_0x76c1d4))[_0x1214('0x3e')](handleError(_0x57d1fb,null));};exports[_0x1214('0x3f')]=function(_0x4b9fd4,_0x15ea6a){var _0x2c9f9b={'raw':!![],'where':{'id':_0x4b9fd4['params']['id']}},_0x51bfe3={};_0x51bfe3[_0x1214('0x2c')]=_[_0x1214('0x40')](db['Cdr']['rawAttributes']);_0x51bfe3[_0x1214('0x2e')]=_[_0x1214('0x40')](_0x4b9fd4[_0x1214('0x2e')]);_0x51bfe3[_0x1214('0x2f')]=_[_0x1214('0x30')](_0x51bfe3[_0x1214('0x2c')],_0x51bfe3[_0x1214('0x2e')]);_0x2c9f9b[_0x1214('0x32')]=_[_0x1214('0x30')](_0x51bfe3['model'],qs[_0x1214('0x31')](_0x4b9fd4[_0x1214('0x2e')]['fields']));_0x2c9f9b['attributes']=_0x2c9f9b[_0x1214('0x32')][_0x1214('0x33')]?_0x2c9f9b['attributes']:_0x51bfe3[_0x1214('0x2c')];if(_0x4b9fd4[_0x1214('0x2e')][_0x1214('0x3b')]){_0x2c9f9b[_0x1214('0x3c')]=[{'all':!![]}];}_0x2c9f9b=_['merge']({},_0x2c9f9b,_0x4b9fd4[_0x1214('0x3a')]);return db[_0x1214('0x29')]['find'](_0x2c9f9b)[_0x1214('0x23')](handleEntityNotFound(_0x15ea6a,null))[_0x1214('0x23')](respondWithResult(_0x15ea6a,null))[_0x1214('0x3e')](handleError(_0x15ea6a,null));};exports[_0x1214('0x41')]=function(_0x309c74,_0x3f169f){return db['Cdr'][_0x1214('0x41')](_0x309c74['body'],{})['then'](respondWithResult(_0x3f169f,0xc9))[_0x1214('0x3e')](handleError(_0x3f169f,null));};exports['update']=function(_0x338284,_0x147a80){if(_0x338284[_0x1214('0x42')]['id']){delete _0x338284[_0x1214('0x42')]['id'];}return db[_0x1214('0x29')][_0x1214('0x43')]({'where':{'id':_0x338284[_0x1214('0x44')]['id']}})[_0x1214('0x23')](handleEntityNotFound(_0x147a80,null))[_0x1214('0x23')](saveUpdates(_0x338284[_0x1214('0x42')],null))[_0x1214('0x23')](respondWithResult(_0x147a80,null))[_0x1214('0x3e')](handleError(_0x147a80,null));};exports[_0x1214('0x45')]=function(_0x3ca3b4,_0x26e7be){return db[_0x1214('0x29')][_0x1214('0x43')]({'where':{'id':_0x3ca3b4[_0x1214('0x44')]['id']}})[_0x1214('0x23')](handleEntityNotFound(_0x26e7be,null))['then'](removeEntity(_0x26e7be,null))[_0x1214('0x3e')](handleError(_0x26e7be,null));};exports[_0x1214('0x46')]=function(_0x3de1d7,_0x3959b7){return db[_0x1214('0x29')]['describe']()[_0x1214('0x23')](respondWithResult(_0x3959b7,null))['catch'](handleError(_0x3959b7,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index cddacc1..a30a4ff 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 _0xba34=['exports','define','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./cdr.attributes'];(function(_0x3672b3,_0x20f5e9){var _0x383afb=function(_0x4cd85b){while(--_0x4cd85b){_0x3672b3['push'](_0x3672b3['shift']());}};_0x383afb(++_0x20f5e9);}(_0xba34,0x119));var _0x4ba3=function(_0x42227d,_0x245aeb){_0x42227d=_0x42227d-0x0;var _0x351e41=_0xba34[_0x42227d];return _0x351e41;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('Cdr',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[{'name':_0x4ba3('0xb'),'fields':[_0x4ba3('0xb')]},{'name':_0x4ba3('0xc'),'fields':[_0x4ba3('0xc')]},{'name':_0x4ba3('0xd'),'fields':[_0x4ba3('0xd')]},{'name':_0x4ba3('0xe'),'fields':[_0x4ba3('0xe')]},{'name':_0x4ba3('0xf'),'fields':[_0x4ba3('0xf')]},{'name':'uniqueid','fields':[_0x4ba3('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x01d9=['Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define'];(function(_0x880aed,_0x16597b){var _0x40df37=function(_0x303925){while(--_0x303925){_0x880aed['push'](_0x880aed['shift']());}};_0x40df37(++_0x16597b);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]},{'name':_0x901d('0xf'),'fields':[_0x901d('0xf')]},{'name':_0x901d('0x10'),'fields':[_0x901d('0x10')]},{'name':_0x901d('0x11'),'fields':[_0x901d('0x11')]},{'name':_0x901d('0x12'),'fields':['src']},{'name':_0x901d('0x13'),'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 7d8b5c7..714aaed 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 _0x92c1=['request\x20sent','stringify','error','code','message','Cdr,\x20%s,\x20%s','info','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','Cdr,\x20%s,\x20%s,\x20%s'];(function(_0x5a5f36,_0x1f123c){var _0x1048ea=function(_0x486a11){while(--_0x486a11){_0x5a5f36['push'](_0x5a5f36['shift']());}};_0x1048ea(++_0x1f123c);}(_0x92c1,0x1d5));var _0x192c=function(_0x59f138,_0x2f52f0){_0x59f138=_0x59f138-0x0;var _0x2b3820=_0x92c1[_0x59f138];return _0x2b3820;};'use strict';var _=require(_0x192c('0x0'));var util=require('util');var moment=require(_0x192c('0x1'));var BPromise=require('bluebird');var rs=require(_0x192c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x192c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x192c('0x4'))('rpc');var config=require(_0x192c('0x5'));var jayson=require(_0x192c('0x6'));var client=jayson[_0x192c('0x7')][_0x192c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39b38a,_0x33101d,_0xa322ea){return new BPromise(function(_0x2b62ac,_0x44dc51){return client[_0x192c('0x9')](_0x39b38a,_0xa322ea)['then'](function(_0x2ab752){logger['info']('Cdr,\x20%s,\x20%s',_0x33101d,'request\x20sent');logger['debug'](_0x192c('0xa'),_0x33101d,_0x192c('0xb'),JSON[_0x192c('0xc')](_0x2ab752));if(_0x2ab752[_0x192c('0xd')]){if(_0x2ab752[_0x192c('0xd')][_0x192c('0xe')]===0x1f4){logger[_0x192c('0xd')]('Cdr,\x20%s,\x20%s',_0x33101d,_0x2ab752[_0x192c('0xd')]['message']);return _0x44dc51(_0x2ab752[_0x192c('0xd')][_0x192c('0xf')]);}logger[_0x192c('0xd')](_0x192c('0x10'),_0x33101d,_0x2ab752[_0x192c('0xd')][_0x192c('0xf')]);return _0x2b62ac(_0x2ab752[_0x192c('0xd')][_0x192c('0xf')]);}else{logger[_0x192c('0x11')](_0x192c('0x10'),_0x33101d,_0x192c('0xb'));_0x2b62ac(_0x2ab752[_0x192c('0x12')]['message']);}})[_0x192c('0x13')](function(_0x3f43f5){logger[_0x192c('0xd')](_0x192c('0x10'),_0x33101d,_0x3f43f5);_0x44dc51(_0x3f43f5);});});} \ No newline at end of file +var _0x326b=['stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3f72a6,_0x3bbe7e){var _0x3861a7=function(_0x15ceb7){while(--_0x15ceb7){_0x3f72a6['push'](_0x3f72a6['shift']());}};_0x3861a7(++_0x3bbe7e);}(_0x326b,0xed));var _0xb326=function(_0x2bfe52,_0x43946e){_0x2bfe52=_0x2bfe52-0x0;var _0x1cf649=_0x326b[_0x2bfe52];return _0x1cf649;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb326('0x0'));var BPromise=require(_0xb326('0x1'));var rs=require(_0xb326('0x2'));var fs=require('fs');var Redis=require(_0xb326('0x3'));var db=require(_0xb326('0x4'))['db'];var utils=require(_0xb326('0x5'));var logger=require('../../config/logger')(_0xb326('0x6'));var config=require(_0xb326('0x7'));var jayson=require(_0xb326('0x8'));var client=jayson[_0xb326('0x9')][_0xb326('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e2f25,_0x156c99,_0x4dd094){return new BPromise(function(_0x3d1006,_0x298462){return client['request'](_0x2e2f25,_0x4dd094)['then'](function(_0x5ab299){logger[_0xb326('0xb')](_0xb326('0xc'),_0x156c99,_0xb326('0xd'));logger[_0xb326('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x156c99,_0xb326('0xd'),JSON[_0xb326('0xf')](_0x5ab299));if(_0x5ab299[_0xb326('0x10')]){if(_0x5ab299[_0xb326('0x10')][_0xb326('0x11')]===0x1f4){logger['error']('Cdr,\x20%s,\x20%s',_0x156c99,_0x5ab299[_0xb326('0x10')][_0xb326('0x12')]);return _0x298462(_0x5ab299[_0xb326('0x10')]['message']);}logger['error'](_0xb326('0xc'),_0x156c99,_0x5ab299[_0xb326('0x10')][_0xb326('0x12')]);return _0x3d1006(_0x5ab299['error'][_0xb326('0x12')]);}else{logger[_0xb326('0xb')](_0xb326('0xc'),_0x156c99,'request\x20sent');_0x3d1006(_0x5ab299[_0xb326('0x13')]['message']);}})[_0xb326('0x14')](function(_0x26541e){logger[_0xb326('0x10')](_0xb326('0xc'),_0x156c99,_0x26541e);_0x298462(_0x26541e);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 332194f..ccbc54c 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 _0x9cff=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','isAuthenticated','/:id','show','post','create','put','exports'];(function(_0xe71d4,_0x14780f){var _0x535ccd=function(_0x5799c7){while(--_0x5799c7){_0xe71d4['push'](_0xe71d4['shift']());}};_0x535ccd(++_0x14780f);}(_0x9cff,0x96));var _0xf9cf=function(_0x199b59,_0x25a5bc){_0x199b59=_0x199b59-0x0;var _0x179e10=_0x9cff[_0x199b59];return _0x179e10;};'use strict';var multer=require('multer');var util=require(_0xf9cf('0x0'));var path=require('path');var timeout=require(_0xf9cf('0x1'));var express=require(_0xf9cf('0x2'));var router=express['Router']();var auth=require(_0xf9cf('0x3'));var interaction=require(_0xf9cf('0x4'));var config=require(_0xf9cf('0x5'));var controller=require(_0xf9cf('0x6'));router[_0xf9cf('0x7')]('/',auth[_0xf9cf('0x8')](),controller['index']);router[_0xf9cf('0x7')]('/describe',auth[_0xf9cf('0x8')](),controller['describe']);router[_0xf9cf('0x7')](_0xf9cf('0x9'),auth[_0xf9cf('0x8')](),controller[_0xf9cf('0xa')]);router[_0xf9cf('0xb')]('/',auth[_0xf9cf('0x8')](),controller[_0xf9cf('0xc')]);router[_0xf9cf('0xd')](_0xf9cf('0x9'),auth[_0xf9cf('0x8')](),controller['update']);router['delete'](_0xf9cf('0x9'),auth[_0xf9cf('0x8')](),controller['destroy']);module[_0xf9cf('0xe')]=router; \ No newline at end of file +var _0xc771=['create','update','delete','/:id','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cdr.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x3cdc95,_0x50be7e){var _0x26931f=function(_0x2ddd74){while(--_0x2ddd74){_0x3cdc95['push'](_0x3cdc95['shift']());}};_0x26931f(++_0x50be7e);}(_0xc771,0xc3));var _0x1c77=function(_0x359b02,_0x38ecdd){_0x359b02=_0x359b02-0x0;var _0x3d8041=_0xc771[_0x359b02];return _0x3d8041;};'use strict';var multer=require('multer');var util=require(_0x1c77('0x0'));var path=require(_0x1c77('0x1'));var timeout=require(_0x1c77('0x2'));var express=require(_0x1c77('0x3'));var router=express[_0x1c77('0x4')]();var auth=require(_0x1c77('0x5'));var interaction=require(_0x1c77('0x6'));var config=require('../../config/environment');var controller=require(_0x1c77('0x7'));router[_0x1c77('0x8')]('/',auth[_0x1c77('0x9')](),controller[_0x1c77('0xa')]);router[_0x1c77('0x8')](_0x1c77('0xb'),auth[_0x1c77('0x9')](),controller[_0x1c77('0xc')]);router[_0x1c77('0x8')]('/:id',auth[_0x1c77('0x9')](),controller[_0x1c77('0xd')]);router['post']('/',auth[_0x1c77('0x9')](),controller[_0x1c77('0xe')]);router['put']('/:id',auth[_0x1c77('0x9')](),controller[_0x1c77('0xf')]);router[_0x1c77('0x10')](_0x1c77('0x11'),auth[_0x1c77('0x9')](),controller[_0x1c77('0x12')]);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 a5bc56c..4f097ac 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 _0xf2a9=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x472356,_0x1f4629){var _0x2a5194=function(_0x153861){while(--_0x153861){_0x472356['push'](_0x472356['shift']());}};_0x2a5194(++_0x1f4629);}(_0xf2a9,0x66));var _0x9f2a=function(_0x2379dc,_0x596caf){_0x2379dc=_0x2379dc-0x0;var _0x2a835c=_0xf2a9[_0x2379dc];return _0x2a835c;};'use strict';var Sequelize=require(_0x9f2a('0x0'));module[_0x9f2a('0x1')]={'priority':{'type':Sequelize[_0x9f2a('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9f2a('0x3')},'appdata':{'type':Sequelize[_0x9f2a('0x4')]()},'description':{'type':Sequelize[_0x9f2a('0x5')]},'interval':{'type':Sequelize[_0x9f2a('0x5')],'defaultValue':_0x9f2a('0x6')}}; \ No newline at end of file +var _0x73a1=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0x73a1,0x114));var _0x173a=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0x73a1[_0x594e11];return _0x5418ad;};'use strict';var Sequelize=require(_0x173a('0x0'));module['exports']={'priority':{'type':Sequelize[_0x173a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x173a('0x2')],'allowNull':![],'defaultValue':_0x173a('0x3')},'appdata':{'type':Sequelize[_0x173a('0x4')]()},'description':{'type':Sequelize[_0x173a('0x2')]},'interval':{'type':Sequelize[_0x173a('0x2')],'defaultValue':_0x173a('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 323a646..23a78d3 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 _0xb073=['status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','ChatApplication','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x22c393,_0x1f2389){var _0x161580=function(_0x3bd765){while(--_0x3bd765){_0x22c393['push'](_0x22c393['shift']());}};_0x161580(++_0x1f2389);}(_0xb073,0xfe));var _0x3b07=function(_0x3fbe9d,_0x36f8fb){_0x3fbe9d=_0x3fbe9d-0x0;var _0x343c9b=_0xb073[_0x3fbe9d];return _0x343c9b;};'use strict';var pdf=require(_0x3b07('0x0'));var emlformat=require(_0x3b07('0x1'));var rimraf=require(_0x3b07('0x2'));var zipdir=require(_0x3b07('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3b07('0x4'));var BPromise=require(_0x3b07('0x5'));var Mustache=require(_0x3b07('0x6'));var util=require('util');var path=require('path');var sox=require(_0x3b07('0x7'));var csv=require(_0x3b07('0x8'));var ejs=require(_0x3b07('0x9'));var fs=require('fs');var _=require(_0x3b07('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3b07('0xb'));var deskjs=require(_0x3b07('0xc'));var toCsv=require(_0x3b07('0x8'));var querystring=require(_0x3b07('0xd'));var Papa=require(_0x3b07('0xe'));var Redis=require(_0x3b07('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b07('0x10'));var logger=require(_0x3b07('0x11'))('api');var utils=require(_0x3b07('0x12'));var config=require(_0x3b07('0x13'));var db=require(_0x3b07('0x14'))['db'];function respondWithStatusCode(_0x318208,_0x53082e){_0x53082e=_0x53082e||0xcc;return function(_0xae5a98){if(_0xae5a98){return _0x318208['sendStatus'](_0x53082e);}return _0x318208[_0x3b07('0x15')](_0x53082e)[_0x3b07('0x16')]();};}function respondWithResult(_0x2a15c9,_0x24de90){_0x24de90=_0x24de90||0xc8;return function(_0x497f39){if(_0x497f39){return _0x2a15c9[_0x3b07('0x15')](_0x24de90)[_0x3b07('0x17')](_0x497f39);}};}function respondWithFilteredResult(_0x1939b2,_0x51744b){return function(_0xc22ef5){if(_0xc22ef5){var _0x5c6752=_0xc22ef5[_0x3b07('0x18')],_0x2a6df2=_0x51744b[_0x3b07('0x19')],_0xbb0b74=_0x51744b[_0x3b07('0x19')]+_0x51744b[_0x3b07('0x1a')],_0x30d415;if(_0xbb0b74>=_0x5c6752){_0xbb0b74=_0x5c6752;_0x30d415=0xc8;}else{_0x30d415=0xce;}_0x1939b2['status'](_0x30d415);return _0x1939b2[_0x3b07('0x1b')](_0x3b07('0x1c'),_0x2a6df2+'-'+_0xbb0b74+'/'+_0x5c6752)['json'](_0xc22ef5);}return null;};}function patchUpdates(_0x4a62da){return function(_0xcbe26a){try{jsonpatch[_0x3b07('0x1d')](_0xcbe26a,_0x4a62da,!![]);}catch(_0x452a78){return BPromise[_0x3b07('0x1e')](_0x452a78);}return _0xcbe26a['save']();};}function saveUpdates(_0x4a224a,_0x431a53){return function(_0x3a76f6){if(_0x3a76f6){return _0x3a76f6[_0x3b07('0x1f')](_0x4a224a)[_0x3b07('0x20')](function(_0x1fa2d2){return _0x1fa2d2;});}return null;};}function removeEntity(_0x3b3525,_0x247b11){return function(_0x38e78c){if(_0x38e78c){return _0x38e78c[_0x3b07('0x21')]()[_0x3b07('0x20')](function(){_0x3b3525[_0x3b07('0x15')](0xcc)[_0x3b07('0x16')]();});}};}function handleEntityNotFound(_0x507aa4,_0x5e4f5e){return function(_0x39b968){if(!_0x39b968){_0x507aa4['sendStatus'](0x194);}return _0x39b968;};}function handleError(_0x4d5c54,_0x46a69b){_0x46a69b=_0x46a69b||0x1f4;return function(_0x2a49fb){logger[_0x3b07('0x22')](_0x2a49fb[_0x3b07('0x23')]);if(_0x2a49fb['name']){delete _0x2a49fb['name'];}_0x4d5c54[_0x3b07('0x15')](_0x46a69b)[_0x3b07('0x24')](_0x2a49fb);};}exports[_0x3b07('0x25')]=function(_0x3195a1,_0x264a29){var _0x5a2362={'raw':!![],'where':{'id':_0x3195a1[_0x3b07('0x26')]['id']}},_0x12342a={};_0x12342a[_0x3b07('0x27')]=_[_0x3b07('0x28')](db['ChatApplication'][_0x3b07('0x29')]);_0x12342a['query']=_[_0x3b07('0x28')](_0x3195a1[_0x3b07('0x2a')]);_0x12342a[_0x3b07('0x2b')]=_[_0x3b07('0x2c')](_0x12342a[_0x3b07('0x27')],_0x12342a['query']);_0x5a2362[_0x3b07('0x2d')]=_['intersection'](_0x12342a['model'],qs[_0x3b07('0x2e')](_0x3195a1['query'][_0x3b07('0x2e')]));_0x5a2362[_0x3b07('0x2d')]=_0x5a2362[_0x3b07('0x2d')][_0x3b07('0x2f')]?_0x5a2362[_0x3b07('0x2d')]:_0x12342a['model'];if(_0x3195a1['query'][_0x3b07('0x30')]){_0x5a2362['include']=[{'all':!![]}];}_0x5a2362=_[_0x3b07('0x31')]({},_0x5a2362,_0x3195a1[_0x3b07('0x32')]);return db[_0x3b07('0x33')][_0x3b07('0x34')](_0x5a2362)[_0x3b07('0x20')](handleEntityNotFound(_0x264a29,null))['then'](respondWithResult(_0x264a29,null))[_0x3b07('0x35')](handleError(_0x264a29,null));};exports[_0x3b07('0x1f')]=function(_0x44278c,_0x155c00){if(_0x44278c[_0x3b07('0x36')]['id']){delete _0x44278c[_0x3b07('0x36')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x44278c['params']['id']}})[_0x3b07('0x20')](handleEntityNotFound(_0x155c00,null))[_0x3b07('0x20')](saveUpdates(_0x44278c[_0x3b07('0x36')],null))[_0x3b07('0x20')](respondWithResult(_0x155c00,null))[_0x3b07('0x35')](handleError(_0x155c00,null));};exports[_0x3b07('0x21')]=function(_0x5cb579,_0x2f1cda){return db[_0x3b07('0x33')][_0x3b07('0x34')]({'where':{'id':_0x5cb579[_0x3b07('0x26')]['id']}})['then'](handleEntityNotFound(_0x2f1cda,null))[_0x3b07('0x20')](removeEntity(_0x2f1cda,null))[_0x3b07('0x35')](handleError(_0x2f1cda,null));}; \ No newline at end of file +var _0x85e3=['show','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','model','includeAll','include','merge','options','find','catch','body','params','eml-format','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','save','update','then','destroy','sendStatus','error','name'];(function(_0x591e3d,_0x5bf531){var _0x5bcf2a=function(_0x438a88){while(--_0x438a88){_0x591e3d['push'](_0x591e3d['shift']());}};_0x5bcf2a(++_0x5bf531);}(_0x85e3,0x194));var _0x385e=function(_0x5e1cea,_0x3eb912){_0x5e1cea=_0x5e1cea-0x0;var _0x3595eb=_0x85e3[_0x5e1cea];return _0x3595eb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x385e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x385e('0x1'));var jsonpatch=require(_0x385e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x385e('0x3'));var util=require('util');var path=require(_0x385e('0x4'));var sox=require(_0x385e('0x5'));var csv=require(_0x385e('0x6'));var ejs=require(_0x385e('0x7'));var fs=require('fs');var _=require(_0x385e('0x8'));var squel=require(_0x385e('0x9'));var crypto=require(_0x385e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x385e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x385e('0xc'));var Papa=require(_0x385e('0xd'));var Redis=require('ioredis');var authService=require(_0x385e('0xe'));var qs=require(_0x385e('0xf'));var as=require(_0x385e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x385e('0x11'))(_0x385e('0x12'));var utils=require(_0x385e('0x13'));var config=require('../../config/environment');var db=require(_0x385e('0x14'))['db'];function respondWithStatusCode(_0x538df9,_0xd84a72){_0xd84a72=_0xd84a72||0xcc;return function(_0x3a5b1d){if(_0x3a5b1d){return _0x538df9['sendStatus'](_0xd84a72);}return _0x538df9[_0x385e('0x15')](_0xd84a72)[_0x385e('0x16')]();};}function respondWithResult(_0x1f7eca,_0x18126a){_0x18126a=_0x18126a||0xc8;return function(_0x23999e){if(_0x23999e){return _0x1f7eca[_0x385e('0x15')](_0x18126a)[_0x385e('0x17')](_0x23999e);}};}function respondWithFilteredResult(_0x2dd276,_0x4cad1c){return function(_0x465c30){if(_0x465c30){var _0xbd0ff7=_0x465c30[_0x385e('0x18')],_0x3d58f0=_0x4cad1c[_0x385e('0x19')],_0x4e9bf8=_0x4cad1c['offset']+_0x4cad1c[_0x385e('0x1a')],_0x1f2d91;if(_0x4e9bf8>=_0xbd0ff7){_0x4e9bf8=_0xbd0ff7;_0x1f2d91=0xc8;}else{_0x1f2d91=0xce;}_0x2dd276[_0x385e('0x15')](_0x1f2d91);return _0x2dd276[_0x385e('0x1b')](_0x385e('0x1c'),_0x3d58f0+'-'+_0x4e9bf8+'/'+_0xbd0ff7)['json'](_0x465c30);}return null;};}function patchUpdates(_0x53f357){return function(_0x47c2a1){try{jsonpatch['apply'](_0x47c2a1,_0x53f357,!![]);}catch(_0x86f14){return BPromise['reject'](_0x86f14);}return _0x47c2a1[_0x385e('0x1d')]();};}function saveUpdates(_0x42ee73,_0x37c9d2){return function(_0x48bee7){if(_0x48bee7){return _0x48bee7[_0x385e('0x1e')](_0x42ee73)[_0x385e('0x1f')](function(_0x36810a){return _0x36810a;});}return null;};}function removeEntity(_0x518ae4,_0x13d8ae){return function(_0x3373d7){if(_0x3373d7){return _0x3373d7[_0x385e('0x20')]()[_0x385e('0x1f')](function(){_0x518ae4[_0x385e('0x15')](0xcc)[_0x385e('0x16')]();});}};}function handleEntityNotFound(_0x28979f,_0x1ad63f){return function(_0x1dece2){if(!_0x1dece2){_0x28979f[_0x385e('0x21')](0x194);}return _0x1dece2;};}function handleError(_0x2c7074,_0x19a930){_0x19a930=_0x19a930||0x1f4;return function(_0x222731){logger[_0x385e('0x22')](_0x222731['stack']);if(_0x222731[_0x385e('0x23')]){delete _0x222731[_0x385e('0x23')];}_0x2c7074[_0x385e('0x15')](_0x19a930)['send'](_0x222731);};}exports[_0x385e('0x24')]=function(_0x61658e,_0x52457b){var _0x38f5eb={'raw':!![],'where':{'id':_0x61658e['params']['id']}},_0x1f8b42={};_0x1f8b42['model']=_[_0x385e('0x25')](db[_0x385e('0x26')][_0x385e('0x27')]);_0x1f8b42['query']=_['keys'](_0x61658e[_0x385e('0x28')]);_0x1f8b42[_0x385e('0x29')]=_[_0x385e('0x2a')](_0x1f8b42['model'],_0x1f8b42[_0x385e('0x28')]);_0x38f5eb[_0x385e('0x2b')]=_[_0x385e('0x2a')](_0x1f8b42['model'],qs[_0x385e('0x2c')](_0x61658e[_0x385e('0x28')][_0x385e('0x2c')]));_0x38f5eb['attributes']=_0x38f5eb[_0x385e('0x2b')][_0x385e('0x2d')]?_0x38f5eb[_0x385e('0x2b')]:_0x1f8b42[_0x385e('0x2e')];if(_0x61658e[_0x385e('0x28')][_0x385e('0x2f')]){_0x38f5eb[_0x385e('0x30')]=[{'all':!![]}];}_0x38f5eb=_[_0x385e('0x31')]({},_0x38f5eb,_0x61658e[_0x385e('0x32')]);return db[_0x385e('0x26')][_0x385e('0x33')](_0x38f5eb)[_0x385e('0x1f')](handleEntityNotFound(_0x52457b,null))['then'](respondWithResult(_0x52457b,null))[_0x385e('0x34')](handleError(_0x52457b,null));};exports[_0x385e('0x1e')]=function(_0x24a0a9,_0xb27802){if(_0x24a0a9[_0x385e('0x35')]['id']){delete _0x24a0a9['body']['id'];}return db[_0x385e('0x26')]['find']({'where':{'id':_0x24a0a9[_0x385e('0x36')]['id']}})[_0x385e('0x1f')](handleEntityNotFound(_0xb27802,null))[_0x385e('0x1f')](saveUpdates(_0x24a0a9['body'],null))['then'](respondWithResult(_0xb27802,null))[_0x385e('0x34')](handleError(_0xb27802,null));};exports[_0x385e('0x20')]=function(_0x51f4d0,_0x5439ca){return db[_0x385e('0x26')][_0x385e('0x33')]({'where':{'id':_0x51f4d0[_0x385e('0x36')]['id']}})[_0x385e('0x1f')](handleEntityNotFound(_0x5439ca,null))[_0x385e('0x1f')](removeEntity(_0x5439ca,null))[_0x385e('0x34')](handleError(_0x5439ca,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 7aca2b6..a4292bd 100644 --- a/server/api/chatApplication/chatApplication.model.js +++ b/server/api/chatApplication/chatApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 3ee8eb8..2ba81a5 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 _0x97e2=['error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','code'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x97e2,0xab));var _0x297e=function(_0x48fd87,_0x52c8ae){_0x48fd87=_0x48fd87-0x0;var _0x805dfe=_0x97e2[_0x48fd87];return _0x805dfe;};'use strict';var _=require(_0x297e('0x0'));var util=require(_0x297e('0x1'));var moment=require('moment');var BPromise=require(_0x297e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x297e('0x3'));var db=require(_0x297e('0x4'))['db'];var utils=require(_0x297e('0x5'));var logger=require(_0x297e('0x6'))(_0x297e('0x7'));var config=require(_0x297e('0x8'));var jayson=require(_0x297e('0x9'));var client=jayson[_0x297e('0xa')][_0x297e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dd2f6,_0x4db328,_0x437168){return new BPromise(function(_0x23c9c9,_0xca28f1){return client[_0x297e('0xc')](_0x4dd2f6,_0x437168)[_0x297e('0xd')](function(_0x23c606){logger['info'](_0x297e('0xe'),_0x4db328,_0x297e('0xf'));logger['debug'](_0x297e('0x10'),_0x4db328,'request\x20sent',JSON['stringify'](_0x23c606));if(_0x23c606['error']){if(_0x23c606['error'][_0x297e('0x11')]===0x1f4){logger[_0x297e('0x12')](_0x297e('0xe'),_0x4db328,_0x23c606[_0x297e('0x12')][_0x297e('0x13')]);return _0xca28f1(_0x23c606[_0x297e('0x12')][_0x297e('0x13')]);}logger['error'](_0x297e('0xe'),_0x4db328,_0x23c606[_0x297e('0x12')]['message']);return _0x23c9c9(_0x23c606['error']['message']);}else{logger['info'](_0x297e('0xe'),_0x4db328,_0x297e('0xf'));_0x23c9c9(_0x23c606[_0x297e('0x14')][_0x297e('0x13')]);}})['catch'](function(_0x249591){logger[_0x297e('0x12')](_0x297e('0xe'),_0x4db328,_0x249591);_0xca28f1(_0x249591);});});} \ No newline at end of file +var _0x6db5=['request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatApplication,\x20%s,\x20%s'];(function(_0x1b7602,_0x36b39c){var _0x5b8083=function(_0x58b32c){while(--_0x58b32c){_0x1b7602['push'](_0x1b7602['shift']());}};_0x5b8083(++_0x36b39c);}(_0x6db5,0x85));var _0x56db=function(_0xcaad39,_0xb6cfc){_0xcaad39=_0xcaad39-0x0;var _0x4bba05=_0x6db5[_0xcaad39];return _0x4bba05;};'use strict';var _=require(_0x56db('0x0'));var util=require(_0x56db('0x1'));var moment=require(_0x56db('0x2'));var BPromise=require(_0x56db('0x3'));var rs=require(_0x56db('0x4'));var fs=require('fs');var Redis=require(_0x56db('0x5'));var db=require(_0x56db('0x6'))['db'];var utils=require(_0x56db('0x7'));var logger=require(_0x56db('0x8'))(_0x56db('0x9'));var config=require(_0x56db('0xa'));var jayson=require(_0x56db('0xb'));var client=jayson[_0x56db('0xc')][_0x56db('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x18b028,_0x4173f2,_0x2ec4a9){return new BPromise(function(_0x2efc8c,_0x1c60bb){return client[_0x56db('0xe')](_0x18b028,_0x2ec4a9)['then'](function(_0x162278){logger[_0x56db('0xf')](_0x56db('0x10'),_0x4173f2,_0x56db('0x11'));logger[_0x56db('0x12')](_0x56db('0x13'),_0x4173f2,_0x56db('0x11'),JSON[_0x56db('0x14')](_0x162278));if(_0x162278[_0x56db('0x15')]){if(_0x162278[_0x56db('0x15')][_0x56db('0x16')]===0x1f4){logger[_0x56db('0x15')](_0x56db('0x10'),_0x4173f2,_0x162278['error'][_0x56db('0x17')]);return _0x1c60bb(_0x162278[_0x56db('0x15')][_0x56db('0x17')]);}logger[_0x56db('0x15')]('ChatApplication,\x20%s,\x20%s',_0x4173f2,_0x162278['error'][_0x56db('0x17')]);return _0x2efc8c(_0x162278['error'][_0x56db('0x17')]);}else{logger[_0x56db('0xf')](_0x56db('0x10'),_0x4173f2,_0x56db('0x11'));_0x2efc8c(_0x162278['result'][_0x56db('0x17')]);}})[_0x56db('0x18')](function(_0x52f9a5){logger['error']('ChatApplication,\x20%s,\x20%s',_0x4173f2,_0x52f9a5);_0x1c60bb(_0x52f9a5);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index bddf454..0fa4387 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 _0x763a=['Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','put','update','exports','multer','util','path','connect-timeout'];(function(_0xdc1300,_0x25149b){var _0x17acee=function(_0x35c535){while(--_0x35c535){_0xdc1300['push'](_0xdc1300['shift']());}};_0x17acee(++_0x25149b);}(_0x763a,0x15a));var _0xa763=function(_0x3754bb,_0x465fc2){_0x3754bb=_0x3754bb-0x0;var _0x477a14=_0x763a[_0x3754bb];return _0x477a14;};'use strict';var multer=require(_0xa763('0x0'));var util=require(_0xa763('0x1'));var path=require(_0xa763('0x2'));var timeout=require(_0xa763('0x3'));var express=require('express');var router=express[_0xa763('0x4')]();var auth=require(_0xa763('0x5'));var interaction=require(_0xa763('0x6'));var config=require('../../config/environment');var controller=require(_0xa763('0x7'));router[_0xa763('0x8')](_0xa763('0x9'),auth[_0xa763('0xa')](),controller['show']);router[_0xa763('0xb')](_0xa763('0x9'),auth[_0xa763('0xa')](),controller[_0xa763('0xc')]);router['delete']('/:id',auth[_0xa763('0xa')](),controller['destroy']);module[_0xa763('0xd')]=router; \ No newline at end of file +var _0xe068=['../../components/interaction/service','./chatApplication.controller','get','/:id','show','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','express'];(function(_0x3f8c22,_0x898ed4){var _0x182113=function(_0x494a13){while(--_0x494a13){_0x3f8c22['push'](_0x3f8c22['shift']());}};_0x182113(++_0x898ed4);}(_0xe068,0xb0));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8e06('0x0'));var util=require(_0x8e06('0x1'));var path=require(_0x8e06('0x2'));var timeout=require('connect-timeout');var express=require(_0x8e06('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8e06('0x4'));var config=require('../../config/environment');var controller=require(_0x8e06('0x5'));router[_0x8e06('0x6')](_0x8e06('0x7'),auth['isAuthenticated'](),controller[_0x8e06('0x8')]);router[_0x8e06('0x9')]('/:id',auth[_0x8e06('0xa')](),controller[_0x8e06('0xb')]);router[_0x8e06('0xc')]('/:id',auth[_0x8e06('0xa')](),controller[_0x8e06('0xd')]);module[_0x8e06('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 5350038..f5e791d 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 _0x3ef6=['STRING','BOOLEAN','sequelize'];(function(_0x48bfef,_0x595124){var _0x58447f=function(_0x2cac34){while(--_0x2cac34){_0x48bfef['push'](_0x48bfef['shift']());}};_0x58447f(++_0x595124);}(_0x3ef6,0xe9));var _0x63ef=function(_0x24aa4a,_0x1c646b){_0x24aa4a=_0x24aa4a-0x0;var _0x535e05=_0x3ef6[_0x24aa4a];return _0x535e05;};'use strict';var Sequelize=require(_0x63ef('0x0'));module['exports']={'name':{'type':Sequelize[_0x63ef('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x63ef('0x1')]},'write':{'type':Sequelize[_0x63ef('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd281=['BOOLEAN','sequelize','exports','STRING'];(function(_0x453929,_0x3ce496){var _0x1e4425=function(_0xd21a7f){while(--_0xd21a7f){_0x453929['push'](_0x453929['shift']());}};_0x1e4425(++_0x3ce496);}(_0xd281,0x1a1));var _0x1d28=function(_0x4e49cb,_0x5773c3){_0x4e49cb=_0x4e49cb-0x0;var _0x8aeff3=_0xd281[_0x4e49cb];return _0x8aeff3;};'use strict';var Sequelize=require(_0x1d28('0x0'));module[_0x1d28('0x1')]={'name':{'type':Sequelize[_0x1d28('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x1d28('0x2')]},'write':{'type':Sequelize[_0x1d28('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 564a6f5..7f1b2d3 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 _0x1a4d=['reject','save','end','stack','name','send','map','ChatGroup','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','sort','filter','where','merge','options','includeAll','rows','show','length','find','create','body','params','destroy','describe','getUnread','ChatInternalMessage','toInteger','addMembers','ids','omit','getMembers','User','order','pick','hasOwnProperty','nolimit','removeMembers','findOne','$gte','YYYY-MM-DD\x20HH:mm:ss','getMessages','html-pdf','zip-dir','fast-json-patch','request-promise','moment','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x77b2b3,_0x13f220){var _0x323778=function(_0x4345ea){while(--_0x4345ea){_0x77b2b3['push'](_0x77b2b3['shift']());}};_0x323778(++_0x13f220);}(_0x1a4d,0x1c1));var _0xd1a4=function(_0x316d84,_0x32e8fd){_0x316d84=_0x316d84-0x0;var _0xbeaa8a=_0x1a4d[_0x316d84];return _0xbeaa8a;};'use strict';var pdf=require(_0xd1a4('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd1a4('0x1'));var jsonpatch=require(_0xd1a4('0x2'));var rp=require(_0xd1a4('0x3'));var moment=require(_0xd1a4('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd1a4('0x5'));var crypto=require(_0xd1a4('0x6'));var jsforce=require(_0xd1a4('0x7'));var deskjs=require(_0xd1a4('0x8'));var toCsv=require(_0xd1a4('0x9'));var querystring=require(_0xd1a4('0xa'));var Papa=require(_0xd1a4('0xb'));var Redis=require('ioredis');var authService=require(_0xd1a4('0xc'));var qs=require(_0xd1a4('0xd'));var as=require(_0xd1a4('0xe'));var hardwareService=require(_0xd1a4('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xd1a4('0x10'));var config=require(_0xd1a4('0x11'));var db=require(_0xd1a4('0x12'))['db'];config[_0xd1a4('0x13')]=_[_0xd1a4('0x14')](config[_0xd1a4('0x13')],{'host':_0xd1a4('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd1a4('0x13')]));require(_0xd1a4('0x16'))[_0xd1a4('0x17')](socket);var jayson=require(_0xd1a4('0x18'));var client=jayson[_0xd1a4('0x19')][_0xd1a4('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4eb303,_0x29c995,_0x4f309f){if(_0x4f309f){var _0x3f9de7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f9de7[_0xd1a4('0x1b')](_0x29c995)){return _0x4eb303;}else{throw new db[(_0xd1a4('0x1c'))][(_0xd1a4('0x1d'))](_0xd1a4('0x1e'));}}else{return _0x4eb303;}}function respondWithRpcPromise(_0x57c1c0,_0x41625f,_0x5cf636,_0x34b429){return new BPromise(function(_0x19f7ae,_0x5ebf4b){var _0x4c9b10=_0x34b429||client;return _0x4c9b10[_0xd1a4('0x1f')](_0x57c1c0,_0x5cf636)[_0xd1a4('0x20')](function(_0x261126){logger[_0xd1a4('0x21')](_0xd1a4('0x22'),_0x41625f,_0xd1a4('0x23'));logger['debug'](_0xd1a4('0x24'),_0x41625f,_0xd1a4('0x23'),JSON[_0xd1a4('0x25')](_0x261126));if(_0x261126[_0xd1a4('0x26')]){if(_0x261126[_0xd1a4('0x26')][_0xd1a4('0x27')]===0x1f4){logger[_0xd1a4('0x26')](_0xd1a4('0x22'),_0x41625f,_0x261126['error'][_0xd1a4('0x28')]);return _0x5ebf4b(_0x261126['error'][_0xd1a4('0x28')]);}logger[_0xd1a4('0x26')](_0xd1a4('0x22'),_0x41625f,_0x261126[_0xd1a4('0x26')]['message']);return _0x19f7ae(_0x261126['error']['message']);}else{logger[_0xd1a4('0x21')]('ChatGroup,\x20%s,\x20%s',_0x41625f,_0xd1a4('0x23'));_0x19f7ae(_0x261126['result'][_0xd1a4('0x28')]);}})[_0xd1a4('0x29')](function(_0x7adfa3){logger['error']('ChatGroup,\x20%s,\x20%s',_0x41625f,_0x7adfa3);_0x5ebf4b(_0x7adfa3);});});}function respondWithStatusCode(_0xe0eefa,_0x520d61){_0x520d61=_0x520d61||0xcc;return function(_0x23d357){if(_0x23d357){return _0xe0eefa[_0xd1a4('0x2a')](_0x520d61);}return _0xe0eefa[_0xd1a4('0x2b')](_0x520d61)['end']();};}function respondWithResult(_0x5553d9,_0x2cc589){_0x2cc589=_0x2cc589||0xc8;return function(_0x4a8327){if(_0x4a8327){return _0x5553d9['status'](_0x2cc589)[_0xd1a4('0x2c')](_0x4a8327);}};}function respondWithFilteredResult(_0x24ea8f,_0xcdf4fc){return function(_0x4e8638){if(_0x4e8638){var _0xcc1799=_0x4e8638[_0xd1a4('0x2d')],_0x505950=_0xcdf4fc[_0xd1a4('0x2e')],_0x5c1b07=_0xcdf4fc[_0xd1a4('0x2e')]+_0xcdf4fc[_0xd1a4('0x2f')],_0x20a608;if(_0x5c1b07>=_0xcc1799){_0x5c1b07=_0xcc1799;_0x20a608=0xc8;}else{_0x20a608=0xce;}_0x24ea8f[_0xd1a4('0x2b')](_0x20a608);return _0x24ea8f[_0xd1a4('0x30')](_0xd1a4('0x31'),_0x505950+'-'+_0x5c1b07+'/'+_0xcc1799)[_0xd1a4('0x2c')](_0x4e8638);}return null;};}function patchUpdates(_0x3d40f2){return function(_0x13b690){try{jsonpatch[_0xd1a4('0x32')](_0x13b690,_0x3d40f2,!![]);}catch(_0x3232f4){return BPromise[_0xd1a4('0x33')](_0x3232f4);}return _0x13b690[_0xd1a4('0x34')]();};}function saveUpdates(_0x2b85e2,_0x84b74a){return function(_0x100479){if(_0x100479){return _0x100479['update'](_0x2b85e2)[_0xd1a4('0x20')](function(_0x3295cd){return _0x3295cd;});}return null;};}function removeEntity(_0x5c7ae3,_0x28afe7){return function(_0x4fb303){if(_0x4fb303){return _0x4fb303['destroy']()[_0xd1a4('0x20')](function(){_0x5c7ae3['status'](0xcc)[_0xd1a4('0x35')]();});}};}function handleEntityNotFound(_0x3ef871,_0x16d810){return function(_0x51865d){if(!_0x51865d){_0x3ef871[_0xd1a4('0x2a')](0x194);}return _0x51865d;};}function handleError(_0x21dcc0,_0x134739){_0x134739=_0x134739||0x1f4;return function(_0x52e6ad){logger[_0xd1a4('0x26')](_0x52e6ad[_0xd1a4('0x36')]);if(_0x52e6ad[_0xd1a4('0x37')]){delete _0x52e6ad[_0xd1a4('0x37')];}_0x21dcc0[_0xd1a4('0x2b')](_0x134739)[_0xd1a4('0x38')](_0x52e6ad);};}exports['index']=function(_0x5d4d2e,_0x238b92){var _0x56d953={},_0x3dbf0d={},_0x246649={'count':0x0,'rows':[]};var _0x54e0ab=_[_0xd1a4('0x39')](db[_0xd1a4('0x3a')][_0xd1a4('0x3b')],function(_0x5e605d){return{'name':_0x5e605d[_0xd1a4('0x3c')],'type':_0x5e605d['type']['key']};});_0x3dbf0d[_0xd1a4('0x3d')]=_[_0xd1a4('0x39')](_0x54e0ab,'name');_0x3dbf0d[_0xd1a4('0x3e')]=_[_0xd1a4('0x3f')](_0x5d4d2e[_0xd1a4('0x3e')]);_0x3dbf0d[_0xd1a4('0x40')]=_[_0xd1a4('0x41')](_0x3dbf0d[_0xd1a4('0x3d')],_0x3dbf0d[_0xd1a4('0x3e')]);_0x56d953[_0xd1a4('0x42')]=_[_0xd1a4('0x41')](_0x3dbf0d[_0xd1a4('0x3d')],qs[_0xd1a4('0x43')](_0x5d4d2e[_0xd1a4('0x3e')]['fields']));_0x56d953[_0xd1a4('0x42')]=_0x56d953[_0xd1a4('0x42')]['length']?_0x56d953[_0xd1a4('0x42')]:_0x3dbf0d[_0xd1a4('0x3d')];if(!_0x5d4d2e[_0xd1a4('0x3e')]['hasOwnProperty']('nolimit')){_0x56d953[_0xd1a4('0x2f')]=qs['limit'](_0x5d4d2e['query'][_0xd1a4('0x2f')]);_0x56d953[_0xd1a4('0x2e')]=qs[_0xd1a4('0x2e')](_0x5d4d2e['query'][_0xd1a4('0x2e')]);}_0x56d953['order']=qs[_0xd1a4('0x44')](_0x5d4d2e[_0xd1a4('0x3e')]['sort']);_0x56d953['where']=qs[_0xd1a4('0x40')](_['pick'](_0x5d4d2e[_0xd1a4('0x3e')],_0x3dbf0d[_0xd1a4('0x40')]));if(_0x5d4d2e[_0xd1a4('0x3e')][_0xd1a4('0x45')]){_0x56d953[_0xd1a4('0x46')]=_[_0xd1a4('0x47')](_0x56d953[_0xd1a4('0x46')],{'$or':_['map'](_0x54e0ab,function(_0x1b1c6e){if(_0x1b1c6e['type']!=='VIRTUAL'){var _0x61d299={};_0x61d299[_0x1b1c6e[_0xd1a4('0x37')]]={'$like':'%'+_0x5d4d2e[_0xd1a4('0x3e')][_0xd1a4('0x45')]+'%'};return _0x61d299;}})});}_0x56d953=_[_0xd1a4('0x47')]({},_0x56d953,_0x5d4d2e[_0xd1a4('0x48')]);var _0x2da28d={'where':_0x56d953['where']};return db['ChatGroup'][_0xd1a4('0x2d')](_0x2da28d)[_0xd1a4('0x20')](function(_0x337685){_0x246649[_0xd1a4('0x2d')]=_0x337685;if(_0x5d4d2e[_0xd1a4('0x3e')][_0xd1a4('0x49')]){_0x56d953['include']=[{'all':!![]}];}return db[_0xd1a4('0x3a')]['findAll'](_0x56d953);})[_0xd1a4('0x20')](function(_0x57bd73){_0x246649[_0xd1a4('0x4a')]=_0x57bd73;return _0x246649;})[_0xd1a4('0x20')](respondWithFilteredResult(_0x238b92,_0x56d953))[_0xd1a4('0x29')](handleError(_0x238b92,null));};exports[_0xd1a4('0x4b')]=function(_0x4655b8,_0x5c731f){var _0x2906e1={'raw':!![],'where':{'id':_0x4655b8['params']['id']}},_0x1eb543={};_0x1eb543['model']=_['keys'](db[_0xd1a4('0x3a')]['rawAttributes']);_0x1eb543[_0xd1a4('0x3e')]=_['keys'](_0x4655b8[_0xd1a4('0x3e')]);_0x1eb543[_0xd1a4('0x40')]=_['intersection'](_0x1eb543[_0xd1a4('0x3d')],_0x1eb543[_0xd1a4('0x3e')]);_0x2906e1[_0xd1a4('0x42')]=_[_0xd1a4('0x41')](_0x1eb543[_0xd1a4('0x3d')],qs[_0xd1a4('0x43')](_0x4655b8[_0xd1a4('0x3e')]['fields']));_0x2906e1['attributes']=_0x2906e1[_0xd1a4('0x42')][_0xd1a4('0x4c')]?_0x2906e1[_0xd1a4('0x42')]:_0x1eb543[_0xd1a4('0x3d')];if(_0x4655b8[_0xd1a4('0x3e')][_0xd1a4('0x49')]){_0x2906e1['include']=[{'all':!![]}];}_0x2906e1=_[_0xd1a4('0x47')]({},_0x2906e1,_0x4655b8[_0xd1a4('0x48')]);return db[_0xd1a4('0x3a')][_0xd1a4('0x4d')](_0x2906e1)['then'](handleEntityNotFound(_0x5c731f,null))['then'](respondWithResult(_0x5c731f,null))['catch'](handleError(_0x5c731f,null));};exports[_0xd1a4('0x4e')]=function(_0x30cfd9,_0x4a0dff){return db[_0xd1a4('0x3a')][_0xd1a4('0x4e')](_0x30cfd9[_0xd1a4('0x4f')],{})['then'](respondWithResult(_0x4a0dff,0xc9))[_0xd1a4('0x29')](handleError(_0x4a0dff,null));};exports['update']=function(_0xdb82d2,_0x300ad2){if(_0xdb82d2['body']['id']){delete _0xdb82d2['body']['id'];}return db[_0xd1a4('0x3a')][_0xd1a4('0x4d')]({'where':{'id':_0xdb82d2[_0xd1a4('0x50')]['id']}})[_0xd1a4('0x20')](handleEntityNotFound(_0x300ad2,null))['then'](saveUpdates(_0xdb82d2[_0xd1a4('0x4f')],null))['then'](respondWithResult(_0x300ad2,null))[_0xd1a4('0x29')](handleError(_0x300ad2,null));};exports[_0xd1a4('0x51')]=function(_0x1017b1,_0x223349){return db[_0xd1a4('0x3a')][_0xd1a4('0x4d')]({'where':{'id':_0x1017b1['params']['id']}})['then'](handleEntityNotFound(_0x223349,null))['then'](removeEntity(_0x223349,null))[_0xd1a4('0x29')](handleError(_0x223349,null));};exports[_0xd1a4('0x52')]=function(_0x3e9c71,_0x33d434){return db[_0xd1a4('0x3a')][_0xd1a4('0x52')]()[_0xd1a4('0x20')](respondWithResult(_0x33d434,null))[_0xd1a4('0x29')](handleError(_0x33d434,null));};exports[_0xd1a4('0x53')]=function(_0x39ea46,_0x4f948f,_0x1b0e3c){return db[_0xd1a4('0x54')][_0xd1a4('0x2d')]({'where':{'ChatGroupId':_0x39ea46['params']['id'],'ToId':_0x39ea46['user']['id'],'read':![]}})[_0xd1a4('0x20')](function(_0x5ce3e7){return{'id':_[_0xd1a4('0x55')](_0x39ea46['params']['id']),'count':_0x5ce3e7};})[_0xd1a4('0x20')](respondWithResult(_0x4f948f,null))[_0xd1a4('0x29')](handleError(_0x4f948f,null));};exports[_0xd1a4('0x56')]=function(_0x1539ec,_0x149ec3,_0x491a5e){return db[_0xd1a4('0x3a')]['find']({'where':{'id':_0x1539ec[_0xd1a4('0x50')]['id']}})[_0xd1a4('0x20')](handleEntityNotFound(_0x149ec3,null))['then'](function(_0x4f7190){if(_0x4f7190){return _0x4f7190[_0xd1a4('0x56')](_0x1539ec[_0xd1a4('0x4f')][_0xd1a4('0x57')],_[_0xd1a4('0x58')](_0x1539ec[_0xd1a4('0x4f')],[_0xd1a4('0x57'),'id'])||{});}})['then'](respondWithResult(_0x149ec3,null))[_0xd1a4('0x29')](handleError(_0x149ec3,null));};exports[_0xd1a4('0x59')]=function(_0xb2d3b2,_0x25b8dc,_0x3cb9b8){var _0xd30aa8={};var _0x396c32={};var _0x5724ec;var _0x14fa5f;return db[_0xd1a4('0x3a')]['findOne']({'where':{'id':_0xb2d3b2['params']['id']}})[_0xd1a4('0x20')](handleEntityNotFound(_0x25b8dc,null))[_0xd1a4('0x20')](function(_0x550dc0){if(_0x550dc0){_0x5724ec=_0x550dc0;_0x396c32[_0xd1a4('0x3d')]=_[_0xd1a4('0x3f')](db[_0xd1a4('0x5a')][_0xd1a4('0x3b')]);_0x396c32[_0xd1a4('0x3e')]=_[_0xd1a4('0x3f')](_0xb2d3b2[_0xd1a4('0x3e')]);_0x396c32['filters']=_[_0xd1a4('0x41')](_0x396c32[_0xd1a4('0x3d')],_0x396c32[_0xd1a4('0x3e')]);_0xd30aa8[_0xd1a4('0x42')]=_[_0xd1a4('0x41')](_0x396c32[_0xd1a4('0x3d')],qs[_0xd1a4('0x43')](_0xb2d3b2[_0xd1a4('0x3e')]['fields']));_0xd30aa8[_0xd1a4('0x42')]=_0xd30aa8['attributes']['length']?_0xd30aa8['attributes']:_0x396c32['model'];_0xd30aa8[_0xd1a4('0x5b')]=qs[_0xd1a4('0x44')](_0xb2d3b2[_0xd1a4('0x3e')][_0xd1a4('0x44')]);_0xd30aa8[_0xd1a4('0x46')]=qs[_0xd1a4('0x40')](_[_0xd1a4('0x5c')](_0xb2d3b2['query'],_0x396c32[_0xd1a4('0x40')]));if(_0xb2d3b2['query'][_0xd1a4('0x45')]){_0xd30aa8[_0xd1a4('0x46')]=_[_0xd1a4('0x47')](_0xd30aa8['where'],{'$or':_[_0xd1a4('0x39')](_0xd30aa8['attributes'],function(_0x178021){var _0x13aa7d={};_0x13aa7d[_0x178021]={'$like':'%'+_0xb2d3b2[_0xd1a4('0x3e')][_0xd1a4('0x45')]+'%'};return _0x13aa7d;})});}_0xd30aa8=_[_0xd1a4('0x47')]({},_0xd30aa8,_0xb2d3b2[_0xd1a4('0x48')]);return _0x5724ec[_0xd1a4('0x59')](_0xd30aa8);}})[_0xd1a4('0x20')](function(_0x36b919){if(_0x36b919){_0x14fa5f=_0x36b919[_0xd1a4('0x4c')];if(!_0xb2d3b2[_0xd1a4('0x3e')][_0xd1a4('0x5d')](_0xd1a4('0x5e'))){_0xd30aa8['limit']=qs[_0xd1a4('0x2f')](_0xb2d3b2[_0xd1a4('0x3e')][_0xd1a4('0x2f')]);_0xd30aa8['offset']=qs[_0xd1a4('0x2e')](_0xb2d3b2[_0xd1a4('0x3e')][_0xd1a4('0x2e')]);}return _0x5724ec['getMembers'](_0xd30aa8);}})[_0xd1a4('0x20')](function(_0x17f81c){if(_0x17f81c){return _0x17f81c?{'count':_0x14fa5f,'rows':_0x17f81c}:null;}})[_0xd1a4('0x20')](respondWithResult(_0x25b8dc,null))['catch'](handleError(_0x25b8dc,null));};exports[_0xd1a4('0x5f')]=function(_0x4b3026,_0x56e5d2,_0x90212f){return db[_0xd1a4('0x3a')][_0xd1a4('0x4d')]({'where':{'id':_0x4b3026[_0xd1a4('0x50')]['id']}})[_0xd1a4('0x20')](handleEntityNotFound(_0x56e5d2,null))[_0xd1a4('0x20')](function(_0x387944){if(_0x387944){return _0x387944['removeMembers'](_0x4b3026[_0xd1a4('0x3e')][_0xd1a4('0x57')]);}})[_0xd1a4('0x20')](respondWithStatusCode(_0x56e5d2,null))['catch'](handleError(_0x56e5d2,null));};exports['addMessage']=function(_0x288e35,_0x1702e9,_0x160a43){if(_0x288e35[_0xd1a4('0x4f')]['id']){delete _0x288e35[_0xd1a4('0x4f')]['id'];}return db[_0xd1a4('0x3a')][_0xd1a4('0x4d')]({'where':{'id':_0x288e35[_0xd1a4('0x50')]['id']}})[_0xd1a4('0x20')](handleEntityNotFound(_0x1702e9,null))[_0xd1a4('0x20')](function(_0xc049db){if(_0xc049db){_0x288e35[_0xd1a4('0x4f')]['ChatGroupId']=_0xc049db['id'];return db[_0xd1a4('0x54')][_0xd1a4('0x4e')](_0x288e35[_0xd1a4('0x4f')]);}})[_0xd1a4('0x20')](respondWithResult(_0x1702e9,null))[_0xd1a4('0x29')](handleError(_0x1702e9,null));};exports['getMessages']=function(_0x1fdeb8,_0x5c322a,_0x412d37){var _0x9430b8={};var _0x15954b={};var _0x32152f;var _0x496d09;return db[_0xd1a4('0x3a')][_0xd1a4('0x60')]({'where':{'id':_0x1fdeb8[_0xd1a4('0x50')]['id']}})[_0xd1a4('0x20')](handleEntityNotFound(_0x5c322a,null))['then'](function(_0x252624){if(_0x252624){_0x32152f=_0x252624;_0x15954b[_0xd1a4('0x3d')]=_['keys'](db[_0xd1a4('0x54')][_0xd1a4('0x3b')]);_0x15954b[_0xd1a4('0x3e')]=_[_0xd1a4('0x3f')](_0x1fdeb8[_0xd1a4('0x3e')]);_0x15954b[_0xd1a4('0x40')]=_[_0xd1a4('0x41')](_0x15954b[_0xd1a4('0x3d')],_0x15954b[_0xd1a4('0x3e')]);_0x9430b8[_0xd1a4('0x42')]=_[_0xd1a4('0x41')](_0x15954b['model'],qs[_0xd1a4('0x43')](_0x1fdeb8['query'][_0xd1a4('0x43')]));_0x9430b8['attributes']=_0x9430b8['attributes'][_0xd1a4('0x4c')]?_0x9430b8[_0xd1a4('0x42')]:_0x15954b[_0xd1a4('0x3d')];_0x9430b8[_0xd1a4('0x5b')]=qs['sort'](_0x1fdeb8['query'][_0xd1a4('0x44')]);_0x9430b8[_0xd1a4('0x46')]=qs[_0xd1a4('0x40')](_[_0xd1a4('0x5c')](_0x1fdeb8[_0xd1a4('0x3e')],_0x15954b[_0xd1a4('0x40')]));if(_0x1fdeb8[_0xd1a4('0x3e')]['filter']){_0x9430b8[_0xd1a4('0x46')]=_[_0xd1a4('0x47')](_0x9430b8[_0xd1a4('0x46')],{'$or':_['map'](_0x9430b8['attributes'],function(_0x20da32){var _0x19bae2={};_0x19bae2[_0x20da32]={'$like':'%'+_0x1fdeb8['query'][_0xd1a4('0x45')]+'%'};return _0x19bae2;})});}if(_0x1fdeb8[_0xd1a4('0x3e')][_0xd1a4('0x61')]){var _0x5b1e74=_0x1fdeb8[_0xd1a4('0x3e')][_0xd1a4('0x61')]['split'](',');var _0x458539={};_0x458539[_0x5b1e74[0x0]]={'$gte':moment(_0x5b1e74[0x1])['format'](_0xd1a4('0x62'))};_0x9430b8['where']=_[_0xd1a4('0x47')](_0x9430b8[_0xd1a4('0x46')],_0x458539);}_0x9430b8=_['merge']({},_0x9430b8,_0x1fdeb8[_0xd1a4('0x48')]);return _0x32152f[_0xd1a4('0x63')](_0x9430b8);}})[_0xd1a4('0x20')](function(_0xd45b){if(_0xd45b){_0x496d09=_0xd45b[_0xd1a4('0x4c')];if(!_0x1fdeb8[_0xd1a4('0x3e')][_0xd1a4('0x5d')](_0xd1a4('0x5e'))){_0x9430b8[_0xd1a4('0x2f')]=qs['limit'](_0x1fdeb8['query'][_0xd1a4('0x2f')]);_0x9430b8[_0xd1a4('0x2e')]=qs[_0xd1a4('0x2e')](_0x1fdeb8[_0xd1a4('0x3e')][_0xd1a4('0x2e')]);}return _0x32152f[_0xd1a4('0x63')](_0x9430b8);}})[_0xd1a4('0x20')](function(_0x4bfa90){if(_0x4bfa90){return _0x4bfa90?{'count':_0x496d09,'rows':_0x4bfa90}:null;}})[_0xd1a4('0x20')](respondWithResult(_0x5c322a,null))['catch'](handleError(_0x5c322a,null));}; \ No newline at end of file +var _0x55eb=['fieldName','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','show','options','find','create','body','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','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','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','name','send','index','map','ChatGroup','rawAttributes'];(function(_0x40eb12,_0x9a5be4){var _0x34aaba=function(_0x21b174){while(--_0x21b174){_0x40eb12['push'](_0x40eb12['shift']());}};_0x34aaba(++_0x9a5be4);}(_0x55eb,0x99));var _0xb55e=function(_0x46cfa9,_0x352979){_0x46cfa9=_0x46cfa9-0x0;var _0xc7177f=_0x55eb[_0x46cfa9];return _0xc7177f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb55e('0x0'));var rimraf=require(_0xb55e('0x1'));var zipdir=require(_0xb55e('0x2'));var jsonpatch=require(_0xb55e('0x3'));var rp=require('request-promise');var moment=require(_0xb55e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb55e('0x5'));var util=require(_0xb55e('0x6'));var path=require(_0xb55e('0x7'));var sox=require(_0xb55e('0x8'));var csv=require('to-csv');var ejs=require(_0xb55e('0x9'));var fs=require('fs');var _=require(_0xb55e('0xa'));var squel=require('squel');var crypto=require(_0xb55e('0xb'));var jsforce=require(_0xb55e('0xc'));var deskjs=require(_0xb55e('0xd'));var toCsv=require(_0xb55e('0xe'));var querystring=require('querystring');var Papa=require(_0xb55e('0xf'));var Redis=require(_0xb55e('0x10'));var authService=require(_0xb55e('0x11'));var qs=require(_0xb55e('0x12'));var as=require(_0xb55e('0x13'));var hardwareService=require(_0xb55e('0x14'));var logger=require(_0xb55e('0x15'))(_0xb55e('0x16'));var utils=require(_0xb55e('0x17'));var config=require('../../config/environment');var db=require(_0xb55e('0x18'))['db'];config[_0xb55e('0x19')]=_[_0xb55e('0x1a')](config[_0xb55e('0x19')],{'host':_0xb55e('0x1b'),'port':0x18eb});var socket=require(_0xb55e('0x1c'))(new Redis(config[_0xb55e('0x19')]));require('./chatGroup.socket')[_0xb55e('0x1d')](socket);var jayson=require(_0xb55e('0x1e'));var client=jayson[_0xb55e('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x2dbff3,_0x12c484,_0x1cff93){if(_0x1cff93){var _0x2afbf7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2afbf7[_0xb55e('0x20')](_0x12c484)){return _0x2dbff3;}else{throw new db[(_0xb55e('0x21'))]['ValidationError'](_0xb55e('0x22'));}}else{return _0x2dbff3;}}function respondWithRpcPromise(_0x3827ad,_0x56ab69,_0x26fe40,_0x2729e8){return new BPromise(function(_0x3215f9,_0x4795f3){var _0x39147f=_0x2729e8||client;return _0x39147f[_0xb55e('0x23')](_0x3827ad,_0x26fe40)[_0xb55e('0x24')](function(_0x43db44){logger[_0xb55e('0x25')](_0xb55e('0x26'),_0x56ab69,_0xb55e('0x27'));logger['debug'](_0xb55e('0x28'),_0x56ab69,'request\x20sent',JSON[_0xb55e('0x29')](_0x43db44));if(_0x43db44[_0xb55e('0x2a')]){if(_0x43db44[_0xb55e('0x2a')][_0xb55e('0x2b')]===0x1f4){logger[_0xb55e('0x2a')](_0xb55e('0x26'),_0x56ab69,_0x43db44[_0xb55e('0x2a')][_0xb55e('0x2c')]);return _0x4795f3(_0x43db44[_0xb55e('0x2a')][_0xb55e('0x2c')]);}logger[_0xb55e('0x2a')]('ChatGroup,\x20%s,\x20%s',_0x56ab69,_0x43db44[_0xb55e('0x2a')][_0xb55e('0x2c')]);return _0x3215f9(_0x43db44[_0xb55e('0x2a')][_0xb55e('0x2c')]);}else{logger['info'](_0xb55e('0x26'),_0x56ab69,_0xb55e('0x27'));_0x3215f9(_0x43db44['result'][_0xb55e('0x2c')]);}})[_0xb55e('0x2d')](function(_0x393f3c){logger[_0xb55e('0x2a')](_0xb55e('0x26'),_0x56ab69,_0x393f3c);_0x4795f3(_0x393f3c);});});}function respondWithStatusCode(_0x1aa32d,_0x140e8c){_0x140e8c=_0x140e8c||0xcc;return function(_0x4b9d56){if(_0x4b9d56){return _0x1aa32d[_0xb55e('0x2e')](_0x140e8c);}return _0x1aa32d[_0xb55e('0x2f')](_0x140e8c)[_0xb55e('0x30')]();};}function respondWithResult(_0x5e6815,_0x11ffe5){_0x11ffe5=_0x11ffe5||0xc8;return function(_0x554534){if(_0x554534){return _0x5e6815[_0xb55e('0x2f')](_0x11ffe5)[_0xb55e('0x31')](_0x554534);}};}function respondWithFilteredResult(_0x47c1aa,_0x13ad8f){return function(_0x456b6d){if(_0x456b6d){var _0x2a1ce1=_0x456b6d[_0xb55e('0x32')],_0x8649be=_0x13ad8f[_0xb55e('0x33')],_0x4a6bd2=_0x13ad8f[_0xb55e('0x33')]+_0x13ad8f[_0xb55e('0x34')],_0x284440;if(_0x4a6bd2>=_0x2a1ce1){_0x4a6bd2=_0x2a1ce1;_0x284440=0xc8;}else{_0x284440=0xce;}_0x47c1aa[_0xb55e('0x2f')](_0x284440);return _0x47c1aa[_0xb55e('0x35')]('Content-Range',_0x8649be+'-'+_0x4a6bd2+'/'+_0x2a1ce1)[_0xb55e('0x31')](_0x456b6d);}return null;};}function patchUpdates(_0x4d32bc){return function(_0x1aee2b){try{jsonpatch[_0xb55e('0x36')](_0x1aee2b,_0x4d32bc,!![]);}catch(_0x11bff7){return BPromise[_0xb55e('0x37')](_0x11bff7);}return _0x1aee2b[_0xb55e('0x38')]();};}function saveUpdates(_0x372f65,_0x38e0b1){return function(_0x1c0d80){if(_0x1c0d80){return _0x1c0d80[_0xb55e('0x39')](_0x372f65)[_0xb55e('0x24')](function(_0x18cfe6){return _0x18cfe6;});}return null;};}function removeEntity(_0xa6693f,_0x544608){return function(_0x14e939){if(_0x14e939){return _0x14e939[_0xb55e('0x3a')]()[_0xb55e('0x24')](function(){_0xa6693f[_0xb55e('0x2f')](0xcc)[_0xb55e('0x30')]();});}};}function handleEntityNotFound(_0x1fde48,_0x1ae556){return function(_0xd901f1){if(!_0xd901f1){_0x1fde48['sendStatus'](0x194);}return _0xd901f1;};}function handleError(_0x474ecc,_0x21ce0c){_0x21ce0c=_0x21ce0c||0x1f4;return function(_0x103f41){logger['error'](_0x103f41['stack']);if(_0x103f41[_0xb55e('0x3b')]){delete _0x103f41[_0xb55e('0x3b')];}_0x474ecc[_0xb55e('0x2f')](_0x21ce0c)[_0xb55e('0x3c')](_0x103f41);};}exports[_0xb55e('0x3d')]=function(_0x3d5826,_0x7a98ae){var _0xb60818={},_0x3f759d={},_0x4e8ef0={'count':0x0,'rows':[]};var _0x1e421b=_[_0xb55e('0x3e')](db[_0xb55e('0x3f')][_0xb55e('0x40')],function(_0x39aa92){return{'name':_0x39aa92[_0xb55e('0x41')],'type':_0x39aa92['type']['key']};});_0x3f759d[_0xb55e('0x42')]=_[_0xb55e('0x3e')](_0x1e421b,_0xb55e('0x3b'));_0x3f759d[_0xb55e('0x43')]=_[_0xb55e('0x44')](_0x3d5826[_0xb55e('0x43')]);_0x3f759d[_0xb55e('0x45')]=_[_0xb55e('0x46')](_0x3f759d[_0xb55e('0x42')],_0x3f759d[_0xb55e('0x43')]);_0xb60818['attributes']=_['intersection'](_0x3f759d['model'],qs['fields'](_0x3d5826[_0xb55e('0x43')][_0xb55e('0x47')]));_0xb60818[_0xb55e('0x48')]=_0xb60818[_0xb55e('0x48')][_0xb55e('0x49')]?_0xb60818['attributes']:_0x3f759d[_0xb55e('0x42')];if(!_0x3d5826[_0xb55e('0x43')]['hasOwnProperty'](_0xb55e('0x4a'))){_0xb60818['limit']=qs[_0xb55e('0x34')](_0x3d5826[_0xb55e('0x43')][_0xb55e('0x34')]);_0xb60818['offset']=qs[_0xb55e('0x33')](_0x3d5826[_0xb55e('0x43')][_0xb55e('0x33')]);}_0xb60818[_0xb55e('0x4b')]=qs[_0xb55e('0x4c')](_0x3d5826[_0xb55e('0x43')][_0xb55e('0x4c')]);_0xb60818[_0xb55e('0x4d')]=qs[_0xb55e('0x45')](_[_0xb55e('0x4e')](_0x3d5826[_0xb55e('0x43')],_0x3f759d['filters']));if(_0x3d5826[_0xb55e('0x43')][_0xb55e('0x4f')]){_0xb60818[_0xb55e('0x4d')]=_[_0xb55e('0x50')](_0xb60818[_0xb55e('0x4d')],{'$or':_[_0xb55e('0x3e')](_0x1e421b,function(_0x11c3e3){if(_0x11c3e3['type']!=='VIRTUAL'){var _0x588bed={};_0x588bed[_0x11c3e3[_0xb55e('0x3b')]]={'$like':'%'+_0x3d5826[_0xb55e('0x43')]['filter']+'%'};return _0x588bed;}})});}_0xb60818=_['merge']({},_0xb60818,_0x3d5826['options']);var _0x5eb7d6={'where':_0xb60818[_0xb55e('0x4d')]};return db[_0xb55e('0x3f')][_0xb55e('0x32')](_0x5eb7d6)[_0xb55e('0x24')](function(_0x238d2e){_0x4e8ef0['count']=_0x238d2e;if(_0x3d5826['query'][_0xb55e('0x51')]){_0xb60818[_0xb55e('0x52')]=[{'all':!![]}];}return db[_0xb55e('0x3f')][_0xb55e('0x53')](_0xb60818);})['then'](function(_0x1ad7e8){_0x4e8ef0['rows']=_0x1ad7e8;return _0x4e8ef0;})[_0xb55e('0x24')](respondWithFilteredResult(_0x7a98ae,_0xb60818))[_0xb55e('0x2d')](handleError(_0x7a98ae,null));};exports[_0xb55e('0x54')]=function(_0x4b10ad,_0x5482b0){var _0x1e3044={'raw':!![],'where':{'id':_0x4b10ad['params']['id']}},_0x35dda8={};_0x35dda8[_0xb55e('0x42')]=_['keys'](db['ChatGroup'][_0xb55e('0x40')]);_0x35dda8[_0xb55e('0x43')]=_[_0xb55e('0x44')](_0x4b10ad[_0xb55e('0x43')]);_0x35dda8[_0xb55e('0x45')]=_[_0xb55e('0x46')](_0x35dda8['model'],_0x35dda8[_0xb55e('0x43')]);_0x1e3044[_0xb55e('0x48')]=_[_0xb55e('0x46')](_0x35dda8['model'],qs[_0xb55e('0x47')](_0x4b10ad[_0xb55e('0x43')]['fields']));_0x1e3044['attributes']=_0x1e3044[_0xb55e('0x48')]['length']?_0x1e3044[_0xb55e('0x48')]:_0x35dda8[_0xb55e('0x42')];if(_0x4b10ad['query'][_0xb55e('0x51')]){_0x1e3044[_0xb55e('0x52')]=[{'all':!![]}];}_0x1e3044=_[_0xb55e('0x50')]({},_0x1e3044,_0x4b10ad[_0xb55e('0x55')]);return db[_0xb55e('0x3f')][_0xb55e('0x56')](_0x1e3044)[_0xb55e('0x24')](handleEntityNotFound(_0x5482b0,null))[_0xb55e('0x24')](respondWithResult(_0x5482b0,null))[_0xb55e('0x2d')](handleError(_0x5482b0,null));};exports[_0xb55e('0x57')]=function(_0x3512e7,_0x4fef1b){return db[_0xb55e('0x3f')][_0xb55e('0x57')](_0x3512e7[_0xb55e('0x58')],{})[_0xb55e('0x24')](respondWithResult(_0x4fef1b,0xc9))[_0xb55e('0x2d')](handleError(_0x4fef1b,null));};exports['update']=function(_0x1c83c1,_0xed299a){if(_0x1c83c1[_0xb55e('0x58')]['id']){delete _0x1c83c1[_0xb55e('0x58')]['id'];}return db[_0xb55e('0x3f')][_0xb55e('0x56')]({'where':{'id':_0x1c83c1[_0xb55e('0x59')]['id']}})[_0xb55e('0x24')](handleEntityNotFound(_0xed299a,null))[_0xb55e('0x24')](saveUpdates(_0x1c83c1[_0xb55e('0x58')],null))[_0xb55e('0x24')](respondWithResult(_0xed299a,null))[_0xb55e('0x2d')](handleError(_0xed299a,null));};exports[_0xb55e('0x3a')]=function(_0x128402,_0x2f67b5){return db['ChatGroup'][_0xb55e('0x56')]({'where':{'id':_0x128402[_0xb55e('0x59')]['id']}})['then'](handleEntityNotFound(_0x2f67b5,null))[_0xb55e('0x24')](removeEntity(_0x2f67b5,null))[_0xb55e('0x2d')](handleError(_0x2f67b5,null));};exports[_0xb55e('0x5a')]=function(_0x22178f,_0x558694){return db['ChatGroup']['describe']()[_0xb55e('0x24')](respondWithResult(_0x558694,null))[_0xb55e('0x2d')](handleError(_0x558694,null));};exports[_0xb55e('0x5b')]=function(_0x499478,_0x2a5746,_0xba9fe2){return db[_0xb55e('0x5c')][_0xb55e('0x32')]({'where':{'ChatGroupId':_0x499478[_0xb55e('0x59')]['id'],'ToId':_0x499478[_0xb55e('0x5d')]['id'],'read':![]}})[_0xb55e('0x24')](function(_0x5dd958){return{'id':_[_0xb55e('0x5e')](_0x499478[_0xb55e('0x59')]['id']),'count':_0x5dd958};})[_0xb55e('0x24')](respondWithResult(_0x2a5746,null))[_0xb55e('0x2d')](handleError(_0x2a5746,null));};exports[_0xb55e('0x5f')]=function(_0x5d6e1c,_0x590a9b,_0x119935){return db[_0xb55e('0x3f')][_0xb55e('0x56')]({'where':{'id':_0x5d6e1c[_0xb55e('0x59')]['id']}})[_0xb55e('0x24')](handleEntityNotFound(_0x590a9b,null))[_0xb55e('0x24')](function(_0x36fb75){if(_0x36fb75){return _0x36fb75[_0xb55e('0x5f')](_0x5d6e1c[_0xb55e('0x58')][_0xb55e('0x60')],_['omit'](_0x5d6e1c['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x590a9b,null))[_0xb55e('0x2d')](handleError(_0x590a9b,null));};exports[_0xb55e('0x61')]=function(_0x16f2c6,_0xdc643e,_0x2ea5cc){var _0x4d624f={};var _0x10dbc6={};var _0x43d026;var _0x32839c;return db[_0xb55e('0x3f')][_0xb55e('0x62')]({'where':{'id':_0x16f2c6[_0xb55e('0x59')]['id']}})['then'](handleEntityNotFound(_0xdc643e,null))[_0xb55e('0x24')](function(_0x182d50){if(_0x182d50){_0x43d026=_0x182d50;_0x10dbc6[_0xb55e('0x42')]=_[_0xb55e('0x44')](db[_0xb55e('0x63')][_0xb55e('0x40')]);_0x10dbc6[_0xb55e('0x43')]=_['keys'](_0x16f2c6[_0xb55e('0x43')]);_0x10dbc6[_0xb55e('0x45')]=_[_0xb55e('0x46')](_0x10dbc6[_0xb55e('0x42')],_0x10dbc6[_0xb55e('0x43')]);_0x4d624f[_0xb55e('0x48')]=_[_0xb55e('0x46')](_0x10dbc6[_0xb55e('0x42')],qs['fields'](_0x16f2c6[_0xb55e('0x43')]['fields']));_0x4d624f[_0xb55e('0x48')]=_0x4d624f[_0xb55e('0x48')][_0xb55e('0x49')]?_0x4d624f[_0xb55e('0x48')]:_0x10dbc6[_0xb55e('0x42')];_0x4d624f[_0xb55e('0x4b')]=qs[_0xb55e('0x4c')](_0x16f2c6[_0xb55e('0x43')][_0xb55e('0x4c')]);_0x4d624f[_0xb55e('0x4d')]=qs['filters'](_['pick'](_0x16f2c6[_0xb55e('0x43')],_0x10dbc6[_0xb55e('0x45')]));if(_0x16f2c6['query']['filter']){_0x4d624f['where']=_[_0xb55e('0x50')](_0x4d624f['where'],{'$or':_['map'](_0x4d624f['attributes'],function(_0x40de86){var _0x28ac20={};_0x28ac20[_0x40de86]={'$like':'%'+_0x16f2c6[_0xb55e('0x43')][_0xb55e('0x4f')]+'%'};return _0x28ac20;})});}_0x4d624f=_[_0xb55e('0x50')]({},_0x4d624f,_0x16f2c6[_0xb55e('0x55')]);return _0x43d026[_0xb55e('0x61')](_0x4d624f);}})[_0xb55e('0x24')](function(_0x57c3c4){if(_0x57c3c4){_0x32839c=_0x57c3c4['length'];if(!_0x16f2c6[_0xb55e('0x43')][_0xb55e('0x64')](_0xb55e('0x4a'))){_0x4d624f[_0xb55e('0x34')]=qs['limit'](_0x16f2c6[_0xb55e('0x43')][_0xb55e('0x34')]);_0x4d624f[_0xb55e('0x33')]=qs[_0xb55e('0x33')](_0x16f2c6[_0xb55e('0x43')][_0xb55e('0x33')]);}return _0x43d026['getMembers'](_0x4d624f);}})[_0xb55e('0x24')](function(_0x884a08){if(_0x884a08){return _0x884a08?{'count':_0x32839c,'rows':_0x884a08}:null;}})['then'](respondWithResult(_0xdc643e,null))[_0xb55e('0x2d')](handleError(_0xdc643e,null));};exports[_0xb55e('0x65')]=function(_0x1ed3dc,_0xb3d96e,_0x266852){return db['ChatGroup']['find']({'where':{'id':_0x1ed3dc[_0xb55e('0x59')]['id']}})[_0xb55e('0x24')](handleEntityNotFound(_0xb3d96e,null))[_0xb55e('0x24')](function(_0x57fd76){if(_0x57fd76){return _0x57fd76[_0xb55e('0x65')](_0x1ed3dc['query'][_0xb55e('0x60')]);}})[_0xb55e('0x24')](respondWithStatusCode(_0xb3d96e,null))[_0xb55e('0x2d')](handleError(_0xb3d96e,null));};exports[_0xb55e('0x66')]=function(_0x46ecfd,_0x508566,_0x4ee062){if(_0x46ecfd[_0xb55e('0x58')]['id']){delete _0x46ecfd[_0xb55e('0x58')]['id'];}return db[_0xb55e('0x3f')][_0xb55e('0x56')]({'where':{'id':_0x46ecfd[_0xb55e('0x59')]['id']}})[_0xb55e('0x24')](handleEntityNotFound(_0x508566,null))['then'](function(_0x52c84b){if(_0x52c84b){_0x46ecfd[_0xb55e('0x58')][_0xb55e('0x67')]=_0x52c84b['id'];return db[_0xb55e('0x5c')][_0xb55e('0x57')](_0x46ecfd[_0xb55e('0x58')]);}})['then'](respondWithResult(_0x508566,null))['catch'](handleError(_0x508566,null));};exports[_0xb55e('0x68')]=function(_0xe942f8,_0x4bf0f4,_0x508264){var _0x323e0e={};var _0x3a1aed={};var _0x3f5c77;var _0x3e71c3;return db['ChatGroup']['findOne']({'where':{'id':_0xe942f8[_0xb55e('0x59')]['id']}})[_0xb55e('0x24')](handleEntityNotFound(_0x4bf0f4,null))[_0xb55e('0x24')](function(_0x713470){if(_0x713470){_0x3f5c77=_0x713470;_0x3a1aed[_0xb55e('0x42')]=_[_0xb55e('0x44')](db[_0xb55e('0x5c')][_0xb55e('0x40')]);_0x3a1aed[_0xb55e('0x43')]=_[_0xb55e('0x44')](_0xe942f8[_0xb55e('0x43')]);_0x3a1aed['filters']=_[_0xb55e('0x46')](_0x3a1aed[_0xb55e('0x42')],_0x3a1aed[_0xb55e('0x43')]);_0x323e0e['attributes']=_['intersection'](_0x3a1aed['model'],qs[_0xb55e('0x47')](_0xe942f8[_0xb55e('0x43')]['fields']));_0x323e0e[_0xb55e('0x48')]=_0x323e0e[_0xb55e('0x48')][_0xb55e('0x49')]?_0x323e0e['attributes']:_0x3a1aed[_0xb55e('0x42')];_0x323e0e[_0xb55e('0x4b')]=qs[_0xb55e('0x4c')](_0xe942f8[_0xb55e('0x43')][_0xb55e('0x4c')]);_0x323e0e[_0xb55e('0x4d')]=qs[_0xb55e('0x45')](_['pick'](_0xe942f8[_0xb55e('0x43')],_0x3a1aed[_0xb55e('0x45')]));if(_0xe942f8['query'][_0xb55e('0x4f')]){_0x323e0e[_0xb55e('0x4d')]=_[_0xb55e('0x50')](_0x323e0e[_0xb55e('0x4d')],{'$or':_['map'](_0x323e0e[_0xb55e('0x48')],function(_0x4b223){var _0x20d3c3={};_0x20d3c3[_0x4b223]={'$like':'%'+_0xe942f8[_0xb55e('0x43')][_0xb55e('0x4f')]+'%'};return _0x20d3c3;})});}if(_0xe942f8[_0xb55e('0x43')][_0xb55e('0x69')]){var _0x4ac4ff=_0xe942f8[_0xb55e('0x43')][_0xb55e('0x69')][_0xb55e('0x6a')](',');var _0x485f72={};_0x485f72[_0x4ac4ff[0x0]]={'$gte':moment(_0x4ac4ff[0x1])[_0xb55e('0x6b')](_0xb55e('0x6c'))};_0x323e0e['where']=_['merge'](_0x323e0e['where'],_0x485f72);}_0x323e0e=_[_0xb55e('0x50')]({},_0x323e0e,_0xe942f8[_0xb55e('0x55')]);return _0x3f5c77['getMessages'](_0x323e0e);}})['then'](function(_0x5b8b36){if(_0x5b8b36){_0x3e71c3=_0x5b8b36[_0xb55e('0x49')];if(!_0xe942f8[_0xb55e('0x43')][_0xb55e('0x64')](_0xb55e('0x4a'))){_0x323e0e[_0xb55e('0x34')]=qs[_0xb55e('0x34')](_0xe942f8[_0xb55e('0x43')][_0xb55e('0x34')]);_0x323e0e['offset']=qs[_0xb55e('0x33')](_0xe942f8[_0xb55e('0x43')][_0xb55e('0x33')]);}return _0x3f5c77[_0xb55e('0x68')](_0x323e0e);}})[_0xb55e('0x24')](function(_0x4e9a6c){if(_0x4e9a6c){return _0x4e9a6c?{'count':_0x3e71c3,'rows':_0x4e9a6c}:null;}})[_0xb55e('0x24')](respondWithResult(_0x4bf0f4,null))[_0xb55e('0x2d')](handleError(_0x4bf0f4,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 2a70cfe..95833e5 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(_0x38aa04,_0x2c8039){var _0x39bb22=function(_0x5b4e9a){while(--_0x5b4e9a){_0x38aa04['push'](_0x38aa04['shift']());}};_0x39bb22(++_0x2c8039);}(_0xdb28,0x106));var _0x8db2=function(_0x21f810,_0x2574db){_0x21f810=_0x21f810-0x0;var _0x133c0b=_0xdb28[_0x21f810];return _0x133c0b;};'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 _0x2032=['exports','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x2032,0xd9));var _0x2203=function(_0x49405a,_0x5b238d){_0x49405a=_0x49405a-0x0;var _0x326380=_0x2032[_0x49405a];return _0x326380;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2203('0x0'))['db'][_0x2203('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2203('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2203('0x3'),'afterDestroy':_0x2203('0x4')};function emitEvent(_0x4b4c7f){return function(_0x46c49a,_0x880dcd,_0x44ccfd){ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f+':'+_0x46c49a['id'],_0x46c49a);ChatGroupEvents[_0x2203('0x5')](_0x4b4c7f,_0x46c49a);_0x44ccfd(null);};}for(var e in events){if(events[_0x2203('0x6')](e)){var event=events[e];ChatGroup[_0x2203('0x7')](e,emitEvent(event));}}module[_0x2203('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 7125e60..6bf2fc9 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 _0x20d7=['rimraf','../../config/environment','ChatGroup','chat_groups','../../config/logger','api','moment'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0x20d7,0x146));var _0x720d=function(_0x562fb6,_0x454b7e){_0x562fb6=_0x562fb6-0x0;var _0x923e60=_0x20d7[_0x562fb6];return _0x923e60;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x720d('0x0'))(_0x720d('0x1'));var moment=require(_0x720d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x720d('0x3'));var config=require(_0x720d('0x4'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x5904d8,_0x23379b){return _0x5904d8['define'](_0x720d('0x5'),attributes,{'tableName':_0x720d('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3379=['exports','ChatGroup','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./chatGroup.attributes'];(function(_0x3ebcf5,_0x2888e6){var _0x516214=function(_0x295256){while(--_0x295256){_0x3ebcf5['push'](_0x3ebcf5['shift']());}};_0x516214(++_0x2888e6);}(_0x3379,0x115));var _0x9337=function(_0x20f8dc,_0x20b2e6){_0x20f8dc=_0x20f8dc-0x0;var _0x597902=_0x3379[_0x20f8dc];return _0x597902;};'use strict';var _=require(_0x9337('0x0'));var util=require(_0x9337('0x1'));var logger=require(_0x9337('0x2'))(_0x9337('0x3'));var moment=require('moment');var BPromise=require(_0x9337('0x4'));var rp=require(_0x9337('0x5'));var fs=require('fs');var path=require(_0x9337('0x6'));var rimraf=require(_0x9337('0x7'));var config=require('../../config/environment');var attributes=require(_0x9337('0x8'));module[_0x9337('0x9')]=function(_0x390772,_0x677c38){return _0x390772['define'](_0x9337('0xa'),attributes,{'tableName':'chat_groups','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 cecdf47..601e8dc 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 _0xcc37=['socket.io-emitter','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults'];(function(_0x3de38d,_0x19fc4b){var _0x5c0c1d=function(_0x19da4c){while(--_0x19da4c){_0x3de38d['push'](_0x3de38d['shift']());}};_0x5c0c1d(++_0x19fc4b);}(_0xcc37,0x1ec));var _0x7cc3=function(_0x237dff,_0xa01488){_0x237dff=_0x237dff-0x0;var _0x5b60f4=_0xcc37[_0x237dff];return _0x5b60f4;};'use strict';var _=require(_0x7cc3('0x0'));var util=require(_0x7cc3('0x1'));var moment=require(_0x7cc3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cc3('0x3'))['db'];var utils=require(_0x7cc3('0x4'));var logger=require(_0x7cc3('0x5'))(_0x7cc3('0x6'));var config=require(_0x7cc3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7cc3('0x8')][_0x7cc3('0x9')]({'port':0x232a});config[_0x7cc3('0xa')]=_[_0x7cc3('0xb')](config[_0x7cc3('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7cc3('0xc'))(new Redis(config[_0x7cc3('0xa')]));require(_0x7cc3('0xd'))[_0x7cc3('0xe')](socket);function respondWithRpcPromise(_0x4d52d2,_0x594672,_0x4c6e53){return new BPromise(function(_0xa7c5d4,_0x4b7e40){return client[_0x7cc3('0xf')](_0x4d52d2,_0x4c6e53)[_0x7cc3('0x10')](function(_0x25ce91){logger['info'](_0x7cc3('0x11'),_0x594672,_0x7cc3('0x12'));logger[_0x7cc3('0x13')](_0x7cc3('0x14'),_0x594672,_0x7cc3('0x12'),JSON[_0x7cc3('0x15')](_0x25ce91));if(_0x25ce91[_0x7cc3('0x16')]){if(_0x25ce91['error'][_0x7cc3('0x17')]===0x1f4){logger[_0x7cc3('0x16')](_0x7cc3('0x11'),_0x594672,_0x25ce91[_0x7cc3('0x16')][_0x7cc3('0x18')]);return _0x4b7e40(_0x25ce91[_0x7cc3('0x16')][_0x7cc3('0x18')]);}logger[_0x7cc3('0x16')](_0x7cc3('0x11'),_0x594672,_0x25ce91[_0x7cc3('0x16')][_0x7cc3('0x18')]);return _0xa7c5d4(_0x25ce91[_0x7cc3('0x16')][_0x7cc3('0x18')]);}else{logger[_0x7cc3('0x19')](_0x7cc3('0x11'),_0x594672,'request\x20sent');_0xa7c5d4(_0x25ce91[_0x7cc3('0x1a')][_0x7cc3('0x18')]);}})[_0x7cc3('0x1b')](function(_0x2d73e0){logger[_0x7cc3('0x16')]('ChatGroup,\x20%s,\x20%s',_0x594672,_0x2d73e0);_0x4b7e40(_0x2d73e0);});});} \ No newline at end of file +var _0xf974=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatGroup.socket','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x172c68,_0x18c24e){var _0x1e002d=function(_0x3a0bb5){while(--_0x3a0bb5){_0x172c68['push'](_0x172c68['shift']());}};_0x1e002d(++_0x18c24e);}(_0xf974,0xe4));var _0x4f97=function(_0x1477c9,_0x280ad1){_0x1477c9=_0x1477c9-0x0;var _0x44e973=_0xf974[_0x1477c9];return _0x44e973;};'use strict';var _=require(_0x4f97('0x0'));var util=require(_0x4f97('0x1'));var moment=require(_0x4f97('0x2'));var BPromise=require(_0x4f97('0x3'));var rs=require(_0x4f97('0x4'));var fs=require('fs');var Redis=require(_0x4f97('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f97('0x6'));var logger=require('../../config/logger')(_0x4f97('0x7'));var config=require(_0x4f97('0x8'));var jayson=require(_0x4f97('0x9'));var client=jayson[_0x4f97('0xa')][_0x4f97('0xb')]({'port':0x232a});config['redis']=_[_0x4f97('0xc')](config[_0x4f97('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f97('0xe'))(new Redis(config[_0x4f97('0xd')]));require(_0x4f97('0xf'))[_0x4f97('0x10')](socket);function respondWithRpcPromise(_0x52ccdb,_0x11ce11,_0x1a5b7e){return new BPromise(function(_0x37ab9d,_0x52132f){return client['request'](_0x52ccdb,_0x1a5b7e)[_0x4f97('0x11')](function(_0x3168bf){logger[_0x4f97('0x12')](_0x4f97('0x13'),_0x11ce11,_0x4f97('0x14'));logger[_0x4f97('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x11ce11,'request\x20sent',JSON['stringify'](_0x3168bf));if(_0x3168bf['error']){if(_0x3168bf[_0x4f97('0x16')][_0x4f97('0x17')]===0x1f4){logger[_0x4f97('0x16')](_0x4f97('0x13'),_0x11ce11,_0x3168bf['error'][_0x4f97('0x18')]);return _0x52132f(_0x3168bf[_0x4f97('0x16')][_0x4f97('0x18')]);}logger['error'](_0x4f97('0x13'),_0x11ce11,_0x3168bf['error'][_0x4f97('0x18')]);return _0x37ab9d(_0x3168bf['error']['message']);}else{logger['info'](_0x4f97('0x13'),_0x11ce11,_0x4f97('0x14'));_0x37ab9d(_0x3168bf['result']['message']);}})[_0x4f97('0x19')](function(_0x2369c8){logger[_0x4f97('0x16')](_0x4f97('0x13'),_0x11ce11,_0x2369c8);_0x52132f(_0x2369c8);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 59a70a6..391bb1d 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 _0x20a7=['removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','update','emit'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x20a7,0x13f));var _0x720a=function(_0x437182,_0x2c782b){_0x437182=_0x437182-0x0;var _0x5ada93=_0x20a7[_0x437182];return _0x5ada93;};'use strict';var ChatGroupEvents=require(_0x720a('0x0'));var events=[_0x720a('0x1'),_0x720a('0x2'),_0x720a('0x3')];function createListener(_0xd4451a,_0x2b323e){return function(_0x281879){_0x2b323e[_0x720a('0x4')](_0xd4451a,_0x281879);};}function removeListener(_0x33d34f,_0x1e74a7){return function(){ChatGroupEvents[_0x720a('0x5')](_0x33d34f,_0x1e74a7);};}exports[_0x720a('0x6')]=function(_0x17e8ef){for(var _0x4ec1ae=0x0,_0x5895b2=events[_0x720a('0x7')];_0x4ec1ae<_0x5895b2;_0x4ec1ae++){var _0x2f1adc=events[_0x4ec1ae];var _0x481120=createListener(_0x720a('0x8')+_0x2f1adc,_0x17e8ef);ChatGroupEvents['on'](_0x2f1adc,_0x481120);}}; \ No newline at end of file +var _0x7479=['register','chatGroup:','./chatGroup.events','save','remove','update','removeListener'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x7479,0x18a));var _0x9747=function(_0x4b3409,_0x5169d6){_0x4b3409=_0x4b3409-0x0;var _0x558200=_0x7479[_0x4b3409];return _0x558200;};'use strict';var ChatGroupEvents=require(_0x9747('0x0'));var events=[_0x9747('0x1'),_0x9747('0x2'),_0x9747('0x3')];function createListener(_0x50ac09,_0x3f6ea0){return function(_0x4749d1){_0x3f6ea0['emit'](_0x50ac09,_0x4749d1);};}function removeListener(_0x5be184,_0x2f10eb){return function(){ChatGroupEvents[_0x9747('0x4')](_0x5be184,_0x2f10eb);};}exports[_0x9747('0x5')]=function(_0x1f8942){for(var _0x19e410=0x0,_0x572bdb=events['length'];_0x19e410<_0x572bdb;_0x19e410++){var _0x2a4c1b=events[_0x19e410];var _0x2673ea=createListener(_0x9747('0x6')+_0x2a4c1b,_0x1f8942);ChatGroupEvents['on'](_0x2a4c1b,_0x2673ea);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 65e1e48..8cb5597 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 _0x6c49=['getMembers','getMessages','post','create','addMembers','addMessage','put','/:id','delete','destroy','removeMembers','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','isAuthenticated','index','get','/describe','show','getUnread','/:id/members'];(function(_0x5908c2,_0x23d6ef){var _0x1a09fa=function(_0x8ea4ff){while(--_0x8ea4ff){_0x5908c2['push'](_0x5908c2['shift']());}};_0x1a09fa(++_0x23d6ef);}(_0x6c49,0x144));var _0x96c4=function(_0x52bce4,_0x8c2808){_0x52bce4=_0x52bce4-0x0;var _0xe785e6=_0x6c49[_0x52bce4];return _0xe785e6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x96c4('0x0'));var express=require('express');var router=express[_0x96c4('0x1')]();var auth=require(_0x96c4('0x2'));var interaction=require(_0x96c4('0x3'));var config=require('../../config/environment');var controller=require(_0x96c4('0x4'));router['get']('/',auth[_0x96c4('0x5')](),controller[_0x96c4('0x6')]);router[_0x96c4('0x7')](_0x96c4('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x96c4('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x96c4('0x9')]);router['get']('/:id/unread',auth[_0x96c4('0x5')](),controller[_0x96c4('0xa')]);router[_0x96c4('0x7')](_0x96c4('0xb'),auth[_0x96c4('0x5')](),controller[_0x96c4('0xc')]);router[_0x96c4('0x7')]('/:id/messages',auth[_0x96c4('0x5')](),controller[_0x96c4('0xd')]);router[_0x96c4('0xe')]('/',auth[_0x96c4('0x5')](),controller[_0x96c4('0xf')]);router[_0x96c4('0xe')](_0x96c4('0xb'),auth[_0x96c4('0x5')](),controller[_0x96c4('0x10')]);router['post']('/:id/messages',auth[_0x96c4('0x5')](),controller[_0x96c4('0x11')]);router[_0x96c4('0x12')](_0x96c4('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x96c4('0x14')](_0x96c4('0x13'),auth[_0x96c4('0x5')](),controller[_0x96c4('0x15')]);router[_0x96c4('0x14')](_0x96c4('0xb'),auth[_0x96c4('0x5')](),controller[_0x96c4('0x16')]);module[_0x96c4('0x17')]=router; \ No newline at end of file +var _0xc2dc=['show','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','get','/:id'];(function(_0x3fdc4c,_0x42ec50){var _0x206e98=function(_0x57404f){while(--_0x57404f){_0x3fdc4c['push'](_0x3fdc4c['shift']());}};_0x206e98(++_0x42ec50);}(_0xc2dc,0xf0));var _0xcc2d=function(_0x7fd9e9,_0x1765d0){_0x7fd9e9=_0x7fd9e9-0x0;var _0x285d92=_0xc2dc[_0x7fd9e9];return _0x285d92;};'use strict';var multer=require(_0xcc2d('0x0'));var util=require('util');var path=require(_0xcc2d('0x1'));var timeout=require(_0xcc2d('0x2'));var express=require(_0xcc2d('0x3'));var router=express[_0xcc2d('0x4')]();var auth=require(_0xcc2d('0x5'));var interaction=require(_0xcc2d('0x6'));var config=require(_0xcc2d('0x7'));var controller=require(_0xcc2d('0x8'));router['get']('/',auth[_0xcc2d('0x9')](),controller['index']);router[_0xcc2d('0xa')]('/describe',auth[_0xcc2d('0x9')](),controller['describe']);router[_0xcc2d('0xa')](_0xcc2d('0xb'),auth[_0xcc2d('0x9')](),controller[_0xcc2d('0xc')]);router[_0xcc2d('0xa')]('/:id/unread',auth[_0xcc2d('0x9')](),controller[_0xcc2d('0xd')]);router[_0xcc2d('0xa')](_0xcc2d('0xe'),auth['isAuthenticated'](),controller[_0xcc2d('0xf')]);router['get'](_0xcc2d('0x10'),auth[_0xcc2d('0x9')](),controller[_0xcc2d('0x11')]);router[_0xcc2d('0x12')]('/',auth[_0xcc2d('0x9')](),controller[_0xcc2d('0x13')]);router[_0xcc2d('0x12')](_0xcc2d('0xe'),auth[_0xcc2d('0x9')](),controller[_0xcc2d('0x14')]);router[_0xcc2d('0x12')](_0xcc2d('0x10'),auth[_0xcc2d('0x9')](),controller[_0xcc2d('0x15')]);router[_0xcc2d('0x16')](_0xcc2d('0xb'),auth['isAuthenticated'](),controller[_0xcc2d('0x17')]);router[_0xcc2d('0x18')](_0xcc2d('0xb'),auth[_0xcc2d('0x9')](),controller[_0xcc2d('0x19')]);router[_0xcc2d('0x18')](_0xcc2d('0xe'),auth[_0xcc2d('0x9')](),controller[_0xcc2d('0x1a')]);module[_0xcc2d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index ea4778a..8acbdf7 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 _0x6fe5=['STRING','DATE','exports','BOOLEAN','INTEGER','ENUM','star','TEXT'];(function(_0x514bd1,_0x25ea3e){var _0x58a281=function(_0x25567a){while(--_0x25567a){_0x514bd1['push'](_0x514bd1['shift']());}};_0x58a281(++_0x25ea3e);}(_0x6fe5,0x1c2));var _0x56fe=function(_0x558cc8,_0x6aa803){_0x558cc8=_0x558cc8-0x0;var _0x144c0f=_0x6fe5[_0x558cc8];return _0x144c0f;};'use strict';var Sequelize=require('sequelize');module[_0x56fe('0x0')]={'closed':{'type':Sequelize[_0x56fe('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x56fe('0x2')]},'ratingType':{'type':Sequelize[_0x56fe('0x3')](_0x56fe('0x4'),'thumb'),'defaultValue':_0x56fe('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x56fe('0x5')]},'mailTranscript':{'type':Sequelize[_0x56fe('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x56fe('0x6')]},'note':{'type':Sequelize[_0x56fe('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x56fe('0x6')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x56fe('0x6')]},'deviceModel':{'type':Sequelize[_0x56fe('0x6')]},'deviceVendor':{'type':Sequelize[_0x56fe('0x6')]},'deviceType':{'type':Sequelize[_0x56fe('0x6')]},'referer':{'type':Sequelize[_0x56fe('0x5')]},'customerIp':{'type':Sequelize[_0x56fe('0x6')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x56fe('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x56fe('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x56fe('0x6')]},'customerPort':{'type':Sequelize[_0x56fe('0x6')]}}; \ No newline at end of file +var _0x3f2e=['TEXT','STRING','DATE','long','sequelize','BOOLEAN','INTEGER','ENUM','thumb','star'];(function(_0xfbf2d3,_0xb18179){var _0x5587aa=function(_0x2cc58b){while(--_0x2cc58b){_0xfbf2d3['push'](_0xfbf2d3['shift']());}};_0x5587aa(++_0xb18179);}(_0x3f2e,0x1da));var _0xe3f2=function(_0x3d118a,_0xc2c0d7){_0x3d118a=_0x3d118a-0x0;var _0xbdfbf3=_0x3f2e[_0x3d118a];return _0xbdfbf3;};'use strict';var Sequelize=require(_0xe3f2('0x0'));module['exports']={'closed':{'type':Sequelize[_0xe3f2('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xe3f2('0x2')]},'ratingType':{'type':Sequelize[_0xe3f2('0x3')]('star',_0xe3f2('0x4')),'defaultValue':_0xe3f2('0x5')},'ratingMessage':{'type':Sequelize[_0xe3f2('0x6')]},'pathTranscript':{'type':Sequelize[_0xe3f2('0x6')]},'mailTranscript':{'type':Sequelize[_0xe3f2('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xe3f2('0x8')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe3f2('0x7')]},'browserName':{'type':Sequelize[_0xe3f2('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xe3f2('0x7')]},'osVersion':{'type':Sequelize[_0xe3f2('0x7')]},'deviceModel':{'type':Sequelize[_0xe3f2('0x7')]},'deviceVendor':{'type':Sequelize[_0xe3f2('0x7')]},'deviceType':{'type':Sequelize[_0xe3f2('0x7')]},'referer':{'type':Sequelize[_0xe3f2('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xe3f2('0x6')](_0xe3f2('0x9'))},'read1stAt':{'type':Sequelize[_0xe3f2('0x8')]},'lastMsgAt':{'type':Sequelize[_0xe3f2('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xe3f2('0x7')]},'customerPort':{'type':Sequelize[_0xe3f2('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 7c22f19..8ae0a28 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 _0xeff8=['root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','User','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','options','findAll','getMyMessages','include','includeAgent','spread','emit','chatInteractionTags:save','removeTags','join','server','tmp','files','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','ChatWebsite','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','json','count','offset','limit','set','Content-Range','apply','destroy','status','end','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','rawAttributes','fieldName','type','model','query','filters','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','value','having','`\x20=\x200','Contact','$substring','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','text','keys','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','journey','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','attributes','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','params','includeAll','ChatInteraction','create','update','describe','abandon','entity\x20not\x20found','ValidationError','closed','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','Attachment','attachmentDownload','findOne','attachId','download'];(function(_0x3b8dd9,_0x9d3b7c){var _0x11de4b=function(_0x3d13bf){while(--_0x3d13bf){_0x3b8dd9['push'](_0x3b8dd9['shift']());}};_0x11de4b(++_0x9d3b7c);}(_0xeff8,0x186));var _0x8eff=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0xeff8[_0x424501];return _0xb719af;};'use strict';var pdf=require(_0x8eff('0x0'));var emlformat=require(_0x8eff('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8eff('0x2'));var jsonpatch=require(_0x8eff('0x3'));var rp=require(_0x8eff('0x4'));var moment=require('moment');var BPromise=require(_0x8eff('0x5'));var Mustache=require(_0x8eff('0x6'));var util=require(_0x8eff('0x7'));var path=require(_0x8eff('0x8'));var sox=require('sox');var csv=require(_0x8eff('0x9'));var ejs=require(_0x8eff('0xa'));var fs=require('fs');var _=require(_0x8eff('0xb'));var squel=require(_0x8eff('0xc'));var crypto=require('crypto');var jsforce=require(_0x8eff('0xd'));var deskjs=require(_0x8eff('0xe'));var toCsv=require(_0x8eff('0x9'));var querystring=require(_0x8eff('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8eff('0x10'));var qs=require(_0x8eff('0x11'));var as=require(_0x8eff('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8eff('0x13'))(_0x8eff('0x14'));var utils=require('../../config/utils');var config=require(_0x8eff('0x15'));var db=require(_0x8eff('0x16'))['db'];config['redis']=_['defaults'](config[_0x8eff('0x17')],{'host':_0x8eff('0x18'),'port':0x18eb});var socket=require(_0x8eff('0x19'))(new Redis(config[_0x8eff('0x17')]));require(_0x8eff('0x1a'))['register'](socket);var jayson=require(_0x8eff('0x1b'));var client=jayson[_0x8eff('0x1c')][_0x8eff('0x1d')]({'port':0x232b});var client9004=jayson[_0x8eff('0x1c')][_0x8eff('0x1d')]({'port':0x232c});function checkPasswordPattern(_0x4cfc91,_0x16202e,_0xdbb753){if(_0xdbb753){var _0x16a4eb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16a4eb[_0x8eff('0x1e')](_0x16202e)){return _0x4cfc91;}else{throw new db[(_0x8eff('0x1f'))]['ValidationError'](_0x8eff('0x20'));}}else{return _0x4cfc91;}}function respondWithRpcPromise(_0x38fb15,_0x3cd1dc,_0x20ec2a,_0x2cd7c5){return new BPromise(function(_0x3c800b,_0x38f5ee){var _0x399d96=_0x2cd7c5||client;return _0x399d96[_0x8eff('0x21')](_0x38fb15,_0x20ec2a)[_0x8eff('0x22')](function(_0x453c7a){logger[_0x8eff('0x23')](_0x8eff('0x24'),_0x3cd1dc,_0x8eff('0x25'));logger[_0x8eff('0x26')](_0x8eff('0x27'),_0x3cd1dc,'request\x20sent',JSON[_0x8eff('0x28')](_0x453c7a));if(_0x453c7a[_0x8eff('0x29')]){if(_0x453c7a['error'][_0x8eff('0x2a')]===0x1f4){logger['error'](_0x8eff('0x24'),_0x3cd1dc,_0x453c7a[_0x8eff('0x29')][_0x8eff('0x2b')]);return _0x38f5ee(_0x453c7a[_0x8eff('0x29')][_0x8eff('0x2b')]);}logger['error'](_0x8eff('0x24'),_0x3cd1dc,_0x453c7a[_0x8eff('0x29')]['message']);return _0x3c800b(_0x453c7a[_0x8eff('0x29')][_0x8eff('0x2b')]);}else{logger[_0x8eff('0x23')](_0x8eff('0x24'),_0x3cd1dc,_0x8eff('0x25'));_0x3c800b(_0x453c7a[_0x8eff('0x2c')][_0x8eff('0x2b')]);}})[_0x8eff('0x2d')](function(_0x516173){logger[_0x8eff('0x29')](_0x8eff('0x24'),_0x3cd1dc,_0x516173);_0x38f5ee(_0x516173);});});}function respondWithStatusCode(_0x15083c,_0xb88ce9){_0xb88ce9=_0xb88ce9||0xcc;return function(_0x45803c){if(_0x45803c){return _0x15083c[_0x8eff('0x2e')](_0xb88ce9);}return _0x15083c['status'](_0xb88ce9)['end']();};}function respondWithResult(_0x44dcdb,_0x472b19){_0x472b19=_0x472b19||0xc8;return function(_0x17ff3f){if(_0x17ff3f){return _0x44dcdb['status'](_0x472b19)[_0x8eff('0x2f')](_0x17ff3f);}};}function respondWithFilteredResult(_0x2f8ad9,_0x229e0d){return function(_0x1da0fa){if(_0x1da0fa){var _0x25b98e=_0x1da0fa[_0x8eff('0x30')],_0x2c5727=_0x229e0d[_0x8eff('0x31')],_0x141bd7=_0x229e0d[_0x8eff('0x31')]+_0x229e0d[_0x8eff('0x32')],_0x1c6efa;if(_0x141bd7>=_0x25b98e){_0x141bd7=_0x25b98e;_0x1c6efa=0xc8;}else{_0x1c6efa=0xce;}_0x2f8ad9['status'](_0x1c6efa);return _0x2f8ad9[_0x8eff('0x33')](_0x8eff('0x34'),_0x2c5727+'-'+_0x141bd7+'/'+_0x25b98e)[_0x8eff('0x2f')](_0x1da0fa);}return null;};}function patchUpdates(_0x7da1fb){return function(_0x50f211){try{jsonpatch[_0x8eff('0x35')](_0x50f211,_0x7da1fb,!![]);}catch(_0x32fd3c){return BPromise['reject'](_0x32fd3c);}return _0x50f211['save']();};}function saveUpdates(_0x40ed09,_0x271d64){return function(_0x565b83){if(_0x565b83){return _0x565b83['update'](_0x40ed09)['then'](function(_0x315691){return _0x315691;});}return null;};}function removeEntity(_0x5f5b79,_0x45d9d4){return function(_0x59c9cc){if(_0x59c9cc){return _0x59c9cc[_0x8eff('0x36')]()[_0x8eff('0x22')](function(){_0x5f5b79[_0x8eff('0x37')](0xcc)[_0x8eff('0x38')]();});}};}function handleEntityNotFound(_0x3e53a2,_0x37e474){return function(_0x5ed3f3){if(!_0x5ed3f3){_0x3e53a2[_0x8eff('0x2e')](0x194);}return _0x5ed3f3;};}function handleError(_0x5907e0,_0xba48d8){_0xba48d8=_0xba48d8||0x1f4;return function(_0x5beed4){logger[_0x8eff('0x29')](_0x5beed4[_0x8eff('0x39')]);if(_0x5beed4[_0x8eff('0x3a')]){delete _0x5beed4[_0x8eff('0x3a')];}_0x5907e0['status'](_0xba48d8)[_0x8eff('0x3b')](_0x5beed4);};}function getInteractionUsers(_0x170a33,_0x18c42c){return new BPromise(function(_0x5360b7,_0x475213){try{if(_0x18c42c[_0x170a33['id']]){_0x170a33[_0x8eff('0x3c')]=_[_0x8eff('0x3d')](_0x18c42c[_0x170a33['id']],function(_0x345bc7){return{'id':_0x345bc7['id'],'fullname':_0x345bc7[_0x8eff('0x3e')]};});}}catch(_0xd2a915){_0x475213(_0xd2a915);}_0x5360b7(_0x170a33);});}function getInteractionTags(_0x29f68e,_0x26da7a){return new BPromise(function(_0x661c36,_0x5c1277){try{if(_0x29f68e['TagIds']){_0x29f68e[_0x8eff('0x3f')]=[];_0x29f68e[_0x8eff('0x40')][_0x8eff('0x41')](',')[_0x8eff('0x42')](function(_0x429c31){_0x29f68e[_0x8eff('0x3f')][_0x8eff('0x43')](_0x26da7a[_0x429c31]);});}delete _0x29f68e['TagIds'];}catch(_0x14cf6e){_0x5c1277(_0x14cf6e);}_0x661c36(_0x29f68e);});}function updateChatInteraction(_0x1c7332,_0x478e09,_0x411a1c){return new BPromise(function(_0x1ad6b3,_0x241b33){return getInteractionUsers(_0x1c7332,_0x411a1c)[_0x8eff('0x22')](function(_0xdc5e2f){return getInteractionTags(_0xdc5e2f,_0x478e09);})[_0x8eff('0x22')](function(_0x194195){_0x1ad6b3(_0x194195);})[_0x8eff('0x2d')](function(_0x6d0568){_0x241b33(_0x6d0568);});});}exports['index']=function(_0x37f376,_0x27a8c9){var _0x3f8a85={},_0x2fa131={},_0x1a5460={'count':0x0,'rows':[]};var _0x55d15c=_[_0x8eff('0x3d')](db['ChatInteraction'][_0x8eff('0x44')],function(_0x42b444){return{'name':_0x42b444[_0x8eff('0x45')],'type':_0x42b444[_0x8eff('0x46')]['key']};});_0x2fa131[_0x8eff('0x47')]=_[_0x8eff('0x3d')](_0x55d15c,_0x8eff('0x3a'));_0x2fa131['query']=_['keys'](_0x37f376[_0x8eff('0x48')]);_0x2fa131[_0x8eff('0x49')]=_[_0x8eff('0x4a')](_0x2fa131[_0x8eff('0x47')],_0x2fa131[_0x8eff('0x48')]);_0x3f8a85['attributes']=_[_0x8eff('0x4a')](_0x2fa131['model'],qs[_0x8eff('0x4b')](_0x37f376[_0x8eff('0x48')]['fields']));_0x3f8a85['attributes']=_0x3f8a85['attributes']['length']?_0x3f8a85['attributes']:_0x2fa131['model'];if(!_0x37f376[_0x8eff('0x48')][_0x8eff('0x4c')](_0x8eff('0x4d'))){_0x3f8a85[_0x8eff('0x32')]=qs[_0x8eff('0x32')](_0x37f376[_0x8eff('0x48')][_0x8eff('0x32')]);_0x3f8a85[_0x8eff('0x31')]=qs[_0x8eff('0x31')](_0x37f376[_0x8eff('0x48')]['offset']);}_0x3f8a85[_0x8eff('0x4e')]=qs['sort'](_0x37f376[_0x8eff('0x48')][_0x8eff('0x4f')]);_0x3f8a85[_0x8eff('0x50')]=qs[_0x8eff('0x49')](_[_0x8eff('0x51')](_0x37f376[_0x8eff('0x48')],_0x2fa131[_0x8eff('0x49')]));var _0x3a4c31=[];var _0x16078f=squel[_0x8eff('0x52')]()[_0x8eff('0x53')]('id')[_0x8eff('0x53')]('name')[_0x8eff('0x53')](_0x8eff('0x54'))[_0x8eff('0x55')](_0x8eff('0x56'));var _0x3de247=squel[_0x8eff('0x52')]()[_0x8eff('0x53')](_0x8eff('0x57'))[_0x8eff('0x53')]('u.fullname')['field'](_0x8eff('0x58'))[_0x8eff('0x55')](_0x8eff('0x59'),'ui')[_0x8eff('0x5a')](_0x8eff('0x5b'),'u',_0x8eff('0x5c'));var _0x4b92ae=squel[_0x8eff('0x52')]()[_0x8eff('0x55')](_0x8eff('0x5d'),'i')['left_join'](_0x8eff('0x5e'),'c',_0x8eff('0x5f'))[_0x8eff('0x5a')](_0x8eff('0x5b'),'o','o.id\x20=\x20i.UserId')[_0x8eff('0x5a')](_0x8eff('0x60'),'a',_0x8eff('0x61'))[_0x8eff('0x5a')](_0x8eff('0x62'),'me',_0x8eff('0x63'))[_0x8eff('0x5a')]('chat_interaction_has_tags','it',_0x8eff('0x64'))[_0x8eff('0x5a')](_0x8eff('0x56'),'t',_0x8eff('0x65'));var _0x2079f6=squel['expr']();var _0x13c2e6=[];var _0x16b968=squel[_0x8eff('0x66')]();var _0x4b05b3;if(_0x37f376[_0x8eff('0x48')]['search']){_0x4b05b3=as[_0x8eff('0x67')](_0x37f376[_0x8eff('0x48')][_0x8eff('0x68')]);var _0xfecdd8=_0x4b05b3[_0x8eff('0x69')];for(var _0xa6355e=0x0;_0xa6355e<_0x4b05b3[_0x8eff('0x6a')]['length'];_0xa6355e++){var _0x48a414=_0x4b05b3[_0x8eff('0x6a')][_0xa6355e];var _0x4cf5db='i';var _0x3bfeac=_[_0x8eff('0x6b')](_0x55d15c,[_0x8eff('0x3a'),_0x48a414[_0x8eff('0x53')]]);if(!_0x3bfeac){switch(_0x48a414[_0x8eff('0x53')]){case'unreadMessages':if(_0x48a414[_0x8eff('0x6c')]==0x1){_0x4b92ae[_0x8eff('0x6d')]('`'+_0x48a414[_0x8eff('0x53')]+_0x8eff('0x6e'));}else{_0x4b92ae[_0x8eff('0x6d')]('`'+_0x48a414[_0x8eff('0x53')]+'`\x20>\x200');}break;case _0x8eff('0x6f'):if(_0x48a414['operator']===_0x8eff('0x70')){if(_0x48a414[_0x8eff('0x6c')]['split']('\x20')[_0x8eff('0x71')]>0x1){_0x2079f6[_0xfecdd8](_0x8eff('0x72'),qs[_0x8eff('0x73')](_0x48a414[_0x8eff('0x6c')]),null);}else{var _0x26ce78='%'+_0x48a414[_0x8eff('0x6c')]+'%';_0x2079f6[_0xfecdd8](_0x8eff('0x74'),_0x26ce78,_0x26ce78,_0x26ce78);}}else{_0x3bfeac=_[_0x8eff('0x6b')](_0x55d15c,['name',_0x8eff('0x75')]);_0x48a414['field']='ContactId';_0x5492df=as[_0x8eff('0x76')](_0x4cf5db,_0x3bfeac[_0x8eff('0x46')],_0x48a414);_0x2079f6[_0xfecdd8](_0x5492df['text'],_0x5492df[_0x8eff('0x6c')][_0x8eff('0x77')],_0x5492df['value'][_0x8eff('0x38')]);}break;case _0x8eff('0x78'):var _0x56c996=_0x48a414[_0x8eff('0x6c')][_0x8eff('0x41')](',')[_0x8eff('0x3d')](function(_0x29390c){return Number(_0x29390c);});_0x56c996[_0x8eff('0x42')](function(_0x41e395){_0x16b968['or'](_0x8eff('0x79'),'%,'+_0x41e395+',%');});_0x13c2e6=_['union'](_0x13c2e6,_0x56c996);break;case'User':if(_0x48a414[_0x8eff('0x7a')]===_0x8eff('0x70')){_0x2079f6[_0xfecdd8](_0x8eff('0x7b'),'%'+_0x48a414[_0x8eff('0x6c')]+'%',null);}else{_0x3bfeac=_[_0x8eff('0x6b')](_0x55d15c,[_0x8eff('0x3a'),_0x8eff('0x7c')]);_0x48a414['field']='UserId';_0x5492df=as[_0x8eff('0x76')](_0x4cf5db,_0x3bfeac['type'],_0x48a414);_0x2079f6[_0xfecdd8](_0x5492df['text'],_0x5492df['value'][_0x8eff('0x77')],_0x5492df[_0x8eff('0x6c')][_0x8eff('0x38')]);}break;case _0x8eff('0x7d'):_0x5492df=as[_0x8eff('0x76')]('me',null,_0x48a414);_0x2079f6[_0xfecdd8](_0x5492df[_0x8eff('0x7e')],_0x5492df[_0x8eff('0x6c')][_0x8eff('0x77')],_0x5492df['value'][_0x8eff('0x38')]);break;}}else{var _0x5492df=as[_0x8eff('0x76')](_0x4cf5db,_0x3bfeac[_0x8eff('0x46')],_0x48a414);_0x2079f6[_0xfecdd8](_0x5492df[_0x8eff('0x7e')],_0x5492df[_0x8eff('0x6c')][_0x8eff('0x77')],_0x5492df[_0x8eff('0x6c')]['end']);}}}else{var _0x3db0d8=_(_0x37f376['query'])[_0x8eff('0x7f')]()[_0x8eff('0x3d')](function(_0x3057f7){return _[_0x8eff('0x80')](_0x55d15c,[_0x8eff('0x3a'),_0x3057f7])?_0x3057f7:undefined;})[_0x8eff('0x81')]()[_0x8eff('0x6c')]();if(!_[_0x8eff('0x82')](_0x3db0d8)){_0x3db0d8[_0x8eff('0x42')](function(_0x592ae5){if(_0x592ae5===_0x8eff('0x83')){_0x4b92ae[_0x8eff('0x50')](_0x8eff('0x84'),[][_0x8eff('0x85')](_0x37f376[_0x8eff('0x48')][_0x592ae5]));}else if(_0x592ae5===_0x8eff('0x86')){var _0x22d462=JSON[_0x8eff('0x87')](_0x37f376[_0x8eff('0x48')][_0x592ae5])[_0x8eff('0x88')];var _0x4ef11d=JSON['parse'](_0x37f376['query'][_0x592ae5])['$lte'];_0x4b92ae[_0x8eff('0x50')](_0x8eff('0x89'),_0x22d462,_0x4ef11d);}else{if(_0x37f376[_0x8eff('0x48')][_0x592ae5]===_0x8eff('0x8a')){_0x4b92ae[_0x8eff('0x50')]('i.'+_0x592ae5+_0x8eff('0x8b'));}else{_0x4b92ae[_0x8eff('0x50')]('i.'+_0x592ae5+'\x20=\x20?',_0x37f376[_0x8eff('0x48')][_0x592ae5]);}}});}if(_0x37f376[_0x8eff('0x48')][_0x8eff('0x8c')]){if(_0x37f376[_0x8eff('0x48')]['read']==0x1){_0x4b92ae[_0x8eff('0x6d')](_0x8eff('0x8d'));}else{_0x4b92ae['having'](_0x8eff('0x8e'));}}if(_0x37f376[_0x8eff('0x48')][_0x8eff('0x8f')]){_0x13c2e6=_['isArray'](_0x37f376['query']['tag'])?_0x37f376[_0x8eff('0x48')][_0x8eff('0x8f')]:new Array(_0x37f376[_0x8eff('0x48')][_0x8eff('0x8f')]);_0x13c2e6[_0x8eff('0x42')](function(_0x10d22d){_0x16b968['or'](_0x8eff('0x79'),'%,'+_0x10d22d+',%');});}if(_0x37f376[_0x8eff('0x48')][_0x8eff('0x90')]){var _0x103a50=_0x37f376[_0x8eff('0x48')]['filter'][_0x8eff('0x91')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x8eff('0x92'));if(qs[_0x8eff('0x93')](_0x103a50)){_0x2079f6['or']('i.id\x20LIKE\x20?',_0x103a50+'%');}else{_0x2079f6['or'](_0x8eff('0x94'),qs['getFullTextValue'](_0x103a50))['or'](_0x8eff('0x95'),_0x103a50+'%');}}}_0x4b92ae[_0x8eff('0x50')](_0x2079f6);_0x4b92ae[_0x8eff('0x96')](_0x8eff('0x97'));var _0x29e358={'type':db['Sequelize'][_0x8eff('0x98')][_0x8eff('0x99')],'raw':!![]};var _0xd5edc5=_0x4b92ae[_0x8eff('0x9a')]();_0xd5edc5[_0x8eff('0x53')](_0x8eff('0x97'));_0xd5edc5[_0x8eff('0x53')](_0x8eff('0x9b'),_0x8eff('0x9c'));if(_0x3f8a85[_0x8eff('0x4e')]){_0x3f8a85[_0x8eff('0x4e')]['forEach'](function(_0x41710c){_0x4b92ae[_0x8eff('0x4e')]('i.'+_0x41710c[0x0],_0x41710c[0x1]===_0x8eff('0x9d')?![]:!![]);});}if(!_[_0x8eff('0x82')](_0x13c2e6)){_0x4b92ae[_0x8eff('0x6d')](_0x16b968);_0xd5edc5['where'](_0x8eff('0x9e'),_0x13c2e6);}BPromise[_0x8eff('0x9f')]()['then'](function(){if(!_0x4b05b3){if(_0x37f376['query'][_0x8eff('0x83')]||_0x37f376[_0x8eff('0x48')][_0x8eff('0xa0')])return;_0xd5edc5[_0x8eff('0x50')](_0x8eff('0xa1'));_0x4b92ae[_0x8eff('0x50')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x37f376[_0x8eff('0xa2')]['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x8eff('0x22')](function(_0x262b68){if(_['isEmpty'](_0x262b68)){_0xd5edc5[_0x8eff('0x50')]('i.ChatWebsiteId\x20IS\x20NULL');_0x4b92ae['where'](_0x8eff('0xa3'));}else{_0xd5edc5['where'](_0x8eff('0x84'),_[_0x8eff('0x3d')](_0x262b68,'id'));_0x4b92ae['where'](_0x8eff('0x84'),_[_0x8eff('0x3d')](_0x262b68,'id'));}});})['then'](function(){db[_0x8eff('0xa4')][_0x8eff('0x48')](_0xd5edc5[_0x8eff('0xa5')](),_0x29e358)[_0x8eff('0x22')](function(_0x22abc5){_0x1a5460[_0x8eff('0x30')]=_0x22abc5[_0x8eff('0x71')];if(_0x1a5460[_0x8eff('0x30')]===0x0)return[];return db[_0x8eff('0xa4')]['query'](_0x16078f['toString'](),_0x29e358)['then'](function(_0x338269){_0x3a4c31=_[_0x8eff('0xa6')](_0x338269,'id');_0x29e358=_[_0x8eff('0xa7')](_0x29e358,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x37f376[_0x8eff('0x48')][_0x8eff('0x4b')]){_0x3f8a85[_0x8eff('0xa8')][_0x8eff('0x42')](function(_0x2c9646){_0x4b92ae[_0x8eff('0x53')]('i.'+_0x2c9646);});}else{_0x4b92ae['field'](_0x8eff('0x9b'),'unreadMessages');_0x4b92ae[_0x8eff('0x53')](_0x8eff('0xa9'),_0x8eff('0xaa'));_0x4b92ae[_0x8eff('0x53')](_0x8eff('0xab'),_0x8eff('0xac'));_0x4b92ae[_0x8eff('0x53')]('i.*');_0x4b92ae[_0x8eff('0x53')](_0x8eff('0xad'),_0x8eff('0xae'));_0x4b92ae[_0x8eff('0x53')](_0x8eff('0xaf'),'Contact.lastName');_0x4b92ae[_0x8eff('0x53')](_0x8eff('0xb0'),_0x8eff('0xb1'));_0x4b92ae['field']('c.phone',_0x8eff('0xb2'));_0x4b92ae[_0x8eff('0x53')](_0x8eff('0xb3'),'Contact.mobile');_0x4b92ae[_0x8eff('0x53')]('c.fax','Contact.fax');_0x4b92ae[_0x8eff('0x53')](_0x8eff('0xb4'),_0x8eff('0xb5'));_0x4b92ae[_0x8eff('0x53')](_0x8eff('0xb6'),_0x8eff('0xb7'));_0x4b92ae[_0x8eff('0x53')](_0x8eff('0xb8'),_0x8eff('0x40'));}_0x4b92ae[_0x8eff('0x32')](_0x3f8a85[_0x8eff('0x32')]);_0x4b92ae[_0x8eff('0x31')](_0x3f8a85['offset']);return db[_0x8eff('0xa4')][_0x8eff('0x48')](_0x4b92ae[_0x8eff('0xa5')](),_0x29e358);})[_0x8eff('0x22')](function(_0x134946){_0x3de247['where'](_0x8eff('0xb9'),_[_0x8eff('0x3d')](_0x134946,'id'));return db[_0x8eff('0xa4')][_0x8eff('0x48')](_0x3de247['toString'](),_0x29e358)['then'](function(_0x339451){var _0x111056=_[_0x8eff('0xba')](_0x339451,_0x8eff('0xbb'));var _0x4944af=[];_0x134946[_0x8eff('0x42')](function(_0xb283a6){_0x4944af[_0x8eff('0x43')](updateChatInteraction(_0xb283a6,_0x3a4c31,_0x111056));});return BPromise[_0x8eff('0xbc')](_0x4944af);});});})[_0x8eff('0x22')](function(_0x44e68a){_0x1a5460[_0x8eff('0xbd')]=_0x44e68a;return _0x1a5460;})[_0x8eff('0x22')](respondWithFilteredResult(_0x27a8c9,_0x3f8a85));})[_0x8eff('0x2d')](handleError(_0x27a8c9,null));};exports['show']=function(_0xe873eb,_0x54a472){var _0x22051e={'raw':![],'where':{'id':_0xe873eb[_0x8eff('0xbe')]['id']}},_0x16367d={};_0x16367d['model']=_[_0x8eff('0x7f')](db['ChatInteraction'][_0x8eff('0x44')]);_0x16367d[_0x8eff('0x48')]=_['keys'](_0xe873eb[_0x8eff('0x48')]);_0x16367d[_0x8eff('0x49')]=_[_0x8eff('0x4a')](_0x16367d[_0x8eff('0x47')],_0x16367d[_0x8eff('0x48')]);_0x22051e[_0x8eff('0xa8')]=_['intersection'](_0x16367d[_0x8eff('0x47')],qs[_0x8eff('0x4b')](_0xe873eb[_0x8eff('0x48')]['fields']));_0x22051e[_0x8eff('0xa8')]=_0x22051e[_0x8eff('0xa8')]['length']?_0x22051e[_0x8eff('0xa8')]:_0x16367d[_0x8eff('0x47')];if(_0xe873eb[_0x8eff('0x48')][_0x8eff('0xbf')]){_0x22051e['include']=[{'all':!![]}];}_0x22051e=_[_0x8eff('0xa7')]({},_0x22051e,_0xe873eb['options']);return db[_0x8eff('0xc0')][_0x8eff('0x6b')](_0x22051e)[_0x8eff('0x22')](handleEntityNotFound(_0x54a472,null))[_0x8eff('0x22')](respondWithResult(_0x54a472,null))['catch'](handleError(_0x54a472,null));};exports[_0x8eff('0xc1')]=function(_0x4d343e,_0x3e755b){return db[_0x8eff('0xc0')][_0x8eff('0xc1')](_0x4d343e[_0x8eff('0x7d')],{})[_0x8eff('0x22')](respondWithResult(_0x3e755b,0xc9))['catch'](handleError(_0x3e755b,null));};exports[_0x8eff('0xc2')]=function(_0x36712f,_0x3665ab){if(_0x36712f[_0x8eff('0x7d')]['id']){delete _0x36712f[_0x8eff('0x7d')]['id'];}return db[_0x8eff('0xc0')][_0x8eff('0x6b')]({'where':{'id':_0x36712f[_0x8eff('0xbe')]['id']}})['then'](handleEntityNotFound(_0x3665ab,null))[_0x8eff('0x22')](saveUpdates(_0x36712f[_0x8eff('0x7d')],null))['then'](respondWithResult(_0x3665ab,null))['catch'](handleError(_0x3665ab,null));};exports[_0x8eff('0x36')]=function(_0x5d9fc3,_0x534862){return db[_0x8eff('0xc0')][_0x8eff('0x6b')]({'where':{'id':_0x5d9fc3['params']['id']}})[_0x8eff('0x22')](handleEntityNotFound(_0x534862,null))[_0x8eff('0x22')](removeEntity(_0x534862,null))[_0x8eff('0x2d')](handleError(_0x534862,null));};exports['describe']=function(_0x3f5c47,_0x35be0a){return db['ChatInteraction'][_0x8eff('0xc3')]()[_0x8eff('0x22')](respondWithResult(_0x35be0a,null))[_0x8eff('0x2d')](handleError(_0x35be0a,null));};exports['customUpdate']=function(_0x5477c0,_0x52f9b2){if(_0x5477c0[_0x8eff('0x7d')]['id']){delete _0x5477c0[_0x8eff('0x7d')]['id'];}return db[_0x8eff('0xc0')][_0x8eff('0x6b')]({'where':{'id':_0x5477c0[_0x8eff('0xbe')]['id']}})[_0x8eff('0x22')](handleEntityNotFound(_0x52f9b2,null))[_0x8eff('0x22')](saveUpdates(_0x5477c0[_0x8eff('0x7d')],null))[_0x8eff('0x22')](respondWithResult(_0x52f9b2,null))[_0x8eff('0x2d')](handleError(_0x52f9b2,null));};exports[_0x8eff('0xc4')]=function(_0x4d7417,_0x56d0ed,_0x20d135){if(_0x4d7417[_0x8eff('0x7d')]['id']){delete _0x4d7417[_0x8eff('0x7d')]['id'];}return db[_0x8eff('0xc0')][_0x8eff('0x6b')]({'where':{'id':_0x4d7417[_0x8eff('0xbe')]['id']}})[_0x8eff('0x22')](function(_0x2d1c0b){if(!_0x2d1c0b){logger[_0x8eff('0x29')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x8eff('0xc4'),0x194,_0x8eff('0xc5'));_0x56d0ed[_0x8eff('0x2e')](0x194);}else{if(_0x2d1c0b[_0x8eff('0x7c')]){throw new db[(_0x8eff('0x1f'))][(_0x8eff('0xc6'))]('Interaction\x20already\x20assigned');}}return _0x2d1c0b;})['then'](function(_0x41e975){if(_0x41e975){return _0x41e975[_0x8eff('0xc2')]({'closed':_0x4d7417[_0x8eff('0x7d')][_0x8eff('0xc7')],'disposition':_0x4d7417[_0x8eff('0x7d')]['disposition']})[_0x8eff('0x22')](function(_0x4e1313){return _0x4e1313;});}})['then'](function(_0x422796){return respondWithRpcPromise(_0x8eff('0xc8'),_0x8eff('0xc4'),_0x4d7417['body'],client9004);})[_0x8eff('0x22')](respondWithResult(_0x56d0ed,null))[_0x8eff('0x2d')](handleError(_0x56d0ed,null));};exports[_0x8eff('0xc9')]=function(_0x41f188,_0x27a3be,_0x2902f0){_0x41f188['body'][_0x8eff('0x3a')]=_0x41f188['file'][_0x8eff('0xca')];_0x41f188[_0x8eff('0x7d')][_0x8eff('0xcb')]=_0x41f188[_0x8eff('0xcc')][_0x8eff('0xcd')];_0x41f188[_0x8eff('0x7d')]['type']=_0x41f188['file'][_0x8eff('0xce')];return db[_0x8eff('0xcf')][_0x8eff('0xc1')](_0x41f188[_0x8eff('0x7d')])[_0x8eff('0x22')](respondWithResult(_0x27a3be,0xc9))['catch'](handleError(_0x27a3be,null));};exports[_0x8eff('0xd0')]=function(_0x1818ff,_0x3414c1,_0x51a066){return db['ChatInteraction'][_0x8eff('0xd1')]({'where':{'id':_0x1818ff[_0x8eff('0xbe')]['id']},'raw':!![]})[_0x8eff('0x22')](handleEntityNotFound(_0x3414c1,null))[_0x8eff('0x22')](function(_0x210ae8){if(_0x210ae8){if(_0x210ae8[_0x8eff('0xc7')]){return _0x3414c1[_0x8eff('0x37')](0x193)[_0x8eff('0x2f')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x8eff('0xd1')]({'where':{'id':_0x1818ff[_0x8eff('0x48')][_0x8eff('0xd2')]},'raw':!![]})[_0x8eff('0x22')](handleEntityNotFound(_0x3414c1,null));}})[_0x8eff('0x22')](function(_0x1f62a5){if(_0x1f62a5){return _0x3414c1[_0x8eff('0xd3')](path['join'](config[_0x8eff('0xd4')],_0x8eff('0xd5'),_0x1f62a5[_0x8eff('0xcb')]));}})[_0x8eff('0x2d')](handleError(_0x3414c1,null));};exports[_0x8eff('0xd6')]=function(_0x2ed342,_0x5c64ef){var _0x51cef3=null;var _0x59b7d2=null;var _0xae8a5e=null;var _0x374b82=null;if(_0x2ed342[_0x8eff('0x7d')]['id']){delete _0x2ed342[_0x8eff('0x7d')]['id'];}if(_0x2ed342[_0x8eff('0x7d')][_0x8eff('0xd7')]){_0x374b82=path['join'](config[_0x8eff('0xd4')],_0x8eff('0xd8'),util[_0x8eff('0xd9')](_0x8eff('0xda'),Date[_0x8eff('0xdb')]()));_0x2ed342[_0x8eff('0x7d')][_0x8eff('0xdc')]=_0x374b82;}return db[_0x8eff('0xc0')][_0x8eff('0x6b')]({'where':{'id':_0x2ed342[_0x8eff('0xbe')]['id']},'include':[{'model':db[_0x8eff('0xdd')],'as':_0x8eff('0xde'),'include':[{'model':db['User'],'as':_0x8eff('0xdf')}]}]})[_0x8eff('0x22')](handleEntityNotFound(_0x5c64ef,null))[_0x8eff('0x22')](saveUpdates(_0x2ed342[_0x8eff('0x7d')],null))[_0x8eff('0x22')](function(_0x3dc53c){if(_0x3dc53c){_0x51cef3=_0x3dc53c;return db['ChatWebsite'][_0x8eff('0x6b')]({'where':{'id':_0x51cef3[_0x8eff('0x83')]}});}})[_0x8eff('0x22')](function(_0x5398e8){if(_0x5398e8){_0xae8a5e=_0x5398e8;return db['CmContact'][_0x8eff('0x6b')]({'where':{'id':_0x51cef3['ContactId']}});}})['then'](function(_0x23d355){if(_0x23d355){_0x59b7d2=_0x23d355;if(_0x374b82){var _0x28abb9=null;for(var _0x270798=0x1;_0x270798<_0x51cef3[_0x8eff('0xde')][_0x8eff('0x71')];++_0x270798){_0x28abb9=_0x51cef3[_0x8eff('0xde')][_0x270798];var _0x1d9e31=_0x28abb9[_0x8eff('0x7c')]?util['format'](_0x8eff('0xe0'),_0xae8a5e[_0x8eff('0xe1')],_0x28abb9[_0x8eff('0x7c')]):_0x8eff('0xe2');var _0x4df919=_0x2ed342[_0x8eff('0x7d')][_0x8eff('0xe3')]||util[_0x8eff('0xd9')](_0x8eff('0xe0'),_0x8eff('0xe4'),_0x28abb9[_0x8eff('0x75')]);switch(_0xae8a5e[_0x8eff('0xe5')]){case _0x8eff('0xe6'):_0x1d9e31=_0x28abb9[_0x8eff('0x7c')]?util[_0x8eff('0xd9')](_0x8eff('0xe0'),_0xae8a5e[_0x8eff('0xe1')],_0x28abb9[_0x8eff('0x7c')]):_0x8eff('0xe2');break;case _0x8eff('0xe7'):_0x1d9e31=_0x28abb9[_0x8eff('0x7c')]?_0x28abb9[_0x8eff('0xdf')][_0x8eff('0xe8')]||_0x28abb9[_0x8eff('0xdf')][_0x8eff('0x3e')]:'System';break;case'agent_fullname':_0x1d9e31=_0x28abb9[_0x8eff('0x7c')]?_0x28abb9[_0x8eff('0xdf')][_0x8eff('0x3e')]:_0x8eff('0xe2');break;default:_0x1d9e31=_0x28abb9[_0x8eff('0x7c')]?util['format'](_0x8eff('0xe0'),_0xae8a5e[_0x8eff('0xe1')],_0x28abb9[_0x8eff('0x7c')]):_0x8eff('0xe2');}var _0x354882=util[_0x8eff('0xd9')](_0x8eff('0xe9'),moment(_0x28abb9['createdAt'])[_0x8eff('0xd9')](_0x8eff('0xea')),_0x28abb9[_0x8eff('0xeb')]==='in'?_0x4df919:_0x1d9e31,_0x28abb9[_0x8eff('0x7d')]);if(!_0x28abb9[_0x8eff('0xec')]){fs[_0x8eff('0xed')](_0x374b82,_0x354882);}}return db[_0x8eff('0xee')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x8eff('0xef')],'as':'Smtp','raw':!![]}]});}}})[_0x8eff('0x22')](function(_0x45cf10){if(_0x45cf10&&_0x45cf10['Smtp']&&_0x2ed342[_0x8eff('0x7d')]){var _0x51c2a8={'tls':{'rejectUnauthorized':![]}};if(_0x45cf10[_0x8eff('0xf0')][_0x8eff('0xf1')]){_0x51c2a8[_0x8eff('0xf1')]=_0x45cf10[_0x8eff('0xf0')]['service'];}else{_0x51c2a8[_0x8eff('0xf2')]=_0x45cf10[_0x8eff('0xf0')]['host'];_0x51c2a8[_0x8eff('0xf3')]=_0x45cf10[_0x8eff('0xf0')][_0x8eff('0xf3')];_0x51c2a8['secure']=_0x45cf10['Smtp'][_0x8eff('0xf4')];}if(_0x45cf10[_0x8eff('0xf0')]['authentication']){_0x51c2a8['auth']={'user':_0x45cf10[_0x8eff('0xf0')][_0x8eff('0xa2')],'pass':_0x45cf10[_0x8eff('0xf0')]['pass']};}return respondWithRpcPromise(_0x8eff('0xf5'),_0x8eff('0xf6'),{'account':_0x51c2a8,'message':{'from':util[_0x8eff('0xd9')](_0x8eff('0xf7'),_0x45cf10[_0x8eff('0x3a')],_0x45cf10['email']||_0x45cf10[_0x8eff('0xf0')][_0x8eff('0xa2')]),'to':_0x2ed342[_0x8eff('0x7d')]['mailTranscript'],'subject':_0x8eff('0xf8'),'text':util[_0x8eff('0xd9')](_0x8eff('0xf9'),_0x2ed342[_0x8eff('0x7d')][_0x8eff('0xd7')]),'attachments':[{'path':_0x374b82}]}})[_0x8eff('0x22')](function(){return _0x51cef3;})[_0x8eff('0x2d')](function(_0x51f22e){console[_0x8eff('0x29')](_0x51f22e);});}else{return _0x51cef3;}})['then'](respondWithStatusCode(_0x5c64ef,0xc8))[_0x8eff('0x2d')](handleError(_0x5c64ef,null));};exports[_0x8eff('0xfa')]=function(_0x4fe183,_0x912eb8,_0x1ae192){return db[_0x8eff('0xdd')][_0x8eff('0x6b')]({'where':{'id':_0x4fe183[_0x8eff('0xbe')]['id']}})[_0x8eff('0x22')](handleEntityNotFound(_0x912eb8,null))[_0x8eff('0x22')](function(_0xe9351c){if(_0xe9351c){return _0xe9351c[_0x8eff('0xfa')](_0x4fe183[_0x8eff('0x7d')][_0x8eff('0xfb')],_[_0x8eff('0xfc')](_0x4fe183[_0x8eff('0x7d')],['ids','id'])||{});}})[_0x8eff('0x22')](respondWithResult(_0x912eb8,null))[_0x8eff('0x2d')](handleError(_0x912eb8,null));};exports['getMessages']=function(_0x428adc,_0x4c5d80,_0x27da0a){var _0x4cd219={'raw':![],'where':{}};var _0xf37a97={};var _0x3bd4f7={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8eff('0xd1')]({'where':{'id':_0x428adc['params']['id']}})[_0x8eff('0x22')](handleEntityNotFound(_0x4c5d80,null))[_0x8eff('0x22')](function(_0x22d3bb){if(_0x22d3bb){_0xf37a97[_0x8eff('0x47')]=_[_0x8eff('0x7f')](db[_0x8eff('0xdd')][_0x8eff('0x44')]);_0xf37a97[_0x8eff('0x48')]=_[_0x8eff('0x7f')](_0x428adc[_0x8eff('0x48')]);_0xf37a97[_0x8eff('0x49')]=_['intersection'](_0xf37a97[_0x8eff('0x47')],_0xf37a97['query']);_0x4cd219['attributes']=_['intersection'](_0xf37a97[_0x8eff('0x47')],qs[_0x8eff('0x4b')](_0x428adc[_0x8eff('0x48')][_0x8eff('0x4b')]));_0x4cd219[_0x8eff('0xa8')]=_0x4cd219[_0x8eff('0xa8')][_0x8eff('0x71')]?_0x4cd219['attributes']:_0xf37a97[_0x8eff('0x47')];if(!_0x428adc['query'][_0x8eff('0x4c')](_0x8eff('0x4d'))){_0x4cd219[_0x8eff('0x32')]=qs[_0x8eff('0x32')](_0x428adc['query'][_0x8eff('0x32')]);_0x4cd219[_0x8eff('0x31')]=qs[_0x8eff('0x31')](_0x428adc[_0x8eff('0x48')]['offset']);}_0x4cd219[_0x8eff('0x4e')]=qs['sort'](_0x428adc[_0x8eff('0x48')][_0x8eff('0x4f')]);_0x4cd219[_0x8eff('0x50')]=qs[_0x8eff('0x49')](_['pick'](_0x428adc[_0x8eff('0x48')],_0xf37a97[_0x8eff('0x49')]));_0x4cd219[_0x8eff('0x50')][_0x8eff('0xbb')]=_0x22d3bb['id'];if(_0x428adc['query'][_0x8eff('0x90')]){_0x4cd219[_0x8eff('0x50')]=_['merge'](_0x4cd219[_0x8eff('0x50')],{'$or':_[_0x8eff('0x3d')](_0x4cd219['attributes'],function(_0x1b6463){var _0x310ae9={};_0x310ae9[_0x1b6463]={'$like':'%'+_0x428adc[_0x8eff('0x48')][_0x8eff('0x90')]+'%'};return _0x310ae9;})});}if(_0x428adc[_0x8eff('0x48')][_0x8eff('0x88')]){var _0x1b8f75=_0x428adc[_0x8eff('0x48')][_0x8eff('0x88')]['split'](',');var _0xa9ca7a={};_0xa9ca7a[_0x1b8f75[0x0]]={'$gte':moment(_0x1b8f75[0x1])[_0x8eff('0xd9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4cd219[_0x8eff('0x50')]=_[_0x8eff('0xa7')](_0x4cd219['where'],_0xa9ca7a);}_0x4cd219=_[_0x8eff('0xa7')]({},_0x4cd219,_0x428adc[_0x8eff('0xfd')]);return db[_0x8eff('0xdd')][_0x8eff('0x30')]({'where':_0x4cd219[_0x8eff('0x50')]})[_0x8eff('0x22')](function(_0x4af3b){_0x3bd4f7[_0x8eff('0x30')]=_0x4af3b;if(_0x428adc[_0x8eff('0x48')][_0x8eff('0xbf')]){_0x4cd219['include']=[{'all':!![]}];}return db['ChatMessage'][_0x8eff('0xfe')](_0x4cd219);})['then'](function(_0x44e1eb){_0x3bd4f7['rows']=_0x44e1eb;return _0x3bd4f7;});}})[_0x8eff('0x22')](respondWithFilteredResult(_0x4c5d80,_0x4cd219))['catch'](handleError(_0x4c5d80,null));};exports[_0x8eff('0xff')]=function(_0x36257a,_0x3626d0,_0x4819fe){var _0x47b8d9={'where':{}},_0x1d5567={},_0x3ec2fc={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8eff('0xd1')]({'where':{'id':_0x36257a[_0x8eff('0xbe')]['id']}})[_0x8eff('0x22')](handleEntityNotFound(_0x3626d0,null))[_0x8eff('0x22')](function(_0x3b7733){if(_0x3b7733){_0x1d5567[_0x8eff('0x47')]=_[_0x8eff('0x7f')](db['ChatMessage'][_0x8eff('0x44')]);_0x1d5567['query']=_['keys'](_0x36257a[_0x8eff('0x48')]);_0x1d5567['filters']=_[_0x8eff('0x4a')](_0x1d5567[_0x8eff('0x47')],_0x1d5567[_0x8eff('0x48')]);_0x47b8d9['attributes']=_[_0x8eff('0x4a')](_0x1d5567[_0x8eff('0x47')],qs[_0x8eff('0x4b')](_0x36257a[_0x8eff('0x48')]['fields']));_0x47b8d9[_0x8eff('0xa8')]=_0x47b8d9[_0x8eff('0xa8')][_0x8eff('0x71')]?_0x47b8d9[_0x8eff('0xa8')]:_0x1d5567[_0x8eff('0x47')];if(!_0x36257a[_0x8eff('0x48')]['hasOwnProperty'](_0x8eff('0x4d'))){_0x47b8d9[_0x8eff('0x32')]=qs[_0x8eff('0x32')](_0x36257a[_0x8eff('0x48')][_0x8eff('0x32')]);_0x47b8d9[_0x8eff('0x31')]=qs[_0x8eff('0x31')](_0x36257a['query'][_0x8eff('0x31')]);}_0x47b8d9[_0x8eff('0x4e')]=qs[_0x8eff('0x4f')](_0x36257a[_0x8eff('0x48')][_0x8eff('0x4f')]);_0x47b8d9[_0x8eff('0x50')]=qs[_0x8eff('0x49')](_[_0x8eff('0x51')](_0x36257a[_0x8eff('0x48')],_0x1d5567[_0x8eff('0x49')]));_0x47b8d9[_0x8eff('0x50')][_0x8eff('0xbb')]=_0x3b7733['id'];if(_0x36257a[_0x8eff('0x48')][_0x8eff('0x90')]){_0x47b8d9[_0x8eff('0x50')]=_['merge'](_0x47b8d9[_0x8eff('0x50')],{'$or':_['map'](_0x47b8d9['attributes'],function(_0x1502d2){var _0x35d931={};_0x35d931[_0x1502d2]={'$like':'%'+_0x36257a[_0x8eff('0x48')]['filter']+'%'};return _0x35d931;})});}_0x47b8d9['where']['secret']=![];if(_0x36257a[_0x8eff('0x48')]['id']){_0x47b8d9[_0x8eff('0x50')]['id']={'$gt':_0x36257a[_0x8eff('0x48')]['id']};}_0x47b8d9=_[_0x8eff('0xa7')]({},_0x47b8d9,_0x36257a[_0x8eff('0xfd')]);return db[_0x8eff('0xdd')][_0x8eff('0x30')]({'where':_0x47b8d9[_0x8eff('0x50')]})['then'](function(_0x3b6bdf){_0x3ec2fc[_0x8eff('0x30')]=_0x3b6bdf;_0x47b8d9[_0x8eff('0x100')]=[];if(_0x36257a[_0x8eff('0x48')][_0x8eff('0x101')]){_0x47b8d9[_0x8eff('0x100')][_0x8eff('0x43')]({'model':db['User'],'as':_0x8eff('0xdf'),'attributes':['id',_0x8eff('0x3e'),_0x8eff('0xe8')]});}if(_0x36257a[_0x8eff('0x48')][_0x8eff('0xbf')]){_0x47b8d9[_0x8eff('0x100')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x47b8d9);})['then'](function(_0xd03bcb){_0x3ec2fc['rows']=_0xd03bcb;return _0x3ec2fc;});}})[_0x8eff('0x22')](respondWithFilteredResult(_0x3626d0,_0x47b8d9))[_0x8eff('0x2d')](handleError(_0x3626d0,null));};exports['addTags']=function(_0x57b56a,_0x52ef48,_0x418c9e){return db[_0x8eff('0xc0')][_0x8eff('0x6b')]({'where':{'id':_0x57b56a[_0x8eff('0xbe')]['id']}})[_0x8eff('0x22')](handleEntityNotFound(_0x52ef48,null))[_0x8eff('0x22')](function(_0x2ed550){if(_0x2ed550){return _0x2ed550['setTags'](_0x57b56a[_0x8eff('0x7d')][_0x8eff('0xfb')],_[_0x8eff('0xfc')](_0x57b56a[_0x8eff('0x7d')],[_0x8eff('0xfb'),'id'])||{})[_0x8eff('0x102')](function(){return db[_0x8eff('0x78')][_0x8eff('0xfe')]({'attributes':['id',_0x8eff('0x3a'),_0x8eff('0x54')],'where':{'id':_0x57b56a[_0x8eff('0x7d')][_0x8eff('0xfb')]}});})[_0x8eff('0x22')](function(_0x3781aa){socket[_0x8eff('0x103')](_0x8eff('0x104'),{'id':Number(_0x57b56a[_0x8eff('0xbe')]['id']),'tags':_0x3781aa||[]});return{'id':Number(_0x57b56a['params']['id']),'tags':_0x3781aa||[]};});}})[_0x8eff('0x22')](respondWithResult(_0x52ef48,null))[_0x8eff('0x2d')](handleError(_0x52ef48,null));};exports[_0x8eff('0x105')]=function(_0x4df5d5,_0x4f7608,_0x16abf6){return db[_0x8eff('0xc0')]['find']({'where':{'id':_0x4df5d5[_0x8eff('0xbe')]['id']}})[_0x8eff('0x22')](handleEntityNotFound(_0x4f7608,null))[_0x8eff('0x22')](function(_0x1ca0a5){if(_0x1ca0a5){return _0x1ca0a5[_0x8eff('0x105')](_0x4df5d5[_0x8eff('0x48')][_0x8eff('0xfb')]);}})['then'](respondWithStatusCode(_0x4f7608,null))['catch'](handleError(_0x4f7608,null));};exports[_0x8eff('0xd3')]=function(_0x2bfd90,_0x17767c){var _0x29419b=moment()['unix']()[_0x8eff('0xa5')]();var _0x555ff7=path[_0x8eff('0x106')](config['root'],_0x8eff('0x107'),'files',_0x8eff('0x108'));var _0xcd9723=path['join'](config[_0x8eff('0xd4')],_0x8eff('0x107'),_0x8eff('0x109'),_0x8eff('0x10a'));var _0x28594b=path[_0x8eff('0x106')](_0x555ff7,_0x29419b);var _0x3bdad7=util[_0x8eff('0xd9')](_0x8eff('0x10b'),_0x2bfd90['params']['id'],_0x29419b);var _0x248cde=path['join'](_0x555ff7,_0x3bdad7);var _0x32ba69=[];_0x32ba69[_0x8eff('0x43')]({'model':db['User'],'as':_0x8eff('0xdf'),'attributes':['id','fullname'],'raw':!![]});_0x32ba69[_0x8eff('0x43')]({'model':db[_0x8eff('0x10c')],'as':_0x8eff('0x6f'),'attributes':['id',_0x8eff('0x10d'),_0x8eff('0x10e')],'raw':!![]});if(_0x2bfd90['query']['attachments']){_0x32ba69[_0x8eff('0x43')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x92c5be=[{'model':db['ChatMessage'],'as':_0x8eff('0xde'),'attributes':['id',_0x8eff('0x7d'),'createdAt',_0x8eff('0xeb'),_0x8eff('0xec'),_0x8eff('0x8c')],'include':_0x32ba69}];_0x92c5be['push']({'model':db[_0x8eff('0x10f')],'as':'Account','attributes':['id',_0x8eff('0x3a')]});_0x92c5be[_0x8eff('0x43')]({'model':db['User'],'as':_0x8eff('0x110'),'attributes':['id',_0x8eff('0x3e')]});return db[_0x8eff('0xc0')]['find']({'where':{'id':_0x2bfd90[_0x8eff('0xbe')]['id']},'include':_0x92c5be})['then'](handleEntityNotFound(_0x17767c,null))[_0x8eff('0x22')](function(_0x462412){if(_0x462412){var _0x395581=_0x462412[_0x8eff('0x111')]({'plain':!![]});fs[_0x8eff('0x112')](_0x28594b);var _0x1f2ae8={'format':'A4','border':'10px','header':{'height':_0x8eff('0x113'),'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':_0x8eff('0x114'),'contents':{'default':util[_0x8eff('0xd9')](_0x8eff('0x115'),util[_0x8eff('0xd9')](_0x8eff('0x116'),_0x8eff('0x117'),_0x395581['id']),moment()[_0x8eff('0xd9')](_0x8eff('0x118'))[_0x8eff('0xa5')]())}}};var _0x4e20f5={'channel':_0x8eff('0x117'),'account':_0x395581['Account'][_0x8eff('0x3a')],'agent':_0x395581['Owner']?_0x395581[_0x8eff('0x110')]['fullname']:_0x8eff('0x119'),'createdAt':moment(_0x395581[_0x8eff('0x86')])[_0x8eff('0xd9')](_0x8eff('0x11a'))[_0x8eff('0xa5')](),'closedAt':_0x395581[_0x8eff('0xc7')]?moment(_0x395581['closedAt'])[_0x8eff('0xd9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x8eff('0xa5')]():'','disposition':_0x395581[_0x8eff('0x11b')],'chatInfo':{'browser':_0x395581['browserName'],'os':_0x395581[_0x8eff('0x11c')],'referer':_0x395581[_0x8eff('0x11d')],'customerIp':_0x395581[_0x8eff('0x11e')],'customerPort':_0x395581['customerPort']?_0x395581[_0x8eff('0x11f')]:_0x8eff('0x119')},'messages':_(_0x395581[_0x8eff('0xde')])[_0x8eff('0x120')]()[_0x8eff('0x90')]({'secret':![]})[_0x8eff('0x3d')](function(_0x5e1cc7){if(_0x5e1cc7[_0x8eff('0xcf')]){var _0x99f3dd=path[_0x8eff('0x106')](_0xcd9723,_0x5e1cc7[_0x8eff('0xcf')][_0x8eff('0xcb')]);if(fs[_0x8eff('0x121')](_0x99f3dd)){fs['createReadStream'](_0x99f3dd)[_0x8eff('0x122')](fs[_0x8eff('0x123')](path[_0x8eff('0x106')](_0x28594b,_0x5e1cc7[_0x8eff('0xcf')][_0x8eff('0xcb')])));}}return{'date':moment(_0x5e1cc7[_0x8eff('0x86')])[_0x8eff('0xd9')](_0x8eff('0x11a'))['toString'](),'sender':_0x5e1cc7['direction']===_0x8eff('0x124')?_0x5e1cc7[_0x8eff('0xdf')]?_0x5e1cc7[_0x8eff('0xdf')][_0x8eff('0x3e')]:_0x8eff('0xe2'):_0x5e1cc7[_0x8eff('0x6f')][_0x8eff('0x10d')]+(_0x5e1cc7[_0x8eff('0x6f')][_0x8eff('0x10e')]?'\x20'+_0x5e1cc7[_0x8eff('0x6f')]['lastName']:''),'body':_0x5e1cc7['Attachment']?_0x5e1cc7[_0x8eff('0xcf')][_0x8eff('0xcb')]:_0x5e1cc7[_0x8eff('0x7d')],'direction':_0x5e1cc7[_0x8eff('0xeb')]==='out'?'A':'C','secret':_0x5e1cc7['secret'],'read':_0x5e1cc7[_0x8eff('0x8c')],'attachment':_0x5e1cc7['Attachment']};})[_0x8eff('0x6c')]()};return ejs[_0x8eff('0x125')](path[_0x8eff('0x106')](config[_0x8eff('0xd4')],_0x8eff('0x107'),_0x8eff('0x126'),_0x8eff('0x127')),{'interaction':_0x4e20f5})[_0x8eff('0x22')](function(_0x34f5d8){return new BPromise(function(_0x2a88bb,_0x3ec815){pdf[_0x8eff('0xc1')](_0x34f5d8,_0x1f2ae8)[_0x8eff('0x128')](path[_0x8eff('0x106')](_0x28594b,_0x8eff('0x129')+_0x395581['id']+'-'+_0x29419b+_0x8eff('0x12a')),function(_0x5f3f16,_0x4bc36){if(_0x5f3f16)return _0x3ec815(_0x5f3f16);_0x2a88bb(_0x4bc36);});});})[_0x8eff('0x22')](function(){return new BPromise(function(_0x348fed,_0x354d74){zipdir(_0x28594b,{'saveTo':_0x248cde},function(_0x596150,_0x36665f){if(_0x596150)return _0x354d74(_0x596150);return _0x348fed(_0x36665f);});})[_0x8eff('0x22')](function(){return new BPromise(function(_0x662c1b,_0x5c0e8d){rimraf(_0x28594b,function(_0x3dede3){if(_0x3dede3)_0x5c0e8d(_0x3dede3);return _0x662c1b();});});})['then'](function(){return _0x17767c[_0x8eff('0xd3')](_0x248cde,_0x3bdad7,function(_0x303d97){if(_0x303d97){console['log'](_0x8eff('0x12b'),_0x303d97);}else{fs[_0x8eff('0x12c')](_0x248cde);}});});});}else{return _0x17767c['sendStatus'](0xc8);}})['catch'](handleError(_0x17767c,null));}; \ No newline at end of file +var _0x4b19=['entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','originalname','basename','filename','file','mimetype','attachmentDownload','findOne','Unauthorized','Attachment','attachId','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','ChatWebsite','agentAlias','System','customer','format','%s%d','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','service','port','secure','authentication','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','omit','getMessages','sort','ChatInteractionId','includeAll','findAll','getMyMessages','includeAgent','addTags','setTags','ids','Tag','emit','removeTags','download','unix','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','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','%s\x20#%d','Chat','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','customerIp','tail','existsSync','createReadStream','pipe','out','Contact','server','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','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','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','name','Users','map','fullname','TagIds','Tags','split','push','catch','index','ChatInteraction','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','select','field','color','tools_tags','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','$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','buildExpression','text','start','forEach','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','resolve','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','all','rows','params','include','options','create','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x5d695b,_0x3f9907){var _0x2fdda7=function(_0x1f93ac){while(--_0x1f93ac){_0x5d695b['push'](_0x5d695b['shift']());}};_0x2fdda7(++_0x3f9907);}(_0x4b19,0x195));var _0x94b1=function(_0x27526e,_0x3f2c11){_0x27526e=_0x27526e-0x0;var _0x1db58f=_0x4b19[_0x27526e];return _0x1db58f;};'use strict';var pdf=require(_0x94b1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x94b1('0x1'));var zipdir=require(_0x94b1('0x2'));var jsonpatch=require(_0x94b1('0x3'));var rp=require('request-promise');var moment=require(_0x94b1('0x4'));var BPromise=require(_0x94b1('0x5'));var Mustache=require(_0x94b1('0x6'));var util=require('util');var path=require(_0x94b1('0x7'));var sox=require(_0x94b1('0x8'));var csv=require('to-csv');var ejs=require(_0x94b1('0x9'));var fs=require('fs');var _=require(_0x94b1('0xa'));var squel=require('squel');var crypto=require(_0x94b1('0xb'));var jsforce=require(_0x94b1('0xc'));var deskjs=require(_0x94b1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x94b1('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x94b1('0xf'));var qs=require(_0x94b1('0x10'));var as=require(_0x94b1('0x11'));var hardwareService=require(_0x94b1('0x12'));var logger=require(_0x94b1('0x13'))(_0x94b1('0x14'));var utils=require('../../config/utils');var config=require(_0x94b1('0x15'));var db=require(_0x94b1('0x16'))['db'];config[_0x94b1('0x17')]=_[_0x94b1('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x94b1('0x19'))(new Redis(config[_0x94b1('0x17')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x94b1('0x1a'));var client=jayson[_0x94b1('0x1b')]['http']({'port':0x232b});var client9004=jayson[_0x94b1('0x1b')]['http']({'port':0x232c});function checkPasswordPattern(_0x4ea6a4,_0x192c03,_0x1f0560){if(_0x1f0560){var _0x258e98=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x258e98[_0x94b1('0x1c')](_0x192c03)){return _0x4ea6a4;}else{throw new db['Sequelize'][(_0x94b1('0x1d'))](_0x94b1('0x1e'));}}else{return _0x4ea6a4;}}function respondWithRpcPromise(_0xa29b90,_0x224099,_0x3a6ae0,_0x1abb7f){return new BPromise(function(_0x2d33dc,_0x59d7cf){var _0x30f969=_0x1abb7f||client;return _0x30f969[_0x94b1('0x1f')](_0xa29b90,_0x3a6ae0)[_0x94b1('0x20')](function(_0x5deb20){logger[_0x94b1('0x21')](_0x94b1('0x22'),_0x224099,'request\x20sent');logger[_0x94b1('0x23')](_0x94b1('0x24'),_0x224099,_0x94b1('0x25'),JSON[_0x94b1('0x26')](_0x5deb20));if(_0x5deb20[_0x94b1('0x27')]){if(_0x5deb20[_0x94b1('0x27')][_0x94b1('0x28')]===0x1f4){logger[_0x94b1('0x27')](_0x94b1('0x22'),_0x224099,_0x5deb20[_0x94b1('0x27')]['message']);return _0x59d7cf(_0x5deb20[_0x94b1('0x27')][_0x94b1('0x29')]);}logger[_0x94b1('0x27')]('ChatInteraction,\x20%s,\x20%s',_0x224099,_0x5deb20[_0x94b1('0x27')]['message']);return _0x2d33dc(_0x5deb20[_0x94b1('0x27')][_0x94b1('0x29')]);}else{logger[_0x94b1('0x21')](_0x94b1('0x22'),_0x224099,'request\x20sent');_0x2d33dc(_0x5deb20['result'][_0x94b1('0x29')]);}})['catch'](function(_0x1aa525){logger['error'](_0x94b1('0x22'),_0x224099,_0x1aa525);_0x59d7cf(_0x1aa525);});});}function respondWithStatusCode(_0x2f06b1,_0x1eda8c){_0x1eda8c=_0x1eda8c||0xcc;return function(_0x4c2732){if(_0x4c2732){return _0x2f06b1[_0x94b1('0x2a')](_0x1eda8c);}return _0x2f06b1[_0x94b1('0x2b')](_0x1eda8c)[_0x94b1('0x2c')]();};}function respondWithResult(_0x319618,_0xd86145){_0xd86145=_0xd86145||0xc8;return function(_0x43b67c){if(_0x43b67c){return _0x319618[_0x94b1('0x2b')](_0xd86145)[_0x94b1('0x2d')](_0x43b67c);}};}function respondWithFilteredResult(_0x1e79e2,_0x597af3){return function(_0x2eb1fa){if(_0x2eb1fa){var _0xf621ea=_0x2eb1fa[_0x94b1('0x2e')],_0x47f019=_0x597af3[_0x94b1('0x2f')],_0x42630a=_0x597af3[_0x94b1('0x2f')]+_0x597af3[_0x94b1('0x30')],_0x1fe766;if(_0x42630a>=_0xf621ea){_0x42630a=_0xf621ea;_0x1fe766=0xc8;}else{_0x1fe766=0xce;}_0x1e79e2['status'](_0x1fe766);return _0x1e79e2[_0x94b1('0x31')]('Content-Range',_0x47f019+'-'+_0x42630a+'/'+_0xf621ea)[_0x94b1('0x2d')](_0x2eb1fa);}return null;};}function patchUpdates(_0x51d67c){return function(_0x57e497){try{jsonpatch[_0x94b1('0x32')](_0x57e497,_0x51d67c,!![]);}catch(_0x171d44){return BPromise[_0x94b1('0x33')](_0x171d44);}return _0x57e497[_0x94b1('0x34')]();};}function saveUpdates(_0x35b97c,_0x195514){return function(_0x26f33d){if(_0x26f33d){return _0x26f33d[_0x94b1('0x35')](_0x35b97c)[_0x94b1('0x20')](function(_0x18de6f){return _0x18de6f;});}return null;};}function removeEntity(_0x3cd875,_0xaff15e){return function(_0x500772){if(_0x500772){return _0x500772['destroy']()[_0x94b1('0x20')](function(){_0x3cd875[_0x94b1('0x2b')](0xcc)[_0x94b1('0x2c')]();});}};}function handleEntityNotFound(_0x2f5e6c,_0x2c7e43){return function(_0x2ba486){if(!_0x2ba486){_0x2f5e6c[_0x94b1('0x2a')](0x194);}return _0x2ba486;};}function handleError(_0x36a2f8,_0x4285dd){_0x4285dd=_0x4285dd||0x1f4;return function(_0x586eaa){logger[_0x94b1('0x27')](_0x586eaa['stack']);if(_0x586eaa[_0x94b1('0x36')]){delete _0x586eaa[_0x94b1('0x36')];}_0x36a2f8[_0x94b1('0x2b')](_0x4285dd)['send'](_0x586eaa);};}function getInteractionUsers(_0x357798,_0x21dd65){return new BPromise(function(_0x27c9e4,_0x5628eb){try{if(_0x21dd65[_0x357798['id']]){_0x357798[_0x94b1('0x37')]=_[_0x94b1('0x38')](_0x21dd65[_0x357798['id']],function(_0x1d4168){return{'id':_0x1d4168['id'],'fullname':_0x1d4168[_0x94b1('0x39')]};});}}catch(_0x3e5b02){_0x5628eb(_0x3e5b02);}_0x27c9e4(_0x357798);});}function getInteractionTags(_0x2e6fb9,_0x292964){return new BPromise(function(_0x127e6c,_0x737da9){try{if(_0x2e6fb9[_0x94b1('0x3a')]){_0x2e6fb9[_0x94b1('0x3b')]=[];_0x2e6fb9[_0x94b1('0x3a')][_0x94b1('0x3c')](',')['forEach'](function(_0x34b148){_0x2e6fb9[_0x94b1('0x3b')][_0x94b1('0x3d')](_0x292964[_0x34b148]);});}delete _0x2e6fb9[_0x94b1('0x3a')];}catch(_0x2e6d0f){_0x737da9(_0x2e6d0f);}_0x127e6c(_0x2e6fb9);});}function updateChatInteraction(_0x5c05c6,_0xc6732a,_0x158d1a){return new BPromise(function(_0x186575,_0x300747){return getInteractionUsers(_0x5c05c6,_0x158d1a)[_0x94b1('0x20')](function(_0x2c9398){return getInteractionTags(_0x2c9398,_0xc6732a);})['then'](function(_0x439323){_0x186575(_0x439323);})[_0x94b1('0x3e')](function(_0x592daa){_0x300747(_0x592daa);});});}exports[_0x94b1('0x3f')]=function(_0x19d4e4,_0x59311b){var _0x2c7359={},_0x442157={},_0x287bac={'count':0x0,'rows':[]};var _0x4b5068=_[_0x94b1('0x38')](db[_0x94b1('0x40')][_0x94b1('0x41')],function(_0xeb94e4){return{'name':_0xeb94e4[_0x94b1('0x42')],'type':_0xeb94e4[_0x94b1('0x43')][_0x94b1('0x44')]};});_0x442157['model']=_[_0x94b1('0x38')](_0x4b5068,_0x94b1('0x36'));_0x442157[_0x94b1('0x45')]=_['keys'](_0x19d4e4[_0x94b1('0x45')]);_0x442157[_0x94b1('0x46')]=_['intersection'](_0x442157[_0x94b1('0x47')],_0x442157[_0x94b1('0x45')]);_0x2c7359[_0x94b1('0x48')]=_[_0x94b1('0x49')](_0x442157[_0x94b1('0x47')],qs[_0x94b1('0x4a')](_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x4a')]));_0x2c7359[_0x94b1('0x48')]=_0x2c7359[_0x94b1('0x48')][_0x94b1('0x4b')]?_0x2c7359[_0x94b1('0x48')]:_0x442157[_0x94b1('0x47')];if(!_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x4c')](_0x94b1('0x4d'))){_0x2c7359[_0x94b1('0x30')]=qs[_0x94b1('0x30')](_0x19d4e4[_0x94b1('0x45')]['limit']);_0x2c7359[_0x94b1('0x2f')]=qs['offset'](_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x2f')]);}_0x2c7359[_0x94b1('0x4e')]=qs['sort'](_0x19d4e4['query']['sort']);_0x2c7359[_0x94b1('0x4f')]=qs[_0x94b1('0x46')](_[_0x94b1('0x50')](_0x19d4e4['query'],_0x442157['filters']));var _0x4d2af3=[];var _0x227f50=squel[_0x94b1('0x51')]()[_0x94b1('0x52')]('id')[_0x94b1('0x52')](_0x94b1('0x36'))[_0x94b1('0x52')](_0x94b1('0x53'))['from'](_0x94b1('0x54'));var _0x1986af=squel[_0x94b1('0x51')]()[_0x94b1('0x52')](_0x94b1('0x55'))[_0x94b1('0x52')](_0x94b1('0x56'))[_0x94b1('0x52')](_0x94b1('0x57'))[_0x94b1('0x58')](_0x94b1('0x59'),'ui')[_0x94b1('0x5a')](_0x94b1('0x5b'),'u',_0x94b1('0x5c'));var _0x4c968d=squel[_0x94b1('0x51')]()[_0x94b1('0x58')](_0x94b1('0x5d'),'i')[_0x94b1('0x5a')](_0x94b1('0x5e'),'c',_0x94b1('0x5f'))[_0x94b1('0x5a')](_0x94b1('0x5b'),'o',_0x94b1('0x60'))['left_join'](_0x94b1('0x61'),'a',_0x94b1('0x62'))[_0x94b1('0x5a')](_0x94b1('0x63'),'me',_0x94b1('0x64'))[_0x94b1('0x5a')]('chat_interaction_has_tags','it',_0x94b1('0x65'))[_0x94b1('0x5a')](_0x94b1('0x54'),'t',_0x94b1('0x66'));var _0x240581=squel[_0x94b1('0x67')]();var _0x2d985e=[];var _0x15b80c=squel[_0x94b1('0x67')]();var _0x502d2c;if(_0x19d4e4['query'][_0x94b1('0x68')]){_0x502d2c=as[_0x94b1('0x69')](_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x68')]);var _0x21caaa=_0x502d2c[_0x94b1('0x6a')];for(var _0x152a22=0x0;_0x152a22<_0x502d2c[_0x94b1('0x6b')][_0x94b1('0x4b')];_0x152a22++){var _0x65157d=_0x502d2c[_0x94b1('0x6b')][_0x152a22];var _0xacf1f4='i';var _0x4d22ac=_['find'](_0x4b5068,[_0x94b1('0x36'),_0x65157d[_0x94b1('0x52')]]);if(!_0x4d22ac){switch(_0x65157d[_0x94b1('0x52')]){case _0x94b1('0x6c'):if(_0x65157d[_0x94b1('0x6d')]==0x1){_0x4c968d['having']('`'+_0x65157d[_0x94b1('0x52')]+_0x94b1('0x6e'));}else{_0x4c968d[_0x94b1('0x6f')]('`'+_0x65157d[_0x94b1('0x52')]+_0x94b1('0x70'));}break;case'Contact':if(_0x65157d['operator']===_0x94b1('0x71')){if(_0x65157d[_0x94b1('0x6d')][_0x94b1('0x3c')]('\x20')['length']>0x1){_0x240581[_0x21caaa](_0x94b1('0x72'),qs[_0x94b1('0x73')](_0x65157d['value']),null);}else{var _0x5ee8a5='%'+_0x65157d[_0x94b1('0x6d')]+'%';_0x240581[_0x21caaa](_0x94b1('0x74'),_0x5ee8a5,_0x5ee8a5,_0x5ee8a5);}}else{_0x4d22ac=_[_0x94b1('0x75')](_0x4b5068,[_0x94b1('0x36'),_0x94b1('0x76')]);_0x65157d[_0x94b1('0x52')]=_0x94b1('0x76');_0x6b2878=as[_0x94b1('0x77')](_0xacf1f4,_0x4d22ac['type'],_0x65157d);_0x240581[_0x21caaa](_0x6b2878[_0x94b1('0x78')],_0x6b2878['value'][_0x94b1('0x79')],_0x6b2878[_0x94b1('0x6d')][_0x94b1('0x2c')]);}break;case'Tag':var _0x1b70b2=_0x65157d['value'][_0x94b1('0x3c')](',')[_0x94b1('0x38')](function(_0x137a37){return Number(_0x137a37);});_0x1b70b2[_0x94b1('0x7a')](function(_0x331682){_0x15b80c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x331682+',%');});_0x2d985e=_['union'](_0x2d985e,_0x1b70b2);break;case _0x94b1('0x7b'):if(_0x65157d[_0x94b1('0x7c')]===_0x94b1('0x71')){_0x240581[_0x21caaa](_0x94b1('0x7d'),'%'+_0x65157d[_0x94b1('0x6d')]+'%',null);}else{_0x4d22ac=_[_0x94b1('0x75')](_0x4b5068,[_0x94b1('0x36'),_0x94b1('0x7e')]);_0x65157d['field']='UserId';_0x6b2878=as[_0x94b1('0x77')](_0xacf1f4,_0x4d22ac['type'],_0x65157d);_0x240581[_0x21caaa](_0x6b2878[_0x94b1('0x78')],_0x6b2878['value'][_0x94b1('0x79')],_0x6b2878[_0x94b1('0x6d')][_0x94b1('0x2c')]);}break;case _0x94b1('0x7f'):_0x6b2878=as[_0x94b1('0x77')]('me',null,_0x65157d);_0x240581[_0x21caaa](_0x6b2878[_0x94b1('0x78')],_0x6b2878['value'][_0x94b1('0x79')],_0x6b2878[_0x94b1('0x6d')][_0x94b1('0x2c')]);break;}}else{var _0x6b2878=as[_0x94b1('0x77')](_0xacf1f4,_0x4d22ac[_0x94b1('0x43')],_0x65157d);_0x240581[_0x21caaa](_0x6b2878[_0x94b1('0x78')],_0x6b2878['value'][_0x94b1('0x79')],_0x6b2878[_0x94b1('0x6d')][_0x94b1('0x2c')]);}}}else{var _0xd40396=_(_0x19d4e4[_0x94b1('0x45')])[_0x94b1('0x80')]()[_0x94b1('0x38')](function(_0x4b5cf7){return _[_0x94b1('0x81')](_0x4b5068,['name',_0x4b5cf7])?_0x4b5cf7:undefined;})[_0x94b1('0x82')]()[_0x94b1('0x6d')]();if(!_[_0x94b1('0x83')](_0xd40396)){_0xd40396[_0x94b1('0x7a')](function(_0x47bc66){if(_0x47bc66==='ChatWebsiteId'){_0x4c968d[_0x94b1('0x4f')](_0x94b1('0x84'),[]['concat'](_0x19d4e4[_0x94b1('0x45')][_0x47bc66]));}else if(_0x47bc66===_0x94b1('0x85')){var _0xc57189=JSON['parse'](_0x19d4e4[_0x94b1('0x45')][_0x47bc66])[_0x94b1('0x86')];var _0x40874c=JSON[_0x94b1('0x87')](_0x19d4e4['query'][_0x47bc66])[_0x94b1('0x88')];_0x4c968d['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xc57189,_0x40874c);}else{if(_0x19d4e4['query'][_0x47bc66]===_0x94b1('0x89')){_0x4c968d[_0x94b1('0x4f')]('i.'+_0x47bc66+_0x94b1('0x8a'));}else{_0x4c968d['where']('i.'+_0x47bc66+'\x20=\x20?',_0x19d4e4['query'][_0x47bc66]);}}});}if(_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x8b')]){if(_0x19d4e4['query']['read']==0x1){_0x4c968d['having'](_0x94b1('0x8c'));}else{_0x4c968d[_0x94b1('0x6f')](_0x94b1('0x8d'));}}if(_0x19d4e4[_0x94b1('0x45')]['tag']){_0x2d985e=_['isArray'](_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x8e')])?_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x8e')]:new Array(_0x19d4e4['query']['tag']);_0x2d985e['forEach'](function(_0x355543){_0x15b80c['or'](_0x94b1('0x8f'),'%,'+_0x355543+',%');});}if(_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x90')]){var _0xa4dfd1=_0x19d4e4['query'][_0x94b1('0x90')][_0x94b1('0x91')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x94b1('0x92'));if(qs['isNumeric'](_0xa4dfd1)){_0x240581['or']('i.id\x20LIKE\x20?',_0xa4dfd1+'%');}else{_0x240581['or'](_0x94b1('0x93'),qs['getFullTextValue'](_0xa4dfd1))['or'](_0x94b1('0x94'),_0xa4dfd1+'%');}}}_0x4c968d[_0x94b1('0x4f')](_0x240581);_0x4c968d[_0x94b1('0x95')](_0x94b1('0x96'));var _0x219b5d={'type':db['Sequelize'][_0x94b1('0x97')]['SELECT'],'raw':!![]};var _0x101517=_0x4c968d[_0x94b1('0x98')]();_0x101517[_0x94b1('0x52')]('i.id');_0x101517[_0x94b1('0x52')](_0x94b1('0x99'),'unreadMessages');if(_0x2c7359['order']){_0x2c7359[_0x94b1('0x4e')][_0x94b1('0x7a')](function(_0x2a0d93){_0x4c968d[_0x94b1('0x4e')]('i.'+_0x2a0d93[0x0],_0x2a0d93[0x1]==='DESC'?![]:!![]);});}if(!_[_0x94b1('0x83')](_0x2d985e)){_0x4c968d['having'](_0x15b80c);_0x101517[_0x94b1('0x4f')]('t.id\x20IN\x20?',_0x2d985e);}BPromise[_0x94b1('0x9a')]()['then'](function(){if(!_0x502d2c){if(_0x19d4e4['query'][_0x94b1('0x9b')]||_0x19d4e4[_0x94b1('0x45')]['journey'])return;_0x101517[_0x94b1('0x4f')](_0x94b1('0x9c'));_0x4c968d[_0x94b1('0x4f')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x19d4e4[_0x94b1('0x9d')][_0x94b1('0x9e')]({'attributes':['id'],'raw':!![]})[_0x94b1('0x20')](function(_0x5d722e){if(_[_0x94b1('0x83')](_0x5d722e)){_0x101517['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x4c968d[_0x94b1('0x4f')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x101517[_0x94b1('0x4f')]('i.ChatWebsiteId\x20IN\x20?',_[_0x94b1('0x38')](_0x5d722e,'id'));_0x4c968d['where'](_0x94b1('0x84'),_['map'](_0x5d722e,'id'));}});})[_0x94b1('0x20')](function(){db[_0x94b1('0x9f')][_0x94b1('0x45')](_0x101517[_0x94b1('0xa0')](),_0x219b5d)[_0x94b1('0x20')](function(_0xd11449){_0x287bac['count']=_0xd11449[_0x94b1('0x4b')];if(_0x287bac[_0x94b1('0x2e')]===0x0)return[];return db[_0x94b1('0x9f')][_0x94b1('0x45')](_0x227f50[_0x94b1('0xa0')](),_0x219b5d)[_0x94b1('0x20')](function(_0x5093d8){_0x4d2af3=_[_0x94b1('0xa1')](_0x5093d8,'id');_0x219b5d=_[_0x94b1('0xa2')](_0x219b5d,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x19d4e4[_0x94b1('0x45')][_0x94b1('0x4a')]){_0x2c7359[_0x94b1('0x48')][_0x94b1('0x7a')](function(_0x2d3c76){_0x4c968d[_0x94b1('0x52')]('i.'+_0x2d3c76);});}else{_0x4c968d[_0x94b1('0x52')](_0x94b1('0x99'),_0x94b1('0x6c'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xa3'),_0x94b1('0xa4'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xa5'),_0x94b1('0xa6'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xa7'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xa8'),_0x94b1('0xa9'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xaa'),_0x94b1('0xab'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xac'),_0x94b1('0xad'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xae'),_0x94b1('0xaf'));_0x4c968d[_0x94b1('0x52')](_0x94b1('0xb0'),_0x94b1('0xb1'));_0x4c968d['field'](_0x94b1('0xb2'),_0x94b1('0xb3'));_0x4c968d['field']('o.fullname',_0x94b1('0xb4'));_0x4c968d['field'](_0x94b1('0xb5'),'Owner.internal');_0x4c968d[_0x94b1('0x52')](_0x94b1('0xb6'),_0x94b1('0x3a'));}_0x4c968d['limit'](_0x2c7359['limit']);_0x4c968d[_0x94b1('0x2f')](_0x2c7359[_0x94b1('0x2f')]);return db[_0x94b1('0x9f')][_0x94b1('0x45')](_0x4c968d[_0x94b1('0xa0')](),_0x219b5d);})[_0x94b1('0x20')](function(_0x2ddfa6){_0x1986af['where'](_0x94b1('0xb7'),_[_0x94b1('0x38')](_0x2ddfa6,'id'));return db[_0x94b1('0x9f')][_0x94b1('0x45')](_0x1986af[_0x94b1('0xa0')](),_0x219b5d)[_0x94b1('0x20')](function(_0x516659){var _0x27267f=_[_0x94b1('0xb8')](_0x516659,'ChatInteractionId');var _0x22e08e=[];_0x2ddfa6[_0x94b1('0x7a')](function(_0x5ab0af){_0x22e08e[_0x94b1('0x3d')](updateChatInteraction(_0x5ab0af,_0x4d2af3,_0x27267f));});return BPromise[_0x94b1('0xb9')](_0x22e08e);});});})[_0x94b1('0x20')](function(_0x568ad6){_0x287bac[_0x94b1('0xba')]=_0x568ad6;return _0x287bac;})[_0x94b1('0x20')](respondWithFilteredResult(_0x59311b,_0x2c7359));})['catch'](handleError(_0x59311b,null));};exports['show']=function(_0x438cdb,_0x3d1e1e){var _0x26c84a={'raw':![],'where':{'id':_0x438cdb[_0x94b1('0xbb')]['id']}},_0x4e44c4={};_0x4e44c4[_0x94b1('0x47')]=_[_0x94b1('0x80')](db[_0x94b1('0x40')][_0x94b1('0x41')]);_0x4e44c4[_0x94b1('0x45')]=_['keys'](_0x438cdb[_0x94b1('0x45')]);_0x4e44c4[_0x94b1('0x46')]=_[_0x94b1('0x49')](_0x4e44c4[_0x94b1('0x47')],_0x4e44c4[_0x94b1('0x45')]);_0x26c84a['attributes']=_[_0x94b1('0x49')](_0x4e44c4['model'],qs['fields'](_0x438cdb[_0x94b1('0x45')][_0x94b1('0x4a')]));_0x26c84a[_0x94b1('0x48')]=_0x26c84a[_0x94b1('0x48')]['length']?_0x26c84a[_0x94b1('0x48')]:_0x4e44c4[_0x94b1('0x47')];if(_0x438cdb[_0x94b1('0x45')]['includeAll']){_0x26c84a[_0x94b1('0xbc')]=[{'all':!![]}];}_0x26c84a=_[_0x94b1('0xa2')]({},_0x26c84a,_0x438cdb[_0x94b1('0xbd')]);return db['ChatInteraction'][_0x94b1('0x75')](_0x26c84a)[_0x94b1('0x20')](handleEntityNotFound(_0x3d1e1e,null))['then'](respondWithResult(_0x3d1e1e,null))[_0x94b1('0x3e')](handleError(_0x3d1e1e,null));};exports[_0x94b1('0xbe')]=function(_0x13c0c3,_0x3923c5){return db[_0x94b1('0x40')]['create'](_0x13c0c3['body'],{})['then'](respondWithResult(_0x3923c5,0xc9))[_0x94b1('0x3e')](handleError(_0x3923c5,null));};exports[_0x94b1('0x35')]=function(_0x22202e,_0x5a4eb6){if(_0x22202e[_0x94b1('0x7f')]['id']){delete _0x22202e[_0x94b1('0x7f')]['id'];}return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x22202e[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x5a4eb6,null))[_0x94b1('0x20')](saveUpdates(_0x22202e[_0x94b1('0x7f')],null))[_0x94b1('0x20')](respondWithResult(_0x5a4eb6,null))[_0x94b1('0x3e')](handleError(_0x5a4eb6,null));};exports['destroy']=function(_0x2254c6,_0x23f144){return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x2254c6[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x23f144,null))[_0x94b1('0x20')](removeEntity(_0x23f144,null))[_0x94b1('0x3e')](handleError(_0x23f144,null));};exports[_0x94b1('0xbf')]=function(_0x4b6ae3,_0x5bd532){return db['ChatInteraction'][_0x94b1('0xbf')]()[_0x94b1('0x20')](respondWithResult(_0x5bd532,null))[_0x94b1('0x3e')](handleError(_0x5bd532,null));};exports[_0x94b1('0xc0')]=function(_0x51b24c,_0x1057de){if(_0x51b24c[_0x94b1('0x7f')]['id']){delete _0x51b24c[_0x94b1('0x7f')]['id'];}return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x51b24c[_0x94b1('0xbb')]['id']}})['then'](handleEntityNotFound(_0x1057de,null))['then'](saveUpdates(_0x51b24c['body'],null))['then'](respondWithResult(_0x1057de,null))[_0x94b1('0x3e')](handleError(_0x1057de,null));};exports[_0x94b1('0xc1')]=function(_0x213bcd,_0x45ad88,_0x193aec){if(_0x213bcd[_0x94b1('0x7f')]['id']){delete _0x213bcd[_0x94b1('0x7f')]['id'];}return db[_0x94b1('0x40')]['find']({'where':{'id':_0x213bcd[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](function(_0x175436){if(!_0x175436){logger['error'](_0x94b1('0xc2'),_0x94b1('0xc1'),0x194,_0x94b1('0xc3'));_0x45ad88[_0x94b1('0x2a')](0x194);}else{if(_0x175436[_0x94b1('0x7e')]){throw new db['Sequelize'][(_0x94b1('0x1d'))](_0x94b1('0xc4'));}}return _0x175436;})[_0x94b1('0x20')](function(_0x2f4211){if(_0x2f4211){return _0x2f4211[_0x94b1('0x35')]({'closed':_0x213bcd[_0x94b1('0x7f')][_0x94b1('0xc5')],'disposition':_0x213bcd[_0x94b1('0x7f')][_0x94b1('0xc6')]})[_0x94b1('0x20')](function(_0x51a3be){return _0x51a3be;});}})['then'](function(_0x848cf8){return respondWithRpcPromise(_0x94b1('0xc7'),_0x94b1('0xc1'),_0x213bcd[_0x94b1('0x7f')],client9004);})[_0x94b1('0x20')](respondWithResult(_0x45ad88,null))[_0x94b1('0x3e')](handleError(_0x45ad88,null));};exports['attachmentUpload']=function(_0x448480,_0x4dd54c,_0xafaac){_0x448480['body'][_0x94b1('0x36')]=_0x448480['file'][_0x94b1('0xc8')];_0x448480[_0x94b1('0x7f')][_0x94b1('0xc9')]=_0x448480['file'][_0x94b1('0xca')];_0x448480[_0x94b1('0x7f')][_0x94b1('0x43')]=_0x448480[_0x94b1('0xcb')][_0x94b1('0xcc')];return db['Attachment']['create'](_0x448480[_0x94b1('0x7f')])[_0x94b1('0x20')](respondWithResult(_0x4dd54c,0xc9))[_0x94b1('0x3e')](handleError(_0x4dd54c,null));};exports[_0x94b1('0xcd')]=function(_0x408933,_0x540d60,_0x5eead5){return db[_0x94b1('0x40')][_0x94b1('0xce')]({'where':{'id':_0x408933[_0x94b1('0xbb')]['id']},'raw':!![]})[_0x94b1('0x20')](handleEntityNotFound(_0x540d60,null))['then'](function(_0x560ca0){if(_0x560ca0){if(_0x560ca0[_0x94b1('0xc5')]){return _0x540d60[_0x94b1('0x2b')](0x193)['json']({'status':0x193,'message':_0x94b1('0xcf')});}return db[_0x94b1('0xd0')][_0x94b1('0xce')]({'where':{'id':_0x408933[_0x94b1('0x45')][_0x94b1('0xd1')]},'raw':!![]})['then'](handleEntityNotFound(_0x540d60,null));}})[_0x94b1('0x20')](function(_0x5e4296){if(_0x5e4296){return _0x540d60['download'](path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],_0x94b1('0xd4'),_0x5e4296[_0x94b1('0xc9')]));}})[_0x94b1('0x3e')](handleError(_0x540d60,null));};exports[_0x94b1('0xd5')]=function(_0x4195a2,_0x3925f6){var _0x1bb516=null;var _0x4742f8=null;var _0x13a409=null;var _0x547c8a=null;if(_0x4195a2[_0x94b1('0x7f')]['id']){delete _0x4195a2['body']['id'];}if(_0x4195a2[_0x94b1('0x7f')][_0x94b1('0xd6')]){_0x547c8a=path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],_0x94b1('0xd7'),util['format'](_0x94b1('0xd8'),Date[_0x94b1('0xd9')]()));_0x4195a2[_0x94b1('0x7f')][_0x94b1('0xda')]=_0x547c8a;}return db['ChatInteraction']['find']({'where':{'id':_0x4195a2[_0x94b1('0xbb')]['id']},'include':[{'model':db[_0x94b1('0xdb')],'as':_0x94b1('0xdc'),'include':[{'model':db['User'],'as':_0x94b1('0x7b')}]}]})[_0x94b1('0x20')](handleEntityNotFound(_0x3925f6,null))[_0x94b1('0x20')](saveUpdates(_0x4195a2[_0x94b1('0x7f')],null))[_0x94b1('0x20')](function(_0x2f495d){if(_0x2f495d){_0x1bb516=_0x2f495d;return db[_0x94b1('0xdd')][_0x94b1('0x75')]({'where':{'id':_0x1bb516[_0x94b1('0x9b')]}});}})['then'](function(_0x1a9d61){if(_0x1a9d61){_0x13a409=_0x1a9d61;return db['CmContact'][_0x94b1('0x75')]({'where':{'id':_0x1bb516['ContactId']}});}})[_0x94b1('0x20')](function(_0x1edb79){if(_0x1edb79){_0x4742f8=_0x1edb79;if(_0x547c8a){var _0x216789=null;for(var _0x452429=0x1;_0x452429<_0x1bb516[_0x94b1('0xdc')][_0x94b1('0x4b')];++_0x452429){_0x216789=_0x1bb516[_0x94b1('0xdc')][_0x452429];var _0x2d5543=_0x216789['UserId']?util['format']('%s%d',_0x13a409[_0x94b1('0xde')],_0x216789[_0x94b1('0x7e')]):_0x94b1('0xdf');var _0x4bae16=_0x4195a2[_0x94b1('0x7f')][_0x94b1('0xe0')]||util[_0x94b1('0xe1')](_0x94b1('0xe2'),_0x94b1('0xe3'),_0x216789['ContactId']);switch(_0x13a409[_0x94b1('0xe4')]){case _0x94b1('0xe5'):_0x2d5543=_0x216789[_0x94b1('0x7e')]?util[_0x94b1('0xe1')](_0x94b1('0xe2'),_0x13a409[_0x94b1('0xde')],_0x216789[_0x94b1('0x7e')]):_0x94b1('0xdf');break;case _0x94b1('0xe6'):_0x2d5543=_0x216789[_0x94b1('0x7e')]?_0x216789[_0x94b1('0x7b')][_0x94b1('0xe7')]||_0x216789[_0x94b1('0x7b')][_0x94b1('0x39')]:'System';break;case _0x94b1('0xe8'):_0x2d5543=_0x216789[_0x94b1('0x7e')]?_0x216789[_0x94b1('0x7b')][_0x94b1('0x39')]:_0x94b1('0xdf');break;default:_0x2d5543=_0x216789[_0x94b1('0x7e')]?util[_0x94b1('0xe1')](_0x94b1('0xe2'),_0x13a409[_0x94b1('0xde')],_0x216789[_0x94b1('0x7e')]):_0x94b1('0xdf');}var _0x4ebe4b=util[_0x94b1('0xe1')](_0x94b1('0xe9'),moment(_0x216789[_0x94b1('0x85')])['format'](_0x94b1('0xea')),_0x216789[_0x94b1('0xeb')]==='in'?_0x4bae16:_0x2d5543,_0x216789[_0x94b1('0x7f')]);if(!_0x216789[_0x94b1('0xec')]){fs['appendFileSync'](_0x547c8a,_0x4ebe4b);}}return db[_0x94b1('0xed')][_0x94b1('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0x94b1('0xee')],'as':'Smtp','raw':!![]}]});}}})[_0x94b1('0x20')](function(_0x509f1a){if(_0x509f1a&&_0x509f1a[_0x94b1('0xef')]&&_0x4195a2[_0x94b1('0x7f')]){var _0x30522d={'tls':{'rejectUnauthorized':![]}};if(_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf0')]){_0x30522d['service']=_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf0')];}else{_0x30522d['host']=_0x509f1a[_0x94b1('0xef')]['host'];_0x30522d[_0x94b1('0xf1')]=_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf1')];_0x30522d[_0x94b1('0xf2')]=_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf2')];}if(_0x509f1a[_0x94b1('0xef')][_0x94b1('0xf3')]){_0x30522d['auth']={'user':_0x509f1a['Smtp'][_0x94b1('0x9d')],'pass':_0x509f1a[_0x94b1('0xef')]['pass']};}return respondWithRpcPromise(_0x94b1('0xf4'),'sendMail',{'account':_0x30522d,'message':{'from':util[_0x94b1('0xe1')]('\x22%s\x22\x20<%s>',_0x509f1a['name'],_0x509f1a['email']||_0x509f1a['Smtp'][_0x94b1('0x9d')]),'to':_0x4195a2['body'][_0x94b1('0xd6')],'subject':_0x94b1('0xf5'),'text':util[_0x94b1('0xe1')](_0x94b1('0xf6'),_0x4195a2['body'][_0x94b1('0xd6')]),'attachments':[{'path':_0x547c8a}]}})[_0x94b1('0x20')](function(){return _0x1bb516;})[_0x94b1('0x3e')](function(_0x112eab){console[_0x94b1('0x27')](_0x112eab);});}else{return _0x1bb516;}})['then'](respondWithStatusCode(_0x3925f6,0xc8))[_0x94b1('0x3e')](handleError(_0x3925f6,null));};exports['addMessage']=function(_0x2f4baf,_0x20830a,_0x221c40){return db[_0x94b1('0xdb')]['find']({'where':{'id':_0x2f4baf['params']['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x20830a,null))['then'](function(_0x460d4e){if(_0x460d4e){return _0x460d4e[_0x94b1('0xf7')](_0x2f4baf[_0x94b1('0x7f')]['ids'],_[_0x94b1('0xf8')](_0x2f4baf[_0x94b1('0x7f')],['ids','id'])||{});}})['then'](respondWithResult(_0x20830a,null))[_0x94b1('0x3e')](handleError(_0x20830a,null));};exports[_0x94b1('0xf9')]=function(_0x562b18,_0xd822e7,_0x35f198){var _0x2f2f21={'raw':![],'where':{}};var _0x23e4b3={};var _0x1a7888={'count':0x0,'rows':[]};return db[_0x94b1('0x40')][_0x94b1('0xce')]({'where':{'id':_0x562b18[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0xd822e7,null))[_0x94b1('0x20')](function(_0x2dcf42){if(_0x2dcf42){_0x23e4b3[_0x94b1('0x47')]=_['keys'](db[_0x94b1('0xdb')]['rawAttributes']);_0x23e4b3[_0x94b1('0x45')]=_[_0x94b1('0x80')](_0x562b18[_0x94b1('0x45')]);_0x23e4b3[_0x94b1('0x46')]=_['intersection'](_0x23e4b3[_0x94b1('0x47')],_0x23e4b3[_0x94b1('0x45')]);_0x2f2f21['attributes']=_[_0x94b1('0x49')](_0x23e4b3[_0x94b1('0x47')],qs['fields'](_0x562b18[_0x94b1('0x45')]['fields']));_0x2f2f21[_0x94b1('0x48')]=_0x2f2f21['attributes'][_0x94b1('0x4b')]?_0x2f2f21[_0x94b1('0x48')]:_0x23e4b3[_0x94b1('0x47')];if(!_0x562b18[_0x94b1('0x45')][_0x94b1('0x4c')](_0x94b1('0x4d'))){_0x2f2f21['limit']=qs[_0x94b1('0x30')](_0x562b18[_0x94b1('0x45')]['limit']);_0x2f2f21[_0x94b1('0x2f')]=qs[_0x94b1('0x2f')](_0x562b18[_0x94b1('0x45')][_0x94b1('0x2f')]);}_0x2f2f21[_0x94b1('0x4e')]=qs[_0x94b1('0xfa')](_0x562b18[_0x94b1('0x45')][_0x94b1('0xfa')]);_0x2f2f21[_0x94b1('0x4f')]=qs[_0x94b1('0x46')](_[_0x94b1('0x50')](_0x562b18[_0x94b1('0x45')],_0x23e4b3[_0x94b1('0x46')]));_0x2f2f21[_0x94b1('0x4f')][_0x94b1('0xfb')]=_0x2dcf42['id'];if(_0x562b18['query'][_0x94b1('0x90')]){_0x2f2f21[_0x94b1('0x4f')]=_[_0x94b1('0xa2')](_0x2f2f21[_0x94b1('0x4f')],{'$or':_[_0x94b1('0x38')](_0x2f2f21[_0x94b1('0x48')],function(_0x3c847f){var _0x2af531={};_0x2af531[_0x3c847f]={'$like':'%'+_0x562b18['query'][_0x94b1('0x90')]+'%'};return _0x2af531;})});}if(_0x562b18[_0x94b1('0x45')][_0x94b1('0x86')]){var _0x206c71=_0x562b18[_0x94b1('0x45')][_0x94b1('0x86')][_0x94b1('0x3c')](',');var _0x51a884={};_0x51a884[_0x206c71[0x0]]={'$gte':moment(_0x206c71[0x1])[_0x94b1('0xe1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2f2f21[_0x94b1('0x4f')]=_['merge'](_0x2f2f21[_0x94b1('0x4f')],_0x51a884);}_0x2f2f21=_['merge']({},_0x2f2f21,_0x562b18['options']);return db[_0x94b1('0xdb')][_0x94b1('0x2e')]({'where':_0x2f2f21[_0x94b1('0x4f')]})[_0x94b1('0x20')](function(_0x40d853){_0x1a7888['count']=_0x40d853;if(_0x562b18[_0x94b1('0x45')][_0x94b1('0xfc')]){_0x2f2f21[_0x94b1('0xbc')]=[{'all':!![]}];}return db['ChatMessage'][_0x94b1('0xfd')](_0x2f2f21);})[_0x94b1('0x20')](function(_0x146dfc){_0x1a7888[_0x94b1('0xba')]=_0x146dfc;return _0x1a7888;});}})[_0x94b1('0x20')](respondWithFilteredResult(_0xd822e7,_0x2f2f21))[_0x94b1('0x3e')](handleError(_0xd822e7,null));};exports[_0x94b1('0xfe')]=function(_0x4ad7db,_0x285419,_0x1375e1){var _0x1f9bd1={'where':{}},_0x32d816={},_0x187582={'count':0x0,'rows':[]};return db[_0x94b1('0x40')][_0x94b1('0xce')]({'where':{'id':_0x4ad7db[_0x94b1('0xbb')]['id']}})['then'](handleEntityNotFound(_0x285419,null))[_0x94b1('0x20')](function(_0x5ddecc){if(_0x5ddecc){_0x32d816[_0x94b1('0x47')]=_[_0x94b1('0x80')](db[_0x94b1('0xdb')][_0x94b1('0x41')]);_0x32d816[_0x94b1('0x45')]=_[_0x94b1('0x80')](_0x4ad7db[_0x94b1('0x45')]);_0x32d816['filters']=_[_0x94b1('0x49')](_0x32d816[_0x94b1('0x47')],_0x32d816['query']);_0x1f9bd1[_0x94b1('0x48')]=_[_0x94b1('0x49')](_0x32d816[_0x94b1('0x47')],qs[_0x94b1('0x4a')](_0x4ad7db[_0x94b1('0x45')][_0x94b1('0x4a')]));_0x1f9bd1['attributes']=_0x1f9bd1[_0x94b1('0x48')][_0x94b1('0x4b')]?_0x1f9bd1['attributes']:_0x32d816[_0x94b1('0x47')];if(!_0x4ad7db[_0x94b1('0x45')][_0x94b1('0x4c')](_0x94b1('0x4d'))){_0x1f9bd1[_0x94b1('0x30')]=qs['limit'](_0x4ad7db['query'][_0x94b1('0x30')]);_0x1f9bd1['offset']=qs[_0x94b1('0x2f')](_0x4ad7db[_0x94b1('0x45')][_0x94b1('0x2f')]);}_0x1f9bd1[_0x94b1('0x4e')]=qs[_0x94b1('0xfa')](_0x4ad7db['query'][_0x94b1('0xfa')]);_0x1f9bd1[_0x94b1('0x4f')]=qs['filters'](_[_0x94b1('0x50')](_0x4ad7db['query'],_0x32d816[_0x94b1('0x46')]));_0x1f9bd1['where']['ChatInteractionId']=_0x5ddecc['id'];if(_0x4ad7db[_0x94b1('0x45')][_0x94b1('0x90')]){_0x1f9bd1[_0x94b1('0x4f')]=_[_0x94b1('0xa2')](_0x1f9bd1[_0x94b1('0x4f')],{'$or':_[_0x94b1('0x38')](_0x1f9bd1[_0x94b1('0x48')],function(_0x578013){var _0x3243db={};_0x3243db[_0x578013]={'$like':'%'+_0x4ad7db['query'][_0x94b1('0x90')]+'%'};return _0x3243db;})});}_0x1f9bd1[_0x94b1('0x4f')]['secret']=![];if(_0x4ad7db[_0x94b1('0x45')]['id']){_0x1f9bd1[_0x94b1('0x4f')]['id']={'$gt':_0x4ad7db[_0x94b1('0x45')]['id']};}_0x1f9bd1=_[_0x94b1('0xa2')]({},_0x1f9bd1,_0x4ad7db[_0x94b1('0xbd')]);return db[_0x94b1('0xdb')][_0x94b1('0x2e')]({'where':_0x1f9bd1['where']})[_0x94b1('0x20')](function(_0x659a05){_0x187582[_0x94b1('0x2e')]=_0x659a05;_0x1f9bd1[_0x94b1('0xbc')]=[];if(_0x4ad7db[_0x94b1('0x45')][_0x94b1('0xff')]){_0x1f9bd1['include'][_0x94b1('0x3d')]({'model':db[_0x94b1('0x7b')],'as':_0x94b1('0x7b'),'attributes':['id',_0x94b1('0x39'),'alias']});}if(_0x4ad7db['query'][_0x94b1('0xfc')]){_0x1f9bd1[_0x94b1('0xbc')]=[{'all':!![]}];}return db['ChatMessage'][_0x94b1('0xfd')](_0x1f9bd1);})[_0x94b1('0x20')](function(_0x23fb6e){_0x187582[_0x94b1('0xba')]=_0x23fb6e;return _0x187582;});}})[_0x94b1('0x20')](respondWithFilteredResult(_0x285419,_0x1f9bd1))[_0x94b1('0x3e')](handleError(_0x285419,null));};exports[_0x94b1('0x100')]=function(_0x268e4f,_0x4484cb,_0x17e886){return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x268e4f[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x4484cb,null))[_0x94b1('0x20')](function(_0x4e5905){if(_0x4e5905){return _0x4e5905[_0x94b1('0x101')](_0x268e4f[_0x94b1('0x7f')][_0x94b1('0x102')],_['omit'](_0x268e4f[_0x94b1('0x7f')],[_0x94b1('0x102'),'id'])||{})['spread'](function(){return db[_0x94b1('0x103')]['findAll']({'attributes':['id','name',_0x94b1('0x53')],'where':{'id':_0x268e4f[_0x94b1('0x7f')][_0x94b1('0x102')]}});})[_0x94b1('0x20')](function(_0x5c7caa){socket[_0x94b1('0x104')]('chatInteractionTags:save',{'id':Number(_0x268e4f[_0x94b1('0xbb')]['id']),'tags':_0x5c7caa||[]});return{'id':Number(_0x268e4f['params']['id']),'tags':_0x5c7caa||[]};});}})['then'](respondWithResult(_0x4484cb,null))['catch'](handleError(_0x4484cb,null));};exports[_0x94b1('0x105')]=function(_0x27baab,_0x23ab4a,_0x5b16f8){return db[_0x94b1('0x40')][_0x94b1('0x75')]({'where':{'id':_0x27baab[_0x94b1('0xbb')]['id']}})[_0x94b1('0x20')](handleEntityNotFound(_0x23ab4a,null))[_0x94b1('0x20')](function(_0x223fd1){if(_0x223fd1){return _0x223fd1[_0x94b1('0x105')](_0x27baab[_0x94b1('0x45')]['ids']);}})[_0x94b1('0x20')](respondWithStatusCode(_0x23ab4a,null))['catch'](handleError(_0x23ab4a,null));};exports[_0x94b1('0x106')]=function(_0xbe4ab5,_0x10d28f){var _0x400b07=moment()[_0x94b1('0x107')]()[_0x94b1('0xa0')]();var _0x2e1cbe=path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],'server',_0x94b1('0x108'),_0x94b1('0x109'));var _0x4beaa8=path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],'server',_0x94b1('0x108'),_0x94b1('0x10a'));var _0x36b436=path[_0x94b1('0xd2')](_0x2e1cbe,_0x400b07);var _0x1f0de4=util[_0x94b1('0xe1')](_0x94b1('0x10b'),_0xbe4ab5[_0x94b1('0xbb')]['id'],_0x400b07);var _0x16136d=path[_0x94b1('0xd2')](_0x2e1cbe,_0x1f0de4);var _0x25a28b=[];_0x25a28b[_0x94b1('0x3d')]({'model':db[_0x94b1('0x7b')],'as':'User','attributes':['id',_0x94b1('0x39')],'raw':!![]});_0x25a28b[_0x94b1('0x3d')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0x94b1('0x10c'),_0x94b1('0x10d')],'raw':!![]});if(_0xbe4ab5[_0x94b1('0x45')][_0x94b1('0x10a')]){_0x25a28b[_0x94b1('0x3d')]({'model':db[_0x94b1('0xd0')],'as':'Attachment','raw':!![]});}var _0x3dd722=[{'model':db['ChatMessage'],'as':_0x94b1('0xdc'),'attributes':['id',_0x94b1('0x7f'),_0x94b1('0x85'),'direction',_0x94b1('0xec'),_0x94b1('0x8b')],'include':_0x25a28b}];_0x3dd722['push']({'model':db[_0x94b1('0xdd')],'as':_0x94b1('0x10e'),'attributes':['id',_0x94b1('0x36')]});_0x3dd722[_0x94b1('0x3d')]({'model':db[_0x94b1('0x7b')],'as':_0x94b1('0x10f'),'attributes':['id',_0x94b1('0x39')]});return db['ChatInteraction'][_0x94b1('0x75')]({'where':{'id':_0xbe4ab5['params']['id']},'include':_0x3dd722})[_0x94b1('0x20')](handleEntityNotFound(_0x10d28f,null))['then'](function(_0x2d4863){if(_0x2d4863){var _0x527204=_0x2d4863[_0x94b1('0x110')]({'plain':!![]});fs[_0x94b1('0x111')](_0x36b436);var _0x252c8f={'format':'A4','border':_0x94b1('0x112'),'header':{'height':_0x94b1('0x113'),'contents':{'first':_0x94b1('0x114')}},'footer':{'height':_0x94b1('0x115'),'contents':{'default':util[_0x94b1('0xe1')]('\x0a\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[_0x94b1('0xe1')](_0x94b1('0x116'),_0x94b1('0x117'),_0x527204['id']),moment()['format'](_0x94b1('0x118'))[_0x94b1('0xa0')]())}}};var _0x1046b8={'channel':_0x94b1('0x117'),'account':_0x527204[_0x94b1('0x10e')][_0x94b1('0x36')],'agent':_0x527204[_0x94b1('0x10f')]?_0x527204['Owner']['fullname']:_0x94b1('0x119'),'createdAt':moment(_0x527204[_0x94b1('0x85')])[_0x94b1('0xe1')](_0x94b1('0x11a'))[_0x94b1('0xa0')](),'closedAt':_0x527204[_0x94b1('0xc5')]?moment(_0x527204[_0x94b1('0x11b')])[_0x94b1('0xe1')](_0x94b1('0x11a'))[_0x94b1('0xa0')]():'','disposition':_0x527204[_0x94b1('0xc6')],'chatInfo':{'browser':_0x527204[_0x94b1('0x11c')],'os':_0x527204['osName'],'referer':_0x527204['referer'],'customerIp':_0x527204[_0x94b1('0x11d')],'customerPort':_0x527204['customerPort']?_0x527204['customerPort']:_0x94b1('0x119')},'messages':_(_0x527204[_0x94b1('0xdc')])[_0x94b1('0x11e')]()[_0x94b1('0x90')]({'secret':![]})[_0x94b1('0x38')](function(_0x1bed17){if(_0x1bed17[_0x94b1('0xd0')]){var _0x136ac3=path[_0x94b1('0xd2')](_0x4beaa8,_0x1bed17['Attachment']['basename']);if(fs[_0x94b1('0x11f')](_0x136ac3)){fs[_0x94b1('0x120')](_0x136ac3)[_0x94b1('0x121')](fs['createWriteStream'](path[_0x94b1('0xd2')](_0x36b436,_0x1bed17['Attachment'][_0x94b1('0xc9')])));}}return{'date':moment(_0x1bed17[_0x94b1('0x85')])['format'](_0x94b1('0x11a'))['toString'](),'sender':_0x1bed17[_0x94b1('0xeb')]===_0x94b1('0x122')?_0x1bed17[_0x94b1('0x7b')]?_0x1bed17[_0x94b1('0x7b')][_0x94b1('0x39')]:_0x94b1('0xdf'):_0x1bed17[_0x94b1('0x123')][_0x94b1('0x10c')]+(_0x1bed17['Contact']['lastName']?'\x20'+_0x1bed17[_0x94b1('0x123')][_0x94b1('0x10d')]:''),'body':_0x1bed17[_0x94b1('0xd0')]?_0x1bed17[_0x94b1('0xd0')][_0x94b1('0xc9')]:_0x1bed17[_0x94b1('0x7f')],'direction':_0x1bed17[_0x94b1('0xeb')]==='out'?'A':'C','secret':_0x1bed17['secret'],'read':_0x1bed17[_0x94b1('0x8b')],'attachment':_0x1bed17['Attachment']};})['value']()};return ejs['renderFile'](path[_0x94b1('0xd2')](config[_0x94b1('0xd3')],_0x94b1('0x124'),_0x94b1('0x125'),_0x94b1('0x126')),{'interaction':_0x1046b8})['then'](function(_0x42fdec){return new BPromise(function(_0x49e927,_0x4fa504){pdf['create'](_0x42fdec,_0x252c8f)[_0x94b1('0x127')](path[_0x94b1('0xd2')](_0x36b436,_0x94b1('0x128')+_0x527204['id']+'-'+_0x400b07+_0x94b1('0x129')),function(_0x46eecd,_0x376f68){if(_0x46eecd)return _0x4fa504(_0x46eecd);_0x49e927(_0x376f68);});});})[_0x94b1('0x20')](function(){return new BPromise(function(_0x39958f,_0xbc244b){zipdir(_0x36b436,{'saveTo':_0x16136d},function(_0x6ee6d2,_0x267a44){if(_0x6ee6d2)return _0xbc244b(_0x6ee6d2);return _0x39958f(_0x267a44);});})[_0x94b1('0x20')](function(){return new BPromise(function(_0x64e990,_0xeeef69){rimraf(_0x36b436,function(_0x5d0ddd){if(_0x5d0ddd)_0xeeef69(_0x5d0ddd);return _0x64e990();});});})[_0x94b1('0x20')](function(){return _0x10d28f[_0x94b1('0x106')](_0x16136d,_0x1f0de4,function(_0x3bee5e){if(_0x3bee5e){console[_0x94b1('0x12a')]('err',_0x3bee5e);}else{fs[_0x94b1('0x12b')](_0x16136d);}});});});}else{return _0x10d28f[_0x94b1('0x2a')](0xc8);}})[_0x94b1('0x3e')](handleError(_0x10d28f,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index c1e7f7a..8be9fc1 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 _0xa93a=['length','emit','catch','hasOwnProperty','ChatInteraction','setMaxListeners','update','getUsers','setDataValue','map','findAll','then'];(function(_0x14caeb,_0x2a9c55){var _0x395418=function(_0x5e85f9){while(--_0x5e85f9){_0x14caeb['push'](_0x14caeb['shift']());}};_0x395418(++_0x2a9c55);}(_0xa93a,0xb8));var _0xaa93=function(_0x59eb88,_0xfdceed){_0x59eb88=_0x59eb88-0x0;var _0x5a3ea5=_0xa93a[_0x59eb88];return _0x5a3ea5;};'use strict';var EventEmitter=require('events');var ChatInteraction=require('../../mysqldb')['db'][_0xaa93('0x0')];var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xaa93('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa93('0x2'),'afterDestroy':'remove'};function emitEvent(_0x242aa2){return function(_0x181549,_0x2705c9,_0xed4247){_0x181549[_0xaa93('0x3')]({'attributes':['id'],'raw':!![]})['then'](function(_0x353544){_0x181549[_0xaa93('0x4')]('Users',_0x353544[_0xaa93('0x5')](function(_0x4bb171){return{'id':_0x4bb171['id']};}));return ChatMessage[_0xaa93('0x6')]({'where':{'ChatInteractionId':_0x181549['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaa93('0x7')](function(_0x5409d9){_0x181549['setDataValue']('unreadMessages',_0x5409d9[_0xaa93('0x8')]);ChatInteractionEvents['emit'](_0x242aa2+':'+_0x181549['id'],_0x181549);ChatInteractionEvents[_0xaa93('0x9')](_0x242aa2,_0x181549);_0xed4247(null);})[_0xaa93('0xa')](_0xed4247(null));};}for(var e in events){if(events[_0xaa93('0xb')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xbb4d=['map','findAll','length','emit','catch','hasOwnProperty','hook','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users'];(function(_0x10f168,_0x2c7474){var _0x54bb66=function(_0x5e88c3){while(--_0x5e88c3){_0x10f168['push'](_0x10f168['shift']());}};_0x54bb66(++_0x2c7474);}(_0xbb4d,0x19f));var _0xdbb4=function(_0x259b25,_0x37fe57){_0x259b25=_0x259b25-0x0;var _0x531cad=_0xbb4d[_0x259b25];return _0x531cad;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xdbb4('0x0'))['db'][_0xdbb4('0x1')];var ChatMessage=require(_0xdbb4('0x0'))['db'][_0xdbb4('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xdbb4('0x3')](0x0);var events={'afterCreate':_0xdbb4('0x4'),'afterUpdate':'update','afterDestroy':_0xdbb4('0x5')};function emitEvent(_0x38fb8f){return function(_0x32b8ed,_0xdeed84,_0x584d4d){_0x32b8ed[_0xdbb4('0x6')]({'attributes':['id'],'raw':!![]})[_0xdbb4('0x7')](function(_0x3ff7d2){_0x32b8ed[_0xdbb4('0x8')](_0xdbb4('0x9'),_0x3ff7d2[_0xdbb4('0xa')](function(_0x5c8216){return{'id':_0x5c8216['id']};}));return ChatMessage[_0xdbb4('0xb')]({'where':{'ChatInteractionId':_0x32b8ed['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdbb4('0x7')](function(_0x429227){_0x32b8ed[_0xdbb4('0x8')]('unreadMessages',_0x429227[_0xdbb4('0xc')]);ChatInteractionEvents[_0xdbb4('0xd')](_0x38fb8f+':'+_0x32b8ed['id'],_0x32b8ed);ChatInteractionEvents[_0xdbb4('0xd')](_0x38fb8f,_0x32b8ed);_0x584d4d(null);})[_0xdbb4('0xe')](_0x584d4d(null));};}for(var e in events){if(events[_0xdbb4('0xf')](e)){var event=events[e];ChatInteraction[_0xdbb4('0x10')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 3cf3912..17bd2f9 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 _0x26a4=['./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closedAt','format','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26a4,0x1aa));var _0x426a=function(_0x4f4bed,_0x4dff8f){_0x4f4bed=_0x4f4bed-0x0;var _0x1bb1d4=_0x26a4[_0x4f4bed];return _0x1bb1d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x426a('0x0'))(_0x426a('0x1'));var moment=require(_0x426a('0x2'));var BPromise=require(_0x426a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x426a('0x4'));var rimraf=require('rimraf');var config=require(_0x426a('0x5'));var attributes=require(_0x426a('0x6'));module[_0x426a('0x7')]=function(_0x31bfc8,_0x807e32){return _0x31bfc8[_0x426a('0x8')](_0x426a('0x9'),attributes,{'tableName':_0x426a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f5273,_0x8df642,_0x13eaf1){if(_0x3f5273[_0x426a('0xb')]('closed')){_0x3f5273[_0x426a('0xc')]=moment()[_0x426a('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x13eaf1(null,_0x3f5273);}},'charset':_0x426a('0xe'),'collate':_0x426a('0xf')});}; \ No newline at end of file +var _0x3972=['moment','bluebird','request-promise','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x5dcbc9,_0x258bef){var _0x427be4=function(_0xf4eb5a){while(--_0xf4eb5a){_0x5dcbc9['push'](_0x5dcbc9['shift']());}};_0x427be4(++_0x258bef);}(_0x3972,0x152));var _0x2397=function(_0x18f988,_0x439998){_0x18f988=_0x18f988-0x0;var _0x7d4d43=_0x3972[_0x18f988];return _0x7d4d43;};'use strict';var _=require(_0x2397('0x0'));var util=require('util');var logger=require(_0x2397('0x1'))('api');var moment=require(_0x2397('0x2'));var BPromise=require(_0x2397('0x3'));var rp=require(_0x2397('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2397('0x5'));var attributes=require('./chatInteraction.attributes');module[_0x2397('0x6')]=function(_0x3bd2ee,_0x3795df){return _0x3bd2ee[_0x2397('0x7')](_0x2397('0x8'),attributes,{'tableName':_0x2397('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25fd35,_0x474ec0,_0x3596e9){if(_0x25fd35[_0x2397('0xa')](_0x2397('0xb'))){_0x25fd35[_0x2397('0xc')]=moment()[_0x2397('0xd')](_0x2397('0xe'));}_0x3596e9(null,_0x25fd35);}},'charset':_0x2397('0xf'),'collate':_0x2397('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index d294731..377a1d6 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 _0x2d80=['update','options','raw','where','attributes','debug','AddTagsToChatInteraction','find','body','omit','spread','AddTags','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction'];(function(_0x3ac3c9,_0xe0bde0){var _0x357ef7=function(_0x339167){while(--_0x339167){_0x3ac3c9['push'](_0x3ac3c9['shift']());}};_0x357ef7(++_0xe0bde0);}(_0x2d80,0xdf));var _0x02d8=function(_0x4bd8e1,_0x5e9388){_0x4bd8e1=_0x4bd8e1-0x0;var _0x286282=_0x2d80[_0x4bd8e1];return _0x286282;};'use strict';var _=require(_0x02d8('0x0'));var util=require(_0x02d8('0x1'));var moment=require(_0x02d8('0x2'));var BPromise=require(_0x02d8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02d8('0x4'));var db=require(_0x02d8('0x5'))['db'];var utils=require(_0x02d8('0x6'));var logger=require(_0x02d8('0x7'))(_0x02d8('0x8'));var config=require(_0x02d8('0x9'));var jayson=require(_0x02d8('0xa'));var client=jayson[_0x02d8('0xb')]['http']({'port':0x232a});config['redis']=_[_0x02d8('0xc')](config[_0x02d8('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x02d8('0xe'))(new Redis(config[_0x02d8('0xd')]));require(_0x02d8('0xf'))[_0x02d8('0x10')](socket);function respondWithRpcPromise(_0x539b31,_0x4ce21d,_0x549dfe){return new BPromise(function(_0x587c5f,_0x37e756){return client[_0x02d8('0x11')](_0x539b31,_0x549dfe)[_0x02d8('0x12')](function(_0x36b2f5){logger['info'](_0x02d8('0x13'),_0x4ce21d,'request\x20sent');logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4ce21d,_0x02d8('0x14'),JSON['stringify'](_0x36b2f5));if(_0x36b2f5[_0x02d8('0x15')]){if(_0x36b2f5[_0x02d8('0x15')][_0x02d8('0x16')]===0x1f4){logger[_0x02d8('0x15')](_0x02d8('0x13'),_0x4ce21d,_0x36b2f5[_0x02d8('0x15')]['message']);return _0x37e756(_0x36b2f5[_0x02d8('0x15')][_0x02d8('0x17')]);}logger[_0x02d8('0x15')](_0x02d8('0x13'),_0x4ce21d,_0x36b2f5[_0x02d8('0x15')][_0x02d8('0x17')]);return _0x587c5f(_0x36b2f5[_0x02d8('0x15')]['message']);}else{logger[_0x02d8('0x18')](_0x02d8('0x13'),_0x4ce21d,_0x02d8('0x14'));_0x587c5f(_0x36b2f5[_0x02d8('0x19')][_0x02d8('0x17')]);}})[_0x02d8('0x1a')](function(_0x1b716d){logger[_0x02d8('0x15')](_0x02d8('0x13'),_0x4ce21d,_0x1b716d);_0x37e756(_0x1b716d);});});}exports[_0x02d8('0x1b')]=function(_0x677fe9){var _0x549b1f=this;return new Promise(function(_0x572a34,_0x36db41){return db[_0x02d8('0x1c')][_0x02d8('0x1d')](_0x677fe9['body'],{'raw':_0x677fe9['options']?_0x677fe9[_0x02d8('0x1e')][_0x02d8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x677fe9['options']?_0x677fe9['options'][_0x02d8('0x20')]||null:null,'attributes':_0x677fe9[_0x02d8('0x1e')]?_0x677fe9[_0x02d8('0x1e')][_0x02d8('0x21')]||null:null,'limit':_0x677fe9[_0x02d8('0x1e')]?_0x677fe9[_0x02d8('0x1e')]['limit']||null:null})[_0x02d8('0x12')](function(_0x2803cd){logger[_0x02d8('0x18')](_0x02d8('0x1b'),_0x677fe9);logger[_0x02d8('0x22')](_0x02d8('0x1b'),_0x677fe9,JSON['stringify'](_0x2803cd));_0x572a34(_0x2803cd);})[_0x02d8('0x1a')](function(_0xd12527){logger[_0x02d8('0x15')](_0x02d8('0x1b'),_0xd12527[_0x02d8('0x17')],_0x677fe9);_0x36db41(_0x549b1f[_0x02d8('0x15')](0x1f4,_0xd12527[_0x02d8('0x17')]));});});};exports[_0x02d8('0x23')]=function(_0xcff579){return new Promise(function(_0x47e526,_0x793ab0){return db[_0x02d8('0x1c')][_0x02d8('0x24')]({'where':_0xcff579[_0x02d8('0x1e')]?_0xcff579['options']['where']||null:null})[_0x02d8('0x12')](function(_0x1f393b){if(_0x1f393b){return _0x1f393b['addTags'](_0xcff579[_0x02d8('0x25')]['ids'],_[_0x02d8('0x26')](_0xcff579['body'],['ids','id'])||{});}})[_0x02d8('0x27')](function(_0x15a209){logger[_0x02d8('0x18')](_0x02d8('0x28'),_0xcff579);logger['debug'](_0x02d8('0x28'),_0xcff579,JSON[_0x02d8('0x29')](_0x15a209));_0x47e526(_0x15a209);})['catch'](function(_0x39337e){logger[_0x02d8('0x15')]('AddTags',_0x39337e['message'],_0xcff579);_0x793ab0(_this['error'](0x1f4,_0x39337e[_0x02d8('0x17')]));});});}; \ No newline at end of file +var _0x4218=['AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','localhost','socket.io-emitter','redis','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','limit','debug','AddTagsToChatInteraction','find','addTags','body','omit','ids','spread'];(function(_0x5c0f10,_0x156f30){var _0x47cf65=function(_0x53d8b1){while(--_0x53d8b1){_0x5c0f10['push'](_0x5c0f10['shift']());}};_0x47cf65(++_0x156f30);}(_0x4218,0x127));var _0x8421=function(_0x5e3f02,_0x407aae){_0x5e3f02=_0x5e3f02-0x0;var _0x594f19=_0x4218[_0x5e3f02];return _0x594f19;};'use strict';var _=require(_0x8421('0x0'));var util=require(_0x8421('0x1'));var moment=require(_0x8421('0x2'));var BPromise=require('bluebird');var rs=require(_0x8421('0x3'));var fs=require('fs');var Redis=require(_0x8421('0x4'));var db=require(_0x8421('0x5'))['db'];var utils=require(_0x8421('0x6'));var logger=require(_0x8421('0x7'))(_0x8421('0x8'));var config=require('../../config/environment');var jayson=require(_0x8421('0x9'));var client=jayson[_0x8421('0xa')][_0x8421('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x8421('0xc'),'port':0x18eb});var socket=require(_0x8421('0xd'))(new Redis(config[_0x8421('0xe')]));require('./chatInteraction.socket')[_0x8421('0xf')](socket);function respondWithRpcPromise(_0x18b391,_0x4de64a,_0x4c9124){return new BPromise(function(_0x432398,_0x44f8d9){return client[_0x8421('0x10')](_0x18b391,_0x4c9124)[_0x8421('0x11')](function(_0x48802c){logger[_0x8421('0x12')](_0x8421('0x13'),_0x4de64a,_0x8421('0x14'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x4de64a,'request\x20sent',JSON[_0x8421('0x15')](_0x48802c));if(_0x48802c[_0x8421('0x16')]){if(_0x48802c['error'][_0x8421('0x17')]===0x1f4){logger[_0x8421('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x4de64a,_0x48802c[_0x8421('0x16')][_0x8421('0x18')]);return _0x44f8d9(_0x48802c[_0x8421('0x16')][_0x8421('0x18')]);}logger['error'](_0x8421('0x13'),_0x4de64a,_0x48802c[_0x8421('0x16')][_0x8421('0x18')]);return _0x432398(_0x48802c[_0x8421('0x16')][_0x8421('0x18')]);}else{logger[_0x8421('0x12')](_0x8421('0x13'),_0x4de64a,_0x8421('0x14'));_0x432398(_0x48802c['result']['message']);}})[_0x8421('0x19')](function(_0x18cfd9){logger[_0x8421('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x4de64a,_0x18cfd9);_0x44f8d9(_0x18cfd9);});});}exports[_0x8421('0x1a')]=function(_0x2ad392){var _0x591290=this;return new Promise(function(_0x45d5bc,_0x550756){return db[_0x8421('0x1b')][_0x8421('0x1c')](_0x2ad392['body'],{'raw':_0x2ad392[_0x8421('0x1d')]?_0x2ad392[_0x8421('0x1d')][_0x8421('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ad392['options']?_0x2ad392[_0x8421('0x1d')][_0x8421('0x1f')]||null:null,'attributes':_0x2ad392[_0x8421('0x1d')]?_0x2ad392[_0x8421('0x1d')]['attributes']||null:null,'limit':_0x2ad392['options']?_0x2ad392['options'][_0x8421('0x20')]||null:null})[_0x8421('0x11')](function(_0x2ea2d9){logger[_0x8421('0x12')]('UpdateChatInteraction',_0x2ad392);logger[_0x8421('0x21')](_0x8421('0x1a'),_0x2ad392,JSON[_0x8421('0x15')](_0x2ea2d9));_0x45d5bc(_0x2ea2d9);})[_0x8421('0x19')](function(_0x1904d3){logger[_0x8421('0x16')](_0x8421('0x1a'),_0x1904d3[_0x8421('0x18')],_0x2ad392);_0x550756(_0x591290[_0x8421('0x16')](0x1f4,_0x1904d3[_0x8421('0x18')]));});});};exports[_0x8421('0x22')]=function(_0x79caf5){return new Promise(function(_0x531959,_0x50f78a){return db[_0x8421('0x1b')][_0x8421('0x23')]({'where':_0x79caf5[_0x8421('0x1d')]?_0x79caf5['options'][_0x8421('0x1f')]||null:null})[_0x8421('0x11')](function(_0x4471a8){if(_0x4471a8){return _0x4471a8[_0x8421('0x24')](_0x79caf5[_0x8421('0x25')]['ids'],_[_0x8421('0x26')](_0x79caf5[_0x8421('0x25')],[_0x8421('0x27'),'id'])||{});}})[_0x8421('0x28')](function(_0x1c4e85){logger[_0x8421('0x12')](_0x8421('0x29'),_0x79caf5);logger[_0x8421('0x21')](_0x8421('0x29'),_0x79caf5,JSON[_0x8421('0x15')](_0x1c4e85));_0x531959(_0x1c4e85);})[_0x8421('0x19')](function(_0x121a01){logger[_0x8421('0x16')]('AddTags',_0x121a01[_0x8421('0x18')],_0x79caf5);_0x50f78a(_this[_0x8421('0x16')](0x1f4,_0x121a01[_0x8421('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 419292f..f5562e2 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 _0x0ad3=['emit','register','./chatInteraction.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0ad3,0x188));var _0x30ad=function(_0x301ee6,_0x5aff44){_0x301ee6=_0x301ee6-0x0;var _0x2024be=_0x0ad3[_0x301ee6];return _0x2024be;};'use strict';var ChatInteractionEvents=require(_0x30ad('0x0'));var events=[_0x30ad('0x1'),_0x30ad('0x2'),'update'];function createListener(_0x4e7e36,_0x5d7535){return function(_0x3d174f){_0x5d7535[_0x30ad('0x3')](_0x4e7e36,_0x3d174f);};}function removeListener(_0x512096,_0x264989){return function(){ChatInteractionEvents['removeListener'](_0x512096,_0x264989);};}exports[_0x30ad('0x4')]=function(_0x261dd1){for(var _0x2c7c2f=0x0,_0x22bed7=events['length'];_0x2c7c2f<_0x22bed7;_0x2c7c2f++){var _0x3f7bb1=events[_0x2c7c2f];var _0x51e01b=createListener('chatInteraction:'+_0x3f7bb1,_0x261dd1);ChatInteractionEvents['on'](_0x3f7bb1,_0x51e01b);}}; \ No newline at end of file +var _0xfbcb=['length','chatInteraction:','./chatInteraction.events','save','remove','emit','register'];(function(_0x1703c6,_0x42c17f){var _0x5e0b6d=function(_0x400189){while(--_0x400189){_0x1703c6['push'](_0x1703c6['shift']());}};_0x5e0b6d(++_0x42c17f);}(_0xfbcb,0x18a));var _0xbfbc=function(_0x54ceab,_0x5addfc){_0x54ceab=_0x54ceab-0x0;var _0x1e4e18=_0xfbcb[_0x54ceab];return _0x1e4e18;};'use strict';var ChatInteractionEvents=require(_0xbfbc('0x0'));var events=[_0xbfbc('0x1'),_0xbfbc('0x2'),'update'];function createListener(_0x2fac03,_0x35c2c7){return function(_0xcdd87e){_0x35c2c7[_0xbfbc('0x3')](_0x2fac03,_0xcdd87e);};}function removeListener(_0x4825ac,_0xa8985e){return function(){ChatInteractionEvents['removeListener'](_0x4825ac,_0xa8985e);};}exports[_0xbfbc('0x4')]=function(_0x34183a){for(var _0x116c43=0x0,_0x391f6c=events[_0xbfbc('0x5')];_0x116c43<_0x391f6c;_0x116c43++){var _0x244901=events[_0x116c43];var _0x3e9bc9=createListener(_0xbfbc('0x6')+_0x244901,_0x34183a);ChatInteractionEvents['on'](_0x244901,_0x3e9bc9);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 80e29f5..1af48a8 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 _0x6c64=['isAuthenticated','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','join','root','server/files/attachments/','format','%s-%s','now','replace','file','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','update','/:id/custom_update','abandon','/:id/close','close','delete','chatinteraction:destroy','removeTags','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get'];(function(_0x478209,_0x27d57b){var _0x443ec4=function(_0x3c647f){while(--_0x3c647f){_0x478209['push'](_0x478209['shift']());}};_0x443ec4(++_0x27d57b);}(_0x6c64,0x16f));var _0x46c6=function(_0x4d72f7,_0x23c8b0){_0x4d72f7=_0x4d72f7-0x0;var _0x52c441=_0x6c64[_0x4d72f7];return _0x52c441;};'use strict';var multer=require('multer');var util=require(_0x46c6('0x0'));var path=require(_0x46c6('0x1'));var timeout=require(_0x46c6('0x2'));var express=require(_0x46c6('0x3'));var router=express[_0x46c6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x46c6('0x5'));var config=require(_0x46c6('0x6'));var controller=require(_0x46c6('0x7'));router[_0x46c6('0x8')]('/',auth[_0x46c6('0x9')](),controller['index']);router[_0x46c6('0x8')](_0x46c6('0xa'),auth[_0x46c6('0x9')](),controller[_0x46c6('0xb')]);router[_0x46c6('0x8')]('/:id',auth[_0x46c6('0xc')](),controller[_0x46c6('0xd')]);router[_0x46c6('0x8')](_0x46c6('0xe'),auth[_0x46c6('0xc')](),controller[_0x46c6('0xf')]);router[_0x46c6('0x8')]('/:id/messages',auth['isAuthenticated'](),controller[_0x46c6('0x10')]);router['get'](_0x46c6('0x11'),auth[_0x46c6('0xc')](),controller[_0x46c6('0x12')]);router[_0x46c6('0x8')](_0x46c6('0x13'),auth['isAuthenticated'](),controller[_0x46c6('0x14')]);router[_0x46c6('0x15')]('/',auth['isAuthenticated'](),controller[_0x46c6('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xafd79c,_0x2a0af7,_0x28f333){_0x28f333(null,path[_0x46c6('0x17')](config[_0x46c6('0x18')],_0x46c6('0x19')));},'filename':function(_0x571426,_0x555d90,_0x2ca908){_0x2ca908(null,util[_0x46c6('0x1a')](_0x46c6('0x1b'),Date[_0x46c6('0x1c')](),_0x555d90['originalname'][_0x46c6('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x46c6('0x15')]('/:id/attachment_upload',upload['single'](_0x46c6('0x1e')),controller['attachmentUpload']);router[_0x46c6('0x15')]('/:id/messages',auth[_0x46c6('0xc')](),controller['addMessage']);router[_0x46c6('0x15')](_0x46c6('0x1f'),auth['isAuthenticated'](),interaction[_0x46c6('0x20')](_0x46c6('0x21'),_0x46c6('0x22')),controller[_0x46c6('0x23')]);router[_0x46c6('0x24')](_0x46c6('0x25'),auth[_0x46c6('0x9')](),interaction[_0x46c6('0x20')](_0x46c6('0x21'),_0x46c6('0x26')),controller[_0x46c6('0x27')]);router[_0x46c6('0x24')](_0x46c6('0x28'),controller['customUpdate']);router[_0x46c6('0x24')]('/:id/abandon',auth['isChatInteractionAuthorized'](),controller[_0x46c6('0x29')]);router[_0x46c6('0x24')](_0x46c6('0x2a'),controller[_0x46c6('0x2b')]);router[_0x46c6('0x2c')](_0x46c6('0x25'),auth[_0x46c6('0x9')](),interaction[_0x46c6('0x20')](_0x46c6('0x21'),_0x46c6('0x2d')),controller['destroy']);router[_0x46c6('0x2c')](_0x46c6('0x1f'),auth[_0x46c6('0x9')](),controller[_0x46c6('0x2e')]);module['exports']=router; \ No newline at end of file +var _0x9038=['describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','post','create','diskStorage','server/files/attachments/','format','%s-%s','now','replace','/:id/attachment_upload','file','addMessage','/:id/tags','chatinteraction:addtags','put','chat','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','tracked','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','/describe'];(function(_0x5a92eb,_0x25c5c1){var _0x28ea30=function(_0x3f5056){while(--_0x3f5056){_0x5a92eb['push'](_0x5a92eb['shift']());}};_0x28ea30(++_0x25c5c1);}(_0x9038,0x1d4));var _0x8903=function(_0x1506be,_0x114985){_0x1506be=_0x1506be-0x0;var _0x4de90d=_0x9038[_0x1506be];return _0x4de90d;};'use strict';var multer=require(_0x8903('0x0'));var util=require(_0x8903('0x1'));var path=require(_0x8903('0x2'));var timeout=require(_0x8903('0x3'));var express=require('express');var router=express[_0x8903('0x4')]();var auth=require(_0x8903('0x5'));var interaction=require(_0x8903('0x6'));var config=require(_0x8903('0x7'));var controller=require(_0x8903('0x8'));router[_0x8903('0x9')]('/',auth[_0x8903('0xa')](),controller['index']);router[_0x8903('0x9')](_0x8903('0xb'),auth['isAuthenticated'](),controller[_0x8903('0xc')]);router[_0x8903('0x9')](_0x8903('0xd'),auth[_0x8903('0xe')](),controller['show']);router[_0x8903('0x9')](_0x8903('0xf'),auth[_0x8903('0xe')](),controller[_0x8903('0x10')]);router[_0x8903('0x9')](_0x8903('0x11'),auth[_0x8903('0xa')](),controller[_0x8903('0x12')]);router[_0x8903('0x9')](_0x8903('0x13'),auth[_0x8903('0xe')](),controller[_0x8903('0x14')]);router[_0x8903('0x9')](_0x8903('0x15'),auth[_0x8903('0xa')](),controller['download']);router[_0x8903('0x16')]('/',auth[_0x8903('0xa')](),controller[_0x8903('0x17')]);var upload=multer({'storage':multer[_0x8903('0x18')]({'destination':function(_0x555878,_0x538cc5,_0x305a01){_0x305a01(null,path['join'](config['root'],_0x8903('0x19')));},'filename':function(_0x41c2db,_0x49133b,_0x448c59){_0x448c59(null,util[_0x8903('0x1a')](_0x8903('0x1b'),Date[_0x8903('0x1c')](),_0x49133b['originalname'][_0x8903('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x8903('0x1e'),upload['single'](_0x8903('0x1f')),controller['attachmentUpload']);router[_0x8903('0x16')](_0x8903('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x8903('0x20')]);router[_0x8903('0x16')](_0x8903('0x21'),auth[_0x8903('0xa')](),interaction['tracked']('chat',_0x8903('0x22')),controller['addTags']);router[_0x8903('0x23')](_0x8903('0xd'),auth[_0x8903('0xa')](),interaction['tracked'](_0x8903('0x24'),'chatinteraction:update'),controller['update']);router[_0x8903('0x23')](_0x8903('0x25'),controller[_0x8903('0x26')]);router[_0x8903('0x23')](_0x8903('0x27'),auth[_0x8903('0xe')](),controller['abandon']);router[_0x8903('0x23')](_0x8903('0x28'),controller[_0x8903('0x29')]);router[_0x8903('0x2a')](_0x8903('0xd'),auth[_0x8903('0xa')](),interaction[_0x8903('0x2b')]('chat',_0x8903('0x2c')),controller[_0x8903('0x2d')]);router[_0x8903('0x2a')](_0x8903('0x21'),auth[_0x8903('0xa')](),controller[_0x8903('0x2e')]);module[_0x8903('0x2f')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 7b0d6d0..18cdf60 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 _0x66fa=['exports','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x34917f,_0x445740){var _0x672dc4=function(_0x5bee0f){while(--_0x5bee0f){_0x34917f['push'](_0x34917f['shift']());}};_0x672dc4(++_0x445740);}(_0x66fa,0x117));var _0xa66f=function(_0x481a03,_0x27a80b){_0x481a03=_0x481a03-0x0;var _0x149186=_0x66fa[_0x481a03];return _0x149186;};'use strict';var Sequelize=require(_0xa66f('0x0'));module[_0xa66f('0x1')]={'body':{'type':Sequelize['TEXT'](_0xa66f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa66f('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa66f('0x4')]}}; \ No newline at end of file +var _0x57ca=['exports','TEXT','BOOLEAN','INTEGER'];(function(_0x56ee7a,_0x21d880){var _0x8594e7=function(_0x14a049){while(--_0x14a049){_0x56ee7a['push'](_0x56ee7a['shift']());}};_0x8594e7(++_0x21d880);}(_0x57ca,0x108));var _0xa57c=function(_0x24b9c5,_0x2672cd){_0x24b9c5=_0x24b9c5-0x0;var _0x27fd24=_0x57ca[_0x24b9c5];return _0x27fd24;};'use strict';var Sequelize=require('sequelize');module[_0xa57c('0x0')]={'body':{'type':Sequelize[_0xa57c('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xa57c('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa57c('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 11b7d3a..e626d8f 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 _0xca91=['nolimit','order','sort','where','filters','pick','filter','merge','name','options','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','body','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','resourceId','push','FromId','ToId','read','-createdAt','all','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','limit','set','json','reject','update','then','destroy','error','stack','send','index','map','key','query','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xca91,0x1ea));var _0x1ca9=function(_0x438fe1,_0x3308d5){_0x438fe1=_0x438fe1-0x0;var _0x3c8e1b=_0xca91[_0x438fe1];return _0x3c8e1b;};'use strict';var pdf=require(_0x1ca9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1ca9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ca9('0x2'));var rp=require(_0x1ca9('0x3'));var moment=require(_0x1ca9('0x4'));var BPromise=require(_0x1ca9('0x5'));var Mustache=require(_0x1ca9('0x6'));var util=require(_0x1ca9('0x7'));var path=require(_0x1ca9('0x8'));var sox=require(_0x1ca9('0x9'));var csv=require('to-csv');var ejs=require(_0x1ca9('0xa'));var fs=require('fs');var _=require(_0x1ca9('0xb'));var squel=require(_0x1ca9('0xc'));var crypto=require('crypto');var jsforce=require(_0x1ca9('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1ca9('0xe'));var Papa=require(_0x1ca9('0xf'));var Redis=require(_0x1ca9('0x10'));var authService=require(_0x1ca9('0x11'));var qs=require(_0x1ca9('0x12'));var as=require(_0x1ca9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ca9('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1ca9('0x15'))['db'];config[_0x1ca9('0x16')]=_[_0x1ca9('0x17')](config[_0x1ca9('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ca9('0x18'))(new Redis(config[_0x1ca9('0x16')]));require('./chatInternalMessage.socket')[_0x1ca9('0x19')](socket);function respondWithStatusCode(_0x179fb2,_0x7d0f3d){_0x7d0f3d=_0x7d0f3d||0xcc;return function(_0x24cf68){if(_0x24cf68){return _0x179fb2[_0x1ca9('0x1a')](_0x7d0f3d);}return _0x179fb2[_0x1ca9('0x1b')](_0x7d0f3d)[_0x1ca9('0x1c')]();};}function respondWithResult(_0xa88699,_0x4d99cc){_0x4d99cc=_0x4d99cc||0xc8;return function(_0x598b77){if(_0x598b77){return _0xa88699[_0x1ca9('0x1b')](_0x4d99cc)['json'](_0x598b77);}};}function respondWithFilteredResult(_0x59c749,_0x555472){return function(_0x8689dd){if(_0x8689dd){var _0x4ba075=_0x8689dd['count'],_0x417ef9=_0x555472[_0x1ca9('0x1d')],_0x168b26=_0x555472[_0x1ca9('0x1d')]+_0x555472[_0x1ca9('0x1e')],_0x28aae7;if(_0x168b26>=_0x4ba075){_0x168b26=_0x4ba075;_0x28aae7=0xc8;}else{_0x28aae7=0xce;}_0x59c749[_0x1ca9('0x1b')](_0x28aae7);return _0x59c749[_0x1ca9('0x1f')]('Content-Range',_0x417ef9+'-'+_0x168b26+'/'+_0x4ba075)[_0x1ca9('0x20')](_0x8689dd);}return null;};}function patchUpdates(_0x40a5bc){return function(_0x13a086){try{jsonpatch['apply'](_0x13a086,_0x40a5bc,!![]);}catch(_0x100b54){return BPromise[_0x1ca9('0x21')](_0x100b54);}return _0x13a086['save']();};}function saveUpdates(_0x395715,_0x4da7c4){return function(_0xc38a7f){if(_0xc38a7f){return _0xc38a7f[_0x1ca9('0x22')](_0x395715)[_0x1ca9('0x23')](function(_0x43f30b){return _0x43f30b;});}return null;};}function removeEntity(_0x168409,_0x195f69){return function(_0x375757){if(_0x375757){return _0x375757[_0x1ca9('0x24')]()[_0x1ca9('0x23')](function(){_0x168409['status'](0xcc)[_0x1ca9('0x1c')]();});}};}function handleEntityNotFound(_0x16b6bb,_0x8b3ce3){return function(_0x17086e){if(!_0x17086e){_0x16b6bb[_0x1ca9('0x1a')](0x194);}return _0x17086e;};}function handleError(_0x1cb8d9,_0x4d603c){_0x4d603c=_0x4d603c||0x1f4;return function(_0x1365d1){logger[_0x1ca9('0x25')](_0x1365d1[_0x1ca9('0x26')]);if(_0x1365d1['name']){delete _0x1365d1['name'];}_0x1cb8d9['status'](_0x4d603c)[_0x1ca9('0x27')](_0x1365d1);};}exports[_0x1ca9('0x28')]=function(_0x7537e6,_0x5a4ad9){var _0x5ba109={},_0x58a325={},_0xdee0ca={'count':0x0,'rows':[]};var _0x22e37a=_[_0x1ca9('0x29')](db['ChatInternalMessage']['rawAttributes'],function(_0x281bea){return{'name':_0x281bea['fieldName'],'type':_0x281bea['type'][_0x1ca9('0x2a')]};});_0x58a325['model']=_['map'](_0x22e37a,'name');_0x58a325[_0x1ca9('0x2b')]=_['keys'](_0x7537e6[_0x1ca9('0x2b')]);_0x58a325['filters']=_[_0x1ca9('0x2c')](_0x58a325[_0x1ca9('0x2d')],_0x58a325[_0x1ca9('0x2b')]);_0x5ba109[_0x1ca9('0x2e')]=_[_0x1ca9('0x2c')](_0x58a325[_0x1ca9('0x2d')],qs[_0x1ca9('0x2f')](_0x7537e6[_0x1ca9('0x2b')][_0x1ca9('0x2f')]));_0x5ba109['attributes']=_0x5ba109[_0x1ca9('0x2e')][_0x1ca9('0x30')]?_0x5ba109[_0x1ca9('0x2e')]:_0x58a325['model'];if(!_0x7537e6[_0x1ca9('0x2b')][_0x1ca9('0x31')](_0x1ca9('0x32'))){_0x5ba109[_0x1ca9('0x1e')]=qs['limit'](_0x7537e6[_0x1ca9('0x2b')][_0x1ca9('0x1e')]);_0x5ba109['offset']=qs['offset'](_0x7537e6[_0x1ca9('0x2b')][_0x1ca9('0x1d')]);}_0x5ba109[_0x1ca9('0x33')]=qs['sort'](_0x7537e6['query'][_0x1ca9('0x34')]);_0x5ba109[_0x1ca9('0x35')]=qs[_0x1ca9('0x36')](_[_0x1ca9('0x37')](_0x7537e6[_0x1ca9('0x2b')],_0x58a325[_0x1ca9('0x36')]));if(_0x7537e6[_0x1ca9('0x2b')][_0x1ca9('0x38')]){_0x5ba109['where']=_[_0x1ca9('0x39')](_0x5ba109['where'],{'$or':_[_0x1ca9('0x29')](_0x22e37a,function(_0x142136){if(_0x142136['type']!=='VIRTUAL'){var _0x2d54cd={};_0x2d54cd[_0x142136[_0x1ca9('0x3a')]]={'$like':'%'+_0x7537e6[_0x1ca9('0x2b')][_0x1ca9('0x38')]+'%'};return _0x2d54cd;}})});}_0x5ba109=_[_0x1ca9('0x39')]({},_0x5ba109,_0x7537e6[_0x1ca9('0x3b')]);var _0x26a7d2={'where':_0x5ba109[_0x1ca9('0x35')]};return db[_0x1ca9('0x3c')]['count'](_0x26a7d2)['then'](function(_0x1b3846){_0xdee0ca['count']=_0x1b3846;if(_0x7537e6[_0x1ca9('0x2b')][_0x1ca9('0x3d')]){_0x5ba109[_0x1ca9('0x3e')]=[{'all':!![]}];}return db[_0x1ca9('0x3c')][_0x1ca9('0x3f')](_0x5ba109);})[_0x1ca9('0x23')](function(_0x1e849d){_0xdee0ca[_0x1ca9('0x40')]=_0x1e849d;return _0xdee0ca;})[_0x1ca9('0x23')](respondWithFilteredResult(_0x5a4ad9,_0x5ba109))[_0x1ca9('0x41')](handleError(_0x5a4ad9,null));};exports[_0x1ca9('0x42')]=function(_0x56280b,_0x36b633){var _0x572968={'raw':!![],'where':{'id':_0x56280b[_0x1ca9('0x43')]['id']}},_0x18c3e0={};_0x18c3e0['model']=_[_0x1ca9('0x44')](db['ChatInternalMessage'][_0x1ca9('0x45')]);_0x18c3e0[_0x1ca9('0x2b')]=_[_0x1ca9('0x44')](_0x56280b[_0x1ca9('0x2b')]);_0x18c3e0[_0x1ca9('0x36')]=_[_0x1ca9('0x2c')](_0x18c3e0[_0x1ca9('0x2d')],_0x18c3e0['query']);_0x572968[_0x1ca9('0x2e')]=_[_0x1ca9('0x2c')](_0x18c3e0[_0x1ca9('0x2d')],qs['fields'](_0x56280b[_0x1ca9('0x2b')]['fields']));_0x572968['attributes']=_0x572968[_0x1ca9('0x2e')]['length']?_0x572968[_0x1ca9('0x2e')]:_0x18c3e0[_0x1ca9('0x2d')];if(_0x56280b[_0x1ca9('0x2b')][_0x1ca9('0x3d')]){_0x572968[_0x1ca9('0x3e')]=[{'all':!![]}];}_0x572968=_[_0x1ca9('0x39')]({},_0x572968,_0x56280b[_0x1ca9('0x3b')]);return db['ChatInternalMessage']['find'](_0x572968)[_0x1ca9('0x23')](handleEntityNotFound(_0x36b633,null))[_0x1ca9('0x23')](respondWithResult(_0x36b633,null))[_0x1ca9('0x41')](handleError(_0x36b633,null));};exports[_0x1ca9('0x46')]=function(_0x327ae1,_0x4e58fa){return db[_0x1ca9('0x3c')][_0x1ca9('0x46')](_0x327ae1[_0x1ca9('0x47')],{})[_0x1ca9('0x23')](respondWithResult(_0x4e58fa,0xc9))[_0x1ca9('0x41')](handleError(_0x4e58fa,null));};exports[_0x1ca9('0x22')]=function(_0x13f8f5,_0x323d61){if(_0x13f8f5[_0x1ca9('0x47')]['id']){delete _0x13f8f5['body']['id'];}return db[_0x1ca9('0x3c')][_0x1ca9('0x48')]({'where':{'id':_0x13f8f5[_0x1ca9('0x43')]['id']}})[_0x1ca9('0x23')](handleEntityNotFound(_0x323d61,null))['then'](saveUpdates(_0x13f8f5['body'],null))['then'](respondWithResult(_0x323d61,null))['catch'](handleError(_0x323d61,null));};exports[_0x1ca9('0x24')]=function(_0x2873ab,_0x15bb6c){return db[_0x1ca9('0x3c')][_0x1ca9('0x48')]({'where':{'id':_0x2873ab[_0x1ca9('0x43')]['id']}})[_0x1ca9('0x23')](handleEntityNotFound(_0x15bb6c,null))[_0x1ca9('0x23')](removeEntity(_0x15bb6c,null))[_0x1ca9('0x41')](handleError(_0x15bb6c,null));};exports[_0x1ca9('0x49')]=function(_0x3b3320,_0x59ed94){return db['ChatInternalMessage'][_0x1ca9('0x49')]()['then'](respondWithResult(_0x59ed94,null))[_0x1ca9('0x41')](handleError(_0x59ed94,null));};function wrapUser(_0x38e2bc){return function(_0x240cfe){var _0x393e24=_0x38e2bc[_0x1ca9('0x4a')]({'plain':!![]});_0x393e24[_0x1ca9('0x4b')]=[];if(_0x240cfe){_0x393e24[_0x1ca9('0x4c')]=_0x240cfe[_0x1ca9('0x4d')];_0x393e24[_0x1ca9('0x4e')]=_0x240cfe;}else{_0x393e24['lastMessageAt']=moment(0x0)['format'](_0x1ca9('0x4f'));_0x393e24[_0x1ca9('0x4e')]={};}return _0x393e24;};}exports[_0x1ca9('0x50')]=function(_0x150f97,_0x427065,_0x512e98){var _0x1fb768=[];return db[_0x1ca9('0x51')][_0x1ca9('0x3f')]({'where':{'role':[_0x1ca9('0x52'),_0x1ca9('0x53'),_0x1ca9('0x54')]},'attributes':['id',_0x1ca9('0x55'),_0x1ca9('0x3a'),_0x1ca9('0x56'),_0x1ca9('0x57'),_0x1ca9('0x58'),_0x1ca9('0x59'),_0x1ca9('0x5a'),_0x1ca9('0x5b'),_0x1ca9('0x5c')],'order':qs[_0x1ca9('0x34')](_0x1ca9('0x5d')),'include':[{'model':db[_0x1ca9('0x5e')],'as':_0x1ca9('0x5f'),'attributes':['id',_0x1ca9('0x3a'),'type'],'through':{'attributes':[]}}]})[_0x1ca9('0x23')](function(_0x6aab59){if(_0x6aab59){var _0x227272=_0x150f97['user'][_0x1ca9('0x4a')]({'plain':!![]});if(!_0x227272)throw new Error(_0x1ca9('0x60'));if(_0x227272[_0x1ca9('0x56')]===_0x1ca9('0x54')){return db[_0x1ca9('0x61')]['find']({'where':{'name':_0x1ca9('0x62'),'userProfileId':_0x227272[_0x1ca9('0x63')]},'raw':!![]})['then'](function(_0x476812){if(_0x476812){if(_0x476812['autoAssociation']===0x0){return db[_0x1ca9('0x64')][_0x1ca9('0x3f')]({'where':{'sectionId':_0x476812['id']},'raw':!![]})[_0x1ca9('0x23')](function(_0x42abfd){var _0xb668d3=[];if(_['isEmpty'](_0x42abfd)){_0xb668d3=_[_0x1ca9('0x38')](_0x6aab59,function(_0x41537d){if(_0x41537d[_0x1ca9('0x56')]!==_0x1ca9('0x52')){return _0x41537d;}});return _0xb668d3;}else{for(var _0x46aa5e=0x0;_0x46aa5e<_0x6aab59['length'];_0x46aa5e++){var _0x222f0b=_0x6aab59[_0x46aa5e];if(_0x222f0b[_0x1ca9('0x56')]==='agent'){var _0x538e5b=_[_0x1ca9('0x48')](_0x42abfd,function(_0x504737){return _0x504737[_0x1ca9('0x65')]===_0x222f0b['id'];});if(_0x538e5b)_0xb668d3['push'](_0x222f0b);}else{_0xb668d3[_0x1ca9('0x66')](_0x222f0b);}}return _0xb668d3;}});}else{return _0x6aab59;}}else{var _0x4cd979=_['filter'](_0x6aab59,function(_0x382273){if(_0x382273[_0x1ca9('0x56')]!=='agent'){return _0x382273;}});return _0x4cd979;}});}else{return _0x6aab59;}}})[_0x1ca9('0x23')](function(_0x2a9e1e){var _0x15c4a3=[];if(_0x2a9e1e){_0x1fb768=_0x2a9e1e;for(var _0x490395=0x0;_0x490395<_0x2a9e1e[_0x1ca9('0x30')];_0x490395+=0x1){_0x1fb768[_0x490395][_0x1ca9('0x4b')]=[];_0x15c4a3[_0x1ca9('0x66')](db[_0x1ca9('0x3c')][_0x1ca9('0x48')]({'where':{'FromId':[_0x150f97[_0x1ca9('0x54')]['id'],_0x2a9e1e[_0x490395]['id']],'ToId':[_0x150f97['user']['id'],_0x2a9e1e[_0x490395]['id']],'ChatGroupId':null},'attributes':['id',_0x1ca9('0x4d'),_0x1ca9('0x67'),_0x1ca9('0x68'),_0x1ca9('0x69'),'body'],'order':qs[_0x1ca9('0x34')](_0x1ca9('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x1ca9('0x23')](wrapUser(_0x2a9e1e[_0x490395])));}return BPromise[_0x1ca9('0x6b')](_0x15c4a3);}return[];})['then'](function(_0xc25899){return{'rows':_0xc25899,'count':_0xc25899[_0x1ca9('0x30')]};})[_0x1ca9('0x23')](respondWithResult(_0x427065,null))[_0x1ca9('0x41')](handleError(_0x427065,null));}; \ No newline at end of file +var _0x139a=['-createdAt','all','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','ChatInternalMessage','includeAll','include','rows','catch','show','params','find','create','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','user','fullname','role','userpic','online','allowmessenger','-online','VoiceQueue','VoiceQueues','get','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read'];(function(_0x15005a,_0x35a6b9){var _0x4d12c6=function(_0x414ed3){while(--_0x414ed3){_0x15005a['push'](_0x15005a['shift']());}};_0x4d12c6(++_0x35a6b9);}(_0x139a,0x155));var _0xa139=function(_0x1d5866,_0x43ff2d){_0x1d5866=_0x1d5866-0x0;var _0x5009e1=_0x139a[_0x1d5866];return _0x5009e1;};'use strict';var pdf=require(_0xa139('0x0'));var emlformat=require(_0xa139('0x1'));var rimraf=require(_0xa139('0x2'));var zipdir=require(_0xa139('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa139('0x4'));var BPromise=require(_0xa139('0x5'));var Mustache=require('mustache');var util=require(_0xa139('0x6'));var path=require(_0xa139('0x7'));var sox=require(_0xa139('0x8'));var csv=require('to-csv');var ejs=require(_0xa139('0x9'));var fs=require('fs');var _=require(_0xa139('0xa'));var squel=require(_0xa139('0xb'));var crypto=require(_0xa139('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xa139('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa139('0xe'));var Papa=require(_0xa139('0xf'));var Redis=require(_0xa139('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa139('0x11'));var as=require(_0xa139('0x12'));var hardwareService=require(_0xa139('0x13'));var logger=require(_0xa139('0x14'))(_0xa139('0x15'));var utils=require(_0xa139('0x16'));var config=require(_0xa139('0x17'));var db=require(_0xa139('0x18'))['db'];config[_0xa139('0x19')]=_[_0xa139('0x1a')](config[_0xa139('0x19')],{'host':_0xa139('0x1b'),'port':0x18eb});var socket=require(_0xa139('0x1c'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xa139('0x1d')](socket);function respondWithStatusCode(_0x5f377a,_0x129bce){_0x129bce=_0x129bce||0xcc;return function(_0x30d750){if(_0x30d750){return _0x5f377a[_0xa139('0x1e')](_0x129bce);}return _0x5f377a[_0xa139('0x1f')](_0x129bce)[_0xa139('0x20')]();};}function respondWithResult(_0x1b96f5,_0x22f259){_0x22f259=_0x22f259||0xc8;return function(_0x49cbc9){if(_0x49cbc9){return _0x1b96f5[_0xa139('0x1f')](_0x22f259)[_0xa139('0x21')](_0x49cbc9);}};}function respondWithFilteredResult(_0x10e1b5,_0x151975){return function(_0x356ada){if(_0x356ada){var _0x9a47da=_0x356ada[_0xa139('0x22')],_0x41a803=_0x151975[_0xa139('0x23')],_0x19f8d4=_0x151975['offset']+_0x151975[_0xa139('0x24')],_0x447734;if(_0x19f8d4>=_0x9a47da){_0x19f8d4=_0x9a47da;_0x447734=0xc8;}else{_0x447734=0xce;}_0x10e1b5[_0xa139('0x1f')](_0x447734);return _0x10e1b5['set'](_0xa139('0x25'),_0x41a803+'-'+_0x19f8d4+'/'+_0x9a47da)[_0xa139('0x21')](_0x356ada);}return null;};}function patchUpdates(_0x15ffe2){return function(_0x48d33c){try{jsonpatch[_0xa139('0x26')](_0x48d33c,_0x15ffe2,!![]);}catch(_0x29113a){return BPromise[_0xa139('0x27')](_0x29113a);}return _0x48d33c[_0xa139('0x28')]();};}function saveUpdates(_0x468d4f,_0x45250e){return function(_0x1fe761){if(_0x1fe761){return _0x1fe761[_0xa139('0x29')](_0x468d4f)[_0xa139('0x2a')](function(_0x3a502f){return _0x3a502f;});}return null;};}function removeEntity(_0x7be11a,_0x1eac58){return function(_0x183db8){if(_0x183db8){return _0x183db8[_0xa139('0x2b')]()[_0xa139('0x2a')](function(){_0x7be11a['status'](0xcc)[_0xa139('0x20')]();});}};}function handleEntityNotFound(_0x54657f,_0x373336){return function(_0x11dc0b){if(!_0x11dc0b){_0x54657f[_0xa139('0x1e')](0x194);}return _0x11dc0b;};}function handleError(_0x4550f5,_0x4504bd){_0x4504bd=_0x4504bd||0x1f4;return function(_0x1682b3){logger[_0xa139('0x2c')](_0x1682b3[_0xa139('0x2d')]);if(_0x1682b3[_0xa139('0x2e')]){delete _0x1682b3[_0xa139('0x2e')];}_0x4550f5['status'](_0x4504bd)[_0xa139('0x2f')](_0x1682b3);};}exports[_0xa139('0x30')]=function(_0x46d318,_0x558a3e){var _0x1d354a={},_0x5ed4f3={},_0x3b9c81={'count':0x0,'rows':[]};var _0x57d94c=_[_0xa139('0x31')](db['ChatInternalMessage'][_0xa139('0x32')],function(_0x2befb0){return{'name':_0x2befb0[_0xa139('0x33')],'type':_0x2befb0[_0xa139('0x34')]['key']};});_0x5ed4f3[_0xa139('0x35')]=_[_0xa139('0x31')](_0x57d94c,_0xa139('0x2e'));_0x5ed4f3[_0xa139('0x36')]=_[_0xa139('0x37')](_0x46d318[_0xa139('0x36')]);_0x5ed4f3[_0xa139('0x38')]=_['intersection'](_0x5ed4f3[_0xa139('0x35')],_0x5ed4f3[_0xa139('0x36')]);_0x1d354a[_0xa139('0x39')]=_[_0xa139('0x3a')](_0x5ed4f3[_0xa139('0x35')],qs[_0xa139('0x3b')](_0x46d318[_0xa139('0x36')][_0xa139('0x3b')]));_0x1d354a[_0xa139('0x39')]=_0x1d354a[_0xa139('0x39')][_0xa139('0x3c')]?_0x1d354a[_0xa139('0x39')]:_0x5ed4f3['model'];if(!_0x46d318[_0xa139('0x36')]['hasOwnProperty']('nolimit')){_0x1d354a[_0xa139('0x24')]=qs['limit'](_0x46d318[_0xa139('0x36')][_0xa139('0x24')]);_0x1d354a[_0xa139('0x23')]=qs['offset'](_0x46d318[_0xa139('0x36')][_0xa139('0x23')]);}_0x1d354a[_0xa139('0x3d')]=qs[_0xa139('0x3e')](_0x46d318[_0xa139('0x36')]['sort']);_0x1d354a[_0xa139('0x3f')]=qs['filters'](_[_0xa139('0x40')](_0x46d318[_0xa139('0x36')],_0x5ed4f3[_0xa139('0x38')]));if(_0x46d318[_0xa139('0x36')][_0xa139('0x41')]){_0x1d354a['where']=_['merge'](_0x1d354a[_0xa139('0x3f')],{'$or':_[_0xa139('0x31')](_0x57d94c,function(_0x2ea4c2){if(_0x2ea4c2[_0xa139('0x34')]!==_0xa139('0x42')){var _0x480efc={};_0x480efc[_0x2ea4c2[_0xa139('0x2e')]]={'$like':'%'+_0x46d318[_0xa139('0x36')][_0xa139('0x41')]+'%'};return _0x480efc;}})});}_0x1d354a=_[_0xa139('0x43')]({},_0x1d354a,_0x46d318[_0xa139('0x44')]);var _0x53ff5a={'where':_0x1d354a[_0xa139('0x3f')]};return db[_0xa139('0x45')][_0xa139('0x22')](_0x53ff5a)[_0xa139('0x2a')](function(_0x18108b){_0x3b9c81[_0xa139('0x22')]=_0x18108b;if(_0x46d318[_0xa139('0x36')][_0xa139('0x46')]){_0x1d354a[_0xa139('0x47')]=[{'all':!![]}];}return db[_0xa139('0x45')]['findAll'](_0x1d354a);})[_0xa139('0x2a')](function(_0x15357e){_0x3b9c81[_0xa139('0x48')]=_0x15357e;return _0x3b9c81;})[_0xa139('0x2a')](respondWithFilteredResult(_0x558a3e,_0x1d354a))[_0xa139('0x49')](handleError(_0x558a3e,null));};exports[_0xa139('0x4a')]=function(_0x44cfda,_0xba4a0e){var _0x2a7dc5={'raw':!![],'where':{'id':_0x44cfda[_0xa139('0x4b')]['id']}},_0x404bfc={};_0x404bfc[_0xa139('0x35')]=_[_0xa139('0x37')](db[_0xa139('0x45')][_0xa139('0x32')]);_0x404bfc[_0xa139('0x36')]=_[_0xa139('0x37')](_0x44cfda[_0xa139('0x36')]);_0x404bfc['filters']=_[_0xa139('0x3a')](_0x404bfc[_0xa139('0x35')],_0x404bfc[_0xa139('0x36')]);_0x2a7dc5['attributes']=_[_0xa139('0x3a')](_0x404bfc[_0xa139('0x35')],qs[_0xa139('0x3b')](_0x44cfda[_0xa139('0x36')]['fields']));_0x2a7dc5['attributes']=_0x2a7dc5['attributes'][_0xa139('0x3c')]?_0x2a7dc5[_0xa139('0x39')]:_0x404bfc['model'];if(_0x44cfda['query'][_0xa139('0x46')]){_0x2a7dc5[_0xa139('0x47')]=[{'all':!![]}];}_0x2a7dc5=_[_0xa139('0x43')]({},_0x2a7dc5,_0x44cfda[_0xa139('0x44')]);return db[_0xa139('0x45')][_0xa139('0x4c')](_0x2a7dc5)['then'](handleEntityNotFound(_0xba4a0e,null))['then'](respondWithResult(_0xba4a0e,null))['catch'](handleError(_0xba4a0e,null));};exports[_0xa139('0x4d')]=function(_0x1ed529,_0x520fc2){return db[_0xa139('0x45')][_0xa139('0x4d')](_0x1ed529[_0xa139('0x4e')],{})['then'](respondWithResult(_0x520fc2,0xc9))[_0xa139('0x49')](handleError(_0x520fc2,null));};exports[_0xa139('0x29')]=function(_0x168f89,_0x56646e){if(_0x168f89[_0xa139('0x4e')]['id']){delete _0x168f89[_0xa139('0x4e')]['id'];}return db[_0xa139('0x45')][_0xa139('0x4c')]({'where':{'id':_0x168f89['params']['id']}})[_0xa139('0x2a')](handleEntityNotFound(_0x56646e,null))[_0xa139('0x2a')](saveUpdates(_0x168f89[_0xa139('0x4e')],null))[_0xa139('0x2a')](respondWithResult(_0x56646e,null))[_0xa139('0x49')](handleError(_0x56646e,null));};exports[_0xa139('0x2b')]=function(_0x4f6a59,_0x5c7ce7){return db[_0xa139('0x45')][_0xa139('0x4c')]({'where':{'id':_0x4f6a59['params']['id']}})[_0xa139('0x2a')](handleEntityNotFound(_0x5c7ce7,null))['then'](removeEntity(_0x5c7ce7,null))[_0xa139('0x49')](handleError(_0x5c7ce7,null));};exports[_0xa139('0x4f')]=function(_0x5b0317,_0x4e0d41){return db[_0xa139('0x45')][_0xa139('0x4f')]()[_0xa139('0x2a')](respondWithResult(_0x4e0d41,null))[_0xa139('0x49')](handleError(_0x4e0d41,null));};function wrapUser(_0xe65f71){return function(_0x2112ad){var _0xe01d9=_0xe65f71['get']({'plain':!![]});_0xe01d9[_0xa139('0x50')]=[];if(_0x2112ad){_0xe01d9[_0xa139('0x51')]=_0x2112ad[_0xa139('0x52')];_0xe01d9[_0xa139('0x53')]=_0x2112ad;}else{_0xe01d9[_0xa139('0x51')]=moment(0x0)[_0xa139('0x54')](_0xa139('0x55'));_0xe01d9[_0xa139('0x53')]={};}return _0xe01d9;};}exports[_0xa139('0x56')]=function(_0x78b349,_0x14f6e5,_0x1ca884){var _0x49901e=[];return db[_0xa139('0x57')][_0xa139('0x58')]({'where':{'role':[_0xa139('0x59'),'admin',_0xa139('0x5a')]},'attributes':['id',_0xa139('0x5b'),_0xa139('0x2e'),_0xa139('0x5c'),_0xa139('0x5d'),'internal',_0xa139('0x5e'),'lastLoginAt',_0xa139('0x5f'),'showWebBar'],'order':qs[_0xa139('0x3e')](_0xa139('0x60')),'include':[{'model':db[_0xa139('0x61')],'as':_0xa139('0x62'),'attributes':['id','name',_0xa139('0x34')],'through':{'attributes':[]}}]})['then'](function(_0x29de8d){if(_0x29de8d){var _0x33cc81=_0x78b349[_0xa139('0x5a')][_0xa139('0x63')]({'plain':!![]});if(!_0x33cc81)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33cc81[_0xa139('0x5c')]==='user'){return db[_0xa139('0x64')][_0xa139('0x4c')]({'where':{'name':_0xa139('0x65'),'userProfileId':_0x33cc81[_0xa139('0x66')]},'raw':!![]})[_0xa139('0x2a')](function(_0x382acd){if(_0x382acd){if(_0x382acd[_0xa139('0x67')]===0x0){return db[_0xa139('0x68')][_0xa139('0x58')]({'where':{'sectionId':_0x382acd['id']},'raw':!![]})[_0xa139('0x2a')](function(_0x5a0e83){var _0x2cc305=[];if(_[_0xa139('0x69')](_0x5a0e83)){_0x2cc305=_[_0xa139('0x41')](_0x29de8d,function(_0x1e084e){if(_0x1e084e[_0xa139('0x5c')]!==_0xa139('0x59')){return _0x1e084e;}});return _0x2cc305;}else{for(var _0x3517ea=0x0;_0x3517ea<_0x29de8d[_0xa139('0x3c')];_0x3517ea++){var _0x1f8560=_0x29de8d[_0x3517ea];if(_0x1f8560[_0xa139('0x5c')]===_0xa139('0x59')){var _0x3f1586=_[_0xa139('0x4c')](_0x5a0e83,function(_0x144371){return _0x144371[_0xa139('0x6a')]===_0x1f8560['id'];});if(_0x3f1586)_0x2cc305[_0xa139('0x6b')](_0x1f8560);}else{_0x2cc305[_0xa139('0x6b')](_0x1f8560);}}return _0x2cc305;}});}else{return _0x29de8d;}}else{var _0x11819c=_[_0xa139('0x41')](_0x29de8d,function(_0x54a9ad){if(_0x54a9ad[_0xa139('0x5c')]!==_0xa139('0x59')){return _0x54a9ad;}});return _0x11819c;}});}else{return _0x29de8d;}}})[_0xa139('0x2a')](function(_0x37d602){var _0x298aa1=[];if(_0x37d602){_0x49901e=_0x37d602;for(var _0x7f7272=0x0;_0x7f7272<_0x37d602[_0xa139('0x3c')];_0x7f7272+=0x1){_0x49901e[_0x7f7272][_0xa139('0x50')]=[];_0x298aa1['push'](db[_0xa139('0x45')]['find']({'where':{'FromId':[_0x78b349['user']['id'],_0x37d602[_0x7f7272]['id']],'ToId':[_0x78b349[_0xa139('0x5a')]['id'],_0x37d602[_0x7f7272]['id']],'ChatGroupId':null},'attributes':['id',_0xa139('0x52'),_0xa139('0x6c'),_0xa139('0x6d'),_0xa139('0x6e'),'body'],'order':qs['sort'](_0xa139('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xa139('0x2a')](wrapUser(_0x37d602[_0x7f7272])));}return BPromise[_0xa139('0x70')](_0x298aa1);}return[];})[_0xa139('0x2a')](function(_0x2df791){return{'rows':_0x2df791,'count':_0x2df791['length']};})[_0xa139('0x2a')](respondWithResult(_0x14f6e5,null))[_0xa139('0x49')](handleError(_0x14f6e5,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 02d9440..ba7d6d9 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 _0xe5d5=['save','remove','emit','hasOwnProperty','hook','exports','ChatInternalMessage'];(function(_0xf200cc,_0x19c4ed){var _0x444ad6=function(_0x59f387){while(--_0x59f387){_0xf200cc['push'](_0xf200cc['shift']());}};_0x444ad6(++_0x19c4ed);}(_0xe5d5,0x156));var _0x5e5d=function(_0x1ed9d2,_0x1fabab){_0x1ed9d2=_0x1ed9d2-0x0;var _0x183b09=_0xe5d5[_0x1ed9d2];return _0x183b09;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x5e5d('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5e5d('0x1'),'afterUpdate':'update','afterDestroy':_0x5e5d('0x2')};function emitEvent(_0x5127ee){return function(_0x3e2410,_0x191980,_0x32c471){ChatInternalMessageEvents[_0x5e5d('0x3')](_0x5127ee+':'+_0x3e2410['id'],_0x3e2410);ChatInternalMessageEvents[_0x5e5d('0x3')](_0x5127ee,_0x3e2410);_0x32c471(null);};}for(var e in events){if(events[_0x5e5d('0x4')](e)){var event=events[e];ChatInternalMessage[_0x5e5d('0x5')](e,emitEvent(event));}}module[_0x5e5d('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x6d65=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x43d814,_0x55d11a){var _0x4f8389=function(_0x3d917e){while(--_0x3d917e){_0x43d814['push'](_0x43d814['shift']());}};_0x4f8389(++_0x55d11a);}(_0x6d65,0x100));var _0x56d6=function(_0x4e57e2,_0x8d67a2){_0x4e57e2=_0x4e57e2-0x0;var _0x11ac0e=_0x6d65[_0x4e57e2];return _0x11ac0e;};'use strict';var EventEmitter=require(_0x56d6('0x0'));var ChatInternalMessage=require(_0x56d6('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x56d6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x56d6('0x3'),'afterDestroy':_0x56d6('0x4')};function emitEvent(_0x5ba563){return function(_0x36f63b,_0x2f1716,_0x86a2c){ChatInternalMessageEvents[_0x56d6('0x5')](_0x5ba563+':'+_0x36f63b['id'],_0x36f63b);ChatInternalMessageEvents[_0x56d6('0x5')](_0x5ba563,_0x36f63b);_0x86a2c(null);};}for(var e in events){if(events[_0x56d6('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x56d6('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index d116686..a0cab5e 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 _0xb7e7=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','define'];(function(_0x9dae9,_0x1cb9b2){var _0x1f07e9=function(_0xfccefd){while(--_0xfccefd){_0x9dae9['push'](_0x9dae9['shift']());}};_0x1f07e9(++_0x1cb9b2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xb7e7[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b7e('0x9'),'collate':_0x7b7e('0xa')});}; \ No newline at end of file +var _0xb7e7=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','define'];(function(_0x5833e7,_0x3d3958){var _0x5778a5=function(_0x4bf11c){while(--_0x4bf11c){_0x5833e7['push'](_0x5833e7['shift']());}};_0x5778a5(++_0x3d3958);}(_0xb7e7,0x121));var _0x7b7e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb7e7[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7b7e('0x9'),'collate':_0x7b7e('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 85dcd55..90a5ee4 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 _0x8d3b=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x332fdc,_0x148c1a){var _0x493ef4=function(_0x3f3b2b){while(--_0x3f3b2b){_0x332fdc['push'](_0x332fdc['shift']());}};_0x493ef4(++_0x148c1a);}(_0x8d3b,0x155));var _0xb8d3=function(_0x1f1011,_0x106d51){_0x1f1011=_0x1f1011-0x0;var _0x4eb6bb=_0x8d3b[_0x1f1011];return _0x4eb6bb;};'use strict';var _=require(_0xb8d3('0x0'));var util=require(_0xb8d3('0x1'));var moment=require(_0xb8d3('0x2'));var BPromise=require(_0xb8d3('0x3'));var rs=require(_0xb8d3('0x4'));var fs=require('fs');var Redis=require(_0xb8d3('0x5'));var db=require(_0xb8d3('0x6'))['db'];var utils=require(_0xb8d3('0x7'));var logger=require(_0xb8d3('0x8'))(_0xb8d3('0x9'));var config=require(_0xb8d3('0xa'));var jayson=require(_0xb8d3('0xb'));var client=jayson[_0xb8d3('0xc')][_0xb8d3('0xd')]({'port':0x232a});config[_0xb8d3('0xe')]=_[_0xb8d3('0xf')](config['redis'],{'host':_0xb8d3('0x10'),'port':0x18eb});var socket=require(_0xb8d3('0x11'))(new Redis(config[_0xb8d3('0xe')]));require(_0xb8d3('0x12'))[_0xb8d3('0x13')](socket);function respondWithRpcPromise(_0x281a16,_0x52a7a1,_0x5e6526){return new BPromise(function(_0x13a2c3,_0x4eb2a7){return client[_0xb8d3('0x14')](_0x281a16,_0x5e6526)[_0xb8d3('0x15')](function(_0x12fcf8){logger['info'](_0xb8d3('0x16'),_0x52a7a1,_0xb8d3('0x17'));logger[_0xb8d3('0x18')](_0xb8d3('0x19'),_0x52a7a1,_0xb8d3('0x17'),JSON[_0xb8d3('0x1a')](_0x12fcf8));if(_0x12fcf8[_0xb8d3('0x1b')]){if(_0x12fcf8[_0xb8d3('0x1b')][_0xb8d3('0x1c')]===0x1f4){logger[_0xb8d3('0x1b')]('ChatInternalMessage,\x20%s,\x20%s',_0x52a7a1,_0x12fcf8[_0xb8d3('0x1b')][_0xb8d3('0x1d')]);return _0x4eb2a7(_0x12fcf8['error']['message']);}logger[_0xb8d3('0x1b')](_0xb8d3('0x16'),_0x52a7a1,_0x12fcf8['error'][_0xb8d3('0x1d')]);return _0x13a2c3(_0x12fcf8[_0xb8d3('0x1b')][_0xb8d3('0x1d')]);}else{logger[_0xb8d3('0x1e')](_0xb8d3('0x16'),_0x52a7a1,_0xb8d3('0x17'));_0x13a2c3(_0x12fcf8['result']['message']);}})[_0xb8d3('0x1f')](function(_0x23e25d){logger[_0xb8d3('0x1b')]('ChatInternalMessage,\x20%s,\x20%s',_0x52a7a1,_0x23e25d);_0x4eb2a7(_0x23e25d);});});} \ No newline at end of file +var _0xac0b=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatInternalMessage.socket','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x109dc3,_0xf6b661){var _0x41a1c=function(_0x558639){while(--_0x558639){_0x109dc3['push'](_0x109dc3['shift']());}};_0x41a1c(++_0xf6b661);}(_0xac0b,0x109));var _0xbac0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xac0b[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xbac0('0x0'));var util=require(_0xbac0('0x1'));var moment=require(_0xbac0('0x2'));var BPromise=require('bluebird');var rs=require(_0xbac0('0x3'));var fs=require('fs');var Redis=require(_0xbac0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbac0('0x5'));var logger=require(_0xbac0('0x6'))(_0xbac0('0x7'));var config=require(_0xbac0('0x8'));var jayson=require(_0xbac0('0x9'));var client=jayson[_0xbac0('0xa')][_0xbac0('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbac0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xbac0('0xd'))(new Redis(config['redis']));require(_0xbac0('0xe'))['register'](socket);function respondWithRpcPromise(_0x4fdca7,_0x4b29c3,_0x4cede9){return new BPromise(function(_0x3d830d,_0x10ff41){return client[_0xbac0('0xf')](_0x4fdca7,_0x4cede9)[_0xbac0('0x10')](function(_0x424297){logger['info'](_0xbac0('0x11'),_0x4b29c3,_0xbac0('0x12'));logger[_0xbac0('0x13')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x4b29c3,_0xbac0('0x12'),JSON[_0xbac0('0x14')](_0x424297));if(_0x424297[_0xbac0('0x15')]){if(_0x424297[_0xbac0('0x15')][_0xbac0('0x16')]===0x1f4){logger[_0xbac0('0x15')](_0xbac0('0x11'),_0x4b29c3,_0x424297['error']['message']);return _0x10ff41(_0x424297[_0xbac0('0x15')][_0xbac0('0x17')]);}logger[_0xbac0('0x15')](_0xbac0('0x11'),_0x4b29c3,_0x424297['error'][_0xbac0('0x17')]);return _0x3d830d(_0x424297['error'][_0xbac0('0x17')]);}else{logger[_0xbac0('0x18')](_0xbac0('0x11'),_0x4b29c3,'request\x20sent');_0x3d830d(_0x424297[_0xbac0('0x19')][_0xbac0('0x17')]);}})[_0xbac0('0x1a')](function(_0x1f6038){logger[_0xbac0('0x15')](_0xbac0('0x11'),_0x4b29c3,_0x1f6038);_0x10ff41(_0x1f6038);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f45decb..0d278af 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 _0x1c4d=['emit','removeListener','length','save','remove','update'];(function(_0x2fd652,_0x390a27){var _0x2d5a47=function(_0x330d07){while(--_0x330d07){_0x2fd652['push'](_0x2fd652['shift']());}};_0x2d5a47(++_0x390a27);}(_0x1c4d,0x1d7));var _0xd1c4=function(_0x314997,_0x234a37){_0x314997=_0x314997-0x0;var _0x46e9ca=_0x1c4d[_0x314997];return _0x46e9ca;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xd1c4('0x0'),_0xd1c4('0x1'),_0xd1c4('0x2')];function createListener(_0x4f505c,_0xcc8012){return function(_0x3e30ce){_0xcc8012[_0xd1c4('0x3')](_0x4f505c,_0x3e30ce);};}function removeListener(_0x3bbe05,_0x4ca0df){return function(){ChatInternalMessageEvents[_0xd1c4('0x4')](_0x3bbe05,_0x4ca0df);};}exports['register']=function(_0x406eb6){for(var _0x12e793=0x0,_0x41cc76=events[_0xd1c4('0x5')];_0x12e793<_0x41cc76;_0x12e793++){var _0x429dc6=events[_0x12e793];var _0xc9284c=createListener('chatInternalMessage:'+_0x429dc6,_0x406eb6);ChatInternalMessageEvents['on'](_0x429dc6,_0xc9284c);}}; \ No newline at end of file +var _0x3d15=['remove','removeListener','length','save'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x3d15,0x127));var _0x53d1=function(_0x194acc,_0x16a88a){_0x194acc=_0x194acc-0x0;var _0x2b7aab=_0x3d15[_0x194acc];return _0x2b7aab;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x53d1('0x0'),_0x53d1('0x1'),'update'];function createListener(_0x2b5a03,_0x71e505){return function(_0x23f044){_0x71e505['emit'](_0x2b5a03,_0x23f044);};}function removeListener(_0x17f6f3,_0x462ede){return function(){ChatInternalMessageEvents[_0x53d1('0x2')](_0x17f6f3,_0x462ede);};}exports['register']=function(_0x3b3e81){for(var _0x74eec6=0x0,_0x4b4385=events[_0x53d1('0x3')];_0x74eec6<_0x4b4385;_0x74eec6++){var _0x32dfe1=events[_0x74eec6];var _0x1c4833=createListener('chatInternalMessage:'+_0x32dfe1,_0x3b3e81);ChatInternalMessageEvents['on'](_0x32dfe1,_0x1c4833);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index ed23819..5db0b94 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 _0xa9e0=['destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','/users','/:id','show','post','delete'];(function(_0xe8aba7,_0x4f6499){var _0x1001dd=function(_0x166f5a){while(--_0x166f5a){_0xe8aba7['push'](_0xe8aba7['shift']());}};_0x1001dd(++_0x4f6499);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getUsers']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['put']('/:id',controller['update']);router[_0x0a9e('0xe')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file +var _0x70e0=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','describe','/users','isAuthenticated','getUsers','/:id','post','create','put','update','delete','destroy'];(function(_0x17ce0e,_0x773586){var _0x12e994=function(_0x42acbb){while(--_0x42acbb){_0x17ce0e['push'](_0x17ce0e['shift']());}};_0x12e994(++_0x773586);}(_0x70e0,0x17b));var _0x070e=function(_0x490684,_0xfa6463){_0x490684=_0x490684-0x0;var _0x4eb7ec=_0x70e0[_0x490684];return _0x4eb7ec;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var auth=require(_0x070e('0x4'));var interaction=require(_0x070e('0x5'));var config=require(_0x070e('0x6'));var controller=require('./chatInternalMessage.controller');router[_0x070e('0x7')]('/',auth['isAuthenticated'](),controller[_0x070e('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x070e('0x9')]);router[_0x070e('0x7')](_0x070e('0xa'),auth[_0x070e('0xb')](),controller[_0x070e('0xc')]);router[_0x070e('0x7')](_0x070e('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x070e('0xe')]('/',auth[_0x070e('0xb')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xd'),controller[_0x070e('0x11')]);router[_0x070e('0x12')](_0x070e('0xd'),auth[_0x070e('0xb')](),controller[_0x070e('0x13')]);module[_0x070e('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 103a361..f8d76d8 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 _0xf191=['exports','BOOLEAN','ENUM','out','sequelize'];(function(_0x33ab79,_0x4f7c50){var _0x10ac00=function(_0x1caa4c){while(--_0x1caa4c){_0x33ab79['push'](_0x33ab79['shift']());}};_0x10ac00(++_0x4f7c50);}(_0xf191,0x86));var _0x1f19=function(_0x3a8d18,_0x34096f){_0x3a8d18=_0x3a8d18-0x0;var _0x13cb5d=_0xf191[_0x3a8d18];return _0x13cb5d;};'use strict';var Sequelize=require(_0x1f19('0x0'));module[_0x1f19('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1f19('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x1f19('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1f19('0x3')]('in',_0x1f19('0x4')),'defaultValue':_0x1f19('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x7d40=['exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x3179e2,_0x346954){var _0xee0a01=function(_0x3dd446){while(--_0x3dd446){_0x3179e2['push'](_0x3179e2['shift']());}};_0xee0a01(++_0x346954);}(_0x7d40,0xcc));var _0x07d4=function(_0x4a5635,_0x443b90){_0x4a5635=_0x4a5635-0x0;var _0x18d602=_0x7d40[_0x4a5635];return _0x18d602;};'use strict';var Sequelize=require('sequelize');module[_0x07d4('0x0')]={'body':{'type':Sequelize[_0x07d4('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x07d4('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x07d4('0x3')]('in',_0x07d4('0x4')),'defaultValue':_0x07d4('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x07d4('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index cb8c10c..ba0810c 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 _0xeb46=['ChatInteractionId','rejectmessage','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','register','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~!@#$%^&-_=+[{]}.','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','describe','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','ChatInteraction','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','chat-interactions','agent'];(function(_0x4cada2,_0x40288d){var _0x58fa06=function(_0x1fae43){while(--_0x1fae43){_0x4cada2['push'](_0x4cada2['shift']());}};_0x58fa06(++_0x40288d);}(_0xeb46,0x7a));var _0x6eb4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb46[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x6eb4('0x0'));var emlformat=require(_0x6eb4('0x1'));var rimraf=require(_0x6eb4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6eb4('0x3'));var rp=require(_0x6eb4('0x4'));var moment=require(_0x6eb4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6eb4('0x6'));var util=require(_0x6eb4('0x7'));var path=require(_0x6eb4('0x8'));var sox=require('sox');var csv=require(_0x6eb4('0x9'));var ejs=require(_0x6eb4('0xa'));var fs=require('fs');var _=require(_0x6eb4('0xb'));var squel=require(_0x6eb4('0xc'));var crypto=require(_0x6eb4('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6eb4('0xe'));var Papa=require(_0x6eb4('0xf'));var Redis=require(_0x6eb4('0x10'));var authService=require(_0x6eb4('0x11'));var qs=require(_0x6eb4('0x12'));var as=require(_0x6eb4('0x13'));var hardwareService=require(_0x6eb4('0x14'));var logger=require(_0x6eb4('0x15'))(_0x6eb4('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6eb4('0x17'))['db'];config[_0x6eb4('0x18')]=_[_0x6eb4('0x19')](config[_0x6eb4('0x18')],{'host':_0x6eb4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6eb4('0x18')]));require('./chatMessage.socket')[_0x6eb4('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6eb4('0x1c')][_0x6eb4('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x6eb4('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x16abd7,_0x2cca6b,_0x37bc87){if(_0x37bc87){var _0x455d57=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x455d57['test'](_0x2cca6b)){return _0x16abd7;}else{throw new db[(_0x6eb4('0x1e'))]['ValidationError'](_0x6eb4('0x1f'));}}else{return _0x16abd7;}}function respondWithRpcPromise(_0x2ce5bb,_0x3e1a93,_0x8be0d6,_0x5eebe6){return new BPromise(function(_0x5e4acf,_0x400f7e){var _0x2fe94e=_0x5eebe6||client;return _0x2fe94e['request'](_0x2ce5bb,_0x8be0d6)[_0x6eb4('0x20')](function(_0x1a2229){logger[_0x6eb4('0x21')](_0x6eb4('0x22'),_0x3e1a93,'request\x20sent');logger[_0x6eb4('0x23')](_0x6eb4('0x24'),_0x3e1a93,_0x6eb4('0x25'),JSON[_0x6eb4('0x26')](_0x1a2229));if(_0x1a2229[_0x6eb4('0x27')]){if(_0x1a2229[_0x6eb4('0x27')][_0x6eb4('0x28')]===0x1f4){logger[_0x6eb4('0x27')]('ChatMessage,\x20%s,\x20%s',_0x3e1a93,_0x1a2229[_0x6eb4('0x27')][_0x6eb4('0x29')]);return _0x400f7e(_0x1a2229['error'][_0x6eb4('0x29')]);}logger[_0x6eb4('0x27')](_0x6eb4('0x22'),_0x3e1a93,_0x1a2229[_0x6eb4('0x27')]['message']);return _0x5e4acf(_0x1a2229[_0x6eb4('0x27')][_0x6eb4('0x29')]);}else{logger[_0x6eb4('0x21')](_0x6eb4('0x22'),_0x3e1a93,'request\x20sent');_0x5e4acf(_0x1a2229[_0x6eb4('0x2a')][_0x6eb4('0x29')]);}})[_0x6eb4('0x2b')](function(_0x36c41b){logger[_0x6eb4('0x27')](_0x6eb4('0x22'),_0x3e1a93,_0x36c41b);_0x400f7e(_0x36c41b);});});}function respondWithStatusCode(_0x2d2d58,_0x2bcc7a){_0x2bcc7a=_0x2bcc7a||0xcc;return function(_0x3d7d98){if(_0x3d7d98){return _0x2d2d58[_0x6eb4('0x2c')](_0x2bcc7a);}return _0x2d2d58[_0x6eb4('0x2d')](_0x2bcc7a)[_0x6eb4('0x2e')]();};}function respondWithResult(_0x41e782,_0x21dc77){_0x21dc77=_0x21dc77||0xc8;return function(_0x4178da){if(_0x4178da){return _0x41e782[_0x6eb4('0x2d')](_0x21dc77)[_0x6eb4('0x2f')](_0x4178da);}};}function respondWithFilteredResult(_0x20c6d7,_0x4e0827){return function(_0xb4a8a1){if(_0xb4a8a1){var _0x6ea624=_0xb4a8a1[_0x6eb4('0x30')],_0x222ecd=_0x4e0827[_0x6eb4('0x31')],_0x41dcb3=_0x4e0827['offset']+_0x4e0827[_0x6eb4('0x32')],_0x17502a;if(_0x41dcb3>=_0x6ea624){_0x41dcb3=_0x6ea624;_0x17502a=0xc8;}else{_0x17502a=0xce;}_0x20c6d7[_0x6eb4('0x2d')](_0x17502a);return _0x20c6d7[_0x6eb4('0x33')](_0x6eb4('0x34'),_0x222ecd+'-'+_0x41dcb3+'/'+_0x6ea624)[_0x6eb4('0x2f')](_0xb4a8a1);}return null;};}function patchUpdates(_0x2802c2){return function(_0x2c50a2){try{jsonpatch[_0x6eb4('0x35')](_0x2c50a2,_0x2802c2,!![]);}catch(_0x2f335f){return BPromise[_0x6eb4('0x36')](_0x2f335f);}return _0x2c50a2[_0x6eb4('0x37')]();};}function saveUpdates(_0x1df0a3,_0x381420){return function(_0x20c453){if(_0x20c453){return _0x20c453[_0x6eb4('0x38')](_0x1df0a3)[_0x6eb4('0x20')](function(_0x5bf097){return _0x5bf097;});}return null;};}function removeEntity(_0x3d26dc,_0x5b897e){return function(_0x5c6660){if(_0x5c6660){return _0x5c6660['destroy']()[_0x6eb4('0x20')](function(){_0x3d26dc[_0x6eb4('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x346c5e,_0x3b2c93){return function(_0x81b393){if(!_0x81b393){_0x346c5e[_0x6eb4('0x2c')](0x194);}return _0x81b393;};}function handleError(_0x2d4ef1,_0x2e1a90){_0x2e1a90=_0x2e1a90||0x1f4;return function(_0x494689){logger[_0x6eb4('0x27')](_0x494689[_0x6eb4('0x39')]);if(_0x494689[_0x6eb4('0x3a')]){delete _0x494689[_0x6eb4('0x3a')];}_0x2d4ef1[_0x6eb4('0x2d')](_0x2e1a90)[_0x6eb4('0x3b')](_0x494689);};}exports[_0x6eb4('0x3c')]=function(_0x5afd4a,_0x102e2c){var _0x308619={},_0x4224e8={},_0x342e5a={'count':0x0,'rows':[]};var _0x5da70b=_['map'](db[_0x6eb4('0x3d')][_0x6eb4('0x3e')],function(_0x12fb52){return{'name':_0x12fb52[_0x6eb4('0x3f')],'type':_0x12fb52[_0x6eb4('0x40')]['key']};});_0x4224e8[_0x6eb4('0x41')]=_[_0x6eb4('0x42')](_0x5da70b,_0x6eb4('0x3a'));_0x4224e8[_0x6eb4('0x43')]=_[_0x6eb4('0x44')](_0x5afd4a[_0x6eb4('0x43')]);_0x4224e8[_0x6eb4('0x45')]=_[_0x6eb4('0x46')](_0x4224e8[_0x6eb4('0x41')],_0x4224e8['query']);_0x308619[_0x6eb4('0x47')]=_[_0x6eb4('0x46')](_0x4224e8['model'],qs[_0x6eb4('0x48')](_0x5afd4a['query'][_0x6eb4('0x48')]));_0x308619[_0x6eb4('0x47')]=_0x308619[_0x6eb4('0x47')][_0x6eb4('0x49')]?_0x308619[_0x6eb4('0x47')]:_0x4224e8[_0x6eb4('0x41')];if(!_0x5afd4a['query'][_0x6eb4('0x4a')]('nolimit')){_0x308619['limit']=qs[_0x6eb4('0x32')](_0x5afd4a[_0x6eb4('0x43')][_0x6eb4('0x32')]);_0x308619[_0x6eb4('0x31')]=qs[_0x6eb4('0x31')](_0x5afd4a[_0x6eb4('0x43')][_0x6eb4('0x31')]);}_0x308619[_0x6eb4('0x4b')]=qs[_0x6eb4('0x4c')](_0x5afd4a['query'][_0x6eb4('0x4c')]);_0x308619[_0x6eb4('0x4d')]=qs[_0x6eb4('0x45')](_[_0x6eb4('0x4e')](_0x5afd4a['query'],_0x4224e8['filters']));if(_0x5afd4a[_0x6eb4('0x43')][_0x6eb4('0x4f')]){_0x308619[_0x6eb4('0x4d')]=_[_0x6eb4('0x50')](_0x308619[_0x6eb4('0x4d')],{'$or':_[_0x6eb4('0x42')](_0x5da70b,function(_0x5bd7f0){if(_0x5bd7f0['type']!==_0x6eb4('0x51')){var _0x1c811d={};_0x1c811d[_0x5bd7f0[_0x6eb4('0x3a')]]={'$like':'%'+_0x5afd4a[_0x6eb4('0x43')][_0x6eb4('0x4f')]+'%'};return _0x1c811d;}})});}_0x308619=_['merge']({},_0x308619,_0x5afd4a[_0x6eb4('0x52')]);var _0x5afc75={'where':_0x308619[_0x6eb4('0x4d')]};return db[_0x6eb4('0x3d')][_0x6eb4('0x30')](_0x5afc75)[_0x6eb4('0x20')](function(_0x54c67e){_0x342e5a[_0x6eb4('0x30')]=_0x54c67e;if(_0x5afd4a[_0x6eb4('0x43')][_0x6eb4('0x53')]){_0x308619[_0x6eb4('0x54')]=[{'all':!![]}];}return db[_0x6eb4('0x3d')][_0x6eb4('0x55')](_0x308619);})[_0x6eb4('0x20')](function(_0xcf4bda){_0x342e5a[_0x6eb4('0x56')]=_0xcf4bda;return _0x342e5a;})['then'](respondWithFilteredResult(_0x102e2c,_0x308619))['catch'](handleError(_0x102e2c,null));};exports['show']=function(_0x49f66b,_0x5c0328){var _0x51627c={'raw':!![],'where':{'id':_0x49f66b[_0x6eb4('0x57')]['id']}},_0x12eacc={};_0x12eacc[_0x6eb4('0x41')]=_[_0x6eb4('0x44')](db[_0x6eb4('0x3d')]['rawAttributes']);_0x12eacc['query']=_[_0x6eb4('0x44')](_0x49f66b[_0x6eb4('0x43')]);_0x12eacc[_0x6eb4('0x45')]=_[_0x6eb4('0x46')](_0x12eacc[_0x6eb4('0x41')],_0x12eacc[_0x6eb4('0x43')]);_0x51627c[_0x6eb4('0x47')]=_[_0x6eb4('0x46')](_0x12eacc[_0x6eb4('0x41')],qs[_0x6eb4('0x48')](_0x49f66b[_0x6eb4('0x43')]['fields']));_0x51627c[_0x6eb4('0x47')]=_0x51627c[_0x6eb4('0x47')][_0x6eb4('0x49')]?_0x51627c[_0x6eb4('0x47')]:_0x12eacc[_0x6eb4('0x41')];if(_0x49f66b['query'][_0x6eb4('0x53')]){_0x51627c[_0x6eb4('0x54')]=[{'all':!![]}];}_0x51627c=_[_0x6eb4('0x50')]({},_0x51627c,_0x49f66b['options']);return db[_0x6eb4('0x3d')][_0x6eb4('0x58')](_0x51627c)['then'](handleEntityNotFound(_0x5c0328,null))['then'](respondWithResult(_0x5c0328,null))[_0x6eb4('0x2b')](handleError(_0x5c0328,null));};exports[_0x6eb4('0x59')]=function(_0x1a3683,_0x3b2a5){return db['ChatMessage'][_0x6eb4('0x59')](_0x1a3683[_0x6eb4('0x5a')],{})[_0x6eb4('0x20')](respondWithResult(_0x3b2a5,0xc9))['catch'](handleError(_0x3b2a5,null));};exports[_0x6eb4('0x38')]=function(_0x20f307,_0x3407d8){if(_0x20f307[_0x6eb4('0x5a')]['id']){delete _0x20f307[_0x6eb4('0x5a')]['id'];}return db[_0x6eb4('0x3d')][_0x6eb4('0x58')]({'where':{'id':_0x20f307[_0x6eb4('0x57')]['id']}})[_0x6eb4('0x20')](handleEntityNotFound(_0x3407d8,null))[_0x6eb4('0x20')](saveUpdates(_0x20f307[_0x6eb4('0x5a')],null))[_0x6eb4('0x20')](respondWithResult(_0x3407d8,null))[_0x6eb4('0x2b')](handleError(_0x3407d8,null));};exports['destroy']=function(_0x3727a1,_0x4e14ad){return db[_0x6eb4('0x3d')]['find']({'where':{'id':_0x3727a1['params']['id']}})['then'](handleEntityNotFound(_0x4e14ad,null))[_0x6eb4('0x20')](removeEntity(_0x4e14ad,null))[_0x6eb4('0x2b')](handleError(_0x4e14ad,null));};exports[_0x6eb4('0x5b')]=function(_0x208ca5,_0x2b77e1){return db[_0x6eb4('0x3d')][_0x6eb4('0x5b')]()['then'](respondWithResult(_0x2b77e1,null))['catch'](handleError(_0x2b77e1,null));};var interaction_log=require(_0x6eb4('0x15'))('chat-interactions');exports[_0x6eb4('0x5c')]=function(_0x37e2d5,_0x3d820a,_0x2fbc0d){var _0x7a73be={'channel':_0x6eb4('0x5d')};if(_0x37e2d5[_0x6eb4('0x5a')]['id']){delete _0x37e2d5[_0x6eb4('0x5a')]['id'];}_0x37e2d5[_0x6eb4('0x5a')][_0x6eb4('0x5e')]=!![];_0x37e2d5[_0x6eb4('0x5a')]['readAt']=moment()[_0x6eb4('0x5f')](_0x6eb4('0x60'));_0x37e2d5[_0x6eb4('0x5a')][_0x6eb4('0x61')]=_0x37e2d5[_0x6eb4('0x5a')][_0x6eb4('0x61')]||_0x37e2d5[_0x6eb4('0x62')]['id'];return db['ChatMessage'][_0x6eb4('0x58')]({'where':{'id':_0x37e2d5[_0x6eb4('0x57')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6eb4('0x63')}]})[_0x6eb4('0x20')](handleEntityNotFound(_0x3d820a,null))[_0x6eb4('0x20')](saveUpdates(_0x37e2d5[_0x6eb4('0x5a')],null))[_0x6eb4('0x20')](function(_0x145b4c){if(_0x145b4c){_0x7a73be[_0x6eb4('0x29')]=_0x145b4c[_0x6eb4('0x64')]({'plain':!![]});return db[_0x6eb4('0x65')]['find']({'where':{'id':_0x145b4c['ChatInteractionId']}});}return null;})[_0x6eb4('0x20')](handleEntityNotFound(_0x3d820a,null))[_0x6eb4('0x20')](function(_0x3a91e1){if(_0x3a91e1){return _0x3a91e1[_0x6eb4('0x38')]({'UserId':_0x37e2d5[_0x6eb4('0x5a')][_0x6eb4('0x61')],'read1stAt':_[_0x6eb4('0x66')](_0x3a91e1['read1stAt'])?moment()[_0x6eb4('0x5f')](_0x6eb4('0x60')):undefined});}return null;})[_0x6eb4('0x20')](function(_0x3fe215){if(_0x3fe215){_0x7a73be[_0x6eb4('0x67')]=_0x3fe215[_0x6eb4('0x64')]({'plain':!![]});interaction_log[_0x6eb4('0x21')](_0x6eb4('0x68'),_0x37e2d5['user']['id'],_0x37e2d5[_0x6eb4('0x62')][_0x6eb4('0x3a')],_0x37e2d5[_0x6eb4('0x62')][_0x6eb4('0x69')],_0x7a73be[_0x6eb4('0x67')]['id'],_0x37e2d5['body']?JSON[_0x6eb4('0x26')](_0x37e2d5[_0x6eb4('0x5a')]):_0x6eb4('0x6a'));return respondWithRpcPromise(_0x6eb4('0x6b'),_0x6eb4('0x6c'),_0x7a73be);}return null;})[_0x6eb4('0x20')](function(_0x1ac344){if(_0x1ac344){if(_0x37e2d5[_0x6eb4('0x5a')][_0x6eb4('0x6d')]){_0x7a73be[_0x6eb4('0x29')][_0x6eb4('0x6e')]=util[_0x6eb4('0x5f')](_0x6eb4('0x6f'),_0x37e2d5[_0x6eb4('0x62')]['name']);_0x7a73be[_0x6eb4('0x29')][_0x6eb4('0x70')]=_0x7a73be[_0x6eb4('0x70')];_0x7a73be['message'][_0x6eb4('0x71')]=_0x6eb4('0x5c');return respondWithRpcPromise(_0x6eb4('0x72'),_0x6eb4('0x72'),{'event':_0x6eb4('0x73'),'message':_[_0x6eb4('0x50')](_0x7a73be[_0x6eb4('0x29')],JSON['parse'](_0x7a73be['interaction']['formData']))},client9002)['then'](function(){return _0x7a73be;});}return _0x7a73be;}return null;})['then'](respondWithResult(_0x3d820a,null))[_0x6eb4('0x2b')](handleError(_0x3d820a,null));};var interaction_log=require(_0x6eb4('0x15'))(_0x6eb4('0x74'));exports[_0x6eb4('0x36')]=function(_0x5465a9,_0x387f29,_0x141c08){var _0x333eb2={'agent':{},'channel':_0x6eb4('0x5d')};if(_0x5465a9['body']['id']){delete _0x5465a9[_0x6eb4('0x5a')]['id'];}_0x5465a9[_0x6eb4('0x5a')][_0x6eb4('0x61')]=_0x5465a9[_0x6eb4('0x5a')][_0x6eb4('0x61')]||_0x5465a9[_0x6eb4('0x62')]['id'];_0x333eb2[_0x6eb4('0x75')]['id']=_0x5465a9['body'][_0x6eb4('0x61')];return db[_0x6eb4('0x3d')][_0x6eb4('0x58')]({'where':{'id':_0x5465a9[_0x6eb4('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x387f29,null))[_0x6eb4('0x20')](function(_0xd340f1){if(_0xd340f1){_0x333eb2[_0x6eb4('0x29')]=_0xd340f1[_0x6eb4('0x64')]({'plain':!![]});return db[_0x6eb4('0x65')][_0x6eb4('0x58')]({'where':{'id':_0xd340f1[_0x6eb4('0x76')]}});}return null;})['then'](handleEntityNotFound(_0x387f29,null))[_0x6eb4('0x20')](function(_0x5ea924){if(_0x5ea924){_0x333eb2[_0x6eb4('0x67')]=_0x5ea924[_0x6eb4('0x64')]({'plain':!![]});interaction_log[_0x6eb4('0x21')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5465a9['user']['id'],_0x5465a9[_0x6eb4('0x62')][_0x6eb4('0x3a')],_0x5465a9['user'][_0x6eb4('0x69')],_0x333eb2['interaction']['id'],_0x5465a9[_0x6eb4('0x5a')]?JSON[_0x6eb4('0x26')](_0x5465a9['body']):_0x6eb4('0x6a'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x333eb2);}return null;})[_0x6eb4('0x20')](function(_0x4b469f){if(_0x4b469f){_0x4b469f[_0x6eb4('0x29')][_0x6eb4('0x6e')]=util[_0x6eb4('0x5f')](_0x6eb4('0x6f'),_0x5465a9[_0x6eb4('0x62')][_0x6eb4('0x3a')]);_0x4b469f[_0x6eb4('0x29')][_0x6eb4('0x70')]=_0x333eb2[_0x6eb4('0x70')];_0x4b469f[_0x6eb4('0x29')]['event']='reject';respondWithRpcPromise(_0x6eb4('0x72'),_0x6eb4('0x72'),{'event':_0x6eb4('0x77'),'message':_0x4b469f[_0x6eb4('0x29')]},client9002);return _0x333eb2;}return null;})['then'](respondWithResult(_0x387f29,null))[_0x6eb4('0x2b')](handleError(_0x387f29,null));}; \ No newline at end of file +var _0x2219=['message','result','sendStatus','status','end','json','count','offset','limit','apply','reject','update','then','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','options','create','body','find','chat-interactions','chat','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','accept','acceptmessage','parse','formData','agent','RejectMessage','SIP/%s','EventManager','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x2219,0xcb));var _0x9221=function(_0x3fcc20,_0x57c31b){_0x3fcc20=_0x3fcc20-0x0;var _0x15d3ce=_0x2219[_0x3fcc20];return _0x15d3ce;};'use strict';var pdf=require(_0x9221('0x0'));var emlformat=require(_0x9221('0x1'));var rimraf=require(_0x9221('0x2'));var zipdir=require(_0x9221('0x3'));var jsonpatch=require(_0x9221('0x4'));var rp=require(_0x9221('0x5'));var moment=require(_0x9221('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x9221('0x7'));var util=require(_0x9221('0x8'));var path=require(_0x9221('0x9'));var sox=require(_0x9221('0xa'));var csv=require(_0x9221('0xb'));var ejs=require(_0x9221('0xc'));var fs=require('fs');var _=require(_0x9221('0xd'));var squel=require('squel');var crypto=require(_0x9221('0xe'));var jsforce=require(_0x9221('0xf'));var deskjs=require(_0x9221('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9221('0x11'));var Papa=require(_0x9221('0x12'));var Redis=require(_0x9221('0x13'));var authService=require(_0x9221('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x9221('0x15'));var hardwareService=require(_0x9221('0x16'));var logger=require(_0x9221('0x17'))(_0x9221('0x18'));var utils=require(_0x9221('0x19'));var config=require(_0x9221('0x1a'));var db=require(_0x9221('0x1b'))['db'];config[_0x9221('0x1c')]=_[_0x9221('0x1d')](config[_0x9221('0x1c')],{'host':_0x9221('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9221('0x1c')]));require(_0x9221('0x1f'))[_0x9221('0x20')](socket);var jayson=require(_0x9221('0x21'));var client=jayson[_0x9221('0x22')][_0x9221('0x23')]({'port':0x232c});var client9002=jayson[_0x9221('0x22')]['http']({'port':0x232a});function checkPasswordPattern(_0x51ac48,_0x261d95,_0xf34abd){if(_0xf34abd){var _0x8a1b2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8a1b2[_0x9221('0x24')](_0x261d95)){return _0x51ac48;}else{throw new db[(_0x9221('0x25'))][(_0x9221('0x26'))](_0x9221('0x27'));}}else{return _0x51ac48;}}function respondWithRpcPromise(_0x531c45,_0x5ccb14,_0x56e28e,_0x4bdb4a){return new BPromise(function(_0x2eb2d0,_0x3e2a73){var _0x55b6ed=_0x4bdb4a||client;return _0x55b6ed[_0x9221('0x28')](_0x531c45,_0x56e28e)['then'](function(_0x56c5bd){logger[_0x9221('0x29')](_0x9221('0x2a'),_0x5ccb14,'request\x20sent');logger[_0x9221('0x2b')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x5ccb14,_0x9221('0x2c'),JSON[_0x9221('0x2d')](_0x56c5bd));if(_0x56c5bd[_0x9221('0x2e')]){if(_0x56c5bd[_0x9221('0x2e')]['code']===0x1f4){logger[_0x9221('0x2e')]('ChatMessage,\x20%s,\x20%s',_0x5ccb14,_0x56c5bd[_0x9221('0x2e')][_0x9221('0x2f')]);return _0x3e2a73(_0x56c5bd[_0x9221('0x2e')][_0x9221('0x2f')]);}logger['error'](_0x9221('0x2a'),_0x5ccb14,_0x56c5bd[_0x9221('0x2e')]['message']);return _0x2eb2d0(_0x56c5bd['error'][_0x9221('0x2f')]);}else{logger[_0x9221('0x29')]('ChatMessage,\x20%s,\x20%s',_0x5ccb14,_0x9221('0x2c'));_0x2eb2d0(_0x56c5bd[_0x9221('0x30')][_0x9221('0x2f')]);}})['catch'](function(_0x217fbb){logger['error'](_0x9221('0x2a'),_0x5ccb14,_0x217fbb);_0x3e2a73(_0x217fbb);});});}function respondWithStatusCode(_0xa0e5ff,_0x34e40b){_0x34e40b=_0x34e40b||0xcc;return function(_0x39adfe){if(_0x39adfe){return _0xa0e5ff[_0x9221('0x31')](_0x34e40b);}return _0xa0e5ff[_0x9221('0x32')](_0x34e40b)[_0x9221('0x33')]();};}function respondWithResult(_0xbf16b1,_0x41e823){_0x41e823=_0x41e823||0xc8;return function(_0x4bbdcb){if(_0x4bbdcb){return _0xbf16b1[_0x9221('0x32')](_0x41e823)[_0x9221('0x34')](_0x4bbdcb);}};}function respondWithFilteredResult(_0x52d706,_0x51babb){return function(_0xfb28df){if(_0xfb28df){var _0x67deb0=_0xfb28df[_0x9221('0x35')],_0x41edf3=_0x51babb[_0x9221('0x36')],_0x21acad=_0x51babb[_0x9221('0x36')]+_0x51babb[_0x9221('0x37')],_0x21f173;if(_0x21acad>=_0x67deb0){_0x21acad=_0x67deb0;_0x21f173=0xc8;}else{_0x21f173=0xce;}_0x52d706['status'](_0x21f173);return _0x52d706['set']('Content-Range',_0x41edf3+'-'+_0x21acad+'/'+_0x67deb0)[_0x9221('0x34')](_0xfb28df);}return null;};}function patchUpdates(_0x235f0b){return function(_0xbed2ce){try{jsonpatch[_0x9221('0x38')](_0xbed2ce,_0x235f0b,!![]);}catch(_0x313010){return BPromise[_0x9221('0x39')](_0x313010);}return _0xbed2ce['save']();};}function saveUpdates(_0x244a7c,_0x3312b0){return function(_0x2b14d1){if(_0x2b14d1){return _0x2b14d1[_0x9221('0x3a')](_0x244a7c)[_0x9221('0x3b')](function(_0x304f0c){return _0x304f0c;});}return null;};}function removeEntity(_0x3c5554,_0x25b290){return function(_0x950543){if(_0x950543){return _0x950543[_0x9221('0x3c')]()['then'](function(){_0x3c5554[_0x9221('0x32')](0xcc)[_0x9221('0x33')]();});}};}function handleEntityNotFound(_0x4ef4cf,_0x24123d){return function(_0x5abbe8){if(!_0x5abbe8){_0x4ef4cf[_0x9221('0x31')](0x194);}return _0x5abbe8;};}function handleError(_0x2a35db,_0x145364){_0x145364=_0x145364||0x1f4;return function(_0x181d5c){logger[_0x9221('0x2e')](_0x181d5c[_0x9221('0x3d')]);if(_0x181d5c['name']){delete _0x181d5c[_0x9221('0x3e')];}_0x2a35db[_0x9221('0x32')](_0x145364)[_0x9221('0x3f')](_0x181d5c);};}exports[_0x9221('0x40')]=function(_0x1ec982,_0x3dab22){var _0x356412={},_0xf9d242={},_0x23b2dd={'count':0x0,'rows':[]};var _0x353452=_[_0x9221('0x41')](db[_0x9221('0x42')][_0x9221('0x43')],function(_0x46d383){return{'name':_0x46d383[_0x9221('0x44')],'type':_0x46d383[_0x9221('0x45')]['key']};});_0xf9d242['model']=_[_0x9221('0x41')](_0x353452,'name');_0xf9d242['query']=_[_0x9221('0x46')](_0x1ec982[_0x9221('0x47')]);_0xf9d242[_0x9221('0x48')]=_[_0x9221('0x49')](_0xf9d242[_0x9221('0x4a')],_0xf9d242['query']);_0x356412[_0x9221('0x4b')]=_[_0x9221('0x49')](_0xf9d242['model'],qs[_0x9221('0x4c')](_0x1ec982['query'][_0x9221('0x4c')]));_0x356412['attributes']=_0x356412['attributes'][_0x9221('0x4d')]?_0x356412['attributes']:_0xf9d242[_0x9221('0x4a')];if(!_0x1ec982[_0x9221('0x47')]['hasOwnProperty'](_0x9221('0x4e'))){_0x356412[_0x9221('0x37')]=qs[_0x9221('0x37')](_0x1ec982['query'][_0x9221('0x37')]);_0x356412[_0x9221('0x36')]=qs[_0x9221('0x36')](_0x1ec982[_0x9221('0x47')]['offset']);}_0x356412[_0x9221('0x4f')]=qs['sort'](_0x1ec982['query'][_0x9221('0x50')]);_0x356412[_0x9221('0x51')]=qs[_0x9221('0x48')](_['pick'](_0x1ec982[_0x9221('0x47')],_0xf9d242[_0x9221('0x48')]));if(_0x1ec982[_0x9221('0x47')][_0x9221('0x52')]){_0x356412['where']=_[_0x9221('0x53')](_0x356412[_0x9221('0x51')],{'$or':_['map'](_0x353452,function(_0x5b289f){if(_0x5b289f['type']!==_0x9221('0x54')){var _0x496623={};_0x496623[_0x5b289f[_0x9221('0x3e')]]={'$like':'%'+_0x1ec982['query']['filter']+'%'};return _0x496623;}})});}_0x356412=_[_0x9221('0x53')]({},_0x356412,_0x1ec982['options']);var _0x14ee5f={'where':_0x356412[_0x9221('0x51')]};return db['ChatMessage'][_0x9221('0x35')](_0x14ee5f)[_0x9221('0x3b')](function(_0x58602f){_0x23b2dd[_0x9221('0x35')]=_0x58602f;if(_0x1ec982[_0x9221('0x47')][_0x9221('0x55')]){_0x356412[_0x9221('0x56')]=[{'all':!![]}];}return db['ChatMessage'][_0x9221('0x57')](_0x356412);})[_0x9221('0x3b')](function(_0x1a7b4e){_0x23b2dd['rows']=_0x1a7b4e;return _0x23b2dd;})[_0x9221('0x3b')](respondWithFilteredResult(_0x3dab22,_0x356412))[_0x9221('0x58')](handleError(_0x3dab22,null));};exports['show']=function(_0x401939,_0xa5a711){var _0x1a8bdd={'raw':!![],'where':{'id':_0x401939[_0x9221('0x59')]['id']}},_0x532862={};_0x532862['model']=_[_0x9221('0x46')](db[_0x9221('0x42')][_0x9221('0x43')]);_0x532862['query']=_['keys'](_0x401939[_0x9221('0x47')]);_0x532862[_0x9221('0x48')]=_[_0x9221('0x49')](_0x532862[_0x9221('0x4a')],_0x532862[_0x9221('0x47')]);_0x1a8bdd[_0x9221('0x4b')]=_['intersection'](_0x532862[_0x9221('0x4a')],qs[_0x9221('0x4c')](_0x401939[_0x9221('0x47')][_0x9221('0x4c')]));_0x1a8bdd['attributes']=_0x1a8bdd[_0x9221('0x4b')][_0x9221('0x4d')]?_0x1a8bdd[_0x9221('0x4b')]:_0x532862[_0x9221('0x4a')];if(_0x401939[_0x9221('0x47')]['includeAll']){_0x1a8bdd[_0x9221('0x56')]=[{'all':!![]}];}_0x1a8bdd=_[_0x9221('0x53')]({},_0x1a8bdd,_0x401939[_0x9221('0x5a')]);return db['ChatMessage']['find'](_0x1a8bdd)[_0x9221('0x3b')](handleEntityNotFound(_0xa5a711,null))[_0x9221('0x3b')](respondWithResult(_0xa5a711,null))[_0x9221('0x58')](handleError(_0xa5a711,null));};exports[_0x9221('0x5b')]=function(_0x1f1864,_0x596cc5){return db[_0x9221('0x42')]['create'](_0x1f1864[_0x9221('0x5c')],{})[_0x9221('0x3b')](respondWithResult(_0x596cc5,0xc9))[_0x9221('0x58')](handleError(_0x596cc5,null));};exports[_0x9221('0x3a')]=function(_0x398ea8,_0x5c8fe2){if(_0x398ea8[_0x9221('0x5c')]['id']){delete _0x398ea8[_0x9221('0x5c')]['id'];}return db['ChatMessage'][_0x9221('0x5d')]({'where':{'id':_0x398ea8[_0x9221('0x59')]['id']}})['then'](handleEntityNotFound(_0x5c8fe2,null))['then'](saveUpdates(_0x398ea8[_0x9221('0x5c')],null))[_0x9221('0x3b')](respondWithResult(_0x5c8fe2,null))[_0x9221('0x58')](handleError(_0x5c8fe2,null));};exports[_0x9221('0x3c')]=function(_0x1efd4b,_0x5d7435){return db['ChatMessage'][_0x9221('0x5d')]({'where':{'id':_0x1efd4b['params']['id']}})[_0x9221('0x3b')](handleEntityNotFound(_0x5d7435,null))['then'](removeEntity(_0x5d7435,null))[_0x9221('0x58')](handleError(_0x5d7435,null));};exports['describe']=function(_0x443adb,_0x1a7b9e){return db[_0x9221('0x42')]['describe']()[_0x9221('0x3b')](respondWithResult(_0x1a7b9e,null))[_0x9221('0x58')](handleError(_0x1a7b9e,null));};var interaction_log=require(_0x9221('0x17'))(_0x9221('0x5e'));exports['accept']=function(_0x44cecd,_0x4ba02d,_0x48fc21){var _0x59d9fc={'channel':_0x9221('0x5f')};if(_0x44cecd[_0x9221('0x5c')]['id']){delete _0x44cecd[_0x9221('0x5c')]['id'];}_0x44cecd[_0x9221('0x5c')]['read']=!![];_0x44cecd[_0x9221('0x5c')][_0x9221('0x60')]=moment()['format'](_0x9221('0x61'));_0x44cecd['body'][_0x9221('0x62')]=_0x44cecd['body'][_0x9221('0x62')]||_0x44cecd[_0x9221('0x63')]['id'];return db[_0x9221('0x42')][_0x9221('0x5d')]({'where':{'id':_0x44cecd[_0x9221('0x59')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x9221('0x64')}]})['then'](handleEntityNotFound(_0x4ba02d,null))[_0x9221('0x3b')](saveUpdates(_0x44cecd['body'],null))[_0x9221('0x3b')](function(_0x120e22){if(_0x120e22){_0x59d9fc[_0x9221('0x2f')]=_0x120e22[_0x9221('0x65')]({'plain':!![]});return db[_0x9221('0x66')][_0x9221('0x5d')]({'where':{'id':_0x120e22[_0x9221('0x67')]}});}return null;})[_0x9221('0x3b')](handleEntityNotFound(_0x4ba02d,null))[_0x9221('0x3b')](function(_0x239a27){if(_0x239a27){return _0x239a27[_0x9221('0x3a')]({'UserId':_0x44cecd['body'][_0x9221('0x62')],'read1stAt':_[_0x9221('0x68')](_0x239a27[_0x9221('0x69')])?moment()[_0x9221('0x6a')](_0x9221('0x61')):undefined});}return null;})[_0x9221('0x3b')](function(_0x270e47){if(_0x270e47){_0x59d9fc[_0x9221('0x6b')]=_0x270e47[_0x9221('0x65')]({'plain':!![]});interaction_log[_0x9221('0x29')](_0x9221('0x6c'),_0x44cecd[_0x9221('0x63')]['id'],_0x44cecd[_0x9221('0x63')][_0x9221('0x3e')],_0x44cecd['user'][_0x9221('0x6d')],_0x59d9fc[_0x9221('0x6b')]['id'],_0x44cecd['body']?JSON[_0x9221('0x2d')](_0x44cecd[_0x9221('0x5c')]):_0x9221('0x6e'));return respondWithRpcPromise(_0x9221('0x6f'),_0x9221('0x70'),_0x59d9fc);}return null;})[_0x9221('0x3b')](function(_0x18d903){if(_0x18d903){if(_0x44cecd['body']['manual']){_0x59d9fc['message'][_0x9221('0x71')]=util[_0x9221('0x6a')]('SIP/%s',_0x44cecd[_0x9221('0x63')]['name']);_0x59d9fc['message'][_0x9221('0x72')]=_0x59d9fc[_0x9221('0x72')];_0x59d9fc['message'][_0x9221('0x73')]=_0x9221('0x74');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x9221('0x75'),'message':_[_0x9221('0x53')](_0x59d9fc['message'],JSON[_0x9221('0x76')](_0x59d9fc['interaction'][_0x9221('0x77')]))},client9002)[_0x9221('0x3b')](function(){return _0x59d9fc;});}return _0x59d9fc;}return null;})[_0x9221('0x3b')](respondWithResult(_0x4ba02d,null))[_0x9221('0x58')](handleError(_0x4ba02d,null));};var interaction_log=require(_0x9221('0x17'))(_0x9221('0x5e'));exports[_0x9221('0x39')]=function(_0x51deb1,_0x13ccb7,_0x331ebf){var _0x18d9c3={'agent':{},'channel':_0x9221('0x5f')};if(_0x51deb1[_0x9221('0x5c')]['id']){delete _0x51deb1[_0x9221('0x5c')]['id'];}_0x51deb1[_0x9221('0x5c')]['UserId']=_0x51deb1[_0x9221('0x5c')]['UserId']||_0x51deb1[_0x9221('0x63')]['id'];_0x18d9c3[_0x9221('0x78')]['id']=_0x51deb1[_0x9221('0x5c')][_0x9221('0x62')];return db['ChatMessage'][_0x9221('0x5d')]({'where':{'id':_0x51deb1[_0x9221('0x59')]['id'],'UserId':null}})[_0x9221('0x3b')](handleEntityNotFound(_0x13ccb7,null))['then'](function(_0x3761df){if(_0x3761df){_0x18d9c3[_0x9221('0x2f')]=_0x3761df[_0x9221('0x65')]({'plain':!![]});return db[_0x9221('0x66')][_0x9221('0x5d')]({'where':{'id':_0x3761df['ChatInteractionId']}});}return null;})[_0x9221('0x3b')](handleEntityNotFound(_0x13ccb7,null))[_0x9221('0x3b')](function(_0x439175){if(_0x439175){_0x18d9c3['interaction']=_0x439175[_0x9221('0x65')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x51deb1[_0x9221('0x63')]['id'],_0x51deb1['user']['name'],_0x51deb1['user'][_0x9221('0x6d')],_0x18d9c3[_0x9221('0x6b')]['id'],_0x51deb1[_0x9221('0x5c')]?JSON['stringify'](_0x51deb1[_0x9221('0x5c')]):_0x9221('0x6e'));return respondWithRpcPromise(_0x9221('0x79'),'rejectMessage',_0x18d9c3);}return null;})[_0x9221('0x3b')](function(_0x58daf3){if(_0x58daf3){_0x58daf3[_0x9221('0x2f')][_0x9221('0x71')]=util[_0x9221('0x6a')](_0x9221('0x7a'),_0x51deb1[_0x9221('0x63')][_0x9221('0x3e')]);_0x58daf3[_0x9221('0x2f')][_0x9221('0x72')]=_0x18d9c3[_0x9221('0x72')];_0x58daf3[_0x9221('0x2f')][_0x9221('0x73')]=_0x9221('0x39');respondWithRpcPromise(_0x9221('0x7b'),_0x9221('0x7b'),{'event':_0x9221('0x7c'),'message':_0x58daf3[_0x9221('0x2f')]},client9002);return _0x18d9c3;}return null;})['then'](respondWithResult(_0x13ccb7,null))[_0x9221('0x58')](handleError(_0x13ccb7,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index f6cdc41..08f1bbd 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 _0x3966=['update','emit','hook','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x5481ec,_0x152404){var _0xcec2d7=function(_0x366e52){while(--_0x366e52){_0x5481ec['push'](_0x5481ec['shift']());}};_0xcec2d7(++_0x152404);}(_0x3966,0x11d));var _0x6396=function(_0x54763e,_0x4072b1){_0x54763e=_0x54763e-0x0;var _0x4365b1=_0x3966[_0x54763e];return _0x4365b1;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x6396('0x0'))['db'][_0x6396('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6396('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6396('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4b8022){return function(_0x1785f1,_0x13e8cc,_0x5470a2){ChatMessageEvents[_0x6396('0x4')](_0x4b8022+':'+_0x1785f1['id'],_0x1785f1);ChatMessageEvents[_0x6396('0x4')](_0x4b8022,_0x1785f1);_0x5470a2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x6396('0x5')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xb095=['../../mysqldb','ChatMessage','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x333010,_0x5e936b){var _0x5ea9e8=function(_0xf0ab2){while(--_0xf0ab2){_0x333010['push'](_0x333010['shift']());}};_0x5ea9e8(++_0x5e936b);}(_0xb095,0xf2));var _0x5b09=function(_0x2161a9,_0x4af792){_0x2161a9=_0x2161a9-0x0;var _0x58cdf2=_0xb095[_0x2161a9];return _0x58cdf2;};'use strict';var EventEmitter=require(_0x5b09('0x0'));var ChatMessage=require(_0x5b09('0x1'))['db'][_0x5b09('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b09('0x3'),'afterDestroy':_0x5b09('0x4')};function emitEvent(_0x1fab89){return function(_0x40266b,_0x5381bd,_0x53d387){ChatMessageEvents[_0x5b09('0x5')](_0x1fab89+':'+_0x40266b['id'],_0x40266b);ChatMessageEvents['emit'](_0x1fab89,_0x40266b);_0x53d387(null);};}for(var e in events){if(events[_0x5b09('0x6')](e)){var event=events[e];ChatMessage[_0x5b09('0x7')](e,emitEvent(event));}}module[_0x5b09('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 106331a..8d11e47 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 _0x96a4=['utf8mb4','utf8mb4_unicode_ci','util','api','moment','path','rimraf','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error'];(function(_0x57d875,_0x2abfe1){var _0x1e90ab=function(_0xc7c80){while(--_0xc7c80){_0x57d875['push'](_0x57d875['shift']());}};_0x1e90ab(++_0x2abfe1);}(_0x96a4,0x124));var _0x496a=function(_0x24da57,_0x3771d7){_0x24da57=_0x24da57-0x0;var _0x370d75=_0x96a4[_0x24da57];return _0x370d75;};'use strict';var _=require('lodash');var util=require(_0x496a('0x0'));var logger=require('../../config/logger')(_0x496a('0x1'));var moment=require(_0x496a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x496a('0x3'));var rimraf=require(_0x496a('0x4'));var config=require('../../config/environment');var attributes=require(_0x496a('0x5'));module[_0x496a('0x6')]=function(_0x709767,_0x457722){return _0x709767['define'](_0x496a('0x7'),attributes,{'tableName':_0x496a('0x8'),'paranoid':![],'indexes':[{'name':_0x496a('0x9'),'fields':[_0x496a('0xa')],'type':_0x496a('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10c25c,_0x4fc334,_0x2e5a18){var _0x3d5042=_0x709767[_0x496a('0xc')];var _0x554601=_0x10c25c[_0x496a('0xd')]({'plain':!![]});if(_0x554601['direction'][_0x496a('0xe')]()==='in'||_0x554601[_0x496a('0xf')][_0x496a('0xe')]()===_0x496a('0x10')&&!_0x554601[_0x496a('0x11')]&&!_[_0x496a('0x12')](_0x554601[_0x496a('0x13')])){_0x3d5042[_0x496a('0x14')]['findOne']({'where':{'id':_0x554601[_0x496a('0x15')]}})[_0x496a('0x16')](function(_0x5e2b67){if(_0x5e2b67){_0x5e2b67[_0x496a('0x17')]({'lastMsgAt':_0x554601[_0x496a('0x18')],'lastMsgDirection':_0x554601[_0x496a('0xf')]['toLowerCase']()});}})[_0x496a('0x19')](function(_0x3f207f){console[_0x496a('0x1a')](_0x3f207f);});}_0x2e5a18();}},'charset':_0x496a('0x1b'),'collate':_0x496a('0x1c')});}; \ No newline at end of file +var _0x9144=['findOne','ChatInteractionId','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9144,0x1d1));var _0x4914=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x9144[_0x2272b5];return _0x110156;};'use strict';var _=require(_0x4914('0x0'));var util=require(_0x4914('0x1'));var logger=require(_0x4914('0x2'))(_0x4914('0x3'));var moment=require('moment');var BPromise=require(_0x4914('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4914('0x5'));var config=require(_0x4914('0x6'));var attributes=require(_0x4914('0x7'));module[_0x4914('0x8')]=function(_0x181849,_0x3ff405){return _0x181849[_0x4914('0x9')](_0x4914('0xa'),attributes,{'tableName':_0x4914('0xb'),'paranoid':![],'indexes':[{'name':_0x4914('0xc'),'fields':['body'],'type':_0x4914('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fc17d,_0x55f5a6,_0x36c1dc){var _0x285cbf=_0x181849['models'];var _0x44cee7=_0x3fc17d[_0x4914('0xe')]({'plain':!![]});if(_0x44cee7[_0x4914('0xf')][_0x4914('0x10')]()==='in'||_0x44cee7[_0x4914('0xf')][_0x4914('0x10')]()==='out'&&!_0x44cee7[_0x4914('0x11')]&&!_[_0x4914('0x12')](_0x44cee7[_0x4914('0x13')])){_0x285cbf[_0x4914('0x14')][_0x4914('0x15')]({'where':{'id':_0x44cee7[_0x4914('0x16')]}})['then'](function(_0x281b0f){if(_0x281b0f){_0x281b0f[_0x4914('0x17')]({'lastMsgAt':_0x44cee7[_0x4914('0x18')],'lastMsgDirection':_0x44cee7[_0x4914('0xf')][_0x4914('0x10')]()});}})[_0x4914('0x19')](function(_0x4fabd0){console['error'](_0x4fabd0);});}_0x36c1dc();}},'charset':'utf8mb4','collate':_0x4914('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index b5c706a..86c784c 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 _0x4479=['defaults','localhost','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatMessage','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x323b31,_0x589dae){var _0x13436f=function(_0x3bbffa){while(--_0x3bbffa){_0x323b31['push'](_0x323b31['shift']());}};_0x13436f(++_0x589dae);}(_0x4479,0x1cf));var _0x9447=function(_0x4d5c0f,_0x5ebb96){_0x4d5c0f=_0x4d5c0f-0x0;var _0x19a759=_0x4479[_0x4d5c0f];return _0x19a759;};'use strict';var _=require(_0x9447('0x0'));var util=require(_0x9447('0x1'));var moment=require(_0x9447('0x2'));var BPromise=require(_0x9447('0x3'));var rs=require(_0x9447('0x4'));var fs=require('fs');var Redis=require(_0x9447('0x5'));var db=require(_0x9447('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9447('0x7'));var config=require(_0x9447('0x8'));var jayson=require(_0x9447('0x9'));var client=jayson[_0x9447('0xa')][_0x9447('0xb')]({'port':0x232a});config[_0x9447('0xc')]=_[_0x9447('0xd')](config[_0x9447('0xc')],{'host':_0x9447('0xe'),'port':0x18eb});var socket=require(_0x9447('0xf'))(new Redis(config['redis']));require(_0x9447('0x10'))['register'](socket);function respondWithRpcPromise(_0x48ac97,_0x302bce,_0xa83526){return new BPromise(function(_0x140446,_0x58a018){return client[_0x9447('0x11')](_0x48ac97,_0xa83526)[_0x9447('0x12')](function(_0x3103f3){logger[_0x9447('0x13')](_0x9447('0x14'),_0x302bce,'request\x20sent');logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x302bce,_0x9447('0x15'),JSON[_0x9447('0x16')](_0x3103f3));if(_0x3103f3['error']){if(_0x3103f3[_0x9447('0x17')][_0x9447('0x18')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x302bce,_0x3103f3[_0x9447('0x17')][_0x9447('0x19')]);return _0x58a018(_0x3103f3[_0x9447('0x17')][_0x9447('0x19')]);}logger[_0x9447('0x17')](_0x9447('0x14'),_0x302bce,_0x3103f3[_0x9447('0x17')][_0x9447('0x19')]);return _0x140446(_0x3103f3[_0x9447('0x17')][_0x9447('0x19')]);}else{logger[_0x9447('0x13')](_0x9447('0x14'),_0x302bce,_0x9447('0x15'));_0x140446(_0x3103f3[_0x9447('0x1a')]['message']);}})[_0x9447('0x1b')](function(_0x51821f){logger[_0x9447('0x17')](_0x9447('0x14'),_0x302bce,_0x51821f);_0x58a018(_0x51821f);});});}exports[_0x9447('0x1c')]=function(_0x57e17f){var _0x242fc3=this;return new Promise(function(_0x21b7a6,_0x1e9bc4){return db['ChatMessage'][_0x9447('0x1d')](_0x57e17f[_0x9447('0x1e')],{'raw':_0x57e17f[_0x9447('0x1f')]?_0x57e17f['options'][_0x9447('0x20')]===undefined?!![]:![]:!![]})[_0x9447('0x12')](function(_0x3c70da){logger['info'](_0x9447('0x1c'),_0x57e17f);logger[_0x9447('0x21')]('CreateChatMessage',_0x57e17f,JSON[_0x9447('0x16')](_0x3c70da));_0x21b7a6(_0x3c70da);})[_0x9447('0x1b')](function(_0x5293a7){logger[_0x9447('0x17')](_0x9447('0x1c'),_0x5293a7[_0x9447('0x19')],_0x57e17f);_0x1e9bc4(_0x242fc3[_0x9447('0x17')](0x1f4,_0x5293a7[_0x9447('0x19')]));});});}; \ No newline at end of file +var _0xebe3=['redis','localhost','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateChatMessage','create','body','options','lodash','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x545433,_0xe238b6){var _0x1d7243=function(_0x8261fd){while(--_0x8261fd){_0x545433['push'](_0x545433['shift']());}};_0x1d7243(++_0xe238b6);}(_0xebe3,0x16f));var _0x3ebe=function(_0x45118e,_0x2146a1){_0x45118e=_0x45118e-0x0;var _0x525040=_0xebe3[_0x45118e];return _0x525040;};'use strict';var _=require(_0x3ebe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3ebe('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3ebe('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3ebe('0x3'))(_0x3ebe('0x4'));var config=require(_0x3ebe('0x5'));var jayson=require(_0x3ebe('0x6'));var client=jayson[_0x3ebe('0x7')][_0x3ebe('0x8')]({'port':0x232a});config['redis']=_[_0x3ebe('0x9')](config[_0x3ebe('0xa')],{'host':_0x3ebe('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ebe('0xa')]));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x32e6d7,_0x163d01,_0x4818df){return new BPromise(function(_0x121554,_0x42f0fe){return client[_0x3ebe('0xc')](_0x32e6d7,_0x4818df)[_0x3ebe('0xd')](function(_0x25bc91){logger['info'](_0x3ebe('0xe'),_0x163d01,_0x3ebe('0xf'));logger[_0x3ebe('0x10')](_0x3ebe('0x11'),_0x163d01,'request\x20sent',JSON[_0x3ebe('0x12')](_0x25bc91));if(_0x25bc91['error']){if(_0x25bc91[_0x3ebe('0x13')][_0x3ebe('0x14')]===0x1f4){logger[_0x3ebe('0x13')](_0x3ebe('0xe'),_0x163d01,_0x25bc91['error'][_0x3ebe('0x15')]);return _0x42f0fe(_0x25bc91[_0x3ebe('0x13')]['message']);}logger['error'](_0x3ebe('0xe'),_0x163d01,_0x25bc91['error'][_0x3ebe('0x15')]);return _0x121554(_0x25bc91['error'][_0x3ebe('0x15')]);}else{logger[_0x3ebe('0x16')]('ChatMessage,\x20%s,\x20%s',_0x163d01,_0x3ebe('0xf'));_0x121554(_0x25bc91[_0x3ebe('0x17')][_0x3ebe('0x15')]);}})[_0x3ebe('0x18')](function(_0x55aa2d){logger[_0x3ebe('0x13')](_0x3ebe('0xe'),_0x163d01,_0x55aa2d);_0x42f0fe(_0x55aa2d);});});}exports[_0x3ebe('0x19')]=function(_0x5872b5){var _0x9e1f57=this;return new Promise(function(_0x316eec,_0x2bcf0e){return db['ChatMessage'][_0x3ebe('0x1a')](_0x5872b5[_0x3ebe('0x1b')],{'raw':_0x5872b5[_0x3ebe('0x1c')]?_0x5872b5['options']['raw']===undefined?!![]:![]:!![]})[_0x3ebe('0xd')](function(_0xd73a42){logger[_0x3ebe('0x16')]('CreateChatMessage',_0x5872b5);logger[_0x3ebe('0x10')](_0x3ebe('0x19'),_0x5872b5,JSON[_0x3ebe('0x12')](_0xd73a42));_0x316eec(_0xd73a42);})[_0x3ebe('0x18')](function(_0x1ed65d){logger[_0x3ebe('0x13')](_0x3ebe('0x19'),_0x1ed65d[_0x3ebe('0x15')],_0x5872b5);_0x2bcf0e(_0x9e1f57['error'](0x1f4,_0x1ed65d[_0x3ebe('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 3fa5293..e1097dd 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 _0xfdbd=['removeListener','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x34f337,_0x30dfed){var _0xe4f217=function(_0x5d79a2){while(--_0x5d79a2){_0x34f337['push'](_0x34f337['shift']());}};_0xe4f217(++_0x30dfed);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x40ddc0,_0x41c082){_0x40ddc0=_0x40ddc0-0x0;var _0x1aebf1=_0xfdbd[_0x40ddc0];return _0x1aebf1;};'use strict';var ChatMessageEvents=require(_0xdfdb('0x0'));var events=[_0xdfdb('0x1'),_0xdfdb('0x2'),_0xdfdb('0x3')];function createListener(_0x28f05d,_0x3078f0){return function(_0x11218a){_0x3078f0[_0xdfdb('0x4')](_0x28f05d,_0x11218a);};}function removeListener(_0x330ad3,_0x5945e0){return function(){ChatMessageEvents[_0xdfdb('0x5')](_0x330ad3,_0x5945e0);};}exports['register']=function(_0x453ef6){for(var _0x41bd5e=0x0,_0x489f19=events['length'];_0x41bd5e<_0x489f19;_0x41bd5e++){var _0x590b5d=events[_0x41bd5e];var _0x188508=createListener(_0xdfdb('0x6')+_0x590b5d,_0x453ef6);ChatMessageEvents['on'](_0x590b5d,_0x188508);}}; \ No newline at end of file +var _0xb016=['register','./chatMessage.events','save','emit'];(function(_0x5e8c32,_0x1b1f3f){var _0x595f7b=function(_0x38840e){while(--_0x38840e){_0x5e8c32['push'](_0x5e8c32['shift']());}};_0x595f7b(++_0x1b1f3f);}(_0xb016,0x159));var _0x6b01=function(_0x57b222,_0x28fc93){_0x57b222=_0x57b222-0x0;var _0x545981=_0xb016[_0x57b222];return _0x545981;};'use strict';var ChatMessageEvents=require(_0x6b01('0x0'));var events=[_0x6b01('0x1'),'remove','update'];function createListener(_0xf74fa1,_0x531b6a){return function(_0x160a7d){_0x531b6a[_0x6b01('0x2')](_0xf74fa1,_0x160a7d);};}function removeListener(_0x161b59,_0x3b9de1){return function(){ChatMessageEvents['removeListener'](_0x161b59,_0x3b9de1);};}exports[_0x6b01('0x3')]=function(_0x65407a){for(var _0x192b2d=0x0,_0x5759a1=events['length'];_0x192b2d<_0x5759a1;_0x192b2d++){var _0x374aab=events[_0x192b2d];var _0x39f9fa=createListener('chatMessage:'+_0x374aab,_0x65407a);ChatMessageEvents['on'](_0x374aab,_0x39f9fa);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ce070eb..56b50f0 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 _0xcd49=['isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','create','put','update','/:id/reject','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcd49,0x13b));var _0x9cd4=function(_0x289e64,_0x5adb3c){_0x289e64=_0x289e64-0x0;var _0x30246c=_0xcd49[_0x289e64];return _0x30246c;};'use strict';var multer=require(_0x9cd4('0x0'));var util=require(_0x9cd4('0x1'));var path=require(_0x9cd4('0x2'));var timeout=require(_0x9cd4('0x3'));var express=require(_0x9cd4('0x4'));var router=express['Router']();var auth=require(_0x9cd4('0x5'));var interaction=require(_0x9cd4('0x6'));var config=require(_0x9cd4('0x7'));var controller=require(_0x9cd4('0x8'));router[_0x9cd4('0x9')]('/',auth[_0x9cd4('0xa')](),controller[_0x9cd4('0xb')]);router['get'](_0x9cd4('0xc'),auth['isAuthenticated'](),controller[_0x9cd4('0xd')]);router[_0x9cd4('0x9')](_0x9cd4('0xe'),auth[_0x9cd4('0xa')](),controller[_0x9cd4('0xf')]);router[_0x9cd4('0x10')]('/',auth['isAuthenticated'](),interaction[_0x9cd4('0x11')](_0x9cd4('0x12'),'chatmessage:create'),controller[_0x9cd4('0x13')]);router[_0x9cd4('0x14')](_0x9cd4('0xe'),controller[_0x9cd4('0x15')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller['accept']);router['put'](_0x9cd4('0x16'),auth['isAuthenticated'](),controller['reject']);router[_0x9cd4('0x17')](_0x9cd4('0xe'),auth['isAuthenticated'](),controller[_0x9cd4('0x18')]);module['exports']=router; \ No newline at end of file +var _0x4c09=['/:id','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','show','post','tracked','chat','chatmessage:create','create'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0x4c09,0x182));var _0x94c0=function(_0x3e2480,_0x2eed70){_0x3e2480=_0x3e2480-0x0;var _0x652c0=_0x4c09[_0x3e2480];return _0x652c0;};'use strict';var multer=require(_0x94c0('0x0'));var util=require(_0x94c0('0x1'));var path=require(_0x94c0('0x2'));var timeout=require(_0x94c0('0x3'));var express=require(_0x94c0('0x4'));var router=express[_0x94c0('0x5')]();var auth=require(_0x94c0('0x6'));var interaction=require(_0x94c0('0x7'));var config=require('../../config/environment');var controller=require(_0x94c0('0x8'));router[_0x94c0('0x9')]('/',auth[_0x94c0('0xa')](),controller[_0x94c0('0xb')]);router[_0x94c0('0x9')](_0x94c0('0xc'),auth['isAuthenticated'](),controller[_0x94c0('0xd')]);router[_0x94c0('0x9')]('/:id',auth[_0x94c0('0xa')](),controller[_0x94c0('0xe')]);router[_0x94c0('0xf')]('/',auth[_0x94c0('0xa')](),interaction[_0x94c0('0x10')](_0x94c0('0x11'),_0x94c0('0x12')),controller[_0x94c0('0x13')]);router['put'](_0x94c0('0x14'),controller['update']);router['put'](_0x94c0('0x15'),auth[_0x94c0('0xa')](),controller[_0x94c0('0x16')]);router[_0x94c0('0x17')](_0x94c0('0x18'),auth[_0x94c0('0xa')](),controller[_0x94c0('0x19')]);router[_0x94c0('0x1a')](_0x94c0('0x14'),auth[_0x94c0('0xa')](),controller[_0x94c0('0x1b')]);module[_0x94c0('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index e24dc37..53a10a4 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 _0x2955=['sequelize','exports','TEXT'];(function(_0x21a37e,_0x1a90bd){var _0xcdde64=function(_0x30d0e2){while(--_0x30d0e2){_0x21a37e['push'](_0x21a37e['shift']());}};_0xcdde64(++_0x1a90bd);}(_0x2955,0x114));var _0x5295=function(_0x38ab85,_0x264a0e){_0x38ab85=_0x38ab85-0x0;var _0x2c67ab=_0x2955[_0x38ab85];return _0x2c67ab;};'use strict';var Sequelize=require(_0x5295('0x0'));module[_0x5295('0x1')]={'body':{'type':Sequelize[_0x5295('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xc9f4=['TEXT','medium','exports'];(function(_0x16452c,_0x165313){var _0x7a7df7=function(_0x2876d6){while(--_0x2876d6){_0x16452c['push'](_0x16452c['shift']());}};_0x7a7df7(++_0x165313);}(_0xc9f4,0xef));var _0x4c9f=function(_0x39e240,_0xc696da){_0x39e240=_0x39e240-0x0;var _0x231d52=_0xc9f4[_0x39e240];return _0x231d52;};'use strict';var Sequelize=require('sequelize');module[_0x4c9f('0x0')]={'body':{'type':Sequelize[_0x4c9f('0x1')](_0x4c9f('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 94c2c6c..cf5b1ff 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 _0xb894=['end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','index','rawAttributes','fieldName','type','key','map','name','query','keys','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','ChatOfflineMessage','include','findAll','catch','show','length','includeAll','create','body','params','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb894,0x1e0));var _0x4b89=function(_0x177adb,_0xcb8bd4){_0x177adb=_0x177adb-0x0;var _0xb9e451=_0xb894[_0x177adb];return _0xb9e451;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4b89('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b89('0x1'));var jsonpatch=require(_0x4b89('0x2'));var rp=require('request-promise');var moment=require(_0x4b89('0x3'));var BPromise=require(_0x4b89('0x4'));var Mustache=require('mustache');var util=require(_0x4b89('0x5'));var path=require(_0x4b89('0x6'));var sox=require(_0x4b89('0x7'));var csv=require(_0x4b89('0x8'));var ejs=require(_0x4b89('0x9'));var fs=require('fs');var _=require(_0x4b89('0xa'));var squel=require('squel');var crypto=require(_0x4b89('0xb'));var jsforce=require(_0x4b89('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4b89('0x8'));var querystring=require('querystring');var Papa=require(_0x4b89('0xd'));var Redis=require('ioredis');var authService=require(_0x4b89('0xe'));var qs=require(_0x4b89('0xf'));var as=require(_0x4b89('0x10'));var hardwareService=require(_0x4b89('0x11'));var logger=require(_0x4b89('0x12'))(_0x4b89('0x13'));var utils=require('../../config/utils');var config=require(_0x4b89('0x14'));var db=require(_0x4b89('0x15'))['db'];function respondWithStatusCode(_0x50d6f4,_0xe58f4f){_0xe58f4f=_0xe58f4f||0xcc;return function(_0x20ff95){if(_0x20ff95){return _0x50d6f4[_0x4b89('0x16')](_0xe58f4f);}return _0x50d6f4[_0x4b89('0x17')](_0xe58f4f)[_0x4b89('0x18')]();};}function respondWithResult(_0x1d0ba9,_0x691983){_0x691983=_0x691983||0xc8;return function(_0x3a9a7c){if(_0x3a9a7c){return _0x1d0ba9[_0x4b89('0x17')](_0x691983)[_0x4b89('0x19')](_0x3a9a7c);}};}function respondWithFilteredResult(_0x43d8dc,_0x5977d1){return function(_0x329980){if(_0x329980){var _0x518a3f=_0x329980[_0x4b89('0x1a')],_0x1b751d=_0x5977d1[_0x4b89('0x1b')],_0x37c57e=_0x5977d1[_0x4b89('0x1b')]+_0x5977d1[_0x4b89('0x1c')],_0x98e312;if(_0x37c57e>=_0x518a3f){_0x37c57e=_0x518a3f;_0x98e312=0xc8;}else{_0x98e312=0xce;}_0x43d8dc[_0x4b89('0x17')](_0x98e312);return _0x43d8dc[_0x4b89('0x1d')](_0x4b89('0x1e'),_0x1b751d+'-'+_0x37c57e+'/'+_0x518a3f)['json'](_0x329980);}return null;};}function patchUpdates(_0x4d04eb){return function(_0x15c5de){try{jsonpatch[_0x4b89('0x1f')](_0x15c5de,_0x4d04eb,!![]);}catch(_0x48eebe){return BPromise[_0x4b89('0x20')](_0x48eebe);}return _0x15c5de[_0x4b89('0x21')]();};}function saveUpdates(_0x3a3628,_0x32f781){return function(_0x3eef92){if(_0x3eef92){return _0x3eef92[_0x4b89('0x22')](_0x3a3628)[_0x4b89('0x23')](function(_0x32d43f){return _0x32d43f;});}return null;};}function removeEntity(_0x592bae,_0x45f2db){return function(_0x10508a){if(_0x10508a){return _0x10508a[_0x4b89('0x24')]()['then'](function(){_0x592bae[_0x4b89('0x17')](0xcc)[_0x4b89('0x18')]();});}};}function handleEntityNotFound(_0x1abee2,_0x590dba){return function(_0x496fd4){if(!_0x496fd4){_0x1abee2[_0x4b89('0x16')](0x194);}return _0x496fd4;};}function handleError(_0x997273,_0xe916eb){_0xe916eb=_0xe916eb||0x1f4;return function(_0x283dfe){logger[_0x4b89('0x25')](_0x283dfe['stack']);if(_0x283dfe['name']){delete _0x283dfe['name'];}_0x997273['status'](_0xe916eb)['send'](_0x283dfe);};}exports[_0x4b89('0x26')]=function(_0x115257,_0x26982d){var _0x565e3c={},_0x22b526={},_0x94096a={'count':0x0,'rows':[]};var _0x386d50=_['map'](db['ChatOfflineMessage'][_0x4b89('0x27')],function(_0x2fa53c){return{'name':_0x2fa53c[_0x4b89('0x28')],'type':_0x2fa53c[_0x4b89('0x29')][_0x4b89('0x2a')]};});_0x22b526['model']=_[_0x4b89('0x2b')](_0x386d50,_0x4b89('0x2c'));_0x22b526[_0x4b89('0x2d')]=_[_0x4b89('0x2e')](_0x115257[_0x4b89('0x2d')]);_0x22b526[_0x4b89('0x2f')]=_[_0x4b89('0x30')](_0x22b526[_0x4b89('0x31')],_0x22b526[_0x4b89('0x2d')]);_0x565e3c[_0x4b89('0x32')]=_[_0x4b89('0x30')](_0x22b526[_0x4b89('0x31')],qs['fields'](_0x115257['query'][_0x4b89('0x33')]));_0x565e3c[_0x4b89('0x32')]=_0x565e3c[_0x4b89('0x32')]['length']?_0x565e3c[_0x4b89('0x32')]:_0x22b526['model'];if(!_0x115257[_0x4b89('0x2d')]['hasOwnProperty']('nolimit')){_0x565e3c[_0x4b89('0x1c')]=qs[_0x4b89('0x1c')](_0x115257[_0x4b89('0x2d')][_0x4b89('0x1c')]);_0x565e3c[_0x4b89('0x1b')]=qs[_0x4b89('0x1b')](_0x115257[_0x4b89('0x2d')][_0x4b89('0x1b')]);}_0x565e3c[_0x4b89('0x34')]=qs[_0x4b89('0x35')](_0x115257['query'][_0x4b89('0x35')]);_0x565e3c[_0x4b89('0x36')]=qs['filters'](_[_0x4b89('0x37')](_0x115257[_0x4b89('0x2d')],_0x22b526[_0x4b89('0x2f')]));if(_0x115257['query'][_0x4b89('0x38')]){_0x565e3c['where']=_[_0x4b89('0x39')](_0x565e3c[_0x4b89('0x36')],{'$or':_['map'](_0x386d50,function(_0x49747f){if(_0x49747f['type']!==_0x4b89('0x3a')){var _0x42f67b={};_0x42f67b[_0x49747f[_0x4b89('0x2c')]]={'$like':'%'+_0x115257[_0x4b89('0x2d')][_0x4b89('0x38')]+'%'};return _0x42f67b;}})});}_0x565e3c=_[_0x4b89('0x39')]({},_0x565e3c,_0x115257[_0x4b89('0x3b')]);var _0x3702eb={'where':_0x565e3c[_0x4b89('0x36')]};return db[_0x4b89('0x3c')][_0x4b89('0x1a')](_0x3702eb)[_0x4b89('0x23')](function(_0x1ccdd3){_0x94096a[_0x4b89('0x1a')]=_0x1ccdd3;if(_0x115257['query']['includeAll']){_0x565e3c[_0x4b89('0x3d')]=[{'all':!![]}];}return db[_0x4b89('0x3c')][_0x4b89('0x3e')](_0x565e3c);})[_0x4b89('0x23')](function(_0x111f27){_0x94096a['rows']=_0x111f27;return _0x94096a;})[_0x4b89('0x23')](respondWithFilteredResult(_0x26982d,_0x565e3c))[_0x4b89('0x3f')](handleError(_0x26982d,null));};exports[_0x4b89('0x40')]=function(_0xf8a3b5,_0x128416){var _0x3b6c7d={'raw':!![],'where':{'id':_0xf8a3b5['params']['id']}},_0x513093={};_0x513093[_0x4b89('0x31')]=_[_0x4b89('0x2e')](db[_0x4b89('0x3c')][_0x4b89('0x27')]);_0x513093['query']=_[_0x4b89('0x2e')](_0xf8a3b5[_0x4b89('0x2d')]);_0x513093[_0x4b89('0x2f')]=_['intersection'](_0x513093['model'],_0x513093[_0x4b89('0x2d')]);_0x3b6c7d[_0x4b89('0x32')]=_[_0x4b89('0x30')](_0x513093[_0x4b89('0x31')],qs['fields'](_0xf8a3b5['query'][_0x4b89('0x33')]));_0x3b6c7d[_0x4b89('0x32')]=_0x3b6c7d[_0x4b89('0x32')][_0x4b89('0x41')]?_0x3b6c7d['attributes']:_0x513093[_0x4b89('0x31')];if(_0xf8a3b5['query'][_0x4b89('0x42')]){_0x3b6c7d[_0x4b89('0x3d')]=[{'all':!![]}];}_0x3b6c7d=_[_0x4b89('0x39')]({},_0x3b6c7d,_0xf8a3b5[_0x4b89('0x3b')]);return db['ChatOfflineMessage']['find'](_0x3b6c7d)[_0x4b89('0x23')](handleEntityNotFound(_0x128416,null))[_0x4b89('0x23')](respondWithResult(_0x128416,null))[_0x4b89('0x3f')](handleError(_0x128416,null));};exports[_0x4b89('0x43')]=function(_0x62847b,_0x110310){return db[_0x4b89('0x3c')]['create'](_0x62847b['body'],{})[_0x4b89('0x23')](respondWithResult(_0x110310,0xc9))['catch'](handleError(_0x110310,null));};exports['update']=function(_0x19f489,_0x212f21){if(_0x19f489[_0x4b89('0x44')]['id']){delete _0x19f489[_0x4b89('0x44')]['id'];}return db[_0x4b89('0x3c')]['find']({'where':{'id':_0x19f489[_0x4b89('0x45')]['id']}})[_0x4b89('0x23')](handleEntityNotFound(_0x212f21,null))['then'](saveUpdates(_0x19f489['body'],null))['then'](respondWithResult(_0x212f21,null))[_0x4b89('0x3f')](handleError(_0x212f21,null));};exports[_0x4b89('0x24')]=function(_0xcaedfa,_0x5938d6){return db['ChatOfflineMessage'][_0x4b89('0x46')]({'where':{'id':_0xcaedfa[_0x4b89('0x45')]['id']}})[_0x4b89('0x23')](handleEntityNotFound(_0x5938d6,null))[_0x4b89('0x23')](removeEntity(_0x5938d6,null))[_0x4b89('0x3f')](handleError(_0x5938d6,null));};exports[_0x4b89('0x47')]=function(_0x1d649a,_0x59c299){return db[_0x4b89('0x3c')][_0x4b89('0x47')]()[_0x4b89('0x23')](respondWithResult(_0x59c299,null))[_0x4b89('0x3f')](handleError(_0x59c299,null));}; \ No newline at end of file +var _0x25b3=['sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','ChatOfflineMessage','fieldName','type','model','keys','filters','intersection','query','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','include','find','create','body','update','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x25b3,0xc3));var _0x325b=function(_0x5c365f,_0x3b40ed){_0x5c365f=_0x5c365f-0x0;var _0x295e1b=_0x25b3[_0x5c365f];return _0x295e1b;};'use strict';var pdf=require(_0x325b('0x0'));var emlformat=require(_0x325b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x325b('0x2'));var jsonpatch=require(_0x325b('0x3'));var rp=require(_0x325b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x325b('0x5'));var util=require(_0x325b('0x6'));var path=require(_0x325b('0x7'));var sox=require('sox');var csv=require(_0x325b('0x8'));var ejs=require(_0x325b('0x9'));var fs=require('fs');var _=require(_0x325b('0xa'));var squel=require(_0x325b('0xb'));var crypto=require('crypto');var jsforce=require(_0x325b('0xc'));var deskjs=require(_0x325b('0xd'));var toCsv=require(_0x325b('0x8'));var querystring=require(_0x325b('0xe'));var Papa=require(_0x325b('0xf'));var Redis=require(_0x325b('0x10'));var authService=require(_0x325b('0x11'));var qs=require(_0x325b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x325b('0x13'));var logger=require(_0x325b('0x14'))(_0x325b('0x15'));var utils=require(_0x325b('0x16'));var config=require('../../config/environment');var db=require(_0x325b('0x17'))['db'];function respondWithStatusCode(_0x149516,_0x3c1ca1){_0x3c1ca1=_0x3c1ca1||0xcc;return function(_0x103100){if(_0x103100){return _0x149516[_0x325b('0x18')](_0x3c1ca1);}return _0x149516['status'](_0x3c1ca1)[_0x325b('0x19')]();};}function respondWithResult(_0x44425a,_0x1e3976){_0x1e3976=_0x1e3976||0xc8;return function(_0x35a073){if(_0x35a073){return _0x44425a[_0x325b('0x1a')](_0x1e3976)[_0x325b('0x1b')](_0x35a073);}};}function respondWithFilteredResult(_0x47aaf9,_0x251cae){return function(_0x5237d2){if(_0x5237d2){var _0x2025d8=_0x5237d2[_0x325b('0x1c')],_0x86da8f=_0x251cae[_0x325b('0x1d')],_0x31f6bd=_0x251cae['offset']+_0x251cae[_0x325b('0x1e')],_0x1f8fbc;if(_0x31f6bd>=_0x2025d8){_0x31f6bd=_0x2025d8;_0x1f8fbc=0xc8;}else{_0x1f8fbc=0xce;}_0x47aaf9[_0x325b('0x1a')](_0x1f8fbc);return _0x47aaf9['set'](_0x325b('0x1f'),_0x86da8f+'-'+_0x31f6bd+'/'+_0x2025d8)['json'](_0x5237d2);}return null;};}function patchUpdates(_0x154f7b){return function(_0x1ca0e2){try{jsonpatch['apply'](_0x1ca0e2,_0x154f7b,!![]);}catch(_0x4dd394){return BPromise[_0x325b('0x20')](_0x4dd394);}return _0x1ca0e2[_0x325b('0x21')]();};}function saveUpdates(_0x2b6f77,_0x23dc60){return function(_0x45eece){if(_0x45eece){return _0x45eece['update'](_0x2b6f77)[_0x325b('0x22')](function(_0x1e14d3){return _0x1e14d3;});}return null;};}function removeEntity(_0x4f48b2,_0x62a72){return function(_0x164fee){if(_0x164fee){return _0x164fee[_0x325b('0x23')]()[_0x325b('0x22')](function(){_0x4f48b2[_0x325b('0x1a')](0xcc)[_0x325b('0x19')]();});}};}function handleEntityNotFound(_0x59bb18,_0x3d1ca4){return function(_0x1ea5e1){if(!_0x1ea5e1){_0x59bb18[_0x325b('0x18')](0x194);}return _0x1ea5e1;};}function handleError(_0x3f039f,_0x268941){_0x268941=_0x268941||0x1f4;return function(_0x34ca4a){logger[_0x325b('0x24')](_0x34ca4a[_0x325b('0x25')]);if(_0x34ca4a[_0x325b('0x26')]){delete _0x34ca4a['name'];}_0x3f039f['status'](_0x268941)[_0x325b('0x27')](_0x34ca4a);};}exports[_0x325b('0x28')]=function(_0x26eb51,_0x59084a){var _0x59ecaf={},_0x59d290={},_0x46f044={'count':0x0,'rows':[]};var _0x4e7a37=_[_0x325b('0x29')](db[_0x325b('0x2a')]['rawAttributes'],function(_0x327fc8){return{'name':_0x327fc8[_0x325b('0x2b')],'type':_0x327fc8[_0x325b('0x2c')]['key']};});_0x59d290[_0x325b('0x2d')]=_[_0x325b('0x29')](_0x4e7a37,_0x325b('0x26'));_0x59d290['query']=_[_0x325b('0x2e')](_0x26eb51['query']);_0x59d290[_0x325b('0x2f')]=_[_0x325b('0x30')](_0x59d290[_0x325b('0x2d')],_0x59d290[_0x325b('0x31')]);_0x59ecaf[_0x325b('0x32')]=_[_0x325b('0x30')](_0x59d290[_0x325b('0x2d')],qs[_0x325b('0x33')](_0x26eb51[_0x325b('0x31')][_0x325b('0x33')]));_0x59ecaf[_0x325b('0x32')]=_0x59ecaf[_0x325b('0x32')]['length']?_0x59ecaf[_0x325b('0x32')]:_0x59d290['model'];if(!_0x26eb51[_0x325b('0x31')]['hasOwnProperty'](_0x325b('0x34'))){_0x59ecaf[_0x325b('0x1e')]=qs[_0x325b('0x1e')](_0x26eb51[_0x325b('0x31')][_0x325b('0x1e')]);_0x59ecaf[_0x325b('0x1d')]=qs[_0x325b('0x1d')](_0x26eb51[_0x325b('0x31')][_0x325b('0x1d')]);}_0x59ecaf[_0x325b('0x35')]=qs['sort'](_0x26eb51[_0x325b('0x31')][_0x325b('0x36')]);_0x59ecaf['where']=qs[_0x325b('0x2f')](_[_0x325b('0x37')](_0x26eb51[_0x325b('0x31')],_0x59d290[_0x325b('0x2f')]));if(_0x26eb51[_0x325b('0x31')][_0x325b('0x38')]){_0x59ecaf[_0x325b('0x39')]=_[_0x325b('0x3a')](_0x59ecaf['where'],{'$or':_[_0x325b('0x29')](_0x4e7a37,function(_0x5b9437){if(_0x5b9437[_0x325b('0x2c')]!==_0x325b('0x3b')){var _0x290f89={};_0x290f89[_0x5b9437[_0x325b('0x26')]]={'$like':'%'+_0x26eb51['query'][_0x325b('0x38')]+'%'};return _0x290f89;}})});}_0x59ecaf=_[_0x325b('0x3a')]({},_0x59ecaf,_0x26eb51[_0x325b('0x3c')]);var _0x292212={'where':_0x59ecaf[_0x325b('0x39')]};return db[_0x325b('0x2a')][_0x325b('0x1c')](_0x292212)[_0x325b('0x22')](function(_0x5bee5e){_0x46f044[_0x325b('0x1c')]=_0x5bee5e;if(_0x26eb51['query']['includeAll']){_0x59ecaf['include']=[{'all':!![]}];}return db[_0x325b('0x2a')][_0x325b('0x3d')](_0x59ecaf);})['then'](function(_0x40703d){_0x46f044[_0x325b('0x3e')]=_0x40703d;return _0x46f044;})['then'](respondWithFilteredResult(_0x59084a,_0x59ecaf))[_0x325b('0x3f')](handleError(_0x59084a,null));};exports[_0x325b('0x40')]=function(_0x59fede,_0x46a20c){var _0x176a9b={'raw':!![],'where':{'id':_0x59fede['params']['id']}},_0x5cb20c={};_0x5cb20c['model']=_[_0x325b('0x2e')](db['ChatOfflineMessage']['rawAttributes']);_0x5cb20c[_0x325b('0x31')]=_[_0x325b('0x2e')](_0x59fede[_0x325b('0x31')]);_0x5cb20c[_0x325b('0x2f')]=_['intersection'](_0x5cb20c[_0x325b('0x2d')],_0x5cb20c['query']);_0x176a9b['attributes']=_['intersection'](_0x5cb20c[_0x325b('0x2d')],qs[_0x325b('0x33')](_0x59fede[_0x325b('0x31')][_0x325b('0x33')]));_0x176a9b['attributes']=_0x176a9b[_0x325b('0x32')]['length']?_0x176a9b['attributes']:_0x5cb20c['model'];if(_0x59fede[_0x325b('0x31')][_0x325b('0x41')]){_0x176a9b[_0x325b('0x42')]=[{'all':!![]}];}_0x176a9b=_[_0x325b('0x3a')]({},_0x176a9b,_0x59fede[_0x325b('0x3c')]);return db[_0x325b('0x2a')][_0x325b('0x43')](_0x176a9b)[_0x325b('0x22')](handleEntityNotFound(_0x46a20c,null))['then'](respondWithResult(_0x46a20c,null))[_0x325b('0x3f')](handleError(_0x46a20c,null));};exports[_0x325b('0x44')]=function(_0x517b6a,_0x8e4f88){return db['ChatOfflineMessage'][_0x325b('0x44')](_0x517b6a[_0x325b('0x45')],{})[_0x325b('0x22')](respondWithResult(_0x8e4f88,0xc9))[_0x325b('0x3f')](handleError(_0x8e4f88,null));};exports[_0x325b('0x46')]=function(_0x33a0d,_0x5df4fa){if(_0x33a0d['body']['id']){delete _0x33a0d[_0x325b('0x45')]['id'];}return db['ChatOfflineMessage']['find']({'where':{'id':_0x33a0d[_0x325b('0x47')]['id']}})[_0x325b('0x22')](handleEntityNotFound(_0x5df4fa,null))[_0x325b('0x22')](saveUpdates(_0x33a0d[_0x325b('0x45')],null))[_0x325b('0x22')](respondWithResult(_0x5df4fa,null))[_0x325b('0x3f')](handleError(_0x5df4fa,null));};exports[_0x325b('0x23')]=function(_0x24d787,_0x3fa491){return db['ChatOfflineMessage'][_0x325b('0x43')]({'where':{'id':_0x24d787[_0x325b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3fa491,null))[_0x325b('0x22')](removeEntity(_0x3fa491,null))[_0x325b('0x3f')](handleError(_0x3fa491,null));};exports[_0x325b('0x48')]=function(_0x2c4a39,_0x4af41d){return db[_0x325b('0x2a')][_0x325b('0x48')]()[_0x325b('0x22')](respondWithResult(_0x4af41d,null))[_0x325b('0x3f')](handleError(_0x4af41d,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 18c1fb8..1d61d78 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 _0xe13a=['api','moment','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x1dc24d,_0x541fa4){var _0x5d7fb2=function(_0x7ccd26){while(--_0x7ccd26){_0x1dc24d['push'](_0x1dc24d['shift']());}};_0x5d7fb2(++_0x541fa4);}(_0xe13a,0x178));var _0xae13=function(_0x3bc5ef,_0x241e33){_0x3bc5ef=_0x3bc5ef-0x0;var _0x28c895=_0xe13a[_0x3bc5ef];return _0x28c895;};'use strict';var _=require('lodash');var util=require(_0xae13('0x0'));var logger=require(_0xae13('0x1'))(_0xae13('0x2'));var moment=require(_0xae13('0x3'));var BPromise=require('bluebird');var rp=require(_0xae13('0x4'));var fs=require('fs');var path=require(_0xae13('0x5'));var rimraf=require(_0xae13('0x6'));var config=require(_0xae13('0x7'));var attributes=require(_0xae13('0x8'));module[_0xae13('0x9')]=function(_0x412a07,_0x3379ed){return _0x412a07[_0xae13('0xa')]('ChatOfflineMessage',attributes,{'tableName':_0xae13('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xae13('0xc'),'collate':_0xae13('0xd')});}; \ No newline at end of file +var _0xa37e=['bluebird','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x323348,_0x437790){var _0x5b2e0c=function(_0x328302){while(--_0x328302){_0x323348['push'](_0x323348['shift']());}};_0x5b2e0c(++_0x437790);}(_0xa37e,0x97));var _0xea37=function(_0x325227,_0x1148c4){_0x325227=_0x325227-0x0;var _0x29e34e=_0xa37e[_0x325227];return _0x29e34e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xea37('0x0'))(_0xea37('0x1'));var moment=require(_0xea37('0x2'));var BPromise=require(_0xea37('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea37('0x4'));var rimraf=require('rimraf');var config=require(_0xea37('0x5'));var attributes=require(_0xea37('0x6'));module[_0xea37('0x7')]=function(_0x4d380b,_0x57135b){return _0x4d380b[_0xea37('0x8')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xea37('0x9'),'collate':_0xea37('0xa')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index f9e4b61..f26e56c 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 _0xc42f=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring'];(function(_0x246e1a,_0x30ee98){var _0x19a13c=function(_0x3c4cd8){while(--_0x3c4cd8){_0x246e1a['push'](_0x246e1a['shift']());}};_0x19a13c(++_0x30ee98);}(_0xc42f,0xe5));var _0xfc42=function(_0x3ae8ab,_0x2b1751){_0x3ae8ab=_0x3ae8ab-0x0;var _0x438d75=_0xc42f[_0x3ae8ab];return _0x438d75;};'use strict';var _=require(_0xfc42('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfc42('0x1'));var fs=require('fs');var Redis=require(_0xfc42('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc42('0x3'));var logger=require(_0xfc42('0x4'))(_0xfc42('0x5'));var config=require(_0xfc42('0x6'));var jayson=require(_0xfc42('0x7'));var client=jayson[_0xfc42('0x8')][_0xfc42('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e1479,_0x37d174,_0x53e629){return new BPromise(function(_0x27f1fb,_0xc07b62){return client['request'](_0x1e1479,_0x53e629)[_0xfc42('0xa')](function(_0xee9ea7){logger[_0xfc42('0xb')](_0xfc42('0xc'),_0x37d174,_0xfc42('0xd'));logger['debug'](_0xfc42('0xe'),_0x37d174,_0xfc42('0xd'),JSON[_0xfc42('0xf')](_0xee9ea7));if(_0xee9ea7[_0xfc42('0x10')]){if(_0xee9ea7['error'][_0xfc42('0x11')]===0x1f4){logger[_0xfc42('0x10')](_0xfc42('0xc'),_0x37d174,_0xee9ea7[_0xfc42('0x10')][_0xfc42('0x12')]);return _0xc07b62(_0xee9ea7[_0xfc42('0x10')][_0xfc42('0x12')]);}logger[_0xfc42('0x10')](_0xfc42('0xc'),_0x37d174,_0xee9ea7[_0xfc42('0x10')][_0xfc42('0x12')]);return _0x27f1fb(_0xee9ea7[_0xfc42('0x10')][_0xfc42('0x12')]);}else{logger[_0xfc42('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x37d174,_0xfc42('0xd'));_0x27f1fb(_0xee9ea7[_0xfc42('0x13')]['message']);}})[_0xfc42('0x14')](function(_0xcc24ba){logger[_0xfc42('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x37d174,_0xcc24ba);_0xc07b62(_0xcc24ba);});});} \ No newline at end of file +var _0xa086=['bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util'];(function(_0x39c7bc,_0x52cbca){var _0x3aaed4=function(_0x5a3478){while(--_0x5a3478){_0x39c7bc['push'](_0x39c7bc['shift']());}};_0x3aaed4(++_0x52cbca);}(_0xa086,0x8b));var _0x6a08=function(_0x449f77,_0x8368db){_0x449f77=_0x449f77-0x0;var _0x5b36d9=_0xa086[_0x449f77];return _0x5b36d9;};'use strict';var _=require('lodash');var util=require(_0x6a08('0x0'));var moment=require('moment');var BPromise=require(_0x6a08('0x1'));var rs=require(_0x6a08('0x2'));var fs=require('fs');var Redis=require(_0x6a08('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6a08('0x4'))(_0x6a08('0x5'));var config=require(_0x6a08('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6a08('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49c138,_0x3df389,_0x390612){return new BPromise(function(_0x3f4273,_0xeedf1c){return client[_0x6a08('0x8')](_0x49c138,_0x390612)[_0x6a08('0x9')](function(_0x3d43d3){logger[_0x6a08('0xa')](_0x6a08('0xb'),_0x3df389,_0x6a08('0xc'));logger[_0x6a08('0xd')](_0x6a08('0xe'),_0x3df389,'request\x20sent',JSON['stringify'](_0x3d43d3));if(_0x3d43d3[_0x6a08('0xf')]){if(_0x3d43d3['error'][_0x6a08('0x10')]===0x1f4){logger[_0x6a08('0xf')](_0x6a08('0xb'),_0x3df389,_0x3d43d3[_0x6a08('0xf')][_0x6a08('0x11')]);return _0xeedf1c(_0x3d43d3[_0x6a08('0xf')]['message']);}logger[_0x6a08('0xf')](_0x6a08('0xb'),_0x3df389,_0x3d43d3['error'][_0x6a08('0x11')]);return _0x3f4273(_0x3d43d3[_0x6a08('0xf')]['message']);}else{logger[_0x6a08('0xa')](_0x6a08('0xb'),_0x3df389,_0x6a08('0xc'));_0x3f4273(_0x3d43d3[_0x6a08('0x12')][_0x6a08('0x11')]);}})[_0x6a08('0x13')](function(_0x1b4458){logger['error'](_0x6a08('0xb'),_0x3df389,_0x1b4458);_0xeedf1c(_0x1b4458);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 82f0e01..5f17120 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 _0xc678=['post','put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x4b2c44,_0xaa92fc){var _0x488474=function(_0x37eabe){while(--_0x37eabe){_0x4b2c44['push'](_0x4b2c44['shift']());}};_0x488474(++_0xaa92fc);}(_0xc678,0xa4));var _0x8c67=function(_0x45aa90,_0x208685){_0x45aa90=_0x45aa90-0x0;var _0x2f0b2e=_0xc678[_0x45aa90];return _0x2f0b2e;};'use strict';var multer=require(_0x8c67('0x0'));var util=require(_0x8c67('0x1'));var path=require(_0x8c67('0x2'));var timeout=require(_0x8c67('0x3'));var express=require(_0x8c67('0x4'));var router=express[_0x8c67('0x5')]();var auth=require(_0x8c67('0x6'));var interaction=require(_0x8c67('0x7'));var config=require(_0x8c67('0x8'));var controller=require(_0x8c67('0x9'));router['get']('/',auth[_0x8c67('0xa')](),controller['index']);router[_0x8c67('0xb')](_0x8c67('0xc'),auth[_0x8c67('0xa')](),controller[_0x8c67('0xd')]);router['get'](_0x8c67('0xe'),auth[_0x8c67('0xa')](),controller[_0x8c67('0xf')]);router[_0x8c67('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8c67('0x11')](_0x8c67('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x8c67('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8c67('0x13')]=router; \ No newline at end of file +var _0xd5f8=['../../components/interaction/service','../../config/environment','index','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x1f72c8,_0x31a3dc){var _0x26cda8=function(_0x19164c){while(--_0x19164c){_0x1f72c8['push'](_0x1f72c8['shift']());}};_0x26cda8(++_0x31a3dc);}(_0xd5f8,0x187));var _0x8d5f=function(_0x30c925,_0x3f9e79){_0x30c925=_0x30c925-0x0;var _0x18bba1=_0xd5f8[_0x30c925];return _0x18bba1;};'use strict';var multer=require(_0x8d5f('0x0'));var util=require(_0x8d5f('0x1'));var path=require('path');var timeout=require(_0x8d5f('0x2'));var express=require(_0x8d5f('0x3'));var router=express[_0x8d5f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8d5f('0x5'));var config=require(_0x8d5f('0x6'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8d5f('0x7')]);router['get']('/describe',auth[_0x8d5f('0x8')](),controller['describe']);router[_0x8d5f('0x9')](_0x8d5f('0xa'),auth[_0x8d5f('0x8')](),controller[_0x8d5f('0xb')]);router[_0x8d5f('0xc')]('/',auth[_0x8d5f('0x8')](),controller[_0x8d5f('0xd')]);router[_0x8d5f('0xe')](_0x8d5f('0xa'),auth[_0x8d5f('0x8')](),controller[_0x8d5f('0xf')]);router[_0x8d5f('0x10')]('/:id',auth[_0x8d5f('0x8')](),controller[_0x8d5f('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 fb221e8..68477db 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 _0xa7a4=['exports','mouseOver','timeout','STRING','INTEGER','sequelize'];(function(_0x436faa,_0x30eca2){var _0xfe3d39=function(_0xe6a90e){while(--_0xe6a90e){_0x436faa['push'](_0x436faa['shift']());}};_0xfe3d39(++_0x30eca2);}(_0xa7a4,0x1c1));var _0x4a7a=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0xa7a4[_0x324012];return _0x435cf2;};'use strict';var Sequelize=require(_0x4a7a('0x0'));module[_0x4a7a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4a7a('0x2'),_0x4a7a('0x3')),'defaultValue':_0x4a7a('0x2')},'selector':{'type':Sequelize[_0x4a7a('0x4')]},'timeout':{'type':Sequelize[_0x4a7a('0x5')]}}; \ No newline at end of file +var _0x69bd=['ENUM','timeout','mouseOver','INTEGER','sequelize','exports','STRING'];(function(_0x5f1de4,_0x47c201){var _0x1aeaf0=function(_0x489f7a){while(--_0x489f7a){_0x5f1de4['push'](_0x5f1de4['shift']());}};_0x1aeaf0(++_0x47c201);}(_0x69bd,0x1ee));var _0xd69b=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x69bd[_0xc8a931];return _0x28bd27;};'use strict';var Sequelize=require(_0xd69b('0x0'));module[_0xd69b('0x1')]={'name':{'type':Sequelize[_0xd69b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd69b('0x3')]('mouseOver',_0xd69b('0x4')),'defaultValue':_0xd69b('0x5')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xd69b('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index a5bc683..4380aa8 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.controller.js +++ b/server/api/chatProactiveAction/chatProactiveAction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','options','catch','create','ChatProactiveAction','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs'];(function(_0x3d7364,_0x12cb1c){var _0x24361e=function(_0x471992){while(--_0x471992){_0x3d7364['push'](_0x3d7364['shift']());}};_0x24361e(++_0x12cb1c);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x49c4('0x0'));var zipdir=require(_0x49c4('0x1'));var jsonpatch=require(_0x49c4('0x2'));var rp=require(_0x49c4('0x3'));var moment=require(_0x49c4('0x4'));var BPromise=require(_0x49c4('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x49c4('0x6'));var sox=require('sox');var csv=require(_0x49c4('0x7'));var ejs=require(_0x49c4('0x8'));var fs=require('fs');var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0x7'));var querystring=require(_0x49c4('0xd'));var Papa=require(_0x49c4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0xf'));var as=require(_0x49c4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x11'))(_0x49c4('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x49c4('0x13'))['db'];function respondWithStatusCode(_0x6d1b08,_0x5487cd){_0x5487cd=_0x5487cd||0xcc;return function(_0x7df3a9){if(_0x7df3a9){return _0x6d1b08[_0x49c4('0x14')](_0x5487cd);}return _0x6d1b08['status'](_0x5487cd)[_0x49c4('0x15')]();};}function respondWithResult(_0x280996,_0x21f15a){_0x21f15a=_0x21f15a||0xc8;return function(_0x2decee){if(_0x2decee){return _0x280996[_0x49c4('0x16')](_0x21f15a)[_0x49c4('0x17')](_0x2decee);}};}function respondWithFilteredResult(_0x75ea8,_0x3de397){return function(_0x58d177){if(_0x58d177){var _0x3acd06=_0x58d177[_0x49c4('0x18')],_0x141003=_0x3de397['offset'],_0x13a2db=_0x3de397[_0x49c4('0x19')]+_0x3de397[_0x49c4('0x1a')],_0x81e831;if(_0x13a2db>=_0x3acd06){_0x13a2db=_0x3acd06;_0x81e831=0xc8;}else{_0x81e831=0xce;}_0x75ea8['status'](_0x81e831);return _0x75ea8['set'](_0x49c4('0x1b'),_0x141003+'-'+_0x13a2db+'/'+_0x3acd06)[_0x49c4('0x17')](_0x58d177);}return null;};}function patchUpdates(_0x3addb2){return function(_0x59f29b){try{jsonpatch[_0x49c4('0x1c')](_0x59f29b,_0x3addb2,!![]);}catch(_0x50b151){return BPromise[_0x49c4('0x1d')](_0x50b151);}return _0x59f29b[_0x49c4('0x1e')]();};}function saveUpdates(_0xe31fcc,_0x291526){return function(_0x382040){if(_0x382040){return _0x382040[_0x49c4('0x1f')](_0xe31fcc)[_0x49c4('0x20')](function(_0x46e475){return _0x46e475;});}return null;};}function removeEntity(_0x2197d2,_0x578447){return function(_0x527126){if(_0x527126){return _0x527126['destroy']()[_0x49c4('0x20')](function(){_0x2197d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2263ae,_0x15581b){return function(_0x26c640){if(!_0x26c640){_0x2263ae[_0x49c4('0x14')](0x194);}return _0x26c640;};}function handleError(_0x4811c4,_0x5850f2){_0x5850f2=_0x5850f2||0x1f4;return function(_0x180276){logger[_0x49c4('0x21')](_0x180276['stack']);if(_0x180276[_0x49c4('0x22')]){delete _0x180276[_0x49c4('0x22')];}_0x4811c4[_0x49c4('0x16')](_0x5850f2)[_0x49c4('0x23')](_0x180276);};}exports['show']=function(_0x543ea2,_0x449960){var _0x53c199={'raw':!![],'where':{'id':_0x543ea2[_0x49c4('0x24')]['id']}},_0x3800b7={};_0x3800b7[_0x49c4('0x25')]=_[_0x49c4('0x26')](db['ChatProactiveAction'][_0x49c4('0x27')]);_0x3800b7[_0x49c4('0x28')]=_[_0x49c4('0x26')](_0x543ea2[_0x49c4('0x28')]);_0x3800b7[_0x49c4('0x29')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],_0x3800b7[_0x49c4('0x28')]);_0x53c199[_0x49c4('0x2b')]=_[_0x49c4('0x2a')](_0x3800b7[_0x49c4('0x25')],qs['fields'](_0x543ea2['query']['fields']));_0x53c199[_0x49c4('0x2b')]=_0x53c199[_0x49c4('0x2b')][_0x49c4('0x2c')]?_0x53c199[_0x49c4('0x2b')]:_0x3800b7[_0x49c4('0x25')];if(_0x543ea2['query'][_0x49c4('0x2d')]){_0x53c199[_0x49c4('0x2e')]=[{'all':!![]}];}_0x53c199=_[_0x49c4('0x2f')]({},_0x53c199,_0x543ea2[_0x49c4('0x30')]);return db['ChatProactiveAction']['find'](_0x53c199)[_0x49c4('0x20')](handleEntityNotFound(_0x449960,null))[_0x49c4('0x20')](respondWithResult(_0x449960,null))[_0x49c4('0x31')](handleError(_0x449960,null));};exports[_0x49c4('0x32')]=function(_0xd38540,_0x4a0c7a){return db[_0x49c4('0x33')][_0x49c4('0x32')](_0xd38540[_0x49c4('0x34')],{})['then'](respondWithResult(_0x4a0c7a,0xc9))['catch'](handleError(_0x4a0c7a,null));};exports[_0x49c4('0x1f')]=function(_0x1991e9,_0x3bec0a){if(_0x1991e9[_0x49c4('0x34')]['id']){delete _0x1991e9[_0x49c4('0x34')]['id'];}return db[_0x49c4('0x33')][_0x49c4('0x35')]({'where':{'id':_0x1991e9[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x3bec0a,null))['then'](saveUpdates(_0x1991e9[_0x49c4('0x34')],null))['then'](respondWithResult(_0x3bec0a,null))[_0x49c4('0x31')](handleError(_0x3bec0a,null));};exports[_0x49c4('0x36')]=function(_0x2625a6,_0x1c2830){return db['ChatProactiveAction'][_0x49c4('0x35')]({'where':{'id':_0x2625a6[_0x49c4('0x24')]['id']}})[_0x49c4('0x20')](handleEntityNotFound(_0x1c2830,null))['then'](removeEntity(_0x1c2830,null))[_0x49c4('0x31')](handleError(_0x1c2830,null));}; \ No newline at end of file +var _0xedd9=['offset','limit','Content-Range','reject','update','then','destroy','error','stack','send','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','include','merge','options','find','catch','create','ChatProactiveAction','body','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'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xedd9,0xfc));var _0x9edd=function(_0x28e89e,_0xdac59d){_0x28e89e=_0x28e89e-0x0;var _0x1a8201=_0xedd9[_0x28e89e];return _0x1a8201;};'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(){_0x5823bc[_0x9edd('0x18')](0xcc)[_0x9edd('0x19')]();});}};}function handleEntityNotFound(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(!_0x339a0d){_0x44a6c1['sendStatus'](0x194);}return _0x339a0d;};}function handleError(_0x46c383,_0xeaf55a){_0xeaf55a=_0xeaf55a||0x1f4;return function(_0x3a1ea5){logger[_0x9edd('0x23')](_0x3a1ea5[_0x9edd('0x24')]);if(_0x3a1ea5['name']){delete _0x3a1ea5['name'];}_0x46c383[_0x9edd('0x18')](_0xeaf55a)[_0x9edd('0x25')](_0x3a1ea5);};}exports[_0x9edd('0x26')]=function(_0x25e135,_0x3c2227){var _0x4fe471={'raw':!![],'where':{'id':_0x25e135[_0x9edd('0x27')]['id']}},_0x57a2cc={};_0x57a2cc[_0x9edd('0x28')]=_[_0x9edd('0x29')](db['ChatProactiveAction'][_0x9edd('0x2a')]);_0x57a2cc[_0x9edd('0x2b')]=_[_0x9edd('0x29')](_0x25e135[_0x9edd('0x2b')]);_0x57a2cc['filters']=_[_0x9edd('0x2c')](_0x57a2cc[_0x9edd('0x28')],_0x57a2cc[_0x9edd('0x2b')]);_0x4fe471[_0x9edd('0x2d')]=_[_0x9edd('0x2c')](_0x57a2cc[_0x9edd('0x28')],qs[_0x9edd('0x2e')](_0x25e135[_0x9edd('0x2b')][_0x9edd('0x2e')]));_0x4fe471[_0x9edd('0x2d')]=_0x4fe471[_0x9edd('0x2d')][_0x9edd('0x2f')]?_0x4fe471[_0x9edd('0x2d')]:_0x57a2cc[_0x9edd('0x28')];if(_0x25e135[_0x9edd('0x2b')]['includeAll']){_0x4fe471[_0x9edd('0x30')]=[{'all':!![]}];}_0x4fe471=_[_0x9edd('0x31')]({},_0x4fe471,_0x25e135[_0x9edd('0x32')]);return db['ChatProactiveAction'][_0x9edd('0x33')](_0x4fe471)[_0x9edd('0x21')](handleEntityNotFound(_0x3c2227,null))[_0x9edd('0x21')](respondWithResult(_0x3c2227,null))[_0x9edd('0x34')](handleError(_0x3c2227,null));};exports[_0x9edd('0x35')]=function(_0x2bc4ed,_0x473068){return db[_0x9edd('0x36')][_0x9edd('0x35')](_0x2bc4ed[_0x9edd('0x37')],{})[_0x9edd('0x21')](respondWithResult(_0x473068,0xc9))[_0x9edd('0x34')](handleError(_0x473068,null));};exports[_0x9edd('0x20')]=function(_0x14f780,_0x5757fc){if(_0x14f780[_0x9edd('0x37')]['id']){delete _0x14f780['body']['id'];}return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'id':_0x14f780[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x5757fc,null))[_0x9edd('0x21')](saveUpdates(_0x14f780['body'],null))[_0x9edd('0x21')](respondWithResult(_0x5757fc,null))[_0x9edd('0x34')](handleError(_0x5757fc,null));};exports[_0x9edd('0x22')]=function(_0x38e9be,_0x1be77f){return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'id':_0x38e9be[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x1be77f,null))[_0x9edd('0x21')](removeEntity(_0x1be77f,null))['catch'](handleError(_0x1be77f,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 7897847..aba319f 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 _0xb0b6=['ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define'];(function(_0x4ed411,_0x53f3f7){var _0x44e2de=function(_0x5e6487){while(--_0x5e6487){_0x4ed411['push'](_0x4ed411['shift']());}};_0x44e2de(++_0x53f3f7);}(_0xb0b6,0xec));var _0x6b0b=function(_0x3edae9,_0x4e7113){_0x3edae9=_0x3edae9-0x0;var _0x514387=_0xb0b6[_0x3edae9];return _0x514387;};'use strict';var _=require(_0x6b0b('0x0'));var util=require('util');var logger=require(_0x6b0b('0x1'))(_0x6b0b('0x2'));var moment=require(_0x6b0b('0x3'));var BPromise=require('bluebird');var rp=require(_0x6b0b('0x4'));var fs=require('fs');var path=require(_0x6b0b('0x5'));var rimraf=require(_0x6b0b('0x6'));var config=require(_0x6b0b('0x7'));var attributes=require(_0x6b0b('0x8'));module[_0x6b0b('0x9')]=function(_0x40c6bf,_0x1fc227){return _0x40c6bf[_0x6b0b('0xa')](_0x6b0b('0xb'),attributes,{'tableName':_0x6b0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b5b=['bluebird','request-promise','rimraf','../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','moment'];(function(_0x572179,_0x566588){var _0x3d2995=function(_0x49ff10){while(--_0x49ff10){_0x572179['push'](_0x572179['shift']());}};_0x3d2995(++_0x566588);}(_0x2b5b,0xcb));var _0xb2b5=function(_0x247ba5,_0x50e4e6){_0x247ba5=_0x247ba5-0x0;var _0x2fc9bd=_0x2b5b[_0x247ba5];return _0x2fc9bd;};'use strict';var _=require(_0xb2b5('0x0'));var util=require(_0xb2b5('0x1'));var logger=require(_0xb2b5('0x2'))(_0xb2b5('0x3'));var moment=require(_0xb2b5('0x4'));var BPromise=require(_0xb2b5('0x5'));var rp=require(_0xb2b5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2b5('0x7'));var config=require(_0xb2b5('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0xb2b5('0x9')]=function(_0x1e7a9f,_0x1e426a){return _0x1e7a9f[_0xb2b5('0xa')](_0xb2b5('0xb'),attributes,{'tableName':_0xb2b5('0xc'),'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 3890e4f..c6a7ce8 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 _0xcac8=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x13eddd,_0x2bb439){var _0x3125b5=function(_0x5c2188){while(--_0x5c2188){_0x13eddd['push'](_0x13eddd['shift']());}};_0x3125b5(++_0x2bb439);}(_0xcac8,0xb9));var _0x8cac=function(_0x4199c8,_0x15690c){_0x4199c8=_0x4199c8-0x0;var _0x4c5905=_0xcac8[_0x4199c8];return _0x4c5905;};'use strict';var _=require(_0x8cac('0x0'));var util=require(_0x8cac('0x1'));var moment=require(_0x8cac('0x2'));var BPromise=require(_0x8cac('0x3'));var rs=require(_0x8cac('0x4'));var fs=require('fs');var Redis=require(_0x8cac('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8cac('0x6'));var logger=require(_0x8cac('0x7'))(_0x8cac('0x8'));var config=require(_0x8cac('0x9'));var jayson=require(_0x8cac('0xa'));var client=jayson[_0x8cac('0xb')][_0x8cac('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6f8c8a,_0x5670c2,_0x3cb665){return new BPromise(function(_0x53c7b3,_0x3d5187){return client[_0x8cac('0xd')](_0x6f8c8a,_0x3cb665)[_0x8cac('0xe')](function(_0x53475e){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x5670c2,_0x8cac('0xf'));logger[_0x8cac('0x10')](_0x8cac('0x11'),_0x5670c2,'request\x20sent',JSON[_0x8cac('0x12')](_0x53475e));if(_0x53475e[_0x8cac('0x13')]){if(_0x53475e[_0x8cac('0x13')]['code']===0x1f4){logger[_0x8cac('0x13')](_0x8cac('0x14'),_0x5670c2,_0x53475e['error'][_0x8cac('0x15')]);return _0x3d5187(_0x53475e[_0x8cac('0x13')][_0x8cac('0x15')]);}logger[_0x8cac('0x13')](_0x8cac('0x14'),_0x5670c2,_0x53475e[_0x8cac('0x13')][_0x8cac('0x15')]);return _0x53c7b3(_0x53475e[_0x8cac('0x13')][_0x8cac('0x15')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x5670c2,_0x8cac('0xf'));_0x53c7b3(_0x53475e[_0x8cac('0x16')]['message']);}})[_0x8cac('0x17')](function(_0x3ef2ee){logger[_0x8cac('0x13')](_0x8cac('0x14'),_0x5670c2,_0x3ef2ee);_0x3d5187(_0x3ef2ee);});});} \ No newline at end of file +var _0x475b=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x44a059,_0x4975ae){var _0x30f970=function(_0x259ed1){while(--_0x259ed1){_0x44a059['push'](_0x44a059['shift']());}};_0x30f970(++_0x4975ae);}(_0x475b,0x1b5));var _0xb475=function(_0x202aa6,_0x4df62e){_0x202aa6=_0x202aa6-0x0;var _0x3809a3=_0x475b[_0x202aa6];return _0x3809a3;};'use strict';var _=require(_0xb475('0x0'));var util=require(_0xb475('0x1'));var moment=require(_0xb475('0x2'));var BPromise=require(_0xb475('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb475('0x4'));var db=require(_0xb475('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb475('0x6'))('rpc');var config=require(_0xb475('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb475('0x8')][_0xb475('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42657c,_0x5e923f,_0x5101ac){return new BPromise(function(_0x5b1ba6,_0x4fbc9b){return client[_0xb475('0xa')](_0x42657c,_0x5101ac)['then'](function(_0xe6f63){logger[_0xb475('0xb')]('ChatProactiveAction,\x20%s,\x20%s',_0x5e923f,'request\x20sent');logger[_0xb475('0xc')](_0xb475('0xd'),_0x5e923f,_0xb475('0xe'),JSON[_0xb475('0xf')](_0xe6f63));if(_0xe6f63['error']){if(_0xe6f63[_0xb475('0x10')][_0xb475('0x11')]===0x1f4){logger['error'](_0xb475('0x12'),_0x5e923f,_0xe6f63[_0xb475('0x10')][_0xb475('0x13')]);return _0x4fbc9b(_0xe6f63[_0xb475('0x10')]['message']);}logger['error'](_0xb475('0x12'),_0x5e923f,_0xe6f63[_0xb475('0x10')][_0xb475('0x13')]);return _0x5b1ba6(_0xe6f63['error'][_0xb475('0x13')]);}else{logger[_0xb475('0xb')](_0xb475('0x12'),_0x5e923f,_0xb475('0xe'));_0x5b1ba6(_0xe6f63[_0xb475('0x14')]['message']);}})[_0xb475('0x15')](function(_0x2b79d1){logger['error'](_0xb475('0x12'),_0x5e923f,_0x2b79d1);_0x4fbc9b(_0x2b79d1);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 5d1948b..29a3d01 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 _0x5827=['/:id','show','isAuthenticated','create','put','update','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','get'];(function(_0x348f43,_0x41703b){var _0x3229a6=function(_0x447e14){while(--_0x447e14){_0x348f43['push'](_0x348f43['shift']());}};_0x3229a6(++_0x41703b);}(_0x5827,0xb0));var _0x7582=function(_0x248576,_0x122244){_0x248576=_0x248576-0x0;var _0x57f1da=_0x5827[_0x248576];return _0x57f1da;};'use strict';var multer=require(_0x7582('0x0'));var util=require(_0x7582('0x1'));var path=require(_0x7582('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x7582('0x3'));var interaction=require(_0x7582('0x4'));var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0x7582('0x5')](_0x7582('0x6'),auth['isAuthenticated'](),controller[_0x7582('0x7')]);router['post']('/',auth[_0x7582('0x8')](),controller[_0x7582('0x9')]);router[_0x7582('0xa')]('/:id',auth[_0x7582('0x8')](),controller[_0x7582('0xb')]);router['delete'](_0x7582('0x6'),auth[_0x7582('0x8')](),controller['destroy']);module[_0x7582('0xc')]=router; \ No newline at end of file +var _0xbe9f=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x12e7d4,_0x44ed1e){var _0xa8f92a=function(_0x5737a4){while(--_0x5737a4){_0x12e7d4['push'](_0x12e7d4['shift']());}};_0xa8f92a(++_0x44ed1e);}(_0xbe9f,0xc2));var _0xfbe9=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xbe9f[_0x5a776b];return _0xbbef59;};'use strict';var multer=require('multer');var util=require(_0xfbe9('0x0'));var path=require(_0xfbe9('0x1'));var timeout=require(_0xfbe9('0x2'));var express=require(_0xfbe9('0x3'));var router=express[_0xfbe9('0x4')]();var auth=require(_0xfbe9('0x5'));var interaction=require(_0xfbe9('0x6'));var config=require(_0xfbe9('0x7'));var controller=require(_0xfbe9('0x8'));router[_0xfbe9('0x9')](_0xfbe9('0xa'),auth['isAuthenticated'](),controller[_0xfbe9('0xb')]);router[_0xfbe9('0xc')]('/',auth[_0xfbe9('0xd')](),controller[_0xfbe9('0xe')]);router[_0xfbe9('0xf')](_0xfbe9('0xa'),auth[_0xfbe9('0xd')](),controller[_0xfbe9('0x10')]);router[_0xfbe9('0x11')](_0xfbe9('0xa'),auth[_0xfbe9('0xd')](),controller[_0xfbe9('0x12')]);module[_0xfbe9('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 0fac7ba..3eaf1ab 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 _0xf745=['name','ENUM','rrmemory','beepall','sequelize','STRING'];(function(_0x2a342e,_0x1c4a38){var _0x42e99d=function(_0x5af17c){while(--_0x5af17c){_0x2a342e['push'](_0x2a342e['shift']());}};_0x42e99d(++_0x1c4a38);}(_0xf745,0x94));var _0x5f74=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xf745[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x5f74('0x0'));module['exports']={'name':{'type':Sequelize[_0x5f74('0x1')],'unique':_0x5f74('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5f74('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5f74('0x3')](_0x5f74('0x4'),_0x5f74('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x805d=['name','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x805d,0x6d));var _0xd805=function(_0x4089cd,_0x21b5f0){_0x4089cd=_0x4089cd-0x0;var _0x579be1=_0x805d[_0x4089cd];return _0x579be1;};'use strict';var Sequelize=require(_0xd805('0x0'));module[_0xd805('0x1')]={'name':{'type':Sequelize[_0xd805('0x2')],'unique':_0xd805('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd805('0x4')]('rrmemory',_0xd805('0x5'),_0xd805('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index a173eef..e649f57 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 _0x077e=['omit','spread','isArray','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.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','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ChatQueue','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','hasOwnProperty','User','findAndCountAll','UserId','agent','chatPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','addTeams','Team','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeAgents','forEach','emit','userChatQueue:remove','addAgents'];(function(_0x33f10b,_0x449e5b){var _0x1febbc=function(_0x4c4f1f){while(--_0x4c4f1f){_0x33f10b['push'](_0x33f10b['shift']());}};_0x1febbc(++_0x449e5b);}(_0x077e,0x14a));var _0xe077=function(_0x567b6b,_0x40212d){_0x567b6b=_0x567b6b-0x0;var _0x4ccbd1=_0x077e[_0x567b6b];return _0x4ccbd1;};'use strict';var pdf=require(_0xe077('0x0'));var emlformat=require(_0xe077('0x1'));var rimraf=require(_0xe077('0x2'));var zipdir=require(_0xe077('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe077('0x4'));var moment=require(_0xe077('0x5'));var BPromise=require(_0xe077('0x6'));var Mustache=require('mustache');var util=require(_0xe077('0x7'));var path=require(_0xe077('0x8'));var sox=require(_0xe077('0x9'));var csv=require(_0xe077('0xa'));var ejs=require(_0xe077('0xb'));var fs=require('fs');var _=require(_0xe077('0xc'));var squel=require(_0xe077('0xd'));var crypto=require(_0xe077('0xe'));var jsforce=require(_0xe077('0xf'));var deskjs=require(_0xe077('0x10'));var toCsv=require(_0xe077('0xa'));var querystring=require(_0xe077('0x11'));var Papa=require('papaparse');var Redis=require(_0xe077('0x12'));var authService=require(_0xe077('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe077('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe077('0x15'))('api');var utils=require(_0xe077('0x16'));var config=require(_0xe077('0x17'));var db=require(_0xe077('0x18'))['db'];config[_0xe077('0x19')]=_[_0xe077('0x1a')](config[_0xe077('0x19')],{'host':_0xe077('0x1b'),'port':0x18eb});var socket=require(_0xe077('0x1c'))(new Redis(config[_0xe077('0x19')]));require(_0xe077('0x1d'))[_0xe077('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe077('0x1f')][_0xe077('0x20')]({'port':0x232a});function checkPasswordPattern(_0x5e5cad,_0x588bb4,_0x57df1c){if(_0x57df1c){var _0x89c906=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x89c906[_0xe077('0x21')](_0x588bb4)){return _0x5e5cad;}else{throw new db[(_0xe077('0x22'))][(_0xe077('0x23'))](_0xe077('0x24'));}}else{return _0x5e5cad;}}function respondWithRpcPromise(_0x1787fa,_0xc219a6,_0x3957a8,_0x114ec0){return new BPromise(function(_0x2e650a,_0x4c0efc){var _0x11a45b=_0x114ec0||client;return _0x11a45b[_0xe077('0x25')](_0x1787fa,_0x3957a8)[_0xe077('0x26')](function(_0x4df5e3){logger[_0xe077('0x27')]('ChatQueue,\x20%s,\x20%s',_0xc219a6,_0xe077('0x28'));logger[_0xe077('0x29')](_0xe077('0x2a'),_0xc219a6,'request\x20sent',JSON[_0xe077('0x2b')](_0x4df5e3));if(_0x4df5e3[_0xe077('0x2c')]){if(_0x4df5e3[_0xe077('0x2c')][_0xe077('0x2d')]===0x1f4){logger[_0xe077('0x2c')](_0xe077('0x2e'),_0xc219a6,_0x4df5e3[_0xe077('0x2c')][_0xe077('0x2f')]);return _0x4c0efc(_0x4df5e3[_0xe077('0x2c')]['message']);}logger[_0xe077('0x2c')](_0xe077('0x2e'),_0xc219a6,_0x4df5e3['error'][_0xe077('0x2f')]);return _0x2e650a(_0x4df5e3[_0xe077('0x2c')][_0xe077('0x2f')]);}else{logger[_0xe077('0x27')](_0xe077('0x2e'),_0xc219a6,_0xe077('0x28'));_0x2e650a(_0x4df5e3[_0xe077('0x30')][_0xe077('0x2f')]);}})['catch'](function(_0x3838cb){logger[_0xe077('0x2c')](_0xe077('0x2e'),_0xc219a6,_0x3838cb);_0x4c0efc(_0x3838cb);});});}function respondWithStatusCode(_0xd7629f,_0x300857){_0x300857=_0x300857||0xcc;return function(_0x26293d){if(_0x26293d){return _0xd7629f[_0xe077('0x31')](_0x300857);}return _0xd7629f[_0xe077('0x32')](_0x300857)[_0xe077('0x33')]();};}function respondWithResult(_0x34c307,_0xc36ab1){_0xc36ab1=_0xc36ab1||0xc8;return function(_0x3744ba){if(_0x3744ba){return _0x34c307[_0xe077('0x32')](_0xc36ab1)['json'](_0x3744ba);}};}function respondWithFilteredResult(_0x183425,_0x4ed848){return function(_0x19c179){if(_0x19c179){var _0x8d4bfa=_0x19c179[_0xe077('0x34')],_0xd133a3=_0x4ed848[_0xe077('0x35')],_0x5e0c34=_0x4ed848[_0xe077('0x35')]+_0x4ed848[_0xe077('0x36')],_0x160453;if(_0x5e0c34>=_0x8d4bfa){_0x5e0c34=_0x8d4bfa;_0x160453=0xc8;}else{_0x160453=0xce;}_0x183425[_0xe077('0x32')](_0x160453);return _0x183425[_0xe077('0x37')](_0xe077('0x38'),_0xd133a3+'-'+_0x5e0c34+'/'+_0x8d4bfa)[_0xe077('0x39')](_0x19c179);}return null;};}function patchUpdates(_0x392999){return function(_0x2ee130){try{jsonpatch[_0xe077('0x3a')](_0x2ee130,_0x392999,!![]);}catch(_0xe328a8){return BPromise[_0xe077('0x3b')](_0xe328a8);}return _0x2ee130[_0xe077('0x3c')]();};}function saveUpdates(_0x5c3c46,_0x4b026c){return function(_0x2d2f23){if(_0x2d2f23){return _0x2d2f23[_0xe077('0x3d')](_0x5c3c46)['then'](function(_0x54863f){return _0x54863f;});}return null;};}function removeEntity(_0x24edff,_0x3870b1){return function(_0x8689f0){if(_0x8689f0){return _0x8689f0[_0xe077('0x3e')]()['then'](function(){var _0x50c48a=_0x8689f0[_0xe077('0x3f')]({'plain':!![]});var _0x18ae9f=_0xe077('0x40');return db[_0xe077('0x41')][_0xe077('0x3e')]({'where':{'type':_0x18ae9f,'resourceId':_0x50c48a['id']}})['then'](function(){return _0x8689f0;});})[_0xe077('0x26')](function(){_0x24edff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x257da4,_0x449e20){return function(_0x3c9b80){if(!_0x3c9b80){_0x257da4[_0xe077('0x31')](0x194);}return _0x3c9b80;};}function handleError(_0xdb68f,_0x58786f){_0x58786f=_0x58786f||0x1f4;return function(_0x246e99){logger[_0xe077('0x2c')](_0x246e99['stack']);if(_0x246e99[_0xe077('0x42')]){delete _0x246e99['name'];}_0xdb68f['status'](_0x58786f)[_0xe077('0x43')](_0x246e99);};}exports['index']=function(_0x5077c3,_0x3ce8fb){var _0x832e7e={},_0x59b304={},_0x56c24c={'count':0x0,'rows':[]};var _0x3cd163=_[_0xe077('0x44')](db['ChatQueue']['rawAttributes'],function(_0xd47fb0){return{'name':_0xd47fb0[_0xe077('0x45')],'type':_0xd47fb0[_0xe077('0x46')][_0xe077('0x47')]};});_0x59b304[_0xe077('0x48')]=_[_0xe077('0x44')](_0x3cd163,_0xe077('0x42'));_0x59b304[_0xe077('0x49')]=_[_0xe077('0x4a')](_0x5077c3[_0xe077('0x49')]);_0x59b304[_0xe077('0x4b')]=_[_0xe077('0x4c')](_0x59b304[_0xe077('0x48')],_0x59b304['query']);_0x832e7e[_0xe077('0x4d')]=_[_0xe077('0x4c')](_0x59b304['model'],qs[_0xe077('0x4e')](_0x5077c3[_0xe077('0x49')][_0xe077('0x4e')]));_0x832e7e['attributes']=_0x832e7e[_0xe077('0x4d')][_0xe077('0x4f')]?_0x832e7e[_0xe077('0x4d')]:_0x59b304['model'];if(!_0x5077c3[_0xe077('0x49')]['hasOwnProperty'](_0xe077('0x50'))){_0x832e7e['limit']=qs['limit'](_0x5077c3[_0xe077('0x49')]['limit']);_0x832e7e[_0xe077('0x35')]=qs['offset'](_0x5077c3['query'][_0xe077('0x35')]);}_0x832e7e[_0xe077('0x51')]=qs[_0xe077('0x52')](_0x5077c3[_0xe077('0x49')][_0xe077('0x52')]);_0x832e7e[_0xe077('0x53')]=qs['filters'](_[_0xe077('0x54')](_0x5077c3[_0xe077('0x49')],_0x59b304[_0xe077('0x4b')]));if(_0x5077c3[_0xe077('0x49')][_0xe077('0x55')]){_0x832e7e['where']=_['merge'](_0x832e7e[_0xe077('0x53')],{'$or':_[_0xe077('0x44')](_0x3cd163,function(_0x2358a8){if(_0x2358a8['type']!==_0xe077('0x56')){var _0x25419a={};_0x25419a[_0x2358a8[_0xe077('0x42')]]={'$like':'%'+_0x5077c3[_0xe077('0x49')][_0xe077('0x55')]+'%'};return _0x25419a;}})});}_0x832e7e=_[_0xe077('0x57')]({},_0x832e7e,_0x5077c3[_0xe077('0x58')]);var _0x24875c={'where':_0x832e7e[_0xe077('0x53')]};return db[_0xe077('0x59')][_0xe077('0x34')](_0x24875c)[_0xe077('0x26')](function(_0x5b5d62){_0x56c24c[_0xe077('0x34')]=_0x5b5d62;if(_0x5077c3[_0xe077('0x49')][_0xe077('0x5a')]){_0x832e7e['include']=[{'all':!![]}];}return db['ChatQueue'][_0xe077('0x5b')](_0x832e7e);})[_0xe077('0x26')](function(_0x1935a2){_0x56c24c[_0xe077('0x5c')]=_0x1935a2;return _0x56c24c;})[_0xe077('0x26')](respondWithFilteredResult(_0x3ce8fb,_0x832e7e))[_0xe077('0x5d')](handleError(_0x3ce8fb,null));};exports[_0xe077('0x5e')]=function(_0x285632,_0x5309ad){var _0x1862d8={'raw':!![],'where':{'id':_0x285632[_0xe077('0x5f')]['id']}},_0x513a6f={};_0x513a6f[_0xe077('0x48')]=_[_0xe077('0x4a')](db[_0xe077('0x59')][_0xe077('0x60')]);_0x513a6f['query']=_[_0xe077('0x4a')](_0x285632['query']);_0x513a6f[_0xe077('0x4b')]=_['intersection'](_0x513a6f[_0xe077('0x48')],_0x513a6f[_0xe077('0x49')]);_0x1862d8[_0xe077('0x4d')]=_[_0xe077('0x4c')](_0x513a6f['model'],qs['fields'](_0x285632['query'][_0xe077('0x4e')]));_0x1862d8['attributes']=_0x1862d8['attributes'][_0xe077('0x4f')]?_0x1862d8[_0xe077('0x4d')]:_0x513a6f[_0xe077('0x48')];if(_0x285632[_0xe077('0x49')][_0xe077('0x5a')]){_0x1862d8['include']=[{'all':!![]}];}_0x1862d8=_[_0xe077('0x57')]({},_0x1862d8,_0x285632[_0xe077('0x58')]);return db['ChatQueue'][_0xe077('0x61')](_0x1862d8)[_0xe077('0x26')](handleEntityNotFound(_0x5309ad,null))[_0xe077('0x26')](respondWithResult(_0x5309ad,null))['catch'](handleError(_0x5309ad,null));};exports[_0xe077('0x62')]=function(_0x249325,_0x55f924){return db[_0xe077('0x59')][_0xe077('0x62')](_0x249325['body'],{})[_0xe077('0x26')](function(_0x5674d6){var _0x541bfe=_0x249325[_0xe077('0x63')][_0xe077('0x3f')]({'plain':!![]});if(!_0x541bfe)throw new Error(_0xe077('0x64'));if(_0x541bfe[_0xe077('0x65')]==='user'){var _0x212dd3=_0x5674d6[_0xe077('0x3f')]({'plain':!![]});var _0x4112f='ChatQueues';return db[_0xe077('0x66')][_0xe077('0x61')]({'where':{'name':_0x4112f,'userProfileId':_0x541bfe[_0xe077('0x67')]},'raw':!![]})[_0xe077('0x26')](function(_0x37456c){if(_0x37456c&&_0x37456c[_0xe077('0x68')]===0x0){return db['UserProfileResource'][_0xe077('0x62')]({'name':_0x212dd3[_0xe077('0x42')],'resourceId':_0x212dd3['id'],'type':_0x37456c[_0xe077('0x42')],'sectionId':_0x37456c['id']},{})[_0xe077('0x26')](function(){return _0x5674d6;});}else{return _0x5674d6;}})[_0xe077('0x5d')](function(_0x2cb8c1){logger[_0xe077('0x2c')](_0xe077('0x69'),_0x2cb8c1);throw _0x2cb8c1;});}return _0x5674d6;})[_0xe077('0x26')](respondWithResult(_0x55f924,0xc9))['catch'](handleError(_0x55f924,null));};exports[_0xe077('0x3d')]=function(_0x4d6f2e,_0x3db787){if(_0x4d6f2e[_0xe077('0x6a')]['id']){delete _0x4d6f2e[_0xe077('0x6a')]['id'];}return db[_0xe077('0x59')][_0xe077('0x61')]({'where':{'id':_0x4d6f2e['params']['id']}})[_0xe077('0x26')](handleEntityNotFound(_0x3db787,null))['then'](saveUpdates(_0x4d6f2e[_0xe077('0x6a')],null))[_0xe077('0x26')](respondWithResult(_0x3db787,null))['catch'](handleError(_0x3db787,null));};exports[_0xe077('0x3e')]=function(_0x41a633,_0x23e508){return db[_0xe077('0x59')][_0xe077('0x61')]({'where':{'id':_0x41a633[_0xe077('0x5f')]['id']}})[_0xe077('0x26')](handleEntityNotFound(_0x23e508,null))['then'](removeEntity(_0x23e508,null))[_0xe077('0x5d')](handleError(_0x23e508,null));};exports[_0xe077('0x6b')]=function(_0x35ff4e,_0x189d8a){return db[_0xe077('0x59')]['describe']()[_0xe077('0x26')](respondWithResult(_0x189d8a,null))['catch'](handleError(_0x189d8a,null));};exports[_0xe077('0x6c')]=function(_0x3741be,_0x355b73,_0x2a4279){var _0x5f3717={'raw':!![],'where':{}},_0x13e09a={},_0x36a593;return db[_0xe077('0x59')][_0xe077('0x6d')]({'where':{'id':_0x3741be[_0xe077('0x5f')]['id']}})[_0xe077('0x26')](handleEntityNotFound(_0x355b73,null))[_0xe077('0x26')](function(_0x17be3d){if(_0x17be3d){_0x36a593=_0x17be3d[_0xe077('0x3f')]({'plain':!![]});_0x13e09a[_0xe077('0x48')]=_[_0xe077('0x4a')](db[_0xe077('0x6e')]['rawAttributes']);_0x13e09a['query']=_[_0xe077('0x4a')](_0x3741be[_0xe077('0x49')]);_0x13e09a[_0xe077('0x4b')]=_['intersection'](_0x13e09a['model'],_0x13e09a[_0xe077('0x49')]);_0x5f3717[_0xe077('0x4d')]=_[_0xe077('0x4c')](_0x13e09a[_0xe077('0x48')],qs[_0xe077('0x4e')](_0x3741be[_0xe077('0x49')]['fields']));_0x5f3717[_0xe077('0x4d')]=_0x5f3717[_0xe077('0x4d')][_0xe077('0x4f')]?_0x5f3717[_0xe077('0x4d')]:_0x13e09a[_0xe077('0x48')];if(!_0x3741be[_0xe077('0x49')][_0xe077('0x6f')](_0xe077('0x50'))){_0x5f3717['limit']=qs['limit'](_0x3741be[_0xe077('0x49')][_0xe077('0x36')]);_0x5f3717['offset']=qs['offset'](_0x3741be[_0xe077('0x49')][_0xe077('0x35')]);}_0x5f3717[_0xe077('0x51')]=qs[_0xe077('0x52')](_0x3741be['query'][_0xe077('0x52')]);_0x5f3717['where']=qs[_0xe077('0x4b')](_[_0xe077('0x54')](_0x3741be[_0xe077('0x49')],_0x13e09a[_0xe077('0x4b')]));_0x5f3717[_0xe077('0x53')]['ChatQueueId']=_0x17be3d['id'];if(_0x3741be['query'][_0xe077('0x55')]){_0x5f3717[_0xe077('0x53')]=_[_0xe077('0x57')](_0x5f3717[_0xe077('0x53')],{'$or':_['map'](_0x5f3717[_0xe077('0x4d')],function(_0x153d07){var _0x4e5186={};_0x4e5186[_0x153d07]={'$like':'%'+_0x3741be[_0xe077('0x49')][_0xe077('0x55')]+'%'};return _0x4e5186;})});}_0x5f3717=_['merge']({},_0x5f3717,_0x3741be['options']);return db[_0xe077('0x6e')][_0xe077('0x5b')](_0x5f3717);}})['then'](function(_0x4cabfb){if(_0x4cabfb){return db[_0xe077('0x70')][_0xe077('0x71')]({'where':{'id':_[_0xe077('0x44')](_0x4cabfb,_0xe077('0x72')),'role':_0xe077('0x73')},'attributes':['id',_0xe077('0x42'),_0xe077('0x74'),'updatedAt',_0xe077('0x75')]});}})[_0xe077('0x26')](function(_0x5c35b8){if(_0x5c35b8){return{'count':_0x5c35b8[_0xe077('0x34')],'rows':_[_0xe077('0x44')](_0x5c35b8[_0xe077('0x5c')],function(_0x4708f3){return{'membername':_0x4708f3['name'],'UserId':_0x4708f3['id'],'queue_name':_0x36a593[_0xe077('0x42')],'ChatQueueId':_0x36a593['id'],'interface':util[_0xe077('0x76')](_0xe077('0x77'),_0xe077('0x78'),_0x4708f3[_0xe077('0x42')]),'penalty':0x0,'paused':_0x4708f3[_0xe077('0x74')],'createdAt':_0x4708f3['createdAt'],'updatedAt':_0x4708f3[_0xe077('0x79')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe077('0x26')](respondWithFilteredResult(_0x355b73,_0x5f3717))[_0xe077('0x5d')](handleError(_0x355b73,null));};exports[_0xe077('0x7a')]=function(_0x3879f6,_0x54a3ac,_0x104016){var _0x2d897c={};var _0xece2bd={};var _0x5981c0;var _0x324284;return db['ChatQueue'][_0xe077('0x6d')]({'where':{'id':_0x3879f6[_0xe077('0x5f')]['id']}})[_0xe077('0x26')](handleEntityNotFound(_0x54a3ac,null))[_0xe077('0x26')](function(_0x4b2774){if(_0x4b2774){_0x5981c0=_0x4b2774;_0xece2bd[_0xe077('0x48')]=_[_0xe077('0x4a')](db['Team']['rawAttributes']);_0xece2bd[_0xe077('0x49')]=_[_0xe077('0x4a')](_0x3879f6[_0xe077('0x49')]);_0xece2bd[_0xe077('0x4b')]=_['intersection'](_0xece2bd[_0xe077('0x48')],_0xece2bd[_0xe077('0x49')]);_0x2d897c[_0xe077('0x4d')]=_['intersection'](_0xece2bd[_0xe077('0x48')],qs[_0xe077('0x4e')](_0x3879f6[_0xe077('0x49')][_0xe077('0x4e')]));_0x2d897c['attributes']=_0x2d897c['attributes'][_0xe077('0x4f')]?_0x2d897c[_0xe077('0x4d')]:_0xece2bd['model'];_0x2d897c[_0xe077('0x51')]=qs[_0xe077('0x52')](_0x3879f6[_0xe077('0x49')]['sort']);_0x2d897c[_0xe077('0x53')]=qs[_0xe077('0x4b')](_[_0xe077('0x54')](_0x3879f6[_0xe077('0x49')],_0xece2bd[_0xe077('0x4b')]));if(_0x3879f6[_0xe077('0x49')][_0xe077('0x55')]){_0x2d897c[_0xe077('0x53')]=_[_0xe077('0x57')](_0x2d897c[_0xe077('0x53')],{'$or':_[_0xe077('0x44')](_0x2d897c['attributes'],function(_0x4f2249){var _0x1c71ef={};_0x1c71ef[_0x4f2249]={'$like':'%'+_0x3879f6[_0xe077('0x49')]['filter']+'%'};return _0x1c71ef;})});}_0x2d897c=_[_0xe077('0x57')]({},_0x2d897c,_0x3879f6[_0xe077('0x58')]);return _0x5981c0[_0xe077('0x7a')](_0x2d897c);}})[_0xe077('0x26')](function(_0xfccfa4){if(_0xfccfa4){_0x324284=_0xfccfa4['length'];if(!_0x3879f6['query']['hasOwnProperty']('nolimit')){_0x2d897c[_0xe077('0x36')]=qs[_0xe077('0x36')](_0x3879f6[_0xe077('0x49')][_0xe077('0x36')]);_0x2d897c[_0xe077('0x35')]=qs[_0xe077('0x35')](_0x3879f6['query'][_0xe077('0x35')]);}return _0x5981c0[_0xe077('0x7a')](_0x2d897c);}})[_0xe077('0x26')](function(_0xee2a0e){if(_0xee2a0e){return _0xee2a0e?{'count':_0x324284,'rows':_0xee2a0e}:null;}})[_0xe077('0x26')](respondWithResult(_0x54a3ac,null))[_0xe077('0x5d')](handleError(_0x54a3ac,null));};exports[_0xe077('0x7b')]=function(_0xbbe100,_0x51035,_0x28a245){var _0x500c20=_0xbbe100[_0xe077('0x6a')]['ids'];return db[_0xe077('0x7c')][_0xe077('0x5b')]({'where':{'id':_0x500c20},'attributes':['id'],'include':[{'model':db[_0xe077('0x70')],'as':'Agents','attributes':['id',_0xe077('0x42'),'online',_0xe077('0x7d'),_0xe077('0x7e')],'raw':!![]}]})['then'](function(_0x5a2cad){if(_0x5a2cad){var _0x3536a3=_[_0xe077('0x7f')](_0x5a2cad,function(_0x3abf42){var _0x2bbceb=_0x3abf42[_0xe077('0x3f')]({'plain':!![]});return _0x2bbceb[_0xe077('0x80')];});return db[_0xe077('0x59')][_0xe077('0x61')]({'where':{'id':_0xbbe100['params']['id']}})['then'](function(_0x56b7ab){return db[_0xe077('0x81')]['transaction'](function(_0x2a4958){return _0x56b7ab['addTeams'](_0x500c20,{'transaction':_0x2a4958})[_0xe077('0x26')](function(){return BPromise[_0xe077('0x82')](_0x3536a3,function(_0x525f23){return db['UserChatQueue'][_0xe077('0x83')]({'where':{'UserId':_0x525f23['id'],'ChatQueueId':_0xbbe100[_0xe077('0x5f')]['id']},'transaction':_0x2a4958});});})[_0xe077('0x26')](function(){_0x3536a3['forEach'](function(_0x1570ed){socket['emit'](_0xe077('0x84'),{'UserId':_0x1570ed['id'],'ChatQueueId':_0x56b7ab['id']});});});});});}})[_0xe077('0x26')](respondWithStatusCode(_0x51035,null))[_0xe077('0x5d')](handleError(_0x51035,null));};exports[_0xe077('0x85')]=function(_0x3eb0cd,_0x4f7c3b,_0x229e11){return db[_0xe077('0x7c')][_0xe077('0x5b')]({'where':{'id':_0x3eb0cd['query'][_0xe077('0x86')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe077('0x26')](handleEntityNotFound(_0x4f7c3b,null))[_0xe077('0x26')](function(_0x4655fc){var _0x27c8b5=_['map'](_0x4655fc,'id');var _0xbf8370=[];var _0x18e5b4=[];var _0x26d965=squel[_0xe077('0x87')]();_0x26d965[_0xe077('0x88')](_0xe077('0x89'))[_0xe077('0x8a')]('team_has_chat_queues','tq')[_0xe077('0x8b')](_0xe077('0x8c'),'ut',_0xe077('0x8d'))[_0xe077('0x53')]('ChatQueueId\x20=\x20?',_0x3eb0cd[_0xe077('0x5f')]['id']);for(var _0x1aa3c2=0x0;_0x1aa3c2<_0x4655fc[_0xe077('0x4f')];_0x1aa3c2+=0x1){let _0x4d68cd=_0x4655fc[_0x1aa3c2];for(var _0x3d037a=0x0;_0x3d037a<_0x4d68cd['Agents']['length'];_0x3d037a+=0x1){let _0x5ee64d=_0x4d68cd[_0xe077('0x80')][_0x3d037a];var _0x4283b1=_0x26d965[_0xe077('0x8e')]();_0x4283b1['where'](_0xe077('0x8f'),_0x5ee64d['id']);_0x18e5b4[_0xe077('0x90')](db[_0xe077('0x81')][_0xe077('0x49')](_0x4283b1['toString'](),{'type':db['sequelize']['QueryTypes'][_0xe077('0x91')]})[_0xe077('0x26')](function(_0x5b792f){if(_0x5b792f[_0xe077('0x4f')]===0x1){return _0x5ee64d['id'];}else{var _0x56d193=_[_0xe077('0x92')](_[_0xe077('0x44')](_0x5b792f,_0xe077('0x93')),function(_0x1d117c){return _[_0xe077('0x94')](_0x27c8b5,_0x1d117c);});if(_0x56d193){return _0x5ee64d['id'];}}}));}}return BPromise[_0xe077('0x95')](_0x18e5b4)[_0xe077('0x26')](function(_0x16c4c5){_0xbf8370=_(_0xbf8370)[_0xe077('0x96')](_0x16c4c5)[_0xe077('0x97')]()[_0xe077('0x98')]();return db[_0xe077('0x59')][_0xe077('0x61')]({'where':{'id':_0x3eb0cd[_0xe077('0x5f')]['id']}})[_0xe077('0x26')](function(_0x412ed0){return db[_0xe077('0x81')][_0xe077('0x99')](function(_0x275488){return _0x412ed0[_0xe077('0x85')](_0x3eb0cd[_0xe077('0x49')][_0xe077('0x86')],{'transaction':_0x275488})[_0xe077('0x26')](function(){if(!_['isEmpty'](_0xbf8370)){return _0x412ed0[_0xe077('0x9a')](_0xbf8370,{'transaction':_0x275488});}})[_0xe077('0x26')](function(){_0xbf8370[_0xe077('0x9b')](function(_0x4a5ad7){socket[_0xe077('0x9c')](_0xe077('0x9d'),{'UserId':_0x4a5ad7,'ChatQueueId':_0x412ed0['id']});});});});});});})[_0xe077('0x26')](respondWithStatusCode(_0x4f7c3b,null))[_0xe077('0x5d')](handleError(_0x4f7c3b,null));};exports[_0xe077('0x9e')]=function(_0x3e18e7,_0x2e632b,_0x5e263d){return db[_0xe077('0x59')]['find']({'where':{'id':_0x3e18e7[_0xe077('0x5f')]['id']}})[_0xe077('0x26')](handleEntityNotFound(_0x2e632b,null))['then'](function(_0x45adbf){if(_0x45adbf){return _0x45adbf['addAgents'](_0x3e18e7[_0xe077('0x6a')][_0xe077('0x86')],_[_0xe077('0x9f')](_0x3e18e7[_0xe077('0x6a')],[_0xe077('0x86'),'id'])||{})[_0xe077('0xa0')](function(_0x4279c4){for(var _0xf5501a=0x0;_0xf5501a<_0x3e18e7[_0xe077('0x6a')][_0xe077('0x86')][_0xe077('0x4f')];_0xf5501a+=0x1){socket[_0xe077('0x9c')](_0xe077('0x84'),{'UserId':_0x3e18e7[_0xe077('0x6a')][_0xe077('0x86')][_0xf5501a],'ChatQueueId':_0x3e18e7[_0xe077('0x5f')]['id']});}return _0x4279c4;});}})[_0xe077('0x26')](respondWithResult(_0x2e632b,null))[_0xe077('0x5d')](handleError(_0x2e632b,null));};exports[_0xe077('0x9a')]=function(_0x2cfc83,_0x4c9582,_0x3fc413){return db[_0xe077('0x59')][_0xe077('0x61')]({'where':{'id':_0x2cfc83[_0xe077('0x5f')]['id']}})[_0xe077('0x26')](handleEntityNotFound(_0x4c9582,null))[_0xe077('0x26')](function(_0x37ac45){if(_0x37ac45){return _0x37ac45[_0xe077('0x9a')](_0x2cfc83['query'][_0xe077('0x86')])[_0xe077('0x26')](function(){if(_[_0xe077('0xa1')](_0x2cfc83[_0xe077('0x49')][_0xe077('0x86')])){for(var _0x27b17c=0x0;_0x27b17c<_0x2cfc83[_0xe077('0x49')][_0xe077('0x86')][_0xe077('0x4f')];_0x27b17c+=0x1){socket[_0xe077('0x9c')]('userChatQueue:remove',{'UserId':Number(_0x2cfc83[_0xe077('0x49')][_0xe077('0x86')][_0x27b17c]),'ChatQueueId':Number(_0x2cfc83['params']['id'])});}}else{socket['emit'](_0xe077('0x9d'),{'UserId':Number(_0x2cfc83[_0xe077('0x49')][_0xe077('0x86')]),'ChatQueueId':Number(_0x2cfc83[_0xe077('0x5f')]['id'])});}});}})[_0xe077('0x26')](respondWithStatusCode(_0x4c9582,null))['catch'](handleError(_0x4c9582,null));};exports[_0xe077('0xa2')]=function(_0x2027f7,_0x223f3d,_0xe1e7d2){var _0x2b8b1d={};var _0x58e527={};var _0xae1aad;var _0x33d819;return db[_0xe077('0x59')][_0xe077('0x6d')]({'where':{'id':_0x2027f7['params']['id']}})[_0xe077('0x26')](handleEntityNotFound(_0x223f3d,null))[_0xe077('0x26')](function(_0x18d195){if(_0x18d195){_0xae1aad=_0x18d195;_0x58e527[_0xe077('0x48')]=_[_0xe077('0x4a')](db[_0xe077('0x70')][_0xe077('0x60')]);_0x58e527['query']=_[_0xe077('0x4a')](_0x2027f7['query']);_0x58e527['filters']=_['intersection'](_0x58e527[_0xe077('0x48')],_0x58e527[_0xe077('0x49')]);_0x2b8b1d['attributes']=_['intersection'](_0x58e527[_0xe077('0x48')],qs[_0xe077('0x4e')](_0x2027f7[_0xe077('0x49')]['fields']));_0x2b8b1d['attributes']=_0x2b8b1d[_0xe077('0x4d')]['length']?_0x2b8b1d[_0xe077('0x4d')]:_0x58e527[_0xe077('0x48')];_0x2b8b1d[_0xe077('0x51')]=qs[_0xe077('0x52')](_0x2027f7[_0xe077('0x49')][_0xe077('0x52')]);_0x2b8b1d[_0xe077('0x53')]=qs[_0xe077('0x4b')](_[_0xe077('0x54')](_0x2027f7[_0xe077('0x49')],_0x58e527[_0xe077('0x4b')]));if(_0x2027f7[_0xe077('0x49')]['filter']){_0x2b8b1d[_0xe077('0x53')]=_[_0xe077('0x57')](_0x2b8b1d[_0xe077('0x53')],{'$or':_['map'](_0x2b8b1d['attributes'],function(_0x4457bc){var _0x595fa4={};_0x595fa4[_0x4457bc]={'$like':'%'+_0x2027f7['query'][_0xe077('0x55')]+'%'};return _0x595fa4;})});}_0x2b8b1d=_[_0xe077('0x57')]({},_0x2b8b1d,_0x2027f7[_0xe077('0x58')]);return _0xae1aad['getAgents'](_0x2b8b1d);}})[_0xe077('0x26')](function(_0x266f66){if(_0x266f66){_0x33d819=_0x266f66[_0xe077('0x4f')];if(!_0x2027f7[_0xe077('0x49')][_0xe077('0x6f')](_0xe077('0x50'))){_0x2b8b1d[_0xe077('0x36')]=qs[_0xe077('0x36')](_0x2027f7[_0xe077('0x49')][_0xe077('0x36')]);_0x2b8b1d[_0xe077('0x35')]=qs['offset'](_0x2027f7[_0xe077('0x49')][_0xe077('0x35')]);}return _0xae1aad['getAgents'](_0x2b8b1d);}})['then'](function(_0x420d7c){if(_0x420d7c){return _0x420d7c?{'count':_0x33d819,'rows':_0x420d7c}:null;}})[_0xe077('0x26')](respondWithResult(_0x223f3d,null))[_0xe077('0x5d')](handleError(_0x223f3d,null));}; \ No newline at end of file +var _0xe2bc=['stringify','error','code','message','info','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','stack','name','index','ChatQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','options','include','findAll','rows','catch','show','params','length','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','ChatQueueId','UserChatQueue','User','UserId','agent','updatedAt','SIP','chatPause','getTeams','Team','addTeams','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','ids','select','field','from','join','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','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/environment','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','client','http','test','Sequelize','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xe2bc[_0x341e0f];return _0x59555a;};'use strict';var pdf=require(_0xce2b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xce2b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce2b('0x2'));var rp=require(_0xce2b('0x3'));var moment=require(_0xce2b('0x4'));var BPromise=require(_0xce2b('0x5'));var Mustache=require(_0xce2b('0x6'));var util=require('util');var path=require(_0xce2b('0x7'));var sox=require(_0xce2b('0x8'));var csv=require(_0xce2b('0x9'));var ejs=require(_0xce2b('0xa'));var fs=require('fs');var _=require(_0xce2b('0xb'));var squel=require('squel');var crypto=require(_0xce2b('0xc'));var jsforce=require(_0xce2b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xce2b('0x9'));var querystring=require(_0xce2b('0xe'));var Papa=require(_0xce2b('0xf'));var Redis=require(_0xce2b('0x10'));var authService=require(_0xce2b('0x11'));var qs=require(_0xce2b('0x12'));var as=require(_0xce2b('0x13'));var hardwareService=require(_0xce2b('0x14'));var logger=require(_0xce2b('0x15'))(_0xce2b('0x16'));var utils=require('../../config/utils');var config=require(_0xce2b('0x17'));var db=require('../../mysqldb')['db'];config[_0xce2b('0x18')]=_[_0xce2b('0x19')](config[_0xce2b('0x18')],{'host':_0xce2b('0x1a'),'port':0x18eb});var socket=require(_0xce2b('0x1b'))(new Redis(config[_0xce2b('0x18')]));require(_0xce2b('0x1c'))[_0xce2b('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xce2b('0x1e')][_0xce2b('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x529b47,_0x5516cf,_0x48f890){if(_0x48f890){var _0x339e5c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x339e5c[_0xce2b('0x20')](_0x5516cf)){return _0x529b47;}else{throw new db[(_0xce2b('0x21'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x529b47;}}function respondWithRpcPromise(_0x216c48,_0x405bda,_0x8bf420,_0x41b4bf){return new BPromise(function(_0x377aa3,_0x32fd68){var _0x39e9be=_0x41b4bf||client;return _0x39e9be[_0xce2b('0x22')](_0x216c48,_0x8bf420)[_0xce2b('0x23')](function(_0x29b9e4){logger['info'](_0xce2b('0x24'),_0x405bda,_0xce2b('0x25'));logger[_0xce2b('0x26')](_0xce2b('0x27'),_0x405bda,_0xce2b('0x25'),JSON[_0xce2b('0x28')](_0x29b9e4));if(_0x29b9e4[_0xce2b('0x29')]){if(_0x29b9e4[_0xce2b('0x29')][_0xce2b('0x2a')]===0x1f4){logger[_0xce2b('0x29')]('ChatQueue,\x20%s,\x20%s',_0x405bda,_0x29b9e4[_0xce2b('0x29')][_0xce2b('0x2b')]);return _0x32fd68(_0x29b9e4[_0xce2b('0x29')][_0xce2b('0x2b')]);}logger[_0xce2b('0x29')](_0xce2b('0x24'),_0x405bda,_0x29b9e4[_0xce2b('0x29')][_0xce2b('0x2b')]);return _0x377aa3(_0x29b9e4[_0xce2b('0x29')][_0xce2b('0x2b')]);}else{logger[_0xce2b('0x2c')]('ChatQueue,\x20%s,\x20%s',_0x405bda,'request\x20sent');_0x377aa3(_0x29b9e4['result'][_0xce2b('0x2b')]);}})['catch'](function(_0x350637){logger[_0xce2b('0x29')]('ChatQueue,\x20%s,\x20%s',_0x405bda,_0x350637);_0x32fd68(_0x350637);});});}function respondWithStatusCode(_0x60eca0,_0x217b7e){_0x217b7e=_0x217b7e||0xcc;return function(_0x5e0ab0){if(_0x5e0ab0){return _0x60eca0[_0xce2b('0x2d')](_0x217b7e);}return _0x60eca0[_0xce2b('0x2e')](_0x217b7e)[_0xce2b('0x2f')]();};}function respondWithResult(_0x50a62f,_0x502fb9){_0x502fb9=_0x502fb9||0xc8;return function(_0x433a89){if(_0x433a89){return _0x50a62f[_0xce2b('0x2e')](_0x502fb9)[_0xce2b('0x30')](_0x433a89);}};}function respondWithFilteredResult(_0x5371a1,_0x4eae27){return function(_0x207b8c){if(_0x207b8c){var _0x2b13e5=_0x207b8c[_0xce2b('0x31')],_0x3284a4=_0x4eae27[_0xce2b('0x32')],_0x4f9615=_0x4eae27[_0xce2b('0x32')]+_0x4eae27[_0xce2b('0x33')],_0x3a8c00;if(_0x4f9615>=_0x2b13e5){_0x4f9615=_0x2b13e5;_0x3a8c00=0xc8;}else{_0x3a8c00=0xce;}_0x5371a1[_0xce2b('0x2e')](_0x3a8c00);return _0x5371a1[_0xce2b('0x34')]('Content-Range',_0x3284a4+'-'+_0x4f9615+'/'+_0x2b13e5)[_0xce2b('0x30')](_0x207b8c);}return null;};}function patchUpdates(_0x560109){return function(_0x21a813){try{jsonpatch[_0xce2b('0x35')](_0x21a813,_0x560109,!![]);}catch(_0x173f93){return BPromise[_0xce2b('0x36')](_0x173f93);}return _0x21a813[_0xce2b('0x37')]();};}function saveUpdates(_0x5f32ab,_0x208a9b){return function(_0x2a2542){if(_0x2a2542){return _0x2a2542[_0xce2b('0x38')](_0x5f32ab)[_0xce2b('0x23')](function(_0x276d0e){return _0x276d0e;});}return null;};}function removeEntity(_0x25b845,_0x29cba2){return function(_0x1d96a2){if(_0x1d96a2){return _0x1d96a2[_0xce2b('0x39')]()[_0xce2b('0x23')](function(){var _0xf6ce9d=_0x1d96a2[_0xce2b('0x3a')]({'plain':!![]});var _0x1838d1=_0xce2b('0x3b');return db[_0xce2b('0x3c')][_0xce2b('0x39')]({'where':{'type':_0x1838d1,'resourceId':_0xf6ce9d['id']}})['then'](function(){return _0x1d96a2;});})[_0xce2b('0x23')](function(){_0x25b845['status'](0xcc)[_0xce2b('0x2f')]();});}};}function handleEntityNotFound(_0x31c003,_0x2f516e){return function(_0xa6ce4e){if(!_0xa6ce4e){_0x31c003[_0xce2b('0x2d')](0x194);}return _0xa6ce4e;};}function handleError(_0xbe1c94,_0x553a04){_0x553a04=_0x553a04||0x1f4;return function(_0x12f1e1){logger[_0xce2b('0x29')](_0x12f1e1[_0xce2b('0x3d')]);if(_0x12f1e1[_0xce2b('0x3e')]){delete _0x12f1e1[_0xce2b('0x3e')];}_0xbe1c94[_0xce2b('0x2e')](_0x553a04)['send'](_0x12f1e1);};}exports[_0xce2b('0x3f')]=function(_0xe6d501,_0x38d764){var _0x30cffb={},_0x280cca={},_0x30aaf5={'count':0x0,'rows':[]};var _0x5a3593=_['map'](db[_0xce2b('0x40')][_0xce2b('0x41')],function(_0x429de0){return{'name':_0x429de0[_0xce2b('0x42')],'type':_0x429de0[_0xce2b('0x43')][_0xce2b('0x44')]};});_0x280cca[_0xce2b('0x45')]=_[_0xce2b('0x46')](_0x5a3593,_0xce2b('0x3e'));_0x280cca[_0xce2b('0x47')]=_[_0xce2b('0x48')](_0xe6d501[_0xce2b('0x47')]);_0x280cca[_0xce2b('0x49')]=_[_0xce2b('0x4a')](_0x280cca[_0xce2b('0x45')],_0x280cca['query']);_0x30cffb[_0xce2b('0x4b')]=_[_0xce2b('0x4a')](_0x280cca['model'],qs[_0xce2b('0x4c')](_0xe6d501['query'][_0xce2b('0x4c')]));_0x30cffb[_0xce2b('0x4b')]=_0x30cffb[_0xce2b('0x4b')]['length']?_0x30cffb[_0xce2b('0x4b')]:_0x280cca[_0xce2b('0x45')];if(!_0xe6d501['query']['hasOwnProperty'](_0xce2b('0x4d'))){_0x30cffb[_0xce2b('0x33')]=qs[_0xce2b('0x33')](_0xe6d501[_0xce2b('0x47')][_0xce2b('0x33')]);_0x30cffb['offset']=qs[_0xce2b('0x32')](_0xe6d501[_0xce2b('0x47')][_0xce2b('0x32')]);}_0x30cffb[_0xce2b('0x4e')]=qs[_0xce2b('0x4f')](_0xe6d501['query'][_0xce2b('0x4f')]);_0x30cffb[_0xce2b('0x50')]=qs[_0xce2b('0x49')](_[_0xce2b('0x51')](_0xe6d501[_0xce2b('0x47')],_0x280cca[_0xce2b('0x49')]));if(_0xe6d501[_0xce2b('0x47')]['filter']){_0x30cffb['where']=_['merge'](_0x30cffb[_0xce2b('0x50')],{'$or':_[_0xce2b('0x46')](_0x5a3593,function(_0x841c2e){if(_0x841c2e['type']!=='VIRTUAL'){var _0x4efd57={};_0x4efd57[_0x841c2e[_0xce2b('0x3e')]]={'$like':'%'+_0xe6d501[_0xce2b('0x47')][_0xce2b('0x52')]+'%'};return _0x4efd57;}})});}_0x30cffb=_['merge']({},_0x30cffb,_0xe6d501[_0xce2b('0x53')]);var _0x83d2a3={'where':_0x30cffb[_0xce2b('0x50')]};return db['ChatQueue'][_0xce2b('0x31')](_0x83d2a3)['then'](function(_0x3b5912){_0x30aaf5[_0xce2b('0x31')]=_0x3b5912;if(_0xe6d501[_0xce2b('0x47')]['includeAll']){_0x30cffb[_0xce2b('0x54')]=[{'all':!![]}];}return db[_0xce2b('0x40')][_0xce2b('0x55')](_0x30cffb);})[_0xce2b('0x23')](function(_0x592b65){_0x30aaf5[_0xce2b('0x56')]=_0x592b65;return _0x30aaf5;})[_0xce2b('0x23')](respondWithFilteredResult(_0x38d764,_0x30cffb))[_0xce2b('0x57')](handleError(_0x38d764,null));};exports[_0xce2b('0x58')]=function(_0x14ecae,_0x4ae40a){var _0x20d4ae={'raw':!![],'where':{'id':_0x14ecae[_0xce2b('0x59')]['id']}},_0x2aeea5={};_0x2aeea5[_0xce2b('0x45')]=_[_0xce2b('0x48')](db['ChatQueue'][_0xce2b('0x41')]);_0x2aeea5['query']=_[_0xce2b('0x48')](_0x14ecae[_0xce2b('0x47')]);_0x2aeea5['filters']=_['intersection'](_0x2aeea5[_0xce2b('0x45')],_0x2aeea5[_0xce2b('0x47')]);_0x20d4ae[_0xce2b('0x4b')]=_['intersection'](_0x2aeea5[_0xce2b('0x45')],qs[_0xce2b('0x4c')](_0x14ecae['query'][_0xce2b('0x4c')]));_0x20d4ae[_0xce2b('0x4b')]=_0x20d4ae[_0xce2b('0x4b')][_0xce2b('0x5a')]?_0x20d4ae[_0xce2b('0x4b')]:_0x2aeea5[_0xce2b('0x45')];if(_0x14ecae['query'][_0xce2b('0x5b')]){_0x20d4ae['include']=[{'all':!![]}];}_0x20d4ae=_[_0xce2b('0x5c')]({},_0x20d4ae,_0x14ecae[_0xce2b('0x53')]);return db[_0xce2b('0x40')][_0xce2b('0x5d')](_0x20d4ae)['then'](handleEntityNotFound(_0x4ae40a,null))[_0xce2b('0x23')](respondWithResult(_0x4ae40a,null))[_0xce2b('0x57')](handleError(_0x4ae40a,null));};exports[_0xce2b('0x5e')]=function(_0xc3c65d,_0x5391e6){return db[_0xce2b('0x40')][_0xce2b('0x5e')](_0xc3c65d[_0xce2b('0x5f')],{})[_0xce2b('0x23')](function(_0x2a4068){var _0x2d9474=_0xc3c65d[_0xce2b('0x60')]['get']({'plain':!![]});if(!_0x2d9474)throw new Error(_0xce2b('0x61'));if(_0x2d9474['role']===_0xce2b('0x60')){var _0x20ccaf=_0x2a4068[_0xce2b('0x3a')]({'plain':!![]});var _0x1546ff=_0xce2b('0x3b');return db[_0xce2b('0x62')][_0xce2b('0x5d')]({'where':{'name':_0x1546ff,'userProfileId':_0x2d9474[_0xce2b('0x63')]},'raw':!![]})['then'](function(_0x3071fe){if(_0x3071fe&&_0x3071fe[_0xce2b('0x64')]===0x0){return db[_0xce2b('0x3c')][_0xce2b('0x5e')]({'name':_0x20ccaf[_0xce2b('0x3e')],'resourceId':_0x20ccaf['id'],'type':_0x3071fe['name'],'sectionId':_0x3071fe['id']},{})[_0xce2b('0x23')](function(){return _0x2a4068;});}else{return _0x2a4068;}})[_0xce2b('0x57')](function(_0x5db856){logger[_0xce2b('0x29')](_0xce2b('0x65'),_0x5db856);throw _0x5db856;});}return _0x2a4068;})[_0xce2b('0x23')](respondWithResult(_0x5391e6,0xc9))[_0xce2b('0x57')](handleError(_0x5391e6,null));};exports[_0xce2b('0x38')]=function(_0x893f84,_0x43213e){if(_0x893f84[_0xce2b('0x5f')]['id']){delete _0x893f84[_0xce2b('0x5f')]['id'];}return db[_0xce2b('0x40')][_0xce2b('0x5d')]({'where':{'id':_0x893f84[_0xce2b('0x59')]['id']}})[_0xce2b('0x23')](handleEntityNotFound(_0x43213e,null))[_0xce2b('0x23')](saveUpdates(_0x893f84['body'],null))[_0xce2b('0x23')](respondWithResult(_0x43213e,null))[_0xce2b('0x57')](handleError(_0x43213e,null));};exports[_0xce2b('0x39')]=function(_0x55b364,_0x2ffb3b){return db[_0xce2b('0x40')]['find']({'where':{'id':_0x55b364[_0xce2b('0x59')]['id']}})[_0xce2b('0x23')](handleEntityNotFound(_0x2ffb3b,null))['then'](removeEntity(_0x2ffb3b,null))[_0xce2b('0x57')](handleError(_0x2ffb3b,null));};exports[_0xce2b('0x66')]=function(_0xce0b23,_0x6df631){return db[_0xce2b('0x40')][_0xce2b('0x66')]()[_0xce2b('0x23')](respondWithResult(_0x6df631,null))['catch'](handleError(_0x6df631,null));};exports[_0xce2b('0x67')]=function(_0x3b710e,_0x53e6b9,_0x288a33){var _0x410c13={'raw':!![],'where':{}},_0x448521={},_0x235b54;return db['ChatQueue'][_0xce2b('0x68')]({'where':{'id':_0x3b710e[_0xce2b('0x59')]['id']}})['then'](handleEntityNotFound(_0x53e6b9,null))['then'](function(_0x4d71e3){if(_0x4d71e3){_0x235b54=_0x4d71e3['get']({'plain':!![]});_0x448521[_0xce2b('0x45')]=_[_0xce2b('0x48')](db['UserChatQueue']['rawAttributes']);_0x448521[_0xce2b('0x47')]=_[_0xce2b('0x48')](_0x3b710e[_0xce2b('0x47')]);_0x448521['filters']=_[_0xce2b('0x4a')](_0x448521[_0xce2b('0x45')],_0x448521['query']);_0x410c13[_0xce2b('0x4b')]=_[_0xce2b('0x4a')](_0x448521[_0xce2b('0x45')],qs[_0xce2b('0x4c')](_0x3b710e['query'][_0xce2b('0x4c')]));_0x410c13[_0xce2b('0x4b')]=_0x410c13['attributes'][_0xce2b('0x5a')]?_0x410c13['attributes']:_0x448521['model'];if(!_0x3b710e[_0xce2b('0x47')][_0xce2b('0x69')](_0xce2b('0x4d'))){_0x410c13[_0xce2b('0x33')]=qs['limit'](_0x3b710e['query'][_0xce2b('0x33')]);_0x410c13[_0xce2b('0x32')]=qs[_0xce2b('0x32')](_0x3b710e[_0xce2b('0x47')][_0xce2b('0x32')]);}_0x410c13[_0xce2b('0x4e')]=qs['sort'](_0x3b710e[_0xce2b('0x47')][_0xce2b('0x4f')]);_0x410c13[_0xce2b('0x50')]=qs[_0xce2b('0x49')](_['pick'](_0x3b710e['query'],_0x448521[_0xce2b('0x49')]));_0x410c13['where'][_0xce2b('0x6a')]=_0x4d71e3['id'];if(_0x3b710e[_0xce2b('0x47')][_0xce2b('0x52')]){_0x410c13['where']=_['merge'](_0x410c13[_0xce2b('0x50')],{'$or':_[_0xce2b('0x46')](_0x410c13[_0xce2b('0x4b')],function(_0x31e5c7){var _0x408009={};_0x408009[_0x31e5c7]={'$like':'%'+_0x3b710e['query'][_0xce2b('0x52')]+'%'};return _0x408009;})});}_0x410c13=_[_0xce2b('0x5c')]({},_0x410c13,_0x3b710e[_0xce2b('0x53')]);return db[_0xce2b('0x6b')][_0xce2b('0x55')](_0x410c13);}})[_0xce2b('0x23')](function(_0x56547e){if(_0x56547e){return db[_0xce2b('0x6c')]['findAndCountAll']({'where':{'id':_['map'](_0x56547e,_0xce2b('0x6d')),'role':_0xce2b('0x6e')},'attributes':['id',_0xce2b('0x3e'),'chatPause',_0xce2b('0x6f'),'createdAt']});}})[_0xce2b('0x23')](function(_0x511ea4){if(_0x511ea4){return{'count':_0x511ea4['count'],'rows':_['map'](_0x511ea4[_0xce2b('0x56')],function(_0x36986d){return{'membername':_0x36986d['name'],'UserId':_0x36986d['id'],'queue_name':_0x235b54['name'],'ChatQueueId':_0x235b54['id'],'interface':util['format']('%s/%s',_0xce2b('0x70'),_0x36986d[_0xce2b('0x3e')]),'penalty':0x0,'paused':_0x36986d[_0xce2b('0x71')],'createdAt':_0x36986d['createdAt'],'updatedAt':_0x36986d[_0xce2b('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x53e6b9,_0x410c13))[_0xce2b('0x57')](handleError(_0x53e6b9,null));};exports[_0xce2b('0x72')]=function(_0x433d31,_0x4d902f,_0x3b1ad){var _0x324a92={};var _0x2e862f={};var _0x15d07f;var _0x2a4217;return db[_0xce2b('0x40')][_0xce2b('0x68')]({'where':{'id':_0x433d31[_0xce2b('0x59')]['id']}})[_0xce2b('0x23')](handleEntityNotFound(_0x4d902f,null))[_0xce2b('0x23')](function(_0x217266){if(_0x217266){_0x15d07f=_0x217266;_0x2e862f[_0xce2b('0x45')]=_[_0xce2b('0x48')](db[_0xce2b('0x73')]['rawAttributes']);_0x2e862f['query']=_[_0xce2b('0x48')](_0x433d31[_0xce2b('0x47')]);_0x2e862f['filters']=_[_0xce2b('0x4a')](_0x2e862f['model'],_0x2e862f[_0xce2b('0x47')]);_0x324a92[_0xce2b('0x4b')]=_['intersection'](_0x2e862f[_0xce2b('0x45')],qs['fields'](_0x433d31[_0xce2b('0x47')][_0xce2b('0x4c')]));_0x324a92[_0xce2b('0x4b')]=_0x324a92['attributes'][_0xce2b('0x5a')]?_0x324a92[_0xce2b('0x4b')]:_0x2e862f[_0xce2b('0x45')];_0x324a92['order']=qs[_0xce2b('0x4f')](_0x433d31[_0xce2b('0x47')][_0xce2b('0x4f')]);_0x324a92[_0xce2b('0x50')]=qs[_0xce2b('0x49')](_[_0xce2b('0x51')](_0x433d31[_0xce2b('0x47')],_0x2e862f[_0xce2b('0x49')]));if(_0x433d31['query'][_0xce2b('0x52')]){_0x324a92[_0xce2b('0x50')]=_[_0xce2b('0x5c')](_0x324a92[_0xce2b('0x50')],{'$or':_[_0xce2b('0x46')](_0x324a92[_0xce2b('0x4b')],function(_0x538176){var _0xc36ed8={};_0xc36ed8[_0x538176]={'$like':'%'+_0x433d31[_0xce2b('0x47')][_0xce2b('0x52')]+'%'};return _0xc36ed8;})});}_0x324a92=_['merge']({},_0x324a92,_0x433d31[_0xce2b('0x53')]);return _0x15d07f[_0xce2b('0x72')](_0x324a92);}})['then'](function(_0x42bfd0){if(_0x42bfd0){_0x2a4217=_0x42bfd0['length'];if(!_0x433d31[_0xce2b('0x47')][_0xce2b('0x69')](_0xce2b('0x4d'))){_0x324a92[_0xce2b('0x33')]=qs[_0xce2b('0x33')](_0x433d31[_0xce2b('0x47')][_0xce2b('0x33')]);_0x324a92[_0xce2b('0x32')]=qs[_0xce2b('0x32')](_0x433d31[_0xce2b('0x47')]['offset']);}return _0x15d07f[_0xce2b('0x72')](_0x324a92);}})[_0xce2b('0x23')](function(_0x1371b5){if(_0x1371b5){return _0x1371b5?{'count':_0x2a4217,'rows':_0x1371b5}:null;}})[_0xce2b('0x23')](respondWithResult(_0x4d902f,null))['catch'](handleError(_0x4d902f,null));};exports[_0xce2b('0x74')]=function(_0x64aba0,_0x33673f,_0x534234){var _0x19eb7f=_0x64aba0[_0xce2b('0x5f')]['ids'];return db[_0xce2b('0x73')][_0xce2b('0x55')]({'where':{'id':_0x19eb7f},'attributes':['id'],'include':[{'model':db[_0xce2b('0x6c')],'as':'Agents','attributes':['id',_0xce2b('0x3e'),'online',_0xce2b('0x75'),_0xce2b('0x76')],'raw':!![]}]})[_0xce2b('0x23')](function(_0x2682f3){if(_0x2682f3){var _0x185011=_[_0xce2b('0x77')](_0x2682f3,function(_0x217454){var _0x15c9b0=_0x217454[_0xce2b('0x3a')]({'plain':!![]});return _0x15c9b0[_0xce2b('0x78')];});return db['ChatQueue']['find']({'where':{'id':_0x64aba0['params']['id']}})['then'](function(_0x2148c8){return db[_0xce2b('0x79')][_0xce2b('0x7a')](function(_0x5ab72b){return _0x2148c8[_0xce2b('0x74')](_0x19eb7f,{'transaction':_0x5ab72b})[_0xce2b('0x23')](function(){return BPromise[_0xce2b('0x7b')](_0x185011,function(_0x1f72f4){return db[_0xce2b('0x6b')][_0xce2b('0x7c')]({'where':{'UserId':_0x1f72f4['id'],'ChatQueueId':_0x64aba0[_0xce2b('0x59')]['id']},'transaction':_0x5ab72b});});})[_0xce2b('0x23')](function(){_0x185011[_0xce2b('0x7d')](function(_0x5d82fb){socket[_0xce2b('0x7e')](_0xce2b('0x7f'),{'UserId':_0x5d82fb['id'],'ChatQueueId':_0x2148c8['id']});});});});});}})[_0xce2b('0x23')](respondWithStatusCode(_0x33673f,null))[_0xce2b('0x57')](handleError(_0x33673f,null));};exports[_0xce2b('0x80')]=function(_0x33578f,_0x2bc34d,_0x41a0f6){return db[_0xce2b('0x73')][_0xce2b('0x55')]({'where':{'id':_0x33578f[_0xce2b('0x47')][_0xce2b('0x81')]},'attributes':['id'],'include':[{'model':db[_0xce2b('0x6c')],'as':_0xce2b('0x78'),'attributes':['id'],'raw':!![]}]})[_0xce2b('0x23')](handleEntityNotFound(_0x2bc34d,null))['then'](function(_0x6f09c9){var _0x56d87b=_['map'](_0x6f09c9,'id');var _0x19648c=[];var _0x1dfafd=[];var _0x2f77fa=squel[_0xce2b('0x82')]();_0x2f77fa[_0xce2b('0x83')]('tq.TeamId')[_0xce2b('0x84')]('team_has_chat_queues','tq')[_0xce2b('0x85')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xce2b('0x86'),_0x33578f[_0xce2b('0x59')]['id']);for(var _0x4d0a1d=0x0;_0x4d0a1d<_0x6f09c9[_0xce2b('0x5a')];_0x4d0a1d+=0x1){let _0x496d7d=_0x6f09c9[_0x4d0a1d];for(var _0xcc9a80=0x0;_0xcc9a80<_0x496d7d['Agents'][_0xce2b('0x5a')];_0xcc9a80+=0x1){let _0x3904cb=_0x496d7d['Agents'][_0xcc9a80];var _0x37cc51=_0x2f77fa[_0xce2b('0x87')]();_0x37cc51[_0xce2b('0x50')](_0xce2b('0x88'),_0x3904cb['id']);_0x1dfafd[_0xce2b('0x89')](db[_0xce2b('0x79')]['query'](_0x37cc51['toString'](),{'type':db[_0xce2b('0x79')][_0xce2b('0x8a')][_0xce2b('0x8b')]})[_0xce2b('0x23')](function(_0x5c8120){if(_0x5c8120[_0xce2b('0x5a')]===0x1){return _0x3904cb['id'];}else{var _0x56e3f4=_[_0xce2b('0x8c')](_[_0xce2b('0x46')](_0x5c8120,_0xce2b('0x8d')),function(_0x12c94a){return _[_0xce2b('0x8e')](_0x56d87b,_0x12c94a);});if(_0x56e3f4){return _0x3904cb['id'];}}}));}}return BPromise[_0xce2b('0x8f')](_0x1dfafd)['then'](function(_0x5fd11d){_0x19648c=_(_0x19648c)['union'](_0x5fd11d)[_0xce2b('0x90')]()[_0xce2b('0x91')]();return db[_0xce2b('0x40')][_0xce2b('0x5d')]({'where':{'id':_0x33578f[_0xce2b('0x59')]['id']}})[_0xce2b('0x23')](function(_0x5128ba){return db[_0xce2b('0x79')][_0xce2b('0x7a')](function(_0x4aa809){return _0x5128ba[_0xce2b('0x80')](_0x33578f['query']['ids'],{'transaction':_0x4aa809})['then'](function(){if(!_[_0xce2b('0x92')](_0x19648c)){return _0x5128ba[_0xce2b('0x93')](_0x19648c,{'transaction':_0x4aa809});}})[_0xce2b('0x23')](function(){_0x19648c[_0xce2b('0x7d')](function(_0x56aeae){socket[_0xce2b('0x7e')](_0xce2b('0x94'),{'UserId':_0x56aeae,'ChatQueueId':_0x5128ba['id']});});});});});});})['then'](respondWithStatusCode(_0x2bc34d,null))[_0xce2b('0x57')](handleError(_0x2bc34d,null));};exports[_0xce2b('0x95')]=function(_0x5b8d8f,_0xb94b6f,_0x584215){return db['ChatQueue'][_0xce2b('0x5d')]({'where':{'id':_0x5b8d8f[_0xce2b('0x59')]['id']}})['then'](handleEntityNotFound(_0xb94b6f,null))[_0xce2b('0x23')](function(_0x17a969){if(_0x17a969){return _0x17a969['addAgents'](_0x5b8d8f[_0xce2b('0x5f')][_0xce2b('0x81')],_[_0xce2b('0x96')](_0x5b8d8f[_0xce2b('0x5f')],[_0xce2b('0x81'),'id'])||{})[_0xce2b('0x97')](function(_0x19ce2c){for(var _0x382049=0x0;_0x382049<_0x5b8d8f['body']['ids'][_0xce2b('0x5a')];_0x382049+=0x1){socket['emit']('userChatQueue:save',{'UserId':_0x5b8d8f['body'][_0xce2b('0x81')][_0x382049],'ChatQueueId':_0x5b8d8f['params']['id']});}return _0x19ce2c;});}})[_0xce2b('0x23')](respondWithResult(_0xb94b6f,null))[_0xce2b('0x57')](handleError(_0xb94b6f,null));};exports[_0xce2b('0x93')]=function(_0x2c423a,_0x195f37,_0x503202){return db['ChatQueue'][_0xce2b('0x5d')]({'where':{'id':_0x2c423a['params']['id']}})[_0xce2b('0x23')](handleEntityNotFound(_0x195f37,null))['then'](function(_0x26fbb8){if(_0x26fbb8){return _0x26fbb8[_0xce2b('0x93')](_0x2c423a['query'][_0xce2b('0x81')])['then'](function(){if(_[_0xce2b('0x98')](_0x2c423a[_0xce2b('0x47')][_0xce2b('0x81')])){for(var _0x1accd2=0x0;_0x1accd2<_0x2c423a['query'][_0xce2b('0x81')][_0xce2b('0x5a')];_0x1accd2+=0x1){socket[_0xce2b('0x7e')](_0xce2b('0x94'),{'UserId':Number(_0x2c423a['query'][_0xce2b('0x81')][_0x1accd2]),'ChatQueueId':Number(_0x2c423a[_0xce2b('0x59')]['id'])});}}else{socket[_0xce2b('0x7e')](_0xce2b('0x94'),{'UserId':Number(_0x2c423a[_0xce2b('0x47')][_0xce2b('0x81')]),'ChatQueueId':Number(_0x2c423a[_0xce2b('0x59')]['id'])});}});}})[_0xce2b('0x23')](respondWithStatusCode(_0x195f37,null))['catch'](handleError(_0x195f37,null));};exports[_0xce2b('0x99')]=function(_0x4d8e49,_0x3ba9a6,_0x4f3d2a){var _0x58dfc4={};var _0x4ebf3d={};var _0x53d53a;var _0x368a76;return db[_0xce2b('0x40')][_0xce2b('0x68')]({'where':{'id':_0x4d8e49[_0xce2b('0x59')]['id']}})['then'](handleEntityNotFound(_0x3ba9a6,null))[_0xce2b('0x23')](function(_0x28effd){if(_0x28effd){_0x53d53a=_0x28effd;_0x4ebf3d[_0xce2b('0x45')]=_['keys'](db[_0xce2b('0x6c')][_0xce2b('0x41')]);_0x4ebf3d[_0xce2b('0x47')]=_[_0xce2b('0x48')](_0x4d8e49[_0xce2b('0x47')]);_0x4ebf3d[_0xce2b('0x49')]=_[_0xce2b('0x4a')](_0x4ebf3d[_0xce2b('0x45')],_0x4ebf3d[_0xce2b('0x47')]);_0x58dfc4[_0xce2b('0x4b')]=_[_0xce2b('0x4a')](_0x4ebf3d['model'],qs[_0xce2b('0x4c')](_0x4d8e49[_0xce2b('0x47')][_0xce2b('0x4c')]));_0x58dfc4[_0xce2b('0x4b')]=_0x58dfc4[_0xce2b('0x4b')][_0xce2b('0x5a')]?_0x58dfc4[_0xce2b('0x4b')]:_0x4ebf3d['model'];_0x58dfc4['order']=qs[_0xce2b('0x4f')](_0x4d8e49['query']['sort']);_0x58dfc4[_0xce2b('0x50')]=qs[_0xce2b('0x49')](_[_0xce2b('0x51')](_0x4d8e49[_0xce2b('0x47')],_0x4ebf3d['filters']));if(_0x4d8e49[_0xce2b('0x47')]['filter']){_0x58dfc4[_0xce2b('0x50')]=_[_0xce2b('0x5c')](_0x58dfc4[_0xce2b('0x50')],{'$or':_['map'](_0x58dfc4[_0xce2b('0x4b')],function(_0x1d60a1){var _0x11a611={};_0x11a611[_0x1d60a1]={'$like':'%'+_0x4d8e49[_0xce2b('0x47')]['filter']+'%'};return _0x11a611;})});}_0x58dfc4=_[_0xce2b('0x5c')]({},_0x58dfc4,_0x4d8e49[_0xce2b('0x53')]);return _0x53d53a['getAgents'](_0x58dfc4);}})[_0xce2b('0x23')](function(_0x3ad461){if(_0x3ad461){_0x368a76=_0x3ad461[_0xce2b('0x5a')];if(!_0x4d8e49[_0xce2b('0x47')][_0xce2b('0x69')](_0xce2b('0x4d'))){_0x58dfc4[_0xce2b('0x33')]=qs[_0xce2b('0x33')](_0x4d8e49[_0xce2b('0x47')][_0xce2b('0x33')]);_0x58dfc4['offset']=qs[_0xce2b('0x32')](_0x4d8e49[_0xce2b('0x47')][_0xce2b('0x32')]);}return _0x53d53a[_0xce2b('0x99')](_0x58dfc4);}})[_0xce2b('0x23')](function(_0x41254b){if(_0x41254b){return _0x41254b?{'count':_0x368a76,'rows':_0x41254b}:null;}})[_0xce2b('0x23')](respondWithResult(_0x3ba9a6,null))[_0xce2b('0x57')](handleError(_0x3ba9a6,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 7310123..d03b3c4 100644 --- a/server/api/chatQueue/chatQueue.events.js +++ b/server/api/chatQueue/chatQueue.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x395b19,_0x3c652d){var _0x3ad823=function(_0x3562e4){while(--_0x3562e4){_0x395b19['push'](_0x395b19['shift']());}};_0x3ad823(++_0x3c652d);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a209a,_0x575ff9){_0x4a209a=_0x4a209a-0x0;var _0x4b3c20=_0xb10b[_0x4a209a];return _0x4b3c20;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x4f26ce,_0x31a151){var _0x37ff6d=function(_0x257217){while(--_0x257217){_0x4f26ce['push'](_0x4f26ce['shift']());}};_0x37ff6d(++_0x31a151);}(_0x5f2f,0x73));var _0xf5f2=function(_0x55b18a,_0x67b547){_0x55b18a=_0x55b18a-0x0;var _0x2172e5=_0x5f2f[_0x55b18a];return _0x2172e5;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index f8720da..e6dbf25 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 _0x6410=['../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x45c8a9,_0x3b8cc5){var _0x1f51d1=function(_0x1548a5){while(--_0x1548a5){_0x45c8a9['push'](_0x45c8a9['shift']());}};_0x1f51d1(++_0x3b8cc5);}(_0x6410,0xae));var _0x0641=function(_0xabdc6d,_0x9bb811){_0xabdc6d=_0xabdc6d-0x0;var _0x449c6b=_0x6410[_0xabdc6d];return _0x449c6b;};'use strict';var _=require(_0x0641('0x0'));var util=require(_0x0641('0x1'));var logger=require('../../config/logger')(_0x0641('0x2'));var moment=require(_0x0641('0x3'));var BPromise=require(_0x0641('0x4'));var rp=require(_0x0641('0x5'));var fs=require('fs');var path=require(_0x0641('0x6'));var rimraf=require(_0x0641('0x7'));var config=require(_0x0641('0x8'));var attributes=require(_0x0641('0x9'));module[_0x0641('0xa')]=function(_0x146c0b,_0x320176){return _0x146c0b[_0x0641('0xb')](_0x0641('0xc'),attributes,{'tableName':_0x0641('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01ce=['bluebird','request-promise','path','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','lodash','util','../../config/logger','api','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x01ce,0x140));var _0xe01c=function(_0x9cef10,_0x3149d2){_0x9cef10=_0x9cef10-0x0;var _0x467b96=_0x01ce[_0x9cef10];return _0x467b96;};'use strict';var _=require(_0xe01c('0x0'));var util=require(_0xe01c('0x1'));var logger=require(_0xe01c('0x2'))(_0xe01c('0x3'));var moment=require(_0xe01c('0x4'));var BPromise=require(_0xe01c('0x5'));var rp=require(_0xe01c('0x6'));var fs=require('fs');var path=require(_0xe01c('0x7'));var rimraf=require('rimraf');var config=require(_0xe01c('0x8'));var attributes=require(_0xe01c('0x9'));module[_0xe01c('0xa')]=function(_0x57d660,_0x3e1d3d){return _0x57d660[_0xe01c('0xb')](_0xe01c('0xc'),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 7c3461b..3c4bec0 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 _0x1f20=['request\x20sent','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','model','ShowChatQueue','map','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1ff966,_0x41fbff){var _0x40cea2=function(_0xce21c4){while(--_0xce21c4){_0x1ff966['push'](_0x1ff966['shift']());}};_0x40cea2(++_0x41fbff);}(_0x1f20,0x11c));var _0x01f2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1f20[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x01f2('0x0'));var util=require(_0x01f2('0x1'));var moment=require('moment');var BPromise=require(_0x01f2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01f2('0x3'));var db=require(_0x01f2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x01f2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x01f2('0x6'));var client=jayson[_0x01f2('0x7')][_0x01f2('0x8')]({'port':0x232a});config[_0x01f2('0x9')]=_[_0x01f2('0xa')](config[_0x01f2('0x9')],{'host':_0x01f2('0xb'),'port':0x18eb});var socket=require(_0x01f2('0xc'))(new Redis(config[_0x01f2('0x9')]));require(_0x01f2('0xd'))[_0x01f2('0xe')](socket);function respondWithRpcPromise(_0xd7815a,_0x33fd40,_0x497a3a){return new BPromise(function(_0x30abe8,_0x4a56a5){return client['request'](_0xd7815a,_0x497a3a)[_0x01f2('0xf')](function(_0xe57cbe){logger[_0x01f2('0x10')](_0x01f2('0x11'),_0x33fd40,'request\x20sent');logger[_0x01f2('0x12')](_0x01f2('0x13'),_0x33fd40,_0x01f2('0x14'),JSON[_0x01f2('0x15')](_0xe57cbe));if(_0xe57cbe['error']){if(_0xe57cbe[_0x01f2('0x16')][_0x01f2('0x17')]===0x1f4){logger[_0x01f2('0x16')]('ChatQueue,\x20%s,\x20%s',_0x33fd40,_0xe57cbe[_0x01f2('0x16')]['message']);return _0x4a56a5(_0xe57cbe[_0x01f2('0x16')][_0x01f2('0x18')]);}logger[_0x01f2('0x16')]('ChatQueue,\x20%s,\x20%s',_0x33fd40,_0xe57cbe[_0x01f2('0x16')]['message']);return _0x30abe8(_0xe57cbe['error'][_0x01f2('0x18')]);}else{logger[_0x01f2('0x10')](_0x01f2('0x11'),_0x33fd40,_0x01f2('0x14'));_0x30abe8(_0xe57cbe[_0x01f2('0x19')]['message']);}})[_0x01f2('0x1a')](function(_0x42a224){logger[_0x01f2('0x16')](_0x01f2('0x11'),_0x33fd40,_0x42a224);_0x4a56a5(_0x42a224);});});}exports[_0x01f2('0x1b')]=function(_0x136f5e){var _0x5e7a9a=this;return new Promise(function(_0x3cac5a,_0xf56702){return db[_0x01f2('0x1c')][_0x01f2('0x1d')]({'raw':_0x136f5e[_0x01f2('0x1e')]?_0x136f5e[_0x01f2('0x1e')][_0x01f2('0x1f')]===undefined?!![]:![]:!![],'where':_0x136f5e[_0x01f2('0x1e')]?_0x136f5e[_0x01f2('0x1e')][_0x01f2('0x20')]||null:null,'attributes':_0x136f5e[_0x01f2('0x1e')]?_0x136f5e[_0x01f2('0x1e')][_0x01f2('0x21')]||null:null,'limit':_0x136f5e['options']?_0x136f5e['options']['limit']||null:null,'include':_0x136f5e['options']?_0x136f5e['options'][_0x01f2('0x22')]?_['map'](_0x136f5e[_0x01f2('0x1e')][_0x01f2('0x22')],function(_0x4b4958){return{'model':db[_0x4b4958[_0x01f2('0x23')]],'as':_0x4b4958['as'],'attributes':_0x4b4958['attributes'],'include':_0x4b4958[_0x01f2('0x22')]?_['map'](_0x4b4958[_0x01f2('0x22')],function(_0x510bdb){return{'model':db[_0x510bdb['model']],'as':_0x510bdb['as'],'attributes':_0x510bdb[_0x01f2('0x21')],'include':_0x510bdb[_0x01f2('0x22')]?_['map'](_0x510bdb[_0x01f2('0x22')],function(_0x3c2e83){return{'model':db[_0x3c2e83[_0x01f2('0x23')]],'as':_0x3c2e83['as'],'attributes':_0x3c2e83[_0x01f2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x01f2('0xf')](function(_0x13c51a){logger['info'](_0x01f2('0x1b'),_0x136f5e);logger[_0x01f2('0x12')](_0x01f2('0x1b'),_0x136f5e,JSON[_0x01f2('0x15')](_0x13c51a));_0x3cac5a(_0x13c51a);})[_0x01f2('0x1a')](function(_0x57d333){logger['error'](_0x01f2('0x1b'),_0x57d333['message'],_0x136f5e);_0xf56702(_0x5e7a9a['error'](0x1f4,_0x57d333[_0x01f2('0x18')]));});});};exports[_0x01f2('0x24')]=function(_0x258786){var _0xd23135=this;return new Promise(function(_0x2a8d55,_0x5db326){return db[_0x01f2('0x1c')]['find']({'raw':_0x258786[_0x01f2('0x1e')]?_0x258786[_0x01f2('0x1e')][_0x01f2('0x1f')]===undefined?!![]:![]:!![],'where':_0x258786[_0x01f2('0x1e')]?_0x258786[_0x01f2('0x1e')][_0x01f2('0x20')]||null:null,'attributes':_0x258786['options']?_0x258786[_0x01f2('0x1e')]['attributes']||null:null,'include':_0x258786[_0x01f2('0x1e')]?_0x258786[_0x01f2('0x1e')][_0x01f2('0x22')]?_[_0x01f2('0x25')](_0x258786[_0x01f2('0x1e')][_0x01f2('0x22')],function(_0x201dc4){return{'model':db[_0x201dc4[_0x01f2('0x23')]],'as':_0x201dc4['as'],'attributes':_0x201dc4[_0x01f2('0x21')],'include':_0x201dc4[_0x01f2('0x22')]?_[_0x01f2('0x25')](_0x201dc4[_0x01f2('0x22')],function(_0x8f4c6c){return{'model':db[_0x8f4c6c[_0x01f2('0x23')]],'as':_0x8f4c6c['as'],'attributes':_0x8f4c6c['attributes'],'include':_0x8f4c6c[_0x01f2('0x22')]?_[_0x01f2('0x25')](_0x8f4c6c[_0x01f2('0x22')],function(_0x59de04){return{'model':db[_0x59de04[_0x01f2('0x23')]],'as':_0x59de04['as'],'attributes':_0x59de04[_0x01f2('0x21')]};}):[]};}):[]};}):[]:[]})[_0x01f2('0xf')](function(_0x371271){logger[_0x01f2('0x10')](_0x01f2('0x24'),_0x258786);logger[_0x01f2('0x12')](_0x01f2('0x24'),_0x258786,JSON['stringify'](_0x371271));_0x2a8d55(_0x371271);})['catch'](function(_0x228c7d){logger['error'](_0x01f2('0x24'),_0x228c7d['message'],_0x258786);_0x5db326(_0xd23135[_0x01f2('0x16')](0x1f4,_0x228c7d[_0x01f2('0x18')]));});});}; \ No newline at end of file +var _0xb4e2=['register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','limit','map','include','model','attributes','ShowChatQueue','find','where','stringify','lodash','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket'];(function(_0xf5ee60,_0x492a07){var _0x30327a=function(_0x3bc609){while(--_0x3bc609){_0xf5ee60['push'](_0xf5ee60['shift']());}};_0x30327a(++_0x492a07);}(_0xb4e2,0x1aa));var _0x2b4e=function(_0x446ea7,_0x296674){_0x446ea7=_0x446ea7-0x0;var _0x90ccf5=_0xb4e2[_0x446ea7];return _0x90ccf5;};'use strict';var _=require(_0x2b4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2b4e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2b4e('0x2'));var logger=require(_0x2b4e('0x3'))(_0x2b4e('0x4'));var config=require(_0x2b4e('0x5'));var jayson=require(_0x2b4e('0x6'));var client=jayson[_0x2b4e('0x7')][_0x2b4e('0x8')]({'port':0x232a});config['redis']=_[_0x2b4e('0x9')](config[_0x2b4e('0xa')],{'host':_0x2b4e('0xb'),'port':0x18eb});var socket=require(_0x2b4e('0xc'))(new Redis(config[_0x2b4e('0xa')]));require(_0x2b4e('0xd'))[_0x2b4e('0xe')](socket);function respondWithRpcPromise(_0x14bb06,_0xfaa7ec,_0x3015e6){return new BPromise(function(_0x16b4ae,_0xa05d7e){return client[_0x2b4e('0xf')](_0x14bb06,_0x3015e6)[_0x2b4e('0x10')](function(_0x493d19){logger[_0x2b4e('0x11')](_0x2b4e('0x12'),_0xfaa7ec,_0x2b4e('0x13'));logger[_0x2b4e('0x14')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0xfaa7ec,_0x2b4e('0x13'),JSON['stringify'](_0x493d19));if(_0x493d19[_0x2b4e('0x15')]){if(_0x493d19[_0x2b4e('0x15')][_0x2b4e('0x16')]===0x1f4){logger[_0x2b4e('0x15')](_0x2b4e('0x12'),_0xfaa7ec,_0x493d19[_0x2b4e('0x15')]['message']);return _0xa05d7e(_0x493d19[_0x2b4e('0x15')][_0x2b4e('0x17')]);}logger[_0x2b4e('0x15')]('ChatQueue,\x20%s,\x20%s',_0xfaa7ec,_0x493d19[_0x2b4e('0x15')][_0x2b4e('0x17')]);return _0x16b4ae(_0x493d19['error'][_0x2b4e('0x17')]);}else{logger['info'](_0x2b4e('0x12'),_0xfaa7ec,_0x2b4e('0x13'));_0x16b4ae(_0x493d19[_0x2b4e('0x18')][_0x2b4e('0x17')]);}})[_0x2b4e('0x19')](function(_0x36d927){logger[_0x2b4e('0x15')](_0x2b4e('0x12'),_0xfaa7ec,_0x36d927);_0xa05d7e(_0x36d927);});});}exports[_0x2b4e('0x1a')]=function(_0x4c8110){var _0x23ca97=this;return new Promise(function(_0x5c920a,_0x4293ae){return db[_0x2b4e('0x1b')][_0x2b4e('0x1c')]({'raw':_0x4c8110[_0x2b4e('0x1d')]?_0x4c8110['options'][_0x2b4e('0x1e')]===undefined?!![]:![]:!![],'where':_0x4c8110[_0x2b4e('0x1d')]?_0x4c8110[_0x2b4e('0x1d')]['where']||null:null,'attributes':_0x4c8110[_0x2b4e('0x1d')]?_0x4c8110[_0x2b4e('0x1d')]['attributes']||null:null,'limit':_0x4c8110[_0x2b4e('0x1d')]?_0x4c8110['options'][_0x2b4e('0x1f')]||null:null,'include':_0x4c8110[_0x2b4e('0x1d')]?_0x4c8110['options']['include']?_[_0x2b4e('0x20')](_0x4c8110[_0x2b4e('0x1d')][_0x2b4e('0x21')],function(_0x47b641){return{'model':db[_0x47b641[_0x2b4e('0x22')]],'as':_0x47b641['as'],'attributes':_0x47b641[_0x2b4e('0x23')],'include':_0x47b641[_0x2b4e('0x21')]?_[_0x2b4e('0x20')](_0x47b641[_0x2b4e('0x21')],function(_0x435926){return{'model':db[_0x435926[_0x2b4e('0x22')]],'as':_0x435926['as'],'attributes':_0x435926[_0x2b4e('0x23')],'include':_0x435926[_0x2b4e('0x21')]?_['map'](_0x435926[_0x2b4e('0x21')],function(_0x2776fb){return{'model':db[_0x2776fb[_0x2b4e('0x22')]],'as':_0x2776fb['as'],'attributes':_0x2776fb[_0x2b4e('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49d4f5){logger['info'](_0x2b4e('0x1a'),_0x4c8110);logger[_0x2b4e('0x14')](_0x2b4e('0x1a'),_0x4c8110,JSON['stringify'](_0x49d4f5));_0x5c920a(_0x49d4f5);})[_0x2b4e('0x19')](function(_0x5771d7){logger['error'](_0x2b4e('0x1a'),_0x5771d7[_0x2b4e('0x17')],_0x4c8110);_0x4293ae(_0x23ca97[_0x2b4e('0x15')](0x1f4,_0x5771d7[_0x2b4e('0x17')]));});});};exports[_0x2b4e('0x24')]=function(_0x38a067){var _0x473629=this;return new Promise(function(_0x5f2888,_0x159ec6){return db[_0x2b4e('0x1b')][_0x2b4e('0x25')]({'raw':_0x38a067[_0x2b4e('0x1d')]?_0x38a067[_0x2b4e('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x38a067[_0x2b4e('0x1d')]?_0x38a067[_0x2b4e('0x1d')][_0x2b4e('0x26')]||null:null,'attributes':_0x38a067[_0x2b4e('0x1d')]?_0x38a067['options'][_0x2b4e('0x23')]||null:null,'include':_0x38a067[_0x2b4e('0x1d')]?_0x38a067['options']['include']?_[_0x2b4e('0x20')](_0x38a067[_0x2b4e('0x1d')][_0x2b4e('0x21')],function(_0x491c27){return{'model':db[_0x491c27[_0x2b4e('0x22')]],'as':_0x491c27['as'],'attributes':_0x491c27[_0x2b4e('0x23')],'include':_0x491c27[_0x2b4e('0x21')]?_[_0x2b4e('0x20')](_0x491c27['include'],function(_0x584d3a){return{'model':db[_0x584d3a[_0x2b4e('0x22')]],'as':_0x584d3a['as'],'attributes':_0x584d3a[_0x2b4e('0x23')],'include':_0x584d3a[_0x2b4e('0x21')]?_[_0x2b4e('0x20')](_0x584d3a[_0x2b4e('0x21')],function(_0x18ccc5){return{'model':db[_0x18ccc5[_0x2b4e('0x22')]],'as':_0x18ccc5['as'],'attributes':_0x18ccc5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a801d){logger[_0x2b4e('0x11')](_0x2b4e('0x24'),_0x38a067);logger[_0x2b4e('0x14')](_0x2b4e('0x24'),_0x38a067,JSON[_0x2b4e('0x27')](_0x5a801d));_0x5f2888(_0x5a801d);})[_0x2b4e('0x19')](function(_0x5b60ff){logger['error'](_0x2b4e('0x24'),_0x5b60ff['message'],_0x38a067);_0x159ec6(_0x473629[_0x2b4e('0x15')](0x1f4,_0x5b60ff[_0x2b4e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 44b01ef..b251cab 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0xc6cc4b,_0x46eac6){var _0x267861=function(_0x5b13f9){while(--_0x5b13f9){_0xc6cc4b['push'](_0xc6cc4b['shift']());}};_0x267861(++_0x46eac6);}(_0x0b0e,0x187));var _0xe0b0=function(_0xae282f,_0x2d9368){_0xae282f=_0xae282f-0x0;var _0x5f46d4=_0x0b0e[_0xae282f];return _0x5f46d4;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file +var _0x0b0e=['chatQueue:','./chatQueue.events','remove','emit','removeListener','register'];(function(_0x165b75,_0x55d77c){var _0x28c0da=function(_0x2c3ad1){while(--_0x2c3ad1){_0x165b75['push'](_0x165b75['shift']());}};_0x28c0da(++_0x55d77c);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x0b0e[_0x3bab09];return _0x164376;};'use strict';var ChatQueueEvents=require(_0xe0b0('0x0'));var events=['save',_0xe0b0('0x1'),'update'];function createListener(_0x7e5a8a,_0xdf715e){return function(_0x3b5e2b){_0xdf715e[_0xe0b0('0x2')](_0x7e5a8a,_0x3b5e2b);};}function removeListener(_0x28040c,_0x38a058){return function(){ChatQueueEvents[_0xe0b0('0x3')](_0x28040c,_0x38a058);};}exports[_0xe0b0('0x4')]=function(_0x30e20d){for(var _0x28e40f=0x0,_0x219b1c=events['length'];_0x28e40f<_0x219b1c;_0x28e40f++){var _0x50be7f=events[_0x28e40f];var _0x11effc=createListener(_0xe0b0('0x5')+_0x50be7f,_0x30e20d);ChatQueueEvents['on'](_0x50be7f,_0x11effc);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 196fdbb..f5f340e 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 _0x08b3=['multer','connect-timeout','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','/:id','update','delete','removeTeams','removeAgents','exports'];(function(_0x39d625,_0xcbd247){var _0x45bafa=function(_0x40f316){while(--_0x40f316){_0x39d625['push'](_0x39d625['shift']());}};_0x45bafa(++_0xcbd247);}(_0x08b3,0x1e4));var _0x308b=function(_0x3fadcf,_0x53075a){_0x3fadcf=_0x3fadcf-0x0;var _0x32501c=_0x08b3[_0x3fadcf];return _0x32501c;};'use strict';var multer=require(_0x308b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x308b('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x308b('0x2'));var config=require(_0x308b('0x3'));var controller=require('./chatQueue.controller');router[_0x308b('0x4')]('/',auth[_0x308b('0x5')](),controller['index']);router['get'](_0x308b('0x6'),auth[_0x308b('0x5')](),controller[_0x308b('0x7')]);router[_0x308b('0x4')]('/:id',auth[_0x308b('0x5')](),controller['show']);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x308b('0x8')]);router[_0x308b('0x4')]('/:id/teams',auth[_0x308b('0x5')](),controller[_0x308b('0x9')]);router['get'](_0x308b('0xa'),auth[_0x308b('0x5')](),controller[_0x308b('0xb')]);router[_0x308b('0xc')]('/',auth['isAuthenticated'](),controller[_0x308b('0xd')]);router[_0x308b('0xc')](_0x308b('0xe'),auth[_0x308b('0x5')](),controller[_0x308b('0xf')]);router[_0x308b('0xc')](_0x308b('0xa'),auth[_0x308b('0x5')](),controller['addAgents']);router['put'](_0x308b('0x10'),auth[_0x308b('0x5')](),controller[_0x308b('0x11')]);router[_0x308b('0x12')](_0x308b('0x10'),auth['isAuthenticated'](),controller['destroy']);router[_0x308b('0x12')](_0x308b('0xe'),auth[_0x308b('0x5')](),controller[_0x308b('0x13')]);router['delete'](_0x308b('0xa'),auth[_0x308b('0x5')](),controller[_0x308b('0x14')]);module[_0x308b('0x15')]=router; \ No newline at end of file +var _0xef15=['./chatQueue.controller','get','/describe','/:id','isAuthenticated','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','destroy','delete','removeTeams','removeAgents','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb57dfe,_0xc39ee5){var _0x48e659=function(_0x5933d9){while(--_0x5933d9){_0xb57dfe['push'](_0xb57dfe['shift']());}};_0x48e659(++_0xc39ee5);}(_0xef15,0x1c2));var _0x5ef1=function(_0x3c5e8b,_0x17513d){_0x3c5e8b=_0x3c5e8b-0x0;var _0x1784b6=_0xef15[_0x3c5e8b];return _0x1784b6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5ef1('0x0'));var timeout=require(_0x5ef1('0x1'));var express=require(_0x5ef1('0x2'));var router=express['Router']();var auth=require(_0x5ef1('0x3'));var interaction=require(_0x5ef1('0x4'));var config=require(_0x5ef1('0x5'));var controller=require(_0x5ef1('0x6'));router[_0x5ef1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5ef1('0x7')](_0x5ef1('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x5ef1('0x7')](_0x5ef1('0x9'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0xb')]);router[_0x5ef1('0x7')]('/:id/members',auth[_0x5ef1('0xa')](),controller['getMembers']);router[_0x5ef1('0x7')](_0x5ef1('0xc'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0xd')]);router[_0x5ef1('0x7')](_0x5ef1('0xe'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0xf')]);router[_0x5ef1('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5ef1('0x10')](_0x5ef1('0xc'),auth['isAuthenticated'](),controller[_0x5ef1('0x11')]);router['post'](_0x5ef1('0xe'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0x12')]);router[_0x5ef1('0x13')]('/:id',auth[_0x5ef1('0xa')](),controller['update']);router['delete']('/:id',auth[_0x5ef1('0xa')](),controller[_0x5ef1('0x14')]);router[_0x5ef1('0x15')]('/:id/teams',auth[_0x5ef1('0xa')](),controller[_0x5ef1('0x16')]);router[_0x5ef1('0x15')](_0x5ef1('0xe'),auth[_0x5ef1('0xa')](),controller[_0x5ef1('0x17')]);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 78108e0..30abd33 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 _0x8600=['STRING','DATE','moment','sequelize'];(function(_0x4424e6,_0x5ad64a){var _0x311b68=function(_0x4a2575){while(--_0x4a2575){_0x4424e6['push'](_0x4424e6['shift']());}};_0x311b68(++_0x5ad64a);}(_0x8600,0x19e));var _0x0860=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x8600[_0x59d89e];return _0x554e93;};'use strict';var moment=require(_0x0860('0x0'));var Sequelize=require(_0x0860('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x0860('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0860('0x2')]},'joinAt':{'type':Sequelize[_0x0860('0x3')]},'leaveAt':{'type':Sequelize[_0x0860('0x3')]},'acceptAt':{'type':Sequelize[_0x0860('0x3')]},'exitAt':{'type':Sequelize[_0x0860('0x3')]},'reason':{'type':Sequelize[_0x0860('0x2')]}}; \ No newline at end of file +var _0x915f=['moment','sequelize','exports','STRING','DATE'];(function(_0x1fbf8d,_0x43874c){var _0x50c7e4=function(_0x134b53){while(--_0x134b53){_0x1fbf8d['push'](_0x1fbf8d['shift']());}};_0x50c7e4(++_0x43874c);}(_0x915f,0xb4));var _0xf915=function(_0x1bf685,_0x2cb26e){_0x1bf685=_0x1bf685-0x0;var _0x1b1164=_0x915f[_0x1bf685];return _0x1b1164;};'use strict';var moment=require(_0xf915('0x0'));var Sequelize=require(_0xf915('0x1'));module[_0xf915('0x2')]={'uniqueid':{'type':Sequelize[_0xf915('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf915('0x4')]},'leaveAt':{'type':Sequelize[_0xf915('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf915('0x4')]},'reason':{'type':Sequelize[_0xf915('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 786c0eb..2b4e2b8 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 _0x2384=['fieldName','type','key','query','intersection','attributes','model','fields','hasOwnProperty','limit','offset','sort','filters','pick','filter','where','merge','findAll','rows','catch','show','params','keys','length','include','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ChatQueueReport','rawAttributes'];(function(_0x32869c,_0xd01545){var _0x136628=function(_0x198fbe){while(--_0x198fbe){_0x32869c['push'](_0x32869c['shift']());}};_0x136628(++_0xd01545);}(_0x2384,0x1ec));var _0x4238=function(_0xb4f3cc,_0xf0419e){_0xb4f3cc=_0xb4f3cc-0x0;var _0x51bfbd=_0x2384[_0xb4f3cc];return _0x51bfbd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4238('0x0'));var zipdir=require(_0x4238('0x1'));var jsonpatch=require(_0x4238('0x2'));var rp=require(_0x4238('0x3'));var moment=require(_0x4238('0x4'));var BPromise=require(_0x4238('0x5'));var Mustache=require(_0x4238('0x6'));var util=require(_0x4238('0x7'));var path=require('path');var sox=require(_0x4238('0x8'));var csv=require(_0x4238('0x9'));var ejs=require(_0x4238('0xa'));var fs=require('fs');var _=require(_0x4238('0xb'));var squel=require(_0x4238('0xc'));var crypto=require(_0x4238('0xd'));var jsforce=require(_0x4238('0xe'));var deskjs=require(_0x4238('0xf'));var toCsv=require(_0x4238('0x9'));var querystring=require(_0x4238('0x10'));var Papa=require(_0x4238('0x11'));var Redis=require(_0x4238('0x12'));var authService=require(_0x4238('0x13'));var qs=require(_0x4238('0x14'));var as=require(_0x4238('0x15'));var hardwareService=require(_0x4238('0x16'));var logger=require(_0x4238('0x17'))(_0x4238('0x18'));var utils=require(_0x4238('0x19'));var config=require(_0x4238('0x1a'));var db=require(_0x4238('0x1b'))['db'];function respondWithStatusCode(_0x49fe03,_0x526d73){_0x526d73=_0x526d73||0xcc;return function(_0x488198){if(_0x488198){return _0x49fe03[_0x4238('0x1c')](_0x526d73);}return _0x49fe03[_0x4238('0x1d')](_0x526d73)[_0x4238('0x1e')]();};}function respondWithResult(_0x176840,_0x225f05){_0x225f05=_0x225f05||0xc8;return function(_0x3a77da){if(_0x3a77da){return _0x176840[_0x4238('0x1d')](_0x225f05)[_0x4238('0x1f')](_0x3a77da);}};}function respondWithFilteredResult(_0xb9f7eb,_0xaf6fbe){return function(_0x9fb170){if(_0x9fb170){var _0x1a5688=_0x9fb170[_0x4238('0x20')],_0x422906=_0xaf6fbe['offset'],_0xfaaec=_0xaf6fbe['offset']+_0xaf6fbe['limit'],_0x40bdcd;if(_0xfaaec>=_0x1a5688){_0xfaaec=_0x1a5688;_0x40bdcd=0xc8;}else{_0x40bdcd=0xce;}_0xb9f7eb['status'](_0x40bdcd);return _0xb9f7eb[_0x4238('0x21')](_0x4238('0x22'),_0x422906+'-'+_0xfaaec+'/'+_0x1a5688)['json'](_0x9fb170);}return null;};}function patchUpdates(_0x47561f){return function(_0x5e4f90){try{jsonpatch[_0x4238('0x23')](_0x5e4f90,_0x47561f,!![]);}catch(_0x5365c5){return BPromise[_0x4238('0x24')](_0x5365c5);}return _0x5e4f90[_0x4238('0x25')]();};}function saveUpdates(_0x323c17,_0x313593){return function(_0x40eee7){if(_0x40eee7){return _0x40eee7[_0x4238('0x26')](_0x323c17)[_0x4238('0x27')](function(_0x829542){return _0x829542;});}return null;};}function removeEntity(_0x1808f8,_0x132e74){return function(_0x183183){if(_0x183183){return _0x183183[_0x4238('0x28')]()[_0x4238('0x27')](function(){_0x1808f8['status'](0xcc)[_0x4238('0x1e')]();});}};}function handleEntityNotFound(_0x572f00,_0x43015a){return function(_0x381cf3){if(!_0x381cf3){_0x572f00[_0x4238('0x1c')](0x194);}return _0x381cf3;};}function handleError(_0x35ca73,_0x39d272){_0x39d272=_0x39d272||0x1f4;return function(_0x2c07bb){logger[_0x4238('0x29')](_0x2c07bb[_0x4238('0x2a')]);if(_0x2c07bb[_0x4238('0x2b')]){delete _0x2c07bb['name'];}_0x35ca73[_0x4238('0x1d')](_0x39d272)['send'](_0x2c07bb);};}exports['index']=function(_0x278cf5,_0x35e2fb){var _0x29ccde={},_0x4e42a6={},_0x54b88c={'count':0x0,'rows':[]};var _0xc132df=_[_0x4238('0x2c')](db[_0x4238('0x2d')][_0x4238('0x2e')],function(_0xb34b4e){return{'name':_0xb34b4e[_0x4238('0x2f')],'type':_0xb34b4e[_0x4238('0x30')][_0x4238('0x31')]};});_0x4e42a6['model']=_[_0x4238('0x2c')](_0xc132df,_0x4238('0x2b'));_0x4e42a6[_0x4238('0x32')]=_['keys'](_0x278cf5[_0x4238('0x32')]);_0x4e42a6['filters']=_[_0x4238('0x33')](_0x4e42a6['model'],_0x4e42a6[_0x4238('0x32')]);_0x29ccde[_0x4238('0x34')]=_['intersection'](_0x4e42a6[_0x4238('0x35')],qs[_0x4238('0x36')](_0x278cf5['query'][_0x4238('0x36')]));_0x29ccde[_0x4238('0x34')]=_0x29ccde[_0x4238('0x34')]['length']?_0x29ccde[_0x4238('0x34')]:_0x4e42a6[_0x4238('0x35')];if(!_0x278cf5['query'][_0x4238('0x37')]('nolimit')){_0x29ccde[_0x4238('0x38')]=qs[_0x4238('0x38')](_0x278cf5[_0x4238('0x32')][_0x4238('0x38')]);_0x29ccde[_0x4238('0x39')]=qs[_0x4238('0x39')](_0x278cf5[_0x4238('0x32')][_0x4238('0x39')]);}_0x29ccde['order']=qs[_0x4238('0x3a')](_0x278cf5[_0x4238('0x32')][_0x4238('0x3a')]);_0x29ccde['where']=qs[_0x4238('0x3b')](_[_0x4238('0x3c')](_0x278cf5['query'],_0x4e42a6[_0x4238('0x3b')]));if(_0x278cf5['query'][_0x4238('0x3d')]){_0x29ccde[_0x4238('0x3e')]=_[_0x4238('0x3f')](_0x29ccde[_0x4238('0x3e')],{'$or':_[_0x4238('0x2c')](_0xc132df,function(_0x2aa9bd){if(_0x2aa9bd['type']!=='VIRTUAL'){var _0x247d16={};_0x247d16[_0x2aa9bd[_0x4238('0x2b')]]={'$like':'%'+_0x278cf5[_0x4238('0x32')]['filter']+'%'};return _0x247d16;}})});}_0x29ccde=_[_0x4238('0x3f')]({},_0x29ccde,_0x278cf5['options']);var _0x1cf2a7={'where':_0x29ccde[_0x4238('0x3e')]};return db[_0x4238('0x2d')]['count'](_0x1cf2a7)['then'](function(_0x4d2a48){_0x54b88c[_0x4238('0x20')]=_0x4d2a48;if(_0x278cf5[_0x4238('0x32')]['includeAll']){_0x29ccde['include']=[{'all':!![]}];}return db[_0x4238('0x2d')][_0x4238('0x40')](_0x29ccde);})['then'](function(_0x46374b){_0x54b88c[_0x4238('0x41')]=_0x46374b;return _0x54b88c;})['then'](respondWithFilteredResult(_0x35e2fb,_0x29ccde))[_0x4238('0x42')](handleError(_0x35e2fb,null));};exports[_0x4238('0x43')]=function(_0x18dc93,_0x26fed0){var _0x241131={'raw':!![],'where':{'id':_0x18dc93[_0x4238('0x44')]['id']}},_0x49de77={};_0x49de77[_0x4238('0x35')]=_['keys'](db['ChatQueueReport'][_0x4238('0x2e')]);_0x49de77[_0x4238('0x32')]=_[_0x4238('0x45')](_0x18dc93[_0x4238('0x32')]);_0x49de77[_0x4238('0x3b')]=_['intersection'](_0x49de77['model'],_0x49de77[_0x4238('0x32')]);_0x241131[_0x4238('0x34')]=_[_0x4238('0x33')](_0x49de77['model'],qs[_0x4238('0x36')](_0x18dc93[_0x4238('0x32')][_0x4238('0x36')]));_0x241131[_0x4238('0x34')]=_0x241131[_0x4238('0x34')][_0x4238('0x46')]?_0x241131[_0x4238('0x34')]:_0x49de77[_0x4238('0x35')];if(_0x18dc93[_0x4238('0x32')]['includeAll']){_0x241131[_0x4238('0x47')]=[{'all':!![]}];}_0x241131=_[_0x4238('0x3f')]({},_0x241131,_0x18dc93[_0x4238('0x48')]);return db[_0x4238('0x2d')][_0x4238('0x49')](_0x241131)[_0x4238('0x27')](handleEntityNotFound(_0x26fed0,null))[_0x4238('0x27')](respondWithResult(_0x26fed0,null))[_0x4238('0x42')](handleError(_0x26fed0,null));};exports[_0x4238('0x4a')]=function(_0x5d3d0c,_0x19b757){return db[_0x4238('0x2d')][_0x4238('0x4a')](_0x5d3d0c['body'],{})[_0x4238('0x27')](respondWithResult(_0x19b757,0xc9))[_0x4238('0x42')](handleError(_0x19b757,null));};exports['update']=function(_0x3d5b15,_0x58ec9c){if(_0x3d5b15[_0x4238('0x4b')]['id']){delete _0x3d5b15['body']['id'];}return db['ChatQueueReport'][_0x4238('0x49')]({'where':{'id':_0x3d5b15['params']['id']}})['then'](handleEntityNotFound(_0x58ec9c,null))[_0x4238('0x27')](saveUpdates(_0x3d5b15[_0x4238('0x4b')],null))[_0x4238('0x27')](respondWithResult(_0x58ec9c,null))['catch'](handleError(_0x58ec9c,null));};exports[_0x4238('0x28')]=function(_0x121841,_0x448fbb){return db['ChatQueueReport']['find']({'where':{'id':_0x121841[_0x4238('0x44')]['id']}})[_0x4238('0x27')](handleEntityNotFound(_0x448fbb,null))[_0x4238('0x27')](removeEntity(_0x448fbb,null))[_0x4238('0x42')](handleError(_0x448fbb,null));};exports[_0x4238('0x4c')]=function(_0x37a4f8,_0x3b7e88){return db[_0x4238('0x2d')]['describe']()['then'](respondWithResult(_0x3b7e88,null))['catch'](handleError(_0x3b7e88,null));}; \ No newline at end of file +var _0x571b=['query','keys','intersection','model','attributes','length','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','ChatQueueReport','findAll','rows','catch','show','params','rawAttributes','fields','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','fieldName','type','key','map'];(function(_0x45a54f,_0x176e36){var _0x5243d8=function(_0xa9788){while(--_0xa9788){_0x45a54f['push'](_0x45a54f['shift']());}};_0x5243d8(++_0x176e36);}(_0x571b,0xfc));var _0xb571=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x571b[_0x4c12ec];return _0x3ae42c;};'use strict';var pdf=require(_0xb571('0x0'));var emlformat=require(_0xb571('0x1'));var rimraf=require(_0xb571('0x2'));var zipdir=require(_0xb571('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb571('0x4'));var moment=require('moment');var BPromise=require(_0xb571('0x5'));var Mustache=require(_0xb571('0x6'));var util=require('util');var path=require(_0xb571('0x7'));var sox=require(_0xb571('0x8'));var csv=require(_0xb571('0x9'));var ejs=require(_0xb571('0xa'));var fs=require('fs');var _=require(_0xb571('0xb'));var squel=require(_0xb571('0xc'));var crypto=require(_0xb571('0xd'));var jsforce=require(_0xb571('0xe'));var deskjs=require(_0xb571('0xf'));var toCsv=require(_0xb571('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb571('0x10'));var authService=require(_0xb571('0x11'));var qs=require(_0xb571('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb571('0x13'))(_0xb571('0x14'));var utils=require(_0xb571('0x15'));var config=require(_0xb571('0x16'));var db=require(_0xb571('0x17'))['db'];function respondWithStatusCode(_0xd70880,_0x514f6a){_0x514f6a=_0x514f6a||0xcc;return function(_0x3a4bf3){if(_0x3a4bf3){return _0xd70880[_0xb571('0x18')](_0x514f6a);}return _0xd70880[_0xb571('0x19')](_0x514f6a)[_0xb571('0x1a')]();};}function respondWithResult(_0x3e1ddf,_0x13cedd){_0x13cedd=_0x13cedd||0xc8;return function(_0x148663){if(_0x148663){return _0x3e1ddf[_0xb571('0x19')](_0x13cedd)[_0xb571('0x1b')](_0x148663);}};}function respondWithFilteredResult(_0x271895,_0x3ebfff){return function(_0x582586){if(_0x582586){var _0x5296cf=_0x582586['count'],_0x2f40c8=_0x3ebfff[_0xb571('0x1c')],_0x596902=_0x3ebfff['offset']+_0x3ebfff['limit'],_0x23d9bd;if(_0x596902>=_0x5296cf){_0x596902=_0x5296cf;_0x23d9bd=0xc8;}else{_0x23d9bd=0xce;}_0x271895['status'](_0x23d9bd);return _0x271895[_0xb571('0x1d')](_0xb571('0x1e'),_0x2f40c8+'-'+_0x596902+'/'+_0x5296cf)[_0xb571('0x1b')](_0x582586);}return null;};}function patchUpdates(_0x1fc7fe){return function(_0x17748d){try{jsonpatch['apply'](_0x17748d,_0x1fc7fe,!![]);}catch(_0x246a87){return BPromise[_0xb571('0x1f')](_0x246a87);}return _0x17748d[_0xb571('0x20')]();};}function saveUpdates(_0x4639c5,_0x2ef2e8){return function(_0x2bb944){if(_0x2bb944){return _0x2bb944[_0xb571('0x21')](_0x4639c5)[_0xb571('0x22')](function(_0x578ba3){return _0x578ba3;});}return null;};}function removeEntity(_0x1796c4,_0x1ccb34){return function(_0x57a90d){if(_0x57a90d){return _0x57a90d['destroy']()[_0xb571('0x22')](function(){_0x1796c4[_0xb571('0x19')](0xcc)[_0xb571('0x1a')]();});}};}function handleEntityNotFound(_0x591727,_0x2b5e20){return function(_0x4900cc){if(!_0x4900cc){_0x591727[_0xb571('0x18')](0x194);}return _0x4900cc;};}function handleError(_0x359af7,_0x3be6c3){_0x3be6c3=_0x3be6c3||0x1f4;return function(_0x5de4b5){logger[_0xb571('0x23')](_0x5de4b5[_0xb571('0x24')]);if(_0x5de4b5[_0xb571('0x25')]){delete _0x5de4b5[_0xb571('0x25')];}_0x359af7['status'](_0x3be6c3)[_0xb571('0x26')](_0x5de4b5);};}exports[_0xb571('0x27')]=function(_0xf131de,_0x5f2933){var _0x3a5baa={},_0x5b55eb={},_0x58818b={'count':0x0,'rows':[]};var _0x1c7e74=_['map'](db['ChatQueueReport']['rawAttributes'],function(_0xd5fd94){return{'name':_0xd5fd94[_0xb571('0x28')],'type':_0xd5fd94[_0xb571('0x29')][_0xb571('0x2a')]};});_0x5b55eb['model']=_[_0xb571('0x2b')](_0x1c7e74,_0xb571('0x25'));_0x5b55eb[_0xb571('0x2c')]=_[_0xb571('0x2d')](_0xf131de[_0xb571('0x2c')]);_0x5b55eb['filters']=_[_0xb571('0x2e')](_0x5b55eb[_0xb571('0x2f')],_0x5b55eb[_0xb571('0x2c')]);_0x3a5baa[_0xb571('0x30')]=_[_0xb571('0x2e')](_0x5b55eb[_0xb571('0x2f')],qs['fields'](_0xf131de['query']['fields']));_0x3a5baa[_0xb571('0x30')]=_0x3a5baa[_0xb571('0x30')][_0xb571('0x31')]?_0x3a5baa['attributes']:_0x5b55eb[_0xb571('0x2f')];if(!_0xf131de[_0xb571('0x2c')]['hasOwnProperty'](_0xb571('0x32'))){_0x3a5baa[_0xb571('0x33')]=qs[_0xb571('0x33')](_0xf131de[_0xb571('0x2c')][_0xb571('0x33')]);_0x3a5baa['offset']=qs[_0xb571('0x1c')](_0xf131de[_0xb571('0x2c')]['offset']);}_0x3a5baa[_0xb571('0x34')]=qs[_0xb571('0x35')](_0xf131de[_0xb571('0x2c')][_0xb571('0x35')]);_0x3a5baa[_0xb571('0x36')]=qs['filters'](_[_0xb571('0x37')](_0xf131de[_0xb571('0x2c')],_0x5b55eb['filters']));if(_0xf131de['query'][_0xb571('0x38')]){_0x3a5baa[_0xb571('0x36')]=_['merge'](_0x3a5baa[_0xb571('0x36')],{'$or':_[_0xb571('0x2b')](_0x1c7e74,function(_0x140e74){if(_0x140e74[_0xb571('0x29')]!==_0xb571('0x39')){var _0x4a1598={};_0x4a1598[_0x140e74['name']]={'$like':'%'+_0xf131de[_0xb571('0x2c')][_0xb571('0x38')]+'%'};return _0x4a1598;}})});}_0x3a5baa=_[_0xb571('0x3a')]({},_0x3a5baa,_0xf131de[_0xb571('0x3b')]);var _0x24a997={'where':_0x3a5baa[_0xb571('0x36')]};return db['ChatQueueReport'][_0xb571('0x3c')](_0x24a997)['then'](function(_0x191210){_0x58818b[_0xb571('0x3c')]=_0x191210;if(_0xf131de[_0xb571('0x2c')]['includeAll']){_0x3a5baa[_0xb571('0x3d')]=[{'all':!![]}];}return db[_0xb571('0x3e')][_0xb571('0x3f')](_0x3a5baa);})[_0xb571('0x22')](function(_0x139d7c){_0x58818b[_0xb571('0x40')]=_0x139d7c;return _0x58818b;})[_0xb571('0x22')](respondWithFilteredResult(_0x5f2933,_0x3a5baa))[_0xb571('0x41')](handleError(_0x5f2933,null));};exports[_0xb571('0x42')]=function(_0x241d47,_0x2e170f){var _0x5ae370={'raw':!![],'where':{'id':_0x241d47[_0xb571('0x43')]['id']}},_0x16f0c0={};_0x16f0c0['model']=_[_0xb571('0x2d')](db['ChatQueueReport'][_0xb571('0x44')]);_0x16f0c0[_0xb571('0x2c')]=_[_0xb571('0x2d')](_0x241d47[_0xb571('0x2c')]);_0x16f0c0['filters']=_[_0xb571('0x2e')](_0x16f0c0[_0xb571('0x2f')],_0x16f0c0[_0xb571('0x2c')]);_0x5ae370[_0xb571('0x30')]=_['intersection'](_0x16f0c0['model'],qs[_0xb571('0x45')](_0x241d47[_0xb571('0x2c')][_0xb571('0x45')]));_0x5ae370['attributes']=_0x5ae370[_0xb571('0x30')][_0xb571('0x31')]?_0x5ae370[_0xb571('0x30')]:_0x16f0c0[_0xb571('0x2f')];if(_0x241d47[_0xb571('0x2c')]['includeAll']){_0x5ae370[_0xb571('0x3d')]=[{'all':!![]}];}_0x5ae370=_['merge']({},_0x5ae370,_0x241d47[_0xb571('0x3b')]);return db[_0xb571('0x3e')]['find'](_0x5ae370)[_0xb571('0x22')](handleEntityNotFound(_0x2e170f,null))[_0xb571('0x22')](respondWithResult(_0x2e170f,null))[_0xb571('0x41')](handleError(_0x2e170f,null));};exports[_0xb571('0x46')]=function(_0xb92db,_0x100348){return db[_0xb571('0x3e')][_0xb571('0x46')](_0xb92db['body'],{})[_0xb571('0x22')](respondWithResult(_0x100348,0xc9))[_0xb571('0x41')](handleError(_0x100348,null));};exports[_0xb571('0x21')]=function(_0x5ab1db,_0x1b8d95){if(_0x5ab1db[_0xb571('0x47')]['id']){delete _0x5ab1db[_0xb571('0x47')]['id'];}return db[_0xb571('0x3e')]['find']({'where':{'id':_0x5ab1db[_0xb571('0x43')]['id']}})[_0xb571('0x22')](handleEntityNotFound(_0x1b8d95,null))[_0xb571('0x22')](saveUpdates(_0x5ab1db[_0xb571('0x47')],null))[_0xb571('0x22')](respondWithResult(_0x1b8d95,null))[_0xb571('0x41')](handleError(_0x1b8d95,null));};exports['destroy']=function(_0x3fe915,_0x171005){return db[_0xb571('0x3e')][_0xb571('0x48')]({'where':{'id':_0x3fe915[_0xb571('0x43')]['id']}})[_0xb571('0x22')](handleEntityNotFound(_0x171005,null))[_0xb571('0x22')](removeEntity(_0x171005,null))[_0xb571('0x41')](handleError(_0x171005,null));};exports[_0xb571('0x49')]=function(_0x518e0a,_0x309ff5){return db[_0xb571('0x3e')][_0xb571('0x49')]()[_0xb571('0x22')](respondWithResult(_0x309ff5,null))[_0xb571('0x41')](handleError(_0x309ff5,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 193b64d..f3e0f67 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 _0x0ed7=['./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash','util','api','bluebird','request-promise','path','../../config/environment'];(function(_0x2662f7,_0x2eaeb5){var _0x17bb1d=function(_0xb04865){while(--_0xb04865){_0x2662f7['push'](_0x2662f7['shift']());}};_0x17bb1d(++_0x2eaeb5);}(_0x0ed7,0xb9));var _0x70ed=function(_0x5b311b,_0x3e0280){_0x5b311b=_0x5b311b-0x0;var _0x4fa0de=_0x0ed7[_0x5b311b];return _0x4fa0de;};'use strict';var _=require(_0x70ed('0x0'));var util=require(_0x70ed('0x1'));var logger=require('../../config/logger')(_0x70ed('0x2'));var moment=require('moment');var BPromise=require(_0x70ed('0x3'));var rp=require(_0x70ed('0x4'));var fs=require('fs');var path=require(_0x70ed('0x5'));var rimraf=require('rimraf');var config=require(_0x70ed('0x6'));var attributes=require(_0x70ed('0x7'));module[_0x70ed('0x8')]=function(_0x12c2ca,_0x3b0d17){return _0x12c2ca[_0x70ed('0x9')]('ChatQueueReport',attributes,{'tableName':_0x70ed('0xa'),'paranoid':![],'indexes':[{'name':_0x70ed('0xb'),'fields':[_0x70ed('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xce42=['path','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x53c412,_0x42577f){var _0x2790b7=function(_0x31e0ee){while(--_0x31e0ee){_0x53c412['push'](_0x53c412['shift']());}};_0x2790b7(++_0x42577f);}(_0xce42,0xb0));var _0x2ce4=function(_0x5c1cdc,_0x322014){_0x5c1cdc=_0x5c1cdc-0x0;var _0x2e8317=_0xce42[_0x5c1cdc];return _0x2e8317;};'use strict';var _=require(_0x2ce4('0x0'));var util=require('util');var logger=require(_0x2ce4('0x1'))(_0x2ce4('0x2'));var moment=require(_0x2ce4('0x3'));var BPromise=require(_0x2ce4('0x4'));var rp=require(_0x2ce4('0x5'));var fs=require('fs');var path=require(_0x2ce4('0x6'));var rimraf=require('rimraf');var config=require(_0x2ce4('0x7'));var attributes=require(_0x2ce4('0x8'));module[_0x2ce4('0x9')]=function(_0x30557d,_0x370efe){return _0x30557d[_0x2ce4('0xa')](_0x2ce4('0xb'),attributes,{'tableName':_0x2ce4('0xc'),'paranoid':![],'indexes':[{'name':_0x2ce4('0xd'),'fields':[_0x2ce4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 043beb4..0e8c4a7 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 _0x4063=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','update','where','attributes','limit','UpdateChatQueueReport','lodash','util','moment','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4063,0x104));var _0x3406=function(_0x277579,_0x33f977){_0x277579=_0x277579-0x0;var _0x459a79=_0x4063[_0x277579];return _0x459a79;};'use strict';var _=require(_0x3406('0x0'));var util=require(_0x3406('0x1'));var moment=require(_0x3406('0x2'));var BPromise=require('bluebird');var rs=require(_0x3406('0x3'));var fs=require('fs');var Redis=require(_0x3406('0x4'));var db=require(_0x3406('0x5'))['db'];var utils=require(_0x3406('0x6'));var logger=require(_0x3406('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3406('0x8'));var client=jayson[_0x3406('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2adead,_0x35f691,_0x36fb42){return new BPromise(function(_0x2a79ed,_0x5763ba){return client[_0x3406('0xa')](_0x2adead,_0x36fb42)['then'](function(_0x23eb39){logger[_0x3406('0xb')](_0x3406('0xc'),_0x35f691,_0x3406('0xd'));logger[_0x3406('0xe')](_0x3406('0xf'),_0x35f691,_0x3406('0xd'),JSON[_0x3406('0x10')](_0x23eb39));if(_0x23eb39[_0x3406('0x11')]){if(_0x23eb39['error']['code']===0x1f4){logger[_0x3406('0x11')](_0x3406('0xc'),_0x35f691,_0x23eb39[_0x3406('0x11')][_0x3406('0x12')]);return _0x5763ba(_0x23eb39[_0x3406('0x11')][_0x3406('0x12')]);}logger[_0x3406('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x35f691,_0x23eb39[_0x3406('0x11')][_0x3406('0x12')]);return _0x2a79ed(_0x23eb39[_0x3406('0x11')]['message']);}else{logger[_0x3406('0xb')](_0x3406('0xc'),_0x35f691,_0x3406('0xd'));_0x2a79ed(_0x23eb39[_0x3406('0x13')][_0x3406('0x12')]);}})[_0x3406('0x14')](function(_0x4f9f80){logger['error'](_0x3406('0xc'),_0x35f691,_0x4f9f80);_0x5763ba(_0x4f9f80);});});}exports[_0x3406('0x15')]=function(_0x4b1202){var _0x4ddafe=this;return new Promise(function(_0x618188,_0x389fbc){return db[_0x3406('0x16')][_0x3406('0x17')](_0x4b1202[_0x3406('0x18')],{'raw':_0x4b1202[_0x3406('0x19')]?_0x4b1202[_0x3406('0x19')][_0x3406('0x1a')]===undefined?!![]:![]:!![]})[_0x3406('0x1b')](function(_0x4f7e98){logger[_0x3406('0xb')]('CreateChatQueueReport',_0x4b1202);logger['debug'](_0x3406('0x15'),_0x4b1202,JSON[_0x3406('0x10')](_0x4f7e98));_0x618188(_0x4f7e98);})[_0x3406('0x14')](function(_0x49288d){logger[_0x3406('0x11')](_0x3406('0x15'),_0x49288d['message'],_0x4b1202);_0x389fbc(_0x4ddafe[_0x3406('0x11')](0x1f4,_0x49288d[_0x3406('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x587c7e){var _0x5891b0=this;return new Promise(function(_0x1650d6,_0x17c6bf){return db[_0x3406('0x16')][_0x3406('0x1c')](_0x587c7e[_0x3406('0x18')],{'raw':_0x587c7e['options']?_0x587c7e[_0x3406('0x19')][_0x3406('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x587c7e[_0x3406('0x19')]?_0x587c7e[_0x3406('0x19')][_0x3406('0x1d')]||null:null,'attributes':_0x587c7e[_0x3406('0x19')]?_0x587c7e[_0x3406('0x19')][_0x3406('0x1e')]||null:null,'limit':_0x587c7e[_0x3406('0x19')]?_0x587c7e[_0x3406('0x19')][_0x3406('0x1f')]||null:null})[_0x3406('0x1b')](function(_0x2678da){logger[_0x3406('0xb')](_0x3406('0x20'),_0x587c7e);logger['debug'](_0x3406('0x20'),_0x587c7e,JSON[_0x3406('0x10')](_0x2678da));_0x1650d6(_0x2678da);})[_0x3406('0x14')](function(_0x5c5f33){logger[_0x3406('0x11')](_0x3406('0x20'),_0x5c5f33[_0x3406('0x12')],_0x587c7e);_0x17c6bf(_0x5891b0[_0x3406('0x11')](0x1f4,_0x5c5f33[_0x3406('0x12')]));});});}; \ No newline at end of file +var _0xc3c3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','CreateChatQueueReport','create','body','options','raw','then','catch','ChatQueueReport','update','where','limit','UpdateChatQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x1675bf,_0x307a0d){var _0x4138d4=function(_0x1ac3c6){while(--_0x1ac3c6){_0x1675bf['push'](_0x1675bf['shift']());}};_0x4138d4(++_0x307a0d);}(_0xc3c3,0x1e4));var _0x3c3c=function(_0x5ab52d,_0x3ac63e){_0x5ab52d=_0x5ab52d-0x0;var _0x2378c4=_0xc3c3[_0x5ab52d];return _0x2378c4;};'use strict';var _=require(_0x3c3c('0x0'));var util=require(_0x3c3c('0x1'));var moment=require(_0x3c3c('0x2'));var BPromise=require(_0x3c3c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c3c('0x4'));var db=require(_0x3c3c('0x5'))['db'];var utils=require(_0x3c3c('0x6'));var logger=require(_0x3c3c('0x7'))(_0x3c3c('0x8'));var config=require(_0x3c3c('0x9'));var jayson=require(_0x3c3c('0xa'));var client=jayson[_0x3c3c('0xb')][_0x3c3c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x455e34,_0x1fa8bb,_0x567682){return new BPromise(function(_0x5517b0,_0x20d4c5){return client[_0x3c3c('0xd')](_0x455e34,_0x567682)['then'](function(_0x4bc399){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x1fa8bb,_0x3c3c('0xe'));logger[_0x3c3c('0xf')](_0x3c3c('0x10'),_0x1fa8bb,'request\x20sent',JSON[_0x3c3c('0x11')](_0x4bc399));if(_0x4bc399[_0x3c3c('0x12')]){if(_0x4bc399[_0x3c3c('0x12')][_0x3c3c('0x13')]===0x1f4){logger[_0x3c3c('0x12')](_0x3c3c('0x14'),_0x1fa8bb,_0x4bc399[_0x3c3c('0x12')][_0x3c3c('0x15')]);return _0x20d4c5(_0x4bc399[_0x3c3c('0x12')]['message']);}logger['error'](_0x3c3c('0x14'),_0x1fa8bb,_0x4bc399['error']['message']);return _0x5517b0(_0x4bc399['error'][_0x3c3c('0x15')]);}else{logger[_0x3c3c('0x16')](_0x3c3c('0x14'),_0x1fa8bb,'request\x20sent');_0x5517b0(_0x4bc399['result'][_0x3c3c('0x15')]);}})['catch'](function(_0x3034de){logger[_0x3c3c('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x1fa8bb,_0x3034de);_0x20d4c5(_0x3034de);});});}exports[_0x3c3c('0x17')]=function(_0x3ab061){var _0x4912e3=this;return new Promise(function(_0x4d5f2d,_0x4e4602){return db['ChatQueueReport'][_0x3c3c('0x18')](_0x3ab061[_0x3c3c('0x19')],{'raw':_0x3ab061['options']?_0x3ab061[_0x3c3c('0x1a')][_0x3c3c('0x1b')]===undefined?!![]:![]:!![]})[_0x3c3c('0x1c')](function(_0x372c94){logger[_0x3c3c('0x16')]('CreateChatQueueReport',_0x3ab061);logger[_0x3c3c('0xf')](_0x3c3c('0x17'),_0x3ab061,JSON[_0x3c3c('0x11')](_0x372c94));_0x4d5f2d(_0x372c94);})[_0x3c3c('0x1d')](function(_0x5cd1b1){logger[_0x3c3c('0x12')]('CreateChatQueueReport',_0x5cd1b1[_0x3c3c('0x15')],_0x3ab061);_0x4e4602(_0x4912e3[_0x3c3c('0x12')](0x1f4,_0x5cd1b1['message']));});});};exports['UpdateChatQueueReport']=function(_0x47971f){var _0x5d0338=this;return new Promise(function(_0x1e372e,_0x49829c){return db[_0x3c3c('0x1e')][_0x3c3c('0x1f')](_0x47971f[_0x3c3c('0x19')],{'raw':_0x47971f[_0x3c3c('0x1a')]?_0x47971f['options'][_0x3c3c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47971f['options']?_0x47971f[_0x3c3c('0x1a')][_0x3c3c('0x20')]||null:null,'attributes':_0x47971f[_0x3c3c('0x1a')]?_0x47971f[_0x3c3c('0x1a')]['attributes']||null:null,'limit':_0x47971f[_0x3c3c('0x1a')]?_0x47971f['options'][_0x3c3c('0x21')]||null:null})[_0x3c3c('0x1c')](function(_0x3b9ab8){logger[_0x3c3c('0x16')]('UpdateChatQueueReport',_0x47971f);logger[_0x3c3c('0xf')](_0x3c3c('0x22'),_0x47971f,JSON['stringify'](_0x3b9ab8));_0x1e372e(_0x3b9ab8);})[_0x3c3c('0x1d')](function(_0x253aa6){logger['error'](_0x3c3c('0x22'),_0x253aa6['message'],_0x47971f);_0x49829c(_0x5d0338[_0x3c3c('0x12')](0x1f4,_0x253aa6['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 80ebf8d..602d24f 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 _0x8b8c=['delete','/:id','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','get','/describe','describe','show','post','create','put'];(function(_0x822e1,_0x4dcc11){var _0x2da176=function(_0xf7e7ff){while(--_0xf7e7ff){_0x822e1['push'](_0x822e1['shift']());}};_0x2da176(++_0x4dcc11);}(_0x8b8c,0x146));var _0xc8b8=function(_0x30e52e,_0x3307f4){_0x30e52e=_0x30e52e-0x0;var _0xe001de=_0x8b8c[_0x30e52e];return _0xe001de;};'use strict';var multer=require(_0xc8b8('0x0'));var util=require('util');var path=require(_0xc8b8('0x1'));var timeout=require('connect-timeout');var express=require(_0xc8b8('0x2'));var router=express[_0xc8b8('0x3')]();var auth=require(_0xc8b8('0x4'));var interaction=require(_0xc8b8('0x5'));var config=require(_0xc8b8('0x6'));var controller=require(_0xc8b8('0x7'));router['get']('/',auth[_0xc8b8('0x8')](),controller['index']);router[_0xc8b8('0x9')](_0xc8b8('0xa'),auth['isAuthenticated'](),controller[_0xc8b8('0xb')]);router[_0xc8b8('0x9')]('/:id',auth[_0xc8b8('0x8')](),controller[_0xc8b8('0xc')]);router[_0xc8b8('0xd')]('/',auth['isAuthenticated'](),controller[_0xc8b8('0xe')]);router[_0xc8b8('0xf')]('/:id',auth[_0xc8b8('0x8')](),controller['update']);router[_0xc8b8('0x10')](_0xc8b8('0x11'),auth[_0xc8b8('0x8')](),controller['destroy']);module[_0xc8b8('0x12')]=router; \ No newline at end of file +var _0xb088=['exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id'];(function(_0x2b78f6,_0x8650c3){var _0x32adac=function(_0x3675ca){while(--_0x3675ca){_0x2b78f6['push'](_0x2b78f6['shift']());}};_0x32adac(++_0x8650c3);}(_0xb088,0xa1));var _0x8b08=function(_0x1230dd,_0x524d12){_0x1230dd=_0x1230dd-0x0;var _0x26794a=_0xb088[_0x1230dd];return _0x26794a;};'use strict';var multer=require(_0x8b08('0x0'));var util=require(_0x8b08('0x1'));var path=require(_0x8b08('0x2'));var timeout=require(_0x8b08('0x3'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8b08('0x4'));var config=require(_0x8b08('0x5'));var controller=require(_0x8b08('0x6'));router[_0x8b08('0x7')]('/',auth[_0x8b08('0x8')](),controller[_0x8b08('0x9')]);router[_0x8b08('0x7')](_0x8b08('0xa'),auth[_0x8b08('0x8')](),controller[_0x8b08('0xb')]);router[_0x8b08('0x7')]('/:id',auth[_0x8b08('0x8')](),controller[_0x8b08('0xc')]);router[_0x8b08('0xd')]('/',auth[_0x8b08('0x8')](),controller[_0x8b08('0xe')]);router[_0x8b08('0xf')]('/:id',auth[_0x8b08('0x8')](),controller[_0x8b08('0x10')]);router[_0x8b08('0x11')](_0x8b08('0x12'),auth[_0x8b08('0x8')](),controller['destroy']);module[_0x8b08('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ebdc709..5c96d97 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 _0x7da7=['agent','queue','DATE','NOW','moment','sequelize','exports','account'];(function(_0x19bb00,_0x4be509){var _0x26470e=function(_0x1d2557){while(--_0x1d2557){_0x19bb00['push'](_0x19bb00['shift']());}};_0x26470e(++_0x4be509);}(_0x7da7,0xb4));var _0x77da=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0x7da7[_0x17823f];return _0x51fc21;};'use strict';var moment=require(_0x77da('0x0'));var Sequelize=require(_0x77da('0x1'));module[_0x77da('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x77da('0x3'),_0x77da('0x4'),_0x77da('0x5')),'allowNull':![],'defaultValue':_0x77da('0x5')},'transferredAt':{'type':Sequelize[_0x77da('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x77da('0x7')]}}; \ No newline at end of file +var _0x4698=['queue','DATE','NOW','moment','sequelize','STRING','ENUM','account'];(function(_0x1ed15c,_0x55f789){var _0x59770e=function(_0x2d1d75){while(--_0x2d1d75){_0x1ed15c['push'](_0x1ed15c['shift']());}};_0x59770e(++_0x55f789);}(_0x4698,0x1e3));var _0x8469=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x4698[_0x521929];return _0x632436;};'use strict';var moment=require(_0x8469('0x0'));var Sequelize=require(_0x8469('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x8469('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8469('0x3')](_0x8469('0x4'),'agent',_0x8469('0x5')),'allowNull':![],'defaultValue':_0x8469('0x5')},'transferredAt':{'type':Sequelize[_0x8469('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x8469('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 5d2cc8c..dad2890 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 _0x3a68=['pick','filter','options','count','includeAll','include','ChatTransferReport','rows','catch','show','params','merge','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','save','then','destroy','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where'];(function(_0x2c741f,_0x25b70c){var _0x33828e=function(_0x45d63f){while(--_0x45d63f){_0x2c741f['push'](_0x2c741f['shift']());}};_0x33828e(++_0x25b70c);}(_0x3a68,0x118));var _0x83a6=function(_0x3ed7b7,_0x30400d){_0x3ed7b7=_0x3ed7b7-0x0;var _0x47612f=_0x3a68[_0x3ed7b7];return _0x47612f;};'use strict';var pdf=require(_0x83a6('0x0'));var emlformat=require(_0x83a6('0x1'));var rimraf=require(_0x83a6('0x2'));var zipdir=require(_0x83a6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x83a6('0x4'));var moment=require(_0x83a6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x83a6('0x6'));var util=require('util');var path=require(_0x83a6('0x7'));var sox=require(_0x83a6('0x8'));var csv=require(_0x83a6('0x9'));var ejs=require(_0x83a6('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x83a6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x83a6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x83a6('0xd'));var Redis=require(_0x83a6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x83a6('0xf'));var as=require(_0x83a6('0x10'));var hardwareService=require(_0x83a6('0x11'));var logger=require(_0x83a6('0x12'))('api');var utils=require(_0x83a6('0x13'));var config=require('../../config/environment');var db=require(_0x83a6('0x14'))['db'];function respondWithStatusCode(_0x4aa1e3,_0x41cffd){_0x41cffd=_0x41cffd||0xcc;return function(_0x39685b){if(_0x39685b){return _0x4aa1e3[_0x83a6('0x15')](_0x41cffd);}return _0x4aa1e3[_0x83a6('0x16')](_0x41cffd)[_0x83a6('0x17')]();};}function respondWithResult(_0x4deebc,_0xede92){_0xede92=_0xede92||0xc8;return function(_0x1803e6){if(_0x1803e6){return _0x4deebc[_0x83a6('0x16')](_0xede92)[_0x83a6('0x18')](_0x1803e6);}};}function respondWithFilteredResult(_0x8ab099,_0x5e3039){return function(_0x1f6303){if(_0x1f6303){var _0x1c2baf=_0x1f6303['count'],_0x3786e3=_0x5e3039['offset'],_0x42a6ad=_0x5e3039[_0x83a6('0x19')]+_0x5e3039[_0x83a6('0x1a')],_0x466a6d;if(_0x42a6ad>=_0x1c2baf){_0x42a6ad=_0x1c2baf;_0x466a6d=0xc8;}else{_0x466a6d=0xce;}_0x8ab099['status'](_0x466a6d);return _0x8ab099[_0x83a6('0x1b')](_0x83a6('0x1c'),_0x3786e3+'-'+_0x42a6ad+'/'+_0x1c2baf)[_0x83a6('0x18')](_0x1f6303);}return null;};}function patchUpdates(_0x2fc344){return function(_0x11b36c){try{jsonpatch['apply'](_0x11b36c,_0x2fc344,!![]);}catch(_0x594451){return BPromise['reject'](_0x594451);}return _0x11b36c[_0x83a6('0x1d')]();};}function saveUpdates(_0x346e66,_0x76938d){return function(_0x365e7a){if(_0x365e7a){return _0x365e7a['update'](_0x346e66)[_0x83a6('0x1e')](function(_0x42d48f){return _0x42d48f;});}return null;};}function removeEntity(_0x49e735,_0x3d367f){return function(_0x4221fa){if(_0x4221fa){return _0x4221fa[_0x83a6('0x1f')]()[_0x83a6('0x1e')](function(){_0x49e735[_0x83a6('0x16')](0xcc)[_0x83a6('0x17')]();});}};}function handleEntityNotFound(_0x407d2e,_0x4c8d32){return function(_0x36cd23){if(!_0x36cd23){_0x407d2e[_0x83a6('0x15')](0x194);}return _0x36cd23;};}function handleError(_0x3add3f,_0x8e650e){_0x8e650e=_0x8e650e||0x1f4;return function(_0x181c2a){logger['error'](_0x181c2a['stack']);if(_0x181c2a[_0x83a6('0x20')]){delete _0x181c2a[_0x83a6('0x20')];}_0x3add3f[_0x83a6('0x16')](_0x8e650e)[_0x83a6('0x21')](_0x181c2a);};}exports[_0x83a6('0x22')]=function(_0x27ae8c,_0x5e23f7){var _0x24167b={},_0x5d2cc1={},_0x43bf24={'count':0x0,'rows':[]};var _0xb4b642=_[_0x83a6('0x23')](db['ChatTransferReport']['rawAttributes'],function(_0x1bacbf){return{'name':_0x1bacbf[_0x83a6('0x24')],'type':_0x1bacbf[_0x83a6('0x25')][_0x83a6('0x26')]};});_0x5d2cc1[_0x83a6('0x27')]=_[_0x83a6('0x23')](_0xb4b642,_0x83a6('0x20'));_0x5d2cc1[_0x83a6('0x28')]=_[_0x83a6('0x29')](_0x27ae8c['query']);_0x5d2cc1[_0x83a6('0x2a')]=_[_0x83a6('0x2b')](_0x5d2cc1[_0x83a6('0x27')],_0x5d2cc1[_0x83a6('0x28')]);_0x24167b[_0x83a6('0x2c')]=_[_0x83a6('0x2b')](_0x5d2cc1[_0x83a6('0x27')],qs[_0x83a6('0x2d')](_0x27ae8c[_0x83a6('0x28')][_0x83a6('0x2d')]));_0x24167b[_0x83a6('0x2c')]=_0x24167b['attributes'][_0x83a6('0x2e')]?_0x24167b[_0x83a6('0x2c')]:_0x5d2cc1[_0x83a6('0x27')];if(!_0x27ae8c[_0x83a6('0x28')][_0x83a6('0x2f')]('nolimit')){_0x24167b[_0x83a6('0x1a')]=qs[_0x83a6('0x1a')](_0x27ae8c['query'][_0x83a6('0x1a')]);_0x24167b[_0x83a6('0x19')]=qs[_0x83a6('0x19')](_0x27ae8c[_0x83a6('0x28')][_0x83a6('0x19')]);}_0x24167b['order']=qs['sort'](_0x27ae8c[_0x83a6('0x28')][_0x83a6('0x30')]);_0x24167b[_0x83a6('0x31')]=qs[_0x83a6('0x2a')](_[_0x83a6('0x32')](_0x27ae8c['query'],_0x5d2cc1[_0x83a6('0x2a')]));if(_0x27ae8c[_0x83a6('0x28')]['filter']){_0x24167b['where']=_['merge'](_0x24167b[_0x83a6('0x31')],{'$or':_['map'](_0xb4b642,function(_0x133d0d){if(_0x133d0d[_0x83a6('0x25')]!=='VIRTUAL'){var _0xbaf0bb={};_0xbaf0bb[_0x133d0d[_0x83a6('0x20')]]={'$like':'%'+_0x27ae8c[_0x83a6('0x28')][_0x83a6('0x33')]+'%'};return _0xbaf0bb;}})});}_0x24167b=_['merge']({},_0x24167b,_0x27ae8c[_0x83a6('0x34')]);var _0x191a62={'where':_0x24167b[_0x83a6('0x31')]};return db['ChatTransferReport'][_0x83a6('0x35')](_0x191a62)['then'](function(_0x350280){_0x43bf24[_0x83a6('0x35')]=_0x350280;if(_0x27ae8c[_0x83a6('0x28')][_0x83a6('0x36')]){_0x24167b[_0x83a6('0x37')]=[{'all':!![]}];}return db[_0x83a6('0x38')]['findAll'](_0x24167b);})[_0x83a6('0x1e')](function(_0x5d97be){_0x43bf24[_0x83a6('0x39')]=_0x5d97be;return _0x43bf24;})[_0x83a6('0x1e')](respondWithFilteredResult(_0x5e23f7,_0x24167b))[_0x83a6('0x3a')](handleError(_0x5e23f7,null));};exports[_0x83a6('0x3b')]=function(_0x307239,_0x31aedd){var _0x4fc259={'raw':!![],'where':{'id':_0x307239[_0x83a6('0x3c')]['id']}},_0x194acd={};_0x194acd['model']=_[_0x83a6('0x29')](db['ChatTransferReport']['rawAttributes']);_0x194acd[_0x83a6('0x28')]=_[_0x83a6('0x29')](_0x307239[_0x83a6('0x28')]);_0x194acd[_0x83a6('0x2a')]=_[_0x83a6('0x2b')](_0x194acd['model'],_0x194acd[_0x83a6('0x28')]);_0x4fc259['attributes']=_[_0x83a6('0x2b')](_0x194acd['model'],qs[_0x83a6('0x2d')](_0x307239[_0x83a6('0x28')][_0x83a6('0x2d')]));_0x4fc259[_0x83a6('0x2c')]=_0x4fc259[_0x83a6('0x2c')][_0x83a6('0x2e')]?_0x4fc259['attributes']:_0x194acd['model'];if(_0x307239[_0x83a6('0x28')][_0x83a6('0x36')]){_0x4fc259[_0x83a6('0x37')]=[{'all':!![]}];}_0x4fc259=_[_0x83a6('0x3d')]({},_0x4fc259,_0x307239[_0x83a6('0x34')]);return db['ChatTransferReport']['find'](_0x4fc259)[_0x83a6('0x1e')](handleEntityNotFound(_0x31aedd,null))[_0x83a6('0x1e')](respondWithResult(_0x31aedd,null))[_0x83a6('0x3a')](handleError(_0x31aedd,null));};exports[_0x83a6('0x3e')]=function(_0x4038c5,_0xc8adc6){return db[_0x83a6('0x38')][_0x83a6('0x3e')](_0x4038c5['body'],{})[_0x83a6('0x1e')](respondWithResult(_0xc8adc6,0xc9))[_0x83a6('0x3a')](handleError(_0xc8adc6,null));};exports['update']=function(_0x31539d,_0x6c1c1b){if(_0x31539d[_0x83a6('0x3f')]['id']){delete _0x31539d[_0x83a6('0x3f')]['id'];}return db[_0x83a6('0x38')][_0x83a6('0x40')]({'where':{'id':_0x31539d[_0x83a6('0x3c')]['id']}})[_0x83a6('0x1e')](handleEntityNotFound(_0x6c1c1b,null))[_0x83a6('0x1e')](saveUpdates(_0x31539d['body'],null))[_0x83a6('0x1e')](respondWithResult(_0x6c1c1b,null))[_0x83a6('0x3a')](handleError(_0x6c1c1b,null));};exports[_0x83a6('0x1f')]=function(_0x1b453e,_0x3451d1){return db[_0x83a6('0x38')][_0x83a6('0x40')]({'where':{'id':_0x1b453e[_0x83a6('0x3c')]['id']}})[_0x83a6('0x1e')](handleEntityNotFound(_0x3451d1,null))[_0x83a6('0x1e')](removeEntity(_0x3451d1,null))[_0x83a6('0x3a')](handleError(_0x3451d1,null));};exports[_0x83a6('0x41')]=function(_0x20351d,_0x2c4d0a){return db[_0x83a6('0x38')][_0x83a6('0x41')]()[_0x83a6('0x1e')](respondWithResult(_0x2c4d0a,null))[_0x83a6('0x3a')](handleError(_0x2c4d0a,null));}; \ No newline at end of file +var _0x2432=['../../config/utils','../../config/environment','end','status','json','offset','limit','set','reject','save','then','destroy','sendStatus','error','stack','name','send','index','ChatTransferReport','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','options','find','create','body','update','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api'];(function(_0x48ecf0,_0x5b3788){var _0x48f5ef=function(_0x4c4e33){while(--_0x4c4e33){_0x48ecf0['push'](_0x48ecf0['shift']());}};_0x48f5ef(++_0x5b3788);}(_0x2432,0x15b));var _0x2243=function(_0x25b9a8,_0x37cc3c){_0x25b9a8=_0x25b9a8-0x0;var _0x123504=_0x2432[_0x25b9a8];return _0x123504;};'use strict';var pdf=require(_0x2243('0x0'));var emlformat=require(_0x2243('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2243('0x2'));var jsonpatch=require(_0x2243('0x3'));var rp=require(_0x2243('0x4'));var moment=require('moment');var BPromise=require(_0x2243('0x5'));var Mustache=require(_0x2243('0x6'));var util=require(_0x2243('0x7'));var path=require(_0x2243('0x8'));var sox=require(_0x2243('0x9'));var csv=require(_0x2243('0xa'));var ejs=require(_0x2243('0xb'));var fs=require('fs');var _=require(_0x2243('0xc'));var squel=require(_0x2243('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2243('0xe'));var authService=require(_0x2243('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2243('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2243('0x11'));var utils=require(_0x2243('0x12'));var config=require(_0x2243('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bf7eb,_0x56dde1){_0x56dde1=_0x56dde1||0xcc;return function(_0x9ad8f8){if(_0x9ad8f8){return _0x1bf7eb['sendStatus'](_0x56dde1);}return _0x1bf7eb['status'](_0x56dde1)[_0x2243('0x14')]();};}function respondWithResult(_0x47b92c,_0x4e65a1){_0x4e65a1=_0x4e65a1||0xc8;return function(_0xcc7ed7){if(_0xcc7ed7){return _0x47b92c[_0x2243('0x15')](_0x4e65a1)[_0x2243('0x16')](_0xcc7ed7);}};}function respondWithFilteredResult(_0x5330d1,_0x196539){return function(_0x585c10){if(_0x585c10){var _0x1348a0=_0x585c10['count'],_0x39d208=_0x196539[_0x2243('0x17')],_0x4f1580=_0x196539[_0x2243('0x17')]+_0x196539[_0x2243('0x18')],_0x582ea9;if(_0x4f1580>=_0x1348a0){_0x4f1580=_0x1348a0;_0x582ea9=0xc8;}else{_0x582ea9=0xce;}_0x5330d1[_0x2243('0x15')](_0x582ea9);return _0x5330d1[_0x2243('0x19')]('Content-Range',_0x39d208+'-'+_0x4f1580+'/'+_0x1348a0)['json'](_0x585c10);}return null;};}function patchUpdates(_0x925cbf){return function(_0x4b53ea){try{jsonpatch['apply'](_0x4b53ea,_0x925cbf,!![]);}catch(_0x64c4cd){return BPromise[_0x2243('0x1a')](_0x64c4cd);}return _0x4b53ea[_0x2243('0x1b')]();};}function saveUpdates(_0x2995c0,_0x580c3a){return function(_0x3a905a){if(_0x3a905a){return _0x3a905a['update'](_0x2995c0)[_0x2243('0x1c')](function(_0x2e8d30){return _0x2e8d30;});}return null;};}function removeEntity(_0x1aa943,_0x2c91da){return function(_0x534eaf){if(_0x534eaf){return _0x534eaf[_0x2243('0x1d')]()['then'](function(){_0x1aa943[_0x2243('0x15')](0xcc)[_0x2243('0x14')]();});}};}function handleEntityNotFound(_0xc35bc0,_0x4fb92b){return function(_0x512b6b){if(!_0x512b6b){_0xc35bc0[_0x2243('0x1e')](0x194);}return _0x512b6b;};}function handleError(_0x3c3c08,_0x5db9ab){_0x5db9ab=_0x5db9ab||0x1f4;return function(_0x30d6bf){logger[_0x2243('0x1f')](_0x30d6bf[_0x2243('0x20')]);if(_0x30d6bf['name']){delete _0x30d6bf[_0x2243('0x21')];}_0x3c3c08['status'](_0x5db9ab)[_0x2243('0x22')](_0x30d6bf);};}exports[_0x2243('0x23')]=function(_0x14a677,_0x441a4f){var _0x5c58d3={},_0x5950dc={},_0x11cbd9={'count':0x0,'rows':[]};var _0x5562dc=_['map'](db[_0x2243('0x24')]['rawAttributes'],function(_0x4f8b04){return{'name':_0x4f8b04[_0x2243('0x25')],'type':_0x4f8b04[_0x2243('0x26')][_0x2243('0x27')]};});_0x5950dc['model']=_[_0x2243('0x28')](_0x5562dc,_0x2243('0x21'));_0x5950dc[_0x2243('0x29')]=_[_0x2243('0x2a')](_0x14a677[_0x2243('0x29')]);_0x5950dc[_0x2243('0x2b')]=_[_0x2243('0x2c')](_0x5950dc['model'],_0x5950dc[_0x2243('0x29')]);_0x5c58d3[_0x2243('0x2d')]=_[_0x2243('0x2c')](_0x5950dc[_0x2243('0x2e')],qs[_0x2243('0x2f')](_0x14a677['query'][_0x2243('0x2f')]));_0x5c58d3[_0x2243('0x2d')]=_0x5c58d3[_0x2243('0x2d')]['length']?_0x5c58d3[_0x2243('0x2d')]:_0x5950dc[_0x2243('0x2e')];if(!_0x14a677[_0x2243('0x29')][_0x2243('0x30')](_0x2243('0x31'))){_0x5c58d3[_0x2243('0x18')]=qs['limit'](_0x14a677[_0x2243('0x29')][_0x2243('0x18')]);_0x5c58d3[_0x2243('0x17')]=qs[_0x2243('0x17')](_0x14a677[_0x2243('0x29')][_0x2243('0x17')]);}_0x5c58d3[_0x2243('0x32')]=qs[_0x2243('0x33')](_0x14a677[_0x2243('0x29')]['sort']);_0x5c58d3['where']=qs[_0x2243('0x2b')](_[_0x2243('0x34')](_0x14a677[_0x2243('0x29')],_0x5950dc[_0x2243('0x2b')]));if(_0x14a677[_0x2243('0x29')][_0x2243('0x35')]){_0x5c58d3[_0x2243('0x36')]=_[_0x2243('0x37')](_0x5c58d3[_0x2243('0x36')],{'$or':_['map'](_0x5562dc,function(_0x105c55){if(_0x105c55[_0x2243('0x26')]!==_0x2243('0x38')){var _0x90119c={};_0x90119c[_0x105c55[_0x2243('0x21')]]={'$like':'%'+_0x14a677[_0x2243('0x29')]['filter']+'%'};return _0x90119c;}})});}_0x5c58d3=_['merge']({},_0x5c58d3,_0x14a677['options']);var _0x23240e={'where':_0x5c58d3[_0x2243('0x36')]};return db[_0x2243('0x24')][_0x2243('0x39')](_0x23240e)['then'](function(_0x232a13){_0x11cbd9[_0x2243('0x39')]=_0x232a13;if(_0x14a677[_0x2243('0x29')]['includeAll']){_0x5c58d3[_0x2243('0x3a')]=[{'all':!![]}];}return db[_0x2243('0x24')][_0x2243('0x3b')](_0x5c58d3);})[_0x2243('0x1c')](function(_0x6d7040){_0x11cbd9[_0x2243('0x3c')]=_0x6d7040;return _0x11cbd9;})[_0x2243('0x1c')](respondWithFilteredResult(_0x441a4f,_0x5c58d3))[_0x2243('0x3d')](handleError(_0x441a4f,null));};exports[_0x2243('0x3e')]=function(_0x5b2666,_0x4b4654){var _0x303845={'raw':!![],'where':{'id':_0x5b2666[_0x2243('0x3f')]['id']}},_0x3b8f81={};_0x3b8f81[_0x2243('0x2e')]=_[_0x2243('0x2a')](db[_0x2243('0x24')][_0x2243('0x40')]);_0x3b8f81[_0x2243('0x29')]=_[_0x2243('0x2a')](_0x5b2666[_0x2243('0x29')]);_0x3b8f81['filters']=_[_0x2243('0x2c')](_0x3b8f81[_0x2243('0x2e')],_0x3b8f81[_0x2243('0x29')]);_0x303845[_0x2243('0x2d')]=_['intersection'](_0x3b8f81['model'],qs[_0x2243('0x2f')](_0x5b2666[_0x2243('0x29')][_0x2243('0x2f')]));_0x303845[_0x2243('0x2d')]=_0x303845[_0x2243('0x2d')][_0x2243('0x41')]?_0x303845[_0x2243('0x2d')]:_0x3b8f81[_0x2243('0x2e')];if(_0x5b2666[_0x2243('0x29')][_0x2243('0x42')]){_0x303845[_0x2243('0x3a')]=[{'all':!![]}];}_0x303845=_[_0x2243('0x37')]({},_0x303845,_0x5b2666[_0x2243('0x43')]);return db[_0x2243('0x24')][_0x2243('0x44')](_0x303845)[_0x2243('0x1c')](handleEntityNotFound(_0x4b4654,null))[_0x2243('0x1c')](respondWithResult(_0x4b4654,null))[_0x2243('0x3d')](handleError(_0x4b4654,null));};exports[_0x2243('0x45')]=function(_0x266c9e,_0x430b1f){return db[_0x2243('0x24')][_0x2243('0x45')](_0x266c9e[_0x2243('0x46')],{})[_0x2243('0x1c')](respondWithResult(_0x430b1f,0xc9))[_0x2243('0x3d')](handleError(_0x430b1f,null));};exports[_0x2243('0x47')]=function(_0x5f4322,_0x344c9c){if(_0x5f4322[_0x2243('0x46')]['id']){delete _0x5f4322['body']['id'];}return db[_0x2243('0x24')][_0x2243('0x44')]({'where':{'id':_0x5f4322[_0x2243('0x3f')]['id']}})[_0x2243('0x1c')](handleEntityNotFound(_0x344c9c,null))[_0x2243('0x1c')](saveUpdates(_0x5f4322[_0x2243('0x46')],null))[_0x2243('0x1c')](respondWithResult(_0x344c9c,null))[_0x2243('0x3d')](handleError(_0x344c9c,null));};exports[_0x2243('0x1d')]=function(_0x2cae30,_0x497099){return db[_0x2243('0x24')][_0x2243('0x44')]({'where':{'id':_0x2cae30['params']['id']}})['then'](handleEntityNotFound(_0x497099,null))[_0x2243('0x1c')](removeEntity(_0x497099,null))[_0x2243('0x3d')](handleError(_0x497099,null));};exports[_0x2243('0x48')]=function(_0x5ebda6,_0x3f3d4a){return db[_0x2243('0x24')][_0x2243('0x48')]()[_0x2243('0x1c')](respondWithResult(_0x3f3d4a,null))[_0x2243('0x3d')](handleError(_0x3f3d4a,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index e1ab727..0ac5989 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 _0x93c3=['lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x323e6d,_0x353fbc){var _0x4170de=function(_0xd350b9){while(--_0xd350b9){_0x323e6d['push'](_0x323e6d['shift']());}};_0x4170de(++_0x353fbc);}(_0x93c3,0x142));var _0x393c=function(_0x2bf90d,_0x4d8f1b){_0x2bf90d=_0x2bf90d-0x0;var _0x568d9e=_0x93c3[_0x2bf90d];return _0x568d9e;};'use strict';var _=require(_0x393c('0x0'));var util=require(_0x393c('0x1'));var logger=require('../../config/logger')(_0x393c('0x2'));var moment=require(_0x393c('0x3'));var BPromise=require('bluebird');var rp=require(_0x393c('0x4'));var fs=require('fs');var path=require(_0x393c('0x5'));var rimraf=require(_0x393c('0x6'));var config=require(_0x393c('0x7'));var attributes=require(_0x393c('0x8'));module[_0x393c('0x9')]=function(_0xf0fc69,_0xa0270a){return _0xf0fc69[_0x393c('0xa')](_0x393c('0xb'),attributes,{'tableName':_0x393c('0xc'),'paranoid':![],'indexes':[{'name':_0x393c('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7006=['path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','lodash','util','api','moment','bluebird'];(function(_0x4db38f,_0x44ce7c){var _0x49c92f=function(_0x153b58){while(--_0x153b58){_0x4db38f['push'](_0x4db38f['shift']());}};_0x49c92f(++_0x44ce7c);}(_0x7006,0xa3));var _0x6700=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0x7006[_0x18f64a];return _0x44687f;};'use strict';var _=require(_0x6700('0x0'));var util=require(_0x6700('0x1'));var logger=require('../../config/logger')(_0x6700('0x2'));var moment=require(_0x6700('0x3'));var BPromise=require(_0x6700('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6700('0x5'));var rimraf=require('rimraf');var config=require(_0x6700('0x6'));var attributes=require(_0x6700('0x7'));module[_0x6700('0x8')]=function(_0x234f3c,_0x573539){return _0x234f3c[_0x6700('0x9')](_0x6700('0xa'),attributes,{'tableName':_0x6700('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 157fc70..7cd5faa 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 _0xc93e=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x1d66b7,_0x5a4910){var _0x28c8c8=function(_0x5cdbc8){while(--_0x5cdbc8){_0x1d66b7['push'](_0x1d66b7['shift']());}};_0x28c8c8(++_0x5a4910);}(_0xc93e,0xee));var _0xec93=function(_0x1505e5,_0x5cc291){_0x1505e5=_0x1505e5-0x0;var _0x5b1dcd=_0xc93e[_0x1505e5];return _0x5b1dcd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xec93('0x0'));var BPromise=require(_0xec93('0x1'));var rs=require(_0xec93('0x2'));var fs=require('fs');var Redis=require(_0xec93('0x3'));var db=require(_0xec93('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xec93('0x5'))(_0xec93('0x6'));var config=require(_0xec93('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xec93('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31cb9c,_0x43b9dd,_0x2759c1){return new BPromise(function(_0x50312c,_0x224495){return client[_0xec93('0x9')](_0x31cb9c,_0x2759c1)[_0xec93('0xa')](function(_0x519add){logger[_0xec93('0xb')](_0xec93('0xc'),_0x43b9dd,'request\x20sent');logger[_0xec93('0xd')](_0xec93('0xe'),_0x43b9dd,_0xec93('0xf'),JSON[_0xec93('0x10')](_0x519add));if(_0x519add[_0xec93('0x11')]){if(_0x519add[_0xec93('0x11')][_0xec93('0x12')]===0x1f4){logger['error'](_0xec93('0xc'),_0x43b9dd,_0x519add[_0xec93('0x11')]['message']);return _0x224495(_0x519add[_0xec93('0x11')]['message']);}logger[_0xec93('0x11')](_0xec93('0xc'),_0x43b9dd,_0x519add['error'][_0xec93('0x13')]);return _0x50312c(_0x519add[_0xec93('0x11')][_0xec93('0x13')]);}else{logger[_0xec93('0xb')](_0xec93('0xc'),_0x43b9dd,_0xec93('0xf'));_0x50312c(_0x519add[_0xec93('0x14')][_0xec93('0x13')]);}})[_0xec93('0x15')](function(_0x8cc4ff){logger[_0xec93('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x43b9dd,_0x8cc4ff);_0x224495(_0x8cc4ff);});});} \ No newline at end of file +var _0x074f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','randomstring'];(function(_0x51fd25,_0x2fcbb){var _0x4529ae=function(_0x17ed81){while(--_0x17ed81){_0x51fd25['push'](_0x51fd25['shift']());}};_0x4529ae(++_0x2fcbb);}(_0x074f,0x15e));var _0xf074=function(_0x40c009,_0x5982fc){_0x40c009=_0x40c009-0x0;var _0x5ca863=_0x074f[_0x40c009];return _0x5ca863;};'use strict';var _=require(_0xf074('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf074('0x1'));var fs=require('fs');var Redis=require(_0xf074('0x2'));var db=require(_0xf074('0x3'))['db'];var utils=require(_0xf074('0x4'));var logger=require(_0xf074('0x5'))('rpc');var config=require(_0xf074('0x6'));var jayson=require(_0xf074('0x7'));var client=jayson[_0xf074('0x8')][_0xf074('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf1a13c,_0x4234f5,_0x213da3){return new BPromise(function(_0x11fad8,_0x44193b){return client[_0xf074('0xa')](_0xf1a13c,_0x213da3)[_0xf074('0xb')](function(_0x3a7d8c){logger[_0xf074('0xc')](_0xf074('0xd'),_0x4234f5,_0xf074('0xe'));logger[_0xf074('0xf')](_0xf074('0x10'),_0x4234f5,'request\x20sent',JSON[_0xf074('0x11')](_0x3a7d8c));if(_0x3a7d8c[_0xf074('0x12')]){if(_0x3a7d8c['error'][_0xf074('0x13')]===0x1f4){logger[_0xf074('0x12')](_0xf074('0xd'),_0x4234f5,_0x3a7d8c[_0xf074('0x12')][_0xf074('0x14')]);return _0x44193b(_0x3a7d8c[_0xf074('0x12')]['message']);}logger[_0xf074('0x12')](_0xf074('0xd'),_0x4234f5,_0x3a7d8c[_0xf074('0x12')][_0xf074('0x14')]);return _0x11fad8(_0x3a7d8c[_0xf074('0x12')][_0xf074('0x14')]);}else{logger[_0xf074('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x4234f5,_0xf074('0xe'));_0x11fad8(_0x3a7d8c[_0xf074('0x15')][_0xf074('0x14')]);}})['catch'](function(_0x3195fd){logger[_0xf074('0x12')](_0xf074('0xd'),_0x4234f5,_0x3195fd);_0x44193b(_0x3195fd);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index e790afa..7b5dde4 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['multer','path','express','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x4a8309,_0x19fc93){var _0x3940f1=function(_0x615935){while(--_0x615935){_0x4a8309['push'](_0x4a8309['shift']());}};_0x3940f1(++_0x19fc93);}(_0xb7e7,0x121));var _0x7b7e=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xb7e7[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xc')]);router['put'](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xf')]);module[_0x7b7e('0x10')]=router; \ No newline at end of file +var _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(_0x23e544,_0x6bafc2){var _0x276fba=function(_0xf32dd2){while(--_0xf32dd2){_0x23e544['push'](_0x23e544['shift']());}};_0x276fba(++_0x6bafc2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1d3e15,_0x2d4ba5){_0x1d3e15=_0x1d3e15-0x0;var _0x3f6062=_0x5f2f[_0x1d3e15];return _0x3f6062;};'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('./chatTransferReport.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index fa84a9b..29352a6 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 _0x6bbb=['Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','thumb','stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','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','#9f946a','#ffffff','INTEGER','BOOLEAN','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error'];(function(_0x16e4f3,_0x4aade7){var _0xa6bb8f=function(_0x55c78d){while(--_0x55c78d){_0x16e4f3['push'](_0x16e4f3['shift']());}};_0xa6bb8f(++_0x4aade7);}(_0x6bbb,0x82));var _0xb6bb=function(_0x53e3de,_0x13da7b){_0x53e3de=_0x53e3de-0x0;var _0x7b905b=_0x6bbb[_0x53e3de];return _0x7b905b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xb6bb('0x0'));module[_0xb6bb('0x1')]={'name':{'type':Sequelize[_0xb6bb('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xb6bb('0x2')],'allowNull':![],'unique':_0xb6bb('0x3')},'description':{'type':Sequelize[_0xb6bb('0x2')]},'mapKey':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0x4')},'mapKeyOffline':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0x4')},'key':{'type':Sequelize[_0xb6bb('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0x5')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xb6bb('0x2')],'allowNull':![],'defaultValue':_0xb6bb('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xb6bb('0x2')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb6bb('0x2')],'allowNull':![],'defaultValue':_0xb6bb('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb6bb('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xb6bb('0x2')]},'animation':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xb6bb('0xa')),'defaultValue':_0xb6bb('0xb')},'header_online':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0xc')},'start_chat_button':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0xd')},'offline_chat_button':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0xb6bb('0xf')},'download_transcript':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb6bb('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xb6bb('0x10')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xb6bb('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb6bb('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xb6bb('0x14')},'placeholderMessage':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0x15')},'closingMessage':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xb6bb('0xe')},'skipMessageButton':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0x17')},'conditionAgreement':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0x18')},'ratingType':{'type':Sequelize[_0xb6bb('0x19')]('star',_0xb6bb('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xb6bb('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xb6bb('0x1b')]({'items':[{'type':_0xb6bb('0x1c'),'variable':null,'config':{'placeholder':_0xb6bb('0x1d'),'type':_0xb6bb('0x1e'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0xb6bb('0x1c'),'props':{'title':_0xb6bb('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb6bb('0x4'),'type':_0xb6bb('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xb6bb('0x1f'))?JSON[_0xb6bb('0x20')](this[_0xb6bb('0x21')](_0xb6bb('0x1f'))):{};},'set':function(_0x5ae8b1){return this[_0xb6bb('0x22')](_0xb6bb('0x1f'),JSON[_0xb6bb('0x1b')](_0x5ae8b1));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xb6bb('0x1b')]({'items':[{'type':_0xb6bb('0x1c'),'props':{'title':_0xb6bb('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xb6bb('0x4'),'type':_0xb6bb('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0xb6bb('0x23')},'props':{'title':_0xb6bb('0x23'),'helpText':_0xb6bb('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0xb6bb('0x21')](_0xb6bb('0x25'))?JSON[_0xb6bb('0x20')](this[_0xb6bb('0x21')]('offlineForm')):{};},'set':function(_0x47d610){return this['setDataValue'](_0xb6bb('0x25'),JSON[_0xb6bb('0x1b')](_0x47d610));}},'token':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb6bb('0x2')]},'forwardOffline':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb6bb('0x26')},'offlineMessageSubject':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0x27')},'offlineMessageBody':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xb6bb('0x29')},'skipUnmanaged':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0x17')},'sendUnmanaged':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb6bb('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xb6bb('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xb6bb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xb6bb('0x2')],'defaultValue':_0xb6bb('0x2b')},'defaultTitle':{'type':Sequelize[_0xb6bb('0x2')]},'customerAvatar':{'type':Sequelize[_0xb6bb('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb6bb('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xb6bb('0x2')],'allowNull':![],'defaultValue':_0xb6bb('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb6bb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb6bb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xb6bb('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb6bb('0x8')],'comment':_0xb6bb('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0xb6bb('0x9')],'defaultValue':![],'comment':_0xb6bb('0x2f'),'set':function(_0x38970b){if(!_0x38970b)this[_0xb6bb('0x22')](_0xb6bb('0x30'),null);this[_0xb6bb('0x22')](_0xb6bb('0x31'),_0x38970b);}}}; \ No newline at end of file +var _0xcc35=['Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','input','name','onlineForm','getDataValue','stringify','Comments','offlineForm','setDataValue','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.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','address','email','Agent','#9f946a','#ffffff','INTEGER','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','BOOLEAN'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcc35,0xda));var _0x5cc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc35[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5cc3('0x0'));var rs=require(_0x5cc3('0x1'));module[_0x5cc3('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x5cc3('0x3')],'allowNull':![],'unique':_0x5cc3('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x5')},'mapKeyOffline':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x5')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x6')},'customerAlias':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5cc3('0x3')],'allowNull':![],'defaultValue':_0x5cc3('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5cc3('0x3')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5cc3('0x3')],'allowNull':![],'defaultValue':_0x5cc3('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5cc3('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5cc3('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5cc3('0xa')](_0x5cc3('0xb'),'squared'),'defaultValue':_0x5cc3('0xb')},'header_online':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0xc')},'start_chat_button':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0xd')},'offline_chat_button':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0xe')},'header_offline':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0xf')},'download_transcript':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5cc3('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5cc3('0x12')]},'closingQuestion':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x13')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x14')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x15')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x17')},'conditionAgreement':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x18')},'ratingType':{'type':Sequelize[_0x5cc3('0xa')](_0x5cc3('0x19'),_0x5cc3('0x1a')),'defaultValue':_0x5cc3('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x5cc3('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5cc3('0x12')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x5cc3('0x1b'),'variable':null,'config':{'placeholder':_0x5cc3('0x1c'),'type':'text','required':!![]},'props':{'title':_0x5cc3('0x1c'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x5cc3('0x5'),'type':_0x5cc3('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x5cc3('0x1d'))?JSON['parse'](this[_0x5cc3('0x1e')]('onlineForm')):{};},'set':function(_0x3f50d0){return this['setDataValue'](_0x5cc3('0x1d'),JSON['stringify'](_0x3f50d0));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x5cc3('0x1f')]({'items':[{'type':'input','props':{'title':_0x5cc3('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x5cc3('0x5'),'type':_0x5cc3('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':_0x5cc3('0x20')},'props':{'title':'Comments','helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x5cc3('0x1e')](_0x5cc3('0x21'))?JSON['parse'](this[_0x5cc3('0x1e')](_0x5cc3('0x21'))):{};},'set':function(_0x5dd8ae){return this[_0x5cc3('0x22')](_0x5cc3('0x21'),JSON[_0x5cc3('0x1f')](_0x5dd8ae));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5cc3('0x23')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5cc3('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x5cc3('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x17')},'sendUnmanaged':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5cc3('0x12')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5cc3('0x3')]},'notificationTemplate':{'type':Sequelize[_0x5cc3('0x12')],'defaultValue':function(){return _0x5cc3('0x28');}},'notificationSound':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5cc3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x2a')},'verticalAlignment':{'type':Sequelize[_0x5cc3('0x9')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x5cc3('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5cc3('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x5cc3('0x3')],'allowNull':![],'defaultValue':_0x5cc3('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5cc3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5cc3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5cc3('0x3')],'defaultValue':_0x5cc3('0x2c')},'systemAvatar':{'type':Sequelize[_0x5cc3('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5cc3('0x9')],'comment':_0x5cc3('0x2d')},'mandatoryDisposition':{'type':Sequelize[_0x5cc3('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2b6c2d){if(!_0x2b6c2d)this[_0x5cc3('0x22')](_0x5cc3('0x2e'),null);this[_0x5cc3('0x22')]('mandatoryDisposition',_0x2b6c2d);}}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index ec5e880..6738fe5 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 _0xe699=['from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','List','DESC','account','applications','Applications','list','orderBy','priority','asc','Contacts','customerIp','cf-connecting-ip','first','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','format','unknown','version','%s\x20%s','device','vendor','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','created','autoclose','push','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','startRouting','EventManager','offline','mapKeyOffline','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','authentication','auth','pass','SendMail','sendMail','email','offlineMessageSubject','addInteraction','omit','Contact','User','Owner','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','indexOf','true','ONLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','virtual','License','increment','chatLicenseExceeded','all','some','remote','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','textColor','addApplications','sequelize','bulkCreate','ChatApplication','findAndCountAll','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','rimraf','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','json','count','offset','status','Content-Range','apply','reject','save','update','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','body','destroy','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','ChatWebsiteId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rawAttributes','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','customerAvatar','addSystemAvatar','systemAvatar','join','root','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe699,0x196));var _0x9e69=function(_0x32a3f3,_0x41004f){_0x32a3f3=_0x32a3f3-0x0;var _0x421387=_0xe699[_0x32a3f3];return _0x421387;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9e69('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9e69('0x1'));var moment=require('moment');var BPromise=require(_0x9e69('0x2'));var Mustache=require(_0x9e69('0x3'));var util=require(_0x9e69('0x4'));var path=require(_0x9e69('0x5'));var sox=require('sox');var csv=require(_0x9e69('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9e69('0x7'));var squel=require(_0x9e69('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9e69('0x9'));var toCsv=require(_0x9e69('0x6'));var querystring=require('querystring');var Papa=require(_0x9e69('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9e69('0xb'));var as=require(_0x9e69('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e69('0xd'))(_0x9e69('0xe'));var utils=require(_0x9e69('0xf'));var config=require(_0x9e69('0x10'));var db=require(_0x9e69('0x11'))['db'];config[_0x9e69('0x12')]=_[_0x9e69('0x13')](config[_0x9e69('0x12')],{'host':_0x9e69('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9e69('0x15'))[_0x9e69('0x16')](socket);var jayson=require(_0x9e69('0x17'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x9e69('0x18')][_0x9e69('0x19')]({'port':0x232a});var client9003=jayson[_0x9e69('0x18')][_0x9e69('0x19')]({'port':0x232b});function checkPasswordPattern(_0x2e3a37,_0xf3e0,_0x4c71f8){if(_0x4c71f8){var _0x5ba665=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5ba665[_0x9e69('0x1a')](_0xf3e0)){return _0x2e3a37;}else{throw new db[(_0x9e69('0x1b'))][(_0x9e69('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 _0x2e3a37;}}function respondWithRpcPromise(_0xd4a427,_0x38a25a,_0x49b4e0,_0x3cfb76){return new BPromise(function(_0x2a779d,_0x58e3c1){var _0x31e85e=_0x3cfb76||client;return _0x31e85e[_0x9e69('0x1d')](_0xd4a427,_0x49b4e0)[_0x9e69('0x1e')](function(_0xd545ad){logger[_0x9e69('0x1f')](_0x9e69('0x20'),_0x38a25a,_0x9e69('0x21'));logger[_0x9e69('0x22')](_0x9e69('0x23'),_0x38a25a,'request\x20sent',JSON[_0x9e69('0x24')](_0xd545ad));if(_0xd545ad[_0x9e69('0x25')]){if(_0xd545ad[_0x9e69('0x25')]['code']===0x1f4){logger[_0x9e69('0x25')](_0x9e69('0x20'),_0x38a25a,_0xd545ad[_0x9e69('0x25')]['message']);return _0x58e3c1(_0xd545ad[_0x9e69('0x25')]['message']);}logger[_0x9e69('0x25')](_0x9e69('0x20'),_0x38a25a,_0xd545ad[_0x9e69('0x25')][_0x9e69('0x26')]);return _0x2a779d(_0xd545ad[_0x9e69('0x25')][_0x9e69('0x26')]);}else{logger[_0x9e69('0x1f')](_0x9e69('0x20'),_0x38a25a,_0x9e69('0x21'));_0x2a779d(_0xd545ad[_0x9e69('0x27')][_0x9e69('0x26')]);}})[_0x9e69('0x28')](function(_0x1f9646){logger[_0x9e69('0x25')](_0x9e69('0x20'),_0x38a25a,_0x1f9646);_0x58e3c1(_0x1f9646);});});}function respondWithStatusCode(_0x592859,_0x495f39){_0x495f39=_0x495f39||0xcc;return function(_0x4a7301){if(_0x4a7301){return _0x592859[_0x9e69('0x29')](_0x495f39);}return _0x592859['status'](_0x495f39)[_0x9e69('0x2a')]();};}function respondWithResult(_0x5ea7cb,_0x26a51a){_0x26a51a=_0x26a51a||0xc8;return function(_0x33b0dc){if(_0x33b0dc){return _0x5ea7cb['status'](_0x26a51a)[_0x9e69('0x2b')](_0x33b0dc);}};}function respondWithFilteredResult(_0x20c3cd,_0x80b9c4){return function(_0x4faab7){if(_0x4faab7){var _0x37b6d3=_0x4faab7[_0x9e69('0x2c')],_0x5420c9=_0x80b9c4[_0x9e69('0x2d')],_0x538d97=_0x80b9c4[_0x9e69('0x2d')]+_0x80b9c4['limit'],_0xd91592;if(_0x538d97>=_0x37b6d3){_0x538d97=_0x37b6d3;_0xd91592=0xc8;}else{_0xd91592=0xce;}_0x20c3cd[_0x9e69('0x2e')](_0xd91592);return _0x20c3cd['set'](_0x9e69('0x2f'),_0x5420c9+'-'+_0x538d97+'/'+_0x37b6d3)['json'](_0x4faab7);}return null;};}function patchUpdates(_0x4b43fa){return function(_0x5b6e7c){try{jsonpatch[_0x9e69('0x30')](_0x5b6e7c,_0x4b43fa,!![]);}catch(_0x5f1a19){return BPromise[_0x9e69('0x31')](_0x5f1a19);}return _0x5b6e7c[_0x9e69('0x32')]();};}function saveUpdates(_0x2c1a33,_0xa96198){return function(_0x5d7cb8){if(_0x5d7cb8){return _0x5d7cb8[_0x9e69('0x33')](_0x2c1a33)[_0x9e69('0x1e')](function(_0x255e75){return _0x255e75;});}return null;};}function removeEntity(_0x5f13df,_0xaccff8){return function(_0x38207c){if(_0x38207c){return _0x38207c['destroy']()['then'](function(){var _0x2b0254=_0x38207c[_0x9e69('0x34')]({'plain':!![]});var _0x3574d3=_0x9e69('0x35');return db[_0x9e69('0x36')]['destroy']({'where':{'type':_0x3574d3,'resourceId':_0x2b0254['id']}})['then'](function(){return _0x38207c;});})[_0x9e69('0x1e')](function(){_0x5f13df[_0x9e69('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4eec71,_0x1d6f75){return function(_0x1323c2){if(!_0x1323c2){_0x4eec71[_0x9e69('0x29')](0x194);}return _0x1323c2;};}function handleError(_0x20d4e6,_0x18e228){_0x18e228=_0x18e228||0x1f4;return function(_0x544830){logger[_0x9e69('0x25')](_0x544830[_0x9e69('0x37')]);if(_0x544830[_0x9e69('0x38')]){delete _0x544830['name'];}_0x20d4e6['status'](_0x18e228)[_0x9e69('0x39')](_0x544830);};}exports[_0x9e69('0x3a')]=function(_0x27327c,_0x4933ac){var _0x24464d={'include':[{'model':db[_0x9e69('0x3b')],'as':_0x9e69('0x3c')}]},_0x3e422d={},_0xd9a28={'count':0x0,'rows':[]};var _0x4b4035=_['map'](db[_0x9e69('0x3d')]['rawAttributes'],function(_0x19994e){return{'name':_0x19994e[_0x9e69('0x3e')],'type':_0x19994e[_0x9e69('0x3f')][_0x9e69('0x40')]};});_0x3e422d[_0x9e69('0x41')]=_[_0x9e69('0x42')](_0x4b4035,_0x9e69('0x38'));_0x3e422d['query']=_[_0x9e69('0x43')](_0x27327c[_0x9e69('0x44')]);_0x3e422d[_0x9e69('0x45')]=_[_0x9e69('0x46')](_0x3e422d[_0x9e69('0x41')],_0x3e422d[_0x9e69('0x44')]);_0x24464d[_0x9e69('0x47')]=_[_0x9e69('0x46')](_0x3e422d[_0x9e69('0x41')],qs['fields'](_0x27327c[_0x9e69('0x44')][_0x9e69('0x48')]));_0x24464d[_0x9e69('0x47')]=_0x24464d[_0x9e69('0x47')][_0x9e69('0x49')]?_0x24464d['attributes']:_0x3e422d[_0x9e69('0x41')];if(!_0x27327c['query']['hasOwnProperty'](_0x9e69('0x4a'))){_0x24464d[_0x9e69('0x4b')]=qs[_0x9e69('0x4b')](_0x27327c['query'][_0x9e69('0x4b')]);_0x24464d[_0x9e69('0x2d')]=qs[_0x9e69('0x2d')](_0x27327c[_0x9e69('0x44')][_0x9e69('0x2d')]);}_0x24464d[_0x9e69('0x4c')]=qs[_0x9e69('0x4d')](_0x27327c[_0x9e69('0x44')][_0x9e69('0x4d')]);_0x24464d[_0x9e69('0x4e')]=qs[_0x9e69('0x45')](_[_0x9e69('0x4f')](_0x27327c[_0x9e69('0x44')],_0x3e422d[_0x9e69('0x45')]));if(_0x27327c[_0x9e69('0x44')][_0x9e69('0x50')]){_0x24464d[_0x9e69('0x4e')]=_[_0x9e69('0x51')](_0x24464d[_0x9e69('0x4e')],{'$or':_[_0x9e69('0x42')](_0x4b4035,function(_0x1edb26){if(_0x1edb26['type']!==_0x9e69('0x52')){var _0x3a57ef={};_0x3a57ef[_0x1edb26['name']]={'$like':'%'+_0x27327c[_0x9e69('0x44')][_0x9e69('0x50')]+'%'};return _0x3a57ef;}})});}_0x24464d=_[_0x9e69('0x51')]({},_0x24464d,_0x27327c[_0x9e69('0x53')]);var _0x4cf4f4={'where':_0x24464d[_0x9e69('0x4e')]};return db['ChatWebsite'][_0x9e69('0x2c')](_0x4cf4f4)[_0x9e69('0x1e')](function(_0x4ee161){_0xd9a28['count']=_0x4ee161;if(_0x27327c[_0x9e69('0x44')][_0x9e69('0x54')]){_0x24464d[_0x9e69('0x55')]=[{'all':!![]}];}return db[_0x9e69('0x3d')]['findAll'](_0x24464d);})[_0x9e69('0x1e')](function(_0x44c825){_0xd9a28[_0x9e69('0x56')]=_0x44c825;return _0xd9a28;})[_0x9e69('0x1e')](respondWithFilteredResult(_0x4933ac,_0x24464d))[_0x9e69('0x28')](handleError(_0x4933ac,null));};exports['show']=function(_0x3605b4,_0x4e7b3b){var _0x110362={'raw':![],'where':{'id':_0x3605b4[_0x9e69('0x57')]['id']},'include':[{'model':db[_0x9e69('0x3b')],'as':'mandatoryDispositionPause'}]},_0x1c8b9f={};_0x1c8b9f['model']=_['keys'](db['ChatWebsite']['rawAttributes']);_0x1c8b9f['query']=_['keys'](_0x3605b4[_0x9e69('0x44')]);_0x1c8b9f[_0x9e69('0x45')]=_[_0x9e69('0x46')](_0x1c8b9f['model'],_0x1c8b9f[_0x9e69('0x44')]);_0x110362[_0x9e69('0x47')]=_[_0x9e69('0x46')](_0x1c8b9f[_0x9e69('0x41')],qs[_0x9e69('0x48')](_0x3605b4['query'][_0x9e69('0x48')]));_0x110362['attributes']=_0x110362[_0x9e69('0x47')][_0x9e69('0x49')]?_0x110362[_0x9e69('0x47')]:_0x1c8b9f[_0x9e69('0x41')];if(_0x3605b4[_0x9e69('0x44')][_0x9e69('0x54')]){_0x110362[_0x9e69('0x55')]=[{'all':!![]}];}_0x110362=_[_0x9e69('0x51')]({},_0x110362,_0x3605b4['options']);return db['ChatWebsite'][_0x9e69('0x58')](_0x110362)['then'](handleEntityNotFound(_0x4e7b3b,null))[_0x9e69('0x1e')](respondWithResult(_0x4e7b3b,null))[_0x9e69('0x28')](handleError(_0x4e7b3b,null));};exports[_0x9e69('0x59')]=function(_0x4b168e,_0x1b38e4){return db[_0x9e69('0x3d')][_0x9e69('0x59')](_0x4b168e['body'],{})[_0x9e69('0x1e')](function(_0x103e6d){var _0x6db9ea=_0x4b168e[_0x9e69('0x5a')]['get']({'plain':!![]});if(!_0x6db9ea)throw new Error(_0x9e69('0x5b'));if(_0x6db9ea['role']==='user'){var _0x24916c=_0x103e6d[_0x9e69('0x34')]({'plain':!![]});var _0x4853a0=_0x9e69('0x35');return db[_0x9e69('0x5c')]['find']({'where':{'name':_0x4853a0,'userProfileId':_0x6db9ea[_0x9e69('0x5d')]},'raw':!![]})[_0x9e69('0x1e')](function(_0x339079){if(_0x339079&&_0x339079[_0x9e69('0x5e')]===0x0){return db[_0x9e69('0x36')][_0x9e69('0x59')]({'name':_0x24916c['name'],'resourceId':_0x24916c['id'],'type':_0x339079[_0x9e69('0x38')],'sectionId':_0x339079['id']},{})[_0x9e69('0x1e')](function(){return _0x103e6d;});}else{return _0x103e6d;}})[_0x9e69('0x28')](function(_0x14bacb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14bacb);throw _0x14bacb;});}return _0x103e6d;})[_0x9e69('0x1e')](respondWithResult(_0x1b38e4,0xc9))[_0x9e69('0x28')](handleError(_0x1b38e4,null));};exports['update']=function(_0x40b7fb,_0x5dfb18){if(_0x40b7fb['body']['id']){delete _0x40b7fb[_0x9e69('0x5f')]['id'];}return db[_0x9e69('0x3d')][_0x9e69('0x58')]({'where':{'id':_0x40b7fb['params']['id']},'include':[{'model':db[_0x9e69('0x3b')],'as':_0x9e69('0x3c')}]})[_0x9e69('0x1e')](handleEntityNotFound(_0x5dfb18,null))[_0x9e69('0x1e')](saveUpdates(_0x40b7fb['body'],null))[_0x9e69('0x1e')](respondWithResult(_0x5dfb18,null))['catch'](handleError(_0x5dfb18,null));};exports[_0x9e69('0x60')]=function(_0x5987a8,_0x120071){return db[_0x9e69('0x3d')][_0x9e69('0x58')]({'where':{'id':_0x5987a8['params']['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0x120071,null))[_0x9e69('0x1e')](removeEntity(_0x120071,null))['catch'](handleError(_0x120071,null));};exports[_0x9e69('0x61')]=function(_0x232059,_0x420298){return db[_0x9e69('0x3d')][_0x9e69('0x61')]()[_0x9e69('0x1e')](respondWithResult(_0x420298,null))[_0x9e69('0x28')](handleError(_0x420298,null));};exports[_0x9e69('0x62')]=function(_0x243198,_0x418360,_0x2f4aee){if(_0x243198[_0x9e69('0x5f')]['id']){delete _0x243198[_0x9e69('0x5f')]['id'];}return db[_0x9e69('0x3d')]['find']({'where':{'id':_0x243198[_0x9e69('0x57')]['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0x418360,null))['then'](function(_0x3cbe0a){if(_0x3cbe0a){_0x243198[_0x9e69('0x5f')]['ChatWebsiteId']=_0x3cbe0a['id'];return db[_0x9e69('0x63')]['create'](_0x243198[_0x9e69('0x5f')]);}})[_0x9e69('0x1e')](respondWithResult(_0x418360,null))['catch'](handleError(_0x418360,null));};exports[_0x9e69('0x64')]=function(_0x236206,_0x3ef54f,_0x3f88f3){var _0x582dd5={'raw':![],'where':{}};var _0x2667ba={};var _0x1f8f2d={'count':0x0,'rows':[]};return db[_0x9e69('0x3d')][_0x9e69('0x65')]({'where':{'id':_0x236206[_0x9e69('0x57')]['id']}})['then'](handleEntityNotFound(_0x3ef54f,null))['then'](function(_0x359ac0){if(_0x359ac0){_0x2667ba[_0x9e69('0x41')]=_['keys'](db[_0x9e69('0x63')]['rawAttributes']);_0x2667ba['query']=_['keys'](_0x236206['query']);_0x2667ba[_0x9e69('0x45')]=_[_0x9e69('0x46')](_0x2667ba[_0x9e69('0x41')],_0x2667ba[_0x9e69('0x44')]);_0x582dd5[_0x9e69('0x47')]=_[_0x9e69('0x46')](_0x2667ba['model'],qs[_0x9e69('0x48')](_0x236206['query']['fields']));_0x582dd5[_0x9e69('0x47')]=_0x582dd5[_0x9e69('0x47')]['length']?_0x582dd5[_0x9e69('0x47')]:_0x2667ba[_0x9e69('0x41')];if(!_0x236206['query'][_0x9e69('0x66')](_0x9e69('0x4a'))){_0x582dd5[_0x9e69('0x4b')]=qs[_0x9e69('0x4b')](_0x236206[_0x9e69('0x44')][_0x9e69('0x4b')]);_0x582dd5[_0x9e69('0x2d')]=qs[_0x9e69('0x2d')](_0x236206[_0x9e69('0x44')][_0x9e69('0x2d')]);}_0x582dd5['order']=qs[_0x9e69('0x4d')](_0x236206['query'][_0x9e69('0x4d')]);_0x582dd5[_0x9e69('0x4e')]=qs[_0x9e69('0x45')](_[_0x9e69('0x4f')](_0x236206['query'],_0x2667ba[_0x9e69('0x45')]));_0x582dd5[_0x9e69('0x4e')][_0x9e69('0x67')]=_0x359ac0['id'];if(_0x236206[_0x9e69('0x44')][_0x9e69('0x50')]){_0x582dd5[_0x9e69('0x4e')]=_['merge'](_0x582dd5[_0x9e69('0x4e')],{'$or':_['map'](_0x582dd5['attributes'],function(_0x5de2c2){var _0x424ce4={};_0x424ce4[_0x5de2c2]={'$like':'%'+_0x236206[_0x9e69('0x44')][_0x9e69('0x50')]+'%'};return _0x424ce4;})});}_0x582dd5=_['merge']({},_0x582dd5,_0x236206[_0x9e69('0x53')]);return db[_0x9e69('0x63')][_0x9e69('0x2c')]({'where':_0x582dd5[_0x9e69('0x4e')]})['then'](function(_0x4d44c7){_0x1f8f2d[_0x9e69('0x2c')]=_0x4d44c7;if(_0x236206[_0x9e69('0x44')][_0x9e69('0x54')]){_0x582dd5[_0x9e69('0x55')]=[{'all':!![]}];}return db[_0x9e69('0x63')][_0x9e69('0x68')](_0x582dd5);})[_0x9e69('0x1e')](function(_0x12affe){_0x1f8f2d['rows']=_0x12affe;return _0x1f8f2d;});}})[_0x9e69('0x1e')](respondWithFilteredResult(_0x3ef54f,_0x582dd5))[_0x9e69('0x28')](handleError(_0x3ef54f,null));};exports[_0x9e69('0x69')]=function(_0x23d9b3,_0x481f23,_0x2bac5b){return db[_0x9e69('0x3d')][_0x9e69('0x58')]({'where':{'id':_0x23d9b3[_0x9e69('0x57')]['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0x481f23,null))[_0x9e69('0x1e')](function(_0x1a3859){if(_0x1a3859){return _0x1a3859[_0x9e69('0x69')](_0x23d9b3['query'][_0x9e69('0x6a')]);}})['then'](respondWithStatusCode(_0x481f23,null))[_0x9e69('0x28')](handleError(_0x481f23,null));};exports[_0x9e69('0x6b')]=function(_0x2012a7,_0x36584d,_0x27598c){if(_0x2012a7[_0x9e69('0x5f')]['id']){delete _0x2012a7[_0x9e69('0x5f')]['id'];}return db[_0x9e69('0x3d')][_0x9e69('0x58')]({'where':{'id':_0x2012a7[_0x9e69('0x57')]['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0x36584d,null))[_0x9e69('0x1e')](function(_0x409f38){if(_0x409f38){_0x2012a7[_0x9e69('0x5f')]['ChatWebsiteId']=_0x409f38['id'];return db[_0x9e69('0x6c')][_0x9e69('0x59')](_0x2012a7[_0x9e69('0x5f')]);}})[_0x9e69('0x1e')](respondWithResult(_0x36584d,null))[_0x9e69('0x28')](handleError(_0x36584d,null));};exports[_0x9e69('0x6d')]=function(_0x3a05b9,_0x3a797f,_0x1fba5d){var _0x4ff882={'raw':![],'where':{}};var _0xdc66cf={};var _0x3b788a={'count':0x0,'rows':[]};return db[_0x9e69('0x3d')][_0x9e69('0x65')]({'where':{'id':_0x3a05b9['params']['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0x3a797f,null))[_0x9e69('0x1e')](function(_0x20e119){if(_0x20e119){_0xdc66cf['model']=_[_0x9e69('0x43')](db[_0x9e69('0x6c')][_0x9e69('0x6e')]);_0xdc66cf[_0x9e69('0x44')]=_[_0x9e69('0x43')](_0x3a05b9[_0x9e69('0x44')]);_0xdc66cf['filters']=_[_0x9e69('0x46')](_0xdc66cf['model'],_0xdc66cf['query']);_0x4ff882['attributes']=_[_0x9e69('0x46')](_0xdc66cf[_0x9e69('0x41')],qs['fields'](_0x3a05b9[_0x9e69('0x44')][_0x9e69('0x48')]));_0x4ff882[_0x9e69('0x47')]=_0x4ff882['attributes'][_0x9e69('0x49')]?_0x4ff882['attributes']:_0xdc66cf[_0x9e69('0x41')];if(!_0x3a05b9[_0x9e69('0x44')][_0x9e69('0x66')](_0x9e69('0x4a'))){_0x4ff882['limit']=qs[_0x9e69('0x4b')](_0x3a05b9[_0x9e69('0x44')][_0x9e69('0x4b')]);_0x4ff882[_0x9e69('0x2d')]=qs[_0x9e69('0x2d')](_0x3a05b9[_0x9e69('0x44')]['offset']);}_0x4ff882['order']=qs['sort'](_0x3a05b9[_0x9e69('0x44')]['sort']);_0x4ff882[_0x9e69('0x4e')]=qs[_0x9e69('0x45')](_[_0x9e69('0x4f')](_0x3a05b9[_0x9e69('0x44')],_0xdc66cf[_0x9e69('0x45')]));_0x4ff882[_0x9e69('0x4e')][_0x9e69('0x67')]=_0x20e119['id'];if(_0x3a05b9[_0x9e69('0x44')]['filter']){_0x4ff882['where']=_[_0x9e69('0x51')](_0x4ff882[_0x9e69('0x4e')],{'$or':_[_0x9e69('0x42')](_0x4ff882['attributes'],function(_0x967b10){var _0x5bf6b2={};_0x5bf6b2[_0x967b10]={'$like':'%'+_0x3a05b9[_0x9e69('0x44')][_0x9e69('0x50')]+'%'};return _0x5bf6b2;})});}_0x4ff882=_['merge']({},_0x4ff882,_0x3a05b9[_0x9e69('0x53')]);return db[_0x9e69('0x6c')]['count']({'where':_0x4ff882['where']})[_0x9e69('0x1e')](function(_0x2a91ae){_0x3b788a['count']=_0x2a91ae;if(_0x3a05b9['query'][_0x9e69('0x54')]){_0x4ff882[_0x9e69('0x55')]=[{'all':!![]}];}return db[_0x9e69('0x6c')]['findAll'](_0x4ff882);})[_0x9e69('0x1e')](function(_0x7e093a){_0x3b788a['rows']=_0x7e093a;return _0x3b788a;});}})[_0x9e69('0x1e')](respondWithFilteredResult(_0x3a797f,_0x4ff882))['catch'](handleError(_0x3a797f,null));};exports[_0x9e69('0x6f')]=function(_0x321d19,_0x69309c,_0x128850){return db[_0x9e69('0x3d')]['find']({'where':{'id':_0x321d19['params']['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0x69309c,null))[_0x9e69('0x1e')](function(_0x2b1442){if(_0x2b1442){return _0x2b1442[_0x9e69('0x6f')](_0x321d19['query'][_0x9e69('0x6a')]);}})[_0x9e69('0x1e')](respondWithStatusCode(_0x69309c,null))[_0x9e69('0x28')](handleError(_0x69309c,null));};exports[_0x9e69('0x70')]=function(_0x46dc83,_0x28cbf6,_0x309cb6){_0x46dc83[_0x9e69('0x5f')][_0x9e69('0x71')]=_0x46dc83['file'][_0x9e69('0x72')];return db[_0x9e69('0x3d')]['find']({'where':{'id':_0x46dc83['params']['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0x28cbf6,null))[_0x9e69('0x1e')](saveUpdates(_0x46dc83['body'],null))[_0x9e69('0x1e')](respondWithResult(_0x28cbf6,null))[_0x9e69('0x28')](handleError(_0x28cbf6,null));};exports[_0x9e69('0x73')]=function(_0x388237,_0x5cf62c,_0x726cec){_0x388237[_0x9e69('0x5f')][_0x9e69('0x74')]=_0x388237[_0x9e69('0x75')][_0x9e69('0x72')];return db['ChatWebsite'][_0x9e69('0x58')]({'where':{'id':_0x388237[_0x9e69('0x57')]['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0x5cf62c,null))[_0x9e69('0x1e')](saveUpdates(_0x388237[_0x9e69('0x5f')],null))[_0x9e69('0x1e')](respondWithResult(_0x5cf62c,null))[_0x9e69('0x28')](handleError(_0x5cf62c,null));};exports['addCustomerAvatar']=function(_0x2145a6,_0x575e50,_0x3ac2ed){_0x2145a6[_0x9e69('0x5f')][_0x9e69('0x76')]=_0x2145a6['file']['filename'];return db[_0x9e69('0x3d')][_0x9e69('0x58')]({'where':{'id':_0x2145a6[_0x9e69('0x57')]['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0x575e50,null))[_0x9e69('0x1e')](saveUpdates(_0x2145a6[_0x9e69('0x5f')],null))[_0x9e69('0x1e')](respondWithResult(_0x575e50,null))[_0x9e69('0x28')](handleError(_0x575e50,null));};exports[_0x9e69('0x77')]=function(_0x4f58b5,_0xce141f,_0x2d592d){_0x4f58b5[_0x9e69('0x5f')][_0x9e69('0x78')]=_0x4f58b5[_0x9e69('0x75')]['filename'];return db[_0x9e69('0x3d')][_0x9e69('0x58')]({'where':{'id':_0x4f58b5[_0x9e69('0x57')]['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0xce141f,null))['then'](saveUpdates(_0x4f58b5[_0x9e69('0x5f')],null))['then'](respondWithResult(_0xce141f,null))[_0x9e69('0x28')](handleError(_0xce141f,null));};exports['getLogo']=function(_0x542a92,_0x36502e,_0x51bb6b){var _0x26c62c=path[_0x9e69('0x79')](config[_0x9e69('0x7a')],'server/files/images/logos/default_logo.png');var _0x409f37={'where':{'id':_0x542a92['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x1b3db6=![];return require('../../config/license/util')[_0x9e69('0x7b')]()[_0x9e69('0x1e')](function(_0x46885b){if(_0x46885b){_0x1b3db6=_0x46885b[_0x9e69('0x7c')];}})['then'](function(){return db[_0x9e69('0x3d')][_0x9e69('0x58')](_0x409f37);})[_0x9e69('0x1e')](handleEntityNotFound(_0x36502e,null))[_0x9e69('0x1e')](function(_0x778e49){if(_0x778e49){if(!_[_0x9e69('0x7d')](_0x778e49[_0x9e69('0x71')])){if(fs[_0x9e69('0x7e')](path['join'](config[_0x9e69('0x7a')],_0x9e69('0x7f'),_0x778e49[_0x9e69('0x71')]))&&_0x1b3db6){_0x26c62c=path[_0x9e69('0x79')](config['root'],'server/files/images/logos/',_0x778e49[_0x9e69('0x71')]);}}return _0x36502e[_0x9e69('0x80')](_0x26c62c);}})[_0x9e69('0x28')](handleError(_0x36502e,null));};exports['getAvatar']=function(_0x291dc5,_0x439144,_0x185e57){var _0x3cb896=path[_0x9e69('0x79')](config['root'],_0x9e69('0x81'));var _0x175a9f={'where':{'id':_0x291dc5[_0x9e69('0x57')]['id']},'attributes':['id',_0x9e69('0x74')],'raw':!![]};return db['ChatWebsite'][_0x9e69('0x58')](_0x175a9f)[_0x9e69('0x1e')](handleEntityNotFound(_0x439144,null))[_0x9e69('0x1e')](function(_0x460650){if(_0x460650){if(!_['isNil'](_0x460650[_0x9e69('0x74')])){if(fs['existsSync'](path[_0x9e69('0x79')](config[_0x9e69('0x7a')],_0x9e69('0x82'),_0x460650[_0x9e69('0x74')]))){_0x3cb896=path[_0x9e69('0x79')](config[_0x9e69('0x7a')],_0x9e69('0x82'),_0x460650[_0x9e69('0x74')]);}}return _0x439144['download'](_0x3cb896);}})['catch'](handleError(_0x439144,null));};exports['getCustomerAvatar']=function(_0x29fea7,_0x555a84,_0x964ab5){var _0x268758=path[_0x9e69('0x79')](config[_0x9e69('0x7a')],'server/files/images/avatars/customer_avatar.png');var _0x4603e8={'where':{'id':_0x29fea7[_0x9e69('0x57')]['id']},'attributes':['id',_0x9e69('0x76'),'showCustomerAvatar'],'raw':!![]};return db[_0x9e69('0x3d')]['find'](_0x4603e8)[_0x9e69('0x1e')](handleEntityNotFound(_0x555a84,null))[_0x9e69('0x1e')](function(_0x3fc582){if(_0x3fc582){if(!_['isNil'](_0x3fc582[_0x9e69('0x76')])){if(fs[_0x9e69('0x7e')](path[_0x9e69('0x79')](config['root'],_0x9e69('0x82'),_0x3fc582[_0x9e69('0x76')]))&&_0x3fc582['showCustomerAvatar']){_0x268758=path[_0x9e69('0x79')](config[_0x9e69('0x7a')],_0x9e69('0x82'),_0x3fc582[_0x9e69('0x76')]);}}return _0x555a84['download'](_0x268758);}})[_0x9e69('0x28')](handleError(_0x555a84,null));};exports['getSystemAvatar']=function(_0x530f1e,_0x1134d3,_0x5252ea){var _0x5d13ad=path[_0x9e69('0x79')](config[_0x9e69('0x7a')],_0x9e69('0x83'));var _0x314959={'where':{'id':_0x530f1e[_0x9e69('0x57')]['id']},'attributes':['id',_0x9e69('0x78')],'raw':!![]};return db[_0x9e69('0x3d')]['find'](_0x314959)['then'](handleEntityNotFound(_0x1134d3,null))[_0x9e69('0x1e')](function(_0xa3573e){if(_0xa3573e){if(!_[_0x9e69('0x7d')](_0xa3573e['systemAvatar'])){if(fs[_0x9e69('0x7e')](path[_0x9e69('0x79')](config['root'],_0x9e69('0x82'),_0xa3573e['systemAvatar']))){_0x5d13ad=path[_0x9e69('0x79')](config[_0x9e69('0x7a')],_0x9e69('0x82'),_0xa3573e['systemAvatar']);}}return _0x1134d3[_0x9e69('0x80')](_0x5d13ad);}})[_0x9e69('0x28')](handleError(_0x1134d3,null));};exports[_0x9e69('0x84')]=function(_0x45dcae,_0x34db78,_0x46a6c5){var _0x38c2b2=require(_0x9e69('0x85'));var _0x3908d6=new _0x38c2b2();var _0x6bb4ef=_0x3908d6[_0x9e69('0x86')](_0x45dcae[_0x9e69('0x87')][_0x9e69('0x88')])['getResult']();var _0xf719ce={'body':_0x45dcae[_0x9e69('0x5f')],'channel':'chat'};var _0x582da5=[];var _0x385a41=[];var _0x3568c7={};var _0x39765a=![];return db[_0x9e69('0x89')][_0x9e69('0x61')]()[_0x9e69('0x1e')](function(_0x3a759f){if(!_0x3a759f){throw new db[(_0x9e69('0x1b'))][(_0x9e69('0x1c'))](_0x9e69('0x8a'));}_0x582da5=_['difference'](_[_0x9e69('0x43')](_0x3a759f),[_0x9e69('0x8b'),_0x9e69('0x8c')]);_0x385a41=_[_0x9e69('0x8d')](_[_0x9e69('0x43')](_0x3a759f),[_0x9e69('0x8b'),_0x9e69('0x8c'),_0x9e69('0x8e'),_0x9e69('0x8f')]);if(_0x45dcae['body']['id']){delete _0x45dcae['body']['id'];}if(_[_0x9e69('0x7d')](_0x45dcae[_0x9e69('0x5f')][_0x9e69('0x90')])){throw new db[(_0x9e69('0x1b'))][(_0x9e69('0x1c'))](_0x9e69('0x91'));}if(_[_0x9e69('0x7d')](_0x45dcae[_0x9e69('0x5f')][_0x9e69('0x5f')])||_0x45dcae[_0x9e69('0x5f')][_0x9e69('0x5f')]===''){throw new db['Sequelize']['ValidationError'](_0x9e69('0x92'));}if(_['isNil'](_0x45dcae[_0x9e69('0x5f')][_0x9e69('0x93')])){throw new db['Sequelize']['ValidationError'](_0x9e69('0x94')+_0x385a41);}if(!_[_0x9e69('0x95')](_0x385a41,_0x45dcae[_0x9e69('0x5f')][_0x9e69('0x93')])){throw new db[(_0x9e69('0x1b'))][(_0x9e69('0x1c'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x385a41);}_0x3568c7[_0x45dcae[_0x9e69('0x5f')][_0x9e69('0x93')]]=_0x45dcae[_0x9e69('0x5f')][_0x9e69('0x90')];})[_0x9e69('0x1e')](function(){return db[_0x9e69('0x3d')]['find']({'where':{'id':_0x45dcae[_0x9e69('0x57')]['id']},'include':[{'model':db[_0x9e69('0x96')],'as':_0x9e69('0x97'),'include':[{'model':db[_0x9e69('0x89')],'as':'Contacts','where':_0x3568c7,'limit':0x1,'order':[[_0x9e69('0x8c'),_0x9e69('0x98')]]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0x9e69('0x1e')](handleEntityNotFound(_0x34db78,null))[_0x9e69('0x1e')](function(_0x37da07){if(_0x37da07&&_0x37da07['List']){_0xf719ce[_0x9e69('0x99')]=_0x37da07;_0xf719ce[_0x9e69('0x9a')]=_0x37da07[_0x9e69('0x9b')];_0xf719ce[_0x9e69('0x9c')]=_0x37da07[_0x9e69('0x97')];_0xf719ce[_0x9e69('0x9a')]=_[_0x9e69('0x9d')](_0xf719ce[_0x9e69('0x9a')],[_0x9e69('0x9e')],[_0x9e69('0x9f')]);if(_0xf719ce[_0x9e69('0x99')][_0x9e69('0x9b')]){delete _0xf719ce['account'][_0x9e69('0x9b')];}if(_0xf719ce[_0x9e69('0x99')][_0x9e69('0x97')]&&_0xf719ce['account'][_0x9e69('0x97')][_0x9e69('0xa0')][_0x9e69('0x49')]){return _0xf719ce[_0x9e69('0x99')]['List'][_0x9e69('0xa0')][0x0];}var _0x43889c=_[_0x9e69('0x13')](_0x45dcae[_0x9e69('0x5f')],{'firstName':_0x45dcae[_0x9e69('0x5f')][_0x9e69('0x90')],'ListId':_0x37da07[_0x9e69('0x8f')]});_0x43889c[_0x45dcae[_0x9e69('0x5f')][_0x9e69('0x93')]]=_0x45dcae['body'][_0x9e69('0x90')];return db['CmContact'][_0x9e69('0x59')](_0x43889c,{'fields':_0x582da5,'raw':!![]});}})[_0x9e69('0x1e')](handleEntityNotFound(_0x34db78,null))['then'](function(_0x2a6d6e){_0xf719ce['contact']=_0x2a6d6e;var _0x1e9214=_0x45dcae[_0x9e69('0x5f')][_0x9e69('0xa1')];if(_0x45dcae[_0x9e69('0x87')][_0x9e69('0xa2')]){_0x1e9214=_0x45dcae[_0x9e69('0x87')][_0x9e69('0xa2')];}else if(_0x45dcae['headers']['x-forwarded-for']){_0x1e9214=_[_0x9e69('0xa3')](_0x45dcae[_0x9e69('0x87')][_0x9e69('0xa4')]['split'](','));}if(_0x2a6d6e){var _0x4c2822={'ContactId':_0x2a6d6e['id'],'ChatWebsiteId':_0x45dcae[_0x9e69('0x57')]['id'],'from':(_0x2a6d6e[_0x9e69('0xa5')]||'')+'\x20'+(_0x2a6d6e[_0x9e69('0xa6')]||''),'customerIp':_0x1e9214,'customerPort':_0x45dcae['headers']['x-real-port']?_0x45dcae['headers'][_0x9e69('0xa7')]:null,'referer':_0x45dcae['body'][_0x9e69('0xa8')],'browserName':_0x6bb4ef[_0x9e69('0xa9')][_0x9e69('0x38')]&&_0x6bb4ef[_0x9e69('0xa9')]['version']?util[_0x9e69('0xaa')]('%s\x20%s',_0x6bb4ef[_0x9e69('0xa9')][_0x9e69('0x38')],_0x6bb4ef['browser']['version']):_0x9e69('0xab'),'browserVersion':_0x6bb4ef[_0x9e69('0xa9')][_0x9e69('0xac')]||'unknown','osName':util[_0x9e69('0xaa')](_0x9e69('0xad'),_0x6bb4ef['os']['name'],_0x6bb4ef['os'][_0x9e69('0xac')]),'osVersion':_0x6bb4ef['os']['version'],'deviceModel':_0x6bb4ef[_0x9e69('0xae')][_0x9e69('0x41')]&&_0x6bb4ef[_0x9e69('0xae')]['vendor']?util['format']('%s\x20%s\x20%s',_0x6bb4ef[_0x9e69('0xae')][_0x9e69('0x41')],_0x6bb4ef[_0x9e69('0xae')][_0x9e69('0xaf')],_0x6bb4ef[_0x9e69('0xae')]['type']):null,'deviceVendor':_0x6bb4ef[_0x9e69('0xae')][_0x9e69('0xaf')],'deviceType':_0x6bb4ef[_0x9e69('0xae')][_0x9e69('0x3f')],'formData':JSON['stringify'](_0x45dcae['body'])};var _0x1f14ab={'ChatWebsiteId':_0x45dcae[_0x9e69('0x57')]['id'],'closed':![]};if(_0x45dcae[_0x9e69('0x5f')][_0x9e69('0xb0')]){_0x1f14ab[_0x9e69('0xb0')]=_0x45dcae['body'][_0x9e69('0xb0')];return db[_0x9e69('0xb1')][_0x9e69('0x58')]({'where':_0x1f14ab})[_0x9e69('0x1e')](function(_0x44434d){if(_0x44434d){return[_0x44434d,![]];}_0x4c2822[_0x9e69('0xb0')]=_0x45dcae['body'][_0x9e69('0xb0')];_0x4c2822[_0x9e69('0xb2')]=_0x45dcae['body'][_0x9e69('0xb2')];return db['ChatInteraction'][_0x9e69('0x59')](_0x4c2822)['then'](function(_0x436467){return[_0x436467,!![]];});});}_0x1f14ab[_0x9e69('0xb3')]=_0x2a6d6e['id'];if(_0x45dcae['body'][_0x9e69('0xb4')]&&_0x45dcae[_0x9e69('0x5f')][_0x9e69('0xb4')]['id']){_0x1f14ab['id']=_0x45dcae[_0x9e69('0x5f')]['interaction']['id'];return db[_0x9e69('0xb1')][_0x9e69('0x58')]({'where':_0x1f14ab})[_0x9e69('0x1e')](function(_0x2375cf){if(_0x2375cf){return[_0x2375cf,![]];}return db[_0x9e69('0xb1')][_0x9e69('0x59')](_0x4c2822)[_0x9e69('0x1e')](function(_0x40cb7c){return[_0x40cb7c,!![]];});});}return db[_0x9e69('0xb1')][_0x9e69('0x59')](_0x4c2822)[_0x9e69('0x1e')](function(_0x17f082){return[_0x17f082,!![]];});}})[_0x9e69('0xb5')](function(_0x44931f,_0x55dd15){if(_0x44931f){_0x39765a=_0x55dd15;if(!_0x55dd15){var _0x2c7f9a={'from':(_0xf719ce[_0x9e69('0xb6')][_0x9e69('0xa5')]||'')+'\x20'+(_0xf719ce[_0x9e69('0xb6')][_0x9e69('0xa6')]||'')};if(_0x45dcae[_0x9e69('0x5f')][_0x9e69('0xb0')]&&_0x45dcae[_0x9e69('0x5f')][_0x9e69('0xb7')]&&_0x45dcae[_0x9e69('0x5f')][_0x9e69('0xb0')]!=_0x45dcae[_0x9e69('0x5f')]['messageId']){_0x2c7f9a['threadId']=_0x45dcae['body'][_0x9e69('0xb7')];}return _0x44931f['update'](_0x2c7f9a);}else{return _0x44931f;}}})['then'](function(_0x4875cc){_0xf719ce[_0x9e69('0xb4')]=_0x4875cc[_0x9e69('0x34')]({'plain':!![]});_0xf719ce[_0x9e69('0xb4')][_0x9e69('0xb8')]=_0x39765a;if(_0xf719ce[_0x9e69('0xb4')][_0x9e69('0xb8')]){if(_0xf719ce['account'][_0x9e69('0xb9')]){_0xf719ce[_0x9e69('0x9a')][_0x9e69('0xba')]({'id':0x0,'priority':_0xf719ce[_0x9e69('0x9a')][_0x9e69('0x49')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x9e69('0xbb')});}}return db[_0x9e69('0xbc')]['create']({'body':_0x45dcae[_0x9e69('0x5f')][_0x9e69('0x5f')],'ChatWebsiteId':_0x45dcae[_0x9e69('0x57')]['id'],'ChatInteractionId':_0x4875cc['id'],'direction':'in','ContactId':_0xf719ce[_0x9e69('0xb6')]['id'],'AttachmentId':_0x45dcae['body'][_0x9e69('0xbd')]});})[_0x9e69('0x1e')](function(_0x52abee){_0xf719ce['message']=_0x52abee;if(_0xf719ce[_0x9e69('0xb4')][_0x9e69('0xbe')]){return db['User'][_0x9e69('0x58')]({'attributes':['id','name'],'where':{'id':_0xf719ce[_0x9e69('0xb4')][_0x9e69('0xbe')]}})[_0x9e69('0x1e')](function(_0x22014a){if(_0x22014a){_0xf719ce[_0x9e69('0x9a')][_0x9e69('0xbf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x22014a[_0x9e69('0x38')]+','+(_0xf719ce[_0x9e69('0x99')][_0x9e69('0xc0')]||0xa),'interval':_0x9e69('0xbb')});_0xf719ce[_0x9e69('0xc1')]=!![];}return respondWithRpcPromise('Start',_0x9e69('0xc2'),_0xf719ce);});}return respondWithRpcPromise('Start',_0x9e69('0xc2'),_0xf719ce);})[_0x9e69('0x1e')](function(_0x14570f){respondWithRpcPromise(_0x9e69('0xc3'),_0x9e69('0xc3'),{'event':'notify','message':_0x14570f},client9002);return _0x14570f;})['then'](respondWithResult(_0x34db78,null))[_0x9e69('0x28')](handleError(_0x34db78,null));};exports[_0x9e69('0xc4')]=function(_0x568073,_0x1ca077,_0x52cb10){var _0x22bb24,_0x19c67a,_0x1f2c98;var _0x528820=[];var _0x45abd5=[];var _0x33efb9={};return db[_0x9e69('0x89')][_0x9e69('0x61')]()[_0x9e69('0x1e')](function(_0x422856){if(!_0x422856){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x45abd5=_[_0x9e69('0x8d')](_['keys'](_0x422856),[_0x9e69('0x8b'),'updatedAt']);_0x528820=_[_0x9e69('0x8d')](_['keys'](_0x422856),[_0x9e69('0x8b'),_0x9e69('0x8c'),_0x9e69('0x8e'),_0x9e69('0x8f')]);if(_0x568073[_0x9e69('0x5f')]['id']){delete _0x568073[_0x9e69('0x5f')]['id'];}if(_[_0x9e69('0x7d')](_0x568073['body'][_0x9e69('0x90')])){throw _0x1ca077[_0x9e69('0x2e')](0x1f4)['send'](new db[(_0x9e69('0x1b'))][(_0x9e69('0x1c'))](_0x9e69('0x91')));}if(_[_0x9e69('0x7d')](_0x568073[_0x9e69('0x5f')][_0x9e69('0x5f')])||_0x568073[_0x9e69('0x5f')][_0x9e69('0x5f')]===''){throw _0x1ca077[_0x9e69('0x2e')](0x1f4)[_0x9e69('0x39')](new db[(_0x9e69('0x1b'))][(_0x9e69('0x1c'))](_0x9e69('0x92')));}if(_[_0x9e69('0x7d')](_0x568073[_0x9e69('0x5f')][_0x9e69('0xc5')])){throw _0x1ca077[_0x9e69('0x2e')](0x1f4)[_0x9e69('0x39')](new db['Sequelize'][(_0x9e69('0x1c'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x528820));}if(!_['includes'](_0x528820,_0x568073['body'][_0x9e69('0xc5')])){throw _0x1ca077[_0x9e69('0x2e')](0x1f4)['send'](new db[(_0x9e69('0x1b'))][(_0x9e69('0x1c'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x528820));}_0x33efb9[_0x568073['body'][_0x9e69('0xc5')]]=_0x568073[_0x9e69('0x5f')][_0x9e69('0x90')];})[_0x9e69('0x1e')](function(){return db['ChatWebsite'][_0x9e69('0x58')]({'where':{'id':_0x568073['params']['id']},'include':[{'model':db[_0x9e69('0x96')],'as':_0x9e69('0x97')}]});})[_0x9e69('0x1e')](handleEntityNotFound(_0x1ca077,null))['then'](function(_0x5dfe64){if(_0x5dfe64&&_0x5dfe64[_0x9e69('0x97')]){_0x19c67a=_0x5dfe64;var _0x59d78e=_[_0x9e69('0x13')](_0x568073[_0x9e69('0x5f')],{'firstName':_0x568073[_0x9e69('0x5f')][_0x9e69('0x90')],'phone':_0x568073[_0x9e69('0x5f')][_0x9e69('0x90')],'ListId':_0x5dfe64['ListId']});_0x59d78e[_0x568073[_0x9e69('0x5f')][_0x9e69('0xc5')]]=_0x568073[_0x9e69('0x5f')][_0x9e69('0x90')];return db[_0x9e69('0x89')]['findOrCreate']({'where':_0x33efb9,'defaults':_0x59d78e});}})[_0x9e69('0xb5')](function(_0x3acf01){if(_0x3acf01){_0x1f2c98=_0x3acf01;var _0x3a6a41=fs[_0x9e69('0xc6')](path[_0x9e69('0x79')](config[_0x9e69('0x7a')],_0x9e69('0xc7')),_0x9e69('0xc8'));var _0x55d377=ejs[_0x9e69('0xc9')](_0x3a6a41,{'body':_[_0x9e69('0xca')](_0x568073[_0x9e69('0x5f')][_0x9e69('0x5f')]),'bodyTitle':_0x19c67a['offlineMessageBody']});return db[_0x9e69('0xcb')][_0x9e69('0x59')]({'body':_0x55d377,'ContactId':_0x3acf01['id'],'ChatWebsiteId':_0x19c67a['id']});}})['then'](function(_0x35b2ed){if(_0x35b2ed){_0x22bb24=_0x35b2ed;return db[_0x9e69('0xcc')][_0x9e69('0x65')]({'where':{'service':!![]},'include':[{'model':db[_0x9e69('0xcd')],'as':_0x9e69('0xce'),'raw':!![]}]});}})[_0x9e69('0x1e')](function(_0x596a16){if(_0x596a16&&_0x596a16['Smtp']&&_0x19c67a[_0x9e69('0xcf')]){var _0x4b97ad={'tls':{'rejectUnauthorized':![]}};if(_0x596a16[_0x9e69('0xce')][_0x9e69('0xd0')]){_0x4b97ad[_0x9e69('0xd0')]=_0x596a16[_0x9e69('0xce')][_0x9e69('0xd0')];}else{_0x4b97ad[_0x9e69('0xd1')]=_0x596a16[_0x9e69('0xce')][_0x9e69('0xd1')];_0x4b97ad['port']=_0x596a16[_0x9e69('0xce')][_0x9e69('0xd2')];_0x4b97ad['secure']=_0x596a16[_0x9e69('0xce')]['secure'];}if(_0x596a16[_0x9e69('0xce')][_0x9e69('0xd3')]){_0x4b97ad[_0x9e69('0xd4')]={'user':_0x596a16[_0x9e69('0xce')][_0x9e69('0x5a')],'pass':_0x596a16[_0x9e69('0xce')][_0x9e69('0xd5')]};}return respondWithRpcPromise(_0x9e69('0xd6'),_0x9e69('0xd7'),{'account':_0x4b97ad,'message':{'from':util[_0x9e69('0xaa')]('\x22%s\x22\x20<%s>',_0x596a16[_0x9e69('0x38')],_0x596a16[_0x9e69('0xd8')]||_0x596a16['Smtp'][_0x9e69('0x5a')]),'to':_0x19c67a['forwardOfflineAddress'],'subject':_0x19c67a[_0x9e69('0xd9')],'text':_0x22bb24[_0x9e69('0x5f')]}},client9003)['then'](function(){return _0x22bb24;})[_0x9e69('0x28')](function(_0x1e9ea4){console[_0x9e69('0x25')](_0x1e9ea4);});}})['then'](function(){if(_0x22bb24){return _0x22bb24;}})[_0x9e69('0x1e')](respondWithResult(_0x1ca077,null))['catch'](handleError(_0x1ca077,null));};exports[_0x9e69('0xda')]=function(_0x1ccf1b,_0x407689,_0x1bccec){return db[_0x9e69('0xb1')]['find']({'where':{'id':_0x1ccf1b['params']['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0x407689,null))[_0x9e69('0x1e')](function(_0x5a7337){if(_0x5a7337){return _0x5a7337[_0x9e69('0xda')](_0x1ccf1b[_0x9e69('0x5f')]['ids'],_[_0x9e69('0xdb')](_0x1ccf1b[_0x9e69('0x5f')],[_0x9e69('0x6a'),'id'])||{});}})[_0x9e69('0x1e')](respondWithResult(_0x407689,null))[_0x9e69('0x28')](handleError(_0x407689,null));};exports['getInteractions']=function(_0x769a4d,_0x5c78b2,_0x5e9c2d){var _0x201212={'raw':![],'where':{}};var _0x2182ff={};var _0x4a35df={'count':0x0,'rows':[]};return db[_0x9e69('0x3d')][_0x9e69('0x65')]({'where':{'id':_0x769a4d[_0x9e69('0x57')]['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0x5c78b2,null))[_0x9e69('0x1e')](function(_0x3f32e2){if(_0x3f32e2){_0x2182ff[_0x9e69('0x41')]=_[_0x9e69('0x43')](db['ChatInteraction'][_0x9e69('0x6e')]);_0x2182ff[_0x9e69('0x44')]=_[_0x9e69('0x43')](_0x769a4d[_0x9e69('0x44')]);_0x2182ff[_0x9e69('0x45')]=_[_0x9e69('0x46')](_0x2182ff[_0x9e69('0x41')],_0x2182ff[_0x9e69('0x44')]);_0x201212[_0x9e69('0x47')]=_[_0x9e69('0x46')](_0x2182ff[_0x9e69('0x41')],qs['fields'](_0x769a4d['query'][_0x9e69('0x48')]));_0x201212[_0x9e69('0x47')]=_0x201212[_0x9e69('0x47')][_0x9e69('0x49')]?_0x201212[_0x9e69('0x47')]:_0x2182ff['model'];if(!_0x769a4d[_0x9e69('0x44')][_0x9e69('0x66')](_0x9e69('0x4a'))){_0x201212[_0x9e69('0x4b')]=qs['limit'](_0x769a4d['query'][_0x9e69('0x4b')]);_0x201212[_0x9e69('0x2d')]=qs[_0x9e69('0x2d')](_0x769a4d[_0x9e69('0x44')]['offset']);}_0x201212[_0x9e69('0x4c')]=qs['sort'](_0x769a4d[_0x9e69('0x44')][_0x9e69('0x4d')]);_0x201212[_0x9e69('0x4e')]=qs[_0x9e69('0x45')](_[_0x9e69('0x4f')](_0x769a4d[_0x9e69('0x44')],_0x2182ff[_0x9e69('0x45')]));_0x201212[_0x9e69('0x4e')][_0x9e69('0x67')]=_0x3f32e2['id'];if(_0x769a4d['query'][_0x9e69('0x50')]){_0x201212['where']=_[_0x9e69('0x51')](_0x201212[_0x9e69('0x4e')],{'$or':_[_0x9e69('0x42')](_0x201212[_0x9e69('0x47')],function(_0x24321f){var _0xe9b122={};_0xe9b122[_0x24321f]={'$like':'%'+_0x769a4d[_0x9e69('0x44')]['filter']+'%'};return _0xe9b122;})});}_0x201212=_['merge']({},_0x201212,_0x769a4d[_0x9e69('0x53')]);return db['ChatInteraction'][_0x9e69('0x2c')]({'where':_0x201212['where']})[_0x9e69('0x1e')](function(_0x537078){_0x4a35df['count']=_0x537078;if(_0x769a4d['query'][_0x9e69('0x54')]){_0x201212['include']=[{'model':db['CmContact'],'as':_0x9e69('0xdc'),'required':![]},{'model':db[_0x9e69('0xdd')],'as':_0x9e69('0xde'),'attributes':[_0x9e69('0x38'),_0x9e69('0xdf'),'internal'],'required':![]},{'model':db[_0x9e69('0xe0')],'as':_0x9e69('0xe1'),'attributes':['id','name',_0x9e69('0xe2')],'where':_0x769a4d[_0x9e69('0x44')]['tag']?{'id':_0x769a4d[_0x9e69('0x44')][_0x9e69('0xe3')]}:undefined,'required':_0x769a4d['query']['tag']?!![]:![]}];}return db[_0x9e69('0xb1')][_0x9e69('0x68')](_0x201212);})[_0x9e69('0x1e')](function(_0x25557b){_0x4a35df[_0x9e69('0x56')]=_0x25557b;return _0x4a35df;});}})[_0x9e69('0x1e')](respondWithFilteredResult(_0x5c78b2,_0x201212))['catch'](handleError(_0x5c78b2,null));};function iftimePromise(_0x10cc75,_0x664557){return respondWithRpcPromise(_0x9e69('0xe4'),_0x9e69('0xe5'),{'command':_0x664557[_0x9e69('0xe6')]?util[_0x9e69('0xaa')]('iftime\x20%s,%s',_0x10cc75[_0x9e69('0xe7')],_0x664557[_0x9e69('0xe6')]):util[_0x9e69('0xaa')]('iftime\x20%s',_0x10cc75[_0x9e69('0xe7')])},client9002)[_0x9e69('0x1e')](function(_0x4dafc3){var _0x27d060=_0x4dafc3&&_0x4dafc3[_0x9e69('0xe8')](_0x9e69('0xe9'))>=0x0?!![]:![];logger[_0x9e69('0x1f')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x664557['id'],_0x10cc75['id'],_0x10cc75[_0x9e69('0xe7')],_0x27d060?_0x9e69('0xea'):'OFFLINE',_0x664557[_0x9e69('0xe6')]?_0x664557[_0x9e69('0xe6')]:_0x9e69('0xeb'));return _0x27d060;})[_0x9e69('0x28')](function(_0x7d3ae5){logger[_0x9e69('0x25')](_0x9e69('0xec'),_0x664557['id'],_0x10cc75['id'],_0x10cc75[_0x9e69('0xe7')],util[_0x9e69('0xed')](_0x7d3ae5,{'showHidden':![],'depth':null}),_0x664557['timezone']?_0x664557[_0x9e69('0xe6')]:_0x9e69('0xeb'));return![];});}exports[_0x9e69('0xe5')]=function(_0x1377a4,_0x57bb87,_0x3b9eb4){var _0x446b1a=0x0;var _0x3d1ee8=0x0;var _0x38bedb=![];var _0x54ebf9;var _0x7e435d;return db['ChatWebsite'][_0x9e69('0x58')]({'where':{'id':_0x1377a4['params']['id']},'include':[{'model':db[_0x9e69('0xee')],'as':'Interval','include':[{'model':db[_0x9e69('0xee')],'as':_0x9e69('0xef'),'attributes':['id',_0x9e69('0xe7')],'raw':!![]}]}]})[_0x9e69('0x1e')](handleEntityNotFound(_0x57bb87,null))['then'](function(_0x598683){if(_0x598683){_0x54ebf9=_0x598683;return _0x598683['getProactiveActions']({'raw':!![]});}})['then'](function(_0x76d4f){if(_0x54ebf9){if(_0x76d4f){_0x7e435d=_0x76d4f;}}return require('../../config/license/util')[_0x9e69('0x7b')]();})['then'](function(_0x3b99cd){if(_0x3b99cd){_0x3d1ee8=_0x3b99cd[_0x9e69('0xf0')];_0x38bedb=_0x3b99cd[_0x9e69('0x7c')];}})[_0x9e69('0x1e')](function(){return db[_0x9e69('0xb1')]['count']({'where':{'closed':![]}});})['then'](function(_0x32cdac){_0x446b1a=_0x32cdac;if(_0x3d1ee8&&_0x32cdac>_0x3d1ee8){return db[_0x9e69('0xf1')]['findOne']({'where':{'id':0x1}})[_0x9e69('0x1e')](function(_0x239d46){if(_0x239d46){_0x239d46[_0x9e69('0xf2')](_0x9e69('0xf3'));}});}})['then'](function(){if(_0x54ebf9[_0x9e69('0xee')]&&_0x54ebf9[_0x9e69('0xee')][_0x9e69('0xef')]){var _0xf34ca1=[];for(var _0x565d46=0x0;_0x565d46<_0x54ebf9[_0x9e69('0xee')][_0x9e69('0xef')]['length'];_0x565d46++){var _0x4d0c76=_0x54ebf9['Interval']['Intervals'][_0x565d46]['get']({'plain':!![]});_0xf34ca1[_0x9e69('0xba')](iftimePromise(_0x4d0c76,_0x54ebf9));}return BPromise[_0x9e69('0xf4')](_0xf34ca1)['then'](function(_0x4cb671){return _[_0x9e69('0xf5')](_0x4cb671);});}else{return!![];}})['then'](function(_0x27fb70){var _0x1058ea=fs[_0x9e69('0xc6')](path[_0x9e69('0x79')](config['root'],'server/files/chat/iframe.js'),_0x9e69('0xc8'));var _0x29758d={'remote':_0x54ebf9[_0x9e69('0xf6')],'query':querystring[_0x9e69('0x24')](_[_0x9e69('0x51')](_0x54ebf9[_0x9e69('0x34')]({'plain':!![]}),{'customerIp':_0x1377a4[_0x9e69('0x87')][_0x9e69('0xa4')]||_0x1377a4[_0x9e69('0x87')][_0x9e69('0xf7')]||_0x1377a4['connection'][_0x9e69('0xf8')]||_0x1377a4['ip'],'referer':_0x1377a4[_0x9e69('0x87')][_0x9e69('0xa8')],'openedInteractions':_0x446b1a,'maxInteractions':_0x3d1ee8,'virtual':_0x38bedb[_0x9e69('0xf0')],'online':_0x27fb70,'custom':_0x38bedb}))[_0x9e69('0xf9')](/'/g,'\x5c\x27')};_0x57bb87[_0x9e69('0x39')](ejs[_0x9e69('0xc9')](Mustache[_0x9e69('0xc9')](_0x1058ea,_0x29758d),{'proactiveActions':_0x7e435d,'alignment':_0x54ebf9[_0x9e69('0xfa')],'verticalAlignment':_0x54ebf9[_0x9e69('0xfb')],'div_color':_0x54ebf9[_0x9e69('0xe2')],'text_color':_0x54ebf9[_0x9e69('0xfc')]}));})['catch'](handleError(_0x57bb87,null));};exports[_0x9e69('0xfd')]=function(_0x144d9e,_0x1b1627,_0x22ccf4){return db[_0x9e69('0x3d')][_0x9e69('0x65')]({'where':{'id':_0x144d9e['params']['id']}})['then'](handleEntityNotFound(_0x1b1627,null))[_0x9e69('0x1e')](function(_0x40e755){if(_0x40e755){return db[_0x9e69('0xfe')]['transaction'](function(_0x1377cb){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x144d9e['params']['id']},'transaction':_0x1377cb})[_0x9e69('0x1e')](function(_0x1eb939){var _0x4be40e=_[_0x9e69('0x42')](_0x144d9e[_0x9e69('0x5f')],function(_0x2c3ce2){_0x2c3ce2[_0x9e69('0x67')]=_0x144d9e[_0x9e69('0x57')]['id'];return _0x2c3ce2;});return db['ChatApplication'][_0x9e69('0xff')](_0x4be40e,{'transaction':_0x1377cb});});})[_0x9e69('0x1e')](function(){return db[_0x9e69('0x100')][_0x9e69('0x101')]({'where':{'ChatWebsiteId':_0x144d9e[_0x9e69('0x57')]['id']},'order':_0x9e69('0x9e')});});}})['then'](respondWithResult(_0x1b1627,null))[_0x9e69('0x28')](handleError(_0x1b1627,null));};exports['getApplications']=function(_0x42224a,_0x3a6950,_0xc22450){var _0x401b04={};var _0x3e70a7={};var _0x4675df;var _0x1dbd38;return db[_0x9e69('0x3d')][_0x9e69('0x65')]({'where':{'id':_0x42224a[_0x9e69('0x57')]['id']}})['then'](handleEntityNotFound(_0x3a6950,null))['then'](function(_0x492b8c){if(_0x492b8c){_0x4675df=_0x492b8c;_0x3e70a7['model']=_[_0x9e69('0x43')](db[_0x9e69('0x100')][_0x9e69('0x6e')]);_0x3e70a7[_0x9e69('0x44')]=_[_0x9e69('0x43')](_0x42224a[_0x9e69('0x44')]);_0x3e70a7[_0x9e69('0x45')]=_[_0x9e69('0x46')](_0x3e70a7['model'],_0x3e70a7['query']);_0x401b04['attributes']=_[_0x9e69('0x46')](_0x3e70a7[_0x9e69('0x41')],qs['fields'](_0x42224a[_0x9e69('0x44')][_0x9e69('0x48')]));_0x401b04[_0x9e69('0x47')]=_0x401b04[_0x9e69('0x47')]['length']?_0x401b04['attributes']:_0x3e70a7[_0x9e69('0x41')];_0x401b04[_0x9e69('0x4c')]=qs[_0x9e69('0x4d')](_0x42224a['query'][_0x9e69('0x4d')]);_0x401b04['where']=qs[_0x9e69('0x45')](_['pick'](_0x42224a[_0x9e69('0x44')],_0x3e70a7[_0x9e69('0x45')]));if(_0x42224a[_0x9e69('0x44')][_0x9e69('0x50')]){_0x401b04[_0x9e69('0x4e')]=_['merge'](_0x401b04['where'],{'$or':_[_0x9e69('0x42')](_0x401b04[_0x9e69('0x47')],function(_0x59ab31){var _0x3a7853={};_0x3a7853[_0x59ab31]={'$like':'%'+_0x42224a[_0x9e69('0x44')][_0x9e69('0x50')]+'%'};return _0x3a7853;})});}_0x401b04=_[_0x9e69('0x51')]({},_0x401b04,_0x42224a[_0x9e69('0x53')]);return _0x4675df['getApplications'](_0x401b04);}})['then'](function(_0x1c6567){if(_0x1c6567){_0x1dbd38=_0x1c6567[_0x9e69('0x49')];if(!_0x42224a[_0x9e69('0x44')][_0x9e69('0x66')](_0x9e69('0x4a'))){_0x401b04[_0x9e69('0x4b')]=qs['limit'](_0x42224a['query'][_0x9e69('0x4b')]);_0x401b04[_0x9e69('0x2d')]=qs[_0x9e69('0x2d')](_0x42224a['query'][_0x9e69('0x2d')]);}return _0x4675df[_0x9e69('0x102')](_0x401b04);}})[_0x9e69('0x1e')](function(_0x5a6a08){if(_0x5a6a08){return _0x5a6a08?{'count':_0x1dbd38,'rows':_0x5a6a08}:null;}})[_0x9e69('0x1e')](respondWithResult(_0x3a6950,null))[_0x9e69('0x28')](handleError(_0x3a6950,null));};exports[_0x9e69('0x103')]=function(_0x5d9c0d,_0xdc1e9f,_0x330c77){return db['chatProactiveAction'][_0x9e69('0x58')]({'where':{'id':_0x5d9c0d[_0x9e69('0x57')]['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0xdc1e9f,null))[_0x9e69('0x1e')](function(_0xb967d6){if(_0xb967d6){return _0xb967d6[_0x9e69('0x103')](_0x5d9c0d[_0x9e69('0x5f')]['ids'],_[_0x9e69('0xdb')](_0x5d9c0d[_0x9e69('0x5f')],[_0x9e69('0x6a'),'id'])||{});}})[_0x9e69('0x1e')](respondWithResult(_0xdc1e9f,null))[_0x9e69('0x28')](handleError(_0xdc1e9f,null));};exports[_0x9e69('0x104')]=function(_0x1ad23e,_0x5744a8,_0x3497bf){var _0xa813ce={};var _0xa0d0cb={};var _0x43ddda;var _0x1f82df;return db[_0x9e69('0x3d')][_0x9e69('0x65')]({'where':{'id':_0x1ad23e[_0x9e69('0x57')]['id']}})['then'](handleEntityNotFound(_0x5744a8,null))[_0x9e69('0x1e')](function(_0x339c35){if(_0x339c35){_0x43ddda=_0x339c35;_0xa0d0cb['model']=_['keys'](db[_0x9e69('0x105')][_0x9e69('0x6e')]);_0xa0d0cb[_0x9e69('0x44')]=_[_0x9e69('0x43')](_0x1ad23e[_0x9e69('0x44')]);_0xa0d0cb[_0x9e69('0x45')]=_[_0x9e69('0x46')](_0xa0d0cb[_0x9e69('0x41')],_0xa0d0cb[_0x9e69('0x44')]);_0xa813ce[_0x9e69('0x47')]=_[_0x9e69('0x46')](_0xa0d0cb[_0x9e69('0x41')],qs[_0x9e69('0x48')](_0x1ad23e['query']['fields']));_0xa813ce[_0x9e69('0x47')]=_0xa813ce[_0x9e69('0x47')]['length']?_0xa813ce[_0x9e69('0x47')]:_0xa0d0cb[_0x9e69('0x41')];_0xa813ce['order']=qs[_0x9e69('0x4d')](_0x1ad23e[_0x9e69('0x44')][_0x9e69('0x4d')]);_0xa813ce[_0x9e69('0x4e')]=qs[_0x9e69('0x45')](_['pick'](_0x1ad23e[_0x9e69('0x44')],_0xa0d0cb['filters']));if(_0x1ad23e[_0x9e69('0x44')]['filter']){_0xa813ce[_0x9e69('0x4e')]=_[_0x9e69('0x51')](_0xa813ce['where'],{'$or':_[_0x9e69('0x42')](_0xa813ce[_0x9e69('0x47')],function(_0x450518){var _0x3b36a4={};_0x3b36a4[_0x450518]={'$like':'%'+_0x1ad23e[_0x9e69('0x44')][_0x9e69('0x50')]+'%'};return _0x3b36a4;})});}_0xa813ce=_[_0x9e69('0x51')]({},_0xa813ce,_0x1ad23e[_0x9e69('0x53')]);return _0x43ddda[_0x9e69('0x104')](_0xa813ce);}})[_0x9e69('0x1e')](function(_0x2a2a61){if(_0x2a2a61){_0x1f82df=_0x2a2a61['length'];if(!_0x1ad23e[_0x9e69('0x44')]['hasOwnProperty'](_0x9e69('0x4a'))){_0xa813ce[_0x9e69('0x4b')]=qs[_0x9e69('0x4b')](_0x1ad23e['query']['limit']);_0xa813ce[_0x9e69('0x2d')]=qs[_0x9e69('0x2d')](_0x1ad23e['query']['offset']);}return _0x43ddda[_0x9e69('0x104')](_0xa813ce);}})[_0x9e69('0x1e')](function(_0x3e5f51){if(_0x3e5f51){return _0x3e5f51?{'count':_0x1f82df,'rows':_0x3e5f51}:null;}})[_0x9e69('0x1e')](respondWithResult(_0x5744a8,null))[_0x9e69('0x28')](handleError(_0x5744a8,null));};exports[_0x9e69('0x106')]=function(_0x4451cb,_0x3a725b,_0x45d65d){var _0x2c797c=_0x4451cb['query'][_0x9e69('0x107')]===_0x9e69('0x108')?'offlineForm':_0x9e69('0x109');return db[_0x9e69('0x3d')][_0x9e69('0x58')]({'attributes':['id',_0x2c797c],'where':{'id':_0x4451cb[_0x9e69('0x57')]['id']}})[_0x9e69('0x1e')](handleEntityNotFound(_0x3a725b,null))[_0x9e69('0x1e')](function(_0x52f047){if(_0x52f047){var _0x335e27=_0x52f047[_0x2c797c];var _0x41f762=_0x335e27&&_0x335e27[_0x9e69('0x10a')]?_0x335e27[_0x9e69('0x10a')]:[];_0x3a725b[_0x9e69('0x39')]({'fromKey':_[_0x9e69('0x7d')](_0x335e27['fromKey'])?undefined:_0x335e27[_0x9e69('0x10b')],'count':_0x41f762[_0x9e69('0x49')],'rows':_0x41f762});}})[_0x9e69('0x28')](handleError(_0x3a725b,null));};exports[_0x9e69('0x10c')]=function(_0x39005d,_0x3c902e,_0x2041f8){var _0x5a9faa={'raw':![],'where':{}};var _0x30f818={};var _0x3d2a80={'count':0x0,'rows':[]};return db[_0x9e69('0x3d')][_0x9e69('0x65')]({'where':{'id':_0x39005d['params']['id']}})['then'](handleEntityNotFound(_0x3c902e,null))['then'](function(_0x4a81d7){if(_0x4a81d7){_0x30f818[_0x9e69('0x41')]=_['keys'](db['ChatOfflineMessage'][_0x9e69('0x6e')]);_0x30f818[_0x9e69('0x44')]=_[_0x9e69('0x43')](_0x39005d[_0x9e69('0x44')]);_0x30f818[_0x9e69('0x45')]=_[_0x9e69('0x46')](_0x30f818[_0x9e69('0x41')],_0x30f818['query']);_0x5a9faa[_0x9e69('0x47')]=_[_0x9e69('0x46')](_0x30f818[_0x9e69('0x41')],qs[_0x9e69('0x48')](_0x39005d[_0x9e69('0x44')][_0x9e69('0x48')]));_0x5a9faa['attributes']=_0x5a9faa['attributes'][_0x9e69('0x49')]?_0x5a9faa[_0x9e69('0x47')]:_0x30f818['model'];if(!_0x39005d[_0x9e69('0x44')][_0x9e69('0x66')](_0x9e69('0x4a'))){_0x5a9faa[_0x9e69('0x4b')]=qs[_0x9e69('0x4b')](_0x39005d['query'][_0x9e69('0x4b')]);_0x5a9faa[_0x9e69('0x2d')]=qs[_0x9e69('0x2d')](_0x39005d[_0x9e69('0x44')]['offset']);}_0x5a9faa[_0x9e69('0x4c')]=qs['sort'](_0x39005d['query'][_0x9e69('0x4d')]);_0x5a9faa[_0x9e69('0x4e')]=qs[_0x9e69('0x45')](_['pick'](_0x39005d[_0x9e69('0x44')],_0x30f818[_0x9e69('0x45')]));_0x5a9faa[_0x9e69('0x4e')][_0x9e69('0x67')]=_0x4a81d7['id'];if(_0x39005d['query'][_0x9e69('0x50')]){_0x5a9faa['where']=_['merge'](_0x5a9faa[_0x9e69('0x4e')],{'$or':_[_0x9e69('0x42')](_0x5a9faa[_0x9e69('0x47')],function(_0x351094){var _0x2c06b2={};_0x2c06b2[_0x351094]={'$like':'%'+_0x39005d[_0x9e69('0x44')][_0x9e69('0x50')]+'%'};return _0x2c06b2;})});}_0x5a9faa=_[_0x9e69('0x51')]({},_0x5a9faa,_0x39005d['options']);return db[_0x9e69('0xcb')][_0x9e69('0x2c')]({'where':_0x5a9faa[_0x9e69('0x4e')]})['then'](function(_0x5c22a6){_0x3d2a80[_0x9e69('0x2c')]=_0x5c22a6;if(_0x39005d[_0x9e69('0x44')][_0x9e69('0x54')]){_0x5a9faa['include']=[{'all':!![]}];}else{_0x5a9faa[_0x9e69('0x55')]=[{'model':db[_0x9e69('0x89')],'as':'Contact','required':![]}];}return db[_0x9e69('0xcb')][_0x9e69('0x68')](_0x5a9faa);})[_0x9e69('0x1e')](function(_0x4965dc){_0x3d2a80[_0x9e69('0x56')]=_0x4965dc;return _0x3d2a80;});}})['then'](respondWithFilteredResult(_0x3c902e,_0x5a9faa))[_0x9e69('0x28')](handleError(_0x3c902e,null));};exports['addAgents']=function(_0x28cc6f,_0x238447,_0x30ff09){return db[_0x9e69('0x3d')][_0x9e69('0x58')]({'where':{'id':_0x28cc6f[_0x9e69('0x57')]['id']}})['then'](handleEntityNotFound(_0x238447,null))[_0x9e69('0x1e')](function(_0x595534){if(_0x595534){return _0x595534['addAgents'](_0x28cc6f['body'][_0x9e69('0x6a')],_[_0x9e69('0xdb')](_0x28cc6f[_0x9e69('0x5f')],['ids','id'])||{})['spread'](function(_0x18f1cf){for(var _0x432b98=0x0;_0x432b98<_0x28cc6f[_0x9e69('0x5f')]['ids'][_0x9e69('0x49')];_0x432b98+=0x1){socket[_0x9e69('0x10d')](_0x9e69('0x10e'),{'UserId':_0x28cc6f[_0x9e69('0x5f')][_0x9e69('0x6a')][_0x432b98],'ChatWebsiteId':_0x28cc6f['params']['id']});}return _0x18f1cf;});}})['then'](respondWithResult(_0x238447,null))[_0x9e69('0x28')](handleError(_0x238447,null));};exports[_0x9e69('0x10f')]=function(_0x26b7d6,_0x24c687,_0x58cf11){return db[_0x9e69('0x3d')]['find']({'where':{'id':_0x26b7d6['params']['id']}})['then'](handleEntityNotFound(_0x24c687,null))[_0x9e69('0x1e')](function(_0xa3f6ae){if(_0xa3f6ae){return _0xa3f6ae[_0x9e69('0x10f')](_0x26b7d6['query']['ids'])['then'](function(){if(_[_0x9e69('0x110')](_0x26b7d6[_0x9e69('0x44')][_0x9e69('0x6a')])){for(var _0x38ba1b=0x0;_0x38ba1b<_0x26b7d6[_0x9e69('0x44')][_0x9e69('0x6a')]['length'];_0x38ba1b+=0x1){socket[_0x9e69('0x10d')]('userChatWebsite:remove',{'UserId':Number(_0x26b7d6[_0x9e69('0x44')][_0x9e69('0x6a')][_0x38ba1b]),'ChatWebsiteId':Number(_0x26b7d6[_0x9e69('0x57')]['id'])});}}else{socket['emit'](_0x9e69('0x111'),{'UserId':Number(_0x26b7d6['query'][_0x9e69('0x6a')]),'ChatWebsiteId':Number(_0x26b7d6['params']['id'])});}});}})[_0x9e69('0x1e')](respondWithStatusCode(_0x24c687,null))[_0x9e69('0x28')](handleError(_0x24c687,null));};exports[_0x9e69('0x112')]=function(_0xc2f3ca,_0x1b2aab,_0x6247e0){var _0x5c38ad={};var _0x435956={};var _0x1e6154;var _0x5a2ec8;return db[_0x9e69('0x3d')][_0x9e69('0x65')]({'where':{'id':_0xc2f3ca[_0x9e69('0x57')]['id']}})['then'](handleEntityNotFound(_0x1b2aab,null))[_0x9e69('0x1e')](function(_0x5646c8){if(_0x5646c8){_0x1e6154=_0x5646c8;_0x435956[_0x9e69('0x41')]=_[_0x9e69('0x43')](db[_0x9e69('0xdd')][_0x9e69('0x6e')]);_0x435956['query']=_[_0x9e69('0x43')](_0xc2f3ca[_0x9e69('0x44')]);_0x435956['filters']=_['intersection'](_0x435956[_0x9e69('0x41')],_0x435956[_0x9e69('0x44')]);_0x5c38ad[_0x9e69('0x47')]=_['intersection'](_0x435956['model'],qs[_0x9e69('0x48')](_0xc2f3ca[_0x9e69('0x44')][_0x9e69('0x48')]));_0x5c38ad['attributes']=_0x5c38ad['attributes']['length']?_0x5c38ad[_0x9e69('0x47')]:_0x435956[_0x9e69('0x41')];_0x5c38ad['order']=qs[_0x9e69('0x4d')](_0xc2f3ca[_0x9e69('0x44')][_0x9e69('0x4d')]);_0x5c38ad['where']=qs[_0x9e69('0x45')](_[_0x9e69('0x4f')](_0xc2f3ca[_0x9e69('0x44')],_0x435956['filters']));if(_0xc2f3ca[_0x9e69('0x44')][_0x9e69('0x50')]){_0x5c38ad[_0x9e69('0x4e')]=_[_0x9e69('0x51')](_0x5c38ad[_0x9e69('0x4e')],{'$or':_[_0x9e69('0x42')](_0x5c38ad[_0x9e69('0x47')],function(_0xbb6741){var _0x3564f3={};_0x3564f3[_0xbb6741]={'$like':'%'+_0xc2f3ca[_0x9e69('0x44')][_0x9e69('0x50')]+'%'};return _0x3564f3;})});}_0x5c38ad=_['merge']({},_0x5c38ad,_0xc2f3ca[_0x9e69('0x53')]);return _0x1e6154['getAgents'](_0x5c38ad);}})[_0x9e69('0x1e')](function(_0x403a8b){if(_0x403a8b){_0x5a2ec8=_0x403a8b[_0x9e69('0x49')];if(!_0xc2f3ca['query'][_0x9e69('0x66')](_0x9e69('0x4a'))){_0x5c38ad[_0x9e69('0x4b')]=qs[_0x9e69('0x4b')](_0xc2f3ca[_0x9e69('0x44')][_0x9e69('0x4b')]);_0x5c38ad[_0x9e69('0x2d')]=qs[_0x9e69('0x2d')](_0xc2f3ca[_0x9e69('0x44')][_0x9e69('0x2d')]);}return _0x1e6154['getAgents'](_0x5c38ad);}})[_0x9e69('0x1e')](function(_0x5edf32){if(_0x5edf32){return _0x5edf32?{'count':_0x5a2ec8,'rows':_0x5edf32}:null;}})['then'](respondWithResult(_0x1b2aab,null))[_0x9e69('0x28')](handleError(_0x1b2aab,null));}; \ No newline at end of file +var _0xdffa=['include','rows','catch','show','mandatoryDispositionPause','keys','options','find','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','length','removeAnswers','addLogo','sitepic','filename','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.png','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','getAvatar','join','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','isNil','setUA','headers','user-agent','getResult','CmContact','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Applications','account','applications','list','orderBy','asc','Contacts','ListId','contact','first','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','autoclose','close','*,*,*,*','AttachmentId','User','UserId','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','EventManager','notify','offline','send','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','MailServerOut','forwardOfflineAddress','Smtp','service','host','port','secure','authentication','auth','user','pass','SendMail','offlineMessageSubject','addInteraction','omit','Contact','Owner','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','Interval','virtual','License','increment','chatLicenseExceeded','Intervals','push','all','some','readFileSync','remote','connection','remoteAddress','alignment','textColor','addApplications','transaction','ChatApplication','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','spread','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','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','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','ValidationError','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','offset','set','json','apply','reject','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','Pause','map','ChatWebsite','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','count','includeAll'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdffa,0xca));var _0xadff=function(_0x213dd9,_0x45789c){_0x213dd9=_0x213dd9-0x0;var _0x21b837=_0xdffa[_0x213dd9];return _0x21b837;};'use strict';var pdf=require(_0xadff('0x0'));var emlformat=require(_0xadff('0x1'));var rimraf=require(_0xadff('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xadff('0x3'));var moment=require(_0xadff('0x4'));var BPromise=require(_0xadff('0x5'));var Mustache=require(_0xadff('0x6'));var util=require(_0xadff('0x7'));var path=require(_0xadff('0x8'));var sox=require(_0xadff('0x9'));var csv=require(_0xadff('0xa'));var ejs=require(_0xadff('0xb'));var fs=require('fs');var _=require(_0xadff('0xc'));var squel=require(_0xadff('0xd'));var crypto=require(_0xadff('0xe'));var jsforce=require(_0xadff('0xf'));var deskjs=require(_0xadff('0x10'));var toCsv=require(_0xadff('0xa'));var querystring=require(_0xadff('0x11'));var Papa=require(_0xadff('0x12'));var Redis=require('ioredis');var authService=require(_0xadff('0x13'));var qs=require(_0xadff('0x14'));var as=require(_0xadff('0x15'));var hardwareService=require(_0xadff('0x16'));var logger=require(_0xadff('0x17'))('api');var utils=require(_0xadff('0x18'));var config=require('../../config/environment');var db=require(_0xadff('0x19'))['db'];config[_0xadff('0x1a')]=_[_0xadff('0x1b')](config[_0xadff('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xadff('0x1c'))(new Redis(config[_0xadff('0x1a')]));require(_0xadff('0x1d'))[_0xadff('0x1e')](socket);var jayson=require(_0xadff('0x1f'));var client=jayson[_0xadff('0x20')][_0xadff('0x21')]({'port':0x232c});var client9002=jayson[_0xadff('0x20')][_0xadff('0x21')]({'port':0x232a});var client9003=jayson['client'][_0xadff('0x21')]({'port':0x232b});function checkPasswordPattern(_0x183ee5,_0x55eca7,_0x3a2e11){if(_0x3a2e11){var _0x21c5d6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x21c5d6['test'](_0x55eca7)){return _0x183ee5;}else{throw new db['Sequelize'][(_0xadff('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 _0x183ee5;}}function respondWithRpcPromise(_0x315e47,_0x43b693,_0x2fd816,_0x4b1eaa){return new BPromise(function(_0x58ef27,_0xe97386){var _0x47387c=_0x4b1eaa||client;return _0x47387c[_0xadff('0x23')](_0x315e47,_0x2fd816)[_0xadff('0x24')](function(_0x186750){logger[_0xadff('0x25')](_0xadff('0x26'),_0x43b693,_0xadff('0x27'));logger[_0xadff('0x28')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x43b693,_0xadff('0x27'),JSON[_0xadff('0x29')](_0x186750));if(_0x186750[_0xadff('0x2a')]){if(_0x186750[_0xadff('0x2a')][_0xadff('0x2b')]===0x1f4){logger[_0xadff('0x2a')]('ChatWebsite,\x20%s,\x20%s',_0x43b693,_0x186750[_0xadff('0x2a')][_0xadff('0x2c')]);return _0xe97386(_0x186750['error']['message']);}logger[_0xadff('0x2a')](_0xadff('0x26'),_0x43b693,_0x186750[_0xadff('0x2a')]['message']);return _0x58ef27(_0x186750[_0xadff('0x2a')][_0xadff('0x2c')]);}else{logger[_0xadff('0x25')](_0xadff('0x26'),_0x43b693,_0xadff('0x27'));_0x58ef27(_0x186750[_0xadff('0x2d')][_0xadff('0x2c')]);}})['catch'](function(_0x187f8e){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x43b693,_0x187f8e);_0xe97386(_0x187f8e);});});}function respondWithStatusCode(_0x52bfb4,_0x5ce529){_0x5ce529=_0x5ce529||0xcc;return function(_0x41618a){if(_0x41618a){return _0x52bfb4['sendStatus'](_0x5ce529);}return _0x52bfb4[_0xadff('0x2e')](_0x5ce529)[_0xadff('0x2f')]();};}function respondWithResult(_0x234771,_0x178286){_0x178286=_0x178286||0xc8;return function(_0x1de2fc){if(_0x1de2fc){return _0x234771[_0xadff('0x2e')](_0x178286)['json'](_0x1de2fc);}};}function respondWithFilteredResult(_0x1acf64,_0x21e855){return function(_0x6d50f7){if(_0x6d50f7){var _0x307c63=_0x6d50f7['count'],_0x4115ce=_0x21e855['offset'],_0x720fff=_0x21e855[_0xadff('0x30')]+_0x21e855['limit'],_0x21f48b;if(_0x720fff>=_0x307c63){_0x720fff=_0x307c63;_0x21f48b=0xc8;}else{_0x21f48b=0xce;}_0x1acf64['status'](_0x21f48b);return _0x1acf64[_0xadff('0x31')]('Content-Range',_0x4115ce+'-'+_0x720fff+'/'+_0x307c63)[_0xadff('0x32')](_0x6d50f7);}return null;};}function patchUpdates(_0x4fc8b0){return function(_0xc769ad){try{jsonpatch[_0xadff('0x33')](_0xc769ad,_0x4fc8b0,!![]);}catch(_0x5a2976){return BPromise[_0xadff('0x34')](_0x5a2976);}return _0xc769ad['save']();};}function saveUpdates(_0x311e5d,_0x1c0233){return function(_0x170c39){if(_0x170c39){return _0x170c39[_0xadff('0x35')](_0x311e5d)[_0xadff('0x24')](function(_0x1c4bf1){return _0x1c4bf1;});}return null;};}function removeEntity(_0x156b23,_0x2035ca){return function(_0x2ae9a9){if(_0x2ae9a9){return _0x2ae9a9[_0xadff('0x36')]()[_0xadff('0x24')](function(){var _0x3c96e2=_0x2ae9a9[_0xadff('0x37')]({'plain':!![]});var _0x26384a=_0xadff('0x38');return db[_0xadff('0x39')]['destroy']({'where':{'type':_0x26384a,'resourceId':_0x3c96e2['id']}})['then'](function(){return _0x2ae9a9;});})[_0xadff('0x24')](function(){_0x156b23['status'](0xcc)[_0xadff('0x2f')]();});}};}function handleEntityNotFound(_0x518066,_0x1e2bcb){return function(_0x569282){if(!_0x569282){_0x518066[_0xadff('0x3a')](0x194);}return _0x569282;};}function handleError(_0x80254,_0x147a79){_0x147a79=_0x147a79||0x1f4;return function(_0x1d07c6){logger[_0xadff('0x2a')](_0x1d07c6[_0xadff('0x3b')]);if(_0x1d07c6[_0xadff('0x3c')]){delete _0x1d07c6[_0xadff('0x3c')];}_0x80254['status'](_0x147a79)['send'](_0x1d07c6);};}exports['index']=function(_0x530b4b,_0x38a695){var _0x414214={'include':[{'model':db[_0xadff('0x3d')],'as':'mandatoryDispositionPause'}]},_0x287929={},_0x40c2e5={'count':0x0,'rows':[]};var _0x14f5f8=_[_0xadff('0x3e')](db[_0xadff('0x3f')][_0xadff('0x40')],function(_0x144e59){return{'name':_0x144e59[_0xadff('0x41')],'type':_0x144e59[_0xadff('0x42')]['key']};});_0x287929[_0xadff('0x43')]=_[_0xadff('0x3e')](_0x14f5f8,_0xadff('0x3c'));_0x287929[_0xadff('0x44')]=_['keys'](_0x530b4b[_0xadff('0x44')]);_0x287929[_0xadff('0x45')]=_[_0xadff('0x46')](_0x287929['model'],_0x287929[_0xadff('0x44')]);_0x414214[_0xadff('0x47')]=_['intersection'](_0x287929[_0xadff('0x43')],qs['fields'](_0x530b4b['query'][_0xadff('0x48')]));_0x414214[_0xadff('0x47')]=_0x414214[_0xadff('0x47')]['length']?_0x414214[_0xadff('0x47')]:_0x287929[_0xadff('0x43')];if(!_0x530b4b[_0xadff('0x44')][_0xadff('0x49')]('nolimit')){_0x414214[_0xadff('0x4a')]=qs['limit'](_0x530b4b['query'][_0xadff('0x4a')]);_0x414214[_0xadff('0x30')]=qs['offset'](_0x530b4b[_0xadff('0x44')]['offset']);}_0x414214[_0xadff('0x4b')]=qs['sort'](_0x530b4b['query'][_0xadff('0x4c')]);_0x414214[_0xadff('0x4d')]=qs[_0xadff('0x45')](_['pick'](_0x530b4b[_0xadff('0x44')],_0x287929['filters']));if(_0x530b4b[_0xadff('0x44')][_0xadff('0x4e')]){_0x414214[_0xadff('0x4d')]=_['merge'](_0x414214['where'],{'$or':_['map'](_0x14f5f8,function(_0x52b7fa){if(_0x52b7fa[_0xadff('0x42')]!==_0xadff('0x4f')){var _0x266a97={};_0x266a97[_0x52b7fa['name']]={'$like':'%'+_0x530b4b[_0xadff('0x44')]['filter']+'%'};return _0x266a97;}})});}_0x414214=_[_0xadff('0x50')]({},_0x414214,_0x530b4b['options']);var _0x58b001={'where':_0x414214['where']};return db[_0xadff('0x3f')]['count'](_0x58b001)[_0xadff('0x24')](function(_0x41581e){_0x40c2e5[_0xadff('0x51')]=_0x41581e;if(_0x530b4b[_0xadff('0x44')][_0xadff('0x52')]){_0x414214[_0xadff('0x53')]=[{'all':!![]}];}return db[_0xadff('0x3f')]['findAll'](_0x414214);})['then'](function(_0x5f1a9b){_0x40c2e5[_0xadff('0x54')]=_0x5f1a9b;return _0x40c2e5;})['then'](respondWithFilteredResult(_0x38a695,_0x414214))[_0xadff('0x55')](handleError(_0x38a695,null));};exports[_0xadff('0x56')]=function(_0x3f22a6,_0x1fbac1){var _0x558cce={'raw':![],'where':{'id':_0x3f22a6['params']['id']},'include':[{'model':db[_0xadff('0x3d')],'as':_0xadff('0x57')}]},_0x3bb1e2={};_0x3bb1e2[_0xadff('0x43')]=_[_0xadff('0x58')](db[_0xadff('0x3f')][_0xadff('0x40')]);_0x3bb1e2[_0xadff('0x44')]=_[_0xadff('0x58')](_0x3f22a6[_0xadff('0x44')]);_0x3bb1e2[_0xadff('0x45')]=_['intersection'](_0x3bb1e2[_0xadff('0x43')],_0x3bb1e2[_0xadff('0x44')]);_0x558cce[_0xadff('0x47')]=_[_0xadff('0x46')](_0x3bb1e2[_0xadff('0x43')],qs[_0xadff('0x48')](_0x3f22a6[_0xadff('0x44')][_0xadff('0x48')]));_0x558cce[_0xadff('0x47')]=_0x558cce[_0xadff('0x47')]['length']?_0x558cce[_0xadff('0x47')]:_0x3bb1e2[_0xadff('0x43')];if(_0x3f22a6['query'][_0xadff('0x52')]){_0x558cce[_0xadff('0x53')]=[{'all':!![]}];}_0x558cce=_[_0xadff('0x50')]({},_0x558cce,_0x3f22a6[_0xadff('0x59')]);return db[_0xadff('0x3f')][_0xadff('0x5a')](_0x558cce)[_0xadff('0x24')](handleEntityNotFound(_0x1fbac1,null))[_0xadff('0x24')](respondWithResult(_0x1fbac1,null))[_0xadff('0x55')](handleError(_0x1fbac1,null));};exports['create']=function(_0x51679b,_0x3a128f){return db[_0xadff('0x3f')]['create'](_0x51679b['body'],{})[_0xadff('0x24')](function(_0x551d23){var _0x46b515=_0x51679b['user'][_0xadff('0x37')]({'plain':!![]});if(!_0x46b515)throw new Error(_0xadff('0x5b'));if(_0x46b515[_0xadff('0x5c')]==='user'){var _0x1fd977=_0x551d23[_0xadff('0x37')]({'plain':!![]});var _0x334419='ChatWebsites';return db[_0xadff('0x5d')][_0xadff('0x5a')]({'where':{'name':_0x334419,'userProfileId':_0x46b515[_0xadff('0x5e')]},'raw':!![]})[_0xadff('0x24')](function(_0x255a5b){if(_0x255a5b&&_0x255a5b['autoAssociation']===0x0){return db[_0xadff('0x39')][_0xadff('0x5f')]({'name':_0x1fd977[_0xadff('0x3c')],'resourceId':_0x1fd977['id'],'type':_0x255a5b['name'],'sectionId':_0x255a5b['id']},{})[_0xadff('0x24')](function(){return _0x551d23;});}else{return _0x551d23;}})[_0xadff('0x55')](function(_0x3ba379){logger[_0xadff('0x2a')](_0xadff('0x60'),_0x3ba379);throw _0x3ba379;});}return _0x551d23;})[_0xadff('0x24')](respondWithResult(_0x3a128f,0xc9))[_0xadff('0x55')](handleError(_0x3a128f,null));};exports['update']=function(_0x32ec54,_0x318238){if(_0x32ec54[_0xadff('0x61')]['id']){delete _0x32ec54['body']['id'];}return db[_0xadff('0x3f')]['find']({'where':{'id':_0x32ec54['params']['id']},'include':[{'model':db[_0xadff('0x3d')],'as':_0xadff('0x57')}]})['then'](handleEntityNotFound(_0x318238,null))[_0xadff('0x24')](saveUpdates(_0x32ec54[_0xadff('0x61')],null))['then'](respondWithResult(_0x318238,null))[_0xadff('0x55')](handleError(_0x318238,null));};exports[_0xadff('0x36')]=function(_0x4046b3,_0x4bf140){return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x4046b3[_0xadff('0x62')]['id']}})['then'](handleEntityNotFound(_0x4bf140,null))[_0xadff('0x24')](removeEntity(_0x4bf140,null))[_0xadff('0x55')](handleError(_0x4bf140,null));};exports[_0xadff('0x63')]=function(_0x4f5e7e,_0xbfb1f1){return db[_0xadff('0x3f')][_0xadff('0x63')]()[_0xadff('0x24')](respondWithResult(_0xbfb1f1,null))['catch'](handleError(_0xbfb1f1,null));};exports[_0xadff('0x64')]=function(_0x597b1a,_0x19988c,_0x366436){if(_0x597b1a[_0xadff('0x61')]['id']){delete _0x597b1a['body']['id'];}return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x597b1a['params']['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x19988c,null))[_0xadff('0x24')](function(_0x4ea869){if(_0x4ea869){_0x597b1a[_0xadff('0x61')][_0xadff('0x65')]=_0x4ea869['id'];return db[_0xadff('0x66')][_0xadff('0x5f')](_0x597b1a[_0xadff('0x61')]);}})[_0xadff('0x24')](respondWithResult(_0x19988c,null))[_0xadff('0x55')](handleError(_0x19988c,null));};exports[_0xadff('0x67')]=function(_0x4219d6,_0xb5e85,_0x48e81b){var _0x3e9d9b={'raw':![],'where':{}};var _0x3af2d2={};var _0x19d153={'count':0x0,'rows':[]};return db[_0xadff('0x3f')][_0xadff('0x68')]({'where':{'id':_0x4219d6['params']['id']}})[_0xadff('0x24')](handleEntityNotFound(_0xb5e85,null))['then'](function(_0x270698){if(_0x270698){_0x3af2d2['model']=_[_0xadff('0x58')](db[_0xadff('0x66')][_0xadff('0x40')]);_0x3af2d2['query']=_['keys'](_0x4219d6[_0xadff('0x44')]);_0x3af2d2['filters']=_[_0xadff('0x46')](_0x3af2d2[_0xadff('0x43')],_0x3af2d2[_0xadff('0x44')]);_0x3e9d9b[_0xadff('0x47')]=_[_0xadff('0x46')](_0x3af2d2[_0xadff('0x43')],qs[_0xadff('0x48')](_0x4219d6[_0xadff('0x44')][_0xadff('0x48')]));_0x3e9d9b[_0xadff('0x47')]=_0x3e9d9b[_0xadff('0x47')]['length']?_0x3e9d9b['attributes']:_0x3af2d2[_0xadff('0x43')];if(!_0x4219d6[_0xadff('0x44')][_0xadff('0x49')](_0xadff('0x69'))){_0x3e9d9b[_0xadff('0x4a')]=qs[_0xadff('0x4a')](_0x4219d6[_0xadff('0x44')]['limit']);_0x3e9d9b['offset']=qs[_0xadff('0x30')](_0x4219d6[_0xadff('0x44')]['offset']);}_0x3e9d9b[_0xadff('0x4b')]=qs[_0xadff('0x4c')](_0x4219d6[_0xadff('0x44')][_0xadff('0x4c')]);_0x3e9d9b[_0xadff('0x4d')]=qs[_0xadff('0x45')](_[_0xadff('0x6a')](_0x4219d6['query'],_0x3af2d2['filters']));_0x3e9d9b[_0xadff('0x4d')][_0xadff('0x65')]=_0x270698['id'];if(_0x4219d6[_0xadff('0x44')][_0xadff('0x4e')]){_0x3e9d9b[_0xadff('0x4d')]=_[_0xadff('0x50')](_0x3e9d9b['where'],{'$or':_[_0xadff('0x3e')](_0x3e9d9b['attributes'],function(_0x5a7744){var _0x3cd7fd={};_0x3cd7fd[_0x5a7744]={'$like':'%'+_0x4219d6[_0xadff('0x44')][_0xadff('0x4e')]+'%'};return _0x3cd7fd;})});}_0x3e9d9b=_[_0xadff('0x50')]({},_0x3e9d9b,_0x4219d6[_0xadff('0x59')]);return db[_0xadff('0x66')][_0xadff('0x51')]({'where':_0x3e9d9b[_0xadff('0x4d')]})[_0xadff('0x24')](function(_0x1233e1){_0x19d153['count']=_0x1233e1;if(_0x4219d6['query']['includeAll']){_0x3e9d9b[_0xadff('0x53')]=[{'all':!![]}];}return db[_0xadff('0x66')][_0xadff('0x6b')](_0x3e9d9b);})[_0xadff('0x24')](function(_0x5166c5){_0x19d153[_0xadff('0x54')]=_0x5166c5;return _0x19d153;});}})[_0xadff('0x24')](respondWithFilteredResult(_0xb5e85,_0x3e9d9b))['catch'](handleError(_0xb5e85,null));};exports[_0xadff('0x6c')]=function(_0xda7a62,_0x161f5e,_0x583198){return db[_0xadff('0x3f')]['find']({'where':{'id':_0xda7a62[_0xadff('0x62')]['id']}})['then'](handleEntityNotFound(_0x161f5e,null))[_0xadff('0x24')](function(_0x1b7272){if(_0x1b7272){return _0x1b7272['removeDispositions'](_0xda7a62[_0xadff('0x44')][_0xadff('0x6d')]);}})[_0xadff('0x24')](respondWithStatusCode(_0x161f5e,null))['catch'](handleError(_0x161f5e,null));};exports[_0xadff('0x6e')]=function(_0x242193,_0xd15c65,_0x5425c6){if(_0x242193['body']['id']){delete _0x242193[_0xadff('0x61')]['id'];}return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x242193[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0xd15c65,null))[_0xadff('0x24')](function(_0x528359){if(_0x528359){_0x242193[_0xadff('0x61')][_0xadff('0x65')]=_0x528359['id'];return db[_0xadff('0x6f')][_0xadff('0x5f')](_0x242193[_0xadff('0x61')]);}})[_0xadff('0x24')](respondWithResult(_0xd15c65,null))[_0xadff('0x55')](handleError(_0xd15c65,null));};exports[_0xadff('0x70')]=function(_0x181482,_0x4d1fed,_0x37e65e){var _0x5a81f6={'raw':![],'where':{}};var _0x261d6d={};var _0x5dffdd={'count':0x0,'rows':[]};return db[_0xadff('0x3f')][_0xadff('0x68')]({'where':{'id':_0x181482['params']['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x4d1fed,null))[_0xadff('0x24')](function(_0x41ef8a){if(_0x41ef8a){_0x261d6d[_0xadff('0x43')]=_[_0xadff('0x58')](db[_0xadff('0x6f')][_0xadff('0x40')]);_0x261d6d[_0xadff('0x44')]=_[_0xadff('0x58')](_0x181482[_0xadff('0x44')]);_0x261d6d[_0xadff('0x45')]=_[_0xadff('0x46')](_0x261d6d[_0xadff('0x43')],_0x261d6d['query']);_0x5a81f6[_0xadff('0x47')]=_[_0xadff('0x46')](_0x261d6d[_0xadff('0x43')],qs[_0xadff('0x48')](_0x181482[_0xadff('0x44')][_0xadff('0x48')]));_0x5a81f6[_0xadff('0x47')]=_0x5a81f6[_0xadff('0x47')][_0xadff('0x71')]?_0x5a81f6['attributes']:_0x261d6d[_0xadff('0x43')];if(!_0x181482[_0xadff('0x44')]['hasOwnProperty'](_0xadff('0x69'))){_0x5a81f6[_0xadff('0x4a')]=qs[_0xadff('0x4a')](_0x181482[_0xadff('0x44')][_0xadff('0x4a')]);_0x5a81f6[_0xadff('0x30')]=qs[_0xadff('0x30')](_0x181482[_0xadff('0x44')]['offset']);}_0x5a81f6[_0xadff('0x4b')]=qs[_0xadff('0x4c')](_0x181482[_0xadff('0x44')]['sort']);_0x5a81f6[_0xadff('0x4d')]=qs[_0xadff('0x45')](_[_0xadff('0x6a')](_0x181482[_0xadff('0x44')],_0x261d6d[_0xadff('0x45')]));_0x5a81f6['where'][_0xadff('0x65')]=_0x41ef8a['id'];if(_0x181482['query']['filter']){_0x5a81f6[_0xadff('0x4d')]=_[_0xadff('0x50')](_0x5a81f6['where'],{'$or':_[_0xadff('0x3e')](_0x5a81f6[_0xadff('0x47')],function(_0x37bbbf){var _0x517588={};_0x517588[_0x37bbbf]={'$like':'%'+_0x181482[_0xadff('0x44')][_0xadff('0x4e')]+'%'};return _0x517588;})});}_0x5a81f6=_[_0xadff('0x50')]({},_0x5a81f6,_0x181482[_0xadff('0x59')]);return db[_0xadff('0x6f')][_0xadff('0x51')]({'where':_0x5a81f6[_0xadff('0x4d')]})[_0xadff('0x24')](function(_0x2adbc1){_0x5dffdd['count']=_0x2adbc1;if(_0x181482['query'][_0xadff('0x52')]){_0x5a81f6[_0xadff('0x53')]=[{'all':!![]}];}return db[_0xadff('0x6f')]['findAll'](_0x5a81f6);})['then'](function(_0x4b0a5b){_0x5dffdd['rows']=_0x4b0a5b;return _0x5dffdd;});}})['then'](respondWithFilteredResult(_0x4d1fed,_0x5a81f6))[_0xadff('0x55')](handleError(_0x4d1fed,null));};exports[_0xadff('0x72')]=function(_0x114f25,_0x5170f4,_0x5b58d6){return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x114f25[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x5170f4,null))[_0xadff('0x24')](function(_0x5cda5b){if(_0x5cda5b){return _0x5cda5b['removeAnswers'](_0x114f25[_0xadff('0x44')]['ids']);}})[_0xadff('0x24')](respondWithStatusCode(_0x5170f4,null))['catch'](handleError(_0x5170f4,null));};exports[_0xadff('0x73')]=function(_0x15d734,_0x270ee3,_0x4c4757){_0x15d734[_0xadff('0x61')][_0xadff('0x74')]=_0x15d734['file'][_0xadff('0x75')];return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x15d734[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x270ee3,null))[_0xadff('0x24')](saveUpdates(_0x15d734[_0xadff('0x61')],null))[_0xadff('0x24')](respondWithResult(_0x270ee3,null))[_0xadff('0x55')](handleError(_0x270ee3,null));};exports['addAvatar']=function(_0x34eadd,_0x21fdaa,_0x48f1df){_0x34eadd[_0xadff('0x61')][_0xadff('0x76')]=_0x34eadd[_0xadff('0x77')][_0xadff('0x75')];return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x34eadd[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x21fdaa,null))[_0xadff('0x24')](saveUpdates(_0x34eadd[_0xadff('0x61')],null))['then'](respondWithResult(_0x21fdaa,null))[_0xadff('0x55')](handleError(_0x21fdaa,null));};exports[_0xadff('0x78')]=function(_0x283bf6,_0x11b59d,_0xd469df){_0x283bf6[_0xadff('0x61')][_0xadff('0x79')]=_0x283bf6[_0xadff('0x77')]['filename'];return db['ChatWebsite'][_0xadff('0x5a')]({'where':{'id':_0x283bf6[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x11b59d,null))['then'](saveUpdates(_0x283bf6[_0xadff('0x61')],null))[_0xadff('0x24')](respondWithResult(_0x11b59d,null))[_0xadff('0x55')](handleError(_0x11b59d,null));};exports[_0xadff('0x7a')]=function(_0x694db6,_0x228a78,_0xd49a86){_0x694db6['body'][_0xadff('0x7b')]=_0x694db6[_0xadff('0x77')][_0xadff('0x75')];return db[_0xadff('0x3f')]['find']({'where':{'id':_0x694db6[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x228a78,null))[_0xadff('0x24')](saveUpdates(_0x694db6[_0xadff('0x61')],null))[_0xadff('0x24')](respondWithResult(_0x228a78,null))[_0xadff('0x55')](handleError(_0x228a78,null));};exports[_0xadff('0x7c')]=function(_0x36e568,_0x1acfd7,_0x4ff2fb){var _0x310912=path['join'](config[_0xadff('0x7d')],_0xadff('0x7e'));var _0x24e16a={'where':{'id':_0x36e568['params']['id']},'attributes':['id',_0xadff('0x74')],'raw':!![]};var _0x4a9111=![];return require(_0xadff('0x7f'))[_0xadff('0x80')]()['then'](function(_0x18994d){if(_0x18994d){_0x4a9111=_0x18994d[_0xadff('0x81')];}})[_0xadff('0x24')](function(){return db[_0xadff('0x3f')][_0xadff('0x5a')](_0x24e16a);})[_0xadff('0x24')](handleEntityNotFound(_0x1acfd7,null))['then'](function(_0x2f82ae){if(_0x2f82ae){if(!_['isNil'](_0x2f82ae[_0xadff('0x74')])){if(fs[_0xadff('0x82')](path['join'](config[_0xadff('0x7d')],_0xadff('0x83'),_0x2f82ae[_0xadff('0x74')]))&&_0x4a9111){_0x310912=path['join'](config[_0xadff('0x7d')],_0xadff('0x83'),_0x2f82ae[_0xadff('0x74')]);}}return _0x1acfd7[_0xadff('0x84')](_0x310912);}})[_0xadff('0x55')](handleError(_0x1acfd7,null));};exports[_0xadff('0x85')]=function(_0x52d5ae,_0x592380,_0x1783dd){var _0x4c1600=path[_0xadff('0x86')](config[_0xadff('0x7d')],_0xadff('0x87'));var _0x462d62={'where':{'id':_0x52d5ae[_0xadff('0x62')]['id']},'attributes':['id',_0xadff('0x76')],'raw':!![]};return db[_0xadff('0x3f')][_0xadff('0x5a')](_0x462d62)[_0xadff('0x24')](handleEntityNotFound(_0x592380,null))[_0xadff('0x24')](function(_0x366667){if(_0x366667){if(!_['isNil'](_0x366667[_0xadff('0x76')])){if(fs[_0xadff('0x82')](path[_0xadff('0x86')](config[_0xadff('0x7d')],_0xadff('0x88'),_0x366667[_0xadff('0x76')]))){_0x4c1600=path[_0xadff('0x86')](config[_0xadff('0x7d')],_0xadff('0x88'),_0x366667['agentAvatar']);}}return _0x592380['download'](_0x4c1600);}})[_0xadff('0x55')](handleError(_0x592380,null));};exports[_0xadff('0x89')]=function(_0x24dfd7,_0xc3d007,_0x379755){var _0x37fd8f=path['join'](config['root'],_0xadff('0x8a'));var _0x4cd402={'where':{'id':_0x24dfd7[_0xadff('0x62')]['id']},'attributes':['id',_0xadff('0x79'),_0xadff('0x8b')],'raw':!![]};return db[_0xadff('0x3f')][_0xadff('0x5a')](_0x4cd402)[_0xadff('0x24')](handleEntityNotFound(_0xc3d007,null))[_0xadff('0x24')](function(_0x87d8a3){if(_0x87d8a3){if(!_['isNil'](_0x87d8a3[_0xadff('0x79')])){if(fs[_0xadff('0x82')](path[_0xadff('0x86')](config[_0xadff('0x7d')],'server/files/images/avatars/',_0x87d8a3[_0xadff('0x79')]))&&_0x87d8a3[_0xadff('0x8b')]){_0x37fd8f=path[_0xadff('0x86')](config[_0xadff('0x7d')],_0xadff('0x88'),_0x87d8a3[_0xadff('0x79')]);}}return _0xc3d007[_0xadff('0x84')](_0x37fd8f);}})[_0xadff('0x55')](handleError(_0xc3d007,null));};exports[_0xadff('0x8c')]=function(_0x5cc61d,_0x8203f3,_0x32be1c){var _0x3df246=path[_0xadff('0x86')](config[_0xadff('0x7d')],_0xadff('0x8d'));var _0x261503={'where':{'id':_0x5cc61d[_0xadff('0x62')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xadff('0x3f')]['find'](_0x261503)['then'](handleEntityNotFound(_0x8203f3,null))[_0xadff('0x24')](function(_0x5eb724){if(_0x5eb724){if(!_[_0xadff('0x8e')](_0x5eb724[_0xadff('0x7b')])){if(fs['existsSync'](path['join'](config[_0xadff('0x7d')],_0xadff('0x88'),_0x5eb724['systemAvatar']))){_0x3df246=path['join'](config[_0xadff('0x7d')],_0xadff('0x88'),_0x5eb724[_0xadff('0x7b')]);}}return _0x8203f3[_0xadff('0x84')](_0x3df246);}})[_0xadff('0x55')](handleError(_0x8203f3,null));};exports['notify']=function(_0x4bbe69,_0x3a6cde,_0xd45f2e){var _0x12c9a1=require('user-agent-parser');var _0x24266e=new _0x12c9a1();var _0x1ededd=_0x24266e[_0xadff('0x8f')](_0x4bbe69[_0xadff('0x90')][_0xadff('0x91')])[_0xadff('0x92')]();var _0x111a79={'body':_0x4bbe69[_0xadff('0x61')],'channel':'chat'};var _0x590c53=[];var _0x4fe40d=[];var _0x2cb21c={};var _0x481fdc=![];return db[_0xadff('0x93')][_0xadff('0x63')]()[_0xadff('0x24')](function(_0x866f3f){if(!_0x866f3f){throw new db['Sequelize'][(_0xadff('0x22'))](_0xadff('0x94'));}_0x590c53=_[_0xadff('0x95')](_[_0xadff('0x58')](_0x866f3f),['createdAt',_0xadff('0x96')]);_0x4fe40d=_[_0xadff('0x95')](_[_0xadff('0x58')](_0x866f3f),[_0xadff('0x97'),'updatedAt',_0xadff('0x98'),'ListId']);if(_0x4bbe69['body']['id']){delete _0x4bbe69[_0xadff('0x61')]['id'];}if(_[_0xadff('0x8e')](_0x4bbe69[_0xadff('0x61')][_0xadff('0x99')])){throw new db[(_0xadff('0x9a'))][(_0xadff('0x22'))](_0xadff('0x9b'));}if(_[_0xadff('0x8e')](_0x4bbe69[_0xadff('0x61')][_0xadff('0x61')])||_0x4bbe69[_0xadff('0x61')][_0xadff('0x61')]===''){throw new db['Sequelize']['ValidationError'](_0xadff('0x9c'));}if(_[_0xadff('0x8e')](_0x4bbe69[_0xadff('0x61')]['mapKey'])){throw new db[(_0xadff('0x9a'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4fe40d);}if(!_[_0xadff('0x9d')](_0x4fe40d,_0x4bbe69[_0xadff('0x61')][_0xadff('0x9e')])){throw new db[(_0xadff('0x9a'))][(_0xadff('0x22'))](_0xadff('0x9f')+_0x4fe40d);}_0x2cb21c[_0x4bbe69[_0xadff('0x61')][_0xadff('0x9e')]]=_0x4bbe69['body'][_0xadff('0x99')];})[_0xadff('0x24')](function(){return db['ChatWebsite'][_0xadff('0x5a')]({'where':{'id':_0x4bbe69[_0xadff('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0xadff('0xa0'),'include':[{'model':db[_0xadff('0x93')],'as':'Contacts','where':_0x2cb21c,'limit':0x1,'order':[[_0xadff('0x96'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xadff('0xa1')}]});})[_0xadff('0x24')](handleEntityNotFound(_0x3a6cde,null))[_0xadff('0x24')](function(_0xa3f323){if(_0xa3f323&&_0xa3f323['List']){_0x111a79[_0xadff('0xa2')]=_0xa3f323;_0x111a79[_0xadff('0xa3')]=_0xa3f323[_0xadff('0xa1')];_0x111a79[_0xadff('0xa4')]=_0xa3f323[_0xadff('0xa0')];_0x111a79[_0xadff('0xa3')]=_[_0xadff('0xa5')](_0x111a79['applications'],['priority'],[_0xadff('0xa6')]);if(_0x111a79['account']['Applications']){delete _0x111a79[_0xadff('0xa2')][_0xadff('0xa1')];}if(_0x111a79['account'][_0xadff('0xa0')]&&_0x111a79[_0xadff('0xa2')][_0xadff('0xa0')][_0xadff('0xa7')][_0xadff('0x71')]){return _0x111a79[_0xadff('0xa2')][_0xadff('0xa0')][_0xadff('0xa7')][0x0];}var _0x46d30c=_['defaults'](_0x4bbe69[_0xadff('0x61')],{'firstName':_0x4bbe69[_0xadff('0x61')]['from'],'ListId':_0xa3f323[_0xadff('0xa8')]});_0x46d30c[_0x4bbe69[_0xadff('0x61')][_0xadff('0x9e')]]=_0x4bbe69['body'][_0xadff('0x99')];return db['CmContact'][_0xadff('0x5f')](_0x46d30c,{'fields':_0x590c53,'raw':!![]});}})['then'](handleEntityNotFound(_0x3a6cde,null))[_0xadff('0x24')](function(_0x55252f){_0x111a79[_0xadff('0xa9')]=_0x55252f;var _0x4e75f3=_0x4bbe69[_0xadff('0x61')]['customerIp'];if(_0x4bbe69['headers']['cf-connecting-ip']){_0x4e75f3=_0x4bbe69[_0xadff('0x90')]['cf-connecting-ip'];}else if(_0x4bbe69[_0xadff('0x90')]['x-forwarded-for']){_0x4e75f3=_[_0xadff('0xaa')](_0x4bbe69['headers'][_0xadff('0xab')]['split'](','));}if(_0x55252f){var _0x5eefe3={'ContactId':_0x55252f['id'],'ChatWebsiteId':_0x4bbe69[_0xadff('0x62')]['id'],'from':(_0x55252f[_0xadff('0xac')]||'')+'\x20'+(_0x55252f[_0xadff('0xad')]||''),'customerIp':_0x4e75f3,'customerPort':_0x4bbe69[_0xadff('0x90')][_0xadff('0xae')]?_0x4bbe69[_0xadff('0x90')][_0xadff('0xae')]:null,'referer':_0x4bbe69[_0xadff('0x61')][_0xadff('0xaf')],'browserName':_0x1ededd[_0xadff('0xb0')][_0xadff('0x3c')]&&_0x1ededd[_0xadff('0xb0')][_0xadff('0xb1')]?util[_0xadff('0xb2')](_0xadff('0xb3'),_0x1ededd[_0xadff('0xb0')][_0xadff('0x3c')],_0x1ededd[_0xadff('0xb0')][_0xadff('0xb1')]):'unknown','browserVersion':_0x1ededd[_0xadff('0xb0')]['version']||_0xadff('0xb4'),'osName':util[_0xadff('0xb2')]('%s\x20%s',_0x1ededd['os'][_0xadff('0x3c')],_0x1ededd['os'][_0xadff('0xb1')]),'osVersion':_0x1ededd['os']['version'],'deviceModel':_0x1ededd[_0xadff('0xb5')][_0xadff('0x43')]&&_0x1ededd['device'][_0xadff('0xb6')]?util[_0xadff('0xb2')](_0xadff('0xb7'),_0x1ededd[_0xadff('0xb5')]['model'],_0x1ededd[_0xadff('0xb5')][_0xadff('0xb6')],_0x1ededd[_0xadff('0xb5')]['type']):null,'deviceVendor':_0x1ededd[_0xadff('0xb5')]['vendor'],'deviceType':_0x1ededd['device'][_0xadff('0x42')],'formData':JSON[_0xadff('0x29')](_0x4bbe69[_0xadff('0x61')])};var _0x39a3fd={'ChatWebsiteId':_0x4bbe69[_0xadff('0x62')]['id'],'closed':![]};if(_0x4bbe69[_0xadff('0x61')]['threadId']){_0x39a3fd[_0xadff('0xb8')]=_0x4bbe69[_0xadff('0x61')][_0xadff('0xb8')];return db[_0xadff('0xb9')][_0xadff('0x5a')]({'where':_0x39a3fd})[_0xadff('0x24')](function(_0x2e00b0){if(_0x2e00b0){return[_0x2e00b0,![]];}_0x5eefe3[_0xadff('0xb8')]=_0x4bbe69[_0xadff('0x61')][_0xadff('0xb8')];_0x5eefe3[_0xadff('0xba')]=_0x4bbe69[_0xadff('0x61')][_0xadff('0xba')];return db['ChatInteraction'][_0xadff('0x5f')](_0x5eefe3)[_0xadff('0x24')](function(_0x3cfaaa){return[_0x3cfaaa,!![]];});});}_0x39a3fd[_0xadff('0xbb')]=_0x55252f['id'];if(_0x4bbe69['body'][_0xadff('0xbc')]&&_0x4bbe69[_0xadff('0x61')]['interaction']['id']){_0x39a3fd['id']=_0x4bbe69[_0xadff('0x61')][_0xadff('0xbc')]['id'];return db[_0xadff('0xb9')]['find']({'where':_0x39a3fd})['then'](function(_0x2d594f){if(_0x2d594f){return[_0x2d594f,![]];}return db[_0xadff('0xb9')][_0xadff('0x5f')](_0x5eefe3)[_0xadff('0x24')](function(_0x59dd48){return[_0x59dd48,!![]];});});}return db[_0xadff('0xb9')][_0xadff('0x5f')](_0x5eefe3)[_0xadff('0x24')](function(_0x2e650f){return[_0x2e650f,!![]];});}})['spread'](function(_0x230711,_0x4da952){if(_0x230711){_0x481fdc=_0x4da952;if(!_0x4da952){var _0x4ed34e={'from':(_0x111a79[_0xadff('0xa9')][_0xadff('0xac')]||'')+'\x20'+(_0x111a79[_0xadff('0xa9')][_0xadff('0xad')]||'')};if(_0x4bbe69[_0xadff('0x61')][_0xadff('0xb8')]&&_0x4bbe69['body']['messageId']&&_0x4bbe69['body'][_0xadff('0xb8')]!=_0x4bbe69[_0xadff('0x61')][_0xadff('0xbd')]){_0x4ed34e[_0xadff('0xb8')]=_0x4bbe69['body']['messageId'];}return _0x230711['update'](_0x4ed34e);}else{return _0x230711;}}})[_0xadff('0x24')](function(_0x3a4cf8){_0x111a79[_0xadff('0xbc')]=_0x3a4cf8[_0xadff('0x37')]({'plain':!![]});_0x111a79[_0xadff('0xbc')]['created']=_0x481fdc;if(_0x111a79['interaction']['created']){if(_0x111a79[_0xadff('0xa2')][_0xadff('0xbe')]){_0x111a79[_0xadff('0xa3')]['push']({'id':0x0,'priority':_0x111a79['applications'][_0xadff('0x71')]+0x1,'app':_0xadff('0xbf'),'appdata':'unmanaged','interval':_0xadff('0xc0')});}}return db['ChatMessage']['create']({'body':_0x4bbe69[_0xadff('0x61')][_0xadff('0x61')],'ChatWebsiteId':_0x4bbe69['params']['id'],'ChatInteractionId':_0x3a4cf8['id'],'direction':'in','ContactId':_0x111a79[_0xadff('0xa9')]['id'],'AttachmentId':_0x4bbe69[_0xadff('0x61')][_0xadff('0xc1')]});})['then'](function(_0xdbbb02){_0x111a79[_0xadff('0x2c')]=_0xdbbb02;if(_0x111a79[_0xadff('0xbc')]['UserId']){return db[_0xadff('0xc2')][_0xadff('0x5a')]({'attributes':['id',_0xadff('0x3c')],'where':{'id':_0x111a79[_0xadff('0xbc')][_0xadff('0xc3')]}})[_0xadff('0x24')](function(_0x43bd0a){if(_0x43bd0a){_0x111a79[_0xadff('0xa3')]['unshift']({'id':0x0,'priority':0x0,'app':_0xadff('0xc4'),'appdata':_0x43bd0a[_0xadff('0x3c')]+','+(_0x111a79['account'][_0xadff('0xc5')]||0xa),'interval':_0xadff('0xc0')});_0x111a79[_0xadff('0xc6')]=!![];}return respondWithRpcPromise('Start',_0xadff('0xc7'),_0x111a79);});}return respondWithRpcPromise('Start',_0xadff('0xc7'),_0x111a79);})['then'](function(_0x199233){respondWithRpcPromise(_0xadff('0xc8'),_0xadff('0xc8'),{'event':_0xadff('0xc9'),'message':_0x199233},client9002);return _0x199233;})['then'](respondWithResult(_0x3a6cde,null))[_0xadff('0x55')](handleError(_0x3a6cde,null));};exports[_0xadff('0xca')]=function(_0x554e49,_0x1d5183,_0x1c1671){var _0x488627,_0x2ab69f,_0x251522;var _0x5b7790=[];var _0x563fde=[];var _0x47db48={};return db[_0xadff('0x93')][_0xadff('0x63')]()[_0xadff('0x24')](function(_0x475d30){if(!_0x475d30){throw new db[(_0xadff('0x9a'))][(_0xadff('0x22'))]('no\x20available\x20attributes');}_0x563fde=_[_0xadff('0x95')](_['keys'](_0x475d30),['createdAt',_0xadff('0x96')]);_0x5b7790=_[_0xadff('0x95')](_[_0xadff('0x58')](_0x475d30),[_0xadff('0x97'),_0xadff('0x96'),_0xadff('0x98'),_0xadff('0xa8')]);if(_0x554e49[_0xadff('0x61')]['id']){delete _0x554e49[_0xadff('0x61')]['id'];}if(_['isNil'](_0x554e49['body']['from'])){throw _0x1d5183[_0xadff('0x2e')](0x1f4)[_0xadff('0xcb')](new db[(_0xadff('0x9a'))]['ValidationError'](_0xadff('0x9b')));}if(_[_0xadff('0x8e')](_0x554e49[_0xadff('0x61')]['body'])||_0x554e49['body']['body']===''){throw _0x1d5183[_0xadff('0x2e')](0x1f4)['send'](new db['Sequelize'][(_0xadff('0x22'))](_0xadff('0x9c')));}if(_[_0xadff('0x8e')](_0x554e49['body'][_0xadff('0xcc')])){throw _0x1d5183[_0xadff('0x2e')](0x1f4)['send'](new db[(_0xadff('0x9a'))][(_0xadff('0x22'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b7790));}if(!_[_0xadff('0x9d')](_0x5b7790,_0x554e49[_0xadff('0x61')][_0xadff('0xcc')])){throw _0x1d5183[_0xadff('0x2e')](0x1f4)[_0xadff('0xcb')](new db[(_0xadff('0x9a'))][(_0xadff('0x22'))](_0xadff('0xcd')+_0x5b7790));}_0x47db48[_0x554e49[_0xadff('0x61')][_0xadff('0xcc')]]=_0x554e49[_0xadff('0x61')][_0xadff('0x99')];})[_0xadff('0x24')](function(){return db['ChatWebsite'][_0xadff('0x5a')]({'where':{'id':_0x554e49[_0xadff('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0xadff('0xa0')}]});})['then'](handleEntityNotFound(_0x1d5183,null))[_0xadff('0x24')](function(_0x51d0c5){if(_0x51d0c5&&_0x51d0c5[_0xadff('0xa0')]){_0x2ab69f=_0x51d0c5;var _0x263084=_['defaults'](_0x554e49[_0xadff('0x61')],{'firstName':_0x554e49['body'][_0xadff('0x99')],'phone':_0x554e49[_0xadff('0x61')]['from'],'ListId':_0x51d0c5[_0xadff('0xa8')]});_0x263084[_0x554e49['body'][_0xadff('0xcc')]]=_0x554e49[_0xadff('0x61')][_0xadff('0x99')];return db[_0xadff('0x93')][_0xadff('0xce')]({'where':_0x47db48,'defaults':_0x263084});}})['spread'](function(_0xd31c38){if(_0xd31c38){_0x251522=_0xd31c38;var _0x30ae96=fs['readFileSync'](path[_0xadff('0x86')](config[_0xadff('0x7d')],_0xadff('0xcf')),_0xadff('0xd0'));var _0x25a736=ejs[_0xadff('0xd1')](_0x30ae96,{'body':_['toPairs'](_0x554e49[_0xadff('0x61')][_0xadff('0x61')]),'bodyTitle':_0x2ab69f[_0xadff('0xd2')]});return db['ChatOfflineMessage'][_0xadff('0x5f')]({'body':_0x25a736,'ContactId':_0xd31c38['id'],'ChatWebsiteId':_0x2ab69f['id']});}})[_0xadff('0x24')](function(_0x27dce1){if(_0x27dce1){_0x488627=_0x27dce1;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xadff('0xd3')],'as':'Smtp','raw':!![]}]});}})[_0xadff('0x24')](function(_0x2dbb7e){if(_0x2dbb7e&&_0x2dbb7e['Smtp']&&_0x2ab69f[_0xadff('0xd4')]){var _0x2816d9={'tls':{'rejectUnauthorized':![]}};if(_0x2dbb7e[_0xadff('0xd5')][_0xadff('0xd6')]){_0x2816d9['service']=_0x2dbb7e[_0xadff('0xd5')][_0xadff('0xd6')];}else{_0x2816d9[_0xadff('0xd7')]=_0x2dbb7e['Smtp'][_0xadff('0xd7')];_0x2816d9['port']=_0x2dbb7e['Smtp'][_0xadff('0xd8')];_0x2816d9[_0xadff('0xd9')]=_0x2dbb7e[_0xadff('0xd5')]['secure'];}if(_0x2dbb7e[_0xadff('0xd5')][_0xadff('0xda')]){_0x2816d9[_0xadff('0xdb')]={'user':_0x2dbb7e[_0xadff('0xd5')][_0xadff('0xdc')],'pass':_0x2dbb7e[_0xadff('0xd5')][_0xadff('0xdd')]};}return respondWithRpcPromise(_0xadff('0xde'),'sendMail',{'account':_0x2816d9,'message':{'from':util[_0xadff('0xb2')]('\x22%s\x22\x20<%s>',_0x2dbb7e[_0xadff('0x3c')],_0x2dbb7e['email']||_0x2dbb7e['Smtp'][_0xadff('0xdc')]),'to':_0x2ab69f['forwardOfflineAddress'],'subject':_0x2ab69f[_0xadff('0xdf')],'text':_0x488627['body']}},client9003)[_0xadff('0x24')](function(){return _0x488627;})['catch'](function(_0x3d38d9){console[_0xadff('0x2a')](_0x3d38d9);});}})['then'](function(){if(_0x488627){return _0x488627;}})[_0xadff('0x24')](respondWithResult(_0x1d5183,null))[_0xadff('0x55')](handleError(_0x1d5183,null));};exports[_0xadff('0xe0')]=function(_0x2748db,_0x40c402,_0x3731eb){return db['ChatInteraction'][_0xadff('0x5a')]({'where':{'id':_0x2748db[_0xadff('0x62')]['id']}})['then'](handleEntityNotFound(_0x40c402,null))[_0xadff('0x24')](function(_0x23ea42){if(_0x23ea42){return _0x23ea42[_0xadff('0xe0')](_0x2748db[_0xadff('0x61')][_0xadff('0x6d')],_[_0xadff('0xe1')](_0x2748db[_0xadff('0x61')],['ids','id'])||{});}})['then'](respondWithResult(_0x40c402,null))['catch'](handleError(_0x40c402,null));};exports['getInteractions']=function(_0x241d18,_0x32a5a0,_0x4d3207){var _0x19d42c={'raw':![],'where':{}};var _0x517049={};var _0x36ad6c={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xadff('0x68')]({'where':{'id':_0x241d18[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x32a5a0,null))[_0xadff('0x24')](function(_0x512bf3){if(_0x512bf3){_0x517049[_0xadff('0x43')]=_[_0xadff('0x58')](db['ChatInteraction'][_0xadff('0x40')]);_0x517049[_0xadff('0x44')]=_[_0xadff('0x58')](_0x241d18['query']);_0x517049[_0xadff('0x45')]=_[_0xadff('0x46')](_0x517049[_0xadff('0x43')],_0x517049[_0xadff('0x44')]);_0x19d42c[_0xadff('0x47')]=_[_0xadff('0x46')](_0x517049['model'],qs[_0xadff('0x48')](_0x241d18[_0xadff('0x44')]['fields']));_0x19d42c[_0xadff('0x47')]=_0x19d42c[_0xadff('0x47')][_0xadff('0x71')]?_0x19d42c['attributes']:_0x517049[_0xadff('0x43')];if(!_0x241d18['query']['hasOwnProperty'](_0xadff('0x69'))){_0x19d42c[_0xadff('0x4a')]=qs[_0xadff('0x4a')](_0x241d18['query'][_0xadff('0x4a')]);_0x19d42c[_0xadff('0x30')]=qs[_0xadff('0x30')](_0x241d18[_0xadff('0x44')][_0xadff('0x30')]);}_0x19d42c[_0xadff('0x4b')]=qs[_0xadff('0x4c')](_0x241d18[_0xadff('0x44')][_0xadff('0x4c')]);_0x19d42c[_0xadff('0x4d')]=qs[_0xadff('0x45')](_[_0xadff('0x6a')](_0x241d18[_0xadff('0x44')],_0x517049['filters']));_0x19d42c[_0xadff('0x4d')][_0xadff('0x65')]=_0x512bf3['id'];if(_0x241d18['query']['filter']){_0x19d42c[_0xadff('0x4d')]=_[_0xadff('0x50')](_0x19d42c[_0xadff('0x4d')],{'$or':_[_0xadff('0x3e')](_0x19d42c['attributes'],function(_0x4df531){var _0x21d6ba={};_0x21d6ba[_0x4df531]={'$like':'%'+_0x241d18[_0xadff('0x44')][_0xadff('0x4e')]+'%'};return _0x21d6ba;})});}_0x19d42c=_[_0xadff('0x50')]({},_0x19d42c,_0x241d18[_0xadff('0x59')]);return db['ChatInteraction'][_0xadff('0x51')]({'where':_0x19d42c[_0xadff('0x4d')]})[_0xadff('0x24')](function(_0x2191a1){_0x36ad6c[_0xadff('0x51')]=_0x2191a1;if(_0x241d18['query'][_0xadff('0x52')]){_0x19d42c[_0xadff('0x53')]=[{'model':db['CmContact'],'as':_0xadff('0xe2'),'required':![]},{'model':db[_0xadff('0xc2')],'as':_0xadff('0xe3'),'attributes':[_0xadff('0x3c'),_0xadff('0xe4'),'internal'],'required':![]},{'model':db[_0xadff('0xe5')],'as':_0xadff('0xe6'),'attributes':['id',_0xadff('0x3c'),_0xadff('0xe7')],'where':_0x241d18[_0xadff('0x44')]['tag']?{'id':_0x241d18['query'][_0xadff('0xe8')]}:undefined,'required':_0x241d18[_0xadff('0x44')][_0xadff('0xe8')]?!![]:![]}];}return db[_0xadff('0xb9')][_0xadff('0x6b')](_0x19d42c);})['then'](function(_0x5d091a){_0x36ad6c[_0xadff('0x54')]=_0x5d091a;return _0x36ad6c;});}})[_0xadff('0x24')](respondWithFilteredResult(_0x32a5a0,_0x19d42c))[_0xadff('0x55')](handleError(_0x32a5a0,null));};function iftimePromise(_0x428146,_0x26bac5){return respondWithRpcPromise(_0xadff('0xe9'),_0xadff('0xea'),{'command':_0x26bac5[_0xadff('0xeb')]?util[_0xadff('0xb2')](_0xadff('0xec'),_0x428146[_0xadff('0xed')],_0x26bac5['timezone']):util[_0xadff('0xb2')](_0xadff('0xee'),_0x428146['interval'])},client9002)[_0xadff('0x24')](function(_0x20ba3e){var _0x5dd404=_0x20ba3e&&_0x20ba3e[_0xadff('0xef')](_0xadff('0xf0'))>=0x0?!![]:![];logger[_0xadff('0x25')](_0xadff('0xf1'),_0x26bac5['id'],_0x428146['id'],_0x428146[_0xadff('0xed')],_0x5dd404?_0xadff('0xf2'):'OFFLINE',_0x26bac5[_0xadff('0xeb')]?_0x26bac5['timezone']:_0xadff('0xf3'));return _0x5dd404;})[_0xadff('0x55')](function(_0x5efd77){logger[_0xadff('0x2a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x26bac5['id'],_0x428146['id'],_0x428146['interval'],util['inspect'](_0x5efd77,{'showHidden':![],'depth':null}),_0x26bac5['timezone']?_0x26bac5[_0xadff('0xeb')]:'No\x20timezone');return![];});}exports[_0xadff('0xea')]=function(_0x4db30f,_0x2994aa,_0x6f43a2){var _0x275c3d=0x0;var _0x3d6a4a=0x0;var _0x5b1d1c=![];var _0x1a619d;var _0x2508bc;return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x4db30f[_0xadff('0x62')]['id']},'include':[{'model':db[_0xadff('0xf4')],'as':_0xadff('0xf4'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xadff('0xed')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x2994aa,null))[_0xadff('0x24')](function(_0x50c0a7){if(_0x50c0a7){_0x1a619d=_0x50c0a7;return _0x50c0a7['getProactiveActions']({'raw':!![]});}})[_0xadff('0x24')](function(_0x56fa4f){if(_0x1a619d){if(_0x56fa4f){_0x2508bc=_0x56fa4f;}}return require(_0xadff('0x7f'))['getLicense']();})[_0xadff('0x24')](function(_0x5290f4){if(_0x5290f4){_0x3d6a4a=_0x5290f4[_0xadff('0xf5')];_0x5b1d1c=_0x5290f4['custom'];}})[_0xadff('0x24')](function(){return db[_0xadff('0xb9')][_0xadff('0x51')]({'where':{'closed':![]}});})[_0xadff('0x24')](function(_0x20d74a){_0x275c3d=_0x20d74a;if(_0x3d6a4a&&_0x20d74a>_0x3d6a4a){return db[_0xadff('0xf6')][_0xadff('0x68')]({'where':{'id':0x1}})['then'](function(_0x41a99e){if(_0x41a99e){_0x41a99e[_0xadff('0xf7')](_0xadff('0xf8'));}});}})[_0xadff('0x24')](function(){if(_0x1a619d[_0xadff('0xf4')]&&_0x1a619d[_0xadff('0xf4')][_0xadff('0xf9')]){var _0x6d594=[];for(var _0x43a6ea=0x0;_0x43a6ea<_0x1a619d[_0xadff('0xf4')]['Intervals'][_0xadff('0x71')];_0x43a6ea++){var _0x1d3187=_0x1a619d[_0xadff('0xf4')][_0xadff('0xf9')][_0x43a6ea]['get']({'plain':!![]});_0x6d594[_0xadff('0xfa')](iftimePromise(_0x1d3187,_0x1a619d));}return BPromise[_0xadff('0xfb')](_0x6d594)['then'](function(_0x4b0556){return _[_0xadff('0xfc')](_0x4b0556);});}else{return!![];}})[_0xadff('0x24')](function(_0x33f651){var _0x8bd6e3=fs[_0xadff('0xfd')](path[_0xadff('0x86')](config[_0xadff('0x7d')],'server/files/chat/iframe.js'),'utf8');var _0x3f0975={'remote':_0x1a619d[_0xadff('0xfe')],'query':querystring[_0xadff('0x29')](_[_0xadff('0x50')](_0x1a619d[_0xadff('0x37')]({'plain':!![]}),{'customerIp':_0x4db30f[_0xadff('0x90')][_0xadff('0xab')]||_0x4db30f['headers']['x-real-ip']||_0x4db30f[_0xadff('0xff')][_0xadff('0x100')]||_0x4db30f['ip'],'referer':_0x4db30f[_0xadff('0x90')][_0xadff('0xaf')],'openedInteractions':_0x275c3d,'maxInteractions':_0x3d6a4a,'virtual':_0x5b1d1c[_0xadff('0xf5')],'online':_0x33f651,'custom':_0x5b1d1c}))['replace'](/'/g,'\x5c\x27')};_0x2994aa[_0xadff('0xcb')](ejs[_0xadff('0xd1')](Mustache['render'](_0x8bd6e3,_0x3f0975),{'proactiveActions':_0x2508bc,'alignment':_0x1a619d[_0xadff('0x101')],'verticalAlignment':_0x1a619d['verticalAlignment'],'div_color':_0x1a619d[_0xadff('0xe7')],'text_color':_0x1a619d[_0xadff('0x102')]}));})['catch'](handleError(_0x2994aa,null));};exports[_0xadff('0x103')]=function(_0x17dbd3,_0x1c94f4,_0x34937b){return db[_0xadff('0x3f')][_0xadff('0x68')]({'where':{'id':_0x17dbd3[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x1c94f4,null))[_0xadff('0x24')](function(_0x59a9ad){if(_0x59a9ad){return db['sequelize'][_0xadff('0x104')](function(_0x636382){return db[_0xadff('0x105')]['destroy']({'where':{'ChatWebsiteId':_0x17dbd3[_0xadff('0x62')]['id']},'transaction':_0x636382})[_0xadff('0x24')](function(_0x2cf9de){var _0x920d7f=_['map'](_0x17dbd3[_0xadff('0x61')],function(_0x9c1c1b){_0x9c1c1b[_0xadff('0x65')]=_0x17dbd3['params']['id'];return _0x9c1c1b;});return db[_0xadff('0x105')][_0xadff('0x106')](_0x920d7f,{'transaction':_0x636382});});})[_0xadff('0x24')](function(){return db[_0xadff('0x105')][_0xadff('0x107')]({'where':{'ChatWebsiteId':_0x17dbd3['params']['id']},'order':_0xadff('0x108')});});}})[_0xadff('0x24')](respondWithResult(_0x1c94f4,null))[_0xadff('0x55')](handleError(_0x1c94f4,null));};exports[_0xadff('0x109')]=function(_0x34ba4e,_0x51612c,_0x32a24a){var _0x45eb65={};var _0x485432={};var _0xba9aae;var _0x162c63;return db[_0xadff('0x3f')][_0xadff('0x68')]({'where':{'id':_0x34ba4e['params']['id']}})['then'](handleEntityNotFound(_0x51612c,null))[_0xadff('0x24')](function(_0x4a9fa5){if(_0x4a9fa5){_0xba9aae=_0x4a9fa5;_0x485432[_0xadff('0x43')]=_['keys'](db[_0xadff('0x105')][_0xadff('0x40')]);_0x485432[_0xadff('0x44')]=_[_0xadff('0x58')](_0x34ba4e[_0xadff('0x44')]);_0x485432[_0xadff('0x45')]=_['intersection'](_0x485432['model'],_0x485432[_0xadff('0x44')]);_0x45eb65['attributes']=_['intersection'](_0x485432[_0xadff('0x43')],qs[_0xadff('0x48')](_0x34ba4e[_0xadff('0x44')]['fields']));_0x45eb65[_0xadff('0x47')]=_0x45eb65[_0xadff('0x47')][_0xadff('0x71')]?_0x45eb65[_0xadff('0x47')]:_0x485432[_0xadff('0x43')];_0x45eb65['order']=qs[_0xadff('0x4c')](_0x34ba4e[_0xadff('0x44')][_0xadff('0x4c')]);_0x45eb65[_0xadff('0x4d')]=qs[_0xadff('0x45')](_[_0xadff('0x6a')](_0x34ba4e[_0xadff('0x44')],_0x485432['filters']));if(_0x34ba4e[_0xadff('0x44')][_0xadff('0x4e')]){_0x45eb65['where']=_[_0xadff('0x50')](_0x45eb65['where'],{'$or':_[_0xadff('0x3e')](_0x45eb65[_0xadff('0x47')],function(_0x51c82f){var _0x1a72ab={};_0x1a72ab[_0x51c82f]={'$like':'%'+_0x34ba4e[_0xadff('0x44')][_0xadff('0x4e')]+'%'};return _0x1a72ab;})});}_0x45eb65=_[_0xadff('0x50')]({},_0x45eb65,_0x34ba4e['options']);return _0xba9aae[_0xadff('0x109')](_0x45eb65);}})[_0xadff('0x24')](function(_0x3090e4){if(_0x3090e4){_0x162c63=_0x3090e4['length'];if(!_0x34ba4e[_0xadff('0x44')][_0xadff('0x49')](_0xadff('0x69'))){_0x45eb65[_0xadff('0x4a')]=qs['limit'](_0x34ba4e['query'][_0xadff('0x4a')]);_0x45eb65[_0xadff('0x30')]=qs['offset'](_0x34ba4e['query'][_0xadff('0x30')]);}return _0xba9aae['getApplications'](_0x45eb65);}})[_0xadff('0x24')](function(_0x160b68){if(_0x160b68){return _0x160b68?{'count':_0x162c63,'rows':_0x160b68}:null;}})[_0xadff('0x24')](respondWithResult(_0x51612c,null))[_0xadff('0x55')](handleError(_0x51612c,null));};exports[_0xadff('0x10a')]=function(_0x4686f8,_0x284362,_0x4fd612){return db[_0xadff('0x10b')]['find']({'where':{'id':_0x4686f8['params']['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x284362,null))[_0xadff('0x24')](function(_0x507e2f){if(_0x507e2f){return _0x507e2f[_0xadff('0x10a')](_0x4686f8[_0xadff('0x61')]['ids'],_[_0xadff('0xe1')](_0x4686f8[_0xadff('0x61')],['ids','id'])||{});}})[_0xadff('0x24')](respondWithResult(_0x284362,null))[_0xadff('0x55')](handleError(_0x284362,null));};exports[_0xadff('0x10c')]=function(_0x5ec6ab,_0x59ba9d,_0x4bc178){var _0x5770dd={};var _0x1f9b90={};var _0x2f075c;var _0x48464f;return db['ChatWebsite'][_0xadff('0x68')]({'where':{'id':_0x5ec6ab['params']['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x59ba9d,null))[_0xadff('0x24')](function(_0xa0df3c){if(_0xa0df3c){_0x2f075c=_0xa0df3c;_0x1f9b90[_0xadff('0x43')]=_['keys'](db['ChatProactiveAction'][_0xadff('0x40')]);_0x1f9b90[_0xadff('0x44')]=_['keys'](_0x5ec6ab['query']);_0x1f9b90[_0xadff('0x45')]=_[_0xadff('0x46')](_0x1f9b90[_0xadff('0x43')],_0x1f9b90[_0xadff('0x44')]);_0x5770dd['attributes']=_[_0xadff('0x46')](_0x1f9b90[_0xadff('0x43')],qs[_0xadff('0x48')](_0x5ec6ab[_0xadff('0x44')][_0xadff('0x48')]));_0x5770dd[_0xadff('0x47')]=_0x5770dd['attributes']['length']?_0x5770dd[_0xadff('0x47')]:_0x1f9b90['model'];_0x5770dd[_0xadff('0x4b')]=qs[_0xadff('0x4c')](_0x5ec6ab['query'][_0xadff('0x4c')]);_0x5770dd[_0xadff('0x4d')]=qs['filters'](_[_0xadff('0x6a')](_0x5ec6ab[_0xadff('0x44')],_0x1f9b90[_0xadff('0x45')]));if(_0x5ec6ab[_0xadff('0x44')]['filter']){_0x5770dd[_0xadff('0x4d')]=_[_0xadff('0x50')](_0x5770dd[_0xadff('0x4d')],{'$or':_[_0xadff('0x3e')](_0x5770dd[_0xadff('0x47')],function(_0x257ef7){var _0x2f6c05={};_0x2f6c05[_0x257ef7]={'$like':'%'+_0x5ec6ab[_0xadff('0x44')][_0xadff('0x4e')]+'%'};return _0x2f6c05;})});}_0x5770dd=_['merge']({},_0x5770dd,_0x5ec6ab[_0xadff('0x59')]);return _0x2f075c[_0xadff('0x10c')](_0x5770dd);}})[_0xadff('0x24')](function(_0x3aee14){if(_0x3aee14){_0x48464f=_0x3aee14[_0xadff('0x71')];if(!_0x5ec6ab['query'][_0xadff('0x49')](_0xadff('0x69'))){_0x5770dd[_0xadff('0x4a')]=qs[_0xadff('0x4a')](_0x5ec6ab['query'][_0xadff('0x4a')]);_0x5770dd[_0xadff('0x30')]=qs[_0xadff('0x30')](_0x5ec6ab[_0xadff('0x44')]['offset']);}return _0x2f075c['getProactiveActions'](_0x5770dd);}})[_0xadff('0x24')](function(_0x8b2456){if(_0x8b2456){return _0x8b2456?{'count':_0x48464f,'rows':_0x8b2456}:null;}})[_0xadff('0x24')](respondWithResult(_0x59ba9d,null))['catch'](handleError(_0x59ba9d,null));};exports[_0xadff('0x10d')]=function(_0x546a8a,_0xc6968,_0x50c5c4){var _0x3a46c5=_0x546a8a[_0xadff('0x44')][_0xadff('0x10e')]==='false'?_0xadff('0x10f'):_0xadff('0x110');return db['ChatWebsite'][_0xadff('0x5a')]({'attributes':['id',_0x3a46c5],'where':{'id':_0x546a8a[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0xc6968,null))[_0xadff('0x24')](function(_0x1d9a78){if(_0x1d9a78){var _0x3665f7=_0x1d9a78[_0x3a46c5];var _0x5d7b21=_0x3665f7&&_0x3665f7[_0xadff('0x111')]?_0x3665f7['items']:[];_0xc6968['send']({'fromKey':_[_0xadff('0x8e')](_0x3665f7[_0xadff('0x112')])?undefined:_0x3665f7['fromKey'],'count':_0x5d7b21[_0xadff('0x71')],'rows':_0x5d7b21});}})[_0xadff('0x55')](handleError(_0xc6968,null));};exports[_0xadff('0x113')]=function(_0x56dd7d,_0x178d9b,_0x5a310d){var _0x34b03f={'raw':![],'where':{}};var _0x41b7f1={};var _0x4c29d4={'count':0x0,'rows':[]};return db[_0xadff('0x3f')][_0xadff('0x68')]({'where':{'id':_0x56dd7d['params']['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x178d9b,null))['then'](function(_0x389613){if(_0x389613){_0x41b7f1[_0xadff('0x43')]=_['keys'](db[_0xadff('0x114')][_0xadff('0x40')]);_0x41b7f1[_0xadff('0x44')]=_[_0xadff('0x58')](_0x56dd7d[_0xadff('0x44')]);_0x41b7f1[_0xadff('0x45')]=_[_0xadff('0x46')](_0x41b7f1[_0xadff('0x43')],_0x41b7f1['query']);_0x34b03f[_0xadff('0x47')]=_[_0xadff('0x46')](_0x41b7f1[_0xadff('0x43')],qs['fields'](_0x56dd7d[_0xadff('0x44')][_0xadff('0x48')]));_0x34b03f[_0xadff('0x47')]=_0x34b03f['attributes'][_0xadff('0x71')]?_0x34b03f[_0xadff('0x47')]:_0x41b7f1[_0xadff('0x43')];if(!_0x56dd7d[_0xadff('0x44')][_0xadff('0x49')]('nolimit')){_0x34b03f[_0xadff('0x4a')]=qs['limit'](_0x56dd7d[_0xadff('0x44')][_0xadff('0x4a')]);_0x34b03f[_0xadff('0x30')]=qs['offset'](_0x56dd7d[_0xadff('0x44')]['offset']);}_0x34b03f['order']=qs[_0xadff('0x4c')](_0x56dd7d[_0xadff('0x44')][_0xadff('0x4c')]);_0x34b03f[_0xadff('0x4d')]=qs[_0xadff('0x45')](_[_0xadff('0x6a')](_0x56dd7d[_0xadff('0x44')],_0x41b7f1[_0xadff('0x45')]));_0x34b03f[_0xadff('0x4d')]['ChatWebsiteId']=_0x389613['id'];if(_0x56dd7d['query'][_0xadff('0x4e')]){_0x34b03f[_0xadff('0x4d')]=_[_0xadff('0x50')](_0x34b03f[_0xadff('0x4d')],{'$or':_['map'](_0x34b03f[_0xadff('0x47')],function(_0x308235){var _0xf5addb={};_0xf5addb[_0x308235]={'$like':'%'+_0x56dd7d[_0xadff('0x44')][_0xadff('0x4e')]+'%'};return _0xf5addb;})});}_0x34b03f=_[_0xadff('0x50')]({},_0x34b03f,_0x56dd7d[_0xadff('0x59')]);return db[_0xadff('0x114')][_0xadff('0x51')]({'where':_0x34b03f[_0xadff('0x4d')]})[_0xadff('0x24')](function(_0x1644fe){_0x4c29d4[_0xadff('0x51')]=_0x1644fe;if(_0x56dd7d[_0xadff('0x44')][_0xadff('0x52')]){_0x34b03f['include']=[{'all':!![]}];}else{_0x34b03f['include']=[{'model':db[_0xadff('0x93')],'as':_0xadff('0xe2'),'required':![]}];}return db[_0xadff('0x114')][_0xadff('0x6b')](_0x34b03f);})[_0xadff('0x24')](function(_0x1d3056){_0x4c29d4['rows']=_0x1d3056;return _0x4c29d4;});}})[_0xadff('0x24')](respondWithFilteredResult(_0x178d9b,_0x34b03f))[_0xadff('0x55')](handleError(_0x178d9b,null));};exports[_0xadff('0x115')]=function(_0x275cc7,_0x16b46e,_0x342923){return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x275cc7['params']['id']}})['then'](handleEntityNotFound(_0x16b46e,null))[_0xadff('0x24')](function(_0x39e8f1){if(_0x39e8f1){return _0x39e8f1[_0xadff('0x115')](_0x275cc7[_0xadff('0x61')][_0xadff('0x6d')],_[_0xadff('0xe1')](_0x275cc7[_0xadff('0x61')],[_0xadff('0x6d'),'id'])||{})[_0xadff('0x116')](function(_0x3b5319){for(var _0xf45e5c=0x0;_0xf45e5c<_0x275cc7[_0xadff('0x61')]['ids'][_0xadff('0x71')];_0xf45e5c+=0x1){socket[_0xadff('0x117')](_0xadff('0x118'),{'UserId':_0x275cc7['body'][_0xadff('0x6d')][_0xf45e5c],'ChatWebsiteId':_0x275cc7[_0xadff('0x62')]['id']});}return _0x3b5319;});}})['then'](respondWithResult(_0x16b46e,null))[_0xadff('0x55')](handleError(_0x16b46e,null));};exports[_0xadff('0x119')]=function(_0x2ffc72,_0x3bd4ed,_0x1934c1){return db[_0xadff('0x3f')][_0xadff('0x5a')]({'where':{'id':_0x2ffc72[_0xadff('0x62')]['id']}})['then'](handleEntityNotFound(_0x3bd4ed,null))[_0xadff('0x24')](function(_0x315210){if(_0x315210){return _0x315210[_0xadff('0x119')](_0x2ffc72[_0xadff('0x44')][_0xadff('0x6d')])[_0xadff('0x24')](function(){if(_[_0xadff('0x11a')](_0x2ffc72[_0xadff('0x44')][_0xadff('0x6d')])){for(var _0x4eed92=0x0;_0x4eed92<_0x2ffc72[_0xadff('0x44')]['ids']['length'];_0x4eed92+=0x1){socket['emit'](_0xadff('0x11b'),{'UserId':Number(_0x2ffc72['query'][_0xadff('0x6d')][_0x4eed92]),'ChatWebsiteId':Number(_0x2ffc72[_0xadff('0x62')]['id'])});}}else{socket[_0xadff('0x117')]('userChatWebsite:remove',{'UserId':Number(_0x2ffc72['query'][_0xadff('0x6d')]),'ChatWebsiteId':Number(_0x2ffc72['params']['id'])});}});}})[_0xadff('0x24')](respondWithStatusCode(_0x3bd4ed,null))['catch'](handleError(_0x3bd4ed,null));};exports[_0xadff('0x11c')]=function(_0x154841,_0x5da85f,_0x1d1849){var _0x25235d={};var _0xa5ca48={};var _0x3bf4d4;var _0x5cb628;return db[_0xadff('0x3f')][_0xadff('0x68')]({'where':{'id':_0x154841[_0xadff('0x62')]['id']}})[_0xadff('0x24')](handleEntityNotFound(_0x5da85f,null))[_0xadff('0x24')](function(_0x16c551){if(_0x16c551){_0x3bf4d4=_0x16c551;_0xa5ca48[_0xadff('0x43')]=_[_0xadff('0x58')](db[_0xadff('0xc2')][_0xadff('0x40')]);_0xa5ca48[_0xadff('0x44')]=_[_0xadff('0x58')](_0x154841['query']);_0xa5ca48['filters']=_[_0xadff('0x46')](_0xa5ca48['model'],_0xa5ca48[_0xadff('0x44')]);_0x25235d[_0xadff('0x47')]=_[_0xadff('0x46')](_0xa5ca48[_0xadff('0x43')],qs[_0xadff('0x48')](_0x154841[_0xadff('0x44')]['fields']));_0x25235d['attributes']=_0x25235d[_0xadff('0x47')][_0xadff('0x71')]?_0x25235d[_0xadff('0x47')]:_0xa5ca48[_0xadff('0x43')];_0x25235d[_0xadff('0x4b')]=qs[_0xadff('0x4c')](_0x154841['query']['sort']);_0x25235d[_0xadff('0x4d')]=qs['filters'](_[_0xadff('0x6a')](_0x154841[_0xadff('0x44')],_0xa5ca48[_0xadff('0x45')]));if(_0x154841[_0xadff('0x44')][_0xadff('0x4e')]){_0x25235d['where']=_[_0xadff('0x50')](_0x25235d[_0xadff('0x4d')],{'$or':_[_0xadff('0x3e')](_0x25235d['attributes'],function(_0x2828b2){var _0x76e756={};_0x76e756[_0x2828b2]={'$like':'%'+_0x154841['query'][_0xadff('0x4e')]+'%'};return _0x76e756;})});}_0x25235d=_[_0xadff('0x50')]({},_0x25235d,_0x154841[_0xadff('0x59')]);return _0x3bf4d4['getAgents'](_0x25235d);}})[_0xadff('0x24')](function(_0x2df153){if(_0x2df153){_0x5cb628=_0x2df153[_0xadff('0x71')];if(!_0x154841[_0xadff('0x44')][_0xadff('0x49')](_0xadff('0x69'))){_0x25235d[_0xadff('0x4a')]=qs['limit'](_0x154841[_0xadff('0x44')]['limit']);_0x25235d['offset']=qs['offset'](_0x154841[_0xadff('0x44')][_0xadff('0x30')]);}return _0x3bf4d4[_0xadff('0x11c')](_0x25235d);}})['then'](function(_0x3485b6){if(_0x3485b6){return _0x3485b6?{'count':_0x5cb628,'rows':_0x3485b6}:null;}})[_0xadff('0x24')](respondWithResult(_0x5da85f,null))[_0xadff('0x55')](handleError(_0x5da85f,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 7891e82..047ded7 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 _0x3212=['exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3a7b8b,_0xa5c309){var _0x2e94c1=function(_0x47fc6d){while(--_0x47fc6d){_0x3a7b8b['push'](_0x3a7b8b['shift']());}};_0x2e94c1(++_0xa5c309);}(_0x3212,0x6f));var _0x2321=function(_0x1f5e13,_0x3f63c7){_0x1f5e13=_0x1f5e13-0x0;var _0x2e6c36=_0x3212[_0x1f5e13];return _0x2e6c36;};'use strict';var EventEmitter=require(_0x2321('0x0'));var ChatWebsite=require(_0x2321('0x1'))['db'][_0x2321('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2321('0x3')](0x0);var events={'afterCreate':_0x2321('0x4'),'afterUpdate':_0x2321('0x5'),'afterDestroy':_0x2321('0x6')};function emitEvent(_0x216f64){return function(_0x4732b7,_0x3e090a,_0x32b9c4){ChatWebsiteEvents[_0x2321('0x7')](_0x216f64+':'+_0x4732b7['id'],_0x4732b7);ChatWebsiteEvents['emit'](_0x216f64,_0x4732b7);_0x32b9c4(null);};}for(var e in events){if(events[_0x2321('0x8')](e)){var event=events[e];ChatWebsite[_0x2321('0x9')](e,emitEvent(event));}}module[_0x2321('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0xcba7=['../../mysqldb','ChatWebsite','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xcba7,0x199));var _0x7cba=function(_0x5b97f0,_0x2ef08c){_0x5b97f0=_0x5b97f0-0x0;var _0x2101a8=_0xcba7[_0x5b97f0];return _0x2101a8;};'use strict';var EventEmitter=require(_0x7cba('0x0'));var ChatWebsite=require(_0x7cba('0x1'))['db'][_0x7cba('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x7cba('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7cba('0x4'),'afterDestroy':_0x7cba('0x5')};function emitEvent(_0x3b5d2d){return function(_0x4fa145,_0x251250,_0x154c08){ChatWebsiteEvents[_0x7cba('0x6')](_0x3b5d2d+':'+_0x4fa145['id'],_0x4fa145);ChatWebsiteEvents[_0x7cba('0x6')](_0x3b5d2d,_0x4fa145);_0x154c08(null);};}for(var e in events){if(events[_0x7cba('0x7')](e)){var event=events[e];ChatWebsite[_0x7cba('0x8')](e,emitEvent(event));}}module[_0x7cba('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index f63efe4..7c78467 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 _0x58a4=['bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment'];(function(_0x50e103,_0x1dfd08){var _0x4feebb=function(_0x445fe4){while(--_0x445fe4){_0x50e103['push'](_0x50e103['shift']());}};_0x4feebb(++_0x1dfd08);}(_0x58a4,0xbf));var _0x458a=function(_0x24c39a,_0x48fc91){_0x24c39a=_0x24c39a-0x0;var _0x4c2fa6=_0x58a4[_0x24c39a];return _0x4c2fa6;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var logger=require(_0x458a('0x2'))(_0x458a('0x3'));var moment=require(_0x458a('0x4'));var BPromise=require(_0x458a('0x5'));var rp=require(_0x458a('0x6'));var fs=require('fs');var path=require(_0x458a('0x7'));var rimraf=require(_0x458a('0x8'));var config=require(_0x458a('0x9'));var attributes=require(_0x458a('0xa'));module[_0x458a('0xb')]=function(_0x2f5d44,_0x57de3c){return _0x2f5d44['define'](_0x458a('0xc'),attributes,{'tableName':_0x458a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74f0=['define','ChatWebsite','chat_websites','util','moment','bluebird','request-promise','path','./chatWebsite.attributes','exports'];(function(_0x324aa9,_0x1cdc6d){var _0x457f10=function(_0x2cdb4e){while(--_0x2cdb4e){_0x324aa9['push'](_0x324aa9['shift']());}};_0x457f10(++_0x1cdc6d);}(_0x74f0,0xf3));var _0x074f=function(_0x5a585b,_0x3e0674){_0x5a585b=_0x5a585b-0x0;var _0x4cd398=_0x74f0[_0x5a585b];return _0x4cd398;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x074f('0x1'));var BPromise=require(_0x074f('0x2'));var rp=require(_0x074f('0x3'));var fs=require('fs');var path=require(_0x074f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x074f('0x5'));module[_0x074f('0x6')]=function(_0x203f47,_0x126607){return _0x203f47[_0x074f('0x7')](_0x074f('0x8'),attributes,{'tableName':_0x074f('0x9'),'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 39c3f49..ea91846 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 _0xc1c6=['./chatWebsite.socket','register','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter'];(function(_0x1043cd,_0x2656a8){var _0x831f67=function(_0x4c7613){while(--_0x4c7613){_0x1043cd['push'](_0x1043cd['shift']());}};_0x831f67(++_0x2656a8);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x533bd6,_0x2c11a0){_0x533bd6=_0x533bd6-0x0;var _0x58f7e6=_0xc1c6[_0x533bd6];return _0x58f7e6;};'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});config['redis']=_[_0x6c1c('0x9')](config[_0x6c1c('0xa')],{'host':_0x6c1c('0xb'),'port':0x18eb});var socket=require(_0x6c1c('0xc'))(new Redis(config['redis']));require(_0x6c1c('0xd'))[_0x6c1c('0xe')](socket);function respondWithRpcPromise(_0x524d21,_0x147c7b,_0x36275f){return new BPromise(function(_0xb3bd12,_0x1137e8){return client['request'](_0x524d21,_0x36275f)[_0x6c1c('0xf')](function(_0x2a4fd4){logger[_0x6c1c('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));logger[_0x6c1c('0x12')](_0x6c1c('0x13'),_0x147c7b,'request\x20sent',JSON[_0x6c1c('0x14')](_0x2a4fd4));if(_0x2a4fd4['error']){if(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x16')]===0x1f4){logger[_0x6c1c('0x15')](_0x6c1c('0x17'),_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0x1137e8(_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);}logger[_0x6c1c('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x2a4fd4[_0x6c1c('0x15')][_0x6c1c('0x18')]);return _0xb3bd12(_0x2a4fd4['error'][_0x6c1c('0x18')]);}else{logger[_0x6c1c('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x6c1c('0x11'));_0xb3bd12(_0x2a4fd4['result'][_0x6c1c('0x18')]);}})[_0x6c1c('0x19')](function(_0x5a3bb7){logger[_0x6c1c('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x147c7b,_0x5a3bb7);_0x1137e8(_0x5a3bb7);});});} \ No newline at end of file +var _0x33af=['result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3fd33b,_0x5d2d11){var _0x32e0fa=function(_0x4cb979){while(--_0x4cb979){_0x3fd33b['push'](_0x3fd33b['shift']());}};_0x32e0fa(++_0x5d2d11);}(_0x33af,0xec));var _0xf33a=function(_0x461119,_0x28ce98){_0x461119=_0x461119-0x0;var _0x4b5ed3=_0x33af[_0x461119];return _0x4b5ed3;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});config[_0xf33a('0xa')]=_[_0xf33a('0xb')](config[_0xf33a('0xa')],{'host':_0xf33a('0xc'),'port':0x18eb});var socket=require(_0xf33a('0xd'))(new Redis(config['redis']));require(_0xf33a('0xe'))[_0xf33a('0xf')](socket);function respondWithRpcPromise(_0x115e08,_0x457b3b,_0x44ee7f){return new BPromise(function(_0x27f30a,_0x5074a2){return client['request'](_0x115e08,_0x44ee7f)[_0xf33a('0x10')](function(_0xb47cde){logger[_0xf33a('0x11')](_0xf33a('0x12'),_0x457b3b,_0xf33a('0x13'));logger['debug'](_0xf33a('0x14'),_0x457b3b,_0xf33a('0x13'),JSON['stringify'](_0xb47cde));if(_0xb47cde['error']){if(_0xb47cde[_0xf33a('0x15')][_0xf33a('0x16')]===0x1f4){logger[_0xf33a('0x15')](_0xf33a('0x12'),_0x457b3b,_0xb47cde[_0xf33a('0x15')][_0xf33a('0x17')]);return _0x5074a2(_0xb47cde[_0xf33a('0x15')][_0xf33a('0x17')]);}logger['error'](_0xf33a('0x12'),_0x457b3b,_0xb47cde['error'][_0xf33a('0x17')]);return _0x27f30a(_0xb47cde[_0xf33a('0x15')]['message']);}else{logger[_0xf33a('0x11')](_0xf33a('0x12'),_0x457b3b,'request\x20sent');_0x27f30a(_0xb47cde[_0xf33a('0x18')][_0xf33a('0x17')]);}})[_0xf33a('0x19')](function(_0x2a9f0e){logger['error'](_0xf33a('0x12'),_0x457b3b,_0x2a9f0e);_0x5074a2(_0x2a9f0e);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index a024906..d97d2bd 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x178ca4,_0x5aaa16){var _0x57f6a8=function(_0x237032){while(--_0x237032){_0x178ca4['push'](_0x178ca4['shift']());}};_0x57f6a8(++_0x5aaa16);}(_0xb10b,0x12a));var _0xbb10=function(_0x20bedd,_0x39694b){_0x20bedd=_0x20bedd-0x0;var _0x3041f3=_0xb10b[_0x20bedd];return _0x3041f3;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x1b17af,_0x260964){var _0x5491f7=function(_0x191e45){while(--_0x191e45){_0x1b17af['push'](_0x1b17af['shift']());}};_0x5491f7(++_0x260964);}(_0x7a54,0x106));var _0x47a5=function(_0x5226c4,_0x5a2b77){_0x5226c4=_0x5226c4-0x0;var _0x4888d3=_0x7a54[_0x5226c4];return _0x4888d3;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 3f291f9..0b16465 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 _0xbb29=['delete','removeAnswers','removeAgents','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','getAgents','post','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','single','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addSystemAvatar','/:id/notify','/:id/offline','addInteraction','addApplications','addProactiveActions','/:id/users','put','/:id','update','destroy'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xbb29,0x1bd));var _0x9bb2=function(_0xc68d79,_0x207ce0){_0xc68d79=_0xc68d79-0x0;var _0x323584=_0xbb29[_0xc68d79];return _0x323584;};'use strict';var multer=require(_0x9bb2('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9bb2('0x1'));var express=require(_0x9bb2('0x2'));var router=express['Router']();var auth=require(_0x9bb2('0x3'));var interaction=require(_0x9bb2('0x4'));var config=require(_0x9bb2('0x5'));var controller=require(_0x9bb2('0x6'));router[_0x9bb2('0x7')]('/',auth[_0x9bb2('0x8')](),controller[_0x9bb2('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9bb2('0xa')]);router[_0x9bb2('0x7')]('/:id',auth[_0x9bb2('0x8')](),controller[_0x9bb2('0xb')]);router[_0x9bb2('0x7')](_0x9bb2('0xc'),auth[_0x9bb2('0x8')](),controller[_0x9bb2('0xd')]);router[_0x9bb2('0x7')](_0x9bb2('0xe'),auth[_0x9bb2('0x8')](),controller[_0x9bb2('0xf')]);router[_0x9bb2('0x7')](_0x9bb2('0x10'),controller[_0x9bb2('0x11')]);router[_0x9bb2('0x7')](_0x9bb2('0x12'),controller[_0x9bb2('0x13')]);router['get']('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0x9bb2('0x7')](_0x9bb2('0x14'),controller[_0x9bb2('0x15')]);router[_0x9bb2('0x7')](_0x9bb2('0x16'),auth[_0x9bb2('0x8')](),controller[_0x9bb2('0x17')]);router[_0x9bb2('0x7')](_0x9bb2('0x18'),controller[_0x9bb2('0x19')]);router['get'](_0x9bb2('0x1a'),auth[_0x9bb2('0x8')](),controller['getApplications']);router['get'](_0x9bb2('0x1b'),auth[_0x9bb2('0x8')](),controller[_0x9bb2('0x1c')]);router[_0x9bb2('0x7')](_0x9bb2('0x1d'),controller[_0x9bb2('0x1e')]);router[_0x9bb2('0x7')]('/:id/offline_messages',auth[_0x9bb2('0x8')](),controller[_0x9bb2('0x1f')]);router[_0x9bb2('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x9bb2('0x20')]);router[_0x9bb2('0x21')]('/',auth[_0x9bb2('0x8')](),controller['create']);router['post']('/:id/dispositions',auth[_0x9bb2('0x8')](),controller['addDisposition']);router[_0x9bb2('0x21')](_0x9bb2('0xe'),auth[_0x9bb2('0x8')](),controller[_0x9bb2('0x22')]);var upload=multer({'storage':multer[_0x9bb2('0x23')]({'destination':function(_0xe8af19,_0x2c7050,_0x5520c2){_0x5520c2(null,path[_0x9bb2('0x24')](config[_0x9bb2('0x25')],_0x9bb2('0x26')));},'filename':function(_0x49fdea,_0x3f892e,_0x1a1721){_0x1a1721(null,util[_0x9bb2('0x27')](_0x9bb2('0x28'),Date[_0x9bb2('0x29')](),_0x3f892e[_0x9bb2('0x2a')]));}})});router[_0x9bb2('0x21')](_0x9bb2('0x10'),upload['single'](_0x9bb2('0x2b')),controller['addLogo']);var upload=multer({'storage':multer[_0x9bb2('0x23')]({'destination':function(_0x567b3a,_0x4236b3,_0x4c876b){_0x4c876b(null,path[_0x9bb2('0x24')](config[_0x9bb2('0x25')],'server/files/images/avatars/'));},'filename':function(_0x5eca56,_0x3357c0,_0x1fc33f){_0x1fc33f(null,util['format']('%s-%s',Date['now'](),_0x3357c0['originalname']));}})});router[_0x9bb2('0x21')](_0x9bb2('0x12'),upload[_0x9bb2('0x2c')](_0x9bb2('0x2b')),controller[_0x9bb2('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5e46c3,_0x4583bf,_0x3b3ff9){_0x3b3ff9(null,path[_0x9bb2('0x24')](config[_0x9bb2('0x25')],_0x9bb2('0x2e')));},'filename':function(_0x8722ee,_0x521545,_0x4489dd){_0x4489dd(null,util[_0x9bb2('0x27')](_0x9bb2('0x28'),Date[_0x9bb2('0x29')](),_0x521545[_0x9bb2('0x2a')]));}})});router['post'](_0x9bb2('0x2f'),upload[_0x9bb2('0x2c')](_0x9bb2('0x2b')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x9bb2('0x23')]({'destination':function(_0x3f69de,_0x2b5cca,_0x45aca4){_0x45aca4(null,path[_0x9bb2('0x24')](config[_0x9bb2('0x25')],_0x9bb2('0x2e')));},'filename':function(_0x30c31f,_0x3cfba5,_0x5e8c70){_0x5e8c70(null,util[_0x9bb2('0x27')](_0x9bb2('0x28'),Date['now'](),_0x3cfba5[_0x9bb2('0x2a')]));}})});router[_0x9bb2('0x21')]('/:id/system_avatar',upload['single'](_0x9bb2('0x2b')),controller[_0x9bb2('0x30')]);router[_0x9bb2('0x21')](_0x9bb2('0x31'),controller['notify']);router[_0x9bb2('0x21')](_0x9bb2('0x32'),controller['offline']);router[_0x9bb2('0x21')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x9bb2('0x33')]);router[_0x9bb2('0x21')](_0x9bb2('0x1a'),auth[_0x9bb2('0x8')](),controller[_0x9bb2('0x34')]);router['post'](_0x9bb2('0x1b'),auth['isAuthenticated'](),controller[_0x9bb2('0x35')]);router[_0x9bb2('0x21')](_0x9bb2('0x36'),auth[_0x9bb2('0x8')](),controller['addAgents']);router[_0x9bb2('0x37')](_0x9bb2('0x38'),auth[_0x9bb2('0x8')](),controller[_0x9bb2('0x39')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9bb2('0x3a')]);router[_0x9bb2('0x3b')](_0x9bb2('0xc'),auth[_0x9bb2('0x8')](),controller['removeDispositions']);router[_0x9bb2('0x3b')](_0x9bb2('0xe'),auth[_0x9bb2('0x8')](),controller[_0x9bb2('0x3c')]);router['delete'](_0x9bb2('0x36'),auth[_0x9bb2('0x8')](),controller[_0x9bb2('0x3d')]);module[_0x9bb2('0x3e')]=router; \ No newline at end of file +var _0xba1a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','join','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','/:id/interactions','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','/:id/users','exports','path','connect-timeout'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xba1a,0xc7));var _0xaba1=function(_0x359f21,_0x37afb8){_0x359f21=_0x359f21-0x0;var _0x2d6ce7=_0xba1a[_0x359f21];return _0x2d6ce7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaba1('0x0'));var timeout=require(_0xaba1('0x1'));var express=require(_0xaba1('0x2'));var router=express[_0xaba1('0x3')]();var auth=require(_0xaba1('0x4'));var interaction=require(_0xaba1('0x5'));var config=require(_0xaba1('0x6'));var controller=require(_0xaba1('0x7'));router['get']('/',auth[_0xaba1('0x8')](),controller['index']);router[_0xaba1('0x9')]('/describe',auth[_0xaba1('0x8')](),controller[_0xaba1('0xa')]);router[_0xaba1('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xaba1('0xb')]);router[_0xaba1('0x9')](_0xaba1('0xc'),auth[_0xaba1('0x8')](),controller[_0xaba1('0xd')]);router[_0xaba1('0x9')]('/:id/canned_answers',auth[_0xaba1('0x8')](),controller[_0xaba1('0xe')]);router[_0xaba1('0x9')](_0xaba1('0xf'),controller[_0xaba1('0x10')]);router['get'](_0xaba1('0x11'),controller[_0xaba1('0x12')]);router['get'](_0xaba1('0x13'),controller[_0xaba1('0x14')]);router[_0xaba1('0x9')]('/:id/system_avatar',controller['getSystemAvatar']);router['get']('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0xaba1('0x9')]('/:id/snippet',controller[_0xaba1('0x15')]);router[_0xaba1('0x9')](_0xaba1('0x16'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x17')]);router[_0xaba1('0x9')](_0xaba1('0x18'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x19')]);router['get'](_0xaba1('0x1a'),controller[_0xaba1('0x1b')]);router[_0xaba1('0x9')](_0xaba1('0x1c'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x1d')]);router['get']('/:id/users',auth[_0xaba1('0x8')](),controller[_0xaba1('0x1e')]);router[_0xaba1('0x1f')]('/',auth['isAuthenticated'](),controller[_0xaba1('0x20')]);router[_0xaba1('0x1f')](_0xaba1('0xc'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x21')]);router[_0xaba1('0x1f')](_0xaba1('0x22'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x23')]);var upload=multer({'storage':multer[_0xaba1('0x24')]({'destination':function(_0x1b24aa,_0x437264,_0x3e55e3){_0x3e55e3(null,path['join'](config[_0xaba1('0x25')],_0xaba1('0x26')));},'filename':function(_0x5b9888,_0x1dfed8,_0x47be35){_0x47be35(null,util[_0xaba1('0x27')](_0xaba1('0x28'),Date[_0xaba1('0x29')](),_0x1dfed8[_0xaba1('0x2a')]));}})});router['post'](_0xaba1('0xf'),upload[_0xaba1('0x2b')](_0xaba1('0x2c')),controller[_0xaba1('0x2d')]);var upload=multer({'storage':multer[_0xaba1('0x24')]({'destination':function(_0x576f52,_0x3c0419,_0x184df0){_0x184df0(null,path[_0xaba1('0x2e')](config[_0xaba1('0x25')],_0xaba1('0x2f')));},'filename':function(_0x59d976,_0x58c4fc,_0x200639){_0x200639(null,util['format'](_0xaba1('0x28'),Date['now'](),_0x58c4fc[_0xaba1('0x2a')]));}})});router[_0xaba1('0x1f')](_0xaba1('0x11'),upload['single'](_0xaba1('0x2c')),controller[_0xaba1('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x294695,_0x1db4c3,_0x34a055){_0x34a055(null,path['join'](config['root'],_0xaba1('0x2f')));},'filename':function(_0x41a667,_0x2eb850,_0x537534){_0x537534(null,util[_0xaba1('0x27')](_0xaba1('0x28'),Date[_0xaba1('0x29')](),_0x2eb850['originalname']));}})});router[_0xaba1('0x1f')](_0xaba1('0x13'),upload['single'](_0xaba1('0x2c')),controller[_0xaba1('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x44f750,_0x4945d2,_0x4e97de){_0x4e97de(null,path[_0xaba1('0x2e')](config[_0xaba1('0x25')],'server/files/images/avatars/'));},'filename':function(_0x227a53,_0x5c8c6d,_0xee5d13){_0xee5d13(null,util[_0xaba1('0x27')](_0xaba1('0x28'),Date['now'](),_0x5c8c6d['originalname']));}})});router[_0xaba1('0x1f')]('/:id/system_avatar',upload[_0xaba1('0x2b')](_0xaba1('0x2c')),controller[_0xaba1('0x32')]);router[_0xaba1('0x1f')](_0xaba1('0x33'),controller[_0xaba1('0x34')]);router[_0xaba1('0x1f')](_0xaba1('0x35'),controller[_0xaba1('0x36')]);router['post'](_0xaba1('0x37'),auth[_0xaba1('0x8')](),controller['addInteraction']);router[_0xaba1('0x1f')](_0xaba1('0x16'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x38')]);router[_0xaba1('0x1f')]('/:id/proactive_actions',auth[_0xaba1('0x8')](),controller[_0xaba1('0x39')]);router[_0xaba1('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0xaba1('0x3a')]);router[_0xaba1('0x3b')](_0xaba1('0x3c'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x3d')]);router[_0xaba1('0x3e')](_0xaba1('0x3c'),auth[_0xaba1('0x8')](),controller['destroy']);router[_0xaba1('0x3e')](_0xaba1('0xc'),auth[_0xaba1('0x8')](),controller[_0xaba1('0x3f')]);router[_0xaba1('0x3e')]('/:id/canned_answers',auth[_0xaba1('0x8')](),controller[_0xaba1('0x40')]);router[_0xaba1('0x3e')](_0xaba1('0x41'),auth[_0xaba1('0x8')](),controller['removeAgents']);module[_0xaba1('0x42')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 18ab9c5..4182a46 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 _0x0d4d=['sequelize','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x2cf140,_0x12e794){var _0x469288=function(_0x5b003a){while(--_0x5b003a){_0x2cf140['push'](_0x2cf140['shift']());}};_0x469288(++_0x12e794);}(_0x0d4d,0x132));var _0xd0d4=function(_0x56cd17,_0x58dc7f){_0x56cd17=_0x56cd17-0x0;var _0x432afa=_0x0d4d[_0x56cd17];return _0x432afa;};'use strict';var Sequelize=require(_0xd0d4('0x0'));module[_0xd0d4('0x1')]={'name':{'type':Sequelize[_0xd0d4('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd0d4('0x3')](_0xd0d4('0x4'),_0xd0d4('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xd0d4('0x2')]}}; \ No newline at end of file +var _0xf31b=['AmazonAWS','Google','sequelize','exports','STRING','ENUM'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xf31b,0x1a0));var _0xbf31=function(_0x1ce18b,_0x273e58){_0x1ce18b=_0x1ce18b-0x0;var _0x32d908=_0xf31b[_0x1ce18b];return _0x32d908;};'use strict';var Sequelize=require(_0xbf31('0x0'));module[_0xbf31('0x1')]={'name':{'type':Sequelize[_0xbf31('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xbf31('0x3')](_0xbf31('0x4'),_0xbf31('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xbf31('0x2')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 425c5ed..473759f 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 _0xc2d5=['VIRTUAL','include','rows','catch','params','length','includeAll','find','create','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','error','name','send','index','map','CloudProvider','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x4bf983,_0x17fde2){var _0x4eb726=function(_0x53bace){while(--_0x53bace){_0x4bf983['push'](_0x4bf983['shift']());}};_0x4eb726(++_0x17fde2);}(_0xc2d5,0x19d));var _0x5c2d=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xc2d5[_0xb0f7c3];return _0x28ea68;};'use strict';var pdf=require(_0x5c2d('0x0'));var emlformat=require(_0x5c2d('0x1'));var rimraf=require(_0x5c2d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c2d('0x3'));var rp=require(_0x5c2d('0x4'));var moment=require(_0x5c2d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5c2d('0x6'));var sox=require(_0x5c2d('0x7'));var csv=require(_0x5c2d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5c2d('0x9'));var squel=require('squel');var crypto=require(_0x5c2d('0xa'));var jsforce=require(_0x5c2d('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5c2d('0xc'));var Papa=require(_0x5c2d('0xd'));var Redis=require(_0x5c2d('0xe'));var authService=require(_0x5c2d('0xf'));var qs=require(_0x5c2d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c2d('0x11'));var logger=require(_0x5c2d('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x5c2d('0x13'));var db=require(_0x5c2d('0x14'))['db'];function respondWithStatusCode(_0x11e827,_0x2aae2e){_0x2aae2e=_0x2aae2e||0xcc;return function(_0x3b0d52){if(_0x3b0d52){return _0x11e827[_0x5c2d('0x15')](_0x2aae2e);}return _0x11e827[_0x5c2d('0x16')](_0x2aae2e)[_0x5c2d('0x17')]();};}function respondWithResult(_0x196518,_0x1ff526){_0x1ff526=_0x1ff526||0xc8;return function(_0x1b59d5){if(_0x1b59d5){return _0x196518[_0x5c2d('0x16')](_0x1ff526)[_0x5c2d('0x18')](_0x1b59d5);}};}function respondWithFilteredResult(_0x194f0d,_0x515fe9){return function(_0x346906){if(_0x346906){var _0x38155c=_0x346906[_0x5c2d('0x19')],_0xa7db0d=_0x515fe9[_0x5c2d('0x1a')],_0x111d0c=_0x515fe9[_0x5c2d('0x1a')]+_0x515fe9[_0x5c2d('0x1b')],_0x2d5fe1;if(_0x111d0c>=_0x38155c){_0x111d0c=_0x38155c;_0x2d5fe1=0xc8;}else{_0x2d5fe1=0xce;}_0x194f0d['status'](_0x2d5fe1);return _0x194f0d[_0x5c2d('0x1c')](_0x5c2d('0x1d'),_0xa7db0d+'-'+_0x111d0c+'/'+_0x38155c)['json'](_0x346906);}return null;};}function patchUpdates(_0x516947){return function(_0x4909b2){try{jsonpatch['apply'](_0x4909b2,_0x516947,!![]);}catch(_0x5a9c4b){return BPromise[_0x5c2d('0x1e')](_0x5a9c4b);}return _0x4909b2['save']();};}function saveUpdates(_0x19c9f5,_0x2487d1){return function(_0x4bd9f1){if(_0x4bd9f1){return _0x4bd9f1[_0x5c2d('0x1f')](_0x19c9f5)[_0x5c2d('0x20')](function(_0x191f7e){return _0x191f7e;});}return null;};}function removeEntity(_0x763964,_0x5a92c0){return function(_0x4d52da){if(_0x4d52da){return _0x4d52da['destroy']()[_0x5c2d('0x20')](function(){_0x763964[_0x5c2d('0x16')](0xcc)[_0x5c2d('0x17')]();});}};}function handleEntityNotFound(_0x52f0b4,_0x223cf7){return function(_0x2071b9){if(!_0x2071b9){_0x52f0b4[_0x5c2d('0x15')](0x194);}return _0x2071b9;};}function handleError(_0x37989c,_0x439295){_0x439295=_0x439295||0x1f4;return function(_0x5c6466){logger[_0x5c2d('0x21')](_0x5c6466['stack']);if(_0x5c6466[_0x5c2d('0x22')]){delete _0x5c6466['name'];}_0x37989c[_0x5c2d('0x16')](_0x439295)[_0x5c2d('0x23')](_0x5c6466);};}exports[_0x5c2d('0x24')]=function(_0x4b8c19,_0x3a62cd){var _0xaa4273={},_0x2361f4={},_0x2cd042={'count':0x0,'rows':[]};var _0x5834d6=_[_0x5c2d('0x25')](db[_0x5c2d('0x26')][_0x5c2d('0x27')],function(_0x4b9298){return{'name':_0x4b9298['fieldName'],'type':_0x4b9298['type'][_0x5c2d('0x28')]};});_0x2361f4[_0x5c2d('0x29')]=_[_0x5c2d('0x25')](_0x5834d6,_0x5c2d('0x22'));_0x2361f4[_0x5c2d('0x2a')]=_[_0x5c2d('0x2b')](_0x4b8c19[_0x5c2d('0x2a')]);_0x2361f4[_0x5c2d('0x2c')]=_[_0x5c2d('0x2d')](_0x2361f4[_0x5c2d('0x29')],_0x2361f4['query']);_0xaa4273['attributes']=_[_0x5c2d('0x2d')](_0x2361f4['model'],qs[_0x5c2d('0x2e')](_0x4b8c19['query'][_0x5c2d('0x2e')]));_0xaa4273[_0x5c2d('0x2f')]=_0xaa4273[_0x5c2d('0x2f')]['length']?_0xaa4273[_0x5c2d('0x2f')]:_0x2361f4[_0x5c2d('0x29')];if(!_0x4b8c19[_0x5c2d('0x2a')][_0x5c2d('0x30')](_0x5c2d('0x31'))){_0xaa4273[_0x5c2d('0x1b')]=qs[_0x5c2d('0x1b')](_0x4b8c19['query']['limit']);_0xaa4273['offset']=qs['offset'](_0x4b8c19[_0x5c2d('0x2a')][_0x5c2d('0x1a')]);}_0xaa4273[_0x5c2d('0x32')]=qs[_0x5c2d('0x33')](_0x4b8c19[_0x5c2d('0x2a')][_0x5c2d('0x33')]);_0xaa4273[_0x5c2d('0x34')]=qs['filters'](_[_0x5c2d('0x35')](_0x4b8c19[_0x5c2d('0x2a')],_0x2361f4[_0x5c2d('0x2c')]),_0x5834d6);if(_0x4b8c19[_0x5c2d('0x2a')][_0x5c2d('0x36')]){_0xaa4273[_0x5c2d('0x34')]=_[_0x5c2d('0x37')](_0xaa4273[_0x5c2d('0x34')],{'$or':_[_0x5c2d('0x25')](_0x5834d6,function(_0xede599){if(_0xede599['type']!==_0x5c2d('0x38')){var _0x3d6096={};_0x3d6096[_0xede599[_0x5c2d('0x22')]]={'$like':'%'+_0x4b8c19[_0x5c2d('0x2a')][_0x5c2d('0x36')]+'%'};return _0x3d6096;}})});}_0xaa4273=_[_0x5c2d('0x37')]({},_0xaa4273,_0x4b8c19['options']);var _0x11f4e1={'where':_0xaa4273['where']};return db[_0x5c2d('0x26')]['count'](_0x11f4e1)['then'](function(_0x5f06b4){_0x2cd042['count']=_0x5f06b4;if(_0x4b8c19['query']['includeAll']){_0xaa4273[_0x5c2d('0x39')]=[{'all':!![]}];}return db[_0x5c2d('0x26')]['findAll'](_0xaa4273);})[_0x5c2d('0x20')](function(_0x25a89e){_0x2cd042[_0x5c2d('0x3a')]=_0x25a89e;return _0x2cd042;})[_0x5c2d('0x20')](respondWithFilteredResult(_0x3a62cd,_0xaa4273))[_0x5c2d('0x3b')](handleError(_0x3a62cd,null));};exports['show']=function(_0x4fcf09,_0x1db498){var _0x5c0e18={'raw':!![],'where':{'id':_0x4fcf09[_0x5c2d('0x3c')]['id']}},_0x38574e={};_0x38574e[_0x5c2d('0x29')]=_[_0x5c2d('0x2b')](db[_0x5c2d('0x26')]['rawAttributes']);_0x38574e[_0x5c2d('0x2a')]=_[_0x5c2d('0x2b')](_0x4fcf09[_0x5c2d('0x2a')]);_0x38574e[_0x5c2d('0x2c')]=_[_0x5c2d('0x2d')](_0x38574e[_0x5c2d('0x29')],_0x38574e[_0x5c2d('0x2a')]);_0x5c0e18[_0x5c2d('0x2f')]=_['intersection'](_0x38574e[_0x5c2d('0x29')],qs[_0x5c2d('0x2e')](_0x4fcf09[_0x5c2d('0x2a')][_0x5c2d('0x2e')]));_0x5c0e18[_0x5c2d('0x2f')]=_0x5c0e18[_0x5c2d('0x2f')][_0x5c2d('0x3d')]?_0x5c0e18['attributes']:_0x38574e[_0x5c2d('0x29')];if(_0x4fcf09[_0x5c2d('0x2a')][_0x5c2d('0x3e')]){_0x5c0e18[_0x5c2d('0x39')]=[{'all':!![]}];}_0x5c0e18=_[_0x5c2d('0x37')]({},_0x5c0e18,_0x4fcf09['options']);return db[_0x5c2d('0x26')][_0x5c2d('0x3f')](_0x5c0e18)[_0x5c2d('0x20')](handleEntityNotFound(_0x1db498,null))[_0x5c2d('0x20')](respondWithResult(_0x1db498,null))[_0x5c2d('0x3b')](handleError(_0x1db498,null));};exports['create']=function(_0x234858,_0x37f5a2){return db[_0x5c2d('0x26')][_0x5c2d('0x40')](_0x234858[_0x5c2d('0x41')],{})['then'](respondWithResult(_0x37f5a2,0xc9))[_0x5c2d('0x3b')](handleError(_0x37f5a2,null));};exports['update']=function(_0x4a3352,_0x283fcd){if(_0x4a3352[_0x5c2d('0x41')]['id']){delete _0x4a3352[_0x5c2d('0x41')]['id'];}return db[_0x5c2d('0x26')]['find']({'where':{'id':_0x4a3352[_0x5c2d('0x3c')]['id']}})[_0x5c2d('0x20')](handleEntityNotFound(_0x283fcd,null))[_0x5c2d('0x20')](saveUpdates(_0x4a3352[_0x5c2d('0x41')],null))[_0x5c2d('0x20')](respondWithResult(_0x283fcd,null))[_0x5c2d('0x3b')](handleError(_0x283fcd,null));};exports[_0x5c2d('0x42')]=function(_0x10de21,_0x38c71d){return db[_0x5c2d('0x26')][_0x5c2d('0x3f')]({'where':{'id':_0x10de21['params']['id']}})[_0x5c2d('0x20')](handleEntityNotFound(_0x38c71d,null))['then'](removeEntity(_0x38c71d,null))[_0x5c2d('0x3b')](handleError(_0x38c71d,null));}; \ No newline at end of file +var _0x45ae=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','CloudProvider','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','catch','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','papaparse'];(function(_0x5bc5fe,_0x2afaef){var _0x298ea7=function(_0x1c6bd5){while(--_0x1c6bd5){_0x5bc5fe['push'](_0x5bc5fe['shift']());}};_0x298ea7(++_0x2afaef);}(_0x45ae,0xca));var _0xe45a=function(_0xeae1a,_0x18b5cb){_0xeae1a=_0xeae1a-0x0;var _0x56573a=_0x45ae[_0xeae1a];return _0x56573a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe45a('0x0'));var rimraf=require(_0xe45a('0x1'));var zipdir=require(_0xe45a('0x2'));var jsonpatch=require(_0xe45a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe45a('0x4'));var Mustache=require(_0xe45a('0x5'));var util=require(_0xe45a('0x6'));var path=require('path');var sox=require(_0xe45a('0x7'));var csv=require(_0xe45a('0x8'));var ejs=require(_0xe45a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe45a('0xa'));var crypto=require(_0xe45a('0xb'));var jsforce=require(_0xe45a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe45a('0x8'));var querystring=require('querystring');var Papa=require(_0xe45a('0xd'));var Redis=require('ioredis');var authService=require(_0xe45a('0xe'));var qs=require(_0xe45a('0xf'));var as=require(_0xe45a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe45a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe45a('0x12'));var db=require(_0xe45a('0x13'))['db'];function respondWithStatusCode(_0x2cb725,_0xd371b5){_0xd371b5=_0xd371b5||0xcc;return function(_0xbc2f92){if(_0xbc2f92){return _0x2cb725[_0xe45a('0x14')](_0xd371b5);}return _0x2cb725[_0xe45a('0x15')](_0xd371b5)[_0xe45a('0x16')]();};}function respondWithResult(_0x3b9d4c,_0x24c753){_0x24c753=_0x24c753||0xc8;return function(_0x3803d6){if(_0x3803d6){return _0x3b9d4c[_0xe45a('0x15')](_0x24c753)[_0xe45a('0x17')](_0x3803d6);}};}function respondWithFilteredResult(_0x55badc,_0x27ff21){return function(_0x2c993d){if(_0x2c993d){var _0x4c97fc=_0x2c993d[_0xe45a('0x18')],_0x373e13=_0x27ff21[_0xe45a('0x19')],_0x551f25=_0x27ff21[_0xe45a('0x19')]+_0x27ff21[_0xe45a('0x1a')],_0x1c0cd0;if(_0x551f25>=_0x4c97fc){_0x551f25=_0x4c97fc;_0x1c0cd0=0xc8;}else{_0x1c0cd0=0xce;}_0x55badc[_0xe45a('0x15')](_0x1c0cd0);return _0x55badc[_0xe45a('0x1b')](_0xe45a('0x1c'),_0x373e13+'-'+_0x551f25+'/'+_0x4c97fc)['json'](_0x2c993d);}return null;};}function patchUpdates(_0x4e765b){return function(_0x598d48){try{jsonpatch[_0xe45a('0x1d')](_0x598d48,_0x4e765b,!![]);}catch(_0x4c4e49){return BPromise[_0xe45a('0x1e')](_0x4c4e49);}return _0x598d48[_0xe45a('0x1f')]();};}function saveUpdates(_0x2de886,_0xdfd22c){return function(_0x5330f3){if(_0x5330f3){return _0x5330f3[_0xe45a('0x20')](_0x2de886)[_0xe45a('0x21')](function(_0x43e088){return _0x43e088;});}return null;};}function removeEntity(_0xefeb42,_0x36d9d4){return function(_0x123c14){if(_0x123c14){return _0x123c14['destroy']()[_0xe45a('0x21')](function(){_0xefeb42[_0xe45a('0x15')](0xcc)[_0xe45a('0x16')]();});}};}function handleEntityNotFound(_0x2104a7,_0x4254ef){return function(_0x2b8454){if(!_0x2b8454){_0x2104a7[_0xe45a('0x14')](0x194);}return _0x2b8454;};}function handleError(_0x5a393c,_0x1880ba){_0x1880ba=_0x1880ba||0x1f4;return function(_0x3564f8){logger[_0xe45a('0x22')](_0x3564f8[_0xe45a('0x23')]);if(_0x3564f8['name']){delete _0x3564f8['name'];}_0x5a393c[_0xe45a('0x15')](_0x1880ba)[_0xe45a('0x24')](_0x3564f8);};}exports[_0xe45a('0x25')]=function(_0x3cb882,_0x5cf717){var _0x174106={},_0x5c9af7={},_0x4a5b5a={'count':0x0,'rows':[]};var _0x5d8d8a=_[_0xe45a('0x26')](db[_0xe45a('0x27')][_0xe45a('0x28')],function(_0xe8421e){return{'name':_0xe8421e[_0xe45a('0x29')],'type':_0xe8421e[_0xe45a('0x2a')]['key']};});_0x5c9af7[_0xe45a('0x2b')]=_[_0xe45a('0x26')](_0x5d8d8a,_0xe45a('0x2c'));_0x5c9af7[_0xe45a('0x2d')]=_[_0xe45a('0x2e')](_0x3cb882[_0xe45a('0x2d')]);_0x5c9af7[_0xe45a('0x2f')]=_[_0xe45a('0x30')](_0x5c9af7[_0xe45a('0x2b')],_0x5c9af7['query']);_0x174106[_0xe45a('0x31')]=_['intersection'](_0x5c9af7[_0xe45a('0x2b')],qs['fields'](_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x32')]));_0x174106[_0xe45a('0x31')]=_0x174106['attributes'][_0xe45a('0x33')]?_0x174106[_0xe45a('0x31')]:_0x5c9af7[_0xe45a('0x2b')];if(!_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x34')](_0xe45a('0x35'))){_0x174106[_0xe45a('0x1a')]=qs[_0xe45a('0x1a')](_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x1a')]);_0x174106[_0xe45a('0x19')]=qs['offset'](_0x3cb882[_0xe45a('0x2d')]['offset']);}_0x174106[_0xe45a('0x36')]=qs['sort'](_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x37')]);_0x174106['where']=qs[_0xe45a('0x2f')](_[_0xe45a('0x38')](_0x3cb882[_0xe45a('0x2d')],_0x5c9af7[_0xe45a('0x2f')]),_0x5d8d8a);if(_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x39')]){_0x174106[_0xe45a('0x3a')]=_['merge'](_0x174106[_0xe45a('0x3a')],{'$or':_[_0xe45a('0x26')](_0x5d8d8a,function(_0x16f87d){if(_0x16f87d[_0xe45a('0x2a')]!==_0xe45a('0x3b')){var _0x3c0c90={};_0x3c0c90[_0x16f87d[_0xe45a('0x2c')]]={'$like':'%'+_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x39')]+'%'};return _0x3c0c90;}})});}_0x174106=_[_0xe45a('0x3c')]({},_0x174106,_0x3cb882[_0xe45a('0x3d')]);var _0x1a280c={'where':_0x174106[_0xe45a('0x3a')]};return db[_0xe45a('0x27')][_0xe45a('0x18')](_0x1a280c)[_0xe45a('0x21')](function(_0x1c029f){_0x4a5b5a[_0xe45a('0x18')]=_0x1c029f;if(_0x3cb882[_0xe45a('0x2d')][_0xe45a('0x3e')]){_0x174106['include']=[{'all':!![]}];}return db[_0xe45a('0x27')][_0xe45a('0x3f')](_0x174106);})['then'](function(_0x397ea0){_0x4a5b5a[_0xe45a('0x40')]=_0x397ea0;return _0x4a5b5a;})[_0xe45a('0x21')](respondWithFilteredResult(_0x5cf717,_0x174106))['catch'](handleError(_0x5cf717,null));};exports[_0xe45a('0x41')]=function(_0x34a6a2,_0x34fa3d){var _0x654d7c={'raw':!![],'where':{'id':_0x34a6a2[_0xe45a('0x42')]['id']}},_0x3f8758={};_0x3f8758[_0xe45a('0x2b')]=_[_0xe45a('0x2e')](db[_0xe45a('0x27')][_0xe45a('0x28')]);_0x3f8758['query']=_[_0xe45a('0x2e')](_0x34a6a2[_0xe45a('0x2d')]);_0x3f8758[_0xe45a('0x2f')]=_[_0xe45a('0x30')](_0x3f8758[_0xe45a('0x2b')],_0x3f8758['query']);_0x654d7c[_0xe45a('0x31')]=_['intersection'](_0x3f8758[_0xe45a('0x2b')],qs[_0xe45a('0x32')](_0x34a6a2[_0xe45a('0x2d')][_0xe45a('0x32')]));_0x654d7c[_0xe45a('0x31')]=_0x654d7c[_0xe45a('0x31')][_0xe45a('0x33')]?_0x654d7c[_0xe45a('0x31')]:_0x3f8758[_0xe45a('0x2b')];if(_0x34a6a2[_0xe45a('0x2d')]['includeAll']){_0x654d7c['include']=[{'all':!![]}];}_0x654d7c=_[_0xe45a('0x3c')]({},_0x654d7c,_0x34a6a2[_0xe45a('0x3d')]);return db[_0xe45a('0x27')]['find'](_0x654d7c)[_0xe45a('0x21')](handleEntityNotFound(_0x34fa3d,null))['then'](respondWithResult(_0x34fa3d,null))[_0xe45a('0x43')](handleError(_0x34fa3d,null));};exports[_0xe45a('0x44')]=function(_0xb9c892,_0x30f96d){return db[_0xe45a('0x27')][_0xe45a('0x44')](_0xb9c892[_0xe45a('0x45')],{})[_0xe45a('0x21')](respondWithResult(_0x30f96d,0xc9))['catch'](handleError(_0x30f96d,null));};exports[_0xe45a('0x20')]=function(_0x5a9a64,_0x2afc37){if(_0x5a9a64[_0xe45a('0x45')]['id']){delete _0x5a9a64[_0xe45a('0x45')]['id'];}return db[_0xe45a('0x27')]['find']({'where':{'id':_0x5a9a64[_0xe45a('0x42')]['id']}})['then'](handleEntityNotFound(_0x2afc37,null))[_0xe45a('0x21')](saveUpdates(_0x5a9a64[_0xe45a('0x45')],null))[_0xe45a('0x21')](respondWithResult(_0x2afc37,null))['catch'](handleError(_0x2afc37,null));};exports[_0xe45a('0x46')]=function(_0x5cbc83,_0x27cbdd){return db['CloudProvider'][_0xe45a('0x47')]({'where':{'id':_0x5cbc83[_0xe45a('0x42')]['id']}})[_0xe45a('0x21')](handleEntityNotFound(_0x27cbdd,null))[_0xe45a('0x21')](removeEntity(_0x27cbdd,null))[_0xe45a('0x43')](handleError(_0x27cbdd,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index eaf2222..b31e8c4 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 _0x6fca=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','util'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x6fca,0x1b7));var _0xa6fc=function(_0x3bcbbc,_0x4e7b07){_0x3bcbbc=_0x3bcbbc-0x0;var _0x52c2b5=_0x6fca[_0x3bcbbc];return _0x52c2b5;};'use strict';var _=require('lodash');var util=require(_0xa6fc('0x0'));var logger=require(_0xa6fc('0x1'))(_0xa6fc('0x2'));var moment=require(_0xa6fc('0x3'));var BPromise=require(_0xa6fc('0x4'));var rp=require(_0xa6fc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa6fc('0x6'));var attributes=require(_0xa6fc('0x7'));module[_0xa6fc('0x8')]=function(_0x237f68,_0x146d5a){return _0x237f68[_0xa6fc('0x9')]('CloudProvider',attributes,{'tableName':_0xa6fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9dad=['request-promise','path','rimraf','../../config/environment','exports','define','CloudProvider','cloud_providers','util','bluebird'];(function(_0x32e6a2,_0x5e1e09){var _0xdc473=function(_0x52bf6c){while(--_0x52bf6c){_0x32e6a2['push'](_0x32e6a2['shift']());}};_0xdc473(++_0x5e1e09);}(_0x9dad,0x9e));var _0xd9da=function(_0x5729bf,_0x4d3f5b){_0x5729bf=_0x5729bf-0x0;var _0x5babbd=_0x9dad[_0x5729bf];return _0x5babbd;};'use strict';var _=require('lodash');var util=require(_0xd9da('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd9da('0x1'));var rp=require(_0xd9da('0x2'));var fs=require('fs');var path=require(_0xd9da('0x3'));var rimraf=require(_0xd9da('0x4'));var config=require(_0xd9da('0x5'));var attributes=require('./cloudProvider.attributes');module[_0xd9da('0x6')]=function(_0x2a037f,_0x31c4b9){return _0x2a037f[_0xd9da('0x7')](_0xd9da('0x8'),attributes,{'tableName':_0xd9da('0x9'),'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 e4c5693..67519e7 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 _0xa5c8=['CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x383dbb,_0x17d41b){var _0x6e8bde=function(_0x2740f1){while(--_0x2740f1){_0x383dbb['push'](_0x383dbb['shift']());}};_0x6e8bde(++_0x17d41b);}(_0xa5c8,0x144));var _0x8a5c=function(_0xc736e7,_0x4fa172){_0xc736e7=_0xc736e7-0x0;var _0xe0f4e9=_0xa5c8[_0xc736e7];return _0xe0f4e9;};'use strict';var _=require(_0x8a5c('0x0'));var util=require(_0x8a5c('0x1'));var moment=require(_0x8a5c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a5c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a5c('0x4'));var logger=require(_0x8a5c('0x5'))('rpc');var config=require(_0x8a5c('0x6'));var jayson=require(_0x8a5c('0x7'));var client=jayson[_0x8a5c('0x8')][_0x8a5c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ad8b6,_0x42d7d4,_0x5690ea){return new BPromise(function(_0x4d2760,_0x568bc0){return client[_0x8a5c('0xa')](_0x1ad8b6,_0x5690ea)['then'](function(_0x263846){logger[_0x8a5c('0xb')](_0x8a5c('0xc'),_0x42d7d4,'request\x20sent');logger[_0x8a5c('0xd')](_0x8a5c('0xe'),_0x42d7d4,'request\x20sent',JSON[_0x8a5c('0xf')](_0x263846));if(_0x263846[_0x8a5c('0x10')]){if(_0x263846[_0x8a5c('0x10')][_0x8a5c('0x11')]===0x1f4){logger[_0x8a5c('0x10')](_0x8a5c('0xc'),_0x42d7d4,_0x263846[_0x8a5c('0x10')][_0x8a5c('0x12')]);return _0x568bc0(_0x263846[_0x8a5c('0x10')][_0x8a5c('0x12')]);}logger[_0x8a5c('0x10')](_0x8a5c('0xc'),_0x42d7d4,_0x263846[_0x8a5c('0x10')]['message']);return _0x4d2760(_0x263846[_0x8a5c('0x10')][_0x8a5c('0x12')]);}else{logger['info']('CloudProvider,\x20%s,\x20%s',_0x42d7d4,_0x8a5c('0x13'));_0x4d2760(_0x263846[_0x8a5c('0x14')][_0x8a5c('0x12')]);}})['catch'](function(_0x17fc7a){logger[_0x8a5c('0x10')](_0x8a5c('0xc'),_0x42d7d4,_0x17fc7a);_0x568bc0(_0x17fc7a);});});} \ No newline at end of file +var _0xd267=['request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','client','then','info','CloudProvider,\x20%s,\x20%s'];(function(_0x4e1bcf,_0x462f1d){var _0x46e82f=function(_0x46109d){while(--_0x46109d){_0x4e1bcf['push'](_0x4e1bcf['shift']());}};_0x46e82f(++_0x462f1d);}(_0xd267,0x7a));var _0x7d26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd267[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7d26('0x0'));var moment=require(_0x7d26('0x1'));var BPromise=require(_0x7d26('0x2'));var rs=require(_0x7d26('0x3'));var fs=require('fs');var Redis=require(_0x7d26('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d26('0x5'));var config=require(_0x7d26('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x7d26('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ad5a8,_0x240ac0,_0x242b82){return new BPromise(function(_0x32c765,_0x3eb536){return client['request'](_0x3ad5a8,_0x242b82)[_0x7d26('0x8')](function(_0x6b9619){logger[_0x7d26('0x9')](_0x7d26('0xa'),_0x240ac0,_0x7d26('0xb'));logger[_0x7d26('0xc')](_0x7d26('0xd'),_0x240ac0,_0x7d26('0xb'),JSON['stringify'](_0x6b9619));if(_0x6b9619[_0x7d26('0xe')]){if(_0x6b9619['error'][_0x7d26('0xf')]===0x1f4){logger[_0x7d26('0xe')](_0x7d26('0xa'),_0x240ac0,_0x6b9619['error'][_0x7d26('0x10')]);return _0x3eb536(_0x6b9619[_0x7d26('0xe')][_0x7d26('0x10')]);}logger['error'](_0x7d26('0xa'),_0x240ac0,_0x6b9619[_0x7d26('0xe')][_0x7d26('0x10')]);return _0x32c765(_0x6b9619['error'][_0x7d26('0x10')]);}else{logger[_0x7d26('0x9')](_0x7d26('0xa'),_0x240ac0,'request\x20sent');_0x32c765(_0x6b9619[_0x7d26('0x11')][_0x7d26('0x10')]);}})[_0x7d26('0x12')](function(_0x2ef9ef){logger[_0x7d26('0xe')](_0x7d26('0xa'),_0x240ac0,_0x2ef9ef);_0x3eb536(_0x2ef9ef);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 244db14..5d80e36 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 _0xf8e0=['update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','post','create'];(function(_0x5cd29f,_0x25f1ab){var _0x2301b5=function(_0x137b82){while(--_0x137b82){_0x5cd29f['push'](_0x5cd29f['shift']());}};_0x2301b5(++_0x25f1ab);}(_0xf8e0,0x110));var _0x0f8e=function(_0x3882e4,_0x2cd2cd){_0x3882e4=_0x3882e4-0x0;var _0x359fea=_0xf8e0[_0x3882e4];return _0x359fea;};'use strict';var multer=require(_0x0f8e('0x0'));var util=require(_0x0f8e('0x1'));var path=require(_0x0f8e('0x2'));var timeout=require(_0x0f8e('0x3'));var express=require(_0x0f8e('0x4'));var router=express[_0x0f8e('0x5')]();var auth=require(_0x0f8e('0x6'));var interaction=require(_0x0f8e('0x7'));var config=require(_0x0f8e('0x8'));var controller=require(_0x0f8e('0x9'));router[_0x0f8e('0xa')]('/',auth[_0x0f8e('0xb')](),controller[_0x0f8e('0xc')]);router[_0x0f8e('0xa')](_0x0f8e('0xd'),auth[_0x0f8e('0xb')](),controller['show']);router[_0x0f8e('0xe')]('/',auth[_0x0f8e('0xb')](),controller[_0x0f8e('0xf')]);router['put'](_0x0f8e('0xd'),auth['isAuthenticated'](),controller[_0x0f8e('0x10')]);router['delete'](_0x0f8e('0xd'),auth[_0x0f8e('0xb')](),controller[_0x0f8e('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8bfe=['update','delete','destroy','exports','path','connect-timeout','express','../../components/interaction/service','./cloudProvider.controller','get','index','/:id','isAuthenticated','show','post','put'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x8bfe,0x184));var _0xe8bf=function(_0x2ade6f,_0x18d576){_0x2ade6f=_0x2ade6f-0x0;var _0x28fa0f=_0x8bfe[_0x2ade6f];return _0x28fa0f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe8bf('0x0'));var timeout=require(_0xe8bf('0x1'));var express=require(_0xe8bf('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe8bf('0x3'));var config=require('../../config/environment');var controller=require(_0xe8bf('0x4'));router[_0xe8bf('0x5')]('/',auth['isAuthenticated'](),controller[_0xe8bf('0x6')]);router[_0xe8bf('0x5')](_0xe8bf('0x7'),auth[_0xe8bf('0x8')](),controller[_0xe8bf('0x9')]);router[_0xe8bf('0xa')]('/',auth[_0xe8bf('0x8')](),controller['create']);router[_0xe8bf('0xb')](_0xe8bf('0x7'),auth[_0xe8bf('0x8')](),controller[_0xe8bf('0xc')]);router[_0xe8bf('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xe8bf('0xe')]);module[_0xe8bf('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 64997b2..fdd0f94 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 _0x2ec4=['STRING'];(function(_0x416c5f,_0x44a996){var _0x5de15d=function(_0x201fe5){while(--_0x201fe5){_0x416c5f['push'](_0x416c5f['shift']());}};_0x5de15d(++_0x44a996);}(_0x2ec4,0x139));var _0x42ec=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x2ec4[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x42ec('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x42ec('0x0')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x42ec('0x0')]},'phone':{'type':Sequelize[_0x42ec('0x0')]},'fax':{'type':Sequelize[_0x42ec('0x0')]},'type':{'type':Sequelize[_0x42ec('0x0')]},'street':{'type':Sequelize[_0x42ec('0x0')]},'postalCode':{'type':Sequelize[_0x42ec('0x0')]},'city':{'type':Sequelize[_0x42ec('0x0')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x42ec('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x42ec('0x0')]},'sStreet':{'type':Sequelize[_0x42ec('0x0')]},'sPostalCode':{'type':Sequelize[_0x42ec('0x0')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x42ec('0x0')]},'description':{'type':Sequelize[_0x42ec('0x0')]}}; \ No newline at end of file +var _0x7a9d=['sequelize','exports','STRING','name'];(function(_0x380307,_0x440ccd){var _0x9ea14b=function(_0x51024c){while(--_0x51024c){_0x380307['push'](_0x380307['shift']());}};_0x9ea14b(++_0x440ccd);}(_0x7a9d,0xb8));var _0xd7a9=function(_0xe285a8,_0x48ff89){_0xe285a8=_0xe285a8-0x0;var _0x2a289e=_0x7a9d[_0xe285a8];return _0x2a289e;};'use strict';var Sequelize=require(_0xd7a9('0x0'));module[_0xd7a9('0x1')]={'name':{'type':Sequelize[_0xd7a9('0x2')],'unique':_0xd7a9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd7a9('0x2')]},'companyId':{'type':Sequelize[_0xd7a9('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xd7a9('0x2')]},'type':{'type':Sequelize[_0xd7a9('0x2')]},'street':{'type':Sequelize[_0xd7a9('0x2')]},'postalCode':{'type':Sequelize[_0xd7a9('0x2')]},'city':{'type':Sequelize[_0xd7a9('0x2')]},'country':{'type':Sequelize[_0xd7a9('0x2')]},'email':{'type':Sequelize[_0xd7a9('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xd7a9('0x2')]},'sStreet':{'type':Sequelize[_0xd7a9('0x2')]},'sPostalCode':{'type':Sequelize[_0xd7a9('0x2')]},'sCity':{'type':Sequelize[_0xd7a9('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd7a9('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 9bbef6f..a6a435d 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 _0x1f3a=['lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','set','apply','reject','then','destroy','get','Companies','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','map','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','ids','omit','getContacts','findOne','pick','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','util','sox'];(function(_0x5e8981,_0x5ad60b){var _0x5a65ab=function(_0x328645){while(--_0x328645){_0x5e8981['push'](_0x5e8981['shift']());}};_0x5a65ab(++_0x5ad60b);}(_0x1f3a,0x18e));var _0xa1f3=function(_0x40f2e9,_0x2875cb){_0x40f2e9=_0x40f2e9-0x0;var _0x5ae775=_0x1f3a[_0x40f2e9];return _0x5ae775;};'use strict';var pdf=require(_0xa1f3('0x0'));var emlformat=require(_0xa1f3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa1f3('0x2'));var jsonpatch=require(_0xa1f3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa1f3('0x4'));var util=require(_0xa1f3('0x5'));var path=require('path');var sox=require(_0xa1f3('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa1f3('0x7'));var squel=require(_0xa1f3('0x8'));var crypto=require(_0xa1f3('0x9'));var jsforce=require(_0xa1f3('0xa'));var deskjs=require(_0xa1f3('0xb'));var toCsv=require(_0xa1f3('0xc'));var querystring=require(_0xa1f3('0xd'));var Papa=require(_0xa1f3('0xe'));var Redis=require(_0xa1f3('0xf'));var authService=require(_0xa1f3('0x10'));var qs=require(_0xa1f3('0x11'));var as=require(_0xa1f3('0x12'));var hardwareService=require(_0xa1f3('0x13'));var logger=require(_0xa1f3('0x14'))('api');var utils=require(_0xa1f3('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14bde3,_0x524988){_0x524988=_0x524988||0xcc;return function(_0x36fa57){if(_0x36fa57){return _0x14bde3[_0xa1f3('0x16')](_0x524988);}return _0x14bde3[_0xa1f3('0x17')](_0x524988)[_0xa1f3('0x18')]();};}function respondWithResult(_0x9cec13,_0x3f44d6){_0x3f44d6=_0x3f44d6||0xc8;return function(_0x3c8348){if(_0x3c8348){return _0x9cec13[_0xa1f3('0x17')](_0x3f44d6)[_0xa1f3('0x19')](_0x3c8348);}};}function respondWithFilteredResult(_0x2c4faa,_0x31c13c){return function(_0x3a152a){if(_0x3a152a){var _0x1471e9=_0x3a152a[_0xa1f3('0x1a')],_0x73f58a=_0x31c13c['offset'],_0x2c24f7=_0x31c13c[_0xa1f3('0x1b')]+_0x31c13c['limit'],_0x127e82;if(_0x2c24f7>=_0x1471e9){_0x2c24f7=_0x1471e9;_0x127e82=0xc8;}else{_0x127e82=0xce;}_0x2c4faa[_0xa1f3('0x17')](_0x127e82);return _0x2c4faa[_0xa1f3('0x1c')]('Content-Range',_0x73f58a+'-'+_0x2c24f7+'/'+_0x1471e9)[_0xa1f3('0x19')](_0x3a152a);}return null;};}function patchUpdates(_0x424def){return function(_0xd280bc){try{jsonpatch[_0xa1f3('0x1d')](_0xd280bc,_0x424def,!![]);}catch(_0x33f6b8){return BPromise[_0xa1f3('0x1e')](_0x33f6b8);}return _0xd280bc['save']();};}function saveUpdates(_0x223281,_0x2f22eb){return function(_0x41a0d5){if(_0x41a0d5){return _0x41a0d5['update'](_0x223281)[_0xa1f3('0x1f')](function(_0x396d39){return _0x396d39;});}return null;};}function removeEntity(_0x3845fc,_0x428f8b){return function(_0x4d303a){if(_0x4d303a){return _0x4d303a[_0xa1f3('0x20')]()['then'](function(){var _0x592d6f=_0x4d303a[_0xa1f3('0x21')]({'plain':!![]});var _0x243cf6=_0xa1f3('0x22');return db['UserProfileResource']['destroy']({'where':{'type':_0x243cf6,'resourceId':_0x592d6f['id']}})['then'](function(){return _0x4d303a;});})[_0xa1f3('0x1f')](function(){_0x3845fc[_0xa1f3('0x17')](0xcc)[_0xa1f3('0x18')]();});}};}function handleEntityNotFound(_0x144b0d,_0xdb62fb){return function(_0x3671bc){if(!_0x3671bc){_0x144b0d[_0xa1f3('0x16')](0x194);}return _0x3671bc;};}function handleError(_0x462ce0,_0x5cee87){_0x5cee87=_0x5cee87||0x1f4;return function(_0x125a1b){logger['error'](_0x125a1b[_0xa1f3('0x23')]);if(_0x125a1b[_0xa1f3('0x24')]){delete _0x125a1b[_0xa1f3('0x24')];}_0x462ce0['status'](_0x5cee87)[_0xa1f3('0x25')](_0x125a1b);};}exports[_0xa1f3('0x26')]=function(_0x39ea2a,_0x1c54d4){var _0x49df62={},_0x3983b4={},_0x4c61b9={'count':0x0,'rows':[]};return db[_0xa1f3('0x27')][_0xa1f3('0x28')]()[_0xa1f3('0x1f')](function(_0x4e436e){_0x3983b4[_0xa1f3('0x29')]=_['keys'](_0x4e436e);_0x3983b4['query']=_[_0xa1f3('0x2a')](_0x39ea2a[_0xa1f3('0x2b')]);_0x3983b4[_0xa1f3('0x2c')]=_[_0xa1f3('0x2d')](_0x3983b4[_0xa1f3('0x29')],_0x3983b4['query']);_0x49df62[_0xa1f3('0x2e')]=_[_0xa1f3('0x2d')](_0x3983b4[_0xa1f3('0x29')],qs[_0xa1f3('0x2f')](_0x39ea2a[_0xa1f3('0x2b')]['fields']));_0x49df62[_0xa1f3('0x2e')]=_0x49df62['attributes'][_0xa1f3('0x30')]?_0x49df62[_0xa1f3('0x2e')]:_0x3983b4[_0xa1f3('0x29')];if(!_0x39ea2a[_0xa1f3('0x2b')][_0xa1f3('0x31')]('nolimit')){_0x49df62[_0xa1f3('0x32')]=qs[_0xa1f3('0x32')](_0x39ea2a['query'][_0xa1f3('0x32')]);_0x49df62[_0xa1f3('0x1b')]=qs['offset'](_0x39ea2a['query'][_0xa1f3('0x1b')]);}_0x49df62[_0xa1f3('0x33')]=qs['sort'](_0x39ea2a[_0xa1f3('0x2b')][_0xa1f3('0x34')]);_0x49df62[_0xa1f3('0x35')]=qs[_0xa1f3('0x2c')](_['pick'](_0x39ea2a['query'],_0x3983b4[_0xa1f3('0x2c')]));if(_0x39ea2a['query'][_0xa1f3('0x36')]){_0x49df62[_0xa1f3('0x35')]=_[_0xa1f3('0x37')](_0x49df62[_0xa1f3('0x35')],{'$or':_[_0xa1f3('0x38')](_0x49df62[_0xa1f3('0x2e')],function(_0x3e019c){var _0x4c145a={};_0x4c145a[_0x3e019c]={'$like':'%'+_0x39ea2a[_0xa1f3('0x2b')][_0xa1f3('0x36')]+'%'};return _0x4c145a;})});}_0x49df62=_[_0xa1f3('0x37')]({},_0x49df62,_0x39ea2a[_0xa1f3('0x39')]);var _0x9b79dd={'where':_0x49df62[_0xa1f3('0x35')]};return db['CmCompany']['count'](_0x9b79dd)['then'](function(_0x5d469e){_0x4c61b9[_0xa1f3('0x1a')]=_0x5d469e;if(_0x39ea2a[_0xa1f3('0x2b')][_0xa1f3('0x3a')]){_0x49df62[_0xa1f3('0x3b')]=[{'all':!![]}];}return db[_0xa1f3('0x27')]['findAll'](_0x49df62);})['then'](function(_0x116582){_0x4c61b9[_0xa1f3('0x3c')]=_0x116582;return _0x4c61b9;})['then'](respondWithFilteredResult(_0x1c54d4,_0x49df62))[_0xa1f3('0x3d')](handleError(_0x1c54d4,null));})[_0xa1f3('0x3d')](handleError(_0x1c54d4,null));};exports[_0xa1f3('0x3e')]=function(_0x313a98,_0x40b2c8){var _0x459e01={'raw':![],'where':{'id':_0x313a98[_0xa1f3('0x3f')]['id']}},_0x376b00={};_0x376b00[_0xa1f3('0x29')]=_['keys'](db['CmCompany'][_0xa1f3('0x40')]);_0x376b00[_0xa1f3('0x2b')]=_[_0xa1f3('0x2a')](_0x313a98[_0xa1f3('0x2b')]);_0x376b00['filters']=_[_0xa1f3('0x2d')](_0x376b00[_0xa1f3('0x29')],_0x376b00[_0xa1f3('0x2b')]);_0x459e01[_0xa1f3('0x2e')]=_['intersection'](_0x376b00[_0xa1f3('0x29')],qs[_0xa1f3('0x2f')](_0x313a98['query']['fields']));_0x459e01[_0xa1f3('0x2e')]=_0x459e01[_0xa1f3('0x2e')][_0xa1f3('0x30')]?_0x459e01['attributes']:_0x376b00[_0xa1f3('0x29')];if(_0x313a98[_0xa1f3('0x2b')][_0xa1f3('0x3a')]){_0x459e01[_0xa1f3('0x3b')]=[{'all':!![]}];}_0x459e01=_[_0xa1f3('0x37')]({},_0x459e01,_0x313a98[_0xa1f3('0x39')]);return db['CmCompany'][_0xa1f3('0x41')](_0x459e01)[_0xa1f3('0x1f')](handleEntityNotFound(_0x40b2c8,null))[_0xa1f3('0x1f')](respondWithResult(_0x40b2c8,null))['catch'](handleError(_0x40b2c8,null));};exports[_0xa1f3('0x42')]=function(_0x3ab7c9,_0x3520ea){return db[_0xa1f3('0x27')][_0xa1f3('0x42')](_0x3ab7c9[_0xa1f3('0x43')],{})[_0xa1f3('0x1f')](function(_0x406a4d){var _0x55c0bd=_0x3ab7c9[_0xa1f3('0x44')][_0xa1f3('0x21')]({'plain':!![]});if(!_0x55c0bd)throw new Error(_0xa1f3('0x45'));if(_0x55c0bd['role']===_0xa1f3('0x44')){var _0x49ef64=_0x406a4d[_0xa1f3('0x21')]({'plain':!![]});var _0x16259a=_0xa1f3('0x22');return db['UserProfileSection'][_0xa1f3('0x41')]({'where':{'name':_0x16259a,'userProfileId':_0x55c0bd['userProfileId']},'raw':!![]})[_0xa1f3('0x1f')](function(_0x26db67){if(_0x26db67&&_0x26db67[_0xa1f3('0x46')]===0x0){return db['UserProfileResource'][_0xa1f3('0x42')]({'name':_0x49ef64[_0xa1f3('0x24')],'resourceId':_0x49ef64['id'],'type':_0x26db67['name'],'sectionId':_0x26db67['id']},{})[_0xa1f3('0x1f')](function(){return _0x406a4d;});}else{return _0x406a4d;}})['catch'](function(_0x45fa95){logger[_0xa1f3('0x47')](_0xa1f3('0x48'),_0x45fa95);throw _0x45fa95;});}return _0x406a4d;})[_0xa1f3('0x1f')](respondWithResult(_0x3520ea,0xc9))[_0xa1f3('0x3d')](handleError(_0x3520ea,null));};exports[_0xa1f3('0x49')]=function(_0x4212c9,_0x35e5ca){if(_0x4212c9['body']['id']){delete _0x4212c9[_0xa1f3('0x43')]['id'];}return db['CmCompany'][_0xa1f3('0x41')]({'where':{'id':_0x4212c9[_0xa1f3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x35e5ca,null))['then'](saveUpdates(_0x4212c9[_0xa1f3('0x43')],null))['then'](respondWithResult(_0x35e5ca,null))[_0xa1f3('0x3d')](handleError(_0x35e5ca,null));};exports[_0xa1f3('0x20')]=function(_0x30c41f,_0x3868a1){return db['CmCompany'][_0xa1f3('0x41')]({'where':{'id':_0x30c41f[_0xa1f3('0x3f')]['id']}})[_0xa1f3('0x1f')](handleEntityNotFound(_0x3868a1,null))[_0xa1f3('0x1f')](removeEntity(_0x3868a1,null))[_0xa1f3('0x3d')](handleError(_0x3868a1,null));};exports[_0xa1f3('0x28')]=function(_0xde0bf8,_0x58027d){return db[_0xa1f3('0x27')][_0xa1f3('0x28')]()['then'](respondWithResult(_0x58027d,null))[_0xa1f3('0x3d')](handleError(_0x58027d,null));};exports[_0xa1f3('0x4a')]=function(_0x53997c,_0x1b6214,_0xbd92f0){return db[_0xa1f3('0x4b')][_0xa1f3('0x41')]({'where':{'id':_0x53997c[_0xa1f3('0x3f')]['id']}})[_0xa1f3('0x1f')](handleEntityNotFound(_0x1b6214,null))[_0xa1f3('0x1f')](function(_0x30ea26){if(_0x30ea26){return _0x30ea26[_0xa1f3('0x4a')](_0x53997c[_0xa1f3('0x43')][_0xa1f3('0x4c')],_[_0xa1f3('0x4d')](_0x53997c[_0xa1f3('0x43')],['ids','id'])||{});}})['then'](respondWithResult(_0x1b6214,null))[_0xa1f3('0x3d')](handleError(_0x1b6214,null));};exports[_0xa1f3('0x4e')]=function(_0x37d4b9,_0x19c229,_0x5ab233){var _0x4c8149={};var _0x3c09f2={};var _0x59e4a4;var _0x1c0e88;return db[_0xa1f3('0x27')][_0xa1f3('0x4f')]({'where':{'id':_0x37d4b9['params']['id']}})[_0xa1f3('0x1f')](handleEntityNotFound(_0x19c229,null))[_0xa1f3('0x1f')](function(_0x111e28){if(_0x111e28){_0x59e4a4=_0x111e28;_0x3c09f2[_0xa1f3('0x29')]=_['keys'](db[_0xa1f3('0x4b')]['rawAttributes']);_0x3c09f2[_0xa1f3('0x2b')]=_[_0xa1f3('0x2a')](_0x37d4b9[_0xa1f3('0x2b')]);_0x3c09f2[_0xa1f3('0x2c')]=_[_0xa1f3('0x2d')](_0x3c09f2[_0xa1f3('0x29')],_0x3c09f2[_0xa1f3('0x2b')]);_0x4c8149[_0xa1f3('0x2e')]=_[_0xa1f3('0x2d')](_0x3c09f2[_0xa1f3('0x29')],qs['fields'](_0x37d4b9[_0xa1f3('0x2b')][_0xa1f3('0x2f')]));_0x4c8149[_0xa1f3('0x2e')]=_0x4c8149[_0xa1f3('0x2e')][_0xa1f3('0x30')]?_0x4c8149[_0xa1f3('0x2e')]:_0x3c09f2[_0xa1f3('0x29')];_0x4c8149[_0xa1f3('0x33')]=qs[_0xa1f3('0x34')](_0x37d4b9[_0xa1f3('0x2b')][_0xa1f3('0x34')]);_0x4c8149[_0xa1f3('0x35')]=qs[_0xa1f3('0x2c')](_[_0xa1f3('0x50')](_0x37d4b9[_0xa1f3('0x2b')],_0x3c09f2[_0xa1f3('0x2c')]));if(_0x37d4b9[_0xa1f3('0x2b')][_0xa1f3('0x36')]){_0x4c8149[_0xa1f3('0x35')]=_[_0xa1f3('0x37')](_0x4c8149['where'],{'$or':_['map'](_0x4c8149[_0xa1f3('0x2e')],function(_0x3b5ccb){var _0x199b5f={};_0x199b5f[_0x3b5ccb]={'$like':'%'+_0x37d4b9['query'][_0xa1f3('0x36')]+'%'};return _0x199b5f;})});}_0x4c8149=_[_0xa1f3('0x37')]({},_0x4c8149,_0x37d4b9['options']);return _0x59e4a4[_0xa1f3('0x4e')](_0x4c8149);}})[_0xa1f3('0x1f')](function(_0x1399ef){if(_0x1399ef){_0x1c0e88=_0x1399ef['length'];if(!_0x37d4b9['query']['hasOwnProperty']('nolimit')){_0x4c8149['limit']=qs[_0xa1f3('0x32')](_0x37d4b9[_0xa1f3('0x2b')][_0xa1f3('0x32')]);_0x4c8149['offset']=qs[_0xa1f3('0x1b')](_0x37d4b9[_0xa1f3('0x2b')]['offset']);}return _0x59e4a4[_0xa1f3('0x4e')](_0x4c8149);}})['then'](function(_0x903eb0){if(_0x903eb0){return _0x903eb0?{'count':_0x1c0e88,'rows':_0x903eb0}:null;}})[_0xa1f3('0x1f')](respondWithResult(_0x19c229,null))[_0xa1f3('0x3d')](handleError(_0x19c229,null));}; \ No newline at end of file +var _0x9aef=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','Companies','UserProfileResource','destroy','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','CmContact','options','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4c02d9,_0x48bc4c){var _0x204607=function(_0x28573b){while(--_0x28573b){_0x4c02d9['push'](_0x4c02d9['shift']());}};_0x204607(++_0x48bc4c);}(_0x9aef,0xa3));var _0xf9ae=function(_0x2c8972,_0x32cd0f){_0x2c8972=_0x2c8972-0x0;var _0x2de078=_0x9aef[_0x2c8972];return _0x2de078;};'use strict';var pdf=require(_0xf9ae('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf9ae('0x1'));var zipdir=require(_0xf9ae('0x2'));var jsonpatch=require(_0xf9ae('0x3'));var rp=require(_0xf9ae('0x4'));var moment=require(_0xf9ae('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf9ae('0x6'));var util=require(_0xf9ae('0x7'));var path=require(_0xf9ae('0x8'));var sox=require(_0xf9ae('0x9'));var csv=require(_0xf9ae('0xa'));var ejs=require(_0xf9ae('0xb'));var fs=require('fs');var _=require(_0xf9ae('0xc'));var squel=require(_0xf9ae('0xd'));var crypto=require(_0xf9ae('0xe'));var jsforce=require(_0xf9ae('0xf'));var deskjs=require(_0xf9ae('0x10'));var toCsv=require(_0xf9ae('0xa'));var querystring=require(_0xf9ae('0x11'));var Papa=require(_0xf9ae('0x12'));var Redis=require(_0xf9ae('0x13'));var authService=require(_0xf9ae('0x14'));var qs=require(_0xf9ae('0x15'));var as=require(_0xf9ae('0x16'));var hardwareService=require(_0xf9ae('0x17'));var logger=require(_0xf9ae('0x18'))(_0xf9ae('0x19'));var utils=require(_0xf9ae('0x1a'));var config=require(_0xf9ae('0x1b'));var db=require(_0xf9ae('0x1c'))['db'];function respondWithStatusCode(_0x37802f,_0x494f23){_0x494f23=_0x494f23||0xcc;return function(_0x49aa41){if(_0x49aa41){return _0x37802f[_0xf9ae('0x1d')](_0x494f23);}return _0x37802f[_0xf9ae('0x1e')](_0x494f23)['end']();};}function respondWithResult(_0x161ad7,_0x4916da){_0x4916da=_0x4916da||0xc8;return function(_0x410c10){if(_0x410c10){return _0x161ad7[_0xf9ae('0x1e')](_0x4916da)[_0xf9ae('0x1f')](_0x410c10);}};}function respondWithFilteredResult(_0x4f9aaa,_0x220b50){return function(_0x30a6c9){if(_0x30a6c9){var _0x2db41c=_0x30a6c9[_0xf9ae('0x20')],_0x35596f=_0x220b50[_0xf9ae('0x21')],_0x149560=_0x220b50['offset']+_0x220b50[_0xf9ae('0x22')],_0x5c432b;if(_0x149560>=_0x2db41c){_0x149560=_0x2db41c;_0x5c432b=0xc8;}else{_0x5c432b=0xce;}_0x4f9aaa[_0xf9ae('0x1e')](_0x5c432b);return _0x4f9aaa[_0xf9ae('0x23')](_0xf9ae('0x24'),_0x35596f+'-'+_0x149560+'/'+_0x2db41c)[_0xf9ae('0x1f')](_0x30a6c9);}return null;};}function patchUpdates(_0x2b218a){return function(_0x141d20){try{jsonpatch['apply'](_0x141d20,_0x2b218a,!![]);}catch(_0x401ea0){return BPromise[_0xf9ae('0x25')](_0x401ea0);}return _0x141d20[_0xf9ae('0x26')]();};}function saveUpdates(_0x19bbf7,_0x595c87){return function(_0x30d8fd){if(_0x30d8fd){return _0x30d8fd[_0xf9ae('0x27')](_0x19bbf7)[_0xf9ae('0x28')](function(_0x28facc){return _0x28facc;});}return null;};}function removeEntity(_0x26cb42,_0x1b976e){return function(_0x3bb356){if(_0x3bb356){return _0x3bb356['destroy']()[_0xf9ae('0x28')](function(){var _0x6aefd1=_0x3bb356[_0xf9ae('0x29')]({'plain':!![]});var _0x26dca5=_0xf9ae('0x2a');return db[_0xf9ae('0x2b')][_0xf9ae('0x2c')]({'where':{'type':_0x26dca5,'resourceId':_0x6aefd1['id']}})[_0xf9ae('0x28')](function(){return _0x3bb356;});})['then'](function(){_0x26cb42['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5bc92e,_0x8eeb76){return function(_0x230f8c){if(!_0x230f8c){_0x5bc92e[_0xf9ae('0x1d')](0x194);}return _0x230f8c;};}function handleError(_0x47822f,_0x8e47c4){_0x8e47c4=_0x8e47c4||0x1f4;return function(_0x1b0f82){logger[_0xf9ae('0x2d')](_0x1b0f82[_0xf9ae('0x2e')]);if(_0x1b0f82[_0xf9ae('0x2f')]){delete _0x1b0f82[_0xf9ae('0x2f')];}_0x47822f[_0xf9ae('0x1e')](_0x8e47c4)[_0xf9ae('0x30')](_0x1b0f82);};}exports[_0xf9ae('0x31')]=function(_0x171095,_0x17607d){var _0x5f0aaf={},_0x2538de={},_0x12bf0d={'count':0x0,'rows':[]};return db[_0xf9ae('0x32')][_0xf9ae('0x33')]()[_0xf9ae('0x28')](function(_0x54f3d9){_0x2538de[_0xf9ae('0x34')]=_[_0xf9ae('0x35')](_0x54f3d9);_0x2538de[_0xf9ae('0x36')]=_[_0xf9ae('0x35')](_0x171095[_0xf9ae('0x36')]);_0x2538de[_0xf9ae('0x37')]=_[_0xf9ae('0x38')](_0x2538de[_0xf9ae('0x34')],_0x2538de[_0xf9ae('0x36')]);_0x5f0aaf['attributes']=_[_0xf9ae('0x38')](_0x2538de[_0xf9ae('0x34')],qs['fields'](_0x171095[_0xf9ae('0x36')]['fields']));_0x5f0aaf[_0xf9ae('0x39')]=_0x5f0aaf[_0xf9ae('0x39')][_0xf9ae('0x3a')]?_0x5f0aaf[_0xf9ae('0x39')]:_0x2538de['model'];if(!_0x171095[_0xf9ae('0x36')][_0xf9ae('0x3b')](_0xf9ae('0x3c'))){_0x5f0aaf['limit']=qs[_0xf9ae('0x22')](_0x171095[_0xf9ae('0x36')]['limit']);_0x5f0aaf[_0xf9ae('0x21')]=qs['offset'](_0x171095[_0xf9ae('0x36')]['offset']);}_0x5f0aaf[_0xf9ae('0x3d')]=qs[_0xf9ae('0x3e')](_0x171095['query']['sort']);_0x5f0aaf[_0xf9ae('0x3f')]=qs[_0xf9ae('0x37')](_[_0xf9ae('0x40')](_0x171095[_0xf9ae('0x36')],_0x2538de[_0xf9ae('0x37')]));if(_0x171095[_0xf9ae('0x36')][_0xf9ae('0x41')]){_0x5f0aaf[_0xf9ae('0x3f')]=_[_0xf9ae('0x42')](_0x5f0aaf[_0xf9ae('0x3f')],{'$or':_[_0xf9ae('0x43')](_0x5f0aaf[_0xf9ae('0x39')],function(_0x919b7a){var _0x828548={};_0x828548[_0x919b7a]={'$like':'%'+_0x171095[_0xf9ae('0x36')][_0xf9ae('0x41')]+'%'};return _0x828548;})});}_0x5f0aaf=_['merge']({},_0x5f0aaf,_0x171095['options']);var _0x33b19b={'where':_0x5f0aaf[_0xf9ae('0x3f')]};return db['CmCompany'][_0xf9ae('0x20')](_0x33b19b)[_0xf9ae('0x28')](function(_0x20ec22){_0x12bf0d[_0xf9ae('0x20')]=_0x20ec22;if(_0x171095[_0xf9ae('0x36')][_0xf9ae('0x44')]){_0x5f0aaf['include']=[{'all':!![]}];}return db[_0xf9ae('0x32')][_0xf9ae('0x45')](_0x5f0aaf);})[_0xf9ae('0x28')](function(_0x13a82c){_0x12bf0d[_0xf9ae('0x46')]=_0x13a82c;return _0x12bf0d;})[_0xf9ae('0x28')](respondWithFilteredResult(_0x17607d,_0x5f0aaf))['catch'](handleError(_0x17607d,null));})[_0xf9ae('0x47')](handleError(_0x17607d,null));};exports[_0xf9ae('0x48')]=function(_0x38172e,_0x40085a){var _0xef39b5={'raw':![],'where':{'id':_0x38172e[_0xf9ae('0x49')]['id']}},_0x2e2802={};_0x2e2802[_0xf9ae('0x34')]=_[_0xf9ae('0x35')](db[_0xf9ae('0x32')][_0xf9ae('0x4a')]);_0x2e2802['query']=_[_0xf9ae('0x35')](_0x38172e[_0xf9ae('0x36')]);_0x2e2802[_0xf9ae('0x37')]=_['intersection'](_0x2e2802[_0xf9ae('0x34')],_0x2e2802['query']);_0xef39b5[_0xf9ae('0x39')]=_[_0xf9ae('0x38')](_0x2e2802[_0xf9ae('0x34')],qs[_0xf9ae('0x4b')](_0x38172e[_0xf9ae('0x36')]['fields']));_0xef39b5['attributes']=_0xef39b5[_0xf9ae('0x39')][_0xf9ae('0x3a')]?_0xef39b5[_0xf9ae('0x39')]:_0x2e2802[_0xf9ae('0x34')];if(_0x38172e[_0xf9ae('0x36')][_0xf9ae('0x44')]){_0xef39b5[_0xf9ae('0x4c')]=[{'all':!![]}];}_0xef39b5=_[_0xf9ae('0x42')]({},_0xef39b5,_0x38172e['options']);return db[_0xf9ae('0x32')][_0xf9ae('0x4d')](_0xef39b5)[_0xf9ae('0x28')](handleEntityNotFound(_0x40085a,null))[_0xf9ae('0x28')](respondWithResult(_0x40085a,null))[_0xf9ae('0x47')](handleError(_0x40085a,null));};exports[_0xf9ae('0x4e')]=function(_0x3d41ba,_0x32637b){return db[_0xf9ae('0x32')][_0xf9ae('0x4e')](_0x3d41ba[_0xf9ae('0x4f')],{})['then'](function(_0x1586b4){var _0x4b01e0=_0x3d41ba[_0xf9ae('0x50')]['get']({'plain':!![]});if(!_0x4b01e0)throw new Error(_0xf9ae('0x51'));if(_0x4b01e0[_0xf9ae('0x52')]===_0xf9ae('0x50')){var _0x23ff2f=_0x1586b4[_0xf9ae('0x29')]({'plain':!![]});var _0x566f6d=_0xf9ae('0x2a');return db[_0xf9ae('0x53')]['find']({'where':{'name':_0x566f6d,'userProfileId':_0x4b01e0[_0xf9ae('0x54')]},'raw':!![]})[_0xf9ae('0x28')](function(_0x53b338){if(_0x53b338&&_0x53b338['autoAssociation']===0x0){return db[_0xf9ae('0x2b')][_0xf9ae('0x4e')]({'name':_0x23ff2f['name'],'resourceId':_0x23ff2f['id'],'type':_0x53b338['name'],'sectionId':_0x53b338['id']},{})[_0xf9ae('0x28')](function(){return _0x1586b4;});}else{return _0x1586b4;}})['catch'](function(_0x43c3f3){logger[_0xf9ae('0x2d')](_0xf9ae('0x55'),_0x43c3f3);throw _0x43c3f3;});}return _0x1586b4;})[_0xf9ae('0x28')](respondWithResult(_0x32637b,0xc9))['catch'](handleError(_0x32637b,null));};exports['update']=function(_0x366de4,_0x5d5369){if(_0x366de4[_0xf9ae('0x4f')]['id']){delete _0x366de4[_0xf9ae('0x4f')]['id'];}return db[_0xf9ae('0x32')]['find']({'where':{'id':_0x366de4['params']['id']}})[_0xf9ae('0x28')](handleEntityNotFound(_0x5d5369,null))[_0xf9ae('0x28')](saveUpdates(_0x366de4[_0xf9ae('0x4f')],null))['then'](respondWithResult(_0x5d5369,null))[_0xf9ae('0x47')](handleError(_0x5d5369,null));};exports[_0xf9ae('0x2c')]=function(_0x3311ee,_0x18b760){return db[_0xf9ae('0x32')][_0xf9ae('0x4d')]({'where':{'id':_0x3311ee[_0xf9ae('0x49')]['id']}})[_0xf9ae('0x28')](handleEntityNotFound(_0x18b760,null))['then'](removeEntity(_0x18b760,null))[_0xf9ae('0x47')](handleError(_0x18b760,null));};exports[_0xf9ae('0x33')]=function(_0x44fca6,_0x1b8fa1){return db['CmCompany'][_0xf9ae('0x33')]()['then'](respondWithResult(_0x1b8fa1,null))[_0xf9ae('0x47')](handleError(_0x1b8fa1,null));};exports['addContacts']=function(_0x5423dd,_0x177c3f,_0x2f692e){return db['CmContact']['find']({'where':{'id':_0x5423dd[_0xf9ae('0x49')]['id']}})[_0xf9ae('0x28')](handleEntityNotFound(_0x177c3f,null))[_0xf9ae('0x28')](function(_0x4c596a){if(_0x4c596a){return _0x4c596a[_0xf9ae('0x56')](_0x5423dd['body'][_0xf9ae('0x57')],_[_0xf9ae('0x58')](_0x5423dd[_0xf9ae('0x4f')],[_0xf9ae('0x57'),'id'])||{});}})[_0xf9ae('0x28')](respondWithResult(_0x177c3f,null))[_0xf9ae('0x47')](handleError(_0x177c3f,null));};exports[_0xf9ae('0x59')]=function(_0xcaee83,_0x2d498d,_0x2bf201){var _0x48eb56={};var _0x43bb6b={};var _0x571b7b;var _0x2f383a;return db['CmCompany'][_0xf9ae('0x5a')]({'where':{'id':_0xcaee83[_0xf9ae('0x49')]['id']}})[_0xf9ae('0x28')](handleEntityNotFound(_0x2d498d,null))[_0xf9ae('0x28')](function(_0x4e5ff2){if(_0x4e5ff2){_0x571b7b=_0x4e5ff2;_0x43bb6b[_0xf9ae('0x34')]=_['keys'](db[_0xf9ae('0x5b')][_0xf9ae('0x4a')]);_0x43bb6b[_0xf9ae('0x36')]=_[_0xf9ae('0x35')](_0xcaee83[_0xf9ae('0x36')]);_0x43bb6b['filters']=_[_0xf9ae('0x38')](_0x43bb6b[_0xf9ae('0x34')],_0x43bb6b['query']);_0x48eb56[_0xf9ae('0x39')]=_[_0xf9ae('0x38')](_0x43bb6b[_0xf9ae('0x34')],qs['fields'](_0xcaee83[_0xf9ae('0x36')][_0xf9ae('0x4b')]));_0x48eb56[_0xf9ae('0x39')]=_0x48eb56[_0xf9ae('0x39')]['length']?_0x48eb56[_0xf9ae('0x39')]:_0x43bb6b[_0xf9ae('0x34')];_0x48eb56['order']=qs[_0xf9ae('0x3e')](_0xcaee83['query'][_0xf9ae('0x3e')]);_0x48eb56[_0xf9ae('0x3f')]=qs[_0xf9ae('0x37')](_[_0xf9ae('0x40')](_0xcaee83['query'],_0x43bb6b[_0xf9ae('0x37')]));if(_0xcaee83['query']['filter']){_0x48eb56[_0xf9ae('0x3f')]=_[_0xf9ae('0x42')](_0x48eb56[_0xf9ae('0x3f')],{'$or':_[_0xf9ae('0x43')](_0x48eb56[_0xf9ae('0x39')],function(_0x2874d4){var _0x183875={};_0x183875[_0x2874d4]={'$like':'%'+_0xcaee83['query']['filter']+'%'};return _0x183875;})});}_0x48eb56=_['merge']({},_0x48eb56,_0xcaee83[_0xf9ae('0x5c')]);return _0x571b7b[_0xf9ae('0x59')](_0x48eb56);}})[_0xf9ae('0x28')](function(_0x252ccf){if(_0x252ccf){_0x2f383a=_0x252ccf[_0xf9ae('0x3a')];if(!_0xcaee83[_0xf9ae('0x36')][_0xf9ae('0x3b')](_0xf9ae('0x3c'))){_0x48eb56[_0xf9ae('0x22')]=qs[_0xf9ae('0x22')](_0xcaee83[_0xf9ae('0x36')][_0xf9ae('0x22')]);_0x48eb56[_0xf9ae('0x21')]=qs[_0xf9ae('0x21')](_0xcaee83['query'][_0xf9ae('0x21')]);}return _0x571b7b[_0xf9ae('0x59')](_0x48eb56);}})[_0xf9ae('0x28')](function(_0x53e78b){if(_0x53e78b){return _0x53e78b?{'count':_0x2f383a,'rows':_0x53e78b}:null;}})['then'](respondWithResult(_0x2d498d,null))[_0xf9ae('0x47')](handleError(_0x2d498d,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index bf913f9..a60520d 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 _0x8d0e=['define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes'];(function(_0xa92013,_0x3b2577){var _0x49fdfa=function(_0x4b88a6){while(--_0x4b88a6){_0xa92013['push'](_0xa92013['shift']());}};_0x49fdfa(++_0x3b2577);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x15f98d,_0x2123a9){_0x15f98d=_0x15f98d-0x0;var _0x4aa8dc=_0x8d0e[_0x15f98d];return _0x4aa8dc;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var logger=require(_0xe8d0('0x2'))(_0xe8d0('0x3'));var moment=require(_0xe8d0('0x4'));var BPromise=require(_0xe8d0('0x5'));var rp=require(_0xe8d0('0x6'));var fs=require('fs');var path=require(_0xe8d0('0x7'));var rimraf=require(_0xe8d0('0x8'));var config=require('../../config/environment');var attributes=require(_0xe8d0('0x9'));module['exports']=function(_0x560dab,_0x2e2985){return _0x560dab[_0xe8d0('0xa')](_0xe8d0('0xb'),attributes,{'tableName':_0xe8d0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe015=['lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','cm_companies'];(function(_0x23811e,_0x425f5f){var _0x350280=function(_0x1f8d16){while(--_0x1f8d16){_0x23811e['push'](_0x23811e['shift']());}};_0x350280(++_0x425f5f);}(_0xe015,0x13b));var _0x5e01=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xe015[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('CmCompany',attributes,{'tableName':_0x5e01('0x8'),'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 326bb5f..11331fa 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 _0xfe64=['../../config/logger','rpc','jayson/promise','client','request','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x3b8fa6,_0x50570e){var _0xed1d0a=function(_0x3c90f6){while(--_0x3c90f6){_0x3b8fa6['push'](_0x3b8fa6['shift']());}};_0xed1d0a(++_0x50570e);}(_0xfe64,0x88));var _0x4fe6=function(_0xc7664a,_0x5ee2b4){_0xc7664a=_0xc7664a-0x0;var _0x1da165=_0xfe64[_0xc7664a];return _0x1da165;};'use strict';var _=require(_0x4fe6('0x0'));var util=require('util');var moment=require(_0x4fe6('0x1'));var BPromise=require('bluebird');var rs=require(_0x4fe6('0x2'));var fs=require('fs');var Redis=require(_0x4fe6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4fe6('0x4'))(_0x4fe6('0x5'));var config=require('../../config/environment');var jayson=require(_0x4fe6('0x6'));var client=jayson[_0x4fe6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23af33,_0x18453e,_0x2c3879){return new BPromise(function(_0x3e4b9c,_0x54b89b){return client[_0x4fe6('0x8')](_0x23af33,_0x2c3879)['then'](function(_0x34853c){logger['info'](_0x4fe6('0x9'),_0x18453e,'request\x20sent');logger[_0x4fe6('0xa')](_0x4fe6('0xb'),_0x18453e,_0x4fe6('0xc'),JSON[_0x4fe6('0xd')](_0x34853c));if(_0x34853c['error']){if(_0x34853c[_0x4fe6('0xe')][_0x4fe6('0xf')]===0x1f4){logger[_0x4fe6('0xe')](_0x4fe6('0x9'),_0x18453e,_0x34853c[_0x4fe6('0xe')]['message']);return _0x54b89b(_0x34853c[_0x4fe6('0xe')][_0x4fe6('0x10')]);}logger[_0x4fe6('0xe')]('CmCompany,\x20%s,\x20%s',_0x18453e,_0x34853c[_0x4fe6('0xe')][_0x4fe6('0x10')]);return _0x3e4b9c(_0x34853c[_0x4fe6('0xe')][_0x4fe6('0x10')]);}else{logger[_0x4fe6('0x11')]('CmCompany,\x20%s,\x20%s',_0x18453e,_0x4fe6('0xc'));_0x3e4b9c(_0x34853c[_0x4fe6('0x12')][_0x4fe6('0x10')]);}})[_0x4fe6('0x13')](function(_0x54839b){logger[_0x4fe6('0xe')]('CmCompany,\x20%s,\x20%s',_0x18453e,_0x54839b);_0x54b89b(_0x54839b);});});} \ No newline at end of file +var _0x36fd=['CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x411270,_0x28df20){var _0x2dd9a7=function(_0x3454e2){while(--_0x3454e2){_0x411270['push'](_0x411270['shift']());}};_0x2dd9a7(++_0x28df20);}(_0x36fd,0x11a));var _0xd36f=function(_0x651702,_0x5ad06c){_0x651702=_0x651702-0x0;var _0x55209a=_0x36fd[_0x651702];return _0x55209a;};'use strict';var _=require(_0xd36f('0x0'));var util=require(_0xd36f('0x1'));var moment=require(_0xd36f('0x2'));var BPromise=require(_0xd36f('0x3'));var rs=require(_0xd36f('0x4'));var fs=require('fs');var Redis=require(_0xd36f('0x5'));var db=require(_0xd36f('0x6'))['db'];var utils=require(_0xd36f('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xd36f('0x8'));var jayson=require(_0xd36f('0x9'));var client=jayson[_0xd36f('0xa')][_0xd36f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x458d6c,_0x358525,_0x89b96c){return new BPromise(function(_0x3a98d9,_0x2cf251){return client[_0xd36f('0xc')](_0x458d6c,_0x89b96c)['then'](function(_0xa6f340){logger[_0xd36f('0xd')](_0xd36f('0xe'),_0x358525,_0xd36f('0xf'));logger[_0xd36f('0x10')](_0xd36f('0x11'),_0x358525,'request\x20sent',JSON['stringify'](_0xa6f340));if(_0xa6f340[_0xd36f('0x12')]){if(_0xa6f340[_0xd36f('0x12')][_0xd36f('0x13')]===0x1f4){logger[_0xd36f('0x12')](_0xd36f('0xe'),_0x358525,_0xa6f340['error'][_0xd36f('0x14')]);return _0x2cf251(_0xa6f340['error']['message']);}logger['error'](_0xd36f('0xe'),_0x358525,_0xa6f340[_0xd36f('0x12')][_0xd36f('0x14')]);return _0x3a98d9(_0xa6f340[_0xd36f('0x12')]['message']);}else{logger[_0xd36f('0xd')](_0xd36f('0xe'),_0x358525,_0xd36f('0xf'));_0x3a98d9(_0xa6f340[_0xd36f('0x15')]['message']);}})[_0xd36f('0x16')](function(_0x1068de){logger[_0xd36f('0x12')](_0xd36f('0xe'),_0x358525,_0x1068de);_0x2cf251(_0x1068de);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 4c91489..2c5387e 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 _0xa456=['update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post'];(function(_0x292dcf,_0x459f1a){var _0x1b4ee6=function(_0x33dc1d){while(--_0x33dc1d){_0x292dcf['push'](_0x292dcf['shift']());}};_0x1b4ee6(++_0x459f1a);}(_0xa456,0x142));var _0x6a45=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xa456[_0x36eaaa];return _0x461349;};'use strict';var multer=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var path=require(_0x6a45('0x2'));var timeout=require(_0x6a45('0x3'));var express=require('express');var router=express[_0x6a45('0x4')]();var auth=require(_0x6a45('0x5'));var interaction=require(_0x6a45('0x6'));var config=require('../../config/environment');var controller=require(_0x6a45('0x7'));router[_0x6a45('0x8')]('/',auth[_0x6a45('0x9')](),controller[_0x6a45('0xa')]);router['get'](_0x6a45('0xb'),auth[_0x6a45('0x9')](),controller[_0x6a45('0xc')]);router[_0x6a45('0x8')](_0x6a45('0xd'),auth['isAuthenticated'](),controller[_0x6a45('0xe')]);router['get'](_0x6a45('0xf'),auth[_0x6a45('0x9')](),controller[_0x6a45('0x10')]);router[_0x6a45('0x11')]('/',auth[_0x6a45('0x9')](),controller['create']);router['post'](_0x6a45('0xf'),auth[_0x6a45('0x9')](),controller['addContacts']);router['put']('/:id',auth[_0x6a45('0x9')](),controller[_0x6a45('0x12')]);router[_0x6a45('0x13')](_0x6a45('0xd'),auth[_0x6a45('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc1c6=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','getContacts','post','/:id/contacts','put','delete','destroy','exports'];(function(_0x4e7ce4,_0x1ee13c){var _0x431441=function(_0x58e3e5){while(--_0x58e3e5){_0x4e7ce4['push'](_0x4e7ce4['shift']());}};_0x431441(++_0x1ee13c);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x6a3061,_0x1fefc1){_0x6a3061=_0x6a3061-0x0;var _0x4c9dd9=_0xc1c6[_0x6a3061];return _0x4c9dd9;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var auth=require(_0x6c1c('0x4'));var interaction=require(_0x6c1c('0x5'));var config=require(_0x6c1c('0x6'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x6c1c('0x7')](),controller['index']);router[_0x6c1c('0x8')]('/describe',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0x9')]);router[_0x6c1c('0x8')](_0x6c1c('0xa'),auth['isAuthenticated'](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x8')]('/:id/contacts',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0xc')]);router[_0x6c1c('0xd')]('/',auth[_0x6c1c('0x7')](),controller['create']);router[_0x6c1c('0xd')](_0x6c1c('0xe'),auth[_0x6c1c('0x7')](),controller['addContacts']);router[_0x6c1c('0xf')](_0x6c1c('0xa'),auth[_0x6c1c('0x7')](),controller['update']);router[_0x6c1c('0x10')]('/:id',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0x11')]);module[_0x6c1c('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index e1bcccd..e5bc245 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 _0xa9c8=['DATE','NOW','exports','STRING','INTEGER','UNSIGNED'];(function(_0x54b7fc,_0x5a8cb6){var _0x2195e7=function(_0x3dd717){while(--_0x3dd717){_0x54b7fc['push'](_0x54b7fc['shift']());}};_0x2195e7(++_0x5a8cb6);}(_0xa9c8,0x11c));var _0x8a9c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9c8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x8a9c('0x0')]={'firstName':{'type':Sequelize[_0x8a9c('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0x8a9c('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x8a9c('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x8a9c('0x1')]},'dateOfBirth':{'type':Sequelize[_0x8a9c('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x8a9c('0x1')]},'fax':{'type':Sequelize[_0x8a9c('0x1')]},'email':{'type':Sequelize[_0x8a9c('0x1')]},'url':{'type':Sequelize[_0x8a9c('0x1')]},'facebook':{'type':Sequelize[_0x8a9c('0x1')]},'fb_data':{'type':Sequelize[_0x8a9c('0x1')]},'twitter':{'type':Sequelize[_0x8a9c('0x1')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x8a9c('0x1')]},'viber':{'type':Sequelize[_0x8a9c('0x1')]},'line':{'type':Sequelize[_0x8a9c('0x1')]},'wechat':{'type':Sequelize[_0x8a9c('0x1')]},'telegram':{'type':Sequelize[_0x8a9c('0x1')]},'UserId':{'type':Sequelize[_0x8a9c('0x2')]},'priority':{'type':Sequelize[_0x8a9c('0x2')](0x2)[_0x8a9c('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8a9c('0x4')],'defaultValue':Sequelize[_0x8a9c('0x5')]}}; \ No newline at end of file +var _0x38ab=['STRING','INTEGER','DATE','NOW','lodash','exports'];(function(_0x210e6b,_0x13d0af){var _0x2471b4=function(_0x1c0dce){while(--_0x1c0dce){_0x210e6b['push'](_0x210e6b['shift']());}};_0x2471b4(++_0x13d0af);}(_0x38ab,0xfa));var _0xb38a=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0x38ab[_0x21af3a];return _0x268a49;};'use strict';var _=require(_0xb38a('0x0'));var Sequelize=require('sequelize');module[_0xb38a('0x1')]={'firstName':{'type':Sequelize[_0xb38a('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xb38a('0x2')]},'street':{'type':Sequelize[_0xb38a('0x2')]},'postalCode':{'type':Sequelize[_0xb38a('0x2')]},'city':{'type':Sequelize[_0xb38a('0x2')]},'country':{'type':Sequelize[_0xb38a('0x2')]},'dateOfBirth':{'type':Sequelize[_0xb38a('0x2')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xb38a('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xb38a('0x2')]},'facebook':{'type':Sequelize[_0xb38a('0x2')]},'fb_data':{'type':Sequelize[_0xb38a('0x2')]},'twitter':{'type':Sequelize[_0xb38a('0x2')]},'skype':{'type':Sequelize[_0xb38a('0x2')]},'teams':{'type':Sequelize[_0xb38a('0x2')]},'viber':{'type':Sequelize[_0xb38a('0x2')]},'line':{'type':Sequelize[_0xb38a('0x2')]},'wechat':{'type':Sequelize[_0xb38a('0x2')]},'telegram':{'type':Sequelize[_0xb38a('0x2')]},'UserId':{'type':Sequelize[_0xb38a('0x3')]},'priority':{'type':Sequelize[_0xb38a('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xb38a('0x4')],'defaultValue':Sequelize[_0xb38a('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 940ae53..ce462aa 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 _0x5f3a=['defaults','localhost','socket.io-emitter','register','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','then','name','index','CmContact','keys','length','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','type','model','query','filters','intersection','attributes','nolimit','sort','where','field','color','from','tools_tags','uc.CmContactId\x20=\x20c.id','left_join','ct.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','Tag','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','dateOfBirth','fieldType','castTo','DATE','buildExpression','hasOwnProperty','filter','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','\x27\x27\x27\x27','getFullTextValue','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','Sequelize','clone','c.id','order','DESC','t.id\x20IN\x20?','resolve','some','User','getLists','c.ListId\x20IS\x20NULL','toString','sequelize','keyBy','merge','fields','c.firstName','c.lastName','c.mobile','c.ListId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','find','params','describe','tags','columnName','displayName','findAll','alias','values','body','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','destroy','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','update','ChatOfflineMessage','MailInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','join','bulkCreate','duplicates','$or','findOrCreate','spread','$and','format','omit','pickBy','cf_%d','table','cm_contacts','setFields','toParam','phone','getTags','pick','options','setTags','ids','getHoppers','rawAttributes','ContactId','includeAll','getHopperHistories','include','getHopperFinals','getJscriptySessions','No\x20ListId\x20specified','binding_keys','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','parse','meta','import','agent','binding','No\x20phone\x20column\x20specified','child_process','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0x5f3a,0xd3));var _0xa5f3=function(_0x107f75,_0x117428){_0x107f75=_0x107f75-0x0;var _0x503a3f=_0x5f3a[_0x107f75];return _0x503a3f;};'use strict';var pdf=require(_0xa5f3('0x0'));var emlformat=require(_0xa5f3('0x1'));var rimraf=require(_0xa5f3('0x2'));var zipdir=require(_0xa5f3('0x3'));var jsonpatch=require(_0xa5f3('0x4'));var rp=require(_0xa5f3('0x5'));var moment=require(_0xa5f3('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa5f3('0x7'));var util=require(_0xa5f3('0x8'));var path=require(_0xa5f3('0x9'));var sox=require('sox');var csv=require(_0xa5f3('0xa'));var ejs=require(_0xa5f3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa5f3('0xc'));var jsforce=require(_0xa5f3('0xd'));var deskjs=require(_0xa5f3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa5f3('0xf'));var Papa=require(_0xa5f3('0x10'));var Redis=require(_0xa5f3('0x11'));var authService=require(_0xa5f3('0x12'));var qs=require(_0xa5f3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5f3('0x14'));var logger=require('../../config/logger')(_0xa5f3('0x15'));var utils=require('../../config/utils');var config=require(_0xa5f3('0x16'));var db=require(_0xa5f3('0x17'))['db'];config[_0xa5f3('0x18')]=_[_0xa5f3('0x19')](config[_0xa5f3('0x18')],{'host':_0xa5f3('0x1a'),'port':0x18eb});var socket=require(_0xa5f3('0x1b'))(new Redis(config[_0xa5f3('0x18')]));require('./cmContact.socket')[_0xa5f3('0x1c')](socket);function respondWithStatusCode(_0x50c170,_0x18e5dc){_0x18e5dc=_0x18e5dc||0xcc;return function(_0x5f53eb){if(_0x5f53eb){return _0x50c170[_0xa5f3('0x1d')](_0x18e5dc);}return _0x50c170['status'](_0x18e5dc)[_0xa5f3('0x1e')]();};}function respondWithResult(_0x4d9c96,_0x46e898){_0x46e898=_0x46e898||0xc8;return function(_0x16ef0d){if(_0x16ef0d){return _0x4d9c96['status'](_0x46e898)[_0xa5f3('0x1f')](_0x16ef0d);}};}function respondWithFilteredResult(_0x92c55a,_0x54d59b){return function(_0x4e8f1d){if(_0x4e8f1d){var _0xcba559=_0x4e8f1d[_0xa5f3('0x20')],_0x54582f=_0x54d59b[_0xa5f3('0x21')],_0x344d0a=_0x54d59b[_0xa5f3('0x21')]+_0x54d59b[_0xa5f3('0x22')],_0x1f49b6;if(_0x344d0a>=_0xcba559){_0x344d0a=_0xcba559;_0x1f49b6=0xc8;}else{_0x1f49b6=0xce;}_0x92c55a[_0xa5f3('0x23')](_0x1f49b6);return _0x92c55a[_0xa5f3('0x24')](_0xa5f3('0x25'),_0x54582f+'-'+_0x344d0a+'/'+_0xcba559)['json'](_0x4e8f1d);}return null;};}function patchUpdates(_0x4703bb){return function(_0x1c7173){try{jsonpatch[_0xa5f3('0x26')](_0x1c7173,_0x4703bb,!![]);}catch(_0x54f6f1){return BPromise[_0xa5f3('0x27')](_0x54f6f1);}return _0x1c7173['save']();};}function saveUpdates(_0x2e5cd1,_0x49f384){return function(_0xd99723){if(_0xd99723){return _0xd99723['update'](_0x2e5cd1)[_0xa5f3('0x28')](function(_0x15e428){return _0x15e428;});}return null;};}function removeEntity(_0xf53548,_0x19823f){return function(_0x191966){if(_0x191966){return _0x191966['destroy']()[_0xa5f3('0x28')](function(){_0xf53548[_0xa5f3('0x23')](0xcc)[_0xa5f3('0x1e')]();});}};}function handleEntityNotFound(_0x56b164,_0x258bf9){return function(_0x110b5e){if(!_0x110b5e){_0x56b164[_0xa5f3('0x1d')](0x194);}return _0x110b5e;};}function handleError(_0x1600d0,_0x34ded9){_0x34ded9=_0x34ded9||0x1f4;return function(_0xa72863){logger['error'](_0xa72863['stack']);if(_0xa72863[_0xa5f3('0x29')]){delete _0xa72863['name'];}_0x1600d0[_0xa5f3('0x23')](_0x34ded9)['send'](_0xa72863);};}exports[_0xa5f3('0x2a')]=function(_0x2f0ba6,_0x2eaf32){var _0x2a4ecf={},_0x54eeb9={},_0x574f7a={'count':0x0,'rows':[]};return db[_0xa5f3('0x2b')]['describe']()[_0xa5f3('0x28')](function(_0x53bf8d){var _0x4898ae=[];for(var _0x43743f=0x0;_0x43743f0x1){_0x1dc513['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa5f3('0x67')](_0x5dc44f),null);}else{if(qs['isNumeric'](_0x5dc44f)){_0x1dc513['or'](_0xa5f3('0x68'),_0x5dc44f+'%');_0x1dc513['or']('c.phone\x20LIKE\x20?',_0x5dc44f+'%');_0x1dc513['or'](_0xa5f3('0x69'),_0x5dc44f+'%');_0x1dc513['or']('c.fax\x20LIKE\x20?',_0x5dc44f+'%');}else if(qs[_0xa5f3('0x6a')](_0x5dc44f)){_0x1dc513['or'](_0xa5f3('0x6b'),_0x5dc44f+'%');}else{_0x1dc513['or']('c.firstName\x20LIKE\x20?','%'+_0x5dc44f+'%');_0x1dc513['or'](_0xa5f3('0x6c'),'%'+_0x5dc44f+'%');_0x1dc513['or'](_0xa5f3('0x6b'),'%'+_0x5dc44f+'%');}}}}_0xde5fd9[_0xa5f3('0x3d')](_0x1dc513);_0xde5fd9[_0xa5f3('0x6d')]('c.id');var _0x47ec88={'type':db[_0xa5f3('0x6e')]['QueryTypes']['SELECT'],'raw':!![]};var _0x5be1f1=_0xde5fd9[_0xa5f3('0x6f')]()[_0xa5f3('0x3e')](_0xa5f3('0x70'));if(_0x2a4ecf[_0xa5f3('0x71')]){_0x2a4ecf[_0xa5f3('0x71')][_0xa5f3('0x4f')](function(_0x163708){_0xde5fd9['order']('c.'+_0x163708[0x0],_0x163708[0x1]===_0xa5f3('0x72')?![]:!![]);});}if(!_[_0xa5f3('0x5d')](_0x1c88bf)){_0xde5fd9['having'](_0x306bd9);_0x5be1f1['where'](_0xa5f3('0x73'),_0x1c88bf);}BPromise[_0xa5f3('0x74')]()[_0xa5f3('0x28')](function(){if(_0x4dfc91&&!_[_0xa5f3('0x75')](_0x4dfc91[_0xa5f3('0x4a')],[_0xa5f3('0x3e'),_0xa5f3('0x76')])){return _0x2f0ba6['user'][_0xa5f3('0x77')]({'attributes':['id'],'raw':!![]})[_0xa5f3('0x28')](function(_0x2b42ab){if(_[_0xa5f3('0x5d')](_0x2b42ab)){_0x5be1f1['where'](_0xa5f3('0x78'));_0xde5fd9[_0xa5f3('0x3d')](_0xa5f3('0x78'));}else{_0x5be1f1['where']('c.ListId\x20IN\x20?',_['map'](_0x2b42ab,'id'));_0xde5fd9[_0xa5f3('0x3d')](_0xa5f3('0x5f'),_[_0xa5f3('0x4e')](_0x2b42ab,'id'));}});}else{return;}})[_0xa5f3('0x28')](function(){db['sequelize']['query'](_0x5be1f1[_0xa5f3('0x79')](),_0x47ec88)[_0xa5f3('0x28')](function(_0x1164f1){_0x574f7a[_0xa5f3('0x20')]=_0x1164f1[_0xa5f3('0x2d')];if(_0x574f7a['count']===0x0)return[];return db[_0xa5f3('0x7a')][_0xa5f3('0x37')](_0x3a4d21[_0xa5f3('0x79')](),_0x47ec88);})[_0xa5f3('0x28')](function(_0x45bd63){_0x1c41ae=_[_0xa5f3('0x7b')](_0x45bd63,'id');_0x47ec88=_[_0xa5f3('0x7c')](_0x47ec88,{'model':db[_0xa5f3('0x2b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f0ba6['query'][_0xa5f3('0x7d')]){_0x2a4ecf[_0xa5f3('0x3a')][_0xa5f3('0x4f')](function(_0x46155f){_0xde5fd9[_0xa5f3('0x3e')]('c.'+_0x46155f);});}else{_0xde5fd9[_0xa5f3('0x3e')](_0xa5f3('0x70'));_0xde5fd9[_0xa5f3('0x3e')](_0xa5f3('0x7e'));_0xde5fd9['field'](_0xa5f3('0x7f'));_0xde5fd9[_0xa5f3('0x3e')]('c.phone');_0xde5fd9[_0xa5f3('0x3e')](_0xa5f3('0x80'));_0xde5fd9[_0xa5f3('0x3e')]('c.fax');_0xde5fd9[_0xa5f3('0x3e')]('c.email');_0xde5fd9['field'](_0xa5f3('0x81'));_0xde5fd9[_0xa5f3('0x3e')]('c.deletedAt');_0xde5fd9[_0xa5f3('0x3e')](_0xa5f3('0x82'),_0xa5f3('0x83'));}if(_0x2a4ecf[_0xa5f3('0x22')])_0xde5fd9[_0xa5f3('0x22')](_0x2a4ecf['limit']);if(_0x2a4ecf['offset'])_0xde5fd9['offset'](_0x2a4ecf[_0xa5f3('0x21')]);return db[_0xa5f3('0x7a')]['query'](_0xde5fd9[_0xa5f3('0x79')](),_0x47ec88);})[_0xa5f3('0x28')](function(_0xbe563){_0xbe563[_0xa5f3('0x4f')](function(_0x121dee){if(_0x121dee[_0xa5f3('0x83')]){_0x121dee[_0xa5f3('0x84')]=[];_0x121dee['TagIds'][_0xa5f3('0x4d')](',')[_0xa5f3('0x4f')](function(_0x1740d3){_0x121dee['Tags'][_0xa5f3('0x30')](_0x1c41ae[_0x1740d3]);});}delete _0x121dee[_0xa5f3('0x83')];});_0x574f7a[_0xa5f3('0x85')]=_0xbe563;return _0x574f7a;})[_0xa5f3('0x28')](respondWithFilteredResult(_0x2eaf32,_0x2a4ecf));});})[_0xa5f3('0x86')](handleError(_0x2eaf32,null));};exports['destroy']=function(_0x2bdd92,_0x5690ed){return db['CmContact'][_0xa5f3('0x87')]({'where':{'id':_0x2bdd92[_0xa5f3('0x88')]['id']}})[_0xa5f3('0x28')](handleEntityNotFound(_0x5690ed,null))[_0xa5f3('0x28')](removeEntity(_0x5690ed,null))[_0xa5f3('0x86')](handleError(_0x5690ed,null));};exports['describe']=function(_0x3a6beb,_0x4d7092){return db['CmContact'][_0xa5f3('0x89')]()[_0xa5f3('0x28')](function(_0x469103){delete _0x469103[_0xa5f3('0x8a')];for(var _0x466429=0x0;_0x466429=_0x59221e){_0x407856=_0x59221e;_0x1a662d=0xc8;}else{_0x1a662d=0xce;}_0x562b70[_0xc1dc('0x18')](_0x1a662d);return _0x562b70[_0xc1dc('0x1c')](_0xc1dc('0x1d'),_0x52af53+'-'+_0x407856+'/'+_0x59221e)['json'](_0x380573);}return null;};}function patchUpdates(_0x4a97e0){return function(_0x2f4970){try{jsonpatch[_0xc1dc('0x1e')](_0x2f4970,_0x4a97e0,!![]);}catch(_0xcc4897){return BPromise[_0xc1dc('0x1f')](_0xcc4897);}return _0x2f4970[_0xc1dc('0x20')]();};}function saveUpdates(_0x1b03df,_0x5ecbfe){return function(_0x3e3328){if(_0x3e3328){return _0x3e3328[_0xc1dc('0x21')](_0x1b03df)[_0xc1dc('0x22')](function(_0x20cf54){return _0x20cf54;});}return null;};}function removeEntity(_0x69e848,_0x6e8dda){return function(_0xda656a){if(_0xda656a){return _0xda656a['destroy']()['then'](function(){_0x69e848[_0xc1dc('0x18')](0xcc)[_0xc1dc('0x23')]();});}};}function handleEntityNotFound(_0x399316,_0x4fe422){return function(_0x126211){if(!_0x126211){_0x399316['sendStatus'](0x194);}return _0x126211;};}function handleError(_0x1d1f0a,_0x2cda2e){_0x2cda2e=_0x2cda2e||0x1f4;return function(_0x1a759c){logger[_0xc1dc('0x24')](_0x1a759c[_0xc1dc('0x25')]);if(_0x1a759c['name']){delete _0x1a759c[_0xc1dc('0x26')];}_0x1d1f0a[_0xc1dc('0x18')](_0x2cda2e)[_0xc1dc('0x27')](_0x1a759c);};}exports[_0xc1dc('0x28')]=function(_0x582f19,_0x8007fe){var _0x2d06d2={},_0x367a75={},_0x3288d4={'count':0x0,'rows':[]};return db['CmContact']['describe']()[_0xc1dc('0x22')](function(_0x11ae26){var _0x5e8782=[];for(var _0x560397=0x0;_0x5603970x1){_0x21bf98['or'](_0xc1dc('0x61'),qs[_0xc1dc('0x62')](_0x1517e1),null);}else{if(qs[_0xc1dc('0x63')](_0x1517e1)){_0x21bf98['or'](_0xc1dc('0x64'),_0x1517e1+'%');_0x21bf98['or'](_0xc1dc('0x65'),_0x1517e1+'%');_0x21bf98['or'](_0xc1dc('0x66'),_0x1517e1+'%');_0x21bf98['or'](_0xc1dc('0x67'),_0x1517e1+'%');}else if(qs[_0xc1dc('0x68')](_0x1517e1)){_0x21bf98['or']('c.email\x20LIKE\x20?',_0x1517e1+'%');}else{_0x21bf98['or'](_0xc1dc('0x69'),'%'+_0x1517e1+'%');_0x21bf98['or'](_0xc1dc('0x6a'),'%'+_0x1517e1+'%');_0x21bf98['or'](_0xc1dc('0x6b'),'%'+_0x1517e1+'%');}}}}_0x33f73f[_0xc1dc('0x38')](_0x21bf98);_0x33f73f['group'](_0xc1dc('0x6c'));var _0x2ca0fe={'type':db[_0xc1dc('0x6d')][_0xc1dc('0x6e')][_0xc1dc('0x6f')],'raw':!![]};var _0x4eab0a=_0x33f73f[_0xc1dc('0x70')]()[_0xc1dc('0x3b')]('c.id');if(_0x2d06d2['order']){_0x2d06d2['order'][_0xc1dc('0x59')](function(_0x1cf3b6){_0x33f73f['order']('c.'+_0x1cf3b6[0x0],_0x1cf3b6[0x1]===_0xc1dc('0x71')?![]:!![]);});}if(!_['isEmpty'](_0x56e8c6)){_0x33f73f['having'](_0x3494ea);_0x4eab0a['where'](_0xc1dc('0x72'),_0x56e8c6);}BPromise['resolve']()[_0xc1dc('0x22')](function(){if(_0x28fce3&&!_[_0xc1dc('0x73')](_0x28fce3[_0xc1dc('0x47')],[_0xc1dc('0x3b'),_0xc1dc('0x4e')])){return _0x582f19[_0xc1dc('0x74')]['getLists']({'attributes':['id'],'raw':!![]})[_0xc1dc('0x22')](function(_0x59e16b){if(_[_0xc1dc('0x75')](_0x59e16b)){_0x4eab0a[_0xc1dc('0x38')]('c.ListId\x20IS\x20NULL');_0x33f73f[_0xc1dc('0x38')](_0xc1dc('0x76'));}else{_0x4eab0a[_0xc1dc('0x38')](_0xc1dc('0x5b'),_[_0xc1dc('0x4b')](_0x59e16b,'id'));_0x33f73f[_0xc1dc('0x38')](_0xc1dc('0x5b'),_[_0xc1dc('0x4b')](_0x59e16b,'id'));}});}else{return;}})[_0xc1dc('0x22')](function(){db[_0xc1dc('0x77')][_0xc1dc('0x33')](_0x4eab0a[_0xc1dc('0x78')](),_0x2ca0fe)[_0xc1dc('0x22')](function(_0xa86ce5){_0x3288d4[_0xc1dc('0x79')]=_0xa86ce5[_0xc1dc('0x2f')];if(_0x3288d4[_0xc1dc('0x79')]===0x0)return[];return db[_0xc1dc('0x77')]['query'](_0x23f490[_0xc1dc('0x78')](),_0x2ca0fe);})[_0xc1dc('0x22')](function(_0x6d0bd2){_0x1a8372=_[_0xc1dc('0x7a')](_0x6d0bd2,'id');_0x2ca0fe=_[_0xc1dc('0x7b')](_0x2ca0fe,{'model':db[_0xc1dc('0x7c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x582f19[_0xc1dc('0x33')][_0xc1dc('0x36')]){_0x2d06d2['attributes'][_0xc1dc('0x59')](function(_0x4f02af){_0x33f73f[_0xc1dc('0x3b')]('c.'+_0x4f02af);});}else{_0x33f73f[_0xc1dc('0x3b')](_0xc1dc('0x6c'));_0x33f73f[_0xc1dc('0x3b')](_0xc1dc('0x7d'));_0x33f73f[_0xc1dc('0x3b')](_0xc1dc('0x7e'));_0x33f73f[_0xc1dc('0x3b')]('c.phone');_0x33f73f[_0xc1dc('0x3b')](_0xc1dc('0x7f'));_0x33f73f[_0xc1dc('0x3b')](_0xc1dc('0x80'));_0x33f73f[_0xc1dc('0x3b')]('c.email');_0x33f73f['field']('c.ListId');_0x33f73f[_0xc1dc('0x3b')](_0xc1dc('0x81'));_0x33f73f[_0xc1dc('0x3b')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc1dc('0x82'));}if(_0x2d06d2[_0xc1dc('0x1b')])_0x33f73f['limit'](_0x2d06d2[_0xc1dc('0x1b')]);if(_0x2d06d2[_0xc1dc('0x1a')])_0x33f73f['offset'](_0x2d06d2[_0xc1dc('0x1a')]);return db[_0xc1dc('0x77')][_0xc1dc('0x33')](_0x33f73f[_0xc1dc('0x78')](),_0x2ca0fe);})['then'](function(_0x2b25b2){_0x2b25b2['forEach'](function(_0x4caaa7){if(_0x4caaa7['TagIds']){_0x4caaa7[_0xc1dc('0x83')]=[];_0x4caaa7[_0xc1dc('0x82')][_0xc1dc('0x4a')](',')[_0xc1dc('0x59')](function(_0x5ec8d3){_0x4caaa7['Tags']['push'](_0x1a8372[_0x5ec8d3]);});}delete _0x4caaa7[_0xc1dc('0x82')];});_0x3288d4[_0xc1dc('0x84')]=_0x2b25b2;return _0x3288d4;})[_0xc1dc('0x22')](respondWithFilteredResult(_0x8007fe,_0x2d06d2));});})['catch'](handleError(_0x8007fe,null));};exports['destroy']=function(_0x492aaf,_0x4c95c7){return db['CmContact'][_0xc1dc('0x48')]({'where':{'id':_0x492aaf[_0xc1dc('0x85')]['id']}})['then'](handleEntityNotFound(_0x4c95c7,null))[_0xc1dc('0x22')](removeEntity(_0x4c95c7,null))['catch'](handleError(_0x4c95c7,null));};exports['describe']=function(_0x447f52,_0x102a7){return db[_0xc1dc('0x7c')][_0xc1dc('0x86')]()[_0xc1dc('0x22')](function(_0x2404f0){delete _0x2404f0[_0xc1dc('0x87')];for(var _0x4bd04d=0x0;_0x4bd04d{}\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 _0x55ca=['originalname','replace','format','basename','extname','now','file','server/files/tmp','%s-%s%s','single','upload','/upload/:id','put','/:id','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','show','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getJscriptySessions','post','/merge','merge','create','/create_many','bulkCreate','/:id/tags','diskStorage','join','root'];(function(_0x5a5276,_0x262d69){var _0x3e8ee2=function(_0x151ce3){while(--_0x151ce3){_0x5a5276['push'](_0x5a5276['shift']());}};_0x3e8ee2(++_0x262d69);}(_0x55ca,0x126));var _0xa55c=function(_0x26aee4,_0x530ead){_0x26aee4=_0x26aee4-0x0;var _0x2e1048=_0x55ca[_0x26aee4];return _0x2e1048;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/:id/tags',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0x6')](_0xa55c('0xd'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xe')]);router[_0xa55c('0x6')](_0xa55c('0xf'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x10')]);router['get']('/:id/hopper_finals',auth[_0xa55c('0x7')](),controller['getHopperFinals']);router['get']('/:id/jscripty_sessions',auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x14')]);router['post']('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x15')]);router[_0xa55c('0x12')](_0xa55c('0x16'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x17')]);router[_0xa55c('0x12')](_0xa55c('0x18'),auth[_0xa55c('0x7')](),controller['setTags']);var upload=multer({'storage':multer[_0xa55c('0x19')]({'destination':function(_0x104a99,_0x461284,_0x358b61){_0x358b61(null,path[_0xa55c('0x1a')](config[_0xa55c('0x1b')],'server/files/tmp'));},'filename':function(_0x5f5158,_0xd643cc,_0x3776ac){_0xd643cc[_0xa55c('0x1c')]=_0xd643cc['originalname'][_0xa55c('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3776ac(null,util[_0xa55c('0x1e')]('%s-%s%s',path[_0xa55c('0x1f')](_0xd643cc[_0xa55c('0x1c')],path[_0xa55c('0x20')](_0xd643cc[_0xa55c('0x1c')])),Date[_0xa55c('0x21')](),path['extname'](_0xd643cc[_0xa55c('0x1c')])));}})});router['post']('/csv',upload['single'](_0xa55c('0x22')),controller['uploadCsv']);var upload=multer({'storage':multer[_0xa55c('0x19')]({'destination':function(_0x190757,_0x3f64de,_0xf0e574){_0xf0e574(null,path[_0xa55c('0x1a')](config[_0xa55c('0x1b')],_0xa55c('0x23')));},'filename':function(_0x11e7f7,_0x192df2,_0x3cd152){_0x192df2[_0xa55c('0x1c')]=_0x192df2['originalname'][_0xa55c('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3cd152(null,util[_0xa55c('0x1e')](_0xa55c('0x24'),path[_0xa55c('0x1f')](_0x192df2['originalname'],path[_0xa55c('0x20')](_0x192df2[_0xa55c('0x1c')])),Date[_0xa55c('0x21')](),path[_0xa55c('0x20')](_0x192df2[_0xa55c('0x1c')])));}})});router[_0xa55c('0x12')]('/upload',upload[_0xa55c('0x25')]('file'),controller[_0xa55c('0x26')]);router[_0xa55c('0x12')](_0xa55c('0x27'),auth[_0xa55c('0x7')](),controller['import']);router[_0xa55c('0x28')](_0xa55c('0x29'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x2a')]);router[_0xa55c('0x2b')](_0xa55c('0x29'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x2c')]);module[_0xa55c('0x2d')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 07cce0d..945f4ff 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 _0xc2ed=['lodash','exports','VIRTUAL','getDataValue','alias','STRING','TEXT','type','select','parse','values','isArray','setDataValue','BOOLEAN','sequelize'];(function(_0x4d4a2e,_0x27a392){var _0x4d4eed=function(_0x24aa79){while(--_0x24aa79){_0x4d4a2e['push'](_0x4d4a2e['shift']());}};_0x4d4eed(++_0x27a392);}(_0xc2ed,0x1ee));var _0xdc2e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xc2ed[_0x38a7ac];return _0x53061a;};'use strict';var Sequelize=require(_0xdc2e('0x0'));var _=require(_0xdc2e('0x1'));module[_0xdc2e('0x2')]={'name':{'type':Sequelize[_0xdc2e('0x3')],'get':function(_0x5dedd3){return this[_0xdc2e('0x4')](_0xdc2e('0x5'));}},'alias':{'type':Sequelize[_0xdc2e('0x6')],'allowNull':![],'set':function(_0x3df292){this['setDataValue'](_0xdc2e('0x5'),_0x3df292?_0x3df292:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0xdc2e('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xdc2e('0x7')]('long'),'get':function(){if(this['getDataValue'](_0xdc2e('0x8'))===_0xdc2e('0x9')){return JSON[_0xdc2e('0xa')](this[_0xdc2e('0x4')]('values'));}else{return this[_0xdc2e('0x4')](_0xdc2e('0xb'));}},'set':function(_0x3523c6){if(Array[_0xdc2e('0xc')](_0x3523c6)){this[_0xdc2e('0xd')]('values',JSON['stringify'](_0x3523c6));}else{this[_0xdc2e('0xd')](_0xdc2e('0xb'),_0x3523c6);}}},'required':{'type':Sequelize[_0xdc2e('0xe')],'defaultValue':![]}}; \ No newline at end of file +var _0x8d6a=['long','type','parse','values','isArray','setDataValue','lodash','exports','VIRTUAL','getDataValue','STRING','alias','name','TEXT'];(function(_0x150fa2,_0x156632){var _0x88e6ba=function(_0x23536e){while(--_0x23536e){_0x150fa2['push'](_0x150fa2['shift']());}};_0x88e6ba(++_0x156632);}(_0x8d6a,0x13a));var _0xa8d6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x8d6a[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa8d6('0x0'));module[_0xa8d6('0x1')]={'name':{'type':Sequelize[_0xa8d6('0x2')],'get':function(_0x37a154){return this[_0xa8d6('0x3')]('alias');}},'alias':{'type':Sequelize[_0xa8d6('0x4')],'allowNull':![],'set':function(_0x49ec9){this['setDataValue'](_0xa8d6('0x5'),_0x49ec9?_0x49ec9:this[_0xa8d6('0x3')](_0xa8d6('0x6')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0xa8d6('0x7')](_0xa8d6('0x8')),'get':function(){if(this['getDataValue'](_0xa8d6('0x9'))==='select'){return JSON[_0xa8d6('0xa')](this['getDataValue'](_0xa8d6('0xb')));}else{return this[_0xa8d6('0x3')](_0xa8d6('0xb'));}},'set':function(_0x63b867){if(Array[_0xa8d6('0xc')](_0x63b867)){this[_0xa8d6('0xd')](_0xa8d6('0xb'),JSON['stringify'](_0x63b867));}else{this[_0xa8d6('0xd')](_0xa8d6('0xb'),_0x63b867);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 730695e..779feda 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 _0x002a=['to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','keys','include','options','find','catch','body','params','create','Sequelize','text','TEXT','INTEGER','switch','sequelize','addColumn','cm_contacts','format','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util'];(function(_0x16cfff,_0x3fc70c){var _0x127aa2=function(_0xd4acdd){while(--_0xd4acdd){_0x16cfff['push'](_0x16cfff['shift']());}};_0x127aa2(++_0x3fc70c);}(_0x002a,0xec));var _0xa002=function(_0xb6765f,_0x59eda7){_0xb6765f=_0xb6765f-0x0;var _0x355196=_0x002a[_0xb6765f];return _0x355196;};'use strict';var pdf=require(_0xa002('0x0'));var emlformat=require(_0xa002('0x1'));var rimraf=require(_0xa002('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa002('0x3'));var rp=require(_0xa002('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa002('0x5'));var util=require(_0xa002('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa002('0x7'));var ejs=require(_0xa002('0x8'));var fs=require('fs');var _=require(_0xa002('0x9'));var squel=require(_0xa002('0xa'));var crypto=require(_0xa002('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa002('0xc'));var toCsv=require(_0xa002('0x7'));var querystring=require('querystring');var Papa=require(_0xa002('0xd'));var Redis=require(_0xa002('0xe'));var authService=require(_0xa002('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa002('0x10'));var hardwareService=require(_0xa002('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xa002('0x12'));var config=require(_0xa002('0x13'));var db=require(_0xa002('0x14'))['db'];function respondWithStatusCode(_0x5db3cd,_0x502f30){_0x502f30=_0x502f30||0xcc;return function(_0x220296){if(_0x220296){return _0x5db3cd['sendStatus'](_0x502f30);}return _0x5db3cd[_0xa002('0x15')](_0x502f30)[_0xa002('0x16')]();};}function respondWithResult(_0x47f65a,_0x116499){_0x116499=_0x116499||0xc8;return function(_0xa38089){if(_0xa38089){return _0x47f65a[_0xa002('0x15')](_0x116499)[_0xa002('0x17')](_0xa38089);}};}function respondWithFilteredResult(_0x19fff3,_0x1c6b05){return function(_0x3cd208){if(_0x3cd208){var _0x15c74f=_0x3cd208[_0xa002('0x18')],_0x2b5f24=_0x1c6b05[_0xa002('0x19')],_0x2101cf=_0x1c6b05[_0xa002('0x19')]+_0x1c6b05[_0xa002('0x1a')],_0x130e60;if(_0x2101cf>=_0x15c74f){_0x2101cf=_0x15c74f;_0x130e60=0xc8;}else{_0x130e60=0xce;}_0x19fff3[_0xa002('0x15')](_0x130e60);return _0x19fff3[_0xa002('0x1b')]('Content-Range',_0x2b5f24+'-'+_0x2101cf+'/'+_0x15c74f)['json'](_0x3cd208);}return null;};}function patchUpdates(_0x11994c){return function(_0xa5e750){try{jsonpatch[_0xa002('0x1c')](_0xa5e750,_0x11994c,!![]);}catch(_0x5bb83d){return BPromise[_0xa002('0x1d')](_0x5bb83d);}return _0xa5e750[_0xa002('0x1e')]();};}function saveUpdates(_0x41c10c,_0x35f2fd){return function(_0x12af0c){if(_0x12af0c){return _0x12af0c[_0xa002('0x1f')](_0x41c10c)[_0xa002('0x20')](function(_0x32841b){return _0x32841b;});}return null;};}function removeEntity(_0x31a5b3,_0x361258){return function(_0xd9e36d){if(_0xd9e36d){return _0xd9e36d[_0xa002('0x21')]()[_0xa002('0x20')](function(){_0x31a5b3[_0xa002('0x15')](0xcc)[_0xa002('0x16')]();});}};}function handleEntityNotFound(_0x5960cc,_0xfcc511){return function(_0x18fc4d){if(!_0x18fc4d){_0x5960cc[_0xa002('0x22')](0x194);}return _0x18fc4d;};}function handleError(_0x1038e6,_0x271987){_0x271987=_0x271987||0x1f4;return function(_0xc57600){logger[_0xa002('0x23')](_0xc57600[_0xa002('0x24')]);if(_0xc57600[_0xa002('0x25')]){delete _0xc57600[_0xa002('0x25')];}_0x1038e6['status'](_0x271987)[_0xa002('0x26')](_0xc57600);};}exports['index']=function(_0x35b65c,_0x11f72d){var _0x324733={},_0x5c6e60={},_0x3fbc50={'count':0x0,'rows':[]};var _0x53ccd6=_['map'](db[_0xa002('0x27')][_0xa002('0x28')],function(_0x58bfb1){return{'name':_0x58bfb1[_0xa002('0x29')],'type':_0x58bfb1[_0xa002('0x2a')][_0xa002('0x2b')]};});_0x5c6e60[_0xa002('0x2c')]=_[_0xa002('0x2d')](_[_0xa002('0x2e')](_0x53ccd6,_0xa002('0x25')),[_0xa002('0x25')]);_0x5c6e60[_0xa002('0x2f')]=_['keys'](_0x35b65c['query']);_0x5c6e60[_0xa002('0x30')]=_['intersection'](_0x5c6e60[_0xa002('0x2c')],_0x5c6e60[_0xa002('0x2f')]);_0x324733['attributes']=_[_0xa002('0x31')](_0x5c6e60[_0xa002('0x2c')],qs[_0xa002('0x32')](_0x35b65c['query']['fields']));_0x324733[_0xa002('0x33')]=_0x324733[_0xa002('0x33')][_0xa002('0x34')]?_0x324733[_0xa002('0x33')]:_0x5c6e60[_0xa002('0x2c')];if(!_0x35b65c[_0xa002('0x2f')][_0xa002('0x35')]('nolimit')){_0x324733[_0xa002('0x1a')]=qs[_0xa002('0x1a')](_0x35b65c['query'][_0xa002('0x1a')]);_0x324733['offset']=qs['offset'](_0x35b65c['query'][_0xa002('0x19')]);}_0x324733['order']=qs['sort'](_0x35b65c[_0xa002('0x2f')][_0xa002('0x36')]);_0x324733[_0xa002('0x37')]=qs['filters'](_[_0xa002('0x38')](_0x35b65c[_0xa002('0x2f')],_0x5c6e60[_0xa002('0x30')]));if(_0x35b65c[_0xa002('0x2f')][_0xa002('0x39')]){_0x324733[_0xa002('0x37')]=_[_0xa002('0x3a')](_0x324733['where'],{'$or':_[_0xa002('0x2e')](_0x53ccd6,function(_0x43735d){if(_0x43735d[_0xa002('0x2a')]!==_0xa002('0x3b')){var _0xc1474={};_0xc1474[_0x43735d[_0xa002('0x25')]]={'$like':'%'+_0x35b65c[_0xa002('0x2f')][_0xa002('0x39')]+'%'};return _0xc1474;}})});}_0x324733=_[_0xa002('0x3a')]({},_0x324733,_0x35b65c['options']);var _0x5bf901={'where':_0x324733[_0xa002('0x37')]};return db[_0xa002('0x27')][_0xa002('0x18')](_0x5bf901)[_0xa002('0x20')](function(_0x37b76c){_0x3fbc50[_0xa002('0x18')]=_0x37b76c;if(_0x35b65c[_0xa002('0x2f')][_0xa002('0x3c')]){_0x324733['include']=[{'all':!![]}];}return db['CmCustomField'][_0xa002('0x3d')](_0x324733);})[_0xa002('0x20')](function(_0x293138){_0x3fbc50[_0xa002('0x3e')]=_0x293138;return _0x3fbc50;})[_0xa002('0x20')](respondWithFilteredResult(_0x11f72d,_0x324733))['catch'](handleError(_0x11f72d,null));};exports[_0xa002('0x3f')]=function(_0x1968c4,_0x5726aa){var _0x5e463a={'raw':!![],'where':{'id':_0x1968c4['params']['id']}},_0x114076={};_0x114076[_0xa002('0x2c')]=_[_0xa002('0x40')](db[_0xa002('0x27')][_0xa002('0x28')]);_0x114076['query']=_[_0xa002('0x40')](_0x1968c4[_0xa002('0x2f')]);_0x114076[_0xa002('0x30')]=_['intersection'](_0x114076[_0xa002('0x2c')],_0x114076[_0xa002('0x2f')]);_0x5e463a['attributes']=_[_0xa002('0x31')](_0x114076[_0xa002('0x2c')],qs[_0xa002('0x32')](_0x1968c4[_0xa002('0x2f')][_0xa002('0x32')]));_0x5e463a['attributes']=_0x5e463a['attributes']['length']?_0x5e463a[_0xa002('0x33')]:_0x114076[_0xa002('0x2c')];if(_0x1968c4['query'][_0xa002('0x3c')]){_0x5e463a[_0xa002('0x41')]=[{'all':!![]}];}_0x5e463a=_['merge']({},_0x5e463a,_0x1968c4[_0xa002('0x42')]);return db[_0xa002('0x27')][_0xa002('0x43')](_0x5e463a)['then'](handleEntityNotFound(_0x5726aa,null))['then'](respondWithResult(_0x5726aa,null))[_0xa002('0x44')](handleError(_0x5726aa,null));};exports[_0xa002('0x1f')]=function(_0x363cc6,_0x379590){if(_0x363cc6[_0xa002('0x45')]['id']){delete _0x363cc6['body']['id'];}return db[_0xa002('0x27')][_0xa002('0x43')]({'where':{'id':_0x363cc6[_0xa002('0x46')]['id']}})[_0xa002('0x20')](handleEntityNotFound(_0x379590,null))['then'](saveUpdates(_0x363cc6[_0xa002('0x45')],null))[_0xa002('0x20')](respondWithResult(_0x379590,null))['catch'](handleError(_0x379590,null));};exports[_0xa002('0x21')]=function(_0x11cec6,_0x66e8){return db[_0xa002('0x27')][_0xa002('0x43')]({'where':{'id':_0x11cec6[_0xa002('0x46')]['id']}})[_0xa002('0x20')](handleEntityNotFound(_0x66e8,null))['then'](removeEntity(_0x66e8,null))[_0xa002('0x44')](handleError(_0x66e8,null));};exports['create']=function(_0x1f693b,_0x3cfe28){var _0x1278ef;return db['sequelize']['transaction'](function(_0xa5402f){return db[_0xa002('0x27')][_0xa002('0x47')](_0x1f693b[_0xa002('0x45')],{'transaction':_0xa5402f})[_0xa002('0x20')](function(_0x42e3b2){_0x1278ef=_0x42e3b2;var _0x7abf38={'type':db[_0xa002('0x48')]['TEXT'],'transaction':_0xa5402f};switch(_0x1f693b[_0xa002('0x45')][_0xa002('0x2a')]){case _0xa002('0x49'):_0x7abf38[_0xa002('0x2a')]=db[_0xa002('0x48')][_0xa002('0x4a')];break;case'number':_0x7abf38[_0xa002('0x2a')]=db['Sequelize'][_0xa002('0x4b')];break;case _0xa002('0x4c'):_0x7abf38['type']=db[_0xa002('0x48')]['BOOLEAN'];_0x7abf38['defaultValue']=![];break;default:}return db[_0xa002('0x4d')]['queryInterface'][_0xa002('0x4e')](_0xa002('0x4f'),util[_0xa002('0x50')]('cf_%d',_0x1278ef['id']),_0x7abf38);})[_0xa002('0x20')](function(){return _0x1278ef;});})['then'](respondWithResult(_0x3cfe28,0xc9))[_0xa002('0x44')](handleError(_0x3cfe28,null));}; \ No newline at end of file +var _0x7e3d=['find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','queryInterface','addColumn','cm_contacts','format','cf_%d','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','apply','reject','update','then','destroy','error','stack','name','send','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','pick','where','merge','map','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','length','include'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x7e3d,0x1b9));var _0xd7e3=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0x7e3d[_0x4ea6af];return _0x4cb1e6;};'use strict';var pdf=require(_0xd7e3('0x0'));var emlformat=require(_0xd7e3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd7e3('0x2'));var jsonpatch=require(_0xd7e3('0x3'));var rp=require(_0xd7e3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd7e3('0x5'));var util=require(_0xd7e3('0x6'));var path=require(_0xd7e3('0x7'));var sox=require(_0xd7e3('0x8'));var csv=require(_0xd7e3('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd7e3('0xa'));var squel=require(_0xd7e3('0xb'));var crypto=require(_0xd7e3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd7e3('0xd'));var toCsv=require(_0xd7e3('0x9'));var querystring=require(_0xd7e3('0xe'));var Papa=require(_0xd7e3('0xf'));var Redis=require(_0xd7e3('0x10'));var authService=require(_0xd7e3('0x11'));var qs=require(_0xd7e3('0x12'));var as=require(_0xd7e3('0x13'));var hardwareService=require(_0xd7e3('0x14'));var logger=require(_0xd7e3('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xd7e3('0x16'));var db=require(_0xd7e3('0x17'))['db'];function respondWithStatusCode(_0x19eeb0,_0x5c91e9){_0x5c91e9=_0x5c91e9||0xcc;return function(_0x365663){if(_0x365663){return _0x19eeb0[_0xd7e3('0x18')](_0x5c91e9);}return _0x19eeb0[_0xd7e3('0x19')](_0x5c91e9)[_0xd7e3('0x1a')]();};}function respondWithResult(_0x2a789e,_0x1632ff){_0x1632ff=_0x1632ff||0xc8;return function(_0x2c8172){if(_0x2c8172){return _0x2a789e[_0xd7e3('0x19')](_0x1632ff)[_0xd7e3('0x1b')](_0x2c8172);}};}function respondWithFilteredResult(_0x1c15cb,_0x341a7c){return function(_0x8eecd3){if(_0x8eecd3){var _0x36a1f6=_0x8eecd3[_0xd7e3('0x1c')],_0x3e1b36=_0x341a7c[_0xd7e3('0x1d')],_0x1dec20=_0x341a7c['offset']+_0x341a7c['limit'],_0x2f117f;if(_0x1dec20>=_0x36a1f6){_0x1dec20=_0x36a1f6;_0x2f117f=0xc8;}else{_0x2f117f=0xce;}_0x1c15cb['status'](_0x2f117f);return _0x1c15cb['set']('Content-Range',_0x3e1b36+'-'+_0x1dec20+'/'+_0x36a1f6)['json'](_0x8eecd3);}return null;};}function patchUpdates(_0x142c11){return function(_0x515f6c){try{jsonpatch[_0xd7e3('0x1e')](_0x515f6c,_0x142c11,!![]);}catch(_0x32c118){return BPromise[_0xd7e3('0x1f')](_0x32c118);}return _0x515f6c['save']();};}function saveUpdates(_0x32f694,_0x470b49){return function(_0x51c354){if(_0x51c354){return _0x51c354[_0xd7e3('0x20')](_0x32f694)[_0xd7e3('0x21')](function(_0x442acf){return _0x442acf;});}return null;};}function removeEntity(_0x103bb1,_0x53830d){return function(_0x2c60f1){if(_0x2c60f1){return _0x2c60f1[_0xd7e3('0x22')]()[_0xd7e3('0x21')](function(){_0x103bb1[_0xd7e3('0x19')](0xcc)[_0xd7e3('0x1a')]();});}};}function handleEntityNotFound(_0x3fa465,_0x4239cf){return function(_0x262f56){if(!_0x262f56){_0x3fa465[_0xd7e3('0x18')](0x194);}return _0x262f56;};}function handleError(_0x56ace4,_0x174ad9){_0x174ad9=_0x174ad9||0x1f4;return function(_0xd98498){logger[_0xd7e3('0x23')](_0xd98498[_0xd7e3('0x24')]);if(_0xd98498[_0xd7e3('0x25')]){delete _0xd98498['name'];}_0x56ace4[_0xd7e3('0x19')](_0x174ad9)[_0xd7e3('0x26')](_0xd98498);};}exports['index']=function(_0x194a29,_0x4a78a7){var _0x3b0e33={},_0x2f1414={},_0x55616e={'count':0x0,'rows':[]};var _0x3d2946=_['map'](db[_0xd7e3('0x27')][_0xd7e3('0x28')],function(_0x155a96){return{'name':_0x155a96[_0xd7e3('0x29')],'type':_0x155a96[_0xd7e3('0x2a')]['key']};});_0x2f1414[_0xd7e3('0x2b')]=_[_0xd7e3('0x2c')](_['map'](_0x3d2946,_0xd7e3('0x25')),[_0xd7e3('0x25')]);_0x2f1414[_0xd7e3('0x2d')]=_[_0xd7e3('0x2e')](_0x194a29['query']);_0x2f1414[_0xd7e3('0x2f')]=_[_0xd7e3('0x30')](_0x2f1414[_0xd7e3('0x2b')],_0x2f1414['query']);_0x3b0e33[_0xd7e3('0x31')]=_[_0xd7e3('0x30')](_0x2f1414[_0xd7e3('0x2b')],qs[_0xd7e3('0x32')](_0x194a29['query']['fields']));_0x3b0e33['attributes']=_0x3b0e33[_0xd7e3('0x31')]['length']?_0x3b0e33[_0xd7e3('0x31')]:_0x2f1414[_0xd7e3('0x2b')];if(!_0x194a29[_0xd7e3('0x2d')]['hasOwnProperty'](_0xd7e3('0x33'))){_0x3b0e33['limit']=qs[_0xd7e3('0x34')](_0x194a29[_0xd7e3('0x2d')]['limit']);_0x3b0e33[_0xd7e3('0x1d')]=qs[_0xd7e3('0x1d')](_0x194a29[_0xd7e3('0x2d')][_0xd7e3('0x1d')]);}_0x3b0e33[_0xd7e3('0x35')]=qs['sort'](_0x194a29[_0xd7e3('0x2d')]['sort']);_0x3b0e33['where']=qs['filters'](_[_0xd7e3('0x36')](_0x194a29[_0xd7e3('0x2d')],_0x2f1414[_0xd7e3('0x2f')]));if(_0x194a29[_0xd7e3('0x2d')]['filter']){_0x3b0e33[_0xd7e3('0x37')]=_[_0xd7e3('0x38')](_0x3b0e33[_0xd7e3('0x37')],{'$or':_[_0xd7e3('0x39')](_0x3d2946,function(_0xdd7146){if(_0xdd7146['type']!==_0xd7e3('0x3a')){var _0x517ae3={};_0x517ae3[_0xdd7146[_0xd7e3('0x25')]]={'$like':'%'+_0x194a29[_0xd7e3('0x2d')][_0xd7e3('0x3b')]+'%'};return _0x517ae3;}})});}_0x3b0e33=_[_0xd7e3('0x38')]({},_0x3b0e33,_0x194a29[_0xd7e3('0x3c')]);var _0x655468={'where':_0x3b0e33[_0xd7e3('0x37')]};return db[_0xd7e3('0x27')]['count'](_0x655468)['then'](function(_0x50aeac){_0x55616e[_0xd7e3('0x1c')]=_0x50aeac;if(_0x194a29['query'][_0xd7e3('0x3d')]){_0x3b0e33['include']=[{'all':!![]}];}return db[_0xd7e3('0x27')][_0xd7e3('0x3e')](_0x3b0e33);})['then'](function(_0x4b39a1){_0x55616e[_0xd7e3('0x3f')]=_0x4b39a1;return _0x55616e;})[_0xd7e3('0x21')](respondWithFilteredResult(_0x4a78a7,_0x3b0e33))[_0xd7e3('0x40')](handleError(_0x4a78a7,null));};exports[_0xd7e3('0x41')]=function(_0x7d23fb,_0x4d8524){var _0x33c553={'raw':!![],'where':{'id':_0x7d23fb[_0xd7e3('0x42')]['id']}},_0x3e3399={};_0x3e3399['model']=_[_0xd7e3('0x2e')](db[_0xd7e3('0x27')][_0xd7e3('0x28')]);_0x3e3399[_0xd7e3('0x2d')]=_[_0xd7e3('0x2e')](_0x7d23fb['query']);_0x3e3399['filters']=_[_0xd7e3('0x30')](_0x3e3399['model'],_0x3e3399[_0xd7e3('0x2d')]);_0x33c553[_0xd7e3('0x31')]=_[_0xd7e3('0x30')](_0x3e3399['model'],qs[_0xd7e3('0x32')](_0x7d23fb[_0xd7e3('0x2d')][_0xd7e3('0x32')]));_0x33c553[_0xd7e3('0x31')]=_0x33c553['attributes'][_0xd7e3('0x43')]?_0x33c553[_0xd7e3('0x31')]:_0x3e3399['model'];if(_0x7d23fb['query'][_0xd7e3('0x3d')]){_0x33c553[_0xd7e3('0x44')]=[{'all':!![]}];}_0x33c553=_[_0xd7e3('0x38')]({},_0x33c553,_0x7d23fb['options']);return db[_0xd7e3('0x27')][_0xd7e3('0x45')](_0x33c553)[_0xd7e3('0x21')](handleEntityNotFound(_0x4d8524,null))[_0xd7e3('0x21')](respondWithResult(_0x4d8524,null))[_0xd7e3('0x40')](handleError(_0x4d8524,null));};exports[_0xd7e3('0x20')]=function(_0x2601af,_0x48f5c1){if(_0x2601af[_0xd7e3('0x46')]['id']){delete _0x2601af[_0xd7e3('0x46')]['id'];}return db[_0xd7e3('0x27')][_0xd7e3('0x45')]({'where':{'id':_0x2601af[_0xd7e3('0x42')]['id']}})[_0xd7e3('0x21')](handleEntityNotFound(_0x48f5c1,null))['then'](saveUpdates(_0x2601af['body'],null))['then'](respondWithResult(_0x48f5c1,null))[_0xd7e3('0x40')](handleError(_0x48f5c1,null));};exports[_0xd7e3('0x22')]=function(_0x3a5409,_0x15c385){return db[_0xd7e3('0x27')][_0xd7e3('0x45')]({'where':{'id':_0x3a5409[_0xd7e3('0x42')]['id']}})[_0xd7e3('0x21')](handleEntityNotFound(_0x15c385,null))['then'](removeEntity(_0x15c385,null))['catch'](handleError(_0x15c385,null));};exports[_0xd7e3('0x47')]=function(_0x339747,_0x55affd){var _0x5d6e6c;return db[_0xd7e3('0x48')][_0xd7e3('0x49')](function(_0x157ca5){return db[_0xd7e3('0x27')][_0xd7e3('0x47')](_0x339747['body'],{'transaction':_0x157ca5})['then'](function(_0x2a2b02){_0x5d6e6c=_0x2a2b02;var _0xd6eb1b={'type':db[_0xd7e3('0x4a')][_0xd7e3('0x4b')],'transaction':_0x157ca5};switch(_0x339747[_0xd7e3('0x46')][_0xd7e3('0x2a')]){case _0xd7e3('0x4c'):_0xd6eb1b[_0xd7e3('0x2a')]=db[_0xd7e3('0x4a')][_0xd7e3('0x4b')];break;case _0xd7e3('0x4d'):_0xd6eb1b[_0xd7e3('0x2a')]=db[_0xd7e3('0x4a')][_0xd7e3('0x4e')];break;case _0xd7e3('0x4f'):_0xd6eb1b['type']=db['Sequelize']['BOOLEAN'];_0xd6eb1b['defaultValue']=![];break;default:}return db[_0xd7e3('0x48')][_0xd7e3('0x50')][_0xd7e3('0x51')](_0xd7e3('0x52'),util[_0xd7e3('0x53')](_0xd7e3('0x54'),_0x5d6e6c['id']),_0xd6eb1b);})['then'](function(){return _0x5d6e6c;});})[_0xd7e3('0x21')](respondWithResult(_0x55affd,0xc9))[_0xd7e3('0x40')](handleError(_0x55affd,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 1a44f1b..cfdf9f4 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 _0xf782=['path','rimraf','../../config/environment','./cmCustomField.attributes','exports','cm_custom_fields','lodash','util','../../config/logger','api','bluebird'];(function(_0xcffa4,_0x235b3e){var _0x5bdf7b=function(_0x3610e3){while(--_0x3610e3){_0xcffa4['push'](_0xcffa4['shift']());}};_0x5bdf7b(++_0x235b3e);}(_0xf782,0x192));var _0x2f78=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0xf782[_0x39ffd1];return _0x31267e;};'use strict';var _=require(_0x2f78('0x0'));var util=require(_0x2f78('0x1'));var logger=require(_0x2f78('0x2'))(_0x2f78('0x3'));var moment=require('moment');var BPromise=require(_0x2f78('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f78('0x5'));var rimraf=require(_0x2f78('0x6'));var config=require(_0x2f78('0x7'));var attributes=require(_0x2f78('0x8'));module[_0x2f78('0x9')]=function(_0x5260e8,_0x955d18){return _0x5260e8['define']('CmCustomField',attributes,{'tableName':_0x2f78('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd58=['exports','CmCustomField','cm_custom_fields','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2b1163,_0x3229d5){var _0x2b9e8b=function(_0x115e19){while(--_0x115e19){_0x2b1163['push'](_0x2b1163['shift']());}};_0x2b9e8b(++_0x3229d5);}(_0xfd58,0xb3));var _0x8fd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd58[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8fd5('0x0'));var util=require(_0x8fd5('0x1'));var logger=require('../../config/logger')(_0x8fd5('0x2'));var moment=require(_0x8fd5('0x3'));var BPromise=require('bluebird');var rp=require(_0x8fd5('0x4'));var fs=require('fs');var path=require(_0x8fd5('0x5'));var rimraf=require(_0x8fd5('0x6'));var config=require(_0x8fd5('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x8fd5('0x8')]=function(_0x20bccc,_0x3790a4){return _0x20bccc['define'](_0x8fd5('0x9'),attributes,{'tableName':_0x8fd5('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 7b32207..67e8c4d 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 _0x6f0d=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x341179,_0x508083){var _0x179028=function(_0x1ecd03){while(--_0x1ecd03){_0x341179['push'](_0x341179['shift']());}};_0x179028(++_0x508083);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x9a86fc,_0x405ef5){_0x9a86fc=_0x9a86fc-0x0;var _0x32b0ba=_0x6f0d[_0x9a86fc];return _0x32b0ba;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('CmCustomField,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +var _0xe13a=['code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x482401,_0x5ac6e7){var _0x1e02df=function(_0x4dc63e){while(--_0x4dc63e){_0x482401['push'](_0x482401['shift']());}};_0x1e02df(++_0x5ac6e7);}(_0xe13a,0x178));var _0xae13=function(_0x493b99,_0x4a80a3){_0x493b99=_0x493b99-0x0;var _0x5ab373=_0xe13a[_0x493b99];return _0x5ab373;};'use strict';var _=require('lodash');var util=require(_0xae13('0x0'));var moment=require(_0xae13('0x1'));var BPromise=require(_0xae13('0x2'));var rs=require(_0xae13('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae13('0x4'))['db'];var utils=require(_0xae13('0x5'));var logger=require(_0xae13('0x6'))(_0xae13('0x7'));var config=require(_0xae13('0x8'));var jayson=require(_0xae13('0x9'));var client=jayson[_0xae13('0xa')][_0xae13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x341ba4,_0x4ae51f,_0x2f6d10){return new BPromise(function(_0x2b2e1f,_0x27fefd){return client[_0xae13('0xc')](_0x341ba4,_0x2f6d10)[_0xae13('0xd')](function(_0x41bf44){logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));logger['debug'](_0xae13('0x11'),_0x4ae51f,_0xae13('0x10'),JSON[_0xae13('0x12')](_0x41bf44));if(_0x41bf44[_0xae13('0x13')]){if(_0x41bf44[_0xae13('0x13')][_0xae13('0x14')]===0x1f4){logger[_0xae13('0x13')]('CmCustomField,\x20%s,\x20%s',_0x4ae51f,_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);return _0x27fefd(_0x41bf44['error']['message']);}logger['error']('CmCustomField,\x20%s,\x20%s',_0x4ae51f,_0x41bf44['error'][_0xae13('0x15')]);return _0x2b2e1f(_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);}else{logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));_0x2b2e1f(_0x41bf44['result'][_0xae13('0x15')]);}})['catch'](function(_0xe10aab){logger[_0xae13('0x13')](_0xae13('0xf'),_0x4ae51f,_0xe10aab);_0x27fefd(_0xe10aab);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index b1ee71d..02af5bb 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 _0xce9d=['destroy','exports','util','path','connect-timeout','express','Router','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','create','update','delete'];(function(_0x155522,_0x500586){var _0x30c4d8=function(_0x3afead){while(--_0x3afead){_0x155522['push'](_0x155522['shift']());}};_0x30c4d8(++_0x500586);}(_0xce9d,0x142));var _0xdce9=function(_0x36e81a,_0x53b3c1){_0x36e81a=_0x36e81a-0x0;var _0xee9bad=_0xce9d[_0x36e81a];return _0xee9bad;};'use strict';var multer=require('multer');var util=require(_0xdce9('0x0'));var path=require(_0xdce9('0x1'));var timeout=require(_0xdce9('0x2'));var express=require(_0xdce9('0x3'));var router=express[_0xdce9('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdce9('0x5'));router[_0xdce9('0x6')]('/',auth[_0xdce9('0x7')](),controller[_0xdce9('0x8')]);router[_0xdce9('0x6')](_0xdce9('0x9'),auth[_0xdce9('0x7')](),controller[_0xdce9('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdce9('0xb')]);router['put'](_0xdce9('0x9'),auth['isAuthenticated'](),controller[_0xdce9('0xc')]);router[_0xdce9('0xd')]('/:id',auth[_0xdce9('0x7')](),controller[_0xdce9('0xe')]);module[_0xdce9('0xf')]=router; \ No newline at end of file +var _0x4ca7=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','post','put','/:id','delete'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x4ca7,0x14b));var _0x74ca=function(_0x5c7e6f,_0x22ab4e){_0x5c7e6f=_0x5c7e6f-0x0;var _0x345842=_0x4ca7[_0x5c7e6f];return _0x345842;};'use strict';var multer=require('multer');var util=require(_0x74ca('0x0'));var path=require('path');var timeout=require(_0x74ca('0x1'));var express=require(_0x74ca('0x2'));var router=express[_0x74ca('0x3')]();var auth=require(_0x74ca('0x4'));var interaction=require(_0x74ca('0x5'));var config=require(_0x74ca('0x6'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0x74ca('0x7')](),controller['index']);router[_0x74ca('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x74ca('0x9')]);router[_0x74ca('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x74ca('0xb')](_0x74ca('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x74ca('0xd')]('/:id',auth[_0x74ca('0x7')](),controller['destroy']);module[_0x74ca('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 9bf19d4..dffb2da 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 _0x24ca=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','STRING','DATE','format'];(function(_0x44774d,_0x27fe98){var _0x282b23=function(_0x3b05d4){while(--_0x3b05d4){_0x44774d['push'](_0x44774d['shift']());}};_0x282b23(++_0x27fe98);}(_0x24ca,0x8c));var _0xa24c=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x24ca[_0x2f3794];return _0x1c9fbe;};'use strict';var moment=require(_0xa24c('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa24c('0x2')],'defaultValue':moment()[_0xa24c('0x3')](_0xa24c('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa24c('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa24c('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa24c('0x6')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xa24c('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa24c('0x6')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa24c('0x5')],'unique':_0xa24c('0x8')},'ListId':{'type':Sequelize[_0xa24c('0x5')],'unique':_0xa24c('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xa24c('0x5')],'unique':_0xa24c('0x8')},'CampaignId':{'type':Sequelize[_0xa24c('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa24c('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa24c('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa24c('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x84ab=['INTEGER','UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1fef2b,_0x1b2067){var _0x35bbfc=function(_0x31c78b){while(--_0x31c78b){_0x1fef2b['push'](_0x1fef2b['shift']());}};_0x35bbfc(++_0x1b2067);}(_0x84ab,0x12f));var _0xb84a=function(_0x3fc97b,_0x20ca29){_0x3fc97b=_0x3fc97b-0x0;var _0x3a0c82=_0x84ab[_0x3fc97b];return _0x3a0c82;};'use strict';var moment=require(_0xb84a('0x0'));var Sequelize=require(_0xb84a('0x1'));module[_0xb84a('0x2')]={'phone':{'type':Sequelize[_0xb84a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xb84a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xb84a('0x5')](_0xb84a('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb84a('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb84a('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb84a('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xb84a('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb84a('0x7')],'unique':_0xb84a('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xb84a('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xb84a('0x7')],'unique':_0xb84a('0x9')},'CampaignId':{'type':Sequelize[_0xb84a('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb84a('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb84a('0x7')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index cd65b40..7d74bd6 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 _0x72d0=['filter','merge','VIRTUAL','options','CmHopper','rows','params','attributes','length','includeAll','include','find','catch','create','body','update','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','state','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','CmContact','Contact','CmList','List','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','html-pdf','rimraf','zip-dir','bluebird','mustache','util','path','ejs','lodash','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','count','offset','Content-Range','json','reject','save','then','stack','name','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','fields','limit','sort','where','pick'];(function(_0x49f525,_0x1d4b51){var _0x26c6a1=function(_0x35baab){while(--_0x35baab){_0x49f525['push'](_0x49f525['shift']());}};_0x26c6a1(++_0x1d4b51);}(_0x72d0,0x153));var _0x072d=function(_0x581f8e,_0x5617cb){_0x581f8e=_0x581f8e-0x0;var _0x18aec=_0x72d0[_0x581f8e];return _0x18aec;};'use strict';var pdf=require(_0x072d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x072d('0x1'));var zipdir=require(_0x072d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x072d('0x3'));var Mustache=require(_0x072d('0x4'));var util=require(_0x072d('0x5'));var path=require(_0x072d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x072d('0x7'));var fs=require('fs');var _=require(_0x072d('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x072d('0x9'));var querystring=require(_0x072d('0xa'));var Papa=require(_0x072d('0xb'));var Redis=require('ioredis');var authService=require(_0x072d('0xc'));var qs=require(_0x072d('0xd'));var as=require(_0x072d('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x072d('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x072d('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13a199,_0xf8127f){_0xf8127f=_0xf8127f||0xcc;return function(_0x2aef0a){if(_0x2aef0a){return _0x13a199[_0x072d('0x11')](_0xf8127f);}return _0x13a199[_0x072d('0x12')](_0xf8127f)['end']();};}function respondWithResult(_0x4410c3,_0x1e5386){_0x1e5386=_0x1e5386||0xc8;return function(_0x2e8469){if(_0x2e8469){return _0x4410c3[_0x072d('0x12')](_0x1e5386)['json'](_0x2e8469);}};}function respondWithFilteredResult(_0xa63f6a,_0x50e686){return function(_0x4a8c1b){if(_0x4a8c1b){var _0x35b14e=_0x4a8c1b[_0x072d('0x13')],_0x1596af=_0x50e686[_0x072d('0x14')],_0x4f9f45=_0x50e686[_0x072d('0x14')]+_0x50e686['limit'],_0x34a6f3;if(_0x4f9f45>=_0x35b14e){_0x4f9f45=_0x35b14e;_0x34a6f3=0xc8;}else{_0x34a6f3=0xce;}_0xa63f6a[_0x072d('0x12')](_0x34a6f3);return _0xa63f6a['set'](_0x072d('0x15'),_0x1596af+'-'+_0x4f9f45+'/'+_0x35b14e)[_0x072d('0x16')](_0x4a8c1b);}return null;};}function patchUpdates(_0x856ad0){return function(_0x1c165e){try{jsonpatch['apply'](_0x1c165e,_0x856ad0,!![]);}catch(_0x5f1044){return BPromise[_0x072d('0x17')](_0x5f1044);}return _0x1c165e[_0x072d('0x18')]();};}function saveUpdates(_0x58a8b0,_0x5de5f9){return function(_0xddb920){if(_0xddb920){return _0xddb920['update'](_0x58a8b0)['then'](function(_0x18c6e1){return _0x18c6e1;});}return null;};}function removeEntity(_0x4de24d,_0x41d5c5){return function(_0x2c2808){if(_0x2c2808){return _0x2c2808['destroy']()[_0x072d('0x19')](function(){_0x4de24d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26d21b,_0xde42ee){return function(_0x2ffe88){if(!_0x2ffe88){_0x26d21b[_0x072d('0x11')](0x194);}return _0x2ffe88;};}function handleError(_0x3f6ec1,_0x245437){_0x245437=_0x245437||0x1f4;return function(_0x22dc1b){logger['error'](_0x22dc1b[_0x072d('0x1a')]);if(_0x22dc1b[_0x072d('0x1b')]){delete _0x22dc1b[_0x072d('0x1b')];}_0x3f6ec1[_0x072d('0x12')](_0x245437)['send'](_0x22dc1b);};}exports['index']=function(_0x2b6704,_0x483d1c){var _0x4e28da={},_0x5dbaf8={},_0x4a5a3a={'count':0x0,'rows':[]};var _0x4dd572=_[_0x072d('0x1c')](db['CmHopper'][_0x072d('0x1d')],function(_0x146e7d){return{'name':_0x146e7d[_0x072d('0x1e')],'type':_0x146e7d[_0x072d('0x1f')][_0x072d('0x20')]};});_0x5dbaf8['model']=_['map'](_0x4dd572,_0x072d('0x1b'));_0x5dbaf8['query']=_[_0x072d('0x21')](_0x2b6704[_0x072d('0x22')]);_0x5dbaf8[_0x072d('0x23')]=_[_0x072d('0x24')](_0x5dbaf8[_0x072d('0x25')],_0x5dbaf8[_0x072d('0x22')]);_0x5dbaf8[_0x072d('0x23')]=_[_0x072d('0x26')](_0x5dbaf8['filters'],[_0x072d('0x27'),_0x072d('0x28'),'$gt',_0x072d('0x29'),_0x072d('0x2a'),_0x072d('0x2b'),_0x072d('0x2c'),_0x072d('0x2d'),'$not',_0x072d('0x2e'),_0x072d('0x2f'),_0x072d('0x30'),_0x072d('0x31'),_0x072d('0x32'),_0x072d('0x33'),_0x072d('0x34'),_0x072d('0x35'),_0x072d('0x32'),_0x072d('0x36'),_0x072d('0x37'),_0x072d('0x38'),_0x072d('0x39')]);_0x4e28da['attributes']=_[_0x072d('0x24')](_0x5dbaf8[_0x072d('0x25')],qs['fields'](_0x2b6704[_0x072d('0x22')][_0x072d('0x3a')]));_0x4e28da['attributes']=_0x4e28da['attributes']['length']?_0x4e28da['attributes']:_0x5dbaf8[_0x072d('0x25')];if(!_0x2b6704[_0x072d('0x22')]['hasOwnProperty']('nolimit')){_0x4e28da[_0x072d('0x3b')]=qs[_0x072d('0x3b')](_0x2b6704[_0x072d('0x22')][_0x072d('0x3b')]);_0x4e28da['offset']=qs[_0x072d('0x14')](_0x2b6704[_0x072d('0x22')][_0x072d('0x14')]);}_0x4e28da['order']=qs[_0x072d('0x3c')](_0x2b6704[_0x072d('0x22')][_0x072d('0x3c')]);_0x4e28da[_0x072d('0x3d')]=qs[_0x072d('0x23')](_[_0x072d('0x3e')](_0x2b6704[_0x072d('0x22')],_0x5dbaf8['filters']));if(_0x2b6704[_0x072d('0x22')][_0x072d('0x3f')]){_0x4e28da[_0x072d('0x3d')]=_[_0x072d('0x40')](_0x4e28da[_0x072d('0x3d')],{'$or':_['map'](_0x4dd572,function(_0x3480de){if(_0x3480de[_0x072d('0x1f')]!==_0x072d('0x41')){var _0xc97b53={};_0xc97b53[_0x3480de['name']]={'$like':'%'+_0x2b6704['query'][_0x072d('0x3f')]+'%'};return _0xc97b53;}})});}_0x4e28da=_[_0x072d('0x40')]({},_0x4e28da,_0x2b6704[_0x072d('0x42')]);var _0xf7c05c={'where':_0x4e28da[_0x072d('0x3d')]};return db[_0x072d('0x43')][_0x072d('0x13')](_0xf7c05c)['then'](function(_0x3e4cbe){_0x4a5a3a['count']=_0x3e4cbe;if(_0x2b6704[_0x072d('0x22')]['includeAll']){_0x4e28da['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x4e28da);})[_0x072d('0x19')](function(_0x1130d5){_0x4a5a3a[_0x072d('0x44')]=_0x1130d5;return _0x4a5a3a;})[_0x072d('0x19')](respondWithFilteredResult(_0x483d1c,_0x4e28da))['catch'](handleError(_0x483d1c,null));};exports['show']=function(_0x45b416,_0x32f2ff){var _0x2eca55={'raw':!![],'where':{'id':_0x45b416[_0x072d('0x45')]['id']}},_0x5374fa={};_0x5374fa['model']=_['keys'](db[_0x072d('0x43')][_0x072d('0x1d')]);_0x5374fa[_0x072d('0x22')]=_[_0x072d('0x21')](_0x45b416['query']);_0x5374fa[_0x072d('0x23')]=_[_0x072d('0x24')](_0x5374fa[_0x072d('0x25')],_0x5374fa[_0x072d('0x22')]);_0x2eca55[_0x072d('0x46')]=_[_0x072d('0x24')](_0x5374fa[_0x072d('0x25')],qs[_0x072d('0x3a')](_0x45b416[_0x072d('0x22')][_0x072d('0x3a')]));_0x2eca55[_0x072d('0x46')]=_0x2eca55['attributes'][_0x072d('0x47')]?_0x2eca55['attributes']:_0x5374fa[_0x072d('0x25')];if(_0x45b416['query'][_0x072d('0x48')]){_0x2eca55[_0x072d('0x49')]=[{'all':!![]}];}_0x2eca55=_[_0x072d('0x40')]({},_0x2eca55,_0x45b416[_0x072d('0x42')]);return db[_0x072d('0x43')][_0x072d('0x4a')](_0x2eca55)[_0x072d('0x19')](handleEntityNotFound(_0x32f2ff,null))['then'](respondWithResult(_0x32f2ff,null))[_0x072d('0x4b')](handleError(_0x32f2ff,null));};exports[_0x072d('0x4c')]=function(_0x5696d2,_0x1d7782){return db['CmHopper']['create'](_0x5696d2[_0x072d('0x4d')],{})[_0x072d('0x19')](respondWithResult(_0x1d7782,0xc9))['catch'](handleError(_0x1d7782,null));};exports[_0x072d('0x4e')]=function(_0x26f67b,_0x4cea66){if(_0x26f67b['body']['id']){delete _0x26f67b[_0x072d('0x4d')]['id'];}return db[_0x072d('0x43')]['find']({'where':{'id':_0x26f67b[_0x072d('0x45')]['id']}})[_0x072d('0x19')](handleEntityNotFound(_0x4cea66,null))[_0x072d('0x19')](saveUpdates(_0x26f67b[_0x072d('0x4d')],null))[_0x072d('0x19')](respondWithResult(_0x4cea66,null))[_0x072d('0x4b')](handleError(_0x4cea66,null));};exports['describe']=function(_0x15dec2,_0x49a937){return db[_0x072d('0x43')][_0x072d('0x4f')]()[_0x072d('0x19')](respondWithResult(_0x49a937,null))['catch'](handleError(_0x49a937,null));};exports['destroy']=function(_0x1d16ec,_0xb5cd4b){var _0x4675f4;return db[_0x072d('0x43')][_0x072d('0x4a')]({'where':{'id':_0x1d16ec['params']['id']}})['then'](handleEntityNotFound(_0xb5cd4b,null))[_0x072d('0x19')](function(_0x146231){if(_0x146231){return _0x146231[_0x072d('0x50')]()[_0x072d('0x19')](function(_0x3f29dc){return _0x3f29dc;});}})[_0x072d('0x19')](function(_0x4b2057){_0x4675f4=_0x4b2057;if(_0x4b2057){if(_0x4b2057[_0x072d('0x51')]||_0x4b2057[_0x072d('0x52')]){return db[_0x4b2057[_0x072d('0x51')]?_0x072d('0x53'):_0x072d('0x54')]['find']({'where':{'id':_0x4b2057['VoiceQueueId']?_0x4b2057['VoiceQueueId']:_0x4b2057[_0x072d('0x52')]},'attributes':['id',_0x072d('0x1b')],'raw':!![]});}}})[_0x072d('0x19')](function(_0x5efed2){var _0x1c8148={};if(_0x5efed2){_['merge'](_0x1c8148,_['omit'](_0x4675f4[_0x072d('0x55')],[_0x072d('0x56'),'updatedAt','id']));_0x1c8148[_0x072d('0x57')]=0x15;_0x1c8148['statedesc']=_0x072d('0x58');_0x1c8148[_0x072d('0x59')]=_0x5efed2[_0x072d('0x1b')];_0x1c8148[_0x072d('0x5a')]=_0x1d16ec[_0x072d('0x5b')]['name'];_0x1c8148['UserId']=_0x1d16ec['user']['id'];_0x1c8148['deleted']=!![];_0x1c8148[_0x072d('0x5c')]=moment()[_0x072d('0x5d')](_0x072d('0x5e'));_0x1c8148['calleridnum']=_0x4675f4[_0x072d('0x5f')];_0x1c8148['campaigntype']=_0x4675f4[_0x072d('0x51')]?_0x072d('0x60'):_0x072d('0x61');return db['CmContact'][_0x072d('0x4a')]({'where':{'id':_0x1c8148[_0x072d('0x62')]},'attributes':[_0x072d('0x63'),_0x072d('0x64')]})['then'](function(_0xade1cf){if(!_[_0x072d('0x65')](_0xb5cd4b)&&!_[_0x072d('0x65')](_0xade1cf[_0x072d('0x63')])){_0x1c8148['calleridname']=_0xade1cf['firstName'];if(!_[_0x072d('0x65')](_0xade1cf['lastName'])){_0x1c8148[_0x072d('0x66')]+='\x20'+_0xade1cf[_0x072d('0x64')];}}})[_0x072d('0x67')](function(){return db['CmHopperFinal']['create'](_0x1c8148);});}})[_0x072d('0x19')](function(){return _0xb5cd4b[_0x072d('0x12')](0xcc)[_0x072d('0x68')]();})[_0x072d('0x4b')](handleError(_0xb5cd4b,null));};exports[_0x072d('0x69')]=function(_0x541c15,_0x190bb5,_0x849eb8){var _0x539da8=[];return db['CmContact']['describe']()[_0x072d('0x19')](function(_0x55a1ef){_0x539da8=_[_0x072d('0x21')](_0x55a1ef);return _0x541c15[_0x072d('0x5b')][_0x072d('0x6a')]({'where':{'type':_0x072d('0x6b'),'dialActive':!![],'dialMethod':_0x072d('0x6c')},'attributes':['id',_0x072d('0x6d')],'raw':!![]});})['then'](function(_0x50681a){if(_0x50681a&&_0x50681a['length']){return db[_0x072d('0x6e')][_0x072d('0x6f')](function(_0x6c6811){var _0x1c6fbb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x072d('0x5e'))},'VoiceQueueId':{'$in':_['map'](_0x50681a,'id')},'$or':[{'UserId':null},{'UserId':_0x541c15[_0x072d('0x5b')]['id']}]};var _0x22d294=[];if(_0x541c15[_0x072d('0x4d')][_0x072d('0x70')]&&_0x541c15[_0x072d('0x4d')][_0x072d('0x70')]===_0x072d('0x71')){if(!_[_0x072d('0x72')](_0x541c15[_0x072d('0x4d')][_0x072d('0x73')])){_0x1c6fbb['id']={'$in':_0x541c15['body'][_0x072d('0x73')]};}_0x22d294=[[_0x072d('0x74'),_0x072d('0x75')],['scheduledAt',_0x50681a[0x0]['dialOrderByScheduledAt']==='ASC'?_0x072d('0x76'):'ASC'],db[_0x072d('0x6e')]['literal'](_0x072d('0x77')),['id',_0x072d('0x76')]];}else{if(!_[_0x072d('0x72')](_0x541c15[_0x072d('0x4d')][_0x072d('0x73')])){_0x1c6fbb['id']={'$notIn':_0x541c15[_0x072d('0x4d')][_0x072d('0x73')]};}_0x22d294=[[_0x072d('0x74'),_0x072d('0x76')],[_0x072d('0x78'),_0x50681a[0x0][_0x072d('0x6d')]],db['sequelize'][_0x072d('0x79')](_0x072d('0x7a')),['id',_0x072d('0x75')]];}return db[_0x072d('0x43')]['findOne']({'attributes':['id',_0x072d('0x7b')],'where':_0x1c6fbb,'order':_0x22d294,'transaction':_0x6c6811,'lock':_0x6c6811[_0x072d('0x7c')]['UPDATE'],'include':[{'model':db[_0x072d('0x7d')],'as':_0x072d('0x7e'),'attributes':_0x539da8,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id',_0x072d('0x1b')]}]},{'model':db[_0x072d('0x7f')],'as':_0x072d('0x80'),'attributes':['id','name']},{'model':db[_0x072d('0x53')],'as':'Queue','attributes':['id','name','dialActive']}]})[_0x072d('0x19')](function(_0x4a8956){if(_0x4a8956){return _0x4a8956[_0x072d('0x4e')]({'UserId':_0x541c15[_0x072d('0x5b')]['id']},{'transaction':_0x6c6811});}});});}})[_0x072d('0x19')](handleEntityNotFound(_0x190bb5,null))[_0x072d('0x19')](respondWithResult(_0x190bb5,null))[_0x072d('0x4b')](handleError(_0x190bb5,null));};exports['getOpenContacts']=function(_0x36aada,_0x5213f6,_0x2b9ce2){return _0x36aada[_0x072d('0x5b')][_0x072d('0x6a')]({'where':{'type':_0x072d('0x6b'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x206b8b){if(_0x206b8b&&_0x206b8b[_0x072d('0x47')]){return db[_0x072d('0x43')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x072d('0x5d')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x206b8b,'id')},'$or':[{'UserId':null},{'UserId':_0x36aada[_0x072d('0x5b')]['id']}]}});}return 0x0;})[_0x072d('0x19')](function(_0xd270cd){if(!_['isNil'](_0xd270cd)&&_[_0x072d('0x81')](_0xd270cd)){return _0x5213f6['status'](0xc8)[_0x072d('0x16')]({'contacts':_0xd270cd});}else{logger[_0x072d('0x82')](_0x072d('0x83'),_0x072d('0x84'),0x194,_0x072d('0x85'));_0x5213f6[_0x072d('0x11')](0x194);}})[_0x072d('0x4b')](handleError(_0x5213f6,null));}; \ No newline at end of file +var _0x1007=['preview','dialOrderByScheduledAt','sequelize','transaction','isEmpty','hopperIds','priority','ASC','scheduledAt','literal','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','CmContact','Contact','CmCompany','Company','CmList','Queue','outbound','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','html-pdf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','apply','save','update','destroy','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','concat','$lt','$lte','$eq','$between','$notBetween','$in','$notIn','$notLike','$like','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','CmHopper','includeAll','include','params','intersection','length','create','body','catch','describe','find','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','state','statedesc','deleted','campaign','membername','UserId','user','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','ivr','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1007,0x12d));var _0x7100=function(_0x55c38c,_0x48565a){_0x55c38c=_0x55c38c-0x0;var _0x18c1a7=_0x1007[_0x55c38c];return _0x18c1a7;};'use strict';var pdf=require(_0x7100('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7100('0x1'));var moment=require(_0x7100('0x2'));var BPromise=require(_0x7100('0x3'));var Mustache=require(_0x7100('0x4'));var util=require(_0x7100('0x5'));var path=require(_0x7100('0x6'));var sox=require('sox');var csv=require(_0x7100('0x7'));var ejs=require(_0x7100('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7100('0x9'));var crypto=require(_0x7100('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7100('0xb'));var toCsv=require(_0x7100('0x7'));var querystring=require('querystring');var Papa=require(_0x7100('0xc'));var Redis=require(_0x7100('0xd'));var authService=require(_0x7100('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7100('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7100('0x10'))(_0x7100('0x11'));var utils=require(_0x7100('0x12'));var config=require(_0x7100('0x13'));var db=require(_0x7100('0x14'))['db'];function respondWithStatusCode(_0x182c2e,_0x15171e){_0x15171e=_0x15171e||0xcc;return function(_0x12c1cb){if(_0x12c1cb){return _0x182c2e[_0x7100('0x15')](_0x15171e);}return _0x182c2e['status'](_0x15171e)[_0x7100('0x16')]();};}function respondWithResult(_0x1cd75c,_0x5556fa){_0x5556fa=_0x5556fa||0xc8;return function(_0x5e41df){if(_0x5e41df){return _0x1cd75c[_0x7100('0x17')](_0x5556fa)[_0x7100('0x18')](_0x5e41df);}};}function respondWithFilteredResult(_0x5f432d,_0x5592af){return function(_0x14d0de){if(_0x14d0de){var _0x373790=_0x14d0de[_0x7100('0x19')],_0x313373=_0x5592af[_0x7100('0x1a')],_0x2aabbb=_0x5592af['offset']+_0x5592af['limit'],_0x13624f;if(_0x2aabbb>=_0x373790){_0x2aabbb=_0x373790;_0x13624f=0xc8;}else{_0x13624f=0xce;}_0x5f432d['status'](_0x13624f);return _0x5f432d[_0x7100('0x1b')]('Content-Range',_0x313373+'-'+_0x2aabbb+'/'+_0x373790)['json'](_0x14d0de);}return null;};}function patchUpdates(_0x45d5ff){return function(_0x32de5a){try{jsonpatch[_0x7100('0x1c')](_0x32de5a,_0x45d5ff,!![]);}catch(_0x7c766d){return BPromise['reject'](_0x7c766d);}return _0x32de5a[_0x7100('0x1d')]();};}function saveUpdates(_0x1ad293,_0xe2ce3){return function(_0x47569d){if(_0x47569d){return _0x47569d[_0x7100('0x1e')](_0x1ad293)['then'](function(_0xdee32c){return _0xdee32c;});}return null;};}function removeEntity(_0x428eac,_0x75eeac){return function(_0x3ecf00){if(_0x3ecf00){return _0x3ecf00[_0x7100('0x1f')]()[_0x7100('0x20')](function(){_0x428eac[_0x7100('0x17')](0xcc)[_0x7100('0x16')]();});}};}function handleEntityNotFound(_0x4d5240,_0x293ad3){return function(_0x1efc99){if(!_0x1efc99){_0x4d5240['sendStatus'](0x194);}return _0x1efc99;};}function handleError(_0x22486b,_0x345911){_0x345911=_0x345911||0x1f4;return function(_0x45f18e){logger['error'](_0x45f18e['stack']);if(_0x45f18e[_0x7100('0x21')]){delete _0x45f18e[_0x7100('0x21')];}_0x22486b[_0x7100('0x17')](_0x345911)[_0x7100('0x22')](_0x45f18e);};}exports[_0x7100('0x23')]=function(_0x8734c8,_0x569909){var _0x38d170={},_0x38eee5={},_0x10287e={'count':0x0,'rows':[]};var _0x965076=_[_0x7100('0x24')](db['CmHopper'][_0x7100('0x25')],function(_0x38aa30){return{'name':_0x38aa30[_0x7100('0x26')],'type':_0x38aa30[_0x7100('0x27')][_0x7100('0x28')]};});_0x38eee5[_0x7100('0x29')]=_[_0x7100('0x24')](_0x965076,_0x7100('0x21'));_0x38eee5[_0x7100('0x2a')]=_[_0x7100('0x2b')](_0x8734c8[_0x7100('0x2a')]);_0x38eee5[_0x7100('0x2c')]=_['intersection'](_0x38eee5['model'],_0x38eee5[_0x7100('0x2a')]);_0x38eee5['filters']=_[_0x7100('0x2d')](_0x38eee5[_0x7100('0x2c')],['$and','$or','$gt','$gte',_0x7100('0x2e'),_0x7100('0x2f'),'$ne',_0x7100('0x30'),'$not',_0x7100('0x31'),_0x7100('0x32'),_0x7100('0x33'),_0x7100('0x34'),'$like',_0x7100('0x35'),'$iLike','$notILike',_0x7100('0x36'),'$overlap',_0x7100('0x37'),_0x7100('0x38'),_0x7100('0x39')]);_0x38d170[_0x7100('0x3a')]=_['intersection'](_0x38eee5['model'],qs[_0x7100('0x3b')](_0x8734c8[_0x7100('0x2a')][_0x7100('0x3b')]));_0x38d170[_0x7100('0x3a')]=_0x38d170[_0x7100('0x3a')]['length']?_0x38d170[_0x7100('0x3a')]:_0x38eee5[_0x7100('0x29')];if(!_0x8734c8[_0x7100('0x2a')][_0x7100('0x3c')](_0x7100('0x3d'))){_0x38d170['limit']=qs['limit'](_0x8734c8[_0x7100('0x2a')][_0x7100('0x3e')]);_0x38d170[_0x7100('0x1a')]=qs[_0x7100('0x1a')](_0x8734c8[_0x7100('0x2a')][_0x7100('0x1a')]);}_0x38d170[_0x7100('0x3f')]=qs[_0x7100('0x40')](_0x8734c8[_0x7100('0x2a')][_0x7100('0x40')]);_0x38d170[_0x7100('0x41')]=qs[_0x7100('0x2c')](_[_0x7100('0x42')](_0x8734c8['query'],_0x38eee5[_0x7100('0x2c')]));if(_0x8734c8[_0x7100('0x2a')]['filter']){_0x38d170['where']=_[_0x7100('0x43')](_0x38d170[_0x7100('0x41')],{'$or':_[_0x7100('0x24')](_0x965076,function(_0x28017e){if(_0x28017e[_0x7100('0x27')]!==_0x7100('0x44')){var _0x592853={};_0x592853[_0x28017e[_0x7100('0x21')]]={'$like':'%'+_0x8734c8[_0x7100('0x2a')][_0x7100('0x45')]+'%'};return _0x592853;}})});}_0x38d170=_[_0x7100('0x43')]({},_0x38d170,_0x8734c8[_0x7100('0x46')]);var _0x3fc894={'where':_0x38d170[_0x7100('0x41')]};return db[_0x7100('0x47')][_0x7100('0x19')](_0x3fc894)[_0x7100('0x20')](function(_0x331a81){_0x10287e['count']=_0x331a81;if(_0x8734c8['query'][_0x7100('0x48')]){_0x38d170[_0x7100('0x49')]=[{'all':!![]}];}return db[_0x7100('0x47')]['findAll'](_0x38d170);})['then'](function(_0x581722){_0x10287e['rows']=_0x581722;return _0x10287e;})['then'](respondWithFilteredResult(_0x569909,_0x38d170))['catch'](handleError(_0x569909,null));};exports['show']=function(_0xf1e8ae,_0x4075a1){var _0x22071f={'raw':!![],'where':{'id':_0xf1e8ae[_0x7100('0x4a')]['id']}},_0x4174b8={};_0x4174b8[_0x7100('0x29')]=_[_0x7100('0x2b')](db['CmHopper'][_0x7100('0x25')]);_0x4174b8[_0x7100('0x2a')]=_[_0x7100('0x2b')](_0xf1e8ae[_0x7100('0x2a')]);_0x4174b8[_0x7100('0x2c')]=_[_0x7100('0x4b')](_0x4174b8[_0x7100('0x29')],_0x4174b8['query']);_0x22071f[_0x7100('0x3a')]=_[_0x7100('0x4b')](_0x4174b8[_0x7100('0x29')],qs['fields'](_0xf1e8ae[_0x7100('0x2a')][_0x7100('0x3b')]));_0x22071f['attributes']=_0x22071f[_0x7100('0x3a')][_0x7100('0x4c')]?_0x22071f['attributes']:_0x4174b8[_0x7100('0x29')];if(_0xf1e8ae['query'][_0x7100('0x48')]){_0x22071f[_0x7100('0x49')]=[{'all':!![]}];}_0x22071f=_[_0x7100('0x43')]({},_0x22071f,_0xf1e8ae['options']);return db['CmHopper']['find'](_0x22071f)[_0x7100('0x20')](handleEntityNotFound(_0x4075a1,null))['then'](respondWithResult(_0x4075a1,null))['catch'](handleError(_0x4075a1,null));};exports['create']=function(_0x354dfd,_0x171ced){return db[_0x7100('0x47')][_0x7100('0x4d')](_0x354dfd[_0x7100('0x4e')],{})[_0x7100('0x20')](respondWithResult(_0x171ced,0xc9))[_0x7100('0x4f')](handleError(_0x171ced,null));};exports[_0x7100('0x1e')]=function(_0x3e3f19,_0x3b8995){if(_0x3e3f19['body']['id']){delete _0x3e3f19[_0x7100('0x4e')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x3e3f19[_0x7100('0x4a')]['id']}})[_0x7100('0x20')](handleEntityNotFound(_0x3b8995,null))[_0x7100('0x20')](saveUpdates(_0x3e3f19[_0x7100('0x4e')],null))[_0x7100('0x20')](respondWithResult(_0x3b8995,null))[_0x7100('0x4f')](handleError(_0x3b8995,null));};exports[_0x7100('0x50')]=function(_0x119bc3,_0x1fedce){return db['CmHopper'][_0x7100('0x50')]()[_0x7100('0x20')](respondWithResult(_0x1fedce,null))[_0x7100('0x4f')](handleError(_0x1fedce,null));};exports['destroy']=function(_0x3d27e9,_0x2f9fde){var _0x1dff42;return db['CmHopper'][_0x7100('0x51')]({'where':{'id':_0x3d27e9[_0x7100('0x4a')]['id']}})[_0x7100('0x20')](handleEntityNotFound(_0x2f9fde,null))['then'](function(_0xb9a60b){if(_0xb9a60b){return _0xb9a60b[_0x7100('0x1f')]()[_0x7100('0x20')](function(_0x3cae02){return _0x3cae02;});}})[_0x7100('0x20')](function(_0x6f29e9){_0x1dff42=_0x6f29e9;if(_0x6f29e9){if(_0x6f29e9['VoiceQueueId']||_0x6f29e9[_0x7100('0x52')]){return db[_0x6f29e9[_0x7100('0x53')]?_0x7100('0x54'):_0x7100('0x55')]['find']({'where':{'id':_0x6f29e9[_0x7100('0x53')]?_0x6f29e9[_0x7100('0x53')]:_0x6f29e9['CampaignId']},'attributes':['id',_0x7100('0x21')],'raw':!![]});}}})[_0x7100('0x20')](function(_0x5b897e){var _0x59dc4e={};if(_0x5b897e){_[_0x7100('0x43')](_0x59dc4e,_[_0x7100('0x56')](_0x1dff42[_0x7100('0x57')],['createdAt','updatedAt','id']));_0x59dc4e[_0x7100('0x58')]=0x15;_0x59dc4e[_0x7100('0x59')]=_0x7100('0x5a');_0x59dc4e[_0x7100('0x5b')]=_0x5b897e[_0x7100('0x21')];_0x59dc4e[_0x7100('0x5c')]=_0x3d27e9['user']['name'];_0x59dc4e[_0x7100('0x5d')]=_0x3d27e9[_0x7100('0x5e')]['id'];_0x59dc4e[_0x7100('0x5a')]=!![];_0x59dc4e['deletedat']=moment()[_0x7100('0x5f')](_0x7100('0x60'));_0x59dc4e[_0x7100('0x61')]=_0x1dff42['phone'];_0x59dc4e[_0x7100('0x62')]=_0x1dff42[_0x7100('0x53')]?_0x7100('0x63'):_0x7100('0x64');return db['CmContact'][_0x7100('0x51')]({'where':{'id':_0x59dc4e[_0x7100('0x65')]},'attributes':[_0x7100('0x66'),_0x7100('0x67')]})[_0x7100('0x20')](function(_0x3d9b67){if(!_[_0x7100('0x68')](_0x2f9fde)&&!_[_0x7100('0x68')](_0x3d9b67[_0x7100('0x66')])){_0x59dc4e[_0x7100('0x69')]=_0x3d9b67[_0x7100('0x66')];if(!_[_0x7100('0x68')](_0x3d9b67[_0x7100('0x67')])){_0x59dc4e[_0x7100('0x69')]+='\x20'+_0x3d9b67[_0x7100('0x67')];}}})[_0x7100('0x6a')](function(){return db[_0x7100('0x6b')][_0x7100('0x4d')](_0x59dc4e);});}})[_0x7100('0x20')](function(){return _0x2f9fde['status'](0xcc)[_0x7100('0x16')]();})[_0x7100('0x4f')](handleError(_0x2f9fde,null));};exports[_0x7100('0x6c')]=function(_0x14c334,_0x28b7f4,_0x3ff868){var _0x53f19e=[];return db['CmContact']['describe']()[_0x7100('0x20')](function(_0xfe90ca){_0x53f19e=_[_0x7100('0x2b')](_0xfe90ca);return _0x14c334[_0x7100('0x5e')][_0x7100('0x6d')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x7100('0x6e')},'attributes':['id',_0x7100('0x6f')],'raw':!![]});})[_0x7100('0x20')](function(_0x351ca9){if(_0x351ca9&&_0x351ca9[_0x7100('0x4c')]){return db[_0x7100('0x70')][_0x7100('0x71')](function(_0x4c01fc){var _0x442f4f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7100('0x5f')](_0x7100('0x60'))},'VoiceQueueId':{'$in':_[_0x7100('0x24')](_0x351ca9,'id')},'$or':[{'UserId':null},{'UserId':_0x14c334['user']['id']}]};var _0x55dc85=[];if(_0x14c334[_0x7100('0x4e')]['direction']&&_0x14c334[_0x7100('0x4e')]['direction']==='prev'){if(!_[_0x7100('0x72')](_0x14c334[_0x7100('0x4e')]['hopperIds'])){_0x442f4f['id']={'$in':_0x14c334['body'][_0x7100('0x73')]};}_0x55dc85=[[_0x7100('0x74'),_0x7100('0x75')],[_0x7100('0x76'),_0x351ca9[0x0][_0x7100('0x6f')]==='ASC'?'DESC':'ASC'],db[_0x7100('0x70')][_0x7100('0x77')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x7100('0x78')]];}else{if(!_[_0x7100('0x72')](_0x14c334[_0x7100('0x4e')][_0x7100('0x73')])){_0x442f4f['id']={'$notIn':_0x14c334[_0x7100('0x4e')]['hopperIds']};}_0x55dc85=[['priority',_0x7100('0x78')],[_0x7100('0x76'),_0x351ca9[0x0][_0x7100('0x6f')]],db[_0x7100('0x70')][_0x7100('0x77')](_0x7100('0x79')),['id',_0x7100('0x75')]];}return db[_0x7100('0x47')]['findOne']({'attributes':['id',_0x7100('0x7a')],'where':_0x442f4f,'order':_0x55dc85,'transaction':_0x4c01fc,'lock':_0x4c01fc[_0x7100('0x7b')][_0x7100('0x7c')],'include':[{'model':db[_0x7100('0x7d')],'as':_0x7100('0x7e'),'attributes':_0x53f19e,'include':[{'model':db[_0x7100('0x7f')],'as':_0x7100('0x80'),'attributes':['id',_0x7100('0x21')]}]},{'model':db[_0x7100('0x81')],'as':'List','attributes':['id',_0x7100('0x21')]},{'model':db[_0x7100('0x54')],'as':_0x7100('0x82'),'attributes':['id','name','dialActive']}]})[_0x7100('0x20')](function(_0x14382c){if(_0x14382c){return _0x14382c[_0x7100('0x1e')]({'UserId':_0x14c334[_0x7100('0x5e')]['id']},{'transaction':_0x4c01fc});}});});}})[_0x7100('0x20')](handleEntityNotFound(_0x28b7f4,null))[_0x7100('0x20')](respondWithResult(_0x28b7f4,null))[_0x7100('0x4f')](handleError(_0x28b7f4,null));};exports['getOpenContacts']=function(_0x1d0d15,_0x28ce3e,_0x3c8aff){return _0x1d0d15[_0x7100('0x5e')][_0x7100('0x6d')]({'where':{'type':_0x7100('0x83'),'dialActive':!![],'dialMethod':_0x7100('0x6e')},'attributes':['id'],'raw':!![]})['then'](function(_0x149cc9){if(_0x149cc9&&_0x149cc9[_0x7100('0x4c')]){return db['CmHopper'][_0x7100('0x19')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7100('0x5f')](_0x7100('0x60'))},'VoiceQueueId':{'$in':_[_0x7100('0x24')](_0x149cc9,'id')},'$or':[{'UserId':null},{'UserId':_0x1d0d15[_0x7100('0x5e')]['id']}]}});}return 0x0;})['then'](function(_0x6993b9){if(!_[_0x7100('0x68')](_0x6993b9)&&_[_0x7100('0x84')](_0x6993b9)){return _0x28ce3e[_0x7100('0x17')](0xc8)[_0x7100('0x18')]({'contacts':_0x6993b9});}else{logger[_0x7100('0x85')](_0x7100('0x86'),_0x7100('0x87'),0x194,_0x7100('0x88'));_0x28ce3e[_0x7100('0x15')](0x194);}})[_0x7100('0x4f')](handleError(_0x28ce3e,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index ca00b14..a5caedd 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 _0x9225=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority','lodash'];(function(_0x1f5048,_0x35594a){var _0x4f17fd=function(_0x59c926){while(--_0x59c926){_0x1f5048['push'](_0x1f5048['shift']());}};_0x4f17fd(++_0x35594a);}(_0x9225,0x158));var _0x5922=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x9225[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0x5922('0x0'));var util=require(_0x5922('0x1'));var logger=require('../../config/logger')(_0x5922('0x2'));var moment=require('moment');var BPromise=require(_0x5922('0x3'));var rp=require(_0x5922('0x4'));var fs=require('fs');var path=require(_0x5922('0x5'));var rimraf=require(_0x5922('0x6'));var config=require(_0x5922('0x7'));var attributes=require(_0x5922('0x8'));module[_0x5922('0x9')]=function(_0x40e46f,_0x4e24b6){return _0x40e46f[_0x5922('0xa')](_0x5922('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x5922('0xc'),'fields':['scheduledat']},{'name':_0x5922('0xd'),'fields':[_0x5922('0xd')]},{'name':'priority','fields':[_0x5922('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa93=['rimraf','../../config/environment','./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xfa93,0x129));var _0x3fa9=function(_0x1766bf,_0x47a3d6){_0x1766bf=_0x1766bf-0x0;var _0x4d67f6=_0xfa93[_0x1766bf];return _0x4d67f6;};'use strict';var _=require(_0x3fa9('0x0'));var util=require(_0x3fa9('0x1'));var logger=require(_0x3fa9('0x2'))(_0x3fa9('0x3'));var moment=require(_0x3fa9('0x4'));var BPromise=require(_0x3fa9('0x5'));var rp=require(_0x3fa9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3fa9('0x7'));var config=require(_0x3fa9('0x8'));var attributes=require(_0x3fa9('0x9'));module[_0x3fa9('0xa')]=function(_0x4d7970,_0x382246){return _0x4d7970['define'](_0x3fa9('0xb'),attributes,{'tableName':_0x3fa9('0xc'),'paranoid':![],'indexes':[{'name':_0x3fa9('0xd'),'fields':[_0x3fa9('0xd')]},{'name':'phone','fields':[_0x3fa9('0xe')]},{'name':_0x3fa9('0xf'),'fields':[_0x3fa9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index ee549ea..0b80d0b 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 _0xb10b=['order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowCmHopper','CreateCmHopper','create','body','update','limit','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d0e8b,_0x25837e){_0x4d0e8b=_0x4d0e8b-0x0;var _0x1163d3=_0xb10b[_0x4d0e8b];return _0x1163d3;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetCmHopper',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowCmHopper']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowCmHopper',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});};exports[_0xbb10('0x22')]=function(_0x4d5a9b){var _0x3c0cd7=this;return new Promise(function(_0x3e8538,_0x4345f3){return db['CmHopper'][_0xbb10('0x23')](_0x4d5a9b[_0xbb10('0x24')],{'raw':_0x4d5a9b[_0xbb10('0x18')]?_0x4d5a9b[_0xbb10('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0x110eb5){logger['info'](_0xbb10('0x22'),_0x4d5a9b);logger[_0xbb10('0x1f')](_0xbb10('0x22'),_0x4d5a9b,JSON[_0xbb10('0x11')](_0x110eb5));_0x3e8538(_0x110eb5);})[_0xbb10('0x20')](function(_0x185a52){logger['error'](_0xbb10('0x22'),_0x185a52[_0xbb10('0x13')],_0x4d5a9b);_0x4345f3(_0x3c0cd7[_0xbb10('0x12')](0x1f4,_0x185a52[_0xbb10('0x13')]));});});};exports['UpdateCmHopper']=function(_0x3fff6c){var _0x331751=this;return new Promise(function(_0x23dc18,_0x403beb){return db['CmHopper'][_0xbb10('0x25')](_0x3fff6c[_0xbb10('0x24')],{'raw':_0x3fff6c['options']?_0x3fff6c['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x3fff6c[_0xbb10('0x18')]?_0x3fff6c['options'][_0xbb10('0x26')]||null:null})[_0xbb10('0xc')](function(_0x3b9fdf){logger[_0xbb10('0xd')](_0xbb10('0x27'),_0x3fff6c);logger[_0xbb10('0x1f')](_0xbb10('0x27'),_0x3fff6c,JSON[_0xbb10('0x11')](_0x3b9fdf));_0x23dc18(_0x3b9fdf);})[_0xbb10('0x20')](function(_0x43b948){logger[_0xbb10('0x12')](_0xbb10('0x27'),_0x43b948['message'],_0x3fff6c);_0x403beb(_0x331751[_0xbb10('0x12')](0x1f4,_0x43b948[_0xbb10('0x13')]));});});};exports['DestroyCmHopper']=function(_0x14e1cb){var _0x2f5027=this;return new Promise(function(_0x1a7df6,_0x5a5226){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x14e1cb[_0xbb10('0x18')]?_0x14e1cb['options']['where']||null:null})[_0xbb10('0xc')](function(_0x76a208){logger[_0xbb10('0xd')]('DestroyCmHopper',_0x14e1cb);logger['debug'](_0xbb10('0x29'),_0x14e1cb,JSON[_0xbb10('0x11')](_0x76a208));_0x1a7df6(_0x76a208);})[_0xbb10('0x20')](function(_0xf820fe){logger[_0xbb10('0x12')](_0xbb10('0x29'),_0xf820fe[_0xbb10('0x13')],_0x14e1cb);_0x5a5226(_0x2f5027[_0xbb10('0x12')](0x1f4,_0xf820fe[_0xbb10('0x13')]));});});};exports[_0xbb10('0x2a')]=function(_0x550111){var _0x5eafac=this;return new Promise(function(_0x412e13,_0x467dba){return db[_0xbb10('0x2b')][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x440f9e){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x1c0d8f){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'where':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x550111[_0xbb10('0x18')]?_0x550111['options'][_0xbb10('0x1b')]||null:null,'limit':_0x550111['options']?_0x550111[_0xbb10('0x18')][_0xbb10('0x26')]||null:null,'order':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x2f')]||null:null,'transaction':_0x1c0d8f,'lock':_0x1c0d8f[_0xbb10('0x30')][_0xbb10('0x31')],'include':[{'model':db[_0xbb10('0x2b')],'as':_0xbb10('0x32'),'attributes':_[_0xbb10('0x33')](_0x440f9e)},{'model':db[_0xbb10('0x34')],'as':_0xbb10('0x35'),'attributes':['id',_0xbb10('0x36'),_0xbb10('0x37')]}]})[_0xbb10('0xc')](function(_0x5de0cc){var _0x4571b6=[];for(var _0x466eb7=0x0;_0x466eb7<_0x5de0cc[_0xbb10('0x38')];_0x466eb7+=0x1){_0x4571b6[_0xbb10('0x39')](_0x5de0cc[_0x466eb7][_0xbb10('0x25')](_0x550111[_0xbb10('0x24')],{'transaction':_0x1c0d8f}));}return BPromise['all'](_0x4571b6);});})[_0xbb10('0xc')](function(_0x4731ce){logger[_0xbb10('0xd')](_0xbb10('0x2a'),_0x550111);logger[_0xbb10('0x1f')](_0xbb10('0x2a'),_0x550111,JSON[_0xbb10('0x11')](_0x4731ce));_0x412e13(_0x4731ce);})[_0xbb10('0x20')](function(_0x205e01){logger[_0xbb10('0x12')](_0xbb10('0x2a'),_0x205e01[_0xbb10('0x13')],_0x550111);_0x467dba(_0x5eafac[_0xbb10('0x12')](0x1f4,_0x205e01['message']));});});});};exports['MoveContactManagedDialer']=function(_0x16272d){var _0x3e6338=this;return new Promise(function(_0x3d0cb7,_0x8b0a7d){return db['sequelize']['transaction'](function(_0x79411e){return db[_0xbb10('0x3a')][_0xbb10('0x23')](_0x16272d[_0xbb10('0x24')],{'raw':_0x16272d[_0xbb10('0x18')]?_0x16272d[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'transaction':_0x79411e})['then'](function(){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x16272d['options']?_0x16272d['options']['where']||null:null,'transaction':_0x79411e});});})[_0xbb10('0xc')](function(_0x31c727){logger[_0xbb10('0xd')]('MoveContactManagedDialer',_0x16272d);logger['debug']('MoveContactManagedDialer',_0x16272d,JSON[_0xbb10('0x11')](_0x31c727));_0x3d0cb7(_0x31c727);})[_0xbb10('0x20')](function(_0x45167a){logger['error'](_0xbb10('0x3b'),_0x45167a[_0xbb10('0x13')],_0x16272d);_0x8b0a7d(_0x3e6338['error'](0x1f4,_0x45167a['message']));});});};exports[_0xbb10('0x3c')]=function(_0x308896){var _0xd77753=this;return new Promise(function(_0x237246,_0x54b7c5){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x308896[_0xbb10('0x18')]?_0x308896['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x308896[_0xbb10('0x18')]?_0x308896[_0xbb10('0x18')]['where']||null:null,'attributes':[[db[_0xbb10('0x2d')]['fn'](_0xbb10('0x3d'),db[_0xbb10('0x2d')]['fn']('IF',db[_0xbb10('0x2d')]['literal'](_0xbb10('0x3e')+util[_0xbb10('0x3f')](_0xbb10('0x40'),moment()[_0xbb10('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbb10('0x41')))),_0xbb10('0x42')]]})[_0xbb10('0xc')](function(_0x2ceb3e){logger[_0xbb10('0xd')](_0xbb10('0x3c'),_0x308896);logger[_0xbb10('0x1f')]('CountReScheduled',_0x308896,JSON['stringify'](_0x2ceb3e));_0x237246(_0x2ceb3e);})['catch'](function(_0xdfbc0b){logger[_0xbb10('0x12')](_0xbb10('0x3c'),_0xdfbc0b['message'],_0x308896);_0x54b7c5(_0xd77753['error'](0x1f4,_0xdfbc0b[_0xbb10('0x13')]));});});};exports[_0xbb10('0x43')]=function(_0xd9e743){var _0x3a9677=this;return new Promise(function(_0x260e06,_0x1ad2ed){return db['CmContact'][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x270fdb){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x5bfc68){return db['CmHopper']['findAll']({'where':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':0x1,'order':_0xd9e743['options']?_0xd9e743[_0xbb10('0x18')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x5bfc68,'lock':_0x5bfc68[_0xbb10('0x30')][_0xbb10('0x31')],'include':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0xd9e743['options']['include'],function(_0x165fe9){return{'model':db[_0x165fe9[_0xbb10('0x1e')]],'as':_0x165fe9['as'],'attributes':_0x165fe9[_0xbb10('0x1b')],'include':_0x165fe9[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x165fe9['include'],function(_0x2d52ea){return{'model':db[_0x2d52ea[_0xbb10('0x1e')]],'as':_0x2d52ea['as'],'attributes':_0x2d52ea[_0xbb10('0x1b')],'include':_0x2d52ea[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x2d52ea[_0xbb10('0x1c')],function(_0x174395){return{'model':db[_0x174395['model']],'as':_0x174395['as'],'attributes':_0x174395[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x30f3ea){var _0x322b41=[];for(var _0x37b20e=0x0;_0x37b20e<_0x30f3ea[_0xbb10('0x38')];_0x37b20e+=0x1){_0x322b41[_0xbb10('0x39')](_0x30f3ea[_0x37b20e][_0xbb10('0x25')](_0xd9e743['body'],{'transaction':_0x5bfc68}));}return BPromise[_0xbb10('0x44')](_0x322b41);});})[_0xbb10('0xc')](function(_0x145baf){logger['info']('GetContactRecallMe',_0xd9e743);logger['debug'](_0xbb10('0x43'),_0xd9e743,JSON['stringify'](_0x145baf));_0x260e06(_0x145baf);})['catch'](function(_0x1701c5){logger[_0xbb10('0x12')](_0xbb10('0x43'),_0x1701c5[_0xbb10('0x13')],_0xd9e743);_0x1ad2ed(_0x3a9677[_0xbb10('0x12')](0x1f4,_0x1701c5[_0xbb10('0x13')]));});});});}; \ No newline at end of file +var _0xb10b=['order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','push','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','all','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopper,\x20%s,\x20%s','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include','map','model','debug','catch','ShowCmHopper','CreateCmHopper','create','body','update','limit','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb10b,0x12a));var _0xbb10=function(_0x11731f,_0x2271b5){_0x11731f=_0x11731f-0x0;var _0x14587c=_0xb10b[_0x11731f];return _0x14587c;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'limit':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['limit']||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x407cb4){return{'model':db[_0x407cb4[_0xbb10('0x1e')]],'as':_0x407cb4['as'],'attributes':_0x407cb4[_0xbb10('0x1b')],'include':_0x407cb4[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x407cb4[_0xbb10('0x1c')],function(_0x537898){return{'model':db[_0x537898['model']],'as':_0x537898['as'],'attributes':_0x537898['attributes'],'include':_0x537898[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x537898[_0xbb10('0x1c')],function(_0x4e25ff){return{'model':db[_0x4e25ff[_0xbb10('0x1e')]],'as':_0x4e25ff['as'],'attributes':_0x4e25ff[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x1d5e95){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')]('GetCmHopper',_0x378da8,JSON[_0xbb10('0x11')](_0x1d5e95));_0x575cca(_0x1d5e95);})[_0xbb10('0x20')](function(_0xfc3595){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0xfc3595[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0xfc3595[_0xbb10('0x13')]));});});};exports['ShowCmHopper']=function(_0x448d5c){var _0x56f2da=this;return new Promise(function(_0x16ad2a,_0x1dcc9c){return db[_0xbb10('0x16')]['find']({'raw':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x448d5c['options']?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'include':_0x448d5c[_0xbb10('0x18')]?_0x448d5c[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0x448d5c[_0xbb10('0x18')][_0xbb10('0x1c')],function(_0x8c1ce6){return{'model':db[_0x8c1ce6[_0xbb10('0x1e')]],'as':_0x8c1ce6['as'],'attributes':_0x8c1ce6[_0xbb10('0x1b')],'include':_0x8c1ce6[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x8c1ce6[_0xbb10('0x1c')],function(_0x56943c){return{'model':db[_0x56943c[_0xbb10('0x1e')]],'as':_0x56943c['as'],'attributes':_0x56943c[_0xbb10('0x1b')],'include':_0x56943c[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x56943c['include'],function(_0x111762){return{'model':db[_0x111762['model']],'as':_0x111762['as'],'attributes':_0x111762['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x40c164){logger[_0xbb10('0xd')](_0xbb10('0x21'),_0x448d5c);logger[_0xbb10('0x1f')](_0xbb10('0x21'),_0x448d5c,JSON['stringify'](_0x40c164));_0x16ad2a(_0x40c164);})[_0xbb10('0x20')](function(_0x25d72f){logger['error']('ShowCmHopper',_0x25d72f['message'],_0x448d5c);_0x1dcc9c(_0x56f2da[_0xbb10('0x12')](0x1f4,_0x25d72f[_0xbb10('0x13')]));});});};exports[_0xbb10('0x22')]=function(_0x4d5a9b){var _0x3c0cd7=this;return new Promise(function(_0x3e8538,_0x4345f3){return db['CmHopper'][_0xbb10('0x23')](_0x4d5a9b[_0xbb10('0x24')],{'raw':_0x4d5a9b[_0xbb10('0x18')]?_0x4d5a9b[_0xbb10('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0x110eb5){logger['info'](_0xbb10('0x22'),_0x4d5a9b);logger[_0xbb10('0x1f')](_0xbb10('0x22'),_0x4d5a9b,JSON[_0xbb10('0x11')](_0x110eb5));_0x3e8538(_0x110eb5);})[_0xbb10('0x20')](function(_0x185a52){logger['error'](_0xbb10('0x22'),_0x185a52[_0xbb10('0x13')],_0x4d5a9b);_0x4345f3(_0x3c0cd7[_0xbb10('0x12')](0x1f4,_0x185a52[_0xbb10('0x13')]));});});};exports['UpdateCmHopper']=function(_0x3fff6c){var _0x331751=this;return new Promise(function(_0x23dc18,_0x403beb){return db['CmHopper'][_0xbb10('0x25')](_0x3fff6c[_0xbb10('0x24')],{'raw':_0x3fff6c['options']?_0x3fff6c['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x3fff6c['options']?_0x3fff6c[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x3fff6c[_0xbb10('0x18')]?_0x3fff6c['options'][_0xbb10('0x26')]||null:null})[_0xbb10('0xc')](function(_0x3b9fdf){logger[_0xbb10('0xd')](_0xbb10('0x27'),_0x3fff6c);logger[_0xbb10('0x1f')](_0xbb10('0x27'),_0x3fff6c,JSON[_0xbb10('0x11')](_0x3b9fdf));_0x23dc18(_0x3b9fdf);})[_0xbb10('0x20')](function(_0x43b948){logger[_0xbb10('0x12')](_0xbb10('0x27'),_0x43b948['message'],_0x3fff6c);_0x403beb(_0x331751[_0xbb10('0x12')](0x1f4,_0x43b948[_0xbb10('0x13')]));});});};exports['DestroyCmHopper']=function(_0x14e1cb){var _0x2f5027=this;return new Promise(function(_0x1a7df6,_0x5a5226){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x14e1cb[_0xbb10('0x18')]?_0x14e1cb['options']['where']||null:null})[_0xbb10('0xc')](function(_0x76a208){logger[_0xbb10('0xd')]('DestroyCmHopper',_0x14e1cb);logger['debug'](_0xbb10('0x29'),_0x14e1cb,JSON[_0xbb10('0x11')](_0x76a208));_0x1a7df6(_0x76a208);})[_0xbb10('0x20')](function(_0xf820fe){logger[_0xbb10('0x12')](_0xbb10('0x29'),_0xf820fe[_0xbb10('0x13')],_0x14e1cb);_0x5a5226(_0x2f5027[_0xbb10('0x12')](0x1f4,_0xf820fe[_0xbb10('0x13')]));});});};exports[_0xbb10('0x2a')]=function(_0x550111){var _0x5eafac=this;return new Promise(function(_0x412e13,_0x467dba){return db[_0xbb10('0x2b')][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x440f9e){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x1c0d8f){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'where':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x550111[_0xbb10('0x18')]?_0x550111['options'][_0xbb10('0x1b')]||null:null,'limit':_0x550111['options']?_0x550111[_0xbb10('0x18')][_0xbb10('0x26')]||null:null,'order':_0x550111[_0xbb10('0x18')]?_0x550111[_0xbb10('0x18')][_0xbb10('0x2f')]||null:null,'transaction':_0x1c0d8f,'lock':_0x1c0d8f[_0xbb10('0x30')][_0xbb10('0x31')],'include':[{'model':db[_0xbb10('0x2b')],'as':_0xbb10('0x32'),'attributes':_[_0xbb10('0x33')](_0x440f9e)},{'model':db[_0xbb10('0x34')],'as':_0xbb10('0x35'),'attributes':['id',_0xbb10('0x36'),_0xbb10('0x37')]}]})[_0xbb10('0xc')](function(_0x5de0cc){var _0x4571b6=[];for(var _0x466eb7=0x0;_0x466eb7<_0x5de0cc[_0xbb10('0x38')];_0x466eb7+=0x1){_0x4571b6[_0xbb10('0x39')](_0x5de0cc[_0x466eb7][_0xbb10('0x25')](_0x550111[_0xbb10('0x24')],{'transaction':_0x1c0d8f}));}return BPromise['all'](_0x4571b6);});})[_0xbb10('0xc')](function(_0x4731ce){logger[_0xbb10('0xd')](_0xbb10('0x2a'),_0x550111);logger[_0xbb10('0x1f')](_0xbb10('0x2a'),_0x550111,JSON[_0xbb10('0x11')](_0x4731ce));_0x412e13(_0x4731ce);})[_0xbb10('0x20')](function(_0x205e01){logger[_0xbb10('0x12')](_0xbb10('0x2a'),_0x205e01[_0xbb10('0x13')],_0x550111);_0x467dba(_0x5eafac[_0xbb10('0x12')](0x1f4,_0x205e01['message']));});});});};exports['MoveContactManagedDialer']=function(_0x16272d){var _0x3e6338=this;return new Promise(function(_0x3d0cb7,_0x8b0a7d){return db['sequelize']['transaction'](function(_0x79411e){return db[_0xbb10('0x3a')][_0xbb10('0x23')](_0x16272d[_0xbb10('0x24')],{'raw':_0x16272d[_0xbb10('0x18')]?_0x16272d[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'transaction':_0x79411e})['then'](function(){return db[_0xbb10('0x16')][_0xbb10('0x28')]({'where':_0x16272d['options']?_0x16272d['options']['where']||null:null,'transaction':_0x79411e});});})[_0xbb10('0xc')](function(_0x31c727){logger[_0xbb10('0xd')]('MoveContactManagedDialer',_0x16272d);logger['debug']('MoveContactManagedDialer',_0x16272d,JSON[_0xbb10('0x11')](_0x31c727));_0x3d0cb7(_0x31c727);})[_0xbb10('0x20')](function(_0x45167a){logger['error'](_0xbb10('0x3b'),_0x45167a[_0xbb10('0x13')],_0x16272d);_0x8b0a7d(_0x3e6338['error'](0x1f4,_0x45167a['message']));});});};exports[_0xbb10('0x3c')]=function(_0x308896){var _0xd77753=this;return new Promise(function(_0x237246,_0x54b7c5){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x308896[_0xbb10('0x18')]?_0x308896['options'][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x308896[_0xbb10('0x18')]?_0x308896[_0xbb10('0x18')]['where']||null:null,'attributes':[[db[_0xbb10('0x2d')]['fn'](_0xbb10('0x3d'),db[_0xbb10('0x2d')]['fn']('IF',db[_0xbb10('0x2d')]['literal'](_0xbb10('0x3e')+util[_0xbb10('0x3f')](_0xbb10('0x40'),moment()[_0xbb10('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbb10('0x41')))),_0xbb10('0x42')]]})[_0xbb10('0xc')](function(_0x2ceb3e){logger[_0xbb10('0xd')](_0xbb10('0x3c'),_0x308896);logger[_0xbb10('0x1f')]('CountReScheduled',_0x308896,JSON['stringify'](_0x2ceb3e));_0x237246(_0x2ceb3e);})['catch'](function(_0xdfbc0b){logger[_0xbb10('0x12')](_0xbb10('0x3c'),_0xdfbc0b['message'],_0x308896);_0x54b7c5(_0xd77753['error'](0x1f4,_0xdfbc0b[_0xbb10('0x13')]));});});};exports[_0xbb10('0x43')]=function(_0xd9e743){var _0x3a9677=this;return new Promise(function(_0x260e06,_0x1ad2ed){return db['CmContact'][_0xbb10('0x2c')]()[_0xbb10('0xc')](function(_0x270fdb){return db[_0xbb10('0x2d')][_0xbb10('0x2e')](function(_0x5bfc68){return db['CmHopper']['findAll']({'where':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':0x1,'order':_0xd9e743['options']?_0xd9e743[_0xbb10('0x18')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x5bfc68,'lock':_0x5bfc68[_0xbb10('0x30')][_0xbb10('0x31')],'include':_0xd9e743[_0xbb10('0x18')]?_0xd9e743[_0xbb10('0x18')]['include']?_[_0xbb10('0x1d')](_0xd9e743['options']['include'],function(_0x165fe9){return{'model':db[_0x165fe9[_0xbb10('0x1e')]],'as':_0x165fe9['as'],'attributes':_0x165fe9[_0xbb10('0x1b')],'include':_0x165fe9[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x165fe9['include'],function(_0x2d52ea){return{'model':db[_0x2d52ea[_0xbb10('0x1e')]],'as':_0x2d52ea['as'],'attributes':_0x2d52ea[_0xbb10('0x1b')],'include':_0x2d52ea[_0xbb10('0x1c')]?_[_0xbb10('0x1d')](_0x2d52ea[_0xbb10('0x1c')],function(_0x174395){return{'model':db[_0x174395['model']],'as':_0x174395['as'],'attributes':_0x174395[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb10('0xc')](function(_0x30f3ea){var _0x322b41=[];for(var _0x37b20e=0x0;_0x37b20e<_0x30f3ea[_0xbb10('0x38')];_0x37b20e+=0x1){_0x322b41[_0xbb10('0x39')](_0x30f3ea[_0x37b20e][_0xbb10('0x25')](_0xd9e743['body'],{'transaction':_0x5bfc68}));}return BPromise[_0xbb10('0x44')](_0x322b41);});})[_0xbb10('0xc')](function(_0x145baf){logger['info']('GetContactRecallMe',_0xd9e743);logger['debug'](_0xbb10('0x43'),_0xd9e743,JSON['stringify'](_0x145baf));_0x260e06(_0x145baf);})['catch'](function(_0x1701c5){logger[_0xbb10('0x12')](_0xbb10('0x43'),_0x1701c5[_0xbb10('0x13')],_0xd9e743);_0x1ad2ed(_0x3a9677[_0xbb10('0x12')](0x1f4,_0x1701c5[_0xbb10('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 0e9fc1d..688767c 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 _0x01d3=['../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/:id','show','post','/preview','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3e8598,_0x5a5d9a){var _0x15c7d4=function(_0x173469){while(--_0x173469){_0x3e8598['push'](_0x3e8598['shift']());}};_0x15c7d4(++_0x5a5d9a);}(_0x01d3,0xa2));var _0x301d=function(_0x263a2f,_0x1e81e3){_0x263a2f=_0x263a2f-0x0;var _0x8020e8=_0x01d3[_0x263a2f];return _0x8020e8;};'use strict';var multer=require(_0x301d('0x0'));var util=require(_0x301d('0x1'));var path=require(_0x301d('0x2'));var timeout=require(_0x301d('0x3'));var express=require('express');var router=express[_0x301d('0x4')]();var auth=require(_0x301d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x301d('0x6'));var controller=require(_0x301d('0x7'));router[_0x301d('0x8')]('/',auth[_0x301d('0x9')](),controller['index']);router[_0x301d('0x8')](_0x301d('0xa'),auth[_0x301d('0x9')](),controller[_0x301d('0xb')]);router[_0x301d('0x8')](_0x301d('0xc'),auth[_0x301d('0x9')](),controller[_0x301d('0xd')]);router[_0x301d('0x8')](_0x301d('0xe'),auth['isAuthenticated'](),controller[_0x301d('0xf')]);router[_0x301d('0x10')]('/',auth[_0x301d('0x9')](),controller['create']);router[_0x301d('0x10')](_0x301d('0x11'),auth['isAuthenticated'](),controller['getPreview']);router['put'](_0x301d('0xe'),auth[_0x301d('0x9')](),controller[_0x301d('0x12')]);router[_0x301d('0x13')](_0x301d('0xe'),auth[_0x301d('0x9')](),controller[_0x301d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x4d5a=['get','/describe','isAuthenticated','describe','/opencontacts','/:id','show','post','create','/preview','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2861e1,_0x442c99){var _0x2b78a0=function(_0x519e71){while(--_0x519e71){_0x2861e1['push'](_0x2861e1['shift']());}};_0x2b78a0(++_0x442c99);}(_0x4d5a,0x15e));var _0xa4d5=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4d5a[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require(_0xa4d5('0x0'));var path=require(_0xa4d5('0x1'));var timeout=require(_0xa4d5('0x2'));var express=require('express');var router=express[_0xa4d5('0x3')]();var auth=require(_0xa4d5('0x4'));var interaction=require(_0xa4d5('0x5'));var config=require(_0xa4d5('0x6'));var controller=require('./cmHopper.controller');router[_0xa4d5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa4d5('0x7')](_0xa4d5('0x8'),auth[_0xa4d5('0x9')](),controller[_0xa4d5('0xa')]);router[_0xa4d5('0x7')](_0xa4d5('0xb'),auth[_0xa4d5('0x9')](),controller['getOpenContacts']);router['get'](_0xa4d5('0xc'),auth[_0xa4d5('0x9')](),controller[_0xa4d5('0xd')]);router[_0xa4d5('0xe')]('/',auth[_0xa4d5('0x9')](),controller[_0xa4d5('0xf')]);router[_0xa4d5('0xe')](_0xa4d5('0x10'),auth['isAuthenticated'](),controller['getPreview']);router[_0xa4d5('0x11')](_0xa4d5('0xc'),auth[_0xa4d5('0x9')](),controller[_0xa4d5('0x12')]);router['delete']('/:id',auth[_0xa4d5('0x9')](),controller[_0xa4d5('0x13')]);module[_0xa4d5('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 2ae3a8e..621cbaf 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 _0xc90c=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x4c6fc0,_0x29218b){var _0x1e143b=function(_0x3997f6){while(--_0x3997f6){_0x4c6fc0['push'](_0x4c6fc0['shift']());}};_0x1e143b(++_0x29218b);}(_0xc90c,0xdc));var _0xcc90=function(_0x5c02c0,_0x2b825e){_0x5c02c0=_0x5c02c0-0x0;var _0x5d7676=_0xc90c[_0x5c02c0];return _0x5d7676;};'use strict';var moment=require(_0xcc90('0x0'));var Sequelize=require(_0xcc90('0x1'));module[_0xcc90('0x2')]={'phone':{'type':Sequelize[_0xcc90('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xcc90('0x4')],'unique':_0xcc90('0x5')},'ListId':{'type':Sequelize[_0xcc90('0x4')],'unique':_0xcc90('0x5')},'VoiceQueueId':{'type':Sequelize[_0xcc90('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x11a4=['contactListQueue','sequelize','STRING','INTEGER'];(function(_0x42b09d,_0x5b6392){var _0xa040be=function(_0x1f9027){while(--_0x1f9027){_0x42b09d['push'](_0x42b09d['shift']());}};_0xa040be(++_0x5b6392);}(_0x11a4,0xfd));var _0x411a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x11a4[_0x42cae2];return _0x5f256f;};'use strict';var moment=require('moment');var Sequelize=require(_0x411a('0x0'));module['exports']={'phone':{'type':Sequelize[_0x411a('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x411a('0x2')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x411a('0x2')],'unique':_0x411a('0x3')},'VoiceQueueId':{'type':Sequelize[_0x411a('0x2')],'unique':_0x411a('0x3')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 45aa642..afbb26f 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 _0x5454=['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','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','catch','params','include','find','body','describe','zip-dir','bluebird','mustache'];(function(_0x2f6cd1,_0x5b0b40){var _0x3c4c0b=function(_0x4f1566){while(--_0x4f1566){_0x2f6cd1['push'](_0x2f6cd1['shift']());}};_0x3c4c0b(++_0x5b0b40);}(_0x5454,0x15b));var _0x4545=function(_0x407140,_0x57ddca){_0x407140=_0x407140-0x0;var _0x24389e=_0x5454[_0x407140];return _0x24389e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4545('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4545('0x1'));var Mustache=require(_0x4545('0x2'));var util=require(_0x4545('0x3'));var path=require(_0x4545('0x4'));var sox=require('sox');var csv=require(_0x4545('0x5'));var ejs=require(_0x4545('0x6'));var fs=require('fs');var _=require(_0x4545('0x7'));var squel=require(_0x4545('0x8'));var crypto=require(_0x4545('0x9'));var jsforce=require(_0x4545('0xa'));var deskjs=require(_0x4545('0xb'));var toCsv=require(_0x4545('0x5'));var querystring=require(_0x4545('0xc'));var Papa=require(_0x4545('0xd'));var Redis=require(_0x4545('0xe'));var authService=require(_0x4545('0xf'));var qs=require(_0x4545('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4545('0x11'));var logger=require(_0x4545('0x12'))(_0x4545('0x13'));var utils=require(_0x4545('0x14'));var config=require(_0x4545('0x15'));var db=require(_0x4545('0x16'))['db'];function respondWithStatusCode(_0x4d414c,_0x3844a3){_0x3844a3=_0x3844a3||0xcc;return function(_0x20a4d8){if(_0x20a4d8){return _0x4d414c[_0x4545('0x17')](_0x3844a3);}return _0x4d414c[_0x4545('0x18')](_0x3844a3)[_0x4545('0x19')]();};}function respondWithResult(_0xb9120a,_0x3e7088){_0x3e7088=_0x3e7088||0xc8;return function(_0x347072){if(_0x347072){return _0xb9120a[_0x4545('0x18')](_0x3e7088)[_0x4545('0x1a')](_0x347072);}};}function respondWithFilteredResult(_0x40a079,_0x4b5700){return function(_0xb10472){if(_0xb10472){var _0x3577f5=_0xb10472['count'],_0x2416b0=_0x4b5700[_0x4545('0x1b')],_0x3bb165=_0x4b5700[_0x4545('0x1b')]+_0x4b5700[_0x4545('0x1c')],_0x5a332e;if(_0x3bb165>=_0x3577f5){_0x3bb165=_0x3577f5;_0x5a332e=0xc8;}else{_0x5a332e=0xce;}_0x40a079[_0x4545('0x18')](_0x5a332e);return _0x40a079[_0x4545('0x1d')](_0x4545('0x1e'),_0x2416b0+'-'+_0x3bb165+'/'+_0x3577f5)[_0x4545('0x1a')](_0xb10472);}return null;};}function patchUpdates(_0x4672ed){return function(_0x53a1cf){try{jsonpatch['apply'](_0x53a1cf,_0x4672ed,!![]);}catch(_0x262669){return BPromise['reject'](_0x262669);}return _0x53a1cf[_0x4545('0x1f')]();};}function saveUpdates(_0x669f9,_0x67e408){return function(_0x6b3bc){if(_0x6b3bc){return _0x6b3bc[_0x4545('0x20')](_0x669f9)[_0x4545('0x21')](function(_0x1a4f5a){return _0x1a4f5a;});}return null;};}function removeEntity(_0x13f497,_0x550dfb){return function(_0x580b57){if(_0x580b57){return _0x580b57[_0x4545('0x22')]()['then'](function(){_0x13f497[_0x4545('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x293c18,_0x4c47c0){return function(_0x519489){if(!_0x519489){_0x293c18[_0x4545('0x17')](0x194);}return _0x519489;};}function handleError(_0xdd21e4,_0x38815e){_0x38815e=_0x38815e||0x1f4;return function(_0x34d4c1){logger[_0x4545('0x23')](_0x34d4c1[_0x4545('0x24')]);if(_0x34d4c1[_0x4545('0x25')]){delete _0x34d4c1[_0x4545('0x25')];}_0xdd21e4[_0x4545('0x18')](_0x38815e)[_0x4545('0x26')](_0x34d4c1);};}exports[_0x4545('0x27')]=function(_0x43749b,_0xab0b00){var _0x3d1c1a={},_0x1d8c39={},_0xfd9247={'count':0x0,'rows':[]};var _0x576200=_[_0x4545('0x28')](db[_0x4545('0x29')][_0x4545('0x2a')],function(_0x394a8e){return{'name':_0x394a8e[_0x4545('0x2b')],'type':_0x394a8e['type'][_0x4545('0x2c')]};});_0x1d8c39[_0x4545('0x2d')]=_[_0x4545('0x28')](_0x576200,_0x4545('0x25'));_0x1d8c39[_0x4545('0x2e')]=_[_0x4545('0x2f')](_0x43749b['query']);_0x1d8c39[_0x4545('0x30')]=_[_0x4545('0x31')](_0x1d8c39[_0x4545('0x2d')],_0x1d8c39[_0x4545('0x2e')]);_0x3d1c1a[_0x4545('0x32')]=_[_0x4545('0x31')](_0x1d8c39[_0x4545('0x2d')],qs[_0x4545('0x33')](_0x43749b[_0x4545('0x2e')][_0x4545('0x33')]));_0x3d1c1a[_0x4545('0x32')]=_0x3d1c1a['attributes'][_0x4545('0x34')]?_0x3d1c1a['attributes']:_0x1d8c39[_0x4545('0x2d')];if(!_0x43749b[_0x4545('0x2e')]['hasOwnProperty'](_0x4545('0x35'))){_0x3d1c1a[_0x4545('0x1c')]=qs[_0x4545('0x1c')](_0x43749b[_0x4545('0x2e')][_0x4545('0x1c')]);_0x3d1c1a[_0x4545('0x1b')]=qs[_0x4545('0x1b')](_0x43749b['query'][_0x4545('0x1b')]);}_0x3d1c1a[_0x4545('0x36')]=qs[_0x4545('0x37')](_0x43749b[_0x4545('0x2e')][_0x4545('0x37')]);_0x3d1c1a[_0x4545('0x38')]=qs['filters'](_[_0x4545('0x39')](_0x43749b[_0x4545('0x2e')],_0x1d8c39[_0x4545('0x30')]));if(_0x43749b[_0x4545('0x2e')][_0x4545('0x3a')]){_0x3d1c1a[_0x4545('0x38')]=_[_0x4545('0x3b')](_0x3d1c1a[_0x4545('0x38')],{'$or':_[_0x4545('0x28')](_0x576200,function(_0x50588b){if(_0x50588b['type']!=='VIRTUAL'){var _0x1435d1={};_0x1435d1[_0x50588b['name']]={'$like':'%'+_0x43749b[_0x4545('0x2e')][_0x4545('0x3a')]+'%'};return _0x1435d1;}})});}_0x3d1c1a=_[_0x4545('0x3b')]({},_0x3d1c1a,_0x43749b[_0x4545('0x3c')]);var _0x537711={'where':_0x3d1c1a['where']};return db[_0x4545('0x29')]['count'](_0x537711)[_0x4545('0x21')](function(_0x12bb6a){_0xfd9247[_0x4545('0x3d')]=_0x12bb6a;if(_0x43749b[_0x4545('0x2e')][_0x4545('0x3e')]){_0x3d1c1a['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x4545('0x3f')](_0x3d1c1a);})[_0x4545('0x21')](function(_0x58d519){_0xfd9247['rows']=_0x58d519;return _0xfd9247;})[_0x4545('0x21')](respondWithFilteredResult(_0xab0b00,_0x3d1c1a))[_0x4545('0x40')](handleError(_0xab0b00,null));};exports['show']=function(_0x1aafdf,_0x59382e){var _0x239246={'raw':!![],'where':{'id':_0x1aafdf[_0x4545('0x41')]['id']}},_0x3612f2={};_0x3612f2[_0x4545('0x2d')]=_['keys'](db[_0x4545('0x29')][_0x4545('0x2a')]);_0x3612f2[_0x4545('0x2e')]=_[_0x4545('0x2f')](_0x1aafdf['query']);_0x3612f2['filters']=_[_0x4545('0x31')](_0x3612f2['model'],_0x3612f2[_0x4545('0x2e')]);_0x239246[_0x4545('0x32')]=_[_0x4545('0x31')](_0x3612f2[_0x4545('0x2d')],qs[_0x4545('0x33')](_0x1aafdf[_0x4545('0x2e')][_0x4545('0x33')]));_0x239246[_0x4545('0x32')]=_0x239246['attributes'][_0x4545('0x34')]?_0x239246[_0x4545('0x32')]:_0x3612f2[_0x4545('0x2d')];if(_0x1aafdf['query'][_0x4545('0x3e')]){_0x239246[_0x4545('0x42')]=[{'all':!![]}];}_0x239246=_[_0x4545('0x3b')]({},_0x239246,_0x1aafdf[_0x4545('0x3c')]);return db[_0x4545('0x29')][_0x4545('0x43')](_0x239246)[_0x4545('0x21')](handleEntityNotFound(_0x59382e,null))[_0x4545('0x21')](respondWithResult(_0x59382e,null))['catch'](handleError(_0x59382e,null));};exports[_0x4545('0x20')]=function(_0x5d4e44,_0x7ca53c){if(_0x5d4e44['body']['id']){delete _0x5d4e44[_0x4545('0x44')]['id'];}return db[_0x4545('0x29')][_0x4545('0x43')]({'where':{'id':_0x5d4e44['params']['id']}})[_0x4545('0x21')](handleEntityNotFound(_0x7ca53c,null))[_0x4545('0x21')](saveUpdates(_0x5d4e44[_0x4545('0x44')],null))[_0x4545('0x21')](respondWithResult(_0x7ca53c,null))[_0x4545('0x40')](handleError(_0x7ca53c,null));};exports[_0x4545('0x22')]=function(_0x51a22e,_0x59d00c){return db['CmHopperBlack']['find']({'where':{'id':_0x51a22e[_0x4545('0x41')]['id']}})[_0x4545('0x21')](handleEntityNotFound(_0x59d00c,null))[_0x4545('0x21')](removeEntity(_0x59d00c,null))[_0x4545('0x40')](handleError(_0x59d00c,null));};exports[_0x4545('0x45')]=function(_0x266f0c,_0x637b88){return db['CmHopperBlack']['describe']()[_0x4545('0x21')](respondWithResult(_0x637b88,null))[_0x4545('0x40')](handleError(_0x637b88,null));}; \ No newline at end of file +var _0x110f=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','CmHopperBlack','findAll','catch','find','update','body','params','describe','html-pdf','eml-format','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','status','end','count','offset','limit','set','json','apply','reject','save','then','sendStatus','stack','name','map','rawAttributes','type','key','model','query','keys'];(function(_0x4c1381,_0x558ecb){var _0x1bdfc3=function(_0x56b3b3){while(--_0x56b3b3){_0x4c1381['push'](_0x4c1381['shift']());}};_0x1bdfc3(++_0x558ecb);}(_0x110f,0x1e6));var _0xf110=function(_0x4a13ee,_0x52134c){_0x4a13ee=_0x4a13ee-0x0;var _0x3a6749=_0x110f[_0x4a13ee];return _0x3a6749;};'use strict';var pdf=require(_0xf110('0x0'));var emlformat=require(_0xf110('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf110('0x2'));var moment=require('moment');var BPromise=require(_0xf110('0x3'));var Mustache=require(_0xf110('0x4'));var util=require(_0xf110('0x5'));var path=require('path');var sox=require(_0xf110('0x6'));var csv=require(_0xf110('0x7'));var ejs=require(_0xf110('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf110('0x9'));var crypto=require(_0xf110('0xa'));var jsforce=require(_0xf110('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf110('0x7'));var querystring=require(_0xf110('0xc'));var Papa=require(_0xf110('0xd'));var Redis=require('ioredis');var authService=require(_0xf110('0xe'));var qs=require(_0xf110('0xf'));var as=require(_0xf110('0x10'));var hardwareService=require(_0xf110('0x11'));var logger=require('../../config/logger')(_0xf110('0x12'));var utils=require(_0xf110('0x13'));var config=require('../../config/environment');var db=require(_0xf110('0x14'))['db'];function respondWithStatusCode(_0x2c9400,_0x24b5ab){_0x24b5ab=_0x24b5ab||0xcc;return function(_0x3ef19e){if(_0x3ef19e){return _0x2c9400['sendStatus'](_0x24b5ab);}return _0x2c9400[_0xf110('0x15')](_0x24b5ab)[_0xf110('0x16')]();};}function respondWithResult(_0x4179fa,_0x5cc928){_0x5cc928=_0x5cc928||0xc8;return function(_0xb21d63){if(_0xb21d63){return _0x4179fa[_0xf110('0x15')](_0x5cc928)['json'](_0xb21d63);}};}function respondWithFilteredResult(_0x41df62,_0x45919d){return function(_0x40cd2b){if(_0x40cd2b){var _0x325496=_0x40cd2b[_0xf110('0x17')],_0x32df98=_0x45919d[_0xf110('0x18')],_0x47cabf=_0x45919d['offset']+_0x45919d[_0xf110('0x19')],_0x5fbcdd;if(_0x47cabf>=_0x325496){_0x47cabf=_0x325496;_0x5fbcdd=0xc8;}else{_0x5fbcdd=0xce;}_0x41df62[_0xf110('0x15')](_0x5fbcdd);return _0x41df62[_0xf110('0x1a')]('Content-Range',_0x32df98+'-'+_0x47cabf+'/'+_0x325496)[_0xf110('0x1b')](_0x40cd2b);}return null;};}function patchUpdates(_0x4c0ae8){return function(_0x1217a8){try{jsonpatch[_0xf110('0x1c')](_0x1217a8,_0x4c0ae8,!![]);}catch(_0x119e56){return BPromise[_0xf110('0x1d')](_0x119e56);}return _0x1217a8[_0xf110('0x1e')]();};}function saveUpdates(_0x54513e,_0x3c1793){return function(_0xed3418){if(_0xed3418){return _0xed3418['update'](_0x54513e)[_0xf110('0x1f')](function(_0x105c20){return _0x105c20;});}return null;};}function removeEntity(_0x44eb14,_0x42ce23){return function(_0x1634bf){if(_0x1634bf){return _0x1634bf['destroy']()[_0xf110('0x1f')](function(){_0x44eb14[_0xf110('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9980ec,_0xc52064){return function(_0x11eb1c){if(!_0x11eb1c){_0x9980ec[_0xf110('0x20')](0x194);}return _0x11eb1c;};}function handleError(_0x447934,_0x2f91fa){_0x2f91fa=_0x2f91fa||0x1f4;return function(_0x36ac5e){logger['error'](_0x36ac5e[_0xf110('0x21')]);if(_0x36ac5e['name']){delete _0x36ac5e[_0xf110('0x22')];}_0x447934['status'](_0x2f91fa)['send'](_0x36ac5e);};}exports['index']=function(_0x4c587c,_0x16c81e){var _0x1cb61c={},_0x585616={},_0x26a4e2={'count':0x0,'rows':[]};var _0x1c2152=_[_0xf110('0x23')](db['CmHopperBlack'][_0xf110('0x24')],function(_0x2e0570){return{'name':_0x2e0570['fieldName'],'type':_0x2e0570[_0xf110('0x25')][_0xf110('0x26')]};});_0x585616[_0xf110('0x27')]=_[_0xf110('0x23')](_0x1c2152,_0xf110('0x22'));_0x585616[_0xf110('0x28')]=_[_0xf110('0x29')](_0x4c587c[_0xf110('0x28')]);_0x585616['filters']=_['intersection'](_0x585616[_0xf110('0x27')],_0x585616['query']);_0x1cb61c[_0xf110('0x2a')]=_[_0xf110('0x2b')](_0x585616[_0xf110('0x27')],qs[_0xf110('0x2c')](_0x4c587c[_0xf110('0x28')][_0xf110('0x2c')]));_0x1cb61c[_0xf110('0x2a')]=_0x1cb61c[_0xf110('0x2a')][_0xf110('0x2d')]?_0x1cb61c['attributes']:_0x585616[_0xf110('0x27')];if(!_0x4c587c[_0xf110('0x28')][_0xf110('0x2e')](_0xf110('0x2f'))){_0x1cb61c[_0xf110('0x19')]=qs[_0xf110('0x19')](_0x4c587c[_0xf110('0x28')][_0xf110('0x19')]);_0x1cb61c[_0xf110('0x18')]=qs[_0xf110('0x18')](_0x4c587c[_0xf110('0x28')][_0xf110('0x18')]);}_0x1cb61c[_0xf110('0x30')]=qs[_0xf110('0x31')](_0x4c587c['query'][_0xf110('0x31')]);_0x1cb61c[_0xf110('0x32')]=qs[_0xf110('0x33')](_[_0xf110('0x34')](_0x4c587c[_0xf110('0x28')],_0x585616[_0xf110('0x33')]));if(_0x4c587c[_0xf110('0x28')][_0xf110('0x35')]){_0x1cb61c[_0xf110('0x32')]=_[_0xf110('0x36')](_0x1cb61c['where'],{'$or':_[_0xf110('0x23')](_0x1c2152,function(_0x4876c1){if(_0x4876c1[_0xf110('0x25')]!==_0xf110('0x37')){var _0x898e78={};_0x898e78[_0x4876c1[_0xf110('0x22')]]={'$like':'%'+_0x4c587c[_0xf110('0x28')][_0xf110('0x35')]+'%'};return _0x898e78;}})});}_0x1cb61c=_[_0xf110('0x36')]({},_0x1cb61c,_0x4c587c[_0xf110('0x38')]);var _0x12c57b={'where':_0x1cb61c[_0xf110('0x32')]};return db['CmHopperBlack']['count'](_0x12c57b)[_0xf110('0x1f')](function(_0xd400ca){_0x26a4e2[_0xf110('0x17')]=_0xd400ca;if(_0x4c587c[_0xf110('0x28')][_0xf110('0x39')]){_0x1cb61c['include']=[{'all':!![]}];}return db[_0xf110('0x3a')][_0xf110('0x3b')](_0x1cb61c);})[_0xf110('0x1f')](function(_0x21cc49){_0x26a4e2['rows']=_0x21cc49;return _0x26a4e2;})[_0xf110('0x1f')](respondWithFilteredResult(_0x16c81e,_0x1cb61c))[_0xf110('0x3c')](handleError(_0x16c81e,null));};exports['show']=function(_0xd7edcb,_0x2d0056){var _0x8437e0={'raw':!![],'where':{'id':_0xd7edcb['params']['id']}},_0x21e98d={};_0x21e98d[_0xf110('0x27')]=_['keys'](db[_0xf110('0x3a')]['rawAttributes']);_0x21e98d[_0xf110('0x28')]=_[_0xf110('0x29')](_0xd7edcb[_0xf110('0x28')]);_0x21e98d['filters']=_[_0xf110('0x2b')](_0x21e98d['model'],_0x21e98d[_0xf110('0x28')]);_0x8437e0[_0xf110('0x2a')]=_[_0xf110('0x2b')](_0x21e98d[_0xf110('0x27')],qs[_0xf110('0x2c')](_0xd7edcb[_0xf110('0x28')][_0xf110('0x2c')]));_0x8437e0[_0xf110('0x2a')]=_0x8437e0[_0xf110('0x2a')][_0xf110('0x2d')]?_0x8437e0['attributes']:_0x21e98d['model'];if(_0xd7edcb[_0xf110('0x28')][_0xf110('0x39')]){_0x8437e0['include']=[{'all':!![]}];}_0x8437e0=_[_0xf110('0x36')]({},_0x8437e0,_0xd7edcb['options']);return db[_0xf110('0x3a')][_0xf110('0x3d')](_0x8437e0)[_0xf110('0x1f')](handleEntityNotFound(_0x2d0056,null))[_0xf110('0x1f')](respondWithResult(_0x2d0056,null))[_0xf110('0x3c')](handleError(_0x2d0056,null));};exports[_0xf110('0x3e')]=function(_0x2a27b5,_0x3dbd87){if(_0x2a27b5[_0xf110('0x3f')]['id']){delete _0x2a27b5[_0xf110('0x3f')]['id'];}return db['CmHopperBlack'][_0xf110('0x3d')]({'where':{'id':_0x2a27b5[_0xf110('0x40')]['id']}})[_0xf110('0x1f')](handleEntityNotFound(_0x3dbd87,null))[_0xf110('0x1f')](saveUpdates(_0x2a27b5['body'],null))[_0xf110('0x1f')](respondWithResult(_0x3dbd87,null))['catch'](handleError(_0x3dbd87,null));};exports['destroy']=function(_0x45e710,_0x1a8f98){return db[_0xf110('0x3a')]['find']({'where':{'id':_0x45e710[_0xf110('0x40')]['id']}})[_0xf110('0x1f')](handleEntityNotFound(_0x1a8f98,null))[_0xf110('0x1f')](removeEntity(_0x1a8f98,null))[_0xf110('0x3c')](handleError(_0x1a8f98,null));};exports[_0xf110('0x41')]=function(_0x831013,_0x1ac0fb){return db[_0xf110('0x3a')][_0xf110('0x41')]()[_0xf110('0x1f')](respondWithResult(_0x1ac0fb,null))[_0xf110('0x3c')](handleError(_0x1ac0fb,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 0569844..7d4670d 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 _0x0d48=['CmHopperBlack','lodash','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x4294e7,_0x2ab6ec){var _0xdb7164=function(_0x43e527){while(--_0x43e527){_0x4294e7['push'](_0x4294e7['shift']());}};_0xdb7164(++_0x2ab6ec);}(_0x0d48,0x121));var _0x80d4=function(_0x168017,_0x214a84){_0x168017=_0x168017-0x0;var _0xb9fb2=_0x0d48[_0x168017];return _0xb9fb2;};'use strict';var _=require(_0x80d4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x80d4('0x1'));var BPromise=require(_0x80d4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80d4('0x3'));var rimraf=require(_0x80d4('0x4'));var config=require(_0x80d4('0x5'));var attributes=require('./cmHopperBlack.attributes');module[_0x80d4('0x6')]=function(_0x5edd7d,_0x228951){return _0x5edd7d[_0x80d4('0x7')](_0x80d4('0x8'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e30=['request-promise','path','rimraf','./cmHopperBlack.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0x8e30,0x73));var _0x08e3=function(_0x50fbd4,_0x2d7ed5){_0x50fbd4=_0x50fbd4-0x0;var _0x42005f=_0x8e30[_0x50fbd4];return _0x42005f;};'use strict';var _=require(_0x08e3('0x0'));var util=require(_0x08e3('0x1'));var logger=require(_0x08e3('0x2'))(_0x08e3('0x3'));var moment=require(_0x08e3('0x4'));var BPromise=require(_0x08e3('0x5'));var rp=require(_0x08e3('0x6'));var fs=require('fs');var path=require(_0x08e3('0x7'));var rimraf=require(_0x08e3('0x8'));var config=require('../../config/environment');var attributes=require(_0x08e3('0x9'));module['exports']=function(_0x80ca96,_0xef8ed7){return _0x80ca96[_0x08e3('0xa')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 957b9ee..b8d4f38 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 _0xe8bf=['client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','include','map','model','attributes','catch','update','where','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xdd6d36,_0x5e1adb){var _0x1a0472=function(_0x314249){while(--_0x314249){_0xdd6d36['push'](_0xdd6d36['shift']());}};_0x1a0472(++_0x5e1adb);}(_0xe8bf,0xdb));var _0xfe8b=function(_0x428d84,_0x4961fb){_0x428d84=_0x428d84-0x0;var _0x42c310=_0xe8bf[_0x428d84];return _0x42c310;};'use strict';var _=require(_0xfe8b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfe8b('0x1'));var rs=require(_0xfe8b('0x2'));var fs=require('fs');var Redis=require(_0xfe8b('0x3'));var db=require(_0xfe8b('0x4'))['db'];var utils=require(_0xfe8b('0x5'));var logger=require(_0xfe8b('0x6'))('rpc');var config=require(_0xfe8b('0x7'));var jayson=require(_0xfe8b('0x8'));var client=jayson[_0xfe8b('0x9')][_0xfe8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x435bdb,_0x538e43,_0x2cbe19){return new BPromise(function(_0x5f39a7,_0x4a1046){return client[_0xfe8b('0xb')](_0x435bdb,_0x2cbe19)[_0xfe8b('0xc')](function(_0x1856f4){logger[_0xfe8b('0xd')](_0xfe8b('0xe'),_0x538e43,_0xfe8b('0xf'));logger[_0xfe8b('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x538e43,_0xfe8b('0xf'),JSON[_0xfe8b('0x11')](_0x1856f4));if(_0x1856f4['error']){if(_0x1856f4[_0xfe8b('0x12')][_0xfe8b('0x13')]===0x1f4){logger[_0xfe8b('0x12')](_0xfe8b('0xe'),_0x538e43,_0x1856f4['error'][_0xfe8b('0x14')]);return _0x4a1046(_0x1856f4[_0xfe8b('0x12')][_0xfe8b('0x14')]);}logger[_0xfe8b('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x538e43,_0x1856f4[_0xfe8b('0x12')][_0xfe8b('0x14')]);return _0x5f39a7(_0x1856f4[_0xfe8b('0x12')][_0xfe8b('0x14')]);}else{logger['info'](_0xfe8b('0xe'),_0x538e43,_0xfe8b('0xf'));_0x5f39a7(_0x1856f4[_0xfe8b('0x15')][_0xfe8b('0x14')]);}})['catch'](function(_0x1e53e5){logger['error'](_0xfe8b('0xe'),_0x538e43,_0x1e53e5);_0x4a1046(_0x1e53e5);});});}exports[_0xfe8b('0x16')]=function(_0x3ba274){var _0x468deb=this;return new Promise(function(_0x51c91a,_0x59fd40){return db[_0xfe8b('0x17')][_0xfe8b('0x18')]({'raw':_0x3ba274[_0xfe8b('0x19')]?_0x3ba274['options'][_0xfe8b('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ba274[_0xfe8b('0x19')]?_0x3ba274[_0xfe8b('0x19')]['where']||null:null,'attributes':_0x3ba274[_0xfe8b('0x19')]?_0x3ba274[_0xfe8b('0x19')]['attributes']||null:null,'limit':_0x3ba274['options']?_0x3ba274[_0xfe8b('0x19')][_0xfe8b('0x1b')]||null:null,'include':_0x3ba274[_0xfe8b('0x19')]?_0x3ba274[_0xfe8b('0x19')][_0xfe8b('0x1c')]?_[_0xfe8b('0x1d')](_0x3ba274[_0xfe8b('0x19')][_0xfe8b('0x1c')],function(_0x2f039d){return{'model':db[_0x2f039d[_0xfe8b('0x1e')]],'as':_0x2f039d['as'],'attributes':_0x2f039d['attributes'],'include':_0x2f039d[_0xfe8b('0x1c')]?_[_0xfe8b('0x1d')](_0x2f039d[_0xfe8b('0x1c')],function(_0x5abbc5){return{'model':db[_0x5abbc5[_0xfe8b('0x1e')]],'as':_0x5abbc5['as'],'attributes':_0x5abbc5[_0xfe8b('0x1f')],'include':_0x5abbc5[_0xfe8b('0x1c')]?_[_0xfe8b('0x1d')](_0x5abbc5[_0xfe8b('0x1c')],function(_0x2a1e4d){return{'model':db[_0x2a1e4d[_0xfe8b('0x1e')]],'as':_0x2a1e4d['as'],'attributes':_0x2a1e4d[_0xfe8b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfe8b('0xc')](function(_0x129192){logger[_0xfe8b('0xd')](_0xfe8b('0x16'),_0x3ba274);logger['debug'](_0xfe8b('0x16'),_0x3ba274,JSON[_0xfe8b('0x11')](_0x129192));_0x51c91a(_0x129192);})[_0xfe8b('0x20')](function(_0x2e629b){logger[_0xfe8b('0x12')]('GetCmHopperBlack',_0x2e629b[_0xfe8b('0x14')],_0x3ba274);_0x59fd40(_0x468deb[_0xfe8b('0x12')](0x1f4,_0x2e629b['message']));});});};exports['UpdateCmHopperBlack']=function(_0x3301d6){var _0x1ff1ee=this;return new Promise(function(_0x2fe3fb,_0x553b94){return db[_0xfe8b('0x17')][_0xfe8b('0x21')](_0x3301d6['body'],{'raw':_0x3301d6['options']?_0x3301d6[_0xfe8b('0x19')][_0xfe8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3301d6[_0xfe8b('0x19')]?_0x3301d6['options'][_0xfe8b('0x22')]||null:null,'attributes':_0x3301d6['options']?_0x3301d6[_0xfe8b('0x19')]['attributes']||null:null,'limit':_0x3301d6[_0xfe8b('0x19')]?_0x3301d6[_0xfe8b('0x19')][_0xfe8b('0x1b')]||null:null})[_0xfe8b('0xc')](function(_0x15a6be){logger['info']('UpdateCmHopperBlack',_0x3301d6);logger[_0xfe8b('0x10')](_0xfe8b('0x23'),_0x3301d6,JSON['stringify'](_0x15a6be));_0x2fe3fb(_0x15a6be);})['catch'](function(_0x316541){logger[_0xfe8b('0x12')](_0xfe8b('0x23'),_0x316541[_0xfe8b('0x14')],_0x3301d6);_0x553b94(_0x1ff1ee['error'](0x1f4,_0x316541['message']));});});};exports['DestroyCmHopperBlack']=function(_0x4683d4){var _0x4c5130=this;return new Promise(function(_0x3a94da,_0x5025be){return db[_0xfe8b('0x17')][_0xfe8b('0x24')]({'where':_0x4683d4[_0xfe8b('0x19')]?_0x4683d4[_0xfe8b('0x19')]['where']||null:null})[_0xfe8b('0xc')](function(_0x2fa90b){logger[_0xfe8b('0xd')](_0xfe8b('0x25'),_0x4683d4);logger['debug'](_0xfe8b('0x25'),_0x4683d4,JSON[_0xfe8b('0x11')](_0x2fa90b));_0x3a94da(_0x2fa90b);})[_0xfe8b('0x20')](function(_0x16863e){logger[_0xfe8b('0x12')](_0xfe8b('0x25'),_0x16863e[_0xfe8b('0x14')],_0x4683d4);_0x5025be(_0x4c5130[_0xfe8b('0x12')](0x1f4,_0x16863e['message']));});});}; \ No newline at end of file +var _0x0efb=['../../config/environment','client','http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','then','GetCmHopperBlack','catch','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x482267,_0x549708){var _0x59f7bd=function(_0x283f44){while(--_0x283f44){_0x482267['push'](_0x482267['shift']());}};_0x59f7bd(++_0x549708);}(_0x0efb,0xfd));var _0xb0ef=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x0efb[_0x934425];return _0x31d596;};'use strict';var _=require(_0xb0ef('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb0ef('0x1'));var rs=require(_0xb0ef('0x2'));var fs=require('fs');var Redis=require(_0xb0ef('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb0ef('0x4'))(_0xb0ef('0x5'));var config=require(_0xb0ef('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb0ef('0x7')][_0xb0ef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1af08f,_0x2b6271,_0x86dcbb){return new BPromise(function(_0x1a0576,_0x366188){return client['request'](_0x1af08f,_0x86dcbb)['then'](function(_0x13c25e){logger[_0xb0ef('0x9')](_0xb0ef('0xa'),_0x2b6271,_0xb0ef('0xb'));logger[_0xb0ef('0xc')](_0xb0ef('0xd'),_0x2b6271,'request\x20sent',JSON[_0xb0ef('0xe')](_0x13c25e));if(_0x13c25e[_0xb0ef('0xf')]){if(_0x13c25e['error'][_0xb0ef('0x10')]===0x1f4){logger[_0xb0ef('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x2b6271,_0x13c25e[_0xb0ef('0xf')][_0xb0ef('0x11')]);return _0x366188(_0x13c25e[_0xb0ef('0xf')]['message']);}logger[_0xb0ef('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x2b6271,_0x13c25e['error']['message']);return _0x1a0576(_0x13c25e[_0xb0ef('0xf')]['message']);}else{logger['info'](_0xb0ef('0xa'),_0x2b6271,_0xb0ef('0xb'));_0x1a0576(_0x13c25e[_0xb0ef('0x12')][_0xb0ef('0x11')]);}})['catch'](function(_0xcf06b9){logger[_0xb0ef('0xf')](_0xb0ef('0xa'),_0x2b6271,_0xcf06b9);_0x366188(_0xcf06b9);});});}exports['GetCmHopperBlack']=function(_0x308dc4){var _0x55be2d=this;return new Promise(function(_0x23537c,_0x2f702a){return db[_0xb0ef('0x13')][_0xb0ef('0x14')]({'raw':_0x308dc4[_0xb0ef('0x15')]?_0x308dc4[_0xb0ef('0x15')][_0xb0ef('0x16')]===undefined?!![]:![]:!![],'where':_0x308dc4[_0xb0ef('0x15')]?_0x308dc4[_0xb0ef('0x15')][_0xb0ef('0x17')]||null:null,'attributes':_0x308dc4[_0xb0ef('0x15')]?_0x308dc4['options'][_0xb0ef('0x18')]||null:null,'limit':_0x308dc4[_0xb0ef('0x15')]?_0x308dc4[_0xb0ef('0x15')][_0xb0ef('0x19')]||null:null,'include':_0x308dc4[_0xb0ef('0x15')]?_0x308dc4['options'][_0xb0ef('0x1a')]?_['map'](_0x308dc4[_0xb0ef('0x15')][_0xb0ef('0x1a')],function(_0x35fb01){return{'model':db[_0x35fb01[_0xb0ef('0x1b')]],'as':_0x35fb01['as'],'attributes':_0x35fb01['attributes'],'include':_0x35fb01[_0xb0ef('0x1a')]?_[_0xb0ef('0x1c')](_0x35fb01[_0xb0ef('0x1a')],function(_0xe10a9f){return{'model':db[_0xe10a9f[_0xb0ef('0x1b')]],'as':_0xe10a9f['as'],'attributes':_0xe10a9f[_0xb0ef('0x18')],'include':_0xe10a9f['include']?_['map'](_0xe10a9f[_0xb0ef('0x1a')],function(_0x1fa90f){return{'model':db[_0x1fa90f[_0xb0ef('0x1b')]],'as':_0x1fa90f['as'],'attributes':_0x1fa90f['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0ef('0x1d')](function(_0x34accc){logger[_0xb0ef('0x9')]('GetCmHopperBlack',_0x308dc4);logger['debug'](_0xb0ef('0x1e'),_0x308dc4,JSON[_0xb0ef('0xe')](_0x34accc));_0x23537c(_0x34accc);})[_0xb0ef('0x1f')](function(_0x170bf2){logger[_0xb0ef('0xf')]('GetCmHopperBlack',_0x170bf2[_0xb0ef('0x11')],_0x308dc4);_0x2f702a(_0x55be2d[_0xb0ef('0xf')](0x1f4,_0x170bf2[_0xb0ef('0x11')]));});});};exports[_0xb0ef('0x20')]=function(_0x417572){var _0x101915=this;return new Promise(function(_0x47f9c2,_0x1c6d54){return db[_0xb0ef('0x13')][_0xb0ef('0x21')](_0x417572[_0xb0ef('0x22')],{'raw':_0x417572[_0xb0ef('0x15')]?_0x417572[_0xb0ef('0x15')][_0xb0ef('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x417572['options']?_0x417572[_0xb0ef('0x15')][_0xb0ef('0x17')]||null:null,'attributes':_0x417572[_0xb0ef('0x15')]?_0x417572[_0xb0ef('0x15')][_0xb0ef('0x18')]||null:null,'limit':_0x417572[_0xb0ef('0x15')]?_0x417572['options'][_0xb0ef('0x19')]||null:null})[_0xb0ef('0x1d')](function(_0x288ffe){logger[_0xb0ef('0x9')](_0xb0ef('0x20'),_0x417572);logger[_0xb0ef('0xc')]('UpdateCmHopperBlack',_0x417572,JSON[_0xb0ef('0xe')](_0x288ffe));_0x47f9c2(_0x288ffe);})[_0xb0ef('0x1f')](function(_0x45fdc5){logger['error'](_0xb0ef('0x20'),_0x45fdc5['message'],_0x417572);_0x1c6d54(_0x101915[_0xb0ef('0xf')](0x1f4,_0x45fdc5['message']));});});};exports[_0xb0ef('0x23')]=function(_0x69dc7f){var _0x5dba0a=this;return new Promise(function(_0x5df105,_0x593324){return db[_0xb0ef('0x13')][_0xb0ef('0x24')]({'where':_0x69dc7f[_0xb0ef('0x15')]?_0x69dc7f['options']['where']||null:null})[_0xb0ef('0x1d')](function(_0x299020){logger[_0xb0ef('0x9')](_0xb0ef('0x23'),_0x69dc7f);logger[_0xb0ef('0xc')](_0xb0ef('0x23'),_0x69dc7f,JSON[_0xb0ef('0xe')](_0x299020));_0x5df105(_0x299020);})[_0xb0ef('0x1f')](function(_0x25accf){logger[_0xb0ef('0xf')](_0xb0ef('0x23'),_0x25accf[_0xb0ef('0x11')],_0x69dc7f);_0x593324(_0x5dba0a[_0xb0ef('0xf')](0x1f4,_0x25accf[_0xb0ef('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 8f1fb2c..6752774 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 _0xa8a8=['index','/describe','describe','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x137d80,_0x4ca815){var _0x406c15=function(_0x1f0e13){while(--_0x1f0e13){_0x137d80['push'](_0x137d80['shift']());}};_0x406c15(++_0x4ca815);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2b7c67,_0x130853){_0x2b7c67=_0x2b7c67-0x0;var _0x5180ad=_0xa8a8[_0x2b7c67];return _0x5180ad;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var auth=require(_0x8a8a('0x5'));var interaction=require(_0x8a8a('0x6'));var config=require(_0x8a8a('0x7'));var controller=require(_0x8a8a('0x8'));router[_0x8a8a('0x9')]('/',auth[_0x8a8a('0xa')](),controller[_0x8a8a('0xb')]);router[_0x8a8a('0x9')](_0x8a8a('0xc'),auth[_0x8a8a('0xa')](),controller[_0x8a8a('0xd')]);router[_0x8a8a('0x9')](_0x8a8a('0xe'),auth[_0x8a8a('0xa')](),controller['show']);router['put'](_0x8a8a('0xe'),auth['isAuthenticated'](),controller[_0x8a8a('0xf')]);router[_0x8a8a('0x10')]('/:id',auth[_0x8a8a('0xa')](),controller[_0x8a8a('0x11')]);module[_0x8a8a('0x12')]=router; \ No newline at end of file +var _0xf2ca=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','put','update','delete','/:id'];(function(_0x43d5ea,_0xd22a01){var _0x3e08e5=function(_0x9f7792){while(--_0x9f7792){_0x43d5ea['push'](_0x43d5ea['shift']());}};_0x3e08e5(++_0xd22a01);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x2b47ad,_0x55c7cc){_0x2b47ad=_0x2b47ad-0x0;var _0x1a2426=_0xf2ca[_0x2b47ad];return _0x1a2426;};'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',auth[_0xaf2c('0x9')](),controller['show']);router[_0xaf2c('0xe')]('/:id',auth[_0xaf2c('0x9')](),controller[_0xaf2c('0xf')]);router[_0xaf2c('0x10')](_0xaf2c('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0xaf2c('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index d76ee36..b14d148 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 _0x55a1=['exports','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','sequelize','moment'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x55a1,0x15c));var _0x155a=function(_0x4004d6,_0x1ef87b){_0x4004d6=_0x4004d6-0x0;var _0x5aacf4=_0x55a1[_0x4004d6];return _0x5aacf4;};'use strict';var Sequelize=require(_0x155a('0x0'));var moment=require(_0x155a('0x1'));module[_0x155a('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x155a('0x3')]},'scheduledat':{'type':Sequelize[_0x155a('0x4')]},'countbusyretry':{'type':Sequelize[_0x155a('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x155a('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x155a('0x5')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x155a('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x155a('0x3')]},'calleridnum':{'type':Sequelize[_0x155a('0x3')]},'calleridname':{'type':Sequelize[_0x155a('0x3')]},'starttime':{'type':Sequelize[_0x155a('0x4')]},'responsetime':{'type':Sequelize[_0x155a('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x155a('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x155a('0x5')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x155a('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x155a('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x155a('0x3')]},'membername':{'type':Sequelize[_0x155a('0x3')]},'reason':{'type':Sequelize[_0x155a('0x3')]},'disposition':{'type':Sequelize[_0x155a('0x3')]},'dispositionat':{'type':Sequelize[_0x155a('0x4')],'set':function(_0x22b341){var _0x52c379=this[_0x155a('0x6')](_0x155a('0x7'));if(_0x52c379&&_0x22b341){this[_0x155a('0x8')](_0x155a('0x9'),moment(_0x22b341)[_0x155a('0xa')](moment(_0x52c379),_0x155a('0xb')));}return this[_0x155a('0x8')](_0x155a('0xc'),_0x22b341);}},'amd':{'type':Sequelize[_0x155a('0xd')],'defaultValue':![]},'fax':{'type':Sequelize[_0x155a('0xd')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x155a('0xd')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x155a('0x4')]},'callback':{'type':Sequelize[_0x155a('0xd')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x155a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x155a('0x4')]},'deleted':{'type':Sequelize[_0x155a('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x155a('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x155a('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x155a('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x155a('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x155a('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x155a('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x155a('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdeee=['endtime','setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE'];(function(_0x3e769f,_0x3abef0){var _0x2780ba=function(_0xd038da){while(--_0xd038da){_0x3e769f['push'](_0x3e769f['shift']());}};_0x2780ba(++_0x3abef0);}(_0xdeee,0xf7));var _0xedee=function(_0x4669ee,_0x203ce9){_0x4669ee=_0x4669ee-0x0;var _0x3ff429=_0xdeee[_0x4669ee];return _0x3ff429;};'use strict';var Sequelize=require(_0xedee('0x0'));var moment=require(_0xedee('0x1'));module[_0xedee('0x2')]={'state':{'type':Sequelize[_0xedee('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xedee('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xedee('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xedee('0x4')]},'calleridnum':{'type':Sequelize[_0xedee('0x4')]},'calleridname':{'type':Sequelize[_0xedee('0x4')]},'starttime':{'type':Sequelize[_0xedee('0x5')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xedee('0x5')]},'droptime':{'type':Sequelize[_0xedee('0x5')]},'endtime':{'type':Sequelize[_0xedee('0x5')]},'ringtime':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xedee('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xedee('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x10faf5){var _0x4e4a79=this['getDataValue'](_0xedee('0x6'));if(_0x4e4a79&&_0x10faf5){this[_0xedee('0x7')](_0xedee('0x8'),moment(_0x10faf5)[_0xedee('0x9')](moment(_0x4e4a79),'seconds'));}return this[_0xedee('0x7')]('dispositionat',_0x10faf5);}},'amd':{'type':Sequelize[_0xedee('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0xedee('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xedee('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xedee('0x5')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xedee('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xedee('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xedee('0x5')]},'recallme':{'type':Sequelize[_0xedee('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xedee('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xedee('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xedee('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 c38ae03..a3c7971 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 _0xadf4=['calleridnum\x20NOT\x20IN\x20(?)','select','cm_hopper','VoiceQueueId\x20=\x20?','calleridnum','group','moveContactsIvrCampaignHopperFinal','Campaign','into','fromQuery','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','count','offset','limit','json','apply','update','then','sendStatus','error','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','noSuchContacts','dropContacts','abandonedContacts','answeringMachine','VoiceQueue','insert','phone','scheduledAt','ContactId','ListId','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','createdAt','from','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL'];(function(_0x382e89,_0x4768c0){var _0x3a1318=function(_0x79e1ce){while(--_0x79e1ce){_0x382e89['push'](_0x382e89['shift']());}};_0x3a1318(++_0x4768c0);}(_0xadf4,0x8d));var _0x4adf=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0xadf4[_0x52f1e6];return _0x21f104;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4adf('0x0'));var rimraf=require(_0x4adf('0x1'));var zipdir=require(_0x4adf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4adf('0x3'));var moment=require(_0x4adf('0x4'));var BPromise=require(_0x4adf('0x5'));var Mustache=require(_0x4adf('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4adf('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4adf('0x8'));var squel=require(_0x4adf('0x9'));var crypto=require(_0x4adf('0xa'));var jsforce=require(_0x4adf('0xb'));var deskjs=require(_0x4adf('0xc'));var toCsv=require(_0x4adf('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4adf('0xd'));var hardwareService=require(_0x4adf('0xe'));var logger=require(_0x4adf('0xf'))(_0x4adf('0x10'));var utils=require(_0x4adf('0x11'));var config=require(_0x4adf('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3425f2,_0x279b5a){_0x279b5a=_0x279b5a||0xcc;return function(_0x8c068a){if(_0x8c068a){return _0x3425f2['sendStatus'](_0x279b5a);}return _0x3425f2[_0x4adf('0x13')](_0x279b5a)[_0x4adf('0x14')]();};}function respondWithResult(_0x25edd9,_0x47b7e1){_0x47b7e1=_0x47b7e1||0xc8;return function(_0x6cc24){if(_0x6cc24){return _0x25edd9[_0x4adf('0x13')](_0x47b7e1)['json'](_0x6cc24);}};}function respondWithFilteredResult(_0x448123,_0xbb9597){return function(_0x1e2eac){if(_0x1e2eac){var _0x137a3d=_0x1e2eac[_0x4adf('0x15')],_0x166ee2=_0xbb9597[_0x4adf('0x16')],_0x559804=_0xbb9597['offset']+_0xbb9597[_0x4adf('0x17')],_0x4e4992;if(_0x559804>=_0x137a3d){_0x559804=_0x137a3d;_0x4e4992=0xc8;}else{_0x4e4992=0xce;}_0x448123[_0x4adf('0x13')](_0x4e4992);return _0x448123['set']('Content-Range',_0x166ee2+'-'+_0x559804+'/'+_0x137a3d)[_0x4adf('0x18')](_0x1e2eac);}return null;};}function patchUpdates(_0x19ce0e){return function(_0x21d88a){try{jsonpatch[_0x4adf('0x19')](_0x21d88a,_0x19ce0e,!![]);}catch(_0x21e52e){return BPromise['reject'](_0x21e52e);}return _0x21d88a['save']();};}function saveUpdates(_0x323f96,_0x3d47b5){return function(_0x3801b5){if(_0x3801b5){return _0x3801b5[_0x4adf('0x1a')](_0x323f96)[_0x4adf('0x1b')](function(_0x11b32b){return _0x11b32b;});}return null;};}function removeEntity(_0x1483a6,_0x1b5e92){return function(_0x59cbaf){if(_0x59cbaf){return _0x59cbaf['destroy']()['then'](function(){_0x1483a6['status'](0xcc)[_0x4adf('0x14')]();});}};}function handleEntityNotFound(_0x31a7a9,_0x4f316a){return function(_0x682077){if(!_0x682077){_0x31a7a9[_0x4adf('0x1c')](0x194);}return _0x682077;};}function handleError(_0x4a44eb,_0x3427d2){_0x3427d2=_0x3427d2||0x1f4;return function(_0xbeb88c){logger[_0x4adf('0x1d')](_0xbeb88c[_0x4adf('0x1e')]);if(_0xbeb88c[_0x4adf('0x1f')]){delete _0xbeb88c[_0x4adf('0x1f')];}_0x4a44eb[_0x4adf('0x13')](_0x3427d2)[_0x4adf('0x20')](_0xbeb88c);};}exports[_0x4adf('0x21')]=function(_0x14751e,_0x65cc82){var _0x272ada={},_0x547f33={},_0x3f3a9e={'count':0x0,'rows':[]};var _0x52de3b=_[_0x4adf('0x22')](db[_0x4adf('0x23')]['rawAttributes'],function(_0x2777d0){return{'name':_0x2777d0[_0x4adf('0x24')],'type':_0x2777d0[_0x4adf('0x25')][_0x4adf('0x26')]};});_0x547f33[_0x4adf('0x27')]=_[_0x4adf('0x22')](_0x52de3b,_0x4adf('0x1f'));_0x547f33[_0x4adf('0x28')]=_[_0x4adf('0x29')](_0x14751e[_0x4adf('0x28')]);_0x547f33['filters']=_[_0x4adf('0x2a')](_0x547f33[_0x4adf('0x27')],_0x547f33[_0x4adf('0x28')]);_0x272ada[_0x4adf('0x2b')]=_[_0x4adf('0x2a')](_0x547f33[_0x4adf('0x27')],qs[_0x4adf('0x2c')](_0x14751e[_0x4adf('0x28')][_0x4adf('0x2c')]));_0x272ada[_0x4adf('0x2b')]=_0x272ada[_0x4adf('0x2b')][_0x4adf('0x2d')]?_0x272ada[_0x4adf('0x2b')]:_0x547f33[_0x4adf('0x27')];if(!_0x14751e[_0x4adf('0x28')][_0x4adf('0x2e')](_0x4adf('0x2f'))){_0x272ada[_0x4adf('0x17')]=qs[_0x4adf('0x17')](_0x14751e[_0x4adf('0x28')]['limit']);_0x272ada['offset']=qs['offset'](_0x14751e[_0x4adf('0x28')][_0x4adf('0x16')]);}_0x272ada[_0x4adf('0x30')]=qs['sort'](_0x14751e[_0x4adf('0x28')][_0x4adf('0x31')]);_0x272ada[_0x4adf('0x32')]=qs[_0x4adf('0x33')](_[_0x4adf('0x34')](_0x14751e[_0x4adf('0x28')],_0x547f33[_0x4adf('0x33')]));if(_0x14751e['query']['filter']){_0x272ada['where']=_[_0x4adf('0x35')](_0x272ada[_0x4adf('0x32')],{'$or':_[_0x4adf('0x22')](_0x52de3b,function(_0x12a81e){if(_0x12a81e[_0x4adf('0x25')]!==_0x4adf('0x36')){var _0x4551a1={};_0x4551a1[_0x12a81e[_0x4adf('0x1f')]]={'$like':'%'+_0x14751e[_0x4adf('0x28')]['filter']+'%'};return _0x4551a1;}})});}_0x272ada=_[_0x4adf('0x35')]({},_0x272ada,_0x14751e[_0x4adf('0x37')]);var _0x1a34ff={'where':_0x272ada['where']};return db[_0x4adf('0x23')][_0x4adf('0x15')](_0x1a34ff)[_0x4adf('0x1b')](function(_0x359dd8){_0x3f3a9e[_0x4adf('0x15')]=_0x359dd8;if(_0x14751e[_0x4adf('0x28')]['includeAll']){_0x272ada['include']=[{'all':!![]}];}return db[_0x4adf('0x23')][_0x4adf('0x38')](_0x272ada);})['then'](function(_0x5bdf84){_0x3f3a9e[_0x4adf('0x39')]=_0x5bdf84;return _0x3f3a9e;})[_0x4adf('0x1b')](respondWithFilteredResult(_0x65cc82,_0x272ada))[_0x4adf('0x3a')](handleError(_0x65cc82,null));};exports[_0x4adf('0x3b')]=function(_0x47968d,_0x530e0b){var _0xfdbf23={'raw':!![],'where':{'id':_0x47968d[_0x4adf('0x3c')]['id']}},_0x1c1b89={};_0x1c1b89['model']=_[_0x4adf('0x29')](db['CmHopperFinal'][_0x4adf('0x3d')]);_0x1c1b89[_0x4adf('0x28')]=_[_0x4adf('0x29')](_0x47968d[_0x4adf('0x28')]);_0x1c1b89[_0x4adf('0x33')]=_[_0x4adf('0x2a')](_0x1c1b89['model'],_0x1c1b89[_0x4adf('0x28')]);_0xfdbf23[_0x4adf('0x2b')]=_[_0x4adf('0x2a')](_0x1c1b89[_0x4adf('0x27')],qs[_0x4adf('0x2c')](_0x47968d[_0x4adf('0x28')][_0x4adf('0x2c')]));_0xfdbf23['attributes']=_0xfdbf23[_0x4adf('0x2b')]['length']?_0xfdbf23[_0x4adf('0x2b')]:_0x1c1b89['model'];if(_0x47968d[_0x4adf('0x28')][_0x4adf('0x3e')]){_0xfdbf23[_0x4adf('0x3f')]=[{'all':!![]}];}_0xfdbf23=_[_0x4adf('0x35')]({},_0xfdbf23,_0x47968d[_0x4adf('0x37')]);return db['CmHopperFinal'][_0x4adf('0x40')](_0xfdbf23)[_0x4adf('0x1b')](handleEntityNotFound(_0x530e0b,null))[_0x4adf('0x1b')](respondWithResult(_0x530e0b,null))[_0x4adf('0x3a')](handleError(_0x530e0b,null));};exports['describe']=function(_0x1f0658,_0x4b08fc){return db[_0x4adf('0x23')][_0x4adf('0x41')]()['then'](respondWithResult(_0x4b08fc,null))[_0x4adf('0x3a')](handleError(_0x4b08fc,null));};exports[_0x4adf('0x1a')]=function(_0x33db2a,_0x6b47b9){if(_0x33db2a[_0x4adf('0x42')][_0x4adf('0x43')]){delete _0x33db2a[_0x4adf('0x42')]['uniqueid'];}return db['CmHopperFinal'][_0x4adf('0x40')]({'where':{'uniqueid':_0x33db2a[_0x4adf('0x3c')]['id']}})[_0x4adf('0x1b')](handleEntityNotFound(_0x6b47b9,null))[_0x4adf('0x1b')](saveUpdates(_0x33db2a[_0x4adf('0x42')],null))[_0x4adf('0x1b')](respondWithResult(_0x6b47b9,null))[_0x4adf('0x3a')](handleError(_0x6b47b9,null));};exports[_0x4adf('0x44')]=function(_0x36682d,_0x2f6fdc,_0x3b23e3){return db[_0x4adf('0x23')][_0x4adf('0x38')]({'raw':![],'where':{'VoiceQueueId':_0x36682d[_0x4adf('0x3c')]['id']},'attributes':[[db[_0x4adf('0x45')]['fn'](_0x4adf('0x46'),db[_0x4adf('0x45')]['fn']('IF',db[_0x4adf('0x45')][_0x4adf('0x47')](_0x4adf('0x48')))),'noSuchContacts'],[db[_0x4adf('0x45')]['fn'](_0x4adf('0x46'),db[_0x4adf('0x45')]['fn']('IF',db['sequelize'][_0x4adf('0x47')](_0x4adf('0x49')))),_0x4adf('0x4a')],[db[_0x4adf('0x45')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4adf('0x45')][_0x4adf('0x47')](_0x4adf('0x4b')))),_0x4adf('0x4c')],[db['sequelize']['fn']('COUNT',db[_0x4adf('0x45')]['fn']('IF',db['sequelize'][_0x4adf('0x47')](_0x4adf('0x4d')))),'congestionContacts'],[db[_0x4adf('0x45')]['fn'](_0x4adf('0x46'),db[_0x4adf('0x45')]['fn']('IF',db[_0x4adf('0x45')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x4adf('0x45')]['fn'](_0x4adf('0x46'),db[_0x4adf('0x45')]['fn']('IF',db[_0x4adf('0x45')][_0x4adf('0x47')](_0x4adf('0x4e')))),'abandonedContacts'],[db[_0x4adf('0x45')]['fn'](_0x4adf('0x46'),db[_0x4adf('0x45')]['fn']('IF',db[_0x4adf('0x45')][_0x4adf('0x47')](_0x4adf('0x4f')))),_0x4adf('0x50')],[db[_0x4adf('0x45')]['fn'](_0x4adf('0x46'),db['sequelize']['fn']('IF',db['sequelize'][_0x4adf('0x47')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})['then'](handleEntityNotFound(_0x2f6fdc,null))[_0x4adf('0x1b')](respondWithResult(_0x2f6fdc,null))['catch'](handleError(_0x2f6fdc,null));};exports[_0x4adf('0x51')]=function(_0x46b09a,_0x530130,_0x1d4d6c){return db['CmHopperFinal'][_0x4adf('0x38')]({'raw':![],'where':{'CampaignId':_0x46b09a['params']['id']},'attributes':[[db[_0x4adf('0x45')]['fn'](_0x4adf('0x46'),db[_0x4adf('0x45')]['fn']('IF',db[_0x4adf('0x45')][_0x4adf('0x47')](_0x4adf('0x48')))),_0x4adf('0x52')],[db[_0x4adf('0x45')]['fn'](_0x4adf('0x46'),db[_0x4adf('0x45')]['fn']('IF',db[_0x4adf('0x45')][_0x4adf('0x47')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x4adf('0x45')]['fn'](_0x4adf('0x46'),db['sequelize']['fn']('IF',db[_0x4adf('0x45')]['literal'](_0x4adf('0x4b')))),_0x4adf('0x4c')],[db['sequelize']['fn'](_0x4adf('0x46'),db[_0x4adf('0x45')]['fn']('IF',db[_0x4adf('0x45')]['literal'](_0x4adf('0x4d')))),'congestionContacts'],[db[_0x4adf('0x45')]['fn'](_0x4adf('0x46'),db[_0x4adf('0x45')]['fn']('IF',db[_0x4adf('0x45')][_0x4adf('0x47')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4adf('0x53')],[db['sequelize']['fn'](_0x4adf('0x46'),db[_0x4adf('0x45')]['fn']('IF',db[_0x4adf('0x45')][_0x4adf('0x47')](_0x4adf('0x4e')))),_0x4adf('0x54')],[db[_0x4adf('0x45')]['fn'](_0x4adf('0x46'),db[_0x4adf('0x45')]['fn']('IF',db[_0x4adf('0x45')][_0x4adf('0x47')](_0x4adf('0x4f')))),_0x4adf('0x50')],[db[_0x4adf('0x45')]['fn'](_0x4adf('0x46'),db['sequelize']['fn']('IF',db[_0x4adf('0x45')][_0x4adf('0x47')]('`state`\x20=\x2019,\x201,\x20null'))),_0x4adf('0x55')]]})['then'](handleEntityNotFound(_0x530130,null))[_0x4adf('0x1b')](respondWithResult(_0x530130,null))[_0x4adf('0x3a')](handleError(_0x530130,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x522e75,_0x28d701,_0x677b69){return db[_0x4adf('0x56')][_0x4adf('0x40')]({'where':{'id':_0x522e75[_0x4adf('0x3c')]['id']}})[_0x4adf('0x1b')](handleEntityNotFound(_0x28d701,null))[_0x4adf('0x1b')](function(_0x1a7ffa){var _0x3802e4;if(_0x1a7ffa){_0x3802e4=squel[_0x4adf('0x57')]()['into']('cm_hopper')['fromQuery']([_0x4adf('0x58'),_0x4adf('0x59'),_0x4adf('0x5a'),_0x4adf('0x5b'),'VoiceQueueId','createdAt',_0x4adf('0x5c')],squel['select']()[_0x4adf('0x5d')](_0x4adf('0x5e'),_0x4adf('0x58'))['field'](_0x4adf('0x5f'),'scheduledAt')[_0x4adf('0x5d')](_0x4adf('0x60'),'ContactId')['field']('ANY_VALUE(ListId)',_0x4adf('0x5b'))['field'](_0x4adf('0x61'),_0x4adf('0x62'))[_0x4adf('0x5d')](_0x4adf('0x5f'),_0x4adf('0x63'))[_0x4adf('0x5d')](_0x4adf('0x5f'),_0x4adf('0x5c'))[_0x4adf('0x64')](_0x4adf('0x65'))[_0x4adf('0x32')]('VoiceQueueId\x20=\x20?',_0x522e75[_0x4adf('0x3c')]['id'][_0x4adf('0x66')]())[_0x4adf('0x32')]('state\x20=\x20?',_0x522e75[_0x4adf('0x42')][_0x4adf('0x67')][_0x4adf('0x66')]())['where'](_0x4adf('0x68'))['where'](_0x4adf('0x69'),squel[_0x4adf('0x6a')]()[_0x4adf('0x5d')](_0x4adf('0x58'))[_0x4adf('0x64')](_0x4adf('0x6b'))[_0x4adf('0x32')](_0x4adf('0x6c'),_0x522e75['params']['id']['toString']()))['where'](_0x4adf('0x69'),squel[_0x4adf('0x6a')]()['field'](_0x4adf('0x6d'))[_0x4adf('0x64')](_0x4adf('0x65'))[_0x4adf('0x32')](_0x4adf('0x6c'),_0x522e75['params']['id'][_0x4adf('0x66')]())[_0x4adf('0x32')]('state\x20=\x204'))[_0x4adf('0x6e')](_0x4adf('0x5a')))[_0x4adf('0x66')]();return db[_0x4adf('0x45')][_0x4adf('0x28')](_0x3802e4);}return[];})[_0x4adf('0x1b')](respondWithResult(_0x28d701,null))['catch'](handleError(_0x28d701,null));};exports[_0x4adf('0x6f')]=function(_0x316815,_0x286bbc,_0x40f26a){return db[_0x4adf('0x70')][_0x4adf('0x40')]({'where':{'id':_0x316815[_0x4adf('0x3c')]['id']}})[_0x4adf('0x1b')](handleEntityNotFound(_0x286bbc,null))[_0x4adf('0x1b')](function(_0x3fea66){var _0x597b1f;if(_0x3fea66){_0x597b1f=squel[_0x4adf('0x57')]()[_0x4adf('0x71')](_0x4adf('0x6b'))[_0x4adf('0x72')]([_0x4adf('0x58'),_0x4adf('0x59'),_0x4adf('0x5a'),'ListId','CampaignId',_0x4adf('0x63'),'updatedAt'],squel[_0x4adf('0x6a')]()[_0x4adf('0x5d')]('ANY_VALUE(calleridnum)','phone')[_0x4adf('0x5d')](_0x4adf('0x5f'),'scheduledAt')[_0x4adf('0x5d')](_0x4adf('0x60'),_0x4adf('0x5a'))[_0x4adf('0x5d')](_0x4adf('0x73'),_0x4adf('0x5b'))[_0x4adf('0x5d')](_0x4adf('0x74'),_0x4adf('0x75'))[_0x4adf('0x5d')]('NOW()',_0x4adf('0x63'))[_0x4adf('0x5d')](_0x4adf('0x5f'),_0x4adf('0x5c'))[_0x4adf('0x64')]('cm_hopper_final')[_0x4adf('0x32')](_0x4adf('0x76'),_0x316815['params']['id'][_0x4adf('0x66')]())['where'](_0x4adf('0x77'),_0x316815[_0x4adf('0x42')][_0x4adf('0x67')][_0x4adf('0x66')]())['where'](_0x4adf('0x68'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x4adf('0x6a')]()[_0x4adf('0x5d')](_0x4adf('0x58'))[_0x4adf('0x64')](_0x4adf('0x6b'))[_0x4adf('0x32')](_0x4adf('0x76'),_0x316815[_0x4adf('0x3c')]['id']['toString']()))[_0x4adf('0x32')](_0x4adf('0x69'),squel['select']()[_0x4adf('0x5d')](_0x4adf('0x6d'))[_0x4adf('0x64')](_0x4adf('0x65'))['where'](_0x4adf('0x76'),_0x316815['params']['id'][_0x4adf('0x66')]())[_0x4adf('0x32')]('state\x20=\x204'))['group'](_0x4adf('0x5a')))[_0x4adf('0x66')]();return db['sequelize'][_0x4adf('0x28')](_0x597b1f);}return[];})['then'](respondWithResult(_0x286bbc,null))[_0x4adf('0x3a')](handleError(_0x286bbc,null));};exports[_0x4adf('0x78')]=function(_0x1933e2,_0x224c6e,_0x245219){return db[_0x4adf('0x79')][_0x4adf('0x7a')]({'where':{'VoiceQueueId':_0x1933e2['body'][_0x4adf('0x62')],'CampaignId':_0x1933e2['body'][_0x4adf('0x75')],'ContactId':_0x1933e2[_0x4adf('0x42')][_0x4adf('0x5a')]}})['then'](handleEntityNotFound(_0x224c6e,null))[_0x4adf('0x1b')](function(_0x4554b5){if(_0x4554b5){return _0x4554b5;}return null;})['then'](respondWithResult(_0x224c6e,null))[_0x4adf('0x3a')](handleError(_0x224c6e,null));}; \ No newline at end of file +var _0xb1ad=['toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','group','moveContactsIvrCampaignHopperFinal','Campaign','cm_hopper','CampaignId','CampaignId\x20=\x20?','calleridnum','state\x20=\x204','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','error','stack','name','send','map','rawAttributes','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','CmHopperFinal','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','noAnswerContacts','literal','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','insert','into','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','phone','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state'];(function(_0x135c3e,_0x48d75a){var _0x36541c=function(_0x246bd3){while(--_0x246bd3){_0x135c3e['push'](_0x135c3e['shift']());}};_0x36541c(++_0x48d75a);}(_0xb1ad,0x184));var _0xdb1a=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xb1ad[_0xf50820];return _0x2a9b10;};'use strict';var pdf=require(_0xdb1a('0x0'));var emlformat=require(_0xdb1a('0x1'));var rimraf=require(_0xdb1a('0x2'));var zipdir=require(_0xdb1a('0x3'));var jsonpatch=require(_0xdb1a('0x4'));var rp=require(_0xdb1a('0x5'));var moment=require('moment');var BPromise=require(_0xdb1a('0x6'));var Mustache=require(_0xdb1a('0x7'));var util=require(_0xdb1a('0x8'));var path=require(_0xdb1a('0x9'));var sox=require(_0xdb1a('0xa'));var csv=require(_0xdb1a('0xb'));var ejs=require(_0xdb1a('0xc'));var fs=require('fs');var _=require(_0xdb1a('0xd'));var squel=require(_0xdb1a('0xe'));var crypto=require(_0xdb1a('0xf'));var jsforce=require(_0xdb1a('0x10'));var deskjs=require(_0xdb1a('0x11'));var toCsv=require(_0xdb1a('0xb'));var querystring=require(_0xdb1a('0x12'));var Papa=require(_0xdb1a('0x13'));var Redis=require('ioredis');var authService=require(_0xdb1a('0x14'));var qs=require(_0xdb1a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdb1a('0x16'));var utils=require(_0xdb1a('0x17'));var config=require(_0xdb1a('0x18'));var db=require(_0xdb1a('0x19'))['db'];function respondWithStatusCode(_0x3cae97,_0x31ccd3){_0x31ccd3=_0x31ccd3||0xcc;return function(_0x3ca28b){if(_0x3ca28b){return _0x3cae97[_0xdb1a('0x1a')](_0x31ccd3);}return _0x3cae97[_0xdb1a('0x1b')](_0x31ccd3)[_0xdb1a('0x1c')]();};}function respondWithResult(_0x40851a,_0x1d69dd){_0x1d69dd=_0x1d69dd||0xc8;return function(_0x857c00){if(_0x857c00){return _0x40851a['status'](_0x1d69dd)[_0xdb1a('0x1d')](_0x857c00);}};}function respondWithFilteredResult(_0x135faf,_0x112be1){return function(_0x4bdec7){if(_0x4bdec7){var _0x28dfe9=_0x4bdec7[_0xdb1a('0x1e')],_0x504d92=_0x112be1['offset'],_0x1c9d2b=_0x112be1[_0xdb1a('0x1f')]+_0x112be1[_0xdb1a('0x20')],_0x3419d5;if(_0x1c9d2b>=_0x28dfe9){_0x1c9d2b=_0x28dfe9;_0x3419d5=0xc8;}else{_0x3419d5=0xce;}_0x135faf[_0xdb1a('0x1b')](_0x3419d5);return _0x135faf['set'](_0xdb1a('0x21'),_0x504d92+'-'+_0x1c9d2b+'/'+_0x28dfe9)[_0xdb1a('0x1d')](_0x4bdec7);}return null;};}function patchUpdates(_0x192d45){return function(_0x15fc44){try{jsonpatch[_0xdb1a('0x22')](_0x15fc44,_0x192d45,!![]);}catch(_0x2882e2){return BPromise['reject'](_0x2882e2);}return _0x15fc44[_0xdb1a('0x23')]();};}function saveUpdates(_0x212f90,_0x386e32){return function(_0x37b776){if(_0x37b776){return _0x37b776[_0xdb1a('0x24')](_0x212f90)[_0xdb1a('0x25')](function(_0x1e6f9d){return _0x1e6f9d;});}return null;};}function removeEntity(_0x20521b,_0x3a9b3a){return function(_0xc92d26){if(_0xc92d26){return _0xc92d26['destroy']()[_0xdb1a('0x25')](function(){_0x20521b['status'](0xcc)[_0xdb1a('0x1c')]();});}};}function handleEntityNotFound(_0x2cc1aa,_0x3d07fc){return function(_0x5d3d24){if(!_0x5d3d24){_0x2cc1aa[_0xdb1a('0x1a')](0x194);}return _0x5d3d24;};}function handleError(_0x58ae1d,_0x3f4d11){_0x3f4d11=_0x3f4d11||0x1f4;return function(_0x37c95e){logger[_0xdb1a('0x26')](_0x37c95e[_0xdb1a('0x27')]);if(_0x37c95e[_0xdb1a('0x28')]){delete _0x37c95e[_0xdb1a('0x28')];}_0x58ae1d[_0xdb1a('0x1b')](_0x3f4d11)[_0xdb1a('0x29')](_0x37c95e);};}exports['index']=function(_0x50c1d7,_0x3a5493){var _0x2c8133={},_0x151af7={},_0x4341b1={'count':0x0,'rows':[]};var _0x29bdfc=_[_0xdb1a('0x2a')](db['CmHopperFinal'][_0xdb1a('0x2b')],function(_0x51f0ff){return{'name':_0x51f0ff['fieldName'],'type':_0x51f0ff[_0xdb1a('0x2c')]['key']};});_0x151af7['model']=_[_0xdb1a('0x2a')](_0x29bdfc,_0xdb1a('0x28'));_0x151af7[_0xdb1a('0x2d')]=_['keys'](_0x50c1d7[_0xdb1a('0x2d')]);_0x151af7[_0xdb1a('0x2e')]=_[_0xdb1a('0x2f')](_0x151af7[_0xdb1a('0x30')],_0x151af7['query']);_0x2c8133[_0xdb1a('0x31')]=_[_0xdb1a('0x2f')](_0x151af7[_0xdb1a('0x30')],qs['fields'](_0x50c1d7[_0xdb1a('0x2d')][_0xdb1a('0x32')]));_0x2c8133[_0xdb1a('0x31')]=_0x2c8133[_0xdb1a('0x31')]['length']?_0x2c8133['attributes']:_0x151af7['model'];if(!_0x50c1d7[_0xdb1a('0x2d')][_0xdb1a('0x33')]('nolimit')){_0x2c8133[_0xdb1a('0x20')]=qs[_0xdb1a('0x20')](_0x50c1d7[_0xdb1a('0x2d')][_0xdb1a('0x20')]);_0x2c8133[_0xdb1a('0x1f')]=qs['offset'](_0x50c1d7['query']['offset']);}_0x2c8133[_0xdb1a('0x34')]=qs['sort'](_0x50c1d7['query'][_0xdb1a('0x35')]);_0x2c8133[_0xdb1a('0x36')]=qs['filters'](_[_0xdb1a('0x37')](_0x50c1d7[_0xdb1a('0x2d')],_0x151af7[_0xdb1a('0x2e')]));if(_0x50c1d7[_0xdb1a('0x2d')][_0xdb1a('0x38')]){_0x2c8133['where']=_['merge'](_0x2c8133[_0xdb1a('0x36')],{'$or':_[_0xdb1a('0x2a')](_0x29bdfc,function(_0x8d7eeb){if(_0x8d7eeb[_0xdb1a('0x2c')]!==_0xdb1a('0x39')){var _0x132d6e={};_0x132d6e[_0x8d7eeb[_0xdb1a('0x28')]]={'$like':'%'+_0x50c1d7['query'][_0xdb1a('0x38')]+'%'};return _0x132d6e;}})});}_0x2c8133=_['merge']({},_0x2c8133,_0x50c1d7['options']);var _0x5d5f21={'where':_0x2c8133['where']};return db[_0xdb1a('0x3a')][_0xdb1a('0x1e')](_0x5d5f21)[_0xdb1a('0x25')](function(_0x3c3755){_0x4341b1[_0xdb1a('0x1e')]=_0x3c3755;if(_0x50c1d7[_0xdb1a('0x2d')][_0xdb1a('0x3b')]){_0x2c8133[_0xdb1a('0x3c')]=[{'all':!![]}];}return db[_0xdb1a('0x3a')][_0xdb1a('0x3d')](_0x2c8133);})[_0xdb1a('0x25')](function(_0x2bf8e1){_0x4341b1[_0xdb1a('0x3e')]=_0x2bf8e1;return _0x4341b1;})[_0xdb1a('0x25')](respondWithFilteredResult(_0x3a5493,_0x2c8133))[_0xdb1a('0x3f')](handleError(_0x3a5493,null));};exports[_0xdb1a('0x40')]=function(_0x4f42fd,_0x593e94){var _0x43e27a={'raw':!![],'where':{'id':_0x4f42fd[_0xdb1a('0x41')]['id']}},_0x4e1e04={};_0x4e1e04[_0xdb1a('0x30')]=_[_0xdb1a('0x42')](db[_0xdb1a('0x3a')][_0xdb1a('0x2b')]);_0x4e1e04[_0xdb1a('0x2d')]=_[_0xdb1a('0x42')](_0x4f42fd[_0xdb1a('0x2d')]);_0x4e1e04[_0xdb1a('0x2e')]=_[_0xdb1a('0x2f')](_0x4e1e04[_0xdb1a('0x30')],_0x4e1e04['query']);_0x43e27a[_0xdb1a('0x31')]=_[_0xdb1a('0x2f')](_0x4e1e04[_0xdb1a('0x30')],qs[_0xdb1a('0x32')](_0x4f42fd[_0xdb1a('0x2d')][_0xdb1a('0x32')]));_0x43e27a[_0xdb1a('0x31')]=_0x43e27a['attributes']['length']?_0x43e27a['attributes']:_0x4e1e04[_0xdb1a('0x30')];if(_0x4f42fd[_0xdb1a('0x2d')]['includeAll']){_0x43e27a[_0xdb1a('0x3c')]=[{'all':!![]}];}_0x43e27a=_[_0xdb1a('0x43')]({},_0x43e27a,_0x4f42fd['options']);return db['CmHopperFinal'][_0xdb1a('0x44')](_0x43e27a)[_0xdb1a('0x25')](handleEntityNotFound(_0x593e94,null))['then'](respondWithResult(_0x593e94,null))[_0xdb1a('0x3f')](handleError(_0x593e94,null));};exports[_0xdb1a('0x45')]=function(_0x1a36dd,_0x4af283){return db[_0xdb1a('0x3a')][_0xdb1a('0x45')]()[_0xdb1a('0x25')](respondWithResult(_0x4af283,null))[_0xdb1a('0x3f')](handleError(_0x4af283,null));};exports['update']=function(_0x37aa5e,_0x452aa8){if(_0x37aa5e[_0xdb1a('0x46')][_0xdb1a('0x47')]){delete _0x37aa5e['body'][_0xdb1a('0x47')];}return db[_0xdb1a('0x3a')][_0xdb1a('0x44')]({'where':{'uniqueid':_0x37aa5e[_0xdb1a('0x41')]['id']}})[_0xdb1a('0x25')](handleEntityNotFound(_0x452aa8,null))[_0xdb1a('0x25')](saveUpdates(_0x37aa5e[_0xdb1a('0x46')],null))[_0xdb1a('0x25')](respondWithResult(_0x452aa8,null))[_0xdb1a('0x3f')](handleError(_0x452aa8,null));};exports[_0xdb1a('0x48')]=function(_0x4f87f6,_0x548e74,_0x536f12){return db[_0xdb1a('0x3a')][_0xdb1a('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x4f87f6[_0xdb1a('0x41')]['id']},'attributes':[[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')]['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xdb1a('0x4b')],[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),_0xdb1a('0x4d')],[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x4e')))),_0xdb1a('0x4f')],[db[_0xdb1a('0x49')]['fn']('COUNT',db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xdb1a('0x50')],[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x51')))),'abandonedContacts'],[db[_0xdb1a('0x49')]['fn']('COUNT',db[_0xdb1a('0x49')]['fn']('IF',db['sequelize'][_0xdb1a('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),_0xdb1a('0x52')],[db['sequelize']['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x53')))),_0xdb1a('0x54')]]})[_0xdb1a('0x25')](handleEntityNotFound(_0x548e74,null))[_0xdb1a('0x25')](respondWithResult(_0x548e74,null))[_0xdb1a('0x3f')](handleError(_0x548e74,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x427292,_0x41ffbf,_0x1bdb0e){return db[_0xdb1a('0x3a')][_0xdb1a('0x3d')]({'raw':![],'where':{'CampaignId':_0x427292[_0xdb1a('0x41')]['id']},'attributes':[[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db['sequelize']['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x55')))),_0xdb1a('0x56')],[db['sequelize']['fn']('COUNT',db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')]('`state`\x20=\x203,\x201,\x20null'))),_0xdb1a('0x4b')],[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db['sequelize']['fn']('IF',db[_0xdb1a('0x49')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xdb1a('0x4d')],[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x4e')))),_0xdb1a('0x4f')],[db[_0xdb1a('0x49')]['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')]['literal'](_0xdb1a('0x57')))),'dropContacts'],[db[_0xdb1a('0x49')]['fn']('COUNT',db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x51')))),_0xdb1a('0x58')],[db['sequelize']['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x59')))),_0xdb1a('0x52')],[db['sequelize']['fn'](_0xdb1a('0x4a'),db[_0xdb1a('0x49')]['fn']('IF',db[_0xdb1a('0x49')][_0xdb1a('0x4c')](_0xdb1a('0x53')))),_0xdb1a('0x54')]]})[_0xdb1a('0x25')](handleEntityNotFound(_0x41ffbf,null))[_0xdb1a('0x25')](respondWithResult(_0x41ffbf,null))[_0xdb1a('0x3f')](handleError(_0x41ffbf,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x17c933,_0x2b555e,_0x2aa700){return db['VoiceQueue'][_0xdb1a('0x44')]({'where':{'id':_0x17c933['params']['id']}})[_0xdb1a('0x25')](handleEntityNotFound(_0x2b555e,null))['then'](function(_0x195192){var _0x322656;if(_0x195192){_0x322656=squel[_0xdb1a('0x5a')]()[_0xdb1a('0x5b')]('cm_hopper')[_0xdb1a('0x5c')](['phone',_0xdb1a('0x5d'),_0xdb1a('0x5e'),_0xdb1a('0x5f'),_0xdb1a('0x60'),_0xdb1a('0x61'),'updatedAt'],squel[_0xdb1a('0x62')]()[_0xdb1a('0x63')](_0xdb1a('0x64'),_0xdb1a('0x65'))[_0xdb1a('0x63')]('NOW()','scheduledAt')[_0xdb1a('0x63')](_0xdb1a('0x66'),_0xdb1a('0x5e'))[_0xdb1a('0x63')](_0xdb1a('0x67'),_0xdb1a('0x5f'))[_0xdb1a('0x63')](_0xdb1a('0x68'),_0xdb1a('0x60'))[_0xdb1a('0x63')](_0xdb1a('0x69'),_0xdb1a('0x61'))[_0xdb1a('0x63')](_0xdb1a('0x69'),_0xdb1a('0x6a'))[_0xdb1a('0x6b')](_0xdb1a('0x6c'))[_0xdb1a('0x36')](_0xdb1a('0x6d'),_0x17c933['params']['id']['toString']())[_0xdb1a('0x36')](_0xdb1a('0x6e'),_0x17c933[_0xdb1a('0x46')][_0xdb1a('0x6f')][_0xdb1a('0x70')]())[_0xdb1a('0x36')](_0xdb1a('0x71'))['where'](_0xdb1a('0x72'),squel[_0xdb1a('0x62')]()[_0xdb1a('0x63')](_0xdb1a('0x65'))['from']('cm_hopper')[_0xdb1a('0x36')]('VoiceQueueId\x20=\x20?',_0x17c933[_0xdb1a('0x41')]['id']['toString']()))[_0xdb1a('0x36')](_0xdb1a('0x72'),squel['select']()['field']('calleridnum')[_0xdb1a('0x6b')](_0xdb1a('0x6c'))['where']('VoiceQueueId\x20=\x20?',_0x17c933[_0xdb1a('0x41')]['id'][_0xdb1a('0x70')]())[_0xdb1a('0x36')]('state\x20=\x204'))[_0xdb1a('0x73')](_0xdb1a('0x5e')))['toString']();return db[_0xdb1a('0x49')]['query'](_0x322656);}return[];})[_0xdb1a('0x25')](respondWithResult(_0x2b555e,null))[_0xdb1a('0x3f')](handleError(_0x2b555e,null));};exports[_0xdb1a('0x74')]=function(_0x1121f0,_0x4a25cb,_0x5ed589){return db[_0xdb1a('0x75')][_0xdb1a('0x44')]({'where':{'id':_0x1121f0['params']['id']}})[_0xdb1a('0x25')](handleEntityNotFound(_0x4a25cb,null))[_0xdb1a('0x25')](function(_0x16b83f){var _0x3c36bf;if(_0x16b83f){_0x3c36bf=squel[_0xdb1a('0x5a')]()[_0xdb1a('0x5b')](_0xdb1a('0x76'))[_0xdb1a('0x5c')]([_0xdb1a('0x65'),_0xdb1a('0x5d'),_0xdb1a('0x5e'),_0xdb1a('0x5f'),_0xdb1a('0x77'),_0xdb1a('0x61'),_0xdb1a('0x6a')],squel['select']()[_0xdb1a('0x63')](_0xdb1a('0x64'),'phone')[_0xdb1a('0x63')](_0xdb1a('0x69'),'scheduledAt')['field'](_0xdb1a('0x66'),_0xdb1a('0x5e'))[_0xdb1a('0x63')](_0xdb1a('0x67'),_0xdb1a('0x5f'))['field']('ANY_VALUE(CampaignId)','CampaignId')['field']('NOW()','createdAt')[_0xdb1a('0x63')](_0xdb1a('0x69'),_0xdb1a('0x6a'))['from'](_0xdb1a('0x6c'))[_0xdb1a('0x36')]('CampaignId\x20=\x20?',_0x1121f0[_0xdb1a('0x41')]['id']['toString']())[_0xdb1a('0x36')]('state\x20=\x20?',_0x1121f0[_0xdb1a('0x46')][_0xdb1a('0x6f')][_0xdb1a('0x70')]())[_0xdb1a('0x36')](_0xdb1a('0x71'))[_0xdb1a('0x36')](_0xdb1a('0x72'),squel[_0xdb1a('0x62')]()[_0xdb1a('0x63')](_0xdb1a('0x65'))[_0xdb1a('0x6b')]('cm_hopper')[_0xdb1a('0x36')](_0xdb1a('0x78'),_0x1121f0[_0xdb1a('0x41')]['id'][_0xdb1a('0x70')]()))[_0xdb1a('0x36')](_0xdb1a('0x72'),squel['select']()[_0xdb1a('0x63')](_0xdb1a('0x79'))[_0xdb1a('0x6b')](_0xdb1a('0x6c'))[_0xdb1a('0x36')](_0xdb1a('0x78'),_0x1121f0['params']['id'][_0xdb1a('0x70')]())[_0xdb1a('0x36')](_0xdb1a('0x7a')))[_0xdb1a('0x73')](_0xdb1a('0x5e')))['toString']();return db[_0xdb1a('0x49')]['query'](_0x3c36bf);}return[];})[_0xdb1a('0x25')](respondWithResult(_0x4a25cb,null))[_0xdb1a('0x3f')](handleError(_0x4a25cb,null));};exports['checkContactHopper']=function(_0x272422,_0x2891af,_0x4e3bdf){return db[_0xdb1a('0x7b')][_0xdb1a('0x7c')]({'where':{'VoiceQueueId':_0x272422['body']['VoiceQueueId'],'CampaignId':_0x272422[_0xdb1a('0x46')][_0xdb1a('0x77')],'ContactId':_0x272422['body'][_0xdb1a('0x5e')]}})['then'](handleEntityNotFound(_0x2891af,null))[_0xdb1a('0x25')](function(_0x2fb85c){if(_0x2fb85c){return _0x2fb85c;}return null;})[_0xdb1a('0x25')](respondWithResult(_0x2891af,null))[_0xdb1a('0x3f')](handleError(_0x2891af,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index e24cc4f..8b15ad3 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 _0x0c95=['../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3c4513,_0x14f374){var _0x4cc2dd=function(_0x7d4f46){while(--_0x7d4f46){_0x3c4513['push'](_0x3c4513['shift']());}};_0x4cc2dd(++_0x14f374);}(_0x0c95,0x19c));var _0x50c9=function(_0x3c2c62,_0x2033c2){_0x3c2c62=_0x3c2c62-0x0;var _0x58bcb8=_0x0c95[_0x3c2c62];return _0x58bcb8;};'use strict';var _=require(_0x50c9('0x0'));var util=require(_0x50c9('0x1'));var logger=require(_0x50c9('0x2'))(_0x50c9('0x3'));var moment=require(_0x50c9('0x4'));var BPromise=require(_0x50c9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50c9('0x6'));var rimraf=require(_0x50c9('0x7'));var config=require(_0x50c9('0x8'));var attributes=require(_0x50c9('0x9'));module['exports']=function(_0x377077,_0x8171a0){return _0x377077[_0x50c9('0xa')](_0x50c9('0xb'),attributes,{'tableName':_0x50c9('0xc'),'paranoid':![],'indexes':[{'name':_0x50c9('0xd'),'fields':[_0x50c9('0xd')]},{'name':_0x50c9('0xe'),'fields':[_0x50c9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2898=['./cmHopperFinal.attributes','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x1034ca,_0x14ecd6){var _0x1a023a=function(_0x2cfa65){while(--_0x2cfa65){_0x1034ca['push'](_0x1034ca['shift']());}};_0x1a023a(++_0x14ecd6);}(_0x2898,0x1f1));var _0x8289=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0x2898[_0x334651];return _0x29657c;};'use strict';var _=require(_0x8289('0x0'));var util=require(_0x8289('0x1'));var logger=require(_0x8289('0x2'))(_0x8289('0x3'));var moment=require(_0x8289('0x4'));var BPromise=require(_0x8289('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8289('0x6'));var config=require('../../config/environment');var attributes=require(_0x8289('0x7'));module['exports']=function(_0x1b2f72,_0x1223da){return _0x1b2f72['define'](_0x8289('0x8'),attributes,{'tableName':_0x8289('0x9'),'paranoid':![],'indexes':[{'name':_0x8289('0xa'),'fields':[_0x8289('0xa')]},{'name':_0x8289('0xb'),'fields':[_0x8289('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index abe5c83..59f28bd 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 _0x3ffb=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateCmHopperFinal','CmHopperFinal','body','options','raw'];(function(_0x2736b6,_0x32b9a9){var _0x193c59=function(_0x1efd73){while(--_0x1efd73){_0x2736b6['push'](_0x2736b6['shift']());}};_0x193c59(++_0x32b9a9);}(_0x3ffb,0x13f));var _0xb3ff=function(_0x3f3cda,_0x22247a){_0x3f3cda=_0x3f3cda-0x0;var _0x19c58a=_0x3ffb[_0x3f3cda];return _0x19c58a;};'use strict';var _=require(_0xb3ff('0x0'));var util=require(_0xb3ff('0x1'));var moment=require(_0xb3ff('0x2'));var BPromise=require(_0xb3ff('0x3'));var rs=require(_0xb3ff('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3ff('0x5'))['db'];var utils=require(_0xb3ff('0x6'));var logger=require(_0xb3ff('0x7'))(_0xb3ff('0x8'));var config=require(_0xb3ff('0x9'));var jayson=require(_0xb3ff('0xa'));var client=jayson[_0xb3ff('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301d72,_0x99d772,_0x3a6e33){return new BPromise(function(_0x4fecf1,_0x4e3533){return client['request'](_0x301d72,_0x3a6e33)[_0xb3ff('0xc')](function(_0x36c3af){logger[_0xb3ff('0xd')](_0xb3ff('0xe'),_0x99d772,'request\x20sent');logger[_0xb3ff('0xf')](_0xb3ff('0x10'),_0x99d772,'request\x20sent',JSON[_0xb3ff('0x11')](_0x36c3af));if(_0x36c3af[_0xb3ff('0x12')]){if(_0x36c3af[_0xb3ff('0x12')][_0xb3ff('0x13')]===0x1f4){logger[_0xb3ff('0x12')](_0xb3ff('0xe'),_0x99d772,_0x36c3af[_0xb3ff('0x12')][_0xb3ff('0x14')]);return _0x4e3533(_0x36c3af['error'][_0xb3ff('0x14')]);}logger[_0xb3ff('0x12')](_0xb3ff('0xe'),_0x99d772,_0x36c3af[_0xb3ff('0x12')][_0xb3ff('0x14')]);return _0x4fecf1(_0x36c3af[_0xb3ff('0x12')]['message']);}else{logger[_0xb3ff('0xd')]('CmHopperFinal,\x20%s,\x20%s',_0x99d772,_0xb3ff('0x15'));_0x4fecf1(_0x36c3af[_0xb3ff('0x16')]['message']);}})[_0xb3ff('0x17')](function(_0x3713f7){logger[_0xb3ff('0x12')](_0xb3ff('0xe'),_0x99d772,_0x3713f7);_0x4e3533(_0x3713f7);});});}exports[_0xb3ff('0x18')]=function(_0x8c5f6f){var _0x3e85c7=this;return new Promise(function(_0x2fe7ca,_0x5d908f){return db[_0xb3ff('0x19')]['create'](_0x8c5f6f[_0xb3ff('0x1a')],{'raw':_0x8c5f6f['options']?_0x8c5f6f[_0xb3ff('0x1b')][_0xb3ff('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x259c9e){logger[_0xb3ff('0xd')]('CreateCmHopperFinal',_0x8c5f6f);logger[_0xb3ff('0xf')](_0xb3ff('0x18'),_0x8c5f6f,JSON[_0xb3ff('0x11')](_0x259c9e));_0x2fe7ca(_0x259c9e);})['catch'](function(_0xa30fcd){logger[_0xb3ff('0x12')]('CreateCmHopperFinal',_0xa30fcd['message'],_0x8c5f6f);_0x5d908f(_0x3e85c7[_0xb3ff('0x12')](0x1f4,_0xa30fcd[_0xb3ff('0x14')]));});});}; \ No newline at end of file +var _0xa067=['stringify','error','code','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x4bfe08,_0x48ae7b){var _0x1f9125=function(_0x11450e){while(--_0x11450e){_0x4bfe08['push'](_0x4bfe08['shift']());}};_0x1f9125(++_0x48ae7b);}(_0xa067,0x168));var _0x7a06=function(_0x3c69e0,_0x22dae7){_0x3c69e0=_0x3c69e0-0x0;var _0x1e3eaf=_0xa067[_0x3c69e0];return _0x1e3eaf;};'use strict';var _=require('lodash');var util=require(_0x7a06('0x0'));var moment=require(_0x7a06('0x1'));var BPromise=require('bluebird');var rs=require(_0x7a06('0x2'));var fs=require('fs');var Redis=require(_0x7a06('0x3'));var db=require(_0x7a06('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a06('0x5'))(_0x7a06('0x6'));var config=require(_0x7a06('0x7'));var jayson=require(_0x7a06('0x8'));var client=jayson[_0x7a06('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xddd9d,_0x334014,_0x17b514){return new BPromise(function(_0x1e3fa6,_0x4be9d3){return client['request'](_0xddd9d,_0x17b514)[_0x7a06('0xa')](function(_0x7da429){logger[_0x7a06('0xb')](_0x7a06('0xc'),_0x334014,'request\x20sent');logger['debug'](_0x7a06('0xd'),_0x334014,_0x7a06('0xe'),JSON[_0x7a06('0xf')](_0x7da429));if(_0x7da429[_0x7a06('0x10')]){if(_0x7da429['error'][_0x7a06('0x11')]===0x1f4){logger[_0x7a06('0x10')](_0x7a06('0xc'),_0x334014,_0x7da429['error'][_0x7a06('0x12')]);return _0x4be9d3(_0x7da429['error']['message']);}logger[_0x7a06('0x10')](_0x7a06('0xc'),_0x334014,_0x7da429[_0x7a06('0x10')]['message']);return _0x1e3fa6(_0x7da429[_0x7a06('0x10')][_0x7a06('0x12')]);}else{logger[_0x7a06('0xb')](_0x7a06('0xc'),_0x334014,_0x7a06('0xe'));_0x1e3fa6(_0x7da429[_0x7a06('0x13')][_0x7a06('0x12')]);}})['catch'](function(_0xf494b9){logger[_0x7a06('0x10')](_0x7a06('0xc'),_0x334014,_0xf494b9);_0x4be9d3(_0xf494b9);});});}exports[_0x7a06('0x14')]=function(_0x134881){var _0xfade6c=this;return new Promise(function(_0x1990c7,_0x202402){return db[_0x7a06('0x15')][_0x7a06('0x16')](_0x134881['body'],{'raw':_0x134881[_0x7a06('0x17')]?_0x134881[_0x7a06('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7a06('0xa')](function(_0x3d38ab){logger[_0x7a06('0xb')](_0x7a06('0x14'),_0x134881);logger['debug'](_0x7a06('0x14'),_0x134881,JSON[_0x7a06('0xf')](_0x3d38ab));_0x1990c7(_0x3d38ab);})[_0x7a06('0x18')](function(_0x11df90){logger[_0x7a06('0x10')](_0x7a06('0x14'),_0x11df90['message'],_0x134881);_0x202402(_0xfade6c['error'](0x1f4,_0x11df90[_0x7a06('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index cb9cff9..093696d 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 _0x134d=['./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','/:id','update','exports','util','connect-timeout','Router','../../config/environment'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0x134d,0xcb));var _0xd134=function(_0x32910a,_0x41a8e9){_0x32910a=_0x32910a-0x0;var _0x3d61bc=_0x134d[_0x32910a];return _0x3d61bc;};'use strict';var multer=require('multer');var util=require(_0xd134('0x0'));var path=require('path');var timeout=require(_0xd134('0x1'));var express=require('express');var router=express[_0xd134('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd134('0x3'));var controller=require(_0xd134('0x4'));router['get']('/',auth[_0xd134('0x5')](),controller[_0xd134('0x6')]);router[_0xd134('0x7')](_0xd134('0x8'),auth[_0xd134('0x5')](),controller[_0xd134('0x9')]);router[_0xd134('0x7')]('/:id',auth[_0xd134('0x5')](),controller[_0xd134('0xa')]);router[_0xd134('0x7')](_0xd134('0xb'),auth[_0xd134('0x5')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xd134('0x7')](_0xd134('0xc'),auth[_0xd134('0x5')](),controller[_0xd134('0xd')]);router['post'](_0xd134('0xe'),auth[_0xd134('0x5')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xd134('0xf')](_0xd134('0x10'),auth[_0xd134('0x5')](),controller[_0xd134('0x11')]);router[_0xd134('0xf')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0xd134('0x12')]);router[_0xd134('0x13')](_0xd134('0x14'),auth['isAuthenticated'](),controller[_0xd134('0x15')]);module[_0xd134('0x16')]=router; \ No newline at end of file +var _0x6fab=['moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6fab,0x158));var _0xb6fa=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x6fab[_0x466af7];return _0x348c96;};'use strict';var multer=require(_0xb6fa('0x0'));var util=require(_0xb6fa('0x1'));var path=require(_0xb6fa('0x2'));var timeout=require(_0xb6fa('0x3'));var express=require(_0xb6fa('0x4'));var router=express[_0xb6fa('0x5')]();var auth=require(_0xb6fa('0x6'));var interaction=require(_0xb6fa('0x7'));var config=require(_0xb6fa('0x8'));var controller=require(_0xb6fa('0x9'));router[_0xb6fa('0xa')]('/',auth[_0xb6fa('0xb')](),controller['index']);router[_0xb6fa('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xb6fa('0xc')]);router[_0xb6fa('0xa')]('/:id',auth[_0xb6fa('0xb')](),controller[_0xb6fa('0xd')]);router['get'](_0xb6fa('0xe'),auth[_0xb6fa('0xb')](),controller[_0xb6fa('0xf')]);router[_0xb6fa('0xa')]('/campaign/countAttributes/:id',auth[_0xb6fa('0xb')](),controller[_0xb6fa('0x10')]);router[_0xb6fa('0x11')](_0xb6fa('0x12'),auth[_0xb6fa('0xb')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xb6fa('0x11')](_0xb6fa('0x13'),auth[_0xb6fa('0xb')](),controller[_0xb6fa('0x14')]);router[_0xb6fa('0x11')](_0xb6fa('0x15'),auth[_0xb6fa('0xb')](),controller[_0xb6fa('0x16')]);router[_0xb6fa('0x17')](_0xb6fa('0x18'),auth[_0xb6fa('0xb')](),controller[_0xb6fa('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 5857d70..3391109 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 _0xbb64=['DATE','STRING','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x20e514,_0x1e6949){var _0x1a525d=function(_0x365224){while(--_0x365224){_0x20e514['push'](_0x20e514['shift']());}};_0x1a525d(++_0x1e6949);}(_0xbb64,0x105));var _0x4bb6=function(_0x2f711c,_0x45b6db){_0x2f711c=_0x2f711c-0x0;var _0x5aabe9=_0xbb64[_0x2f711c];return _0x5aabe9;};'use strict';var Sequelize=require(_0x4bb6('0x0'));module[_0x4bb6('0x1')]={'state':{'type':Sequelize[_0x4bb6('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x4bb6('0x3')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4bb6('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4bb6('0x4')]},'calleridname':{'type':Sequelize[_0x4bb6('0x4')]},'starttime':{'type':Sequelize[_0x4bb6('0x3')]},'responsetime':{'type':Sequelize[_0x4bb6('0x3')]},'answertime':{'type':Sequelize[_0x4bb6('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4bb6('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4bb6('0x4')]},'campaign':{'type':Sequelize[_0x4bb6('0x4')]},'campaigntype':{'type':Sequelize[_0x4bb6('0x4')]},'membername':{'type':Sequelize[_0x4bb6('0x4')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x4bb6('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x4bb6('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x4bb6('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4bb6('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x4bb6('0x3')]},'recallme':{'type':Sequelize[_0x4bb6('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4bb6('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x4bb6('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4bb6('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4bb6('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x48af=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x45cb39,_0x26b0a6){var _0x3e1ca1=function(_0x359613){while(--_0x359613){_0x45cb39['push'](_0x45cb39['shift']());}};_0x3e1ca1(++_0x26b0a6);}(_0x48af,0x1b0));var _0xf48a=function(_0x1be1f6,_0x5e7089){_0x1be1f6=_0x1be1f6-0x0;var _0x2bd577=_0x48af[_0x1be1f6];return _0x2bd577;};'use strict';var Sequelize=require(_0xf48a('0x0'));module[_0xf48a('0x1')]={'state':{'type':Sequelize[_0xf48a('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf48a('0x3')]},'scheduledat':{'type':Sequelize[_0xf48a('0x4')]},'countbusyretry':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf48a('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xf48a('0x3')]},'calleridnum':{'type':Sequelize[_0xf48a('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xf48a('0x4')]},'responsetime':{'type':Sequelize[_0xf48a('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xf48a('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf48a('0x3')]},'campaign':{'type':Sequelize[_0xf48a('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf48a('0x3')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xf48a('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf48a('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf48a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf48a('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xf48a('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf48a('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index defde10..d9291cd 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 _0x0ac0=['length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','fields','options','create','body','describe','uniqueid','find','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/qs','../../config/license/hardware','../../config/utils','../../mysqldb','status','count','offset','limit','json','apply','update','then','sendStatus','error','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes'];(function(_0x222355,_0x3cdb49){var _0x412c7c=function(_0x234b83){while(--_0x234b83){_0x222355['push'](_0x222355['shift']());}};_0x412c7c(++_0x3cdb49);}(_0x0ac0,0x1c7));var _0x00ac=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0x0ac0[_0x2e3dfc];return _0x4b1245;};'use strict';var pdf=require(_0x00ac('0x0'));var emlformat=require(_0x00ac('0x1'));var rimraf=require(_0x00ac('0x2'));var zipdir=require(_0x00ac('0x3'));var jsonpatch=require(_0x00ac('0x4'));var rp=require(_0x00ac('0x5'));var moment=require(_0x00ac('0x6'));var BPromise=require(_0x00ac('0x7'));var Mustache=require(_0x00ac('0x8'));var util=require(_0x00ac('0x9'));var path=require(_0x00ac('0xa'));var sox=require(_0x00ac('0xb'));var csv=require(_0x00ac('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x00ac('0xd'));var squel=require(_0x00ac('0xe'));var crypto=require(_0x00ac('0xf'));var jsforce=require(_0x00ac('0x10'));var deskjs=require(_0x00ac('0x11'));var toCsv=require('to-csv');var querystring=require(_0x00ac('0x12'));var Papa=require(_0x00ac('0x13'));var Redis=require(_0x00ac('0x14'));var authService=require(_0x00ac('0x15'));var qs=require(_0x00ac('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x00ac('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x00ac('0x18'));var config=require('../../config/environment');var db=require(_0x00ac('0x19'))['db'];function respondWithStatusCode(_0x4b19fc,_0x43a8c2){_0x43a8c2=_0x43a8c2||0xcc;return function(_0x4e0b8b){if(_0x4e0b8b){return _0x4b19fc['sendStatus'](_0x43a8c2);}return _0x4b19fc[_0x00ac('0x1a')](_0x43a8c2)['end']();};}function respondWithResult(_0x47936e,_0x39a8c9){_0x39a8c9=_0x39a8c9||0xc8;return function(_0x47a3ef){if(_0x47a3ef){return _0x47936e[_0x00ac('0x1a')](_0x39a8c9)['json'](_0x47a3ef);}};}function respondWithFilteredResult(_0x2c28a4,_0x327fbb){return function(_0x57f807){if(_0x57f807){var _0x22e02b=_0x57f807[_0x00ac('0x1b')],_0x3e073d=_0x327fbb['offset'],_0x2de45e=_0x327fbb[_0x00ac('0x1c')]+_0x327fbb[_0x00ac('0x1d')],_0x32db3b;if(_0x2de45e>=_0x22e02b){_0x2de45e=_0x22e02b;_0x32db3b=0xc8;}else{_0x32db3b=0xce;}_0x2c28a4[_0x00ac('0x1a')](_0x32db3b);return _0x2c28a4['set']('Content-Range',_0x3e073d+'-'+_0x2de45e+'/'+_0x22e02b)[_0x00ac('0x1e')](_0x57f807);}return null;};}function patchUpdates(_0x580d84){return function(_0x98cb67){try{jsonpatch[_0x00ac('0x1f')](_0x98cb67,_0x580d84,!![]);}catch(_0x479a6d){return BPromise['reject'](_0x479a6d);}return _0x98cb67['save']();};}function saveUpdates(_0x57bba0,_0x44fd50){return function(_0x5909e3){if(_0x5909e3){return _0x5909e3[_0x00ac('0x20')](_0x57bba0)[_0x00ac('0x21')](function(_0x2333e0){return _0x2333e0;});}return null;};}function removeEntity(_0x34c5e4,_0x939c89){return function(_0xb6716a){if(_0xb6716a){return _0xb6716a['destroy']()[_0x00ac('0x21')](function(){_0x34c5e4[_0x00ac('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x561612,_0x437bc4){return function(_0x50b486){if(!_0x50b486){_0x561612[_0x00ac('0x22')](0x194);}return _0x50b486;};}function handleError(_0x22ca40,_0x1f4369){_0x1f4369=_0x1f4369||0x1f4;return function(_0xcf9f30){logger[_0x00ac('0x23')](_0xcf9f30['stack']);if(_0xcf9f30[_0x00ac('0x24')]){delete _0xcf9f30['name'];}_0x22ca40['status'](_0x1f4369)[_0x00ac('0x25')](_0xcf9f30);};}exports[_0x00ac('0x26')]=function(_0xcaef59,_0x78f48f){var _0x258418={},_0x58f07d={},_0x2ce2e8={'count':0x0,'rows':[]};var _0x38ba83=_['map'](db[_0x00ac('0x27')][_0x00ac('0x28')],function(_0x42885d){return{'name':_0x42885d[_0x00ac('0x29')],'type':_0x42885d[_0x00ac('0x2a')]['key']};});_0x58f07d[_0x00ac('0x2b')]=_[_0x00ac('0x2c')](_0x38ba83,_0x00ac('0x24'));_0x58f07d['query']=_['keys'](_0xcaef59[_0x00ac('0x2d')]);_0x58f07d[_0x00ac('0x2e')]=_[_0x00ac('0x2f')](_0x58f07d[_0x00ac('0x2b')],_0x58f07d[_0x00ac('0x2d')]);_0x258418[_0x00ac('0x30')]=_[_0x00ac('0x2f')](_0x58f07d['model'],qs['fields'](_0xcaef59['query']['fields']));_0x258418['attributes']=_0x258418[_0x00ac('0x30')][_0x00ac('0x31')]?_0x258418[_0x00ac('0x30')]:_0x58f07d[_0x00ac('0x2b')];if(!_0xcaef59[_0x00ac('0x2d')][_0x00ac('0x32')](_0x00ac('0x33'))){_0x258418['limit']=qs[_0x00ac('0x1d')](_0xcaef59[_0x00ac('0x2d')][_0x00ac('0x1d')]);_0x258418['offset']=qs[_0x00ac('0x1c')](_0xcaef59[_0x00ac('0x2d')][_0x00ac('0x1c')]);}_0x258418[_0x00ac('0x34')]=qs[_0x00ac('0x35')](_0xcaef59['query']['sort']);_0x258418[_0x00ac('0x36')]=qs[_0x00ac('0x2e')](_['pick'](_0xcaef59[_0x00ac('0x2d')],_0x58f07d[_0x00ac('0x2e')]));if(_0xcaef59[_0x00ac('0x2d')]['filter']){_0x258418['where']=_[_0x00ac('0x37')](_0x258418['where'],{'$or':_[_0x00ac('0x2c')](_0x38ba83,function(_0x1394ef){if(_0x1394ef[_0x00ac('0x2a')]!==_0x00ac('0x38')){var _0x12a22c={};_0x12a22c[_0x1394ef[_0x00ac('0x24')]]={'$like':'%'+_0xcaef59[_0x00ac('0x2d')]['filter']+'%'};return _0x12a22c;}})});}_0x258418=_[_0x00ac('0x37')]({},_0x258418,_0xcaef59['options']);var _0x216b25={'where':_0x258418[_0x00ac('0x36')]};return db[_0x00ac('0x27')]['count'](_0x216b25)[_0x00ac('0x21')](function(_0x4dbe49){_0x2ce2e8[_0x00ac('0x1b')]=_0x4dbe49;if(_0xcaef59['query'][_0x00ac('0x39')]){_0x258418[_0x00ac('0x3a')]=[{'all':!![]}];}return db[_0x00ac('0x27')][_0x00ac('0x3b')](_0x258418);})[_0x00ac('0x21')](function(_0x357fe0){_0x2ce2e8[_0x00ac('0x3c')]=_0x357fe0;return _0x2ce2e8;})[_0x00ac('0x21')](respondWithFilteredResult(_0x78f48f,_0x258418))[_0x00ac('0x3d')](handleError(_0x78f48f,null));};exports[_0x00ac('0x3e')]=function(_0x57811d,_0x3d7e1c){var _0x2851e7={'raw':!![],'where':{'id':_0x57811d[_0x00ac('0x3f')]['id']}},_0x2e076a={};_0x2e076a[_0x00ac('0x2b')]=_[_0x00ac('0x40')](db[_0x00ac('0x27')][_0x00ac('0x28')]);_0x2e076a[_0x00ac('0x2d')]=_[_0x00ac('0x40')](_0x57811d[_0x00ac('0x2d')]);_0x2e076a[_0x00ac('0x2e')]=_['intersection'](_0x2e076a[_0x00ac('0x2b')],_0x2e076a[_0x00ac('0x2d')]);_0x2851e7[_0x00ac('0x30')]=_['intersection'](_0x2e076a[_0x00ac('0x2b')],qs['fields'](_0x57811d[_0x00ac('0x2d')][_0x00ac('0x41')]));_0x2851e7['attributes']=_0x2851e7[_0x00ac('0x30')][_0x00ac('0x31')]?_0x2851e7[_0x00ac('0x30')]:_0x2e076a[_0x00ac('0x2b')];if(_0x57811d[_0x00ac('0x2d')]['includeAll']){_0x2851e7['include']=[{'all':!![]}];}_0x2851e7=_[_0x00ac('0x37')]({},_0x2851e7,_0x57811d[_0x00ac('0x42')]);return db['CmHopperHistory']['find'](_0x2851e7)['then'](handleEntityNotFound(_0x3d7e1c,null))[_0x00ac('0x21')](respondWithResult(_0x3d7e1c,null))[_0x00ac('0x3d')](handleError(_0x3d7e1c,null));};exports[_0x00ac('0x43')]=function(_0x477498,_0x4dd3f7){return db[_0x00ac('0x27')]['create'](_0x477498[_0x00ac('0x44')],{})[_0x00ac('0x21')](respondWithResult(_0x4dd3f7,0xc9))[_0x00ac('0x3d')](handleError(_0x4dd3f7,null));};exports['describe']=function(_0x529a03,_0x40f039){return db[_0x00ac('0x27')][_0x00ac('0x45')]()[_0x00ac('0x21')](respondWithResult(_0x40f039,null))[_0x00ac('0x3d')](handleError(_0x40f039,null));};exports[_0x00ac('0x20')]=function(_0x3837ad,_0x2b32ea){if(_0x3837ad[_0x00ac('0x44')][_0x00ac('0x46')]){delete _0x3837ad['body'][_0x00ac('0x46')];}return db['CmHopperHistory'][_0x00ac('0x47')]({'where':{'uniqueid':_0x3837ad['params']['id']}})['then'](handleEntityNotFound(_0x2b32ea,null))['then'](saveUpdates(_0x3837ad[_0x00ac('0x44')],null))['then'](respondWithResult(_0x2b32ea,null))[_0x00ac('0x3d')](handleError(_0x2b32ea,null));}; \ No newline at end of file +var _0x10c4=['key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','CmHopperHistory','includeAll','include','findAll','rows','show','intersection','length','find','create','body','describe','catch','update','uniqueid','params','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','save','destroy','then','sendStatus','error','stack','name','map','rawAttributes','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10c4,0x1e4));var _0x410c=function(_0x52a45c,_0x331b52){_0x52a45c=_0x52a45c-0x0;var _0x4ac4be=_0x10c4[_0x52a45c];return _0x4ac4be;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x410c('0x0'));var rimraf=require(_0x410c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x410c('0x2'));var rp=require('request-promise');var moment=require(_0x410c('0x3'));var BPromise=require(_0x410c('0x4'));var Mustache=require('mustache');var util=require(_0x410c('0x5'));var path=require(_0x410c('0x6'));var sox=require(_0x410c('0x7'));var csv=require(_0x410c('0x8'));var ejs=require(_0x410c('0x9'));var fs=require('fs');var _=require(_0x410c('0xa'));var squel=require('squel');var crypto=require(_0x410c('0xb'));var jsforce=require(_0x410c('0xc'));var deskjs=require(_0x410c('0xd'));var toCsv=require(_0x410c('0x8'));var querystring=require(_0x410c('0xe'));var Papa=require('papaparse');var Redis=require(_0x410c('0xf'));var authService=require(_0x410c('0x10'));var qs=require(_0x410c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x410c('0x12'))(_0x410c('0x13'));var utils=require(_0x410c('0x14'));var config=require(_0x410c('0x15'));var db=require(_0x410c('0x16'))['db'];function respondWithStatusCode(_0x2223e8,_0x52618f){_0x52618f=_0x52618f||0xcc;return function(_0x1e1990){if(_0x1e1990){return _0x2223e8['sendStatus'](_0x52618f);}return _0x2223e8[_0x410c('0x17')](_0x52618f)[_0x410c('0x18')]();};}function respondWithResult(_0x236b5a,_0x5a4c0b){_0x5a4c0b=_0x5a4c0b||0xc8;return function(_0x4ad998){if(_0x4ad998){return _0x236b5a[_0x410c('0x17')](_0x5a4c0b)[_0x410c('0x19')](_0x4ad998);}};}function respondWithFilteredResult(_0x89506d,_0x25c31b){return function(_0x451912){if(_0x451912){var _0x49af99=_0x451912[_0x410c('0x1a')],_0x52ac9e=_0x25c31b[_0x410c('0x1b')],_0x1f4e33=_0x25c31b[_0x410c('0x1b')]+_0x25c31b[_0x410c('0x1c')],_0x2fe3ce;if(_0x1f4e33>=_0x49af99){_0x1f4e33=_0x49af99;_0x2fe3ce=0xc8;}else{_0x2fe3ce=0xce;}_0x89506d['status'](_0x2fe3ce);return _0x89506d[_0x410c('0x1d')]('Content-Range',_0x52ac9e+'-'+_0x1f4e33+'/'+_0x49af99)['json'](_0x451912);}return null;};}function patchUpdates(_0xd3e2a6){return function(_0x23279f){try{jsonpatch[_0x410c('0x1e')](_0x23279f,_0xd3e2a6,!![]);}catch(_0x17f5c0){return BPromise['reject'](_0x17f5c0);}return _0x23279f[_0x410c('0x1f')]();};}function saveUpdates(_0x5e307a,_0x3c33c8){return function(_0x25f6bb){if(_0x25f6bb){return _0x25f6bb['update'](_0x5e307a)['then'](function(_0xff4cb){return _0xff4cb;});}return null;};}function removeEntity(_0x5f3ff4,_0x3e0d2a){return function(_0x381dac){if(_0x381dac){return _0x381dac[_0x410c('0x20')]()[_0x410c('0x21')](function(){_0x5f3ff4['status'](0xcc)[_0x410c('0x18')]();});}};}function handleEntityNotFound(_0x20d589,_0x1f1722){return function(_0x39cf37){if(!_0x39cf37){_0x20d589[_0x410c('0x22')](0x194);}return _0x39cf37;};}function handleError(_0x147db1,_0x4ddd75){_0x4ddd75=_0x4ddd75||0x1f4;return function(_0x3df292){logger[_0x410c('0x23')](_0x3df292[_0x410c('0x24')]);if(_0x3df292[_0x410c('0x25')]){delete _0x3df292[_0x410c('0x25')];}_0x147db1[_0x410c('0x17')](_0x4ddd75)['send'](_0x3df292);};}exports['index']=function(_0x424db1,_0x56667a){var _0x2200ca={},_0x3dccdc={},_0x58c1c7={'count':0x0,'rows':[]};var _0x1de135=_[_0x410c('0x26')](db['CmHopperHistory'][_0x410c('0x27')],function(_0xfa18ca){return{'name':_0xfa18ca[_0x410c('0x28')],'type':_0xfa18ca['type'][_0x410c('0x29')]};});_0x3dccdc[_0x410c('0x2a')]=_['map'](_0x1de135,_0x410c('0x25'));_0x3dccdc[_0x410c('0x2b')]=_[_0x410c('0x2c')](_0x424db1[_0x410c('0x2b')]);_0x3dccdc[_0x410c('0x2d')]=_['intersection'](_0x3dccdc[_0x410c('0x2a')],_0x3dccdc[_0x410c('0x2b')]);_0x2200ca[_0x410c('0x2e')]=_['intersection'](_0x3dccdc['model'],qs['fields'](_0x424db1[_0x410c('0x2b')][_0x410c('0x2f')]));_0x2200ca[_0x410c('0x2e')]=_0x2200ca[_0x410c('0x2e')]['length']?_0x2200ca['attributes']:_0x3dccdc[_0x410c('0x2a')];if(!_0x424db1[_0x410c('0x2b')][_0x410c('0x30')](_0x410c('0x31'))){_0x2200ca[_0x410c('0x1c')]=qs[_0x410c('0x1c')](_0x424db1[_0x410c('0x2b')]['limit']);_0x2200ca[_0x410c('0x1b')]=qs[_0x410c('0x1b')](_0x424db1['query'][_0x410c('0x1b')]);}_0x2200ca[_0x410c('0x32')]=qs['sort'](_0x424db1['query'][_0x410c('0x33')]);_0x2200ca[_0x410c('0x34')]=qs[_0x410c('0x2d')](_[_0x410c('0x35')](_0x424db1[_0x410c('0x2b')],_0x3dccdc[_0x410c('0x2d')]));if(_0x424db1[_0x410c('0x2b')]['filter']){_0x2200ca[_0x410c('0x34')]=_['merge'](_0x2200ca[_0x410c('0x34')],{'$or':_[_0x410c('0x26')](_0x1de135,function(_0x40f5cf){if(_0x40f5cf[_0x410c('0x36')]!==_0x410c('0x37')){var _0x1f31e1={};_0x1f31e1[_0x40f5cf[_0x410c('0x25')]]={'$like':'%'+_0x424db1['query'][_0x410c('0x38')]+'%'};return _0x1f31e1;}})});}_0x2200ca=_[_0x410c('0x39')]({},_0x2200ca,_0x424db1[_0x410c('0x3a')]);var _0x54499c={'where':_0x2200ca['where']};return db[_0x410c('0x3b')][_0x410c('0x1a')](_0x54499c)[_0x410c('0x21')](function(_0x55e698){_0x58c1c7['count']=_0x55e698;if(_0x424db1[_0x410c('0x2b')][_0x410c('0x3c')]){_0x2200ca[_0x410c('0x3d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x410c('0x3e')](_0x2200ca);})[_0x410c('0x21')](function(_0xb79aa4){_0x58c1c7[_0x410c('0x3f')]=_0xb79aa4;return _0x58c1c7;})[_0x410c('0x21')](respondWithFilteredResult(_0x56667a,_0x2200ca))['catch'](handleError(_0x56667a,null));};exports[_0x410c('0x40')]=function(_0x38bc58,_0x2b9769){var _0x3a88e3={'raw':!![],'where':{'id':_0x38bc58['params']['id']}},_0x21f90d={};_0x21f90d['model']=_[_0x410c('0x2c')](db[_0x410c('0x3b')][_0x410c('0x27')]);_0x21f90d['query']=_[_0x410c('0x2c')](_0x38bc58[_0x410c('0x2b')]);_0x21f90d[_0x410c('0x2d')]=_['intersection'](_0x21f90d[_0x410c('0x2a')],_0x21f90d[_0x410c('0x2b')]);_0x3a88e3['attributes']=_[_0x410c('0x41')](_0x21f90d[_0x410c('0x2a')],qs[_0x410c('0x2f')](_0x38bc58[_0x410c('0x2b')][_0x410c('0x2f')]));_0x3a88e3['attributes']=_0x3a88e3[_0x410c('0x2e')][_0x410c('0x42')]?_0x3a88e3['attributes']:_0x21f90d[_0x410c('0x2a')];if(_0x38bc58['query'][_0x410c('0x3c')]){_0x3a88e3[_0x410c('0x3d')]=[{'all':!![]}];}_0x3a88e3=_[_0x410c('0x39')]({},_0x3a88e3,_0x38bc58['options']);return db['CmHopperHistory'][_0x410c('0x43')](_0x3a88e3)[_0x410c('0x21')](handleEntityNotFound(_0x2b9769,null))['then'](respondWithResult(_0x2b9769,null))['catch'](handleError(_0x2b9769,null));};exports[_0x410c('0x44')]=function(_0x4a15ec,_0x53e546){return db[_0x410c('0x3b')][_0x410c('0x44')](_0x4a15ec[_0x410c('0x45')],{})[_0x410c('0x21')](respondWithResult(_0x53e546,0xc9))['catch'](handleError(_0x53e546,null));};exports[_0x410c('0x46')]=function(_0x551061,_0x14a4f0){return db['CmHopperHistory']['describe']()['then'](respondWithResult(_0x14a4f0,null))[_0x410c('0x47')](handleError(_0x14a4f0,null));};exports[_0x410c('0x48')]=function(_0x1e01de,_0x35b837){if(_0x1e01de['body']['uniqueid']){delete _0x1e01de[_0x410c('0x45')][_0x410c('0x49')];}return db[_0x410c('0x3b')][_0x410c('0x43')]({'where':{'uniqueid':_0x1e01de[_0x410c('0x4a')]['id']}})[_0x410c('0x21')](handleEntityNotFound(_0x35b837,null))[_0x410c('0x21')](saveUpdates(_0x1e01de[_0x410c('0x45')],null))['then'](respondWithResult(_0x35b837,null))['catch'](handleError(_0x35b837,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 98062b2..950de20 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 _0xcaa0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','cm_hopper_history','uniqueid'];(function(_0x177e0e,_0x3c86a8){var _0x6b2089=function(_0x5e361b){while(--_0x5e361b){_0x177e0e['push'](_0x177e0e['shift']());}};_0x6b2089(++_0x3c86a8);}(_0xcaa0,0x168));var _0x0caa=function(_0x39ffd1,_0x299703){_0x39ffd1=_0x39ffd1-0x0;var _0x31267e=_0xcaa0[_0x39ffd1];return _0x31267e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0caa('0x0'))(_0x0caa('0x1'));var moment=require(_0x0caa('0x2'));var BPromise=require(_0x0caa('0x3'));var rp=require(_0x0caa('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0caa('0x5'));var config=require(_0x0caa('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x46aa77,_0x35b997){return _0x46aa77[_0x0caa('0x7')]('CmHopperHistory',attributes,{'tableName':_0x0caa('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x0caa('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fd7=['./cmHopperHistory.attributes','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x1e5c25,_0x374a3d){var _0x52b774=function(_0x463766){while(--_0x463766){_0x1e5c25['push'](_0x1e5c25['shift']());}};_0x52b774(++_0x374a3d);}(_0x5fd7,0x1b8));var _0x75fd=function(_0xb8609a,_0x1e33e2){_0xb8609a=_0xb8609a-0x0;var _0x32c16c=_0x5fd7[_0xb8609a];return _0x32c16c;};'use strict';var _=require(_0x75fd('0x0'));var util=require(_0x75fd('0x1'));var logger=require(_0x75fd('0x2'))(_0x75fd('0x3'));var moment=require('moment');var BPromise=require(_0x75fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75fd('0x5'));var rimraf=require(_0x75fd('0x6'));var config=require(_0x75fd('0x7'));var attributes=require(_0x75fd('0x8'));module['exports']=function(_0x585035,_0x536f49){return _0x585035[_0x75fd('0x9')](_0x75fd('0xa'),attributes,{'tableName':_0x75fd('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x75fd('0xc')]},{'name':_0x75fd('0xd'),'fields':[_0x75fd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index bea4c8d..d65a108 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 _0x757a=['AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','name','outboundNoSuchCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','campaign','ivrTotalCallsDays','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','where','sequelize','COUNT','col','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit'];(function(_0x59ce18,_0x2b6286){var _0x4c2c9c=function(_0x5b3386){while(--_0x5b3386){_0x59ce18['push'](_0x59ce18['shift']());}};_0x4c2c9c(++_0x2b6286);}(_0x757a,0xde));var _0xa757=function(_0x4eedc6,_0x2267c4){_0x4eedc6=_0x4eedc6-0x0;var _0x5e5b57=_0x757a[_0x4eedc6];return _0x5e5b57;};'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']('CmHopperHistory,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')](_0x4d9f58[_0xa757('0x18')],{'raw':_0x4d9f58[_0xa757('0x19')]?_0x4d9f58['options'][_0xa757('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x32c2a1){logger[_0xa757('0xb')](_0xa757('0x15'),_0x4d9f58);logger[_0xa757('0xe')]('CreateCmHopperHistory',_0x4d9f58,JSON['stringify'](_0x32c2a1));_0x151c04(_0x32c2a1);})[_0xa757('0x14')](function(_0x2159cf){logger[_0xa757('0x11')](_0xa757('0x15'),_0x2159cf[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305[_0xa757('0x11')](0x1f4,_0x2159cf[_0xa757('0x12')]));});});};exports[_0xa757('0x1b')]=function(_0x2bf276){var _0x59fae6=this;return new Promise(function(_0x3707c1,_0x59e9d4){return db[_0xa757('0x16')]['findAll']({'raw':_0x2bf276[_0xa757('0x19')]?_0x2bf276[_0xa757('0x19')][_0xa757('0x1a')]===undefined?!![]:![]:!![],'where':_0x2bf276['options']?_0x2bf276[_0xa757('0x19')][_0xa757('0x1c')]||null:null,'attributes':[[db[_0xa757('0x1d')]['fn'](_0xa757('0x1e'),db['sequelize'][_0xa757('0x1f')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa757('0x1d')]['literal'](_0xa757('0x20')))),_0xa757('0x21')],[db['sequelize']['fn'](_0xa757('0x1e'),db['sequelize']['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')]('`state`\x20=\x2010,\x201,\x20null'))),_0xa757('0x23')],[db['sequelize']['fn'](_0xa757('0x1e'),db[_0xa757('0x1d')]['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')](_0xa757('0x24')))),_0xa757('0x25')],[db[_0xa757('0x1d')]['fn'](_0xa757('0x26'),db[_0xa757('0x1d')]['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')](_0xa757('0x27')))),_0xa757('0x28')],[db[_0xa757('0x1d')]['fn'](_0xa757('0x26'),db[_0xa757('0x1d')]['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')](_0xa757('0x29')))),_0xa757('0x2a')]]})[_0xa757('0xa')](function(_0x170aa9){logger[_0xa757('0xb')](_0xa757('0x1b'),_0x2bf276);logger['debug'](_0xa757('0x1b'),_0x2bf276,JSON[_0xa757('0x10')](_0x170aa9));_0x3707c1(_0x170aa9);})[_0xa757('0x14')](function(_0x1794a9){logger[_0xa757('0x11')]('AvgHandleTime',_0x1794a9[_0xa757('0x12')],_0x2bf276);_0x59e9d4(_0x59fae6[_0xa757('0x11')](0x1f4,_0x1794a9[_0xa757('0x12')]));});});};exports[_0xa757('0x2b')]=function(_0xd54446){var _0xc97cb8=this;return new Promise(function(_0x499390,_0x1346c2){return db[_0xa757('0x16')][_0xa757('0x2c')]({'raw':_0xd54446[_0xa757('0x19')]?_0xd54446[_0xa757('0x19')][_0xa757('0x1a')]===undefined?!![]:![]:!![],'where':_0xd54446[_0xa757('0x19')]?_0xd54446[_0xa757('0x19')][_0xa757('0x1c')]||null:null,'attributes':[['campaign',_0xa757('0x2d')],[db[_0xa757('0x1d')]['fn'](_0xa757('0x1e'),db[_0xa757('0x1d')]['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')]('`state`\x20=\x200,\x201,\x20null'))),_0xa757('0x2e')],[db[_0xa757('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0xa757('0x1d')]['fn'](_0xa757('0x1e'),db[_0xa757('0x1d')]['fn']('IF',db['sequelize'][_0xa757('0x22')](_0xa757('0x20')))),_0xa757('0x2f')],[db[_0xa757('0x1d')]['fn'](_0xa757('0x1e'),db['sequelize']['fn']('IF',db[_0xa757('0x1d')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xa757('0x30')],[db[_0xa757('0x1d')]['fn'](_0xa757('0x1e'),db[_0xa757('0x1d')]['fn']('IF',db[_0xa757('0x1d')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xa757('0x31')],[db[_0xa757('0x1d')]['fn'](_0xa757('0x1e'),db[_0xa757('0x1d')]['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xa757('0x32')],[db[_0xa757('0x1d')]['fn']('COUNT',db[_0xa757('0x1d')]['fn']('IF',db['sequelize'][_0xa757('0x22')](_0xa757('0x33')))),'outboundDropCallsDayCallersExit'],[db[_0xa757('0x1d')]['fn'](_0xa757('0x1e'),db['sequelize']['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')](_0xa757('0x34')))),_0xa757('0x35')],[db['sequelize']['fn'](_0xa757('0x1e'),db[_0xa757('0x1d')]['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0xa757('0x36')],[db['sequelize']['fn']('COUNT',db[_0xa757('0x1d')]['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')]('`state`\x20=\x2014,\x201,\x20null'))),_0xa757('0x37')],[db['sequelize']['fn'](_0xa757('0x1e'),db[_0xa757('0x1d')]['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')](_0xa757('0x38')))),_0xa757('0x39')],[db[_0xa757('0x1d')]['fn'](_0xa757('0x1e'),db['sequelize']['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')](_0xa757('0x3a')))),_0xa757('0x3b')],[db[_0xa757('0x1d')]['fn'](_0xa757('0x1e'),db[_0xa757('0x1d')]['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')](_0xa757('0x3c')))),_0xa757('0x39')],[db[_0xa757('0x1d')]['fn'](_0xa757('0x1e'),db[_0xa757('0x1d')]['fn']('IF',db[_0xa757('0x1d')][_0xa757('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xa757('0x3d')]],'group':['campaign']})[_0xa757('0xa')](function(_0x311c25){logger[_0xa757('0xb')](_0xa757('0x2b'),_0xd54446);logger['debug'](_0xa757('0x2b'),_0xd54446,JSON[_0xa757('0x10')](_0x311c25));_0x499390(_0x311c25);})[_0xa757('0x14')](function(_0x980e1){logger['error'](_0xa757('0x2b'),_0x980e1[_0xa757('0x12')],_0xd54446);_0x1346c2(_0xc97cb8[_0xa757('0x11')](0x1f4,_0x980e1[_0xa757('0x12')]));});});};exports[_0xa757('0x3e')]=function(_0x291b26){var _0x55ad28=this;return new Promise(function(_0x485100,_0x5d21c1){return db['CmHopperHistory'][_0xa757('0x2c')]({'raw':_0x291b26[_0xa757('0x19')]?_0x291b26[_0xa757('0x19')][_0xa757('0x1a')]===undefined?!![]:![]:!![],'where':_0x291b26[_0xa757('0x19')]?_0x291b26[_0xa757('0x19')]['where']||null:null,'attributes':[[_0xa757('0x3f'),_0xa757('0x2d')],[db[_0xa757('0x1d')]['fn'](_0xa757('0x1e'),db['sequelize'][_0xa757('0x1f')]('id')),_0xa757('0x40')],[db['sequelize']['fn'](_0xa757('0x1e'),db['sequelize']['fn']('IF',db[_0xa757('0x1d')]['literal'](_0xa757('0x20')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0xa757('0xa')](function(_0x235c1e){logger[_0xa757('0xb')](_0xa757('0x3e'),_0x291b26);logger[_0xa757('0xe')](_0xa757('0x3e'),_0x291b26,JSON['stringify'](_0x235c1e));_0x485100(_0x235c1e);})['catch'](function(_0x201557){logger[_0xa757('0x11')](_0xa757('0x3e'),_0x201557['message'],_0x291b26);_0x5d21c1(_0x55ad28['error'](0x1f4,_0x201557[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0x0972=['sequelize','literal','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','catch','AvgHandleTime','findAll','where','COUNT','col','predictiveIntervalTotalCalls'];(function(_0xf9c824,_0x867745){var _0x1d08e7=function(_0x96ae15){while(--_0x96ae15){_0xf9c824['push'](_0xf9c824['shift']());}};_0x1d08e7(++_0x867745);}(_0x0972,0x64));var _0x2097=function(_0x445263,_0x112482){_0x445263=_0x445263-0x0;var _0x55a10d=_0x0972[_0x445263];return _0x55a10d;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4f21,_0x59739f,_0x332aac){return new BPromise(function(_0x1e661a,_0x11d263){return client[_0x2097('0xa')](_0x2b4f21,_0x332aac)[_0x2097('0xb')](function(_0x59d947){logger[_0x2097('0xc')](_0x2097('0xd'),_0x59739f,_0x2097('0xe'));logger[_0x2097('0xf')](_0x2097('0x10'),_0x59739f,_0x2097('0xe'),JSON[_0x2097('0x11')](_0x59d947));if(_0x59d947[_0x2097('0x12')]){if(_0x59d947[_0x2097('0x12')][_0x2097('0x13')]===0x1f4){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x11d263(_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);}logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x1e661a(_0x59d947['error'][_0x2097('0x14')]);}else{logger[_0x2097('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x59739f,'request\x20sent');_0x1e661a(_0x59d947['result'][_0x2097('0x14')]);}})['catch'](function(_0x28c35c){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x28c35c);_0x11d263(_0x28c35c);});});}exports[_0x2097('0x15')]=function(_0x44c584){var _0x53e2b4=this;return new Promise(function(_0x324652,_0x140094){return db[_0x2097('0x16')][_0x2097('0x17')](_0x44c584[_0x2097('0x18')],{'raw':_0x44c584[_0x2097('0x19')]?_0x44c584[_0x2097('0x19')][_0x2097('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4d957e){logger[_0x2097('0xc')]('CreateCmHopperHistory',_0x44c584);logger[_0x2097('0xf')](_0x2097('0x15'),_0x44c584,JSON['stringify'](_0x4d957e));_0x324652(_0x4d957e);})[_0x2097('0x1b')](function(_0x5b0582){logger[_0x2097('0x12')](_0x2097('0x15'),_0x5b0582[_0x2097('0x14')],_0x44c584);_0x140094(_0x53e2b4[_0x2097('0x12')](0x1f4,_0x5b0582[_0x2097('0x14')]));});});};exports[_0x2097('0x1c')]=function(_0x56390a){var _0xae5f9=this;return new Promise(function(_0x500234,_0x3f9279){return db[_0x2097('0x16')][_0x2097('0x1d')]({'raw':_0x56390a[_0x2097('0x19')]?_0x56390a['options'][_0x2097('0x1a')]===undefined?!![]:![]:!![],'where':_0x56390a[_0x2097('0x19')]?_0x56390a['options'][_0x2097('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x2097('0x1f'),db['sequelize'][_0x2097('0x20')]('id')),_0x2097('0x21')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x2097('0x24')],[db[_0x2097('0x22')]['fn']('COUNT',db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x2097('0x25')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')]('`state`\x20=\x2011,\x201,\x20null'))),_0x2097('0x26')],[db['sequelize']['fn'](_0x2097('0x27'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')](_0x2097('0x28')))),_0x2097('0x29')],[db[_0x2097('0x22')]['fn'](_0x2097('0x27'),db[_0x2097('0x22')]['fn']('IF',db['sequelize'][_0x2097('0x23')](_0x2097('0x2a')))),_0x2097('0x2b')]]})['then'](function(_0x3d97ee){logger[_0x2097('0xc')](_0x2097('0x1c'),_0x56390a);logger[_0x2097('0xf')]('AvgHandleTime',_0x56390a,JSON['stringify'](_0x3d97ee));_0x500234(_0x3d97ee);})['catch'](function(_0x3484ff){logger[_0x2097('0x12')](_0x2097('0x1c'),_0x3484ff[_0x2097('0x14')],_0x56390a);_0x3f9279(_0xae5f9[_0x2097('0x12')](0x1f4,_0x3484ff[_0x2097('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x379032){var _0xf65266=this;return new Promise(function(_0x2cf259,_0x164eba){return db[_0x2097('0x16')][_0x2097('0x1d')]({'raw':_0x379032['options']?_0x379032[_0x2097('0x19')][_0x2097('0x1a')]===undefined?!![]:![]:!![],'where':_0x379032[_0x2097('0x19')]?_0x379032['options']['where']||null:null,'attributes':[[_0x2097('0x2c'),_0x2097('0x2d')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')](_0x2097('0x2e')))),_0x2097('0x2f')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db['sequelize'][_0x2097('0x23')](_0x2097('0x30')))),_0x2097('0x31')],[db['sequelize']['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')](_0x2097('0x32')))),_0x2097('0x33')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db['sequelize']['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')](_0x2097('0x34')))),_0x2097('0x35')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')]['literal'](_0x2097('0x36')))),'outboundCongestionCallsDay'],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x2097('0x37')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')]['literal'](_0x2097('0x38')))),_0x2097('0x39')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')](_0x2097('0x3a')))),'outboundUnknownCallsDay'],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),'outboundBlacklistCallsDay'],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db['sequelize']['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db['sequelize'][_0x2097('0x23')](_0x2097('0x3b')))),'outboundRejectCallsDay'],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db['sequelize']['literal'](_0x2097('0x3c')))),_0x2097('0x3d')],[db['sequelize']['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db[_0x2097('0x22')][_0x2097('0x23')](_0x2097('0x3e')))),'outboundReCallsDay']],'group':[_0x2097('0x2c')]})[_0x2097('0xb')](function(_0x190859){logger['info'](_0x2097('0x3f'),_0x379032);logger[_0x2097('0xf')]('GetVoiceQueueHopperHistory',_0x379032,JSON[_0x2097('0x11')](_0x190859));_0x2cf259(_0x190859);})['catch'](function(_0x30b4cd){logger['error']('GetVoiceQueueHopperHistory',_0x30b4cd['message'],_0x379032);_0x164eba(_0xf65266[_0x2097('0x12')](0x1f4,_0x30b4cd['message']));});});};exports['GetCampaignHopperHistory']=function(_0x11e37f){var _0x52af14=this;return new Promise(function(_0x597322,_0x5465ea){return db['CmHopperHistory'][_0x2097('0x1d')]({'raw':_0x11e37f[_0x2097('0x19')]?_0x11e37f[_0x2097('0x19')][_0x2097('0x1a')]===undefined?!![]:![]:!![],'where':_0x11e37f[_0x2097('0x19')]?_0x11e37f['options'][_0x2097('0x1e')]||null:null,'attributes':[['campaign',_0x2097('0x2d')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db['sequelize'][_0x2097('0x20')]('id')),_0x2097('0x40')],[db[_0x2097('0x22')]['fn'](_0x2097('0x1f'),db[_0x2097('0x22')]['fn']('IF',db['sequelize']['literal'](_0x2097('0x32')))),_0x2097('0x41')]],'group':['campaign']})['then'](function(_0x4c5f0d){logger['info'](_0x2097('0x42'),_0x11e37f);logger['debug'](_0x2097('0x42'),_0x11e37f,JSON[_0x2097('0x11')](_0x4c5f0d));_0x597322(_0x4c5f0d);})['catch'](function(_0x13558a){logger[_0x2097('0x12')](_0x2097('0x42'),_0x13558a[_0x2097('0x14')],_0x11e37f);_0x5465ea(_0x52af14[_0x2097('0x12')](0x1f4,_0x13558a[_0x2097('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index ccd3bfe..c572c9a 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 _0x9303=['isAuthenticated','describe','/:id','show','create','update','exports','multer','connect-timeout','Router','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9303,0xd7));var _0x3930=function(_0x3ced9d,_0x18daa5){_0x3ced9d=_0x3ced9d-0x0;var _0xa06cbb=_0x9303[_0x3ced9d];return _0xa06cbb;};'use strict';var multer=require(_0x3930('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3930('0x1'));var express=require('express');var router=express[_0x3930('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3930('0x3'));var controller=require(_0x3930('0x4'));router[_0x3930('0x5')]('/',auth[_0x3930('0x6')](),controller['index']);router[_0x3930('0x5')]('/describe',auth['isAuthenticated'](),controller[_0x3930('0x7')]);router[_0x3930('0x5')](_0x3930('0x8'),auth[_0x3930('0x6')](),controller[_0x3930('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3930('0xa')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3930('0xb')]);module[_0x3930('0xc')]=router; \ No newline at end of file +var _0x0984=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','show','put','update','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0984,0xff));var _0x4098=function(_0x125145,_0x2154fd){_0x125145=_0x125145-0x0;var _0x5191ea=_0x0984[_0x125145];return _0x5191ea;};'use strict';var multer=require(_0x4098('0x0'));var util=require(_0x4098('0x1'));var path=require(_0x4098('0x2'));var timeout=require('connect-timeout');var express=require(_0x4098('0x3'));var router=express[_0x4098('0x4')]();var auth=require(_0x4098('0x5'));var interaction=require(_0x4098('0x6'));var config=require('../../config/environment');var controller=require(_0x4098('0x7'));router[_0x4098('0x8')]('/',auth[_0x4098('0x9')](),controller[_0x4098('0xa')]);router['get'](_0x4098('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4098('0xc'),auth[_0x4098('0x9')](),controller[_0x4098('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4098('0xe')](_0x4098('0xc'),auth['isAuthenticated'](),controller[_0x4098('0xf')]);module[_0x4098('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 18f6a4b..899469b 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 _0xa1d4=['STRING','name','sequelize','exports'];(function(_0x446737,_0x411246){var _0x575b95=function(_0x388fc6){while(--_0x388fc6){_0x446737['push'](_0x446737['shift']());}};_0x575b95(++_0x411246);}(_0xa1d4,0x1c6));var _0x4a1d=function(_0x2f0d03,_0xa45133){_0x2f0d03=_0x2f0d03-0x0;var _0x5ab783=_0xa1d4[_0x2f0d03];return _0x5ab783;};'use strict';var Sequelize=require(_0x4a1d('0x0'));module[_0x4a1d('0x1')]={'name':{'type':Sequelize[_0x4a1d('0x2')],'unique':_0x4a1d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4a1d('0x2')]},'dialPrefix':{'type':Sequelize[_0x4a1d('0x2')]}}; \ No newline at end of file +var _0x3ad4=['STRING','sequelize','name'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0x3ad4,0x100));var _0x43ad=function(_0x1dd8f6,_0x3ea487){_0x1dd8f6=_0x1dd8f6-0x0;var _0xf083b7=_0x3ad4[_0x1dd8f6];return _0xf083b7;};'use strict';var Sequelize=require(_0x43ad('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x43ad('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x43ad('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 13cd710..5b8a8a7 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 _0xe706=['cf_%s','getCustomFields','findAndCountAll','addAgents','omit','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','Lists','destroy','sendStatus','error','stack','name','send','index','CmList','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','findOne','order','includeAll','rows','removeDispositions','ids','addContacts','tags','isArray','each','CmContact','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','raw','getContactsCsv','cf_%d','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','addCustomField','sequelize','transaction','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts'];(function(_0x5b3e28,_0x2ad693){var _0x21a6f4=function(_0xea4216){while(--_0xea4216){_0x5b3e28['push'](_0x5b3e28['shift']());}};_0x21a6f4(++_0x2ad693);}(_0xe706,0xa3));var _0x6e70=function(_0x1e9dd1,_0x2e180a){_0x1e9dd1=_0x1e9dd1-0x0;var _0x1752dc=_0xe706[_0x1e9dd1];return _0x1752dc;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];config[_0x6e70('0x1c')]=_[_0x6e70('0x1d')](config[_0x6e70('0x1c')],{'host':_0x6e70('0x1e'),'port':0x18eb});var socket=require(_0x6e70('0x1f'))(new Redis(config[_0x6e70('0x1c')]));require('./cmList.socket')['register'](socket);function respondWithStatusCode(_0x48bc72,_0x257e81){_0x257e81=_0x257e81||0xcc;return function(_0x5a37a6){if(_0x5a37a6){return _0x48bc72['sendStatus'](_0x257e81);}return _0x48bc72[_0x6e70('0x20')](_0x257e81)[_0x6e70('0x21')]();};}function respondWithResult(_0x5d9263,_0x24f3ac){_0x24f3ac=_0x24f3ac||0xc8;return function(_0x5c3fe7){if(_0x5c3fe7){return _0x5d9263[_0x6e70('0x20')](_0x24f3ac)[_0x6e70('0x22')](_0x5c3fe7);}};}function respondWithFilteredResult(_0x4ca554,_0x49029f){return function(_0x3bd572){if(_0x3bd572){var _0x5ea7a5=_0x3bd572['count'],_0x28a21f=_0x49029f[_0x6e70('0x23')],_0x173afe=_0x49029f[_0x6e70('0x23')]+_0x49029f[_0x6e70('0x24')],_0x53acdc;if(_0x173afe>=_0x5ea7a5){_0x173afe=_0x5ea7a5;_0x53acdc=0xc8;}else{_0x53acdc=0xce;}_0x4ca554[_0x6e70('0x20')](_0x53acdc);return _0x4ca554[_0x6e70('0x25')](_0x6e70('0x26'),_0x28a21f+'-'+_0x173afe+'/'+_0x5ea7a5)[_0x6e70('0x22')](_0x3bd572);}return null;};}function patchUpdates(_0x44a49f){return function(_0x29326f){try{jsonpatch[_0x6e70('0x27')](_0x29326f,_0x44a49f,!![]);}catch(_0x4a0cfe){return BPromise[_0x6e70('0x28')](_0x4a0cfe);}return _0x29326f[_0x6e70('0x29')]();};}function saveUpdates(_0x27b294,_0x502b2d){return function(_0x3ccd87){if(_0x3ccd87){return _0x3ccd87[_0x6e70('0x2a')](_0x27b294)[_0x6e70('0x2b')](function(_0x50da2c){return _0x50da2c;});}return null;};}function removeEntity(_0x10fc91,_0x538b9c){return function(_0x50aec2){if(_0x50aec2){return _0x50aec2['destroy']()[_0x6e70('0x2b')](function(){var _0x19c5ae=_0x50aec2['get']({'plain':!![]});var _0x3ecdf1=_0x6e70('0x2c');return db['UserProfileResource'][_0x6e70('0x2d')]({'where':{'type':_0x3ecdf1,'resourceId':_0x19c5ae['id']}})[_0x6e70('0x2b')](function(){return _0x50aec2;});})[_0x6e70('0x2b')](function(){_0x10fc91['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c4d37,_0x3af17f){return function(_0x83c836){if(!_0x83c836){_0x2c4d37[_0x6e70('0x2e')](0x194);}return _0x83c836;};}function handleError(_0x43fee0,_0x5d772a){_0x5d772a=_0x5d772a||0x1f4;return function(_0x1952ea){logger[_0x6e70('0x2f')](_0x1952ea[_0x6e70('0x30')]);if(_0x1952ea[_0x6e70('0x31')]){delete _0x1952ea[_0x6e70('0x31')];}_0x43fee0[_0x6e70('0x20')](_0x5d772a)[_0x6e70('0x32')](_0x1952ea);};}exports[_0x6e70('0x33')]=function(_0x3a0821,_0x3a5d30){var _0x4b1229={},_0x1b27d8={},_0x50d60b={'count':0x0,'rows':[]};var _0x259486=_['map'](db[_0x6e70('0x34')][_0x6e70('0x35')],function(_0x30fa0b){return{'name':_0x30fa0b['fieldName'],'type':_0x30fa0b[_0x6e70('0x36')][_0x6e70('0x37')]};});_0x1b27d8['model']=_[_0x6e70('0x38')](_0x259486,_0x6e70('0x31'));_0x1b27d8['query']=_[_0x6e70('0x39')](_0x3a0821[_0x6e70('0x3a')]);_0x1b27d8[_0x6e70('0x3b')]=_[_0x6e70('0x3c')](_0x1b27d8[_0x6e70('0x3d')],_0x1b27d8[_0x6e70('0x3a')]);_0x4b1229[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x1b27d8[_0x6e70('0x3d')],qs[_0x6e70('0x3f')](_0x3a0821['query'][_0x6e70('0x3f')]));_0x4b1229['attributes']=_0x4b1229[_0x6e70('0x3e')][_0x6e70('0x40')]?_0x4b1229[_0x6e70('0x3e')]:_0x1b27d8[_0x6e70('0x3d')];if(!_0x3a0821[_0x6e70('0x3a')][_0x6e70('0x41')](_0x6e70('0x42'))){_0x4b1229[_0x6e70('0x24')]=qs[_0x6e70('0x24')](_0x3a0821[_0x6e70('0x3a')][_0x6e70('0x24')]);_0x4b1229[_0x6e70('0x23')]=qs[_0x6e70('0x23')](_0x3a0821['query']['offset']);}_0x4b1229['order']=qs[_0x6e70('0x43')](_0x3a0821[_0x6e70('0x3a')][_0x6e70('0x43')]);_0x4b1229[_0x6e70('0x44')]=qs[_0x6e70('0x3b')](_[_0x6e70('0x45')](_0x3a0821['query'],_0x1b27d8[_0x6e70('0x3b')]));if(_0x3a0821[_0x6e70('0x3a')][_0x6e70('0x46')]){_0x4b1229[_0x6e70('0x44')]=_[_0x6e70('0x47')](_0x4b1229[_0x6e70('0x44')],{'$or':_[_0x6e70('0x38')](_0x259486,function(_0x16fc7d){if(_0x16fc7d['type']!==_0x6e70('0x48')){var _0x23e893={};_0x23e893[_0x16fc7d[_0x6e70('0x31')]]={'$like':'%'+_0x3a0821[_0x6e70('0x3a')][_0x6e70('0x46')]+'%'};return _0x23e893;}})});}_0x4b1229=_[_0x6e70('0x47')]({},_0x4b1229,_0x3a0821[_0x6e70('0x49')]);var _0x4a8adc={'where':_0x4b1229['where']};return db['CmList'][_0x6e70('0x4a')](_0x4a8adc)[_0x6e70('0x2b')](function(_0x83847b){_0x50d60b[_0x6e70('0x4a')]=_0x83847b;if(_0x3a0821[_0x6e70('0x3a')]['includeAll']){_0x4b1229[_0x6e70('0x4b')]=[{'all':!![]}];}return db[_0x6e70('0x34')][_0x6e70('0x4c')](_0x4b1229);})['then'](function(_0x544ad0){_0x50d60b['rows']=_0x544ad0;return _0x50d60b;})[_0x6e70('0x2b')](respondWithFilteredResult(_0x3a5d30,_0x4b1229))['catch'](handleError(_0x3a5d30,null));};exports[_0x6e70('0x4d')]=function(_0x39913a,_0x3fed21){var _0x75a90d={'raw':![],'where':{'id':_0x39913a[_0x6e70('0x4e')]['id']}},_0x59c87d={};_0x59c87d['model']=_[_0x6e70('0x39')](db[_0x6e70('0x34')][_0x6e70('0x35')]);_0x59c87d[_0x6e70('0x3a')]=_['keys'](_0x39913a[_0x6e70('0x3a')]);_0x59c87d[_0x6e70('0x3b')]=_[_0x6e70('0x3c')](_0x59c87d[_0x6e70('0x3d')],_0x59c87d[_0x6e70('0x3a')]);_0x75a90d[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x59c87d['model'],qs[_0x6e70('0x3f')](_0x39913a[_0x6e70('0x3a')][_0x6e70('0x3f')]));_0x75a90d[_0x6e70('0x3e')]=_0x75a90d[_0x6e70('0x3e')][_0x6e70('0x40')]?_0x75a90d[_0x6e70('0x3e')]:_0x59c87d['model'];if(_0x39913a[_0x6e70('0x3a')]['includeAll']){_0x75a90d[_0x6e70('0x4b')]=[{'all':!![]}];}_0x75a90d=_[_0x6e70('0x47')]({},_0x75a90d,_0x39913a['options']);return db['CmList'][_0x6e70('0x4f')](_0x75a90d)[_0x6e70('0x2b')](handleEntityNotFound(_0x3fed21,null))[_0x6e70('0x2b')](respondWithResult(_0x3fed21,null))['catch'](handleError(_0x3fed21,null));};exports['create']=function(_0x238ebb,_0x11ac3d){return db[_0x6e70('0x34')][_0x6e70('0x50')](_0x238ebb[_0x6e70('0x51')],{})[_0x6e70('0x2b')](function(_0x4ad5a9){var _0x756a5b=_0x238ebb[_0x6e70('0x52')][_0x6e70('0x53')]({'plain':!![]});if(!_0x756a5b)throw new Error(_0x6e70('0x54'));if(_0x756a5b[_0x6e70('0x55')]==='user'){var _0x4ae901=_0x4ad5a9[_0x6e70('0x53')]({'plain':!![]});var _0x2e3ea6=_0x6e70('0x2c');return db[_0x6e70('0x56')][_0x6e70('0x4f')]({'where':{'name':_0x2e3ea6,'userProfileId':_0x756a5b['userProfileId']},'raw':!![]})[_0x6e70('0x2b')](function(_0x232366){if(_0x232366&&_0x232366[_0x6e70('0x57')]===0x0){return db[_0x6e70('0x58')][_0x6e70('0x50')]({'name':_0x4ae901['name'],'resourceId':_0x4ae901['id'],'type':_0x232366[_0x6e70('0x31')],'sectionId':_0x232366['id']},{})[_0x6e70('0x2b')](function(){return _0x4ad5a9;});}else{return _0x4ad5a9;}})[_0x6e70('0x59')](function(_0x3fb0d3){logger[_0x6e70('0x2f')](_0x6e70('0x5a'),_0x3fb0d3);throw _0x3fb0d3;});}return _0x4ad5a9;})['then'](respondWithResult(_0x11ac3d,0xc9))[_0x6e70('0x59')](handleError(_0x11ac3d,null));};exports[_0x6e70('0x2a')]=function(_0x5c2396,_0x382fde){if(_0x5c2396[_0x6e70('0x51')]['id']){delete _0x5c2396['body']['id'];}return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0x5c2396[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x382fde,null))[_0x6e70('0x2b')](saveUpdates(_0x5c2396['body'],null))[_0x6e70('0x2b')](respondWithResult(_0x382fde,null))[_0x6e70('0x59')](handleError(_0x382fde,null));};exports[_0x6e70('0x2d')]=function(_0x13be81,_0x1c02d7){return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0x13be81[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x1c02d7,null))[_0x6e70('0x2b')](removeEntity(_0x1c02d7,null))[_0x6e70('0x59')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x5b')]=function(_0xb8f78,_0x1fd9a6){return db[_0x6e70('0x34')][_0x6e70('0x5b')]()[_0x6e70('0x2b')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0x59')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x5c')]=function(_0x1c7dca,_0x4c6aab,_0x28898a){if(_0x1c7dca[_0x6e70('0x51')]['id']){delete _0x1c7dca[_0x6e70('0x51')]['id'];}return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0x1c7dca[_0x6e70('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4c6aab,null))[_0x6e70('0x2b')](function(_0x6cabf0){if(_0x6cabf0){_0x1c7dca['body'][_0x6e70('0x5d')]=_0x6cabf0['id'];return db[_0x6e70('0x5e')][_0x6e70('0x50')](_0x1c7dca['body']);}})['then'](respondWithResult(_0x4c6aab,null))[_0x6e70('0x59')](handleError(_0x4c6aab,null));};exports[_0x6e70('0x5f')]=function(_0x2d0203,_0x41a861,_0x10d299){var _0x739946={'raw':![],'where':{}};var _0x30cd88={};var _0x57bfe5={'count':0x0,'rows':[]};return db['CmList'][_0x6e70('0x60')]({'where':{'id':_0x2d0203[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x41a861,null))[_0x6e70('0x2b')](function(_0x5b1e6f){if(_0x5b1e6f){_0x30cd88['model']=_[_0x6e70('0x39')](db[_0x6e70('0x5e')]['rawAttributes']);_0x30cd88['query']=_[_0x6e70('0x39')](_0x2d0203['query']);_0x30cd88[_0x6e70('0x3b')]=_[_0x6e70('0x3c')](_0x30cd88[_0x6e70('0x3d')],_0x30cd88[_0x6e70('0x3a')]);_0x739946[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x30cd88[_0x6e70('0x3d')],qs[_0x6e70('0x3f')](_0x2d0203['query'][_0x6e70('0x3f')]));_0x739946[_0x6e70('0x3e')]=_0x739946[_0x6e70('0x3e')][_0x6e70('0x40')]?_0x739946[_0x6e70('0x3e')]:_0x30cd88['model'];if(!_0x2d0203['query']['hasOwnProperty'](_0x6e70('0x42'))){_0x739946[_0x6e70('0x24')]=qs[_0x6e70('0x24')](_0x2d0203['query']['limit']);_0x739946[_0x6e70('0x23')]=qs[_0x6e70('0x23')](_0x2d0203[_0x6e70('0x3a')][_0x6e70('0x23')]);}_0x739946[_0x6e70('0x61')]=qs[_0x6e70('0x43')](_0x2d0203['query'][_0x6e70('0x43')]);_0x739946[_0x6e70('0x44')]=qs[_0x6e70('0x3b')](_[_0x6e70('0x45')](_0x2d0203['query'],_0x30cd88[_0x6e70('0x3b')]));_0x739946['where']['ListId']=_0x5b1e6f['id'];if(_0x2d0203[_0x6e70('0x3a')][_0x6e70('0x46')]){_0x739946[_0x6e70('0x44')]=_[_0x6e70('0x47')](_0x739946[_0x6e70('0x44')],{'$or':_[_0x6e70('0x38')](_0x739946['attributes'],function(_0x370eeb){var _0x152003={};_0x152003[_0x370eeb]={'$like':'%'+_0x2d0203[_0x6e70('0x3a')][_0x6e70('0x46')]+'%'};return _0x152003;})});}_0x739946=_[_0x6e70('0x47')]({},_0x739946,_0x2d0203[_0x6e70('0x49')]);return db[_0x6e70('0x5e')][_0x6e70('0x4a')]({'where':_0x739946[_0x6e70('0x44')]})[_0x6e70('0x2b')](function(_0x575938){_0x57bfe5[_0x6e70('0x4a')]=_0x575938;if(_0x2d0203[_0x6e70('0x3a')][_0x6e70('0x62')]){_0x739946['include']=[{'all':!![]}];}return db['Disposition'][_0x6e70('0x4c')](_0x739946);})[_0x6e70('0x2b')](function(_0x25e685){_0x57bfe5[_0x6e70('0x63')]=_0x25e685;return _0x57bfe5;});}})[_0x6e70('0x2b')](respondWithFilteredResult(_0x41a861,_0x739946))['catch'](handleError(_0x41a861,null));};exports['removeDispositions']=function(_0xe0073f,_0x241a21,_0x56d4d9){return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0xe0073f[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x241a21,null))[_0x6e70('0x2b')](function(_0x44bf96){if(_0x44bf96){return _0x44bf96[_0x6e70('0x64')](_0xe0073f[_0x6e70('0x3a')][_0x6e70('0x65')]);}})[_0x6e70('0x2b')](respondWithStatusCode(_0x241a21,null))[_0x6e70('0x59')](handleError(_0x241a21,null));};exports[_0x6e70('0x66')]=function(_0x2eb58b,_0x2473e8,_0x511658){return db['CmList'][_0x6e70('0x4f')]({'where':{'id':_0x2eb58b['params']['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x2473e8,null))['then'](function(_0x5b5471){if(_0x5b5471){var _0x402f6f=[];var _0x48e04b={'success':[],'errors':[]};return db['CmContact'][_0x6e70('0x5b')]()[_0x6e70('0x2b')](function(_0x3d1b42){if(_0x2eb58b['body']['tags']&&_['isArray'](_0x2eb58b[_0x6e70('0x51')]['tags'])){if(_0x2eb58b[_0x6e70('0x51')][_0x6e70('0x67')][_0x6e70('0x40')]){_0x2eb58b[_0x6e70('0x51')][_0x6e70('0x67')]=_0x2eb58b[_0x6e70('0x51')][_0x6e70('0x67')]['join'](';')+';';}else{_0x2eb58b[_0x6e70('0x51')][_0x6e70('0x67')]=null;}}else{_0x2eb58b[_0x6e70('0x51')]['tags']=null;}if(_0x2eb58b[_0x6e70('0x51')]&&_[_0x6e70('0x68')](_0x2eb58b[_0x6e70('0x51')])){for(var _0x267576=0x0;_0x267576<_0x2eb58b[_0x6e70('0x51')][_0x6e70('0x40')];_0x267576+=0x1){_0x2eb58b[_0x6e70('0x51')][_0x267576][_0x6e70('0x5d')]=_0x2eb58b[_0x6e70('0x4e')]['id'];_0x402f6f['push'](_0x2eb58b[_0x6e70('0x51')][_0x267576]);}return BPromise[_0x6e70('0x69')](_0x402f6f,function(_0x53acc8){return db[_0x6e70('0x6a')][_0x6e70('0x50')](_['omit'](_0x53acc8,['ids','id'])||{},{'fields':_[_0x6e70('0x39')](_0x3d1b42),'raw':!![]})['then'](function(_0x154c8a){_0x48e04b['success'][_0x6e70('0x6b')](_0x154c8a[_0x6e70('0x6c')]);})[_0x6e70('0x59')](function(_0x40eec7){_0x48e04b[_0x6e70('0x6d')][_0x6e70('0x6b')]({'data':_0x53acc8,'error':_0x40eec7[_0x6e70('0x6e')]});});})['then'](function(_0x4d6a09){return _0x48e04b;})[_0x6e70('0x59')](function(_0x4bf451){return _0x4bf451;});}else{_0x2473e8[_0x6e70('0x20')](0x190)[_0x6e70('0x22')]({'message':_0x6e70('0x6f')});}});}})[_0x6e70('0x2b')](respondWithResult(_0x2473e8,null))['catch'](handleError(_0x2473e8,null));};exports[_0x6e70('0x70')]=function(_0x5c30ce,_0x260dfa,_0x18a1be){var _0x21cd21;return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0x5c30ce[_0x6e70('0x4e')]['id']},'include':[{'model':db[_0x6e70('0x71')],'as':'CustomFields'}]})[_0x6e70('0x2b')](handleEntityNotFound(_0x260dfa,null))['then'](function(_0x185599){if(_0x185599){_0x21cd21=_0x185599;return db['CmContact']['rawAttributes'];}})['then'](function(_0x1b4258){if(_0x1b4258){var _0x2179c9={};var _0x168209={};_0x168209[_0x6e70('0x3d')]=_[_0x6e70('0x72')](_['keys'](_0x1b4258),_[_0x6e70('0x38')](_0x21cd21[_0x6e70('0x73')],function(_0x48c30c){return util[_0x6e70('0x74')]('cf_%d',_0x48c30c['id']);}));_0x168209[_0x6e70('0x3a')]=_['keys'](_0x5c30ce['query']);_0x168209[_0x6e70('0x3b')]=_[_0x6e70('0x3c')](_0x168209[_0x6e70('0x3d')],_0x168209[_0x6e70('0x3a')]);_0x2179c9[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x168209[_0x6e70('0x3d')],qs['fields'](_0x5c30ce[_0x6e70('0x3a')]['fields']));_0x2179c9[_0x6e70('0x3e')]=_0x2179c9[_0x6e70('0x3e')][_0x6e70('0x40')]?_0x2179c9[_0x6e70('0x3e')]:_0x168209[_0x6e70('0x3d')];if(!_0x5c30ce[_0x6e70('0x3a')][_0x6e70('0x41')]('nolimit')){_0x2179c9[_0x6e70('0x24')]=qs['limit'](_0x5c30ce[_0x6e70('0x3a')][_0x6e70('0x24')]);_0x2179c9[_0x6e70('0x23')]=qs[_0x6e70('0x23')](_0x5c30ce[_0x6e70('0x3a')][_0x6e70('0x23')]);}_0x2179c9[_0x6e70('0x61')]=qs[_0x6e70('0x43')](_0x5c30ce[_0x6e70('0x3a')][_0x6e70('0x43')]);_0x2179c9['where']=qs[_0x6e70('0x3b')](_[_0x6e70('0x45')](_0x5c30ce[_0x6e70('0x3a')],_0x168209[_0x6e70('0x3b')]));_0x2179c9[_0x6e70('0x75')]=!![];if(_0x5c30ce['query']['filter']){_0x2179c9['where']=_[_0x6e70('0x47')](_0x2179c9[_0x6e70('0x44')],{'$or':_[_0x6e70('0x38')](_0x2179c9[_0x6e70('0x3e')],function(_0x3ef276){var _0x251111={};_0x251111[_0x3ef276]={'$like':'%'+_0x5c30ce[_0x6e70('0x3a')][_0x6e70('0x46')]+'%'};return _0x251111;})});}_0x2179c9=_[_0x6e70('0x47')]({},_0x2179c9,_0x5c30ce[_0x6e70('0x49')]);return _0x21cd21[_0x6e70('0x70')](_0x2179c9);}})[_0x6e70('0x2b')](respondWithResult(_0x260dfa,null))[_0x6e70('0x59')](handleError(_0x260dfa,null));};exports[_0x6e70('0x76')]=function(_0x3fcf78,_0x54abf9,_0x3a038a){var _0x223610;return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0x3fcf78[_0x6e70('0x4e')]['id']},'include':[{'model':db[_0x6e70('0x71')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x54abf9,null))[_0x6e70('0x2b')](function(_0x433c79){if(_0x433c79){_0x223610=_0x433c79;return db[_0x6e70('0x6a')][_0x6e70('0x35')];}})[_0x6e70('0x2b')](function(_0x213926){if(_0x213926){var _0x2ea4e9={};var _0x5f0cfb={};_0x5f0cfb[_0x6e70('0x3d')]=_['concat'](_[_0x6e70('0x39')](_0x213926),_[_0x6e70('0x38')](_0x223610[_0x6e70('0x73')],function(_0x3caa72){return util['format'](_0x6e70('0x77'),_0x3caa72['id']);}));_0x5f0cfb[_0x6e70('0x3a')]=_['keys'](_0x3fcf78[_0x6e70('0x3a')]);_0x5f0cfb['filters']=_[_0x6e70('0x3c')](_0x5f0cfb['model'],_0x5f0cfb['query']);_0x2ea4e9[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x5f0cfb[_0x6e70('0x3d')],qs['fields'](_0x3fcf78[_0x6e70('0x3a')][_0x6e70('0x3f')]));_0x2ea4e9['attributes']=_0x2ea4e9[_0x6e70('0x3e')][_0x6e70('0x40')]?_0x2ea4e9[_0x6e70('0x3e')]:_0x5f0cfb[_0x6e70('0x3d')];if(!_0x3fcf78[_0x6e70('0x3a')][_0x6e70('0x41')](_0x6e70('0x42'))){_0x2ea4e9[_0x6e70('0x24')]=qs[_0x6e70('0x24')](_0x3fcf78['query']['limit']);_0x2ea4e9[_0x6e70('0x23')]=qs['offset'](_0x3fcf78[_0x6e70('0x3a')][_0x6e70('0x23')]);}_0x2ea4e9['order']=qs[_0x6e70('0x43')](_0x3fcf78[_0x6e70('0x3a')][_0x6e70('0x43')]);_0x2ea4e9['where']=qs[_0x6e70('0x3b')](_[_0x6e70('0x45')](_0x3fcf78[_0x6e70('0x3a')],_0x5f0cfb[_0x6e70('0x3b')]));_0x2ea4e9[_0x6e70('0x75')]=!![];if(_0x3fcf78[_0x6e70('0x3a')][_0x6e70('0x46')]){_0x2ea4e9[_0x6e70('0x44')]=_[_0x6e70('0x47')](_0x2ea4e9[_0x6e70('0x44')],{'$or':_[_0x6e70('0x38')](_0x2ea4e9[_0x6e70('0x3e')],function(_0x5f41ae){var _0x5bcfcf={};_0x5bcfcf[_0x5f41ae]={'$like':'%'+_0x3fcf78[_0x6e70('0x3a')][_0x6e70('0x46')]+'%'};return _0x5bcfcf;})});}_0x2ea4e9=_[_0x6e70('0x47')]({},_0x2ea4e9,_0x3fcf78[_0x6e70('0x49')]);return _0x223610[_0x6e70('0x70')](_0x2ea4e9);}})['then'](function(_0x3296e9){if(!_[_0x6e70('0x78')](_0x3296e9)){var _0x2a5aed=toCsv(_0x3296e9);var _0x5e5b1f=Date[_0x6e70('0x79')]();fs['writeFileSync'](util['format'](_0x6e70('0x7a'),_0x223610['id'],_0x5e5b1f),_0x2a5aed);_0x54abf9[_0x6e70('0x7b')](_0x6e70('0x7c'),_0x6e70('0x7d')+util['format'](_0x6e70('0x7e'),_0x223610['id'],_0x5e5b1f));_0x54abf9[_0x6e70('0x7b')]('Content-type','text/csv');return _0x54abf9['download'](util[_0x6e70('0x74')](_0x6e70('0x7a'),_0x223610['id'],_0x5e5b1f));}else{return _0x54abf9[_0x6e70('0x2e')](0xcc);}})[_0x6e70('0x59')](handleError(_0x54abf9,null));};exports[_0x6e70('0x7f')]=function(_0xae1e83,_0x40c5c0,_0x5d5dc1){var _0x26e149;delete _0xae1e83[_0x6e70('0x51')]['id'];return db[_0x6e70('0x34')][_0x6e70('0x60')]({'where':{'id':_0xae1e83[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x40c5c0,null))[_0x6e70('0x2b')](function(_0x2badf5){if(_0x2badf5){return db[_0x6e70('0x80')][_0x6e70('0x81')](function(_0x1a2a44){return db[_0x6e70('0x71')]['create'](_0xae1e83[_0x6e70('0x51')],{'transaction':_0x1a2a44})[_0x6e70('0x2b')](function(_0x397289){_0x26e149=_0x397289;return _0x2badf5['addCustomFields'](_0x397289,{'transaction':_0x1a2a44});})[_0x6e70('0x2b')](function(){var _0x8264bb={'type':db[_0x6e70('0x82')][_0x6e70('0x83')],'transaction':_0x1a2a44};switch(_0xae1e83[_0x6e70('0x51')][_0x6e70('0x36')]){case'text':_0x8264bb['type']=db[_0x6e70('0x82')][_0x6e70('0x83')];break;case _0x6e70('0x84'):_0x8264bb[_0x6e70('0x36')]=db[_0x6e70('0x82')][_0x6e70('0x85')];break;case'switch':_0x8264bb[_0x6e70('0x36')]=db[_0x6e70('0x82')][_0x6e70('0x86')];_0x8264bb[_0x6e70('0x87')]=![];break;default:}return db[_0x6e70('0x80')][_0x6e70('0x88')][_0x6e70('0x89')](_0x6e70('0x8a'),util[_0x6e70('0x74')](_0x6e70('0x8b'),_0x26e149['id']),_0x8264bb);})[_0x6e70('0x2b')](function(){return _0x26e149;});});}})[_0x6e70('0x2b')](respondWithResult(_0x40c5c0,null))[_0x6e70('0x59')](handleError(_0x40c5c0,null));};exports[_0x6e70('0x8c')]=function(_0xc2eb8c,_0x1fc939,_0x3b9f61){var _0x4ca2f4={};var _0x4995fc={};var _0x35bd16;var _0xebb753;return db[_0x6e70('0x34')][_0x6e70('0x60')]({'where':{'id':_0xc2eb8c[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x1fc939,null))['then'](function(_0x8476fd){if(_0x8476fd){_0x35bd16=_0x8476fd;_0x4995fc['model']=_[_0x6e70('0x39')](db['CmCustomField'][_0x6e70('0x35')]);_0x4995fc['query']=_[_0x6e70('0x39')](_0xc2eb8c[_0x6e70('0x3a')]);_0x4995fc[_0x6e70('0x3b')]=_['intersection'](_0x4995fc[_0x6e70('0x3d')],_0x4995fc[_0x6e70('0x3a')]);_0x4ca2f4[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x4995fc[_0x6e70('0x3d')],qs[_0x6e70('0x3f')](_0xc2eb8c[_0x6e70('0x3a')]['fields']));_0x4ca2f4[_0x6e70('0x3e')]=_0x4ca2f4[_0x6e70('0x3e')]['length']?_0x4ca2f4[_0x6e70('0x3e')]:_0x4995fc[_0x6e70('0x3d')];_0x4ca2f4['order']=qs['sort'](_0xc2eb8c[_0x6e70('0x3a')]['sort']);_0x4ca2f4[_0x6e70('0x44')]=qs[_0x6e70('0x3b')](_[_0x6e70('0x45')](_0xc2eb8c[_0x6e70('0x3a')],_0x4995fc[_0x6e70('0x3b')]));_0x4ca2f4[_0x6e70('0x44')]=_[_0x6e70('0x47')](_0x4ca2f4[_0x6e70('0x44')],{'$or':[{'ListId':_0x8476fd['id']},{'ListId':null}]});if(_0xc2eb8c[_0x6e70('0x3a')][_0x6e70('0x46')]){_0x4ca2f4[_0x6e70('0x44')]=_[_0x6e70('0x47')](_0x4ca2f4[_0x6e70('0x44')],{'$or':_['map'](_0x4ca2f4[_0x6e70('0x3e')],function(_0x3fb786){var _0x2aa20a={};_0x2aa20a[_0x3fb786]={'$like':'%'+_0xc2eb8c[_0x6e70('0x3a')][_0x6e70('0x46')]+'%'};return _0x2aa20a;})});}_0x4ca2f4=_[_0x6e70('0x47')]({},_0x4ca2f4,_0xc2eb8c[_0x6e70('0x49')]);return db[_0x6e70('0x71')][_0x6e70('0x8d')](_0x4ca2f4);}})['then'](respondWithResult(_0x1fc939,null))[_0x6e70('0x59')](handleError(_0x1fc939,null));};exports[_0x6e70('0x8e')]=function(_0x349387,_0x49fd11,_0x88522){return db[_0x6e70('0x34')][_0x6e70('0x4f')]({'where':{'id':_0x349387[_0x6e70('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49fd11,null))['then'](function(_0x20ac7e){if(_0x20ac7e){return _0x20ac7e['addAgents'](_0x349387['body'][_0x6e70('0x65')],_[_0x6e70('0x8f')](_0x349387[_0x6e70('0x51')],[_0x6e70('0x65'),'id'])||{})[_0x6e70('0x90')](function(_0x22827){for(var _0xf7e813=0x0;_0xf7e813<_0x349387[_0x6e70('0x51')][_0x6e70('0x65')][_0x6e70('0x40')];_0xf7e813+=0x1){socket['emit'](_0x6e70('0x91'),{'UserId':_0x349387[_0x6e70('0x51')][_0x6e70('0x65')][_0xf7e813],'CmListId':_0x349387[_0x6e70('0x4e')]['id']});}return _0x22827;});}})[_0x6e70('0x2b')](respondWithResult(_0x49fd11,null))[_0x6e70('0x59')](handleError(_0x49fd11,null));};exports[_0x6e70('0x92')]=function(_0xa9a209,_0x3c0e38,_0x372c3d){return db['CmList']['find']({'where':{'id':_0xa9a209['params']['id']}})['then'](handleEntityNotFound(_0x3c0e38,null))[_0x6e70('0x2b')](function(_0x12f155){if(_0x12f155){return _0x12f155[_0x6e70('0x92')](_0xa9a209['query'][_0x6e70('0x65')])['then'](function(){if(_[_0x6e70('0x68')](_0xa9a209['query']['ids'])){for(var _0xe4b9f8=0x0;_0xe4b9f8<_0xa9a209[_0x6e70('0x3a')][_0x6e70('0x65')][_0x6e70('0x40')];_0xe4b9f8+=0x1){socket[_0x6e70('0x93')](_0x6e70('0x94'),{'UserId':Number(_0xa9a209[_0x6e70('0x3a')]['ids'][_0xe4b9f8]),'CmListId':Number(_0xa9a209[_0x6e70('0x4e')]['id'])});}}else{socket[_0x6e70('0x93')]('userCmList:remove',{'UserId':Number(_0xa9a209[_0x6e70('0x3a')][_0x6e70('0x65')]),'CmListId':Number(_0xa9a209[_0x6e70('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c0e38,null))[_0x6e70('0x59')](handleError(_0x3c0e38,null));};exports[_0x6e70('0x95')]=function(_0x5516b9,_0x502927,_0x18f71f){var _0x303ae3={};var _0x747523={};var _0xe93f52;var _0x2943a6;return db['CmList']['findOne']({'where':{'id':_0x5516b9[_0x6e70('0x4e')]['id']}})[_0x6e70('0x2b')](handleEntityNotFound(_0x502927,null))[_0x6e70('0x2b')](function(_0x5dcc57){if(_0x5dcc57){_0xe93f52=_0x5dcc57;_0x747523[_0x6e70('0x3d')]=_[_0x6e70('0x39')](db[_0x6e70('0x96')][_0x6e70('0x35')]);_0x747523[_0x6e70('0x3a')]=_[_0x6e70('0x39')](_0x5516b9[_0x6e70('0x3a')]);_0x747523[_0x6e70('0x3b')]=_[_0x6e70('0x3c')](_0x747523[_0x6e70('0x3d')],_0x747523['query']);_0x303ae3[_0x6e70('0x3e')]=_[_0x6e70('0x3c')](_0x747523[_0x6e70('0x3d')],qs[_0x6e70('0x3f')](_0x5516b9['query'][_0x6e70('0x3f')]));_0x303ae3[_0x6e70('0x3e')]=_0x303ae3[_0x6e70('0x3e')]['length']?_0x303ae3[_0x6e70('0x3e')]:_0x747523[_0x6e70('0x3d')];_0x303ae3[_0x6e70('0x61')]=qs[_0x6e70('0x43')](_0x5516b9['query'][_0x6e70('0x43')]);_0x303ae3[_0x6e70('0x44')]=qs[_0x6e70('0x3b')](_[_0x6e70('0x45')](_0x5516b9[_0x6e70('0x3a')],_0x747523[_0x6e70('0x3b')]));if(_0x5516b9[_0x6e70('0x3a')][_0x6e70('0x46')]){_0x303ae3[_0x6e70('0x44')]=_[_0x6e70('0x47')](_0x303ae3['where'],{'$or':_['map'](_0x303ae3[_0x6e70('0x3e')],function(_0x3dec80){var _0x323887={};_0x323887[_0x3dec80]={'$like':'%'+_0x5516b9[_0x6e70('0x3a')][_0x6e70('0x46')]+'%'};return _0x323887;})});}_0x303ae3=_[_0x6e70('0x47')]({},_0x303ae3,_0x5516b9[_0x6e70('0x49')]);return _0xe93f52[_0x6e70('0x95')](_0x303ae3);}})[_0x6e70('0x2b')](function(_0x166244){if(_0x166244){_0x2943a6=_0x166244[_0x6e70('0x40')];if(!_0x5516b9[_0x6e70('0x3a')][_0x6e70('0x41')](_0x6e70('0x42'))){_0x303ae3[_0x6e70('0x24')]=qs['limit'](_0x5516b9[_0x6e70('0x3a')][_0x6e70('0x24')]);_0x303ae3[_0x6e70('0x23')]=qs['offset'](_0x5516b9[_0x6e70('0x3a')][_0x6e70('0x23')]);}return _0xe93f52[_0x6e70('0x95')](_0x303ae3);}})[_0x6e70('0x2b')](function(_0x3c7d2f){if(_0x3c7d2f){return _0x3c7d2f?{'count':_0x2943a6,'rows':_0x3c7d2f}:null;}})[_0x6e70('0x2b')](respondWithResult(_0x502927,null))['catch'](handleError(_0x502927,null));}; \ No newline at end of file +var _0xcb91=['bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','get','Lists','destroy','error','name','index','map','CmList','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','describe','addDisposition','ListId','Disposition','getDispositions','sort','includeAll','rows','removeDispositions','CmContact','tags','isArray','join','each','omit','ids','success','dataValues','errors','push','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xcb91[_0x2d34d6];return _0x1d3d12;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];config[_0x1cb9('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1cb9('0x17'))(new Redis(config[_0x1cb9('0x16')]));require(_0x1cb9('0x18'))[_0x1cb9('0x19')](socket);function respondWithStatusCode(_0x56884d,_0x397727){_0x397727=_0x397727||0xcc;return function(_0x6ef389){if(_0x6ef389){return _0x56884d[_0x1cb9('0x1a')](_0x397727);}return _0x56884d[_0x1cb9('0x1b')](_0x397727)[_0x1cb9('0x1c')]();};}function respondWithResult(_0x5806d8,_0x5572cb){_0x5572cb=_0x5572cb||0xc8;return function(_0xd446a3){if(_0xd446a3){return _0x5806d8[_0x1cb9('0x1b')](_0x5572cb)[_0x1cb9('0x1d')](_0xd446a3);}};}function respondWithFilteredResult(_0x3f1376,_0x3e21e0){return function(_0xf22920){if(_0xf22920){var _0x23d3a9=_0xf22920[_0x1cb9('0x1e')],_0x4e1340=_0x3e21e0[_0x1cb9('0x1f')],_0x479d43=_0x3e21e0[_0x1cb9('0x1f')]+_0x3e21e0[_0x1cb9('0x20')],_0x1b2fa6;if(_0x479d43>=_0x23d3a9){_0x479d43=_0x23d3a9;_0x1b2fa6=0xc8;}else{_0x1b2fa6=0xce;}_0x3f1376[_0x1cb9('0x1b')](_0x1b2fa6);return _0x3f1376[_0x1cb9('0x21')]('Content-Range',_0x4e1340+'-'+_0x479d43+'/'+_0x23d3a9)['json'](_0xf22920);}return null;};}function patchUpdates(_0x1a5a72){return function(_0x5dbfae){try{jsonpatch[_0x1cb9('0x22')](_0x5dbfae,_0x1a5a72,!![]);}catch(_0x2265ea){return BPromise['reject'](_0x2265ea);}return _0x5dbfae['save']();};}function saveUpdates(_0x2e3854,_0x325637){return function(_0x103a63){if(_0x103a63){return _0x103a63[_0x1cb9('0x23')](_0x2e3854)[_0x1cb9('0x24')](function(_0x27db16){return _0x27db16;});}return null;};}function removeEntity(_0x59ebea,_0x55b232){return function(_0x6c6f61){if(_0x6c6f61){return _0x6c6f61['destroy']()[_0x1cb9('0x24')](function(){var _0x2b1275=_0x6c6f61[_0x1cb9('0x25')]({'plain':!![]});var _0x44d3c4=_0x1cb9('0x26');return db['UserProfileResource'][_0x1cb9('0x27')]({'where':{'type':_0x44d3c4,'resourceId':_0x2b1275['id']}})[_0x1cb9('0x24')](function(){return _0x6c6f61;});})['then'](function(){_0x59ebea[_0x1cb9('0x1b')](0xcc)[_0x1cb9('0x1c')]();});}};}function handleEntityNotFound(_0x41a9a0,_0x1804fd){return function(_0x406821){if(!_0x406821){_0x41a9a0[_0x1cb9('0x1a')](0x194);}return _0x406821;};}function handleError(_0x2e28fe,_0xb644b3){_0xb644b3=_0xb644b3||0x1f4;return function(_0x41e5c2){logger[_0x1cb9('0x28')](_0x41e5c2['stack']);if(_0x41e5c2[_0x1cb9('0x29')]){delete _0x41e5c2['name'];}_0x2e28fe[_0x1cb9('0x1b')](_0xb644b3)['send'](_0x41e5c2);};}exports[_0x1cb9('0x2a')]=function(_0x41011c,_0x3cd7f5){var _0x2038aa={},_0x561d89={},_0x1c701f={'count':0x0,'rows':[]};var _0x4eba82=_[_0x1cb9('0x2b')](db[_0x1cb9('0x2c')][_0x1cb9('0x2d')],function(_0x5d8793){return{'name':_0x5d8793[_0x1cb9('0x2e')],'type':_0x5d8793['type'][_0x1cb9('0x2f')]};});_0x561d89['model']=_[_0x1cb9('0x2b')](_0x4eba82,_0x1cb9('0x29'));_0x561d89[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x41011c['query']);_0x561d89[_0x1cb9('0x32')]=_[_0x1cb9('0x33')](_0x561d89[_0x1cb9('0x34')],_0x561d89[_0x1cb9('0x30')]);_0x2038aa[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0x561d89[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x2038aa[_0x1cb9('0x35')]=_0x2038aa[_0x1cb9('0x35')][_0x1cb9('0x37')]?_0x2038aa['attributes']:_0x561d89['model'];if(!_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x2038aa[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x20')]);_0x2038aa[_0x1cb9('0x1f')]=qs['offset'](_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x1f')]);}_0x2038aa[_0x1cb9('0x3a')]=qs['sort'](_0x41011c[_0x1cb9('0x30')]['sort']);_0x2038aa[_0x1cb9('0x3b')]=qs['filters'](_[_0x1cb9('0x3c')](_0x41011c[_0x1cb9('0x30')],_0x561d89[_0x1cb9('0x32')]));if(_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x3d')]){_0x2038aa[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x2038aa['where'],{'$or':_['map'](_0x4eba82,function(_0x4111b8){if(_0x4111b8[_0x1cb9('0x3f')]!==_0x1cb9('0x40')){var _0x16ad1c={};_0x16ad1c[_0x4111b8[_0x1cb9('0x29')]]={'$like':'%'+_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0x16ad1c;}})});}_0x2038aa=_['merge']({},_0x2038aa,_0x41011c[_0x1cb9('0x41')]);var _0x47edad={'where':_0x2038aa['where']};return db['CmList'][_0x1cb9('0x1e')](_0x47edad)[_0x1cb9('0x24')](function(_0x1bf51c){_0x1c701f[_0x1cb9('0x1e')]=_0x1bf51c;if(_0x41011c[_0x1cb9('0x30')]['includeAll']){_0x2038aa[_0x1cb9('0x42')]=[{'all':!![]}];}return db['CmList'][_0x1cb9('0x43')](_0x2038aa);})[_0x1cb9('0x24')](function(_0x38d973){_0x1c701f['rows']=_0x38d973;return _0x1c701f;})[_0x1cb9('0x24')](respondWithFilteredResult(_0x3cd7f5,_0x2038aa))['catch'](handleError(_0x3cd7f5,null));};exports[_0x1cb9('0x44')]=function(_0xbc36fc,_0x51a898){var _0x5839aa={'raw':![],'where':{'id':_0xbc36fc[_0x1cb9('0x45')]['id']}},_0x24c643={};_0x24c643[_0x1cb9('0x34')]=_[_0x1cb9('0x31')](db[_0x1cb9('0x2c')]['rawAttributes']);_0x24c643[_0x1cb9('0x30')]=_['keys'](_0xbc36fc['query']);_0x24c643['filters']=_[_0x1cb9('0x33')](_0x24c643[_0x1cb9('0x34')],_0x24c643[_0x1cb9('0x30')]);_0x5839aa[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0x24c643[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0xbc36fc[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x5839aa[_0x1cb9('0x35')]=_0x5839aa[_0x1cb9('0x35')]['length']?_0x5839aa[_0x1cb9('0x35')]:_0x24c643[_0x1cb9('0x34')];if(_0xbc36fc[_0x1cb9('0x30')]['includeAll']){_0x5839aa[_0x1cb9('0x42')]=[{'all':!![]}];}_0x5839aa=_[_0x1cb9('0x3e')]({},_0x5839aa,_0xbc36fc[_0x1cb9('0x41')]);return db[_0x1cb9('0x2c')][_0x1cb9('0x46')](_0x5839aa)['then'](handleEntityNotFound(_0x51a898,null))[_0x1cb9('0x24')](respondWithResult(_0x51a898,null))['catch'](handleError(_0x51a898,null));};exports[_0x1cb9('0x47')]=function(_0x4ac483,_0x1cf2ee){return db[_0x1cb9('0x2c')][_0x1cb9('0x47')](_0x4ac483[_0x1cb9('0x48')],{})['then'](function(_0x298475){var _0x1149b9=_0x4ac483[_0x1cb9('0x49')][_0x1cb9('0x25')]({'plain':!![]});if(!_0x1149b9)throw new Error(_0x1cb9('0x4a'));if(_0x1149b9[_0x1cb9('0x4b')]===_0x1cb9('0x49')){var _0x3b6a92=_0x298475[_0x1cb9('0x25')]({'plain':!![]});var _0x17f10e='Lists';return db['UserProfileSection'][_0x1cb9('0x46')]({'where':{'name':_0x17f10e,'userProfileId':_0x1149b9[_0x1cb9('0x4c')]},'raw':!![]})[_0x1cb9('0x24')](function(_0x1e073d){if(_0x1e073d&&_0x1e073d[_0x1cb9('0x4d')]===0x0){return db[_0x1cb9('0x4e')][_0x1cb9('0x47')]({'name':_0x3b6a92[_0x1cb9('0x29')],'resourceId':_0x3b6a92['id'],'type':_0x1e073d[_0x1cb9('0x29')],'sectionId':_0x1e073d['id']},{})[_0x1cb9('0x24')](function(){return _0x298475;});}else{return _0x298475;}})['catch'](function(_0x2cf8e2){logger['error'](_0x1cb9('0x4f'),_0x2cf8e2);throw _0x2cf8e2;});}return _0x298475;})['then'](respondWithResult(_0x1cf2ee,0xc9))[_0x1cb9('0x50')](handleError(_0x1cf2ee,null));};exports['update']=function(_0x5e5174,_0x44e918){if(_0x5e5174[_0x1cb9('0x48')]['id']){delete _0x5e5174[_0x1cb9('0x48')]['id'];}return db['CmList'][_0x1cb9('0x46')]({'where':{'id':_0x5e5174[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x44e918,null))['then'](saveUpdates(_0x5e5174[_0x1cb9('0x48')],null))[_0x1cb9('0x24')](respondWithResult(_0x44e918,null))[_0x1cb9('0x50')](handleError(_0x44e918,null));};exports[_0x1cb9('0x27')]=function(_0x3de325,_0x310d6d){return db[_0x1cb9('0x2c')]['find']({'where':{'id':_0x3de325[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x310d6d,null))[_0x1cb9('0x24')](removeEntity(_0x310d6d,null))['catch'](handleError(_0x310d6d,null));};exports[_0x1cb9('0x51')]=function(_0x9893a3,_0x1651c5){return db[_0x1cb9('0x2c')][_0x1cb9('0x51')]()[_0x1cb9('0x24')](respondWithResult(_0x1651c5,null))['catch'](handleError(_0x1651c5,null));};exports[_0x1cb9('0x52')]=function(_0x36c40d,_0x41e81f,_0x128c5b){if(_0x36c40d[_0x1cb9('0x48')]['id']){delete _0x36c40d[_0x1cb9('0x48')]['id'];}return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x36c40d[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x41e81f,null))[_0x1cb9('0x24')](function(_0x55fb51){if(_0x55fb51){_0x36c40d[_0x1cb9('0x48')][_0x1cb9('0x53')]=_0x55fb51['id'];return db[_0x1cb9('0x54')][_0x1cb9('0x47')](_0x36c40d['body']);}})['then'](respondWithResult(_0x41e81f,null))[_0x1cb9('0x50')](handleError(_0x41e81f,null));};exports[_0x1cb9('0x55')]=function(_0x31eccc,_0x173db5,_0x3c2f9c){var _0x75c734={'raw':![],'where':{}};var _0xc515a6={};var _0xd010a9={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x31eccc[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x173db5,null))['then'](function(_0x4ca5bc){if(_0x4ca5bc){_0xc515a6['model']=_['keys'](db[_0x1cb9('0x54')][_0x1cb9('0x2d')]);_0xc515a6[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x31eccc[_0x1cb9('0x30')]);_0xc515a6[_0x1cb9('0x32')]=_['intersection'](_0xc515a6[_0x1cb9('0x34')],_0xc515a6[_0x1cb9('0x30')]);_0x75c734['attributes']=_['intersection'](_0xc515a6[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x75c734[_0x1cb9('0x35')]=_0x75c734['attributes']['length']?_0x75c734['attributes']:_0xc515a6[_0x1cb9('0x34')];if(!_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x75c734[_0x1cb9('0x20')]=qs['limit'](_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x20')]);_0x75c734['offset']=qs['offset'](_0x31eccc[_0x1cb9('0x30')]['offset']);}_0x75c734[_0x1cb9('0x3a')]=qs[_0x1cb9('0x56')](_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x56')]);_0x75c734[_0x1cb9('0x3b')]=qs[_0x1cb9('0x32')](_['pick'](_0x31eccc[_0x1cb9('0x30')],_0xc515a6[_0x1cb9('0x32')]));_0x75c734[_0x1cb9('0x3b')][_0x1cb9('0x53')]=_0x4ca5bc['id'];if(_0x31eccc['query']['filter']){_0x75c734[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x75c734[_0x1cb9('0x3b')],{'$or':_[_0x1cb9('0x2b')](_0x75c734[_0x1cb9('0x35')],function(_0x267a3c){var _0x4f8756={};_0x4f8756[_0x267a3c]={'$like':'%'+_0x31eccc[_0x1cb9('0x30')]['filter']+'%'};return _0x4f8756;})});}_0x75c734=_[_0x1cb9('0x3e')]({},_0x75c734,_0x31eccc[_0x1cb9('0x41')]);return db['Disposition'][_0x1cb9('0x1e')]({'where':_0x75c734[_0x1cb9('0x3b')]})[_0x1cb9('0x24')](function(_0x539514){_0xd010a9[_0x1cb9('0x1e')]=_0x539514;if(_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x57')]){_0x75c734[_0x1cb9('0x42')]=[{'all':!![]}];}return db[_0x1cb9('0x54')][_0x1cb9('0x43')](_0x75c734);})['then'](function(_0x2b2874){_0xd010a9[_0x1cb9('0x58')]=_0x2b2874;return _0xd010a9;});}})[_0x1cb9('0x24')](respondWithFilteredResult(_0x173db5,_0x75c734))[_0x1cb9('0x50')](handleError(_0x173db5,null));};exports[_0x1cb9('0x59')]=function(_0x1da41c,_0x128a41,_0x37bcd9){return db['CmList'][_0x1cb9('0x46')]({'where':{'id':_0x1da41c[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x128a41,null))[_0x1cb9('0x24')](function(_0x5415fa){if(_0x5415fa){return _0x5415fa[_0x1cb9('0x59')](_0x1da41c['query']['ids']);}})[_0x1cb9('0x24')](respondWithStatusCode(_0x128a41,null))[_0x1cb9('0x50')](handleError(_0x128a41,null));};exports['addContacts']=function(_0x342cb1,_0x5b5419,_0x3d6474){return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x342cb1[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b5419,null))[_0x1cb9('0x24')](function(_0x3d25a3){if(_0x3d25a3){var _0x2a157d=[];var _0x27cc3c={'success':[],'errors':[]};return db[_0x1cb9('0x5a')][_0x1cb9('0x51')]()['then'](function(_0x248946){if(_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')]&&_[_0x1cb9('0x5c')](_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')])){if(_0x342cb1['body'][_0x1cb9('0x5b')][_0x1cb9('0x37')]){_0x342cb1['body'][_0x1cb9('0x5b')]=_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')][_0x1cb9('0x5d')](';')+';';}else{_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')]=null;}}else{_0x342cb1[_0x1cb9('0x48')]['tags']=null;}if(_0x342cb1[_0x1cb9('0x48')]&&_['isArray'](_0x342cb1[_0x1cb9('0x48')])){for(var _0xb5eac1=0x0;_0xb5eac1<_0x342cb1['body'][_0x1cb9('0x37')];_0xb5eac1+=0x1){_0x342cb1[_0x1cb9('0x48')][_0xb5eac1][_0x1cb9('0x53')]=_0x342cb1[_0x1cb9('0x45')]['id'];_0x2a157d['push'](_0x342cb1[_0x1cb9('0x48')][_0xb5eac1]);}return BPromise[_0x1cb9('0x5e')](_0x2a157d,function(_0x429371){return db['CmContact'][_0x1cb9('0x47')](_[_0x1cb9('0x5f')](_0x429371,[_0x1cb9('0x60'),'id'])||{},{'fields':_[_0x1cb9('0x31')](_0x248946),'raw':!![]})[_0x1cb9('0x24')](function(_0x1ea329){_0x27cc3c[_0x1cb9('0x61')]['push'](_0x1ea329[_0x1cb9('0x62')]);})['catch'](function(_0x27f1d2){_0x27cc3c[_0x1cb9('0x63')][_0x1cb9('0x64')]({'data':_0x429371,'error':_0x27f1d2[_0x1cb9('0x65')]});});})['then'](function(_0x1ff5e9){return _0x27cc3c;})[_0x1cb9('0x50')](function(_0x5e68a1){return _0x5e68a1;});}else{_0x5b5419[_0x1cb9('0x1b')](0x190)[_0x1cb9('0x1d')]({'message':_0x1cb9('0x66')});}});}})[_0x1cb9('0x24')](respondWithResult(_0x5b5419,null))[_0x1cb9('0x50')](handleError(_0x5b5419,null));};exports['getContacts']=function(_0x5e0e56,_0x544d2d,_0x5ad853){var _0x19daa1;return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x5e0e56[_0x1cb9('0x45')]['id']},'include':[{'model':db[_0x1cb9('0x67')],'as':_0x1cb9('0x68')}]})[_0x1cb9('0x24')](handleEntityNotFound(_0x544d2d,null))[_0x1cb9('0x24')](function(_0x4e969a){if(_0x4e969a){_0x19daa1=_0x4e969a;return db[_0x1cb9('0x5a')][_0x1cb9('0x2d')];}})[_0x1cb9('0x24')](function(_0x5eff1e){if(_0x5eff1e){var _0x10977f={};var _0xc6b64c={};_0xc6b64c['model']=_[_0x1cb9('0x69')](_[_0x1cb9('0x31')](_0x5eff1e),_[_0x1cb9('0x2b')](_0x19daa1[_0x1cb9('0x68')],function(_0x5cb5e5){return util[_0x1cb9('0x6a')](_0x1cb9('0x6b'),_0x5cb5e5['id']);}));_0xc6b64c['query']=_['keys'](_0x5e0e56[_0x1cb9('0x30')]);_0xc6b64c[_0x1cb9('0x32')]=_['intersection'](_0xc6b64c['model'],_0xc6b64c[_0x1cb9('0x30')]);_0x10977f[_0x1cb9('0x35')]=_['intersection'](_0xc6b64c['model'],qs[_0x1cb9('0x36')](_0x5e0e56['query']['fields']));_0x10977f['attributes']=_0x10977f[_0x1cb9('0x35')]['length']?_0x10977f[_0x1cb9('0x35')]:_0xc6b64c[_0x1cb9('0x34')];if(!_0x5e0e56[_0x1cb9('0x30')]['hasOwnProperty'](_0x1cb9('0x39'))){_0x10977f[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x5e0e56['query'][_0x1cb9('0x20')]);_0x10977f[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x5e0e56[_0x1cb9('0x30')][_0x1cb9('0x1f')]);}_0x10977f['order']=qs[_0x1cb9('0x56')](_0x5e0e56[_0x1cb9('0x30')][_0x1cb9('0x56')]);_0x10977f['where']=qs[_0x1cb9('0x32')](_[_0x1cb9('0x3c')](_0x5e0e56[_0x1cb9('0x30')],_0xc6b64c[_0x1cb9('0x32')]));_0x10977f[_0x1cb9('0x6c')]=!![];if(_0x5e0e56['query'][_0x1cb9('0x3d')]){_0x10977f[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x10977f[_0x1cb9('0x3b')],{'$or':_[_0x1cb9('0x2b')](_0x10977f[_0x1cb9('0x35')],function(_0x37affa){var _0x36864c={};_0x36864c[_0x37affa]={'$like':'%'+_0x5e0e56[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0x36864c;})});}_0x10977f=_[_0x1cb9('0x3e')]({},_0x10977f,_0x5e0e56[_0x1cb9('0x41')]);return _0x19daa1[_0x1cb9('0x6d')](_0x10977f);}})[_0x1cb9('0x24')](respondWithResult(_0x544d2d,null))[_0x1cb9('0x50')](handleError(_0x544d2d,null));};exports[_0x1cb9('0x6e')]=function(_0x37b290,_0xf25415,_0x48e879){var _0x508a75;return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x37b290[_0x1cb9('0x45')]['id']},'include':[{'model':db[_0x1cb9('0x67')],'as':_0x1cb9('0x68')}]})[_0x1cb9('0x24')](handleEntityNotFound(_0xf25415,null))[_0x1cb9('0x24')](function(_0x56251d){if(_0x56251d){_0x508a75=_0x56251d;return db['CmContact'][_0x1cb9('0x2d')];}})[_0x1cb9('0x24')](function(_0x29b478){if(_0x29b478){var _0x11a46b={};var _0xed8968={};_0xed8968['model']=_[_0x1cb9('0x69')](_[_0x1cb9('0x31')](_0x29b478),_[_0x1cb9('0x2b')](_0x508a75['CustomFields'],function(_0x36faa4){return util[_0x1cb9('0x6a')](_0x1cb9('0x6b'),_0x36faa4['id']);}));_0xed8968['query']=_[_0x1cb9('0x31')](_0x37b290[_0x1cb9('0x30')]);_0xed8968[_0x1cb9('0x32')]=_['intersection'](_0xed8968['model'],_0xed8968['query']);_0x11a46b[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0xed8968[_0x1cb9('0x34')],qs['fields'](_0x37b290[_0x1cb9('0x30')]['fields']));_0x11a46b['attributes']=_0x11a46b[_0x1cb9('0x35')][_0x1cb9('0x37')]?_0x11a46b[_0x1cb9('0x35')]:_0xed8968[_0x1cb9('0x34')];if(!_0x37b290[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x11a46b[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x37b290[_0x1cb9('0x30')]['limit']);_0x11a46b['offset']=qs[_0x1cb9('0x1f')](_0x37b290[_0x1cb9('0x30')]['offset']);}_0x11a46b['order']=qs['sort'](_0x37b290['query'][_0x1cb9('0x56')]);_0x11a46b[_0x1cb9('0x3b')]=qs['filters'](_[_0x1cb9('0x3c')](_0x37b290[_0x1cb9('0x30')],_0xed8968[_0x1cb9('0x32')]));_0x11a46b[_0x1cb9('0x6c')]=!![];if(_0x37b290[_0x1cb9('0x30')]['filter']){_0x11a46b[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x11a46b[_0x1cb9('0x3b')],{'$or':_[_0x1cb9('0x2b')](_0x11a46b['attributes'],function(_0x19f3db){var _0x3d82b0={};_0x3d82b0[_0x19f3db]={'$like':'%'+_0x37b290['query']['filter']+'%'};return _0x3d82b0;})});}_0x11a46b=_['merge']({},_0x11a46b,_0x37b290[_0x1cb9('0x41')]);return _0x508a75['getContacts'](_0x11a46b);}})[_0x1cb9('0x24')](function(_0x3506d7){if(!_[_0x1cb9('0x6f')](_0x3506d7)){var _0xf3c554=toCsv(_0x3506d7);var _0x31d1e5=Date[_0x1cb9('0x70')]();fs['writeFileSync'](util[_0x1cb9('0x6a')](_0x1cb9('0x71'),_0x508a75['id'],_0x31d1e5),_0xf3c554);_0xf25415[_0x1cb9('0x72')](_0x1cb9('0x73'),_0x1cb9('0x74')+util[_0x1cb9('0x6a')](_0x1cb9('0x75'),_0x508a75['id'],_0x31d1e5));_0xf25415[_0x1cb9('0x72')](_0x1cb9('0x76'),_0x1cb9('0x77'));return _0xf25415[_0x1cb9('0x78')](util[_0x1cb9('0x6a')](_0x1cb9('0x71'),_0x508a75['id'],_0x31d1e5));}else{return _0xf25415[_0x1cb9('0x1a')](0xcc);}})[_0x1cb9('0x50')](handleError(_0xf25415,null));};exports['addCustomField']=function(_0x592c04,_0x5aae4c,_0x9b1c60){var _0x35792e;delete _0x592c04['body']['id'];return db[_0x1cb9('0x2c')][_0x1cb9('0x79')]({'where':{'id':_0x592c04[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x5aae4c,null))[_0x1cb9('0x24')](function(_0x3f817e){if(_0x3f817e){return db[_0x1cb9('0x7a')][_0x1cb9('0x7b')](function(_0x45b2e4){return db['CmCustomField'][_0x1cb9('0x47')](_0x592c04['body'],{'transaction':_0x45b2e4})['then'](function(_0x191988){_0x35792e=_0x191988;return _0x3f817e[_0x1cb9('0x7c')](_0x191988,{'transaction':_0x45b2e4});})[_0x1cb9('0x24')](function(){var _0x2e9d88={'type':db[_0x1cb9('0x7d')][_0x1cb9('0x7e')],'transaction':_0x45b2e4};switch(_0x592c04[_0x1cb9('0x48')][_0x1cb9('0x3f')]){case'text':_0x2e9d88[_0x1cb9('0x3f')]=db[_0x1cb9('0x7d')][_0x1cb9('0x7e')];break;case _0x1cb9('0x7f'):_0x2e9d88[_0x1cb9('0x3f')]=db['Sequelize'][_0x1cb9('0x80')];break;case _0x1cb9('0x81'):_0x2e9d88[_0x1cb9('0x3f')]=db[_0x1cb9('0x7d')][_0x1cb9('0x82')];_0x2e9d88['defaultValue']=![];break;default:}return db[_0x1cb9('0x7a')][_0x1cb9('0x83')][_0x1cb9('0x84')]('cm_contacts',util[_0x1cb9('0x6a')](_0x1cb9('0x85'),_0x35792e['id']),_0x2e9d88);})[_0x1cb9('0x24')](function(){return _0x35792e;});});}})[_0x1cb9('0x24')](respondWithResult(_0x5aae4c,null))[_0x1cb9('0x50')](handleError(_0x5aae4c,null));};exports[_0x1cb9('0x86')]=function(_0x4e3ad0,_0x45dc8c,_0x7118bb){var _0x17fdd1={};var _0x5d230a={};var _0x142f08;var _0x2485b9;return db['CmList']['findOne']({'where':{'id':_0x4e3ad0[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x45dc8c,null))[_0x1cb9('0x24')](function(_0x208ce1){if(_0x208ce1){_0x142f08=_0x208ce1;_0x5d230a[_0x1cb9('0x34')]=_['keys'](db[_0x1cb9('0x67')][_0x1cb9('0x2d')]);_0x5d230a[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x4e3ad0[_0x1cb9('0x30')]);_0x5d230a['filters']=_['intersection'](_0x5d230a[_0x1cb9('0x34')],_0x5d230a[_0x1cb9('0x30')]);_0x17fdd1[_0x1cb9('0x35')]=_['intersection'](_0x5d230a['model'],qs[_0x1cb9('0x36')](_0x4e3ad0[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x17fdd1['attributes']=_0x17fdd1['attributes']['length']?_0x17fdd1[_0x1cb9('0x35')]:_0x5d230a[_0x1cb9('0x34')];_0x17fdd1[_0x1cb9('0x3a')]=qs['sort'](_0x4e3ad0[_0x1cb9('0x30')]['sort']);_0x17fdd1[_0x1cb9('0x3b')]=qs[_0x1cb9('0x32')](_[_0x1cb9('0x3c')](_0x4e3ad0[_0x1cb9('0x30')],_0x5d230a[_0x1cb9('0x32')]));_0x17fdd1['where']=_[_0x1cb9('0x3e')](_0x17fdd1['where'],{'$or':[{'ListId':_0x208ce1['id']},{'ListId':null}]});if(_0x4e3ad0[_0x1cb9('0x30')][_0x1cb9('0x3d')]){_0x17fdd1[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x17fdd1[_0x1cb9('0x3b')],{'$or':_['map'](_0x17fdd1[_0x1cb9('0x35')],function(_0x174147){var _0xb4ea43={};_0xb4ea43[_0x174147]={'$like':'%'+_0x4e3ad0[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0xb4ea43;})});}_0x17fdd1=_[_0x1cb9('0x3e')]({},_0x17fdd1,_0x4e3ad0[_0x1cb9('0x41')]);return db['CmCustomField']['findAndCountAll'](_0x17fdd1);}})[_0x1cb9('0x24')](respondWithResult(_0x45dc8c,null))[_0x1cb9('0x50')](handleError(_0x45dc8c,null));};exports[_0x1cb9('0x87')]=function(_0x1cdff0,_0x106fe7,_0x54b0d0){return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x1cdff0['params']['id']}})['then'](handleEntityNotFound(_0x106fe7,null))[_0x1cb9('0x24')](function(_0x48c8e7){if(_0x48c8e7){return _0x48c8e7[_0x1cb9('0x87')](_0x1cdff0['body'][_0x1cb9('0x60')],_[_0x1cb9('0x5f')](_0x1cdff0[_0x1cb9('0x48')],[_0x1cb9('0x60'),'id'])||{})[_0x1cb9('0x88')](function(_0x345e13){for(var _0x2c7326=0x0;_0x2c7326<_0x1cdff0[_0x1cb9('0x48')][_0x1cb9('0x60')][_0x1cb9('0x37')];_0x2c7326+=0x1){socket[_0x1cb9('0x89')](_0x1cb9('0x8a'),{'UserId':_0x1cdff0['body']['ids'][_0x2c7326],'CmListId':_0x1cdff0['params']['id']});}return _0x345e13;});}})['then'](respondWithResult(_0x106fe7,null))[_0x1cb9('0x50')](handleError(_0x106fe7,null));};exports[_0x1cb9('0x8b')]=function(_0x550877,_0x5b2b21,_0x4e46c1){return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x550877[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x5b2b21,null))['then'](function(_0x178cba){if(_0x178cba){return _0x178cba[_0x1cb9('0x8b')](_0x550877[_0x1cb9('0x30')]['ids'])[_0x1cb9('0x24')](function(){if(_[_0x1cb9('0x5c')](_0x550877['query'][_0x1cb9('0x60')])){for(var _0x57c3c4=0x0;_0x57c3c4<_0x550877[_0x1cb9('0x30')][_0x1cb9('0x60')][_0x1cb9('0x37')];_0x57c3c4+=0x1){socket[_0x1cb9('0x89')](_0x1cb9('0x8c'),{'UserId':Number(_0x550877[_0x1cb9('0x30')][_0x1cb9('0x60')][_0x57c3c4]),'CmListId':Number(_0x550877['params']['id'])});}}else{socket[_0x1cb9('0x89')](_0x1cb9('0x8c'),{'UserId':Number(_0x550877[_0x1cb9('0x30')][_0x1cb9('0x60')]),'CmListId':Number(_0x550877[_0x1cb9('0x45')]['id'])});}});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x5b2b21,null))[_0x1cb9('0x50')](handleError(_0x5b2b21,null));};exports[_0x1cb9('0x8d')]=function(_0x181146,_0x394a89,_0x4a050d){var _0x183dbf={};var _0x32f255={};var _0x32be25;var _0x3e9fca;return db[_0x1cb9('0x2c')]['findOne']({'where':{'id':_0x181146[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x394a89,null))['then'](function(_0x44f38a){if(_0x44f38a){_0x32be25=_0x44f38a;_0x32f255[_0x1cb9('0x34')]=_[_0x1cb9('0x31')](db[_0x1cb9('0x8e')][_0x1cb9('0x2d')]);_0x32f255[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x181146[_0x1cb9('0x30')]);_0x32f255[_0x1cb9('0x32')]=_['intersection'](_0x32f255['model'],_0x32f255[_0x1cb9('0x30')]);_0x183dbf[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0x32f255[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0x181146[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x183dbf[_0x1cb9('0x35')]=_0x183dbf[_0x1cb9('0x35')][_0x1cb9('0x37')]?_0x183dbf['attributes']:_0x32f255[_0x1cb9('0x34')];_0x183dbf[_0x1cb9('0x3a')]=qs[_0x1cb9('0x56')](_0x181146[_0x1cb9('0x30')][_0x1cb9('0x56')]);_0x183dbf[_0x1cb9('0x3b')]=qs['filters'](_[_0x1cb9('0x3c')](_0x181146[_0x1cb9('0x30')],_0x32f255[_0x1cb9('0x32')]));if(_0x181146[_0x1cb9('0x30')][_0x1cb9('0x3d')]){_0x183dbf[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x183dbf['where'],{'$or':_[_0x1cb9('0x2b')](_0x183dbf[_0x1cb9('0x35')],function(_0x276900){var _0x45c0e6={};_0x45c0e6[_0x276900]={'$like':'%'+_0x181146[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0x45c0e6;})});}_0x183dbf=_[_0x1cb9('0x3e')]({},_0x183dbf,_0x181146[_0x1cb9('0x41')]);return _0x32be25[_0x1cb9('0x8d')](_0x183dbf);}})[_0x1cb9('0x24')](function(_0x27390a){if(_0x27390a){_0x3e9fca=_0x27390a[_0x1cb9('0x37')];if(!_0x181146[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x183dbf[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x181146[_0x1cb9('0x30')][_0x1cb9('0x20')]);_0x183dbf[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x181146[_0x1cb9('0x30')]['offset']);}return _0x32be25[_0x1cb9('0x8d')](_0x183dbf);}})[_0x1cb9('0x24')](function(_0x16ec06){if(_0x16ec06){return _0x16ec06?{'count':_0x3e9fca,'rows':_0x16ec06}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x394a89,null))[_0x1cb9('0x50')](handleError(_0x394a89,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index d5a230f..0d89d13 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 _0xdc2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList','save','update'];(function(_0x556b1d,_0xa0f67e){var _0x346381=function(_0x31a455){while(--_0x31a455){_0x556b1d['push'](_0x556b1d['shift']());}};_0x346381(++_0xa0f67e);}(_0xdc2f,0x1c7));var _0xfdc2=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xdc2f[_0x10004e];return _0x5af990;};'use strict';var EventEmitter=require(_0xfdc2('0x0'));var CmList=require(_0xfdc2('0x1'))['db'][_0xfdc2('0x2')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfdc2('0x3'),'afterUpdate':_0xfdc2('0x4'),'afterDestroy':_0xfdc2('0x5')};function emitEvent(_0x2b1cf8){return function(_0x16f9c6,_0xc047ea,_0x536223){CmListEvents['emit'](_0x2b1cf8+':'+_0x16f9c6['id'],_0x16f9c6);CmListEvents[_0xfdc2('0x6')](_0x2b1cf8,_0x16f9c6);_0x536223(null);};}for(var e in events){if(events[_0xfdc2('0x7')](e)){var event=events[e];CmList[_0xfdc2('0x8')](e,emitEvent(event));}}module[_0xfdc2('0x9')]=CmListEvents; \ No newline at end of file +var _0xd0dd=['events','../../mysqldb','CmList','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x212638,_0x2ac680){var _0xc91090=function(_0x10432c){while(--_0x10432c){_0x212638['push'](_0x212638['shift']());}};_0xc91090(++_0x2ac680);}(_0xd0dd,0x1f4));var _0xdd0d=function(_0x3b729a,_0x4558bc){_0x3b729a=_0x3b729a-0x0;var _0x370439=_0xd0dd[_0x3b729a];return _0x370439;};'use strict';var EventEmitter=require(_0xdd0d('0x0'));var CmList=require(_0xdd0d('0x1'))['db'][_0xdd0d('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xdd0d('0x3')](0x0);var events={'afterCreate':_0xdd0d('0x4'),'afterUpdate':_0xdd0d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1a7ac6){return function(_0x121755,_0x202866,_0x4d6b58){CmListEvents[_0xdd0d('0x6')](_0x1a7ac6+':'+_0x121755['id'],_0x121755);CmListEvents[_0xdd0d('0x6')](_0x1a7ac6,_0x121755);_0x4d6b58(null);};}for(var e in events){if(events[_0xdd0d('0x7')](e)){var event=events[e];CmList[_0xdd0d('0x8')](e,emitEvent(event));}}module[_0xdd0d('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index cf0e4eb..7d4da1b 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 _0xaf2a=['api','bluebird','path','rimraf','../../config/environment','./cmList.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf2a,0x1b5));var _0xaaf2=function(_0x1806d6,_0x10bd83){_0x1806d6=_0x1806d6-0x0;var _0x3c2fc3=_0xaf2a[_0x1806d6];return _0x3c2fc3;};'use strict';var _=require(_0xaaf2('0x0'));var util=require(_0xaaf2('0x1'));var logger=require(_0xaaf2('0x2'))(_0xaaf2('0x3'));var moment=require('moment');var BPromise=require(_0xaaf2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaaf2('0x5'));var rimraf=require(_0xaaf2('0x6'));var config=require(_0xaaf2('0x7'));var attributes=require(_0xaaf2('0x8'));module[_0xaaf2('0x9')]=function(_0x4c7cb2,_0x45ec04){return _0x4c7cb2[_0xaaf2('0xa')]('CmList',attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c52=['exports','define','CmList','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmList.attributes'];(function(_0x5067c6,_0x3f1e9e){var _0xb5daa3=function(_0x45337e){while(--_0x45337e){_0x5067c6['push'](_0x5067c6['shift']());}};_0xb5daa3(++_0x3f1e9e);}(_0x1c52,0xe7));var _0x21c5=function(_0x458f8a,_0x284189){_0x458f8a=_0x458f8a-0x0;var _0x2db426=_0x1c52[_0x458f8a];return _0x2db426;};'use strict';var _=require(_0x21c5('0x0'));var util=require('util');var logger=require(_0x21c5('0x1'))(_0x21c5('0x2'));var moment=require(_0x21c5('0x3'));var BPromise=require(_0x21c5('0x4'));var rp=require(_0x21c5('0x5'));var fs=require('fs');var path=require(_0x21c5('0x6'));var rimraf=require('rimraf');var config=require(_0x21c5('0x7'));var attributes=require(_0x21c5('0x8'));module[_0x21c5('0x9')]=function(_0x2e9a32,_0x5c2519){return _0x2e9a32[_0x21c5('0xa')](_0x21c5('0xb'),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 4db165b..777bc79 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 _0x1236=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','./cmList.socket','request','then','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x1236,0xab));var _0x6123=function(_0x867b3a,_0x2fcc0d){_0x867b3a=_0x867b3a-0x0;var _0x2f0995=_0x1236[_0x867b3a];return _0x2f0995;};'use strict';var _=require(_0x6123('0x0'));var util=require(_0x6123('0x1'));var moment=require(_0x6123('0x2'));var BPromise=require(_0x6123('0x3'));var rs=require(_0x6123('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6123('0x5'))['db'];var utils=require(_0x6123('0x6'));var logger=require(_0x6123('0x7'))('rpc');var config=require(_0x6123('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6123('0x9')]({'port':0x232a});config[_0x6123('0xa')]=_[_0x6123('0xb')](config[_0x6123('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6123('0xa')]));require(_0x6123('0xc'))['register'](socket);function respondWithRpcPromise(_0x31d9a8,_0x15d66c,_0x42d8b9){return new BPromise(function(_0xe83225,_0x35fb21){return client[_0x6123('0xd')](_0x31d9a8,_0x42d8b9)[_0x6123('0xe')](function(_0x2dbd12){logger['info']('CmList,\x20%s,\x20%s',_0x15d66c,_0x6123('0xf'));logger[_0x6123('0x10')](_0x6123('0x11'),_0x15d66c,_0x6123('0xf'),JSON[_0x6123('0x12')](_0x2dbd12));if(_0x2dbd12['error']){if(_0x2dbd12[_0x6123('0x13')][_0x6123('0x14')]===0x1f4){logger[_0x6123('0x13')](_0x6123('0x15'),_0x15d66c,_0x2dbd12[_0x6123('0x13')]['message']);return _0x35fb21(_0x2dbd12[_0x6123('0x13')][_0x6123('0x16')]);}logger[_0x6123('0x13')]('CmList,\x20%s,\x20%s',_0x15d66c,_0x2dbd12[_0x6123('0x13')]['message']);return _0xe83225(_0x2dbd12['error'][_0x6123('0x16')]);}else{logger[_0x6123('0x17')](_0x6123('0x15'),_0x15d66c,_0x6123('0xf'));_0xe83225(_0x2dbd12[_0x6123('0x18')][_0x6123('0x16')]);}})['catch'](function(_0x2a2a30){logger['error'](_0x6123('0x15'),_0x15d66c,_0x2a2a30);_0x35fb21(_0x2a2a30);});});} \ No newline at end of file +var _0x7619=['request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7619,0x1b5));var _0x9761=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7619[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9761('0x0'));var util=require(_0x9761('0x1'));var moment=require(_0x9761('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9761('0x3'));var db=require(_0x9761('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9761('0x5'))(_0x9761('0x6'));var config=require(_0x9761('0x7'));var jayson=require(_0x9761('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x9761('0x9')]=_['defaults'](config[_0x9761('0x9')],{'host':_0x9761('0xa'),'port':0x18eb});var socket=require(_0x9761('0xb'))(new Redis(config[_0x9761('0x9')]));require('./cmList.socket')[_0x9761('0xc')](socket);function respondWithRpcPromise(_0x3f7e85,_0x2e82e2,_0x2defa0){return new BPromise(function(_0xaa7de8,_0x501129){return client[_0x9761('0xd')](_0x3f7e85,_0x2defa0)[_0x9761('0xe')](function(_0x5d7441){logger[_0x9761('0xf')](_0x9761('0x10'),_0x2e82e2,_0x9761('0x11'));logger[_0x9761('0x12')](_0x9761('0x13'),_0x2e82e2,_0x9761('0x11'),JSON[_0x9761('0x14')](_0x5d7441));if(_0x5d7441[_0x9761('0x15')]){if(_0x5d7441[_0x9761('0x15')]['code']===0x1f4){logger[_0x9761('0x15')](_0x9761('0x10'),_0x2e82e2,_0x5d7441[_0x9761('0x15')][_0x9761('0x16')]);return _0x501129(_0x5d7441['error']['message']);}logger[_0x9761('0x15')](_0x9761('0x10'),_0x2e82e2,_0x5d7441[_0x9761('0x15')][_0x9761('0x16')]);return _0xaa7de8(_0x5d7441[_0x9761('0x15')][_0x9761('0x16')]);}else{logger[_0x9761('0xf')]('CmList,\x20%s,\x20%s',_0x2e82e2,_0x9761('0x11'));_0xaa7de8(_0x5d7441[_0x9761('0x17')][_0x9761('0x16')]);}})[_0x9761('0x18')](function(_0x347583){logger[_0x9761('0x15')]('CmList,\x20%s,\x20%s',_0x2e82e2,_0x347583);_0x501129(_0x347583);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index c98ef1a..2558a15 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 _0x8c79=['./cmList.events','emit','length'];(function(_0x5c67dd,_0x13dd6c){var _0x1bdb4b=function(_0x3f1967){while(--_0x3f1967){_0x5c67dd['push'](_0x5c67dd['shift']());}};_0x1bdb4b(++_0x13dd6c);}(_0x8c79,0xa8));var _0x98c7=function(_0x4bd374,_0x1b9051){_0x4bd374=_0x4bd374-0x0;var _0x4959a0=_0x8c79[_0x4bd374];return _0x4959a0;};'use strict';var CmListEvents=require(_0x98c7('0x0'));var events=['save','remove','update'];function createListener(_0x14ca25,_0x55824b){return function(_0x255cd6){_0x55824b[_0x98c7('0x1')](_0x14ca25,_0x255cd6);};}function removeListener(_0x5ecf19,_0x456fb6){return function(){CmListEvents['removeListener'](_0x5ecf19,_0x456fb6);};}exports['register']=function(_0x553d51){for(var _0x9e9609=0x0,_0x57b072=events[_0x98c7('0x2')];_0x9e9609<_0x57b072;_0x9e9609++){var _0x25dd4c=events[_0x9e9609];var _0x513208=createListener('cmList:'+_0x25dd4c,_0x553d51);CmListEvents['on'](_0x25dd4c,_0x513208);}}; \ No newline at end of file +var _0xf2e0=['save','update','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x3a52de,_0x6a12b7){var _0x3844d4=function(_0x153ae4){while(--_0x153ae4){_0x3a52de['push'](_0x3a52de['shift']());}};_0x3844d4(++_0x6a12b7);}(_0xf2e0,0xc7));var _0x0f2e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xf2e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var CmListEvents=require(_0x0f2e('0x0'));var events=[_0x0f2e('0x1'),'remove',_0x0f2e('0x2')];function createListener(_0x359e6e,_0x48b292){return function(_0x3261d6){_0x48b292[_0x0f2e('0x3')](_0x359e6e,_0x3261d6);};}function removeListener(_0x363be3,_0x4d60de){return function(){CmListEvents[_0x0f2e('0x4')](_0x363be3,_0x4d60de);};}exports[_0x0f2e('0x5')]=function(_0x256aba){for(var _0x47c448=0x0,_0x51a040=events[_0x0f2e('0x6')];_0x47c448<_0x51a040;_0x47c448++){var _0x53de0f=events[_0x47c448];var _0x1e28ed=createListener(_0x0f2e('0x7')+_0x53de0f,_0x256aba);CmListEvents['on'](_0x53de0f,_0x1e28ed);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 93edeba..1867ce4 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 _0x66b3=['getAgents','post','create','addDisposition','/:id/users','addAgents','destroy','delete','removeDispositions','removeAgents','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts/csv','/:id/fields','getCustomFields'];(function(_0x4e3cf3,_0x1e7822){var _0x332bfe=function(_0x56bcd7){while(--_0x56bcd7){_0x4e3cf3['push'](_0x4e3cf3['shift']());}};_0x332bfe(++_0x1e7822);}(_0x66b3,0x19f));var _0x366b=function(_0x24c76d,_0x473c10){_0x24c76d=_0x24c76d-0x0;var _0x5093ca=_0x66b3[_0x24c76d];return _0x5093ca;};'use strict';var multer=require('multer');var util=require(_0x366b('0x0'));var path=require(_0x366b('0x1'));var timeout=require('connect-timeout');var express=require(_0x366b('0x2'));var router=express[_0x366b('0x3')]();var auth=require(_0x366b('0x4'));var interaction=require(_0x366b('0x5'));var config=require(_0x366b('0x6'));var controller=require('./cmList.controller');router[_0x366b('0x7')]('/',auth[_0x366b('0x8')](),controller[_0x366b('0x9')]);router[_0x366b('0x7')](_0x366b('0xa'),auth[_0x366b('0x8')](),controller['describe']);router[_0x366b('0x7')](_0x366b('0xb'),auth[_0x366b('0x8')](),controller['show']);router[_0x366b('0x7')](_0x366b('0xc'),auth['isAuthenticated'](),controller[_0x366b('0xd')]);router[_0x366b('0x7')]('/:id/contacts',auth[_0x366b('0x8')](),controller['getContacts']);router['get'](_0x366b('0xe'),auth[_0x366b('0x8')](),controller['getContactsCsv']);router['get'](_0x366b('0xf'),auth[_0x366b('0x8')](),controller[_0x366b('0x10')]);router[_0x366b('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x366b('0x11')]);router[_0x366b('0x12')]('/',auth[_0x366b('0x8')](),controller[_0x366b('0x13')]);router[_0x366b('0x12')](_0x366b('0xc'),auth[_0x366b('0x8')](),controller[_0x366b('0x14')]);router[_0x366b('0x12')]('/:id/contacts',auth[_0x366b('0x8')](),controller['addContacts']);router['post'](_0x366b('0xf'),auth['isAuthenticated'](),controller['addCustomField']);router[_0x366b('0x12')](_0x366b('0x15'),auth['isAuthenticated'](),controller[_0x366b('0x16')]);router['put'](_0x366b('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x366b('0xb'),auth['isAuthenticated'](),controller[_0x366b('0x17')]);router[_0x366b('0x18')](_0x366b('0xc'),auth['isAuthenticated'](),controller[_0x366b('0x19')]);router[_0x366b('0x18')](_0x366b('0x15'),auth[_0x366b('0x8')](),controller[_0x366b('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xce59=['/:id','show','/:id/dispositions','getDispositions','getContacts','/:id/contacts/csv','getCustomFields','/:id/users','getAgents','create','addDisposition','post','/:id/contacts','/:id/fields','addAgents','put','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe','get'];(function(_0x2e2d89,_0x4bb615){var _0x3aba90=function(_0x9daf58){while(--_0x9daf58){_0x2e2d89['push'](_0x2e2d89['shift']());}};_0x3aba90(++_0x4bb615);}(_0xce59,0x1f4));var _0x9ce5=function(_0x580d0e,_0x1e5f43){_0x580d0e=_0x580d0e-0x0;var _0xb51111=_0xce59[_0x580d0e];return _0xb51111;};'use strict';var multer=require(_0x9ce5('0x0'));var util=require(_0x9ce5('0x1'));var path=require(_0x9ce5('0x2'));var timeout=require(_0x9ce5('0x3'));var express=require(_0x9ce5('0x4'));var router=express['Router']();var auth=require(_0x9ce5('0x5'));var interaction=require(_0x9ce5('0x6'));var config=require('../../config/environment');var controller=require('./cmList.controller');router['get']('/',auth[_0x9ce5('0x7')](),controller[_0x9ce5('0x8')]);router['get'](_0x9ce5('0x9'),auth['isAuthenticated'](),controller[_0x9ce5('0xa')]);router[_0x9ce5('0xb')](_0x9ce5('0xc'),auth['isAuthenticated'](),controller[_0x9ce5('0xd')]);router[_0x9ce5('0xb')](_0x9ce5('0xe'),auth[_0x9ce5('0x7')](),controller[_0x9ce5('0xf')]);router[_0x9ce5('0xb')]('/:id/contacts',auth[_0x9ce5('0x7')](),controller[_0x9ce5('0x10')]);router[_0x9ce5('0xb')](_0x9ce5('0x11'),auth[_0x9ce5('0x7')](),controller['getContactsCsv']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x9ce5('0x12')]);router[_0x9ce5('0xb')](_0x9ce5('0x13'),auth['isAuthenticated'](),controller[_0x9ce5('0x14')]);router['post']('/',auth[_0x9ce5('0x7')](),controller[_0x9ce5('0x15')]);router['post'](_0x9ce5('0xe'),auth[_0x9ce5('0x7')](),controller[_0x9ce5('0x16')]);router[_0x9ce5('0x17')](_0x9ce5('0x18'),auth[_0x9ce5('0x7')](),controller['addContacts']);router[_0x9ce5('0x17')](_0x9ce5('0x19'),auth[_0x9ce5('0x7')](),controller['addCustomField']);router['post'](_0x9ce5('0x13'),auth['isAuthenticated'](),controller[_0x9ce5('0x1a')]);router[_0x9ce5('0x1b')]('/:id',auth[_0x9ce5('0x7')](),controller[_0x9ce5('0x1c')]);router[_0x9ce5('0x1d')](_0x9ce5('0xc'),auth[_0x9ce5('0x7')](),controller['destroy']);router['delete'](_0x9ce5('0xe'),auth[_0x9ce5('0x7')](),controller['removeDispositions']);router[_0x9ce5('0x1d')](_0x9ce5('0x13'),auth[_0x9ce5('0x7')](),controller[_0x9ce5('0x1e')]);module[_0x9ce5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index b31c095..d72f12e 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(_0xa890e9,_0x46883c){var _0x5d2339=function(_0x2c54db){while(--_0x2c54db){_0xa890e9['push'](_0xa890e9['shift']());}};_0x5d2339(++_0x46883c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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(_0x50e459,_0x11196e){var _0x2e4a07=function(_0x362b2f){while(--_0x362b2f){_0x50e459['push'](_0x50e459['shift']());}};_0x2e4a07(++_0x11196e);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'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 2413ecb..5dd1365 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 _0xb9be=['../../mysqldb','count','offset','limit','status','set','Content-Range','json','apply','save','update','destroy','then','end','sendStatus','error','name','body','Condition','find','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x5c9b7f,_0x10061f){var _0x5adb5f=function(_0xe5ec3d){while(--_0xe5ec3d){_0x5c9b7f['push'](_0x5c9b7f['shift']());}};_0x5adb5f(++_0x10061f);}(_0xb9be,0xc5));var _0xeb9b=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xb9be[_0x3e6d5d];return _0x238923;};'use strict';var pdf=require(_0xeb9b('0x0'));var emlformat=require(_0xeb9b('0x1'));var rimraf=require(_0xeb9b('0x2'));var zipdir=require(_0xeb9b('0x3'));var jsonpatch=require(_0xeb9b('0x4'));var rp=require(_0xeb9b('0x5'));var moment=require(_0xeb9b('0x6'));var BPromise=require(_0xeb9b('0x7'));var Mustache=require(_0xeb9b('0x8'));var util=require('util');var path=require('path');var sox=require(_0xeb9b('0x9'));var csv=require(_0xeb9b('0xa'));var ejs=require(_0xeb9b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeb9b('0xc'));var crypto=require(_0xeb9b('0xd'));var jsforce=require(_0xeb9b('0xe'));var deskjs=require(_0xeb9b('0xf'));var toCsv=require(_0xeb9b('0xa'));var querystring=require(_0xeb9b('0x10'));var Papa=require(_0xeb9b('0x11'));var Redis=require(_0xeb9b('0x12'));var authService=require(_0xeb9b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9b('0x15'));var utils=require(_0xeb9b('0x16'));var config=require('../../config/environment');var db=require(_0xeb9b('0x17'))['db'];function respondWithStatusCode(_0x1def58,_0x3df18a){_0x3df18a=_0x3df18a||0xcc;return function(_0x2a01df){if(_0x2a01df){return _0x1def58['sendStatus'](_0x3df18a);}return _0x1def58['status'](_0x3df18a)['end']();};}function respondWithResult(_0x355edb,_0x1ef03f){_0x1ef03f=_0x1ef03f||0xc8;return function(_0x2674e6){if(_0x2674e6){return _0x355edb['status'](_0x1ef03f)['json'](_0x2674e6);}};}function respondWithFilteredResult(_0x4f8182,_0x32538b){return function(_0x1a5f27){if(_0x1a5f27){var _0x406afd=_0x1a5f27[_0xeb9b('0x18')],_0x3fa308=_0x32538b['offset'],_0x2c9aa6=_0x32538b[_0xeb9b('0x19')]+_0x32538b[_0xeb9b('0x1a')],_0x10da6e;if(_0x2c9aa6>=_0x406afd){_0x2c9aa6=_0x406afd;_0x10da6e=0xc8;}else{_0x10da6e=0xce;}_0x4f8182[_0xeb9b('0x1b')](_0x10da6e);return _0x4f8182[_0xeb9b('0x1c')](_0xeb9b('0x1d'),_0x3fa308+'-'+_0x2c9aa6+'/'+_0x406afd)[_0xeb9b('0x1e')](_0x1a5f27);}return null;};}function patchUpdates(_0x21010e){return function(_0x3342c1){try{jsonpatch[_0xeb9b('0x1f')](_0x3342c1,_0x21010e,!![]);}catch(_0x26e312){return BPromise['reject'](_0x26e312);}return _0x3342c1[_0xeb9b('0x20')]();};}function saveUpdates(_0x5a7ffd,_0x5d5f54){return function(_0x580498){if(_0x580498){return _0x580498[_0xeb9b('0x21')](_0x5a7ffd)['then'](function(_0xbed5ce){return _0xbed5ce;});}return null;};}function removeEntity(_0x2dabb1,_0x37935c){return function(_0x37d7e0){if(_0x37d7e0){return _0x37d7e0[_0xeb9b('0x22')]()[_0xeb9b('0x23')](function(){_0x2dabb1[_0xeb9b('0x1b')](0xcc)[_0xeb9b('0x24')]();});}};}function handleEntityNotFound(_0x142d1c,_0x46df93){return function(_0x61c86d){if(!_0x61c86d){_0x142d1c[_0xeb9b('0x25')](0x194);}return _0x61c86d;};}function handleError(_0x1a4faf,_0xe6d3e1){_0xe6d3e1=_0xe6d3e1||0x1f4;return function(_0x2b2a14){logger[_0xeb9b('0x26')](_0x2b2a14['stack']);if(_0x2b2a14[_0xeb9b('0x27')]){delete _0x2b2a14['name'];}_0x1a4faf[_0xeb9b('0x1b')](_0xe6d3e1)['send'](_0x2b2a14);};}exports[_0xeb9b('0x21')]=function(_0x4361b9,_0x7e0134){if(_0x4361b9[_0xeb9b('0x28')]['id']){delete _0x4361b9['body']['id'];}return db[_0xeb9b('0x29')][_0xeb9b('0x2a')]({'where':{'id':_0x4361b9['params']['id']}})[_0xeb9b('0x23')](handleEntityNotFound(_0x7e0134,null))[_0xeb9b('0x23')](saveUpdates(_0x4361b9['body'],null))[_0xeb9b('0x23')](respondWithResult(_0x7e0134,null))[_0xeb9b('0x2b')](handleError(_0x7e0134,null));};exports[_0xeb9b('0x22')]=function(_0x48c5f4,_0x309bad){return db['Condition'][_0xeb9b('0x2a')]({'where':{'id':_0x48c5f4['params']['id']}})[_0xeb9b('0x23')](handleEntityNotFound(_0x309bad,null))['then'](removeEntity(_0x309bad,null))[_0xeb9b('0x2b')](handleError(_0x309bad,null));}; \ No newline at end of file +var _0xbc6f=['apply','save','update','then','destroy','error','stack','name','send','body','Condition','find','params','catch','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range'];(function(_0x123985,_0x489296){var _0x176258=function(_0x192b10){while(--_0x192b10){_0x123985['push'](_0x123985['shift']());}};_0x176258(++_0x489296);}(_0xbc6f,0x166));var _0xfbc6=function(_0x1c07c3,_0x41e664){_0x1c07c3=_0x1c07c3-0x0;var _0x3728b4=_0xbc6f[_0x1c07c3];return _0x3728b4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfbc6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbc6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xfbc6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfbc6('0x3'));var util=require(_0xfbc6('0x4'));var path=require(_0xfbc6('0x5'));var sox=require(_0xfbc6('0x6'));var csv=require(_0xfbc6('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfbc6('0x8'));var squel=require(_0xfbc6('0x9'));var crypto=require(_0xfbc6('0xa'));var jsforce=require(_0xfbc6('0xb'));var deskjs=require(_0xfbc6('0xc'));var toCsv=require(_0xfbc6('0x7'));var querystring=require(_0xfbc6('0xd'));var Papa=require('papaparse');var Redis=require(_0xfbc6('0xe'));var authService=require(_0xfbc6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfbc6('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfbc6('0x11'))(_0xfbc6('0x12'));var utils=require(_0xfbc6('0x13'));var config=require('../../config/environment');var db=require(_0xfbc6('0x14'))['db'];function respondWithStatusCode(_0x4aef87,_0x5ec97a){_0x5ec97a=_0x5ec97a||0xcc;return function(_0x40433b){if(_0x40433b){return _0x4aef87[_0xfbc6('0x15')](_0x5ec97a);}return _0x4aef87[_0xfbc6('0x16')](_0x5ec97a)[_0xfbc6('0x17')]();};}function respondWithResult(_0xc3fb53,_0x10ae22){_0x10ae22=_0x10ae22||0xc8;return function(_0x386cf1){if(_0x386cf1){return _0xc3fb53[_0xfbc6('0x16')](_0x10ae22)[_0xfbc6('0x18')](_0x386cf1);}};}function respondWithFilteredResult(_0x2e2bae,_0xbdc135){return function(_0x131764){if(_0x131764){var _0x25f1f1=_0x131764[_0xfbc6('0x19')],_0x1846e0=_0xbdc135[_0xfbc6('0x1a')],_0x409a90=_0xbdc135[_0xfbc6('0x1a')]+_0xbdc135[_0xfbc6('0x1b')],_0xa25066;if(_0x409a90>=_0x25f1f1){_0x409a90=_0x25f1f1;_0xa25066=0xc8;}else{_0xa25066=0xce;}_0x2e2bae[_0xfbc6('0x16')](_0xa25066);return _0x2e2bae['set'](_0xfbc6('0x1c'),_0x1846e0+'-'+_0x409a90+'/'+_0x25f1f1)[_0xfbc6('0x18')](_0x131764);}return null;};}function patchUpdates(_0xcebc61){return function(_0x5d9bfa){try{jsonpatch[_0xfbc6('0x1d')](_0x5d9bfa,_0xcebc61,!![]);}catch(_0x1e0650){return BPromise['reject'](_0x1e0650);}return _0x5d9bfa[_0xfbc6('0x1e')]();};}function saveUpdates(_0x539a1e,_0x1e0bb8){return function(_0x374c6f){if(_0x374c6f){return _0x374c6f[_0xfbc6('0x1f')](_0x539a1e)[_0xfbc6('0x20')](function(_0x48a7fe){return _0x48a7fe;});}return null;};}function removeEntity(_0x43ad2e,_0x3707f2){return function(_0x2671e5){if(_0x2671e5){return _0x2671e5[_0xfbc6('0x21')]()['then'](function(){_0x43ad2e[_0xfbc6('0x16')](0xcc)[_0xfbc6('0x17')]();});}};}function handleEntityNotFound(_0x4a0095,_0x3731b7){return function(_0x4faf24){if(!_0x4faf24){_0x4a0095[_0xfbc6('0x15')](0x194);}return _0x4faf24;};}function handleError(_0x372a59,_0x597c22){_0x597c22=_0x597c22||0x1f4;return function(_0xe8a076){logger[_0xfbc6('0x22')](_0xe8a076[_0xfbc6('0x23')]);if(_0xe8a076[_0xfbc6('0x24')]){delete _0xe8a076['name'];}_0x372a59[_0xfbc6('0x16')](_0x597c22)[_0xfbc6('0x25')](_0xe8a076);};}exports['update']=function(_0x121113,_0x3e2365){if(_0x121113[_0xfbc6('0x26')]['id']){delete _0x121113[_0xfbc6('0x26')]['id'];}return db[_0xfbc6('0x27')][_0xfbc6('0x28')]({'where':{'id':_0x121113['params']['id']}})['then'](handleEntityNotFound(_0x3e2365,null))[_0xfbc6('0x20')](saveUpdates(_0x121113[_0xfbc6('0x26')],null))[_0xfbc6('0x20')](respondWithResult(_0x3e2365,null))['catch'](handleError(_0x3e2365,null));};exports[_0xfbc6('0x21')]=function(_0x31c61d,_0x28b3c9){return db['Condition']['find']({'where':{'id':_0x31c61d[_0xfbc6('0x29')]['id']}})[_0xfbc6('0x20')](handleEntityNotFound(_0x28b3c9,null))[_0xfbc6('0x20')](removeEntity(_0x28b3c9,null))[_0xfbc6('0x2a')](handleError(_0x28b3c9,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index b5c32d6..feef117 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 _0x084f=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions'];(function(_0x4c7377,_0x2a68d0){var _0x28fdf6=function(_0x383065){while(--_0x383065){_0x4c7377['push'](_0x4c7377['shift']());}};_0x28fdf6(++_0x2a68d0);}(_0x084f,0x160));var _0xf084=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x084f[_0x433a86];return _0x23000c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf084('0x0'))('api');var moment=require('moment');var BPromise=require(_0xf084('0x1'));var rp=require(_0xf084('0x2'));var fs=require('fs');var path=require(_0xf084('0x3'));var rimraf=require(_0xf084('0x4'));var config=require(_0xf084('0x5'));var attributes=require(_0xf084('0x6'));module[_0xf084('0x7')]=function(_0x1cf223,_0x562db5){return _0x1cf223[_0xf084('0x8')](_0xf084('0x9'),attributes,{'tableName':_0xf084('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b37=['bluebird','request-promise','path','../../config/environment','exports','define','tools_conditions','lodash','util','../../config/logger','api'];(function(_0x212fcc,_0x1a8867){var _0x4d8190=function(_0x347f7b){while(--_0x347f7b){_0x212fcc['push'](_0x212fcc['shift']());}};_0x4d8190(++_0x1a8867);}(_0x5b37,0x151));var _0x75b3=function(_0x113cf9,_0x358825){_0x113cf9=_0x113cf9-0x0;var _0x5842ad=_0x5b37[_0x113cf9];return _0x5842ad;};'use strict';var _=require(_0x75b3('0x0'));var util=require(_0x75b3('0x1'));var logger=require(_0x75b3('0x2'))(_0x75b3('0x3'));var moment=require('moment');var BPromise=require(_0x75b3('0x4'));var rp=require(_0x75b3('0x5'));var fs=require('fs');var path=require(_0x75b3('0x6'));var rimraf=require('rimraf');var config=require(_0x75b3('0x7'));var attributes=require('./condition.attributes');module[_0x75b3('0x8')]=function(_0x487006,_0x549c81){return _0x487006[_0x75b3('0x9')]('Condition',attributes,{'tableName':_0x75b3('0xa'),'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 2f3142f..19a99e8 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 _0xf25e=['request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xf25e,0xbc));var _0xef25=function(_0x3e8b71,_0x41dd0d){_0x3e8b71=_0x3e8b71-0x0;var _0x147a06=_0xf25e[_0x3e8b71];return _0x147a06;};'use strict';var _=require(_0xef25('0x0'));var util=require('util');var moment=require(_0xef25('0x1'));var BPromise=require(_0xef25('0x2'));var rs=require(_0xef25('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef25('0x4'))['db'];var utils=require(_0xef25('0x5'));var logger=require(_0xef25('0x6'))(_0xef25('0x7'));var config=require('../../config/environment');var jayson=require(_0xef25('0x8'));var client=jayson[_0xef25('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ee749,_0xa86bb,_0x5aff60){return new BPromise(function(_0x4276e4,_0x4d6a04){return client[_0xef25('0xa')](_0x1ee749,_0x5aff60)[_0xef25('0xb')](function(_0x37a329){logger[_0xef25('0xc')](_0xef25('0xd'),_0xa86bb,_0xef25('0xe'));logger[_0xef25('0xf')](_0xef25('0x10'),_0xa86bb,_0xef25('0xe'),JSON[_0xef25('0x11')](_0x37a329));if(_0x37a329[_0xef25('0x12')]){if(_0x37a329[_0xef25('0x12')][_0xef25('0x13')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0xa86bb,_0x37a329['error'][_0xef25('0x14')]);return _0x4d6a04(_0x37a329[_0xef25('0x12')][_0xef25('0x14')]);}logger[_0xef25('0x12')](_0xef25('0xd'),_0xa86bb,_0x37a329[_0xef25('0x12')][_0xef25('0x14')]);return _0x4276e4(_0x37a329[_0xef25('0x12')][_0xef25('0x14')]);}else{logger[_0xef25('0xc')](_0xef25('0xd'),_0xa86bb,_0xef25('0xe'));_0x4276e4(_0x37a329[_0xef25('0x15')][_0xef25('0x14')]);}})['catch'](function(_0x2ae983){logger[_0xef25('0x12')](_0xef25('0xd'),_0xa86bb,_0x2ae983);_0x4d6a04(_0x2ae983);});});} \ No newline at end of file +var _0x496b=['error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4052b5,_0x4a1a6a){var _0x4360da=function(_0x4bfb55){while(--_0x4bfb55){_0x4052b5['push'](_0x4052b5['shift']());}};_0x4360da(++_0x4a1a6a);}(_0x496b,0x147));var _0xb496=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0x496b[_0x47b15f];return _0x55bf25;};'use strict';var _=require(_0xb496('0x0'));var util=require(_0xb496('0x1'));var moment=require(_0xb496('0x2'));var BPromise=require('bluebird');var rs=require(_0xb496('0x3'));var fs=require('fs');var Redis=require(_0xb496('0x4'));var db=require(_0xb496('0x5'))['db'];var utils=require(_0xb496('0x6'));var logger=require('../../config/logger')(_0xb496('0x7'));var config=require(_0xb496('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb496('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4abe16,_0x48b501,_0x52c232){return new BPromise(function(_0x5b0a79,_0x63b379){return client[_0xb496('0xa')](_0x4abe16,_0x52c232)[_0xb496('0xb')](function(_0x8be6e5){logger[_0xb496('0xc')](_0xb496('0xd'),_0x48b501,_0xb496('0xe'));logger[_0xb496('0xf')](_0xb496('0x10'),_0x48b501,'request\x20sent',JSON[_0xb496('0x11')](_0x8be6e5));if(_0x8be6e5[_0xb496('0x12')]){if(_0x8be6e5[_0xb496('0x12')][_0xb496('0x13')]===0x1f4){logger[_0xb496('0x12')]('Condition,\x20%s,\x20%s',_0x48b501,_0x8be6e5['error'][_0xb496('0x14')]);return _0x63b379(_0x8be6e5[_0xb496('0x12')][_0xb496('0x14')]);}logger[_0xb496('0x12')](_0xb496('0xd'),_0x48b501,_0x8be6e5[_0xb496('0x12')][_0xb496('0x14')]);return _0x5b0a79(_0x8be6e5[_0xb496('0x12')][_0xb496('0x14')]);}else{logger[_0xb496('0xc')]('Condition,\x20%s,\x20%s',_0x48b501,_0xb496('0xe'));_0x5b0a79(_0x8be6e5[_0xb496('0x15')]['message']);}})[_0xb496('0x16')](function(_0x485883){logger[_0xb496('0x12')](_0xb496('0xd'),_0x48b501,_0x485883);_0x63b379(_0x485883);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 1badfd3..055830f 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 _0x0e72=['delete','/:id','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./condition.controller','update'];(function(_0x3d7075,_0x3a34fc){var _0x3e8328=function(_0x325bbc){while(--_0x325bbc){_0x3d7075['push'](_0x3d7075['shift']());}};_0x3e8328(++_0x3a34fc);}(_0x0e72,0x148));var _0x20e7=function(_0x39af3a,_0x1f050b){_0x39af3a=_0x39af3a-0x0;var _0x4e7415=_0x0e72[_0x39af3a];return _0x4e7415;};'use strict';var multer=require(_0x20e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x20e7('0x1'));var express=require(_0x20e7('0x2'));var router=express[_0x20e7('0x3')]();var auth=require(_0x20e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x20e7('0x5'));var controller=require(_0x20e7('0x6'));router['put']('/:id',auth['isAuthenticated'](),controller[_0x20e7('0x7')]);router[_0x20e7('0x8')](_0x20e7('0x9'),auth['isAuthenticated'](),controller[_0x20e7('0xa')]);module[_0x20e7('0xb')]=router; \ No newline at end of file +var _0xd27b=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./condition.controller','put','isAuthenticated','update','destroy','exports'];(function(_0xaa11e4,_0x270698){var _0x2a1b22=function(_0x222713){while(--_0x222713){_0xaa11e4['push'](_0xaa11e4['shift']());}};_0x2a1b22(++_0x270698);}(_0xd27b,0x111));var _0xbd27=function(_0x36e8e4,_0x213a61){_0x36e8e4=_0x36e8e4-0x0;var _0x491ac7=_0xd27b[_0x36e8e4];return _0x491ac7;};'use strict';var multer=require('multer');var util=require(_0xbd27('0x0'));var path=require(_0xbd27('0x1'));var timeout=require(_0xbd27('0x2'));var express=require(_0xbd27('0x3'));var router=express[_0xbd27('0x4')]();var auth=require(_0xbd27('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbd27('0x6'));var controller=require(_0xbd27('0x7'));router[_0xbd27('0x8')]('/:id',auth[_0xbd27('0x9')](),controller[_0xbd27('0xa')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xbd27('0xb')]);module[_0xbd27('0xc')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 37cd1fc..99d8526 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 _0x55e2=['sequelize','exports','STRING'];(function(_0x4d7765,_0x2ec4bd){var _0x146c1a=function(_0x384776){while(--_0x384776){_0x4d7765['push'](_0x4d7765['shift']());}};_0x146c1a(++_0x2ec4bd);}(_0x55e2,0xd8));var _0x255e=function(_0x523098,_0x3e214a){_0x523098=_0x523098-0x0;var _0xcdf5e0=_0x55e2[_0x523098];return _0xcdf5e0;};'use strict';var Sequelize=require(_0x255e('0x0'));module[_0x255e('0x1')]={'name':{'type':Sequelize[_0x255e('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6dd4=['name','sequelize','exports','STRING'];(function(_0x510f02,_0x4b0f01){var _0x412d65=function(_0x258e43){while(--_0x258e43){_0x510f02['push'](_0x510f02['shift']());}};_0x412d65(++_0x4b0f01);}(_0x6dd4,0x129));var _0x46dd=function(_0x3ac054,_0x558393){_0x3ac054=_0x3ac054-0x0;var _0x472577=_0x6dd4[_0x3ac054];return _0x472577;};'use strict';var Sequelize=require(_0x46dd('0x0'));module[_0x46dd('0x1')]={'name':{'type':Sequelize[_0x46dd('0x2')],'allowNull':![],'unique':_0x46dd('0x3')},'description':{'type':Sequelize[_0x46dd('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 4bdd9f6..54b0c5a 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 _0xd2e3=['userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','include','createdAt','omit','updatedAt','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','nolimit','getItems','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','CustomDashboards','sendStatus','stack','name','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','findAll','catch','params','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection'];(function(_0x48764a,_0x1590bc){var _0x31828b=function(_0x1fce43){while(--_0x1fce43){_0x48764a['push'](_0x48764a['shift']());}};_0x31828b(++_0x1590bc);}(_0xd2e3,0x10a));var _0x3d2e=function(_0x3405e7,_0x125160){_0x3405e7=_0x3405e7-0x0;var _0x363901=_0xd2e3[_0x3405e7];return _0x363901;};'use strict';var pdf=require(_0x3d2e('0x0'));var emlformat=require(_0x3d2e('0x1'));var rimraf=require(_0x3d2e('0x2'));var zipdir=require(_0x3d2e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d2e('0x4'));var moment=require('moment');var BPromise=require(_0x3d2e('0x5'));var Mustache=require(_0x3d2e('0x6'));var util=require(_0x3d2e('0x7'));var path=require(_0x3d2e('0x8'));var sox=require(_0x3d2e('0x9'));var csv=require(_0x3d2e('0xa'));var ejs=require(_0x3d2e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3d2e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3d2e('0xd'));var toCsv=require(_0x3d2e('0xa'));var querystring=require(_0x3d2e('0xe'));var Papa=require(_0x3d2e('0xf'));var Redis=require(_0x3d2e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3d2e('0x11'));var as=require(_0x3d2e('0x12'));var hardwareService=require(_0x3d2e('0x13'));var logger=require(_0x3d2e('0x14'))('api');var utils=require(_0x3d2e('0x15'));var config=require('../../config/environment');var db=require(_0x3d2e('0x16'))['db'];config[_0x3d2e('0x17')]=_[_0x3d2e('0x18')](config[_0x3d2e('0x17')],{'host':_0x3d2e('0x19'),'port':0x18eb});var socket=require(_0x3d2e('0x1a'))(new Redis(config['redis']));require(_0x3d2e('0x1b'))['register'](socket);function respondWithStatusCode(_0x302436,_0x440434){_0x440434=_0x440434||0xcc;return function(_0x5d6619){if(_0x5d6619){return _0x302436['sendStatus'](_0x440434);}return _0x302436[_0x3d2e('0x1c')](_0x440434)[_0x3d2e('0x1d')]();};}function respondWithResult(_0x5e59ed,_0x50303d){_0x50303d=_0x50303d||0xc8;return function(_0x474c04){if(_0x474c04){return _0x5e59ed[_0x3d2e('0x1c')](_0x50303d)[_0x3d2e('0x1e')](_0x474c04);}};}function respondWithFilteredResult(_0x29e6ee,_0x111d41){return function(_0x320849){if(_0x320849){var _0xd30619=_0x320849[_0x3d2e('0x1f')],_0x5e8f1b=_0x111d41[_0x3d2e('0x20')],_0x50f46a=_0x111d41[_0x3d2e('0x20')]+_0x111d41[_0x3d2e('0x21')],_0x3baaf4;if(_0x50f46a>=_0xd30619){_0x50f46a=_0xd30619;_0x3baaf4=0xc8;}else{_0x3baaf4=0xce;}_0x29e6ee['status'](_0x3baaf4);return _0x29e6ee[_0x3d2e('0x22')](_0x3d2e('0x23'),_0x5e8f1b+'-'+_0x50f46a+'/'+_0xd30619)[_0x3d2e('0x1e')](_0x320849);}return null;};}function patchUpdates(_0xaaf5b1){return function(_0x3791b2){try{jsonpatch[_0x3d2e('0x24')](_0x3791b2,_0xaaf5b1,!![]);}catch(_0x395564){return BPromise[_0x3d2e('0x25')](_0x395564);}return _0x3791b2['save']();};}function saveUpdates(_0x4ca8c3,_0x289ef6){return function(_0x11b381){if(_0x11b381){return _0x11b381[_0x3d2e('0x26')](_0x4ca8c3)[_0x3d2e('0x27')](function(_0x1412f6){return _0x1412f6;});}return null;};}function removeEntity(_0x5cfe6c,_0x3a90f4){return function(_0x3693e3){if(_0x3693e3){return _0x3693e3[_0x3d2e('0x28')]()[_0x3d2e('0x27')](function(){var _0xafdb65=_0x3693e3['get']({'plain':!![]});var _0x3ca975=_0x3d2e('0x29');return db['UserProfileResource'][_0x3d2e('0x28')]({'where':{'type':_0x3ca975,'resourceId':_0xafdb65['id']}})[_0x3d2e('0x27')](function(){return _0x3693e3;});})[_0x3d2e('0x27')](function(){_0x5cfe6c[_0x3d2e('0x1c')](0xcc)[_0x3d2e('0x1d')]();});}};}function handleEntityNotFound(_0x4684b4,_0x3a4d85){return function(_0x1af047){if(!_0x1af047){_0x4684b4[_0x3d2e('0x2a')](0x194);}return _0x1af047;};}function handleError(_0xe11603,_0x2441cb){_0x2441cb=_0x2441cb||0x1f4;return function(_0x368d18){logger['error'](_0x368d18[_0x3d2e('0x2b')]);if(_0x368d18['name']){delete _0x368d18[_0x3d2e('0x2c')];}_0xe11603[_0x3d2e('0x1c')](_0x2441cb)['send'](_0x368d18);};}exports['index']=function(_0x403fcd,_0x45e130){var _0xe13fbe={},_0x46aeb6={},_0xf3516b={'count':0x0,'rows':[]};var _0x1d81ee=_[_0x3d2e('0x2d')](db[_0x3d2e('0x2e')][_0x3d2e('0x2f')],function(_0xf8f5d1){return{'name':_0xf8f5d1[_0x3d2e('0x30')],'type':_0xf8f5d1[_0x3d2e('0x31')][_0x3d2e('0x32')]};});_0x46aeb6[_0x3d2e('0x33')]=_[_0x3d2e('0x2d')](_0x1d81ee,_0x3d2e('0x2c'));_0x46aeb6['query']=_[_0x3d2e('0x34')](_0x403fcd['query']);_0x46aeb6[_0x3d2e('0x35')]=_[_0x3d2e('0x36')](_0x46aeb6['model'],_0x46aeb6[_0x3d2e('0x37')]);_0xe13fbe[_0x3d2e('0x38')]=_[_0x3d2e('0x36')](_0x46aeb6[_0x3d2e('0x33')],qs['fields'](_0x403fcd[_0x3d2e('0x37')][_0x3d2e('0x39')]));_0xe13fbe[_0x3d2e('0x38')]=_0xe13fbe[_0x3d2e('0x38')][_0x3d2e('0x3a')]?_0xe13fbe[_0x3d2e('0x38')]:_0x46aeb6[_0x3d2e('0x33')];if(!_0x403fcd[_0x3d2e('0x37')][_0x3d2e('0x3b')]('nolimit')){_0xe13fbe[_0x3d2e('0x21')]=qs[_0x3d2e('0x21')](_0x403fcd['query'][_0x3d2e('0x21')]);_0xe13fbe[_0x3d2e('0x20')]=qs[_0x3d2e('0x20')](_0x403fcd['query'][_0x3d2e('0x20')]);}_0xe13fbe[_0x3d2e('0x3c')]=qs[_0x3d2e('0x3d')](_0x403fcd[_0x3d2e('0x37')]['sort']);_0xe13fbe[_0x3d2e('0x3e')]=qs['filters'](_[_0x3d2e('0x3f')](_0x403fcd['query'],_0x46aeb6['filters']));if(_0x403fcd[_0x3d2e('0x37')][_0x3d2e('0x40')]){_0xe13fbe[_0x3d2e('0x3e')]=_['merge'](_0xe13fbe[_0x3d2e('0x3e')],{'$or':_[_0x3d2e('0x2d')](_0x1d81ee,function(_0x395531){if(_0x395531['type']!=='VIRTUAL'){var _0x1d40fb={};_0x1d40fb[_0x395531[_0x3d2e('0x2c')]]={'$like':'%'+_0x403fcd[_0x3d2e('0x37')]['filter']+'%'};return _0x1d40fb;}})});}_0xe13fbe=_[_0x3d2e('0x41')]({},_0xe13fbe,_0x403fcd[_0x3d2e('0x42')]);var _0x17ce91={'where':_0xe13fbe[_0x3d2e('0x3e')]};return db['Dashboard']['count'](_0x17ce91)[_0x3d2e('0x27')](function(_0x1c1e1a){_0xf3516b[_0x3d2e('0x1f')]=_0x1c1e1a;if(_0x403fcd[_0x3d2e('0x37')]['includeAll']){_0xe13fbe['include']=[{'all':!![]}];}return db[_0x3d2e('0x2e')][_0x3d2e('0x43')](_0xe13fbe);})['then'](function(_0x4bb39f){_0xf3516b['rows']=_0x4bb39f;return _0xf3516b;})[_0x3d2e('0x27')](respondWithFilteredResult(_0x45e130,_0xe13fbe))[_0x3d2e('0x44')](handleError(_0x45e130,null));};exports['show']=function(_0x396f90,_0x52a843){var _0x124183={'raw':![],'where':{'id':_0x396f90[_0x3d2e('0x45')]['id']}},_0x44b37d={};_0x44b37d[_0x3d2e('0x33')]=_[_0x3d2e('0x34')](db[_0x3d2e('0x2e')]['rawAttributes']);_0x44b37d[_0x3d2e('0x37')]=_['keys'](_0x396f90[_0x3d2e('0x37')]);_0x44b37d[_0x3d2e('0x35')]=_[_0x3d2e('0x36')](_0x44b37d[_0x3d2e('0x33')],_0x44b37d['query']);_0x124183[_0x3d2e('0x38')]=_[_0x3d2e('0x36')](_0x44b37d[_0x3d2e('0x33')],qs['fields'](_0x396f90['query'][_0x3d2e('0x39')]));_0x124183[_0x3d2e('0x38')]=_0x124183[_0x3d2e('0x38')][_0x3d2e('0x3a')]?_0x124183['attributes']:_0x44b37d[_0x3d2e('0x33')];if(_0x396f90[_0x3d2e('0x37')][_0x3d2e('0x46')]){_0x124183['include']=[{'all':!![]}];}_0x124183=_['merge']({},_0x124183,_0x396f90[_0x3d2e('0x42')]);return db['Dashboard'][_0x3d2e('0x47')](_0x124183)['then'](handleEntityNotFound(_0x52a843,null))[_0x3d2e('0x27')](respondWithResult(_0x52a843,null))[_0x3d2e('0x44')](handleError(_0x52a843,null));};exports[_0x3d2e('0x48')]=function(_0x4240b1,_0x55843e){return db[_0x3d2e('0x2e')][_0x3d2e('0x48')](_0x4240b1[_0x3d2e('0x49')],{})[_0x3d2e('0x27')](function(_0x2e3244){var _0x298f91=_0x4240b1['user'][_0x3d2e('0x4a')]({'plain':!![]});if(!_0x298f91)throw new Error(_0x3d2e('0x4b'));if(_0x298f91[_0x3d2e('0x4c')]===_0x3d2e('0x4d')){var _0x11e984=_0x2e3244[_0x3d2e('0x4a')]({'plain':!![]});var _0x55d396=_0x3d2e('0x29');return db[_0x3d2e('0x4e')][_0x3d2e('0x47')]({'where':{'name':_0x55d396,'userProfileId':_0x298f91[_0x3d2e('0x4f')]},'raw':!![]})[_0x3d2e('0x27')](function(_0x3e58c2){if(_0x3e58c2&&_0x3e58c2[_0x3d2e('0x50')]===0x0){return db['UserProfileResource'][_0x3d2e('0x48')]({'name':_0x11e984[_0x3d2e('0x2c')],'resourceId':_0x11e984['id'],'type':_0x3e58c2[_0x3d2e('0x2c')],'sectionId':_0x3e58c2['id']},{})[_0x3d2e('0x27')](function(){return _0x2e3244;});}else{return _0x2e3244;}})['catch'](function(_0x4ff88a){logger[_0x3d2e('0x51')](_0x3d2e('0x52'),_0x4ff88a);throw _0x4ff88a;});}return _0x2e3244;})[_0x3d2e('0x27')](respondWithResult(_0x55843e,0xc9))[_0x3d2e('0x44')](handleError(_0x55843e,null));};exports['clone']=function(_0x473fb4,_0x363b7a){var _0x351bc9={'where':{'id':_0x473fb4[_0x3d2e('0x45')]['id']}},_0x210ba5={};_0x210ba5[_0x3d2e('0x33')]=_[_0x3d2e('0x34')](db[_0x3d2e('0x2e')][_0x3d2e('0x2f')]);_0x351bc9[_0x3d2e('0x38')]=_[_0x3d2e('0x36')](_0x210ba5[_0x3d2e('0x33')],qs[_0x3d2e('0x39')](_0x473fb4[_0x3d2e('0x37')][_0x3d2e('0x39')]));_0x351bc9['attributes']=_0x351bc9[_0x3d2e('0x38')]['length']?_0x351bc9['attributes']:_0x210ba5[_0x3d2e('0x33')];if(_0x473fb4[_0x3d2e('0x37')][_0x3d2e('0x46')]){_0x351bc9[_0x3d2e('0x53')]=[{'all':!![]}];}_0x351bc9=_[_0x3d2e('0x41')]({},_0x351bc9,_0x473fb4[_0x3d2e('0x42')]);return db['Dashboard'][_0x3d2e('0x47')](_0x351bc9)[_0x3d2e('0x27')](handleEntityNotFound(_0x363b7a,null))[_0x3d2e('0x27')](function(_0x3094c2){if(_0x3094c2){var _0x19c0d7=_0x3094c2[_0x3d2e('0x4a')]({'plain':!![]});_0x19c0d7=qs['omit'](_0x19c0d7,['id',_0x3d2e('0x54'),'updatedAt']);_0x473fb4['body']=_[_0x3d2e('0x55')](_0x473fb4[_0x3d2e('0x49')],['id','createdAt',_0x3d2e('0x56')]);return db['Dashboard'][_0x3d2e('0x48')](_['merge'](_0x19c0d7,_0x473fb4[_0x3d2e('0x49')]),{'include':_0x473fb4[_0x3d2e('0x37')][_0x3d2e('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x257287){var _0x3a99b5=_0x473fb4[_0x3d2e('0x4d')]['get']({'plain':!![]});if(!_0x3a99b5)throw new Error(_0x3d2e('0x4b'));if(_0x3a99b5[_0x3d2e('0x4c')]==='user'){var _0x54d7c9=_0x257287[_0x3d2e('0x4a')]({'plain':!![]});var _0x5c3f86='CustomDashboards';return db[_0x3d2e('0x4e')]['find']({'where':{'name':_0x5c3f86,'userProfileId':_0x3a99b5['userProfileId']},'raw':!![]})[_0x3d2e('0x27')](function(_0x35f2e7){if(_0x35f2e7&&_0x35f2e7[_0x3d2e('0x50')]===0x0){return db['UserProfileResource'][_0x3d2e('0x48')]({'name':_0x54d7c9[_0x3d2e('0x2c')],'resourceId':_0x54d7c9['id'],'type':_0x35f2e7[_0x3d2e('0x2c')],'sectionId':_0x35f2e7['id']},{})[_0x3d2e('0x27')](function(){return _0x257287;});}else{return _0x257287;}})[_0x3d2e('0x44')](function(_0x2e1c5c){logger[_0x3d2e('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e1c5c);throw _0x2e1c5c;});}return _0x257287;});}})[_0x3d2e('0x27')](respondWithResult(_0x363b7a,0xc9))[_0x3d2e('0x44')](handleError(_0x363b7a,null));};exports[_0x3d2e('0x26')]=function(_0x4fe845,_0x16f3df){if(_0x4fe845[_0x3d2e('0x49')]['id']){delete _0x4fe845[_0x3d2e('0x49')]['id'];}return db[_0x3d2e('0x2e')][_0x3d2e('0x47')]({'where':{'id':_0x4fe845[_0x3d2e('0x45')]['id']}})[_0x3d2e('0x27')](handleEntityNotFound(_0x16f3df,null))[_0x3d2e('0x27')](saveUpdates(_0x4fe845['body'],null))[_0x3d2e('0x27')](respondWithResult(_0x16f3df,null))[_0x3d2e('0x44')](handleError(_0x16f3df,null));};exports[_0x3d2e('0x28')]=function(_0x54f674,_0x29022f){return db[_0x3d2e('0x2e')]['find']({'where':{'id':_0x54f674[_0x3d2e('0x45')]['id']}})[_0x3d2e('0x27')](handleEntityNotFound(_0x29022f,null))['then'](removeEntity(_0x29022f,null))[_0x3d2e('0x44')](handleError(_0x29022f,null));};function widgetAttributes(_0x11598e){try{switch(_0x11598e[_0x3d2e('0x31')]){case'iframe':return[{'name':'attrUrl','value':_0x11598e[_0x3d2e('0x57')]||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e[_0x3d2e('0x58')][0x0]?_0x11598e[_0x3d2e('0x58')][0x0][_0x3d2e('0x59')]:undefined)||_0x3d2e('0x5a')}];case'custom':return[{'name':_0x3d2e('0x5b'),'value':_0x11598e['attrPath']||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e[_0x3d2e('0x58')][0x0]?_0x11598e[_0x3d2e('0x58')][0x0][_0x3d2e('0x59')]:undefined)||''}];case _0x3d2e('0x5c'):return[{'name':'attrHourFormat','value':_0x11598e[_0x3d2e('0x5d')]||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e['attrs'][0x0]?_0x11598e['attrs'][0x0]['value']:undefined)||_0x3d2e('0x5e')},{'name':_0x3d2e('0x5f'),'value':_0x11598e[_0x3d2e('0x5f')]||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e[_0x3d2e('0x58')][0x1]?_0x11598e[_0x3d2e('0x58')][0x1][_0x3d2e('0x59')]:undefined)||_0x3d2e('0x60')},{'name':_0x3d2e('0x61'),'value':_0x11598e[_0x3d2e('0x61')]||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e[_0x3d2e('0x58')][0x2]?_0x11598e[_0x3d2e('0x58')][0x2]['value']:undefined)||0xc}];case _0x3d2e('0x62'):return[{'name':_0x3d2e('0x63'),'value':_0x11598e[_0x3d2e('0x63')]||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e['attrs'][0x0]?_0x11598e['attrs'][0x0][_0x3d2e('0x59')]:undefined)||_0x3d2e('0x64')},{'name':_0x3d2e('0x65'),'value':_0x11598e[_0x3d2e('0x65')]||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e[_0x3d2e('0x58')][0x1]?_0x11598e[_0x3d2e('0x58')][0x1][_0x3d2e('0x59')]:undefined)||[]},{'name':_0x3d2e('0x61'),'value':_0x11598e[_0x3d2e('0x61')]||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e[_0x3d2e('0x58')][0x2]?_0x11598e[_0x3d2e('0x58')][0x2][_0x3d2e('0x59')]:undefined)||0x14}];case'multibar-chart':case _0x3d2e('0x66'):return[{'name':_0x3d2e('0x67'),'value':_0x11598e[_0x3d2e('0x67')]||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e[_0x3d2e('0x58')][0x0]?_0x11598e['attrs'][0x0][_0x3d2e('0x59')]:undefined)||'total'},{'name':_0x3d2e('0x68'),'value':_0x11598e['attrSerie2']||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e[_0x3d2e('0x58')][0x1]?_0x11598e['attrs'][0x1][_0x3d2e('0x59')]:undefined)||null},{'name':_0x3d2e('0x69'),'value':_0x11598e[_0x3d2e('0x69')]||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e[_0x3d2e('0x58')][0x2]?_0x11598e[_0x3d2e('0x58')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x11598e[_0x3d2e('0x65')]||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e[_0x3d2e('0x58')][0x3]?_0x11598e[_0x3d2e('0x58')][0x3][_0x3d2e('0x59')]:undefined)||[]}];case'web-report':return[{'name':_0x3d2e('0x6a'),'type':_0x11598e[_0x3d2e('0x6b')]||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e[_0x3d2e('0x58')][0x0]?_0x11598e[_0x3d2e('0x58')][0x0]['type']:undefined)||null,'value':_0x11598e[_0x3d2e('0x6a')]||(_0x11598e[_0x3d2e('0x58')]&&_0x11598e[_0x3d2e('0x58')][0x0]?_0x11598e[_0x3d2e('0x58')][0x0][_0x3d2e('0x59')]:undefined)||null},{'name':_0x3d2e('0x6c'),'value':_0x11598e[_0x3d2e('0x6c')]||(_0x11598e['attrs']&&_0x11598e['attrs'][0x1]?_0x11598e[_0x3d2e('0x58')][0x1][_0x3d2e('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x3601c1){logger[_0x3d2e('0x51')]('widgetAttributes:\x20%s',JSON[_0x3d2e('0x6d')](_0x3601c1));return[];}}exports[_0x3d2e('0x6e')]=function(_0x2b65b0,_0x472a84,_0x40751d){if(_0x2b65b0['body']['id']){delete _0x2b65b0['body']['id'];}return db[_0x3d2e('0x2e')][_0x3d2e('0x47')]({'where':{'id':_0x2b65b0['params']['id']}})['then'](handleEntityNotFound(_0x472a84,null))[_0x3d2e('0x27')](function(_0x398cb2){if(_0x398cb2){_0x2b65b0[_0x3d2e('0x49')][_0x3d2e('0x6f')]=_0x398cb2['id'];_0x2b65b0[_0x3d2e('0x49')]['attrs']=widgetAttributes(_0x2b65b0[_0x3d2e('0x49')]);return db[_0x3d2e('0x70')][_0x3d2e('0x48')](_0x2b65b0[_0x3d2e('0x49')]);}})[_0x3d2e('0x27')](respondWithResult(_0x472a84,null))['catch'](handleError(_0x472a84,null));};exports['getItems']=function(_0x2ff412,_0x2305e5,_0x2be736){var _0xc58d13={};var _0x28dd09={};var _0x51129a;var _0x56e989;return db[_0x3d2e('0x2e')]['findOne']({'where':{'id':_0x2ff412[_0x3d2e('0x45')]['id']}})[_0x3d2e('0x27')](handleEntityNotFound(_0x2305e5,null))[_0x3d2e('0x27')](function(_0x24d7fb){if(_0x24d7fb){_0x51129a=_0x24d7fb;_0x28dd09['model']=_[_0x3d2e('0x34')](db[_0x3d2e('0x70')]['rawAttributes']);_0x28dd09[_0x3d2e('0x37')]=_['keys'](_0x2ff412[_0x3d2e('0x37')]);_0x28dd09[_0x3d2e('0x35')]=_[_0x3d2e('0x36')](_0x28dd09[_0x3d2e('0x33')],_0x28dd09[_0x3d2e('0x37')]);_0xc58d13[_0x3d2e('0x38')]=_[_0x3d2e('0x36')](_0x28dd09[_0x3d2e('0x33')],qs['fields'](_0x2ff412[_0x3d2e('0x37')][_0x3d2e('0x39')]));_0xc58d13['attributes']=_0xc58d13['attributes'][_0x3d2e('0x3a')]?_0xc58d13[_0x3d2e('0x38')]:_0x28dd09[_0x3d2e('0x33')];_0xc58d13[_0x3d2e('0x3c')]=qs[_0x3d2e('0x3d')](_0x2ff412[_0x3d2e('0x37')][_0x3d2e('0x3d')]);_0xc58d13[_0x3d2e('0x3e')]=qs[_0x3d2e('0x35')](_[_0x3d2e('0x3f')](_0x2ff412[_0x3d2e('0x37')],_0x28dd09['filters']));if(_0x2ff412[_0x3d2e('0x37')][_0x3d2e('0x40')]){_0xc58d13[_0x3d2e('0x3e')]=_[_0x3d2e('0x41')](_0xc58d13[_0x3d2e('0x3e')],{'$or':_[_0x3d2e('0x2d')](_0xc58d13[_0x3d2e('0x38')],function(_0x2a5841){var _0x3b3b86={};_0x3b3b86[_0x2a5841]={'$like':'%'+_0x2ff412['query'][_0x3d2e('0x40')]+'%'};return _0x3b3b86;})});}_0xc58d13=_[_0x3d2e('0x41')]({},_0xc58d13,_0x2ff412[_0x3d2e('0x42')]);return _0x51129a['getItems'](_0xc58d13);}})[_0x3d2e('0x27')](function(_0x322eb5){if(_0x322eb5){_0x56e989=_0x322eb5[_0x3d2e('0x3a')];if(!_0x2ff412[_0x3d2e('0x37')][_0x3d2e('0x3b')](_0x3d2e('0x71'))){_0xc58d13[_0x3d2e('0x21')]=qs[_0x3d2e('0x21')](_0x2ff412[_0x3d2e('0x37')][_0x3d2e('0x21')]);_0xc58d13['offset']=qs[_0x3d2e('0x20')](_0x2ff412[_0x3d2e('0x37')][_0x3d2e('0x20')]);}return _0x51129a[_0x3d2e('0x72')](_0xc58d13);}})[_0x3d2e('0x27')](function(_0x5f3698){if(_0x5f3698){return _0x5f3698?{'count':_0x56e989,'rows':_0x5f3698}:null;}})[_0x3d2e('0x27')](respondWithResult(_0x2305e5,null))[_0x3d2e('0x44')](handleError(_0x2305e5,null));}; \ No newline at end of file +var _0x22d5=['error','index','Dashboard','rawAttributes','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','findAll','rows','catch','show','params','include','options','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','includeAll','Unable\x20to\x20retrieve\x20the\x20current\x20user','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','getItems','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','sendStatus'];(function(_0x46b832,_0x454e18){var _0x42b328=function(_0x204e99){while(--_0x204e99){_0x46b832['push'](_0x46b832['shift']());}};_0x42b328(++_0x454e18);}(_0x22d5,0xc5));var _0x522d=function(_0x330a51,_0x42c33b){_0x330a51=_0x330a51-0x0;var _0x55aa63=_0x22d5[_0x330a51];return _0x55aa63;};'use strict';var pdf=require(_0x522d('0x0'));var emlformat=require(_0x522d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x522d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x522d('0x3'));var moment=require(_0x522d('0x4'));var BPromise=require(_0x522d('0x5'));var Mustache=require('mustache');var util=require(_0x522d('0x6'));var path=require('path');var sox=require(_0x522d('0x7'));var csv=require(_0x522d('0x8'));var ejs=require(_0x522d('0x9'));var fs=require('fs');var _=require(_0x522d('0xa'));var squel=require(_0x522d('0xb'));var crypto=require(_0x522d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x522d('0xd'));var toCsv=require(_0x522d('0x8'));var querystring=require(_0x522d('0xe'));var Papa=require(_0x522d('0xf'));var Redis=require('ioredis');var authService=require(_0x522d('0x10'));var qs=require(_0x522d('0x11'));var as=require(_0x522d('0x12'));var hardwareService=require(_0x522d('0x13'));var logger=require(_0x522d('0x14'))(_0x522d('0x15'));var utils=require(_0x522d('0x16'));var config=require(_0x522d('0x17'));var db=require(_0x522d('0x18'))['db'];config[_0x522d('0x19')]=_[_0x522d('0x1a')](config[_0x522d('0x19')],{'host':_0x522d('0x1b'),'port':0x18eb});var socket=require(_0x522d('0x1c'))(new Redis(config['redis']));require(_0x522d('0x1d'))[_0x522d('0x1e')](socket);function respondWithStatusCode(_0x32fdef,_0x29f6ef){_0x29f6ef=_0x29f6ef||0xcc;return function(_0x2a63d9){if(_0x2a63d9){return _0x32fdef['sendStatus'](_0x29f6ef);}return _0x32fdef[_0x522d('0x1f')](_0x29f6ef)[_0x522d('0x20')]();};}function respondWithResult(_0x5336ba,_0x488c79){_0x488c79=_0x488c79||0xc8;return function(_0x361d88){if(_0x361d88){return _0x5336ba[_0x522d('0x1f')](_0x488c79)['json'](_0x361d88);}};}function respondWithFilteredResult(_0x1ad35e,_0x128639){return function(_0x45512d){if(_0x45512d){var _0x3b009a=_0x45512d[_0x522d('0x21')],_0x3129f0=_0x128639[_0x522d('0x22')],_0x6be763=_0x128639[_0x522d('0x22')]+_0x128639[_0x522d('0x23')],_0x377b85;if(_0x6be763>=_0x3b009a){_0x6be763=_0x3b009a;_0x377b85=0xc8;}else{_0x377b85=0xce;}_0x1ad35e['status'](_0x377b85);return _0x1ad35e[_0x522d('0x24')](_0x522d('0x25'),_0x3129f0+'-'+_0x6be763+'/'+_0x3b009a)[_0x522d('0x26')](_0x45512d);}return null;};}function patchUpdates(_0x1143c2){return function(_0x1eb0df){try{jsonpatch[_0x522d('0x27')](_0x1eb0df,_0x1143c2,!![]);}catch(_0x11d14d){return BPromise[_0x522d('0x28')](_0x11d14d);}return _0x1eb0df[_0x522d('0x29')]();};}function saveUpdates(_0x390d1a,_0x5cfa19){return function(_0x386d61){if(_0x386d61){return _0x386d61[_0x522d('0x2a')](_0x390d1a)[_0x522d('0x2b')](function(_0x315913){return _0x315913;});}return null;};}function removeEntity(_0x33da63,_0x402487){return function(_0x41f724){if(_0x41f724){return _0x41f724[_0x522d('0x2c')]()[_0x522d('0x2b')](function(){var _0x30f06e=_0x41f724[_0x522d('0x2d')]({'plain':!![]});var _0x197d2d=_0x522d('0x2e');return db[_0x522d('0x2f')][_0x522d('0x2c')]({'where':{'type':_0x197d2d,'resourceId':_0x30f06e['id']}})[_0x522d('0x2b')](function(){return _0x41f724;});})[_0x522d('0x2b')](function(){_0x33da63[_0x522d('0x1f')](0xcc)[_0x522d('0x20')]();});}};}function handleEntityNotFound(_0x486472,_0x32fce9){return function(_0x4aece0){if(!_0x4aece0){_0x486472[_0x522d('0x30')](0x194);}return _0x4aece0;};}function handleError(_0x419343,_0x4b0ee1){_0x4b0ee1=_0x4b0ee1||0x1f4;return function(_0xdb7f18){logger[_0x522d('0x31')](_0xdb7f18['stack']);if(_0xdb7f18['name']){delete _0xdb7f18['name'];}_0x419343[_0x522d('0x1f')](_0x4b0ee1)['send'](_0xdb7f18);};}exports[_0x522d('0x32')]=function(_0x2ad9cf,_0x41ce81){var _0xfa52f2={},_0x2285f0={},_0x52f2bb={'count':0x0,'rows':[]};var _0x5094f1=_['map'](db[_0x522d('0x33')][_0x522d('0x34')],function(_0xc307ee){return{'name':_0xc307ee['fieldName'],'type':_0xc307ee['type'][_0x522d('0x35')]};});_0x2285f0[_0x522d('0x36')]=_[_0x522d('0x37')](_0x5094f1,_0x522d('0x38'));_0x2285f0[_0x522d('0x39')]=_[_0x522d('0x3a')](_0x2ad9cf[_0x522d('0x39')]);_0x2285f0[_0x522d('0x3b')]=_[_0x522d('0x3c')](_0x2285f0[_0x522d('0x36')],_0x2285f0['query']);_0xfa52f2[_0x522d('0x3d')]=_[_0x522d('0x3c')](_0x2285f0[_0x522d('0x36')],qs[_0x522d('0x3e')](_0x2ad9cf[_0x522d('0x39')][_0x522d('0x3e')]));_0xfa52f2[_0x522d('0x3d')]=_0xfa52f2[_0x522d('0x3d')][_0x522d('0x3f')]?_0xfa52f2[_0x522d('0x3d')]:_0x2285f0[_0x522d('0x36')];if(!_0x2ad9cf[_0x522d('0x39')][_0x522d('0x40')](_0x522d('0x41'))){_0xfa52f2[_0x522d('0x23')]=qs[_0x522d('0x23')](_0x2ad9cf[_0x522d('0x39')]['limit']);_0xfa52f2[_0x522d('0x22')]=qs[_0x522d('0x22')](_0x2ad9cf['query']['offset']);}_0xfa52f2[_0x522d('0x42')]=qs[_0x522d('0x43')](_0x2ad9cf['query']['sort']);_0xfa52f2[_0x522d('0x44')]=qs[_0x522d('0x3b')](_[_0x522d('0x45')](_0x2ad9cf[_0x522d('0x39')],_0x2285f0[_0x522d('0x3b')]));if(_0x2ad9cf['query']['filter']){_0xfa52f2[_0x522d('0x44')]=_[_0x522d('0x46')](_0xfa52f2[_0x522d('0x44')],{'$or':_[_0x522d('0x37')](_0x5094f1,function(_0x1b4b7f){if(_0x1b4b7f['type']!==_0x522d('0x47')){var _0x5889d0={};_0x5889d0[_0x1b4b7f[_0x522d('0x38')]]={'$like':'%'+_0x2ad9cf[_0x522d('0x39')][_0x522d('0x48')]+'%'};return _0x5889d0;}})});}_0xfa52f2=_[_0x522d('0x46')]({},_0xfa52f2,_0x2ad9cf['options']);var _0x1b65e5={'where':_0xfa52f2['where']};return db[_0x522d('0x33')][_0x522d('0x21')](_0x1b65e5)[_0x522d('0x2b')](function(_0x5b8a42){_0x52f2bb[_0x522d('0x21')]=_0x5b8a42;if(_0x2ad9cf[_0x522d('0x39')]['includeAll']){_0xfa52f2['include']=[{'all':!![]}];}return db[_0x522d('0x33')][_0x522d('0x49')](_0xfa52f2);})['then'](function(_0x4e6832){_0x52f2bb[_0x522d('0x4a')]=_0x4e6832;return _0x52f2bb;})['then'](respondWithFilteredResult(_0x41ce81,_0xfa52f2))[_0x522d('0x4b')](handleError(_0x41ce81,null));};exports[_0x522d('0x4c')]=function(_0x25e41b,_0xbd019a){var _0x308029={'raw':![],'where':{'id':_0x25e41b[_0x522d('0x4d')]['id']}},_0x2b19c0={};_0x2b19c0[_0x522d('0x36')]=_['keys'](db[_0x522d('0x33')]['rawAttributes']);_0x2b19c0[_0x522d('0x39')]=_['keys'](_0x25e41b[_0x522d('0x39')]);_0x2b19c0['filters']=_['intersection'](_0x2b19c0[_0x522d('0x36')],_0x2b19c0[_0x522d('0x39')]);_0x308029[_0x522d('0x3d')]=_[_0x522d('0x3c')](_0x2b19c0[_0x522d('0x36')],qs['fields'](_0x25e41b['query']['fields']));_0x308029[_0x522d('0x3d')]=_0x308029[_0x522d('0x3d')]['length']?_0x308029[_0x522d('0x3d')]:_0x2b19c0[_0x522d('0x36')];if(_0x25e41b['query']['includeAll']){_0x308029[_0x522d('0x4e')]=[{'all':!![]}];}_0x308029=_['merge']({},_0x308029,_0x25e41b[_0x522d('0x4f')]);return db[_0x522d('0x33')][_0x522d('0x50')](_0x308029)['then'](handleEntityNotFound(_0xbd019a,null))[_0x522d('0x2b')](respondWithResult(_0xbd019a,null))['catch'](handleError(_0xbd019a,null));};exports[_0x522d('0x51')]=function(_0x481857,_0x3f8ea9){return db['Dashboard'][_0x522d('0x51')](_0x481857[_0x522d('0x52')],{})[_0x522d('0x2b')](function(_0x10499a){var _0x56f665=_0x481857[_0x522d('0x53')][_0x522d('0x2d')]({'plain':!![]});if(!_0x56f665)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56f665[_0x522d('0x54')]==='user'){var _0x3fe0c9=_0x10499a[_0x522d('0x2d')]({'plain':!![]});var _0x384340=_0x522d('0x2e');return db['UserProfileSection']['find']({'where':{'name':_0x384340,'userProfileId':_0x56f665[_0x522d('0x55')]},'raw':!![]})[_0x522d('0x2b')](function(_0x3dff0b){if(_0x3dff0b&&_0x3dff0b[_0x522d('0x56')]===0x0){return db[_0x522d('0x2f')][_0x522d('0x51')]({'name':_0x3fe0c9[_0x522d('0x38')],'resourceId':_0x3fe0c9['id'],'type':_0x3dff0b['name'],'sectionId':_0x3dff0b['id']},{})['then'](function(){return _0x10499a;});}else{return _0x10499a;}})[_0x522d('0x4b')](function(_0x15ce25){logger[_0x522d('0x31')](_0x522d('0x57'),_0x15ce25);throw _0x15ce25;});}return _0x10499a;})['then'](respondWithResult(_0x3f8ea9,0xc9))[_0x522d('0x4b')](handleError(_0x3f8ea9,null));};exports[_0x522d('0x58')]=function(_0x515b1f,_0x87d9f1){var _0x4a7d29={'where':{'id':_0x515b1f[_0x522d('0x4d')]['id']}},_0x44a9bc={};_0x44a9bc[_0x522d('0x36')]=_[_0x522d('0x3a')](db[_0x522d('0x33')][_0x522d('0x34')]);_0x4a7d29[_0x522d('0x3d')]=_[_0x522d('0x3c')](_0x44a9bc[_0x522d('0x36')],qs[_0x522d('0x3e')](_0x515b1f['query']['fields']));_0x4a7d29[_0x522d('0x3d')]=_0x4a7d29[_0x522d('0x3d')][_0x522d('0x3f')]?_0x4a7d29[_0x522d('0x3d')]:_0x44a9bc['model'];if(_0x515b1f['query']['includeAll']){_0x4a7d29[_0x522d('0x4e')]=[{'all':!![]}];}_0x4a7d29=_[_0x522d('0x46')]({},_0x4a7d29,_0x515b1f[_0x522d('0x4f')]);return db[_0x522d('0x33')][_0x522d('0x50')](_0x4a7d29)[_0x522d('0x2b')](handleEntityNotFound(_0x87d9f1,null))[_0x522d('0x2b')](function(_0x161777){if(_0x161777){var _0x27a73e=_0x161777[_0x522d('0x2d')]({'plain':!![]});_0x27a73e=qs[_0x522d('0x59')](_0x27a73e,['id','createdAt','updatedAt']);_0x515b1f[_0x522d('0x52')]=_[_0x522d('0x59')](_0x515b1f[_0x522d('0x52')],['id',_0x522d('0x5a'),'updatedAt']);return db['Dashboard'][_0x522d('0x51')](_[_0x522d('0x46')](_0x27a73e,_0x515b1f[_0x522d('0x52')]),{'include':_0x515b1f[_0x522d('0x39')][_0x522d('0x5b')]?[{'all':!![]}]:undefined})[_0x522d('0x2b')](function(_0x5c6a88){var _0x299504=_0x515b1f[_0x522d('0x53')][_0x522d('0x2d')]({'plain':!![]});if(!_0x299504)throw new Error(_0x522d('0x5c'));if(_0x299504[_0x522d('0x54')]===_0x522d('0x53')){var _0x433fee=_0x5c6a88[_0x522d('0x2d')]({'plain':!![]});var _0x4a9ca9='CustomDashboards';return db['UserProfileSection'][_0x522d('0x50')]({'where':{'name':_0x4a9ca9,'userProfileId':_0x299504['userProfileId']},'raw':!![]})[_0x522d('0x2b')](function(_0x55ade8){if(_0x55ade8&&_0x55ade8[_0x522d('0x56')]===0x0){return db['UserProfileResource'][_0x522d('0x51')]({'name':_0x433fee[_0x522d('0x38')],'resourceId':_0x433fee['id'],'type':_0x55ade8[_0x522d('0x38')],'sectionId':_0x55ade8['id']},{})[_0x522d('0x2b')](function(){return _0x5c6a88;});}else{return _0x5c6a88;}})['catch'](function(_0x315ab2){logger['error'](_0x522d('0x57'),_0x315ab2);throw _0x315ab2;});}return _0x5c6a88;});}})['then'](respondWithResult(_0x87d9f1,0xc9))[_0x522d('0x4b')](handleError(_0x87d9f1,null));};exports['update']=function(_0x23a70b,_0x3a27e8){if(_0x23a70b['body']['id']){delete _0x23a70b[_0x522d('0x52')]['id'];}return db['Dashboard'][_0x522d('0x50')]({'where':{'id':_0x23a70b[_0x522d('0x4d')]['id']}})[_0x522d('0x2b')](handleEntityNotFound(_0x3a27e8,null))[_0x522d('0x2b')](saveUpdates(_0x23a70b[_0x522d('0x52')],null))[_0x522d('0x2b')](respondWithResult(_0x3a27e8,null))[_0x522d('0x4b')](handleError(_0x3a27e8,null));};exports[_0x522d('0x2c')]=function(_0x52f1d9,_0x5830e6){return db[_0x522d('0x33')][_0x522d('0x50')]({'where':{'id':_0x52f1d9[_0x522d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5830e6,null))[_0x522d('0x2b')](removeEntity(_0x5830e6,null))['catch'](handleError(_0x5830e6,null));};function widgetAttributes(_0x3ef383){try{switch(_0x3ef383[_0x522d('0x5d')]){case _0x522d('0x5e'):return[{'name':_0x522d('0x5f'),'value':_0x3ef383['attrUrl']||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x0]?_0x3ef383[_0x522d('0x60')][0x0][_0x522d('0x61')]:undefined)||_0x522d('0x62')}];case _0x522d('0x63'):return[{'name':_0x522d('0x64'),'value':_0x3ef383[_0x522d('0x64')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x0]?_0x3ef383[_0x522d('0x60')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x522d('0x65'),'value':_0x3ef383[_0x522d('0x65')]||(_0x3ef383['attrs']&&_0x3ef383[_0x522d('0x60')][0x0]?_0x3ef383['attrs'][0x0][_0x522d('0x61')]:undefined)||_0x522d('0x66')},{'name':_0x522d('0x67'),'value':_0x3ef383[_0x522d('0x67')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x1]?_0x3ef383[_0x522d('0x60')][0x1][_0x522d('0x61')]:undefined)||'0.00'},{'name':_0x522d('0x68'),'value':_0x3ef383['attrFontSize']||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x2]?_0x3ef383[_0x522d('0x60')][0x2][_0x522d('0x61')]:undefined)||0xc}];case _0x522d('0x69'):return[{'name':_0x522d('0x6a'),'value':_0x3ef383['attrMetric']||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383['attrs'][0x0]?_0x3ef383['attrs'][0x0][_0x522d('0x61')]:undefined)||_0x522d('0x6b')},{'name':_0x522d('0x6c'),'value':_0x3ef383[_0x522d('0x6c')]||(_0x3ef383['attrs']&&_0x3ef383['attrs'][0x1]?_0x3ef383[_0x522d('0x60')][0x1][_0x522d('0x61')]:undefined)||[]},{'name':_0x522d('0x68'),'value':_0x3ef383[_0x522d('0x68')]||(_0x3ef383['attrs']&&_0x3ef383['attrs'][0x2]?_0x3ef383[_0x522d('0x60')][0x2]['value']:undefined)||0x14}];case _0x522d('0x6d'):case'pie-chart':return[{'name':_0x522d('0x6e'),'value':_0x3ef383[_0x522d('0x6e')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x0]?_0x3ef383[_0x522d('0x60')][0x0][_0x522d('0x61')]:undefined)||_0x522d('0x6b')},{'name':_0x522d('0x6f'),'value':_0x3ef383[_0x522d('0x6f')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x1]?_0x3ef383[_0x522d('0x60')][0x1][_0x522d('0x61')]:undefined)||null},{'name':_0x522d('0x70'),'value':_0x3ef383[_0x522d('0x70')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x2]?_0x3ef383[_0x522d('0x60')][0x2][_0x522d('0x61')]:undefined)||null},{'name':_0x522d('0x6c'),'value':_0x3ef383['attrVoiceQueues']||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x3]?_0x3ef383['attrs'][0x3][_0x522d('0x61')]:undefined)||[]}];case _0x522d('0x71'):return[{'name':'attrReport','type':_0x3ef383[_0x522d('0x72')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x0]?_0x3ef383['attrs'][0x0][_0x522d('0x5d')]:undefined)||null,'value':_0x3ef383[_0x522d('0x73')]||(_0x3ef383[_0x522d('0x60')]&&_0x3ef383[_0x522d('0x60')][0x0]?_0x3ef383['attrs'][0x0]['value']:undefined)||null},{'name':_0x522d('0x74'),'value':_0x3ef383[_0x522d('0x74')]||(_0x3ef383['attrs']&&_0x3ef383[_0x522d('0x60')][0x1]?_0x3ef383[_0x522d('0x60')][0x1][_0x522d('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x5b8400){logger[_0x522d('0x31')](_0x522d('0x75'),JSON[_0x522d('0x76')](_0x5b8400));return[];}}exports[_0x522d('0x77')]=function(_0x442210,_0x432d84,_0x2c2106){if(_0x442210[_0x522d('0x52')]['id']){delete _0x442210['body']['id'];}return db[_0x522d('0x33')][_0x522d('0x50')]({'where':{'id':_0x442210[_0x522d('0x4d')]['id']}})[_0x522d('0x2b')](handleEntityNotFound(_0x432d84,null))[_0x522d('0x2b')](function(_0x98122e){if(_0x98122e){_0x442210[_0x522d('0x52')]['DashboardId']=_0x98122e['id'];_0x442210[_0x522d('0x52')][_0x522d('0x60')]=widgetAttributes(_0x442210['body']);return db[_0x522d('0x78')][_0x522d('0x51')](_0x442210[_0x522d('0x52')]);}})[_0x522d('0x2b')](respondWithResult(_0x432d84,null))[_0x522d('0x4b')](handleError(_0x432d84,null));};exports['getItems']=function(_0x31b39e,_0x39b90f,_0x35ce6f){var _0x5c3492={};var _0x208659={};var _0x8412c1;var _0x17fc95;return db[_0x522d('0x33')][_0x522d('0x79')]({'where':{'id':_0x31b39e['params']['id']}})['then'](handleEntityNotFound(_0x39b90f,null))['then'](function(_0x5bcb6a){if(_0x5bcb6a){_0x8412c1=_0x5bcb6a;_0x208659['model']=_[_0x522d('0x3a')](db[_0x522d('0x78')][_0x522d('0x34')]);_0x208659[_0x522d('0x39')]=_[_0x522d('0x3a')](_0x31b39e[_0x522d('0x39')]);_0x208659[_0x522d('0x3b')]=_['intersection'](_0x208659[_0x522d('0x36')],_0x208659['query']);_0x5c3492[_0x522d('0x3d')]=_[_0x522d('0x3c')](_0x208659[_0x522d('0x36')],qs[_0x522d('0x3e')](_0x31b39e[_0x522d('0x39')][_0x522d('0x3e')]));_0x5c3492[_0x522d('0x3d')]=_0x5c3492[_0x522d('0x3d')]['length']?_0x5c3492[_0x522d('0x3d')]:_0x208659['model'];_0x5c3492[_0x522d('0x42')]=qs[_0x522d('0x43')](_0x31b39e[_0x522d('0x39')][_0x522d('0x43')]);_0x5c3492[_0x522d('0x44')]=qs[_0x522d('0x3b')](_['pick'](_0x31b39e[_0x522d('0x39')],_0x208659['filters']));if(_0x31b39e[_0x522d('0x39')][_0x522d('0x48')]){_0x5c3492['where']=_['merge'](_0x5c3492[_0x522d('0x44')],{'$or':_[_0x522d('0x37')](_0x5c3492[_0x522d('0x3d')],function(_0x1e8d3d){var _0x3ecd9a={};_0x3ecd9a[_0x1e8d3d]={'$like':'%'+_0x31b39e[_0x522d('0x39')][_0x522d('0x48')]+'%'};return _0x3ecd9a;})});}_0x5c3492=_['merge']({},_0x5c3492,_0x31b39e[_0x522d('0x4f')]);return _0x8412c1[_0x522d('0x7a')](_0x5c3492);}})['then'](function(_0x487d22){if(_0x487d22){_0x17fc95=_0x487d22[_0x522d('0x3f')];if(!_0x31b39e[_0x522d('0x39')][_0x522d('0x40')](_0x522d('0x41'))){_0x5c3492[_0x522d('0x23')]=qs[_0x522d('0x23')](_0x31b39e['query'][_0x522d('0x23')]);_0x5c3492['offset']=qs[_0x522d('0x22')](_0x31b39e['query'][_0x522d('0x22')]);}return _0x8412c1[_0x522d('0x7a')](_0x5c3492);}})[_0x522d('0x2b')](function(_0x821761){if(_0x821761){return _0x821761?{'count':_0x17fc95,'rows':_0x821761}:null;}})['then'](respondWithResult(_0x39b90f,null))[_0x522d('0x4b')](handleError(_0x39b90f,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 91f0be3..e7a480b 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 _0x5765=['hook','exports','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1da9bc,_0x4bd9c8){var _0x51878f=function(_0x5c6e0f){while(--_0x5c6e0f){_0x1da9bc['push'](_0x1da9bc['shift']());}};_0x51878f(++_0x4bd9c8);}(_0x5765,0x87));var _0x5576=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x5765[_0x5a5395];return _0x4da43d;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5576('0x0')](0x0);var events={'afterCreate':_0x5576('0x1'),'afterUpdate':_0x5576('0x2'),'afterDestroy':'remove'};function emitEvent(_0x41e417){return function(_0x59434f,_0x4324a3,_0x2620c7){DashboardEvents[_0x5576('0x3')](_0x41e417+':'+_0x59434f['id'],_0x59434f);DashboardEvents[_0x5576('0x3')](_0x41e417,_0x59434f);_0x2620c7(null);};}for(var e in events){if(events[_0x5576('0x4')](e)){var event=events[e];Dashboard[_0x5576('0x5')](e,emitEvent(event));}}module[_0x5576('0x6')]=DashboardEvents; \ No newline at end of file +var _0x6c24=['Dashboard','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x383780,_0x3309eb){var _0x3c4bc8=function(_0x1b70ab){while(--_0x1b70ab){_0x383780['push'](_0x383780['shift']());}};_0x3c4bc8(++_0x3309eb);}(_0x6c24,0x1db));var _0x46c2=function(_0x3a077f,_0x576e25){_0x3a077f=_0x3a077f-0x0;var _0x3ea13c=_0x6c24[_0x3a077f];return _0x3ea13c;};'use strict';var EventEmitter=require(_0x46c2('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x46c2('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x46c2('0x2')};function emitEvent(_0x234da1){return function(_0x555f4f,_0x3534b8,_0x57aa0b){DashboardEvents[_0x46c2('0x3')](_0x234da1+':'+_0x555f4f['id'],_0x555f4f);DashboardEvents['emit'](_0x234da1,_0x555f4f);_0x57aa0b(null);};}for(var e in events){if(events[_0x46c2('0x4')](e)){var event=events[e];Dashboard[_0x46c2('0x5')](e,emitEvent(event));}}module[_0x46c2('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index a6e75d0..0c2b4de 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 _0xc6c9=['Dashboard','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x858576,_0x4f0c25){var _0x7a7198=function(_0x52e7c2){while(--_0x52e7c2){_0x858576['push'](_0x858576['shift']());}};_0x7a7198(++_0x4f0c25);}(_0xc6c9,0x97));var _0x9c6c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc6c9[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9c6c('0x0'));var moment=require(_0x9c6c('0x1'));var BPromise=require(_0x9c6c('0x2'));var rp=require(_0x9c6c('0x3'));var fs=require('fs');var path=require(_0x9c6c('0x4'));var rimraf=require(_0x9c6c('0x5'));var config=require(_0x9c6c('0x6'));var attributes=require('./dashboard.attributes');module[_0x9c6c('0x7')]=function(_0x15cc17,_0x2eaa9a){return _0x15cc17[_0x9c6c('0x8')](_0x9c6c('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3845=['path','../../config/environment','./dashboard.attributes','exports','Dashboard','lodash','util','moment','request-promise'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x3845,0xcb));var _0x5384=function(_0xca9bcd,_0x54e883){_0xca9bcd=_0xca9bcd-0x0;var _0x521e98=_0x3845[_0xca9bcd];return _0x521e98;};'use strict';var _=require(_0x5384('0x0'));var util=require(_0x5384('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5384('0x2'));var BPromise=require('bluebird');var rp=require(_0x5384('0x3'));var fs=require('fs');var path=require(_0x5384('0x4'));var rimraf=require('rimraf');var config=require(_0x5384('0x5'));var attributes=require(_0x5384('0x6'));module[_0x5384('0x7')]=function(_0x3dd4d6,_0x163ded){return _0x3dd4d6['define'](_0x5384('0x8'),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 853770a..1e7eb74 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 _0x2424=['ioredis','../../mysqldb','../../config/logger','rpc','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x38fb5e,_0x2d0526){var _0x2f5278=function(_0x1e4576){while(--_0x1e4576){_0x38fb5e['push'](_0x38fb5e['shift']());}};_0x2f5278(++_0x2d0526);}(_0x2424,0x10a));var _0x4242=function(_0x48522d,_0x3e5fea){_0x48522d=_0x48522d-0x0;var _0x5b328b=_0x2424[_0x48522d];return _0x5b328b;};'use strict';var _=require(_0x4242('0x0'));var util=require(_0x4242('0x1'));var moment=require('moment');var BPromise=require(_0x4242('0x2'));var rs=require(_0x4242('0x3'));var fs=require('fs');var Redis=require(_0x4242('0x4'));var db=require(_0x4242('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4242('0x6'))(_0x4242('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4242('0x8')][_0x4242('0x9')]({'port':0x232a});config['redis']=_[_0x4242('0xa')](config[_0x4242('0xb')],{'host':_0x4242('0xc'),'port':0x18eb});var socket=require(_0x4242('0xd'))(new Redis(config[_0x4242('0xb')]));require(_0x4242('0xe'))[_0x4242('0xf')](socket);function respondWithRpcPromise(_0x26b3d1,_0x449861,_0xfb6eb6){return new BPromise(function(_0x2f0c1a,_0x43facd){return client[_0x4242('0x10')](_0x26b3d1,_0xfb6eb6)[_0x4242('0x11')](function(_0x323b54){logger[_0x4242('0x12')](_0x4242('0x13'),_0x449861,_0x4242('0x14'));logger[_0x4242('0x15')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x449861,_0x4242('0x14'),JSON[_0x4242('0x16')](_0x323b54));if(_0x323b54[_0x4242('0x17')]){if(_0x323b54['error']['code']===0x1f4){logger[_0x4242('0x17')](_0x4242('0x13'),_0x449861,_0x323b54[_0x4242('0x17')][_0x4242('0x18')]);return _0x43facd(_0x323b54['error']['message']);}logger['error']('Dashboard,\x20%s,\x20%s',_0x449861,_0x323b54[_0x4242('0x17')]['message']);return _0x2f0c1a(_0x323b54[_0x4242('0x17')][_0x4242('0x18')]);}else{logger[_0x4242('0x12')](_0x4242('0x13'),_0x449861,_0x4242('0x14'));_0x2f0c1a(_0x323b54[_0x4242('0x19')][_0x4242('0x18')]);}})[_0x4242('0x1a')](function(_0x1887de){logger['error']('Dashboard,\x20%s,\x20%s',_0x449861,_0x1887de);_0x43facd(_0x1887de);});});} \ No newline at end of file +var _0x8cab=['../../config/logger','rpc','../../config/environment','http','localhost','socket.io-emitter','redis','register','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4dfd78,_0x3ce417){var _0x4377e8=function(_0x4c10f8){while(--_0x4c10f8){_0x4dfd78['push'](_0x4dfd78['shift']());}};_0x4377e8(++_0x3ce417);}(_0x8cab,0x13d));var _0xb8ca=function(_0x8d02f2,_0x3e53d4){_0x8d02f2=_0x8d02f2-0x0;var _0x16512f=_0x8cab[_0x8d02f2];return _0x16512f;};'use strict';var _=require(_0xb8ca('0x0'));var util=require(_0xb8ca('0x1'));var moment=require('moment');var BPromise=require(_0xb8ca('0x2'));var rs=require(_0xb8ca('0x3'));var fs=require('fs');var Redis=require(_0xb8ca('0x4'));var db=require(_0xb8ca('0x5'))['db'];var utils=require(_0xb8ca('0x6'));var logger=require(_0xb8ca('0x7'))(_0xb8ca('0x8'));var config=require(_0xb8ca('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb8ca('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xb8ca('0xb'),'port':0x18eb});var socket=require(_0xb8ca('0xc'))(new Redis(config[_0xb8ca('0xd')]));require('./dashboard.socket')[_0xb8ca('0xe')](socket);function respondWithRpcPromise(_0x19aae2,_0x4dfe27,_0x1b6dd9){return new BPromise(function(_0x551075,_0x3c4eac){return client['request'](_0x19aae2,_0x1b6dd9)[_0xb8ca('0xf')](function(_0x530929){logger['info']('Dashboard,\x20%s,\x20%s',_0x4dfe27,_0xb8ca('0x10'));logger[_0xb8ca('0x11')](_0xb8ca('0x12'),_0x4dfe27,'request\x20sent',JSON[_0xb8ca('0x13')](_0x530929));if(_0x530929[_0xb8ca('0x14')]){if(_0x530929[_0xb8ca('0x14')][_0xb8ca('0x15')]===0x1f4){logger[_0xb8ca('0x14')](_0xb8ca('0x16'),_0x4dfe27,_0x530929[_0xb8ca('0x14')][_0xb8ca('0x17')]);return _0x3c4eac(_0x530929[_0xb8ca('0x14')][_0xb8ca('0x17')]);}logger['error'](_0xb8ca('0x16'),_0x4dfe27,_0x530929[_0xb8ca('0x14')][_0xb8ca('0x17')]);return _0x551075(_0x530929[_0xb8ca('0x14')]['message']);}else{logger[_0xb8ca('0x18')](_0xb8ca('0x16'),_0x4dfe27,_0xb8ca('0x10'));_0x551075(_0x530929[_0xb8ca('0x19')]['message']);}})[_0xb8ca('0x1a')](function(_0x35a7fb){logger['error'](_0xb8ca('0x16'),_0x4dfe27,_0x35a7fb);_0x3c4eac(_0x35a7fb);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 446131d..ec7cea2 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 _0x8d0f=['update','emit','register','length','dashboard:','save'];(function(_0x50982e,_0x106bf2){var _0xe3710d=function(_0x4af44d){while(--_0x4af44d){_0x50982e['push'](_0x50982e['shift']());}};_0xe3710d(++_0x106bf2);}(_0x8d0f,0x1d9));var _0xf8d0=function(_0x246c77,_0xdf8952){_0x246c77=_0x246c77-0x0;var _0x2d3c16=_0x8d0f[_0x246c77];return _0x2d3c16;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xf8d0('0x0'),'remove',_0xf8d0('0x1')];function createListener(_0x5ce5f9,_0x2474f5){return function(_0x54f271){_0x2474f5[_0xf8d0('0x2')](_0x5ce5f9,_0x54f271);};}function removeListener(_0x21a0fc,_0x43492c){return function(){DashboardEvents['removeListener'](_0x21a0fc,_0x43492c);};}exports[_0xf8d0('0x3')]=function(_0x72e583){for(var _0x342a81=0x0,_0x3b8f8c=events[_0xf8d0('0x4')];_0x342a81<_0x3b8f8c;_0x342a81++){var _0x52970a=events[_0x342a81];var _0x4f0180=createListener(_0xf8d0('0x5')+_0x52970a,_0x72e583);DashboardEvents['on'](_0x52970a,_0x4f0180);}}; \ No newline at end of file +var _0xbdca=['remove','emit','removeListener','register','length','dashboard:','./dashboard.events','save'];(function(_0x453acf,_0x3c10c6){var _0x49c3c1=function(_0x5cfb88){while(--_0x5cfb88){_0x453acf['push'](_0x453acf['shift']());}};_0x49c3c1(++_0x3c10c6);}(_0xbdca,0x7e));var _0xabdc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbdca[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0xabdc('0x0'));var events=[_0xabdc('0x1'),_0xabdc('0x2'),'update'];function createListener(_0x34b62c,_0x4ba9b3){return function(_0x5370fc){_0x4ba9b3[_0xabdc('0x3')](_0x34b62c,_0x5370fc);};}function removeListener(_0x24a0d3,_0x19d893){return function(){DashboardEvents[_0xabdc('0x4')](_0x24a0d3,_0x19d893);};}exports[_0xabdc('0x5')]=function(_0x3a00ce){for(var _0x317ae0=0x0,_0x24e2e5=events[_0xabdc('0x6')];_0x317ae0<_0x24e2e5;_0x317ae0++){var _0x238754=events[_0x317ae0];var _0x44da74=createListener(_0xabdc('0x7')+_0x238754,_0x3a00ce);DashboardEvents['on'](_0x238754,_0x44da74);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 3aac91c..85b5d02 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 _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','multer','util','path','express','Router'];(function(_0x23a673,_0x31e4bc){var _0x2213b7=function(_0x3c5dcc){while(--_0x3c5dcc){_0x23a673['push'](_0x23a673['shift']());}};_0x2213b7(++_0x31e4bc);}(_0xe706,0xa3));var _0x6e70=function(_0x2064c8,_0x168039){_0x2064c8=_0x2064c8-0x0;var _0x23af73=_0xe706[_0x2064c8];return _0x23af73;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x10')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x10')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['post']('/:id/items',auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/items','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated'];(function(_0x33f1ef,_0x16e79b){var _0x3e8f49=function(_0x114a84){while(--_0x114a84){_0x33f1ef['push'](_0x33f1ef['shift']());}};_0x3e8f49(++_0x16e79b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getItems']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xb')](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['clone']);router['post']('/:id/items',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index cd131d0..ae6696b 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 _0xa58d=['long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','squel','exports','STRING','TEXT'];(function(_0x32f75b,_0x16cde7){var _0x26f5c7=function(_0x2f80b8){while(--_0x2f80b8){_0x32f75b['push'](_0x32f75b['shift']());}};_0x26f5c7(++_0x16cde7);}(_0xa58d,0x7e));var _0xda58=function(_0x75d890,_0x2aee0b){_0x75d890=_0x75d890-0x0;var _0xf90253=_0xa58d[_0x75d890];return _0xf90253;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xda58('0x0'));var _=require('lodash');module[_0xda58('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xda58('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xda58('0x3')](_0xda58('0x4')),'get':function(){try{return JSON[_0xda58('0x5')](this[_0xda58('0x6')](_0xda58('0x7')));}catch(_0x21fac2){return[];}},'set':function(_0x48e412){try{this[_0xda58('0x8')](_0xda58('0x7'),JSON[_0xda58('0x9')](_0x48e412));}catch(_0x5ea178){this[_0xda58('0x8')](_0xda58('0x7'),JSON[_0xda58('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xda58('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xda58('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xda58('0xa')]},'background':{'type':Sequelize[_0xda58('0x2')],'allowNull':![],'defaultValue':_0xda58('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xda58('0x2')],'allowNull':![],'defaultValue':_0xda58('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xda58('0x2')]}}; \ No newline at end of file +var _0xe425=['lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','INTEGER','#ffffff','sequelize','squel'];(function(_0x57f228,_0x5d9ee4){var _0x9df7a3=function(_0x5fd2f1){while(--_0x5fd2f1){_0x57f228['push'](_0x57f228['shift']());}};_0x9df7a3(++_0x5d9ee4);}(_0xe425,0x16a));var _0x5e42=function(_0x1aaeb5,_0x48d8ed){_0x1aaeb5=_0x1aaeb5-0x0;var _0x54451a=_0xe425[_0x1aaeb5];return _0x54451a;};'use strict';var Sequelize=require(_0x5e42('0x0'));var squel=require(_0x5e42('0x1'));var _=require(_0x5e42('0x2'));module[_0x5e42('0x3')]={'title':{'type':Sequelize[_0x5e42('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x5e42('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x5e42('0x5')](_0x5e42('0x6')),'get':function(){try{return JSON[_0x5e42('0x7')](this[_0x5e42('0x8')](_0x5e42('0x9')));}catch(_0x21ed0b){return[];}},'set':function(_0x402c4a){try{this['setDataValue']('attrs',JSON[_0x5e42('0xa')](_0x402c4a));}catch(_0x2ea5e1){this['setDataValue'](_0x5e42('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x5e42('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5e42('0xb')]},'col':{'type':Sequelize[_0x5e42('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5e42('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5e42('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5e42('0x4')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 0bc4979..f3ca8d8 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 _0xd1e0=['desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','stack','name','send','show','params','model','keys','DashboardItem','query','filters','attributes','intersection','length','include','merge','options','find','catch','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','type','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x5a089c,_0x49bb9e){var _0x2cf479=function(_0x24067b){while(--_0x24067b){_0x5a089c['push'](_0x5a089c['shift']());}};_0x2cf479(++_0x49bb9e);}(_0xd1e0,0x1b3));var _0x0d1e=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xd1e0[_0xdea41a];return _0x15d0d8;};'use strict';var pdf=require(_0x0d1e('0x0'));var emlformat=require(_0x0d1e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0d1e('0x2'));var jsonpatch=require(_0x0d1e('0x3'));var rp=require(_0x0d1e('0x4'));var moment=require(_0x0d1e('0x5'));var BPromise=require(_0x0d1e('0x6'));var Mustache=require('mustache');var util=require(_0x0d1e('0x7'));var path=require(_0x0d1e('0x8'));var sox=require(_0x0d1e('0x9'));var csv=require(_0x0d1e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0d1e('0xb'));var squel=require(_0x0d1e('0xc'));var crypto=require(_0x0d1e('0xd'));var jsforce=require(_0x0d1e('0xe'));var deskjs=require(_0x0d1e('0xf'));var toCsv=require(_0x0d1e('0xa'));var querystring=require(_0x0d1e('0x10'));var Papa=require('papaparse');var Redis=require(_0x0d1e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0d1e('0x12'));var as=require(_0x0d1e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0d1e('0x14'));var utils=require('../../config/utils');var config=require(_0x0d1e('0x15'));var db=require(_0x0d1e('0x16'))['db'];config[_0x0d1e('0x17')]=_[_0x0d1e('0x18')](config[_0x0d1e('0x17')],{'host':_0x0d1e('0x19'),'port':0x18eb});var socket=require(_0x0d1e('0x1a'))(new Redis(config[_0x0d1e('0x17')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x25bc01,_0x48741f){_0x48741f=_0x48741f||0xcc;return function(_0x439529){if(_0x439529){return _0x25bc01[_0x0d1e('0x1b')](_0x48741f);}return _0x25bc01[_0x0d1e('0x1c')](_0x48741f)[_0x0d1e('0x1d')]();};}function respondWithResult(_0x2ec18a,_0x11f177){_0x11f177=_0x11f177||0xc8;return function(_0x464d60){if(_0x464d60){return _0x2ec18a[_0x0d1e('0x1c')](_0x11f177)[_0x0d1e('0x1e')](_0x464d60);}};}function respondWithFilteredResult(_0x2e12cd,_0x4bd785){return function(_0x121cc3){if(_0x121cc3){var _0x1688d7=_0x121cc3[_0x0d1e('0x1f')],_0x3fef92=_0x4bd785[_0x0d1e('0x20')],_0x34efed=_0x4bd785[_0x0d1e('0x20')]+_0x4bd785[_0x0d1e('0x21')],_0x407805;if(_0x34efed>=_0x1688d7){_0x34efed=_0x1688d7;_0x407805=0xc8;}else{_0x407805=0xce;}_0x2e12cd[_0x0d1e('0x1c')](_0x407805);return _0x2e12cd[_0x0d1e('0x22')](_0x0d1e('0x23'),_0x3fef92+'-'+_0x34efed+'/'+_0x1688d7)[_0x0d1e('0x1e')](_0x121cc3);}return null;};}function patchUpdates(_0x1acb08){return function(_0x1239eb){try{jsonpatch[_0x0d1e('0x24')](_0x1239eb,_0x1acb08,!![]);}catch(_0x4684d1){return BPromise['reject'](_0x4684d1);}return _0x1239eb[_0x0d1e('0x25')]();};}function saveUpdates(_0xb22319,_0x5df7b4){return function(_0x151f6e){if(_0x151f6e){return _0x151f6e['update'](_0xb22319)[_0x0d1e('0x26')](function(_0x309841){return _0x309841;});}return null;};}function removeEntity(_0x12ea4a,_0x3cd4eb){return function(_0x1e3ff1){if(_0x1e3ff1){return _0x1e3ff1[_0x0d1e('0x27')]()[_0x0d1e('0x26')](function(){_0x12ea4a['status'](0xcc)[_0x0d1e('0x1d')]();});}};}function handleEntityNotFound(_0x27c4c6,_0x10f70d){return function(_0x4b1981){if(!_0x4b1981){_0x27c4c6['sendStatus'](0x194);}return _0x4b1981;};}function handleError(_0x517272,_0x117a73){_0x117a73=_0x117a73||0x1f4;return function(_0x5dbb79){logger['error'](_0x5dbb79[_0x0d1e('0x28')]);if(_0x5dbb79[_0x0d1e('0x29')]){delete _0x5dbb79[_0x0d1e('0x29')];}_0x517272[_0x0d1e('0x1c')](_0x117a73)[_0x0d1e('0x2a')](_0x5dbb79);};}exports[_0x0d1e('0x2b')]=function(_0x20913f,_0x48e6c1){var _0x5259e3={'raw':![],'where':{'id':_0x20913f[_0x0d1e('0x2c')]['id']}},_0x2637ca={};_0x2637ca[_0x0d1e('0x2d')]=_[_0x0d1e('0x2e')](db[_0x0d1e('0x2f')]['rawAttributes']);_0x2637ca[_0x0d1e('0x30')]=_[_0x0d1e('0x2e')](_0x20913f[_0x0d1e('0x30')]);_0x2637ca[_0x0d1e('0x31')]=_['intersection'](_0x2637ca['model'],_0x2637ca[_0x0d1e('0x30')]);_0x5259e3[_0x0d1e('0x32')]=_[_0x0d1e('0x33')](_0x2637ca[_0x0d1e('0x2d')],qs['fields'](_0x20913f[_0x0d1e('0x30')]['fields']));_0x5259e3[_0x0d1e('0x32')]=_0x5259e3['attributes'][_0x0d1e('0x34')]?_0x5259e3[_0x0d1e('0x32')]:_0x2637ca[_0x0d1e('0x2d')];if(_0x20913f['query']['includeAll']){_0x5259e3[_0x0d1e('0x35')]=[{'all':!![]}];}_0x5259e3=_[_0x0d1e('0x36')]({},_0x5259e3,_0x20913f[_0x0d1e('0x37')]);return db[_0x0d1e('0x2f')][_0x0d1e('0x38')](_0x5259e3)[_0x0d1e('0x26')](handleEntityNotFound(_0x48e6c1,null))[_0x0d1e('0x26')](respondWithResult(_0x48e6c1,null))[_0x0d1e('0x39')](handleError(_0x48e6c1,null));};exports[_0x0d1e('0x27')]=function(_0x2688e9,_0x300a9d){return db['DashboardItem'][_0x0d1e('0x38')]({'where':{'id':_0x2688e9[_0x0d1e('0x2c')]['id']}})[_0x0d1e('0x26')](handleEntityNotFound(_0x300a9d,null))[_0x0d1e('0x26')](removeEntity(_0x300a9d,null))[_0x0d1e('0x39')](handleError(_0x300a9d,null));};function widgetAttributes(_0x1b062b){try{switch(_0x1b062b['type']){case _0x0d1e('0x3a'):return[{'name':_0x0d1e('0x3b'),'value':_0x1b062b['attrUrl']||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b[_0x0d1e('0x3c')][0x0]?_0x1b062b['attrs'][0x0]['value']:undefined)||_0x0d1e('0x3d')}];case _0x0d1e('0x3e'):return[{'name':_0x0d1e('0x3f'),'value':_0x1b062b[_0x0d1e('0x3f')]||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b[_0x0d1e('0x3c')][0x0]?_0x1b062b[_0x0d1e('0x3c')][0x0][_0x0d1e('0x40')]:undefined)||''}];case _0x0d1e('0x41'):return[{'name':_0x0d1e('0x42'),'value':_0x1b062b['attrHourFormat']||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b['attrs'][0x0]?_0x1b062b[_0x0d1e('0x3c')][0x0][_0x0d1e('0x40')]:undefined)||_0x0d1e('0x43')},{'name':'attrTimezone','value':_0x1b062b[_0x0d1e('0x44')]||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b[_0x0d1e('0x3c')][0x1]?_0x1b062b['attrs'][0x1][_0x0d1e('0x40')]:undefined)||_0x0d1e('0x45')},{'name':'attrFontSize','value':_0x1b062b[_0x0d1e('0x46')]||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b[_0x0d1e('0x3c')][0x2]?_0x1b062b[_0x0d1e('0x3c')][0x2][_0x0d1e('0x40')]:undefined)||0xc}];case _0x0d1e('0x47'):return[{'name':_0x0d1e('0x48'),'value':_0x1b062b[_0x0d1e('0x48')]||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b[_0x0d1e('0x3c')][0x0]?_0x1b062b[_0x0d1e('0x3c')][0x0][_0x0d1e('0x40')]:undefined)||'total'},{'name':_0x0d1e('0x49'),'value':_0x1b062b[_0x0d1e('0x49')]||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b[_0x0d1e('0x3c')][0x1]?_0x1b062b[_0x0d1e('0x3c')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x1b062b[_0x0d1e('0x46')]||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b[_0x0d1e('0x3c')][0x2]?_0x1b062b[_0x0d1e('0x3c')][0x2][_0x0d1e('0x40')]:undefined)||0x14}];case _0x0d1e('0x4a'):case _0x0d1e('0x4b'):return[{'name':_0x0d1e('0x4c'),'value':_0x1b062b[_0x0d1e('0x4c')]||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b[_0x0d1e('0x3c')][0x0]?_0x1b062b['attrs'][0x0][_0x0d1e('0x40')]:undefined)||_0x0d1e('0x4d')},{'name':_0x0d1e('0x4e'),'value':_0x1b062b[_0x0d1e('0x4e')]||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b[_0x0d1e('0x3c')][0x1]?_0x1b062b[_0x0d1e('0x3c')][0x1][_0x0d1e('0x40')]:undefined)||null},{'name':_0x0d1e('0x4f'),'value':_0x1b062b[_0x0d1e('0x4f')]||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b['attrs'][0x2]?_0x1b062b['attrs'][0x2][_0x0d1e('0x40')]:undefined)||null},{'name':_0x0d1e('0x49'),'value':_0x1b062b[_0x0d1e('0x49')]||(_0x1b062b['attrs']&&_0x1b062b[_0x0d1e('0x3c')][0x3]?_0x1b062b[_0x0d1e('0x3c')][0x3][_0x0d1e('0x40')]:undefined)||[]}];case _0x0d1e('0x50'):return[{'name':'attrReport','type':_0x1b062b['reportType']||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b[_0x0d1e('0x3c')][0x0]?_0x1b062b[_0x0d1e('0x3c')][0x0][_0x0d1e('0x51')]:undefined)||null,'value':_0x1b062b[_0x0d1e('0x52')]||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b[_0x0d1e('0x3c')][0x0]?_0x1b062b['attrs'][0x0][_0x0d1e('0x40')]:undefined)||null},{'name':_0x0d1e('0x53'),'value':_0x1b062b[_0x0d1e('0x53')]||(_0x1b062b[_0x0d1e('0x3c')]&&_0x1b062b[_0x0d1e('0x3c')][0x1]?_0x1b062b[_0x0d1e('0x3c')][0x1][_0x0d1e('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x3cb4dd){logger[_0x0d1e('0x54')](_0x0d1e('0x55'),JSON[_0x0d1e('0x56')](_0x3cb4dd));return[];}}exports[_0x0d1e('0x57')]=function(_0x4f51e2,_0x1187e8){if(_0x4f51e2[_0x0d1e('0x58')]){_0x4f51e2['body'][_0x0d1e('0x3c')]=widgetAttributes(_0x4f51e2[_0x0d1e('0x58')]);}return db[_0x0d1e('0x2f')]['create'](_0x4f51e2[_0x0d1e('0x58')],{})[_0x0d1e('0x26')](respondWithResult(_0x1187e8,0xc9))[_0x0d1e('0x39')](handleError(_0x1187e8,null));};exports[_0x0d1e('0x59')]=function(_0x2d3d98,_0x22adec){if(_0x2d3d98[_0x0d1e('0x58')]['id']){delete _0x2d3d98[_0x0d1e('0x58')]['id'];}_0x2d3d98['body'][_0x0d1e('0x3c')]=widgetAttributes(_0x2d3d98[_0x0d1e('0x58')]);return db[_0x0d1e('0x2f')][_0x0d1e('0x38')]({'where':{'id':_0x2d3d98[_0x0d1e('0x2c')]['id']}})[_0x0d1e('0x26')](handleEntityNotFound(_0x22adec,null))[_0x0d1e('0x26')](saveUpdates(_0x2d3d98[_0x0d1e('0x58')],null))[_0x0d1e('0x26')](respondWithResult(_0x22adec,null))[_0x0d1e('0x39')](handleError(_0x22adec,null));}; \ No newline at end of file +var _0x19ff=['https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','html-pdf','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','error','stack','name','send','show','params','model','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','options','DashboardItem','find','then','catch','destroy','type','iframe','attrUrl','attrs'];(function(_0x43d495,_0x2d074c){var _0x4ab769=function(_0x569ae4){while(--_0x569ae4){_0x43d495['push'](_0x43d495['shift']());}};_0x4ab769(++_0x2d074c);}(_0x19ff,0x12a));var _0xf19f=function(_0x2fe245,_0x608257){_0x2fe245=_0x2fe245-0x0;var _0x21c004=_0x19ff[_0x2fe245];return _0x21c004;};'use strict';var pdf=require(_0xf19f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf19f('0x1'));var jsonpatch=require(_0xf19f('0x2'));var rp=require(_0xf19f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf19f('0x4'));var util=require(_0xf19f('0x5'));var path=require(_0xf19f('0x6'));var sox=require('sox');var csv=require(_0xf19f('0x7'));var ejs=require(_0xf19f('0x8'));var fs=require('fs');var _=require(_0xf19f('0x9'));var squel=require(_0xf19f('0xa'));var crypto=require(_0xf19f('0xb'));var jsforce=require(_0xf19f('0xc'));var deskjs=require(_0xf19f('0xd'));var toCsv=require(_0xf19f('0x7'));var querystring=require(_0xf19f('0xe'));var Papa=require(_0xf19f('0xf'));var Redis=require(_0xf19f('0x10'));var authService=require(_0xf19f('0x11'));var qs=require(_0xf19f('0x12'));var as=require(_0xf19f('0x13'));var hardwareService=require(_0xf19f('0x14'));var logger=require(_0xf19f('0x15'))(_0xf19f('0x16'));var utils=require('../../config/utils');var config=require(_0xf19f('0x17'));var db=require(_0xf19f('0x18'))['db'];config[_0xf19f('0x19')]=_[_0xf19f('0x1a')](config[_0xf19f('0x19')],{'host':_0xf19f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf19f('0x19')]));require(_0xf19f('0x1c'))['register'](socket);function respondWithStatusCode(_0x12fd14,_0x328a48){_0x328a48=_0x328a48||0xcc;return function(_0x40f4d3){if(_0x40f4d3){return _0x12fd14[_0xf19f('0x1d')](_0x328a48);}return _0x12fd14[_0xf19f('0x1e')](_0x328a48)[_0xf19f('0x1f')]();};}function respondWithResult(_0xb3ce48,_0x512dfc){_0x512dfc=_0x512dfc||0xc8;return function(_0x583c22){if(_0x583c22){return _0xb3ce48[_0xf19f('0x1e')](_0x512dfc)[_0xf19f('0x20')](_0x583c22);}};}function respondWithFilteredResult(_0x88c25c,_0x39d685){return function(_0x164420){if(_0x164420){var _0x1c9c6e=_0x164420[_0xf19f('0x21')],_0x418309=_0x39d685[_0xf19f('0x22')],_0x3d26a6=_0x39d685[_0xf19f('0x22')]+_0x39d685[_0xf19f('0x23')],_0x2db30f;if(_0x3d26a6>=_0x1c9c6e){_0x3d26a6=_0x1c9c6e;_0x2db30f=0xc8;}else{_0x2db30f=0xce;}_0x88c25c['status'](_0x2db30f);return _0x88c25c[_0xf19f('0x24')]('Content-Range',_0x418309+'-'+_0x3d26a6+'/'+_0x1c9c6e)[_0xf19f('0x20')](_0x164420);}return null;};}function patchUpdates(_0x48b684){return function(_0x15d258){try{jsonpatch[_0xf19f('0x25')](_0x15d258,_0x48b684,!![]);}catch(_0x972945){return BPromise[_0xf19f('0x26')](_0x972945);}return _0x15d258['save']();};}function saveUpdates(_0x80a855,_0x2845f9){return function(_0x9b277a){if(_0x9b277a){return _0x9b277a[_0xf19f('0x27')](_0x80a855)['then'](function(_0x156bfd){return _0x156bfd;});}return null;};}function removeEntity(_0x5c294b,_0x133179){return function(_0x220e3e){if(_0x220e3e){return _0x220e3e['destroy']()['then'](function(){_0x5c294b['status'](0xcc)[_0xf19f('0x1f')]();});}};}function handleEntityNotFound(_0x496546,_0x47b621){return function(_0x2dc4e9){if(!_0x2dc4e9){_0x496546[_0xf19f('0x1d')](0x194);}return _0x2dc4e9;};}function handleError(_0x1a4d81,_0x20efba){_0x20efba=_0x20efba||0x1f4;return function(_0x1a0613){logger[_0xf19f('0x28')](_0x1a0613[_0xf19f('0x29')]);if(_0x1a0613[_0xf19f('0x2a')]){delete _0x1a0613['name'];}_0x1a4d81[_0xf19f('0x1e')](_0x20efba)[_0xf19f('0x2b')](_0x1a0613);};}exports[_0xf19f('0x2c')]=function(_0x52e227,_0x2d23bd){var _0x3a28a3={'raw':![],'where':{'id':_0x52e227[_0xf19f('0x2d')]['id']}},_0x20f226={};_0x20f226[_0xf19f('0x2e')]=_['keys'](db['DashboardItem'][_0xf19f('0x2f')]);_0x20f226[_0xf19f('0x30')]=_['keys'](_0x52e227['query']);_0x20f226[_0xf19f('0x31')]=_[_0xf19f('0x32')](_0x20f226['model'],_0x20f226[_0xf19f('0x30')]);_0x3a28a3[_0xf19f('0x33')]=_[_0xf19f('0x32')](_0x20f226['model'],qs[_0xf19f('0x34')](_0x52e227[_0xf19f('0x30')][_0xf19f('0x34')]));_0x3a28a3[_0xf19f('0x33')]=_0x3a28a3['attributes'][_0xf19f('0x35')]?_0x3a28a3[_0xf19f('0x33')]:_0x20f226[_0xf19f('0x2e')];if(_0x52e227['query'][_0xf19f('0x36')]){_0x3a28a3[_0xf19f('0x37')]=[{'all':!![]}];}_0x3a28a3=_['merge']({},_0x3a28a3,_0x52e227[_0xf19f('0x38')]);return db[_0xf19f('0x39')][_0xf19f('0x3a')](_0x3a28a3)['then'](handleEntityNotFound(_0x2d23bd,null))[_0xf19f('0x3b')](respondWithResult(_0x2d23bd,null))[_0xf19f('0x3c')](handleError(_0x2d23bd,null));};exports[_0xf19f('0x3d')]=function(_0x4d2513,_0x4221f9){return db[_0xf19f('0x39')][_0xf19f('0x3a')]({'where':{'id':_0x4d2513[_0xf19f('0x2d')]['id']}})[_0xf19f('0x3b')](handleEntityNotFound(_0x4221f9,null))[_0xf19f('0x3b')](removeEntity(_0x4221f9,null))[_0xf19f('0x3c')](handleError(_0x4221f9,null));};function widgetAttributes(_0x5dda52){try{switch(_0x5dda52[_0xf19f('0x3e')]){case _0xf19f('0x3f'):return[{'name':_0xf19f('0x40'),'value':_0x5dda52['attrUrl']||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52['attrs'][0x0]?_0x5dda52['attrs'][0x0]['value']:undefined)||_0xf19f('0x42')}];case _0xf19f('0x43'):return[{'name':_0xf19f('0x44'),'value':_0x5dda52['attrPath']||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x0]?_0x5dda52[_0xf19f('0x41')][0x0][_0xf19f('0x45')]:undefined)||''}];case _0xf19f('0x46'):return[{'name':_0xf19f('0x47'),'value':_0x5dda52[_0xf19f('0x47')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x0]?_0x5dda52[_0xf19f('0x41')][0x0]['value']:undefined)||_0xf19f('0x48')},{'name':_0xf19f('0x49'),'value':_0x5dda52[_0xf19f('0x49')]||(_0x5dda52['attrs']&&_0x5dda52['attrs'][0x1]?_0x5dda52[_0xf19f('0x41')][0x1]['value']:undefined)||_0xf19f('0x4a')},{'name':'attrFontSize','value':_0x5dda52[_0xf19f('0x4b')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x2]?_0x5dda52[_0xf19f('0x41')][0x2]['value']:undefined)||0xc}];case _0xf19f('0x4c'):return[{'name':_0xf19f('0x4d'),'value':_0x5dda52['attrMetric']||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x0]?_0x5dda52['attrs'][0x0][_0xf19f('0x45')]:undefined)||_0xf19f('0x4e')},{'name':_0xf19f('0x4f'),'value':_0x5dda52[_0xf19f('0x4f')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x1]?_0x5dda52[_0xf19f('0x41')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x5dda52[_0xf19f('0x4b')]||(_0x5dda52['attrs']&&_0x5dda52['attrs'][0x2]?_0x5dda52[_0xf19f('0x41')][0x2][_0xf19f('0x45')]:undefined)||0x14}];case _0xf19f('0x50'):case'pie-chart':return[{'name':_0xf19f('0x51'),'value':_0x5dda52[_0xf19f('0x51')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52['attrs'][0x0]?_0x5dda52[_0xf19f('0x41')][0x0]['value']:undefined)||_0xf19f('0x4e')},{'name':_0xf19f('0x52'),'value':_0x5dda52['attrSerie2']||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x1]?_0x5dda52[_0xf19f('0x41')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x5dda52[_0xf19f('0x53')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x2]?_0x5dda52[_0xf19f('0x41')][0x2]['value']:undefined)||null},{'name':_0xf19f('0x4f'),'value':_0x5dda52[_0xf19f('0x4f')]||(_0x5dda52['attrs']&&_0x5dda52['attrs'][0x3]?_0x5dda52['attrs'][0x3][_0xf19f('0x45')]:undefined)||[]}];case'web-report':return[{'name':_0xf19f('0x54'),'type':_0x5dda52[_0xf19f('0x55')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x0]?_0x5dda52[_0xf19f('0x41')][0x0]['type']:undefined)||null,'value':_0x5dda52['attrReport']||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x0]?_0x5dda52['attrs'][0x0][_0xf19f('0x45')]:undefined)||null},{'name':'attrRefresh','value':_0x5dda52[_0xf19f('0x56')]||(_0x5dda52[_0xf19f('0x41')]&&_0x5dda52[_0xf19f('0x41')][0x1]?_0x5dda52[_0xf19f('0x41')][0x1][_0xf19f('0x45')]:undefined)||0x0}];default:return[];}}catch(_0x4e96d8){logger[_0xf19f('0x28')](_0xf19f('0x57'),JSON[_0xf19f('0x58')](_0x4e96d8));return[];}}exports[_0xf19f('0x59')]=function(_0x5ce579,_0x3a7570){if(_0x5ce579[_0xf19f('0x5a')]){_0x5ce579['body']['attrs']=widgetAttributes(_0x5ce579[_0xf19f('0x5a')]);}return db[_0xf19f('0x39')][_0xf19f('0x59')](_0x5ce579[_0xf19f('0x5a')],{})[_0xf19f('0x3b')](respondWithResult(_0x3a7570,0xc9))[_0xf19f('0x3c')](handleError(_0x3a7570,null));};exports[_0xf19f('0x27')]=function(_0xbae2e7,_0xdefb60){if(_0xbae2e7['body']['id']){delete _0xbae2e7['body']['id'];}_0xbae2e7[_0xf19f('0x5a')][_0xf19f('0x41')]=widgetAttributes(_0xbae2e7[_0xf19f('0x5a')]);return db[_0xf19f('0x39')][_0xf19f('0x3a')]({'where':{'id':_0xbae2e7[_0xf19f('0x2d')]['id']}})['then'](handleEntityNotFound(_0xdefb60,null))[_0xf19f('0x3b')](saveUpdates(_0xbae2e7[_0xf19f('0x5a')],null))[_0xf19f('0x3b')](respondWithResult(_0xdefb60,null))[_0xf19f('0x3c')](handleError(_0xdefb60,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 98af8f5..442e067 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 _0xc923=['DashboardItem','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x42ead5,_0x58c1b8){var _0x1c08cc=function(_0x19efa2){while(--_0x19efa2){_0x42ead5['push'](_0x42ead5['shift']());}};_0x1c08cc(++_0x58c1b8);}(_0xc923,0x1ef));var _0x3c92=function(_0x51fa5c,_0x4ab762){_0x51fa5c=_0x51fa5c-0x0;var _0x1a7131=_0xc923[_0x51fa5c];return _0x1a7131;};'use strict';var EventEmitter=require(_0x3c92('0x0'));var DashboardItem=require(_0x3c92('0x1'))['db'][_0x3c92('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5ebcfd){return function(_0x3fd700,_0x3b52a5,_0x166f22){DashboardItemEvents[_0x3c92('0x3')](_0x5ebcfd+':'+_0x3fd700['id'],_0x3fd700);DashboardItemEvents[_0x3c92('0x3')](_0x5ebcfd,_0x3fd700);_0x166f22(null);};}for(var e in events){if(events[_0x3c92('0x4')](e)){var event=events[e];DashboardItem[_0x3c92('0x5')](e,emitEvent(event));}}module[_0x3c92('0x6')]=DashboardItemEvents; \ No newline at end of file +var _0x8a1a=['save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x2eb3db,_0x4a32c0){var _0x358f33=function(_0x1d0588){while(--_0x1d0588){_0x2eb3db['push'](_0x2eb3db['shift']());}};_0x358f33(++_0x4a32c0);}(_0x8a1a,0x110));var _0xa8a1=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x8a1a[_0x54d4fe];return _0x1ab5bb;};'use strict';var EventEmitter=require(_0xa8a1('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa8a1('0x1'),'afterUpdate':_0xa8a1('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3c1455){return function(_0x56d3eb,_0x4d9b44,_0x1f794b){DashboardItemEvents[_0xa8a1('0x3')](_0x3c1455+':'+_0x56d3eb['id'],_0x56d3eb);DashboardItemEvents[_0xa8a1('0x3')](_0x3c1455,_0x56d3eb);_0x1f794b(null);};}for(var e in events){if(events[_0xa8a1('0x4')](e)){var event=events[e];DashboardItem[_0xa8a1('0x5')](e,emitEvent(event));}}module[_0xa8a1('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 85e1321..f0b405a 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 _0x3d69=['moment','bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes','DashboardItem','dashboard_items','lodash','util','../../config/logger','api'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0x3d69,0x110));var _0x93d6=function(_0xe1abca,_0x3dac84){_0xe1abca=_0xe1abca-0x0;var _0x52a661=_0x3d69[_0xe1abca];return _0x52a661;};'use strict';var _=require(_0x93d6('0x0'));var util=require(_0x93d6('0x1'));var logger=require(_0x93d6('0x2'))(_0x93d6('0x3'));var moment=require(_0x93d6('0x4'));var BPromise=require(_0x93d6('0x5'));var rp=require(_0x93d6('0x6'));var fs=require('fs');var path=require(_0x93d6('0x7'));var rimraf=require('rimraf');var config=require(_0x93d6('0x8'));var attributes=require(_0x93d6('0x9'));module['exports']=function(_0x84ea1,_0x70df2a){return _0x84ea1['define'](_0x93d6('0xa'),attributes,{'tableName':_0x93d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad1b=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x43dfa1,_0x3455d8){var _0x717ade=function(_0x46a201){while(--_0x46a201){_0x43dfa1['push'](_0x43dfa1['shift']());}};_0x717ade(++_0x3455d8);}(_0xad1b,0x1c6));var _0xbad1=function(_0x47602a,_0x35be20){_0x47602a=_0x47602a-0x0;var _0x333836=_0xad1b[_0x47602a];return _0x333836;};'use strict';var _=require(_0xbad1('0x0'));var util=require(_0xbad1('0x1'));var logger=require(_0xbad1('0x2'))('api');var moment=require(_0xbad1('0x3'));var BPromise=require(_0xbad1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbad1('0x5'));var rimraf=require(_0xbad1('0x6'));var config=require(_0xbad1('0x7'));var attributes=require(_0xbad1('0x8'));module[_0xbad1('0x9')]=function(_0x1d54fc,_0x5e0562){return _0x1d54fc[_0xbad1('0xa')](_0xbad1('0xb'),attributes,{'tableName':_0xbad1('0xc'),'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 2aee000..6020686 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 _0x2db1=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','./dashboardItem.socket','register','request','then','info','request\x20sent','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x568f3d,_0x3fb237){var _0x3aa727=function(_0x5a0f9f){while(--_0x5a0f9f){_0x568f3d['push'](_0x568f3d['shift']());}};_0x3aa727(++_0x3fb237);}(_0x2db1,0x7d));var _0x12db=function(_0x4b9298,_0x40ddcf){_0x4b9298=_0x4b9298-0x0;var _0x369af0=_0x2db1[_0x4b9298];return _0x369af0;};'use strict';var _=require(_0x12db('0x0'));var util=require(_0x12db('0x1'));var moment=require(_0x12db('0x2'));var BPromise=require(_0x12db('0x3'));var rs=require(_0x12db('0x4'));var fs=require('fs');var Redis=require(_0x12db('0x5'));var db=require(_0x12db('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x12db('0x7'))(_0x12db('0x8'));var config=require(_0x12db('0x9'));var jayson=require(_0x12db('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x12db('0xb')]=_['defaults'](config[_0x12db('0xb')],{'host':_0x12db('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x12db('0xd'))[_0x12db('0xe')](socket);function respondWithRpcPromise(_0x73e587,_0x322bc4,_0x19e868){return new BPromise(function(_0xe42596,_0x2a50af){return client[_0x12db('0xf')](_0x73e587,_0x19e868)[_0x12db('0x10')](function(_0x38b6b3){logger[_0x12db('0x11')]('DashboardItem,\x20%s,\x20%s',_0x322bc4,_0x12db('0x12'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x322bc4,_0x12db('0x12'),JSON[_0x12db('0x13')](_0x38b6b3));if(_0x38b6b3[_0x12db('0x14')]){if(_0x38b6b3[_0x12db('0x14')][_0x12db('0x15')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x322bc4,_0x38b6b3[_0x12db('0x14')]['message']);return _0x2a50af(_0x38b6b3[_0x12db('0x14')][_0x12db('0x16')]);}logger[_0x12db('0x14')]('DashboardItem,\x20%s,\x20%s',_0x322bc4,_0x38b6b3['error'][_0x12db('0x16')]);return _0xe42596(_0x38b6b3[_0x12db('0x14')][_0x12db('0x16')]);}else{logger[_0x12db('0x11')](_0x12db('0x17'),_0x322bc4,_0x12db('0x12'));_0xe42596(_0x38b6b3[_0x12db('0x18')][_0x12db('0x16')]);}})[_0x12db('0x19')](function(_0x11c945){logger['error'](_0x12db('0x17'),_0x322bc4,_0x11c945);_0x2a50af(_0x11c945);});});} \ No newline at end of file +var _0x368f=['./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter'];(function(_0x5d4405,_0x3e4872){var _0xfd017=function(_0x3bb87c){while(--_0x3bb87c){_0x5d4405['push'](_0x5d4405['shift']());}};_0xfd017(++_0x3e4872);}(_0x368f,0x11f));var _0xf368=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x368f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xf368('0x0'));var util=require(_0xf368('0x1'));var moment=require('moment');var BPromise=require(_0xf368('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf368('0x3'));var db=require(_0xf368('0x4'))['db'];var utils=require(_0xf368('0x5'));var logger=require(_0xf368('0x6'))(_0xf368('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf368('0x8')][_0xf368('0x9')]({'port':0x232a});config[_0xf368('0xa')]=_['defaults'](config['redis'],{'host':_0xf368('0xb'),'port':0x18eb});var socket=require(_0xf368('0xc'))(new Redis(config['redis']));require(_0xf368('0xd'))[_0xf368('0xe')](socket);function respondWithRpcPromise(_0x37b555,_0xc5150b,_0xc93ddb){return new BPromise(function(_0x5f49f0,_0x5e3329){return client['request'](_0x37b555,_0xc93ddb)[_0xf368('0xf')](function(_0x429359){logger[_0xf368('0x10')](_0xf368('0x11'),_0xc5150b,'request\x20sent');logger[_0xf368('0x12')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0xc5150b,_0xf368('0x13'),JSON[_0xf368('0x14')](_0x429359));if(_0x429359[_0xf368('0x15')]){if(_0x429359['error'][_0xf368('0x16')]===0x1f4){logger['error'](_0xf368('0x11'),_0xc5150b,_0x429359[_0xf368('0x15')][_0xf368('0x17')]);return _0x5e3329(_0x429359[_0xf368('0x15')][_0xf368('0x17')]);}logger[_0xf368('0x15')](_0xf368('0x11'),_0xc5150b,_0x429359[_0xf368('0x15')][_0xf368('0x17')]);return _0x5f49f0(_0x429359['error'][_0xf368('0x17')]);}else{logger['info'](_0xf368('0x11'),_0xc5150b,_0xf368('0x13'));_0x5f49f0(_0x429359['result'][_0xf368('0x17')]);}})[_0xf368('0x18')](function(_0x3dbb0c){logger[_0xf368('0x15')](_0xf368('0x11'),_0xc5150b,_0x3dbb0c);_0x5e3329(_0x3dbb0c);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 93c90a1..5aedef4 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 _0x0c8b=['length','dashboardItem:','./dashboardItem.events','save','remove','emit','removeListener'];(function(_0x219c34,_0xdfd698){var _0x3189d2=function(_0x3572a8){while(--_0x3572a8){_0x219c34['push'](_0x219c34['shift']());}};_0x3189d2(++_0xdfd698);}(_0x0c8b,0x1ec));var _0xb0c8=function(_0x37f053,_0x4b2ad0){_0x37f053=_0x37f053-0x0;var _0x78f6a0=_0x0c8b[_0x37f053];return _0x78f6a0;};'use strict';var DashboardItemEvents=require(_0xb0c8('0x0'));var events=[_0xb0c8('0x1'),_0xb0c8('0x2'),'update'];function createListener(_0x2d45de,_0x25e0dc){return function(_0x486c0a){_0x25e0dc[_0xb0c8('0x3')](_0x2d45de,_0x486c0a);};}function removeListener(_0x26e951,_0x35d062){return function(){DashboardItemEvents[_0xb0c8('0x4')](_0x26e951,_0x35d062);};}exports['register']=function(_0x1d390b){for(var _0x160e50=0x0,_0x1a402a=events[_0xb0c8('0x5')];_0x160e50<_0x1a402a;_0x160e50++){var _0x9a4b9d=events[_0x160e50];var _0x1f2a55=createListener(_0xb0c8('0x6')+_0x9a4b9d,_0x1d390b);DashboardItemEvents['on'](_0x9a4b9d,_0x1f2a55);}}; \ No newline at end of file +var _0x712c=['./dashboardItem.events','save','remove','update','removeListener','register','length','dashboardItem:'];(function(_0x7ba80c,_0x5a64cf){var _0x423725=function(_0x4bd110){while(--_0x4bd110){_0x7ba80c['push'](_0x7ba80c['shift']());}};_0x423725(++_0x5a64cf);}(_0x712c,0x78));var _0xc712=function(_0x5e9be9,_0x1b7e0b){_0x5e9be9=_0x5e9be9-0x0;var _0x57eaee=_0x712c[_0x5e9be9];return _0x57eaee;};'use strict';var DashboardItemEvents=require(_0xc712('0x0'));var events=[_0xc712('0x1'),_0xc712('0x2'),_0xc712('0x3')];function createListener(_0x24fe3e,_0x4a2152){return function(_0x43af54){_0x4a2152['emit'](_0x24fe3e,_0x43af54);};}function removeListener(_0x212916,_0x2aa2e6){return function(){DashboardItemEvents[_0xc712('0x4')](_0x212916,_0x2aa2e6);};}exports[_0xc712('0x5')]=function(_0x45ef73){for(var _0x11cb15=0x0,_0x538e01=events[_0xc712('0x6')];_0x11cb15<_0x538e01;_0x11cb15++){var _0xb07435=events[_0x11cb15];var _0x4eb7e=createListener(_0xc712('0x7')+_0xb07435,_0x45ef73);DashboardItemEvents['on'](_0xb07435,_0x4eb7e);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 5670dab..08fe0fc 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 _0x4975=['/:id','show','isAuthenticated','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get'];(function(_0x397004,_0x7949f){var _0xa7a10=function(_0x377854){while(--_0x377854){_0x397004['push'](_0x397004['shift']());}};_0xa7a10(++_0x7949f);}(_0x4975,0x86));var _0x5497=function(_0x25de61,_0x574bfd){_0x25de61=_0x25de61-0x0;var _0x271834=_0x4975[_0x25de61];return _0x271834;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var auth=require(_0x5497('0x5'));var interaction=require(_0x5497('0x6'));var config=require(_0x5497('0x7'));var controller=require(_0x5497('0x8'));router[_0x5497('0x9')](_0x5497('0xa'),auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['post']('/',auth[_0x5497('0xc')](),controller[_0x5497('0xd')]);router[_0x5497('0xe')]('/:id',auth[_0x5497('0xc')](),controller['update']);router[_0x5497('0xf')](_0x5497('0xa'),auth[_0x5497('0xc')](),controller[_0x5497('0x10')]);module[_0x5497('0x11')]=router; \ No newline at end of file +var _0x326f=['create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post'];(function(_0x4ae74b,_0x4c2ad8){var _0x55b780=function(_0x542f3b){while(--_0x542f3b){_0x4ae74b['push'](_0x4ae74b['shift']());}};_0x55b780(++_0x4c2ad8);}(_0x326f,0xd1));var _0xf326=function(_0x3ea4d8,_0x173ee4){_0x3ea4d8=_0x3ea4d8-0x0;var _0x14d3d2=_0x326f[_0x3ea4d8];return _0x14d3d2;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')](_0xf326('0x9'),auth[_0xf326('0xa')](),controller['show']);router[_0xf326('0xb')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf326('0xe')](_0xf326('0x9'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);module[_0xf326('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 8fae9c6..5b76231 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 _0x961b=['STRING','sequelize','exports'];(function(_0x1ce101,_0x396e9a){var _0x578960=function(_0x4b24b6){while(--_0x4b24b6){_0x1ce101['push'](_0x1ce101['shift']());}};_0x578960(++_0x396e9a);}(_0x961b,0x166));var _0xb961=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0x961b[_0x460150];return _0x340677;};'use strict';var Sequelize=require(_0xb961('0x0'));module[_0xb961('0x1')]={'name':{'type':Sequelize[_0xb961('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x42d5=['exports','STRING'];(function(_0x58b542,_0x2dc849){var _0x423500=function(_0x5a8916){while(--_0x5a8916){_0x58b542['push'](_0x58b542['shift']());}};_0x423500(++_0x2dc849);}(_0x42d5,0x114));var _0x542d=function(_0x2c375e,_0x606a7b){_0x2c375e=_0x2c375e-0x0;var _0x20c576=_0x42d5[_0x2c375e];return _0x20c576;};'use strict';var Sequelize=require('sequelize');module[_0x542d('0x0')]={'name':{'type':Sequelize[_0x542d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index b1100e4..caaffbc 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 _0xe14d=['includeAll','include','rows','catch','params','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','get','Dispositions','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','pick','filter','where','merge','type','VIRTUAL'];(function(_0x52784b,_0x35e2f0){var _0x3e90ec=function(_0x1d507f){while(--_0x1d507f){_0x52784b['push'](_0x52784b['shift']());}};_0x3e90ec(++_0x35e2f0);}(_0xe14d,0x1ee));var _0xde14=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xe14d[_0x33032e];return _0x13316b;};'use strict';var pdf=require(_0xde14('0x0'));var emlformat=require(_0xde14('0x1'));var rimraf=require(_0xde14('0x2'));var zipdir=require(_0xde14('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xde14('0x4'));var moment=require(_0xde14('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xde14('0x6'));var util=require(_0xde14('0x7'));var path=require(_0xde14('0x8'));var sox=require(_0xde14('0x9'));var csv=require(_0xde14('0xa'));var ejs=require(_0xde14('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0xa'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var db=require(_0xde14('0x19'))['db'];function respondWithStatusCode(_0x3d5a29,_0x34e28f){_0x34e28f=_0x34e28f||0xcc;return function(_0x29e3ca){if(_0x29e3ca){return _0x3d5a29[_0xde14('0x1a')](_0x34e28f);}return _0x3d5a29[_0xde14('0x1b')](_0x34e28f)[_0xde14('0x1c')]();};}function respondWithResult(_0x281c54,_0x1489e9){_0x1489e9=_0x1489e9||0xc8;return function(_0x54c58b){if(_0x54c58b){return _0x281c54['status'](_0x1489e9)[_0xde14('0x1d')](_0x54c58b);}};}function respondWithFilteredResult(_0x1db2f6,_0x26c1ec){return function(_0x4c86ff){if(_0x4c86ff){var _0x16aa55=_0x4c86ff[_0xde14('0x1e')],_0x31adb3=_0x26c1ec[_0xde14('0x1f')],_0x257390=_0x26c1ec[_0xde14('0x1f')]+_0x26c1ec[_0xde14('0x20')],_0x31902a;if(_0x257390>=_0x16aa55){_0x257390=_0x16aa55;_0x31902a=0xc8;}else{_0x31902a=0xce;}_0x1db2f6[_0xde14('0x1b')](_0x31902a);return _0x1db2f6[_0xde14('0x21')]('Content-Range',_0x31adb3+'-'+_0x257390+'/'+_0x16aa55)[_0xde14('0x1d')](_0x4c86ff);}return null;};}function patchUpdates(_0x3bfc59){return function(_0x2eb8a8){try{jsonpatch[_0xde14('0x22')](_0x2eb8a8,_0x3bfc59,!![]);}catch(_0x4ce69f){return BPromise[_0xde14('0x23')](_0x4ce69f);}return _0x2eb8a8['save']();};}function saveUpdates(_0x45d101,_0x4c24a8){return function(_0xa50687){if(_0xa50687){return _0xa50687[_0xde14('0x24')](_0x45d101)[_0xde14('0x25')](function(_0x1949ab){return _0x1949ab;});}return null;};}function removeEntity(_0x39bdc5,_0x11a4d9){return function(_0x40b648){if(_0x40b648){return _0x40b648[_0xde14('0x26')]()[_0xde14('0x25')](function(){var _0x163b79=_0x40b648[_0xde14('0x27')]({'plain':!![]});var _0xbaa078=_0xde14('0x28');return db['UserProfileResource'][_0xde14('0x26')]({'where':{'type':_0xbaa078,'resourceId':_0x163b79['id']}})[_0xde14('0x25')](function(){return _0x40b648;});})[_0xde14('0x25')](function(){_0x39bdc5[_0xde14('0x1b')](0xcc)[_0xde14('0x1c')]();});}};}function handleEntityNotFound(_0x21ef15,_0x310d75){return function(_0x23c735){if(!_0x23c735){_0x21ef15[_0xde14('0x1a')](0x194);}return _0x23c735;};}function handleError(_0x350a78,_0x4eff65){_0x4eff65=_0x4eff65||0x1f4;return function(_0x309922){logger[_0xde14('0x29')](_0x309922[_0xde14('0x2a')]);if(_0x309922[_0xde14('0x2b')]){delete _0x309922['name'];}_0x350a78[_0xde14('0x1b')](_0x4eff65)[_0xde14('0x2c')](_0x309922);};}exports[_0xde14('0x2d')]=function(_0x553cab,_0x4655fb){var _0x582537={},_0x2760f9={},_0x361b2c={'count':0x0,'rows':[]};var _0x3bb1da=_[_0xde14('0x2e')](db[_0xde14('0x2f')][_0xde14('0x30')],function(_0xae9dca){return{'name':_0xae9dca[_0xde14('0x31')],'type':_0xae9dca['type'][_0xde14('0x32')]};});_0x2760f9[_0xde14('0x33')]=_['map'](_0x3bb1da,_0xde14('0x2b'));_0x2760f9['query']=_[_0xde14('0x34')](_0x553cab[_0xde14('0x35')]);_0x2760f9[_0xde14('0x36')]=_[_0xde14('0x37')](_0x2760f9[_0xde14('0x33')],_0x2760f9['query']);_0x582537[_0xde14('0x38')]=_[_0xde14('0x37')](_0x2760f9['model'],qs[_0xde14('0x39')](_0x553cab[_0xde14('0x35')][_0xde14('0x39')]));_0x582537[_0xde14('0x38')]=_0x582537[_0xde14('0x38')][_0xde14('0x3a')]?_0x582537[_0xde14('0x38')]:_0x2760f9[_0xde14('0x33')];if(!_0x553cab[_0xde14('0x35')]['hasOwnProperty']('nolimit')){_0x582537[_0xde14('0x20')]=qs[_0xde14('0x20')](_0x553cab[_0xde14('0x35')][_0xde14('0x20')]);_0x582537[_0xde14('0x1f')]=qs[_0xde14('0x1f')](_0x553cab[_0xde14('0x35')][_0xde14('0x1f')]);}_0x582537[_0xde14('0x3b')]=qs['sort'](_0x553cab[_0xde14('0x35')]['sort']);_0x582537['where']=qs['filters'](_[_0xde14('0x3c')](_0x553cab[_0xde14('0x35')],_0x2760f9[_0xde14('0x36')]));if(_0x553cab[_0xde14('0x35')][_0xde14('0x3d')]){_0x582537[_0xde14('0x3e')]=_[_0xde14('0x3f')](_0x582537[_0xde14('0x3e')],{'$or':_['map'](_0x3bb1da,function(_0xc2a39d){if(_0xc2a39d[_0xde14('0x40')]!==_0xde14('0x41')){var _0x2b3004={};_0x2b3004[_0xc2a39d[_0xde14('0x2b')]]={'$like':'%'+_0x553cab[_0xde14('0x35')][_0xde14('0x3d')]+'%'};return _0x2b3004;}})});}_0x582537=_[_0xde14('0x3f')]({},_0x582537,_0x553cab['options']);var _0x225164={'where':_0x582537[_0xde14('0x3e')]};return db[_0xde14('0x2f')][_0xde14('0x1e')](_0x225164)['then'](function(_0x5ebb03){_0x361b2c[_0xde14('0x1e')]=_0x5ebb03;if(_0x553cab[_0xde14('0x35')][_0xde14('0x42')]){_0x582537[_0xde14('0x43')]=[{'all':!![]}];}return db[_0xde14('0x2f')]['findAll'](_0x582537);})[_0xde14('0x25')](function(_0x70c912){_0x361b2c[_0xde14('0x44')]=_0x70c912;return _0x361b2c;})['then'](respondWithFilteredResult(_0x4655fb,_0x582537))[_0xde14('0x45')](handleError(_0x4655fb,null));};exports['show']=function(_0x46ac22,_0x51ace9){var _0x102770={'raw':!![],'where':{'id':_0x46ac22[_0xde14('0x46')]['id']}},_0x117c64={};_0x117c64[_0xde14('0x33')]=_[_0xde14('0x34')](db[_0xde14('0x2f')][_0xde14('0x30')]);_0x117c64[_0xde14('0x35')]=_['keys'](_0x46ac22[_0xde14('0x35')]);_0x117c64['filters']=_[_0xde14('0x37')](_0x117c64['model'],_0x117c64[_0xde14('0x35')]);_0x102770[_0xde14('0x38')]=_[_0xde14('0x37')](_0x117c64[_0xde14('0x33')],qs[_0xde14('0x39')](_0x46ac22[_0xde14('0x35')][_0xde14('0x39')]));_0x102770[_0xde14('0x38')]=_0x102770['attributes'][_0xde14('0x3a')]?_0x102770[_0xde14('0x38')]:_0x117c64[_0xde14('0x33')];if(_0x46ac22[_0xde14('0x35')]['includeAll']){_0x102770[_0xde14('0x43')]=[{'all':!![]}];}_0x102770=_[_0xde14('0x3f')]({},_0x102770,_0x46ac22[_0xde14('0x47')]);return db[_0xde14('0x2f')][_0xde14('0x48')](_0x102770)[_0xde14('0x25')](handleEntityNotFound(_0x51ace9,null))['then'](respondWithResult(_0x51ace9,null))[_0xde14('0x45')](handleError(_0x51ace9,null));};exports['create']=function(_0xa408ec,_0x383b99){return db['Disposition'][_0xde14('0x49')](_0xa408ec[_0xde14('0x4a')],{})[_0xde14('0x25')](function(_0x2775da){var _0x2d05c7=_0xa408ec[_0xde14('0x4b')][_0xde14('0x27')]({'plain':!![]});if(!_0x2d05c7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d05c7[_0xde14('0x4c')]==='user'){var _0xfa80c8=_0x2775da[_0xde14('0x27')]({'plain':!![]});var _0x237be4=_0xde14('0x28');return db[_0xde14('0x4d')][_0xde14('0x48')]({'where':{'name':_0x237be4,'userProfileId':_0x2d05c7[_0xde14('0x4e')]},'raw':!![]})[_0xde14('0x25')](function(_0x3495d1){if(_0x3495d1&&_0x3495d1[_0xde14('0x4f')]===0x0){return db['UserProfileResource'][_0xde14('0x49')]({'name':_0xfa80c8[_0xde14('0x2b')],'resourceId':_0xfa80c8['id'],'type':_0x3495d1[_0xde14('0x2b')],'sectionId':_0x3495d1['id']},{})[_0xde14('0x25')](function(){return _0x2775da;});}else{return _0x2775da;}})[_0xde14('0x45')](function(_0x4874ed){logger[_0xde14('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4874ed);throw _0x4874ed;});}return _0x2775da;})[_0xde14('0x25')](respondWithResult(_0x383b99,0xc9))[_0xde14('0x45')](handleError(_0x383b99,null));};exports[_0xde14('0x24')]=function(_0x115d3e,_0x30d230){if(_0x115d3e['body']['id']){delete _0x115d3e['body']['id'];}return db[_0xde14('0x2f')]['find']({'where':{'id':_0x115d3e[_0xde14('0x46')]['id']}})[_0xde14('0x25')](handleEntityNotFound(_0x30d230,null))[_0xde14('0x25')](saveUpdates(_0x115d3e[_0xde14('0x4a')],null))[_0xde14('0x25')](respondWithResult(_0x30d230,null))[_0xde14('0x45')](handleError(_0x30d230,null));};exports[_0xde14('0x26')]=function(_0x187bd3,_0x423adc){return db['Disposition'][_0xde14('0x48')]({'where':{'id':_0x187bd3[_0xde14('0x46')]['id']}})[_0xde14('0x25')](handleEntityNotFound(_0x423adc,null))[_0xde14('0x25')](removeEntity(_0x423adc,null))[_0xde14('0x45')](handleError(_0x423adc,null));}; \ No newline at end of file +var _0xc3b5=['model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','options','count','includeAll','include','rows','catch','show','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Dispositions','then','sendStatus','error','stack','send','index','map','Disposition','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection'];(function(_0x41385d,_0x16e0de){var _0x3a9bda=function(_0x3323e5){while(--_0x3323e5){_0x41385d['push'](_0x41385d['shift']());}};_0x3a9bda(++_0x16e0de);}(_0xc3b5,0x6f));var _0x5c3b=function(_0x27ef71,_0x3440cb){_0x27ef71=_0x27ef71-0x0;var _0x3fb1e0=_0xc3b5[_0x27ef71];return _0x3fb1e0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5c3b('0x0'));var zipdir=require(_0x5c3b('0x1'));var jsonpatch=require(_0x5c3b('0x2'));var rp=require(_0x5c3b('0x3'));var moment=require(_0x5c3b('0x4'));var BPromise=require(_0x5c3b('0x5'));var Mustache=require(_0x5c3b('0x6'));var util=require(_0x5c3b('0x7'));var path=require('path');var sox=require(_0x5c3b('0x8'));var csv=require(_0x5c3b('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5c3b('0xa'));var squel=require(_0x5c3b('0xb'));var crypto=require(_0x5c3b('0xc'));var jsforce=require(_0x5c3b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5c3b('0x9'));var querystring=require(_0x5c3b('0xe'));var Papa=require(_0x5c3b('0xf'));var Redis=require(_0x5c3b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5c3b('0x11'));var as=require(_0x5c3b('0x12'));var hardwareService=require(_0x5c3b('0x13'));var logger=require(_0x5c3b('0x14'))(_0x5c3b('0x15'));var utils=require('../../config/utils');var config=require(_0x5c3b('0x16'));var db=require(_0x5c3b('0x17'))['db'];function respondWithStatusCode(_0x589c36,_0x1b2815){_0x1b2815=_0x1b2815||0xcc;return function(_0x3b953d){if(_0x3b953d){return _0x589c36['sendStatus'](_0x1b2815);}return _0x589c36[_0x5c3b('0x18')](_0x1b2815)[_0x5c3b('0x19')]();};}function respondWithResult(_0x3e24bd,_0x2384b9){_0x2384b9=_0x2384b9||0xc8;return function(_0x315e68){if(_0x315e68){return _0x3e24bd[_0x5c3b('0x18')](_0x2384b9)[_0x5c3b('0x1a')](_0x315e68);}};}function respondWithFilteredResult(_0x4f20eb,_0x2f7ab2){return function(_0x5b55be){if(_0x5b55be){var _0x4cf80d=_0x5b55be['count'],_0x195c1e=_0x2f7ab2[_0x5c3b('0x1b')],_0x945338=_0x2f7ab2[_0x5c3b('0x1b')]+_0x2f7ab2[_0x5c3b('0x1c')],_0x18757e;if(_0x945338>=_0x4cf80d){_0x945338=_0x4cf80d;_0x18757e=0xc8;}else{_0x18757e=0xce;}_0x4f20eb['status'](_0x18757e);return _0x4f20eb[_0x5c3b('0x1d')](_0x5c3b('0x1e'),_0x195c1e+'-'+_0x945338+'/'+_0x4cf80d)['json'](_0x5b55be);}return null;};}function patchUpdates(_0x3973bc){return function(_0x4658ce){try{jsonpatch[_0x5c3b('0x1f')](_0x4658ce,_0x3973bc,!![]);}catch(_0x681ac1){return BPromise[_0x5c3b('0x20')](_0x681ac1);}return _0x4658ce[_0x5c3b('0x21')]();};}function saveUpdates(_0x1915c8,_0x1af39c){return function(_0xc63307){if(_0xc63307){return _0xc63307[_0x5c3b('0x22')](_0x1915c8)['then'](function(_0x555495){return _0x555495;});}return null;};}function removeEntity(_0x319f0c,_0x143022){return function(_0x5942f1){if(_0x5942f1){return _0x5942f1[_0x5c3b('0x23')]()['then'](function(){var _0x832a1c=_0x5942f1[_0x5c3b('0x24')]({'plain':!![]});var _0x2bb9dc=_0x5c3b('0x25');return db['UserProfileResource'][_0x5c3b('0x23')]({'where':{'type':_0x2bb9dc,'resourceId':_0x832a1c['id']}})[_0x5c3b('0x26')](function(){return _0x5942f1;});})['then'](function(){_0x319f0c[_0x5c3b('0x18')](0xcc)[_0x5c3b('0x19')]();});}};}function handleEntityNotFound(_0x3a8141,_0x3c3991){return function(_0x511a1c){if(!_0x511a1c){_0x3a8141[_0x5c3b('0x27')](0x194);}return _0x511a1c;};}function handleError(_0x20469d,_0x2099dc){_0x2099dc=_0x2099dc||0x1f4;return function(_0x28b782){logger[_0x5c3b('0x28')](_0x28b782[_0x5c3b('0x29')]);if(_0x28b782['name']){delete _0x28b782['name'];}_0x20469d['status'](_0x2099dc)[_0x5c3b('0x2a')](_0x28b782);};}exports[_0x5c3b('0x2b')]=function(_0x59b640,_0xd93418){var _0x15044e={},_0x421d96={},_0x2a26df={'count':0x0,'rows':[]};var _0x19a73d=_[_0x5c3b('0x2c')](db[_0x5c3b('0x2d')][_0x5c3b('0x2e')],function(_0x30d701){return{'name':_0x30d701[_0x5c3b('0x2f')],'type':_0x30d701[_0x5c3b('0x30')][_0x5c3b('0x31')]};});_0x421d96['model']=_[_0x5c3b('0x2c')](_0x19a73d,_0x5c3b('0x32'));_0x421d96[_0x5c3b('0x33')]=_[_0x5c3b('0x34')](_0x59b640[_0x5c3b('0x33')]);_0x421d96[_0x5c3b('0x35')]=_[_0x5c3b('0x36')](_0x421d96[_0x5c3b('0x37')],_0x421d96[_0x5c3b('0x33')]);_0x15044e[_0x5c3b('0x38')]=_[_0x5c3b('0x36')](_0x421d96[_0x5c3b('0x37')],qs[_0x5c3b('0x39')](_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x39')]));_0x15044e[_0x5c3b('0x38')]=_0x15044e[_0x5c3b('0x38')]['length']?_0x15044e[_0x5c3b('0x38')]:_0x421d96[_0x5c3b('0x37')];if(!_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x3a')]('nolimit')){_0x15044e[_0x5c3b('0x1c')]=qs[_0x5c3b('0x1c')](_0x59b640['query'][_0x5c3b('0x1c')]);_0x15044e[_0x5c3b('0x1b')]=qs[_0x5c3b('0x1b')](_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x1b')]);}_0x15044e[_0x5c3b('0x3b')]=qs[_0x5c3b('0x3c')](_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x3c')]);_0x15044e['where']=qs[_0x5c3b('0x35')](_[_0x5c3b('0x3d')](_0x59b640['query'],_0x421d96['filters']));if(_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x3e')]){_0x15044e[_0x5c3b('0x3f')]=_[_0x5c3b('0x40')](_0x15044e[_0x5c3b('0x3f')],{'$or':_[_0x5c3b('0x2c')](_0x19a73d,function(_0x10fbd8){if(_0x10fbd8['type']!=='VIRTUAL'){var _0x3a641e={};_0x3a641e[_0x10fbd8[_0x5c3b('0x32')]]={'$like':'%'+_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x3e')]+'%'};return _0x3a641e;}})});}_0x15044e=_['merge']({},_0x15044e,_0x59b640[_0x5c3b('0x41')]);var _0x4b9a81={'where':_0x15044e[_0x5c3b('0x3f')]};return db[_0x5c3b('0x2d')][_0x5c3b('0x42')](_0x4b9a81)[_0x5c3b('0x26')](function(_0x2caa63){_0x2a26df[_0x5c3b('0x42')]=_0x2caa63;if(_0x59b640[_0x5c3b('0x33')][_0x5c3b('0x43')]){_0x15044e[_0x5c3b('0x44')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x15044e);})[_0x5c3b('0x26')](function(_0x34f04b){_0x2a26df[_0x5c3b('0x45')]=_0x34f04b;return _0x2a26df;})[_0x5c3b('0x26')](respondWithFilteredResult(_0xd93418,_0x15044e))[_0x5c3b('0x46')](handleError(_0xd93418,null));};exports[_0x5c3b('0x47')]=function(_0x2cec5d,_0x1d9427){var _0x29ffdc={'raw':!![],'where':{'id':_0x2cec5d[_0x5c3b('0x48')]['id']}},_0x56a53e={};_0x56a53e[_0x5c3b('0x37')]=_[_0x5c3b('0x34')](db['Disposition'][_0x5c3b('0x2e')]);_0x56a53e[_0x5c3b('0x33')]=_[_0x5c3b('0x34')](_0x2cec5d[_0x5c3b('0x33')]);_0x56a53e[_0x5c3b('0x35')]=_[_0x5c3b('0x36')](_0x56a53e[_0x5c3b('0x37')],_0x56a53e[_0x5c3b('0x33')]);_0x29ffdc[_0x5c3b('0x38')]=_[_0x5c3b('0x36')](_0x56a53e[_0x5c3b('0x37')],qs['fields'](_0x2cec5d[_0x5c3b('0x33')]['fields']));_0x29ffdc[_0x5c3b('0x38')]=_0x29ffdc[_0x5c3b('0x38')]['length']?_0x29ffdc[_0x5c3b('0x38')]:_0x56a53e[_0x5c3b('0x37')];if(_0x2cec5d[_0x5c3b('0x33')]['includeAll']){_0x29ffdc[_0x5c3b('0x44')]=[{'all':!![]}];}_0x29ffdc=_['merge']({},_0x29ffdc,_0x2cec5d[_0x5c3b('0x41')]);return db[_0x5c3b('0x2d')][_0x5c3b('0x49')](_0x29ffdc)[_0x5c3b('0x26')](handleEntityNotFound(_0x1d9427,null))[_0x5c3b('0x26')](respondWithResult(_0x1d9427,null))[_0x5c3b('0x46')](handleError(_0x1d9427,null));};exports[_0x5c3b('0x4a')]=function(_0x3d6034,_0x42d34f){return db[_0x5c3b('0x2d')][_0x5c3b('0x4a')](_0x3d6034['body'],{})[_0x5c3b('0x26')](function(_0x5ac2aa){var _0x155b22=_0x3d6034[_0x5c3b('0x4b')][_0x5c3b('0x24')]({'plain':!![]});if(!_0x155b22)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x155b22[_0x5c3b('0x4c')]===_0x5c3b('0x4b')){var _0x5c9e2d=_0x5ac2aa[_0x5c3b('0x24')]({'plain':!![]});var _0x7f0100=_0x5c3b('0x25');return db[_0x5c3b('0x4d')][_0x5c3b('0x49')]({'where':{'name':_0x7f0100,'userProfileId':_0x155b22[_0x5c3b('0x4e')]},'raw':!![]})[_0x5c3b('0x26')](function(_0x21e430){if(_0x21e430&&_0x21e430[_0x5c3b('0x4f')]===0x0){return db[_0x5c3b('0x50')][_0x5c3b('0x4a')]({'name':_0x5c9e2d['name'],'resourceId':_0x5c9e2d['id'],'type':_0x21e430['name'],'sectionId':_0x21e430['id']},{})['then'](function(){return _0x5ac2aa;});}else{return _0x5ac2aa;}})[_0x5c3b('0x46')](function(_0x203ae2){logger['error'](_0x5c3b('0x51'),_0x203ae2);throw _0x203ae2;});}return _0x5ac2aa;})[_0x5c3b('0x26')](respondWithResult(_0x42d34f,0xc9))[_0x5c3b('0x46')](handleError(_0x42d34f,null));};exports[_0x5c3b('0x22')]=function(_0x53c2c2,_0x305b49){if(_0x53c2c2[_0x5c3b('0x52')]['id']){delete _0x53c2c2['body']['id'];}return db[_0x5c3b('0x2d')][_0x5c3b('0x49')]({'where':{'id':_0x53c2c2[_0x5c3b('0x48')]['id']}})[_0x5c3b('0x26')](handleEntityNotFound(_0x305b49,null))[_0x5c3b('0x26')](saveUpdates(_0x53c2c2[_0x5c3b('0x52')],null))[_0x5c3b('0x26')](respondWithResult(_0x305b49,null))[_0x5c3b('0x46')](handleError(_0x305b49,null));};exports[_0x5c3b('0x23')]=function(_0x36c734,_0x381e3c){return db[_0x5c3b('0x2d')][_0x5c3b('0x49')]({'where':{'id':_0x36c734['params']['id']}})['then'](handleEntityNotFound(_0x381e3c,null))[_0x5c3b('0x26')](removeEntity(_0x381e3c,null))[_0x5c3b('0x46')](handleError(_0x381e3c,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 52218b4..d06d3b2 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 _0xe100=['MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId'];(function(_0x42ed70,_0x58b3ef){var _0x514049=function(_0x5c6d67){while(--_0x5c6d67){_0x42ed70['push'](_0x42ed70['shift']());}};_0x514049(++_0x58b3ef);}(_0xe100,0x1bb));var _0x0e10=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe100[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0e10('0x0'));var util=require(_0x0e10('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0e10('0x2'));var BPromise=require(_0x0e10('0x3'));var rp=require(_0x0e10('0x4'));var fs=require('fs');var path=require(_0x0e10('0x5'));var rimraf=require(_0x0e10('0x6'));var config=require('../../config/environment');var attributes=require(_0x0e10('0x7'));module[_0x0e10('0x8')]=function(_0x409a7e,_0x46d1a1){return _0x409a7e[_0x0e10('0x9')](_0x0e10('0xa'),attributes,{'tableName':_0x0e10('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x0e10('0xc'),'fields':[_0x0e10('0xd'),_0x0e10('0xe')]},{'unique':!![],'name':_0x0e10('0xf'),'fields':[_0x0e10('0xd'),_0x0e10('0x10')]},{'unique':!![],'name':'name_mail','fields':[_0x0e10('0xd'),_0x0e10('0x11')]},{'unique':!![],'name':_0x0e10('0x12'),'fields':[_0x0e10('0xd'),'SmsAccountId']},{'unique':!![],'name':_0x0e10('0x13'),'fields':[_0x0e10('0xd'),_0x0e10('0x14')]},{'unique':!![],'name':_0x0e10('0x15'),'fields':[_0x0e10('0xd'),_0x0e10('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xddf1=['api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger'];(function(_0x3e0c47,_0x448eaa){var _0x142825=function(_0x583ddd){while(--_0x583ddd){_0x3e0c47['push'](_0x3e0c47['shift']());}};_0x142825(++_0x448eaa);}(_0xddf1,0x1b2));var _0x1ddf=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xddf1[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0x1ddf('0x0'));var util=require(_0x1ddf('0x1'));var logger=require(_0x1ddf('0x2'))(_0x1ddf('0x3'));var moment=require(_0x1ddf('0x4'));var BPromise=require(_0x1ddf('0x5'));var rp=require(_0x1ddf('0x6'));var fs=require('fs');var path=require(_0x1ddf('0x7'));var rimraf=require('rimraf');var config=require(_0x1ddf('0x8'));var attributes=require(_0x1ddf('0x9'));module[_0x1ddf('0xa')]=function(_0x155b24,_0x1d8b11){return _0x155b24['define']('Disposition',attributes,{'tableName':_0x1ddf('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x1ddf('0xc'),'fields':[_0x1ddf('0xd'),_0x1ddf('0xe')]},{'unique':!![],'name':'name_chat','fields':[_0x1ddf('0xd'),_0x1ddf('0xf')]},{'unique':!![],'name':_0x1ddf('0x10'),'fields':[_0x1ddf('0xd'),_0x1ddf('0x11')]},{'unique':!![],'name':_0x1ddf('0x12'),'fields':['name',_0x1ddf('0x13')]},{'unique':!![],'name':_0x1ddf('0x14'),'fields':[_0x1ddf('0xd'),'FaxAccountId']},{'unique':!![],'name':_0x1ddf('0x15'),'fields':[_0x1ddf('0xd'),_0x1ddf('0x16')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index f6ababc..138f1a6 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 _0x5934=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3a5595,_0x267381){var _0x3cac19=function(_0x50953f){while(--_0x50953f){_0x3a5595['push'](_0x3a5595['shift']());}};_0x3cac19(++_0x267381);}(_0x5934,0x177));var _0x4593=function(_0x52f400,_0x4db153){_0x52f400=_0x52f400-0x0;var _0x44ad48=_0x5934[_0x52f400];return _0x44ad48;};'use strict';var _=require(_0x4593('0x0'));var util=require(_0x4593('0x1'));var moment=require('moment');var BPromise=require(_0x4593('0x2'));var rs=require(_0x4593('0x3'));var fs=require('fs');var Redis=require(_0x4593('0x4'));var db=require(_0x4593('0x5'))['db'];var utils=require(_0x4593('0x6'));var logger=require('../../config/logger')(_0x4593('0x7'));var config=require('../../config/environment');var jayson=require(_0x4593('0x8'));var client=jayson[_0x4593('0x9')][_0x4593('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x53d200,_0x5828d7,_0x9e06b1){return new BPromise(function(_0x4431cc,_0x4173df){return client['request'](_0x53d200,_0x9e06b1)[_0x4593('0xb')](function(_0x3b92ac){logger[_0x4593('0xc')](_0x4593('0xd'),_0x5828d7,_0x4593('0xe'));logger[_0x4593('0xf')](_0x4593('0x10'),_0x5828d7,_0x4593('0xe'),JSON[_0x4593('0x11')](_0x3b92ac));if(_0x3b92ac[_0x4593('0x12')]){if(_0x3b92ac['error'][_0x4593('0x13')]===0x1f4){logger[_0x4593('0x12')](_0x4593('0xd'),_0x5828d7,_0x3b92ac['error'][_0x4593('0x14')]);return _0x4173df(_0x3b92ac[_0x4593('0x12')][_0x4593('0x14')]);}logger[_0x4593('0x12')](_0x4593('0xd'),_0x5828d7,_0x3b92ac['error']['message']);return _0x4431cc(_0x3b92ac[_0x4593('0x12')][_0x4593('0x14')]);}else{logger[_0x4593('0xc')](_0x4593('0xd'),_0x5828d7,_0x4593('0xe'));_0x4431cc(_0x3b92ac['result'][_0x4593('0x14')]);}})[_0x4593('0x15')](function(_0x5240d0){logger[_0x4593('0x12')](_0x4593('0xd'),_0x5828d7,_0x5240d0);_0x4173df(_0x5240d0);});});} \ No newline at end of file +var _0xf099=['moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','Disposition,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util'];(function(_0x1fe29a,_0x553b9a){var _0xb94d8f=function(_0x373141){while(--_0x373141){_0x1fe29a['push'](_0x1fe29a['shift']());}};_0xb94d8f(++_0x553b9a);}(_0xf099,0x163));var _0x9f09=function(_0x54fbff,_0x53470e){_0x54fbff=_0x54fbff-0x0;var _0x5cf619=_0xf099[_0x54fbff];return _0x5cf619;};'use strict';var _=require(_0x9f09('0x0'));var util=require(_0x9f09('0x1'));var moment=require(_0x9f09('0x2'));var BPromise=require(_0x9f09('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f09('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9f09('0x5'))(_0x9f09('0x6'));var config=require(_0x9f09('0x7'));var jayson=require(_0x9f09('0x8'));var client=jayson[_0x9f09('0x9')][_0x9f09('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b1879,_0x19f961,_0x17a47a){return new BPromise(function(_0x5485b0,_0x4485c0){return client[_0x9f09('0xb')](_0x4b1879,_0x17a47a)[_0x9f09('0xc')](function(_0x160b10){logger[_0x9f09('0xd')](_0x9f09('0xe'),_0x19f961,_0x9f09('0xf'));logger['debug'](_0x9f09('0x10'),_0x19f961,_0x9f09('0xf'),JSON['stringify'](_0x160b10));if(_0x160b10[_0x9f09('0x11')]){if(_0x160b10[_0x9f09('0x11')]['code']===0x1f4){logger[_0x9f09('0x11')](_0x9f09('0xe'),_0x19f961,_0x160b10['error'][_0x9f09('0x12')]);return _0x4485c0(_0x160b10['error'][_0x9f09('0x12')]);}logger['error'](_0x9f09('0xe'),_0x19f961,_0x160b10[_0x9f09('0x11')]['message']);return _0x5485b0(_0x160b10[_0x9f09('0x11')][_0x9f09('0x12')]);}else{logger['info'](_0x9f09('0xe'),_0x19f961,_0x9f09('0xf'));_0x5485b0(_0x160b10[_0x9f09('0x13')][_0x9f09('0x12')]);}})[_0x9f09('0x14')](function(_0x16110a){logger['error'](_0x9f09('0xe'),_0x19f961,_0x16110a);_0x4485c0(_0x16110a);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 507f268..cde0a43 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 _0x8579=['Router','../../components/auth/service','isAuthenticated','index','get','/:id','show','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x4a2da2,_0x1c4e33){var _0x31960c=function(_0x5914b4){while(--_0x5914b4){_0x4a2da2['push'](_0x4a2da2['shift']());}};_0x31960c(++_0x1c4e33);}(_0x8579,0x16c));var _0x9857=function(_0x4f0b69,_0x11b0ca){_0x4f0b69=_0x4f0b69-0x0;var _0x1eccbc=_0x8579[_0x4f0b69];return _0x1eccbc;};'use strict';var multer=require(_0x9857('0x0'));var util=require(_0x9857('0x1'));var path=require('path');var timeout=require(_0x9857('0x2'));var express=require(_0x9857('0x3'));var router=express[_0x9857('0x4')]();var auth=require(_0x9857('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./disposition.controller');router['get']('/',auth[_0x9857('0x6')](),controller[_0x9857('0x7')]);router[_0x9857('0x8')](_0x9857('0x9'),auth[_0x9857('0x6')](),controller[_0x9857('0xa')]);router['post']('/',auth[_0x9857('0x6')](),controller[_0x9857('0xb')]);router[_0x9857('0xc')](_0x9857('0x9'),auth[_0x9857('0x6')](),controller[_0x9857('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9857('0xe')]);module[_0x9857('0xf')]=router; \ No newline at end of file +var _0xad07=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','/:id','create','update'];(function(_0x35c72c,_0x38dfe3){var _0x36fb68=function(_0x47af30){while(--_0x47af30){_0x35c72c['push'](_0x35c72c['shift']());}};_0x36fb68(++_0x38dfe3);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7ad0('0x0'));var util=require(_0x7ad0('0x1'));var path=require('path');var timeout=require(_0x7ad0('0x2'));var express=require(_0x7ad0('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7ad0('0x4'));var config=require(_0x7ad0('0x5'));var controller=require(_0x7ad0('0x6'));router['get']('/',auth[_0x7ad0('0x7')](),controller['index']);router['get'](_0x7ad0('0x8'),auth[_0x7ad0('0x7')](),controller['show']);router['post']('/',auth[_0x7ad0('0x7')](),controller[_0x7ad0('0x9')]);router['put'](_0x7ad0('0x8'),auth[_0x7ad0('0x7')](),controller[_0x7ad0('0xa')]);router[_0x7ad0('0xb')]('/:id',auth[_0x7ad0('0x7')](),controller[_0x7ad0('0xc')]);module[_0x7ad0('0xd')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 4f3c526..545c3f8 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 _0xeb28=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','ENUM','yes','xCALLY\x20Motion\x20Fax','STRING','localstationid','2400','4800','7200','9600','12000','14400','SIP','IAX','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'];(function(_0x51e7f8,_0x1b4d4c){var _0x1b19cf=function(_0x3af857){while(--_0x3af857){_0x51e7f8['push'](_0x51e7f8['shift']());}};_0x1b19cf(++_0x1b4d4c);}(_0xeb28,0x10b));var _0x8eb2=function(_0x4e7bae,_0x587907){_0x4e7bae=_0x4e7bae-0x0;var _0x1891aa=_0xeb28[_0x4e7bae];return _0x1891aa;};'use strict';var Sequelize=require(_0x8eb2('0x0'));module[_0x8eb2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x8eb2('0x2')](_0x8eb2('0x3'),'no'),'defaultValue':_0x8eb2('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x8eb2('0x4')},'localstationid':{'type':Sequelize[_0x8eb2('0x5')],'unique':_0x8eb2('0x6')},'minrate':{'type':Sequelize[_0x8eb2('0x2')](_0x8eb2('0x7'),_0x8eb2('0x8'),_0x8eb2('0x9'),_0x8eb2('0xa'),_0x8eb2('0xb'),_0x8eb2('0xc')),'defaultValue':'4800'},'maxrate':{'type':Sequelize['ENUM'](_0x8eb2('0x7'),'4800',_0x8eb2('0x9'),_0x8eb2('0xa'),'12000',_0x8eb2('0xc')),'defaultValue':_0x8eb2('0xc')},'modem':{'type':Sequelize[_0x8eb2('0x5')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x8eb2('0x5')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x8eb2('0x5')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x8eb2('0x2')](_0x8eb2('0xd'),_0x8eb2('0xe'),'DADHI','KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x8eb2('0x5')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x8eb2('0xf')],'defaultValue':function(){return _0x8eb2('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8eb2('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8eb2('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8eb2('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8eb2('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8eb2('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8eb2('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8eb2('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0x8eb2('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x8eb2('0x11')],'defaultValue':![],'comment':_0x8eb2('0x14'),'set':function(_0x4d4512){if(!_0x4d4512)this[_0x8eb2('0x15')](_0x8eb2('0x16'),null);this[_0x8eb2('0x15')](_0x8eb2('0x17'),_0x4d4512);}}}; \ No newline at end of file +var _0x0142=['mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x360e08,_0x4042d7){var _0x3b20ca=function(_0x27ec9b){while(--_0x27ec9b){_0x360e08['push'](_0x360e08['shift']());}};_0x3b20ca(++_0x4042d7);}(_0x0142,0xff));var _0x2014=function(_0x472ded,_0x7b9b67){_0x472ded=_0x472ded-0x0;var _0x4cdf81=_0x0142[_0x472ded];return _0x4cdf81;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2014('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2014('0x0')]},'ecm':{'type':Sequelize[_0x2014('0x1')](_0x2014('0x2'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x2014('0x0')],'defaultValue':_0x2014('0x3')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x2014('0x4')},'minrate':{'type':Sequelize['ENUM'](_0x2014('0x5'),_0x2014('0x6'),_0x2014('0x7'),_0x2014('0x8'),_0x2014('0x9'),'14400'),'defaultValue':_0x2014('0x6')},'maxrate':{'type':Sequelize[_0x2014('0x1')](_0x2014('0x5'),'4800',_0x2014('0x7'),_0x2014('0x8'),_0x2014('0x9'),_0x2014('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x2014('0x0')],'defaultValue':_0x2014('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x2014('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x2014('0x1')](_0x2014('0xc'),_0x2014('0xd'),_0x2014('0xe'),'KHOMP'),'defaultValue':_0x2014('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2014('0xf')],'defaultValue':function(){return _0x2014('0x10');}},'notificationSound':{'type':Sequelize[_0x2014('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2014('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2014('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2014('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2014('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2014('0x13'),'set':function(_0xd0daa9){if(!_0xd0daa9)this[_0x2014('0x14')](_0x2014('0x15'),null);this[_0x2014('0x14')](_0x2014('0x16'),_0xd0daa9);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 5d4bfa6..c30d429 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 _0x99b3=['DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','ContactId','Messages','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','isArray','userFaxAccount:remove','emit','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','./faxAccount.socket','jayson/promise','client','test','Sequelize','ValidationError','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','keys','includeAll','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','localstationid','faxdetect','headerinfo','maxrate','minrate','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','sequelize','VoiceExtension','updateAccountApplications','tech','key','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','Contacts'];(function(_0x32be36,_0x54005f){var _0x3b92fb=function(_0x3f8a17){while(--_0x3f8a17){_0x32be36['push'](_0x32be36['shift']());}};_0x3b92fb(++_0x54005f);}(_0x99b3,0xe6));var _0x399b=function(_0x326e7f,_0xe8da32){_0x326e7f=_0x326e7f-0x0;var _0x5b11fe=_0x99b3[_0x326e7f];return _0x5b11fe;};'use strict';var pdf=require(_0x399b('0x0'));var emlformat=require(_0x399b('0x1'));var rimraf=require(_0x399b('0x2'));var zipdir=require(_0x399b('0x3'));var jsonpatch=require(_0x399b('0x4'));var rp=require(_0x399b('0x5'));var moment=require('moment');var BPromise=require(_0x399b('0x6'));var Mustache=require(_0x399b('0x7'));var util=require(_0x399b('0x8'));var path=require(_0x399b('0x9'));var sox=require(_0x399b('0xa'));var csv=require('to-csv');var ejs=require(_0x399b('0xb'));var fs=require('fs');var _=require(_0x399b('0xc'));var squel=require(_0x399b('0xd'));var crypto=require(_0x399b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x399b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x399b('0x10'));var Papa=require(_0x399b('0x11'));var Redis=require(_0x399b('0x12'));var authService=require(_0x399b('0x13'));var qs=require(_0x399b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x399b('0x15'));var logger=require('../../config/logger')(_0x399b('0x16'));var utils=require(_0x399b('0x17'));var config=require(_0x399b('0x18'));var db=require('../../mysqldb')['db'];config[_0x399b('0x19')]=_[_0x399b('0x1a')](config[_0x399b('0x19')],{'host':_0x399b('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x399b('0x19')]));require(_0x399b('0x1c'))['register'](socket);var jayson=require(_0x399b('0x1d'));var client=jayson[_0x399b('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x399b('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x112f12,_0x140b33,_0x3a33a2){if(_0x3a33a2){var _0x8befb4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x8befb4[_0x399b('0x1f')](_0x140b33)){return _0x112f12;}else{throw new db[(_0x399b('0x20'))][(_0x399b('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 _0x112f12;}}function respondWithRpcPromise(_0x317033,_0x95f986,_0x3969e5,_0x128171){return new BPromise(function(_0x463081,_0x5c2c27){var _0xde7dd5=_0x128171||client;return _0xde7dd5[_0x399b('0x22')](_0x317033,_0x3969e5)[_0x399b('0x23')](function(_0x2b632b){logger['info']('FaxAccount,\x20%s,\x20%s',_0x95f986,_0x399b('0x24'));logger[_0x399b('0x25')](_0x399b('0x26'),_0x95f986,_0x399b('0x24'),JSON['stringify'](_0x2b632b));if(_0x2b632b[_0x399b('0x27')]){if(_0x2b632b[_0x399b('0x27')][_0x399b('0x28')]===0x1f4){logger[_0x399b('0x27')](_0x399b('0x29'),_0x95f986,_0x2b632b['error']['message']);return _0x5c2c27(_0x2b632b[_0x399b('0x27')][_0x399b('0x2a')]);}logger['error'](_0x399b('0x29'),_0x95f986,_0x2b632b[_0x399b('0x27')]['message']);return _0x463081(_0x2b632b[_0x399b('0x27')]['message']);}else{logger[_0x399b('0x2b')](_0x399b('0x29'),_0x95f986,_0x399b('0x24'));_0x463081(_0x2b632b[_0x399b('0x2c')][_0x399b('0x2a')]);}})[_0x399b('0x2d')](function(_0xf0f8a){logger[_0x399b('0x27')](_0x399b('0x29'),_0x95f986,_0xf0f8a);_0x5c2c27(_0xf0f8a);});});}function respondWithStatusCode(_0x5363ed,_0x3fdd61){_0x3fdd61=_0x3fdd61||0xcc;return function(_0x28d537){if(_0x28d537){return _0x5363ed[_0x399b('0x2e')](_0x3fdd61);}return _0x5363ed[_0x399b('0x2f')](_0x3fdd61)[_0x399b('0x30')]();};}function respondWithResult(_0x3f8b58,_0x50f9c4){_0x50f9c4=_0x50f9c4||0xc8;return function(_0x2f4d83){if(_0x2f4d83){return _0x3f8b58[_0x399b('0x2f')](_0x50f9c4)['json'](_0x2f4d83);}};}function respondWithFilteredResult(_0x193996,_0xb019a){return function(_0x415ea4){if(_0x415ea4){var _0x520f79=_0x415ea4[_0x399b('0x31')],_0x3b3bb8=_0xb019a[_0x399b('0x32')],_0x1ad802=_0xb019a[_0x399b('0x32')]+_0xb019a[_0x399b('0x33')],_0x457fdd;if(_0x1ad802>=_0x520f79){_0x1ad802=_0x520f79;_0x457fdd=0xc8;}else{_0x457fdd=0xce;}_0x193996['status'](_0x457fdd);return _0x193996['set'](_0x399b('0x34'),_0x3b3bb8+'-'+_0x1ad802+'/'+_0x520f79)[_0x399b('0x35')](_0x415ea4);}return null;};}function patchUpdates(_0x33e4b8){return function(_0x393547){try{jsonpatch['apply'](_0x393547,_0x33e4b8,!![]);}catch(_0x3b117a){return BPromise['reject'](_0x3b117a);}return _0x393547['save']();};}function saveUpdates(_0x4db924,_0x324ff3){return function(_0x77f302){if(_0x77f302){return _0x77f302[_0x399b('0x36')](_0x4db924)[_0x399b('0x23')](function(_0x837763){return _0x837763;});}return null;};}function removeEntity(_0x476f55,_0x28ae3b){return function(_0x59016d){if(_0x59016d){return _0x59016d[_0x399b('0x37')]()[_0x399b('0x23')](function(){var _0x24415b=_0x59016d[_0x399b('0x38')]({'plain':!![]});var _0x35ece3=_0x399b('0x39');return db[_0x399b('0x3a')][_0x399b('0x37')]({'where':{'type':_0x35ece3,'resourceId':_0x24415b['id']}})[_0x399b('0x23')](function(){return _0x59016d;});})[_0x399b('0x23')](function(){_0x476f55[_0x399b('0x2f')](0xcc)[_0x399b('0x30')]();});}};}function handleEntityNotFound(_0x306bc9,_0x2f7e0b){return function(_0x29dd78){if(!_0x29dd78){_0x306bc9[_0x399b('0x2e')](0x194);}return _0x29dd78;};}function handleError(_0x27f5ca,_0x204503){_0x204503=_0x204503||0x1f4;return function(_0x547169){logger['error'](_0x547169[_0x399b('0x3b')]);if(_0x547169['name']){delete _0x547169[_0x399b('0x3c')];}_0x27f5ca[_0x399b('0x2f')](_0x204503)[_0x399b('0x3d')](_0x547169);};}exports[_0x399b('0x3e')]=function(_0x5aeeba,_0x16099d){var _0x5db840={'include':[{'model':db[_0x399b('0x3f')],'as':_0x399b('0x40')}]},_0x418fe5={},_0x4186cd={'count':0x0,'rows':[]};var _0x174e9c=_[_0x399b('0x41')](db[_0x399b('0x42')][_0x399b('0x43')],function(_0x5df6fc){return{'name':_0x5df6fc[_0x399b('0x44')],'type':_0x5df6fc[_0x399b('0x45')]['key']};});_0x418fe5[_0x399b('0x46')]=_['map'](_0x174e9c,_0x399b('0x3c'));_0x418fe5[_0x399b('0x47')]=_['keys'](_0x5aeeba[_0x399b('0x47')]);_0x418fe5[_0x399b('0x48')]=_[_0x399b('0x49')](_0x418fe5['model'],_0x418fe5[_0x399b('0x47')]);_0x5db840[_0x399b('0x4a')]=_[_0x399b('0x49')](_0x418fe5[_0x399b('0x46')],qs[_0x399b('0x4b')](_0x5aeeba[_0x399b('0x47')]['fields']));_0x5db840['attributes']=_0x5db840[_0x399b('0x4a')][_0x399b('0x4c')]?_0x5db840[_0x399b('0x4a')]:_0x418fe5[_0x399b('0x46')];if(!_0x5aeeba['query'][_0x399b('0x4d')](_0x399b('0x4e'))){_0x5db840['limit']=qs[_0x399b('0x33')](_0x5aeeba[_0x399b('0x47')][_0x399b('0x33')]);_0x5db840[_0x399b('0x32')]=qs['offset'](_0x5aeeba[_0x399b('0x47')][_0x399b('0x32')]);}_0x5db840[_0x399b('0x4f')]=qs[_0x399b('0x50')](_0x5aeeba[_0x399b('0x47')][_0x399b('0x50')]);_0x5db840[_0x399b('0x51')]=qs['filters'](_[_0x399b('0x52')](_0x5aeeba[_0x399b('0x47')],_0x418fe5[_0x399b('0x48')]));if(_0x5aeeba['query'][_0x399b('0x53')]){_0x5db840[_0x399b('0x51')]=_[_0x399b('0x54')](_0x5db840['where'],{'$or':_[_0x399b('0x41')](_0x174e9c,function(_0x26ca3b){if(_0x26ca3b[_0x399b('0x45')]!==_0x399b('0x55')){var _0x5c3ccd={};_0x5c3ccd[_0x26ca3b[_0x399b('0x3c')]]={'$like':'%'+_0x5aeeba[_0x399b('0x47')][_0x399b('0x53')]+'%'};return _0x5c3ccd;}})});}_0x5db840=_['merge']({},_0x5db840,_0x5aeeba[_0x399b('0x56')]);var _0x139f95={'where':_0x5db840[_0x399b('0x51')]};return db[_0x399b('0x42')]['count'](_0x139f95)[_0x399b('0x23')](function(_0x255e92){_0x4186cd[_0x399b('0x31')]=_0x255e92;if(_0x5aeeba[_0x399b('0x47')]['includeAll']){_0x5db840[_0x399b('0x57')]=[{'all':!![]}];}return db[_0x399b('0x42')][_0x399b('0x58')](_0x5db840);})[_0x399b('0x23')](function(_0x418a6d){_0x4186cd[_0x399b('0x59')]=_0x418a6d;return _0x4186cd;})[_0x399b('0x23')](respondWithFilteredResult(_0x16099d,_0x5db840))[_0x399b('0x2d')](handleError(_0x16099d,null));};exports['show']=function(_0x3fd91e,_0xe5d75f){var _0x265db9={'raw':![],'where':{'id':_0x3fd91e[_0x399b('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x399b('0x40')}]},_0x3893a4={};_0x3893a4[_0x399b('0x46')]=_[_0x399b('0x5b')](db[_0x399b('0x42')][_0x399b('0x43')]);_0x3893a4[_0x399b('0x47')]=_[_0x399b('0x5b')](_0x3fd91e[_0x399b('0x47')]);_0x3893a4['filters']=_[_0x399b('0x49')](_0x3893a4[_0x399b('0x46')],_0x3893a4[_0x399b('0x47')]);_0x265db9['attributes']=_[_0x399b('0x49')](_0x3893a4[_0x399b('0x46')],qs[_0x399b('0x4b')](_0x3fd91e['query'][_0x399b('0x4b')]));_0x265db9[_0x399b('0x4a')]=_0x265db9[_0x399b('0x4a')][_0x399b('0x4c')]?_0x265db9['attributes']:_0x3893a4['model'];if(_0x3fd91e[_0x399b('0x47')][_0x399b('0x5c')]){_0x265db9[_0x399b('0x57')]=[{'all':!![]}];}_0x265db9=_['merge']({},_0x265db9,_0x3fd91e['options']);return db['FaxAccount'][_0x399b('0x5d')](_0x265db9)[_0x399b('0x23')](handleEntityNotFound(_0xe5d75f,null))[_0x399b('0x23')](respondWithResult(_0xe5d75f,null))[_0x399b('0x2d')](handleError(_0xe5d75f,null));};exports['create']=function(_0x44fdf8,_0x3bb256){return db[_0x399b('0x42')][_0x399b('0x5e')](_0x44fdf8[_0x399b('0x5f')],{})['then'](function(_0x781ade){var _0x4e8720=_0x44fdf8[_0x399b('0x60')][_0x399b('0x38')]({'plain':!![]});if(!_0x4e8720)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e8720[_0x399b('0x61')]===_0x399b('0x60')){var _0x33b156=_0x781ade[_0x399b('0x38')]({'plain':!![]});var _0x1d5307=_0x399b('0x39');return db[_0x399b('0x62')][_0x399b('0x5d')]({'where':{'name':_0x1d5307,'userProfileId':_0x4e8720[_0x399b('0x63')]},'raw':!![]})['then'](function(_0x2d8f82){if(_0x2d8f82&&_0x2d8f82[_0x399b('0x64')]===0x0){return db[_0x399b('0x3a')][_0x399b('0x5e')]({'name':_0x33b156[_0x399b('0x3c')],'resourceId':_0x33b156['id'],'type':_0x2d8f82[_0x399b('0x3c')],'sectionId':_0x2d8f82['id']},{})[_0x399b('0x23')](function(){return _0x781ade;});}else{return _0x781ade;}})[_0x399b('0x2d')](function(_0x5c8b23){logger['error'](_0x399b('0x65'),_0x5c8b23);throw _0x5c8b23;});}return _0x781ade;})[_0x399b('0x23')](respondWithResult(_0x3bb256,0xc9))['catch'](handleError(_0x3bb256,null));};exports[_0x399b('0x36')]=function(_0x79b688,_0x1788cc){if(_0x79b688[_0x399b('0x5f')]['id']){delete _0x79b688['body']['id'];}return db['FaxAccount'][_0x399b('0x5d')]({'where':{'id':_0x79b688[_0x399b('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x399b('0x23')](handleEntityNotFound(_0x1788cc,null))[_0x399b('0x23')](saveUpdates(_0x79b688[_0x399b('0x5f')],null))[_0x399b('0x23')](respondWithResult(_0x1788cc,null))[_0x399b('0x2d')](handleError(_0x1788cc,null));};exports[_0x399b('0x37')]=function(_0x5674eb,_0x3bd3d5){return db[_0x399b('0x42')][_0x399b('0x5d')]({'where':{'id':_0x5674eb[_0x399b('0x5a')]['id']}})[_0x399b('0x23')](handleEntityNotFound(_0x3bd3d5,null))[_0x399b('0x23')](removeEntity(_0x3bd3d5,null))[_0x399b('0x2d')](handleError(_0x3bd3d5,null));};exports[_0x399b('0x66')]=function(_0x5d5bc0,_0x45272a){return db['FaxAccount'][_0x399b('0x66')]()[_0x399b('0x23')](respondWithResult(_0x45272a,null))[_0x399b('0x2d')](handleError(_0x45272a,null));};exports[_0x399b('0x67')]=function(_0xf131c6,_0x6dd243,_0x1f8b05){if(_0xf131c6[_0x399b('0x5f')]['id']){delete _0xf131c6[_0x399b('0x5f')]['id'];}return db[_0x399b('0x42')][_0x399b('0x5d')]({'where':{'id':_0xf131c6[_0x399b('0x5a')]['id']}})[_0x399b('0x23')](handleEntityNotFound(_0x6dd243,null))[_0x399b('0x23')](function(_0x56fe58){if(_0x56fe58){_0xf131c6['body']['FaxAccountId']=_0x56fe58['id'];return db[_0x399b('0x68')][_0x399b('0x5e')](_0xf131c6['body']);}})[_0x399b('0x23')](respondWithResult(_0x6dd243,null))[_0x399b('0x2d')](handleError(_0x6dd243,null));};exports[_0x399b('0x69')]=function(_0xcd80a8,_0x4293dd,_0x20256c){var _0x258070={'raw':![],'where':{}};var _0x1c7431={};var _0x13aad3={'count':0x0,'rows':[]};return db['FaxAccount'][_0x399b('0x6a')]({'where':{'id':_0xcd80a8['params']['id']}})[_0x399b('0x23')](handleEntityNotFound(_0x4293dd,null))[_0x399b('0x23')](function(_0x280cec){if(_0x280cec){_0x1c7431['model']=_[_0x399b('0x5b')](db['Disposition'][_0x399b('0x43')]);_0x1c7431['query']=_[_0x399b('0x5b')](_0xcd80a8['query']);_0x1c7431['filters']=_['intersection'](_0x1c7431[_0x399b('0x46')],_0x1c7431[_0x399b('0x47')]);_0x258070[_0x399b('0x4a')]=_[_0x399b('0x49')](_0x1c7431[_0x399b('0x46')],qs[_0x399b('0x4b')](_0xcd80a8['query']['fields']));_0x258070[_0x399b('0x4a')]=_0x258070['attributes'][_0x399b('0x4c')]?_0x258070[_0x399b('0x4a')]:_0x1c7431['model'];if(!_0xcd80a8[_0x399b('0x47')][_0x399b('0x4d')]('nolimit')){_0x258070[_0x399b('0x33')]=qs[_0x399b('0x33')](_0xcd80a8[_0x399b('0x47')][_0x399b('0x33')]);_0x258070['offset']=qs[_0x399b('0x32')](_0xcd80a8[_0x399b('0x47')][_0x399b('0x32')]);}_0x258070['order']=qs[_0x399b('0x50')](_0xcd80a8[_0x399b('0x47')]['sort']);_0x258070[_0x399b('0x51')]=qs[_0x399b('0x48')](_[_0x399b('0x52')](_0xcd80a8['query'],_0x1c7431[_0x399b('0x48')]));_0x258070[_0x399b('0x51')][_0x399b('0x6b')]=_0x280cec['id'];if(_0xcd80a8['query']['filter']){_0x258070[_0x399b('0x51')]=_[_0x399b('0x54')](_0x258070[_0x399b('0x51')],{'$or':_[_0x399b('0x41')](_0x258070[_0x399b('0x4a')],function(_0x25c86b){var _0x13e913={};_0x13e913[_0x25c86b]={'$like':'%'+_0xcd80a8['query'][_0x399b('0x53')]+'%'};return _0x13e913;})});}_0x258070=_['merge']({},_0x258070,_0xcd80a8[_0x399b('0x56')]);return db[_0x399b('0x68')]['count']({'where':_0x258070[_0x399b('0x51')]})['then'](function(_0x4727f2){_0x13aad3[_0x399b('0x31')]=_0x4727f2;if(_0xcd80a8['query'][_0x399b('0x5c')]){_0x258070[_0x399b('0x57')]=[{'all':!![]}];}return db[_0x399b('0x68')]['findAll'](_0x258070);})[_0x399b('0x23')](function(_0x29de01){_0x13aad3['rows']=_0x29de01;return _0x13aad3;});}})[_0x399b('0x23')](respondWithFilteredResult(_0x4293dd,_0x258070))[_0x399b('0x2d')](handleError(_0x4293dd,null));};exports[_0x399b('0x6c')]=function(_0x3031df,_0x4dd2bc,_0x3a34cb){return db[_0x399b('0x42')][_0x399b('0x5d')]({'where':{'id':_0x3031df[_0x399b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4dd2bc,null))['then'](function(_0x44cccb){if(_0x44cccb){return _0x44cccb[_0x399b('0x6c')](_0x3031df[_0x399b('0x47')][_0x399b('0x6d')]);}})[_0x399b('0x23')](respondWithStatusCode(_0x4dd2bc,null))[_0x399b('0x2d')](handleError(_0x4dd2bc,null));};exports[_0x399b('0x6e')]=function(_0x22a9db,_0x3f17e8,_0x2e6a3f){if(_0x22a9db[_0x399b('0x5f')]['id']){delete _0x22a9db[_0x399b('0x5f')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x22a9db[_0x399b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3f17e8,null))['then'](function(_0x382c53){if(_0x382c53){_0x22a9db['body'][_0x399b('0x6b')]=_0x382c53['id'];return db[_0x399b('0x6f')][_0x399b('0x5e')](_0x22a9db[_0x399b('0x5f')]);}})[_0x399b('0x23')](respondWithResult(_0x3f17e8,null))['catch'](handleError(_0x3f17e8,null));};exports[_0x399b('0x70')]=function(_0x443e90,_0x5186e4,_0x4f8f06){var _0x2b0ba5={'raw':![],'where':{}};var _0x5f348a={};var _0x534b0b={'count':0x0,'rows':[]};return db[_0x399b('0x42')][_0x399b('0x6a')]({'where':{'id':_0x443e90['params']['id']}})[_0x399b('0x23')](handleEntityNotFound(_0x5186e4,null))[_0x399b('0x23')](function(_0x17d1b8){if(_0x17d1b8){_0x5f348a['model']=_[_0x399b('0x5b')](db['CannedAnswer'][_0x399b('0x43')]);_0x5f348a[_0x399b('0x47')]=_[_0x399b('0x5b')](_0x443e90[_0x399b('0x47')]);_0x5f348a[_0x399b('0x48')]=_[_0x399b('0x49')](_0x5f348a[_0x399b('0x46')],_0x5f348a[_0x399b('0x47')]);_0x2b0ba5['attributes']=_[_0x399b('0x49')](_0x5f348a[_0x399b('0x46')],qs[_0x399b('0x4b')](_0x443e90[_0x399b('0x47')][_0x399b('0x4b')]));_0x2b0ba5[_0x399b('0x4a')]=_0x2b0ba5[_0x399b('0x4a')]['length']?_0x2b0ba5[_0x399b('0x4a')]:_0x5f348a[_0x399b('0x46')];if(!_0x443e90[_0x399b('0x47')][_0x399b('0x4d')]('nolimit')){_0x2b0ba5[_0x399b('0x33')]=qs['limit'](_0x443e90[_0x399b('0x47')][_0x399b('0x33')]);_0x2b0ba5[_0x399b('0x32')]=qs['offset'](_0x443e90['query']['offset']);}_0x2b0ba5[_0x399b('0x4f')]=qs[_0x399b('0x50')](_0x443e90['query'][_0x399b('0x50')]);_0x2b0ba5[_0x399b('0x51')]=qs[_0x399b('0x48')](_[_0x399b('0x52')](_0x443e90[_0x399b('0x47')],_0x5f348a['filters']));_0x2b0ba5[_0x399b('0x51')]['FaxAccountId']=_0x17d1b8['id'];if(_0x443e90[_0x399b('0x47')][_0x399b('0x53')]){_0x2b0ba5['where']=_['merge'](_0x2b0ba5[_0x399b('0x51')],{'$or':_['map'](_0x2b0ba5['attributes'],function(_0x229095){var _0x151995={};_0x151995[_0x229095]={'$like':'%'+_0x443e90[_0x399b('0x47')][_0x399b('0x53')]+'%'};return _0x151995;})});}_0x2b0ba5=_[_0x399b('0x54')]({},_0x2b0ba5,_0x443e90[_0x399b('0x56')]);return db['CannedAnswer'][_0x399b('0x31')]({'where':_0x2b0ba5[_0x399b('0x51')]})[_0x399b('0x23')](function(_0x48e73a){_0x534b0b['count']=_0x48e73a;if(_0x443e90[_0x399b('0x47')]['includeAll']){_0x2b0ba5[_0x399b('0x57')]=[{'all':!![]}];}return db[_0x399b('0x6f')][_0x399b('0x58')](_0x2b0ba5);})['then'](function(_0x1184b8){_0x534b0b[_0x399b('0x59')]=_0x1184b8;return _0x534b0b;});}})[_0x399b('0x23')](respondWithFilteredResult(_0x5186e4,_0x2b0ba5))[_0x399b('0x2d')](handleError(_0x5186e4,null));};exports[_0x399b('0x71')]=function(_0x5974c9,_0x4b2d63,_0x2a9c96){return db[_0x399b('0x42')]['find']({'where':{'id':_0x5974c9[_0x399b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4b2d63,null))[_0x399b('0x23')](function(_0x59b809){if(_0x59b809){return _0x59b809[_0x399b('0x71')](_0x5974c9[_0x399b('0x47')]['ids']);}})[_0x399b('0x23')](respondWithStatusCode(_0x4b2d63,null))[_0x399b('0x2d')](handleError(_0x4b2d63,null));};exports[_0x399b('0x72')]=function(_0x541b7c,_0x1085cf,_0x5ce19a){return db['FaxInteraction'][_0x399b('0x5d')]({'where':{'id':_0x541b7c[_0x399b('0x5a')]['id']}})[_0x399b('0x23')](handleEntityNotFound(_0x1085cf,null))['then'](function(_0x57c3c5){if(_0x57c3c5){return _0x57c3c5[_0x399b('0x72')](_0x541b7c['body'][_0x399b('0x6d')],_[_0x399b('0x73')](_0x541b7c['body'],[_0x399b('0x6d'),'id'])||{});}})[_0x399b('0x23')](respondWithResult(_0x1085cf,null))[_0x399b('0x2d')](handleError(_0x1085cf,null));};exports[_0x399b('0x74')]=function(_0x5a2fd2,_0x551672,_0x14efd5){var _0x263970={'raw':![],'where':{}};var _0xf0619b={};var _0x36fdb5={'count':0x0,'rows':[]};return db[_0x399b('0x42')][_0x399b('0x6a')]({'where':{'id':_0x5a2fd2[_0x399b('0x5a')]['id']}})[_0x399b('0x23')](handleEntityNotFound(_0x551672,null))[_0x399b('0x23')](function(_0x1251d7){if(_0x1251d7){_0xf0619b['model']=_['keys'](db['FaxInteraction']['rawAttributes']);_0xf0619b[_0x399b('0x47')]=_['keys'](_0x5a2fd2[_0x399b('0x47')]);_0xf0619b[_0x399b('0x48')]=_['intersection'](_0xf0619b[_0x399b('0x46')],_0xf0619b[_0x399b('0x47')]);_0x263970['attributes']=_[_0x399b('0x49')](_0xf0619b[_0x399b('0x46')],qs[_0x399b('0x4b')](_0x5a2fd2[_0x399b('0x47')][_0x399b('0x4b')]));_0x263970[_0x399b('0x4a')]=_0x263970[_0x399b('0x4a')][_0x399b('0x4c')]?_0x263970['attributes']:_0xf0619b['model'];if(!_0x5a2fd2['query']['hasOwnProperty'](_0x399b('0x4e'))){_0x263970[_0x399b('0x33')]=qs[_0x399b('0x33')](_0x5a2fd2[_0x399b('0x47')][_0x399b('0x33')]);_0x263970[_0x399b('0x32')]=qs[_0x399b('0x32')](_0x5a2fd2[_0x399b('0x47')]['offset']);}_0x263970[_0x399b('0x4f')]=qs[_0x399b('0x50')](_0x5a2fd2[_0x399b('0x47')]['sort']);_0x263970[_0x399b('0x51')]=qs[_0x399b('0x48')](_[_0x399b('0x52')](_0x5a2fd2[_0x399b('0x47')],_0xf0619b['filters']));_0x263970[_0x399b('0x51')]['FaxAccountId']=_0x1251d7['id'];if(_0x5a2fd2['query'][_0x399b('0x53')]){_0x263970['where']=_['merge'](_0x263970[_0x399b('0x51')],{'$or':_[_0x399b('0x41')](_0x263970[_0x399b('0x4a')],function(_0x1a0120){var _0x1f6501={};_0x1f6501[_0x1a0120]={'$like':'%'+_0x5a2fd2[_0x399b('0x47')][_0x399b('0x53')]+'%'};return _0x1f6501;})});}_0x263970=_[_0x399b('0x54')]({},_0x263970,_0x5a2fd2[_0x399b('0x56')]);return db[_0x399b('0x75')][_0x399b('0x31')]({'where':_0x263970[_0x399b('0x51')]})[_0x399b('0x23')](function(_0x541adf){_0x36fdb5[_0x399b('0x31')]=_0x541adf;if(_0x5a2fd2[_0x399b('0x47')][_0x399b('0x5c')]){_0x263970[_0x399b('0x57')]=[{'model':db['CmContact'],'as':_0x399b('0x76'),'required':![]},{'model':db[_0x399b('0x77')],'as':_0x399b('0x78'),'attributes':[_0x399b('0x3c'),_0x399b('0x79'),_0x399b('0x7a')],'required':![]},{'model':db[_0x399b('0x7b')],'as':'Tags','attributes':['id',_0x399b('0x3c'),_0x399b('0x7c')],'where':_0x5a2fd2['query'][_0x399b('0x7d')]?{'id':_0x5a2fd2[_0x399b('0x47')][_0x399b('0x7d')]}:undefined,'required':_0x5a2fd2['query']['tag']?!![]:![]}];}return db[_0x399b('0x75')][_0x399b('0x58')](_0x263970);})['then'](function(_0x142bc9){_0x36fdb5[_0x399b('0x59')]=_0x142bc9;return _0x36fdb5;});}})[_0x399b('0x23')](respondWithFilteredResult(_0x551672,_0x263970))[_0x399b('0x2d')](handleError(_0x551672,null));};exports[_0x399b('0x7e')]=function(_0x4b01ba,_0x131ed9,_0x141a77){return db[_0x399b('0x42')][_0x399b('0x6a')]({'where':{'id':_0x4b01ba[_0x399b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x131ed9,null))['then'](function(_0x303148){if(_0x303148){return db['sequelize'][_0x399b('0x7f')](function(_0xae6dd6){return db[_0x399b('0x80')][_0x399b('0x37')]({'where':{'FaxAccountId':_0x4b01ba[_0x399b('0x5a')]['id']},'transaction':_0xae6dd6})['then'](function(_0x1160a6){var _0x3d345a=_[_0x399b('0x41')](_0x4b01ba[_0x399b('0x5f')],function(_0x25949e){_0x25949e['FaxAccountId']=_0x4b01ba[_0x399b('0x5a')]['id'];return _0x25949e;});return db[_0x399b('0x80')][_0x399b('0x81')](_0x3d345a,{'transaction':_0xae6dd6});});})['then'](function(){return db['FaxApplication'][_0x399b('0x82')]({'where':{'FaxAccountId':_0x4b01ba[_0x399b('0x5a')]['id']},'order':_0x399b('0x83')});});}})[_0x399b('0x23')](respondWithResult(_0x131ed9,null))[_0x399b('0x2d')](handleError(_0x131ed9,null));};exports['getApplications']=function(_0x540dd6,_0x40cd74,_0x531f7b){var _0x56b93d={};var _0x5d119d={};var _0x494fb0;var _0x139b85;return db['FaxAccount']['findOne']({'where':{'id':_0x540dd6[_0x399b('0x5a')]['id']}})[_0x399b('0x23')](handleEntityNotFound(_0x40cd74,null))[_0x399b('0x23')](function(_0x234480){if(_0x234480){_0x494fb0=_0x234480;_0x5d119d[_0x399b('0x46')]=_[_0x399b('0x5b')](db[_0x399b('0x80')][_0x399b('0x43')]);_0x5d119d[_0x399b('0x47')]=_[_0x399b('0x5b')](_0x540dd6[_0x399b('0x47')]);_0x5d119d[_0x399b('0x48')]=_[_0x399b('0x49')](_0x5d119d[_0x399b('0x46')],_0x5d119d[_0x399b('0x47')]);_0x56b93d[_0x399b('0x4a')]=_[_0x399b('0x49')](_0x5d119d[_0x399b('0x46')],qs[_0x399b('0x4b')](_0x540dd6[_0x399b('0x47')][_0x399b('0x4b')]));_0x56b93d[_0x399b('0x4a')]=_0x56b93d[_0x399b('0x4a')][_0x399b('0x4c')]?_0x56b93d[_0x399b('0x4a')]:_0x5d119d[_0x399b('0x46')];_0x56b93d[_0x399b('0x4f')]=qs[_0x399b('0x50')](_0x540dd6[_0x399b('0x47')]['sort']);_0x56b93d[_0x399b('0x51')]=qs[_0x399b('0x48')](_[_0x399b('0x52')](_0x540dd6['query'],_0x5d119d[_0x399b('0x48')]));if(_0x540dd6[_0x399b('0x47')][_0x399b('0x53')]){_0x56b93d[_0x399b('0x51')]=_['merge'](_0x56b93d[_0x399b('0x51')],{'$or':_[_0x399b('0x41')](_0x56b93d[_0x399b('0x4a')],function(_0xe2ccd){var _0x4d1fa0={};_0x4d1fa0[_0xe2ccd]={'$like':'%'+_0x540dd6['query'][_0x399b('0x53')]+'%'};return _0x4d1fa0;})});}_0x56b93d=_[_0x399b('0x54')]({},_0x56b93d,_0x540dd6['options']);return _0x494fb0[_0x399b('0x84')](_0x56b93d);}})[_0x399b('0x23')](function(_0x51719b){if(_0x51719b){_0x139b85=_0x51719b[_0x399b('0x4c')];if(!_0x540dd6[_0x399b('0x47')][_0x399b('0x4d')](_0x399b('0x4e'))){_0x56b93d['limit']=qs[_0x399b('0x33')](_0x540dd6[_0x399b('0x47')]['limit']);_0x56b93d['offset']=qs[_0x399b('0x32')](_0x540dd6[_0x399b('0x47')][_0x399b('0x32')]);}return _0x494fb0[_0x399b('0x84')](_0x56b93d);}})[_0x399b('0x23')](function(_0x3dab9e){if(_0x3dab9e){return _0x3dab9e?{'count':_0x139b85,'rows':_0x3dab9e}:null;}})[_0x399b('0x23')](respondWithResult(_0x40cd74,null))[_0x399b('0x2d')](handleError(_0x40cd74,null));};function Extension(_0x4e8c5d,_0x3733d7,_0xc1d0a3,_0x28fdd9){this[_0x399b('0x85')]=_0x399b('0x86');this[_0x399b('0x87')]=_0x4e8c5d['localstationid'];this['app']=_0x28fdd9;this[_0x399b('0x45')]=_0x399b('0x88');this[_0x399b('0x89')]=_0x399b('0x8a');this[_0x399b('0x6b')]=_0x4e8c5d['id'];this['priority']=_0x3733d7;this[_0x399b('0x8b')]=_0xc1d0a3;}function createExtensionsReciveFax(_0x9dbdf5){var _0x1ba37a=0x1;var _0x5b06ac=[];_0x5b06ac[_0x399b('0x8c')](new Extension(_0x9dbdf5,_0x1ba37a,'',_0x399b('0x8d')));_0x1ba37a+=0x1;_0x5b06ac[_0x399b('0x8c')](new Extension(_0x9dbdf5,_0x1ba37a,_0x399b('0x8e'),_0x399b('0x8f')));_0x1ba37a+=0x1;for(var _0x3610ff in _0x9dbdf5){if(_0x9dbdf5[_0x399b('0x4d')](_0x3610ff)&&(_0x3610ff==='ecm'||_0x3610ff===_0x399b('0x90')||_0x3610ff==='gateway'||_0x3610ff===_0x399b('0x91')||_0x3610ff===_0x399b('0x92')||_0x3610ff===_0x399b('0x93')||_0x3610ff===_0x399b('0x94')||_0x3610ff==='modem'||_0x3610ff==='t38timeout')){_0x5b06ac['push'](new Extension(_0x9dbdf5,_0x1ba37a,_0x399b('0x95')+_0x3610ff+')='+_0x9dbdf5[_0x3610ff],_0x399b('0x8f')));_0x1ba37a+=0x1;}}_0x5b06ac[_0x399b('0x8c')](new Extension(_0x9dbdf5,_0x1ba37a,'6','Wait'));_0x1ba37a+=0x1;_0x5b06ac['push'](new Extension(_0x9dbdf5,_0x1ba37a,_0x399b('0x96'),_0x399b('0x97')));_0x1ba37a=0x0;return _0x5b06ac;}exports['addAccountApplications']=function(_0x1dc4f7,_0x53ebce,_0x7a69c9){var _0x3df744;return db[_0x399b('0x98')][_0x399b('0x7f')](function(_0x4199ef){return db[_0x399b('0x42')]['create'](_0x1dc4f7[_0x399b('0x5f')],{'transaction':_0x4199ef})['then'](function(_0x56eaf8){_0x3df744=_0x56eaf8[_0x399b('0x38')]({'plain':!![]});return db[_0x399b('0x99')][_0x399b('0x81')](createExtensionsReciveFax(_0x3df744),{'transaction':_0x4199ef});});})[_0x399b('0x23')](function(){return _0x3df744;})[_0x399b('0x23')](respondWithResult(_0x53ebce,null))[_0x399b('0x2d')](handleError(_0x53ebce,null));};exports[_0x399b('0x9a')]=function(_0x1a58f2,_0x344611,_0x1ec498){var _0x596a07;return db[_0x399b('0x98')]['transaction'](function(_0x1b99f4){return db['FaxAccount'][_0x399b('0x36')](_0x1a58f2['body'],{'where':{'id':_0x1a58f2[_0x399b('0x5f')]['id']},'transaction':_0x1b99f4})[_0x399b('0x23')](function(_0x4bf60a){return db[_0x399b('0x99')][_0x399b('0x37')]({'where':{'FaxAccountId':_0x1a58f2['body']['id']},'transaction':_0x1b99f4})['then'](function(_0x47e112){return db[_0x399b('0x99')][_0x399b('0x81')](createExtensionsReciveFax(_[_0x399b('0x73')](_0x1a58f2[_0x399b('0x5f')],[_0x399b('0x9b'),_0x399b('0x9c'),_0x399b('0x9d'),_0x399b('0x9e'),_0x399b('0x9f'),'ListId'])),{'transaction':_0x1b99f4});});});})[_0x399b('0x23')](function(){return db['FaxAccount'][_0x399b('0xa0')](_0x1a58f2['body']['id']);})[_0x399b('0x23')](respondWithResult(_0x344611,null))[_0x399b('0x2d')](handleError(_0x344611,null));};exports[_0x399b('0xa1')]=function(_0x5130a9,_0x54c633,_0x4d669a){var _0x1c7c98={'raw':!![],'where':{}};var _0x53aeee={};var _0x257609={'count':0x0,'rows':[]};return db[_0x399b('0x42')][_0x399b('0x6a')]({'where':{'id':_0x5130a9[_0x399b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x54c633,null))['then'](function(_0x15c0aa){if(_0x15c0aa){_0x53aeee[_0x399b('0x46')]=_[_0x399b('0x5b')](db[_0x399b('0xa2')][_0x399b('0x43')]);_0x53aeee[_0x399b('0x47')]=_['keys'](_0x5130a9[_0x399b('0x47')]);_0x53aeee['filters']=_[_0x399b('0x49')](_0x53aeee[_0x399b('0x46')],_0x53aeee['query']);_0x1c7c98[_0x399b('0x4a')]=_[_0x399b('0x49')](_0x53aeee['model'],qs[_0x399b('0x4b')](_0x5130a9['query'][_0x399b('0x4b')]));_0x1c7c98['attributes']=_0x1c7c98['attributes']['length']?_0x1c7c98[_0x399b('0x4a')]:_0x53aeee[_0x399b('0x46')];if(!_0x5130a9[_0x399b('0x47')][_0x399b('0x4d')](_0x399b('0x4e'))){_0x1c7c98[_0x399b('0x33')]=qs[_0x399b('0x33')](_0x5130a9[_0x399b('0x47')]['limit']);_0x1c7c98[_0x399b('0x32')]=qs[_0x399b('0x32')](_0x5130a9[_0x399b('0x47')]['offset']);}_0x1c7c98[_0x399b('0x4f')]=qs['sort'](_0x5130a9['query'][_0x399b('0x50')]);_0x1c7c98[_0x399b('0x51')]=qs[_0x399b('0x48')](_[_0x399b('0x52')](_0x5130a9[_0x399b('0x47')],_0x53aeee[_0x399b('0x48')]));_0x1c7c98[_0x399b('0x51')]['FaxAccountId']=_0x15c0aa['id'];if(_0x5130a9[_0x399b('0x47')]['filter']){_0x1c7c98['where']=_[_0x399b('0x54')](_0x1c7c98[_0x399b('0x51')],{'$or':_[_0x399b('0x41')](_0x1c7c98[_0x399b('0x4a')],function(_0x2539d4){var _0x517ab3={};_0x517ab3[_0x2539d4]={'$like':'%'+_0x5130a9[_0x399b('0x47')]['filter']+'%'};return _0x517ab3;})});}if(_0x5130a9[_0x399b('0x47')][_0x399b('0xa3')]){var _0x298dfd=_0x5130a9['query'][_0x399b('0xa3')][_0x399b('0xa4')](',');var _0x5ba6be={};_0x5ba6be[_0x298dfd[0x0]]={'$gte':moment(_0x298dfd[0x1])[_0x399b('0xa5')](_0x399b('0xa6'))};_0x1c7c98[_0x399b('0x51')]=_[_0x399b('0x54')](_0x1c7c98[_0x399b('0x51')],_0x5ba6be);}_0x1c7c98=_['merge']({},_0x1c7c98,_0x5130a9[_0x399b('0x56')]);return db['FaxMessage'][_0x399b('0x31')]({'where':_0x1c7c98['where']})[_0x399b('0x23')](function(_0x14eabb){_0x257609['count']=_0x14eabb;if(_0x5130a9['query'][_0x399b('0x5c')]){_0x1c7c98[_0x399b('0x57')]=[{'all':!![]}];}return db[_0x399b('0xa2')][_0x399b('0x58')](_0x1c7c98);})[_0x399b('0x23')](function(_0x28ed3f){_0x257609[_0x399b('0x59')]=_0x28ed3f;return _0x257609;});}})['then'](respondWithFilteredResult(_0x54c633,_0x1c7c98))[_0x399b('0x2d')](handleError(_0x54c633,null));};exports[_0x399b('0x3d')]=function(_0x17a367,_0x45c782,_0x3cc4e1){var _0x41f4dd,_0x151e56={},_0x1f3b08;if(_0x17a367[_0x399b('0x5f')]['to']){_0x1f3b08=_0x17a367[_0x399b('0x5f')]['to'][0x0];}return db[_0x399b('0x42')][_0x399b('0x5d')]({'where':{'id':_0x17a367['params']['id']},'include':[{'model':db[_0x399b('0xa7')],'as':'List','include':[{'model':db[_0x399b('0xa8')],'as':_0x399b('0xa9'),'where':{'fax':_0x1f3b08},'limit':0x1,'order':[[_0x399b('0x9e'),_0x399b('0xaa')]]}]}]})[_0x399b('0x23')](handleEntityNotFound(_0x45c782,null))[_0x399b('0x23')](function(_0x1be2ca){_0x41f4dd=_0x1be2ca;if(_0x17a367[_0x399b('0x5f')][_0x399b('0xab')]&&_0x17a367['body'][_0x399b('0xab')][_0x399b('0x4c')]){for(var _0xb73da5=0x0;_0xb73da5<_0x17a367['body']['attachments'][_0x399b('0x4c')];_0xb73da5+=0x1){_0x17a367[_0x399b('0x5f')][_0x399b('0xab')][_0xb73da5]={'filename':_0x17a367[_0x399b('0x5f')]['attachments'][_0xb73da5][_0x399b('0x3c')],'id':_0x17a367[_0x399b('0x5f')][_0x399b('0xab')][_0xb73da5]['id'],'path':path[_0x399b('0xac')](config[_0x399b('0xad')],_0x399b('0xae'),_0x17a367['body'][_0x399b('0xab')][_0xb73da5][_0x399b('0xaf')])};}}return respondWithRpcPromise(_0x399b('0xb0'),_0x399b('0xb0'),{'FaxAccountId':_[_0x399b('0xb1')](_0x17a367[_0x399b('0x5a')]['id'])?undefined:_0x17a367[_0x399b('0x5a')]['id'],'path':_['isNil'](_0x17a367[_0x399b('0x5f')]['attachments'][0x0][_0x399b('0x9')])?undefined:_0x17a367[_0x399b('0x5f')][_0x399b('0xab')][0x0][_0x399b('0x9')],'fax':_[_0x399b('0xb1')](_0x17a367['body']['to'][0x0])?undefined:_0x17a367[_0x399b('0x5f')]['to'][0x0]},client9002);})[_0x399b('0x23')](function(){if(_0x41f4dd){if(_[_0x399b('0xb1')](_0x17a367['body'][_0x399b('0xb2')])){_0x17a367[_0x399b('0x5f')][_0x399b('0xb2')]=util[_0x399b('0xa5')](_0x399b('0xb3'),_0x41f4dd[_0x399b('0x3c')],_0x41f4dd[_0x399b('0xb4')]);}if(_0x41f4dd['List']){if(_0x41f4dd[_0x399b('0xb5')][_0x399b('0xa9')]['length']){return _0x41f4dd[_0x399b('0xb5')][_0x399b('0xa9')][0x0];}else{return db['CmContact'][_0x399b('0x5e')](_[_0x399b('0x1a')](_0x17a367[_0x399b('0x5f')],{'firstName':_0x17a367[_0x399b('0x5f')]['to'][0x0],'phone':_0x17a367[_0x399b('0x5f')]['to'][0x0],'fax':_0x17a367[_0x399b('0x5f')]['to'][0x0],'ListId':_0x41f4dd[_0x399b('0xb6')]}));}}else{throw new Error(_0x399b('0xb7'));}}else{throw new Error(_0x399b('0xb8'));}})['then'](function(_0x205224){if(_0x205224){return db[_0x399b('0x75')][_0x399b('0x5d')]({'where':{'ContactId':_0x205224['id'],'closed':![],'FaxAccountId':_0x41f4dd['id']}})[_0x399b('0x23')](function(_0x52b2af){if(_0x52b2af){return[_0x52b2af,![]];}return db[_0x399b('0x75')][_0x399b('0x5e')]({'UserId':_0x17a367[_0x399b('0x60')]['id'],'ContactId':_0x205224['id'],'FaxAccountId':_0x41f4dd['id'],'fax':_0x17a367[_0x399b('0x5f')]['to'][0x0],'firstMsgDirection':_0x399b('0xb9'),'Messages':[_[_0x399b('0x54')](_0x17a367[_0x399b('0x5f')],{'read':![],'body':_0x17a367[_0x399b('0x5f')][_0x399b('0xab')][0x0][_0x399b('0xba')],'FaxAccountId':_0x41f4dd['id'],'UserId':_0x17a367[_0x399b('0x60')]['id'],'ContactId':_0x205224['id'],'AttachmentId':_0x17a367[_0x399b('0x5f')][_0x399b('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x399b('0xa2')],'as':'Messages'}]})[_0x399b('0x23')](function(_0x3c5d13){return[_0x3c5d13,!![]];});});}else{throw new Error(_0x399b('0xbb'));}})['spread'](function(_0x26ae4d,_0x9720ee){if(_0x9720ee){return _0x26ae4d;}return db[_0x399b('0xa2')][_0x399b('0x5e')]({'direction':'out','read':![],'body':_0x17a367[_0x399b('0x5f')][_0x399b('0xab')][0x0]['filename'],'FaxAccountId':_0x41f4dd['id'],'FaxInteractionId':_0x26ae4d['id'],'UserId':_0x17a367[_0x399b('0x60')]['id'],'ContactId':_0x26ae4d[_0x399b('0xbc')],'AttachmentId':_0x17a367[_0x399b('0x5f')]['attachments'][0x0]['id']})['then'](function(_0x380ca9){_0x26ae4d['dataValues'][_0x399b('0xbd')]=[];_0x26ae4d[_0x399b('0xbe')][_0x399b('0xbd')]['push'](_0x380ca9[_0x399b('0xbe')]);return _0x26ae4d;});})[_0x399b('0x23')](function(_0x51e95b){respondWithRpcPromise(_0x399b('0xbf'),_0x399b('0xbf'),{'FaxAccountId':_[_0x399b('0xb1')](_0x17a367[_0x399b('0x5a')]['id'])?undefined:_0x17a367[_0x399b('0x5a')]['id'],'path':_[_0x399b('0xb1')](_0x17a367['body']['attachments'][0x0][_0x399b('0x9')])?undefined:_0x17a367[_0x399b('0x5f')]['attachments'][0x0][_0x399b('0x9')],'fax':_[_0x399b('0xb1')](_0x17a367[_0x399b('0x5f')]['to'][0x0])?undefined:_0x17a367['body']['to'][0x0],'AttachmentId':_0x17a367[_0x399b('0x5f')][_0x399b('0xab')][0x0]['id']},client9002)[_0x399b('0x23')](function(_0x1be7da){logger['info']('SendFaxRpc,\x20%s',_0x1be7da);})['catch'](function(_0x2cd0be){logger[_0x399b('0x2b')](_0x399b('0xc0'),_0x2cd0be);});return _0x51e95b;})[_0x399b('0x23')](respondWithResult(_0x45c782,null))['catch'](handleError(_0x45c782,null));};exports[_0x399b('0xc1')]=function(_0x39b17a,_0x26024a,_0x38b6ec){return db[_0x399b('0x42')]['find']({'where':{'id':_0x39b17a[_0x399b('0x5a')]['id']}})[_0x399b('0x23')](handleEntityNotFound(_0x26024a,null))['then'](function(_0x225d63){if(_0x225d63){return _0x225d63['addAgents'](_0x39b17a[_0x399b('0x5f')][_0x399b('0x6d')],_[_0x399b('0x73')](_0x39b17a[_0x399b('0x5f')],[_0x399b('0x6d'),'id'])||{})[_0x399b('0xc2')](function(_0x48de4e){for(var _0x43a2e7=0x0;_0x43a2e7<_0x39b17a['body'][_0x399b('0x6d')]['length'];_0x43a2e7+=0x1){socket['emit'](_0x399b('0xc3'),{'UserId':_0x39b17a['body'][_0x399b('0x6d')][_0x43a2e7],'FaxAccountId':_0x39b17a[_0x399b('0x5a')]['id']});}return _0x48de4e;});}})[_0x399b('0x23')](respondWithResult(_0x26024a,null))[_0x399b('0x2d')](handleError(_0x26024a,null));};exports['removeAgents']=function(_0x2e3c91,_0x24872a,_0x3bc801){return db[_0x399b('0x42')][_0x399b('0x5d')]({'where':{'id':_0x2e3c91[_0x399b('0x5a')]['id']}})[_0x399b('0x23')](handleEntityNotFound(_0x24872a,null))[_0x399b('0x23')](function(_0x2ab7e3){if(_0x2ab7e3){return _0x2ab7e3['removeAgents'](_0x2e3c91[_0x399b('0x47')][_0x399b('0x6d')])['then'](function(){if(_[_0x399b('0xc4')](_0x2e3c91[_0x399b('0x47')][_0x399b('0x6d')])){for(var _0x42ecad=0x0;_0x42ecad<_0x2e3c91[_0x399b('0x47')][_0x399b('0x6d')][_0x399b('0x4c')];_0x42ecad+=0x1){socket['emit'](_0x399b('0xc5'),{'UserId':Number(_0x2e3c91['query'][_0x399b('0x6d')][_0x42ecad]),'FaxAccountId':Number(_0x2e3c91[_0x399b('0x5a')]['id'])});}}else{socket[_0x399b('0xc6')]('userFaxAccount:remove',{'UserId':Number(_0x2e3c91[_0x399b('0x47')][_0x399b('0x6d')]),'FaxAccountId':Number(_0x2e3c91['params']['id'])});}});}})[_0x399b('0x23')](respondWithStatusCode(_0x24872a,null))[_0x399b('0x2d')](handleError(_0x24872a,null));};exports[_0x399b('0xc7')]=function(_0x353526,_0x1abc96,_0x45369c){var _0x8d21e3={};var _0x5a17f8={};var _0x23078e;var _0x20c497;return db[_0x399b('0x42')][_0x399b('0x6a')]({'where':{'id':_0x353526[_0x399b('0x5a')]['id']}})[_0x399b('0x23')](handleEntityNotFound(_0x1abc96,null))[_0x399b('0x23')](function(_0x263bc4){if(_0x263bc4){_0x23078e=_0x263bc4;_0x5a17f8[_0x399b('0x46')]=_['keys'](db['User']['rawAttributes']);_0x5a17f8[_0x399b('0x47')]=_[_0x399b('0x5b')](_0x353526['query']);_0x5a17f8[_0x399b('0x48')]=_['intersection'](_0x5a17f8[_0x399b('0x46')],_0x5a17f8[_0x399b('0x47')]);_0x8d21e3[_0x399b('0x4a')]=_[_0x399b('0x49')](_0x5a17f8['model'],qs[_0x399b('0x4b')](_0x353526[_0x399b('0x47')][_0x399b('0x4b')]));_0x8d21e3[_0x399b('0x4a')]=_0x8d21e3[_0x399b('0x4a')][_0x399b('0x4c')]?_0x8d21e3['attributes']:_0x5a17f8[_0x399b('0x46')];_0x8d21e3[_0x399b('0x4f')]=qs[_0x399b('0x50')](_0x353526[_0x399b('0x47')][_0x399b('0x50')]);_0x8d21e3[_0x399b('0x51')]=qs[_0x399b('0x48')](_[_0x399b('0x52')](_0x353526[_0x399b('0x47')],_0x5a17f8[_0x399b('0x48')]));if(_0x353526[_0x399b('0x47')][_0x399b('0x53')]){_0x8d21e3[_0x399b('0x51')]=_[_0x399b('0x54')](_0x8d21e3['where'],{'$or':_[_0x399b('0x41')](_0x8d21e3[_0x399b('0x4a')],function(_0xca6fb){var _0x191c30={};_0x191c30[_0xca6fb]={'$like':'%'+_0x353526[_0x399b('0x47')][_0x399b('0x53')]+'%'};return _0x191c30;})});}_0x8d21e3=_[_0x399b('0x54')]({},_0x8d21e3,_0x353526[_0x399b('0x56')]);return _0x23078e[_0x399b('0xc7')](_0x8d21e3);}})['then'](function(_0x3948ee){if(_0x3948ee){_0x20c497=_0x3948ee['length'];if(!_0x353526[_0x399b('0x47')][_0x399b('0x4d')](_0x399b('0x4e'))){_0x8d21e3[_0x399b('0x33')]=qs[_0x399b('0x33')](_0x353526[_0x399b('0x47')]['limit']);_0x8d21e3['offset']=qs[_0x399b('0x32')](_0x353526[_0x399b('0x47')][_0x399b('0x32')]);}return _0x23078e[_0x399b('0xc7')](_0x8d21e3);}})[_0x399b('0x23')](function(_0x41798d){if(_0x41798d){return _0x41798d?{'count':_0x20c497,'rows':_0x41798d}:null;}})['then'](respondWithResult(_0x1abc96,null))['catch'](handleError(_0x1abc96,null));}; \ No newline at end of file +var _0x892d=['where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','params','rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','ids','omit','getInteractions','FaxInteraction','Contact','User','internal','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','appdata','push','Answer','Set','ecm','gateway','faxdetect','maxrate','minrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','tech','key','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','updatedAt','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','CmContact','Send\x20Fax\x20failed','user','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','status','json','offset','Content-Range','reject','save','then','destroy','get','FaxAccounts','end','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0x892d,0x136));var _0xd892=function(_0x48d93d,_0x17a2a1){_0x48d93d=_0x48d93d-0x0;var _0x497a42=_0x892d[_0x48d93d];return _0x497a42;};'use strict';var pdf=require(_0xd892('0x0'));var emlformat=require(_0xd892('0x1'));var rimraf=require(_0xd892('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd892('0x3'));var rp=require('request-promise');var moment=require(_0xd892('0x4'));var BPromise=require(_0xd892('0x5'));var Mustache=require(_0xd892('0x6'));var util=require('util');var path=require(_0xd892('0x7'));var sox=require('sox');var csv=require(_0xd892('0x8'));var ejs=require(_0xd892('0x9'));var fs=require('fs');var _=require(_0xd892('0xa'));var squel=require(_0xd892('0xb'));var crypto=require('crypto');var jsforce=require(_0xd892('0xc'));var deskjs=require(_0xd892('0xd'));var toCsv=require(_0xd892('0x8'));var querystring=require(_0xd892('0xe'));var Papa=require(_0xd892('0xf'));var Redis=require(_0xd892('0x10'));var authService=require(_0xd892('0x11'));var qs=require(_0xd892('0x12'));var as=require(_0xd892('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd892('0x14'))(_0xd892('0x15'));var utils=require(_0xd892('0x16'));var config=require(_0xd892('0x17'));var db=require('../../mysqldb')['db'];config[_0xd892('0x18')]=_[_0xd892('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd892('0x1a'))(new Redis(config[_0xd892('0x18')]));require(_0xd892('0x1b'))[_0xd892('0x1c')](socket);var jayson=require(_0xd892('0x1d'));var client=jayson['client'][_0xd892('0x1e')]({'port':0x232c});var client9002=jayson[_0xd892('0x1f')][_0xd892('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x14833a,_0x36ccf4,_0x48aac6){if(_0x48aac6){var _0x1303c2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1303c2[_0xd892('0x20')](_0x36ccf4)){return _0x14833a;}else{throw new db[(_0xd892('0x21'))][(_0xd892('0x22'))](_0xd892('0x23'));}}else{return _0x14833a;}}function respondWithRpcPromise(_0x439477,_0x297f97,_0x8f51f4,_0x3cfc99){return new BPromise(function(_0x5679fb,_0xf09c14){var _0x5bcf26=_0x3cfc99||client;return _0x5bcf26[_0xd892('0x24')](_0x439477,_0x8f51f4)['then'](function(_0xaa24ac){logger[_0xd892('0x25')](_0xd892('0x26'),_0x297f97,'request\x20sent');logger[_0xd892('0x27')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x297f97,_0xd892('0x28'),JSON['stringify'](_0xaa24ac));if(_0xaa24ac[_0xd892('0x29')]){if(_0xaa24ac[_0xd892('0x29')][_0xd892('0x2a')]===0x1f4){logger[_0xd892('0x29')](_0xd892('0x26'),_0x297f97,_0xaa24ac['error'][_0xd892('0x2b')]);return _0xf09c14(_0xaa24ac[_0xd892('0x29')][_0xd892('0x2b')]);}logger[_0xd892('0x29')](_0xd892('0x26'),_0x297f97,_0xaa24ac[_0xd892('0x29')][_0xd892('0x2b')]);return _0x5679fb(_0xaa24ac[_0xd892('0x29')][_0xd892('0x2b')]);}else{logger[_0xd892('0x25')](_0xd892('0x26'),_0x297f97,_0xd892('0x28'));_0x5679fb(_0xaa24ac[_0xd892('0x2c')][_0xd892('0x2b')]);}})[_0xd892('0x2d')](function(_0x43a2f8){logger[_0xd892('0x29')](_0xd892('0x26'),_0x297f97,_0x43a2f8);_0xf09c14(_0x43a2f8);});});}function respondWithStatusCode(_0x3350f7,_0x3a4547){_0x3a4547=_0x3a4547||0xcc;return function(_0x16a5f7){if(_0x16a5f7){return _0x3350f7['sendStatus'](_0x3a4547);}return _0x3350f7[_0xd892('0x2e')](_0x3a4547)['end']();};}function respondWithResult(_0x3cc750,_0x2270c3){_0x2270c3=_0x2270c3||0xc8;return function(_0x5354b8){if(_0x5354b8){return _0x3cc750[_0xd892('0x2e')](_0x2270c3)[_0xd892('0x2f')](_0x5354b8);}};}function respondWithFilteredResult(_0x1ee6f8,_0x2594eb){return function(_0x1008cf){if(_0x1008cf){var _0x4124c2=_0x1008cf['count'],_0x4e4f15=_0x2594eb[_0xd892('0x30')],_0x34b431=_0x2594eb[_0xd892('0x30')]+_0x2594eb['limit'],_0x2b7dc9;if(_0x34b431>=_0x4124c2){_0x34b431=_0x4124c2;_0x2b7dc9=0xc8;}else{_0x2b7dc9=0xce;}_0x1ee6f8[_0xd892('0x2e')](_0x2b7dc9);return _0x1ee6f8['set'](_0xd892('0x31'),_0x4e4f15+'-'+_0x34b431+'/'+_0x4124c2)['json'](_0x1008cf);}return null;};}function patchUpdates(_0x7203a2){return function(_0x47e427){try{jsonpatch['apply'](_0x47e427,_0x7203a2,!![]);}catch(_0x22abbb){return BPromise[_0xd892('0x32')](_0x22abbb);}return _0x47e427[_0xd892('0x33')]();};}function saveUpdates(_0x551f92,_0x553d19){return function(_0x28b744){if(_0x28b744){return _0x28b744['update'](_0x551f92)[_0xd892('0x34')](function(_0xe61c0a){return _0xe61c0a;});}return null;};}function removeEntity(_0x5f308a,_0x57354c){return function(_0x50ea54){if(_0x50ea54){return _0x50ea54[_0xd892('0x35')]()[_0xd892('0x34')](function(){var _0x3416f6=_0x50ea54[_0xd892('0x36')]({'plain':!![]});var _0x5330bf=_0xd892('0x37');return db['UserProfileResource']['destroy']({'where':{'type':_0x5330bf,'resourceId':_0x3416f6['id']}})['then'](function(){return _0x50ea54;});})[_0xd892('0x34')](function(){_0x5f308a['status'](0xcc)[_0xd892('0x38')]();});}};}function handleEntityNotFound(_0x1a51da,_0x3c8b8c){return function(_0x3621ec){if(!_0x3621ec){_0x1a51da[_0xd892('0x39')](0x194);}return _0x3621ec;};}function handleError(_0x22ddb9,_0x6f215f){_0x6f215f=_0x6f215f||0x1f4;return function(_0x502f5a){logger[_0xd892('0x29')](_0x502f5a[_0xd892('0x3a')]);if(_0x502f5a[_0xd892('0x3b')]){delete _0x502f5a[_0xd892('0x3b')];}_0x22ddb9[_0xd892('0x2e')](_0x6f215f)[_0xd892('0x3c')](_0x502f5a);};}exports[_0xd892('0x3d')]=function(_0x467d54,_0x538c9f){var _0x3ab944={'include':[{'model':db[_0xd892('0x3e')],'as':_0xd892('0x3f')}]},_0x18dd65={},_0x37d250={'count':0x0,'rows':[]};var _0x47ef09=_[_0xd892('0x40')](db[_0xd892('0x41')]['rawAttributes'],function(_0x132c49){return{'name':_0x132c49[_0xd892('0x42')],'type':_0x132c49[_0xd892('0x43')]['key']};});_0x18dd65[_0xd892('0x44')]=_[_0xd892('0x40')](_0x47ef09,_0xd892('0x3b'));_0x18dd65[_0xd892('0x45')]=_[_0xd892('0x46')](_0x467d54[_0xd892('0x45')]);_0x18dd65[_0xd892('0x47')]=_[_0xd892('0x48')](_0x18dd65[_0xd892('0x44')],_0x18dd65[_0xd892('0x45')]);_0x3ab944[_0xd892('0x49')]=_['intersection'](_0x18dd65[_0xd892('0x44')],qs[_0xd892('0x4a')](_0x467d54['query'][_0xd892('0x4a')]));_0x3ab944[_0xd892('0x49')]=_0x3ab944['attributes'][_0xd892('0x4b')]?_0x3ab944['attributes']:_0x18dd65['model'];if(!_0x467d54[_0xd892('0x45')]['hasOwnProperty'](_0xd892('0x4c'))){_0x3ab944[_0xd892('0x4d')]=qs[_0xd892('0x4d')](_0x467d54[_0xd892('0x45')][_0xd892('0x4d')]);_0x3ab944[_0xd892('0x30')]=qs[_0xd892('0x30')](_0x467d54['query'][_0xd892('0x30')]);}_0x3ab944[_0xd892('0x4e')]=qs[_0xd892('0x4f')](_0x467d54[_0xd892('0x45')]['sort']);_0x3ab944['where']=qs[_0xd892('0x47')](_[_0xd892('0x50')](_0x467d54[_0xd892('0x45')],_0x18dd65[_0xd892('0x47')]));if(_0x467d54[_0xd892('0x45')][_0xd892('0x51')]){_0x3ab944['where']=_['merge'](_0x3ab944[_0xd892('0x52')],{'$or':_[_0xd892('0x40')](_0x47ef09,function(_0x22ccad){if(_0x22ccad[_0xd892('0x43')]!==_0xd892('0x53')){var _0x58aa5d={};_0x58aa5d[_0x22ccad[_0xd892('0x3b')]]={'$like':'%'+_0x467d54[_0xd892('0x45')][_0xd892('0x51')]+'%'};return _0x58aa5d;}})});}_0x3ab944=_[_0xd892('0x54')]({},_0x3ab944,_0x467d54[_0xd892('0x55')]);var _0x3d7130={'where':_0x3ab944[_0xd892('0x52')]};return db[_0xd892('0x41')]['count'](_0x3d7130)[_0xd892('0x34')](function(_0x178d2b){_0x37d250[_0xd892('0x56')]=_0x178d2b;if(_0x467d54['query'][_0xd892('0x57')]){_0x3ab944[_0xd892('0x58')]=[{'all':!![]}];}return db[_0xd892('0x41')][_0xd892('0x59')](_0x3ab944);})[_0xd892('0x34')](function(_0x1c4da7){_0x37d250[_0xd892('0x5a')]=_0x1c4da7;return _0x37d250;})['then'](respondWithFilteredResult(_0x538c9f,_0x3ab944))['catch'](handleError(_0x538c9f,null));};exports['show']=function(_0x2c2d7a,_0x2b8d79){var _0x4d9327={'raw':![],'where':{'id':_0x2c2d7a[_0xd892('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xd892('0x3f')}]},_0x1015ca={};_0x1015ca[_0xd892('0x44')]=_['keys'](db[_0xd892('0x41')][_0xd892('0x5c')]);_0x1015ca[_0xd892('0x45')]=_[_0xd892('0x46')](_0x2c2d7a[_0xd892('0x45')]);_0x1015ca[_0xd892('0x47')]=_[_0xd892('0x48')](_0x1015ca['model'],_0x1015ca[_0xd892('0x45')]);_0x4d9327[_0xd892('0x49')]=_[_0xd892('0x48')](_0x1015ca['model'],qs['fields'](_0x2c2d7a['query'][_0xd892('0x4a')]));_0x4d9327[_0xd892('0x49')]=_0x4d9327[_0xd892('0x49')][_0xd892('0x4b')]?_0x4d9327[_0xd892('0x49')]:_0x1015ca[_0xd892('0x44')];if(_0x2c2d7a[_0xd892('0x45')][_0xd892('0x57')]){_0x4d9327[_0xd892('0x58')]=[{'all':!![]}];}_0x4d9327=_[_0xd892('0x54')]({},_0x4d9327,_0x2c2d7a[_0xd892('0x55')]);return db[_0xd892('0x41')][_0xd892('0x5d')](_0x4d9327)[_0xd892('0x34')](handleEntityNotFound(_0x2b8d79,null))[_0xd892('0x34')](respondWithResult(_0x2b8d79,null))[_0xd892('0x2d')](handleError(_0x2b8d79,null));};exports[_0xd892('0x5e')]=function(_0x5eed29,_0x3d3fc8){return db[_0xd892('0x41')]['create'](_0x5eed29['body'],{})[_0xd892('0x34')](function(_0x4b824b){var _0x18662e=_0x5eed29['user']['get']({'plain':!![]});if(!_0x18662e)throw new Error(_0xd892('0x5f'));if(_0x18662e[_0xd892('0x60')]==='user'){var _0x24e7dd=_0x4b824b[_0xd892('0x36')]({'plain':!![]});var _0x2ff8a2=_0xd892('0x37');return db[_0xd892('0x61')]['find']({'where':{'name':_0x2ff8a2,'userProfileId':_0x18662e[_0xd892('0x62')]},'raw':!![]})[_0xd892('0x34')](function(_0x2d8777){if(_0x2d8777&&_0x2d8777['autoAssociation']===0x0){return db['UserProfileResource'][_0xd892('0x5e')]({'name':_0x24e7dd[_0xd892('0x3b')],'resourceId':_0x24e7dd['id'],'type':_0x2d8777['name'],'sectionId':_0x2d8777['id']},{})[_0xd892('0x34')](function(){return _0x4b824b;});}else{return _0x4b824b;}})[_0xd892('0x2d')](function(_0x14ea4e){logger[_0xd892('0x29')](_0xd892('0x63'),_0x14ea4e);throw _0x14ea4e;});}return _0x4b824b;})['then'](respondWithResult(_0x3d3fc8,0xc9))['catch'](handleError(_0x3d3fc8,null));};exports[_0xd892('0x64')]=function(_0x2f8925,_0x499bab){if(_0x2f8925[_0xd892('0x65')]['id']){delete _0x2f8925[_0xd892('0x65')]['id'];}return db[_0xd892('0x41')][_0xd892('0x5d')]({'where':{'id':_0x2f8925[_0xd892('0x5b')]['id']},'include':[{'model':db[_0xd892('0x3e')],'as':_0xd892('0x3f')}]})[_0xd892('0x34')](handleEntityNotFound(_0x499bab,null))[_0xd892('0x34')](saveUpdates(_0x2f8925[_0xd892('0x65')],null))[_0xd892('0x34')](respondWithResult(_0x499bab,null))[_0xd892('0x2d')](handleError(_0x499bab,null));};exports['destroy']=function(_0x5ab242,_0x39f9a9){return db['FaxAccount'][_0xd892('0x5d')]({'where':{'id':_0x5ab242[_0xd892('0x5b')]['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x39f9a9,null))['then'](removeEntity(_0x39f9a9,null))['catch'](handleError(_0x39f9a9,null));};exports['describe']=function(_0x175e20,_0x474e9f){return db[_0xd892('0x41')]['describe']()[_0xd892('0x34')](respondWithResult(_0x474e9f,null))[_0xd892('0x2d')](handleError(_0x474e9f,null));};exports[_0xd892('0x66')]=function(_0x3ddfb6,_0x19cd0c,_0x17a676){if(_0x3ddfb6[_0xd892('0x65')]['id']){delete _0x3ddfb6['body']['id'];}return db[_0xd892('0x41')][_0xd892('0x5d')]({'where':{'id':_0x3ddfb6['params']['id']}})['then'](handleEntityNotFound(_0x19cd0c,null))[_0xd892('0x34')](function(_0xabd598){if(_0xabd598){_0x3ddfb6[_0xd892('0x65')][_0xd892('0x67')]=_0xabd598['id'];return db[_0xd892('0x68')][_0xd892('0x5e')](_0x3ddfb6[_0xd892('0x65')]);}})[_0xd892('0x34')](respondWithResult(_0x19cd0c,null))[_0xd892('0x2d')](handleError(_0x19cd0c,null));};exports[_0xd892('0x69')]=function(_0x12c798,_0x417a43,_0x4276a6){var _0x2582bb={'raw':![],'where':{}};var _0x2935bc={};var _0x2ae94e={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd892('0x6a')]({'where':{'id':_0x12c798[_0xd892('0x5b')]['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x417a43,null))[_0xd892('0x34')](function(_0x267bb2){if(_0x267bb2){_0x2935bc[_0xd892('0x44')]=_['keys'](db['Disposition'][_0xd892('0x5c')]);_0x2935bc[_0xd892('0x45')]=_[_0xd892('0x46')](_0x12c798[_0xd892('0x45')]);_0x2935bc[_0xd892('0x47')]=_[_0xd892('0x48')](_0x2935bc[_0xd892('0x44')],_0x2935bc[_0xd892('0x45')]);_0x2582bb[_0xd892('0x49')]=_[_0xd892('0x48')](_0x2935bc['model'],qs[_0xd892('0x4a')](_0x12c798[_0xd892('0x45')][_0xd892('0x4a')]));_0x2582bb[_0xd892('0x49')]=_0x2582bb['attributes'][_0xd892('0x4b')]?_0x2582bb[_0xd892('0x49')]:_0x2935bc['model'];if(!_0x12c798[_0xd892('0x45')][_0xd892('0x6b')](_0xd892('0x4c'))){_0x2582bb[_0xd892('0x4d')]=qs[_0xd892('0x4d')](_0x12c798[_0xd892('0x45')]['limit']);_0x2582bb[_0xd892('0x30')]=qs[_0xd892('0x30')](_0x12c798['query'][_0xd892('0x30')]);}_0x2582bb[_0xd892('0x4e')]=qs[_0xd892('0x4f')](_0x12c798[_0xd892('0x45')]['sort']);_0x2582bb[_0xd892('0x52')]=qs['filters'](_[_0xd892('0x50')](_0x12c798[_0xd892('0x45')],_0x2935bc[_0xd892('0x47')]));_0x2582bb[_0xd892('0x52')][_0xd892('0x67')]=_0x267bb2['id'];if(_0x12c798['query'][_0xd892('0x51')]){_0x2582bb['where']=_[_0xd892('0x54')](_0x2582bb[_0xd892('0x52')],{'$or':_['map'](_0x2582bb['attributes'],function(_0x6d88b7){var _0x353e37={};_0x353e37[_0x6d88b7]={'$like':'%'+_0x12c798[_0xd892('0x45')][_0xd892('0x51')]+'%'};return _0x353e37;})});}_0x2582bb=_['merge']({},_0x2582bb,_0x12c798[_0xd892('0x55')]);return db['Disposition'][_0xd892('0x56')]({'where':_0x2582bb[_0xd892('0x52')]})['then'](function(_0x27e9dc){_0x2ae94e['count']=_0x27e9dc;if(_0x12c798[_0xd892('0x45')][_0xd892('0x57')]){_0x2582bb[_0xd892('0x58')]=[{'all':!![]}];}return db[_0xd892('0x68')]['findAll'](_0x2582bb);})[_0xd892('0x34')](function(_0x13b438){_0x2ae94e[_0xd892('0x5a')]=_0x13b438;return _0x2ae94e;});}})[_0xd892('0x34')](respondWithFilteredResult(_0x417a43,_0x2582bb))['catch'](handleError(_0x417a43,null));};exports[_0xd892('0x6c')]=function(_0x38b4b2,_0x1f65f0,_0x5ac75f){return db[_0xd892('0x41')]['find']({'where':{'id':_0x38b4b2[_0xd892('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1f65f0,null))[_0xd892('0x34')](function(_0x461b58){if(_0x461b58){return _0x461b58[_0xd892('0x6c')](_0x38b4b2[_0xd892('0x45')]['ids']);}})[_0xd892('0x34')](respondWithStatusCode(_0x1f65f0,null))[_0xd892('0x2d')](handleError(_0x1f65f0,null));};exports[_0xd892('0x6d')]=function(_0x541079,_0x5f4d9e,_0x5e7f65){if(_0x541079[_0xd892('0x65')]['id']){delete _0x541079['body']['id'];}return db[_0xd892('0x41')][_0xd892('0x5d')]({'where':{'id':_0x541079[_0xd892('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5f4d9e,null))[_0xd892('0x34')](function(_0x43afe2){if(_0x43afe2){_0x541079[_0xd892('0x65')][_0xd892('0x67')]=_0x43afe2['id'];return db[_0xd892('0x6e')]['create'](_0x541079[_0xd892('0x65')]);}})[_0xd892('0x34')](respondWithResult(_0x5f4d9e,null))[_0xd892('0x2d')](handleError(_0x5f4d9e,null));};exports[_0xd892('0x6f')]=function(_0x25197e,_0xa4d17d,_0x50dbdf){var _0x44feae={'raw':![],'where':{}};var _0xd60c40={};var _0x850654={'count':0x0,'rows':[]};return db[_0xd892('0x41')][_0xd892('0x6a')]({'where':{'id':_0x25197e[_0xd892('0x5b')]['id']}})[_0xd892('0x34')](handleEntityNotFound(_0xa4d17d,null))[_0xd892('0x34')](function(_0x367daa){if(_0x367daa){_0xd60c40[_0xd892('0x44')]=_[_0xd892('0x46')](db[_0xd892('0x6e')][_0xd892('0x5c')]);_0xd60c40['query']=_['keys'](_0x25197e['query']);_0xd60c40['filters']=_['intersection'](_0xd60c40[_0xd892('0x44')],_0xd60c40[_0xd892('0x45')]);_0x44feae[_0xd892('0x49')]=_[_0xd892('0x48')](_0xd60c40[_0xd892('0x44')],qs[_0xd892('0x4a')](_0x25197e[_0xd892('0x45')][_0xd892('0x4a')]));_0x44feae['attributes']=_0x44feae[_0xd892('0x49')][_0xd892('0x4b')]?_0x44feae[_0xd892('0x49')]:_0xd60c40[_0xd892('0x44')];if(!_0x25197e[_0xd892('0x45')][_0xd892('0x6b')](_0xd892('0x4c'))){_0x44feae['limit']=qs[_0xd892('0x4d')](_0x25197e[_0xd892('0x45')][_0xd892('0x4d')]);_0x44feae[_0xd892('0x30')]=qs[_0xd892('0x30')](_0x25197e[_0xd892('0x45')][_0xd892('0x30')]);}_0x44feae[_0xd892('0x4e')]=qs[_0xd892('0x4f')](_0x25197e['query'][_0xd892('0x4f')]);_0x44feae[_0xd892('0x52')]=qs['filters'](_['pick'](_0x25197e['query'],_0xd60c40[_0xd892('0x47')]));_0x44feae['where']['FaxAccountId']=_0x367daa['id'];if(_0x25197e[_0xd892('0x45')][_0xd892('0x51')]){_0x44feae[_0xd892('0x52')]=_[_0xd892('0x54')](_0x44feae[_0xd892('0x52')],{'$or':_['map'](_0x44feae['attributes'],function(_0x54a88f){var _0x4fa939={};_0x4fa939[_0x54a88f]={'$like':'%'+_0x25197e[_0xd892('0x45')]['filter']+'%'};return _0x4fa939;})});}_0x44feae=_['merge']({},_0x44feae,_0x25197e['options']);return db[_0xd892('0x6e')][_0xd892('0x56')]({'where':_0x44feae[_0xd892('0x52')]})[_0xd892('0x34')](function(_0x192501){_0x850654[_0xd892('0x56')]=_0x192501;if(_0x25197e[_0xd892('0x45')][_0xd892('0x57')]){_0x44feae[_0xd892('0x58')]=[{'all':!![]}];}return db['CannedAnswer'][_0xd892('0x59')](_0x44feae);})[_0xd892('0x34')](function(_0x2f02da){_0x850654[_0xd892('0x5a')]=_0x2f02da;return _0x850654;});}})['then'](respondWithFilteredResult(_0xa4d17d,_0x44feae))[_0xd892('0x2d')](handleError(_0xa4d17d,null));};exports[_0xd892('0x70')]=function(_0x4c45a1,_0x4026d0,_0x2d99e2){return db['FaxAccount'][_0xd892('0x5d')]({'where':{'id':_0x4c45a1[_0xd892('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4026d0,null))[_0xd892('0x34')](function(_0x2cca7a){if(_0x2cca7a){return _0x2cca7a[_0xd892('0x70')](_0x4c45a1[_0xd892('0x45')]['ids']);}})[_0xd892('0x34')](respondWithStatusCode(_0x4026d0,null))[_0xd892('0x2d')](handleError(_0x4026d0,null));};exports['addInteraction']=function(_0x153430,_0x1b6829,_0x24b324){return db['FaxInteraction']['find']({'where':{'id':_0x153430[_0xd892('0x5b')]['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x1b6829,null))[_0xd892('0x34')](function(_0x1d0c68){if(_0x1d0c68){return _0x1d0c68[_0xd892('0x71')](_0x153430[_0xd892('0x65')][_0xd892('0x72')],_[_0xd892('0x73')](_0x153430['body'],[_0xd892('0x72'),'id'])||{});}})[_0xd892('0x34')](respondWithResult(_0x1b6829,null))[_0xd892('0x2d')](handleError(_0x1b6829,null));};exports[_0xd892('0x74')]=function(_0x54ce47,_0x1755f4,_0x3b92ae){var _0x4c2dc0={'raw':![],'where':{}};var _0x544c39={};var _0x49c1c4={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x54ce47[_0xd892('0x5b')]['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x1755f4,null))[_0xd892('0x34')](function(_0x479ecc){if(_0x479ecc){_0x544c39[_0xd892('0x44')]=_[_0xd892('0x46')](db[_0xd892('0x75')][_0xd892('0x5c')]);_0x544c39[_0xd892('0x45')]=_[_0xd892('0x46')](_0x54ce47['query']);_0x544c39['filters']=_[_0xd892('0x48')](_0x544c39[_0xd892('0x44')],_0x544c39['query']);_0x4c2dc0[_0xd892('0x49')]=_[_0xd892('0x48')](_0x544c39[_0xd892('0x44')],qs[_0xd892('0x4a')](_0x54ce47['query'][_0xd892('0x4a')]));_0x4c2dc0[_0xd892('0x49')]=_0x4c2dc0[_0xd892('0x49')][_0xd892('0x4b')]?_0x4c2dc0[_0xd892('0x49')]:_0x544c39[_0xd892('0x44')];if(!_0x54ce47['query'][_0xd892('0x6b')](_0xd892('0x4c'))){_0x4c2dc0[_0xd892('0x4d')]=qs[_0xd892('0x4d')](_0x54ce47[_0xd892('0x45')][_0xd892('0x4d')]);_0x4c2dc0[_0xd892('0x30')]=qs['offset'](_0x54ce47['query']['offset']);}_0x4c2dc0[_0xd892('0x4e')]=qs[_0xd892('0x4f')](_0x54ce47[_0xd892('0x45')][_0xd892('0x4f')]);_0x4c2dc0['where']=qs['filters'](_[_0xd892('0x50')](_0x54ce47['query'],_0x544c39[_0xd892('0x47')]));_0x4c2dc0[_0xd892('0x52')][_0xd892('0x67')]=_0x479ecc['id'];if(_0x54ce47[_0xd892('0x45')]['filter']){_0x4c2dc0['where']=_[_0xd892('0x54')](_0x4c2dc0[_0xd892('0x52')],{'$or':_['map'](_0x4c2dc0['attributes'],function(_0x2e7128){var _0x4defa1={};_0x4defa1[_0x2e7128]={'$like':'%'+_0x54ce47[_0xd892('0x45')][_0xd892('0x51')]+'%'};return _0x4defa1;})});}_0x4c2dc0=_[_0xd892('0x54')]({},_0x4c2dc0,_0x54ce47['options']);return db['FaxInteraction'][_0xd892('0x56')]({'where':_0x4c2dc0[_0xd892('0x52')]})[_0xd892('0x34')](function(_0x2cef9f){_0x49c1c4['count']=_0x2cef9f;if(_0x54ce47['query'][_0xd892('0x57')]){_0x4c2dc0['include']=[{'model':db['CmContact'],'as':_0xd892('0x76'),'required':![]},{'model':db[_0xd892('0x77')],'as':'Owner','attributes':[_0xd892('0x3b'),'fullname',_0xd892('0x78')],'required':![]},{'model':db[_0xd892('0x79')],'as':_0xd892('0x7a'),'attributes':['id',_0xd892('0x3b'),'color'],'where':_0x54ce47[_0xd892('0x45')][_0xd892('0x7b')]?{'id':_0x54ce47[_0xd892('0x45')][_0xd892('0x7b')]}:undefined,'required':_0x54ce47[_0xd892('0x45')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0xd892('0x59')](_0x4c2dc0);})[_0xd892('0x34')](function(_0x3da97f){_0x49c1c4[_0xd892('0x5a')]=_0x3da97f;return _0x49c1c4;});}})[_0xd892('0x34')](respondWithFilteredResult(_0x1755f4,_0x4c2dc0))['catch'](handleError(_0x1755f4,null));};exports[_0xd892('0x7c')]=function(_0x5d732a,_0x507a88,_0x17c5de){return db[_0xd892('0x41')][_0xd892('0x6a')]({'where':{'id':_0x5d732a['params']['id']}})['then'](handleEntityNotFound(_0x507a88,null))[_0xd892('0x34')](function(_0x2b057d){if(_0x2b057d){return db[_0xd892('0x7d')][_0xd892('0x7e')](function(_0x4a17c9){return db[_0xd892('0x7f')][_0xd892('0x35')]({'where':{'FaxAccountId':_0x5d732a[_0xd892('0x5b')]['id']},'transaction':_0x4a17c9})[_0xd892('0x34')](function(_0xcd9bf8){var _0x482dcd=_[_0xd892('0x40')](_0x5d732a[_0xd892('0x65')],function(_0x4968ea){_0x4968ea[_0xd892('0x67')]=_0x5d732a['params']['id'];return _0x4968ea;});return db[_0xd892('0x7f')][_0xd892('0x80')](_0x482dcd,{'transaction':_0x4a17c9});});})[_0xd892('0x34')](function(){return db[_0xd892('0x7f')][_0xd892('0x81')]({'where':{'FaxAccountId':_0x5d732a[_0xd892('0x5b')]['id']},'order':_0xd892('0x82')});});}})['then'](respondWithResult(_0x507a88,null))[_0xd892('0x2d')](handleError(_0x507a88,null));};exports['getApplications']=function(_0x53c2c1,_0x1dee4e,_0x4770c8){var _0x32673c={};var _0x2ffc34={};var _0x5f1b59;var _0x302450;return db[_0xd892('0x41')][_0xd892('0x6a')]({'where':{'id':_0x53c2c1[_0xd892('0x5b')]['id']}})['then'](handleEntityNotFound(_0x1dee4e,null))[_0xd892('0x34')](function(_0x1c2945){if(_0x1c2945){_0x5f1b59=_0x1c2945;_0x2ffc34['model']=_['keys'](db[_0xd892('0x7f')]['rawAttributes']);_0x2ffc34[_0xd892('0x45')]=_[_0xd892('0x46')](_0x53c2c1[_0xd892('0x45')]);_0x2ffc34[_0xd892('0x47')]=_['intersection'](_0x2ffc34[_0xd892('0x44')],_0x2ffc34[_0xd892('0x45')]);_0x32673c['attributes']=_[_0xd892('0x48')](_0x2ffc34['model'],qs[_0xd892('0x4a')](_0x53c2c1['query']['fields']));_0x32673c[_0xd892('0x49')]=_0x32673c[_0xd892('0x49')]['length']?_0x32673c[_0xd892('0x49')]:_0x2ffc34[_0xd892('0x44')];_0x32673c['order']=qs['sort'](_0x53c2c1['query'][_0xd892('0x4f')]);_0x32673c[_0xd892('0x52')]=qs[_0xd892('0x47')](_['pick'](_0x53c2c1[_0xd892('0x45')],_0x2ffc34[_0xd892('0x47')]));if(_0x53c2c1[_0xd892('0x45')][_0xd892('0x51')]){_0x32673c[_0xd892('0x52')]=_[_0xd892('0x54')](_0x32673c[_0xd892('0x52')],{'$or':_[_0xd892('0x40')](_0x32673c[_0xd892('0x49')],function(_0x279377){var _0x28f4a9={};_0x28f4a9[_0x279377]={'$like':'%'+_0x53c2c1[_0xd892('0x45')][_0xd892('0x51')]+'%'};return _0x28f4a9;})});}_0x32673c=_['merge']({},_0x32673c,_0x53c2c1[_0xd892('0x55')]);return _0x5f1b59[_0xd892('0x83')](_0x32673c);}})[_0xd892('0x34')](function(_0x3516b7){if(_0x3516b7){_0x302450=_0x3516b7[_0xd892('0x4b')];if(!_0x53c2c1[_0xd892('0x45')][_0xd892('0x6b')](_0xd892('0x4c'))){_0x32673c['limit']=qs[_0xd892('0x4d')](_0x53c2c1['query'][_0xd892('0x4d')]);_0x32673c[_0xd892('0x30')]=qs[_0xd892('0x30')](_0x53c2c1[_0xd892('0x45')][_0xd892('0x30')]);}return _0x5f1b59[_0xd892('0x83')](_0x32673c);}})[_0xd892('0x34')](function(_0x4a95cf){if(_0x4a95cf){return _0x4a95cf?{'count':_0x302450,'rows':_0x4a95cf}:null;}})[_0xd892('0x34')](respondWithResult(_0x1dee4e,null))[_0xd892('0x2d')](handleError(_0x1dee4e,null));};function Extension(_0x4508c9,_0x363043,_0x2265e2,_0x287514){this[_0xd892('0x84')]=_0xd892('0x85');this[_0xd892('0x86')]=_0x4508c9[_0xd892('0x87')];this[_0xd892('0x88')]=_0x287514;this[_0xd892('0x43')]=_0xd892('0x89');this[_0xd892('0x8a')]='Fax\x20Extension';this[_0xd892('0x67')]=_0x4508c9['id'];this[_0xd892('0x82')]=_0x363043;this[_0xd892('0x8b')]=_0x2265e2;}function createExtensionsReciveFax(_0x173641){var _0x3007e7=0x1;var _0x26215e=[];_0x26215e[_0xd892('0x8c')](new Extension(_0x173641,_0x3007e7,'',_0xd892('0x8d')));_0x3007e7+=0x1;_0x26215e['push'](new Extension(_0x173641,_0x3007e7,'CDR(type)=inbound-fax',_0xd892('0x8e')));_0x3007e7+=0x1;for(var _0x50ffe8 in _0x173641){if(_0x173641['hasOwnProperty'](_0x50ffe8)&&(_0x50ffe8===_0xd892('0x8f')||_0x50ffe8==='localstationid'||_0x50ffe8===_0xd892('0x90')||_0x50ffe8===_0xd892('0x91')||_0x50ffe8==='headerinfo'||_0x50ffe8===_0xd892('0x92')||_0x50ffe8===_0xd892('0x93')||_0x50ffe8==='modem'||_0x50ffe8===_0xd892('0x94'))){_0x26215e[_0xd892('0x8c')](new Extension(_0x173641,_0x3007e7,_0xd892('0x95')+_0x50ffe8+')='+_0x173641[_0x50ffe8],_0xd892('0x8e')));_0x3007e7+=0x1;}}_0x26215e[_0xd892('0x8c')](new Extension(_0x173641,_0x3007e7,'6',_0xd892('0x96')));_0x3007e7+=0x1;_0x26215e[_0xd892('0x8c')](new Extension(_0x173641,_0x3007e7,_0xd892('0x97'),'ReceiveFax'));_0x3007e7=0x0;return _0x26215e;}exports[_0xd892('0x98')]=function(_0x1581e3,_0x18edbd,_0xbb78fb){var _0x559141;return db[_0xd892('0x7d')][_0xd892('0x7e')](function(_0x2d6570){return db[_0xd892('0x41')][_0xd892('0x5e')](_0x1581e3[_0xd892('0x65')],{'transaction':_0x2d6570})[_0xd892('0x34')](function(_0xfba323){_0x559141=_0xfba323[_0xd892('0x36')]({'plain':!![]});return db[_0xd892('0x99')][_0xd892('0x80')](createExtensionsReciveFax(_0x559141),{'transaction':_0x2d6570});});})[_0xd892('0x34')](function(){return _0x559141;})[_0xd892('0x34')](respondWithResult(_0x18edbd,null))['catch'](handleError(_0x18edbd,null));};exports[_0xd892('0x9a')]=function(_0x352ef2,_0x2f0a7c,_0x426041){var _0x3b1395;return db[_0xd892('0x7d')][_0xd892('0x7e')](function(_0x4ae62d){return db['FaxAccount'][_0xd892('0x64')](_0x352ef2[_0xd892('0x65')],{'where':{'id':_0x352ef2[_0xd892('0x65')]['id']},'transaction':_0x4ae62d})[_0xd892('0x34')](function(_0x158f53){return db['VoiceExtension'][_0xd892('0x35')]({'where':{'FaxAccountId':_0x352ef2[_0xd892('0x65')]['id']},'transaction':_0x4ae62d})[_0xd892('0x34')](function(_0x1e3461){return db[_0xd892('0x99')][_0xd892('0x80')](createExtensionsReciveFax(_['omit'](_0x352ef2[_0xd892('0x65')],[_0xd892('0x9b'),_0xd892('0x9c'),'createdAt','updatedAt',_0xd892('0x9d'),_0xd892('0x9e')])),{'transaction':_0x4ae62d});});});})[_0xd892('0x34')](function(){return db[_0xd892('0x41')][_0xd892('0x9f')](_0x352ef2['body']['id']);})[_0xd892('0x34')](respondWithResult(_0x2f0a7c,null))['catch'](handleError(_0x2f0a7c,null));};exports[_0xd892('0xa0')]=function(_0x1b0f63,_0x177def,_0x5762e9){var _0x3c5bcf={'raw':!![],'where':{}};var _0x568d98={};var _0x26b87f={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd892('0x6a')]({'where':{'id':_0x1b0f63['params']['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x177def,null))[_0xd892('0x34')](function(_0x304fa1){if(_0x304fa1){_0x568d98['model']=_['keys'](db['FaxMessage']['rawAttributes']);_0x568d98[_0xd892('0x45')]=_[_0xd892('0x46')](_0x1b0f63[_0xd892('0x45')]);_0x568d98[_0xd892('0x47')]=_[_0xd892('0x48')](_0x568d98['model'],_0x568d98[_0xd892('0x45')]);_0x3c5bcf[_0xd892('0x49')]=_['intersection'](_0x568d98['model'],qs[_0xd892('0x4a')](_0x1b0f63['query'][_0xd892('0x4a')]));_0x3c5bcf[_0xd892('0x49')]=_0x3c5bcf[_0xd892('0x49')][_0xd892('0x4b')]?_0x3c5bcf['attributes']:_0x568d98['model'];if(!_0x1b0f63['query']['hasOwnProperty'](_0xd892('0x4c'))){_0x3c5bcf['limit']=qs[_0xd892('0x4d')](_0x1b0f63['query'][_0xd892('0x4d')]);_0x3c5bcf[_0xd892('0x30')]=qs[_0xd892('0x30')](_0x1b0f63[_0xd892('0x45')]['offset']);}_0x3c5bcf['order']=qs[_0xd892('0x4f')](_0x1b0f63[_0xd892('0x45')]['sort']);_0x3c5bcf[_0xd892('0x52')]=qs['filters'](_[_0xd892('0x50')](_0x1b0f63[_0xd892('0x45')],_0x568d98[_0xd892('0x47')]));_0x3c5bcf[_0xd892('0x52')]['FaxAccountId']=_0x304fa1['id'];if(_0x1b0f63[_0xd892('0x45')][_0xd892('0x51')]){_0x3c5bcf['where']=_['merge'](_0x3c5bcf[_0xd892('0x52')],{'$or':_[_0xd892('0x40')](_0x3c5bcf['attributes'],function(_0x5ad822){var _0x378711={};_0x378711[_0x5ad822]={'$like':'%'+_0x1b0f63[_0xd892('0x45')][_0xd892('0x51')]+'%'};return _0x378711;})});}if(_0x1b0f63[_0xd892('0x45')][_0xd892('0xa1')]){var _0x31a646=_0x1b0f63[_0xd892('0x45')][_0xd892('0xa1')][_0xd892('0xa2')](',');var _0x46ee78={};_0x46ee78[_0x31a646[0x0]]={'$gte':moment(_0x31a646[0x1])[_0xd892('0xa3')](_0xd892('0xa4'))};_0x3c5bcf['where']=_[_0xd892('0x54')](_0x3c5bcf[_0xd892('0x52')],_0x46ee78);}_0x3c5bcf=_[_0xd892('0x54')]({},_0x3c5bcf,_0x1b0f63[_0xd892('0x55')]);return db['FaxMessage'][_0xd892('0x56')]({'where':_0x3c5bcf[_0xd892('0x52')]})[_0xd892('0x34')](function(_0x488b77){_0x26b87f['count']=_0x488b77;if(_0x1b0f63['query']['includeAll']){_0x3c5bcf[_0xd892('0x58')]=[{'all':!![]}];}return db[_0xd892('0xa5')][_0xd892('0x59')](_0x3c5bcf);})['then'](function(_0x2d33e7){_0x26b87f['rows']=_0x2d33e7;return _0x26b87f;});}})[_0xd892('0x34')](respondWithFilteredResult(_0x177def,_0x3c5bcf))['catch'](handleError(_0x177def,null));};exports[_0xd892('0x3c')]=function(_0x404c7c,_0x5f4c3e,_0x17a16e){var _0x211349,_0x943ea0={},_0x13c007;if(_0x404c7c[_0xd892('0x65')]['to']){_0x13c007=_0x404c7c[_0xd892('0x65')]['to'][0x0];}return db[_0xd892('0x41')][_0xd892('0x5d')]({'where':{'id':_0x404c7c[_0xd892('0x5b')]['id']},'include':[{'model':db[_0xd892('0xa6')],'as':_0xd892('0xa7'),'include':[{'model':db['CmContact'],'as':_0xd892('0xa8'),'where':{'fax':_0x13c007},'limit':0x1,'order':[[_0xd892('0xa9'),'DESC']]}]}]})[_0xd892('0x34')](handleEntityNotFound(_0x5f4c3e,null))[_0xd892('0x34')](function(_0xbfef3b){_0x211349=_0xbfef3b;if(_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')]&&_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][_0xd892('0x4b')]){for(var _0x340c16=0x0;_0x340c16<_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][_0xd892('0x4b')];_0x340c16+=0x1){_0x404c7c[_0xd892('0x65')]['attachments'][_0x340c16]={'filename':_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][_0x340c16][_0xd892('0x3b')],'id':_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][_0x340c16]['id'],'path':path['join'](config[_0xd892('0xab')],_0xd892('0xac'),_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][_0x340c16][_0xd892('0xad')])};}}return respondWithRpcPromise(_0xd892('0xae'),'CheckAfterSend',{'FaxAccountId':_['isNil'](_0x404c7c['params']['id'])?undefined:_0x404c7c['params']['id'],'path':_[_0xd892('0xaf')](_0x404c7c['body'][_0xd892('0xaa')][0x0][_0xd892('0x7')])?undefined:_0x404c7c['body'][_0xd892('0xaa')][0x0][_0xd892('0x7')],'fax':_['isNil'](_0x404c7c[_0xd892('0x65')]['to'][0x0])?undefined:_0x404c7c[_0xd892('0x65')]['to'][0x0]},client9002);})[_0xd892('0x34')](function(){if(_0x211349){if(_[_0xd892('0xaf')](_0x404c7c[_0xd892('0x65')][_0xd892('0xb0')])){_0x404c7c[_0xd892('0x65')][_0xd892('0xb0')]=util[_0xd892('0xa3')](_0xd892('0xb1'),_0x211349[_0xd892('0x3b')],_0x211349[_0xd892('0xb2')]);}if(_0x211349[_0xd892('0xa7')]){if(_0x211349[_0xd892('0xa7')][_0xd892('0xa8')][_0xd892('0x4b')]){return _0x211349[_0xd892('0xa7')]['Contacts'][0x0];}else{return db[_0xd892('0xb3')][_0xd892('0x5e')](_['defaults'](_0x404c7c['body'],{'firstName':_0x404c7c['body']['to'][0x0],'phone':_0x404c7c[_0xd892('0x65')]['to'][0x0],'fax':_0x404c7c[_0xd892('0x65')]['to'][0x0],'ListId':_0x211349['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xd892('0xb4'));}})[_0xd892('0x34')](function(_0x28f101){if(_0x28f101){return db[_0xd892('0x75')]['find']({'where':{'ContactId':_0x28f101['id'],'closed':![],'FaxAccountId':_0x211349['id']}})[_0xd892('0x34')](function(_0x217d25){if(_0x217d25){return[_0x217d25,![]];}return db[_0xd892('0x75')]['create']({'UserId':_0x404c7c[_0xd892('0xb5')]['id'],'ContactId':_0x28f101['id'],'FaxAccountId':_0x211349['id'],'fax':_0x404c7c['body']['to'][0x0],'firstMsgDirection':_0xd892('0xb6'),'Messages':[_[_0xd892('0x54')](_0x404c7c[_0xd892('0x65')],{'read':![],'body':_0x404c7c['body'][_0xd892('0xaa')][0x0][_0xd892('0xb7')],'FaxAccountId':_0x211349['id'],'UserId':_0x404c7c[_0xd892('0xb5')]['id'],'ContactId':_0x28f101['id'],'AttachmentId':_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0xd892('0xa5')],'as':_0xd892('0xb8')}]})['then'](function(_0xe8ab55){return[_0xe8ab55,!![]];});});}else{throw new Error(_0xd892('0xb9'));}})['spread'](function(_0x29b1f6,_0x5adcbd){if(_0x5adcbd){return _0x29b1f6;}return db['FaxMessage']['create']({'direction':_0xd892('0xb6'),'read':![],'body':_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][0x0][_0xd892('0xb7')],'FaxAccountId':_0x211349['id'],'FaxInteractionId':_0x29b1f6['id'],'UserId':_0x404c7c[_0xd892('0xb5')]['id'],'ContactId':_0x29b1f6[_0xd892('0xba')],'AttachmentId':_0x404c7c[_0xd892('0x65')]['attachments'][0x0]['id']})[_0xd892('0x34')](function(_0xaecc7a){_0x29b1f6['dataValues'][_0xd892('0xb8')]=[];_0x29b1f6[_0xd892('0xbb')]['Messages']['push'](_0xaecc7a[_0xd892('0xbb')]);return _0x29b1f6;});})['then'](function(_0x305d25){respondWithRpcPromise(_0xd892('0xbc'),_0xd892('0xbc'),{'FaxAccountId':_[_0xd892('0xaf')](_0x404c7c['params']['id'])?undefined:_0x404c7c['params']['id'],'path':_[_0xd892('0xaf')](_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][0x0][_0xd892('0x7')])?undefined:_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][0x0]['path'],'fax':_[_0xd892('0xaf')](_0x404c7c[_0xd892('0x65')]['to'][0x0])?undefined:_0x404c7c['body']['to'][0x0],'AttachmentId':_0x404c7c[_0xd892('0x65')][_0xd892('0xaa')][0x0]['id']},client9002)['then'](function(_0x628b53){logger[_0xd892('0x25')](_0xd892('0xbd'),_0x628b53);})[_0xd892('0x2d')](function(_0xa9410e){logger[_0xd892('0x25')]('SendFaxRpc,\x20%s',_0xa9410e);});return _0x305d25;})['then'](respondWithResult(_0x5f4c3e,null))['catch'](handleError(_0x5f4c3e,null));};exports[_0xd892('0xbe')]=function(_0x16e43d,_0x54af6c,_0x1fb98b){return db[_0xd892('0x41')]['find']({'where':{'id':_0x16e43d[_0xd892('0x5b')]['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x54af6c,null))[_0xd892('0x34')](function(_0x328701){if(_0x328701){return _0x328701[_0xd892('0xbe')](_0x16e43d[_0xd892('0x65')][_0xd892('0x72')],_[_0xd892('0x73')](_0x16e43d['body'],[_0xd892('0x72'),'id'])||{})['spread'](function(_0x2871a2){for(var _0x14ad1e=0x0;_0x14ad1e<_0x16e43d[_0xd892('0x65')][_0xd892('0x72')]['length'];_0x14ad1e+=0x1){socket[_0xd892('0xbf')]('userFaxAccount:save',{'UserId':_0x16e43d['body'][_0xd892('0x72')][_0x14ad1e],'FaxAccountId':_0x16e43d['params']['id']});}return _0x2871a2;});}})['then'](respondWithResult(_0x54af6c,null))[_0xd892('0x2d')](handleError(_0x54af6c,null));};exports['removeAgents']=function(_0x3bf713,_0x42dfac,_0x15f8a7){return db[_0xd892('0x41')][_0xd892('0x5d')]({'where':{'id':_0x3bf713['params']['id']}})[_0xd892('0x34')](handleEntityNotFound(_0x42dfac,null))[_0xd892('0x34')](function(_0x17a094){if(_0x17a094){return _0x17a094[_0xd892('0xc0')](_0x3bf713[_0xd892('0x45')][_0xd892('0x72')])[_0xd892('0x34')](function(){if(_[_0xd892('0xc1')](_0x3bf713[_0xd892('0x45')]['ids'])){for(var _0x5e4c81=0x0;_0x5e4c81<_0x3bf713[_0xd892('0x45')]['ids'][_0xd892('0x4b')];_0x5e4c81+=0x1){socket[_0xd892('0xbf')](_0xd892('0xc2'),{'UserId':Number(_0x3bf713[_0xd892('0x45')][_0xd892('0x72')][_0x5e4c81]),'FaxAccountId':Number(_0x3bf713[_0xd892('0x5b')]['id'])});}}else{socket[_0xd892('0xbf')](_0xd892('0xc2'),{'UserId':Number(_0x3bf713[_0xd892('0x45')][_0xd892('0x72')]),'FaxAccountId':Number(_0x3bf713[_0xd892('0x5b')]['id'])});}});}})[_0xd892('0x34')](respondWithStatusCode(_0x42dfac,null))[_0xd892('0x2d')](handleError(_0x42dfac,null));};exports['getAgents']=function(_0x538a48,_0x6be97d,_0x924a89){var _0x4155a3={};var _0x29a851={};var _0x816e90;var _0x245925;return db[_0xd892('0x41')]['findOne']({'where':{'id':_0x538a48[_0xd892('0x5b')]['id']}})['then'](handleEntityNotFound(_0x6be97d,null))[_0xd892('0x34')](function(_0x2d0e64){if(_0x2d0e64){_0x816e90=_0x2d0e64;_0x29a851[_0xd892('0x44')]=_[_0xd892('0x46')](db[_0xd892('0x77')][_0xd892('0x5c')]);_0x29a851[_0xd892('0x45')]=_['keys'](_0x538a48[_0xd892('0x45')]);_0x29a851[_0xd892('0x47')]=_[_0xd892('0x48')](_0x29a851[_0xd892('0x44')],_0x29a851[_0xd892('0x45')]);_0x4155a3[_0xd892('0x49')]=_[_0xd892('0x48')](_0x29a851[_0xd892('0x44')],qs[_0xd892('0x4a')](_0x538a48[_0xd892('0x45')]['fields']));_0x4155a3[_0xd892('0x49')]=_0x4155a3[_0xd892('0x49')][_0xd892('0x4b')]?_0x4155a3[_0xd892('0x49')]:_0x29a851[_0xd892('0x44')];_0x4155a3[_0xd892('0x4e')]=qs['sort'](_0x538a48[_0xd892('0x45')][_0xd892('0x4f')]);_0x4155a3[_0xd892('0x52')]=qs['filters'](_[_0xd892('0x50')](_0x538a48[_0xd892('0x45')],_0x29a851[_0xd892('0x47')]));if(_0x538a48['query'][_0xd892('0x51')]){_0x4155a3['where']=_['merge'](_0x4155a3['where'],{'$or':_[_0xd892('0x40')](_0x4155a3[_0xd892('0x49')],function(_0xc0d511){var _0xfdfd36={};_0xfdfd36[_0xc0d511]={'$like':'%'+_0x538a48[_0xd892('0x45')]['filter']+'%'};return _0xfdfd36;})});}_0x4155a3=_[_0xd892('0x54')]({},_0x4155a3,_0x538a48['options']);return _0x816e90[_0xd892('0xc3')](_0x4155a3);}})[_0xd892('0x34')](function(_0x241119){if(_0x241119){_0x245925=_0x241119[_0xd892('0x4b')];if(!_0x538a48['query'][_0xd892('0x6b')](_0xd892('0x4c'))){_0x4155a3['limit']=qs[_0xd892('0x4d')](_0x538a48['query']['limit']);_0x4155a3[_0xd892('0x30')]=qs[_0xd892('0x30')](_0x538a48[_0xd892('0x45')][_0xd892('0x30')]);}return _0x816e90[_0xd892('0xc3')](_0x4155a3);}})[_0xd892('0x34')](function(_0x165bf8){if(_0x165bf8){return _0x165bf8?{'count':_0x245925,'rows':_0x165bf8}:null;}})[_0xd892('0x34')](respondWithResult(_0x6be97d,null))[_0xd892('0x2d')](handleError(_0x6be97d,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 6a1c3da..a26f550 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 _0x4815=['remove','emit','hasOwnProperty','exports','events','FaxAccount','setMaxListeners','save','update'];(function(_0x3a3c81,_0x253ca1){var _0x53acaf=function(_0x585113){while(--_0x585113){_0x3a3c81['push'](_0x3a3c81['shift']());}};_0x53acaf(++_0x253ca1);}(_0x4815,0xe5));var _0x5481=function(_0xea9870,_0x3e09c1){_0xea9870=_0xea9870-0x0;var _0x473f14=_0x4815[_0xea9870];return _0x473f14;};'use strict';var EventEmitter=require(_0x5481('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x5481('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x5481('0x2')](0x0);var events={'afterCreate':_0x5481('0x3'),'afterUpdate':_0x5481('0x4'),'afterDestroy':_0x5481('0x5')};function emitEvent(_0x25b3b7){return function(_0x2d40b1,_0xa4292b,_0x13c515){FaxAccountEvents[_0x5481('0x6')](_0x25b3b7+':'+_0x2d40b1['id'],_0x2d40b1);FaxAccountEvents['emit'](_0x25b3b7,_0x2d40b1);_0x13c515(null);};}for(var e in events){if(events[_0x5481('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x5481('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x4d32=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2dc794,_0x4d2724){var _0x55a6a1=function(_0x3f99ff){while(--_0x3f99ff){_0x2dc794['push'](_0x2dc794['shift']());}};_0x55a6a1(++_0x4d2724);}(_0x4d32,0xe4));var _0x24d3=function(_0x3ad451,_0x204dc2){_0x3ad451=_0x3ad451-0x0;var _0x178759=_0x4d32[_0x3ad451];return _0x178759;};'use strict';var EventEmitter=require(_0x24d3('0x0'));var FaxAccount=require(_0x24d3('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x24d3('0x2')](0x0);var events={'afterCreate':_0x24d3('0x3'),'afterUpdate':_0x24d3('0x4'),'afterDestroy':_0x24d3('0x5')};function emitEvent(_0xf44f07){return function(_0x5df3a0,_0x120c79,_0x24b1f7){FaxAccountEvents[_0x24d3('0x6')](_0xf44f07+':'+_0x5df3a0['id'],_0x5df3a0);FaxAccountEvents[_0x24d3('0x6')](_0xf44f07,_0x5df3a0);_0x24b1f7(null);};}for(var e in events){if(events[_0x24d3('0x7')](e)){var event=events[e];FaxAccount[_0x24d3('0x8')](e,emitEvent(event));}}module[_0x24d3('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index b342681..3562870 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 _0x448d=['request-promise','path','rimraf','../../config/environment','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','bluebird'];(function(_0x571b15,_0x2ef730){var _0x26a18a=function(_0x5e2ef6){while(--_0x5e2ef6){_0x571b15['push'](_0x571b15['shift']());}};_0x26a18a(++_0x2ef730);}(_0x448d,0xaf));var _0xd448=function(_0x11a23e,_0x388dcf){_0x11a23e=_0x11a23e-0x0;var _0x5300dc=_0x448d[_0x11a23e];return _0x5300dc;};'use strict';var _=require(_0xd448('0x0'));var util=require(_0xd448('0x1'));var logger=require(_0xd448('0x2'))(_0xd448('0x3'));var moment=require('moment');var BPromise=require(_0xd448('0x4'));var rp=require(_0xd448('0x5'));var fs=require('fs');var path=require(_0xd448('0x6'));var rimraf=require(_0xd448('0x7'));var config=require(_0xd448('0x8'));var attributes=require('./faxAccount.attributes');module['exports']=function(_0x4c40ae,_0x1164ac){return _0x4c40ae[_0xd448('0x9')](_0xd448('0xa'),attributes,{'tableName':_0xd448('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x117f=['./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x20d36b,_0x29d90e){var _0x49f086=function(_0x18b442){while(--_0x18b442){_0x20d36b['push'](_0x20d36b['shift']());}};_0x49f086(++_0x29d90e);}(_0x117f,0x1f2));var _0xf117=function(_0x293829,_0x131414){_0x293829=_0x293829-0x0;var _0x171291=_0x117f[_0x293829];return _0x171291;};'use strict';var _=require(_0xf117('0x0'));var util=require(_0xf117('0x1'));var logger=require(_0xf117('0x2'))(_0xf117('0x3'));var moment=require(_0xf117('0x4'));var BPromise=require(_0xf117('0x5'));var rp=require(_0xf117('0x6'));var fs=require('fs');var path=require(_0xf117('0x7'));var rimraf=require('rimraf');var config=require(_0xf117('0x8'));var attributes=require(_0xf117('0x9'));module['exports']=function(_0x52b7e8,_0x3bb76a){return _0x52b7e8[_0xf117('0xa')](_0xf117('0xb'),attributes,{'tableName':_0xf117('0xc'),'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 85f07f0..e523ef3 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 _0xdbbd=['list','orderBy','priority','asc','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','get','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','name','*,*,*,*','startRouting','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetFaxAccount','findAll','options','where','attributes','model','include','debug','NotifyFaxAccount','body','fax','CmContact','describe','difference','createdAt','updatedAt','keys','Sequelize','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','FaxAccount','account','CmList','List','Contacts','DESC','Applications','applications'];(function(_0x463f6f,_0x19b8f6){var _0x5c908d=function(_0x35c275){while(--_0x35c275){_0x463f6f['push'](_0x463f6f['shift']());}};_0x5c908d(++_0x19b8f6);}(_0xdbbd,0x1bc));var _0xddbb=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xdbbd[_0x40bffc];return _0x3007e9;};'use strict';var _=require('lodash');var util=require(_0xddbb('0x0'));var moment=require(_0xddbb('0x1'));var BPromise=require(_0xddbb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddbb('0x3'));var db=require(_0xddbb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xddbb('0x5'))(_0xddbb('0x6'));var config=require(_0xddbb('0x7'));var jayson=require(_0xddbb('0x8'));var client=jayson[_0xddbb('0x9')][_0xddbb('0xa')]({'port':0x232c});config[_0xddbb('0xb')]=_[_0xddbb('0xc')](config[_0xddbb('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xddbb('0xd'))(new Redis(config[_0xddbb('0xb')]));require('./faxAccount.socket')[_0xddbb('0xe')](socket);function respondWithRpcPromise(_0xa1063c,_0x1bb728,_0x398a75){return new BPromise(function(_0xc67008,_0x7c7f70){return client[_0xddbb('0xf')](_0xa1063c,_0x398a75)[_0xddbb('0x10')](function(_0x4ec365){logger['info'](_0xddbb('0x11'),_0x1bb728,_0xddbb('0x12'));logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1bb728,'request\x20sent',JSON[_0xddbb('0x13')](_0x4ec365));if(_0x4ec365[_0xddbb('0x14')]){if(_0x4ec365[_0xddbb('0x14')][_0xddbb('0x15')]===0x1f4){logger[_0xddbb('0x14')](_0xddbb('0x11'),_0x1bb728,_0x4ec365['error']['message']);return _0x7c7f70(_0x4ec365[_0xddbb('0x14')][_0xddbb('0x16')]);}logger[_0xddbb('0x14')]('FaxAccount,\x20%s,\x20%s',_0x1bb728,_0x4ec365['error'][_0xddbb('0x16')]);return _0xc67008(_0x4ec365[_0xddbb('0x14')][_0xddbb('0x16')]);}else{logger[_0xddbb('0x17')](_0xddbb('0x11'),_0x1bb728,'request\x20sent');_0xc67008(_0x4ec365['result']['message']);}})[_0xddbb('0x18')](function(_0xa4b5f){logger['error']('FaxAccount,\x20%s,\x20%s',_0x1bb728,_0xa4b5f);_0x7c7f70(_0xa4b5f);});});}exports[_0xddbb('0x19')]=function(_0x57b841){var _0x1d5104=this;return new Promise(function(_0x34bc41,_0x15698a){return db['FaxAccount'][_0xddbb('0x1a')]({'raw':_0x57b841[_0xddbb('0x1b')]?_0x57b841[_0xddbb('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x57b841[_0xddbb('0x1b')]?_0x57b841['options'][_0xddbb('0x1c')]||null:null,'attributes':_0x57b841[_0xddbb('0x1b')]?_0x57b841[_0xddbb('0x1b')][_0xddbb('0x1d')]||null:null,'limit':_0x57b841[_0xddbb('0x1b')]?_0x57b841[_0xddbb('0x1b')]['limit']||null:null,'include':_0x57b841[_0xddbb('0x1b')]?_0x57b841[_0xddbb('0x1b')]['include']?_['map'](_0x57b841['options']['include'],function(_0x51067d){return{'model':db[_0x51067d[_0xddbb('0x1e')]],'as':_0x51067d['as'],'attributes':_0x51067d[_0xddbb('0x1d')],'include':_0x51067d[_0xddbb('0x1f')]?_['map'](_0x51067d[_0xddbb('0x1f')],function(_0x2c8a33){return{'model':db[_0x2c8a33[_0xddbb('0x1e')]],'as':_0x2c8a33['as'],'attributes':_0x2c8a33[_0xddbb('0x1d')],'include':_0x2c8a33['include']?_['map'](_0x2c8a33[_0xddbb('0x1f')],function(_0x47d0f2){return{'model':db[_0x47d0f2['model']],'as':_0x47d0f2['as'],'attributes':_0x47d0f2[_0xddbb('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xddbb('0x10')](function(_0x31ab8e){logger[_0xddbb('0x17')]('GetFaxAccount',_0x57b841);logger[_0xddbb('0x20')](_0xddbb('0x19'),_0x57b841,JSON[_0xddbb('0x13')](_0x31ab8e));_0x34bc41(_0x31ab8e);})[_0xddbb('0x18')](function(_0x4f61ee){logger[_0xddbb('0x14')](_0xddbb('0x19'),_0x4f61ee['message'],_0x57b841);_0x15698a(_0x1d5104['error'](0x1f4,_0x4f61ee['message']));});});};exports[_0xddbb('0x21')]=function(_0x18bba4,_0x34f487,_0x1c6bff){var _0x194a8f=this;return new Promise(function(_0x30f933,_0x15a8dd){var _0xb2cbee={'body':_0x18bba4[_0xddbb('0x22')],'channel':_0xddbb('0x23')};var _0x3a331c=[];var _0x5ebd5d=[];var _0x221851={};return db[_0xddbb('0x24')][_0xddbb('0x25')]()['then'](function(_0x1c2bd4){if(!_0x1c2bd4){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x3a331c=_[_0xddbb('0x26')](_['keys'](_0x1c2bd4),[_0xddbb('0x27'),_0xddbb('0x28')]);_0x5ebd5d=_[_0xddbb('0x26')](_[_0xddbb('0x29')](_0x1c2bd4),['createdAt','updatedAt','CompanyId','ListId']);if(_0x18bba4[_0xddbb('0x22')]['id']){delete _0x18bba4['body']['id'];}if(_['isNil'](_0x18bba4[_0xddbb('0x22')]['from'])){throw new db[(_0xddbb('0x2a'))][(_0xddbb('0x2b'))](_0xddbb('0x2c'));}if(_[_0xddbb('0x2d')](_0x18bba4[_0xddbb('0x22')][_0xddbb('0x22')])||_0x18bba4[_0xddbb('0x22')][_0xddbb('0x22')]===''){throw new db[(_0xddbb('0x2a'))][(_0xddbb('0x2b'))](_0xddbb('0x2e'));}if(_['isNil'](_0x18bba4[_0xddbb('0x22')]['mapKey'])){throw new db['Sequelize'][(_0xddbb('0x2b'))](_0xddbb('0x2f')+_0x5ebd5d);}if(!_[_0xddbb('0x30')](_0x5ebd5d,_0x18bba4['body']['mapKey'])){throw new db['Sequelize']['ValidationError'](_0xddbb('0x31')+_0x5ebd5d);}_0x221851[_0x18bba4['body'][_0xddbb('0x32')]]=_0x18bba4[_0xddbb('0x22')][_0xddbb('0x33')];})[_0xddbb('0x10')](function(){return db[_0xddbb('0x34')]['find']({'where':{'id':_0x18bba4[_0xddbb('0x35')]['id']},'include':[{'model':db[_0xddbb('0x36')],'as':_0xddbb('0x37'),'include':[{'model':db[_0xddbb('0x24')],'as':_0xddbb('0x38'),'where':_0x221851,'limit':0x1,'order':[[_0xddbb('0x28'),_0xddbb('0x39')]]}]},{'model':db['FaxApplication'],'as':_0xddbb('0x3a')}]});})['then'](function(_0x151ac6){if(_0x151ac6&&_0x151ac6['List']){var _0x31c9e2=_0x151ac6['get']({'plain':!![]});_0xb2cbee[_0xddbb('0x35')]=_0x31c9e2;_0xb2cbee[_0xddbb('0x3b')]=_0x31c9e2[_0xddbb('0x3a')];_0xb2cbee[_0xddbb('0x3c')]=_0x31c9e2[_0xddbb('0x37')];_0xb2cbee[_0xddbb('0x3b')]=_[_0xddbb('0x3d')](_0xb2cbee[_0xddbb('0x3b')],[_0xddbb('0x3e')],[_0xddbb('0x3f')]);if(_0xb2cbee[_0xddbb('0x35')][_0xddbb('0x3a')]){delete _0xb2cbee[_0xddbb('0x35')]['Applications'];}if(_0xb2cbee['account'][_0xddbb('0x37')]&&_0xb2cbee[_0xddbb('0x35')][_0xddbb('0x37')][_0xddbb('0x38')][_0xddbb('0x40')]){return _0xb2cbee[_0xddbb('0x35')][_0xddbb('0x37')][_0xddbb('0x38')][0x0];}var _0x550031=_[_0xddbb('0xc')](_0x18bba4[_0xddbb('0x22')],{'firstName':_0x18bba4['body'][_0xddbb('0x33')],'ListId':_0x31c9e2[_0xddbb('0x41')]});_0x550031[_0x18bba4[_0xddbb('0x22')]['mapKey']]=_0x18bba4[_0xddbb('0x22')][_0xddbb('0x33')];return db['CmContact'][_0xddbb('0x42')](_0x550031,{'fields':_0x3a331c,'raw':!![]});}})[_0xddbb('0x10')](function(_0x2c3c80){_0xb2cbee[_0xddbb('0x43')]=_0x2c3c80;if(_0x2c3c80){var _0x163bc5={'ContactId':_0x2c3c80['id'],'FaxAccountId':_0x18bba4[_0xddbb('0x35')]['id'],'fax':_0x2c3c80[_0xddbb('0x23')]};return db[_0xddbb('0x44')]['find']({'where':{'ContactId':_0x2c3c80['id'],'closed':![],'FaxAccountId':_0x18bba4[_0xddbb('0x35')]['id']}})[_0xddbb('0x10')](function(_0x510821){if(_0x510821){return[_0x510821,![]];}return db[_0xddbb('0x44')][_0xddbb('0x42')](_0x163bc5)[_0xddbb('0x10')](function(_0x128b29){return[_0x128b29,!![]];});});}else{throw new Error(_0xddbb('0x45'));}})[_0xddbb('0x46')](function(_0x50d739,_0x1d109b){var _0xb4d880=_0x50d739[_0xddbb('0x47')]({'plain':!![]});if(_0x1d109b){if(_0xb2cbee[_0xddbb('0x35')]['autoclose']){_0xb2cbee[_0xddbb('0x3b')]['push']({'id':0x0,'priority':_0xb2cbee[_0xddbb('0x3b')][_0xddbb('0x40')]+0x1,'app':_0xddbb('0x48'),'appdata':_0xddbb('0x49'),'interval':'*,*,*,*'});}_0xb4d880[_0xddbb('0x4a')]=!![];}else{_0xb4d880[_0xddbb('0x4a')]=![];}_0xb2cbee[_0xddbb('0x4b')]=_0xb4d880;return db[_0xddbb('0x4c')]['create']({'body':_0x18bba4[_0xddbb('0x22')][_0xddbb('0x22')],'FaxAccountId':_0x18bba4['account']['id'],'FaxInteractionId':_0x50d739['id'],'direction':'in','ContactId':_0x50d739[_0xddbb('0x4d')],'AttachmentId':_0x18bba4[_0xddbb('0x22')][_0xddbb('0x4e')]});})['then'](function(_0x3b19e7){_0xb2cbee[_0xddbb('0x16')]=_0x3b19e7;if(_0xb2cbee['interaction'][_0xddbb('0x4f')]){return db[_0xddbb('0x50')]['find']({'attributes':['id',_0xddbb('0x51')],'where':{'id':_0xb2cbee['interaction'][_0xddbb('0x4f')]}})[_0xddbb('0x10')](function(_0x21ed32){if(_0x21ed32){_0xb2cbee[_0xddbb('0x3b')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x21ed32[_0xddbb('0x51')]+','+(_0xb2cbee[_0xddbb('0x35')]['waitForTheAssignedAgent']||0xa),'interval':_0xddbb('0x52')});}return respondWithRpcPromise('Start',_0xddbb('0x53'),_0xb2cbee);});}return respondWithRpcPromise('Start',_0xddbb('0x53'),_0xb2cbee);})[_0xddbb('0x10')](function(_0x1fc72b){_0x30f933(_0x1fc72b);})[_0xddbb('0x18')](function(_0x9b49f5){_0x15a8dd(_0x194a8f[_0xddbb('0x14')](0x1f4,_0x9b49f5[_0xddbb('0x16')]));});});}; \ No newline at end of file +var _0x0933=['Applications','get','applications','list','orderBy','priority','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','include','model','map','NotifyFaxAccount','body','fax','describe','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','CmContact','Contacts','FaxApplication'];(function(_0x3dd227,_0x1c0126){var _0x24995d=function(_0x320874){while(--_0x320874){_0x3dd227['push'](_0x3dd227['shift']());}};_0x24995d(++_0x1c0126);}(_0x0933,0xd5));var _0x3093=function(_0x241103,_0x2ff561){_0x241103=_0x241103-0x0;var _0x5d0e5a=_0x0933[_0x241103];return _0x5d0e5a;};'use strict';var _=require(_0x3093('0x0'));var util=require(_0x3093('0x1'));var moment=require(_0x3093('0x2'));var BPromise=require(_0x3093('0x3'));var rs=require(_0x3093('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3093('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3093('0x6'))(_0x3093('0x7'));var config=require(_0x3093('0x8'));var jayson=require(_0x3093('0x9'));var client=jayson[_0x3093('0xa')][_0x3093('0xb')]({'port':0x232c});config['redis']=_[_0x3093('0xc')](config[_0x3093('0xd')],{'host':_0x3093('0xe'),'port':0x18eb});var socket=require(_0x3093('0xf'))(new Redis(config[_0x3093('0xd')]));require(_0x3093('0x10'))[_0x3093('0x11')](socket);function respondWithRpcPromise(_0xb6123,_0x16231a,_0x1a4253){return new BPromise(function(_0xb3a107,_0x440bbc){return client['request'](_0xb6123,_0x1a4253)[_0x3093('0x12')](function(_0x16c654){logger[_0x3093('0x13')](_0x3093('0x14'),_0x16231a,_0x3093('0x15'));logger[_0x3093('0x16')](_0x3093('0x17'),_0x16231a,'request\x20sent',JSON['stringify'](_0x16c654));if(_0x16c654['error']){if(_0x16c654[_0x3093('0x18')][_0x3093('0x19')]===0x1f4){logger[_0x3093('0x18')](_0x3093('0x14'),_0x16231a,_0x16c654[_0x3093('0x18')][_0x3093('0x1a')]);return _0x440bbc(_0x16c654[_0x3093('0x18')][_0x3093('0x1a')]);}logger[_0x3093('0x18')](_0x3093('0x14'),_0x16231a,_0x16c654['error']['message']);return _0xb3a107(_0x16c654['error'][_0x3093('0x1a')]);}else{logger[_0x3093('0x13')](_0x3093('0x14'),_0x16231a,_0x3093('0x15'));_0xb3a107(_0x16c654[_0x3093('0x1b')][_0x3093('0x1a')]);}})[_0x3093('0x1c')](function(_0x216a3e){logger['error'](_0x3093('0x14'),_0x16231a,_0x216a3e);_0x440bbc(_0x216a3e);});});}exports[_0x3093('0x1d')]=function(_0x4d5788){var _0x115b00=this;return new Promise(function(_0x223cb6,_0xac5159){return db[_0x3093('0x1e')][_0x3093('0x1f')]({'raw':_0x4d5788['options']?_0x4d5788[_0x3093('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x4d5788['options']?_0x4d5788[_0x3093('0x20')][_0x3093('0x21')]||null:null,'attributes':_0x4d5788[_0x3093('0x20')]?_0x4d5788[_0x3093('0x20')][_0x3093('0x22')]||null:null,'limit':_0x4d5788[_0x3093('0x20')]?_0x4d5788[_0x3093('0x20')][_0x3093('0x23')]||null:null,'include':_0x4d5788[_0x3093('0x20')]?_0x4d5788['options'][_0x3093('0x24')]?_['map'](_0x4d5788[_0x3093('0x20')]['include'],function(_0x12600a){return{'model':db[_0x12600a[_0x3093('0x25')]],'as':_0x12600a['as'],'attributes':_0x12600a[_0x3093('0x22')],'include':_0x12600a[_0x3093('0x24')]?_[_0x3093('0x26')](_0x12600a[_0x3093('0x24')],function(_0x381fa1){return{'model':db[_0x381fa1[_0x3093('0x25')]],'as':_0x381fa1['as'],'attributes':_0x381fa1['attributes'],'include':_0x381fa1[_0x3093('0x24')]?_['map'](_0x381fa1[_0x3093('0x24')],function(_0x3d8908){return{'model':db[_0x3d8908[_0x3093('0x25')]],'as':_0x3d8908['as'],'attributes':_0x3d8908['attributes']};}):[]};}):[]};}):[]:[]})[_0x3093('0x12')](function(_0x5c3f50){logger[_0x3093('0x13')](_0x3093('0x1d'),_0x4d5788);logger['debug'](_0x3093('0x1d'),_0x4d5788,JSON['stringify'](_0x5c3f50));_0x223cb6(_0x5c3f50);})[_0x3093('0x1c')](function(_0x3c0d4d){logger[_0x3093('0x18')](_0x3093('0x1d'),_0x3c0d4d[_0x3093('0x1a')],_0x4d5788);_0xac5159(_0x115b00['error'](0x1f4,_0x3c0d4d[_0x3093('0x1a')]));});});};exports[_0x3093('0x27')]=function(_0x6ec0e3,_0x200640,_0x3c29af){var _0x120723=this;return new Promise(function(_0x255ba1,_0x585668){var _0x3c8f7b={'body':_0x6ec0e3[_0x3093('0x28')],'channel':_0x3093('0x29')};var _0x1c708c=[];var _0x49a547=[];var _0x4f8aba={};return db['CmContact'][_0x3093('0x2a')]()[_0x3093('0x12')](function(_0x3ee60c){if(!_0x3ee60c){throw new db['Sequelize'][(_0x3093('0x2b'))](_0x3093('0x2c'));}_0x1c708c=_[_0x3093('0x2d')](_[_0x3093('0x2e')](_0x3ee60c),[_0x3093('0x2f'),'updatedAt']);_0x49a547=_['difference'](_[_0x3093('0x2e')](_0x3ee60c),[_0x3093('0x2f'),_0x3093('0x30'),_0x3093('0x31'),_0x3093('0x32')]);if(_0x6ec0e3['body']['id']){delete _0x6ec0e3[_0x3093('0x28')]['id'];}if(_[_0x3093('0x33')](_0x6ec0e3[_0x3093('0x28')][_0x3093('0x34')])){throw new db[(_0x3093('0x35'))][(_0x3093('0x2b'))](_0x3093('0x36'));}if(_['isNil'](_0x6ec0e3[_0x3093('0x28')][_0x3093('0x28')])||_0x6ec0e3[_0x3093('0x28')][_0x3093('0x28')]===''){throw new db['Sequelize'][(_0x3093('0x2b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x3093('0x33')](_0x6ec0e3[_0x3093('0x28')][_0x3093('0x37')])){throw new db[(_0x3093('0x35'))][(_0x3093('0x2b'))](_0x3093('0x38')+_0x49a547);}if(!_[_0x3093('0x39')](_0x49a547,_0x6ec0e3['body'][_0x3093('0x37')])){throw new db[(_0x3093('0x35'))][(_0x3093('0x2b'))](_0x3093('0x3a')+_0x49a547);}_0x4f8aba[_0x6ec0e3['body'][_0x3093('0x37')]]=_0x6ec0e3[_0x3093('0x28')][_0x3093('0x34')];})[_0x3093('0x12')](function(){return db['FaxAccount'][_0x3093('0x3b')]({'where':{'id':_0x6ec0e3[_0x3093('0x3c')]['id']},'include':[{'model':db[_0x3093('0x3d')],'as':_0x3093('0x3e'),'include':[{'model':db[_0x3093('0x3f')],'as':_0x3093('0x40'),'where':_0x4f8aba,'limit':0x1,'order':[[_0x3093('0x30'),'DESC']]}]},{'model':db[_0x3093('0x41')],'as':_0x3093('0x42')}]});})[_0x3093('0x12')](function(_0x2c8250){if(_0x2c8250&&_0x2c8250[_0x3093('0x3e')]){var _0x43d069=_0x2c8250[_0x3093('0x43')]({'plain':!![]});_0x3c8f7b[_0x3093('0x3c')]=_0x43d069;_0x3c8f7b[_0x3093('0x44')]=_0x43d069[_0x3093('0x42')];_0x3c8f7b[_0x3093('0x45')]=_0x43d069[_0x3093('0x3e')];_0x3c8f7b[_0x3093('0x44')]=_[_0x3093('0x46')](_0x3c8f7b[_0x3093('0x44')],[_0x3093('0x47')],['asc']);if(_0x3c8f7b[_0x3093('0x3c')]['Applications']){delete _0x3c8f7b[_0x3093('0x3c')][_0x3093('0x42')];}if(_0x3c8f7b['account'][_0x3093('0x3e')]&&_0x3c8f7b[_0x3093('0x3c')][_0x3093('0x3e')][_0x3093('0x40')][_0x3093('0x48')]){return _0x3c8f7b[_0x3093('0x3c')][_0x3093('0x3e')][_0x3093('0x40')][0x0];}var _0x131792=_[_0x3093('0xc')](_0x6ec0e3[_0x3093('0x28')],{'firstName':_0x6ec0e3[_0x3093('0x28')]['from'],'ListId':_0x43d069[_0x3093('0x32')]});_0x131792[_0x6ec0e3[_0x3093('0x28')][_0x3093('0x37')]]=_0x6ec0e3[_0x3093('0x28')][_0x3093('0x34')];return db[_0x3093('0x3f')][_0x3093('0x49')](_0x131792,{'fields':_0x1c708c,'raw':!![]});}})[_0x3093('0x12')](function(_0x48c2cc){_0x3c8f7b[_0x3093('0x4a')]=_0x48c2cc;if(_0x48c2cc){var _0x504b38={'ContactId':_0x48c2cc['id'],'FaxAccountId':_0x6ec0e3[_0x3093('0x3c')]['id'],'fax':_0x48c2cc[_0x3093('0x29')]};return db[_0x3093('0x4b')][_0x3093('0x3b')]({'where':{'ContactId':_0x48c2cc['id'],'closed':![],'FaxAccountId':_0x6ec0e3[_0x3093('0x3c')]['id']}})[_0x3093('0x12')](function(_0x41a87a){if(_0x41a87a){return[_0x41a87a,![]];}return db[_0x3093('0x4b')]['create'](_0x504b38)[_0x3093('0x12')](function(_0xeee841){return[_0xeee841,!![]];});});}else{throw new Error(_0x3093('0x4c'));}})[_0x3093('0x4d')](function(_0x22c5db,_0x33d97a){var _0x2451d6=_0x22c5db['get']({'plain':!![]});if(_0x33d97a){if(_0x3c8f7b[_0x3093('0x3c')][_0x3093('0x4e')]){_0x3c8f7b[_0x3093('0x44')]['push']({'id':0x0,'priority':_0x3c8f7b[_0x3093('0x44')][_0x3093('0x48')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x3093('0x4f')});}_0x2451d6[_0x3093('0x50')]=!![];}else{_0x2451d6[_0x3093('0x50')]=![];}_0x3c8f7b['interaction']=_0x2451d6;return db[_0x3093('0x51')][_0x3093('0x49')]({'body':_0x6ec0e3[_0x3093('0x28')]['body'],'FaxAccountId':_0x6ec0e3['account']['id'],'FaxInteractionId':_0x22c5db['id'],'direction':'in','ContactId':_0x22c5db[_0x3093('0x52')],'AttachmentId':_0x6ec0e3[_0x3093('0x28')][_0x3093('0x53')]});})[_0x3093('0x12')](function(_0xa57551){_0x3c8f7b['message']=_0xa57551;if(_0x3c8f7b[_0x3093('0x54')][_0x3093('0x55')]){return db[_0x3093('0x56')][_0x3093('0x3b')]({'attributes':['id','name'],'where':{'id':_0x3c8f7b[_0x3093('0x54')]['UserId']}})['then'](function(_0x47f62c){if(_0x47f62c){_0x3c8f7b['applications'][_0x3093('0x57')]({'id':0x0,'priority':0x0,'app':_0x3093('0x58'),'appdata':_0x47f62c[_0x3093('0x59')]+','+(_0x3c8f7b[_0x3093('0x3c')][_0x3093('0x5a')]||0xa),'interval':_0x3093('0x4f')});}return respondWithRpcPromise(_0x3093('0x5b'),_0x3093('0x5c'),_0x3c8f7b);});}return respondWithRpcPromise(_0x3093('0x5b'),'startRouting',_0x3c8f7b);})[_0x3093('0x12')](function(_0x416a3a){_0x255ba1(_0x416a3a);})['catch'](function(_0x4a9733){_0x585668(_0x120723[_0x3093('0x18')](0x1f4,_0x4a9733[_0x3093('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 9b54cc9..adbb201 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 _0x5204=['length','./faxAccount.events','save','update','emit','register'];(function(_0x3462e9,_0x255a41){var _0x218a11=function(_0x514c56){while(--_0x514c56){_0x3462e9['push'](_0x3462e9['shift']());}};_0x218a11(++_0x255a41);}(_0x5204,0xdf));var _0x4520=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0x5204[_0x1ad926];return _0x1b81dc;};'use strict';var FaxAccountEvents=require(_0x4520('0x0'));var events=[_0x4520('0x1'),'remove',_0x4520('0x2')];function createListener(_0x3bf0b1,_0x10cbc2){return function(_0x36caca){_0x10cbc2[_0x4520('0x3')](_0x3bf0b1,_0x36caca);};}function removeListener(_0x592fe0,_0x41d89c){return function(){FaxAccountEvents['removeListener'](_0x592fe0,_0x41d89c);};}exports[_0x4520('0x4')]=function(_0x209381){for(var _0xe0a256=0x0,_0xe741c2=events[_0x4520('0x5')];_0xe0a256<_0xe741c2;_0xe0a256++){var _0x446dc9=events[_0xe0a256];var _0x27890f=createListener('faxAccount:'+_0x446dc9,_0x209381);FaxAccountEvents['on'](_0x446dc9,_0x27890f);}}; \ No newline at end of file +var _0x5430=['length','faxAccount:','./faxAccount.events','save','remove','update','register'];(function(_0x2a6604,_0x2682a4){var _0x49068c=function(_0x134826){while(--_0x134826){_0x2a6604['push'](_0x2a6604['shift']());}};_0x49068c(++_0x2682a4);}(_0x5430,0x10c));var _0x0543=function(_0x590563,_0x1920fb){_0x590563=_0x590563-0x0;var _0x1acfd7=_0x5430[_0x590563];return _0x1acfd7;};'use strict';var FaxAccountEvents=require(_0x0543('0x0'));var events=[_0x0543('0x1'),_0x0543('0x2'),_0x0543('0x3')];function createListener(_0x114bf2,_0x3b93d7){return function(_0x5518f8){_0x3b93d7['emit'](_0x114bf2,_0x5518f8);};}function removeListener(_0x1c5ab7,_0x4ee416){return function(){FaxAccountEvents['removeListener'](_0x1c5ab7,_0x4ee416);};}exports[_0x0543('0x4')]=function(_0x45b909){for(var _0x9754ba=0x0,_0x319568=events[_0x0543('0x5')];_0x9754ba<_0x319568;_0x9754ba++){var _0x5ac352=events[_0x9754ba];var _0x372974=createListener(_0x0543('0x6')+_0x5ac352,_0x45b909);FaxAccountEvents['on'](_0x5ac352,_0x372974);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 299acd7..285c0f3 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 _0x04c5=['delete','removeDispositions','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','getApplications','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','addAnswer','addInteraction','addApplications','/updateaccountapplications','updateAccountApplications','addAgents','put','update','destroy'];(function(_0x5cc631,_0x25e822){var _0x17a984=function(_0x1a7779){while(--_0x1a7779){_0x5cc631['push'](_0x5cc631['shift']());}};_0x17a984(++_0x25e822);}(_0x04c5,0x163));var _0x504c=function(_0x242bf2,_0x343ad2){_0x242bf2=_0x242bf2-0x0;var _0x38d325=_0x04c5[_0x242bf2];return _0x38d325;};'use strict';var multer=require(_0x504c('0x0'));var util=require('util');var path=require(_0x504c('0x1'));var timeout=require('connect-timeout');var express=require(_0x504c('0x2'));var router=express[_0x504c('0x3')]();var auth=require(_0x504c('0x4'));var interaction=require(_0x504c('0x5'));var config=require(_0x504c('0x6'));var controller=require(_0x504c('0x7'));router[_0x504c('0x8')]('/',auth[_0x504c('0x9')](),controller[_0x504c('0xa')]);router[_0x504c('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x504c('0xb')]);router[_0x504c('0x8')](_0x504c('0xc'),auth[_0x504c('0x9')](),controller[_0x504c('0xd')]);router[_0x504c('0x8')]('/:id/dispositions',auth[_0x504c('0x9')](),controller[_0x504c('0xe')]);router[_0x504c('0x8')](_0x504c('0xf'),auth[_0x504c('0x9')](),controller[_0x504c('0x10')]);router[_0x504c('0x8')](_0x504c('0x11'),auth[_0x504c('0x9')](),controller[_0x504c('0x12')]);router[_0x504c('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x504c('0x13')]);router[_0x504c('0x8')]('/:id/messages',auth[_0x504c('0x9')](),controller['getMessages']);router['get'](_0x504c('0x14'),auth[_0x504c('0x9')](),controller[_0x504c('0x15')]);router['post']('/',auth[_0x504c('0x9')](),controller[_0x504c('0x16')]);router[_0x504c('0x17')](_0x504c('0x18'),auth['isAuthenticated'](),controller[_0x504c('0x19')]);router[_0x504c('0x17')](_0x504c('0xf'),auth[_0x504c('0x9')](),controller[_0x504c('0x1a')]);router[_0x504c('0x17')]('/:id/interactions',auth[_0x504c('0x9')](),controller[_0x504c('0x1b')]);router['post']('/:id/applications',auth[_0x504c('0x9')](),controller[_0x504c('0x1c')]);router[_0x504c('0x17')]('/addaccountapplications',auth[_0x504c('0x9')](),controller['addAccountApplications']);router['post'](_0x504c('0x1d'),auth[_0x504c('0x9')](),controller[_0x504c('0x1e')]);router[_0x504c('0x17')]('/:id/send',auth[_0x504c('0x9')](),controller['send']);router['post']('/:id/users',auth[_0x504c('0x9')](),controller[_0x504c('0x1f')]);router[_0x504c('0x20')](_0x504c('0xc'),auth[_0x504c('0x9')](),controller[_0x504c('0x21')]);router['delete'](_0x504c('0xc'),auth[_0x504c('0x9')](),controller[_0x504c('0x22')]);router[_0x504c('0x23')]('/:id/dispositions',auth[_0x504c('0x9')](),controller[_0x504c('0x24')]);router[_0x504c('0x23')](_0x504c('0xf'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x504c('0x23')](_0x504c('0x14'),auth['isAuthenticated'](),controller[_0x504c('0x25')]);module[_0x504c('0x26')]=router; \ No newline at end of file +var _0x2162=['getMessages','/:id/users','getAgents','create','addDisposition','post','addAnswer','/:id/interactions','addInteraction','addApplications','/addaccountapplications','addAccountApplications','updateAccountApplications','/:id/send','send','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/messages'];(function(_0x2355dd,_0x5a2b4a){var _0x1a7b2e=function(_0x1d012f){while(--_0x1d012f){_0x2355dd['push'](_0x2355dd['shift']());}};_0x1a7b2e(++_0x5a2b4a);}(_0x2162,0x9d));var _0x2216=function(_0x476558,_0x32d07f){_0x476558=_0x476558-0x0;var _0x565cca=_0x2162[_0x476558];return _0x565cca;};'use strict';var multer=require(_0x2216('0x0'));var util=require(_0x2216('0x1'));var path=require(_0x2216('0x2'));var timeout=require('connect-timeout');var express=require(_0x2216('0x3'));var router=express[_0x2216('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2216('0x5'));var config=require(_0x2216('0x6'));var controller=require(_0x2216('0x7'));router[_0x2216('0x8')]('/',auth[_0x2216('0x9')](),controller['index']);router[_0x2216('0x8')](_0x2216('0xa'),auth[_0x2216('0x9')](),controller['describe']);router[_0x2216('0x8')]('/:id',auth[_0x2216('0x9')](),controller[_0x2216('0xb')]);router['get'](_0x2216('0xc'),auth[_0x2216('0x9')](),controller[_0x2216('0xd')]);router[_0x2216('0x8')](_0x2216('0xe'),auth['isAuthenticated'](),controller[_0x2216('0xf')]);router[_0x2216('0x8')]('/:id/interactions',auth[_0x2216('0x9')](),controller['getInteractions']);router[_0x2216('0x8')](_0x2216('0x10'),auth['isAuthenticated'](),controller[_0x2216('0x11')]);router['get'](_0x2216('0x12'),auth[_0x2216('0x9')](),controller[_0x2216('0x13')]);router['get'](_0x2216('0x14'),auth['isAuthenticated'](),controller[_0x2216('0x15')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2216('0x16')]);router['post'](_0x2216('0xc'),auth['isAuthenticated'](),controller[_0x2216('0x17')]);router[_0x2216('0x18')](_0x2216('0xe'),auth[_0x2216('0x9')](),controller[_0x2216('0x19')]);router['post'](_0x2216('0x1a'),auth['isAuthenticated'](),controller[_0x2216('0x1b')]);router[_0x2216('0x18')]('/:id/applications',auth[_0x2216('0x9')](),controller[_0x2216('0x1c')]);router[_0x2216('0x18')](_0x2216('0x1d'),auth[_0x2216('0x9')](),controller[_0x2216('0x1e')]);router[_0x2216('0x18')]('/updateaccountapplications',auth[_0x2216('0x9')](),controller[_0x2216('0x1f')]);router['post'](_0x2216('0x20'),auth[_0x2216('0x9')](),controller[_0x2216('0x21')]);router[_0x2216('0x18')](_0x2216('0x14'),auth['isAuthenticated'](),controller[_0x2216('0x22')]);router[_0x2216('0x23')](_0x2216('0x24'),auth[_0x2216('0x9')](),controller[_0x2216('0x25')]);router[_0x2216('0x26')](_0x2216('0x24'),auth[_0x2216('0x9')](),controller[_0x2216('0x27')]);router[_0x2216('0x26')](_0x2216('0xc'),auth[_0x2216('0x9')](),controller[_0x2216('0x28')]);router[_0x2216('0x26')](_0x2216('0xe'),auth[_0x2216('0x9')](),controller[_0x2216('0x29')]);router['delete'](_0x2216('0x14'),auth[_0x2216('0x9')](),controller[_0x2216('0x2a')]);module[_0x2216('0x2b')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index d5bee07..e71e4c2 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 _0xf496=['sequelize','exports','INTEGER','STRING','noop'];(function(_0x525c29,_0x44ad57){var _0x596d53=function(_0x1dd265){while(--_0x1dd265){_0x525c29['push'](_0x525c29['shift']());}};_0x596d53(++_0x44ad57);}(_0xf496,0x1c7));var _0x6f49=function(_0x58fae6,_0x561737){_0x58fae6=_0x58fae6-0x0;var _0x13296c=_0xf496[_0x58fae6];return _0x13296c;};'use strict';var Sequelize=require(_0x6f49('0x0'));module[_0x6f49('0x1')]={'priority':{'type':Sequelize[_0x6f49('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6f49('0x3')],'allowNull':![],'defaultValue':_0x6f49('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6f49('0x3')]},'interval':{'type':Sequelize[_0x6f49('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x7aa0=['*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x7aa0,0xa1));var _0x07aa=function(_0x54375f,_0x59d67d){_0x54375f=_0x54375f-0x0;var _0xfbacc1=_0x7aa0[_0x54375f];return _0xfbacc1;};'use strict';var Sequelize=require(_0x07aa('0x0'));module[_0x07aa('0x1')]={'priority':{'type':Sequelize[_0x07aa('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x07aa('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x07aa('0x3')]},'interval':{'type':Sequelize[_0x07aa('0x3')],'defaultValue':_0x07aa('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index a7e9cac..656a32e 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 _0xe4d6=['options','count','includeAll','include','catch','show','params','fields','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','FaxApplication','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter'];(function(_0x10a94d,_0x3bf30f){var _0x33b351=function(_0x10277c){while(--_0x10277c){_0x10a94d['push'](_0x10a94d['shift']());}};_0x33b351(++_0x3bf30f);}(_0xe4d6,0xd7));var _0x6e4d=function(_0x238613,_0x719e82){_0x238613=_0x238613-0x0;var _0x50db4e=_0xe4d6[_0x238613];return _0x50db4e;};'use strict';var pdf=require(_0x6e4d('0x0'));var emlformat=require(_0x6e4d('0x1'));var rimraf=require(_0x6e4d('0x2'));var zipdir=require(_0x6e4d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e4d('0x4'));var moment=require(_0x6e4d('0x5'));var BPromise=require(_0x6e4d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6e4d('0x7'));var sox=require('sox');var csv=require(_0x6e4d('0x8'));var ejs=require(_0x6e4d('0x9'));var fs=require('fs');var _=require(_0x6e4d('0xa'));var squel=require(_0x6e4d('0xb'));var crypto=require(_0x6e4d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6e4d('0x8'));var querystring=require(_0x6e4d('0xd'));var Papa=require(_0x6e4d('0xe'));var Redis=require('ioredis');var authService=require(_0x6e4d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6e4d('0x10'));var hardwareService=require(_0x6e4d('0x11'));var logger=require(_0x6e4d('0x12'))(_0x6e4d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6e4d('0x14'))['db'];function respondWithStatusCode(_0x3e99c7,_0x13cd57){_0x13cd57=_0x13cd57||0xcc;return function(_0x39ab6d){if(_0x39ab6d){return _0x3e99c7[_0x6e4d('0x15')](_0x13cd57);}return _0x3e99c7[_0x6e4d('0x16')](_0x13cd57)[_0x6e4d('0x17')]();};}function respondWithResult(_0x451a48,_0x7ade78){_0x7ade78=_0x7ade78||0xc8;return function(_0x545f9b){if(_0x545f9b){return _0x451a48[_0x6e4d('0x16')](_0x7ade78)[_0x6e4d('0x18')](_0x545f9b);}};}function respondWithFilteredResult(_0x1694c4,_0x5d1391){return function(_0x5863d3){if(_0x5863d3){var _0xdca5f3=_0x5863d3['count'],_0x51b9f1=_0x5d1391[_0x6e4d('0x19')],_0x206c02=_0x5d1391['offset']+_0x5d1391[_0x6e4d('0x1a')],_0xf0021;if(_0x206c02>=_0xdca5f3){_0x206c02=_0xdca5f3;_0xf0021=0xc8;}else{_0xf0021=0xce;}_0x1694c4[_0x6e4d('0x16')](_0xf0021);return _0x1694c4[_0x6e4d('0x1b')](_0x6e4d('0x1c'),_0x51b9f1+'-'+_0x206c02+'/'+_0xdca5f3)[_0x6e4d('0x18')](_0x5863d3);}return null;};}function patchUpdates(_0x5cf5e4){return function(_0x168ef9){try{jsonpatch['apply'](_0x168ef9,_0x5cf5e4,!![]);}catch(_0xa1da79){return BPromise[_0x6e4d('0x1d')](_0xa1da79);}return _0x168ef9[_0x6e4d('0x1e')]();};}function saveUpdates(_0x15d386,_0x5a8c39){return function(_0x33867f){if(_0x33867f){return _0x33867f[_0x6e4d('0x1f')](_0x15d386)[_0x6e4d('0x20')](function(_0xaf1736){return _0xaf1736;});}return null;};}function removeEntity(_0x4bc652,_0xe45d2a){return function(_0x1be13b){if(_0x1be13b){return _0x1be13b[_0x6e4d('0x21')]()['then'](function(){_0x4bc652[_0x6e4d('0x16')](0xcc)[_0x6e4d('0x17')]();});}};}function handleEntityNotFound(_0x2fbbae,_0x2873b3){return function(_0x4a7d4a){if(!_0x4a7d4a){_0x2fbbae['sendStatus'](0x194);}return _0x4a7d4a;};}function handleError(_0x9fb272,_0x586adb){_0x586adb=_0x586adb||0x1f4;return function(_0x46f528){logger[_0x6e4d('0x22')](_0x46f528[_0x6e4d('0x23')]);if(_0x46f528['name']){delete _0x46f528[_0x6e4d('0x24')];}_0x9fb272[_0x6e4d('0x16')](_0x586adb)['send'](_0x46f528);};}exports['index']=function(_0x5a2ef9,_0x345ce6){var _0x229d4d={},_0x251d0c={},_0x215020={'count':0x0,'rows':[]};var _0xeb2707=_['map'](db[_0x6e4d('0x25')][_0x6e4d('0x26')],function(_0x1c90de){return{'name':_0x1c90de[_0x6e4d('0x27')],'type':_0x1c90de[_0x6e4d('0x28')]['key']};});_0x251d0c['model']=_[_0x6e4d('0x29')](_0xeb2707,'name');_0x251d0c[_0x6e4d('0x2a')]=_[_0x6e4d('0x2b')](_0x5a2ef9[_0x6e4d('0x2a')]);_0x251d0c[_0x6e4d('0x2c')]=_[_0x6e4d('0x2d')](_0x251d0c[_0x6e4d('0x2e')],_0x251d0c[_0x6e4d('0x2a')]);_0x229d4d[_0x6e4d('0x2f')]=_[_0x6e4d('0x2d')](_0x251d0c[_0x6e4d('0x2e')],qs['fields'](_0x5a2ef9['query']['fields']));_0x229d4d[_0x6e4d('0x2f')]=_0x229d4d[_0x6e4d('0x2f')][_0x6e4d('0x30')]?_0x229d4d[_0x6e4d('0x2f')]:_0x251d0c['model'];if(!_0x5a2ef9[_0x6e4d('0x2a')][_0x6e4d('0x31')](_0x6e4d('0x32'))){_0x229d4d[_0x6e4d('0x1a')]=qs['limit'](_0x5a2ef9[_0x6e4d('0x2a')][_0x6e4d('0x1a')]);_0x229d4d['offset']=qs[_0x6e4d('0x19')](_0x5a2ef9[_0x6e4d('0x2a')][_0x6e4d('0x19')]);}_0x229d4d[_0x6e4d('0x33')]=qs[_0x6e4d('0x34')](_0x5a2ef9[_0x6e4d('0x2a')]['sort']);_0x229d4d['where']=qs[_0x6e4d('0x2c')](_[_0x6e4d('0x35')](_0x5a2ef9[_0x6e4d('0x2a')],_0x251d0c['filters']));if(_0x5a2ef9['query']['filter']){_0x229d4d['where']=_[_0x6e4d('0x36')](_0x229d4d[_0x6e4d('0x37')],{'$or':_['map'](_0xeb2707,function(_0x357a11){if(_0x357a11[_0x6e4d('0x28')]!=='VIRTUAL'){var _0x2f612e={};_0x2f612e[_0x357a11[_0x6e4d('0x24')]]={'$like':'%'+_0x5a2ef9[_0x6e4d('0x2a')][_0x6e4d('0x38')]+'%'};return _0x2f612e;}})});}_0x229d4d=_[_0x6e4d('0x36')]({},_0x229d4d,_0x5a2ef9[_0x6e4d('0x39')]);var _0x3a18ae={'where':_0x229d4d['where']};return db[_0x6e4d('0x25')]['count'](_0x3a18ae)['then'](function(_0x8b047d){_0x215020[_0x6e4d('0x3a')]=_0x8b047d;if(_0x5a2ef9['query'][_0x6e4d('0x3b')]){_0x229d4d[_0x6e4d('0x3c')]=[{'all':!![]}];}return db['FaxApplication']['findAll'](_0x229d4d);})[_0x6e4d('0x20')](function(_0x2e2c70){_0x215020['rows']=_0x2e2c70;return _0x215020;})[_0x6e4d('0x20')](respondWithFilteredResult(_0x345ce6,_0x229d4d))[_0x6e4d('0x3d')](handleError(_0x345ce6,null));};exports[_0x6e4d('0x3e')]=function(_0x4acf59,_0x2a6b38){var _0x55c4e1={'raw':!![],'where':{'id':_0x4acf59[_0x6e4d('0x3f')]['id']}},_0x4bd3e7={};_0x4bd3e7[_0x6e4d('0x2e')]=_['keys'](db[_0x6e4d('0x25')][_0x6e4d('0x26')]);_0x4bd3e7[_0x6e4d('0x2a')]=_[_0x6e4d('0x2b')](_0x4acf59[_0x6e4d('0x2a')]);_0x4bd3e7[_0x6e4d('0x2c')]=_[_0x6e4d('0x2d')](_0x4bd3e7[_0x6e4d('0x2e')],_0x4bd3e7['query']);_0x55c4e1[_0x6e4d('0x2f')]=_['intersection'](_0x4bd3e7['model'],qs[_0x6e4d('0x40')](_0x4acf59[_0x6e4d('0x2a')]['fields']));_0x55c4e1[_0x6e4d('0x2f')]=_0x55c4e1[_0x6e4d('0x2f')][_0x6e4d('0x30')]?_0x55c4e1[_0x6e4d('0x2f')]:_0x4bd3e7['model'];if(_0x4acf59[_0x6e4d('0x2a')][_0x6e4d('0x3b')]){_0x55c4e1[_0x6e4d('0x3c')]=[{'all':!![]}];}_0x55c4e1=_['merge']({},_0x55c4e1,_0x4acf59['options']);return db['FaxApplication'][_0x6e4d('0x41')](_0x55c4e1)[_0x6e4d('0x20')](handleEntityNotFound(_0x2a6b38,null))[_0x6e4d('0x20')](respondWithResult(_0x2a6b38,null))[_0x6e4d('0x3d')](handleError(_0x2a6b38,null));};exports[_0x6e4d('0x42')]=function(_0x4dec54,_0x54bdbe){return db[_0x6e4d('0x25')]['create'](_0x4dec54[_0x6e4d('0x43')],{})[_0x6e4d('0x20')](respondWithResult(_0x54bdbe,0xc9))['catch'](handleError(_0x54bdbe,null));};exports[_0x6e4d('0x1f')]=function(_0x6d042f,_0x411e04){if(_0x6d042f[_0x6e4d('0x43')]['id']){delete _0x6d042f[_0x6e4d('0x43')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x6d042f['params']['id']}})[_0x6e4d('0x20')](handleEntityNotFound(_0x411e04,null))[_0x6e4d('0x20')](saveUpdates(_0x6d042f[_0x6e4d('0x43')],null))['then'](respondWithResult(_0x411e04,null))[_0x6e4d('0x3d')](handleError(_0x411e04,null));};exports[_0x6e4d('0x21')]=function(_0x393670,_0xb8f9bc){return db[_0x6e4d('0x25')][_0x6e4d('0x41')]({'where':{'id':_0x393670[_0x6e4d('0x3f')]['id']}})[_0x6e4d('0x20')](handleEntityNotFound(_0xb8f9bc,null))['then'](removeEntity(_0xb8f9bc,null))[_0x6e4d('0x3d')](handleError(_0xb8f9bc,null));}; \ No newline at end of file +var _0xa4fb=['stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','FaxApplication','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','error'];(function(_0x35485a,_0x91cdd4){var _0x5148e6=function(_0x27ed1d){while(--_0x27ed1d){_0x35485a['push'](_0x35485a['shift']());}};_0x5148e6(++_0x91cdd4);}(_0xa4fb,0x150));var _0xba4f=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0xa4fb[_0x277fa3];return _0x2e4520;};'use strict';var pdf=require(_0xba4f('0x0'));var emlformat=require(_0xba4f('0x1'));var rimraf=require(_0xba4f('0x2'));var zipdir=require(_0xba4f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xba4f('0x4'));var BPromise=require(_0xba4f('0x5'));var Mustache=require(_0xba4f('0x6'));var util=require('util');var path=require(_0xba4f('0x7'));var sox=require(_0xba4f('0x8'));var csv=require(_0xba4f('0x9'));var ejs=require(_0xba4f('0xa'));var fs=require('fs');var _=require(_0xba4f('0xb'));var squel=require(_0xba4f('0xc'));var crypto=require(_0xba4f('0xd'));var jsforce=require(_0xba4f('0xe'));var deskjs=require(_0xba4f('0xf'));var toCsv=require(_0xba4f('0x9'));var querystring=require('querystring');var Papa=require(_0xba4f('0x10'));var Redis=require('ioredis');var authService=require(_0xba4f('0x11'));var qs=require(_0xba4f('0x12'));var as=require(_0xba4f('0x13'));var hardwareService=require(_0xba4f('0x14'));var logger=require(_0xba4f('0x15'))(_0xba4f('0x16'));var utils=require('../../config/utils');var config=require(_0xba4f('0x17'));var db=require(_0xba4f('0x18'))['db'];function respondWithStatusCode(_0x2d6309,_0x35a461){_0x35a461=_0x35a461||0xcc;return function(_0x3a0216){if(_0x3a0216){return _0x2d6309[_0xba4f('0x19')](_0x35a461);}return _0x2d6309[_0xba4f('0x1a')](_0x35a461)[_0xba4f('0x1b')]();};}function respondWithResult(_0x182f05,_0xbccef6){_0xbccef6=_0xbccef6||0xc8;return function(_0x4b9e86){if(_0x4b9e86){return _0x182f05[_0xba4f('0x1a')](_0xbccef6)[_0xba4f('0x1c')](_0x4b9e86);}};}function respondWithFilteredResult(_0xe8349b,_0x5b9334){return function(_0x5ad1e3){if(_0x5ad1e3){var _0x5a1e59=_0x5ad1e3[_0xba4f('0x1d')],_0x26d144=_0x5b9334[_0xba4f('0x1e')],_0x104caf=_0x5b9334[_0xba4f('0x1e')]+_0x5b9334['limit'],_0xc0a442;if(_0x104caf>=_0x5a1e59){_0x104caf=_0x5a1e59;_0xc0a442=0xc8;}else{_0xc0a442=0xce;}_0xe8349b[_0xba4f('0x1a')](_0xc0a442);return _0xe8349b[_0xba4f('0x1f')]('Content-Range',_0x26d144+'-'+_0x104caf+'/'+_0x5a1e59)[_0xba4f('0x1c')](_0x5ad1e3);}return null;};}function patchUpdates(_0x4cdc90){return function(_0x666124){try{jsonpatch[_0xba4f('0x20')](_0x666124,_0x4cdc90,!![]);}catch(_0x26e470){return BPromise[_0xba4f('0x21')](_0x26e470);}return _0x666124[_0xba4f('0x22')]();};}function saveUpdates(_0x6f513,_0x516024){return function(_0x254ef9){if(_0x254ef9){return _0x254ef9[_0xba4f('0x23')](_0x6f513)[_0xba4f('0x24')](function(_0x5ab4fb){return _0x5ab4fb;});}return null;};}function removeEntity(_0x17592f,_0x5a3ed0){return function(_0x4bdddc){if(_0x4bdddc){return _0x4bdddc[_0xba4f('0x25')]()[_0xba4f('0x24')](function(){_0x17592f[_0xba4f('0x1a')](0xcc)[_0xba4f('0x1b')]();});}};}function handleEntityNotFound(_0x1c68a1,_0x277f93){return function(_0x1e9b4f){if(!_0x1e9b4f){_0x1c68a1['sendStatus'](0x194);}return _0x1e9b4f;};}function handleError(_0x5ec4ae,_0xd65629){_0xd65629=_0xd65629||0x1f4;return function(_0x420099){logger[_0xba4f('0x26')](_0x420099[_0xba4f('0x27')]);if(_0x420099[_0xba4f('0x28')]){delete _0x420099['name'];}_0x5ec4ae['status'](_0xd65629)[_0xba4f('0x29')](_0x420099);};}exports[_0xba4f('0x2a')]=function(_0x1d639a,_0x294be5){var _0x2053d7={},_0x326443={},_0x16c6da={'count':0x0,'rows':[]};var _0xf3dd94=_[_0xba4f('0x2b')](db['FaxApplication'][_0xba4f('0x2c')],function(_0x4944ca){return{'name':_0x4944ca[_0xba4f('0x2d')],'type':_0x4944ca[_0xba4f('0x2e')]['key']};});_0x326443[_0xba4f('0x2f')]=_[_0xba4f('0x2b')](_0xf3dd94,_0xba4f('0x28'));_0x326443[_0xba4f('0x30')]=_[_0xba4f('0x31')](_0x1d639a[_0xba4f('0x30')]);_0x326443[_0xba4f('0x32')]=_[_0xba4f('0x33')](_0x326443[_0xba4f('0x2f')],_0x326443[_0xba4f('0x30')]);_0x2053d7[_0xba4f('0x34')]=_[_0xba4f('0x33')](_0x326443[_0xba4f('0x2f')],qs[_0xba4f('0x35')](_0x1d639a[_0xba4f('0x30')][_0xba4f('0x35')]));_0x2053d7[_0xba4f('0x34')]=_0x2053d7['attributes'][_0xba4f('0x36')]?_0x2053d7[_0xba4f('0x34')]:_0x326443[_0xba4f('0x2f')];if(!_0x1d639a[_0xba4f('0x30')]['hasOwnProperty'](_0xba4f('0x37'))){_0x2053d7[_0xba4f('0x38')]=qs[_0xba4f('0x38')](_0x1d639a[_0xba4f('0x30')][_0xba4f('0x38')]);_0x2053d7['offset']=qs['offset'](_0x1d639a['query']['offset']);}_0x2053d7[_0xba4f('0x39')]=qs['sort'](_0x1d639a['query'][_0xba4f('0x3a')]);_0x2053d7[_0xba4f('0x3b')]=qs[_0xba4f('0x32')](_[_0xba4f('0x3c')](_0x1d639a[_0xba4f('0x30')],_0x326443[_0xba4f('0x32')]));if(_0x1d639a[_0xba4f('0x30')][_0xba4f('0x3d')]){_0x2053d7[_0xba4f('0x3b')]=_[_0xba4f('0x3e')](_0x2053d7['where'],{'$or':_[_0xba4f('0x2b')](_0xf3dd94,function(_0x4cadde){if(_0x4cadde[_0xba4f('0x2e')]!==_0xba4f('0x3f')){var _0x2612cc={};_0x2612cc[_0x4cadde['name']]={'$like':'%'+_0x1d639a[_0xba4f('0x30')][_0xba4f('0x3d')]+'%'};return _0x2612cc;}})});}_0x2053d7=_['merge']({},_0x2053d7,_0x1d639a[_0xba4f('0x40')]);var _0x2a27bf={'where':_0x2053d7[_0xba4f('0x3b')]};return db['FaxApplication'][_0xba4f('0x1d')](_0x2a27bf)[_0xba4f('0x24')](function(_0x2cf39f){_0x16c6da[_0xba4f('0x1d')]=_0x2cf39f;if(_0x1d639a['query']['includeAll']){_0x2053d7[_0xba4f('0x41')]=[{'all':!![]}];}return db['FaxApplication'][_0xba4f('0x42')](_0x2053d7);})[_0xba4f('0x24')](function(_0x6055f7){_0x16c6da[_0xba4f('0x43')]=_0x6055f7;return _0x16c6da;})[_0xba4f('0x24')](respondWithFilteredResult(_0x294be5,_0x2053d7))[_0xba4f('0x44')](handleError(_0x294be5,null));};exports[_0xba4f('0x45')]=function(_0x3fcb67,_0x9e1543){var _0x45c860={'raw':!![],'where':{'id':_0x3fcb67[_0xba4f('0x46')]['id']}},_0x348a38={};_0x348a38[_0xba4f('0x2f')]=_[_0xba4f('0x31')](db['FaxApplication'][_0xba4f('0x2c')]);_0x348a38[_0xba4f('0x30')]=_[_0xba4f('0x31')](_0x3fcb67['query']);_0x348a38[_0xba4f('0x32')]=_[_0xba4f('0x33')](_0x348a38[_0xba4f('0x2f')],_0x348a38['query']);_0x45c860['attributes']=_[_0xba4f('0x33')](_0x348a38['model'],qs[_0xba4f('0x35')](_0x3fcb67['query'][_0xba4f('0x35')]));_0x45c860['attributes']=_0x45c860[_0xba4f('0x34')][_0xba4f('0x36')]?_0x45c860[_0xba4f('0x34')]:_0x348a38[_0xba4f('0x2f')];if(_0x3fcb67[_0xba4f('0x30')]['includeAll']){_0x45c860[_0xba4f('0x41')]=[{'all':!![]}];}_0x45c860=_[_0xba4f('0x3e')]({},_0x45c860,_0x3fcb67['options']);return db[_0xba4f('0x47')][_0xba4f('0x48')](_0x45c860)[_0xba4f('0x24')](handleEntityNotFound(_0x9e1543,null))[_0xba4f('0x24')](respondWithResult(_0x9e1543,null))[_0xba4f('0x44')](handleError(_0x9e1543,null));};exports[_0xba4f('0x49')]=function(_0x169699,_0x4fe97f){return db[_0xba4f('0x47')][_0xba4f('0x49')](_0x169699[_0xba4f('0x4a')],{})[_0xba4f('0x24')](respondWithResult(_0x4fe97f,0xc9))[_0xba4f('0x44')](handleError(_0x4fe97f,null));};exports[_0xba4f('0x23')]=function(_0x4e265b,_0x3f0eb){if(_0x4e265b[_0xba4f('0x4a')]['id']){delete _0x4e265b[_0xba4f('0x4a')]['id'];}return db[_0xba4f('0x47')][_0xba4f('0x48')]({'where':{'id':_0x4e265b[_0xba4f('0x46')]['id']}})[_0xba4f('0x24')](handleEntityNotFound(_0x3f0eb,null))[_0xba4f('0x24')](saveUpdates(_0x4e265b[_0xba4f('0x4a')],null))[_0xba4f('0x24')](respondWithResult(_0x3f0eb,null))[_0xba4f('0x44')](handleError(_0x3f0eb,null));};exports[_0xba4f('0x25')]=function(_0x3e8938,_0x15703a){return db[_0xba4f('0x47')]['find']({'where':{'id':_0x3e8938[_0xba4f('0x46')]['id']}})['then'](handleEntityNotFound(_0x15703a,null))[_0xba4f('0x24')](removeEntity(_0x15703a,null))['catch'](handleError(_0x15703a,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index fe04743..fb11dc8 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 _0x8d0f=['utf8mb4_unicode_ci','util','../../config/logger','api','request-promise','rimraf','../../config/environment','exports','define','fax_applications','utf8mb4'];(function(_0x336043,_0x5d09f6){var _0x3b945c=function(_0x37d2bf){while(--_0x37d2bf){_0x336043['push'](_0x336043['shift']());}};_0x3b945c(++_0x5d09f6);}(_0x8d0f,0x14b));var _0xf8d0=function(_0x4eccdb,_0x116e65){_0x4eccdb=_0x4eccdb-0x0;var _0x5d7cdf=_0x8d0f[_0x4eccdb];return _0x5d7cdf;};'use strict';var _=require('lodash');var util=require(_0xf8d0('0x0'));var logger=require(_0xf8d0('0x1'))(_0xf8d0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf8d0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8d0('0x4'));var config=require(_0xf8d0('0x5'));var attributes=require('./faxApplication.attributes');module[_0xf8d0('0x6')]=function(_0xc9ebb6,_0x4c9fa6){return _0xc9ebb6[_0xf8d0('0x7')]('FaxApplication',attributes,{'tableName':_0xf8d0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf8d0('0x9'),'collate':_0xf8d0('0xa')});}; \ No newline at end of file +var _0xf3ee=['lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4_unicode_ci'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0xf3ee,0x108));var _0xef3e=function(_0x4748d1,_0x3a538e){_0x4748d1=_0x4748d1-0x0;var _0x23bfab=_0xf3ee[_0x4748d1];return _0x23bfab;};'use strict';var _=require(_0xef3e('0x0'));var util=require(_0xef3e('0x1'));var logger=require('../../config/logger')(_0xef3e('0x2'));var moment=require('moment');var BPromise=require(_0xef3e('0x3'));var rp=require(_0xef3e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef3e('0x5'));var config=require(_0xef3e('0x6'));var attributes=require(_0xef3e('0x7'));module['exports']=function(_0x12000d,_0x4b3954){return _0x12000d['define'](_0xef3e('0x8'),attributes,{'tableName':_0xef3e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xef3e('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index c419d55..40b588e 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 _0x3e99=['body','options','raw','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','update'];(function(_0x10a781,_0x26dcd7){var _0x41d8ae=function(_0x14ad0c){while(--_0x14ad0c){_0x10a781['push'](_0x10a781['shift']());}};_0x41d8ae(++_0x26dcd7);}(_0x3e99,0xed));var _0x93e9=function(_0x4d2bee,_0x2960a6){_0x4d2bee=_0x4d2bee-0x0;var _0x22c9d6=_0x3e99[_0x4d2bee];return _0x22c9d6;};'use strict';var _=require('lodash');var util=require(_0x93e9('0x0'));var moment=require(_0x93e9('0x1'));var BPromise=require(_0x93e9('0x2'));var rs=require(_0x93e9('0x3'));var fs=require('fs');var Redis=require(_0x93e9('0x4'));var db=require(_0x93e9('0x5'))['db'];var utils=require(_0x93e9('0x6'));var logger=require(_0x93e9('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x93e9('0x8'));var client=jayson[_0x93e9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6ac8db,_0x34afdd,_0x3dd432){return new BPromise(function(_0x240dba,_0x4c5eba){return client[_0x93e9('0xa')](_0x6ac8db,_0x3dd432)[_0x93e9('0xb')](function(_0x55d4bc){logger[_0x93e9('0xc')](_0x93e9('0xd'),_0x34afdd,_0x93e9('0xe'));logger[_0x93e9('0xf')](_0x93e9('0x10'),_0x34afdd,'request\x20sent',JSON[_0x93e9('0x11')](_0x55d4bc));if(_0x55d4bc['error']){if(_0x55d4bc['error']['code']===0x1f4){logger[_0x93e9('0x12')](_0x93e9('0xd'),_0x34afdd,_0x55d4bc[_0x93e9('0x12')][_0x93e9('0x13')]);return _0x4c5eba(_0x55d4bc[_0x93e9('0x12')][_0x93e9('0x13')]);}logger[_0x93e9('0x12')](_0x93e9('0xd'),_0x34afdd,_0x55d4bc[_0x93e9('0x12')][_0x93e9('0x13')]);return _0x240dba(_0x55d4bc[_0x93e9('0x12')][_0x93e9('0x13')]);}else{logger[_0x93e9('0xc')]('FaxApplication,\x20%s,\x20%s',_0x34afdd,_0x93e9('0xe'));_0x240dba(_0x55d4bc[_0x93e9('0x14')][_0x93e9('0x13')]);}})[_0x93e9('0x15')](function(_0x6eed82){logger[_0x93e9('0x12')](_0x93e9('0xd'),_0x34afdd,_0x6eed82);_0x4c5eba(_0x6eed82);});});}exports[_0x93e9('0x16')]=function(_0x3ed72f){var _0x34bb6e=this;return new Promise(function(_0x2069b4,_0x402bd3){return db['FaxApplication'][_0x93e9('0x17')](_0x3ed72f[_0x93e9('0x18')],{'raw':_0x3ed72f[_0x93e9('0x19')]?_0x3ed72f['options'][_0x93e9('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ed72f[_0x93e9('0x19')]?_0x3ed72f[_0x93e9('0x19')]['where']||null:null,'attributes':_0x3ed72f[_0x93e9('0x19')]?_0x3ed72f['options'][_0x93e9('0x1b')]||null:null,'limit':_0x3ed72f['options']?_0x3ed72f[_0x93e9('0x19')][_0x93e9('0x1c')]||null:null})['then'](function(_0x5f58ab){logger['info'](_0x93e9('0x16'),_0x3ed72f);logger[_0x93e9('0xf')]('UpdateFaxApplication',_0x3ed72f,JSON['stringify'](_0x5f58ab));_0x2069b4(_0x5f58ab);})['catch'](function(_0x213933){logger[_0x93e9('0x12')](_0x93e9('0x16'),_0x213933[_0x93e9('0x13')],_0x3ed72f);_0x402bd3(_0x34bb6e[_0x93e9('0x12')](0x1f4,_0x213933[_0x93e9('0x13')]));});});}; \ No newline at end of file +var _0xff1f=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FaxApplication','body','raw','options','attributes','UpdateFaxApplication','catch','lodash','util'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0xff1f,0xd0));var _0xfff1=function(_0x53fe97,_0x544271){_0x53fe97=_0x53fe97-0x0;var _0x5c49a2=_0xff1f[_0x53fe97];return _0x5c49a2;};'use strict';var _=require(_0xfff1('0x0'));var util=require(_0xfff1('0x1'));var moment=require(_0xfff1('0x2'));var BPromise=require('bluebird');var rs=require(_0xfff1('0x3'));var fs=require('fs');var Redis=require(_0xfff1('0x4'));var db=require(_0xfff1('0x5'))['db'];var utils=require(_0xfff1('0x6'));var logger=require(_0xfff1('0x7'))(_0xfff1('0x8'));var config=require('../../config/environment');var jayson=require(_0xfff1('0x9'));var client=jayson[_0xfff1('0xa')][_0xfff1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xed3d34,_0x15c012,_0x1b2bbc){return new BPromise(function(_0x51190d,_0x1b6f24){return client[_0xfff1('0xc')](_0xed3d34,_0x1b2bbc)[_0xfff1('0xd')](function(_0xce0b8d){logger[_0xfff1('0xe')](_0xfff1('0xf'),_0x15c012,'request\x20sent');logger[_0xfff1('0x10')](_0xfff1('0x11'),_0x15c012,_0xfff1('0x12'),JSON[_0xfff1('0x13')](_0xce0b8d));if(_0xce0b8d[_0xfff1('0x14')]){if(_0xce0b8d[_0xfff1('0x14')][_0xfff1('0x15')]===0x1f4){logger[_0xfff1('0x14')](_0xfff1('0xf'),_0x15c012,_0xce0b8d[_0xfff1('0x14')][_0xfff1('0x16')]);return _0x1b6f24(_0xce0b8d['error'][_0xfff1('0x16')]);}logger[_0xfff1('0x14')](_0xfff1('0xf'),_0x15c012,_0xce0b8d[_0xfff1('0x14')]['message']);return _0x51190d(_0xce0b8d[_0xfff1('0x14')][_0xfff1('0x16')]);}else{logger[_0xfff1('0xe')](_0xfff1('0xf'),_0x15c012,'request\x20sent');_0x51190d(_0xce0b8d['result'][_0xfff1('0x16')]);}})['catch'](function(_0x1187d1){logger[_0xfff1('0x14')]('FaxApplication,\x20%s,\x20%s',_0x15c012,_0x1187d1);_0x1b6f24(_0x1187d1);});});}exports['UpdateFaxApplication']=function(_0x477cc5){var _0x2e7667=this;return new Promise(function(_0x342500,_0x86db6){return db[_0xfff1('0x17')]['update'](_0x477cc5[_0xfff1('0x18')],{'raw':_0x477cc5['options']?_0x477cc5['options'][_0xfff1('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x477cc5[_0xfff1('0x1a')]?_0x477cc5[_0xfff1('0x1a')]['where']||null:null,'attributes':_0x477cc5['options']?_0x477cc5[_0xfff1('0x1a')][_0xfff1('0x1b')]||null:null,'limit':_0x477cc5[_0xfff1('0x1a')]?_0x477cc5[_0xfff1('0x1a')]['limit']||null:null})['then'](function(_0x1c318c){logger[_0xfff1('0xe')](_0xfff1('0x1c'),_0x477cc5);logger[_0xfff1('0x10')](_0xfff1('0x1c'),_0x477cc5,JSON[_0xfff1('0x13')](_0x1c318c));_0x342500(_0x1c318c);})[_0xfff1('0x1d')](function(_0xb5b4a7){logger[_0xfff1('0x14')](_0xfff1('0x1c'),_0xb5b4a7['message'],_0x477cc5);_0x86db6(_0x2e7667['error'](0x1f4,_0xb5b4a7[_0xfff1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 5ec142b..b540349 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 _0x33c5=['destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x4ea16b,_0x4aee83){var _0x42312e=function(_0xd6a8d2){while(--_0xd6a8d2){_0x4ea16b['push'](_0x4ea16b['shift']());}};_0x42312e(++_0x4aee83);}(_0x33c5,0xe6));var _0x533c=function(_0x4d4f61,_0x56d7a7){_0x4d4f61=_0x4d4f61-0x0;var _0x297414=_0x33c5[_0x4d4f61];return _0x297414;};'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('./faxApplication.controller');router[_0x533c('0x7')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0x9')]);router[_0x533c('0x7')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0xb')]);router[_0x533c('0xc')]('/',auth[_0x533c('0x8')](),controller[_0x533c('0xd')]);router[_0x533c('0xe')](_0x533c('0xa'),auth[_0x533c('0x8')](),controller[_0x533c('0xf')]);router[_0x533c('0x10')](_0x533c('0xa'),auth['isAuthenticated'](),controller[_0x533c('0x11')]);module[_0x533c('0x12')]=router; \ No newline at end of file +var _0x7c09=['update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','/:id','isAuthenticated','show','post','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7c09,0x102));var _0x97c0=function(_0x360793,_0x5b20c9){_0x360793=_0x360793-0x0;var _0x1efcd0=_0x7c09[_0x360793];return _0x1efcd0;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x97c0('0x2'));var router=express[_0x97c0('0x3')]();var auth=require(_0x97c0('0x4'));var interaction=require(_0x97c0('0x5'));var config=require(_0x97c0('0x6'));var controller=require(_0x97c0('0x7'));router[_0x97c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x97c0('0x9'),auth[_0x97c0('0xa')](),controller[_0x97c0('0xb')]);router[_0x97c0('0xc')]('/',auth[_0x97c0('0xa')](),controller['create']);router[_0x97c0('0xd')]('/:id',auth[_0x97c0('0xa')](),controller[_0x97c0('0xe')]);router['delete']('/:id',auth[_0x97c0('0xa')](),controller[_0x97c0('0xf')]);module[_0x97c0('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 45dd568..9f3b658 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 _0xe018=['sequelize','exports','BOOLEAN','DATE','STRING','out'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe018,0x66));var _0x8e01=function(_0x844676,_0xabcc4e){_0x844676=_0x844676-0x0;var _0x14b776=_0xe018[_0x844676];return _0x14b776;};'use strict';var Sequelize=require(_0x8e01('0x0'));module[_0x8e01('0x1')]={'closed':{'type':Sequelize[_0x8e01('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8e01('0x3')]},'disposition':{'type':Sequelize[_0x8e01('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x8e01('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8e01('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8e01('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x0425=['STRING','ENUM','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0425,0x65));var _0x5042=function(_0x2225ac,_0x21969c){_0x2225ac=_0x2225ac-0x0;var _0x40325b=_0x0425[_0x2225ac];return _0x40325b;};'use strict';var Sequelize=require(_0x5042('0x0'));module[_0x5042('0x1')]={'closed':{'type':Sequelize[_0x5042('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5042('0x3')]},'disposition':{'type':Sequelize[_0x5042('0x4')]},'note':{'type':Sequelize[_0x5042('0x4')]},'read1stAt':{'type':Sequelize[_0x5042('0x3')]},'fax':{'type':Sequelize[_0x5042('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x5042('0x5')]('in',_0x5042('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5042('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5042('0x5')]('in',_0x5042('0x6')),'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 00181af..4f4c635 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 _0xadc9=['isNumeric','i.id\x20LIKE\x20?','i.fax\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','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','sequelize','count','toString','keyBy','a.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','all','rows','show','includeAll','merge','options','find','create','params','destroy','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','nolimit','YYYY-MM-DD\x20HH:mm:ss','include','findAll','setTags','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','sendStatus','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','status','json','limit','set','Content-Range','reject','save','update','then','end','stack','name','Users','map','fullname','Tags','split','forEach','push','TagIds','catch','FaxInteraction','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','select','field','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','body','start','some','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace'];(function(_0x1cafd7,_0x34e7e1){var _0x96f4d4=function(_0x4f9538){while(--_0x4f9538){_0x1cafd7['push'](_0x1cafd7['shift']());}};_0x96f4d4(++_0x34e7e1);}(_0xadc9,0x12a));var _0x9adc=function(_0x46e9f0,_0x41091a){_0x46e9f0=_0x46e9f0-0x0;var _0x115380=_0xadc9[_0x46e9f0];return _0x115380;};'use strict';var pdf=require(_0x9adc('0x0'));var emlformat=require(_0x9adc('0x1'));var rimraf=require(_0x9adc('0x2'));var zipdir=require(_0x9adc('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9adc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9adc('0x5'));var util=require(_0x9adc('0x6'));var path=require(_0x9adc('0x7'));var sox=require(_0x9adc('0x8'));var csv=require(_0x9adc('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9adc('0xa'));var squel=require('squel');var crypto=require(_0x9adc('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9adc('0x9'));var querystring=require(_0x9adc('0xc'));var Papa=require(_0x9adc('0xd'));var Redis=require(_0x9adc('0xe'));var authService=require(_0x9adc('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9adc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9adc('0x11'))('api');var utils=require(_0x9adc('0x12'));var config=require(_0x9adc('0x13'));var db=require(_0x9adc('0x14'))['db'];config[_0x9adc('0x15')]=_['defaults'](config[_0x9adc('0x15')],{'host':_0x9adc('0x16'),'port':0x18eb});var socket=require(_0x9adc('0x17'))(new Redis(config['redis']));require(_0x9adc('0x18'))['register'](socket);function respondWithStatusCode(_0x3072f8,_0x2a7225){_0x2a7225=_0x2a7225||0xcc;return function(_0x1264a7){if(_0x1264a7){return _0x3072f8['sendStatus'](_0x2a7225);}return _0x3072f8[_0x9adc('0x19')](_0x2a7225)['end']();};}function respondWithResult(_0x18b96c,_0xadf8c2){_0xadf8c2=_0xadf8c2||0xc8;return function(_0x556ff6){if(_0x556ff6){return _0x18b96c[_0x9adc('0x19')](_0xadf8c2)[_0x9adc('0x1a')](_0x556ff6);}};}function respondWithFilteredResult(_0x1e1056,_0xc21bca){return function(_0x41726e){if(_0x41726e){var _0x4e8747=_0x41726e['count'],_0x1ead12=_0xc21bca['offset'],_0x8ba066=_0xc21bca['offset']+_0xc21bca[_0x9adc('0x1b')],_0x50440a;if(_0x8ba066>=_0x4e8747){_0x8ba066=_0x4e8747;_0x50440a=0xc8;}else{_0x50440a=0xce;}_0x1e1056[_0x9adc('0x19')](_0x50440a);return _0x1e1056[_0x9adc('0x1c')](_0x9adc('0x1d'),_0x1ead12+'-'+_0x8ba066+'/'+_0x4e8747)['json'](_0x41726e);}return null;};}function patchUpdates(_0x31b5ae){return function(_0x35752a){try{jsonpatch['apply'](_0x35752a,_0x31b5ae,!![]);}catch(_0x1da797){return BPromise[_0x9adc('0x1e')](_0x1da797);}return _0x35752a[_0x9adc('0x1f')]();};}function saveUpdates(_0x49a04e,_0x406c0d){return function(_0x1f21bc){if(_0x1f21bc){return _0x1f21bc[_0x9adc('0x20')](_0x49a04e)[_0x9adc('0x21')](function(_0x164fff){return _0x164fff;});}return null;};}function removeEntity(_0x489217,_0x281aea){return function(_0x1912d3){if(_0x1912d3){return _0x1912d3['destroy']()[_0x9adc('0x21')](function(){_0x489217[_0x9adc('0x19')](0xcc)[_0x9adc('0x22')]();});}};}function handleEntityNotFound(_0x61885b,_0x69ba17){return function(_0x2831ee){if(!_0x2831ee){_0x61885b['sendStatus'](0x194);}return _0x2831ee;};}function handleError(_0x1e6779,_0xe9bb88){_0xe9bb88=_0xe9bb88||0x1f4;return function(_0x244a1d){logger['error'](_0x244a1d[_0x9adc('0x23')]);if(_0x244a1d[_0x9adc('0x24')]){delete _0x244a1d[_0x9adc('0x24')];}_0x1e6779[_0x9adc('0x19')](_0xe9bb88)['send'](_0x244a1d);};}function getInteractionUsers(_0xeb5f13,_0x470744){return new BPromise(function(_0x3e72cf,_0x43b5f2){try{if(_0x470744[_0xeb5f13['id']]){_0xeb5f13[_0x9adc('0x25')]=_[_0x9adc('0x26')](_0x470744[_0xeb5f13['id']],function(_0x13c512){return{'id':_0x13c512['id'],'fullname':_0x13c512[_0x9adc('0x27')]};});}}catch(_0x22db36){_0x43b5f2(_0x22db36);}_0x3e72cf(_0xeb5f13);});}function getInteractionTags(_0x1ceb4f,_0x57789e){return new BPromise(function(_0x43d2d6,_0x479352){try{if(_0x1ceb4f['TagIds']){_0x1ceb4f[_0x9adc('0x28')]=[];_0x1ceb4f['TagIds'][_0x9adc('0x29')](',')[_0x9adc('0x2a')](function(_0x286258){_0x1ceb4f[_0x9adc('0x28')][_0x9adc('0x2b')](_0x57789e[_0x286258]);});}delete _0x1ceb4f[_0x9adc('0x2c')];}catch(_0x1ad660){_0x479352(_0x1ad660);}_0x43d2d6(_0x1ceb4f);});}function updateFaxInteraction(_0x4095c5,_0x91df8f,_0x5ccd90){return new BPromise(function(_0x34d0f3,_0x28fa8d){return getInteractionUsers(_0x4095c5,_0x5ccd90)[_0x9adc('0x21')](function(_0x1efbaf){return getInteractionTags(_0x1efbaf,_0x91df8f);})['then'](function(_0x398d18){_0x34d0f3(_0x398d18);})[_0x9adc('0x2d')](function(_0x5dd079){_0x28fa8d(_0x5dd079);});});}exports['index']=function(_0x39894d,_0x27d906){var _0x52a7ac={},_0x39cd96={},_0x20c568={'count':0x0,'rows':[]};var _0x3f41bb=_[_0x9adc('0x26')](db[_0x9adc('0x2e')][_0x9adc('0x2f')],function(_0x12d67f){return{'name':_0x12d67f['fieldName'],'type':_0x12d67f['type'][_0x9adc('0x30')]};});_0x39cd96[_0x9adc('0x31')]=_[_0x9adc('0x26')](_0x3f41bb,_0x9adc('0x24'));_0x39cd96[_0x9adc('0x32')]=_[_0x9adc('0x33')](_0x39894d[_0x9adc('0x32')]);_0x39cd96[_0x9adc('0x34')]=_[_0x9adc('0x35')](_0x39cd96[_0x9adc('0x31')],_0x39cd96['query']);_0x52a7ac[_0x9adc('0x36')]=_[_0x9adc('0x35')](_0x39cd96[_0x9adc('0x31')],qs[_0x9adc('0x37')](_0x39894d[_0x9adc('0x32')][_0x9adc('0x37')]));_0x52a7ac['attributes']=_0x52a7ac[_0x9adc('0x36')][_0x9adc('0x38')]?_0x52a7ac['attributes']:_0x39cd96[_0x9adc('0x31')];if(!_0x39894d[_0x9adc('0x32')][_0x9adc('0x39')]('nolimit')){_0x52a7ac[_0x9adc('0x1b')]=qs[_0x9adc('0x1b')](_0x39894d[_0x9adc('0x32')]['limit']);_0x52a7ac[_0x9adc('0x3a')]=qs[_0x9adc('0x3a')](_0x39894d[_0x9adc('0x32')][_0x9adc('0x3a')]);}_0x52a7ac[_0x9adc('0x3b')]=qs[_0x9adc('0x3c')](_0x39894d[_0x9adc('0x32')]['sort']);_0x52a7ac[_0x9adc('0x3d')]=qs[_0x9adc('0x34')](_[_0x9adc('0x3e')](_0x39894d[_0x9adc('0x32')],_0x39cd96[_0x9adc('0x34')]));var _0x41c892=[];var _0x5ed810=squel[_0x9adc('0x3f')]()['field']('id')[_0x9adc('0x40')](_0x9adc('0x24'))['field']('color')[_0x9adc('0x41')](_0x9adc('0x42'));var _0x12af87=squel[_0x9adc('0x3f')]()[_0x9adc('0x40')](_0x9adc('0x43'))[_0x9adc('0x40')](_0x9adc('0x44'))[_0x9adc('0x40')](_0x9adc('0x45'))[_0x9adc('0x41')](_0x9adc('0x46'),'ui')[_0x9adc('0x47')]('users','u',_0x9adc('0x48'));var _0x116428=squel[_0x9adc('0x3f')]()[_0x9adc('0x41')](_0x9adc('0x49'),'i')[_0x9adc('0x47')](_0x9adc('0x4a'),'c',_0x9adc('0x4b'))['left_join'](_0x9adc('0x4c'),'o',_0x9adc('0x4d'))[_0x9adc('0x47')]('fax_accounts','a',_0x9adc('0x4e'))['left_join'](_0x9adc('0x4f'),'me',_0x9adc('0x50'))[_0x9adc('0x47')](_0x9adc('0x51'),'it',_0x9adc('0x52'))[_0x9adc('0x47')](_0x9adc('0x42'),'t',_0x9adc('0x53'));var _0xc0d9a=squel['expr']();var _0x14f7f5=[];var _0x49de8b=squel[_0x9adc('0x54')]();var _0x3f7f6e;if(_0x39894d[_0x9adc('0x32')][_0x9adc('0x55')]){_0x3f7f6e=as['parseSearch'](_0x39894d[_0x9adc('0x32')][_0x9adc('0x55')]);var _0x35824a=_0x3f7f6e[_0x9adc('0x56')];for(var _0x4f7fde=0x0;_0x4f7fde<_0x3f7f6e[_0x9adc('0x57')][_0x9adc('0x38')];_0x4f7fde++){var _0x5580f6=_0x3f7f6e[_0x9adc('0x57')][_0x4f7fde];var _0x44375b='i';var _0x38229b=_['find'](_0x3f41bb,[_0x9adc('0x24'),_0x5580f6[_0x9adc('0x40')]]);if(!_0x38229b){switch(_0x5580f6[_0x9adc('0x40')]){case _0x9adc('0x58'):if(_0x5580f6[_0x9adc('0x59')]==0x1){_0x116428[_0x9adc('0x5a')]('`'+_0x5580f6[_0x9adc('0x40')]+_0x9adc('0x5b'));}else{_0x116428[_0x9adc('0x5a')]('`'+_0x5580f6[_0x9adc('0x40')]+_0x9adc('0x5c'));}break;case _0x9adc('0x5d'):if(_0x5580f6[_0x9adc('0x5e')]===_0x9adc('0x5f')){if(_0x5580f6['value'][_0x9adc('0x29')]('\x20')['length']>0x1){_0xc0d9a[_0x35824a](_0x9adc('0x60'),qs[_0x9adc('0x61')](_0x5580f6['value']),null);}else{var _0x2646d9='%'+_0x5580f6[_0x9adc('0x59')]+'%';_0xc0d9a[_0x35824a](_0x9adc('0x62'),_0x2646d9,_0x2646d9,_0x2646d9);}}else{_0x38229b=_['find'](_0x3f41bb,['name','ContactId']);_0x5580f6['field']=_0x9adc('0x63');_0x46100f=as[_0x9adc('0x64')](_0x44375b,_0x38229b[_0x9adc('0x65')],_0x5580f6);_0xc0d9a[_0x35824a](_0x46100f[_0x9adc('0x66')],_0x46100f[_0x9adc('0x59')]['start'],_0x46100f[_0x9adc('0x59')][_0x9adc('0x22')]);}break;case _0x9adc('0x67'):var _0x3f7bdc=_0x5580f6[_0x9adc('0x59')]['split'](',')[_0x9adc('0x26')](function(_0x2e5aee){return Number(_0x2e5aee);});_0x3f7bdc['forEach'](function(_0x1d4957){_0x49de8b['or'](_0x9adc('0x68'),'%,'+_0x1d4957+',%');});_0x14f7f5=_[_0x9adc('0x69')](_0x14f7f5,_0x3f7bdc);break;case _0x9adc('0x6a'):if(_0x5580f6[_0x9adc('0x5e')]==='$substring'){_0xc0d9a[_0x35824a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5580f6[_0x9adc('0x59')]+'%',null);}else{_0x38229b=_['find'](_0x3f41bb,['name','UserId']);_0x5580f6['field']='UserId';_0x46100f=as[_0x9adc('0x64')](_0x44375b,_0x38229b[_0x9adc('0x65')],_0x5580f6);_0xc0d9a[_0x35824a](_0x46100f[_0x9adc('0x66')],_0x46100f[_0x9adc('0x59')]['start'],_0x46100f[_0x9adc('0x59')][_0x9adc('0x22')]);}break;case _0x9adc('0x6b'):_0x46100f=as['buildExpression']('me',null,_0x5580f6);_0xc0d9a[_0x35824a](_0x46100f[_0x9adc('0x66')],_0x46100f[_0x9adc('0x59')]['start'],_0x46100f[_0x9adc('0x59')]['end']);break;}}else{var _0x46100f=as['buildExpression'](_0x44375b,_0x38229b[_0x9adc('0x65')],_0x5580f6);_0xc0d9a[_0x35824a](_0x46100f[_0x9adc('0x66')],_0x46100f[_0x9adc('0x59')][_0x9adc('0x6c')],_0x46100f[_0x9adc('0x59')]['end']);}}}else{var _0x241cde=_(_0x39894d[_0x9adc('0x32')])[_0x9adc('0x33')]()[_0x9adc('0x26')](function(_0x5a563c){return _[_0x9adc('0x6d')](_0x3f41bb,[_0x9adc('0x24'),_0x5a563c])?_0x5a563c:undefined;})['compact']()[_0x9adc('0x59')]();if(!_[_0x9adc('0x6e')](_0x241cde)){_0x241cde[_0x9adc('0x2a')](function(_0x47fd75){if(_0x47fd75===_0x9adc('0x6f')){_0x116428[_0x9adc('0x3d')](_0x9adc('0x70'),[][_0x9adc('0x71')](_0x39894d['query'][_0x47fd75]));}else if(_0x47fd75==='createdAt'){var _0x2c0845=JSON[_0x9adc('0x72')](_0x39894d[_0x9adc('0x32')][_0x47fd75])[_0x9adc('0x73')];var _0x2aa754=JSON[_0x9adc('0x72')](_0x39894d[_0x9adc('0x32')][_0x47fd75])['$lte'];_0x116428['where'](_0x9adc('0x74'),_0x2c0845,_0x2aa754);}else{if(_0x39894d[_0x9adc('0x32')][_0x47fd75]===_0x9adc('0x75')){_0x116428[_0x9adc('0x3d')]('i.'+_0x47fd75+_0x9adc('0x76'));}else{_0x116428[_0x9adc('0x3d')]('i.'+_0x47fd75+'\x20=\x20?',_0x39894d[_0x9adc('0x32')][_0x47fd75]);}}});}if(_0x39894d[_0x9adc('0x32')][_0x9adc('0x77')]){if(_0x39894d[_0x9adc('0x32')][_0x9adc('0x77')]==0x1){_0x116428[_0x9adc('0x5a')](_0x9adc('0x78'));}else{_0x116428[_0x9adc('0x5a')](_0x9adc('0x79'));}}if(_0x39894d[_0x9adc('0x32')][_0x9adc('0x7a')]){_0x14f7f5=_[_0x9adc('0x7b')](_0x39894d[_0x9adc('0x32')]['tag'])?_0x39894d[_0x9adc('0x32')][_0x9adc('0x7a')]:new Array(_0x39894d[_0x9adc('0x32')][_0x9adc('0x7a')]);_0x14f7f5['forEach'](function(_0x278736){_0x49de8b['or'](_0x9adc('0x68'),'%,'+_0x278736+',%');});}if(_0x39894d[_0x9adc('0x32')][_0x9adc('0x7c')]){var _0x9c206=_0x39894d[_0x9adc('0x32')][_0x9adc('0x7c')]['replace']('\x5c','\x5c\x5c')[_0x9adc('0x7d')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x9adc('0x7e')](_0x9c206)){_0xc0d9a['or'](_0x9adc('0x7f'),_0x9c206+'%')['or'](_0x9adc('0x80'),_0x9c206+'%');}_0xc0d9a['or'](_0x9adc('0x81'),_0x9c206+'%');}}_0x116428[_0x9adc('0x3d')](_0xc0d9a);_0x116428[_0x9adc('0x82')](_0x9adc('0x83'));var _0x97aa21={'type':db[_0x9adc('0x84')][_0x9adc('0x85')][_0x9adc('0x86')],'raw':!![]};var _0x17b59b=_0x116428[_0x9adc('0x87')]();_0x17b59b[_0x9adc('0x40')](_0x9adc('0x83'));_0x17b59b[_0x9adc('0x40')](_0x9adc('0x88'),'unreadMessages');if(_0x52a7ac[_0x9adc('0x3b')]){_0x52a7ac[_0x9adc('0x3b')][_0x9adc('0x2a')](function(_0x7f8da4){_0x116428[_0x9adc('0x3b')]('i.'+_0x7f8da4[0x0],_0x7f8da4[0x1]===_0x9adc('0x89')?![]:!![]);});}if(!_['isEmpty'](_0x14f7f5)){_0x116428[_0x9adc('0x5a')](_0x49de8b);_0x17b59b[_0x9adc('0x3d')]('t.id\x20IN\x20?',_0x14f7f5);}BPromise[_0x9adc('0x8a')]()[_0x9adc('0x21')](function(){if(!_0x3f7f6e){if(_0x39894d[_0x9adc('0x32')][_0x9adc('0x6f')]||_0x39894d[_0x9adc('0x32')]['journey'])return;_0x17b59b['where'](_0x9adc('0x8b'));_0x116428[_0x9adc('0x3d')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x39894d[_0x9adc('0x8c')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x9adc('0x21')](function(_0x140d26){if(_[_0x9adc('0x6e')](_0x140d26)){_0x17b59b[_0x9adc('0x3d')](_0x9adc('0x8d'));_0x116428[_0x9adc('0x3d')](_0x9adc('0x8d'));}else{_0x17b59b[_0x9adc('0x3d')](_0x9adc('0x70'),_[_0x9adc('0x26')](_0x140d26,'id'));_0x116428[_0x9adc('0x3d')](_0x9adc('0x70'),_['map'](_0x140d26,'id'));}});})[_0x9adc('0x21')](function(){db[_0x9adc('0x8e')][_0x9adc('0x32')](_0x17b59b['toString'](),_0x97aa21)['then'](function(_0x1981f0){_0x20c568[_0x9adc('0x8f')]=_0x1981f0[_0x9adc('0x38')];if(_0x20c568[_0x9adc('0x8f')]===0x0)return[];return db[_0x9adc('0x8e')][_0x9adc('0x32')](_0x5ed810[_0x9adc('0x90')](),_0x97aa21)['then'](function(_0x2f3520){_0x41c892=_[_0x9adc('0x91')](_0x2f3520,'id');_0x97aa21=_['merge'](_0x97aa21,{'model':db[_0x9adc('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x39894d[_0x9adc('0x32')]['fields']){_0x52a7ac[_0x9adc('0x36')][_0x9adc('0x2a')](function(_0x29a192){_0x116428[_0x9adc('0x40')]('i.'+_0x29a192);});}else{_0x116428['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9adc('0x58'));_0x116428[_0x9adc('0x40')](_0x9adc('0x92'),'Account.key');_0x116428['field'](_0x9adc('0x93'),'Account.mandatoryDisposition');_0x116428['field'](_0x9adc('0x94'));_0x116428[_0x9adc('0x40')](_0x9adc('0x95'),_0x9adc('0x96'));_0x116428['field'](_0x9adc('0x97'),_0x9adc('0x98'));_0x116428[_0x9adc('0x40')]('c.email','Contact.email');_0x116428['field']('c.phone',_0x9adc('0x99'));_0x116428['field'](_0x9adc('0x9a'),_0x9adc('0x9b'));_0x116428['field']('c.fax',_0x9adc('0x9c'));_0x116428[_0x9adc('0x40')](_0x9adc('0x9d'),_0x9adc('0x9e'));_0x116428[_0x9adc('0x40')](_0x9adc('0x9f'),_0x9adc('0xa0'));_0x116428[_0x9adc('0x40')](_0x9adc('0xa1'),_0x9adc('0x2c'));}_0x116428['limit'](_0x52a7ac[_0x9adc('0x1b')]);_0x116428[_0x9adc('0x3a')](_0x52a7ac['offset']);return db[_0x9adc('0x8e')][_0x9adc('0x32')](_0x116428[_0x9adc('0x90')](),_0x97aa21);})[_0x9adc('0x21')](function(_0x35d6bc){_0x12af87[_0x9adc('0x3d')](_0x9adc('0xa2'),_[_0x9adc('0x26')](_0x35d6bc,'id'));return db[_0x9adc('0x8e')][_0x9adc('0x32')](_0x12af87[_0x9adc('0x90')](),_0x97aa21)[_0x9adc('0x21')](function(_0xc2f6a1){var _0x564f4c=_['groupBy'](_0xc2f6a1,_0x9adc('0xa3'));var _0x211c24=[];_0x35d6bc[_0x9adc('0x2a')](function(_0x338bd7){_0x211c24[_0x9adc('0x2b')](updateFaxInteraction(_0x338bd7,_0x41c892,_0x564f4c));});return BPromise[_0x9adc('0xa4')](_0x211c24);});});})[_0x9adc('0x21')](function(_0x1da4d4){_0x20c568[_0x9adc('0xa5')]=_0x1da4d4;return _0x20c568;})[_0x9adc('0x21')](respondWithFilteredResult(_0x27d906,_0x52a7ac));})[_0x9adc('0x2d')](handleError(_0x27d906,null));};exports[_0x9adc('0xa6')]=function(_0x11b488,_0x5c1531){var _0x148da8={'raw':![],'where':{'id':_0x11b488['params']['id']}},_0x4ac6b1={};_0x4ac6b1['model']=_[_0x9adc('0x33')](db['FaxInteraction'][_0x9adc('0x2f')]);_0x4ac6b1[_0x9adc('0x32')]=_['keys'](_0x11b488[_0x9adc('0x32')]);_0x4ac6b1[_0x9adc('0x34')]=_['intersection'](_0x4ac6b1['model'],_0x4ac6b1[_0x9adc('0x32')]);_0x148da8['attributes']=_[_0x9adc('0x35')](_0x4ac6b1[_0x9adc('0x31')],qs[_0x9adc('0x37')](_0x11b488[_0x9adc('0x32')][_0x9adc('0x37')]));_0x148da8[_0x9adc('0x36')]=_0x148da8[_0x9adc('0x36')][_0x9adc('0x38')]?_0x148da8[_0x9adc('0x36')]:_0x4ac6b1[_0x9adc('0x31')];if(_0x11b488[_0x9adc('0x32')][_0x9adc('0xa7')]){_0x148da8['include']=[{'all':!![]}];}_0x148da8=_[_0x9adc('0xa8')]({},_0x148da8,_0x11b488[_0x9adc('0xa9')]);return db['FaxInteraction'][_0x9adc('0xaa')](_0x148da8)[_0x9adc('0x21')](handleEntityNotFound(_0x5c1531,null))[_0x9adc('0x21')](respondWithResult(_0x5c1531,null))[_0x9adc('0x2d')](handleError(_0x5c1531,null));};exports[_0x9adc('0xab')]=function(_0x40fa15,_0x338e03){return db['FaxInteraction'][_0x9adc('0xab')](_0x40fa15['body'],{})[_0x9adc('0x21')](respondWithResult(_0x338e03,0xc9))[_0x9adc('0x2d')](handleError(_0x338e03,null));};exports[_0x9adc('0x20')]=function(_0x4f01e3,_0x5d4186){if(_0x4f01e3['body']['id']){delete _0x4f01e3[_0x9adc('0x6b')]['id'];}return db[_0x9adc('0x2e')][_0x9adc('0xaa')]({'where':{'id':_0x4f01e3[_0x9adc('0xac')]['id']}})[_0x9adc('0x21')](handleEntityNotFound(_0x5d4186,null))[_0x9adc('0x21')](saveUpdates(_0x4f01e3['body'],null))[_0x9adc('0x21')](respondWithResult(_0x5d4186,null))['catch'](handleError(_0x5d4186,null));};exports[_0x9adc('0xad')]=function(_0x475b02,_0x35b511){return db[_0x9adc('0x2e')]['find']({'where':{'id':_0x475b02[_0x9adc('0xac')]['id']}})['then'](handleEntityNotFound(_0x35b511,null))[_0x9adc('0x21')](removeEntity(_0x35b511,null))[_0x9adc('0x2d')](handleError(_0x35b511,null));};exports['describe']=function(_0x339adc,_0x35db4a){return db[_0x9adc('0x2e')][_0x9adc('0xae')]()['then'](respondWithResult(_0x35db4a,null))[_0x9adc('0x2d')](handleError(_0x35db4a,null));};exports['addMessage']=function(_0x2cbcf2,_0x1fbfc2,_0xe63f8a){return db[_0x9adc('0xaf')][_0x9adc('0xaa')]({'where':{'id':_0x2cbcf2[_0x9adc('0xac')]['id']}})['then'](handleEntityNotFound(_0x1fbfc2,null))[_0x9adc('0x21')](function(_0x4dd088){if(_0x4dd088){return _0x4dd088[_0x9adc('0xb0')](_0x2cbcf2['body'][_0x9adc('0xb1')],_[_0x9adc('0xb2')](_0x2cbcf2[_0x9adc('0x6b')],[_0x9adc('0xb1'),'id'])||{});}})[_0x9adc('0x21')](respondWithResult(_0x1fbfc2,null))[_0x9adc('0x2d')](handleError(_0x1fbfc2,null));};exports[_0x9adc('0xb3')]=function(_0x5f57ec,_0x2e6372,_0x3cd521){var _0x20e511={'raw':![],'where':{}};var _0x32fc82={};var _0xc6a2bc={'count':0x0,'rows':[]};return db[_0x9adc('0x2e')][_0x9adc('0xb4')]({'where':{'id':_0x5f57ec['params']['id']}})[_0x9adc('0x21')](handleEntityNotFound(_0x2e6372,null))[_0x9adc('0x21')](function(_0x1a3a3d){if(_0x1a3a3d){_0x32fc82['model']=_[_0x9adc('0x33')](db['FaxMessage']['rawAttributes']);_0x32fc82[_0x9adc('0x32')]=_['keys'](_0x5f57ec[_0x9adc('0x32')]);_0x32fc82[_0x9adc('0x34')]=_[_0x9adc('0x35')](_0x32fc82[_0x9adc('0x31')],_0x32fc82[_0x9adc('0x32')]);_0x20e511[_0x9adc('0x36')]=_[_0x9adc('0x35')](_0x32fc82[_0x9adc('0x31')],qs[_0x9adc('0x37')](_0x5f57ec[_0x9adc('0x32')][_0x9adc('0x37')]));_0x20e511['attributes']=_0x20e511[_0x9adc('0x36')][_0x9adc('0x38')]?_0x20e511[_0x9adc('0x36')]:_0x32fc82[_0x9adc('0x31')];if(!_0x5f57ec[_0x9adc('0x32')][_0x9adc('0x39')](_0x9adc('0xb5'))){_0x20e511[_0x9adc('0x1b')]=qs[_0x9adc('0x1b')](_0x5f57ec[_0x9adc('0x32')][_0x9adc('0x1b')]);_0x20e511[_0x9adc('0x3a')]=qs[_0x9adc('0x3a')](_0x5f57ec['query']['offset']);}_0x20e511[_0x9adc('0x3b')]=qs[_0x9adc('0x3c')](_0x5f57ec[_0x9adc('0x32')][_0x9adc('0x3c')]);_0x20e511[_0x9adc('0x3d')]=qs['filters'](_['pick'](_0x5f57ec[_0x9adc('0x32')],_0x32fc82[_0x9adc('0x34')]));_0x20e511[_0x9adc('0x3d')][_0x9adc('0xa3')]=_0x1a3a3d['id'];if(_0x5f57ec[_0x9adc('0x32')]['filter']){_0x20e511[_0x9adc('0x3d')]=_['merge'](_0x20e511['where'],{'$or':_[_0x9adc('0x26')](_0x20e511[_0x9adc('0x36')],function(_0x4fe018){var _0x50d8ef={};_0x50d8ef[_0x4fe018]={'$like':'%'+_0x5f57ec[_0x9adc('0x32')][_0x9adc('0x7c')]+'%'};return _0x50d8ef;})});}if(_0x5f57ec[_0x9adc('0x32')][_0x9adc('0x73')]){var _0x5312b0=_0x5f57ec[_0x9adc('0x32')]['$gte'][_0x9adc('0x29')](',');var _0x5a3ea2={};_0x5a3ea2[_0x5312b0[0x0]]={'$gte':moment(_0x5312b0[0x1])['format'](_0x9adc('0xb6'))};_0x20e511[_0x9adc('0x3d')]=_[_0x9adc('0xa8')](_0x20e511['where'],_0x5a3ea2);}_0x20e511=_[_0x9adc('0xa8')]({},_0x20e511,_0x5f57ec[_0x9adc('0xa9')]);return db[_0x9adc('0xaf')][_0x9adc('0x8f')]({'where':_0x20e511[_0x9adc('0x3d')]})['then'](function(_0x26b5eb){_0xc6a2bc[_0x9adc('0x8f')]=_0x26b5eb;if(_0x5f57ec[_0x9adc('0x32')][_0x9adc('0xa7')]){_0x20e511[_0x9adc('0xb7')]=[{'all':!![]}];}return db[_0x9adc('0xaf')][_0x9adc('0xb8')](_0x20e511);})[_0x9adc('0x21')](function(_0x5db283){_0xc6a2bc[_0x9adc('0xa5')]=_0x5db283;return _0xc6a2bc;});}})['then'](respondWithFilteredResult(_0x2e6372,_0x20e511))['catch'](handleError(_0x2e6372,null));};exports['addTags']=function(_0x4680f6,_0x492762,_0x4a463e){return db[_0x9adc('0x2e')][_0x9adc('0xaa')]({'where':{'id':_0x4680f6[_0x9adc('0xac')]['id']}})[_0x9adc('0x21')](handleEntityNotFound(_0x492762,null))[_0x9adc('0x21')](function(_0x21e007){if(_0x21e007){return _0x21e007[_0x9adc('0xb9')](_0x4680f6[_0x9adc('0x6b')][_0x9adc('0xb1')],_[_0x9adc('0xb2')](_0x4680f6['body'],[_0x9adc('0xb1'),'id'])||{})[_0x9adc('0xba')](function(){return db['Tag']['findAll']({'attributes':['id',_0x9adc('0x24'),_0x9adc('0xbb')],'where':{'id':_0x4680f6[_0x9adc('0x6b')]['ids']}});})[_0x9adc('0x21')](function(_0x349865){socket[_0x9adc('0xbc')](_0x9adc('0xbd'),{'id':Number(_0x4680f6['params']['id']),'tags':_0x349865||[]});return{'id':Number(_0x4680f6[_0x9adc('0xac')]['id']),'tags':_0x349865||[]};});}})['then'](respondWithResult(_0x492762,null))[_0x9adc('0x2d')](handleError(_0x492762,null));};exports[_0x9adc('0xbe')]=function(_0x14735a,_0x396231,_0x3f9b42){return db[_0x9adc('0x2e')][_0x9adc('0xaa')]({'where':{'id':_0x14735a['params']['id']}})[_0x9adc('0x21')](handleEntityNotFound(_0x396231,null))[_0x9adc('0x21')](function(_0x3dceea){if(_0x3dceea){return _0x3dceea[_0x9adc('0xbe')](_0x14735a[_0x9adc('0x32')][_0x9adc('0xb1')]);}})['then'](respondWithStatusCode(_0x396231,null))['catch'](handleError(_0x396231,null));};exports[_0x9adc('0xbf')]=function(_0xd753bd,_0x2fee9b){var _0x1d52c0=moment()[_0x9adc('0xc0')]()[_0x9adc('0x90')]();var _0x366bef=path[_0x9adc('0xc1')](config[_0x9adc('0xc2')],_0x9adc('0xc3'),_0x9adc('0xc4'),'tmp');var _0xf1a168=path[_0x9adc('0xc1')](config[_0x9adc('0xc2')],_0x9adc('0xc3'),_0x9adc('0xc4'),_0x9adc('0xc5'));var _0x5be0b6=path[_0x9adc('0xc1')](_0x366bef,_0x1d52c0);var _0x51b379=util[_0x9adc('0xc6')](_0x9adc('0xc7'),_0xd753bd[_0x9adc('0xac')]['id'],_0x1d52c0);var _0x52e7d8=path['join'](_0x366bef,_0x51b379);var _0x4e19c6=[];_0x4e19c6['push']({'model':db[_0x9adc('0xc8')],'as':_0x9adc('0xc8'),'raw':!![]});var _0x2688eb=[{'model':db[_0x9adc('0xaf')],'as':_0x9adc('0xc9'),'attributes':['id',_0x9adc('0x6b'),_0x9adc('0xca')],'include':_0x4e19c6}];return db['FaxInteraction']['find']({'where':{'id':_0xd753bd[_0x9adc('0xac')]['id']},'include':_0x2688eb})[_0x9adc('0x21')](handleEntityNotFound(_0x2fee9b,null))[_0x9adc('0x21')](function(_0x177d17){if(_0x177d17&&_0x177d17[_0x9adc('0xc9')]){var _0xa17bae=_0x177d17['get']({'plain':!![]});fs['mkdirSync'](_0x5be0b6);for(var _0x1d5d45=0x0;_0x1d5d45<_0xa17bae[_0x9adc('0xc9')][_0x9adc('0x38')];_0x1d5d45++){var _0x34999d=_0xa17bae['Messages'][_0x1d5d45][_0x9adc('0xc8')];if(_0x34999d){var _0x16cc14=path[_0x9adc('0xc1')](_0xf1a168,_0x34999d[_0x9adc('0xcb')]);if(fs[_0x9adc('0xcc')](_0x16cc14)){fs[_0x9adc('0xcd')](_0x16cc14)[_0x9adc('0xce')](fs[_0x9adc('0xcf')](path[_0x9adc('0xc1')](_0x5be0b6,_0x34999d['basename'])));}}}return BPromise[_0x9adc('0x8a')]()[_0x9adc('0x21')](function(){return new BPromise(function(_0x2a7271,_0x4a9554){zipdir(_0x5be0b6,{'saveTo':_0x52e7d8},function(_0x2408e2,_0x596fa6){if(_0x2408e2)return _0x4a9554(_0x2408e2);return _0x2a7271(_0x596fa6);});})[_0x9adc('0x21')](function(){return new BPromise(function(_0x53352e,_0x124567){rimraf(_0x5be0b6,function(_0x57d701){if(_0x57d701)_0x124567(_0x57d701);return _0x53352e();});});})['then'](function(){return _0x2fee9b['download'](_0x52e7d8,_0x51b379,function(_0x5472fd){if(_0x5472fd){console[_0x9adc('0xd0')](_0x9adc('0xd1'),_0x5472fd);}else{fs[_0x9adc('0xd2')](_0x52e7d8);}});});});}else{return _0x2fee9b[_0x9adc('0xd3')](0xc8);}})[_0x9adc('0x2d')](handleError(_0x2fee9b,null));}; \ No newline at end of file +var _0x1a6e=['sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','split','forEach','Tags','push','index','FaxInteraction','fieldName','key','keys','query','filters','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','left_join','users','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','body','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','clone','unreadMessages','DESC','t.id\x20IN\x20?','resolve','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','c.email','c.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','rows','catch','params','rawAttributes','includeAll','include','options','describe','addMessage','ids','omit','findOne','FaxMessage','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','removeTags','download','unix','root','files','join','server','attachments','format','transcript-%d-%s.zip','Messages','mkdirSync','basename','createReadStream','createWriteStream','err','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x2e4576,_0x348ac1){var _0x84ebf9=function(_0x248089){while(--_0x248089){_0x2e4576['push'](_0x2e4576['shift']());}};_0x84ebf9(++_0x348ac1);}(_0x1a6e,0x193));var _0xe1a6=function(_0xda6d0f,_0x35e271){_0xda6d0f=_0xda6d0f-0x0;var _0x244540=_0x1a6e[_0xda6d0f];return _0x244540;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe1a6('0x0'));var jsonpatch=require(_0xe1a6('0x1'));var rp=require(_0xe1a6('0x2'));var moment=require(_0xe1a6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe1a6('0x4'));var util=require(_0xe1a6('0x5'));var path=require(_0xe1a6('0x6'));var sox=require(_0xe1a6('0x7'));var csv=require('to-csv');var ejs=require(_0xe1a6('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe1a6('0x9'));var crypto=require(_0xe1a6('0xa'));var jsforce=require(_0xe1a6('0xb'));var deskjs=require(_0xe1a6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe1a6('0xd'));var Papa=require(_0xe1a6('0xe'));var Redis=require(_0xe1a6('0xf'));var authService=require(_0xe1a6('0x10'));var qs=require(_0xe1a6('0x11'));var as=require(_0xe1a6('0x12'));var hardwareService=require(_0xe1a6('0x13'));var logger=require('../../config/logger')(_0xe1a6('0x14'));var utils=require('../../config/utils');var config=require(_0xe1a6('0x15'));var db=require(_0xe1a6('0x16'))['db'];config[_0xe1a6('0x17')]=_[_0xe1a6('0x18')](config[_0xe1a6('0x17')],{'host':_0xe1a6('0x19'),'port':0x18eb});var socket=require(_0xe1a6('0x1a'))(new Redis(config['redis']));require(_0xe1a6('0x1b'))['register'](socket);function respondWithStatusCode(_0x2a0670,_0x4ef256){_0x4ef256=_0x4ef256||0xcc;return function(_0x18b820){if(_0x18b820){return _0x2a0670[_0xe1a6('0x1c')](_0x4ef256);}return _0x2a0670[_0xe1a6('0x1d')](_0x4ef256)[_0xe1a6('0x1e')]();};}function respondWithResult(_0x5279a8,_0x35f6e2){_0x35f6e2=_0x35f6e2||0xc8;return function(_0x537bc5){if(_0x537bc5){return _0x5279a8[_0xe1a6('0x1d')](_0x35f6e2)[_0xe1a6('0x1f')](_0x537bc5);}};}function respondWithFilteredResult(_0xe197f5,_0x2bbe01){return function(_0x2eb5b2){if(_0x2eb5b2){var _0x2a9de7=_0x2eb5b2[_0xe1a6('0x20')],_0x5ba228=_0x2bbe01[_0xe1a6('0x21')],_0x5a898e=_0x2bbe01[_0xe1a6('0x21')]+_0x2bbe01[_0xe1a6('0x22')],_0x320456;if(_0x5a898e>=_0x2a9de7){_0x5a898e=_0x2a9de7;_0x320456=0xc8;}else{_0x320456=0xce;}_0xe197f5[_0xe1a6('0x1d')](_0x320456);return _0xe197f5[_0xe1a6('0x23')](_0xe1a6('0x24'),_0x5ba228+'-'+_0x5a898e+'/'+_0x2a9de7)['json'](_0x2eb5b2);}return null;};}function patchUpdates(_0x2fd577){return function(_0x3e2595){try{jsonpatch[_0xe1a6('0x25')](_0x3e2595,_0x2fd577,!![]);}catch(_0x1d3930){return BPromise[_0xe1a6('0x26')](_0x1d3930);}return _0x3e2595['save']();};}function saveUpdates(_0x58b859,_0x4d14f1){return function(_0x541368){if(_0x541368){return _0x541368[_0xe1a6('0x27')](_0x58b859)[_0xe1a6('0x28')](function(_0x547635){return _0x547635;});}return null;};}function removeEntity(_0x22b24e,_0x40bae0){return function(_0x392242){if(_0x392242){return _0x392242[_0xe1a6('0x29')]()[_0xe1a6('0x28')](function(){_0x22b24e[_0xe1a6('0x1d')](0xcc)[_0xe1a6('0x1e')]();});}};}function handleEntityNotFound(_0x24a4f5,_0x25bc53){return function(_0x4305ec){if(!_0x4305ec){_0x24a4f5[_0xe1a6('0x1c')](0x194);}return _0x4305ec;};}function handleError(_0x2c282d,_0xba56df){_0xba56df=_0xba56df||0x1f4;return function(_0xc33d9){logger[_0xe1a6('0x2a')](_0xc33d9[_0xe1a6('0x2b')]);if(_0xc33d9[_0xe1a6('0x2c')]){delete _0xc33d9[_0xe1a6('0x2c')];}_0x2c282d[_0xe1a6('0x1d')](_0xba56df)[_0xe1a6('0x2d')](_0xc33d9);};}function getInteractionUsers(_0x40f37a,_0x2dfeac){return new BPromise(function(_0x586d77,_0x12818e){try{if(_0x2dfeac[_0x40f37a['id']]){_0x40f37a[_0xe1a6('0x2e')]=_[_0xe1a6('0x2f')](_0x2dfeac[_0x40f37a['id']],function(_0x1c5f62){return{'id':_0x1c5f62['id'],'fullname':_0x1c5f62[_0xe1a6('0x30')]};});}}catch(_0x46347d){_0x12818e(_0x46347d);}_0x586d77(_0x40f37a);});}function getInteractionTags(_0x3fd900,_0x49fc8e){return new BPromise(function(_0x46dd6b,_0x1bd7b5){try{if(_0x3fd900[_0xe1a6('0x31')]){_0x3fd900['Tags']=[];_0x3fd900['TagIds'][_0xe1a6('0x32')](',')[_0xe1a6('0x33')](function(_0x3d57f7){_0x3fd900[_0xe1a6('0x34')][_0xe1a6('0x35')](_0x49fc8e[_0x3d57f7]);});}delete _0x3fd900[_0xe1a6('0x31')];}catch(_0x371320){_0x1bd7b5(_0x371320);}_0x46dd6b(_0x3fd900);});}function updateFaxInteraction(_0x3db2a0,_0x37785a,_0x53bf1b){return new BPromise(function(_0x19962b,_0x136f4b){return getInteractionUsers(_0x3db2a0,_0x53bf1b)[_0xe1a6('0x28')](function(_0x3115df){return getInteractionTags(_0x3115df,_0x37785a);})[_0xe1a6('0x28')](function(_0x2ebfe6){_0x19962b(_0x2ebfe6);})['catch'](function(_0x24dc54){_0x136f4b(_0x24dc54);});});}exports[_0xe1a6('0x36')]=function(_0x1ca367,_0x34a59e){var _0x11350a={},_0x5261c8={},_0x2beed0={'count':0x0,'rows':[]};var _0x58e833=_[_0xe1a6('0x2f')](db[_0xe1a6('0x37')]['rawAttributes'],function(_0xaead8f){return{'name':_0xaead8f[_0xe1a6('0x38')],'type':_0xaead8f['type'][_0xe1a6('0x39')]};});_0x5261c8['model']=_[_0xe1a6('0x2f')](_0x58e833,_0xe1a6('0x2c'));_0x5261c8['query']=_[_0xe1a6('0x3a')](_0x1ca367[_0xe1a6('0x3b')]);_0x5261c8[_0xe1a6('0x3c')]=_['intersection'](_0x5261c8[_0xe1a6('0x3d')],_0x5261c8[_0xe1a6('0x3b')]);_0x11350a[_0xe1a6('0x3e')]=_[_0xe1a6('0x3f')](_0x5261c8[_0xe1a6('0x3d')],qs['fields'](_0x1ca367[_0xe1a6('0x3b')]['fields']));_0x11350a['attributes']=_0x11350a[_0xe1a6('0x3e')][_0xe1a6('0x40')]?_0x11350a[_0xe1a6('0x3e')]:_0x5261c8[_0xe1a6('0x3d')];if(!_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x41')](_0xe1a6('0x42'))){_0x11350a[_0xe1a6('0x22')]=qs[_0xe1a6('0x22')](_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x22')]);_0x11350a[_0xe1a6('0x21')]=qs[_0xe1a6('0x21')](_0x1ca367['query'][_0xe1a6('0x21')]);}_0x11350a[_0xe1a6('0x43')]=qs[_0xe1a6('0x44')](_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x44')]);_0x11350a[_0xe1a6('0x45')]=qs[_0xe1a6('0x3c')](_[_0xe1a6('0x46')](_0x1ca367['query'],_0x5261c8['filters']));var _0x384cde=[];var _0x112821=squel[_0xe1a6('0x47')]()[_0xe1a6('0x48')]('id')[_0xe1a6('0x48')](_0xe1a6('0x2c'))[_0xe1a6('0x48')](_0xe1a6('0x49'))[_0xe1a6('0x4a')](_0xe1a6('0x4b'));var _0xff4fa9=squel[_0xe1a6('0x47')]()[_0xe1a6('0x48')](_0xe1a6('0x4c'))[_0xe1a6('0x48')](_0xe1a6('0x4d'))[_0xe1a6('0x48')](_0xe1a6('0x4e'))['from']('user_has_fax_interactions','ui')[_0xe1a6('0x4f')](_0xe1a6('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x2d3544=squel[_0xe1a6('0x47')]()['from'](_0xe1a6('0x51'),'i')[_0xe1a6('0x4f')](_0xe1a6('0x52'),'c',_0xe1a6('0x53'))['left_join'](_0xe1a6('0x50'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xe1a6('0x54'),'a',_0xe1a6('0x55'))[_0xe1a6('0x4f')](_0xe1a6('0x56'),'me',_0xe1a6('0x57'))[_0xe1a6('0x4f')]('fax_interaction_has_tags','it',_0xe1a6('0x58'))[_0xe1a6('0x4f')](_0xe1a6('0x4b'),'t',_0xe1a6('0x59'));var _0x231f8b=squel[_0xe1a6('0x5a')]();var _0x281948=[];var _0x363ff6=squel[_0xe1a6('0x5a')]();var _0x492c87;if(_0x1ca367[_0xe1a6('0x3b')]['search']){_0x492c87=as[_0xe1a6('0x5b')](_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x5c')]);var _0x369b12=_0x492c87[_0xe1a6('0x5d')];for(var _0x7d89eb=0x0;_0x7d89eb<_0x492c87[_0xe1a6('0x5e')][_0xe1a6('0x40')];_0x7d89eb++){var _0x2f544a=_0x492c87[_0xe1a6('0x5e')][_0x7d89eb];var _0x5ce466='i';var _0x3867af=_[_0xe1a6('0x5f')](_0x58e833,['name',_0x2f544a[_0xe1a6('0x48')]]);if(!_0x3867af){switch(_0x2f544a[_0xe1a6('0x48')]){case'unreadMessages':if(_0x2f544a[_0xe1a6('0x60')]==0x1){_0x2d3544[_0xe1a6('0x61')]('`'+_0x2f544a[_0xe1a6('0x48')]+_0xe1a6('0x62'));}else{_0x2d3544['having']('`'+_0x2f544a['field']+_0xe1a6('0x63'));}break;case _0xe1a6('0x64'):if(_0x2f544a['operator']===_0xe1a6('0x65')){if(_0x2f544a[_0xe1a6('0x60')][_0xe1a6('0x32')]('\x20')['length']>0x1){_0x231f8b[_0x369b12](_0xe1a6('0x66'),qs[_0xe1a6('0x67')](_0x2f544a['value']),null);}else{var _0x9e806d='%'+_0x2f544a['value']+'%';_0x231f8b[_0x369b12]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x9e806d,_0x9e806d,_0x9e806d);}}else{_0x3867af=_[_0xe1a6('0x5f')](_0x58e833,[_0xe1a6('0x2c'),_0xe1a6('0x68')]);_0x2f544a['field']=_0xe1a6('0x68');_0x226369=as[_0xe1a6('0x69')](_0x5ce466,_0x3867af[_0xe1a6('0x6a')],_0x2f544a);_0x231f8b[_0x369b12](_0x226369[_0xe1a6('0x6b')],_0x226369[_0xe1a6('0x60')][_0xe1a6('0x6c')],_0x226369[_0xe1a6('0x60')][_0xe1a6('0x1e')]);}break;case _0xe1a6('0x6d'):var _0x395aad=_0x2f544a['value'][_0xe1a6('0x32')](',')[_0xe1a6('0x2f')](function(_0x26067b){return Number(_0x26067b);});_0x395aad[_0xe1a6('0x33')](function(_0x3c0f13){_0x363ff6['or'](_0xe1a6('0x6e'),'%,'+_0x3c0f13+',%');});_0x281948=_[_0xe1a6('0x6f')](_0x281948,_0x395aad);break;case _0xe1a6('0x70'):if(_0x2f544a[_0xe1a6('0x71')]===_0xe1a6('0x65')){_0x231f8b[_0x369b12]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x2f544a[_0xe1a6('0x60')]+'%',null);}else{_0x3867af=_[_0xe1a6('0x5f')](_0x58e833,['name',_0xe1a6('0x72')]);_0x2f544a['field']='UserId';_0x226369=as[_0xe1a6('0x69')](_0x5ce466,_0x3867af[_0xe1a6('0x6a')],_0x2f544a);_0x231f8b[_0x369b12](_0x226369[_0xe1a6('0x6b')],_0x226369[_0xe1a6('0x60')][_0xe1a6('0x6c')],_0x226369['value']['end']);}break;case _0xe1a6('0x73'):_0x226369=as[_0xe1a6('0x69')]('me',null,_0x2f544a);_0x231f8b[_0x369b12](_0x226369[_0xe1a6('0x6b')],_0x226369['value'][_0xe1a6('0x6c')],_0x226369[_0xe1a6('0x60')]['end']);break;}}else{var _0x226369=as[_0xe1a6('0x69')](_0x5ce466,_0x3867af[_0xe1a6('0x6a')],_0x2f544a);_0x231f8b[_0x369b12](_0x226369[_0xe1a6('0x6b')],_0x226369[_0xe1a6('0x60')][_0xe1a6('0x6c')],_0x226369[_0xe1a6('0x60')][_0xe1a6('0x1e')]);}}}else{var _0xfe2710=_(_0x1ca367['query'])[_0xe1a6('0x3a')]()['map'](function(_0x103214){return _['some'](_0x58e833,[_0xe1a6('0x2c'),_0x103214])?_0x103214:undefined;})['compact']()[_0xe1a6('0x60')]();if(!_[_0xe1a6('0x74')](_0xfe2710)){_0xfe2710[_0xe1a6('0x33')](function(_0x437af4){if(_0x437af4===_0xe1a6('0x75')){_0x2d3544[_0xe1a6('0x45')](_0xe1a6('0x76'),[]['concat'](_0x1ca367[_0xe1a6('0x3b')][_0x437af4]));}else if(_0x437af4===_0xe1a6('0x77')){var _0x113430=JSON[_0xe1a6('0x78')](_0x1ca367[_0xe1a6('0x3b')][_0x437af4])[_0xe1a6('0x79')];var _0x127a9a=JSON[_0xe1a6('0x78')](_0x1ca367[_0xe1a6('0x3b')][_0x437af4])[_0xe1a6('0x7a')];_0x2d3544[_0xe1a6('0x45')](_0xe1a6('0x7b'),_0x113430,_0x127a9a);}else{if(_0x1ca367[_0xe1a6('0x3b')][_0x437af4]===_0xe1a6('0x7c')){_0x2d3544['where']('i.'+_0x437af4+_0xe1a6('0x7d'));}else{_0x2d3544[_0xe1a6('0x45')]('i.'+_0x437af4+_0xe1a6('0x7e'),_0x1ca367[_0xe1a6('0x3b')][_0x437af4]);}}});}if(_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x7f')]){if(_0x1ca367['query'][_0xe1a6('0x7f')]==0x1){_0x2d3544[_0xe1a6('0x61')]('`unreadMessages`\x20=\x200');}else{_0x2d3544['having'](_0xe1a6('0x80'));}}if(_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x81')]){_0x281948=_[_0xe1a6('0x82')](_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x81')])?_0x1ca367['query'][_0xe1a6('0x81')]:new Array(_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x81')]);_0x281948['forEach'](function(_0x2cae14){_0x363ff6['or'](_0xe1a6('0x6e'),'%,'+_0x2cae14+',%');});}if(_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x83')]){var _0x479f8d=_0x1ca367['query'][_0xe1a6('0x83')]['replace']('\x5c','\x5c\x5c')[_0xe1a6('0x84')]('\x27\x27',_0xe1a6('0x85'));if(qs[_0xe1a6('0x86')](_0x479f8d)){_0x231f8b['or'](_0xe1a6('0x87'),_0x479f8d+'%')['or'](_0xe1a6('0x88'),_0x479f8d+'%');}_0x231f8b['or'](_0xe1a6('0x89'),_0x479f8d+'%');}}_0x2d3544['where'](_0x231f8b);_0x2d3544['group'](_0xe1a6('0x8a'));var _0x3a7ff4={'type':db['Sequelize'][_0xe1a6('0x8b')]['SELECT'],'raw':!![]};var _0x52ff2e=_0x2d3544[_0xe1a6('0x8c')]();_0x52ff2e['field']('i.id');_0x52ff2e[_0xe1a6('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe1a6('0x8d'));if(_0x11350a[_0xe1a6('0x43')]){_0x11350a[_0xe1a6('0x43')]['forEach'](function(_0x29acb4){_0x2d3544[_0xe1a6('0x43')]('i.'+_0x29acb4[0x0],_0x29acb4[0x1]===_0xe1a6('0x8e')?![]:!![]);});}if(!_[_0xe1a6('0x74')](_0x281948)){_0x2d3544[_0xe1a6('0x61')](_0x363ff6);_0x52ff2e[_0xe1a6('0x45')](_0xe1a6('0x8f'),_0x281948);}BPromise[_0xe1a6('0x90')]()[_0xe1a6('0x28')](function(){if(!_0x492c87){if(_0x1ca367[_0xe1a6('0x3b')][_0xe1a6('0x75')]||_0x1ca367['query'][_0xe1a6('0x91')])return;_0x52ff2e['where'](_0xe1a6('0x92'));_0x2d3544[_0xe1a6('0x45')](_0xe1a6('0x92'));return;}return _0x1ca367[_0xe1a6('0x93')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xe1a6('0x28')](function(_0x4fc312){if(_[_0xe1a6('0x74')](_0x4fc312)){_0x52ff2e[_0xe1a6('0x45')]('i.FaxAccountId\x20IS\x20NULL');_0x2d3544[_0xe1a6('0x45')](_0xe1a6('0x94'));}else{_0x52ff2e[_0xe1a6('0x45')](_0xe1a6('0x76'),_[_0xe1a6('0x2f')](_0x4fc312,'id'));_0x2d3544[_0xe1a6('0x45')](_0xe1a6('0x76'),_['map'](_0x4fc312,'id'));}});})[_0xe1a6('0x28')](function(){db[_0xe1a6('0x95')][_0xe1a6('0x3b')](_0x52ff2e[_0xe1a6('0x96')](),_0x3a7ff4)[_0xe1a6('0x28')](function(_0x7d03e3){_0x2beed0[_0xe1a6('0x20')]=_0x7d03e3[_0xe1a6('0x40')];if(_0x2beed0[_0xe1a6('0x20')]===0x0)return[];return db['sequelize'][_0xe1a6('0x3b')](_0x112821['toString'](),_0x3a7ff4)[_0xe1a6('0x28')](function(_0x5d02bb){_0x384cde=_[_0xe1a6('0x97')](_0x5d02bb,'id');_0x3a7ff4=_[_0xe1a6('0x98')](_0x3a7ff4,{'model':db[_0xe1a6('0x37')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1ca367['query'][_0xe1a6('0x99')]){_0x11350a[_0xe1a6('0x3e')]['forEach'](function(_0x2fc548){_0x2d3544[_0xe1a6('0x48')]('i.'+_0x2fc548);});}else{_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0x9a'),_0xe1a6('0x8d'));_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0x9b'),_0xe1a6('0x9c'));_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0x9d'),_0xe1a6('0x9e'));_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0x9f'));_0x2d3544[_0xe1a6('0x48')]('c.firstName',_0xe1a6('0xa0'));_0x2d3544['field'](_0xe1a6('0xa1'),'Contact.lastName');_0x2d3544['field'](_0xe1a6('0xa2'),'Contact.email');_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0xa3'),'Contact.phone');_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0xa4'),_0xe1a6('0xa5'));_0x2d3544['field']('c.fax',_0xe1a6('0xa6'));_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0xa7'),_0xe1a6('0xa8'));_0x2d3544['field']('o.internal','Owner.internal');_0x2d3544[_0xe1a6('0x48')](_0xe1a6('0xa9'),_0xe1a6('0x31'));}_0x2d3544[_0xe1a6('0x22')](_0x11350a[_0xe1a6('0x22')]);_0x2d3544['offset'](_0x11350a[_0xe1a6('0x21')]);return db[_0xe1a6('0x95')][_0xe1a6('0x3b')](_0x2d3544[_0xe1a6('0x96')](),_0x3a7ff4);})['then'](function(_0x2f674f){_0xff4fa9[_0xe1a6('0x45')](_0xe1a6('0xaa'),_[_0xe1a6('0x2f')](_0x2f674f,'id'));return db[_0xe1a6('0x95')]['query'](_0xff4fa9[_0xe1a6('0x96')](),_0x3a7ff4)[_0xe1a6('0x28')](function(_0xfb1705){var _0x3e74a4=_[_0xe1a6('0xab')](_0xfb1705,_0xe1a6('0xac'));var _0x353487=[];_0x2f674f[_0xe1a6('0x33')](function(_0x66767){_0x353487[_0xe1a6('0x35')](updateFaxInteraction(_0x66767,_0x384cde,_0x3e74a4));});return BPromise['all'](_0x353487);});});})['then'](function(_0x3d7f0e){_0x2beed0[_0xe1a6('0xad')]=_0x3d7f0e;return _0x2beed0;})[_0xe1a6('0x28')](respondWithFilteredResult(_0x34a59e,_0x11350a));})[_0xe1a6('0xae')](handleError(_0x34a59e,null));};exports['show']=function(_0x45e016,_0x27c3c2){var _0x3bea45={'raw':![],'where':{'id':_0x45e016[_0xe1a6('0xaf')]['id']}},_0x17b7ee={};_0x17b7ee[_0xe1a6('0x3d')]=_[_0xe1a6('0x3a')](db['FaxInteraction'][_0xe1a6('0xb0')]);_0x17b7ee[_0xe1a6('0x3b')]=_[_0xe1a6('0x3a')](_0x45e016[_0xe1a6('0x3b')]);_0x17b7ee[_0xe1a6('0x3c')]=_[_0xe1a6('0x3f')](_0x17b7ee[_0xe1a6('0x3d')],_0x17b7ee[_0xe1a6('0x3b')]);_0x3bea45[_0xe1a6('0x3e')]=_[_0xe1a6('0x3f')](_0x17b7ee[_0xe1a6('0x3d')],qs[_0xe1a6('0x99')](_0x45e016[_0xe1a6('0x3b')]['fields']));_0x3bea45[_0xe1a6('0x3e')]=_0x3bea45['attributes'][_0xe1a6('0x40')]?_0x3bea45['attributes']:_0x17b7ee['model'];if(_0x45e016[_0xe1a6('0x3b')][_0xe1a6('0xb1')]){_0x3bea45[_0xe1a6('0xb2')]=[{'all':!![]}];}_0x3bea45=_[_0xe1a6('0x98')]({},_0x3bea45,_0x45e016[_0xe1a6('0xb3')]);return db[_0xe1a6('0x37')][_0xe1a6('0x5f')](_0x3bea45)[_0xe1a6('0x28')](handleEntityNotFound(_0x27c3c2,null))[_0xe1a6('0x28')](respondWithResult(_0x27c3c2,null))[_0xe1a6('0xae')](handleError(_0x27c3c2,null));};exports['create']=function(_0x446798,_0x1a7628){return db[_0xe1a6('0x37')]['create'](_0x446798[_0xe1a6('0x73')],{})[_0xe1a6('0x28')](respondWithResult(_0x1a7628,0xc9))[_0xe1a6('0xae')](handleError(_0x1a7628,null));};exports['update']=function(_0x5dadab,_0x172b8a){if(_0x5dadab[_0xe1a6('0x73')]['id']){delete _0x5dadab[_0xe1a6('0x73')]['id'];}return db[_0xe1a6('0x37')]['find']({'where':{'id':_0x5dadab[_0xe1a6('0xaf')]['id']}})['then'](handleEntityNotFound(_0x172b8a,null))[_0xe1a6('0x28')](saveUpdates(_0x5dadab[_0xe1a6('0x73')],null))[_0xe1a6('0x28')](respondWithResult(_0x172b8a,null))['catch'](handleError(_0x172b8a,null));};exports[_0xe1a6('0x29')]=function(_0x3b157c,_0xaede02){return db['FaxInteraction'][_0xe1a6('0x5f')]({'where':{'id':_0x3b157c[_0xe1a6('0xaf')]['id']}})[_0xe1a6('0x28')](handleEntityNotFound(_0xaede02,null))[_0xe1a6('0x28')](removeEntity(_0xaede02,null))[_0xe1a6('0xae')](handleError(_0xaede02,null));};exports['describe']=function(_0x5823cf,_0x229bbb){return db[_0xe1a6('0x37')][_0xe1a6('0xb4')]()['then'](respondWithResult(_0x229bbb,null))[_0xe1a6('0xae')](handleError(_0x229bbb,null));};exports[_0xe1a6('0xb5')]=function(_0x5b6bb5,_0x5c0796,_0x41b493){return db['FaxMessage'][_0xe1a6('0x5f')]({'where':{'id':_0x5b6bb5[_0xe1a6('0xaf')]['id']}})['then'](handleEntityNotFound(_0x5c0796,null))[_0xe1a6('0x28')](function(_0x54e5a3){if(_0x54e5a3){return _0x54e5a3['addMessage'](_0x5b6bb5[_0xe1a6('0x73')][_0xe1a6('0xb6')],_[_0xe1a6('0xb7')](_0x5b6bb5['body'],['ids','id'])||{});}})[_0xe1a6('0x28')](respondWithResult(_0x5c0796,null))[_0xe1a6('0xae')](handleError(_0x5c0796,null));};exports['getMessages']=function(_0x2384c7,_0x55845e,_0x5c0d1d){var _0x5e35f3={'raw':![],'where':{}};var _0x1e4dd8={};var _0x40dbb3={'count':0x0,'rows':[]};return db[_0xe1a6('0x37')][_0xe1a6('0xb8')]({'where':{'id':_0x2384c7['params']['id']}})[_0xe1a6('0x28')](handleEntityNotFound(_0x55845e,null))[_0xe1a6('0x28')](function(_0x2df0e4){if(_0x2df0e4){_0x1e4dd8[_0xe1a6('0x3d')]=_['keys'](db[_0xe1a6('0xb9')][_0xe1a6('0xb0')]);_0x1e4dd8['query']=_[_0xe1a6('0x3a')](_0x2384c7[_0xe1a6('0x3b')]);_0x1e4dd8['filters']=_[_0xe1a6('0x3f')](_0x1e4dd8[_0xe1a6('0x3d')],_0x1e4dd8[_0xe1a6('0x3b')]);_0x5e35f3[_0xe1a6('0x3e')]=_['intersection'](_0x1e4dd8[_0xe1a6('0x3d')],qs['fields'](_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x99')]));_0x5e35f3[_0xe1a6('0x3e')]=_0x5e35f3['attributes'][_0xe1a6('0x40')]?_0x5e35f3[_0xe1a6('0x3e')]:_0x1e4dd8[_0xe1a6('0x3d')];if(!_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x41')](_0xe1a6('0x42'))){_0x5e35f3[_0xe1a6('0x22')]=qs['limit'](_0x2384c7['query'][_0xe1a6('0x22')]);_0x5e35f3[_0xe1a6('0x21')]=qs[_0xe1a6('0x21')](_0x2384c7[_0xe1a6('0x3b')]['offset']);}_0x5e35f3[_0xe1a6('0x43')]=qs[_0xe1a6('0x44')](_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x44')]);_0x5e35f3[_0xe1a6('0x45')]=qs[_0xe1a6('0x3c')](_[_0xe1a6('0x46')](_0x2384c7[_0xe1a6('0x3b')],_0x1e4dd8['filters']));_0x5e35f3[_0xe1a6('0x45')][_0xe1a6('0xac')]=_0x2df0e4['id'];if(_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x83')]){_0x5e35f3['where']=_[_0xe1a6('0x98')](_0x5e35f3[_0xe1a6('0x45')],{'$or':_[_0xe1a6('0x2f')](_0x5e35f3[_0xe1a6('0x3e')],function(_0x18b47c){var _0x40bd36={};_0x40bd36[_0x18b47c]={'$like':'%'+_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x83')]+'%'};return _0x40bd36;})});}if(_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x79')]){var _0x3acdf8=_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0x79')][_0xe1a6('0x32')](',');var _0x4d2cdb={};_0x4d2cdb[_0x3acdf8[0x0]]={'$gte':moment(_0x3acdf8[0x1])['format'](_0xe1a6('0xba'))};_0x5e35f3[_0xe1a6('0x45')]=_[_0xe1a6('0x98')](_0x5e35f3[_0xe1a6('0x45')],_0x4d2cdb);}_0x5e35f3=_['merge']({},_0x5e35f3,_0x2384c7[_0xe1a6('0xb3')]);return db[_0xe1a6('0xb9')]['count']({'where':_0x5e35f3[_0xe1a6('0x45')]})[_0xe1a6('0x28')](function(_0x1676d0){_0x40dbb3[_0xe1a6('0x20')]=_0x1676d0;if(_0x2384c7[_0xe1a6('0x3b')][_0xe1a6('0xb1')]){_0x5e35f3[_0xe1a6('0xb2')]=[{'all':!![]}];}return db[_0xe1a6('0xb9')][_0xe1a6('0xbb')](_0x5e35f3);})[_0xe1a6('0x28')](function(_0x13f83b){_0x40dbb3[_0xe1a6('0xad')]=_0x13f83b;return _0x40dbb3;});}})['then'](respondWithFilteredResult(_0x55845e,_0x5e35f3))[_0xe1a6('0xae')](handleError(_0x55845e,null));};exports[_0xe1a6('0xbc')]=function(_0x5d570f,_0x3321f5,_0x5250b3){return db[_0xe1a6('0x37')][_0xe1a6('0x5f')]({'where':{'id':_0x5d570f[_0xe1a6('0xaf')]['id']}})[_0xe1a6('0x28')](handleEntityNotFound(_0x3321f5,null))[_0xe1a6('0x28')](function(_0x18e146){if(_0x18e146){return _0x18e146['setTags'](_0x5d570f['body'][_0xe1a6('0xb6')],_[_0xe1a6('0xb7')](_0x5d570f[_0xe1a6('0x73')],[_0xe1a6('0xb6'),'id'])||{})['spread'](function(){return db[_0xe1a6('0x6d')]['findAll']({'attributes':['id',_0xe1a6('0x2c'),_0xe1a6('0x49')],'where':{'id':_0x5d570f[_0xe1a6('0x73')][_0xe1a6('0xb6')]}});})[_0xe1a6('0x28')](function(_0x160dcc){socket['emit']('faxInteractionTags:save',{'id':Number(_0x5d570f[_0xe1a6('0xaf')]['id']),'tags':_0x160dcc||[]});return{'id':Number(_0x5d570f[_0xe1a6('0xaf')]['id']),'tags':_0x160dcc||[]};});}})['then'](respondWithResult(_0x3321f5,null))[_0xe1a6('0xae')](handleError(_0x3321f5,null));};exports[_0xe1a6('0xbd')]=function(_0x3108ea,_0x12f763,_0x3e1d7d){return db['FaxInteraction'][_0xe1a6('0x5f')]({'where':{'id':_0x3108ea[_0xe1a6('0xaf')]['id']}})[_0xe1a6('0x28')](handleEntityNotFound(_0x12f763,null))['then'](function(_0x57ed25){if(_0x57ed25){return _0x57ed25[_0xe1a6('0xbd')](_0x3108ea[_0xe1a6('0x3b')][_0xe1a6('0xb6')]);}})[_0xe1a6('0x28')](respondWithStatusCode(_0x12f763,null))['catch'](handleError(_0x12f763,null));};exports[_0xe1a6('0xbe')]=function(_0x11f58f,_0x1c6025){var _0x528fff=moment()[_0xe1a6('0xbf')]()[_0xe1a6('0x96')]();var _0x8be27a=path['join'](config[_0xe1a6('0xc0')],'server',_0xe1a6('0xc1'),'tmp');var _0x353706=path[_0xe1a6('0xc2')](config[_0xe1a6('0xc0')],_0xe1a6('0xc3'),_0xe1a6('0xc1'),_0xe1a6('0xc4'));var _0x23f224=path[_0xe1a6('0xc2')](_0x8be27a,_0x528fff);var _0x11ffe7=util[_0xe1a6('0xc5')](_0xe1a6('0xc6'),_0x11f58f['params']['id'],_0x528fff);var _0x126677=path['join'](_0x8be27a,_0x11ffe7);var _0x3aeb73=[];_0x3aeb73[_0xe1a6('0x35')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x1a823a=[{'model':db['FaxMessage'],'as':_0xe1a6('0xc7'),'attributes':['id',_0xe1a6('0x73'),_0xe1a6('0x77')],'include':_0x3aeb73}];return db[_0xe1a6('0x37')][_0xe1a6('0x5f')]({'where':{'id':_0x11f58f[_0xe1a6('0xaf')]['id']},'include':_0x1a823a})['then'](handleEntityNotFound(_0x1c6025,null))['then'](function(_0x44374f){if(_0x44374f&&_0x44374f['Messages']){var _0x52f1c7=_0x44374f['get']({'plain':!![]});fs[_0xe1a6('0xc8')](_0x23f224);for(var _0x4249bc=0x0;_0x4249bc<_0x52f1c7[_0xe1a6('0xc7')][_0xe1a6('0x40')];_0x4249bc++){var _0x923191=_0x52f1c7[_0xe1a6('0xc7')][_0x4249bc]['Attachment'];if(_0x923191){var _0x35b68d=path['join'](_0x353706,_0x923191[_0xe1a6('0xc9')]);if(fs['existsSync'](_0x35b68d)){fs[_0xe1a6('0xca')](_0x35b68d)['pipe'](fs[_0xe1a6('0xcb')](path[_0xe1a6('0xc2')](_0x23f224,_0x923191[_0xe1a6('0xc9')])));}}}return BPromise[_0xe1a6('0x90')]()[_0xe1a6('0x28')](function(){return new BPromise(function(_0x249e74,_0x5f5811){zipdir(_0x23f224,{'saveTo':_0x126677},function(_0x5bc415,_0x2ac3a2){if(_0x5bc415)return _0x5f5811(_0x5bc415);return _0x249e74(_0x2ac3a2);});})[_0xe1a6('0x28')](function(){return new BPromise(function(_0x46dacb,_0x343078){rimraf(_0x23f224,function(_0x3dcf3f){if(_0x3dcf3f)_0x343078(_0x3dcf3f);return _0x46dacb();});});})[_0xe1a6('0x28')](function(){return _0x1c6025[_0xe1a6('0xbe')](_0x126677,_0x11ffe7,function(_0x428bf9){if(_0x428bf9){console['log'](_0xe1a6('0xcc'),_0x428bf9);}else{fs['unlinkSync'](_0x126677);}});});});}else{return _0x1c6025['sendStatus'](0xc8);}})['catch'](handleError(_0x1c6025,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 136c3e1..425867c 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(_0x24560b,_0x3186f2){var _0x1b2919=function(_0x289580){while(--_0x289580){_0x24560b['push'](_0x24560b['shift']());}};_0x1b2919(++_0x3186f2);}(_0x1261,0x144));var _0x1126=function(_0x4ca796,_0x10dc47){_0x4ca796=_0x4ca796-0x0;var _0x171f87=_0x1261[_0x4ca796];return _0x171f87;};'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 _0x2ef3=['remove','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2ef3,0xba));var _0x32ef=function(_0x1083a8,_0x4ea006){_0x1083a8=_0x1083a8-0x0;var _0xbbddbd=_0x2ef3[_0x1083a8];return _0xbbddbd;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var FaxInteraction=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var FaxMessage=require(_0x32ef('0x1'))['db'][_0x32ef('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x32ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32ef('0x5'),'afterDestroy':_0x32ef('0x6')};function emitEvent(_0x524ab6){return function(_0x402857,_0x37dd1d,_0x4c8104){_0x402857['getUsers']({'attributes':['id'],'raw':!![]})[_0x32ef('0x7')](function(_0x4bfcf8){_0x402857[_0x32ef('0x8')](_0x32ef('0x9'),_0x4bfcf8[_0x32ef('0xa')](function(_0x298066){return{'id':_0x298066['id']};}));return FaxMessage[_0x32ef('0xb')]({'where':{'FaxInteractionId':_0x402857['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32ef('0x7')](function(_0x28275c){_0x402857[_0x32ef('0x8')]('unreadMessages',_0x28275c['length']);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6+':'+_0x402857['id'],_0x402857);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6,_0x402857);_0x4c8104(null);})[_0x32ef('0xd')](_0x4c8104(null));};}for(var e in events){if(events[_0x32ef('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x32ef('0xf')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index b2e6ae7..8a881a6 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 _0xb45a=['bluebird','path','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x71fe8,_0x485e02){var _0x1ea6c7=function(_0x18f770){while(--_0x18f770){_0x71fe8['push'](_0x71fe8['shift']());}};_0x1ea6c7(++_0x485e02);}(_0xb45a,0x185));var _0xab45=function(_0x26c643,_0x2c784a){_0x26c643=_0x26c643-0x0;var _0xb49398=_0xb45a[_0x26c643];return _0xb49398;};'use strict';var _=require(_0xab45('0x0'));var util=require(_0xab45('0x1'));var logger=require(_0xab45('0x2'))('api');var moment=require('moment');var BPromise=require(_0xab45('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xab45('0x4'));var rimraf=require('rimraf');var config=require(_0xab45('0x5'));var attributes=require(_0xab45('0x6'));module['exports']=function(_0x5c4119,_0x110f65){return _0x5c4119[_0xab45('0x7')](_0xab45('0x8'),attributes,{'tableName':_0xab45('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe0993,_0xada04e,_0x381057){if(_0xe0993[_0xab45('0xa')]('closed')){_0xe0993[_0xab45('0xb')]=moment()[_0xab45('0xc')](_0xab45('0xd'));}_0x381057(null,_0xe0993);}}});}; \ No newline at end of file +var _0x8792=['closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed'];(function(_0x301f7f,_0x31cb97){var _0x2c25d9=function(_0x403b20){while(--_0x403b20){_0x301f7f['push'](_0x301f7f['shift']());}};_0x2c25d9(++_0x31cb97);}(_0x8792,0x146));var _0x2879=function(_0x32249d,_0x1811e2){_0x32249d=_0x32249d-0x0;var _0x10c478=_0x8792[_0x32249d];return _0x10c478;};'use strict';var _=require(_0x2879('0x0'));var util=require(_0x2879('0x1'));var logger=require(_0x2879('0x2'))(_0x2879('0x3'));var moment=require(_0x2879('0x4'));var BPromise=require(_0x2879('0x5'));var rp=require(_0x2879('0x6'));var fs=require('fs');var path=require(_0x2879('0x7'));var rimraf=require('rimraf');var config=require(_0x2879('0x8'));var attributes=require(_0x2879('0x9'));module[_0x2879('0xa')]=function(_0x38faed,_0x25bc71){return _0x38faed[_0x2879('0xb')](_0x2879('0xc'),attributes,{'tableName':_0x2879('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5c9476,_0x536b3a,_0x1efe86){if(_0x5c9476[_0x2879('0xe')](_0x2879('0xf'))){_0x5c9476[_0x2879('0x10')]=moment()[_0x2879('0x11')](_0x2879('0x12'));}_0x1efe86(null,_0x5c9476);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 0e8e394..3b1a1c0 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 _0x8f00=['catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','then','AddTagsToFaxInteraction','find','ids','omit','spread','AddTags','moment','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8f00,0x129));var _0x08f0=function(_0x54282e,_0x30d848){_0x54282e=_0x54282e-0x0;var _0x1f3ae2=_0x8f00[_0x54282e];return _0x1f3ae2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x08f0('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x08f0('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x08f0('0x2'));var logger=require(_0x08f0('0x3'))('rpc');var config=require('../../config/environment');var jayson=require(_0x08f0('0x4'));var client=jayson[_0x08f0('0x5')][_0x08f0('0x6')]({'port':0x232a});config[_0x08f0('0x7')]=_[_0x08f0('0x8')](config[_0x08f0('0x7')],{'host':_0x08f0('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x08f0('0x7')]));require(_0x08f0('0xa'))[_0x08f0('0xb')](socket);function respondWithRpcPromise(_0x152b5c,_0x1b85df,_0x12fda7){return new BPromise(function(_0x3ff667,_0x2ac41b){return client[_0x08f0('0xc')](_0x152b5c,_0x12fda7)['then'](function(_0x2620da){logger[_0x08f0('0xd')](_0x08f0('0xe'),_0x1b85df,'request\x20sent');logger[_0x08f0('0xf')](_0x08f0('0x10'),_0x1b85df,_0x08f0('0x11'),JSON[_0x08f0('0x12')](_0x2620da));if(_0x2620da['error']){if(_0x2620da[_0x08f0('0x13')][_0x08f0('0x14')]===0x1f4){logger[_0x08f0('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x1b85df,_0x2620da[_0x08f0('0x13')][_0x08f0('0x15')]);return _0x2ac41b(_0x2620da[_0x08f0('0x13')][_0x08f0('0x15')]);}logger[_0x08f0('0x13')](_0x08f0('0xe'),_0x1b85df,_0x2620da[_0x08f0('0x13')][_0x08f0('0x15')]);return _0x3ff667(_0x2620da[_0x08f0('0x13')][_0x08f0('0x15')]);}else{logger[_0x08f0('0xd')]('FaxInteraction,\x20%s,\x20%s',_0x1b85df,_0x08f0('0x11'));_0x3ff667(_0x2620da[_0x08f0('0x16')]['message']);}})[_0x08f0('0x17')](function(_0x52aca7){logger[_0x08f0('0x13')](_0x08f0('0xe'),_0x1b85df,_0x52aca7);_0x2ac41b(_0x52aca7);});});}exports[_0x08f0('0x18')]=function(_0x42ed67){var _0x49fe30=this;return new Promise(function(_0x964b6d,_0x209100){return db[_0x08f0('0x19')][_0x08f0('0x1a')](_0x42ed67[_0x08f0('0x1b')],{'raw':_0x42ed67[_0x08f0('0x1c')]?_0x42ed67['options'][_0x08f0('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42ed67[_0x08f0('0x1c')]?_0x42ed67[_0x08f0('0x1c')][_0x08f0('0x1e')]||null:null,'attributes':_0x42ed67['options']?_0x42ed67[_0x08f0('0x1c')][_0x08f0('0x1f')]||null:null,'limit':_0x42ed67[_0x08f0('0x1c')]?_0x42ed67['options'][_0x08f0('0x20')]||null:null})[_0x08f0('0x21')](function(_0x7eeae7){logger[_0x08f0('0xd')]('UpdateFaxInteraction',_0x42ed67);logger[_0x08f0('0xf')](_0x08f0('0x18'),_0x42ed67,JSON['stringify'](_0x7eeae7));_0x964b6d(_0x7eeae7);})['catch'](function(_0x107ffe){logger[_0x08f0('0x13')](_0x08f0('0x18'),_0x107ffe[_0x08f0('0x15')],_0x42ed67);_0x209100(_0x49fe30['error'](0x1f4,_0x107ffe['message']));});});};exports[_0x08f0('0x22')]=function(_0x522c21){return new Promise(function(_0xe767cc,_0x1c9f2f){return db[_0x08f0('0x19')][_0x08f0('0x23')]({'where':_0x522c21[_0x08f0('0x1c')]?_0x522c21[_0x08f0('0x1c')][_0x08f0('0x1e')]||null:null})[_0x08f0('0x21')](function(_0x423685){if(_0x423685){return _0x423685['addTags'](_0x522c21[_0x08f0('0x1b')][_0x08f0('0x24')],_[_0x08f0('0x25')](_0x522c21[_0x08f0('0x1b')],['ids','id'])||{});}})[_0x08f0('0x26')](function(_0x13154a){logger[_0x08f0('0xd')](_0x08f0('0x27'),_0x522c21);logger[_0x08f0('0xf')](_0x08f0('0x27'),_0x522c21,JSON[_0x08f0('0x12')](_0x13154a));_0xe767cc(_0x13154a);})[_0x08f0('0x17')](function(_0x4b6fca){logger['error']('AddTags',_0x4b6fca['message'],_0x522c21);_0x1c9f2f(_this[_0x08f0('0x13')](0x1f4,_0x4b6fca[_0x08f0('0x15')]));});});}; \ No newline at end of file +var _0xa638=['FaxInteraction,\x20%s,\x20%s','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UpdateFaxInteraction','FaxInteraction','options','raw','where','limit','then','find','addTags','omit','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','request'];(function(_0x31b723,_0x367cd0){var _0x445234=function(_0x3fe82e){while(--_0x3fe82e){_0x31b723['push'](_0x31b723['shift']());}};_0x445234(++_0x367cd0);}(_0xa638,0x146));var _0x8a63=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa638[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x8a63('0x0'));var util=require(_0x8a63('0x1'));var moment=require(_0x8a63('0x2'));var BPromise=require(_0x8a63('0x3'));var rs=require(_0x8a63('0x4'));var fs=require('fs');var Redis=require(_0x8a63('0x5'));var db=require(_0x8a63('0x6'))['db'];var utils=require(_0x8a63('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x8a63('0x8'));var jayson=require(_0x8a63('0x9'));var client=jayson[_0x8a63('0xa')][_0x8a63('0xb')]({'port':0x232a});config[_0x8a63('0xc')]=_[_0x8a63('0xd')](config[_0x8a63('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8a63('0xe'))(new Redis(config[_0x8a63('0xc')]));require(_0x8a63('0xf'))[_0x8a63('0x10')](socket);function respondWithRpcPromise(_0x18a9fc,_0x1dece7,_0x127e7b){return new BPromise(function(_0x16dcdb,_0x5522c3){return client[_0x8a63('0x11')](_0x18a9fc,_0x127e7b)['then'](function(_0x2cc650){logger['info'](_0x8a63('0x12'),_0x1dece7,'request\x20sent');logger[_0x8a63('0x13')](_0x8a63('0x14'),_0x1dece7,_0x8a63('0x15'),JSON[_0x8a63('0x16')](_0x2cc650));if(_0x2cc650[_0x8a63('0x17')]){if(_0x2cc650['error'][_0x8a63('0x18')]===0x1f4){logger[_0x8a63('0x17')](_0x8a63('0x12'),_0x1dece7,_0x2cc650['error'][_0x8a63('0x19')]);return _0x5522c3(_0x2cc650[_0x8a63('0x17')][_0x8a63('0x19')]);}logger[_0x8a63('0x17')](_0x8a63('0x12'),_0x1dece7,_0x2cc650['error'][_0x8a63('0x19')]);return _0x16dcdb(_0x2cc650[_0x8a63('0x17')][_0x8a63('0x19')]);}else{logger[_0x8a63('0x1a')](_0x8a63('0x12'),_0x1dece7,_0x8a63('0x15'));_0x16dcdb(_0x2cc650[_0x8a63('0x1b')][_0x8a63('0x19')]);}})[_0x8a63('0x1c')](function(_0x631734){logger[_0x8a63('0x17')](_0x8a63('0x12'),_0x1dece7,_0x631734);_0x5522c3(_0x631734);});});}exports[_0x8a63('0x1d')]=function(_0x2f15fc){var _0x2b0da7=this;return new Promise(function(_0x2cbee5,_0xd0655a){return db[_0x8a63('0x1e')]['update'](_0x2f15fc['body'],{'raw':_0x2f15fc[_0x8a63('0x1f')]?_0x2f15fc[_0x8a63('0x1f')][_0x8a63('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f15fc[_0x8a63('0x1f')]?_0x2f15fc[_0x8a63('0x1f')][_0x8a63('0x21')]||null:null,'attributes':_0x2f15fc[_0x8a63('0x1f')]?_0x2f15fc[_0x8a63('0x1f')]['attributes']||null:null,'limit':_0x2f15fc[_0x8a63('0x1f')]?_0x2f15fc[_0x8a63('0x1f')][_0x8a63('0x22')]||null:null})[_0x8a63('0x23')](function(_0x47dacf){logger[_0x8a63('0x1a')](_0x8a63('0x1d'),_0x2f15fc);logger[_0x8a63('0x13')](_0x8a63('0x1d'),_0x2f15fc,JSON['stringify'](_0x47dacf));_0x2cbee5(_0x47dacf);})[_0x8a63('0x1c')](function(_0x3c1c83){logger[_0x8a63('0x17')]('UpdateFaxInteraction',_0x3c1c83[_0x8a63('0x19')],_0x2f15fc);_0xd0655a(_0x2b0da7[_0x8a63('0x17')](0x1f4,_0x3c1c83['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x3e0fe7){return new Promise(function(_0x41be65,_0x401f49){return db['FaxInteraction'][_0x8a63('0x24')]({'where':_0x3e0fe7['options']?_0x3e0fe7[_0x8a63('0x1f')][_0x8a63('0x21')]||null:null})['then'](function(_0x498fab){if(_0x498fab){return _0x498fab[_0x8a63('0x25')](_0x3e0fe7['body']['ids'],_[_0x8a63('0x26')](_0x3e0fe7[_0x8a63('0x27')],[_0x8a63('0x28'),'id'])||{});}})[_0x8a63('0x29')](function(_0x1e6bdd){logger[_0x8a63('0x1a')]('AddTags',_0x3e0fe7);logger[_0x8a63('0x13')](_0x8a63('0x2a'),_0x3e0fe7,JSON['stringify'](_0x1e6bdd));_0x41be65(_0x1e6bdd);})['catch'](function(_0x405561){logger[_0x8a63('0x17')](_0x8a63('0x2a'),_0x405561[_0x8a63('0x19')],_0x3e0fe7);_0x401f49(_this[_0x8a63('0x17')](0x1f4,_0x405561['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 590f3fe..382dd9c 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 _0xe0a7=['emit','removeListener','register','faxInteraction:','./faxInteraction.events','save','remove'];(function(_0x4faab0,_0x544bf3){var _0x5b1f25=function(_0xf5d089){while(--_0xf5d089){_0x4faab0['push'](_0x4faab0['shift']());}};_0x5b1f25(++_0x544bf3);}(_0xe0a7,0x193));var _0x7e0a=function(_0x11a2a1,_0x157e61){_0x11a2a1=_0x11a2a1-0x0;var _0x3bdd17=_0xe0a7[_0x11a2a1];return _0x3bdd17;};'use strict';var FaxInteractionEvents=require(_0x7e0a('0x0'));var events=[_0x7e0a('0x1'),_0x7e0a('0x2'),'update'];function createListener(_0x12f5f3,_0xf49ef3){return function(_0x1e7727){_0xf49ef3[_0x7e0a('0x3')](_0x12f5f3,_0x1e7727);};}function removeListener(_0x56cfd7,_0x4f277b){return function(){FaxInteractionEvents[_0x7e0a('0x4')](_0x56cfd7,_0x4f277b);};}exports[_0x7e0a('0x5')]=function(_0x5c0e56){for(var _0x462985=0x0,_0x3e612b=events['length'];_0x462985<_0x3e612b;_0x462985++){var _0x42c31f=events[_0x462985];var _0x117289=createListener(_0x7e0a('0x6')+_0x42c31f,_0x5c0e56);FaxInteractionEvents['on'](_0x42c31f,_0x117289);}}; \ No newline at end of file +var _0x7094=['length','faxInteraction:','./faxInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x425ef7,_0x2444ec){var _0x463339=function(_0x157dfb){while(--_0x157dfb){_0x425ef7['push'](_0x425ef7['shift']());}};_0x463339(++_0x2444ec);}(_0x7094,0xda));var _0x4709=function(_0x578ad4,_0x2f3607){_0x578ad4=_0x578ad4-0x0;var _0x4ecc08=_0x7094[_0x578ad4];return _0x4ecc08;};'use strict';var FaxInteractionEvents=require(_0x4709('0x0'));var events=[_0x4709('0x1'),_0x4709('0x2'),_0x4709('0x3')];function createListener(_0x28f7f1,_0x7655d3){return function(_0x106280){_0x7655d3[_0x4709('0x4')](_0x28f7f1,_0x106280);};}function removeListener(_0x12bdb5,_0x54aeed){return function(){FaxInteractionEvents[_0x4709('0x5')](_0x12bdb5,_0x54aeed);};}exports[_0x4709('0x6')]=function(_0x4ddff8){for(var _0x3aa2af=0x0,_0x263039=events[_0x4709('0x7')];_0x3aa2af<_0x263039;_0x3aa2af++){var _0x5d1d8a=events[_0x3aa2af];var _0x5efdb4=createListener(_0x4709('0x8')+_0x5d1d8a,_0x4ddff8);FaxInteractionEvents['on'](_0x5d1d8a,_0x5efdb4);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 07b5d1b..5dc3f7e 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 _0x7a0a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router'];(function(_0x5c9865,_0x1a299a){var _0x54c22b=function(_0x538537){while(--_0x538537){_0x5c9865['push'](_0x5c9865['shift']());}};_0x54c22b(++_0x1a299a);}(_0x7a0a,0xc6));var _0xa7a0=function(_0x2e8afb,_0x112502){_0x2e8afb=_0x2e8afb-0x0;var _0x24b08f=_0x7a0a[_0x2e8afb];return _0x24b08f;};'use strict';var multer=require(_0xa7a0('0x0'));var util=require(_0xa7a0('0x1'));var path=require(_0xa7a0('0x2'));var timeout=require(_0xa7a0('0x3'));var express=require(_0xa7a0('0x4'));var router=express[_0xa7a0('0x5')]();var auth=require(_0xa7a0('0x6'));var interaction=require(_0xa7a0('0x7'));var config=require(_0xa7a0('0x8'));var controller=require(_0xa7a0('0x9'));router[_0xa7a0('0xa')]('/',auth[_0xa7a0('0xb')](),controller[_0xa7a0('0xc')]);router['get'](_0xa7a0('0xd'),auth[_0xa7a0('0xb')](),controller[_0xa7a0('0xe')]);router[_0xa7a0('0xa')](_0xa7a0('0xf'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/messages',auth[_0xa7a0('0xb')](),controller[_0xa7a0('0x10')]);router[_0xa7a0('0xa')](_0xa7a0('0x11'),auth[_0xa7a0('0xb')](),controller[_0xa7a0('0x12')]);router[_0xa7a0('0x13')]('/',auth['isAuthenticated'](),controller[_0xa7a0('0x14')]);router[_0xa7a0('0x13')](_0xa7a0('0x15'),auth[_0xa7a0('0xb')](),controller[_0xa7a0('0x16')]);router['post'](_0xa7a0('0x17'),auth[_0xa7a0('0xb')](),interaction[_0xa7a0('0x18')](_0xa7a0('0x19'),_0xa7a0('0x1a')),controller[_0xa7a0('0x1b')]);router[_0xa7a0('0x1c')](_0xa7a0('0xf'),auth[_0xa7a0('0xb')](),interaction['tracked'](_0xa7a0('0x19'),_0xa7a0('0x1d')),controller['update']);router[_0xa7a0('0x1e')](_0xa7a0('0xf'),auth[_0xa7a0('0xb')](),interaction['tracked'](_0xa7a0('0x19'),_0xa7a0('0x1f')),controller[_0xa7a0('0x20')]);router[_0xa7a0('0x1e')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa7a0('0x21')]);module['exports']=router; \ No newline at end of file +var _0x0911=['delete','/:id','faxinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','fax','update'];(function(_0x4baac3,_0x481c9a){var _0x4fb4bc=function(_0x27d865){while(--_0x27d865){_0x4baac3['push'](_0x4baac3['shift']());}};_0x4fb4bc(++_0x481c9a);}(_0x0911,0x1a9));var _0x1091=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0x0911[_0xd299c3];return _0x376574;};'use strict';var multer=require(_0x1091('0x0'));var util=require(_0x1091('0x1'));var path=require(_0x1091('0x2'));var timeout=require(_0x1091('0x3'));var express=require(_0x1091('0x4'));var router=express['Router']();var auth=require(_0x1091('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1091('0x6'));var controller=require(_0x1091('0x7'));router[_0x1091('0x8')]('/',auth[_0x1091('0x9')](),controller[_0x1091('0xa')]);router[_0x1091('0x8')](_0x1091('0xb'),auth[_0x1091('0x9')](),controller[_0x1091('0xc')]);router[_0x1091('0x8')]('/:id',auth[_0x1091('0x9')](),controller[_0x1091('0xd')]);router[_0x1091('0x8')](_0x1091('0xe'),auth[_0x1091('0x9')](),controller[_0x1091('0xf')]);router['get'](_0x1091('0x10'),auth[_0x1091('0x9')](),controller['download']);router['post']('/',auth[_0x1091('0x9')](),controller['create']);router[_0x1091('0x11')]('/:id/messages',auth[_0x1091('0x9')](),controller[_0x1091('0x12')]);router[_0x1091('0x11')](_0x1091('0x13'),auth['isAuthenticated'](),interaction[_0x1091('0x14')](_0x1091('0x15'),'faxinteraction:addtags'),controller['addTags']);router['put']('/:id',auth[_0x1091('0x9')](),interaction[_0x1091('0x14')](_0x1091('0x15'),'faxinteraction:update'),controller[_0x1091('0x16')]);router[_0x1091('0x17')](_0x1091('0x18'),auth[_0x1091('0x9')](),interaction[_0x1091('0x14')]('fax',_0x1091('0x19')),controller[_0x1091('0x1a')]);router[_0x1091('0x17')](_0x1091('0x13'),auth[_0x1091('0x9')](),controller['removeTags']);module[_0x1091('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 5f60208..335baa7 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 _0x1d3a=['out','DATE','sequelize','TEXT','medium','BOOLEAN'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x1d3a,0xaa));var _0xa1d3=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x1d3a[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0xa1d3('0x0'));module['exports']={'body':{'type':Sequelize[_0xa1d3('0x1')](_0xa1d3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xa1d3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa1d3('0x4')),'defaultValue':_0xa1d3('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa1d3('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa1d3('0x5')]}}; \ No newline at end of file +var _0x4e74=['DATE','exports','TEXT','medium','ENUM','out'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x4e74,0xeb));var _0x44e7=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0x4e74[_0x53b53e];return _0xbb6179;};'use strict';var Sequelize=require('sequelize');module[_0x44e7('0x0')]={'body':{'type':Sequelize[_0x44e7('0x1')](_0x44e7('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x44e7('0x3')]('in',_0x44e7('0x4')),'defaultValue':_0x44e7('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x44e7('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x44e7('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 599d468..5d6aa6e 100644 --- a/server/api/faxMessage/faxMessage.controller.js +++ b/server/api/faxMessage/faxMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','EventManager','acceptmessage','fax','agent','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','create','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','update','stack','name','send','index','FaxMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','body','destroy','describe','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteraction','isNil'];(function(_0x4728c8,_0x1913e7){var _0x1faa7c=function(_0x3e2f16){while(--_0x3e2f16){_0x4728c8['push'](_0x4728c8['shift']());}};_0x1faa7c(++_0x1913e7);}(_0xb10b,0x12a));var _0xbb10=function(_0xe96931,_0x2f59d7){_0xe96931=_0xe96931-0x0;var _0x332f08=_0xb10b[_0xe96931];return _0x332f08;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];config[_0xbb10('0x18')]=_[_0xbb10('0x19')](config[_0xbb10('0x18')],{'host':_0xbb10('0x1a'),'port':0x18eb});var socket=require(_0xbb10('0x1b'))(new Redis(config[_0xbb10('0x18')]));require('./faxMessage.socket')[_0xbb10('0x1c')](socket);var jayson=require(_0xbb10('0x1d'));var client=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232c});var client9002=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x24a57b,_0x36b5e8,_0x3e26f4){if(_0x3e26f4){var _0x2b184e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b184e['test'](_0x36b5e8)){return _0x24a57b;}else{throw new db[(_0xbb10('0x20'))][(_0xbb10('0x21'))](_0xbb10('0x22'));}}else{return _0x24a57b;}}function respondWithRpcPromise(_0x42db98,_0x378da8,_0x1682a4,_0x575cca){return new BPromise(function(_0x30efc6,_0xbf2906){var _0xe1c665=_0x575cca||client;return _0xe1c665['request'](_0x42db98,_0x1682a4)[_0xbb10('0x23')](function(_0x19f48d){logger[_0xbb10('0x24')](_0xbb10('0x25'),_0x378da8,_0xbb10('0x26'));logger[_0xbb10('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'),JSON[_0xbb10('0x28')](_0x19f48d));if(_0x19f48d['error']){if(_0x19f48d['error'][_0xbb10('0x29')]===0x1f4){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0xbf2906(_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);}logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0x30efc6(_0x19f48d[_0xbb10('0x2a')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'));_0x30efc6(_0x19f48d[_0xbb10('0x2c')][_0xbb10('0x2b')]);}})['catch'](function(_0x2fdde9){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x2fdde9);_0xbf2906(_0x2fdde9);});});}function respondWithStatusCode(_0x1d5e95,_0x1acce9){_0x1acce9=_0x1acce9||0xcc;return function(_0x20d946){if(_0x20d946){return _0x1d5e95[_0xbb10('0x2d')](_0x1acce9);}return _0x1d5e95['status'](_0x1acce9)[_0xbb10('0x2e')]();};}function respondWithResult(_0x21ac54,_0xfc3595){_0xfc3595=_0xfc3595||0xc8;return function(_0x2e0249){if(_0x2e0249){return _0x21ac54[_0xbb10('0x2f')](_0xfc3595)[_0xbb10('0x30')](_0x2e0249);}};}function respondWithFilteredResult(_0x5d5c80,_0x221624){return function(_0x4ee02e){if(_0x4ee02e){var _0x448d5c=_0x4ee02e[_0xbb10('0x31')],_0x56f2da=_0x221624['offset'],_0x16ad2a=_0x221624['offset']+_0x221624[_0xbb10('0x32')],_0x1dcc9c;if(_0x16ad2a>=_0x448d5c){_0x16ad2a=_0x448d5c;_0x1dcc9c=0xc8;}else{_0x1dcc9c=0xce;}_0x5d5c80[_0xbb10('0x2f')](_0x1dcc9c);return _0x5d5c80['set'](_0xbb10('0x33'),_0x56f2da+'-'+_0x16ad2a+'/'+_0x448d5c)[_0xbb10('0x30')](_0x4ee02e);}return null;};}function patchUpdates(_0x2f653f){return function(_0x1c0b57){try{jsonpatch[_0xbb10('0x34')](_0x1c0b57,_0x2f653f,!![]);}catch(_0x138bc6){return BPromise[_0xbb10('0x35')](_0x138bc6);}return _0x1c0b57['save']();};}function saveUpdates(_0x25acb3,_0x1da9c9){return function(_0x441d15){if(_0x441d15){return _0x441d15[_0xbb10('0x36')](_0x25acb3)[_0xbb10('0x23')](function(_0x9de708){return _0x9de708;});}return null;};}function removeEntity(_0x188cbd,_0x10202c){return function(_0x3c8d7d){if(_0x3c8d7d){return _0x3c8d7d['destroy']()[_0xbb10('0x23')](function(){_0x188cbd[_0xbb10('0x2f')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x3c3c45,_0x570f5a){return function(_0x111762){if(!_0x111762){_0x3c3c45['sendStatus'](0x194);}return _0x111762;};}function handleError(_0x4e2754,_0x3eb3cc){_0x3eb3cc=_0x3eb3cc||0x1f4;return function(_0x40c164){logger[_0xbb10('0x2a')](_0x40c164[_0xbb10('0x37')]);if(_0x40c164[_0xbb10('0x38')]){delete _0x40c164[_0xbb10('0x38')];}_0x4e2754['status'](_0x3eb3cc)[_0xbb10('0x39')](_0x40c164);};}exports[_0xbb10('0x3a')]=function(_0x52de31,_0x5e3fbd){var _0x5cd55f={},_0x31bee3={},_0x2b0b45={'count':0x0,'rows':[]};var _0x2b658a=_['map'](db[_0xbb10('0x3b')][_0xbb10('0x3c')],function(_0x4345f3){return{'name':_0x4345f3['fieldName'],'type':_0x4345f3[_0xbb10('0x3d')][_0xbb10('0x3e')]};});_0x31bee3[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x2b658a,'name');_0x31bee3[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x52de31['query']);_0x31bee3[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x31bee3[_0xbb10('0x3f')],_0x31bee3[_0xbb10('0x41')]);_0x5cd55f[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x31bee3['model'],qs[_0xbb10('0x46')](_0x52de31[_0xbb10('0x41')][_0xbb10('0x46')]));_0x5cd55f[_0xbb10('0x45')]=_0x5cd55f['attributes'][_0xbb10('0x47')]?_0x5cd55f[_0xbb10('0x45')]:_0x31bee3[_0xbb10('0x3f')];if(!_0x52de31[_0xbb10('0x41')]['hasOwnProperty'](_0xbb10('0x48'))){_0x5cd55f[_0xbb10('0x32')]=qs['limit'](_0x52de31['query'][_0xbb10('0x32')]);_0x5cd55f['offset']=qs[_0xbb10('0x49')](_0x52de31[_0xbb10('0x41')]['offset']);}_0x5cd55f[_0xbb10('0x4a')]=qs[_0xbb10('0x4b')](_0x52de31[_0xbb10('0x41')]['sort']);_0x5cd55f[_0xbb10('0x4c')]=qs[_0xbb10('0x43')](_[_0xbb10('0x4d')](_0x52de31[_0xbb10('0x41')],_0x31bee3[_0xbb10('0x43')]));if(_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]){_0x5cd55f[_0xbb10('0x4c')]=_[_0xbb10('0x4f')](_0x5cd55f[_0xbb10('0x4c')],{'$or':_[_0xbb10('0x40')](_0x2b658a,function(_0x1eadd2){if(_0x1eadd2['type']!==_0xbb10('0x50')){var _0x41bbf8={};_0x41bbf8[_0x1eadd2['name']]={'$like':'%'+_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]+'%'};return _0x41bbf8;}})});}_0x5cd55f=_[_0xbb10('0x4f')]({},_0x5cd55f,_0x52de31[_0xbb10('0x51')]);var _0x41ea91={'where':_0x5cd55f[_0xbb10('0x4c')]};return db[_0xbb10('0x3b')]['count'](_0x41ea91)['then'](function(_0xcb3354){_0x2b0b45[_0xbb10('0x31')]=_0xcb3354;if(_0x52de31[_0xbb10('0x41')]['includeAll']){_0x5cd55f['include']=[{'all':!![]}];}return db[_0xbb10('0x3b')][_0xbb10('0x52')](_0x5cd55f);})[_0xbb10('0x23')](function(_0xf820fe){_0x2b0b45[_0xbb10('0x53')]=_0xf820fe;return _0x2b0b45;})[_0xbb10('0x23')](respondWithFilteredResult(_0x5e3fbd,_0x5cd55f))[_0xbb10('0x54')](handleError(_0x5e3fbd,null));};exports[_0xbb10('0x55')]=function(_0x2626d8,_0x3d7e7e){var _0x550111={'raw':!![],'where':{'id':_0x2626d8[_0xbb10('0x56')]['id']}},_0x5eafac={};_0x5eafac[_0xbb10('0x3f')]=_[_0xbb10('0x42')](db[_0xbb10('0x3b')][_0xbb10('0x3c')]);_0x5eafac[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x2626d8[_0xbb10('0x41')]);_0x5eafac[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],_0x5eafac[_0xbb10('0x41')]);_0x550111[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],qs['fields'](_0x2626d8[_0xbb10('0x41')]['fields']));_0x550111[_0xbb10('0x45')]=_0x550111[_0xbb10('0x45')][_0xbb10('0x47')]?_0x550111[_0xbb10('0x45')]:_0x5eafac[_0xbb10('0x3f')];if(_0x2626d8[_0xbb10('0x41')][_0xbb10('0x57')]){_0x550111[_0xbb10('0x58')]=[{'all':!![]}];}_0x550111=_[_0xbb10('0x4f')]({},_0x550111,_0x2626d8[_0xbb10('0x51')]);return db[_0xbb10('0x3b')][_0xbb10('0x59')](_0x550111)[_0xbb10('0x23')](handleEntityNotFound(_0x3d7e7e,null))[_0xbb10('0x23')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x54')](handleError(_0x3d7e7e,null));};exports['update']=function(_0x4571b6,_0x466eb7){if(_0x4571b6[_0xbb10('0x5a')]['id']){delete _0x4571b6[_0xbb10('0x5a')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x4571b6['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x466eb7,null))[_0xbb10('0x23')](saveUpdates(_0x4571b6[_0xbb10('0x5a')],null))[_0xbb10('0x23')](respondWithResult(_0x466eb7,null))[_0xbb10('0x54')](handleError(_0x466eb7,null));};exports[_0xbb10('0x5b')]=function(_0x175872,_0x12ec18){return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x175872[_0xbb10('0x56')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))[_0xbb10('0x23')](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['describe']=function(_0x16272d,_0x3e6338){return db[_0xbb10('0x3b')][_0xbb10('0x5c')]()['then'](respondWithResult(_0x3e6338,null))['catch'](handleError(_0x3e6338,null));};var interaction_log=require(_0xbb10('0x15'))(_0xbb10('0x5d'));exports[_0xbb10('0x5e')]=function(_0x2dd150,_0x412f13,_0x3e9753){var _0x45c0dc={'channel':'fax'};if(_0x2dd150[_0xbb10('0x5a')]['id']){delete _0x2dd150[_0xbb10('0x5a')]['id'];}_0x2dd150['body']['read']=!![];_0x2dd150['body'][_0xbb10('0x5f')]=moment()[_0xbb10('0x60')](_0xbb10('0x61'));_0x2dd150['body']['UserId']=_0x2dd150['body'][_0xbb10('0x62')]||_0x2dd150[_0xbb10('0x63')]['id'];return db[_0xbb10('0x3b')]['find']({'where':{'id':_0x2dd150[_0xbb10('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xbb10('0x64')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](saveUpdates(_0x2dd150[_0xbb10('0x5a')],null))[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x45c0dc['message']=_0x237246[_0xbb10('0x65')]({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x237246['FaxInteractionId']}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](function(_0x3e3617){if(_0x3e3617){return _0x3e3617['update']({'UserId':_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x62')],'read1stAt':_[_0xbb10('0x67')](_0x3e3617[_0xbb10('0x68')])?moment()['format'](_0xbb10('0x61')):undefined});}return null;})[_0xbb10('0x23')](function(_0x108e5b){if(_0x108e5b){_0x45c0dc[_0xbb10('0x69')]=_0x108e5b['get']({'plain':!![]});interaction_log[_0xbb10('0x24')](_0xbb10('0x6a'),_0x2dd150[_0xbb10('0x63')]['id'],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x6b')],_0x45c0dc['interaction']['id'],_0x2dd150['body']?JSON['stringify'](_0x2dd150[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x6d'),'acceptMessage',_0x45c0dc);}return null;})['then'](function(_0x46f462){if(_0x46f462){if(_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x6e')]){_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')]);_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x45c0dc[_0xbb10('0x70')];_0x45c0dc['message']['event']='accept';return respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':_0xbb10('0x72'),'message':_0x45c0dc[_0xbb10('0x2b')]},client9002)[_0xbb10('0x23')](function(){return _0x45c0dc;});}return _0x45c0dc;}return null;})[_0xbb10('0x23')](respondWithResult(_0x412f13,null))['catch'](handleError(_0x412f13,null));};var interaction_log=require(_0xbb10('0x15'))('fax-interactions');exports['reject']=function(_0x519a54,_0xdf634f,_0x13040d){var _0x23b1d5={'agent':{},'channel':_0xbb10('0x73')};if(_0x519a54['body']['id']){delete _0x519a54[_0xbb10('0x5a')]['id'];}_0x519a54['body']['UserId']=_0x519a54[_0xbb10('0x5a')][_0xbb10('0x62')]||_0x519a54[_0xbb10('0x63')]['id'];_0x23b1d5[_0xbb10('0x74')]['id']=_0x519a54[_0xbb10('0x5a')]['UserId'];return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x519a54[_0xbb10('0x56')]['id'],'UserId':null}})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x27f42f){if(_0x27f42f){_0x23b1d5[_0xbb10('0x2b')]=_0x27f42f['get']({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x27f42f[_0xbb10('0x75')]}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x172be3){if(_0x172be3){_0x23b1d5[_0xbb10('0x69')]=_0x172be3[_0xbb10('0x65')]({'plain':!![]});interaction_log['info'](_0xbb10('0x76'),_0x519a54[_0xbb10('0x63')]['id'],_0x519a54[_0xbb10('0x63')]['name'],_0x519a54['user']['role'],_0x23b1d5[_0xbb10('0x69')]['id'],_0x519a54['body']?JSON['stringify'](_0x519a54[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x77'),_0xbb10('0x78'),_0x23b1d5);}return null;})[_0xbb10('0x23')](function(_0x24dca6){if(_0x24dca6){_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x519a54[_0xbb10('0x63')][_0xbb10('0x38')]);_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x23b1d5['channel'];_0x24dca6['message'][_0xbb10('0x79')]=_0xbb10('0x35');respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':'rejectmessage','message':_0x24dca6[_0xbb10('0x2b')]},client9002);return _0x23b1d5;}return null;})[_0xbb10('0x23')](respondWithResult(_0xdf634f,null))[_0xbb10('0x54')](handleError(_0xdf634f,null));};exports[_0xbb10('0x7a')]=function(_0x35c1e8,_0x517185){var _0x5f0691;return db[_0xbb10('0x3b')][_0xbb10('0x7a')](_0x35c1e8[_0xbb10('0x5a')],{})['then'](function(_0x256b35){_0x5f0691=_0x256b35;return db[_0xbb10('0x64')]['findOne']({'where':{'id':_0x5f0691['ContactId']}});})[_0xbb10('0x23')](function(_0x26d0dd){if(_[_0xbb10('0x67')](_0x26d0dd)){return;}else{_0x5f0691['fax']=_0x26d0dd[_0xbb10('0x73')];return db[_0xbb10('0x7b')][_0xbb10('0x7c')]({'where':{'id':_0x5f0691[_0xbb10('0x7d')]}});}})[_0xbb10('0x23')](function(_0x5de006){return respondWithRpcPromise(_0xbb10('0x7e'),_0xbb10('0x7e'),{'FaxAccountId':_[_0xbb10('0x67')](_0x35c1e8['body'])?undefined:_0x35c1e8[_0xbb10('0x5a')][_0xbb10('0x7f')],'path':_[_0xbb10('0x67')](_0x5de006)?undefined:util[_0xbb10('0x60')](_0xbb10('0x80'),_0x5de006[_0xbb10('0x81')]),'fax':_[_0xbb10('0x67')](_0x5f0691[_0xbb10('0x73')])?undefined:_0x5f0691[_0xbb10('0x73')],'AttachmentId':_0x5f0691[_0xbb10('0x7d')]},client9002);})[_0xbb10('0x23')](respondWithResult(_0x517185,0xc9))[_0xbb10('0x54')](handleError(_0x517185,null));};exports['download']=function(_0x51f106,_0xe1fc51){var _0x3fa344=path[_0xbb10('0x82')](config[_0xbb10('0x83')],_0xbb10('0x84'),'files',_0xbb10('0x85'));return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x51f106[_0xbb10('0x56')]['id']},'include':[{'model':db[_0xbb10('0x7b')],'as':_0xbb10('0x7b')}]})['then'](handleEntityNotFound(_0xe1fc51,null))[_0xbb10('0x23')](function(_0x742e10){if(_0x742e10){return _0xe1fc51['download'](path[_0xbb10('0x82')](_0x3fa344,_0x742e10['Attachment'][_0xbb10('0x81')]));}})[_0xbb10('0x54')](handleError(_0xe1fc51,null));}; \ No newline at end of file +var _0xb10b=['read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','EventManager','acceptmessage','fax','agent','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','create','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','update','stack','name','send','index','FaxMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','body','destroy','describe','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteraction','isNil'];(function(_0x47b49d,_0x66e6fd){var _0x1af551=function(_0x3c5e0c){while(--_0x3c5e0c){_0x47b49d['push'](_0x47b49d['shift']());}};_0x1af551(++_0x66e6fd);}(_0xb10b,0x12a));var _0xbb10=function(_0x35e083,_0x2a67b7){_0x35e083=_0x35e083-0x0;var _0x4c1d88=_0xb10b[_0x35e083];return _0x4c1d88;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];config[_0xbb10('0x18')]=_[_0xbb10('0x19')](config[_0xbb10('0x18')],{'host':_0xbb10('0x1a'),'port':0x18eb});var socket=require(_0xbb10('0x1b'))(new Redis(config[_0xbb10('0x18')]));require('./faxMessage.socket')[_0xbb10('0x1c')](socket);var jayson=require(_0xbb10('0x1d'));var client=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232c});var client9002=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x24a57b,_0x36b5e8,_0x3e26f4){if(_0x3e26f4){var _0x2b184e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b184e['test'](_0x36b5e8)){return _0x24a57b;}else{throw new db[(_0xbb10('0x20'))][(_0xbb10('0x21'))](_0xbb10('0x22'));}}else{return _0x24a57b;}}function respondWithRpcPromise(_0x42db98,_0x378da8,_0x1682a4,_0x575cca){return new BPromise(function(_0x30efc6,_0xbf2906){var _0xe1c665=_0x575cca||client;return _0xe1c665['request'](_0x42db98,_0x1682a4)[_0xbb10('0x23')](function(_0x19f48d){logger[_0xbb10('0x24')](_0xbb10('0x25'),_0x378da8,_0xbb10('0x26'));logger[_0xbb10('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'),JSON[_0xbb10('0x28')](_0x19f48d));if(_0x19f48d['error']){if(_0x19f48d['error'][_0xbb10('0x29')]===0x1f4){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0xbf2906(_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);}logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0x30efc6(_0x19f48d[_0xbb10('0x2a')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'));_0x30efc6(_0x19f48d[_0xbb10('0x2c')][_0xbb10('0x2b')]);}})['catch'](function(_0x2fdde9){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x2fdde9);_0xbf2906(_0x2fdde9);});});}function respondWithStatusCode(_0x1d5e95,_0x1acce9){_0x1acce9=_0x1acce9||0xcc;return function(_0x20d946){if(_0x20d946){return _0x1d5e95[_0xbb10('0x2d')](_0x1acce9);}return _0x1d5e95['status'](_0x1acce9)[_0xbb10('0x2e')]();};}function respondWithResult(_0x21ac54,_0xfc3595){_0xfc3595=_0xfc3595||0xc8;return function(_0x2e0249){if(_0x2e0249){return _0x21ac54[_0xbb10('0x2f')](_0xfc3595)[_0xbb10('0x30')](_0x2e0249);}};}function respondWithFilteredResult(_0x5d5c80,_0x221624){return function(_0x4ee02e){if(_0x4ee02e){var _0x448d5c=_0x4ee02e[_0xbb10('0x31')],_0x56f2da=_0x221624['offset'],_0x16ad2a=_0x221624['offset']+_0x221624[_0xbb10('0x32')],_0x1dcc9c;if(_0x16ad2a>=_0x448d5c){_0x16ad2a=_0x448d5c;_0x1dcc9c=0xc8;}else{_0x1dcc9c=0xce;}_0x5d5c80[_0xbb10('0x2f')](_0x1dcc9c);return _0x5d5c80['set'](_0xbb10('0x33'),_0x56f2da+'-'+_0x16ad2a+'/'+_0x448d5c)[_0xbb10('0x30')](_0x4ee02e);}return null;};}function patchUpdates(_0x2f653f){return function(_0x1c0b57){try{jsonpatch[_0xbb10('0x34')](_0x1c0b57,_0x2f653f,!![]);}catch(_0x138bc6){return BPromise[_0xbb10('0x35')](_0x138bc6);}return _0x1c0b57['save']();};}function saveUpdates(_0x25acb3,_0x1da9c9){return function(_0x441d15){if(_0x441d15){return _0x441d15[_0xbb10('0x36')](_0x25acb3)[_0xbb10('0x23')](function(_0x9de708){return _0x9de708;});}return null;};}function removeEntity(_0x188cbd,_0x10202c){return function(_0x3c8d7d){if(_0x3c8d7d){return _0x3c8d7d['destroy']()[_0xbb10('0x23')](function(){_0x188cbd[_0xbb10('0x2f')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x3c3c45,_0x570f5a){return function(_0x111762){if(!_0x111762){_0x3c3c45['sendStatus'](0x194);}return _0x111762;};}function handleError(_0x4e2754,_0x3eb3cc){_0x3eb3cc=_0x3eb3cc||0x1f4;return function(_0x40c164){logger[_0xbb10('0x2a')](_0x40c164[_0xbb10('0x37')]);if(_0x40c164[_0xbb10('0x38')]){delete _0x40c164[_0xbb10('0x38')];}_0x4e2754['status'](_0x3eb3cc)[_0xbb10('0x39')](_0x40c164);};}exports[_0xbb10('0x3a')]=function(_0x52de31,_0x5e3fbd){var _0x5cd55f={},_0x31bee3={},_0x2b0b45={'count':0x0,'rows':[]};var _0x2b658a=_['map'](db[_0xbb10('0x3b')][_0xbb10('0x3c')],function(_0x4345f3){return{'name':_0x4345f3['fieldName'],'type':_0x4345f3[_0xbb10('0x3d')][_0xbb10('0x3e')]};});_0x31bee3[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x2b658a,'name');_0x31bee3[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x52de31['query']);_0x31bee3[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x31bee3[_0xbb10('0x3f')],_0x31bee3[_0xbb10('0x41')]);_0x5cd55f[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x31bee3['model'],qs[_0xbb10('0x46')](_0x52de31[_0xbb10('0x41')][_0xbb10('0x46')]));_0x5cd55f[_0xbb10('0x45')]=_0x5cd55f['attributes'][_0xbb10('0x47')]?_0x5cd55f[_0xbb10('0x45')]:_0x31bee3[_0xbb10('0x3f')];if(!_0x52de31[_0xbb10('0x41')]['hasOwnProperty'](_0xbb10('0x48'))){_0x5cd55f[_0xbb10('0x32')]=qs['limit'](_0x52de31['query'][_0xbb10('0x32')]);_0x5cd55f['offset']=qs[_0xbb10('0x49')](_0x52de31[_0xbb10('0x41')]['offset']);}_0x5cd55f[_0xbb10('0x4a')]=qs[_0xbb10('0x4b')](_0x52de31[_0xbb10('0x41')]['sort']);_0x5cd55f[_0xbb10('0x4c')]=qs[_0xbb10('0x43')](_[_0xbb10('0x4d')](_0x52de31[_0xbb10('0x41')],_0x31bee3[_0xbb10('0x43')]));if(_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]){_0x5cd55f[_0xbb10('0x4c')]=_[_0xbb10('0x4f')](_0x5cd55f[_0xbb10('0x4c')],{'$or':_[_0xbb10('0x40')](_0x2b658a,function(_0x1eadd2){if(_0x1eadd2['type']!==_0xbb10('0x50')){var _0x41bbf8={};_0x41bbf8[_0x1eadd2['name']]={'$like':'%'+_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]+'%'};return _0x41bbf8;}})});}_0x5cd55f=_[_0xbb10('0x4f')]({},_0x5cd55f,_0x52de31[_0xbb10('0x51')]);var _0x41ea91={'where':_0x5cd55f[_0xbb10('0x4c')]};return db[_0xbb10('0x3b')]['count'](_0x41ea91)['then'](function(_0xcb3354){_0x2b0b45[_0xbb10('0x31')]=_0xcb3354;if(_0x52de31[_0xbb10('0x41')]['includeAll']){_0x5cd55f['include']=[{'all':!![]}];}return db[_0xbb10('0x3b')][_0xbb10('0x52')](_0x5cd55f);})[_0xbb10('0x23')](function(_0xf820fe){_0x2b0b45[_0xbb10('0x53')]=_0xf820fe;return _0x2b0b45;})[_0xbb10('0x23')](respondWithFilteredResult(_0x5e3fbd,_0x5cd55f))[_0xbb10('0x54')](handleError(_0x5e3fbd,null));};exports[_0xbb10('0x55')]=function(_0x2626d8,_0x3d7e7e){var _0x550111={'raw':!![],'where':{'id':_0x2626d8[_0xbb10('0x56')]['id']}},_0x5eafac={};_0x5eafac[_0xbb10('0x3f')]=_[_0xbb10('0x42')](db[_0xbb10('0x3b')][_0xbb10('0x3c')]);_0x5eafac[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x2626d8[_0xbb10('0x41')]);_0x5eafac[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],_0x5eafac[_0xbb10('0x41')]);_0x550111[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],qs['fields'](_0x2626d8[_0xbb10('0x41')]['fields']));_0x550111[_0xbb10('0x45')]=_0x550111[_0xbb10('0x45')][_0xbb10('0x47')]?_0x550111[_0xbb10('0x45')]:_0x5eafac[_0xbb10('0x3f')];if(_0x2626d8[_0xbb10('0x41')][_0xbb10('0x57')]){_0x550111[_0xbb10('0x58')]=[{'all':!![]}];}_0x550111=_[_0xbb10('0x4f')]({},_0x550111,_0x2626d8[_0xbb10('0x51')]);return db[_0xbb10('0x3b')][_0xbb10('0x59')](_0x550111)[_0xbb10('0x23')](handleEntityNotFound(_0x3d7e7e,null))[_0xbb10('0x23')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x54')](handleError(_0x3d7e7e,null));};exports['update']=function(_0x4571b6,_0x466eb7){if(_0x4571b6[_0xbb10('0x5a')]['id']){delete _0x4571b6[_0xbb10('0x5a')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x4571b6['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x466eb7,null))[_0xbb10('0x23')](saveUpdates(_0x4571b6[_0xbb10('0x5a')],null))[_0xbb10('0x23')](respondWithResult(_0x466eb7,null))[_0xbb10('0x54')](handleError(_0x466eb7,null));};exports[_0xbb10('0x5b')]=function(_0x175872,_0x12ec18){return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x175872[_0xbb10('0x56')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))[_0xbb10('0x23')](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['describe']=function(_0x16272d,_0x3e6338){return db[_0xbb10('0x3b')][_0xbb10('0x5c')]()['then'](respondWithResult(_0x3e6338,null))['catch'](handleError(_0x3e6338,null));};var interaction_log=require(_0xbb10('0x15'))(_0xbb10('0x5d'));exports[_0xbb10('0x5e')]=function(_0x2dd150,_0x412f13,_0x3e9753){var _0x45c0dc={'channel':'fax'};if(_0x2dd150[_0xbb10('0x5a')]['id']){delete _0x2dd150[_0xbb10('0x5a')]['id'];}_0x2dd150['body']['read']=!![];_0x2dd150['body'][_0xbb10('0x5f')]=moment()[_0xbb10('0x60')](_0xbb10('0x61'));_0x2dd150['body']['UserId']=_0x2dd150['body'][_0xbb10('0x62')]||_0x2dd150[_0xbb10('0x63')]['id'];return db[_0xbb10('0x3b')]['find']({'where':{'id':_0x2dd150[_0xbb10('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xbb10('0x64')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](saveUpdates(_0x2dd150[_0xbb10('0x5a')],null))[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x45c0dc['message']=_0x237246[_0xbb10('0x65')]({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x237246['FaxInteractionId']}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](function(_0x3e3617){if(_0x3e3617){return _0x3e3617['update']({'UserId':_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x62')],'read1stAt':_[_0xbb10('0x67')](_0x3e3617[_0xbb10('0x68')])?moment()['format'](_0xbb10('0x61')):undefined});}return null;})[_0xbb10('0x23')](function(_0x108e5b){if(_0x108e5b){_0x45c0dc[_0xbb10('0x69')]=_0x108e5b['get']({'plain':!![]});interaction_log[_0xbb10('0x24')](_0xbb10('0x6a'),_0x2dd150[_0xbb10('0x63')]['id'],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x6b')],_0x45c0dc['interaction']['id'],_0x2dd150['body']?JSON['stringify'](_0x2dd150[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x6d'),'acceptMessage',_0x45c0dc);}return null;})['then'](function(_0x46f462){if(_0x46f462){if(_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x6e')]){_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')]);_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x45c0dc[_0xbb10('0x70')];_0x45c0dc['message']['event']='accept';return respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':_0xbb10('0x72'),'message':_0x45c0dc[_0xbb10('0x2b')]},client9002)[_0xbb10('0x23')](function(){return _0x45c0dc;});}return _0x45c0dc;}return null;})[_0xbb10('0x23')](respondWithResult(_0x412f13,null))['catch'](handleError(_0x412f13,null));};var interaction_log=require(_0xbb10('0x15'))('fax-interactions');exports['reject']=function(_0x519a54,_0xdf634f,_0x13040d){var _0x23b1d5={'agent':{},'channel':_0xbb10('0x73')};if(_0x519a54['body']['id']){delete _0x519a54[_0xbb10('0x5a')]['id'];}_0x519a54['body']['UserId']=_0x519a54[_0xbb10('0x5a')][_0xbb10('0x62')]||_0x519a54[_0xbb10('0x63')]['id'];_0x23b1d5[_0xbb10('0x74')]['id']=_0x519a54[_0xbb10('0x5a')]['UserId'];return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x519a54[_0xbb10('0x56')]['id'],'UserId':null}})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x27f42f){if(_0x27f42f){_0x23b1d5[_0xbb10('0x2b')]=_0x27f42f['get']({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x27f42f[_0xbb10('0x75')]}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x172be3){if(_0x172be3){_0x23b1d5[_0xbb10('0x69')]=_0x172be3[_0xbb10('0x65')]({'plain':!![]});interaction_log['info'](_0xbb10('0x76'),_0x519a54[_0xbb10('0x63')]['id'],_0x519a54[_0xbb10('0x63')]['name'],_0x519a54['user']['role'],_0x23b1d5[_0xbb10('0x69')]['id'],_0x519a54['body']?JSON['stringify'](_0x519a54[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x77'),_0xbb10('0x78'),_0x23b1d5);}return null;})[_0xbb10('0x23')](function(_0x24dca6){if(_0x24dca6){_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x519a54[_0xbb10('0x63')][_0xbb10('0x38')]);_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x23b1d5['channel'];_0x24dca6['message'][_0xbb10('0x79')]=_0xbb10('0x35');respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':'rejectmessage','message':_0x24dca6[_0xbb10('0x2b')]},client9002);return _0x23b1d5;}return null;})[_0xbb10('0x23')](respondWithResult(_0xdf634f,null))[_0xbb10('0x54')](handleError(_0xdf634f,null));};exports[_0xbb10('0x7a')]=function(_0x35c1e8,_0x517185){var _0x5f0691;return db[_0xbb10('0x3b')][_0xbb10('0x7a')](_0x35c1e8[_0xbb10('0x5a')],{})['then'](function(_0x256b35){_0x5f0691=_0x256b35;return db[_0xbb10('0x64')]['findOne']({'where':{'id':_0x5f0691['ContactId']}});})[_0xbb10('0x23')](function(_0x26d0dd){if(_[_0xbb10('0x67')](_0x26d0dd)){return;}else{_0x5f0691['fax']=_0x26d0dd[_0xbb10('0x73')];return db[_0xbb10('0x7b')][_0xbb10('0x7c')]({'where':{'id':_0x5f0691[_0xbb10('0x7d')]}});}})[_0xbb10('0x23')](function(_0x5de006){return respondWithRpcPromise(_0xbb10('0x7e'),_0xbb10('0x7e'),{'FaxAccountId':_[_0xbb10('0x67')](_0x35c1e8['body'])?undefined:_0x35c1e8[_0xbb10('0x5a')][_0xbb10('0x7f')],'path':_[_0xbb10('0x67')](_0x5de006)?undefined:util[_0xbb10('0x60')](_0xbb10('0x80'),_0x5de006[_0xbb10('0x81')]),'fax':_[_0xbb10('0x67')](_0x5f0691[_0xbb10('0x73')])?undefined:_0x5f0691[_0xbb10('0x73')],'AttachmentId':_0x5f0691[_0xbb10('0x7d')]},client9002);})[_0xbb10('0x23')](respondWithResult(_0x517185,0xc9))[_0xbb10('0x54')](handleError(_0x517185,null));};exports['download']=function(_0x51f106,_0xe1fc51){var _0x3fa344=path[_0xbb10('0x82')](config[_0xbb10('0x83')],_0xbb10('0x84'),'files',_0xbb10('0x85'));return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x51f106[_0xbb10('0x56')]['id']},'include':[{'model':db[_0xbb10('0x7b')],'as':_0xbb10('0x7b')}]})['then'](handleEntityNotFound(_0xe1fc51,null))[_0xbb10('0x23')](function(_0x742e10){if(_0x742e10){return _0xe1fc51['download'](path[_0xbb10('0x82')](_0x3fa344,_0x742e10['Attachment'][_0xbb10('0x81')]));}})[_0xbb10('0x54')](handleError(_0xe1fc51,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 9cd7a36..e278fb6 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxMessage'];(function(_0x47b3cf,_0x5bcca2){var _0x346ff2=function(_0x1dcc1a){while(--_0x1dcc1a){_0x47b3cf['push'](_0x47b3cf['shift']());}};_0x346ff2(++_0x5bcca2);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0x7995('0x0'));var FaxMessage=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){FaxMessageEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);FaxMessageEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];FaxMessage[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x3e74=['hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3e74,0x175));var _0x43e7=function(_0x56f764,_0x4acb5a){_0x56f764=_0x56f764-0x0;var _0x5779ee=_0x3e74[_0x56f764];return _0x5779ee;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x43e7('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){FaxMessageEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);FaxMessageEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 707f537..73b7bf8 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 _0xc82e=['direction','toLowerCase','out','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','models','get'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc82e,0x85));var _0xec82=function(_0x55a975,_0x44dc51){_0x55a975=_0x55a975-0x0;var _0x94b368=_0xc82e[_0x55a975];return _0x94b368;};'use strict';var _=require(_0xec82('0x0'));var util=require(_0xec82('0x1'));var logger=require(_0xec82('0x2'))(_0xec82('0x3'));var moment=require(_0xec82('0x4'));var BPromise=require(_0xec82('0x5'));var rp=require(_0xec82('0x6'));var fs=require('fs');var path=require(_0xec82('0x7'));var rimraf=require(_0xec82('0x8'));var config=require('../../config/environment');var attributes=require(_0xec82('0x9'));module[_0xec82('0xa')]=function(_0x3e0c67,_0x534d4e){return _0x3e0c67[_0xec82('0xb')](_0xec82('0xc'),attributes,{'tableName':_0xec82('0xd'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0xec82('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3124b2,_0x5901bb,_0x1b5047){var _0x1ec999=_0x3e0c67[_0xec82('0xf')];var _0x382b6e=_0x3124b2[_0xec82('0x10')]({'plain':!![]});if(_0x382b6e[_0xec82('0x11')][_0xec82('0x12')]()==='in'||_0x382b6e[_0xec82('0x11')]['toLowerCase']()===_0xec82('0x13')&&!_0x382b6e['secret']&&!_[_0xec82('0x14')](_0x382b6e[_0xec82('0x15')])){_0x1ec999['FaxInteraction'][_0xec82('0x16')]({'where':{'id':_0x382b6e[_0xec82('0x17')]}})[_0xec82('0x18')](function(_0xe0a35d){if(_0xe0a35d){_0xe0a35d[_0xec82('0x19')]({'lastMsgAt':_0x382b6e[_0xec82('0x1a')],'lastMsgDirection':_0x382b6e[_0xec82('0x11')][_0xec82('0x12')]()});}})[_0xec82('0x1b')](function(_0x36098a){console[_0xec82('0x1c')](_0x36098a);});}_0x1b5047();}},'charset':'utf8mb4','collate':_0xec82('0x1d')});}; \ No newline at end of file +var _0x7766=['models','get','direction','toLowerCase','out','secret','isNil','FaxInteractionId','then','update','createdAt','error','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','body','FULLTEXT'];(function(_0x5224b9,_0x195fcb){var _0x363bcc=function(_0x3d219a){while(--_0x3d219a){_0x5224b9['push'](_0x5224b9['shift']());}};_0x363bcc(++_0x195fcb);}(_0x7766,0xd1));var _0x6776=function(_0x29ad0e,_0x4d7e03){_0x29ad0e=_0x29ad0e-0x0;var _0x3199fd=_0x7766[_0x29ad0e];return _0x3199fd;};'use strict';var _=require(_0x6776('0x0'));var util=require(_0x6776('0x1'));var logger=require('../../config/logger')(_0x6776('0x2'));var moment=require(_0x6776('0x3'));var BPromise=require(_0x6776('0x4'));var rp=require(_0x6776('0x5'));var fs=require('fs');var path=require(_0x6776('0x6'));var rimraf=require(_0x6776('0x7'));var config=require(_0x6776('0x8'));var attributes=require(_0x6776('0x9'));module[_0x6776('0xa')]=function(_0x973766,_0x197bc0){return _0x973766['define'](_0x6776('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x6776('0xc'),'fields':[_0x6776('0xd')],'type':_0x6776('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2890bb,_0x2a3094,_0x30bfcb){var _0x33269d=_0x973766[_0x6776('0xf')];var _0x38686d=_0x2890bb[_0x6776('0x10')]({'plain':!![]});if(_0x38686d['direction']['toLowerCase']()==='in'||_0x38686d[_0x6776('0x11')][_0x6776('0x12')]()===_0x6776('0x13')&&!_0x38686d[_0x6776('0x14')]&&!_[_0x6776('0x15')](_0x38686d['UserId'])){_0x33269d['FaxInteraction']['findOne']({'where':{'id':_0x38686d[_0x6776('0x16')]}})[_0x6776('0x17')](function(_0xe3099c){if(_0xe3099c){_0xe3099c[_0x6776('0x18')]({'lastMsgAt':_0x38686d[_0x6776('0x19')],'lastMsgDirection':_0x38686d[_0x6776('0x11')][_0x6776('0x12')]()});}})['catch'](function(_0x17efc5){console[_0x6776('0x1a')](_0x17efc5);});}_0x30bfcb();}},'charset':'utf8mb4','collate':_0x6776('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 60a0272..b118572 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 _0x0a35=['socket.io-emitter','./faxMessage.socket','register','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','stringify','update','attributes','limit','UpdateFaxMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x8e69da,_0x4b916b){var _0x161ac8=function(_0x1eece0){while(--_0x1eece0){_0x8e69da['push'](_0x8e69da['shift']());}};_0x161ac8(++_0x4b916b);}(_0x0a35,0xe1));var _0x50a3=function(_0x10aa73,_0xc744f4){_0x10aa73=_0x10aa73-0x0;var _0x3496d9=_0x0a35[_0x10aa73];return _0x3496d9;};'use strict';var _=require(_0x50a3('0x0'));var util=require(_0x50a3('0x1'));var moment=require(_0x50a3('0x2'));var BPromise=require(_0x50a3('0x3'));var rs=require(_0x50a3('0x4'));var fs=require('fs');var Redis=require(_0x50a3('0x5'));var db=require(_0x50a3('0x6'))['db'];var utils=require(_0x50a3('0x7'));var logger=require(_0x50a3('0x8'))('rpc');var config=require(_0x50a3('0x9'));var jayson=require(_0x50a3('0xa'));var client=jayson[_0x50a3('0xb')][_0x50a3('0xc')]({'port':0x232a});config['redis']=_[_0x50a3('0xd')](config[_0x50a3('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x50a3('0xf'))(new Redis(config[_0x50a3('0xe')]));require(_0x50a3('0x10'))[_0x50a3('0x11')](socket);function respondWithRpcPromise(_0x166474,_0x557506,_0x2b91e9){return new BPromise(function(_0x3a526d,_0x3b2114){return client[_0x50a3('0x12')](_0x166474,_0x2b91e9)['then'](function(_0x4c7fe5){logger[_0x50a3('0x13')]('FaxMessage,\x20%s,\x20%s',_0x557506,_0x50a3('0x14'));logger[_0x50a3('0x15')](_0x50a3('0x16'),_0x557506,_0x50a3('0x14'),JSON['stringify'](_0x4c7fe5));if(_0x4c7fe5['error']){if(_0x4c7fe5[_0x50a3('0x17')][_0x50a3('0x18')]===0x1f4){logger[_0x50a3('0x17')](_0x50a3('0x19'),_0x557506,_0x4c7fe5[_0x50a3('0x17')]['message']);return _0x3b2114(_0x4c7fe5[_0x50a3('0x17')][_0x50a3('0x1a')]);}logger['error'](_0x50a3('0x19'),_0x557506,_0x4c7fe5['error'][_0x50a3('0x1a')]);return _0x3a526d(_0x4c7fe5[_0x50a3('0x17')][_0x50a3('0x1a')]);}else{logger[_0x50a3('0x13')](_0x50a3('0x19'),_0x557506,_0x50a3('0x14'));_0x3a526d(_0x4c7fe5[_0x50a3('0x1b')][_0x50a3('0x1a')]);}})[_0x50a3('0x1c')](function(_0x29e369){logger[_0x50a3('0x17')]('FaxMessage,\x20%s,\x20%s',_0x557506,_0x29e369);_0x3b2114(_0x29e369);});});}exports[_0x50a3('0x1d')]=function(_0x4435c9){var _0xc3e4b2=this;return new Promise(function(_0x27a69f,_0x55a60f){return db[_0x50a3('0x1e')][_0x50a3('0x1f')](_0x4435c9[_0x50a3('0x20')],{'raw':_0x4435c9[_0x50a3('0x21')]?_0x4435c9['options'][_0x50a3('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x347e29){logger[_0x50a3('0x13')](_0x50a3('0x1d'),_0x4435c9);logger[_0x50a3('0x15')](_0x50a3('0x1d'),_0x4435c9,JSON[_0x50a3('0x23')](_0x347e29));_0x27a69f(_0x347e29);})['catch'](function(_0x353e65){logger[_0x50a3('0x17')](_0x50a3('0x1d'),_0x353e65[_0x50a3('0x1a')],_0x4435c9);_0x55a60f(_0xc3e4b2[_0x50a3('0x17')](0x1f4,_0x353e65[_0x50a3('0x1a')]));});});};exports['UpdateFaxMessage']=function(_0x1d1195){var _0x3a566b=this;return new Promise(function(_0x14f3c1,_0x51dd05){return db['FaxMessage'][_0x50a3('0x24')](_0x1d1195[_0x50a3('0x20')],{'raw':_0x1d1195['options']?_0x1d1195['options'][_0x50a3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d1195[_0x50a3('0x21')]?_0x1d1195['options']['where']||null:null,'attributes':_0x1d1195[_0x50a3('0x21')]?_0x1d1195[_0x50a3('0x21')][_0x50a3('0x25')]||null:null,'limit':_0x1d1195[_0x50a3('0x21')]?_0x1d1195[_0x50a3('0x21')][_0x50a3('0x26')]||null:null})['then'](function(_0x38f3d2){logger[_0x50a3('0x13')](_0x50a3('0x27'),_0x1d1195);logger['debug'](_0x50a3('0x27'),_0x1d1195,JSON['stringify'](_0x38f3d2));_0x14f3c1(_0x38f3d2);})[_0x50a3('0x1c')](function(_0x3cd70c){logger[_0x50a3('0x17')]('UpdateFaxMessage',_0x3cd70c[_0x50a3('0x1a')],_0x1d1195);_0x51dd05(_0x3a566b['error'](0x1f4,_0x3cd70c['message']));});});}; \ No newline at end of file +var _0x7602=['FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','result','options','raw','CreateFaxMessage','UpdateFaxMessage','FaxMessage','body','where','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','then','request\x20sent','debug'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7602,0x15e));var _0x2760=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x7602[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0x2760('0x0'));var util=require(_0x2760('0x1'));var moment=require(_0x2760('0x2'));var BPromise=require(_0x2760('0x3'));var rs=require(_0x2760('0x4'));var fs=require('fs');var Redis=require(_0x2760('0x5'));var db=require(_0x2760('0x6'))['db'];var utils=require(_0x2760('0x7'));var logger=require(_0x2760('0x8'))(_0x2760('0x9'));var config=require(_0x2760('0xa'));var jayson=require(_0x2760('0xb'));var client=jayson[_0x2760('0xc')][_0x2760('0xd')]({'port':0x232a});config[_0x2760('0xe')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2760('0xf'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x2760('0x10')](socket);function respondWithRpcPromise(_0x3bc032,_0x361453,_0x2536ad){return new BPromise(function(_0x3f0911,_0x1473cc){return client['request'](_0x3bc032,_0x2536ad)[_0x2760('0x11')](function(_0x444c35){logger['info']('FaxMessage,\x20%s,\x20%s',_0x361453,_0x2760('0x12'));logger[_0x2760('0x13')](_0x2760('0x14'),_0x361453,_0x2760('0x12'),JSON[_0x2760('0x15')](_0x444c35));if(_0x444c35['error']){if(_0x444c35[_0x2760('0x16')][_0x2760('0x17')]===0x1f4){logger[_0x2760('0x16')](_0x2760('0x18'),_0x361453,_0x444c35[_0x2760('0x16')][_0x2760('0x19')]);return _0x1473cc(_0x444c35['error']['message']);}logger[_0x2760('0x16')]('FaxMessage,\x20%s,\x20%s',_0x361453,_0x444c35['error']['message']);return _0x3f0911(_0x444c35[_0x2760('0x16')][_0x2760('0x19')]);}else{logger[_0x2760('0x1a')](_0x2760('0x18'),_0x361453,_0x2760('0x12'));_0x3f0911(_0x444c35[_0x2760('0x1b')][_0x2760('0x19')]);}})['catch'](function(_0x13811c){logger[_0x2760('0x16')](_0x2760('0x18'),_0x361453,_0x13811c);_0x1473cc(_0x13811c);});});}exports['CreateFaxMessage']=function(_0x1a6ff3){var _0x593e9f=this;return new Promise(function(_0x4b1b90,_0xd54f5a){return db['FaxMessage']['create'](_0x1a6ff3['body'],{'raw':_0x1a6ff3[_0x2760('0x1c')]?_0x1a6ff3[_0x2760('0x1c')][_0x2760('0x1d')]===undefined?!![]:![]:!![]})[_0x2760('0x11')](function(_0x452dde){logger[_0x2760('0x1a')]('CreateFaxMessage',_0x1a6ff3);logger[_0x2760('0x13')](_0x2760('0x1e'),_0x1a6ff3,JSON['stringify'](_0x452dde));_0x4b1b90(_0x452dde);})['catch'](function(_0x194b27){logger['error']('CreateFaxMessage',_0x194b27[_0x2760('0x19')],_0x1a6ff3);_0xd54f5a(_0x593e9f[_0x2760('0x16')](0x1f4,_0x194b27['message']));});});};exports[_0x2760('0x1f')]=function(_0x407c69){var _0x36e378=this;return new Promise(function(_0x37bc5b,_0x4569dd){return db[_0x2760('0x20')]['update'](_0x407c69[_0x2760('0x21')],{'raw':_0x407c69[_0x2760('0x1c')]?_0x407c69['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x407c69[_0x2760('0x1c')]?_0x407c69['options'][_0x2760('0x22')]||null:null,'attributes':_0x407c69[_0x2760('0x1c')]?_0x407c69[_0x2760('0x1c')][_0x2760('0x23')]||null:null,'limit':_0x407c69[_0x2760('0x1c')]?_0x407c69[_0x2760('0x1c')]['limit']||null:null})[_0x2760('0x11')](function(_0x4fe68a){logger[_0x2760('0x1a')](_0x2760('0x1f'),_0x407c69);logger[_0x2760('0x13')](_0x2760('0x1f'),_0x407c69,JSON[_0x2760('0x15')](_0x4fe68a));_0x37bc5b(_0x4fe68a);})[_0x2760('0x24')](function(_0xcd99d){logger[_0x2760('0x16')](_0x2760('0x1f'),_0xcd99d[_0x2760('0x19')],_0x407c69);_0x4569dd(_0x36e378['error'](0x1f4,_0xcd99d[_0x2760('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index a9cccbe..c979098 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 2f4aeab..f755cb5 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 _0x0e7a=['../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','index','get','/describe','describe','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1a0769,_0xbd0de6){var _0x4bae96=function(_0x1766b5){while(--_0x1766b5){_0x1a0769['push'](_0x1a0769['shift']());}};_0x4bae96(++_0xbd0de6);}(_0x0e7a,0xff));var _0xa0e7=function(_0x5385f5,_0x554c1b){_0x5385f5=_0x5385f5-0x0;var _0x1eac01=_0x0e7a[_0x5385f5];return _0x1eac01;};'use strict';var multer=require(_0xa0e7('0x0'));var util=require(_0xa0e7('0x1'));var path=require(_0xa0e7('0x2'));var timeout=require(_0xa0e7('0x3'));var express=require('express');var router=express[_0xa0e7('0x4')]();var auth=require(_0xa0e7('0x5'));var interaction=require(_0xa0e7('0x6'));var config=require(_0xa0e7('0x7'));var controller=require(_0xa0e7('0x8'));router['get']('/',auth[_0xa0e7('0x9')](),controller[_0xa0e7('0xa')]);router[_0xa0e7('0xb')](_0xa0e7('0xc'),auth[_0xa0e7('0x9')](),controller[_0xa0e7('0xd')]);router[_0xa0e7('0xb')]('/:id',auth[_0xa0e7('0x9')](),controller['show']);router[_0xa0e7('0xb')](_0xa0e7('0xe'),auth['isAuthenticated'](),controller[_0xa0e7('0xf')]);router[_0xa0e7('0x10')]('/',auth[_0xa0e7('0x9')](),interaction[_0xa0e7('0x11')](_0xa0e7('0x12'),_0xa0e7('0x13')),controller[_0xa0e7('0x14')]);router[_0xa0e7('0x15')](_0xa0e7('0x16'),auth[_0xa0e7('0x9')](),controller['update']);router[_0xa0e7('0x15')](_0xa0e7('0x17'),auth[_0xa0e7('0x9')](),controller[_0xa0e7('0x18')]);router['put']('/:id/reject',auth[_0xa0e7('0x9')](),controller[_0xa0e7('0x19')]);router[_0xa0e7('0x1a')](_0xa0e7('0x16'),auth[_0xa0e7('0x9')](),controller[_0xa0e7('0x1b')]);module[_0xa0e7('0x1c')]=router; \ No newline at end of file +var _0xaeaa=['path','connect-timeout','Router','../../components/auth/service','get','isAuthenticated','describe','/:id','show','/:id/download','download','post','tracked','fax','create','put','update','/:id/accept','accept','delete','destroy','multer'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xaeaa,0x11d));var _0xaaea=function(_0x264bb1,_0x492de4){_0x264bb1=_0x264bb1-0x0;var _0x53b584=_0xaeaa[_0x264bb1];return _0x53b584;};'use strict';var multer=require(_0xaaea('0x0'));var util=require('util');var path=require(_0xaaea('0x1'));var timeout=require(_0xaaea('0x2'));var express=require('express');var router=express[_0xaaea('0x3')]();var auth=require(_0xaaea('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xaaea('0x5')]('/',auth[_0xaaea('0x6')](),controller['index']);router[_0xaaea('0x5')]('/describe',auth[_0xaaea('0x6')](),controller[_0xaaea('0x7')]);router['get'](_0xaaea('0x8'),auth['isAuthenticated'](),controller[_0xaaea('0x9')]);router[_0xaaea('0x5')](_0xaaea('0xa'),auth[_0xaaea('0x6')](),controller[_0xaaea('0xb')]);router[_0xaaea('0xc')]('/',auth[_0xaaea('0x6')](),interaction[_0xaaea('0xd')](_0xaaea('0xe'),'faxmessage:create'),controller[_0xaaea('0xf')]);router[_0xaaea('0x10')](_0xaaea('0x8'),auth['isAuthenticated'](),controller[_0xaaea('0x11')]);router[_0xaaea('0x10')](_0xaaea('0x12'),auth['isAuthenticated'](),controller[_0xaaea('0x13')]);router[_0xaaea('0x10')]('/:id/reject',auth[_0xaaea('0x6')](),controller['reject']);router[_0xaaea('0x14')](_0xaaea('0x8'),auth[_0xaaea('0x6')](),controller[_0xaaea('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 9b21834..ebfe272 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 _0xb545=['INTEGER','ENUM','rrmemory','roundrobin','exports','name','STRING'];(function(_0x336ca2,_0x1a813a){var _0xda59a6=function(_0x47caa6){while(--_0x47caa6){_0x336ca2['push'](_0x336ca2['shift']());}};_0xda59a6(++_0x1a813a);}(_0xb545,0xcf));var _0x5b54=function(_0x178247,_0x41c6d3){_0x178247=_0x178247-0x0;var _0x4eb948=_0xb545[_0x178247];return _0x4eb948;};'use strict';var Sequelize=require('sequelize');module[_0x5b54('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5b54('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5b54('0x2')]},'timeout':{'type':Sequelize[_0x5b54('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5b54('0x4')](_0x5b54('0x5'),'beepall',_0x5b54('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x5b54('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc389=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x246bf5,_0x3c8f49){var _0x5e0313=function(_0x897b96){while(--_0x897b96){_0x246bf5['push'](_0x246bf5['shift']());}};_0x5e0313(++_0x3c8f49);}(_0xc389,0x180));var _0x9c38=function(_0x2b2bb0,_0x31c452){_0x2b2bb0=_0x2b2bb0-0x0;var _0x5823ad=_0xc389[_0x2b2bb0];return _0x5823ad;};'use strict';var Sequelize=require(_0x9c38('0x0'));module[_0x9c38('0x1')]={'name':{'type':Sequelize[_0x9c38('0x2')],'unique':_0x9c38('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9c38('0x2')]},'timeout':{'type':Sequelize[_0x9c38('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9c38('0x5')](_0x9c38('0x6'),_0x9c38('0x7'),_0x9c38('0x8')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x9c38('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 456c834..9b65c5c 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 _0x4ad3=['isEmpty','addAgents','omit','userFaxQueue:save','removeAgents','userFaxQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','offset','limit','set','Content-Range','json','save','update','then','FaxQueues','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','FaxQueue','count','include','findAll','rows','catch','keys','options','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','UserId','agent','updatedAt','createdAt','faxPause','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','sequelize','toString','SELECT','every','TeamId','all','union','compact','value'];(function(_0x218480,_0x2db0af){var _0x479ba2=function(_0x2a750d){while(--_0x2a750d){_0x218480['push'](_0x218480['shift']());}};_0x479ba2(++_0x2db0af);}(_0x4ad3,0x1b1));var _0x34ad=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0x4ad3[_0x234ae1];return _0x227ba0;};'use strict';var pdf=require(_0x34ad('0x0'));var emlformat=require(_0x34ad('0x1'));var rimraf=require(_0x34ad('0x2'));var zipdir=require(_0x34ad('0x3'));var jsonpatch=require(_0x34ad('0x4'));var rp=require(_0x34ad('0x5'));var moment=require('moment');var BPromise=require(_0x34ad('0x6'));var Mustache=require(_0x34ad('0x7'));var util=require(_0x34ad('0x8'));var path=require(_0x34ad('0x9'));var sox=require(_0x34ad('0xa'));var csv=require(_0x34ad('0xb'));var ejs=require(_0x34ad('0xc'));var fs=require('fs');var _=require(_0x34ad('0xd'));var squel=require(_0x34ad('0xe'));var crypto=require(_0x34ad('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x34ad('0xb'));var querystring=require(_0x34ad('0x10'));var Papa=require(_0x34ad('0x11'));var Redis=require(_0x34ad('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x34ad('0x13'));var as=require(_0x34ad('0x14'));var hardwareService=require(_0x34ad('0x15'));var logger=require(_0x34ad('0x16'))(_0x34ad('0x17'));var utils=require(_0x34ad('0x18'));var config=require(_0x34ad('0x19'));var db=require(_0x34ad('0x1a'))['db'];config[_0x34ad('0x1b')]=_[_0x34ad('0x1c')](config[_0x34ad('0x1b')],{'host':_0x34ad('0x1d'),'port':0x18eb});var socket=require(_0x34ad('0x1e'))(new Redis(config[_0x34ad('0x1b')]));require(_0x34ad('0x1f'))[_0x34ad('0x20')](socket);function respondWithStatusCode(_0x558097,_0x4764e9){_0x4764e9=_0x4764e9||0xcc;return function(_0x5d166b){if(_0x5d166b){return _0x558097[_0x34ad('0x21')](_0x4764e9);}return _0x558097['status'](_0x4764e9)[_0x34ad('0x22')]();};}function respondWithResult(_0x262123,_0x38a15e){_0x38a15e=_0x38a15e||0xc8;return function(_0x36c8d3){if(_0x36c8d3){return _0x262123[_0x34ad('0x23')](_0x38a15e)['json'](_0x36c8d3);}};}function respondWithFilteredResult(_0x1533b5,_0x4daa5c){return function(_0x1fcdd0){if(_0x1fcdd0){var _0x294326=_0x1fcdd0['count'],_0x32316c=_0x4daa5c[_0x34ad('0x24')],_0x7036e0=_0x4daa5c[_0x34ad('0x24')]+_0x4daa5c[_0x34ad('0x25')],_0x2c5b60;if(_0x7036e0>=_0x294326){_0x7036e0=_0x294326;_0x2c5b60=0xc8;}else{_0x2c5b60=0xce;}_0x1533b5[_0x34ad('0x23')](_0x2c5b60);return _0x1533b5[_0x34ad('0x26')](_0x34ad('0x27'),_0x32316c+'-'+_0x7036e0+'/'+_0x294326)[_0x34ad('0x28')](_0x1fcdd0);}return null;};}function patchUpdates(_0x45557e){return function(_0x1ef997){try{jsonpatch['apply'](_0x1ef997,_0x45557e,!![]);}catch(_0x45d055){return BPromise['reject'](_0x45d055);}return _0x1ef997[_0x34ad('0x29')]();};}function saveUpdates(_0x493f73,_0x154ee8){return function(_0x439333){if(_0x439333){return _0x439333[_0x34ad('0x2a')](_0x493f73)[_0x34ad('0x2b')](function(_0x737c2d){return _0x737c2d;});}return null;};}function removeEntity(_0x4a06a7,_0x5a8379){return function(_0x3a8418){if(_0x3a8418){return _0x3a8418['destroy']()[_0x34ad('0x2b')](function(){var _0x4bdad0=_0x3a8418['get']({'plain':!![]});var _0x34d2ae=_0x34ad('0x2c');return db[_0x34ad('0x2d')][_0x34ad('0x2e')]({'where':{'type':_0x34d2ae,'resourceId':_0x4bdad0['id']}})[_0x34ad('0x2b')](function(){return _0x3a8418;});})[_0x34ad('0x2b')](function(){_0x4a06a7[_0x34ad('0x23')](0xcc)[_0x34ad('0x22')]();});}};}function handleEntityNotFound(_0xd230ca,_0x9ebbad){return function(_0x580ee5){if(!_0x580ee5){_0xd230ca[_0x34ad('0x21')](0x194);}return _0x580ee5;};}function handleError(_0x25316a,_0x23bb04){_0x23bb04=_0x23bb04||0x1f4;return function(_0x31b880){logger[_0x34ad('0x2f')](_0x31b880[_0x34ad('0x30')]);if(_0x31b880[_0x34ad('0x31')]){delete _0x31b880[_0x34ad('0x31')];}_0x25316a[_0x34ad('0x23')](_0x23bb04)[_0x34ad('0x32')](_0x31b880);};}exports[_0x34ad('0x33')]=function(_0x174001,_0x5258fc){var _0xf0f8b7={},_0x603161={},_0x14be3a={'count':0x0,'rows':[]};var _0x568e91=_[_0x34ad('0x34')](db['FaxQueue'][_0x34ad('0x35')],function(_0xedd677){return{'name':_0xedd677[_0x34ad('0x36')],'type':_0xedd677[_0x34ad('0x37')]['key']};});_0x603161[_0x34ad('0x38')]=_[_0x34ad('0x34')](_0x568e91,_0x34ad('0x31'));_0x603161[_0x34ad('0x39')]=_['keys'](_0x174001['query']);_0x603161['filters']=_[_0x34ad('0x3a')](_0x603161[_0x34ad('0x38')],_0x603161[_0x34ad('0x39')]);_0xf0f8b7[_0x34ad('0x3b')]=_[_0x34ad('0x3a')](_0x603161['model'],qs[_0x34ad('0x3c')](_0x174001[_0x34ad('0x39')][_0x34ad('0x3c')]));_0xf0f8b7[_0x34ad('0x3b')]=_0xf0f8b7[_0x34ad('0x3b')][_0x34ad('0x3d')]?_0xf0f8b7[_0x34ad('0x3b')]:_0x603161[_0x34ad('0x38')];if(!_0x174001[_0x34ad('0x39')][_0x34ad('0x3e')](_0x34ad('0x3f'))){_0xf0f8b7[_0x34ad('0x25')]=qs[_0x34ad('0x25')](_0x174001[_0x34ad('0x39')][_0x34ad('0x25')]);_0xf0f8b7[_0x34ad('0x24')]=qs[_0x34ad('0x24')](_0x174001[_0x34ad('0x39')][_0x34ad('0x24')]);}_0xf0f8b7[_0x34ad('0x40')]=qs['sort'](_0x174001['query'][_0x34ad('0x41')]);_0xf0f8b7[_0x34ad('0x42')]=qs[_0x34ad('0x43')](_[_0x34ad('0x44')](_0x174001[_0x34ad('0x39')],_0x603161[_0x34ad('0x43')]));if(_0x174001[_0x34ad('0x39')][_0x34ad('0x45')]){_0xf0f8b7[_0x34ad('0x42')]=_[_0x34ad('0x46')](_0xf0f8b7['where'],{'$or':_[_0x34ad('0x34')](_0x568e91,function(_0x843cc5){if(_0x843cc5[_0x34ad('0x37')]!==_0x34ad('0x47')){var _0x212e45={};_0x212e45[_0x843cc5[_0x34ad('0x31')]]={'$like':'%'+_0x174001[_0x34ad('0x39')][_0x34ad('0x45')]+'%'};return _0x212e45;}})});}_0xf0f8b7=_[_0x34ad('0x46')]({},_0xf0f8b7,_0x174001['options']);var _0x2dccc6={'where':_0xf0f8b7['where']};return db[_0x34ad('0x48')][_0x34ad('0x49')](_0x2dccc6)[_0x34ad('0x2b')](function(_0x4710c9){_0x14be3a[_0x34ad('0x49')]=_0x4710c9;if(_0x174001[_0x34ad('0x39')]['includeAll']){_0xf0f8b7[_0x34ad('0x4a')]=[{'all':!![]}];}return db['FaxQueue'][_0x34ad('0x4b')](_0xf0f8b7);})['then'](function(_0x5c55ad){_0x14be3a[_0x34ad('0x4c')]=_0x5c55ad;return _0x14be3a;})[_0x34ad('0x2b')](respondWithFilteredResult(_0x5258fc,_0xf0f8b7))[_0x34ad('0x4d')](handleError(_0x5258fc,null));};exports['show']=function(_0x201803,_0x22b2d2){var _0x1cec0b={'raw':!![],'where':{'id':_0x201803['params']['id']}},_0x4d7015={};_0x4d7015[_0x34ad('0x38')]=_[_0x34ad('0x4e')](db['FaxQueue'][_0x34ad('0x35')]);_0x4d7015[_0x34ad('0x39')]=_[_0x34ad('0x4e')](_0x201803['query']);_0x4d7015[_0x34ad('0x43')]=_[_0x34ad('0x3a')](_0x4d7015[_0x34ad('0x38')],_0x4d7015[_0x34ad('0x39')]);_0x1cec0b[_0x34ad('0x3b')]=_[_0x34ad('0x3a')](_0x4d7015[_0x34ad('0x38')],qs['fields'](_0x201803[_0x34ad('0x39')][_0x34ad('0x3c')]));_0x1cec0b['attributes']=_0x1cec0b[_0x34ad('0x3b')][_0x34ad('0x3d')]?_0x1cec0b[_0x34ad('0x3b')]:_0x4d7015[_0x34ad('0x38')];if(_0x201803[_0x34ad('0x39')]['includeAll']){_0x1cec0b['include']=[{'all':!![]}];}_0x1cec0b=_[_0x34ad('0x46')]({},_0x1cec0b,_0x201803[_0x34ad('0x4f')]);return db['FaxQueue']['find'](_0x1cec0b)[_0x34ad('0x2b')](handleEntityNotFound(_0x22b2d2,null))['then'](respondWithResult(_0x22b2d2,null))[_0x34ad('0x4d')](handleError(_0x22b2d2,null));};exports[_0x34ad('0x50')]=function(_0x287401,_0x5a3ef5){return db[_0x34ad('0x48')][_0x34ad('0x50')](_0x287401['body'],{})['then'](function(_0x48be05){var _0x4ee0b4=_0x287401[_0x34ad('0x51')][_0x34ad('0x52')]({'plain':!![]});if(!_0x4ee0b4)throw new Error(_0x34ad('0x53'));if(_0x4ee0b4[_0x34ad('0x54')]==='user'){var _0x3ad42e=_0x48be05[_0x34ad('0x52')]({'plain':!![]});var _0x54b41d='FaxQueues';return db[_0x34ad('0x55')][_0x34ad('0x56')]({'where':{'name':_0x54b41d,'userProfileId':_0x4ee0b4[_0x34ad('0x57')]},'raw':!![]})[_0x34ad('0x2b')](function(_0x1f6bed){if(_0x1f6bed&&_0x1f6bed[_0x34ad('0x58')]===0x0){return db['UserProfileResource'][_0x34ad('0x50')]({'name':_0x3ad42e[_0x34ad('0x31')],'resourceId':_0x3ad42e['id'],'type':_0x1f6bed['name'],'sectionId':_0x1f6bed['id']},{})[_0x34ad('0x2b')](function(){return _0x48be05;});}else{return _0x48be05;}})['catch'](function(_0x50fa8c){logger[_0x34ad('0x2f')](_0x34ad('0x59'),_0x50fa8c);throw _0x50fa8c;});}return _0x48be05;})[_0x34ad('0x2b')](respondWithResult(_0x5a3ef5,0xc9))['catch'](handleError(_0x5a3ef5,null));};exports[_0x34ad('0x2a')]=function(_0x4ef0b4,_0x3556a2){if(_0x4ef0b4[_0x34ad('0x5a')]['id']){delete _0x4ef0b4[_0x34ad('0x5a')]['id'];}return db['FaxQueue'][_0x34ad('0x56')]({'where':{'id':_0x4ef0b4[_0x34ad('0x5b')]['id']}})[_0x34ad('0x2b')](handleEntityNotFound(_0x3556a2,null))[_0x34ad('0x2b')](saveUpdates(_0x4ef0b4[_0x34ad('0x5a')],null))[_0x34ad('0x2b')](respondWithResult(_0x3556a2,null))[_0x34ad('0x4d')](handleError(_0x3556a2,null));};exports[_0x34ad('0x2e')]=function(_0x273b78,_0x56e01d){return db[_0x34ad('0x48')][_0x34ad('0x56')]({'where':{'id':_0x273b78[_0x34ad('0x5b')]['id']}})[_0x34ad('0x2b')](handleEntityNotFound(_0x56e01d,null))[_0x34ad('0x2b')](removeEntity(_0x56e01d,null))[_0x34ad('0x4d')](handleError(_0x56e01d,null));};exports[_0x34ad('0x5c')]=function(_0x15d671,_0x2dd5c5){return db[_0x34ad('0x48')][_0x34ad('0x5c')]()[_0x34ad('0x2b')](respondWithResult(_0x2dd5c5,null))['catch'](handleError(_0x2dd5c5,null));};exports[_0x34ad('0x5d')]=function(_0x40946f,_0x3727f5,_0xf9815a){var _0x114904={'raw':!![],'where':{}},_0x4e1ae1={},_0x13c8a1;return db['FaxQueue'][_0x34ad('0x5e')]({'where':{'id':_0x40946f[_0x34ad('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3727f5,null))[_0x34ad('0x2b')](function(_0xb78e72){if(_0xb78e72){_0x13c8a1=_0xb78e72[_0x34ad('0x52')]({'plain':!![]});_0x4e1ae1[_0x34ad('0x38')]=_[_0x34ad('0x4e')](db[_0x34ad('0x5f')]['rawAttributes']);_0x4e1ae1[_0x34ad('0x39')]=_[_0x34ad('0x4e')](_0x40946f[_0x34ad('0x39')]);_0x4e1ae1['filters']=_[_0x34ad('0x3a')](_0x4e1ae1[_0x34ad('0x38')],_0x4e1ae1[_0x34ad('0x39')]);_0x114904[_0x34ad('0x3b')]=_[_0x34ad('0x3a')](_0x4e1ae1['model'],qs[_0x34ad('0x3c')](_0x40946f[_0x34ad('0x39')]['fields']));_0x114904['attributes']=_0x114904[_0x34ad('0x3b')]['length']?_0x114904[_0x34ad('0x3b')]:_0x4e1ae1[_0x34ad('0x38')];if(!_0x40946f[_0x34ad('0x39')][_0x34ad('0x3e')](_0x34ad('0x3f'))){_0x114904[_0x34ad('0x25')]=qs[_0x34ad('0x25')](_0x40946f[_0x34ad('0x39')][_0x34ad('0x25')]);_0x114904[_0x34ad('0x24')]=qs['offset'](_0x40946f[_0x34ad('0x39')][_0x34ad('0x24')]);}_0x114904[_0x34ad('0x40')]=qs['sort'](_0x40946f[_0x34ad('0x39')][_0x34ad('0x41')]);_0x114904['where']=qs[_0x34ad('0x43')](_['pick'](_0x40946f[_0x34ad('0x39')],_0x4e1ae1[_0x34ad('0x43')]));_0x114904[_0x34ad('0x42')][_0x34ad('0x60')]=_0xb78e72['id'];if(_0x40946f[_0x34ad('0x39')][_0x34ad('0x45')]){_0x114904[_0x34ad('0x42')]=_['merge'](_0x114904[_0x34ad('0x42')],{'$or':_[_0x34ad('0x34')](_0x114904[_0x34ad('0x3b')],function(_0x24c864){var _0x30fd34={};_0x30fd34[_0x24c864]={'$like':'%'+_0x40946f['query'][_0x34ad('0x45')]+'%'};return _0x30fd34;})});}_0x114904=_['merge']({},_0x114904,_0x40946f['options']);return db[_0x34ad('0x5f')][_0x34ad('0x4b')](_0x114904);}})[_0x34ad('0x2b')](function(_0x56c1b9){if(_0x56c1b9){return db['User']['findAndCountAll']({'where':{'id':_[_0x34ad('0x34')](_0x56c1b9,_0x34ad('0x61')),'role':_0x34ad('0x62')},'attributes':['id','name','faxPause',_0x34ad('0x63'),_0x34ad('0x64')]});}})[_0x34ad('0x2b')](function(_0x4b574e){if(_0x4b574e){return{'count':_0x4b574e['count'],'rows':_[_0x34ad('0x34')](_0x4b574e[_0x34ad('0x4c')],function(_0x5d8434){return{'membername':_0x5d8434[_0x34ad('0x31')],'UserId':_0x5d8434['id'],'queue_name':_0x13c8a1['name'],'FaxQueueId':_0x13c8a1['id'],'interface':util['format']('%s/%s','SIP',_0x5d8434[_0x34ad('0x31')]),'penalty':0x0,'paused':_0x5d8434[_0x34ad('0x65')],'createdAt':_0x5d8434[_0x34ad('0x64')],'updatedAt':_0x5d8434['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x34ad('0x2b')](respondWithFilteredResult(_0x3727f5,_0x114904))[_0x34ad('0x4d')](handleError(_0x3727f5,null));};exports[_0x34ad('0x66')]=function(_0x503c6b,_0x19d3b4,_0x5a482a){var _0x25236c={};var _0x332754={};var _0xccc0ff;var _0x4f6135;return db[_0x34ad('0x48')][_0x34ad('0x5e')]({'where':{'id':_0x503c6b['params']['id']}})['then'](handleEntityNotFound(_0x19d3b4,null))[_0x34ad('0x2b')](function(_0x28c70e){if(_0x28c70e){_0xccc0ff=_0x28c70e;_0x332754['model']=_[_0x34ad('0x4e')](db[_0x34ad('0x67')][_0x34ad('0x35')]);_0x332754[_0x34ad('0x39')]=_[_0x34ad('0x4e')](_0x503c6b[_0x34ad('0x39')]);_0x332754[_0x34ad('0x43')]=_['intersection'](_0x332754['model'],_0x332754[_0x34ad('0x39')]);_0x25236c[_0x34ad('0x3b')]=_[_0x34ad('0x3a')](_0x332754[_0x34ad('0x38')],qs[_0x34ad('0x3c')](_0x503c6b['query'][_0x34ad('0x3c')]));_0x25236c['attributes']=_0x25236c[_0x34ad('0x3b')][_0x34ad('0x3d')]?_0x25236c[_0x34ad('0x3b')]:_0x332754[_0x34ad('0x38')];_0x25236c[_0x34ad('0x40')]=qs[_0x34ad('0x41')](_0x503c6b[_0x34ad('0x39')][_0x34ad('0x41')]);_0x25236c[_0x34ad('0x42')]=qs[_0x34ad('0x43')](_[_0x34ad('0x44')](_0x503c6b[_0x34ad('0x39')],_0x332754[_0x34ad('0x43')]));if(_0x503c6b[_0x34ad('0x39')][_0x34ad('0x45')]){_0x25236c['where']=_[_0x34ad('0x46')](_0x25236c['where'],{'$or':_['map'](_0x25236c[_0x34ad('0x3b')],function(_0xfe0159){var _0x305ee9={};_0x305ee9[_0xfe0159]={'$like':'%'+_0x503c6b[_0x34ad('0x39')][_0x34ad('0x45')]+'%'};return _0x305ee9;})});}_0x25236c=_[_0x34ad('0x46')]({},_0x25236c,_0x503c6b[_0x34ad('0x4f')]);return _0xccc0ff[_0x34ad('0x66')](_0x25236c);}})[_0x34ad('0x2b')](function(_0xb0c8ba){if(_0xb0c8ba){_0x4f6135=_0xb0c8ba[_0x34ad('0x3d')];if(!_0x503c6b[_0x34ad('0x39')]['hasOwnProperty'](_0x34ad('0x3f'))){_0x25236c['limit']=qs['limit'](_0x503c6b[_0x34ad('0x39')][_0x34ad('0x25')]);_0x25236c[_0x34ad('0x24')]=qs[_0x34ad('0x24')](_0x503c6b[_0x34ad('0x39')][_0x34ad('0x24')]);}return _0xccc0ff[_0x34ad('0x66')](_0x25236c);}})['then'](function(_0x2d41ac){if(_0x2d41ac){return _0x2d41ac?{'count':_0x4f6135,'rows':_0x2d41ac}:null;}})['then'](respondWithResult(_0x19d3b4,null))['catch'](handleError(_0x19d3b4,null));};exports[_0x34ad('0x68')]=function(_0x554c90,_0x5cdd6c,_0x4278ef){var _0x266d6b=_0x554c90[_0x34ad('0x5a')][_0x34ad('0x69')];return db[_0x34ad('0x67')]['findAll']({'where':{'id':_0x266d6b},'attributes':['id'],'include':[{'model':db[_0x34ad('0x6a')],'as':_0x34ad('0x6b'),'attributes':['id',_0x34ad('0x31'),_0x34ad('0x6c'),_0x34ad('0x6d'),_0x34ad('0x6e')],'raw':!![]}]})['then'](function(_0x44613f){if(_0x44613f){var _0x571925=_[_0x34ad('0x6f')](_0x44613f,function(_0x35b4f6){var _0x49b39e=_0x35b4f6[_0x34ad('0x52')]({'plain':!![]});return _0x49b39e[_0x34ad('0x6b')];});return db[_0x34ad('0x48')][_0x34ad('0x56')]({'where':{'id':_0x554c90[_0x34ad('0x5b')]['id']}})['then'](function(_0x595f4b){return db['sequelize'][_0x34ad('0x70')](function(_0x5f3fd2){return _0x595f4b['addTeams'](_0x266d6b,{'transaction':_0x5f3fd2})[_0x34ad('0x2b')](function(){return BPromise[_0x34ad('0x71')](_0x571925,function(_0x22e7c2){return db[_0x34ad('0x5f')][_0x34ad('0x72')]({'where':{'UserId':_0x22e7c2['id'],'FaxQueueId':_0x554c90[_0x34ad('0x5b')]['id']},'transaction':_0x5f3fd2});});})[_0x34ad('0x2b')](function(){_0x571925[_0x34ad('0x73')](function(_0x57741b){socket[_0x34ad('0x74')]('userFaxQueue:save',{'UserId':_0x57741b['id'],'FaxQueueId':_0x595f4b['id']});});});});});}})['then'](respondWithStatusCode(_0x5cdd6c,null))[_0x34ad('0x4d')](handleError(_0x5cdd6c,null));};exports[_0x34ad('0x75')]=function(_0x1a5796,_0x4ecb02,_0x51010c){return db['Team'][_0x34ad('0x4b')]({'where':{'id':_0x1a5796['query'][_0x34ad('0x69')]},'attributes':['id'],'include':[{'model':db[_0x34ad('0x6a')],'as':_0x34ad('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x34ad('0x2b')](handleEntityNotFound(_0x4ecb02,null))[_0x34ad('0x2b')](function(_0x8745c0){var _0x420629=_[_0x34ad('0x34')](_0x8745c0,'id');var _0x25bf5b=[];var _0x18fed1=[];var _0x4e2f74=squel[_0x34ad('0x76')]();_0x4e2f74[_0x34ad('0x77')](_0x34ad('0x78'))[_0x34ad('0x79')]('team_has_fax_queues','tq')[_0x34ad('0x7a')](_0x34ad('0x7b'),'ut',_0x34ad('0x7c'))[_0x34ad('0x42')]('FaxQueueId\x20=\x20?',_0x1a5796['params']['id']);for(var _0x175dbc=0x0;_0x175dbc<_0x8745c0[_0x34ad('0x3d')];_0x175dbc+=0x1){let _0x3991cc=_0x8745c0[_0x175dbc];for(var _0xbc21c6=0x0;_0xbc21c6<_0x3991cc[_0x34ad('0x6b')][_0x34ad('0x3d')];_0xbc21c6+=0x1){let _0x46f71c=_0x3991cc[_0x34ad('0x6b')][_0xbc21c6];var _0x274a16=_0x4e2f74['clone']();_0x274a16[_0x34ad('0x42')](_0x34ad('0x7d'),_0x46f71c['id']);_0x18fed1['push'](db[_0x34ad('0x7e')][_0x34ad('0x39')](_0x274a16[_0x34ad('0x7f')](),{'type':db[_0x34ad('0x7e')]['QueryTypes'][_0x34ad('0x80')]})[_0x34ad('0x2b')](function(_0x2367f3){if(_0x2367f3[_0x34ad('0x3d')]===0x1){return _0x46f71c['id'];}else{var _0xb7f03d=_[_0x34ad('0x81')](_['map'](_0x2367f3,_0x34ad('0x82')),function(_0x4a4335){return _['includes'](_0x420629,_0x4a4335);});if(_0xb7f03d){return _0x46f71c['id'];}}}));}}return BPromise[_0x34ad('0x83')](_0x18fed1)[_0x34ad('0x2b')](function(_0x24fa5c){_0x25bf5b=_(_0x25bf5b)[_0x34ad('0x84')](_0x24fa5c)[_0x34ad('0x85')]()[_0x34ad('0x86')]();return db[_0x34ad('0x48')][_0x34ad('0x56')]({'where':{'id':_0x1a5796['params']['id']}})[_0x34ad('0x2b')](function(_0x7d5de6){return db['sequelize'][_0x34ad('0x70')](function(_0x1c1780){return _0x7d5de6[_0x34ad('0x75')](_0x1a5796[_0x34ad('0x39')][_0x34ad('0x69')],{'transaction':_0x1c1780})[_0x34ad('0x2b')](function(){if(!_[_0x34ad('0x87')](_0x25bf5b)){return _0x7d5de6['removeAgents'](_0x25bf5b,{'transaction':_0x1c1780});}})['then'](function(){_0x25bf5b['forEach'](function(_0x136eae){socket[_0x34ad('0x74')]('userFaxQueue:remove',{'UserId':_0x136eae,'FaxQueueId':_0x7d5de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4ecb02,null))[_0x34ad('0x4d')](handleError(_0x4ecb02,null));};exports['addAgents']=function(_0x4be1e3,_0x2659db,_0x4180f0){return db[_0x34ad('0x48')][_0x34ad('0x56')]({'where':{'id':_0x4be1e3[_0x34ad('0x5b')]['id']}})[_0x34ad('0x2b')](handleEntityNotFound(_0x2659db,null))[_0x34ad('0x2b')](function(_0x20e7b0){if(_0x20e7b0){return _0x20e7b0[_0x34ad('0x88')](_0x4be1e3['body'][_0x34ad('0x69')],_[_0x34ad('0x89')](_0x4be1e3[_0x34ad('0x5a')],[_0x34ad('0x69'),'id'])||{})['spread'](function(_0x232994){for(var _0x31af6a=0x0;_0x31af6a<_0x4be1e3[_0x34ad('0x5a')][_0x34ad('0x69')][_0x34ad('0x3d')];_0x31af6a+=0x1){socket['emit'](_0x34ad('0x8a'),{'UserId':_0x4be1e3[_0x34ad('0x5a')][_0x34ad('0x69')][_0x31af6a],'FaxQueueId':_0x4be1e3[_0x34ad('0x5b')]['id']});}return _0x232994;});}})[_0x34ad('0x2b')](respondWithResult(_0x2659db,null))[_0x34ad('0x4d')](handleError(_0x2659db,null));};exports[_0x34ad('0x8b')]=function(_0x2264e5,_0x28d3e4,_0x1137d1){return db[_0x34ad('0x48')][_0x34ad('0x56')]({'where':{'id':_0x2264e5[_0x34ad('0x5b')]['id']}})[_0x34ad('0x2b')](handleEntityNotFound(_0x28d3e4,null))[_0x34ad('0x2b')](function(_0x2fa9c1){if(_0x2fa9c1){return _0x2fa9c1[_0x34ad('0x8b')](_0x2264e5[_0x34ad('0x39')][_0x34ad('0x69')])['then'](function(){if(_['isArray'](_0x2264e5[_0x34ad('0x39')][_0x34ad('0x69')])){for(var _0x4fb7a6=0x0;_0x4fb7a6<_0x2264e5[_0x34ad('0x39')]['ids']['length'];_0x4fb7a6+=0x1){socket[_0x34ad('0x74')](_0x34ad('0x8c'),{'UserId':Number(_0x2264e5[_0x34ad('0x39')][_0x34ad('0x69')][_0x4fb7a6]),'FaxQueueId':Number(_0x2264e5['params']['id'])});}}else{socket[_0x34ad('0x74')](_0x34ad('0x8c'),{'UserId':Number(_0x2264e5[_0x34ad('0x39')][_0x34ad('0x69')]),'FaxQueueId':Number(_0x2264e5[_0x34ad('0x5b')]['id'])});}});}})[_0x34ad('0x2b')](respondWithStatusCode(_0x28d3e4,null))['catch'](handleError(_0x28d3e4,null));};exports['getAgents']=function(_0x62820f,_0x3ab4af,_0x48fc77){var _0x295c47={};var _0x556143={};var _0x1bd382;var _0x40ec80;return db[_0x34ad('0x48')][_0x34ad('0x5e')]({'where':{'id':_0x62820f[_0x34ad('0x5b')]['id']}})[_0x34ad('0x2b')](handleEntityNotFound(_0x3ab4af,null))[_0x34ad('0x2b')](function(_0x44dc93){if(_0x44dc93){_0x1bd382=_0x44dc93;_0x556143['model']=_[_0x34ad('0x4e')](db[_0x34ad('0x6a')][_0x34ad('0x35')]);_0x556143[_0x34ad('0x39')]=_['keys'](_0x62820f[_0x34ad('0x39')]);_0x556143['filters']=_['intersection'](_0x556143[_0x34ad('0x38')],_0x556143[_0x34ad('0x39')]);_0x295c47[_0x34ad('0x3b')]=_[_0x34ad('0x3a')](_0x556143['model'],qs[_0x34ad('0x3c')](_0x62820f[_0x34ad('0x39')][_0x34ad('0x3c')]));_0x295c47['attributes']=_0x295c47[_0x34ad('0x3b')][_0x34ad('0x3d')]?_0x295c47[_0x34ad('0x3b')]:_0x556143[_0x34ad('0x38')];_0x295c47[_0x34ad('0x40')]=qs[_0x34ad('0x41')](_0x62820f[_0x34ad('0x39')][_0x34ad('0x41')]);_0x295c47['where']=qs[_0x34ad('0x43')](_['pick'](_0x62820f[_0x34ad('0x39')],_0x556143['filters']));if(_0x62820f[_0x34ad('0x39')][_0x34ad('0x45')]){_0x295c47[_0x34ad('0x42')]=_['merge'](_0x295c47[_0x34ad('0x42')],{'$or':_['map'](_0x295c47[_0x34ad('0x3b')],function(_0x10ab1f){var _0x595a85={};_0x595a85[_0x10ab1f]={'$like':'%'+_0x62820f[_0x34ad('0x39')][_0x34ad('0x45')]+'%'};return _0x595a85;})});}_0x295c47=_[_0x34ad('0x46')]({},_0x295c47,_0x62820f['options']);return _0x1bd382[_0x34ad('0x8d')](_0x295c47);}})[_0x34ad('0x2b')](function(_0x1bfa17){if(_0x1bfa17){_0x40ec80=_0x1bfa17['length'];if(!_0x62820f[_0x34ad('0x39')][_0x34ad('0x3e')](_0x34ad('0x3f'))){_0x295c47[_0x34ad('0x25')]=qs[_0x34ad('0x25')](_0x62820f['query'][_0x34ad('0x25')]);_0x295c47[_0x34ad('0x24')]=qs[_0x34ad('0x24')](_0x62820f[_0x34ad('0x39')][_0x34ad('0x24')]);}return _0x1bd382[_0x34ad('0x8d')](_0x295c47);}})['then'](function(_0x470564){if(_0x470564){return _0x470564?{'count':_0x40ec80,'rows':_0x470564}:null;}})[_0x34ad('0x2b')](respondWithResult(_0x3ab4af,null))[_0x34ad('0x4d')](handleError(_0x3ab4af,null));}; \ No newline at end of file +var _0xcaef=['updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','interface','flatMap','sequelize','each','findOrCreate','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','QueryTypes','SELECT','every','includes','all','union','compact','value','transaction','isEmpty','removeAgents','forEach','emit','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','FaxQueue','rawAttributes','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxQueues','UserProfileSection','userProfileId','update','describe','getMembers','findOne','UserFaxQueue','order','User','findAndCountAll','UserId','faxPause'];(function(_0x3e8f4d,_0x2973ed){var _0x590a2e=function(_0x5ebea8){while(--_0x5ebea8){_0x3e8f4d['push'](_0x3e8f4d['shift']());}};_0x590a2e(++_0x2973ed);}(_0xcaef,0x1c9));var _0xfcae=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0xcaef[_0x1b4b23];return _0x2a325b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfcae('0x0'));var rimraf=require(_0xfcae('0x1'));var zipdir=require(_0xfcae('0x2'));var jsonpatch=require(_0xfcae('0x3'));var rp=require('request-promise');var moment=require(_0xfcae('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfcae('0x5'));var util=require(_0xfcae('0x6'));var path=require('path');var sox=require(_0xfcae('0x7'));var csv=require(_0xfcae('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfcae('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfcae('0xa'));var deskjs=require(_0xfcae('0xb'));var toCsv=require(_0xfcae('0x8'));var querystring=require('querystring');var Papa=require(_0xfcae('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfcae('0xd'));var as=require(_0xfcae('0xe'));var hardwareService=require(_0xfcae('0xf'));var logger=require(_0xfcae('0x10'))(_0xfcae('0x11'));var utils=require(_0xfcae('0x12'));var config=require(_0xfcae('0x13'));var db=require(_0xfcae('0x14'))['db'];config[_0xfcae('0x15')]=_['defaults'](config[_0xfcae('0x15')],{'host':_0xfcae('0x16'),'port':0x18eb});var socket=require(_0xfcae('0x17'))(new Redis(config[_0xfcae('0x15')]));require(_0xfcae('0x18'))[_0xfcae('0x19')](socket);function respondWithStatusCode(_0x19cf42,_0x386379){_0x386379=_0x386379||0xcc;return function(_0x5a8717){if(_0x5a8717){return _0x19cf42[_0xfcae('0x1a')](_0x386379);}return _0x19cf42['status'](_0x386379)[_0xfcae('0x1b')]();};}function respondWithResult(_0x12a15e,_0x1ab8f3){_0x1ab8f3=_0x1ab8f3||0xc8;return function(_0x3e8a36){if(_0x3e8a36){return _0x12a15e[_0xfcae('0x1c')](_0x1ab8f3)[_0xfcae('0x1d')](_0x3e8a36);}};}function respondWithFilteredResult(_0x1d49cd,_0x199b03){return function(_0x3d8c62){if(_0x3d8c62){var _0x4d2a5e=_0x3d8c62[_0xfcae('0x1e')],_0x24f607=_0x199b03[_0xfcae('0x1f')],_0x5f4a8b=_0x199b03[_0xfcae('0x1f')]+_0x199b03[_0xfcae('0x20')],_0x3176d6;if(_0x5f4a8b>=_0x4d2a5e){_0x5f4a8b=_0x4d2a5e;_0x3176d6=0xc8;}else{_0x3176d6=0xce;}_0x1d49cd[_0xfcae('0x1c')](_0x3176d6);return _0x1d49cd[_0xfcae('0x21')]('Content-Range',_0x24f607+'-'+_0x5f4a8b+'/'+_0x4d2a5e)['json'](_0x3d8c62);}return null;};}function patchUpdates(_0x1f79cb){return function(_0x35fa50){try{jsonpatch[_0xfcae('0x22')](_0x35fa50,_0x1f79cb,!![]);}catch(_0x17daf9){return BPromise[_0xfcae('0x23')](_0x17daf9);}return _0x35fa50[_0xfcae('0x24')]();};}function saveUpdates(_0xc2d0ed,_0x7f50dd){return function(_0x26a5aa){if(_0x26a5aa){return _0x26a5aa['update'](_0xc2d0ed)[_0xfcae('0x25')](function(_0x4571a9){return _0x4571a9;});}return null;};}function removeEntity(_0x57687e,_0x49e534){return function(_0x51776e){if(_0x51776e){return _0x51776e[_0xfcae('0x26')]()['then'](function(){var _0x229e86=_0x51776e[_0xfcae('0x27')]({'plain':!![]});var _0x232695='FaxQueues';return db[_0xfcae('0x28')][_0xfcae('0x26')]({'where':{'type':_0x232695,'resourceId':_0x229e86['id']}})[_0xfcae('0x25')](function(){return _0x51776e;});})[_0xfcae('0x25')](function(){_0x57687e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x48f6bb,_0x47b7ed){return function(_0x4b874b){if(!_0x4b874b){_0x48f6bb[_0xfcae('0x1a')](0x194);}return _0x4b874b;};}function handleError(_0x5527cf,_0x5b9341){_0x5b9341=_0x5b9341||0x1f4;return function(_0x409dd6){logger[_0xfcae('0x29')](_0x409dd6[_0xfcae('0x2a')]);if(_0x409dd6['name']){delete _0x409dd6[_0xfcae('0x2b')];}_0x5527cf['status'](_0x5b9341)['send'](_0x409dd6);};}exports['index']=function(_0x29a7d7,_0x2859d2){var _0x3931b0={},_0x31e0ce={},_0x47cfde={'count':0x0,'rows':[]};var _0x502626=_['map'](db[_0xfcae('0x2c')][_0xfcae('0x2d')],function(_0x3faa9b){return{'name':_0x3faa9b['fieldName'],'type':_0x3faa9b['type'][_0xfcae('0x2e')]};});_0x31e0ce['model']=_[_0xfcae('0x2f')](_0x502626,_0xfcae('0x2b'));_0x31e0ce[_0xfcae('0x30')]=_[_0xfcae('0x31')](_0x29a7d7[_0xfcae('0x30')]);_0x31e0ce['filters']=_[_0xfcae('0x32')](_0x31e0ce[_0xfcae('0x33')],_0x31e0ce[_0xfcae('0x30')]);_0x3931b0['attributes']=_[_0xfcae('0x32')](_0x31e0ce[_0xfcae('0x33')],qs[_0xfcae('0x34')](_0x29a7d7[_0xfcae('0x30')]['fields']));_0x3931b0[_0xfcae('0x35')]=_0x3931b0[_0xfcae('0x35')][_0xfcae('0x36')]?_0x3931b0['attributes']:_0x31e0ce[_0xfcae('0x33')];if(!_0x29a7d7[_0xfcae('0x30')][_0xfcae('0x37')](_0xfcae('0x38'))){_0x3931b0['limit']=qs['limit'](_0x29a7d7['query'][_0xfcae('0x20')]);_0x3931b0[_0xfcae('0x1f')]=qs['offset'](_0x29a7d7[_0xfcae('0x30')]['offset']);}_0x3931b0['order']=qs[_0xfcae('0x39')](_0x29a7d7[_0xfcae('0x30')][_0xfcae('0x39')]);_0x3931b0[_0xfcae('0x3a')]=qs[_0xfcae('0x3b')](_[_0xfcae('0x3c')](_0x29a7d7[_0xfcae('0x30')],_0x31e0ce[_0xfcae('0x3b')]));if(_0x29a7d7['query']['filter']){_0x3931b0['where']=_['merge'](_0x3931b0[_0xfcae('0x3a')],{'$or':_[_0xfcae('0x2f')](_0x502626,function(_0x59cdcb){if(_0x59cdcb[_0xfcae('0x3d')]!==_0xfcae('0x3e')){var _0x1582c8={};_0x1582c8[_0x59cdcb[_0xfcae('0x2b')]]={'$like':'%'+_0x29a7d7[_0xfcae('0x30')][_0xfcae('0x3f')]+'%'};return _0x1582c8;}})});}_0x3931b0=_[_0xfcae('0x40')]({},_0x3931b0,_0x29a7d7[_0xfcae('0x41')]);var _0x337d45={'where':_0x3931b0[_0xfcae('0x3a')]};return db[_0xfcae('0x2c')][_0xfcae('0x1e')](_0x337d45)[_0xfcae('0x25')](function(_0x4211fc){_0x47cfde[_0xfcae('0x1e')]=_0x4211fc;if(_0x29a7d7[_0xfcae('0x30')][_0xfcae('0x42')]){_0x3931b0['include']=[{'all':!![]}];}return db[_0xfcae('0x2c')][_0xfcae('0x43')](_0x3931b0);})['then'](function(_0x86235f){_0x47cfde[_0xfcae('0x44')]=_0x86235f;return _0x47cfde;})[_0xfcae('0x25')](respondWithFilteredResult(_0x2859d2,_0x3931b0))[_0xfcae('0x45')](handleError(_0x2859d2,null));};exports[_0xfcae('0x46')]=function(_0x13b59c,_0x1fe8f2){var _0x4ff103={'raw':!![],'where':{'id':_0x13b59c[_0xfcae('0x47')]['id']}},_0x3c94f1={};_0x3c94f1['model']=_[_0xfcae('0x31')](db[_0xfcae('0x2c')][_0xfcae('0x2d')]);_0x3c94f1[_0xfcae('0x30')]=_['keys'](_0x13b59c['query']);_0x3c94f1['filters']=_[_0xfcae('0x32')](_0x3c94f1['model'],_0x3c94f1[_0xfcae('0x30')]);_0x4ff103['attributes']=_[_0xfcae('0x32')](_0x3c94f1['model'],qs[_0xfcae('0x34')](_0x13b59c[_0xfcae('0x30')][_0xfcae('0x34')]));_0x4ff103['attributes']=_0x4ff103['attributes']['length']?_0x4ff103['attributes']:_0x3c94f1[_0xfcae('0x33')];if(_0x13b59c['query'][_0xfcae('0x42')]){_0x4ff103[_0xfcae('0x48')]=[{'all':!![]}];}_0x4ff103=_[_0xfcae('0x40')]({},_0x4ff103,_0x13b59c[_0xfcae('0x41')]);return db['FaxQueue'][_0xfcae('0x49')](_0x4ff103)[_0xfcae('0x25')](handleEntityNotFound(_0x1fe8f2,null))['then'](respondWithResult(_0x1fe8f2,null))[_0xfcae('0x45')](handleError(_0x1fe8f2,null));};exports[_0xfcae('0x4a')]=function(_0x543370,_0x562f6c){return db[_0xfcae('0x2c')]['create'](_0x543370[_0xfcae('0x4b')],{})[_0xfcae('0x25')](function(_0x41b0fe){var _0x524cee=_0x543370[_0xfcae('0x4c')][_0xfcae('0x27')]({'plain':!![]});if(!_0x524cee)throw new Error(_0xfcae('0x4d'));if(_0x524cee['role']===_0xfcae('0x4c')){var _0x1682db=_0x41b0fe[_0xfcae('0x27')]({'plain':!![]});var _0x14d98a=_0xfcae('0x4e');return db[_0xfcae('0x4f')]['find']({'where':{'name':_0x14d98a,'userProfileId':_0x524cee[_0xfcae('0x50')]},'raw':!![]})[_0xfcae('0x25')](function(_0x56eee7){if(_0x56eee7&&_0x56eee7['autoAssociation']===0x0){return db[_0xfcae('0x28')][_0xfcae('0x4a')]({'name':_0x1682db[_0xfcae('0x2b')],'resourceId':_0x1682db['id'],'type':_0x56eee7[_0xfcae('0x2b')],'sectionId':_0x56eee7['id']},{})[_0xfcae('0x25')](function(){return _0x41b0fe;});}else{return _0x41b0fe;}})[_0xfcae('0x45')](function(_0xbb2c2f){logger[_0xfcae('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbb2c2f);throw _0xbb2c2f;});}return _0x41b0fe;})['then'](respondWithResult(_0x562f6c,0xc9))[_0xfcae('0x45')](handleError(_0x562f6c,null));};exports[_0xfcae('0x51')]=function(_0x30ed96,_0x875b6d){if(_0x30ed96[_0xfcae('0x4b')]['id']){delete _0x30ed96['body']['id'];}return db[_0xfcae('0x2c')][_0xfcae('0x49')]({'where':{'id':_0x30ed96[_0xfcae('0x47')]['id']}})['then'](handleEntityNotFound(_0x875b6d,null))['then'](saveUpdates(_0x30ed96[_0xfcae('0x4b')],null))[_0xfcae('0x25')](respondWithResult(_0x875b6d,null))[_0xfcae('0x45')](handleError(_0x875b6d,null));};exports[_0xfcae('0x26')]=function(_0x393624,_0x181d40){return db[_0xfcae('0x2c')][_0xfcae('0x49')]({'where':{'id':_0x393624[_0xfcae('0x47')]['id']}})['then'](handleEntityNotFound(_0x181d40,null))[_0xfcae('0x25')](removeEntity(_0x181d40,null))[_0xfcae('0x45')](handleError(_0x181d40,null));};exports[_0xfcae('0x52')]=function(_0x4b64a4,_0x3f8e7b){return db[_0xfcae('0x2c')][_0xfcae('0x52')]()[_0xfcae('0x25')](respondWithResult(_0x3f8e7b,null))['catch'](handleError(_0x3f8e7b,null));};exports[_0xfcae('0x53')]=function(_0x1a5e0f,_0x1df11f,_0x35bf42){var _0x5ddac0={'raw':!![],'where':{}},_0x61fda0={},_0x2c2d6a;return db[_0xfcae('0x2c')][_0xfcae('0x54')]({'where':{'id':_0x1a5e0f[_0xfcae('0x47')]['id']}})[_0xfcae('0x25')](handleEntityNotFound(_0x1df11f,null))['then'](function(_0x2cc2d4){if(_0x2cc2d4){_0x2c2d6a=_0x2cc2d4[_0xfcae('0x27')]({'plain':!![]});_0x61fda0[_0xfcae('0x33')]=_[_0xfcae('0x31')](db[_0xfcae('0x55')]['rawAttributes']);_0x61fda0[_0xfcae('0x30')]=_['keys'](_0x1a5e0f['query']);_0x61fda0['filters']=_[_0xfcae('0x32')](_0x61fda0[_0xfcae('0x33')],_0x61fda0[_0xfcae('0x30')]);_0x5ddac0[_0xfcae('0x35')]=_[_0xfcae('0x32')](_0x61fda0['model'],qs[_0xfcae('0x34')](_0x1a5e0f[_0xfcae('0x30')]['fields']));_0x5ddac0[_0xfcae('0x35')]=_0x5ddac0[_0xfcae('0x35')][_0xfcae('0x36')]?_0x5ddac0[_0xfcae('0x35')]:_0x61fda0[_0xfcae('0x33')];if(!_0x1a5e0f[_0xfcae('0x30')]['hasOwnProperty'](_0xfcae('0x38'))){_0x5ddac0[_0xfcae('0x20')]=qs[_0xfcae('0x20')](_0x1a5e0f[_0xfcae('0x30')][_0xfcae('0x20')]);_0x5ddac0[_0xfcae('0x1f')]=qs[_0xfcae('0x1f')](_0x1a5e0f[_0xfcae('0x30')][_0xfcae('0x1f')]);}_0x5ddac0[_0xfcae('0x56')]=qs[_0xfcae('0x39')](_0x1a5e0f[_0xfcae('0x30')][_0xfcae('0x39')]);_0x5ddac0[_0xfcae('0x3a')]=qs[_0xfcae('0x3b')](_[_0xfcae('0x3c')](_0x1a5e0f[_0xfcae('0x30')],_0x61fda0[_0xfcae('0x3b')]));_0x5ddac0[_0xfcae('0x3a')]['FaxQueueId']=_0x2cc2d4['id'];if(_0x1a5e0f[_0xfcae('0x30')][_0xfcae('0x3f')]){_0x5ddac0[_0xfcae('0x3a')]=_['merge'](_0x5ddac0['where'],{'$or':_[_0xfcae('0x2f')](_0x5ddac0['attributes'],function(_0x4dbbba){var _0x4aa346={};_0x4aa346[_0x4dbbba]={'$like':'%'+_0x1a5e0f[_0xfcae('0x30')][_0xfcae('0x3f')]+'%'};return _0x4aa346;})});}_0x5ddac0=_[_0xfcae('0x40')]({},_0x5ddac0,_0x1a5e0f[_0xfcae('0x41')]);return db[_0xfcae('0x55')]['findAll'](_0x5ddac0);}})[_0xfcae('0x25')](function(_0x2ea348){if(_0x2ea348){return db[_0xfcae('0x57')][_0xfcae('0x58')]({'where':{'id':_[_0xfcae('0x2f')](_0x2ea348,_0xfcae('0x59')),'role':'agent'},'attributes':['id',_0xfcae('0x2b'),_0xfcae('0x5a'),_0xfcae('0x5b'),_0xfcae('0x5c')]});}})['then'](function(_0xd42e84){if(_0xd42e84){return{'count':_0xd42e84[_0xfcae('0x1e')],'rows':_['map'](_0xd42e84[_0xfcae('0x44')],function(_0x51d789){return{'membername':_0x51d789[_0xfcae('0x2b')],'UserId':_0x51d789['id'],'queue_name':_0x2c2d6a[_0xfcae('0x2b')],'FaxQueueId':_0x2c2d6a['id'],'interface':util[_0xfcae('0x5d')](_0xfcae('0x5e'),_0xfcae('0x5f'),_0x51d789['name']),'penalty':0x0,'paused':_0x51d789[_0xfcae('0x5a')],'createdAt':_0x51d789[_0xfcae('0x5c')],'updatedAt':_0x51d789['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfcae('0x25')](respondWithFilteredResult(_0x1df11f,_0x5ddac0))['catch'](handleError(_0x1df11f,null));};exports[_0xfcae('0x60')]=function(_0x40b967,_0x163306,_0x3cfcad){var _0x1ead11={};var _0x39bf87={};var _0x7ee008;var _0x1ce9d6;return db[_0xfcae('0x2c')]['findOne']({'where':{'id':_0x40b967[_0xfcae('0x47')]['id']}})[_0xfcae('0x25')](handleEntityNotFound(_0x163306,null))[_0xfcae('0x25')](function(_0x1f4b43){if(_0x1f4b43){_0x7ee008=_0x1f4b43;_0x39bf87['model']=_[_0xfcae('0x31')](db[_0xfcae('0x61')][_0xfcae('0x2d')]);_0x39bf87['query']=_['keys'](_0x40b967['query']);_0x39bf87['filters']=_[_0xfcae('0x32')](_0x39bf87[_0xfcae('0x33')],_0x39bf87['query']);_0x1ead11[_0xfcae('0x35')]=_['intersection'](_0x39bf87['model'],qs[_0xfcae('0x34')](_0x40b967['query'][_0xfcae('0x34')]));_0x1ead11[_0xfcae('0x35')]=_0x1ead11[_0xfcae('0x35')][_0xfcae('0x36')]?_0x1ead11[_0xfcae('0x35')]:_0x39bf87[_0xfcae('0x33')];_0x1ead11[_0xfcae('0x56')]=qs[_0xfcae('0x39')](_0x40b967[_0xfcae('0x30')][_0xfcae('0x39')]);_0x1ead11['where']=qs[_0xfcae('0x3b')](_[_0xfcae('0x3c')](_0x40b967[_0xfcae('0x30')],_0x39bf87[_0xfcae('0x3b')]));if(_0x40b967[_0xfcae('0x30')][_0xfcae('0x3f')]){_0x1ead11[_0xfcae('0x3a')]=_[_0xfcae('0x40')](_0x1ead11[_0xfcae('0x3a')],{'$or':_['map'](_0x1ead11[_0xfcae('0x35')],function(_0x2caee8){var _0x48140d={};_0x48140d[_0x2caee8]={'$like':'%'+_0x40b967['query']['filter']+'%'};return _0x48140d;})});}_0x1ead11=_[_0xfcae('0x40')]({},_0x1ead11,_0x40b967[_0xfcae('0x41')]);return _0x7ee008[_0xfcae('0x60')](_0x1ead11);}})['then'](function(_0x476307){if(_0x476307){_0x1ce9d6=_0x476307['length'];if(!_0x40b967[_0xfcae('0x30')][_0xfcae('0x37')](_0xfcae('0x38'))){_0x1ead11[_0xfcae('0x20')]=qs[_0xfcae('0x20')](_0x40b967['query']['limit']);_0x1ead11[_0xfcae('0x1f')]=qs[_0xfcae('0x1f')](_0x40b967[_0xfcae('0x30')]['offset']);}return _0x7ee008[_0xfcae('0x60')](_0x1ead11);}})[_0xfcae('0x25')](function(_0x5124fc){if(_0x5124fc){return _0x5124fc?{'count':_0x1ce9d6,'rows':_0x5124fc}:null;}})['then'](respondWithResult(_0x163306,null))[_0xfcae('0x45')](handleError(_0x163306,null));};exports[_0xfcae('0x62')]=function(_0x470924,_0x5b8d6f,_0x5521b4){var _0x573359=_0x470924[_0xfcae('0x4b')][_0xfcae('0x63')];return db[_0xfcae('0x61')][_0xfcae('0x43')]({'where':{'id':_0x573359},'attributes':['id'],'include':[{'model':db[_0xfcae('0x57')],'as':_0xfcae('0x64'),'attributes':['id',_0xfcae('0x2b'),'online','voicePause',_0xfcae('0x65')],'raw':!![]}]})[_0xfcae('0x25')](function(_0x49d569){if(_0x49d569){var _0x37c97f=_[_0xfcae('0x66')](_0x49d569,function(_0x470891){var _0x2adfd9=_0x470891['get']({'plain':!![]});return _0x2adfd9['Agents'];});return db[_0xfcae('0x2c')][_0xfcae('0x49')]({'where':{'id':_0x470924[_0xfcae('0x47')]['id']}})[_0xfcae('0x25')](function(_0x4520d2){return db[_0xfcae('0x67')]['transaction'](function(_0x14a44f){return _0x4520d2[_0xfcae('0x62')](_0x573359,{'transaction':_0x14a44f})[_0xfcae('0x25')](function(){return BPromise[_0xfcae('0x68')](_0x37c97f,function(_0xb858b6){return db[_0xfcae('0x55')][_0xfcae('0x69')]({'where':{'UserId':_0xb858b6['id'],'FaxQueueId':_0x470924[_0xfcae('0x47')]['id']},'transaction':_0x14a44f});});})[_0xfcae('0x25')](function(){_0x37c97f['forEach'](function(_0x1138bc){socket['emit'](_0xfcae('0x6a'),{'UserId':_0x1138bc['id'],'FaxQueueId':_0x4520d2['id']});});});});});}})[_0xfcae('0x25')](respondWithStatusCode(_0x5b8d6f,null))['catch'](handleError(_0x5b8d6f,null));};exports[_0xfcae('0x6b')]=function(_0xc89937,_0x3b9fb3,_0x532c64){return db['Team'][_0xfcae('0x43')]({'where':{'id':_0xc89937['query'][_0xfcae('0x63')]},'attributes':['id'],'include':[{'model':db[_0xfcae('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfcae('0x25')](handleEntityNotFound(_0x3b9fb3,null))[_0xfcae('0x25')](function(_0x4d2659){var _0x23a5fe=_[_0xfcae('0x2f')](_0x4d2659,'id');var _0x3e4b76=[];var _0x2b358a=[];var _0x590f10=squel[_0xfcae('0x6c')]();_0x590f10[_0xfcae('0x6d')](_0xfcae('0x6e'))[_0xfcae('0x6f')](_0xfcae('0x70'),'tq')[_0xfcae('0x71')](_0xfcae('0x72'),'ut',_0xfcae('0x73'))[_0xfcae('0x3a')](_0xfcae('0x74'),_0xc89937['params']['id']);for(var _0xcebbeb=0x0;_0xcebbeb<_0x4d2659[_0xfcae('0x36')];_0xcebbeb+=0x1){let _0x1ed0be=_0x4d2659[_0xcebbeb];for(var _0x14a63f=0x0;_0x14a63f<_0x1ed0be[_0xfcae('0x64')][_0xfcae('0x36')];_0x14a63f+=0x1){let _0x45b3b1=_0x1ed0be['Agents'][_0x14a63f];var _0x193978=_0x590f10[_0xfcae('0x75')]();_0x193978['where']('ut.UserId\x20=\x20?',_0x45b3b1['id']);_0x2b358a['push'](db[_0xfcae('0x67')]['query'](_0x193978['toString'](),{'type':db['sequelize'][_0xfcae('0x76')][_0xfcae('0x77')]})[_0xfcae('0x25')](function(_0x5023f5){if(_0x5023f5[_0xfcae('0x36')]===0x1){return _0x45b3b1['id'];}else{var _0x1c1110=_[_0xfcae('0x78')](_[_0xfcae('0x2f')](_0x5023f5,'TeamId'),function(_0x1ca38c){return _[_0xfcae('0x79')](_0x23a5fe,_0x1ca38c);});if(_0x1c1110){return _0x45b3b1['id'];}}}));}}return BPromise[_0xfcae('0x7a')](_0x2b358a)[_0xfcae('0x25')](function(_0x1894a7){_0x3e4b76=_(_0x3e4b76)[_0xfcae('0x7b')](_0x1894a7)[_0xfcae('0x7c')]()[_0xfcae('0x7d')]();return db['FaxQueue'][_0xfcae('0x49')]({'where':{'id':_0xc89937[_0xfcae('0x47')]['id']}})[_0xfcae('0x25')](function(_0x149e6d){return db['sequelize'][_0xfcae('0x7e')](function(_0x58acab){return _0x149e6d[_0xfcae('0x6b')](_0xc89937[_0xfcae('0x30')][_0xfcae('0x63')],{'transaction':_0x58acab})[_0xfcae('0x25')](function(){if(!_[_0xfcae('0x7f')](_0x3e4b76)){return _0x149e6d[_0xfcae('0x80')](_0x3e4b76,{'transaction':_0x58acab});}})['then'](function(){_0x3e4b76[_0xfcae('0x81')](function(_0x58b410){socket[_0xfcae('0x82')](_0xfcae('0x83'),{'UserId':_0x58b410,'FaxQueueId':_0x149e6d['id']});});});});});});})[_0xfcae('0x25')](respondWithStatusCode(_0x3b9fb3,null))[_0xfcae('0x45')](handleError(_0x3b9fb3,null));};exports[_0xfcae('0x84')]=function(_0x5c30e3,_0x3b6b73,_0xd15842){return db[_0xfcae('0x2c')][_0xfcae('0x49')]({'where':{'id':_0x5c30e3[_0xfcae('0x47')]['id']}})[_0xfcae('0x25')](handleEntityNotFound(_0x3b6b73,null))[_0xfcae('0x25')](function(_0x5c88e4){if(_0x5c88e4){return _0x5c88e4[_0xfcae('0x84')](_0x5c30e3[_0xfcae('0x4b')][_0xfcae('0x63')],_[_0xfcae('0x85')](_0x5c30e3['body'],[_0xfcae('0x63'),'id'])||{})[_0xfcae('0x86')](function(_0xbc268f){for(var _0x26670f=0x0;_0x26670f<_0x5c30e3[_0xfcae('0x4b')][_0xfcae('0x63')]['length'];_0x26670f+=0x1){socket[_0xfcae('0x82')](_0xfcae('0x6a'),{'UserId':_0x5c30e3['body'][_0xfcae('0x63')][_0x26670f],'FaxQueueId':_0x5c30e3[_0xfcae('0x47')]['id']});}return _0xbc268f;});}})[_0xfcae('0x25')](respondWithResult(_0x3b6b73,null))[_0xfcae('0x45')](handleError(_0x3b6b73,null));};exports['removeAgents']=function(_0x30c064,_0x151d70,_0x231855){return db[_0xfcae('0x2c')][_0xfcae('0x49')]({'where':{'id':_0x30c064['params']['id']}})[_0xfcae('0x25')](handleEntityNotFound(_0x151d70,null))[_0xfcae('0x25')](function(_0x204bd3){if(_0x204bd3){return _0x204bd3[_0xfcae('0x80')](_0x30c064['query'][_0xfcae('0x63')])[_0xfcae('0x25')](function(){if(_[_0xfcae('0x87')](_0x30c064['query'][_0xfcae('0x63')])){for(var _0x465ac6=0x0;_0x465ac6<_0x30c064[_0xfcae('0x30')][_0xfcae('0x63')]['length'];_0x465ac6+=0x1){socket[_0xfcae('0x82')](_0xfcae('0x83'),{'UserId':Number(_0x30c064[_0xfcae('0x30')][_0xfcae('0x63')][_0x465ac6]),'FaxQueueId':Number(_0x30c064[_0xfcae('0x47')]['id'])});}}else{socket['emit'](_0xfcae('0x83'),{'UserId':Number(_0x30c064[_0xfcae('0x30')][_0xfcae('0x63')]),'FaxQueueId':Number(_0x30c064[_0xfcae('0x47')]['id'])});}});}})[_0xfcae('0x25')](respondWithStatusCode(_0x151d70,null))[_0xfcae('0x45')](handleError(_0x151d70,null));};exports['getAgents']=function(_0x293fa2,_0x2d530b,_0xfc88c9){var _0x423bd5={};var _0x5668d9={};var _0xce0604;var _0x3afa3e;return db[_0xfcae('0x2c')]['findOne']({'where':{'id':_0x293fa2[_0xfcae('0x47')]['id']}})[_0xfcae('0x25')](handleEntityNotFound(_0x2d530b,null))[_0xfcae('0x25')](function(_0x28dc4c){if(_0x28dc4c){_0xce0604=_0x28dc4c;_0x5668d9[_0xfcae('0x33')]=_[_0xfcae('0x31')](db[_0xfcae('0x57')]['rawAttributes']);_0x5668d9['query']=_[_0xfcae('0x31')](_0x293fa2[_0xfcae('0x30')]);_0x5668d9['filters']=_['intersection'](_0x5668d9['model'],_0x5668d9[_0xfcae('0x30')]);_0x423bd5['attributes']=_['intersection'](_0x5668d9[_0xfcae('0x33')],qs[_0xfcae('0x34')](_0x293fa2['query'][_0xfcae('0x34')]));_0x423bd5[_0xfcae('0x35')]=_0x423bd5[_0xfcae('0x35')][_0xfcae('0x36')]?_0x423bd5[_0xfcae('0x35')]:_0x5668d9[_0xfcae('0x33')];_0x423bd5['order']=qs[_0xfcae('0x39')](_0x293fa2['query'][_0xfcae('0x39')]);_0x423bd5['where']=qs[_0xfcae('0x3b')](_[_0xfcae('0x3c')](_0x293fa2[_0xfcae('0x30')],_0x5668d9[_0xfcae('0x3b')]));if(_0x293fa2[_0xfcae('0x30')][_0xfcae('0x3f')]){_0x423bd5['where']=_[_0xfcae('0x40')](_0x423bd5['where'],{'$or':_[_0xfcae('0x2f')](_0x423bd5[_0xfcae('0x35')],function(_0x3dd971){var _0x48e441={};_0x48e441[_0x3dd971]={'$like':'%'+_0x293fa2[_0xfcae('0x30')][_0xfcae('0x3f')]+'%'};return _0x48e441;})});}_0x423bd5=_[_0xfcae('0x40')]({},_0x423bd5,_0x293fa2[_0xfcae('0x41')]);return _0xce0604[_0xfcae('0x88')](_0x423bd5);}})['then'](function(_0x329d43){if(_0x329d43){_0x3afa3e=_0x329d43['length'];if(!_0x293fa2[_0xfcae('0x30')][_0xfcae('0x37')](_0xfcae('0x38'))){_0x423bd5[_0xfcae('0x20')]=qs[_0xfcae('0x20')](_0x293fa2[_0xfcae('0x30')]['limit']);_0x423bd5['offset']=qs[_0xfcae('0x1f')](_0x293fa2[_0xfcae('0x30')][_0xfcae('0x1f')]);}return _0xce0604[_0xfcae('0x88')](_0x423bd5);}})[_0xfcae('0x25')](function(_0x38fd19){if(_0x38fd19){return _0x38fd19?{'count':_0x3afa3e,'rows':_0x38fd19}:null;}})['then'](respondWithResult(_0x2d530b,null))[_0xfcae('0x45')](handleError(_0x2d530b,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ccac28b..90a5219 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 _0x7c99=['events','../../mysqldb','FaxQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x134749,_0x294e3c){var _0x3e6f43=function(_0x39ddf7){while(--_0x39ddf7){_0x134749['push'](_0x134749['shift']());}};_0x3e6f43(++_0x294e3c);}(_0x7c99,0x1d6));var _0x97c9=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7c99[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0x97c9('0x0'));var FaxQueue=require(_0x97c9('0x1'))['db'][_0x97c9('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x97c9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x97c9('0x4'),'afterDestroy':_0x97c9('0x5')};function emitEvent(_0x37d1c9){return function(_0x41fd1a,_0x4ae58f,_0x4f4fba){FaxQueueEvents['emit'](_0x37d1c9+':'+_0x41fd1a['id'],_0x41fd1a);FaxQueueEvents[_0x97c9('0x6')](_0x37d1c9,_0x41fd1a);_0x4f4fba(null);};}for(var e in events){if(events[_0x97c9('0x7')](e)){var event=events[e];FaxQueue[_0x97c9('0x8')](e,emitEvent(event));}}module[_0x97c9('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x5f7b=['emit','hasOwnProperty','hook','exports','events','FaxQueue','setMaxListeners','save','update','remove'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5f7b,0xcc));var _0xb5f7=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x5f7b[_0x4b7895];return _0x264180;};'use strict';var EventEmitter=require(_0xb5f7('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xb5f7('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb5f7('0x2')](0x0);var events={'afterCreate':_0xb5f7('0x3'),'afterUpdate':_0xb5f7('0x4'),'afterDestroy':_0xb5f7('0x5')};function emitEvent(_0x487d91){return function(_0x3e9393,_0x53e44f,_0x4d49d7){FaxQueueEvents[_0xb5f7('0x6')](_0x487d91+':'+_0x3e9393['id'],_0x3e9393);FaxQueueEvents['emit'](_0x487d91,_0x3e9393);_0x4d49d7(null);};}for(var e in events){if(events[_0xb5f7('0x7')](e)){var event=events[e];FaxQueue[_0xb5f7('0x8')](e,emitEvent(event));}}module[_0xb5f7('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index e0523cc..8cf5b6b 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 _0xa51b=['define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa51b,0x1b0));var _0xba51=function(_0x19faa4,_0x1ce8e8){_0x19faa4=_0x19faa4-0x0;var _0x51b78b=_0xa51b[_0x19faa4];return _0x51b78b;};'use strict';var _=require(_0xba51('0x0'));var util=require(_0xba51('0x1'));var logger=require(_0xba51('0x2'))(_0xba51('0x3'));var moment=require(_0xba51('0x4'));var BPromise=require('bluebird');var rp=require(_0xba51('0x5'));var fs=require('fs');var path=require(_0xba51('0x6'));var rimraf=require(_0xba51('0x7'));var config=require(_0xba51('0x8'));var attributes=require(_0xba51('0x9'));module['exports']=function(_0x5dd152,_0x115770){return _0x5dd152[_0xba51('0xa')](_0xba51('0xb'),attributes,{'tableName':_0xba51('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b9d=['moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','define','fax_queues','lodash','util','../../config/logger'];(function(_0x5a0630,_0x84bcd8){var _0x346ba9=function(_0x423a99){while(--_0x423a99){_0x5a0630['push'](_0x5a0630['shift']());}};_0x346ba9(++_0x84bcd8);}(_0x4b9d,0xd9));var _0xd4b9=function(_0x4c73ac,_0x46b73c){_0x4c73ac=_0x4c73ac-0x0;var _0x9839ee=_0x4b9d[_0x4c73ac];return _0x9839ee;};'use strict';var _=require(_0xd4b9('0x0'));var util=require(_0xd4b9('0x1'));var logger=require(_0xd4b9('0x2'))('api');var moment=require(_0xd4b9('0x3'));var BPromise=require(_0xd4b9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4b9('0x5'));var rimraf=require(_0xd4b9('0x6'));var config=require(_0xd4b9('0x7'));var attributes=require(_0xd4b9('0x8'));module['exports']=function(_0x250d72,_0x17539e){return _0x250d72[_0xd4b9('0x9')]('FaxQueue',attributes,{'tableName':_0xd4b9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 974e0d8..e41e020 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 _0xf204=['rpc','../../config/environment','defaults','localhost','redis','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowFaxQueue','find','debug','lodash','util','randomstring','../../config/logger'];(function(_0x412d5f,_0x3beb1){var _0x275d6f=function(_0x44535e){while(--_0x44535e){_0x412d5f['push'](_0x412d5f['shift']());}};_0x275d6f(++_0x3beb1);}(_0xf204,0x6b));var _0x4f20=function(_0x463c38,_0x562392){_0x463c38=_0x463c38-0x0;var _0x17304f=_0xf204[_0x463c38];return _0x17304f;};'use strict';var _=require(_0x4f20('0x0'));var util=require(_0x4f20('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f20('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4f20('0x3'))(_0x4f20('0x4'));var config=require(_0x4f20('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x4f20('0x6')](config['redis'],{'host':_0x4f20('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f20('0x8')]));require(_0x4f20('0x9'))[_0x4f20('0xa')](socket);function respondWithRpcPromise(_0xde60aa,_0x4ce2f8,_0x385a60){return new BPromise(function(_0x45200e,_0x32f9c6){return client[_0x4f20('0xb')](_0xde60aa,_0x385a60)[_0x4f20('0xc')](function(_0x3e2182){logger['info'](_0x4f20('0xd'),_0x4ce2f8,'request\x20sent');logger['debug'](_0x4f20('0xe'),_0x4ce2f8,_0x4f20('0xf'),JSON[_0x4f20('0x10')](_0x3e2182));if(_0x3e2182[_0x4f20('0x11')]){if(_0x3e2182[_0x4f20('0x11')][_0x4f20('0x12')]===0x1f4){logger[_0x4f20('0x11')]('FaxQueue,\x20%s,\x20%s',_0x4ce2f8,_0x3e2182['error']['message']);return _0x32f9c6(_0x3e2182[_0x4f20('0x11')][_0x4f20('0x13')]);}logger[_0x4f20('0x11')](_0x4f20('0xd'),_0x4ce2f8,_0x3e2182[_0x4f20('0x11')][_0x4f20('0x13')]);return _0x45200e(_0x3e2182[_0x4f20('0x11')]['message']);}else{logger[_0x4f20('0x14')](_0x4f20('0xd'),_0x4ce2f8,_0x4f20('0xf'));_0x45200e(_0x3e2182[_0x4f20('0x15')][_0x4f20('0x13')]);}})[_0x4f20('0x16')](function(_0x200050){logger[_0x4f20('0x11')](_0x4f20('0xd'),_0x4ce2f8,_0x200050);_0x32f9c6(_0x200050);});});}exports[_0x4f20('0x17')]=function(_0x53d5d2){var _0x298e5b=this;return new Promise(function(_0x448649,_0x48c423){return db[_0x4f20('0x18')][_0x4f20('0x19')]({'raw':_0x53d5d2[_0x4f20('0x1a')]?_0x53d5d2[_0x4f20('0x1a')][_0x4f20('0x1b')]===undefined?!![]:![]:!![],'where':_0x53d5d2[_0x4f20('0x1a')]?_0x53d5d2[_0x4f20('0x1a')][_0x4f20('0x1c')]||null:null,'attributes':_0x53d5d2['options']?_0x53d5d2['options'][_0x4f20('0x1d')]||null:null,'limit':_0x53d5d2[_0x4f20('0x1a')]?_0x53d5d2[_0x4f20('0x1a')][_0x4f20('0x1e')]||null:null,'include':_0x53d5d2[_0x4f20('0x1a')]?_0x53d5d2['options'][_0x4f20('0x1f')]?_[_0x4f20('0x20')](_0x53d5d2[_0x4f20('0x1a')][_0x4f20('0x1f')],function(_0x31c23d){return{'model':db[_0x31c23d['model']],'as':_0x31c23d['as'],'attributes':_0x31c23d['attributes'],'include':_0x31c23d[_0x4f20('0x1f')]?_[_0x4f20('0x20')](_0x31c23d[_0x4f20('0x1f')],function(_0x52c8ec){return{'model':db[_0x52c8ec[_0x4f20('0x21')]],'as':_0x52c8ec['as'],'attributes':_0x52c8ec[_0x4f20('0x1d')],'include':_0x52c8ec[_0x4f20('0x1f')]?_[_0x4f20('0x20')](_0x52c8ec[_0x4f20('0x1f')],function(_0x588ed7){return{'model':db[_0x588ed7['model']],'as':_0x588ed7['as'],'attributes':_0x588ed7[_0x4f20('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x533327){logger[_0x4f20('0x14')](_0x4f20('0x17'),_0x53d5d2);logger['debug']('GetFaxQueue',_0x53d5d2,JSON['stringify'](_0x533327));_0x448649(_0x533327);})[_0x4f20('0x16')](function(_0x57c931){logger['error'](_0x4f20('0x17'),_0x57c931[_0x4f20('0x13')],_0x53d5d2);_0x48c423(_0x298e5b[_0x4f20('0x11')](0x1f4,_0x57c931[_0x4f20('0x13')]));});});};exports[_0x4f20('0x22')]=function(_0x2d96bf){var _0x2325eb=this;return new Promise(function(_0x6e838f,_0x50a84){return db['FaxQueue'][_0x4f20('0x23')]({'raw':_0x2d96bf[_0x4f20('0x1a')]?_0x2d96bf['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d96bf[_0x4f20('0x1a')]?_0x2d96bf['options'][_0x4f20('0x1c')]||null:null,'attributes':_0x2d96bf['options']?_0x2d96bf[_0x4f20('0x1a')][_0x4f20('0x1d')]||null:null,'include':_0x2d96bf[_0x4f20('0x1a')]?_0x2d96bf['options'][_0x4f20('0x1f')]?_[_0x4f20('0x20')](_0x2d96bf['options'][_0x4f20('0x1f')],function(_0x4d62a6){return{'model':db[_0x4d62a6[_0x4f20('0x21')]],'as':_0x4d62a6['as'],'attributes':_0x4d62a6[_0x4f20('0x1d')],'include':_0x4d62a6[_0x4f20('0x1f')]?_[_0x4f20('0x20')](_0x4d62a6[_0x4f20('0x1f')],function(_0x15388e){return{'model':db[_0x15388e[_0x4f20('0x21')]],'as':_0x15388e['as'],'attributes':_0x15388e[_0x4f20('0x1d')],'include':_0x15388e[_0x4f20('0x1f')]?_['map'](_0x15388e['include'],function(_0x58373a){return{'model':db[_0x58373a[_0x4f20('0x21')]],'as':_0x58373a['as'],'attributes':_0x58373a[_0x4f20('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4f20('0xc')](function(_0x2206d0){logger[_0x4f20('0x14')](_0x4f20('0x22'),_0x2d96bf);logger[_0x4f20('0x24')](_0x4f20('0x22'),_0x2d96bf,JSON[_0x4f20('0x10')](_0x2206d0));_0x6e838f(_0x2206d0);})[_0x4f20('0x16')](function(_0x3409b1){logger[_0x4f20('0x11')](_0x4f20('0x22'),_0x3409b1['message'],_0x2d96bf);_0x50a84(_0x2325eb[_0x4f20('0x11')](0x1f4,_0x3409b1[_0x4f20('0x13')]));});});}; \ No newline at end of file +var _0x4e4d=['FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','limit','include','map','model','ShowFaxQueue','find','where','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e4d,0xbb));var _0xd4e4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4e4d[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xd4e4('0x0'));var util=require(_0xd4e4('0x1'));var moment=require(_0xd4e4('0x2'));var BPromise=require('bluebird');var rs=require(_0xd4e4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd4e4('0x4'));var logger=require(_0xd4e4('0x5'))(_0xd4e4('0x6'));var config=require(_0xd4e4('0x7'));var jayson=require(_0xd4e4('0x8'));var client=jayson[_0xd4e4('0x9')][_0xd4e4('0xa')]({'port':0x232a});config['redis']=_[_0xd4e4('0xb')](config[_0xd4e4('0xc')],{'host':_0xd4e4('0xd'),'port':0x18eb});var socket=require(_0xd4e4('0xe'))(new Redis(config[_0xd4e4('0xc')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x206b88,_0x23971,_0x569db8){return new BPromise(function(_0x24c36f,_0x6f085d){return client[_0xd4e4('0xf')](_0x206b88,_0x569db8)[_0xd4e4('0x10')](function(_0x244135){logger[_0xd4e4('0x11')](_0xd4e4('0x12'),_0x23971,_0xd4e4('0x13'));logger[_0xd4e4('0x14')](_0xd4e4('0x15'),_0x23971,_0xd4e4('0x13'),JSON[_0xd4e4('0x16')](_0x244135));if(_0x244135[_0xd4e4('0x17')]){if(_0x244135[_0xd4e4('0x17')][_0xd4e4('0x18')]===0x1f4){logger[_0xd4e4('0x17')](_0xd4e4('0x12'),_0x23971,_0x244135['error'][_0xd4e4('0x19')]);return _0x6f085d(_0x244135[_0xd4e4('0x17')][_0xd4e4('0x19')]);}logger[_0xd4e4('0x17')](_0xd4e4('0x12'),_0x23971,_0x244135['error'][_0xd4e4('0x19')]);return _0x24c36f(_0x244135[_0xd4e4('0x17')][_0xd4e4('0x19')]);}else{logger[_0xd4e4('0x11')]('FaxQueue,\x20%s,\x20%s',_0x23971,_0xd4e4('0x13'));_0x24c36f(_0x244135[_0xd4e4('0x1a')][_0xd4e4('0x19')]);}})[_0xd4e4('0x1b')](function(_0x544736){logger[_0xd4e4('0x17')]('FaxQueue,\x20%s,\x20%s',_0x23971,_0x544736);_0x6f085d(_0x544736);});});}exports[_0xd4e4('0x1c')]=function(_0x1612a7){var _0x121b2a=this;return new Promise(function(_0x597e97,_0x53184c){return db[_0xd4e4('0x1d')][_0xd4e4('0x1e')]({'raw':_0x1612a7[_0xd4e4('0x1f')]?_0x1612a7[_0xd4e4('0x1f')][_0xd4e4('0x20')]===undefined?!![]:![]:!![],'where':_0x1612a7['options']?_0x1612a7[_0xd4e4('0x1f')]['where']||null:null,'attributes':_0x1612a7[_0xd4e4('0x1f')]?_0x1612a7[_0xd4e4('0x1f')][_0xd4e4('0x21')]||null:null,'limit':_0x1612a7['options']?_0x1612a7[_0xd4e4('0x1f')][_0xd4e4('0x22')]||null:null,'include':_0x1612a7[_0xd4e4('0x1f')]?_0x1612a7[_0xd4e4('0x1f')][_0xd4e4('0x23')]?_[_0xd4e4('0x24')](_0x1612a7[_0xd4e4('0x1f')][_0xd4e4('0x23')],function(_0x57e888){return{'model':db[_0x57e888[_0xd4e4('0x25')]],'as':_0x57e888['as'],'attributes':_0x57e888[_0xd4e4('0x21')],'include':_0x57e888[_0xd4e4('0x23')]?_[_0xd4e4('0x24')](_0x57e888[_0xd4e4('0x23')],function(_0x15b3f1){return{'model':db[_0x15b3f1[_0xd4e4('0x25')]],'as':_0x15b3f1['as'],'attributes':_0x15b3f1[_0xd4e4('0x21')],'include':_0x15b3f1[_0xd4e4('0x23')]?_[_0xd4e4('0x24')](_0x15b3f1[_0xd4e4('0x23')],function(_0x201ab3){return{'model':db[_0x201ab3['model']],'as':_0x201ab3['as'],'attributes':_0x201ab3[_0xd4e4('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd4e4('0x10')](function(_0x26e4a3){logger[_0xd4e4('0x11')](_0xd4e4('0x1c'),_0x1612a7);logger[_0xd4e4('0x14')](_0xd4e4('0x1c'),_0x1612a7,JSON[_0xd4e4('0x16')](_0x26e4a3));_0x597e97(_0x26e4a3);})[_0xd4e4('0x1b')](function(_0x3a8e56){logger[_0xd4e4('0x17')](_0xd4e4('0x1c'),_0x3a8e56[_0xd4e4('0x19')],_0x1612a7);_0x53184c(_0x121b2a[_0xd4e4('0x17')](0x1f4,_0x3a8e56['message']));});});};exports[_0xd4e4('0x26')]=function(_0x5ba68c){var _0x213f50=this;return new Promise(function(_0x57f671,_0x543919){return db[_0xd4e4('0x1d')][_0xd4e4('0x27')]({'raw':_0x5ba68c[_0xd4e4('0x1f')]?_0x5ba68c[_0xd4e4('0x1f')][_0xd4e4('0x20')]===undefined?!![]:![]:!![],'where':_0x5ba68c['options']?_0x5ba68c['options'][_0xd4e4('0x28')]||null:null,'attributes':_0x5ba68c['options']?_0x5ba68c[_0xd4e4('0x1f')][_0xd4e4('0x21')]||null:null,'include':_0x5ba68c['options']?_0x5ba68c[_0xd4e4('0x1f')][_0xd4e4('0x23')]?_[_0xd4e4('0x24')](_0x5ba68c[_0xd4e4('0x1f')][_0xd4e4('0x23')],function(_0x2a1609){return{'model':db[_0x2a1609[_0xd4e4('0x25')]],'as':_0x2a1609['as'],'attributes':_0x2a1609[_0xd4e4('0x21')],'include':_0x2a1609[_0xd4e4('0x23')]?_[_0xd4e4('0x24')](_0x2a1609[_0xd4e4('0x23')],function(_0x3931fc){return{'model':db[_0x3931fc[_0xd4e4('0x25')]],'as':_0x3931fc['as'],'attributes':_0x3931fc['attributes'],'include':_0x3931fc[_0xd4e4('0x23')]?_[_0xd4e4('0x24')](_0x3931fc[_0xd4e4('0x23')],function(_0x1a8c43){return{'model':db[_0x1a8c43['model']],'as':_0x1a8c43['as'],'attributes':_0x1a8c43[_0xd4e4('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd4e4('0x10')](function(_0x209e65){logger[_0xd4e4('0x11')]('ShowFaxQueue',_0x5ba68c);logger[_0xd4e4('0x14')](_0xd4e4('0x26'),_0x5ba68c,JSON[_0xd4e4('0x16')](_0x209e65));_0x57f671(_0x209e65);})[_0xd4e4('0x1b')](function(_0x4cb970){logger[_0xd4e4('0x17')](_0xd4e4('0x26'),_0x4cb970[_0xd4e4('0x19')],_0x5ba68c);_0x543919(_0x213f50[_0xd4e4('0x17')](0x1f4,_0x4cb970[_0xd4e4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 62604f2..2e9189e 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 _0x3911=['save','remove','update','emit','length','faxQueue:','./faxQueue.events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3911,0x76));var _0x1391=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0x3911[_0x2c1dcd];return _0x158ce5;};'use strict';var FaxQueueEvents=require(_0x1391('0x0'));var events=[_0x1391('0x1'),_0x1391('0x2'),_0x1391('0x3')];function createListener(_0x3100e6,_0x4823af){return function(_0x4c487b){_0x4823af[_0x1391('0x4')](_0x3100e6,_0x4c487b);};}function removeListener(_0x46e0b0,_0x2e95e8){return function(){FaxQueueEvents['removeListener'](_0x46e0b0,_0x2e95e8);};}exports['register']=function(_0x205d1b){for(var _0x5786dc=0x0,_0x3a310d=events[_0x1391('0x5')];_0x5786dc<_0x3a310d;_0x5786dc++){var _0x143b74=events[_0x5786dc];var _0x2c0f0e=createListener(_0x1391('0x6')+_0x143b74,_0x205d1b);FaxQueueEvents['on'](_0x143b74,_0x2c0f0e);}}; \ No newline at end of file +var _0x789f=['save','remove','emit','removeListener','register','faxQueue:'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x789f,0x132));var _0xf789=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0x789f[_0x498334];return _0x13bb70;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xf789('0x0'),_0xf789('0x1'),'update'];function createListener(_0x3d93c2,_0x44a8f0){return function(_0x570a42){_0x44a8f0[_0xf789('0x2')](_0x3d93c2,_0x570a42);};}function removeListener(_0x3b42f2,_0xca769a){return function(){FaxQueueEvents[_0xf789('0x3')](_0x3b42f2,_0xca769a);};}exports[_0xf789('0x4')]=function(_0x27f29e){for(var _0x4701d6=0x0,_0x8def63=events['length'];_0x4701d6<_0x8def63;_0x4701d6++){var _0x27737e=events[_0x4701d6];var _0x1fa1b2=createListener(_0xf789('0x5')+_0x27737e,_0x27f29e);FaxQueueEvents['on'](_0x27737e,_0x1fa1b2);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index d89d6ef..ba007d4 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 _0xd8b0=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index','get','/describe','describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','exports','multer'];(function(_0x3a3976,_0x31cf95){var _0x3f3e45=function(_0x1f5181){while(--_0x1f5181){_0x3a3976['push'](_0x3a3976['shift']());}};_0x3f3e45(++_0x31cf95);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['get'](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x13')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);router[_0x0d8b('0x13')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0x17'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x18')]);router[_0x0d8b('0x19')](_0x0d8b('0x17'),auth['isAuthenticated'](),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x19')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x1b')]);router[_0x0d8b('0x19')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller['removeAgents']);module[_0x0d8b('0x1c')]=router; \ No newline at end of file +var _0xb10b=['addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0xb10b,0x12a));var _0xbb10=function(_0x81e39d,_0x4c3934){_0x81e39d=_0x81e39d-0x0;var _0x548fbb=_0xb10b[_0x81e39d];return _0x548fbb;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getMembers']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['get'](_0xbb10('0x11'),auth['isAuthenticated'](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x13')](_0xbb10('0xf'),auth['isAuthenticated'](),controller[_0xbb10('0x15')]);router[_0xbb10('0x13')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x16')]);router[_0xbb10('0x17')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x18')]);router[_0xbb10('0x19')]('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x19')](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1b')]);router[_0xbb10('0x19')](_0xbb10('0x11'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 4521102..3854cef 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 _0x30aa=['exports','STRING','DATE','moment','sequelize'];(function(_0x11a6dd,_0x24663e){var _0x215d88=function(_0x2f3d04){while(--_0x2f3d04){_0x11a6dd['push'](_0x11a6dd['shift']());}};_0x215d88(++_0x24663e);}(_0x30aa,0xfd));var _0xa30a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x30aa[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0xa30a('0x0'));var Sequelize=require(_0xa30a('0x1'));module[_0xa30a('0x2')]={'uniqueid':{'type':Sequelize[_0xa30a('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa30a('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa30a('0x4')]},'acceptAt':{'type':Sequelize[_0xa30a('0x4')]},'exitAt':{'type':Sequelize[_0xa30a('0x4')]},'reason':{'type':Sequelize[_0xa30a('0x3')]}}; \ No newline at end of file +var _0x1a63=['DATE','moment','sequelize','exports','STRING'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0x1a63,0x83));var _0x31a6=function(_0x5d3d39,_0x5ed8a1){_0x5d3d39=_0x5d3d39-0x0;var _0x2de363=_0x1a63[_0x5d3d39];return _0x2de363;};'use strict';var moment=require(_0x31a6('0x0'));var Sequelize=require(_0x31a6('0x1'));module[_0x31a6('0x2')]={'uniqueid':{'type':Sequelize[_0x31a6('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x31a6('0x3')]},'joinAt':{'type':Sequelize[_0x31a6('0x4')]},'leaveAt':{'type':Sequelize[_0x31a6('0x4')]},'acceptAt':{'type':Sequelize[_0x31a6('0x4')]},'exitAt':{'type':Sequelize[_0x31a6('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index fdb170a..0d93452 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 _0x2aa6=['then','destroy','end','error','name','send','map','FaxQueueReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','catch','show','params','intersection','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','json','offset','limit','set','reject','save','update'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0x2aa6,0xb5));var _0x62aa=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0x2aa6[_0x4c4037];return _0x357862;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x62aa('0x0'));var rimraf=require(_0x62aa('0x1'));var zipdir=require(_0x62aa('0x2'));var jsonpatch=require(_0x62aa('0x3'));var rp=require(_0x62aa('0x4'));var moment=require(_0x62aa('0x5'));var BPromise=require(_0x62aa('0x6'));var Mustache=require(_0x62aa('0x7'));var util=require(_0x62aa('0x8'));var path=require(_0x62aa('0x9'));var sox=require(_0x62aa('0xa'));var csv=require(_0x62aa('0xb'));var ejs=require(_0x62aa('0xc'));var fs=require('fs');var _=require(_0x62aa('0xd'));var squel=require(_0x62aa('0xe'));var crypto=require(_0x62aa('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x62aa('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x62aa('0x11'));var Redis=require(_0x62aa('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x62aa('0x13'));var as=require(_0x62aa('0x14'));var hardwareService=require(_0x62aa('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x62aa('0x16'));var db=require(_0x62aa('0x17'))['db'];function respondWithStatusCode(_0x521ba2,_0x23de4b){_0x23de4b=_0x23de4b||0xcc;return function(_0x2fa330){if(_0x2fa330){return _0x521ba2['sendStatus'](_0x23de4b);}return _0x521ba2[_0x62aa('0x18')](_0x23de4b)['end']();};}function respondWithResult(_0x36f8b2,_0x5a56aa){_0x5a56aa=_0x5a56aa||0xc8;return function(_0x186274){if(_0x186274){return _0x36f8b2['status'](_0x5a56aa)[_0x62aa('0x19')](_0x186274);}};}function respondWithFilteredResult(_0x4b7a53,_0x4d3756){return function(_0x3826b7){if(_0x3826b7){var _0xcc2d71=_0x3826b7['count'],_0x52468a=_0x4d3756['offset'],_0x7f5b99=_0x4d3756[_0x62aa('0x1a')]+_0x4d3756[_0x62aa('0x1b')],_0x1ca1ad;if(_0x7f5b99>=_0xcc2d71){_0x7f5b99=_0xcc2d71;_0x1ca1ad=0xc8;}else{_0x1ca1ad=0xce;}_0x4b7a53[_0x62aa('0x18')](_0x1ca1ad);return _0x4b7a53[_0x62aa('0x1c')]('Content-Range',_0x52468a+'-'+_0x7f5b99+'/'+_0xcc2d71)[_0x62aa('0x19')](_0x3826b7);}return null;};}function patchUpdates(_0x58016a){return function(_0x4ef5d2){try{jsonpatch['apply'](_0x4ef5d2,_0x58016a,!![]);}catch(_0x590424){return BPromise[_0x62aa('0x1d')](_0x590424);}return _0x4ef5d2[_0x62aa('0x1e')]();};}function saveUpdates(_0x2c3a88,_0x2b657f){return function(_0x3e4d22){if(_0x3e4d22){return _0x3e4d22[_0x62aa('0x1f')](_0x2c3a88)[_0x62aa('0x20')](function(_0x19cb98){return _0x19cb98;});}return null;};}function removeEntity(_0x1e641d,_0x2d920f){return function(_0x104eea){if(_0x104eea){return _0x104eea[_0x62aa('0x21')]()[_0x62aa('0x20')](function(){_0x1e641d[_0x62aa('0x18')](0xcc)[_0x62aa('0x22')]();});}};}function handleEntityNotFound(_0x20fbb,_0x20a238){return function(_0x3b9fb4){if(!_0x3b9fb4){_0x20fbb['sendStatus'](0x194);}return _0x3b9fb4;};}function handleError(_0x4ce3c8,_0x1d2585){_0x1d2585=_0x1d2585||0x1f4;return function(_0x5ddc03){logger[_0x62aa('0x23')](_0x5ddc03['stack']);if(_0x5ddc03[_0x62aa('0x24')]){delete _0x5ddc03[_0x62aa('0x24')];}_0x4ce3c8[_0x62aa('0x18')](_0x1d2585)[_0x62aa('0x25')](_0x5ddc03);};}exports['index']=function(_0x150990,_0x3882b8){var _0x418530={},_0x228491={},_0x149cf6={'count':0x0,'rows':[]};var _0x27580e=_[_0x62aa('0x26')](db[_0x62aa('0x27')][_0x62aa('0x28')],function(_0x3b9431){return{'name':_0x3b9431['fieldName'],'type':_0x3b9431[_0x62aa('0x29')][_0x62aa('0x2a')]};});_0x228491[_0x62aa('0x2b')]=_[_0x62aa('0x26')](_0x27580e,_0x62aa('0x24'));_0x228491[_0x62aa('0x2c')]=_[_0x62aa('0x2d')](_0x150990[_0x62aa('0x2c')]);_0x228491[_0x62aa('0x2e')]=_['intersection'](_0x228491[_0x62aa('0x2b')],_0x228491['query']);_0x418530[_0x62aa('0x2f')]=_['intersection'](_0x228491['model'],qs[_0x62aa('0x30')](_0x150990['query'][_0x62aa('0x30')]));_0x418530[_0x62aa('0x2f')]=_0x418530['attributes']['length']?_0x418530[_0x62aa('0x2f')]:_0x228491[_0x62aa('0x2b')];if(!_0x150990[_0x62aa('0x2c')][_0x62aa('0x31')](_0x62aa('0x32'))){_0x418530[_0x62aa('0x1b')]=qs[_0x62aa('0x1b')](_0x150990['query'][_0x62aa('0x1b')]);_0x418530[_0x62aa('0x1a')]=qs[_0x62aa('0x1a')](_0x150990['query']['offset']);}_0x418530[_0x62aa('0x33')]=qs[_0x62aa('0x34')](_0x150990[_0x62aa('0x2c')][_0x62aa('0x34')]);_0x418530['where']=qs[_0x62aa('0x2e')](_[_0x62aa('0x35')](_0x150990[_0x62aa('0x2c')],_0x228491['filters']));if(_0x150990[_0x62aa('0x2c')][_0x62aa('0x36')]){_0x418530[_0x62aa('0x37')]=_[_0x62aa('0x38')](_0x418530[_0x62aa('0x37')],{'$or':_[_0x62aa('0x26')](_0x27580e,function(_0x5d1a89){if(_0x5d1a89[_0x62aa('0x29')]!=='VIRTUAL'){var _0x524a2e={};_0x524a2e[_0x5d1a89[_0x62aa('0x24')]]={'$like':'%'+_0x150990['query'][_0x62aa('0x36')]+'%'};return _0x524a2e;}})});}_0x418530=_[_0x62aa('0x38')]({},_0x418530,_0x150990[_0x62aa('0x39')]);var _0x57ebdd={'where':_0x418530[_0x62aa('0x37')]};return db['FaxQueueReport']['count'](_0x57ebdd)[_0x62aa('0x20')](function(_0x1547de){_0x149cf6[_0x62aa('0x3a')]=_0x1547de;if(_0x150990[_0x62aa('0x2c')][_0x62aa('0x3b')]){_0x418530[_0x62aa('0x3c')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x62aa('0x3d')](_0x418530);})['then'](function(_0x50edb0){_0x149cf6['rows']=_0x50edb0;return _0x149cf6;})['then'](respondWithFilteredResult(_0x3882b8,_0x418530))[_0x62aa('0x3e')](handleError(_0x3882b8,null));};exports[_0x62aa('0x3f')]=function(_0x490d4a,_0x2da885){var _0x168a31={'raw':!![],'where':{'id':_0x490d4a[_0x62aa('0x40')]['id']}},_0x2e90c3={};_0x2e90c3[_0x62aa('0x2b')]=_[_0x62aa('0x2d')](db[_0x62aa('0x27')][_0x62aa('0x28')]);_0x2e90c3['query']=_[_0x62aa('0x2d')](_0x490d4a[_0x62aa('0x2c')]);_0x2e90c3[_0x62aa('0x2e')]=_['intersection'](_0x2e90c3[_0x62aa('0x2b')],_0x2e90c3[_0x62aa('0x2c')]);_0x168a31[_0x62aa('0x2f')]=_[_0x62aa('0x41')](_0x2e90c3['model'],qs['fields'](_0x490d4a[_0x62aa('0x2c')]['fields']));_0x168a31[_0x62aa('0x2f')]=_0x168a31[_0x62aa('0x2f')][_0x62aa('0x42')]?_0x168a31[_0x62aa('0x2f')]:_0x2e90c3[_0x62aa('0x2b')];if(_0x490d4a[_0x62aa('0x2c')][_0x62aa('0x3b')]){_0x168a31[_0x62aa('0x3c')]=[{'all':!![]}];}_0x168a31=_[_0x62aa('0x38')]({},_0x168a31,_0x490d4a[_0x62aa('0x39')]);return db['FaxQueueReport'][_0x62aa('0x43')](_0x168a31)[_0x62aa('0x20')](handleEntityNotFound(_0x2da885,null))[_0x62aa('0x20')](respondWithResult(_0x2da885,null))['catch'](handleError(_0x2da885,null));};exports[_0x62aa('0x44')]=function(_0x62e66e,_0x5c8ce2){return db['FaxQueueReport'][_0x62aa('0x44')](_0x62e66e[_0x62aa('0x45')],{})['then'](respondWithResult(_0x5c8ce2,0xc9))[_0x62aa('0x3e')](handleError(_0x5c8ce2,null));};exports[_0x62aa('0x1f')]=function(_0x4841df,_0x54c034){if(_0x4841df[_0x62aa('0x45')]['id']){delete _0x4841df[_0x62aa('0x45')]['id'];}return db['FaxQueueReport'][_0x62aa('0x43')]({'where':{'id':_0x4841df[_0x62aa('0x40')]['id']}})[_0x62aa('0x20')](handleEntityNotFound(_0x54c034,null))[_0x62aa('0x20')](saveUpdates(_0x4841df[_0x62aa('0x45')],null))[_0x62aa('0x20')](respondWithResult(_0x54c034,null))[_0x62aa('0x3e')](handleError(_0x54c034,null));};exports[_0x62aa('0x21')]=function(_0x536ee2,_0x434919){return db[_0x62aa('0x27')][_0x62aa('0x43')]({'where':{'id':_0x536ee2['params']['id']}})[_0x62aa('0x20')](handleEntityNotFound(_0x434919,null))['then'](removeEntity(_0x434919,null))[_0x62aa('0x3e')](handleError(_0x434919,null));};exports[_0x62aa('0x46')]=function(_0x302d97,_0x26e64f){return db[_0x62aa('0x27')][_0x62aa('0x46')]()[_0x62aa('0x20')](respondWithResult(_0x26e64f,null))[_0x62aa('0x3e')](handleError(_0x26e64f,null));}; \ No newline at end of file +var _0x244b=['count','includeAll','include','findAll','catch','params','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0xad40f5,_0x245f13){var _0x236292=function(_0x8a6086){while(--_0x8a6086){_0xad40f5['push'](_0xad40f5['shift']());}};_0x236292(++_0x245f13);}(_0x244b,0x1b5));var _0xb244=function(_0x58203c,_0x4a7d09){_0x58203c=_0x58203c-0x0;var _0x5f1013=_0x244b[_0x58203c];return _0x5f1013;};'use strict';var pdf=require(_0xb244('0x0'));var emlformat=require(_0xb244('0x1'));var rimraf=require(_0xb244('0x2'));var zipdir=require(_0xb244('0x3'));var jsonpatch=require(_0xb244('0x4'));var rp=require(_0xb244('0x5'));var moment=require(_0xb244('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb244('0x7'));var util=require(_0xb244('0x8'));var path=require(_0xb244('0x9'));var sox=require('sox');var csv=require(_0xb244('0xa'));var ejs=require(_0xb244('0xb'));var fs=require('fs');var _=require(_0xb244('0xc'));var squel=require('squel');var crypto=require(_0xb244('0xd'));var jsforce=require(_0xb244('0xe'));var deskjs=require(_0xb244('0xf'));var toCsv=require(_0xb244('0xa'));var querystring=require(_0xb244('0x10'));var Papa=require(_0xb244('0x11'));var Redis=require('ioredis');var authService=require(_0xb244('0x12'));var qs=require(_0xb244('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb244('0x14'));var utils=require(_0xb244('0x15'));var config=require(_0xb244('0x16'));var db=require(_0xb244('0x17'))['db'];function respondWithStatusCode(_0x35fde7,_0x32dc9b){_0x32dc9b=_0x32dc9b||0xcc;return function(_0xa827eb){if(_0xa827eb){return _0x35fde7[_0xb244('0x18')](_0x32dc9b);}return _0x35fde7[_0xb244('0x19')](_0x32dc9b)[_0xb244('0x1a')]();};}function respondWithResult(_0x22bc55,_0x2ff56a){_0x2ff56a=_0x2ff56a||0xc8;return function(_0x125dae){if(_0x125dae){return _0x22bc55['status'](_0x2ff56a)[_0xb244('0x1b')](_0x125dae);}};}function respondWithFilteredResult(_0x4d2f2a,_0x2fff21){return function(_0x30c4e2){if(_0x30c4e2){var _0x259fb5=_0x30c4e2['count'],_0x26888b=_0x2fff21[_0xb244('0x1c')],_0x4e9d5f=_0x2fff21['offset']+_0x2fff21[_0xb244('0x1d')],_0x500b37;if(_0x4e9d5f>=_0x259fb5){_0x4e9d5f=_0x259fb5;_0x500b37=0xc8;}else{_0x500b37=0xce;}_0x4d2f2a[_0xb244('0x19')](_0x500b37);return _0x4d2f2a['set'](_0xb244('0x1e'),_0x26888b+'-'+_0x4e9d5f+'/'+_0x259fb5)[_0xb244('0x1b')](_0x30c4e2);}return null;};}function patchUpdates(_0x5b8cda){return function(_0x480552){try{jsonpatch[_0xb244('0x1f')](_0x480552,_0x5b8cda,!![]);}catch(_0x4cd786){return BPromise[_0xb244('0x20')](_0x4cd786);}return _0x480552[_0xb244('0x21')]();};}function saveUpdates(_0x721ced,_0x26e48a){return function(_0x45d68d){if(_0x45d68d){return _0x45d68d[_0xb244('0x22')](_0x721ced)[_0xb244('0x23')](function(_0x1c909d){return _0x1c909d;});}return null;};}function removeEntity(_0x3da3a0,_0x38a289){return function(_0x308b6e){if(_0x308b6e){return _0x308b6e['destroy']()[_0xb244('0x23')](function(){_0x3da3a0[_0xb244('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d89a1,_0xfe8794){return function(_0x3a93bc){if(!_0x3a93bc){_0x3d89a1[_0xb244('0x18')](0x194);}return _0x3a93bc;};}function handleError(_0xcbe2e7,_0x493452){_0x493452=_0x493452||0x1f4;return function(_0x43e0d1){logger[_0xb244('0x24')](_0x43e0d1[_0xb244('0x25')]);if(_0x43e0d1[_0xb244('0x26')]){delete _0x43e0d1['name'];}_0xcbe2e7[_0xb244('0x19')](_0x493452)['send'](_0x43e0d1);};}exports[_0xb244('0x27')]=function(_0x8c3101,_0x203146){var _0x353c28={},_0x2a0270={},_0x41322a={'count':0x0,'rows':[]};var _0x3da086=_[_0xb244('0x28')](db[_0xb244('0x29')][_0xb244('0x2a')],function(_0x169ce5){return{'name':_0x169ce5[_0xb244('0x2b')],'type':_0x169ce5[_0xb244('0x2c')]['key']};});_0x2a0270[_0xb244('0x2d')]=_[_0xb244('0x28')](_0x3da086,_0xb244('0x26'));_0x2a0270[_0xb244('0x2e')]=_[_0xb244('0x2f')](_0x8c3101['query']);_0x2a0270[_0xb244('0x30')]=_['intersection'](_0x2a0270[_0xb244('0x2d')],_0x2a0270[_0xb244('0x2e')]);_0x353c28[_0xb244('0x31')]=_['intersection'](_0x2a0270[_0xb244('0x2d')],qs['fields'](_0x8c3101['query'][_0xb244('0x32')]));_0x353c28[_0xb244('0x31')]=_0x353c28[_0xb244('0x31')][_0xb244('0x33')]?_0x353c28[_0xb244('0x31')]:_0x2a0270[_0xb244('0x2d')];if(!_0x8c3101[_0xb244('0x2e')]['hasOwnProperty'](_0xb244('0x34'))){_0x353c28[_0xb244('0x1d')]=qs['limit'](_0x8c3101[_0xb244('0x2e')]['limit']);_0x353c28[_0xb244('0x1c')]=qs[_0xb244('0x1c')](_0x8c3101['query']['offset']);}_0x353c28['order']=qs[_0xb244('0x35')](_0x8c3101[_0xb244('0x2e')][_0xb244('0x35')]);_0x353c28[_0xb244('0x36')]=qs[_0xb244('0x30')](_[_0xb244('0x37')](_0x8c3101[_0xb244('0x2e')],_0x2a0270[_0xb244('0x30')]));if(_0x8c3101[_0xb244('0x2e')][_0xb244('0x38')]){_0x353c28['where']=_[_0xb244('0x39')](_0x353c28[_0xb244('0x36')],{'$or':_[_0xb244('0x28')](_0x3da086,function(_0x1379b8){if(_0x1379b8[_0xb244('0x2c')]!==_0xb244('0x3a')){var _0xc8c431={};_0xc8c431[_0x1379b8[_0xb244('0x26')]]={'$like':'%'+_0x8c3101[_0xb244('0x2e')][_0xb244('0x38')]+'%'};return _0xc8c431;}})});}_0x353c28=_[_0xb244('0x39')]({},_0x353c28,_0x8c3101[_0xb244('0x3b')]);var _0x2a458c={'where':_0x353c28[_0xb244('0x36')]};return db['FaxQueueReport'][_0xb244('0x3c')](_0x2a458c)[_0xb244('0x23')](function(_0x481526){_0x41322a[_0xb244('0x3c')]=_0x481526;if(_0x8c3101[_0xb244('0x2e')][_0xb244('0x3d')]){_0x353c28[_0xb244('0x3e')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xb244('0x3f')](_0x353c28);})[_0xb244('0x23')](function(_0x29d83a){_0x41322a['rows']=_0x29d83a;return _0x41322a;})[_0xb244('0x23')](respondWithFilteredResult(_0x203146,_0x353c28))[_0xb244('0x40')](handleError(_0x203146,null));};exports['show']=function(_0x2d2619,_0x3193d6){var _0x49a046={'raw':!![],'where':{'id':_0x2d2619[_0xb244('0x41')]['id']}},_0x28b2d2={};_0x28b2d2['model']=_[_0xb244('0x2f')](db[_0xb244('0x29')][_0xb244('0x2a')]);_0x28b2d2[_0xb244('0x2e')]=_[_0xb244('0x2f')](_0x2d2619[_0xb244('0x2e')]);_0x28b2d2[_0xb244('0x30')]=_['intersection'](_0x28b2d2[_0xb244('0x2d')],_0x28b2d2[_0xb244('0x2e')]);_0x49a046[_0xb244('0x31')]=_['intersection'](_0x28b2d2[_0xb244('0x2d')],qs[_0xb244('0x32')](_0x2d2619[_0xb244('0x2e')][_0xb244('0x32')]));_0x49a046[_0xb244('0x31')]=_0x49a046[_0xb244('0x31')][_0xb244('0x33')]?_0x49a046[_0xb244('0x31')]:_0x28b2d2['model'];if(_0x2d2619['query'][_0xb244('0x3d')]){_0x49a046[_0xb244('0x3e')]=[{'all':!![]}];}_0x49a046=_[_0xb244('0x39')]({},_0x49a046,_0x2d2619['options']);return db[_0xb244('0x29')][_0xb244('0x42')](_0x49a046)[_0xb244('0x23')](handleEntityNotFound(_0x3193d6,null))[_0xb244('0x23')](respondWithResult(_0x3193d6,null))[_0xb244('0x40')](handleError(_0x3193d6,null));};exports[_0xb244('0x43')]=function(_0x46cd8a,_0xdc7753){return db[_0xb244('0x29')]['create'](_0x46cd8a[_0xb244('0x44')],{})[_0xb244('0x23')](respondWithResult(_0xdc7753,0xc9))[_0xb244('0x40')](handleError(_0xdc7753,null));};exports['update']=function(_0xbf713f,_0x4557c7){if(_0xbf713f['body']['id']){delete _0xbf713f[_0xb244('0x44')]['id'];}return db['FaxQueueReport'][_0xb244('0x42')]({'where':{'id':_0xbf713f[_0xb244('0x41')]['id']}})[_0xb244('0x23')](handleEntityNotFound(_0x4557c7,null))['then'](saveUpdates(_0xbf713f[_0xb244('0x44')],null))['then'](respondWithResult(_0x4557c7,null))['catch'](handleError(_0x4557c7,null));};exports[_0xb244('0x45')]=function(_0x6e86ff,_0x24c048){return db[_0xb244('0x29')][_0xb244('0x42')]({'where':{'id':_0x6e86ff['params']['id']}})['then'](handleEntityNotFound(_0x24c048,null))['then'](removeEntity(_0x24c048,null))[_0xb244('0x40')](handleError(_0x24c048,null));};exports[_0xb244('0x46')]=function(_0x57410f,_0x509305){return db[_0xb244('0x29')][_0xb244('0x46')]()[_0xb244('0x23')](respondWithResult(_0x509305,null))[_0xb244('0x40')](handleError(_0x509305,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 457fca1..f9d5317 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 _0x6e42=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x3cf617,_0x343fb1){var _0x51b7ef=function(_0x5a9444){while(--_0x5a9444){_0x3cf617['push'](_0x3cf617['shift']());}};_0x51b7ef(++_0x343fb1);}(_0x6e42,0x14c));var _0x26e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6e42[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x26e4('0x0'));var util=require('util');var logger=require(_0x26e4('0x1'))(_0x26e4('0x2'));var moment=require(_0x26e4('0x3'));var BPromise=require(_0x26e4('0x4'));var rp=require(_0x26e4('0x5'));var fs=require('fs');var path=require(_0x26e4('0x6'));var rimraf=require(_0x26e4('0x7'));var config=require(_0x26e4('0x8'));var attributes=require('./faxQueueReport.attributes');module[_0x26e4('0x9')]=function(_0xdf5435,_0x1ac7e1){return _0xdf5435[_0x26e4('0xa')](_0x26e4('0xb'),attributes,{'tableName':_0x26e4('0xc'),'paranoid':![],'indexes':[{'name':_0x26e4('0xd'),'fields':[_0x26e4('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4686=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util'];(function(_0x1ef2c9,_0x472b87){var _0x3c4257=function(_0x2320e5){while(--_0x2320e5){_0x1ef2c9['push'](_0x1ef2c9['shift']());}};_0x3c4257(++_0x472b87);}(_0x4686,0x1e8));var _0x6468=function(_0x2c9e15,_0x3ff2f2){_0x2c9e15=_0x2c9e15-0x0;var _0x90e2d4=_0x4686[_0x2c9e15];return _0x90e2d4;};'use strict';var _=require(_0x6468('0x0'));var util=require(_0x6468('0x1'));var logger=require(_0x6468('0x2'))('api');var moment=require(_0x6468('0x3'));var BPromise=require(_0x6468('0x4'));var rp=require(_0x6468('0x5'));var fs=require('fs');var path=require(_0x6468('0x6'));var rimraf=require(_0x6468('0x7'));var config=require(_0x6468('0x8'));var attributes=require(_0x6468('0x9'));module[_0x6468('0xa')]=function(_0x33ca1e,_0x4e9dd2){return _0x33ca1e['define'](_0x6468('0xb'),attributes,{'tableName':_0x6468('0xc'),'paranoid':![],'indexes':[{'name':_0x6468('0xd'),'fields':[_0x6468('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 190ebcf..d832b8f 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 _0x22a5=['catch','CreateFaxQueueReport','create','options','FaxQueueReport','update','body','limit','UpdateFaxQueueReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3e0248,_0x990363){var _0x127971=function(_0x4c2907){while(--_0x4c2907){_0x3e0248['push'](_0x3e0248['shift']());}};_0x127971(++_0x990363);}(_0x22a5,0x1ad));var _0x522a=function(_0x460551,_0x3c4155){_0x460551=_0x460551-0x0;var _0x20a144=_0x22a5[_0x460551];return _0x20a144;};'use strict';var _=require(_0x522a('0x0'));var util=require('util');var moment=require(_0x522a('0x1'));var BPromise=require('bluebird');var rs=require(_0x522a('0x2'));var fs=require('fs');var Redis=require(_0x522a('0x3'));var db=require(_0x522a('0x4'))['db'];var utils=require(_0x522a('0x5'));var logger=require('../../config/logger')(_0x522a('0x6'));var config=require('../../config/environment');var jayson=require(_0x522a('0x7'));var client=jayson['client'][_0x522a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x173007,_0x1a2c7a,_0x1b8b7b){return new BPromise(function(_0x4955b4,_0x35c03f){return client[_0x522a('0x9')](_0x173007,_0x1b8b7b)[_0x522a('0xa')](function(_0x5d793a){logger[_0x522a('0xb')](_0x522a('0xc'),_0x1a2c7a,_0x522a('0xd'));logger[_0x522a('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1a2c7a,_0x522a('0xd'),JSON[_0x522a('0xf')](_0x5d793a));if(_0x5d793a[_0x522a('0x10')]){if(_0x5d793a['error'][_0x522a('0x11')]===0x1f4){logger[_0x522a('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x1a2c7a,_0x5d793a['error']['message']);return _0x35c03f(_0x5d793a['error'][_0x522a('0x12')]);}logger[_0x522a('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x1a2c7a,_0x5d793a[_0x522a('0x10')][_0x522a('0x12')]);return _0x4955b4(_0x5d793a['error'][_0x522a('0x12')]);}else{logger[_0x522a('0xb')](_0x522a('0xc'),_0x1a2c7a,_0x522a('0xd'));_0x4955b4(_0x5d793a['result'][_0x522a('0x12')]);}})[_0x522a('0x13')](function(_0x4d0b3c){logger[_0x522a('0x10')](_0x522a('0xc'),_0x1a2c7a,_0x4d0b3c);_0x35c03f(_0x4d0b3c);});});}exports[_0x522a('0x14')]=function(_0x289fa8){var _0x4989d3=this;return new Promise(function(_0xe8a021,_0x3e1228){return db['FaxQueueReport'][_0x522a('0x15')](_0x289fa8['body'],{'raw':_0x289fa8[_0x522a('0x16')]?_0x289fa8[_0x522a('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x522a('0xa')](function(_0x2d0ea7){logger[_0x522a('0xb')](_0x522a('0x14'),_0x289fa8);logger[_0x522a('0xe')](_0x522a('0x14'),_0x289fa8,JSON[_0x522a('0xf')](_0x2d0ea7));_0xe8a021(_0x2d0ea7);})[_0x522a('0x13')](function(_0x208adb){logger[_0x522a('0x10')](_0x522a('0x14'),_0x208adb[_0x522a('0x12')],_0x289fa8);_0x3e1228(_0x4989d3['error'](0x1f4,_0x208adb['message']));});});};exports['UpdateFaxQueueReport']=function(_0x98ad6e){var _0x39383d=this;return new Promise(function(_0x4b5179,_0x27039c){return db[_0x522a('0x17')][_0x522a('0x18')](_0x98ad6e[_0x522a('0x19')],{'raw':_0x98ad6e['options']?_0x98ad6e[_0x522a('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x98ad6e[_0x522a('0x16')]?_0x98ad6e[_0x522a('0x16')]['where']||null:null,'attributes':_0x98ad6e[_0x522a('0x16')]?_0x98ad6e[_0x522a('0x16')]['attributes']||null:null,'limit':_0x98ad6e['options']?_0x98ad6e[_0x522a('0x16')][_0x522a('0x1a')]||null:null})[_0x522a('0xa')](function(_0x309fff){logger[_0x522a('0xb')](_0x522a('0x1b'),_0x98ad6e);logger[_0x522a('0xe')](_0x522a('0x1b'),_0x98ad6e,JSON[_0x522a('0xf')](_0x309fff));_0x4b5179(_0x309fff);})[_0x522a('0x13')](function(_0x4080e4){logger[_0x522a('0x10')]('UpdateFaxQueueReport',_0x4080e4['message'],_0x98ad6e);_0x27039c(_0x39383d[_0x522a('0x10')](0x1f4,_0x4080e4['message']));});});}; \ No newline at end of file +var _0x0d42=['request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateFaxQueueReport','create','body','options','raw','debug','stringify','catch','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4c97d8,_0x3baab4){var _0xf4e6e=function(_0x12ac40){while(--_0x12ac40){_0x4c97d8['push'](_0x4c97d8['shift']());}};_0xf4e6e(++_0x3baab4);}(_0x0d42,0x198));var _0x20d4=function(_0x229532,_0x1c0e67){_0x229532=_0x229532-0x0;var _0x598c8a=_0x0d42[_0x229532];return _0x598c8a;};'use strict';var _=require(_0x20d4('0x0'));var util=require(_0x20d4('0x1'));var moment=require(_0x20d4('0x2'));var BPromise=require(_0x20d4('0x3'));var rs=require(_0x20d4('0x4'));var fs=require('fs');var Redis=require(_0x20d4('0x5'));var db=require(_0x20d4('0x6'))['db'];var utils=require(_0x20d4('0x7'));var logger=require(_0x20d4('0x8'))('rpc');var config=require(_0x20d4('0x9'));var jayson=require(_0x20d4('0xa'));var client=jayson[_0x20d4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4137c2,_0x2263ed,_0x182b06){return new BPromise(function(_0x1c7f16,_0xcd648e){return client[_0x20d4('0xc')](_0x4137c2,_0x182b06)[_0x20d4('0xd')](function(_0x4f82dd){logger[_0x20d4('0xe')](_0x20d4('0xf'),_0x2263ed,_0x20d4('0x10'));logger['debug'](_0x20d4('0x11'),_0x2263ed,_0x20d4('0x10'),JSON['stringify'](_0x4f82dd));if(_0x4f82dd[_0x20d4('0x12')]){if(_0x4f82dd[_0x20d4('0x12')][_0x20d4('0x13')]===0x1f4){logger[_0x20d4('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x2263ed,_0x4f82dd[_0x20d4('0x12')][_0x20d4('0x14')]);return _0xcd648e(_0x4f82dd[_0x20d4('0x12')]['message']);}logger[_0x20d4('0x12')](_0x20d4('0xf'),_0x2263ed,_0x4f82dd[_0x20d4('0x12')][_0x20d4('0x14')]);return _0x1c7f16(_0x4f82dd[_0x20d4('0x12')][_0x20d4('0x14')]);}else{logger[_0x20d4('0xe')](_0x20d4('0xf'),_0x2263ed,_0x20d4('0x10'));_0x1c7f16(_0x4f82dd['result']['message']);}})['catch'](function(_0x5ced83){logger[_0x20d4('0x12')](_0x20d4('0xf'),_0x2263ed,_0x5ced83);_0xcd648e(_0x5ced83);});});}exports[_0x20d4('0x15')]=function(_0x32fd5a){var _0x3165ba=this;return new Promise(function(_0x524275,_0x2a8492){return db['FaxQueueReport'][_0x20d4('0x16')](_0x32fd5a[_0x20d4('0x17')],{'raw':_0x32fd5a[_0x20d4('0x18')]?_0x32fd5a[_0x20d4('0x18')][_0x20d4('0x19')]===undefined?!![]:![]:!![]})[_0x20d4('0xd')](function(_0x3dc6db){logger['info'](_0x20d4('0x15'),_0x32fd5a);logger[_0x20d4('0x1a')](_0x20d4('0x15'),_0x32fd5a,JSON[_0x20d4('0x1b')](_0x3dc6db));_0x524275(_0x3dc6db);})[_0x20d4('0x1c')](function(_0xf8b6aa){logger[_0x20d4('0x12')](_0x20d4('0x15'),_0xf8b6aa[_0x20d4('0x14')],_0x32fd5a);_0x2a8492(_0x3165ba['error'](0x1f4,_0xf8b6aa[_0x20d4('0x14')]));});});};exports[_0x20d4('0x1d')]=function(_0xce5a7a){var _0x412e9e=this;return new Promise(function(_0x51cb45,_0x5a6bf0){return db[_0x20d4('0x1e')][_0x20d4('0x1f')](_0xce5a7a[_0x20d4('0x17')],{'raw':_0xce5a7a[_0x20d4('0x18')]?_0xce5a7a[_0x20d4('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xce5a7a[_0x20d4('0x18')]?_0xce5a7a['options'][_0x20d4('0x20')]||null:null,'attributes':_0xce5a7a[_0x20d4('0x18')]?_0xce5a7a[_0x20d4('0x18')][_0x20d4('0x21')]||null:null,'limit':_0xce5a7a[_0x20d4('0x18')]?_0xce5a7a[_0x20d4('0x18')][_0x20d4('0x22')]||null:null})[_0x20d4('0xd')](function(_0x5d12eb){logger[_0x20d4('0xe')](_0x20d4('0x1d'),_0xce5a7a);logger[_0x20d4('0x1a')]('UpdateFaxQueueReport',_0xce5a7a,JSON['stringify'](_0x5d12eb));_0x51cb45(_0x5d12eb);})[_0x20d4('0x1c')](function(_0x302231){logger[_0x20d4('0x12')](_0x20d4('0x1d'),_0x302231['message'],_0xce5a7a);_0x5a6bf0(_0x412e9e[_0x20d4('0x12')](0x1f4,_0x302231[_0x20d4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 5c96e8c..8635d1c 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 _0x7f07=['/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated'];(function(_0xf7e28,_0x45a637){var _0x2497c8=function(_0x5aa52e){while(--_0x5aa52e){_0xf7e28['push'](_0xf7e28['shift']());}};_0x2497c8(++_0x45a637);}(_0x7f07,0x99));var _0x77f0=function(_0x5ec453,_0x30b0ba){_0x5ec453=_0x5ec453-0x0;var _0x25548f=_0x7f07[_0x5ec453];return _0x25548f;};'use strict';var multer=require(_0x77f0('0x0'));var util=require(_0x77f0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x77f0('0x2'));var router=express[_0x77f0('0x3')]();var auth=require(_0x77f0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77f0('0x5'));var controller=require(_0x77f0('0x6'));router[_0x77f0('0x7')]('/',auth[_0x77f0('0x8')](),controller['index']);router['get'](_0x77f0('0x9'),auth[_0x77f0('0x8')](),controller[_0x77f0('0xa')]);router[_0x77f0('0x7')](_0x77f0('0xb'),auth[_0x77f0('0x8')](),controller['show']);router[_0x77f0('0xc')]('/',auth[_0x77f0('0x8')](),controller[_0x77f0('0xd')]);router[_0x77f0('0xe')]('/:id',auth[_0x77f0('0x8')](),controller['update']);router[_0x77f0('0xf')](_0x77f0('0xb'),auth['isAuthenticated'](),controller[_0x77f0('0x10')]);module[_0x77f0('0x11')]=router; \ No newline at end of file +var _0x02bf=['show','post','create','put','update','/:id','destroy','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe'];(function(_0x5d00ff,_0x42e04b){var _0x5700bf=function(_0x24930e){while(--_0x24930e){_0x5d00ff['push'](_0x5d00ff['shift']());}};_0x5700bf(++_0x42e04b);}(_0x02bf,0x1ca));var _0xf02b=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x02bf[_0x5bd4f6];return _0x33a165;};'use strict';var multer=require(_0xf02b('0x0'));var util=require('util');var path=require(_0xf02b('0x1'));var timeout=require('connect-timeout');var express=require(_0xf02b('0x2'));var router=express[_0xf02b('0x3')]();var auth=require(_0xf02b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf02b('0x5'));var controller=require(_0xf02b('0x6'));router[_0xf02b('0x7')]('/',auth[_0xf02b('0x8')](),controller['index']);router['get'](_0xf02b('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xf02b('0x7')]('/:id',auth[_0xf02b('0x8')](),controller[_0xf02b('0xa')]);router[_0xf02b('0xb')]('/',auth['isAuthenticated'](),controller[_0xf02b('0xc')]);router[_0xf02b('0xd')]('/:id',auth[_0xf02b('0x8')](),controller[_0xf02b('0xe')]);router['delete'](_0xf02b('0xf'),auth[_0xf02b('0x8')](),controller[_0xf02b('0x10')]);module[_0xf02b('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 94a609c..f45c065 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 _0xbabf=['agent','queue','NOW','moment','exports','STRING','ENUM','account'];(function(_0x1beeba,_0x5a9bd7){var _0x66112c=function(_0x3f41e9){while(--_0x3f41e9){_0x1beeba['push'](_0x1beeba['shift']());}};_0x66112c(++_0x5a9bd7);}(_0xbabf,0x14b));var _0xfbab=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xbabf[_0x55abd9];return _0x3e5669;};'use strict';var moment=require(_0xfbab('0x0'));var Sequelize=require('sequelize');module[_0xfbab('0x1')]={'uniqueid':{'type':Sequelize[_0xfbab('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xfbab('0x3')](_0xfbab('0x4'),_0xfbab('0x5'),'queue'),'allowNull':![],'defaultValue':_0xfbab('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xfbab('0x7')]}}; \ No newline at end of file +var _0x6b04=['queue','moment','exports','STRING','ENUM','account','agent'];(function(_0x3474bb,_0x216281){var _0x5db28e=function(_0x36db70){while(--_0x36db70){_0x3474bb['push'](_0x3474bb['shift']());}};_0x5db28e(++_0x216281);}(_0x6b04,0xcc));var _0x46b0=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6b04[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x46b0('0x0'));var Sequelize=require('sequelize');module[_0x46b0('0x1')]={'uniqueid':{'type':Sequelize[_0x46b0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x46b0('0x3')](_0x46b0('0x4'),_0x46b0('0x5'),_0x46b0('0x6')),'allowNull':![],'defaultValue':_0x46b0('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index d5d723b..83968f5 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 _0x03f5=['stack','name','index','FaxTransferReport','fieldName','key','map','keys','filters','intersection','model','fields','query','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','find','params','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','then'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x03f5,0xb2));var _0x503f=function(_0x2daf49,_0x131e8a){_0x2daf49=_0x2daf49-0x0;var _0x67085d=_0x03f5[_0x2daf49];return _0x67085d;};'use strict';var pdf=require(_0x503f('0x0'));var emlformat=require(_0x503f('0x1'));var rimraf=require(_0x503f('0x2'));var zipdir=require(_0x503f('0x3'));var jsonpatch=require(_0x503f('0x4'));var rp=require('request-promise');var moment=require(_0x503f('0x5'));var BPromise=require(_0x503f('0x6'));var Mustache=require(_0x503f('0x7'));var util=require(_0x503f('0x8'));var path=require('path');var sox=require(_0x503f('0x9'));var csv=require(_0x503f('0xa'));var ejs=require(_0x503f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x503f('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x503f('0xa'));var querystring=require(_0x503f('0xd'));var Papa=require(_0x503f('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x503f('0xf'));var as=require(_0x503f('0x10'));var hardwareService=require(_0x503f('0x11'));var logger=require('../../config/logger')(_0x503f('0x12'));var utils=require('../../config/utils');var config=require(_0x503f('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3af385,_0xa840b9){_0xa840b9=_0xa840b9||0xcc;return function(_0x12b1f2){if(_0x12b1f2){return _0x3af385[_0x503f('0x14')](_0xa840b9);}return _0x3af385[_0x503f('0x15')](_0xa840b9)[_0x503f('0x16')]();};}function respondWithResult(_0x128c5d,_0xbee938){_0xbee938=_0xbee938||0xc8;return function(_0x419b94){if(_0x419b94){return _0x128c5d[_0x503f('0x15')](_0xbee938)['json'](_0x419b94);}};}function respondWithFilteredResult(_0x49dd06,_0x5dfe40){return function(_0x3ce597){if(_0x3ce597){var _0x5d2404=_0x3ce597[_0x503f('0x17')],_0x46588d=_0x5dfe40[_0x503f('0x18')],_0x4bbca6=_0x5dfe40[_0x503f('0x18')]+_0x5dfe40['limit'],_0xab87ad;if(_0x4bbca6>=_0x5d2404){_0x4bbca6=_0x5d2404;_0xab87ad=0xc8;}else{_0xab87ad=0xce;}_0x49dd06['status'](_0xab87ad);return _0x49dd06[_0x503f('0x19')](_0x503f('0x1a'),_0x46588d+'-'+_0x4bbca6+'/'+_0x5d2404)[_0x503f('0x1b')](_0x3ce597);}return null;};}function patchUpdates(_0x8d82a7){return function(_0x2cdc7c){try{jsonpatch[_0x503f('0x1c')](_0x2cdc7c,_0x8d82a7,!![]);}catch(_0x524eb6){return BPromise[_0x503f('0x1d')](_0x524eb6);}return _0x2cdc7c[_0x503f('0x1e')]();};}function saveUpdates(_0x243b30,_0x382f84){return function(_0x49d416){if(_0x49d416){return _0x49d416['update'](_0x243b30)['then'](function(_0x52b966){return _0x52b966;});}return null;};}function removeEntity(_0x16d905,_0x1deb5b){return function(_0x36d1df){if(_0x36d1df){return _0x36d1df['destroy']()[_0x503f('0x1f')](function(){_0x16d905[_0x503f('0x15')](0xcc)[_0x503f('0x16')]();});}};}function handleEntityNotFound(_0x36c2b5,_0x24a226){return function(_0x4b0481){if(!_0x4b0481){_0x36c2b5[_0x503f('0x14')](0x194);}return _0x4b0481;};}function handleError(_0x3a61f5,_0x43343d){_0x43343d=_0x43343d||0x1f4;return function(_0x1109f6){logger['error'](_0x1109f6[_0x503f('0x20')]);if(_0x1109f6[_0x503f('0x21')]){delete _0x1109f6[_0x503f('0x21')];}_0x3a61f5[_0x503f('0x15')](_0x43343d)['send'](_0x1109f6);};}exports[_0x503f('0x22')]=function(_0x4e5558,_0x3689af){var _0x2e059f={},_0x8e4f8f={},_0x58e326={'count':0x0,'rows':[]};var _0x55d1fa=_['map'](db[_0x503f('0x23')]['rawAttributes'],function(_0x39b90f){return{'name':_0x39b90f[_0x503f('0x24')],'type':_0x39b90f['type'][_0x503f('0x25')]};});_0x8e4f8f['model']=_[_0x503f('0x26')](_0x55d1fa,'name');_0x8e4f8f['query']=_[_0x503f('0x27')](_0x4e5558['query']);_0x8e4f8f[_0x503f('0x28')]=_[_0x503f('0x29')](_0x8e4f8f[_0x503f('0x2a')],_0x8e4f8f['query']);_0x2e059f['attributes']=_[_0x503f('0x29')](_0x8e4f8f[_0x503f('0x2a')],qs[_0x503f('0x2b')](_0x4e5558[_0x503f('0x2c')]['fields']));_0x2e059f[_0x503f('0x2d')]=_0x2e059f[_0x503f('0x2d')][_0x503f('0x2e')]?_0x2e059f[_0x503f('0x2d')]:_0x8e4f8f[_0x503f('0x2a')];if(!_0x4e5558[_0x503f('0x2c')][_0x503f('0x2f')](_0x503f('0x30'))){_0x2e059f[_0x503f('0x31')]=qs[_0x503f('0x31')](_0x4e5558['query'][_0x503f('0x31')]);_0x2e059f[_0x503f('0x18')]=qs[_0x503f('0x18')](_0x4e5558['query'][_0x503f('0x18')]);}_0x2e059f[_0x503f('0x32')]=qs[_0x503f('0x33')](_0x4e5558[_0x503f('0x2c')][_0x503f('0x33')]);_0x2e059f[_0x503f('0x34')]=qs[_0x503f('0x28')](_['pick'](_0x4e5558[_0x503f('0x2c')],_0x8e4f8f[_0x503f('0x28')]));if(_0x4e5558[_0x503f('0x2c')][_0x503f('0x35')]){_0x2e059f[_0x503f('0x34')]=_[_0x503f('0x36')](_0x2e059f[_0x503f('0x34')],{'$or':_[_0x503f('0x26')](_0x55d1fa,function(_0x4fe27b){if(_0x4fe27b[_0x503f('0x37')]!==_0x503f('0x38')){var _0x36f823={};_0x36f823[_0x4fe27b['name']]={'$like':'%'+_0x4e5558['query'][_0x503f('0x35')]+'%'};return _0x36f823;}})});}_0x2e059f=_[_0x503f('0x36')]({},_0x2e059f,_0x4e5558[_0x503f('0x39')]);var _0x25903f={'where':_0x2e059f[_0x503f('0x34')]};return db['FaxTransferReport'][_0x503f('0x17')](_0x25903f)[_0x503f('0x1f')](function(_0x4addaf){_0x58e326[_0x503f('0x17')]=_0x4addaf;if(_0x4e5558['query'][_0x503f('0x3a')]){_0x2e059f['include']=[{'all':!![]}];}return db[_0x503f('0x23')][_0x503f('0x3b')](_0x2e059f);})[_0x503f('0x1f')](function(_0x4a53a2){_0x58e326[_0x503f('0x3c')]=_0x4a53a2;return _0x58e326;})[_0x503f('0x1f')](respondWithFilteredResult(_0x3689af,_0x2e059f))[_0x503f('0x3d')](handleError(_0x3689af,null));};exports[_0x503f('0x3e')]=function(_0xfdb8be,_0x409ead){var _0x2be501={'raw':!![],'where':{'id':_0xfdb8be['params']['id']}},_0x3ac74e={};_0x3ac74e[_0x503f('0x2a')]=_[_0x503f('0x27')](db[_0x503f('0x23')]['rawAttributes']);_0x3ac74e['query']=_[_0x503f('0x27')](_0xfdb8be[_0x503f('0x2c')]);_0x3ac74e['filters']=_[_0x503f('0x29')](_0x3ac74e[_0x503f('0x2a')],_0x3ac74e[_0x503f('0x2c')]);_0x2be501[_0x503f('0x2d')]=_[_0x503f('0x29')](_0x3ac74e['model'],qs[_0x503f('0x2b')](_0xfdb8be[_0x503f('0x2c')]['fields']));_0x2be501[_0x503f('0x2d')]=_0x2be501['attributes'][_0x503f('0x2e')]?_0x2be501[_0x503f('0x2d')]:_0x3ac74e['model'];if(_0xfdb8be[_0x503f('0x2c')][_0x503f('0x3a')]){_0x2be501[_0x503f('0x3f')]=[{'all':!![]}];}_0x2be501=_[_0x503f('0x36')]({},_0x2be501,_0xfdb8be[_0x503f('0x39')]);return db[_0x503f('0x23')]['find'](_0x2be501)[_0x503f('0x1f')](handleEntityNotFound(_0x409ead,null))[_0x503f('0x1f')](respondWithResult(_0x409ead,null))[_0x503f('0x3d')](handleError(_0x409ead,null));};exports[_0x503f('0x40')]=function(_0x63b29a,_0x3421bf){return db['FaxTransferReport'][_0x503f('0x40')](_0x63b29a['body'],{})['then'](respondWithResult(_0x3421bf,0xc9))[_0x503f('0x3d')](handleError(_0x3421bf,null));};exports['update']=function(_0x5d899a,_0xe11e7f){if(_0x5d899a[_0x503f('0x41')]['id']){delete _0x5d899a['body']['id'];}return db['FaxTransferReport'][_0x503f('0x42')]({'where':{'id':_0x5d899a[_0x503f('0x43')]['id']}})[_0x503f('0x1f')](handleEntityNotFound(_0xe11e7f,null))[_0x503f('0x1f')](saveUpdates(_0x5d899a[_0x503f('0x41')],null))[_0x503f('0x1f')](respondWithResult(_0xe11e7f,null))[_0x503f('0x3d')](handleError(_0xe11e7f,null));};exports[_0x503f('0x44')]=function(_0x29a778,_0x180bbc){return db[_0x503f('0x23')][_0x503f('0x42')]({'where':{'id':_0x29a778[_0x503f('0x43')]['id']}})['then'](handleEntityNotFound(_0x180bbc,null))['then'](removeEntity(_0x180bbc,null))[_0x503f('0x3d')](handleError(_0x180bbc,null));};exports[_0x503f('0x45')]=function(_0x69b996,_0x516f12){return db[_0x503f('0x23')][_0x503f('0x45')]()['then'](respondWithResult(_0x516f12,null))[_0x503f('0x3d')](handleError(_0x516f12,null));}; \ No newline at end of file +var _0x09aa=['status','count','offset','limit','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','FaxTransferReport','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x5a41b8,_0xfb31e9){var _0x37069f=function(_0xdff7a3){while(--_0xdff7a3){_0x5a41b8['push'](_0x5a41b8['shift']());}};_0x37069f(++_0xfb31e9);}(_0x09aa,0x161));var _0xa09a=function(_0x425b2d,_0x28f8d2){_0x425b2d=_0x425b2d-0x0;var _0x356017=_0x09aa[_0x425b2d];return _0x356017;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa09a('0x0'));var rimraf=require(_0xa09a('0x1'));var zipdir=require(_0xa09a('0x2'));var jsonpatch=require(_0xa09a('0x3'));var rp=require(_0xa09a('0x4'));var moment=require('moment');var BPromise=require(_0xa09a('0x5'));var Mustache=require(_0xa09a('0x6'));var util=require(_0xa09a('0x7'));var path=require(_0xa09a('0x8'));var sox=require(_0xa09a('0x9'));var csv=require(_0xa09a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa09a('0xb'));var squel=require(_0xa09a('0xc'));var crypto=require(_0xa09a('0xd'));var jsforce=require(_0xa09a('0xe'));var deskjs=require(_0xa09a('0xf'));var toCsv=require(_0xa09a('0xa'));var querystring=require(_0xa09a('0x10'));var Papa=require(_0xa09a('0x11'));var Redis=require(_0xa09a('0x12'));var authService=require(_0xa09a('0x13'));var qs=require(_0xa09a('0x14'));var as=require(_0xa09a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa09a('0x16'));var utils=require(_0xa09a('0x17'));var config=require(_0xa09a('0x18'));var db=require(_0xa09a('0x19'))['db'];function respondWithStatusCode(_0x1ffe8d,_0x5b7df2){_0x5b7df2=_0x5b7df2||0xcc;return function(_0xc549fa){if(_0xc549fa){return _0x1ffe8d[_0xa09a('0x1a')](_0x5b7df2);}return _0x1ffe8d[_0xa09a('0x1b')](_0x5b7df2)['end']();};}function respondWithResult(_0x3250dd,_0x1e9ef8){_0x1e9ef8=_0x1e9ef8||0xc8;return function(_0xb6088e){if(_0xb6088e){return _0x3250dd[_0xa09a('0x1b')](_0x1e9ef8)['json'](_0xb6088e);}};}function respondWithFilteredResult(_0x272488,_0x9aa825){return function(_0x46dabb){if(_0x46dabb){var _0x1b7478=_0x46dabb[_0xa09a('0x1c')],_0x46f6b5=_0x9aa825['offset'],_0x3789f5=_0x9aa825[_0xa09a('0x1d')]+_0x9aa825[_0xa09a('0x1e')],_0x3d2db4;if(_0x3789f5>=_0x1b7478){_0x3789f5=_0x1b7478;_0x3d2db4=0xc8;}else{_0x3d2db4=0xce;}_0x272488[_0xa09a('0x1b')](_0x3d2db4);return _0x272488['set'](_0xa09a('0x1f'),_0x46f6b5+'-'+_0x3789f5+'/'+_0x1b7478)['json'](_0x46dabb);}return null;};}function patchUpdates(_0x3948ac){return function(_0x424e2a){try{jsonpatch[_0xa09a('0x20')](_0x424e2a,_0x3948ac,!![]);}catch(_0x4c9253){return BPromise[_0xa09a('0x21')](_0x4c9253);}return _0x424e2a['save']();};}function saveUpdates(_0xaa4d75,_0x8e49e6){return function(_0x1ec475){if(_0x1ec475){return _0x1ec475[_0xa09a('0x22')](_0xaa4d75)['then'](function(_0xe10e5b){return _0xe10e5b;});}return null;};}function removeEntity(_0x36e665,_0x5d3d2){return function(_0x12f609){if(_0x12f609){return _0x12f609['destroy']()[_0xa09a('0x23')](function(){_0x36e665[_0xa09a('0x1b')](0xcc)[_0xa09a('0x24')]();});}};}function handleEntityNotFound(_0xbe9e84,_0x27b507){return function(_0x88d3f9){if(!_0x88d3f9){_0xbe9e84['sendStatus'](0x194);}return _0x88d3f9;};}function handleError(_0x27d177,_0x30393d){_0x30393d=_0x30393d||0x1f4;return function(_0x3c194f){logger[_0xa09a('0x25')](_0x3c194f[_0xa09a('0x26')]);if(_0x3c194f[_0xa09a('0x27')]){delete _0x3c194f['name'];}_0x27d177[_0xa09a('0x1b')](_0x30393d)[_0xa09a('0x28')](_0x3c194f);};}exports[_0xa09a('0x29')]=function(_0x42fccc,_0x2a2834){var _0x331f06={},_0x2db76a={},_0x5e0a69={'count':0x0,'rows':[]};var _0x4f2c14=_['map'](db[_0xa09a('0x2a')]['rawAttributes'],function(_0x2f79ab){return{'name':_0x2f79ab[_0xa09a('0x2b')],'type':_0x2f79ab[_0xa09a('0x2c')]['key']};});_0x2db76a[_0xa09a('0x2d')]=_[_0xa09a('0x2e')](_0x4f2c14,'name');_0x2db76a[_0xa09a('0x2f')]=_[_0xa09a('0x30')](_0x42fccc[_0xa09a('0x2f')]);_0x2db76a['filters']=_[_0xa09a('0x31')](_0x2db76a[_0xa09a('0x2d')],_0x2db76a[_0xa09a('0x2f')]);_0x331f06[_0xa09a('0x32')]=_['intersection'](_0x2db76a[_0xa09a('0x2d')],qs['fields'](_0x42fccc[_0xa09a('0x2f')][_0xa09a('0x33')]));_0x331f06[_0xa09a('0x32')]=_0x331f06['attributes'][_0xa09a('0x34')]?_0x331f06[_0xa09a('0x32')]:_0x2db76a[_0xa09a('0x2d')];if(!_0x42fccc['query'][_0xa09a('0x35')](_0xa09a('0x36'))){_0x331f06[_0xa09a('0x1e')]=qs[_0xa09a('0x1e')](_0x42fccc[_0xa09a('0x2f')]['limit']);_0x331f06['offset']=qs['offset'](_0x42fccc[_0xa09a('0x2f')]['offset']);}_0x331f06[_0xa09a('0x37')]=qs['sort'](_0x42fccc[_0xa09a('0x2f')][_0xa09a('0x38')]);_0x331f06[_0xa09a('0x39')]=qs[_0xa09a('0x3a')](_[_0xa09a('0x3b')](_0x42fccc[_0xa09a('0x2f')],_0x2db76a['filters']));if(_0x42fccc[_0xa09a('0x2f')][_0xa09a('0x3c')]){_0x331f06['where']=_[_0xa09a('0x3d')](_0x331f06[_0xa09a('0x39')],{'$or':_[_0xa09a('0x2e')](_0x4f2c14,function(_0xcd8586){if(_0xcd8586[_0xa09a('0x2c')]!==_0xa09a('0x3e')){var _0xe380e3={};_0xe380e3[_0xcd8586[_0xa09a('0x27')]]={'$like':'%'+_0x42fccc[_0xa09a('0x2f')][_0xa09a('0x3c')]+'%'};return _0xe380e3;}})});}_0x331f06=_[_0xa09a('0x3d')]({},_0x331f06,_0x42fccc[_0xa09a('0x3f')]);var _0x366e01={'where':_0x331f06[_0xa09a('0x39')]};return db[_0xa09a('0x2a')][_0xa09a('0x1c')](_0x366e01)['then'](function(_0x5bec4e){_0x5e0a69[_0xa09a('0x1c')]=_0x5bec4e;if(_0x42fccc[_0xa09a('0x2f')][_0xa09a('0x40')]){_0x331f06[_0xa09a('0x41')]=[{'all':!![]}];}return db[_0xa09a('0x2a')][_0xa09a('0x42')](_0x331f06);})[_0xa09a('0x23')](function(_0x168eac){_0x5e0a69[_0xa09a('0x43')]=_0x168eac;return _0x5e0a69;})['then'](respondWithFilteredResult(_0x2a2834,_0x331f06))[_0xa09a('0x44')](handleError(_0x2a2834,null));};exports[_0xa09a('0x45')]=function(_0x2c37fd,_0xcc7b24){var _0xa8710c={'raw':!![],'where':{'id':_0x2c37fd['params']['id']}},_0x557065={};_0x557065[_0xa09a('0x2d')]=_['keys'](db[_0xa09a('0x2a')]['rawAttributes']);_0x557065[_0xa09a('0x2f')]=_[_0xa09a('0x30')](_0x2c37fd[_0xa09a('0x2f')]);_0x557065['filters']=_[_0xa09a('0x31')](_0x557065[_0xa09a('0x2d')],_0x557065[_0xa09a('0x2f')]);_0xa8710c[_0xa09a('0x32')]=_[_0xa09a('0x31')](_0x557065[_0xa09a('0x2d')],qs[_0xa09a('0x33')](_0x2c37fd[_0xa09a('0x2f')][_0xa09a('0x33')]));_0xa8710c[_0xa09a('0x32')]=_0xa8710c['attributes'][_0xa09a('0x34')]?_0xa8710c['attributes']:_0x557065[_0xa09a('0x2d')];if(_0x2c37fd[_0xa09a('0x2f')][_0xa09a('0x40')]){_0xa8710c['include']=[{'all':!![]}];}_0xa8710c=_['merge']({},_0xa8710c,_0x2c37fd[_0xa09a('0x3f')]);return db['FaxTransferReport'][_0xa09a('0x46')](_0xa8710c)[_0xa09a('0x23')](handleEntityNotFound(_0xcc7b24,null))[_0xa09a('0x23')](respondWithResult(_0xcc7b24,null))[_0xa09a('0x44')](handleError(_0xcc7b24,null));};exports[_0xa09a('0x47')]=function(_0x26146a,_0x16c840){return db[_0xa09a('0x2a')][_0xa09a('0x47')](_0x26146a['body'],{})[_0xa09a('0x23')](respondWithResult(_0x16c840,0xc9))[_0xa09a('0x44')](handleError(_0x16c840,null));};exports[_0xa09a('0x22')]=function(_0x3c2873,_0x5eb5f2){if(_0x3c2873[_0xa09a('0x48')]['id']){delete _0x3c2873['body']['id'];}return db[_0xa09a('0x2a')][_0xa09a('0x46')]({'where':{'id':_0x3c2873[_0xa09a('0x49')]['id']}})['then'](handleEntityNotFound(_0x5eb5f2,null))[_0xa09a('0x23')](saveUpdates(_0x3c2873['body'],null))[_0xa09a('0x23')](respondWithResult(_0x5eb5f2,null))[_0xa09a('0x44')](handleError(_0x5eb5f2,null));};exports[_0xa09a('0x4a')]=function(_0x519f03,_0x570e34){return db[_0xa09a('0x2a')][_0xa09a('0x46')]({'where':{'id':_0x519f03[_0xa09a('0x49')]['id']}})[_0xa09a('0x23')](handleEntityNotFound(_0x570e34,null))[_0xa09a('0x23')](removeEntity(_0x570e34,null))[_0xa09a('0x44')](handleError(_0x570e34,null));};exports[_0xa09a('0x4b')]=function(_0x242fc1,_0x1cd56f){return db['FaxTransferReport'][_0xa09a('0x4b')]()[_0xa09a('0x23')](respondWithResult(_0x1cd56f,null))[_0xa09a('0x44')](handleError(_0x1cd56f,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 5b05d45..45bb235 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 _0xb2df=['path','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','util','api','moment','bluebird'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xb2df,0x8b));var _0xfb2d=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xb2df[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require(_0xfb2d('0x0'));var logger=require('../../config/logger')(_0xfb2d('0x1'));var moment=require(_0xfb2d('0x2'));var BPromise=require(_0xfb2d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb2d('0x4'));var rimraf=require('rimraf');var config=require(_0xfb2d('0x5'));var attributes=require(_0xfb2d('0x6'));module[_0xfb2d('0x7')]=function(_0x22b1f8,_0x2d1dc5){return _0x22b1f8['define'](_0xfb2d('0x8'),attributes,{'tableName':_0xfb2d('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfb2d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x729a=['./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xd2d133,_0x3ffcc0){var _0x45b4e9=function(_0x478390){while(--_0x478390){_0xd2d133['push'](_0xd2d133['shift']());}};_0x45b4e9(++_0x3ffcc0);}(_0x729a,0xf3));var _0xa729=function(_0x33732f,_0x537323){_0x33732f=_0x33732f-0x0;var _0x248736=_0x729a[_0x33732f];return _0x248736;};'use strict';var _=require(_0xa729('0x0'));var util=require(_0xa729('0x1'));var logger=require(_0xa729('0x2'))(_0xa729('0x3'));var moment=require(_0xa729('0x4'));var BPromise=require(_0xa729('0x5'));var rp=require(_0xa729('0x6'));var fs=require('fs');var path=require(_0xa729('0x7'));var rimraf=require('rimraf');var config=require(_0xa729('0x8'));var attributes=require(_0xa729('0x9'));module[_0xa729('0xa')]=function(_0x39917a,_0xd17050){return _0x39917a[_0xa729('0xb')](_0xa729('0xc'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa729('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 61ac224..247ebf5 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 _0x02df=['request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0xf715bc,_0x1df25e){var _0x2fb8ce=function(_0x29d43d){while(--_0x29d43d){_0xf715bc['push'](_0xf715bc['shift']());}};_0x2fb8ce(++_0x1df25e);}(_0x02df,0x13c));var _0xf02d=function(_0x31742b,_0x3efb44){_0x31742b=_0x31742b-0x0;var _0x4041d1=_0x02df[_0x31742b];return _0x4041d1;};'use strict';var _=require(_0xf02d('0x0'));var util=require('util');var moment=require(_0xf02d('0x1'));var BPromise=require('bluebird');var rs=require(_0xf02d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf02d('0x3'))('rpc');var config=require(_0xf02d('0x4'));var jayson=require(_0xf02d('0x5'));var client=jayson['client'][_0xf02d('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x32db92,_0x804202,_0x4ce292){return new BPromise(function(_0x5e013e,_0x853a90){return client[_0xf02d('0x7')](_0x32db92,_0x4ce292)[_0xf02d('0x8')](function(_0xbc0ca){logger[_0xf02d('0x9')](_0xf02d('0xa'),_0x804202,_0xf02d('0xb'));logger[_0xf02d('0xc')](_0xf02d('0xd'),_0x804202,'request\x20sent',JSON[_0xf02d('0xe')](_0xbc0ca));if(_0xbc0ca[_0xf02d('0xf')]){if(_0xbc0ca[_0xf02d('0xf')][_0xf02d('0x10')]===0x1f4){logger[_0xf02d('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x804202,_0xbc0ca[_0xf02d('0xf')][_0xf02d('0x11')]);return _0x853a90(_0xbc0ca[_0xf02d('0xf')]['message']);}logger['error'](_0xf02d('0xa'),_0x804202,_0xbc0ca['error'][_0xf02d('0x11')]);return _0x5e013e(_0xbc0ca[_0xf02d('0xf')][_0xf02d('0x11')]);}else{logger[_0xf02d('0x9')]('FaxTransferReport,\x20%s,\x20%s',_0x804202,_0xf02d('0xb'));_0x5e013e(_0xbc0ca['result']['message']);}})[_0xf02d('0x12')](function(_0x33fece){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x804202,_0x33fece);_0x853a90(_0x33fece);});});} \ No newline at end of file +var _0x8185=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x8185,0xec));var _0x5818=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8185[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var moment=require(_0x5818('0x2'));var BPromise=require(_0x5818('0x3'));var rs=require(_0x5818('0x4'));var fs=require('fs');var Redis=require(_0x5818('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5818('0x6'));var logger=require(_0x5818('0x7'))(_0x5818('0x8'));var config=require('../../config/environment');var jayson=require(_0x5818('0x9'));var client=jayson[_0x5818('0xa')][_0x5818('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f2530,_0x26c7aa,_0x1ae5c6){return new BPromise(function(_0x504a58,_0x24e8fc){return client[_0x5818('0xc')](_0x2f2530,_0x1ae5c6)[_0x5818('0xd')](function(_0x1de557){logger[_0x5818('0xe')](_0x5818('0xf'),_0x26c7aa,_0x5818('0x10'));logger['debug'](_0x5818('0x11'),_0x26c7aa,_0x5818('0x10'),JSON[_0x5818('0x12')](_0x1de557));if(_0x1de557[_0x5818('0x13')]){if(_0x1de557[_0x5818('0x13')][_0x5818('0x14')]===0x1f4){logger[_0x5818('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x26c7aa,_0x1de557[_0x5818('0x13')][_0x5818('0x15')]);return _0x24e8fc(_0x1de557[_0x5818('0x13')]['message']);}logger[_0x5818('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x26c7aa,_0x1de557[_0x5818('0x13')][_0x5818('0x15')]);return _0x504a58(_0x1de557[_0x5818('0x13')][_0x5818('0x15')]);}else{logger[_0x5818('0xe')](_0x5818('0xf'),_0x26c7aa,_0x5818('0x10'));_0x504a58(_0x1de557['result'][_0x5818('0x15')]);}})['catch'](function(_0x1da518){logger['error'](_0x5818('0xf'),_0x26c7aa,_0x1da518);_0x24e8fc(_0x1da518);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index b9508ba..008ae29 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 _0x09de=['put','destroy','exports','multer','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x491468,_0x42f169){var _0x5b8c22=function(_0x407a9b){while(--_0x407a9b){_0x491468['push'](_0x491468['shift']());}};_0x5b8c22(++_0x42f169);}(_0x09de,0x123));var _0xe09d=function(_0x4d6ac0,_0x201628){_0x4d6ac0=_0x4d6ac0-0x0;var _0x5296c4=_0x09de[_0x4d6ac0];return _0x5296c4;};'use strict';var multer=require(_0xe09d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe09d('0x1'));var router=express[_0xe09d('0x2')]();var auth=require(_0xe09d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe09d('0x4'));var controller=require(_0xe09d('0x5'));router[_0xe09d('0x6')]('/',auth[_0xe09d('0x7')](),controller[_0xe09d('0x8')]);router[_0xe09d('0x6')]('/describe',auth[_0xe09d('0x7')](),controller[_0xe09d('0x9')]);router['get'](_0xe09d('0xa'),auth[_0xe09d('0x7')](),controller[_0xe09d('0xb')]);router[_0xe09d('0xc')]('/',auth[_0xe09d('0x7')](),controller['create']);router[_0xe09d('0xd')](_0xe09d('0xa'),auth[_0xe09d('0x7')](),controller['update']);router['delete'](_0xe09d('0xa'),auth['isAuthenticated'](),controller[_0xe09d('0xe')]);module[_0xe09d('0xf')]=router; \ No newline at end of file +var _0x1121=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer','util','path','express'];(function(_0x15fb0b,_0x44b92d){var _0x423f50=function(_0x32b8c5){while(--_0x32b8c5){_0x15fb0b['push'](_0x15fb0b['shift']());}};_0x423f50(++_0x44b92d);}(_0x1121,0xcd));var _0x1112=function(_0x4ef221,_0x16827c){_0x4ef221=_0x4ef221-0x0;var _0x403f5a=_0x1121[_0x4ef221];return _0x403f5a;};'use strict';var multer=require(_0x1112('0x0'));var util=require(_0x1112('0x1'));var path=require(_0x1112('0x2'));var timeout=require('connect-timeout');var express=require(_0x1112('0x3'));var router=express[_0x1112('0x4')]();var auth=require(_0x1112('0x5'));var interaction=require(_0x1112('0x6'));var config=require(_0x1112('0x7'));var controller=require(_0x1112('0x8'));router[_0x1112('0x9')]('/',auth[_0x1112('0xa')](),controller[_0x1112('0xb')]);router[_0x1112('0x9')]('/describe',auth[_0x1112('0xa')](),controller['describe']);router[_0x1112('0x9')](_0x1112('0xc'),auth['isAuthenticated'](),controller[_0x1112('0xd')]);router[_0x1112('0xe')]('/',auth[_0x1112('0xa')](),controller['create']);router[_0x1112('0xf')]('/:id',auth[_0x1112('0xa')](),controller[_0x1112('0x10')]);router[_0x1112('0x11')]('/:id',auth[_0x1112('0xa')](),controller[_0x1112('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 74dbde5..71be8c8 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 _0xc03e=['post','create','addConfiguration','put','update','delete','multer','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x5595f1,_0x37e1fc){var _0xa8f714=function(_0x402126){while(--_0x402126){_0x5595f1['push'](_0x5595f1['shift']());}};_0xa8f714(++_0x37e1fc);}(_0xc03e,0x15a));var _0xec03=function(_0x493dda,_0x1528d3){_0x493dda=_0x493dda-0x0;var _0x31a5a6=_0xc03e[_0x493dda];return _0x31a5a6;};'use strict';var multer=require(_0xec03('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xec03('0x1'));var express=require('express');var router=express[_0xec03('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xec03('0x3'));var config=require(_0xec03('0x4'));var controller=require(_0xec03('0x5'));router[_0xec03('0x6')]('/',auth[_0xec03('0x7')](),controller[_0xec03('0x8')]);router[_0xec03('0x6')](_0xec03('0x9'),auth[_0xec03('0x7')](),controller['show']);router[_0xec03('0x6')](_0xec03('0xa'),auth[_0xec03('0x7')](),controller[_0xec03('0xb')]);router['get'](_0xec03('0xc'),auth[_0xec03('0x7')](),controller[_0xec03('0xd')]);router[_0xec03('0xe')]('/',auth[_0xec03('0x7')](),controller[_0xec03('0xf')]);router[_0xec03('0xe')](_0xec03('0xa'),auth['isAuthenticated'](),controller[_0xec03('0x10')]);router[_0xec03('0x11')](_0xec03('0x9'),auth[_0xec03('0x7')](),controller[_0xec03('0x12')]);router[_0xec03('0x13')](_0xec03('0x9'),auth[_0xec03('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6b8f=['destroy','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','post','addConfiguration','put','delete'];(function(_0x2e249d,_0x41b7e7){var _0x1faa37=function(_0x1422b4){while(--_0x1422b4){_0x2e249d['push'](_0x2e249d['shift']());}};_0x1faa37(++_0x41b7e7);}(_0x6b8f,0x1bc));var _0xf6b8=function(_0x25ab79,_0x1e5d72){_0x25ab79=_0x25ab79-0x0;var _0x2b3469=_0x6b8f[_0x25ab79];return _0x2b3469;};'use strict';var multer=require('multer');var util=require(_0xf6b8('0x0'));var path=require('path');var timeout=require(_0xf6b8('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xf6b8('0x2'));var interaction=require(_0xf6b8('0x3'));var config=require('../../config/environment');var controller=require(_0xf6b8('0x4'));router[_0xf6b8('0x5')]('/',auth[_0xf6b8('0x6')](),controller['index']);router[_0xf6b8('0x5')](_0xf6b8('0x7'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0x8')]);router['get']('/:id/configurations',auth[_0xf6b8('0x6')](),controller['getConfigurations']);router[_0xf6b8('0x5')](_0xf6b8('0x9'),auth[_0xf6b8('0x6')](),controller[_0xf6b8('0xa')]);router[_0xf6b8('0xb')]('/',auth[_0xf6b8('0x6')](),controller['create']);router['post']('/:id/configurations',auth[_0xf6b8('0x6')](),controller[_0xf6b8('0xc')]);router[_0xf6b8('0xd')](_0xf6b8('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xf6b8('0xe')](_0xf6b8('0x7'),auth['isAuthenticated'](),controller[_0xf6b8('0xf')]);module[_0xf6b8('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index b6facb0..13bea17 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 _0x5941=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x18ec86,_0xb357e2){var _0x26d709=function(_0x169a09){while(--_0x169a09){_0x18ec86['push'](_0x18ec86['shift']());}};_0x26d709(++_0xb357e2);}(_0x5941,0xd4));var _0x1594=function(_0x2a93e8,_0x43ac33){_0x2a93e8=_0x2a93e8-0x0;var _0xac8c4d=_0x5941[_0x2a93e8];return _0xac8c4d;};'use strict';var Sequelize=require(_0x1594('0x0'));module[_0x1594('0x1')]={'name':{'type':Sequelize[_0x1594('0x2')]},'description':{'type':Sequelize[_0x1594('0x2')]},'username':{'type':Sequelize[_0x1594('0x2')]},'remoteUri':{'type':Sequelize[_0x1594('0x2')]},'authType':{'type':Sequelize[_0x1594('0x3')](_0x1594('0x4')),'defaultValue':_0x1594('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x1594('0x2')]},'token':{'type':Sequelize[_0x1594('0x2')]},'tokenSecret':{'type':Sequelize[_0x1594('0x2')]},'serverUrl':{'type':Sequelize[_0x1594('0x2')]},'type':{'type':Sequelize[_0x1594('0x3')](_0x1594('0x5'),_0x1594('0x6')),'defaultValue':_0x1594('0x5')}}; \ No newline at end of file +var _0xed67=['integrationTab','newTab','exports','STRING','ENUM','basic'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0xed67,0x1e8));var _0x7ed6=function(_0x1a4a06,_0x36a5c2){_0x1a4a06=_0x1a4a06-0x0;var _0x49ec08=_0xed67[_0x1a4a06];return _0x49ec08;};'use strict';var Sequelize=require('sequelize');module[_0x7ed6('0x0')]={'name':{'type':Sequelize[_0x7ed6('0x1')]},'description':{'type':Sequelize[_0x7ed6('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7ed6('0x1')]},'authType':{'type':Sequelize[_0x7ed6('0x2')]('basic'),'defaultValue':_0x7ed6('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x7ed6('0x1')]},'token':{'type':Sequelize[_0x7ed6('0x1')]},'tokenSecret':{'type':Sequelize[_0x7ed6('0x1')]},'serverUrl':{'type':Sequelize[_0x7ed6('0x1')]},'type':{'type':Sequelize[_0x7ed6('0x2')](_0x7ed6('0x4'),_0x7ed6('0x5')),'defaultValue':_0x7ed6('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 41b7eb5..f9726b9 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 _0x50b0=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../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','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','end','status','count','offset','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','map','DeskAccount','rawAttributes','fieldName','type','key','query','intersection','attributes','fields','length','model','limit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','getConfigurations','findOne','DeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','DeskField','getFields','priority','remoteUri','username','password','consumerSecret','token','slice','substring','GET','%s/custom_fields','application/json','authType','basic','headers','Authorization','format','Basic\x20%s','toString','base64','_embedded','entries','active','label','statusCode','send','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0xc8ffc4,_0x2cea71){var _0x48e8e6=function(_0x3b86bf){while(--_0x3b86bf){_0xc8ffc4['push'](_0xc8ffc4['shift']());}};_0x48e8e6(++_0x2cea71);}(_0x50b0,0x16c));var _0x050b=function(_0x161f85,_0x1b1968){_0x161f85=_0x161f85-0x0;var _0x3f98ad=_0x50b0[_0x161f85];return _0x3f98ad;};'use strict';var pdf=require(_0x050b('0x0'));var emlformat=require(_0x050b('0x1'));var rimraf=require(_0x050b('0x2'));var zipdir=require(_0x050b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x050b('0x4'));var moment=require('moment');var BPromise=require(_0x050b('0x5'));var Mustache=require(_0x050b('0x6'));var util=require(_0x050b('0x7'));var path=require(_0x050b('0x8'));var sox=require(_0x050b('0x9'));var csv=require(_0x050b('0xa'));var ejs=require(_0x050b('0xb'));var fs=require('fs');var _=require(_0x050b('0xc'));var squel=require(_0x050b('0xd'));var crypto=require(_0x050b('0xe'));var jsforce=require(_0x050b('0xf'));var deskjs=require(_0x050b('0x10'));var toCsv=require(_0x050b('0xa'));var querystring=require('querystring');var Papa=require(_0x050b('0x11'));var Redis=require(_0x050b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x050b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x050b('0x14'));var logger=require(_0x050b('0x15'))(_0x050b('0x16'));var utils=require(_0x050b('0x17'));var config=require(_0x050b('0x18'));var db=require(_0x050b('0x19'))['db'];var integrations=require(_0x050b('0x1a'));var jayson=require(_0x050b('0x1b'));var client=jayson[_0x050b('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x42a019,_0x25fbb0,_0x2855de){if(_0x2855de){var _0x26ae98=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x26ae98[_0x050b('0x1d')](_0x25fbb0)){return _0x42a019;}else{throw new db[(_0x050b('0x1e'))][(_0x050b('0x1f'))](_0x050b('0x20'));}}else{return _0x42a019;}}function respondWithRpcPromise(_0x46a1ec,_0x89ec80,_0x14313c,_0x39d257){return new BPromise(function(_0x41d968,_0xa2f614){var _0x25a9be=_0x39d257||client;return _0x25a9be[_0x050b('0x21')](_0x46a1ec,_0x14313c)[_0x050b('0x22')](function(_0xd637b7){logger[_0x050b('0x23')](_0x050b('0x24'),_0x89ec80,_0x050b('0x25'));logger[_0x050b('0x26')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x89ec80,_0x050b('0x25'),JSON[_0x050b('0x27')](_0xd637b7));if(_0xd637b7[_0x050b('0x28')]){if(_0xd637b7['error']['code']===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x89ec80,_0xd637b7[_0x050b('0x28')][_0x050b('0x29')]);return _0xa2f614(_0xd637b7[_0x050b('0x28')][_0x050b('0x29')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x89ec80,_0xd637b7[_0x050b('0x28')]['message']);return _0x41d968(_0xd637b7[_0x050b('0x28')][_0x050b('0x29')]);}else{logger[_0x050b('0x23')](_0x050b('0x24'),_0x89ec80,'request\x20sent');_0x41d968(_0xd637b7[_0x050b('0x2a')][_0x050b('0x29')]);}})[_0x050b('0x2b')](function(_0x33aa01){logger['error'](_0x050b('0x24'),_0x89ec80,_0x33aa01);_0xa2f614(_0x33aa01);});});}function respondWithStatusCode(_0x5e09e7,_0x56cec5){_0x56cec5=_0x56cec5||0xcc;return function(_0x46abe6){if(_0x46abe6){return _0x5e09e7['sendStatus'](_0x56cec5);}return _0x5e09e7['status'](_0x56cec5)[_0x050b('0x2c')]();};}function respondWithResult(_0x3c2bfe,_0x45d725){_0x45d725=_0x45d725||0xc8;return function(_0x353a3c){if(_0x353a3c){return _0x3c2bfe[_0x050b('0x2d')](_0x45d725)['json'](_0x353a3c);}};}function respondWithFilteredResult(_0x102645,_0x3121e9){return function(_0xf472a7){if(_0xf472a7){var _0x28373c=_0xf472a7[_0x050b('0x2e')],_0x205985=_0x3121e9[_0x050b('0x2f')],_0x4131c0=_0x3121e9[_0x050b('0x2f')]+_0x3121e9['limit'],_0x11b0aa;if(_0x4131c0>=_0x28373c){_0x4131c0=_0x28373c;_0x11b0aa=0xc8;}else{_0x11b0aa=0xce;}_0x102645[_0x050b('0x2d')](_0x11b0aa);return _0x102645['set'](_0x050b('0x30'),_0x205985+'-'+_0x4131c0+'/'+_0x28373c)['json'](_0xf472a7);}return null;};}function patchUpdates(_0xbcb6c1){return function(_0x59bd26){try{jsonpatch[_0x050b('0x31')](_0x59bd26,_0xbcb6c1,!![]);}catch(_0x369e71){return BPromise[_0x050b('0x32')](_0x369e71);}return _0x59bd26['save']();};}function saveUpdates(_0x2409c7,_0x4f09d8){return function(_0x46d3d8){if(_0x46d3d8){return _0x46d3d8[_0x050b('0x33')](_0x2409c7)[_0x050b('0x22')](function(_0x11d678){return _0x11d678;});}return null;};}function removeEntity(_0x14df62,_0x3f44b8){return function(_0x163c08){if(_0x163c08){return _0x163c08[_0x050b('0x34')]()[_0x050b('0x22')](function(){_0x14df62[_0x050b('0x2d')](0xcc)[_0x050b('0x2c')]();});}};}function handleEntityNotFound(_0x15e412,_0x32201b){return function(_0x331ac8){if(!_0x331ac8){_0x15e412[_0x050b('0x35')](0x194);}return _0x331ac8;};}function handleError(_0x3388a3,_0x53f6c3){_0x53f6c3=_0x53f6c3||0x1f4;return function(_0x2a9a7b){logger['error'](_0x2a9a7b[_0x050b('0x36')]);if(_0x2a9a7b['name']){delete _0x2a9a7b[_0x050b('0x37')];}_0x3388a3[_0x050b('0x2d')](_0x53f6c3)['send'](_0x2a9a7b);};}exports['index']=function(_0x5060c5,_0x5a892a){var _0x2e6070={},_0x55fd9f={},_0x173d9e={'count':0x0,'rows':[]};var _0x21d493=_[_0x050b('0x38')](db[_0x050b('0x39')][_0x050b('0x3a')],function(_0x681bae){return{'name':_0x681bae[_0x050b('0x3b')],'type':_0x681bae[_0x050b('0x3c')][_0x050b('0x3d')]};});_0x55fd9f['model']=_[_0x050b('0x38')](_0x21d493,_0x050b('0x37'));_0x55fd9f[_0x050b('0x3e')]=_['keys'](_0x5060c5[_0x050b('0x3e')]);_0x55fd9f['filters']=_[_0x050b('0x3f')](_0x55fd9f['model'],_0x55fd9f[_0x050b('0x3e')]);_0x2e6070[_0x050b('0x40')]=_[_0x050b('0x3f')](_0x55fd9f['model'],qs[_0x050b('0x41')](_0x5060c5[_0x050b('0x3e')][_0x050b('0x41')]));_0x2e6070['attributes']=_0x2e6070['attributes'][_0x050b('0x42')]?_0x2e6070[_0x050b('0x40')]:_0x55fd9f[_0x050b('0x43')];if(!_0x5060c5[_0x050b('0x3e')]['hasOwnProperty']('nolimit')){_0x2e6070[_0x050b('0x44')]=qs[_0x050b('0x44')](_0x5060c5['query'][_0x050b('0x44')]);_0x2e6070[_0x050b('0x2f')]=qs['offset'](_0x5060c5[_0x050b('0x3e')]['offset']);}_0x2e6070[_0x050b('0x45')]=qs[_0x050b('0x46')](_0x5060c5['query']['sort']);_0x2e6070[_0x050b('0x47')]=qs[_0x050b('0x48')](_[_0x050b('0x49')](_0x5060c5[_0x050b('0x3e')],_0x55fd9f[_0x050b('0x48')]));if(_0x5060c5[_0x050b('0x3e')]['filter']){_0x2e6070[_0x050b('0x47')]=_[_0x050b('0x4a')](_0x2e6070['where'],{'$or':_['map'](_0x21d493,function(_0x113bd9){if(_0x113bd9['type']!==_0x050b('0x4b')){var _0x51f422={};_0x51f422[_0x113bd9[_0x050b('0x37')]]={'$like':'%'+_0x5060c5['query'][_0x050b('0x4c')]+'%'};return _0x51f422;}})});}_0x2e6070=_[_0x050b('0x4a')]({},_0x2e6070,_0x5060c5[_0x050b('0x4d')]);var _0x2bb827={'where':_0x2e6070[_0x050b('0x47')]};return db[_0x050b('0x39')]['count'](_0x2bb827)['then'](function(_0x2dd44b){_0x173d9e['count']=_0x2dd44b;if(_0x5060c5['query'][_0x050b('0x4e')]){_0x2e6070[_0x050b('0x4f')]=[{'all':!![]}];}return db[_0x050b('0x39')][_0x050b('0x50')](_0x2e6070);})[_0x050b('0x22')](function(_0x4b8ccb){_0x173d9e[_0x050b('0x51')]=_0x4b8ccb;return _0x173d9e;})['then'](respondWithFilteredResult(_0x5a892a,_0x2e6070))[_0x050b('0x2b')](handleError(_0x5a892a,null));};exports[_0x050b('0x52')]=function(_0x478894,_0x17cc92){var _0x4630da={'raw':![],'where':{'id':_0x478894[_0x050b('0x53')]['id']}},_0x395510={};_0x395510['model']=_[_0x050b('0x54')](db['DeskAccount'][_0x050b('0x3a')]);_0x395510[_0x050b('0x3e')]=_[_0x050b('0x54')](_0x478894[_0x050b('0x3e')]);_0x395510[_0x050b('0x48')]=_[_0x050b('0x3f')](_0x395510[_0x050b('0x43')],_0x395510['query']);_0x4630da['attributes']=_['intersection'](_0x395510['model'],qs[_0x050b('0x41')](_0x478894[_0x050b('0x3e')][_0x050b('0x41')]));_0x4630da['attributes']=_0x4630da[_0x050b('0x40')][_0x050b('0x42')]?_0x4630da[_0x050b('0x40')]:_0x395510[_0x050b('0x43')];if(_0x478894[_0x050b('0x3e')]['includeAll']){_0x4630da[_0x050b('0x4f')]=[{'all':!![]}];}_0x4630da=_[_0x050b('0x4a')]({},_0x4630da,_0x478894[_0x050b('0x4d')]);return db[_0x050b('0x39')][_0x050b('0x55')](_0x4630da)[_0x050b('0x22')](handleEntityNotFound(_0x17cc92,null))[_0x050b('0x22')](respondWithResult(_0x17cc92,null))[_0x050b('0x2b')](handleError(_0x17cc92,null));};exports[_0x050b('0x56')]=function(_0xb0cdb4,_0x370c35){return db[_0x050b('0x39')][_0x050b('0x56')](_0xb0cdb4[_0x050b('0x57')],{})['then'](respondWithResult(_0x370c35,0xc9))[_0x050b('0x2b')](handleError(_0x370c35,null));};exports['update']=function(_0xfa7e54,_0x3686b4){if(_0xfa7e54[_0x050b('0x57')]['id']){delete _0xfa7e54[_0x050b('0x57')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0xfa7e54[_0x050b('0x53')]['id']}})[_0x050b('0x22')](handleEntityNotFound(_0x3686b4,null))['then'](saveUpdates(_0xfa7e54['body'],null))[_0x050b('0x22')](respondWithResult(_0x3686b4,null))['catch'](handleError(_0x3686b4,null));};exports[_0x050b('0x34')]=function(_0x13a6d6,_0x40d1fc){return db[_0x050b('0x39')][_0x050b('0x55')]({'where':{'id':_0x13a6d6[_0x050b('0x53')]['id']}})[_0x050b('0x22')](handleEntityNotFound(_0x40d1fc,null))['then'](removeEntity(_0x40d1fc,null))[_0x050b('0x2b')](handleError(_0x40d1fc,null));};exports[_0x050b('0x58')]=function(_0x47f5c8,_0x1cd8bf,_0x3b76bc){var _0x2e42dd={};var _0x5823b2={};var _0x4cedf6;var _0x44c579;return db['DeskAccount'][_0x050b('0x59')]({'where':{'id':_0x47f5c8[_0x050b('0x53')]['id']}})[_0x050b('0x22')](handleEntityNotFound(_0x1cd8bf,null))[_0x050b('0x22')](function(_0x1a1d57){if(_0x1a1d57){_0x4cedf6=_0x1a1d57;_0x5823b2[_0x050b('0x43')]=_[_0x050b('0x54')](db[_0x050b('0x5a')][_0x050b('0x3a')]);_0x5823b2[_0x050b('0x3e')]=_[_0x050b('0x54')](_0x47f5c8['query']);_0x5823b2[_0x050b('0x48')]=_['intersection'](_0x5823b2[_0x050b('0x43')],_0x5823b2[_0x050b('0x3e')]);_0x2e42dd[_0x050b('0x40')]=_[_0x050b('0x3f')](_0x5823b2['model'],qs[_0x050b('0x41')](_0x47f5c8['query'][_0x050b('0x41')]));_0x2e42dd[_0x050b('0x40')]=_0x2e42dd['attributes'][_0x050b('0x42')]?_0x2e42dd[_0x050b('0x40')]:_0x5823b2[_0x050b('0x43')];_0x2e42dd[_0x050b('0x45')]=qs[_0x050b('0x46')](_0x47f5c8[_0x050b('0x3e')][_0x050b('0x46')]);_0x2e42dd[_0x050b('0x47')]=qs['filters'](_[_0x050b('0x49')](_0x47f5c8[_0x050b('0x3e')],_0x5823b2[_0x050b('0x48')]));if(_0x47f5c8['query'][_0x050b('0x4c')]){_0x2e42dd[_0x050b('0x47')]=_[_0x050b('0x4a')](_0x2e42dd[_0x050b('0x47')],{'$or':_[_0x050b('0x38')](_0x2e42dd['attributes'],function(_0x50e4ef){var _0x2e455f={};_0x2e455f[_0x50e4ef]={'$like':'%'+_0x47f5c8[_0x050b('0x3e')][_0x050b('0x4c')]+'%'};return _0x2e455f;})});}_0x2e42dd=_['merge']({},_0x2e42dd,_0x47f5c8['options']);return _0x4cedf6[_0x050b('0x58')](_0x2e42dd);}})[_0x050b('0x22')](function(_0x26dc7f){if(_0x26dc7f){_0x44c579=_0x26dc7f['length'];if(!_0x47f5c8[_0x050b('0x3e')][_0x050b('0x5b')]('nolimit')){_0x2e42dd[_0x050b('0x44')]=qs['limit'](_0x47f5c8['query']['limit']);_0x2e42dd[_0x050b('0x2f')]=qs[_0x050b('0x2f')](_0x47f5c8[_0x050b('0x3e')][_0x050b('0x2f')]);}return _0x4cedf6['getConfigurations'](_0x2e42dd);}})[_0x050b('0x22')](function(_0x478276){if(_0x478276){return _0x478276?{'count':_0x44c579,'rows':_0x478276}:null;}})['then'](respondWithResult(_0x1cd8bf,null))['catch'](handleError(_0x1cd8bf,null));};exports[_0x050b('0x5c')]=function(_0x394618,_0x38fec0,_0x5ebef2){if(_0x394618['body']['id']){delete _0x394618[_0x050b('0x57')]['id'];}return db['DeskAccount'][_0x050b('0x59')]({'where':{'id':_0x394618['params']['id']}})[_0x050b('0x22')](handleEntityNotFound(_0x38fec0,null))[_0x050b('0x22')](function(_0x52da7b){if(_0x52da7b){_0x394618['body'][_0x050b('0x5d')]=_0x52da7b['id'];_0x394618['body'][_0x050b('0x5e')]=integrations[_0x050b('0x5f')](_0x394618['body'][_0x050b('0x60')],_0x394618[_0x050b('0x57')]['type']);_0x394618['body'][_0x050b('0x61')]=integrations['getDescriptions'](_0x394618['body'][_0x050b('0x60')],_0x394618[_0x050b('0x57')][_0x050b('0x3c')]);return db[_0x050b('0x5a')][_0x050b('0x56')](_0x394618['body'],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x050b('0x62')],'as':_0x050b('0x61')}]});}return null;})[_0x050b('0x22')](respondWithResult(_0x38fec0,null))[_0x050b('0x2b')](handleError(_0x38fec0,null));};exports[_0x050b('0x63')]=function(_0x27e2ab,_0xc3cd06,_0x51f53){var _0x55d56d=[{'name':_0x050b('0x64'),'label':_0x050b('0x64'),'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 _0x16b5ab='';return db['DeskAccount'][_0x050b('0x59')]({'where':{'id':_0x27e2ab[_0x050b('0x53')]['id']},'attributes':['id',_0x050b('0x65'),'authType',_0x050b('0x66'),_0x050b('0x67'),'consumerKey',_0x050b('0x68'),_0x050b('0x69'),'tokenSecret']})['then'](handleEntityNotFound(_0xc3cd06,null))['then'](function(_0x149beb){if(_0x149beb){_0x16b5ab=_0x149beb[_0x050b('0x65')];var _0x18cc50=_0x16b5ab[_0x050b('0x6a')](-0x1);if(_0x18cc50==='/'){_0x16b5ab=_0x16b5ab[_0x050b('0x6b')](0x0,_0x16b5ab['lastIndexOf'](_0x18cc50));}var _0x4987f9={'method':_0x050b('0x6c'),'uri':util['format'](_0x050b('0x6d'),_0x16b5ab),'headers':{'Content-Type':_0x050b('0x6e'),'Accept':'application/json'},'json':!![]};if(_0x149beb[_0x050b('0x6f')]===_0x050b('0x70')){_0x4987f9[_0x050b('0x71')][_0x050b('0x72')]=util[_0x050b('0x73')](_0x050b('0x74'),new Buffer(util[_0x050b('0x73')]('%s:%s',_0x149beb[_0x050b('0x66')],_0x149beb[_0x050b('0x67')]))[_0x050b('0x75')](_0x050b('0x76')));}return rp(_0x4987f9)[_0x050b('0x22')](function(_0x5625ca){return _0x55d56d['concat'](_[_0x050b('0x38')](_0x5625ca[_0x050b('0x77')][_0x050b('0x78')],function(_0x3c3364){return{'id':_0x3c3364[_0x050b('0x37')],'name':_0x3c3364[_0x050b('0x37')],'type':_0x3c3364[_0x050b('0x3c')],'active':_0x3c3364[_0x050b('0x79')],'label':_0x3c3364[_0x050b('0x7a')],'custom':!![]};}));});}})[_0x050b('0x22')](function(_0x3b126c){return{'count':_0x3b126c[_0x050b('0x42')],'rows':_0x3b126c};})['then'](respondWithResult(_0xc3cd06,null))['catch'](function(_0xa79f){var _0x17d35a=_0x27e2ab['query'][_0x050b('0x1d')]?0x1f4:_0xa79f[_0x050b('0x7b')]||0x1f4;logger[_0x050b('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x050b('0x63'),_0x17d35a,JSON['stringify'](_0xa79f));delete _0xa79f['name'];if(_0x17d35a===0x191){_0x17d35a=0x190;}_0xc3cd06['status'](_0x17d35a)[_0x050b('0x7c')](_0x27e2ab[_0x050b('0x3e')][_0x050b('0x1d')]?{'message':_0x050b('0x7d'),'statusCode':_0xa79f['statusCode']}:_0xa79f);});}; \ No newline at end of file +var _0x3ad8=['then','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','status','end','offset','set','json','apply','save','update','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','sort','filters','pick','filter','where','VIRTUAL','options','count','includeAll','include','findAll','show','params','DeskAccount','rawAttributes','find','create','body','getConfigurations','findOne','DeskConfiguration','order','merge','AccountId','getSubjects','getDescriptions','channel','DeskField','Subjects','Descriptions','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','substring','%s/custom_fields','application/json','basic','headers','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','getFields','test','statusCode','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request'];(function(_0x479c1b,_0x5a460b){var _0x200e67=function(_0x7b11e7){while(--_0x7b11e7){_0x479c1b['push'](_0x479c1b['shift']());}};_0x200e67(++_0x5a460b);}(_0x3ad8,0x1cb));var _0x83ad=function(_0x49e238,_0x3bf994){_0x49e238=_0x49e238-0x0;var _0x5df396=_0x3ad8[_0x49e238];return _0x5df396;};'use strict';var pdf=require(_0x83ad('0x0'));var emlformat=require(_0x83ad('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x83ad('0x2'));var rp=require(_0x83ad('0x3'));var moment=require(_0x83ad('0x4'));var BPromise=require(_0x83ad('0x5'));var Mustache=require(_0x83ad('0x6'));var util=require(_0x83ad('0x7'));var path=require(_0x83ad('0x8'));var sox=require(_0x83ad('0x9'));var csv=require('to-csv');var ejs=require(_0x83ad('0xa'));var fs=require('fs');var _=require(_0x83ad('0xb'));var squel=require(_0x83ad('0xc'));var crypto=require(_0x83ad('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x83ad('0xe'));var toCsv=require(_0x83ad('0xf'));var querystring=require(_0x83ad('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x83ad('0x11'));var hardwareService=require(_0x83ad('0x12'));var logger=require('../../config/logger')(_0x83ad('0x13'));var utils=require(_0x83ad('0x14'));var config=require('../../config/environment');var db=require(_0x83ad('0x15'))['db'];var integrations=require(_0x83ad('0x16'));var jayson=require(_0x83ad('0x17'));var client=jayson['client'][_0x83ad('0x18')]({'port':0x232a});function checkPasswordPattern(_0x56bb29,_0x1c7712,_0x570aff){if(_0x570aff){var _0x4d645d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4d645d['test'](_0x1c7712)){return _0x56bb29;}else{throw new db[(_0x83ad('0x19'))][(_0x83ad('0x1a'))](_0x83ad('0x1b'));}}else{return _0x56bb29;}}function respondWithRpcPromise(_0x23f03e,_0x4149e3,_0x423a73,_0x1b9361){return new BPromise(function(_0x4fe262,_0x5deaf7){var _0x1420dd=_0x1b9361||client;return _0x1420dd[_0x83ad('0x1c')](_0x23f03e,_0x423a73)[_0x83ad('0x1d')](function(_0x3ab229){logger[_0x83ad('0x1e')](_0x83ad('0x1f'),_0x4149e3,'request\x20sent');logger[_0x83ad('0x20')](_0x83ad('0x21'),_0x4149e3,_0x83ad('0x22'),JSON[_0x83ad('0x23')](_0x3ab229));if(_0x3ab229[_0x83ad('0x24')]){if(_0x3ab229[_0x83ad('0x24')]['code']===0x1f4){logger['error'](_0x83ad('0x1f'),_0x4149e3,_0x3ab229[_0x83ad('0x24')][_0x83ad('0x25')]);return _0x5deaf7(_0x3ab229['error'][_0x83ad('0x25')]);}logger[_0x83ad('0x24')]('DeskAccount,\x20%s,\x20%s',_0x4149e3,_0x3ab229['error']['message']);return _0x4fe262(_0x3ab229[_0x83ad('0x24')][_0x83ad('0x25')]);}else{logger[_0x83ad('0x1e')](_0x83ad('0x1f'),_0x4149e3,_0x83ad('0x22'));_0x4fe262(_0x3ab229['result'][_0x83ad('0x25')]);}})[_0x83ad('0x26')](function(_0x348cad){logger[_0x83ad('0x24')](_0x83ad('0x1f'),_0x4149e3,_0x348cad);_0x5deaf7(_0x348cad);});});}function respondWithStatusCode(_0xf938ab,_0x49e1b0){_0x49e1b0=_0x49e1b0||0xcc;return function(_0x3c3278){if(_0x3c3278){return _0xf938ab['sendStatus'](_0x49e1b0);}return _0xf938ab[_0x83ad('0x27')](_0x49e1b0)[_0x83ad('0x28')]();};}function respondWithResult(_0x4d7102,_0xe54712){_0xe54712=_0xe54712||0xc8;return function(_0xc66ebe){if(_0xc66ebe){return _0x4d7102[_0x83ad('0x27')](_0xe54712)['json'](_0xc66ebe);}};}function respondWithFilteredResult(_0x2826a6,_0x563da2){return function(_0x5d1014){if(_0x5d1014){var _0x9fcbcb=_0x5d1014['count'],_0x30fb28=_0x563da2[_0x83ad('0x29')],_0x5749f1=_0x563da2[_0x83ad('0x29')]+_0x563da2['limit'],_0x43bca3;if(_0x5749f1>=_0x9fcbcb){_0x5749f1=_0x9fcbcb;_0x43bca3=0xc8;}else{_0x43bca3=0xce;}_0x2826a6[_0x83ad('0x27')](_0x43bca3);return _0x2826a6[_0x83ad('0x2a')]('Content-Range',_0x30fb28+'-'+_0x5749f1+'/'+_0x9fcbcb)[_0x83ad('0x2b')](_0x5d1014);}return null;};}function patchUpdates(_0x335d3b){return function(_0x1c86e4){try{jsonpatch[_0x83ad('0x2c')](_0x1c86e4,_0x335d3b,!![]);}catch(_0x15a6d1){return BPromise['reject'](_0x15a6d1);}return _0x1c86e4[_0x83ad('0x2d')]();};}function saveUpdates(_0x34a8de,_0x290dfe){return function(_0x1e47fd){if(_0x1e47fd){return _0x1e47fd[_0x83ad('0x2e')](_0x34a8de)[_0x83ad('0x1d')](function(_0x4f1803){return _0x4f1803;});}return null;};}function removeEntity(_0x3925e0,_0x5ce649){return function(_0x23b43b){if(_0x23b43b){return _0x23b43b[_0x83ad('0x2f')]()['then'](function(){_0x3925e0[_0x83ad('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498c01,_0x1aad62){return function(_0x52ec2b){if(!_0x52ec2b){_0x498c01['sendStatus'](0x194);}return _0x52ec2b;};}function handleError(_0x503988,_0x2b3af0){_0x2b3af0=_0x2b3af0||0x1f4;return function(_0x24ec27){logger[_0x83ad('0x24')](_0x24ec27[_0x83ad('0x30')]);if(_0x24ec27['name']){delete _0x24ec27[_0x83ad('0x31')];}_0x503988[_0x83ad('0x27')](_0x2b3af0)[_0x83ad('0x32')](_0x24ec27);};}exports[_0x83ad('0x33')]=function(_0xce8021,_0x8d995f){var _0x580a6a={},_0x268ff2={},_0x26a325={'count':0x0,'rows':[]};var _0x15263a=_[_0x83ad('0x34')](db['DeskAccount']['rawAttributes'],function(_0x2f7a10){return{'name':_0x2f7a10[_0x83ad('0x35')],'type':_0x2f7a10[_0x83ad('0x36')][_0x83ad('0x37')]};});_0x268ff2[_0x83ad('0x38')]=_['map'](_0x15263a,'name');_0x268ff2[_0x83ad('0x39')]=_[_0x83ad('0x3a')](_0xce8021[_0x83ad('0x39')]);_0x268ff2['filters']=_['intersection'](_0x268ff2[_0x83ad('0x38')],_0x268ff2['query']);_0x580a6a[_0x83ad('0x3b')]=_[_0x83ad('0x3c')](_0x268ff2[_0x83ad('0x38')],qs[_0x83ad('0x3d')](_0xce8021[_0x83ad('0x39')][_0x83ad('0x3d')]));_0x580a6a[_0x83ad('0x3b')]=_0x580a6a[_0x83ad('0x3b')][_0x83ad('0x3e')]?_0x580a6a[_0x83ad('0x3b')]:_0x268ff2[_0x83ad('0x38')];if(!_0xce8021[_0x83ad('0x39')][_0x83ad('0x3f')]('nolimit')){_0x580a6a[_0x83ad('0x40')]=qs[_0x83ad('0x40')](_0xce8021[_0x83ad('0x39')]['limit']);_0x580a6a[_0x83ad('0x29')]=qs[_0x83ad('0x29')](_0xce8021[_0x83ad('0x39')]['offset']);}_0x580a6a['order']=qs['sort'](_0xce8021[_0x83ad('0x39')][_0x83ad('0x41')]);_0x580a6a['where']=qs[_0x83ad('0x42')](_[_0x83ad('0x43')](_0xce8021[_0x83ad('0x39')],_0x268ff2[_0x83ad('0x42')]));if(_0xce8021['query'][_0x83ad('0x44')]){_0x580a6a[_0x83ad('0x45')]=_['merge'](_0x580a6a['where'],{'$or':_[_0x83ad('0x34')](_0x15263a,function(_0x526bef){if(_0x526bef[_0x83ad('0x36')]!==_0x83ad('0x46')){var _0x3e6a82={};_0x3e6a82[_0x526bef[_0x83ad('0x31')]]={'$like':'%'+_0xce8021[_0x83ad('0x39')][_0x83ad('0x44')]+'%'};return _0x3e6a82;}})});}_0x580a6a=_['merge']({},_0x580a6a,_0xce8021[_0x83ad('0x47')]);var _0x25b69e={'where':_0x580a6a[_0x83ad('0x45')]};return db['DeskAccount'][_0x83ad('0x48')](_0x25b69e)[_0x83ad('0x1d')](function(_0x4fdc87){_0x26a325[_0x83ad('0x48')]=_0x4fdc87;if(_0xce8021[_0x83ad('0x39')][_0x83ad('0x49')]){_0x580a6a[_0x83ad('0x4a')]=[{'all':!![]}];}return db['DeskAccount'][_0x83ad('0x4b')](_0x580a6a);})[_0x83ad('0x1d')](function(_0x58c08e){_0x26a325['rows']=_0x58c08e;return _0x26a325;})[_0x83ad('0x1d')](respondWithFilteredResult(_0x8d995f,_0x580a6a))[_0x83ad('0x26')](handleError(_0x8d995f,null));};exports[_0x83ad('0x4c')]=function(_0x2686d8,_0x1b48da){var _0x21b970={'raw':![],'where':{'id':_0x2686d8[_0x83ad('0x4d')]['id']}},_0x386823={};_0x386823[_0x83ad('0x38')]=_[_0x83ad('0x3a')](db[_0x83ad('0x4e')][_0x83ad('0x4f')]);_0x386823[_0x83ad('0x39')]=_[_0x83ad('0x3a')](_0x2686d8['query']);_0x386823[_0x83ad('0x42')]=_[_0x83ad('0x3c')](_0x386823[_0x83ad('0x38')],_0x386823[_0x83ad('0x39')]);_0x21b970[_0x83ad('0x3b')]=_[_0x83ad('0x3c')](_0x386823[_0x83ad('0x38')],qs[_0x83ad('0x3d')](_0x2686d8['query'][_0x83ad('0x3d')]));_0x21b970['attributes']=_0x21b970[_0x83ad('0x3b')][_0x83ad('0x3e')]?_0x21b970[_0x83ad('0x3b')]:_0x386823[_0x83ad('0x38')];if(_0x2686d8[_0x83ad('0x39')]['includeAll']){_0x21b970[_0x83ad('0x4a')]=[{'all':!![]}];}_0x21b970=_['merge']({},_0x21b970,_0x2686d8[_0x83ad('0x47')]);return db[_0x83ad('0x4e')][_0x83ad('0x50')](_0x21b970)[_0x83ad('0x1d')](handleEntityNotFound(_0x1b48da,null))[_0x83ad('0x1d')](respondWithResult(_0x1b48da,null))[_0x83ad('0x26')](handleError(_0x1b48da,null));};exports['create']=function(_0x582c10,_0x2616be){return db['DeskAccount'][_0x83ad('0x51')](_0x582c10['body'],{})[_0x83ad('0x1d')](respondWithResult(_0x2616be,0xc9))[_0x83ad('0x26')](handleError(_0x2616be,null));};exports[_0x83ad('0x2e')]=function(_0x53f7ee,_0x3bc714){if(_0x53f7ee[_0x83ad('0x52')]['id']){delete _0x53f7ee[_0x83ad('0x52')]['id'];}return db[_0x83ad('0x4e')][_0x83ad('0x50')]({'where':{'id':_0x53f7ee[_0x83ad('0x4d')]['id']}})[_0x83ad('0x1d')](handleEntityNotFound(_0x3bc714,null))[_0x83ad('0x1d')](saveUpdates(_0x53f7ee['body'],null))[_0x83ad('0x1d')](respondWithResult(_0x3bc714,null))[_0x83ad('0x26')](handleError(_0x3bc714,null));};exports[_0x83ad('0x2f')]=function(_0x1e4559,_0x29ba33){return db['DeskAccount'][_0x83ad('0x50')]({'where':{'id':_0x1e4559[_0x83ad('0x4d')]['id']}})[_0x83ad('0x1d')](handleEntityNotFound(_0x29ba33,null))[_0x83ad('0x1d')](removeEntity(_0x29ba33,null))['catch'](handleError(_0x29ba33,null));};exports[_0x83ad('0x53')]=function(_0x597f38,_0x23b97,_0x1ccc2b){var _0x38a8e3={};var _0x1d3af3={};var _0x142a6c;var _0x325812;return db[_0x83ad('0x4e')][_0x83ad('0x54')]({'where':{'id':_0x597f38[_0x83ad('0x4d')]['id']}})[_0x83ad('0x1d')](handleEntityNotFound(_0x23b97,null))[_0x83ad('0x1d')](function(_0x36bbdc){if(_0x36bbdc){_0x142a6c=_0x36bbdc;_0x1d3af3[_0x83ad('0x38')]=_[_0x83ad('0x3a')](db[_0x83ad('0x55')][_0x83ad('0x4f')]);_0x1d3af3[_0x83ad('0x39')]=_['keys'](_0x597f38[_0x83ad('0x39')]);_0x1d3af3[_0x83ad('0x42')]=_[_0x83ad('0x3c')](_0x1d3af3[_0x83ad('0x38')],_0x1d3af3[_0x83ad('0x39')]);_0x38a8e3['attributes']=_[_0x83ad('0x3c')](_0x1d3af3['model'],qs[_0x83ad('0x3d')](_0x597f38[_0x83ad('0x39')][_0x83ad('0x3d')]));_0x38a8e3['attributes']=_0x38a8e3['attributes']['length']?_0x38a8e3[_0x83ad('0x3b')]:_0x1d3af3[_0x83ad('0x38')];_0x38a8e3[_0x83ad('0x56')]=qs[_0x83ad('0x41')](_0x597f38[_0x83ad('0x39')]['sort']);_0x38a8e3[_0x83ad('0x45')]=qs[_0x83ad('0x42')](_[_0x83ad('0x43')](_0x597f38['query'],_0x1d3af3[_0x83ad('0x42')]));if(_0x597f38[_0x83ad('0x39')][_0x83ad('0x44')]){_0x38a8e3['where']=_['merge'](_0x38a8e3[_0x83ad('0x45')],{'$or':_['map'](_0x38a8e3[_0x83ad('0x3b')],function(_0xcbc20b){var _0x16e792={};_0x16e792[_0xcbc20b]={'$like':'%'+_0x597f38[_0x83ad('0x39')]['filter']+'%'};return _0x16e792;})});}_0x38a8e3=_[_0x83ad('0x57')]({},_0x38a8e3,_0x597f38['options']);return _0x142a6c['getConfigurations'](_0x38a8e3);}})['then'](function(_0x17dbca){if(_0x17dbca){_0x325812=_0x17dbca['length'];if(!_0x597f38[_0x83ad('0x39')][_0x83ad('0x3f')]('nolimit')){_0x38a8e3[_0x83ad('0x40')]=qs[_0x83ad('0x40')](_0x597f38[_0x83ad('0x39')][_0x83ad('0x40')]);_0x38a8e3[_0x83ad('0x29')]=qs[_0x83ad('0x29')](_0x597f38[_0x83ad('0x39')][_0x83ad('0x29')]);}return _0x142a6c[_0x83ad('0x53')](_0x38a8e3);}})[_0x83ad('0x1d')](function(_0xdc6294){if(_0xdc6294){return _0xdc6294?{'count':_0x325812,'rows':_0xdc6294}:null;}})[_0x83ad('0x1d')](respondWithResult(_0x23b97,null))[_0x83ad('0x26')](handleError(_0x23b97,null));};exports['addConfiguration']=function(_0x1e967b,_0xe771f3,_0x5ea047){if(_0x1e967b[_0x83ad('0x52')]['id']){delete _0x1e967b['body']['id'];}return db[_0x83ad('0x4e')][_0x83ad('0x54')]({'where':{'id':_0x1e967b[_0x83ad('0x4d')]['id']}})['then'](handleEntityNotFound(_0xe771f3,null))[_0x83ad('0x1d')](function(_0x480739){if(_0x480739){_0x1e967b['body'][_0x83ad('0x58')]=_0x480739['id'];_0x1e967b[_0x83ad('0x52')]['Subjects']=integrations[_0x83ad('0x59')](_0x1e967b[_0x83ad('0x52')]['channel'],_0x1e967b[_0x83ad('0x52')]['type']);_0x1e967b[_0x83ad('0x52')]['Descriptions']=integrations[_0x83ad('0x5a')](_0x1e967b['body'][_0x83ad('0x5b')],_0x1e967b[_0x83ad('0x52')][_0x83ad('0x36')]);return db[_0x83ad('0x55')][_0x83ad('0x51')](_0x1e967b['body'],{'include':[{'model':db[_0x83ad('0x5c')],'as':_0x83ad('0x5d')},{'model':db[_0x83ad('0x5c')],'as':_0x83ad('0x5e')}]});}return null;})[_0x83ad('0x1d')](respondWithResult(_0xe771f3,null))[_0x83ad('0x26')](handleError(_0xe771f3,null));};exports['getFields']=function(_0x3b1a3f,_0xd98ee4,_0x1c96a9){var _0x53932c=[{'name':_0x83ad('0x5f'),'label':_0x83ad('0x5f'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x59bdad='';return db[_0x83ad('0x4e')][_0x83ad('0x54')]({'where':{'id':_0x3b1a3f['params']['id']},'attributes':['id',_0x83ad('0x60'),_0x83ad('0x61'),_0x83ad('0x62'),_0x83ad('0x63'),_0x83ad('0x64'),_0x83ad('0x65'),_0x83ad('0x66'),'tokenSecret']})['then'](handleEntityNotFound(_0xd98ee4,null))[_0x83ad('0x1d')](function(_0xb8c650){if(_0xb8c650){_0x59bdad=_0xb8c650['remoteUri'];var _0x38f295=_0x59bdad['slice'](-0x1);if(_0x38f295==='/'){_0x59bdad=_0x59bdad[_0x83ad('0x67')](0x0,_0x59bdad['lastIndexOf'](_0x38f295));}var _0x35a1da={'method':'GET','uri':util['format'](_0x83ad('0x68'),_0x59bdad),'headers':{'Content-Type':_0x83ad('0x69'),'Accept':_0x83ad('0x69')},'json':!![]};if(_0xb8c650['authType']===_0x83ad('0x6a')){_0x35a1da[_0x83ad('0x6b')]['Authorization']=util[_0x83ad('0x6c')](_0x83ad('0x6d'),new Buffer(util[_0x83ad('0x6c')](_0x83ad('0x6e'),_0xb8c650[_0x83ad('0x62')],_0xb8c650['password']))[_0x83ad('0x6f')](_0x83ad('0x70')));}return rp(_0x35a1da)['then'](function(_0x3b0dfa){return _0x53932c[_0x83ad('0x71')](_[_0x83ad('0x34')](_0x3b0dfa[_0x83ad('0x72')][_0x83ad('0x73')],function(_0x376664){return{'id':_0x376664[_0x83ad('0x31')],'name':_0x376664[_0x83ad('0x31')],'type':_0x376664[_0x83ad('0x36')],'active':_0x376664[_0x83ad('0x74')],'label':_0x376664[_0x83ad('0x75')],'custom':!![]};}));});}})['then'](function(_0x5e491b){return{'count':_0x5e491b[_0x83ad('0x3e')],'rows':_0x5e491b};})['then'](respondWithResult(_0xd98ee4,null))[_0x83ad('0x26')](function(_0x54cf86){var _0x1fa538=_0x3b1a3f[_0x83ad('0x39')]['test']?0x1f4:_0x54cf86['statusCode']||0x1f4;logger[_0x83ad('0x24')](_0x83ad('0x76'),_0x83ad('0x77'),_0x1fa538,JSON[_0x83ad('0x23')](_0x54cf86));delete _0x54cf86[_0x83ad('0x31')];if(_0x1fa538===0x191){_0x1fa538=0x190;}_0xd98ee4[_0x83ad('0x27')](_0x1fa538)['send'](_0x3b1a3f['query'][_0x83ad('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x54cf86[_0x83ad('0x79')]}:_0x54cf86);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 225bade..8828571 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 _0xba1a=['moment','rimraf','./intDeskAccount.attributes','define','int_desk_accounts','lodash','util','../../config/logger','api'];(function(_0x1cc986,_0x4f94a0){var _0x251eda=function(_0x524072){while(--_0x524072){_0x1cc986['push'](_0x1cc986['shift']());}};_0x251eda(++_0x4f94a0);}(_0xba1a,0x7a));var _0xaba1=function(_0x2252a5,_0x2be87b){_0x2252a5=_0x2252a5-0x0;var _0x365891=_0xba1a[_0x2252a5];return _0x365891;};'use strict';var _=require(_0xaba1('0x0'));var util=require(_0xaba1('0x1'));var logger=require(_0xaba1('0x2'))(_0xaba1('0x3'));var moment=require(_0xaba1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaba1('0x5'));var config=require('../../config/environment');var attributes=require(_0xaba1('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x776a2c,_0x43c7b6){return _0x776a2c[_0xaba1('0x7')]('DeskAccount',attributes,{'tableName':_0xaba1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f36=['define','DeskAccount','lodash','api','moment','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7f36,0x14c));var _0x67f3=function(_0x2f2614,_0x402b20){_0x2f2614=_0x2f2614-0x0;var _0x42d5da=_0x7f36[_0x2f2614];return _0x42d5da;};'use strict';var _=require(_0x67f3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x67f3('0x1'));var moment=require(_0x67f3('0x2'));var BPromise=require('bluebird');var rp=require(_0x67f3('0x3'));var fs=require('fs');var path=require(_0x67f3('0x4'));var rimraf=require('rimraf');var config=require(_0x67f3('0x5'));var attributes=require(_0x67f3('0x6'));var integrations=require(_0x67f3('0x7'));module[_0x67f3('0x8')]=function(_0x301d77,_0x1752bc){return _0x301d77[_0x67f3('0x9')](_0x67f3('0xa'),attributes,{'tableName':'int_desk_accounts','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 ef72912..f9eaf81 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 _0xd234=['ShowDeskAccount','find','raw','then','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','include','map','model','stringify'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd234,0x1e0));var _0x4d23=function(_0x1fabda,_0x23dfa4){_0x1fabda=_0x1fabda-0x0;var _0x10cf23=_0xd234[_0x1fabda];return _0x10cf23;};'use strict';var _=require(_0x4d23('0x0'));var util=require(_0x4d23('0x1'));var moment=require('moment');var BPromise=require(_0x4d23('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4d23('0x3'));var db=require(_0x4d23('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4d23('0x5'))(_0x4d23('0x6'));var config=require(_0x4d23('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4d23('0x8')][_0x4d23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7be169,_0xbfefd1,_0x3d5a5d){return new BPromise(function(_0x5cda6c,_0x163097){return client['request'](_0x7be169,_0x3d5a5d)['then'](function(_0x52a3de){logger[_0x4d23('0xa')]('DeskAccount,\x20%s,\x20%s',_0xbfefd1,_0x4d23('0xb'));logger[_0x4d23('0xc')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0xbfefd1,_0x4d23('0xb'),JSON['stringify'](_0x52a3de));if(_0x52a3de[_0x4d23('0xd')]){if(_0x52a3de[_0x4d23('0xd')][_0x4d23('0xe')]===0x1f4){logger[_0x4d23('0xd')](_0x4d23('0xf'),_0xbfefd1,_0x52a3de['error'][_0x4d23('0x10')]);return _0x163097(_0x52a3de['error']['message']);}logger['error']('DeskAccount,\x20%s,\x20%s',_0xbfefd1,_0x52a3de[_0x4d23('0xd')][_0x4d23('0x10')]);return _0x5cda6c(_0x52a3de[_0x4d23('0xd')][_0x4d23('0x10')]);}else{logger[_0x4d23('0xa')](_0x4d23('0xf'),_0xbfefd1,_0x4d23('0xb'));_0x5cda6c(_0x52a3de[_0x4d23('0x11')]['message']);}})[_0x4d23('0x12')](function(_0x1d3e28){logger[_0x4d23('0xd')](_0x4d23('0xf'),_0xbfefd1,_0x1d3e28);_0x163097(_0x1d3e28);});});}exports[_0x4d23('0x13')]=function(_0x17e7a3){var _0x188e29=this;return new Promise(function(_0x4f6a07,_0x1933c8){return db[_0x4d23('0x14')][_0x4d23('0x15')]({'raw':_0x17e7a3['options']?_0x17e7a3[_0x4d23('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x17e7a3[_0x4d23('0x16')]?_0x17e7a3['options'][_0x4d23('0x17')]||null:null,'attributes':_0x17e7a3[_0x4d23('0x16')]?_0x17e7a3[_0x4d23('0x16')][_0x4d23('0x18')]||null:null,'limit':_0x17e7a3[_0x4d23('0x16')]?_0x17e7a3[_0x4d23('0x16')][_0x4d23('0x19')]||null:null,'include':_0x17e7a3[_0x4d23('0x16')]?_0x17e7a3['options'][_0x4d23('0x1a')]?_[_0x4d23('0x1b')](_0x17e7a3[_0x4d23('0x16')][_0x4d23('0x1a')],function(_0x54155f){return{'model':db[_0x54155f['model']],'as':_0x54155f['as'],'attributes':_0x54155f[_0x4d23('0x18')],'include':_0x54155f[_0x4d23('0x1a')]?_[_0x4d23('0x1b')](_0x54155f[_0x4d23('0x1a')],function(_0x13074f){return{'model':db[_0x13074f[_0x4d23('0x1c')]],'as':_0x13074f['as'],'attributes':_0x13074f[_0x4d23('0x18')],'include':_0x13074f['include']?_[_0x4d23('0x1b')](_0x13074f[_0x4d23('0x1a')],function(_0x3b4ba8){return{'model':db[_0x3b4ba8[_0x4d23('0x1c')]],'as':_0x3b4ba8['as'],'attributes':_0x3b4ba8[_0x4d23('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ba6d5){logger['info'](_0x4d23('0x13'),_0x17e7a3);logger['debug'](_0x4d23('0x13'),_0x17e7a3,JSON[_0x4d23('0x1d')](_0x2ba6d5));_0x4f6a07(_0x2ba6d5);})[_0x4d23('0x12')](function(_0x19267c){logger[_0x4d23('0xd')](_0x4d23('0x13'),_0x19267c[_0x4d23('0x10')],_0x17e7a3);_0x1933c8(_0x188e29[_0x4d23('0xd')](0x1f4,_0x19267c[_0x4d23('0x10')]));});});};exports[_0x4d23('0x1e')]=function(_0x418653){var _0x38d1f4=this;return new Promise(function(_0x1833a7,_0x376242){return db[_0x4d23('0x14')][_0x4d23('0x1f')]({'raw':_0x418653[_0x4d23('0x16')]?_0x418653[_0x4d23('0x16')][_0x4d23('0x20')]===undefined?!![]:![]:!![],'where':_0x418653[_0x4d23('0x16')]?_0x418653[_0x4d23('0x16')][_0x4d23('0x17')]||null:null,'attributes':_0x418653[_0x4d23('0x16')]?_0x418653[_0x4d23('0x16')][_0x4d23('0x18')]||null:null,'include':_0x418653[_0x4d23('0x16')]?_0x418653[_0x4d23('0x16')][_0x4d23('0x1a')]?_[_0x4d23('0x1b')](_0x418653['options'][_0x4d23('0x1a')],function(_0x31a98c){return{'model':db[_0x31a98c[_0x4d23('0x1c')]],'as':_0x31a98c['as'],'attributes':_0x31a98c[_0x4d23('0x18')],'include':_0x31a98c[_0x4d23('0x1a')]?_['map'](_0x31a98c[_0x4d23('0x1a')],function(_0x33c7d5){return{'model':db[_0x33c7d5[_0x4d23('0x1c')]],'as':_0x33c7d5['as'],'attributes':_0x33c7d5[_0x4d23('0x18')],'include':_0x33c7d5['include']?_[_0x4d23('0x1b')](_0x33c7d5[_0x4d23('0x1a')],function(_0x4b56f7){return{'model':db[_0x4b56f7['model']],'as':_0x4b56f7['as'],'attributes':_0x4b56f7[_0x4d23('0x18')]};}):[]};}):[]};}):[]:[]})[_0x4d23('0x21')](function(_0x16f0e7){logger[_0x4d23('0xa')](_0x4d23('0x1e'),_0x418653);logger[_0x4d23('0xc')](_0x4d23('0x1e'),_0x418653,JSON['stringify'](_0x16f0e7));_0x1833a7(_0x16f0e7);})['catch'](function(_0x270e73){logger['error']('ShowDeskAccount',_0x270e73['message'],_0x418653);_0x376242(_0x38d1f4[_0x4d23('0xd')](0x1f4,_0x270e73[_0x4d23('0x10')]));});});}; \ No newline at end of file +var _0x0153=['../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowDeskAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x131e57,_0x2cf3a1){var _0x362902=function(_0x2d57d7){while(--_0x2d57d7){_0x131e57['push'](_0x131e57['shift']());}};_0x362902(++_0x2cf3a1);}(_0x0153,0x9e));var _0x3015=function(_0x5ee4cc,_0x486993){_0x5ee4cc=_0x5ee4cc-0x0;var _0x56df10=_0x0153[_0x5ee4cc];return _0x56df10;};'use strict';var _=require(_0x3015('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3015('0x1'));var rs=require(_0x3015('0x2'));var fs=require('fs');var Redis=require(_0x3015('0x3'));var db=require(_0x3015('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3015('0x5'))(_0x3015('0x6'));var config=require(_0x3015('0x7'));var jayson=require(_0x3015('0x8'));var client=jayson[_0x3015('0x9')][_0x3015('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b590d,_0x3c6efb,_0x1b5427){return new BPromise(function(_0x5a8694,_0x3e246e){return client[_0x3015('0xb')](_0x4b590d,_0x1b5427)['then'](function(_0x146189){logger[_0x3015('0xc')](_0x3015('0xd'),_0x3c6efb,'request\x20sent');logger[_0x3015('0xe')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3c6efb,_0x3015('0xf'),JSON['stringify'](_0x146189));if(_0x146189[_0x3015('0x10')]){if(_0x146189[_0x3015('0x10')][_0x3015('0x11')]===0x1f4){logger[_0x3015('0x10')]('DeskAccount,\x20%s,\x20%s',_0x3c6efb,_0x146189[_0x3015('0x10')][_0x3015('0x12')]);return _0x3e246e(_0x146189[_0x3015('0x10')][_0x3015('0x12')]);}logger[_0x3015('0x10')]('DeskAccount,\x20%s,\x20%s',_0x3c6efb,_0x146189[_0x3015('0x10')][_0x3015('0x12')]);return _0x5a8694(_0x146189[_0x3015('0x10')][_0x3015('0x12')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x3c6efb,_0x3015('0xf'));_0x5a8694(_0x146189['result'][_0x3015('0x12')]);}})[_0x3015('0x13')](function(_0xc83d27){logger['error'](_0x3015('0xd'),_0x3c6efb,_0xc83d27);_0x3e246e(_0xc83d27);});});}exports[_0x3015('0x14')]=function(_0xca9515){var _0x22a434=this;return new Promise(function(_0x3e7049,_0x54503f){return db[_0x3015('0x15')][_0x3015('0x16')]({'raw':_0xca9515[_0x3015('0x17')]?_0xca9515['options'][_0x3015('0x18')]===undefined?!![]:![]:!![],'where':_0xca9515[_0x3015('0x17')]?_0xca9515[_0x3015('0x17')][_0x3015('0x19')]||null:null,'attributes':_0xca9515[_0x3015('0x17')]?_0xca9515['options']['attributes']||null:null,'limit':_0xca9515['options']?_0xca9515[_0x3015('0x17')][_0x3015('0x1a')]||null:null,'include':_0xca9515[_0x3015('0x17')]?_0xca9515[_0x3015('0x17')][_0x3015('0x1b')]?_[_0x3015('0x1c')](_0xca9515[_0x3015('0x17')][_0x3015('0x1b')],function(_0x4a5d8d){return{'model':db[_0x4a5d8d[_0x3015('0x1d')]],'as':_0x4a5d8d['as'],'attributes':_0x4a5d8d['attributes'],'include':_0x4a5d8d[_0x3015('0x1b')]?_[_0x3015('0x1c')](_0x4a5d8d['include'],function(_0x16eedb){return{'model':db[_0x16eedb[_0x3015('0x1d')]],'as':_0x16eedb['as'],'attributes':_0x16eedb[_0x3015('0x1e')],'include':_0x16eedb[_0x3015('0x1b')]?_['map'](_0x16eedb[_0x3015('0x1b')],function(_0x1a47d6){return{'model':db[_0x1a47d6[_0x3015('0x1d')]],'as':_0x1a47d6['as'],'attributes':_0x1a47d6[_0x3015('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3015('0x1f')](function(_0x5672a5){logger[_0x3015('0xc')](_0x3015('0x14'),_0xca9515);logger['debug'](_0x3015('0x14'),_0xca9515,JSON['stringify'](_0x5672a5));_0x3e7049(_0x5672a5);})[_0x3015('0x13')](function(_0x2ccc82){logger[_0x3015('0x10')](_0x3015('0x14'),_0x2ccc82[_0x3015('0x12')],_0xca9515);_0x54503f(_0x22a434[_0x3015('0x10')](0x1f4,_0x2ccc82[_0x3015('0x12')]));});});};exports[_0x3015('0x20')]=function(_0x2d6479){var _0x4335b6=this;return new Promise(function(_0x5b1b87,_0x4776c2){return db[_0x3015('0x15')]['find']({'raw':_0x2d6479[_0x3015('0x17')]?_0x2d6479[_0x3015('0x17')][_0x3015('0x18')]===undefined?!![]:![]:!![],'where':_0x2d6479[_0x3015('0x17')]?_0x2d6479[_0x3015('0x17')][_0x3015('0x19')]||null:null,'attributes':_0x2d6479[_0x3015('0x17')]?_0x2d6479[_0x3015('0x17')][_0x3015('0x1e')]||null:null,'include':_0x2d6479[_0x3015('0x17')]?_0x2d6479['options']['include']?_[_0x3015('0x1c')](_0x2d6479[_0x3015('0x17')][_0x3015('0x1b')],function(_0x2e6eda){return{'model':db[_0x2e6eda[_0x3015('0x1d')]],'as':_0x2e6eda['as'],'attributes':_0x2e6eda[_0x3015('0x1e')],'include':_0x2e6eda[_0x3015('0x1b')]?_[_0x3015('0x1c')](_0x2e6eda['include'],function(_0x51e636){return{'model':db[_0x51e636[_0x3015('0x1d')]],'as':_0x51e636['as'],'attributes':_0x51e636['attributes'],'include':_0x51e636[_0x3015('0x1b')]?_[_0x3015('0x1c')](_0x51e636[_0x3015('0x1b')],function(_0xe004ba){return{'model':db[_0xe004ba['model']],'as':_0xe004ba['as'],'attributes':_0xe004ba[_0x3015('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3015('0x1f')](function(_0x53ceea){logger[_0x3015('0xc')](_0x3015('0x20'),_0x2d6479);logger[_0x3015('0xe')](_0x3015('0x20'),_0x2d6479,JSON['stringify'](_0x53ceea));_0x5b1b87(_0x53ceea);})['catch'](function(_0x3c8449){logger['error'](_0x3015('0x20'),_0x3c8449[_0x3015('0x12')],_0x2d6479);_0x4776c2(_0x4335b6[_0x3015('0x10')](0x1f4,_0x3c8449['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f4d8f46..a6e9e29 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 _0x78f4=['util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','index','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','/:id','delete','destroy'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x478f('0x0'));var path=require(_0x478f('0x1'));var timeout=require(_0x478f('0x2'));var express=require(_0x478f('0x3'));var router=express['Router']();var auth=require(_0x478f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x478f('0x5'));var controller=require(_0x478f('0x6'));router[_0x478f('0x7')]('/',auth['isAuthenticated'](),controller[_0x478f('0x8')]);router[_0x478f('0x7')]('/:id',auth[_0x478f('0x9')](),controller['show']);router['get'](_0x478f('0xa'),auth['isAuthenticated'](),controller[_0x478f('0xb')]);router[_0x478f('0x7')](_0x478f('0xc'),auth[_0x478f('0x9')](),controller['getSubjects']);router['get'](_0x478f('0xd'),auth[_0x478f('0x9')](),controller[_0x478f('0xe')]);router[_0x478f('0x7')](_0x478f('0xf'),auth[_0x478f('0x9')](),controller[_0x478f('0x10')]);router[_0x478f('0x11')]('/',auth['isAuthenticated'](),controller[_0x478f('0x12')]);router[_0x478f('0x11')](_0x478f('0xf'),auth[_0x478f('0x9')](),controller[_0x478f('0x13')]);router[_0x478f('0x14')](_0x478f('0x15'),auth[_0x478f('0x9')](),controller['update']);router[_0x478f('0x16')](_0x478f('0x15'),auth[_0x478f('0x9')](),controller[_0x478f('0x17')]);module['exports']=router; \ No newline at end of file +var _0x94d4=['index','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x94d4,0xa5));var _0x494d=function(_0x3907c2,_0x18043a){_0x3907c2=_0x3907c2-0x0;var _0x5df1ed=_0x94d4[_0x3907c2];return _0x5df1ed;};'use strict';var multer=require(_0x494d('0x0'));var util=require(_0x494d('0x1'));var path=require('path');var timeout=require(_0x494d('0x2'));var express=require(_0x494d('0x3'));var router=express[_0x494d('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x494d('0x5'));var config=require(_0x494d('0x6'));var controller=require(_0x494d('0x7'));router[_0x494d('0x8')]('/',auth[_0x494d('0x9')](),controller[_0x494d('0xa')]);router[_0x494d('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x494d('0x8')](_0x494d('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x494d('0x8')](_0x494d('0xc'),auth['isAuthenticated'](),controller[_0x494d('0xd')]);router[_0x494d('0x8')](_0x494d('0xe'),auth[_0x494d('0x9')](),controller['getDescriptions']);router[_0x494d('0x8')](_0x494d('0xf'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0x494d('0x9')](),controller[_0x494d('0x10')]);router[_0x494d('0x11')](_0x494d('0xf'),auth[_0x494d('0x9')](),controller[_0x494d('0x12')]);router[_0x494d('0x13')](_0x494d('0x14'),auth[_0x494d('0x9')](),controller[_0x494d('0x15')]);router[_0x494d('0x16')]('/:id',auth[_0x494d('0x9')](),controller[_0x494d('0x17')]);module[_0x494d('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 08fc7d1..cff8e7a 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 _0x3914=['sequelize','exports','STRING'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x3914,0x75));var _0x4391=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0x3914[_0x6f1a87];return _0x2495c7;};'use strict';var Sequelize=require(_0x4391('0x0'));module[_0x4391('0x1')]={'name':{'type':Sequelize[_0x4391('0x2')]},'description':{'type':Sequelize[_0x4391('0x2')]}}; \ No newline at end of file +var _0x4def=['sequelize','exports','STRING'];(function(_0x552865,_0x4e5d35){var _0x534117=function(_0x7d7fa7){while(--_0x7d7fa7){_0x552865['push'](_0x552865['shift']());}};_0x534117(++_0x4e5d35);}(_0x4def,0x90));var _0xf4de=function(_0x16d3c7,_0x82a2c4){_0x16d3c7=_0x16d3c7-0x0;var _0x1f6edc=_0x4def[_0x16d3c7];return _0x1f6edc;};'use strict';var Sequelize=require(_0xf4de('0x0'));module[_0xf4de('0x1')]={'name':{'type':Sequelize[_0xf4de('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index c3e1245..b0f3313 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 _0xc295=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','name','send','index','map','DeskConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','create','body','find','getFields','findOne','DeskField','rawAttributes','order','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis'];(function(_0x4c4797,_0x172f9b){var _0x12a28d=function(_0x3aeb83){while(--_0x3aeb83){_0x4c4797['push'](_0x4c4797['shift']());}};_0x12a28d(++_0x172f9b);}(_0xc295,0x1cb));var _0x5c29=function(_0x5a5dd9,_0x246ba4){_0x5a5dd9=_0x5a5dd9-0x0;var _0x4e7d14=_0xc295[_0x5a5dd9];return _0x4e7d14;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x5c29('0x0'));var zipdir=require(_0x5c29('0x1'));var jsonpatch=require(_0x5c29('0x2'));var rp=require(_0x5c29('0x3'));var moment=require(_0x5c29('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5c29('0x5'));var util=require(_0x5c29('0x6'));var path=require(_0x5c29('0x7'));var sox=require('sox');var csv=require(_0x5c29('0x8'));var ejs=require(_0x5c29('0x9'));var fs=require('fs');var _=require(_0x5c29('0xa'));var squel=require(_0x5c29('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5c29('0xc'));var toCsv=require(_0x5c29('0x8'));var querystring=require(_0x5c29('0xd'));var Papa=require(_0x5c29('0xe'));var Redis=require(_0x5c29('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5c29('0x10'));var as=require(_0x5c29('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c29('0x12'))(_0x5c29('0x13'));var utils=require(_0x5c29('0x14'));var config=require(_0x5c29('0x15'));var db=require(_0x5c29('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x5c29('0x17')][_0x5c29('0x18')]({'port':0x232a});function checkPasswordPattern(_0x460f51,_0x1137d7,_0x43e517){if(_0x43e517){var _0x31addd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x31addd[_0x5c29('0x19')](_0x1137d7)){return _0x460f51;}else{throw new db['Sequelize']['ValidationError'](_0x5c29('0x1a'));}}else{return _0x460f51;}}function respondWithRpcPromise(_0x363b8a,_0x5aa860,_0x539782,_0x50b28c){return new BPromise(function(_0x1770ba,_0x463bf7){var _0x2c6bb2=_0x50b28c||client;return _0x2c6bb2[_0x5c29('0x1b')](_0x363b8a,_0x539782)[_0x5c29('0x1c')](function(_0x5ed75c){logger[_0x5c29('0x1d')]('DeskConfiguration,\x20%s,\x20%s',_0x5aa860,_0x5c29('0x1e'));logger[_0x5c29('0x1f')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5aa860,'request\x20sent',JSON[_0x5c29('0x20')](_0x5ed75c));if(_0x5ed75c['error']){if(_0x5ed75c[_0x5c29('0x21')]['code']===0x1f4){logger[_0x5c29('0x21')](_0x5c29('0x22'),_0x5aa860,_0x5ed75c[_0x5c29('0x21')][_0x5c29('0x23')]);return _0x463bf7(_0x5ed75c[_0x5c29('0x21')][_0x5c29('0x23')]);}logger[_0x5c29('0x21')](_0x5c29('0x22'),_0x5aa860,_0x5ed75c[_0x5c29('0x21')][_0x5c29('0x23')]);return _0x1770ba(_0x5ed75c['error']['message']);}else{logger[_0x5c29('0x1d')](_0x5c29('0x22'),_0x5aa860,_0x5c29('0x1e'));_0x1770ba(_0x5ed75c[_0x5c29('0x24')][_0x5c29('0x23')]);}})[_0x5c29('0x25')](function(_0x4c8ea9){logger[_0x5c29('0x21')](_0x5c29('0x22'),_0x5aa860,_0x4c8ea9);_0x463bf7(_0x4c8ea9);});});}function respondWithStatusCode(_0x19d385,_0x3c1f8c){_0x3c1f8c=_0x3c1f8c||0xcc;return function(_0x3446a6){if(_0x3446a6){return _0x19d385[_0x5c29('0x26')](_0x3c1f8c);}return _0x19d385[_0x5c29('0x27')](_0x3c1f8c)[_0x5c29('0x28')]();};}function respondWithResult(_0x44fc0d,_0x761f73){_0x761f73=_0x761f73||0xc8;return function(_0x529e61){if(_0x529e61){return _0x44fc0d[_0x5c29('0x27')](_0x761f73)[_0x5c29('0x29')](_0x529e61);}};}function respondWithFilteredResult(_0x4c6148,_0xbd77){return function(_0x50a8a7){if(_0x50a8a7){var _0xf65275=_0x50a8a7[_0x5c29('0x2a')],_0x3326b4=_0xbd77['offset'],_0x22c473=_0xbd77[_0x5c29('0x2b')]+_0xbd77[_0x5c29('0x2c')],_0x2118cc;if(_0x22c473>=_0xf65275){_0x22c473=_0xf65275;_0x2118cc=0xc8;}else{_0x2118cc=0xce;}_0x4c6148['status'](_0x2118cc);return _0x4c6148[_0x5c29('0x2d')](_0x5c29('0x2e'),_0x3326b4+'-'+_0x22c473+'/'+_0xf65275)[_0x5c29('0x29')](_0x50a8a7);}return null;};}function patchUpdates(_0x1bd72e){return function(_0x2ec06b){try{jsonpatch[_0x5c29('0x2f')](_0x2ec06b,_0x1bd72e,!![]);}catch(_0x7bdda9){return BPromise[_0x5c29('0x30')](_0x7bdda9);}return _0x2ec06b['save']();};}function saveUpdates(_0x4d59c1,_0x51729d){return function(_0x4a6efe){if(_0x4a6efe){return _0x4a6efe[_0x5c29('0x31')](_0x4d59c1)[_0x5c29('0x1c')](function(_0x451a98){return _0x451a98;});}return null;};}function removeEntity(_0x3342af,_0x1a2fed){return function(_0x5acf79){if(_0x5acf79){return _0x5acf79[_0x5c29('0x32')]()['then'](function(){_0x3342af[_0x5c29('0x27')](0xcc)[_0x5c29('0x28')]();});}};}function handleEntityNotFound(_0x29794a,_0x36bed9){return function(_0x10ddf1){if(!_0x10ddf1){_0x29794a[_0x5c29('0x26')](0x194);}return _0x10ddf1;};}function handleError(_0x5e64d3,_0x4a4f9c){_0x4a4f9c=_0x4a4f9c||0x1f4;return function(_0x74415d){logger['error'](_0x74415d['stack']);if(_0x74415d['name']){delete _0x74415d[_0x5c29('0x33')];}_0x5e64d3[_0x5c29('0x27')](_0x4a4f9c)[_0x5c29('0x34')](_0x74415d);};}exports[_0x5c29('0x35')]=function(_0x10adcd,_0x246143){var _0xd09da1={},_0x3094bd={},_0x3f8f75={'count':0x0,'rows':[]};var _0x797cec=_[_0x5c29('0x36')](db[_0x5c29('0x37')]['rawAttributes'],function(_0x32ad44){return{'name':_0x32ad44[_0x5c29('0x38')],'type':_0x32ad44[_0x5c29('0x39')][_0x5c29('0x3a')]};});_0x3094bd['model']=_['map'](_0x797cec,_0x5c29('0x33'));_0x3094bd[_0x5c29('0x3b')]=_[_0x5c29('0x3c')](_0x10adcd[_0x5c29('0x3b')]);_0x3094bd[_0x5c29('0x3d')]=_[_0x5c29('0x3e')](_0x3094bd[_0x5c29('0x3f')],_0x3094bd[_0x5c29('0x3b')]);_0xd09da1[_0x5c29('0x40')]=_[_0x5c29('0x3e')](_0x3094bd[_0x5c29('0x3f')],qs[_0x5c29('0x41')](_0x10adcd[_0x5c29('0x3b')][_0x5c29('0x41')]));_0xd09da1[_0x5c29('0x40')]=_0xd09da1[_0x5c29('0x40')][_0x5c29('0x42')]?_0xd09da1[_0x5c29('0x40')]:_0x3094bd['model'];if(!_0x10adcd[_0x5c29('0x3b')][_0x5c29('0x43')]('nolimit')){_0xd09da1[_0x5c29('0x2c')]=qs[_0x5c29('0x2c')](_0x10adcd[_0x5c29('0x3b')][_0x5c29('0x2c')]);_0xd09da1['offset']=qs[_0x5c29('0x2b')](_0x10adcd[_0x5c29('0x3b')]['offset']);}_0xd09da1['order']=qs[_0x5c29('0x44')](_0x10adcd['query'][_0x5c29('0x44')]);_0xd09da1[_0x5c29('0x45')]=qs[_0x5c29('0x3d')](_[_0x5c29('0x46')](_0x10adcd['query'],_0x3094bd[_0x5c29('0x3d')]));if(_0x10adcd['query'][_0x5c29('0x47')]){_0xd09da1['where']=_[_0x5c29('0x48')](_0xd09da1['where'],{'$or':_[_0x5c29('0x36')](_0x797cec,function(_0x12f507){if(_0x12f507[_0x5c29('0x39')]!==_0x5c29('0x49')){var _0x2ff0c5={};_0x2ff0c5[_0x12f507[_0x5c29('0x33')]]={'$like':'%'+_0x10adcd['query'][_0x5c29('0x47')]+'%'};return _0x2ff0c5;}})});}_0xd09da1=_['merge']({},_0xd09da1,_0x10adcd[_0x5c29('0x4a')]);var _0x4c4423={'where':_0xd09da1['where']};return db['DeskConfiguration'][_0x5c29('0x2a')](_0x4c4423)['then'](function(_0x1b7e9){_0x3f8f75['count']=_0x1b7e9;if(_0x10adcd[_0x5c29('0x3b')]['includeAll']){_0xd09da1[_0x5c29('0x4b')]=[{'all':!![]}];}return db[_0x5c29('0x37')]['findAll'](_0xd09da1);})[_0x5c29('0x1c')](function(_0x58139a){_0x3f8f75[_0x5c29('0x4c')]=_0x58139a;return _0x3f8f75;})[_0x5c29('0x1c')](respondWithFilteredResult(_0x246143,_0xd09da1))['catch'](handleError(_0x246143,null));};exports[_0x5c29('0x4d')]=function(_0x5c26ed,_0x3eac95){var _0x15fdd5={'raw':![],'where':{'id':_0x5c26ed[_0x5c29('0x4e')]['id']}},_0x1f193f={};_0x1f193f[_0x5c29('0x3f')]=_[_0x5c29('0x3c')](db[_0x5c29('0x37')]['rawAttributes']);_0x1f193f[_0x5c29('0x3b')]=_[_0x5c29('0x3c')](_0x5c26ed[_0x5c29('0x3b')]);_0x1f193f[_0x5c29('0x3d')]=_[_0x5c29('0x3e')](_0x1f193f[_0x5c29('0x3f')],_0x1f193f[_0x5c29('0x3b')]);_0x15fdd5['attributes']=_[_0x5c29('0x3e')](_0x1f193f[_0x5c29('0x3f')],qs[_0x5c29('0x41')](_0x5c26ed[_0x5c29('0x3b')][_0x5c29('0x41')]));_0x15fdd5[_0x5c29('0x40')]=_0x15fdd5[_0x5c29('0x40')][_0x5c29('0x42')]?_0x15fdd5[_0x5c29('0x40')]:_0x1f193f['model'];if(_0x5c26ed['query'][_0x5c29('0x4f')]){_0x15fdd5[_0x5c29('0x4b')]=[{'all':!![]}];}_0x15fdd5=_[_0x5c29('0x48')]({},_0x15fdd5,_0x5c26ed['options']);return db['DeskConfiguration']['find'](_0x15fdd5)[_0x5c29('0x1c')](handleEntityNotFound(_0x3eac95,null))[_0x5c29('0x1c')](respondWithResult(_0x3eac95,null))[_0x5c29('0x25')](handleError(_0x3eac95,null));};exports[_0x5c29('0x50')]=function(_0x104c11,_0x83a5ce){return db['DeskConfiguration'][_0x5c29('0x50')](_0x104c11[_0x5c29('0x51')],{})[_0x5c29('0x1c')](respondWithResult(_0x83a5ce,0xc9))[_0x5c29('0x25')](handleError(_0x83a5ce,null));};exports[_0x5c29('0x31')]=function(_0x515d9f,_0x511953){if(_0x515d9f[_0x5c29('0x51')]['id']){delete _0x515d9f[_0x5c29('0x51')]['id'];}return db[_0x5c29('0x37')]['find']({'where':{'id':_0x515d9f[_0x5c29('0x4e')]['id']}})['then'](handleEntityNotFound(_0x511953,null))[_0x5c29('0x1c')](saveUpdates(_0x515d9f['body'],null))[_0x5c29('0x1c')](respondWithResult(_0x511953,null))[_0x5c29('0x25')](handleError(_0x511953,null));};exports[_0x5c29('0x32')]=function(_0x53bed2,_0x21c94b){return db[_0x5c29('0x37')][_0x5c29('0x52')]({'where':{'id':_0x53bed2[_0x5c29('0x4e')]['id']}})[_0x5c29('0x1c')](handleEntityNotFound(_0x21c94b,null))[_0x5c29('0x1c')](removeEntity(_0x21c94b,null))['catch'](handleError(_0x21c94b,null));};exports[_0x5c29('0x53')]=function(_0x2469e3,_0x5211dc,_0x33eee4){var _0x108c75={};var _0x4a962d={};var _0x708720;var _0x4b6488;return db[_0x5c29('0x37')][_0x5c29('0x54')]({'where':{'id':_0x2469e3[_0x5c29('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5211dc,null))[_0x5c29('0x1c')](function(_0x9080e8){if(_0x9080e8){_0x708720=_0x9080e8;_0x4a962d['model']=_[_0x5c29('0x3c')](db[_0x5c29('0x55')][_0x5c29('0x56')]);_0x4a962d[_0x5c29('0x3b')]=_['keys'](_0x2469e3[_0x5c29('0x3b')]);_0x4a962d[_0x5c29('0x3d')]=_[_0x5c29('0x3e')](_0x4a962d[_0x5c29('0x3f')],_0x4a962d['query']);_0x108c75[_0x5c29('0x40')]=_[_0x5c29('0x3e')](_0x4a962d[_0x5c29('0x3f')],qs[_0x5c29('0x41')](_0x2469e3[_0x5c29('0x3b')]['fields']));_0x108c75[_0x5c29('0x40')]=_0x108c75['attributes'][_0x5c29('0x42')]?_0x108c75['attributes']:_0x4a962d[_0x5c29('0x3f')];_0x108c75[_0x5c29('0x57')]=qs[_0x5c29('0x44')](_0x2469e3[_0x5c29('0x3b')][_0x5c29('0x44')]);_0x108c75[_0x5c29('0x45')]=qs[_0x5c29('0x3d')](_[_0x5c29('0x46')](_0x2469e3[_0x5c29('0x3b')],_0x4a962d[_0x5c29('0x3d')]));if(_0x2469e3[_0x5c29('0x3b')][_0x5c29('0x47')]){_0x108c75['where']=_[_0x5c29('0x48')](_0x108c75[_0x5c29('0x45')],{'$or':_[_0x5c29('0x36')](_0x108c75['attributes'],function(_0x4e94f4){var _0x5dfa89={};_0x5dfa89[_0x4e94f4]={'$like':'%'+_0x2469e3['query'][_0x5c29('0x47')]+'%'};return _0x5dfa89;})});}_0x108c75=_[_0x5c29('0x48')]({},_0x108c75,_0x2469e3[_0x5c29('0x4a')]);return _0x708720['getFields'](_0x108c75);}})[_0x5c29('0x1c')](function(_0x2a379d){if(_0x2a379d){_0x4b6488=_0x2a379d[_0x5c29('0x42')];if(!_0x2469e3[_0x5c29('0x3b')][_0x5c29('0x43')](_0x5c29('0x58'))){_0x108c75[_0x5c29('0x2c')]=qs[_0x5c29('0x2c')](_0x2469e3[_0x5c29('0x3b')][_0x5c29('0x2c')]);_0x108c75[_0x5c29('0x2b')]=qs[_0x5c29('0x2b')](_0x2469e3[_0x5c29('0x3b')][_0x5c29('0x2b')]);}return _0x708720['getFields'](_0x108c75);}})[_0x5c29('0x1c')](function(_0x438ce1){if(_0x438ce1){return _0x438ce1?{'count':_0x4b6488,'rows':_0x438ce1}:null;}})[_0x5c29('0x1c')](respondWithResult(_0x5211dc,null))[_0x5c29('0x25')](handleError(_0x5211dc,null));};exports[_0x5c29('0x59')]=function(_0xa36c97,_0x229362,_0x27dd1a){var _0x227ac3={};var _0xe32d3={};var _0x186897;var _0x2ccd12;return db[_0x5c29('0x37')][_0x5c29('0x54')]({'where':{'id':_0xa36c97[_0x5c29('0x4e')]['id']}})[_0x5c29('0x1c')](handleEntityNotFound(_0x229362,null))[_0x5c29('0x1c')](function(_0x1d9e47){if(_0x1d9e47){_0x186897=_0x1d9e47;_0xe32d3[_0x5c29('0x3f')]=_[_0x5c29('0x3c')](db[_0x5c29('0x55')]['rawAttributes']);_0xe32d3[_0x5c29('0x3b')]=_['keys'](_0xa36c97['query']);_0xe32d3[_0x5c29('0x3d')]=_[_0x5c29('0x3e')](_0xe32d3['model'],_0xe32d3[_0x5c29('0x3b')]);_0x227ac3[_0x5c29('0x40')]=_[_0x5c29('0x3e')](_0xe32d3[_0x5c29('0x3f')],qs['fields'](_0xa36c97['query'][_0x5c29('0x41')]));_0x227ac3['attributes']=_0x227ac3[_0x5c29('0x40')][_0x5c29('0x42')]?_0x227ac3[_0x5c29('0x40')]:_0xe32d3['model'];_0x227ac3[_0x5c29('0x57')]=qs['sort'](_0xa36c97[_0x5c29('0x3b')][_0x5c29('0x44')]);_0x227ac3[_0x5c29('0x45')]=qs[_0x5c29('0x3d')](_[_0x5c29('0x46')](_0xa36c97[_0x5c29('0x3b')],_0xe32d3[_0x5c29('0x3d')]));if(_0xa36c97['query'][_0x5c29('0x47')]){_0x227ac3[_0x5c29('0x45')]=_['merge'](_0x227ac3[_0x5c29('0x45')],{'$or':_[_0x5c29('0x36')](_0x227ac3[_0x5c29('0x40')],function(_0x3ce357){var _0x25a662={};_0x25a662[_0x3ce357]={'$like':'%'+_0xa36c97[_0x5c29('0x3b')][_0x5c29('0x47')]+'%'};return _0x25a662;})});}_0x227ac3=_['merge']({},_0x227ac3,_0xa36c97[_0x5c29('0x4a')]);return _0x186897[_0x5c29('0x59')](_0x227ac3);}})[_0x5c29('0x1c')](function(_0x4132d3){if(_0x4132d3){_0x2ccd12=_0x4132d3[_0x5c29('0x42')];if(!_0xa36c97[_0x5c29('0x3b')][_0x5c29('0x43')](_0x5c29('0x58'))){_0x227ac3[_0x5c29('0x2c')]=qs['limit'](_0xa36c97[_0x5c29('0x3b')][_0x5c29('0x2c')]);_0x227ac3[_0x5c29('0x2b')]=qs[_0x5c29('0x2b')](_0xa36c97[_0x5c29('0x3b')]['offset']);}return _0x186897[_0x5c29('0x59')](_0x227ac3);}})[_0x5c29('0x1c')](function(_0x505204){if(_0x505204){return _0x505204?{'count':_0x2ccd12,'rows':_0x505204}:null;}})[_0x5c29('0x1c')](respondWithResult(_0x229362,null))[_0x5c29('0x25')](handleError(_0x229362,null));};exports[_0x5c29('0x5a')]=function(_0x2ef5c9,_0x139352,_0x1d2b4a){var _0x22cdcd={};var _0x2f9107={};var _0x258758;var _0x22515d;return db[_0x5c29('0x37')]['findOne']({'where':{'id':_0x2ef5c9[_0x5c29('0x4e')]['id']}})[_0x5c29('0x1c')](handleEntityNotFound(_0x139352,null))[_0x5c29('0x1c')](function(_0x4ab598){if(_0x4ab598){_0x258758=_0x4ab598;_0x2f9107[_0x5c29('0x3f')]=_['keys'](db[_0x5c29('0x55')]['rawAttributes']);_0x2f9107[_0x5c29('0x3b')]=_['keys'](_0x2ef5c9[_0x5c29('0x3b')]);_0x2f9107[_0x5c29('0x3d')]=_[_0x5c29('0x3e')](_0x2f9107[_0x5c29('0x3f')],_0x2f9107[_0x5c29('0x3b')]);_0x22cdcd[_0x5c29('0x40')]=_[_0x5c29('0x3e')](_0x2f9107['model'],qs['fields'](_0x2ef5c9[_0x5c29('0x3b')][_0x5c29('0x41')]));_0x22cdcd[_0x5c29('0x40')]=_0x22cdcd[_0x5c29('0x40')]['length']?_0x22cdcd[_0x5c29('0x40')]:_0x2f9107[_0x5c29('0x3f')];_0x22cdcd[_0x5c29('0x57')]=qs[_0x5c29('0x44')](_0x2ef5c9[_0x5c29('0x3b')][_0x5c29('0x44')]);_0x22cdcd[_0x5c29('0x45')]=qs[_0x5c29('0x3d')](_[_0x5c29('0x46')](_0x2ef5c9[_0x5c29('0x3b')],_0x2f9107[_0x5c29('0x3d')]));if(_0x2ef5c9[_0x5c29('0x3b')]['filter']){_0x22cdcd[_0x5c29('0x45')]=_[_0x5c29('0x48')](_0x22cdcd['where'],{'$or':_[_0x5c29('0x36')](_0x22cdcd[_0x5c29('0x40')],function(_0x131079){var _0x4a56d1={};_0x4a56d1[_0x131079]={'$like':'%'+_0x2ef5c9['query'][_0x5c29('0x47')]+'%'};return _0x4a56d1;})});}_0x22cdcd=_[_0x5c29('0x48')]({},_0x22cdcd,_0x2ef5c9[_0x5c29('0x4a')]);return _0x258758[_0x5c29('0x5a')](_0x22cdcd);}})['then'](function(_0x438955){if(_0x438955){_0x22515d=_0x438955[_0x5c29('0x42')];if(!_0x2ef5c9[_0x5c29('0x3b')]['hasOwnProperty']('nolimit')){_0x22cdcd[_0x5c29('0x2c')]=qs[_0x5c29('0x2c')](_0x2ef5c9[_0x5c29('0x3b')][_0x5c29('0x2c')]);_0x22cdcd[_0x5c29('0x2b')]=qs[_0x5c29('0x2b')](_0x2ef5c9['query']['offset']);}return _0x258758[_0x5c29('0x5a')](_0x22cdcd);}})[_0x5c29('0x1c')](function(_0x42c50d){if(_0x42c50d){return _0x42c50d?{'count':_0x22515d,'rows':_0x42c50d}:null;}})[_0x5c29('0x1c')](respondWithResult(_0x139352,null))[_0x5c29('0x25')](handleError(_0x139352,null));};exports[_0x5c29('0x5b')]=function(_0x21a3ab,_0x2ef47c,_0xd3ae5b){var _0xe2fe3d={};var _0x5123d1={};var _0x4710a7;var _0x516050;return db[_0x5c29('0x37')]['findOne']({'where':{'id':_0x21a3ab[_0x5c29('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2ef47c,null))[_0x5c29('0x1c')](function(_0x7d6186){if(_0x7d6186){_0x4710a7=_0x7d6186;_0x5123d1[_0x5c29('0x3f')]=_[_0x5c29('0x3c')](db[_0x5c29('0x5c')][_0x5c29('0x56')]);_0x5123d1[_0x5c29('0x3b')]=_[_0x5c29('0x3c')](_0x21a3ab[_0x5c29('0x3b')]);_0x5123d1[_0x5c29('0x3d')]=_[_0x5c29('0x3e')](_0x5123d1[_0x5c29('0x3f')],_0x5123d1['query']);_0xe2fe3d['attributes']=_['intersection'](_0x5123d1[_0x5c29('0x3f')],qs[_0x5c29('0x41')](_0x21a3ab[_0x5c29('0x3b')][_0x5c29('0x41')]));_0xe2fe3d[_0x5c29('0x40')]=_0xe2fe3d['attributes'][_0x5c29('0x42')]?_0xe2fe3d[_0x5c29('0x40')]:_0x5123d1[_0x5c29('0x3f')];_0xe2fe3d[_0x5c29('0x57')]=qs[_0x5c29('0x44')](_0x21a3ab[_0x5c29('0x3b')]['sort']);_0xe2fe3d['where']=qs[_0x5c29('0x3d')](_[_0x5c29('0x46')](_0x21a3ab[_0x5c29('0x3b')],_0x5123d1[_0x5c29('0x3d')]));if(_0x21a3ab[_0x5c29('0x3b')][_0x5c29('0x47')]){_0xe2fe3d[_0x5c29('0x45')]=_[_0x5c29('0x48')](_0xe2fe3d[_0x5c29('0x45')],{'$or':_[_0x5c29('0x36')](_0xe2fe3d[_0x5c29('0x40')],function(_0x5e7090){var _0x4a197b={};_0x4a197b[_0x5e7090]={'$like':'%'+_0x21a3ab['query']['filter']+'%'};return _0x4a197b;})});}_0xe2fe3d=_[_0x5c29('0x48')]({},_0xe2fe3d,_0x21a3ab[_0x5c29('0x4a')]);return _0x4710a7[_0x5c29('0x5b')](_0xe2fe3d);}})[_0x5c29('0x1c')](function(_0x5ced80){if(_0x5ced80){_0x516050=_0x5ced80[_0x5c29('0x42')];if(!_0x21a3ab['query'][_0x5c29('0x43')](_0x5c29('0x58'))){_0xe2fe3d[_0x5c29('0x2c')]=qs[_0x5c29('0x2c')](_0x21a3ab['query'][_0x5c29('0x2c')]);_0xe2fe3d[_0x5c29('0x2b')]=qs[_0x5c29('0x2b')](_0x21a3ab[_0x5c29('0x3b')][_0x5c29('0x2b')]);}return _0x4710a7[_0x5c29('0x5b')](_0xe2fe3d);}})['then'](function(_0xa1ab34){if(_0xa1ab34){return _0xa1ab34?{'count':_0x516050,'rows':_0xa1ab34}:null;}})[_0x5c29('0x1c')](respondWithResult(_0x2ef47c,null))[_0x5c29('0x25')](handleError(_0x2ef47c,null));};exports[_0x5c29('0x5d')]=function(_0x4b7657,_0x668011,_0x21b657){if(_0x4b7657[_0x5c29('0x51')]['id']){delete _0x4b7657[_0x5c29('0x51')]['id'];}return db[_0x5c29('0x37')][_0x5c29('0x54')]({'where':{'id':_0x4b7657['params']['id']}})[_0x5c29('0x1c')](handleEntityNotFound(_0x668011,null))[_0x5c29('0x1c')](function(_0x5f55d2){if(_0x5f55d2){return _0x5f55d2['setTags'](_0x4b7657[_0x5c29('0x51')][_0x5c29('0x5e')]||[]);}return null;})[_0x5c29('0x1c')](respondWithResult(_0x668011,null))[_0x5c29('0x25')](handleError(_0x668011,null));}; \ No newline at end of file +var _0xe32d=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','destroy','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','show','params','DeskConfiguration','rawAttributes','includeAll','options','find','create','body','getFields','findOne','getSubjects','DeskField','getDescriptions','getTags','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','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'];(function(_0x2a2966,_0x4a3091){var _0x2b2e70=function(_0x5b2331){while(--_0x5b2331){_0x2a2966['push'](_0x2a2966['shift']());}};_0x2b2e70(++_0x4a3091);}(_0xe32d,0xff));var _0xde32=function(_0xe39134,_0x120db7){_0xe39134=_0xe39134-0x0;var _0x28118a=_0xe32d[_0xe39134];return _0x28118a;};'use strict';var pdf=require(_0xde32('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xde32('0x1'));var zipdir=require(_0xde32('0x2'));var jsonpatch=require(_0xde32('0x3'));var rp=require('request-promise');var moment=require(_0xde32('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xde32('0x5'));var util=require('util');var path=require(_0xde32('0x6'));var sox=require(_0xde32('0x7'));var csv=require(_0xde32('0x8'));var ejs=require(_0xde32('0x9'));var fs=require('fs');var _=require(_0xde32('0xa'));var squel=require(_0xde32('0xb'));var crypto=require(_0xde32('0xc'));var jsforce=require(_0xde32('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xde32('0x8'));var querystring=require('querystring');var Papa=require(_0xde32('0xe'));var Redis=require('ioredis');var authService=require(_0xde32('0xf'));var qs=require(_0xde32('0x10'));var as=require(_0xde32('0x11'));var hardwareService=require(_0xde32('0x12'));var logger=require(_0xde32('0x13'))(_0xde32('0x14'));var utils=require(_0xde32('0x15'));var config=require(_0xde32('0x16'));var db=require(_0xde32('0x17'))['db'];var jayson=require(_0xde32('0x18'));var client=jayson[_0xde32('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x1f0c89,_0x3bbfd5,_0x7ab0ab){if(_0x7ab0ab){var _0x1acd89=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1acd89[_0xde32('0x1a')](_0x3bbfd5)){return _0x1f0c89;}else{throw new db[(_0xde32('0x1b'))][(_0xde32('0x1c'))](_0xde32('0x1d'));}}else{return _0x1f0c89;}}function respondWithRpcPromise(_0x23ba9e,_0x14d156,_0xaed16c,_0x21fa42){return new BPromise(function(_0x247e13,_0x5ae995){var _0x273172=_0x21fa42||client;return _0x273172[_0xde32('0x1e')](_0x23ba9e,_0xaed16c)[_0xde32('0x1f')](function(_0x11062a){logger[_0xde32('0x20')](_0xde32('0x21'),_0x14d156,_0xde32('0x22'));logger[_0xde32('0x23')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x14d156,'request\x20sent',JSON[_0xde32('0x24')](_0x11062a));if(_0x11062a[_0xde32('0x25')]){if(_0x11062a['error'][_0xde32('0x26')]===0x1f4){logger[_0xde32('0x25')](_0xde32('0x21'),_0x14d156,_0x11062a[_0xde32('0x25')][_0xde32('0x27')]);return _0x5ae995(_0x11062a[_0xde32('0x25')][_0xde32('0x27')]);}logger[_0xde32('0x25')](_0xde32('0x21'),_0x14d156,_0x11062a[_0xde32('0x25')][_0xde32('0x27')]);return _0x247e13(_0x11062a['error'][_0xde32('0x27')]);}else{logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x14d156,_0xde32('0x22'));_0x247e13(_0x11062a[_0xde32('0x28')]['message']);}})[_0xde32('0x29')](function(_0x2c90e6){logger[_0xde32('0x25')](_0xde32('0x21'),_0x14d156,_0x2c90e6);_0x5ae995(_0x2c90e6);});});}function respondWithStatusCode(_0x2d4ce0,_0x2c45e2){_0x2c45e2=_0x2c45e2||0xcc;return function(_0x232cdc){if(_0x232cdc){return _0x2d4ce0[_0xde32('0x2a')](_0x2c45e2);}return _0x2d4ce0[_0xde32('0x2b')](_0x2c45e2)['end']();};}function respondWithResult(_0xc13e0a,_0x27b2ef){_0x27b2ef=_0x27b2ef||0xc8;return function(_0x293834){if(_0x293834){return _0xc13e0a['status'](_0x27b2ef)[_0xde32('0x2c')](_0x293834);}};}function respondWithFilteredResult(_0x1c6103,_0x1204db){return function(_0x1a55d8){if(_0x1a55d8){var _0x51606e=_0x1a55d8[_0xde32('0x2d')],_0x31c4cd=_0x1204db[_0xde32('0x2e')],_0x5da5e5=_0x1204db[_0xde32('0x2e')]+_0x1204db[_0xde32('0x2f')],_0x2671fd;if(_0x5da5e5>=_0x51606e){_0x5da5e5=_0x51606e;_0x2671fd=0xc8;}else{_0x2671fd=0xce;}_0x1c6103['status'](_0x2671fd);return _0x1c6103[_0xde32('0x30')](_0xde32('0x31'),_0x31c4cd+'-'+_0x5da5e5+'/'+_0x51606e)['json'](_0x1a55d8);}return null;};}function patchUpdates(_0x3d24ba){return function(_0x271c9b){try{jsonpatch[_0xde32('0x32')](_0x271c9b,_0x3d24ba,!![]);}catch(_0x3325b6){return BPromise['reject'](_0x3325b6);}return _0x271c9b['save']();};}function saveUpdates(_0x4f2b30,_0x2f31f5){return function(_0x12ccde){if(_0x12ccde){return _0x12ccde[_0xde32('0x33')](_0x4f2b30)[_0xde32('0x1f')](function(_0x12a019){return _0x12a019;});}return null;};}function removeEntity(_0x30fac1,_0x162682){return function(_0x1aee37){if(_0x1aee37){return _0x1aee37[_0xde32('0x34')]()[_0xde32('0x1f')](function(){_0x30fac1[_0xde32('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e434c,_0x5bdf41){return function(_0x28fe88){if(!_0x28fe88){_0x2e434c['sendStatus'](0x194);}return _0x28fe88;};}function handleError(_0x564754,_0x31d82b){_0x31d82b=_0x31d82b||0x1f4;return function(_0x43a689){logger[_0xde32('0x25')](_0x43a689['stack']);if(_0x43a689[_0xde32('0x35')]){delete _0x43a689[_0xde32('0x35')];}_0x564754[_0xde32('0x2b')](_0x31d82b)[_0xde32('0x36')](_0x43a689);};}exports[_0xde32('0x37')]=function(_0x1c9c72,_0x254a50){var _0x3eaf2e={},_0x2738ef={},_0x13f63a={'count':0x0,'rows':[]};var _0x5362df=_['map'](db['DeskConfiguration']['rawAttributes'],function(_0x4dc9ec){return{'name':_0x4dc9ec[_0xde32('0x38')],'type':_0x4dc9ec[_0xde32('0x39')][_0xde32('0x3a')]};});_0x2738ef[_0xde32('0x3b')]=_[_0xde32('0x3c')](_0x5362df,_0xde32('0x35'));_0x2738ef[_0xde32('0x3d')]=_[_0xde32('0x3e')](_0x1c9c72[_0xde32('0x3d')]);_0x2738ef[_0xde32('0x3f')]=_[_0xde32('0x40')](_0x2738ef['model'],_0x2738ef[_0xde32('0x3d')]);_0x3eaf2e[_0xde32('0x41')]=_['intersection'](_0x2738ef[_0xde32('0x3b')],qs['fields'](_0x1c9c72['query'][_0xde32('0x42')]));_0x3eaf2e['attributes']=_0x3eaf2e[_0xde32('0x41')][_0xde32('0x43')]?_0x3eaf2e[_0xde32('0x41')]:_0x2738ef[_0xde32('0x3b')];if(!_0x1c9c72[_0xde32('0x3d')][_0xde32('0x44')](_0xde32('0x45'))){_0x3eaf2e[_0xde32('0x2f')]=qs['limit'](_0x1c9c72['query'][_0xde32('0x2f')]);_0x3eaf2e[_0xde32('0x2e')]=qs['offset'](_0x1c9c72['query']['offset']);}_0x3eaf2e[_0xde32('0x46')]=qs[_0xde32('0x47')](_0x1c9c72[_0xde32('0x3d')][_0xde32('0x47')]);_0x3eaf2e[_0xde32('0x48')]=qs['filters'](_[_0xde32('0x49')](_0x1c9c72[_0xde32('0x3d')],_0x2738ef[_0xde32('0x3f')]));if(_0x1c9c72[_0xde32('0x3d')][_0xde32('0x4a')]){_0x3eaf2e[_0xde32('0x48')]=_['merge'](_0x3eaf2e[_0xde32('0x48')],{'$or':_[_0xde32('0x3c')](_0x5362df,function(_0x399149){if(_0x399149[_0xde32('0x39')]!==_0xde32('0x4b')){var _0x2c7f5c={};_0x2c7f5c[_0x399149[_0xde32('0x35')]]={'$like':'%'+_0x1c9c72[_0xde32('0x3d')][_0xde32('0x4a')]+'%'};return _0x2c7f5c;}})});}_0x3eaf2e=_[_0xde32('0x4c')]({},_0x3eaf2e,_0x1c9c72['options']);var _0x52d467={'where':_0x3eaf2e[_0xde32('0x48')]};return db['DeskConfiguration']['count'](_0x52d467)['then'](function(_0x24572d){_0x13f63a[_0xde32('0x2d')]=_0x24572d;if(_0x1c9c72[_0xde32('0x3d')]['includeAll']){_0x3eaf2e[_0xde32('0x4d')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xde32('0x4e')](_0x3eaf2e);})[_0xde32('0x1f')](function(_0x388444){_0x13f63a['rows']=_0x388444;return _0x13f63a;})[_0xde32('0x1f')](respondWithFilteredResult(_0x254a50,_0x3eaf2e))[_0xde32('0x29')](handleError(_0x254a50,null));};exports[_0xde32('0x4f')]=function(_0x465741,_0x413b31){var _0x39d1af={'raw':![],'where':{'id':_0x465741[_0xde32('0x50')]['id']}},_0x1e7f91={};_0x1e7f91[_0xde32('0x3b')]=_[_0xde32('0x3e')](db[_0xde32('0x51')][_0xde32('0x52')]);_0x1e7f91[_0xde32('0x3d')]=_[_0xde32('0x3e')](_0x465741[_0xde32('0x3d')]);_0x1e7f91[_0xde32('0x3f')]=_[_0xde32('0x40')](_0x1e7f91[_0xde32('0x3b')],_0x1e7f91[_0xde32('0x3d')]);_0x39d1af[_0xde32('0x41')]=_[_0xde32('0x40')](_0x1e7f91[_0xde32('0x3b')],qs['fields'](_0x465741['query'][_0xde32('0x42')]));_0x39d1af[_0xde32('0x41')]=_0x39d1af['attributes'][_0xde32('0x43')]?_0x39d1af['attributes']:_0x1e7f91[_0xde32('0x3b')];if(_0x465741[_0xde32('0x3d')][_0xde32('0x53')]){_0x39d1af[_0xde32('0x4d')]=[{'all':!![]}];}_0x39d1af=_[_0xde32('0x4c')]({},_0x39d1af,_0x465741[_0xde32('0x54')]);return db[_0xde32('0x51')][_0xde32('0x55')](_0x39d1af)['then'](handleEntityNotFound(_0x413b31,null))[_0xde32('0x1f')](respondWithResult(_0x413b31,null))[_0xde32('0x29')](handleError(_0x413b31,null));};exports[_0xde32('0x56')]=function(_0x51c4ef,_0x4d3c5f){return db[_0xde32('0x51')][_0xde32('0x56')](_0x51c4ef[_0xde32('0x57')],{})[_0xde32('0x1f')](respondWithResult(_0x4d3c5f,0xc9))[_0xde32('0x29')](handleError(_0x4d3c5f,null));};exports[_0xde32('0x33')]=function(_0x404062,_0x2a80e3){if(_0x404062[_0xde32('0x57')]['id']){delete _0x404062['body']['id'];}return db[_0xde32('0x51')][_0xde32('0x55')]({'where':{'id':_0x404062['params']['id']}})[_0xde32('0x1f')](handleEntityNotFound(_0x2a80e3,null))[_0xde32('0x1f')](saveUpdates(_0x404062[_0xde32('0x57')],null))[_0xde32('0x1f')](respondWithResult(_0x2a80e3,null))[_0xde32('0x29')](handleError(_0x2a80e3,null));};exports[_0xde32('0x34')]=function(_0x48db4d,_0x48dfb6){return db[_0xde32('0x51')][_0xde32('0x55')]({'where':{'id':_0x48db4d[_0xde32('0x50')]['id']}})[_0xde32('0x1f')](handleEntityNotFound(_0x48dfb6,null))[_0xde32('0x1f')](removeEntity(_0x48dfb6,null))['catch'](handleError(_0x48dfb6,null));};exports[_0xde32('0x58')]=function(_0x4e172c,_0x36c262,_0x399e02){var _0x51ea00={};var _0x3b5055={};var _0x25b2e8;var _0x16e056;return db[_0xde32('0x51')][_0xde32('0x59')]({'where':{'id':_0x4e172c[_0xde32('0x50')]['id']}})[_0xde32('0x1f')](handleEntityNotFound(_0x36c262,null))[_0xde32('0x1f')](function(_0x2e6353){if(_0x2e6353){_0x25b2e8=_0x2e6353;_0x3b5055['model']=_['keys'](db['DeskField']['rawAttributes']);_0x3b5055[_0xde32('0x3d')]=_[_0xde32('0x3e')](_0x4e172c[_0xde32('0x3d')]);_0x3b5055[_0xde32('0x3f')]=_[_0xde32('0x40')](_0x3b5055[_0xde32('0x3b')],_0x3b5055[_0xde32('0x3d')]);_0x51ea00[_0xde32('0x41')]=_[_0xde32('0x40')](_0x3b5055[_0xde32('0x3b')],qs[_0xde32('0x42')](_0x4e172c[_0xde32('0x3d')][_0xde32('0x42')]));_0x51ea00[_0xde32('0x41')]=_0x51ea00[_0xde32('0x41')][_0xde32('0x43')]?_0x51ea00[_0xde32('0x41')]:_0x3b5055[_0xde32('0x3b')];_0x51ea00[_0xde32('0x46')]=qs[_0xde32('0x47')](_0x4e172c['query']['sort']);_0x51ea00[_0xde32('0x48')]=qs[_0xde32('0x3f')](_[_0xde32('0x49')](_0x4e172c['query'],_0x3b5055[_0xde32('0x3f')]));if(_0x4e172c[_0xde32('0x3d')]['filter']){_0x51ea00['where']=_['merge'](_0x51ea00[_0xde32('0x48')],{'$or':_[_0xde32('0x3c')](_0x51ea00[_0xde32('0x41')],function(_0x3bba01){var _0x168a08={};_0x168a08[_0x3bba01]={'$like':'%'+_0x4e172c[_0xde32('0x3d')][_0xde32('0x4a')]+'%'};return _0x168a08;})});}_0x51ea00=_[_0xde32('0x4c')]({},_0x51ea00,_0x4e172c[_0xde32('0x54')]);return _0x25b2e8['getFields'](_0x51ea00);}})[_0xde32('0x1f')](function(_0x114080){if(_0x114080){_0x16e056=_0x114080[_0xde32('0x43')];if(!_0x4e172c[_0xde32('0x3d')][_0xde32('0x44')](_0xde32('0x45'))){_0x51ea00[_0xde32('0x2f')]=qs[_0xde32('0x2f')](_0x4e172c[_0xde32('0x3d')][_0xde32('0x2f')]);_0x51ea00[_0xde32('0x2e')]=qs['offset'](_0x4e172c[_0xde32('0x3d')][_0xde32('0x2e')]);}return _0x25b2e8[_0xde32('0x58')](_0x51ea00);}})[_0xde32('0x1f')](function(_0x2a9ac5){if(_0x2a9ac5){return _0x2a9ac5?{'count':_0x16e056,'rows':_0x2a9ac5}:null;}})['then'](respondWithResult(_0x36c262,null))['catch'](handleError(_0x36c262,null));};exports[_0xde32('0x5a')]=function(_0x2a6ffe,_0x24bf07,_0x433796){var _0xe1c788={};var _0x3df1d4={};var _0x4a5658;var _0x35763c;return db[_0xde32('0x51')][_0xde32('0x59')]({'where':{'id':_0x2a6ffe['params']['id']}})[_0xde32('0x1f')](handleEntityNotFound(_0x24bf07,null))['then'](function(_0x2a71f1){if(_0x2a71f1){_0x4a5658=_0x2a71f1;_0x3df1d4[_0xde32('0x3b')]=_['keys'](db[_0xde32('0x5b')][_0xde32('0x52')]);_0x3df1d4[_0xde32('0x3d')]=_[_0xde32('0x3e')](_0x2a6ffe[_0xde32('0x3d')]);_0x3df1d4['filters']=_[_0xde32('0x40')](_0x3df1d4['model'],_0x3df1d4['query']);_0xe1c788[_0xde32('0x41')]=_[_0xde32('0x40')](_0x3df1d4['model'],qs[_0xde32('0x42')](_0x2a6ffe[_0xde32('0x3d')][_0xde32('0x42')]));_0xe1c788['attributes']=_0xe1c788['attributes'][_0xde32('0x43')]?_0xe1c788['attributes']:_0x3df1d4[_0xde32('0x3b')];_0xe1c788[_0xde32('0x46')]=qs['sort'](_0x2a6ffe[_0xde32('0x3d')][_0xde32('0x47')]);_0xe1c788[_0xde32('0x48')]=qs[_0xde32('0x3f')](_[_0xde32('0x49')](_0x2a6ffe[_0xde32('0x3d')],_0x3df1d4[_0xde32('0x3f')]));if(_0x2a6ffe[_0xde32('0x3d')]['filter']){_0xe1c788['where']=_[_0xde32('0x4c')](_0xe1c788[_0xde32('0x48')],{'$or':_['map'](_0xe1c788[_0xde32('0x41')],function(_0x5a8df9){var _0x54154a={};_0x54154a[_0x5a8df9]={'$like':'%'+_0x2a6ffe[_0xde32('0x3d')][_0xde32('0x4a')]+'%'};return _0x54154a;})});}_0xe1c788=_[_0xde32('0x4c')]({},_0xe1c788,_0x2a6ffe[_0xde32('0x54')]);return _0x4a5658[_0xde32('0x5a')](_0xe1c788);}})[_0xde32('0x1f')](function(_0x18a4c4){if(_0x18a4c4){_0x35763c=_0x18a4c4[_0xde32('0x43')];if(!_0x2a6ffe[_0xde32('0x3d')][_0xde32('0x44')](_0xde32('0x45'))){_0xe1c788['limit']=qs[_0xde32('0x2f')](_0x2a6ffe[_0xde32('0x3d')][_0xde32('0x2f')]);_0xe1c788[_0xde32('0x2e')]=qs[_0xde32('0x2e')](_0x2a6ffe['query'][_0xde32('0x2e')]);}return _0x4a5658[_0xde32('0x5a')](_0xe1c788);}})[_0xde32('0x1f')](function(_0x3a6741){if(_0x3a6741){return _0x3a6741?{'count':_0x35763c,'rows':_0x3a6741}:null;}})[_0xde32('0x1f')](respondWithResult(_0x24bf07,null))['catch'](handleError(_0x24bf07,null));};exports['getDescriptions']=function(_0x3ab142,_0xa9a08f,_0x3052f6){var _0x55b8b0={};var _0x2b1b22={};var _0x371eee;var _0x2c3d8f;return db[_0xde32('0x51')]['findOne']({'where':{'id':_0x3ab142[_0xde32('0x50')]['id']}})[_0xde32('0x1f')](handleEntityNotFound(_0xa9a08f,null))[_0xde32('0x1f')](function(_0x5e02f8){if(_0x5e02f8){_0x371eee=_0x5e02f8;_0x2b1b22[_0xde32('0x3b')]=_[_0xde32('0x3e')](db[_0xde32('0x5b')]['rawAttributes']);_0x2b1b22[_0xde32('0x3d')]=_[_0xde32('0x3e')](_0x3ab142[_0xde32('0x3d')]);_0x2b1b22['filters']=_[_0xde32('0x40')](_0x2b1b22['model'],_0x2b1b22[_0xde32('0x3d')]);_0x55b8b0[_0xde32('0x41')]=_[_0xde32('0x40')](_0x2b1b22[_0xde32('0x3b')],qs[_0xde32('0x42')](_0x3ab142[_0xde32('0x3d')][_0xde32('0x42')]));_0x55b8b0[_0xde32('0x41')]=_0x55b8b0[_0xde32('0x41')][_0xde32('0x43')]?_0x55b8b0[_0xde32('0x41')]:_0x2b1b22[_0xde32('0x3b')];_0x55b8b0['order']=qs[_0xde32('0x47')](_0x3ab142[_0xde32('0x3d')]['sort']);_0x55b8b0[_0xde32('0x48')]=qs[_0xde32('0x3f')](_[_0xde32('0x49')](_0x3ab142['query'],_0x2b1b22['filters']));if(_0x3ab142['query'][_0xde32('0x4a')]){_0x55b8b0[_0xde32('0x48')]=_[_0xde32('0x4c')](_0x55b8b0[_0xde32('0x48')],{'$or':_[_0xde32('0x3c')](_0x55b8b0['attributes'],function(_0x16f05f){var _0xa70aa4={};_0xa70aa4[_0x16f05f]={'$like':'%'+_0x3ab142['query'][_0xde32('0x4a')]+'%'};return _0xa70aa4;})});}_0x55b8b0=_[_0xde32('0x4c')]({},_0x55b8b0,_0x3ab142[_0xde32('0x54')]);return _0x371eee['getDescriptions'](_0x55b8b0);}})[_0xde32('0x1f')](function(_0x3bd38a){if(_0x3bd38a){_0x2c3d8f=_0x3bd38a[_0xde32('0x43')];if(!_0x3ab142[_0xde32('0x3d')][_0xde32('0x44')](_0xde32('0x45'))){_0x55b8b0[_0xde32('0x2f')]=qs[_0xde32('0x2f')](_0x3ab142[_0xde32('0x3d')][_0xde32('0x2f')]);_0x55b8b0[_0xde32('0x2e')]=qs[_0xde32('0x2e')](_0x3ab142[_0xde32('0x3d')][_0xde32('0x2e')]);}return _0x371eee[_0xde32('0x5c')](_0x55b8b0);}})[_0xde32('0x1f')](function(_0x42398a){if(_0x42398a){return _0x42398a?{'count':_0x2c3d8f,'rows':_0x42398a}:null;}})[_0xde32('0x1f')](respondWithResult(_0xa9a08f,null))['catch'](handleError(_0xa9a08f,null));};exports[_0xde32('0x5d')]=function(_0x56fdd5,_0x583080,_0x552509){var _0x518c5c={};var _0x19b404={};var _0x629c3e;var _0x1151af;return db[_0xde32('0x51')][_0xde32('0x59')]({'where':{'id':_0x56fdd5[_0xde32('0x50')]['id']}})['then'](handleEntityNotFound(_0x583080,null))[_0xde32('0x1f')](function(_0x37ac06){if(_0x37ac06){_0x629c3e=_0x37ac06;_0x19b404['model']=_[_0xde32('0x3e')](db['Tag'][_0xde32('0x52')]);_0x19b404[_0xde32('0x3d')]=_[_0xde32('0x3e')](_0x56fdd5[_0xde32('0x3d')]);_0x19b404[_0xde32('0x3f')]=_['intersection'](_0x19b404[_0xde32('0x3b')],_0x19b404[_0xde32('0x3d')]);_0x518c5c[_0xde32('0x41')]=_[_0xde32('0x40')](_0x19b404[_0xde32('0x3b')],qs[_0xde32('0x42')](_0x56fdd5[_0xde32('0x3d')][_0xde32('0x42')]));_0x518c5c[_0xde32('0x41')]=_0x518c5c[_0xde32('0x41')][_0xde32('0x43')]?_0x518c5c[_0xde32('0x41')]:_0x19b404[_0xde32('0x3b')];_0x518c5c[_0xde32('0x46')]=qs['sort'](_0x56fdd5[_0xde32('0x3d')][_0xde32('0x47')]);_0x518c5c[_0xde32('0x48')]=qs['filters'](_[_0xde32('0x49')](_0x56fdd5[_0xde32('0x3d')],_0x19b404[_0xde32('0x3f')]));if(_0x56fdd5[_0xde32('0x3d')][_0xde32('0x4a')]){_0x518c5c[_0xde32('0x48')]=_[_0xde32('0x4c')](_0x518c5c[_0xde32('0x48')],{'$or':_[_0xde32('0x3c')](_0x518c5c[_0xde32('0x41')],function(_0x6e6d42){var _0x3c1e31={};_0x3c1e31[_0x6e6d42]={'$like':'%'+_0x56fdd5[_0xde32('0x3d')][_0xde32('0x4a')]+'%'};return _0x3c1e31;})});}_0x518c5c=_['merge']({},_0x518c5c,_0x56fdd5[_0xde32('0x54')]);return _0x629c3e[_0xde32('0x5d')](_0x518c5c);}})[_0xde32('0x1f')](function(_0x434253){if(_0x434253){_0x1151af=_0x434253['length'];if(!_0x56fdd5[_0xde32('0x3d')][_0xde32('0x44')](_0xde32('0x45'))){_0x518c5c[_0xde32('0x2f')]=qs[_0xde32('0x2f')](_0x56fdd5[_0xde32('0x3d')][_0xde32('0x2f')]);_0x518c5c[_0xde32('0x2e')]=qs[_0xde32('0x2e')](_0x56fdd5[_0xde32('0x3d')]['offset']);}return _0x629c3e[_0xde32('0x5d')](_0x518c5c);}})[_0xde32('0x1f')](function(_0x3cd971){if(_0x3cd971){return _0x3cd971?{'count':_0x1151af,'rows':_0x3cd971}:null;}})[_0xde32('0x1f')](respondWithResult(_0x583080,null))[_0xde32('0x29')](handleError(_0x583080,null));};exports[_0xde32('0x5e')]=function(_0x2bda6e,_0x4ac74f,_0x13793c){if(_0x2bda6e[_0xde32('0x57')]['id']){delete _0x2bda6e['body']['id'];}return db[_0xde32('0x51')]['findOne']({'where':{'id':_0x2bda6e['params']['id']}})['then'](handleEntityNotFound(_0x4ac74f,null))['then'](function(_0x36f893){if(_0x36f893){return _0x36f893[_0xde32('0x5e')](_0x2bda6e[_0xde32('0x57')][_0xde32('0x5f')]||[]);}return null;})[_0xde32('0x1f')](respondWithResult(_0x4ac74f,null))[_0xde32('0x29')](handleError(_0x4ac74f,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index e276b50..c0b82ab 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 _0xfd01=['util','../../config/logger','api','moment','bluebird','path','rimraf','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0xfd01,0x1df));var _0x1fd0=function(_0x5c0d9f,_0x496051){_0x5c0d9f=_0x5c0d9f-0x0;var _0x32b430=_0xfd01[_0x5c0d9f];return _0x32b430;};'use strict';var _=require(_0x1fd0('0x0'));var util=require(_0x1fd0('0x1'));var logger=require(_0x1fd0('0x2'))(_0x1fd0('0x3'));var moment=require(_0x1fd0('0x4'));var BPromise=require(_0x1fd0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fd0('0x6'));var rimraf=require(_0x1fd0('0x7'));var config=require('../../config/environment');var attributes=require(_0x1fd0('0x8'));module['exports']=function(_0x49722e,_0x48f322){return _0x49722e[_0x1fd0('0x9')](_0x1fd0('0xa'),attributes,{'tableName':_0x1fd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xece8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger'];(function(_0x5de713,_0x1c1ba1){var _0x1742a4=function(_0x329915){while(--_0x329915){_0x5de713['push'](_0x5de713['shift']());}};_0x1742a4(++_0x1c1ba1);}(_0xece8,0x129));var _0x8ece=function(_0x3399a0,_0x2c3489){_0x3399a0=_0x3399a0-0x0;var _0x1f6d58=_0xece8[_0x3399a0];return _0x1f6d58;};'use strict';var _=require(_0x8ece('0x0'));var util=require(_0x8ece('0x1'));var logger=require(_0x8ece('0x2'))('api');var moment=require(_0x8ece('0x3'));var BPromise=require(_0x8ece('0x4'));var rp=require(_0x8ece('0x5'));var fs=require('fs');var path=require(_0x8ece('0x6'));var rimraf=require(_0x8ece('0x7'));var config=require(_0x8ece('0x8'));var attributes=require(_0x8ece('0x9'));module['exports']=function(_0x14f532,_0x5aca55){return _0x14f532['define'](_0x8ece('0xa'),attributes,{'tableName':_0x8ece('0xb'),'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 fbaba5b..7029a10 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 _0xe13a=['code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xda4fd6,_0x16d39e){var _0x27bd93=function(_0x3de8cc){while(--_0x3de8cc){_0xda4fd6['push'](_0xda4fd6['shift']());}};_0x27bd93(++_0x16d39e);}(_0xe13a,0x178));var _0xae13=function(_0x45f888,_0x22b1a0){_0x45f888=_0x45f888-0x0;var _0x5638e8=_0xe13a[_0x45f888];return _0x5638e8;};'use strict';var _=require('lodash');var util=require(_0xae13('0x0'));var moment=require(_0xae13('0x1'));var BPromise=require(_0xae13('0x2'));var rs=require(_0xae13('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae13('0x4'))['db'];var utils=require(_0xae13('0x5'));var logger=require(_0xae13('0x6'))(_0xae13('0x7'));var config=require(_0xae13('0x8'));var jayson=require(_0xae13('0x9'));var client=jayson[_0xae13('0xa')][_0xae13('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x341ba4,_0x4ae51f,_0x2f6d10){return new BPromise(function(_0x2b2e1f,_0x27fefd){return client[_0xae13('0xc')](_0x341ba4,_0x2f6d10)[_0xae13('0xd')](function(_0x41bf44){logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));logger['debug'](_0xae13('0x11'),_0x4ae51f,_0xae13('0x10'),JSON[_0xae13('0x12')](_0x41bf44));if(_0x41bf44[_0xae13('0x13')]){if(_0x41bf44[_0xae13('0x13')][_0xae13('0x14')]===0x1f4){logger[_0xae13('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0x4ae51f,_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);return _0x27fefd(_0x41bf44['error']['message']);}logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x4ae51f,_0x41bf44['error'][_0xae13('0x15')]);return _0x2b2e1f(_0x41bf44[_0xae13('0x13')][_0xae13('0x15')]);}else{logger[_0xae13('0xe')](_0xae13('0xf'),_0x4ae51f,_0xae13('0x10'));_0x2b2e1f(_0x41bf44['result'][_0xae13('0x15')]);}})['catch'](function(_0xe10aab){logger[_0xae13('0x13')](_0xae13('0xf'),_0x4ae51f,_0xe10aab);_0x27fefd(_0xe10aab);});});} \ No newline at end of file +var _0x6b19=['error','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6b19,0xe8));var _0x96b1=function(_0x2af652,_0x42c24f){_0x2af652=_0x2af652-0x0;var _0xcce294=_0x6b19[_0x2af652];return _0xcce294;};'use strict';var _=require(_0x96b1('0x0'));var util=require(_0x96b1('0x1'));var moment=require('moment');var BPromise=require(_0x96b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96b1('0x3'))['db'];var utils=require(_0x96b1('0x4'));var logger=require(_0x96b1('0x5'))(_0x96b1('0x6'));var config=require(_0x96b1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x96b1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e3e1a,_0x572fde,_0x57a23a){return new BPromise(function(_0x307e65,_0x535cc9){return client[_0x96b1('0x9')](_0x3e3e1a,_0x57a23a)['then'](function(_0x36ea50){logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));logger[_0x96b1('0xd')](_0x96b1('0xe'),_0x572fde,_0x96b1('0xc'),JSON['stringify'](_0x36ea50));if(_0x36ea50['error']){if(_0x36ea50[_0x96b1('0xf')]['code']===0x1f4){logger['error'](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x535cc9(_0x36ea50['error'][_0x96b1('0x10')]);}logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x36ea50[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x307e65(_0x36ea50['error'][_0x96b1('0x10')]);}else{logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x572fde,_0x96b1('0xc'));_0x307e65(_0x36ea50[_0x96b1('0x11')][_0x96b1('0x10')]);}})[_0x96b1('0x12')](function(_0x2d5a32){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x572fde,_0x2d5a32);_0x535cc9(_0x2d5a32);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 6578e1e..bfdfd3c 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 _0x89d9=['exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x89d9,0x1cc));var _0x989d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x89d9[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x989d('0x0'));var timeout=require(_0x989d('0x1'));var express=require('express');var router=express[_0x989d('0x2')]();var auth=require(_0x989d('0x3'));var interaction=require(_0x989d('0x4'));var config=require(_0x989d('0x5'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0x989d('0x6')](),controller[_0x989d('0x7')]);router[_0x989d('0x8')](_0x989d('0x9'),auth[_0x989d('0x6')](),controller[_0x989d('0xa')]);router[_0x989d('0xb')]('/',auth[_0x989d('0x6')](),controller[_0x989d('0xc')]);router[_0x989d('0xd')](_0x989d('0x9'),auth[_0x989d('0x6')](),controller[_0x989d('0xe')]);router[_0x989d('0xf')](_0x989d('0x9'),auth[_0x989d('0x6')](),controller['destroy']);module[_0x989d('0x10')]=router; \ No newline at end of file +var _0x2b2d=['update','delete','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','create','put'];(function(_0x102c8f,_0x2199e0){var _0x494c4c=function(_0x26bc4e){while(--_0x26bc4e){_0x102c8f['push'](_0x102c8f['shift']());}};_0x494c4c(++_0x2199e0);}(_0x2b2d,0x7b));var _0xd2b2=function(_0x5dff0c,_0x2bdeb4){_0x5dff0c=_0x5dff0c-0x0;var _0x15615f=_0x2b2d[_0x5dff0c];return _0x15615f;};'use strict';var multer=require(_0xd2b2('0x0'));var util=require('util');var path=require(_0xd2b2('0x1'));var timeout=require('connect-timeout');var express=require(_0xd2b2('0x2'));var router=express['Router']();var auth=require(_0xd2b2('0x3'));var interaction=require(_0xd2b2('0x4'));var config=require(_0xd2b2('0x5'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0xd2b2('0x6')](),controller[_0xd2b2('0x7')]);router[_0xd2b2('0x8')](_0xd2b2('0x9'),auth[_0xd2b2('0x6')](),controller['show']);router['post']('/',auth[_0xd2b2('0x6')](),controller[_0xd2b2('0xa')]);router[_0xd2b2('0xb')](_0xd2b2('0x9'),auth['isAuthenticated'](),controller[_0xd2b2('0xc')]);router[_0xd2b2('0xd')]('/:id',auth[_0xd2b2('0x6')](),controller['destroy']);module[_0xd2b2('0xe')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 007c4c0..8a14ff9 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 _0xa009=['customVariable','keyValue','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xa009,0x1a3));var _0x9a00=function(_0x2c8036,_0x34fc75){_0x2c8036=_0x2c8036-0x0;var _0x45b90f=_0xa009[_0x2c8036];return _0x45b90f;};'use strict';var Sequelize=require(_0x9a00('0x0'));module[_0x9a00('0x1')]={'type':{'type':Sequelize[_0x9a00('0x2')](_0x9a00('0x3'),_0x9a00('0x4'),_0x9a00('0x5'),_0x9a00('0x6')),'defaultValue':_0x9a00('0x3')},'content':{'type':Sequelize[_0x9a00('0x7')]},'key':{'type':Sequelize[_0x9a00('0x7')]},'keyType':{'type':Sequelize[_0x9a00('0x2')](_0x9a00('0x3'),_0x9a00('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9a00('0x7')]},'nameField':{'type':Sequelize[_0x9a00('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9a00('0x7')]}}; \ No newline at end of file +var _0x70f4=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x1d5d3f,_0x3a9d08){var _0x6f9221=function(_0x1e9b5d){while(--_0x1e9b5d){_0x1d5d3f['push'](_0x1d5d3f['shift']());}};_0x6f9221(++_0x3a9d08);}(_0x70f4,0x176));var _0x470f=function(_0x18307e,_0x1898e8){_0x18307e=_0x18307e-0x0;var _0x24186b=_0x70f4[_0x18307e];return _0x24186b;};'use strict';var Sequelize=require(_0x470f('0x0'));module['exports']={'type':{'type':Sequelize[_0x470f('0x1')](_0x470f('0x2'),_0x470f('0x3'),_0x470f('0x4'),_0x470f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x470f('0x6')]},'key':{'type':Sequelize[_0x470f('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x470f('0x2'),_0x470f('0x3'),_0x470f('0x4'))},'keyContent':{'type':Sequelize[_0x470f('0x6')]},'idField':{'type':Sequelize[_0x470f('0x6')]},'nameField':{'type':Sequelize[_0x470f('0x6')]},'customField':{'type':Sequelize[_0x470f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x470f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index f0e82d3..8dcf5f8 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 _0xd2bb=['body','find','params','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','DeskField','count','includeAll','findAll','rows','show','keys','include','options','create','catch'];(function(_0x52a9f9,_0x1d6c5d){var _0x7f7693=function(_0x498696){while(--_0x498696){_0x52a9f9['push'](_0x52a9f9['shift']());}};_0x7f7693(++_0x1d6c5d);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x3fac61,_0x39d769){_0x3fac61=_0x3fac61-0x0;var _0x17943=_0xd2bb[_0x3fac61];return _0x17943;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbd2b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbd2b('0x1'));var jsonpatch=require(_0xbd2b('0x2'));var rp=require(_0xbd2b('0x3'));var moment=require(_0xbd2b('0x4'));var BPromise=require(_0xbd2b('0x5'));var Mustache=require(_0xbd2b('0x6'));var util=require('util');var path=require(_0xbd2b('0x7'));var sox=require(_0xbd2b('0x8'));var csv=require(_0xbd2b('0x9'));var ejs=require(_0xbd2b('0xa'));var fs=require('fs');var _=require(_0xbd2b('0xb'));var squel=require(_0xbd2b('0xc'));var crypto=require(_0xbd2b('0xd'));var jsforce=require(_0xbd2b('0xe'));var deskjs=require(_0xbd2b('0xf'));var toCsv=require(_0xbd2b('0x9'));var querystring=require('querystring');var Papa=require(_0xbd2b('0x10'));var Redis=require('ioredis');var authService=require(_0xbd2b('0x11'));var qs=require(_0xbd2b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd2b('0x13'));var logger=require(_0xbd2b('0x14'))(_0xbd2b('0x15'));var utils=require(_0xbd2b('0x16'));var config=require(_0xbd2b('0x17'));var db=require(_0xbd2b('0x18'))['db'];function respondWithStatusCode(_0x1077b0,_0x275b60){_0x275b60=_0x275b60||0xcc;return function(_0x5722a4){if(_0x5722a4){return _0x1077b0[_0xbd2b('0x19')](_0x275b60);}return _0x1077b0[_0xbd2b('0x1a')](_0x275b60)[_0xbd2b('0x1b')]();};}function respondWithResult(_0x36916c,_0x29f3d1){_0x29f3d1=_0x29f3d1||0xc8;return function(_0x5f246b){if(_0x5f246b){return _0x36916c[_0xbd2b('0x1a')](_0x29f3d1)[_0xbd2b('0x1c')](_0x5f246b);}};}function respondWithFilteredResult(_0x1bc648,_0x1018dc){return function(_0x1815b3){if(_0x1815b3){var _0x2d8352=_0x1815b3['count'],_0x29c6a6=_0x1018dc[_0xbd2b('0x1d')],_0x190648=_0x1018dc[_0xbd2b('0x1d')]+_0x1018dc[_0xbd2b('0x1e')],_0x80463f;if(_0x190648>=_0x2d8352){_0x190648=_0x2d8352;_0x80463f=0xc8;}else{_0x80463f=0xce;}_0x1bc648[_0xbd2b('0x1a')](_0x80463f);return _0x1bc648[_0xbd2b('0x1f')](_0xbd2b('0x20'),_0x29c6a6+'-'+_0x190648+'/'+_0x2d8352)[_0xbd2b('0x1c')](_0x1815b3);}return null;};}function patchUpdates(_0xe4eaa6){return function(_0x21468b){try{jsonpatch[_0xbd2b('0x21')](_0x21468b,_0xe4eaa6,!![]);}catch(_0x5183c1){return BPromise[_0xbd2b('0x22')](_0x5183c1);}return _0x21468b[_0xbd2b('0x23')]();};}function saveUpdates(_0x2b6af4,_0x12d252){return function(_0xc1ce31){if(_0xc1ce31){return _0xc1ce31[_0xbd2b('0x24')](_0x2b6af4)[_0xbd2b('0x25')](function(_0x4cccdd){return _0x4cccdd;});}return null;};}function removeEntity(_0x5e4c99,_0x4a3588){return function(_0x2fb14b){if(_0x2fb14b){return _0x2fb14b['destroy']()[_0xbd2b('0x25')](function(){_0x5e4c99[_0xbd2b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b6b31,_0x1a2b3d){return function(_0x1e3609){if(!_0x1e3609){_0x5b6b31['sendStatus'](0x194);}return _0x1e3609;};}function handleError(_0x534583,_0x584fbd){_0x584fbd=_0x584fbd||0x1f4;return function(_0xbeeef9){logger[_0xbd2b('0x26')](_0xbeeef9[_0xbd2b('0x27')]);if(_0xbeeef9[_0xbd2b('0x28')]){delete _0xbeeef9[_0xbd2b('0x28')];}_0x534583[_0xbd2b('0x1a')](_0x584fbd)['send'](_0xbeeef9);};}exports['index']=function(_0x5f5643,_0x3925ab){var _0x51b3d5={},_0x3516bd={},_0x3e4b8c={'count':0x0,'rows':[]};var _0x44a1ef=_[_0xbd2b('0x29')](db['DeskField'][_0xbd2b('0x2a')],function(_0x5cb9a0){return{'name':_0x5cb9a0[_0xbd2b('0x2b')],'type':_0x5cb9a0[_0xbd2b('0x2c')][_0xbd2b('0x2d')]};});_0x3516bd[_0xbd2b('0x2e')]=_[_0xbd2b('0x29')](_0x44a1ef,_0xbd2b('0x28'));_0x3516bd[_0xbd2b('0x2f')]=_['keys'](_0x5f5643[_0xbd2b('0x2f')]);_0x3516bd['filters']=_[_0xbd2b('0x30')](_0x3516bd[_0xbd2b('0x2e')],_0x3516bd['query']);_0x51b3d5['attributes']=_[_0xbd2b('0x30')](_0x3516bd[_0xbd2b('0x2e')],qs[_0xbd2b('0x31')](_0x5f5643[_0xbd2b('0x2f')][_0xbd2b('0x31')]));_0x51b3d5['attributes']=_0x51b3d5[_0xbd2b('0x32')][_0xbd2b('0x33')]?_0x51b3d5[_0xbd2b('0x32')]:_0x3516bd[_0xbd2b('0x2e')];if(!_0x5f5643[_0xbd2b('0x2f')][_0xbd2b('0x34')](_0xbd2b('0x35'))){_0x51b3d5['limit']=qs[_0xbd2b('0x1e')](_0x5f5643['query']['limit']);_0x51b3d5[_0xbd2b('0x1d')]=qs[_0xbd2b('0x1d')](_0x5f5643[_0xbd2b('0x2f')]['offset']);}_0x51b3d5['order']=qs[_0xbd2b('0x36')](_0x5f5643[_0xbd2b('0x2f')][_0xbd2b('0x36')]);_0x51b3d5[_0xbd2b('0x37')]=qs[_0xbd2b('0x38')](_['pick'](_0x5f5643[_0xbd2b('0x2f')],_0x3516bd[_0xbd2b('0x38')]));if(_0x5f5643['query'][_0xbd2b('0x39')]){_0x51b3d5['where']=_[_0xbd2b('0x3a')](_0x51b3d5[_0xbd2b('0x37')],{'$or':_[_0xbd2b('0x29')](_0x44a1ef,function(_0x2eeafa){if(_0x2eeafa['type']!==_0xbd2b('0x3b')){var _0x2cbe0e={};_0x2cbe0e[_0x2eeafa[_0xbd2b('0x28')]]={'$like':'%'+_0x5f5643[_0xbd2b('0x2f')]['filter']+'%'};return _0x2cbe0e;}})});}_0x51b3d5=_[_0xbd2b('0x3a')]({},_0x51b3d5,_0x5f5643['options']);var _0x3ea722={'where':_0x51b3d5[_0xbd2b('0x37')]};return db[_0xbd2b('0x3c')][_0xbd2b('0x3d')](_0x3ea722)[_0xbd2b('0x25')](function(_0x534741){_0x3e4b8c[_0xbd2b('0x3d')]=_0x534741;if(_0x5f5643[_0xbd2b('0x2f')][_0xbd2b('0x3e')]){_0x51b3d5['include']=[{'all':!![]}];}return db[_0xbd2b('0x3c')][_0xbd2b('0x3f')](_0x51b3d5);})[_0xbd2b('0x25')](function(_0x40df8b){_0x3e4b8c[_0xbd2b('0x40')]=_0x40df8b;return _0x3e4b8c;})[_0xbd2b('0x25')](respondWithFilteredResult(_0x3925ab,_0x51b3d5))['catch'](handleError(_0x3925ab,null));};exports[_0xbd2b('0x41')]=function(_0x27ca58,_0x3f1ae4){var _0x4bcdee={'raw':!![],'where':{'id':_0x27ca58['params']['id']}},_0x57c275={};_0x57c275[_0xbd2b('0x2e')]=_[_0xbd2b('0x42')](db[_0xbd2b('0x3c')][_0xbd2b('0x2a')]);_0x57c275[_0xbd2b('0x2f')]=_['keys'](_0x27ca58[_0xbd2b('0x2f')]);_0x57c275['filters']=_[_0xbd2b('0x30')](_0x57c275['model'],_0x57c275[_0xbd2b('0x2f')]);_0x4bcdee[_0xbd2b('0x32')]=_[_0xbd2b('0x30')](_0x57c275['model'],qs['fields'](_0x27ca58[_0xbd2b('0x2f')]['fields']));_0x4bcdee[_0xbd2b('0x32')]=_0x4bcdee[_0xbd2b('0x32')][_0xbd2b('0x33')]?_0x4bcdee[_0xbd2b('0x32')]:_0x57c275[_0xbd2b('0x2e')];if(_0x27ca58[_0xbd2b('0x2f')][_0xbd2b('0x3e')]){_0x4bcdee[_0xbd2b('0x43')]=[{'all':!![]}];}_0x4bcdee=_['merge']({},_0x4bcdee,_0x27ca58[_0xbd2b('0x44')]);return db['DeskField']['find'](_0x4bcdee)['then'](handleEntityNotFound(_0x3f1ae4,null))[_0xbd2b('0x25')](respondWithResult(_0x3f1ae4,null))['catch'](handleError(_0x3f1ae4,null));};exports[_0xbd2b('0x45')]=function(_0x45e791,_0x1074ef){return db['DeskField'][_0xbd2b('0x45')](_0x45e791['body'],{})[_0xbd2b('0x25')](respondWithResult(_0x1074ef,0xc9))[_0xbd2b('0x46')](handleError(_0x1074ef,null));};exports[_0xbd2b('0x24')]=function(_0x2dae90,_0x3194af){if(_0x2dae90[_0xbd2b('0x47')]['id']){delete _0x2dae90['body']['id'];}return db[_0xbd2b('0x3c')][_0xbd2b('0x48')]({'where':{'id':_0x2dae90[_0xbd2b('0x49')]['id']}})[_0xbd2b('0x25')](handleEntityNotFound(_0x3194af,null))[_0xbd2b('0x25')](saveUpdates(_0x2dae90[_0xbd2b('0x47')],null))[_0xbd2b('0x25')](respondWithResult(_0x3194af,null))['catch'](handleError(_0x3194af,null));};exports[_0xbd2b('0x4a')]=function(_0x4d639d,_0x3d254d){return db[_0xbd2b('0x3c')][_0xbd2b('0x48')]({'where':{'id':_0x4d639d[_0xbd2b('0x49')]['id']}})[_0xbd2b('0x25')](handleEntityNotFound(_0x3d254d,null))[_0xbd2b('0x25')](removeEntity(_0x3d254d,null))[_0xbd2b('0x46')](handleError(_0x3d254d,null));}; \ No newline at end of file +var _0xa990=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','apply','then','destroy','name','send','index','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','where','pick','filter','merge','options','DeskField','count','includeAll','findAll','params','include','find','catch','create','body','update'];(function(_0x74c1ee,_0x533e4f){var _0x43f6dc=function(_0x16a0b2){while(--_0x16a0b2){_0x74c1ee['push'](_0x74c1ee['shift']());}};_0x43f6dc(++_0x533e4f);}(_0xa990,0xc9));var _0x0a99=function(_0x295ec2,_0x565c58){_0x295ec2=_0x295ec2-0x0;var _0x547e27=_0xa990[_0x295ec2];return _0x547e27;};'use strict';var pdf=require(_0x0a99('0x0'));var emlformat=require(_0x0a99('0x1'));var rimraf=require(_0x0a99('0x2'));var zipdir=require(_0x0a99('0x3'));var jsonpatch=require(_0x0a99('0x4'));var rp=require(_0x0a99('0x5'));var moment=require(_0x0a99('0x6'));var BPromise=require(_0x0a99('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0a99('0x8'));var sox=require(_0x0a99('0x9'));var csv=require(_0x0a99('0xa'));var ejs=require(_0x0a99('0xb'));var fs=require('fs');var _=require(_0x0a99('0xc'));var squel=require(_0x0a99('0xd'));var crypto=require(_0x0a99('0xe'));var jsforce=require(_0x0a99('0xf'));var deskjs=require(_0x0a99('0x10'));var toCsv=require(_0x0a99('0xa'));var querystring=require(_0x0a99('0x11'));var Papa=require('papaparse');var Redis=require(_0x0a99('0x12'));var authService=require(_0x0a99('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a99('0x14'));var logger=require(_0x0a99('0x15'))(_0x0a99('0x16'));var utils=require(_0x0a99('0x17'));var config=require(_0x0a99('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbb3980,_0x3aaaad){_0x3aaaad=_0x3aaaad||0xcc;return function(_0x57ab88){if(_0x57ab88){return _0xbb3980[_0x0a99('0x19')](_0x3aaaad);}return _0xbb3980[_0x0a99('0x1a')](_0x3aaaad)[_0x0a99('0x1b')]();};}function respondWithResult(_0x2bbf1a,_0x346061){_0x346061=_0x346061||0xc8;return function(_0x23d018){if(_0x23d018){return _0x2bbf1a[_0x0a99('0x1a')](_0x346061)[_0x0a99('0x1c')](_0x23d018);}};}function respondWithFilteredResult(_0x4b6946,_0x5a17e1){return function(_0x2c40db){if(_0x2c40db){var _0x3ac17e=_0x2c40db['count'],_0xb7356c=_0x5a17e1['offset'],_0x49653c=_0x5a17e1[_0x0a99('0x1d')]+_0x5a17e1[_0x0a99('0x1e')],_0x3483a7;if(_0x49653c>=_0x3ac17e){_0x49653c=_0x3ac17e;_0x3483a7=0xc8;}else{_0x3483a7=0xce;}_0x4b6946[_0x0a99('0x1a')](_0x3483a7);return _0x4b6946[_0x0a99('0x1f')]('Content-Range',_0xb7356c+'-'+_0x49653c+'/'+_0x3ac17e)['json'](_0x2c40db);}return null;};}function patchUpdates(_0x27a14f){return function(_0x13df0b){try{jsonpatch[_0x0a99('0x20')](_0x13df0b,_0x27a14f,!![]);}catch(_0x416d32){return BPromise['reject'](_0x416d32);}return _0x13df0b['save']();};}function saveUpdates(_0x1b0279,_0x4d0c78){return function(_0x1e8d30){if(_0x1e8d30){return _0x1e8d30['update'](_0x1b0279)[_0x0a99('0x21')](function(_0x59da66){return _0x59da66;});}return null;};}function removeEntity(_0x1b8324,_0x356681){return function(_0x3b1d60){if(_0x3b1d60){return _0x3b1d60[_0x0a99('0x22')]()[_0x0a99('0x21')](function(){_0x1b8324[_0x0a99('0x1a')](0xcc)[_0x0a99('0x1b')]();});}};}function handleEntityNotFound(_0x1d803c,_0x398dd2){return function(_0x5745ca){if(!_0x5745ca){_0x1d803c['sendStatus'](0x194);}return _0x5745ca;};}function handleError(_0x463e02,_0xcd088){_0xcd088=_0xcd088||0x1f4;return function(_0x5cbf1f){logger['error'](_0x5cbf1f['stack']);if(_0x5cbf1f[_0x0a99('0x23')]){delete _0x5cbf1f[_0x0a99('0x23')];}_0x463e02[_0x0a99('0x1a')](_0xcd088)[_0x0a99('0x24')](_0x5cbf1f);};}exports[_0x0a99('0x25')]=function(_0x3fd406,_0x25b4c0){var _0x2f104a={},_0x163031={},_0x5722f9={'count':0x0,'rows':[]};var _0x411233=_['map'](db['DeskField']['rawAttributes'],function(_0x223bdb){return{'name':_0x223bdb[_0x0a99('0x26')],'type':_0x223bdb[_0x0a99('0x27')][_0x0a99('0x28')]};});_0x163031[_0x0a99('0x29')]=_[_0x0a99('0x2a')](_0x411233,_0x0a99('0x23'));_0x163031['query']=_[_0x0a99('0x2b')](_0x3fd406[_0x0a99('0x2c')]);_0x163031[_0x0a99('0x2d')]=_[_0x0a99('0x2e')](_0x163031['model'],_0x163031['query']);_0x2f104a['attributes']=_[_0x0a99('0x2e')](_0x163031[_0x0a99('0x29')],qs[_0x0a99('0x2f')](_0x3fd406['query'][_0x0a99('0x2f')]));_0x2f104a[_0x0a99('0x30')]=_0x2f104a[_0x0a99('0x30')][_0x0a99('0x31')]?_0x2f104a[_0x0a99('0x30')]:_0x163031[_0x0a99('0x29')];if(!_0x3fd406[_0x0a99('0x2c')]['hasOwnProperty'](_0x0a99('0x32'))){_0x2f104a[_0x0a99('0x1e')]=qs[_0x0a99('0x1e')](_0x3fd406[_0x0a99('0x2c')][_0x0a99('0x1e')]);_0x2f104a['offset']=qs[_0x0a99('0x1d')](_0x3fd406['query']['offset']);}_0x2f104a['order']=qs['sort'](_0x3fd406[_0x0a99('0x2c')]['sort']);_0x2f104a[_0x0a99('0x33')]=qs[_0x0a99('0x2d')](_[_0x0a99('0x34')](_0x3fd406[_0x0a99('0x2c')],_0x163031[_0x0a99('0x2d')]));if(_0x3fd406[_0x0a99('0x2c')][_0x0a99('0x35')]){_0x2f104a[_0x0a99('0x33')]=_[_0x0a99('0x36')](_0x2f104a[_0x0a99('0x33')],{'$or':_[_0x0a99('0x2a')](_0x411233,function(_0x3a2a78){if(_0x3a2a78[_0x0a99('0x27')]!=='VIRTUAL'){var _0x34f122={};_0x34f122[_0x3a2a78[_0x0a99('0x23')]]={'$like':'%'+_0x3fd406['query'][_0x0a99('0x35')]+'%'};return _0x34f122;}})});}_0x2f104a=_['merge']({},_0x2f104a,_0x3fd406[_0x0a99('0x37')]);var _0x563fbc={'where':_0x2f104a[_0x0a99('0x33')]};return db[_0x0a99('0x38')][_0x0a99('0x39')](_0x563fbc)[_0x0a99('0x21')](function(_0x4a5c58){_0x5722f9[_0x0a99('0x39')]=_0x4a5c58;if(_0x3fd406[_0x0a99('0x2c')][_0x0a99('0x3a')]){_0x2f104a['include']=[{'all':!![]}];}return db[_0x0a99('0x38')][_0x0a99('0x3b')](_0x2f104a);})[_0x0a99('0x21')](function(_0x1abeb0){_0x5722f9['rows']=_0x1abeb0;return _0x5722f9;})[_0x0a99('0x21')](respondWithFilteredResult(_0x25b4c0,_0x2f104a))['catch'](handleError(_0x25b4c0,null));};exports['show']=function(_0x12b942,_0x4b0be6){var _0x185495={'raw':!![],'where':{'id':_0x12b942[_0x0a99('0x3c')]['id']}},_0x583dca={};_0x583dca[_0x0a99('0x29')]=_[_0x0a99('0x2b')](db[_0x0a99('0x38')]['rawAttributes']);_0x583dca[_0x0a99('0x2c')]=_[_0x0a99('0x2b')](_0x12b942[_0x0a99('0x2c')]);_0x583dca[_0x0a99('0x2d')]=_['intersection'](_0x583dca['model'],_0x583dca['query']);_0x185495[_0x0a99('0x30')]=_['intersection'](_0x583dca[_0x0a99('0x29')],qs['fields'](_0x12b942['query']['fields']));_0x185495['attributes']=_0x185495[_0x0a99('0x30')]['length']?_0x185495[_0x0a99('0x30')]:_0x583dca[_0x0a99('0x29')];if(_0x12b942['query'][_0x0a99('0x3a')]){_0x185495[_0x0a99('0x3d')]=[{'all':!![]}];}_0x185495=_['merge']({},_0x185495,_0x12b942[_0x0a99('0x37')]);return db['DeskField'][_0x0a99('0x3e')](_0x185495)[_0x0a99('0x21')](handleEntityNotFound(_0x4b0be6,null))['then'](respondWithResult(_0x4b0be6,null))[_0x0a99('0x3f')](handleError(_0x4b0be6,null));};exports['create']=function(_0x5f1980,_0x2ae47c){return db[_0x0a99('0x38')][_0x0a99('0x40')](_0x5f1980[_0x0a99('0x41')],{})[_0x0a99('0x21')](respondWithResult(_0x2ae47c,0xc9))['catch'](handleError(_0x2ae47c,null));};exports[_0x0a99('0x42')]=function(_0x174298,_0x4525d1){if(_0x174298[_0x0a99('0x41')]['id']){delete _0x174298[_0x0a99('0x41')]['id'];}return db[_0x0a99('0x38')][_0x0a99('0x3e')]({'where':{'id':_0x174298[_0x0a99('0x3c')]['id']}})[_0x0a99('0x21')](handleEntityNotFound(_0x4525d1,null))[_0x0a99('0x21')](saveUpdates(_0x174298['body'],null))['then'](respondWithResult(_0x4525d1,null))[_0x0a99('0x3f')](handleError(_0x4525d1,null));};exports[_0x0a99('0x22')]=function(_0x74d2f3,_0x14fdd2){return db[_0x0a99('0x38')][_0x0a99('0x3e')]({'where':{'id':_0x74d2f3['params']['id']}})[_0x0a99('0x21')](handleEntityNotFound(_0x14fdd2,null))[_0x0a99('0x21')](removeEntity(_0x14fdd2,null))['catch'](handleError(_0x14fdd2,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index a4ded4b..6f407f4 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 _0xf19d=['define','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf19d,0x115));var _0xdf19=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xf19d[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0xdf19('0x0'));var util=require(_0xdf19('0x1'));var logger=require(_0xdf19('0x2'))(_0xdf19('0x3'));var moment=require(_0xdf19('0x4'));var BPromise=require(_0xdf19('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf19('0x6'));var rimraf=require(_0xdf19('0x7'));var config=require(_0xdf19('0x8'));var attributes=require(_0xdf19('0x9'));module[_0xdf19('0xa')]=function(_0x2e7171,_0x4ea69){return _0x2e7171[_0xdf19('0xb')]('DeskField',attributes,{'tableName':_0xdf19('0xc'),'paranoid':![],'indexes':[{'name':_0xdf19('0xd'),'fields':[_0xdf19('0xe'),_0xdf19('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf427=['../../config/environment','./intDeskField.attributes','exports','DeskField','int_desk_fields','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x2c091e,_0x332206){var _0x29c0e5=function(_0x369398){while(--_0x369398){_0x2c091e['push'](_0x2c091e['shift']());}};_0x29c0e5(++_0x332206);}(_0xf427,0x115));var _0x7f42=function(_0x5f6780,_0xee810b){_0x5f6780=_0x5f6780-0x0;var _0xff129c=_0xf427[_0x5f6780];return _0xff129c;};'use strict';var _=require(_0x7f42('0x0'));var util=require(_0x7f42('0x1'));var logger=require(_0x7f42('0x2'))('api');var moment=require(_0x7f42('0x3'));var BPromise=require(_0x7f42('0x4'));var rp=require(_0x7f42('0x5'));var fs=require('fs');var path=require(_0x7f42('0x6'));var rimraf=require(_0x7f42('0x7'));var config=require(_0x7f42('0x8'));var attributes=require(_0x7f42('0x9'));module[_0x7f42('0xa')]=function(_0x20d026,_0x3995a6){return _0x20d026['define'](_0x7f42('0xb'),attributes,{'tableName':_0x7f42('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x7f42('0xd'),_0x7f42('0xe')],'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 aa8b710..bcef513 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 _0xb178=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb178,0xcf));var _0x8b17=function(_0x18bee8,_0x15e890){_0x18bee8=_0x18bee8-0x0;var _0x4301a9=_0xb178[_0x18bee8];return _0x4301a9;};'use strict';var _=require(_0x8b17('0x0'));var util=require('util');var moment=require(_0x8b17('0x1'));var BPromise=require(_0x8b17('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b17('0x3'))['db'];var utils=require(_0x8b17('0x4'));var logger=require(_0x8b17('0x5'))(_0x8b17('0x6'));var config=require('../../config/environment');var jayson=require(_0x8b17('0x7'));var client=jayson['client'][_0x8b17('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe8f13b,_0x5d4de9,_0x4b29ee){return new BPromise(function(_0x274563,_0x247bd2){return client[_0x8b17('0x9')](_0xe8f13b,_0x4b29ee)[_0x8b17('0xa')](function(_0x2ac369){logger[_0x8b17('0xb')](_0x8b17('0xc'),_0x5d4de9,'request\x20sent');logger['debug'](_0x8b17('0xd'),_0x5d4de9,_0x8b17('0xe'),JSON[_0x8b17('0xf')](_0x2ac369));if(_0x2ac369[_0x8b17('0x10')]){if(_0x2ac369[_0x8b17('0x10')]['code']===0x1f4){logger[_0x8b17('0x10')]('DeskField,\x20%s,\x20%s',_0x5d4de9,_0x2ac369['error'][_0x8b17('0x11')]);return _0x247bd2(_0x2ac369[_0x8b17('0x10')][_0x8b17('0x11')]);}logger[_0x8b17('0x10')](_0x8b17('0xc'),_0x5d4de9,_0x2ac369[_0x8b17('0x10')]['message']);return _0x274563(_0x2ac369[_0x8b17('0x10')]['message']);}else{logger[_0x8b17('0xb')](_0x8b17('0xc'),_0x5d4de9,'request\x20sent');_0x274563(_0x2ac369['result']['message']);}})[_0x8b17('0x12')](function(_0x422199){logger[_0x8b17('0x10')](_0x8b17('0xc'),_0x5d4de9,_0x422199);_0x247bd2(_0x422199);});});} \ No newline at end of file +var _0xc6a6=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5b07ab,_0x157042){var _0x8c0d25=function(_0x378e64){while(--_0x378e64){_0x5b07ab['push'](_0x5b07ab['shift']());}};_0x8c0d25(++_0x157042);}(_0xc6a6,0xab));var _0x6c6a=function(_0x12abd3,_0x45c120){_0x12abd3=_0x12abd3-0x0;var _0x210643=_0xc6a6[_0x12abd3];return _0x210643;};'use strict';var _=require(_0x6c6a('0x0'));var util=require(_0x6c6a('0x1'));var moment=require(_0x6c6a('0x2'));var BPromise=require(_0x6c6a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c6a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6c6a('0x5'));var logger=require(_0x6c6a('0x6'))('rpc');var config=require(_0x6c6a('0x7'));var jayson=require(_0x6c6a('0x8'));var client=jayson[_0x6c6a('0x9')][_0x6c6a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11ab06,_0x495a75,_0x2f66a9){return new BPromise(function(_0x4a36a7,_0x38fa2b){return client[_0x6c6a('0xb')](_0x11ab06,_0x2f66a9)[_0x6c6a('0xc')](function(_0x3d86e2){logger[_0x6c6a('0xd')](_0x6c6a('0xe'),_0x495a75,_0x6c6a('0xf'));logger[_0x6c6a('0x10')](_0x6c6a('0x11'),_0x495a75,_0x6c6a('0xf'),JSON[_0x6c6a('0x12')](_0x3d86e2));if(_0x3d86e2[_0x6c6a('0x13')]){if(_0x3d86e2[_0x6c6a('0x13')][_0x6c6a('0x14')]===0x1f4){logger[_0x6c6a('0x13')](_0x6c6a('0xe'),_0x495a75,_0x3d86e2[_0x6c6a('0x13')][_0x6c6a('0x15')]);return _0x38fa2b(_0x3d86e2[_0x6c6a('0x13')][_0x6c6a('0x15')]);}logger['error'](_0x6c6a('0xe'),_0x495a75,_0x3d86e2[_0x6c6a('0x13')]['message']);return _0x4a36a7(_0x3d86e2[_0x6c6a('0x13')][_0x6c6a('0x15')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x495a75,_0x6c6a('0xf'));_0x4a36a7(_0x3d86e2[_0x6c6a('0x16')]['message']);}})[_0x6c6a('0x17')](function(_0x4c7087){logger[_0x6c6a('0x13')]('DeskField,\x20%s,\x20%s',_0x495a75,_0x4c7087);_0x38fa2b(_0x4c7087);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 7a3d871..0cb0b51 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 _0xdfb7=['/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show'];(function(_0x51a6d6,_0x3c9c49){var _0x5ef1a8=function(_0x8ff84a){while(--_0x8ff84a){_0x51a6d6['push'](_0x51a6d6['shift']());}};_0x5ef1a8(++_0x3c9c49);}(_0xdfb7,0x180));var _0x7dfb=function(_0x2866ae,_0x904928){_0x2866ae=_0x2866ae-0x0;var _0x3d9027=_0xdfb7[_0x2866ae];return _0x3d9027;};'use strict';var multer=require('multer');var util=require(_0x7dfb('0x0'));var path=require(_0x7dfb('0x1'));var timeout=require(_0x7dfb('0x2'));var express=require(_0x7dfb('0x3'));var router=express[_0x7dfb('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7dfb('0x5'));var controller=require(_0x7dfb('0x6'));router[_0x7dfb('0x7')]('/',auth[_0x7dfb('0x8')](),controller[_0x7dfb('0x9')]);router[_0x7dfb('0x7')](_0x7dfb('0xa'),auth[_0x7dfb('0x8')](),controller[_0x7dfb('0xb')]);router[_0x7dfb('0x7')](_0x7dfb('0xc'),auth[_0x7dfb('0x8')](),controller[_0x7dfb('0xd')]);router[_0x7dfb('0x7')](_0x7dfb('0xe'),auth[_0x7dfb('0x8')](),controller['getFields']);router['post']('/',auth[_0x7dfb('0x8')](),controller[_0x7dfb('0xf')]);router[_0x7dfb('0x10')](_0x7dfb('0xc'),auth[_0x7dfb('0x8')](),controller[_0x7dfb('0x11')]);router[_0x7dfb('0x12')](_0x7dfb('0xa'),auth[_0x7dfb('0x8')](),controller[_0x7dfb('0x13')]);router[_0x7dfb('0x14')]('/:id',auth[_0x7dfb('0x8')](),controller[_0x7dfb('0x15')]);module['exports']=router; \ No newline at end of file +var _0x3f31=['/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','show'];(function(_0x5ca8df,_0x3abfd5){var _0x9ae030=function(_0x37c940){while(--_0x37c940){_0x5ca8df['push'](_0x5ca8df['shift']());}};_0x9ae030(++_0x3abfd5);}(_0x3f31,0x154));var _0x13f3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3f31[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x13f3('0x0'));var util=require(_0x13f3('0x1'));var path=require('path');var timeout=require(_0x13f3('0x2'));var express=require(_0x13f3('0x3'));var router=express['Router']();var auth=require(_0x13f3('0x4'));var interaction=require(_0x13f3('0x5'));var config=require(_0x13f3('0x6'));var controller=require(_0x13f3('0x7'));router[_0x13f3('0x8')]('/',auth[_0x13f3('0x9')](),controller[_0x13f3('0xa')]);router[_0x13f3('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x13f3('0xb')]);router[_0x13f3('0x8')](_0x13f3('0xc'),auth[_0x13f3('0x9')](),controller['getConfigurations']);router[_0x13f3('0x8')](_0x13f3('0xd'),auth['isAuthenticated'](),controller[_0x13f3('0xe')]);router[_0x13f3('0xf')]('/',auth[_0x13f3('0x9')](),controller[_0x13f3('0x10')]);router[_0x13f3('0xf')](_0x13f3('0xc'),auth[_0x13f3('0x9')](),controller[_0x13f3('0x11')]);router[_0x13f3('0x12')](_0x13f3('0x13'),auth['isAuthenticated'](),controller[_0x13f3('0x14')]);router['delete']('/:id',auth[_0x13f3('0x9')](),controller['destroy']);module[_0x13f3('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 943cca5..cf1f14b 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 _0x206b=['STRING','sequelize','exports'];(function(_0x140920,_0x5464db){var _0x436ed0=function(_0x56b784){while(--_0x56b784){_0x140920['push'](_0x140920['shift']());}};_0x436ed0(++_0x5464db);}(_0x206b,0x1c6));var _0xb206=function(_0x1476fb,_0x467d01){_0x1476fb=_0x1476fb-0x0;var _0x44f57e=_0x206b[_0x1476fb];return _0x44f57e;};'use strict';var Sequelize=require(_0xb206('0x0'));module[_0xb206('0x1')]={'name':{'type':Sequelize[_0xb206('0x2')]},'username':{'type':Sequelize[_0xb206('0x2')]},'password':{'type':Sequelize[_0xb206('0x2')]},'remoteUri':{'type':Sequelize[_0xb206('0x2')]},'tenantId':{'type':Sequelize[_0xb206('0x2')]},'clientId':{'type':Sequelize[_0xb206('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x839d=['sequelize','exports','STRING'];(function(_0x331c17,_0x5ceeb4){var _0xd58915=function(_0x1def85){while(--_0x1def85){_0x331c17['push'](_0x331c17['shift']());}};_0xd58915(++_0x5ceeb4);}(_0x839d,0xb7));var _0xd839=function(_0xea9eaf,_0x15f682){_0xea9eaf=_0xea9eaf-0x0;var _0x5f2e12=_0x839d[_0xea9eaf];return _0x5f2e12;};'use strict';var Sequelize=require(_0xd839('0x0'));module[_0xd839('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd839('0x2')]},'password':{'type':Sequelize[_0xd839('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xd839('0x2')]},'clientId':{'type':Sequelize[_0xd839('0x2')]},'clientSecret':{'type':Sequelize[_0xd839('0x2')]},'serverUrl':{'type':Sequelize[_0xd839('0x2')]},'description':{'type':Sequelize[_0xd839('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 75280e1..40a1f1d 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 _0x1617=['index','rawAttributes','fieldName','key','model','keys','filters','attributes','query','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','Dynamics365Account','includeAll','include','findAll','rows','intersection','options','find','create','body','params','destroy','Dynamics365Configuration','hasOwnProperty','getConfigurations','findOne','AccountId','channel','Descriptions','getDescriptions','Subjects','Dynamics365Field','getFields','ticketType','incident','title','description','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridtype','owneridyominame','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','format','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','lastIndexOf','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','Wrong\x20credentials','GET','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','request','then','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','reject','save','update','stack','name','send'];(function(_0x23ae69,_0xbbd128){var _0x57d6b4=function(_0x31b769){while(--_0x31b769){_0x23ae69['push'](_0x23ae69['shift']());}};_0x57d6b4(++_0xbbd128);}(_0x1617,0xa5));var _0x7161=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x1617[_0x599f41];return _0x2e4d58;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7161('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7161('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7161('0x2'));var moment=require(_0x7161('0x3'));var BPromise=require(_0x7161('0x4'));var Mustache=require(_0x7161('0x5'));var util=require(_0x7161('0x6'));var path=require(_0x7161('0x7'));var sox=require(_0x7161('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7161('0x9'));var squel=require(_0x7161('0xa'));var crypto=require(_0x7161('0xb'));var jsforce=require(_0x7161('0xc'));var deskjs=require(_0x7161('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7161('0xe'));var Papa=require(_0x7161('0xf'));var Redis=require(_0x7161('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7161('0x11'));var as=require(_0x7161('0x12'));var hardwareService=require(_0x7161('0x13'));var logger=require(_0x7161('0x14'))(_0x7161('0x15'));var utils=require(_0x7161('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x7161('0x17'));var jayson=require(_0x7161('0x18'));var client=jayson['client'][_0x7161('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4299f9,_0x2a2756,_0x336de6){if(_0x336de6){var _0x39f25d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x39f25d[_0x7161('0x1a')](_0x2a2756)){return _0x4299f9;}else{throw new db[(_0x7161('0x1b'))][(_0x7161('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 _0x4299f9;}}function respondWithRpcPromise(_0x42f312,_0x286e7d,_0x378b81,_0x29ce07){return new BPromise(function(_0x1bdea9,_0x5becfa){var _0x35c2bb=_0x29ce07||client;return _0x35c2bb[_0x7161('0x1d')](_0x42f312,_0x378b81)[_0x7161('0x1e')](function(_0x5c0bb3){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x286e7d,'request\x20sent');logger['debug'](_0x7161('0x1f'),_0x286e7d,_0x7161('0x20'),JSON[_0x7161('0x21')](_0x5c0bb3));if(_0x5c0bb3[_0x7161('0x22')]){if(_0x5c0bb3[_0x7161('0x22')][_0x7161('0x23')]===0x1f4){logger[_0x7161('0x22')](_0x7161('0x24'),_0x286e7d,_0x5c0bb3['error']['message']);return _0x5becfa(_0x5c0bb3[_0x7161('0x22')][_0x7161('0x25')]);}logger['error'](_0x7161('0x24'),_0x286e7d,_0x5c0bb3[_0x7161('0x22')][_0x7161('0x25')]);return _0x1bdea9(_0x5c0bb3[_0x7161('0x22')][_0x7161('0x25')]);}else{logger[_0x7161('0x26')](_0x7161('0x24'),_0x286e7d,_0x7161('0x20'));_0x1bdea9(_0x5c0bb3[_0x7161('0x27')][_0x7161('0x25')]);}})[_0x7161('0x28')](function(_0x17c0fa){logger[_0x7161('0x22')](_0x7161('0x24'),_0x286e7d,_0x17c0fa);_0x5becfa(_0x17c0fa);});});}function respondWithStatusCode(_0xc79b0d,_0x4381d3){_0x4381d3=_0x4381d3||0xcc;return function(_0x3016f4){if(_0x3016f4){return _0xc79b0d[_0x7161('0x29')](_0x4381d3);}return _0xc79b0d[_0x7161('0x2a')](_0x4381d3)[_0x7161('0x2b')]();};}function respondWithResult(_0x5489c3,_0x2ea998){_0x2ea998=_0x2ea998||0xc8;return function(_0x164d4b){if(_0x164d4b){return _0x5489c3['status'](_0x2ea998)['json'](_0x164d4b);}};}function respondWithFilteredResult(_0x2fcaeb,_0x35b8da){return function(_0x59cd8e){if(_0x59cd8e){var _0x398ef3=_0x59cd8e[_0x7161('0x2c')],_0x567bea=_0x35b8da[_0x7161('0x2d')],_0x14ddde=_0x35b8da[_0x7161('0x2d')]+_0x35b8da[_0x7161('0x2e')],_0x22fde4;if(_0x14ddde>=_0x398ef3){_0x14ddde=_0x398ef3;_0x22fde4=0xc8;}else{_0x22fde4=0xce;}_0x2fcaeb[_0x7161('0x2a')](_0x22fde4);return _0x2fcaeb['set'](_0x7161('0x2f'),_0x567bea+'-'+_0x14ddde+'/'+_0x398ef3)[_0x7161('0x30')](_0x59cd8e);}return null;};}function patchUpdates(_0x20e729){return function(_0x4ac683){try{jsonpatch['apply'](_0x4ac683,_0x20e729,!![]);}catch(_0x2fb50c){return BPromise[_0x7161('0x31')](_0x2fb50c);}return _0x4ac683[_0x7161('0x32')]();};}function saveUpdates(_0x87e468,_0x2373bd){return function(_0x2f796b){if(_0x2f796b){return _0x2f796b[_0x7161('0x33')](_0x87e468)['then'](function(_0xce3430){return _0xce3430;});}return null;};}function removeEntity(_0x4291b8,_0x286e15){return function(_0x110a18){if(_0x110a18){return _0x110a18['destroy']()[_0x7161('0x1e')](function(){_0x4291b8[_0x7161('0x2a')](0xcc)[_0x7161('0x2b')]();});}};}function handleEntityNotFound(_0x167537,_0x232ab2){return function(_0x3d6d1f){if(!_0x3d6d1f){_0x167537[_0x7161('0x29')](0x194);}return _0x3d6d1f;};}function handleError(_0x54d6e1,_0x21dd45){_0x21dd45=_0x21dd45||0x1f4;return function(_0x178eb6){logger['error'](_0x178eb6[_0x7161('0x34')]);if(_0x178eb6[_0x7161('0x35')]){delete _0x178eb6[_0x7161('0x35')];}_0x54d6e1[_0x7161('0x2a')](_0x21dd45)[_0x7161('0x36')](_0x178eb6);};}exports[_0x7161('0x37')]=function(_0x38b7b6,_0x3abfbb){var _0x4919c1={},_0x4f4373={},_0x105ad8={'count':0x0,'rows':[]};var _0x330ab8=_['map'](db['Dynamics365Account'][_0x7161('0x38')],function(_0x28cbd8){return{'name':_0x28cbd8[_0x7161('0x39')],'type':_0x28cbd8['type'][_0x7161('0x3a')]};});_0x4f4373[_0x7161('0x3b')]=_['map'](_0x330ab8,_0x7161('0x35'));_0x4f4373['query']=_[_0x7161('0x3c')](_0x38b7b6['query']);_0x4f4373[_0x7161('0x3d')]=_['intersection'](_0x4f4373[_0x7161('0x3b')],_0x4f4373['query']);_0x4919c1[_0x7161('0x3e')]=_['intersection'](_0x4f4373['model'],qs['fields'](_0x38b7b6[_0x7161('0x3f')][_0x7161('0x40')]));_0x4919c1[_0x7161('0x3e')]=_0x4919c1['attributes'][_0x7161('0x41')]?_0x4919c1[_0x7161('0x3e')]:_0x4f4373[_0x7161('0x3b')];if(!_0x38b7b6[_0x7161('0x3f')]['hasOwnProperty'](_0x7161('0x42'))){_0x4919c1[_0x7161('0x2e')]=qs['limit'](_0x38b7b6[_0x7161('0x3f')][_0x7161('0x2e')]);_0x4919c1[_0x7161('0x2d')]=qs[_0x7161('0x2d')](_0x38b7b6[_0x7161('0x3f')][_0x7161('0x2d')]);}_0x4919c1[_0x7161('0x43')]=qs[_0x7161('0x44')](_0x38b7b6[_0x7161('0x3f')][_0x7161('0x44')]);_0x4919c1[_0x7161('0x45')]=qs[_0x7161('0x3d')](_[_0x7161('0x46')](_0x38b7b6[_0x7161('0x3f')],_0x4f4373[_0x7161('0x3d')]));if(_0x38b7b6[_0x7161('0x3f')][_0x7161('0x47')]){_0x4919c1[_0x7161('0x45')]=_[_0x7161('0x48')](_0x4919c1[_0x7161('0x45')],{'$or':_[_0x7161('0x49')](_0x330ab8,function(_0x1dde9a){if(_0x1dde9a[_0x7161('0x4a')]!==_0x7161('0x4b')){var _0x13844b={};_0x13844b[_0x1dde9a['name']]={'$like':'%'+_0x38b7b6[_0x7161('0x3f')][_0x7161('0x47')]+'%'};return _0x13844b;}})});}_0x4919c1=_[_0x7161('0x48')]({},_0x4919c1,_0x38b7b6['options']);var _0x2af8ee={'where':_0x4919c1['where']};return db[_0x7161('0x4c')][_0x7161('0x2c')](_0x2af8ee)[_0x7161('0x1e')](function(_0x4f6421){_0x105ad8[_0x7161('0x2c')]=_0x4f6421;if(_0x38b7b6['query'][_0x7161('0x4d')]){_0x4919c1[_0x7161('0x4e')]=[{'all':!![]}];}return db[_0x7161('0x4c')][_0x7161('0x4f')](_0x4919c1);})[_0x7161('0x1e')](function(_0x327399){_0x105ad8[_0x7161('0x50')]=_0x327399;return _0x105ad8;})[_0x7161('0x1e')](respondWithFilteredResult(_0x3abfbb,_0x4919c1))[_0x7161('0x28')](handleError(_0x3abfbb,null));};exports['show']=function(_0x59da5e,_0x59f91b){var _0x4f8195={'raw':![],'where':{'id':_0x59da5e['params']['id']}},_0x1db136={};_0x1db136[_0x7161('0x3b')]=_[_0x7161('0x3c')](db[_0x7161('0x4c')][_0x7161('0x38')]);_0x1db136['query']=_[_0x7161('0x3c')](_0x59da5e[_0x7161('0x3f')]);_0x1db136[_0x7161('0x3d')]=_[_0x7161('0x51')](_0x1db136[_0x7161('0x3b')],_0x1db136[_0x7161('0x3f')]);_0x4f8195[_0x7161('0x3e')]=_['intersection'](_0x1db136[_0x7161('0x3b')],qs[_0x7161('0x40')](_0x59da5e[_0x7161('0x3f')]['fields']));_0x4f8195[_0x7161('0x3e')]=_0x4f8195[_0x7161('0x3e')]['length']?_0x4f8195['attributes']:_0x1db136['model'];if(_0x59da5e[_0x7161('0x3f')][_0x7161('0x4d')]){_0x4f8195['include']=[{'all':!![]}];}_0x4f8195=_[_0x7161('0x48')]({},_0x4f8195,_0x59da5e[_0x7161('0x52')]);return db[_0x7161('0x4c')][_0x7161('0x53')](_0x4f8195)[_0x7161('0x1e')](handleEntityNotFound(_0x59f91b,null))[_0x7161('0x1e')](respondWithResult(_0x59f91b,null))[_0x7161('0x28')](handleError(_0x59f91b,null));};exports['create']=function(_0x1bab36,_0x441997){return db[_0x7161('0x4c')][_0x7161('0x54')](_0x1bab36[_0x7161('0x55')],{})[_0x7161('0x1e')](respondWithResult(_0x441997,0xc9))[_0x7161('0x28')](handleError(_0x441997,null));};exports[_0x7161('0x33')]=function(_0x543286,_0x4803d5){if(_0x543286[_0x7161('0x55')]['id']){delete _0x543286[_0x7161('0x55')]['id'];}return db[_0x7161('0x4c')][_0x7161('0x53')]({'where':{'id':_0x543286[_0x7161('0x56')]['id']}})['then'](handleEntityNotFound(_0x4803d5,null))[_0x7161('0x1e')](saveUpdates(_0x543286['body'],null))['then'](respondWithResult(_0x4803d5,null))[_0x7161('0x28')](handleError(_0x4803d5,null));};exports[_0x7161('0x57')]=function(_0x58c0c0,_0x3cc145){return db['Dynamics365Account'][_0x7161('0x53')]({'where':{'id':_0x58c0c0[_0x7161('0x56')]['id']}})[_0x7161('0x1e')](handleEntityNotFound(_0x3cc145,null))[_0x7161('0x1e')](removeEntity(_0x3cc145,null))[_0x7161('0x28')](handleError(_0x3cc145,null));};exports['getConfigurations']=function(_0x2038ef,_0x5dc0ee,_0x520373){var _0x460d6b={};var _0x3eab6e={};var _0x5b3d94;var _0x15d2c9;return db[_0x7161('0x4c')]['findOne']({'where':{'id':_0x2038ef[_0x7161('0x56')]['id']}})['then'](handleEntityNotFound(_0x5dc0ee,null))[_0x7161('0x1e')](function(_0x5f098e){if(_0x5f098e){_0x5b3d94=_0x5f098e;_0x3eab6e[_0x7161('0x3b')]=_[_0x7161('0x3c')](db[_0x7161('0x58')][_0x7161('0x38')]);_0x3eab6e[_0x7161('0x3f')]=_[_0x7161('0x3c')](_0x2038ef['query']);_0x3eab6e[_0x7161('0x3d')]=_[_0x7161('0x51')](_0x3eab6e['model'],_0x3eab6e[_0x7161('0x3f')]);_0x460d6b[_0x7161('0x3e')]=_[_0x7161('0x51')](_0x3eab6e[_0x7161('0x3b')],qs[_0x7161('0x40')](_0x2038ef[_0x7161('0x3f')][_0x7161('0x40')]));_0x460d6b[_0x7161('0x3e')]=_0x460d6b['attributes'][_0x7161('0x41')]?_0x460d6b['attributes']:_0x3eab6e[_0x7161('0x3b')];_0x460d6b[_0x7161('0x43')]=qs[_0x7161('0x44')](_0x2038ef['query'][_0x7161('0x44')]);_0x460d6b[_0x7161('0x45')]=qs['filters'](_['pick'](_0x2038ef['query'],_0x3eab6e[_0x7161('0x3d')]));if(_0x2038ef[_0x7161('0x3f')]['filter']){_0x460d6b[_0x7161('0x45')]=_['merge'](_0x460d6b[_0x7161('0x45')],{'$or':_['map'](_0x460d6b['attributes'],function(_0xd260ee){var _0x44a12c={};_0x44a12c[_0xd260ee]={'$like':'%'+_0x2038ef[_0x7161('0x3f')][_0x7161('0x47')]+'%'};return _0x44a12c;})});}_0x460d6b=_[_0x7161('0x48')]({},_0x460d6b,_0x2038ef[_0x7161('0x52')]);return _0x5b3d94['getConfigurations'](_0x460d6b);}})[_0x7161('0x1e')](function(_0x2f6552){if(_0x2f6552){_0x15d2c9=_0x2f6552[_0x7161('0x41')];if(!_0x2038ef[_0x7161('0x3f')][_0x7161('0x59')](_0x7161('0x42'))){_0x460d6b[_0x7161('0x2e')]=qs[_0x7161('0x2e')](_0x2038ef['query']['limit']);_0x460d6b[_0x7161('0x2d')]=qs[_0x7161('0x2d')](_0x2038ef[_0x7161('0x3f')][_0x7161('0x2d')]);}return _0x5b3d94[_0x7161('0x5a')](_0x460d6b);}})[_0x7161('0x1e')](function(_0x3ec552){if(_0x3ec552){return _0x3ec552?{'count':_0x15d2c9,'rows':_0x3ec552}:null;}})[_0x7161('0x1e')](respondWithResult(_0x5dc0ee,null))[_0x7161('0x28')](handleError(_0x5dc0ee,null));};exports['addConfiguration']=function(_0xf7740c,_0x469910,_0x3744ab){if(_0xf7740c[_0x7161('0x55')]['id']){delete _0xf7740c[_0x7161('0x55')]['id'];}return db[_0x7161('0x4c')][_0x7161('0x5b')]({'where':{'id':_0xf7740c[_0x7161('0x56')]['id']}})[_0x7161('0x1e')](handleEntityNotFound(_0x469910,null))[_0x7161('0x1e')](function(_0x1d7654){if(_0x1d7654){_0xf7740c[_0x7161('0x55')][_0x7161('0x5c')]=_0x1d7654['id'];_0xf7740c[_0x7161('0x55')]['Subjects']=integrations['getSubjects'](_0xf7740c[_0x7161('0x55')][_0x7161('0x5d')],_0xf7740c['body'][_0x7161('0x4a')]);_0xf7740c[_0x7161('0x55')][_0x7161('0x5e')]=integrations[_0x7161('0x5f')](_0xf7740c[_0x7161('0x55')][_0x7161('0x5d')],_0xf7740c[_0x7161('0x55')][_0x7161('0x4a')]);return db['Dynamics365Configuration'][_0x7161('0x54')](_0xf7740c[_0x7161('0x55')],{'include':[{'model':db['Dynamics365Field'],'as':_0x7161('0x60')},{'model':db[_0x7161('0x61')],'as':'Descriptions'}]});}return null;})[_0x7161('0x1e')](respondWithResult(_0x469910,null))[_0x7161('0x28')](handleError(_0x469910,null));};exports[_0x7161('0x62')]=function(_0x13ceba,_0x1a18f8,_0x5cc747){var _0x227f2e=_0x13ceba[_0x7161('0x3f')][_0x7161('0x63')];var _0x2b38ce=_0x227f2e===_0x7161('0x64')?'Incident':'PhoneCall';var _0x9c1559='';var _0x2ed672='';var _0x5afce8='';var _0x4e4446='';var _0x21a229='';var _0x317ef4='';var _0x9368ee='';var _0x11e07f='';var _0x33c71f=[_0x7161('0x65'),_0x7161('0x66'),_0x7161('0x67'),_0x7161('0x68'),_0x7161('0x69'),_0x7161('0x6a'),_0x7161('0x6b'),_0x7161('0x6c'),_0x7161('0x6d'),_0x7161('0x6e')];var _0x483353=['accountidname','accountidyominame','actualserviceunits',_0x7161('0x6f'),_0x7161('0x70'),_0x7161('0x71'),_0x7161('0x72'),'contractidname',_0x7161('0x73'),_0x7161('0x74'),_0x7161('0x75'),_0x7161('0x76'),_0x7161('0x77'),_0x7161('0x78'),_0x7161('0x79'),_0x7161('0x7a'),_0x7161('0x7b'),_0x7161('0x7c'),_0x7161('0x7d'),_0x7161('0x7e'),_0x7161('0x7f'),_0x7161('0x80'),_0x7161('0x81'),_0x7161('0x82'),_0x7161('0x83'),_0x7161('0x84'),_0x7161('0x85'),_0x7161('0x86'),_0x7161('0x87'),'lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0x7161('0x88'),_0x7161('0x89'),_0x7161('0x8a'),_0x7161('0x8b'),_0x7161('0x8c'),'msdyn_incidenttypename',_0x7161('0x8d'),_0x7161('0x8e'),_0x7161('0x8f'),'overriddencreatedon','owneridname',_0x7161('0x90'),_0x7161('0x91'),'parentcaseidname',_0x7161('0x92'),'primarycontactidyominame',_0x7161('0x93'),_0x7161('0x94'),_0x7161('0x95'),_0x7161('0x96'),_0x7161('0x97'),_0x7161('0x98'),_0x7161('0x99'),_0x7161('0x9a'),_0x7161('0x9b'),_0x7161('0x9c'),_0x7161('0x9d'),_0x7161('0x9e'),'statecode','statuscode',_0x7161('0x9f'),_0x7161('0xa0'),_0x7161('0xa1'),_0x7161('0xa2'),_0x7161('0xa3'),_0x7161('0xa4'),_0x7161('0xa5')];var _0x2eba90=_0x33c71f['concat'](_0x483353);return db[_0x7161('0x4c')]['findOne']({'where':{'id':_0x13ceba[_0x7161('0x56')]['id']},'attributes':['id',_0x7161('0xa6'),_0x7161('0xa7'),_0x7161('0xa8'),_0x7161('0xa9'),_0x7161('0xaa'),_0x7161('0xab')]})[_0x7161('0x1e')](handleEntityNotFound(_0x1a18f8,null))[_0x7161('0x1e')](function(_0x3baef9){if(_0x3baef9){_0x11e07f=_0x3baef9[_0x7161('0xa8')];var _0x1dc19f=_0x11e07f[_0x7161('0xac')](-0x1);if(_0x1dc19f==='/'){_0x11e07f=_0x11e07f[_0x7161('0xad')](0x0,_0x11e07f['lastIndexOf'](_0x1dc19f));}_0x9368ee=util[_0x7161('0xae')]('%s/api/data/v9.0/',_0x11e07f);var _0x2ecf28={'method':_0x7161('0xaf'),'uri':_0x7161('0xb0')+_0x3baef9['tenantId']+_0x7161('0xb1'),'form':{'client_id':_0x3baef9[_0x7161('0xaa')],'resource':_0x11e07f,'username':_0x3baef9[_0x7161('0xa6')],'password':_0x3baef9[_0x7161('0xa7')],'grant_type':_0x7161('0xa7'),'client_secret':_0x3baef9[_0x7161('0xab')]},'json':!![]};return rp(_0x2ecf28);}})[_0x7161('0x1e')](function(_0x6ae69a){_0x317ef4=_0x6ae69a[_0x7161('0xb2')];var _0x35ec30={'method':'GET','uri':encodeURI(_0x9368ee+_0x7161('0xb3')+_0x2b38ce+'\x27'),'headers':{'Authorization':_0x7161('0xb4')+_0x317ef4,'If-None-Match':null,'OData-Version':_0x7161('0xb5')},'json':!![]};return rp(_0x35ec30);})['then'](function(_0x4eb04d){var _0x307af0=_0x4eb04d['value'][0x0];var _0x35e11c=_0x307af0[_0x7161('0xb6')];var _0xa04cad={'method':'GET','uri':_0x9368ee+_0x7161('0xb7')+_0x35e11c+_0x7161('0xb8'),'headers':{'Authorization':_0x7161('0xb4')+_0x317ef4,'If-None-Match':null,'OData-Version':_0x7161('0xb5')},'json':!![]};return rp(_0xa04cad);})['then'](function(_0x18676c){_0x9c1559=_0x18676c;_0x2ed672=_0x9c1559[_0x7161('0xb9')];_0x2ed672=_[_0x7161('0xba')](_0x2ed672,function(_0x2f6f8d){return!_0x2eba90[_0x7161('0xbb')](_0x2f6f8d[_0x7161('0xbc')]);});var _0x5bf9c0=[];var _0x3cb4d8=[];_0x2ed672[_0x7161('0xbd')](function(_0x569042){if(_0x569042[_0x7161('0xbe')]){var _0x3cd60e=_0x569042['@odata.type'][_0x7161('0xad')](_0x569042[_0x7161('0xbe')]['lastIndexOf']('.')+0x1);if(_0x3cd60e===_0x7161('0xbf')){_0x5bf9c0[_0x7161('0xc0')](getSelectList(_0x9368ee,_0x227f2e,_0x3cb4d8,_0x9c1559[_0x7161('0xb6')],_0x569042['MetadataId'],_0x317ef4));}}});return Promise[_0x7161('0xc1')](_0x5bf9c0);})[_0x7161('0x1e')](function(_0x1a61be){_0x5afce8=_0x1a61be[0x0];var _0xceac6e=[];var _0x504164=[];_0x2ed672[_0x7161('0xbd')](function(_0x25162e){if(!_[_0x7161('0xc2')](_0x25162e[_0x7161('0xbe')])){var _0xf4d48c=_0x25162e['@odata.type'][_0x7161('0xad')](_0x25162e[_0x7161('0xbe')][_0x7161('0xc3')]('.')+0x1);if(_0xf4d48c===_0x7161('0xc4')){_0xceac6e[_0x7161('0xc0')](getBooleanList(_0x9368ee,_0x227f2e,_0x504164,_0x9c1559['MetadataId'],_0x25162e[_0x7161('0xb6')],_0x317ef4));}}});return Promise[_0x7161('0xc1')](_0xceac6e);})[_0x7161('0x1e')](function(_0x447f44){_0x4e4446=_0x447f44[0x0];var _0x97393=[];var _0x44356c=[];_0x2ed672['forEach'](function(_0x3cf57d){if(_0x3cf57d[_0x7161('0xbe')]){var _0x26ce0c=_0x3cf57d[_0x7161('0xbe')][_0x7161('0xad')](_0x3cf57d[_0x7161('0xbe')][_0x7161('0xc3')]('.')+0x1);if(_0x26ce0c==='StringAttributeMetadata'||_0x26ce0c==='DoubleAttributeMetadata'||_0x26ce0c===_0x7161('0xc5')||_0x26ce0c===_0x7161('0xc6')||_0x26ce0c==='MemoAttributeMetadata'||_0x26ce0c===_0x7161('0xc7')||_0x26ce0c==='StatusAttributeMetadata'||_0x26ce0c==='EntityNameAttributeMetadata'||_0x26ce0c===_0x7161('0xc8')||_0x26ce0c===_0x7161('0xc9')){_0x97393[_0x7161('0xc0')](getInputList(_0x9368ee,_0x227f2e,_0x26ce0c,_0x44356c,_0x9c1559[_0x7161('0xb6')],_0x3cf57d[_0x7161('0xb6')],_0x317ef4));}}});return Promise[_0x7161('0xc1')](_0x97393);})['then'](function(_0x46bcec){_0x21a229=_0x46bcec[0x0];var _0x1865ce=_0x5afce8[_0x7161('0xca')](_0x4e4446)[_0x7161('0xca')](_0x21a229);var _0xde8d5b={'count':_0x1865ce[_0x7161('0x41')],'rows':_0x1865ce};return _0xde8d5b;})[_0x7161('0x1e')](respondWithResult(_0x1a18f8,null))[_0x7161('0x28')](function(_0x316aec){var _0xaacf66=_0x13ceba[_0x7161('0x3f')]['test']?0x1f4:_0x316aec[_0x7161('0xcb')]||0x1f4;logger[_0x7161('0x22')](_0x316aec[_0x7161('0x34')]);delete _0x316aec[_0x7161('0x35')];if(_0xaacf66===0x191){_0xaacf66=0x190;}_0x1a18f8['status'](_0xaacf66)[_0x7161('0x36')](_0x13ceba[_0x7161('0x3f')][_0x7161('0x1a')]?{'message':_0x7161('0xcc'),'statusCode':_0x316aec[_0x7161('0xcb')]}:_0x316aec);});};function getSelectList(_0xfe3a76,_0x1d647e,_0x4a1b8f,_0x2e016d,_0x537325,_0x1de529){var _0x3eaa52={'method':_0x7161('0xcd'),'uri':_0xfe3a76+_0x7161('0xb7')+_0x2e016d+')/Attributes('+_0x537325+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x7161('0xce'),'headers':{'Authorization':_0x7161('0xb4')+_0x1de529,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3eaa52)[_0x7161('0x1e')](function(_0x48cc79){var _0x3b59bd=[];var _0x47b421=_0x48cc79[_0x7161('0xcf')][_0x7161('0xd0')];_0x47b421[_0x7161('0xbd')](function(_0x175191){_0x3b59bd[_0x7161('0xc0')]({'name':_0x175191['Label'][_0x7161('0xd1')][_0x7161('0xd2')],'value':String(_0x175191[_0x7161('0xd3')])});});var _0x3647f6={'id':_0x1d647e+'_'+_0x48cc79['LogicalName'],'name':_0x48cc79[_0x7161('0xd4')]['UserLocalizedLabel'][_0x7161('0xd2')],'custom':![],'options':_0x3b59bd};_0x4a1b8f[_0x7161('0xc0')](_0x3647f6);return _0x4a1b8f;});}function getBooleanList(_0x5d48c7,_0x43735d,_0x38ac19,_0x26777a,_0x1a9b1b,_0x38a3a5){var _0x141d7f={'method':_0x7161('0xcd'),'uri':_0x5d48c7+_0x7161('0xb7')+_0x26777a+_0x7161('0xd5')+_0x1a9b1b+_0x7161('0xd6'),'headers':{'Authorization':'Bearer\x20'+_0x38a3a5,'If-None-Match':null,'OData-Version':_0x7161('0xb5')},'json':!![]};return rp(_0x141d7f)[_0x7161('0x1e')](function(_0x50ab2a){var _0x3f4320=[];_0x3f4320['push']({'name':_0x50ab2a[_0x7161('0xcf')][_0x7161('0xd7')][_0x7161('0xd2')][_0x7161('0xd1')][_0x7161('0xd2')],'value':_0x7161('0xd8')},{'name':_0x50ab2a[_0x7161('0xcf')][_0x7161('0xd9')][_0x7161('0xd2')][_0x7161('0xd1')][_0x7161('0xd2')],'value':'false'});var _0x2476c9={'id':_0x43735d+'_'+_0x50ab2a[_0x7161('0xbc')],'name':_0x50ab2a[_0x7161('0xd4')][_0x7161('0xd1')][_0x7161('0xd2')],'custom':![],'options':_0x3f4320};_0x38ac19[_0x7161('0xc0')](_0x2476c9);return _0x38ac19;});}function getInputList(_0x114720,_0x1bf8e6,_0x168128,_0x2ac8d3,_0xcab222,_0x4e92a2,_0xb819c3){var _0x5c88a3={'method':_0x7161('0xcd'),'uri':_0x114720+'EntityDefinitions('+_0xcab222+_0x7161('0xd5')+_0x4e92a2+_0x7161('0xda')+_0x168128+_0x7161('0xdb'),'headers':{'Authorization':_0x7161('0xb4')+_0xb819c3,'If-None-Match':null,'OData-Version':_0x7161('0xb5')},'json':!![]};return rp(_0x5c88a3)['then'](function(_0x3ca0bc){var _0xf57dd0={'id':_0x1bf8e6+'_'+_0x3ca0bc[_0x7161('0xbc')],'name':_0x3ca0bc[_0x7161('0xd4')]['UserLocalizedLabel']?_0x3ca0bc['DisplayName'][_0x7161('0xd1')][_0x7161('0xd2')]:_0x3ca0bc['LogicalName'],'custom':![],'options':[]};_0x2ac8d3['push'](_0xf57dd0);return _0x2ac8d3;});} \ No newline at end of file +var _0xb770=['customeridname','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','concat','username','password','tenantId','clientId','clientSecret','remoteUri','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId','EntityDefinitions(','4.0','Attributes','includes','forEach','@odata.type','PicklistAttributeMetadata','isNil','BooleanAttributeMetadata','push','all','StringAttributeMetadata','DoubleAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Value','LogicalName','DisplayName','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption',')/Microsoft.Dynamics.CRM.','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','test','request','then','info','request\x20sent','debug','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','stack','name','send','map','key','query','intersection','model','attributes','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','Dynamics365Account','findAll','rows','show','rawAttributes','keys','fields','include','find','create','catch','body','params','getConfigurations','findOne','Dynamics365Configuration','filter','length','nolimit','Subjects','getSubjects','Descriptions','getDescriptions','type','Dynamics365Field','getFields','ticketType','incident','Incident','PhoneCall','title','description','caseorigincode','subject','regardingobjectid','phonecall_activity_parties','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame'];(function(_0x24fff3,_0x5af505){var _0xe1d410=function(_0x1722af){while(--_0x1722af){_0x24fff3['push'](_0x24fff3['shift']());}};_0xe1d410(++_0x5af505);}(_0xb770,0x1e2));var _0x0b77=function(_0x2a02d6,_0x3c10d){_0x2a02d6=_0x2a02d6-0x0;var _0x1a6a2f=_0xb770[_0x2a02d6];return _0x1a6a2f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0b77('0x0'));var rimraf=require(_0x0b77('0x1'));var zipdir=require(_0x0b77('0x2'));var jsonpatch=require(_0x0b77('0x3'));var rp=require(_0x0b77('0x4'));var moment=require(_0x0b77('0x5'));var BPromise=require(_0x0b77('0x6'));var Mustache=require(_0x0b77('0x7'));var util=require(_0x0b77('0x8'));var path=require(_0x0b77('0x9'));var sox=require(_0x0b77('0xa'));var csv=require(_0x0b77('0xb'));var ejs=require(_0x0b77('0xc'));var fs=require('fs');var _=require(_0x0b77('0xd'));var squel=require(_0x0b77('0xe'));var crypto=require('crypto');var jsforce=require(_0x0b77('0xf'));var deskjs=require(_0x0b77('0x10'));var toCsv=require(_0x0b77('0xb'));var querystring=require(_0x0b77('0x11'));var Papa=require(_0x0b77('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0b77('0x13'));var as=require(_0x0b77('0x14'));var hardwareService=require(_0x0b77('0x15'));var logger=require(_0x0b77('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x0b77('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0b77('0x18'));var jayson=require(_0x0b77('0x19'));var client=jayson[_0x0b77('0x1a')][_0x0b77('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x5c9055,_0x319664,_0x183ea8){if(_0x183ea8){var _0x140a6b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x140a6b[_0x0b77('0x1c')](_0x319664)){return _0x5c9055;}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 _0x5c9055;}}function respondWithRpcPromise(_0x2314b9,_0x4d909c,_0x19242b,_0x319b04){return new BPromise(function(_0x29699b,_0x51c4d8){var _0x4265e9=_0x319b04||client;return _0x4265e9[_0x0b77('0x1d')](_0x2314b9,_0x19242b)[_0x0b77('0x1e')](function(_0x2a920b){logger[_0x0b77('0x1f')]('Dynamics365Account,\x20%s,\x20%s',_0x4d909c,_0x0b77('0x20'));logger[_0x0b77('0x21')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4d909c,'request\x20sent',JSON[_0x0b77('0x22')](_0x2a920b));if(_0x2a920b[_0x0b77('0x23')]){if(_0x2a920b[_0x0b77('0x23')][_0x0b77('0x24')]===0x1f4){logger[_0x0b77('0x23')]('Dynamics365Account,\x20%s,\x20%s',_0x4d909c,_0x2a920b[_0x0b77('0x23')]['message']);return _0x51c4d8(_0x2a920b[_0x0b77('0x23')]['message']);}logger[_0x0b77('0x23')](_0x0b77('0x25'),_0x4d909c,_0x2a920b[_0x0b77('0x23')][_0x0b77('0x26')]);return _0x29699b(_0x2a920b[_0x0b77('0x23')][_0x0b77('0x26')]);}else{logger[_0x0b77('0x1f')](_0x0b77('0x25'),_0x4d909c,_0x0b77('0x20'));_0x29699b(_0x2a920b[_0x0b77('0x27')][_0x0b77('0x26')]);}})['catch'](function(_0x338816){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4d909c,_0x338816);_0x51c4d8(_0x338816);});});}function respondWithStatusCode(_0x5d1450,_0x2f9084){_0x2f9084=_0x2f9084||0xcc;return function(_0xeca5d7){if(_0xeca5d7){return _0x5d1450[_0x0b77('0x28')](_0x2f9084);}return _0x5d1450[_0x0b77('0x29')](_0x2f9084)[_0x0b77('0x2a')]();};}function respondWithResult(_0x2ec8d7,_0x4af416){_0x4af416=_0x4af416||0xc8;return function(_0x857461){if(_0x857461){return _0x2ec8d7[_0x0b77('0x29')](_0x4af416)[_0x0b77('0x2b')](_0x857461);}};}function respondWithFilteredResult(_0x4f8ddb,_0x1c8408){return function(_0x31ae45){if(_0x31ae45){var _0x578aaa=_0x31ae45[_0x0b77('0x2c')],_0x4d08a1=_0x1c8408['offset'],_0x58215d=_0x1c8408[_0x0b77('0x2d')]+_0x1c8408[_0x0b77('0x2e')],_0x28af40;if(_0x58215d>=_0x578aaa){_0x58215d=_0x578aaa;_0x28af40=0xc8;}else{_0x28af40=0xce;}_0x4f8ddb[_0x0b77('0x29')](_0x28af40);return _0x4f8ddb[_0x0b77('0x2f')](_0x0b77('0x30'),_0x4d08a1+'-'+_0x58215d+'/'+_0x578aaa)[_0x0b77('0x2b')](_0x31ae45);}return null;};}function patchUpdates(_0x4547cd){return function(_0x4b0b5e){try{jsonpatch['apply'](_0x4b0b5e,_0x4547cd,!![]);}catch(_0x2402d1){return BPromise['reject'](_0x2402d1);}return _0x4b0b5e[_0x0b77('0x31')]();};}function saveUpdates(_0x371b9f,_0x3a6058){return function(_0x4e31ee){if(_0x4e31ee){return _0x4e31ee[_0x0b77('0x32')](_0x371b9f)[_0x0b77('0x1e')](function(_0x3280bd){return _0x3280bd;});}return null;};}function removeEntity(_0x422014,_0x1a9f63){return function(_0x387d6e){if(_0x387d6e){return _0x387d6e[_0x0b77('0x33')]()[_0x0b77('0x1e')](function(){_0x422014['status'](0xcc)[_0x0b77('0x2a')]();});}};}function handleEntityNotFound(_0x10e5c5,_0x3fcb3d){return function(_0x5b06c1){if(!_0x5b06c1){_0x10e5c5[_0x0b77('0x28')](0x194);}return _0x5b06c1;};}function handleError(_0x308917,_0x54988f){_0x54988f=_0x54988f||0x1f4;return function(_0xc07407){logger[_0x0b77('0x23')](_0xc07407[_0x0b77('0x34')]);if(_0xc07407[_0x0b77('0x35')]){delete _0xc07407[_0x0b77('0x35')];}_0x308917[_0x0b77('0x29')](_0x54988f)[_0x0b77('0x36')](_0xc07407);};}exports['index']=function(_0x59555a,_0x17b6e1){var _0x2479e4={},_0x454fa2={},_0x1a053e={'count':0x0,'rows':[]};var _0x4c8f9b=_[_0x0b77('0x37')](db['Dynamics365Account']['rawAttributes'],function(_0x490cec){return{'name':_0x490cec['fieldName'],'type':_0x490cec['type'][_0x0b77('0x38')]};});_0x454fa2['model']=_['map'](_0x4c8f9b,_0x0b77('0x35'));_0x454fa2[_0x0b77('0x39')]=_['keys'](_0x59555a[_0x0b77('0x39')]);_0x454fa2['filters']=_[_0x0b77('0x3a')](_0x454fa2[_0x0b77('0x3b')],_0x454fa2[_0x0b77('0x39')]);_0x2479e4[_0x0b77('0x3c')]=_[_0x0b77('0x3a')](_0x454fa2[_0x0b77('0x3b')],qs['fields'](_0x59555a[_0x0b77('0x39')]['fields']));_0x2479e4[_0x0b77('0x3c')]=_0x2479e4[_0x0b77('0x3c')]['length']?_0x2479e4[_0x0b77('0x3c')]:_0x454fa2['model'];if(!_0x59555a[_0x0b77('0x39')][_0x0b77('0x3d')]('nolimit')){_0x2479e4['limit']=qs[_0x0b77('0x2e')](_0x59555a['query'][_0x0b77('0x2e')]);_0x2479e4[_0x0b77('0x2d')]=qs[_0x0b77('0x2d')](_0x59555a['query'][_0x0b77('0x2d')]);}_0x2479e4[_0x0b77('0x3e')]=qs[_0x0b77('0x3f')](_0x59555a[_0x0b77('0x39')][_0x0b77('0x3f')]);_0x2479e4[_0x0b77('0x40')]=qs[_0x0b77('0x41')](_[_0x0b77('0x42')](_0x59555a[_0x0b77('0x39')],_0x454fa2[_0x0b77('0x41')]));if(_0x59555a[_0x0b77('0x39')]['filter']){_0x2479e4[_0x0b77('0x40')]=_[_0x0b77('0x43')](_0x2479e4[_0x0b77('0x40')],{'$or':_[_0x0b77('0x37')](_0x4c8f9b,function(_0x2ee915){if(_0x2ee915['type']!==_0x0b77('0x44')){var _0x35a870={};_0x35a870[_0x2ee915[_0x0b77('0x35')]]={'$like':'%'+_0x59555a[_0x0b77('0x39')]['filter']+'%'};return _0x35a870;}})});}_0x2479e4=_[_0x0b77('0x43')]({},_0x2479e4,_0x59555a[_0x0b77('0x45')]);var _0x3d877f={'where':_0x2479e4[_0x0b77('0x40')]};return db['Dynamics365Account']['count'](_0x3d877f)[_0x0b77('0x1e')](function(_0x4753bb){_0x1a053e[_0x0b77('0x2c')]=_0x4753bb;if(_0x59555a[_0x0b77('0x39')][_0x0b77('0x46')]){_0x2479e4['include']=[{'all':!![]}];}return db[_0x0b77('0x47')][_0x0b77('0x48')](_0x2479e4);})[_0x0b77('0x1e')](function(_0x186656){_0x1a053e[_0x0b77('0x49')]=_0x186656;return _0x1a053e;})['then'](respondWithFilteredResult(_0x17b6e1,_0x2479e4))['catch'](handleError(_0x17b6e1,null));};exports[_0x0b77('0x4a')]=function(_0x416443,_0x3df436){var _0x512fa6={'raw':![],'where':{'id':_0x416443['params']['id']}},_0x45e3f5={};_0x45e3f5[_0x0b77('0x3b')]=_['keys'](db[_0x0b77('0x47')][_0x0b77('0x4b')]);_0x45e3f5['query']=_[_0x0b77('0x4c')](_0x416443[_0x0b77('0x39')]);_0x45e3f5[_0x0b77('0x41')]=_[_0x0b77('0x3a')](_0x45e3f5[_0x0b77('0x3b')],_0x45e3f5[_0x0b77('0x39')]);_0x512fa6[_0x0b77('0x3c')]=_[_0x0b77('0x3a')](_0x45e3f5[_0x0b77('0x3b')],qs['fields'](_0x416443[_0x0b77('0x39')][_0x0b77('0x4d')]));_0x512fa6[_0x0b77('0x3c')]=_0x512fa6[_0x0b77('0x3c')]['length']?_0x512fa6[_0x0b77('0x3c')]:_0x45e3f5[_0x0b77('0x3b')];if(_0x416443[_0x0b77('0x39')][_0x0b77('0x46')]){_0x512fa6[_0x0b77('0x4e')]=[{'all':!![]}];}_0x512fa6=_[_0x0b77('0x43')]({},_0x512fa6,_0x416443[_0x0b77('0x45')]);return db['Dynamics365Account'][_0x0b77('0x4f')](_0x512fa6)[_0x0b77('0x1e')](handleEntityNotFound(_0x3df436,null))[_0x0b77('0x1e')](respondWithResult(_0x3df436,null))['catch'](handleError(_0x3df436,null));};exports[_0x0b77('0x50')]=function(_0x5be369,_0x20fbce){return db['Dynamics365Account']['create'](_0x5be369['body'],{})[_0x0b77('0x1e')](respondWithResult(_0x20fbce,0xc9))[_0x0b77('0x51')](handleError(_0x20fbce,null));};exports[_0x0b77('0x32')]=function(_0x5c4fa9,_0x928b2b){if(_0x5c4fa9[_0x0b77('0x52')]['id']){delete _0x5c4fa9[_0x0b77('0x52')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x5c4fa9[_0x0b77('0x53')]['id']}})[_0x0b77('0x1e')](handleEntityNotFound(_0x928b2b,null))[_0x0b77('0x1e')](saveUpdates(_0x5c4fa9[_0x0b77('0x52')],null))[_0x0b77('0x1e')](respondWithResult(_0x928b2b,null))['catch'](handleError(_0x928b2b,null));};exports[_0x0b77('0x33')]=function(_0x4eb2e7,_0x443438){return db[_0x0b77('0x47')][_0x0b77('0x4f')]({'where':{'id':_0x4eb2e7[_0x0b77('0x53')]['id']}})['then'](handleEntityNotFound(_0x443438,null))[_0x0b77('0x1e')](removeEntity(_0x443438,null))[_0x0b77('0x51')](handleError(_0x443438,null));};exports[_0x0b77('0x54')]=function(_0x1aba7b,_0x1571fd,_0x4e4f0c){var _0x554580={};var _0x5a6c43={};var _0x1530df;var _0x4f7475;return db[_0x0b77('0x47')][_0x0b77('0x55')]({'where':{'id':_0x1aba7b[_0x0b77('0x53')]['id']}})['then'](handleEntityNotFound(_0x1571fd,null))['then'](function(_0x569b12){if(_0x569b12){_0x1530df=_0x569b12;_0x5a6c43[_0x0b77('0x3b')]=_['keys'](db[_0x0b77('0x56')][_0x0b77('0x4b')]);_0x5a6c43[_0x0b77('0x39')]=_['keys'](_0x1aba7b[_0x0b77('0x39')]);_0x5a6c43['filters']=_['intersection'](_0x5a6c43['model'],_0x5a6c43[_0x0b77('0x39')]);_0x554580[_0x0b77('0x3c')]=_[_0x0b77('0x3a')](_0x5a6c43[_0x0b77('0x3b')],qs['fields'](_0x1aba7b['query'][_0x0b77('0x4d')]));_0x554580['attributes']=_0x554580['attributes']['length']?_0x554580[_0x0b77('0x3c')]:_0x5a6c43[_0x0b77('0x3b')];_0x554580[_0x0b77('0x3e')]=qs[_0x0b77('0x3f')](_0x1aba7b[_0x0b77('0x39')][_0x0b77('0x3f')]);_0x554580[_0x0b77('0x40')]=qs[_0x0b77('0x41')](_[_0x0b77('0x42')](_0x1aba7b[_0x0b77('0x39')],_0x5a6c43['filters']));if(_0x1aba7b[_0x0b77('0x39')][_0x0b77('0x57')]){_0x554580['where']=_[_0x0b77('0x43')](_0x554580[_0x0b77('0x40')],{'$or':_[_0x0b77('0x37')](_0x554580[_0x0b77('0x3c')],function(_0x2890a5){var _0x4fe705={};_0x4fe705[_0x2890a5]={'$like':'%'+_0x1aba7b[_0x0b77('0x39')][_0x0b77('0x57')]+'%'};return _0x4fe705;})});}_0x554580=_[_0x0b77('0x43')]({},_0x554580,_0x1aba7b[_0x0b77('0x45')]);return _0x1530df[_0x0b77('0x54')](_0x554580);}})[_0x0b77('0x1e')](function(_0x1fe581){if(_0x1fe581){_0x4f7475=_0x1fe581[_0x0b77('0x58')];if(!_0x1aba7b[_0x0b77('0x39')][_0x0b77('0x3d')](_0x0b77('0x59'))){_0x554580[_0x0b77('0x2e')]=qs[_0x0b77('0x2e')](_0x1aba7b['query'][_0x0b77('0x2e')]);_0x554580[_0x0b77('0x2d')]=qs[_0x0b77('0x2d')](_0x1aba7b[_0x0b77('0x39')][_0x0b77('0x2d')]);}return _0x1530df['getConfigurations'](_0x554580);}})[_0x0b77('0x1e')](function(_0x253cf5){if(_0x253cf5){return _0x253cf5?{'count':_0x4f7475,'rows':_0x253cf5}:null;}})[_0x0b77('0x1e')](respondWithResult(_0x1571fd,null))['catch'](handleError(_0x1571fd,null));};exports['addConfiguration']=function(_0xd9ae17,_0x5339ac,_0x518009){if(_0xd9ae17['body']['id']){delete _0xd9ae17[_0x0b77('0x52')]['id'];}return db[_0x0b77('0x47')][_0x0b77('0x55')]({'where':{'id':_0xd9ae17[_0x0b77('0x53')]['id']}})[_0x0b77('0x1e')](handleEntityNotFound(_0x5339ac,null))[_0x0b77('0x1e')](function(_0x173c20){if(_0x173c20){_0xd9ae17[_0x0b77('0x52')]['AccountId']=_0x173c20['id'];_0xd9ae17[_0x0b77('0x52')][_0x0b77('0x5a')]=integrations[_0x0b77('0x5b')](_0xd9ae17[_0x0b77('0x52')]['channel'],_0xd9ae17[_0x0b77('0x52')]['type']);_0xd9ae17['body'][_0x0b77('0x5c')]=integrations[_0x0b77('0x5d')](_0xd9ae17[_0x0b77('0x52')]['channel'],_0xd9ae17['body'][_0x0b77('0x5e')]);return db[_0x0b77('0x56')][_0x0b77('0x50')](_0xd9ae17[_0x0b77('0x52')],{'include':[{'model':db[_0x0b77('0x5f')],'as':_0x0b77('0x5a')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0x0b77('0x1e')](respondWithResult(_0x5339ac,null))[_0x0b77('0x51')](handleError(_0x5339ac,null));};exports[_0x0b77('0x60')]=function(_0x358ed4,_0x3a1b37,_0x322c42){var _0x3fd162=_0x358ed4[_0x0b77('0x39')][_0x0b77('0x61')];var _0x156c69=_0x3fd162===_0x0b77('0x62')?_0x0b77('0x63'):_0x0b77('0x64');var _0x301f54='';var _0x22cbec='';var _0x5a2baa='';var _0x59210a='';var _0x4a9875='';var _0x385913='';var _0x433b8d='';var _0x132af5='';var _0x4417e6=[_0x0b77('0x65'),_0x0b77('0x66'),'customerid','ownerid',_0x0b77('0x67'),_0x0b77('0x68'),'phonenumber',_0x0b77('0x69'),'directioncode',_0x0b77('0x6a')];var _0x3c3667=['accountidname',_0x0b77('0x6b'),_0x0b77('0x6c'),_0x0b77('0x6d'),'contactidname',_0x0b77('0x6e'),'contractdetailidname','contractidname',_0x0b77('0x6f'),_0x0b77('0x70'),_0x0b77('0x71'),_0x0b77('0x72'),_0x0b77('0x73'),_0x0b77('0x74'),_0x0b77('0x75'),_0x0b77('0x76'),'customeridtype',_0x0b77('0x77'),_0x0b77('0x78'),_0x0b77('0x79'),_0x0b77('0x7a'),'entityimage_url',_0x0b77('0x7b'),_0x0b77('0x7c'),'firstresponsebykpiidname','followupby','importsequencenumber','influencescore',_0x0b77('0x7d'),'lastonholdtime',_0x0b77('0x7e'),_0x0b77('0x7f'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x0b77('0x80'),_0x0b77('0x81'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x0b77('0x82'),'msdyn_iotalertname','numberofchildincidents',_0x0b77('0x83'),_0x0b77('0x84'),_0x0b77('0x85'),_0x0b77('0x86'),_0x0b77('0x87'),'parentcaseidname',_0x0b77('0x88'),'primarycontactidyominame','prioritycodename',_0x0b77('0x89'),_0x0b77('0x8a'),_0x0b77('0x8b'),_0x0b77('0x8c'),'responseby',_0x0b77('0x8d'),_0x0b77('0x8e'),'sentimentvalue',_0x0b77('0x8f'),_0x0b77('0x90'),_0x0b77('0x91'),_0x0b77('0x92'),'statuscode',_0x0b77('0x93'),'ticketnumber',_0x0b77('0x94'),_0x0b77('0x95'),'traversedpath',_0x0b77('0x96'),'versionnumber'];var _0x363f17=_0x4417e6[_0x0b77('0x97')](_0x3c3667);return db[_0x0b77('0x47')][_0x0b77('0x55')]({'where':{'id':_0x358ed4[_0x0b77('0x53')]['id']},'attributes':['id',_0x0b77('0x98'),_0x0b77('0x99'),'remoteUri',_0x0b77('0x9a'),_0x0b77('0x9b'),_0x0b77('0x9c')]})[_0x0b77('0x1e')](handleEntityNotFound(_0x3a1b37,null))[_0x0b77('0x1e')](function(_0x1ddeb9){if(_0x1ddeb9){_0x132af5=_0x1ddeb9[_0x0b77('0x9d')];var _0x13eb19=_0x132af5['slice'](-0x1);if(_0x13eb19==='/'){_0x132af5=_0x132af5[_0x0b77('0x9e')](0x0,_0x132af5[_0x0b77('0x9f')](_0x13eb19));}_0x433b8d=util[_0x0b77('0xa0')](_0x0b77('0xa1'),_0x132af5);var _0x21350a={'method':'POST','uri':_0x0b77('0xa2')+_0x1ddeb9[_0x0b77('0x9a')]+'/oauth2/token','form':{'client_id':_0x1ddeb9[_0x0b77('0x9b')],'resource':_0x132af5,'username':_0x1ddeb9[_0x0b77('0x98')],'password':_0x1ddeb9[_0x0b77('0x99')],'grant_type':_0x0b77('0x99'),'client_secret':_0x1ddeb9[_0x0b77('0x9c')]},'json':!![]};return rp(_0x21350a);}})[_0x0b77('0x1e')](function(_0x48a132){_0x385913=_0x48a132['access_token'];var _0x24e2c6={'method':_0x0b77('0xa3'),'uri':encodeURI(_0x433b8d+_0x0b77('0xa4')+_0x156c69+'\x27'),'headers':{'Authorization':_0x0b77('0xa5')+_0x385913,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x24e2c6);})[_0x0b77('0x1e')](function(_0x46d43d){var _0x1ef094=_0x46d43d['value'][0x0];var _0x305b8d=_0x1ef094[_0x0b77('0xa6')];var _0x15b74f={'method':'GET','uri':_0x433b8d+_0x0b77('0xa7')+_0x305b8d+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x0b77('0xa5')+_0x385913,'If-None-Match':null,'OData-Version':_0x0b77('0xa8')},'json':!![]};return rp(_0x15b74f);})['then'](function(_0x303ebf){_0x301f54=_0x303ebf;_0x22cbec=_0x301f54[_0x0b77('0xa9')];_0x22cbec=_['remove'](_0x22cbec,function(_0x5e5642){return!_0x363f17[_0x0b77('0xaa')](_0x5e5642['LogicalName']);});var _0x229ffd=[];var _0x44974a=[];_0x22cbec[_0x0b77('0xab')](function(_0x3f6122){if(_0x3f6122[_0x0b77('0xac')]){var _0x32fc4e=_0x3f6122['@odata.type']['substring'](_0x3f6122['@odata.type']['lastIndexOf']('.')+0x1);if(_0x32fc4e===_0x0b77('0xad')){_0x229ffd['push'](getSelectList(_0x433b8d,_0x3fd162,_0x44974a,_0x301f54[_0x0b77('0xa6')],_0x3f6122[_0x0b77('0xa6')],_0x385913));}}});return Promise['all'](_0x229ffd);})[_0x0b77('0x1e')](function(_0x31e837){_0x5a2baa=_0x31e837[0x0];var _0x29b45a=[];var _0x31f3a8=[];_0x22cbec[_0x0b77('0xab')](function(_0x4d9b43){if(!_[_0x0b77('0xae')](_0x4d9b43[_0x0b77('0xac')])){var _0x3d5c01=_0x4d9b43[_0x0b77('0xac')]['substring'](_0x4d9b43[_0x0b77('0xac')][_0x0b77('0x9f')]('.')+0x1);if(_0x3d5c01===_0x0b77('0xaf')){_0x29b45a[_0x0b77('0xb0')](getBooleanList(_0x433b8d,_0x3fd162,_0x31f3a8,_0x301f54['MetadataId'],_0x4d9b43[_0x0b77('0xa6')],_0x385913));}}});return Promise[_0x0b77('0xb1')](_0x29b45a);})[_0x0b77('0x1e')](function(_0x1b6b04){_0x59210a=_0x1b6b04[0x0];var _0x1b72e7=[];var _0x5054df=[];_0x22cbec['forEach'](function(_0x4f67fc){if(_0x4f67fc[_0x0b77('0xac')]){var _0x356390=_0x4f67fc['@odata.type'][_0x0b77('0x9e')](_0x4f67fc[_0x0b77('0xac')][_0x0b77('0x9f')]('.')+0x1);if(_0x356390===_0x0b77('0xb2')||_0x356390===_0x0b77('0xb3')||_0x356390==='BigIntAttributeMetadata'||_0x356390==='IntegerAttributeMetadata'||_0x356390===_0x0b77('0xb4')||_0x356390==='DateTimeAttributeMetadata'||_0x356390==='StatusAttributeMetadata'||_0x356390===_0x0b77('0xb5')||_0x356390===_0x0b77('0xb6')||_0x356390===_0x0b77('0xb7')){_0x1b72e7[_0x0b77('0xb0')](getInputList(_0x433b8d,_0x3fd162,_0x356390,_0x5054df,_0x301f54['MetadataId'],_0x4f67fc[_0x0b77('0xa6')],_0x385913));}}});return Promise['all'](_0x1b72e7);})[_0x0b77('0x1e')](function(_0x34ecbf){_0x4a9875=_0x34ecbf[0x0];var _0x40443c=_0x5a2baa['concat'](_0x59210a)[_0x0b77('0x97')](_0x4a9875);var _0x24c15c={'count':_0x40443c[_0x0b77('0x58')],'rows':_0x40443c};return _0x24c15c;})['then'](respondWithResult(_0x3a1b37,null))[_0x0b77('0x51')](function(_0x4f8aaa){var _0x335986=_0x358ed4[_0x0b77('0x39')][_0x0b77('0x1c')]?0x1f4:_0x4f8aaa[_0x0b77('0xb8')]||0x1f4;logger[_0x0b77('0x23')](_0x4f8aaa[_0x0b77('0x34')]);delete _0x4f8aaa['name'];if(_0x335986===0x191){_0x335986=0x190;}_0x3a1b37[_0x0b77('0x29')](_0x335986)[_0x0b77('0x36')](_0x358ed4['query']['test']?{'message':_0x0b77('0xb9'),'statusCode':_0x4f8aaa[_0x0b77('0xb8')]}:_0x4f8aaa);});};function getSelectList(_0x2c52b6,_0x5194bf,_0x1f8bc3,_0x38d37b,_0x332ca3,_0x43d0e1){var _0xb3c376={'method':_0x0b77('0xa3'),'uri':_0x2c52b6+_0x0b77('0xa7')+_0x38d37b+_0x0b77('0xba')+_0x332ca3+_0x0b77('0xbb')+_0x0b77('0xbc'),'headers':{'Authorization':_0x0b77('0xa5')+_0x43d0e1,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xb3c376)[_0x0b77('0x1e')](function(_0x504973){var _0x14a3fe=[];var _0x55fd88=_0x504973[_0x0b77('0xbd')][_0x0b77('0xbe')];_0x55fd88[_0x0b77('0xab')](function(_0x3510a4){_0x14a3fe['push']({'name':_0x3510a4['Label'][_0x0b77('0xbf')]['Label'],'value':String(_0x3510a4[_0x0b77('0xc0')])});});var _0x4a6ddf={'id':_0x5194bf+'_'+_0x504973[_0x0b77('0xc1')],'name':_0x504973[_0x0b77('0xc2')][_0x0b77('0xbf')][_0x0b77('0xc3')],'custom':![],'options':_0x14a3fe};_0x1f8bc3[_0x0b77('0xb0')](_0x4a6ddf);return _0x1f8bc3;});}function getBooleanList(_0x21c840,_0x3f5ed2,_0xb3da86,_0x1c6c0a,_0x190da8,_0x265d8e){var _0x471766={'method':'GET','uri':_0x21c840+_0x0b77('0xa7')+_0x1c6c0a+_0x0b77('0xba')+_0x190da8+_0x0b77('0xc4'),'headers':{'Authorization':_0x0b77('0xa5')+_0x265d8e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x471766)[_0x0b77('0x1e')](function(_0x42b9c5){var _0x1d9810=[];_0x1d9810[_0x0b77('0xb0')]({'name':_0x42b9c5[_0x0b77('0xbd')]['TrueOption']['Label'][_0x0b77('0xbf')]['Label'],'value':_0x0b77('0xc5')},{'name':_0x42b9c5[_0x0b77('0xbd')][_0x0b77('0xc6')][_0x0b77('0xc3')]['UserLocalizedLabel'][_0x0b77('0xc3')],'value':'false'});var _0x3b622d={'id':_0x3f5ed2+'_'+_0x42b9c5[_0x0b77('0xc1')],'name':_0x42b9c5[_0x0b77('0xc2')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x1d9810};_0xb3da86[_0x0b77('0xb0')](_0x3b622d);return _0xb3da86;});}function getInputList(_0x50b3ce,_0x523896,_0x3e59ad,_0x24922c,_0x5eceed,_0x44609f,_0x12c4f6){var _0x5e9fc9={'method':_0x0b77('0xa3'),'uri':_0x50b3ce+_0x0b77('0xa7')+_0x5eceed+_0x0b77('0xba')+_0x44609f+_0x0b77('0xc7')+_0x3e59ad+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x0b77('0xa5')+_0x12c4f6,'If-None-Match':null,'OData-Version':_0x0b77('0xa8')},'json':!![]};return rp(_0x5e9fc9)[_0x0b77('0x1e')](function(_0xd9c3fb){var _0x3e2667={'id':_0x523896+'_'+_0xd9c3fb[_0x0b77('0xc1')],'name':_0xd9c3fb[_0x0b77('0xc2')][_0x0b77('0xbf')]?_0xd9c3fb[_0x0b77('0xc2')][_0x0b77('0xbf')][_0x0b77('0xc3')]:_0xd9c3fb[_0x0b77('0xc1')],'custom':![],'options':[]};_0x24922c[_0x0b77('0xb0')](_0x3e2667);return _0x24922c;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 68dd3d7..6940594 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 _0xe9a1=['./intDynamics365Account.attributes','exports','define','Dynamics365Account','lodash','util','api','moment','bluebird','path','../../config/environment'];(function(_0x112571,_0x59086f){var _0x19bb43=function(_0x5d32d5){while(--_0x5d32d5){_0x112571['push'](_0x112571['shift']());}};_0x19bb43(++_0x59086f);}(_0xe9a1,0xf6));var _0x1e9a=function(_0x3e4a61,_0x59a7c0){_0x3e4a61=_0x3e4a61-0x0;var _0x2361b5=_0xe9a1[_0x3e4a61];return _0x2361b5;};'use strict';var _=require(_0x1e9a('0x0'));var util=require(_0x1e9a('0x1'));var logger=require('../../config/logger')(_0x1e9a('0x2'));var moment=require(_0x1e9a('0x3'));var BPromise=require(_0x1e9a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e9a('0x5'));var rimraf=require('rimraf');var config=require(_0x1e9a('0x6'));var attributes=require(_0x1e9a('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x1e9a('0x8')]=function(_0x2e6781,_0x3122bb){return _0x2e6781[_0x1e9a('0x9')](_0x1e9a('0xa'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fd5=['request-promise','../../config/environment','./intDynamics365Account.attributes','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util','api','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4fd5,0x1ab));var _0x54fd=function(_0x2ac128,_0x2350d2){_0x2ac128=_0x2ac128-0x0;var _0x14ccfc=_0x4fd5[_0x2ac128];return _0x14ccfc;};'use strict';var _=require(_0x54fd('0x0'));var util=require(_0x54fd('0x1'));var logger=require('../../config/logger')(_0x54fd('0x2'));var moment=require(_0x54fd('0x3'));var BPromise=require(_0x54fd('0x4'));var rp=require(_0x54fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x54fd('0x6'));var attributes=require(_0x54fd('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x54fd('0x8')]=function(_0x5a2cd4,_0x13fc74){return _0x5a2cd4[_0x54fd('0x9')](_0x54fd('0xa'),attributes,{'tableName':_0x54fd('0xb'),'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 552fbef..d597f2a 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 _0xb242=['include','map','ShowDynamics365Account','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','catch','GetDynamics365Account','Dynamics365Account','findAll','raw','options','where','attributes','model'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0xb242,0x1f3));var _0x2b24=function(_0x2fbcf6,_0x2e7155){_0x2fbcf6=_0x2fbcf6-0x0;var _0x3e7265=_0xb242[_0x2fbcf6];return _0x3e7265;};'use strict';var _=require('lodash');var util=require(_0x2b24('0x0'));var moment=require(_0x2b24('0x1'));var BPromise=require(_0x2b24('0x2'));var rs=require(_0x2b24('0x3'));var fs=require('fs');var Redis=require(_0x2b24('0x4'));var db=require(_0x2b24('0x5'))['db'];var utils=require(_0x2b24('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x2b24('0x7'));var jayson=require(_0x2b24('0x8'));var client=jayson['client'][_0x2b24('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x477e45,_0x179d9a,_0x53345b){return new BPromise(function(_0x475271,_0x56c14a){return client[_0x2b24('0xa')](_0x477e45,_0x53345b)[_0x2b24('0xb')](function(_0x529939){logger[_0x2b24('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x179d9a,_0x2b24('0xd'));logger[_0x2b24('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x179d9a,'request\x20sent',JSON[_0x2b24('0xf')](_0x529939));if(_0x529939['error']){if(_0x529939[_0x2b24('0x10')][_0x2b24('0x11')]===0x1f4){logger[_0x2b24('0x10')](_0x2b24('0x12'),_0x179d9a,_0x529939['error']['message']);return _0x56c14a(_0x529939[_0x2b24('0x10')][_0x2b24('0x13')]);}logger[_0x2b24('0x10')](_0x2b24('0x12'),_0x179d9a,_0x529939[_0x2b24('0x10')]['message']);return _0x475271(_0x529939[_0x2b24('0x10')][_0x2b24('0x13')]);}else{logger['info'](_0x2b24('0x12'),_0x179d9a,_0x2b24('0xd'));_0x475271(_0x529939['result'][_0x2b24('0x13')]);}})[_0x2b24('0x14')](function(_0x2fdc73){logger[_0x2b24('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x179d9a,_0x2fdc73);_0x56c14a(_0x2fdc73);});});}exports[_0x2b24('0x15')]=function(_0x2815dc){var _0x135261=this;return new Promise(function(_0x4951af,_0x1eb73f){return db[_0x2b24('0x16')][_0x2b24('0x17')]({'raw':_0x2815dc['options']?_0x2815dc['options'][_0x2b24('0x18')]===undefined?!![]:![]:!![],'where':_0x2815dc[_0x2b24('0x19')]?_0x2815dc[_0x2b24('0x19')][_0x2b24('0x1a')]||null:null,'attributes':_0x2815dc['options']?_0x2815dc[_0x2b24('0x19')][_0x2b24('0x1b')]||null:null,'limit':_0x2815dc[_0x2b24('0x19')]?_0x2815dc[_0x2b24('0x19')]['limit']||null:null,'include':_0x2815dc['options']?_0x2815dc[_0x2b24('0x19')]['include']?_['map'](_0x2815dc['options']['include'],function(_0x2acfcf){return{'model':db[_0x2acfcf[_0x2b24('0x1c')]],'as':_0x2acfcf['as'],'attributes':_0x2acfcf[_0x2b24('0x1b')],'include':_0x2acfcf[_0x2b24('0x1d')]?_['map'](_0x2acfcf['include'],function(_0x4d25e4){return{'model':db[_0x4d25e4[_0x2b24('0x1c')]],'as':_0x4d25e4['as'],'attributes':_0x4d25e4[_0x2b24('0x1b')],'include':_0x4d25e4[_0x2b24('0x1d')]?_[_0x2b24('0x1e')](_0x4d25e4['include'],function(_0x5c9efb){return{'model':db[_0x5c9efb[_0x2b24('0x1c')]],'as':_0x5c9efb['as'],'attributes':_0x5c9efb[_0x2b24('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5765b5){logger[_0x2b24('0xc')]('GetDynamics365Account',_0x2815dc);logger['debug'](_0x2b24('0x15'),_0x2815dc,JSON[_0x2b24('0xf')](_0x5765b5));_0x4951af(_0x5765b5);})[_0x2b24('0x14')](function(_0x3183cd){logger['error'](_0x2b24('0x15'),_0x3183cd['message'],_0x2815dc);_0x1eb73f(_0x135261[_0x2b24('0x10')](0x1f4,_0x3183cd[_0x2b24('0x13')]));});});};exports[_0x2b24('0x1f')]=function(_0x12c529){var _0x316253=this;return new Promise(function(_0x8717e,_0x3ca905){return db[_0x2b24('0x16')][_0x2b24('0x20')]({'raw':_0x12c529[_0x2b24('0x19')]?_0x12c529[_0x2b24('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x12c529[_0x2b24('0x19')]?_0x12c529['options'][_0x2b24('0x1a')]||null:null,'attributes':_0x12c529['options']?_0x12c529[_0x2b24('0x19')][_0x2b24('0x1b')]||null:null,'include':_0x12c529['options']?_0x12c529[_0x2b24('0x19')][_0x2b24('0x1d')]?_['map'](_0x12c529[_0x2b24('0x19')][_0x2b24('0x1d')],function(_0x243ed5){return{'model':db[_0x243ed5['model']],'as':_0x243ed5['as'],'attributes':_0x243ed5[_0x2b24('0x1b')],'include':_0x243ed5[_0x2b24('0x1d')]?_['map'](_0x243ed5[_0x2b24('0x1d')],function(_0x45ddd4){return{'model':db[_0x45ddd4['model']],'as':_0x45ddd4['as'],'attributes':_0x45ddd4[_0x2b24('0x1b')],'include':_0x45ddd4[_0x2b24('0x1d')]?_['map'](_0x45ddd4[_0x2b24('0x1d')],function(_0x2f974d){return{'model':db[_0x2f974d[_0x2b24('0x1c')]],'as':_0x2f974d['as'],'attributes':_0x2f974d['attributes']};}):[]};}):[]};}):[]:[]})[_0x2b24('0xb')](function(_0x214f3d){logger[_0x2b24('0xc')](_0x2b24('0x1f'),_0x12c529);logger['debug'](_0x2b24('0x1f'),_0x12c529,JSON[_0x2b24('0xf')](_0x214f3d));_0x8717e(_0x214f3d);})[_0x2b24('0x14')](function(_0x1810b4){logger[_0x2b24('0x10')](_0x2b24('0x1f'),_0x1810b4['message'],_0x12c529);_0x3ca905(_0x316253[_0x2b24('0x10')](0x1f4,_0x1810b4[_0x2b24('0x13')]));});});}; \ No newline at end of file +var _0xd9fb=['limit','include','map','model','then','GetDynamics365Account','stringify','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','result','catch','Dynamics365Account','findAll','options','raw','where','attributes'];(function(_0x3f5dca,_0x59472b){var _0x5b833a=function(_0x1cb84b){while(--_0x1cb84b){_0x3f5dca['push'](_0x3f5dca['shift']());}};_0x5b833a(++_0x59472b);}(_0xd9fb,0x189));var _0xbd9f=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xd9fb[_0xaa0309];return _0x5de7ce;};'use strict';var _=require(_0xbd9f('0x0'));var util=require(_0xbd9f('0x1'));var moment=require(_0xbd9f('0x2'));var BPromise=require(_0xbd9f('0x3'));var rs=require(_0xbd9f('0x4'));var fs=require('fs');var Redis=require(_0xbd9f('0x5'));var db=require(_0xbd9f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd9f('0x7'))(_0xbd9f('0x8'));var config=require('../../config/environment');var jayson=require(_0xbd9f('0x9'));var client=jayson['client'][_0xbd9f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43a5a2,_0x5e2143,_0x30f0ae){return new BPromise(function(_0x16f086,_0x3dbc8e){return client[_0xbd9f('0xb')](_0x43a5a2,_0x30f0ae)['then'](function(_0x37163c){logger[_0xbd9f('0xc')](_0xbd9f('0xd'),_0x5e2143,_0xbd9f('0xe'));logger[_0xbd9f('0xf')](_0xbd9f('0x10'),_0x5e2143,_0xbd9f('0xe'),JSON['stringify'](_0x37163c));if(_0x37163c['error']){if(_0x37163c['error']['code']===0x1f4){logger[_0xbd9f('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x5e2143,_0x37163c[_0xbd9f('0x11')][_0xbd9f('0x12')]);return _0x3dbc8e(_0x37163c[_0xbd9f('0x11')]['message']);}logger[_0xbd9f('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x5e2143,_0x37163c[_0xbd9f('0x11')][_0xbd9f('0x12')]);return _0x16f086(_0x37163c[_0xbd9f('0x11')][_0xbd9f('0x12')]);}else{logger['info'](_0xbd9f('0xd'),_0x5e2143,_0xbd9f('0xe'));_0x16f086(_0x37163c[_0xbd9f('0x13')][_0xbd9f('0x12')]);}})[_0xbd9f('0x14')](function(_0x985bc1){logger[_0xbd9f('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x5e2143,_0x985bc1);_0x3dbc8e(_0x985bc1);});});}exports['GetDynamics365Account']=function(_0x35be6d){var _0x5ebaf6=this;return new Promise(function(_0x2f52dd,_0x3cc2ce){return db[_0xbd9f('0x15')][_0xbd9f('0x16')]({'raw':_0x35be6d[_0xbd9f('0x17')]?_0x35be6d[_0xbd9f('0x17')][_0xbd9f('0x18')]===undefined?!![]:![]:!![],'where':_0x35be6d[_0xbd9f('0x17')]?_0x35be6d['options'][_0xbd9f('0x19')]||null:null,'attributes':_0x35be6d[_0xbd9f('0x17')]?_0x35be6d[_0xbd9f('0x17')][_0xbd9f('0x1a')]||null:null,'limit':_0x35be6d[_0xbd9f('0x17')]?_0x35be6d[_0xbd9f('0x17')][_0xbd9f('0x1b')]||null:null,'include':_0x35be6d[_0xbd9f('0x17')]?_0x35be6d[_0xbd9f('0x17')][_0xbd9f('0x1c')]?_[_0xbd9f('0x1d')](_0x35be6d['options'][_0xbd9f('0x1c')],function(_0x10697a){return{'model':db[_0x10697a[_0xbd9f('0x1e')]],'as':_0x10697a['as'],'attributes':_0x10697a[_0xbd9f('0x1a')],'include':_0x10697a['include']?_[_0xbd9f('0x1d')](_0x10697a[_0xbd9f('0x1c')],function(_0x278a10){return{'model':db[_0x278a10[_0xbd9f('0x1e')]],'as':_0x278a10['as'],'attributes':_0x278a10[_0xbd9f('0x1a')],'include':_0x278a10[_0xbd9f('0x1c')]?_[_0xbd9f('0x1d')](_0x278a10['include'],function(_0xd89fc2){return{'model':db[_0xd89fc2[_0xbd9f('0x1e')]],'as':_0xd89fc2['as'],'attributes':_0xd89fc2[_0xbd9f('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbd9f('0x1f')](function(_0x25a5c8){logger['info']('GetDynamics365Account',_0x35be6d);logger[_0xbd9f('0xf')](_0xbd9f('0x20'),_0x35be6d,JSON[_0xbd9f('0x21')](_0x25a5c8));_0x2f52dd(_0x25a5c8);})['catch'](function(_0xe884e8){logger[_0xbd9f('0x11')](_0xbd9f('0x20'),_0xe884e8['message'],_0x35be6d);_0x3cc2ce(_0x5ebaf6[_0xbd9f('0x11')](0x1f4,_0xe884e8[_0xbd9f('0x12')]));});});};exports[_0xbd9f('0x22')]=function(_0x25c219){var _0x2a733e=this;return new Promise(function(_0x28dd61,_0x22c16c){return db['Dynamics365Account']['find']({'raw':_0x25c219[_0xbd9f('0x17')]?_0x25c219[_0xbd9f('0x17')][_0xbd9f('0x18')]===undefined?!![]:![]:!![],'where':_0x25c219[_0xbd9f('0x17')]?_0x25c219[_0xbd9f('0x17')][_0xbd9f('0x19')]||null:null,'attributes':_0x25c219[_0xbd9f('0x17')]?_0x25c219[_0xbd9f('0x17')][_0xbd9f('0x1a')]||null:null,'include':_0x25c219['options']?_0x25c219['options'][_0xbd9f('0x1c')]?_['map'](_0x25c219['options'][_0xbd9f('0x1c')],function(_0x422089){return{'model':db[_0x422089[_0xbd9f('0x1e')]],'as':_0x422089['as'],'attributes':_0x422089[_0xbd9f('0x1a')],'include':_0x422089[_0xbd9f('0x1c')]?_[_0xbd9f('0x1d')](_0x422089[_0xbd9f('0x1c')],function(_0x43aef6){return{'model':db[_0x43aef6['model']],'as':_0x43aef6['as'],'attributes':_0x43aef6[_0xbd9f('0x1a')],'include':_0x43aef6[_0xbd9f('0x1c')]?_[_0xbd9f('0x1d')](_0x43aef6['include'],function(_0x5553d9){return{'model':db[_0x5553d9[_0xbd9f('0x1e')]],'as':_0x5553d9['as'],'attributes':_0x5553d9[_0xbd9f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x149777){logger['info'](_0xbd9f('0x22'),_0x25c219);logger[_0xbd9f('0xf')](_0xbd9f('0x22'),_0x25c219,JSON[_0xbd9f('0x21')](_0x149777));_0x28dd61(_0x149777);})[_0xbd9f('0x14')](function(_0x5f0cb2){logger[_0xbd9f('0x11')](_0xbd9f('0x22'),_0x5f0cb2['message'],_0x25c219);_0x22c16c(_0x2a733e[_0xbd9f('0x11')](0x1f4,_0x5f0cb2[_0xbd9f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 635969e..aae8647 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 _0xe23d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xe23d,0x1d0));var _0xde23=function(_0x376a7d,_0xf534){_0x376a7d=_0x376a7d-0x0;var _0x34b2aa=_0xe23d[_0x376a7d];return _0x34b2aa;};'use strict';var multer=require(_0xde23('0x0'));var util=require(_0xde23('0x1'));var path=require(_0xde23('0x2'));var timeout=require('connect-timeout');var express=require(_0xde23('0x3'));var router=express[_0xde23('0x4')]();var auth=require(_0xde23('0x5'));var interaction=require(_0xde23('0x6'));var config=require(_0xde23('0x7'));var controller=require(_0xde23('0x8'));router[_0xde23('0x9')]('/',auth[_0xde23('0xa')](),controller[_0xde23('0xb')]);router[_0xde23('0x9')](_0xde23('0xc'),auth[_0xde23('0xa')](),controller[_0xde23('0xd')]);router[_0xde23('0x9')](_0xde23('0xe'),auth[_0xde23('0xa')](),controller[_0xde23('0xf')]);router[_0xde23('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xde23('0x10')]);router[_0xde23('0x9')](_0xde23('0x11'),auth[_0xde23('0xa')](),controller[_0xde23('0x12')]);router[_0xde23('0x13')]('/',auth[_0xde23('0xa')](),controller[_0xde23('0x14')]);router[_0xde23('0x15')](_0xde23('0xc'),auth[_0xde23('0xa')](),controller[_0xde23('0x16')]);router[_0xde23('0x17')](_0xde23('0xc'),auth[_0xde23('0xa')](),controller[_0xde23('0x18')]);module[_0xde23('0x19')]=router; \ No newline at end of file +var _0xa8a6=['get','isAuthenticated','index','/:id/fields','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/interaction/service','./intDynamics365Configuration.controller'];(function(_0x4db23b,_0x57d095){var _0x117614=function(_0x1c5130){while(--_0x1c5130){_0x4db23b['push'](_0x4db23b['shift']());}};_0x117614(++_0x57d095);}(_0xa8a6,0x11a));var _0x6a8a=function(_0x2f1133,_0x9554f9){_0x2f1133=_0x2f1133-0x0;var _0x15b963=_0xa8a6[_0x2f1133];return _0x15b963;};'use strict';var multer=require(_0x6a8a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6a8a('0x1'));var express=require(_0x6a8a('0x2'));var router=express[_0x6a8a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6a8a('0x4'));var config=require('../../config/environment');var controller=require(_0x6a8a('0x5'));router[_0x6a8a('0x6')]('/',auth[_0x6a8a('0x7')](),controller[_0x6a8a('0x8')]);router[_0x6a8a('0x6')]('/:id',auth[_0x6a8a('0x7')](),controller['show']);router[_0x6a8a('0x6')](_0x6a8a('0x9'),auth[_0x6a8a('0x7')](),controller['getFields']);router[_0x6a8a('0x6')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0x6a8a('0xa'),auth[_0x6a8a('0x7')](),controller[_0x6a8a('0xb')]);router[_0x6a8a('0xc')]('/',auth['isAuthenticated'](),controller[_0x6a8a('0xd')]);router[_0x6a8a('0xe')]('/:id',auth[_0x6a8a('0x7')](),controller[_0x6a8a('0xf')]);router[_0x6a8a('0x10')]('/:id',auth[_0x6a8a('0x7')](),controller[_0x6a8a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 12764e3..a2428bc 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 _0x3a0b=['STRING','ENUM','incident','phonecall'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x3a0b,0x150));var _0xb3a0=function(_0xcf5436,_0x4632c3){_0xcf5436=_0xcf5436-0x0;var _0xc4f5c8=_0x3a0b[_0xcf5436];return _0xc4f5c8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb3a0('0x0')]},'description':{'type':Sequelize[_0xb3a0('0x0')]},'ticketType':{'type':Sequelize[_0xb3a0('0x1')](_0xb3a0('0x2'),_0xb3a0('0x3')),'defaultValue':'incident'}}; \ No newline at end of file +var _0x685b=['exports','STRING','ENUM','incident','phonecall','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x685b,0x1a3));var _0xb685=function(_0x35d2d6,_0x14e944){_0x35d2d6=_0x35d2d6-0x0;var _0x1637d5=_0x685b[_0x35d2d6];return _0x1637d5;};'use strict';var Sequelize=require(_0xb685('0x0'));module[_0xb685('0x1')]={'name':{'type':Sequelize[_0xb685('0x2')]},'description':{'type':Sequelize[_0xb685('0x2')]},'ticketType':{'type':Sequelize[_0xb685('0x3')](_0xb685('0x4'),_0xb685('0x5')),'defaultValue':_0xb685('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index e36d9ad..cb36a68 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 _0x8d6c=['offset','limit','set','Content-Range','reject','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','Dynamics365Configuration','includeAll','include','findAll','rows','show','params','merge','options','find','create','body','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count'];(function(_0x568270,_0x3e67eb){var _0x29cb99=function(_0x4d0b8b){while(--_0x4d0b8b){_0x568270['push'](_0x568270['shift']());}};_0x29cb99(++_0x3e67eb);}(_0x8d6c,0x1a1));var _0xc8d6=function(_0x51380e,_0x55b897){_0x51380e=_0x51380e-0x0;var _0x2ed390=_0x8d6c[_0x51380e];return _0x2ed390;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc8d6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc8d6('0x1'));var jsonpatch=require(_0xc8d6('0x2'));var rp=require(_0xc8d6('0x3'));var moment=require(_0xc8d6('0x4'));var BPromise=require(_0xc8d6('0x5'));var Mustache=require('mustache');var util=require(_0xc8d6('0x6'));var path=require('path');var sox=require(_0xc8d6('0x7'));var csv=require(_0xc8d6('0x8'));var ejs=require(_0xc8d6('0x9'));var fs=require('fs');var _=require(_0xc8d6('0xa'));var squel=require(_0xc8d6('0xb'));var crypto=require(_0xc8d6('0xc'));var jsforce=require(_0xc8d6('0xd'));var deskjs=require(_0xc8d6('0xe'));var toCsv=require(_0xc8d6('0x8'));var querystring=require(_0xc8d6('0xf'));var Papa=require(_0xc8d6('0x10'));var Redis=require(_0xc8d6('0x11'));var authService=require(_0xc8d6('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc8d6('0x13'));var logger=require(_0xc8d6('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc8d6('0x15'))['db'];var jayson=require(_0xc8d6('0x16'));var client=jayson[_0xc8d6('0x17')][_0xc8d6('0x18')]({'port':0x232a});function checkPasswordPattern(_0x1df752,_0x2017af,_0x131703){if(_0x131703){var _0x3667bb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3667bb[_0xc8d6('0x19')](_0x2017af)){return _0x1df752;}else{throw new db['Sequelize'][(_0xc8d6('0x1a'))](_0xc8d6('0x1b'));}}else{return _0x1df752;}}function respondWithRpcPromise(_0x2dafde,_0x58f24e,_0x234ba5,_0x11ad2c){return new BPromise(function(_0x3156da,_0x57fd9b){var _0x235120=_0x11ad2c||client;return _0x235120[_0xc8d6('0x1c')](_0x2dafde,_0x234ba5)[_0xc8d6('0x1d')](function(_0x384d78){logger[_0xc8d6('0x1e')](_0xc8d6('0x1f'),_0x58f24e,'request\x20sent');logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x58f24e,'request\x20sent',JSON[_0xc8d6('0x20')](_0x384d78));if(_0x384d78[_0xc8d6('0x21')]){if(_0x384d78[_0xc8d6('0x21')][_0xc8d6('0x22')]===0x1f4){logger[_0xc8d6('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x58f24e,_0x384d78[_0xc8d6('0x21')][_0xc8d6('0x23')]);return _0x57fd9b(_0x384d78['error'][_0xc8d6('0x23')]);}logger[_0xc8d6('0x21')]('Dynamics365Configuration,\x20%s,\x20%s',_0x58f24e,_0x384d78['error']['message']);return _0x3156da(_0x384d78[_0xc8d6('0x21')][_0xc8d6('0x23')]);}else{logger['info'](_0xc8d6('0x1f'),_0x58f24e,'request\x20sent');_0x3156da(_0x384d78[_0xc8d6('0x24')]['message']);}})[_0xc8d6('0x25')](function(_0xae860c){logger['error'](_0xc8d6('0x1f'),_0x58f24e,_0xae860c);_0x57fd9b(_0xae860c);});});}function respondWithStatusCode(_0x240d6e,_0x341390){_0x341390=_0x341390||0xcc;return function(_0x583143){if(_0x583143){return _0x240d6e[_0xc8d6('0x26')](_0x341390);}return _0x240d6e[_0xc8d6('0x27')](_0x341390)[_0xc8d6('0x28')]();};}function respondWithResult(_0x2ab229,_0x3d8c3a){_0x3d8c3a=_0x3d8c3a||0xc8;return function(_0x504b83){if(_0x504b83){return _0x2ab229['status'](_0x3d8c3a)[_0xc8d6('0x29')](_0x504b83);}};}function respondWithFilteredResult(_0x1c5ead,_0x40f873){return function(_0x264d59){if(_0x264d59){var _0x476d24=_0x264d59[_0xc8d6('0x2a')],_0x5f1cc9=_0x40f873['offset'],_0x6dacc0=_0x40f873[_0xc8d6('0x2b')]+_0x40f873[_0xc8d6('0x2c')],_0xc6db6d;if(_0x6dacc0>=_0x476d24){_0x6dacc0=_0x476d24;_0xc6db6d=0xc8;}else{_0xc6db6d=0xce;}_0x1c5ead['status'](_0xc6db6d);return _0x1c5ead[_0xc8d6('0x2d')](_0xc8d6('0x2e'),_0x5f1cc9+'-'+_0x6dacc0+'/'+_0x476d24)[_0xc8d6('0x29')](_0x264d59);}return null;};}function patchUpdates(_0x4f2d6b){return function(_0x415849){try{jsonpatch['apply'](_0x415849,_0x4f2d6b,!![]);}catch(_0x1703b9){return BPromise[_0xc8d6('0x2f')](_0x1703b9);}return _0x415849['save']();};}function saveUpdates(_0x46ceff,_0xcb8580){return function(_0x9ede7f){if(_0x9ede7f){return _0x9ede7f[_0xc8d6('0x30')](_0x46ceff)[_0xc8d6('0x1d')](function(_0xd8a31d){return _0xd8a31d;});}return null;};}function removeEntity(_0x1a1f10,_0x36e469){return function(_0x4d02ee){if(_0x4d02ee){return _0x4d02ee[_0xc8d6('0x31')]()['then'](function(){_0x1a1f10[_0xc8d6('0x27')](0xcc)[_0xc8d6('0x28')]();});}};}function handleEntityNotFound(_0x22c66a,_0x5ef8c5){return function(_0x149b6b){if(!_0x149b6b){_0x22c66a[_0xc8d6('0x26')](0x194);}return _0x149b6b;};}function handleError(_0x5a701c,_0x4ae1b5){_0x4ae1b5=_0x4ae1b5||0x1f4;return function(_0xd0aed0){logger[_0xc8d6('0x21')](_0xd0aed0[_0xc8d6('0x32')]);if(_0xd0aed0[_0xc8d6('0x33')]){delete _0xd0aed0[_0xc8d6('0x33')];}_0x5a701c[_0xc8d6('0x27')](_0x4ae1b5)[_0xc8d6('0x34')](_0xd0aed0);};}exports[_0xc8d6('0x35')]=function(_0x17ac53,_0x5815fa){var _0x5d34ea={},_0x598971={},_0x20bad9={'count':0x0,'rows':[]};var _0x474761=_[_0xc8d6('0x36')](db['Dynamics365Configuration'][_0xc8d6('0x37')],function(_0x569494){return{'name':_0x569494[_0xc8d6('0x38')],'type':_0x569494[_0xc8d6('0x39')][_0xc8d6('0x3a')]};});_0x598971[_0xc8d6('0x3b')]=_[_0xc8d6('0x36')](_0x474761,'name');_0x598971[_0xc8d6('0x3c')]=_[_0xc8d6('0x3d')](_0x17ac53[_0xc8d6('0x3c')]);_0x598971[_0xc8d6('0x3e')]=_[_0xc8d6('0x3f')](_0x598971[_0xc8d6('0x3b')],_0x598971[_0xc8d6('0x3c')]);_0x5d34ea[_0xc8d6('0x40')]=_[_0xc8d6('0x3f')](_0x598971[_0xc8d6('0x3b')],qs[_0xc8d6('0x41')](_0x17ac53['query']['fields']));_0x5d34ea['attributes']=_0x5d34ea['attributes'][_0xc8d6('0x42')]?_0x5d34ea[_0xc8d6('0x40')]:_0x598971['model'];if(!_0x17ac53[_0xc8d6('0x3c')][_0xc8d6('0x43')](_0xc8d6('0x44'))){_0x5d34ea[_0xc8d6('0x2c')]=qs[_0xc8d6('0x2c')](_0x17ac53[_0xc8d6('0x3c')][_0xc8d6('0x2c')]);_0x5d34ea[_0xc8d6('0x2b')]=qs[_0xc8d6('0x2b')](_0x17ac53['query'][_0xc8d6('0x2b')]);}_0x5d34ea[_0xc8d6('0x45')]=qs[_0xc8d6('0x46')](_0x17ac53[_0xc8d6('0x3c')]['sort']);_0x5d34ea[_0xc8d6('0x47')]=qs[_0xc8d6('0x3e')](_['pick'](_0x17ac53['query'],_0x598971[_0xc8d6('0x3e')]));if(_0x17ac53[_0xc8d6('0x3c')]['filter']){_0x5d34ea[_0xc8d6('0x47')]=_['merge'](_0x5d34ea[_0xc8d6('0x47')],{'$or':_[_0xc8d6('0x36')](_0x474761,function(_0x16e40a){if(_0x16e40a[_0xc8d6('0x39')]!==_0xc8d6('0x48')){var _0x484eaa={};_0x484eaa[_0x16e40a[_0xc8d6('0x33')]]={'$like':'%'+_0x17ac53[_0xc8d6('0x3c')][_0xc8d6('0x49')]+'%'};return _0x484eaa;}})});}_0x5d34ea=_['merge']({},_0x5d34ea,_0x17ac53['options']);var _0x4427a0={'where':_0x5d34ea['where']};return db[_0xc8d6('0x4a')]['count'](_0x4427a0)[_0xc8d6('0x1d')](function(_0x436b1c){_0x20bad9[_0xc8d6('0x2a')]=_0x436b1c;if(_0x17ac53[_0xc8d6('0x3c')][_0xc8d6('0x4b')]){_0x5d34ea[_0xc8d6('0x4c')]=[{'all':!![]}];}return db[_0xc8d6('0x4a')][_0xc8d6('0x4d')](_0x5d34ea);})[_0xc8d6('0x1d')](function(_0x1933e2){_0x20bad9[_0xc8d6('0x4e')]=_0x1933e2;return _0x20bad9;})[_0xc8d6('0x1d')](respondWithFilteredResult(_0x5815fa,_0x5d34ea))['catch'](handleError(_0x5815fa,null));};exports[_0xc8d6('0x4f')]=function(_0x2a89ca,_0x37ab1a){var _0x55dddd={'raw':![],'where':{'id':_0x2a89ca[_0xc8d6('0x50')]['id']}},_0x353112={};_0x353112['model']=_[_0xc8d6('0x3d')](db['Dynamics365Configuration'][_0xc8d6('0x37')]);_0x353112[_0xc8d6('0x3c')]=_[_0xc8d6('0x3d')](_0x2a89ca['query']);_0x353112[_0xc8d6('0x3e')]=_[_0xc8d6('0x3f')](_0x353112[_0xc8d6('0x3b')],_0x353112[_0xc8d6('0x3c')]);_0x55dddd[_0xc8d6('0x40')]=_[_0xc8d6('0x3f')](_0x353112['model'],qs['fields'](_0x2a89ca['query'][_0xc8d6('0x41')]));_0x55dddd['attributes']=_0x55dddd[_0xc8d6('0x40')][_0xc8d6('0x42')]?_0x55dddd['attributes']:_0x353112[_0xc8d6('0x3b')];if(_0x2a89ca[_0xc8d6('0x3c')][_0xc8d6('0x4b')]){_0x55dddd[_0xc8d6('0x4c')]=[{'all':!![]}];}_0x55dddd=_[_0xc8d6('0x51')]({},_0x55dddd,_0x2a89ca[_0xc8d6('0x52')]);return db[_0xc8d6('0x4a')][_0xc8d6('0x53')](_0x55dddd)['then'](handleEntityNotFound(_0x37ab1a,null))[_0xc8d6('0x1d')](respondWithResult(_0x37ab1a,null))[_0xc8d6('0x25')](handleError(_0x37ab1a,null));};exports[_0xc8d6('0x54')]=function(_0x100f0f,_0x4379f7){return db[_0xc8d6('0x4a')][_0xc8d6('0x54')](_0x100f0f[_0xc8d6('0x55')],{})[_0xc8d6('0x1d')](respondWithResult(_0x4379f7,0xc9))[_0xc8d6('0x25')](handleError(_0x4379f7,null));};exports[_0xc8d6('0x30')]=function(_0x19b607,_0x2e62d5){if(_0x19b607[_0xc8d6('0x55')]['id']){delete _0x19b607[_0xc8d6('0x55')]['id'];}return db['Dynamics365Configuration'][_0xc8d6('0x53')]({'where':{'id':_0x19b607[_0xc8d6('0x50')]['id']}})[_0xc8d6('0x1d')](handleEntityNotFound(_0x2e62d5,null))[_0xc8d6('0x1d')](saveUpdates(_0x19b607[_0xc8d6('0x55')],null))['then'](respondWithResult(_0x2e62d5,null))['catch'](handleError(_0x2e62d5,null));};exports['destroy']=function(_0x4d14ed,_0x56c811){return db['Dynamics365Configuration'][_0xc8d6('0x53')]({'where':{'id':_0x4d14ed[_0xc8d6('0x50')]['id']}})[_0xc8d6('0x1d')](handleEntityNotFound(_0x56c811,null))[_0xc8d6('0x1d')](removeEntity(_0x56c811,null))['catch'](handleError(_0x56c811,null));};exports[_0xc8d6('0x56')]=function(_0x5c3879,_0x1a18c8,_0x5b7621){var _0x45528e={};var _0x381bb3={};var _0xf7c27f;var _0x9e64fb;return db[_0xc8d6('0x4a')][_0xc8d6('0x57')]({'where':{'id':_0x5c3879['params']['id']}})[_0xc8d6('0x1d')](handleEntityNotFound(_0x1a18c8,null))[_0xc8d6('0x1d')](function(_0x44719b){if(_0x44719b){_0xf7c27f=_0x44719b;_0x381bb3[_0xc8d6('0x3b')]=_[_0xc8d6('0x3d')](db[_0xc8d6('0x58')][_0xc8d6('0x37')]);_0x381bb3[_0xc8d6('0x3c')]=_[_0xc8d6('0x3d')](_0x5c3879[_0xc8d6('0x3c')]);_0x381bb3[_0xc8d6('0x3e')]=_[_0xc8d6('0x3f')](_0x381bb3[_0xc8d6('0x3b')],_0x381bb3['query']);_0x45528e['attributes']=_[_0xc8d6('0x3f')](_0x381bb3['model'],qs[_0xc8d6('0x41')](_0x5c3879[_0xc8d6('0x3c')][_0xc8d6('0x41')]));_0x45528e[_0xc8d6('0x40')]=_0x45528e['attributes']['length']?_0x45528e['attributes']:_0x381bb3[_0xc8d6('0x3b')];_0x45528e[_0xc8d6('0x45')]=qs[_0xc8d6('0x46')](_0x5c3879[_0xc8d6('0x3c')][_0xc8d6('0x46')]);_0x45528e[_0xc8d6('0x47')]=qs[_0xc8d6('0x3e')](_[_0xc8d6('0x59')](_0x5c3879['query'],_0x381bb3[_0xc8d6('0x3e')]));if(_0x5c3879[_0xc8d6('0x3c')][_0xc8d6('0x49')]){_0x45528e[_0xc8d6('0x47')]=_[_0xc8d6('0x51')](_0x45528e[_0xc8d6('0x47')],{'$or':_[_0xc8d6('0x36')](_0x45528e['attributes'],function(_0xd1576c){var _0x165696={};_0x165696[_0xd1576c]={'$like':'%'+_0x5c3879[_0xc8d6('0x3c')][_0xc8d6('0x49')]+'%'};return _0x165696;})});}_0x45528e=_['merge']({},_0x45528e,_0x5c3879[_0xc8d6('0x52')]);return _0xf7c27f['getFields'](_0x45528e);}})[_0xc8d6('0x1d')](function(_0x44b5ad){if(_0x44b5ad){_0x9e64fb=_0x44b5ad[_0xc8d6('0x42')];if(!_0x5c3879[_0xc8d6('0x3c')]['hasOwnProperty'](_0xc8d6('0x44'))){_0x45528e['limit']=qs[_0xc8d6('0x2c')](_0x5c3879['query']['limit']);_0x45528e[_0xc8d6('0x2b')]=qs['offset'](_0x5c3879[_0xc8d6('0x3c')][_0xc8d6('0x2b')]);}return _0xf7c27f[_0xc8d6('0x56')](_0x45528e);}})[_0xc8d6('0x1d')](function(_0x25f60d){if(_0x25f60d){return _0x25f60d?{'count':_0x9e64fb,'rows':_0x25f60d}:null;}})['then'](respondWithResult(_0x1a18c8,null))[_0xc8d6('0x25')](handleError(_0x1a18c8,null));};exports[_0xc8d6('0x5a')]=function(_0x292b94,_0x454019,_0x4a26d5){var _0x24b0e7={};var _0x45b5bb={};var _0x19388b;var _0x3ee03f;return db['Dynamics365Configuration'][_0xc8d6('0x57')]({'where':{'id':_0x292b94['params']['id']}})[_0xc8d6('0x1d')](handleEntityNotFound(_0x454019,null))[_0xc8d6('0x1d')](function(_0x2d11b4){if(_0x2d11b4){_0x19388b=_0x2d11b4;_0x45b5bb['model']=_['keys'](db['Dynamics365Field'][_0xc8d6('0x37')]);_0x45b5bb[_0xc8d6('0x3c')]=_[_0xc8d6('0x3d')](_0x292b94[_0xc8d6('0x3c')]);_0x45b5bb[_0xc8d6('0x3e')]=_[_0xc8d6('0x3f')](_0x45b5bb[_0xc8d6('0x3b')],_0x45b5bb[_0xc8d6('0x3c')]);_0x24b0e7[_0xc8d6('0x40')]=_[_0xc8d6('0x3f')](_0x45b5bb[_0xc8d6('0x3b')],qs[_0xc8d6('0x41')](_0x292b94[_0xc8d6('0x3c')][_0xc8d6('0x41')]));_0x24b0e7[_0xc8d6('0x40')]=_0x24b0e7[_0xc8d6('0x40')][_0xc8d6('0x42')]?_0x24b0e7[_0xc8d6('0x40')]:_0x45b5bb[_0xc8d6('0x3b')];_0x24b0e7[_0xc8d6('0x45')]=qs[_0xc8d6('0x46')](_0x292b94[_0xc8d6('0x3c')][_0xc8d6('0x46')]);_0x24b0e7['where']=qs[_0xc8d6('0x3e')](_[_0xc8d6('0x59')](_0x292b94[_0xc8d6('0x3c')],_0x45b5bb[_0xc8d6('0x3e')]));if(_0x292b94['query'][_0xc8d6('0x49')]){_0x24b0e7[_0xc8d6('0x47')]=_[_0xc8d6('0x51')](_0x24b0e7[_0xc8d6('0x47')],{'$or':_[_0xc8d6('0x36')](_0x24b0e7[_0xc8d6('0x40')],function(_0x1c311a){var _0x50239f={};_0x50239f[_0x1c311a]={'$like':'%'+_0x292b94[_0xc8d6('0x3c')][_0xc8d6('0x49')]+'%'};return _0x50239f;})});}_0x24b0e7=_[_0xc8d6('0x51')]({},_0x24b0e7,_0x292b94[_0xc8d6('0x52')]);return _0x19388b[_0xc8d6('0x5a')](_0x24b0e7);}})[_0xc8d6('0x1d')](function(_0x3d6296){if(_0x3d6296){_0x3ee03f=_0x3d6296[_0xc8d6('0x42')];if(!_0x292b94['query'][_0xc8d6('0x43')](_0xc8d6('0x44'))){_0x24b0e7[_0xc8d6('0x2c')]=qs[_0xc8d6('0x2c')](_0x292b94[_0xc8d6('0x3c')][_0xc8d6('0x2c')]);_0x24b0e7[_0xc8d6('0x2b')]=qs[_0xc8d6('0x2b')](_0x292b94[_0xc8d6('0x3c')][_0xc8d6('0x2b')]);}return _0x19388b[_0xc8d6('0x5a')](_0x24b0e7);}})['then'](function(_0x3cc33c){if(_0x3cc33c){return _0x3cc33c?{'count':_0x3ee03f,'rows':_0x3cc33c}:null;}})[_0xc8d6('0x1d')](respondWithResult(_0x454019,null))[_0xc8d6('0x25')](handleError(_0x454019,null));};exports[_0xc8d6('0x5b')]=function(_0x22470b,_0x5c5d51,_0x31a403){var _0x103f8d={};var _0x24b666={};var _0x449f8a;var _0x8977df;return db[_0xc8d6('0x4a')][_0xc8d6('0x57')]({'where':{'id':_0x22470b['params']['id']}})[_0xc8d6('0x1d')](handleEntityNotFound(_0x5c5d51,null))['then'](function(_0x138e29){if(_0x138e29){_0x449f8a=_0x138e29;_0x24b666[_0xc8d6('0x3b')]=_['keys'](db[_0xc8d6('0x58')][_0xc8d6('0x37')]);_0x24b666[_0xc8d6('0x3c')]=_[_0xc8d6('0x3d')](_0x22470b[_0xc8d6('0x3c')]);_0x24b666[_0xc8d6('0x3e')]=_[_0xc8d6('0x3f')](_0x24b666[_0xc8d6('0x3b')],_0x24b666[_0xc8d6('0x3c')]);_0x103f8d[_0xc8d6('0x40')]=_[_0xc8d6('0x3f')](_0x24b666['model'],qs[_0xc8d6('0x41')](_0x22470b[_0xc8d6('0x3c')][_0xc8d6('0x41')]));_0x103f8d['attributes']=_0x103f8d[_0xc8d6('0x40')][_0xc8d6('0x42')]?_0x103f8d[_0xc8d6('0x40')]:_0x24b666['model'];_0x103f8d['order']=qs[_0xc8d6('0x46')](_0x22470b[_0xc8d6('0x3c')][_0xc8d6('0x46')]);_0x103f8d[_0xc8d6('0x47')]=qs[_0xc8d6('0x3e')](_[_0xc8d6('0x59')](_0x22470b[_0xc8d6('0x3c')],_0x24b666['filters']));if(_0x22470b[_0xc8d6('0x3c')][_0xc8d6('0x49')]){_0x103f8d[_0xc8d6('0x47')]=_[_0xc8d6('0x51')](_0x103f8d[_0xc8d6('0x47')],{'$or':_[_0xc8d6('0x36')](_0x103f8d['attributes'],function(_0x5d2a36){var _0x1ff434={};_0x1ff434[_0x5d2a36]={'$like':'%'+_0x22470b[_0xc8d6('0x3c')]['filter']+'%'};return _0x1ff434;})});}_0x103f8d=_[_0xc8d6('0x51')]({},_0x103f8d,_0x22470b[_0xc8d6('0x52')]);return _0x449f8a[_0xc8d6('0x5b')](_0x103f8d);}})[_0xc8d6('0x1d')](function(_0x1851c5){if(_0x1851c5){_0x8977df=_0x1851c5[_0xc8d6('0x42')];if(!_0x22470b[_0xc8d6('0x3c')][_0xc8d6('0x43')](_0xc8d6('0x44'))){_0x103f8d[_0xc8d6('0x2c')]=qs['limit'](_0x22470b['query'][_0xc8d6('0x2c')]);_0x103f8d['offset']=qs[_0xc8d6('0x2b')](_0x22470b['query']['offset']);}return _0x449f8a[_0xc8d6('0x5b')](_0x103f8d);}})['then'](function(_0x42d221){if(_0x42d221){return _0x42d221?{'count':_0x8977df,'rows':_0x42d221}:null;}})[_0xc8d6('0x1d')](respondWithResult(_0x5c5d51,null))[_0xc8d6('0x25')](handleError(_0x5c5d51,null));}; \ No newline at end of file +var _0xdc2f=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','json','offset','set','apply','reject','save','update','then','destroy','end','index','map','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','Dynamics365Configuration','count','includeAll','include','findAll','rows','show','params','find','create','body','catch','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','html-pdf','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xdc2f,0x1a8));var _0xfdc2=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xdc2f[_0x6cf19c];return _0xce14f3;};'use strict';var pdf=require(_0xfdc2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfdc2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdc2('0x2'));var moment=require('moment');var BPromise=require(_0xfdc2('0x3'));var Mustache=require(_0xfdc2('0x4'));var util=require(_0xfdc2('0x5'));var path=require('path');var sox=require(_0xfdc2('0x6'));var csv=require(_0xfdc2('0x7'));var ejs=require(_0xfdc2('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfdc2('0x9'));var jsforce=require(_0xfdc2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfdc2('0x7'));var querystring=require(_0xfdc2('0xb'));var Papa=require(_0xfdc2('0xc'));var Redis=require(_0xfdc2('0xd'));var authService=require(_0xfdc2('0xe'));var qs=require(_0xfdc2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfdc2('0x10'));var logger=require(_0xfdc2('0x11'))('api');var utils=require(_0xfdc2('0x12'));var config=require(_0xfdc2('0x13'));var db=require(_0xfdc2('0x14'))['db'];var jayson=require(_0xfdc2('0x15'));var client=jayson[_0xfdc2('0x16')][_0xfdc2('0x17')]({'port':0x232a});function checkPasswordPattern(_0x1933f9,_0xab3380,_0x9227f8){if(_0x9227f8){var _0x16c5f3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16c5f3['test'](_0xab3380)){return _0x1933f9;}else{throw new db['Sequelize'][(_0xfdc2('0x18'))](_0xfdc2('0x19'));}}else{return _0x1933f9;}}function respondWithRpcPromise(_0x35f553,_0x34de10,_0x47c33a,_0x2179ea){return new BPromise(function(_0x7e00c0,_0x5b7032){var _0x2f9dd8=_0x2179ea||client;return _0x2f9dd8[_0xfdc2('0x1a')](_0x35f553,_0x47c33a)['then'](function(_0x772588){logger[_0xfdc2('0x1b')](_0xfdc2('0x1c'),_0x34de10,_0xfdc2('0x1d'));logger[_0xfdc2('0x1e')](_0xfdc2('0x1f'),_0x34de10,_0xfdc2('0x1d'),JSON[_0xfdc2('0x20')](_0x772588));if(_0x772588[_0xfdc2('0x21')]){if(_0x772588[_0xfdc2('0x21')][_0xfdc2('0x22')]===0x1f4){logger[_0xfdc2('0x21')](_0xfdc2('0x1c'),_0x34de10,_0x772588[_0xfdc2('0x21')][_0xfdc2('0x23')]);return _0x5b7032(_0x772588[_0xfdc2('0x21')][_0xfdc2('0x23')]);}logger[_0xfdc2('0x21')](_0xfdc2('0x1c'),_0x34de10,_0x772588[_0xfdc2('0x21')]['message']);return _0x7e00c0(_0x772588[_0xfdc2('0x21')][_0xfdc2('0x23')]);}else{logger[_0xfdc2('0x1b')](_0xfdc2('0x1c'),_0x34de10,_0xfdc2('0x1d'));_0x7e00c0(_0x772588[_0xfdc2('0x24')][_0xfdc2('0x23')]);}})['catch'](function(_0x405074){logger[_0xfdc2('0x21')](_0xfdc2('0x1c'),_0x34de10,_0x405074);_0x5b7032(_0x405074);});});}function respondWithStatusCode(_0xa9ea70,_0x255e61){_0x255e61=_0x255e61||0xcc;return function(_0x59398e){if(_0x59398e){return _0xa9ea70[_0xfdc2('0x25')](_0x255e61);}return _0xa9ea70[_0xfdc2('0x26')](_0x255e61)['end']();};}function respondWithResult(_0x4d471a,_0x4092a6){_0x4092a6=_0x4092a6||0xc8;return function(_0x4345d7){if(_0x4345d7){return _0x4d471a[_0xfdc2('0x26')](_0x4092a6)[_0xfdc2('0x27')](_0x4345d7);}};}function respondWithFilteredResult(_0x5367d5,_0x166bf4){return function(_0x600fd8){if(_0x600fd8){var _0x1beb80=_0x600fd8['count'],_0x16080c=_0x166bf4[_0xfdc2('0x28')],_0x175727=_0x166bf4['offset']+_0x166bf4['limit'],_0x53968e;if(_0x175727>=_0x1beb80){_0x175727=_0x1beb80;_0x53968e=0xc8;}else{_0x53968e=0xce;}_0x5367d5[_0xfdc2('0x26')](_0x53968e);return _0x5367d5[_0xfdc2('0x29')]('Content-Range',_0x16080c+'-'+_0x175727+'/'+_0x1beb80)[_0xfdc2('0x27')](_0x600fd8);}return null;};}function patchUpdates(_0x2f2f14){return function(_0x4df3cd){try{jsonpatch[_0xfdc2('0x2a')](_0x4df3cd,_0x2f2f14,!![]);}catch(_0x56fc1b){return BPromise[_0xfdc2('0x2b')](_0x56fc1b);}return _0x4df3cd[_0xfdc2('0x2c')]();};}function saveUpdates(_0x475ecc,_0x17c663){return function(_0x427177){if(_0x427177){return _0x427177[_0xfdc2('0x2d')](_0x475ecc)[_0xfdc2('0x2e')](function(_0x406b30){return _0x406b30;});}return null;};}function removeEntity(_0x452b0a,_0x39a026){return function(_0x43f8d6){if(_0x43f8d6){return _0x43f8d6[_0xfdc2('0x2f')]()[_0xfdc2('0x2e')](function(){_0x452b0a[_0xfdc2('0x26')](0xcc)[_0xfdc2('0x30')]();});}};}function handleEntityNotFound(_0x49c605,_0x3a7691){return function(_0x1ed32c){if(!_0x1ed32c){_0x49c605[_0xfdc2('0x25')](0x194);}return _0x1ed32c;};}function handleError(_0x4cbd82,_0x8dc280){_0x8dc280=_0x8dc280||0x1f4;return function(_0x296873){logger[_0xfdc2('0x21')](_0x296873['stack']);if(_0x296873['name']){delete _0x296873['name'];}_0x4cbd82[_0xfdc2('0x26')](_0x8dc280)['send'](_0x296873);};}exports[_0xfdc2('0x31')]=function(_0x42b44a,_0x55874e){var _0x1b1605={},_0x4daf55={},_0x3748c6={'count':0x0,'rows':[]};var _0x435d53=_[_0xfdc2('0x32')](db['Dynamics365Configuration'][_0xfdc2('0x33')],function(_0x1091ce){return{'name':_0x1091ce[_0xfdc2('0x34')],'type':_0x1091ce[_0xfdc2('0x35')][_0xfdc2('0x36')]};});_0x4daf55[_0xfdc2('0x37')]=_[_0xfdc2('0x32')](_0x435d53,_0xfdc2('0x38'));_0x4daf55['query']=_[_0xfdc2('0x39')](_0x42b44a['query']);_0x4daf55[_0xfdc2('0x3a')]=_[_0xfdc2('0x3b')](_0x4daf55[_0xfdc2('0x37')],_0x4daf55['query']);_0x1b1605[_0xfdc2('0x3c')]=_[_0xfdc2('0x3b')](_0x4daf55['model'],qs['fields'](_0x42b44a[_0xfdc2('0x3d')][_0xfdc2('0x3e')]));_0x1b1605[_0xfdc2('0x3c')]=_0x1b1605[_0xfdc2('0x3c')][_0xfdc2('0x3f')]?_0x1b1605[_0xfdc2('0x3c')]:_0x4daf55[_0xfdc2('0x37')];if(!_0x42b44a['query'][_0xfdc2('0x40')](_0xfdc2('0x41'))){_0x1b1605[_0xfdc2('0x42')]=qs[_0xfdc2('0x42')](_0x42b44a[_0xfdc2('0x3d')][_0xfdc2('0x42')]);_0x1b1605[_0xfdc2('0x28')]=qs[_0xfdc2('0x28')](_0x42b44a['query'][_0xfdc2('0x28')]);}_0x1b1605[_0xfdc2('0x43')]=qs['sort'](_0x42b44a['query'][_0xfdc2('0x44')]);_0x1b1605['where']=qs[_0xfdc2('0x3a')](_[_0xfdc2('0x45')](_0x42b44a[_0xfdc2('0x3d')],_0x4daf55[_0xfdc2('0x3a')]));if(_0x42b44a[_0xfdc2('0x3d')][_0xfdc2('0x46')]){_0x1b1605[_0xfdc2('0x47')]=_[_0xfdc2('0x48')](_0x1b1605[_0xfdc2('0x47')],{'$or':_[_0xfdc2('0x32')](_0x435d53,function(_0x8529a0){if(_0x8529a0[_0xfdc2('0x35')]!=='VIRTUAL'){var _0x9a75f3={};_0x9a75f3[_0x8529a0['name']]={'$like':'%'+_0x42b44a['query'][_0xfdc2('0x46')]+'%'};return _0x9a75f3;}})});}_0x1b1605=_[_0xfdc2('0x48')]({},_0x1b1605,_0x42b44a[_0xfdc2('0x49')]);var _0x27111a={'where':_0x1b1605[_0xfdc2('0x47')]};return db[_0xfdc2('0x4a')]['count'](_0x27111a)[_0xfdc2('0x2e')](function(_0x34e9b7){_0x3748c6[_0xfdc2('0x4b')]=_0x34e9b7;if(_0x42b44a[_0xfdc2('0x3d')][_0xfdc2('0x4c')]){_0x1b1605[_0xfdc2('0x4d')]=[{'all':!![]}];}return db[_0xfdc2('0x4a')][_0xfdc2('0x4e')](_0x1b1605);})[_0xfdc2('0x2e')](function(_0xb5ecf0){_0x3748c6[_0xfdc2('0x4f')]=_0xb5ecf0;return _0x3748c6;})[_0xfdc2('0x2e')](respondWithFilteredResult(_0x55874e,_0x1b1605))['catch'](handleError(_0x55874e,null));};exports[_0xfdc2('0x50')]=function(_0x5a23c8,_0x77187d){var _0x3f2c24={'raw':![],'where':{'id':_0x5a23c8[_0xfdc2('0x51')]['id']}},_0x53ae09={};_0x53ae09[_0xfdc2('0x37')]=_[_0xfdc2('0x39')](db['Dynamics365Configuration']['rawAttributes']);_0x53ae09[_0xfdc2('0x3d')]=_[_0xfdc2('0x39')](_0x5a23c8[_0xfdc2('0x3d')]);_0x53ae09[_0xfdc2('0x3a')]=_['intersection'](_0x53ae09[_0xfdc2('0x37')],_0x53ae09[_0xfdc2('0x3d')]);_0x3f2c24[_0xfdc2('0x3c')]=_[_0xfdc2('0x3b')](_0x53ae09[_0xfdc2('0x37')],qs['fields'](_0x5a23c8[_0xfdc2('0x3d')][_0xfdc2('0x3e')]));_0x3f2c24[_0xfdc2('0x3c')]=_0x3f2c24['attributes'][_0xfdc2('0x3f')]?_0x3f2c24['attributes']:_0x53ae09[_0xfdc2('0x37')];if(_0x5a23c8[_0xfdc2('0x3d')][_0xfdc2('0x4c')]){_0x3f2c24['include']=[{'all':!![]}];}_0x3f2c24=_[_0xfdc2('0x48')]({},_0x3f2c24,_0x5a23c8[_0xfdc2('0x49')]);return db['Dynamics365Configuration'][_0xfdc2('0x52')](_0x3f2c24)[_0xfdc2('0x2e')](handleEntityNotFound(_0x77187d,null))[_0xfdc2('0x2e')](respondWithResult(_0x77187d,null))['catch'](handleError(_0x77187d,null));};exports[_0xfdc2('0x53')]=function(_0x5e8a61,_0x4ae04a){return db[_0xfdc2('0x4a')][_0xfdc2('0x53')](_0x5e8a61[_0xfdc2('0x54')],{})[_0xfdc2('0x2e')](respondWithResult(_0x4ae04a,0xc9))[_0xfdc2('0x55')](handleError(_0x4ae04a,null));};exports[_0xfdc2('0x2d')]=function(_0x55af23,_0x5b81d7){if(_0x55af23[_0xfdc2('0x54')]['id']){delete _0x55af23[_0xfdc2('0x54')]['id'];}return db[_0xfdc2('0x4a')][_0xfdc2('0x52')]({'where':{'id':_0x55af23[_0xfdc2('0x51')]['id']}})[_0xfdc2('0x2e')](handleEntityNotFound(_0x5b81d7,null))[_0xfdc2('0x2e')](saveUpdates(_0x55af23[_0xfdc2('0x54')],null))[_0xfdc2('0x2e')](respondWithResult(_0x5b81d7,null))['catch'](handleError(_0x5b81d7,null));};exports[_0xfdc2('0x2f')]=function(_0x52128e,_0x22f477){return db[_0xfdc2('0x4a')][_0xfdc2('0x52')]({'where':{'id':_0x52128e[_0xfdc2('0x51')]['id']}})[_0xfdc2('0x2e')](handleEntityNotFound(_0x22f477,null))[_0xfdc2('0x2e')](removeEntity(_0x22f477,null))[_0xfdc2('0x55')](handleError(_0x22f477,null));};exports[_0xfdc2('0x56')]=function(_0x4d30f1,_0x5cf41a,_0x2d9fab){var _0x760ee7={};var _0x97d1d9={};var _0x1d24df;var _0x1e9dc0;return db[_0xfdc2('0x4a')][_0xfdc2('0x57')]({'where':{'id':_0x4d30f1[_0xfdc2('0x51')]['id']}})[_0xfdc2('0x2e')](handleEntityNotFound(_0x5cf41a,null))['then'](function(_0xa5b3b4){if(_0xa5b3b4){_0x1d24df=_0xa5b3b4;_0x97d1d9[_0xfdc2('0x37')]=_[_0xfdc2('0x39')](db[_0xfdc2('0x58')][_0xfdc2('0x33')]);_0x97d1d9['query']=_['keys'](_0x4d30f1[_0xfdc2('0x3d')]);_0x97d1d9[_0xfdc2('0x3a')]=_[_0xfdc2('0x3b')](_0x97d1d9['model'],_0x97d1d9[_0xfdc2('0x3d')]);_0x760ee7[_0xfdc2('0x3c')]=_[_0xfdc2('0x3b')](_0x97d1d9[_0xfdc2('0x37')],qs[_0xfdc2('0x3e')](_0x4d30f1['query']['fields']));_0x760ee7[_0xfdc2('0x3c')]=_0x760ee7[_0xfdc2('0x3c')][_0xfdc2('0x3f')]?_0x760ee7[_0xfdc2('0x3c')]:_0x97d1d9['model'];_0x760ee7[_0xfdc2('0x43')]=qs[_0xfdc2('0x44')](_0x4d30f1[_0xfdc2('0x3d')][_0xfdc2('0x44')]);_0x760ee7[_0xfdc2('0x47')]=qs['filters'](_[_0xfdc2('0x45')](_0x4d30f1[_0xfdc2('0x3d')],_0x97d1d9[_0xfdc2('0x3a')]));if(_0x4d30f1[_0xfdc2('0x3d')][_0xfdc2('0x46')]){_0x760ee7[_0xfdc2('0x47')]=_[_0xfdc2('0x48')](_0x760ee7[_0xfdc2('0x47')],{'$or':_[_0xfdc2('0x32')](_0x760ee7[_0xfdc2('0x3c')],function(_0x1d0f1e){var _0x2147ad={};_0x2147ad[_0x1d0f1e]={'$like':'%'+_0x4d30f1[_0xfdc2('0x3d')]['filter']+'%'};return _0x2147ad;})});}_0x760ee7=_[_0xfdc2('0x48')]({},_0x760ee7,_0x4d30f1[_0xfdc2('0x49')]);return _0x1d24df[_0xfdc2('0x56')](_0x760ee7);}})[_0xfdc2('0x2e')](function(_0x5c7a00){if(_0x5c7a00){_0x1e9dc0=_0x5c7a00[_0xfdc2('0x3f')];if(!_0x4d30f1[_0xfdc2('0x3d')][_0xfdc2('0x40')]('nolimit')){_0x760ee7['limit']=qs[_0xfdc2('0x42')](_0x4d30f1[_0xfdc2('0x3d')]['limit']);_0x760ee7[_0xfdc2('0x28')]=qs['offset'](_0x4d30f1['query'][_0xfdc2('0x28')]);}return _0x1d24df['getFields'](_0x760ee7);}})[_0xfdc2('0x2e')](function(_0x37c985){if(_0x37c985){return _0x37c985?{'count':_0x1e9dc0,'rows':_0x37c985}:null;}})[_0xfdc2('0x2e')](respondWithResult(_0x5cf41a,null))['catch'](handleError(_0x5cf41a,null));};exports[_0xfdc2('0x59')]=function(_0x2df6b1,_0x5d1e18,_0x8bb969){var _0x13ec8b={};var _0x152926={};var _0x5db479;var _0x27163b;return db[_0xfdc2('0x4a')][_0xfdc2('0x57')]({'where':{'id':_0x2df6b1[_0xfdc2('0x51')]['id']}})[_0xfdc2('0x2e')](handleEntityNotFound(_0x5d1e18,null))['then'](function(_0x570023){if(_0x570023){_0x5db479=_0x570023;_0x152926['model']=_['keys'](db[_0xfdc2('0x58')][_0xfdc2('0x33')]);_0x152926[_0xfdc2('0x3d')]=_[_0xfdc2('0x39')](_0x2df6b1['query']);_0x152926[_0xfdc2('0x3a')]=_[_0xfdc2('0x3b')](_0x152926['model'],_0x152926[_0xfdc2('0x3d')]);_0x13ec8b[_0xfdc2('0x3c')]=_[_0xfdc2('0x3b')](_0x152926[_0xfdc2('0x37')],qs[_0xfdc2('0x3e')](_0x2df6b1[_0xfdc2('0x3d')][_0xfdc2('0x3e')]));_0x13ec8b[_0xfdc2('0x3c')]=_0x13ec8b[_0xfdc2('0x3c')][_0xfdc2('0x3f')]?_0x13ec8b[_0xfdc2('0x3c')]:_0x152926[_0xfdc2('0x37')];_0x13ec8b[_0xfdc2('0x43')]=qs[_0xfdc2('0x44')](_0x2df6b1[_0xfdc2('0x3d')][_0xfdc2('0x44')]);_0x13ec8b[_0xfdc2('0x47')]=qs[_0xfdc2('0x3a')](_[_0xfdc2('0x45')](_0x2df6b1[_0xfdc2('0x3d')],_0x152926[_0xfdc2('0x3a')]));if(_0x2df6b1[_0xfdc2('0x3d')][_0xfdc2('0x46')]){_0x13ec8b[_0xfdc2('0x47')]=_[_0xfdc2('0x48')](_0x13ec8b[_0xfdc2('0x47')],{'$or':_[_0xfdc2('0x32')](_0x13ec8b[_0xfdc2('0x3c')],function(_0x3d8022){var _0x1a4f0d={};_0x1a4f0d[_0x3d8022]={'$like':'%'+_0x2df6b1[_0xfdc2('0x3d')]['filter']+'%'};return _0x1a4f0d;})});}_0x13ec8b=_[_0xfdc2('0x48')]({},_0x13ec8b,_0x2df6b1[_0xfdc2('0x49')]);return _0x5db479[_0xfdc2('0x59')](_0x13ec8b);}})[_0xfdc2('0x2e')](function(_0x189bf1){if(_0x189bf1){_0x27163b=_0x189bf1[_0xfdc2('0x3f')];if(!_0x2df6b1[_0xfdc2('0x3d')][_0xfdc2('0x40')](_0xfdc2('0x41'))){_0x13ec8b['limit']=qs[_0xfdc2('0x42')](_0x2df6b1[_0xfdc2('0x3d')][_0xfdc2('0x42')]);_0x13ec8b['offset']=qs['offset'](_0x2df6b1[_0xfdc2('0x3d')][_0xfdc2('0x28')]);}return _0x5db479[_0xfdc2('0x59')](_0x13ec8b);}})[_0xfdc2('0x2e')](function(_0x100dad){if(_0x100dad){return _0x100dad?{'count':_0x27163b,'rows':_0x100dad}:null;}})['then'](respondWithResult(_0x5d1e18,null))[_0xfdc2('0x55')](handleError(_0x5d1e18,null));};exports[_0xfdc2('0x5a')]=function(_0x1a5906,_0x5727d6,_0x32579b){var _0x138f91={};var _0x3e1deb={};var _0x2b6d91;var _0x50d3de;return db[_0xfdc2('0x4a')][_0xfdc2('0x57')]({'where':{'id':_0x1a5906['params']['id']}})[_0xfdc2('0x2e')](handleEntityNotFound(_0x5727d6,null))[_0xfdc2('0x2e')](function(_0x49a8ea){if(_0x49a8ea){_0x2b6d91=_0x49a8ea;_0x3e1deb[_0xfdc2('0x37')]=_[_0xfdc2('0x39')](db['Dynamics365Field']['rawAttributes']);_0x3e1deb[_0xfdc2('0x3d')]=_[_0xfdc2('0x39')](_0x1a5906[_0xfdc2('0x3d')]);_0x3e1deb[_0xfdc2('0x3a')]=_[_0xfdc2('0x3b')](_0x3e1deb[_0xfdc2('0x37')],_0x3e1deb['query']);_0x138f91[_0xfdc2('0x3c')]=_[_0xfdc2('0x3b')](_0x3e1deb[_0xfdc2('0x37')],qs[_0xfdc2('0x3e')](_0x1a5906[_0xfdc2('0x3d')][_0xfdc2('0x3e')]));_0x138f91[_0xfdc2('0x3c')]=_0x138f91[_0xfdc2('0x3c')][_0xfdc2('0x3f')]?_0x138f91['attributes']:_0x3e1deb['model'];_0x138f91['order']=qs['sort'](_0x1a5906[_0xfdc2('0x3d')]['sort']);_0x138f91[_0xfdc2('0x47')]=qs['filters'](_['pick'](_0x1a5906[_0xfdc2('0x3d')],_0x3e1deb[_0xfdc2('0x3a')]));if(_0x1a5906[_0xfdc2('0x3d')]['filter']){_0x138f91[_0xfdc2('0x47')]=_[_0xfdc2('0x48')](_0x138f91[_0xfdc2('0x47')],{'$or':_[_0xfdc2('0x32')](_0x138f91[_0xfdc2('0x3c')],function(_0x50efd2){var _0x175f88={};_0x175f88[_0x50efd2]={'$like':'%'+_0x1a5906[_0xfdc2('0x3d')][_0xfdc2('0x46')]+'%'};return _0x175f88;})});}_0x138f91=_[_0xfdc2('0x48')]({},_0x138f91,_0x1a5906[_0xfdc2('0x49')]);return _0x2b6d91[_0xfdc2('0x5a')](_0x138f91);}})['then'](function(_0x387a4e){if(_0x387a4e){_0x50d3de=_0x387a4e['length'];if(!_0x1a5906['query']['hasOwnProperty']('nolimit')){_0x138f91['limit']=qs[_0xfdc2('0x42')](_0x1a5906[_0xfdc2('0x3d')][_0xfdc2('0x42')]);_0x138f91[_0xfdc2('0x28')]=qs[_0xfdc2('0x28')](_0x1a5906[_0xfdc2('0x3d')]['offset']);}return _0x2b6d91[_0xfdc2('0x5a')](_0x138f91);}})['then'](function(_0x4fee0d){if(_0x4fee0d){return _0x4fee0d?{'count':_0x50d3de,'rows':_0x4fee0d}:null;}})['then'](respondWithResult(_0x5727d6,null))[_0xfdc2('0x55')](handleError(_0x5727d6,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index f6d2550..9623f6f 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 _0x799a=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash','util'];(function(_0x2369e3,_0x589d00){var _0x2adeb5=function(_0x1a0f96){while(--_0x1a0f96){_0x2369e3['push'](_0x2369e3['shift']());}};_0x2adeb5(++_0x589d00);}(_0x799a,0x1ea));var _0xa799=function(_0x5583a7,_0x15e952){_0x5583a7=_0x5583a7-0x0;var _0x589639=_0x799a[_0x5583a7];return _0x589639;};'use strict';var _=require(_0xa799('0x0'));var util=require(_0xa799('0x1'));var logger=require(_0xa799('0x2'))('api');var moment=require(_0xa799('0x3'));var BPromise=require(_0xa799('0x4'));var rp=require(_0xa799('0x5'));var fs=require('fs');var path=require(_0xa799('0x6'));var rimraf=require(_0xa799('0x7'));var config=require(_0xa799('0x8'));var attributes=require(_0xa799('0x9'));module['exports']=function(_0x40fb42,_0x2fa0b5){return _0x40fb42['define'](_0xa799('0xa'),attributes,{'tableName':_0xa799('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb90=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','int_dynamics365_configurations'];(function(_0x428a10,_0x3d945c){var _0x2c1cb7=function(_0x386102){while(--_0x386102){_0x428a10['push'](_0x428a10['shift']());}};_0x2c1cb7(++_0x3d945c);}(_0xcb90,0x18c));var _0x0cb9=function(_0x563ca8,_0x13a872){_0x563ca8=_0x563ca8-0x0;var _0x59f451=_0xcb90[_0x563ca8];return _0x59f451;};'use strict';var _=require(_0x0cb9('0x0'));var util=require(_0x0cb9('0x1'));var logger=require(_0x0cb9('0x2'))(_0x0cb9('0x3'));var moment=require(_0x0cb9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0cb9('0x5'));var rimraf=require(_0x0cb9('0x6'));var config=require(_0x0cb9('0x7'));var attributes=require(_0x0cb9('0x8'));module[_0x0cb9('0x9')]=function(_0x10d9a6,_0x12fdb7){return _0x10d9a6[_0x0cb9('0xa')]('Dynamics365Configuration',attributes,{'tableName':_0x0cb9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 5c8b28e..3175940 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 _0xdbf6=['Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','debug'];(function(_0x342c3d,_0x538b21){var _0x131531=function(_0x88f4b){while(--_0x88f4b){_0x342c3d['push'](_0x342c3d['shift']());}};_0x131531(++_0x538b21);}(_0xdbf6,0x146));var _0x6dbf=function(_0x406c64,_0x14fbf4){_0x406c64=_0x406c64-0x0;var _0x2b5f80=_0xdbf6[_0x406c64];return _0x2b5f80;};'use strict';var _=require('lodash');var util=require(_0x6dbf('0x0'));var moment=require('moment');var BPromise=require(_0x6dbf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dbf('0x2'))['db'];var utils=require(_0x6dbf('0x3'));var logger=require('../../config/logger')(_0x6dbf('0x4'));var config=require(_0x6dbf('0x5'));var jayson=require(_0x6dbf('0x6'));var client=jayson[_0x6dbf('0x7')][_0x6dbf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25ba15,_0x398e0b,_0x47d5c4){return new BPromise(function(_0x15b8aa,_0x3afde2){return client[_0x6dbf('0x9')](_0x25ba15,_0x47d5c4)[_0x6dbf('0xa')](function(_0x59f4b5){logger[_0x6dbf('0xb')](_0x6dbf('0xc'),_0x398e0b,'request\x20sent');logger[_0x6dbf('0xd')](_0x6dbf('0xe'),_0x398e0b,_0x6dbf('0xf'),JSON['stringify'](_0x59f4b5));if(_0x59f4b5[_0x6dbf('0x10')]){if(_0x59f4b5[_0x6dbf('0x10')]['code']===0x1f4){logger[_0x6dbf('0x10')](_0x6dbf('0xc'),_0x398e0b,_0x59f4b5[_0x6dbf('0x10')][_0x6dbf('0x11')]);return _0x3afde2(_0x59f4b5['error'][_0x6dbf('0x11')]);}logger[_0x6dbf('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x398e0b,_0x59f4b5['error'][_0x6dbf('0x11')]);return _0x15b8aa(_0x59f4b5[_0x6dbf('0x10')]['message']);}else{logger[_0x6dbf('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x398e0b,_0x6dbf('0xf'));_0x15b8aa(_0x59f4b5[_0x6dbf('0x12')][_0x6dbf('0x11')]);}})[_0x6dbf('0x13')](function(_0x4d1b07){logger[_0x6dbf('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x398e0b,_0x4d1b07);_0x3afde2(_0x4d1b07);});});} \ No newline at end of file +var _0xa285=['jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4b6d8b,_0x3925c8){var _0x178c28=function(_0x307192){while(--_0x307192){_0x4b6d8b['push'](_0x4b6d8b['shift']());}};_0x178c28(++_0x3925c8);}(_0xa285,0x1af));var _0x5a28=function(_0x19bb4c,_0x1380c5){_0x19bb4c=_0x19bb4c-0x0;var _0x6bc86b=_0xa285[_0x19bb4c];return _0x6bc86b;};'use strict';var _=require(_0x5a28('0x0'));var util=require(_0x5a28('0x1'));var moment=require(_0x5a28('0x2'));var BPromise=require(_0x5a28('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a28('0x4'));var db=require(_0x5a28('0x5'))['db'];var utils=require(_0x5a28('0x6'));var logger=require(_0x5a28('0x7'))(_0x5a28('0x8'));var config=require('../../config/environment');var jayson=require(_0x5a28('0x9'));var client=jayson['client'][_0x5a28('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27e17b,_0x2b95fe,_0x33672c){return new BPromise(function(_0x256b2f,_0x2192d3){return client[_0x5a28('0xb')](_0x27e17b,_0x33672c)['then'](function(_0x2e6590){logger[_0x5a28('0xc')](_0x5a28('0xd'),_0x2b95fe,_0x5a28('0xe'));logger[_0x5a28('0xf')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x2b95fe,'request\x20sent',JSON[_0x5a28('0x10')](_0x2e6590));if(_0x2e6590['error']){if(_0x2e6590[_0x5a28('0x11')][_0x5a28('0x12')]===0x1f4){logger[_0x5a28('0x11')](_0x5a28('0xd'),_0x2b95fe,_0x2e6590[_0x5a28('0x11')]['message']);return _0x2192d3(_0x2e6590[_0x5a28('0x11')][_0x5a28('0x13')]);}logger[_0x5a28('0x11')](_0x5a28('0xd'),_0x2b95fe,_0x2e6590[_0x5a28('0x11')][_0x5a28('0x13')]);return _0x256b2f(_0x2e6590['error'][_0x5a28('0x13')]);}else{logger[_0x5a28('0xc')](_0x5a28('0xd'),_0x2b95fe,_0x5a28('0xe'));_0x256b2f(_0x2e6590[_0x5a28('0x14')][_0x5a28('0x13')]);}})[_0x5a28('0x15')](function(_0xf4f2a6){logger[_0x5a28('0x11')](_0x5a28('0xd'),_0x2b95fe,_0xf4f2a6);_0x2192d3(_0xf4f2a6);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index ae625f2..0341fc0 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 _0x4058=['../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4884f5,_0x2b8afb){var _0x3a551e=function(_0x2e4b1c){while(--_0x2e4b1c){_0x4884f5['push'](_0x4884f5['shift']());}};_0x3a551e(++_0x2b8afb);}(_0x4058,0x129));var _0x8405=function(_0x42cda2,_0x8c7efb){_0x42cda2=_0x42cda2-0x0;var _0x2135b7=_0x4058[_0x42cda2];return _0x2135b7;};'use strict';var multer=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var path=require(_0x8405('0x2'));var timeout=require(_0x8405('0x3'));var express=require(_0x8405('0x4'));var router=express[_0x8405('0x5')]();var auth=require(_0x8405('0x6'));var interaction=require(_0x8405('0x7'));var config=require(_0x8405('0x8'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8405('0x9')]);router[_0x8405('0xa')](_0x8405('0xb'),auth[_0x8405('0xc')](),controller[_0x8405('0xd')]);router['post']('/',auth[_0x8405('0xc')](),controller[_0x8405('0xe')]);router[_0x8405('0xf')]('/:id',auth[_0x8405('0xc')](),controller['update']);router[_0x8405('0x10')](_0x8405('0xb'),auth['isAuthenticated'](),controller[_0x8405('0x11')]);module[_0x8405('0x12')]=router; \ No newline at end of file +var _0xf4eb=['../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','Router'];(function(_0x542427,_0x329647){var _0x2ad09f=function(_0x465a0d){while(--_0x465a0d){_0x542427['push'](_0x542427['shift']());}};_0x2ad09f(++_0x329647);}(_0xf4eb,0xec));var _0xbf4e=function(_0x19e9d1,_0x4a4ba1){_0x19e9d1=_0x19e9d1-0x0;var _0x453300=_0xf4eb[_0x19e9d1];return _0x453300;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf4e('0x2'));var controller=require(_0xbf4e('0x3'));router[_0xbf4e('0x4')]('/',auth[_0xbf4e('0x5')](),controller[_0xbf4e('0x6')]);router[_0xbf4e('0x4')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller[_0xbf4e('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0xa')](_0xbf4e('0x7'),auth[_0xbf4e('0x5')](),controller[_0xbf4e('0xb')]);router[_0xbf4e('0xc')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xbf4e('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 25b13fc..2c0dce4 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 _0xed7f=['variable','customVariable','keyValue','STRING','ENUM','BOOLEAN','string'];(function(_0x248238,_0xe31996){var _0xb93bc4=function(_0xa7489e){while(--_0xa7489e){_0x248238['push'](_0x248238['shift']());}};_0xb93bc4(++_0xe31996);}(_0xed7f,0xd8));var _0xfed7=function(_0x107f31,_0x1bcd53){_0x107f31=_0x107f31-0x0;var _0x10560c=_0xed7f[_0x107f31];return _0x10560c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xfed7('0x0'),_0xfed7('0x1'),_0xfed7('0x2'),_0xfed7('0x3')),'defaultValue':_0xfed7('0x0')},'content':{'type':Sequelize[_0xfed7('0x4')]},'key':{'type':Sequelize[_0xfed7('0x4')]},'keyType':{'type':Sequelize[_0xfed7('0x5')](_0xfed7('0x0'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xfed7('0x4')]},'idField':{'type':Sequelize[_0xfed7('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfed7('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x25aa=['ENUM','sequelize','string','variable','customVariable','keyValue','STRING'];(function(_0x6f19cb,_0xc6fcdd){var _0x39ded3=function(_0x3456c4){while(--_0x3456c4){_0x6f19cb['push'](_0x6f19cb['shift']());}};_0x39ded3(++_0xc6fcdd);}(_0x25aa,0x151));var _0xa25a=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0x25aa[_0x4991d6];return _0x50faf7;};'use strict';var Sequelize=require(_0xa25a('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa25a('0x1'),_0xa25a('0x2'),_0xa25a('0x3'),_0xa25a('0x4')),'defaultValue':_0xa25a('0x1')},'content':{'type':Sequelize[_0xa25a('0x5')]},'key':{'type':Sequelize[_0xa25a('0x5')]},'keyType':{'type':Sequelize[_0xa25a('0x6')](_0xa25a('0x1'),_0xa25a('0x2'),_0xa25a('0x3'))},'keyContent':{'type':Sequelize[_0xa25a('0x5')]},'idField':{'type':Sequelize[_0xa25a('0x5')]},'nameField':{'type':Sequelize[_0xa25a('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 40c2ed8..97693fb 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 _0xaee6=['sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','params','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order'];(function(_0x36996d,_0x53f741){var _0x5f0877=function(_0xc52912){while(--_0xc52912){_0x36996d['push'](_0x36996d['shift']());}};_0x5f0877(++_0x53f741);}(_0xaee6,0x187));var _0x6aee=function(_0x48211e,_0x3fe6e1){_0x48211e=_0x48211e-0x0;var _0xb9369c=_0xaee6[_0x48211e];return _0xb9369c;};'use strict';var pdf=require(_0x6aee('0x0'));var emlformat=require(_0x6aee('0x1'));var rimraf=require(_0x6aee('0x2'));var zipdir=require(_0x6aee('0x3'));var jsonpatch=require(_0x6aee('0x4'));var rp=require(_0x6aee('0x5'));var moment=require('moment');var BPromise=require(_0x6aee('0x6'));var Mustache=require(_0x6aee('0x7'));var util=require(_0x6aee('0x8'));var path=require('path');var sox=require(_0x6aee('0x9'));var csv=require(_0x6aee('0xa'));var ejs=require(_0x6aee('0xb'));var fs=require('fs');var _=require(_0x6aee('0xc'));var squel=require(_0x6aee('0xd'));var crypto=require(_0x6aee('0xe'));var jsforce=require(_0x6aee('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6aee('0x10'));var Papa=require('papaparse');var Redis=require(_0x6aee('0x11'));var authService=require(_0x6aee('0x12'));var qs=require(_0x6aee('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6aee('0x14'));var logger=require(_0x6aee('0x15'))(_0x6aee('0x16'));var utils=require(_0x6aee('0x17'));var config=require('../../config/environment');var db=require(_0x6aee('0x18'))['db'];function respondWithStatusCode(_0x567627,_0x5b4551){_0x5b4551=_0x5b4551||0xcc;return function(_0x46e458){if(_0x46e458){return _0x567627[_0x6aee('0x19')](_0x5b4551);}return _0x567627[_0x6aee('0x1a')](_0x5b4551)[_0x6aee('0x1b')]();};}function respondWithResult(_0x5201fa,_0x2d13f5){_0x2d13f5=_0x2d13f5||0xc8;return function(_0x238b4d){if(_0x238b4d){return _0x5201fa['status'](_0x2d13f5)['json'](_0x238b4d);}};}function respondWithFilteredResult(_0x3179e3,_0x10a0c8){return function(_0x658ef){if(_0x658ef){var _0x18b259=_0x658ef[_0x6aee('0x1c')],_0x16cc61=_0x10a0c8['offset'],_0x257c0b=_0x10a0c8[_0x6aee('0x1d')]+_0x10a0c8[_0x6aee('0x1e')],_0x1c0235;if(_0x257c0b>=_0x18b259){_0x257c0b=_0x18b259;_0x1c0235=0xc8;}else{_0x1c0235=0xce;}_0x3179e3['status'](_0x1c0235);return _0x3179e3[_0x6aee('0x1f')](_0x6aee('0x20'),_0x16cc61+'-'+_0x257c0b+'/'+_0x18b259)['json'](_0x658ef);}return null;};}function patchUpdates(_0x1848a9){return function(_0x138d83){try{jsonpatch[_0x6aee('0x21')](_0x138d83,_0x1848a9,!![]);}catch(_0x3231af){return BPromise[_0x6aee('0x22')](_0x3231af);}return _0x138d83[_0x6aee('0x23')]();};}function saveUpdates(_0xf94d0d,_0x5969b2){return function(_0x25c43f){if(_0x25c43f){return _0x25c43f['update'](_0xf94d0d)['then'](function(_0x2097ed){return _0x2097ed;});}return null;};}function removeEntity(_0x3413df,_0x409295){return function(_0x4619b1){if(_0x4619b1){return _0x4619b1[_0x6aee('0x24')]()[_0x6aee('0x25')](function(){_0x3413df[_0x6aee('0x1a')](0xcc)[_0x6aee('0x1b')]();});}};}function handleEntityNotFound(_0x57b997,_0xc1b66c){return function(_0x511ea6){if(!_0x511ea6){_0x57b997['sendStatus'](0x194);}return _0x511ea6;};}function handleError(_0x5fbffb,_0x30f4cd){_0x30f4cd=_0x30f4cd||0x1f4;return function(_0x5ea8da){logger[_0x6aee('0x26')](_0x5ea8da[_0x6aee('0x27')]);if(_0x5ea8da['name']){delete _0x5ea8da[_0x6aee('0x28')];}_0x5fbffb[_0x6aee('0x1a')](_0x30f4cd)[_0x6aee('0x29')](_0x5ea8da);};}exports[_0x6aee('0x2a')]=function(_0xb5c93c,_0x321c55){var _0x411149={},_0x34f448={},_0x34034a={'count':0x0,'rows':[]};var _0x1916b7=_[_0x6aee('0x2b')](db[_0x6aee('0x2c')][_0x6aee('0x2d')],function(_0x7327d4){return{'name':_0x7327d4[_0x6aee('0x2e')],'type':_0x7327d4[_0x6aee('0x2f')]['key']};});_0x34f448['model']=_[_0x6aee('0x2b')](_0x1916b7,_0x6aee('0x28'));_0x34f448[_0x6aee('0x30')]=_[_0x6aee('0x31')](_0xb5c93c['query']);_0x34f448[_0x6aee('0x32')]=_['intersection'](_0x34f448[_0x6aee('0x33')],_0x34f448[_0x6aee('0x30')]);_0x411149[_0x6aee('0x34')]=_[_0x6aee('0x35')](_0x34f448[_0x6aee('0x33')],qs[_0x6aee('0x36')](_0xb5c93c[_0x6aee('0x30')][_0x6aee('0x36')]));_0x411149[_0x6aee('0x34')]=_0x411149[_0x6aee('0x34')][_0x6aee('0x37')]?_0x411149[_0x6aee('0x34')]:_0x34f448[_0x6aee('0x33')];if(!_0xb5c93c['query'][_0x6aee('0x38')](_0x6aee('0x39'))){_0x411149[_0x6aee('0x1e')]=qs[_0x6aee('0x1e')](_0xb5c93c[_0x6aee('0x30')][_0x6aee('0x1e')]);_0x411149[_0x6aee('0x1d')]=qs[_0x6aee('0x1d')](_0xb5c93c['query'][_0x6aee('0x1d')]);}_0x411149[_0x6aee('0x3a')]=qs[_0x6aee('0x3b')](_0xb5c93c[_0x6aee('0x30')][_0x6aee('0x3b')]);_0x411149[_0x6aee('0x3c')]=qs[_0x6aee('0x32')](_[_0x6aee('0x3d')](_0xb5c93c[_0x6aee('0x30')],_0x34f448[_0x6aee('0x32')]));if(_0xb5c93c[_0x6aee('0x30')]['filter']){_0x411149['where']=_[_0x6aee('0x3e')](_0x411149['where'],{'$or':_['map'](_0x1916b7,function(_0x387c58){if(_0x387c58[_0x6aee('0x2f')]!==_0x6aee('0x3f')){var _0x590825={};_0x590825[_0x387c58[_0x6aee('0x28')]]={'$like':'%'+_0xb5c93c[_0x6aee('0x30')][_0x6aee('0x40')]+'%'};return _0x590825;}})});}_0x411149=_[_0x6aee('0x3e')]({},_0x411149,_0xb5c93c['options']);var _0x1aba43={'where':_0x411149[_0x6aee('0x3c')]};return db[_0x6aee('0x2c')][_0x6aee('0x1c')](_0x1aba43)[_0x6aee('0x25')](function(_0x5b85cc){_0x34034a[_0x6aee('0x1c')]=_0x5b85cc;if(_0xb5c93c[_0x6aee('0x30')][_0x6aee('0x41')]){_0x411149[_0x6aee('0x42')]=[{'all':!![]}];}return db[_0x6aee('0x2c')]['findAll'](_0x411149);})[_0x6aee('0x25')](function(_0x49777d){_0x34034a[_0x6aee('0x43')]=_0x49777d;return _0x34034a;})[_0x6aee('0x25')](respondWithFilteredResult(_0x321c55,_0x411149))[_0x6aee('0x44')](handleError(_0x321c55,null));};exports[_0x6aee('0x45')]=function(_0x36c6a4,_0x1b1898){var _0x5ba53b={'raw':!![],'where':{'id':_0x36c6a4[_0x6aee('0x46')]['id']}},_0x58b3a2={};_0x58b3a2['model']=_[_0x6aee('0x31')](db[_0x6aee('0x2c')][_0x6aee('0x2d')]);_0x58b3a2[_0x6aee('0x30')]=_['keys'](_0x36c6a4[_0x6aee('0x30')]);_0x58b3a2['filters']=_[_0x6aee('0x35')](_0x58b3a2['model'],_0x58b3a2[_0x6aee('0x30')]);_0x5ba53b[_0x6aee('0x34')]=_[_0x6aee('0x35')](_0x58b3a2[_0x6aee('0x33')],qs[_0x6aee('0x36')](_0x36c6a4[_0x6aee('0x30')][_0x6aee('0x36')]));_0x5ba53b[_0x6aee('0x34')]=_0x5ba53b['attributes'][_0x6aee('0x37')]?_0x5ba53b[_0x6aee('0x34')]:_0x58b3a2['model'];if(_0x36c6a4['query'][_0x6aee('0x41')]){_0x5ba53b[_0x6aee('0x42')]=[{'all':!![]}];}_0x5ba53b=_['merge']({},_0x5ba53b,_0x36c6a4[_0x6aee('0x47')]);return db['Dynamics365Field'][_0x6aee('0x48')](_0x5ba53b)[_0x6aee('0x25')](handleEntityNotFound(_0x1b1898,null))[_0x6aee('0x25')](respondWithResult(_0x1b1898,null))[_0x6aee('0x44')](handleError(_0x1b1898,null));};exports['create']=function(_0x4f5218,_0x11f9e6){return db[_0x6aee('0x2c')][_0x6aee('0x49')](_0x4f5218[_0x6aee('0x4a')],{})['then'](respondWithResult(_0x11f9e6,0xc9))[_0x6aee('0x44')](handleError(_0x11f9e6,null));};exports['update']=function(_0x40ea5e,_0x3b0392){if(_0x40ea5e[_0x6aee('0x4a')]['id']){delete _0x40ea5e[_0x6aee('0x4a')]['id'];}return db['Dynamics365Field'][_0x6aee('0x48')]({'where':{'id':_0x40ea5e[_0x6aee('0x46')]['id']}})[_0x6aee('0x25')](handleEntityNotFound(_0x3b0392,null))[_0x6aee('0x25')](saveUpdates(_0x40ea5e[_0x6aee('0x4a')],null))[_0x6aee('0x25')](respondWithResult(_0x3b0392,null))[_0x6aee('0x44')](handleError(_0x3b0392,null));};exports[_0x6aee('0x24')]=function(_0x56004e,_0x23e252){return db[_0x6aee('0x2c')]['find']({'where':{'id':_0x56004e[_0x6aee('0x46')]['id']}})[_0x6aee('0x25')](handleEntityNotFound(_0x23e252,null))[_0x6aee('0x25')](removeEntity(_0x23e252,null))[_0x6aee('0x44')](handleError(_0x23e252,null));}; \ No newline at end of file +var _0xf777=['api','../../config/environment','../../mysqldb','end','status','json','count','offset','set','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','Dynamics365Field','includeAll','include','findAll','rows','catch','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x216a1b,_0x3d8947){var _0x40a5dd=function(_0x2ddbf4){while(--_0x2ddbf4){_0x216a1b['push'](_0x216a1b['shift']());}};_0x40a5dd(++_0x3d8947);}(_0xf777,0x1e9));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7f77('0x0'));var emlformat=require(_0x7f77('0x1'));var rimraf=require(_0x7f77('0x2'));var zipdir=require(_0x7f77('0x3'));var jsonpatch=require(_0x7f77('0x4'));var rp=require(_0x7f77('0x5'));var moment=require(_0x7f77('0x6'));var BPromise=require(_0x7f77('0x7'));var Mustache=require(_0x7f77('0x8'));var util=require('util');var path=require(_0x7f77('0x9'));var sox=require(_0x7f77('0xa'));var csv=require('to-csv');var ejs=require(_0x7f77('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7f77('0xc'));var crypto=require('crypto');var jsforce=require(_0x7f77('0xd'));var deskjs=require(_0x7f77('0xe'));var toCsv=require(_0x7f77('0xf'));var querystring=require(_0x7f77('0x10'));var Papa=require(_0x7f77('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7f77('0x12'));var as=require(_0x7f77('0x13'));var hardwareService=require(_0x7f77('0x14'));var logger=require(_0x7f77('0x15'))(_0x7f77('0x16'));var utils=require('../../config/utils');var config=require(_0x7f77('0x17'));var db=require(_0x7f77('0x18'))['db'];function respondWithStatusCode(_0x1640e9,_0x2ab82d){_0x2ab82d=_0x2ab82d||0xcc;return function(_0xd625fb){if(_0xd625fb){return _0x1640e9['sendStatus'](_0x2ab82d);}return _0x1640e9['status'](_0x2ab82d)[_0x7f77('0x19')]();};}function respondWithResult(_0x18f698,_0x3f7a60){_0x3f7a60=_0x3f7a60||0xc8;return function(_0x3f99e2){if(_0x3f99e2){return _0x18f698[_0x7f77('0x1a')](_0x3f7a60)[_0x7f77('0x1b')](_0x3f99e2);}};}function respondWithFilteredResult(_0x1f0729,_0x2efdd1){return function(_0x13e9a1){if(_0x13e9a1){var _0x3d8a45=_0x13e9a1[_0x7f77('0x1c')],_0x2c104a=_0x2efdd1[_0x7f77('0x1d')],_0x29d2cb=_0x2efdd1[_0x7f77('0x1d')]+_0x2efdd1['limit'],_0x186f7a;if(_0x29d2cb>=_0x3d8a45){_0x29d2cb=_0x3d8a45;_0x186f7a=0xc8;}else{_0x186f7a=0xce;}_0x1f0729['status'](_0x186f7a);return _0x1f0729[_0x7f77('0x1e')]('Content-Range',_0x2c104a+'-'+_0x29d2cb+'/'+_0x3d8a45)[_0x7f77('0x1b')](_0x13e9a1);}return null;};}function patchUpdates(_0x50eb96){return function(_0x23b8b0){try{jsonpatch[_0x7f77('0x1f')](_0x23b8b0,_0x50eb96,!![]);}catch(_0x359f63){return BPromise['reject'](_0x359f63);}return _0x23b8b0[_0x7f77('0x20')]();};}function saveUpdates(_0x3d91f8,_0x4d7283){return function(_0x175e9c){if(_0x175e9c){return _0x175e9c[_0x7f77('0x21')](_0x3d91f8)[_0x7f77('0x22')](function(_0x48647f){return _0x48647f;});}return null;};}function removeEntity(_0x24fac0,_0x5b869c){return function(_0x5c4049){if(_0x5c4049){return _0x5c4049[_0x7f77('0x23')]()[_0x7f77('0x22')](function(){_0x24fac0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2493a0,_0x87e6b6){return function(_0x1d8fe3){if(!_0x1d8fe3){_0x2493a0['sendStatus'](0x194);}return _0x1d8fe3;};}function handleError(_0x5e03a3,_0x13662c){_0x13662c=_0x13662c||0x1f4;return function(_0x8cf65b){logger[_0x7f77('0x24')](_0x8cf65b[_0x7f77('0x25')]);if(_0x8cf65b[_0x7f77('0x26')]){delete _0x8cf65b[_0x7f77('0x26')];}_0x5e03a3['status'](_0x13662c)[_0x7f77('0x27')](_0x8cf65b);};}exports['index']=function(_0x3c2ece,_0x29f31b){var _0x5e119f={},_0x2bd7e0={},_0x386842={'count':0x0,'rows':[]};var _0x51437e=_[_0x7f77('0x28')](db['Dynamics365Field'][_0x7f77('0x29')],function(_0x25fcae){return{'name':_0x25fcae[_0x7f77('0x2a')],'type':_0x25fcae[_0x7f77('0x2b')][_0x7f77('0x2c')]};});_0x2bd7e0[_0x7f77('0x2d')]=_[_0x7f77('0x28')](_0x51437e,'name');_0x2bd7e0[_0x7f77('0x2e')]=_[_0x7f77('0x2f')](_0x3c2ece[_0x7f77('0x2e')]);_0x2bd7e0[_0x7f77('0x30')]=_[_0x7f77('0x31')](_0x2bd7e0[_0x7f77('0x2d')],_0x2bd7e0[_0x7f77('0x2e')]);_0x5e119f['attributes']=_['intersection'](_0x2bd7e0['model'],qs[_0x7f77('0x32')](_0x3c2ece[_0x7f77('0x2e')][_0x7f77('0x32')]));_0x5e119f[_0x7f77('0x33')]=_0x5e119f[_0x7f77('0x33')][_0x7f77('0x34')]?_0x5e119f[_0x7f77('0x33')]:_0x2bd7e0[_0x7f77('0x2d')];if(!_0x3c2ece[_0x7f77('0x2e')][_0x7f77('0x35')](_0x7f77('0x36'))){_0x5e119f['limit']=qs[_0x7f77('0x37')](_0x3c2ece[_0x7f77('0x2e')][_0x7f77('0x37')]);_0x5e119f[_0x7f77('0x1d')]=qs[_0x7f77('0x1d')](_0x3c2ece[_0x7f77('0x2e')][_0x7f77('0x1d')]);}_0x5e119f[_0x7f77('0x38')]=qs[_0x7f77('0x39')](_0x3c2ece[_0x7f77('0x2e')]['sort']);_0x5e119f[_0x7f77('0x3a')]=qs['filters'](_[_0x7f77('0x3b')](_0x3c2ece[_0x7f77('0x2e')],_0x2bd7e0['filters']));if(_0x3c2ece['query'][_0x7f77('0x3c')]){_0x5e119f[_0x7f77('0x3a')]=_['merge'](_0x5e119f[_0x7f77('0x3a')],{'$or':_['map'](_0x51437e,function(_0x30521b){if(_0x30521b[_0x7f77('0x2b')]!=='VIRTUAL'){var _0x43a0a4={};_0x43a0a4[_0x30521b[_0x7f77('0x26')]]={'$like':'%'+_0x3c2ece[_0x7f77('0x2e')][_0x7f77('0x3c')]+'%'};return _0x43a0a4;}})});}_0x5e119f=_[_0x7f77('0x3d')]({},_0x5e119f,_0x3c2ece[_0x7f77('0x3e')]);var _0x397991={'where':_0x5e119f[_0x7f77('0x3a')]};return db[_0x7f77('0x3f')]['count'](_0x397991)[_0x7f77('0x22')](function(_0x333e2d){_0x386842[_0x7f77('0x1c')]=_0x333e2d;if(_0x3c2ece[_0x7f77('0x2e')][_0x7f77('0x40')]){_0x5e119f[_0x7f77('0x41')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x7f77('0x42')](_0x5e119f);})['then'](function(_0x2fc747){_0x386842[_0x7f77('0x43')]=_0x2fc747;return _0x386842;})['then'](respondWithFilteredResult(_0x29f31b,_0x5e119f))[_0x7f77('0x44')](handleError(_0x29f31b,null));};exports['show']=function(_0x1e1ca3,_0xbe7578){var _0x2078bf={'raw':!![],'where':{'id':_0x1e1ca3[_0x7f77('0x45')]['id']}},_0x3cbd7b={};_0x3cbd7b['model']=_[_0x7f77('0x2f')](db[_0x7f77('0x3f')][_0x7f77('0x29')]);_0x3cbd7b[_0x7f77('0x2e')]=_['keys'](_0x1e1ca3[_0x7f77('0x2e')]);_0x3cbd7b[_0x7f77('0x30')]=_[_0x7f77('0x31')](_0x3cbd7b['model'],_0x3cbd7b[_0x7f77('0x2e')]);_0x2078bf[_0x7f77('0x33')]=_['intersection'](_0x3cbd7b[_0x7f77('0x2d')],qs['fields'](_0x1e1ca3['query'][_0x7f77('0x32')]));_0x2078bf[_0x7f77('0x33')]=_0x2078bf['attributes'][_0x7f77('0x34')]?_0x2078bf[_0x7f77('0x33')]:_0x3cbd7b[_0x7f77('0x2d')];if(_0x1e1ca3[_0x7f77('0x2e')]['includeAll']){_0x2078bf[_0x7f77('0x41')]=[{'all':!![]}];}_0x2078bf=_[_0x7f77('0x3d')]({},_0x2078bf,_0x1e1ca3[_0x7f77('0x3e')]);return db[_0x7f77('0x3f')]['find'](_0x2078bf)[_0x7f77('0x22')](handleEntityNotFound(_0xbe7578,null))[_0x7f77('0x22')](respondWithResult(_0xbe7578,null))[_0x7f77('0x44')](handleError(_0xbe7578,null));};exports['create']=function(_0x5ce8e,_0x5299a4){return db[_0x7f77('0x3f')][_0x7f77('0x46')](_0x5ce8e[_0x7f77('0x47')],{})['then'](respondWithResult(_0x5299a4,0xc9))['catch'](handleError(_0x5299a4,null));};exports[_0x7f77('0x21')]=function(_0x296152,_0x390c64){if(_0x296152[_0x7f77('0x47')]['id']){delete _0x296152[_0x7f77('0x47')]['id'];}return db[_0x7f77('0x3f')][_0x7f77('0x48')]({'where':{'id':_0x296152[_0x7f77('0x45')]['id']}})[_0x7f77('0x22')](handleEntityNotFound(_0x390c64,null))[_0x7f77('0x22')](saveUpdates(_0x296152[_0x7f77('0x47')],null))[_0x7f77('0x22')](respondWithResult(_0x390c64,null))['catch'](handleError(_0x390c64,null));};exports[_0x7f77('0x23')]=function(_0x44bd1d,_0x4675ed){return db[_0x7f77('0x3f')][_0x7f77('0x48')]({'where':{'id':_0x44bd1d[_0x7f77('0x45')]['id']}})[_0x7f77('0x22')](handleEntityNotFound(_0x4675ed,null))[_0x7f77('0x22')](removeEntity(_0x4675ed,null))[_0x7f77('0x44')](handleError(_0x4675ed,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 3cbf95d..7d2b6f3 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 _0xe9df=['FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index'];(function(_0x47e137,_0x3b8cd6){var _0x223976=function(_0x3388c6){while(--_0x3388c6){_0x47e137['push'](_0x47e137['shift']());}};_0x223976(++_0x3b8cd6);}(_0xe9df,0xa6));var _0xfe9d=function(_0x1b4474,_0x45738f){_0x1b4474=_0x1b4474-0x0;var _0x3425da=_0xe9df[_0x1b4474];return _0x3425da;};'use strict';var _=require(_0xfe9d('0x0'));var util=require(_0xfe9d('0x1'));var logger=require(_0xfe9d('0x2'))(_0xfe9d('0x3'));var moment=require('moment');var BPromise=require(_0xfe9d('0x4'));var rp=require(_0xfe9d('0x5'));var fs=require('fs');var path=require(_0xfe9d('0x6'));var rimraf=require(_0xfe9d('0x7'));var config=require(_0xfe9d('0x8'));var attributes=require(_0xfe9d('0x9'));module[_0xfe9d('0xa')]=function(_0x55453b,_0x45ee28){return _0x55453b[_0xfe9d('0xb')](_0xfe9d('0xc'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xfe9d('0xd'),'fields':['idField',_0xfe9d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6857=['rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1416c1,_0x1998f9){var _0x73ec0e=function(_0x4b9a80){while(--_0x4b9a80){_0x1416c1['push'](_0x1416c1['shift']());}};_0x73ec0e(++_0x1998f9);}(_0x6857,0xa3));var _0x7685=function(_0x5910c5,_0x274f1f){_0x5910c5=_0x5910c5-0x0;var _0x587619=_0x6857[_0x5910c5];return _0x587619;};'use strict';var _=require(_0x7685('0x0'));var util=require(_0x7685('0x1'));var logger=require(_0x7685('0x2'))(_0x7685('0x3'));var moment=require(_0x7685('0x4'));var BPromise=require(_0x7685('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7685('0x6'));var config=require('../../config/environment');var attributes=require(_0x7685('0x7'));module[_0x7685('0x8')]=function(_0x43c29c,_0x4ad34b){return _0x43c29c[_0x7685('0x9')](_0x7685('0xa'),attributes,{'tableName':_0x7685('0xb'),'paranoid':![],'indexes':[{'name':_0x7685('0xc'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 2124cb5..7948265 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 _0x326f=['info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2976cd,_0x5c1f6d){var _0x518222=function(_0x248cac){while(--_0x248cac){_0x2976cd['push'](_0x2976cd['shift']());}};_0x518222(++_0x5c1f6d);}(_0x326f,0xd1));var _0xf326=function(_0x294f81,_0x10d6cb){_0x294f81=_0x294f81-0x0;var _0x1ac0c8=_0x326f[_0x294f81];return _0x1ac0c8;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x6dc0=['rpc','../../config/environment','client','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2398b1,_0x24aff3){var _0x21d136=function(_0x533c5d){while(--_0x533c5d){_0x2398b1['push'](_0x2398b1['shift']());}};_0x21d136(++_0x24aff3);}(_0x6dc0,0xb6));var _0x06dc=function(_0x393868,_0x491e3c){_0x393868=_0x393868-0x0;var _0x42bc61=_0x6dc0[_0x393868];return _0x42bc61;};'use strict';var _=require(_0x06dc('0x0'));var util=require(_0x06dc('0x1'));var moment=require(_0x06dc('0x2'));var BPromise=require('bluebird');var rs=require(_0x06dc('0x3'));var fs=require('fs');var Redis=require(_0x06dc('0x4'));var db=require(_0x06dc('0x5'))['db'];var utils=require(_0x06dc('0x6'));var logger=require('../../config/logger')(_0x06dc('0x7'));var config=require(_0x06dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x06dc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x419534,_0x3212ca,_0x14c15b){return new BPromise(function(_0x10e23b,_0x140eef){return client['request'](_0x419534,_0x14c15b)['then'](function(_0x480f30){logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,'request\x20sent');logger[_0x06dc('0xc')](_0x06dc('0xd'),_0x3212ca,_0x06dc('0xe'),JSON[_0x06dc('0xf')](_0x480f30));if(_0x480f30['error']){if(_0x480f30[_0x06dc('0x10')][_0x06dc('0x11')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x3212ca,_0x480f30['error']['message']);return _0x140eef(_0x480f30[_0x06dc('0x10')]['message']);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x3212ca,_0x480f30[_0x06dc('0x10')][_0x06dc('0x12')]);return _0x10e23b(_0x480f30[_0x06dc('0x10')]['message']);}else{logger[_0x06dc('0xa')](_0x06dc('0xb'),_0x3212ca,_0x06dc('0xe'));_0x10e23b(_0x480f30[_0x06dc('0x13')]['message']);}})[_0x06dc('0x14')](function(_0x30c1c5){logger[_0x06dc('0x10')](_0x06dc('0xb'),_0x3212ca,_0x30c1c5);_0x140eef(_0x30c1c5);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 2e3182d..8f083f4 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 _0xd883=['destroy','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','update','delete'];(function(_0x56908c,_0x4b974d){var _0x4bd4f7=function(_0x2d8755){while(--_0x2d8755){_0x56908c['push'](_0x56908c['shift']());}};_0x4bd4f7(++_0x4b974d);}(_0xd883,0x86));var _0x3d88=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd883[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x3d88('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3d88('0x1'));var router=express[_0x3d88('0x2')]();var auth=require(_0x3d88('0x3'));var interaction=require(_0x3d88('0x4'));var config=require(_0x3d88('0x5'));var controller=require('./intFreshdeskAccount.controller');router[_0x3d88('0x6')]('/',auth[_0x3d88('0x7')](),controller[_0x3d88('0x8')]);router[_0x3d88('0x6')](_0x3d88('0x9'),auth[_0x3d88('0x7')](),controller[_0x3d88('0xa')]);router[_0x3d88('0x6')](_0x3d88('0xb'),auth[_0x3d88('0x7')](),controller[_0x3d88('0xc')]);router[_0x3d88('0x6')](_0x3d88('0xd'),auth['isAuthenticated'](),controller[_0x3d88('0xe')]);router[_0x3d88('0xf')]('/',auth[_0x3d88('0x7')](),controller['create']);router['post'](_0x3d88('0xb'),auth[_0x3d88('0x7')](),controller['addConfiguration']);router['put'](_0x3d88('0x9'),auth[_0x3d88('0x7')](),controller[_0x3d88('0x10')]);router[_0x3d88('0x11')](_0x3d88('0x9'),auth['isAuthenticated'](),controller[_0x3d88('0x12')]);module['exports']=router; \ No newline at end of file +var _0x7ef6=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','getFields','post','put','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1acbef,_0x1c1bfc){var _0x14d1e0=function(_0x4c0165){while(--_0x4c0165){_0x1acbef['push'](_0x1acbef['shift']());}};_0x14d1e0(++_0x1c1bfc);}(_0x7ef6,0x159));var _0x67ef=function(_0x46ac7d,_0x42ebc3){_0x46ac7d=_0x46ac7d-0x0;var _0x41e45e=_0x7ef6[_0x46ac7d];return _0x41e45e;};'use strict';var multer=require(_0x67ef('0x0'));var util=require(_0x67ef('0x1'));var path=require(_0x67ef('0x2'));var timeout=require(_0x67ef('0x3'));var express=require(_0x67ef('0x4'));var router=express[_0x67ef('0x5')]();var auth=require(_0x67ef('0x6'));var interaction=require(_0x67ef('0x7'));var config=require(_0x67ef('0x8'));var controller=require(_0x67ef('0x9'));router['get']('/',auth[_0x67ef('0xa')](),controller[_0x67ef('0xb')]);router[_0x67ef('0xc')](_0x67ef('0xd'),auth[_0x67ef('0xa')](),controller[_0x67ef('0xe')]);router['get'](_0x67ef('0xf'),auth[_0x67ef('0xa')](),controller['getConfigurations']);router[_0x67ef('0xc')](_0x67ef('0x10'),auth[_0x67ef('0xa')](),controller[_0x67ef('0x11')]);router['post']('/',auth[_0x67ef('0xa')](),controller['create']);router[_0x67ef('0x12')]('/:id/configurations',auth[_0x67ef('0xa')](),controller['addConfiguration']);router[_0x67ef('0x13')](_0x67ef('0xd'),auth[_0x67ef('0xa')](),controller['update']);router[_0x67ef('0x14')](_0x67ef('0xd'),auth[_0x67ef('0xa')](),controller[_0x67ef('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 93df44b..ea90cbb 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 _0x17a7=['username','remoteUri','STRING'];(function(_0x29a9a1,_0x933e2d){var _0x2226b7=function(_0x2f41cb){while(--_0x2f41cb){_0x29a9a1['push'](_0x29a9a1['shift']());}};_0x2226b7(++_0x933e2d);}(_0x17a7,0xc2));var _0x717a=function(_0x43df48,_0x157e38){_0x43df48=_0x43df48-0x0;var _0x5681af=_0x17a7[_0x43df48];return _0x5681af;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x717a('0x0')]},'username':{'type':Sequelize[_0x717a('0x0')],'unique':_0x717a('0x1')},'apiKey':{'type':Sequelize[_0x717a('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x717a('0x2')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5713=['sequelize','exports','STRING','username','remoteUri'];(function(_0x178ba3,_0x1b10cd){var _0x4a2bb3=function(_0x389d8c){while(--_0x389d8c){_0x178ba3['push'](_0x178ba3['shift']());}};_0x4a2bb3(++_0x1b10cd);}(_0x5713,0x1c7));var _0x3571=function(_0x2273ac,_0x4a2a19){_0x2273ac=_0x2273ac-0x0;var _0x3bea1c=_0x5713[_0x2273ac];return _0x3bea1c;};'use strict';var Sequelize=require(_0x3571('0x0'));module[_0x3571('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3571('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x3571('0x3')},'apiKey':{'type':Sequelize[_0x3571('0x2')]},'remoteUri':{'type':Sequelize[_0x3571('0x2')],'unique':_0x3571('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 7835302..9ebdcdf 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 _0x5998=['to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','update','destroy','stack','name','send','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','count','includeAll','rows','show','params','length','include','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','order','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','requester','subject','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','map','label','choices','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox'];(function(_0x568e72,_0x494e27){var _0x4576c0=function(_0x216307){while(--_0x216307){_0x568e72['push'](_0x568e72['shift']());}};_0x4576c0(++_0x494e27);}(_0x5998,0xf2));var _0x8599=function(_0x10d308,_0x98cd27){_0x10d308=_0x10d308-0x0;var _0x370b8c=_0x5998[_0x10d308];return _0x370b8c;};'use strict';var pdf=require(_0x8599('0x0'));var emlformat=require(_0x8599('0x1'));var rimraf=require(_0x8599('0x2'));var zipdir=require(_0x8599('0x3'));var jsonpatch=require(_0x8599('0x4'));var rp=require(_0x8599('0x5'));var moment=require(_0x8599('0x6'));var BPromise=require(_0x8599('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8599('0x8'));var sox=require(_0x8599('0x9'));var csv=require(_0x8599('0xa'));var ejs=require(_0x8599('0xb'));var fs=require('fs');var _=require(_0x8599('0xc'));var squel=require('squel');var crypto=require(_0x8599('0xd'));var jsforce=require(_0x8599('0xe'));var deskjs=require(_0x8599('0xf'));var toCsv=require(_0x8599('0xa'));var querystring=require('querystring');var Papa=require(_0x8599('0x10'));var Redis=require(_0x8599('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8599('0x12'));var as=require(_0x8599('0x13'));var hardwareService=require(_0x8599('0x14'));var logger=require('../../config/logger')(_0x8599('0x15'));var utils=require(_0x8599('0x16'));var config=require(_0x8599('0x17'));var db=require(_0x8599('0x18'))['db'];var integrations=require(_0x8599('0x19'));var jayson=require('jayson/promise');var client=jayson[_0x8599('0x1a')][_0x8599('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x523291,_0x4d0c6e,_0x41e97b){if(_0x41e97b){var _0x577220=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x577220[_0x8599('0x1c')](_0x4d0c6e)){return _0x523291;}else{throw new db[(_0x8599('0x1d'))][(_0x8599('0x1e'))](_0x8599('0x1f'));}}else{return _0x523291;}}function respondWithRpcPromise(_0x3f020c,_0x5c819c,_0x1249c2,_0x1859b8){return new BPromise(function(_0x398aec,_0x410f06){var _0x4623e4=_0x1859b8||client;return _0x4623e4[_0x8599('0x20')](_0x3f020c,_0x1249c2)[_0x8599('0x21')](function(_0x41958d){logger[_0x8599('0x22')](_0x8599('0x23'),_0x5c819c,_0x8599('0x24'));logger[_0x8599('0x25')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x5c819c,'request\x20sent',JSON[_0x8599('0x26')](_0x41958d));if(_0x41958d['error']){if(_0x41958d[_0x8599('0x27')]['code']===0x1f4){logger[_0x8599('0x27')](_0x8599('0x23'),_0x5c819c,_0x41958d[_0x8599('0x27')][_0x8599('0x28')]);return _0x410f06(_0x41958d[_0x8599('0x27')]['message']);}logger[_0x8599('0x27')]('FreshdeskAccount,\x20%s,\x20%s',_0x5c819c,_0x41958d[_0x8599('0x27')][_0x8599('0x28')]);return _0x398aec(_0x41958d[_0x8599('0x27')][_0x8599('0x28')]);}else{logger['info'](_0x8599('0x23'),_0x5c819c,_0x8599('0x24'));_0x398aec(_0x41958d[_0x8599('0x29')][_0x8599('0x28')]);}})[_0x8599('0x2a')](function(_0x3dae1a){logger[_0x8599('0x27')](_0x8599('0x23'),_0x5c819c,_0x3dae1a);_0x410f06(_0x3dae1a);});});}function respondWithStatusCode(_0x290f38,_0x2dd63c){_0x2dd63c=_0x2dd63c||0xcc;return function(_0x211932){if(_0x211932){return _0x290f38[_0x8599('0x2b')](_0x2dd63c);}return _0x290f38['status'](_0x2dd63c)[_0x8599('0x2c')]();};}function respondWithResult(_0xd8502e,_0x59f2d7){_0x59f2d7=_0x59f2d7||0xc8;return function(_0x3a5023){if(_0x3a5023){return _0xd8502e[_0x8599('0x2d')](_0x59f2d7)[_0x8599('0x2e')](_0x3a5023);}};}function respondWithFilteredResult(_0x1fa8c5,_0x32b102){return function(_0x198b53){if(_0x198b53){var _0x3b26a5=_0x198b53['count'],_0x162a64=_0x32b102['offset'],_0x44f72c=_0x32b102[_0x8599('0x2f')]+_0x32b102[_0x8599('0x30')],_0x4d3ad4;if(_0x44f72c>=_0x3b26a5){_0x44f72c=_0x3b26a5;_0x4d3ad4=0xc8;}else{_0x4d3ad4=0xce;}_0x1fa8c5[_0x8599('0x2d')](_0x4d3ad4);return _0x1fa8c5[_0x8599('0x31')](_0x8599('0x32'),_0x162a64+'-'+_0x44f72c+'/'+_0x3b26a5)[_0x8599('0x2e')](_0x198b53);}return null;};}function patchUpdates(_0x1b2f05){return function(_0x42e979){try{jsonpatch['apply'](_0x42e979,_0x1b2f05,!![]);}catch(_0x4fc7e0){return BPromise['reject'](_0x4fc7e0);}return _0x42e979['save']();};}function saveUpdates(_0x1116ad,_0x4ce052){return function(_0x362ff5){if(_0x362ff5){return _0x362ff5[_0x8599('0x33')](_0x1116ad)[_0x8599('0x21')](function(_0x19c480){return _0x19c480;});}return null;};}function removeEntity(_0x5d0826,_0x34b693){return function(_0x347a62){if(_0x347a62){return _0x347a62[_0x8599('0x34')]()[_0x8599('0x21')](function(){_0x5d0826[_0x8599('0x2d')](0xcc)[_0x8599('0x2c')]();});}};}function handleEntityNotFound(_0x3b75b0,_0x3227cb){return function(_0x391743){if(!_0x391743){_0x3b75b0[_0x8599('0x2b')](0x194);}return _0x391743;};}function handleError(_0xe1fec4,_0x5a0ff2){_0x5a0ff2=_0x5a0ff2||0x1f4;return function(_0x645344){logger[_0x8599('0x27')](_0x645344[_0x8599('0x35')]);if(_0x645344[_0x8599('0x36')]){delete _0x645344[_0x8599('0x36')];}_0xe1fec4[_0x8599('0x2d')](_0x5a0ff2)[_0x8599('0x37')](_0x645344);};}exports['index']=function(_0x5caed3,_0x763e26){var _0x13adb2={},_0x1551d3={},_0x5d783d={'count':0x0,'rows':[]};var _0x275dac=_['map'](db['FreshdeskAccount'][_0x8599('0x38')],function(_0x33a14a){return{'name':_0x33a14a[_0x8599('0x39')],'type':_0x33a14a[_0x8599('0x3a')]['key']};});_0x1551d3['model']=_['map'](_0x275dac,_0x8599('0x36'));_0x1551d3[_0x8599('0x3b')]=_[_0x8599('0x3c')](_0x5caed3[_0x8599('0x3b')]);_0x1551d3[_0x8599('0x3d')]=_[_0x8599('0x3e')](_0x1551d3[_0x8599('0x3f')],_0x1551d3[_0x8599('0x3b')]);_0x13adb2[_0x8599('0x40')]=_['intersection'](_0x1551d3[_0x8599('0x3f')],qs[_0x8599('0x41')](_0x5caed3[_0x8599('0x3b')][_0x8599('0x41')]));_0x13adb2['attributes']=_0x13adb2[_0x8599('0x40')]['length']?_0x13adb2[_0x8599('0x40')]:_0x1551d3[_0x8599('0x3f')];if(!_0x5caed3[_0x8599('0x3b')]['hasOwnProperty'](_0x8599('0x42'))){_0x13adb2[_0x8599('0x30')]=qs[_0x8599('0x30')](_0x5caed3[_0x8599('0x3b')][_0x8599('0x30')]);_0x13adb2[_0x8599('0x2f')]=qs[_0x8599('0x2f')](_0x5caed3[_0x8599('0x3b')]['offset']);}_0x13adb2['order']=qs[_0x8599('0x43')](_0x5caed3[_0x8599('0x3b')][_0x8599('0x43')]);_0x13adb2[_0x8599('0x44')]=qs[_0x8599('0x3d')](_[_0x8599('0x45')](_0x5caed3['query'],_0x1551d3[_0x8599('0x3d')]));if(_0x5caed3[_0x8599('0x3b')][_0x8599('0x46')]){_0x13adb2[_0x8599('0x44')]=_[_0x8599('0x47')](_0x13adb2[_0x8599('0x44')],{'$or':_['map'](_0x275dac,function(_0x119a76){if(_0x119a76[_0x8599('0x3a')]!==_0x8599('0x48')){var _0x35259b={};_0x35259b[_0x119a76['name']]={'$like':'%'+_0x5caed3[_0x8599('0x3b')]['filter']+'%'};return _0x35259b;}})});}_0x13adb2=_[_0x8599('0x47')]({},_0x13adb2,_0x5caed3[_0x8599('0x49')]);var _0xcae185={'where':_0x13adb2[_0x8599('0x44')]};return db[_0x8599('0x4a')]['count'](_0xcae185)[_0x8599('0x21')](function(_0x47a49b){_0x5d783d[_0x8599('0x4b')]=_0x47a49b;if(_0x5caed3['query'][_0x8599('0x4c')]){_0x13adb2['include']=[{'all':!![]}];}return db[_0x8599('0x4a')]['findAll'](_0x13adb2);})['then'](function(_0x1500cb){_0x5d783d[_0x8599('0x4d')]=_0x1500cb;return _0x5d783d;})[_0x8599('0x21')](respondWithFilteredResult(_0x763e26,_0x13adb2))[_0x8599('0x2a')](handleError(_0x763e26,null));};exports[_0x8599('0x4e')]=function(_0x4f9d86,_0x4e93b8){var _0x4de863={'raw':![],'where':{'id':_0x4f9d86[_0x8599('0x4f')]['id']}},_0x16cf5b={};_0x16cf5b['model']=_['keys'](db[_0x8599('0x4a')][_0x8599('0x38')]);_0x16cf5b[_0x8599('0x3b')]=_[_0x8599('0x3c')](_0x4f9d86[_0x8599('0x3b')]);_0x16cf5b[_0x8599('0x3d')]=_[_0x8599('0x3e')](_0x16cf5b[_0x8599('0x3f')],_0x16cf5b[_0x8599('0x3b')]);_0x4de863[_0x8599('0x40')]=_[_0x8599('0x3e')](_0x16cf5b[_0x8599('0x3f')],qs['fields'](_0x4f9d86[_0x8599('0x3b')][_0x8599('0x41')]));_0x4de863['attributes']=_0x4de863[_0x8599('0x40')][_0x8599('0x50')]?_0x4de863[_0x8599('0x40')]:_0x16cf5b['model'];if(_0x4f9d86[_0x8599('0x3b')][_0x8599('0x4c')]){_0x4de863[_0x8599('0x51')]=[{'all':!![]}];}_0x4de863=_['merge']({},_0x4de863,_0x4f9d86[_0x8599('0x49')]);return db[_0x8599('0x4a')][_0x8599('0x52')](_0x4de863)[_0x8599('0x21')](handleEntityNotFound(_0x4e93b8,null))[_0x8599('0x21')](respondWithResult(_0x4e93b8,null))['catch'](handleError(_0x4e93b8,null));};exports[_0x8599('0x53')]=function(_0x1171d8,_0x2aa943){return db[_0x8599('0x4a')][_0x8599('0x53')](_0x1171d8[_0x8599('0x54')],{})[_0x8599('0x21')](respondWithResult(_0x2aa943,0xc9))[_0x8599('0x2a')](handleError(_0x2aa943,null));};exports['update']=function(_0x55227e,_0x4d0d21){if(_0x55227e['body']['id']){delete _0x55227e[_0x8599('0x54')]['id'];}return db[_0x8599('0x4a')][_0x8599('0x52')]({'where':{'id':_0x55227e['params']['id']}})[_0x8599('0x21')](handleEntityNotFound(_0x4d0d21,null))[_0x8599('0x21')](saveUpdates(_0x55227e['body'],null))[_0x8599('0x21')](respondWithResult(_0x4d0d21,null))[_0x8599('0x2a')](handleError(_0x4d0d21,null));};exports[_0x8599('0x34')]=function(_0x264193,_0x37961b){return db[_0x8599('0x4a')]['find']({'where':{'id':_0x264193[_0x8599('0x4f')]['id']}})['then'](handleEntityNotFound(_0x37961b,null))['then'](removeEntity(_0x37961b,null))[_0x8599('0x2a')](handleError(_0x37961b,null));};exports[_0x8599('0x55')]=function(_0xa279f0,_0x3cd733,_0x110a03){var _0x2504fc={};var _0x4c23b1={};var _0x1857fb;var _0x4c9514;return db[_0x8599('0x4a')][_0x8599('0x56')]({'where':{'id':_0xa279f0['params']['id']}})[_0x8599('0x21')](handleEntityNotFound(_0x3cd733,null))[_0x8599('0x21')](function(_0x20fe7c){if(_0x20fe7c){_0x1857fb=_0x20fe7c;_0x4c23b1['model']=_['keys'](db[_0x8599('0x57')][_0x8599('0x38')]);_0x4c23b1[_0x8599('0x3b')]=_[_0x8599('0x3c')](_0xa279f0[_0x8599('0x3b')]);_0x4c23b1[_0x8599('0x3d')]=_['intersection'](_0x4c23b1[_0x8599('0x3f')],_0x4c23b1[_0x8599('0x3b')]);_0x2504fc[_0x8599('0x40')]=_[_0x8599('0x3e')](_0x4c23b1[_0x8599('0x3f')],qs[_0x8599('0x41')](_0xa279f0[_0x8599('0x3b')][_0x8599('0x41')]));_0x2504fc[_0x8599('0x40')]=_0x2504fc['attributes'][_0x8599('0x50')]?_0x2504fc[_0x8599('0x40')]:_0x4c23b1[_0x8599('0x3f')];_0x2504fc[_0x8599('0x58')]=qs[_0x8599('0x43')](_0xa279f0[_0x8599('0x3b')][_0x8599('0x43')]);_0x2504fc[_0x8599('0x44')]=qs['filters'](_['pick'](_0xa279f0['query'],_0x4c23b1[_0x8599('0x3d')]));if(_0xa279f0[_0x8599('0x3b')][_0x8599('0x46')]){_0x2504fc['where']=_[_0x8599('0x47')](_0x2504fc[_0x8599('0x44')],{'$or':_['map'](_0x2504fc[_0x8599('0x40')],function(_0x388639){var _0x495c63={};_0x495c63[_0x388639]={'$like':'%'+_0xa279f0[_0x8599('0x3b')][_0x8599('0x46')]+'%'};return _0x495c63;})});}_0x2504fc=_['merge']({},_0x2504fc,_0xa279f0['options']);return _0x1857fb[_0x8599('0x55')](_0x2504fc);}})['then'](function(_0x58e1f6){if(_0x58e1f6){_0x4c9514=_0x58e1f6[_0x8599('0x50')];if(!_0xa279f0['query']['hasOwnProperty'](_0x8599('0x42'))){_0x2504fc[_0x8599('0x30')]=qs['limit'](_0xa279f0[_0x8599('0x3b')][_0x8599('0x30')]);_0x2504fc[_0x8599('0x2f')]=qs[_0x8599('0x2f')](_0xa279f0[_0x8599('0x3b')][_0x8599('0x2f')]);}return _0x1857fb['getConfigurations'](_0x2504fc);}})['then'](function(_0x369be5){if(_0x369be5){return _0x369be5?{'count':_0x4c9514,'rows':_0x369be5}:null;}})[_0x8599('0x21')](respondWithResult(_0x3cd733,null))['catch'](handleError(_0x3cd733,null));};exports[_0x8599('0x59')]=function(_0x259808,_0x32ef5f,_0x8c83a5){if(_0x259808[_0x8599('0x54')]['id']){delete _0x259808['body']['id'];}return db['FreshdeskAccount'][_0x8599('0x56')]({'where':{'id':_0x259808['params']['id']}})['then'](handleEntityNotFound(_0x32ef5f,null))['then'](function(_0x244767){if(_0x244767){_0x259808['body']['AccountId']=_0x244767['id'];_0x259808['body'][_0x8599('0x5a')]=integrations[_0x8599('0x5b')](_0x259808[_0x8599('0x54')][_0x8599('0x5c')],_0x259808[_0x8599('0x54')]['type']);_0x259808[_0x8599('0x54')][_0x8599('0x5d')]=integrations[_0x8599('0x5e')](_0x259808['body'][_0x8599('0x5c')],_0x259808[_0x8599('0x54')]['type']);return db['FreshdeskConfiguration'][_0x8599('0x53')](_0x259808[_0x8599('0x54')],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db[_0x8599('0x5f')],'as':_0x8599('0x5d')}]});}return null;})[_0x8599('0x21')](respondWithResult(_0x32ef5f,null))[_0x8599('0x2a')](handleError(_0x32ef5f,null));};exports[_0x8599('0x60')]=function(_0x3aa186,_0x1c0e12,_0x5aa10c){var _0x1fc6df='';return db[_0x8599('0x4a')][_0x8599('0x56')]({'where':{'id':_0x3aa186['params']['id']},'attributes':['id',_0x8599('0x61'),'apiKey']})[_0x8599('0x21')](handleEntityNotFound(_0x1c0e12,null))[_0x8599('0x21')](function(_0x1a5735){if(_0x1a5735){_0x1fc6df=_0x1a5735['remoteUri'];var _0x32a067=_0x1fc6df[_0x8599('0x62')](-0x1);if(_0x32a067==='/'){_0x1fc6df=_0x1fc6df[_0x8599('0x63')](0x0,_0x1fc6df[_0x8599('0x64')](_0x32a067));}return rp({'method':_0x8599('0x65'),'uri':util[_0x8599('0x66')](_0x8599('0x67'),_0x1fc6df,_0x8599('0x68')),'headers':{'Authorization':util[_0x8599('0x66')]('Basic\x20%s',new Buffer(util['format'](_0x8599('0x69'),_0x1a5735['apiKey']))[_0x8599('0x6a')](_0x8599('0x6b')))},'json':!![]});}})[_0x8599('0x21')](function(_0x2701c9){if(_0x2701c9){var _0x45c4b8=[_0x8599('0x6c'),_0x8599('0x6d'),'agent','description',_0x8599('0x2d'),_0x8599('0x6e'),_0x8599('0x6f'),_0x8599('0x70'),_0x8599('0x71'),_0x8599('0x6f'),_0x8599('0x72')];_[_0x8599('0x73')](_0x2701c9,function(_0x4f04d0){return _0x45c4b8[_0x8599('0x74')](_0x4f04d0[_0x8599('0x36')])||!_0x4f04d0[_0x8599('0x75')]&&_0x4f04d0[_0x8599('0x3a')]!==_0x8599('0x76')&&_0x4f04d0[_0x8599('0x3a')]!==_0x8599('0x77');});return{'count':_0x2701c9[_0x8599('0x50')],'rows':_[_0x8599('0x78')](_0x2701c9,function(_0x2424e1){return{'id':_0x2424e1['name'],'name':_0x2424e1[_0x8599('0x79')],'custom':!_0x2424e1[_0x8599('0x75')],'options':_0x2424e1[_0x8599('0x7a')]?_[_0x8599('0x78')](_0x2424e1[_0x8599('0x7a')],function(_0x580d8b){return{'name':_['capitalize'](_0x580d8b),'value':_0x580d8b};}):[]};})};}})[_0x8599('0x21')](respondWithResult(_0x1c0e12,null))[_0x8599('0x2a')](function(_0x1d925f){var _0x453270=_0x3aa186['query'][_0x8599('0x1c')]?0x1f4:_0x1d925f['statusCode']||0x1f4;logger[_0x8599('0x27')](_0x8599('0x7b'),_0x8599('0x60'),_0x453270,JSON['stringify'](_0x1d925f));delete _0x1d925f[_0x8599('0x36')];if(_0x453270===0x191){_0x453270=0x190;}_0x1c0e12[_0x8599('0x2d')](_0x453270)[_0x8599('0x37')](_0x3aa186['query'][_0x8599('0x1c')]?{'message':_0x8599('0x7c'),'statusCode':_0x1d925f[_0x8599('0x7d')]}:_0x1d925f);});}; \ No newline at end of file +var _0x7414=['save','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','catch','show','params','length','include','find','create','body','update','destroy','getConfigurations','pick','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','findOne','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','group','source','company','remove','default','custom_text','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7414,0x152));var _0x4741=function(_0x36fb33,_0x661d30){_0x36fb33=_0x36fb33-0x0;var _0x37bd88=_0x7414[_0x36fb33];return _0x37bd88;};'use strict';var pdf=require(_0x4741('0x0'));var emlformat=require(_0x4741('0x1'));var rimraf=require(_0x4741('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4741('0x3'));var rp=require(_0x4741('0x4'));var moment=require(_0x4741('0x5'));var BPromise=require(_0x4741('0x6'));var Mustache=require(_0x4741('0x7'));var util=require(_0x4741('0x8'));var path=require(_0x4741('0x9'));var sox=require(_0x4741('0xa'));var csv=require(_0x4741('0xb'));var ejs=require(_0x4741('0xc'));var fs=require('fs');var _=require(_0x4741('0xd'));var squel=require(_0x4741('0xe'));var crypto=require(_0x4741('0xf'));var jsforce=require(_0x4741('0x10'));var deskjs=require(_0x4741('0x11'));var toCsv=require(_0x4741('0xb'));var querystring=require(_0x4741('0x12'));var Papa=require(_0x4741('0x13'));var Redis=require(_0x4741('0x14'));var authService=require(_0x4741('0x15'));var qs=require(_0x4741('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4741('0x17'));var logger=require('../../config/logger')(_0x4741('0x18'));var utils=require(_0x4741('0x19'));var config=require('../../config/environment');var db=require(_0x4741('0x1a'))['db'];var integrations=require(_0x4741('0x1b'));var jayson=require(_0x4741('0x1c'));var client=jayson[_0x4741('0x1d')][_0x4741('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x26bf5e,_0x303e05,_0x22cece){if(_0x22cece){var _0x4b09e9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b09e9[_0x4741('0x1f')](_0x303e05)){return _0x26bf5e;}else{throw new db[(_0x4741('0x20'))][(_0x4741('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 _0x26bf5e;}}function respondWithRpcPromise(_0x4fc318,_0x21d932,_0x56250a,_0x59033e){return new BPromise(function(_0x1c044a,_0x235092){var _0x5dfd6f=_0x59033e||client;return _0x5dfd6f[_0x4741('0x22')](_0x4fc318,_0x56250a)[_0x4741('0x23')](function(_0x2cd9ee){logger['info'](_0x4741('0x24'),_0x21d932,_0x4741('0x25'));logger[_0x4741('0x26')](_0x4741('0x27'),_0x21d932,_0x4741('0x25'),JSON[_0x4741('0x28')](_0x2cd9ee));if(_0x2cd9ee[_0x4741('0x29')]){if(_0x2cd9ee['error'][_0x4741('0x2a')]===0x1f4){logger[_0x4741('0x29')](_0x4741('0x24'),_0x21d932,_0x2cd9ee[_0x4741('0x29')][_0x4741('0x2b')]);return _0x235092(_0x2cd9ee['error']['message']);}logger[_0x4741('0x29')](_0x4741('0x24'),_0x21d932,_0x2cd9ee[_0x4741('0x29')][_0x4741('0x2b')]);return _0x1c044a(_0x2cd9ee[_0x4741('0x29')][_0x4741('0x2b')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x21d932,_0x4741('0x25'));_0x1c044a(_0x2cd9ee[_0x4741('0x2c')][_0x4741('0x2b')]);}})['catch'](function(_0xf95508){logger[_0x4741('0x29')](_0x4741('0x24'),_0x21d932,_0xf95508);_0x235092(_0xf95508);});});}function respondWithStatusCode(_0x1f1b59,_0x21593e){_0x21593e=_0x21593e||0xcc;return function(_0x484612){if(_0x484612){return _0x1f1b59[_0x4741('0x2d')](_0x21593e);}return _0x1f1b59['status'](_0x21593e)[_0x4741('0x2e')]();};}function respondWithResult(_0x30d5c9,_0x5d995c){_0x5d995c=_0x5d995c||0xc8;return function(_0x4ae076){if(_0x4ae076){return _0x30d5c9[_0x4741('0x2f')](_0x5d995c)[_0x4741('0x30')](_0x4ae076);}};}function respondWithFilteredResult(_0x4c0b0f,_0x3ffedd){return function(_0x3e5a85){if(_0x3e5a85){var _0x2b8757=_0x3e5a85[_0x4741('0x31')],_0x304086=_0x3ffedd[_0x4741('0x32')],_0xa2b4fa=_0x3ffedd['offset']+_0x3ffedd[_0x4741('0x33')],_0x37d024;if(_0xa2b4fa>=_0x2b8757){_0xa2b4fa=_0x2b8757;_0x37d024=0xc8;}else{_0x37d024=0xce;}_0x4c0b0f[_0x4741('0x2f')](_0x37d024);return _0x4c0b0f[_0x4741('0x34')](_0x4741('0x35'),_0x304086+'-'+_0xa2b4fa+'/'+_0x2b8757)[_0x4741('0x30')](_0x3e5a85);}return null;};}function patchUpdates(_0x463e5c){return function(_0x328403){try{jsonpatch[_0x4741('0x36')](_0x328403,_0x463e5c,!![]);}catch(_0x19fd09){return BPromise['reject'](_0x19fd09);}return _0x328403[_0x4741('0x37')]();};}function saveUpdates(_0x144128,_0x14a8c9){return function(_0x2aefd3){if(_0x2aefd3){return _0x2aefd3['update'](_0x144128)[_0x4741('0x23')](function(_0x752f77){return _0x752f77;});}return null;};}function removeEntity(_0x21a2ef,_0x367193){return function(_0x4ce46a){if(_0x4ce46a){return _0x4ce46a['destroy']()['then'](function(){_0x21a2ef[_0x4741('0x2f')](0xcc)[_0x4741('0x2e')]();});}};}function handleEntityNotFound(_0x263d0a,_0x23d893){return function(_0x4577c7){if(!_0x4577c7){_0x263d0a[_0x4741('0x2d')](0x194);}return _0x4577c7;};}function handleError(_0xc88518,_0x40418e){_0x40418e=_0x40418e||0x1f4;return function(_0x28a5f9){logger[_0x4741('0x29')](_0x28a5f9[_0x4741('0x38')]);if(_0x28a5f9[_0x4741('0x39')]){delete _0x28a5f9[_0x4741('0x39')];}_0xc88518[_0x4741('0x2f')](_0x40418e)['send'](_0x28a5f9);};}exports[_0x4741('0x3a')]=function(_0x21c90e,_0x4bf693){var _0x520b4d={},_0x3e44a8={},_0x759f19={'count':0x0,'rows':[]};var _0xad6c3d=_[_0x4741('0x3b')](db[_0x4741('0x3c')][_0x4741('0x3d')],function(_0xd17795){return{'name':_0xd17795[_0x4741('0x3e')],'type':_0xd17795[_0x4741('0x3f')][_0x4741('0x40')]};});_0x3e44a8[_0x4741('0x41')]=_[_0x4741('0x3b')](_0xad6c3d,_0x4741('0x39'));_0x3e44a8['query']=_[_0x4741('0x42')](_0x21c90e[_0x4741('0x43')]);_0x3e44a8[_0x4741('0x44')]=_[_0x4741('0x45')](_0x3e44a8[_0x4741('0x41')],_0x3e44a8['query']);_0x520b4d[_0x4741('0x46')]=_[_0x4741('0x45')](_0x3e44a8[_0x4741('0x41')],qs[_0x4741('0x47')](_0x21c90e[_0x4741('0x43')][_0x4741('0x47')]));_0x520b4d['attributes']=_0x520b4d['attributes']['length']?_0x520b4d[_0x4741('0x46')]:_0x3e44a8[_0x4741('0x41')];if(!_0x21c90e[_0x4741('0x43')]['hasOwnProperty'](_0x4741('0x48'))){_0x520b4d[_0x4741('0x33')]=qs[_0x4741('0x33')](_0x21c90e[_0x4741('0x43')][_0x4741('0x33')]);_0x520b4d[_0x4741('0x32')]=qs[_0x4741('0x32')](_0x21c90e[_0x4741('0x43')][_0x4741('0x32')]);}_0x520b4d[_0x4741('0x49')]=qs[_0x4741('0x4a')](_0x21c90e[_0x4741('0x43')]['sort']);_0x520b4d[_0x4741('0x4b')]=qs[_0x4741('0x44')](_['pick'](_0x21c90e[_0x4741('0x43')],_0x3e44a8[_0x4741('0x44')]));if(_0x21c90e[_0x4741('0x43')]['filter']){_0x520b4d[_0x4741('0x4b')]=_[_0x4741('0x4c')](_0x520b4d[_0x4741('0x4b')],{'$or':_[_0x4741('0x3b')](_0xad6c3d,function(_0x378a14){if(_0x378a14[_0x4741('0x3f')]!==_0x4741('0x4d')){var _0x107d68={};_0x107d68[_0x378a14[_0x4741('0x39')]]={'$like':'%'+_0x21c90e[_0x4741('0x43')]['filter']+'%'};return _0x107d68;}})});}_0x520b4d=_['merge']({},_0x520b4d,_0x21c90e[_0x4741('0x4e')]);var _0x364841={'where':_0x520b4d['where']};return db[_0x4741('0x3c')][_0x4741('0x31')](_0x364841)[_0x4741('0x23')](function(_0x50e061){_0x759f19['count']=_0x50e061;if(_0x21c90e[_0x4741('0x43')][_0x4741('0x4f')]){_0x520b4d['include']=[{'all':!![]}];}return db[_0x4741('0x3c')]['findAll'](_0x520b4d);})[_0x4741('0x23')](function(_0x18cdef){_0x759f19['rows']=_0x18cdef;return _0x759f19;})[_0x4741('0x23')](respondWithFilteredResult(_0x4bf693,_0x520b4d))[_0x4741('0x50')](handleError(_0x4bf693,null));};exports[_0x4741('0x51')]=function(_0x462b04,_0x4bd07c){var _0x55c5f3={'raw':![],'where':{'id':_0x462b04[_0x4741('0x52')]['id']}},_0x253cf9={};_0x253cf9[_0x4741('0x41')]=_[_0x4741('0x42')](db[_0x4741('0x3c')][_0x4741('0x3d')]);_0x253cf9[_0x4741('0x43')]=_[_0x4741('0x42')](_0x462b04[_0x4741('0x43')]);_0x253cf9[_0x4741('0x44')]=_[_0x4741('0x45')](_0x253cf9[_0x4741('0x41')],_0x253cf9['query']);_0x55c5f3['attributes']=_['intersection'](_0x253cf9['model'],qs[_0x4741('0x47')](_0x462b04['query'][_0x4741('0x47')]));_0x55c5f3[_0x4741('0x46')]=_0x55c5f3['attributes'][_0x4741('0x53')]?_0x55c5f3[_0x4741('0x46')]:_0x253cf9[_0x4741('0x41')];if(_0x462b04[_0x4741('0x43')][_0x4741('0x4f')]){_0x55c5f3[_0x4741('0x54')]=[{'all':!![]}];}_0x55c5f3=_[_0x4741('0x4c')]({},_0x55c5f3,_0x462b04[_0x4741('0x4e')]);return db[_0x4741('0x3c')][_0x4741('0x55')](_0x55c5f3)[_0x4741('0x23')](handleEntityNotFound(_0x4bd07c,null))['then'](respondWithResult(_0x4bd07c,null))[_0x4741('0x50')](handleError(_0x4bd07c,null));};exports[_0x4741('0x56')]=function(_0x1b679f,_0x5daa02){return db[_0x4741('0x3c')]['create'](_0x1b679f[_0x4741('0x57')],{})['then'](respondWithResult(_0x5daa02,0xc9))[_0x4741('0x50')](handleError(_0x5daa02,null));};exports[_0x4741('0x58')]=function(_0x44ffe4,_0x168095){if(_0x44ffe4[_0x4741('0x57')]['id']){delete _0x44ffe4[_0x4741('0x57')]['id'];}return db[_0x4741('0x3c')][_0x4741('0x55')]({'where':{'id':_0x44ffe4[_0x4741('0x52')]['id']}})[_0x4741('0x23')](handleEntityNotFound(_0x168095,null))[_0x4741('0x23')](saveUpdates(_0x44ffe4[_0x4741('0x57')],null))[_0x4741('0x23')](respondWithResult(_0x168095,null))[_0x4741('0x50')](handleError(_0x168095,null));};exports[_0x4741('0x59')]=function(_0x538d4b,_0x10bbca){return db[_0x4741('0x3c')]['find']({'where':{'id':_0x538d4b[_0x4741('0x52')]['id']}})['then'](handleEntityNotFound(_0x10bbca,null))['then'](removeEntity(_0x10bbca,null))[_0x4741('0x50')](handleError(_0x10bbca,null));};exports[_0x4741('0x5a')]=function(_0x34d039,_0x23f25b,_0x24c2ea){var _0x487320={};var _0x2f7890={};var _0x55824e;var _0x27a190;return db[_0x4741('0x3c')]['findOne']({'where':{'id':_0x34d039[_0x4741('0x52')]['id']}})[_0x4741('0x23')](handleEntityNotFound(_0x23f25b,null))[_0x4741('0x23')](function(_0x3810c7){if(_0x3810c7){_0x55824e=_0x3810c7;_0x2f7890[_0x4741('0x41')]=_['keys'](db['FreshdeskConfiguration'][_0x4741('0x3d')]);_0x2f7890[_0x4741('0x43')]=_[_0x4741('0x42')](_0x34d039[_0x4741('0x43')]);_0x2f7890[_0x4741('0x44')]=_[_0x4741('0x45')](_0x2f7890[_0x4741('0x41')],_0x2f7890[_0x4741('0x43')]);_0x487320[_0x4741('0x46')]=_[_0x4741('0x45')](_0x2f7890[_0x4741('0x41')],qs[_0x4741('0x47')](_0x34d039['query'][_0x4741('0x47')]));_0x487320[_0x4741('0x46')]=_0x487320['attributes'][_0x4741('0x53')]?_0x487320[_0x4741('0x46')]:_0x2f7890[_0x4741('0x41')];_0x487320[_0x4741('0x49')]=qs[_0x4741('0x4a')](_0x34d039['query']['sort']);_0x487320[_0x4741('0x4b')]=qs[_0x4741('0x44')](_[_0x4741('0x5b')](_0x34d039[_0x4741('0x43')],_0x2f7890[_0x4741('0x44')]));if(_0x34d039[_0x4741('0x43')]['filter']){_0x487320['where']=_[_0x4741('0x4c')](_0x487320[_0x4741('0x4b')],{'$or':_[_0x4741('0x3b')](_0x487320['attributes'],function(_0x4acc10){var _0x41dec7={};_0x41dec7[_0x4acc10]={'$like':'%'+_0x34d039[_0x4741('0x43')][_0x4741('0x5c')]+'%'};return _0x41dec7;})});}_0x487320=_['merge']({},_0x487320,_0x34d039[_0x4741('0x4e')]);return _0x55824e[_0x4741('0x5a')](_0x487320);}})[_0x4741('0x23')](function(_0x2acdce){if(_0x2acdce){_0x27a190=_0x2acdce[_0x4741('0x53')];if(!_0x34d039['query'][_0x4741('0x5d')]('nolimit')){_0x487320['limit']=qs[_0x4741('0x33')](_0x34d039[_0x4741('0x43')][_0x4741('0x33')]);_0x487320['offset']=qs[_0x4741('0x32')](_0x34d039['query'][_0x4741('0x32')]);}return _0x55824e['getConfigurations'](_0x487320);}})[_0x4741('0x23')](function(_0x6690e3){if(_0x6690e3){return _0x6690e3?{'count':_0x27a190,'rows':_0x6690e3}:null;}})[_0x4741('0x23')](respondWithResult(_0x23f25b,null))[_0x4741('0x50')](handleError(_0x23f25b,null));};exports[_0x4741('0x5e')]=function(_0x2a8049,_0x577e84,_0x40840e){if(_0x2a8049[_0x4741('0x57')]['id']){delete _0x2a8049['body']['id'];}return db[_0x4741('0x3c')]['findOne']({'where':{'id':_0x2a8049['params']['id']}})[_0x4741('0x23')](handleEntityNotFound(_0x577e84,null))[_0x4741('0x23')](function(_0x495b32){if(_0x495b32){_0x2a8049[_0x4741('0x57')][_0x4741('0x5f')]=_0x495b32['id'];_0x2a8049[_0x4741('0x57')][_0x4741('0x60')]=integrations[_0x4741('0x61')](_0x2a8049[_0x4741('0x57')][_0x4741('0x62')],_0x2a8049[_0x4741('0x57')][_0x4741('0x3f')]);_0x2a8049[_0x4741('0x57')][_0x4741('0x63')]=integrations[_0x4741('0x64')](_0x2a8049[_0x4741('0x57')][_0x4741('0x62')],_0x2a8049[_0x4741('0x57')][_0x4741('0x3f')]);return db[_0x4741('0x65')][_0x4741('0x56')](_0x2a8049[_0x4741('0x57')],{'include':[{'model':db[_0x4741('0x66')],'as':'Subjects'},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0x4741('0x23')](respondWithResult(_0x577e84,null))[_0x4741('0x50')](handleError(_0x577e84,null));};exports[_0x4741('0x67')]=function(_0xe137cc,_0x7c24de,_0x2b2852){var _0x14bb3f='';return db[_0x4741('0x3c')][_0x4741('0x68')]({'where':{'id':_0xe137cc[_0x4741('0x52')]['id']},'attributes':['id',_0x4741('0x69'),_0x4741('0x6a')]})['then'](handleEntityNotFound(_0x7c24de,null))[_0x4741('0x23')](function(_0x1fee08){if(_0x1fee08){_0x14bb3f=_0x1fee08[_0x4741('0x69')];var _0x21402a=_0x14bb3f[_0x4741('0x6b')](-0x1);if(_0x21402a==='/'){_0x14bb3f=_0x14bb3f[_0x4741('0x6c')](0x0,_0x14bb3f[_0x4741('0x6d')](_0x21402a));}return rp({'method':_0x4741('0x6e'),'uri':util[_0x4741('0x6f')](_0x4741('0x70'),_0x14bb3f,_0x4741('0x71')),'headers':{'Authorization':util[_0x4741('0x6f')](_0x4741('0x72'),new Buffer(util[_0x4741('0x6f')](_0x4741('0x73'),_0x1fee08[_0x4741('0x6a')]))[_0x4741('0x74')](_0x4741('0x75')))},'json':!![]});}})['then'](function(_0x5ea448){if(_0x5ea448){var _0x5955c4=[_0x4741('0x76'),_0x4741('0x77'),'agent',_0x4741('0x78'),_0x4741('0x2f'),_0x4741('0x79'),_0x4741('0x7a'),_0x4741('0x7b'),'ticket_type',_0x4741('0x7a'),_0x4741('0x7c')];_[_0x4741('0x7d')](_0x5ea448,function(_0x13d063){return _0x5955c4['includes'](_0x13d063[_0x4741('0x39')])||!_0x13d063[_0x4741('0x7e')]&&_0x13d063['type']!==_0x4741('0x7f')&&_0x13d063[_0x4741('0x3f')]!=='custom_dropdown';});return{'count':_0x5ea448[_0x4741('0x53')],'rows':_[_0x4741('0x3b')](_0x5ea448,function(_0x5ac441){return{'id':_0x5ac441[_0x4741('0x39')],'name':_0x5ac441['label'],'custom':!_0x5ac441[_0x4741('0x7e')],'options':_0x5ac441[_0x4741('0x80')]?_['map'](_0x5ac441[_0x4741('0x80')],function(_0x5977a9){return{'name':_['capitalize'](_0x5977a9),'value':_0x5977a9};}):[]};})};}})[_0x4741('0x23')](respondWithResult(_0x7c24de,null))[_0x4741('0x50')](function(_0x19bf17){var _0x154a19=_0xe137cc[_0x4741('0x43')][_0x4741('0x1f')]?0x1f4:_0x19bf17[_0x4741('0x81')]||0x1f4;logger[_0x4741('0x29')](_0x4741('0x82'),_0x4741('0x67'),_0x154a19,JSON[_0x4741('0x28')](_0x19bf17));delete _0x19bf17[_0x4741('0x39')];if(_0x154a19===0x191){_0x154a19=0x190;}_0x7c24de['status'](_0x154a19)['send'](_0xe137cc[_0x4741('0x43')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x19bf17[_0x4741('0x81')]}:_0x19bf17);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index adbb8e8..9868756 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 _0xf278=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x488ca1,_0xf6858e){var _0x4dd0a4=function(_0x40fb65){while(--_0x40fb65){_0x488ca1['push'](_0x488ca1['shift']());}};_0x4dd0a4(++_0xf6858e);}(_0xf278,0x1ea));var _0x8f27=function(_0x42701f,_0x3d2f90){_0x42701f=_0x42701f-0x0;var _0x36aafb=_0xf278[_0x42701f];return _0x36aafb;};'use strict';var _=require(_0x8f27('0x0'));var util=require(_0x8f27('0x1'));var logger=require(_0x8f27('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8f27('0x3'));var rp=require(_0x8f27('0x4'));var fs=require('fs');var path=require(_0x8f27('0x5'));var rimraf=require(_0x8f27('0x6'));var config=require(_0x8f27('0x7'));var attributes=require(_0x8f27('0x8'));var integrations=require(_0x8f27('0x9'));module[_0x8f27('0xa')]=function(_0x53902a,_0x17d175){return _0x53902a[_0x8f27('0xb')](_0x8f27('0xc'),attributes,{'tableName':_0x8f27('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe951=['api','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe951,0x8e));var _0x1e95=function(_0x5d1594,_0x105585){_0x5d1594=_0x5d1594-0x0;var _0x5c4153=_0xe951[_0x5d1594];return _0x5c4153;};'use strict';var _=require('lodash');var util=require(_0x1e95('0x0'));var logger=require(_0x1e95('0x1'))(_0x1e95('0x2'));var moment=require('moment');var BPromise=require(_0x1e95('0x3'));var rp=require(_0x1e95('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1e95('0x5'));var config=require(_0x1e95('0x6'));var attributes=require(_0x1e95('0x7'));var integrations=require(_0x1e95('0x8'));module['exports']=function(_0x221c70,_0x5eaa45){return _0x221c70[_0x1e95('0x9')](_0x1e95('0xa'),attributes,{'tableName':_0x1e95('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 37eee4f..59db29f 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 _0xca4b=['find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount'];(function(_0x4cce8,_0x22d1fe){var _0x458440=function(_0x3d15e4){while(--_0x3d15e4){_0x4cce8['push'](_0x4cce8['shift']());}};_0x458440(++_0x22d1fe);}(_0xca4b,0x1eb));var _0xbca4=function(_0x529a51,_0x408d27){_0x529a51=_0x529a51-0x0;var _0x29b763=_0xca4b[_0x529a51];return _0x29b763;};'use strict';var _=require(_0xbca4('0x0'));var util=require(_0xbca4('0x1'));var moment=require(_0xbca4('0x2'));var BPromise=require(_0xbca4('0x3'));var rs=require(_0xbca4('0x4'));var fs=require('fs');var Redis=require(_0xbca4('0x5'));var db=require(_0xbca4('0x6'))['db'];var utils=require(_0xbca4('0x7'));var logger=require(_0xbca4('0x8'))(_0xbca4('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbca4('0xa')][_0xbca4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e4bbe,_0x62292d,_0x56dd4f){return new BPromise(function(_0x3a2cd0,_0x3ba840){return client['request'](_0x2e4bbe,_0x56dd4f)['then'](function(_0x3922d7){logger[_0xbca4('0xc')](_0xbca4('0xd'),_0x62292d,_0xbca4('0xe'));logger[_0xbca4('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x62292d,_0xbca4('0xe'),JSON[_0xbca4('0x10')](_0x3922d7));if(_0x3922d7[_0xbca4('0x11')]){if(_0x3922d7[_0xbca4('0x11')][_0xbca4('0x12')]===0x1f4){logger[_0xbca4('0x11')](_0xbca4('0xd'),_0x62292d,_0x3922d7[_0xbca4('0x11')][_0xbca4('0x13')]);return _0x3ba840(_0x3922d7['error'][_0xbca4('0x13')]);}logger[_0xbca4('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x62292d,_0x3922d7[_0xbca4('0x11')][_0xbca4('0x13')]);return _0x3a2cd0(_0x3922d7[_0xbca4('0x11')][_0xbca4('0x13')]);}else{logger[_0xbca4('0xc')](_0xbca4('0xd'),_0x62292d,_0xbca4('0xe'));_0x3a2cd0(_0x3922d7['result'][_0xbca4('0x13')]);}})[_0xbca4('0x14')](function(_0x40704c){logger[_0xbca4('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x62292d,_0x40704c);_0x3ba840(_0x40704c);});});}exports['GetFreshdeskAccount']=function(_0x4dc9aa){var _0x1b1e27=this;return new Promise(function(_0x3033da,_0x40f02a){return db['FreshdeskAccount'][_0xbca4('0x15')]({'raw':_0x4dc9aa['options']?_0x4dc9aa[_0xbca4('0x16')][_0xbca4('0x17')]===undefined?!![]:![]:!![],'where':_0x4dc9aa[_0xbca4('0x16')]?_0x4dc9aa['options'][_0xbca4('0x18')]||null:null,'attributes':_0x4dc9aa['options']?_0x4dc9aa[_0xbca4('0x16')][_0xbca4('0x19')]||null:null,'limit':_0x4dc9aa[_0xbca4('0x16')]?_0x4dc9aa[_0xbca4('0x16')][_0xbca4('0x1a')]||null:null,'include':_0x4dc9aa['options']?_0x4dc9aa['options'][_0xbca4('0x1b')]?_[_0xbca4('0x1c')](_0x4dc9aa['options'][_0xbca4('0x1b')],function(_0xa9be84){return{'model':db[_0xa9be84[_0xbca4('0x1d')]],'as':_0xa9be84['as'],'attributes':_0xa9be84[_0xbca4('0x19')],'include':_0xa9be84['include']?_[_0xbca4('0x1c')](_0xa9be84['include'],function(_0x3a1b8a){return{'model':db[_0x3a1b8a[_0xbca4('0x1d')]],'as':_0x3a1b8a['as'],'attributes':_0x3a1b8a[_0xbca4('0x19')],'include':_0x3a1b8a[_0xbca4('0x1b')]?_[_0xbca4('0x1c')](_0x3a1b8a[_0xbca4('0x1b')],function(_0x405a96){return{'model':db[_0x405a96[_0xbca4('0x1d')]],'as':_0x405a96['as'],'attributes':_0x405a96[_0xbca4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbca4('0x1e')](function(_0x5bd4d7){logger['info'](_0xbca4('0x1f'),_0x4dc9aa);logger[_0xbca4('0xf')]('GetFreshdeskAccount',_0x4dc9aa,JSON[_0xbca4('0x10')](_0x5bd4d7));_0x3033da(_0x5bd4d7);})[_0xbca4('0x14')](function(_0x5611f7){logger[_0xbca4('0x11')](_0xbca4('0x1f'),_0x5611f7[_0xbca4('0x13')],_0x4dc9aa);_0x40f02a(_0x1b1e27[_0xbca4('0x11')](0x1f4,_0x5611f7[_0xbca4('0x13')]));});});};exports[_0xbca4('0x20')]=function(_0x24a874){var _0x2f6c0d=this;return new Promise(function(_0x179589,_0xbcc412){return db[_0xbca4('0x21')][_0xbca4('0x22')]({'raw':_0x24a874[_0xbca4('0x16')]?_0x24a874[_0xbca4('0x16')][_0xbca4('0x17')]===undefined?!![]:![]:!![],'where':_0x24a874[_0xbca4('0x16')]?_0x24a874[_0xbca4('0x16')][_0xbca4('0x18')]||null:null,'attributes':_0x24a874[_0xbca4('0x16')]?_0x24a874['options'][_0xbca4('0x19')]||null:null,'include':_0x24a874['options']?_0x24a874[_0xbca4('0x16')][_0xbca4('0x1b')]?_[_0xbca4('0x1c')](_0x24a874['options'][_0xbca4('0x1b')],function(_0x5e79ab){return{'model':db[_0x5e79ab[_0xbca4('0x1d')]],'as':_0x5e79ab['as'],'attributes':_0x5e79ab[_0xbca4('0x19')],'include':_0x5e79ab[_0xbca4('0x1b')]?_['map'](_0x5e79ab[_0xbca4('0x1b')],function(_0x377c53){return{'model':db[_0x377c53['model']],'as':_0x377c53['as'],'attributes':_0x377c53[_0xbca4('0x19')],'include':_0x377c53['include']?_['map'](_0x377c53[_0xbca4('0x1b')],function(_0x85e6d8){return{'model':db[_0x85e6d8[_0xbca4('0x1d')]],'as':_0x85e6d8['as'],'attributes':_0x85e6d8[_0xbca4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbca4('0x1e')](function(_0x47cda8){logger[_0xbca4('0xc')](_0xbca4('0x20'),_0x24a874);logger[_0xbca4('0xf')](_0xbca4('0x20'),_0x24a874,JSON['stringify'](_0x47cda8));_0x179589(_0x47cda8);})[_0xbca4('0x14')](function(_0x3661ce){logger[_0xbca4('0x11')](_0xbca4('0x20'),_0x3661ce[_0xbca4('0x13')],_0x24a874);_0xbcc412(_0x2f6c0d[_0xbca4('0x11')](0x1f4,_0x3661ce['message']));});});}; \ No newline at end of file +var _0xd523=['info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','catch','options','where','attributes','limit','include','map','model','GetFreshdeskAccount','find','raw','ShowFreshdeskAccount','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x52c44e,_0x4c8b6e){var _0xcf8e7d=function(_0x5a04b8){while(--_0x5a04b8){_0x52c44e['push'](_0x52c44e['shift']());}};_0xcf8e7d(++_0x4c8b6e);}(_0xd523,0x116));var _0x3d52=function(_0xc59b5b,_0x45c6d2){_0xc59b5b=_0xc59b5b-0x0;var _0x26f308=_0xd523[_0xc59b5b];return _0x26f308;};'use strict';var _=require(_0x3d52('0x0'));var util=require('util');var moment=require(_0x3d52('0x1'));var BPromise=require(_0x3d52('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d52('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3d52('0x4'))(_0x3d52('0x5'));var config=require(_0x3d52('0x6'));var jayson=require(_0x3d52('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34096a,_0x5ccd7b,_0x515a67){return new BPromise(function(_0x57729e,_0x28fcc4){return client[_0x3d52('0x8')](_0x34096a,_0x515a67)[_0x3d52('0x9')](function(_0x36de42){logger[_0x3d52('0xa')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ccd7b,'request\x20sent');logger[_0x3d52('0xb')](_0x3d52('0xc'),_0x5ccd7b,_0x3d52('0xd'),JSON[_0x3d52('0xe')](_0x36de42));if(_0x36de42[_0x3d52('0xf')]){if(_0x36de42[_0x3d52('0xf')][_0x3d52('0x10')]===0x1f4){logger[_0x3d52('0xf')](_0x3d52('0x11'),_0x5ccd7b,_0x36de42[_0x3d52('0xf')]['message']);return _0x28fcc4(_0x36de42[_0x3d52('0xf')][_0x3d52('0x12')]);}logger[_0x3d52('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ccd7b,_0x36de42[_0x3d52('0xf')][_0x3d52('0x12')]);return _0x57729e(_0x36de42[_0x3d52('0xf')]['message']);}else{logger[_0x3d52('0xa')](_0x3d52('0x11'),_0x5ccd7b,_0x3d52('0xd'));_0x57729e(_0x36de42[_0x3d52('0x13')][_0x3d52('0x12')]);}})[_0x3d52('0x14')](function(_0xd37bde){logger[_0x3d52('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ccd7b,_0xd37bde);_0x28fcc4(_0xd37bde);});});}exports['GetFreshdeskAccount']=function(_0x2bb04f){var _0x3beb0b=this;return new Promise(function(_0x135714,_0x3643b9){return db['FreshdeskAccount']['findAll']({'raw':_0x2bb04f[_0x3d52('0x15')]?_0x2bb04f[_0x3d52('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2bb04f[_0x3d52('0x15')]?_0x2bb04f[_0x3d52('0x15')][_0x3d52('0x16')]||null:null,'attributes':_0x2bb04f[_0x3d52('0x15')]?_0x2bb04f[_0x3d52('0x15')][_0x3d52('0x17')]||null:null,'limit':_0x2bb04f['options']?_0x2bb04f[_0x3d52('0x15')][_0x3d52('0x18')]||null:null,'include':_0x2bb04f[_0x3d52('0x15')]?_0x2bb04f[_0x3d52('0x15')][_0x3d52('0x19')]?_[_0x3d52('0x1a')](_0x2bb04f[_0x3d52('0x15')][_0x3d52('0x19')],function(_0x9bc355){return{'model':db[_0x9bc355[_0x3d52('0x1b')]],'as':_0x9bc355['as'],'attributes':_0x9bc355[_0x3d52('0x17')],'include':_0x9bc355[_0x3d52('0x19')]?_[_0x3d52('0x1a')](_0x9bc355[_0x3d52('0x19')],function(_0x487541){return{'model':db[_0x487541[_0x3d52('0x1b')]],'as':_0x487541['as'],'attributes':_0x487541[_0x3d52('0x17')],'include':_0x487541[_0x3d52('0x19')]?_[_0x3d52('0x1a')](_0x487541[_0x3d52('0x19')],function(_0x189746){return{'model':db[_0x189746[_0x3d52('0x1b')]],'as':_0x189746['as'],'attributes':_0x189746['attributes']};}):[]};}):[]};}):[]:[]})[_0x3d52('0x9')](function(_0x127ce4){logger[_0x3d52('0xa')]('GetFreshdeskAccount',_0x2bb04f);logger[_0x3d52('0xb')](_0x3d52('0x1c'),_0x2bb04f,JSON[_0x3d52('0xe')](_0x127ce4));_0x135714(_0x127ce4);})[_0x3d52('0x14')](function(_0x41cadc){logger[_0x3d52('0xf')](_0x3d52('0x1c'),_0x41cadc['message'],_0x2bb04f);_0x3643b9(_0x3beb0b[_0x3d52('0xf')](0x1f4,_0x41cadc[_0x3d52('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x25e748){var _0x3ba711=this;return new Promise(function(_0x37b330,_0x296eb0){return db['FreshdeskAccount'][_0x3d52('0x1d')]({'raw':_0x25e748['options']?_0x25e748['options'][_0x3d52('0x1e')]===undefined?!![]:![]:!![],'where':_0x25e748[_0x3d52('0x15')]?_0x25e748[_0x3d52('0x15')][_0x3d52('0x16')]||null:null,'attributes':_0x25e748[_0x3d52('0x15')]?_0x25e748[_0x3d52('0x15')]['attributes']||null:null,'include':_0x25e748['options']?_0x25e748['options'][_0x3d52('0x19')]?_[_0x3d52('0x1a')](_0x25e748['options'][_0x3d52('0x19')],function(_0x39d83f){return{'model':db[_0x39d83f[_0x3d52('0x1b')]],'as':_0x39d83f['as'],'attributes':_0x39d83f[_0x3d52('0x17')],'include':_0x39d83f[_0x3d52('0x19')]?_[_0x3d52('0x1a')](_0x39d83f[_0x3d52('0x19')],function(_0x5ca269){return{'model':db[_0x5ca269[_0x3d52('0x1b')]],'as':_0x5ca269['as'],'attributes':_0x5ca269[_0x3d52('0x17')],'include':_0x5ca269[_0x3d52('0x19')]?_[_0x3d52('0x1a')](_0x5ca269[_0x3d52('0x19')],function(_0xd08e54){return{'model':db[_0xd08e54[_0x3d52('0x1b')]],'as':_0xd08e54['as'],'attributes':_0xd08e54[_0x3d52('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x403934){logger['info'](_0x3d52('0x1f'),_0x25e748);logger[_0x3d52('0xb')](_0x3d52('0x1f'),_0x25e748,JSON[_0x3d52('0xe')](_0x403934));_0x37b330(_0x403934);})[_0x3d52('0x14')](function(_0x45051c){logger['error'](_0x3d52('0x1f'),_0x45051c['message'],_0x25e748);_0x296eb0(_0x3ba711[_0x3d52('0xf')](0x1f4,_0x45051c[_0x3d52('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 79a2477..203c42a 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 _0xba71=['getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id/fields'];(function(_0x5d5f03,_0x4d8cfc){var _0x4e1cb8=function(_0x1f84a){while(--_0x1f84a){_0x5d5f03['push'](_0x5d5f03['shift']());}};_0x4e1cb8(++_0x4d8cfc);}(_0xba71,0x120));var _0x1ba7=function(_0x38e191,_0x8d5355){_0x38e191=_0x38e191-0x0;var _0x4af767=_0xba71[_0x38e191];return _0x4af767;};'use strict';var multer=require(_0x1ba7('0x0'));var util=require(_0x1ba7('0x1'));var path=require(_0x1ba7('0x2'));var timeout=require(_0x1ba7('0x3'));var express=require('express');var router=express[_0x1ba7('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1ba7('0x5'));var config=require(_0x1ba7('0x6'));var controller=require('./intFreshdeskConfiguration.controller');router[_0x1ba7('0x7')]('/',auth[_0x1ba7('0x8')](),controller[_0x1ba7('0x9')]);router[_0x1ba7('0x7')]('/:id',auth[_0x1ba7('0x8')](),controller['show']);router[_0x1ba7('0x7')](_0x1ba7('0xa'),auth['isAuthenticated'](),controller[_0x1ba7('0xb')]);router[_0x1ba7('0x7')](_0x1ba7('0xc'),auth[_0x1ba7('0x8')](),controller['getSubjects']);router[_0x1ba7('0x7')](_0x1ba7('0xd'),auth[_0x1ba7('0x8')](),controller[_0x1ba7('0xe')]);router['get'](_0x1ba7('0xf'),auth['isAuthenticated'](),controller['getTags']);router['post']('/',auth[_0x1ba7('0x8')](),controller[_0x1ba7('0x10')]);router[_0x1ba7('0x11')](_0x1ba7('0xf'),auth['isAuthenticated'](),controller['setTags']);router[_0x1ba7('0x12')](_0x1ba7('0x13'),auth['isAuthenticated'](),controller[_0x1ba7('0x14')]);router[_0x1ba7('0x15')]('/:id',auth[_0x1ba7('0x8')](),controller[_0x1ba7('0x16')]);module['exports']=router; \ No newline at end of file +var _0x04d1=['/:id/tags','getTags','setTags','put','delete','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions'];(function(_0x16c5f0,_0x329e87){var _0x4df7eb=function(_0x25b976){while(--_0x25b976){_0x16c5f0['push'](_0x16c5f0['shift']());}};_0x4df7eb(++_0x329e87);}(_0x04d1,0x12c));var _0x104d=function(_0x2fdba1,_0x1246f7){_0x2fdba1=_0x2fdba1-0x0;var _0x1a3cf3=_0x04d1[_0x2fdba1];return _0x1a3cf3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x104d('0x0'));var express=require('express');var router=express[_0x104d('0x1')]();var auth=require(_0x104d('0x2'));var interaction=require(_0x104d('0x3'));var config=require(_0x104d('0x4'));var controller=require(_0x104d('0x5'));router[_0x104d('0x6')]('/',auth[_0x104d('0x7')](),controller[_0x104d('0x8')]);router[_0x104d('0x6')](_0x104d('0x9'),auth[_0x104d('0x7')](),controller[_0x104d('0xa')]);router[_0x104d('0x6')](_0x104d('0xb'),auth[_0x104d('0x7')](),controller['getFields']);router['get'](_0x104d('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x104d('0x6')](_0x104d('0xd'),auth['isAuthenticated'](),controller[_0x104d('0xe')]);router[_0x104d('0x6')](_0x104d('0xf'),auth[_0x104d('0x7')](),controller[_0x104d('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x104d('0xf'),auth[_0x104d('0x7')](),controller[_0x104d('0x11')]);router[_0x104d('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x104d('0x13')]('/:id',auth[_0x104d('0x7')](),controller['destroy']);module[_0x104d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index b708d8e..4c1a83e 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 _0x38ea=['exports','STRING','sequelize'];(function(_0x34ac4b,_0xac857e){var _0x57c0db=function(_0x199bd6){while(--_0x199bd6){_0x34ac4b['push'](_0x34ac4b['shift']());}};_0x57c0db(++_0xac857e);}(_0x38ea,0xd7));var _0xa38e=function(_0x3a39c4,_0x3d8c81){_0x3a39c4=_0x3a39c4-0x0;var _0x1392f6=_0x38ea[_0x3a39c4];return _0x1392f6;};'use strict';var Sequelize=require(_0xa38e('0x0'));module[_0xa38e('0x1')]={'name':{'type':Sequelize[_0xa38e('0x2')]},'description':{'type':Sequelize[_0xa38e('0x2')]}}; \ No newline at end of file +var _0x464b=['sequelize','exports','STRING'];(function(_0x104112,_0x342eb6){var _0x394ab4=function(_0x48db18){while(--_0x48db18){_0x104112['push'](_0x104112['shift']());}};_0x394ab4(++_0x342eb6);}(_0x464b,0xc3));var _0xb464=function(_0x385226,_0x156d51){_0x385226=_0x385226-0x0;var _0x3ae91c=_0x464b[_0x385226];return _0x3ae91c;};'use strict';var Sequelize=require(_0xb464('0x0'));module[_0xb464('0x1')]={'name':{'type':Sequelize[_0xb464('0x2')]},'description':{'type':Sequelize[_0xb464('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 4d52755..ef83685 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 _0x69f4=['error','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','find','create','update','body','params','getFields','FreshdeskField','order','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','code'];(function(_0x2ee922,_0x3b3c54){var _0x49e807=function(_0x36eb7b){while(--_0x36eb7b){_0x2ee922['push'](_0x2ee922['shift']());}};_0x49e807(++_0x3b3c54);}(_0x69f4,0xa1));var _0x469f=function(_0x309b09,_0xe4c181){_0x309b09=_0x309b09-0x0;var _0x7b38d7=_0x69f4[_0x309b09];return _0x7b38d7;};'use strict';var pdf=require(_0x469f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x469f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x469f('0x2'));var rp=require(_0x469f('0x3'));var moment=require(_0x469f('0x4'));var BPromise=require(_0x469f('0x5'));var Mustache=require(_0x469f('0x6'));var util=require(_0x469f('0x7'));var path=require(_0x469f('0x8'));var sox=require(_0x469f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x469f('0xa'));var crypto=require(_0x469f('0xb'));var jsforce=require(_0x469f('0xc'));var deskjs=require(_0x469f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x469f('0xe'));var Papa=require(_0x469f('0xf'));var Redis=require('ioredis');var authService=require(_0x469f('0x10'));var qs=require(_0x469f('0x11'));var as=require(_0x469f('0x12'));var hardwareService=require(_0x469f('0x13'));var logger=require(_0x469f('0x14'))(_0x469f('0x15'));var utils=require(_0x469f('0x16'));var config=require(_0x469f('0x17'));var db=require(_0x469f('0x18'))['db'];var jayson=require(_0x469f('0x19'));var client=jayson[_0x469f('0x1a')][_0x469f('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x3718b8,_0x542d50,_0x442355){if(_0x442355){var _0x3f2f3a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3f2f3a[_0x469f('0x1c')](_0x542d50)){return _0x3718b8;}else{throw new db[(_0x469f('0x1d'))][(_0x469f('0x1e'))](_0x469f('0x1f'));}}else{return _0x3718b8;}}function respondWithRpcPromise(_0x240d57,_0x305579,_0x360a0a,_0x335cc9){return new BPromise(function(_0x3f5274,_0x4fb43d){var _0x3f226f=_0x335cc9||client;return _0x3f226f[_0x469f('0x20')](_0x240d57,_0x360a0a)[_0x469f('0x21')](function(_0x27baea){logger[_0x469f('0x22')](_0x469f('0x23'),_0x305579,'request\x20sent');logger[_0x469f('0x24')](_0x469f('0x25'),_0x305579,'request\x20sent',JSON['stringify'](_0x27baea));if(_0x27baea['error']){if(_0x27baea['error'][_0x469f('0x26')]===0x1f4){logger[_0x469f('0x27')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x305579,_0x27baea['error'][_0x469f('0x28')]);return _0x4fb43d(_0x27baea[_0x469f('0x27')][_0x469f('0x28')]);}logger[_0x469f('0x27')](_0x469f('0x23'),_0x305579,_0x27baea['error'][_0x469f('0x28')]);return _0x3f5274(_0x27baea['error'][_0x469f('0x28')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x305579,_0x469f('0x29'));_0x3f5274(_0x27baea[_0x469f('0x2a')]['message']);}})[_0x469f('0x2b')](function(_0x515322){logger[_0x469f('0x27')](_0x469f('0x23'),_0x305579,_0x515322);_0x4fb43d(_0x515322);});});}function respondWithStatusCode(_0x2a09fa,_0x3c3c7c){_0x3c3c7c=_0x3c3c7c||0xcc;return function(_0x562b71){if(_0x562b71){return _0x2a09fa[_0x469f('0x2c')](_0x3c3c7c);}return _0x2a09fa[_0x469f('0x2d')](_0x3c3c7c)[_0x469f('0x2e')]();};}function respondWithResult(_0x9f507c,_0x29fcb1){_0x29fcb1=_0x29fcb1||0xc8;return function(_0x188ad6){if(_0x188ad6){return _0x9f507c[_0x469f('0x2d')](_0x29fcb1)[_0x469f('0x2f')](_0x188ad6);}};}function respondWithFilteredResult(_0x1ce9e6,_0x53f9ab){return function(_0x4c3a92){if(_0x4c3a92){var _0x453ea0=_0x4c3a92['count'],_0x4a274f=_0x53f9ab[_0x469f('0x30')],_0x40483c=_0x53f9ab[_0x469f('0x30')]+_0x53f9ab[_0x469f('0x31')],_0x4ca58e;if(_0x40483c>=_0x453ea0){_0x40483c=_0x453ea0;_0x4ca58e=0xc8;}else{_0x4ca58e=0xce;}_0x1ce9e6[_0x469f('0x2d')](_0x4ca58e);return _0x1ce9e6[_0x469f('0x32')]('Content-Range',_0x4a274f+'-'+_0x40483c+'/'+_0x453ea0)[_0x469f('0x2f')](_0x4c3a92);}return null;};}function patchUpdates(_0x2eb27b){return function(_0x4097a0){try{jsonpatch[_0x469f('0x33')](_0x4097a0,_0x2eb27b,!![]);}catch(_0xb741f){return BPromise[_0x469f('0x34')](_0xb741f);}return _0x4097a0[_0x469f('0x35')]();};}function saveUpdates(_0x150d85,_0x410861){return function(_0x407458){if(_0x407458){return _0x407458['update'](_0x150d85)[_0x469f('0x21')](function(_0x417c06){return _0x417c06;});}return null;};}function removeEntity(_0x3422c5,_0x21de11){return function(_0x3ef793){if(_0x3ef793){return _0x3ef793[_0x469f('0x36')]()[_0x469f('0x21')](function(){_0x3422c5[_0x469f('0x2d')](0xcc)[_0x469f('0x2e')]();});}};}function handleEntityNotFound(_0x42b823,_0x327852){return function(_0x465cb){if(!_0x465cb){_0x42b823[_0x469f('0x2c')](0x194);}return _0x465cb;};}function handleError(_0x3e5b93,_0x14df9a){_0x14df9a=_0x14df9a||0x1f4;return function(_0x1d53e0){logger[_0x469f('0x27')](_0x1d53e0[_0x469f('0x37')]);if(_0x1d53e0[_0x469f('0x38')]){delete _0x1d53e0[_0x469f('0x38')];}_0x3e5b93['status'](_0x14df9a)[_0x469f('0x39')](_0x1d53e0);};}exports[_0x469f('0x3a')]=function(_0x464bd0,_0x5f315c){var _0x350dc7={},_0x5c9c6f={},_0x219da5={'count':0x0,'rows':[]};var _0x39e682=_[_0x469f('0x3b')](db[_0x469f('0x3c')][_0x469f('0x3d')],function(_0x1d968a){return{'name':_0x1d968a['fieldName'],'type':_0x1d968a[_0x469f('0x3e')][_0x469f('0x3f')]};});_0x5c9c6f[_0x469f('0x40')]=_[_0x469f('0x3b')](_0x39e682,'name');_0x5c9c6f[_0x469f('0x41')]=_[_0x469f('0x42')](_0x464bd0[_0x469f('0x41')]);_0x5c9c6f[_0x469f('0x43')]=_[_0x469f('0x44')](_0x5c9c6f['model'],_0x5c9c6f[_0x469f('0x41')]);_0x350dc7[_0x469f('0x45')]=_['intersection'](_0x5c9c6f[_0x469f('0x40')],qs[_0x469f('0x46')](_0x464bd0['query'][_0x469f('0x46')]));_0x350dc7[_0x469f('0x45')]=_0x350dc7['attributes'][_0x469f('0x47')]?_0x350dc7[_0x469f('0x45')]:_0x5c9c6f[_0x469f('0x40')];if(!_0x464bd0[_0x469f('0x41')][_0x469f('0x48')](_0x469f('0x49'))){_0x350dc7['limit']=qs[_0x469f('0x31')](_0x464bd0[_0x469f('0x41')][_0x469f('0x31')]);_0x350dc7['offset']=qs[_0x469f('0x30')](_0x464bd0['query'][_0x469f('0x30')]);}_0x350dc7['order']=qs[_0x469f('0x4a')](_0x464bd0['query'][_0x469f('0x4a')]);_0x350dc7['where']=qs['filters'](_[_0x469f('0x4b')](_0x464bd0['query'],_0x5c9c6f[_0x469f('0x43')]));if(_0x464bd0[_0x469f('0x41')][_0x469f('0x4c')]){_0x350dc7[_0x469f('0x4d')]=_[_0x469f('0x4e')](_0x350dc7[_0x469f('0x4d')],{'$or':_['map'](_0x39e682,function(_0x435ff4){if(_0x435ff4[_0x469f('0x3e')]!==_0x469f('0x4f')){var _0x3a768f={};_0x3a768f[_0x435ff4[_0x469f('0x38')]]={'$like':'%'+_0x464bd0[_0x469f('0x41')][_0x469f('0x4c')]+'%'};return _0x3a768f;}})});}_0x350dc7=_[_0x469f('0x4e')]({},_0x350dc7,_0x464bd0[_0x469f('0x50')]);var _0x58ea69={'where':_0x350dc7['where']};return db[_0x469f('0x3c')]['count'](_0x58ea69)[_0x469f('0x21')](function(_0x121b65){_0x219da5[_0x469f('0x51')]=_0x121b65;if(_0x464bd0['query'][_0x469f('0x52')]){_0x350dc7[_0x469f('0x53')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x469f('0x54')](_0x350dc7);})['then'](function(_0x11307a){_0x219da5[_0x469f('0x55')]=_0x11307a;return _0x219da5;})[_0x469f('0x21')](respondWithFilteredResult(_0x5f315c,_0x350dc7))[_0x469f('0x2b')](handleError(_0x5f315c,null));};exports['show']=function(_0x552308,_0x38bfa4){var _0x5164b3={'raw':![],'where':{'id':_0x552308['params']['id']}},_0x5b77a7={};_0x5b77a7[_0x469f('0x40')]=_[_0x469f('0x42')](db[_0x469f('0x3c')][_0x469f('0x3d')]);_0x5b77a7[_0x469f('0x41')]=_['keys'](_0x552308[_0x469f('0x41')]);_0x5b77a7[_0x469f('0x43')]=_[_0x469f('0x44')](_0x5b77a7[_0x469f('0x40')],_0x5b77a7['query']);_0x5164b3['attributes']=_['intersection'](_0x5b77a7[_0x469f('0x40')],qs['fields'](_0x552308['query'][_0x469f('0x46')]));_0x5164b3[_0x469f('0x45')]=_0x5164b3['attributes'][_0x469f('0x47')]?_0x5164b3[_0x469f('0x45')]:_0x5b77a7[_0x469f('0x40')];if(_0x552308[_0x469f('0x41')][_0x469f('0x52')]){_0x5164b3[_0x469f('0x53')]=[{'all':!![]}];}_0x5164b3=_['merge']({},_0x5164b3,_0x552308[_0x469f('0x50')]);return db[_0x469f('0x3c')][_0x469f('0x56')](_0x5164b3)[_0x469f('0x21')](handleEntityNotFound(_0x38bfa4,null))[_0x469f('0x21')](respondWithResult(_0x38bfa4,null))[_0x469f('0x2b')](handleError(_0x38bfa4,null));};exports[_0x469f('0x57')]=function(_0x1bd5d8,_0xf0e7fa){return db[_0x469f('0x3c')]['create'](_0x1bd5d8['body'],{})[_0x469f('0x21')](respondWithResult(_0xf0e7fa,0xc9))[_0x469f('0x2b')](handleError(_0xf0e7fa,null));};exports[_0x469f('0x58')]=function(_0x134a13,_0x5b699){if(_0x134a13[_0x469f('0x59')]['id']){delete _0x134a13[_0x469f('0x59')]['id'];}return db[_0x469f('0x3c')]['find']({'where':{'id':_0x134a13[_0x469f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5b699,null))[_0x469f('0x21')](saveUpdates(_0x134a13[_0x469f('0x59')],null))[_0x469f('0x21')](respondWithResult(_0x5b699,null))[_0x469f('0x2b')](handleError(_0x5b699,null));};exports[_0x469f('0x36')]=function(_0x146b5d,_0x283243){return db[_0x469f('0x3c')]['find']({'where':{'id':_0x146b5d[_0x469f('0x5a')]['id']}})[_0x469f('0x21')](handleEntityNotFound(_0x283243,null))[_0x469f('0x21')](removeEntity(_0x283243,null))[_0x469f('0x2b')](handleError(_0x283243,null));};exports[_0x469f('0x5b')]=function(_0x4e919b,_0x54be3a,_0x43ec13){var _0x18713c={};var _0x391c35={};var _0x385fb3;var _0x24a8f5;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4e919b[_0x469f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x54be3a,null))[_0x469f('0x21')](function(_0x2b1912){if(_0x2b1912){_0x385fb3=_0x2b1912;_0x391c35['model']=_[_0x469f('0x42')](db[_0x469f('0x5c')][_0x469f('0x3d')]);_0x391c35['query']=_['keys'](_0x4e919b['query']);_0x391c35[_0x469f('0x43')]=_['intersection'](_0x391c35[_0x469f('0x40')],_0x391c35['query']);_0x18713c[_0x469f('0x45')]=_[_0x469f('0x44')](_0x391c35[_0x469f('0x40')],qs[_0x469f('0x46')](_0x4e919b['query'][_0x469f('0x46')]));_0x18713c['attributes']=_0x18713c[_0x469f('0x45')]['length']?_0x18713c[_0x469f('0x45')]:_0x391c35['model'];_0x18713c[_0x469f('0x5d')]=qs[_0x469f('0x4a')](_0x4e919b[_0x469f('0x41')]['sort']);_0x18713c[_0x469f('0x4d')]=qs[_0x469f('0x43')](_['pick'](_0x4e919b[_0x469f('0x41')],_0x391c35[_0x469f('0x43')]));if(_0x4e919b[_0x469f('0x41')]['filter']){_0x18713c[_0x469f('0x4d')]=_[_0x469f('0x4e')](_0x18713c[_0x469f('0x4d')],{'$or':_[_0x469f('0x3b')](_0x18713c[_0x469f('0x45')],function(_0x15b0ff){var _0x15f7a7={};_0x15f7a7[_0x15b0ff]={'$like':'%'+_0x4e919b['query'][_0x469f('0x4c')]+'%'};return _0x15f7a7;})});}_0x18713c=_[_0x469f('0x4e')]({},_0x18713c,_0x4e919b['options']);return _0x385fb3[_0x469f('0x5b')](_0x18713c);}})[_0x469f('0x21')](function(_0x2f303c){if(_0x2f303c){_0x24a8f5=_0x2f303c[_0x469f('0x47')];if(!_0x4e919b[_0x469f('0x41')][_0x469f('0x48')](_0x469f('0x49'))){_0x18713c[_0x469f('0x31')]=qs['limit'](_0x4e919b[_0x469f('0x41')][_0x469f('0x31')]);_0x18713c[_0x469f('0x30')]=qs[_0x469f('0x30')](_0x4e919b[_0x469f('0x41')][_0x469f('0x30')]);}return _0x385fb3[_0x469f('0x5b')](_0x18713c);}})[_0x469f('0x21')](function(_0x11f813){if(_0x11f813){return _0x11f813?{'count':_0x24a8f5,'rows':_0x11f813}:null;}})[_0x469f('0x21')](respondWithResult(_0x54be3a,null))[_0x469f('0x2b')](handleError(_0x54be3a,null));};exports[_0x469f('0x5e')]=function(_0x1c5201,_0x4cec80,_0x5c08aa){var _0x138271={};var _0x5d3464={};var _0x1585ab;var _0x548b2e;return db[_0x469f('0x3c')][_0x469f('0x5f')]({'where':{'id':_0x1c5201['params']['id']}})[_0x469f('0x21')](handleEntityNotFound(_0x4cec80,null))[_0x469f('0x21')](function(_0x513ff3){if(_0x513ff3){_0x1585ab=_0x513ff3;_0x5d3464['model']=_[_0x469f('0x42')](db[_0x469f('0x5c')][_0x469f('0x3d')]);_0x5d3464[_0x469f('0x41')]=_['keys'](_0x1c5201[_0x469f('0x41')]);_0x5d3464['filters']=_[_0x469f('0x44')](_0x5d3464[_0x469f('0x40')],_0x5d3464['query']);_0x138271[_0x469f('0x45')]=_['intersection'](_0x5d3464[_0x469f('0x40')],qs[_0x469f('0x46')](_0x1c5201[_0x469f('0x41')][_0x469f('0x46')]));_0x138271[_0x469f('0x45')]=_0x138271[_0x469f('0x45')][_0x469f('0x47')]?_0x138271[_0x469f('0x45')]:_0x5d3464['model'];_0x138271['order']=qs[_0x469f('0x4a')](_0x1c5201['query'][_0x469f('0x4a')]);_0x138271['where']=qs['filters'](_[_0x469f('0x4b')](_0x1c5201[_0x469f('0x41')],_0x5d3464[_0x469f('0x43')]));if(_0x1c5201['query']['filter']){_0x138271['where']=_[_0x469f('0x4e')](_0x138271[_0x469f('0x4d')],{'$or':_[_0x469f('0x3b')](_0x138271[_0x469f('0x45')],function(_0x35f65b){var _0xfed47d={};_0xfed47d[_0x35f65b]={'$like':'%'+_0x1c5201['query']['filter']+'%'};return _0xfed47d;})});}_0x138271=_[_0x469f('0x4e')]({},_0x138271,_0x1c5201[_0x469f('0x50')]);return _0x1585ab[_0x469f('0x5e')](_0x138271);}})[_0x469f('0x21')](function(_0x484eec){if(_0x484eec){_0x548b2e=_0x484eec['length'];if(!_0x1c5201['query'][_0x469f('0x48')](_0x469f('0x49'))){_0x138271[_0x469f('0x31')]=qs[_0x469f('0x31')](_0x1c5201[_0x469f('0x41')][_0x469f('0x31')]);_0x138271[_0x469f('0x30')]=qs[_0x469f('0x30')](_0x1c5201['query'][_0x469f('0x30')]);}return _0x1585ab[_0x469f('0x5e')](_0x138271);}})[_0x469f('0x21')](function(_0x5cdcbd){if(_0x5cdcbd){return _0x5cdcbd?{'count':_0x548b2e,'rows':_0x5cdcbd}:null;}})[_0x469f('0x21')](respondWithResult(_0x4cec80,null))[_0x469f('0x2b')](handleError(_0x4cec80,null));};exports[_0x469f('0x60')]=function(_0x3f8c31,_0x1e2ff3,_0x33a280){var _0x3853c0={};var _0x106e5b={};var _0x28d798;var _0x3a336c;return db[_0x469f('0x3c')][_0x469f('0x5f')]({'where':{'id':_0x3f8c31[_0x469f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x1e2ff3,null))[_0x469f('0x21')](function(_0x4bd5fe){if(_0x4bd5fe){_0x28d798=_0x4bd5fe;_0x106e5b[_0x469f('0x40')]=_[_0x469f('0x42')](db[_0x469f('0x5c')]['rawAttributes']);_0x106e5b['query']=_[_0x469f('0x42')](_0x3f8c31[_0x469f('0x41')]);_0x106e5b['filters']=_[_0x469f('0x44')](_0x106e5b[_0x469f('0x40')],_0x106e5b[_0x469f('0x41')]);_0x3853c0[_0x469f('0x45')]=_[_0x469f('0x44')](_0x106e5b[_0x469f('0x40')],qs[_0x469f('0x46')](_0x3f8c31[_0x469f('0x41')][_0x469f('0x46')]));_0x3853c0[_0x469f('0x45')]=_0x3853c0[_0x469f('0x45')]['length']?_0x3853c0['attributes']:_0x106e5b[_0x469f('0x40')];_0x3853c0[_0x469f('0x5d')]=qs[_0x469f('0x4a')](_0x3f8c31[_0x469f('0x41')][_0x469f('0x4a')]);_0x3853c0[_0x469f('0x4d')]=qs[_0x469f('0x43')](_['pick'](_0x3f8c31['query'],_0x106e5b[_0x469f('0x43')]));if(_0x3f8c31[_0x469f('0x41')]['filter']){_0x3853c0['where']=_[_0x469f('0x4e')](_0x3853c0['where'],{'$or':_[_0x469f('0x3b')](_0x3853c0['attributes'],function(_0xbb5be7){var _0x6a2f2f={};_0x6a2f2f[_0xbb5be7]={'$like':'%'+_0x3f8c31[_0x469f('0x41')]['filter']+'%'};return _0x6a2f2f;})});}_0x3853c0=_[_0x469f('0x4e')]({},_0x3853c0,_0x3f8c31[_0x469f('0x50')]);return _0x28d798[_0x469f('0x60')](_0x3853c0);}})[_0x469f('0x21')](function(_0x115eed){if(_0x115eed){_0x3a336c=_0x115eed[_0x469f('0x47')];if(!_0x3f8c31[_0x469f('0x41')]['hasOwnProperty'](_0x469f('0x49'))){_0x3853c0[_0x469f('0x31')]=qs['limit'](_0x3f8c31[_0x469f('0x41')][_0x469f('0x31')]);_0x3853c0['offset']=qs[_0x469f('0x30')](_0x3f8c31[_0x469f('0x41')][_0x469f('0x30')]);}return _0x28d798['getDescriptions'](_0x3853c0);}})['then'](function(_0x1591eb){if(_0x1591eb){return _0x1591eb?{'count':_0x3a336c,'rows':_0x1591eb}:null;}})[_0x469f('0x21')](respondWithResult(_0x1e2ff3,null))[_0x469f('0x2b')](handleError(_0x1e2ff3,null));};exports[_0x469f('0x61')]=function(_0xa5fde4,_0x5edd3d,_0x13f2e0){var _0x440ec3={};var _0x62b9d4={};var _0x3f86d1;var _0x17ebea;return db['FreshdeskConfiguration'][_0x469f('0x5f')]({'where':{'id':_0xa5fde4['params']['id']}})[_0x469f('0x21')](handleEntityNotFound(_0x5edd3d,null))[_0x469f('0x21')](function(_0x1c4b9b){if(_0x1c4b9b){_0x3f86d1=_0x1c4b9b;_0x62b9d4[_0x469f('0x40')]=_[_0x469f('0x42')](db[_0x469f('0x62')][_0x469f('0x3d')]);_0x62b9d4[_0x469f('0x41')]=_['keys'](_0xa5fde4[_0x469f('0x41')]);_0x62b9d4[_0x469f('0x43')]=_[_0x469f('0x44')](_0x62b9d4[_0x469f('0x40')],_0x62b9d4['query']);_0x440ec3['attributes']=_['intersection'](_0x62b9d4[_0x469f('0x40')],qs[_0x469f('0x46')](_0xa5fde4[_0x469f('0x41')][_0x469f('0x46')]));_0x440ec3[_0x469f('0x45')]=_0x440ec3[_0x469f('0x45')]['length']?_0x440ec3[_0x469f('0x45')]:_0x62b9d4[_0x469f('0x40')];_0x440ec3[_0x469f('0x5d')]=qs[_0x469f('0x4a')](_0xa5fde4[_0x469f('0x41')][_0x469f('0x4a')]);_0x440ec3[_0x469f('0x4d')]=qs[_0x469f('0x43')](_[_0x469f('0x4b')](_0xa5fde4['query'],_0x62b9d4[_0x469f('0x43')]));if(_0xa5fde4[_0x469f('0x41')][_0x469f('0x4c')]){_0x440ec3[_0x469f('0x4d')]=_['merge'](_0x440ec3[_0x469f('0x4d')],{'$or':_['map'](_0x440ec3[_0x469f('0x45')],function(_0x31c99e){var _0x33fb33={};_0x33fb33[_0x31c99e]={'$like':'%'+_0xa5fde4['query'][_0x469f('0x4c')]+'%'};return _0x33fb33;})});}_0x440ec3=_['merge']({},_0x440ec3,_0xa5fde4[_0x469f('0x50')]);return _0x3f86d1[_0x469f('0x61')](_0x440ec3);}})['then'](function(_0x11c52e){if(_0x11c52e){_0x17ebea=_0x11c52e['length'];if(!_0xa5fde4[_0x469f('0x41')][_0x469f('0x48')](_0x469f('0x49'))){_0x440ec3['limit']=qs[_0x469f('0x31')](_0xa5fde4[_0x469f('0x41')][_0x469f('0x31')]);_0x440ec3[_0x469f('0x30')]=qs[_0x469f('0x30')](_0xa5fde4[_0x469f('0x41')][_0x469f('0x30')]);}return _0x3f86d1[_0x469f('0x61')](_0x440ec3);}})[_0x469f('0x21')](function(_0x4226ad){if(_0x4226ad){return _0x4226ad?{'count':_0x17ebea,'rows':_0x4226ad}:null;}})['then'](respondWithResult(_0x5edd3d,null))[_0x469f('0x2b')](handleError(_0x5edd3d,null));};exports[_0x469f('0x63')]=function(_0x4759b6,_0x5b172e,_0x2a6f7f){if(_0x4759b6['body']['id']){delete _0x4759b6[_0x469f('0x59')]['id'];}return db[_0x469f('0x3c')][_0x469f('0x5f')]({'where':{'id':_0x4759b6[_0x469f('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5b172e,null))[_0x469f('0x21')](function(_0xa07f78){if(_0xa07f78){return _0xa07f78[_0x469f('0x63')](_0x4759b6[_0x469f('0x59')]['ids']||[]);}return null;})[_0x469f('0x21')](respondWithResult(_0x5b172e,null))[_0x469f('0x2b')](handleError(_0x5b172e,null));}; \ No newline at end of file +var _0x0060=['getSubjects','getDescriptions','getTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','name','send','index','map','FreshdeskConfiguration','rawAttributes','key','model','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','show','params','fields','includeAll','find','create','body','destroy','getFields','nolimit','findOne','FreshdeskField'];(function(_0x1db29a,_0x5263e6){var _0x53525b=function(_0x469d7d){while(--_0x469d7d){_0x1db29a['push'](_0x1db29a['shift']());}};_0x53525b(++_0x5263e6);}(_0x0060,0x11e));var _0x0006=function(_0x33ba78,_0xbcaa2d){_0x33ba78=_0x33ba78-0x0;var _0x24a8a8=_0x0060[_0x33ba78];return _0x24a8a8;};'use strict';var pdf=require(_0x0006('0x0'));var emlformat=require(_0x0006('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0006('0x2'));var jsonpatch=require(_0x0006('0x3'));var rp=require('request-promise');var moment=require(_0x0006('0x4'));var BPromise=require(_0x0006('0x5'));var Mustache=require(_0x0006('0x6'));var util=require('util');var path=require(_0x0006('0x7'));var sox=require(_0x0006('0x8'));var csv=require(_0x0006('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0006('0xa'));var squel=require('squel');var crypto=require(_0x0006('0xb'));var jsforce=require(_0x0006('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0006('0x9'));var querystring=require(_0x0006('0xd'));var Papa=require(_0x0006('0xe'));var Redis=require(_0x0006('0xf'));var authService=require(_0x0006('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0006('0x11'));var hardwareService=require(_0x0006('0x12'));var logger=require('../../config/logger')(_0x0006('0x13'));var utils=require(_0x0006('0x14'));var config=require('../../config/environment');var db=require(_0x0006('0x15'))['db'];var jayson=require(_0x0006('0x16'));var client=jayson[_0x0006('0x17')][_0x0006('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5eb74a,_0xca69ad,_0x5e2ef6){if(_0x5e2ef6){var _0x4edfdc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4edfdc[_0x0006('0x19')](_0xca69ad)){return _0x5eb74a;}else{throw new db[(_0x0006('0x1a'))][(_0x0006('0x1b'))](_0x0006('0x1c'));}}else{return _0x5eb74a;}}function respondWithRpcPromise(_0x1dcc0b,_0x397d5a,_0x3bba76,_0x24d922){return new BPromise(function(_0x13efec,_0xf41460){var _0x355c11=_0x24d922||client;return _0x355c11['request'](_0x1dcc0b,_0x3bba76)['then'](function(_0x56db0f){logger['info'](_0x0006('0x1d'),_0x397d5a,_0x0006('0x1e'));logger[_0x0006('0x1f')](_0x0006('0x20'),_0x397d5a,_0x0006('0x1e'),JSON[_0x0006('0x21')](_0x56db0f));if(_0x56db0f[_0x0006('0x22')]){if(_0x56db0f['error'][_0x0006('0x23')]===0x1f4){logger['error'](_0x0006('0x1d'),_0x397d5a,_0x56db0f['error'][_0x0006('0x24')]);return _0xf41460(_0x56db0f[_0x0006('0x22')][_0x0006('0x24')]);}logger[_0x0006('0x22')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x397d5a,_0x56db0f[_0x0006('0x22')]['message']);return _0x13efec(_0x56db0f['error'][_0x0006('0x24')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x397d5a,'request\x20sent');_0x13efec(_0x56db0f['result']['message']);}})[_0x0006('0x25')](function(_0x233e1e){logger[_0x0006('0x22')](_0x0006('0x1d'),_0x397d5a,_0x233e1e);_0xf41460(_0x233e1e);});});}function respondWithStatusCode(_0x9a33e5,_0x3a8a8e){_0x3a8a8e=_0x3a8a8e||0xcc;return function(_0x4295b7){if(_0x4295b7){return _0x9a33e5[_0x0006('0x26')](_0x3a8a8e);}return _0x9a33e5['status'](_0x3a8a8e)[_0x0006('0x27')]();};}function respondWithResult(_0x51d8d2,_0x1d1633){_0x1d1633=_0x1d1633||0xc8;return function(_0x388199){if(_0x388199){return _0x51d8d2[_0x0006('0x28')](_0x1d1633)[_0x0006('0x29')](_0x388199);}};}function respondWithFilteredResult(_0x3fa769,_0x3633e7){return function(_0x56687c){if(_0x56687c){var _0x18fb47=_0x56687c['count'],_0x374a4e=_0x3633e7['offset'],_0x11ed6f=_0x3633e7[_0x0006('0x2a')]+_0x3633e7[_0x0006('0x2b')],_0xe3aa24;if(_0x11ed6f>=_0x18fb47){_0x11ed6f=_0x18fb47;_0xe3aa24=0xc8;}else{_0xe3aa24=0xce;}_0x3fa769[_0x0006('0x28')](_0xe3aa24);return _0x3fa769['set'](_0x0006('0x2c'),_0x374a4e+'-'+_0x11ed6f+'/'+_0x18fb47)[_0x0006('0x29')](_0x56687c);}return null;};}function patchUpdates(_0xd7faf){return function(_0x25f901){try{jsonpatch[_0x0006('0x2d')](_0x25f901,_0xd7faf,!![]);}catch(_0x52a172){return BPromise[_0x0006('0x2e')](_0x52a172);}return _0x25f901[_0x0006('0x2f')]();};}function saveUpdates(_0x396f0e,_0x3f5122){return function(_0x14711d){if(_0x14711d){return _0x14711d[_0x0006('0x30')](_0x396f0e)[_0x0006('0x31')](function(_0x2155e5){return _0x2155e5;});}return null;};}function removeEntity(_0x531af0,_0x297097){return function(_0x4dbc55){if(_0x4dbc55){return _0x4dbc55['destroy']()[_0x0006('0x31')](function(){_0x531af0[_0x0006('0x28')](0xcc)[_0x0006('0x27')]();});}};}function handleEntityNotFound(_0x236f59,_0x408b21){return function(_0x20e140){if(!_0x20e140){_0x236f59['sendStatus'](0x194);}return _0x20e140;};}function handleError(_0x193a1d,_0x420ce7){_0x420ce7=_0x420ce7||0x1f4;return function(_0x1332d9){logger[_0x0006('0x22')](_0x1332d9['stack']);if(_0x1332d9[_0x0006('0x32')]){delete _0x1332d9[_0x0006('0x32')];}_0x193a1d[_0x0006('0x28')](_0x420ce7)[_0x0006('0x33')](_0x1332d9);};}exports[_0x0006('0x34')]=function(_0x2538c8,_0x13e6e3){var _0x34600c={},_0x1108b1={},_0x2f81c7={'count':0x0,'rows':[]};var _0x2098b5=_[_0x0006('0x35')](db[_0x0006('0x36')][_0x0006('0x37')],function(_0x4c9400){return{'name':_0x4c9400['fieldName'],'type':_0x4c9400['type'][_0x0006('0x38')]};});_0x1108b1[_0x0006('0x39')]=_['map'](_0x2098b5,_0x0006('0x32'));_0x1108b1[_0x0006('0x3a')]=_[_0x0006('0x3b')](_0x2538c8['query']);_0x1108b1['filters']=_[_0x0006('0x3c')](_0x1108b1['model'],_0x1108b1[_0x0006('0x3a')]);_0x34600c[_0x0006('0x3d')]=_['intersection'](_0x1108b1[_0x0006('0x39')],qs['fields'](_0x2538c8[_0x0006('0x3a')]['fields']));_0x34600c[_0x0006('0x3d')]=_0x34600c[_0x0006('0x3d')][_0x0006('0x3e')]?_0x34600c[_0x0006('0x3d')]:_0x1108b1[_0x0006('0x39')];if(!_0x2538c8[_0x0006('0x3a')][_0x0006('0x3f')]('nolimit')){_0x34600c[_0x0006('0x2b')]=qs[_0x0006('0x2b')](_0x2538c8[_0x0006('0x3a')][_0x0006('0x2b')]);_0x34600c[_0x0006('0x2a')]=qs['offset'](_0x2538c8['query'][_0x0006('0x2a')]);}_0x34600c[_0x0006('0x40')]=qs[_0x0006('0x41')](_0x2538c8[_0x0006('0x3a')][_0x0006('0x41')]);_0x34600c[_0x0006('0x42')]=qs[_0x0006('0x43')](_[_0x0006('0x44')](_0x2538c8['query'],_0x1108b1['filters']));if(_0x2538c8['query'][_0x0006('0x45')]){_0x34600c[_0x0006('0x42')]=_[_0x0006('0x46')](_0x34600c['where'],{'$or':_[_0x0006('0x35')](_0x2098b5,function(_0x2274f2){if(_0x2274f2[_0x0006('0x47')]!==_0x0006('0x48')){var _0x4b288b={};_0x4b288b[_0x2274f2[_0x0006('0x32')]]={'$like':'%'+_0x2538c8[_0x0006('0x3a')][_0x0006('0x45')]+'%'};return _0x4b288b;}})});}_0x34600c=_[_0x0006('0x46')]({},_0x34600c,_0x2538c8[_0x0006('0x49')]);var _0x24093b={'where':_0x34600c['where']};return db['FreshdeskConfiguration']['count'](_0x24093b)['then'](function(_0x2ed2be){_0x2f81c7[_0x0006('0x4a')]=_0x2ed2be;if(_0x2538c8[_0x0006('0x3a')]['includeAll']){_0x34600c[_0x0006('0x4b')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x0006('0x4c')](_0x34600c);})['then'](function(_0x38d6f8){_0x2f81c7[_0x0006('0x4d')]=_0x38d6f8;return _0x2f81c7;})[_0x0006('0x31')](respondWithFilteredResult(_0x13e6e3,_0x34600c))[_0x0006('0x25')](handleError(_0x13e6e3,null));};exports[_0x0006('0x4e')]=function(_0x3b26ba,_0xd34bbf){var _0x48ad8e={'raw':![],'where':{'id':_0x3b26ba[_0x0006('0x4f')]['id']}},_0x1537ed={};_0x1537ed['model']=_[_0x0006('0x3b')](db[_0x0006('0x36')]['rawAttributes']);_0x1537ed[_0x0006('0x3a')]=_[_0x0006('0x3b')](_0x3b26ba['query']);_0x1537ed[_0x0006('0x43')]=_[_0x0006('0x3c')](_0x1537ed[_0x0006('0x39')],_0x1537ed[_0x0006('0x3a')]);_0x48ad8e[_0x0006('0x3d')]=_[_0x0006('0x3c')](_0x1537ed[_0x0006('0x39')],qs[_0x0006('0x50')](_0x3b26ba[_0x0006('0x3a')][_0x0006('0x50')]));_0x48ad8e[_0x0006('0x3d')]=_0x48ad8e[_0x0006('0x3d')][_0x0006('0x3e')]?_0x48ad8e[_0x0006('0x3d')]:_0x1537ed[_0x0006('0x39')];if(_0x3b26ba['query'][_0x0006('0x51')]){_0x48ad8e[_0x0006('0x4b')]=[{'all':!![]}];}_0x48ad8e=_['merge']({},_0x48ad8e,_0x3b26ba[_0x0006('0x49')]);return db[_0x0006('0x36')][_0x0006('0x52')](_0x48ad8e)[_0x0006('0x31')](handleEntityNotFound(_0xd34bbf,null))[_0x0006('0x31')](respondWithResult(_0xd34bbf,null))[_0x0006('0x25')](handleError(_0xd34bbf,null));};exports[_0x0006('0x53')]=function(_0x57bef8,_0x30ec9d){return db['FreshdeskConfiguration'][_0x0006('0x53')](_0x57bef8[_0x0006('0x54')],{})[_0x0006('0x31')](respondWithResult(_0x30ec9d,0xc9))[_0x0006('0x25')](handleError(_0x30ec9d,null));};exports[_0x0006('0x30')]=function(_0xfbd2a6,_0x538114){if(_0xfbd2a6['body']['id']){delete _0xfbd2a6[_0x0006('0x54')]['id'];}return db[_0x0006('0x36')]['find']({'where':{'id':_0xfbd2a6[_0x0006('0x4f')]['id']}})[_0x0006('0x31')](handleEntityNotFound(_0x538114,null))['then'](saveUpdates(_0xfbd2a6[_0x0006('0x54')],null))[_0x0006('0x31')](respondWithResult(_0x538114,null))[_0x0006('0x25')](handleError(_0x538114,null));};exports[_0x0006('0x55')]=function(_0xfa03ab,_0x58805c){return db[_0x0006('0x36')][_0x0006('0x52')]({'where':{'id':_0xfa03ab[_0x0006('0x4f')]['id']}})[_0x0006('0x31')](handleEntityNotFound(_0x58805c,null))['then'](removeEntity(_0x58805c,null))[_0x0006('0x25')](handleError(_0x58805c,null));};exports[_0x0006('0x56')]=function(_0x309971,_0x4ddf79,_0x295751){var _0x223556={};var _0x3489db={};var _0xd2b810;var _0xc54368;return db[_0x0006('0x36')]['findOne']({'where':{'id':_0x309971[_0x0006('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4ddf79,null))[_0x0006('0x31')](function(_0x140a0f){if(_0x140a0f){_0xd2b810=_0x140a0f;_0x3489db[_0x0006('0x39')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x3489db[_0x0006('0x3a')]=_[_0x0006('0x3b')](_0x309971['query']);_0x3489db[_0x0006('0x43')]=_[_0x0006('0x3c')](_0x3489db[_0x0006('0x39')],_0x3489db['query']);_0x223556[_0x0006('0x3d')]=_[_0x0006('0x3c')](_0x3489db[_0x0006('0x39')],qs[_0x0006('0x50')](_0x309971['query']['fields']));_0x223556[_0x0006('0x3d')]=_0x223556['attributes'][_0x0006('0x3e')]?_0x223556['attributes']:_0x3489db[_0x0006('0x39')];_0x223556[_0x0006('0x40')]=qs[_0x0006('0x41')](_0x309971[_0x0006('0x3a')]['sort']);_0x223556[_0x0006('0x42')]=qs[_0x0006('0x43')](_[_0x0006('0x44')](_0x309971[_0x0006('0x3a')],_0x3489db[_0x0006('0x43')]));if(_0x309971[_0x0006('0x3a')][_0x0006('0x45')]){_0x223556[_0x0006('0x42')]=_['merge'](_0x223556[_0x0006('0x42')],{'$or':_[_0x0006('0x35')](_0x223556[_0x0006('0x3d')],function(_0x4c9182){var _0x1d7459={};_0x1d7459[_0x4c9182]={'$like':'%'+_0x309971[_0x0006('0x3a')][_0x0006('0x45')]+'%'};return _0x1d7459;})});}_0x223556=_['merge']({},_0x223556,_0x309971[_0x0006('0x49')]);return _0xd2b810[_0x0006('0x56')](_0x223556);}})['then'](function(_0x1aaee7){if(_0x1aaee7){_0xc54368=_0x1aaee7['length'];if(!_0x309971['query'][_0x0006('0x3f')](_0x0006('0x57'))){_0x223556['limit']=qs[_0x0006('0x2b')](_0x309971[_0x0006('0x3a')][_0x0006('0x2b')]);_0x223556[_0x0006('0x2a')]=qs[_0x0006('0x2a')](_0x309971[_0x0006('0x3a')][_0x0006('0x2a')]);}return _0xd2b810[_0x0006('0x56')](_0x223556);}})[_0x0006('0x31')](function(_0x23d690){if(_0x23d690){return _0x23d690?{'count':_0xc54368,'rows':_0x23d690}:null;}})[_0x0006('0x31')](respondWithResult(_0x4ddf79,null))[_0x0006('0x25')](handleError(_0x4ddf79,null));};exports['getSubjects']=function(_0xd74be2,_0x4a4b24,_0xc28fc5){var _0x579875={};var _0x4e80b0={};var _0x319673;var _0x12054;return db[_0x0006('0x36')][_0x0006('0x58')]({'where':{'id':_0xd74be2[_0x0006('0x4f')]['id']}})[_0x0006('0x31')](handleEntityNotFound(_0x4a4b24,null))[_0x0006('0x31')](function(_0x538801){if(_0x538801){_0x319673=_0x538801;_0x4e80b0[_0x0006('0x39')]=_['keys'](db[_0x0006('0x59')]['rawAttributes']);_0x4e80b0['query']=_[_0x0006('0x3b')](_0xd74be2[_0x0006('0x3a')]);_0x4e80b0[_0x0006('0x43')]=_[_0x0006('0x3c')](_0x4e80b0[_0x0006('0x39')],_0x4e80b0[_0x0006('0x3a')]);_0x579875[_0x0006('0x3d')]=_['intersection'](_0x4e80b0[_0x0006('0x39')],qs[_0x0006('0x50')](_0xd74be2[_0x0006('0x3a')][_0x0006('0x50')]));_0x579875[_0x0006('0x3d')]=_0x579875[_0x0006('0x3d')][_0x0006('0x3e')]?_0x579875[_0x0006('0x3d')]:_0x4e80b0['model'];_0x579875[_0x0006('0x40')]=qs[_0x0006('0x41')](_0xd74be2['query'][_0x0006('0x41')]);_0x579875['where']=qs[_0x0006('0x43')](_[_0x0006('0x44')](_0xd74be2[_0x0006('0x3a')],_0x4e80b0['filters']));if(_0xd74be2[_0x0006('0x3a')][_0x0006('0x45')]){_0x579875['where']=_[_0x0006('0x46')](_0x579875[_0x0006('0x42')],{'$or':_['map'](_0x579875['attributes'],function(_0x24f391){var _0x40fa9d={};_0x40fa9d[_0x24f391]={'$like':'%'+_0xd74be2[_0x0006('0x3a')][_0x0006('0x45')]+'%'};return _0x40fa9d;})});}_0x579875=_[_0x0006('0x46')]({},_0x579875,_0xd74be2[_0x0006('0x49')]);return _0x319673[_0x0006('0x5a')](_0x579875);}})[_0x0006('0x31')](function(_0x1e3ab3){if(_0x1e3ab3){_0x12054=_0x1e3ab3[_0x0006('0x3e')];if(!_0xd74be2['query']['hasOwnProperty']('nolimit')){_0x579875['limit']=qs[_0x0006('0x2b')](_0xd74be2[_0x0006('0x3a')][_0x0006('0x2b')]);_0x579875['offset']=qs[_0x0006('0x2a')](_0xd74be2[_0x0006('0x3a')][_0x0006('0x2a')]);}return _0x319673[_0x0006('0x5a')](_0x579875);}})[_0x0006('0x31')](function(_0x447e1e){if(_0x447e1e){return _0x447e1e?{'count':_0x12054,'rows':_0x447e1e}:null;}})['then'](respondWithResult(_0x4a4b24,null))[_0x0006('0x25')](handleError(_0x4a4b24,null));};exports[_0x0006('0x5b')]=function(_0x4106aa,_0x478ffc,_0x4b7550){var _0x31d9f6={};var _0x2f9f3f={};var _0x2e0067;var _0x536492;return db[_0x0006('0x36')]['findOne']({'where':{'id':_0x4106aa['params']['id']}})[_0x0006('0x31')](handleEntityNotFound(_0x478ffc,null))[_0x0006('0x31')](function(_0x18ebd9){if(_0x18ebd9){_0x2e0067=_0x18ebd9;_0x2f9f3f[_0x0006('0x39')]=_[_0x0006('0x3b')](db[_0x0006('0x59')][_0x0006('0x37')]);_0x2f9f3f[_0x0006('0x3a')]=_[_0x0006('0x3b')](_0x4106aa[_0x0006('0x3a')]);_0x2f9f3f['filters']=_[_0x0006('0x3c')](_0x2f9f3f[_0x0006('0x39')],_0x2f9f3f[_0x0006('0x3a')]);_0x31d9f6[_0x0006('0x3d')]=_[_0x0006('0x3c')](_0x2f9f3f[_0x0006('0x39')],qs[_0x0006('0x50')](_0x4106aa[_0x0006('0x3a')][_0x0006('0x50')]));_0x31d9f6[_0x0006('0x3d')]=_0x31d9f6[_0x0006('0x3d')]['length']?_0x31d9f6[_0x0006('0x3d')]:_0x2f9f3f['model'];_0x31d9f6[_0x0006('0x40')]=qs[_0x0006('0x41')](_0x4106aa['query'][_0x0006('0x41')]);_0x31d9f6['where']=qs['filters'](_['pick'](_0x4106aa['query'],_0x2f9f3f[_0x0006('0x43')]));if(_0x4106aa[_0x0006('0x3a')][_0x0006('0x45')]){_0x31d9f6['where']=_[_0x0006('0x46')](_0x31d9f6['where'],{'$or':_['map'](_0x31d9f6[_0x0006('0x3d')],function(_0x43cdbd){var _0x28040f={};_0x28040f[_0x43cdbd]={'$like':'%'+_0x4106aa[_0x0006('0x3a')][_0x0006('0x45')]+'%'};return _0x28040f;})});}_0x31d9f6=_[_0x0006('0x46')]({},_0x31d9f6,_0x4106aa[_0x0006('0x49')]);return _0x2e0067['getDescriptions'](_0x31d9f6);}})[_0x0006('0x31')](function(_0x5d13b7){if(_0x5d13b7){_0x536492=_0x5d13b7[_0x0006('0x3e')];if(!_0x4106aa[_0x0006('0x3a')]['hasOwnProperty'](_0x0006('0x57'))){_0x31d9f6[_0x0006('0x2b')]=qs[_0x0006('0x2b')](_0x4106aa[_0x0006('0x3a')]['limit']);_0x31d9f6['offset']=qs[_0x0006('0x2a')](_0x4106aa[_0x0006('0x3a')]['offset']);}return _0x2e0067['getDescriptions'](_0x31d9f6);}})[_0x0006('0x31')](function(_0x3a6dec){if(_0x3a6dec){return _0x3a6dec?{'count':_0x536492,'rows':_0x3a6dec}:null;}})['then'](respondWithResult(_0x478ffc,null))[_0x0006('0x25')](handleError(_0x478ffc,null));};exports[_0x0006('0x5c')]=function(_0x14d65b,_0x3051f3,_0x5bdf44){var _0x4dff68={};var _0x7553d9={};var _0x27e635;var _0x23751f;return db[_0x0006('0x36')][_0x0006('0x58')]({'where':{'id':_0x14d65b[_0x0006('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3051f3,null))[_0x0006('0x31')](function(_0x341510){if(_0x341510){_0x27e635=_0x341510;_0x7553d9[_0x0006('0x39')]=_['keys'](db['Tag'][_0x0006('0x37')]);_0x7553d9['query']=_['keys'](_0x14d65b[_0x0006('0x3a')]);_0x7553d9[_0x0006('0x43')]=_['intersection'](_0x7553d9[_0x0006('0x39')],_0x7553d9['query']);_0x4dff68[_0x0006('0x3d')]=_[_0x0006('0x3c')](_0x7553d9[_0x0006('0x39')],qs[_0x0006('0x50')](_0x14d65b[_0x0006('0x3a')]['fields']));_0x4dff68['attributes']=_0x4dff68[_0x0006('0x3d')]['length']?_0x4dff68[_0x0006('0x3d')]:_0x7553d9[_0x0006('0x39')];_0x4dff68['order']=qs[_0x0006('0x41')](_0x14d65b[_0x0006('0x3a')][_0x0006('0x41')]);_0x4dff68[_0x0006('0x42')]=qs[_0x0006('0x43')](_[_0x0006('0x44')](_0x14d65b[_0x0006('0x3a')],_0x7553d9[_0x0006('0x43')]));if(_0x14d65b[_0x0006('0x3a')][_0x0006('0x45')]){_0x4dff68[_0x0006('0x42')]=_[_0x0006('0x46')](_0x4dff68[_0x0006('0x42')],{'$or':_[_0x0006('0x35')](_0x4dff68[_0x0006('0x3d')],function(_0x3c7643){var _0x282c5a={};_0x282c5a[_0x3c7643]={'$like':'%'+_0x14d65b['query'][_0x0006('0x45')]+'%'};return _0x282c5a;})});}_0x4dff68=_['merge']({},_0x4dff68,_0x14d65b[_0x0006('0x49')]);return _0x27e635['getTags'](_0x4dff68);}})['then'](function(_0x26f61b){if(_0x26f61b){_0x23751f=_0x26f61b['length'];if(!_0x14d65b[_0x0006('0x3a')][_0x0006('0x3f')](_0x0006('0x57'))){_0x4dff68[_0x0006('0x2b')]=qs['limit'](_0x14d65b[_0x0006('0x3a')]['limit']);_0x4dff68['offset']=qs[_0x0006('0x2a')](_0x14d65b[_0x0006('0x3a')]['offset']);}return _0x27e635[_0x0006('0x5c')](_0x4dff68);}})[_0x0006('0x31')](function(_0x42e048){if(_0x42e048){return _0x42e048?{'count':_0x23751f,'rows':_0x42e048}:null;}})['then'](respondWithResult(_0x3051f3,null))[_0x0006('0x25')](handleError(_0x3051f3,null));};exports['setTags']=function(_0x502dba,_0x429659,_0xb9b975){if(_0x502dba[_0x0006('0x54')]['id']){delete _0x502dba[_0x0006('0x54')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x502dba[_0x0006('0x4f')]['id']}})[_0x0006('0x31')](handleEntityNotFound(_0x429659,null))[_0x0006('0x31')](function(_0xcc5edc){if(_0xcc5edc){return _0xcc5edc['setTags'](_0x502dba['body'][_0x0006('0x5d')]||[]);}return null;})[_0x0006('0x31')](respondWithResult(_0x429659,null))[_0x0006('0x25')](handleError(_0x429659,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 0a1ee84..7515aa5 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 _0x2008=['rimraf','../../config/environment','int_freshdesk_configurations','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x4e3cfa,_0xf8d93e){var _0x36adad=function(_0x991058){while(--_0x991058){_0x4e3cfa['push'](_0x4e3cfa['shift']());}};_0x36adad(++_0xf8d93e);}(_0x2008,0xe4));var _0x8200=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0x2008[_0x52096b];return _0x2b1cc7;};'use strict';var _=require(_0x8200('0x0'));var util=require(_0x8200('0x1'));var logger=require(_0x8200('0x2'))('api');var moment=require(_0x8200('0x3'));var BPromise=require('bluebird');var rp=require(_0x8200('0x4'));var fs=require('fs');var path=require(_0x8200('0x5'));var rimraf=require(_0x8200('0x6'));var config=require(_0x8200('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x169b93,_0x4843c0){return _0x169b93['define']('FreshdeskConfiguration',attributes,{'tableName':_0x8200('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55f3=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes'];(function(_0x20737a,_0x1f107d){var _0x30cb7c=function(_0x2c9185){while(--_0x2c9185){_0x20737a['push'](_0x20737a['shift']());}};_0x30cb7c(++_0x1f107d);}(_0x55f3,0x1b4));var _0x355f=function(_0xfc1b31,_0x49d99e){_0xfc1b31=_0xfc1b31-0x0;var _0x4e74d7=_0x55f3[_0xfc1b31];return _0x4e74d7;};'use strict';var _=require(_0x355f('0x0'));var util=require('util');var logger=require(_0x355f('0x1'))(_0x355f('0x2'));var moment=require('moment');var BPromise=require(_0x355f('0x3'));var rp=require(_0x355f('0x4'));var fs=require('fs');var path=require(_0x355f('0x5'));var rimraf=require(_0x355f('0x6'));var config=require('../../config/environment');var attributes=require(_0x355f('0x7'));module[_0x355f('0x8')]=function(_0x27249a,_0x23daca){return _0x27249a[_0x355f('0x9')](_0x355f('0xa'),attributes,{'tableName':_0x355f('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 4d250b3..0e31fb1 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 _0x6393=['request','then','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3c9e74,_0x4334c5){var _0x4fea21=function(_0x5a2cbb){while(--_0x5a2cbb){_0x3c9e74['push'](_0x3c9e74['shift']());}};_0x4fea21(++_0x4334c5);}(_0x6393,0x8e));var _0x3639=function(_0x185f7f,_0x42aa8b){_0x185f7f=_0x185f7f-0x0;var _0x15d436=_0x6393[_0x185f7f];return _0x15d436;};'use strict';var _=require(_0x3639('0x0'));var util=require(_0x3639('0x1'));var moment=require(_0x3639('0x2'));var BPromise=require('bluebird');var rs=require(_0x3639('0x3'));var fs=require('fs');var Redis=require(_0x3639('0x4'));var db=require(_0x3639('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3639('0x6'))(_0x3639('0x7'));var config=require(_0x3639('0x8'));var jayson=require(_0x3639('0x9'));var client=jayson[_0x3639('0xa')][_0x3639('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27d01f,_0x10a4b9,_0x382079){return new BPromise(function(_0x1786b4,_0x18cdcc){return client[_0x3639('0xc')](_0x27d01f,_0x382079)[_0x3639('0xd')](function(_0x4f7698){logger['info'](_0x3639('0xe'),_0x10a4b9,_0x3639('0xf'));logger['debug'](_0x3639('0x10'),_0x10a4b9,_0x3639('0xf'),JSON['stringify'](_0x4f7698));if(_0x4f7698['error']){if(_0x4f7698[_0x3639('0x11')][_0x3639('0x12')]===0x1f4){logger[_0x3639('0x11')](_0x3639('0xe'),_0x10a4b9,_0x4f7698[_0x3639('0x11')][_0x3639('0x13')]);return _0x18cdcc(_0x4f7698[_0x3639('0x11')][_0x3639('0x13')]);}logger[_0x3639('0x11')](_0x3639('0xe'),_0x10a4b9,_0x4f7698[_0x3639('0x11')]['message']);return _0x1786b4(_0x4f7698[_0x3639('0x11')]['message']);}else{logger[_0x3639('0x14')](_0x3639('0xe'),_0x10a4b9,_0x3639('0xf'));_0x1786b4(_0x4f7698[_0x3639('0x15')][_0x3639('0x13')]);}})['catch'](function(_0x29cce8){logger[_0x3639('0x11')](_0x3639('0xe'),_0x10a4b9,_0x29cce8);_0x18cdcc(_0x29cce8);});});} \ No newline at end of file +var _0x0376=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird'];(function(_0x244977,_0x248794){var _0x43bc02=function(_0x598f6d){while(--_0x598f6d){_0x244977['push'](_0x244977['shift']());}};_0x43bc02(++_0x248794);}(_0x0376,0x18b));var _0x6037=function(_0x1a040e,_0x102e6e){_0x1a040e=_0x1a040e-0x0;var _0x309059=_0x0376[_0x1a040e];return _0x309059;};'use strict';var _=require(_0x6037('0x0'));var util=require(_0x6037('0x1'));var moment=require(_0x6037('0x2'));var BPromise=require(_0x6037('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6037('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6037('0x5'));var logger=require(_0x6037('0x6'))(_0x6037('0x7'));var config=require(_0x6037('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6037('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x370bf9,_0x354515,_0x3f4b8b){return new BPromise(function(_0x46b708,_0x374a8f){return client['request'](_0x370bf9,_0x3f4b8b)[_0x6037('0xa')](function(_0x3cd448){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x354515,_0x6037('0xb'));logger['debug'](_0x6037('0xc'),_0x354515,_0x6037('0xb'),JSON[_0x6037('0xd')](_0x3cd448));if(_0x3cd448[_0x6037('0xe')]){if(_0x3cd448[_0x6037('0xe')][_0x6037('0xf')]===0x1f4){logger[_0x6037('0xe')](_0x6037('0x10'),_0x354515,_0x3cd448[_0x6037('0xe')][_0x6037('0x11')]);return _0x374a8f(_0x3cd448[_0x6037('0xe')][_0x6037('0x11')]);}logger[_0x6037('0xe')](_0x6037('0x10'),_0x354515,_0x3cd448[_0x6037('0xe')][_0x6037('0x11')]);return _0x46b708(_0x3cd448['error'][_0x6037('0x11')]);}else{logger[_0x6037('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x354515,_0x6037('0xb'));_0x46b708(_0x3cd448[_0x6037('0x13')]['message']);}})[_0x6037('0x14')](function(_0x20d929){logger[_0x6037('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x354515,_0x20d929);_0x374a8f(_0x20d929);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2609160..d5cdc31 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x10c814,_0x2c5349){var _0x3620e8=function(_0x2da52a){while(--_0x2da52a){_0x10c814['push'](_0x10c814['shift']());}};_0x3620e8(++_0x2c5349);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var auth=require(_0x49c4('0x4'));var interaction=require(_0x49c4('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x49c4('0x6')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x7')]);router[_0x49c4('0x6')](_0x49c4('0x8'),auth[_0x49c4('0x9')](),controller[_0x49c4('0xa')]);router['post']('/',auth[_0x49c4('0x9')](),controller[_0x49c4('0xb')]);router[_0x49c4('0xc')](_0x49c4('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x49c4('0xd')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0x9c44=['/:id','isAuthenticated','show','create','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x949ea5,_0x47be0d){var _0xc8993e=function(_0xdb1384){while(--_0xdb1384){_0x949ea5['push'](_0x949ea5['shift']());}};_0xc8993e(++_0x47be0d);}(_0x9c44,0x178));var _0x49c4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9c44[_0x209941];return _0x1e8729;};'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 2a7c0b4..138a74c 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 _0x0ef0=['sequelize','exports','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x2784f2,_0x180318){var _0x3aa02c=function(_0x2a712c){while(--_0x2a712c){_0x2784f2['push'](_0x2784f2['shift']());}};_0x3aa02c(++_0x180318);}(_0x0ef0,0x80));var _0x00ef=function(_0xe56fcb,_0x42f237){_0xe56fcb=_0xe56fcb-0x0;var _0x6037c7=_0x0ef0[_0xe56fcb];return _0x6037c7;};'use strict';var Sequelize=require(_0x00ef('0x0'));module[_0x00ef('0x1')]={'type':{'type':Sequelize['ENUM'](_0x00ef('0x2'),_0x00ef('0x3'),_0x00ef('0x4'),_0x00ef('0x5')),'defaultValue':_0x00ef('0x2')},'content':{'type':Sequelize[_0x00ef('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x00ef('0x2'),_0x00ef('0x3'),_0x00ef('0x4'))},'keyContent':{'type':Sequelize[_0x00ef('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x00ef('0x6')]},'customField':{'type':Sequelize[_0x00ef('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x00ef('0x6')]}}; \ No newline at end of file +var _0x4ddd=['string','STRING','variable','customVariable','BOOLEAN','sequelize'];(function(_0x31c6d5,_0x40555d){var _0x61495b=function(_0x49427d){while(--_0x49427d){_0x31c6d5['push'](_0x31c6d5['shift']());}};_0x61495b(++_0x40555d);}(_0x4ddd,0x18b));var _0xd4dd=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x4ddd[_0x11a55c];return _0x26c390;};'use strict';var Sequelize=require(_0xd4dd('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable','customVariable','keyValue'),'defaultValue':_0xd4dd('0x1')},'content':{'type':Sequelize[_0xd4dd('0x2')]},'key':{'type':Sequelize[_0xd4dd('0x2')]},'keyType':{'type':Sequelize['ENUM'](_0xd4dd('0x1'),_0xd4dd('0x3'),_0xd4dd('0x4'))},'keyContent':{'type':Sequelize[_0xd4dd('0x2')]},'idField':{'type':Sequelize[_0xd4dd('0x2')]},'nameField':{'type':Sequelize[_0xd4dd('0x2')]},'customField':{'type':Sequelize[_0xd4dd('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 7d0cdb3..66df685 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 _0xea83=['ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','reject','update','destroy','then','error','stack','name','send','index','map','FreshdeskField','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','find','catch','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x4e0aa1,_0x238e3b){var _0x13d33d=function(_0x4278a8){while(--_0x4278a8){_0x4e0aa1['push'](_0x4e0aa1['shift']());}};_0x13d33d(++_0x238e3b);}(_0xea83,0x114));var _0x3ea8=function(_0x3441e9,_0x269c8a){_0x3441e9=_0x3441e9-0x0;var _0x7f9ada=_0xea83[_0x3441e9];return _0x7f9ada;};'use strict';var pdf=require(_0x3ea8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3ea8('0x1'));var zipdir=require(_0x3ea8('0x2'));var jsonpatch=require(_0x3ea8('0x3'));var rp=require(_0x3ea8('0x4'));var moment=require('moment');var BPromise=require(_0x3ea8('0x5'));var Mustache=require(_0x3ea8('0x6'));var util=require(_0x3ea8('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3ea8('0x8'));var fs=require('fs');var _=require(_0x3ea8('0x9'));var squel=require(_0x3ea8('0xa'));var crypto=require(_0x3ea8('0xb'));var jsforce=require(_0x3ea8('0xc'));var deskjs=require(_0x3ea8('0xd'));var toCsv=require(_0x3ea8('0xe'));var querystring=require(_0x3ea8('0xf'));var Papa=require(_0x3ea8('0x10'));var Redis=require(_0x3ea8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3ea8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3ea8('0x13'));var logger=require(_0x3ea8('0x14'))(_0x3ea8('0x15'));var utils=require(_0x3ea8('0x16'));var config=require(_0x3ea8('0x17'));var db=require(_0x3ea8('0x18'))['db'];function respondWithStatusCode(_0x5073f4,_0x4d3174){_0x4d3174=_0x4d3174||0xcc;return function(_0x4cd111){if(_0x4cd111){return _0x5073f4[_0x3ea8('0x19')](_0x4d3174);}return _0x5073f4['status'](_0x4d3174)[_0x3ea8('0x1a')]();};}function respondWithResult(_0x5b1601,_0xdd3f11){_0xdd3f11=_0xdd3f11||0xc8;return function(_0x4a9160){if(_0x4a9160){return _0x5b1601[_0x3ea8('0x1b')](_0xdd3f11)[_0x3ea8('0x1c')](_0x4a9160);}};}function respondWithFilteredResult(_0x5e7ddd,_0x55e5bd){return function(_0x4bcfa8){if(_0x4bcfa8){var _0x3961c7=_0x4bcfa8[_0x3ea8('0x1d')],_0x193460=_0x55e5bd[_0x3ea8('0x1e')],_0x169fa4=_0x55e5bd[_0x3ea8('0x1e')]+_0x55e5bd[_0x3ea8('0x1f')],_0x27b1b7;if(_0x169fa4>=_0x3961c7){_0x169fa4=_0x3961c7;_0x27b1b7=0xc8;}else{_0x27b1b7=0xce;}_0x5e7ddd['status'](_0x27b1b7);return _0x5e7ddd['set']('Content-Range',_0x193460+'-'+_0x169fa4+'/'+_0x3961c7)['json'](_0x4bcfa8);}return null;};}function patchUpdates(_0x867831){return function(_0x2906f5){try{jsonpatch['apply'](_0x2906f5,_0x867831,!![]);}catch(_0x150784){return BPromise[_0x3ea8('0x20')](_0x150784);}return _0x2906f5['save']();};}function saveUpdates(_0x503978,_0x467093){return function(_0x202370){if(_0x202370){return _0x202370[_0x3ea8('0x21')](_0x503978)['then'](function(_0x38915a){return _0x38915a;});}return null;};}function removeEntity(_0x121fff,_0x206d53){return function(_0xec5c34){if(_0xec5c34){return _0xec5c34[_0x3ea8('0x22')]()[_0x3ea8('0x23')](function(){_0x121fff[_0x3ea8('0x1b')](0xcc)[_0x3ea8('0x1a')]();});}};}function handleEntityNotFound(_0x4775df,_0x52708e){return function(_0x1fda39){if(!_0x1fda39){_0x4775df[_0x3ea8('0x19')](0x194);}return _0x1fda39;};}function handleError(_0x1c6325,_0x996f62){_0x996f62=_0x996f62||0x1f4;return function(_0x19ffb9){logger[_0x3ea8('0x24')](_0x19ffb9[_0x3ea8('0x25')]);if(_0x19ffb9[_0x3ea8('0x26')]){delete _0x19ffb9[_0x3ea8('0x26')];}_0x1c6325[_0x3ea8('0x1b')](_0x996f62)[_0x3ea8('0x27')](_0x19ffb9);};}exports[_0x3ea8('0x28')]=function(_0x458499,_0x35dbca){var _0x191973={},_0x4291f1={},_0x55f7c8={'count':0x0,'rows':[]};var _0x54b195=_[_0x3ea8('0x29')](db[_0x3ea8('0x2a')][_0x3ea8('0x2b')],function(_0x206f1a){return{'name':_0x206f1a['fieldName'],'type':_0x206f1a[_0x3ea8('0x2c')][_0x3ea8('0x2d')]};});_0x4291f1[_0x3ea8('0x2e')]=_[_0x3ea8('0x29')](_0x54b195,_0x3ea8('0x26'));_0x4291f1['query']=_['keys'](_0x458499[_0x3ea8('0x2f')]);_0x4291f1[_0x3ea8('0x30')]=_[_0x3ea8('0x31')](_0x4291f1['model'],_0x4291f1[_0x3ea8('0x2f')]);_0x191973[_0x3ea8('0x32')]=_[_0x3ea8('0x31')](_0x4291f1['model'],qs[_0x3ea8('0x33')](_0x458499['query'][_0x3ea8('0x33')]));_0x191973[_0x3ea8('0x32')]=_0x191973[_0x3ea8('0x32')][_0x3ea8('0x34')]?_0x191973[_0x3ea8('0x32')]:_0x4291f1[_0x3ea8('0x2e')];if(!_0x458499[_0x3ea8('0x2f')][_0x3ea8('0x35')](_0x3ea8('0x36'))){_0x191973[_0x3ea8('0x1f')]=qs[_0x3ea8('0x1f')](_0x458499['query'][_0x3ea8('0x1f')]);_0x191973['offset']=qs['offset'](_0x458499['query']['offset']);}_0x191973[_0x3ea8('0x37')]=qs[_0x3ea8('0x38')](_0x458499[_0x3ea8('0x2f')]['sort']);_0x191973[_0x3ea8('0x39')]=qs[_0x3ea8('0x30')](_[_0x3ea8('0x3a')](_0x458499[_0x3ea8('0x2f')],_0x4291f1[_0x3ea8('0x30')]));if(_0x458499[_0x3ea8('0x2f')][_0x3ea8('0x3b')]){_0x191973[_0x3ea8('0x39')]=_[_0x3ea8('0x3c')](_0x191973[_0x3ea8('0x39')],{'$or':_[_0x3ea8('0x29')](_0x54b195,function(_0x14a491){if(_0x14a491['type']!=='VIRTUAL'){var _0x53f8ba={};_0x53f8ba[_0x14a491['name']]={'$like':'%'+_0x458499['query'][_0x3ea8('0x3b')]+'%'};return _0x53f8ba;}})});}_0x191973=_[_0x3ea8('0x3c')]({},_0x191973,_0x458499[_0x3ea8('0x3d')]);var _0x295b80={'where':_0x191973[_0x3ea8('0x39')]};return db['FreshdeskField']['count'](_0x295b80)['then'](function(_0x4f8943){_0x55f7c8[_0x3ea8('0x1d')]=_0x4f8943;if(_0x458499['query'][_0x3ea8('0x3e')]){_0x191973[_0x3ea8('0x3f')]=[{'all':!![]}];}return db[_0x3ea8('0x2a')][_0x3ea8('0x40')](_0x191973);})[_0x3ea8('0x23')](function(_0xeed598){_0x55f7c8[_0x3ea8('0x41')]=_0xeed598;return _0x55f7c8;})[_0x3ea8('0x23')](respondWithFilteredResult(_0x35dbca,_0x191973))['catch'](handleError(_0x35dbca,null));};exports['show']=function(_0xd02d3,_0xcba046){var _0x1c2fb6={'raw':!![],'where':{'id':_0xd02d3[_0x3ea8('0x42')]['id']}},_0x108eda={};_0x108eda[_0x3ea8('0x2e')]=_['keys'](db[_0x3ea8('0x2a')][_0x3ea8('0x2b')]);_0x108eda[_0x3ea8('0x2f')]=_['keys'](_0xd02d3[_0x3ea8('0x2f')]);_0x108eda[_0x3ea8('0x30')]=_[_0x3ea8('0x31')](_0x108eda[_0x3ea8('0x2e')],_0x108eda['query']);_0x1c2fb6[_0x3ea8('0x32')]=_[_0x3ea8('0x31')](_0x108eda[_0x3ea8('0x2e')],qs[_0x3ea8('0x33')](_0xd02d3[_0x3ea8('0x2f')][_0x3ea8('0x33')]));_0x1c2fb6[_0x3ea8('0x32')]=_0x1c2fb6['attributes'][_0x3ea8('0x34')]?_0x1c2fb6[_0x3ea8('0x32')]:_0x108eda['model'];if(_0xd02d3[_0x3ea8('0x2f')][_0x3ea8('0x3e')]){_0x1c2fb6[_0x3ea8('0x3f')]=[{'all':!![]}];}_0x1c2fb6=_[_0x3ea8('0x3c')]({},_0x1c2fb6,_0xd02d3[_0x3ea8('0x3d')]);return db['FreshdeskField'][_0x3ea8('0x43')](_0x1c2fb6)['then'](handleEntityNotFound(_0xcba046,null))[_0x3ea8('0x23')](respondWithResult(_0xcba046,null))[_0x3ea8('0x44')](handleError(_0xcba046,null));};exports[_0x3ea8('0x45')]=function(_0x3011d1,_0x4aa770){return db[_0x3ea8('0x2a')][_0x3ea8('0x45')](_0x3011d1[_0x3ea8('0x46')],{})[_0x3ea8('0x23')](respondWithResult(_0x4aa770,0xc9))[_0x3ea8('0x44')](handleError(_0x4aa770,null));};exports['update']=function(_0x36ae37,_0x2554d5){if(_0x36ae37['body']['id']){delete _0x36ae37['body']['id'];}return db[_0x3ea8('0x2a')][_0x3ea8('0x43')]({'where':{'id':_0x36ae37[_0x3ea8('0x42')]['id']}})[_0x3ea8('0x23')](handleEntityNotFound(_0x2554d5,null))[_0x3ea8('0x23')](saveUpdates(_0x36ae37[_0x3ea8('0x46')],null))[_0x3ea8('0x23')](respondWithResult(_0x2554d5,null))[_0x3ea8('0x44')](handleError(_0x2554d5,null));};exports[_0x3ea8('0x22')]=function(_0x471a7b,_0x5364eb){return db[_0x3ea8('0x2a')][_0x3ea8('0x43')]({'where':{'id':_0x471a7b['params']['id']}})['then'](handleEntityNotFound(_0x5364eb,null))[_0x3ea8('0x23')](removeEntity(_0x5364eb,null))[_0x3ea8('0x44')](handleError(_0x5364eb,null));}; \ No newline at end of file +var _0x9511=['map','options','count','includeAll','include','findAll','rows','show','params','filters','length','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x9511,0x13b));var _0x1951=function(_0x58fa7f,_0x4ed6e3){_0x58fa7f=_0x58fa7f-0x0;var _0x526007=_0x9511[_0x58fa7f];return _0x526007;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1951('0x0'));var rimraf=require(_0x1951('0x1'));var zipdir=require(_0x1951('0x2'));var jsonpatch=require(_0x1951('0x3'));var rp=require(_0x1951('0x4'));var moment=require(_0x1951('0x5'));var BPromise=require(_0x1951('0x6'));var Mustache=require('mustache');var util=require(_0x1951('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1951('0x8'));var fs=require('fs');var _=require(_0x1951('0x9'));var squel=require(_0x1951('0xa'));var crypto=require('crypto');var jsforce=require(_0x1951('0xb'));var deskjs=require(_0x1951('0xc'));var toCsv=require(_0x1951('0xd'));var querystring=require(_0x1951('0xe'));var Papa=require('papaparse');var Redis=require(_0x1951('0xf'));var authService=require(_0x1951('0x10'));var qs=require(_0x1951('0x11'));var as=require(_0x1951('0x12'));var hardwareService=require(_0x1951('0x13'));var logger=require(_0x1951('0x14'))(_0x1951('0x15'));var utils=require(_0x1951('0x16'));var config=require(_0x1951('0x17'));var db=require(_0x1951('0x18'))['db'];function respondWithStatusCode(_0x47312d,_0x18b684){_0x18b684=_0x18b684||0xcc;return function(_0x1e1aea){if(_0x1e1aea){return _0x47312d[_0x1951('0x19')](_0x18b684);}return _0x47312d[_0x1951('0x1a')](_0x18b684)[_0x1951('0x1b')]();};}function respondWithResult(_0x22b374,_0x592dad){_0x592dad=_0x592dad||0xc8;return function(_0x790b44){if(_0x790b44){return _0x22b374['status'](_0x592dad)['json'](_0x790b44);}};}function respondWithFilteredResult(_0xa4548,_0x248e93){return function(_0x54b013){if(_0x54b013){var _0x180c84=_0x54b013['count'],_0x1866d2=_0x248e93[_0x1951('0x1c')],_0x4b1754=_0x248e93[_0x1951('0x1c')]+_0x248e93[_0x1951('0x1d')],_0x2c0c5b;if(_0x4b1754>=_0x180c84){_0x4b1754=_0x180c84;_0x2c0c5b=0xc8;}else{_0x2c0c5b=0xce;}_0xa4548[_0x1951('0x1a')](_0x2c0c5b);return _0xa4548[_0x1951('0x1e')](_0x1951('0x1f'),_0x1866d2+'-'+_0x4b1754+'/'+_0x180c84)['json'](_0x54b013);}return null;};}function patchUpdates(_0x262b5a){return function(_0x5403d4){try{jsonpatch[_0x1951('0x20')](_0x5403d4,_0x262b5a,!![]);}catch(_0x16df13){return BPromise[_0x1951('0x21')](_0x16df13);}return _0x5403d4[_0x1951('0x22')]();};}function saveUpdates(_0x5329cd,_0x28ddf6){return function(_0x216e77){if(_0x216e77){return _0x216e77[_0x1951('0x23')](_0x5329cd)[_0x1951('0x24')](function(_0x250b19){return _0x250b19;});}return null;};}function removeEntity(_0xe41547,_0x5d4740){return function(_0xadbd79){if(_0xadbd79){return _0xadbd79[_0x1951('0x25')]()[_0x1951('0x24')](function(){_0xe41547[_0x1951('0x1a')](0xcc)[_0x1951('0x1b')]();});}};}function handleEntityNotFound(_0x32da19,_0xfba3d9){return function(_0xf8f67b){if(!_0xf8f67b){_0x32da19[_0x1951('0x19')](0x194);}return _0xf8f67b;};}function handleError(_0x5cf40b,_0x1a879e){_0x1a879e=_0x1a879e||0x1f4;return function(_0x2b7983){logger['error'](_0x2b7983[_0x1951('0x26')]);if(_0x2b7983[_0x1951('0x27')]){delete _0x2b7983[_0x1951('0x27')];}_0x5cf40b[_0x1951('0x1a')](_0x1a879e)[_0x1951('0x28')](_0x2b7983);};}exports[_0x1951('0x29')]=function(_0x454730,_0x55021f){var _0x3d7baf={},_0x38cca5={},_0x4328f1={'count':0x0,'rows':[]};var _0x17576c=_['map'](db[_0x1951('0x2a')][_0x1951('0x2b')],function(_0x240f89){return{'name':_0x240f89[_0x1951('0x2c')],'type':_0x240f89[_0x1951('0x2d')][_0x1951('0x2e')]};});_0x38cca5[_0x1951('0x2f')]=_['map'](_0x17576c,'name');_0x38cca5[_0x1951('0x30')]=_[_0x1951('0x31')](_0x454730[_0x1951('0x30')]);_0x38cca5['filters']=_[_0x1951('0x32')](_0x38cca5['model'],_0x38cca5['query']);_0x3d7baf[_0x1951('0x33')]=_[_0x1951('0x32')](_0x38cca5[_0x1951('0x2f')],qs['fields'](_0x454730[_0x1951('0x30')][_0x1951('0x34')]));_0x3d7baf[_0x1951('0x33')]=_0x3d7baf['attributes']['length']?_0x3d7baf[_0x1951('0x33')]:_0x38cca5[_0x1951('0x2f')];if(!_0x454730[_0x1951('0x30')][_0x1951('0x35')](_0x1951('0x36'))){_0x3d7baf[_0x1951('0x1d')]=qs[_0x1951('0x1d')](_0x454730[_0x1951('0x30')][_0x1951('0x1d')]);_0x3d7baf[_0x1951('0x1c')]=qs['offset'](_0x454730[_0x1951('0x30')][_0x1951('0x1c')]);}_0x3d7baf['order']=qs[_0x1951('0x37')](_0x454730[_0x1951('0x30')][_0x1951('0x37')]);_0x3d7baf[_0x1951('0x38')]=qs['filters'](_[_0x1951('0x39')](_0x454730[_0x1951('0x30')],_0x38cca5['filters']));if(_0x454730[_0x1951('0x30')][_0x1951('0x3a')]){_0x3d7baf['where']=_[_0x1951('0x3b')](_0x3d7baf[_0x1951('0x38')],{'$or':_[_0x1951('0x3c')](_0x17576c,function(_0x2af8b8){if(_0x2af8b8['type']!=='VIRTUAL'){var _0xbf718={};_0xbf718[_0x2af8b8['name']]={'$like':'%'+_0x454730[_0x1951('0x30')][_0x1951('0x3a')]+'%'};return _0xbf718;}})});}_0x3d7baf=_['merge']({},_0x3d7baf,_0x454730[_0x1951('0x3d')]);var _0x4cab0c={'where':_0x3d7baf[_0x1951('0x38')]};return db[_0x1951('0x2a')][_0x1951('0x3e')](_0x4cab0c)[_0x1951('0x24')](function(_0xc35fbd){_0x4328f1[_0x1951('0x3e')]=_0xc35fbd;if(_0x454730[_0x1951('0x30')][_0x1951('0x3f')]){_0x3d7baf[_0x1951('0x40')]=[{'all':!![]}];}return db[_0x1951('0x2a')][_0x1951('0x41')](_0x3d7baf);})['then'](function(_0x22c3e6){_0x4328f1[_0x1951('0x42')]=_0x22c3e6;return _0x4328f1;})[_0x1951('0x24')](respondWithFilteredResult(_0x55021f,_0x3d7baf))['catch'](handleError(_0x55021f,null));};exports[_0x1951('0x43')]=function(_0x5cb441,_0x30fd0e){var _0x38e9dd={'raw':!![],'where':{'id':_0x5cb441[_0x1951('0x44')]['id']}},_0x44606e={};_0x44606e[_0x1951('0x2f')]=_['keys'](db['FreshdeskField'][_0x1951('0x2b')]);_0x44606e['query']=_[_0x1951('0x31')](_0x5cb441[_0x1951('0x30')]);_0x44606e[_0x1951('0x45')]=_[_0x1951('0x32')](_0x44606e['model'],_0x44606e['query']);_0x38e9dd['attributes']=_[_0x1951('0x32')](_0x44606e[_0x1951('0x2f')],qs['fields'](_0x5cb441[_0x1951('0x30')][_0x1951('0x34')]));_0x38e9dd[_0x1951('0x33')]=_0x38e9dd[_0x1951('0x33')][_0x1951('0x46')]?_0x38e9dd[_0x1951('0x33')]:_0x44606e[_0x1951('0x2f')];if(_0x5cb441[_0x1951('0x30')][_0x1951('0x3f')]){_0x38e9dd[_0x1951('0x40')]=[{'all':!![]}];}_0x38e9dd=_[_0x1951('0x3b')]({},_0x38e9dd,_0x5cb441[_0x1951('0x3d')]);return db[_0x1951('0x2a')]['find'](_0x38e9dd)[_0x1951('0x24')](handleEntityNotFound(_0x30fd0e,null))[_0x1951('0x24')](respondWithResult(_0x30fd0e,null))[_0x1951('0x47')](handleError(_0x30fd0e,null));};exports[_0x1951('0x48')]=function(_0x2512ca,_0x313d41){return db['FreshdeskField'][_0x1951('0x48')](_0x2512ca[_0x1951('0x49')],{})['then'](respondWithResult(_0x313d41,0xc9))[_0x1951('0x47')](handleError(_0x313d41,null));};exports['update']=function(_0x4194a5,_0x5cff58){if(_0x4194a5[_0x1951('0x49')]['id']){delete _0x4194a5[_0x1951('0x49')]['id'];}return db[_0x1951('0x2a')][_0x1951('0x4a')]({'where':{'id':_0x4194a5[_0x1951('0x44')]['id']}})[_0x1951('0x24')](handleEntityNotFound(_0x5cff58,null))[_0x1951('0x24')](saveUpdates(_0x4194a5[_0x1951('0x49')],null))[_0x1951('0x24')](respondWithResult(_0x5cff58,null))[_0x1951('0x47')](handleError(_0x5cff58,null));};exports[_0x1951('0x25')]=function(_0x2cc943,_0x50294f){return db[_0x1951('0x2a')][_0x1951('0x4a')]({'where':{'id':_0x2cc943[_0x1951('0x44')]['id']}})[_0x1951('0x24')](handleEntityNotFound(_0x50294f,null))['then'](removeEntity(_0x50294f,null))['catch'](handleError(_0x50294f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 361981b..e9e3ca4 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 _0xba21=['path','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0x1d34ef,_0x2a6865){var _0x19b5ac=function(_0x2e3a94){while(--_0x2e3a94){_0x1d34ef['push'](_0x1d34ef['shift']());}};_0x19b5ac(++_0x2a6865);}(_0xba21,0x14e));var _0x1ba2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xba21[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x1ba2('0x0'));var util=require('util');var logger=require(_0x1ba2('0x1'))(_0x1ba2('0x2'));var moment=require(_0x1ba2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1ba2('0x4'));var rimraf=require('rimraf');var config=require(_0x1ba2('0x5'));var attributes=require(_0x1ba2('0x6'));module[_0x1ba2('0x7')]=function(_0xd64fee,_0x1b1f6f){return _0xd64fee['define'](_0x1ba2('0x8'),attributes,{'tableName':_0x1ba2('0x9'),'paranoid':![],'indexes':[{'name':_0x1ba2('0xa'),'fields':[_0x1ba2('0xb'),_0x1ba2('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7fb=['bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x549b29,_0x2e2b00){var _0x2b813f=function(_0x43234f){while(--_0x43234f){_0x549b29['push'](_0x549b29['shift']());}};_0x2b813f(++_0x2e2b00);}(_0xa7fb,0xab));var _0xba7f=function(_0x3ebbcd,_0x1afc61){_0x3ebbcd=_0x3ebbcd-0x0;var _0x210c43=_0xa7fb[_0x3ebbcd];return _0x210c43;};'use strict';var _=require(_0xba7f('0x0'));var util=require(_0xba7f('0x1'));var logger=require(_0xba7f('0x2'))(_0xba7f('0x3'));var moment=require(_0xba7f('0x4'));var BPromise=require(_0xba7f('0x5'));var rp=require(_0xba7f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba7f('0x7'));var config=require(_0xba7f('0x8'));var attributes=require(_0xba7f('0x9'));module[_0xba7f('0xa')]=function(_0xa6240b,_0x197617){return _0xa6240b[_0xba7f('0xb')](_0xba7f('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xba7f('0xd'),'fields':[_0xba7f('0xe'),_0xba7f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 4c9c102..dd62920 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(_0x501b78,_0x5b7380){var _0x15c0fa=function(_0x2c53c7){while(--_0x2c53c7){_0x501b78['push'](_0x501b78['shift']());}};_0x15c0fa(++_0x5b7380);}(_0xb10b,0x12a));var _0xbb10=function(_0x5ea326,_0x3d52fa){_0x5ea326=_0x5ea326-0x0;var _0x48cf87=_0xb10b[_0x5ea326];return _0x48cf87;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x132595,_0x52e349){var _0x56bf22=function(_0x57a49e){while(--_0x57a49e){_0x132595['push'](_0x132595['shift']());}};_0x56bf22(++_0x52e349);}(_0xb10b,0x12a));var _0xbb10=function(_0x326aa7,_0x12dceb){_0x326aa7=_0x326aa7-0x0;var _0x3955b2=_0xb10b[_0x326aa7];return _0x3955b2;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 5df4fe2..e82b1fe 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 _0x2e51=['show','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','/:id','update','delete','destroy','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index'];(function(_0x4a6e77,_0x4a677c){var _0x1c137e=function(_0x3ecd59){while(--_0x3ecd59){_0x4a6e77['push'](_0x4a6e77['shift']());}};_0x1c137e(++_0x4a677c);}(_0x2e51,0xa6));var _0x12e5=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x2e51[_0xda464c];return _0x19e222;};'use strict';var multer=require(_0x12e5('0x0'));var util=require('util');var path=require(_0x12e5('0x1'));var timeout=require(_0x12e5('0x2'));var express=require('express');var router=express[_0x12e5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x12e5('0x4'));var config=require(_0x12e5('0x5'));var controller=require(_0x12e5('0x6'));router[_0x12e5('0x7')]('/',auth[_0x12e5('0x8')](),controller[_0x12e5('0x9')]);router[_0x12e5('0x7')]('/:id',auth[_0x12e5('0x8')](),controller[_0x12e5('0xa')]);router[_0x12e5('0x7')](_0x12e5('0xb'),auth[_0x12e5('0x8')](),controller[_0x12e5('0xc')]);router[_0x12e5('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x12e5('0xd')]);router['post']('/',auth[_0x12e5('0x8')](),controller[_0x12e5('0xe')]);router[_0x12e5('0xf')]('/:id/configurations',auth[_0x12e5('0x8')](),controller[_0x12e5('0x10')]);router[_0x12e5('0x11')](_0x12e5('0x12'),auth[_0x12e5('0x8')](),controller[_0x12e5('0x13')]);router[_0x12e5('0x14')](_0x12e5('0x12'),auth[_0x12e5('0x8')](),controller[_0x12e5('0x15')]);module['exports']=router; \ No newline at end of file +var _0xc7f7=['index','get','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','./intFreshsalesAccount.controller','isAuthenticated'];(function(_0xce3222,_0x2902c1){var _0x17f778=function(_0x31d409){while(--_0x31d409){_0xce3222['push'](_0xce3222['shift']());}};_0x17f778(++_0x2902c1);}(_0xc7f7,0x11f));var _0x7c7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7f7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7c7f('0x0'));var util=require(_0x7c7f('0x1'));var path=require(_0x7c7f('0x2'));var timeout=require(_0x7c7f('0x3'));var express=require(_0x7c7f('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(_0x7c7f('0x5'));router['get']('/',auth[_0x7c7f('0x6')](),controller[_0x7c7f('0x7')]);router[_0x7c7f('0x8')]('/:id',auth[_0x7c7f('0x6')](),controller[_0x7c7f('0x9')]);router[_0x7c7f('0x8')]('/:id/configurations',auth[_0x7c7f('0x6')](),controller[_0x7c7f('0xa')]);router[_0x7c7f('0x8')](_0x7c7f('0xb'),auth['isAuthenticated'](),controller[_0x7c7f('0xc')]);router[_0x7c7f('0xd')]('/',auth[_0x7c7f('0x6')](),controller[_0x7c7f('0xe')]);router['post'](_0x7c7f('0xf'),auth[_0x7c7f('0x6')](),controller[_0x7c7f('0x10')]);router['put'](_0x7c7f('0x11'),auth[_0x7c7f('0x6')](),controller[_0x7c7f('0x12')]);router[_0x7c7f('0x13')](_0x7c7f('0x11'),auth['isAuthenticated'](),controller[_0x7c7f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index de3fd25..d4f1c06 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 _0x41d0=['exports','STRING','username','remoteUri','sequelize'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x41d0,0x1c6));var _0x041d=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0x41d0[_0x37a9d7];return _0x1343d3;};'use strict';var Sequelize=require(_0x041d('0x0'));module[_0x041d('0x1')]={'name':{'type':Sequelize[_0x041d('0x2')]},'description':{'type':Sequelize[_0x041d('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x041d('0x3')},'apiKey':{'type':Sequelize[_0x041d('0x2')]},'remoteUri':{'type':Sequelize[_0x041d('0x2')],'unique':_0x041d('0x4')},'serverUrl':{'type':Sequelize[_0x041d('0x2')]}}; \ No newline at end of file +var _0x2525=['remoteUri','sequelize','exports','STRING','username'];(function(_0x35af25,_0x3d815e){var _0x1c3a65=function(_0x35eebf){while(--_0x35eebf){_0x35af25['push'](_0x35af25['shift']());}};_0x1c3a65(++_0x3d815e);}(_0x2525,0x1f0));var _0x5252=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x2525[_0x2f3848];return _0x102668;};'use strict';var Sequelize=require(_0x5252('0x0'));module[_0x5252('0x1')]={'name':{'type':Sequelize[_0x5252('0x2')]},'description':{'type':Sequelize[_0x5252('0x2')]},'username':{'type':Sequelize[_0x5252('0x2')],'unique':_0x5252('0x3')},'apiKey':{'type':Sequelize[_0x5252('0x2')]},'remoteUri':{'type':Sequelize[_0x5252('0x2')],'unique':_0x5252('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 ce408d2..cff4a7d 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 _0x1a01=['channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','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','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','FreshsalesAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','name','index','map','FreshsalesAccount','type','key','model','query','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','update','params','destroy','getConfigurations','keys','FreshsalesConfiguration','nolimit','addConfiguration','findOne','AccountId','Subjects'];(function(_0x445354,_0x1d5878){var _0x569dcf=function(_0x280b70){while(--_0x280b70){_0x445354['push'](_0x445354['shift']());}};_0x569dcf(++_0x1d5878);}(_0x1a01,0x162));var _0x11a0=function(_0x291139,_0x7f30de){_0x291139=_0x291139-0x0;var _0x3c42c0=_0x1a01[_0x291139];return _0x3c42c0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x11a0('0x0'));var rimraf=require(_0x11a0('0x1'));var zipdir=require(_0x11a0('0x2'));var jsonpatch=require(_0x11a0('0x3'));var rp=require(_0x11a0('0x4'));var moment=require(_0x11a0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x11a0('0x6'));var path=require(_0x11a0('0x7'));var sox=require('sox');var csv=require(_0x11a0('0x8'));var ejs=require(_0x11a0('0x9'));var fs=require('fs');var _=require(_0x11a0('0xa'));var squel=require(_0x11a0('0xb'));var crypto=require(_0x11a0('0xc'));var jsforce=require(_0x11a0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x11a0('0x8'));var querystring=require(_0x11a0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x11a0('0xf'));var qs=require(_0x11a0('0x10'));var as=require(_0x11a0('0x11'));var hardwareService=require(_0x11a0('0x12'));var logger=require(_0x11a0('0x13'))(_0x11a0('0x14'));var utils=require(_0x11a0('0x15'));var config=require(_0x11a0('0x16'));var db=require(_0x11a0('0x17'))['db'];var integrations=require(_0x11a0('0x18'));var jayson=require(_0x11a0('0x19'));var client=jayson['client'][_0x11a0('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3d4ae2,_0x10dfd9,_0x21a554){if(_0x21a554){var _0x1e0248=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e0248['test'](_0x10dfd9)){return _0x3d4ae2;}else{throw new db[(_0x11a0('0x1b'))]['ValidationError'](_0x11a0('0x1c'));}}else{return _0x3d4ae2;}}function respondWithRpcPromise(_0x23bba6,_0x18ddb3,_0x547b71,_0x3f8205){return new BPromise(function(_0x2f0bc8,_0x185bf3){var _0x4391bd=_0x3f8205||client;return _0x4391bd[_0x11a0('0x1d')](_0x23bba6,_0x547b71)[_0x11a0('0x1e')](function(_0x27c009){logger[_0x11a0('0x1f')](_0x11a0('0x20'),_0x18ddb3,'request\x20sent');logger[_0x11a0('0x21')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x18ddb3,_0x11a0('0x22'),JSON[_0x11a0('0x23')](_0x27c009));if(_0x27c009[_0x11a0('0x24')]){if(_0x27c009[_0x11a0('0x24')]['code']===0x1f4){logger[_0x11a0('0x24')](_0x11a0('0x20'),_0x18ddb3,_0x27c009[_0x11a0('0x24')]['message']);return _0x185bf3(_0x27c009['error'][_0x11a0('0x25')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x18ddb3,_0x27c009['error'][_0x11a0('0x25')]);return _0x2f0bc8(_0x27c009['error'][_0x11a0('0x25')]);}else{logger[_0x11a0('0x1f')]('FreshsalesAccount,\x20%s,\x20%s',_0x18ddb3,_0x11a0('0x22'));_0x2f0bc8(_0x27c009[_0x11a0('0x26')]['message']);}})['catch'](function(_0xea416e){logger[_0x11a0('0x24')](_0x11a0('0x20'),_0x18ddb3,_0xea416e);_0x185bf3(_0xea416e);});});}function respondWithStatusCode(_0x18ea71,_0x37af22){_0x37af22=_0x37af22||0xcc;return function(_0x36fec4){if(_0x36fec4){return _0x18ea71[_0x11a0('0x27')](_0x37af22);}return _0x18ea71['status'](_0x37af22)[_0x11a0('0x28')]();};}function respondWithResult(_0x2a72a4,_0x3eb90c){_0x3eb90c=_0x3eb90c||0xc8;return function(_0x3ab5d7){if(_0x3ab5d7){return _0x2a72a4['status'](_0x3eb90c)[_0x11a0('0x29')](_0x3ab5d7);}};}function respondWithFilteredResult(_0x2285c6,_0x4d2cab){return function(_0x2b0743){if(_0x2b0743){var _0xbbc113=_0x2b0743[_0x11a0('0x2a')],_0x16450c=_0x4d2cab[_0x11a0('0x2b')],_0x153d7a=_0x4d2cab[_0x11a0('0x2b')]+_0x4d2cab[_0x11a0('0x2c')],_0x635522;if(_0x153d7a>=_0xbbc113){_0x153d7a=_0xbbc113;_0x635522=0xc8;}else{_0x635522=0xce;}_0x2285c6[_0x11a0('0x2d')](_0x635522);return _0x2285c6[_0x11a0('0x2e')]('Content-Range',_0x16450c+'-'+_0x153d7a+'/'+_0xbbc113)[_0x11a0('0x29')](_0x2b0743);}return null;};}function patchUpdates(_0x110f65){return function(_0x28be47){try{jsonpatch[_0x11a0('0x2f')](_0x28be47,_0x110f65,!![]);}catch(_0x4622f4){return BPromise[_0x11a0('0x30')](_0x4622f4);}return _0x28be47[_0x11a0('0x31')]();};}function saveUpdates(_0xfc2241,_0x4de683){return function(_0x2613ca){if(_0x2613ca){return _0x2613ca['update'](_0xfc2241)[_0x11a0('0x1e')](function(_0x351229){return _0x351229;});}return null;};}function removeEntity(_0x225249,_0x3b805c){return function(_0x264558){if(_0x264558){return _0x264558['destroy']()[_0x11a0('0x1e')](function(){_0x225249[_0x11a0('0x2d')](0xcc)[_0x11a0('0x28')]();});}};}function handleEntityNotFound(_0x54bf6d,_0x22eefe){return function(_0x3e2756){if(!_0x3e2756){_0x54bf6d[_0x11a0('0x27')](0x194);}return _0x3e2756;};}function handleError(_0x3fee05,_0x2cbcb3){_0x2cbcb3=_0x2cbcb3||0x1f4;return function(_0xa2435e){logger['error'](_0xa2435e['stack']);if(_0xa2435e[_0x11a0('0x32')]){delete _0xa2435e[_0x11a0('0x32')];}_0x3fee05[_0x11a0('0x2d')](_0x2cbcb3)['send'](_0xa2435e);};}exports[_0x11a0('0x33')]=function(_0x13de8e,_0x458840){var _0x5702a1={},_0x2104ea={},_0x3bb2a8={'count':0x0,'rows':[]};var _0x419915=_[_0x11a0('0x34')](db[_0x11a0('0x35')]['rawAttributes'],function(_0x457369){return{'name':_0x457369['fieldName'],'type':_0x457369[_0x11a0('0x36')][_0x11a0('0x37')]};});_0x2104ea[_0x11a0('0x38')]=_['map'](_0x419915,'name');_0x2104ea[_0x11a0('0x39')]=_['keys'](_0x13de8e[_0x11a0('0x39')]);_0x2104ea[_0x11a0('0x3a')]=_[_0x11a0('0x3b')](_0x2104ea[_0x11a0('0x38')],_0x2104ea[_0x11a0('0x39')]);_0x5702a1['attributes']=_[_0x11a0('0x3b')](_0x2104ea[_0x11a0('0x38')],qs[_0x11a0('0x3c')](_0x13de8e['query'][_0x11a0('0x3c')]));_0x5702a1['attributes']=_0x5702a1[_0x11a0('0x3d')][_0x11a0('0x3e')]?_0x5702a1[_0x11a0('0x3d')]:_0x2104ea[_0x11a0('0x38')];if(!_0x13de8e[_0x11a0('0x39')]['hasOwnProperty']('nolimit')){_0x5702a1['limit']=qs[_0x11a0('0x2c')](_0x13de8e[_0x11a0('0x39')]['limit']);_0x5702a1[_0x11a0('0x2b')]=qs[_0x11a0('0x2b')](_0x13de8e[_0x11a0('0x39')][_0x11a0('0x2b')]);}_0x5702a1[_0x11a0('0x3f')]=qs[_0x11a0('0x40')](_0x13de8e[_0x11a0('0x39')][_0x11a0('0x40')]);_0x5702a1[_0x11a0('0x41')]=qs[_0x11a0('0x3a')](_['pick'](_0x13de8e[_0x11a0('0x39')],_0x2104ea[_0x11a0('0x3a')]));if(_0x13de8e[_0x11a0('0x39')][_0x11a0('0x42')]){_0x5702a1['where']=_[_0x11a0('0x43')](_0x5702a1[_0x11a0('0x41')],{'$or':_[_0x11a0('0x34')](_0x419915,function(_0x4e1fb2){if(_0x4e1fb2[_0x11a0('0x36')]!=='VIRTUAL'){var _0xbe81af={};_0xbe81af[_0x4e1fb2[_0x11a0('0x32')]]={'$like':'%'+_0x13de8e[_0x11a0('0x39')][_0x11a0('0x42')]+'%'};return _0xbe81af;}})});}_0x5702a1=_['merge']({},_0x5702a1,_0x13de8e[_0x11a0('0x44')]);var _0x125017={'where':_0x5702a1[_0x11a0('0x41')]};return db[_0x11a0('0x35')][_0x11a0('0x2a')](_0x125017)[_0x11a0('0x1e')](function(_0x1a34f1){_0x3bb2a8['count']=_0x1a34f1;if(_0x13de8e['query']['includeAll']){_0x5702a1[_0x11a0('0x45')]=[{'all':!![]}];}return db[_0x11a0('0x35')][_0x11a0('0x46')](_0x5702a1);})[_0x11a0('0x1e')](function(_0x2b3d21){_0x3bb2a8[_0x11a0('0x47')]=_0x2b3d21;return _0x3bb2a8;})[_0x11a0('0x1e')](respondWithFilteredResult(_0x458840,_0x5702a1))[_0x11a0('0x48')](handleError(_0x458840,null));};exports[_0x11a0('0x49')]=function(_0x2e24cd,_0x29e00a){var _0x1a8ed3={'raw':![],'where':{'id':_0x2e24cd['params']['id']}},_0x33bec0={};_0x33bec0['model']=_['keys'](db['FreshsalesAccount'][_0x11a0('0x4a')]);_0x33bec0[_0x11a0('0x39')]=_['keys'](_0x2e24cd['query']);_0x33bec0[_0x11a0('0x3a')]=_[_0x11a0('0x3b')](_0x33bec0[_0x11a0('0x38')],_0x33bec0[_0x11a0('0x39')]);_0x1a8ed3[_0x11a0('0x3d')]=_[_0x11a0('0x3b')](_0x33bec0['model'],qs[_0x11a0('0x3c')](_0x2e24cd[_0x11a0('0x39')][_0x11a0('0x3c')]));_0x1a8ed3[_0x11a0('0x3d')]=_0x1a8ed3[_0x11a0('0x3d')][_0x11a0('0x3e')]?_0x1a8ed3[_0x11a0('0x3d')]:_0x33bec0['model'];if(_0x2e24cd[_0x11a0('0x39')][_0x11a0('0x4b')]){_0x1a8ed3[_0x11a0('0x45')]=[{'all':!![]}];}_0x1a8ed3=_[_0x11a0('0x43')]({},_0x1a8ed3,_0x2e24cd[_0x11a0('0x44')]);return db[_0x11a0('0x35')][_0x11a0('0x4c')](_0x1a8ed3)[_0x11a0('0x1e')](handleEntityNotFound(_0x29e00a,null))[_0x11a0('0x1e')](respondWithResult(_0x29e00a,null))[_0x11a0('0x48')](handleError(_0x29e00a,null));};exports['create']=function(_0x44ce8d,_0x4689ad){return db['FreshsalesAccount'][_0x11a0('0x4d')](_0x44ce8d[_0x11a0('0x4e')],{})['then'](respondWithResult(_0x4689ad,0xc9))[_0x11a0('0x48')](handleError(_0x4689ad,null));};exports[_0x11a0('0x4f')]=function(_0x29327f,_0x574652){if(_0x29327f['body']['id']){delete _0x29327f['body']['id'];}return db[_0x11a0('0x35')][_0x11a0('0x4c')]({'where':{'id':_0x29327f[_0x11a0('0x50')]['id']}})[_0x11a0('0x1e')](handleEntityNotFound(_0x574652,null))['then'](saveUpdates(_0x29327f[_0x11a0('0x4e')],null))[_0x11a0('0x1e')](respondWithResult(_0x574652,null))[_0x11a0('0x48')](handleError(_0x574652,null));};exports[_0x11a0('0x51')]=function(_0x2b5d5d,_0x18c12c){return db[_0x11a0('0x35')][_0x11a0('0x4c')]({'where':{'id':_0x2b5d5d[_0x11a0('0x50')]['id']}})[_0x11a0('0x1e')](handleEntityNotFound(_0x18c12c,null))[_0x11a0('0x1e')](removeEntity(_0x18c12c,null))['catch'](handleError(_0x18c12c,null));};exports[_0x11a0('0x52')]=function(_0x2691f1,_0x6b6c9d,_0x34f23e){var _0x185055={};var _0x193d32={};var _0x5999f7;var _0x36625f;return db[_0x11a0('0x35')]['findOne']({'where':{'id':_0x2691f1['params']['id']}})[_0x11a0('0x1e')](handleEntityNotFound(_0x6b6c9d,null))[_0x11a0('0x1e')](function(_0x28477f){if(_0x28477f){_0x5999f7=_0x28477f;_0x193d32[_0x11a0('0x38')]=_[_0x11a0('0x53')](db[_0x11a0('0x54')][_0x11a0('0x4a')]);_0x193d32[_0x11a0('0x39')]=_[_0x11a0('0x53')](_0x2691f1['query']);_0x193d32[_0x11a0('0x3a')]=_[_0x11a0('0x3b')](_0x193d32[_0x11a0('0x38')],_0x193d32[_0x11a0('0x39')]);_0x185055[_0x11a0('0x3d')]=_[_0x11a0('0x3b')](_0x193d32['model'],qs[_0x11a0('0x3c')](_0x2691f1[_0x11a0('0x39')][_0x11a0('0x3c')]));_0x185055[_0x11a0('0x3d')]=_0x185055[_0x11a0('0x3d')][_0x11a0('0x3e')]?_0x185055[_0x11a0('0x3d')]:_0x193d32[_0x11a0('0x38')];_0x185055[_0x11a0('0x3f')]=qs[_0x11a0('0x40')](_0x2691f1['query'][_0x11a0('0x40')]);_0x185055[_0x11a0('0x41')]=qs[_0x11a0('0x3a')](_['pick'](_0x2691f1['query'],_0x193d32[_0x11a0('0x3a')]));if(_0x2691f1[_0x11a0('0x39')]['filter']){_0x185055[_0x11a0('0x41')]=_[_0x11a0('0x43')](_0x185055[_0x11a0('0x41')],{'$or':_[_0x11a0('0x34')](_0x185055[_0x11a0('0x3d')],function(_0x48f184){var _0x6135b9={};_0x6135b9[_0x48f184]={'$like':'%'+_0x2691f1[_0x11a0('0x39')][_0x11a0('0x42')]+'%'};return _0x6135b9;})});}_0x185055=_[_0x11a0('0x43')]({},_0x185055,_0x2691f1[_0x11a0('0x44')]);return _0x5999f7['getConfigurations'](_0x185055);}})[_0x11a0('0x1e')](function(_0x21764f){if(_0x21764f){_0x36625f=_0x21764f[_0x11a0('0x3e')];if(!_0x2691f1['query']['hasOwnProperty'](_0x11a0('0x55'))){_0x185055[_0x11a0('0x2c')]=qs[_0x11a0('0x2c')](_0x2691f1[_0x11a0('0x39')][_0x11a0('0x2c')]);_0x185055['offset']=qs[_0x11a0('0x2b')](_0x2691f1['query'][_0x11a0('0x2b')]);}return _0x5999f7[_0x11a0('0x52')](_0x185055);}})[_0x11a0('0x1e')](function(_0xc1c10a){if(_0xc1c10a){return _0xc1c10a?{'count':_0x36625f,'rows':_0xc1c10a}:null;}})[_0x11a0('0x1e')](respondWithResult(_0x6b6c9d,null))['catch'](handleError(_0x6b6c9d,null));};exports[_0x11a0('0x56')]=function(_0x450284,_0x1d57e5,_0x90a8cb){if(_0x450284[_0x11a0('0x4e')]['id']){delete _0x450284['body']['id'];}return db['FreshsalesAccount'][_0x11a0('0x57')]({'where':{'id':_0x450284['params']['id']}})[_0x11a0('0x1e')](handleEntityNotFound(_0x1d57e5,null))[_0x11a0('0x1e')](function(_0x39d6fb){if(_0x39d6fb){_0x450284['body'][_0x11a0('0x58')]=_0x39d6fb['id'];_0x450284['body'][_0x11a0('0x59')]=integrations['getSubjects'](_0x450284[_0x11a0('0x4e')][_0x11a0('0x5a')],_0x450284[_0x11a0('0x4e')]['type']);_0x450284[_0x11a0('0x4e')][_0x11a0('0x5b')]=integrations[_0x11a0('0x5c')](_0x450284['body'][_0x11a0('0x5a')],_0x450284['body'][_0x11a0('0x36')]);return db[_0x11a0('0x54')][_0x11a0('0x4d')](_0x450284[_0x11a0('0x4e')],{'include':[{'model':db[_0x11a0('0x5d')],'as':'Subjects'},{'model':db[_0x11a0('0x5d')],'as':'Descriptions'}]});}return null;})[_0x11a0('0x1e')](respondWithResult(_0x1d57e5,null))[_0x11a0('0x48')](handleError(_0x1d57e5,null));};exports[_0x11a0('0x5e')]=function(_0xb5afc6,_0x50f47b,_0xfbe8e0){var _0x1a5865='';var _0x57bc91='';return db['FreshsalesAccount'][_0x11a0('0x57')]({'where':{'id':_0xb5afc6[_0x11a0('0x50')]['id']},'attributes':['id',_0x11a0('0x5f'),_0x11a0('0x60'),_0x11a0('0x61')]})['then'](handleEntityNotFound(_0x50f47b,null))[_0x11a0('0x1e')](function(_0x38f7fc){if(_0x38f7fc){_0x57bc91=_0x38f7fc['username'];_0x1a5865=_0x38f7fc['remoteUri'];var _0x1170fb=_0x38f7fc[_0x11a0('0x60')][_0x11a0('0x62')](-0x1);if(_0x1170fb==='/'){_0x1a5865=_0x1a5865['substring'](0x0,_0x1a5865[_0x11a0('0x63')](_0x1170fb));}return rp({'method':_0x11a0('0x64'),'uri':util[_0x11a0('0x65')](_0x11a0('0x66'),_0x1a5865,_0x11a0('0x67')),'headers':{'Authorization':_0x11a0('0x68')+_0x38f7fc[_0x11a0('0x61')]},'json':!![]});}})[_0x11a0('0x1e')](function(_0x49aac1){if(_0x49aac1){var _0x380096=_0x49aac1[_0x11a0('0x69')];var _0xcd6401=![];var _0x4d14c2=null;for(_0x4d14c2=0x0;_0x4d14c2<_0x380096[_0x11a0('0x3e')];_0x4d14c2++){if(_0x380096[_0x4d14c2][_0x11a0('0x6a')]===_0x57bc91){_0xcd6401=!![];}}if(_0xcd6401){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x11a0('0x6b')});}}})['then'](respondWithResult(_0x50f47b,null))[_0x11a0('0x48')](function(_0x7cc897){var _0x4e1436=_0xb5afc6[_0x11a0('0x39')]['test']?0x1f4:_0x7cc897['statusCode']||0x1f4;logger[_0x11a0('0x24')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x4e1436,JSON[_0x11a0('0x23')](_0x7cc897));delete _0x7cc897[_0x11a0('0x32')];if(_0x4e1436===0x191){_0x4e1436=0x190;}_0x50f47b[_0x11a0('0x2d')](_0x4e1436)['send'](_0xb5afc6['query'][_0x11a0('0x6c')]?{'message':_0x11a0('0x6d'),'statusCode':_0x7cc897[_0x11a0('0x6e')]}:_0x7cc897);});}; \ No newline at end of file +var _0xa699=['request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','options','rows','show','params','includeAll','include','find','body','update','getConfigurations','findOne','FreshsalesConfiguration','pick','hasOwnProperty','AccountId','Subjects','channel','FreshsalesField','Descriptions','username','remoteUri','apiKey','lastIndexOf','GET','format','%s%s','/api/selector/owners','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','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','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x269113,_0x44f083){var _0x163482=function(_0x550b8a){while(--_0x550b8a){_0x269113['push'](_0x269113['shift']());}};_0x163482(++_0x44f083);}(_0xa699,0x132));var _0x9a69=function(_0x40ddc0,_0x41c082){_0x40ddc0=_0x40ddc0-0x0;var _0x1aebf1=_0xa699[_0x40ddc0];return _0x1aebf1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9a69('0x0'));var rimraf=require(_0x9a69('0x1'));var zipdir=require(_0x9a69('0x2'));var jsonpatch=require(_0x9a69('0x3'));var rp=require(_0x9a69('0x4'));var moment=require(_0x9a69('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9a69('0x6'));var util=require(_0x9a69('0x7'));var path=require(_0x9a69('0x8'));var sox=require(_0x9a69('0x9'));var csv=require(_0x9a69('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9a69('0xb'));var jsforce=require(_0x9a69('0xc'));var deskjs=require(_0x9a69('0xd'));var toCsv=require(_0x9a69('0xa'));var querystring=require(_0x9a69('0xe'));var Papa=require('papaparse');var Redis=require(_0x9a69('0xf'));var authService=require(_0x9a69('0x10'));var qs=require(_0x9a69('0x11'));var as=require(_0x9a69('0x12'));var hardwareService=require(_0x9a69('0x13'));var logger=require('../../config/logger')(_0x9a69('0x14'));var utils=require(_0x9a69('0x15'));var config=require('../../config/environment');var db=require(_0x9a69('0x16'))['db'];var integrations=require(_0x9a69('0x17'));var jayson=require('jayson/promise');var client=jayson[_0x9a69('0x18')][_0x9a69('0x19')]({'port':0x232a});function checkPasswordPattern(_0x1313ec,_0x1ca02e,_0x791ea7){if(_0x791ea7){var _0x479c85=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x479c85[_0x9a69('0x1a')](_0x1ca02e)){return _0x1313ec;}else{throw new db[(_0x9a69('0x1b'))][(_0x9a69('0x1c'))](_0x9a69('0x1d'));}}else{return _0x1313ec;}}function respondWithRpcPromise(_0x428710,_0xf43f3,_0x41f952,_0x4796c7){return new BPromise(function(_0xb5326c,_0x1c22e5){var _0x194d77=_0x4796c7||client;return _0x194d77[_0x9a69('0x1e')](_0x428710,_0x41f952)['then'](function(_0x559802){logger[_0x9a69('0x1f')](_0x9a69('0x20'),_0xf43f3,_0x9a69('0x21'));logger[_0x9a69('0x22')](_0x9a69('0x23'),_0xf43f3,'request\x20sent',JSON[_0x9a69('0x24')](_0x559802));if(_0x559802['error']){if(_0x559802[_0x9a69('0x25')][_0x9a69('0x26')]===0x1f4){logger[_0x9a69('0x25')](_0x9a69('0x20'),_0xf43f3,_0x559802[_0x9a69('0x25')][_0x9a69('0x27')]);return _0x1c22e5(_0x559802['error']['message']);}logger[_0x9a69('0x25')]('FreshsalesAccount,\x20%s,\x20%s',_0xf43f3,_0x559802[_0x9a69('0x25')][_0x9a69('0x27')]);return _0xb5326c(_0x559802[_0x9a69('0x25')][_0x9a69('0x27')]);}else{logger[_0x9a69('0x1f')]('FreshsalesAccount,\x20%s,\x20%s',_0xf43f3,_0x9a69('0x21'));_0xb5326c(_0x559802[_0x9a69('0x28')][_0x9a69('0x27')]);}})[_0x9a69('0x29')](function(_0x4929dc){logger[_0x9a69('0x25')]('FreshsalesAccount,\x20%s,\x20%s',_0xf43f3,_0x4929dc);_0x1c22e5(_0x4929dc);});});}function respondWithStatusCode(_0xa32f7a,_0x295a25){_0x295a25=_0x295a25||0xcc;return function(_0x14ec2f){if(_0x14ec2f){return _0xa32f7a['sendStatus'](_0x295a25);}return _0xa32f7a[_0x9a69('0x2a')](_0x295a25)[_0x9a69('0x2b')]();};}function respondWithResult(_0x37793a,_0x50f239){_0x50f239=_0x50f239||0xc8;return function(_0x1b2193){if(_0x1b2193){return _0x37793a[_0x9a69('0x2a')](_0x50f239)[_0x9a69('0x2c')](_0x1b2193);}};}function respondWithFilteredResult(_0x3997e9,_0x2a7137){return function(_0x2cd35f){if(_0x2cd35f){var _0x5a65b4=_0x2cd35f[_0x9a69('0x2d')],_0x1c470b=_0x2a7137[_0x9a69('0x2e')],_0x3a4eac=_0x2a7137['offset']+_0x2a7137['limit'],_0xe24224;if(_0x3a4eac>=_0x5a65b4){_0x3a4eac=_0x5a65b4;_0xe24224=0xc8;}else{_0xe24224=0xce;}_0x3997e9[_0x9a69('0x2a')](_0xe24224);return _0x3997e9['set'](_0x9a69('0x2f'),_0x1c470b+'-'+_0x3a4eac+'/'+_0x5a65b4)[_0x9a69('0x2c')](_0x2cd35f);}return null;};}function patchUpdates(_0x39c7a6){return function(_0x5de6d3){try{jsonpatch[_0x9a69('0x30')](_0x5de6d3,_0x39c7a6,!![]);}catch(_0x3fb577){return BPromise[_0x9a69('0x31')](_0x3fb577);}return _0x5de6d3[_0x9a69('0x32')]();};}function saveUpdates(_0xd57e53,_0x2bd304){return function(_0x216709){if(_0x216709){return _0x216709['update'](_0xd57e53)[_0x9a69('0x33')](function(_0x1b0e09){return _0x1b0e09;});}return null;};}function removeEntity(_0x2b1d3f,_0x41fb8f){return function(_0x51c366){if(_0x51c366){return _0x51c366[_0x9a69('0x34')]()[_0x9a69('0x33')](function(){_0x2b1d3f[_0x9a69('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b72d1,_0x205616){return function(_0x30fb60){if(!_0x30fb60){_0x2b72d1[_0x9a69('0x35')](0x194);}return _0x30fb60;};}function handleError(_0xe3e511,_0x5a7c3b){_0x5a7c3b=_0x5a7c3b||0x1f4;return function(_0x5c799d){logger['error'](_0x5c799d[_0x9a69('0x36')]);if(_0x5c799d['name']){delete _0x5c799d[_0x9a69('0x37')];}_0xe3e511[_0x9a69('0x2a')](_0x5a7c3b)[_0x9a69('0x38')](_0x5c799d);};}exports[_0x9a69('0x39')]=function(_0x5f0ecd,_0x1abbe9){var _0x3b95cc={},_0x5c4af0={},_0x29f5ec={'count':0x0,'rows':[]};var _0x1e906d=_[_0x9a69('0x3a')](db[_0x9a69('0x3b')][_0x9a69('0x3c')],function(_0x83b300){return{'name':_0x83b300[_0x9a69('0x3d')],'type':_0x83b300[_0x9a69('0x3e')][_0x9a69('0x3f')]};});_0x5c4af0['model']=_['map'](_0x1e906d,_0x9a69('0x37'));_0x5c4af0[_0x9a69('0x40')]=_[_0x9a69('0x41')](_0x5f0ecd[_0x9a69('0x40')]);_0x5c4af0[_0x9a69('0x42')]=_[_0x9a69('0x43')](_0x5c4af0[_0x9a69('0x44')],_0x5c4af0[_0x9a69('0x40')]);_0x3b95cc[_0x9a69('0x45')]=_[_0x9a69('0x43')](_0x5c4af0['model'],qs[_0x9a69('0x46')](_0x5f0ecd[_0x9a69('0x40')]['fields']));_0x3b95cc[_0x9a69('0x45')]=_0x3b95cc['attributes'][_0x9a69('0x47')]?_0x3b95cc[_0x9a69('0x45')]:_0x5c4af0[_0x9a69('0x44')];if(!_0x5f0ecd['query']['hasOwnProperty'](_0x9a69('0x48'))){_0x3b95cc[_0x9a69('0x49')]=qs[_0x9a69('0x49')](_0x5f0ecd[_0x9a69('0x40')][_0x9a69('0x49')]);_0x3b95cc['offset']=qs[_0x9a69('0x2e')](_0x5f0ecd[_0x9a69('0x40')][_0x9a69('0x2e')]);}_0x3b95cc[_0x9a69('0x4a')]=qs[_0x9a69('0x4b')](_0x5f0ecd[_0x9a69('0x40')][_0x9a69('0x4b')]);_0x3b95cc[_0x9a69('0x4c')]=qs[_0x9a69('0x42')](_['pick'](_0x5f0ecd['query'],_0x5c4af0[_0x9a69('0x42')]));if(_0x5f0ecd[_0x9a69('0x40')][_0x9a69('0x4d')]){_0x3b95cc['where']=_[_0x9a69('0x4e')](_0x3b95cc[_0x9a69('0x4c')],{'$or':_[_0x9a69('0x3a')](_0x1e906d,function(_0x1a216b){if(_0x1a216b[_0x9a69('0x3e')]!=='VIRTUAL'){var _0x2255f5={};_0x2255f5[_0x1a216b[_0x9a69('0x37')]]={'$like':'%'+_0x5f0ecd[_0x9a69('0x40')][_0x9a69('0x4d')]+'%'};return _0x2255f5;}})});}_0x3b95cc=_[_0x9a69('0x4e')]({},_0x3b95cc,_0x5f0ecd[_0x9a69('0x4f')]);var _0x1b698b={'where':_0x3b95cc[_0x9a69('0x4c')]};return db['FreshsalesAccount'][_0x9a69('0x2d')](_0x1b698b)['then'](function(_0x54c125){_0x29f5ec[_0x9a69('0x2d')]=_0x54c125;if(_0x5f0ecd[_0x9a69('0x40')]['includeAll']){_0x3b95cc['include']=[{'all':!![]}];}return db['FreshsalesAccount']['findAll'](_0x3b95cc);})[_0x9a69('0x33')](function(_0x2de8c0){_0x29f5ec[_0x9a69('0x50')]=_0x2de8c0;return _0x29f5ec;})[_0x9a69('0x33')](respondWithFilteredResult(_0x1abbe9,_0x3b95cc))[_0x9a69('0x29')](handleError(_0x1abbe9,null));};exports[_0x9a69('0x51')]=function(_0x3757d6,_0x2fe962){var _0x254daf={'raw':![],'where':{'id':_0x3757d6[_0x9a69('0x52')]['id']}},_0x761324={};_0x761324['model']=_['keys'](db[_0x9a69('0x3b')][_0x9a69('0x3c')]);_0x761324[_0x9a69('0x40')]=_[_0x9a69('0x41')](_0x3757d6['query']);_0x761324[_0x9a69('0x42')]=_['intersection'](_0x761324[_0x9a69('0x44')],_0x761324[_0x9a69('0x40')]);_0x254daf['attributes']=_[_0x9a69('0x43')](_0x761324[_0x9a69('0x44')],qs[_0x9a69('0x46')](_0x3757d6[_0x9a69('0x40')][_0x9a69('0x46')]));_0x254daf['attributes']=_0x254daf[_0x9a69('0x45')][_0x9a69('0x47')]?_0x254daf['attributes']:_0x761324[_0x9a69('0x44')];if(_0x3757d6[_0x9a69('0x40')][_0x9a69('0x53')]){_0x254daf[_0x9a69('0x54')]=[{'all':!![]}];}_0x254daf=_[_0x9a69('0x4e')]({},_0x254daf,_0x3757d6['options']);return db['FreshsalesAccount'][_0x9a69('0x55')](_0x254daf)[_0x9a69('0x33')](handleEntityNotFound(_0x2fe962,null))[_0x9a69('0x33')](respondWithResult(_0x2fe962,null))[_0x9a69('0x29')](handleError(_0x2fe962,null));};exports['create']=function(_0x1707d6,_0x44af7d){return db[_0x9a69('0x3b')]['create'](_0x1707d6[_0x9a69('0x56')],{})['then'](respondWithResult(_0x44af7d,0xc9))[_0x9a69('0x29')](handleError(_0x44af7d,null));};exports[_0x9a69('0x57')]=function(_0x547a5b,_0x1ba9bc){if(_0x547a5b[_0x9a69('0x56')]['id']){delete _0x547a5b['body']['id'];}return db[_0x9a69('0x3b')][_0x9a69('0x55')]({'where':{'id':_0x547a5b[_0x9a69('0x52')]['id']}})[_0x9a69('0x33')](handleEntityNotFound(_0x1ba9bc,null))['then'](saveUpdates(_0x547a5b['body'],null))[_0x9a69('0x33')](respondWithResult(_0x1ba9bc,null))[_0x9a69('0x29')](handleError(_0x1ba9bc,null));};exports[_0x9a69('0x34')]=function(_0x5b0e3a,_0x18782a){return db[_0x9a69('0x3b')][_0x9a69('0x55')]({'where':{'id':_0x5b0e3a[_0x9a69('0x52')]['id']}})[_0x9a69('0x33')](handleEntityNotFound(_0x18782a,null))['then'](removeEntity(_0x18782a,null))[_0x9a69('0x29')](handleError(_0x18782a,null));};exports[_0x9a69('0x58')]=function(_0x2bbc94,_0x44f783,_0x2f34b4){var _0x34fbae={};var _0x57ab46={};var _0x240218;var _0x314011;return db[_0x9a69('0x3b')][_0x9a69('0x59')]({'where':{'id':_0x2bbc94[_0x9a69('0x52')]['id']}})[_0x9a69('0x33')](handleEntityNotFound(_0x44f783,null))[_0x9a69('0x33')](function(_0x4d0075){if(_0x4d0075){_0x240218=_0x4d0075;_0x57ab46['model']=_[_0x9a69('0x41')](db[_0x9a69('0x5a')][_0x9a69('0x3c')]);_0x57ab46['query']=_[_0x9a69('0x41')](_0x2bbc94[_0x9a69('0x40')]);_0x57ab46['filters']=_[_0x9a69('0x43')](_0x57ab46[_0x9a69('0x44')],_0x57ab46['query']);_0x34fbae[_0x9a69('0x45')]=_[_0x9a69('0x43')](_0x57ab46['model'],qs['fields'](_0x2bbc94['query'][_0x9a69('0x46')]));_0x34fbae[_0x9a69('0x45')]=_0x34fbae[_0x9a69('0x45')]['length']?_0x34fbae['attributes']:_0x57ab46['model'];_0x34fbae[_0x9a69('0x4a')]=qs[_0x9a69('0x4b')](_0x2bbc94[_0x9a69('0x40')]['sort']);_0x34fbae[_0x9a69('0x4c')]=qs['filters'](_[_0x9a69('0x5b')](_0x2bbc94[_0x9a69('0x40')],_0x57ab46[_0x9a69('0x42')]));if(_0x2bbc94['query'][_0x9a69('0x4d')]){_0x34fbae[_0x9a69('0x4c')]=_['merge'](_0x34fbae['where'],{'$or':_[_0x9a69('0x3a')](_0x34fbae[_0x9a69('0x45')],function(_0x423d3d){var _0x54b6c7={};_0x54b6c7[_0x423d3d]={'$like':'%'+_0x2bbc94['query'][_0x9a69('0x4d')]+'%'};return _0x54b6c7;})});}_0x34fbae=_['merge']({},_0x34fbae,_0x2bbc94['options']);return _0x240218[_0x9a69('0x58')](_0x34fbae);}})[_0x9a69('0x33')](function(_0x46b4f1){if(_0x46b4f1){_0x314011=_0x46b4f1[_0x9a69('0x47')];if(!_0x2bbc94[_0x9a69('0x40')][_0x9a69('0x5c')](_0x9a69('0x48'))){_0x34fbae[_0x9a69('0x49')]=qs[_0x9a69('0x49')](_0x2bbc94[_0x9a69('0x40')][_0x9a69('0x49')]);_0x34fbae['offset']=qs['offset'](_0x2bbc94[_0x9a69('0x40')]['offset']);}return _0x240218[_0x9a69('0x58')](_0x34fbae);}})[_0x9a69('0x33')](function(_0x18c080){if(_0x18c080){return _0x18c080?{'count':_0x314011,'rows':_0x18c080}:null;}})[_0x9a69('0x33')](respondWithResult(_0x44f783,null))[_0x9a69('0x29')](handleError(_0x44f783,null));};exports['addConfiguration']=function(_0xbe0690,_0x5aa008,_0x14f072){if(_0xbe0690[_0x9a69('0x56')]['id']){delete _0xbe0690[_0x9a69('0x56')]['id'];}return db[_0x9a69('0x3b')][_0x9a69('0x59')]({'where':{'id':_0xbe0690[_0x9a69('0x52')]['id']}})[_0x9a69('0x33')](handleEntityNotFound(_0x5aa008,null))['then'](function(_0x5f4e20){if(_0x5f4e20){_0xbe0690[_0x9a69('0x56')][_0x9a69('0x5d')]=_0x5f4e20['id'];_0xbe0690[_0x9a69('0x56')][_0x9a69('0x5e')]=integrations['getSubjects'](_0xbe0690[_0x9a69('0x56')]['channel'],_0xbe0690[_0x9a69('0x56')][_0x9a69('0x3e')]);_0xbe0690['body']['Descriptions']=integrations['getDescriptions'](_0xbe0690['body'][_0x9a69('0x5f')],_0xbe0690[_0x9a69('0x56')][_0x9a69('0x3e')]);return db['FreshsalesConfiguration']['create'](_0xbe0690[_0x9a69('0x56')],{'include':[{'model':db['FreshsalesField'],'as':_0x9a69('0x5e')},{'model':db[_0x9a69('0x60')],'as':_0x9a69('0x61')}]});}return null;})[_0x9a69('0x33')](respondWithResult(_0x5aa008,null))[_0x9a69('0x29')](handleError(_0x5aa008,null));};exports['getFields']=function(_0x4dbcc0,_0x240d91,_0x2c1f81){var _0x5e48d0='';var _0x3e69ce='';return db['FreshsalesAccount'][_0x9a69('0x59')]({'where':{'id':_0x4dbcc0[_0x9a69('0x52')]['id']},'attributes':['id',_0x9a69('0x62'),_0x9a69('0x63'),_0x9a69('0x64')]})[_0x9a69('0x33')](handleEntityNotFound(_0x240d91,null))['then'](function(_0x5c0202){if(_0x5c0202){_0x3e69ce=_0x5c0202['username'];_0x5e48d0=_0x5c0202[_0x9a69('0x63')];var _0x4b8b77=_0x5c0202['remoteUri']['slice'](-0x1);if(_0x4b8b77==='/'){_0x5e48d0=_0x5e48d0['substring'](0x0,_0x5e48d0[_0x9a69('0x65')](_0x4b8b77));}return rp({'method':_0x9a69('0x66'),'uri':util[_0x9a69('0x67')](_0x9a69('0x68'),_0x5e48d0,_0x9a69('0x69')),'headers':{'Authorization':'Token\x20token='+_0x5c0202[_0x9a69('0x64')]},'json':!![]});}})['then'](function(_0x54b9e1){if(_0x54b9e1){var _0x3223b5=_0x54b9e1[_0x9a69('0x6a')];var _0x421204=![];var _0x419257=null;for(_0x419257=0x0;_0x419257<_0x3223b5[_0x9a69('0x47')];_0x419257++){if(_0x3223b5[_0x419257][_0x9a69('0x6b')]===_0x3e69ce){_0x421204=!![];}}if(_0x421204){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9a69('0x6c')});}}})[_0x9a69('0x33')](respondWithResult(_0x240d91,null))[_0x9a69('0x29')](function(_0x29ea28){var _0x403444=_0x4dbcc0[_0x9a69('0x40')][_0x9a69('0x1a')]?0x1f4:_0x29ea28[_0x9a69('0x6d')]||0x1f4;logger[_0x9a69('0x25')](_0x9a69('0x6e'),_0x9a69('0x6f'),_0x403444,JSON[_0x9a69('0x24')](_0x29ea28));delete _0x29ea28[_0x9a69('0x37')];if(_0x403444===0x191){_0x403444=0x190;}_0x240d91['status'](_0x403444)[_0x9a69('0x38')](_0x4dbcc0[_0x9a69('0x40')][_0x9a69('0x1a')]?{'message':_0x9a69('0x70'),'statusCode':_0x29ea28[_0x9a69('0x6d')]}:_0x29ea28);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index df1a836..3ced1ca 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 _0x1aac=['bluebird','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x5e305a,_0x5385f){var _0x25b737=function(_0x6d7ca8){while(--_0x6d7ca8){_0x5e305a['push'](_0x5e305a['shift']());}};_0x25b737(++_0x5385f);}(_0x1aac,0x6b));var _0xc1aa=function(_0x318062,_0x4c380b){_0x318062=_0x318062-0x0;var _0x1fc947=_0x1aac[_0x318062];return _0x1fc947;};'use strict';var _=require(_0xc1aa('0x0'));var util=require(_0xc1aa('0x1'));var logger=require(_0xc1aa('0x2'))(_0xc1aa('0x3'));var moment=require(_0xc1aa('0x4'));var BPromise=require(_0xc1aa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1aa('0x6'));var rimraf=require('rimraf');var config=require(_0xc1aa('0x7'));var attributes=require(_0xc1aa('0x8'));var integrations=require(_0xc1aa('0x9'));module[_0xc1aa('0xa')]=function(_0x21d9b8,_0x4de411){return _0x21d9b8[_0xc1aa('0xb')](_0xc1aa('0xc'),attributes,{'tableName':_0xc1aa('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d8a=['request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3b4626,_0x14d17b){var _0x404a2e=function(_0x1d0e4f){while(--_0x1d0e4f){_0x3b4626['push'](_0x3b4626['shift']());}};_0x404a2e(++_0x14d17b);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x7d8a[_0x454018];return _0x24697d;};'use strict';var _=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var logger=require(_0xa7d8('0x2'))(_0xa7d8('0x3'));var moment=require(_0xa7d8('0x4'));var BPromise=require(_0xa7d8('0x5'));var rp=require(_0xa7d8('0x6'));var fs=require('fs');var path=require(_0xa7d8('0x7'));var rimraf=require(_0xa7d8('0x8'));var config=require(_0xa7d8('0x9'));var attributes=require(_0xa7d8('0xa'));var integrations=require(_0xa7d8('0xb'));module[_0xa7d8('0xc')]=function(_0x44660b,_0x55bb66){return _0x44660b[_0xa7d8('0xd')](_0xa7d8('0xe'),attributes,{'tableName':_0xa7d8('0xf'),'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 d9e29be..80b1ad8 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 _0xb470=['limit','include','map','model','then','GetFreshsalesAccount','ShowFreshsalesAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','FreshsalesAccount','options','raw','attributes'];(function(_0x1d2351,_0x4d2a6c){var _0x6762c0=function(_0x33ae0d){while(--_0x33ae0d){_0x1d2351['push'](_0x1d2351['shift']());}};_0x6762c0(++_0x4d2a6c);}(_0xb470,0x75));var _0x0b47=function(_0x5c620f,_0xdb8e5b){_0x5c620f=_0x5c620f-0x0;var _0x4f71e5=_0xb470[_0x5c620f];return _0x4f71e5;};'use strict';var _=require(_0x0b47('0x0'));var util=require(_0x0b47('0x1'));var moment=require(_0x0b47('0x2'));var BPromise=require(_0x0b47('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0b47('0x4'));var db=require(_0x0b47('0x5'))['db'];var utils=require(_0x0b47('0x6'));var logger=require('../../config/logger')(_0x0b47('0x7'));var config=require(_0x0b47('0x8'));var jayson=require(_0x0b47('0x9'));var client=jayson[_0x0b47('0xa')][_0x0b47('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23d960,_0x201ab2,_0x37eb18){return new BPromise(function(_0x4bfebf,_0x56543c){return client['request'](_0x23d960,_0x37eb18)['then'](function(_0x38523d){logger[_0x0b47('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x201ab2,_0x0b47('0xd'));logger[_0x0b47('0xe')](_0x0b47('0xf'),_0x201ab2,_0x0b47('0xd'),JSON[_0x0b47('0x10')](_0x38523d));if(_0x38523d[_0x0b47('0x11')]){if(_0x38523d[_0x0b47('0x11')][_0x0b47('0x12')]===0x1f4){logger[_0x0b47('0x11')](_0x0b47('0x13'),_0x201ab2,_0x38523d['error']['message']);return _0x56543c(_0x38523d[_0x0b47('0x11')]['message']);}logger[_0x0b47('0x11')](_0x0b47('0x13'),_0x201ab2,_0x38523d['error'][_0x0b47('0x14')]);return _0x4bfebf(_0x38523d[_0x0b47('0x11')][_0x0b47('0x14')]);}else{logger[_0x0b47('0xc')](_0x0b47('0x13'),_0x201ab2,_0x0b47('0xd'));_0x4bfebf(_0x38523d[_0x0b47('0x15')][_0x0b47('0x14')]);}})[_0x0b47('0x16')](function(_0x1da847){logger['error'](_0x0b47('0x13'),_0x201ab2,_0x1da847);_0x56543c(_0x1da847);});});}exports['GetFreshsalesAccount']=function(_0x11f305){var _0x1620fc=this;return new Promise(function(_0x2b1024,_0x478caa){return db[_0x0b47('0x17')]['findAll']({'raw':_0x11f305['options']?_0x11f305[_0x0b47('0x18')][_0x0b47('0x19')]===undefined?!![]:![]:!![],'where':_0x11f305['options']?_0x11f305[_0x0b47('0x18')]['where']||null:null,'attributes':_0x11f305[_0x0b47('0x18')]?_0x11f305[_0x0b47('0x18')][_0x0b47('0x1a')]||null:null,'limit':_0x11f305[_0x0b47('0x18')]?_0x11f305[_0x0b47('0x18')][_0x0b47('0x1b')]||null:null,'include':_0x11f305[_0x0b47('0x18')]?_0x11f305[_0x0b47('0x18')][_0x0b47('0x1c')]?_[_0x0b47('0x1d')](_0x11f305[_0x0b47('0x18')]['include'],function(_0xc87cd){return{'model':db[_0xc87cd[_0x0b47('0x1e')]],'as':_0xc87cd['as'],'attributes':_0xc87cd['attributes'],'include':_0xc87cd[_0x0b47('0x1c')]?_[_0x0b47('0x1d')](_0xc87cd[_0x0b47('0x1c')],function(_0xd9c35c){return{'model':db[_0xd9c35c['model']],'as':_0xd9c35c['as'],'attributes':_0xd9c35c['attributes'],'include':_0xd9c35c[_0x0b47('0x1c')]?_[_0x0b47('0x1d')](_0xd9c35c['include'],function(_0x138a03){return{'model':db[_0x138a03[_0x0b47('0x1e')]],'as':_0x138a03['as'],'attributes':_0x138a03[_0x0b47('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0b47('0x1f')](function(_0x15db7d){logger[_0x0b47('0xc')](_0x0b47('0x20'),_0x11f305);logger[_0x0b47('0xe')](_0x0b47('0x20'),_0x11f305,JSON[_0x0b47('0x10')](_0x15db7d));_0x2b1024(_0x15db7d);})[_0x0b47('0x16')](function(_0x5e90f1){logger['error'](_0x0b47('0x20'),_0x5e90f1['message'],_0x11f305);_0x478caa(_0x1620fc[_0x0b47('0x11')](0x1f4,_0x5e90f1[_0x0b47('0x14')]));});});};exports[_0x0b47('0x21')]=function(_0xccf571){var _0x1014cd=this;return new Promise(function(_0x510caf,_0x453ac1){return db[_0x0b47('0x17')][_0x0b47('0x22')]({'raw':_0xccf571['options']?_0xccf571[_0x0b47('0x18')][_0x0b47('0x19')]===undefined?!![]:![]:!![],'where':_0xccf571[_0x0b47('0x18')]?_0xccf571[_0x0b47('0x18')][_0x0b47('0x23')]||null:null,'attributes':_0xccf571[_0x0b47('0x18')]?_0xccf571['options']['attributes']||null:null,'include':_0xccf571[_0x0b47('0x18')]?_0xccf571[_0x0b47('0x18')][_0x0b47('0x1c')]?_[_0x0b47('0x1d')](_0xccf571[_0x0b47('0x18')][_0x0b47('0x1c')],function(_0x42fa6c){return{'model':db[_0x42fa6c[_0x0b47('0x1e')]],'as':_0x42fa6c['as'],'attributes':_0x42fa6c[_0x0b47('0x1a')],'include':_0x42fa6c[_0x0b47('0x1c')]?_[_0x0b47('0x1d')](_0x42fa6c['include'],function(_0x50fd74){return{'model':db[_0x50fd74[_0x0b47('0x1e')]],'as':_0x50fd74['as'],'attributes':_0x50fd74['attributes'],'include':_0x50fd74[_0x0b47('0x1c')]?_[_0x0b47('0x1d')](_0x50fd74[_0x0b47('0x1c')],function(_0xa7724f){return{'model':db[_0xa7724f[_0x0b47('0x1e')]],'as':_0xa7724f['as'],'attributes':_0xa7724f[_0x0b47('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4948d5){logger['info'](_0x0b47('0x21'),_0xccf571);logger[_0x0b47('0xe')](_0x0b47('0x21'),_0xccf571,JSON[_0x0b47('0x10')](_0x4948d5));_0x510caf(_0x4948d5);})[_0x0b47('0x16')](function(_0x22227f){logger['error'](_0x0b47('0x21'),_0x22227f[_0x0b47('0x14')],_0xccf571);_0x453ac1(_0x1014cd[_0x0b47('0x11')](0x1f4,_0x22227f[_0x0b47('0x14')]));});});}; \ No newline at end of file +var _0x8374=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','limit','include','model','map','stringify','ShowFreshsalesAccount','raw','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1331d7,_0x3c62ab){var _0x219d12=function(_0x32a923){while(--_0x32a923){_0x1331d7['push'](_0x1331d7['shift']());}};_0x219d12(++_0x3c62ab);}(_0x8374,0x174));var _0x4837=function(_0x2d0a84,_0x44d08c){_0x2d0a84=_0x2d0a84-0x0;var _0x5cfdff=_0x8374[_0x2d0a84];return _0x5cfdff;};'use strict';var _=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var moment=require(_0x4837('0x2'));var BPromise=require(_0x4837('0x3'));var rs=require(_0x4837('0x4'));var fs=require('fs');var Redis=require(_0x4837('0x5'));var db=require(_0x4837('0x6'))['db'];var utils=require(_0x4837('0x7'));var logger=require(_0x4837('0x8'))(_0x4837('0x9'));var config=require(_0x4837('0xa'));var jayson=require(_0x4837('0xb'));var client=jayson[_0x4837('0xc')][_0x4837('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4e0e60,_0x2036a4,_0x560c37){return new BPromise(function(_0x408c14,_0x476a1d){return client[_0x4837('0xe')](_0x4e0e60,_0x560c37)[_0x4837('0xf')](function(_0x2f0ca6){logger[_0x4837('0x10')](_0x4837('0x11'),_0x2036a4,_0x4837('0x12'));logger[_0x4837('0x13')](_0x4837('0x14'),_0x2036a4,'request\x20sent',JSON['stringify'](_0x2f0ca6));if(_0x2f0ca6[_0x4837('0x15')]){if(_0x2f0ca6['error'][_0x4837('0x16')]===0x1f4){logger[_0x4837('0x15')]('FreshsalesAccount,\x20%s,\x20%s',_0x2036a4,_0x2f0ca6['error']['message']);return _0x476a1d(_0x2f0ca6[_0x4837('0x15')][_0x4837('0x17')]);}logger[_0x4837('0x15')](_0x4837('0x11'),_0x2036a4,_0x2f0ca6['error'][_0x4837('0x17')]);return _0x408c14(_0x2f0ca6[_0x4837('0x15')][_0x4837('0x17')]);}else{logger['info'](_0x4837('0x11'),_0x2036a4,_0x4837('0x12'));_0x408c14(_0x2f0ca6['result'][_0x4837('0x17')]);}})[_0x4837('0x18')](function(_0xb95296){logger[_0x4837('0x15')](_0x4837('0x11'),_0x2036a4,_0xb95296);_0x476a1d(_0xb95296);});});}exports[_0x4837('0x19')]=function(_0x48b61b){var _0xf21681=this;return new Promise(function(_0x1cb24a,_0x427171){return db[_0x4837('0x1a')][_0x4837('0x1b')]({'raw':_0x48b61b[_0x4837('0x1c')]?_0x48b61b[_0x4837('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x48b61b['options']?_0x48b61b[_0x4837('0x1c')][_0x4837('0x1d')]||null:null,'attributes':_0x48b61b[_0x4837('0x1c')]?_0x48b61b[_0x4837('0x1c')]['attributes']||null:null,'limit':_0x48b61b[_0x4837('0x1c')]?_0x48b61b['options'][_0x4837('0x1e')]||null:null,'include':_0x48b61b['options']?_0x48b61b['options'][_0x4837('0x1f')]?_['map'](_0x48b61b['options']['include'],function(_0x40bebd){return{'model':db[_0x40bebd[_0x4837('0x20')]],'as':_0x40bebd['as'],'attributes':_0x40bebd['attributes'],'include':_0x40bebd[_0x4837('0x1f')]?_[_0x4837('0x21')](_0x40bebd['include'],function(_0x3fa5ad){return{'model':db[_0x3fa5ad[_0x4837('0x20')]],'as':_0x3fa5ad['as'],'attributes':_0x3fa5ad['attributes'],'include':_0x3fa5ad[_0x4837('0x1f')]?_[_0x4837('0x21')](_0x3fa5ad[_0x4837('0x1f')],function(_0x22ca2b){return{'model':db[_0x22ca2b[_0x4837('0x20')]],'as':_0x22ca2b['as'],'attributes':_0x22ca2b['attributes']};}):[]};}):[]};}):[]:[]})[_0x4837('0xf')](function(_0x153bc7){logger[_0x4837('0x10')](_0x4837('0x19'),_0x48b61b);logger[_0x4837('0x13')](_0x4837('0x19'),_0x48b61b,JSON[_0x4837('0x22')](_0x153bc7));_0x1cb24a(_0x153bc7);})[_0x4837('0x18')](function(_0x55f82b){logger[_0x4837('0x15')](_0x4837('0x19'),_0x55f82b[_0x4837('0x17')],_0x48b61b);_0x427171(_0xf21681[_0x4837('0x15')](0x1f4,_0x55f82b[_0x4837('0x17')]));});});};exports[_0x4837('0x23')]=function(_0xf3e0d7){var _0x139e3c=this;return new Promise(function(_0xccb861,_0x569ae1){return db[_0x4837('0x1a')]['find']({'raw':_0xf3e0d7[_0x4837('0x1c')]?_0xf3e0d7['options'][_0x4837('0x24')]===undefined?!![]:![]:!![],'where':_0xf3e0d7[_0x4837('0x1c')]?_0xf3e0d7[_0x4837('0x1c')]['where']||null:null,'attributes':_0xf3e0d7['options']?_0xf3e0d7[_0x4837('0x1c')][_0x4837('0x25')]||null:null,'include':_0xf3e0d7[_0x4837('0x1c')]?_0xf3e0d7[_0x4837('0x1c')][_0x4837('0x1f')]?_['map'](_0xf3e0d7[_0x4837('0x1c')][_0x4837('0x1f')],function(_0x5695a1){return{'model':db[_0x5695a1[_0x4837('0x20')]],'as':_0x5695a1['as'],'attributes':_0x5695a1['attributes'],'include':_0x5695a1[_0x4837('0x1f')]?_['map'](_0x5695a1['include'],function(_0x449e7b){return{'model':db[_0x449e7b[_0x4837('0x20')]],'as':_0x449e7b['as'],'attributes':_0x449e7b[_0x4837('0x25')],'include':_0x449e7b['include']?_[_0x4837('0x21')](_0x449e7b[_0x4837('0x1f')],function(_0x59d704){return{'model':db[_0x59d704[_0x4837('0x20')]],'as':_0x59d704['as'],'attributes':_0x59d704['attributes']};}):[]};}):[]};}):[]:[]})[_0x4837('0xf')](function(_0x349bec){logger[_0x4837('0x10')](_0x4837('0x23'),_0xf3e0d7);logger['debug'](_0x4837('0x23'),_0xf3e0d7,JSON[_0x4837('0x22')](_0x349bec));_0xccb861(_0x349bec);})[_0x4837('0x18')](function(_0x285b48){logger[_0x4837('0x15')](_0x4837('0x23'),_0x285b48['message'],_0xf3e0d7);_0x569ae1(_0x139e3c[_0x4837('0x15')](0x1f4,_0x285b48['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 23eca56..2820e2b 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 _0x6ec7=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/fields','create','put','update','delete','exports','multer','util','path'];(function(_0x3ba0bb,_0x3a2c81){var _0x3e74b7=function(_0x362c5d){while(--_0x362c5d){_0x3ba0bb['push'](_0x3ba0bb['shift']());}};_0x3e74b7(++_0x3a2c81);}(_0x6ec7,0x156));var _0x76ec=function(_0x183228,_0x58db39){_0x183228=_0x183228-0x0;var _0x505ac6=_0x6ec7[_0x183228];return _0x505ac6;};'use strict';var multer=require(_0x76ec('0x0'));var util=require(_0x76ec('0x1'));var path=require(_0x76ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x76ec('0x3'));var router=express[_0x76ec('0x4')]();var auth=require(_0x76ec('0x5'));var interaction=require(_0x76ec('0x6'));var config=require(_0x76ec('0x7'));var controller=require(_0x76ec('0x8'));router[_0x76ec('0x9')]('/',auth[_0x76ec('0xa')](),controller[_0x76ec('0xb')]);router['get'](_0x76ec('0xc'),auth['isAuthenticated'](),controller[_0x76ec('0xd')]);router[_0x76ec('0x9')](_0x76ec('0xe'),auth[_0x76ec('0xa')](),controller['getSubjects']);router[_0x76ec('0x9')](_0x76ec('0xf'),auth[_0x76ec('0xa')](),controller[_0x76ec('0x10')]);router[_0x76ec('0x9')](_0x76ec('0x11'),auth[_0x76ec('0xa')](),controller['getFields']);router['post']('/',auth[_0x76ec('0xa')](),controller[_0x76ec('0x12')]);router[_0x76ec('0x13')](_0x76ec('0xc'),auth[_0x76ec('0xa')](),controller[_0x76ec('0x14')]);router[_0x76ec('0x15')](_0x76ec('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x76ec('0x16')]=router; \ No newline at end of file +var _0x3afc=['isAuthenticated','/:id/fields','getFields','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0xc983c1,_0x4a4332){var _0x213b06=function(_0x5bd589){while(--_0x5bd589){_0xc983c1['push'](_0xc983c1['shift']());}};_0x213b06(++_0x4a4332);}(_0x3afc,0x99));var _0xc3af=function(_0x3d97d1,_0x33faff){_0x3d97d1=_0x3d97d1-0x0;var _0x39df0e=_0x3afc[_0x3d97d1];return _0x39df0e;};'use strict';var multer=require(_0xc3af('0x0'));var util=require(_0xc3af('0x1'));var path=require(_0xc3af('0x2'));var timeout=require('connect-timeout');var express=require(_0xc3af('0x3'));var router=express[_0xc3af('0x4')]();var auth=require(_0xc3af('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc3af('0x6'));var controller=require(_0xc3af('0x7'));router[_0xc3af('0x8')]('/',auth['isAuthenticated'](),controller[_0xc3af('0x9')]);router[_0xc3af('0x8')](_0xc3af('0xa'),auth['isAuthenticated'](),controller[_0xc3af('0xb')]);router[_0xc3af('0x8')](_0xc3af('0xc'),auth['isAuthenticated'](),controller[_0xc3af('0xd')]);router['get'](_0xc3af('0xe'),auth[_0xc3af('0xf')](),controller['getDescriptions']);router['get'](_0xc3af('0x10'),auth[_0xc3af('0xf')](),controller[_0xc3af('0x11')]);router[_0xc3af('0x12')]('/',auth[_0xc3af('0xf')](),controller[_0xc3af('0x13')]);router[_0xc3af('0x14')](_0xc3af('0xa'),auth[_0xc3af('0xf')](),controller['update']);router[_0xc3af('0x15')](_0xc3af('0xa'),auth[_0xc3af('0xf')](),controller[_0xc3af('0x16')]);module[_0xc3af('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 3dd8237..4c043d2 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 _0x5243=['exports','STRING','sequelize'];(function(_0x241fa3,_0x400ab1){var _0x366370=function(_0x255289){while(--_0x255289){_0x241fa3['push'](_0x241fa3['shift']());}};_0x366370(++_0x400ab1);}(_0x5243,0xf5));var _0x3524=function(_0x5723b7,_0x373d5b){_0x5723b7=_0x5723b7-0x0;var _0x5ad9a4=_0x5243[_0x5723b7];return _0x5ad9a4;};'use strict';var Sequelize=require(_0x3524('0x0'));module[_0x3524('0x1')]={'name':{'type':Sequelize[_0x3524('0x2')]},'description':{'type':Sequelize[_0x3524('0x2')]}}; \ No newline at end of file +var _0x6ede=['exports','STRING','sequelize'];(function(_0x49c271,_0x4d514f){var _0x48c8af=function(_0x2d4ccb){while(--_0x2d4ccb){_0x49c271['push'](_0x49c271['shift']());}};_0x48c8af(++_0x4d514f);}(_0x6ede,0x9b));var _0xe6ed=function(_0x3be2e2,_0x5c166d){_0x3be2e2=_0x3be2e2-0x0;var _0x53b9c5=_0x6ede[_0x3be2e2];return _0x53b9c5;};'use strict';var Sequelize=require(_0xe6ed('0x0'));module[_0xe6ed('0x1')]={'name':{'type':Sequelize[_0xe6ed('0x2')]},'description':{'type':Sequelize[_0xe6ed('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 773bfd8..9a48fcd 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 _0xf494=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','jayson/promise','client','test','Sequelize','ValidationError','request','info','FreshsalesConfiguration,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','pick','filter','merge','options','where','includeAll','findAll','catch','show','params','find','body','getSubjects','FreshsalesField','length','sort','getDescriptions','getFields','findOne','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x56b93a,_0x8473a4){var _0x155a17=function(_0xe0436){while(--_0xe0436){_0x56b93a['push'](_0x56b93a['shift']());}};_0x155a17(++_0x8473a4);}(_0xf494,0x1c6));var _0x4f49=function(_0x5c5c32,_0x5355b1){_0x5c5c32=_0x5c5c32-0x0;var _0x22392c=_0xf494[_0x5c5c32];return _0x22392c;};'use strict';var pdf=require(_0x4f49('0x0'));var emlformat=require(_0x4f49('0x1'));var rimraf=require(_0x4f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var moment=require(_0x4f49('0x5'));var BPromise=require(_0x4f49('0x6'));var Mustache=require(_0x4f49('0x7'));var util=require(_0x4f49('0x8'));var path=require(_0x4f49('0x9'));var sox=require(_0x4f49('0xa'));var csv=require(_0x4f49('0xb'));var ejs=require(_0x4f49('0xc'));var fs=require('fs');var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xb'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x4f49('0x18'));var client=jayson[_0x4f49('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x1e1c37,_0x111a8b,_0x1b9145){if(_0x1b9145){var _0x2efe49=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2efe49[_0x4f49('0x1a')](_0x111a8b)){return _0x1e1c37;}else{throw new db[(_0x4f49('0x1b'))][(_0x4f49('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 _0x1e1c37;}}function respondWithRpcPromise(_0x515ace,_0x1f2d0d,_0x415e83,_0x5878f4){return new BPromise(function(_0x5bdfaf,_0x2f0a0d){var _0x2ecaaa=_0x5878f4||client;return _0x2ecaaa[_0x4f49('0x1d')](_0x515ace,_0x415e83)['then'](function(_0x1dccfd){logger[_0x4f49('0x1e')](_0x4f49('0x1f'),_0x1f2d0d,'request\x20sent');logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x1f2d0d,'request\x20sent',JSON[_0x4f49('0x20')](_0x1dccfd));if(_0x1dccfd[_0x4f49('0x21')]){if(_0x1dccfd[_0x4f49('0x21')][_0x4f49('0x22')]===0x1f4){logger['error'](_0x4f49('0x1f'),_0x1f2d0d,_0x1dccfd[_0x4f49('0x21')][_0x4f49('0x23')]);return _0x2f0a0d(_0x1dccfd[_0x4f49('0x21')][_0x4f49('0x23')]);}logger['error'](_0x4f49('0x1f'),_0x1f2d0d,_0x1dccfd[_0x4f49('0x21')][_0x4f49('0x23')]);return _0x5bdfaf(_0x1dccfd['error'][_0x4f49('0x23')]);}else{logger[_0x4f49('0x1e')](_0x4f49('0x1f'),_0x1f2d0d,_0x4f49('0x24'));_0x5bdfaf(_0x1dccfd[_0x4f49('0x25')][_0x4f49('0x23')]);}})['catch'](function(_0x4e9041){logger[_0x4f49('0x21')](_0x4f49('0x1f'),_0x1f2d0d,_0x4e9041);_0x2f0a0d(_0x4e9041);});});}function respondWithStatusCode(_0x4fedbb,_0x408552){_0x408552=_0x408552||0xcc;return function(_0x2c1519){if(_0x2c1519){return _0x4fedbb[_0x4f49('0x26')](_0x408552);}return _0x4fedbb['status'](_0x408552)[_0x4f49('0x27')]();};}function respondWithResult(_0x2eed1c,_0x298785){_0x298785=_0x298785||0xc8;return function(_0x148153){if(_0x148153){return _0x2eed1c[_0x4f49('0x28')](_0x298785)[_0x4f49('0x29')](_0x148153);}};}function respondWithFilteredResult(_0x4915af,_0x50c571){return function(_0x239f44){if(_0x239f44){var _0x2c00ee=_0x239f44[_0x4f49('0x2a')],_0x605c91=_0x50c571[_0x4f49('0x2b')],_0x560050=_0x50c571['offset']+_0x50c571['limit'],_0x3cbfbd;if(_0x560050>=_0x2c00ee){_0x560050=_0x2c00ee;_0x3cbfbd=0xc8;}else{_0x3cbfbd=0xce;}_0x4915af[_0x4f49('0x28')](_0x3cbfbd);return _0x4915af[_0x4f49('0x2c')](_0x4f49('0x2d'),_0x605c91+'-'+_0x560050+'/'+_0x2c00ee)['json'](_0x239f44);}return null;};}function patchUpdates(_0x1eaac6){return function(_0x35aa33){try{jsonpatch[_0x4f49('0x2e')](_0x35aa33,_0x1eaac6,!![]);}catch(_0x2ceda4){return BPromise[_0x4f49('0x2f')](_0x2ceda4);}return _0x35aa33[_0x4f49('0x30')]();};}function saveUpdates(_0x32c066,_0x45ae19){return function(_0x1f38d3){if(_0x1f38d3){return _0x1f38d3[_0x4f49('0x31')](_0x32c066)[_0x4f49('0x32')](function(_0xf65ac6){return _0xf65ac6;});}return null;};}function removeEntity(_0x29ff83,_0x6625cd){return function(_0x135d17){if(_0x135d17){return _0x135d17[_0x4f49('0x33')]()[_0x4f49('0x32')](function(){_0x29ff83[_0x4f49('0x28')](0xcc)[_0x4f49('0x27')]();});}};}function handleEntityNotFound(_0x492b16,_0x45d0d2){return function(_0x46b7ba){if(!_0x46b7ba){_0x492b16[_0x4f49('0x26')](0x194);}return _0x46b7ba;};}function handleError(_0x1cb3cc,_0x1c3af8){_0x1c3af8=_0x1c3af8||0x1f4;return function(_0x15e82b){logger[_0x4f49('0x21')](_0x15e82b[_0x4f49('0x34')]);if(_0x15e82b[_0x4f49('0x35')]){delete _0x15e82b[_0x4f49('0x35')];}_0x1cb3cc[_0x4f49('0x28')](_0x1c3af8)[_0x4f49('0x36')](_0x15e82b);};}exports[_0x4f49('0x37')]=function(_0x4d2d57,_0x371282){var _0x27b7a9={},_0x36000a={},_0x26014f={'count':0x0,'rows':[]};var _0x1c1e9b=_[_0x4f49('0x38')](db[_0x4f49('0x39')][_0x4f49('0x3a')],function(_0x10bfc4){return{'name':_0x10bfc4[_0x4f49('0x3b')],'type':_0x10bfc4[_0x4f49('0x3c')][_0x4f49('0x3d')]};});_0x36000a[_0x4f49('0x3e')]=_[_0x4f49('0x38')](_0x1c1e9b,'name');_0x36000a[_0x4f49('0x3f')]=_[_0x4f49('0x40')](_0x4d2d57['query']);_0x36000a[_0x4f49('0x41')]=_[_0x4f49('0x42')](_0x36000a['model'],_0x36000a[_0x4f49('0x3f')]);_0x27b7a9[_0x4f49('0x43')]=_[_0x4f49('0x42')](_0x36000a[_0x4f49('0x3e')],qs[_0x4f49('0x44')](_0x4d2d57[_0x4f49('0x3f')][_0x4f49('0x44')]));_0x27b7a9['attributes']=_0x27b7a9['attributes']['length']?_0x27b7a9[_0x4f49('0x43')]:_0x36000a[_0x4f49('0x3e')];if(!_0x4d2d57[_0x4f49('0x3f')][_0x4f49('0x45')](_0x4f49('0x46'))){_0x27b7a9[_0x4f49('0x47')]=qs[_0x4f49('0x47')](_0x4d2d57[_0x4f49('0x3f')][_0x4f49('0x47')]);_0x27b7a9['offset']=qs['offset'](_0x4d2d57[_0x4f49('0x3f')][_0x4f49('0x2b')]);}_0x27b7a9[_0x4f49('0x48')]=qs['sort'](_0x4d2d57[_0x4f49('0x3f')]['sort']);_0x27b7a9['where']=qs[_0x4f49('0x41')](_[_0x4f49('0x49')](_0x4d2d57[_0x4f49('0x3f')],_0x36000a['filters']));if(_0x4d2d57[_0x4f49('0x3f')][_0x4f49('0x4a')]){_0x27b7a9['where']=_[_0x4f49('0x4b')](_0x27b7a9['where'],{'$or':_[_0x4f49('0x38')](_0x1c1e9b,function(_0xb9601){if(_0xb9601[_0x4f49('0x3c')]!=='VIRTUAL'){var _0x23a0fc={};_0x23a0fc[_0xb9601[_0x4f49('0x35')]]={'$like':'%'+_0x4d2d57[_0x4f49('0x3f')][_0x4f49('0x4a')]+'%'};return _0x23a0fc;}})});}_0x27b7a9=_[_0x4f49('0x4b')]({},_0x27b7a9,_0x4d2d57[_0x4f49('0x4c')]);var _0xe66867={'where':_0x27b7a9[_0x4f49('0x4d')]};return db[_0x4f49('0x39')][_0x4f49('0x2a')](_0xe66867)['then'](function(_0x26c222){_0x26014f[_0x4f49('0x2a')]=_0x26c222;if(_0x4d2d57['query'][_0x4f49('0x4e')]){_0x27b7a9['include']=[{'all':!![]}];}return db[_0x4f49('0x39')][_0x4f49('0x4f')](_0x27b7a9);})[_0x4f49('0x32')](function(_0x300230){_0x26014f['rows']=_0x300230;return _0x26014f;})[_0x4f49('0x32')](respondWithFilteredResult(_0x371282,_0x27b7a9))[_0x4f49('0x50')](handleError(_0x371282,null));};exports[_0x4f49('0x51')]=function(_0x973099,_0x3ec266){var _0x72ea05={'raw':![],'where':{'id':_0x973099[_0x4f49('0x52')]['id']}},_0x37fdb7={};_0x37fdb7[_0x4f49('0x3e')]=_[_0x4f49('0x40')](db[_0x4f49('0x39')][_0x4f49('0x3a')]);_0x37fdb7[_0x4f49('0x3f')]=_[_0x4f49('0x40')](_0x973099[_0x4f49('0x3f')]);_0x37fdb7[_0x4f49('0x41')]=_['intersection'](_0x37fdb7['model'],_0x37fdb7[_0x4f49('0x3f')]);_0x72ea05[_0x4f49('0x43')]=_[_0x4f49('0x42')](_0x37fdb7[_0x4f49('0x3e')],qs[_0x4f49('0x44')](_0x973099[_0x4f49('0x3f')][_0x4f49('0x44')]));_0x72ea05['attributes']=_0x72ea05[_0x4f49('0x43')]['length']?_0x72ea05[_0x4f49('0x43')]:_0x37fdb7[_0x4f49('0x3e')];if(_0x973099[_0x4f49('0x3f')][_0x4f49('0x4e')]){_0x72ea05['include']=[{'all':!![]}];}_0x72ea05=_[_0x4f49('0x4b')]({},_0x72ea05,_0x973099['options']);return db['FreshsalesConfiguration'][_0x4f49('0x53')](_0x72ea05)[_0x4f49('0x32')](handleEntityNotFound(_0x3ec266,null))[_0x4f49('0x32')](respondWithResult(_0x3ec266,null))[_0x4f49('0x50')](handleError(_0x3ec266,null));};exports['create']=function(_0x599c51,_0xd7f47b){return db[_0x4f49('0x39')]['create'](_0x599c51[_0x4f49('0x54')],{})['then'](respondWithResult(_0xd7f47b,0xc9))['catch'](handleError(_0xd7f47b,null));};exports[_0x4f49('0x31')]=function(_0x5f3a80,_0xfa7dd6){if(_0x5f3a80['body']['id']){delete _0x5f3a80[_0x4f49('0x54')]['id'];}return db[_0x4f49('0x39')][_0x4f49('0x53')]({'where':{'id':_0x5f3a80[_0x4f49('0x52')]['id']}})[_0x4f49('0x32')](handleEntityNotFound(_0xfa7dd6,null))[_0x4f49('0x32')](saveUpdates(_0x5f3a80[_0x4f49('0x54')],null))[_0x4f49('0x32')](respondWithResult(_0xfa7dd6,null))['catch'](handleError(_0xfa7dd6,null));};exports[_0x4f49('0x33')]=function(_0x51f57e,_0x213608){return db[_0x4f49('0x39')][_0x4f49('0x53')]({'where':{'id':_0x51f57e[_0x4f49('0x52')]['id']}})[_0x4f49('0x32')](handleEntityNotFound(_0x213608,null))[_0x4f49('0x32')](removeEntity(_0x213608,null))['catch'](handleError(_0x213608,null));};exports[_0x4f49('0x55')]=function(_0xd3689c,_0x5e3568,_0x5d2b3c){var _0x121c04={};var _0x447dde={};var _0x2e0df5;var _0x2409f1;return db[_0x4f49('0x39')]['findOne']({'where':{'id':_0xd3689c[_0x4f49('0x52')]['id']}})['then'](handleEntityNotFound(_0x5e3568,null))[_0x4f49('0x32')](function(_0x372dfd){if(_0x372dfd){_0x2e0df5=_0x372dfd;_0x447dde[_0x4f49('0x3e')]=_['keys'](db[_0x4f49('0x56')][_0x4f49('0x3a')]);_0x447dde[_0x4f49('0x3f')]=_[_0x4f49('0x40')](_0xd3689c['query']);_0x447dde[_0x4f49('0x41')]=_[_0x4f49('0x42')](_0x447dde['model'],_0x447dde[_0x4f49('0x3f')]);_0x121c04[_0x4f49('0x43')]=_[_0x4f49('0x42')](_0x447dde[_0x4f49('0x3e')],qs[_0x4f49('0x44')](_0xd3689c[_0x4f49('0x3f')][_0x4f49('0x44')]));_0x121c04[_0x4f49('0x43')]=_0x121c04['attributes'][_0x4f49('0x57')]?_0x121c04[_0x4f49('0x43')]:_0x447dde[_0x4f49('0x3e')];_0x121c04[_0x4f49('0x48')]=qs[_0x4f49('0x58')](_0xd3689c[_0x4f49('0x3f')][_0x4f49('0x58')]);_0x121c04['where']=qs[_0x4f49('0x41')](_['pick'](_0xd3689c[_0x4f49('0x3f')],_0x447dde[_0x4f49('0x41')]));if(_0xd3689c[_0x4f49('0x3f')][_0x4f49('0x4a')]){_0x121c04[_0x4f49('0x4d')]=_[_0x4f49('0x4b')](_0x121c04[_0x4f49('0x4d')],{'$or':_[_0x4f49('0x38')](_0x121c04[_0x4f49('0x43')],function(_0x176a6a){var _0x545552={};_0x545552[_0x176a6a]={'$like':'%'+_0xd3689c[_0x4f49('0x3f')][_0x4f49('0x4a')]+'%'};return _0x545552;})});}_0x121c04=_[_0x4f49('0x4b')]({},_0x121c04,_0xd3689c[_0x4f49('0x4c')]);return _0x2e0df5['getSubjects'](_0x121c04);}})['then'](function(_0x28e8ae){if(_0x28e8ae){_0x2409f1=_0x28e8ae['length'];if(!_0xd3689c[_0x4f49('0x3f')][_0x4f49('0x45')](_0x4f49('0x46'))){_0x121c04[_0x4f49('0x47')]=qs[_0x4f49('0x47')](_0xd3689c[_0x4f49('0x3f')][_0x4f49('0x47')]);_0x121c04[_0x4f49('0x2b')]=qs[_0x4f49('0x2b')](_0xd3689c[_0x4f49('0x3f')][_0x4f49('0x2b')]);}return _0x2e0df5[_0x4f49('0x55')](_0x121c04);}})[_0x4f49('0x32')](function(_0xd53de8){if(_0xd53de8){return _0xd53de8?{'count':_0x2409f1,'rows':_0xd53de8}:null;}})[_0x4f49('0x32')](respondWithResult(_0x5e3568,null))[_0x4f49('0x50')](handleError(_0x5e3568,null));};exports[_0x4f49('0x59')]=function(_0x753863,_0x1f9161,_0x1434ea){var _0x2c3962={};var _0x3e9389={};var _0xf6d04b;var _0x4683f8;return db[_0x4f49('0x39')]['findOne']({'where':{'id':_0x753863[_0x4f49('0x52')]['id']}})['then'](handleEntityNotFound(_0x1f9161,null))[_0x4f49('0x32')](function(_0x3b0990){if(_0x3b0990){_0xf6d04b=_0x3b0990;_0x3e9389[_0x4f49('0x3e')]=_[_0x4f49('0x40')](db[_0x4f49('0x56')][_0x4f49('0x3a')]);_0x3e9389[_0x4f49('0x3f')]=_[_0x4f49('0x40')](_0x753863[_0x4f49('0x3f')]);_0x3e9389['filters']=_['intersection'](_0x3e9389[_0x4f49('0x3e')],_0x3e9389['query']);_0x2c3962[_0x4f49('0x43')]=_[_0x4f49('0x42')](_0x3e9389[_0x4f49('0x3e')],qs[_0x4f49('0x44')](_0x753863[_0x4f49('0x3f')]['fields']));_0x2c3962['attributes']=_0x2c3962[_0x4f49('0x43')][_0x4f49('0x57')]?_0x2c3962['attributes']:_0x3e9389[_0x4f49('0x3e')];_0x2c3962[_0x4f49('0x48')]=qs['sort'](_0x753863[_0x4f49('0x3f')]['sort']);_0x2c3962[_0x4f49('0x4d')]=qs[_0x4f49('0x41')](_['pick'](_0x753863[_0x4f49('0x3f')],_0x3e9389[_0x4f49('0x41')]));if(_0x753863[_0x4f49('0x3f')][_0x4f49('0x4a')]){_0x2c3962[_0x4f49('0x4d')]=_[_0x4f49('0x4b')](_0x2c3962['where'],{'$or':_[_0x4f49('0x38')](_0x2c3962['attributes'],function(_0x3ecc94){var _0x574343={};_0x574343[_0x3ecc94]={'$like':'%'+_0x753863[_0x4f49('0x3f')]['filter']+'%'};return _0x574343;})});}_0x2c3962=_[_0x4f49('0x4b')]({},_0x2c3962,_0x753863[_0x4f49('0x4c')]);return _0xf6d04b[_0x4f49('0x59')](_0x2c3962);}})[_0x4f49('0x32')](function(_0x47af99){if(_0x47af99){_0x4683f8=_0x47af99[_0x4f49('0x57')];if(!_0x753863['query'][_0x4f49('0x45')]('nolimit')){_0x2c3962[_0x4f49('0x47')]=qs['limit'](_0x753863['query'][_0x4f49('0x47')]);_0x2c3962[_0x4f49('0x2b')]=qs[_0x4f49('0x2b')](_0x753863['query'][_0x4f49('0x2b')]);}return _0xf6d04b[_0x4f49('0x59')](_0x2c3962);}})['then'](function(_0x5d52ae){if(_0x5d52ae){return _0x5d52ae?{'count':_0x4683f8,'rows':_0x5d52ae}:null;}})['then'](respondWithResult(_0x1f9161,null))[_0x4f49('0x50')](handleError(_0x1f9161,null));};exports[_0x4f49('0x5a')]=function(_0x38a515,_0x87439,_0x1643fc){var _0x517144={};var _0x15b7e4={};var _0x1b922e;var _0x29de92;return db['FreshsalesConfiguration'][_0x4f49('0x5b')]({'where':{'id':_0x38a515[_0x4f49('0x52')]['id']}})[_0x4f49('0x32')](handleEntityNotFound(_0x87439,null))[_0x4f49('0x32')](function(_0x5ea6b4){if(_0x5ea6b4){_0x1b922e=_0x5ea6b4;_0x15b7e4[_0x4f49('0x3e')]=_[_0x4f49('0x40')](db[_0x4f49('0x56')][_0x4f49('0x3a')]);_0x15b7e4[_0x4f49('0x3f')]=_['keys'](_0x38a515[_0x4f49('0x3f')]);_0x15b7e4[_0x4f49('0x41')]=_['intersection'](_0x15b7e4[_0x4f49('0x3e')],_0x15b7e4['query']);_0x517144[_0x4f49('0x43')]=_['intersection'](_0x15b7e4[_0x4f49('0x3e')],qs[_0x4f49('0x44')](_0x38a515[_0x4f49('0x3f')][_0x4f49('0x44')]));_0x517144[_0x4f49('0x43')]=_0x517144['attributes'][_0x4f49('0x57')]?_0x517144[_0x4f49('0x43')]:_0x15b7e4[_0x4f49('0x3e')];_0x517144[_0x4f49('0x48')]=qs['sort'](_0x38a515[_0x4f49('0x3f')]['sort']);_0x517144[_0x4f49('0x4d')]=qs['filters'](_[_0x4f49('0x49')](_0x38a515[_0x4f49('0x3f')],_0x15b7e4[_0x4f49('0x41')]));if(_0x38a515[_0x4f49('0x3f')][_0x4f49('0x4a')]){_0x517144[_0x4f49('0x4d')]=_[_0x4f49('0x4b')](_0x517144[_0x4f49('0x4d')],{'$or':_[_0x4f49('0x38')](_0x517144[_0x4f49('0x43')],function(_0x5e6c35){var _0x33098a={};_0x33098a[_0x5e6c35]={'$like':'%'+_0x38a515[_0x4f49('0x3f')][_0x4f49('0x4a')]+'%'};return _0x33098a;})});}_0x517144=_[_0x4f49('0x4b')]({},_0x517144,_0x38a515[_0x4f49('0x4c')]);return _0x1b922e[_0x4f49('0x5a')](_0x517144);}})['then'](function(_0x2ec42b){if(_0x2ec42b){_0x29de92=_0x2ec42b[_0x4f49('0x57')];if(!_0x38a515[_0x4f49('0x3f')][_0x4f49('0x45')]('nolimit')){_0x517144[_0x4f49('0x47')]=qs['limit'](_0x38a515[_0x4f49('0x3f')][_0x4f49('0x47')]);_0x517144[_0x4f49('0x2b')]=qs[_0x4f49('0x2b')](_0x38a515['query'][_0x4f49('0x2b')]);}return _0x1b922e[_0x4f49('0x5a')](_0x517144);}})[_0x4f49('0x32')](function(_0x1c053d){if(_0x1c053d){return _0x1c053d?{'count':_0x29de92,'rows':_0x1c053d}:null;}})[_0x4f49('0x32')](respondWithResult(_0x87439,null))[_0x4f49('0x50')](handleError(_0x87439,null));}; \ No newline at end of file +var _0x56e7=['rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','find','create','body','getSubjects','findOne','params','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','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','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','count','offset','limit','set','Content-Range','json','reject','update','destroy','sendStatus','send','index','map','FreshsalesConfiguration'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x56e7,0x7b));var _0x756e=function(_0x5bc4e1,_0x39d898){_0x5bc4e1=_0x5bc4e1-0x0;var _0x2fccc3=_0x56e7[_0x5bc4e1];return _0x2fccc3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x756e('0x0'));var rimraf=require(_0x756e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x756e('0x2'));var rp=require(_0x756e('0x3'));var moment=require(_0x756e('0x4'));var BPromise=require(_0x756e('0x5'));var Mustache=require(_0x756e('0x6'));var util=require(_0x756e('0x7'));var path=require(_0x756e('0x8'));var sox=require('sox');var csv=require(_0x756e('0x9'));var ejs=require(_0x756e('0xa'));var fs=require('fs');var _=require(_0x756e('0xb'));var squel=require(_0x756e('0xc'));var crypto=require('crypto');var jsforce=require(_0x756e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x756e('0x9'));var querystring=require(_0x756e('0xe'));var Papa=require(_0x756e('0xf'));var Redis=require(_0x756e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x756e('0x11'));var hardwareService=require(_0x756e('0x12'));var logger=require(_0x756e('0x13'))('api');var utils=require(_0x756e('0x14'));var config=require(_0x756e('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x756e('0x16')]['http']({'port':0x232a});function checkPasswordPattern(_0x459237,_0x21701a,_0x38d5e9){if(_0x38d5e9){var _0x136052=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x136052[_0x756e('0x17')](_0x21701a)){return _0x459237;}else{throw new db['Sequelize']['ValidationError'](_0x756e('0x18'));}}else{return _0x459237;}}function respondWithRpcPromise(_0x11f37b,_0xccccd4,_0x59956f,_0x530e36){return new BPromise(function(_0x1f7161,_0x33dd9c){var _0x1cf73d=_0x530e36||client;return _0x1cf73d[_0x756e('0x19')](_0x11f37b,_0x59956f)[_0x756e('0x1a')](function(_0x285290){logger[_0x756e('0x1b')](_0x756e('0x1c'),_0xccccd4,_0x756e('0x1d'));logger['debug'](_0x756e('0x1e'),_0xccccd4,'request\x20sent',JSON['stringify'](_0x285290));if(_0x285290[_0x756e('0x1f')]){if(_0x285290[_0x756e('0x1f')][_0x756e('0x20')]===0x1f4){logger[_0x756e('0x1f')](_0x756e('0x1c'),_0xccccd4,_0x285290[_0x756e('0x1f')][_0x756e('0x21')]);return _0x33dd9c(_0x285290[_0x756e('0x1f')][_0x756e('0x21')]);}logger[_0x756e('0x1f')](_0x756e('0x1c'),_0xccccd4,_0x285290[_0x756e('0x1f')][_0x756e('0x21')]);return _0x1f7161(_0x285290[_0x756e('0x1f')][_0x756e('0x21')]);}else{logger[_0x756e('0x1b')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xccccd4,_0x756e('0x1d'));_0x1f7161(_0x285290['result'][_0x756e('0x21')]);}})[_0x756e('0x22')](function(_0x43cc04){logger[_0x756e('0x1f')]('FreshsalesConfiguration,\x20%s,\x20%s',_0xccccd4,_0x43cc04);_0x33dd9c(_0x43cc04);});});}function respondWithStatusCode(_0x3ef5ef,_0x4cbd7){_0x4cbd7=_0x4cbd7||0xcc;return function(_0x2f4db8){if(_0x2f4db8){return _0x3ef5ef['sendStatus'](_0x4cbd7);}return _0x3ef5ef[_0x756e('0x23')](_0x4cbd7)[_0x756e('0x24')]();};}function respondWithResult(_0x29dffb,_0x555912){_0x555912=_0x555912||0xc8;return function(_0xf09ae3){if(_0xf09ae3){return _0x29dffb[_0x756e('0x23')](_0x555912)['json'](_0xf09ae3);}};}function respondWithFilteredResult(_0x39befb,_0x43df79){return function(_0x345162){if(_0x345162){var _0x5a1cf0=_0x345162[_0x756e('0x25')],_0x3c332e=_0x43df79[_0x756e('0x26')],_0x308153=_0x43df79['offset']+_0x43df79[_0x756e('0x27')],_0x5c6949;if(_0x308153>=_0x5a1cf0){_0x308153=_0x5a1cf0;_0x5c6949=0xc8;}else{_0x5c6949=0xce;}_0x39befb[_0x756e('0x23')](_0x5c6949);return _0x39befb[_0x756e('0x28')](_0x756e('0x29'),_0x3c332e+'-'+_0x308153+'/'+_0x5a1cf0)[_0x756e('0x2a')](_0x345162);}return null;};}function patchUpdates(_0x4fdb97){return function(_0x2e2558){try{jsonpatch['apply'](_0x2e2558,_0x4fdb97,!![]);}catch(_0x47b17c){return BPromise[_0x756e('0x2b')](_0x47b17c);}return _0x2e2558['save']();};}function saveUpdates(_0x2e00ec,_0x6a3661){return function(_0x6aaf10){if(_0x6aaf10){return _0x6aaf10[_0x756e('0x2c')](_0x2e00ec)[_0x756e('0x1a')](function(_0x17d9d1){return _0x17d9d1;});}return null;};}function removeEntity(_0x39ad1c,_0xd3903){return function(_0x25457a){if(_0x25457a){return _0x25457a[_0x756e('0x2d')]()[_0x756e('0x1a')](function(){_0x39ad1c[_0x756e('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x523f09,_0x1d116){return function(_0x3204b9){if(!_0x3204b9){_0x523f09[_0x756e('0x2e')](0x194);}return _0x3204b9;};}function handleError(_0x8c29ea,_0x254efe){_0x254efe=_0x254efe||0x1f4;return function(_0x31a507){logger[_0x756e('0x1f')](_0x31a507['stack']);if(_0x31a507['name']){delete _0x31a507['name'];}_0x8c29ea[_0x756e('0x23')](_0x254efe)[_0x756e('0x2f')](_0x31a507);};}exports[_0x756e('0x30')]=function(_0x4fadda,_0x32958b){var _0x2d8a29={},_0x5d1575={},_0x3ece0f={'count':0x0,'rows':[]};var _0x341e35=_[_0x756e('0x31')](db[_0x756e('0x32')][_0x756e('0x33')],function(_0x26965c){return{'name':_0x26965c[_0x756e('0x34')],'type':_0x26965c[_0x756e('0x35')]['key']};});_0x5d1575[_0x756e('0x36')]=_[_0x756e('0x31')](_0x341e35,_0x756e('0x37'));_0x5d1575[_0x756e('0x38')]=_[_0x756e('0x39')](_0x4fadda[_0x756e('0x38')]);_0x5d1575[_0x756e('0x3a')]=_[_0x756e('0x3b')](_0x5d1575[_0x756e('0x36')],_0x5d1575[_0x756e('0x38')]);_0x2d8a29['attributes']=_[_0x756e('0x3b')](_0x5d1575[_0x756e('0x36')],qs['fields'](_0x4fadda[_0x756e('0x38')][_0x756e('0x3c')]));_0x2d8a29[_0x756e('0x3d')]=_0x2d8a29['attributes'][_0x756e('0x3e')]?_0x2d8a29[_0x756e('0x3d')]:_0x5d1575[_0x756e('0x36')];if(!_0x4fadda['query'][_0x756e('0x3f')](_0x756e('0x40'))){_0x2d8a29[_0x756e('0x27')]=qs[_0x756e('0x27')](_0x4fadda[_0x756e('0x38')][_0x756e('0x27')]);_0x2d8a29['offset']=qs[_0x756e('0x26')](_0x4fadda[_0x756e('0x38')]['offset']);}_0x2d8a29[_0x756e('0x41')]=qs[_0x756e('0x42')](_0x4fadda[_0x756e('0x38')][_0x756e('0x42')]);_0x2d8a29[_0x756e('0x43')]=qs[_0x756e('0x3a')](_[_0x756e('0x44')](_0x4fadda[_0x756e('0x38')],_0x5d1575[_0x756e('0x3a')]));if(_0x4fadda['query'][_0x756e('0x45')]){_0x2d8a29['where']=_[_0x756e('0x46')](_0x2d8a29[_0x756e('0x43')],{'$or':_[_0x756e('0x31')](_0x341e35,function(_0x54248c){if(_0x54248c[_0x756e('0x35')]!==_0x756e('0x47')){var _0xf68a24={};_0xf68a24[_0x54248c['name']]={'$like':'%'+_0x4fadda['query'][_0x756e('0x45')]+'%'};return _0xf68a24;}})});}_0x2d8a29=_[_0x756e('0x46')]({},_0x2d8a29,_0x4fadda['options']);var _0x499da2={'where':_0x2d8a29[_0x756e('0x43')]};return db[_0x756e('0x32')][_0x756e('0x25')](_0x499da2)['then'](function(_0x3c70a1){_0x3ece0f['count']=_0x3c70a1;if(_0x4fadda[_0x756e('0x38')][_0x756e('0x48')]){_0x2d8a29[_0x756e('0x49')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x756e('0x4a')](_0x2d8a29);})['then'](function(_0x5064a3){_0x3ece0f[_0x756e('0x4b')]=_0x5064a3;return _0x3ece0f;})['then'](respondWithFilteredResult(_0x32958b,_0x2d8a29))[_0x756e('0x22')](handleError(_0x32958b,null));};exports[_0x756e('0x4c')]=function(_0xd6ee1b,_0x2512d3){var _0x95061c={'raw':![],'where':{'id':_0xd6ee1b['params']['id']}},_0x2fb384={};_0x2fb384[_0x756e('0x36')]=_['keys'](db[_0x756e('0x32')]['rawAttributes']);_0x2fb384[_0x756e('0x38')]=_['keys'](_0xd6ee1b[_0x756e('0x38')]);_0x2fb384['filters']=_[_0x756e('0x3b')](_0x2fb384[_0x756e('0x36')],_0x2fb384[_0x756e('0x38')]);_0x95061c['attributes']=_[_0x756e('0x3b')](_0x2fb384[_0x756e('0x36')],qs['fields'](_0xd6ee1b['query'][_0x756e('0x3c')]));_0x95061c[_0x756e('0x3d')]=_0x95061c[_0x756e('0x3d')][_0x756e('0x3e')]?_0x95061c[_0x756e('0x3d')]:_0x2fb384[_0x756e('0x36')];if(_0xd6ee1b[_0x756e('0x38')][_0x756e('0x48')]){_0x95061c[_0x756e('0x49')]=[{'all':!![]}];}_0x95061c=_['merge']({},_0x95061c,_0xd6ee1b[_0x756e('0x4d')]);return db[_0x756e('0x32')][_0x756e('0x4e')](_0x95061c)[_0x756e('0x1a')](handleEntityNotFound(_0x2512d3,null))[_0x756e('0x1a')](respondWithResult(_0x2512d3,null))[_0x756e('0x22')](handleError(_0x2512d3,null));};exports[_0x756e('0x4f')]=function(_0x15c159,_0x4da157){return db[_0x756e('0x32')][_0x756e('0x4f')](_0x15c159['body'],{})[_0x756e('0x1a')](respondWithResult(_0x4da157,0xc9))['catch'](handleError(_0x4da157,null));};exports[_0x756e('0x2c')]=function(_0xa5d6a3,_0x1d0b60){if(_0xa5d6a3['body']['id']){delete _0xa5d6a3[_0x756e('0x50')]['id'];}return db[_0x756e('0x32')][_0x756e('0x4e')]({'where':{'id':_0xa5d6a3['params']['id']}})[_0x756e('0x1a')](handleEntityNotFound(_0x1d0b60,null))['then'](saveUpdates(_0xa5d6a3[_0x756e('0x50')],null))[_0x756e('0x1a')](respondWithResult(_0x1d0b60,null))[_0x756e('0x22')](handleError(_0x1d0b60,null));};exports[_0x756e('0x2d')]=function(_0x3c9248,_0x413061){return db[_0x756e('0x32')][_0x756e('0x4e')]({'where':{'id':_0x3c9248['params']['id']}})[_0x756e('0x1a')](handleEntityNotFound(_0x413061,null))[_0x756e('0x1a')](removeEntity(_0x413061,null))[_0x756e('0x22')](handleError(_0x413061,null));};exports[_0x756e('0x51')]=function(_0x3c3cc3,_0x7c1c21,_0x14d02b){var _0x2a280a={};var _0x2ed6dd={};var _0xa78775;var _0x237a29;return db[_0x756e('0x32')][_0x756e('0x52')]({'where':{'id':_0x3c3cc3[_0x756e('0x53')]['id']}})['then'](handleEntityNotFound(_0x7c1c21,null))[_0x756e('0x1a')](function(_0x9b1c8a){if(_0x9b1c8a){_0xa78775=_0x9b1c8a;_0x2ed6dd[_0x756e('0x36')]=_[_0x756e('0x39')](db[_0x756e('0x54')][_0x756e('0x33')]);_0x2ed6dd['query']=_[_0x756e('0x39')](_0x3c3cc3[_0x756e('0x38')]);_0x2ed6dd[_0x756e('0x3a')]=_[_0x756e('0x3b')](_0x2ed6dd['model'],_0x2ed6dd['query']);_0x2a280a[_0x756e('0x3d')]=_[_0x756e('0x3b')](_0x2ed6dd[_0x756e('0x36')],qs[_0x756e('0x3c')](_0x3c3cc3['query'][_0x756e('0x3c')]));_0x2a280a[_0x756e('0x3d')]=_0x2a280a[_0x756e('0x3d')][_0x756e('0x3e')]?_0x2a280a['attributes']:_0x2ed6dd['model'];_0x2a280a[_0x756e('0x41')]=qs[_0x756e('0x42')](_0x3c3cc3[_0x756e('0x38')][_0x756e('0x42')]);_0x2a280a[_0x756e('0x43')]=qs[_0x756e('0x3a')](_[_0x756e('0x44')](_0x3c3cc3[_0x756e('0x38')],_0x2ed6dd['filters']));if(_0x3c3cc3['query'][_0x756e('0x45')]){_0x2a280a[_0x756e('0x43')]=_[_0x756e('0x46')](_0x2a280a[_0x756e('0x43')],{'$or':_[_0x756e('0x31')](_0x2a280a[_0x756e('0x3d')],function(_0x1ce418){var _0x580b66={};_0x580b66[_0x1ce418]={'$like':'%'+_0x3c3cc3[_0x756e('0x38')]['filter']+'%'};return _0x580b66;})});}_0x2a280a=_[_0x756e('0x46')]({},_0x2a280a,_0x3c3cc3['options']);return _0xa78775[_0x756e('0x51')](_0x2a280a);}})[_0x756e('0x1a')](function(_0x1e4ee4){if(_0x1e4ee4){_0x237a29=_0x1e4ee4['length'];if(!_0x3c3cc3[_0x756e('0x38')][_0x756e('0x3f')](_0x756e('0x40'))){_0x2a280a[_0x756e('0x27')]=qs[_0x756e('0x27')](_0x3c3cc3[_0x756e('0x38')][_0x756e('0x27')]);_0x2a280a['offset']=qs['offset'](_0x3c3cc3[_0x756e('0x38')][_0x756e('0x26')]);}return _0xa78775[_0x756e('0x51')](_0x2a280a);}})[_0x756e('0x1a')](function(_0x2c4dc5){if(_0x2c4dc5){return _0x2c4dc5?{'count':_0x237a29,'rows':_0x2c4dc5}:null;}})[_0x756e('0x1a')](respondWithResult(_0x7c1c21,null))['catch'](handleError(_0x7c1c21,null));};exports[_0x756e('0x55')]=function(_0x228182,_0x190752,_0x2fa04b){var _0x338f50={};var _0x2b564a={};var _0x4c20c4;var _0x3041da;return db['FreshsalesConfiguration'][_0x756e('0x52')]({'where':{'id':_0x228182[_0x756e('0x53')]['id']}})[_0x756e('0x1a')](handleEntityNotFound(_0x190752,null))[_0x756e('0x1a')](function(_0x975c7b){if(_0x975c7b){_0x4c20c4=_0x975c7b;_0x2b564a['model']=_['keys'](db[_0x756e('0x54')]['rawAttributes']);_0x2b564a[_0x756e('0x38')]=_['keys'](_0x228182[_0x756e('0x38')]);_0x2b564a['filters']=_[_0x756e('0x3b')](_0x2b564a[_0x756e('0x36')],_0x2b564a[_0x756e('0x38')]);_0x338f50['attributes']=_[_0x756e('0x3b')](_0x2b564a['model'],qs[_0x756e('0x3c')](_0x228182[_0x756e('0x38')][_0x756e('0x3c')]));_0x338f50[_0x756e('0x3d')]=_0x338f50[_0x756e('0x3d')][_0x756e('0x3e')]?_0x338f50[_0x756e('0x3d')]:_0x2b564a['model'];_0x338f50[_0x756e('0x41')]=qs[_0x756e('0x42')](_0x228182['query'][_0x756e('0x42')]);_0x338f50['where']=qs['filters'](_[_0x756e('0x44')](_0x228182['query'],_0x2b564a[_0x756e('0x3a')]));if(_0x228182['query'][_0x756e('0x45')]){_0x338f50['where']=_[_0x756e('0x46')](_0x338f50[_0x756e('0x43')],{'$or':_[_0x756e('0x31')](_0x338f50[_0x756e('0x3d')],function(_0xf9cb3a){var _0x247725={};_0x247725[_0xf9cb3a]={'$like':'%'+_0x228182[_0x756e('0x38')][_0x756e('0x45')]+'%'};return _0x247725;})});}_0x338f50=_[_0x756e('0x46')]({},_0x338f50,_0x228182[_0x756e('0x4d')]);return _0x4c20c4[_0x756e('0x55')](_0x338f50);}})[_0x756e('0x1a')](function(_0x9cdab6){if(_0x9cdab6){_0x3041da=_0x9cdab6['length'];if(!_0x228182['query'][_0x756e('0x3f')](_0x756e('0x40'))){_0x338f50[_0x756e('0x27')]=qs[_0x756e('0x27')](_0x228182[_0x756e('0x38')][_0x756e('0x27')]);_0x338f50[_0x756e('0x26')]=qs['offset'](_0x228182[_0x756e('0x38')][_0x756e('0x26')]);}return _0x4c20c4[_0x756e('0x55')](_0x338f50);}})[_0x756e('0x1a')](function(_0xcfaaba){if(_0xcfaaba){return _0xcfaaba?{'count':_0x3041da,'rows':_0xcfaaba}:null;}})['then'](respondWithResult(_0x190752,null))[_0x756e('0x22')](handleError(_0x190752,null));};exports['getFields']=function(_0x5a95ee,_0x45dfd2,_0x48b8e8){var _0x863f9={};var _0x1d5cc3={};var _0x502719;var _0x4130e3;return db[_0x756e('0x32')][_0x756e('0x52')]({'where':{'id':_0x5a95ee[_0x756e('0x53')]['id']}})[_0x756e('0x1a')](handleEntityNotFound(_0x45dfd2,null))['then'](function(_0x3498dd){if(_0x3498dd){_0x502719=_0x3498dd;_0x1d5cc3[_0x756e('0x36')]=_[_0x756e('0x39')](db[_0x756e('0x54')][_0x756e('0x33')]);_0x1d5cc3['query']=_['keys'](_0x5a95ee['query']);_0x1d5cc3[_0x756e('0x3a')]=_['intersection'](_0x1d5cc3[_0x756e('0x36')],_0x1d5cc3[_0x756e('0x38')]);_0x863f9[_0x756e('0x3d')]=_['intersection'](_0x1d5cc3[_0x756e('0x36')],qs['fields'](_0x5a95ee[_0x756e('0x38')]['fields']));_0x863f9[_0x756e('0x3d')]=_0x863f9[_0x756e('0x3d')][_0x756e('0x3e')]?_0x863f9[_0x756e('0x3d')]:_0x1d5cc3[_0x756e('0x36')];_0x863f9[_0x756e('0x41')]=qs[_0x756e('0x42')](_0x5a95ee[_0x756e('0x38')][_0x756e('0x42')]);_0x863f9['where']=qs[_0x756e('0x3a')](_[_0x756e('0x44')](_0x5a95ee[_0x756e('0x38')],_0x1d5cc3[_0x756e('0x3a')]));if(_0x5a95ee[_0x756e('0x38')][_0x756e('0x45')]){_0x863f9[_0x756e('0x43')]=_[_0x756e('0x46')](_0x863f9[_0x756e('0x43')],{'$or':_[_0x756e('0x31')](_0x863f9[_0x756e('0x3d')],function(_0x44a587){var _0x586579={};_0x586579[_0x44a587]={'$like':'%'+_0x5a95ee[_0x756e('0x38')][_0x756e('0x45')]+'%'};return _0x586579;})});}_0x863f9=_[_0x756e('0x46')]({},_0x863f9,_0x5a95ee[_0x756e('0x4d')]);return _0x502719[_0x756e('0x56')](_0x863f9);}})[_0x756e('0x1a')](function(_0x2287b1){if(_0x2287b1){_0x4130e3=_0x2287b1[_0x756e('0x3e')];if(!_0x5a95ee[_0x756e('0x38')][_0x756e('0x3f')](_0x756e('0x40'))){_0x863f9[_0x756e('0x27')]=qs[_0x756e('0x27')](_0x5a95ee[_0x756e('0x38')]['limit']);_0x863f9[_0x756e('0x26')]=qs[_0x756e('0x26')](_0x5a95ee[_0x756e('0x38')][_0x756e('0x26')]);}return _0x502719[_0x756e('0x56')](_0x863f9);}})[_0x756e('0x1a')](function(_0x251584){if(_0x251584){return _0x251584?{'count':_0x4130e3,'rows':_0x251584}:null;}})[_0x756e('0x1a')](respondWithResult(_0x45dfd2,null))[_0x756e('0x22')](handleError(_0x45dfd2,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 445013d..56d42cc 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 _0xc423=['path','rimraf','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0xc423,0x159));var _0x3c42=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xc423[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x3c42('0x0'));var util=require(_0x3c42('0x1'));var logger=require(_0x3c42('0x2'))(_0x3c42('0x3'));var moment=require(_0x3c42('0x4'));var BPromise=require('bluebird');var rp=require(_0x3c42('0x5'));var fs=require('fs');var path=require(_0x3c42('0x6'));var rimraf=require(_0x3c42('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c42('0x8'));module[_0x3c42('0x9')]=function(_0x14e395,_0x1feba8){return _0x14e395[_0x3c42('0xa')](_0x3c42('0xb'),attributes,{'tableName':_0x3c42('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca56=['./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x47ffe6,_0x592f40){var _0x3c1724=function(_0x3e20a2){while(--_0x3e20a2){_0x47ffe6['push'](_0x47ffe6['shift']());}};_0x3c1724(++_0x592f40);}(_0xca56,0xee));var _0x6ca5=function(_0x5ae926,_0x43b832){_0x5ae926=_0x5ae926-0x0;var _0x4bde2d=_0xca56[_0x5ae926];return _0x4bde2d;};'use strict';var _=require(_0x6ca5('0x0'));var util=require(_0x6ca5('0x1'));var logger=require(_0x6ca5('0x2'))(_0x6ca5('0x3'));var moment=require(_0x6ca5('0x4'));var BPromise=require(_0x6ca5('0x5'));var rp=require(_0x6ca5('0x6'));var fs=require('fs');var path=require(_0x6ca5('0x7'));var rimraf=require(_0x6ca5('0x8'));var config=require('../../config/environment');var attributes=require(_0x6ca5('0x9'));module[_0x6ca5('0xa')]=function(_0x4440bd,_0x2c078a){return _0x4440bd['define'](_0x6ca5('0xb'),attributes,{'tableName':_0x6ca5('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 5d249fd..417b50f 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 _0x7980=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x53537c,_0x256227){var _0x53a442=function(_0x50d845){while(--_0x50d845){_0x53537c['push'](_0x53537c['shift']());}};_0x53a442(++_0x256227);}(_0x7980,0xab));var _0x0798=function(_0x46e2bb,_0x276efb){_0x46e2bb=_0x46e2bb-0x0;var _0x243efb=_0x7980[_0x46e2bb];return _0x243efb;};'use strict';var _=require(_0x0798('0x0'));var util=require(_0x0798('0x1'));var moment=require(_0x0798('0x2'));var BPromise=require(_0x0798('0x3'));var rs=require(_0x0798('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0798('0x5'))['db'];var utils=require(_0x0798('0x6'));var logger=require(_0x0798('0x7'))(_0x0798('0x8'));var config=require(_0x0798('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0798('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e534f,_0x34f808,_0x467859){return new BPromise(function(_0x54da10,_0x5151b3){return client[_0x0798('0xb')](_0x1e534f,_0x467859)[_0x0798('0xc')](function(_0x301a55){logger[_0x0798('0xd')](_0x0798('0xe'),_0x34f808,_0x0798('0xf'));logger[_0x0798('0x10')](_0x0798('0x11'),_0x34f808,_0x0798('0xf'),JSON[_0x0798('0x12')](_0x301a55));if(_0x301a55['error']){if(_0x301a55[_0x0798('0x13')][_0x0798('0x14')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x34f808,_0x301a55[_0x0798('0x13')][_0x0798('0x15')]);return _0x5151b3(_0x301a55[_0x0798('0x13')][_0x0798('0x15')]);}logger[_0x0798('0x13')](_0x0798('0xe'),_0x34f808,_0x301a55[_0x0798('0x13')]['message']);return _0x54da10(_0x301a55['error'][_0x0798('0x15')]);}else{logger[_0x0798('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x34f808,'request\x20sent');_0x54da10(_0x301a55[_0x0798('0x16')][_0x0798('0x15')]);}})[_0x0798('0x17')](function(_0x5dc617){logger['error'](_0x0798('0xe'),_0x34f808,_0x5dc617);_0x5151b3(_0x5dc617);});});} \ No newline at end of file +var _0x8c11=['rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x5d7738,_0x3f8cfa){var _0x14b96f=function(_0x214f13){while(--_0x214f13){_0x5d7738['push'](_0x5d7738['shift']());}};_0x14b96f(++_0x3f8cfa);}(_0x8c11,0xf5));var _0x18c1=function(_0x4ee79c,_0x44d6ca){_0x4ee79c=_0x4ee79c-0x0;var _0x484362=_0x8c11[_0x4ee79c];return _0x484362;};'use strict';var _=require(_0x18c1('0x0'));var util=require(_0x18c1('0x1'));var moment=require(_0x18c1('0x2'));var BPromise=require(_0x18c1('0x3'));var rs=require(_0x18c1('0x4'));var fs=require('fs');var Redis=require(_0x18c1('0x5'));var db=require(_0x18c1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x18c1('0x7'))(_0x18c1('0x8'));var config=require(_0x18c1('0x9'));var jayson=require(_0x18c1('0xa'));var client=jayson[_0x18c1('0xb')][_0x18c1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40bc72,_0x276eb7,_0x54519f){return new BPromise(function(_0x28fc68,_0x1477ca){return client['request'](_0x40bc72,_0x54519f)[_0x18c1('0xd')](function(_0x343480){logger[_0x18c1('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x276eb7,_0x18c1('0xf'));logger['debug']('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x276eb7,_0x18c1('0xf'),JSON[_0x18c1('0x10')](_0x343480));if(_0x343480[_0x18c1('0x11')]){if(_0x343480[_0x18c1('0x11')][_0x18c1('0x12')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x276eb7,_0x343480[_0x18c1('0x11')][_0x18c1('0x13')]);return _0x1477ca(_0x343480['error']['message']);}logger[_0x18c1('0x11')](_0x18c1('0x14'),_0x276eb7,_0x343480[_0x18c1('0x11')]['message']);return _0x28fc68(_0x343480['error']['message']);}else{logger[_0x18c1('0xe')](_0x18c1('0x14'),_0x276eb7,_0x18c1('0xf'));_0x28fc68(_0x343480[_0x18c1('0x15')]['message']);}})[_0x18c1('0x16')](function(_0x6306f1){logger[_0x18c1('0x11')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x276eb7,_0x6306f1);_0x1477ca(_0x6306f1);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index db42ca9..4f56b46 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 _0xe2c8=['put','update','delete','destroy','exports','multer','util','express','Router','../../components/interaction/service','isAuthenticated','index','get','/:id','post','create'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe2c8,0xd5));var _0x8e2c=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xe2c8[_0x1694f5];return _0x5b4321;};'use strict';var multer=require(_0x8e2c('0x0'));var util=require(_0x8e2c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8e2c('0x2'));var router=express[_0x8e2c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8e2c('0x4'));var config=require('../../config/environment');var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0x8e2c('0x5')](),controller[_0x8e2c('0x6')]);router[_0x8e2c('0x7')](_0x8e2c('0x8'),auth[_0x8e2c('0x5')](),controller['show']);router[_0x8e2c('0x9')]('/',auth[_0x8e2c('0x5')](),controller[_0x8e2c('0xa')]);router[_0x8e2c('0xb')](_0x8e2c('0x8'),auth[_0x8e2c('0x5')](),controller[_0x8e2c('0xc')]);router[_0x8e2c('0xd')]('/:id',auth[_0x8e2c('0x5')](),controller[_0x8e2c('0xe')]);module[_0x8e2c('0xf')]=router; \ No newline at end of file +var _0xda02=['put','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x5bc369,_0x59fa6d){var _0x58dbb0=function(_0x27b280){while(--_0x27b280){_0x5bc369['push'](_0x5bc369['shift']());}};_0x58dbb0(++_0x59fa6d);}(_0xda02,0xc9));var _0x2da0=function(_0x146837,_0x2aa6a2){_0x146837=_0x146837-0x0;var _0x3d7e60=_0xda02[_0x146837];return _0x3d7e60;};'use strict';var multer=require(_0x2da0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2da0('0x1'));var express=require(_0x2da0('0x2'));var router=express[_0x2da0('0x3')]();var auth=require(_0x2da0('0x4'));var interaction=require(_0x2da0('0x5'));var config=require(_0x2da0('0x6'));var controller=require(_0x2da0('0x7'));router[_0x2da0('0x8')]('/',auth[_0x2da0('0x9')](),controller[_0x2da0('0xa')]);router[_0x2da0('0x8')](_0x2da0('0xb'),auth['isAuthenticated'](),controller[_0x2da0('0xc')]);router[_0x2da0('0xd')]('/',auth[_0x2da0('0x9')](),controller[_0x2da0('0xe')]);router[_0x2da0('0xf')](_0x2da0('0xb'),auth[_0x2da0('0x9')](),controller['update']);router[_0x2da0('0x10')](_0x2da0('0xb'),auth[_0x2da0('0x9')](),controller[_0x2da0('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 2301268..ddd886e 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 _0x0590=['exports','string','variable','customVariable','keyValue','ENUM','STRING','BOOLEAN','sequelize'];(function(_0x157033,_0x398810){var _0x45d09f=function(_0x55086b){while(--_0x55086b){_0x157033['push'](_0x157033['shift']());}};_0x45d09f(++_0x398810);}(_0x0590,0x1d3));var _0x0059=function(_0x5a5399,_0x406fea){_0x5a5399=_0x5a5399-0x0;var _0x1537fd=_0x0590[_0x5a5399];return _0x1537fd;};'use strict';var Sequelize=require(_0x0059('0x0'));module[_0x0059('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0059('0x2'),_0x0059('0x3'),_0x0059('0x4'),_0x0059('0x5')),'defaultValue':_0x0059('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0059('0x6')](_0x0059('0x2'),_0x0059('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x0059('0x7')]},'idField':{'type':Sequelize[_0x0059('0x7')]},'nameField':{'type':Sequelize[_0x0059('0x7')]},'customField':{'type':Sequelize[_0x0059('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0059('0x7')]}}; \ No newline at end of file +var _0xd601=['variable','customVariable','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x43b5a7,_0xf5e3d6){var _0x5461fe=function(_0x5d9d5a){while(--_0x5d9d5a){_0x43b5a7['push'](_0x43b5a7['shift']());}};_0x5461fe(++_0xf5e3d6);}(_0xd601,0x17e));var _0x1d60=function(_0x180f82,_0xa7bbd5){_0x180f82=_0x180f82-0x0;var _0x36407e=_0xd601[_0x180f82];return _0x36407e;};'use strict';var Sequelize=require('sequelize');module[_0x1d60('0x0')]={'type':{'type':Sequelize[_0x1d60('0x1')](_0x1d60('0x2'),_0x1d60('0x3'),_0x1d60('0x4'),'keyValue'),'defaultValue':_0x1d60('0x2')},'content':{'type':Sequelize[_0x1d60('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1d60('0x1')](_0x1d60('0x2'),'variable',_0x1d60('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1d60('0x5')]},'nameField':{'type':Sequelize[_0x1d60('0x5')]},'customField':{'type':Sequelize[_0x1d60('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1d60('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index f17e562..76552ef 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 _0xb9be=['../../config/utils','../../mysqldb','count','offset','limit','status','set','Content-Range','json','apply','save','update','destroy','then','end','sendStatus','error','name','index','FreshsalesField','rawAttributes','fieldName','type','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','keys','options','find','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api'];(function(_0x4da6c4,_0x2f2213){var _0x48feaa=function(_0x4b42af){while(--_0x4b42af){_0x4da6c4['push'](_0x4da6c4['shift']());}};_0x48feaa(++_0x2f2213);}(_0xb9be,0xc5));var _0xeb9b=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xb9be[_0x35007a];return _0x574f68;};'use strict';var pdf=require(_0xeb9b('0x0'));var emlformat=require(_0xeb9b('0x1'));var rimraf=require(_0xeb9b('0x2'));var zipdir=require(_0xeb9b('0x3'));var jsonpatch=require(_0xeb9b('0x4'));var rp=require(_0xeb9b('0x5'));var moment=require(_0xeb9b('0x6'));var BPromise=require(_0xeb9b('0x7'));var Mustache=require(_0xeb9b('0x8'));var util=require('util');var path=require('path');var sox=require(_0xeb9b('0x9'));var csv=require(_0xeb9b('0xa'));var ejs=require(_0xeb9b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeb9b('0xc'));var crypto=require(_0xeb9b('0xd'));var jsforce=require(_0xeb9b('0xe'));var deskjs=require(_0xeb9b('0xf'));var toCsv=require(_0xeb9b('0xa'));var querystring=require(_0xeb9b('0x10'));var Papa=require(_0xeb9b('0x11'));var Redis=require(_0xeb9b('0x12'));var authService=require(_0xeb9b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb9b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb9b('0x15'));var utils=require(_0xeb9b('0x16'));var config=require('../../config/environment');var db=require(_0xeb9b('0x17'))['db'];function respondWithStatusCode(_0x1def58,_0x3df18a){_0x3df18a=_0x3df18a||0xcc;return function(_0x2a01df){if(_0x2a01df){return _0x1def58['sendStatus'](_0x3df18a);}return _0x1def58['status'](_0x3df18a)['end']();};}function respondWithResult(_0x355edb,_0x1ef03f){_0x1ef03f=_0x1ef03f||0xc8;return function(_0x2674e6){if(_0x2674e6){return _0x355edb['status'](_0x1ef03f)['json'](_0x2674e6);}};}function respondWithFilteredResult(_0x4f8182,_0x32538b){return function(_0x1a5f27){if(_0x1a5f27){var _0x406afd=_0x1a5f27[_0xeb9b('0x18')],_0x3fa308=_0x32538b['offset'],_0x2c9aa6=_0x32538b[_0xeb9b('0x19')]+_0x32538b[_0xeb9b('0x1a')],_0x10da6e;if(_0x2c9aa6>=_0x406afd){_0x2c9aa6=_0x406afd;_0x10da6e=0xc8;}else{_0x10da6e=0xce;}_0x4f8182[_0xeb9b('0x1b')](_0x10da6e);return _0x4f8182[_0xeb9b('0x1c')](_0xeb9b('0x1d'),_0x3fa308+'-'+_0x2c9aa6+'/'+_0x406afd)[_0xeb9b('0x1e')](_0x1a5f27);}return null;};}function patchUpdates(_0x21010e){return function(_0x3342c1){try{jsonpatch[_0xeb9b('0x1f')](_0x3342c1,_0x21010e,!![]);}catch(_0x26e312){return BPromise['reject'](_0x26e312);}return _0x3342c1[_0xeb9b('0x20')]();};}function saveUpdates(_0x5a7ffd,_0x5d5f54){return function(_0x580498){if(_0x580498){return _0x580498[_0xeb9b('0x21')](_0x5a7ffd)['then'](function(_0xbed5ce){return _0xbed5ce;});}return null;};}function removeEntity(_0x2dabb1,_0x37935c){return function(_0x37d7e0){if(_0x37d7e0){return _0x37d7e0[_0xeb9b('0x22')]()[_0xeb9b('0x23')](function(){_0x2dabb1[_0xeb9b('0x1b')](0xcc)[_0xeb9b('0x24')]();});}};}function handleEntityNotFound(_0x142d1c,_0x46df93){return function(_0x61c86d){if(!_0x61c86d){_0x142d1c[_0xeb9b('0x25')](0x194);}return _0x61c86d;};}function handleError(_0x1a4faf,_0xe6d3e1){_0xe6d3e1=_0xe6d3e1||0x1f4;return function(_0x2b2a14){logger[_0xeb9b('0x26')](_0x2b2a14['stack']);if(_0x2b2a14[_0xeb9b('0x27')]){delete _0x2b2a14['name'];}_0x1a4faf[_0xeb9b('0x1b')](_0xe6d3e1)['send'](_0x2b2a14);};}exports[_0xeb9b('0x28')]=function(_0x4361b9,_0x7e0134){var _0xe3eda5={},_0x52f6c1={},_0x33f73a={'count':0x0,'rows':[]};var _0x42fe78=_['map'](db[_0xeb9b('0x29')][_0xeb9b('0x2a')],function(_0x5ce745){return{'name':_0x5ce745[_0xeb9b('0x2b')],'type':_0x5ce745[_0xeb9b('0x2c')][_0xeb9b('0x2d')]};});_0x52f6c1['model']=_[_0xeb9b('0x2e')](_0x42fe78,'name');_0x52f6c1[_0xeb9b('0x2f')]=_['keys'](_0x4361b9[_0xeb9b('0x2f')]);_0x52f6c1['filters']=_[_0xeb9b('0x30')](_0x52f6c1['model'],_0x52f6c1[_0xeb9b('0x2f')]);_0xe3eda5['attributes']=_[_0xeb9b('0x30')](_0x52f6c1[_0xeb9b('0x31')],qs[_0xeb9b('0x32')](_0x4361b9[_0xeb9b('0x2f')][_0xeb9b('0x32')]));_0xe3eda5[_0xeb9b('0x33')]=_0xe3eda5[_0xeb9b('0x33')][_0xeb9b('0x34')]?_0xe3eda5[_0xeb9b('0x33')]:_0x52f6c1[_0xeb9b('0x31')];if(!_0x4361b9['query'][_0xeb9b('0x35')](_0xeb9b('0x36'))){_0xe3eda5[_0xeb9b('0x1a')]=qs[_0xeb9b('0x1a')](_0x4361b9[_0xeb9b('0x2f')][_0xeb9b('0x1a')]);_0xe3eda5[_0xeb9b('0x19')]=qs['offset'](_0x4361b9[_0xeb9b('0x2f')][_0xeb9b('0x19')]);}_0xe3eda5[_0xeb9b('0x37')]=qs['sort'](_0x4361b9[_0xeb9b('0x2f')][_0xeb9b('0x38')]);_0xe3eda5[_0xeb9b('0x39')]=qs[_0xeb9b('0x3a')](_[_0xeb9b('0x3b')](_0x4361b9[_0xeb9b('0x2f')],_0x52f6c1['filters']));if(_0x4361b9[_0xeb9b('0x2f')][_0xeb9b('0x3c')]){_0xe3eda5['where']=_[_0xeb9b('0x3d')](_0xe3eda5[_0xeb9b('0x39')],{'$or':_[_0xeb9b('0x2e')](_0x42fe78,function(_0x395b6b){if(_0x395b6b[_0xeb9b('0x2c')]!==_0xeb9b('0x3e')){var _0x408839={};_0x408839[_0x395b6b['name']]={'$like':'%'+_0x4361b9[_0xeb9b('0x2f')][_0xeb9b('0x3c')]+'%'};return _0x408839;}})});}_0xe3eda5=_[_0xeb9b('0x3d')]({},_0xe3eda5,_0x4361b9['options']);var _0x5750df={'where':_0xe3eda5['where']};return db[_0xeb9b('0x29')][_0xeb9b('0x18')](_0x5750df)[_0xeb9b('0x23')](function(_0x57d2a6){_0x33f73a[_0xeb9b('0x18')]=_0x57d2a6;if(_0x4361b9[_0xeb9b('0x2f')][_0xeb9b('0x3f')]){_0xe3eda5[_0xeb9b('0x40')]=[{'all':!![]}];}return db[_0xeb9b('0x29')][_0xeb9b('0x41')](_0xe3eda5);})[_0xeb9b('0x23')](function(_0x492122){_0x33f73a[_0xeb9b('0x42')]=_0x492122;return _0x33f73a;})[_0xeb9b('0x23')](respondWithFilteredResult(_0x7e0134,_0xe3eda5))[_0xeb9b('0x43')](handleError(_0x7e0134,null));};exports['show']=function(_0x4967cb,_0x34ea03){var _0x110122={'raw':!![],'where':{'id':_0x4967cb[_0xeb9b('0x44')]['id']}},_0x495998={};_0x495998['model']=_[_0xeb9b('0x45')](db[_0xeb9b('0x29')][_0xeb9b('0x2a')]);_0x495998[_0xeb9b('0x2f')]=_[_0xeb9b('0x45')](_0x4967cb[_0xeb9b('0x2f')]);_0x495998[_0xeb9b('0x3a')]=_[_0xeb9b('0x30')](_0x495998[_0xeb9b('0x31')],_0x495998[_0xeb9b('0x2f')]);_0x110122[_0xeb9b('0x33')]=_[_0xeb9b('0x30')](_0x495998['model'],qs['fields'](_0x4967cb[_0xeb9b('0x2f')]['fields']));_0x110122[_0xeb9b('0x33')]=_0x110122[_0xeb9b('0x33')][_0xeb9b('0x34')]?_0x110122['attributes']:_0x495998[_0xeb9b('0x31')];if(_0x4967cb[_0xeb9b('0x2f')]['includeAll']){_0x110122[_0xeb9b('0x40')]=[{'all':!![]}];}_0x110122=_[_0xeb9b('0x3d')]({},_0x110122,_0x4967cb[_0xeb9b('0x46')]);return db[_0xeb9b('0x29')][_0xeb9b('0x47')](_0x110122)[_0xeb9b('0x23')](handleEntityNotFound(_0x34ea03,null))[_0xeb9b('0x23')](respondWithResult(_0x34ea03,null))[_0xeb9b('0x43')](handleError(_0x34ea03,null));};exports['create']=function(_0x54bb29,_0x3a13cc){return db['FreshsalesField']['create'](_0x54bb29[_0xeb9b('0x48')],{})[_0xeb9b('0x23')](respondWithResult(_0x3a13cc,0xc9))[_0xeb9b('0x43')](handleError(_0x3a13cc,null));};exports[_0xeb9b('0x21')]=function(_0x45bc74,_0x2fd6ee){if(_0x45bc74['body']['id']){delete _0x45bc74['body']['id'];}return db['FreshsalesField'][_0xeb9b('0x47')]({'where':{'id':_0x45bc74['params']['id']}})[_0xeb9b('0x23')](handleEntityNotFound(_0x2fd6ee,null))[_0xeb9b('0x23')](saveUpdates(_0x45bc74[_0xeb9b('0x48')],null))[_0xeb9b('0x23')](respondWithResult(_0x2fd6ee,null))[_0xeb9b('0x43')](handleError(_0x2fd6ee,null));};exports[_0xeb9b('0x22')]=function(_0x202ef3,_0x1a2189){return db[_0xeb9b('0x29')][_0xeb9b('0x47')]({'where':{'id':_0x202ef3['params']['id']}})['then'](handleEntityNotFound(_0x1a2189,null))[_0xeb9b('0x23')](removeEntity(_0x1a2189,null))[_0xeb9b('0x43')](handleError(_0x1a2189,null));}; \ No newline at end of file +var _0xd3d1=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','limit','status','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','FreshsalesField','fieldName','type','key','keys','filters','intersection','query','attributes','model','fields','hasOwnProperty','offset','where','pick','filter','includeAll','include','findAll','catch','show','params','rawAttributes','length','merge','options','find','create','body','html-pdf','eml-format','fast-json-patch','request-promise','moment'];(function(_0x481f9d,_0x5e14d9){var _0x31156d=function(_0x12cb0d){while(--_0x12cb0d){_0x481f9d['push'](_0x481f9d['shift']());}};_0x31156d(++_0x5e14d9);}(_0xd3d1,0x172));var _0x1d3d=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xd3d1[_0x36ed48];return _0x51c63a;};'use strict';var pdf=require(_0x1d3d('0x0'));var emlformat=require(_0x1d3d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1d3d('0x2'));var rp=require(_0x1d3d('0x3'));var moment=require(_0x1d3d('0x4'));var BPromise=require(_0x1d3d('0x5'));var Mustache=require(_0x1d3d('0x6'));var util=require(_0x1d3d('0x7'));var path=require(_0x1d3d('0x8'));var sox=require(_0x1d3d('0x9'));var csv=require(_0x1d3d('0xa'));var ejs=require(_0x1d3d('0xb'));var fs=require('fs');var _=require(_0x1d3d('0xc'));var squel=require(_0x1d3d('0xd'));var crypto=require(_0x1d3d('0xe'));var jsforce=require(_0x1d3d('0xf'));var deskjs=require(_0x1d3d('0x10'));var toCsv=require(_0x1d3d('0xa'));var querystring=require(_0x1d3d('0x11'));var Papa=require('papaparse');var Redis=require(_0x1d3d('0x12'));var authService=require(_0x1d3d('0x13'));var qs=require(_0x1d3d('0x14'));var as=require(_0x1d3d('0x15'));var hardwareService=require(_0x1d3d('0x16'));var logger=require(_0x1d3d('0x17'))(_0x1d3d('0x18'));var utils=require(_0x1d3d('0x19'));var config=require(_0x1d3d('0x1a'));var db=require(_0x1d3d('0x1b'))['db'];function respondWithStatusCode(_0x29e17e,_0x479216){_0x479216=_0x479216||0xcc;return function(_0xb587d){if(_0xb587d){return _0x29e17e[_0x1d3d('0x1c')](_0x479216);}return _0x29e17e['status'](_0x479216)['end']();};}function respondWithResult(_0x12bd00,_0x2f5b7f){_0x2f5b7f=_0x2f5b7f||0xc8;return function(_0x1a8035){if(_0x1a8035){return _0x12bd00['status'](_0x2f5b7f)[_0x1d3d('0x1d')](_0x1a8035);}};}function respondWithFilteredResult(_0x4dcc22,_0x1d54f3){return function(_0x33e7d9){if(_0x33e7d9){var _0x3491e4=_0x33e7d9[_0x1d3d('0x1e')],_0x24bb8c=_0x1d54f3['offset'],_0x21c2e4=_0x1d54f3['offset']+_0x1d54f3[_0x1d3d('0x1f')],_0x1bdbdc;if(_0x21c2e4>=_0x3491e4){_0x21c2e4=_0x3491e4;_0x1bdbdc=0xc8;}else{_0x1bdbdc=0xce;}_0x4dcc22[_0x1d3d('0x20')](_0x1bdbdc);return _0x4dcc22['set'](_0x1d3d('0x21'),_0x24bb8c+'-'+_0x21c2e4+'/'+_0x3491e4)['json'](_0x33e7d9);}return null;};}function patchUpdates(_0x1eade8){return function(_0x392e92){try{jsonpatch[_0x1d3d('0x22')](_0x392e92,_0x1eade8,!![]);}catch(_0x2d6dfb){return BPromise['reject'](_0x2d6dfb);}return _0x392e92[_0x1d3d('0x23')]();};}function saveUpdates(_0x56db7a,_0x56c424){return function(_0x108005){if(_0x108005){return _0x108005[_0x1d3d('0x24')](_0x56db7a)[_0x1d3d('0x25')](function(_0x344a03){return _0x344a03;});}return null;};}function removeEntity(_0xa6f180,_0xe4afa2){return function(_0x471df5){if(_0x471df5){return _0x471df5[_0x1d3d('0x26')]()[_0x1d3d('0x25')](function(){_0xa6f180[_0x1d3d('0x20')](0xcc)[_0x1d3d('0x27')]();});}};}function handleEntityNotFound(_0x502921,_0xfc3606){return function(_0x72868d){if(!_0x72868d){_0x502921['sendStatus'](0x194);}return _0x72868d;};}function handleError(_0x3639f1,_0x5c52da){_0x5c52da=_0x5c52da||0x1f4;return function(_0x467ea7){logger[_0x1d3d('0x28')](_0x467ea7[_0x1d3d('0x29')]);if(_0x467ea7[_0x1d3d('0x2a')]){delete _0x467ea7[_0x1d3d('0x2a')];}_0x3639f1[_0x1d3d('0x20')](_0x5c52da)[_0x1d3d('0x2b')](_0x467ea7);};}exports[_0x1d3d('0x2c')]=function(_0x2294ee,_0x2df7b7){var _0x172dbd={},_0x4f0aa7={},_0x3f5681={'count':0x0,'rows':[]};var _0x5b2986=_[_0x1d3d('0x2d')](db[_0x1d3d('0x2e')]['rawAttributes'],function(_0x185913){return{'name':_0x185913[_0x1d3d('0x2f')],'type':_0x185913[_0x1d3d('0x30')][_0x1d3d('0x31')]};});_0x4f0aa7['model']=_[_0x1d3d('0x2d')](_0x5b2986,_0x1d3d('0x2a'));_0x4f0aa7['query']=_[_0x1d3d('0x32')](_0x2294ee['query']);_0x4f0aa7[_0x1d3d('0x33')]=_[_0x1d3d('0x34')](_0x4f0aa7['model'],_0x4f0aa7[_0x1d3d('0x35')]);_0x172dbd[_0x1d3d('0x36')]=_[_0x1d3d('0x34')](_0x4f0aa7[_0x1d3d('0x37')],qs[_0x1d3d('0x38')](_0x2294ee[_0x1d3d('0x35')][_0x1d3d('0x38')]));_0x172dbd[_0x1d3d('0x36')]=_0x172dbd[_0x1d3d('0x36')]['length']?_0x172dbd[_0x1d3d('0x36')]:_0x4f0aa7[_0x1d3d('0x37')];if(!_0x2294ee[_0x1d3d('0x35')][_0x1d3d('0x39')]('nolimit')){_0x172dbd['limit']=qs[_0x1d3d('0x1f')](_0x2294ee[_0x1d3d('0x35')]['limit']);_0x172dbd[_0x1d3d('0x3a')]=qs[_0x1d3d('0x3a')](_0x2294ee[_0x1d3d('0x35')][_0x1d3d('0x3a')]);}_0x172dbd['order']=qs['sort'](_0x2294ee[_0x1d3d('0x35')]['sort']);_0x172dbd[_0x1d3d('0x3b')]=qs[_0x1d3d('0x33')](_[_0x1d3d('0x3c')](_0x2294ee[_0x1d3d('0x35')],_0x4f0aa7[_0x1d3d('0x33')]));if(_0x2294ee[_0x1d3d('0x35')][_0x1d3d('0x3d')]){_0x172dbd[_0x1d3d('0x3b')]=_['merge'](_0x172dbd[_0x1d3d('0x3b')],{'$or':_['map'](_0x5b2986,function(_0x58ae8e){if(_0x58ae8e[_0x1d3d('0x30')]!=='VIRTUAL'){var _0x175e8a={};_0x175e8a[_0x58ae8e[_0x1d3d('0x2a')]]={'$like':'%'+_0x2294ee[_0x1d3d('0x35')][_0x1d3d('0x3d')]+'%'};return _0x175e8a;}})});}_0x172dbd=_['merge']({},_0x172dbd,_0x2294ee['options']);var _0x434dad={'where':_0x172dbd['where']};return db[_0x1d3d('0x2e')][_0x1d3d('0x1e')](_0x434dad)['then'](function(_0x1ad7a6){_0x3f5681[_0x1d3d('0x1e')]=_0x1ad7a6;if(_0x2294ee['query'][_0x1d3d('0x3e')]){_0x172dbd[_0x1d3d('0x3f')]=[{'all':!![]}];}return db[_0x1d3d('0x2e')][_0x1d3d('0x40')](_0x172dbd);})[_0x1d3d('0x25')](function(_0x36c713){_0x3f5681['rows']=_0x36c713;return _0x3f5681;})[_0x1d3d('0x25')](respondWithFilteredResult(_0x2df7b7,_0x172dbd))[_0x1d3d('0x41')](handleError(_0x2df7b7,null));};exports[_0x1d3d('0x42')]=function(_0x3941bd,_0x232b62){var _0x5f007e={'raw':!![],'where':{'id':_0x3941bd[_0x1d3d('0x43')]['id']}},_0x327e73={};_0x327e73[_0x1d3d('0x37')]=_[_0x1d3d('0x32')](db['FreshsalesField'][_0x1d3d('0x44')]);_0x327e73[_0x1d3d('0x35')]=_[_0x1d3d('0x32')](_0x3941bd[_0x1d3d('0x35')]);_0x327e73[_0x1d3d('0x33')]=_['intersection'](_0x327e73['model'],_0x327e73[_0x1d3d('0x35')]);_0x5f007e[_0x1d3d('0x36')]=_[_0x1d3d('0x34')](_0x327e73[_0x1d3d('0x37')],qs[_0x1d3d('0x38')](_0x3941bd['query'][_0x1d3d('0x38')]));_0x5f007e['attributes']=_0x5f007e[_0x1d3d('0x36')][_0x1d3d('0x45')]?_0x5f007e[_0x1d3d('0x36')]:_0x327e73[_0x1d3d('0x37')];if(_0x3941bd['query'][_0x1d3d('0x3e')]){_0x5f007e[_0x1d3d('0x3f')]=[{'all':!![]}];}_0x5f007e=_[_0x1d3d('0x46')]({},_0x5f007e,_0x3941bd[_0x1d3d('0x47')]);return db[_0x1d3d('0x2e')][_0x1d3d('0x48')](_0x5f007e)[_0x1d3d('0x25')](handleEntityNotFound(_0x232b62,null))['then'](respondWithResult(_0x232b62,null))[_0x1d3d('0x41')](handleError(_0x232b62,null));};exports['create']=function(_0x160f88,_0x256ecc){return db['FreshsalesField'][_0x1d3d('0x49')](_0x160f88['body'],{})[_0x1d3d('0x25')](respondWithResult(_0x256ecc,0xc9))['catch'](handleError(_0x256ecc,null));};exports[_0x1d3d('0x24')]=function(_0xebd1f4,_0x1dafe8){if(_0xebd1f4[_0x1d3d('0x4a')]['id']){delete _0xebd1f4[_0x1d3d('0x4a')]['id'];}return db[_0x1d3d('0x2e')][_0x1d3d('0x48')]({'where':{'id':_0xebd1f4[_0x1d3d('0x43')]['id']}})['then'](handleEntityNotFound(_0x1dafe8,null))['then'](saveUpdates(_0xebd1f4['body'],null))[_0x1d3d('0x25')](respondWithResult(_0x1dafe8,null))[_0x1d3d('0x41')](handleError(_0x1dafe8,null));};exports[_0x1d3d('0x26')]=function(_0x3856d5,_0x438c61){return db[_0x1d3d('0x2e')]['find']({'where':{'id':_0x3856d5['params']['id']}})['then'](handleEntityNotFound(_0x438c61,null))['then'](removeEntity(_0x438c61,null))[_0x1d3d('0x41')](handleError(_0x438c61,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index e6f8b24..3a40879 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 _0x02d1=['exports','FreshsalesField','freshsales_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x02d1,0x1b1));var _0x102d=function(_0x592c54,_0x30eff0){_0x592c54=_0x592c54-0x0;var _0x2ccaed=_0x02d1[_0x592c54];return _0x2ccaed;};'use strict';var _=require(_0x102d('0x0'));var util=require(_0x102d('0x1'));var logger=require(_0x102d('0x2'))(_0x102d('0x3'));var moment=require('moment');var BPromise=require(_0x102d('0x4'));var rp=require(_0x102d('0x5'));var fs=require('fs');var path=require(_0x102d('0x6'));var rimraf=require(_0x102d('0x7'));var config=require('../../config/environment');var attributes=require(_0x102d('0x8'));module[_0x102d('0x9')]=function(_0x2aa388,_0x3b1ab3){return _0x2aa388['define'](_0x102d('0xa'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x102d('0xb'),'fields':[_0x102d('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5cd1=['bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x3e9b64,_0x240cf1){var _0x3ee1fe=function(_0x3d81ff){while(--_0x3d81ff){_0x3e9b64['push'](_0x3e9b64['shift']());}};_0x3ee1fe(++_0x240cf1);}(_0x5cd1,0x72));var _0x15cd=function(_0x4c22fc,_0x14342d){_0x4c22fc=_0x4c22fc-0x0;var _0x44196a=_0x5cd1[_0x4c22fc];return _0x44196a;};'use strict';var _=require(_0x15cd('0x0'));var util=require(_0x15cd('0x1'));var logger=require(_0x15cd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x15cd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x15cd('0x4'));var rimraf=require(_0x15cd('0x5'));var config=require(_0x15cd('0x6'));var attributes=require(_0x15cd('0x7'));module[_0x15cd('0x8')]=function(_0x36bf51,_0x5e0348){return _0x36bf51['define'](_0x15cd('0x9'),attributes,{'tableName':_0x15cd('0xa'),'paranoid':![],'indexes':[{'name':_0x15cd('0xb'),'fields':['idField',_0x15cd('0xc')],'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 ad57f14..51381ad 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 _0xd12c=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','FreshsalesField,\x20%s,\x20%s','message','result','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x56b5d1,_0x59be02){var _0x5bfe4a=function(_0x9ed053){while(--_0x9ed053){_0x56b5d1['push'](_0x56b5d1['shift']());}};_0x5bfe4a(++_0x59be02);}(_0xd12c,0x64));var _0xcd12=function(_0x1d1b93,_0x1e44c9){_0x1d1b93=_0x1d1b93-0x0;var _0x100cd1=_0xd12c[_0x1d1b93];return _0x100cd1;};'use strict';var _=require(_0xcd12('0x0'));var util=require('util');var moment=require(_0xcd12('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd12('0x2'));var fs=require('fs');var Redis=require(_0xcd12('0x3'));var db=require(_0xcd12('0x4'))['db'];var utils=require(_0xcd12('0x5'));var logger=require(_0xcd12('0x6'))(_0xcd12('0x7'));var config=require(_0xcd12('0x8'));var jayson=require(_0xcd12('0x9'));var client=jayson[_0xcd12('0xa')][_0xcd12('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f7eec,_0x1ad659,_0x3cd587){return new BPromise(function(_0x62200e,_0x1f412f){return client['request'](_0x3f7eec,_0x3cd587)[_0xcd12('0xc')](function(_0x2ce4e8){logger[_0xcd12('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x1ad659,_0xcd12('0xe'));logger[_0xcd12('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x1ad659,_0xcd12('0xe'),JSON[_0xcd12('0x10')](_0x2ce4e8));if(_0x2ce4e8[_0xcd12('0x11')]){if(_0x2ce4e8[_0xcd12('0x11')]['code']===0x1f4){logger[_0xcd12('0x11')](_0xcd12('0x12'),_0x1ad659,_0x2ce4e8[_0xcd12('0x11')][_0xcd12('0x13')]);return _0x1f412f(_0x2ce4e8[_0xcd12('0x11')][_0xcd12('0x13')]);}logger[_0xcd12('0x11')](_0xcd12('0x12'),_0x1ad659,_0x2ce4e8['error'][_0xcd12('0x13')]);return _0x62200e(_0x2ce4e8['error']['message']);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x1ad659,_0xcd12('0xe'));_0x62200e(_0x2ce4e8[_0xcd12('0x14')][_0xcd12('0x13')]);}})['catch'](function(_0x53fe23){logger[_0xcd12('0x11')](_0xcd12('0x12'),_0x1ad659,_0x53fe23);_0x1f412f(_0x53fe23);});});} \ No newline at end of file +var _0x19a2=['code','message','info','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','FreshsalesField,\x20%s,\x20%s','debug','stringify','error'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x19a2,0x124));var _0x219a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x19a2[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x219a('0x0'));var util=require('util');var moment=require(_0x219a('0x1'));var BPromise=require(_0x219a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x219a('0x3'));var db=require(_0x219a('0x4'))['db'];var utils=require(_0x219a('0x5'));var logger=require(_0x219a('0x6'))(_0x219a('0x7'));var config=require(_0x219a('0x8'));var jayson=require(_0x219a('0x9'));var client=jayson['client'][_0x219a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8d395f,_0x405a27,_0x295039){return new BPromise(function(_0x5c80e8,_0x65cb38){return client['request'](_0x8d395f,_0x295039)[_0x219a('0xb')](function(_0x21dd1c){logger['info'](_0x219a('0xc'),_0x405a27,'request\x20sent');logger[_0x219a('0xd')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x405a27,'request\x20sent',JSON[_0x219a('0xe')](_0x21dd1c));if(_0x21dd1c[_0x219a('0xf')]){if(_0x21dd1c[_0x219a('0xf')][_0x219a('0x10')]===0x1f4){logger['error']('FreshsalesField,\x20%s,\x20%s',_0x405a27,_0x21dd1c[_0x219a('0xf')][_0x219a('0x11')]);return _0x65cb38(_0x21dd1c[_0x219a('0xf')][_0x219a('0x11')]);}logger['error'](_0x219a('0xc'),_0x405a27,_0x21dd1c[_0x219a('0xf')][_0x219a('0x11')]);return _0x5c80e8(_0x21dd1c[_0x219a('0xf')][_0x219a('0x11')]);}else{logger[_0x219a('0x12')]('FreshsalesField,\x20%s,\x20%s',_0x405a27,_0x219a('0x13'));_0x5c80e8(_0x21dd1c[_0x219a('0x14')]['message']);}})[_0x219a('0x15')](function(_0x3d2c41){logger[_0x219a('0xf')](_0x219a('0xc'),_0x405a27,_0x3d2c41);_0x65cb38(_0x3d2c41);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c9fd78a..93a9cc1 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 _0xf8fe=['post','create','addConfiguration','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xf8fe,0x1be));var _0xef8f=function(_0x33e169,_0x3fdd78){_0x33e169=_0x33e169-0x0;var _0xa6d1e7=_0xf8fe[_0x33e169];return _0xa6d1e7;};'use strict';var multer=require(_0xef8f('0x0'));var util=require(_0xef8f('0x1'));var path=require(_0xef8f('0x2'));var timeout=require('connect-timeout');var express=require(_0xef8f('0x3'));var router=express[_0xef8f('0x4')]();var auth=require(_0xef8f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xef8f('0x6'));var controller=require(_0xef8f('0x7'));router[_0xef8f('0x8')]('/',auth[_0xef8f('0x9')](),controller[_0xef8f('0xa')]);router[_0xef8f('0x8')](_0xef8f('0xb'),auth['isAuthenticated'](),controller[_0xef8f('0xc')]);router[_0xef8f('0x8')](_0xef8f('0xd'),auth[_0xef8f('0x9')](),controller[_0xef8f('0xe')]);router[_0xef8f('0x8')]('/:id/fields',auth[_0xef8f('0x9')](),controller[_0xef8f('0xf')]);router[_0xef8f('0x10')]('/',auth[_0xef8f('0x9')](),controller[_0xef8f('0x11')]);router['post'](_0xef8f('0xd'),auth[_0xef8f('0x9')](),controller[_0xef8f('0x12')]);router['put'](_0xef8f('0xb'),auth[_0xef8f('0x9')](),controller[_0xef8f('0x13')]);router[_0xef8f('0x14')]('/:id',auth[_0xef8f('0x9')](),controller['destroy']);module[_0xef8f('0x15')]=router; \ No newline at end of file +var _0x1974=['addConfiguration','update','delete','destroy','exports','path','express','Router','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1974,0x1d3));var _0x4197=function(_0x3c8df7,_0x7418e8){_0x3c8df7=_0x3c8df7-0x0;var _0x2d88c8=_0x1974[_0x3c8df7];return _0x2d88c8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4197('0x0'));var timeout=require('connect-timeout');var express=require(_0x4197('0x1'));var router=express[_0x4197('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x4197('0x3'));var config=require(_0x4197('0x4'));var controller=require(_0x4197('0x5'));router[_0x4197('0x6')]('/',auth[_0x4197('0x7')](),controller[_0x4197('0x8')]);router[_0x4197('0x6')](_0x4197('0x9'),auth[_0x4197('0x7')](),controller[_0x4197('0xa')]);router['get']('/:id/configurations',auth[_0x4197('0x7')](),controller[_0x4197('0xb')]);router[_0x4197('0x6')](_0x4197('0xc'),auth[_0x4197('0x7')](),controller[_0x4197('0xd')]);router[_0x4197('0xe')]('/',auth['isAuthenticated'](),controller[_0x4197('0xf')]);router[_0x4197('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x4197('0x10')]);router['put'](_0x4197('0x9'),auth[_0x4197('0x7')](),controller[_0x4197('0x11')]);router[_0x4197('0x12')](_0x4197('0x9'),auth[_0x4197('0x7')](),controller[_0x4197('0x13')]);module[_0x4197('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index b2dc42b..27eb3bf 100644 --- a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js +++ b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['STRING','username','ENUM','integrationTab','newTab','sequelize','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')]},'description':{'type':Sequelize[_0xac4a('0x2')]},'username':{'type':Sequelize[_0xac4a('0x2')],'unique':_0xac4a('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xac4a('0x2')]},'securityToken':{'type':Sequelize[_0xac4a('0x2')]},'serverUrl':{'type':Sequelize[_0xac4a('0x2')]},'type':{'type':Sequelize[_0xac4a('0x4')](_0xac4a('0x5'),_0xac4a('0x6')),'defaultValue':_0xac4a('0x5')}}; \ No newline at end of file +var _0x53ec=['ENUM','newTab','integrationTab','sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53ec,0x192));var _0xc53e=function(_0x2d7c67,_0x358a79){_0x2d7c67=_0x2d7c67-0x0;var _0x523bd4=_0x53ec[_0x2d7c67];return _0x523bd4;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'name':{'type':Sequelize[_0xc53e('0x2')]},'description':{'type':Sequelize[_0xc53e('0x2')]},'username':{'type':Sequelize[_0xc53e('0x2')],'unique':_0xc53e('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xc53e('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xc53e('0x2')]},'securityToken':{'type':Sequelize[_0xc53e('0x2')]},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc53e('0x4')]('integrationTab',_0xc53e('0x5')),'defaultValue':_0xc53e('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index ed78218..87c25cb 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 _0xf494=['addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','clientId','username','securityToken','remoteUri','substring','Connection','clientSecret','password','concat','isNil','ticketType','sobject','describe','CallDisposition','CallDurationInSeconds','CallObject','IsArchived','Priority','Status','Type','Case','Origin','Reason','SuppliedName','remove','custom','includes','picklistValues','label','value','boolean','True','true','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','stringify','error','SalesforceAccount,\x20%s,\x20%s','message','result','status','end','count','limit','set','json','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','SalesforceConfiguration','order'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0xf494,0x1c6));var _0x4f49=function(_0x2f22da,_0x4677d7){_0x2f22da=_0x2f22da-0x0;var _0x1ef6d7=_0xf494[_0x2f22da];return _0x1ef6d7;};'use strict';var pdf=require(_0x4f49('0x0'));var emlformat=require(_0x4f49('0x1'));var rimraf=require(_0x4f49('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f49('0x3'));var rp=require(_0x4f49('0x4'));var moment=require(_0x4f49('0x5'));var BPromise=require(_0x4f49('0x6'));var Mustache=require(_0x4f49('0x7'));var util=require(_0x4f49('0x8'));var path=require(_0x4f49('0x9'));var sox=require(_0x4f49('0xa'));var csv=require(_0x4f49('0xb'));var ejs=require(_0x4f49('0xc'));var fs=require('fs');var _=require(_0x4f49('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f49('0xe'));var deskjs=require(_0x4f49('0xf'));var toCsv=require(_0x4f49('0xb'));var querystring=require(_0x4f49('0x10'));var Papa=require(_0x4f49('0x11'));var Redis=require(_0x4f49('0x12'));var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))('api');var utils=require(_0x4f49('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x4f49('0x18'));var jayson=require(_0x4f49('0x19'));var client=jayson['client'][_0x4f49('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x111a8b,_0x1b9145,_0x2efe49){if(_0x2efe49){var _0x1a0f1e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a0f1e[_0x4f49('0x1b')](_0x1b9145)){return _0x111a8b;}else{throw new db[(_0x4f49('0x1c'))]['ValidationError'](_0x4f49('0x1d'));}}else{return _0x111a8b;}}function respondWithRpcPromise(_0x1f2d0d,_0x415e83,_0x5878f4,_0x5bdfaf){return new BPromise(function(_0x2f0a0d,_0x2ecaaa){var _0x74886e=_0x5bdfaf||client;return _0x74886e['request'](_0x1f2d0d,_0x5878f4)[_0x4f49('0x1e')](function(_0x399be7){logger[_0x4f49('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x415e83,'request\x20sent');logger['debug']('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x415e83,_0x4f49('0x20'),JSON[_0x4f49('0x21')](_0x399be7));if(_0x399be7[_0x4f49('0x22')]){if(_0x399be7[_0x4f49('0x22')]['code']===0x1f4){logger[_0x4f49('0x22')](_0x4f49('0x23'),_0x415e83,_0x399be7[_0x4f49('0x22')][_0x4f49('0x24')]);return _0x2ecaaa(_0x399be7[_0x4f49('0x22')]['message']);}logger[_0x4f49('0x22')](_0x4f49('0x23'),_0x415e83,_0x399be7[_0x4f49('0x22')]['message']);return _0x2f0a0d(_0x399be7[_0x4f49('0x22')][_0x4f49('0x24')]);}else{logger[_0x4f49('0x1f')](_0x4f49('0x23'),_0x415e83,_0x4f49('0x20'));_0x2f0a0d(_0x399be7[_0x4f49('0x25')]['message']);}})['catch'](function(_0x3a947b){logger[_0x4f49('0x22')]('SalesforceAccount,\x20%s,\x20%s',_0x415e83,_0x3a947b);_0x2ecaaa(_0x3a947b);});});}function respondWithStatusCode(_0x408552,_0x2c1519){_0x2c1519=_0x2c1519||0xcc;return function(_0x35f8e0){if(_0x35f8e0){return _0x408552['sendStatus'](_0x2c1519);}return _0x408552[_0x4f49('0x26')](_0x2c1519)[_0x4f49('0x27')]();};}function respondWithResult(_0x298785,_0x148153){_0x148153=_0x148153||0xc8;return function(_0xfefbab){if(_0xfefbab){return _0x298785[_0x4f49('0x26')](_0x148153)['json'](_0xfefbab);}};}function respondWithFilteredResult(_0x50c571,_0x239f44){return function(_0x2c00ee){if(_0x2c00ee){var _0x605c91=_0x2c00ee[_0x4f49('0x28')],_0x560050=_0x239f44['offset'],_0x3cbfbd=_0x239f44['offset']+_0x239f44[_0x4f49('0x29')],_0x206203;if(_0x3cbfbd>=_0x605c91){_0x3cbfbd=_0x605c91;_0x206203=0xc8;}else{_0x206203=0xce;}_0x50c571[_0x4f49('0x26')](_0x206203);return _0x50c571[_0x4f49('0x2a')]('Content-Range',_0x560050+'-'+_0x3cbfbd+'/'+_0x605c91)[_0x4f49('0x2b')](_0x2c00ee);}return null;};}function patchUpdates(_0x35aa33){return function(_0x173657){try{jsonpatch[_0x4f49('0x2c')](_0x173657,_0x35aa33,!![]);}catch(_0x3e103b){return BPromise[_0x4f49('0x2d')](_0x3e103b);}return _0x173657[_0x4f49('0x2e')]();};}function saveUpdates(_0x45ae19,_0x1f38d3){return function(_0x310ee2){if(_0x310ee2){return _0x310ee2[_0x4f49('0x2f')](_0x45ae19)[_0x4f49('0x1e')](function(_0x29ff83){return _0x29ff83;});}return null;};}function removeEntity(_0x6625cd,_0x135d17){return function(_0x97ef98){if(_0x97ef98){return _0x97ef98[_0x4f49('0x30')]()[_0x4f49('0x1e')](function(){_0x6625cd[_0x4f49('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d0d2,_0x46b7ba){return function(_0x24f568){if(!_0x24f568){_0x45d0d2[_0x4f49('0x31')](0x194);}return _0x24f568;};}function handleError(_0x1c3af8,_0x15e82b){_0x15e82b=_0x15e82b||0x1f4;return function(_0x2cbe4e){logger[_0x4f49('0x22')](_0x2cbe4e[_0x4f49('0x32')]);if(_0x2cbe4e[_0x4f49('0x33')]){delete _0x2cbe4e[_0x4f49('0x33')];}_0x1c3af8[_0x4f49('0x26')](_0x15e82b)[_0x4f49('0x34')](_0x2cbe4e);};}exports['index']=function(_0x371282,_0x27b7a9){var _0x36000a={},_0x26014f={},_0x1c1e9b={'count':0x0,'rows':[]};var _0x3ee818=_[_0x4f49('0x35')](db[_0x4f49('0x36')][_0x4f49('0x37')],function(_0xf8c377){return{'name':_0xf8c377[_0x4f49('0x38')],'type':_0xf8c377[_0x4f49('0x39')][_0x4f49('0x3a')]};});_0x26014f[_0x4f49('0x3b')]=_['map'](_0x3ee818,_0x4f49('0x33'));_0x26014f[_0x4f49('0x3c')]=_['keys'](_0x371282[_0x4f49('0x3c')]);_0x26014f[_0x4f49('0x3d')]=_['intersection'](_0x26014f[_0x4f49('0x3b')],_0x26014f[_0x4f49('0x3c')]);_0x36000a[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0x26014f[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x371282[_0x4f49('0x3c')]['fields']));_0x36000a['attributes']=_0x36000a['attributes'][_0x4f49('0x41')]?_0x36000a[_0x4f49('0x3e')]:_0x26014f[_0x4f49('0x3b')];if(!_0x371282[_0x4f49('0x3c')][_0x4f49('0x42')](_0x4f49('0x43'))){_0x36000a[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x371282[_0x4f49('0x3c')]['limit']);_0x36000a['offset']=qs[_0x4f49('0x44')](_0x371282[_0x4f49('0x3c')][_0x4f49('0x44')]);}_0x36000a['order']=qs[_0x4f49('0x45')](_0x371282['query']['sort']);_0x36000a[_0x4f49('0x46')]=qs[_0x4f49('0x3d')](_[_0x4f49('0x47')](_0x371282['query'],_0x26014f[_0x4f49('0x3d')]));if(_0x371282[_0x4f49('0x3c')]['filter']){_0x36000a[_0x4f49('0x46')]=_['merge'](_0x36000a[_0x4f49('0x46')],{'$or':_[_0x4f49('0x35')](_0x3ee818,function(_0x133f39){if(_0x133f39['type']!==_0x4f49('0x48')){var _0x1e5f0b={};_0x1e5f0b[_0x133f39[_0x4f49('0x33')]]={'$like':'%'+_0x371282[_0x4f49('0x3c')][_0x4f49('0x49')]+'%'};return _0x1e5f0b;}})});}_0x36000a=_[_0x4f49('0x4a')]({},_0x36000a,_0x371282[_0x4f49('0x4b')]);var _0x356785={'where':_0x36000a[_0x4f49('0x46')]};return db[_0x4f49('0x36')]['count'](_0x356785)[_0x4f49('0x1e')](function(_0x44bf1d){_0x1c1e9b['count']=_0x44bf1d;if(_0x371282[_0x4f49('0x3c')]['includeAll']){_0x36000a[_0x4f49('0x4c')]=[{'all':!![]}];}return db[_0x4f49('0x36')][_0x4f49('0x4d')](_0x36000a);})[_0x4f49('0x1e')](function(_0x4a91ec){_0x1c1e9b[_0x4f49('0x4e')]=_0x4a91ec;return _0x1c1e9b;})[_0x4f49('0x1e')](respondWithFilteredResult(_0x27b7a9,_0x36000a))[_0x4f49('0x4f')](handleError(_0x27b7a9,null));};exports[_0x4f49('0x50')]=function(_0x3ec266,_0x72ea05){var _0x37fdb7={'raw':![],'where':{'id':_0x3ec266[_0x4f49('0x51')]['id']}},_0xd282c={};_0xd282c[_0x4f49('0x3b')]=_[_0x4f49('0x52')](db[_0x4f49('0x36')][_0x4f49('0x37')]);_0xd282c[_0x4f49('0x3c')]=_[_0x4f49('0x52')](_0x3ec266[_0x4f49('0x3c')]);_0xd282c['filters']=_['intersection'](_0xd282c[_0x4f49('0x3b')],_0xd282c[_0x4f49('0x3c')]);_0x37fdb7[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0xd282c[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x3ec266[_0x4f49('0x3c')]['fields']));_0x37fdb7[_0x4f49('0x3e')]=_0x37fdb7['attributes'][_0x4f49('0x41')]?_0x37fdb7[_0x4f49('0x3e')]:_0xd282c[_0x4f49('0x3b')];if(_0x3ec266[_0x4f49('0x3c')]['includeAll']){_0x37fdb7[_0x4f49('0x4c')]=[{'all':!![]}];}_0x37fdb7=_['merge']({},_0x37fdb7,_0x3ec266['options']);return db[_0x4f49('0x36')][_0x4f49('0x53')](_0x37fdb7)[_0x4f49('0x1e')](handleEntityNotFound(_0x72ea05,null))[_0x4f49('0x1e')](respondWithResult(_0x72ea05,null))['catch'](handleError(_0x72ea05,null));};exports['create']=function(_0xd7f47b,_0x291a45){return db['SalesforceAccount'][_0x4f49('0x54')](_0xd7f47b['body'],{})['then'](respondWithResult(_0x291a45,0xc9))[_0x4f49('0x4f')](handleError(_0x291a45,null));};exports['update']=function(_0xfa7dd6,_0x492aaa){if(_0xfa7dd6[_0x4f49('0x55')]['id']){delete _0xfa7dd6[_0x4f49('0x55')]['id'];}return db[_0x4f49('0x36')][_0x4f49('0x53')]({'where':{'id':_0xfa7dd6[_0x4f49('0x51')]['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x492aaa,null))[_0x4f49('0x1e')](saveUpdates(_0xfa7dd6[_0x4f49('0x55')],null))['then'](respondWithResult(_0x492aaa,null))[_0x4f49('0x4f')](handleError(_0x492aaa,null));};exports['destroy']=function(_0x213608,_0x1f640d){return db[_0x4f49('0x36')][_0x4f49('0x53')]({'where':{'id':_0x213608[_0x4f49('0x51')]['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x1f640d,null))['then'](removeEntity(_0x1f640d,null))[_0x4f49('0x4f')](handleError(_0x1f640d,null));};exports[_0x4f49('0x56')]=function(_0x5e3568,_0x5d2b3c,_0x121c04){var _0x447dde={};var _0x2e0df5={};var _0x2409f1;var _0x19a788;return db['SalesforceAccount'][_0x4f49('0x57')]({'where':{'id':_0x5e3568['params']['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x5d2b3c,null))[_0x4f49('0x1e')](function(_0x2a2b0d){if(_0x2a2b0d){_0x2409f1=_0x2a2b0d;_0x2e0df5['model']=_[_0x4f49('0x52')](db[_0x4f49('0x58')][_0x4f49('0x37')]);_0x2e0df5[_0x4f49('0x3c')]=_['keys'](_0x5e3568[_0x4f49('0x3c')]);_0x2e0df5[_0x4f49('0x3d')]=_['intersection'](_0x2e0df5[_0x4f49('0x3b')],_0x2e0df5[_0x4f49('0x3c')]);_0x447dde[_0x4f49('0x3e')]=_[_0x4f49('0x3f')](_0x2e0df5[_0x4f49('0x3b')],qs[_0x4f49('0x40')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x40')]));_0x447dde['attributes']=_0x447dde[_0x4f49('0x3e')][_0x4f49('0x41')]?_0x447dde[_0x4f49('0x3e')]:_0x2e0df5[_0x4f49('0x3b')];_0x447dde[_0x4f49('0x59')]=qs[_0x4f49('0x45')](_0x5e3568[_0x4f49('0x3c')]['sort']);_0x447dde[_0x4f49('0x46')]=qs['filters'](_[_0x4f49('0x47')](_0x5e3568[_0x4f49('0x3c')],_0x2e0df5[_0x4f49('0x3d')]));if(_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x49')]){_0x447dde[_0x4f49('0x46')]=_[_0x4f49('0x4a')](_0x447dde[_0x4f49('0x46')],{'$or':_[_0x4f49('0x35')](_0x447dde[_0x4f49('0x3e')],function(_0x545552){var _0x2f9f2e={};_0x2f9f2e[_0x545552]={'$like':'%'+_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x49')]+'%'};return _0x2f9f2e;})});}_0x447dde=_[_0x4f49('0x4a')]({},_0x447dde,_0x5e3568['options']);return _0x2409f1['getConfigurations'](_0x447dde);}})[_0x4f49('0x1e')](function(_0x5e4879){if(_0x5e4879){_0x19a788=_0x5e4879[_0x4f49('0x41')];if(!_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x42')](_0x4f49('0x43'))){_0x447dde[_0x4f49('0x29')]=qs[_0x4f49('0x29')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x29')]);_0x447dde[_0x4f49('0x44')]=qs[_0x4f49('0x44')](_0x5e3568[_0x4f49('0x3c')][_0x4f49('0x44')]);}return _0x2409f1[_0x4f49('0x56')](_0x447dde);}})[_0x4f49('0x1e')](function(_0x234984){if(_0x234984){return _0x234984?{'count':_0x19a788,'rows':_0x234984}:null;}})[_0x4f49('0x1e')](respondWithResult(_0x5d2b3c,null))[_0x4f49('0x4f')](handleError(_0x5d2b3c,null));};exports[_0x4f49('0x5a')]=function(_0x1f9161,_0x1434ea,_0x2c3962){if(_0x1f9161[_0x4f49('0x55')]['id']){delete _0x1f9161[_0x4f49('0x55')]['id'];}return db[_0x4f49('0x36')][_0x4f49('0x57')]({'where':{'id':_0x1f9161['params']['id']}})[_0x4f49('0x1e')](handleEntityNotFound(_0x1434ea,null))['then'](function(_0x31df7f){if(_0x31df7f){_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5b')]=_0x31df7f['id'];_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5c')]=integrations[_0x4f49('0x5d')](_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5e')],_0x1f9161[_0x4f49('0x55')]['type']);_0x1f9161['body'][_0x4f49('0x5f')]=integrations['getDescriptions'](_0x1f9161[_0x4f49('0x55')][_0x4f49('0x5e')],_0x1f9161[_0x4f49('0x55')][_0x4f49('0x39')]);return db[_0x4f49('0x58')]['create'](_0x1f9161['body'],{'include':[{'model':db[_0x4f49('0x60')],'as':_0x4f49('0x5c')},{'model':db['SalesforceField'],'as':_0x4f49('0x5f')}]});}return null;})[_0x4f49('0x1e')](respondWithResult(_0x1434ea,null))['catch'](handleError(_0x1434ea,null));};exports[_0x4f49('0x61')]=function(_0x5b88aa,_0x121972,_0x160cf8){var _0x544356;var _0x15ed6c='';var _0x4551d9=_0x4f49('0x62');return db[_0x4f49('0x36')][_0x4f49('0x57')]({'where':{'id':_0x5b88aa[_0x4f49('0x51')]['id']},'attributes':['id','remoteUri',_0x4f49('0x63'),'clientSecret',_0x4f49('0x64'),'password',_0x4f49('0x65')]})['then'](handleEntityNotFound(_0x121972,null))[_0x4f49('0x1e')](function(_0x16fad9){if(_0x16fad9){_0x15ed6c=_0x16fad9[_0x4f49('0x66')];var _0x2dbd0f=_0x15ed6c['slice'](-0x1);if(_0x2dbd0f==='/'){_0x15ed6c=_0x15ed6c[_0x4f49('0x67')](0x0,_0x15ed6c['lastIndexOf'](_0x2dbd0f));}_0x544356=new jsforce[(_0x4f49('0x68'))]({'oauth2':{'loginUrl':_0x15ed6c,'clientId':_0x16fad9['clientId'],'clientSecret':_0x16fad9[_0x4f49('0x69')]}});return _0x544356['login'](_0x16fad9['username'],_0x16fad9[_0x4f49('0x6a')][_0x4f49('0x6b')](_0x16fad9[_0x4f49('0x65')]));}})['then'](function(_0x289810){if(_0x289810){if(!_[_0x4f49('0x6c')](_0x5b88aa['query']['ticketType'])){_0x4551d9=_0x5b88aa['query'][_0x4f49('0x6d')];}return _0x544356[_0x4f49('0x6e')](_0x4551d9)[_0x4f49('0x6f')]();}})[_0x4f49('0x1e')](function(_0x1643fc){var _0x517144=[_0x4f49('0x70'),_0x4f49('0x71'),_0x4f49('0x72'),'CallType',_0x4f49('0x73'),_0x4f49('0x74'),_0x4f49('0x75'),_0x4f49('0x76')];if(!_['isNil'](_0x5b88aa[_0x4f49('0x3c')][_0x4f49('0x6d')])&&_0x5b88aa[_0x4f49('0x3c')][_0x4f49('0x6d')]===_0x4f49('0x77')){_0x517144=['Type',_0x4f49('0x78'),_0x4f49('0x79'),'Status',_0x4f49('0x74'),'IsEscalated',_0x4f49('0x7a'),'SuppliedCompany'];}if(_0x1643fc){_[_0x4f49('0x7b')](_0x1643fc[_0x4f49('0x40')],function(_0x2ef19e){return _0x2ef19e[_0x4f49('0x7c')]===![]&&!_0x517144[_0x4f49('0x7d')](_0x2ef19e['name']);});return{'count':_0x1643fc[_0x4f49('0x40')][_0x4f49('0x41')],'rows':_[_0x4f49('0x35')](_0x1643fc[_0x4f49('0x40')],function(_0x4b7c61){return{'id':_0x4b7c61[_0x4f49('0x33')],'name':_0x4b7c61['label'],'custom':_0x4b7c61[_0x4f49('0x7c')],'options':_0x4b7c61['picklistValues'][_0x4f49('0x41')]>0x0?_[_0x4f49('0x35')](_0x4b7c61[_0x4f49('0x7e')],function(_0x34fca3){return{'name':_0x34fca3[_0x4f49('0x7f')],'value':_0x34fca3[_0x4f49('0x80')]};}):_0x4b7c61[_0x4f49('0x39')]==_0x4f49('0x81')?[{'name':_0x4f49('0x82'),'value':_0x4f49('0x83')},{'name':'False','value':_0x4f49('0x84')}]:[]};})};}})[_0x4f49('0x1e')](respondWithResult(_0x121972,null))[_0x4f49('0x4f')](function(_0x299849){var _0x302861=_0x5b88aa[_0x4f49('0x3c')]['test']?0x1f4:_0x299849[_0x4f49('0x85')]||0x1f4;logger[_0x4f49('0x22')](_0x4f49('0x86'),_0x4f49('0x61'),_0x302861,JSON['stringify'](_0x299849));delete _0x299849[_0x4f49('0x33')];if(_0x302861===0x191){_0x302861=0x190;}_0x121972['status'](_0x302861)[_0x4f49('0x34')](_0x5b88aa[_0x4f49('0x3c')][_0x4f49('0x1b')]?{'message':_0x4f49('0x87'),'statusCode':_0x299849['statusCode']}:_0x299849);});}; \ No newline at end of file +var _0xc4aa=['concat','isNil','ticketType','sobject','describe','CallDurationInSeconds','CallObject','CallType','IsArchived','Status','Case','Type','Reason','Priority','IsEscalated','SuppliedName','SuppliedCompany','remove','custom','includes','picklistValues','label','value','True','true','False','false','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','save','update','destroy','name','send','index','map','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','length','nolimit','limit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','SalesforceAccount','include','findAll','params','keys','includeAll','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','getSubjects','getDescriptions','SalesforceField','Descriptions','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','Connection','login'];(function(_0x2206a9,_0x3a8674){var _0x5d14d2=function(_0x4480d2){while(--_0x4480d2){_0x2206a9['push'](_0x2206a9['shift']());}};_0x5d14d2(++_0x3a8674);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];var integrations=require(_0xac4a('0x16'));var jayson=require(_0xac4a('0x17'));var client=jayson['client'][_0xac4a('0x18')]({'port':0x232a});function checkPasswordPattern(_0x68424a,_0x247b78,_0x6e00d4){if(_0x6e00d4){var _0x1b4313=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b4313[_0xac4a('0x19')](_0x247b78)){return _0x68424a;}else{throw new db[(_0xac4a('0x1a'))][(_0xac4a('0x1b'))](_0xac4a('0x1c'));}}else{return _0x68424a;}}function respondWithRpcPromise(_0x42c7fc,_0x11e101,_0x26dbb8,_0x4a2119){return new BPromise(function(_0x402fff,_0x34d797){var _0x23eb66=_0x4a2119||client;return _0x23eb66[_0xac4a('0x1d')](_0x42c7fc,_0x26dbb8)[_0xac4a('0x1e')](function(_0x387a54){logger[_0xac4a('0x1f')](_0xac4a('0x20'),_0x11e101,'request\x20sent');logger['debug'](_0xac4a('0x21'),_0x11e101,_0xac4a('0x22'),JSON[_0xac4a('0x23')](_0x387a54));if(_0x387a54['error']){if(_0x387a54[_0xac4a('0x24')][_0xac4a('0x25')]===0x1f4){logger[_0xac4a('0x24')](_0xac4a('0x20'),_0x11e101,_0x387a54[_0xac4a('0x24')][_0xac4a('0x26')]);return _0x34d797(_0x387a54[_0xac4a('0x24')][_0xac4a('0x26')]);}logger['error'](_0xac4a('0x20'),_0x11e101,_0x387a54[_0xac4a('0x24')]['message']);return _0x402fff(_0x387a54[_0xac4a('0x24')][_0xac4a('0x26')]);}else{logger[_0xac4a('0x1f')](_0xac4a('0x20'),_0x11e101,'request\x20sent');_0x402fff(_0x387a54[_0xac4a('0x27')][_0xac4a('0x26')]);}})[_0xac4a('0x28')](function(_0x412494){logger[_0xac4a('0x24')](_0xac4a('0x20'),_0x11e101,_0x412494);_0x34d797(_0x412494);});});}function respondWithStatusCode(_0x222507,_0x36054a){_0x36054a=_0x36054a||0xcc;return function(_0x3e2c69){if(_0x3e2c69){return _0x222507[_0xac4a('0x29')](_0x36054a);}return _0x222507[_0xac4a('0x2a')](_0x36054a)[_0xac4a('0x2b')]();};}function respondWithResult(_0x14832b,_0x472c57){_0x472c57=_0x472c57||0xc8;return function(_0x1c13dc){if(_0x1c13dc){return _0x14832b[_0xac4a('0x2a')](_0x472c57)['json'](_0x1c13dc);}};}function respondWithFilteredResult(_0x23b061,_0x267a22){return function(_0x42a33c){if(_0x42a33c){var _0x2772fe=_0x42a33c[_0xac4a('0x2c')],_0x116700=_0x267a22[_0xac4a('0x2d')],_0x4a5a9e=_0x267a22[_0xac4a('0x2d')]+_0x267a22['limit'],_0x47f49c;if(_0x4a5a9e>=_0x2772fe){_0x4a5a9e=_0x2772fe;_0x47f49c=0xc8;}else{_0x47f49c=0xce;}_0x23b061['status'](_0x47f49c);return _0x23b061[_0xac4a('0x2e')](_0xac4a('0x2f'),_0x116700+'-'+_0x4a5a9e+'/'+_0x2772fe)[_0xac4a('0x30')](_0x42a33c);}return null;};}function patchUpdates(_0x432066){return function(_0x17118e){try{jsonpatch['apply'](_0x17118e,_0x432066,!![]);}catch(_0x6dcc7f){return BPromise['reject'](_0x6dcc7f);}return _0x17118e[_0xac4a('0x31')]();};}function saveUpdates(_0x57adcf,_0x17e6de){return function(_0xfbe355){if(_0xfbe355){return _0xfbe355[_0xac4a('0x32')](_0x57adcf)[_0xac4a('0x1e')](function(_0x34577f){return _0x34577f;});}return null;};}function removeEntity(_0x61e552,_0xbd4591){return function(_0x1f13f3){if(_0x1f13f3){return _0x1f13f3[_0xac4a('0x33')]()[_0xac4a('0x1e')](function(){_0x61e552[_0xac4a('0x2a')](0xcc)[_0xac4a('0x2b')]();});}};}function handleEntityNotFound(_0x1a9be2,_0x1a9d4e){return function(_0x5634e2){if(!_0x5634e2){_0x1a9be2[_0xac4a('0x29')](0x194);}return _0x5634e2;};}function handleError(_0x1c41fb,_0x5a4e2b){_0x5a4e2b=_0x5a4e2b||0x1f4;return function(_0x2a5419){logger[_0xac4a('0x24')](_0x2a5419['stack']);if(_0x2a5419['name']){delete _0x2a5419[_0xac4a('0x34')];}_0x1c41fb[_0xac4a('0x2a')](_0x5a4e2b)[_0xac4a('0x35')](_0x2a5419);};}exports[_0xac4a('0x36')]=function(_0x4f5986,_0x453d02){var _0x2e56c6={},_0x4e7630={},_0x37f2ee={'count':0x0,'rows':[]};var _0x34f55c=_[_0xac4a('0x37')](db['SalesforceAccount'][_0xac4a('0x38')],function(_0x357f06){return{'name':_0x357f06[_0xac4a('0x39')],'type':_0x357f06['type'][_0xac4a('0x3a')]};});_0x4e7630[_0xac4a('0x3b')]=_['map'](_0x34f55c,'name');_0x4e7630[_0xac4a('0x3c')]=_['keys'](_0x4f5986['query']);_0x4e7630['filters']=_['intersection'](_0x4e7630[_0xac4a('0x3b')],_0x4e7630[_0xac4a('0x3c')]);_0x2e56c6[_0xac4a('0x3d')]=_[_0xac4a('0x3e')](_0x4e7630[_0xac4a('0x3b')],qs[_0xac4a('0x3f')](_0x4f5986[_0xac4a('0x3c')][_0xac4a('0x3f')]));_0x2e56c6[_0xac4a('0x3d')]=_0x2e56c6[_0xac4a('0x3d')][_0xac4a('0x40')]?_0x2e56c6[_0xac4a('0x3d')]:_0x4e7630['model'];if(!_0x4f5986['query']['hasOwnProperty'](_0xac4a('0x41'))){_0x2e56c6[_0xac4a('0x42')]=qs[_0xac4a('0x42')](_0x4f5986[_0xac4a('0x3c')][_0xac4a('0x42')]);_0x2e56c6[_0xac4a('0x2d')]=qs[_0xac4a('0x2d')](_0x4f5986[_0xac4a('0x3c')][_0xac4a('0x2d')]);}_0x2e56c6[_0xac4a('0x43')]=qs['sort'](_0x4f5986[_0xac4a('0x3c')][_0xac4a('0x44')]);_0x2e56c6[_0xac4a('0x45')]=qs[_0xac4a('0x46')](_[_0xac4a('0x47')](_0x4f5986['query'],_0x4e7630[_0xac4a('0x46')]));if(_0x4f5986[_0xac4a('0x3c')]['filter']){_0x2e56c6[_0xac4a('0x45')]=_['merge'](_0x2e56c6[_0xac4a('0x45')],{'$or':_[_0xac4a('0x37')](_0x34f55c,function(_0xe5ee0f){if(_0xe5ee0f[_0xac4a('0x48')]!==_0xac4a('0x49')){var _0x463f01={};_0x463f01[_0xe5ee0f[_0xac4a('0x34')]]={'$like':'%'+_0x4f5986[_0xac4a('0x3c')][_0xac4a('0x4a')]+'%'};return _0x463f01;}})});}_0x2e56c6=_[_0xac4a('0x4b')]({},_0x2e56c6,_0x4f5986[_0xac4a('0x4c')]);var _0x3b68b3={'where':_0x2e56c6['where']};return db[_0xac4a('0x4d')][_0xac4a('0x2c')](_0x3b68b3)[_0xac4a('0x1e')](function(_0x58759a){_0x37f2ee[_0xac4a('0x2c')]=_0x58759a;if(_0x4f5986[_0xac4a('0x3c')]['includeAll']){_0x2e56c6[_0xac4a('0x4e')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xac4a('0x4f')](_0x2e56c6);})[_0xac4a('0x1e')](function(_0x136a65){_0x37f2ee['rows']=_0x136a65;return _0x37f2ee;})['then'](respondWithFilteredResult(_0x453d02,_0x2e56c6))[_0xac4a('0x28')](handleError(_0x453d02,null));};exports['show']=function(_0x18ae96,_0x566258){var _0x3d2aaf={'raw':![],'where':{'id':_0x18ae96[_0xac4a('0x50')]['id']}},_0x530bbb={};_0x530bbb[_0xac4a('0x3b')]=_[_0xac4a('0x51')](db[_0xac4a('0x4d')]['rawAttributes']);_0x530bbb[_0xac4a('0x3c')]=_[_0xac4a('0x51')](_0x18ae96[_0xac4a('0x3c')]);_0x530bbb[_0xac4a('0x46')]=_[_0xac4a('0x3e')](_0x530bbb[_0xac4a('0x3b')],_0x530bbb[_0xac4a('0x3c')]);_0x3d2aaf['attributes']=_[_0xac4a('0x3e')](_0x530bbb[_0xac4a('0x3b')],qs['fields'](_0x18ae96[_0xac4a('0x3c')][_0xac4a('0x3f')]));_0x3d2aaf[_0xac4a('0x3d')]=_0x3d2aaf[_0xac4a('0x3d')]['length']?_0x3d2aaf[_0xac4a('0x3d')]:_0x530bbb[_0xac4a('0x3b')];if(_0x18ae96[_0xac4a('0x3c')][_0xac4a('0x52')]){_0x3d2aaf[_0xac4a('0x4e')]=[{'all':!![]}];}_0x3d2aaf=_['merge']({},_0x3d2aaf,_0x18ae96[_0xac4a('0x4c')]);return db['SalesforceAccount'][_0xac4a('0x53')](_0x3d2aaf)[_0xac4a('0x1e')](handleEntityNotFound(_0x566258,null))['then'](respondWithResult(_0x566258,null))['catch'](handleError(_0x566258,null));};exports[_0xac4a('0x54')]=function(_0x70fdc3,_0x4d448f){return db[_0xac4a('0x4d')][_0xac4a('0x54')](_0x70fdc3[_0xac4a('0x55')],{})[_0xac4a('0x1e')](respondWithResult(_0x4d448f,0xc9))['catch'](handleError(_0x4d448f,null));};exports[_0xac4a('0x32')]=function(_0x108f7c,_0xb43fdb){if(_0x108f7c[_0xac4a('0x55')]['id']){delete _0x108f7c[_0xac4a('0x55')]['id'];}return db[_0xac4a('0x4d')][_0xac4a('0x53')]({'where':{'id':_0x108f7c['params']['id']}})[_0xac4a('0x1e')](handleEntityNotFound(_0xb43fdb,null))[_0xac4a('0x1e')](saveUpdates(_0x108f7c[_0xac4a('0x55')],null))[_0xac4a('0x1e')](respondWithResult(_0xb43fdb,null))[_0xac4a('0x28')](handleError(_0xb43fdb,null));};exports[_0xac4a('0x33')]=function(_0x213df2,_0x236f57){return db[_0xac4a('0x4d')][_0xac4a('0x53')]({'where':{'id':_0x213df2[_0xac4a('0x50')]['id']}})[_0xac4a('0x1e')](handleEntityNotFound(_0x236f57,null))[_0xac4a('0x1e')](removeEntity(_0x236f57,null))[_0xac4a('0x28')](handleError(_0x236f57,null));};exports[_0xac4a('0x56')]=function(_0x11c753,_0x492aae,_0x13a577){var _0x479ebc={};var _0x2d598e={};var _0x4b7f79;var _0x2a30e8;return db['SalesforceAccount'][_0xac4a('0x57')]({'where':{'id':_0x11c753['params']['id']}})['then'](handleEntityNotFound(_0x492aae,null))[_0xac4a('0x1e')](function(_0x568ffb){if(_0x568ffb){_0x4b7f79=_0x568ffb;_0x2d598e[_0xac4a('0x3b')]=_[_0xac4a('0x51')](db[_0xac4a('0x58')][_0xac4a('0x38')]);_0x2d598e['query']=_[_0xac4a('0x51')](_0x11c753['query']);_0x2d598e[_0xac4a('0x46')]=_['intersection'](_0x2d598e[_0xac4a('0x3b')],_0x2d598e[_0xac4a('0x3c')]);_0x479ebc[_0xac4a('0x3d')]=_[_0xac4a('0x3e')](_0x2d598e[_0xac4a('0x3b')],qs[_0xac4a('0x3f')](_0x11c753[_0xac4a('0x3c')][_0xac4a('0x3f')]));_0x479ebc[_0xac4a('0x3d')]=_0x479ebc[_0xac4a('0x3d')][_0xac4a('0x40')]?_0x479ebc[_0xac4a('0x3d')]:_0x2d598e[_0xac4a('0x3b')];_0x479ebc[_0xac4a('0x43')]=qs[_0xac4a('0x44')](_0x11c753[_0xac4a('0x3c')][_0xac4a('0x44')]);_0x479ebc['where']=qs[_0xac4a('0x46')](_[_0xac4a('0x47')](_0x11c753['query'],_0x2d598e[_0xac4a('0x46')]));if(_0x11c753[_0xac4a('0x3c')][_0xac4a('0x4a')]){_0x479ebc[_0xac4a('0x45')]=_[_0xac4a('0x4b')](_0x479ebc['where'],{'$or':_['map'](_0x479ebc[_0xac4a('0x3d')],function(_0x11bb54){var _0x158223={};_0x158223[_0x11bb54]={'$like':'%'+_0x11c753[_0xac4a('0x3c')][_0xac4a('0x4a')]+'%'};return _0x158223;})});}_0x479ebc=_[_0xac4a('0x4b')]({},_0x479ebc,_0x11c753[_0xac4a('0x4c')]);return _0x4b7f79[_0xac4a('0x56')](_0x479ebc);}})[_0xac4a('0x1e')](function(_0x295f21){if(_0x295f21){_0x2a30e8=_0x295f21[_0xac4a('0x40')];if(!_0x11c753['query']['hasOwnProperty'](_0xac4a('0x41'))){_0x479ebc[_0xac4a('0x42')]=qs[_0xac4a('0x42')](_0x11c753[_0xac4a('0x3c')][_0xac4a('0x42')]);_0x479ebc[_0xac4a('0x2d')]=qs[_0xac4a('0x2d')](_0x11c753[_0xac4a('0x3c')][_0xac4a('0x2d')]);}return _0x4b7f79[_0xac4a('0x56')](_0x479ebc);}})[_0xac4a('0x1e')](function(_0xb12cc5){if(_0xb12cc5){return _0xb12cc5?{'count':_0x2a30e8,'rows':_0xb12cc5}:null;}})['then'](respondWithResult(_0x492aae,null))[_0xac4a('0x28')](handleError(_0x492aae,null));};exports[_0xac4a('0x59')]=function(_0x26bd31,_0x231932,_0x513976){if(_0x26bd31[_0xac4a('0x55')]['id']){delete _0x26bd31['body']['id'];}return db[_0xac4a('0x4d')][_0xac4a('0x57')]({'where':{'id':_0x26bd31['params']['id']}})['then'](handleEntityNotFound(_0x231932,null))[_0xac4a('0x1e')](function(_0x3b8974){if(_0x3b8974){_0x26bd31[_0xac4a('0x55')]['AccountId']=_0x3b8974['id'];_0x26bd31[_0xac4a('0x55')]['Subjects']=integrations[_0xac4a('0x5a')](_0x26bd31['body']['channel'],_0x26bd31[_0xac4a('0x55')]['type']);_0x26bd31[_0xac4a('0x55')]['Descriptions']=integrations[_0xac4a('0x5b')](_0x26bd31[_0xac4a('0x55')]['channel'],_0x26bd31[_0xac4a('0x55')]['type']);return db[_0xac4a('0x58')][_0xac4a('0x54')](_0x26bd31['body'],{'include':[{'model':db[_0xac4a('0x5c')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0xac4a('0x5d')}]});}return null;})['then'](respondWithResult(_0x231932,null))[_0xac4a('0x28')](handleError(_0x231932,null));};exports['getFields']=function(_0x4ccd67,_0x1588e2,_0x4065c0){var _0x3bec8a;var _0x54c063='';var _0x504256=_0xac4a('0x5e');return db[_0xac4a('0x4d')]['findOne']({'where':{'id':_0x4ccd67['params']['id']},'attributes':['id',_0xac4a('0x5f'),_0xac4a('0x60'),_0xac4a('0x61'),_0xac4a('0x62'),_0xac4a('0x63'),_0xac4a('0x64')]})[_0xac4a('0x1e')](handleEntityNotFound(_0x1588e2,null))[_0xac4a('0x1e')](function(_0x26bf73){if(_0x26bf73){_0x54c063=_0x26bf73['remoteUri'];var _0x1201e8=_0x54c063[_0xac4a('0x65')](-0x1);if(_0x1201e8==='/'){_0x54c063=_0x54c063[_0xac4a('0x66')](0x0,_0x54c063['lastIndexOf'](_0x1201e8));}_0x3bec8a=new jsforce[(_0xac4a('0x67'))]({'oauth2':{'loginUrl':_0x54c063,'clientId':_0x26bf73[_0xac4a('0x60')],'clientSecret':_0x26bf73[_0xac4a('0x61')]}});return _0x3bec8a[_0xac4a('0x68')](_0x26bf73[_0xac4a('0x62')],_0x26bf73['password'][_0xac4a('0x69')](_0x26bf73[_0xac4a('0x64')]));}})[_0xac4a('0x1e')](function(_0x37e519){if(_0x37e519){if(!_[_0xac4a('0x6a')](_0x4ccd67[_0xac4a('0x3c')][_0xac4a('0x6b')])){_0x504256=_0x4ccd67['query'][_0xac4a('0x6b')];}return _0x3bec8a[_0xac4a('0x6c')](_0x504256)[_0xac4a('0x6d')]();}})[_0xac4a('0x1e')](function(_0x1bb24d){var _0x171c47=['CallDisposition',_0xac4a('0x6e'),_0xac4a('0x6f'),_0xac4a('0x70'),_0xac4a('0x71'),'Priority',_0xac4a('0x72'),'Type'];if(!_[_0xac4a('0x6a')](_0x4ccd67[_0xac4a('0x3c')]['ticketType'])&&_0x4ccd67['query'][_0xac4a('0x6b')]===_0xac4a('0x73')){_0x171c47=[_0xac4a('0x74'),'Origin',_0xac4a('0x75'),'Status',_0xac4a('0x76'),_0xac4a('0x77'),_0xac4a('0x78'),_0xac4a('0x79')];}if(_0x1bb24d){_[_0xac4a('0x7a')](_0x1bb24d['fields'],function(_0x50f471){return _0x50f471[_0xac4a('0x7b')]===![]&&!_0x171c47[_0xac4a('0x7c')](_0x50f471[_0xac4a('0x34')]);});return{'count':_0x1bb24d[_0xac4a('0x3f')][_0xac4a('0x40')],'rows':_[_0xac4a('0x37')](_0x1bb24d[_0xac4a('0x3f')],function(_0x186410){return{'id':_0x186410['name'],'name':_0x186410['label'],'custom':_0x186410[_0xac4a('0x7b')],'options':_0x186410[_0xac4a('0x7d')][_0xac4a('0x40')]>0x0?_[_0xac4a('0x37')](_0x186410[_0xac4a('0x7d')],function(_0x2ea4a4){return{'name':_0x2ea4a4[_0xac4a('0x7e')],'value':_0x2ea4a4[_0xac4a('0x7f')]};}):_0x186410['type']=='boolean'?[{'name':_0xac4a('0x80'),'value':_0xac4a('0x81')},{'name':_0xac4a('0x82'),'value':_0xac4a('0x83')}]:[]};})};}})[_0xac4a('0x1e')](respondWithResult(_0x1588e2,null))[_0xac4a('0x28')](function(_0x338af3){var _0x51c3ef=_0x4ccd67[_0xac4a('0x3c')][_0xac4a('0x19')]?0x1f4:_0x338af3[_0xac4a('0x84')]||0x1f4;logger['error'](_0xac4a('0x85'),_0xac4a('0x86'),_0x51c3ef,JSON[_0xac4a('0x23')](_0x338af3));delete _0x338af3[_0xac4a('0x34')];if(_0x51c3ef===0x191){_0x51c3ef=0x190;}_0x1588e2[_0xac4a('0x2a')](_0x51c3ef)[_0xac4a('0x35')](_0x4ccd67[_0xac4a('0x3c')][_0xac4a('0x19')]?{'message':_0xac4a('0x87'),'statusCode':_0x338af3['statusCode']}:_0x338af3);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ceccdbb..a2c7bd7 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 _0xea73=['api','moment','request-promise','path','../../config/environment','./intSalesforceAccount.attributes','define','int_salesforce_accounts','util','../../config/logger'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0xea73,0x166));var _0x3ea7=function(_0x540c07,_0x5ef3b3){_0x540c07=_0x540c07-0x0;var _0x1f10d2=_0xea73[_0x540c07];return _0x1f10d2;};'use strict';var _=require('lodash');var util=require(_0x3ea7('0x0'));var logger=require(_0x3ea7('0x1'))(_0x3ea7('0x2'));var moment=require(_0x3ea7('0x3'));var BPromise=require('bluebird');var rp=require(_0x3ea7('0x4'));var fs=require('fs');var path=require(_0x3ea7('0x5'));var rimraf=require('rimraf');var config=require(_0x3ea7('0x6'));var attributes=require(_0x3ea7('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xa0eac2,_0xfd314c){return _0xa0eac2[_0x3ea7('0x8')]('SalesforceAccount',attributes,{'tableName':_0x3ea7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x615d=['moment','bluebird','path','rimraf','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger'];(function(_0x20e754,_0x3cbd96){var _0x1a4b3c=function(_0x53a00d){while(--_0x53a00d){_0x20e754['push'](_0x20e754['shift']());}};_0x1a4b3c(++_0x3cbd96);}(_0x615d,0x1ac));var _0xd615=function(_0x46ee6b,_0x7f3e6c){_0x46ee6b=_0x46ee6b-0x0;var _0x97d54b=_0x615d[_0x46ee6b];return _0x97d54b;};'use strict';var _=require(_0xd615('0x0'));var util=require('util');var logger=require(_0xd615('0x1'))('api');var moment=require(_0xd615('0x2'));var BPromise=require(_0xd615('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd615('0x4'));var rimraf=require(_0xd615('0x5'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xd615('0x6'));module['exports']=function(_0x587b5f,_0x1ee77a){return _0x587b5f[_0xd615('0x7')](_0xd615('0x8'),attributes,{'tableName':_0xd615('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 31224d4..e526872 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 _0xe14d=['catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','map','model','ShowSalesforceAccount','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x34e37e,_0x3db1ca){var _0x4eb5a3=function(_0x9e3f45){while(--_0x9e3f45){_0x34e37e['push'](_0x34e37e['shift']());}};_0x4eb5a3(++_0x3db1ca);}(_0xe14d,0x1ee));var _0xde14=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xe14d[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var BPromise=require(_0xde14('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde14('0x4'));var db=require(_0xde14('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xde14('0x6'))(_0xde14('0x7'));var config=require(_0xde14('0x8'));var jayson=require(_0xde14('0x9'));var client=jayson[_0xde14('0xa')][_0xde14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b1f6b,_0x5a1344,_0x1bd49d){return new BPromise(function(_0x115b7d,_0x2b0e7c){return client[_0xde14('0xc')](_0x4b1f6b,_0x1bd49d)[_0xde14('0xd')](function(_0x176909){logger[_0xde14('0xe')](_0xde14('0xf'),_0x5a1344,'request\x20sent');logger[_0xde14('0x10')](_0xde14('0x11'),_0x5a1344,_0xde14('0x12'),JSON[_0xde14('0x13')](_0x176909));if(_0x176909[_0xde14('0x14')]){if(_0x176909[_0xde14('0x14')][_0xde14('0x15')]===0x1f4){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909[_0xde14('0x14')][_0xde14('0x16')]);return _0x2b0e7c(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x176909['error']['message']);return _0x115b7d(_0x176909[_0xde14('0x14')][_0xde14('0x16')]);}else{logger[_0xde14('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x5a1344,_0xde14('0x12'));_0x115b7d(_0x176909[_0xde14('0x17')][_0xde14('0x16')]);}})[_0xde14('0x18')](function(_0x3de959){logger[_0xde14('0x14')](_0xde14('0xf'),_0x5a1344,_0x3de959);_0x2b0e7c(_0x3de959);});});}exports[_0xde14('0x19')]=function(_0x3cc317){var _0x10c4ab=this;return new Promise(function(_0x590a8b,_0x3f5fcf){return db[_0xde14('0x1a')][_0xde14('0x1b')]({'raw':_0x3cc317[_0xde14('0x1c')]?_0x3cc317['options'][_0xde14('0x1d')]===undefined?!![]:![]:!![],'where':_0x3cc317['options']?_0x3cc317[_0xde14('0x1c')]['where']||null:null,'attributes':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x1e')]||null:null,'limit':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x1f')]||null:null,'include':_0x3cc317[_0xde14('0x1c')]?_0x3cc317[_0xde14('0x1c')][_0xde14('0x20')]?_[_0xde14('0x21')](_0x3cc317[_0xde14('0x1c')][_0xde14('0x20')],function(_0x8f8033){return{'model':db[_0x8f8033['model']],'as':_0x8f8033['as'],'attributes':_0x8f8033[_0xde14('0x1e')],'include':_0x8f8033[_0xde14('0x20')]?_[_0xde14('0x21')](_0x8f8033[_0xde14('0x20')],function(_0x1bb7be){return{'model':db[_0x1bb7be[_0xde14('0x22')]],'as':_0x1bb7be['as'],'attributes':_0x1bb7be[_0xde14('0x1e')],'include':_0x1bb7be[_0xde14('0x20')]?_[_0xde14('0x21')](_0x1bb7be[_0xde14('0x20')],function(_0x4eff65){return{'model':db[_0x4eff65[_0xde14('0x22')]],'as':_0x4eff65['as'],'attributes':_0x4eff65[_0xde14('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde14('0xd')](function(_0xf8279a){logger['info'](_0xde14('0x19'),_0x3cc317);logger[_0xde14('0x10')](_0xde14('0x19'),_0x3cc317,JSON['stringify'](_0xf8279a));_0x590a8b(_0xf8279a);})[_0xde14('0x18')](function(_0x582537){logger[_0xde14('0x14')](_0xde14('0x19'),_0x582537[_0xde14('0x16')],_0x3cc317);_0x3f5fcf(_0x10c4ab[_0xde14('0x14')](0x1f4,_0x582537[_0xde14('0x16')]));});});};exports[_0xde14('0x23')]=function(_0xae9dca){var _0x464666=this;return new Promise(function(_0x4e7c5b,_0xbfc01b){return db[_0xde14('0x1a')]['find']({'raw':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x1d')]===undefined?!![]:![]:!![],'where':_0xae9dca[_0xde14('0x1c')]?_0xae9dca[_0xde14('0x1c')][_0xde14('0x24')]||null:null,'attributes':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x1e')]||null:null,'include':_0xae9dca[_0xde14('0x1c')]?_0xae9dca['options'][_0xde14('0x20')]?_[_0xde14('0x21')](_0xae9dca[_0xde14('0x1c')][_0xde14('0x20')],function(_0x2713fb){return{'model':db[_0x2713fb[_0xde14('0x22')]],'as':_0x2713fb['as'],'attributes':_0x2713fb[_0xde14('0x1e')],'include':_0x2713fb[_0xde14('0x20')]?_[_0xde14('0x21')](_0x2713fb['include'],function(_0x50084f){return{'model':db[_0x50084f[_0xde14('0x22')]],'as':_0x50084f['as'],'attributes':_0x50084f[_0xde14('0x1e')],'include':_0x50084f[_0xde14('0x20')]?_[_0xde14('0x21')](_0x50084f[_0xde14('0x20')],function(_0x23813f){return{'model':db[_0x23813f[_0xde14('0x22')]],'as':_0x23813f['as'],'attributes':_0x23813f[_0xde14('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xde14('0xd')](function(_0x4e33e0){logger[_0xde14('0xe')]('ShowSalesforceAccount',_0xae9dca);logger['debug']('ShowSalesforceAccount',_0xae9dca,JSON[_0xde14('0x13')](_0x4e33e0));_0x4e7c5b(_0x4e33e0);})[_0xde14('0x18')](function(_0x398f63){logger[_0xde14('0x14')](_0xde14('0x23'),_0x398f63[_0xde14('0x16')],_0xae9dca);_0xbfc01b(_0x464666[_0xde14('0x14')](0x1f4,_0x398f63[_0xde14('0x16')]));});});}; \ No newline at end of file +var _0x2750=['../../config/environment','jayson/promise','http','request','then','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','SalesforceAccount','options','raw','where','attributes','include','model','map','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4555c2,_0x138d83){var _0x492d1d=function(_0x55a0c5){while(--_0x55a0c5){_0x4555c2['push'](_0x4555c2['shift']());}};_0x492d1d(++_0x138d83);}(_0x2750,0x13b));var _0x0275=function(_0x1bd464,_0x516e58){_0x1bd464=_0x1bd464-0x0;var _0x414341=_0x2750[_0x1bd464];return _0x414341;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var moment=require(_0x0275('0x1'));var BPromise=require(_0x0275('0x2'));var rs=require(_0x0275('0x3'));var fs=require('fs');var Redis=require(_0x0275('0x4'));var db=require(_0x0275('0x5'))['db'];var utils=require(_0x0275('0x6'));var logger=require(_0x0275('0x7'))(_0x0275('0x8'));var config=require(_0x0275('0x9'));var jayson=require(_0x0275('0xa'));var client=jayson['client'][_0x0275('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2421fd,_0x2fa0eb,_0x2e4b5c){return new BPromise(function(_0x4dffd1,_0x1f7c4a){return client[_0x0275('0xc')](_0x2421fd,_0x2e4b5c)[_0x0275('0xd')](function(_0x5e0e4a){logger['info'](_0x0275('0xe'),_0x2fa0eb,'request\x20sent');logger[_0x0275('0xf')](_0x0275('0x10'),_0x2fa0eb,_0x0275('0x11'),JSON[_0x0275('0x12')](_0x5e0e4a));if(_0x5e0e4a[_0x0275('0x13')]){if(_0x5e0e4a['error'][_0x0275('0x14')]===0x1f4){logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a['error']['message']);return _0x1f7c4a(_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);}logger[_0x0275('0x13')](_0x0275('0xe'),_0x2fa0eb,_0x5e0e4a[_0x0275('0x13')][_0x0275('0x15')]);return _0x4dffd1(_0x5e0e4a['error'][_0x0275('0x15')]);}else{logger[_0x0275('0x16')]('SalesforceAccount,\x20%s,\x20%s',_0x2fa0eb,_0x0275('0x11'));_0x4dffd1(_0x5e0e4a[_0x0275('0x17')]['message']);}})[_0x0275('0x18')](function(_0x31c76b){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x2fa0eb,_0x31c76b);_0x1f7c4a(_0x31c76b);});});}exports['GetSalesforceAccount']=function(_0x591d27){var _0x5b8746=this;return new Promise(function(_0x566ad6,_0x44f7b0){return db[_0x0275('0x19')]['findAll']({'raw':_0x591d27[_0x0275('0x1a')]?_0x591d27[_0x0275('0x1a')][_0x0275('0x1b')]===undefined?!![]:![]:!![],'where':_0x591d27['options']?_0x591d27[_0x0275('0x1a')][_0x0275('0x1c')]||null:null,'attributes':_0x591d27['options']?_0x591d27['options'][_0x0275('0x1d')]||null:null,'limit':_0x591d27[_0x0275('0x1a')]?_0x591d27[_0x0275('0x1a')]['limit']||null:null,'include':_0x591d27[_0x0275('0x1a')]?_0x591d27['options'][_0x0275('0x1e')]?_['map'](_0x591d27[_0x0275('0x1a')][_0x0275('0x1e')],function(_0x594321){return{'model':db[_0x594321[_0x0275('0x1f')]],'as':_0x594321['as'],'attributes':_0x594321[_0x0275('0x1d')],'include':_0x594321[_0x0275('0x1e')]?_['map'](_0x594321[_0x0275('0x1e')],function(_0x44bbf8){return{'model':db[_0x44bbf8[_0x0275('0x1f')]],'as':_0x44bbf8['as'],'attributes':_0x44bbf8[_0x0275('0x1d')],'include':_0x44bbf8[_0x0275('0x1e')]?_[_0x0275('0x20')](_0x44bbf8['include'],function(_0x35343c){return{'model':db[_0x35343c[_0x0275('0x1f')]],'as':_0x35343c['as'],'attributes':_0x35343c[_0x0275('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0275('0xd')](function(_0x4689a3){logger['info'](_0x0275('0x21'),_0x591d27);logger[_0x0275('0xf')](_0x0275('0x21'),_0x591d27,JSON[_0x0275('0x12')](_0x4689a3));_0x566ad6(_0x4689a3);})[_0x0275('0x18')](function(_0x49e645){logger[_0x0275('0x13')](_0x0275('0x21'),_0x49e645[_0x0275('0x15')],_0x591d27);_0x44f7b0(_0x5b8746['error'](0x1f4,_0x49e645['message']));});});};exports[_0x0275('0x22')]=function(_0x299190){var _0x5dc2bc=this;return new Promise(function(_0x7eff96,_0x155a50){return db[_0x0275('0x19')][_0x0275('0x23')]({'raw':_0x299190['options']?_0x299190[_0x0275('0x1a')][_0x0275('0x1b')]===undefined?!![]:![]:!![],'where':_0x299190[_0x0275('0x1a')]?_0x299190[_0x0275('0x1a')]['where']||null:null,'attributes':_0x299190[_0x0275('0x1a')]?_0x299190['options'][_0x0275('0x1d')]||null:null,'include':_0x299190['options']?_0x299190[_0x0275('0x1a')][_0x0275('0x1e')]?_['map'](_0x299190[_0x0275('0x1a')][_0x0275('0x1e')],function(_0x1575be){return{'model':db[_0x1575be[_0x0275('0x1f')]],'as':_0x1575be['as'],'attributes':_0x1575be['attributes'],'include':_0x1575be[_0x0275('0x1e')]?_[_0x0275('0x20')](_0x1575be[_0x0275('0x1e')],function(_0x1d872a){return{'model':db[_0x1d872a[_0x0275('0x1f')]],'as':_0x1d872a['as'],'attributes':_0x1d872a['attributes'],'include':_0x1d872a[_0x0275('0x1e')]?_[_0x0275('0x20')](_0x1d872a[_0x0275('0x1e')],function(_0x364773){return{'model':db[_0x364773[_0x0275('0x1f')]],'as':_0x364773['as'],'attributes':_0x364773[_0x0275('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0275('0xd')](function(_0x471fc7){logger[_0x0275('0x16')](_0x0275('0x22'),_0x299190);logger[_0x0275('0xf')]('ShowSalesforceAccount',_0x299190,JSON[_0x0275('0x12')](_0x471fc7));_0x7eff96(_0x471fc7);})[_0x0275('0x18')](function(_0xc7d2fe){logger[_0x0275('0x13')](_0x0275('0x22'),_0xc7d2fe[_0x0275('0x15')],_0x299190);_0x155a50(_0x5dc2bc[_0x0275('0x13')](0x1f4,_0xc7d2fe[_0x0275('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 9c3282f..ef0ebc2 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 _0x9d67=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x415816,_0x666ce3){var _0x351d34=function(_0xd9e554){while(--_0xd9e554){_0x415816['push'](_0x415816['shift']());}};_0x351d34(++_0x666ce3);}(_0x9d67,0x1e6));var _0x79d6=function(_0x4e82ce,_0x435ec7){_0x4e82ce=_0x4e82ce-0x0;var _0x18cf87=_0x9d67[_0x4e82ce];return _0x18cf87;};'use strict';var multer=require(_0x79d6('0x0'));var util=require(_0x79d6('0x1'));var path=require(_0x79d6('0x2'));var timeout=require(_0x79d6('0x3'));var express=require(_0x79d6('0x4'));var router=express['Router']();var auth=require(_0x79d6('0x5'));var interaction=require(_0x79d6('0x6'));var config=require(_0x79d6('0x7'));var controller=require(_0x79d6('0x8'));router[_0x79d6('0x9')]('/',auth[_0x79d6('0xa')](),controller['index']);router[_0x79d6('0x9')](_0x79d6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x79d6('0x9')](_0x79d6('0xc'),auth['isAuthenticated'](),controller[_0x79d6('0xd')]);router[_0x79d6('0x9')](_0x79d6('0xe'),auth[_0x79d6('0xa')](),controller[_0x79d6('0xf')]);router[_0x79d6('0x9')](_0x79d6('0x10'),auth[_0x79d6('0xa')](),controller[_0x79d6('0x11')]);router[_0x79d6('0x12')]('/',auth[_0x79d6('0xa')](),controller['create']);router[_0x79d6('0x13')]('/:id',auth[_0x79d6('0xa')](),controller['update']);router[_0x79d6('0x14')]('/:id',auth[_0x79d6('0xa')](),controller[_0x79d6('0x15')]);module[_0x79d6('0x16')]=router; \ No newline at end of file +var _0xf6f8=['show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated'];(function(_0xd0e268,_0x18863c){var _0x272c9f=function(_0x536f88){while(--_0x536f88){_0xd0e268['push'](_0xd0e268['shift']());}};_0x272c9f(++_0x18863c);}(_0xf6f8,0xba));var _0x8f6f=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xf6f8[_0x31ced5];return _0x10d9e5;};'use strict';var multer=require(_0x8f6f('0x0'));var util=require(_0x8f6f('0x1'));var path=require(_0x8f6f('0x2'));var timeout=require(_0x8f6f('0x3'));var express=require(_0x8f6f('0x4'));var router=express[_0x8f6f('0x5')]();var auth=require(_0x8f6f('0x6'));var interaction=require(_0x8f6f('0x7'));var config=require(_0x8f6f('0x8'));var controller=require(_0x8f6f('0x9'));router[_0x8f6f('0xa')]('/',auth[_0x8f6f('0xb')](),controller['index']);router[_0x8f6f('0xa')]('/:id',auth[_0x8f6f('0xb')](),controller[_0x8f6f('0xc')]);router[_0x8f6f('0xa')]('/:id/fields',auth[_0x8f6f('0xb')](),controller[_0x8f6f('0xd')]);router[_0x8f6f('0xa')]('/:id/subjects',auth[_0x8f6f('0xb')](),controller[_0x8f6f('0xe')]);router[_0x8f6f('0xa')](_0x8f6f('0xf'),auth['isAuthenticated'](),controller[_0x8f6f('0x10')]);router[_0x8f6f('0x11')]('/',auth[_0x8f6f('0xb')](),controller['create']);router[_0x8f6f('0x12')](_0x8f6f('0x13'),auth['isAuthenticated'](),controller[_0x8f6f('0x14')]);router[_0x8f6f('0x15')](_0x8f6f('0x13'),auth[_0x8f6f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index d47d216..97cf453 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 _0x0649=['lead','contact','sequelize','exports','STRING','ENUM','Case','Task','contact_lead'];(function(_0x2f3b14,_0x554f94){var _0x20e924=function(_0x3f4c1c){while(--_0x3f4c1c){_0x2f3b14['push'](_0x2f3b14['shift']());}};_0x20e924(++_0x554f94);}(_0x0649,0x77));var _0x9064=function(_0x157e8f,_0x317587){_0x157e8f=_0x157e8f-0x0;var _0x57df7f=_0x0649[_0x157e8f];return _0x57df7f;};'use strict';var Sequelize=require(_0x9064('0x0'));module[_0x9064('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9064('0x2')]},'ticketType':{'type':Sequelize[_0x9064('0x3')]('Task',_0x9064('0x4')),'defaultValue':_0x9064('0x5')},'moduleSearch':{'type':Sequelize[_0x9064('0x3')](_0x9064('0x6'),'contact',_0x9064('0x7')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x9064('0x3')]('nothing',_0x9064('0x8'),'lead'),'defaultValue':_0x9064('0x7')}}; \ No newline at end of file +var _0x693e=['contact_lead','contact','lead','STRING','ENUM','Task','Case'];(function(_0x40a474,_0x5074af){var _0x59ebb0=function(_0x1a52b5){while(--_0x1a52b5){_0x40a474['push'](_0x40a474['shift']());}};_0x59ebb0(++_0x5074af);}(_0x693e,0xdc));var _0xe693=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x693e[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe693('0x0')]},'description':{'type':Sequelize[_0xe693('0x0')]},'ticketType':{'type':Sequelize[_0xe693('0x1')](_0xe693('0x2'),_0xe693('0x3')),'defaultValue':_0xe693('0x2')},'moduleSearch':{'type':Sequelize[_0xe693('0x1')](_0xe693('0x4'),_0xe693('0x5'),_0xe693('0x6')),'defaultValue':_0xe693('0x4')},'moduleCreate':{'type':Sequelize[_0xe693('0x1')]('nothing',_0xe693('0x5'),_0xe693('0x6')),'defaultValue':_0xe693('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 34cce14..9a80467 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 _0x55d4=['type','key','model','map','keys','query','attributes','intersection','fields','length','limit','sort','where','filters','merge','options','includeAll','include','rows','catch','params','find','create','body','getFields','findOne','SalesforceField','pick','filter','nolimit','getSubjects','order','hasOwnProperty','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','test','Sequelize','ValidationError','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','stack','name','send','SalesforceConfiguration','rawAttributes'];(function(_0x91ec22,_0x3cc1b7){var _0x4f655f=function(_0x3e70a0){while(--_0x3e70a0){_0x91ec22['push'](_0x91ec22['shift']());}};_0x4f655f(++_0x3cc1b7);}(_0x55d4,0x12d));var _0x455d=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x55d4[_0x40a045];return _0x1a687c;};'use strict';var pdf=require(_0x455d('0x0'));var emlformat=require(_0x455d('0x1'));var rimraf=require(_0x455d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x455d('0x3'));var rp=require(_0x455d('0x4'));var moment=require('moment');var BPromise=require(_0x455d('0x5'));var Mustache=require(_0x455d('0x6'));var util=require(_0x455d('0x7'));var path=require('path');var sox=require(_0x455d('0x8'));var csv=require(_0x455d('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x455d('0xa'));var squel=require(_0x455d('0xb'));var crypto=require(_0x455d('0xc'));var jsforce=require(_0x455d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x455d('0x9'));var querystring=require('querystring');var Papa=require(_0x455d('0xe'));var Redis=require(_0x455d('0xf'));var authService=require(_0x455d('0x10'));var qs=require(_0x455d('0x11'));var as=require(_0x455d('0x12'));var hardwareService=require(_0x455d('0x13'));var logger=require(_0x455d('0x14'))('api');var utils=require(_0x455d('0x15'));var config=require(_0x455d('0x16'));var db=require(_0x455d('0x17'))['db'];var jayson=require(_0x455d('0x18'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x1a9712,_0x585d67,_0x37ba52){if(_0x37ba52){var _0x14288f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14288f[_0x455d('0x19')](_0x585d67)){return _0x1a9712;}else{throw new db[(_0x455d('0x1a'))][(_0x455d('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 _0x1a9712;}}function respondWithRpcPromise(_0x1e603b,_0x4cbf06,_0x207d67,_0xb3174a){return new BPromise(function(_0x4bbca0,_0x2d27c4){var _0x39cba7=_0xb3174a||client;return _0x39cba7[_0x455d('0x1c')](_0x1e603b,_0x207d67)[_0x455d('0x1d')](function(_0xc33c42){logger[_0x455d('0x1e')](_0x455d('0x1f'),_0x4cbf06,_0x455d('0x20'));logger[_0x455d('0x21')](_0x455d('0x22'),_0x4cbf06,_0x455d('0x20'),JSON['stringify'](_0xc33c42));if(_0xc33c42[_0x455d('0x23')]){if(_0xc33c42['error'][_0x455d('0x24')]===0x1f4){logger[_0x455d('0x23')](_0x455d('0x1f'),_0x4cbf06,_0xc33c42[_0x455d('0x23')]['message']);return _0x2d27c4(_0xc33c42['error'][_0x455d('0x25')]);}logger['error'](_0x455d('0x1f'),_0x4cbf06,_0xc33c42[_0x455d('0x23')][_0x455d('0x25')]);return _0x4bbca0(_0xc33c42[_0x455d('0x23')][_0x455d('0x25')]);}else{logger[_0x455d('0x1e')](_0x455d('0x1f'),_0x4cbf06,_0x455d('0x20'));_0x4bbca0(_0xc33c42[_0x455d('0x26')][_0x455d('0x25')]);}})['catch'](function(_0x180bf9){logger[_0x455d('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4cbf06,_0x180bf9);_0x2d27c4(_0x180bf9);});});}function respondWithStatusCode(_0x26818d,_0x1a1710){_0x1a1710=_0x1a1710||0xcc;return function(_0x343bd8){if(_0x343bd8){return _0x26818d[_0x455d('0x27')](_0x1a1710);}return _0x26818d['status'](_0x1a1710)[_0x455d('0x28')]();};}function respondWithResult(_0x18cd4c,_0x17e4a0){_0x17e4a0=_0x17e4a0||0xc8;return function(_0x12f5b7){if(_0x12f5b7){return _0x18cd4c[_0x455d('0x29')](_0x17e4a0)[_0x455d('0x2a')](_0x12f5b7);}};}function respondWithFilteredResult(_0x31f856,_0x3735f1){return function(_0x13afa4){if(_0x13afa4){var _0x4e9da6=_0x13afa4[_0x455d('0x2b')],_0x174985=_0x3735f1[_0x455d('0x2c')],_0x67ddbe=_0x3735f1[_0x455d('0x2c')]+_0x3735f1['limit'],_0x1d7f50;if(_0x67ddbe>=_0x4e9da6){_0x67ddbe=_0x4e9da6;_0x1d7f50=0xc8;}else{_0x1d7f50=0xce;}_0x31f856[_0x455d('0x29')](_0x1d7f50);return _0x31f856['set'](_0x455d('0x2d'),_0x174985+'-'+_0x67ddbe+'/'+_0x4e9da6)[_0x455d('0x2a')](_0x13afa4);}return null;};}function patchUpdates(_0x382b85){return function(_0x3fa730){try{jsonpatch[_0x455d('0x2e')](_0x3fa730,_0x382b85,!![]);}catch(_0x17d654){return BPromise[_0x455d('0x2f')](_0x17d654);}return _0x3fa730[_0x455d('0x30')]();};}function saveUpdates(_0x456a03,_0x2bc9c7){return function(_0x131419){if(_0x131419){return _0x131419[_0x455d('0x31')](_0x456a03)[_0x455d('0x1d')](function(_0x461ed3){return _0x461ed3;});}return null;};}function removeEntity(_0x373148,_0x45dd1a){return function(_0x3ebbbe){if(_0x3ebbbe){return _0x3ebbbe['destroy']()[_0x455d('0x1d')](function(){_0x373148[_0x455d('0x29')](0xcc)[_0x455d('0x28')]();});}};}function handleEntityNotFound(_0x20040d,_0x90be39){return function(_0x593bff){if(!_0x593bff){_0x20040d[_0x455d('0x27')](0x194);}return _0x593bff;};}function handleError(_0x28cc93,_0x52d7bd){_0x52d7bd=_0x52d7bd||0x1f4;return function(_0x3920c){logger[_0x455d('0x23')](_0x3920c[_0x455d('0x32')]);if(_0x3920c[_0x455d('0x33')]){delete _0x3920c[_0x455d('0x33')];}_0x28cc93['status'](_0x52d7bd)[_0x455d('0x34')](_0x3920c);};}exports['index']=function(_0x3b32e7,_0x1a685e){var _0x553770={},_0x49b7ea={},_0x20193f={'count':0x0,'rows':[]};var _0x40de45=_['map'](db[_0x455d('0x35')][_0x455d('0x36')],function(_0xec3e6b){return{'name':_0xec3e6b['fieldName'],'type':_0xec3e6b[_0x455d('0x37')][_0x455d('0x38')]};});_0x49b7ea[_0x455d('0x39')]=_[_0x455d('0x3a')](_0x40de45,_0x455d('0x33'));_0x49b7ea['query']=_[_0x455d('0x3b')](_0x3b32e7[_0x455d('0x3c')]);_0x49b7ea['filters']=_['intersection'](_0x49b7ea[_0x455d('0x39')],_0x49b7ea[_0x455d('0x3c')]);_0x553770[_0x455d('0x3d')]=_[_0x455d('0x3e')](_0x49b7ea['model'],qs[_0x455d('0x3f')](_0x3b32e7[_0x455d('0x3c')][_0x455d('0x3f')]));_0x553770[_0x455d('0x3d')]=_0x553770[_0x455d('0x3d')][_0x455d('0x40')]?_0x553770[_0x455d('0x3d')]:_0x49b7ea['model'];if(!_0x3b32e7['query']['hasOwnProperty']('nolimit')){_0x553770[_0x455d('0x41')]=qs[_0x455d('0x41')](_0x3b32e7['query']['limit']);_0x553770[_0x455d('0x2c')]=qs[_0x455d('0x2c')](_0x3b32e7[_0x455d('0x3c')][_0x455d('0x2c')]);}_0x553770['order']=qs[_0x455d('0x42')](_0x3b32e7[_0x455d('0x3c')][_0x455d('0x42')]);_0x553770[_0x455d('0x43')]=qs[_0x455d('0x44')](_['pick'](_0x3b32e7['query'],_0x49b7ea[_0x455d('0x44')]));if(_0x3b32e7['query']['filter']){_0x553770[_0x455d('0x43')]=_['merge'](_0x553770['where'],{'$or':_[_0x455d('0x3a')](_0x40de45,function(_0x15b4cf){if(_0x15b4cf[_0x455d('0x37')]!=='VIRTUAL'){var _0x5c03f8={};_0x5c03f8[_0x15b4cf[_0x455d('0x33')]]={'$like':'%'+_0x3b32e7[_0x455d('0x3c')]['filter']+'%'};return _0x5c03f8;}})});}_0x553770=_[_0x455d('0x45')]({},_0x553770,_0x3b32e7[_0x455d('0x46')]);var _0x27f81d={'where':_0x553770['where']};return db[_0x455d('0x35')][_0x455d('0x2b')](_0x27f81d)['then'](function(_0x20c07d){_0x20193f[_0x455d('0x2b')]=_0x20c07d;if(_0x3b32e7[_0x455d('0x3c')][_0x455d('0x47')]){_0x553770[_0x455d('0x48')]=[{'all':!![]}];}return db[_0x455d('0x35')]['findAll'](_0x553770);})[_0x455d('0x1d')](function(_0x3320c0){_0x20193f[_0x455d('0x49')]=_0x3320c0;return _0x20193f;})[_0x455d('0x1d')](respondWithFilteredResult(_0x1a685e,_0x553770))[_0x455d('0x4a')](handleError(_0x1a685e,null));};exports['show']=function(_0x40ddf1,_0x247989){var _0x27085a={'raw':![],'where':{'id':_0x40ddf1[_0x455d('0x4b')]['id']}},_0x28cf4a={};_0x28cf4a['model']=_[_0x455d('0x3b')](db[_0x455d('0x35')][_0x455d('0x36')]);_0x28cf4a[_0x455d('0x3c')]=_[_0x455d('0x3b')](_0x40ddf1[_0x455d('0x3c')]);_0x28cf4a['filters']=_[_0x455d('0x3e')](_0x28cf4a[_0x455d('0x39')],_0x28cf4a['query']);_0x27085a[_0x455d('0x3d')]=_[_0x455d('0x3e')](_0x28cf4a[_0x455d('0x39')],qs[_0x455d('0x3f')](_0x40ddf1[_0x455d('0x3c')]['fields']));_0x27085a[_0x455d('0x3d')]=_0x27085a[_0x455d('0x3d')]['length']?_0x27085a[_0x455d('0x3d')]:_0x28cf4a[_0x455d('0x39')];if(_0x40ddf1[_0x455d('0x3c')][_0x455d('0x47')]){_0x27085a[_0x455d('0x48')]=[{'all':!![]}];}_0x27085a=_[_0x455d('0x45')]({},_0x27085a,_0x40ddf1[_0x455d('0x46')]);return db[_0x455d('0x35')][_0x455d('0x4c')](_0x27085a)['then'](handleEntityNotFound(_0x247989,null))['then'](respondWithResult(_0x247989,null))['catch'](handleError(_0x247989,null));};exports['create']=function(_0xb98afb,_0x3882ef){return db[_0x455d('0x35')][_0x455d('0x4d')](_0xb98afb[_0x455d('0x4e')],{})[_0x455d('0x1d')](respondWithResult(_0x3882ef,0xc9))['catch'](handleError(_0x3882ef,null));};exports[_0x455d('0x31')]=function(_0x546006,_0x15a948){if(_0x546006['body']['id']){delete _0x546006['body']['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x546006[_0x455d('0x4b')]['id']}})[_0x455d('0x1d')](handleEntityNotFound(_0x15a948,null))[_0x455d('0x1d')](saveUpdates(_0x546006[_0x455d('0x4e')],null))[_0x455d('0x1d')](respondWithResult(_0x15a948,null))[_0x455d('0x4a')](handleError(_0x15a948,null));};exports['destroy']=function(_0x553cd7,_0x2bfc4b){return db[_0x455d('0x35')][_0x455d('0x4c')]({'where':{'id':_0x553cd7[_0x455d('0x4b')]['id']}})[_0x455d('0x1d')](handleEntityNotFound(_0x2bfc4b,null))[_0x455d('0x1d')](removeEntity(_0x2bfc4b,null))[_0x455d('0x4a')](handleError(_0x2bfc4b,null));};exports[_0x455d('0x4f')]=function(_0x188aa4,_0x32f2c4,_0x2e99df){var _0x5e01e8={};var _0x589ee6={};var _0x352c9f;var _0x27eaa0;return db[_0x455d('0x35')][_0x455d('0x50')]({'where':{'id':_0x188aa4[_0x455d('0x4b')]['id']}})[_0x455d('0x1d')](handleEntityNotFound(_0x32f2c4,null))[_0x455d('0x1d')](function(_0x2a93f8){if(_0x2a93f8){_0x352c9f=_0x2a93f8;_0x589ee6[_0x455d('0x39')]=_[_0x455d('0x3b')](db[_0x455d('0x51')][_0x455d('0x36')]);_0x589ee6['query']=_[_0x455d('0x3b')](_0x188aa4[_0x455d('0x3c')]);_0x589ee6[_0x455d('0x44')]=_['intersection'](_0x589ee6[_0x455d('0x39')],_0x589ee6[_0x455d('0x3c')]);_0x5e01e8[_0x455d('0x3d')]=_['intersection'](_0x589ee6[_0x455d('0x39')],qs[_0x455d('0x3f')](_0x188aa4[_0x455d('0x3c')][_0x455d('0x3f')]));_0x5e01e8[_0x455d('0x3d')]=_0x5e01e8[_0x455d('0x3d')]['length']?_0x5e01e8[_0x455d('0x3d')]:_0x589ee6[_0x455d('0x39')];_0x5e01e8['order']=qs['sort'](_0x188aa4[_0x455d('0x3c')][_0x455d('0x42')]);_0x5e01e8['where']=qs[_0x455d('0x44')](_[_0x455d('0x52')](_0x188aa4['query'],_0x589ee6[_0x455d('0x44')]));if(_0x188aa4[_0x455d('0x3c')][_0x455d('0x53')]){_0x5e01e8[_0x455d('0x43')]=_['merge'](_0x5e01e8[_0x455d('0x43')],{'$or':_[_0x455d('0x3a')](_0x5e01e8[_0x455d('0x3d')],function(_0x479015){var _0x302cbe={};_0x302cbe[_0x479015]={'$like':'%'+_0x188aa4['query'][_0x455d('0x53')]+'%'};return _0x302cbe;})});}_0x5e01e8=_[_0x455d('0x45')]({},_0x5e01e8,_0x188aa4[_0x455d('0x46')]);return _0x352c9f['getFields'](_0x5e01e8);}})['then'](function(_0x23f27e){if(_0x23f27e){_0x27eaa0=_0x23f27e[_0x455d('0x40')];if(!_0x188aa4[_0x455d('0x3c')]['hasOwnProperty'](_0x455d('0x54'))){_0x5e01e8[_0x455d('0x41')]=qs[_0x455d('0x41')](_0x188aa4[_0x455d('0x3c')]['limit']);_0x5e01e8[_0x455d('0x2c')]=qs[_0x455d('0x2c')](_0x188aa4['query'][_0x455d('0x2c')]);}return _0x352c9f[_0x455d('0x4f')](_0x5e01e8);}})[_0x455d('0x1d')](function(_0x34321a){if(_0x34321a){return _0x34321a?{'count':_0x27eaa0,'rows':_0x34321a}:null;}})[_0x455d('0x1d')](respondWithResult(_0x32f2c4,null))[_0x455d('0x4a')](handleError(_0x32f2c4,null));};exports[_0x455d('0x55')]=function(_0x3f1665,_0x1abec8,_0x24c6b2){var _0x40f730={};var _0x4ec77b={};var _0x3d60e2;var _0x5b6cbd;return db['SalesforceConfiguration'][_0x455d('0x50')]({'where':{'id':_0x3f1665[_0x455d('0x4b')]['id']}})[_0x455d('0x1d')](handleEntityNotFound(_0x1abec8,null))[_0x455d('0x1d')](function(_0x26b7c4){if(_0x26b7c4){_0x3d60e2=_0x26b7c4;_0x4ec77b['model']=_[_0x455d('0x3b')](db[_0x455d('0x51')][_0x455d('0x36')]);_0x4ec77b[_0x455d('0x3c')]=_[_0x455d('0x3b')](_0x3f1665[_0x455d('0x3c')]);_0x4ec77b[_0x455d('0x44')]=_[_0x455d('0x3e')](_0x4ec77b['model'],_0x4ec77b[_0x455d('0x3c')]);_0x40f730[_0x455d('0x3d')]=_['intersection'](_0x4ec77b[_0x455d('0x39')],qs[_0x455d('0x3f')](_0x3f1665['query'][_0x455d('0x3f')]));_0x40f730[_0x455d('0x3d')]=_0x40f730['attributes'][_0x455d('0x40')]?_0x40f730[_0x455d('0x3d')]:_0x4ec77b[_0x455d('0x39')];_0x40f730[_0x455d('0x56')]=qs['sort'](_0x3f1665['query'][_0x455d('0x42')]);_0x40f730[_0x455d('0x43')]=qs['filters'](_[_0x455d('0x52')](_0x3f1665[_0x455d('0x3c')],_0x4ec77b[_0x455d('0x44')]));if(_0x3f1665['query']['filter']){_0x40f730[_0x455d('0x43')]=_[_0x455d('0x45')](_0x40f730[_0x455d('0x43')],{'$or':_[_0x455d('0x3a')](_0x40f730[_0x455d('0x3d')],function(_0x34a22e){var _0x48277e={};_0x48277e[_0x34a22e]={'$like':'%'+_0x3f1665[_0x455d('0x3c')][_0x455d('0x53')]+'%'};return _0x48277e;})});}_0x40f730=_[_0x455d('0x45')]({},_0x40f730,_0x3f1665[_0x455d('0x46')]);return _0x3d60e2['getSubjects'](_0x40f730);}})[_0x455d('0x1d')](function(_0x41446c){if(_0x41446c){_0x5b6cbd=_0x41446c[_0x455d('0x40')];if(!_0x3f1665[_0x455d('0x3c')][_0x455d('0x57')]('nolimit')){_0x40f730['limit']=qs['limit'](_0x3f1665['query'][_0x455d('0x41')]);_0x40f730[_0x455d('0x2c')]=qs[_0x455d('0x2c')](_0x3f1665[_0x455d('0x3c')][_0x455d('0x2c')]);}return _0x3d60e2[_0x455d('0x55')](_0x40f730);}})[_0x455d('0x1d')](function(_0x20d936){if(_0x20d936){return _0x20d936?{'count':_0x5b6cbd,'rows':_0x20d936}:null;}})['then'](respondWithResult(_0x1abec8,null))[_0x455d('0x4a')](handleError(_0x1abec8,null));};exports[_0x455d('0x58')]=function(_0x2f70ef,_0x317315,_0xd0f5d8){var _0x2fb29f={};var _0x52657c={};var _0x3979b0;var _0x3532d8;return db[_0x455d('0x35')][_0x455d('0x50')]({'where':{'id':_0x2f70ef[_0x455d('0x4b')]['id']}})[_0x455d('0x1d')](handleEntityNotFound(_0x317315,null))[_0x455d('0x1d')](function(_0x57e55c){if(_0x57e55c){_0x3979b0=_0x57e55c;_0x52657c[_0x455d('0x39')]=_['keys'](db[_0x455d('0x51')][_0x455d('0x36')]);_0x52657c[_0x455d('0x3c')]=_[_0x455d('0x3b')](_0x2f70ef[_0x455d('0x3c')]);_0x52657c['filters']=_[_0x455d('0x3e')](_0x52657c[_0x455d('0x39')],_0x52657c[_0x455d('0x3c')]);_0x2fb29f[_0x455d('0x3d')]=_['intersection'](_0x52657c[_0x455d('0x39')],qs[_0x455d('0x3f')](_0x2f70ef['query'][_0x455d('0x3f')]));_0x2fb29f['attributes']=_0x2fb29f[_0x455d('0x3d')][_0x455d('0x40')]?_0x2fb29f[_0x455d('0x3d')]:_0x52657c['model'];_0x2fb29f[_0x455d('0x56')]=qs[_0x455d('0x42')](_0x2f70ef['query'][_0x455d('0x42')]);_0x2fb29f[_0x455d('0x43')]=qs[_0x455d('0x44')](_[_0x455d('0x52')](_0x2f70ef['query'],_0x52657c[_0x455d('0x44')]));if(_0x2f70ef[_0x455d('0x3c')]['filter']){_0x2fb29f[_0x455d('0x43')]=_['merge'](_0x2fb29f[_0x455d('0x43')],{'$or':_[_0x455d('0x3a')](_0x2fb29f[_0x455d('0x3d')],function(_0x34ee0d){var _0x528c10={};_0x528c10[_0x34ee0d]={'$like':'%'+_0x2f70ef[_0x455d('0x3c')][_0x455d('0x53')]+'%'};return _0x528c10;})});}_0x2fb29f=_[_0x455d('0x45')]({},_0x2fb29f,_0x2f70ef[_0x455d('0x46')]);return _0x3979b0[_0x455d('0x58')](_0x2fb29f);}})['then'](function(_0x2c9033){if(_0x2c9033){_0x3532d8=_0x2c9033[_0x455d('0x40')];if(!_0x2f70ef[_0x455d('0x3c')][_0x455d('0x57')]('nolimit')){_0x2fb29f[_0x455d('0x41')]=qs[_0x455d('0x41')](_0x2f70ef['query'][_0x455d('0x41')]);_0x2fb29f[_0x455d('0x2c')]=qs[_0x455d('0x2c')](_0x2f70ef[_0x455d('0x3c')][_0x455d('0x2c')]);}return _0x3979b0[_0x455d('0x58')](_0x2fb29f);}})['then'](function(_0x425022){if(_0x425022){return _0x425022?{'count':_0x3532d8,'rows':_0x425022}:null;}})[_0x455d('0x1d')](respondWithResult(_0x317315,null))[_0x455d('0x4a')](handleError(_0x317315,null));}; \ No newline at end of file +var _0x7166=['keys','query','filters','intersection','attributes','model','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','SalesforceConfiguration','includeAll','include','findAll','rows','show','params','create','body','find','findOne','SalesforceField','getFields','hasOwnProperty','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../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','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0x7166,0x141));var _0x6716=function(_0x3cf5a3,_0x5a4492){_0x3cf5a3=_0x3cf5a3-0x0;var _0x39ba2d=_0x7166[_0x3cf5a3];return _0x39ba2d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6716('0x0'));var rimraf=require(_0x6716('0x1'));var zipdir=require(_0x6716('0x2'));var jsonpatch=require(_0x6716('0x3'));var rp=require('request-promise');var moment=require(_0x6716('0x4'));var BPromise=require(_0x6716('0x5'));var Mustache=require(_0x6716('0x6'));var util=require(_0x6716('0x7'));var path=require(_0x6716('0x8'));var sox=require(_0x6716('0x9'));var csv=require(_0x6716('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6716('0xb'));var squel=require(_0x6716('0xc'));var crypto=require('crypto');var jsforce=require(_0x6716('0xd'));var deskjs=require(_0x6716('0xe'));var toCsv=require(_0x6716('0xa'));var querystring=require('querystring');var Papa=require(_0x6716('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6716('0x10'));var as=require(_0x6716('0x11'));var hardwareService=require(_0x6716('0x12'));var logger=require(_0x6716('0x13'))(_0x6716('0x14'));var utils=require(_0x6716('0x15'));var config=require('../../config/environment');var db=require(_0x6716('0x16'))['db'];var jayson=require(_0x6716('0x17'));var client=jayson['client'][_0x6716('0x18')]({'port':0x232a});function checkPasswordPattern(_0xabc9eb,_0x366c80,_0x24b591){if(_0x24b591){var _0x5093f7=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5093f7[_0x6716('0x19')](_0x366c80)){return _0xabc9eb;}else{throw new db['Sequelize'][(_0x6716('0x1a'))](_0x6716('0x1b'));}}else{return _0xabc9eb;}}function respondWithRpcPromise(_0x2b7c05,_0x4297b8,_0x2c31c2,_0x30fc7b){return new BPromise(function(_0x3b4c19,_0xed1901){var _0x2cc702=_0x30fc7b||client;return _0x2cc702[_0x6716('0x1c')](_0x2b7c05,_0x2c31c2)[_0x6716('0x1d')](function(_0x4f4f3d){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x4297b8,_0x6716('0x1e'));logger[_0x6716('0x1f')](_0x6716('0x20'),_0x4297b8,_0x6716('0x1e'),JSON[_0x6716('0x21')](_0x4f4f3d));if(_0x4f4f3d[_0x6716('0x22')]){if(_0x4f4f3d[_0x6716('0x22')][_0x6716('0x23')]===0x1f4){logger[_0x6716('0x22')](_0x6716('0x24'),_0x4297b8,_0x4f4f3d[_0x6716('0x22')][_0x6716('0x25')]);return _0xed1901(_0x4f4f3d['error'][_0x6716('0x25')]);}logger[_0x6716('0x22')](_0x6716('0x24'),_0x4297b8,_0x4f4f3d['error']['message']);return _0x3b4c19(_0x4f4f3d[_0x6716('0x22')][_0x6716('0x25')]);}else{logger[_0x6716('0x26')](_0x6716('0x24'),_0x4297b8,'request\x20sent');_0x3b4c19(_0x4f4f3d[_0x6716('0x27')][_0x6716('0x25')]);}})[_0x6716('0x28')](function(_0x395eb2){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4297b8,_0x395eb2);_0xed1901(_0x395eb2);});});}function respondWithStatusCode(_0x392123,_0x1c574a){_0x1c574a=_0x1c574a||0xcc;return function(_0x3ac138){if(_0x3ac138){return _0x392123[_0x6716('0x29')](_0x1c574a);}return _0x392123[_0x6716('0x2a')](_0x1c574a)[_0x6716('0x2b')]();};}function respondWithResult(_0x1e346f,_0x2c8de4){_0x2c8de4=_0x2c8de4||0xc8;return function(_0x3aea71){if(_0x3aea71){return _0x1e346f[_0x6716('0x2a')](_0x2c8de4)['json'](_0x3aea71);}};}function respondWithFilteredResult(_0x363275,_0x25d370){return function(_0x1c6cfd){if(_0x1c6cfd){var _0x226cce=_0x1c6cfd[_0x6716('0x2c')],_0x324349=_0x25d370[_0x6716('0x2d')],_0x334901=_0x25d370[_0x6716('0x2d')]+_0x25d370[_0x6716('0x2e')],_0x952386;if(_0x334901>=_0x226cce){_0x334901=_0x226cce;_0x952386=0xc8;}else{_0x952386=0xce;}_0x363275[_0x6716('0x2a')](_0x952386);return _0x363275['set'](_0x6716('0x2f'),_0x324349+'-'+_0x334901+'/'+_0x226cce)[_0x6716('0x30')](_0x1c6cfd);}return null;};}function patchUpdates(_0x593939){return function(_0x4fb5fe){try{jsonpatch[_0x6716('0x31')](_0x4fb5fe,_0x593939,!![]);}catch(_0x27355a){return BPromise[_0x6716('0x32')](_0x27355a);}return _0x4fb5fe[_0x6716('0x33')]();};}function saveUpdates(_0x402eb4,_0x37bfd5){return function(_0x3e96fd){if(_0x3e96fd){return _0x3e96fd[_0x6716('0x34')](_0x402eb4)[_0x6716('0x1d')](function(_0x9dce3d){return _0x9dce3d;});}return null;};}function removeEntity(_0xc7e676,_0x431d06){return function(_0x2983db){if(_0x2983db){return _0x2983db[_0x6716('0x35')]()[_0x6716('0x1d')](function(){_0xc7e676[_0x6716('0x2a')](0xcc)[_0x6716('0x2b')]();});}};}function handleEntityNotFound(_0x43da9e,_0x263d95){return function(_0x51ffdd){if(!_0x51ffdd){_0x43da9e[_0x6716('0x29')](0x194);}return _0x51ffdd;};}function handleError(_0x729b09,_0x2422d6){_0x2422d6=_0x2422d6||0x1f4;return function(_0x4f28ed){logger[_0x6716('0x22')](_0x4f28ed[_0x6716('0x36')]);if(_0x4f28ed['name']){delete _0x4f28ed[_0x6716('0x37')];}_0x729b09[_0x6716('0x2a')](_0x2422d6)[_0x6716('0x38')](_0x4f28ed);};}exports[_0x6716('0x39')]=function(_0x15ed4a,_0xc15aa4){var _0x358770={},_0x4a74e1={},_0x39738c={'count':0x0,'rows':[]};var _0x1d0ba9=_[_0x6716('0x3a')](db['SalesforceConfiguration'][_0x6716('0x3b')],function(_0xa1994a){return{'name':_0xa1994a[_0x6716('0x3c')],'type':_0xa1994a[_0x6716('0x3d')][_0x6716('0x3e')]};});_0x4a74e1['model']=_[_0x6716('0x3a')](_0x1d0ba9,_0x6716('0x37'));_0x4a74e1['query']=_[_0x6716('0x3f')](_0x15ed4a[_0x6716('0x40')]);_0x4a74e1[_0x6716('0x41')]=_[_0x6716('0x42')](_0x4a74e1['model'],_0x4a74e1['query']);_0x358770[_0x6716('0x43')]=_['intersection'](_0x4a74e1[_0x6716('0x44')],qs[_0x6716('0x45')](_0x15ed4a[_0x6716('0x40')][_0x6716('0x45')]));_0x358770['attributes']=_0x358770[_0x6716('0x43')][_0x6716('0x46')]?_0x358770['attributes']:_0x4a74e1[_0x6716('0x44')];if(!_0x15ed4a[_0x6716('0x40')]['hasOwnProperty']('nolimit')){_0x358770['limit']=qs[_0x6716('0x2e')](_0x15ed4a[_0x6716('0x40')]['limit']);_0x358770[_0x6716('0x2d')]=qs['offset'](_0x15ed4a[_0x6716('0x40')][_0x6716('0x2d')]);}_0x358770[_0x6716('0x47')]=qs[_0x6716('0x48')](_0x15ed4a['query']['sort']);_0x358770[_0x6716('0x49')]=qs[_0x6716('0x41')](_[_0x6716('0x4a')](_0x15ed4a[_0x6716('0x40')],_0x4a74e1[_0x6716('0x41')]));if(_0x15ed4a['query']['filter']){_0x358770[_0x6716('0x49')]=_[_0x6716('0x4b')](_0x358770[_0x6716('0x49')],{'$or':_[_0x6716('0x3a')](_0x1d0ba9,function(_0x182478){if(_0x182478['type']!==_0x6716('0x4c')){var _0x46c4ca={};_0x46c4ca[_0x182478[_0x6716('0x37')]]={'$like':'%'+_0x15ed4a['query'][_0x6716('0x4d')]+'%'};return _0x46c4ca;}})});}_0x358770=_['merge']({},_0x358770,_0x15ed4a[_0x6716('0x4e')]);var _0x58bea3={'where':_0x358770[_0x6716('0x49')]};return db[_0x6716('0x4f')][_0x6716('0x2c')](_0x58bea3)['then'](function(_0x50542e){_0x39738c[_0x6716('0x2c')]=_0x50542e;if(_0x15ed4a[_0x6716('0x40')][_0x6716('0x50')]){_0x358770[_0x6716('0x51')]=[{'all':!![]}];}return db[_0x6716('0x4f')][_0x6716('0x52')](_0x358770);})['then'](function(_0x3b4b42){_0x39738c[_0x6716('0x53')]=_0x3b4b42;return _0x39738c;})[_0x6716('0x1d')](respondWithFilteredResult(_0xc15aa4,_0x358770))[_0x6716('0x28')](handleError(_0xc15aa4,null));};exports[_0x6716('0x54')]=function(_0xab2617,_0x5c5f7d){var _0xb501d2={'raw':![],'where':{'id':_0xab2617[_0x6716('0x55')]['id']}},_0x14e642={};_0x14e642[_0x6716('0x44')]=_[_0x6716('0x3f')](db['SalesforceConfiguration'][_0x6716('0x3b')]);_0x14e642[_0x6716('0x40')]=_[_0x6716('0x3f')](_0xab2617[_0x6716('0x40')]);_0x14e642[_0x6716('0x41')]=_[_0x6716('0x42')](_0x14e642[_0x6716('0x44')],_0x14e642[_0x6716('0x40')]);_0xb501d2[_0x6716('0x43')]=_['intersection'](_0x14e642['model'],qs['fields'](_0xab2617[_0x6716('0x40')][_0x6716('0x45')]));_0xb501d2[_0x6716('0x43')]=_0xb501d2[_0x6716('0x43')][_0x6716('0x46')]?_0xb501d2[_0x6716('0x43')]:_0x14e642['model'];if(_0xab2617['query'][_0x6716('0x50')]){_0xb501d2['include']=[{'all':!![]}];}_0xb501d2=_[_0x6716('0x4b')]({},_0xb501d2,_0xab2617['options']);return db[_0x6716('0x4f')]['find'](_0xb501d2)[_0x6716('0x1d')](handleEntityNotFound(_0x5c5f7d,null))[_0x6716('0x1d')](respondWithResult(_0x5c5f7d,null))[_0x6716('0x28')](handleError(_0x5c5f7d,null));};exports[_0x6716('0x56')]=function(_0x1ef02d,_0x305b6c){return db[_0x6716('0x4f')][_0x6716('0x56')](_0x1ef02d[_0x6716('0x57')],{})[_0x6716('0x1d')](respondWithResult(_0x305b6c,0xc9))[_0x6716('0x28')](handleError(_0x305b6c,null));};exports[_0x6716('0x34')]=function(_0xe6e97a,_0x136112){if(_0xe6e97a['body']['id']){delete _0xe6e97a[_0x6716('0x57')]['id'];}return db['SalesforceConfiguration'][_0x6716('0x58')]({'where':{'id':_0xe6e97a[_0x6716('0x55')]['id']}})['then'](handleEntityNotFound(_0x136112,null))['then'](saveUpdates(_0xe6e97a[_0x6716('0x57')],null))[_0x6716('0x1d')](respondWithResult(_0x136112,null))['catch'](handleError(_0x136112,null));};exports[_0x6716('0x35')]=function(_0x5b9e31,_0xf715a0){return db['SalesforceConfiguration'][_0x6716('0x58')]({'where':{'id':_0x5b9e31[_0x6716('0x55')]['id']}})[_0x6716('0x1d')](handleEntityNotFound(_0xf715a0,null))[_0x6716('0x1d')](removeEntity(_0xf715a0,null))[_0x6716('0x28')](handleError(_0xf715a0,null));};exports['getFields']=function(_0x3b524b,_0x2d6172,_0x56292d){var _0x40f014={};var _0x14bdc0={};var _0x23757c;var _0x394b5d;return db[_0x6716('0x4f')][_0x6716('0x59')]({'where':{'id':_0x3b524b['params']['id']}})['then'](handleEntityNotFound(_0x2d6172,null))['then'](function(_0x2bb21f){if(_0x2bb21f){_0x23757c=_0x2bb21f;_0x14bdc0[_0x6716('0x44')]=_[_0x6716('0x3f')](db[_0x6716('0x5a')][_0x6716('0x3b')]);_0x14bdc0[_0x6716('0x40')]=_['keys'](_0x3b524b['query']);_0x14bdc0[_0x6716('0x41')]=_[_0x6716('0x42')](_0x14bdc0['model'],_0x14bdc0[_0x6716('0x40')]);_0x40f014['attributes']=_[_0x6716('0x42')](_0x14bdc0[_0x6716('0x44')],qs[_0x6716('0x45')](_0x3b524b[_0x6716('0x40')][_0x6716('0x45')]));_0x40f014[_0x6716('0x43')]=_0x40f014['attributes'][_0x6716('0x46')]?_0x40f014[_0x6716('0x43')]:_0x14bdc0[_0x6716('0x44')];_0x40f014[_0x6716('0x47')]=qs[_0x6716('0x48')](_0x3b524b[_0x6716('0x40')][_0x6716('0x48')]);_0x40f014[_0x6716('0x49')]=qs[_0x6716('0x41')](_[_0x6716('0x4a')](_0x3b524b[_0x6716('0x40')],_0x14bdc0[_0x6716('0x41')]));if(_0x3b524b[_0x6716('0x40')][_0x6716('0x4d')]){_0x40f014[_0x6716('0x49')]=_['merge'](_0x40f014[_0x6716('0x49')],{'$or':_[_0x6716('0x3a')](_0x40f014[_0x6716('0x43')],function(_0x418639){var _0x256180={};_0x256180[_0x418639]={'$like':'%'+_0x3b524b[_0x6716('0x40')]['filter']+'%'};return _0x256180;})});}_0x40f014=_[_0x6716('0x4b')]({},_0x40f014,_0x3b524b[_0x6716('0x4e')]);return _0x23757c[_0x6716('0x5b')](_0x40f014);}})[_0x6716('0x1d')](function(_0x30abb4){if(_0x30abb4){_0x394b5d=_0x30abb4[_0x6716('0x46')];if(!_0x3b524b['query'][_0x6716('0x5c')]('nolimit')){_0x40f014['limit']=qs[_0x6716('0x2e')](_0x3b524b['query'][_0x6716('0x2e')]);_0x40f014[_0x6716('0x2d')]=qs[_0x6716('0x2d')](_0x3b524b[_0x6716('0x40')][_0x6716('0x2d')]);}return _0x23757c[_0x6716('0x5b')](_0x40f014);}})[_0x6716('0x1d')](function(_0x56de1a){if(_0x56de1a){return _0x56de1a?{'count':_0x394b5d,'rows':_0x56de1a}:null;}})[_0x6716('0x1d')](respondWithResult(_0x2d6172,null))[_0x6716('0x28')](handleError(_0x2d6172,null));};exports[_0x6716('0x5d')]=function(_0x57158e,_0x431886,_0x156834){var _0x476356={};var _0x5e8b85={};var _0x151c1d;var _0x1b8532;return db['SalesforceConfiguration'][_0x6716('0x59')]({'where':{'id':_0x57158e['params']['id']}})[_0x6716('0x1d')](handleEntityNotFound(_0x431886,null))[_0x6716('0x1d')](function(_0x57d9fd){if(_0x57d9fd){_0x151c1d=_0x57d9fd;_0x5e8b85['model']=_[_0x6716('0x3f')](db[_0x6716('0x5a')]['rawAttributes']);_0x5e8b85[_0x6716('0x40')]=_['keys'](_0x57158e[_0x6716('0x40')]);_0x5e8b85['filters']=_['intersection'](_0x5e8b85[_0x6716('0x44')],_0x5e8b85[_0x6716('0x40')]);_0x476356['attributes']=_['intersection'](_0x5e8b85[_0x6716('0x44')],qs[_0x6716('0x45')](_0x57158e[_0x6716('0x40')]['fields']));_0x476356[_0x6716('0x43')]=_0x476356['attributes'][_0x6716('0x46')]?_0x476356[_0x6716('0x43')]:_0x5e8b85[_0x6716('0x44')];_0x476356[_0x6716('0x47')]=qs['sort'](_0x57158e[_0x6716('0x40')][_0x6716('0x48')]);_0x476356[_0x6716('0x49')]=qs[_0x6716('0x41')](_[_0x6716('0x4a')](_0x57158e[_0x6716('0x40')],_0x5e8b85['filters']));if(_0x57158e[_0x6716('0x40')]['filter']){_0x476356[_0x6716('0x49')]=_[_0x6716('0x4b')](_0x476356['where'],{'$or':_[_0x6716('0x3a')](_0x476356[_0x6716('0x43')],function(_0x2cf543){var _0x4178fa={};_0x4178fa[_0x2cf543]={'$like':'%'+_0x57158e[_0x6716('0x40')][_0x6716('0x4d')]+'%'};return _0x4178fa;})});}_0x476356=_[_0x6716('0x4b')]({},_0x476356,_0x57158e[_0x6716('0x4e')]);return _0x151c1d['getSubjects'](_0x476356);}})[_0x6716('0x1d')](function(_0x477bf2){if(_0x477bf2){_0x1b8532=_0x477bf2[_0x6716('0x46')];if(!_0x57158e['query'][_0x6716('0x5c')](_0x6716('0x5e'))){_0x476356[_0x6716('0x2e')]=qs[_0x6716('0x2e')](_0x57158e[_0x6716('0x40')]['limit']);_0x476356[_0x6716('0x2d')]=qs[_0x6716('0x2d')](_0x57158e[_0x6716('0x40')][_0x6716('0x2d')]);}return _0x151c1d[_0x6716('0x5d')](_0x476356);}})[_0x6716('0x1d')](function(_0x28b1dc){if(_0x28b1dc){return _0x28b1dc?{'count':_0x1b8532,'rows':_0x28b1dc}:null;}})[_0x6716('0x1d')](respondWithResult(_0x431886,null))[_0x6716('0x28')](handleError(_0x431886,null));};exports[_0x6716('0x5f')]=function(_0x3d9176,_0x369c84,_0x49d5e0){var _0x3c812f={};var _0x5f41da={};var _0x590a78;var _0x292830;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x3d9176[_0x6716('0x55')]['id']}})[_0x6716('0x1d')](handleEntityNotFound(_0x369c84,null))['then'](function(_0x29e5f6){if(_0x29e5f6){_0x590a78=_0x29e5f6;_0x5f41da[_0x6716('0x44')]=_[_0x6716('0x3f')](db[_0x6716('0x5a')][_0x6716('0x3b')]);_0x5f41da[_0x6716('0x40')]=_[_0x6716('0x3f')](_0x3d9176[_0x6716('0x40')]);_0x5f41da[_0x6716('0x41')]=_[_0x6716('0x42')](_0x5f41da[_0x6716('0x44')],_0x5f41da[_0x6716('0x40')]);_0x3c812f[_0x6716('0x43')]=_[_0x6716('0x42')](_0x5f41da[_0x6716('0x44')],qs[_0x6716('0x45')](_0x3d9176[_0x6716('0x40')][_0x6716('0x45')]));_0x3c812f[_0x6716('0x43')]=_0x3c812f['attributes'][_0x6716('0x46')]?_0x3c812f[_0x6716('0x43')]:_0x5f41da[_0x6716('0x44')];_0x3c812f[_0x6716('0x47')]=qs[_0x6716('0x48')](_0x3d9176[_0x6716('0x40')][_0x6716('0x48')]);_0x3c812f[_0x6716('0x49')]=qs[_0x6716('0x41')](_[_0x6716('0x4a')](_0x3d9176[_0x6716('0x40')],_0x5f41da[_0x6716('0x41')]));if(_0x3d9176[_0x6716('0x40')][_0x6716('0x4d')]){_0x3c812f['where']=_[_0x6716('0x4b')](_0x3c812f[_0x6716('0x49')],{'$or':_[_0x6716('0x3a')](_0x3c812f[_0x6716('0x43')],function(_0x29b54e){var _0x57bd08={};_0x57bd08[_0x29b54e]={'$like':'%'+_0x3d9176[_0x6716('0x40')]['filter']+'%'};return _0x57bd08;})});}_0x3c812f=_[_0x6716('0x4b')]({},_0x3c812f,_0x3d9176['options']);return _0x590a78[_0x6716('0x5f')](_0x3c812f);}})[_0x6716('0x1d')](function(_0x1e958d){if(_0x1e958d){_0x292830=_0x1e958d['length'];if(!_0x3d9176[_0x6716('0x40')]['hasOwnProperty'](_0x6716('0x5e'))){_0x3c812f[_0x6716('0x2e')]=qs[_0x6716('0x2e')](_0x3d9176['query']['limit']);_0x3c812f[_0x6716('0x2d')]=qs[_0x6716('0x2d')](_0x3d9176['query'][_0x6716('0x2d')]);}return _0x590a78[_0x6716('0x5f')](_0x3c812f);}})[_0x6716('0x1d')](function(_0x411e55){if(_0x411e55){return _0x411e55?{'count':_0x292830,'rows':_0x411e55}:null;}})['then'](respondWithResult(_0x369c84,null))[_0x6716('0x28')](handleError(_0x369c84,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 59cab15..0f3cf9a 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 _0x61ad=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','int_salesforce_configurations'];(function(_0x176ea1,_0x3ae5af){var _0x17e9a5=function(_0x3ced4a){while(--_0x3ced4a){_0x176ea1['push'](_0x176ea1['shift']());}};_0x17e9a5(++_0x3ae5af);}(_0x61ad,0x134));var _0xd61a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x61ad[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd61a('0x0'));var util=require(_0xd61a('0x1'));var logger=require(_0xd61a('0x2'))(_0xd61a('0x3'));var moment=require(_0xd61a('0x4'));var BPromise=require(_0xd61a('0x5'));var rp=require(_0xd61a('0x6'));var fs=require('fs');var path=require(_0xd61a('0x7'));var rimraf=require(_0xd61a('0x8'));var config=require(_0xd61a('0x9'));var attributes=require(_0xd61a('0xa'));module[_0xd61a('0xb')]=function(_0x37ae5e,_0x3ab3e1){return _0x37ae5e[_0xd61a('0xc')]('SalesforceConfiguration',attributes,{'tableName':_0xd61a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc8b=['exports','define','SalesforceConfiguration','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x1fcbcd,_0x4a5cd4){var _0x516f9c=function(_0x213e3b){while(--_0x213e3b){_0x1fcbcd['push'](_0x1fcbcd['shift']());}};_0x516f9c(++_0x4a5cd4);}(_0xbc8b,0x10b));var _0xbbc8=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0xbc8b[_0x3f3f06];return _0x140feb;};'use strict';var _=require(_0xbbc8('0x0'));var util=require(_0xbbc8('0x1'));var logger=require('../../config/logger')(_0xbbc8('0x2'));var moment=require(_0xbbc8('0x3'));var BPromise=require(_0xbbc8('0x4'));var rp=require(_0xbbc8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbbc8('0x6'));var config=require(_0xbbc8('0x7'));var attributes=require(_0xbbc8('0x8'));module[_0xbbc8('0x9')]=function(_0x25ca87,_0x335eba){return _0x25ca87[_0xbbc8('0xa')](_0xbbc8('0xb'),attributes,{'tableName':'int_salesforce_configurations','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 2235290..87be077 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 _0x061f=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x7b3f4a,_0x5c6900){var _0x140a33=function(_0x2ea661){while(--_0x2ea661){_0x7b3f4a['push'](_0x7b3f4a['shift']());}};_0x140a33(++_0x5c6900);}(_0x061f,0xe9));var _0xf061=function(_0x11fb21,_0x5369cd){_0x11fb21=_0x11fb21-0x0;var _0x4d51d0=_0x061f[_0x11fb21];return _0x4d51d0;};'use strict';var _=require(_0xf061('0x0'));var util=require(_0xf061('0x1'));var moment=require(_0xf061('0x2'));var BPromise=require(_0xf061('0x3'));var rs=require(_0xf061('0x4'));var fs=require('fs');var Redis=require(_0xf061('0x5'));var db=require(_0xf061('0x6'))['db'];var utils=require(_0xf061('0x7'));var logger=require('../../config/logger')(_0xf061('0x8'));var config=require(_0xf061('0x9'));var jayson=require(_0xf061('0xa'));var client=jayson[_0xf061('0xb')][_0xf061('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c61f6,_0x813e4a,_0x5f3d2a){return new BPromise(function(_0x2f0415,_0x184949){return client[_0xf061('0xd')](_0x4c61f6,_0x5f3d2a)[_0xf061('0xe')](function(_0x1847bb){logger[_0xf061('0xf')](_0xf061('0x10'),_0x813e4a,_0xf061('0x11'));logger['debug'](_0xf061('0x12'),_0x813e4a,_0xf061('0x11'),JSON[_0xf061('0x13')](_0x1847bb));if(_0x1847bb[_0xf061('0x14')]){if(_0x1847bb[_0xf061('0x14')][_0xf061('0x15')]===0x1f4){logger[_0xf061('0x14')](_0xf061('0x10'),_0x813e4a,_0x1847bb[_0xf061('0x14')]['message']);return _0x184949(_0x1847bb['error'][_0xf061('0x16')]);}logger[_0xf061('0x14')](_0xf061('0x10'),_0x813e4a,_0x1847bb[_0xf061('0x14')]['message']);return _0x2f0415(_0x1847bb[_0xf061('0x14')][_0xf061('0x16')]);}else{logger[_0xf061('0xf')](_0xf061('0x10'),_0x813e4a,'request\x20sent');_0x2f0415(_0x1847bb[_0xf061('0x17')]['message']);}})['catch'](function(_0x618b57){logger[_0xf061('0x14')](_0xf061('0x10'),_0x813e4a,_0x618b57);_0x184949(_0x618b57);});});} \ No newline at end of file +var _0xcd1a=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0xcd1a,0x7d));var _0xacd1=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xcd1a[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0xacd1('0x0'));var moment=require(_0xacd1('0x1'));var BPromise=require(_0xacd1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacd1('0x3'));var db=require(_0xacd1('0x4'))['db'];var utils=require(_0xacd1('0x5'));var logger=require(_0xacd1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xacd1('0x7'));var client=jayson[_0xacd1('0x8')][_0xacd1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x87a7c0,_0x20e08a,_0x5d16be){return new BPromise(function(_0x53b62f,_0x2309e6){return client[_0xacd1('0xa')](_0x87a7c0,_0x5d16be)['then'](function(_0x4453bf){logger[_0xacd1('0xb')](_0xacd1('0xc'),_0x20e08a,_0xacd1('0xd'));logger[_0xacd1('0xe')](_0xacd1('0xf'),_0x20e08a,'request\x20sent',JSON['stringify'](_0x4453bf));if(_0x4453bf[_0xacd1('0x10')]){if(_0x4453bf[_0xacd1('0x10')][_0xacd1('0x11')]===0x1f4){logger[_0xacd1('0x10')](_0xacd1('0xc'),_0x20e08a,_0x4453bf[_0xacd1('0x10')][_0xacd1('0x12')]);return _0x2309e6(_0x4453bf['error'][_0xacd1('0x12')]);}logger[_0xacd1('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x20e08a,_0x4453bf[_0xacd1('0x10')]['message']);return _0x53b62f(_0x4453bf[_0xacd1('0x10')][_0xacd1('0x12')]);}else{logger[_0xacd1('0xb')](_0xacd1('0xc'),_0x20e08a,_0xacd1('0xd'));_0x53b62f(_0x4453bf['result'][_0xacd1('0x12')]);}})[_0xacd1('0x13')](function(_0x2c9b98){logger[_0xacd1('0x10')](_0xacd1('0xc'),_0x20e08a,_0x2c9b98);_0x2309e6(_0x2c9b98);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index cc9e83d..4e5a3b8 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 _0xc1c6=['show','post','put','/:id','update','delete','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x3af198,_0x53e7eb){var _0x47abff=function(_0x5d9d8b){while(--_0x5d9d8b){_0x3af198['push'](_0x3af198['shift']());}};_0x47abff(++_0x53e7eb);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4e18fb,_0x169975){_0x4e18fb=_0x4e18fb-0x0;var _0x37bfcf=_0xc1c6[_0x4e18fb];return _0x37bfcf;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var auth=require(_0x6c1c('0x4'));var interaction=require(_0x6c1c('0x5'));var config=require(_0x6c1c('0x6'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x6c1c('0x7')](),controller['index']);router[_0x6c1c('0x8')]('/:id',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0x9')]);router[_0x6c1c('0xa')]('/',auth[_0x6c1c('0x7')](),controller['create']);router[_0x6c1c('0xb')](_0x6c1c('0xc'),auth['isAuthenticated'](),controller[_0x6c1c('0xd')]);router[_0x6c1c('0xe')](_0x6c1c('0xc'),auth[_0x6c1c('0x7')](),controller['destroy']);module[_0x6c1c('0xf')]=router; \ No newline at end of file +var _0x6d38=['path','connect-timeout','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x3b07a5,_0x4ebe01){var _0x5d845a=function(_0x39e0ec){while(--_0x39e0ec){_0x3b07a5['push'](_0x3b07a5['shift']());}};_0x5d845a(++_0x4ebe01);}(_0x6d38,0x1ef));var _0x86d3=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x6d38[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x86d3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x86d3('0x4'));var controller=require(_0x86d3('0x5'));router[_0x86d3('0x6')]('/',auth['isAuthenticated'](),controller[_0x86d3('0x7')]);router[_0x86d3('0x6')](_0x86d3('0x8'),auth[_0x86d3('0x9')](),controller['show']);router['post']('/',auth[_0x86d3('0x9')](),controller[_0x86d3('0xa')]);router[_0x86d3('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xc')]);router[_0x86d3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 57bb85b..fdbcf81 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 _0x8b3b=['exports','ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x19be1a,_0x32b7ef){var _0x36feea=function(_0xbfc581){while(--_0xbfc581){_0x19be1a['push'](_0x19be1a['shift']());}};_0x36feea(++_0x32b7ef);}(_0x8b3b,0xf7));var _0xb8b3=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0x8b3b[_0x55677b];return _0x104b88;};'use strict';var Sequelize=require(_0xb8b3('0x0'));module[_0xb8b3('0x1')]={'type':{'type':Sequelize[_0xb8b3('0x2')](_0xb8b3('0x3'),_0xb8b3('0x4'),_0xb8b3('0x5'),_0xb8b3('0x6')),'defaultValue':_0xb8b3('0x3')},'content':{'type':Sequelize[_0xb8b3('0x7')]},'key':{'type':Sequelize[_0xb8b3('0x7')]},'keyType':{'type':Sequelize[_0xb8b3('0x2')](_0xb8b3('0x3'),_0xb8b3('0x4'),_0xb8b3('0x5'))},'keyContent':{'type':Sequelize[_0xb8b3('0x7')]},'idField':{'type':Sequelize[_0xb8b3('0x7')]},'variableName':{'type':Sequelize[_0xb8b3('0x7')]}}; \ No newline at end of file +var _0x77b4=['variable','customVariable','keyValue','STRING','sequelize','ENUM','string'];(function(_0x29c823,_0xc71af8){var _0x4870ff=function(_0x56e217){while(--_0x56e217){_0x29c823['push'](_0x29c823['shift']());}};_0x4870ff(++_0xc71af8);}(_0x77b4,0xf9));var _0x477b=function(_0x34158b,_0x6e54c0){_0x34158b=_0x34158b-0x0;var _0xf70991=_0x77b4[_0x34158b];return _0xf70991;};'use strict';var Sequelize=require(_0x477b('0x0'));module['exports']={'type':{'type':Sequelize[_0x477b('0x1')](_0x477b('0x2'),_0x477b('0x3'),_0x477b('0x4'),_0x477b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x477b('0x6')]},'key':{'type':Sequelize[_0x477b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x477b('0x2'),_0x477b('0x3'),_0x477b('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x477b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index e530a9e..1cdcb3f 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 _0x2ef3=['then','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','limit','set','apply','reject','save','update','destroy'];(function(_0x35ebae,_0x4f86c4){var _0x1924cf=function(_0x5788fe){while(--_0x5788fe){_0x35ebae['push'](_0x35ebae['shift']());}};_0x1924cf(++_0x4f86c4);}(_0x2ef3,0xba));var _0x32ef=function(_0x3b4680,_0x52a696){_0x3b4680=_0x3b4680-0x0;var _0x51f021=_0x2ef3[_0x3b4680];return _0x51f021;};'use strict';var pdf=require(_0x32ef('0x0'));var emlformat=require(_0x32ef('0x1'));var rimraf=require(_0x32ef('0x2'));var zipdir=require(_0x32ef('0x3'));var jsonpatch=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var moment=require('moment');var BPromise=require(_0x32ef('0x6'));var Mustache=require(_0x32ef('0x7'));var util=require('util');var path=require(_0x32ef('0x8'));var sox=require(_0x32ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0xf'));var querystring=require(_0x32ef('0x10'));var Papa=require(_0x32ef('0x11'));var Redis=require(_0x32ef('0x12'));var authService=require(_0x32ef('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x14'));var logger=require(_0x32ef('0x15'))(_0x32ef('0x16'));var utils=require(_0x32ef('0x17'));var config=require('../../config/environment');var db=require(_0x32ef('0x18'))['db'];function respondWithStatusCode(_0x5afcc2,_0x1a5106){_0x1a5106=_0x1a5106||0xcc;return function(_0x49d590){if(_0x49d590){return _0x5afcc2[_0x32ef('0x19')](_0x1a5106);}return _0x5afcc2[_0x32ef('0x1a')](_0x1a5106)['end']();};}function respondWithResult(_0x539d18,_0x19ce1){_0x19ce1=_0x19ce1||0xc8;return function(_0x4d8009){if(_0x4d8009){return _0x539d18[_0x32ef('0x1a')](_0x19ce1)[_0x32ef('0x1b')](_0x4d8009);}};}function respondWithFilteredResult(_0x93d492,_0x54c7f5){return function(_0x57aff1){if(_0x57aff1){var _0x55bf0b=_0x57aff1[_0x32ef('0x1c')],_0x531e30=_0x54c7f5['offset'],_0x13db1a=_0x54c7f5['offset']+_0x54c7f5[_0x32ef('0x1d')],_0x3950e6;if(_0x13db1a>=_0x55bf0b){_0x13db1a=_0x55bf0b;_0x3950e6=0xc8;}else{_0x3950e6=0xce;}_0x93d492[_0x32ef('0x1a')](_0x3950e6);return _0x93d492[_0x32ef('0x1e')]('Content-Range',_0x531e30+'-'+_0x13db1a+'/'+_0x55bf0b)[_0x32ef('0x1b')](_0x57aff1);}return null;};}function patchUpdates(_0x33e230){return function(_0x4f4c98){try{jsonpatch[_0x32ef('0x1f')](_0x4f4c98,_0x33e230,!![]);}catch(_0x314ef1){return BPromise[_0x32ef('0x20')](_0x314ef1);}return _0x4f4c98[_0x32ef('0x21')]();};}function saveUpdates(_0x445cda,_0x3aec05){return function(_0x4de441){if(_0x4de441){return _0x4de441[_0x32ef('0x22')](_0x445cda)['then'](function(_0x309866){return _0x309866;});}return null;};}function removeEntity(_0x3a20ca,_0x49f2d8){return function(_0x1af371){if(_0x1af371){return _0x1af371[_0x32ef('0x23')]()[_0x32ef('0x24')](function(){_0x3a20ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(!_0x225feb){_0x22f2d7['sendStatus'](0x194);}return _0x225feb;};}function handleError(_0x59585f,_0x19ea6){_0x19ea6=_0x19ea6||0x1f4;return function(_0x4d584b){logger['error'](_0x4d584b[_0x32ef('0x25')]);if(_0x4d584b[_0x32ef('0x26')]){delete _0x4d584b[_0x32ef('0x26')];}_0x59585f[_0x32ef('0x1a')](_0x19ea6)[_0x32ef('0x27')](_0x4d584b);};}exports[_0x32ef('0x28')]=function(_0x1874ea,_0x38aed5){var _0x338f19={},_0x2f52d7={},_0x1335e2={'count':0x0,'rows':[]};var _0xba4b3f=_['map'](db[_0x32ef('0x29')][_0x32ef('0x2a')],function(_0x5a04cd){return{'name':_0x5a04cd[_0x32ef('0x2b')],'type':_0x5a04cd[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x2f52d7[_0x32ef('0x2e')]=_['map'](_0xba4b3f,_0x32ef('0x26'));_0x2f52d7[_0x32ef('0x2f')]=_[_0x32ef('0x30')](_0x1874ea[_0x32ef('0x2f')]);_0x2f52d7[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2f52d7[_0x32ef('0x2e')],_0x2f52d7['query']);_0x338f19[_0x32ef('0x33')]=_['intersection'](_0x2f52d7[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x1874ea['query'][_0x32ef('0x34')]));_0x338f19[_0x32ef('0x33')]=_0x338f19[_0x32ef('0x33')][_0x32ef('0x35')]?_0x338f19[_0x32ef('0x33')]:_0x2f52d7['model'];if(!_0x1874ea['query'][_0x32ef('0x36')]('nolimit')){_0x338f19[_0x32ef('0x1d')]=qs[_0x32ef('0x1d')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x338f19[_0x32ef('0x37')]=qs[_0x32ef('0x37')](_0x1874ea['query']['offset']);}_0x338f19['order']=qs[_0x32ef('0x38')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x38')]);_0x338f19['where']=qs['filters'](_[_0x32ef('0x39')](_0x1874ea[_0x32ef('0x2f')],_0x2f52d7[_0x32ef('0x31')]));if(_0x1874ea['query']['filter']){_0x338f19[_0x32ef('0x3a')]=_[_0x32ef('0x3b')](_0x338f19[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x3c')](_0xba4b3f,function(_0x3a7c49){if(_0x3a7c49[_0x32ef('0x2c')]!==_0x32ef('0x3d')){var _0x21da90={};_0x21da90[_0x3a7c49[_0x32ef('0x26')]]={'$like':'%'+_0x1874ea['query'][_0x32ef('0x3e')]+'%'};return _0x21da90;}})});}_0x338f19=_[_0x32ef('0x3b')]({},_0x338f19,_0x1874ea[_0x32ef('0x3f')]);var _0x4b97dc={'where':_0x338f19[_0x32ef('0x3a')]};return db[_0x32ef('0x29')][_0x32ef('0x1c')](_0x4b97dc)[_0x32ef('0x24')](function(_0x1faf72){_0x1335e2[_0x32ef('0x1c')]=_0x1faf72;if(_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x40')]){_0x338f19[_0x32ef('0x41')]=[{'all':!![]}];}return db[_0x32ef('0x29')][_0x32ef('0x42')](_0x338f19);})[_0x32ef('0x24')](function(_0x48e071){_0x1335e2[_0x32ef('0x43')]=_0x48e071;return _0x1335e2;})[_0x32ef('0x24')](respondWithFilteredResult(_0x38aed5,_0x338f19))[_0x32ef('0x44')](handleError(_0x38aed5,null));};exports[_0x32ef('0x45')]=function(_0x2f92f5,_0x2ca66b){var _0x3c0e44={'raw':!![],'where':{'id':_0x2f92f5['params']['id']}},_0x596d5a={};_0x596d5a[_0x32ef('0x2e')]=_[_0x32ef('0x30')](db[_0x32ef('0x29')][_0x32ef('0x2a')]);_0x596d5a['query']=_[_0x32ef('0x30')](_0x2f92f5[_0x32ef('0x2f')]);_0x596d5a['filters']=_[_0x32ef('0x32')](_0x596d5a['model'],_0x596d5a[_0x32ef('0x2f')]);_0x3c0e44[_0x32ef('0x33')]=_[_0x32ef('0x32')](_0x596d5a[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x2f92f5[_0x32ef('0x2f')][_0x32ef('0x34')]));_0x3c0e44[_0x32ef('0x33')]=_0x3c0e44[_0x32ef('0x33')][_0x32ef('0x35')]?_0x3c0e44['attributes']:_0x596d5a[_0x32ef('0x2e')];if(_0x2f92f5['query'][_0x32ef('0x40')]){_0x3c0e44[_0x32ef('0x41')]=[{'all':!![]}];}_0x3c0e44=_[_0x32ef('0x3b')]({},_0x3c0e44,_0x2f92f5['options']);return db[_0x32ef('0x29')][_0x32ef('0x46')](_0x3c0e44)[_0x32ef('0x24')](handleEntityNotFound(_0x2ca66b,null))[_0x32ef('0x24')](respondWithResult(_0x2ca66b,null))[_0x32ef('0x44')](handleError(_0x2ca66b,null));};exports[_0x32ef('0x47')]=function(_0x12c9e6,_0x47dbe1){return db['SalesforceField'][_0x32ef('0x47')](_0x12c9e6[_0x32ef('0x48')],{})[_0x32ef('0x24')](respondWithResult(_0x47dbe1,0xc9))[_0x32ef('0x44')](handleError(_0x47dbe1,null));};exports[_0x32ef('0x22')]=function(_0xd67dc9,_0x44ad11){if(_0xd67dc9[_0x32ef('0x48')]['id']){delete _0xd67dc9[_0x32ef('0x48')]['id'];}return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0xd67dc9[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x44ad11,null))['then'](saveUpdates(_0xd67dc9[_0x32ef('0x48')],null))[_0x32ef('0x24')](respondWithResult(_0x44ad11,null))[_0x32ef('0x44')](handleError(_0x44ad11,null));};exports[_0x32ef('0x23')]=function(_0x1cc9f3,_0x4353f0){return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0x1cc9f3[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x4353f0,null))[_0x32ef('0x24')](removeEntity(_0x4353f0,null))[_0x32ef('0x44')](handleError(_0x4353f0,null));}; \ No newline at end of file +var _0x2ef3=['then','stack','name','send','index','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','sort','pick','where','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','limit','set','apply','reject','save','update','destroy'];(function(_0xa28b1a,_0x384f4b){var _0x4c9b78=function(_0x3cf640){while(--_0x3cf640){_0xa28b1a['push'](_0xa28b1a['shift']());}};_0x4c9b78(++_0x384f4b);}(_0x2ef3,0xba));var _0x32ef=function(_0x336533,_0x420ded){_0x336533=_0x336533-0x0;var _0x2f7356=_0x2ef3[_0x336533];return _0x2f7356;};'use strict';var pdf=require(_0x32ef('0x0'));var emlformat=require(_0x32ef('0x1'));var rimraf=require(_0x32ef('0x2'));var zipdir=require(_0x32ef('0x3'));var jsonpatch=require(_0x32ef('0x4'));var rp=require(_0x32ef('0x5'));var moment=require('moment');var BPromise=require(_0x32ef('0x6'));var Mustache=require(_0x32ef('0x7'));var util=require('util');var path=require(_0x32ef('0x8'));var sox=require(_0x32ef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0xf'));var querystring=require(_0x32ef('0x10'));var Papa=require(_0x32ef('0x11'));var Redis=require(_0x32ef('0x12'));var authService=require(_0x32ef('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x14'));var logger=require(_0x32ef('0x15'))(_0x32ef('0x16'));var utils=require(_0x32ef('0x17'));var config=require('../../config/environment');var db=require(_0x32ef('0x18'))['db'];function respondWithStatusCode(_0x5afcc2,_0x1a5106){_0x1a5106=_0x1a5106||0xcc;return function(_0x49d590){if(_0x49d590){return _0x5afcc2[_0x32ef('0x19')](_0x1a5106);}return _0x5afcc2[_0x32ef('0x1a')](_0x1a5106)['end']();};}function respondWithResult(_0x539d18,_0x19ce1){_0x19ce1=_0x19ce1||0xc8;return function(_0x4d8009){if(_0x4d8009){return _0x539d18[_0x32ef('0x1a')](_0x19ce1)[_0x32ef('0x1b')](_0x4d8009);}};}function respondWithFilteredResult(_0x93d492,_0x54c7f5){return function(_0x57aff1){if(_0x57aff1){var _0x55bf0b=_0x57aff1[_0x32ef('0x1c')],_0x531e30=_0x54c7f5['offset'],_0x13db1a=_0x54c7f5['offset']+_0x54c7f5[_0x32ef('0x1d')],_0x3950e6;if(_0x13db1a>=_0x55bf0b){_0x13db1a=_0x55bf0b;_0x3950e6=0xc8;}else{_0x3950e6=0xce;}_0x93d492[_0x32ef('0x1a')](_0x3950e6);return _0x93d492[_0x32ef('0x1e')]('Content-Range',_0x531e30+'-'+_0x13db1a+'/'+_0x55bf0b)[_0x32ef('0x1b')](_0x57aff1);}return null;};}function patchUpdates(_0x33e230){return function(_0x4f4c98){try{jsonpatch[_0x32ef('0x1f')](_0x4f4c98,_0x33e230,!![]);}catch(_0x314ef1){return BPromise[_0x32ef('0x20')](_0x314ef1);}return _0x4f4c98[_0x32ef('0x21')]();};}function saveUpdates(_0x445cda,_0x3aec05){return function(_0x4de441){if(_0x4de441){return _0x4de441[_0x32ef('0x22')](_0x445cda)['then'](function(_0x309866){return _0x309866;});}return null;};}function removeEntity(_0x3a20ca,_0x49f2d8){return function(_0x1af371){if(_0x1af371){return _0x1af371[_0x32ef('0x23')]()[_0x32ef('0x24')](function(){_0x3a20ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(!_0x225feb){_0x22f2d7['sendStatus'](0x194);}return _0x225feb;};}function handleError(_0x59585f,_0x19ea6){_0x19ea6=_0x19ea6||0x1f4;return function(_0x4d584b){logger['error'](_0x4d584b[_0x32ef('0x25')]);if(_0x4d584b[_0x32ef('0x26')]){delete _0x4d584b[_0x32ef('0x26')];}_0x59585f[_0x32ef('0x1a')](_0x19ea6)[_0x32ef('0x27')](_0x4d584b);};}exports[_0x32ef('0x28')]=function(_0x1874ea,_0x38aed5){var _0x338f19={},_0x2f52d7={},_0x1335e2={'count':0x0,'rows':[]};var _0xba4b3f=_['map'](db[_0x32ef('0x29')][_0x32ef('0x2a')],function(_0x5a04cd){return{'name':_0x5a04cd[_0x32ef('0x2b')],'type':_0x5a04cd[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x2f52d7[_0x32ef('0x2e')]=_['map'](_0xba4b3f,_0x32ef('0x26'));_0x2f52d7[_0x32ef('0x2f')]=_[_0x32ef('0x30')](_0x1874ea[_0x32ef('0x2f')]);_0x2f52d7[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2f52d7[_0x32ef('0x2e')],_0x2f52d7['query']);_0x338f19[_0x32ef('0x33')]=_['intersection'](_0x2f52d7[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x1874ea['query'][_0x32ef('0x34')]));_0x338f19[_0x32ef('0x33')]=_0x338f19[_0x32ef('0x33')][_0x32ef('0x35')]?_0x338f19[_0x32ef('0x33')]:_0x2f52d7['model'];if(!_0x1874ea['query'][_0x32ef('0x36')]('nolimit')){_0x338f19[_0x32ef('0x1d')]=qs[_0x32ef('0x1d')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x338f19[_0x32ef('0x37')]=qs[_0x32ef('0x37')](_0x1874ea['query']['offset']);}_0x338f19['order']=qs[_0x32ef('0x38')](_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x38')]);_0x338f19['where']=qs['filters'](_[_0x32ef('0x39')](_0x1874ea[_0x32ef('0x2f')],_0x2f52d7[_0x32ef('0x31')]));if(_0x1874ea['query']['filter']){_0x338f19[_0x32ef('0x3a')]=_[_0x32ef('0x3b')](_0x338f19[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x3c')](_0xba4b3f,function(_0x3a7c49){if(_0x3a7c49[_0x32ef('0x2c')]!==_0x32ef('0x3d')){var _0x21da90={};_0x21da90[_0x3a7c49[_0x32ef('0x26')]]={'$like':'%'+_0x1874ea['query'][_0x32ef('0x3e')]+'%'};return _0x21da90;}})});}_0x338f19=_[_0x32ef('0x3b')]({},_0x338f19,_0x1874ea[_0x32ef('0x3f')]);var _0x4b97dc={'where':_0x338f19[_0x32ef('0x3a')]};return db[_0x32ef('0x29')][_0x32ef('0x1c')](_0x4b97dc)[_0x32ef('0x24')](function(_0x1faf72){_0x1335e2[_0x32ef('0x1c')]=_0x1faf72;if(_0x1874ea[_0x32ef('0x2f')][_0x32ef('0x40')]){_0x338f19[_0x32ef('0x41')]=[{'all':!![]}];}return db[_0x32ef('0x29')][_0x32ef('0x42')](_0x338f19);})[_0x32ef('0x24')](function(_0x48e071){_0x1335e2[_0x32ef('0x43')]=_0x48e071;return _0x1335e2;})[_0x32ef('0x24')](respondWithFilteredResult(_0x38aed5,_0x338f19))[_0x32ef('0x44')](handleError(_0x38aed5,null));};exports[_0x32ef('0x45')]=function(_0x2f92f5,_0x2ca66b){var _0x3c0e44={'raw':!![],'where':{'id':_0x2f92f5['params']['id']}},_0x596d5a={};_0x596d5a[_0x32ef('0x2e')]=_[_0x32ef('0x30')](db[_0x32ef('0x29')][_0x32ef('0x2a')]);_0x596d5a['query']=_[_0x32ef('0x30')](_0x2f92f5[_0x32ef('0x2f')]);_0x596d5a['filters']=_[_0x32ef('0x32')](_0x596d5a['model'],_0x596d5a[_0x32ef('0x2f')]);_0x3c0e44[_0x32ef('0x33')]=_[_0x32ef('0x32')](_0x596d5a[_0x32ef('0x2e')],qs[_0x32ef('0x34')](_0x2f92f5[_0x32ef('0x2f')][_0x32ef('0x34')]));_0x3c0e44[_0x32ef('0x33')]=_0x3c0e44[_0x32ef('0x33')][_0x32ef('0x35')]?_0x3c0e44['attributes']:_0x596d5a[_0x32ef('0x2e')];if(_0x2f92f5['query'][_0x32ef('0x40')]){_0x3c0e44[_0x32ef('0x41')]=[{'all':!![]}];}_0x3c0e44=_[_0x32ef('0x3b')]({},_0x3c0e44,_0x2f92f5['options']);return db[_0x32ef('0x29')][_0x32ef('0x46')](_0x3c0e44)[_0x32ef('0x24')](handleEntityNotFound(_0x2ca66b,null))[_0x32ef('0x24')](respondWithResult(_0x2ca66b,null))[_0x32ef('0x44')](handleError(_0x2ca66b,null));};exports[_0x32ef('0x47')]=function(_0x12c9e6,_0x47dbe1){return db['SalesforceField'][_0x32ef('0x47')](_0x12c9e6[_0x32ef('0x48')],{})[_0x32ef('0x24')](respondWithResult(_0x47dbe1,0xc9))[_0x32ef('0x44')](handleError(_0x47dbe1,null));};exports[_0x32ef('0x22')]=function(_0xd67dc9,_0x44ad11){if(_0xd67dc9[_0x32ef('0x48')]['id']){delete _0xd67dc9[_0x32ef('0x48')]['id'];}return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0xd67dc9[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x44ad11,null))['then'](saveUpdates(_0xd67dc9[_0x32ef('0x48')],null))[_0x32ef('0x24')](respondWithResult(_0x44ad11,null))[_0x32ef('0x44')](handleError(_0x44ad11,null));};exports[_0x32ef('0x23')]=function(_0x1cc9f3,_0x4353f0){return db[_0x32ef('0x29')][_0x32ef('0x46')]({'where':{'id':_0x1cc9f3[_0x32ef('0x49')]['id']}})[_0x32ef('0x24')](handleEntityNotFound(_0x4353f0,null))[_0x32ef('0x24')](removeEntity(_0x4353f0,null))[_0x32ef('0x44')](handleError(_0x4353f0,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index b8ba4a6..e14e9b1 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 _0x493d=['path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','util','api','moment','bluebird','request-promise'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x493d,0xcd));var _0xd493=function(_0xddb860,_0x344918){_0xddb860=_0xddb860-0x0;var _0x255df9=_0x493d[_0xddb860];return _0x255df9;};'use strict';var _=require('lodash');var util=require(_0xd493('0x0'));var logger=require('../../config/logger')(_0xd493('0x1'));var moment=require(_0xd493('0x2'));var BPromise=require(_0xd493('0x3'));var rp=require(_0xd493('0x4'));var fs=require('fs');var path=require(_0xd493('0x5'));var rimraf=require(_0xd493('0x6'));var config=require(_0xd493('0x7'));var attributes=require(_0xd493('0x8'));module[_0xd493('0x9')]=function(_0x531e22,_0x2ed96a){return _0x531e22[_0xd493('0xa')](_0xd493('0xb'),attributes,{'tableName':_0xd493('0xc'),'paranoid':![],'indexes':[{'name':_0xd493('0xd'),'fields':['idField',_0xd493('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x14d8=['../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x2fc2ca,_0x5a2b12){var _0x39b5ea=function(_0x40b734){while(--_0x40b734){_0x2fc2ca['push'](_0x2fc2ca['shift']());}};_0x39b5ea(++_0x5a2b12);}(_0x14d8,0x19d));var _0x814d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x14d8[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x814d('0x0'));var util=require(_0x814d('0x1'));var logger=require('../../config/logger')(_0x814d('0x2'));var moment=require('moment');var BPromise=require(_0x814d('0x3'));var rp=require(_0x814d('0x4'));var fs=require('fs');var path=require(_0x814d('0x5'));var rimraf=require(_0x814d('0x6'));var config=require(_0x814d('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x814d('0x8')]=function(_0x2e1be8,_0x1268c9){return _0x2e1be8[_0x814d('0x9')](_0x814d('0xa'),attributes,{'tableName':_0x814d('0xb'),'paranoid':![],'indexes':[{'name':_0x814d('0xc'),'fields':[_0x814d('0xd'),_0x814d('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 f7cc48c..5a6a4fa 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 _0x0bb5=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x286e77,_0x34cdb2){var _0x5ac349=function(_0xb439bb){while(--_0xb439bb){_0x286e77['push'](_0x286e77['shift']());}};_0x5ac349(++_0x34cdb2);}(_0x0bb5,0x148));var _0x50bb=function(_0x5a6519,_0x3ee377){_0x5a6519=_0x5a6519-0x0;var _0x1f31c1=_0x0bb5[_0x5a6519];return _0x1f31c1;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50bb('0x2'));var fs=require('fs');var Redis=require(_0x50bb('0x3'));var db=require(_0x50bb('0x4'))['db'];var utils=require(_0x50bb('0x5'));var logger=require(_0x50bb('0x6'))(_0x50bb('0x7'));var config=require(_0x50bb('0x8'));var jayson=require(_0x50bb('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xfd7aeb,_0x35de5d,_0x2e5463){return new BPromise(function(_0x33ff54,_0x4f9172){return client['request'](_0xfd7aeb,_0x2e5463)[_0x50bb('0xa')](function(_0x1c2174){logger[_0x50bb('0xb')](_0x50bb('0xc'),_0x35de5d,'request\x20sent');logger[_0x50bb('0xd')](_0x50bb('0xe'),_0x35de5d,_0x50bb('0xf'),JSON[_0x50bb('0x10')](_0x1c2174));if(_0x1c2174[_0x50bb('0x11')]){if(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x12')]===0x1f4){logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174['error'][_0x50bb('0x13')]);return _0x4f9172(_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);}logger['error'](_0x50bb('0xc'),_0x35de5d,_0x1c2174[_0x50bb('0x11')][_0x50bb('0x13')]);return _0x33ff54(_0x1c2174['error'][_0x50bb('0x13')]);}else{logger['info'](_0x50bb('0xc'),_0x35de5d,_0x50bb('0xf'));_0x33ff54(_0x1c2174[_0x50bb('0x14')][_0x50bb('0x13')]);}})[_0x50bb('0x15')](function(_0x4f2897){logger[_0x50bb('0x11')](_0x50bb('0xc'),_0x35de5d,_0x4f2897);_0x4f9172(_0x4f2897);});});} \ No newline at end of file +var _0x9bde=['code','message','SalesforceField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5f0487,_0x371396){var _0x222aa8=function(_0xf81a39){while(--_0xf81a39){_0x5f0487['push'](_0x5f0487['shift']());}};_0x222aa8(++_0x371396);}(_0x9bde,0xe1));var _0xe9bd=function(_0x19a10a,_0x3511f1){_0x19a10a=_0x19a10a-0x0;var _0x578af2=_0x9bde[_0x19a10a];return _0x578af2;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('SalesforceField,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('SalesforceField,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index dcef28b..7c1628c 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 _0x0389=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getFields','post','create','addConfiguration','/:id','update','delete','destroy','exports','multer'];(function(_0x267279,_0x92911c){var _0x14b8ef=function(_0x112564){while(--_0x112564){_0x267279['push'](_0x267279['shift']());}};_0x14b8ef(++_0x92911c);}(_0x0389,0x175));var _0x9038=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0389[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x9038('0x0'));var util=require('util');var path=require(_0x9038('0x1'));var timeout=require(_0x9038('0x2'));var express=require(_0x9038('0x3'));var router=express[_0x9038('0x4')]();var auth=require(_0x9038('0x5'));var interaction=require(_0x9038('0x6'));var config=require(_0x9038('0x7'));var controller=require('./intServicenowAccount.controller');router[_0x9038('0x8')]('/',auth[_0x9038('0x9')](),controller[_0x9038('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9038('0xb')]);router[_0x9038('0x8')](_0x9038('0xc'),auth[_0x9038('0x9')](),controller['getConfigurations']);router[_0x9038('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x9038('0xd')]);router[_0x9038('0xe')]('/',auth['isAuthenticated'](),controller[_0x9038('0xf')]);router['post'](_0x9038('0xc'),auth[_0x9038('0x9')](),controller[_0x9038('0x10')]);router['put'](_0x9038('0x11'),auth[_0x9038('0x9')](),controller[_0x9038('0x12')]);router[_0x9038('0x13')]('/:id',auth[_0x9038('0x9')](),controller[_0x9038('0x14')]);module[_0x9038('0x15')]=router; \ No newline at end of file +var _0xfa12=['update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','./intServicenowAccount.controller','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','/:id'];(function(_0x47c5bf,_0x45977e){var _0x11b779=function(_0x1bd585){while(--_0x1bd585){_0x47c5bf['push'](_0x47c5bf['shift']());}};_0x11b779(++_0x45977e);}(_0xfa12,0x1bd));var _0x2fa1=function(_0x11d88c,_0x305978){_0x11d88c=_0x11d88c-0x0;var _0xd5e234=_0xfa12[_0x11d88c];return _0xd5e234;};'use strict';var multer=require(_0x2fa1('0x0'));var util=require(_0x2fa1('0x1'));var path=require(_0x2fa1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2fa1('0x3')]();var auth=require(_0x2fa1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2fa1('0x5'));router[_0x2fa1('0x6')]('/',auth[_0x2fa1('0x7')](),controller['index']);router[_0x2fa1('0x6')]('/:id',auth[_0x2fa1('0x7')](),controller[_0x2fa1('0x8')]);router[_0x2fa1('0x6')](_0x2fa1('0x9'),auth[_0x2fa1('0x7')](),controller[_0x2fa1('0xa')]);router['get'](_0x2fa1('0xb'),auth[_0x2fa1('0x7')](),controller[_0x2fa1('0xc')]);router[_0x2fa1('0xd')]('/',auth[_0x2fa1('0x7')](),controller[_0x2fa1('0xe')]);router[_0x2fa1('0xd')](_0x2fa1('0x9'),auth['isAuthenticated'](),controller[_0x2fa1('0xf')]);router['put'](_0x2fa1('0x10'),auth['isAuthenticated'](),controller[_0x2fa1('0x11')]);router[_0x2fa1('0x12')](_0x2fa1('0x10'),auth[_0x2fa1('0x7')](),controller[_0x2fa1('0x13')]);module[_0x2fa1('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 531be96..cf67a21 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 _0x8f6a=['exports','STRING','username','remoteUri','sequelize'];(function(_0x413059,_0xaa27a1){var _0x43aa6f=function(_0x5a99f1){while(--_0x5a99f1){_0x413059['push'](_0x413059['shift']());}};_0x43aa6f(++_0xaa27a1);}(_0x8f6a,0x14e));var _0xa8f6=function(_0x5b479e,_0x4dd759){_0x5b479e=_0x5b479e-0x0;var _0x44f253=_0x8f6a[_0x5b479e];return _0x44f253;};'use strict';var Sequelize=require(_0xa8f6('0x0'));module[_0xa8f6('0x1')]={'name':{'type':Sequelize[_0xa8f6('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xa8f6('0x2')],'unique':_0xa8f6('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa8f6('0x2')]},'remoteUri':{'type':Sequelize[_0xa8f6('0x2')],'unique':_0xa8f6('0x4')},'serverUrl':{'type':Sequelize[_0xa8f6('0x2')]}}; \ No newline at end of file +var _0xab33=['username','sequelize','exports','STRING'];(function(_0x2d14f5,_0x1cb1c1){var _0x5bbfa4=function(_0x3e3af4){while(--_0x3e3af4){_0x2d14f5['push'](_0x2d14f5['shift']());}};_0x5bbfa4(++_0x1cb1c1);}(_0xab33,0x189));var _0x3ab3=function(_0x21d3a3,_0x4241b3){_0x21d3a3=_0x21d3a3-0x0;var _0x3bce93=_0xab33[_0x21d3a3];return _0x3bce93;};'use strict';var Sequelize=require(_0x3ab3('0x0'));module[_0x3ab3('0x1')]={'name':{'type':Sequelize[_0x3ab3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3ab3('0x2')],'unique':_0x3ab3('0x3')},'password':{'type':Sequelize[_0x3ab3('0x2')]},'email':{'type':Sequelize[_0x3ab3('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x3ab3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index edacc0c..7addcf4 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 _0x4ac0=['category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','number','sys_updated_by','user_input','sys_created_on','state','sys_created_by','knowledge','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','approval_set','subcategory','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','close_notes','closed_by','parent_incident','contact_type','reopened_by','urgency','problem_id','activity_due','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','location','username','email','serverUrl','remoteUri','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','password','incident?sysparm_display_value=all','incident\x20table\x20objects','assign','remove','includes','label','all','TCL:\x20_object','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','push','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','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/environment','../../components/integrations/configuration','jayson/promise','client','http','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ServicenowField','made_sla','hold_reason','close_code','notify','incident_state','severity'];(function(_0x462643,_0x3148c6){var _0x280baa=function(_0x214362){while(--_0x214362){_0x462643['push'](_0x462643['shift']());}};_0x280baa(++_0x3148c6);}(_0x4ac0,0x1d1));var _0x04ac=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4ac0[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0x04ac('0x0'));var emlformat=require(_0x04ac('0x1'));var rimraf=require(_0x04ac('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04ac('0x3'));var rp=require('request-promise');var moment=require(_0x04ac('0x4'));var BPromise=require(_0x04ac('0x5'));var Mustache=require(_0x04ac('0x6'));var util=require(_0x04ac('0x7'));var path=require(_0x04ac('0x8'));var sox=require(_0x04ac('0x9'));var csv=require(_0x04ac('0xa'));var ejs=require(_0x04ac('0xb'));var fs=require('fs');var _=require(_0x04ac('0xc'));var squel=require('squel');var crypto=require(_0x04ac('0xd'));var jsforce=require(_0x04ac('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x04ac('0xa'));var querystring=require(_0x04ac('0xf'));var Papa=require(_0x04ac('0x10'));var Redis=require(_0x04ac('0x11'));var authService=require(_0x04ac('0x12'));var qs=require(_0x04ac('0x13'));var as=require(_0x04ac('0x14'));var hardwareService=require(_0x04ac('0x15'));var logger=require(_0x04ac('0x16'))(_0x04ac('0x17'));var utils=require('../../config/utils');var config=require(_0x04ac('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x04ac('0x19'));var jayson=require(_0x04ac('0x1a'));var client=jayson[_0x04ac('0x1b')][_0x04ac('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x2e11fc,_0x1ff357,_0xd55645){if(_0xd55645){var _0x1d23dd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1d23dd['test'](_0x1ff357)){return _0x2e11fc;}else{throw new db['Sequelize']['ValidationError'](_0x04ac('0x1d'));}}else{return _0x2e11fc;}}function respondWithRpcPromise(_0x16072e,_0x2aa5f5,_0x516912,_0x419ed0){return new BPromise(function(_0x393dc1,_0x4203e5){var _0x2ad21d=_0x419ed0||client;return _0x2ad21d[_0x04ac('0x1e')](_0x16072e,_0x516912)[_0x04ac('0x1f')](function(_0x1c842e){logger[_0x04ac('0x20')](_0x04ac('0x21'),_0x2aa5f5,_0x04ac('0x22'));logger[_0x04ac('0x23')](_0x04ac('0x24'),_0x2aa5f5,'request\x20sent',JSON[_0x04ac('0x25')](_0x1c842e));if(_0x1c842e[_0x04ac('0x26')]){if(_0x1c842e[_0x04ac('0x26')]['code']===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x2aa5f5,_0x1c842e[_0x04ac('0x26')][_0x04ac('0x27')]);return _0x4203e5(_0x1c842e[_0x04ac('0x26')][_0x04ac('0x27')]);}logger['error'](_0x04ac('0x21'),_0x2aa5f5,_0x1c842e[_0x04ac('0x26')][_0x04ac('0x27')]);return _0x393dc1(_0x1c842e[_0x04ac('0x26')]['message']);}else{logger[_0x04ac('0x20')](_0x04ac('0x21'),_0x2aa5f5,_0x04ac('0x22'));_0x393dc1(_0x1c842e[_0x04ac('0x28')][_0x04ac('0x27')]);}})[_0x04ac('0x29')](function(_0x2d13d2){logger[_0x04ac('0x26')](_0x04ac('0x21'),_0x2aa5f5,_0x2d13d2);_0x4203e5(_0x2d13d2);});});}function respondWithStatusCode(_0xb70067,_0x3f4e88){_0x3f4e88=_0x3f4e88||0xcc;return function(_0xb82390){if(_0xb82390){return _0xb70067[_0x04ac('0x2a')](_0x3f4e88);}return _0xb70067['status'](_0x3f4e88)[_0x04ac('0x2b')]();};}function respondWithResult(_0x3e2092,_0x870676){_0x870676=_0x870676||0xc8;return function(_0x831f0a){if(_0x831f0a){return _0x3e2092[_0x04ac('0x2c')](_0x870676)[_0x04ac('0x2d')](_0x831f0a);}};}function respondWithFilteredResult(_0x475534,_0x13a993){return function(_0x56bd05){if(_0x56bd05){var _0x24846f=_0x56bd05[_0x04ac('0x2e')],_0x39cc97=_0x13a993[_0x04ac('0x2f')],_0x4adab1=_0x13a993[_0x04ac('0x2f')]+_0x13a993[_0x04ac('0x30')],_0x35e784;if(_0x4adab1>=_0x24846f){_0x4adab1=_0x24846f;_0x35e784=0xc8;}else{_0x35e784=0xce;}_0x475534[_0x04ac('0x2c')](_0x35e784);return _0x475534[_0x04ac('0x31')](_0x04ac('0x32'),_0x39cc97+'-'+_0x4adab1+'/'+_0x24846f)[_0x04ac('0x2d')](_0x56bd05);}return null;};}function patchUpdates(_0x10e881){return function(_0x5cb9ef){try{jsonpatch['apply'](_0x5cb9ef,_0x10e881,!![]);}catch(_0x1934bb){return BPromise[_0x04ac('0x33')](_0x1934bb);}return _0x5cb9ef['save']();};}function saveUpdates(_0x77740d,_0x38dbb8){return function(_0x1188ae){if(_0x1188ae){return _0x1188ae['update'](_0x77740d)[_0x04ac('0x1f')](function(_0xf80fc0){return _0xf80fc0;});}return null;};}function removeEntity(_0x586eea,_0x175aa7){return function(_0x4db384){if(_0x4db384){return _0x4db384['destroy']()['then'](function(){_0x586eea['status'](0xcc)[_0x04ac('0x2b')]();});}};}function handleEntityNotFound(_0x55d7ff,_0x5acee6){return function(_0xa473e3){if(!_0xa473e3){_0x55d7ff[_0x04ac('0x2a')](0x194);}return _0xa473e3;};}function handleError(_0x4928b6,_0x49e4d5){_0x49e4d5=_0x49e4d5||0x1f4;return function(_0x55253f){logger[_0x04ac('0x26')](_0x55253f[_0x04ac('0x34')]);if(_0x55253f[_0x04ac('0x35')]){delete _0x55253f[_0x04ac('0x35')];}_0x4928b6['status'](_0x49e4d5)[_0x04ac('0x36')](_0x55253f);};}exports[_0x04ac('0x37')]=function(_0x4ba085,_0x2b9037){var _0x384c5a={},_0x16979d={},_0x25190c={'count':0x0,'rows':[]};var _0x50661c=_[_0x04ac('0x38')](db[_0x04ac('0x39')]['rawAttributes'],function(_0xa0c5af){return{'name':_0xa0c5af[_0x04ac('0x3a')],'type':_0xa0c5af[_0x04ac('0x3b')][_0x04ac('0x3c')]};});_0x16979d[_0x04ac('0x3d')]=_['map'](_0x50661c,_0x04ac('0x35'));_0x16979d[_0x04ac('0x3e')]=_[_0x04ac('0x3f')](_0x4ba085[_0x04ac('0x3e')]);_0x16979d[_0x04ac('0x40')]=_[_0x04ac('0x41')](_0x16979d[_0x04ac('0x3d')],_0x16979d[_0x04ac('0x3e')]);_0x384c5a[_0x04ac('0x42')]=_[_0x04ac('0x41')](_0x16979d[_0x04ac('0x3d')],qs[_0x04ac('0x43')](_0x4ba085[_0x04ac('0x3e')][_0x04ac('0x43')]));_0x384c5a[_0x04ac('0x42')]=_0x384c5a['attributes'][_0x04ac('0x44')]?_0x384c5a['attributes']:_0x16979d['model'];if(!_0x4ba085[_0x04ac('0x3e')][_0x04ac('0x45')](_0x04ac('0x46'))){_0x384c5a['limit']=qs[_0x04ac('0x30')](_0x4ba085[_0x04ac('0x3e')]['limit']);_0x384c5a['offset']=qs[_0x04ac('0x2f')](_0x4ba085[_0x04ac('0x3e')][_0x04ac('0x2f')]);}_0x384c5a[_0x04ac('0x47')]=qs[_0x04ac('0x48')](_0x4ba085[_0x04ac('0x3e')]['sort']);_0x384c5a[_0x04ac('0x49')]=qs['filters'](_[_0x04ac('0x4a')](_0x4ba085[_0x04ac('0x3e')],_0x16979d['filters']));if(_0x4ba085[_0x04ac('0x3e')]['filter']){_0x384c5a[_0x04ac('0x49')]=_['merge'](_0x384c5a[_0x04ac('0x49')],{'$or':_[_0x04ac('0x38')](_0x50661c,function(_0x302c41){if(_0x302c41[_0x04ac('0x3b')]!==_0x04ac('0x4b')){var _0x8275a4={};_0x8275a4[_0x302c41[_0x04ac('0x35')]]={'$like':'%'+_0x4ba085[_0x04ac('0x3e')][_0x04ac('0x4c')]+'%'};return _0x8275a4;}})});}_0x384c5a=_[_0x04ac('0x4d')]({},_0x384c5a,_0x4ba085[_0x04ac('0x4e')]);var _0x82eca7={'where':_0x384c5a[_0x04ac('0x49')]};return db[_0x04ac('0x39')][_0x04ac('0x2e')](_0x82eca7)[_0x04ac('0x1f')](function(_0x399b99){_0x25190c[_0x04ac('0x2e')]=_0x399b99;if(_0x4ba085[_0x04ac('0x3e')]['includeAll']){_0x384c5a[_0x04ac('0x4f')]=[{'all':!![]}];}return db[_0x04ac('0x39')][_0x04ac('0x50')](_0x384c5a);})[_0x04ac('0x1f')](function(_0x22cc35){_0x25190c[_0x04ac('0x51')]=_0x22cc35;return _0x25190c;})[_0x04ac('0x1f')](respondWithFilteredResult(_0x2b9037,_0x384c5a))['catch'](handleError(_0x2b9037,null));};exports[_0x04ac('0x52')]=function(_0xf44357,_0x30943b){var _0x2390d4={'raw':![],'where':{'id':_0xf44357[_0x04ac('0x53')]['id']}},_0x484d9f={};_0x484d9f[_0x04ac('0x3d')]=_[_0x04ac('0x3f')](db[_0x04ac('0x39')][_0x04ac('0x54')]);_0x484d9f[_0x04ac('0x3e')]=_[_0x04ac('0x3f')](_0xf44357[_0x04ac('0x3e')]);_0x484d9f[_0x04ac('0x40')]=_[_0x04ac('0x41')](_0x484d9f['model'],_0x484d9f['query']);_0x2390d4['attributes']=_[_0x04ac('0x41')](_0x484d9f[_0x04ac('0x3d')],qs[_0x04ac('0x43')](_0xf44357[_0x04ac('0x3e')][_0x04ac('0x43')]));_0x2390d4[_0x04ac('0x42')]=_0x2390d4[_0x04ac('0x42')][_0x04ac('0x44')]?_0x2390d4['attributes']:_0x484d9f[_0x04ac('0x3d')];if(_0xf44357['query']['includeAll']){_0x2390d4[_0x04ac('0x4f')]=[{'all':!![]}];}_0x2390d4=_['merge']({},_0x2390d4,_0xf44357['options']);return db[_0x04ac('0x39')][_0x04ac('0x55')](_0x2390d4)[_0x04ac('0x1f')](handleEntityNotFound(_0x30943b,null))['then'](respondWithResult(_0x30943b,null))['catch'](handleError(_0x30943b,null));};exports[_0x04ac('0x56')]=function(_0x45bbed,_0x8327a0){return db[_0x04ac('0x39')]['create'](_0x45bbed[_0x04ac('0x57')],{})[_0x04ac('0x1f')](respondWithResult(_0x8327a0,0xc9))['catch'](handleError(_0x8327a0,null));};exports['update']=function(_0x3051e9,_0x5668c1){if(_0x3051e9[_0x04ac('0x57')]['id']){delete _0x3051e9[_0x04ac('0x57')]['id'];}return db[_0x04ac('0x39')][_0x04ac('0x55')]({'where':{'id':_0x3051e9[_0x04ac('0x53')]['id']}})[_0x04ac('0x1f')](handleEntityNotFound(_0x5668c1,null))['then'](saveUpdates(_0x3051e9[_0x04ac('0x57')],null))[_0x04ac('0x1f')](respondWithResult(_0x5668c1,null))[_0x04ac('0x29')](handleError(_0x5668c1,null));};exports[_0x04ac('0x58')]=function(_0x554007,_0x3a76f2){return db[_0x04ac('0x39')]['find']({'where':{'id':_0x554007['params']['id']}})[_0x04ac('0x1f')](handleEntityNotFound(_0x3a76f2,null))[_0x04ac('0x1f')](removeEntity(_0x3a76f2,null))[_0x04ac('0x29')](handleError(_0x3a76f2,null));};exports[_0x04ac('0x59')]=function(_0x1d37c9,_0x54c9f4,_0x33c470){var _0x2126d3={};var _0x418d7c={};var _0x3f0011;var _0x533fe2;return db['ServicenowAccount'][_0x04ac('0x5a')]({'where':{'id':_0x1d37c9[_0x04ac('0x53')]['id']}})[_0x04ac('0x1f')](handleEntityNotFound(_0x54c9f4,null))[_0x04ac('0x1f')](function(_0x11801c){if(_0x11801c){_0x3f0011=_0x11801c;_0x418d7c[_0x04ac('0x3d')]=_[_0x04ac('0x3f')](db[_0x04ac('0x5b')][_0x04ac('0x54')]);_0x418d7c['query']=_[_0x04ac('0x3f')](_0x1d37c9[_0x04ac('0x3e')]);_0x418d7c[_0x04ac('0x40')]=_[_0x04ac('0x41')](_0x418d7c[_0x04ac('0x3d')],_0x418d7c[_0x04ac('0x3e')]);_0x2126d3[_0x04ac('0x42')]=_[_0x04ac('0x41')](_0x418d7c[_0x04ac('0x3d')],qs[_0x04ac('0x43')](_0x1d37c9[_0x04ac('0x3e')]['fields']));_0x2126d3['attributes']=_0x2126d3[_0x04ac('0x42')][_0x04ac('0x44')]?_0x2126d3[_0x04ac('0x42')]:_0x418d7c[_0x04ac('0x3d')];_0x2126d3[_0x04ac('0x47')]=qs[_0x04ac('0x48')](_0x1d37c9[_0x04ac('0x3e')][_0x04ac('0x48')]);_0x2126d3[_0x04ac('0x49')]=qs['filters'](_[_0x04ac('0x4a')](_0x1d37c9[_0x04ac('0x3e')],_0x418d7c[_0x04ac('0x40')]));if(_0x1d37c9['query'][_0x04ac('0x4c')]){_0x2126d3[_0x04ac('0x49')]=_[_0x04ac('0x4d')](_0x2126d3[_0x04ac('0x49')],{'$or':_[_0x04ac('0x38')](_0x2126d3[_0x04ac('0x42')],function(_0x2fee5c){var _0x3efafb={};_0x3efafb[_0x2fee5c]={'$like':'%'+_0x1d37c9[_0x04ac('0x3e')][_0x04ac('0x4c')]+'%'};return _0x3efafb;})});}_0x2126d3=_[_0x04ac('0x4d')]({},_0x2126d3,_0x1d37c9[_0x04ac('0x4e')]);return _0x3f0011[_0x04ac('0x59')](_0x2126d3);}})[_0x04ac('0x1f')](function(_0x144862){if(_0x144862){_0x533fe2=_0x144862['length'];if(!_0x1d37c9[_0x04ac('0x3e')][_0x04ac('0x45')]('nolimit')){_0x2126d3[_0x04ac('0x30')]=qs[_0x04ac('0x30')](_0x1d37c9[_0x04ac('0x3e')][_0x04ac('0x30')]);_0x2126d3['offset']=qs[_0x04ac('0x2f')](_0x1d37c9[_0x04ac('0x3e')][_0x04ac('0x2f')]);}return _0x3f0011[_0x04ac('0x59')](_0x2126d3);}})['then'](function(_0x4ff0d1){if(_0x4ff0d1){return _0x4ff0d1?{'count':_0x533fe2,'rows':_0x4ff0d1}:null;}})['then'](respondWithResult(_0x54c9f4,null))[_0x04ac('0x29')](handleError(_0x54c9f4,null));};exports[_0x04ac('0x5c')]=function(_0x523e25,_0x27c74d,_0x22c7fc){if(_0x523e25[_0x04ac('0x57')]['id']){delete _0x523e25[_0x04ac('0x57')]['id'];}return db[_0x04ac('0x39')][_0x04ac('0x5a')]({'where':{'id':_0x523e25[_0x04ac('0x53')]['id']}})[_0x04ac('0x1f')](handleEntityNotFound(_0x27c74d,null))[_0x04ac('0x1f')](function(_0x2310a7){if(_0x2310a7){_0x523e25[_0x04ac('0x57')][_0x04ac('0x5d')]=_0x2310a7['id'];_0x523e25[_0x04ac('0x57')][_0x04ac('0x5e')]=integrations[_0x04ac('0x5f')](_0x523e25[_0x04ac('0x57')][_0x04ac('0x60')],_0x523e25['body'][_0x04ac('0x3b')]);_0x523e25['body'][_0x04ac('0x61')]=integrations['getDescriptions'](_0x523e25[_0x04ac('0x57')][_0x04ac('0x60')],_0x523e25['body']['type']);return db[_0x04ac('0x5b')][_0x04ac('0x56')](_0x523e25[_0x04ac('0x57')],{'include':[{'model':db[_0x04ac('0x62')],'as':_0x04ac('0x5e')},{'model':db[_0x04ac('0x62')],'as':'Descriptions'}]});}return null;})[_0x04ac('0x1f')](respondWithResult(_0x27c74d,null))['catch'](handleError(_0x27c74d,null));};exports['getFields']=function(_0x1e6a7f,_0x4f77f5,_0x646276){var _0x5729f4=[_0x04ac('0x63'),_0x04ac('0x64'),'knowledge','subcategory',_0x04ac('0x65'),_0x04ac('0x66'),_0x04ac('0x67'),_0x04ac('0x68'),_0x04ac('0x69')];var _0x480f8d=[_0x04ac('0x6a'),_0x04ac('0x63'),_0x04ac('0x6b'),'watch_list',_0x04ac('0x6c'),_0x04ac('0x6d'),_0x04ac('0x6e'),_0x04ac('0x64'),'approval_history',_0x04ac('0x6f'),'resolved_by',_0x04ac('0x70'),'opened_by',_0x04ac('0x71'),_0x04ac('0x72'),'sys_domain',_0x04ac('0x73'),_0x04ac('0x74'),_0x04ac('0x75'),_0x04ac('0x47'),'calendar_stc','closed_at',_0x04ac('0x76'),_0x04ac('0x77'),_0x04ac('0x78'),_0x04ac('0x79'),_0x04ac('0x7a'),_0x04ac('0x7b'),'priority',_0x04ac('0x7c'),_0x04ac('0x7d'),'time_worked',_0x04ac('0x7e'),_0x04ac('0x7f'),_0x04ac('0x80'),_0x04ac('0x81'),'work_end',_0x04ac('0x82'),_0x04ac('0x83'),'caller_id',_0x04ac('0x84'),_0x04ac('0x85'),'work_notes',_0x04ac('0x86'),_0x04ac('0x65'),'correlation_display',_0x04ac('0x87'),_0x04ac('0x88'),_0x04ac('0x89'),_0x04ac('0x8a'),_0x04ac('0x8b'),_0x04ac('0x8c'),'calendar_duration',_0x04ac('0x66'),'sys_class_name',_0x04ac('0x8d'),_0x04ac('0x8e'),'follow_up',_0x04ac('0x8f'),'sys_id',_0x04ac('0x90'),_0x04ac('0x91'),_0x04ac('0x67'),_0x04ac('0x92'),_0x04ac('0x93'),'company','reassignment_count',_0x04ac('0x94'),'assigned_to',_0x04ac('0x68'),'comments',_0x04ac('0x95'),'approval',_0x04ac('0x96'),_0x04ac('0x97'),_0x04ac('0x98'),_0x04ac('0x99'),_0x04ac('0x9a'),_0x04ac('0x9b'),'upon_approval','correlation_id',_0x04ac('0x9c'),_0x04ac('0x69')];var _0x46e6b7='';var _0x5eca9d='';var _0x16d62f=[];var _0x5eeb08='';var _0x3c6420='';var _0x52ab5d=[];var _0x224f33='';var _0x328ef1='';var _0x2aabbd={};var _0x14b408='';return db[_0x04ac('0x39')][_0x04ac('0x5a')]({'where':{'id':_0x1e6a7f['params']['id']},'attributes':['id',_0x04ac('0x9d'),'password',_0x04ac('0x9e'),'remoteUri',_0x04ac('0x9f')]})['then'](handleEntityNotFound(_0x4f77f5,null))[_0x04ac('0x1f')](function(_0x48e319){if(_0x48e319){_0x14b408=_0x48e319[_0x04ac('0xa0')];var _0x3426c7=_0x14b408['slice'](-0x1);if(_0x3426c7==='/'){_0x14b408=_0x14b408[_0x04ac('0xa1')](0x0,_0x14b408[_0x04ac('0xa2')](_0x3426c7));}_0x328ef1=util['format'](_0x04ac('0xa3'),_0x14b408);_0x224f33=util[_0x04ac('0xa4')](_0x04ac('0xa5'),_0x14b408);_0x2aabbd={'user':_0x48e319[_0x04ac('0x9d')],'pass':_0x48e319[_0x04ac('0xa6')]};var _0x7f2805={'method':'GET','uri':_0x328ef1+_0x04ac('0xa7'),'auth':_0x2aabbd,'json':!![]};return rp(_0x7f2805);}})[_0x04ac('0x1f')](function(_0x165b38){if(_0x165b38['result'][_0x04ac('0x44')]>0x0){_0x46e6b7=_0x165b38[_0x04ac('0x28')];}console['log'](_0x04ac('0xa8'),_0x46e6b7);_0x52ab5d=[];_0x5eca9d=Object[_0x04ac('0xa9')]([],_0x46e6b7);_[_0x04ac('0xaa')](_0x5eca9d,function(_0x144306){return!_0x5729f4[_0x04ac('0xab')](_0x144306['name']);});_0x5eca9d['forEach'](function(_0x205e4b){var _0x2e692d=createFieldObject(_0x224f33,_0x2aabbd,_0x205e4b['internalType'],_0x205e4b[_0x04ac('0x35')],_0x205e4b[_0x04ac('0xac')],![]);_0x52ab5d['push'](_0x2e692d);});return Promise[_0x04ac('0xad')](_0x52ab5d);})[_0x04ac('0x1f')](function(_0x41acbf){_0x16d62f=_0x41acbf;_0x5eeb08=Object[_0x04ac('0xa9')]([],_0x46e6b7);console['log'](_0x04ac('0xae'),_0x46e6b7);_[_0x04ac('0xaa')](_0x5eeb08,function(_0x13942a){return _0x480f8d['includes'](_0x13942a[_0x04ac('0x35')]);});console[_0x04ac('0xaf')](_0x04ac('0xb0'),_0x5eeb08);_0x52ab5d=[];_0x5eeb08[_0x04ac('0xb1')](function(_0x5d0a97){var _0xa7959c=createFieldObject(_0x224f33,_0x2aabbd,_0x5d0a97['internalType'],_0x5d0a97[_0x04ac('0x35')],_0x5d0a97[_0x04ac('0xac')],!![]);_0x52ab5d[_0x04ac('0xb2')](_0xa7959c);});return Promise[_0x04ac('0xad')](_0x52ab5d);})[_0x04ac('0x1f')](function(_0x3e51b2){_0x3c6420=_0x3e51b2;var _0x2f70d1=_0x16d62f[_0x04ac('0xb3')](_0x3c6420);return{'count':_0x2f70d1[_0x04ac('0x44')],'rows':_0x2f70d1};})[_0x04ac('0x1f')](respondWithResult(_0x4f77f5,null))['catch'](function(_0x1ef099){console[_0x04ac('0xaf')](_0x04ac('0xb4')+_0x1ef099);var _0x50ddf2=_0x1e6a7f[_0x04ac('0x3e')][_0x04ac('0xb5')]?0x1f4:_0x1ef099['statusCode']||0x1f4;logger[_0x04ac('0x26')](_0x1ef099['stack']);delete _0x1ef099[_0x04ac('0x35')];if(_0x50ddf2===0x191){_0x50ddf2=0x190;}_0x4f77f5[_0x04ac('0x2c')](_0x50ddf2)['send'](_0x1e6a7f['query'][_0x04ac('0xb5')]?{'message':_0x04ac('0xb6'),'statusCode':_0x1ef099[_0x04ac('0xb7')]}:_0x1ef099);});};function createFieldObject(_0xedb186,_0x4bf2ea,_0x214169,_0x312c73,_0x59c389,_0x45d43b){return new Promise(function(_0x38587a,_0x16408d){var _0x23051e={'id':_0x312c73,'name':_0x59c389,'custom':_0x45d43b};if(_0x214169==='boolean'){_0x23051e[_0x04ac('0x4e')]=[{'name':_0x04ac('0xb8'),'value':_0x04ac('0xb9')},{'name':_0x04ac('0xba'),'value':_0x04ac('0xbb')}];_0x38587a(_0x23051e);}else{var _0x23896a={'method':'GET','uri':_0xedb186+_0x04ac('0xbc')+_0x312c73,'auth':_0x4bf2ea,'json':!![]};return rp(_0x23896a)[_0x04ac('0x1f')](function(_0x436f35){var _0x385717=[];if(_0x436f35[_0x04ac('0x28')]['length']>0x0){_0x436f35[_0x04ac('0x28')][_0x04ac('0xb1')](function(_0xc83c95){if(_0xc83c95['inactive']===_0x04ac('0xbb')){var _0x269394={'name':_0xc83c95[_0x04ac('0xac')],'value':_0xc83c95[_0x04ac('0xbd')]};_0x385717['push'](_0x269394);}});}_0x23051e[_0x04ac('0x4e')]=_0x385717;if(_0x23051e[_0x04ac('0x4e')]['length']>0x0){_0x38587a(_0x23051e);}else{if(_0x45d43b==![]){_0x38587a();}else{_0x38587a(_0x23051e);}}});}});} \ No newline at end of file +var _0x5807=['then','info','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','ServicenowAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','set','reject','update','stack','name','send','index','ServicenowAccount','rawAttributes','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','create','body','find','ServicenowConfiguration','options','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','rfc','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','resolved_at','approval_set','work_notes','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','company','reassignment_count','activity_due','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','remoteUri','serverUrl','slice','lastIndexOf','format','%s/api/now/doc/table/schema/','username','GET','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','result','false','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','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','jayson/promise','test','ValidationError','request'];(function(_0xb08125,_0x561acb){var _0x2ace23=function(_0x50dbbf){while(--_0x50dbbf){_0xb08125['push'](_0xb08125['shift']());}};_0x2ace23(++_0x561acb);}(_0x5807,0x165));var _0x7580=function(_0x2c0be1,_0x1e88f2){_0x2c0be1=_0x2c0be1-0x0;var _0x3d4bd2=_0x5807[_0x2c0be1];return _0x3d4bd2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7580('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7580('0x1'));var jsonpatch=require(_0x7580('0x2'));var rp=require(_0x7580('0x3'));var moment=require(_0x7580('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7580('0x5'));var util=require(_0x7580('0x6'));var path=require('path');var sox=require(_0x7580('0x7'));var csv=require('to-csv');var ejs=require(_0x7580('0x8'));var fs=require('fs');var _=require(_0x7580('0x9'));var squel=require(_0x7580('0xa'));var crypto=require(_0x7580('0xb'));var jsforce=require(_0x7580('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7580('0xd'));var Papa=require(_0x7580('0xe'));var Redis=require(_0x7580('0xf'));var authService=require(_0x7580('0x10'));var qs=require(_0x7580('0x11'));var as=require(_0x7580('0x12'));var hardwareService=require(_0x7580('0x13'));var logger=require(_0x7580('0x14'))(_0x7580('0x15'));var utils=require(_0x7580('0x16'));var config=require(_0x7580('0x17'));var db=require(_0x7580('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x7580('0x19'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x33d510,_0x3c5b1f,_0x26732b){if(_0x26732b){var _0x57aa16=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x57aa16[_0x7580('0x1a')](_0x3c5b1f)){return _0x33d510;}else{throw new db['Sequelize'][(_0x7580('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 _0x33d510;}}function respondWithRpcPromise(_0x382303,_0x234c13,_0x3742d2,_0x358be5){return new BPromise(function(_0xc177dc,_0x3afa28){var _0x32bf6f=_0x358be5||client;return _0x32bf6f[_0x7580('0x1c')](_0x382303,_0x3742d2)[_0x7580('0x1d')](function(_0x328244){logger[_0x7580('0x1e')]('ServicenowAccount,\x20%s,\x20%s',_0x234c13,'request\x20sent');logger[_0x7580('0x1f')](_0x7580('0x20'),_0x234c13,_0x7580('0x21'),JSON['stringify'](_0x328244));if(_0x328244['error']){if(_0x328244[_0x7580('0x22')]['code']===0x1f4){logger[_0x7580('0x22')](_0x7580('0x23'),_0x234c13,_0x328244[_0x7580('0x22')]['message']);return _0x3afa28(_0x328244[_0x7580('0x22')][_0x7580('0x24')]);}logger[_0x7580('0x22')](_0x7580('0x23'),_0x234c13,_0x328244[_0x7580('0x22')]['message']);return _0xc177dc(_0x328244['error'][_0x7580('0x24')]);}else{logger[_0x7580('0x1e')]('ServicenowAccount,\x20%s,\x20%s',_0x234c13,_0x7580('0x21'));_0xc177dc(_0x328244['result'][_0x7580('0x24')]);}})[_0x7580('0x25')](function(_0x464c50){logger['error'](_0x7580('0x23'),_0x234c13,_0x464c50);_0x3afa28(_0x464c50);});});}function respondWithStatusCode(_0x82dd49,_0x2c5df4){_0x2c5df4=_0x2c5df4||0xcc;return function(_0x5ce615){if(_0x5ce615){return _0x82dd49[_0x7580('0x26')](_0x2c5df4);}return _0x82dd49[_0x7580('0x27')](_0x2c5df4)[_0x7580('0x28')]();};}function respondWithResult(_0x3ed100,_0xa64d02){_0xa64d02=_0xa64d02||0xc8;return function(_0x1b28e4){if(_0x1b28e4){return _0x3ed100[_0x7580('0x27')](_0xa64d02)[_0x7580('0x29')](_0x1b28e4);}};}function respondWithFilteredResult(_0x507c40,_0x3dd559){return function(_0x541de8){if(_0x541de8){var _0x377e4a=_0x541de8[_0x7580('0x2a')],_0x255bdf=_0x3dd559[_0x7580('0x2b')],_0x492829=_0x3dd559[_0x7580('0x2b')]+_0x3dd559['limit'],_0x3696d9;if(_0x492829>=_0x377e4a){_0x492829=_0x377e4a;_0x3696d9=0xc8;}else{_0x3696d9=0xce;}_0x507c40[_0x7580('0x27')](_0x3696d9);return _0x507c40[_0x7580('0x2c')]('Content-Range',_0x255bdf+'-'+_0x492829+'/'+_0x377e4a)['json'](_0x541de8);}return null;};}function patchUpdates(_0x3f4036){return function(_0xb191f5){try{jsonpatch['apply'](_0xb191f5,_0x3f4036,!![]);}catch(_0x1e881f){return BPromise[_0x7580('0x2d')](_0x1e881f);}return _0xb191f5['save']();};}function saveUpdates(_0x432540,_0x1fb665){return function(_0x2c0092){if(_0x2c0092){return _0x2c0092[_0x7580('0x2e')](_0x432540)[_0x7580('0x1d')](function(_0x2ab3dc){return _0x2ab3dc;});}return null;};}function removeEntity(_0xfa71ae,_0x18a543){return function(_0x6e5cea){if(_0x6e5cea){return _0x6e5cea['destroy']()[_0x7580('0x1d')](function(){_0xfa71ae[_0x7580('0x27')](0xcc)[_0x7580('0x28')]();});}};}function handleEntityNotFound(_0x29be2,_0x5b1add){return function(_0x45777f){if(!_0x45777f){_0x29be2['sendStatus'](0x194);}return _0x45777f;};}function handleError(_0x289c8a,_0x5c5356){_0x5c5356=_0x5c5356||0x1f4;return function(_0x3184a2){logger[_0x7580('0x22')](_0x3184a2[_0x7580('0x2f')]);if(_0x3184a2[_0x7580('0x30')]){delete _0x3184a2['name'];}_0x289c8a['status'](_0x5c5356)[_0x7580('0x31')](_0x3184a2);};}exports[_0x7580('0x32')]=function(_0x351e49,_0x295f22){var _0x5c8d98={},_0x4562fe={},_0x2a81dd={'count':0x0,'rows':[]};var _0x5c3954=_['map'](db[_0x7580('0x33')][_0x7580('0x34')],function(_0x499c75){return{'name':_0x499c75['fieldName'],'type':_0x499c75['type'][_0x7580('0x35')]};});_0x4562fe[_0x7580('0x36')]=_[_0x7580('0x37')](_0x5c3954,_0x7580('0x30'));_0x4562fe['query']=_[_0x7580('0x38')](_0x351e49[_0x7580('0x39')]);_0x4562fe[_0x7580('0x3a')]=_['intersection'](_0x4562fe[_0x7580('0x36')],_0x4562fe[_0x7580('0x39')]);_0x5c8d98[_0x7580('0x3b')]=_[_0x7580('0x3c')](_0x4562fe['model'],qs[_0x7580('0x3d')](_0x351e49['query'][_0x7580('0x3d')]));_0x5c8d98[_0x7580('0x3b')]=_0x5c8d98['attributes'][_0x7580('0x3e')]?_0x5c8d98['attributes']:_0x4562fe[_0x7580('0x36')];if(!_0x351e49[_0x7580('0x39')][_0x7580('0x3f')](_0x7580('0x40'))){_0x5c8d98['limit']=qs[_0x7580('0x41')](_0x351e49[_0x7580('0x39')][_0x7580('0x41')]);_0x5c8d98[_0x7580('0x2b')]=qs[_0x7580('0x2b')](_0x351e49['query'][_0x7580('0x2b')]);}_0x5c8d98[_0x7580('0x42')]=qs[_0x7580('0x43')](_0x351e49[_0x7580('0x39')][_0x7580('0x43')]);_0x5c8d98[_0x7580('0x44')]=qs[_0x7580('0x3a')](_[_0x7580('0x45')](_0x351e49['query'],_0x4562fe[_0x7580('0x3a')]));if(_0x351e49[_0x7580('0x39')][_0x7580('0x46')]){_0x5c8d98['where']=_[_0x7580('0x47')](_0x5c8d98['where'],{'$or':_[_0x7580('0x37')](_0x5c3954,function(_0x261bdf){if(_0x261bdf[_0x7580('0x48')]!==_0x7580('0x49')){var _0x2512ec={};_0x2512ec[_0x261bdf['name']]={'$like':'%'+_0x351e49[_0x7580('0x39')][_0x7580('0x46')]+'%'};return _0x2512ec;}})});}_0x5c8d98=_['merge']({},_0x5c8d98,_0x351e49['options']);var _0x5f053a={'where':_0x5c8d98[_0x7580('0x44')]};return db[_0x7580('0x33')][_0x7580('0x2a')](_0x5f053a)[_0x7580('0x1d')](function(_0x45f0ff){_0x2a81dd[_0x7580('0x2a')]=_0x45f0ff;if(_0x351e49[_0x7580('0x39')][_0x7580('0x4a')]){_0x5c8d98[_0x7580('0x4b')]=[{'all':!![]}];}return db[_0x7580('0x33')][_0x7580('0x4c')](_0x5c8d98);})[_0x7580('0x1d')](function(_0x40dff3){_0x2a81dd[_0x7580('0x4d')]=_0x40dff3;return _0x2a81dd;})[_0x7580('0x1d')](respondWithFilteredResult(_0x295f22,_0x5c8d98))[_0x7580('0x25')](handleError(_0x295f22,null));};exports[_0x7580('0x4e')]=function(_0x109fd8,_0x1fe4b2){var _0x2acdb0={'raw':![],'where':{'id':_0x109fd8[_0x7580('0x4f')]['id']}},_0x20e4dd={};_0x20e4dd[_0x7580('0x36')]=_[_0x7580('0x38')](db['ServicenowAccount'][_0x7580('0x34')]);_0x20e4dd[_0x7580('0x39')]=_[_0x7580('0x38')](_0x109fd8[_0x7580('0x39')]);_0x20e4dd[_0x7580('0x3a')]=_['intersection'](_0x20e4dd['model'],_0x20e4dd[_0x7580('0x39')]);_0x2acdb0[_0x7580('0x3b')]=_[_0x7580('0x3c')](_0x20e4dd[_0x7580('0x36')],qs[_0x7580('0x3d')](_0x109fd8[_0x7580('0x39')]['fields']));_0x2acdb0[_0x7580('0x3b')]=_0x2acdb0[_0x7580('0x3b')]['length']?_0x2acdb0['attributes']:_0x20e4dd[_0x7580('0x36')];if(_0x109fd8['query'][_0x7580('0x4a')]){_0x2acdb0[_0x7580('0x4b')]=[{'all':!![]}];}_0x2acdb0=_['merge']({},_0x2acdb0,_0x109fd8['options']);return db[_0x7580('0x33')]['find'](_0x2acdb0)['then'](handleEntityNotFound(_0x1fe4b2,null))['then'](respondWithResult(_0x1fe4b2,null))[_0x7580('0x25')](handleError(_0x1fe4b2,null));};exports[_0x7580('0x50')]=function(_0x3dae8b,_0x2956c2){return db[_0x7580('0x33')][_0x7580('0x50')](_0x3dae8b['body'],{})[_0x7580('0x1d')](respondWithResult(_0x2956c2,0xc9))[_0x7580('0x25')](handleError(_0x2956c2,null));};exports[_0x7580('0x2e')]=function(_0x2b6113,_0x47b902){if(_0x2b6113['body']['id']){delete _0x2b6113[_0x7580('0x51')]['id'];}return db[_0x7580('0x33')]['find']({'where':{'id':_0x2b6113[_0x7580('0x4f')]['id']}})[_0x7580('0x1d')](handleEntityNotFound(_0x47b902,null))[_0x7580('0x1d')](saveUpdates(_0x2b6113[_0x7580('0x51')],null))[_0x7580('0x1d')](respondWithResult(_0x47b902,null))[_0x7580('0x25')](handleError(_0x47b902,null));};exports['destroy']=function(_0x1da7b8,_0x204acd){return db['ServicenowAccount'][_0x7580('0x52')]({'where':{'id':_0x1da7b8[_0x7580('0x4f')]['id']}})['then'](handleEntityNotFound(_0x204acd,null))[_0x7580('0x1d')](removeEntity(_0x204acd,null))[_0x7580('0x25')](handleError(_0x204acd,null));};exports['getConfigurations']=function(_0x3ac39b,_0x536e61,_0x36abda){var _0x52a0d5={};var _0x2dc008={};var _0x34d25f;var _0xf9de19;return db[_0x7580('0x33')]['findOne']({'where':{'id':_0x3ac39b[_0x7580('0x4f')]['id']}})[_0x7580('0x1d')](handleEntityNotFound(_0x536e61,null))[_0x7580('0x1d')](function(_0x67194a){if(_0x67194a){_0x34d25f=_0x67194a;_0x2dc008['model']=_[_0x7580('0x38')](db[_0x7580('0x53')]['rawAttributes']);_0x2dc008[_0x7580('0x39')]=_[_0x7580('0x38')](_0x3ac39b[_0x7580('0x39')]);_0x2dc008['filters']=_[_0x7580('0x3c')](_0x2dc008[_0x7580('0x36')],_0x2dc008['query']);_0x52a0d5['attributes']=_[_0x7580('0x3c')](_0x2dc008[_0x7580('0x36')],qs[_0x7580('0x3d')](_0x3ac39b['query']['fields']));_0x52a0d5[_0x7580('0x3b')]=_0x52a0d5[_0x7580('0x3b')][_0x7580('0x3e')]?_0x52a0d5['attributes']:_0x2dc008[_0x7580('0x36')];_0x52a0d5[_0x7580('0x42')]=qs['sort'](_0x3ac39b[_0x7580('0x39')][_0x7580('0x43')]);_0x52a0d5[_0x7580('0x44')]=qs[_0x7580('0x3a')](_[_0x7580('0x45')](_0x3ac39b[_0x7580('0x39')],_0x2dc008[_0x7580('0x3a')]));if(_0x3ac39b[_0x7580('0x39')][_0x7580('0x46')]){_0x52a0d5['where']=_[_0x7580('0x47')](_0x52a0d5[_0x7580('0x44')],{'$or':_[_0x7580('0x37')](_0x52a0d5[_0x7580('0x3b')],function(_0xc2620b){var _0x519486={};_0x519486[_0xc2620b]={'$like':'%'+_0x3ac39b['query'][_0x7580('0x46')]+'%'};return _0x519486;})});}_0x52a0d5=_['merge']({},_0x52a0d5,_0x3ac39b[_0x7580('0x54')]);return _0x34d25f['getConfigurations'](_0x52a0d5);}})[_0x7580('0x1d')](function(_0x10121c){if(_0x10121c){_0xf9de19=_0x10121c[_0x7580('0x3e')];if(!_0x3ac39b[_0x7580('0x39')][_0x7580('0x3f')](_0x7580('0x40'))){_0x52a0d5[_0x7580('0x41')]=qs['limit'](_0x3ac39b[_0x7580('0x39')][_0x7580('0x41')]);_0x52a0d5['offset']=qs['offset'](_0x3ac39b['query'][_0x7580('0x2b')]);}return _0x34d25f[_0x7580('0x55')](_0x52a0d5);}})[_0x7580('0x1d')](function(_0x58dc3a){if(_0x58dc3a){return _0x58dc3a?{'count':_0xf9de19,'rows':_0x58dc3a}:null;}})[_0x7580('0x1d')](respondWithResult(_0x536e61,null))[_0x7580('0x25')](handleError(_0x536e61,null));};exports[_0x7580('0x56')]=function(_0x324cc6,_0x408078,_0x57334b){if(_0x324cc6[_0x7580('0x51')]['id']){delete _0x324cc6['body']['id'];}return db['ServicenowAccount'][_0x7580('0x57')]({'where':{'id':_0x324cc6[_0x7580('0x4f')]['id']}})[_0x7580('0x1d')](handleEntityNotFound(_0x408078,null))[_0x7580('0x1d')](function(_0x5a93d1){if(_0x5a93d1){_0x324cc6[_0x7580('0x51')][_0x7580('0x58')]=_0x5a93d1['id'];_0x324cc6[_0x7580('0x51')]['Subjects']=integrations[_0x7580('0x59')](_0x324cc6[_0x7580('0x51')][_0x7580('0x5a')],_0x324cc6[_0x7580('0x51')][_0x7580('0x48')]);_0x324cc6['body'][_0x7580('0x5b')]=integrations[_0x7580('0x5c')](_0x324cc6['body']['channel'],_0x324cc6[_0x7580('0x51')][_0x7580('0x48')]);return db[_0x7580('0x53')][_0x7580('0x50')](_0x324cc6['body'],{'include':[{'model':db[_0x7580('0x5d')],'as':'Subjects'},{'model':db[_0x7580('0x5d')],'as':_0x7580('0x5b')}]});}return null;})['then'](respondWithResult(_0x408078,null))[_0x7580('0x25')](handleError(_0x408078,null));};exports[_0x7580('0x5e')]=function(_0xfcd9c8,_0x3dd095,_0x4ed83c){var _0x123861=[_0x7580('0x5f'),_0x7580('0x60'),_0x7580('0x61'),_0x7580('0x62'),_0x7580('0x63'),_0x7580('0x64'),_0x7580('0x65'),_0x7580('0x66'),_0x7580('0x67')];var _0x1a6550=[_0x7580('0x68'),_0x7580('0x5f'),_0x7580('0x69'),'watch_list',_0x7580('0x6a'),_0x7580('0x6b'),_0x7580('0x6c'),_0x7580('0x60'),_0x7580('0x6d'),_0x7580('0x6e'),_0x7580('0x6f'),_0x7580('0x70'),_0x7580('0x71'),_0x7580('0x72'),_0x7580('0x73'),_0x7580('0x74'),'state',_0x7580('0x75'),'knowledge',_0x7580('0x42'),_0x7580('0x76'),_0x7580('0x77'),_0x7580('0x78'),_0x7580('0x79'),_0x7580('0x7a'),_0x7580('0x7b'),'work_notes_list',_0x7580('0x7c'),'priority','sys_domain_path',_0x7580('0x7d'),_0x7580('0x7e'),_0x7580('0x7f'),_0x7580('0x80'),_0x7580('0x81'),_0x7580('0x82'),'work_end',_0x7580('0x83'),_0x7580('0x84'),'caller_id',_0x7580('0x85'),_0x7580('0x62'),_0x7580('0x86'),'short_description','close_code','correlation_display','delivery_task',_0x7580('0x87'),_0x7580('0x88'),_0x7580('0x89'),_0x7580('0x8a'),_0x7580('0x8b'),_0x7580('0x8c'),_0x7580('0x64'),'sys_class_name',_0x7580('0x8d'),_0x7580('0x8e'),_0x7580('0x8f'),_0x7580('0x90'),_0x7580('0x91'),_0x7580('0x92'),'reopened_by',_0x7580('0x65'),_0x7580('0x93'),'problem_id',_0x7580('0x94'),_0x7580('0x95'),_0x7580('0x96'),'assigned_to',_0x7580('0x66'),'comments',_0x7580('0x97'),_0x7580('0x98'),_0x7580('0x99'),_0x7580('0x9a'),_0x7580('0x9b'),_0x7580('0x9c'),_0x7580('0x9d'),_0x7580('0x9e'),_0x7580('0x9f'),_0x7580('0xa0'),_0x7580('0xa1'),'category'];var _0x2f68fd='';var _0x52e1a8='';var _0x53b21b=[];var _0x40b178='';var _0x111068='';var _0x21f1a4=[];var _0x1e4600='';var _0x3f8edb='';var _0x2977fc={};var _0x4c03f7='';return db[_0x7580('0x33')][_0x7580('0x57')]({'where':{'id':_0xfcd9c8[_0x7580('0x4f')]['id']},'attributes':['id','username','password','email',_0x7580('0xa2'),_0x7580('0xa3')]})[_0x7580('0x1d')](handleEntityNotFound(_0x3dd095,null))['then'](function(_0x3389ae){if(_0x3389ae){_0x4c03f7=_0x3389ae[_0x7580('0xa2')];var _0x4fb10f=_0x4c03f7[_0x7580('0xa4')](-0x1);if(_0x4fb10f==='/'){_0x4c03f7=_0x4c03f7['substring'](0x0,_0x4c03f7[_0x7580('0xa5')](_0x4fb10f));}_0x3f8edb=util[_0x7580('0xa6')](_0x7580('0xa7'),_0x4c03f7);_0x1e4600=util[_0x7580('0xa6')]('%s/api/now/table/',_0x4c03f7);_0x2977fc={'user':_0x3389ae[_0x7580('0xa8')],'pass':_0x3389ae['password']};var _0x168c9d={'method':_0x7580('0xa9'),'uri':_0x3f8edb+'incident?sysparm_display_value=all','auth':_0x2977fc,'json':!![]};return rp(_0x168c9d);}})[_0x7580('0x1d')](function(_0xc5329f){if(_0xc5329f['result']['length']>0x0){_0x2f68fd=_0xc5329f['result'];}console[_0x7580('0xaa')](_0x7580('0xab'),_0x2f68fd);_0x21f1a4=[];_0x52e1a8=Object[_0x7580('0xac')]([],_0x2f68fd);_[_0x7580('0xad')](_0x52e1a8,function(_0x41296a){return!_0x123861[_0x7580('0xae')](_0x41296a[_0x7580('0x30')]);});_0x52e1a8[_0x7580('0xaf')](function(_0x205e57){var _0x4aff26=createFieldObject(_0x1e4600,_0x2977fc,_0x205e57[_0x7580('0xb0')],_0x205e57['name'],_0x205e57[_0x7580('0xb1')],![]);_0x21f1a4[_0x7580('0xb2')](_0x4aff26);});return Promise[_0x7580('0xb3')](_0x21f1a4);})[_0x7580('0x1d')](function(_0xf941bc){_0x53b21b=_0xf941bc;_0x40b178=Object[_0x7580('0xac')]([],_0x2f68fd);console['log'](_0x7580('0xb4'),_0x2f68fd);_[_0x7580('0xad')](_0x40b178,function(_0x2fa9d4){return _0x1a6550[_0x7580('0xae')](_0x2fa9d4[_0x7580('0x30')]);});console[_0x7580('0xaa')](_0x7580('0xb5'),_0x40b178);_0x21f1a4=[];_0x40b178[_0x7580('0xaf')](function(_0x52e3a7){var _0xaca533=createFieldObject(_0x1e4600,_0x2977fc,_0x52e3a7[_0x7580('0xb0')],_0x52e3a7['name'],_0x52e3a7[_0x7580('0xb1')],!![]);_0x21f1a4[_0x7580('0xb2')](_0xaca533);});return Promise[_0x7580('0xb3')](_0x21f1a4);})[_0x7580('0x1d')](function(_0x2a3b50){_0x111068=_0x2a3b50;var _0x3fd54b=_0x53b21b[_0x7580('0xb6')](_0x111068);return{'count':_0x3fd54b[_0x7580('0x3e')],'rows':_0x3fd54b};})['then'](respondWithResult(_0x3dd095,null))[_0x7580('0x25')](function(_0xd4cf48){console['log'](_0x7580('0xb7')+_0xd4cf48);var _0x2acea0=_0xfcd9c8[_0x7580('0x39')][_0x7580('0x1a')]?0x1f4:_0xd4cf48[_0x7580('0xb8')]||0x1f4;logger['error'](_0xd4cf48[_0x7580('0x2f')]);delete _0xd4cf48['name'];if(_0x2acea0===0x191){_0x2acea0=0x190;}_0x3dd095[_0x7580('0x27')](_0x2acea0)[_0x7580('0x31')](_0xfcd9c8['query'][_0x7580('0x1a')]?{'message':'Wrong\x20credentials','statusCode':_0xd4cf48['statusCode']}:_0xd4cf48);});};function createFieldObject(_0x1c3bd6,_0x500073,_0x47cef8,_0x1f8f5c,_0x143d2f,_0x385c93){return new Promise(function(_0x1326ad,_0x9247d6){var _0x476dad={'id':_0x1f8f5c,'name':_0x143d2f,'custom':_0x385c93};if(_0x47cef8===_0x7580('0xb9')){_0x476dad[_0x7580('0x54')]=[{'name':_0x7580('0xba'),'value':_0x7580('0xbb')},{'name':_0x7580('0xbc'),'value':'false'}];_0x1326ad(_0x476dad);}else{var _0x40a621={'method':_0x7580('0xa9'),'uri':_0x1c3bd6+_0x7580('0xbd')+_0x1f8f5c,'auth':_0x500073,'json':!![]};return rp(_0x40a621)[_0x7580('0x1d')](function(_0x5d2f19){var _0x372606=[];if(_0x5d2f19['result'][_0x7580('0x3e')]>0x0){_0x5d2f19[_0x7580('0xbe')][_0x7580('0xaf')](function(_0x5f0d9b){if(_0x5f0d9b['inactive']===_0x7580('0xbf')){var _0x2073e7={'name':_0x5f0d9b[_0x7580('0xb1')],'value':_0x5f0d9b[_0x7580('0xc0')]};_0x372606[_0x7580('0xb2')](_0x2073e7);}});}_0x476dad[_0x7580('0x54')]=_0x372606;if(_0x476dad[_0x7580('0x54')][_0x7580('0x3e')]>0x0){_0x1326ad(_0x476dad);}else{if(_0x385c93==![]){_0x1326ad();}else{_0x1326ad(_0x476dad);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 84661b1..5ac1571 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 _0x2d17=['ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','request-promise','path','../../config/environment','../../components/integrations/configuration'];(function(_0x3c6a7b,_0x5c561b){var _0x350944=function(_0x59a35b){while(--_0x59a35b){_0x3c6a7b['push'](_0x3c6a7b['shift']());}};_0x350944(++_0x5c561b);}(_0x2d17,0x17e));var _0x72d1=function(_0x4da74e,_0x50dbb3){_0x4da74e=_0x4da74e-0x0;var _0x2188cf=_0x2d17[_0x4da74e];return _0x2188cf;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var logger=require('../../config/logger')(_0x72d1('0x2'));var moment=require(_0x72d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d1('0x4'));var fs=require('fs');var path=require(_0x72d1('0x5'));var rimraf=require('rimraf');var config=require(_0x72d1('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x72d1('0x7'));module['exports']=function(_0x139ba0,_0x239d1f){return _0x139ba0['define'](_0x72d1('0x8'),attributes,{'tableName':_0x72d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5178=['rimraf','../../config/environment','../../components/integrations/configuration','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x201d56,_0x5a6902){var _0x15ab25=function(_0x52d6dd){while(--_0x52d6dd){_0x201d56['push'](_0x201d56['shift']());}};_0x15ab25(++_0x5a6902);}(_0x5178,0x171));var _0x8517=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5178[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x8517('0x0'));var logger=require(_0x8517('0x1'))(_0x8517('0x2'));var moment=require(_0x8517('0x3'));var BPromise=require(_0x8517('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x8517('0x7'));module['exports']=function(_0x13ba05,_0x45498e){return _0x13ba05[_0x8517('0x8')](_0x8517('0x9'),attributes,{'tableName':_0x8517('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 0c4db7c..0335cad 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 _0x3a29=['message','info','request\x20sent','result','catch','options','raw','attributes','include','map','model','GetServicenowAccount','ShowServicenowAccount','ServicenowAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3bd26a,_0x37c34d){var _0x40a154=function(_0xf494c5){while(--_0xf494c5){_0x3bd26a['push'](_0x3bd26a['shift']());}};_0x40a154(++_0x37c34d);}(_0x3a29,0x185));var _0x93a2=function(_0x2fe6fa,_0x4f2c02){_0x2fe6fa=_0x2fe6fa-0x0;var _0x4fce31=_0x3a29[_0x2fe6fa];return _0x4fce31;};'use strict';var _=require(_0x93a2('0x0'));var util=require(_0x93a2('0x1'));var moment=require(_0x93a2('0x2'));var BPromise=require(_0x93a2('0x3'));var rs=require(_0x93a2('0x4'));var fs=require('fs');var Redis=require(_0x93a2('0x5'));var db=require(_0x93a2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x93a2('0x7'))('rpc');var config=require(_0x93a2('0x8'));var jayson=require(_0x93a2('0x9'));var client=jayson[_0x93a2('0xa')][_0x93a2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f0651,_0x49b305,_0x9332ea){return new BPromise(function(_0x265cd7,_0x3d9d51){return client[_0x93a2('0xc')](_0x3f0651,_0x9332ea)[_0x93a2('0xd')](function(_0x21d950){logger['info'](_0x93a2('0xe'),_0x49b305,'request\x20sent');logger[_0x93a2('0xf')](_0x93a2('0x10'),_0x49b305,'request\x20sent',JSON['stringify'](_0x21d950));if(_0x21d950['error']){if(_0x21d950[_0x93a2('0x11')][_0x93a2('0x12')]===0x1f4){logger[_0x93a2('0x11')](_0x93a2('0xe'),_0x49b305,_0x21d950[_0x93a2('0x11')][_0x93a2('0x13')]);return _0x3d9d51(_0x21d950['error']['message']);}logger[_0x93a2('0x11')](_0x93a2('0xe'),_0x49b305,_0x21d950[_0x93a2('0x11')][_0x93a2('0x13')]);return _0x265cd7(_0x21d950[_0x93a2('0x11')][_0x93a2('0x13')]);}else{logger[_0x93a2('0x14')](_0x93a2('0xe'),_0x49b305,_0x93a2('0x15'));_0x265cd7(_0x21d950[_0x93a2('0x16')][_0x93a2('0x13')]);}})[_0x93a2('0x17')](function(_0x362ec6){logger[_0x93a2('0x11')](_0x93a2('0xe'),_0x49b305,_0x362ec6);_0x3d9d51(_0x362ec6);});});}exports['GetServicenowAccount']=function(_0x4a33ba){var _0x3f86e2=this;return new Promise(function(_0x119cef,_0x10e923){return db['ServicenowAccount']['findAll']({'raw':_0x4a33ba[_0x93a2('0x18')]?_0x4a33ba['options'][_0x93a2('0x19')]===undefined?!![]:![]:!![],'where':_0x4a33ba[_0x93a2('0x18')]?_0x4a33ba['options']['where']||null:null,'attributes':_0x4a33ba['options']?_0x4a33ba['options'][_0x93a2('0x1a')]||null:null,'limit':_0x4a33ba[_0x93a2('0x18')]?_0x4a33ba['options']['limit']||null:null,'include':_0x4a33ba[_0x93a2('0x18')]?_0x4a33ba['options'][_0x93a2('0x1b')]?_['map'](_0x4a33ba[_0x93a2('0x18')][_0x93a2('0x1b')],function(_0x1946b8){return{'model':db[_0x1946b8['model']],'as':_0x1946b8['as'],'attributes':_0x1946b8['attributes'],'include':_0x1946b8[_0x93a2('0x1b')]?_[_0x93a2('0x1c')](_0x1946b8[_0x93a2('0x1b')],function(_0x39d422){return{'model':db[_0x39d422[_0x93a2('0x1d')]],'as':_0x39d422['as'],'attributes':_0x39d422[_0x93a2('0x1a')],'include':_0x39d422['include']?_[_0x93a2('0x1c')](_0x39d422[_0x93a2('0x1b')],function(_0x2ea1ee){return{'model':db[_0x2ea1ee[_0x93a2('0x1d')]],'as':_0x2ea1ee['as'],'attributes':_0x2ea1ee[_0x93a2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x93a2('0xd')](function(_0x12c850){logger[_0x93a2('0x14')](_0x93a2('0x1e'),_0x4a33ba);logger['debug']('GetServicenowAccount',_0x4a33ba,JSON['stringify'](_0x12c850));_0x119cef(_0x12c850);})[_0x93a2('0x17')](function(_0x1318f8){logger[_0x93a2('0x11')](_0x93a2('0x1e'),_0x1318f8[_0x93a2('0x13')],_0x4a33ba);_0x10e923(_0x3f86e2[_0x93a2('0x11')](0x1f4,_0x1318f8[_0x93a2('0x13')]));});});};exports[_0x93a2('0x1f')]=function(_0x2fb730){var _0x39091f=this;return new Promise(function(_0x552685,_0x308bec){return db[_0x93a2('0x20')][_0x93a2('0x21')]({'raw':_0x2fb730[_0x93a2('0x18')]?_0x2fb730[_0x93a2('0x18')][_0x93a2('0x19')]===undefined?!![]:![]:!![],'where':_0x2fb730[_0x93a2('0x18')]?_0x2fb730[_0x93a2('0x18')]['where']||null:null,'attributes':_0x2fb730['options']?_0x2fb730[_0x93a2('0x18')][_0x93a2('0x1a')]||null:null,'include':_0x2fb730['options']?_0x2fb730[_0x93a2('0x18')][_0x93a2('0x1b')]?_[_0x93a2('0x1c')](_0x2fb730['options'][_0x93a2('0x1b')],function(_0x3d44d8){return{'model':db[_0x3d44d8[_0x93a2('0x1d')]],'as':_0x3d44d8['as'],'attributes':_0x3d44d8[_0x93a2('0x1a')],'include':_0x3d44d8[_0x93a2('0x1b')]?_[_0x93a2('0x1c')](_0x3d44d8['include'],function(_0xe76894){return{'model':db[_0xe76894[_0x93a2('0x1d')]],'as':_0xe76894['as'],'attributes':_0xe76894[_0x93a2('0x1a')],'include':_0xe76894[_0x93a2('0x1b')]?_[_0x93a2('0x1c')](_0xe76894[_0x93a2('0x1b')],function(_0x1fee0b){return{'model':db[_0x1fee0b['model']],'as':_0x1fee0b['as'],'attributes':_0x1fee0b['attributes']};}):[]};}):[]};}):[]:[]})[_0x93a2('0xd')](function(_0x5d6792){logger[_0x93a2('0x14')]('ShowServicenowAccount',_0x2fb730);logger[_0x93a2('0xf')]('ShowServicenowAccount',_0x2fb730,JSON['stringify'](_0x5d6792));_0x552685(_0x5d6792);})['catch'](function(_0x355685){logger[_0x93a2('0x11')](_0x93a2('0x1f'),_0x355685[_0x93a2('0x13')],_0x2fb730);_0x308bec(_0x39091f[_0x93a2('0x11')](0x1f4,_0x355685[_0x93a2('0x13')]));});});}; \ No newline at end of file +var _0xb0ff=['randomstring','../../config/utils','rpc','../../config/environment','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','findAll','options','raw','where','attributes','include','map','model','GetServicenowAccount','stringify','catch','ShowServicenowAccount','find','lodash','moment','bluebird'];(function(_0x1dda84,_0x3ae4cb){var _0x3cb62d=function(_0x42f525){while(--_0x42f525){_0x1dda84['push'](_0x1dda84['shift']());}};_0x3cb62d(++_0x3ae4cb);}(_0xb0ff,0xd6));var _0xfb0f=function(_0x2682fe,_0x4fe106){_0x2682fe=_0x2682fe-0x0;var _0x2dc372=_0xb0ff[_0x2682fe];return _0x2dc372;};'use strict';var _=require(_0xfb0f('0x0'));var util=require('util');var moment=require(_0xfb0f('0x1'));var BPromise=require(_0xfb0f('0x2'));var rs=require(_0xfb0f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfb0f('0x4'));var logger=require('../../config/logger')(_0xfb0f('0x5'));var config=require(_0xfb0f('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfb0f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x471c68,_0x8c0254,_0x44eea3){return new BPromise(function(_0x1c9425,_0x206aed){return client[_0xfb0f('0x8')](_0x471c68,_0x44eea3)[_0xfb0f('0x9')](function(_0x1b5d5e){logger[_0xfb0f('0xa')](_0xfb0f('0xb'),_0x8c0254,_0xfb0f('0xc'));logger[_0xfb0f('0xd')](_0xfb0f('0xe'),_0x8c0254,_0xfb0f('0xc'),JSON['stringify'](_0x1b5d5e));if(_0x1b5d5e[_0xfb0f('0xf')]){if(_0x1b5d5e[_0xfb0f('0xf')][_0xfb0f('0x10')]===0x1f4){logger['error'](_0xfb0f('0xb'),_0x8c0254,_0x1b5d5e[_0xfb0f('0xf')][_0xfb0f('0x11')]);return _0x206aed(_0x1b5d5e[_0xfb0f('0xf')][_0xfb0f('0x11')]);}logger[_0xfb0f('0xf')]('ServicenowAccount,\x20%s,\x20%s',_0x8c0254,_0x1b5d5e[_0xfb0f('0xf')][_0xfb0f('0x11')]);return _0x1c9425(_0x1b5d5e['error'][_0xfb0f('0x11')]);}else{logger[_0xfb0f('0xa')]('ServicenowAccount,\x20%s,\x20%s',_0x8c0254,_0xfb0f('0xc'));_0x1c9425(_0x1b5d5e['result'][_0xfb0f('0x11')]);}})['catch'](function(_0x37c412){logger[_0xfb0f('0xf')](_0xfb0f('0xb'),_0x8c0254,_0x37c412);_0x206aed(_0x37c412);});});}exports['GetServicenowAccount']=function(_0x170c0d){var _0x125a82=this;return new Promise(function(_0x16672e,_0x217647){return db['ServicenowAccount'][_0xfb0f('0x12')]({'raw':_0x170c0d[_0xfb0f('0x13')]?_0x170c0d[_0xfb0f('0x13')][_0xfb0f('0x14')]===undefined?!![]:![]:!![],'where':_0x170c0d[_0xfb0f('0x13')]?_0x170c0d[_0xfb0f('0x13')][_0xfb0f('0x15')]||null:null,'attributes':_0x170c0d[_0xfb0f('0x13')]?_0x170c0d[_0xfb0f('0x13')][_0xfb0f('0x16')]||null:null,'limit':_0x170c0d[_0xfb0f('0x13')]?_0x170c0d['options']['limit']||null:null,'include':_0x170c0d['options']?_0x170c0d[_0xfb0f('0x13')][_0xfb0f('0x17')]?_[_0xfb0f('0x18')](_0x170c0d['options']['include'],function(_0x3f7008){return{'model':db[_0x3f7008[_0xfb0f('0x19')]],'as':_0x3f7008['as'],'attributes':_0x3f7008['attributes'],'include':_0x3f7008[_0xfb0f('0x17')]?_[_0xfb0f('0x18')](_0x3f7008[_0xfb0f('0x17')],function(_0x3a8fc5){return{'model':db[_0x3a8fc5['model']],'as':_0x3a8fc5['as'],'attributes':_0x3a8fc5[_0xfb0f('0x16')],'include':_0x3a8fc5['include']?_[_0xfb0f('0x18')](_0x3a8fc5[_0xfb0f('0x17')],function(_0x396937){return{'model':db[_0x396937[_0xfb0f('0x19')]],'as':_0x396937['as'],'attributes':_0x396937[_0xfb0f('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfb0f('0x9')](function(_0x1813e2){logger[_0xfb0f('0xa')]('GetServicenowAccount',_0x170c0d);logger['debug'](_0xfb0f('0x1a'),_0x170c0d,JSON[_0xfb0f('0x1b')](_0x1813e2));_0x16672e(_0x1813e2);})[_0xfb0f('0x1c')](function(_0x31b7fe){logger['error'](_0xfb0f('0x1a'),_0x31b7fe[_0xfb0f('0x11')],_0x170c0d);_0x217647(_0x125a82[_0xfb0f('0xf')](0x1f4,_0x31b7fe[_0xfb0f('0x11')]));});});};exports[_0xfb0f('0x1d')]=function(_0xbcc5cc){var _0x2cc57e=this;return new Promise(function(_0x360143,_0x293916){return db['ServicenowAccount'][_0xfb0f('0x1e')]({'raw':_0xbcc5cc[_0xfb0f('0x13')]?_0xbcc5cc['options']['raw']===undefined?!![]:![]:!![],'where':_0xbcc5cc['options']?_0xbcc5cc[_0xfb0f('0x13')]['where']||null:null,'attributes':_0xbcc5cc[_0xfb0f('0x13')]?_0xbcc5cc[_0xfb0f('0x13')]['attributes']||null:null,'include':_0xbcc5cc['options']?_0xbcc5cc[_0xfb0f('0x13')]['include']?_[_0xfb0f('0x18')](_0xbcc5cc[_0xfb0f('0x13')][_0xfb0f('0x17')],function(_0x2fb21c){return{'model':db[_0x2fb21c[_0xfb0f('0x19')]],'as':_0x2fb21c['as'],'attributes':_0x2fb21c['attributes'],'include':_0x2fb21c[_0xfb0f('0x17')]?_['map'](_0x2fb21c['include'],function(_0x253eac){return{'model':db[_0x253eac['model']],'as':_0x253eac['as'],'attributes':_0x253eac[_0xfb0f('0x16')],'include':_0x253eac['include']?_[_0xfb0f('0x18')](_0x253eac[_0xfb0f('0x17')],function(_0x1fb000){return{'model':db[_0x1fb000[_0xfb0f('0x19')]],'as':_0x1fb000['as'],'attributes':_0x1fb000[_0xfb0f('0x16')]};}):[]};}):[]};}):[]:[]})[_0xfb0f('0x9')](function(_0x456648){logger['info']('ShowServicenowAccount',_0xbcc5cc);logger[_0xfb0f('0xd')](_0xfb0f('0x1d'),_0xbcc5cc,JSON[_0xfb0f('0x1b')](_0x456648));_0x360143(_0x456648);})[_0xfb0f('0x1c')](function(_0xa87fe9){logger[_0xfb0f('0xf')](_0xfb0f('0x1d'),_0xa87fe9[_0xfb0f('0x11')],_0xbcc5cc);_0x293916(_0x2cc57e[_0xfb0f('0xf')](0x1f4,_0xa87fe9['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 01c5df6..2906929 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 _0xd645=['../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','multer','path','connect-timeout','Router'];(function(_0x45ba3d,_0x5c9be4){var _0x359ea6=function(_0x3c9da1){while(--_0x3c9da1){_0x45ba3d['push'](_0x45ba3d['shift']());}};_0x359ea6(++_0x5c9be4);}(_0xd645,0xcb));var _0x5d64=function(_0x40aa25,_0x5b92d1){_0x40aa25=_0x40aa25-0x0;var _0x43f972=_0xd645[_0x40aa25];return _0x43f972;};'use strict';var multer=require(_0x5d64('0x0'));var util=require('util');var path=require(_0x5d64('0x1'));var timeout=require(_0x5d64('0x2'));var express=require('express');var router=express[_0x5d64('0x3')]();var auth=require(_0x5d64('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5d64('0x5'));var controller=require(_0x5d64('0x6'));router[_0x5d64('0x7')]('/',auth[_0x5d64('0x8')](),controller[_0x5d64('0x9')]);router['get'](_0x5d64('0xa'),auth[_0x5d64('0x8')](),controller[_0x5d64('0xb')]);router[_0x5d64('0x7')](_0x5d64('0xc'),auth[_0x5d64('0x8')](),controller[_0x5d64('0xd')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x5d64('0xe')]);router[_0x5d64('0x7')](_0x5d64('0xf'),auth[_0x5d64('0x8')](),controller[_0x5d64('0x10')]);router[_0x5d64('0x11')]('/',auth['isAuthenticated'](),controller[_0x5d64('0x12')]);router[_0x5d64('0x13')]('/:id',auth[_0x5d64('0x8')](),controller[_0x5d64('0x14')]);router[_0x5d64('0x15')](_0x5d64('0xa'),auth[_0x5d64('0x8')](),controller[_0x5d64('0x16')]);module['exports']=router; \ No newline at end of file +var _0x520f=['/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index'];(function(_0x43be03,_0x3f4dc3){var _0x6aabf9=function(_0xb24702){while(--_0xb24702){_0x43be03['push'](_0x43be03['shift']());}};_0x6aabf9(++_0x3f4dc3);}(_0x520f,0xf9));var _0xf520=function(_0x30505b,_0x3b6c06){_0x30505b=_0x30505b-0x0;var _0x4f7466=_0x520f[_0x30505b];return _0x4f7466;};'use strict';var multer=require(_0xf520('0x0'));var util=require(_0xf520('0x1'));var path=require('path');var timeout=require(_0xf520('0x2'));var express=require('express');var router=express[_0xf520('0x3')]();var auth=require(_0xf520('0x4'));var interaction=require(_0xf520('0x5'));var config=require(_0xf520('0x6'));var controller=require(_0xf520('0x7'));router[_0xf520('0x8')]('/',auth[_0xf520('0x9')](),controller[_0xf520('0xa')]);router['get'](_0xf520('0xb'),auth[_0xf520('0x9')](),controller['show']);router[_0xf520('0x8')](_0xf520('0xc'),auth[_0xf520('0x9')](),controller[_0xf520('0xd')]);router[_0xf520('0x8')](_0xf520('0xe'),auth[_0xf520('0x9')](),controller['getSubjects']);router[_0xf520('0x8')](_0xf520('0xf'),auth[_0xf520('0x9')](),controller[_0xf520('0x10')]);router[_0xf520('0x11')]('/',auth[_0xf520('0x9')](),controller[_0xf520('0x12')]);router['put'](_0xf520('0xb'),auth[_0xf520('0x9')](),controller[_0xf520('0x13')]);router['delete']('/:id',auth[_0xf520('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 29e6f26..f544869 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 _0xa0b2=['sequelize','exports','STRING'];(function(_0x562463,_0x28c932){var _0x1430d7=function(_0x3a9cb9){while(--_0x3a9cb9){_0x562463['push'](_0x562463['shift']());}};_0x1430d7(++_0x28c932);}(_0xa0b2,0xea));var _0x2a0b=function(_0x53b8e0,_0x55d46e){_0x53b8e0=_0x53b8e0-0x0;var _0x10630c=_0xa0b2[_0x53b8e0];return _0x10630c;};'use strict';var Sequelize=require(_0x2a0b('0x0'));module[_0x2a0b('0x1')]={'name':{'type':Sequelize[_0x2a0b('0x2')]},'description':{'type':Sequelize[_0x2a0b('0x2')]}}; \ No newline at end of file +var _0xec0c=['exports'];(function(_0x3f14ed,_0x51b3c4){var _0x37d329=function(_0xdbeed){while(--_0xdbeed){_0x3f14ed['push'](_0x3f14ed['shift']());}};_0x37d329(++_0x51b3c4);}(_0xec0c,0x9c));var _0xcec0=function(_0x2657e0,_0x391a4c){_0x2657e0=_0x2657e0-0x0;var _0x2d1f0e=_0xec0c[_0x2657e0];return _0x2d1f0e;};'use strict';var Sequelize=require('sequelize');module[_0xcec0('0x0')]={'name':{'type':Sequelize['STRING']},'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 9b028bc..a7e9717 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 _0x2214=['error','code','message','info','result','catch','status','end','count','offset','json','reject','save','update','then','sendStatus','stack','name','send','index','ServicenowConfiguration','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','find','create','body','destroy','getFields','findOne','ServicenowField','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','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','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x539fb2,_0x5b6718){var _0x4d583d=function(_0x55fa69){while(--_0x55fa69){_0x539fb2['push'](_0x539fb2['shift']());}};_0x4d583d(++_0x5b6718);}(_0x2214,0xf7));var _0x4221=function(_0x49e1f5,_0x951f5f){_0x49e1f5=_0x49e1f5-0x0;var _0x14a6d6=_0x2214[_0x49e1f5];return _0x14a6d6;};'use strict';var pdf=require(_0x4221('0x0'));var emlformat=require(_0x4221('0x1'));var rimraf=require(_0x4221('0x2'));var zipdir=require(_0x4221('0x3'));var jsonpatch=require(_0x4221('0x4'));var rp=require(_0x4221('0x5'));var moment=require(_0x4221('0x6'));var BPromise=require(_0x4221('0x7'));var Mustache=require(_0x4221('0x8'));var util=require('util');var path=require(_0x4221('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4221('0xa'));var fs=require('fs');var _=require(_0x4221('0xb'));var squel=require(_0x4221('0xc'));var crypto=require(_0x4221('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4221('0xe'));var toCsv=require(_0x4221('0xf'));var querystring=require(_0x4221('0x10'));var Papa=require(_0x4221('0x11'));var Redis=require(_0x4221('0x12'));var authService=require(_0x4221('0x13'));var qs=require(_0x4221('0x14'));var as=require(_0x4221('0x15'));var hardwareService=require(_0x4221('0x16'));var logger=require(_0x4221('0x17'))(_0x4221('0x18'));var utils=require(_0x4221('0x19'));var config=require(_0x4221('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4221('0x1b'));var client=jayson['client'][_0x4221('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x2405bc,_0x4992f3,_0x11a9b0){if(_0x11a9b0){var _0x89d4e1=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x89d4e1[_0x4221('0x1d')](_0x4992f3)){return _0x2405bc;}else{throw new db[(_0x4221('0x1e'))][(_0x4221('0x1f'))](_0x4221('0x20'));}}else{return _0x2405bc;}}function respondWithRpcPromise(_0xb22699,_0x3a0c0d,_0x550cde,_0x1fc89a){return new BPromise(function(_0x35bf1d,_0x5dab0c){var _0x4341ad=_0x1fc89a||client;return _0x4341ad[_0x4221('0x21')](_0xb22699,_0x550cde)['then'](function(_0x2bcf16){logger['info'](_0x4221('0x22'),_0x3a0c0d,_0x4221('0x23'));logger[_0x4221('0x24')](_0x4221('0x25'),_0x3a0c0d,_0x4221('0x23'),JSON['stringify'](_0x2bcf16));if(_0x2bcf16[_0x4221('0x26')]){if(_0x2bcf16[_0x4221('0x26')][_0x4221('0x27')]===0x1f4){logger[_0x4221('0x26')](_0x4221('0x22'),_0x3a0c0d,_0x2bcf16[_0x4221('0x26')][_0x4221('0x28')]);return _0x5dab0c(_0x2bcf16[_0x4221('0x26')][_0x4221('0x28')]);}logger[_0x4221('0x26')](_0x4221('0x22'),_0x3a0c0d,_0x2bcf16['error']['message']);return _0x35bf1d(_0x2bcf16[_0x4221('0x26')][_0x4221('0x28')]);}else{logger[_0x4221('0x29')](_0x4221('0x22'),_0x3a0c0d,_0x4221('0x23'));_0x35bf1d(_0x2bcf16[_0x4221('0x2a')][_0x4221('0x28')]);}})[_0x4221('0x2b')](function(_0xceb8ce){logger[_0x4221('0x26')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3a0c0d,_0xceb8ce);_0x5dab0c(_0xceb8ce);});});}function respondWithStatusCode(_0x2f3f43,_0x417f8c){_0x417f8c=_0x417f8c||0xcc;return function(_0x3c1624){if(_0x3c1624){return _0x2f3f43['sendStatus'](_0x417f8c);}return _0x2f3f43[_0x4221('0x2c')](_0x417f8c)[_0x4221('0x2d')]();};}function respondWithResult(_0x3e24e5,_0x5a31d1){_0x5a31d1=_0x5a31d1||0xc8;return function(_0x48a999){if(_0x48a999){return _0x3e24e5[_0x4221('0x2c')](_0x5a31d1)['json'](_0x48a999);}};}function respondWithFilteredResult(_0x44bdbb,_0x1af858){return function(_0x540972){if(_0x540972){var _0x4cc7d0=_0x540972[_0x4221('0x2e')],_0x1707e0=_0x1af858[_0x4221('0x2f')],_0x13889f=_0x1af858['offset']+_0x1af858['limit'],_0x33d7ec;if(_0x13889f>=_0x4cc7d0){_0x13889f=_0x4cc7d0;_0x33d7ec=0xc8;}else{_0x33d7ec=0xce;}_0x44bdbb['status'](_0x33d7ec);return _0x44bdbb['set']('Content-Range',_0x1707e0+'-'+_0x13889f+'/'+_0x4cc7d0)[_0x4221('0x30')](_0x540972);}return null;};}function patchUpdates(_0x158649){return function(_0x1d1bb1){try{jsonpatch['apply'](_0x1d1bb1,_0x158649,!![]);}catch(_0x5e67c1){return BPromise[_0x4221('0x31')](_0x5e67c1);}return _0x1d1bb1[_0x4221('0x32')]();};}function saveUpdates(_0xf2f910,_0xde2af2){return function(_0x4eeead){if(_0x4eeead){return _0x4eeead[_0x4221('0x33')](_0xf2f910)[_0x4221('0x34')](function(_0x21c829){return _0x21c829;});}return null;};}function removeEntity(_0x2cbe31,_0x353ecc){return function(_0x5f52bc){if(_0x5f52bc){return _0x5f52bc['destroy']()[_0x4221('0x34')](function(){_0x2cbe31[_0x4221('0x2c')](0xcc)[_0x4221('0x2d')]();});}};}function handleEntityNotFound(_0x3b95b8,_0x34fe15){return function(_0x40be7b){if(!_0x40be7b){_0x3b95b8[_0x4221('0x35')](0x194);}return _0x40be7b;};}function handleError(_0x222fde,_0x4f8304){_0x4f8304=_0x4f8304||0x1f4;return function(_0x43fd71){logger[_0x4221('0x26')](_0x43fd71[_0x4221('0x36')]);if(_0x43fd71[_0x4221('0x37')]){delete _0x43fd71[_0x4221('0x37')];}_0x222fde[_0x4221('0x2c')](_0x4f8304)[_0x4221('0x38')](_0x43fd71);};}exports[_0x4221('0x39')]=function(_0x17a703,_0x4b2991){var _0x45a2ee={},_0x58aeea={},_0x275d2a={'count':0x0,'rows':[]};var _0x4e3e5d=_['map'](db[_0x4221('0x3a')][_0x4221('0x3b')],function(_0x182b42){return{'name':_0x182b42['fieldName'],'type':_0x182b42[_0x4221('0x3c')][_0x4221('0x3d')]};});_0x58aeea[_0x4221('0x3e')]=_[_0x4221('0x3f')](_0x4e3e5d,_0x4221('0x37'));_0x58aeea['query']=_[_0x4221('0x40')](_0x17a703[_0x4221('0x41')]);_0x58aeea[_0x4221('0x42')]=_[_0x4221('0x43')](_0x58aeea[_0x4221('0x3e')],_0x58aeea[_0x4221('0x41')]);_0x45a2ee[_0x4221('0x44')]=_['intersection'](_0x58aeea[_0x4221('0x3e')],qs[_0x4221('0x45')](_0x17a703['query']['fields']));_0x45a2ee[_0x4221('0x44')]=_0x45a2ee[_0x4221('0x44')][_0x4221('0x46')]?_0x45a2ee[_0x4221('0x44')]:_0x58aeea[_0x4221('0x3e')];if(!_0x17a703[_0x4221('0x41')][_0x4221('0x47')](_0x4221('0x48'))){_0x45a2ee['limit']=qs[_0x4221('0x49')](_0x17a703[_0x4221('0x41')][_0x4221('0x49')]);_0x45a2ee[_0x4221('0x2f')]=qs[_0x4221('0x2f')](_0x17a703[_0x4221('0x41')]['offset']);}_0x45a2ee[_0x4221('0x4a')]=qs[_0x4221('0x4b')](_0x17a703[_0x4221('0x41')][_0x4221('0x4b')]);_0x45a2ee[_0x4221('0x4c')]=qs['filters'](_[_0x4221('0x4d')](_0x17a703[_0x4221('0x41')],_0x58aeea[_0x4221('0x42')]));if(_0x17a703[_0x4221('0x41')][_0x4221('0x4e')]){_0x45a2ee[_0x4221('0x4c')]=_[_0x4221('0x4f')](_0x45a2ee['where'],{'$or':_[_0x4221('0x3f')](_0x4e3e5d,function(_0x448185){if(_0x448185[_0x4221('0x3c')]!==_0x4221('0x50')){var _0x5efa02={};_0x5efa02[_0x448185[_0x4221('0x37')]]={'$like':'%'+_0x17a703['query'][_0x4221('0x4e')]+'%'};return _0x5efa02;}})});}_0x45a2ee=_[_0x4221('0x4f')]({},_0x45a2ee,_0x17a703[_0x4221('0x51')]);var _0x63465c={'where':_0x45a2ee[_0x4221('0x4c')]};return db[_0x4221('0x3a')][_0x4221('0x2e')](_0x63465c)[_0x4221('0x34')](function(_0x543947){_0x275d2a[_0x4221('0x2e')]=_0x543947;if(_0x17a703['query'][_0x4221('0x52')]){_0x45a2ee[_0x4221('0x53')]=[{'all':!![]}];}return db[_0x4221('0x3a')]['findAll'](_0x45a2ee);})[_0x4221('0x34')](function(_0x46c2aa){_0x275d2a[_0x4221('0x54')]=_0x46c2aa;return _0x275d2a;})[_0x4221('0x34')](respondWithFilteredResult(_0x4b2991,_0x45a2ee))[_0x4221('0x2b')](handleError(_0x4b2991,null));};exports['show']=function(_0x1adacd,_0x590e25){var _0x2011ea={'raw':![],'where':{'id':_0x1adacd[_0x4221('0x55')]['id']}},_0xed3896={};_0xed3896['model']=_[_0x4221('0x40')](db[_0x4221('0x3a')][_0x4221('0x3b')]);_0xed3896[_0x4221('0x41')]=_['keys'](_0x1adacd['query']);_0xed3896[_0x4221('0x42')]=_['intersection'](_0xed3896[_0x4221('0x3e')],_0xed3896[_0x4221('0x41')]);_0x2011ea[_0x4221('0x44')]=_[_0x4221('0x43')](_0xed3896['model'],qs[_0x4221('0x45')](_0x1adacd['query'][_0x4221('0x45')]));_0x2011ea[_0x4221('0x44')]=_0x2011ea[_0x4221('0x44')][_0x4221('0x46')]?_0x2011ea[_0x4221('0x44')]:_0xed3896[_0x4221('0x3e')];if(_0x1adacd[_0x4221('0x41')][_0x4221('0x52')]){_0x2011ea['include']=[{'all':!![]}];}_0x2011ea=_['merge']({},_0x2011ea,_0x1adacd[_0x4221('0x51')]);return db[_0x4221('0x3a')][_0x4221('0x56')](_0x2011ea)['then'](handleEntityNotFound(_0x590e25,null))[_0x4221('0x34')](respondWithResult(_0x590e25,null))[_0x4221('0x2b')](handleError(_0x590e25,null));};exports[_0x4221('0x57')]=function(_0x2cdb76,_0x54a119){return db[_0x4221('0x3a')][_0x4221('0x57')](_0x2cdb76[_0x4221('0x58')],{})['then'](respondWithResult(_0x54a119,0xc9))[_0x4221('0x2b')](handleError(_0x54a119,null));};exports[_0x4221('0x33')]=function(_0x3380ec,_0x47d7e9){if(_0x3380ec['body']['id']){delete _0x3380ec[_0x4221('0x58')]['id'];}return db['ServicenowConfiguration'][_0x4221('0x56')]({'where':{'id':_0x3380ec[_0x4221('0x55')]['id']}})['then'](handleEntityNotFound(_0x47d7e9,null))[_0x4221('0x34')](saveUpdates(_0x3380ec[_0x4221('0x58')],null))[_0x4221('0x34')](respondWithResult(_0x47d7e9,null))[_0x4221('0x2b')](handleError(_0x47d7e9,null));};exports[_0x4221('0x59')]=function(_0x284908,_0x47911a){return db[_0x4221('0x3a')][_0x4221('0x56')]({'where':{'id':_0x284908[_0x4221('0x55')]['id']}})['then'](handleEntityNotFound(_0x47911a,null))['then'](removeEntity(_0x47911a,null))[_0x4221('0x2b')](handleError(_0x47911a,null));};exports[_0x4221('0x5a')]=function(_0x25c44e,_0x2cdf55,_0x5cfe5e){var _0x4ae09c={};var _0x29c078={};var _0xe5c743;var _0x3d3c08;return db['ServicenowConfiguration'][_0x4221('0x5b')]({'where':{'id':_0x25c44e[_0x4221('0x55')]['id']}})['then'](handleEntityNotFound(_0x2cdf55,null))[_0x4221('0x34')](function(_0x545556){if(_0x545556){_0xe5c743=_0x545556;_0x29c078[_0x4221('0x3e')]=_[_0x4221('0x40')](db[_0x4221('0x5c')][_0x4221('0x3b')]);_0x29c078['query']=_['keys'](_0x25c44e[_0x4221('0x41')]);_0x29c078[_0x4221('0x42')]=_[_0x4221('0x43')](_0x29c078[_0x4221('0x3e')],_0x29c078[_0x4221('0x41')]);_0x4ae09c[_0x4221('0x44')]=_[_0x4221('0x43')](_0x29c078[_0x4221('0x3e')],qs[_0x4221('0x45')](_0x25c44e[_0x4221('0x41')][_0x4221('0x45')]));_0x4ae09c[_0x4221('0x44')]=_0x4ae09c['attributes'][_0x4221('0x46')]?_0x4ae09c[_0x4221('0x44')]:_0x29c078['model'];_0x4ae09c[_0x4221('0x4a')]=qs[_0x4221('0x4b')](_0x25c44e[_0x4221('0x41')][_0x4221('0x4b')]);_0x4ae09c[_0x4221('0x4c')]=qs[_0x4221('0x42')](_[_0x4221('0x4d')](_0x25c44e[_0x4221('0x41')],_0x29c078[_0x4221('0x42')]));if(_0x25c44e[_0x4221('0x41')][_0x4221('0x4e')]){_0x4ae09c[_0x4221('0x4c')]=_[_0x4221('0x4f')](_0x4ae09c[_0x4221('0x4c')],{'$or':_['map'](_0x4ae09c[_0x4221('0x44')],function(_0x4106e0){var _0xb81c6c={};_0xb81c6c[_0x4106e0]={'$like':'%'+_0x25c44e['query']['filter']+'%'};return _0xb81c6c;})});}_0x4ae09c=_[_0x4221('0x4f')]({},_0x4ae09c,_0x25c44e[_0x4221('0x51')]);return _0xe5c743[_0x4221('0x5a')](_0x4ae09c);}})[_0x4221('0x34')](function(_0x522be2){if(_0x522be2){_0x3d3c08=_0x522be2[_0x4221('0x46')];if(!_0x25c44e[_0x4221('0x41')][_0x4221('0x47')](_0x4221('0x48'))){_0x4ae09c[_0x4221('0x49')]=qs[_0x4221('0x49')](_0x25c44e[_0x4221('0x41')]['limit']);_0x4ae09c[_0x4221('0x2f')]=qs[_0x4221('0x2f')](_0x25c44e[_0x4221('0x41')][_0x4221('0x2f')]);}return _0xe5c743[_0x4221('0x5a')](_0x4ae09c);}})[_0x4221('0x34')](function(_0x373a9a){if(_0x373a9a){return _0x373a9a?{'count':_0x3d3c08,'rows':_0x373a9a}:null;}})[_0x4221('0x34')](respondWithResult(_0x2cdf55,null))[_0x4221('0x2b')](handleError(_0x2cdf55,null));};exports['getSubjects']=function(_0x1001d5,_0x421103,_0x3f4e4f){var _0x53cc50={};var _0x4d024b={};var _0xe265a4;var _0x63d187;return db[_0x4221('0x3a')][_0x4221('0x5b')]({'where':{'id':_0x1001d5[_0x4221('0x55')]['id']}})[_0x4221('0x34')](handleEntityNotFound(_0x421103,null))['then'](function(_0x46684a){if(_0x46684a){_0xe265a4=_0x46684a;_0x4d024b[_0x4221('0x3e')]=_[_0x4221('0x40')](db[_0x4221('0x5c')]['rawAttributes']);_0x4d024b[_0x4221('0x41')]=_[_0x4221('0x40')](_0x1001d5[_0x4221('0x41')]);_0x4d024b[_0x4221('0x42')]=_['intersection'](_0x4d024b['model'],_0x4d024b[_0x4221('0x41')]);_0x53cc50[_0x4221('0x44')]=_['intersection'](_0x4d024b[_0x4221('0x3e')],qs[_0x4221('0x45')](_0x1001d5['query']['fields']));_0x53cc50[_0x4221('0x44')]=_0x53cc50[_0x4221('0x44')][_0x4221('0x46')]?_0x53cc50['attributes']:_0x4d024b['model'];_0x53cc50['order']=qs[_0x4221('0x4b')](_0x1001d5[_0x4221('0x41')][_0x4221('0x4b')]);_0x53cc50['where']=qs[_0x4221('0x42')](_[_0x4221('0x4d')](_0x1001d5[_0x4221('0x41')],_0x4d024b[_0x4221('0x42')]));if(_0x1001d5[_0x4221('0x41')][_0x4221('0x4e')]){_0x53cc50['where']=_[_0x4221('0x4f')](_0x53cc50[_0x4221('0x4c')],{'$or':_['map'](_0x53cc50[_0x4221('0x44')],function(_0x460530){var _0x18b188={};_0x18b188[_0x460530]={'$like':'%'+_0x1001d5[_0x4221('0x41')][_0x4221('0x4e')]+'%'};return _0x18b188;})});}_0x53cc50=_['merge']({},_0x53cc50,_0x1001d5[_0x4221('0x51')]);return _0xe265a4[_0x4221('0x5d')](_0x53cc50);}})[_0x4221('0x34')](function(_0x1113a0){if(_0x1113a0){_0x63d187=_0x1113a0[_0x4221('0x46')];if(!_0x1001d5[_0x4221('0x41')][_0x4221('0x47')](_0x4221('0x48'))){_0x53cc50[_0x4221('0x49')]=qs['limit'](_0x1001d5['query'][_0x4221('0x49')]);_0x53cc50[_0x4221('0x2f')]=qs['offset'](_0x1001d5[_0x4221('0x41')][_0x4221('0x2f')]);}return _0xe265a4[_0x4221('0x5d')](_0x53cc50);}})[_0x4221('0x34')](function(_0x400c07){if(_0x400c07){return _0x400c07?{'count':_0x63d187,'rows':_0x400c07}:null;}})['then'](respondWithResult(_0x421103,null))[_0x4221('0x2b')](handleError(_0x421103,null));};exports[_0x4221('0x5e')]=function(_0x4b1b6f,_0x15308b,_0x4719ec){var _0x4181a6={};var _0x42bba8={};var _0x4170b1;var _0x201475;return db[_0x4221('0x3a')][_0x4221('0x5b')]({'where':{'id':_0x4b1b6f['params']['id']}})['then'](handleEntityNotFound(_0x15308b,null))['then'](function(_0x2080b0){if(_0x2080b0){_0x4170b1=_0x2080b0;_0x42bba8['model']=_[_0x4221('0x40')](db[_0x4221('0x5c')][_0x4221('0x3b')]);_0x42bba8[_0x4221('0x41')]=_[_0x4221('0x40')](_0x4b1b6f[_0x4221('0x41')]);_0x42bba8[_0x4221('0x42')]=_[_0x4221('0x43')](_0x42bba8[_0x4221('0x3e')],_0x42bba8[_0x4221('0x41')]);_0x4181a6[_0x4221('0x44')]=_['intersection'](_0x42bba8['model'],qs['fields'](_0x4b1b6f[_0x4221('0x41')]['fields']));_0x4181a6[_0x4221('0x44')]=_0x4181a6['attributes'][_0x4221('0x46')]?_0x4181a6[_0x4221('0x44')]:_0x42bba8[_0x4221('0x3e')];_0x4181a6[_0x4221('0x4a')]=qs[_0x4221('0x4b')](_0x4b1b6f[_0x4221('0x41')][_0x4221('0x4b')]);_0x4181a6['where']=qs[_0x4221('0x42')](_[_0x4221('0x4d')](_0x4b1b6f[_0x4221('0x41')],_0x42bba8['filters']));if(_0x4b1b6f[_0x4221('0x41')][_0x4221('0x4e')]){_0x4181a6['where']=_[_0x4221('0x4f')](_0x4181a6['where'],{'$or':_[_0x4221('0x3f')](_0x4181a6['attributes'],function(_0xcf7ea8){var _0x1f1a3a={};_0x1f1a3a[_0xcf7ea8]={'$like':'%'+_0x4b1b6f[_0x4221('0x41')][_0x4221('0x4e')]+'%'};return _0x1f1a3a;})});}_0x4181a6=_['merge']({},_0x4181a6,_0x4b1b6f[_0x4221('0x51')]);return _0x4170b1[_0x4221('0x5e')](_0x4181a6);}})[_0x4221('0x34')](function(_0xf10e0b){if(_0xf10e0b){_0x201475=_0xf10e0b[_0x4221('0x46')];if(!_0x4b1b6f[_0x4221('0x41')][_0x4221('0x47')](_0x4221('0x48'))){_0x4181a6[_0x4221('0x49')]=qs[_0x4221('0x49')](_0x4b1b6f[_0x4221('0x41')][_0x4221('0x49')]);_0x4181a6[_0x4221('0x2f')]=qs[_0x4221('0x2f')](_0x4b1b6f[_0x4221('0x41')][_0x4221('0x2f')]);}return _0x4170b1[_0x4221('0x5e')](_0x4181a6);}})[_0x4221('0x34')](function(_0x4353cd){if(_0x4353cd){return _0x4353cd?{'count':_0x201475,'rows':_0x4353cd}:null;}})[_0x4221('0x34')](respondWithResult(_0x15308b,null))[_0x4221('0x2b')](handleError(_0x15308b,null));}; \ No newline at end of file +var _0x62f0=['create','body','findOne','keys','ServicenowField','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','moment','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowConfiguration','includeAll','include','findAll','rows','show','params','length','find'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x62f0,0x67));var _0x062f=function(_0x56085e,_0x5c69e9){_0x56085e=_0x56085e-0x0;var _0x4de130=_0x62f0[_0x56085e];return _0x4de130;};'use strict';var pdf=require(_0x062f('0x0'));var emlformat=require(_0x062f('0x1'));var rimraf=require(_0x062f('0x2'));var zipdir=require(_0x062f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x062f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x062f('0x5'));var sox=require(_0x062f('0x6'));var csv=require('to-csv');var ejs=require(_0x062f('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x062f('0x8'));var crypto=require(_0x062f('0x9'));var jsforce=require(_0x062f('0xa'));var deskjs=require(_0x062f('0xb'));var toCsv=require(_0x062f('0xc'));var querystring=require(_0x062f('0xd'));var Papa=require(_0x062f('0xe'));var Redis=require(_0x062f('0xf'));var authService=require(_0x062f('0x10'));var qs=require(_0x062f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x062f('0x12'));var logger=require(_0x062f('0x13'))(_0x062f('0x14'));var utils=require(_0x062f('0x15'));var config=require(_0x062f('0x16'));var db=require(_0x062f('0x17'))['db'];var jayson=require(_0x062f('0x18'));var client=jayson[_0x062f('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x32bae9,_0x1bd148,_0x25a933){if(_0x25a933){var _0x3a89a0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3a89a0[_0x062f('0x1a')](_0x1bd148)){return _0x32bae9;}else{throw new db['Sequelize'][(_0x062f('0x1b'))](_0x062f('0x1c'));}}else{return _0x32bae9;}}function respondWithRpcPromise(_0x291d70,_0x5ec273,_0x3b7c96,_0x2ddb74){return new BPromise(function(_0x5dd6bc,_0x50399a){var _0x335b24=_0x2ddb74||client;return _0x335b24[_0x062f('0x1d')](_0x291d70,_0x3b7c96)[_0x062f('0x1e')](function(_0x57c190){logger['info'](_0x062f('0x1f'),_0x5ec273,_0x062f('0x20'));logger[_0x062f('0x21')](_0x062f('0x22'),_0x5ec273,_0x062f('0x20'),JSON[_0x062f('0x23')](_0x57c190));if(_0x57c190[_0x062f('0x24')]){if(_0x57c190['error'][_0x062f('0x25')]===0x1f4){logger['error'](_0x062f('0x1f'),_0x5ec273,_0x57c190[_0x062f('0x24')][_0x062f('0x26')]);return _0x50399a(_0x57c190['error'][_0x062f('0x26')]);}logger[_0x062f('0x24')](_0x062f('0x1f'),_0x5ec273,_0x57c190[_0x062f('0x24')][_0x062f('0x26')]);return _0x5dd6bc(_0x57c190[_0x062f('0x24')][_0x062f('0x26')]);}else{logger[_0x062f('0x27')](_0x062f('0x1f'),_0x5ec273,_0x062f('0x20'));_0x5dd6bc(_0x57c190[_0x062f('0x28')][_0x062f('0x26')]);}})[_0x062f('0x29')](function(_0x5733c9){logger['error'](_0x062f('0x1f'),_0x5ec273,_0x5733c9);_0x50399a(_0x5733c9);});});}function respondWithStatusCode(_0xf61c11,_0x406234){_0x406234=_0x406234||0xcc;return function(_0x14f1f1){if(_0x14f1f1){return _0xf61c11[_0x062f('0x2a')](_0x406234);}return _0xf61c11[_0x062f('0x2b')](_0x406234)[_0x062f('0x2c')]();};}function respondWithResult(_0x52daba,_0x446a32){_0x446a32=_0x446a32||0xc8;return function(_0x3a4747){if(_0x3a4747){return _0x52daba[_0x062f('0x2b')](_0x446a32)[_0x062f('0x2d')](_0x3a4747);}};}function respondWithFilteredResult(_0x27c0c7,_0x4d1504){return function(_0x42fa9d){if(_0x42fa9d){var _0x36bf18=_0x42fa9d[_0x062f('0x2e')],_0x22ce8e=_0x4d1504['offset'],_0x35e4e2=_0x4d1504[_0x062f('0x2f')]+_0x4d1504[_0x062f('0x30')],_0x1c562d;if(_0x35e4e2>=_0x36bf18){_0x35e4e2=_0x36bf18;_0x1c562d=0xc8;}else{_0x1c562d=0xce;}_0x27c0c7[_0x062f('0x2b')](_0x1c562d);return _0x27c0c7[_0x062f('0x31')]('Content-Range',_0x22ce8e+'-'+_0x35e4e2+'/'+_0x36bf18)[_0x062f('0x2d')](_0x42fa9d);}return null;};}function patchUpdates(_0x4feb0f){return function(_0x421d04){try{jsonpatch[_0x062f('0x32')](_0x421d04,_0x4feb0f,!![]);}catch(_0x4c63a6){return BPromise[_0x062f('0x33')](_0x4c63a6);}return _0x421d04[_0x062f('0x34')]();};}function saveUpdates(_0x56d148,_0x42e565){return function(_0x15bbef){if(_0x15bbef){return _0x15bbef[_0x062f('0x35')](_0x56d148)['then'](function(_0xdd8a36){return _0xdd8a36;});}return null;};}function removeEntity(_0x5c907e,_0x2a9a9f){return function(_0x1e40f9){if(_0x1e40f9){return _0x1e40f9[_0x062f('0x36')]()['then'](function(){_0x5c907e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb966d0,_0x531bb6){return function(_0x6f04f5){if(!_0x6f04f5){_0xb966d0[_0x062f('0x2a')](0x194);}return _0x6f04f5;};}function handleError(_0x345566,_0x10d489){_0x10d489=_0x10d489||0x1f4;return function(_0x2e15ee){logger['error'](_0x2e15ee[_0x062f('0x37')]);if(_0x2e15ee[_0x062f('0x38')]){delete _0x2e15ee[_0x062f('0x38')];}_0x345566[_0x062f('0x2b')](_0x10d489)[_0x062f('0x39')](_0x2e15ee);};}exports[_0x062f('0x3a')]=function(_0x59179a,_0x56d388){var _0x501965={},_0x49768b={},_0x27f055={'count':0x0,'rows':[]};var _0x1fc0a9=_[_0x062f('0x3b')](db['ServicenowConfiguration'][_0x062f('0x3c')],function(_0x53a496){return{'name':_0x53a496[_0x062f('0x3d')],'type':_0x53a496['type']['key']};});_0x49768b['model']=_[_0x062f('0x3b')](_0x1fc0a9,_0x062f('0x38'));_0x49768b['query']=_['keys'](_0x59179a[_0x062f('0x3e')]);_0x49768b[_0x062f('0x3f')]=_[_0x062f('0x40')](_0x49768b[_0x062f('0x41')],_0x49768b['query']);_0x501965[_0x062f('0x42')]=_[_0x062f('0x40')](_0x49768b[_0x062f('0x41')],qs[_0x062f('0x43')](_0x59179a[_0x062f('0x3e')][_0x062f('0x43')]));_0x501965['attributes']=_0x501965[_0x062f('0x42')]['length']?_0x501965[_0x062f('0x42')]:_0x49768b['model'];if(!_0x59179a[_0x062f('0x3e')][_0x062f('0x44')](_0x062f('0x45'))){_0x501965['limit']=qs['limit'](_0x59179a['query'][_0x062f('0x30')]);_0x501965[_0x062f('0x2f')]=qs['offset'](_0x59179a[_0x062f('0x3e')][_0x062f('0x2f')]);}_0x501965[_0x062f('0x46')]=qs[_0x062f('0x47')](_0x59179a[_0x062f('0x3e')][_0x062f('0x47')]);_0x501965[_0x062f('0x48')]=qs[_0x062f('0x3f')](_[_0x062f('0x49')](_0x59179a[_0x062f('0x3e')],_0x49768b[_0x062f('0x3f')]));if(_0x59179a[_0x062f('0x3e')][_0x062f('0x4a')]){_0x501965[_0x062f('0x48')]=_[_0x062f('0x4b')](_0x501965[_0x062f('0x48')],{'$or':_[_0x062f('0x3b')](_0x1fc0a9,function(_0x54dccf){if(_0x54dccf['type']!==_0x062f('0x4c')){var _0x230d11={};_0x230d11[_0x54dccf[_0x062f('0x38')]]={'$like':'%'+_0x59179a[_0x062f('0x3e')][_0x062f('0x4a')]+'%'};return _0x230d11;}})});}_0x501965=_[_0x062f('0x4b')]({},_0x501965,_0x59179a[_0x062f('0x4d')]);var _0x1a6365={'where':_0x501965['where']};return db[_0x062f('0x4e')][_0x062f('0x2e')](_0x1a6365)['then'](function(_0x23f682){_0x27f055[_0x062f('0x2e')]=_0x23f682;if(_0x59179a[_0x062f('0x3e')][_0x062f('0x4f')]){_0x501965[_0x062f('0x50')]=[{'all':!![]}];}return db[_0x062f('0x4e')][_0x062f('0x51')](_0x501965);})[_0x062f('0x1e')](function(_0x23ee7a){_0x27f055[_0x062f('0x52')]=_0x23ee7a;return _0x27f055;})['then'](respondWithFilteredResult(_0x56d388,_0x501965))['catch'](handleError(_0x56d388,null));};exports[_0x062f('0x53')]=function(_0x2ee74c,_0x4fffad){var _0x56ecac={'raw':![],'where':{'id':_0x2ee74c[_0x062f('0x54')]['id']}},_0x1cc499={};_0x1cc499[_0x062f('0x41')]=_['keys'](db[_0x062f('0x4e')][_0x062f('0x3c')]);_0x1cc499[_0x062f('0x3e')]=_['keys'](_0x2ee74c[_0x062f('0x3e')]);_0x1cc499[_0x062f('0x3f')]=_['intersection'](_0x1cc499[_0x062f('0x41')],_0x1cc499['query']);_0x56ecac['attributes']=_[_0x062f('0x40')](_0x1cc499['model'],qs[_0x062f('0x43')](_0x2ee74c[_0x062f('0x3e')][_0x062f('0x43')]));_0x56ecac[_0x062f('0x42')]=_0x56ecac[_0x062f('0x42')][_0x062f('0x55')]?_0x56ecac[_0x062f('0x42')]:_0x1cc499[_0x062f('0x41')];if(_0x2ee74c[_0x062f('0x3e')]['includeAll']){_0x56ecac['include']=[{'all':!![]}];}_0x56ecac=_[_0x062f('0x4b')]({},_0x56ecac,_0x2ee74c[_0x062f('0x4d')]);return db['ServicenowConfiguration'][_0x062f('0x56')](_0x56ecac)[_0x062f('0x1e')](handleEntityNotFound(_0x4fffad,null))[_0x062f('0x1e')](respondWithResult(_0x4fffad,null))['catch'](handleError(_0x4fffad,null));};exports['create']=function(_0x2ef330,_0x22b348){return db[_0x062f('0x4e')][_0x062f('0x57')](_0x2ef330['body'],{})[_0x062f('0x1e')](respondWithResult(_0x22b348,0xc9))[_0x062f('0x29')](handleError(_0x22b348,null));};exports[_0x062f('0x35')]=function(_0x1f5872,_0x39b85c){if(_0x1f5872[_0x062f('0x58')]['id']){delete _0x1f5872['body']['id'];}return db[_0x062f('0x4e')][_0x062f('0x56')]({'where':{'id':_0x1f5872[_0x062f('0x54')]['id']}})['then'](handleEntityNotFound(_0x39b85c,null))[_0x062f('0x1e')](saveUpdates(_0x1f5872['body'],null))[_0x062f('0x1e')](respondWithResult(_0x39b85c,null))[_0x062f('0x29')](handleError(_0x39b85c,null));};exports[_0x062f('0x36')]=function(_0x84a977,_0x3bcd88){return db['ServicenowConfiguration'][_0x062f('0x56')]({'where':{'id':_0x84a977[_0x062f('0x54')]['id']}})[_0x062f('0x1e')](handleEntityNotFound(_0x3bcd88,null))['then'](removeEntity(_0x3bcd88,null))[_0x062f('0x29')](handleError(_0x3bcd88,null));};exports['getFields']=function(_0x454543,_0x37e89c,_0x334ae8){var _0x44ea81={};var _0x4a20da={};var _0x2dc9b3;var _0x252486;return db[_0x062f('0x4e')][_0x062f('0x59')]({'where':{'id':_0x454543['params']['id']}})[_0x062f('0x1e')](handleEntityNotFound(_0x37e89c,null))['then'](function(_0x346d46){if(_0x346d46){_0x2dc9b3=_0x346d46;_0x4a20da[_0x062f('0x41')]=_[_0x062f('0x5a')](db[_0x062f('0x5b')][_0x062f('0x3c')]);_0x4a20da[_0x062f('0x3e')]=_[_0x062f('0x5a')](_0x454543[_0x062f('0x3e')]);_0x4a20da[_0x062f('0x3f')]=_[_0x062f('0x40')](_0x4a20da[_0x062f('0x41')],_0x4a20da[_0x062f('0x3e')]);_0x44ea81[_0x062f('0x42')]=_[_0x062f('0x40')](_0x4a20da['model'],qs['fields'](_0x454543[_0x062f('0x3e')][_0x062f('0x43')]));_0x44ea81[_0x062f('0x42')]=_0x44ea81[_0x062f('0x42')][_0x062f('0x55')]?_0x44ea81[_0x062f('0x42')]:_0x4a20da[_0x062f('0x41')];_0x44ea81[_0x062f('0x46')]=qs[_0x062f('0x47')](_0x454543[_0x062f('0x3e')][_0x062f('0x47')]);_0x44ea81[_0x062f('0x48')]=qs['filters'](_[_0x062f('0x49')](_0x454543[_0x062f('0x3e')],_0x4a20da[_0x062f('0x3f')]));if(_0x454543[_0x062f('0x3e')][_0x062f('0x4a')]){_0x44ea81[_0x062f('0x48')]=_[_0x062f('0x4b')](_0x44ea81['where'],{'$or':_[_0x062f('0x3b')](_0x44ea81[_0x062f('0x42')],function(_0x1b280e){var _0x1b5911={};_0x1b5911[_0x1b280e]={'$like':'%'+_0x454543[_0x062f('0x3e')]['filter']+'%'};return _0x1b5911;})});}_0x44ea81=_[_0x062f('0x4b')]({},_0x44ea81,_0x454543[_0x062f('0x4d')]);return _0x2dc9b3[_0x062f('0x5c')](_0x44ea81);}})['then'](function(_0x17076c){if(_0x17076c){_0x252486=_0x17076c[_0x062f('0x55')];if(!_0x454543[_0x062f('0x3e')][_0x062f('0x44')](_0x062f('0x45'))){_0x44ea81[_0x062f('0x30')]=qs[_0x062f('0x30')](_0x454543['query'][_0x062f('0x30')]);_0x44ea81[_0x062f('0x2f')]=qs['offset'](_0x454543['query'][_0x062f('0x2f')]);}return _0x2dc9b3[_0x062f('0x5c')](_0x44ea81);}})[_0x062f('0x1e')](function(_0x56edae){if(_0x56edae){return _0x56edae?{'count':_0x252486,'rows':_0x56edae}:null;}})[_0x062f('0x1e')](respondWithResult(_0x37e89c,null))[_0x062f('0x29')](handleError(_0x37e89c,null));};exports[_0x062f('0x5d')]=function(_0x3d1aee,_0x31f45d,_0x156720){var _0x41379d={};var _0x4e9116={};var _0x57b478;var _0x5e764a;return db[_0x062f('0x4e')]['findOne']({'where':{'id':_0x3d1aee[_0x062f('0x54')]['id']}})[_0x062f('0x1e')](handleEntityNotFound(_0x31f45d,null))[_0x062f('0x1e')](function(_0x51ca8b){if(_0x51ca8b){_0x57b478=_0x51ca8b;_0x4e9116[_0x062f('0x41')]=_['keys'](db[_0x062f('0x5b')][_0x062f('0x3c')]);_0x4e9116['query']=_[_0x062f('0x5a')](_0x3d1aee[_0x062f('0x3e')]);_0x4e9116['filters']=_[_0x062f('0x40')](_0x4e9116[_0x062f('0x41')],_0x4e9116[_0x062f('0x3e')]);_0x41379d[_0x062f('0x42')]=_[_0x062f('0x40')](_0x4e9116[_0x062f('0x41')],qs['fields'](_0x3d1aee[_0x062f('0x3e')]['fields']));_0x41379d['attributes']=_0x41379d[_0x062f('0x42')][_0x062f('0x55')]?_0x41379d[_0x062f('0x42')]:_0x4e9116[_0x062f('0x41')];_0x41379d[_0x062f('0x46')]=qs[_0x062f('0x47')](_0x3d1aee['query'][_0x062f('0x47')]);_0x41379d['where']=qs['filters'](_[_0x062f('0x49')](_0x3d1aee[_0x062f('0x3e')],_0x4e9116[_0x062f('0x3f')]));if(_0x3d1aee['query'][_0x062f('0x4a')]){_0x41379d[_0x062f('0x48')]=_[_0x062f('0x4b')](_0x41379d[_0x062f('0x48')],{'$or':_[_0x062f('0x3b')](_0x41379d[_0x062f('0x42')],function(_0x4f6aaf){var _0x16693e={};_0x16693e[_0x4f6aaf]={'$like':'%'+_0x3d1aee[_0x062f('0x3e')][_0x062f('0x4a')]+'%'};return _0x16693e;})});}_0x41379d=_['merge']({},_0x41379d,_0x3d1aee[_0x062f('0x4d')]);return _0x57b478[_0x062f('0x5d')](_0x41379d);}})[_0x062f('0x1e')](function(_0x3e8777){if(_0x3e8777){_0x5e764a=_0x3e8777['length'];if(!_0x3d1aee[_0x062f('0x3e')][_0x062f('0x44')](_0x062f('0x45'))){_0x41379d[_0x062f('0x30')]=qs['limit'](_0x3d1aee['query'][_0x062f('0x30')]);_0x41379d[_0x062f('0x2f')]=qs[_0x062f('0x2f')](_0x3d1aee[_0x062f('0x3e')][_0x062f('0x2f')]);}return _0x57b478['getSubjects'](_0x41379d);}})['then'](function(_0x529d8f){if(_0x529d8f){return _0x529d8f?{'count':_0x5e764a,'rows':_0x529d8f}:null;}})[_0x062f('0x1e')](respondWithResult(_0x31f45d,null))[_0x062f('0x29')](handleError(_0x31f45d,null));};exports[_0x062f('0x5e')]=function(_0x2da0e5,_0x18a72c,_0x300989){var _0x41d626={};var _0x43d3ad={};var _0x18cc52;var _0x556ab5;return db[_0x062f('0x4e')][_0x062f('0x59')]({'where':{'id':_0x2da0e5['params']['id']}})['then'](handleEntityNotFound(_0x18a72c,null))[_0x062f('0x1e')](function(_0x1c98d8){if(_0x1c98d8){_0x18cc52=_0x1c98d8;_0x43d3ad[_0x062f('0x41')]=_['keys'](db[_0x062f('0x5b')][_0x062f('0x3c')]);_0x43d3ad[_0x062f('0x3e')]=_['keys'](_0x2da0e5[_0x062f('0x3e')]);_0x43d3ad[_0x062f('0x3f')]=_[_0x062f('0x40')](_0x43d3ad[_0x062f('0x41')],_0x43d3ad[_0x062f('0x3e')]);_0x41d626['attributes']=_[_0x062f('0x40')](_0x43d3ad[_0x062f('0x41')],qs['fields'](_0x2da0e5['query'][_0x062f('0x43')]));_0x41d626['attributes']=_0x41d626['attributes'][_0x062f('0x55')]?_0x41d626[_0x062f('0x42')]:_0x43d3ad['model'];_0x41d626[_0x062f('0x46')]=qs[_0x062f('0x47')](_0x2da0e5[_0x062f('0x3e')][_0x062f('0x47')]);_0x41d626[_0x062f('0x48')]=qs['filters'](_['pick'](_0x2da0e5[_0x062f('0x3e')],_0x43d3ad['filters']));if(_0x2da0e5[_0x062f('0x3e')][_0x062f('0x4a')]){_0x41d626[_0x062f('0x48')]=_[_0x062f('0x4b')](_0x41d626['where'],{'$or':_[_0x062f('0x3b')](_0x41d626['attributes'],function(_0x189789){var _0x3cf090={};_0x3cf090[_0x189789]={'$like':'%'+_0x2da0e5[_0x062f('0x3e')][_0x062f('0x4a')]+'%'};return _0x3cf090;})});}_0x41d626=_[_0x062f('0x4b')]({},_0x41d626,_0x2da0e5['options']);return _0x18cc52['getDescriptions'](_0x41d626);}})[_0x062f('0x1e')](function(_0xd02f36){if(_0xd02f36){_0x556ab5=_0xd02f36[_0x062f('0x55')];if(!_0x2da0e5['query'][_0x062f('0x44')](_0x062f('0x45'))){_0x41d626[_0x062f('0x30')]=qs[_0x062f('0x30')](_0x2da0e5[_0x062f('0x3e')][_0x062f('0x30')]);_0x41d626[_0x062f('0x2f')]=qs[_0x062f('0x2f')](_0x2da0e5[_0x062f('0x3e')]['offset']);}return _0x18cc52[_0x062f('0x5e')](_0x41d626);}})['then'](function(_0x1a787f){if(_0x1a787f){return _0x1a787f?{'count':_0x556ab5,'rows':_0x1a787f}:null;}})['then'](respondWithResult(_0x18a72c,null))['catch'](handleError(_0x18a72c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 1e11a74..4244b4d 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 _0xe68a=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','lodash'];(function(_0x254957,_0x10c53b){var _0x1ef53b=function(_0x2d40a4){while(--_0x2d40a4){_0x254957['push'](_0x254957['shift']());}};_0x1ef53b(++_0x10c53b);}(_0xe68a,0x185));var _0xae68=function(_0x1699e9,_0x1f2652){_0x1699e9=_0x1699e9-0x0;var _0x14b104=_0xe68a[_0x1699e9];return _0x14b104;};'use strict';var _=require(_0xae68('0x0'));var util=require(_0xae68('0x1'));var logger=require(_0xae68('0x2'))(_0xae68('0x3'));var moment=require('moment');var BPromise=require(_0xae68('0x4'));var rp=require(_0xae68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae68('0x6'));var config=require(_0xae68('0x7'));var attributes=require(_0xae68('0x8'));module[_0xae68('0x9')]=function(_0x42db59,_0x4e7df0){return _0x42db59['define']('ServicenowConfiguration',attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9be=['int_servicenow_configurations','lodash','api','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration'];(function(_0xf05891,_0x5327e6){var _0x190faa=function(_0x2c3608){while(--_0x2c3608){_0xf05891['push'](_0xf05891['shift']());}};_0x190faa(++_0x5327e6);}(_0xc9be,0x79));var _0xec9b=function(_0x5c7f18,_0x26b7b9){_0x5c7f18=_0x5c7f18-0x0;var _0x1eea0e=_0xc9be[_0x5c7f18];return _0x1eea0e;};'use strict';var _=require(_0xec9b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xec9b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xec9b('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec9b('0x3'));var config=require(_0xec9b('0x4'));var attributes=require(_0xec9b('0x5'));module[_0xec9b('0x6')]=function(_0x2e8c54,_0x182f97){return _0x2e8c54[_0xec9b('0x7')](_0xec9b('0x8'),attributes,{'tableName':_0xec9b('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 a9057f9..03375e7 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 _0xa2d7=['error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','request','then','info','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5a10b7,_0x1279c7){var _0x5e07ae=function(_0x2f3feb){while(--_0x2f3feb){_0x5a10b7['push'](_0x5a10b7['shift']());}};_0x5e07ae(++_0x1279c7);}(_0xa2d7,0x84));var _0x7a2d=function(_0x221db8,_0x1788f9){_0x221db8=_0x221db8-0x0;var _0x3a20d6=_0xa2d7[_0x221db8];return _0x3a20d6;};'use strict';var _=require('lodash');var util=require(_0x7a2d('0x0'));var moment=require(_0x7a2d('0x1'));var BPromise=require(_0x7a2d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7a2d('0x3'));var logger=require(_0x7a2d('0x4'))('rpc');var config=require(_0x7a2d('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a6647,_0x23a8ed,_0x3ef4b0){return new BPromise(function(_0x3eda34,_0x358fe0){return client[_0x7a2d('0x6')](_0x3a6647,_0x3ef4b0)[_0x7a2d('0x7')](function(_0x2ee9ee){logger[_0x7a2d('0x8')]('ServicenowConfiguration,\x20%s,\x20%s',_0x23a8ed,_0x7a2d('0x9'));logger['debug'](_0x7a2d('0xa'),_0x23a8ed,_0x7a2d('0x9'),JSON[_0x7a2d('0xb')](_0x2ee9ee));if(_0x2ee9ee['error']){if(_0x2ee9ee[_0x7a2d('0xc')][_0x7a2d('0xd')]===0x1f4){logger[_0x7a2d('0xc')](_0x7a2d('0xe'),_0x23a8ed,_0x2ee9ee['error'][_0x7a2d('0xf')]);return _0x358fe0(_0x2ee9ee[_0x7a2d('0xc')][_0x7a2d('0xf')]);}logger[_0x7a2d('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x23a8ed,_0x2ee9ee[_0x7a2d('0xc')][_0x7a2d('0xf')]);return _0x3eda34(_0x2ee9ee['error'][_0x7a2d('0xf')]);}else{logger[_0x7a2d('0x8')]('ServicenowConfiguration,\x20%s,\x20%s',_0x23a8ed,_0x7a2d('0x9'));_0x3eda34(_0x2ee9ee[_0x7a2d('0x10')][_0x7a2d('0xf')]);}})[_0x7a2d('0x11')](function(_0x49ab8a){logger[_0x7a2d('0xc')](_0x7a2d('0xe'),_0x23a8ed,_0x49ab8a);_0x358fe0(_0x49ab8a);});});} \ No newline at end of file +var _0x8a52=['result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x12da7a,_0xbee425){var _0x3d35c0=function(_0x18df47){while(--_0x18df47){_0x12da7a['push'](_0x12da7a['shift']());}};_0x3d35c0(++_0xbee425);}(_0x8a52,0x1ba));var _0x28a5=function(_0x10176a,_0x4f643f){_0x10176a=_0x10176a-0x0;var _0x414dd0=_0x8a52[_0x10176a];return _0x414dd0;};'use strict';var _=require(_0x28a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x28a5('0x1'));var rs=require(_0x28a5('0x2'));var fs=require('fs');var Redis=require(_0x28a5('0x3'));var db=require(_0x28a5('0x4'))['db'];var utils=require(_0x28a5('0x5'));var logger=require(_0x28a5('0x6'))(_0x28a5('0x7'));var config=require('../../config/environment');var jayson=require(_0x28a5('0x8'));var client=jayson[_0x28a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe2ce,_0x49ee2e,_0x3f9a35){return new BPromise(function(_0x2457aa,_0x58368a){return client[_0x28a5('0xa')](_0x3fe2ce,_0x3f9a35)[_0x28a5('0xb')](function(_0x39c282){logger[_0x28a5('0xc')](_0x28a5('0xd'),_0x49ee2e,'request\x20sent');logger['debug'](_0x28a5('0xe'),_0x49ee2e,_0x28a5('0xf'),JSON[_0x28a5('0x10')](_0x39c282));if(_0x39c282['error']){if(_0x39c282[_0x28a5('0x11')][_0x28a5('0x12')]===0x1f4){logger[_0x28a5('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x49ee2e,_0x39c282[_0x28a5('0x11')][_0x28a5('0x13')]);return _0x58368a(_0x39c282[_0x28a5('0x11')][_0x28a5('0x13')]);}logger['error'](_0x28a5('0xd'),_0x49ee2e,_0x39c282['error'][_0x28a5('0x13')]);return _0x2457aa(_0x39c282['error'][_0x28a5('0x13')]);}else{logger[_0x28a5('0xc')](_0x28a5('0xd'),_0x49ee2e,_0x28a5('0xf'));_0x2457aa(_0x39c282[_0x28a5('0x14')][_0x28a5('0x13')]);}})['catch'](function(_0x53dbdd){logger[_0x28a5('0x11')](_0x28a5('0xd'),_0x49ee2e,_0x53dbdd);_0x58368a(_0x53dbdd);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 1336a36..bfcd334 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 _0xef9f=['put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x58f4cb,_0x31734c){var _0x48d432=function(_0x3f986f){while(--_0x3f986f){_0x58f4cb['push'](_0x58f4cb['shift']());}};_0x48d432(++_0x31734c);}(_0xef9f,0x145));var _0xfef9=function(_0x2a2b0e,_0x1f7010){_0x2a2b0e=_0x2a2b0e-0x0;var _0xab91d7=_0xef9f[_0x2a2b0e];return _0xab91d7;};'use strict';var multer=require(_0xfef9('0x0'));var util=require(_0xfef9('0x1'));var path=require(_0xfef9('0x2'));var timeout=require('connect-timeout');var express=require(_0xfef9('0x3'));var router=express[_0xfef9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfef9('0x5'));var config=require(_0xfef9('0x6'));var controller=require(_0xfef9('0x7'));router[_0xfef9('0x8')]('/',auth[_0xfef9('0x9')](),controller[_0xfef9('0xa')]);router[_0xfef9('0x8')](_0xfef9('0xb'),auth[_0xfef9('0x9')](),controller[_0xfef9('0xc')]);router[_0xfef9('0xd')]('/',auth[_0xfef9('0x9')](),controller[_0xfef9('0xe')]);router[_0xfef9('0xf')](_0xfef9('0xb'),auth[_0xfef9('0x9')](),controller[_0xfef9('0x10')]);router[_0xfef9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xfef9('0x12')]);module[_0xfef9('0x13')]=router; \ No newline at end of file +var _0x55d4=['update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intServicenowField.controller','index','get','/:id','show','post','isAuthenticated','create','put'];(function(_0x4dd12c,_0x1f544c){var _0x1d73c7=function(_0x242808){while(--_0x242808){_0x4dd12c['push'](_0x4dd12c['shift']());}};_0x1d73c7(++_0x1f544c);}(_0x55d4,0x15a));var _0x455d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x55d4[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require('multer');var util=require(_0x455d('0x0'));var path=require(_0x455d('0x1'));var timeout=require(_0x455d('0x2'));var express=require(_0x455d('0x3'));var router=express['Router']();var auth=require(_0x455d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x455d('0x5'));var controller=require(_0x455d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x455d('0x7')]);router[_0x455d('0x8')](_0x455d('0x9'),auth['isAuthenticated'](),controller[_0x455d('0xa')]);router[_0x455d('0xb')]('/',auth[_0x455d('0xc')](),controller[_0x455d('0xd')]);router[_0x455d('0xe')](_0x455d('0x9'),auth[_0x455d('0xc')](),controller[_0x455d('0xf')]);router[_0x455d('0x10')](_0x455d('0x9'),auth[_0x455d('0xc')](),controller[_0x455d('0x11')]);module[_0x455d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 5f6c242..db33612 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 _0x4fdc=['BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','STRING','variable'];(function(_0x140884,_0x509bc9){var _0x4f6531=function(_0xb5d391){while(--_0xb5d391){_0x140884['push'](_0x140884['shift']());}};_0x4f6531(++_0x509bc9);}(_0x4fdc,0xf9));var _0xc4fd=function(_0x2b8dac,_0x1a6488){_0x2b8dac=_0x2b8dac-0x0;var _0x4dbb56=_0x4fdc[_0x2b8dac];return _0x4dbb56;};'use strict';var Sequelize=require(_0xc4fd('0x0'));module[_0xc4fd('0x1')]={'type':{'type':Sequelize[_0xc4fd('0x2')]('string','variable',_0xc4fd('0x3'),_0xc4fd('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc4fd('0x5')]},'key':{'type':Sequelize[_0xc4fd('0x5')]},'keyType':{'type':Sequelize[_0xc4fd('0x2')]('string',_0xc4fd('0x6'),_0xc4fd('0x3'))},'keyContent':{'type':Sequelize[_0xc4fd('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc4fd('0x5')]},'customField':{'type':Sequelize[_0xc4fd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc4fd('0x5')]}}; \ No newline at end of file +var _0xb810=['customVariable','sequelize','exports','string','variable','keyValue','STRING','ENUM'];(function(_0x5b746b,_0xacfd8b){var _0x2e7fa3=function(_0x2e5c08){while(--_0x2e5c08){_0x5b746b['push'](_0x5b746b['shift']());}};_0x2e7fa3(++_0xacfd8b);}(_0xb810,0x1e9));var _0x0b81=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xb810[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x0b81('0x0'));module[_0x0b81('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0b81('0x2'),_0x0b81('0x3'),'customVariable',_0x0b81('0x4')),'defaultValue':_0x0b81('0x2')},'content':{'type':Sequelize[_0x0b81('0x5')]},'key':{'type':Sequelize[_0x0b81('0x5')]},'keyType':{'type':Sequelize[_0x0b81('0x6')]('string','variable',_0x0b81('0x7'))},'keyContent':{'type':Sequelize[_0x0b81('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0b81('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0b81('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 13017d6..ac2efd6 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 _0xc5dd=['order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','sendStatus','end','status','json','count','offset','limit','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','ServicenowField','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x40da2b,_0x4c8c73){var _0x122eb5=function(_0x2fc5f3){while(--_0x2fc5f3){_0x40da2b['push'](_0x40da2b['shift']());}};_0x122eb5(++_0x4c8c73);}(_0xc5dd,0x122));var _0xdc5d=function(_0x4ff448,_0x5cff72){_0x4ff448=_0x4ff448-0x0;var _0x224a01=_0xc5dd[_0x4ff448];return _0x224a01;};'use strict';var pdf=require(_0xdc5d('0x0'));var emlformat=require(_0xdc5d('0x1'));var rimraf=require(_0xdc5d('0x2'));var zipdir=require(_0xdc5d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdc5d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdc5d('0x5'));var path=require(_0xdc5d('0x6'));var sox=require(_0xdc5d('0x7'));var csv=require(_0xdc5d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdc5d('0x9'));var squel=require(_0xdc5d('0xa'));var crypto=require('crypto');var jsforce=require(_0xdc5d('0xb'));var deskjs=require(_0xdc5d('0xc'));var toCsv=require(_0xdc5d('0x8'));var querystring=require('querystring');var Papa=require(_0xdc5d('0xd'));var Redis=require(_0xdc5d('0xe'));var authService=require(_0xdc5d('0xf'));var qs=require(_0xdc5d('0x10'));var as=require(_0xdc5d('0x11'));var hardwareService=require(_0xdc5d('0x12'));var logger=require(_0xdc5d('0x13'))(_0xdc5d('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x484d9c,_0x12af0b){_0x12af0b=_0x12af0b||0xcc;return function(_0x38c259){if(_0x38c259){return _0x484d9c[_0xdc5d('0x15')](_0x12af0b);}return _0x484d9c['status'](_0x12af0b)[_0xdc5d('0x16')]();};}function respondWithResult(_0x1a8860,_0x4a7d4b){_0x4a7d4b=_0x4a7d4b||0xc8;return function(_0x156293){if(_0x156293){return _0x1a8860[_0xdc5d('0x17')](_0x4a7d4b)[_0xdc5d('0x18')](_0x156293);}};}function respondWithFilteredResult(_0x5d02e5,_0xbe0928){return function(_0x5bfe20){if(_0x5bfe20){var _0x41ed95=_0x5bfe20[_0xdc5d('0x19')],_0x4703d3=_0xbe0928[_0xdc5d('0x1a')],_0x305485=_0xbe0928['offset']+_0xbe0928[_0xdc5d('0x1b')],_0x5e1721;if(_0x305485>=_0x41ed95){_0x305485=_0x41ed95;_0x5e1721=0xc8;}else{_0x5e1721=0xce;}_0x5d02e5[_0xdc5d('0x17')](_0x5e1721);return _0x5d02e5[_0xdc5d('0x1c')](_0xdc5d('0x1d'),_0x4703d3+'-'+_0x305485+'/'+_0x41ed95)[_0xdc5d('0x18')](_0x5bfe20);}return null;};}function patchUpdates(_0x37ec48){return function(_0x11414d){try{jsonpatch['apply'](_0x11414d,_0x37ec48,!![]);}catch(_0x39e5fa){return BPromise['reject'](_0x39e5fa);}return _0x11414d[_0xdc5d('0x1e')]();};}function saveUpdates(_0x29ace8,_0x1e35ad){return function(_0x57ddb7){if(_0x57ddb7){return _0x57ddb7[_0xdc5d('0x1f')](_0x29ace8)[_0xdc5d('0x20')](function(_0x464d20){return _0x464d20;});}return null;};}function removeEntity(_0x10d01b,_0xb601ff){return function(_0x8dff3e){if(_0x8dff3e){return _0x8dff3e[_0xdc5d('0x21')]()[_0xdc5d('0x20')](function(){_0x10d01b['status'](0xcc)[_0xdc5d('0x16')]();});}};}function handleEntityNotFound(_0x1da3ca,_0x536c80){return function(_0x3d179a){if(!_0x3d179a){_0x1da3ca[_0xdc5d('0x15')](0x194);}return _0x3d179a;};}function handleError(_0x3a480b,_0x5792c1){_0x5792c1=_0x5792c1||0x1f4;return function(_0x41a32d){logger[_0xdc5d('0x22')](_0x41a32d[_0xdc5d('0x23')]);if(_0x41a32d[_0xdc5d('0x24')]){delete _0x41a32d[_0xdc5d('0x24')];}_0x3a480b[_0xdc5d('0x17')](_0x5792c1)['send'](_0x41a32d);};}exports[_0xdc5d('0x25')]=function(_0x10f3b8,_0x319b64){var _0x19922a={},_0x1f5ccf={},_0x465fdf={'count':0x0,'rows':[]};var _0x5afba4=_[_0xdc5d('0x26')](db[_0xdc5d('0x27')]['rawAttributes'],function(_0x32f8d4){return{'name':_0x32f8d4[_0xdc5d('0x28')],'type':_0x32f8d4[_0xdc5d('0x29')][_0xdc5d('0x2a')]};});_0x1f5ccf[_0xdc5d('0x2b')]=_[_0xdc5d('0x26')](_0x5afba4,_0xdc5d('0x24'));_0x1f5ccf[_0xdc5d('0x2c')]=_['keys'](_0x10f3b8[_0xdc5d('0x2c')]);_0x1f5ccf[_0xdc5d('0x2d')]=_['intersection'](_0x1f5ccf[_0xdc5d('0x2b')],_0x1f5ccf['query']);_0x19922a['attributes']=_[_0xdc5d('0x2e')](_0x1f5ccf['model'],qs[_0xdc5d('0x2f')](_0x10f3b8[_0xdc5d('0x2c')][_0xdc5d('0x2f')]));_0x19922a['attributes']=_0x19922a[_0xdc5d('0x30')]['length']?_0x19922a['attributes']:_0x1f5ccf[_0xdc5d('0x2b')];if(!_0x10f3b8[_0xdc5d('0x2c')][_0xdc5d('0x31')]('nolimit')){_0x19922a['limit']=qs[_0xdc5d('0x1b')](_0x10f3b8['query'][_0xdc5d('0x1b')]);_0x19922a[_0xdc5d('0x1a')]=qs['offset'](_0x10f3b8[_0xdc5d('0x2c')][_0xdc5d('0x1a')]);}_0x19922a[_0xdc5d('0x32')]=qs[_0xdc5d('0x33')](_0x10f3b8[_0xdc5d('0x2c')]['sort']);_0x19922a['where']=qs[_0xdc5d('0x2d')](_['pick'](_0x10f3b8['query'],_0x1f5ccf['filters']));if(_0x10f3b8[_0xdc5d('0x2c')][_0xdc5d('0x34')]){_0x19922a['where']=_[_0xdc5d('0x35')](_0x19922a[_0xdc5d('0x36')],{'$or':_[_0xdc5d('0x26')](_0x5afba4,function(_0x333019){if(_0x333019[_0xdc5d('0x29')]!==_0xdc5d('0x37')){var _0x365399={};_0x365399[_0x333019[_0xdc5d('0x24')]]={'$like':'%'+_0x10f3b8[_0xdc5d('0x2c')][_0xdc5d('0x34')]+'%'};return _0x365399;}})});}_0x19922a=_[_0xdc5d('0x35')]({},_0x19922a,_0x10f3b8[_0xdc5d('0x38')]);var _0x748e27={'where':_0x19922a[_0xdc5d('0x36')]};return db[_0xdc5d('0x27')][_0xdc5d('0x19')](_0x748e27)['then'](function(_0x4b01d9){_0x465fdf['count']=_0x4b01d9;if(_0x10f3b8[_0xdc5d('0x2c')][_0xdc5d('0x39')]){_0x19922a[_0xdc5d('0x3a')]=[{'all':!![]}];}return db[_0xdc5d('0x27')][_0xdc5d('0x3b')](_0x19922a);})['then'](function(_0xe2c743){_0x465fdf[_0xdc5d('0x3c')]=_0xe2c743;return _0x465fdf;})[_0xdc5d('0x20')](respondWithFilteredResult(_0x319b64,_0x19922a))[_0xdc5d('0x3d')](handleError(_0x319b64,null));};exports['show']=function(_0x59dfaa,_0x3c6bbc){var _0x4f2ae1={'raw':!![],'where':{'id':_0x59dfaa[_0xdc5d('0x3e')]['id']}},_0x62b9c4={};_0x62b9c4[_0xdc5d('0x2b')]=_[_0xdc5d('0x3f')](db[_0xdc5d('0x27')]['rawAttributes']);_0x62b9c4[_0xdc5d('0x2c')]=_[_0xdc5d('0x3f')](_0x59dfaa[_0xdc5d('0x2c')]);_0x62b9c4[_0xdc5d('0x2d')]=_[_0xdc5d('0x2e')](_0x62b9c4[_0xdc5d('0x2b')],_0x62b9c4[_0xdc5d('0x2c')]);_0x4f2ae1[_0xdc5d('0x30')]=_[_0xdc5d('0x2e')](_0x62b9c4[_0xdc5d('0x2b')],qs[_0xdc5d('0x2f')](_0x59dfaa[_0xdc5d('0x2c')][_0xdc5d('0x2f')]));_0x4f2ae1[_0xdc5d('0x30')]=_0x4f2ae1[_0xdc5d('0x30')][_0xdc5d('0x40')]?_0x4f2ae1[_0xdc5d('0x30')]:_0x62b9c4[_0xdc5d('0x2b')];if(_0x59dfaa['query'][_0xdc5d('0x39')]){_0x4f2ae1[_0xdc5d('0x3a')]=[{'all':!![]}];}_0x4f2ae1=_[_0xdc5d('0x35')]({},_0x4f2ae1,_0x59dfaa[_0xdc5d('0x38')]);return db[_0xdc5d('0x27')][_0xdc5d('0x41')](_0x4f2ae1)[_0xdc5d('0x20')](handleEntityNotFound(_0x3c6bbc,null))[_0xdc5d('0x20')](respondWithResult(_0x3c6bbc,null))[_0xdc5d('0x3d')](handleError(_0x3c6bbc,null));};exports[_0xdc5d('0x42')]=function(_0x1061ba,_0x131160){return db['ServicenowField']['create'](_0x1061ba['body'],{})['then'](respondWithResult(_0x131160,0xc9))[_0xdc5d('0x3d')](handleError(_0x131160,null));};exports[_0xdc5d('0x1f')]=function(_0x5ec04a,_0x469a22){if(_0x5ec04a[_0xdc5d('0x43')]['id']){delete _0x5ec04a[_0xdc5d('0x43')]['id'];}return db[_0xdc5d('0x27')][_0xdc5d('0x41')]({'where':{'id':_0x5ec04a[_0xdc5d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x469a22,null))[_0xdc5d('0x20')](saveUpdates(_0x5ec04a[_0xdc5d('0x43')],null))[_0xdc5d('0x20')](respondWithResult(_0x469a22,null))[_0xdc5d('0x3d')](handleError(_0x469a22,null));};exports[_0xdc5d('0x21')]=function(_0x371618,_0x150366){return db[_0xdc5d('0x27')][_0xdc5d('0x41')]({'where':{'id':_0x371618[_0xdc5d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x150366,null))[_0xdc5d('0x20')](removeEntity(_0x150366,null))['catch'](handleError(_0x150366,null));}; \ No newline at end of file +var _0xbc0d=['desk.js','to-csv','papaparse','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','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowField','fieldName','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','show','rawAttributes','keys','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x1f1511,_0x4ea911){var _0x1d9ab8=function(_0x53276a){while(--_0x53276a){_0x1f1511['push'](_0x1f1511['shift']());}};_0x1d9ab8(++_0x4ea911);}(_0xbc0d,0x129));var _0xdbc0=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0xbc0d[_0xdbe2de];return _0x2facd7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdbc0('0x0'));var rimraf=require(_0xdbc0('0x1'));var zipdir=require(_0xdbc0('0x2'));var jsonpatch=require(_0xdbc0('0x3'));var rp=require(_0xdbc0('0x4'));var moment=require(_0xdbc0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdbc0('0x6'));var util=require(_0xdbc0('0x7'));var path=require(_0xdbc0('0x8'));var sox=require(_0xdbc0('0x9'));var csv=require('to-csv');var ejs=require(_0xdbc0('0xa'));var fs=require('fs');var _=require(_0xdbc0('0xb'));var squel=require(_0xdbc0('0xc'));var crypto=require(_0xdbc0('0xd'));var jsforce=require(_0xdbc0('0xe'));var deskjs=require(_0xdbc0('0xf'));var toCsv=require(_0xdbc0('0x10'));var querystring=require('querystring');var Papa=require(_0xdbc0('0x11'));var Redis=require(_0xdbc0('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xdbc0('0x13'));var as=require(_0xdbc0('0x14'));var hardwareService=require(_0xdbc0('0x15'));var logger=require(_0xdbc0('0x16'))('api');var utils=require(_0xdbc0('0x17'));var config=require(_0xdbc0('0x18'));var db=require(_0xdbc0('0x19'))['db'];function respondWithStatusCode(_0x10bf19,_0x44caab){_0x44caab=_0x44caab||0xcc;return function(_0x11c690){if(_0x11c690){return _0x10bf19[_0xdbc0('0x1a')](_0x44caab);}return _0x10bf19[_0xdbc0('0x1b')](_0x44caab)[_0xdbc0('0x1c')]();};}function respondWithResult(_0x345871,_0xe0b7b8){_0xe0b7b8=_0xe0b7b8||0xc8;return function(_0x38ed76){if(_0x38ed76){return _0x345871['status'](_0xe0b7b8)[_0xdbc0('0x1d')](_0x38ed76);}};}function respondWithFilteredResult(_0x49e147,_0xb7ac2){return function(_0x47e58f){if(_0x47e58f){var _0x551920=_0x47e58f['count'],_0x320fd9=_0xb7ac2[_0xdbc0('0x1e')],_0x2010a0=_0xb7ac2['offset']+_0xb7ac2[_0xdbc0('0x1f')],_0x5e801d;if(_0x2010a0>=_0x551920){_0x2010a0=_0x551920;_0x5e801d=0xc8;}else{_0x5e801d=0xce;}_0x49e147[_0xdbc0('0x1b')](_0x5e801d);return _0x49e147[_0xdbc0('0x20')]('Content-Range',_0x320fd9+'-'+_0x2010a0+'/'+_0x551920)[_0xdbc0('0x1d')](_0x47e58f);}return null;};}function patchUpdates(_0xe1070){return function(_0x5aea1d){try{jsonpatch[_0xdbc0('0x21')](_0x5aea1d,_0xe1070,!![]);}catch(_0x315d8a){return BPromise[_0xdbc0('0x22')](_0x315d8a);}return _0x5aea1d[_0xdbc0('0x23')]();};}function saveUpdates(_0x2554e3,_0x124b07){return function(_0x57ef7a){if(_0x57ef7a){return _0x57ef7a[_0xdbc0('0x24')](_0x2554e3)[_0xdbc0('0x25')](function(_0x5ab988){return _0x5ab988;});}return null;};}function removeEntity(_0x5c4342,_0x332160){return function(_0x5cc267){if(_0x5cc267){return _0x5cc267[_0xdbc0('0x26')]()[_0xdbc0('0x25')](function(){_0x5c4342[_0xdbc0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48caf9,_0xb03554){return function(_0x338aad){if(!_0x338aad){_0x48caf9[_0xdbc0('0x1a')](0x194);}return _0x338aad;};}function handleError(_0x4b98a7,_0x1c245d){_0x1c245d=_0x1c245d||0x1f4;return function(_0x1af678){logger[_0xdbc0('0x27')](_0x1af678[_0xdbc0('0x28')]);if(_0x1af678[_0xdbc0('0x29')]){delete _0x1af678[_0xdbc0('0x29')];}_0x4b98a7[_0xdbc0('0x1b')](_0x1c245d)[_0xdbc0('0x2a')](_0x1af678);};}exports[_0xdbc0('0x2b')]=function(_0x54a5a5,_0x404768){var _0x2aa04a={},_0x563e4c={},_0x330ba7={'count':0x0,'rows':[]};var _0x59b955=_[_0xdbc0('0x2c')](db[_0xdbc0('0x2d')]['rawAttributes'],function(_0x2c601f){return{'name':_0x2c601f[_0xdbc0('0x2e')],'type':_0x2c601f[_0xdbc0('0x2f')][_0xdbc0('0x30')]};});_0x563e4c[_0xdbc0('0x31')]=_[_0xdbc0('0x2c')](_0x59b955,_0xdbc0('0x29'));_0x563e4c[_0xdbc0('0x32')]=_['keys'](_0x54a5a5[_0xdbc0('0x32')]);_0x563e4c[_0xdbc0('0x33')]=_['intersection'](_0x563e4c[_0xdbc0('0x31')],_0x563e4c[_0xdbc0('0x32')]);_0x2aa04a['attributes']=_[_0xdbc0('0x34')](_0x563e4c['model'],qs[_0xdbc0('0x35')](_0x54a5a5[_0xdbc0('0x32')]['fields']));_0x2aa04a['attributes']=_0x2aa04a['attributes'][_0xdbc0('0x36')]?_0x2aa04a[_0xdbc0('0x37')]:_0x563e4c['model'];if(!_0x54a5a5[_0xdbc0('0x32')][_0xdbc0('0x38')]('nolimit')){_0x2aa04a['limit']=qs[_0xdbc0('0x1f')](_0x54a5a5[_0xdbc0('0x32')][_0xdbc0('0x1f')]);_0x2aa04a[_0xdbc0('0x1e')]=qs[_0xdbc0('0x1e')](_0x54a5a5[_0xdbc0('0x32')][_0xdbc0('0x1e')]);}_0x2aa04a[_0xdbc0('0x39')]=qs[_0xdbc0('0x3a')](_0x54a5a5[_0xdbc0('0x32')][_0xdbc0('0x3a')]);_0x2aa04a['where']=qs[_0xdbc0('0x33')](_[_0xdbc0('0x3b')](_0x54a5a5[_0xdbc0('0x32')],_0x563e4c[_0xdbc0('0x33')]));if(_0x54a5a5[_0xdbc0('0x32')][_0xdbc0('0x3c')]){_0x2aa04a['where']=_[_0xdbc0('0x3d')](_0x2aa04a[_0xdbc0('0x3e')],{'$or':_['map'](_0x59b955,function(_0x3cffae){if(_0x3cffae['type']!==_0xdbc0('0x3f')){var _0xfeb214={};_0xfeb214[_0x3cffae[_0xdbc0('0x29')]]={'$like':'%'+_0x54a5a5['query'][_0xdbc0('0x3c')]+'%'};return _0xfeb214;}})});}_0x2aa04a=_[_0xdbc0('0x3d')]({},_0x2aa04a,_0x54a5a5[_0xdbc0('0x40')]);var _0x6230dd={'where':_0x2aa04a['where']};return db[_0xdbc0('0x2d')][_0xdbc0('0x41')](_0x6230dd)[_0xdbc0('0x25')](function(_0x274996){_0x330ba7[_0xdbc0('0x41')]=_0x274996;if(_0x54a5a5[_0xdbc0('0x32')][_0xdbc0('0x42')]){_0x2aa04a[_0xdbc0('0x43')]=[{'all':!![]}];}return db['ServicenowField'][_0xdbc0('0x44')](_0x2aa04a);})[_0xdbc0('0x25')](function(_0x3f31bb){_0x330ba7[_0xdbc0('0x45')]=_0x3f31bb;return _0x330ba7;})[_0xdbc0('0x25')](respondWithFilteredResult(_0x404768,_0x2aa04a))['catch'](handleError(_0x404768,null));};exports[_0xdbc0('0x46')]=function(_0x35506d,_0x555df4){var _0x244d88={'raw':!![],'where':{'id':_0x35506d['params']['id']}},_0x39ce95={};_0x39ce95['model']=_['keys'](db[_0xdbc0('0x2d')][_0xdbc0('0x47')]);_0x39ce95[_0xdbc0('0x32')]=_[_0xdbc0('0x48')](_0x35506d[_0xdbc0('0x32')]);_0x39ce95['filters']=_[_0xdbc0('0x34')](_0x39ce95[_0xdbc0('0x31')],_0x39ce95[_0xdbc0('0x32')]);_0x244d88[_0xdbc0('0x37')]=_['intersection'](_0x39ce95['model'],qs[_0xdbc0('0x35')](_0x35506d[_0xdbc0('0x32')][_0xdbc0('0x35')]));_0x244d88[_0xdbc0('0x37')]=_0x244d88[_0xdbc0('0x37')]['length']?_0x244d88[_0xdbc0('0x37')]:_0x39ce95['model'];if(_0x35506d['query']['includeAll']){_0x244d88[_0xdbc0('0x43')]=[{'all':!![]}];}_0x244d88=_[_0xdbc0('0x3d')]({},_0x244d88,_0x35506d[_0xdbc0('0x40')]);return db[_0xdbc0('0x2d')][_0xdbc0('0x49')](_0x244d88)[_0xdbc0('0x25')](handleEntityNotFound(_0x555df4,null))['then'](respondWithResult(_0x555df4,null))[_0xdbc0('0x4a')](handleError(_0x555df4,null));};exports[_0xdbc0('0x4b')]=function(_0x2ebc56,_0x131851){return db[_0xdbc0('0x2d')][_0xdbc0('0x4b')](_0x2ebc56['body'],{})['then'](respondWithResult(_0x131851,0xc9))[_0xdbc0('0x4a')](handleError(_0x131851,null));};exports[_0xdbc0('0x24')]=function(_0x4b3be2,_0x1876e5){if(_0x4b3be2[_0xdbc0('0x4c')]['id']){delete _0x4b3be2['body']['id'];}return db[_0xdbc0('0x2d')]['find']({'where':{'id':_0x4b3be2[_0xdbc0('0x4d')]['id']}})[_0xdbc0('0x25')](handleEntityNotFound(_0x1876e5,null))[_0xdbc0('0x25')](saveUpdates(_0x4b3be2['body'],null))[_0xdbc0('0x25')](respondWithResult(_0x1876e5,null))[_0xdbc0('0x4a')](handleError(_0x1876e5,null));};exports['destroy']=function(_0x29e07a,_0x2a94e9){return db['ServicenowField']['find']({'where':{'id':_0x29e07a[_0xdbc0('0x4d')]['id']}})[_0xdbc0('0x25')](handleEntityNotFound(_0x2a94e9,null))[_0xdbc0('0x25')](removeEntity(_0x2a94e9,null))[_0xdbc0('0x4a')](handleError(_0x2a94e9,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index a117afe..390d456 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 _0x3c34=['ServicenowField','int_servicenow_fields','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define'];(function(_0x51724e,_0x4f4bab){var _0x9776ef=function(_0x15c3cf){while(--_0x15c3cf){_0x51724e['push'](_0x51724e['shift']());}};_0x9776ef(++_0x4f4bab);}(_0x3c34,0x162));var _0x43c3=function(_0x2b8077,_0x453634){_0x2b8077=_0x2b8077-0x0;var _0x308091=_0x3c34[_0x2b8077];return _0x308091;};'use strict';var _=require(_0x43c3('0x0'));var util=require('util');var logger=require(_0x43c3('0x1'))(_0x43c3('0x2'));var moment=require('moment');var BPromise=require(_0x43c3('0x3'));var rp=require(_0x43c3('0x4'));var fs=require('fs');var path=require(_0x43c3('0x5'));var rimraf=require(_0x43c3('0x6'));var config=require(_0x43c3('0x7'));var attributes=require(_0x43c3('0x8'));module['exports']=function(_0x1456c6,_0x975508){return _0x1456c6[_0x43c3('0x9')](_0x43c3('0xa'),attributes,{'tableName':_0x43c3('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x43c3('0xc'),_0x43c3('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6865=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ServicenowField','servicenow_unique_index','idField','../../config/logger'];(function(_0x3a39ea,_0x44e465){var _0x41cfe5=function(_0x17c509){while(--_0x17c509){_0x3a39ea['push'](_0x3a39ea['shift']());}};_0x41cfe5(++_0x44e465);}(_0x6865,0x1af));var _0x5686=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6865[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5686('0x0'))(_0x5686('0x1'));var moment=require(_0x5686('0x2'));var BPromise=require(_0x5686('0x3'));var rp=require(_0x5686('0x4'));var fs=require('fs');var path=require(_0x5686('0x5'));var rimraf=require(_0x5686('0x6'));var config=require(_0x5686('0x7'));var attributes=require('./intServicenowField.attributes');module[_0x5686('0x8')]=function(_0x3a1924,_0x31d664){return _0x3a1924['define'](_0x5686('0x9'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x5686('0xa'),'fields':[_0x5686('0xb'),'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 ad2213b..9cc4fc5 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 _0x7c31=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5c9df0,_0x3cfaf6){var _0x5e45c2=function(_0x19d30b){while(--_0x19d30b){_0x5c9df0['push'](_0x5c9df0['shift']());}};_0x5e45c2(++_0x3cfaf6);}(_0x7c31,0x10e));var _0x17c3=function(_0xdfac90,_0x58ff7b){_0xdfac90=_0xdfac90-0x0;var _0x1c3bc9=_0x7c31[_0xdfac90];return _0x1c3bc9;};'use strict';var _=require(_0x17c3('0x0'));var util=require(_0x17c3('0x1'));var moment=require(_0x17c3('0x2'));var BPromise=require('bluebird');var rs=require(_0x17c3('0x3'));var fs=require('fs');var Redis=require(_0x17c3('0x4'));var db=require(_0x17c3('0x5'))['db'];var utils=require(_0x17c3('0x6'));var logger=require(_0x17c3('0x7'))(_0x17c3('0x8'));var config=require(_0x17c3('0x9'));var jayson=require(_0x17c3('0xa'));var client=jayson['client'][_0x17c3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dd097,_0x4d334c,_0x64f415){return new BPromise(function(_0x5a479e,_0x13f75d){return client[_0x17c3('0xc')](_0x4dd097,_0x64f415)['then'](function(_0x5023a8){logger[_0x17c3('0xd')](_0x17c3('0xe'),_0x4d334c,_0x17c3('0xf'));logger[_0x17c3('0x10')](_0x17c3('0x11'),_0x4d334c,_0x17c3('0xf'),JSON['stringify'](_0x5023a8));if(_0x5023a8[_0x17c3('0x12')]){if(_0x5023a8[_0x17c3('0x12')][_0x17c3('0x13')]===0x1f4){logger['error'](_0x17c3('0xe'),_0x4d334c,_0x5023a8[_0x17c3('0x12')][_0x17c3('0x14')]);return _0x13f75d(_0x5023a8['error'][_0x17c3('0x14')]);}logger[_0x17c3('0x12')](_0x17c3('0xe'),_0x4d334c,_0x5023a8[_0x17c3('0x12')][_0x17c3('0x14')]);return _0x5a479e(_0x5023a8[_0x17c3('0x12')][_0x17c3('0x14')]);}else{logger[_0x17c3('0xd')]('ServicenowField,\x20%s,\x20%s',_0x4d334c,'request\x20sent');_0x5a479e(_0x5023a8[_0x17c3('0x15')][_0x17c3('0x14')]);}})[_0x17c3('0x16')](function(_0x16b3e4){logger['error']('ServicenowField,\x20%s,\x20%s',_0x4d334c,_0x16b3e4);_0x13f75d(_0x16b3e4);});});} \ No newline at end of file +var _0x09fd=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09fd,0x6e));var _0xd09f=function(_0x4dab66,_0x272458){_0x4dab66=_0x4dab66-0x0;var _0x3c658a=_0x09fd[_0x4dab66];return _0x3c658a;};'use strict';var _=require(_0xd09f('0x0'));var util=require(_0xd09f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd09f('0x2'));var fs=require('fs');var Redis=require(_0xd09f('0x3'));var db=require(_0xd09f('0x4'))['db'];var utils=require(_0xd09f('0x5'));var logger=require('../../config/logger')(_0xd09f('0x6'));var config=require(_0xd09f('0x7'));var jayson=require(_0xd09f('0x8'));var client=jayson['client'][_0xd09f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x571069,_0x180fcd,_0x3a57f8){return new BPromise(function(_0xe7442a,_0x4f48e0){return client['request'](_0x571069,_0x3a57f8)[_0xd09f('0xa')](function(_0x1bf82c){logger[_0xd09f('0xb')](_0xd09f('0xc'),_0x180fcd,_0xd09f('0xd'));logger['debug'](_0xd09f('0xe'),_0x180fcd,_0xd09f('0xd'),JSON['stringify'](_0x1bf82c));if(_0x1bf82c[_0xd09f('0xf')]){if(_0x1bf82c[_0xd09f('0xf')]['code']===0x1f4){logger[_0xd09f('0xf')](_0xd09f('0xc'),_0x180fcd,_0x1bf82c['error'][_0xd09f('0x10')]);return _0x4f48e0(_0x1bf82c[_0xd09f('0xf')][_0xd09f('0x10')]);}logger['error'](_0xd09f('0xc'),_0x180fcd,_0x1bf82c[_0xd09f('0xf')][_0xd09f('0x10')]);return _0xe7442a(_0x1bf82c[_0xd09f('0xf')][_0xd09f('0x10')]);}else{logger['info'](_0xd09f('0xc'),_0x180fcd,_0xd09f('0xd'));_0xe7442a(_0x1bf82c[_0xd09f('0x11')][_0xd09f('0x10')]);}})[_0xd09f('0x12')](function(_0xa1af1f){logger['error']('ServicenowField,\x20%s,\x20%s',_0x180fcd,_0xa1af1f);_0x4f48e0(_0xa1af1f);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 0fe90c1..661b7f8 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 _0xdc84=['create','post','addConfiguration','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x49ca6b,_0x3ba842){var _0x1d957f=function(_0x12ef94){while(--_0x12ef94){_0x49ca6b['push'](_0x49ca6b['shift']());}};_0x1d957f(++_0x3ba842);}(_0xdc84,0x11c));var _0x4dc8=function(_0x36436d,_0x20292c){_0x36436d=_0x36436d-0x0;var _0x34615d=_0xdc84[_0x36436d];return _0x34615d;};'use strict';var multer=require(_0x4dc8('0x0'));var util=require(_0x4dc8('0x1'));var path=require('path');var timeout=require(_0x4dc8('0x2'));var express=require(_0x4dc8('0x3'));var router=express['Router']();var auth=require(_0x4dc8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4dc8('0x5'));var controller=require(_0x4dc8('0x6'));router[_0x4dc8('0x7')]('/',auth[_0x4dc8('0x8')](),controller[_0x4dc8('0x9')]);router[_0x4dc8('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4dc8('0xa')]);router[_0x4dc8('0x7')](_0x4dc8('0xb'),auth['isAuthenticated'](),controller[_0x4dc8('0xc')]);router[_0x4dc8('0x7')](_0x4dc8('0xd'),auth[_0x4dc8('0x8')](),controller[_0x4dc8('0xe')]);router['post']('/',auth[_0x4dc8('0x8')](),controller[_0x4dc8('0xf')]);router[_0x4dc8('0x10')](_0x4dc8('0xb'),auth[_0x4dc8('0x8')](),controller[_0x4dc8('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x4dc8('0x12')]);router[_0x4dc8('0x13')](_0x4dc8('0x14'),auth[_0x4dc8('0x8')](),controller[_0x4dc8('0x15')]);module[_0x4dc8('0x16')]=router; \ No newline at end of file +var _0x8eac=['create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','post'];(function(_0xca4c88,_0xcef50){var _0x21083d=function(_0x405668){while(--_0x405668){_0xca4c88['push'](_0xca4c88['shift']());}};_0x21083d(++_0xcef50);}(_0x8eac,0x1d4));var _0xc8ea=function(_0x515099,_0x46bdbd){_0x515099=_0x515099-0x0;var _0x26e0a7=_0x8eac[_0x515099];return _0x26e0a7;};'use strict';var multer=require(_0xc8ea('0x0'));var util=require(_0xc8ea('0x1'));var path=require(_0xc8ea('0x2'));var timeout=require('connect-timeout');var express=require(_0xc8ea('0x3'));var router=express[_0xc8ea('0x4')]();var auth=require(_0xc8ea('0x5'));var interaction=require(_0xc8ea('0x6'));var config=require('../../config/environment');var controller=require(_0xc8ea('0x7'));router[_0xc8ea('0x8')]('/',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xa')]);router['get']('/:id',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xb')]);router[_0xc8ea('0x8')](_0xc8ea('0xc'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xd')]);router['get']('/:id/fields',auth[_0xc8ea('0x9')](),controller['getFields']);router[_0xc8ea('0xe')]('/',auth[_0xc8ea('0x9')](),controller[_0xc8ea('0xf')]);router['post'](_0xc8ea('0xc'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x10')]);router[_0xc8ea('0x11')](_0xc8ea('0x12'),auth[_0xc8ea('0x9')](),controller[_0xc8ea('0x13')]);router[_0xc8ea('0x14')](_0xc8ea('0x12'),auth['isAuthenticated'](),controller[_0xc8ea('0x15')]);module[_0xc8ea('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 62158ef..c9ed28c 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 _0xc7cb=['username','remoteUri','sequelize','exports','STRING'];(function(_0xa9e5a0,_0x51fafb){var _0x21b584=function(_0x78cb37){while(--_0x78cb37){_0xa9e5a0['push'](_0xa9e5a0['shift']());}};_0x21b584(++_0x51fafb);}(_0xc7cb,0x115));var _0xbc7c=function(_0x10b15d,_0x3cc5b5){_0x10b15d=_0x10b15d-0x0;var _0x44dd13=_0xc7cb[_0x10b15d];return _0x44dd13;};'use strict';var Sequelize=require(_0xbc7c('0x0'));module[_0xbc7c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbc7c('0x2')]},'username':{'type':Sequelize[_0xbc7c('0x2')],'unique':_0xbc7c('0x3')},'password':{'type':Sequelize[_0xbc7c('0x2')]},'remoteUri':{'type':Sequelize[_0xbc7c('0x2')],'unique':_0xbc7c('0x4')},'serverUrl':{'type':Sequelize[_0xbc7c('0x2')]}}; \ No newline at end of file +var _0x7df2=['remoteUri','sequelize','exports','STRING','username'];(function(_0x587693,_0x27fe90){var _0x510a1a=function(_0x290f71){while(--_0x290f71){_0x587693['push'](_0x587693['shift']());}};_0x510a1a(++_0x27fe90);}(_0x7df2,0x119));var _0x27df=function(_0x7217ea,_0x3016f6){_0x7217ea=_0x7217ea-0x0;var _0x15b307=_0x7df2[_0x7217ea];return _0x15b307;};'use strict';var Sequelize=require(_0x27df('0x0'));module[_0x27df('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x27df('0x2')]},'username':{'type':Sequelize[_0x27df('0x2')],'unique':_0x27df('0x3')},'password':{'type':Sequelize[_0x27df('0x2')]},'remoteUri':{'type':Sequelize[_0x27df('0x2')],'unique':_0x27df('0x4')},'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 02c7117..a2559e4 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 _0xf50f=['parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','%s%s','JSON','stringify','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','format','/service/v4_1/rest.php','remove','includes','endsWith','values','value','statusCode','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','request\x20sent','debug','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','catch','sendStatus','end','json','count','offset','limit','status','set','apply','save','destroy','name','send','index','SugarcrmAccount','rawAttributes','type','model','map','filters','intersection','query','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','show','keys','include','create','body','update','find','params','getConfigurations','SugarcrmConfiguration','length','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','date_start','duration_hours','duration_minutes','parent_id','parent_type'];(function(_0x271a80,_0x268bac){var _0xf8233e=function(_0x825987){while(--_0x825987){_0x271a80['push'](_0x271a80['shift']());}};_0xf8233e(++_0x268bac);}(_0xf50f,0x113));var _0xff50=function(_0x5e8c7a,_0x18eb53){_0x5e8c7a=_0x5e8c7a-0x0;var _0x408701=_0xf50f[_0x5e8c7a];return _0x408701;};'use strict';var pdf=require(_0xff50('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xff50('0x1'));var zipdir=require(_0xff50('0x2'));var jsonpatch=require(_0xff50('0x3'));var rp=require(_0xff50('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xff50('0x5'));var path=require('path');var sox=require(_0xff50('0x6'));var csv=require(_0xff50('0x7'));var ejs=require(_0xff50('0x8'));var fs=require('fs');var _=require(_0xff50('0x9'));var squel=require(_0xff50('0xa'));var crypto=require(_0xff50('0xb'));var jsforce=require(_0xff50('0xc'));var deskjs=require(_0xff50('0xd'));var toCsv=require(_0xff50('0x7'));var querystring=require(_0xff50('0xe'));var Papa=require(_0xff50('0xf'));var Redis=require(_0xff50('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xff50('0x11'));var as=require(_0xff50('0x12'));var hardwareService=require(_0xff50('0x13'));var logger=require(_0xff50('0x14'))('api');var utils=require(_0xff50('0x15'));var config=require('../../config/environment');var db=require(_0xff50('0x16'))['db'];var integrations=require(_0xff50('0x17'));var jayson=require(_0xff50('0x18'));var client=jayson[_0xff50('0x19')][_0xff50('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x245439,_0x3c9e87,_0x35fd5d){if(_0x35fd5d){var _0x5ddd9f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5ddd9f[_0xff50('0x1b')](_0x3c9e87)){return _0x245439;}else{throw new db[(_0xff50('0x1c'))][(_0xff50('0x1d'))](_0xff50('0x1e'));}}else{return _0x245439;}}function respondWithRpcPromise(_0x2b80f1,_0x50b8d6,_0x4f9abc,_0x3579d7){return new BPromise(function(_0x44e85e,_0x52bb55){var _0x1fc28f=_0x3579d7||client;return _0x1fc28f[_0xff50('0x1f')](_0x2b80f1,_0x4f9abc)[_0xff50('0x20')](function(_0x3819a4){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x50b8d6,_0xff50('0x21'));logger[_0xff50('0x22')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x50b8d6,'request\x20sent',JSON['stringify'](_0x3819a4));if(_0x3819a4[_0xff50('0x23')]){if(_0x3819a4[_0xff50('0x23')][_0xff50('0x24')]===0x1f4){logger['error'](_0xff50('0x25'),_0x50b8d6,_0x3819a4['error'][_0xff50('0x26')]);return _0x52bb55(_0x3819a4[_0xff50('0x23')]['message']);}logger[_0xff50('0x23')]('SugarcrmAccount,\x20%s,\x20%s',_0x50b8d6,_0x3819a4[_0xff50('0x23')]['message']);return _0x44e85e(_0x3819a4[_0xff50('0x23')][_0xff50('0x26')]);}else{logger[_0xff50('0x27')]('SugarcrmAccount,\x20%s,\x20%s',_0x50b8d6,_0xff50('0x21'));_0x44e85e(_0x3819a4['result'][_0xff50('0x26')]);}})[_0xff50('0x28')](function(_0x2802b1){logger[_0xff50('0x23')](_0xff50('0x25'),_0x50b8d6,_0x2802b1);_0x52bb55(_0x2802b1);});});}function respondWithStatusCode(_0x1b97d0,_0x9a7898){_0x9a7898=_0x9a7898||0xcc;return function(_0x3042ca){if(_0x3042ca){return _0x1b97d0[_0xff50('0x29')](_0x9a7898);}return _0x1b97d0['status'](_0x9a7898)[_0xff50('0x2a')]();};}function respondWithResult(_0x1f822c,_0x2e2671){_0x2e2671=_0x2e2671||0xc8;return function(_0x2d43a0){if(_0x2d43a0){return _0x1f822c['status'](_0x2e2671)[_0xff50('0x2b')](_0x2d43a0);}};}function respondWithFilteredResult(_0xb86ac1,_0x583af2){return function(_0x3740b2){if(_0x3740b2){var _0x2f7a51=_0x3740b2[_0xff50('0x2c')],_0x5c89e1=_0x583af2[_0xff50('0x2d')],_0x535823=_0x583af2[_0xff50('0x2d')]+_0x583af2[_0xff50('0x2e')],_0x29f67d;if(_0x535823>=_0x2f7a51){_0x535823=_0x2f7a51;_0x29f67d=0xc8;}else{_0x29f67d=0xce;}_0xb86ac1[_0xff50('0x2f')](_0x29f67d);return _0xb86ac1[_0xff50('0x30')]('Content-Range',_0x5c89e1+'-'+_0x535823+'/'+_0x2f7a51)[_0xff50('0x2b')](_0x3740b2);}return null;};}function patchUpdates(_0xd842cb){return function(_0x345280){try{jsonpatch[_0xff50('0x31')](_0x345280,_0xd842cb,!![]);}catch(_0x5dbf3a){return BPromise['reject'](_0x5dbf3a);}return _0x345280[_0xff50('0x32')]();};}function saveUpdates(_0x11e3bd,_0x18e89c){return function(_0x4d4b8c){if(_0x4d4b8c){return _0x4d4b8c['update'](_0x11e3bd)[_0xff50('0x20')](function(_0x168754){return _0x168754;});}return null;};}function removeEntity(_0x2cc432,_0x57e527){return function(_0x38d012){if(_0x38d012){return _0x38d012[_0xff50('0x33')]()[_0xff50('0x20')](function(){_0x2cc432[_0xff50('0x2f')](0xcc)[_0xff50('0x2a')]();});}};}function handleEntityNotFound(_0x5a1e0a,_0x4d0d96){return function(_0x398a91){if(!_0x398a91){_0x5a1e0a[_0xff50('0x29')](0x194);}return _0x398a91;};}function handleError(_0x4a4ed7,_0xa5da09){_0xa5da09=_0xa5da09||0x1f4;return function(_0x599f85){logger[_0xff50('0x23')](_0x599f85['stack']);if(_0x599f85[_0xff50('0x34')]){delete _0x599f85['name'];}_0x4a4ed7[_0xff50('0x2f')](_0xa5da09)[_0xff50('0x35')](_0x599f85);};}exports[_0xff50('0x36')]=function(_0x37aaa6,_0x2d354d){var _0x46e7e1={},_0x441d26={},_0x1eba11={'count':0x0,'rows':[]};var _0x5b8383=_['map'](db[_0xff50('0x37')][_0xff50('0x38')],function(_0xa2bacf){return{'name':_0xa2bacf['fieldName'],'type':_0xa2bacf[_0xff50('0x39')]['key']};});_0x441d26[_0xff50('0x3a')]=_[_0xff50('0x3b')](_0x5b8383,_0xff50('0x34'));_0x441d26['query']=_['keys'](_0x37aaa6['query']);_0x441d26[_0xff50('0x3c')]=_[_0xff50('0x3d')](_0x441d26[_0xff50('0x3a')],_0x441d26[_0xff50('0x3e')]);_0x46e7e1['attributes']=_[_0xff50('0x3d')](_0x441d26['model'],qs[_0xff50('0x3f')](_0x37aaa6['query'][_0xff50('0x3f')]));_0x46e7e1[_0xff50('0x40')]=_0x46e7e1[_0xff50('0x40')]['length']?_0x46e7e1['attributes']:_0x441d26[_0xff50('0x3a')];if(!_0x37aaa6[_0xff50('0x3e')][_0xff50('0x41')](_0xff50('0x42'))){_0x46e7e1[_0xff50('0x2e')]=qs['limit'](_0x37aaa6['query'][_0xff50('0x2e')]);_0x46e7e1[_0xff50('0x2d')]=qs[_0xff50('0x2d')](_0x37aaa6[_0xff50('0x3e')][_0xff50('0x2d')]);}_0x46e7e1[_0xff50('0x43')]=qs[_0xff50('0x44')](_0x37aaa6['query'][_0xff50('0x44')]);_0x46e7e1['where']=qs['filters'](_[_0xff50('0x45')](_0x37aaa6[_0xff50('0x3e')],_0x441d26[_0xff50('0x3c')]));if(_0x37aaa6[_0xff50('0x3e')][_0xff50('0x46')]){_0x46e7e1['where']=_[_0xff50('0x47')](_0x46e7e1[_0xff50('0x48')],{'$or':_['map'](_0x5b8383,function(_0x259a9f){if(_0x259a9f[_0xff50('0x39')]!==_0xff50('0x49')){var _0x2908ba={};_0x2908ba[_0x259a9f[_0xff50('0x34')]]={'$like':'%'+_0x37aaa6[_0xff50('0x3e')]['filter']+'%'};return _0x2908ba;}})});}_0x46e7e1=_[_0xff50('0x47')]({},_0x46e7e1,_0x37aaa6[_0xff50('0x4a')]);var _0x5e20f1={'where':_0x46e7e1[_0xff50('0x48')]};return db[_0xff50('0x37')][_0xff50('0x2c')](_0x5e20f1)[_0xff50('0x20')](function(_0x14279e){_0x1eba11['count']=_0x14279e;if(_0x37aaa6[_0xff50('0x3e')][_0xff50('0x4b')]){_0x46e7e1['include']=[{'all':!![]}];}return db[_0xff50('0x37')][_0xff50('0x4c')](_0x46e7e1);})[_0xff50('0x20')](function(_0x1bea2a){_0x1eba11['rows']=_0x1bea2a;return _0x1eba11;})[_0xff50('0x20')](respondWithFilteredResult(_0x2d354d,_0x46e7e1))['catch'](handleError(_0x2d354d,null));};exports[_0xff50('0x4d')]=function(_0x5a4155,_0x57a648){var _0x44ad03={'raw':![],'where':{'id':_0x5a4155['params']['id']}},_0x32a0ba={};_0x32a0ba['model']=_['keys'](db[_0xff50('0x37')]['rawAttributes']);_0x32a0ba[_0xff50('0x3e')]=_[_0xff50('0x4e')](_0x5a4155['query']);_0x32a0ba[_0xff50('0x3c')]=_[_0xff50('0x3d')](_0x32a0ba[_0xff50('0x3a')],_0x32a0ba['query']);_0x44ad03['attributes']=_[_0xff50('0x3d')](_0x32a0ba['model'],qs[_0xff50('0x3f')](_0x5a4155[_0xff50('0x3e')][_0xff50('0x3f')]));_0x44ad03[_0xff50('0x40')]=_0x44ad03['attributes']['length']?_0x44ad03[_0xff50('0x40')]:_0x32a0ba[_0xff50('0x3a')];if(_0x5a4155[_0xff50('0x3e')][_0xff50('0x4b')]){_0x44ad03[_0xff50('0x4f')]=[{'all':!![]}];}_0x44ad03=_[_0xff50('0x47')]({},_0x44ad03,_0x5a4155[_0xff50('0x4a')]);return db[_0xff50('0x37')]['find'](_0x44ad03)[_0xff50('0x20')](handleEntityNotFound(_0x57a648,null))[_0xff50('0x20')](respondWithResult(_0x57a648,null))[_0xff50('0x28')](handleError(_0x57a648,null));};exports['create']=function(_0x1fb172,_0x322cc5){return db[_0xff50('0x37')][_0xff50('0x50')](_0x1fb172[_0xff50('0x51')],{})[_0xff50('0x20')](respondWithResult(_0x322cc5,0xc9))['catch'](handleError(_0x322cc5,null));};exports[_0xff50('0x52')]=function(_0x4192bb,_0x450f93){if(_0x4192bb['body']['id']){delete _0x4192bb['body']['id'];}return db[_0xff50('0x37')][_0xff50('0x53')]({'where':{'id':_0x4192bb[_0xff50('0x54')]['id']}})['then'](handleEntityNotFound(_0x450f93,null))[_0xff50('0x20')](saveUpdates(_0x4192bb[_0xff50('0x51')],null))[_0xff50('0x20')](respondWithResult(_0x450f93,null))['catch'](handleError(_0x450f93,null));};exports[_0xff50('0x33')]=function(_0x1fd673,_0x3fb763){return db[_0xff50('0x37')][_0xff50('0x53')]({'where':{'id':_0x1fd673['params']['id']}})[_0xff50('0x20')](handleEntityNotFound(_0x3fb763,null))[_0xff50('0x20')](removeEntity(_0x3fb763,null))[_0xff50('0x28')](handleError(_0x3fb763,null));};exports[_0xff50('0x55')]=function(_0x4044f8,_0x457048,_0x4664b7){var _0x160360={};var _0x1c1c7c={};var _0x4f8812;var _0x4c1cb7;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x4044f8[_0xff50('0x54')]['id']}})['then'](handleEntityNotFound(_0x457048,null))[_0xff50('0x20')](function(_0x33e96c){if(_0x33e96c){_0x4f8812=_0x33e96c;_0x1c1c7c['model']=_['keys'](db[_0xff50('0x56')]['rawAttributes']);_0x1c1c7c[_0xff50('0x3e')]=_[_0xff50('0x4e')](_0x4044f8[_0xff50('0x3e')]);_0x1c1c7c[_0xff50('0x3c')]=_[_0xff50('0x3d')](_0x1c1c7c[_0xff50('0x3a')],_0x1c1c7c['query']);_0x160360['attributes']=_['intersection'](_0x1c1c7c['model'],qs[_0xff50('0x3f')](_0x4044f8[_0xff50('0x3e')][_0xff50('0x3f')]));_0x160360['attributes']=_0x160360[_0xff50('0x40')][_0xff50('0x57')]?_0x160360[_0xff50('0x40')]:_0x1c1c7c[_0xff50('0x3a')];_0x160360[_0xff50('0x43')]=qs[_0xff50('0x44')](_0x4044f8[_0xff50('0x3e')]['sort']);_0x160360[_0xff50('0x48')]=qs[_0xff50('0x3c')](_['pick'](_0x4044f8[_0xff50('0x3e')],_0x1c1c7c[_0xff50('0x3c')]));if(_0x4044f8['query'][_0xff50('0x46')]){_0x160360['where']=_[_0xff50('0x47')](_0x160360[_0xff50('0x48')],{'$or':_['map'](_0x160360['attributes'],function(_0x385f9b){var _0x41d682={};_0x41d682[_0x385f9b]={'$like':'%'+_0x4044f8[_0xff50('0x3e')]['filter']+'%'};return _0x41d682;})});}_0x160360=_[_0xff50('0x47')]({},_0x160360,_0x4044f8[_0xff50('0x4a')]);return _0x4f8812[_0xff50('0x55')](_0x160360);}})[_0xff50('0x20')](function(_0x504126){if(_0x504126){_0x4c1cb7=_0x504126[_0xff50('0x57')];if(!_0x4044f8['query']['hasOwnProperty'](_0xff50('0x42'))){_0x160360[_0xff50('0x2e')]=qs[_0xff50('0x2e')](_0x4044f8[_0xff50('0x3e')]['limit']);_0x160360[_0xff50('0x2d')]=qs[_0xff50('0x2d')](_0x4044f8['query']['offset']);}return _0x4f8812[_0xff50('0x55')](_0x160360);}})['then'](function(_0x35dfaf){if(_0x35dfaf){return _0x35dfaf?{'count':_0x4c1cb7,'rows':_0x35dfaf}:null;}})[_0xff50('0x20')](respondWithResult(_0x457048,null))[_0xff50('0x28')](handleError(_0x457048,null));};exports['addConfiguration']=function(_0x553257,_0x3da61a,_0x3a0761){if(_0x553257[_0xff50('0x51')]['id']){delete _0x553257['body']['id'];}return db[_0xff50('0x37')][_0xff50('0x58')]({'where':{'id':_0x553257[_0xff50('0x54')]['id']}})[_0xff50('0x20')](handleEntityNotFound(_0x3da61a,null))['then'](function(_0x12ce19){if(_0x12ce19){_0x553257['body'][_0xff50('0x59')]=_0x12ce19['id'];_0x553257['body'][_0xff50('0x5a')]=integrations[_0xff50('0x5b')](_0x553257[_0xff50('0x51')]['channel'],_0x553257[_0xff50('0x51')]['type']);_0x553257['body'][_0xff50('0x5c')]=integrations[_0xff50('0x5d')](_0x553257[_0xff50('0x51')][_0xff50('0x5e')],_0x553257['body'][_0xff50('0x39')]);return db['SugarcrmConfiguration']['create'](_0x553257[_0xff50('0x51')],{'include':[{'model':db[_0xff50('0x5f')],'as':_0xff50('0x5a')},{'model':db[_0xff50('0x5f')],'as':_0xff50('0x5c')}]});}return null;})[_0xff50('0x20')](respondWithResult(_0x3da61a,null))[_0xff50('0x28')](handleError(_0x3da61a,null));};exports[_0xff50('0x60')]=function(_0x576952,_0x395067,_0x5800a2){var _0x5860b4='';var _0x4df467=['id',_0xff50('0x34'),_0xff50('0x61'),'created_by','description',_0xff50('0x62'),_0xff50('0x63'),_0xff50('0x64'),_0xff50('0x65'),_0xff50('0x66'),_0xff50('0x67'),_0xff50('0x68')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x576952[_0xff50('0x54')]['id']},'attributes':['id',_0xff50('0x69'),'password',_0xff50('0x6a')]})[_0xff50('0x20')](handleEntityNotFound(_0x395067,null))[_0xff50('0x20')](function(_0x49a352){if(_0x49a352){_0x5860b4=_0x49a352[_0xff50('0x6a')];var _0x1cb5c7=_0x5860b4[_0xff50('0x6b')](-0x1);if(_0x1cb5c7==='/'){_0x5860b4=_0x5860b4[_0xff50('0x6c')](0x0,_0x5860b4[_0xff50('0x6d')](_0x1cb5c7));}return rp({'method':_0xff50('0x6e'),'uri':util['format'](_0xff50('0x6f'),_0x5860b4,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xff50('0x70'),'rest_data':JSON[_0xff50('0x71')]({'user_auth':{'user_name':_0x49a352[_0xff50('0x69')],'password':_0x49a352[_0xff50('0x72')],'encryption':'PLAIN'},'application':_0xff50('0x73')})}});}})['then'](function(_0x282055){if(_0x282055&&_0x282055[_0xff50('0x34')]!==_0xff50('0x74')&&_0x282055['name']!=='Password\x20Expired'){return rp({'method':_0xff50('0x6e'),'uri':util[_0xff50('0x75')](_0xff50('0x6f'),_0x5860b4,_0xff50('0x76')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xff50('0x70'),'response_type':_0xff50('0x70'),'rest_data':JSON[_0xff50('0x71')]({'session':_0x282055['id'],'module_name':'Calls'})}})[_0xff50('0x20')](function(_0x138d57){if(_0x138d57){var _0x253581=_['values'](_0x138d57['module_fields']);_[_0xff50('0x77')](_0x253581,function(_0x3fb9a0){return _0x4df467[_0xff50('0x78')](_0x3fb9a0[_0xff50('0x34')]);});return{'count':_0x253581[_0xff50('0x57')],'rows':_[_0xff50('0x3b')](_0x253581,function(_0x3e436b){return{'id':_0x3e436b[_0xff50('0x34')],'name':_0x3e436b['label'],'custom':_[_0xff50('0x79')](_0x3e436b[_0xff50('0x34')],'_c')?!![]:![],'options':_0x3e436b[_0xff50('0x4a')]?_[_0xff50('0x3b')](_[_0xff50('0x7a')](_0x3e436b[_0xff50('0x4a')]),function(_0x22c609){return{'name':_0x22c609[_0xff50('0x7b')],'value':_0x22c609[_0xff50('0x34')]};}):[]};})};}})[_0xff50('0x20')](respondWithResult(_0x395067,null))['catch'](function(_0x3d6469){var _0x2fa953=_0x576952[_0xff50('0x3e')][_0xff50('0x1b')]?0x1f4:_0x3d6469[_0xff50('0x7c')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2fa953,JSON[_0xff50('0x71')](_0x3d6469));delete _0x3d6469[_0xff50('0x34')];if(_0x2fa953===0x191){_0x2fa953=0x190;}_0x395067[_0xff50('0x2f')](_0x2fa953)[_0xff50('0x35')](_0x576952[_0xff50('0x3e')][_0xff50('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x3d6469[_0xff50('0x7c')]}:_0x3d6469);});}else{var _0xde89a6=0x1f4;_0x395067[_0xff50('0x2f')](_0xde89a6)['send']({'message':_0xff50('0x7d'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x38f8=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','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~!@#$%^&-_=+[{]}.','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','sendStatus','status','end','count','offset','apply','reject','save','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','SugarcrmAccount','includeAll','include','findAll','rows','catch','params','keys','length','options','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmConfiguration','SugarcrmField','created_by','description','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','/service/v4_1/rest.php','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','%s%s','values','module_fields','label','endsWith','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x189581,_0x3e568f){var _0x489bc2=function(_0x1f5a69){while(--_0x1f5a69){_0x189581['push'](_0x189581['shift']());}};_0x489bc2(++_0x3e568f);}(_0x38f8,0xf6));var _0x838f=function(_0x712d01,_0x53ed96){_0x712d01=_0x712d01-0x0;var _0x49550d=_0x38f8[_0x712d01];return _0x49550d;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x838f('0x0'));var jsonpatch=require(_0x838f('0x1'));var rp=require(_0x838f('0x2'));var moment=require(_0x838f('0x3'));var BPromise=require(_0x838f('0x4'));var Mustache=require(_0x838f('0x5'));var util=require(_0x838f('0x6'));var path=require(_0x838f('0x7'));var sox=require('sox');var csv=require(_0x838f('0x8'));var ejs=require(_0x838f('0x9'));var fs=require('fs');var _=require(_0x838f('0xa'));var squel=require(_0x838f('0xb'));var crypto=require(_0x838f('0xc'));var jsforce=require(_0x838f('0xd'));var deskjs=require(_0x838f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x838f('0xf'));var Papa=require(_0x838f('0x10'));var Redis=require(_0x838f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x838f('0x12'));var as=require(_0x838f('0x13'));var hardwareService=require(_0x838f('0x14'));var logger=require(_0x838f('0x15'))(_0x838f('0x16'));var utils=require('../../config/utils');var config=require(_0x838f('0x17'));var db=require(_0x838f('0x18'))['db'];var integrations=require(_0x838f('0x19'));var jayson=require(_0x838f('0x1a'));var client=jayson[_0x838f('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x2c3ae4,_0x2b7c80,_0x40e3b5){if(_0x40e3b5){var _0xe67280=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe67280[_0x838f('0x1c')](_0x2b7c80)){return _0x2c3ae4;}else{throw new db[(_0x838f('0x1d'))][(_0x838f('0x1e'))](_0x838f('0x1f'));}}else{return _0x2c3ae4;}}function respondWithRpcPromise(_0x2f5fb6,_0x5934d2,_0x211653,_0x4b4597){return new BPromise(function(_0x3ad676,_0x3f56f6){var _0xe5c112=_0x4b4597||client;return _0xe5c112['request'](_0x2f5fb6,_0x211653)['then'](function(_0x369ef1){logger[_0x838f('0x20')](_0x838f('0x21'),_0x5934d2,_0x838f('0x22'));logger[_0x838f('0x23')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x5934d2,_0x838f('0x22'),JSON[_0x838f('0x24')](_0x369ef1));if(_0x369ef1['error']){if(_0x369ef1['error'][_0x838f('0x25')]===0x1f4){logger[_0x838f('0x26')](_0x838f('0x21'),_0x5934d2,_0x369ef1[_0x838f('0x26')][_0x838f('0x27')]);return _0x3f56f6(_0x369ef1[_0x838f('0x26')][_0x838f('0x27')]);}logger['error'](_0x838f('0x21'),_0x5934d2,_0x369ef1[_0x838f('0x26')][_0x838f('0x27')]);return _0x3ad676(_0x369ef1[_0x838f('0x26')]['message']);}else{logger[_0x838f('0x20')](_0x838f('0x21'),_0x5934d2,_0x838f('0x22'));_0x3ad676(_0x369ef1['result'][_0x838f('0x27')]);}})['catch'](function(_0x8a10cd){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5934d2,_0x8a10cd);_0x3f56f6(_0x8a10cd);});});}function respondWithStatusCode(_0x7afe49,_0x286332){_0x286332=_0x286332||0xcc;return function(_0x78c9ed){if(_0x78c9ed){return _0x7afe49[_0x838f('0x28')](_0x286332);}return _0x7afe49[_0x838f('0x29')](_0x286332)[_0x838f('0x2a')]();};}function respondWithResult(_0x2f669b,_0xe2c5c1){_0xe2c5c1=_0xe2c5c1||0xc8;return function(_0x526c81){if(_0x526c81){return _0x2f669b['status'](_0xe2c5c1)['json'](_0x526c81);}};}function respondWithFilteredResult(_0x2e4450,_0x4bf027){return function(_0x42a564){if(_0x42a564){var _0x1c8bf9=_0x42a564[_0x838f('0x2b')],_0x5c56bd=_0x4bf027[_0x838f('0x2c')],_0x4401be=_0x4bf027[_0x838f('0x2c')]+_0x4bf027['limit'],_0x14c16c;if(_0x4401be>=_0x1c8bf9){_0x4401be=_0x1c8bf9;_0x14c16c=0xc8;}else{_0x14c16c=0xce;}_0x2e4450[_0x838f('0x29')](_0x14c16c);return _0x2e4450['set']('Content-Range',_0x5c56bd+'-'+_0x4401be+'/'+_0x1c8bf9)['json'](_0x42a564);}return null;};}function patchUpdates(_0x26cd02){return function(_0x1a1e50){try{jsonpatch[_0x838f('0x2d')](_0x1a1e50,_0x26cd02,!![]);}catch(_0x119f35){return BPromise[_0x838f('0x2e')](_0x119f35);}return _0x1a1e50[_0x838f('0x2f')]();};}function saveUpdates(_0x539a9b,_0x4bb76b){return function(_0x32ba08){if(_0x32ba08){return _0x32ba08[_0x838f('0x30')](_0x539a9b)[_0x838f('0x31')](function(_0x5b7e41){return _0x5b7e41;});}return null;};}function removeEntity(_0x505322,_0x335480){return function(_0x303f1c){if(_0x303f1c){return _0x303f1c[_0x838f('0x32')]()[_0x838f('0x31')](function(){_0x505322[_0x838f('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x530878,_0x5d4609){return function(_0x3359bc){if(!_0x3359bc){_0x530878[_0x838f('0x28')](0x194);}return _0x3359bc;};}function handleError(_0x11ff33,_0x504942){_0x504942=_0x504942||0x1f4;return function(_0x14f558){logger['error'](_0x14f558[_0x838f('0x33')]);if(_0x14f558[_0x838f('0x34')]){delete _0x14f558[_0x838f('0x34')];}_0x11ff33[_0x838f('0x29')](_0x504942)['send'](_0x14f558);};}exports[_0x838f('0x35')]=function(_0x745939,_0x1b4c7d){var _0x39ec2e={},_0x4c78df={},_0x4edd2f={'count':0x0,'rows':[]};var _0x202a93=_['map'](db['SugarcrmAccount'][_0x838f('0x36')],function(_0x452edc){return{'name':_0x452edc[_0x838f('0x37')],'type':_0x452edc[_0x838f('0x38')][_0x838f('0x39')]};});_0x4c78df[_0x838f('0x3a')]=_[_0x838f('0x3b')](_0x202a93,_0x838f('0x34'));_0x4c78df[_0x838f('0x3c')]=_['keys'](_0x745939['query']);_0x4c78df[_0x838f('0x3d')]=_[_0x838f('0x3e')](_0x4c78df['model'],_0x4c78df[_0x838f('0x3c')]);_0x39ec2e[_0x838f('0x3f')]=_[_0x838f('0x3e')](_0x4c78df[_0x838f('0x3a')],qs[_0x838f('0x40')](_0x745939[_0x838f('0x3c')]['fields']));_0x39ec2e[_0x838f('0x3f')]=_0x39ec2e[_0x838f('0x3f')]['length']?_0x39ec2e['attributes']:_0x4c78df[_0x838f('0x3a')];if(!_0x745939['query'][_0x838f('0x41')]('nolimit')){_0x39ec2e[_0x838f('0x42')]=qs['limit'](_0x745939[_0x838f('0x3c')][_0x838f('0x42')]);_0x39ec2e[_0x838f('0x2c')]=qs['offset'](_0x745939[_0x838f('0x3c')][_0x838f('0x2c')]);}_0x39ec2e[_0x838f('0x43')]=qs[_0x838f('0x44')](_0x745939[_0x838f('0x3c')]['sort']);_0x39ec2e['where']=qs[_0x838f('0x3d')](_[_0x838f('0x45')](_0x745939[_0x838f('0x3c')],_0x4c78df['filters']));if(_0x745939[_0x838f('0x3c')][_0x838f('0x46')]){_0x39ec2e[_0x838f('0x47')]=_[_0x838f('0x48')](_0x39ec2e['where'],{'$or':_['map'](_0x202a93,function(_0x166caf){if(_0x166caf[_0x838f('0x38')]!==_0x838f('0x49')){var _0x21e8a6={};_0x21e8a6[_0x166caf[_0x838f('0x34')]]={'$like':'%'+_0x745939[_0x838f('0x3c')][_0x838f('0x46')]+'%'};return _0x21e8a6;}})});}_0x39ec2e=_[_0x838f('0x48')]({},_0x39ec2e,_0x745939['options']);var _0x34469d={'where':_0x39ec2e[_0x838f('0x47')]};return db[_0x838f('0x4a')][_0x838f('0x2b')](_0x34469d)[_0x838f('0x31')](function(_0x66f47e){_0x4edd2f[_0x838f('0x2b')]=_0x66f47e;if(_0x745939[_0x838f('0x3c')][_0x838f('0x4b')]){_0x39ec2e[_0x838f('0x4c')]=[{'all':!![]}];}return db[_0x838f('0x4a')][_0x838f('0x4d')](_0x39ec2e);})[_0x838f('0x31')](function(_0x5e02c2){_0x4edd2f[_0x838f('0x4e')]=_0x5e02c2;return _0x4edd2f;})[_0x838f('0x31')](respondWithFilteredResult(_0x1b4c7d,_0x39ec2e))[_0x838f('0x4f')](handleError(_0x1b4c7d,null));};exports['show']=function(_0x462361,_0x5e6f67){var _0x4f063b={'raw':![],'where':{'id':_0x462361[_0x838f('0x50')]['id']}},_0x320be6={};_0x320be6[_0x838f('0x3a')]=_[_0x838f('0x51')](db[_0x838f('0x4a')][_0x838f('0x36')]);_0x320be6[_0x838f('0x3c')]=_[_0x838f('0x51')](_0x462361['query']);_0x320be6[_0x838f('0x3d')]=_[_0x838f('0x3e')](_0x320be6['model'],_0x320be6[_0x838f('0x3c')]);_0x4f063b[_0x838f('0x3f')]=_[_0x838f('0x3e')](_0x320be6[_0x838f('0x3a')],qs[_0x838f('0x40')](_0x462361[_0x838f('0x3c')][_0x838f('0x40')]));_0x4f063b['attributes']=_0x4f063b[_0x838f('0x3f')][_0x838f('0x52')]?_0x4f063b['attributes']:_0x320be6[_0x838f('0x3a')];if(_0x462361[_0x838f('0x3c')][_0x838f('0x4b')]){_0x4f063b[_0x838f('0x4c')]=[{'all':!![]}];}_0x4f063b=_[_0x838f('0x48')]({},_0x4f063b,_0x462361[_0x838f('0x53')]);return db['SugarcrmAccount'][_0x838f('0x54')](_0x4f063b)[_0x838f('0x31')](handleEntityNotFound(_0x5e6f67,null))[_0x838f('0x31')](respondWithResult(_0x5e6f67,null))['catch'](handleError(_0x5e6f67,null));};exports[_0x838f('0x55')]=function(_0x3169c4,_0x536784){return db['SugarcrmAccount']['create'](_0x3169c4[_0x838f('0x56')],{})[_0x838f('0x31')](respondWithResult(_0x536784,0xc9))[_0x838f('0x4f')](handleError(_0x536784,null));};exports[_0x838f('0x30')]=function(_0x6a37a7,_0x4658f6){if(_0x6a37a7[_0x838f('0x56')]['id']){delete _0x6a37a7[_0x838f('0x56')]['id'];}return db[_0x838f('0x4a')][_0x838f('0x54')]({'where':{'id':_0x6a37a7[_0x838f('0x50')]['id']}})[_0x838f('0x31')](handleEntityNotFound(_0x4658f6,null))[_0x838f('0x31')](saveUpdates(_0x6a37a7[_0x838f('0x56')],null))[_0x838f('0x31')](respondWithResult(_0x4658f6,null))[_0x838f('0x4f')](handleError(_0x4658f6,null));};exports[_0x838f('0x32')]=function(_0x183a5a,_0x26fc53){return db[_0x838f('0x4a')][_0x838f('0x54')]({'where':{'id':_0x183a5a[_0x838f('0x50')]['id']}})['then'](handleEntityNotFound(_0x26fc53,null))[_0x838f('0x31')](removeEntity(_0x26fc53,null))['catch'](handleError(_0x26fc53,null));};exports[_0x838f('0x57')]=function(_0x7ea7d0,_0x2eb3d8,_0x45d2b3){var _0x4aabb9={};var _0x2c9e69={};var _0x12f9ce;var _0x44e9ad;return db[_0x838f('0x4a')]['findOne']({'where':{'id':_0x7ea7d0[_0x838f('0x50')]['id']}})[_0x838f('0x31')](handleEntityNotFound(_0x2eb3d8,null))['then'](function(_0x5affaa){if(_0x5affaa){_0x12f9ce=_0x5affaa;_0x2c9e69['model']=_[_0x838f('0x51')](db['SugarcrmConfiguration'][_0x838f('0x36')]);_0x2c9e69[_0x838f('0x3c')]=_[_0x838f('0x51')](_0x7ea7d0[_0x838f('0x3c')]);_0x2c9e69['filters']=_[_0x838f('0x3e')](_0x2c9e69[_0x838f('0x3a')],_0x2c9e69[_0x838f('0x3c')]);_0x4aabb9['attributes']=_[_0x838f('0x3e')](_0x2c9e69[_0x838f('0x3a')],qs[_0x838f('0x40')](_0x7ea7d0[_0x838f('0x3c')][_0x838f('0x40')]));_0x4aabb9[_0x838f('0x3f')]=_0x4aabb9[_0x838f('0x3f')][_0x838f('0x52')]?_0x4aabb9[_0x838f('0x3f')]:_0x2c9e69[_0x838f('0x3a')];_0x4aabb9[_0x838f('0x43')]=qs[_0x838f('0x44')](_0x7ea7d0[_0x838f('0x3c')][_0x838f('0x44')]);_0x4aabb9['where']=qs[_0x838f('0x3d')](_[_0x838f('0x45')](_0x7ea7d0[_0x838f('0x3c')],_0x2c9e69[_0x838f('0x3d')]));if(_0x7ea7d0[_0x838f('0x3c')][_0x838f('0x46')]){_0x4aabb9[_0x838f('0x47')]=_['merge'](_0x4aabb9[_0x838f('0x47')],{'$or':_[_0x838f('0x3b')](_0x4aabb9[_0x838f('0x3f')],function(_0x3def7a){var _0x2b43d8={};_0x2b43d8[_0x3def7a]={'$like':'%'+_0x7ea7d0[_0x838f('0x3c')][_0x838f('0x46')]+'%'};return _0x2b43d8;})});}_0x4aabb9=_[_0x838f('0x48')]({},_0x4aabb9,_0x7ea7d0[_0x838f('0x53')]);return _0x12f9ce[_0x838f('0x57')](_0x4aabb9);}})[_0x838f('0x31')](function(_0x55df41){if(_0x55df41){_0x44e9ad=_0x55df41[_0x838f('0x52')];if(!_0x7ea7d0[_0x838f('0x3c')][_0x838f('0x41')]('nolimit')){_0x4aabb9['limit']=qs['limit'](_0x7ea7d0[_0x838f('0x3c')]['limit']);_0x4aabb9['offset']=qs['offset'](_0x7ea7d0[_0x838f('0x3c')]['offset']);}return _0x12f9ce['getConfigurations'](_0x4aabb9);}})['then'](function(_0x5bd3f9){if(_0x5bd3f9){return _0x5bd3f9?{'count':_0x44e9ad,'rows':_0x5bd3f9}:null;}})[_0x838f('0x31')](respondWithResult(_0x2eb3d8,null))[_0x838f('0x4f')](handleError(_0x2eb3d8,null));};exports[_0x838f('0x58')]=function(_0x1042ac,_0x3d463e,_0x57020b){if(_0x1042ac['body']['id']){delete _0x1042ac[_0x838f('0x56')]['id'];}return db['SugarcrmAccount'][_0x838f('0x59')]({'where':{'id':_0x1042ac['params']['id']}})[_0x838f('0x31')](handleEntityNotFound(_0x3d463e,null))['then'](function(_0x1f6ed0){if(_0x1f6ed0){_0x1042ac[_0x838f('0x56')][_0x838f('0x5a')]=_0x1f6ed0['id'];_0x1042ac[_0x838f('0x56')][_0x838f('0x5b')]=integrations[_0x838f('0x5c')](_0x1042ac[_0x838f('0x56')][_0x838f('0x5d')],_0x1042ac[_0x838f('0x56')][_0x838f('0x38')]);_0x1042ac['body'][_0x838f('0x5e')]=integrations['getDescriptions'](_0x1042ac[_0x838f('0x56')]['channel'],_0x1042ac[_0x838f('0x56')][_0x838f('0x38')]);return db[_0x838f('0x5f')][_0x838f('0x55')](_0x1042ac[_0x838f('0x56')],{'include':[{'model':db['SugarcrmField'],'as':_0x838f('0x5b')},{'model':db[_0x838f('0x60')],'as':_0x838f('0x5e')}]});}return null;})[_0x838f('0x31')](respondWithResult(_0x3d463e,null))[_0x838f('0x4f')](handleError(_0x3d463e,null));};exports['getFields']=function(_0x3696a7,_0x2e5d2f,_0x4bfdec){var _0x5cc4ab='';var _0x3630fc=['id',_0x838f('0x34'),'assigned_user_id',_0x838f('0x61'),_0x838f('0x62'),'date_start','duration_hours',_0x838f('0x63'),'parent_id',_0x838f('0x64'),_0x838f('0x65'),_0x838f('0x66')];return db[_0x838f('0x4a')][_0x838f('0x59')]({'where':{'id':_0x3696a7[_0x838f('0x50')]['id']},'attributes':['id',_0x838f('0x67'),_0x838f('0x68'),'remoteUri']})[_0x838f('0x31')](handleEntityNotFound(_0x2e5d2f,null))['then'](function(_0x186c93){if(_0x186c93){_0x5cc4ab=_0x186c93[_0x838f('0x69')];var _0x58b039=_0x5cc4ab[_0x838f('0x6a')](-0x1);if(_0x58b039==='/'){_0x5cc4ab=_0x5cc4ab[_0x838f('0x6b')](0x0,_0x5cc4ab[_0x838f('0x6c')](_0x58b039));}return rp({'method':_0x838f('0x6d'),'uri':util['format']('%s%s',_0x5cc4ab,_0x838f('0x6e')),'json':!![],'form':{'method':_0x838f('0x6f'),'input_type':_0x838f('0x70'),'response_type':_0x838f('0x70'),'rest_data':JSON[_0x838f('0x24')]({'user_auth':{'user_name':_0x186c93[_0x838f('0x67')],'password':_0x186c93['password'],'encryption':_0x838f('0x71')},'application':_0x838f('0x72')})}});}})['then'](function(_0x572f88){if(_0x572f88&&_0x572f88[_0x838f('0x34')]!==_0x838f('0x73')&&_0x572f88[_0x838f('0x34')]!==_0x838f('0x74')){return rp({'method':_0x838f('0x6d'),'uri':util[_0x838f('0x75')](_0x838f('0x76'),_0x5cc4ab,_0x838f('0x6e')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x838f('0x70'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x572f88['id'],'module_name':'Calls'})}})[_0x838f('0x31')](function(_0xfccc99){if(_0xfccc99){var _0x10b465=_[_0x838f('0x77')](_0xfccc99[_0x838f('0x78')]);_['remove'](_0x10b465,function(_0x42159b){return _0x3630fc['includes'](_0x42159b[_0x838f('0x34')]);});return{'count':_0x10b465[_0x838f('0x52')],'rows':_[_0x838f('0x3b')](_0x10b465,function(_0x3fe621){return{'id':_0x3fe621[_0x838f('0x34')],'name':_0x3fe621[_0x838f('0x79')],'custom':_[_0x838f('0x7a')](_0x3fe621[_0x838f('0x34')],'_c')?!![]:![],'options':_0x3fe621[_0x838f('0x53')]?_['map'](_['values'](_0x3fe621[_0x838f('0x53')]),function(_0x1f6455){return{'name':_0x1f6455['value'],'value':_0x1f6455[_0x838f('0x34')]};}):[]};})};}})['then'](respondWithResult(_0x2e5d2f,null))[_0x838f('0x4f')](function(_0x2aaa6f){var _0x478381=_0x3696a7[_0x838f('0x3c')]['test']?0x1f4:_0x2aaa6f[_0x838f('0x7b')]||0x1f4;logger['error'](_0x838f('0x7c'),_0x838f('0x7d'),_0x478381,JSON[_0x838f('0x24')](_0x2aaa6f));delete _0x2aaa6f[_0x838f('0x34')];if(_0x478381===0x191){_0x478381=0x190;}_0x2e5d2f['status'](_0x478381)[_0x838f('0x7e')](_0x3696a7[_0x838f('0x3c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2aaa6f[_0x838f('0x7b')]}:_0x2aaa6f);});}else{var _0x40c096=0x1f4;_0x2e5d2f[_0x838f('0x29')](_0x40c096)[_0x838f('0x7e')]({'message':_0x838f('0x7f'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 3ac9aa7..273930d 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 _0x2371=['int_sugarcrm_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','SugarcrmAccount'];(function(_0x3f058e,_0x5d2c72){var _0x3bda50=function(_0x334ace){while(--_0x334ace){_0x3f058e['push'](_0x3f058e['shift']());}};_0x3bda50(++_0x5d2c72);}(_0x2371,0x1b9));var _0x1237=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0x2371[_0x1f5a63];return _0x30bb7a;};'use strict';var _=require('lodash');var util=require(_0x1237('0x0'));var logger=require(_0x1237('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1237('0x2'));var fs=require('fs');var path=require(_0x1237('0x3'));var rimraf=require(_0x1237('0x4'));var config=require(_0x1237('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x1237('0x6'));module[_0x1237('0x7')]=function(_0x2ee303,_0x19ff0e){return _0x2ee303['define'](_0x1237('0x8'),attributes,{'tableName':_0x1237('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2083=['path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4078c8,_0x1d7bba){var _0x1e7acb=function(_0xf13efe){while(--_0xf13efe){_0x4078c8['push'](_0x4078c8['shift']());}};_0x1e7acb(++_0x1d7bba);}(_0x2083,0x153));var _0x3208=function(_0x2d6d7b,_0x183ff8){_0x2d6d7b=_0x2d6d7b-0x0;var _0x4372c5=_0x2083[_0x2d6d7b];return _0x4372c5;};'use strict';var _=require(_0x3208('0x0'));var util=require(_0x3208('0x1'));var logger=require(_0x3208('0x2'))(_0x3208('0x3'));var moment=require(_0x3208('0x4'));var BPromise=require(_0x3208('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3208('0x6'));var rimraf=require(_0x3208('0x7'));var config=require(_0x3208('0x8'));var attributes=require(_0x3208('0x9'));var integrations=require(_0x3208('0xa'));module[_0x3208('0xb')]=function(_0x244933,_0x5a1924){return _0x244933[_0x3208('0xc')](_0x3208('0xd'),attributes,{'tableName':_0x3208('0xe'),'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 f56ad82..ce75f59 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 _0x07db=['raw','where','limit','map','include','attributes','model','stringify','ShowSugarcrmAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x07db,0xb9));var _0xb07d=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x07db[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0xb07d('0x0'));var util=require(_0xb07d('0x1'));var moment=require('moment');var BPromise=require(_0xb07d('0x2'));var rs=require(_0xb07d('0x3'));var fs=require('fs');var Redis=require(_0xb07d('0x4'));var db=require(_0xb07d('0x5'))['db'];var utils=require(_0xb07d('0x6'));var logger=require(_0xb07d('0x7'))(_0xb07d('0x8'));var config=require(_0xb07d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb07d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eb4ae,_0x380ee4,_0x337c02){return new BPromise(function(_0x4f6871,_0x2d7610){return client['request'](_0x4eb4ae,_0x337c02)[_0xb07d('0xb')](function(_0x56d835){logger[_0xb07d('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x380ee4,'request\x20sent');logger[_0xb07d('0xd')](_0xb07d('0xe'),_0x380ee4,_0xb07d('0xf'),JSON['stringify'](_0x56d835));if(_0x56d835[_0xb07d('0x10')]){if(_0x56d835[_0xb07d('0x10')][_0xb07d('0x11')]===0x1f4){logger[_0xb07d('0x10')](_0xb07d('0x12'),_0x380ee4,_0x56d835['error'][_0xb07d('0x13')]);return _0x2d7610(_0x56d835['error'][_0xb07d('0x13')]);}logger[_0xb07d('0x10')](_0xb07d('0x12'),_0x380ee4,_0x56d835[_0xb07d('0x10')]['message']);return _0x4f6871(_0x56d835[_0xb07d('0x10')]['message']);}else{logger['info'](_0xb07d('0x12'),_0x380ee4,'request\x20sent');_0x4f6871(_0x56d835[_0xb07d('0x14')]['message']);}})[_0xb07d('0x15')](function(_0x47ff62){logger[_0xb07d('0x10')](_0xb07d('0x12'),_0x380ee4,_0x47ff62);_0x2d7610(_0x47ff62);});});}exports[_0xb07d('0x16')]=function(_0x307224){var _0x52d3cc=this;return new Promise(function(_0x5ae653,_0x66a076){return db[_0xb07d('0x17')]['findAll']({'raw':_0x307224[_0xb07d('0x18')]?_0x307224['options'][_0xb07d('0x19')]===undefined?!![]:![]:!![],'where':_0x307224[_0xb07d('0x18')]?_0x307224[_0xb07d('0x18')][_0xb07d('0x1a')]||null:null,'attributes':_0x307224['options']?_0x307224[_0xb07d('0x18')]['attributes']||null:null,'limit':_0x307224[_0xb07d('0x18')]?_0x307224[_0xb07d('0x18')][_0xb07d('0x1b')]||null:null,'include':_0x307224[_0xb07d('0x18')]?_0x307224['options']['include']?_[_0xb07d('0x1c')](_0x307224[_0xb07d('0x18')][_0xb07d('0x1d')],function(_0x2ad8c0){return{'model':db[_0x2ad8c0['model']],'as':_0x2ad8c0['as'],'attributes':_0x2ad8c0[_0xb07d('0x1e')],'include':_0x2ad8c0[_0xb07d('0x1d')]?_['map'](_0x2ad8c0[_0xb07d('0x1d')],function(_0x253d93){return{'model':db[_0x253d93['model']],'as':_0x253d93['as'],'attributes':_0x253d93[_0xb07d('0x1e')],'include':_0x253d93['include']?_[_0xb07d('0x1c')](_0x253d93[_0xb07d('0x1d')],function(_0x22979a){return{'model':db[_0x22979a[_0xb07d('0x1f')]],'as':_0x22979a['as'],'attributes':_0x22979a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x582a9d){logger['info']('GetSugarcrmAccount',_0x307224);logger[_0xb07d('0xd')]('GetSugarcrmAccount',_0x307224,JSON[_0xb07d('0x20')](_0x582a9d));_0x5ae653(_0x582a9d);})[_0xb07d('0x15')](function(_0x261768){logger['error']('GetSugarcrmAccount',_0x261768[_0xb07d('0x13')],_0x307224);_0x66a076(_0x52d3cc[_0xb07d('0x10')](0x1f4,_0x261768['message']));});});};exports[_0xb07d('0x21')]=function(_0x4d449e){var _0x2a960e=this;return new Promise(function(_0x4033af,_0x60023b){return db[_0xb07d('0x17')][_0xb07d('0x22')]({'raw':_0x4d449e[_0xb07d('0x18')]?_0x4d449e[_0xb07d('0x18')][_0xb07d('0x19')]===undefined?!![]:![]:!![],'where':_0x4d449e[_0xb07d('0x18')]?_0x4d449e[_0xb07d('0x18')]['where']||null:null,'attributes':_0x4d449e['options']?_0x4d449e[_0xb07d('0x18')][_0xb07d('0x1e')]||null:null,'include':_0x4d449e[_0xb07d('0x18')]?_0x4d449e['options'][_0xb07d('0x1d')]?_['map'](_0x4d449e[_0xb07d('0x18')][_0xb07d('0x1d')],function(_0x2f51c1){return{'model':db[_0x2f51c1[_0xb07d('0x1f')]],'as':_0x2f51c1['as'],'attributes':_0x2f51c1['attributes'],'include':_0x2f51c1[_0xb07d('0x1d')]?_[_0xb07d('0x1c')](_0x2f51c1[_0xb07d('0x1d')],function(_0x590cb7){return{'model':db[_0x590cb7[_0xb07d('0x1f')]],'as':_0x590cb7['as'],'attributes':_0x590cb7['attributes'],'include':_0x590cb7[_0xb07d('0x1d')]?_[_0xb07d('0x1c')](_0x590cb7[_0xb07d('0x1d')],function(_0x2fdcbb){return{'model':db[_0x2fdcbb[_0xb07d('0x1f')]],'as':_0x2fdcbb['as'],'attributes':_0x2fdcbb['attributes']};}):[]};}):[]};}):[]:[]})[_0xb07d('0xb')](function(_0x23040f){logger['info'](_0xb07d('0x21'),_0x4d449e);logger[_0xb07d('0xd')](_0xb07d('0x21'),_0x4d449e,JSON[_0xb07d('0x20')](_0x23040f));_0x4033af(_0x23040f);})['catch'](function(_0x8bc743){logger[_0xb07d('0x10')](_0xb07d('0x21'),_0x8bc743[_0xb07d('0x13')],_0x4d449e);_0x60023b(_0x2a960e[_0xb07d('0x10')](0x1f4,_0x8bc743['message']));});});}; \ No newline at end of file +var _0xf15f=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','options','where','attributes','limit','include','model','then','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find','map','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1c9cfb,_0x4efc3b){var _0x32436a=function(_0x6836da){while(--_0x6836da){_0x1c9cfb['push'](_0x1c9cfb['shift']());}};_0x32436a(++_0x4efc3b);}(_0xf15f,0x160));var _0xff15=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xf15f[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xff15('0x0'));var util=require(_0xff15('0x1'));var moment=require('moment');var BPromise=require(_0xff15('0x2'));var rs=require(_0xff15('0x3'));var fs=require('fs');var Redis=require(_0xff15('0x4'));var db=require(_0xff15('0x5'))['db'];var utils=require(_0xff15('0x6'));var logger=require(_0xff15('0x7'))(_0xff15('0x8'));var config=require(_0xff15('0x9'));var jayson=require(_0xff15('0xa'));var client=jayson[_0xff15('0xb')][_0xff15('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xfd2c09,_0x17b9af,_0x733af3){return new BPromise(function(_0x46a491,_0x4db6eb){return client[_0xff15('0xd')](_0xfd2c09,_0x733af3)['then'](function(_0x333ef8){logger[_0xff15('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x17b9af,_0xff15('0xf'));logger[_0xff15('0x10')](_0xff15('0x11'),_0x17b9af,'request\x20sent',JSON[_0xff15('0x12')](_0x333ef8));if(_0x333ef8['error']){if(_0x333ef8[_0xff15('0x13')]['code']===0x1f4){logger['error'](_0xff15('0x14'),_0x17b9af,_0x333ef8[_0xff15('0x13')][_0xff15('0x15')]);return _0x4db6eb(_0x333ef8[_0xff15('0x13')][_0xff15('0x15')]);}logger[_0xff15('0x13')](_0xff15('0x14'),_0x17b9af,_0x333ef8[_0xff15('0x13')][_0xff15('0x15')]);return _0x46a491(_0x333ef8[_0xff15('0x13')][_0xff15('0x15')]);}else{logger['info'](_0xff15('0x14'),_0x17b9af,_0xff15('0xf'));_0x46a491(_0x333ef8[_0xff15('0x16')][_0xff15('0x15')]);}})[_0xff15('0x17')](function(_0x384114){logger[_0xff15('0x13')](_0xff15('0x14'),_0x17b9af,_0x384114);_0x4db6eb(_0x384114);});});}exports['GetSugarcrmAccount']=function(_0x5e9996){var _0xd5bbe3=this;return new Promise(function(_0x1c15e0,_0x287b22){return db['SugarcrmAccount']['findAll']({'raw':_0x5e9996[_0xff15('0x18')]?_0x5e9996['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e9996[_0xff15('0x18')]?_0x5e9996[_0xff15('0x18')][_0xff15('0x19')]||null:null,'attributes':_0x5e9996['options']?_0x5e9996[_0xff15('0x18')][_0xff15('0x1a')]||null:null,'limit':_0x5e9996[_0xff15('0x18')]?_0x5e9996[_0xff15('0x18')][_0xff15('0x1b')]||null:null,'include':_0x5e9996[_0xff15('0x18')]?_0x5e9996[_0xff15('0x18')]['include']?_['map'](_0x5e9996[_0xff15('0x18')][_0xff15('0x1c')],function(_0xdb0817){return{'model':db[_0xdb0817[_0xff15('0x1d')]],'as':_0xdb0817['as'],'attributes':_0xdb0817[_0xff15('0x1a')],'include':_0xdb0817[_0xff15('0x1c')]?_['map'](_0xdb0817[_0xff15('0x1c')],function(_0x4b4aa6){return{'model':db[_0x4b4aa6[_0xff15('0x1d')]],'as':_0x4b4aa6['as'],'attributes':_0x4b4aa6[_0xff15('0x1a')],'include':_0x4b4aa6['include']?_['map'](_0x4b4aa6[_0xff15('0x1c')],function(_0x164976){return{'model':db[_0x164976[_0xff15('0x1d')]],'as':_0x164976['as'],'attributes':_0x164976['attributes']};}):[]};}):[]};}):[]:[]})[_0xff15('0x1e')](function(_0x5880ff){logger[_0xff15('0xe')](_0xff15('0x1f'),_0x5e9996);logger['debug'](_0xff15('0x1f'),_0x5e9996,JSON[_0xff15('0x12')](_0x5880ff));_0x1c15e0(_0x5880ff);})['catch'](function(_0x4ea52e){logger[_0xff15('0x13')](_0xff15('0x1f'),_0x4ea52e[_0xff15('0x15')],_0x5e9996);_0x287b22(_0xd5bbe3[_0xff15('0x13')](0x1f4,_0x4ea52e['message']));});});};exports[_0xff15('0x20')]=function(_0x2225e5){var _0x10f58a=this;return new Promise(function(_0x26b3bd,_0x52e08f){return db[_0xff15('0x21')][_0xff15('0x22')]({'raw':_0x2225e5[_0xff15('0x18')]?_0x2225e5[_0xff15('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2225e5['options']?_0x2225e5[_0xff15('0x18')][_0xff15('0x19')]||null:null,'attributes':_0x2225e5[_0xff15('0x18')]?_0x2225e5[_0xff15('0x18')][_0xff15('0x1a')]||null:null,'include':_0x2225e5[_0xff15('0x18')]?_0x2225e5['options']['include']?_[_0xff15('0x23')](_0x2225e5[_0xff15('0x18')][_0xff15('0x1c')],function(_0x74585){return{'model':db[_0x74585[_0xff15('0x1d')]],'as':_0x74585['as'],'attributes':_0x74585[_0xff15('0x1a')],'include':_0x74585['include']?_['map'](_0x74585[_0xff15('0x1c')],function(_0x1fd752){return{'model':db[_0x1fd752['model']],'as':_0x1fd752['as'],'attributes':_0x1fd752[_0xff15('0x1a')],'include':_0x1fd752[_0xff15('0x1c')]?_[_0xff15('0x23')](_0x1fd752['include'],function(_0x3fcf4b){return{'model':db[_0x3fcf4b[_0xff15('0x1d')]],'as':_0x3fcf4b['as'],'attributes':_0x3fcf4b[_0xff15('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xff15('0x1e')](function(_0x4c8f59){logger['info'](_0xff15('0x20'),_0x2225e5);logger[_0xff15('0x10')](_0xff15('0x20'),_0x2225e5,JSON[_0xff15('0x12')](_0x4c8f59));_0x26b3bd(_0x4c8f59);})[_0xff15('0x17')](function(_0x3fca8d){logger[_0xff15('0x13')](_0xff15('0x20'),_0x3fca8d[_0xff15('0x15')],_0x2225e5);_0x52e08f(_0x10f58a[_0xff15('0x13')](0x1f4,_0x3fca8d[_0xff15('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index d9f8b89..961c08a 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 _0x04e6=['create','put','update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','getDescriptions','post'];(function(_0x15d756,_0x419438){var _0x191b5f=function(_0x21e0a4){while(--_0x21e0a4){_0x15d756['push'](_0x15d756['shift']());}};_0x191b5f(++_0x419438);}(_0x04e6,0x1be));var _0x604e=function(_0x1ae31c,_0x8dcd2d){_0x1ae31c=_0x1ae31c-0x0;var _0x19519d=_0x04e6[_0x1ae31c];return _0x19519d;};'use strict';var multer=require('multer');var util=require(_0x604e('0x0'));var path=require(_0x604e('0x1'));var timeout=require('connect-timeout');var express=require(_0x604e('0x2'));var router=express[_0x604e('0x3')]();var auth=require(_0x604e('0x4'));var interaction=require(_0x604e('0x5'));var config=require('../../config/environment');var controller=require(_0x604e('0x6'));router[_0x604e('0x7')]('/',auth[_0x604e('0x8')](),controller[_0x604e('0x9')]);router['get'](_0x604e('0xa'),auth[_0x604e('0x8')](),controller[_0x604e('0xb')]);router[_0x604e('0x7')]('/:id/fields',auth[_0x604e('0x8')](),controller['getFields']);router['get'](_0x604e('0xc'),auth[_0x604e('0x8')](),controller[_0x604e('0xd')]);router[_0x604e('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x604e('0xe')]);router[_0x604e('0xf')]('/',auth['isAuthenticated'](),controller[_0x604e('0x10')]);router[_0x604e('0x11')](_0x604e('0xa'),auth[_0x604e('0x8')](),controller[_0x604e('0x12')]);router['delete'](_0x604e('0xa'),auth['isAuthenticated'](),controller[_0x604e('0x13')]);module[_0x604e('0x14')]=router; \ No newline at end of file +var _0x480b=['/:id/fields','getFields','getDescriptions','put','delete','destroy','exports','path','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id'];(function(_0x49d21f,_0x6e7f5){var _0x1b93f2=function(_0x1cd8e7){while(--_0x1cd8e7){_0x49d21f['push'](_0x49d21f['shift']());}};_0x1b93f2(++_0x6e7f5);}(_0x480b,0x177));var _0xb480=function(_0x5aeaa2,_0x431b8b){_0x5aeaa2=_0x5aeaa2-0x0;var _0x224ec2=_0x480b[_0x5aeaa2];return _0x224ec2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb480('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb480('0x1')]();var auth=require(_0xb480('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xb480('0x3'));var controller=require(_0xb480('0x4'));router['get']('/',auth[_0xb480('0x5')](),controller[_0xb480('0x6')]);router[_0xb480('0x7')](_0xb480('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xb480('0x7')](_0xb480('0x9'),auth[_0xb480('0x5')](),controller[_0xb480('0xa')]);router[_0xb480('0x7')]('/:id/subjects',auth[_0xb480('0x5')](),controller['getSubjects']);router[_0xb480('0x7')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xb480('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb480('0xc')](_0xb480('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xb480('0xd')](_0xb480('0x8'),auth[_0xb480('0x5')](),controller[_0xb480('0xe')]);module[_0xb480('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 45c8cae..fc2e911 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 _0x83d0=['sequelize','exports','STRING'];(function(_0x17e69b,_0x512806){var _0x55eea8=function(_0x510384){while(--_0x510384){_0x17e69b['push'](_0x17e69b['shift']());}};_0x55eea8(++_0x512806);}(_0x83d0,0x8d));var _0x083d=function(_0x3dc5c4,_0x305733){_0x3dc5c4=_0x3dc5c4-0x0;var _0x2f6ec1=_0x83d0[_0x3dc5c4];return _0x2f6ec1;};'use strict';var Sequelize=require(_0x083d('0x0'));module[_0x083d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x083d('0x2')]}}; \ No newline at end of file +var _0x443c=['STRING','sequelize','exports'];(function(_0x30b367,_0x2cd6c3){var _0x7f99ef=function(_0x1d53bc){while(--_0x1d53bc){_0x30b367['push'](_0x30b367['shift']());}};_0x7f99ef(++_0x2cd6c3);}(_0x443c,0x199));var _0xc443=function(_0xc56c3,_0x3f6ba2){_0xc56c3=_0xc56c3-0x0;var _0x6fabbb=_0x443c[_0xc56c3];return _0x6fabbb;};'use strict';var Sequelize=require(_0xc443('0x0'));module[_0xc443('0x1')]={'name':{'type':Sequelize[_0xc443('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 52b03c7..cf4aa15 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 _0x1dcc=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','count','findAll','rows','show','params','includeAll','include','find','create','update','body','destroy','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','offset','limit','Content-Range','json','apply','save','then','end','sendStatus','stack','name','map','SugarcrmConfiguration','rawAttributes','type','model','query','keys','filters','intersection'];(function(_0x12edae,_0x389154){var _0x2370f7=function(_0x558e03){while(--_0x558e03){_0x12edae['push'](_0x12edae['shift']());}};_0x2370f7(++_0x389154);}(_0x1dcc,0x77));var _0xc1dc=function(_0x2ad270,_0x12bd60){_0x2ad270=_0x2ad270-0x0;var _0x50ef45=_0x1dcc[_0x2ad270];return _0x50ef45;};'use strict';var pdf=require(_0xc1dc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc1dc('0x1'));var jsonpatch=require(_0xc1dc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc1dc('0x3'));var Mustache=require(_0xc1dc('0x4'));var util=require(_0xc1dc('0x5'));var path=require(_0xc1dc('0x6'));var sox=require(_0xc1dc('0x7'));var csv=require(_0xc1dc('0x8'));var ejs=require(_0xc1dc('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc1dc('0xa'));var crypto=require(_0xc1dc('0xb'));var jsforce=require(_0xc1dc('0xc'));var deskjs=require(_0xc1dc('0xd'));var toCsv=require(_0xc1dc('0x8'));var querystring=require(_0xc1dc('0xe'));var Papa=require(_0xc1dc('0xf'));var Redis=require(_0xc1dc('0x10'));var authService=require(_0xc1dc('0x11'));var qs=require(_0xc1dc('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc1dc('0x13'));var logger=require(_0xc1dc('0x14'))('api');var utils=require(_0xc1dc('0x15'));var config=require(_0xc1dc('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0xc1dc('0x17'));var client=jayson[_0xc1dc('0x18')][_0xc1dc('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2d407c,_0x41679c,_0x418f8c){if(_0x418f8c){var _0x18a8a2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x18a8a2['test'](_0x41679c)){return _0x2d407c;}else{throw new db[(_0xc1dc('0x1a'))][(_0xc1dc('0x1b'))](_0xc1dc('0x1c'));}}else{return _0x2d407c;}}function respondWithRpcPromise(_0x775ee4,_0xdfbe60,_0x31191a,_0x209355){return new BPromise(function(_0x1edb66,_0x4b7fd5){var _0x5dd754=_0x209355||client;return _0x5dd754['request'](_0x775ee4,_0x31191a)['then'](function(_0x2e2d8e){logger[_0xc1dc('0x1d')](_0xc1dc('0x1e'),_0xdfbe60,_0xc1dc('0x1f'));logger[_0xc1dc('0x20')](_0xc1dc('0x21'),_0xdfbe60,'request\x20sent',JSON[_0xc1dc('0x22')](_0x2e2d8e));if(_0x2e2d8e[_0xc1dc('0x23')]){if(_0x2e2d8e[_0xc1dc('0x23')]['code']===0x1f4){logger[_0xc1dc('0x23')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xdfbe60,_0x2e2d8e[_0xc1dc('0x23')][_0xc1dc('0x24')]);return _0x4b7fd5(_0x2e2d8e[_0xc1dc('0x23')][_0xc1dc('0x24')]);}logger[_0xc1dc('0x23')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xdfbe60,_0x2e2d8e[_0xc1dc('0x23')][_0xc1dc('0x24')]);return _0x1edb66(_0x2e2d8e[_0xc1dc('0x23')][_0xc1dc('0x24')]);}else{logger['info'](_0xc1dc('0x1e'),_0xdfbe60,_0xc1dc('0x1f'));_0x1edb66(_0x2e2d8e['result'][_0xc1dc('0x24')]);}})[_0xc1dc('0x25')](function(_0x13998b){logger[_0xc1dc('0x23')](_0xc1dc('0x1e'),_0xdfbe60,_0x13998b);_0x4b7fd5(_0x13998b);});});}function respondWithStatusCode(_0x454ed2,_0x55e6f9){_0x55e6f9=_0x55e6f9||0xcc;return function(_0x509a4a){if(_0x509a4a){return _0x454ed2['sendStatus'](_0x55e6f9);}return _0x454ed2[_0xc1dc('0x26')](_0x55e6f9)['end']();};}function respondWithResult(_0x10d1a8,_0x2c6114){_0x2c6114=_0x2c6114||0xc8;return function(_0x413bc7){if(_0x413bc7){return _0x10d1a8['status'](_0x2c6114)['json'](_0x413bc7);}};}function respondWithFilteredResult(_0x2b14de,_0x418072){return function(_0x3a8b7f){if(_0x3a8b7f){var _0x1dc7bc=_0x3a8b7f['count'],_0x1745b2=_0x418072[_0xc1dc('0x27')],_0x1ae9d1=_0x418072['offset']+_0x418072[_0xc1dc('0x28')],_0x560e05;if(_0x1ae9d1>=_0x1dc7bc){_0x1ae9d1=_0x1dc7bc;_0x560e05=0xc8;}else{_0x560e05=0xce;}_0x2b14de['status'](_0x560e05);return _0x2b14de['set'](_0xc1dc('0x29'),_0x1745b2+'-'+_0x1ae9d1+'/'+_0x1dc7bc)[_0xc1dc('0x2a')](_0x3a8b7f);}return null;};}function patchUpdates(_0xfeab2a){return function(_0x2aface){try{jsonpatch[_0xc1dc('0x2b')](_0x2aface,_0xfeab2a,!![]);}catch(_0x285606){return BPromise['reject'](_0x285606);}return _0x2aface[_0xc1dc('0x2c')]();};}function saveUpdates(_0x77eaa7,_0x50b25b){return function(_0x447650){if(_0x447650){return _0x447650['update'](_0x77eaa7)[_0xc1dc('0x2d')](function(_0x320802){return _0x320802;});}return null;};}function removeEntity(_0x374b8e,_0x5e63c0){return function(_0x3ad22e){if(_0x3ad22e){return _0x3ad22e['destroy']()[_0xc1dc('0x2d')](function(){_0x374b8e[_0xc1dc('0x26')](0xcc)[_0xc1dc('0x2e')]();});}};}function handleEntityNotFound(_0x48954f,_0x385773){return function(_0x15957b){if(!_0x15957b){_0x48954f[_0xc1dc('0x2f')](0x194);}return _0x15957b;};}function handleError(_0x221f33,_0x5b8ee4){_0x5b8ee4=_0x5b8ee4||0x1f4;return function(_0x5cbe71){logger['error'](_0x5cbe71[_0xc1dc('0x30')]);if(_0x5cbe71[_0xc1dc('0x31')]){delete _0x5cbe71[_0xc1dc('0x31')];}_0x221f33[_0xc1dc('0x26')](_0x5b8ee4)['send'](_0x5cbe71);};}exports['index']=function(_0x5660e0,_0x46761f){var _0x176d38={},_0x219021={},_0x59dcce={'count':0x0,'rows':[]};var _0x1ca665=_[_0xc1dc('0x32')](db[_0xc1dc('0x33')][_0xc1dc('0x34')],function(_0x583462){return{'name':_0x583462['fieldName'],'type':_0x583462[_0xc1dc('0x35')]['key']};});_0x219021[_0xc1dc('0x36')]=_[_0xc1dc('0x32')](_0x1ca665,_0xc1dc('0x31'));_0x219021[_0xc1dc('0x37')]=_[_0xc1dc('0x38')](_0x5660e0[_0xc1dc('0x37')]);_0x219021[_0xc1dc('0x39')]=_[_0xc1dc('0x3a')](_0x219021[_0xc1dc('0x36')],_0x219021[_0xc1dc('0x37')]);_0x176d38[_0xc1dc('0x3b')]=_[_0xc1dc('0x3a')](_0x219021[_0xc1dc('0x36')],qs[_0xc1dc('0x3c')](_0x5660e0['query'][_0xc1dc('0x3c')]));_0x176d38[_0xc1dc('0x3b')]=_0x176d38[_0xc1dc('0x3b')][_0xc1dc('0x3d')]?_0x176d38[_0xc1dc('0x3b')]:_0x219021['model'];if(!_0x5660e0[_0xc1dc('0x37')][_0xc1dc('0x3e')](_0xc1dc('0x3f'))){_0x176d38[_0xc1dc('0x28')]=qs[_0xc1dc('0x28')](_0x5660e0[_0xc1dc('0x37')][_0xc1dc('0x28')]);_0x176d38[_0xc1dc('0x27')]=qs[_0xc1dc('0x27')](_0x5660e0[_0xc1dc('0x37')]['offset']);}_0x176d38[_0xc1dc('0x40')]=qs[_0xc1dc('0x41')](_0x5660e0['query'][_0xc1dc('0x41')]);_0x176d38['where']=qs[_0xc1dc('0x39')](_[_0xc1dc('0x42')](_0x5660e0[_0xc1dc('0x37')],_0x219021[_0xc1dc('0x39')]));if(_0x5660e0[_0xc1dc('0x37')][_0xc1dc('0x43')]){_0x176d38['where']=_[_0xc1dc('0x44')](_0x176d38[_0xc1dc('0x45')],{'$or':_[_0xc1dc('0x32')](_0x1ca665,function(_0x4a072c){if(_0x4a072c[_0xc1dc('0x35')]!==_0xc1dc('0x46')){var _0x59c76a={};_0x59c76a[_0x4a072c['name']]={'$like':'%'+_0x5660e0['query'][_0xc1dc('0x43')]+'%'};return _0x59c76a;}})});}_0x176d38=_[_0xc1dc('0x44')]({},_0x176d38,_0x5660e0[_0xc1dc('0x47')]);var _0xd8b94={'where':_0x176d38['where']};return db[_0xc1dc('0x33')][_0xc1dc('0x48')](_0xd8b94)['then'](function(_0x1fe9b2){_0x59dcce[_0xc1dc('0x48')]=_0x1fe9b2;if(_0x5660e0[_0xc1dc('0x37')]['includeAll']){_0x176d38['include']=[{'all':!![]}];}return db[_0xc1dc('0x33')][_0xc1dc('0x49')](_0x176d38);})[_0xc1dc('0x2d')](function(_0x36415b){_0x59dcce[_0xc1dc('0x4a')]=_0x36415b;return _0x59dcce;})[_0xc1dc('0x2d')](respondWithFilteredResult(_0x46761f,_0x176d38))[_0xc1dc('0x25')](handleError(_0x46761f,null));};exports[_0xc1dc('0x4b')]=function(_0x233673,_0x51b970){var _0x74756={'raw':![],'where':{'id':_0x233673[_0xc1dc('0x4c')]['id']}},_0x5ec10a={};_0x5ec10a[_0xc1dc('0x36')]=_[_0xc1dc('0x38')](db[_0xc1dc('0x33')][_0xc1dc('0x34')]);_0x5ec10a[_0xc1dc('0x37')]=_[_0xc1dc('0x38')](_0x233673[_0xc1dc('0x37')]);_0x5ec10a[_0xc1dc('0x39')]=_[_0xc1dc('0x3a')](_0x5ec10a[_0xc1dc('0x36')],_0x5ec10a[_0xc1dc('0x37')]);_0x74756[_0xc1dc('0x3b')]=_[_0xc1dc('0x3a')](_0x5ec10a['model'],qs['fields'](_0x233673[_0xc1dc('0x37')][_0xc1dc('0x3c')]));_0x74756['attributes']=_0x74756[_0xc1dc('0x3b')][_0xc1dc('0x3d')]?_0x74756['attributes']:_0x5ec10a[_0xc1dc('0x36')];if(_0x233673['query'][_0xc1dc('0x4d')]){_0x74756[_0xc1dc('0x4e')]=[{'all':!![]}];}_0x74756=_[_0xc1dc('0x44')]({},_0x74756,_0x233673[_0xc1dc('0x47')]);return db[_0xc1dc('0x33')][_0xc1dc('0x4f')](_0x74756)[_0xc1dc('0x2d')](handleEntityNotFound(_0x51b970,null))[_0xc1dc('0x2d')](respondWithResult(_0x51b970,null))[_0xc1dc('0x25')](handleError(_0x51b970,null));};exports[_0xc1dc('0x50')]=function(_0x50ae51,_0x4f97c0){return db[_0xc1dc('0x33')][_0xc1dc('0x50')](_0x50ae51['body'],{})['then'](respondWithResult(_0x4f97c0,0xc9))[_0xc1dc('0x25')](handleError(_0x4f97c0,null));};exports[_0xc1dc('0x51')]=function(_0x35e2a9,_0x267935){if(_0x35e2a9[_0xc1dc('0x52')]['id']){delete _0x35e2a9[_0xc1dc('0x52')]['id'];}return db[_0xc1dc('0x33')][_0xc1dc('0x4f')]({'where':{'id':_0x35e2a9[_0xc1dc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x267935,null))[_0xc1dc('0x2d')](saveUpdates(_0x35e2a9['body'],null))[_0xc1dc('0x2d')](respondWithResult(_0x267935,null))[_0xc1dc('0x25')](handleError(_0x267935,null));};exports[_0xc1dc('0x53')]=function(_0x116e01,_0x3754f7){return db['SugarcrmConfiguration'][_0xc1dc('0x4f')]({'where':{'id':_0x116e01[_0xc1dc('0x4c')]['id']}})[_0xc1dc('0x2d')](handleEntityNotFound(_0x3754f7,null))['then'](removeEntity(_0x3754f7,null))[_0xc1dc('0x25')](handleError(_0x3754f7,null));};exports[_0xc1dc('0x54')]=function(_0x1a21ae,_0x2e5d83,_0xa17370){var _0x2a62cb={};var _0x4284f4={};var _0x4836ba;var _0x5e66da;return db['SugarcrmConfiguration'][_0xc1dc('0x55')]({'where':{'id':_0x1a21ae[_0xc1dc('0x4c')]['id']}})[_0xc1dc('0x2d')](handleEntityNotFound(_0x2e5d83,null))['then'](function(_0x329747){if(_0x329747){_0x4836ba=_0x329747;_0x4284f4[_0xc1dc('0x36')]=_[_0xc1dc('0x38')](db[_0xc1dc('0x56')][_0xc1dc('0x34')]);_0x4284f4['query']=_['keys'](_0x1a21ae[_0xc1dc('0x37')]);_0x4284f4['filters']=_[_0xc1dc('0x3a')](_0x4284f4[_0xc1dc('0x36')],_0x4284f4['query']);_0x2a62cb['attributes']=_[_0xc1dc('0x3a')](_0x4284f4[_0xc1dc('0x36')],qs['fields'](_0x1a21ae[_0xc1dc('0x37')][_0xc1dc('0x3c')]));_0x2a62cb[_0xc1dc('0x3b')]=_0x2a62cb[_0xc1dc('0x3b')]['length']?_0x2a62cb['attributes']:_0x4284f4['model'];_0x2a62cb['order']=qs['sort'](_0x1a21ae['query'][_0xc1dc('0x41')]);_0x2a62cb['where']=qs[_0xc1dc('0x39')](_['pick'](_0x1a21ae[_0xc1dc('0x37')],_0x4284f4['filters']));if(_0x1a21ae[_0xc1dc('0x37')][_0xc1dc('0x43')]){_0x2a62cb[_0xc1dc('0x45')]=_[_0xc1dc('0x44')](_0x2a62cb[_0xc1dc('0x45')],{'$or':_[_0xc1dc('0x32')](_0x2a62cb[_0xc1dc('0x3b')],function(_0x396473){var _0xc3fbd0={};_0xc3fbd0[_0x396473]={'$like':'%'+_0x1a21ae['query']['filter']+'%'};return _0xc3fbd0;})});}_0x2a62cb=_[_0xc1dc('0x44')]({},_0x2a62cb,_0x1a21ae[_0xc1dc('0x47')]);return _0x4836ba[_0xc1dc('0x54')](_0x2a62cb);}})[_0xc1dc('0x2d')](function(_0x122207){if(_0x122207){_0x5e66da=_0x122207[_0xc1dc('0x3d')];if(!_0x1a21ae['query'][_0xc1dc('0x3e')](_0xc1dc('0x3f'))){_0x2a62cb[_0xc1dc('0x28')]=qs[_0xc1dc('0x28')](_0x1a21ae['query'][_0xc1dc('0x28')]);_0x2a62cb[_0xc1dc('0x27')]=qs[_0xc1dc('0x27')](_0x1a21ae['query'][_0xc1dc('0x27')]);}return _0x4836ba['getFields'](_0x2a62cb);}})[_0xc1dc('0x2d')](function(_0x29d6ed){if(_0x29d6ed){return _0x29d6ed?{'count':_0x5e66da,'rows':_0x29d6ed}:null;}})[_0xc1dc('0x2d')](respondWithResult(_0x2e5d83,null))[_0xc1dc('0x25')](handleError(_0x2e5d83,null));};exports[_0xc1dc('0x57')]=function(_0x4a9f83,_0x4748de,_0xa5598f){var _0x408bcb={};var _0x5f46a9={};var _0x5ac82b;var _0x4fc697;return db[_0xc1dc('0x33')]['findOne']({'where':{'id':_0x4a9f83[_0xc1dc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4748de,null))[_0xc1dc('0x2d')](function(_0x2550bc){if(_0x2550bc){_0x5ac82b=_0x2550bc;_0x5f46a9['model']=_[_0xc1dc('0x38')](db[_0xc1dc('0x56')][_0xc1dc('0x34')]);_0x5f46a9[_0xc1dc('0x37')]=_[_0xc1dc('0x38')](_0x4a9f83['query']);_0x5f46a9[_0xc1dc('0x39')]=_[_0xc1dc('0x3a')](_0x5f46a9['model'],_0x5f46a9['query']);_0x408bcb[_0xc1dc('0x3b')]=_[_0xc1dc('0x3a')](_0x5f46a9['model'],qs[_0xc1dc('0x3c')](_0x4a9f83[_0xc1dc('0x37')]['fields']));_0x408bcb[_0xc1dc('0x3b')]=_0x408bcb['attributes']['length']?_0x408bcb[_0xc1dc('0x3b')]:_0x5f46a9[_0xc1dc('0x36')];_0x408bcb['order']=qs[_0xc1dc('0x41')](_0x4a9f83[_0xc1dc('0x37')]['sort']);_0x408bcb['where']=qs[_0xc1dc('0x39')](_[_0xc1dc('0x42')](_0x4a9f83[_0xc1dc('0x37')],_0x5f46a9[_0xc1dc('0x39')]));if(_0x4a9f83[_0xc1dc('0x37')][_0xc1dc('0x43')]){_0x408bcb['where']=_[_0xc1dc('0x44')](_0x408bcb[_0xc1dc('0x45')],{'$or':_['map'](_0x408bcb[_0xc1dc('0x3b')],function(_0x1cfb1c){var _0x1fabb1={};_0x1fabb1[_0x1cfb1c]={'$like':'%'+_0x4a9f83[_0xc1dc('0x37')][_0xc1dc('0x43')]+'%'};return _0x1fabb1;})});}_0x408bcb=_[_0xc1dc('0x44')]({},_0x408bcb,_0x4a9f83['options']);return _0x5ac82b[_0xc1dc('0x57')](_0x408bcb);}})[_0xc1dc('0x2d')](function(_0x1fe49c){if(_0x1fe49c){_0x4fc697=_0x1fe49c['length'];if(!_0x4a9f83[_0xc1dc('0x37')][_0xc1dc('0x3e')](_0xc1dc('0x3f'))){_0x408bcb[_0xc1dc('0x28')]=qs[_0xc1dc('0x28')](_0x4a9f83[_0xc1dc('0x37')][_0xc1dc('0x28')]);_0x408bcb[_0xc1dc('0x27')]=qs[_0xc1dc('0x27')](_0x4a9f83[_0xc1dc('0x37')]['offset']);}return _0x5ac82b['getSubjects'](_0x408bcb);}})[_0xc1dc('0x2d')](function(_0x5f10e8){if(_0x5f10e8){return _0x5f10e8?{'count':_0x4fc697,'rows':_0x5f10e8}:null;}})[_0xc1dc('0x2d')](respondWithResult(_0x4748de,null))[_0xc1dc('0x25')](handleError(_0x4748de,null));};exports[_0xc1dc('0x58')]=function(_0x6dbca3,_0x2d60ac,_0x5f38f3){var _0x1eb898={};var _0x194e49={};var _0x1cbfbc;var _0x57bf9d;return db[_0xc1dc('0x33')][_0xc1dc('0x55')]({'where':{'id':_0x6dbca3[_0xc1dc('0x4c')]['id']}})[_0xc1dc('0x2d')](handleEntityNotFound(_0x2d60ac,null))[_0xc1dc('0x2d')](function(_0x3c80b1){if(_0x3c80b1){_0x1cbfbc=_0x3c80b1;_0x194e49[_0xc1dc('0x36')]=_[_0xc1dc('0x38')](db[_0xc1dc('0x56')][_0xc1dc('0x34')]);_0x194e49[_0xc1dc('0x37')]=_['keys'](_0x6dbca3['query']);_0x194e49[_0xc1dc('0x39')]=_['intersection'](_0x194e49[_0xc1dc('0x36')],_0x194e49['query']);_0x1eb898[_0xc1dc('0x3b')]=_['intersection'](_0x194e49[_0xc1dc('0x36')],qs[_0xc1dc('0x3c')](_0x6dbca3[_0xc1dc('0x37')]['fields']));_0x1eb898[_0xc1dc('0x3b')]=_0x1eb898[_0xc1dc('0x3b')]['length']?_0x1eb898['attributes']:_0x194e49[_0xc1dc('0x36')];_0x1eb898['order']=qs[_0xc1dc('0x41')](_0x6dbca3['query'][_0xc1dc('0x41')]);_0x1eb898[_0xc1dc('0x45')]=qs[_0xc1dc('0x39')](_[_0xc1dc('0x42')](_0x6dbca3['query'],_0x194e49[_0xc1dc('0x39')]));if(_0x6dbca3[_0xc1dc('0x37')][_0xc1dc('0x43')]){_0x1eb898[_0xc1dc('0x45')]=_[_0xc1dc('0x44')](_0x1eb898[_0xc1dc('0x45')],{'$or':_['map'](_0x1eb898['attributes'],function(_0x1c6b4c){var _0x40bbe7={};_0x40bbe7[_0x1c6b4c]={'$like':'%'+_0x6dbca3[_0xc1dc('0x37')][_0xc1dc('0x43')]+'%'};return _0x40bbe7;})});}_0x1eb898=_[_0xc1dc('0x44')]({},_0x1eb898,_0x6dbca3[_0xc1dc('0x47')]);return _0x1cbfbc['getDescriptions'](_0x1eb898);}})['then'](function(_0x22c2de){if(_0x22c2de){_0x57bf9d=_0x22c2de[_0xc1dc('0x3d')];if(!_0x6dbca3[_0xc1dc('0x37')][_0xc1dc('0x3e')]('nolimit')){_0x1eb898[_0xc1dc('0x28')]=qs[_0xc1dc('0x28')](_0x6dbca3[_0xc1dc('0x37')][_0xc1dc('0x28')]);_0x1eb898[_0xc1dc('0x27')]=qs[_0xc1dc('0x27')](_0x6dbca3[_0xc1dc('0x37')][_0xc1dc('0x27')]);}return _0x1cbfbc[_0xc1dc('0x58')](_0x1eb898);}})[_0xc1dc('0x2d')](function(_0x492231){if(_0x492231){return _0x492231?{'count':_0x57bf9d,'rows':_0x492231}:null;}})[_0xc1dc('0x2d')](respondWithResult(_0x2d60ac,null))[_0xc1dc('0x25')](handleError(_0x2d60ac,null));}; \ No newline at end of file +var _0x8962=['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','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','count','limit','set','Content-Range','reject','update','destroy','end','name','send','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','model','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','length','includeAll','find','create','body','getFields','findOne','SugarcrmField','sort','pick','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client'];(function(_0x17f62a,_0x278b44){var _0xf10db0=function(_0x3b9423){while(--_0x3b9423){_0x17f62a['push'](_0x17f62a['shift']());}};_0xf10db0(++_0x278b44);}(_0x8962,0xfe));var _0x2896=function(_0x564570,_0x3a5122){_0x564570=_0x564570-0x0;var _0x4c0155=_0x8962[_0x564570];return _0x4c0155;};'use strict';var pdf=require(_0x2896('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2896('0x1'));var zipdir=require(_0x2896('0x2'));var jsonpatch=require(_0x2896('0x3'));var rp=require(_0x2896('0x4'));var moment=require(_0x2896('0x5'));var BPromise=require(_0x2896('0x6'));var Mustache=require(_0x2896('0x7'));var util=require('util');var path=require(_0x2896('0x8'));var sox=require(_0x2896('0x9'));var csv=require('to-csv');var ejs=require(_0x2896('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2896('0xb'));var crypto=require(_0x2896('0xc'));var jsforce=require(_0x2896('0xd'));var deskjs=require(_0x2896('0xe'));var toCsv=require(_0x2896('0xf'));var querystring=require(_0x2896('0x10'));var Papa=require(_0x2896('0x11'));var Redis=require(_0x2896('0x12'));var authService=require(_0x2896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2896('0x14'));var hardwareService=require(_0x2896('0x15'));var logger=require('../../config/logger')(_0x2896('0x16'));var utils=require(_0x2896('0x17'));var config=require(_0x2896('0x18'));var db=require(_0x2896('0x19'))['db'];var jayson=require(_0x2896('0x1a'));var client=jayson[_0x2896('0x1b')][_0x2896('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x53379c,_0x4e1e86,_0x1c7a6f){if(_0x1c7a6f){var _0x50a89a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50a89a['test'](_0x4e1e86)){return _0x53379c;}else{throw new db[(_0x2896('0x1d'))]['ValidationError'](_0x2896('0x1e'));}}else{return _0x53379c;}}function respondWithRpcPromise(_0xcfe48c,_0xeb677c,_0x214f9d,_0x3e7f03){return new BPromise(function(_0xb117bc,_0x205961){var _0x284fc3=_0x3e7f03||client;return _0x284fc3[_0x2896('0x1f')](_0xcfe48c,_0x214f9d)[_0x2896('0x20')](function(_0x412727){logger['info'](_0x2896('0x21'),_0xeb677c,_0x2896('0x22'));logger['debug'](_0x2896('0x23'),_0xeb677c,_0x2896('0x22'),JSON[_0x2896('0x24')](_0x412727));if(_0x412727[_0x2896('0x25')]){if(_0x412727[_0x2896('0x25')][_0x2896('0x26')]===0x1f4){logger[_0x2896('0x25')](_0x2896('0x21'),_0xeb677c,_0x412727[_0x2896('0x25')][_0x2896('0x27')]);return _0x205961(_0x412727[_0x2896('0x25')][_0x2896('0x27')]);}logger[_0x2896('0x25')](_0x2896('0x21'),_0xeb677c,_0x412727[_0x2896('0x25')][_0x2896('0x27')]);return _0xb117bc(_0x412727[_0x2896('0x25')][_0x2896('0x27')]);}else{logger[_0x2896('0x28')](_0x2896('0x21'),_0xeb677c,_0x2896('0x22'));_0xb117bc(_0x412727[_0x2896('0x29')][_0x2896('0x27')]);}})[_0x2896('0x2a')](function(_0x9bb69c){logger[_0x2896('0x25')](_0x2896('0x21'),_0xeb677c,_0x9bb69c);_0x205961(_0x9bb69c);});});}function respondWithStatusCode(_0x44cb33,_0xb055a){_0xb055a=_0xb055a||0xcc;return function(_0x1ccd0d){if(_0x1ccd0d){return _0x44cb33[_0x2896('0x2b')](_0xb055a);}return _0x44cb33[_0x2896('0x2c')](_0xb055a)['end']();};}function respondWithResult(_0x560302,_0xba82){_0xba82=_0xba82||0xc8;return function(_0x4ca252){if(_0x4ca252){return _0x560302[_0x2896('0x2c')](_0xba82)['json'](_0x4ca252);}};}function respondWithFilteredResult(_0x3d4e12,_0x1838ce){return function(_0x37d1bf){if(_0x37d1bf){var _0x1ec15e=_0x37d1bf[_0x2896('0x2d')],_0x25574b=_0x1838ce['offset'],_0x5007c7=_0x1838ce['offset']+_0x1838ce[_0x2896('0x2e')],_0x17dc3b;if(_0x5007c7>=_0x1ec15e){_0x5007c7=_0x1ec15e;_0x17dc3b=0xc8;}else{_0x17dc3b=0xce;}_0x3d4e12[_0x2896('0x2c')](_0x17dc3b);return _0x3d4e12[_0x2896('0x2f')](_0x2896('0x30'),_0x25574b+'-'+_0x5007c7+'/'+_0x1ec15e)['json'](_0x37d1bf);}return null;};}function patchUpdates(_0x4b9723){return function(_0x5a324a){try{jsonpatch['apply'](_0x5a324a,_0x4b9723,!![]);}catch(_0x2086b4){return BPromise[_0x2896('0x31')](_0x2086b4);}return _0x5a324a['save']();};}function saveUpdates(_0x1a702c,_0xccd0ba){return function(_0x2bb354){if(_0x2bb354){return _0x2bb354[_0x2896('0x32')](_0x1a702c)['then'](function(_0xc89de7){return _0xc89de7;});}return null;};}function removeEntity(_0x587349,_0x3e6210){return function(_0x381d2b){if(_0x381d2b){return _0x381d2b[_0x2896('0x33')]()['then'](function(){_0x587349['status'](0xcc)[_0x2896('0x34')]();});}};}function handleEntityNotFound(_0x1d1272,_0x41fc06){return function(_0x1303af){if(!_0x1303af){_0x1d1272[_0x2896('0x2b')](0x194);}return _0x1303af;};}function handleError(_0xe68f20,_0x40f263){_0x40f263=_0x40f263||0x1f4;return function(_0x36406d){logger[_0x2896('0x25')](_0x36406d['stack']);if(_0x36406d[_0x2896('0x35')]){delete _0x36406d[_0x2896('0x35')];}_0xe68f20[_0x2896('0x2c')](_0x40f263)[_0x2896('0x36')](_0x36406d);};}exports['index']=function(_0x2d8ab8,_0x5acf62){var _0x1f511d={},_0x2b35b9={},_0x186bf4={'count':0x0,'rows':[]};var _0x198614=_[_0x2896('0x37')](db[_0x2896('0x38')][_0x2896('0x39')],function(_0x31ee72){return{'name':_0x31ee72[_0x2896('0x3a')],'type':_0x31ee72[_0x2896('0x3b')][_0x2896('0x3c')]};});_0x2b35b9['model']=_[_0x2896('0x37')](_0x198614,_0x2896('0x35'));_0x2b35b9[_0x2896('0x3d')]=_['keys'](_0x2d8ab8[_0x2896('0x3d')]);_0x2b35b9['filters']=_['intersection'](_0x2b35b9[_0x2896('0x3e')],_0x2b35b9[_0x2896('0x3d')]);_0x1f511d['attributes']=_[_0x2896('0x3f')](_0x2b35b9[_0x2896('0x3e')],qs[_0x2896('0x40')](_0x2d8ab8[_0x2896('0x3d')][_0x2896('0x40')]));_0x1f511d[_0x2896('0x41')]=_0x1f511d[_0x2896('0x41')]['length']?_0x1f511d[_0x2896('0x41')]:_0x2b35b9[_0x2896('0x3e')];if(!_0x2d8ab8[_0x2896('0x3d')][_0x2896('0x42')](_0x2896('0x43'))){_0x1f511d[_0x2896('0x2e')]=qs[_0x2896('0x2e')](_0x2d8ab8['query'][_0x2896('0x2e')]);_0x1f511d[_0x2896('0x44')]=qs[_0x2896('0x44')](_0x2d8ab8['query']['offset']);}_0x1f511d[_0x2896('0x45')]=qs['sort'](_0x2d8ab8[_0x2896('0x3d')]['sort']);_0x1f511d[_0x2896('0x46')]=qs['filters'](_['pick'](_0x2d8ab8['query'],_0x2b35b9[_0x2896('0x47')]));if(_0x2d8ab8[_0x2896('0x3d')][_0x2896('0x48')]){_0x1f511d[_0x2896('0x46')]=_[_0x2896('0x49')](_0x1f511d[_0x2896('0x46')],{'$or':_['map'](_0x198614,function(_0x5467e4){if(_0x5467e4[_0x2896('0x3b')]!==_0x2896('0x4a')){var _0x21a4ac={};_0x21a4ac[_0x5467e4[_0x2896('0x35')]]={'$like':'%'+_0x2d8ab8['query'][_0x2896('0x48')]+'%'};return _0x21a4ac;}})});}_0x1f511d=_[_0x2896('0x49')]({},_0x1f511d,_0x2d8ab8[_0x2896('0x4b')]);var _0x54a2b9={'where':_0x1f511d['where']};return db['SugarcrmConfiguration'][_0x2896('0x2d')](_0x54a2b9)[_0x2896('0x20')](function(_0x24f3e2){_0x186bf4[_0x2896('0x2d')]=_0x24f3e2;if(_0x2d8ab8['query']['includeAll']){_0x1f511d[_0x2896('0x4c')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x2896('0x4d')](_0x1f511d);})[_0x2896('0x20')](function(_0x421121){_0x186bf4[_0x2896('0x4e')]=_0x421121;return _0x186bf4;})[_0x2896('0x20')](respondWithFilteredResult(_0x5acf62,_0x1f511d))[_0x2896('0x2a')](handleError(_0x5acf62,null));};exports[_0x2896('0x4f')]=function(_0xd19fde,_0x2bdb43){var _0x2ebd0e={'raw':![],'where':{'id':_0xd19fde[_0x2896('0x50')]['id']}},_0x10099d={};_0x10099d['model']=_['keys'](db[_0x2896('0x38')][_0x2896('0x39')]);_0x10099d[_0x2896('0x3d')]=_[_0x2896('0x51')](_0xd19fde['query']);_0x10099d[_0x2896('0x47')]=_[_0x2896('0x3f')](_0x10099d[_0x2896('0x3e')],_0x10099d[_0x2896('0x3d')]);_0x2ebd0e[_0x2896('0x41')]=_['intersection'](_0x10099d[_0x2896('0x3e')],qs[_0x2896('0x40')](_0xd19fde['query']['fields']));_0x2ebd0e[_0x2896('0x41')]=_0x2ebd0e[_0x2896('0x41')][_0x2896('0x52')]?_0x2ebd0e[_0x2896('0x41')]:_0x10099d['model'];if(_0xd19fde['query'][_0x2896('0x53')]){_0x2ebd0e[_0x2896('0x4c')]=[{'all':!![]}];}_0x2ebd0e=_[_0x2896('0x49')]({},_0x2ebd0e,_0xd19fde[_0x2896('0x4b')]);return db[_0x2896('0x38')][_0x2896('0x54')](_0x2ebd0e)[_0x2896('0x20')](handleEntityNotFound(_0x2bdb43,null))[_0x2896('0x20')](respondWithResult(_0x2bdb43,null))[_0x2896('0x2a')](handleError(_0x2bdb43,null));};exports[_0x2896('0x55')]=function(_0x31e300,_0x2f0542){return db[_0x2896('0x38')][_0x2896('0x55')](_0x31e300[_0x2896('0x56')],{})[_0x2896('0x20')](respondWithResult(_0x2f0542,0xc9))[_0x2896('0x2a')](handleError(_0x2f0542,null));};exports[_0x2896('0x32')]=function(_0x1dbeb4,_0x46f04b){if(_0x1dbeb4[_0x2896('0x56')]['id']){delete _0x1dbeb4[_0x2896('0x56')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x1dbeb4[_0x2896('0x50')]['id']}})[_0x2896('0x20')](handleEntityNotFound(_0x46f04b,null))[_0x2896('0x20')](saveUpdates(_0x1dbeb4[_0x2896('0x56')],null))['then'](respondWithResult(_0x46f04b,null))['catch'](handleError(_0x46f04b,null));};exports[_0x2896('0x33')]=function(_0x4d2387,_0x22fdec){return db[_0x2896('0x38')][_0x2896('0x54')]({'where':{'id':_0x4d2387[_0x2896('0x50')]['id']}})[_0x2896('0x20')](handleEntityNotFound(_0x22fdec,null))[_0x2896('0x20')](removeEntity(_0x22fdec,null))[_0x2896('0x2a')](handleError(_0x22fdec,null));};exports[_0x2896('0x57')]=function(_0x29eb58,_0x455463,_0xfb2937){var _0x2c9a8c={};var _0x386f43={};var _0xc263a7;var _0x2e3402;return db[_0x2896('0x38')][_0x2896('0x58')]({'where':{'id':_0x29eb58[_0x2896('0x50')]['id']}})[_0x2896('0x20')](handleEntityNotFound(_0x455463,null))['then'](function(_0x17ce0f){if(_0x17ce0f){_0xc263a7=_0x17ce0f;_0x386f43['model']=_['keys'](db[_0x2896('0x59')]['rawAttributes']);_0x386f43[_0x2896('0x3d')]=_[_0x2896('0x51')](_0x29eb58['query']);_0x386f43['filters']=_[_0x2896('0x3f')](_0x386f43[_0x2896('0x3e')],_0x386f43['query']);_0x2c9a8c[_0x2896('0x41')]=_['intersection'](_0x386f43[_0x2896('0x3e')],qs[_0x2896('0x40')](_0x29eb58[_0x2896('0x3d')][_0x2896('0x40')]));_0x2c9a8c[_0x2896('0x41')]=_0x2c9a8c[_0x2896('0x41')][_0x2896('0x52')]?_0x2c9a8c[_0x2896('0x41')]:_0x386f43[_0x2896('0x3e')];_0x2c9a8c[_0x2896('0x45')]=qs[_0x2896('0x5a')](_0x29eb58[_0x2896('0x3d')][_0x2896('0x5a')]);_0x2c9a8c[_0x2896('0x46')]=qs['filters'](_[_0x2896('0x5b')](_0x29eb58['query'],_0x386f43[_0x2896('0x47')]));if(_0x29eb58[_0x2896('0x3d')][_0x2896('0x48')]){_0x2c9a8c[_0x2896('0x46')]=_[_0x2896('0x49')](_0x2c9a8c[_0x2896('0x46')],{'$or':_[_0x2896('0x37')](_0x2c9a8c[_0x2896('0x41')],function(_0x4657b8){var _0x49c37c={};_0x49c37c[_0x4657b8]={'$like':'%'+_0x29eb58[_0x2896('0x3d')]['filter']+'%'};return _0x49c37c;})});}_0x2c9a8c=_[_0x2896('0x49')]({},_0x2c9a8c,_0x29eb58[_0x2896('0x4b')]);return _0xc263a7[_0x2896('0x57')](_0x2c9a8c);}})[_0x2896('0x20')](function(_0x1ab49c){if(_0x1ab49c){_0x2e3402=_0x1ab49c[_0x2896('0x52')];if(!_0x29eb58['query']['hasOwnProperty'](_0x2896('0x43'))){_0x2c9a8c[_0x2896('0x2e')]=qs[_0x2896('0x2e')](_0x29eb58[_0x2896('0x3d')][_0x2896('0x2e')]);_0x2c9a8c[_0x2896('0x44')]=qs[_0x2896('0x44')](_0x29eb58[_0x2896('0x3d')]['offset']);}return _0xc263a7[_0x2896('0x57')](_0x2c9a8c);}})[_0x2896('0x20')](function(_0x54ac37){if(_0x54ac37){return _0x54ac37?{'count':_0x2e3402,'rows':_0x54ac37}:null;}})[_0x2896('0x20')](respondWithResult(_0x455463,null))[_0x2896('0x2a')](handleError(_0x455463,null));};exports[_0x2896('0x5c')]=function(_0x594573,_0x4645fa,_0x2575d9){var _0x4f5b55={};var _0x233a3c={};var _0x370430;var _0x5a1198;return db['SugarcrmConfiguration'][_0x2896('0x58')]({'where':{'id':_0x594573[_0x2896('0x50')]['id']}})[_0x2896('0x20')](handleEntityNotFound(_0x4645fa,null))[_0x2896('0x20')](function(_0xdbb8fb){if(_0xdbb8fb){_0x370430=_0xdbb8fb;_0x233a3c[_0x2896('0x3e')]=_['keys'](db[_0x2896('0x59')][_0x2896('0x39')]);_0x233a3c['query']=_[_0x2896('0x51')](_0x594573[_0x2896('0x3d')]);_0x233a3c[_0x2896('0x47')]=_[_0x2896('0x3f')](_0x233a3c[_0x2896('0x3e')],_0x233a3c[_0x2896('0x3d')]);_0x4f5b55[_0x2896('0x41')]=_[_0x2896('0x3f')](_0x233a3c[_0x2896('0x3e')],qs[_0x2896('0x40')](_0x594573[_0x2896('0x3d')]['fields']));_0x4f5b55['attributes']=_0x4f5b55['attributes'][_0x2896('0x52')]?_0x4f5b55[_0x2896('0x41')]:_0x233a3c[_0x2896('0x3e')];_0x4f5b55[_0x2896('0x45')]=qs[_0x2896('0x5a')](_0x594573[_0x2896('0x3d')][_0x2896('0x5a')]);_0x4f5b55['where']=qs[_0x2896('0x47')](_[_0x2896('0x5b')](_0x594573[_0x2896('0x3d')],_0x233a3c[_0x2896('0x47')]));if(_0x594573[_0x2896('0x3d')][_0x2896('0x48')]){_0x4f5b55[_0x2896('0x46')]=_[_0x2896('0x49')](_0x4f5b55['where'],{'$or':_[_0x2896('0x37')](_0x4f5b55[_0x2896('0x41')],function(_0x3c9f96){var _0x1351e6={};_0x1351e6[_0x3c9f96]={'$like':'%'+_0x594573[_0x2896('0x3d')][_0x2896('0x48')]+'%'};return _0x1351e6;})});}_0x4f5b55=_[_0x2896('0x49')]({},_0x4f5b55,_0x594573[_0x2896('0x4b')]);return _0x370430['getSubjects'](_0x4f5b55);}})['then'](function(_0x19ce27){if(_0x19ce27){_0x5a1198=_0x19ce27[_0x2896('0x52')];if(!_0x594573[_0x2896('0x3d')][_0x2896('0x42')](_0x2896('0x43'))){_0x4f5b55[_0x2896('0x2e')]=qs['limit'](_0x594573[_0x2896('0x3d')][_0x2896('0x2e')]);_0x4f5b55[_0x2896('0x44')]=qs['offset'](_0x594573[_0x2896('0x3d')]['offset']);}return _0x370430['getSubjects'](_0x4f5b55);}})[_0x2896('0x20')](function(_0x36e863){if(_0x36e863){return _0x36e863?{'count':_0x5a1198,'rows':_0x36e863}:null;}})[_0x2896('0x20')](respondWithResult(_0x4645fa,null))[_0x2896('0x2a')](handleError(_0x4645fa,null));};exports[_0x2896('0x5d')]=function(_0xa2433b,_0x292236,_0x1501b6){var _0x2a7da7={};var _0x8bd084={};var _0x56d0fb;var _0x21519d;return db[_0x2896('0x38')]['findOne']({'where':{'id':_0xa2433b['params']['id']}})[_0x2896('0x20')](handleEntityNotFound(_0x292236,null))['then'](function(_0x4bb3d2){if(_0x4bb3d2){_0x56d0fb=_0x4bb3d2;_0x8bd084['model']=_[_0x2896('0x51')](db[_0x2896('0x59')][_0x2896('0x39')]);_0x8bd084['query']=_['keys'](_0xa2433b['query']);_0x8bd084[_0x2896('0x47')]=_[_0x2896('0x3f')](_0x8bd084[_0x2896('0x3e')],_0x8bd084[_0x2896('0x3d')]);_0x2a7da7[_0x2896('0x41')]=_[_0x2896('0x3f')](_0x8bd084[_0x2896('0x3e')],qs[_0x2896('0x40')](_0xa2433b[_0x2896('0x3d')][_0x2896('0x40')]));_0x2a7da7[_0x2896('0x41')]=_0x2a7da7[_0x2896('0x41')][_0x2896('0x52')]?_0x2a7da7[_0x2896('0x41')]:_0x8bd084[_0x2896('0x3e')];_0x2a7da7[_0x2896('0x45')]=qs[_0x2896('0x5a')](_0xa2433b['query'][_0x2896('0x5a')]);_0x2a7da7['where']=qs[_0x2896('0x47')](_[_0x2896('0x5b')](_0xa2433b[_0x2896('0x3d')],_0x8bd084[_0x2896('0x47')]));if(_0xa2433b[_0x2896('0x3d')]['filter']){_0x2a7da7[_0x2896('0x46')]=_['merge'](_0x2a7da7[_0x2896('0x46')],{'$or':_['map'](_0x2a7da7[_0x2896('0x41')],function(_0xf980c1){var _0x147e0b={};_0x147e0b[_0xf980c1]={'$like':'%'+_0xa2433b[_0x2896('0x3d')][_0x2896('0x48')]+'%'};return _0x147e0b;})});}_0x2a7da7=_[_0x2896('0x49')]({},_0x2a7da7,_0xa2433b[_0x2896('0x4b')]);return _0x56d0fb['getDescriptions'](_0x2a7da7);}})['then'](function(_0x3e4fbf){if(_0x3e4fbf){_0x21519d=_0x3e4fbf[_0x2896('0x52')];if(!_0xa2433b[_0x2896('0x3d')]['hasOwnProperty'](_0x2896('0x43'))){_0x2a7da7['limit']=qs['limit'](_0xa2433b['query'][_0x2896('0x2e')]);_0x2a7da7[_0x2896('0x44')]=qs[_0x2896('0x44')](_0xa2433b[_0x2896('0x3d')][_0x2896('0x44')]);}return _0x56d0fb[_0x2896('0x5d')](_0x2a7da7);}})[_0x2896('0x20')](function(_0x875e38){if(_0x875e38){return _0x875e38?{'count':_0x21519d,'rows':_0x875e38}:null;}})[_0x2896('0x20')](respondWithResult(_0x292236,null))[_0x2896('0x2a')](handleError(_0x292236,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 5273d65..b338b50 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 _0x0a65=['moment','request-promise','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger'];(function(_0x145204,_0x30d112){var _0x12cda3=function(_0x21880e){while(--_0x21880e){_0x145204['push'](_0x145204['shift']());}};_0x12cda3(++_0x30d112);}(_0x0a65,0x1ab));var _0x50a6=function(_0x41862f,_0x3d9e3d){_0x41862f=_0x41862f-0x0;var _0x2430bd=_0x0a65[_0x41862f];return _0x2430bd;};'use strict';var _=require(_0x50a6('0x0'));var util=require(_0x50a6('0x1'));var logger=require(_0x50a6('0x2'))('api');var moment=require(_0x50a6('0x3'));var BPromise=require('bluebird');var rp=require(_0x50a6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x50a6('0x5'));var attributes=require(_0x50a6('0x6'));module['exports']=function(_0x5436cf,_0x170241){return _0x5436cf[_0x50a6('0x7')](_0x50a6('0x8'),attributes,{'tableName':_0x50a6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadd0=['request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','../../config/logger','bluebird'];(function(_0x67d919,_0x5490f1){var _0x48ce10=function(_0x138a4d){while(--_0x138a4d){_0x67d919['push'](_0x67d919['shift']());}};_0x48ce10(++_0x5490f1);}(_0xadd0,0x1b5));var _0x0add=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xadd0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0add('0x0'));var logger=require(_0x0add('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0add('0x2'));var rp=require(_0x0add('0x3'));var fs=require('fs');var path=require(_0x0add('0x4'));var rimraf=require(_0x0add('0x5'));var config=require('../../config/environment');var attributes=require(_0x0add('0x6'));module['exports']=function(_0x5b5260,_0x347293){return _0x5b5260[_0x0add('0x7')](_0x0add('0x8'),attributes,{'tableName':_0x0add('0x9'),'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 43c6538..d6ec3bf 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 _0xa50d=['catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa50d,0xfe));var _0xda50=function(_0x13fdb1,_0x1c6fba){_0x13fdb1=_0x13fdb1-0x0;var _0x55f710=_0xa50d[_0x13fdb1];return _0x55f710;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xda50('0x0'));var BPromise=require(_0xda50('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda50('0x2'));var db=require(_0xda50('0x3'))['db'];var utils=require(_0xda50('0x4'));var logger=require(_0xda50('0x5'))(_0xda50('0x6'));var config=require(_0xda50('0x7'));var jayson=require(_0xda50('0x8'));var client=jayson[_0xda50('0x9')][_0xda50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a10a0,_0x12b307,_0xaef15e){return new BPromise(function(_0x1ed78b,_0x53abf0){return client[_0xda50('0xb')](_0x2a10a0,_0xaef15e)[_0xda50('0xc')](function(_0x291a11){logger[_0xda50('0xd')](_0xda50('0xe'),_0x12b307,_0xda50('0xf'));logger['debug'](_0xda50('0x10'),_0x12b307,_0xda50('0xf'),JSON[_0xda50('0x11')](_0x291a11));if(_0x291a11['error']){if(_0x291a11[_0xda50('0x12')][_0xda50('0x13')]===0x1f4){logger[_0xda50('0x12')](_0xda50('0xe'),_0x12b307,_0x291a11[_0xda50('0x12')]['message']);return _0x53abf0(_0x291a11[_0xda50('0x12')][_0xda50('0x14')]);}logger[_0xda50('0x12')](_0xda50('0xe'),_0x12b307,_0x291a11[_0xda50('0x12')][_0xda50('0x14')]);return _0x1ed78b(_0x291a11[_0xda50('0x12')][_0xda50('0x14')]);}else{logger[_0xda50('0xd')](_0xda50('0xe'),_0x12b307,_0xda50('0xf'));_0x1ed78b(_0x291a11[_0xda50('0x15')]['message']);}})[_0xda50('0x16')](function(_0x43ba08){logger[_0xda50('0x12')](_0xda50('0xe'),_0x12b307,_0x43ba08);_0x53abf0(_0x43ba08);});});} \ No newline at end of file +var _0xa96b=['request','info','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa96b,0x1ac));var _0xba96=function(_0x86cb6f,_0x4a78fc){_0x86cb6f=_0x86cb6f-0x0;var _0x56b665=_0xa96b[_0x86cb6f];return _0x56b665;};'use strict';var _=require(_0xba96('0x0'));var util=require('util');var moment=require(_0xba96('0x1'));var BPromise=require(_0xba96('0x2'));var rs=require(_0xba96('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba96('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xba96('0x5'))('rpc');var config=require(_0xba96('0x6'));var jayson=require(_0xba96('0x7'));var client=jayson[_0xba96('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30391d,_0x4a317c,_0x56615c){return new BPromise(function(_0x59f424,_0x552143){return client[_0xba96('0x9')](_0x30391d,_0x56615c)['then'](function(_0x173c58){logger[_0xba96('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x4a317c,'request\x20sent');logger['debug'](_0xba96('0xb'),_0x4a317c,_0xba96('0xc'),JSON[_0xba96('0xd')](_0x173c58));if(_0x173c58['error']){if(_0x173c58[_0xba96('0xe')][_0xba96('0xf')]===0x1f4){logger[_0xba96('0xe')](_0xba96('0x10'),_0x4a317c,_0x173c58['error'][_0xba96('0x11')]);return _0x552143(_0x173c58[_0xba96('0xe')][_0xba96('0x11')]);}logger[_0xba96('0xe')](_0xba96('0x10'),_0x4a317c,_0x173c58[_0xba96('0xe')][_0xba96('0x11')]);return _0x59f424(_0x173c58['error'][_0xba96('0x11')]);}else{logger[_0xba96('0xa')](_0xba96('0x10'),_0x4a317c,_0xba96('0xc'));_0x59f424(_0x173c58[_0xba96('0x12')][_0xba96('0x11')]);}})['catch'](function(_0x1f7bf7){logger[_0xba96('0xe')](_0xba96('0x10'),_0x4a317c,_0x1f7bf7);_0x552143(_0x1f7bf7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 5f3c86d..49b9d58 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 _0x8062=['post','create','/:id','update','delete','exports','multer','util','path','express','../../components/auth/service','./intSugarcrmField.controller','isAuthenticated','index','get'];(function(_0x9e1d73,_0xcf6479){var _0x1ba603=function(_0x689c74){while(--_0x689c74){_0x9e1d73['push'](_0x9e1d73['shift']());}};_0x1ba603(++_0xcf6479);}(_0x8062,0x114));var _0x2806=function(_0x1cf86c,_0x5ab5a7){_0x1cf86c=_0x1cf86c-0x0;var _0x21dd0c=_0x8062[_0x1cf86c];return _0x21dd0c;};'use strict';var multer=require(_0x2806('0x0'));var util=require(_0x2806('0x1'));var path=require(_0x2806('0x2'));var timeout=require('connect-timeout');var express=require(_0x2806('0x3'));var router=express['Router']();var auth=require(_0x2806('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2806('0x5'));router['get']('/',auth[_0x2806('0x6')](),controller[_0x2806('0x7')]);router[_0x2806('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2806('0x9')]('/',auth['isAuthenticated'](),controller[_0x2806('0xa')]);router['put'](_0x2806('0xb'),auth[_0x2806('0x6')](),controller[_0x2806('0xc')]);router[_0x2806('0xd')]('/:id',auth[_0x2806('0x6')](),controller['destroy']);module[_0x2806('0xe')]=router; \ No newline at end of file +var _0xdb1b=['isAuthenticated','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','/:id'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xdb1b,0x85));var _0xbdb1=function(_0x629def,_0x23f88b){_0x629def=_0x629def-0x0;var _0x552abb=_0xdb1b[_0x629def];return _0x552abb;};'use strict';var multer=require(_0xbdb1('0x0'));var util=require(_0xbdb1('0x1'));var path=require(_0xbdb1('0x2'));var timeout=require(_0xbdb1('0x3'));var express=require(_0xbdb1('0x4'));var router=express['Router']();var auth=require(_0xbdb1('0x5'));var interaction=require(_0xbdb1('0x6'));var config=require(_0xbdb1('0x7'));var controller=require(_0xbdb1('0x8'));router[_0xbdb1('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbdb1('0x9')](_0xbdb1('0xa'),auth[_0xbdb1('0xb')](),controller[_0xbdb1('0xc')]);router[_0xbdb1('0xd')]('/',auth[_0xbdb1('0xb')](),controller[_0xbdb1('0xe')]);router['put']('/:id',auth[_0xbdb1('0xb')](),controller[_0xbdb1('0xf')]);router[_0xbdb1('0x10')](_0xbdb1('0xa'),auth[_0xbdb1('0xb')](),controller[_0xbdb1('0x11')]);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 ff91d01..afa5514 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 _0xbeea=['variable','keyValue','STRING','sequelize','ENUM','string'];(function(_0x27eeca,_0x128a0d){var _0x5649ff=function(_0x1bfdf3){while(--_0x1bfdf3){_0x27eeca['push'](_0x27eeca['shift']());}};_0x5649ff(++_0x128a0d);}(_0xbeea,0xb1));var _0xabee=function(_0xcfbd37,_0x17f3d8){_0xcfbd37=_0xcfbd37-0x0;var _0x212feb=_0xbeea[_0xcfbd37];return _0x212feb;};'use strict';var Sequelize=require(_0xabee('0x0'));module['exports']={'type':{'type':Sequelize[_0xabee('0x1')](_0xabee('0x2'),_0xabee('0x3'),'customVariable',_0xabee('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xabee('0x5')]},'key':{'type':Sequelize[_0xabee('0x5')]},'keyType':{'type':Sequelize[_0xabee('0x1')](_0xabee('0x2'),_0xabee('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xabee('0x5')]},'nameField':{'type':Sequelize[_0xabee('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xabee('0x5')]}}; \ No newline at end of file +var _0xbe48=['STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x14d2b7,_0x33e508){var _0x5643aa=function(_0x119a19){while(--_0x119a19){_0x14d2b7['push'](_0x14d2b7['shift']());}};_0x5643aa(++_0x33e508);}(_0xbe48,0x121));var _0x8be4=function(_0x444231,_0x1f655c){_0x444231=_0x444231-0x0;var _0x472a9b=_0xbe48[_0x444231];return _0x472a9b;};'use strict';var Sequelize=require(_0x8be4('0x0'));module[_0x8be4('0x1')]={'type':{'type':Sequelize[_0x8be4('0x2')](_0x8be4('0x3'),_0x8be4('0x4'),'customVariable','keyValue'),'defaultValue':_0x8be4('0x3')},'content':{'type':Sequelize[_0x8be4('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8be4('0x2')](_0x8be4('0x3'),_0x8be4('0x4'),_0x8be4('0x6'))},'keyContent':{'type':Sequelize[_0x8be4('0x5')]},'idField':{'type':Sequelize[_0x8be4('0x5')]},'nameField':{'type':Sequelize[_0x8be4('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8be4('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 414813d..f3f063c 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 _0x45e3=['crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','merge','where','filter','options','includeAll','rows','catch','show','params','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x942852,_0x6e2c5){var _0x24517a=function(_0x4da2d9){while(--_0x4da2d9){_0x942852['push'](_0x942852['shift']());}};_0x24517a(++_0x6e2c5);}(_0x45e3,0xd1));var _0x345e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x45e3[_0x3054be];return _0x3df150;};'use strict';var pdf=require(_0x345e('0x0'));var emlformat=require(_0x345e('0x1'));var rimraf=require(_0x345e('0x2'));var zipdir=require(_0x345e('0x3'));var jsonpatch=require(_0x345e('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x345e('0x5'));var Mustache=require('mustache');var util=require(_0x345e('0x6'));var path=require(_0x345e('0x7'));var sox=require(_0x345e('0x8'));var csv=require(_0x345e('0x9'));var ejs=require(_0x345e('0xa'));var fs=require('fs');var _=require(_0x345e('0xb'));var squel=require(_0x345e('0xc'));var crypto=require(_0x345e('0xd'));var jsforce=require(_0x345e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x345e('0x9'));var querystring=require(_0x345e('0xf'));var Papa=require('papaparse');var Redis=require(_0x345e('0x10'));var authService=require(_0x345e('0x11'));var qs=require(_0x345e('0x12'));var as=require(_0x345e('0x13'));var hardwareService=require(_0x345e('0x14'));var logger=require(_0x345e('0x15'))(_0x345e('0x16'));var utils=require(_0x345e('0x17'));var config=require(_0x345e('0x18'));var db=require(_0x345e('0x19'))['db'];function respondWithStatusCode(_0x4b719d,_0x1a7469){_0x1a7469=_0x1a7469||0xcc;return function(_0x554638){if(_0x554638){return _0x4b719d['sendStatus'](_0x1a7469);}return _0x4b719d[_0x345e('0x1a')](_0x1a7469)[_0x345e('0x1b')]();};}function respondWithResult(_0x9d27ee,_0x485405){_0x485405=_0x485405||0xc8;return function(_0x302a2a){if(_0x302a2a){return _0x9d27ee[_0x345e('0x1a')](_0x485405)[_0x345e('0x1c')](_0x302a2a);}};}function respondWithFilteredResult(_0x5ef876,_0xb71727){return function(_0x35db12){if(_0x35db12){var _0x3d4bb1=_0x35db12[_0x345e('0x1d')],_0x249660=_0xb71727[_0x345e('0x1e')],_0x247d48=_0xb71727['offset']+_0xb71727[_0x345e('0x1f')],_0x4b0b8f;if(_0x247d48>=_0x3d4bb1){_0x247d48=_0x3d4bb1;_0x4b0b8f=0xc8;}else{_0x4b0b8f=0xce;}_0x5ef876[_0x345e('0x1a')](_0x4b0b8f);return _0x5ef876[_0x345e('0x20')](_0x345e('0x21'),_0x249660+'-'+_0x247d48+'/'+_0x3d4bb1)[_0x345e('0x1c')](_0x35db12);}return null;};}function patchUpdates(_0x3be2d3){return function(_0x373de7){try{jsonpatch[_0x345e('0x22')](_0x373de7,_0x3be2d3,!![]);}catch(_0x58a122){return BPromise['reject'](_0x58a122);}return _0x373de7[_0x345e('0x23')]();};}function saveUpdates(_0x48af3c,_0x2a0008){return function(_0x461530){if(_0x461530){return _0x461530[_0x345e('0x24')](_0x48af3c)[_0x345e('0x25')](function(_0x3ec4d7){return _0x3ec4d7;});}return null;};}function removeEntity(_0x2c646d,_0x429ded){return function(_0x2eda7b){if(_0x2eda7b){return _0x2eda7b[_0x345e('0x26')]()['then'](function(){_0x2c646d[_0x345e('0x1a')](0xcc)[_0x345e('0x1b')]();});}};}function handleEntityNotFound(_0x25b0b9,_0x3a048d){return function(_0x1a2adc){if(!_0x1a2adc){_0x25b0b9[_0x345e('0x27')](0x194);}return _0x1a2adc;};}function handleError(_0x8948b4,_0x3e2201){_0x3e2201=_0x3e2201||0x1f4;return function(_0x4e3519){logger[_0x345e('0x28')](_0x4e3519[_0x345e('0x29')]);if(_0x4e3519[_0x345e('0x2a')]){delete _0x4e3519['name'];}_0x8948b4[_0x345e('0x1a')](_0x3e2201)[_0x345e('0x2b')](_0x4e3519);};}exports[_0x345e('0x2c')]=function(_0x2aa5a,_0xf3a66e){var _0x3a806f={},_0x1c2194={},_0x50a724={'count':0x0,'rows':[]};var _0x42894a=_[_0x345e('0x2d')](db[_0x345e('0x2e')][_0x345e('0x2f')],function(_0x13bb77){return{'name':_0x13bb77[_0x345e('0x30')],'type':_0x13bb77['type'][_0x345e('0x31')]};});_0x1c2194['model']=_[_0x345e('0x2d')](_0x42894a,'name');_0x1c2194[_0x345e('0x32')]=_[_0x345e('0x33')](_0x2aa5a['query']);_0x1c2194[_0x345e('0x34')]=_[_0x345e('0x35')](_0x1c2194[_0x345e('0x36')],_0x1c2194[_0x345e('0x32')]);_0x3a806f[_0x345e('0x37')]=_['intersection'](_0x1c2194[_0x345e('0x36')],qs['fields'](_0x2aa5a[_0x345e('0x32')][_0x345e('0x38')]));_0x3a806f['attributes']=_0x3a806f[_0x345e('0x37')]['length']?_0x3a806f[_0x345e('0x37')]:_0x1c2194[_0x345e('0x36')];if(!_0x2aa5a[_0x345e('0x32')][_0x345e('0x39')](_0x345e('0x3a'))){_0x3a806f[_0x345e('0x1f')]=qs[_0x345e('0x1f')](_0x2aa5a['query'][_0x345e('0x1f')]);_0x3a806f['offset']=qs[_0x345e('0x1e')](_0x2aa5a[_0x345e('0x32')][_0x345e('0x1e')]);}_0x3a806f[_0x345e('0x3b')]=qs[_0x345e('0x3c')](_0x2aa5a[_0x345e('0x32')][_0x345e('0x3c')]);_0x3a806f['where']=qs[_0x345e('0x34')](_[_0x345e('0x3d')](_0x2aa5a[_0x345e('0x32')],_0x1c2194[_0x345e('0x34')]));if(_0x2aa5a[_0x345e('0x32')]['filter']){_0x3a806f['where']=_[_0x345e('0x3e')](_0x3a806f[_0x345e('0x3f')],{'$or':_[_0x345e('0x2d')](_0x42894a,function(_0x24cca8){if(_0x24cca8['type']!=='VIRTUAL'){var _0x331653={};_0x331653[_0x24cca8[_0x345e('0x2a')]]={'$like':'%'+_0x2aa5a[_0x345e('0x32')][_0x345e('0x40')]+'%'};return _0x331653;}})});}_0x3a806f=_[_0x345e('0x3e')]({},_0x3a806f,_0x2aa5a[_0x345e('0x41')]);var _0x7c726d={'where':_0x3a806f['where']};return db[_0x345e('0x2e')][_0x345e('0x1d')](_0x7c726d)['then'](function(_0x125210){_0x50a724[_0x345e('0x1d')]=_0x125210;if(_0x2aa5a[_0x345e('0x32')][_0x345e('0x42')]){_0x3a806f['include']=[{'all':!![]}];}return db[_0x345e('0x2e')]['findAll'](_0x3a806f);})[_0x345e('0x25')](function(_0x318ab1){_0x50a724[_0x345e('0x43')]=_0x318ab1;return _0x50a724;})[_0x345e('0x25')](respondWithFilteredResult(_0xf3a66e,_0x3a806f))[_0x345e('0x44')](handleError(_0xf3a66e,null));};exports[_0x345e('0x45')]=function(_0x46948d,_0x31c293){var _0x47a68f={'raw':!![],'where':{'id':_0x46948d[_0x345e('0x46')]['id']}},_0x483cee={};_0x483cee[_0x345e('0x36')]=_['keys'](db['SugarcrmField'][_0x345e('0x2f')]);_0x483cee['query']=_[_0x345e('0x33')](_0x46948d['query']);_0x483cee[_0x345e('0x34')]=_[_0x345e('0x35')](_0x483cee['model'],_0x483cee[_0x345e('0x32')]);_0x47a68f[_0x345e('0x37')]=_[_0x345e('0x35')](_0x483cee['model'],qs[_0x345e('0x38')](_0x46948d[_0x345e('0x32')][_0x345e('0x38')]));_0x47a68f[_0x345e('0x37')]=_0x47a68f[_0x345e('0x37')]['length']?_0x47a68f[_0x345e('0x37')]:_0x483cee[_0x345e('0x36')];if(_0x46948d[_0x345e('0x32')][_0x345e('0x42')]){_0x47a68f['include']=[{'all':!![]}];}_0x47a68f=_[_0x345e('0x3e')]({},_0x47a68f,_0x46948d[_0x345e('0x41')]);return db[_0x345e('0x2e')]['find'](_0x47a68f)['then'](handleEntityNotFound(_0x31c293,null))[_0x345e('0x25')](respondWithResult(_0x31c293,null))[_0x345e('0x44')](handleError(_0x31c293,null));};exports[_0x345e('0x47')]=function(_0x2e7f89,_0x7aa0fd){return db['SugarcrmField'][_0x345e('0x47')](_0x2e7f89[_0x345e('0x48')],{})['then'](respondWithResult(_0x7aa0fd,0xc9))[_0x345e('0x44')](handleError(_0x7aa0fd,null));};exports[_0x345e('0x24')]=function(_0x337fc3,_0x52d67c){if(_0x337fc3[_0x345e('0x48')]['id']){delete _0x337fc3[_0x345e('0x48')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x337fc3[_0x345e('0x46')]['id']}})[_0x345e('0x25')](handleEntityNotFound(_0x52d67c,null))[_0x345e('0x25')](saveUpdates(_0x337fc3[_0x345e('0x48')],null))[_0x345e('0x25')](respondWithResult(_0x52d67c,null))['catch'](handleError(_0x52d67c,null));};exports['destroy']=function(_0x16ee4f,_0x5461e4){return db[_0x345e('0x2e')][_0x345e('0x49')]({'where':{'id':_0x16ee4f['params']['id']}})['then'](handleEntityNotFound(_0x5461e4,null))[_0x345e('0x25')](removeEntity(_0x5461e4,null))[_0x345e('0x44')](handleError(_0x5461e4,null));}; \ No newline at end of file +var _0x2b62=['save','update','then','error','name','send','index','map','SugarcrmField','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','include','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject'];(function(_0x593e92,_0xcf67e2){var _0x5a4b47=function(_0x1b21cf){while(--_0x1b21cf){_0x593e92['push'](_0x593e92['shift']());}};_0x5a4b47(++_0xcf67e2);}(_0x2b62,0x1ef));var _0x22b6=function(_0x1e3b65,_0x181a35){_0x1e3b65=_0x1e3b65-0x0;var _0xf83d49=_0x2b62[_0x1e3b65];return _0xf83d49;};'use strict';var pdf=require(_0x22b6('0x0'));var emlformat=require(_0x22b6('0x1'));var rimraf=require(_0x22b6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x22b6('0x3'));var rp=require('request-promise');var moment=require(_0x22b6('0x4'));var BPromise=require(_0x22b6('0x5'));var Mustache=require(_0x22b6('0x6'));var util=require(_0x22b6('0x7'));var path=require('path');var sox=require(_0x22b6('0x8'));var csv=require('to-csv');var ejs=require(_0x22b6('0x9'));var fs=require('fs');var _=require(_0x22b6('0xa'));var squel=require('squel');var crypto=require(_0x22b6('0xb'));var jsforce=require(_0x22b6('0xc'));var deskjs=require(_0x22b6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x22b6('0xe'));var Redis=require(_0x22b6('0xf'));var authService=require(_0x22b6('0x10'));var qs=require(_0x22b6('0x11'));var as=require(_0x22b6('0x12'));var hardwareService=require(_0x22b6('0x13'));var logger=require(_0x22b6('0x14'))(_0x22b6('0x15'));var utils=require(_0x22b6('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f5e6c,_0x1ead4c){_0x1ead4c=_0x1ead4c||0xcc;return function(_0x1f4420){if(_0x1f4420){return _0x2f5e6c[_0x22b6('0x17')](_0x1ead4c);}return _0x2f5e6c[_0x22b6('0x18')](_0x1ead4c)[_0x22b6('0x19')]();};}function respondWithResult(_0xdfa483,_0x3bbf37){_0x3bbf37=_0x3bbf37||0xc8;return function(_0x1dc838){if(_0x1dc838){return _0xdfa483[_0x22b6('0x18')](_0x3bbf37)[_0x22b6('0x1a')](_0x1dc838);}};}function respondWithFilteredResult(_0x36ce7c,_0x62e2c){return function(_0x54bbc2){if(_0x54bbc2){var _0x5033e3=_0x54bbc2[_0x22b6('0x1b')],_0x2cc077=_0x62e2c[_0x22b6('0x1c')],_0x3b6a28=_0x62e2c[_0x22b6('0x1c')]+_0x62e2c[_0x22b6('0x1d')],_0x1ded82;if(_0x3b6a28>=_0x5033e3){_0x3b6a28=_0x5033e3;_0x1ded82=0xc8;}else{_0x1ded82=0xce;}_0x36ce7c[_0x22b6('0x18')](_0x1ded82);return _0x36ce7c['set'](_0x22b6('0x1e'),_0x2cc077+'-'+_0x3b6a28+'/'+_0x5033e3)['json'](_0x54bbc2);}return null;};}function patchUpdates(_0x5588d5){return function(_0xef6f6d){try{jsonpatch[_0x22b6('0x1f')](_0xef6f6d,_0x5588d5,!![]);}catch(_0x48e19a){return BPromise[_0x22b6('0x20')](_0x48e19a);}return _0xef6f6d[_0x22b6('0x21')]();};}function saveUpdates(_0x43ab23,_0x9df37){return function(_0x2bc5b2){if(_0x2bc5b2){return _0x2bc5b2[_0x22b6('0x22')](_0x43ab23)['then'](function(_0x33e186){return _0x33e186;});}return null;};}function removeEntity(_0x5b0eee,_0xe5388f){return function(_0xd24aba){if(_0xd24aba){return _0xd24aba['destroy']()[_0x22b6('0x23')](function(){_0x5b0eee[_0x22b6('0x18')](0xcc)[_0x22b6('0x19')]();});}};}function handleEntityNotFound(_0x20b0e1,_0x2f2eaa){return function(_0x7ad1bd){if(!_0x7ad1bd){_0x20b0e1[_0x22b6('0x17')](0x194);}return _0x7ad1bd;};}function handleError(_0x20ec5b,_0x4f0ab2){_0x4f0ab2=_0x4f0ab2||0x1f4;return function(_0x355866){logger[_0x22b6('0x24')](_0x355866['stack']);if(_0x355866[_0x22b6('0x25')]){delete _0x355866[_0x22b6('0x25')];}_0x20ec5b[_0x22b6('0x18')](_0x4f0ab2)[_0x22b6('0x26')](_0x355866);};}exports[_0x22b6('0x27')]=function(_0x3275f2,_0x1082f0){var _0x14f6d7={},_0x402823={},_0x1ccae7={'count':0x0,'rows':[]};var _0x25b3a5=_[_0x22b6('0x28')](db[_0x22b6('0x29')][_0x22b6('0x2a')],function(_0x13a369){return{'name':_0x13a369['fieldName'],'type':_0x13a369[_0x22b6('0x2b')]['key']};});_0x402823[_0x22b6('0x2c')]=_[_0x22b6('0x28')](_0x25b3a5,_0x22b6('0x25'));_0x402823[_0x22b6('0x2d')]=_[_0x22b6('0x2e')](_0x3275f2[_0x22b6('0x2d')]);_0x402823[_0x22b6('0x2f')]=_[_0x22b6('0x30')](_0x402823[_0x22b6('0x2c')],_0x402823[_0x22b6('0x2d')]);_0x14f6d7['attributes']=_['intersection'](_0x402823[_0x22b6('0x2c')],qs[_0x22b6('0x31')](_0x3275f2[_0x22b6('0x2d')]['fields']));_0x14f6d7[_0x22b6('0x32')]=_0x14f6d7[_0x22b6('0x32')][_0x22b6('0x33')]?_0x14f6d7[_0x22b6('0x32')]:_0x402823[_0x22b6('0x2c')];if(!_0x3275f2[_0x22b6('0x2d')]['hasOwnProperty'](_0x22b6('0x34'))){_0x14f6d7[_0x22b6('0x1d')]=qs[_0x22b6('0x1d')](_0x3275f2['query'][_0x22b6('0x1d')]);_0x14f6d7[_0x22b6('0x1c')]=qs[_0x22b6('0x1c')](_0x3275f2['query'][_0x22b6('0x1c')]);}_0x14f6d7[_0x22b6('0x35')]=qs[_0x22b6('0x36')](_0x3275f2[_0x22b6('0x2d')][_0x22b6('0x36')]);_0x14f6d7[_0x22b6('0x37')]=qs[_0x22b6('0x2f')](_[_0x22b6('0x38')](_0x3275f2[_0x22b6('0x2d')],_0x402823[_0x22b6('0x2f')]));if(_0x3275f2[_0x22b6('0x2d')][_0x22b6('0x39')]){_0x14f6d7[_0x22b6('0x37')]=_[_0x22b6('0x3a')](_0x14f6d7[_0x22b6('0x37')],{'$or':_['map'](_0x25b3a5,function(_0x1ce327){if(_0x1ce327['type']!=='VIRTUAL'){var _0x1952b6={};_0x1952b6[_0x1ce327[_0x22b6('0x25')]]={'$like':'%'+_0x3275f2['query'][_0x22b6('0x39')]+'%'};return _0x1952b6;}})});}_0x14f6d7=_[_0x22b6('0x3a')]({},_0x14f6d7,_0x3275f2['options']);var _0x490416={'where':_0x14f6d7['where']};return db[_0x22b6('0x29')][_0x22b6('0x1b')](_0x490416)[_0x22b6('0x23')](function(_0x4c5038){_0x1ccae7[_0x22b6('0x1b')]=_0x4c5038;if(_0x3275f2[_0x22b6('0x2d')]['includeAll']){_0x14f6d7[_0x22b6('0x3b')]=[{'all':!![]}];}return db[_0x22b6('0x29')]['findAll'](_0x14f6d7);})['then'](function(_0x5128ab){_0x1ccae7['rows']=_0x5128ab;return _0x1ccae7;})['then'](respondWithFilteredResult(_0x1082f0,_0x14f6d7))[_0x22b6('0x3c')](handleError(_0x1082f0,null));};exports['show']=function(_0x200ea1,_0x555014){var _0x53b8f0={'raw':!![],'where':{'id':_0x200ea1[_0x22b6('0x3d')]['id']}},_0x12d461={};_0x12d461[_0x22b6('0x2c')]=_[_0x22b6('0x2e')](db[_0x22b6('0x29')][_0x22b6('0x2a')]);_0x12d461['query']=_[_0x22b6('0x2e')](_0x200ea1[_0x22b6('0x2d')]);_0x12d461[_0x22b6('0x2f')]=_['intersection'](_0x12d461[_0x22b6('0x2c')],_0x12d461[_0x22b6('0x2d')]);_0x53b8f0[_0x22b6('0x32')]=_[_0x22b6('0x30')](_0x12d461['model'],qs['fields'](_0x200ea1[_0x22b6('0x2d')][_0x22b6('0x31')]));_0x53b8f0[_0x22b6('0x32')]=_0x53b8f0[_0x22b6('0x32')]['length']?_0x53b8f0['attributes']:_0x12d461[_0x22b6('0x2c')];if(_0x200ea1[_0x22b6('0x2d')][_0x22b6('0x3e')]){_0x53b8f0[_0x22b6('0x3b')]=[{'all':!![]}];}_0x53b8f0=_['merge']({},_0x53b8f0,_0x200ea1['options']);return db[_0x22b6('0x29')]['find'](_0x53b8f0)[_0x22b6('0x23')](handleEntityNotFound(_0x555014,null))['then'](respondWithResult(_0x555014,null))[_0x22b6('0x3c')](handleError(_0x555014,null));};exports[_0x22b6('0x3f')]=function(_0x388728,_0x134aa6){return db['SugarcrmField'][_0x22b6('0x3f')](_0x388728[_0x22b6('0x40')],{})['then'](respondWithResult(_0x134aa6,0xc9))[_0x22b6('0x3c')](handleError(_0x134aa6,null));};exports[_0x22b6('0x22')]=function(_0x4db03f,_0x30b564){if(_0x4db03f['body']['id']){delete _0x4db03f[_0x22b6('0x40')]['id'];}return db[_0x22b6('0x29')][_0x22b6('0x41')]({'where':{'id':_0x4db03f[_0x22b6('0x3d')]['id']}})[_0x22b6('0x23')](handleEntityNotFound(_0x30b564,null))['then'](saveUpdates(_0x4db03f['body'],null))['then'](respondWithResult(_0x30b564,null))[_0x22b6('0x3c')](handleError(_0x30b564,null));};exports['destroy']=function(_0x31e8cb,_0x4bfb4f){return db[_0x22b6('0x29')]['find']({'where':{'id':_0x31e8cb[_0x22b6('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4bfb4f,null))[_0x22b6('0x23')](removeEntity(_0x4bfb4f,null))[_0x22b6('0x3c')](handleError(_0x4bfb4f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 096cb1a..178777e 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 _0xbabc=['bluebird','request-promise','rimraf','./intSugarcrmField.attributes','define','idField','lodash','../../config/logger','api','moment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xbabc,0xc4));var _0xcbab=function(_0x4fab5f,_0x5038ec){_0x4fab5f=_0x4fab5f-0x0;var _0x1ef72f=_0xbabc[_0x4fab5f];return _0x1ef72f;};'use strict';var _=require(_0xcbab('0x0'));var util=require('util');var logger=require(_0xcbab('0x1'))(_0xcbab('0x2'));var moment=require(_0xcbab('0x3'));var BPromise=require(_0xcbab('0x4'));var rp=require(_0xcbab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbab('0x6'));var config=require('../../config/environment');var attributes=require(_0xcbab('0x7'));module['exports']=function(_0x27477f,_0x28d5d2){return _0x27477f[_0xcbab('0x8')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0xcbab('0x9'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0a96=['lodash','util','../../config/logger','api','moment','request-promise','path','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x3859d1,_0x316568){var _0x245dc3=function(_0x586e78){while(--_0x586e78){_0x3859d1['push'](_0x3859d1['shift']());}};_0x245dc3(++_0x316568);}(_0x0a96,0x75));var _0x60a9=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0a96[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x60a9('0x0'));var util=require(_0x60a9('0x1'));var logger=require(_0x60a9('0x2'))(_0x60a9('0x3'));var moment=require(_0x60a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x60a9('0x5'));var fs=require('fs');var path=require(_0x60a9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x60a9('0x7'));module['exports']=function(_0x2f2d30,_0x44929a){return _0x2f2d30[_0x60a9('0x8')](_0x60a9('0x9'),attributes,{'tableName':_0x60a9('0xa'),'paranoid':![],'indexes':[{'name':_0x60a9('0xb'),'fields':[_0x60a9('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 38585e0..260b4dc 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x7f3ee6,_0xd4b17c){var _0x1a72e0=function(_0x27ee47){while(--_0x27ee47){_0x7f3ee6['push'](_0x7f3ee6['shift']());}};_0x1a72e0(++_0xd4b17c);}(_0x1a85,0x178));var _0x51a8=function(_0x4dd15b,_0x1d880a){_0x4dd15b=_0x4dd15b-0x0;var _0x2445f2=_0x1a85[_0x4dd15b];return _0x2445f2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0x757a=['request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0xff9e1a,_0x183a52){var _0x5a6817=function(_0x500814){while(--_0x500814){_0xff9e1a['push'](_0xff9e1a['shift']());}};_0x5a6817(++_0x183a52);}(_0x757a,0xde));var _0xa757=function(_0x1ba4be,_0x3d63aa){_0x1ba4be=_0x1ba4be-0x0;var _0x2e7829=_0x757a[_0x1ba4be];return _0x2e7829;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 4fc3290..9c49795 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 _0xff0d=['multer','path','connect-timeout','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy'];(function(_0x53da0f,_0x142ae4){var _0x56d563=function(_0x4e6f41){while(--_0x4e6f41){_0x53da0f['push'](_0x53da0f['shift']());}};_0x56d563(++_0x142ae4);}(_0xff0d,0x85));var _0xdff0=function(_0x1a89a1,_0x56d889){_0x1a89a1=_0x1a89a1-0x0;var _0x3d5b46=_0xff0d[_0x1a89a1];return _0x3d5b46;};'use strict';var multer=require(_0xdff0('0x0'));var util=require('util');var path=require(_0xdff0('0x1'));var timeout=require(_0xdff0('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xdff0('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdff0('0x4'));var controller=require(_0xdff0('0x5'));router[_0xdff0('0x6')]('/',auth[_0xdff0('0x7')](),controller['index']);router[_0xdff0('0x6')]('/:id',auth[_0xdff0('0x7')](),controller[_0xdff0('0x8')]);router['get']('/:id/configurations',auth[_0xdff0('0x7')](),controller[_0xdff0('0x9')]);router[_0xdff0('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0xdff0('0xa')]);router[_0xdff0('0xb')]('/',auth[_0xdff0('0x7')](),controller[_0xdff0('0xc')]);router[_0xdff0('0xb')](_0xdff0('0xd'),auth[_0xdff0('0x7')](),controller[_0xdff0('0xe')]);router[_0xdff0('0xf')]('/:id',auth[_0xdff0('0x7')](),controller[_0xdff0('0x10')]);router[_0xdff0('0x11')]('/:id',auth[_0xdff0('0x7')](),controller[_0xdff0('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb0d9=['../../components/auth/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4aea0e,_0x19ed08){var _0x52a5b1=function(_0x310d01){while(--_0x310d01){_0x4aea0e['push'](_0x4aea0e['shift']());}};_0x52a5b1(++_0x19ed08);}(_0xb0d9,0x87));var _0x9b0d=function(_0x1d5589,_0x2f5c00){_0x1d5589=_0x1d5589-0x0;var _0x551317=_0xb0d9[_0x1d5589];return _0x551317;};'use strict';var multer=require(_0x9b0d('0x0'));var util=require(_0x9b0d('0x1'));var path=require(_0x9b0d('0x2'));var timeout=require(_0x9b0d('0x3'));var express=require(_0x9b0d('0x4'));var router=express['Router']();var auth=require(_0x9b0d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9b0d('0x6'));router[_0x9b0d('0x7')]('/',auth[_0x9b0d('0x8')](),controller[_0x9b0d('0x9')]);router['get']('/:id',auth[_0x9b0d('0x8')](),controller['show']);router['get'](_0x9b0d('0xa'),auth[_0x9b0d('0x8')](),controller[_0x9b0d('0xb')]);router[_0x9b0d('0x7')](_0x9b0d('0xc'),auth[_0x9b0d('0x8')](),controller[_0x9b0d('0xd')]);router[_0x9b0d('0xe')]('/',auth[_0x9b0d('0x8')](),controller[_0x9b0d('0xf')]);router[_0x9b0d('0xe')](_0x9b0d('0xa'),auth[_0x9b0d('0x8')](),controller['addConfiguration']);router[_0x9b0d('0x10')](_0x9b0d('0x11'),auth[_0x9b0d('0x8')](),controller['update']);router['delete'](_0x9b0d('0x11'),auth[_0x9b0d('0x8')](),controller[_0x9b0d('0x12')]);module[_0x9b0d('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 c32d54e..47de964 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 _0x8024=['HelpDesk','sequelize','STRING'];(function(_0x118491,_0x18108b){var _0x418406=function(_0x28bc98){while(--_0x28bc98){_0x118491['push'](_0x118491['shift']());}};_0x418406(++_0x18108b);}(_0x8024,0xdc));var _0x4802=function(_0x10ee1a,_0x31071b){_0x10ee1a=_0x10ee1a-0x0;var _0x18103e=_0x8024[_0x10ee1a];return _0x18103e;};'use strict';var Sequelize=require(_0x4802('0x0'));module['exports']={'name':{'type':Sequelize[_0x4802('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4802('0x1')]},'username':{'type':Sequelize[_0x4802('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x4802('0x1')],'allowNull':![],'defaultValue':_0x4802('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x4802('0x1')]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x3be9=['STRING'];(function(_0x5a09f3,_0x56ae7d){var _0x2d73c4=function(_0x1f3375){while(--_0x1f3375){_0x5a09f3['push'](_0x5a09f3['shift']());}};_0x2d73c4(++_0x56ae7d);}(_0x3be9,0x18f));var _0x93be=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0x3be9[_0x5027b1];return _0x4a46cf;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x93be('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x93be('0x0')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0x93be('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x93be('0x0')]},'accessKey':{'type':Sequelize[_0x93be('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index dd40dd4..89bab76 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 _0x7d5b=['options','includeAll','include','rows','show','params','keys','rawAttributes','find','create','body','getConfigurations','findOne','VtigerConfiguration','hasOwnProperty','Subjects','getSubjects','getDescriptions','channel','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','lastIndexOf','format','%s/webservice.php','success','login','token','GET','autogenerated','reference','owner','includes','remove','editable','false','label','startsWith','picklistValues','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../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','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','send','index','map','VtigerAccount','fieldName','type','name','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d5b,0x131));var _0xb7d5=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x7d5b[_0x17928f];return _0x500b63;};'use strict';var pdf=require(_0xb7d5('0x0'));var emlformat=require(_0xb7d5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb7d5('0x2'));var jsonpatch=require(_0xb7d5('0x3'));var rp=require(_0xb7d5('0x4'));var moment=require('moment');var BPromise=require(_0xb7d5('0x5'));var Mustache=require(_0xb7d5('0x6'));var util=require(_0xb7d5('0x7'));var path=require('path');var sox=require(_0xb7d5('0x8'));var csv=require('to-csv');var ejs=require(_0xb7d5('0x9'));var fs=require('fs');var _=require(_0xb7d5('0xa'));var squel=require(_0xb7d5('0xb'));var crypto=require('crypto');var jsforce=require(_0xb7d5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb7d5('0xd'));var querystring=require(_0xb7d5('0xe'));var Papa=require('papaparse');var Redis=require(_0xb7d5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb7d5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7d5('0x11'))(_0xb7d5('0x12'));var utils=require(_0xb7d5('0x13'));var config=require(_0xb7d5('0x14'));var db=require(_0xb7d5('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xb7d5('0x16')][_0xb7d5('0x17')]({'port':0x232a});function checkPasswordPattern(_0x421a62,_0x3d912a,_0x2a6a4b){if(_0x2a6a4b){var _0x600ebd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x600ebd[_0xb7d5('0x18')](_0x3d912a)){return _0x421a62;}else{throw new db[(_0xb7d5('0x19'))][(_0xb7d5('0x1a'))](_0xb7d5('0x1b'));}}else{return _0x421a62;}}function respondWithRpcPromise(_0x120bcb,_0x587769,_0x58fc36,_0x187318){return new BPromise(function(_0x18de19,_0x599180){var _0x551466=_0x187318||client;return _0x551466[_0xb7d5('0x1c')](_0x120bcb,_0x58fc36)[_0xb7d5('0x1d')](function(_0x220444){logger['info'](_0xb7d5('0x1e'),_0x587769,_0xb7d5('0x1f'));logger[_0xb7d5('0x20')](_0xb7d5('0x21'),_0x587769,_0xb7d5('0x1f'),JSON[_0xb7d5('0x22')](_0x220444));if(_0x220444[_0xb7d5('0x23')]){if(_0x220444[_0xb7d5('0x23')][_0xb7d5('0x24')]===0x1f4){logger['error'](_0xb7d5('0x1e'),_0x587769,_0x220444[_0xb7d5('0x23')][_0xb7d5('0x25')]);return _0x599180(_0x220444[_0xb7d5('0x23')]['message']);}logger[_0xb7d5('0x23')]('VtigerAccount,\x20%s,\x20%s',_0x587769,_0x220444[_0xb7d5('0x23')]['message']);return _0x18de19(_0x220444[_0xb7d5('0x23')]['message']);}else{logger[_0xb7d5('0x26')](_0xb7d5('0x1e'),_0x587769,_0xb7d5('0x1f'));_0x18de19(_0x220444[_0xb7d5('0x27')]['message']);}})[_0xb7d5('0x28')](function(_0x278c77){logger[_0xb7d5('0x23')](_0xb7d5('0x1e'),_0x587769,_0x278c77);_0x599180(_0x278c77);});});}function respondWithStatusCode(_0x15337a,_0x44d111){_0x44d111=_0x44d111||0xcc;return function(_0x314124){if(_0x314124){return _0x15337a[_0xb7d5('0x29')](_0x44d111);}return _0x15337a[_0xb7d5('0x2a')](_0x44d111)[_0xb7d5('0x2b')]();};}function respondWithResult(_0x288c72,_0x23731d){_0x23731d=_0x23731d||0xc8;return function(_0x1c19ff){if(_0x1c19ff){return _0x288c72[_0xb7d5('0x2a')](_0x23731d)[_0xb7d5('0x2c')](_0x1c19ff);}};}function respondWithFilteredResult(_0x413baf,_0x7a6cfa){return function(_0x17671e){if(_0x17671e){var _0x555342=_0x17671e[_0xb7d5('0x2d')],_0x41e32b=_0x7a6cfa[_0xb7d5('0x2e')],_0x47161b=_0x7a6cfa[_0xb7d5('0x2e')]+_0x7a6cfa[_0xb7d5('0x2f')],_0x32c7de;if(_0x47161b>=_0x555342){_0x47161b=_0x555342;_0x32c7de=0xc8;}else{_0x32c7de=0xce;}_0x413baf['status'](_0x32c7de);return _0x413baf[_0xb7d5('0x30')]('Content-Range',_0x41e32b+'-'+_0x47161b+'/'+_0x555342)['json'](_0x17671e);}return null;};}function patchUpdates(_0x438562){return function(_0x3f6fe7){try{jsonpatch[_0xb7d5('0x31')](_0x3f6fe7,_0x438562,!![]);}catch(_0x3da4cf){return BPromise[_0xb7d5('0x32')](_0x3da4cf);}return _0x3f6fe7[_0xb7d5('0x33')]();};}function saveUpdates(_0x33bb99,_0x3128d1){return function(_0x2c3971){if(_0x2c3971){return _0x2c3971[_0xb7d5('0x34')](_0x33bb99)[_0xb7d5('0x1d')](function(_0x5b7a40){return _0x5b7a40;});}return null;};}function removeEntity(_0x4cd49e,_0x589661){return function(_0x4e8e64){if(_0x4e8e64){return _0x4e8e64[_0xb7d5('0x35')]()[_0xb7d5('0x1d')](function(){_0x4cd49e[_0xb7d5('0x2a')](0xcc)[_0xb7d5('0x2b')]();});}};}function handleEntityNotFound(_0x43dfd6,_0x503c9d){return function(_0x338996){if(!_0x338996){_0x43dfd6['sendStatus'](0x194);}return _0x338996;};}function handleError(_0x545940,_0x2986df){_0x2986df=_0x2986df||0x1f4;return function(_0x4b0622){logger[_0xb7d5('0x23')](_0x4b0622[_0xb7d5('0x36')]);if(_0x4b0622['name']){delete _0x4b0622['name'];}_0x545940[_0xb7d5('0x2a')](_0x2986df)[_0xb7d5('0x37')](_0x4b0622);};}exports[_0xb7d5('0x38')]=function(_0x5e39f7,_0x412ed9){var _0x477be0={},_0x427578={},_0xf33eb0={'count':0x0,'rows':[]};var _0x1033ed=_[_0xb7d5('0x39')](db[_0xb7d5('0x3a')]['rawAttributes'],function(_0x53a1a6){return{'name':_0x53a1a6[_0xb7d5('0x3b')],'type':_0x53a1a6[_0xb7d5('0x3c')]['key']};});_0x427578['model']=_[_0xb7d5('0x39')](_0x1033ed,_0xb7d5('0x3d'));_0x427578[_0xb7d5('0x3e')]=_['keys'](_0x5e39f7['query']);_0x427578[_0xb7d5('0x3f')]=_[_0xb7d5('0x40')](_0x427578[_0xb7d5('0x41')],_0x427578['query']);_0x477be0[_0xb7d5('0x42')]=_['intersection'](_0x427578['model'],qs[_0xb7d5('0x43')](_0x5e39f7[_0xb7d5('0x3e')][_0xb7d5('0x43')]));_0x477be0['attributes']=_0x477be0[_0xb7d5('0x42')][_0xb7d5('0x44')]?_0x477be0['attributes']:_0x427578[_0xb7d5('0x41')];if(!_0x5e39f7['query']['hasOwnProperty'](_0xb7d5('0x45'))){_0x477be0['limit']=qs['limit'](_0x5e39f7['query'][_0xb7d5('0x2f')]);_0x477be0[_0xb7d5('0x2e')]=qs[_0xb7d5('0x2e')](_0x5e39f7[_0xb7d5('0x3e')][_0xb7d5('0x2e')]);}_0x477be0[_0xb7d5('0x46')]=qs[_0xb7d5('0x47')](_0x5e39f7[_0xb7d5('0x3e')][_0xb7d5('0x47')]);_0x477be0[_0xb7d5('0x48')]=qs[_0xb7d5('0x3f')](_['pick'](_0x5e39f7['query'],_0x427578[_0xb7d5('0x3f')]));if(_0x5e39f7['query']['filter']){_0x477be0[_0xb7d5('0x48')]=_[_0xb7d5('0x49')](_0x477be0[_0xb7d5('0x48')],{'$or':_[_0xb7d5('0x39')](_0x1033ed,function(_0x3ab603){if(_0x3ab603['type']!==_0xb7d5('0x4a')){var _0x1337e8={};_0x1337e8[_0x3ab603['name']]={'$like':'%'+_0x5e39f7[_0xb7d5('0x3e')][_0xb7d5('0x4b')]+'%'};return _0x1337e8;}})});}_0x477be0=_['merge']({},_0x477be0,_0x5e39f7[_0xb7d5('0x4c')]);var _0x430260={'where':_0x477be0[_0xb7d5('0x48')]};return db['VtigerAccount'][_0xb7d5('0x2d')](_0x430260)[_0xb7d5('0x1d')](function(_0x464840){_0xf33eb0[_0xb7d5('0x2d')]=_0x464840;if(_0x5e39f7[_0xb7d5('0x3e')][_0xb7d5('0x4d')]){_0x477be0[_0xb7d5('0x4e')]=[{'all':!![]}];}return db['VtigerAccount']['findAll'](_0x477be0);})[_0xb7d5('0x1d')](function(_0x152efc){_0xf33eb0[_0xb7d5('0x4f')]=_0x152efc;return _0xf33eb0;})[_0xb7d5('0x1d')](respondWithFilteredResult(_0x412ed9,_0x477be0))['catch'](handleError(_0x412ed9,null));};exports[_0xb7d5('0x50')]=function(_0x5f31d9,_0x27df0c){var _0x16e0f1={'raw':![],'where':{'id':_0x5f31d9[_0xb7d5('0x51')]['id']}},_0x2bef19={};_0x2bef19['model']=_[_0xb7d5('0x52')](db[_0xb7d5('0x3a')][_0xb7d5('0x53')]);_0x2bef19[_0xb7d5('0x3e')]=_[_0xb7d5('0x52')](_0x5f31d9[_0xb7d5('0x3e')]);_0x2bef19[_0xb7d5('0x3f')]=_['intersection'](_0x2bef19['model'],_0x2bef19['query']);_0x16e0f1[_0xb7d5('0x42')]=_[_0xb7d5('0x40')](_0x2bef19[_0xb7d5('0x41')],qs['fields'](_0x5f31d9[_0xb7d5('0x3e')]['fields']));_0x16e0f1[_0xb7d5('0x42')]=_0x16e0f1['attributes'][_0xb7d5('0x44')]?_0x16e0f1[_0xb7d5('0x42')]:_0x2bef19['model'];if(_0x5f31d9[_0xb7d5('0x3e')][_0xb7d5('0x4d')]){_0x16e0f1[_0xb7d5('0x4e')]=[{'all':!![]}];}_0x16e0f1=_['merge']({},_0x16e0f1,_0x5f31d9[_0xb7d5('0x4c')]);return db[_0xb7d5('0x3a')][_0xb7d5('0x54')](_0x16e0f1)[_0xb7d5('0x1d')](handleEntityNotFound(_0x27df0c,null))[_0xb7d5('0x1d')](respondWithResult(_0x27df0c,null))[_0xb7d5('0x28')](handleError(_0x27df0c,null));};exports[_0xb7d5('0x55')]=function(_0x4a8b5d,_0x3ae842){return db[_0xb7d5('0x3a')]['create'](_0x4a8b5d[_0xb7d5('0x56')],{})[_0xb7d5('0x1d')](respondWithResult(_0x3ae842,0xc9))['catch'](handleError(_0x3ae842,null));};exports['update']=function(_0x3c99cd,_0x5776e4){if(_0x3c99cd['body']['id']){delete _0x3c99cd['body']['id'];}return db[_0xb7d5('0x3a')][_0xb7d5('0x54')]({'where':{'id':_0x3c99cd[_0xb7d5('0x51')]['id']}})['then'](handleEntityNotFound(_0x5776e4,null))[_0xb7d5('0x1d')](saveUpdates(_0x3c99cd['body'],null))[_0xb7d5('0x1d')](respondWithResult(_0x5776e4,null))[_0xb7d5('0x28')](handleError(_0x5776e4,null));};exports[_0xb7d5('0x35')]=function(_0x45c43b,_0x1ae382){return db[_0xb7d5('0x3a')][_0xb7d5('0x54')]({'where':{'id':_0x45c43b['params']['id']}})[_0xb7d5('0x1d')](handleEntityNotFound(_0x1ae382,null))[_0xb7d5('0x1d')](removeEntity(_0x1ae382,null))[_0xb7d5('0x28')](handleError(_0x1ae382,null));};exports[_0xb7d5('0x57')]=function(_0x53f7e6,_0x22bfb5,_0x3d2b16){var _0x1d409c={};var _0x4b9a3f={};var _0x232d51;var _0x4e7761;return db[_0xb7d5('0x3a')][_0xb7d5('0x58')]({'where':{'id':_0x53f7e6['params']['id']}})[_0xb7d5('0x1d')](handleEntityNotFound(_0x22bfb5,null))[_0xb7d5('0x1d')](function(_0x6d4e6e){if(_0x6d4e6e){_0x232d51=_0x6d4e6e;_0x4b9a3f[_0xb7d5('0x41')]=_[_0xb7d5('0x52')](db[_0xb7d5('0x59')]['rawAttributes']);_0x4b9a3f[_0xb7d5('0x3e')]=_[_0xb7d5('0x52')](_0x53f7e6[_0xb7d5('0x3e')]);_0x4b9a3f[_0xb7d5('0x3f')]=_['intersection'](_0x4b9a3f[_0xb7d5('0x41')],_0x4b9a3f[_0xb7d5('0x3e')]);_0x1d409c[_0xb7d5('0x42')]=_[_0xb7d5('0x40')](_0x4b9a3f['model'],qs[_0xb7d5('0x43')](_0x53f7e6['query']['fields']));_0x1d409c[_0xb7d5('0x42')]=_0x1d409c[_0xb7d5('0x42')][_0xb7d5('0x44')]?_0x1d409c['attributes']:_0x4b9a3f[_0xb7d5('0x41')];_0x1d409c[_0xb7d5('0x46')]=qs[_0xb7d5('0x47')](_0x53f7e6['query'][_0xb7d5('0x47')]);_0x1d409c[_0xb7d5('0x48')]=qs['filters'](_['pick'](_0x53f7e6[_0xb7d5('0x3e')],_0x4b9a3f[_0xb7d5('0x3f')]));if(_0x53f7e6[_0xb7d5('0x3e')]['filter']){_0x1d409c[_0xb7d5('0x48')]=_[_0xb7d5('0x49')](_0x1d409c[_0xb7d5('0x48')],{'$or':_[_0xb7d5('0x39')](_0x1d409c[_0xb7d5('0x42')],function(_0x22bdfb){var _0x18c211={};_0x18c211[_0x22bdfb]={'$like':'%'+_0x53f7e6[_0xb7d5('0x3e')]['filter']+'%'};return _0x18c211;})});}_0x1d409c=_[_0xb7d5('0x49')]({},_0x1d409c,_0x53f7e6[_0xb7d5('0x4c')]);return _0x232d51[_0xb7d5('0x57')](_0x1d409c);}})[_0xb7d5('0x1d')](function(_0x32ec83){if(_0x32ec83){_0x4e7761=_0x32ec83[_0xb7d5('0x44')];if(!_0x53f7e6[_0xb7d5('0x3e')][_0xb7d5('0x5a')]('nolimit')){_0x1d409c['limit']=qs['limit'](_0x53f7e6[_0xb7d5('0x3e')]['limit']);_0x1d409c[_0xb7d5('0x2e')]=qs[_0xb7d5('0x2e')](_0x53f7e6[_0xb7d5('0x3e')]['offset']);}return _0x232d51[_0xb7d5('0x57')](_0x1d409c);}})[_0xb7d5('0x1d')](function(_0x25c580){if(_0x25c580){return _0x25c580?{'count':_0x4e7761,'rows':_0x25c580}:null;}})[_0xb7d5('0x1d')](respondWithResult(_0x22bfb5,null))['catch'](handleError(_0x22bfb5,null));};exports['addConfiguration']=function(_0x2b8c19,_0x2b31a4,_0x1cc8e8){if(_0x2b8c19[_0xb7d5('0x56')]['id']){delete _0x2b8c19[_0xb7d5('0x56')]['id'];}return db[_0xb7d5('0x3a')]['findOne']({'where':{'id':_0x2b8c19[_0xb7d5('0x51')]['id']}})[_0xb7d5('0x1d')](handleEntityNotFound(_0x2b31a4,null))['then'](function(_0x534c9a){if(_0x534c9a){_0x2b8c19[_0xb7d5('0x56')]['AccountId']=_0x534c9a['id'];_0x2b8c19[_0xb7d5('0x56')][_0xb7d5('0x5b')]=integrations[_0xb7d5('0x5c')](_0x2b8c19['body']['channel'],_0x2b8c19[_0xb7d5('0x56')][_0xb7d5('0x3c')]);_0x2b8c19['body']['Descriptions']=integrations[_0xb7d5('0x5d')](_0x2b8c19[_0xb7d5('0x56')][_0xb7d5('0x5e')],_0x2b8c19[_0xb7d5('0x56')][_0xb7d5('0x3c')]);return db[_0xb7d5('0x59')]['create'](_0x2b8c19[_0xb7d5('0x56')],{'include':[{'model':db[_0xb7d5('0x5f')],'as':_0xb7d5('0x5b')},{'model':db['VtigerField'],'as':'Descriptions'}]});}return null;})[_0xb7d5('0x1d')](respondWithResult(_0x2b31a4,null))['catch'](handleError(_0x2b31a4,null));};var md5=require(_0xb7d5('0x60'));exports[_0xb7d5('0x61')]=function(_0x371667,_0x54b801,_0x1df41a){var _0x5606e8=null;var _0x6232d4=null;var _0x2599ac=null;var _0x24e350=null;var _0x199317='';return db[_0xb7d5('0x3a')][_0xb7d5('0x58')]({'where':{'id':_0x371667[_0xb7d5('0x51')]['id']},'attributes':['id',_0xb7d5('0x3d'),_0xb7d5('0x62'),_0xb7d5('0x63'),_0xb7d5('0x64'),_0xb7d5('0x65'),_0xb7d5('0x66'),_0xb7d5('0x67')]})[_0xb7d5('0x1d')](handleEntityNotFound(_0x54b801,null))[_0xb7d5('0x1d')](function(_0x59791b){if(_0x59791b){_0x5606e8=_0x59791b[_0xb7d5('0x62')];_0x6232d4=_0x59791b['accessKey'];_0x2599ac=_0x59791b[_0xb7d5('0x64')];_0x199317=_0x59791b[_0xb7d5('0x65')];var _0x2c5b97=_0x199317[_0xb7d5('0x68')](-0x1);if(_0x2c5b97==='/'){_0x199317=_0x199317['substring'](0x0,_0x199317[_0xb7d5('0x69')](_0x2c5b97));}_0x24e350=util[_0xb7d5('0x6a')](_0xb7d5('0x6b'),_0x199317);var _0x2f29eb={'method':'GET','uri':_0x24e350,'qs':{'operation':'getchallenge','username':_0x59791b['username']},'json':!![]};return rp(_0x2f29eb);}})['then'](function(_0x35b275){if(_0x35b275[_0xb7d5('0x6c')]){var _0x1d8686={'method':'POST','uri':_0x24e350,'form':{'operation':_0xb7d5('0x6d'),'username':_0x5606e8,'accessKey':md5(_0x35b275[_0xb7d5('0x27')][_0xb7d5('0x6e')]+_0x6232d4)},'json':!![]};return rp(_0x1d8686);}})['then'](function(_0x51a672){if(_0x51a672[_0xb7d5('0x6c')]){var _0x3f8225={'method':_0xb7d5('0x6f'),'uri':_0x24e350,'qs':{'operation':'describe','username':_0x5606e8,'sessionName':_0x51a672[_0xb7d5('0x27')]['sessionName'],'elementType':_0x2599ac},'json':!![]};return rp(_0x3f8225);}})[_0xb7d5('0x1d')](function(_0x202c55){if(_0x202c55[_0xb7d5('0x6c')]){var _0x405b22=[_0xb7d5('0x70'),_0xb7d5('0x71'),_0xb7d5('0x72')];_['remove'](_0x202c55[_0xb7d5('0x27')][_0xb7d5('0x43')],function(_0x6051e5){return _0x405b22[_0xb7d5('0x73')](_0x6051e5[_0xb7d5('0x3c')][_0xb7d5('0x3d')]);});_[_0xb7d5('0x74')](_0x202c55[_0xb7d5('0x27')][_0xb7d5('0x43')],function(_0x3a323e){return _0x3a323e[_0xb7d5('0x75')]===_0xb7d5('0x76');});return{'count':_0x202c55[_0xb7d5('0x27')][_0xb7d5('0x43')]['length'],'rows':_[_0xb7d5('0x39')](_0x202c55[_0xb7d5('0x27')]['fields'],function(_0x4af6a3){return{'id':_0x4af6a3[_0xb7d5('0x3d')],'name':_0x4af6a3[_0xb7d5('0x77')],'custom':_[_0xb7d5('0x78')](_0x4af6a3[_0xb7d5('0x3d')],'cf_')?!![]:![],'options':_0x4af6a3[_0xb7d5('0x3c')]['name']==='picklist'&&_0x4af6a3[_0xb7d5('0x3c')][_0xb7d5('0x79')][_0xb7d5('0x44')]>0x0?_[_0xb7d5('0x39')](_0x4af6a3[_0xb7d5('0x3c')][_0xb7d5('0x79')],function(_0x3b73d3){return{'name':_0x3b73d3[_0xb7d5('0x77')],'value':_0x3b73d3[_0xb7d5('0x7a')]};}):[]};})};}})[_0xb7d5('0x1d')](respondWithResult(_0x54b801,null))[_0xb7d5('0x28')](function(_0x9362c6){console[_0xb7d5('0x7b')]('vTiger\x20error:\x20'+_0x9362c6);var _0x48b197=_0x371667[_0xb7d5('0x3e')][_0xb7d5('0x18')]?0x1f4:_0x9362c6[_0xb7d5('0x7c')]||0x1f4;logger[_0xb7d5('0x23')](_0xb7d5('0x7d'),_0xb7d5('0x61'),_0x48b197,JSON[_0xb7d5('0x22')](_0x9362c6));delete _0x9362c6['name'];if(_0x48b197===0x191){_0x48b197=0x190;}_0x54b801[_0xb7d5('0x2a')](_0x48b197)[_0xb7d5('0x37')](_0x371667[_0xb7d5('0x3e')]['test']?{'message':_0xb7d5('0x7e'),'statusCode':_0x9362c6['statusCode']}:_0x9362c6);});}; \ No newline at end of file +var _0x038f=['debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','then','end','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','update','body','destroy','getConfigurations','findOne','VtigerConfiguration','nolimit','limit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','lastIndexOf','format','%s/webservice.php','GET','POST','login','token','success','describe','sessionName','reference','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','test','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','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x51a232,_0x1eadcd){var _0xcc19ca=function(_0x38b2e8){while(--_0x38b2e8){_0x51a232['push'](_0x51a232['shift']());}};_0xcc19ca(++_0x1eadcd);}(_0x038f,0xf4));var _0xf038=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x038f[_0x3d42d8];return _0x27fc41;};'use strict';var pdf=require(_0xf038('0x0'));var emlformat=require(_0xf038('0x1'));var rimraf=require(_0xf038('0x2'));var zipdir=require(_0xf038('0x3'));var jsonpatch=require(_0xf038('0x4'));var rp=require(_0xf038('0x5'));var moment=require(_0xf038('0x6'));var BPromise=require(_0xf038('0x7'));var Mustache=require(_0xf038('0x8'));var util=require(_0xf038('0x9'));var path=require(_0xf038('0xa'));var sox=require(_0xf038('0xb'));var csv=require(_0xf038('0xc'));var ejs=require(_0xf038('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf038('0xe'));var crypto=require(_0xf038('0xf'));var jsforce=require(_0xf038('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xf038('0xc'));var querystring=require(_0xf038('0x11'));var Papa=require(_0xf038('0x12'));var Redis=require(_0xf038('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xf038('0x14'));var as=require(_0xf038('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf038('0x16'))(_0xf038('0x17'));var utils=require('../../config/utils');var config=require(_0xf038('0x18'));var db=require(_0xf038('0x19'))['db'];var integrations=require(_0xf038('0x1a'));var jayson=require(_0xf038('0x1b'));var client=jayson[_0xf038('0x1c')][_0xf038('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x4835af,_0x400750,_0x22afd6){if(_0x22afd6){var _0x1e84ea=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1e84ea['test'](_0x400750)){return _0x4835af;}else{throw new db[(_0xf038('0x1e'))][(_0xf038('0x1f'))](_0xf038('0x20'));}}else{return _0x4835af;}}function respondWithRpcPromise(_0x1e430d,_0x17aecf,_0xcf47ee,_0x1d873a){return new BPromise(function(_0x49fb78,_0x78f97a){var _0xbf21b5=_0x1d873a||client;return _0xbf21b5[_0xf038('0x21')](_0x1e430d,_0xcf47ee)['then'](function(_0x32a46e){logger[_0xf038('0x22')](_0xf038('0x23'),_0x17aecf,'request\x20sent');logger[_0xf038('0x24')](_0xf038('0x25'),_0x17aecf,'request\x20sent',JSON[_0xf038('0x26')](_0x32a46e));if(_0x32a46e[_0xf038('0x27')]){if(_0x32a46e[_0xf038('0x27')][_0xf038('0x28')]===0x1f4){logger[_0xf038('0x27')]('VtigerAccount,\x20%s,\x20%s',_0x17aecf,_0x32a46e[_0xf038('0x27')][_0xf038('0x29')]);return _0x78f97a(_0x32a46e[_0xf038('0x27')]['message']);}logger['error'](_0xf038('0x23'),_0x17aecf,_0x32a46e[_0xf038('0x27')][_0xf038('0x29')]);return _0x49fb78(_0x32a46e['error'][_0xf038('0x29')]);}else{logger[_0xf038('0x22')](_0xf038('0x23'),_0x17aecf,_0xf038('0x2a'));_0x49fb78(_0x32a46e[_0xf038('0x2b')][_0xf038('0x29')]);}})[_0xf038('0x2c')](function(_0xe4305e){logger[_0xf038('0x27')]('VtigerAccount,\x20%s,\x20%s',_0x17aecf,_0xe4305e);_0x78f97a(_0xe4305e);});});}function respondWithStatusCode(_0x14661a,_0x1c8925){_0x1c8925=_0x1c8925||0xcc;return function(_0xcba55b){if(_0xcba55b){return _0x14661a[_0xf038('0x2d')](_0x1c8925);}return _0x14661a['status'](_0x1c8925)['end']();};}function respondWithResult(_0x3e03fa,_0x3949f0){_0x3949f0=_0x3949f0||0xc8;return function(_0x1c5b8a){if(_0x1c5b8a){return _0x3e03fa[_0xf038('0x2e')](_0x3949f0)['json'](_0x1c5b8a);}};}function respondWithFilteredResult(_0x3fb0a,_0x183cfa){return function(_0x2aa048){if(_0x2aa048){var _0x18be81=_0x2aa048[_0xf038('0x2f')],_0x572055=_0x183cfa['offset'],_0xec6a7f=_0x183cfa[_0xf038('0x30')]+_0x183cfa['limit'],_0x471135;if(_0xec6a7f>=_0x18be81){_0xec6a7f=_0x18be81;_0x471135=0xc8;}else{_0x471135=0xce;}_0x3fb0a['status'](_0x471135);return _0x3fb0a[_0xf038('0x31')](_0xf038('0x32'),_0x572055+'-'+_0xec6a7f+'/'+_0x18be81)[_0xf038('0x33')](_0x2aa048);}return null;};}function patchUpdates(_0xfb176){return function(_0x3e18ef){try{jsonpatch[_0xf038('0x34')](_0x3e18ef,_0xfb176,!![]);}catch(_0x5d3045){return BPromise[_0xf038('0x35')](_0x5d3045);}return _0x3e18ef[_0xf038('0x36')]();};}function saveUpdates(_0x2c4b6f,_0x43806d){return function(_0x168813){if(_0x168813){return _0x168813['update'](_0x2c4b6f)[_0xf038('0x37')](function(_0x24003f){return _0x24003f;});}return null;};}function removeEntity(_0x23ee91,_0x4e0a91){return function(_0x34d950){if(_0x34d950){return _0x34d950['destroy']()[_0xf038('0x37')](function(){_0x23ee91[_0xf038('0x2e')](0xcc)[_0xf038('0x38')]();});}};}function handleEntityNotFound(_0x5af01f,_0x599df9){return function(_0x8adcaa){if(!_0x8adcaa){_0x5af01f[_0xf038('0x2d')](0x194);}return _0x8adcaa;};}function handleError(_0x3ad753,_0x5b38f5){_0x5b38f5=_0x5b38f5||0x1f4;return function(_0x4d17a0){logger[_0xf038('0x27')](_0x4d17a0[_0xf038('0x39')]);if(_0x4d17a0[_0xf038('0x3a')]){delete _0x4d17a0[_0xf038('0x3a')];}_0x3ad753[_0xf038('0x2e')](_0x5b38f5)[_0xf038('0x3b')](_0x4d17a0);};}exports[_0xf038('0x3c')]=function(_0x4c9b7f,_0x28a691){var _0x5bd231={},_0x4fb117={},_0x357fd0={'count':0x0,'rows':[]};var _0x35dbfa=_[_0xf038('0x3d')](db[_0xf038('0x3e')][_0xf038('0x3f')],function(_0x4fd349){return{'name':_0x4fd349[_0xf038('0x40')],'type':_0x4fd349[_0xf038('0x41')][_0xf038('0x42')]};});_0x4fb117[_0xf038('0x43')]=_['map'](_0x35dbfa,_0xf038('0x3a'));_0x4fb117['query']=_[_0xf038('0x44')](_0x4c9b7f[_0xf038('0x45')]);_0x4fb117['filters']=_[_0xf038('0x46')](_0x4fb117[_0xf038('0x43')],_0x4fb117['query']);_0x5bd231[_0xf038('0x47')]=_[_0xf038('0x46')](_0x4fb117[_0xf038('0x43')],qs[_0xf038('0x48')](_0x4c9b7f[_0xf038('0x45')][_0xf038('0x48')]));_0x5bd231[_0xf038('0x47')]=_0x5bd231[_0xf038('0x47')][_0xf038('0x49')]?_0x5bd231['attributes']:_0x4fb117['model'];if(!_0x4c9b7f['query'][_0xf038('0x4a')]('nolimit')){_0x5bd231['limit']=qs['limit'](_0x4c9b7f[_0xf038('0x45')]['limit']);_0x5bd231['offset']=qs[_0xf038('0x30')](_0x4c9b7f['query'][_0xf038('0x30')]);}_0x5bd231[_0xf038('0x4b')]=qs['sort'](_0x4c9b7f['query'][_0xf038('0x4c')]);_0x5bd231['where']=qs['filters'](_[_0xf038('0x4d')](_0x4c9b7f[_0xf038('0x45')],_0x4fb117[_0xf038('0x4e')]));if(_0x4c9b7f[_0xf038('0x45')][_0xf038('0x4f')]){_0x5bd231[_0xf038('0x50')]=_[_0xf038('0x51')](_0x5bd231['where'],{'$or':_[_0xf038('0x3d')](_0x35dbfa,function(_0x5d7003){if(_0x5d7003[_0xf038('0x41')]!==_0xf038('0x52')){var _0x32d307={};_0x32d307[_0x5d7003[_0xf038('0x3a')]]={'$like':'%'+_0x4c9b7f[_0xf038('0x45')][_0xf038('0x4f')]+'%'};return _0x32d307;}})});}_0x5bd231=_[_0xf038('0x51')]({},_0x5bd231,_0x4c9b7f[_0xf038('0x53')]);var _0x784367={'where':_0x5bd231['where']};return db['VtigerAccount'][_0xf038('0x2f')](_0x784367)[_0xf038('0x37')](function(_0x110a32){_0x357fd0[_0xf038('0x2f')]=_0x110a32;if(_0x4c9b7f[_0xf038('0x45')][_0xf038('0x54')]){_0x5bd231[_0xf038('0x55')]=[{'all':!![]}];}return db[_0xf038('0x3e')][_0xf038('0x56')](_0x5bd231);})['then'](function(_0x31da55){_0x357fd0[_0xf038('0x57')]=_0x31da55;return _0x357fd0;})[_0xf038('0x37')](respondWithFilteredResult(_0x28a691,_0x5bd231))['catch'](handleError(_0x28a691,null));};exports[_0xf038('0x58')]=function(_0x3748e5,_0x1dfaa4){var _0xc7faf={'raw':![],'where':{'id':_0x3748e5[_0xf038('0x59')]['id']}},_0x308e83={};_0x308e83[_0xf038('0x43')]=_['keys'](db[_0xf038('0x3e')]['rawAttributes']);_0x308e83[_0xf038('0x45')]=_[_0xf038('0x44')](_0x3748e5[_0xf038('0x45')]);_0x308e83[_0xf038('0x4e')]=_[_0xf038('0x46')](_0x308e83[_0xf038('0x43')],_0x308e83['query']);_0xc7faf[_0xf038('0x47')]=_[_0xf038('0x46')](_0x308e83[_0xf038('0x43')],qs['fields'](_0x3748e5[_0xf038('0x45')][_0xf038('0x48')]));_0xc7faf['attributes']=_0xc7faf[_0xf038('0x47')][_0xf038('0x49')]?_0xc7faf['attributes']:_0x308e83[_0xf038('0x43')];if(_0x3748e5[_0xf038('0x45')][_0xf038('0x54')]){_0xc7faf[_0xf038('0x55')]=[{'all':!![]}];}_0xc7faf=_[_0xf038('0x51')]({},_0xc7faf,_0x3748e5[_0xf038('0x53')]);return db[_0xf038('0x3e')][_0xf038('0x5a')](_0xc7faf)[_0xf038('0x37')](handleEntityNotFound(_0x1dfaa4,null))[_0xf038('0x37')](respondWithResult(_0x1dfaa4,null))[_0xf038('0x2c')](handleError(_0x1dfaa4,null));};exports['create']=function(_0x1d696d,_0x594ef1){return db['VtigerAccount']['create'](_0x1d696d['body'],{})['then'](respondWithResult(_0x594ef1,0xc9))[_0xf038('0x2c')](handleError(_0x594ef1,null));};exports[_0xf038('0x5b')]=function(_0x3c9f31,_0x540248){if(_0x3c9f31['body']['id']){delete _0x3c9f31[_0xf038('0x5c')]['id'];}return db['VtigerAccount'][_0xf038('0x5a')]({'where':{'id':_0x3c9f31['params']['id']}})[_0xf038('0x37')](handleEntityNotFound(_0x540248,null))[_0xf038('0x37')](saveUpdates(_0x3c9f31[_0xf038('0x5c')],null))[_0xf038('0x37')](respondWithResult(_0x540248,null))[_0xf038('0x2c')](handleError(_0x540248,null));};exports[_0xf038('0x5d')]=function(_0x169912,_0x2b0460){return db[_0xf038('0x3e')][_0xf038('0x5a')]({'where':{'id':_0x169912[_0xf038('0x59')]['id']}})[_0xf038('0x37')](handleEntityNotFound(_0x2b0460,null))[_0xf038('0x37')](removeEntity(_0x2b0460,null))['catch'](handleError(_0x2b0460,null));};exports[_0xf038('0x5e')]=function(_0x139aa9,_0x3c8a30,_0x3c904a){var _0x567963={};var _0x4ff4e7={};var _0x562d07;var _0x23967e;return db['VtigerAccount'][_0xf038('0x5f')]({'where':{'id':_0x139aa9[_0xf038('0x59')]['id']}})[_0xf038('0x37')](handleEntityNotFound(_0x3c8a30,null))[_0xf038('0x37')](function(_0x48f41b){if(_0x48f41b){_0x562d07=_0x48f41b;_0x4ff4e7['model']=_[_0xf038('0x44')](db[_0xf038('0x60')]['rawAttributes']);_0x4ff4e7[_0xf038('0x45')]=_[_0xf038('0x44')](_0x139aa9[_0xf038('0x45')]);_0x4ff4e7['filters']=_['intersection'](_0x4ff4e7[_0xf038('0x43')],_0x4ff4e7[_0xf038('0x45')]);_0x567963[_0xf038('0x47')]=_[_0xf038('0x46')](_0x4ff4e7[_0xf038('0x43')],qs[_0xf038('0x48')](_0x139aa9[_0xf038('0x45')][_0xf038('0x48')]));_0x567963['attributes']=_0x567963[_0xf038('0x47')][_0xf038('0x49')]?_0x567963['attributes']:_0x4ff4e7[_0xf038('0x43')];_0x567963[_0xf038('0x4b')]=qs[_0xf038('0x4c')](_0x139aa9[_0xf038('0x45')]['sort']);_0x567963[_0xf038('0x50')]=qs[_0xf038('0x4e')](_[_0xf038('0x4d')](_0x139aa9['query'],_0x4ff4e7[_0xf038('0x4e')]));if(_0x139aa9[_0xf038('0x45')]['filter']){_0x567963['where']=_[_0xf038('0x51')](_0x567963[_0xf038('0x50')],{'$or':_['map'](_0x567963[_0xf038('0x47')],function(_0x3d95ce){var _0x5b70a3={};_0x5b70a3[_0x3d95ce]={'$like':'%'+_0x139aa9[_0xf038('0x45')][_0xf038('0x4f')]+'%'};return _0x5b70a3;})});}_0x567963=_[_0xf038('0x51')]({},_0x567963,_0x139aa9['options']);return _0x562d07['getConfigurations'](_0x567963);}})['then'](function(_0x33e879){if(_0x33e879){_0x23967e=_0x33e879[_0xf038('0x49')];if(!_0x139aa9[_0xf038('0x45')]['hasOwnProperty'](_0xf038('0x61'))){_0x567963[_0xf038('0x62')]=qs['limit'](_0x139aa9['query'][_0xf038('0x62')]);_0x567963['offset']=qs[_0xf038('0x30')](_0x139aa9['query'][_0xf038('0x30')]);}return _0x562d07[_0xf038('0x5e')](_0x567963);}})[_0xf038('0x37')](function(_0x4724a4){if(_0x4724a4){return _0x4724a4?{'count':_0x23967e,'rows':_0x4724a4}:null;}})[_0xf038('0x37')](respondWithResult(_0x3c8a30,null))[_0xf038('0x2c')](handleError(_0x3c8a30,null));};exports[_0xf038('0x63')]=function(_0x39bbb7,_0x235291,_0x1b8b9f){if(_0x39bbb7[_0xf038('0x5c')]['id']){delete _0x39bbb7[_0xf038('0x5c')]['id'];}return db[_0xf038('0x3e')][_0xf038('0x5f')]({'where':{'id':_0x39bbb7['params']['id']}})[_0xf038('0x37')](handleEntityNotFound(_0x235291,null))['then'](function(_0x479c34){if(_0x479c34){_0x39bbb7['body'][_0xf038('0x64')]=_0x479c34['id'];_0x39bbb7[_0xf038('0x5c')][_0xf038('0x65')]=integrations[_0xf038('0x66')](_0x39bbb7[_0xf038('0x5c')][_0xf038('0x67')],_0x39bbb7['body'][_0xf038('0x41')]);_0x39bbb7[_0xf038('0x5c')][_0xf038('0x68')]=integrations[_0xf038('0x69')](_0x39bbb7['body'][_0xf038('0x67')],_0x39bbb7[_0xf038('0x5c')]['type']);return db[_0xf038('0x60')]['create'](_0x39bbb7[_0xf038('0x5c')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xf038('0x6a')],'as':_0xf038('0x68')}]});}return null;})[_0xf038('0x37')](respondWithResult(_0x235291,null))['catch'](handleError(_0x235291,null));};var md5=require('md5');exports[_0xf038('0x6b')]=function(_0x1b85a3,_0x22ef22,_0x5a4afe){var _0x3fdde8=null;var _0x518d8e=null;var _0x2ee42b=null;var _0x55ed64=null;var _0x384565='';return db[_0xf038('0x3e')][_0xf038('0x5f')]({'where':{'id':_0x1b85a3['params']['id']},'attributes':['id',_0xf038('0x3a'),_0xf038('0x6c'),_0xf038('0x6d'),_0xf038('0x6e'),_0xf038('0x6f'),_0xf038('0x70'),_0xf038('0x71')]})[_0xf038('0x37')](handleEntityNotFound(_0x22ef22,null))[_0xf038('0x37')](function(_0x53d81e){if(_0x53d81e){_0x3fdde8=_0x53d81e[_0xf038('0x6c')];_0x518d8e=_0x53d81e[_0xf038('0x71')];_0x2ee42b=_0x53d81e[_0xf038('0x6e')];_0x384565=_0x53d81e[_0xf038('0x6f')];var _0x5d040e=_0x384565['slice'](-0x1);if(_0x5d040e==='/'){_0x384565=_0x384565['substring'](0x0,_0x384565[_0xf038('0x72')](_0x5d040e));}_0x55ed64=util[_0xf038('0x73')](_0xf038('0x74'),_0x384565);var _0x232316={'method':_0xf038('0x75'),'uri':_0x55ed64,'qs':{'operation':'getchallenge','username':_0x53d81e[_0xf038('0x6c')]},'json':!![]};return rp(_0x232316);}})[_0xf038('0x37')](function(_0x109d96){if(_0x109d96['success']){var _0x509fe5={'method':_0xf038('0x76'),'uri':_0x55ed64,'form':{'operation':_0xf038('0x77'),'username':_0x3fdde8,'accessKey':md5(_0x109d96['result'][_0xf038('0x78')]+_0x518d8e)},'json':!![]};return rp(_0x509fe5);}})[_0xf038('0x37')](function(_0x487577){if(_0x487577[_0xf038('0x79')]){var _0x37770c={'method':_0xf038('0x75'),'uri':_0x55ed64,'qs':{'operation':_0xf038('0x7a'),'username':_0x3fdde8,'sessionName':_0x487577[_0xf038('0x2b')][_0xf038('0x7b')],'elementType':_0x2ee42b},'json':!![]};return rp(_0x37770c);}})[_0xf038('0x37')](function(_0xd441e1){if(_0xd441e1[_0xf038('0x79')]){var _0x4ef0d4=['autogenerated',_0xf038('0x7c'),'owner'];_[_0xf038('0x7d')](_0xd441e1['result'][_0xf038('0x48')],function(_0x7cc580){return _0x4ef0d4[_0xf038('0x7e')](_0x7cc580['type'][_0xf038('0x3a')]);});_[_0xf038('0x7d')](_0xd441e1['result'][_0xf038('0x48')],function(_0x928f1b){return _0x928f1b[_0xf038('0x7f')]===_0xf038('0x80');});return{'count':_0xd441e1[_0xf038('0x2b')]['fields'][_0xf038('0x49')],'rows':_['map'](_0xd441e1[_0xf038('0x2b')]['fields'],function(_0x4f0ab3){return{'id':_0x4f0ab3['name'],'name':_0x4f0ab3[_0xf038('0x81')],'custom':_[_0xf038('0x82')](_0x4f0ab3[_0xf038('0x3a')],_0xf038('0x83'))?!![]:![],'options':_0x4f0ab3[_0xf038('0x41')][_0xf038('0x3a')]===_0xf038('0x84')&&_0x4f0ab3['type'][_0xf038('0x85')][_0xf038('0x49')]>0x0?_['map'](_0x4f0ab3['type'][_0xf038('0x85')],function(_0x33f921){return{'name':_0x33f921[_0xf038('0x81')],'value':_0x33f921[_0xf038('0x86')]};}):[]};})};}})[_0xf038('0x37')](respondWithResult(_0x22ef22,null))['catch'](function(_0x395a80){console[_0xf038('0x87')]('vTiger\x20error:\x20'+_0x395a80);var _0x127e49=_0x1b85a3[_0xf038('0x45')][_0xf038('0x88')]?0x1f4:_0x395a80[_0xf038('0x89')]||0x1f4;logger[_0xf038('0x27')](_0xf038('0x8a'),_0xf038('0x6b'),_0x127e49,JSON[_0xf038('0x26')](_0x395a80));delete _0x395a80['name'];if(_0x127e49===0x191){_0x127e49=0x190;}_0x22ef22[_0xf038('0x2e')](_0x127e49)[_0xf038('0x3b')](_0x1b85a3[_0xf038('0x45')][_0xf038('0x88')]?{'message':_0xf038('0x8b'),'statusCode':_0x395a80[_0xf038('0x89')]}:_0x395a80);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 47016c5..f4cbab4 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 _0xea85=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','define','VtigerAccount','int_vtiger_accounts','lodash','util','api','moment'];(function(_0x3ed2ae,_0x1f2259){var _0x251aee=function(_0x573f27){while(--_0x573f27){_0x3ed2ae['push'](_0x3ed2ae['shift']());}};_0x251aee(++_0x1f2259);}(_0xea85,0xd9));var _0x5ea8=function(_0x566acc,_0x5f42ec){_0x566acc=_0x566acc-0x0;var _0x4a6c6e=_0xea85[_0x566acc];return _0x4a6c6e;};'use strict';var _=require(_0x5ea8('0x0'));var util=require(_0x5ea8('0x1'));var logger=require('../../config/logger')(_0x5ea8('0x2'));var moment=require(_0x5ea8('0x3'));var BPromise=require(_0x5ea8('0x4'));var rp=require(_0x5ea8('0x5'));var fs=require('fs');var path=require(_0x5ea8('0x6'));var rimraf=require(_0x5ea8('0x7'));var config=require(_0x5ea8('0x8'));var attributes=require(_0x5ea8('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5e5e2a,_0x1e6095){return _0x5e5e2a[_0x5ea8('0xa')](_0x5ea8('0xb'),attributes,{'tableName':_0x5ea8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c6e=['../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','int_vtiger_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4d282d,_0x4ec060){var _0x31fd1f=function(_0x1404a6){while(--_0x1404a6){_0x4d282d['push'](_0x4d282d['shift']());}};_0x31fd1f(++_0x4ec060);}(_0x2c6e,0xac));var _0xe2c6=function(_0x112773,_0x3d7a4d){_0x112773=_0x112773-0x0;var _0x289f3f=_0x2c6e[_0x112773];return _0x289f3f;};'use strict';var _=require('lodash');var util=require(_0xe2c6('0x0'));var logger=require(_0xe2c6('0x1'))(_0xe2c6('0x2'));var moment=require(_0xe2c6('0x3'));var BPromise=require(_0xe2c6('0x4'));var rp=require(_0xe2c6('0x5'));var fs=require('fs');var path=require(_0xe2c6('0x6'));var rimraf=require(_0xe2c6('0x7'));var config=require(_0xe2c6('0x8'));var attributes=require(_0xe2c6('0x9'));var integrations=require(_0xe2c6('0xa'));module['exports']=function(_0x25fc98,_0x5f02f2){return _0x25fc98['define']('VtigerAccount',attributes,{'tableName':_0xe2c6('0xb'),'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 4587168..f65016e 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 _0x6238=['../../config/logger','rpc','../../config/environment','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','include','map','model','attributes','ShowVtigerAccount','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x43b1fb,_0x22e01e){var _0x2eb5bc=function(_0x1622a4){while(--_0x1622a4){_0x43b1fb['push'](_0x43b1fb['shift']());}};_0x2eb5bc(++_0x22e01e);}(_0x6238,0x118));var _0x8623=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6238[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x8623('0x0'));var util=require(_0x8623('0x1'));var moment=require(_0x8623('0x2'));var BPromise=require(_0x8623('0x3'));var rs=require(_0x8623('0x4'));var fs=require('fs');var Redis=require(_0x8623('0x5'));var db=require(_0x8623('0x6'))['db'];var utils=require(_0x8623('0x7'));var logger=require(_0x8623('0x8'))(_0x8623('0x9'));var config=require(_0x8623('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8623('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57ab28,_0x408855,_0x2b1484){return new BPromise(function(_0x2ab910,_0x1b12bd){return client[_0x8623('0xc')](_0x57ab28,_0x2b1484)[_0x8623('0xd')](function(_0x4d3a2c){logger[_0x8623('0xe')](_0x8623('0xf'),_0x408855,_0x8623('0x10'));logger[_0x8623('0x11')](_0x8623('0x12'),_0x408855,'request\x20sent',JSON['stringify'](_0x4d3a2c));if(_0x4d3a2c[_0x8623('0x13')]){if(_0x4d3a2c['error'][_0x8623('0x14')]===0x1f4){logger[_0x8623('0x13')](_0x8623('0xf'),_0x408855,_0x4d3a2c[_0x8623('0x13')][_0x8623('0x15')]);return _0x1b12bd(_0x4d3a2c[_0x8623('0x13')][_0x8623('0x15')]);}logger[_0x8623('0x13')](_0x8623('0xf'),_0x408855,_0x4d3a2c[_0x8623('0x13')]['message']);return _0x2ab910(_0x4d3a2c[_0x8623('0x13')][_0x8623('0x15')]);}else{logger[_0x8623('0xe')](_0x8623('0xf'),_0x408855,_0x8623('0x10'));_0x2ab910(_0x4d3a2c[_0x8623('0x16')][_0x8623('0x15')]);}})[_0x8623('0x17')](function(_0x2a4ec5){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x408855,_0x2a4ec5);_0x1b12bd(_0x2a4ec5);});});}exports[_0x8623('0x18')]=function(_0x323156){var _0x4b7fe2=this;return new Promise(function(_0x12f723,_0x2a71c7){return db[_0x8623('0x19')][_0x8623('0x1a')]({'raw':_0x323156[_0x8623('0x1b')]?_0x323156[_0x8623('0x1b')][_0x8623('0x1c')]===undefined?!![]:![]:!![],'where':_0x323156[_0x8623('0x1b')]?_0x323156['options'][_0x8623('0x1d')]||null:null,'attributes':_0x323156[_0x8623('0x1b')]?_0x323156[_0x8623('0x1b')]['attributes']||null:null,'limit':_0x323156[_0x8623('0x1b')]?_0x323156[_0x8623('0x1b')]['limit']||null:null,'include':_0x323156[_0x8623('0x1b')]?_0x323156['options'][_0x8623('0x1e')]?_[_0x8623('0x1f')](_0x323156['options'][_0x8623('0x1e')],function(_0x4600c9){return{'model':db[_0x4600c9[_0x8623('0x20')]],'as':_0x4600c9['as'],'attributes':_0x4600c9[_0x8623('0x21')],'include':_0x4600c9[_0x8623('0x1e')]?_[_0x8623('0x1f')](_0x4600c9['include'],function(_0x23f32f){return{'model':db[_0x23f32f['model']],'as':_0x23f32f['as'],'attributes':_0x23f32f[_0x8623('0x21')],'include':_0x23f32f[_0x8623('0x1e')]?_[_0x8623('0x1f')](_0x23f32f[_0x8623('0x1e')],function(_0x34fffb){return{'model':db[_0x34fffb[_0x8623('0x20')]],'as':_0x34fffb['as'],'attributes':_0x34fffb[_0x8623('0x21')]};}):[]};}):[]};}):[]:[]})[_0x8623('0xd')](function(_0x13ddce){logger[_0x8623('0xe')](_0x8623('0x18'),_0x323156);logger[_0x8623('0x11')](_0x8623('0x18'),_0x323156,JSON['stringify'](_0x13ddce));_0x12f723(_0x13ddce);})['catch'](function(_0x714668){logger[_0x8623('0x13')]('GetVtigerAccount',_0x714668['message'],_0x323156);_0x2a71c7(_0x4b7fe2[_0x8623('0x13')](0x1f4,_0x714668[_0x8623('0x15')]));});});};exports['ShowVtigerAccount']=function(_0x543f29){var _0x595295=this;return new Promise(function(_0x17e1e3,_0x5728e1){return db[_0x8623('0x19')]['find']({'raw':_0x543f29[_0x8623('0x1b')]?_0x543f29[_0x8623('0x1b')][_0x8623('0x1c')]===undefined?!![]:![]:!![],'where':_0x543f29[_0x8623('0x1b')]?_0x543f29[_0x8623('0x1b')][_0x8623('0x1d')]||null:null,'attributes':_0x543f29[_0x8623('0x1b')]?_0x543f29[_0x8623('0x1b')]['attributes']||null:null,'include':_0x543f29['options']?_0x543f29[_0x8623('0x1b')]['include']?_[_0x8623('0x1f')](_0x543f29[_0x8623('0x1b')][_0x8623('0x1e')],function(_0x3dacc2){return{'model':db[_0x3dacc2[_0x8623('0x20')]],'as':_0x3dacc2['as'],'attributes':_0x3dacc2[_0x8623('0x21')],'include':_0x3dacc2[_0x8623('0x1e')]?_[_0x8623('0x1f')](_0x3dacc2[_0x8623('0x1e')],function(_0x2036ae){return{'model':db[_0x2036ae[_0x8623('0x20')]],'as':_0x2036ae['as'],'attributes':_0x2036ae[_0x8623('0x21')],'include':_0x2036ae['include']?_[_0x8623('0x1f')](_0x2036ae[_0x8623('0x1e')],function(_0x319257){return{'model':db[_0x319257['model']],'as':_0x319257['as'],'attributes':_0x319257['attributes']};}):[]};}):[]};}):[]:[]})[_0x8623('0xd')](function(_0x9123a){logger[_0x8623('0xe')](_0x8623('0x22'),_0x543f29);logger[_0x8623('0x11')](_0x8623('0x22'),_0x543f29,JSON[_0x8623('0x23')](_0x9123a));_0x17e1e3(_0x9123a);})[_0x8623('0x17')](function(_0x53756d){logger[_0x8623('0x13')](_0x8623('0x22'),_0x53756d['message'],_0x543f29);_0x5728e1(_0x595295[_0x8623('0x13')](0x1f4,_0x53756d['message']));});});}; \ No newline at end of file +var _0x153a=['VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVtigerAccount','VtigerAccount','findAll','options','attributes','limit','include','map','model','then','stringify','ShowVtigerAccount','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x14b516,_0x25a727){var _0x450e4a=function(_0x18488f){while(--_0x18488f){_0x14b516['push'](_0x14b516['shift']());}};_0x450e4a(++_0x25a727);}(_0x153a,0x122));var _0xa153=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x153a[_0x1a7846];return _0x48049;};'use strict';var _=require(_0xa153('0x0'));var util=require('util');var moment=require(_0xa153('0x1'));var BPromise=require(_0xa153('0x2'));var rs=require(_0xa153('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa153('0x4'))['db'];var utils=require(_0xa153('0x5'));var logger=require(_0xa153('0x6'))(_0xa153('0x7'));var config=require('../../config/environment');var jayson=require(_0xa153('0x8'));var client=jayson[_0xa153('0x9')][_0xa153('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xcde29f,_0x114743,_0x1efe8c){return new BPromise(function(_0x366415,_0x1699bd){return client[_0xa153('0xb')](_0xcde29f,_0x1efe8c)['then'](function(_0x541077){logger[_0xa153('0xc')](_0xa153('0xd'),_0x114743,_0xa153('0xe'));logger[_0xa153('0xf')](_0xa153('0x10'),_0x114743,_0xa153('0xe'),JSON['stringify'](_0x541077));if(_0x541077[_0xa153('0x11')]){if(_0x541077['error'][_0xa153('0x12')]===0x1f4){logger[_0xa153('0x11')](_0xa153('0xd'),_0x114743,_0x541077[_0xa153('0x11')][_0xa153('0x13')]);return _0x1699bd(_0x541077[_0xa153('0x11')][_0xa153('0x13')]);}logger[_0xa153('0x11')](_0xa153('0xd'),_0x114743,_0x541077[_0xa153('0x11')][_0xa153('0x13')]);return _0x366415(_0x541077['error'][_0xa153('0x13')]);}else{logger['info'](_0xa153('0xd'),_0x114743,_0xa153('0xe'));_0x366415(_0x541077['result'][_0xa153('0x13')]);}})[_0xa153('0x14')](function(_0x522f7b){logger[_0xa153('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x114743,_0x522f7b);_0x1699bd(_0x522f7b);});});}exports[_0xa153('0x15')]=function(_0x4ad23f){var _0x22f497=this;return new Promise(function(_0x43a12e,_0x3afe6e){return db[_0xa153('0x16')][_0xa153('0x17')]({'raw':_0x4ad23f['options']?_0x4ad23f['options']['raw']===undefined?!![]:![]:!![],'where':_0x4ad23f[_0xa153('0x18')]?_0x4ad23f['options']['where']||null:null,'attributes':_0x4ad23f[_0xa153('0x18')]?_0x4ad23f[_0xa153('0x18')][_0xa153('0x19')]||null:null,'limit':_0x4ad23f[_0xa153('0x18')]?_0x4ad23f['options'][_0xa153('0x1a')]||null:null,'include':_0x4ad23f[_0xa153('0x18')]?_0x4ad23f[_0xa153('0x18')][_0xa153('0x1b')]?_[_0xa153('0x1c')](_0x4ad23f[_0xa153('0x18')][_0xa153('0x1b')],function(_0x460be8){return{'model':db[_0x460be8['model']],'as':_0x460be8['as'],'attributes':_0x460be8[_0xa153('0x19')],'include':_0x460be8[_0xa153('0x1b')]?_[_0xa153('0x1c')](_0x460be8[_0xa153('0x1b')],function(_0x47724a){return{'model':db[_0x47724a['model']],'as':_0x47724a['as'],'attributes':_0x47724a[_0xa153('0x19')],'include':_0x47724a[_0xa153('0x1b')]?_[_0xa153('0x1c')](_0x47724a[_0xa153('0x1b')],function(_0x418a32){return{'model':db[_0x418a32[_0xa153('0x1d')]],'as':_0x418a32['as'],'attributes':_0x418a32[_0xa153('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa153('0x1e')](function(_0x91c806){logger[_0xa153('0xc')](_0xa153('0x15'),_0x4ad23f);logger['debug'](_0xa153('0x15'),_0x4ad23f,JSON[_0xa153('0x1f')](_0x91c806));_0x43a12e(_0x91c806);})[_0xa153('0x14')](function(_0x3924f3){logger['error'](_0xa153('0x15'),_0x3924f3[_0xa153('0x13')],_0x4ad23f);_0x3afe6e(_0x22f497[_0xa153('0x11')](0x1f4,_0x3924f3[_0xa153('0x13')]));});});};exports[_0xa153('0x20')]=function(_0x3acefa){var _0x2fa311=this;return new Promise(function(_0x123c3b,_0x3d03a5){return db[_0xa153('0x16')]['find']({'raw':_0x3acefa['options']?_0x3acefa[_0xa153('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3acefa['options']?_0x3acefa[_0xa153('0x18')][_0xa153('0x21')]||null:null,'attributes':_0x3acefa[_0xa153('0x18')]?_0x3acefa[_0xa153('0x18')]['attributes']||null:null,'include':_0x3acefa[_0xa153('0x18')]?_0x3acefa[_0xa153('0x18')][_0xa153('0x1b')]?_['map'](_0x3acefa[_0xa153('0x18')][_0xa153('0x1b')],function(_0x222e0b){return{'model':db[_0x222e0b[_0xa153('0x1d')]],'as':_0x222e0b['as'],'attributes':_0x222e0b[_0xa153('0x19')],'include':_0x222e0b[_0xa153('0x1b')]?_[_0xa153('0x1c')](_0x222e0b[_0xa153('0x1b')],function(_0x5211aa){return{'model':db[_0x5211aa[_0xa153('0x1d')]],'as':_0x5211aa['as'],'attributes':_0x5211aa[_0xa153('0x19')],'include':_0x5211aa['include']?_[_0xa153('0x1c')](_0x5211aa['include'],function(_0xd67d44){return{'model':db[_0xd67d44['model']],'as':_0xd67d44['as'],'attributes':_0xd67d44['attributes']};}):[]};}):[]};}):[]:[]})[_0xa153('0x1e')](function(_0x1aa66a){logger[_0xa153('0xc')](_0xa153('0x20'),_0x3acefa);logger['debug'](_0xa153('0x20'),_0x3acefa,JSON[_0xa153('0x1f')](_0x1aa66a));_0x123c3b(_0x1aa66a);})[_0xa153('0x14')](function(_0x1cd30b){logger[_0xa153('0x11')](_0xa153('0x20'),_0x1cd30b[_0xa153('0x13')],_0x3acefa);_0x3d03a5(_0x2fa311[_0xa153('0x11')](0x1f4,_0x1cd30b[_0xa153('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 2a076aa..43fe53a 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(_0x224527,_0x2daeb0){var _0x5cb8ef=function(_0x442991){while(--_0x442991){_0x224527['push'](_0x224527['shift']());}};_0x5cb8ef(++_0x2daeb0);}(_0xb10b,0x12a));var _0xbb10=function(_0x2e2f84,_0x24e46f){_0x2e2f84=_0x2e2f84-0x0;var _0x448191=_0xb10b[_0x2e2f84];return _0x448191;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('0x15')]=router; \ No newline at end of file +var _0xd8b0=['isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','index','get','/:id','show'];(function(_0x312ff8,_0x5d7167){var _0x4e144b=function(_0x8c0bd5){while(--_0x8c0bd5){_0x312ff8['push'](_0x312ff8['shift']());}};_0x4e144b(++_0x5d7167);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/fields',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['post']('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x11')]);router[_0x0d8b('0x12')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x13')]);router[_0x0d8b('0x14')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);module[_0x0d8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index c521e3c..38adb0c 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 _0x05ab=['STRING','sequelize'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x05ab,0x1c7));var _0xb05a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x05ab[_0x1caf6a];return _0x1bf493;};'use strict';var Sequelize=require(_0xb05a('0x0'));module['exports']={'name':{'type':Sequelize[_0xb05a('0x1')]},'description':{'type':Sequelize[_0xb05a('0x1')]}}; \ No newline at end of file +var _0x4be2=['STRING','sequelize','exports'];(function(_0xa87d32,_0x17d3d8){var _0xaa140c=function(_0x33fe34){while(--_0x33fe34){_0xa87d32['push'](_0xa87d32['shift']());}};_0xaa140c(++_0x17d3d8);}(_0x4be2,0x145));var _0x24be=function(_0x267be3,_0x18ef5f){_0x267be3=_0x267be3-0x0;var _0x57fe29=_0x4be2[_0x267be3];return _0x57fe29;};'use strict';var Sequelize=require(_0x24be('0x0'));module[_0x24be('0x1')]={'name':{'type':Sequelize[_0x24be('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 92ba283..e768e32 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 _0x8c8e=['destroy','stack','name','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','find','getFields','findOne','VtigerField','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','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','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8c8e,0xe7));var _0xe8c8=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x8c8e[_0x425716];return _0x2d39af;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe8c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe8c8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8c8('0x2'));var moment=require(_0xe8c8('0x3'));var BPromise=require(_0xe8c8('0x4'));var Mustache=require(_0xe8c8('0x5'));var util=require('util');var path=require(_0xe8c8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe8c8('0x7'));var squel=require(_0xe8c8('0x8'));var crypto=require(_0xe8c8('0x9'));var jsforce=require(_0xe8c8('0xa'));var deskjs=require(_0xe8c8('0xb'));var toCsv=require(_0xe8c8('0xc'));var querystring=require(_0xe8c8('0xd'));var Papa=require('papaparse');var Redis=require(_0xe8c8('0xe'));var authService=require(_0xe8c8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe8c8('0x10'));var hardwareService=require(_0xe8c8('0x11'));var logger=require(_0xe8c8('0x12'))(_0xe8c8('0x13'));var utils=require(_0xe8c8('0x14'));var config=require(_0xe8c8('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xe8c8('0x16')][_0xe8c8('0x17')]({'port':0x232a});function checkPasswordPattern(_0x1b1808,_0x15fa1a,_0x354fab){if(_0x354fab){var _0x1c2056=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1c2056[_0xe8c8('0x18')](_0x15fa1a)){return _0x1b1808;}else{throw new db[(_0xe8c8('0x19'))][(_0xe8c8('0x1a'))](_0xe8c8('0x1b'));}}else{return _0x1b1808;}}function respondWithRpcPromise(_0x3a9fc5,_0x11edaa,_0x1e295c,_0x41ab88){return new BPromise(function(_0xad462d,_0x109575){var _0x3bef29=_0x41ab88||client;return _0x3bef29[_0xe8c8('0x1c')](_0x3a9fc5,_0x1e295c)[_0xe8c8('0x1d')](function(_0x4b9d12){logger[_0xe8c8('0x1e')]('VtigerConfiguration,\x20%s,\x20%s',_0x11edaa,'request\x20sent');logger[_0xe8c8('0x1f')](_0xe8c8('0x20'),_0x11edaa,_0xe8c8('0x21'),JSON[_0xe8c8('0x22')](_0x4b9d12));if(_0x4b9d12['error']){if(_0x4b9d12[_0xe8c8('0x23')][_0xe8c8('0x24')]===0x1f4){logger[_0xe8c8('0x23')](_0xe8c8('0x25'),_0x11edaa,_0x4b9d12[_0xe8c8('0x23')][_0xe8c8('0x26')]);return _0x109575(_0x4b9d12[_0xe8c8('0x23')]['message']);}logger[_0xe8c8('0x23')]('VtigerConfiguration,\x20%s,\x20%s',_0x11edaa,_0x4b9d12[_0xe8c8('0x23')][_0xe8c8('0x26')]);return _0xad462d(_0x4b9d12[_0xe8c8('0x23')][_0xe8c8('0x26')]);}else{logger['info'](_0xe8c8('0x25'),_0x11edaa,_0xe8c8('0x21'));_0xad462d(_0x4b9d12['result'][_0xe8c8('0x26')]);}})['catch'](function(_0x1c76f6){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x11edaa,_0x1c76f6);_0x109575(_0x1c76f6);});});}function respondWithStatusCode(_0x5aeaf7,_0x22551a){_0x22551a=_0x22551a||0xcc;return function(_0x3393cb){if(_0x3393cb){return _0x5aeaf7[_0xe8c8('0x27')](_0x22551a);}return _0x5aeaf7[_0xe8c8('0x28')](_0x22551a)[_0xe8c8('0x29')]();};}function respondWithResult(_0x4533b6,_0x3a7223){_0x3a7223=_0x3a7223||0xc8;return function(_0x31bf5c){if(_0x31bf5c){return _0x4533b6['status'](_0x3a7223)[_0xe8c8('0x2a')](_0x31bf5c);}};}function respondWithFilteredResult(_0x9a0ad3,_0x47ca39){return function(_0x2e80f3){if(_0x2e80f3){var _0x33d230=_0x2e80f3[_0xe8c8('0x2b')],_0x3f8026=_0x47ca39[_0xe8c8('0x2c')],_0x415e01=_0x47ca39['offset']+_0x47ca39[_0xe8c8('0x2d')],_0x2e970f;if(_0x415e01>=_0x33d230){_0x415e01=_0x33d230;_0x2e970f=0xc8;}else{_0x2e970f=0xce;}_0x9a0ad3['status'](_0x2e970f);return _0x9a0ad3[_0xe8c8('0x2e')](_0xe8c8('0x2f'),_0x3f8026+'-'+_0x415e01+'/'+_0x33d230)['json'](_0x2e80f3);}return null;};}function patchUpdates(_0x544d6c){return function(_0x44fc4a){try{jsonpatch[_0xe8c8('0x30')](_0x44fc4a,_0x544d6c,!![]);}catch(_0x496245){return BPromise[_0xe8c8('0x31')](_0x496245);}return _0x44fc4a['save']();};}function saveUpdates(_0x466a4d,_0x698e78){return function(_0x39cf21){if(_0x39cf21){return _0x39cf21[_0xe8c8('0x32')](_0x466a4d)[_0xe8c8('0x1d')](function(_0x128036){return _0x128036;});}return null;};}function removeEntity(_0x3b093f,_0x1c3b1e){return function(_0x4cc683){if(_0x4cc683){return _0x4cc683[_0xe8c8('0x33')]()[_0xe8c8('0x1d')](function(){_0x3b093f[_0xe8c8('0x28')](0xcc)[_0xe8c8('0x29')]();});}};}function handleEntityNotFound(_0x3a5bb8,_0x134822){return function(_0x1805c0){if(!_0x1805c0){_0x3a5bb8[_0xe8c8('0x27')](0x194);}return _0x1805c0;};}function handleError(_0x11411c,_0x294b5e){_0x294b5e=_0x294b5e||0x1f4;return function(_0x5db3fe){logger[_0xe8c8('0x23')](_0x5db3fe[_0xe8c8('0x34')]);if(_0x5db3fe[_0xe8c8('0x35')]){delete _0x5db3fe[_0xe8c8('0x35')];}_0x11411c[_0xe8c8('0x28')](_0x294b5e)['send'](_0x5db3fe);};}exports[_0xe8c8('0x36')]=function(_0x903e76,_0x1ef5b8){var _0x3bebb6={},_0x37f0f3={},_0x17eaeb={'count':0x0,'rows':[]};var _0x226445=_['map'](db[_0xe8c8('0x37')][_0xe8c8('0x38')],function(_0x3d0f55){return{'name':_0x3d0f55[_0xe8c8('0x39')],'type':_0x3d0f55[_0xe8c8('0x3a')][_0xe8c8('0x3b')]};});_0x37f0f3[_0xe8c8('0x3c')]=_[_0xe8c8('0x3d')](_0x226445,'name');_0x37f0f3[_0xe8c8('0x3e')]=_[_0xe8c8('0x3f')](_0x903e76[_0xe8c8('0x3e')]);_0x37f0f3['filters']=_[_0xe8c8('0x40')](_0x37f0f3[_0xe8c8('0x3c')],_0x37f0f3[_0xe8c8('0x3e')]);_0x3bebb6[_0xe8c8('0x41')]=_['intersection'](_0x37f0f3['model'],qs['fields'](_0x903e76[_0xe8c8('0x3e')]['fields']));_0x3bebb6[_0xe8c8('0x41')]=_0x3bebb6[_0xe8c8('0x41')][_0xe8c8('0x42')]?_0x3bebb6[_0xe8c8('0x41')]:_0x37f0f3[_0xe8c8('0x3c')];if(!_0x903e76[_0xe8c8('0x3e')]['hasOwnProperty'](_0xe8c8('0x43'))){_0x3bebb6['limit']=qs[_0xe8c8('0x2d')](_0x903e76[_0xe8c8('0x3e')][_0xe8c8('0x2d')]);_0x3bebb6['offset']=qs[_0xe8c8('0x2c')](_0x903e76[_0xe8c8('0x3e')][_0xe8c8('0x2c')]);}_0x3bebb6[_0xe8c8('0x44')]=qs[_0xe8c8('0x45')](_0x903e76[_0xe8c8('0x3e')]['sort']);_0x3bebb6[_0xe8c8('0x46')]=qs[_0xe8c8('0x47')](_[_0xe8c8('0x48')](_0x903e76[_0xe8c8('0x3e')],_0x37f0f3['filters']));if(_0x903e76[_0xe8c8('0x3e')][_0xe8c8('0x49')]){_0x3bebb6[_0xe8c8('0x46')]=_[_0xe8c8('0x4a')](_0x3bebb6[_0xe8c8('0x46')],{'$or':_[_0xe8c8('0x3d')](_0x226445,function(_0xf3ff3c){if(_0xf3ff3c[_0xe8c8('0x3a')]!==_0xe8c8('0x4b')){var _0x5cc7fd={};_0x5cc7fd[_0xf3ff3c[_0xe8c8('0x35')]]={'$like':'%'+_0x903e76['query'][_0xe8c8('0x49')]+'%'};return _0x5cc7fd;}})});}_0x3bebb6=_['merge']({},_0x3bebb6,_0x903e76[_0xe8c8('0x4c')]);var _0x38d613={'where':_0x3bebb6[_0xe8c8('0x46')]};return db[_0xe8c8('0x37')][_0xe8c8('0x2b')](_0x38d613)['then'](function(_0x2e5a86){_0x17eaeb['count']=_0x2e5a86;if(_0x903e76[_0xe8c8('0x3e')][_0xe8c8('0x4d')]){_0x3bebb6[_0xe8c8('0x4e')]=[{'all':!![]}];}return db[_0xe8c8('0x37')][_0xe8c8('0x4f')](_0x3bebb6);})[_0xe8c8('0x1d')](function(_0xde495a){_0x17eaeb[_0xe8c8('0x50')]=_0xde495a;return _0x17eaeb;})['then'](respondWithFilteredResult(_0x1ef5b8,_0x3bebb6))['catch'](handleError(_0x1ef5b8,null));};exports[_0xe8c8('0x51')]=function(_0x9b977d,_0x4691b0){var _0x3c5634={'raw':![],'where':{'id':_0x9b977d[_0xe8c8('0x52')]['id']}},_0x310d3c={};_0x310d3c[_0xe8c8('0x3c')]=_[_0xe8c8('0x3f')](db[_0xe8c8('0x37')][_0xe8c8('0x38')]);_0x310d3c['query']=_[_0xe8c8('0x3f')](_0x9b977d[_0xe8c8('0x3e')]);_0x310d3c[_0xe8c8('0x47')]=_[_0xe8c8('0x40')](_0x310d3c[_0xe8c8('0x3c')],_0x310d3c[_0xe8c8('0x3e')]);_0x3c5634['attributes']=_[_0xe8c8('0x40')](_0x310d3c['model'],qs[_0xe8c8('0x53')](_0x9b977d['query']['fields']));_0x3c5634[_0xe8c8('0x41')]=_0x3c5634['attributes'][_0xe8c8('0x42')]?_0x3c5634[_0xe8c8('0x41')]:_0x310d3c[_0xe8c8('0x3c')];if(_0x9b977d[_0xe8c8('0x3e')][_0xe8c8('0x4d')]){_0x3c5634[_0xe8c8('0x4e')]=[{'all':!![]}];}_0x3c5634=_['merge']({},_0x3c5634,_0x9b977d['options']);return db[_0xe8c8('0x37')]['find'](_0x3c5634)[_0xe8c8('0x1d')](handleEntityNotFound(_0x4691b0,null))[_0xe8c8('0x1d')](respondWithResult(_0x4691b0,null))[_0xe8c8('0x54')](handleError(_0x4691b0,null));};exports[_0xe8c8('0x55')]=function(_0x21492d,_0x26fe34){return db[_0xe8c8('0x37')][_0xe8c8('0x55')](_0x21492d[_0xe8c8('0x56')],{})[_0xe8c8('0x1d')](respondWithResult(_0x26fe34,0xc9))[_0xe8c8('0x54')](handleError(_0x26fe34,null));};exports[_0xe8c8('0x32')]=function(_0x453d89,_0x516645){if(_0x453d89[_0xe8c8('0x56')]['id']){delete _0x453d89[_0xe8c8('0x56')]['id'];}return db[_0xe8c8('0x37')][_0xe8c8('0x57')]({'where':{'id':_0x453d89['params']['id']}})[_0xe8c8('0x1d')](handleEntityNotFound(_0x516645,null))[_0xe8c8('0x1d')](saveUpdates(_0x453d89['body'],null))['then'](respondWithResult(_0x516645,null))[_0xe8c8('0x54')](handleError(_0x516645,null));};exports[_0xe8c8('0x33')]=function(_0xa651a7,_0x2dbf69){return db[_0xe8c8('0x37')][_0xe8c8('0x57')]({'where':{'id':_0xa651a7[_0xe8c8('0x52')]['id']}})['then'](handleEntityNotFound(_0x2dbf69,null))[_0xe8c8('0x1d')](removeEntity(_0x2dbf69,null))['catch'](handleError(_0x2dbf69,null));};exports[_0xe8c8('0x58')]=function(_0x522a17,_0x3acb0e,_0x46c398){var _0x22fe6f={};var _0x3c8850={};var _0x31154e;var _0x380182;return db['VtigerConfiguration'][_0xe8c8('0x59')]({'where':{'id':_0x522a17[_0xe8c8('0x52')]['id']}})[_0xe8c8('0x1d')](handleEntityNotFound(_0x3acb0e,null))['then'](function(_0x4256e9){if(_0x4256e9){_0x31154e=_0x4256e9;_0x3c8850['model']=_['keys'](db[_0xe8c8('0x5a')]['rawAttributes']);_0x3c8850['query']=_['keys'](_0x522a17[_0xe8c8('0x3e')]);_0x3c8850[_0xe8c8('0x47')]=_[_0xe8c8('0x40')](_0x3c8850[_0xe8c8('0x3c')],_0x3c8850[_0xe8c8('0x3e')]);_0x22fe6f[_0xe8c8('0x41')]=_['intersection'](_0x3c8850[_0xe8c8('0x3c')],qs[_0xe8c8('0x53')](_0x522a17[_0xe8c8('0x3e')]['fields']));_0x22fe6f[_0xe8c8('0x41')]=_0x22fe6f['attributes'][_0xe8c8('0x42')]?_0x22fe6f['attributes']:_0x3c8850[_0xe8c8('0x3c')];_0x22fe6f[_0xe8c8('0x44')]=qs['sort'](_0x522a17[_0xe8c8('0x3e')][_0xe8c8('0x45')]);_0x22fe6f[_0xe8c8('0x46')]=qs[_0xe8c8('0x47')](_[_0xe8c8('0x48')](_0x522a17[_0xe8c8('0x3e')],_0x3c8850[_0xe8c8('0x47')]));if(_0x522a17['query'][_0xe8c8('0x49')]){_0x22fe6f[_0xe8c8('0x46')]=_['merge'](_0x22fe6f['where'],{'$or':_['map'](_0x22fe6f[_0xe8c8('0x41')],function(_0xec5b00){var _0x21349c={};_0x21349c[_0xec5b00]={'$like':'%'+_0x522a17[_0xe8c8('0x3e')]['filter']+'%'};return _0x21349c;})});}_0x22fe6f=_['merge']({},_0x22fe6f,_0x522a17[_0xe8c8('0x4c')]);return _0x31154e[_0xe8c8('0x58')](_0x22fe6f);}})[_0xe8c8('0x1d')](function(_0x22baa3){if(_0x22baa3){_0x380182=_0x22baa3[_0xe8c8('0x42')];if(!_0x522a17[_0xe8c8('0x3e')][_0xe8c8('0x5b')](_0xe8c8('0x43'))){_0x22fe6f[_0xe8c8('0x2d')]=qs[_0xe8c8('0x2d')](_0x522a17[_0xe8c8('0x3e')][_0xe8c8('0x2d')]);_0x22fe6f['offset']=qs[_0xe8c8('0x2c')](_0x522a17[_0xe8c8('0x3e')]['offset']);}return _0x31154e[_0xe8c8('0x58')](_0x22fe6f);}})[_0xe8c8('0x1d')](function(_0x184951){if(_0x184951){return _0x184951?{'count':_0x380182,'rows':_0x184951}:null;}})[_0xe8c8('0x1d')](respondWithResult(_0x3acb0e,null))[_0xe8c8('0x54')](handleError(_0x3acb0e,null));};exports[_0xe8c8('0x5c')]=function(_0x42d0bc,_0x2dab10,_0x30df6b){var _0x541c30={};var _0x53fd93={};var _0x1c3c38;var _0x5171a4;return db[_0xe8c8('0x37')][_0xe8c8('0x59')]({'where':{'id':_0x42d0bc[_0xe8c8('0x52')]['id']}})[_0xe8c8('0x1d')](handleEntityNotFound(_0x2dab10,null))[_0xe8c8('0x1d')](function(_0x2a1cdf){if(_0x2a1cdf){_0x1c3c38=_0x2a1cdf;_0x53fd93['model']=_[_0xe8c8('0x3f')](db['VtigerField'][_0xe8c8('0x38')]);_0x53fd93[_0xe8c8('0x3e')]=_[_0xe8c8('0x3f')](_0x42d0bc[_0xe8c8('0x3e')]);_0x53fd93['filters']=_[_0xe8c8('0x40')](_0x53fd93[_0xe8c8('0x3c')],_0x53fd93[_0xe8c8('0x3e')]);_0x541c30[_0xe8c8('0x41')]=_[_0xe8c8('0x40')](_0x53fd93[_0xe8c8('0x3c')],qs[_0xe8c8('0x53')](_0x42d0bc[_0xe8c8('0x3e')][_0xe8c8('0x53')]));_0x541c30[_0xe8c8('0x41')]=_0x541c30['attributes'][_0xe8c8('0x42')]?_0x541c30[_0xe8c8('0x41')]:_0x53fd93[_0xe8c8('0x3c')];_0x541c30[_0xe8c8('0x44')]=qs[_0xe8c8('0x45')](_0x42d0bc[_0xe8c8('0x3e')][_0xe8c8('0x45')]);_0x541c30[_0xe8c8('0x46')]=qs['filters'](_['pick'](_0x42d0bc[_0xe8c8('0x3e')],_0x53fd93[_0xe8c8('0x47')]));if(_0x42d0bc[_0xe8c8('0x3e')]['filter']){_0x541c30['where']=_[_0xe8c8('0x4a')](_0x541c30[_0xe8c8('0x46')],{'$or':_[_0xe8c8('0x3d')](_0x541c30[_0xe8c8('0x41')],function(_0x237d82){var _0x8a356d={};_0x8a356d[_0x237d82]={'$like':'%'+_0x42d0bc[_0xe8c8('0x3e')][_0xe8c8('0x49')]+'%'};return _0x8a356d;})});}_0x541c30=_['merge']({},_0x541c30,_0x42d0bc[_0xe8c8('0x4c')]);return _0x1c3c38[_0xe8c8('0x5c')](_0x541c30);}})[_0xe8c8('0x1d')](function(_0x5cf78b){if(_0x5cf78b){_0x5171a4=_0x5cf78b[_0xe8c8('0x42')];if(!_0x42d0bc[_0xe8c8('0x3e')]['hasOwnProperty'](_0xe8c8('0x43'))){_0x541c30['limit']=qs['limit'](_0x42d0bc['query'][_0xe8c8('0x2d')]);_0x541c30['offset']=qs['offset'](_0x42d0bc[_0xe8c8('0x3e')][_0xe8c8('0x2c')]);}return _0x1c3c38[_0xe8c8('0x5c')](_0x541c30);}})[_0xe8c8('0x1d')](function(_0x1a0ae3){if(_0x1a0ae3){return _0x1a0ae3?{'count':_0x5171a4,'rows':_0x1a0ae3}:null;}})[_0xe8c8('0x1d')](respondWithResult(_0x2dab10,null))[_0xe8c8('0x54')](handleError(_0x2dab10,null));};exports[_0xe8c8('0x5d')]=function(_0x2a9efb,_0x3d1f29,_0x3fc1e0){var _0x2bf023={};var _0x508941={};var _0xfd7cef;var _0xa8a5f5;return db['VtigerConfiguration'][_0xe8c8('0x59')]({'where':{'id':_0x2a9efb['params']['id']}})[_0xe8c8('0x1d')](handleEntityNotFound(_0x3d1f29,null))[_0xe8c8('0x1d')](function(_0x515b24){if(_0x515b24){_0xfd7cef=_0x515b24;_0x508941['model']=_[_0xe8c8('0x3f')](db[_0xe8c8('0x5a')][_0xe8c8('0x38')]);_0x508941[_0xe8c8('0x3e')]=_[_0xe8c8('0x3f')](_0x2a9efb['query']);_0x508941[_0xe8c8('0x47')]=_[_0xe8c8('0x40')](_0x508941[_0xe8c8('0x3c')],_0x508941['query']);_0x2bf023[_0xe8c8('0x41')]=_[_0xe8c8('0x40')](_0x508941['model'],qs[_0xe8c8('0x53')](_0x2a9efb['query'][_0xe8c8('0x53')]));_0x2bf023[_0xe8c8('0x41')]=_0x2bf023['attributes'][_0xe8c8('0x42')]?_0x2bf023[_0xe8c8('0x41')]:_0x508941[_0xe8c8('0x3c')];_0x2bf023['order']=qs[_0xe8c8('0x45')](_0x2a9efb[_0xe8c8('0x3e')][_0xe8c8('0x45')]);_0x2bf023['where']=qs[_0xe8c8('0x47')](_[_0xe8c8('0x48')](_0x2a9efb['query'],_0x508941[_0xe8c8('0x47')]));if(_0x2a9efb[_0xe8c8('0x3e')][_0xe8c8('0x49')]){_0x2bf023[_0xe8c8('0x46')]=_[_0xe8c8('0x4a')](_0x2bf023[_0xe8c8('0x46')],{'$or':_[_0xe8c8('0x3d')](_0x2bf023[_0xe8c8('0x41')],function(_0x3327e7){var _0x3db1b7={};_0x3db1b7[_0x3327e7]={'$like':'%'+_0x2a9efb[_0xe8c8('0x3e')][_0xe8c8('0x49')]+'%'};return _0x3db1b7;})});}_0x2bf023=_[_0xe8c8('0x4a')]({},_0x2bf023,_0x2a9efb['options']);return _0xfd7cef[_0xe8c8('0x5d')](_0x2bf023);}})[_0xe8c8('0x1d')](function(_0x16e820){if(_0x16e820){_0xa8a5f5=_0x16e820['length'];if(!_0x2a9efb['query'][_0xe8c8('0x5b')](_0xe8c8('0x43'))){_0x2bf023[_0xe8c8('0x2d')]=qs[_0xe8c8('0x2d')](_0x2a9efb[_0xe8c8('0x3e')]['limit']);_0x2bf023[_0xe8c8('0x2c')]=qs[_0xe8c8('0x2c')](_0x2a9efb[_0xe8c8('0x3e')]['offset']);}return _0xfd7cef['getDescriptions'](_0x2bf023);}})['then'](function(_0x3b557c){if(_0x3b557c){return _0x3b557c?{'count':_0xa8a5f5,'rows':_0x3b557c}:null;}})[_0xe8c8('0x1d')](respondWithResult(_0x3d1f29,null))['catch'](handleError(_0x3d1f29,null));}; \ No newline at end of file +var _0xc620=['key','model','query','keys','filters','attributes','intersection','fields','nolimit','limit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','destroy','VtigerField','getFields','hasOwnProperty','getSubjects','order','options','getDescriptions','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','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','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','end','count','offset','Content-Range','json','reject','save','update','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type'];(function(_0x46224b,_0x10ea5b){var _0x3f7876=function(_0x12cad0){while(--_0x12cad0){_0x46224b['push'](_0x46224b['shift']());}};_0x3f7876(++_0x10ea5b);}(_0xc620,0x138));var _0x0c62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc620[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x0c62('0x0'));var emlformat=require(_0x0c62('0x1'));var rimraf=require(_0x0c62('0x2'));var zipdir=require(_0x0c62('0x3'));var jsonpatch=require(_0x0c62('0x4'));var rp=require(_0x0c62('0x5'));var moment=require(_0x0c62('0x6'));var BPromise=require(_0x0c62('0x7'));var Mustache=require(_0x0c62('0x8'));var util=require(_0x0c62('0x9'));var path=require(_0x0c62('0xa'));var sox=require(_0x0c62('0xb'));var csv=require(_0x0c62('0xc'));var ejs=require(_0x0c62('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0c62('0xe'));var crypto=require(_0x0c62('0xf'));var jsforce=require(_0x0c62('0x10'));var deskjs=require(_0x0c62('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0c62('0x12'));var Redis=require(_0x0c62('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0c62('0x14'));var hardwareService=require(_0x0c62('0x15'));var logger=require(_0x0c62('0x16'))('api');var utils=require(_0x0c62('0x17'));var config=require(_0x0c62('0x18'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x0c62('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x39a1a8,_0x58321c,_0x42999b){if(_0x42999b){var _0x1cb33c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1cb33c['test'](_0x58321c)){return _0x39a1a8;}else{throw new db[(_0x0c62('0x1a'))][(_0x0c62('0x1b'))](_0x0c62('0x1c'));}}else{return _0x39a1a8;}}function respondWithRpcPromise(_0x53b30b,_0x28b9ff,_0x205a8c,_0xfef5a1){return new BPromise(function(_0x55cc1e,_0x517c06){var _0x456b6f=_0xfef5a1||client;return _0x456b6f[_0x0c62('0x1d')](_0x53b30b,_0x205a8c)[_0x0c62('0x1e')](function(_0x113171){logger[_0x0c62('0x1f')](_0x0c62('0x20'),_0x28b9ff,_0x0c62('0x21'));logger[_0x0c62('0x22')](_0x0c62('0x23'),_0x28b9ff,'request\x20sent',JSON['stringify'](_0x113171));if(_0x113171[_0x0c62('0x24')]){if(_0x113171[_0x0c62('0x24')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x28b9ff,_0x113171[_0x0c62('0x24')][_0x0c62('0x25')]);return _0x517c06(_0x113171[_0x0c62('0x24')]['message']);}logger[_0x0c62('0x24')](_0x0c62('0x20'),_0x28b9ff,_0x113171[_0x0c62('0x24')]['message']);return _0x55cc1e(_0x113171['error'][_0x0c62('0x25')]);}else{logger[_0x0c62('0x1f')]('VtigerConfiguration,\x20%s,\x20%s',_0x28b9ff,'request\x20sent');_0x55cc1e(_0x113171['result']['message']);}})['catch'](function(_0x1db1eb){logger[_0x0c62('0x24')](_0x0c62('0x20'),_0x28b9ff,_0x1db1eb);_0x517c06(_0x1db1eb);});});}function respondWithStatusCode(_0x169342,_0x2049fa){_0x2049fa=_0x2049fa||0xcc;return function(_0x2f36f9){if(_0x2f36f9){return _0x169342[_0x0c62('0x26')](_0x2049fa);}return _0x169342[_0x0c62('0x27')](_0x2049fa)[_0x0c62('0x28')]();};}function respondWithResult(_0x32d783,_0x504364){_0x504364=_0x504364||0xc8;return function(_0x45f310){if(_0x45f310){return _0x32d783[_0x0c62('0x27')](_0x504364)['json'](_0x45f310);}};}function respondWithFilteredResult(_0x1b1b92,_0x48e873){return function(_0x7d53ae){if(_0x7d53ae){var _0x407be0=_0x7d53ae[_0x0c62('0x29')],_0x246034=_0x48e873[_0x0c62('0x2a')],_0x6d0319=_0x48e873[_0x0c62('0x2a')]+_0x48e873['limit'],_0x45fcfd;if(_0x6d0319>=_0x407be0){_0x6d0319=_0x407be0;_0x45fcfd=0xc8;}else{_0x45fcfd=0xce;}_0x1b1b92['status'](_0x45fcfd);return _0x1b1b92['set'](_0x0c62('0x2b'),_0x246034+'-'+_0x6d0319+'/'+_0x407be0)[_0x0c62('0x2c')](_0x7d53ae);}return null;};}function patchUpdates(_0x757c4f){return function(_0x336eb4){try{jsonpatch['apply'](_0x336eb4,_0x757c4f,!![]);}catch(_0x40901e){return BPromise[_0x0c62('0x2d')](_0x40901e);}return _0x336eb4[_0x0c62('0x2e')]();};}function saveUpdates(_0x47278f,_0x5ad9cf){return function(_0x347ed4){if(_0x347ed4){return _0x347ed4[_0x0c62('0x2f')](_0x47278f)['then'](function(_0x134f63){return _0x134f63;});}return null;};}function removeEntity(_0x3dd146,_0x4d9ab1){return function(_0x5a072c){if(_0x5a072c){return _0x5a072c['destroy']()[_0x0c62('0x1e')](function(){_0x3dd146[_0x0c62('0x27')](0xcc)[_0x0c62('0x28')]();});}};}function handleEntityNotFound(_0x5e3111,_0x42da31){return function(_0x2de9c2){if(!_0x2de9c2){_0x5e3111['sendStatus'](0x194);}return _0x2de9c2;};}function handleError(_0x5740f4,_0x22844d){_0x22844d=_0x22844d||0x1f4;return function(_0x5580b4){logger[_0x0c62('0x24')](_0x5580b4['stack']);if(_0x5580b4['name']){delete _0x5580b4[_0x0c62('0x30')];}_0x5740f4[_0x0c62('0x27')](_0x22844d)[_0x0c62('0x31')](_0x5580b4);};}exports[_0x0c62('0x32')]=function(_0x68f47,_0xe7fbec){var _0xecae0f={},_0x10f1b5={},_0xa1f24b={'count':0x0,'rows':[]};var _0x18017f=_[_0x0c62('0x33')](db[_0x0c62('0x34')][_0x0c62('0x35')],function(_0x4e1e36){return{'name':_0x4e1e36[_0x0c62('0x36')],'type':_0x4e1e36[_0x0c62('0x37')][_0x0c62('0x38')]};});_0x10f1b5[_0x0c62('0x39')]=_[_0x0c62('0x33')](_0x18017f,_0x0c62('0x30'));_0x10f1b5[_0x0c62('0x3a')]=_[_0x0c62('0x3b')](_0x68f47[_0x0c62('0x3a')]);_0x10f1b5[_0x0c62('0x3c')]=_['intersection'](_0x10f1b5['model'],_0x10f1b5[_0x0c62('0x3a')]);_0xecae0f[_0x0c62('0x3d')]=_[_0x0c62('0x3e')](_0x10f1b5[_0x0c62('0x39')],qs['fields'](_0x68f47[_0x0c62('0x3a')][_0x0c62('0x3f')]));_0xecae0f[_0x0c62('0x3d')]=_0xecae0f[_0x0c62('0x3d')]['length']?_0xecae0f[_0x0c62('0x3d')]:_0x10f1b5[_0x0c62('0x39')];if(!_0x68f47[_0x0c62('0x3a')]['hasOwnProperty'](_0x0c62('0x40'))){_0xecae0f[_0x0c62('0x41')]=qs[_0x0c62('0x41')](_0x68f47['query']['limit']);_0xecae0f[_0x0c62('0x2a')]=qs[_0x0c62('0x2a')](_0x68f47[_0x0c62('0x3a')][_0x0c62('0x2a')]);}_0xecae0f['order']=qs[_0x0c62('0x42')](_0x68f47[_0x0c62('0x3a')][_0x0c62('0x42')]);_0xecae0f[_0x0c62('0x43')]=qs[_0x0c62('0x3c')](_[_0x0c62('0x44')](_0x68f47[_0x0c62('0x3a')],_0x10f1b5['filters']));if(_0x68f47[_0x0c62('0x3a')][_0x0c62('0x45')]){_0xecae0f['where']=_['merge'](_0xecae0f[_0x0c62('0x43')],{'$or':_[_0x0c62('0x33')](_0x18017f,function(_0x324cf6){if(_0x324cf6[_0x0c62('0x37')]!==_0x0c62('0x46')){var _0x3fd932={};_0x3fd932[_0x324cf6[_0x0c62('0x30')]]={'$like':'%'+_0x68f47[_0x0c62('0x3a')][_0x0c62('0x45')]+'%'};return _0x3fd932;}})});}_0xecae0f=_[_0x0c62('0x47')]({},_0xecae0f,_0x68f47['options']);var _0x15d989={'where':_0xecae0f[_0x0c62('0x43')]};return db[_0x0c62('0x34')][_0x0c62('0x29')](_0x15d989)['then'](function(_0x27594e){_0xa1f24b[_0x0c62('0x29')]=_0x27594e;if(_0x68f47['query'][_0x0c62('0x48')]){_0xecae0f[_0x0c62('0x49')]=[{'all':!![]}];}return db[_0x0c62('0x34')][_0x0c62('0x4a')](_0xecae0f);})['then'](function(_0x3d786a){_0xa1f24b[_0x0c62('0x4b')]=_0x3d786a;return _0xa1f24b;})[_0x0c62('0x1e')](respondWithFilteredResult(_0xe7fbec,_0xecae0f))[_0x0c62('0x4c')](handleError(_0xe7fbec,null));};exports[_0x0c62('0x4d')]=function(_0x1748c2,_0x2f07ff){var _0x5c2d3b={'raw':![],'where':{'id':_0x1748c2['params']['id']}},_0x59d360={};_0x59d360[_0x0c62('0x39')]=_[_0x0c62('0x3b')](db[_0x0c62('0x34')][_0x0c62('0x35')]);_0x59d360[_0x0c62('0x3a')]=_[_0x0c62('0x3b')](_0x1748c2[_0x0c62('0x3a')]);_0x59d360['filters']=_[_0x0c62('0x3e')](_0x59d360['model'],_0x59d360['query']);_0x5c2d3b[_0x0c62('0x3d')]=_['intersection'](_0x59d360['model'],qs[_0x0c62('0x3f')](_0x1748c2[_0x0c62('0x3a')][_0x0c62('0x3f')]));_0x5c2d3b[_0x0c62('0x3d')]=_0x5c2d3b[_0x0c62('0x3d')][_0x0c62('0x4e')]?_0x5c2d3b[_0x0c62('0x3d')]:_0x59d360[_0x0c62('0x39')];if(_0x1748c2[_0x0c62('0x3a')][_0x0c62('0x48')]){_0x5c2d3b[_0x0c62('0x49')]=[{'all':!![]}];}_0x5c2d3b=_[_0x0c62('0x47')]({},_0x5c2d3b,_0x1748c2['options']);return db['VtigerConfiguration'][_0x0c62('0x4f')](_0x5c2d3b)[_0x0c62('0x1e')](handleEntityNotFound(_0x2f07ff,null))['then'](respondWithResult(_0x2f07ff,null))[_0x0c62('0x4c')](handleError(_0x2f07ff,null));};exports[_0x0c62('0x50')]=function(_0x238f43,_0x26c107){return db['VtigerConfiguration'][_0x0c62('0x50')](_0x238f43[_0x0c62('0x51')],{})[_0x0c62('0x1e')](respondWithResult(_0x26c107,0xc9))['catch'](handleError(_0x26c107,null));};exports[_0x0c62('0x2f')]=function(_0x160bf4,_0x297202){if(_0x160bf4[_0x0c62('0x51')]['id']){delete _0x160bf4[_0x0c62('0x51')]['id'];}return db[_0x0c62('0x34')][_0x0c62('0x4f')]({'where':{'id':_0x160bf4[_0x0c62('0x52')]['id']}})[_0x0c62('0x1e')](handleEntityNotFound(_0x297202,null))['then'](saveUpdates(_0x160bf4[_0x0c62('0x51')],null))[_0x0c62('0x1e')](respondWithResult(_0x297202,null))[_0x0c62('0x4c')](handleError(_0x297202,null));};exports[_0x0c62('0x53')]=function(_0x23a97a,_0x59b8b1){return db['VtigerConfiguration'][_0x0c62('0x4f')]({'where':{'id':_0x23a97a[_0x0c62('0x52')]['id']}})[_0x0c62('0x1e')](handleEntityNotFound(_0x59b8b1,null))[_0x0c62('0x1e')](removeEntity(_0x59b8b1,null))[_0x0c62('0x4c')](handleError(_0x59b8b1,null));};exports['getFields']=function(_0x5668f8,_0x226ad2,_0x2bcd51){var _0x3a5066={};var _0x33ed3e={};var _0x471b3a;var _0x29a57f;return db[_0x0c62('0x34')]['findOne']({'where':{'id':_0x5668f8['params']['id']}})['then'](handleEntityNotFound(_0x226ad2,null))['then'](function(_0x5d00ff){if(_0x5d00ff){_0x471b3a=_0x5d00ff;_0x33ed3e[_0x0c62('0x39')]=_[_0x0c62('0x3b')](db[_0x0c62('0x54')][_0x0c62('0x35')]);_0x33ed3e[_0x0c62('0x3a')]=_[_0x0c62('0x3b')](_0x5668f8[_0x0c62('0x3a')]);_0x33ed3e[_0x0c62('0x3c')]=_['intersection'](_0x33ed3e['model'],_0x33ed3e['query']);_0x3a5066[_0x0c62('0x3d')]=_[_0x0c62('0x3e')](_0x33ed3e[_0x0c62('0x39')],qs[_0x0c62('0x3f')](_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x3f')]));_0x3a5066[_0x0c62('0x3d')]=_0x3a5066[_0x0c62('0x3d')][_0x0c62('0x4e')]?_0x3a5066[_0x0c62('0x3d')]:_0x33ed3e['model'];_0x3a5066['order']=qs[_0x0c62('0x42')](_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x42')]);_0x3a5066[_0x0c62('0x43')]=qs[_0x0c62('0x3c')](_[_0x0c62('0x44')](_0x5668f8[_0x0c62('0x3a')],_0x33ed3e[_0x0c62('0x3c')]));if(_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x45')]){_0x3a5066[_0x0c62('0x43')]=_[_0x0c62('0x47')](_0x3a5066[_0x0c62('0x43')],{'$or':_[_0x0c62('0x33')](_0x3a5066['attributes'],function(_0x55850a){var _0x595615={};_0x595615[_0x55850a]={'$like':'%'+_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x45')]+'%'};return _0x595615;})});}_0x3a5066=_[_0x0c62('0x47')]({},_0x3a5066,_0x5668f8['options']);return _0x471b3a[_0x0c62('0x55')](_0x3a5066);}})[_0x0c62('0x1e')](function(_0x1a19c0){if(_0x1a19c0){_0x29a57f=_0x1a19c0[_0x0c62('0x4e')];if(!_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x56')](_0x0c62('0x40'))){_0x3a5066[_0x0c62('0x41')]=qs[_0x0c62('0x41')](_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x41')]);_0x3a5066[_0x0c62('0x2a')]=qs[_0x0c62('0x2a')](_0x5668f8[_0x0c62('0x3a')][_0x0c62('0x2a')]);}return _0x471b3a['getFields'](_0x3a5066);}})[_0x0c62('0x1e')](function(_0x226216){if(_0x226216){return _0x226216?{'count':_0x29a57f,'rows':_0x226216}:null;}})['then'](respondWithResult(_0x226ad2,null))['catch'](handleError(_0x226ad2,null));};exports[_0x0c62('0x57')]=function(_0x328d6a,_0x42d236,_0x290ddb){var _0x28534b={};var _0x4627e2={};var _0x5c5c99;var _0x3cf656;return db[_0x0c62('0x34')]['findOne']({'where':{'id':_0x328d6a[_0x0c62('0x52')]['id']}})['then'](handleEntityNotFound(_0x42d236,null))[_0x0c62('0x1e')](function(_0x58a96b){if(_0x58a96b){_0x5c5c99=_0x58a96b;_0x4627e2[_0x0c62('0x39')]=_[_0x0c62('0x3b')](db[_0x0c62('0x54')]['rawAttributes']);_0x4627e2['query']=_[_0x0c62('0x3b')](_0x328d6a[_0x0c62('0x3a')]);_0x4627e2[_0x0c62('0x3c')]=_[_0x0c62('0x3e')](_0x4627e2[_0x0c62('0x39')],_0x4627e2[_0x0c62('0x3a')]);_0x28534b[_0x0c62('0x3d')]=_['intersection'](_0x4627e2[_0x0c62('0x39')],qs[_0x0c62('0x3f')](_0x328d6a['query']['fields']));_0x28534b[_0x0c62('0x3d')]=_0x28534b[_0x0c62('0x3d')][_0x0c62('0x4e')]?_0x28534b[_0x0c62('0x3d')]:_0x4627e2[_0x0c62('0x39')];_0x28534b[_0x0c62('0x58')]=qs['sort'](_0x328d6a[_0x0c62('0x3a')][_0x0c62('0x42')]);_0x28534b[_0x0c62('0x43')]=qs[_0x0c62('0x3c')](_[_0x0c62('0x44')](_0x328d6a['query'],_0x4627e2[_0x0c62('0x3c')]));if(_0x328d6a[_0x0c62('0x3a')][_0x0c62('0x45')]){_0x28534b['where']=_[_0x0c62('0x47')](_0x28534b[_0x0c62('0x43')],{'$or':_[_0x0c62('0x33')](_0x28534b['attributes'],function(_0xc35617){var _0xb35b17={};_0xb35b17[_0xc35617]={'$like':'%'+_0x328d6a[_0x0c62('0x3a')]['filter']+'%'};return _0xb35b17;})});}_0x28534b=_[_0x0c62('0x47')]({},_0x28534b,_0x328d6a[_0x0c62('0x59')]);return _0x5c5c99['getSubjects'](_0x28534b);}})[_0x0c62('0x1e')](function(_0x107ba5){if(_0x107ba5){_0x3cf656=_0x107ba5['length'];if(!_0x328d6a[_0x0c62('0x3a')]['hasOwnProperty'](_0x0c62('0x40'))){_0x28534b[_0x0c62('0x41')]=qs[_0x0c62('0x41')](_0x328d6a[_0x0c62('0x3a')][_0x0c62('0x41')]);_0x28534b[_0x0c62('0x2a')]=qs[_0x0c62('0x2a')](_0x328d6a[_0x0c62('0x3a')]['offset']);}return _0x5c5c99['getSubjects'](_0x28534b);}})['then'](function(_0x4ab3da){if(_0x4ab3da){return _0x4ab3da?{'count':_0x3cf656,'rows':_0x4ab3da}:null;}})[_0x0c62('0x1e')](respondWithResult(_0x42d236,null))['catch'](handleError(_0x42d236,null));};exports[_0x0c62('0x5a')]=function(_0x5c1958,_0x2c3dd4,_0x509006){var _0x237a5e={};var _0x3e711f={};var _0x331ccb;var _0x128ab3;return db[_0x0c62('0x34')][_0x0c62('0x5b')]({'where':{'id':_0x5c1958['params']['id']}})[_0x0c62('0x1e')](handleEntityNotFound(_0x2c3dd4,null))['then'](function(_0x1a9b03){if(_0x1a9b03){_0x331ccb=_0x1a9b03;_0x3e711f[_0x0c62('0x39')]=_[_0x0c62('0x3b')](db[_0x0c62('0x54')][_0x0c62('0x35')]);_0x3e711f[_0x0c62('0x3a')]=_[_0x0c62('0x3b')](_0x5c1958[_0x0c62('0x3a')]);_0x3e711f[_0x0c62('0x3c')]=_[_0x0c62('0x3e')](_0x3e711f[_0x0c62('0x39')],_0x3e711f[_0x0c62('0x3a')]);_0x237a5e[_0x0c62('0x3d')]=_[_0x0c62('0x3e')](_0x3e711f[_0x0c62('0x39')],qs[_0x0c62('0x3f')](_0x5c1958[_0x0c62('0x3a')]['fields']));_0x237a5e[_0x0c62('0x3d')]=_0x237a5e[_0x0c62('0x3d')]['length']?_0x237a5e[_0x0c62('0x3d')]:_0x3e711f['model'];_0x237a5e['order']=qs[_0x0c62('0x42')](_0x5c1958['query'][_0x0c62('0x42')]);_0x237a5e['where']=qs[_0x0c62('0x3c')](_[_0x0c62('0x44')](_0x5c1958[_0x0c62('0x3a')],_0x3e711f[_0x0c62('0x3c')]));if(_0x5c1958[_0x0c62('0x3a')][_0x0c62('0x45')]){_0x237a5e[_0x0c62('0x43')]=_[_0x0c62('0x47')](_0x237a5e[_0x0c62('0x43')],{'$or':_[_0x0c62('0x33')](_0x237a5e[_0x0c62('0x3d')],function(_0x4eab8c){var _0x5c8d1d={};_0x5c8d1d[_0x4eab8c]={'$like':'%'+_0x5c1958[_0x0c62('0x3a')][_0x0c62('0x45')]+'%'};return _0x5c8d1d;})});}_0x237a5e=_[_0x0c62('0x47')]({},_0x237a5e,_0x5c1958[_0x0c62('0x59')]);return _0x331ccb[_0x0c62('0x5a')](_0x237a5e);}})[_0x0c62('0x1e')](function(_0x2b56e2){if(_0x2b56e2){_0x128ab3=_0x2b56e2[_0x0c62('0x4e')];if(!_0x5c1958['query'][_0x0c62('0x56')](_0x0c62('0x40'))){_0x237a5e[_0x0c62('0x41')]=qs[_0x0c62('0x41')](_0x5c1958[_0x0c62('0x3a')][_0x0c62('0x41')]);_0x237a5e[_0x0c62('0x2a')]=qs[_0x0c62('0x2a')](_0x5c1958[_0x0c62('0x3a')][_0x0c62('0x2a')]);}return _0x331ccb[_0x0c62('0x5a')](_0x237a5e);}})[_0x0c62('0x1e')](function(_0x40076f){if(_0x40076f){return _0x40076f?{'count':_0x128ab3,'rows':_0x40076f}:null;}})[_0x0c62('0x1e')](respondWithResult(_0x2c3dd4,null))['catch'](handleError(_0x2c3dd4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d96fd53..a63eb95 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 _0x8832=['rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0x8832,0x13b));var _0x2883=function(_0x579c21,_0x2881ab){_0x579c21=_0x579c21-0x0;var _0x5117c9=_0x8832[_0x579c21];return _0x5117c9;};'use strict';var _=require(_0x2883('0x0'));var util=require(_0x2883('0x1'));var logger=require(_0x2883('0x2'))(_0x2883('0x3'));var moment=require(_0x2883('0x4'));var BPromise=require(_0x2883('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2883('0x6'));var rimraf=require(_0x2883('0x7'));var config=require(_0x2883('0x8'));var attributes=require(_0x2883('0x9'));module[_0x2883('0xa')]=function(_0x194396,_0x365087){return _0x194396[_0x2883('0xb')](_0x2883('0xc'),attributes,{'tableName':_0x2883('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2b7=['define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports'];(function(_0x500106,_0xe35499){var _0x2344a0=function(_0x31f106){while(--_0x31f106){_0x500106['push'](_0x500106['shift']());}};_0x2344a0(++_0xe35499);}(_0xd2b7,0x121));var _0x7d2b=function(_0x40822a,_0x582b60){_0x40822a=_0x40822a-0x0;var _0x357420=_0xd2b7[_0x40822a];return _0x357420;};'use strict';var _=require(_0x7d2b('0x0'));var util=require(_0x7d2b('0x1'));var logger=require(_0x7d2b('0x2'))(_0x7d2b('0x3'));var moment=require(_0x7d2b('0x4'));var BPromise=require(_0x7d2b('0x5'));var rp=require(_0x7d2b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x7d2b('0x7')]=function(_0x7bd511,_0x37ed96){return _0x7bd511[_0x7d2b('0x8')](_0x7d2b('0x9'),attributes,{'tableName':_0x7d2b('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 4e9f35f..160b7e2 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 _0xdb79=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x37401d,_0x5846b4){var _0x789d52=function(_0x22c028){while(--_0x22c028){_0x37401d['push'](_0x37401d['shift']());}};_0x789d52(++_0x5846b4);}(_0xdb79,0xf7));var _0x9db7=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xdb79[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require(_0x9db7('0x0'));var util=require(_0x9db7('0x1'));var moment=require(_0x9db7('0x2'));var BPromise=require(_0x9db7('0x3'));var rs=require(_0x9db7('0x4'));var fs=require('fs');var Redis=require(_0x9db7('0x5'));var db=require(_0x9db7('0x6'))['db'];var utils=require(_0x9db7('0x7'));var logger=require('../../config/logger')(_0x9db7('0x8'));var config=require(_0x9db7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9db7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43503b,_0x30049a,_0x4fb087){return new BPromise(function(_0x1c9324,_0x2efa6b){return client[_0x9db7('0xb')](_0x43503b,_0x4fb087)['then'](function(_0x3421b4){logger[_0x9db7('0xc')](_0x9db7('0xd'),_0x30049a,_0x9db7('0xe'));logger[_0x9db7('0xf')](_0x9db7('0x10'),_0x30049a,_0x9db7('0xe'),JSON[_0x9db7('0x11')](_0x3421b4));if(_0x3421b4[_0x9db7('0x12')]){if(_0x3421b4[_0x9db7('0x12')][_0x9db7('0x13')]===0x1f4){logger[_0x9db7('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x30049a,_0x3421b4[_0x9db7('0x12')][_0x9db7('0x14')]);return _0x2efa6b(_0x3421b4[_0x9db7('0x12')][_0x9db7('0x14')]);}logger[_0x9db7('0x12')](_0x9db7('0xd'),_0x30049a,_0x3421b4[_0x9db7('0x12')][_0x9db7('0x14')]);return _0x1c9324(_0x3421b4[_0x9db7('0x12')][_0x9db7('0x14')]);}else{logger[_0x9db7('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x30049a,_0x9db7('0xe'));_0x1c9324(_0x3421b4[_0x9db7('0x15')][_0x9db7('0x14')]);}})[_0x9db7('0x16')](function(_0x189115){logger[_0x9db7('0x12')](_0x9db7('0xd'),_0x30049a,_0x189115);_0x2efa6b(_0x189115);});});} \ No newline at end of file +var _0x0f70=['result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x32d414,_0x4d23da){var _0x4e0bca=function(_0x15d397){while(--_0x15d397){_0x32d414['push'](_0x32d414['shift']());}};_0x4e0bca(++_0x4d23da);}(_0x0f70,0x95));var _0x00f7=function(_0x2f8bc5,_0x12e3d1){_0x2f8bc5=_0x2f8bc5-0x0;var _0x2e4207=_0x0f70[_0x2f8bc5];return _0x2e4207;};'use strict';var _=require(_0x00f7('0x0'));var util=require(_0x00f7('0x1'));var moment=require(_0x00f7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00f7('0x3'));var db=require(_0x00f7('0x4'))['db'];var utils=require(_0x00f7('0x5'));var logger=require('../../config/logger')(_0x00f7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x00f7('0x7')][_0x00f7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58fd50,_0x43528f,_0x53007b){return new BPromise(function(_0x5186ae,_0x4333d3){return client[_0x00f7('0x9')](_0x58fd50,_0x53007b)['then'](function(_0x32cbee){logger['info'](_0x00f7('0xa'),_0x43528f,_0x00f7('0xb'));logger[_0x00f7('0xc')](_0x00f7('0xd'),_0x43528f,_0x00f7('0xb'),JSON[_0x00f7('0xe')](_0x32cbee));if(_0x32cbee[_0x00f7('0xf')]){if(_0x32cbee[_0x00f7('0xf')][_0x00f7('0x10')]===0x1f4){logger[_0x00f7('0xf')](_0x00f7('0xa'),_0x43528f,_0x32cbee[_0x00f7('0xf')][_0x00f7('0x11')]);return _0x4333d3(_0x32cbee[_0x00f7('0xf')][_0x00f7('0x11')]);}logger[_0x00f7('0xf')](_0x00f7('0xa'),_0x43528f,_0x32cbee['error']['message']);return _0x5186ae(_0x32cbee[_0x00f7('0xf')][_0x00f7('0x11')]);}else{logger[_0x00f7('0x12')](_0x00f7('0xa'),_0x43528f,_0x00f7('0xb'));_0x5186ae(_0x32cbee[_0x00f7('0x13')][_0x00f7('0x11')]);}})[_0x00f7('0x14')](function(_0xe0cd67){logger[_0x00f7('0xf')](_0x00f7('0xa'),_0x43528f,_0xe0cd67);_0x4333d3(_0xe0cd67);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index be44a51..64d745c 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 _0x041b=['destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x041b,0x131));var _0xb041=function(_0x8d0548,_0x4b9c70){_0x8d0548=_0x8d0548-0x0;var _0x383d57=_0x041b[_0x8d0548];return _0x383d57;};'use strict';var multer=require(_0xb041('0x0'));var util=require(_0xb041('0x1'));var path=require(_0xb041('0x2'));var timeout=require(_0xb041('0x3'));var express=require('express');var router=express[_0xb041('0x4')]();var auth=require(_0xb041('0x5'));var interaction=require(_0xb041('0x6'));var config=require(_0xb041('0x7'));var controller=require(_0xb041('0x8'));router[_0xb041('0x9')]('/',auth[_0xb041('0xa')](),controller[_0xb041('0xb')]);router[_0xb041('0x9')](_0xb041('0xc'),auth[_0xb041('0xa')](),controller[_0xb041('0xd')]);router[_0xb041('0xe')]('/',auth[_0xb041('0xa')](),controller[_0xb041('0xf')]);router[_0xb041('0x10')](_0xb041('0xc'),auth[_0xb041('0xa')](),controller['update']);router[_0xb041('0x11')](_0xb041('0xc'),auth[_0xb041('0xa')](),controller[_0xb041('0x12')]);module['exports']=router; \ No newline at end of file +var _0x83d4=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x83d4,0x1cb));var _0x483d=function(_0x398947,_0x3f0dfb){_0x398947=_0x398947-0x0;var _0x2b1a00=_0x83d4[_0x398947];return _0x2b1a00;};'use strict';var multer=require(_0x483d('0x0'));var util=require(_0x483d('0x1'));var path=require(_0x483d('0x2'));var timeout=require(_0x483d('0x3'));var express=require(_0x483d('0x4'));var router=express[_0x483d('0x5')]();var auth=require(_0x483d('0x6'));var interaction=require(_0x483d('0x7'));var config=require(_0x483d('0x8'));var controller=require(_0x483d('0x9'));router['get']('/',auth[_0x483d('0xa')](),controller[_0x483d('0xb')]);router[_0x483d('0xc')](_0x483d('0xd'),auth['isAuthenticated'](),controller[_0x483d('0xe')]);router[_0x483d('0xf')]('/',auth[_0x483d('0xa')](),controller[_0x483d('0x10')]);router[_0x483d('0x11')](_0x483d('0xd'),auth[_0x483d('0xa')](),controller[_0x483d('0x12')]);router[_0x483d('0x13')](_0x483d('0xd'),auth[_0x483d('0xa')](),controller[_0x483d('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 891fd3a..aaf874e 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 _0x72b1=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x72b1,0x16e));var _0x172b=function(_0x484b90,_0x2b8052){_0x484b90=_0x484b90-0x0;var _0x1394d6=_0x72b1[_0x484b90];return _0x1394d6;};'use strict';var Sequelize=require(_0x172b('0x0'));module['exports']={'type':{'type':Sequelize[_0x172b('0x1')](_0x172b('0x2'),_0x172b('0x3'),_0x172b('0x4'),_0x172b('0x5')),'defaultValue':_0x172b('0x2')},'content':{'type':Sequelize[_0x172b('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x172b('0x1')](_0x172b('0x2'),_0x172b('0x3'),_0x172b('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x172b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x172b('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4508=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','exports'];(function(_0x553c2a,_0x592c23){var _0x37988b=function(_0x5ccdf1){while(--_0x5ccdf1){_0x553c2a['push'](_0x553c2a['shift']());}};_0x37988b(++_0x592c23);}(_0x4508,0x1ef));var _0x8450=function(_0x5a41ae,_0x51ddc8){_0x5a41ae=_0x5a41ae-0x0;var _0x78f90c=_0x4508[_0x5a41ae];return _0x78f90c;};'use strict';var Sequelize=require('sequelize');module[_0x8450('0x0')]={'type':{'type':Sequelize[_0x8450('0x1')](_0x8450('0x2'),'variable',_0x8450('0x3'),_0x8450('0x4')),'defaultValue':_0x8450('0x2')},'content':{'type':Sequelize[_0x8450('0x5')]},'key':{'type':Sequelize[_0x8450('0x5')]},'keyType':{'type':Sequelize[_0x8450('0x1')](_0x8450('0x2'),_0x8450('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x8450('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8450('0x5')]},'customField':{'type':Sequelize[_0x8450('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 9ae29d5..30d8bd0 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 _0x4789=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','show','params','keys','VtigerField','find','catch','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x40a446,_0x5e43d4){var _0x445050=function(_0x34255a){while(--_0x34255a){_0x40a446['push'](_0x40a446['shift']());}};_0x445050(++_0x5e43d4);}(_0x4789,0x81));var _0x9478=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0x4789[_0x5ff517];return _0x19a245;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x9478('0x0'));var zipdir=require(_0x9478('0x1'));var jsonpatch=require(_0x9478('0x2'));var rp=require(_0x9478('0x3'));var moment=require('moment');var BPromise=require(_0x9478('0x4'));var Mustache=require(_0x9478('0x5'));var util=require(_0x9478('0x6'));var path=require(_0x9478('0x7'));var sox=require('sox');var csv=require(_0x9478('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9478('0x9'));var squel=require(_0x9478('0xa'));var crypto=require(_0x9478('0xb'));var jsforce=require(_0x9478('0xc'));var deskjs=require(_0x9478('0xd'));var toCsv=require(_0x9478('0x8'));var querystring=require(_0x9478('0xe'));var Papa=require(_0x9478('0xf'));var Redis=require('ioredis');var authService=require(_0x9478('0x10'));var qs=require(_0x9478('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9478('0x12'));var logger=require('../../config/logger')(_0x9478('0x13'));var utils=require(_0x9478('0x14'));var config=require(_0x9478('0x15'));var db=require(_0x9478('0x16'))['db'];function respondWithStatusCode(_0x9750f6,_0xa56a1c){_0xa56a1c=_0xa56a1c||0xcc;return function(_0x5af677){if(_0x5af677){return _0x9750f6[_0x9478('0x17')](_0xa56a1c);}return _0x9750f6[_0x9478('0x18')](_0xa56a1c)[_0x9478('0x19')]();};}function respondWithResult(_0x28fde8,_0x50d1d1){_0x50d1d1=_0x50d1d1||0xc8;return function(_0x1d12d2){if(_0x1d12d2){return _0x28fde8[_0x9478('0x18')](_0x50d1d1)[_0x9478('0x1a')](_0x1d12d2);}};}function respondWithFilteredResult(_0x56fdf9,_0xe2915d){return function(_0x2ccf25){if(_0x2ccf25){var _0x4e03cb=_0x2ccf25[_0x9478('0x1b')],_0x27b6c5=_0xe2915d[_0x9478('0x1c')],_0x2ce73d=_0xe2915d['offset']+_0xe2915d[_0x9478('0x1d')],_0x2395da;if(_0x2ce73d>=_0x4e03cb){_0x2ce73d=_0x4e03cb;_0x2395da=0xc8;}else{_0x2395da=0xce;}_0x56fdf9[_0x9478('0x18')](_0x2395da);return _0x56fdf9[_0x9478('0x1e')](_0x9478('0x1f'),_0x27b6c5+'-'+_0x2ce73d+'/'+_0x4e03cb)[_0x9478('0x1a')](_0x2ccf25);}return null;};}function patchUpdates(_0x295b50){return function(_0xd65387){try{jsonpatch['apply'](_0xd65387,_0x295b50,!![]);}catch(_0x5da198){return BPromise[_0x9478('0x20')](_0x5da198);}return _0xd65387[_0x9478('0x21')]();};}function saveUpdates(_0x5106c2,_0x32f6cf){return function(_0x41942d){if(_0x41942d){return _0x41942d[_0x9478('0x22')](_0x5106c2)['then'](function(_0x49f890){return _0x49f890;});}return null;};}function removeEntity(_0x5a0da1,_0x4a5009){return function(_0x44d178){if(_0x44d178){return _0x44d178['destroy']()[_0x9478('0x23')](function(){_0x5a0da1[_0x9478('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x352def,_0x1b40c5){return function(_0x1047cf){if(!_0x1047cf){_0x352def['sendStatus'](0x194);}return _0x1047cf;};}function handleError(_0x3487cf,_0x230c78){_0x230c78=_0x230c78||0x1f4;return function(_0x55f0b3){logger['error'](_0x55f0b3[_0x9478('0x24')]);if(_0x55f0b3[_0x9478('0x25')]){delete _0x55f0b3[_0x9478('0x25')];}_0x3487cf[_0x9478('0x18')](_0x230c78)[_0x9478('0x26')](_0x55f0b3);};}exports[_0x9478('0x27')]=function(_0x4fec12,_0x452c07){var _0xdf528b={},_0x1a021a={},_0x1feb5d={'count':0x0,'rows':[]};var _0xee6044=_[_0x9478('0x28')](db['VtigerField'][_0x9478('0x29')],function(_0x2a68c5){return{'name':_0x2a68c5[_0x9478('0x2a')],'type':_0x2a68c5[_0x9478('0x2b')][_0x9478('0x2c')]};});_0x1a021a[_0x9478('0x2d')]=_[_0x9478('0x28')](_0xee6044,'name');_0x1a021a['query']=_['keys'](_0x4fec12[_0x9478('0x2e')]);_0x1a021a[_0x9478('0x2f')]=_[_0x9478('0x30')](_0x1a021a[_0x9478('0x2d')],_0x1a021a[_0x9478('0x2e')]);_0xdf528b[_0x9478('0x31')]=_[_0x9478('0x30')](_0x1a021a[_0x9478('0x2d')],qs[_0x9478('0x32')](_0x4fec12['query']['fields']));_0xdf528b[_0x9478('0x31')]=_0xdf528b[_0x9478('0x31')][_0x9478('0x33')]?_0xdf528b[_0x9478('0x31')]:_0x1a021a[_0x9478('0x2d')];if(!_0x4fec12['query']['hasOwnProperty'](_0x9478('0x34'))){_0xdf528b[_0x9478('0x1d')]=qs[_0x9478('0x1d')](_0x4fec12['query']['limit']);_0xdf528b[_0x9478('0x1c')]=qs[_0x9478('0x1c')](_0x4fec12['query']['offset']);}_0xdf528b[_0x9478('0x35')]=qs[_0x9478('0x36')](_0x4fec12['query']['sort']);_0xdf528b[_0x9478('0x37')]=qs['filters'](_[_0x9478('0x38')](_0x4fec12[_0x9478('0x2e')],_0x1a021a['filters']));if(_0x4fec12[_0x9478('0x2e')]['filter']){_0xdf528b['where']=_[_0x9478('0x39')](_0xdf528b[_0x9478('0x37')],{'$or':_[_0x9478('0x28')](_0xee6044,function(_0x5a333f){if(_0x5a333f[_0x9478('0x2b')]!=='VIRTUAL'){var _0x540aac={};_0x540aac[_0x5a333f['name']]={'$like':'%'+_0x4fec12['query'][_0x9478('0x3a')]+'%'};return _0x540aac;}})});}_0xdf528b=_[_0x9478('0x39')]({},_0xdf528b,_0x4fec12[_0x9478('0x3b')]);var _0x4c808b={'where':_0xdf528b[_0x9478('0x37')]};return db['VtigerField']['count'](_0x4c808b)[_0x9478('0x23')](function(_0x3b2761){_0x1feb5d['count']=_0x3b2761;if(_0x4fec12['query'][_0x9478('0x3c')]){_0xdf528b[_0x9478('0x3d')]=[{'all':!![]}];}return db['VtigerField'][_0x9478('0x3e')](_0xdf528b);})[_0x9478('0x23')](function(_0x1980ad){_0x1feb5d[_0x9478('0x3f')]=_0x1980ad;return _0x1feb5d;})['then'](respondWithFilteredResult(_0x452c07,_0xdf528b))['catch'](handleError(_0x452c07,null));};exports[_0x9478('0x40')]=function(_0xbc9f49,_0x2ff89e){var _0x307fed={'raw':!![],'where':{'id':_0xbc9f49[_0x9478('0x41')]['id']}},_0x4de932={};_0x4de932[_0x9478('0x2d')]=_[_0x9478('0x42')](db['VtigerField'][_0x9478('0x29')]);_0x4de932[_0x9478('0x2e')]=_[_0x9478('0x42')](_0xbc9f49[_0x9478('0x2e')]);_0x4de932[_0x9478('0x2f')]=_[_0x9478('0x30')](_0x4de932[_0x9478('0x2d')],_0x4de932[_0x9478('0x2e')]);_0x307fed[_0x9478('0x31')]=_[_0x9478('0x30')](_0x4de932[_0x9478('0x2d')],qs[_0x9478('0x32')](_0xbc9f49[_0x9478('0x2e')][_0x9478('0x32')]));_0x307fed[_0x9478('0x31')]=_0x307fed['attributes'][_0x9478('0x33')]?_0x307fed[_0x9478('0x31')]:_0x4de932[_0x9478('0x2d')];if(_0xbc9f49[_0x9478('0x2e')]['includeAll']){_0x307fed['include']=[{'all':!![]}];}_0x307fed=_[_0x9478('0x39')]({},_0x307fed,_0xbc9f49['options']);return db[_0x9478('0x43')][_0x9478('0x44')](_0x307fed)[_0x9478('0x23')](handleEntityNotFound(_0x2ff89e,null))[_0x9478('0x23')](respondWithResult(_0x2ff89e,null))[_0x9478('0x45')](handleError(_0x2ff89e,null));};exports[_0x9478('0x46')]=function(_0x5a8e9e,_0x8a2ab9){return db[_0x9478('0x43')][_0x9478('0x46')](_0x5a8e9e[_0x9478('0x47')],{})[_0x9478('0x23')](respondWithResult(_0x8a2ab9,0xc9))['catch'](handleError(_0x8a2ab9,null));};exports[_0x9478('0x22')]=function(_0x3d8ad2,_0x506f6c){if(_0x3d8ad2[_0x9478('0x47')]['id']){delete _0x3d8ad2['body']['id'];}return db[_0x9478('0x43')][_0x9478('0x44')]({'where':{'id':_0x3d8ad2['params']['id']}})[_0x9478('0x23')](handleEntityNotFound(_0x506f6c,null))['then'](saveUpdates(_0x3d8ad2[_0x9478('0x47')],null))[_0x9478('0x23')](respondWithResult(_0x506f6c,null))[_0x9478('0x45')](handleError(_0x506f6c,null));};exports[_0x9478('0x48')]=function(_0xbd5b4,_0x131996){return db['VtigerField'][_0x9478('0x44')]({'where':{'id':_0xbd5b4[_0x9478('0x41')]['id']}})[_0x9478('0x23')](handleEntityNotFound(_0x131996,null))['then'](removeEntity(_0x131996,null))[_0x9478('0x45')](handleError(_0x131996,null));}; \ No newline at end of file +var _0x96ce=['VtigerField','count','includeAll','findAll','rows','catch','show','params','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','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','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','set','Content-Range','json','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options'];(function(_0x2b4d01,_0x4c6044){var _0x4195d7=function(_0x59935){while(--_0x59935){_0x2b4d01['push'](_0x2b4d01['shift']());}};_0x4195d7(++_0x4c6044);}(_0x96ce,0xec));var _0xe96c=function(_0x4013da,_0xeaf6dc){_0x4013da=_0x4013da-0x0;var _0x434e19=_0x96ce[_0x4013da];return _0x434e19;};'use strict';var pdf=require(_0xe96c('0x0'));var emlformat=require(_0xe96c('0x1'));var rimraf=require(_0xe96c('0x2'));var zipdir=require(_0xe96c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe96c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe96c('0x5'));var util=require(_0xe96c('0x6'));var path=require(_0xe96c('0x7'));var sox=require(_0xe96c('0x8'));var csv=require(_0xe96c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe96c('0xa'));var squel=require(_0xe96c('0xb'));var crypto=require(_0xe96c('0xc'));var jsforce=require(_0xe96c('0xd'));var deskjs=require(_0xe96c('0xe'));var toCsv=require(_0xe96c('0x9'));var querystring=require('querystring');var Papa=require(_0xe96c('0xf'));var Redis=require(_0xe96c('0x10'));var authService=require(_0xe96c('0x11'));var qs=require(_0xe96c('0x12'));var as=require(_0xe96c('0x13'));var hardwareService=require(_0xe96c('0x14'));var logger=require('../../config/logger')(_0xe96c('0x15'));var utils=require(_0xe96c('0x16'));var config=require(_0xe96c('0x17'));var db=require(_0xe96c('0x18'))['db'];function respondWithStatusCode(_0x5d9a0b,_0x22d973){_0x22d973=_0x22d973||0xcc;return function(_0x4c63c4){if(_0x4c63c4){return _0x5d9a0b['sendStatus'](_0x22d973);}return _0x5d9a0b[_0xe96c('0x19')](_0x22d973)['end']();};}function respondWithResult(_0x4af589,_0x225515){_0x225515=_0x225515||0xc8;return function(_0x173d43){if(_0x173d43){return _0x4af589['status'](_0x225515)['json'](_0x173d43);}};}function respondWithFilteredResult(_0x1e8178,_0x2a8db7){return function(_0x53cda3){if(_0x53cda3){var _0x54698e=_0x53cda3['count'],_0x387b64=_0x2a8db7[_0xe96c('0x1a')],_0x32fdff=_0x2a8db7[_0xe96c('0x1a')]+_0x2a8db7['limit'],_0x4f8e8c;if(_0x32fdff>=_0x54698e){_0x32fdff=_0x54698e;_0x4f8e8c=0xc8;}else{_0x4f8e8c=0xce;}_0x1e8178[_0xe96c('0x19')](_0x4f8e8c);return _0x1e8178[_0xe96c('0x1b')](_0xe96c('0x1c'),_0x387b64+'-'+_0x32fdff+'/'+_0x54698e)[_0xe96c('0x1d')](_0x53cda3);}return null;};}function patchUpdates(_0x2ca386){return function(_0x1de7e8){try{jsonpatch['apply'](_0x1de7e8,_0x2ca386,!![]);}catch(_0x13ce42){return BPromise['reject'](_0x13ce42);}return _0x1de7e8[_0xe96c('0x1e')]();};}function saveUpdates(_0x473b76,_0x2408e2){return function(_0xfb8d87){if(_0xfb8d87){return _0xfb8d87[_0xe96c('0x1f')](_0x473b76)[_0xe96c('0x20')](function(_0x2f4aff){return _0x2f4aff;});}return null;};}function removeEntity(_0x2311b2,_0x4f7f9b){return function(_0x5d30a5){if(_0x5d30a5){return _0x5d30a5[_0xe96c('0x21')]()['then'](function(){_0x2311b2[_0xe96c('0x19')](0xcc)[_0xe96c('0x22')]();});}};}function handleEntityNotFound(_0x5d3775,_0x593107){return function(_0x5a591f){if(!_0x5a591f){_0x5d3775[_0xe96c('0x23')](0x194);}return _0x5a591f;};}function handleError(_0xcb15cd,_0x2e14ff){_0x2e14ff=_0x2e14ff||0x1f4;return function(_0x3e8029){logger['error'](_0x3e8029[_0xe96c('0x24')]);if(_0x3e8029['name']){delete _0x3e8029[_0xe96c('0x25')];}_0xcb15cd['status'](_0x2e14ff)[_0xe96c('0x26')](_0x3e8029);};}exports[_0xe96c('0x27')]=function(_0x5a0bcc,_0x409557){var _0xca5e65={},_0x52e46e={},_0x18b44b={'count':0x0,'rows':[]};var _0x574eed=_[_0xe96c('0x28')](db['VtigerField'][_0xe96c('0x29')],function(_0x4457f1){return{'name':_0x4457f1[_0xe96c('0x2a')],'type':_0x4457f1[_0xe96c('0x2b')][_0xe96c('0x2c')]};});_0x52e46e[_0xe96c('0x2d')]=_[_0xe96c('0x28')](_0x574eed,_0xe96c('0x25'));_0x52e46e['query']=_[_0xe96c('0x2e')](_0x5a0bcc[_0xe96c('0x2f')]);_0x52e46e['filters']=_[_0xe96c('0x30')](_0x52e46e['model'],_0x52e46e[_0xe96c('0x2f')]);_0xca5e65['attributes']=_[_0xe96c('0x30')](_0x52e46e['model'],qs['fields'](_0x5a0bcc['query'][_0xe96c('0x31')]));_0xca5e65[_0xe96c('0x32')]=_0xca5e65['attributes'][_0xe96c('0x33')]?_0xca5e65[_0xe96c('0x32')]:_0x52e46e[_0xe96c('0x2d')];if(!_0x5a0bcc[_0xe96c('0x2f')][_0xe96c('0x34')](_0xe96c('0x35'))){_0xca5e65['limit']=qs[_0xe96c('0x36')](_0x5a0bcc[_0xe96c('0x2f')][_0xe96c('0x36')]);_0xca5e65[_0xe96c('0x1a')]=qs[_0xe96c('0x1a')](_0x5a0bcc[_0xe96c('0x2f')][_0xe96c('0x1a')]);}_0xca5e65[_0xe96c('0x37')]=qs[_0xe96c('0x38')](_0x5a0bcc[_0xe96c('0x2f')][_0xe96c('0x38')]);_0xca5e65[_0xe96c('0x39')]=qs[_0xe96c('0x3a')](_[_0xe96c('0x3b')](_0x5a0bcc[_0xe96c('0x2f')],_0x52e46e['filters']));if(_0x5a0bcc['query'][_0xe96c('0x3c')]){_0xca5e65[_0xe96c('0x39')]=_['merge'](_0xca5e65[_0xe96c('0x39')],{'$or':_['map'](_0x574eed,function(_0x384c98){if(_0x384c98[_0xe96c('0x2b')]!==_0xe96c('0x3d')){var _0x463bc1={};_0x463bc1[_0x384c98[_0xe96c('0x25')]]={'$like':'%'+_0x5a0bcc[_0xe96c('0x2f')]['filter']+'%'};return _0x463bc1;}})});}_0xca5e65=_[_0xe96c('0x3e')]({},_0xca5e65,_0x5a0bcc[_0xe96c('0x3f')]);var _0x431e14={'where':_0xca5e65['where']};return db[_0xe96c('0x40')][_0xe96c('0x41')](_0x431e14)[_0xe96c('0x20')](function(_0x33987f){_0x18b44b[_0xe96c('0x41')]=_0x33987f;if(_0x5a0bcc[_0xe96c('0x2f')][_0xe96c('0x42')]){_0xca5e65['include']=[{'all':!![]}];}return db[_0xe96c('0x40')][_0xe96c('0x43')](_0xca5e65);})[_0xe96c('0x20')](function(_0x254d77){_0x18b44b[_0xe96c('0x44')]=_0x254d77;return _0x18b44b;})[_0xe96c('0x20')](respondWithFilteredResult(_0x409557,_0xca5e65))[_0xe96c('0x45')](handleError(_0x409557,null));};exports[_0xe96c('0x46')]=function(_0x530f72,_0x4bba3f){var _0x1f56bd={'raw':!![],'where':{'id':_0x530f72[_0xe96c('0x47')]['id']}},_0x4f4e38={};_0x4f4e38[_0xe96c('0x2d')]=_[_0xe96c('0x2e')](db[_0xe96c('0x40')][_0xe96c('0x29')]);_0x4f4e38[_0xe96c('0x2f')]=_[_0xe96c('0x2e')](_0x530f72[_0xe96c('0x2f')]);_0x4f4e38[_0xe96c('0x3a')]=_[_0xe96c('0x30')](_0x4f4e38['model'],_0x4f4e38[_0xe96c('0x2f')]);_0x1f56bd[_0xe96c('0x32')]=_[_0xe96c('0x30')](_0x4f4e38[_0xe96c('0x2d')],qs[_0xe96c('0x31')](_0x530f72[_0xe96c('0x2f')][_0xe96c('0x31')]));_0x1f56bd[_0xe96c('0x32')]=_0x1f56bd[_0xe96c('0x32')][_0xe96c('0x33')]?_0x1f56bd['attributes']:_0x4f4e38[_0xe96c('0x2d')];if(_0x530f72['query'][_0xe96c('0x42')]){_0x1f56bd['include']=[{'all':!![]}];}_0x1f56bd=_['merge']({},_0x1f56bd,_0x530f72['options']);return db[_0xe96c('0x40')][_0xe96c('0x48')](_0x1f56bd)[_0xe96c('0x20')](handleEntityNotFound(_0x4bba3f,null))[_0xe96c('0x20')](respondWithResult(_0x4bba3f,null))['catch'](handleError(_0x4bba3f,null));};exports[_0xe96c('0x49')]=function(_0x259488,_0x106701){return db[_0xe96c('0x40')][_0xe96c('0x49')](_0x259488[_0xe96c('0x4a')],{})[_0xe96c('0x20')](respondWithResult(_0x106701,0xc9))[_0xe96c('0x45')](handleError(_0x106701,null));};exports[_0xe96c('0x1f')]=function(_0x622c20,_0x1c7169){if(_0x622c20[_0xe96c('0x4a')]['id']){delete _0x622c20['body']['id'];}return db[_0xe96c('0x40')]['find']({'where':{'id':_0x622c20['params']['id']}})[_0xe96c('0x20')](handleEntityNotFound(_0x1c7169,null))[_0xe96c('0x20')](saveUpdates(_0x622c20[_0xe96c('0x4a')],null))[_0xe96c('0x20')](respondWithResult(_0x1c7169,null))[_0xe96c('0x45')](handleError(_0x1c7169,null));};exports[_0xe96c('0x21')]=function(_0x18b28d,_0x1a494a){return db[_0xe96c('0x40')]['find']({'where':{'id':_0x18b28d[_0xe96c('0x47')]['id']}})[_0xe96c('0x20')](handleEntityNotFound(_0x1a494a,null))[_0xe96c('0x20')](removeEntity(_0x1a494a,null))['catch'](handleError(_0x1a494a,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 00fba50..0f47526 100644 --- a/server/api/intVtigerField/intVtigerField.model.js +++ b/server/api/intVtigerField/intVtigerField.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['int_vtiger_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField'];(function(_0x52c043,_0x30d33b){var _0x450183=function(_0x3eade1){while(--_0x3eade1){_0x52c043['push'](_0x52c043['shift']());}};_0x450183(++_0x30d33b);}(_0x7a54,0x106));var _0x47a5=function(_0x59b0cd,_0x1e6ca6){_0x59b0cd=_0x59b0cd-0x0;var _0x1fcc7b=_0x7a54[_0x59b0cd];return _0x1fcc7b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 6ce8a4d..e31c53e 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 _0xe9e8=['info','VtigerField,\x20%s,\x20%s','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x36e40e,_0x27dbd3){var _0x582c00=function(_0x150b44){while(--_0x150b44){_0x36e40e['push'](_0x36e40e['shift']());}};_0x582c00(++_0x27dbd3);}(_0xe9e8,0x6b));var _0x8e9e=function(_0x5e465d,_0x1d6c1c){_0x5e465d=_0x5e465d-0x0;var _0x44a890=_0xe9e8[_0x5e465d];return _0x44a890;};'use strict';var _=require(_0x8e9e('0x0'));var util=require(_0x8e9e('0x1'));var moment=require(_0x8e9e('0x2'));var BPromise=require(_0x8e9e('0x3'));var rs=require(_0x8e9e('0x4'));var fs=require('fs');var Redis=require(_0x8e9e('0x5'));var db=require(_0x8e9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8e9e('0x7'))(_0x8e9e('0x8'));var config=require(_0x8e9e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8e9e('0xa')][_0x8e9e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x204f5c,_0x1fb8d3,_0x58f822){return new BPromise(function(_0x3b5d21,_0x2ae896){return client[_0x8e9e('0xc')](_0x204f5c,_0x58f822)['then'](function(_0x39f5e5){logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');logger[_0x8e9e('0xf')](_0x8e9e('0x10'),_0x1fb8d3,_0x8e9e('0x11'),JSON[_0x8e9e('0x12')](_0x39f5e5));if(_0x39f5e5[_0x8e9e('0x13')]){if(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x14')]===0x1f4){logger['error'](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5['error'][_0x8e9e('0x15')]);return _0x2ae896(_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);}logger[_0x8e9e('0x13')](_0x8e9e('0xe'),_0x1fb8d3,_0x39f5e5[_0x8e9e('0x13')][_0x8e9e('0x15')]);return _0x3b5d21(_0x39f5e5['error']['message']);}else{logger[_0x8e9e('0xd')](_0x8e9e('0xe'),_0x1fb8d3,'request\x20sent');_0x3b5d21(_0x39f5e5[_0x8e9e('0x16')][_0x8e9e('0x15')]);}})[_0x8e9e('0x17')](function(_0x22b2c7){logger[_0x8e9e('0x13')]('VtigerField,\x20%s,\x20%s',_0x1fb8d3,_0x22b2c7);_0x2ae896(_0x22b2c7);});});} \ No newline at end of file +var _0xbc4a=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x257126,_0xd0458b){var _0x2a2aa8=function(_0x1be180){while(--_0x1be180){_0x257126['push'](_0x257126['shift']());}};_0x2a2aa8(++_0xd0458b);}(_0xbc4a,0x1dd));var _0xabc4=function(_0xf05c4d,_0x140378){_0xf05c4d=_0xf05c4d-0x0;var _0x14030b=_0xbc4a[_0xf05c4d];return _0x14030b;};'use strict';var _=require(_0xabc4('0x0'));var util=require(_0xabc4('0x1'));var moment=require(_0xabc4('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('../../config/utils');var logger=require(_0xabc4('0x3'))('rpc');var config=require(_0xabc4('0x4'));var jayson=require(_0xabc4('0x5'));var client=jayson[_0xabc4('0x6')][_0xabc4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x244d3a,_0x1a33c4,_0x244a46){return new BPromise(function(_0x28ea0b,_0x159741){return client[_0xabc4('0x8')](_0x244d3a,_0x244a46)[_0xabc4('0x9')](function(_0x7ca67d){logger[_0xabc4('0xa')](_0xabc4('0xb'),_0x1a33c4,_0xabc4('0xc'));logger[_0xabc4('0xd')](_0xabc4('0xe'),_0x1a33c4,_0xabc4('0xc'),JSON[_0xabc4('0xf')](_0x7ca67d));if(_0x7ca67d[_0xabc4('0x10')]){if(_0x7ca67d[_0xabc4('0x10')][_0xabc4('0x11')]===0x1f4){logger[_0xabc4('0x10')](_0xabc4('0xb'),_0x1a33c4,_0x7ca67d[_0xabc4('0x10')][_0xabc4('0x12')]);return _0x159741(_0x7ca67d[_0xabc4('0x10')]['message']);}logger[_0xabc4('0x10')](_0xabc4('0xb'),_0x1a33c4,_0x7ca67d['error']['message']);return _0x28ea0b(_0x7ca67d[_0xabc4('0x10')][_0xabc4('0x12')]);}else{logger[_0xabc4('0xa')]('VtigerField,\x20%s,\x20%s',_0x1a33c4,'request\x20sent');_0x28ea0b(_0x7ca67d['result'][_0xabc4('0x12')]);}})[_0xabc4('0x13')](function(_0xa4ea8){logger[_0xabc4('0x10')](_0xabc4('0xb'),_0x1a33c4,_0xa4ea8);_0x159741(_0xa4ea8);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 3c7c184..410c6ef 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 _0x3ad6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','path','connect-timeout','express'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3ad6,0x179));var _0x63ad=function(_0x3c4885,_0x5ec7fe){_0x3c4885=_0x3c4885-0x0;var _0xf71c22=_0x3ad6[_0x3c4885];return _0xf71c22;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x63ad('0x0'));var timeout=require(_0x63ad('0x1'));var express=require(_0x63ad('0x2'));var router=express['Router']();var auth=require(_0x63ad('0x3'));var interaction=require(_0x63ad('0x4'));var config=require(_0x63ad('0x5'));var controller=require(_0x63ad('0x6'));router[_0x63ad('0x7')]('/',auth[_0x63ad('0x8')](),controller['index']);router[_0x63ad('0x7')](_0x63ad('0x9'),auth['isAuthenticated'](),controller[_0x63ad('0xa')]);router[_0x63ad('0x7')](_0x63ad('0xb'),auth[_0x63ad('0x8')](),controller['getConfigurations']);router[_0x63ad('0x7')](_0x63ad('0xc'),auth[_0x63ad('0x8')](),controller[_0x63ad('0xd')]);router[_0x63ad('0xe')]('/',auth[_0x63ad('0x8')](),controller['create']);router[_0x63ad('0xe')]('/:id/configurations',auth[_0x63ad('0x8')](),controller[_0x63ad('0xf')]);router[_0x63ad('0x10')]('/:id',auth[_0x63ad('0x8')](),controller[_0x63ad('0x11')]);router[_0x63ad('0x12')](_0x63ad('0x9'),auth[_0x63ad('0x8')](),controller['destroy']);module[_0x63ad('0x13')]=router; \ No newline at end of file +var _0xa5d8=['getConfigurations','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','path','express','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x10852d,_0x4cdcc6){var _0x13a8d6=function(_0x2ece16){while(--_0x2ece16){_0x10852d['push'](_0x10852d['shift']());}};_0x13a8d6(++_0x4cdcc6);}(_0xa5d8,0x10d));var _0x8a5d=function(_0x299808,_0x5321e5){_0x299808=_0x299808-0x0;var _0x10c145=_0xa5d8[_0x299808];return _0x10c145;};'use strict';var multer=require(_0x8a5d('0x0'));var util=require('util');var path=require(_0x8a5d('0x1'));var timeout=require('connect-timeout');var express=require(_0x8a5d('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x8a5d('0x3'));var config=require('../../config/environment');var controller=require(_0x8a5d('0x4'));router[_0x8a5d('0x5')]('/',auth[_0x8a5d('0x6')](),controller[_0x8a5d('0x7')]);router['get'](_0x8a5d('0x8'),auth['isAuthenticated'](),controller[_0x8a5d('0x9')]);router['get'](_0x8a5d('0xa'),auth[_0x8a5d('0x6')](),controller[_0x8a5d('0xb')]);router[_0x8a5d('0x5')]('/:id/fields',auth['isAuthenticated'](),controller[_0x8a5d('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x8a5d('0xd')](_0x8a5d('0xa'),auth[_0x8a5d('0x6')](),controller[_0x8a5d('0xe')]);router[_0x8a5d('0xf')](_0x8a5d('0x8'),auth[_0x8a5d('0x6')](),controller[_0x8a5d('0x10')]);router[_0x8a5d('0x11')](_0x8a5d('0x8'),auth[_0x8a5d('0x6')](),controller[_0x8a5d('0x12')]);module[_0x8a5d('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index b264650..f792f1c 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 _0x15f9=['ENUM','newTab','integrationTab','STRING','username','remoteUri','password'];(function(_0x189a72,_0x4ac342){var _0x2b457a=function(_0x151b57){while(--_0x151b57){_0x189a72['push'](_0x189a72['shift']());}};_0x2b457a(++_0x4ac342);}(_0x15f9,0x176));var _0x915f=function(_0x33ea19,_0x1a450f){_0x33ea19=_0x33ea19-0x0;var _0x3dacd8=_0x15f9[_0x33ea19];return _0x3dacd8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x915f('0x0')]},'description':{'type':Sequelize[_0x915f('0x0')]},'username':{'type':Sequelize[_0x915f('0x0')],'unique':_0x915f('0x1')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x915f('0x0')]},'remoteUri':{'type':Sequelize[_0x915f('0x0')],'unique':_0x915f('0x2')},'authType':{'type':Sequelize['ENUM'](_0x915f('0x3'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x915f('0x0')]},'type':{'type':Sequelize[_0x915f('0x4')]('integrationTab',_0x915f('0x5')),'defaultValue':_0x915f('0x6')}}; \ No newline at end of file +var _0xdc98=['integrationTab','newTab','exports','STRING','ENUM','token'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xdc98,0x14c));var _0x8dc9=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xdc98[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require('sequelize');module[_0x8dc9('0x0')]={'name':{'type':Sequelize[_0x8dc9('0x1')]},'description':{'type':Sequelize[_0x8dc9('0x1')]},'username':{'type':Sequelize[_0x8dc9('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x8dc9('0x1')]},'token':{'type':Sequelize[_0x8dc9('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x8dc9('0x2')]('password',_0x8dc9('0x3')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x8dc9('0x4'),_0x8dc9('0x5')),'defaultValue':_0x8dc9('0x4')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 3b85005..898e081 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 _0x1360=['title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','error','message','result','catch','end','status','count','limit','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','include','find','create','body','findOne','params','ZendeskConfiguration','order','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','password','headers','%s:%s','Basic\x20%s','toString','base64','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position'];(function(_0x36c576,_0x3cd309){var _0x143732=function(_0x52085c){while(--_0x52085c){_0x36c576['push'](_0x36c576['shift']());}};_0x143732(++_0x3cd309);}(_0x1360,0x87));var _0x0136=function(_0x5316c9,_0x1599b8){_0x5316c9=_0x5316c9-0x0;var _0x4b7507=_0x1360[_0x5316c9];return _0x4b7507;};'use strict';var pdf=require(_0x0136('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0136('0x1'));var zipdir=require(_0x0136('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0136('0x3'));var moment=require(_0x0136('0x4'));var BPromise=require(_0x0136('0x5'));var Mustache=require(_0x0136('0x6'));var util=require(_0x0136('0x7'));var path=require(_0x0136('0x8'));var sox=require(_0x0136('0x9'));var csv=require(_0x0136('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0136('0xb'));var squel=require('squel');var crypto=require(_0x0136('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0136('0xa'));var querystring=require(_0x0136('0xd'));var Papa=require(_0x0136('0xe'));var Redis=require(_0x0136('0xf'));var authService=require(_0x0136('0x10'));var qs=require(_0x0136('0x11'));var as=require(_0x0136('0x12'));var hardwareService=require(_0x0136('0x13'));var logger=require(_0x0136('0x14'))(_0x0136('0x15'));var utils=require(_0x0136('0x16'));var config=require(_0x0136('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0136('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x0136('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x5eddb5,_0x3c21d0,_0x53b5b3){if(_0x53b5b3){var _0x5ce018=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5ce018[_0x0136('0x1a')](_0x3c21d0)){return _0x5eddb5;}else{throw new db[(_0x0136('0x1b'))][(_0x0136('0x1c'))](_0x0136('0x1d'));}}else{return _0x5eddb5;}}function respondWithRpcPromise(_0x36f17a,_0x2c8460,_0x2830af,_0x5aba35){return new BPromise(function(_0x1b0839,_0xdcf0ba){var _0x16b67c=_0x5aba35||client;return _0x16b67c[_0x0136('0x1e')](_0x36f17a,_0x2830af)[_0x0136('0x1f')](function(_0x4d455f){logger[_0x0136('0x20')](_0x0136('0x21'),_0x2c8460,_0x0136('0x22'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x2c8460,_0x0136('0x22'),JSON['stringify'](_0x4d455f));if(_0x4d455f[_0x0136('0x23')]){if(_0x4d455f[_0x0136('0x23')]['code']===0x1f4){logger[_0x0136('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x2c8460,_0x4d455f['error'][_0x0136('0x24')]);return _0xdcf0ba(_0x4d455f[_0x0136('0x23')][_0x0136('0x24')]);}logger[_0x0136('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x2c8460,_0x4d455f['error']['message']);return _0x1b0839(_0x4d455f[_0x0136('0x23')][_0x0136('0x24')]);}else{logger[_0x0136('0x20')]('ZendeskAccount,\x20%s,\x20%s',_0x2c8460,'request\x20sent');_0x1b0839(_0x4d455f[_0x0136('0x25')][_0x0136('0x24')]);}})[_0x0136('0x26')](function(_0x10177f){logger[_0x0136('0x23')]('ZendeskAccount,\x20%s,\x20%s',_0x2c8460,_0x10177f);_0xdcf0ba(_0x10177f);});});}function respondWithStatusCode(_0x592e5b,_0xe5506a){_0xe5506a=_0xe5506a||0xcc;return function(_0x3b522b){if(_0x3b522b){return _0x592e5b['sendStatus'](_0xe5506a);}return _0x592e5b['status'](_0xe5506a)[_0x0136('0x27')]();};}function respondWithResult(_0x3e0777,_0x15005f){_0x15005f=_0x15005f||0xc8;return function(_0x22306d){if(_0x22306d){return _0x3e0777[_0x0136('0x28')](_0x15005f)['json'](_0x22306d);}};}function respondWithFilteredResult(_0x3a8471,_0x4ff4ac){return function(_0x3461e2){if(_0x3461e2){var _0x129877=_0x3461e2[_0x0136('0x29')],_0x368410=_0x4ff4ac['offset'],_0x203371=_0x4ff4ac['offset']+_0x4ff4ac[_0x0136('0x2a')],_0x18b066;if(_0x203371>=_0x129877){_0x203371=_0x129877;_0x18b066=0xc8;}else{_0x18b066=0xce;}_0x3a8471[_0x0136('0x28')](_0x18b066);return _0x3a8471['set']('Content-Range',_0x368410+'-'+_0x203371+'/'+_0x129877)['json'](_0x3461e2);}return null;};}function patchUpdates(_0x148c31){return function(_0x1581ff){try{jsonpatch[_0x0136('0x2b')](_0x1581ff,_0x148c31,!![]);}catch(_0x284d4c){return BPromise[_0x0136('0x2c')](_0x284d4c);}return _0x1581ff[_0x0136('0x2d')]();};}function saveUpdates(_0x2d9ea3,_0xef7295){return function(_0x17fc78){if(_0x17fc78){return _0x17fc78[_0x0136('0x2e')](_0x2d9ea3)[_0x0136('0x1f')](function(_0x3926c1){return _0x3926c1;});}return null;};}function removeEntity(_0x3ac9a6,_0x15e0bc){return function(_0x543d29){if(_0x543d29){return _0x543d29[_0x0136('0x2f')]()[_0x0136('0x1f')](function(){_0x3ac9a6[_0x0136('0x28')](0xcc)[_0x0136('0x27')]();});}};}function handleEntityNotFound(_0x1ff2d0,_0x24ee44){return function(_0x6900f0){if(!_0x6900f0){_0x1ff2d0[_0x0136('0x30')](0x194);}return _0x6900f0;};}function handleError(_0x217769,_0x34ce1a){_0x34ce1a=_0x34ce1a||0x1f4;return function(_0x91035d){logger[_0x0136('0x23')](_0x91035d[_0x0136('0x31')]);if(_0x91035d['name']){delete _0x91035d[_0x0136('0x32')];}_0x217769[_0x0136('0x28')](_0x34ce1a)[_0x0136('0x33')](_0x91035d);};}exports[_0x0136('0x34')]=function(_0x5b0e92,_0x310d7b){var _0x3153a6={},_0x5edd66={},_0x2d7e32={'count':0x0,'rows':[]};var _0x1a3c1e=_[_0x0136('0x35')](db[_0x0136('0x36')][_0x0136('0x37')],function(_0x1a89cd){return{'name':_0x1a89cd[_0x0136('0x38')],'type':_0x1a89cd[_0x0136('0x39')]['key']};});_0x5edd66[_0x0136('0x3a')]=_[_0x0136('0x35')](_0x1a3c1e,_0x0136('0x32'));_0x5edd66[_0x0136('0x3b')]=_[_0x0136('0x3c')](_0x5b0e92[_0x0136('0x3b')]);_0x5edd66[_0x0136('0x3d')]=_[_0x0136('0x3e')](_0x5edd66[_0x0136('0x3a')],_0x5edd66[_0x0136('0x3b')]);_0x3153a6[_0x0136('0x3f')]=_[_0x0136('0x3e')](_0x5edd66[_0x0136('0x3a')],qs[_0x0136('0x40')](_0x5b0e92[_0x0136('0x3b')][_0x0136('0x40')]));_0x3153a6[_0x0136('0x3f')]=_0x3153a6[_0x0136('0x3f')][_0x0136('0x41')]?_0x3153a6[_0x0136('0x3f')]:_0x5edd66[_0x0136('0x3a')];if(!_0x5b0e92[_0x0136('0x3b')][_0x0136('0x42')](_0x0136('0x43'))){_0x3153a6[_0x0136('0x2a')]=qs[_0x0136('0x2a')](_0x5b0e92[_0x0136('0x3b')][_0x0136('0x2a')]);_0x3153a6[_0x0136('0x44')]=qs[_0x0136('0x44')](_0x5b0e92[_0x0136('0x3b')][_0x0136('0x44')]);}_0x3153a6['order']=qs[_0x0136('0x45')](_0x5b0e92[_0x0136('0x3b')][_0x0136('0x45')]);_0x3153a6[_0x0136('0x46')]=qs[_0x0136('0x3d')](_['pick'](_0x5b0e92['query'],_0x5edd66[_0x0136('0x3d')]));if(_0x5b0e92[_0x0136('0x3b')]['filter']){_0x3153a6[_0x0136('0x46')]=_[_0x0136('0x47')](_0x3153a6['where'],{'$or':_['map'](_0x1a3c1e,function(_0x35fab){if(_0x35fab['type']!==_0x0136('0x48')){var _0x3bac9a={};_0x3bac9a[_0x35fab[_0x0136('0x32')]]={'$like':'%'+_0x5b0e92['query'][_0x0136('0x49')]+'%'};return _0x3bac9a;}})});}_0x3153a6=_['merge']({},_0x3153a6,_0x5b0e92[_0x0136('0x4a')]);var _0x418f0a={'where':_0x3153a6[_0x0136('0x46')]};return db['ZendeskAccount'][_0x0136('0x29')](_0x418f0a)['then'](function(_0x362826){_0x2d7e32['count']=_0x362826;if(_0x5b0e92[_0x0136('0x3b')][_0x0136('0x4b')]){_0x3153a6['include']=[{'all':!![]}];}return db[_0x0136('0x36')][_0x0136('0x4c')](_0x3153a6);})[_0x0136('0x1f')](function(_0x9f18de){_0x2d7e32[_0x0136('0x4d')]=_0x9f18de;return _0x2d7e32;})[_0x0136('0x1f')](respondWithFilteredResult(_0x310d7b,_0x3153a6))[_0x0136('0x26')](handleError(_0x310d7b,null));};exports[_0x0136('0x4e')]=function(_0x4ec014,_0x343b0a){var _0x1ba863={'raw':![],'where':{'id':_0x4ec014['params']['id']}},_0x3c817f={};_0x3c817f[_0x0136('0x3a')]=_[_0x0136('0x3c')](db[_0x0136('0x36')]['rawAttributes']);_0x3c817f['query']=_[_0x0136('0x3c')](_0x4ec014[_0x0136('0x3b')]);_0x3c817f[_0x0136('0x3d')]=_[_0x0136('0x3e')](_0x3c817f[_0x0136('0x3a')],_0x3c817f[_0x0136('0x3b')]);_0x1ba863['attributes']=_['intersection'](_0x3c817f[_0x0136('0x3a')],qs['fields'](_0x4ec014['query']['fields']));_0x1ba863[_0x0136('0x3f')]=_0x1ba863[_0x0136('0x3f')][_0x0136('0x41')]?_0x1ba863['attributes']:_0x3c817f[_0x0136('0x3a')];if(_0x4ec014[_0x0136('0x3b')][_0x0136('0x4b')]){_0x1ba863[_0x0136('0x4f')]=[{'all':!![]}];}_0x1ba863=_[_0x0136('0x47')]({},_0x1ba863,_0x4ec014[_0x0136('0x4a')]);return db[_0x0136('0x36')][_0x0136('0x50')](_0x1ba863)[_0x0136('0x1f')](handleEntityNotFound(_0x343b0a,null))['then'](respondWithResult(_0x343b0a,null))['catch'](handleError(_0x343b0a,null));};exports['create']=function(_0x432e6a,_0x569d48){return db[_0x0136('0x36')][_0x0136('0x51')](_0x432e6a[_0x0136('0x52')],{})[_0x0136('0x1f')](respondWithResult(_0x569d48,0xc9))[_0x0136('0x26')](handleError(_0x569d48,null));};exports[_0x0136('0x2e')]=function(_0x2d7255,_0x1334d5){if(_0x2d7255[_0x0136('0x52')]['id']){delete _0x2d7255[_0x0136('0x52')]['id'];}return db[_0x0136('0x36')]['find']({'where':{'id':_0x2d7255['params']['id']}})[_0x0136('0x1f')](handleEntityNotFound(_0x1334d5,null))[_0x0136('0x1f')](saveUpdates(_0x2d7255[_0x0136('0x52')],null))['then'](respondWithResult(_0x1334d5,null))[_0x0136('0x26')](handleError(_0x1334d5,null));};exports[_0x0136('0x2f')]=function(_0x10522e,_0x49ecde){return db[_0x0136('0x36')][_0x0136('0x50')]({'where':{'id':_0x10522e['params']['id']}})['then'](handleEntityNotFound(_0x49ecde,null))[_0x0136('0x1f')](removeEntity(_0x49ecde,null))['catch'](handleError(_0x49ecde,null));};exports['getConfigurations']=function(_0x513bc6,_0x2bcc96,_0x59773f){var _0x140226={};var _0x5a8e9b={};var _0x606d2e;var _0x42079f;return db[_0x0136('0x36')][_0x0136('0x53')]({'where':{'id':_0x513bc6[_0x0136('0x54')]['id']}})[_0x0136('0x1f')](handleEntityNotFound(_0x2bcc96,null))['then'](function(_0x35bef6){if(_0x35bef6){_0x606d2e=_0x35bef6;_0x5a8e9b[_0x0136('0x3a')]=_[_0x0136('0x3c')](db[_0x0136('0x55')][_0x0136('0x37')]);_0x5a8e9b[_0x0136('0x3b')]=_[_0x0136('0x3c')](_0x513bc6[_0x0136('0x3b')]);_0x5a8e9b[_0x0136('0x3d')]=_['intersection'](_0x5a8e9b[_0x0136('0x3a')],_0x5a8e9b['query']);_0x140226[_0x0136('0x3f')]=_[_0x0136('0x3e')](_0x5a8e9b[_0x0136('0x3a')],qs['fields'](_0x513bc6['query'][_0x0136('0x40')]));_0x140226[_0x0136('0x3f')]=_0x140226['attributes'][_0x0136('0x41')]?_0x140226[_0x0136('0x3f')]:_0x5a8e9b['model'];_0x140226[_0x0136('0x56')]=qs['sort'](_0x513bc6[_0x0136('0x3b')][_0x0136('0x45')]);_0x140226[_0x0136('0x46')]=qs[_0x0136('0x3d')](_['pick'](_0x513bc6[_0x0136('0x3b')],_0x5a8e9b[_0x0136('0x3d')]));if(_0x513bc6[_0x0136('0x3b')][_0x0136('0x49')]){_0x140226[_0x0136('0x46')]=_[_0x0136('0x47')](_0x140226[_0x0136('0x46')],{'$or':_[_0x0136('0x35')](_0x140226['attributes'],function(_0x51fbee){var _0xb6adc5={};_0xb6adc5[_0x51fbee]={'$like':'%'+_0x513bc6[_0x0136('0x3b')][_0x0136('0x49')]+'%'};return _0xb6adc5;})});}_0x140226=_['merge']({},_0x140226,_0x513bc6['options']);return _0x606d2e[_0x0136('0x57')](_0x140226);}})[_0x0136('0x1f')](function(_0x3b16df){if(_0x3b16df){_0x42079f=_0x3b16df[_0x0136('0x41')];if(!_0x513bc6[_0x0136('0x3b')][_0x0136('0x42')](_0x0136('0x43'))){_0x140226[_0x0136('0x2a')]=qs[_0x0136('0x2a')](_0x513bc6[_0x0136('0x3b')][_0x0136('0x2a')]);_0x140226[_0x0136('0x44')]=qs[_0x0136('0x44')](_0x513bc6[_0x0136('0x3b')][_0x0136('0x44')]);}return _0x606d2e['getConfigurations'](_0x140226);}})[_0x0136('0x1f')](function(_0x1e2fba){if(_0x1e2fba){return _0x1e2fba?{'count':_0x42079f,'rows':_0x1e2fba}:null;}})[_0x0136('0x1f')](respondWithResult(_0x2bcc96,null))[_0x0136('0x26')](handleError(_0x2bcc96,null));};exports[_0x0136('0x58')]=function(_0x1c9647,_0x4cbb56,_0x397ebe){if(_0x1c9647[_0x0136('0x52')]['id']){delete _0x1c9647['body']['id'];}return db[_0x0136('0x36')][_0x0136('0x53')]({'where':{'id':_0x1c9647['params']['id']}})[_0x0136('0x1f')](handleEntityNotFound(_0x4cbb56,null))[_0x0136('0x1f')](function(_0x37ebb7){if(_0x37ebb7){_0x1c9647[_0x0136('0x52')][_0x0136('0x59')]=_0x37ebb7['id'];_0x1c9647['body']['Subjects']=integrations[_0x0136('0x5a')](_0x1c9647[_0x0136('0x52')][_0x0136('0x5b')],_0x1c9647[_0x0136('0x52')][_0x0136('0x39')]);_0x1c9647['body'][_0x0136('0x5c')]=integrations[_0x0136('0x5d')](_0x1c9647[_0x0136('0x52')][_0x0136('0x5b')],_0x1c9647[_0x0136('0x52')]['type']);return db['ZendeskConfiguration'][_0x0136('0x51')](_0x1c9647[_0x0136('0x52')],{'include':[{'model':db[_0x0136('0x5e')],'as':_0x0136('0x5f')},{'model':db[_0x0136('0x5e')],'as':_0x0136('0x5c')}]});}return null;})[_0x0136('0x1f')](respondWithResult(_0x4cbb56,null))[_0x0136('0x26')](handleError(_0x4cbb56,null));};exports[_0x0136('0x60')]=function(_0x17b111,_0x5d6526,_0x38cfba){var _0xc6ce13='';return db[_0x0136('0x36')][_0x0136('0x53')]({'where':{'id':_0x17b111[_0x0136('0x54')]['id']},'attributes':['id',_0x0136('0x61'),'password',_0x0136('0x62'),_0x0136('0x63'),_0x0136('0x64')]})[_0x0136('0x1f')](handleEntityNotFound(_0x5d6526,null))[_0x0136('0x1f')](function(_0x4dbbaa){if(_0x4dbbaa){_0xc6ce13=_0x4dbbaa[_0x0136('0x64')];var _0x59b050=_0xc6ce13[_0x0136('0x65')](-0x1);if(_0x59b050==='/'){_0xc6ce13=_0xc6ce13[_0x0136('0x66')](0x0,_0xc6ce13[_0x0136('0x67')](_0x59b050));}var _0x412eb8={'method':_0x0136('0x68'),'uri':util[_0x0136('0x69')]('%s/%s',_0xc6ce13,_0x0136('0x6a')),'json':!![]};switch(_0x4dbbaa[_0x0136('0x63')]){case _0x0136('0x6b'):_0x412eb8[_0x0136('0x6c')]={'Authorization':util[_0x0136('0x69')]('Basic\x20%s',new Buffer(util[_0x0136('0x69')](_0x0136('0x6d'),_0x4dbbaa[_0x0136('0x61')],_0x4dbbaa[_0x0136('0x6b')]))['toString']('base64'))};break;case _0x0136('0x62'):_0x412eb8[_0x0136('0x6c')]={'Authorization':util[_0x0136('0x69')](_0x0136('0x6e'),new Buffer(util[_0x0136('0x69')]('%s/token:%s',_0x4dbbaa[_0x0136('0x61')],_0x4dbbaa[_0x0136('0x62')]))[_0x0136('0x6f')](_0x0136('0x70')))};break;default:throw new db['Sequelize']['ValidationError'](_0x0136('0x71'));}return rp(_0x412eb8);}})[_0x0136('0x1f')](function(_0x535f1b){if(_0x535f1b){var _0x209e7d=[_0x0136('0x72'),_0x0136('0x73'),_0x0136('0x74'),_0x0136('0x75')];_[_0x0136('0x76')](_0x535f1b[_0x0136('0x6a')],function(_0x47dc96){return _0x209e7d[_0x0136('0x77')](_0x47dc96[_0x0136('0x39')]);});return{'count':_0x535f1b['ticket_fields'][_0x0136('0x41')],'rows':_[_0x0136('0x35')](_0x535f1b[_0x0136('0x6a')],function(_0x29c48c){return{'id':_0x29c48c['id'],'name':_0x29c48c[_0x0136('0x78')]>0x7?_0x29c48c[_0x0136('0x79')]:_0x29c48c[_0x0136('0x39')],'custom':_0x29c48c[_0x0136('0x78')]>0x7?!![]:![],'options':_0x29c48c[_0x0136('0x7a')]?_0x29c48c['system_field_options']:_0x29c48c['custom_field_options']?_0x29c48c[_0x0136('0x7b')]:[]};})};}})['then'](respondWithResult(_0x5d6526,null))[_0x0136('0x26')](function(_0x506a2d){var _0x49546c=_0x17b111[_0x0136('0x3b')]['test']?0x1f4:_0x506a2d[_0x0136('0x7c')]||0x1f4;logger[_0x0136('0x23')](_0x0136('0x7d'),_0x0136('0x60'),_0x49546c,JSON[_0x0136('0x7e')](_0x506a2d));delete _0x506a2d[_0x0136('0x32')];if(_0x49546c===0x191){_0x49546c=0x190;}_0x5d6526['status'](_0x49546c)['send'](_0x17b111['query'][_0x0136('0x1a')]?{'message':_0x0136('0x7f'),'statusCode':_0x506a2d[_0x0136('0x7c')]}:_0x506a2d);});}; \ No newline at end of file +var _0x6fcf=['getConfigurations','findOne','ZendeskConfiguration','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','Subjects','password','token','authType','remoteUri','slice','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','username','base64','%s/token:%s','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','title','position','system_field_options','custom_field_options','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','Sequelize','ValidationError','request','then','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','sendStatus','end','status','count','offset','limit','set','json','apply','reject','save','update','destroy','index','map','ZendeskAccount','fieldName','type','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','options','includeAll','include','show','params','rawAttributes','find','create','body'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6fcf,0x11e));var _0xf6fc=function(_0x47b017,_0x52942d){_0x47b017=_0x47b017-0x0;var _0x485638=_0x6fcf[_0x47b017];return _0x485638;};'use strict';var pdf=require(_0xf6fc('0x0'));var emlformat=require(_0xf6fc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf6fc('0x2'));var rp=require('request-promise');var moment=require(_0xf6fc('0x3'));var BPromise=require(_0xf6fc('0x4'));var Mustache=require(_0xf6fc('0x5'));var util=require(_0xf6fc('0x6'));var path=require('path');var sox=require(_0xf6fc('0x7'));var csv=require(_0xf6fc('0x8'));var ejs=require(_0xf6fc('0x9'));var fs=require('fs');var _=require(_0xf6fc('0xa'));var squel=require(_0xf6fc('0xb'));var crypto=require('crypto');var jsforce=require(_0xf6fc('0xc'));var deskjs=require(_0xf6fc('0xd'));var toCsv=require(_0xf6fc('0x8'));var querystring=require(_0xf6fc('0xe'));var Papa=require(_0xf6fc('0xf'));var Redis=require(_0xf6fc('0x10'));var authService=require(_0xf6fc('0x11'));var qs=require(_0xf6fc('0x12'));var as=require(_0xf6fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xf6fc('0x14'));var config=require(_0xf6fc('0x15'));var db=require(_0xf6fc('0x16'))['db'];var integrations=require(_0xf6fc('0x17'));var jayson=require(_0xf6fc('0x18'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x3665c5,_0x91733f,_0x2d253f){if(_0x2d253f){var _0x3e19c2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e19c2['test'](_0x91733f)){return _0x3665c5;}else{throw new db[(_0xf6fc('0x19'))][(_0xf6fc('0x1a'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x3665c5;}}function respondWithRpcPromise(_0x41e06b,_0x408bdb,_0x59ade8,_0x3f3d42){return new BPromise(function(_0x2d3d66,_0x58fe61){var _0x19c9d1=_0x3f3d42||client;return _0x19c9d1[_0xf6fc('0x1b')](_0x41e06b,_0x59ade8)[_0xf6fc('0x1c')](function(_0x374243){logger[_0xf6fc('0x1d')](_0xf6fc('0x1e'),_0x408bdb,'request\x20sent');logger['debug'](_0xf6fc('0x1f'),_0x408bdb,'request\x20sent',JSON[_0xf6fc('0x20')](_0x374243));if(_0x374243['error']){if(_0x374243[_0xf6fc('0x21')]['code']===0x1f4){logger[_0xf6fc('0x21')](_0xf6fc('0x1e'),_0x408bdb,_0x374243[_0xf6fc('0x21')][_0xf6fc('0x22')]);return _0x58fe61(_0x374243[_0xf6fc('0x21')][_0xf6fc('0x22')]);}logger[_0xf6fc('0x21')](_0xf6fc('0x1e'),_0x408bdb,_0x374243[_0xf6fc('0x21')]['message']);return _0x2d3d66(_0x374243[_0xf6fc('0x21')][_0xf6fc('0x22')]);}else{logger['info'](_0xf6fc('0x1e'),_0x408bdb,_0xf6fc('0x23'));_0x2d3d66(_0x374243[_0xf6fc('0x24')][_0xf6fc('0x22')]);}})[_0xf6fc('0x25')](function(_0x3b5fae){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x408bdb,_0x3b5fae);_0x58fe61(_0x3b5fae);});});}function respondWithStatusCode(_0x4d6a3b,_0x3dbdd5){_0x3dbdd5=_0x3dbdd5||0xcc;return function(_0x5aa8c9){if(_0x5aa8c9){return _0x4d6a3b[_0xf6fc('0x26')](_0x3dbdd5);}return _0x4d6a3b['status'](_0x3dbdd5)[_0xf6fc('0x27')]();};}function respondWithResult(_0x2cf521,_0x136d0a){_0x136d0a=_0x136d0a||0xc8;return function(_0x11b7de){if(_0x11b7de){return _0x2cf521[_0xf6fc('0x28')](_0x136d0a)['json'](_0x11b7de);}};}function respondWithFilteredResult(_0x530d1f,_0x32918c){return function(_0x5a28e5){if(_0x5a28e5){var _0x2ae78b=_0x5a28e5[_0xf6fc('0x29')],_0x5f484f=_0x32918c[_0xf6fc('0x2a')],_0x4c7e88=_0x32918c[_0xf6fc('0x2a')]+_0x32918c[_0xf6fc('0x2b')],_0x1aae32;if(_0x4c7e88>=_0x2ae78b){_0x4c7e88=_0x2ae78b;_0x1aae32=0xc8;}else{_0x1aae32=0xce;}_0x530d1f[_0xf6fc('0x28')](_0x1aae32);return _0x530d1f[_0xf6fc('0x2c')]('Content-Range',_0x5f484f+'-'+_0x4c7e88+'/'+_0x2ae78b)[_0xf6fc('0x2d')](_0x5a28e5);}return null;};}function patchUpdates(_0x25acde){return function(_0x27ee1c){try{jsonpatch[_0xf6fc('0x2e')](_0x27ee1c,_0x25acde,!![]);}catch(_0x35adbc){return BPromise[_0xf6fc('0x2f')](_0x35adbc);}return _0x27ee1c[_0xf6fc('0x30')]();};}function saveUpdates(_0x49e4c0,_0x41f63f){return function(_0x452239){if(_0x452239){return _0x452239[_0xf6fc('0x31')](_0x49e4c0)[_0xf6fc('0x1c')](function(_0x4b9433){return _0x4b9433;});}return null;};}function removeEntity(_0x303de1,_0x491f78){return function(_0xca8098){if(_0xca8098){return _0xca8098[_0xf6fc('0x32')]()[_0xf6fc('0x1c')](function(){_0x303de1[_0xf6fc('0x28')](0xcc)[_0xf6fc('0x27')]();});}};}function handleEntityNotFound(_0x41ca8a,_0x11e322){return function(_0x233221){if(!_0x233221){_0x41ca8a[_0xf6fc('0x26')](0x194);}return _0x233221;};}function handleError(_0x3970f5,_0x45f299){_0x45f299=_0x45f299||0x1f4;return function(_0x4dff29){logger[_0xf6fc('0x21')](_0x4dff29['stack']);if(_0x4dff29['name']){delete _0x4dff29['name'];}_0x3970f5['status'](_0x45f299)['send'](_0x4dff29);};}exports[_0xf6fc('0x33')]=function(_0x1c133a,_0x4abc84){var _0x178940={},_0x405b08={},_0x230cae={'count':0x0,'rows':[]};var _0x11416e=_[_0xf6fc('0x34')](db[_0xf6fc('0x35')]['rawAttributes'],function(_0xdf2315){return{'name':_0xdf2315[_0xf6fc('0x36')],'type':_0xdf2315[_0xf6fc('0x37')]['key']};});_0x405b08[_0xf6fc('0x38')]=_[_0xf6fc('0x34')](_0x11416e,'name');_0x405b08['query']=_[_0xf6fc('0x39')](_0x1c133a['query']);_0x405b08[_0xf6fc('0x3a')]=_[_0xf6fc('0x3b')](_0x405b08['model'],_0x405b08[_0xf6fc('0x3c')]);_0x178940[_0xf6fc('0x3d')]=_['intersection'](_0x405b08[_0xf6fc('0x38')],qs[_0xf6fc('0x3e')](_0x1c133a['query']['fields']));_0x178940[_0xf6fc('0x3d')]=_0x178940[_0xf6fc('0x3d')][_0xf6fc('0x3f')]?_0x178940['attributes']:_0x405b08[_0xf6fc('0x38')];if(!_0x1c133a['query'][_0xf6fc('0x40')](_0xf6fc('0x41'))){_0x178940[_0xf6fc('0x2b')]=qs[_0xf6fc('0x2b')](_0x1c133a['query']['limit']);_0x178940[_0xf6fc('0x2a')]=qs[_0xf6fc('0x2a')](_0x1c133a['query'][_0xf6fc('0x2a')]);}_0x178940[_0xf6fc('0x42')]=qs[_0xf6fc('0x43')](_0x1c133a[_0xf6fc('0x3c')]['sort']);_0x178940[_0xf6fc('0x44')]=qs[_0xf6fc('0x3a')](_[_0xf6fc('0x45')](_0x1c133a['query'],_0x405b08[_0xf6fc('0x3a')]));if(_0x1c133a[_0xf6fc('0x3c')][_0xf6fc('0x46')]){_0x178940['where']=_['merge'](_0x178940[_0xf6fc('0x44')],{'$or':_[_0xf6fc('0x34')](_0x11416e,function(_0xcfea57){if(_0xcfea57[_0xf6fc('0x37')]!==_0xf6fc('0x47')){var _0x506af1={};_0x506af1[_0xcfea57[_0xf6fc('0x48')]]={'$like':'%'+_0x1c133a[_0xf6fc('0x3c')]['filter']+'%'};return _0x506af1;}})});}_0x178940=_[_0xf6fc('0x49')]({},_0x178940,_0x1c133a[_0xf6fc('0x4a')]);var _0x1c318e={'where':_0x178940[_0xf6fc('0x44')]};return db[_0xf6fc('0x35')]['count'](_0x1c318e)[_0xf6fc('0x1c')](function(_0x26b726){_0x230cae[_0xf6fc('0x29')]=_0x26b726;if(_0x1c133a[_0xf6fc('0x3c')][_0xf6fc('0x4b')]){_0x178940[_0xf6fc('0x4c')]=[{'all':!![]}];}return db[_0xf6fc('0x35')]['findAll'](_0x178940);})['then'](function(_0x49424a){_0x230cae['rows']=_0x49424a;return _0x230cae;})[_0xf6fc('0x1c')](respondWithFilteredResult(_0x4abc84,_0x178940))[_0xf6fc('0x25')](handleError(_0x4abc84,null));};exports[_0xf6fc('0x4d')]=function(_0x24bc79,_0x447c96){var _0x53cae3={'raw':![],'where':{'id':_0x24bc79[_0xf6fc('0x4e')]['id']}},_0x453d57={};_0x453d57[_0xf6fc('0x38')]=_[_0xf6fc('0x39')](db['ZendeskAccount'][_0xf6fc('0x4f')]);_0x453d57['query']=_[_0xf6fc('0x39')](_0x24bc79[_0xf6fc('0x3c')]);_0x453d57[_0xf6fc('0x3a')]=_['intersection'](_0x453d57[_0xf6fc('0x38')],_0x453d57['query']);_0x53cae3[_0xf6fc('0x3d')]=_['intersection'](_0x453d57['model'],qs[_0xf6fc('0x3e')](_0x24bc79[_0xf6fc('0x3c')]['fields']));_0x53cae3[_0xf6fc('0x3d')]=_0x53cae3['attributes']['length']?_0x53cae3[_0xf6fc('0x3d')]:_0x453d57[_0xf6fc('0x38')];if(_0x24bc79['query']['includeAll']){_0x53cae3[_0xf6fc('0x4c')]=[{'all':!![]}];}_0x53cae3=_[_0xf6fc('0x49')]({},_0x53cae3,_0x24bc79[_0xf6fc('0x4a')]);return db[_0xf6fc('0x35')][_0xf6fc('0x50')](_0x53cae3)[_0xf6fc('0x1c')](handleEntityNotFound(_0x447c96,null))[_0xf6fc('0x1c')](respondWithResult(_0x447c96,null))[_0xf6fc('0x25')](handleError(_0x447c96,null));};exports[_0xf6fc('0x51')]=function(_0x775328,_0x2c5418){return db['ZendeskAccount'][_0xf6fc('0x51')](_0x775328[_0xf6fc('0x52')],{})[_0xf6fc('0x1c')](respondWithResult(_0x2c5418,0xc9))[_0xf6fc('0x25')](handleError(_0x2c5418,null));};exports[_0xf6fc('0x31')]=function(_0x4707fe,_0x12dbd2){if(_0x4707fe[_0xf6fc('0x52')]['id']){delete _0x4707fe['body']['id'];}return db[_0xf6fc('0x35')][_0xf6fc('0x50')]({'where':{'id':_0x4707fe[_0xf6fc('0x4e')]['id']}})[_0xf6fc('0x1c')](handleEntityNotFound(_0x12dbd2,null))[_0xf6fc('0x1c')](saveUpdates(_0x4707fe['body'],null))['then'](respondWithResult(_0x12dbd2,null))[_0xf6fc('0x25')](handleError(_0x12dbd2,null));};exports[_0xf6fc('0x32')]=function(_0x1874f9,_0x517a61){return db['ZendeskAccount']['find']({'where':{'id':_0x1874f9[_0xf6fc('0x4e')]['id']}})[_0xf6fc('0x1c')](handleEntityNotFound(_0x517a61,null))['then'](removeEntity(_0x517a61,null))[_0xf6fc('0x25')](handleError(_0x517a61,null));};exports[_0xf6fc('0x53')]=function(_0x2865ec,_0x4b9d92,_0xc5933c){var _0x2ca691={};var _0xa66a66={};var _0x50cd08;var _0x9969f1;return db[_0xf6fc('0x35')][_0xf6fc('0x54')]({'where':{'id':_0x2865ec['params']['id']}})[_0xf6fc('0x1c')](handleEntityNotFound(_0x4b9d92,null))['then'](function(_0x39bb45){if(_0x39bb45){_0x50cd08=_0x39bb45;_0xa66a66[_0xf6fc('0x38')]=_[_0xf6fc('0x39')](db[_0xf6fc('0x55')][_0xf6fc('0x4f')]);_0xa66a66[_0xf6fc('0x3c')]=_['keys'](_0x2865ec[_0xf6fc('0x3c')]);_0xa66a66['filters']=_[_0xf6fc('0x3b')](_0xa66a66['model'],_0xa66a66[_0xf6fc('0x3c')]);_0x2ca691[_0xf6fc('0x3d')]=_[_0xf6fc('0x3b')](_0xa66a66[_0xf6fc('0x38')],qs[_0xf6fc('0x3e')](_0x2865ec[_0xf6fc('0x3c')]['fields']));_0x2ca691[_0xf6fc('0x3d')]=_0x2ca691[_0xf6fc('0x3d')][_0xf6fc('0x3f')]?_0x2ca691['attributes']:_0xa66a66['model'];_0x2ca691[_0xf6fc('0x42')]=qs[_0xf6fc('0x43')](_0x2865ec['query'][_0xf6fc('0x43')]);_0x2ca691['where']=qs[_0xf6fc('0x3a')](_[_0xf6fc('0x45')](_0x2865ec[_0xf6fc('0x3c')],_0xa66a66[_0xf6fc('0x3a')]));if(_0x2865ec['query'][_0xf6fc('0x46')]){_0x2ca691['where']=_[_0xf6fc('0x49')](_0x2ca691[_0xf6fc('0x44')],{'$or':_[_0xf6fc('0x34')](_0x2ca691[_0xf6fc('0x3d')],function(_0xd60fd9){var _0x2e9c0e={};_0x2e9c0e[_0xd60fd9]={'$like':'%'+_0x2865ec['query'][_0xf6fc('0x46')]+'%'};return _0x2e9c0e;})});}_0x2ca691=_['merge']({},_0x2ca691,_0x2865ec['options']);return _0x50cd08[_0xf6fc('0x53')](_0x2ca691);}})[_0xf6fc('0x1c')](function(_0x543b19){if(_0x543b19){_0x9969f1=_0x543b19['length'];if(!_0x2865ec[_0xf6fc('0x3c')][_0xf6fc('0x40')]('nolimit')){_0x2ca691[_0xf6fc('0x2b')]=qs[_0xf6fc('0x2b')](_0x2865ec[_0xf6fc('0x3c')][_0xf6fc('0x2b')]);_0x2ca691[_0xf6fc('0x2a')]=qs['offset'](_0x2865ec['query'][_0xf6fc('0x2a')]);}return _0x50cd08['getConfigurations'](_0x2ca691);}})[_0xf6fc('0x1c')](function(_0x1390b4){if(_0x1390b4){return _0x1390b4?{'count':_0x9969f1,'rows':_0x1390b4}:null;}})[_0xf6fc('0x1c')](respondWithResult(_0x4b9d92,null))[_0xf6fc('0x25')](handleError(_0x4b9d92,null));};exports[_0xf6fc('0x56')]=function(_0x210e63,_0x51a73a,_0x413679){if(_0x210e63[_0xf6fc('0x52')]['id']){delete _0x210e63[_0xf6fc('0x52')]['id'];}return db[_0xf6fc('0x35')][_0xf6fc('0x54')]({'where':{'id':_0x210e63[_0xf6fc('0x4e')]['id']}})[_0xf6fc('0x1c')](handleEntityNotFound(_0x51a73a,null))[_0xf6fc('0x1c')](function(_0x35770f){if(_0x35770f){_0x210e63[_0xf6fc('0x52')]['AccountId']=_0x35770f['id'];_0x210e63[_0xf6fc('0x52')]['Subjects']=integrations[_0xf6fc('0x57')](_0x210e63[_0xf6fc('0x52')][_0xf6fc('0x58')],_0x210e63[_0xf6fc('0x52')][_0xf6fc('0x37')]);_0x210e63[_0xf6fc('0x52')][_0xf6fc('0x59')]=integrations[_0xf6fc('0x5a')](_0x210e63[_0xf6fc('0x52')]['channel'],_0x210e63['body']['type']);return db[_0xf6fc('0x55')][_0xf6fc('0x51')](_0x210e63[_0xf6fc('0x52')],{'include':[{'model':db[_0xf6fc('0x5b')],'as':_0xf6fc('0x5c')},{'model':db['ZendeskField'],'as':_0xf6fc('0x59')}]});}return null;})['then'](respondWithResult(_0x51a73a,null))[_0xf6fc('0x25')](handleError(_0x51a73a,null));};exports['getFields']=function(_0x166f83,_0x2b5095,_0x916676){var _0x391ae1='';return db[_0xf6fc('0x35')][_0xf6fc('0x54')]({'where':{'id':_0x166f83[_0xf6fc('0x4e')]['id']},'attributes':['id','username',_0xf6fc('0x5d'),_0xf6fc('0x5e'),_0xf6fc('0x5f'),_0xf6fc('0x60')]})[_0xf6fc('0x1c')](handleEntityNotFound(_0x2b5095,null))['then'](function(_0x4e3e93){if(_0x4e3e93){_0x391ae1=_0x4e3e93[_0xf6fc('0x60')];var _0x33803c=_0x391ae1[_0xf6fc('0x61')](-0x1);if(_0x33803c==='/'){_0x391ae1=_0x391ae1['substring'](0x0,_0x391ae1['lastIndexOf'](_0x33803c));}var _0x2b5c7a={'method':_0xf6fc('0x62'),'uri':util[_0xf6fc('0x63')](_0xf6fc('0x64'),_0x391ae1,_0xf6fc('0x65')),'json':!![]};switch(_0x4e3e93[_0xf6fc('0x5f')]){case _0xf6fc('0x5d'):_0x2b5c7a[_0xf6fc('0x66')]={'Authorization':util['format'](_0xf6fc('0x67'),new Buffer(util[_0xf6fc('0x63')](_0xf6fc('0x68'),_0x4e3e93[_0xf6fc('0x69')],_0x4e3e93['password']))['toString'](_0xf6fc('0x6a')))};break;case _0xf6fc('0x5e'):_0x2b5c7a[_0xf6fc('0x66')]={'Authorization':util['format'](_0xf6fc('0x67'),new Buffer(util['format'](_0xf6fc('0x6b'),_0x4e3e93['username'],_0x4e3e93[_0xf6fc('0x5e')]))['toString']('base64'))};break;default:throw new db[(_0xf6fc('0x19'))]['ValidationError'](_0xf6fc('0x6c'));}return rp(_0x2b5c7a);}})[_0xf6fc('0x1c')](function(_0x5b1750){if(_0x5b1750){var _0x498b19=['subject',_0xf6fc('0x6d'),_0xf6fc('0x6e'),_0xf6fc('0x6f')];_[_0xf6fc('0x70')](_0x5b1750[_0xf6fc('0x65')],function(_0x155abb){return _0x498b19[_0xf6fc('0x71')](_0x155abb[_0xf6fc('0x37')]);});return{'count':_0x5b1750[_0xf6fc('0x65')][_0xf6fc('0x3f')],'rows':_['map'](_0x5b1750['ticket_fields'],function(_0x47ed62){return{'id':_0x47ed62['id'],'name':_0x47ed62['position']>0x7?_0x47ed62[_0xf6fc('0x72')]:_0x47ed62[_0xf6fc('0x37')],'custom':_0x47ed62[_0xf6fc('0x73')]>0x7?!![]:![],'options':_0x47ed62['system_field_options']?_0x47ed62[_0xf6fc('0x74')]:_0x47ed62[_0xf6fc('0x75')]?_0x47ed62[_0xf6fc('0x75')]:[]};})};}})[_0xf6fc('0x1c')](respondWithResult(_0x2b5095,null))['catch'](function(_0x27ffdf){var _0x3f2822=_0x166f83['query'][_0xf6fc('0x76')]?0x1f4:_0x27ffdf['statusCode']||0x1f4;logger['error'](_0xf6fc('0x77'),_0xf6fc('0x78'),_0x3f2822,JSON[_0xf6fc('0x20')](_0x27ffdf));delete _0x27ffdf[_0xf6fc('0x48')];if(_0x3f2822===0x191){_0x3f2822=0x190;}_0x2b5095[_0xf6fc('0x28')](_0x3f2822)['send'](_0x166f83[_0xf6fc('0x3c')][_0xf6fc('0x76')]?{'message':_0xf6fc('0x79'),'statusCode':_0x27ffdf[_0xf6fc('0x7a')]}:_0x27ffdf);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index f56ddcc..9e0eac2 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 _0x43e6=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','ZendeskAccount','int_zendesk_accounts','../../config/logger'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x43e6,0x9f));var _0x643e=function(_0x2f503f,_0x29bd35){_0x2f503f=_0x2f503f-0x0;var _0x5511f1=_0x43e6[_0x2f503f];return _0x5511f1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x643e('0x0'))(_0x643e('0x1'));var moment=require('moment');var BPromise=require(_0x643e('0x2'));var rp=require(_0x643e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x643e('0x4'));var config=require(_0x643e('0x5'));var attributes=require('./intZendeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x643e('0x6')]=function(_0x425cfb,_0x1da904){return _0x425cfb[_0x643e('0x7')](_0x643e('0x8'),attributes,{'tableName':_0x643e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x13d5=['lodash','moment','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x24f251,_0x570117){var _0x532cb0=function(_0x372e2f){while(--_0x372e2f){_0x24f251['push'](_0x24f251['shift']());}};_0x532cb0(++_0x570117);}(_0x13d5,0x70));var _0x513d=function(_0x3abd24,_0x554343){_0x3abd24=_0x3abd24-0x0;var _0x392bda=_0x13d5[_0x3abd24];return _0x392bda;};'use strict';var _=require(_0x513d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x513d('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x513d('0x2'));var rimraf=require(_0x513d('0x3'));var config=require(_0x513d('0x4'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x513d('0x5'));module[_0x513d('0x6')]=function(_0x446bae,_0x468540){return _0x446bae[_0x513d('0x7')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','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 c42caec..6d44c79 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 _0xcb91=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','include','map','model','then','ShowZendeskAccount','find','where','moment','bluebird','randomstring','ioredis'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35485a,_0x91cdd4){_0x35485a=_0x35485a-0x0;var _0x5148e6=_0xcb91[_0x35485a];return _0x5148e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ZendeskAccount,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});}exports[_0x1cb9('0x14')]=function(_0x23d3a9){var _0x4e1340=this;return new Promise(function(_0x479d43,_0x1b2fa6){return db[_0x1cb9('0x15')][_0x1cb9('0x16')]({'raw':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x18')]===undefined?!![]:![]:!![],'where':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['where']||null:null,'attributes':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options'][_0x1cb9('0x19')]||null:null,'limit':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9['options']['limit']||null:null,'include':_0x23d3a9[_0x1cb9('0x17')]?_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x23d3a9[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x59ebea){return{'model':db[_0x59ebea['model']],'as':_0x59ebea['as'],'attributes':_0x59ebea[_0x1cb9('0x19')],'include':_0x59ebea['include']?_[_0x1cb9('0x1b')](_0x59ebea[_0x1cb9('0x1a')],function(_0x69b4c8){return{'model':db[_0x69b4c8[_0x1cb9('0x1c')]],'as':_0x69b4c8['as'],'attributes':_0x69b4c8[_0x1cb9('0x19')],'include':_0x69b4c8['include']?_[_0x1cb9('0x1b')](_0x69b4c8[_0x1cb9('0x1a')],function(_0x4c8d76){return{'model':db[_0x4c8d76[_0x1cb9('0x1c')]],'as':_0x4c8d76['as'],'attributes':_0x4c8d76[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x1804fd){logger[_0x1cb9('0xa')](_0x1cb9('0x14'),_0x23d3a9);logger[_0x1cb9('0xd')](_0x1cb9('0x14'),_0x23d3a9,JSON[_0x1cb9('0xf')](_0x1804fd));_0x479d43(_0x1804fd);})[_0x1cb9('0x13')](function(_0x48888d){logger[_0x1cb9('0x10')]('GetZendeskAccount',_0x48888d[_0x1cb9('0x12')],_0x23d3a9);_0x1b2fa6(_0x4e1340['error'](0x1f4,_0x48888d[_0x1cb9('0x12')]));});});};exports[_0x1cb9('0x1e')]=function(_0x3cd7f5){var _0x2038aa=this;return new Promise(function(_0x561d89,_0x1c701f){return db['ZendeskAccount'][_0x1cb9('0x1f')]({'raw':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5['options'][_0x1cb9('0x20')]||null:null,'attributes':_0x3cd7f5['options']?_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x19')]||null:null,'include':_0x3cd7f5[_0x1cb9('0x17')]?_0x3cd7f5[_0x1cb9('0x17')]['include']?_[_0x1cb9('0x1b')](_0x3cd7f5[_0x1cb9('0x17')][_0x1cb9('0x1a')],function(_0x91a1db){return{'model':db[_0x91a1db[_0x1cb9('0x1c')]],'as':_0x91a1db['as'],'attributes':_0x91a1db[_0x1cb9('0x19')],'include':_0x91a1db[_0x1cb9('0x1a')]?_[_0x1cb9('0x1b')](_0x91a1db[_0x1cb9('0x1a')],function(_0x1de287){return{'model':db[_0x1de287[_0x1cb9('0x1c')]],'as':_0x1de287['as'],'attributes':_0x1de287[_0x1cb9('0x19')],'include':_0x1de287[_0x1cb9('0x1a')]?_['map'](_0x1de287['include'],function(_0x299ff8){return{'model':db[_0x299ff8[_0x1cb9('0x1c')]],'as':_0x299ff8['as'],'attributes':_0x299ff8[_0x1cb9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cb9('0x1d')](function(_0x385daa){logger[_0x1cb9('0xa')](_0x1cb9('0x1e'),_0x3cd7f5);logger[_0x1cb9('0xd')]('ShowZendeskAccount',_0x3cd7f5,JSON[_0x1cb9('0xf')](_0x385daa));_0x561d89(_0x385daa);})[_0x1cb9('0x13')](function(_0xefe136){logger['error'](_0x1cb9('0x1e'),_0xefe136['message'],_0x3cd7f5);_0x1c701f(_0x2038aa[_0x1cb9('0x10')](0x1f4,_0xefe136['message']));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','ShowZendeskAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x2f22d7,_0x2e677d){var _0x498b74=function(_0x17c6a3){while(--_0x17c6a3){_0x2f22d7['push'](_0x2f22d7['shift']());}};_0x498b74(++_0x2e677d);}(_0x757a,0xde));var _0xa757=function(_0x3fd6ca,_0x302d90){_0x3fd6ca=_0x3fd6ca-0x0;var _0x2f1e2c=_0x757a[_0x3fd6ca];return _0x2f1e2c;};'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']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetZendeskAccount',_0x4d9f58);logger['debug']('GetZendeskAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetZendeskAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index ee3eafe..d90f04f 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 _0x8521=['express','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5cde6f,_0x3d0cc5){var _0x2f3e6e=function(_0x561a5c){while(--_0x561a5c){_0x5cde6f['push'](_0x5cde6f['shift']());}};_0x2f3e6e(++_0x3d0cc5);}(_0x8521,0x1ac));var _0x1852=function(_0xf56b28,_0x18eb5c){_0xf56b28=_0xf56b28-0x0;var _0x4aae66=_0x8521[_0xf56b28];return _0x4aae66;};'use strict';var multer=require(_0x1852('0x0'));var util=require(_0x1852('0x1'));var path=require(_0x1852('0x2'));var timeout=require(_0x1852('0x3'));var express=require(_0x1852('0x4'));var router=express[_0x1852('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x1852('0x6'));var config=require(_0x1852('0x7'));var controller=require(_0x1852('0x8'));router[_0x1852('0x9')]('/',auth[_0x1852('0xa')](),controller[_0x1852('0xb')]);router[_0x1852('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x1852('0xc')]);router[_0x1852('0x9')](_0x1852('0xd'),auth['isAuthenticated'](),controller[_0x1852('0xe')]);router[_0x1852('0x9')]('/:id/subjects',auth[_0x1852('0xa')](),controller[_0x1852('0xf')]);router[_0x1852('0x9')]('/:id/descriptions',auth[_0x1852('0xa')](),controller['getDescriptions']);router[_0x1852('0x9')](_0x1852('0x10'),auth[_0x1852('0xa')](),controller[_0x1852('0x11')]);router['post']('/',auth[_0x1852('0xa')](),controller[_0x1852('0x12')]);router[_0x1852('0x13')]('/:id/tags',auth[_0x1852('0xa')](),controller[_0x1852('0x14')]);router[_0x1852('0x15')](_0x1852('0x16'),auth[_0x1852('0xa')](),controller[_0x1852('0x17')]);router[_0x1852('0x18')]('/:id',auth[_0x1852('0xa')](),controller[_0x1852('0x19')]);module[_0x1852('0x1a')]=router; \ No newline at end of file +var _0xd6ef=['express','Router','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x198d9c,_0x2b6cfa){var _0x1daf34=function(_0x593921){while(--_0x593921){_0x198d9c['push'](_0x198d9c['shift']());}};_0x1daf34(++_0x2b6cfa);}(_0xd6ef,0xc4));var _0xfd6e=function(_0x206835,_0x1c574f){_0x206835=_0x206835-0x0;var _0x499cc7=_0xd6ef[_0x206835];return _0x499cc7;};'use strict';var multer=require(_0xfd6e('0x0'));var util=require(_0xfd6e('0x1'));var path=require(_0xfd6e('0x2'));var timeout=require(_0xfd6e('0x3'));var express=require(_0xfd6e('0x4'));var router=express[_0xfd6e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xfd6e('0x6'));var config=require(_0xfd6e('0x7'));var controller=require(_0xfd6e('0x8'));router[_0xfd6e('0x9')]('/',auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xb')]);router[_0xfd6e('0x9')](_0xfd6e('0xc'),auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xd')]);router[_0xfd6e('0x9')]('/:id/fields',auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xe')]);router['get']('/:id/subjects',auth[_0xfd6e('0xa')](),controller[_0xfd6e('0xf')]);router[_0xfd6e('0x9')](_0xfd6e('0x10'),auth[_0xfd6e('0xa')](),controller[_0xfd6e('0x11')]);router['get'](_0xfd6e('0x12'),auth[_0xfd6e('0xa')](),controller['getTags']);router[_0xfd6e('0x13')]('/',auth[_0xfd6e('0xa')](),controller[_0xfd6e('0x14')]);router[_0xfd6e('0x13')](_0xfd6e('0x12'),auth[_0xfd6e('0xa')](),controller[_0xfd6e('0x15')]);router['put'](_0xfd6e('0xc'),auth[_0xfd6e('0xa')](),controller[_0xfd6e('0x16')]);router[_0xfd6e('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfd6e('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 0182009..483a64f 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 _0xe88d=['sequelize','exports','STRING'];(function(_0x223b3e,_0x3aa1aa){var _0x394aa4=function(_0x5a0b3d){while(--_0x5a0b3d){_0x223b3e['push'](_0x223b3e['shift']());}};_0x394aa4(++_0x3aa1aa);}(_0xe88d,0x1f2));var _0xde88=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0xe88d[_0x40d8d7];return _0x3454cc;};'use strict';var Sequelize=require(_0xde88('0x0'));module[_0xde88('0x1')]={'name':{'type':Sequelize[_0xde88('0x2')]},'description':{'type':Sequelize[_0xde88('0x2')]}}; \ No newline at end of file +var _0x5159=['sequelize','exports'];(function(_0xc4791d,_0x3b5bee){var _0x5386e1=function(_0x215ef8){while(--_0x215ef8){_0xc4791d['push'](_0xc4791d['shift']());}};_0x5386e1(++_0x3b5bee);}(_0x5159,0x76));var _0x9515=function(_0x13f8d3,_0x4471c2){_0x13f8d3=_0x13f8d3-0x0;var _0x1793c9=_0x5159[_0x13f8d3];return _0x1793c9;};'use strict';var Sequelize=require(_0x9515('0x0'));module[_0x9515('0x1')]={'name':{'type':Sequelize['STRING']},'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 b18d3be..bb066f1 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 _0x1261=['update','then','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','count','includeAll','findAll','rows','catch','show','include','create','body','find','params','getFields','findOne','where','options','getSubjects','ZendeskField','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','request\x20sent','sendStatus','status','offset','limit','set','apply','save'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x1261,0x144));var _0x1126=function(_0xb85fd5,_0x3362ae){_0xb85fd5=_0xb85fd5-0x0;var _0x34228e=_0x1261[_0xb85fd5];return _0x34228e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var db=require(_0x1126('0x16'))['db'];var jayson=require(_0x1126('0x17'));var client=jayson[_0x1126('0x18')][_0x1126('0x19')]({'port':0x232a});function checkPasswordPattern(_0xca0355,_0x3f10e9,_0xd8ca42){if(_0xd8ca42){var _0x2048ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2048ad[_0x1126('0x1a')](_0x3f10e9)){return _0xca0355;}else{throw new db['Sequelize']['ValidationError'](_0x1126('0x1b'));}}else{return _0xca0355;}}function respondWithRpcPromise(_0x154e20,_0x279455,_0x4be0c6,_0x45149c){return new BPromise(function(_0x4794a7,_0x35fe9f){var _0x42f379=_0x45149c||client;return _0x42f379[_0x1126('0x1c')](_0x154e20,_0x4be0c6)['then'](function(_0x245cd7){logger[_0x1126('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x279455,'request\x20sent');logger[_0x1126('0x1e')](_0x1126('0x1f'),_0x279455,'request\x20sent',JSON['stringify'](_0x245cd7));if(_0x245cd7[_0x1126('0x20')]){if(_0x245cd7['error'][_0x1126('0x21')]===0x1f4){logger[_0x1126('0x20')](_0x1126('0x22'),_0x279455,_0x245cd7['error'][_0x1126('0x23')]);return _0x35fe9f(_0x245cd7['error']['message']);}logger[_0x1126('0x20')](_0x1126('0x22'),_0x279455,_0x245cd7[_0x1126('0x20')][_0x1126('0x23')]);return _0x4794a7(_0x245cd7['error'][_0x1126('0x23')]);}else{logger[_0x1126('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x279455,_0x1126('0x24'));_0x4794a7(_0x245cd7['result']['message']);}})['catch'](function(_0x2199d9){logger[_0x1126('0x20')](_0x1126('0x22'),_0x279455,_0x2199d9);_0x35fe9f(_0x2199d9);});});}function respondWithStatusCode(_0x34bcf1,_0x566c09){_0x566c09=_0x566c09||0xcc;return function(_0x1b07a7){if(_0x1b07a7){return _0x34bcf1[_0x1126('0x25')](_0x566c09);}return _0x34bcf1[_0x1126('0x26')](_0x566c09)['end']();};}function respondWithResult(_0x35eec3,_0x375e59){_0x375e59=_0x375e59||0xc8;return function(_0xa293f4){if(_0xa293f4){return _0x35eec3['status'](_0x375e59)['json'](_0xa293f4);}};}function respondWithFilteredResult(_0xeb7d89,_0x39bf0e){return function(_0x55e195){if(_0x55e195){var _0x2fb797=_0x55e195['count'],_0x23d2bc=_0x39bf0e[_0x1126('0x27')],_0x4a334a=_0x39bf0e['offset']+_0x39bf0e[_0x1126('0x28')],_0x3fa694;if(_0x4a334a>=_0x2fb797){_0x4a334a=_0x2fb797;_0x3fa694=0xc8;}else{_0x3fa694=0xce;}_0xeb7d89['status'](_0x3fa694);return _0xeb7d89[_0x1126('0x29')]('Content-Range',_0x23d2bc+'-'+_0x4a334a+'/'+_0x2fb797)['json'](_0x55e195);}return null;};}function patchUpdates(_0x4a53ab){return function(_0x17646e){try{jsonpatch[_0x1126('0x2a')](_0x17646e,_0x4a53ab,!![]);}catch(_0x1cef48){return BPromise['reject'](_0x1cef48);}return _0x17646e[_0x1126('0x2b')]();};}function saveUpdates(_0x226afb,_0x56f7f8){return function(_0x3dd50e){if(_0x3dd50e){return _0x3dd50e[_0x1126('0x2c')](_0x226afb)[_0x1126('0x2d')](function(_0x29fbfa){return _0x29fbfa;});}return null;};}function removeEntity(_0x5836a2,_0x5ecbc3){return function(_0x2a7edc){if(_0x2a7edc){return _0x2a7edc[_0x1126('0x2e')]()[_0x1126('0x2d')](function(){_0x5836a2[_0x1126('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x145314,_0x6f4312){return function(_0x313ebe){if(!_0x313ebe){_0x145314[_0x1126('0x25')](0x194);}return _0x313ebe;};}function handleError(_0x3b0f79,_0x5df232){_0x5df232=_0x5df232||0x1f4;return function(_0x2a0dfe){logger[_0x1126('0x20')](_0x2a0dfe[_0x1126('0x2f')]);if(_0x2a0dfe[_0x1126('0x30')]){delete _0x2a0dfe['name'];}_0x3b0f79['status'](_0x5df232)[_0x1126('0x31')](_0x2a0dfe);};}exports[_0x1126('0x32')]=function(_0x511e6b,_0xde37cf){var _0xf3c21b={},_0x11b0f6={},_0x5c08b9={'count':0x0,'rows':[]};var _0x4b3859=_[_0x1126('0x33')](db[_0x1126('0x34')][_0x1126('0x35')],function(_0x156554){return{'name':_0x156554['fieldName'],'type':_0x156554[_0x1126('0x36')]['key']};});_0x11b0f6[_0x1126('0x37')]=_[_0x1126('0x33')](_0x4b3859,_0x1126('0x30'));_0x11b0f6[_0x1126('0x38')]=_[_0x1126('0x39')](_0x511e6b['query']);_0x11b0f6[_0x1126('0x3a')]=_[_0x1126('0x3b')](_0x11b0f6[_0x1126('0x37')],_0x11b0f6[_0x1126('0x38')]);_0xf3c21b[_0x1126('0x3c')]=_[_0x1126('0x3b')](_0x11b0f6[_0x1126('0x37')],qs['fields'](_0x511e6b[_0x1126('0x38')][_0x1126('0x3d')]));_0xf3c21b[_0x1126('0x3c')]=_0xf3c21b[_0x1126('0x3c')][_0x1126('0x3e')]?_0xf3c21b['attributes']:_0x11b0f6['model'];if(!_0x511e6b[_0x1126('0x38')][_0x1126('0x3f')](_0x1126('0x40'))){_0xf3c21b[_0x1126('0x28')]=qs[_0x1126('0x28')](_0x511e6b[_0x1126('0x38')]['limit']);_0xf3c21b['offset']=qs['offset'](_0x511e6b[_0x1126('0x38')]['offset']);}_0xf3c21b[_0x1126('0x41')]=qs[_0x1126('0x42')](_0x511e6b[_0x1126('0x38')][_0x1126('0x42')]);_0xf3c21b['where']=qs['filters'](_[_0x1126('0x43')](_0x511e6b[_0x1126('0x38')],_0x11b0f6[_0x1126('0x3a')]));if(_0x511e6b['query'][_0x1126('0x44')]){_0xf3c21b['where']=_[_0x1126('0x45')](_0xf3c21b['where'],{'$or':_[_0x1126('0x33')](_0x4b3859,function(_0xe178b4){if(_0xe178b4[_0x1126('0x36')]!=='VIRTUAL'){var _0xfaa3d8={};_0xfaa3d8[_0xe178b4[_0x1126('0x30')]]={'$like':'%'+_0x511e6b[_0x1126('0x38')]['filter']+'%'};return _0xfaa3d8;}})});}_0xf3c21b=_['merge']({},_0xf3c21b,_0x511e6b['options']);var _0x6e78cf={'where':_0xf3c21b['where']};return db[_0x1126('0x34')]['count'](_0x6e78cf)[_0x1126('0x2d')](function(_0x323499){_0x5c08b9[_0x1126('0x46')]=_0x323499;if(_0x511e6b[_0x1126('0x38')][_0x1126('0x47')]){_0xf3c21b['include']=[{'all':!![]}];}return db[_0x1126('0x34')][_0x1126('0x48')](_0xf3c21b);})['then'](function(_0x1a15f8){_0x5c08b9[_0x1126('0x49')]=_0x1a15f8;return _0x5c08b9;})['then'](respondWithFilteredResult(_0xde37cf,_0xf3c21b))[_0x1126('0x4a')](handleError(_0xde37cf,null));};exports[_0x1126('0x4b')]=function(_0x518e0a,_0x3e4eeb){var _0xbdde58={'raw':![],'where':{'id':_0x518e0a['params']['id']}},_0x213a76={};_0x213a76[_0x1126('0x37')]=_[_0x1126('0x39')](db[_0x1126('0x34')][_0x1126('0x35')]);_0x213a76[_0x1126('0x38')]=_[_0x1126('0x39')](_0x518e0a[_0x1126('0x38')]);_0x213a76[_0x1126('0x3a')]=_['intersection'](_0x213a76[_0x1126('0x37')],_0x213a76['query']);_0xbdde58[_0x1126('0x3c')]=_[_0x1126('0x3b')](_0x213a76['model'],qs['fields'](_0x518e0a[_0x1126('0x38')][_0x1126('0x3d')]));_0xbdde58[_0x1126('0x3c')]=_0xbdde58['attributes'][_0x1126('0x3e')]?_0xbdde58[_0x1126('0x3c')]:_0x213a76[_0x1126('0x37')];if(_0x518e0a[_0x1126('0x38')]['includeAll']){_0xbdde58[_0x1126('0x4c')]=[{'all':!![]}];}_0xbdde58=_[_0x1126('0x45')]({},_0xbdde58,_0x518e0a['options']);return db['ZendeskConfiguration']['find'](_0xbdde58)['then'](handleEntityNotFound(_0x3e4eeb,null))[_0x1126('0x2d')](respondWithResult(_0x3e4eeb,null))[_0x1126('0x4a')](handleError(_0x3e4eeb,null));};exports['create']=function(_0x16552b,_0x1c7a2b){return db[_0x1126('0x34')][_0x1126('0x4d')](_0x16552b[_0x1126('0x4e')],{})['then'](respondWithResult(_0x1c7a2b,0xc9))[_0x1126('0x4a')](handleError(_0x1c7a2b,null));};exports[_0x1126('0x2c')]=function(_0x5d6414,_0x322016){if(_0x5d6414[_0x1126('0x4e')]['id']){delete _0x5d6414[_0x1126('0x4e')]['id'];}return db[_0x1126('0x34')][_0x1126('0x4f')]({'where':{'id':_0x5d6414['params']['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x322016,null))['then'](saveUpdates(_0x5d6414[_0x1126('0x4e')],null))[_0x1126('0x2d')](respondWithResult(_0x322016,null))[_0x1126('0x4a')](handleError(_0x322016,null));};exports['destroy']=function(_0x427add,_0x2340f8){return db['ZendeskConfiguration'][_0x1126('0x4f')]({'where':{'id':_0x427add[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x2340f8,null))['then'](removeEntity(_0x2340f8,null))[_0x1126('0x4a')](handleError(_0x2340f8,null));};exports[_0x1126('0x51')]=function(_0x22ab18,_0x308ee4,_0x128c94){var _0x26949c={};var _0x30c848={};var _0x114be2;var _0x47e53d;return db[_0x1126('0x34')][_0x1126('0x52')]({'where':{'id':_0x22ab18[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x308ee4,null))[_0x1126('0x2d')](function(_0x4f5772){if(_0x4f5772){_0x114be2=_0x4f5772;_0x30c848[_0x1126('0x37')]=_[_0x1126('0x39')](db['ZendeskField'][_0x1126('0x35')]);_0x30c848['query']=_[_0x1126('0x39')](_0x22ab18[_0x1126('0x38')]);_0x30c848['filters']=_[_0x1126('0x3b')](_0x30c848[_0x1126('0x37')],_0x30c848[_0x1126('0x38')]);_0x26949c['attributes']=_[_0x1126('0x3b')](_0x30c848['model'],qs['fields'](_0x22ab18[_0x1126('0x38')][_0x1126('0x3d')]));_0x26949c[_0x1126('0x3c')]=_0x26949c[_0x1126('0x3c')][_0x1126('0x3e')]?_0x26949c[_0x1126('0x3c')]:_0x30c848[_0x1126('0x37')];_0x26949c['order']=qs[_0x1126('0x42')](_0x22ab18[_0x1126('0x38')][_0x1126('0x42')]);_0x26949c[_0x1126('0x53')]=qs[_0x1126('0x3a')](_[_0x1126('0x43')](_0x22ab18['query'],_0x30c848['filters']));if(_0x22ab18[_0x1126('0x38')][_0x1126('0x44')]){_0x26949c['where']=_['merge'](_0x26949c['where'],{'$or':_['map'](_0x26949c[_0x1126('0x3c')],function(_0x37b1ab){var _0x3440c5={};_0x3440c5[_0x37b1ab]={'$like':'%'+_0x22ab18['query'][_0x1126('0x44')]+'%'};return _0x3440c5;})});}_0x26949c=_[_0x1126('0x45')]({},_0x26949c,_0x22ab18[_0x1126('0x54')]);return _0x114be2[_0x1126('0x51')](_0x26949c);}})[_0x1126('0x2d')](function(_0x3f007b){if(_0x3f007b){_0x47e53d=_0x3f007b[_0x1126('0x3e')];if(!_0x22ab18['query'][_0x1126('0x3f')](_0x1126('0x40'))){_0x26949c[_0x1126('0x28')]=qs[_0x1126('0x28')](_0x22ab18[_0x1126('0x38')]['limit']);_0x26949c['offset']=qs[_0x1126('0x27')](_0x22ab18[_0x1126('0x38')]['offset']);}return _0x114be2[_0x1126('0x51')](_0x26949c);}})[_0x1126('0x2d')](function(_0x366675){if(_0x366675){return _0x366675?{'count':_0x47e53d,'rows':_0x366675}:null;}})[_0x1126('0x2d')](respondWithResult(_0x308ee4,null))[_0x1126('0x4a')](handleError(_0x308ee4,null));};exports[_0x1126('0x55')]=function(_0x41ce78,_0x247f12,_0xd20fbe){var _0x3d5e15={};var _0x16e48a={};var _0x1228cf;var _0x3dad39;return db['ZendeskConfiguration'][_0x1126('0x52')]({'where':{'id':_0x41ce78[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x247f12,null))['then'](function(_0x484881){if(_0x484881){_0x1228cf=_0x484881;_0x16e48a[_0x1126('0x37')]=_[_0x1126('0x39')](db[_0x1126('0x56')][_0x1126('0x35')]);_0x16e48a['query']=_['keys'](_0x41ce78['query']);_0x16e48a[_0x1126('0x3a')]=_[_0x1126('0x3b')](_0x16e48a[_0x1126('0x37')],_0x16e48a[_0x1126('0x38')]);_0x3d5e15['attributes']=_[_0x1126('0x3b')](_0x16e48a['model'],qs[_0x1126('0x3d')](_0x41ce78[_0x1126('0x38')][_0x1126('0x3d')]));_0x3d5e15[_0x1126('0x3c')]=_0x3d5e15[_0x1126('0x3c')][_0x1126('0x3e')]?_0x3d5e15[_0x1126('0x3c')]:_0x16e48a['model'];_0x3d5e15[_0x1126('0x41')]=qs['sort'](_0x41ce78[_0x1126('0x38')][_0x1126('0x42')]);_0x3d5e15['where']=qs[_0x1126('0x3a')](_[_0x1126('0x43')](_0x41ce78['query'],_0x16e48a[_0x1126('0x3a')]));if(_0x41ce78[_0x1126('0x38')]['filter']){_0x3d5e15['where']=_[_0x1126('0x45')](_0x3d5e15[_0x1126('0x53')],{'$or':_[_0x1126('0x33')](_0x3d5e15['attributes'],function(_0x4d007b){var _0x4b0fab={};_0x4b0fab[_0x4d007b]={'$like':'%'+_0x41ce78[_0x1126('0x38')]['filter']+'%'};return _0x4b0fab;})});}_0x3d5e15=_['merge']({},_0x3d5e15,_0x41ce78[_0x1126('0x54')]);return _0x1228cf['getSubjects'](_0x3d5e15);}})[_0x1126('0x2d')](function(_0x288a0c){if(_0x288a0c){_0x3dad39=_0x288a0c['length'];if(!_0x41ce78[_0x1126('0x38')][_0x1126('0x3f')](_0x1126('0x40'))){_0x3d5e15[_0x1126('0x28')]=qs[_0x1126('0x28')](_0x41ce78['query'][_0x1126('0x28')]);_0x3d5e15[_0x1126('0x27')]=qs['offset'](_0x41ce78[_0x1126('0x38')][_0x1126('0x27')]);}return _0x1228cf[_0x1126('0x55')](_0x3d5e15);}})[_0x1126('0x2d')](function(_0x2598a7){if(_0x2598a7){return _0x2598a7?{'count':_0x3dad39,'rows':_0x2598a7}:null;}})[_0x1126('0x2d')](respondWithResult(_0x247f12,null))[_0x1126('0x4a')](handleError(_0x247f12,null));};exports[_0x1126('0x57')]=function(_0xeaf964,_0x9a2af0,_0xbe2a8f){var _0x3af321={};var _0x2010a9={};var _0x3b5384;var _0x8bfa0;return db[_0x1126('0x34')]['findOne']({'where':{'id':_0xeaf964[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x9a2af0,null))[_0x1126('0x2d')](function(_0x1483f4){if(_0x1483f4){_0x3b5384=_0x1483f4;_0x2010a9[_0x1126('0x37')]=_['keys'](db[_0x1126('0x56')]['rawAttributes']);_0x2010a9['query']=_[_0x1126('0x39')](_0xeaf964[_0x1126('0x38')]);_0x2010a9['filters']=_['intersection'](_0x2010a9[_0x1126('0x37')],_0x2010a9[_0x1126('0x38')]);_0x3af321[_0x1126('0x3c')]=_[_0x1126('0x3b')](_0x2010a9[_0x1126('0x37')],qs[_0x1126('0x3d')](_0xeaf964[_0x1126('0x38')][_0x1126('0x3d')]));_0x3af321[_0x1126('0x3c')]=_0x3af321['attributes'][_0x1126('0x3e')]?_0x3af321[_0x1126('0x3c')]:_0x2010a9[_0x1126('0x37')];_0x3af321[_0x1126('0x41')]=qs[_0x1126('0x42')](_0xeaf964[_0x1126('0x38')]['sort']);_0x3af321[_0x1126('0x53')]=qs[_0x1126('0x3a')](_[_0x1126('0x43')](_0xeaf964[_0x1126('0x38')],_0x2010a9[_0x1126('0x3a')]));if(_0xeaf964[_0x1126('0x38')][_0x1126('0x44')]){_0x3af321[_0x1126('0x53')]=_[_0x1126('0x45')](_0x3af321[_0x1126('0x53')],{'$or':_['map'](_0x3af321['attributes'],function(_0x271d7c){var _0x55496f={};_0x55496f[_0x271d7c]={'$like':'%'+_0xeaf964[_0x1126('0x38')]['filter']+'%'};return _0x55496f;})});}_0x3af321=_[_0x1126('0x45')]({},_0x3af321,_0xeaf964['options']);return _0x3b5384[_0x1126('0x57')](_0x3af321);}})['then'](function(_0x5c5044){if(_0x5c5044){_0x8bfa0=_0x5c5044['length'];if(!_0xeaf964[_0x1126('0x38')][_0x1126('0x3f')]('nolimit')){_0x3af321['limit']=qs[_0x1126('0x28')](_0xeaf964[_0x1126('0x38')][_0x1126('0x28')]);_0x3af321['offset']=qs['offset'](_0xeaf964[_0x1126('0x38')]['offset']);}return _0x3b5384[_0x1126('0x57')](_0x3af321);}})[_0x1126('0x2d')](function(_0x41c7f8){if(_0x41c7f8){return _0x41c7f8?{'count':_0x8bfa0,'rows':_0x41c7f8}:null;}})[_0x1126('0x2d')](respondWithResult(_0x9a2af0,null))[_0x1126('0x4a')](handleError(_0x9a2af0,null));};exports['getTags']=function(_0x591c75,_0x5ae7ac,_0xd808db){var _0xfc9fb4={};var _0x3758fa={};var _0x1b8218;var _0x23bd79;return db[_0x1126('0x34')][_0x1126('0x52')]({'where':{'id':_0x591c75[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x5ae7ac,null))[_0x1126('0x2d')](function(_0x5119a1){if(_0x5119a1){_0x1b8218=_0x5119a1;_0x3758fa[_0x1126('0x37')]=_['keys'](db[_0x1126('0x58')]['rawAttributes']);_0x3758fa[_0x1126('0x38')]=_[_0x1126('0x39')](_0x591c75[_0x1126('0x38')]);_0x3758fa[_0x1126('0x3a')]=_['intersection'](_0x3758fa[_0x1126('0x37')],_0x3758fa[_0x1126('0x38')]);_0xfc9fb4['attributes']=_['intersection'](_0x3758fa[_0x1126('0x37')],qs[_0x1126('0x3d')](_0x591c75[_0x1126('0x38')]['fields']));_0xfc9fb4[_0x1126('0x3c')]=_0xfc9fb4['attributes'][_0x1126('0x3e')]?_0xfc9fb4[_0x1126('0x3c')]:_0x3758fa['model'];_0xfc9fb4[_0x1126('0x41')]=qs[_0x1126('0x42')](_0x591c75[_0x1126('0x38')][_0x1126('0x42')]);_0xfc9fb4[_0x1126('0x53')]=qs['filters'](_[_0x1126('0x43')](_0x591c75[_0x1126('0x38')],_0x3758fa[_0x1126('0x3a')]));if(_0x591c75['query']['filter']){_0xfc9fb4['where']=_[_0x1126('0x45')](_0xfc9fb4[_0x1126('0x53')],{'$or':_[_0x1126('0x33')](_0xfc9fb4[_0x1126('0x3c')],function(_0x4fcca3){var _0x101553={};_0x101553[_0x4fcca3]={'$like':'%'+_0x591c75[_0x1126('0x38')][_0x1126('0x44')]+'%'};return _0x101553;})});}_0xfc9fb4=_[_0x1126('0x45')]({},_0xfc9fb4,_0x591c75[_0x1126('0x54')]);return _0x1b8218['getTags'](_0xfc9fb4);}})[_0x1126('0x2d')](function(_0x21c487){if(_0x21c487){_0x23bd79=_0x21c487['length'];if(!_0x591c75[_0x1126('0x38')]['hasOwnProperty']('nolimit')){_0xfc9fb4[_0x1126('0x28')]=qs['limit'](_0x591c75[_0x1126('0x38')][_0x1126('0x28')]);_0xfc9fb4[_0x1126('0x27')]=qs[_0x1126('0x27')](_0x591c75[_0x1126('0x38')][_0x1126('0x27')]);}return _0x1b8218[_0x1126('0x59')](_0xfc9fb4);}})[_0x1126('0x2d')](function(_0x3762e0){if(_0x3762e0){return _0x3762e0?{'count':_0x23bd79,'rows':_0x3762e0}:null;}})['then'](respondWithResult(_0x5ae7ac,null))[_0x1126('0x4a')](handleError(_0x5ae7ac,null));};exports[_0x1126('0x5a')]=function(_0x1cda9d,_0x369447,_0x5a96ee){if(_0x1cda9d[_0x1126('0x4e')]['id']){delete _0x1cda9d[_0x1126('0x4e')]['id'];}return db[_0x1126('0x34')][_0x1126('0x52')]({'where':{'id':_0x1cda9d['params']['id']}})['then'](handleEntityNotFound(_0x369447,null))['then'](function(_0x3229ee){if(_0x3229ee){return _0x3229ee['setTags'](_0x1cda9d[_0x1126('0x4e')][_0x1126('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x369447,null))['catch'](handleError(_0x369447,null));}; \ No newline at end of file +var _0x1261=['update','then','destroy','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','count','includeAll','findAll','rows','catch','show','include','create','body','find','params','getFields','findOne','where','options','getSubjects','ZendeskField','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','jayson/promise','client','http','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','request\x20sent','sendStatus','status','offset','limit','set','apply','save'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1261,0x144));var _0x1126=function(_0x1193ea,_0xc04ef0){_0x1193ea=_0x1193ea-0x0;var _0x5e4000=_0x1261[_0x1193ea];return _0x5e4000;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var db=require(_0x1126('0x16'))['db'];var jayson=require(_0x1126('0x17'));var client=jayson[_0x1126('0x18')][_0x1126('0x19')]({'port':0x232a});function checkPasswordPattern(_0xca0355,_0x3f10e9,_0xd8ca42){if(_0xd8ca42){var _0x2048ad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2048ad[_0x1126('0x1a')](_0x3f10e9)){return _0xca0355;}else{throw new db['Sequelize']['ValidationError'](_0x1126('0x1b'));}}else{return _0xca0355;}}function respondWithRpcPromise(_0x154e20,_0x279455,_0x4be0c6,_0x45149c){return new BPromise(function(_0x4794a7,_0x35fe9f){var _0x42f379=_0x45149c||client;return _0x42f379[_0x1126('0x1c')](_0x154e20,_0x4be0c6)['then'](function(_0x245cd7){logger[_0x1126('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x279455,'request\x20sent');logger[_0x1126('0x1e')](_0x1126('0x1f'),_0x279455,'request\x20sent',JSON['stringify'](_0x245cd7));if(_0x245cd7[_0x1126('0x20')]){if(_0x245cd7['error'][_0x1126('0x21')]===0x1f4){logger[_0x1126('0x20')](_0x1126('0x22'),_0x279455,_0x245cd7['error'][_0x1126('0x23')]);return _0x35fe9f(_0x245cd7['error']['message']);}logger[_0x1126('0x20')](_0x1126('0x22'),_0x279455,_0x245cd7[_0x1126('0x20')][_0x1126('0x23')]);return _0x4794a7(_0x245cd7['error'][_0x1126('0x23')]);}else{logger[_0x1126('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x279455,_0x1126('0x24'));_0x4794a7(_0x245cd7['result']['message']);}})['catch'](function(_0x2199d9){logger[_0x1126('0x20')](_0x1126('0x22'),_0x279455,_0x2199d9);_0x35fe9f(_0x2199d9);});});}function respondWithStatusCode(_0x34bcf1,_0x566c09){_0x566c09=_0x566c09||0xcc;return function(_0x1b07a7){if(_0x1b07a7){return _0x34bcf1[_0x1126('0x25')](_0x566c09);}return _0x34bcf1[_0x1126('0x26')](_0x566c09)['end']();};}function respondWithResult(_0x35eec3,_0x375e59){_0x375e59=_0x375e59||0xc8;return function(_0xa293f4){if(_0xa293f4){return _0x35eec3['status'](_0x375e59)['json'](_0xa293f4);}};}function respondWithFilteredResult(_0xeb7d89,_0x39bf0e){return function(_0x55e195){if(_0x55e195){var _0x2fb797=_0x55e195['count'],_0x23d2bc=_0x39bf0e[_0x1126('0x27')],_0x4a334a=_0x39bf0e['offset']+_0x39bf0e[_0x1126('0x28')],_0x3fa694;if(_0x4a334a>=_0x2fb797){_0x4a334a=_0x2fb797;_0x3fa694=0xc8;}else{_0x3fa694=0xce;}_0xeb7d89['status'](_0x3fa694);return _0xeb7d89[_0x1126('0x29')]('Content-Range',_0x23d2bc+'-'+_0x4a334a+'/'+_0x2fb797)['json'](_0x55e195);}return null;};}function patchUpdates(_0x4a53ab){return function(_0x17646e){try{jsonpatch[_0x1126('0x2a')](_0x17646e,_0x4a53ab,!![]);}catch(_0x1cef48){return BPromise['reject'](_0x1cef48);}return _0x17646e[_0x1126('0x2b')]();};}function saveUpdates(_0x226afb,_0x56f7f8){return function(_0x3dd50e){if(_0x3dd50e){return _0x3dd50e[_0x1126('0x2c')](_0x226afb)[_0x1126('0x2d')](function(_0x29fbfa){return _0x29fbfa;});}return null;};}function removeEntity(_0x5836a2,_0x5ecbc3){return function(_0x2a7edc){if(_0x2a7edc){return _0x2a7edc[_0x1126('0x2e')]()[_0x1126('0x2d')](function(){_0x5836a2[_0x1126('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x145314,_0x6f4312){return function(_0x313ebe){if(!_0x313ebe){_0x145314[_0x1126('0x25')](0x194);}return _0x313ebe;};}function handleError(_0x3b0f79,_0x5df232){_0x5df232=_0x5df232||0x1f4;return function(_0x2a0dfe){logger[_0x1126('0x20')](_0x2a0dfe[_0x1126('0x2f')]);if(_0x2a0dfe[_0x1126('0x30')]){delete _0x2a0dfe['name'];}_0x3b0f79['status'](_0x5df232)[_0x1126('0x31')](_0x2a0dfe);};}exports[_0x1126('0x32')]=function(_0x511e6b,_0xde37cf){var _0xf3c21b={},_0x11b0f6={},_0x5c08b9={'count':0x0,'rows':[]};var _0x4b3859=_[_0x1126('0x33')](db[_0x1126('0x34')][_0x1126('0x35')],function(_0x156554){return{'name':_0x156554['fieldName'],'type':_0x156554[_0x1126('0x36')]['key']};});_0x11b0f6[_0x1126('0x37')]=_[_0x1126('0x33')](_0x4b3859,_0x1126('0x30'));_0x11b0f6[_0x1126('0x38')]=_[_0x1126('0x39')](_0x511e6b['query']);_0x11b0f6[_0x1126('0x3a')]=_[_0x1126('0x3b')](_0x11b0f6[_0x1126('0x37')],_0x11b0f6[_0x1126('0x38')]);_0xf3c21b[_0x1126('0x3c')]=_[_0x1126('0x3b')](_0x11b0f6[_0x1126('0x37')],qs['fields'](_0x511e6b[_0x1126('0x38')][_0x1126('0x3d')]));_0xf3c21b[_0x1126('0x3c')]=_0xf3c21b[_0x1126('0x3c')][_0x1126('0x3e')]?_0xf3c21b['attributes']:_0x11b0f6['model'];if(!_0x511e6b[_0x1126('0x38')][_0x1126('0x3f')](_0x1126('0x40'))){_0xf3c21b[_0x1126('0x28')]=qs[_0x1126('0x28')](_0x511e6b[_0x1126('0x38')]['limit']);_0xf3c21b['offset']=qs['offset'](_0x511e6b[_0x1126('0x38')]['offset']);}_0xf3c21b[_0x1126('0x41')]=qs[_0x1126('0x42')](_0x511e6b[_0x1126('0x38')][_0x1126('0x42')]);_0xf3c21b['where']=qs['filters'](_[_0x1126('0x43')](_0x511e6b[_0x1126('0x38')],_0x11b0f6[_0x1126('0x3a')]));if(_0x511e6b['query'][_0x1126('0x44')]){_0xf3c21b['where']=_[_0x1126('0x45')](_0xf3c21b['where'],{'$or':_[_0x1126('0x33')](_0x4b3859,function(_0xe178b4){if(_0xe178b4[_0x1126('0x36')]!=='VIRTUAL'){var _0xfaa3d8={};_0xfaa3d8[_0xe178b4[_0x1126('0x30')]]={'$like':'%'+_0x511e6b[_0x1126('0x38')]['filter']+'%'};return _0xfaa3d8;}})});}_0xf3c21b=_['merge']({},_0xf3c21b,_0x511e6b['options']);var _0x6e78cf={'where':_0xf3c21b['where']};return db[_0x1126('0x34')]['count'](_0x6e78cf)[_0x1126('0x2d')](function(_0x323499){_0x5c08b9[_0x1126('0x46')]=_0x323499;if(_0x511e6b[_0x1126('0x38')][_0x1126('0x47')]){_0xf3c21b['include']=[{'all':!![]}];}return db[_0x1126('0x34')][_0x1126('0x48')](_0xf3c21b);})['then'](function(_0x1a15f8){_0x5c08b9[_0x1126('0x49')]=_0x1a15f8;return _0x5c08b9;})['then'](respondWithFilteredResult(_0xde37cf,_0xf3c21b))[_0x1126('0x4a')](handleError(_0xde37cf,null));};exports[_0x1126('0x4b')]=function(_0x518e0a,_0x3e4eeb){var _0xbdde58={'raw':![],'where':{'id':_0x518e0a['params']['id']}},_0x213a76={};_0x213a76[_0x1126('0x37')]=_[_0x1126('0x39')](db[_0x1126('0x34')][_0x1126('0x35')]);_0x213a76[_0x1126('0x38')]=_[_0x1126('0x39')](_0x518e0a[_0x1126('0x38')]);_0x213a76[_0x1126('0x3a')]=_['intersection'](_0x213a76[_0x1126('0x37')],_0x213a76['query']);_0xbdde58[_0x1126('0x3c')]=_[_0x1126('0x3b')](_0x213a76['model'],qs['fields'](_0x518e0a[_0x1126('0x38')][_0x1126('0x3d')]));_0xbdde58[_0x1126('0x3c')]=_0xbdde58['attributes'][_0x1126('0x3e')]?_0xbdde58[_0x1126('0x3c')]:_0x213a76[_0x1126('0x37')];if(_0x518e0a[_0x1126('0x38')]['includeAll']){_0xbdde58[_0x1126('0x4c')]=[{'all':!![]}];}_0xbdde58=_[_0x1126('0x45')]({},_0xbdde58,_0x518e0a['options']);return db['ZendeskConfiguration']['find'](_0xbdde58)['then'](handleEntityNotFound(_0x3e4eeb,null))[_0x1126('0x2d')](respondWithResult(_0x3e4eeb,null))[_0x1126('0x4a')](handleError(_0x3e4eeb,null));};exports['create']=function(_0x16552b,_0x1c7a2b){return db[_0x1126('0x34')][_0x1126('0x4d')](_0x16552b[_0x1126('0x4e')],{})['then'](respondWithResult(_0x1c7a2b,0xc9))[_0x1126('0x4a')](handleError(_0x1c7a2b,null));};exports[_0x1126('0x2c')]=function(_0x5d6414,_0x322016){if(_0x5d6414[_0x1126('0x4e')]['id']){delete _0x5d6414[_0x1126('0x4e')]['id'];}return db[_0x1126('0x34')][_0x1126('0x4f')]({'where':{'id':_0x5d6414['params']['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x322016,null))['then'](saveUpdates(_0x5d6414[_0x1126('0x4e')],null))[_0x1126('0x2d')](respondWithResult(_0x322016,null))[_0x1126('0x4a')](handleError(_0x322016,null));};exports['destroy']=function(_0x427add,_0x2340f8){return db['ZendeskConfiguration'][_0x1126('0x4f')]({'where':{'id':_0x427add[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x2340f8,null))['then'](removeEntity(_0x2340f8,null))[_0x1126('0x4a')](handleError(_0x2340f8,null));};exports[_0x1126('0x51')]=function(_0x22ab18,_0x308ee4,_0x128c94){var _0x26949c={};var _0x30c848={};var _0x114be2;var _0x47e53d;return db[_0x1126('0x34')][_0x1126('0x52')]({'where':{'id':_0x22ab18[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x308ee4,null))[_0x1126('0x2d')](function(_0x4f5772){if(_0x4f5772){_0x114be2=_0x4f5772;_0x30c848[_0x1126('0x37')]=_[_0x1126('0x39')](db['ZendeskField'][_0x1126('0x35')]);_0x30c848['query']=_[_0x1126('0x39')](_0x22ab18[_0x1126('0x38')]);_0x30c848['filters']=_[_0x1126('0x3b')](_0x30c848[_0x1126('0x37')],_0x30c848[_0x1126('0x38')]);_0x26949c['attributes']=_[_0x1126('0x3b')](_0x30c848['model'],qs['fields'](_0x22ab18[_0x1126('0x38')][_0x1126('0x3d')]));_0x26949c[_0x1126('0x3c')]=_0x26949c[_0x1126('0x3c')][_0x1126('0x3e')]?_0x26949c[_0x1126('0x3c')]:_0x30c848[_0x1126('0x37')];_0x26949c['order']=qs[_0x1126('0x42')](_0x22ab18[_0x1126('0x38')][_0x1126('0x42')]);_0x26949c[_0x1126('0x53')]=qs[_0x1126('0x3a')](_[_0x1126('0x43')](_0x22ab18['query'],_0x30c848['filters']));if(_0x22ab18[_0x1126('0x38')][_0x1126('0x44')]){_0x26949c['where']=_['merge'](_0x26949c['where'],{'$or':_['map'](_0x26949c[_0x1126('0x3c')],function(_0x37b1ab){var _0x3440c5={};_0x3440c5[_0x37b1ab]={'$like':'%'+_0x22ab18['query'][_0x1126('0x44')]+'%'};return _0x3440c5;})});}_0x26949c=_[_0x1126('0x45')]({},_0x26949c,_0x22ab18[_0x1126('0x54')]);return _0x114be2[_0x1126('0x51')](_0x26949c);}})[_0x1126('0x2d')](function(_0x3f007b){if(_0x3f007b){_0x47e53d=_0x3f007b[_0x1126('0x3e')];if(!_0x22ab18['query'][_0x1126('0x3f')](_0x1126('0x40'))){_0x26949c[_0x1126('0x28')]=qs[_0x1126('0x28')](_0x22ab18[_0x1126('0x38')]['limit']);_0x26949c['offset']=qs[_0x1126('0x27')](_0x22ab18[_0x1126('0x38')]['offset']);}return _0x114be2[_0x1126('0x51')](_0x26949c);}})[_0x1126('0x2d')](function(_0x366675){if(_0x366675){return _0x366675?{'count':_0x47e53d,'rows':_0x366675}:null;}})[_0x1126('0x2d')](respondWithResult(_0x308ee4,null))[_0x1126('0x4a')](handleError(_0x308ee4,null));};exports[_0x1126('0x55')]=function(_0x41ce78,_0x247f12,_0xd20fbe){var _0x3d5e15={};var _0x16e48a={};var _0x1228cf;var _0x3dad39;return db['ZendeskConfiguration'][_0x1126('0x52')]({'where':{'id':_0x41ce78[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x247f12,null))['then'](function(_0x484881){if(_0x484881){_0x1228cf=_0x484881;_0x16e48a[_0x1126('0x37')]=_[_0x1126('0x39')](db[_0x1126('0x56')][_0x1126('0x35')]);_0x16e48a['query']=_['keys'](_0x41ce78['query']);_0x16e48a[_0x1126('0x3a')]=_[_0x1126('0x3b')](_0x16e48a[_0x1126('0x37')],_0x16e48a[_0x1126('0x38')]);_0x3d5e15['attributes']=_[_0x1126('0x3b')](_0x16e48a['model'],qs[_0x1126('0x3d')](_0x41ce78[_0x1126('0x38')][_0x1126('0x3d')]));_0x3d5e15[_0x1126('0x3c')]=_0x3d5e15[_0x1126('0x3c')][_0x1126('0x3e')]?_0x3d5e15[_0x1126('0x3c')]:_0x16e48a['model'];_0x3d5e15[_0x1126('0x41')]=qs['sort'](_0x41ce78[_0x1126('0x38')][_0x1126('0x42')]);_0x3d5e15['where']=qs[_0x1126('0x3a')](_[_0x1126('0x43')](_0x41ce78['query'],_0x16e48a[_0x1126('0x3a')]));if(_0x41ce78[_0x1126('0x38')]['filter']){_0x3d5e15['where']=_[_0x1126('0x45')](_0x3d5e15[_0x1126('0x53')],{'$or':_[_0x1126('0x33')](_0x3d5e15['attributes'],function(_0x4d007b){var _0x4b0fab={};_0x4b0fab[_0x4d007b]={'$like':'%'+_0x41ce78[_0x1126('0x38')]['filter']+'%'};return _0x4b0fab;})});}_0x3d5e15=_['merge']({},_0x3d5e15,_0x41ce78[_0x1126('0x54')]);return _0x1228cf['getSubjects'](_0x3d5e15);}})[_0x1126('0x2d')](function(_0x288a0c){if(_0x288a0c){_0x3dad39=_0x288a0c['length'];if(!_0x41ce78[_0x1126('0x38')][_0x1126('0x3f')](_0x1126('0x40'))){_0x3d5e15[_0x1126('0x28')]=qs[_0x1126('0x28')](_0x41ce78['query'][_0x1126('0x28')]);_0x3d5e15[_0x1126('0x27')]=qs['offset'](_0x41ce78[_0x1126('0x38')][_0x1126('0x27')]);}return _0x1228cf[_0x1126('0x55')](_0x3d5e15);}})[_0x1126('0x2d')](function(_0x2598a7){if(_0x2598a7){return _0x2598a7?{'count':_0x3dad39,'rows':_0x2598a7}:null;}})[_0x1126('0x2d')](respondWithResult(_0x247f12,null))[_0x1126('0x4a')](handleError(_0x247f12,null));};exports[_0x1126('0x57')]=function(_0xeaf964,_0x9a2af0,_0xbe2a8f){var _0x3af321={};var _0x2010a9={};var _0x3b5384;var _0x8bfa0;return db[_0x1126('0x34')]['findOne']({'where':{'id':_0xeaf964[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x9a2af0,null))[_0x1126('0x2d')](function(_0x1483f4){if(_0x1483f4){_0x3b5384=_0x1483f4;_0x2010a9[_0x1126('0x37')]=_['keys'](db[_0x1126('0x56')]['rawAttributes']);_0x2010a9['query']=_[_0x1126('0x39')](_0xeaf964[_0x1126('0x38')]);_0x2010a9['filters']=_['intersection'](_0x2010a9[_0x1126('0x37')],_0x2010a9[_0x1126('0x38')]);_0x3af321[_0x1126('0x3c')]=_[_0x1126('0x3b')](_0x2010a9[_0x1126('0x37')],qs[_0x1126('0x3d')](_0xeaf964[_0x1126('0x38')][_0x1126('0x3d')]));_0x3af321[_0x1126('0x3c')]=_0x3af321['attributes'][_0x1126('0x3e')]?_0x3af321[_0x1126('0x3c')]:_0x2010a9[_0x1126('0x37')];_0x3af321[_0x1126('0x41')]=qs[_0x1126('0x42')](_0xeaf964[_0x1126('0x38')]['sort']);_0x3af321[_0x1126('0x53')]=qs[_0x1126('0x3a')](_[_0x1126('0x43')](_0xeaf964[_0x1126('0x38')],_0x2010a9[_0x1126('0x3a')]));if(_0xeaf964[_0x1126('0x38')][_0x1126('0x44')]){_0x3af321[_0x1126('0x53')]=_[_0x1126('0x45')](_0x3af321[_0x1126('0x53')],{'$or':_['map'](_0x3af321['attributes'],function(_0x271d7c){var _0x55496f={};_0x55496f[_0x271d7c]={'$like':'%'+_0xeaf964[_0x1126('0x38')]['filter']+'%'};return _0x55496f;})});}_0x3af321=_[_0x1126('0x45')]({},_0x3af321,_0xeaf964['options']);return _0x3b5384[_0x1126('0x57')](_0x3af321);}})['then'](function(_0x5c5044){if(_0x5c5044){_0x8bfa0=_0x5c5044['length'];if(!_0xeaf964[_0x1126('0x38')][_0x1126('0x3f')]('nolimit')){_0x3af321['limit']=qs[_0x1126('0x28')](_0xeaf964[_0x1126('0x38')][_0x1126('0x28')]);_0x3af321['offset']=qs['offset'](_0xeaf964[_0x1126('0x38')]['offset']);}return _0x3b5384[_0x1126('0x57')](_0x3af321);}})[_0x1126('0x2d')](function(_0x41c7f8){if(_0x41c7f8){return _0x41c7f8?{'count':_0x8bfa0,'rows':_0x41c7f8}:null;}})[_0x1126('0x2d')](respondWithResult(_0x9a2af0,null))[_0x1126('0x4a')](handleError(_0x9a2af0,null));};exports['getTags']=function(_0x591c75,_0x5ae7ac,_0xd808db){var _0xfc9fb4={};var _0x3758fa={};var _0x1b8218;var _0x23bd79;return db[_0x1126('0x34')][_0x1126('0x52')]({'where':{'id':_0x591c75[_0x1126('0x50')]['id']}})[_0x1126('0x2d')](handleEntityNotFound(_0x5ae7ac,null))[_0x1126('0x2d')](function(_0x5119a1){if(_0x5119a1){_0x1b8218=_0x5119a1;_0x3758fa[_0x1126('0x37')]=_['keys'](db[_0x1126('0x58')]['rawAttributes']);_0x3758fa[_0x1126('0x38')]=_[_0x1126('0x39')](_0x591c75[_0x1126('0x38')]);_0x3758fa[_0x1126('0x3a')]=_['intersection'](_0x3758fa[_0x1126('0x37')],_0x3758fa[_0x1126('0x38')]);_0xfc9fb4['attributes']=_['intersection'](_0x3758fa[_0x1126('0x37')],qs[_0x1126('0x3d')](_0x591c75[_0x1126('0x38')]['fields']));_0xfc9fb4[_0x1126('0x3c')]=_0xfc9fb4['attributes'][_0x1126('0x3e')]?_0xfc9fb4[_0x1126('0x3c')]:_0x3758fa['model'];_0xfc9fb4[_0x1126('0x41')]=qs[_0x1126('0x42')](_0x591c75[_0x1126('0x38')][_0x1126('0x42')]);_0xfc9fb4[_0x1126('0x53')]=qs['filters'](_[_0x1126('0x43')](_0x591c75[_0x1126('0x38')],_0x3758fa[_0x1126('0x3a')]));if(_0x591c75['query']['filter']){_0xfc9fb4['where']=_[_0x1126('0x45')](_0xfc9fb4[_0x1126('0x53')],{'$or':_[_0x1126('0x33')](_0xfc9fb4[_0x1126('0x3c')],function(_0x4fcca3){var _0x101553={};_0x101553[_0x4fcca3]={'$like':'%'+_0x591c75[_0x1126('0x38')][_0x1126('0x44')]+'%'};return _0x101553;})});}_0xfc9fb4=_[_0x1126('0x45')]({},_0xfc9fb4,_0x591c75[_0x1126('0x54')]);return _0x1b8218['getTags'](_0xfc9fb4);}})[_0x1126('0x2d')](function(_0x21c487){if(_0x21c487){_0x23bd79=_0x21c487['length'];if(!_0x591c75[_0x1126('0x38')]['hasOwnProperty']('nolimit')){_0xfc9fb4[_0x1126('0x28')]=qs['limit'](_0x591c75[_0x1126('0x38')][_0x1126('0x28')]);_0xfc9fb4[_0x1126('0x27')]=qs[_0x1126('0x27')](_0x591c75[_0x1126('0x38')][_0x1126('0x27')]);}return _0x1b8218[_0x1126('0x59')](_0xfc9fb4);}})[_0x1126('0x2d')](function(_0x3762e0){if(_0x3762e0){return _0x3762e0?{'count':_0x23bd79,'rows':_0x3762e0}:null;}})['then'](respondWithResult(_0x5ae7ac,null))[_0x1126('0x4a')](handleError(_0x5ae7ac,null));};exports[_0x1126('0x5a')]=function(_0x1cda9d,_0x369447,_0x5a96ee){if(_0x1cda9d[_0x1126('0x4e')]['id']){delete _0x1cda9d[_0x1126('0x4e')]['id'];}return db[_0x1126('0x34')][_0x1126('0x52')]({'where':{'id':_0x1cda9d['params']['id']}})['then'](handleEntityNotFound(_0x369447,null))['then'](function(_0x3229ee){if(_0x3229ee){return _0x3229ee['setTags'](_0x1cda9d[_0x1126('0x4e')][_0x1126('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x369447,null))['catch'](handleError(_0x369447,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 2936e0a..49e5731 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 _0x24df=['api','moment','bluebird','path','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','lodash','util','../../config/logger'];(function(_0x3fdce3,_0x36312e){var _0x3d5c99=function(_0x11bd94){while(--_0x11bd94){_0x3fdce3['push'](_0x3fdce3['shift']());}};_0x3d5c99(++_0x36312e);}(_0x24df,0x189));var _0xf24d=function(_0x25909b,_0x24d88b){_0x25909b=_0x25909b-0x0;var _0x5669c5=_0x24df[_0x25909b];return _0x5669c5;};'use strict';var _=require(_0xf24d('0x0'));var util=require(_0xf24d('0x1'));var logger=require(_0xf24d('0x2'))(_0xf24d('0x3'));var moment=require(_0xf24d('0x4'));var BPromise=require(_0xf24d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf24d('0x6'));var rimraf=require('rimraf');var config=require(_0xf24d('0x7'));var attributes=require(_0xf24d('0x8'));module[_0xf24d('0x9')]=function(_0x34f1bb,_0x252ff6){return _0x34f1bb['define'](_0xf24d('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8e2=['util','api','bluebird','request-promise','rimraf','./intZendeskConfiguration.attributes','exports','define','int_zendesk_configurations','lodash'];(function(_0x563194,_0x461e6c){var _0x277d3a=function(_0x5baac1){while(--_0x5baac1){_0x563194['push'](_0x563194['shift']());}};_0x277d3a(++_0x461e6c);}(_0xe8e2,0xbd));var _0x2e8e=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xe8e2[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0x2e8e('0x0'));var util=require(_0x2e8e('0x1'));var logger=require('../../config/logger')(_0x2e8e('0x2'));var moment=require('moment');var BPromise=require(_0x2e8e('0x3'));var rp=require(_0x2e8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2e8e('0x5'));var config=require('../../config/environment');var attributes=require(_0x2e8e('0x6'));module[_0x2e8e('0x7')]=function(_0x4e2dca,_0x4c29f1){return _0x4e2dca[_0x2e8e('0x8')]('ZendeskConfiguration',attributes,{'tableName':_0x2e8e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 1787ae0..df36f11 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 _0x255c=['request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x59aeb3,_0x32f513){var _0x3c6521=function(_0x1129b2){while(--_0x1129b2){_0x59aeb3['push'](_0x59aeb3['shift']());}};_0x3c6521(++_0x32f513);}(_0x255c,0xfd));var _0xc255=function(_0x310fc1,_0x32d346){_0x310fc1=_0x310fc1-0x0;var _0x3d1e75=_0x255c[_0x310fc1];return _0x3d1e75;};'use strict';var _=require(_0xc255('0x0'));var util=require(_0xc255('0x1'));var moment=require(_0xc255('0x2'));var BPromise=require(_0xc255('0x3'));var rs=require(_0xc255('0x4'));var fs=require('fs');var Redis=require(_0xc255('0x5'));var db=require(_0xc255('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc255('0x7'))(_0xc255('0x8'));var config=require('../../config/environment');var jayson=require(_0xc255('0x9'));var client=jayson['client'][_0xc255('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21c57d,_0x57a425,_0x53ede8){return new BPromise(function(_0x5cb5ff,_0x50a675){return client[_0xc255('0xb')](_0x21c57d,_0x53ede8)[_0xc255('0xc')](function(_0x5b0018){logger[_0xc255('0xd')](_0xc255('0xe'),_0x57a425,_0xc255('0xf'));logger['debug'](_0xc255('0x10'),_0x57a425,_0xc255('0xf'),JSON[_0xc255('0x11')](_0x5b0018));if(_0x5b0018[_0xc255('0x12')]){if(_0x5b0018['error']['code']===0x1f4){logger[_0xc255('0x12')](_0xc255('0xe'),_0x57a425,_0x5b0018['error']['message']);return _0x50a675(_0x5b0018['error'][_0xc255('0x13')]);}logger[_0xc255('0x12')](_0xc255('0xe'),_0x57a425,_0x5b0018[_0xc255('0x12')][_0xc255('0x13')]);return _0x5cb5ff(_0x5b0018[_0xc255('0x12')]['message']);}else{logger['info'](_0xc255('0xe'),_0x57a425,_0xc255('0xf'));_0x5cb5ff(_0x5b0018[_0xc255('0x14')][_0xc255('0x13')]);}})[_0xc255('0x15')](function(_0x171e8d){logger[_0xc255('0x12')](_0xc255('0xe'),_0x57a425,_0x171e8d);_0x50a675(_0x171e8d);});});} \ No newline at end of file +var _0x69d6=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','randomstring','../../mysqldb'];(function(_0x6c6d75,_0xef7deb){var _0x48a161=function(_0xf0fba0){while(--_0xf0fba0){_0x6c6d75['push'](_0x6c6d75['shift']());}};_0x48a161(++_0xef7deb);}(_0x69d6,0x75));var _0x669d=function(_0x12ef39,_0x18d320){_0x12ef39=_0x12ef39-0x0;var _0x47a734=_0x69d6[_0x12ef39];return _0x47a734;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x669d('0x0'));var BPromise=require('bluebird');var rs=require(_0x669d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x669d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x669d('0x3'))(_0x669d('0x4'));var config=require(_0x669d('0x5'));var jayson=require(_0x669d('0x6'));var client=jayson[_0x669d('0x7')][_0x669d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e5ea7,_0x29afae,_0x4d1852){return new BPromise(function(_0x30d0f2,_0x464034){return client[_0x669d('0x9')](_0x1e5ea7,_0x4d1852)['then'](function(_0x511b7d){logger['info'](_0x669d('0xa'),_0x29afae,_0x669d('0xb'));logger[_0x669d('0xc')](_0x669d('0xd'),_0x29afae,_0x669d('0xb'),JSON[_0x669d('0xe')](_0x511b7d));if(_0x511b7d[_0x669d('0xf')]){if(_0x511b7d[_0x669d('0xf')]['code']===0x1f4){logger['error'](_0x669d('0xa'),_0x29afae,_0x511b7d[_0x669d('0xf')][_0x669d('0x10')]);return _0x464034(_0x511b7d[_0x669d('0xf')][_0x669d('0x10')]);}logger[_0x669d('0xf')](_0x669d('0xa'),_0x29afae,_0x511b7d['error'][_0x669d('0x10')]);return _0x30d0f2(_0x511b7d[_0x669d('0xf')][_0x669d('0x10')]);}else{logger[_0x669d('0x11')](_0x669d('0xa'),_0x29afae,_0x669d('0xb'));_0x30d0f2(_0x511b7d[_0x669d('0x12')][_0x669d('0x10')]);}})[_0x669d('0x13')](function(_0x3cd9a7){logger[_0x669d('0xf')]('ZendeskConfiguration,\x20%s,\x20%s',_0x29afae,_0x3cd9a7);_0x464034(_0x3cd9a7);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 4029580..32f5c3c 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 _0xb806=['connect-timeout','express','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0xb806,0x95));var _0x6b80=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0xb806[_0x5a9c0c];return _0x53c77d;};'use strict';var multer=require(_0x6b80('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b80('0x1'));var express=require(_0x6b80('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6b80('0x3'));var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router[_0x6b80('0x4')]('/',auth[_0x6b80('0x5')](),controller[_0x6b80('0x6')]);router['get'](_0x6b80('0x7'),auth[_0x6b80('0x5')](),controller[_0x6b80('0x8')]);router['post']('/',auth[_0x6b80('0x5')](),controller[_0x6b80('0x9')]);router[_0x6b80('0xa')](_0x6b80('0x7'),auth[_0x6b80('0x5')](),controller[_0x6b80('0xb')]);router[_0x6b80('0xc')](_0x6b80('0x7'),auth[_0x6b80('0x5')](),controller[_0x6b80('0xd')]);module[_0x6b80('0xe')]=router; \ No newline at end of file +var _0x10c4=['update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x29c081,_0x4b190f){var _0x264f8b=function(_0x1eae03){while(--_0x1eae03){_0x29c081['push'](_0x29c081['shift']());}};_0x264f8b(++_0x4b190f);}(_0x10c4,0x16b));var _0x410c=function(_0x54b7e6,_0x436ba5){_0x54b7e6=_0x54b7e6-0x0;var _0x1ea107=_0x10c4[_0x54b7e6];return _0x1ea107;};'use strict';var multer=require(_0x410c('0x0'));var util=require('util');var path=require(_0x410c('0x1'));var timeout=require(_0x410c('0x2'));var express=require(_0x410c('0x3'));var router=express[_0x410c('0x4')]();var auth=require(_0x410c('0x5'));var interaction=require(_0x410c('0x6'));var config=require('../../config/environment');var controller=require(_0x410c('0x7'));router[_0x410c('0x8')]('/',auth[_0x410c('0x9')](),controller[_0x410c('0xa')]);router[_0x410c('0x8')](_0x410c('0xb'),auth[_0x410c('0x9')](),controller[_0x410c('0xc')]);router['post']('/',auth[_0x410c('0x9')](),controller[_0x410c('0xd')]);router[_0x410c('0xe')](_0x410c('0xb'),auth[_0x410c('0x9')](),controller[_0x410c('0xf')]);router[_0x410c('0x10')](_0x410c('0xb'),auth[_0x410c('0x9')](),controller[_0x410c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 9e433f7..050dbc0 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 _0x15a9=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15a9,0x18a));var _0x915a=function(_0x3c81c0,_0x43ba7d){_0x3c81c0=_0x3c81c0-0x0;var _0x385f94=_0x15a9[_0x3c81c0];return _0x385f94;};'use strict';var Sequelize=require(_0x915a('0x0'));module[_0x915a('0x1')]={'type':{'type':Sequelize[_0x915a('0x2')](_0x915a('0x3'),'variable',_0x915a('0x4'),_0x915a('0x5')),'defaultValue':_0x915a('0x3')},'content':{'type':Sequelize[_0x915a('0x6')]},'key':{'type':Sequelize[_0x915a('0x6')]},'keyType':{'type':Sequelize[_0x915a('0x2')](_0x915a('0x3'),_0x915a('0x7'),_0x915a('0x4'))},'keyContent':{'type':Sequelize[_0x915a('0x6')]},'idField':{'type':Sequelize[_0x915a('0x6')]},'nameField':{'type':Sequelize[_0x915a('0x6')]},'customField':{'type':Sequelize[_0x915a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8ce1=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x530bba,_0x5cd025){var _0x29c6db=function(_0x101796){while(--_0x101796){_0x530bba['push'](_0x530bba['shift']());}};_0x29c6db(++_0x5cd025);}(_0x8ce1,0x183));var _0x18ce=function(_0x38fcb5,_0x55b868){_0x38fcb5=_0x38fcb5-0x0;var _0x1e478c=_0x8ce1[_0x38fcb5];return _0x1e478c;};'use strict';var Sequelize=require(_0x18ce('0x0'));module[_0x18ce('0x1')]={'type':{'type':Sequelize[_0x18ce('0x2')](_0x18ce('0x3'),_0x18ce('0x4'),_0x18ce('0x5'),_0x18ce('0x6')),'defaultValue':_0x18ce('0x3')},'content':{'type':Sequelize[_0x18ce('0x7')]},'key':{'type':Sequelize[_0x18ce('0x7')]},'keyType':{'type':Sequelize[_0x18ce('0x2')](_0x18ce('0x3'),_0x18ce('0x4'),_0x18ce('0x5'))},'keyContent':{'type':Sequelize[_0x18ce('0x7')]},'idField':{'type':Sequelize[_0x18ce('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x18ce('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x18ce('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 2d5ff1f..7b19e2c 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 _0xdc33=['type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','find','catch','create','body','params','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../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','error','stack','name','send','map','ZendeskField','rawAttributes','fieldName'];(function(_0x149a11,_0x768ad9){var _0x162487=function(_0x5b726b){while(--_0x5b726b){_0x149a11['push'](_0x149a11['shift']());}};_0x162487(++_0x768ad9);}(_0xdc33,0x66));var _0x3dc3=function(_0x148c56,_0x431219){_0x148c56=_0x148c56-0x0;var _0x47b9d5=_0xdc33[_0x148c56];return _0x47b9d5;};'use strict';var pdf=require(_0x3dc3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3dc3('0x1'));var zipdir=require(_0x3dc3('0x2'));var jsonpatch=require(_0x3dc3('0x3'));var rp=require(_0x3dc3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3dc3('0x5'));var util=require(_0x3dc3('0x6'));var path=require(_0x3dc3('0x7'));var sox=require(_0x3dc3('0x8'));var csv=require('to-csv');var ejs=require(_0x3dc3('0x9'));var fs=require('fs');var _=require(_0x3dc3('0xa'));var squel=require(_0x3dc3('0xb'));var crypto=require(_0x3dc3('0xc'));var jsforce=require(_0x3dc3('0xd'));var deskjs=require(_0x3dc3('0xe'));var toCsv=require(_0x3dc3('0xf'));var querystring=require(_0x3dc3('0x10'));var Papa=require(_0x3dc3('0x11'));var Redis=require(_0x3dc3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3dc3('0x13'));var as=require(_0x3dc3('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3dc3('0x15'))(_0x3dc3('0x16'));var utils=require(_0x3dc3('0x17'));var config=require(_0x3dc3('0x18'));var db=require(_0x3dc3('0x19'))['db'];function respondWithStatusCode(_0x20152f,_0x641d36){_0x641d36=_0x641d36||0xcc;return function(_0x1663f1){if(_0x1663f1){return _0x20152f['sendStatus'](_0x641d36);}return _0x20152f[_0x3dc3('0x1a')](_0x641d36)[_0x3dc3('0x1b')]();};}function respondWithResult(_0x5264ce,_0x19d266){_0x19d266=_0x19d266||0xc8;return function(_0x3b70fb){if(_0x3b70fb){return _0x5264ce[_0x3dc3('0x1a')](_0x19d266)[_0x3dc3('0x1c')](_0x3b70fb);}};}function respondWithFilteredResult(_0x3dea1d,_0x52b143){return function(_0x4d8452){if(_0x4d8452){var _0x3995f8=_0x4d8452[_0x3dc3('0x1d')],_0x5292b7=_0x52b143[_0x3dc3('0x1e')],_0x3d5d96=_0x52b143['offset']+_0x52b143[_0x3dc3('0x1f')],_0x1500f4;if(_0x3d5d96>=_0x3995f8){_0x3d5d96=_0x3995f8;_0x1500f4=0xc8;}else{_0x1500f4=0xce;}_0x3dea1d[_0x3dc3('0x1a')](_0x1500f4);return _0x3dea1d[_0x3dc3('0x20')]('Content-Range',_0x5292b7+'-'+_0x3d5d96+'/'+_0x3995f8)['json'](_0x4d8452);}return null;};}function patchUpdates(_0x29f68e){return function(_0x49aeeb){try{jsonpatch[_0x3dc3('0x21')](_0x49aeeb,_0x29f68e,!![]);}catch(_0x29e047){return BPromise[_0x3dc3('0x22')](_0x29e047);}return _0x49aeeb[_0x3dc3('0x23')]();};}function saveUpdates(_0x2e1992,_0xfa826b){return function(_0x1cffa8){if(_0x1cffa8){return _0x1cffa8[_0x3dc3('0x24')](_0x2e1992)['then'](function(_0x26a2a6){return _0x26a2a6;});}return null;};}function removeEntity(_0x1cff6d,_0x57babe){return function(_0x8ab8d4){if(_0x8ab8d4){return _0x8ab8d4['destroy']()[_0x3dc3('0x25')](function(){_0x1cff6d[_0x3dc3('0x1a')](0xcc)[_0x3dc3('0x1b')]();});}};}function handleEntityNotFound(_0x1cd0ad,_0x4a0b84){return function(_0x1096c0){if(!_0x1096c0){_0x1cd0ad['sendStatus'](0x194);}return _0x1096c0;};}function handleError(_0x402338,_0x4825fb){_0x4825fb=_0x4825fb||0x1f4;return function(_0x557f89){logger[_0x3dc3('0x26')](_0x557f89[_0x3dc3('0x27')]);if(_0x557f89[_0x3dc3('0x28')]){delete _0x557f89[_0x3dc3('0x28')];}_0x402338['status'](_0x4825fb)[_0x3dc3('0x29')](_0x557f89);};}exports['index']=function(_0x4af31b,_0x4a70fc){var _0xbe713c={},_0x29a7d7={},_0x23f395={'count':0x0,'rows':[]};var _0x54f4f8=_[_0x3dc3('0x2a')](db[_0x3dc3('0x2b')][_0x3dc3('0x2c')],function(_0x367723){return{'name':_0x367723[_0x3dc3('0x2d')],'type':_0x367723[_0x3dc3('0x2e')][_0x3dc3('0x2f')]};});_0x29a7d7['model']=_[_0x3dc3('0x2a')](_0x54f4f8,_0x3dc3('0x28'));_0x29a7d7[_0x3dc3('0x30')]=_[_0x3dc3('0x31')](_0x4af31b[_0x3dc3('0x30')]);_0x29a7d7['filters']=_[_0x3dc3('0x32')](_0x29a7d7[_0x3dc3('0x33')],_0x29a7d7[_0x3dc3('0x30')]);_0xbe713c[_0x3dc3('0x34')]=_[_0x3dc3('0x32')](_0x29a7d7[_0x3dc3('0x33')],qs[_0x3dc3('0x35')](_0x4af31b[_0x3dc3('0x30')]['fields']));_0xbe713c[_0x3dc3('0x34')]=_0xbe713c[_0x3dc3('0x34')][_0x3dc3('0x36')]?_0xbe713c[_0x3dc3('0x34')]:_0x29a7d7[_0x3dc3('0x33')];if(!_0x4af31b['query']['hasOwnProperty'](_0x3dc3('0x37'))){_0xbe713c[_0x3dc3('0x1f')]=qs[_0x3dc3('0x1f')](_0x4af31b['query']['limit']);_0xbe713c[_0x3dc3('0x1e')]=qs[_0x3dc3('0x1e')](_0x4af31b['query']['offset']);}_0xbe713c[_0x3dc3('0x38')]=qs[_0x3dc3('0x39')](_0x4af31b[_0x3dc3('0x30')]['sort']);_0xbe713c[_0x3dc3('0x3a')]=qs[_0x3dc3('0x3b')](_['pick'](_0x4af31b[_0x3dc3('0x30')],_0x29a7d7[_0x3dc3('0x3b')]));if(_0x4af31b[_0x3dc3('0x30')][_0x3dc3('0x3c')]){_0xbe713c[_0x3dc3('0x3a')]=_[_0x3dc3('0x3d')](_0xbe713c['where'],{'$or':_[_0x3dc3('0x2a')](_0x54f4f8,function(_0x101019){if(_0x101019[_0x3dc3('0x2e')]!==_0x3dc3('0x3e')){var _0x2c339e={};_0x2c339e[_0x101019[_0x3dc3('0x28')]]={'$like':'%'+_0x4af31b['query'][_0x3dc3('0x3c')]+'%'};return _0x2c339e;}})});}_0xbe713c=_[_0x3dc3('0x3d')]({},_0xbe713c,_0x4af31b[_0x3dc3('0x3f')]);var _0x241d5c={'where':_0xbe713c[_0x3dc3('0x3a')]};return db[_0x3dc3('0x2b')][_0x3dc3('0x1d')](_0x241d5c)[_0x3dc3('0x25')](function(_0x54384f){_0x23f395[_0x3dc3('0x1d')]=_0x54384f;if(_0x4af31b[_0x3dc3('0x30')][_0x3dc3('0x40')]){_0xbe713c[_0x3dc3('0x41')]=[{'all':!![]}];}return db[_0x3dc3('0x2b')][_0x3dc3('0x42')](_0xbe713c);})[_0x3dc3('0x25')](function(_0x905550){_0x23f395['rows']=_0x905550;return _0x23f395;})[_0x3dc3('0x25')](respondWithFilteredResult(_0x4a70fc,_0xbe713c))['catch'](handleError(_0x4a70fc,null));};exports[_0x3dc3('0x43')]=function(_0x1a070c,_0x3ff551){var _0xd7bdac={'raw':!![],'where':{'id':_0x1a070c['params']['id']}},_0x23cc6a={};_0x23cc6a[_0x3dc3('0x33')]=_[_0x3dc3('0x31')](db[_0x3dc3('0x2b')]['rawAttributes']);_0x23cc6a[_0x3dc3('0x30')]=_[_0x3dc3('0x31')](_0x1a070c[_0x3dc3('0x30')]);_0x23cc6a[_0x3dc3('0x3b')]=_[_0x3dc3('0x32')](_0x23cc6a[_0x3dc3('0x33')],_0x23cc6a[_0x3dc3('0x30')]);_0xd7bdac['attributes']=_[_0x3dc3('0x32')](_0x23cc6a['model'],qs['fields'](_0x1a070c[_0x3dc3('0x30')]['fields']));_0xd7bdac[_0x3dc3('0x34')]=_0xd7bdac[_0x3dc3('0x34')][_0x3dc3('0x36')]?_0xd7bdac[_0x3dc3('0x34')]:_0x23cc6a[_0x3dc3('0x33')];if(_0x1a070c[_0x3dc3('0x30')][_0x3dc3('0x40')]){_0xd7bdac[_0x3dc3('0x41')]=[{'all':!![]}];}_0xd7bdac=_[_0x3dc3('0x3d')]({},_0xd7bdac,_0x1a070c['options']);return db[_0x3dc3('0x2b')][_0x3dc3('0x44')](_0xd7bdac)[_0x3dc3('0x25')](handleEntityNotFound(_0x3ff551,null))[_0x3dc3('0x25')](respondWithResult(_0x3ff551,null))[_0x3dc3('0x45')](handleError(_0x3ff551,null));};exports[_0x3dc3('0x46')]=function(_0xfd3a12,_0x4b9e63){return db[_0x3dc3('0x2b')][_0x3dc3('0x46')](_0xfd3a12['body'],{})[_0x3dc3('0x25')](respondWithResult(_0x4b9e63,0xc9))[_0x3dc3('0x45')](handleError(_0x4b9e63,null));};exports[_0x3dc3('0x24')]=function(_0x36de38,_0x44f3a3){if(_0x36de38[_0x3dc3('0x47')]['id']){delete _0x36de38[_0x3dc3('0x47')]['id'];}return db[_0x3dc3('0x2b')][_0x3dc3('0x44')]({'where':{'id':_0x36de38[_0x3dc3('0x48')]['id']}})[_0x3dc3('0x25')](handleEntityNotFound(_0x44f3a3,null))['then'](saveUpdates(_0x36de38[_0x3dc3('0x47')],null))[_0x3dc3('0x25')](respondWithResult(_0x44f3a3,null))['catch'](handleError(_0x44f3a3,null));};exports[_0x3dc3('0x49')]=function(_0x21d9f9,_0x165ea7){return db['ZendeskField']['find']({'where':{'id':_0x21d9f9['params']['id']}})['then'](handleEntityNotFound(_0x165ea7,null))[_0x3dc3('0x25')](removeEntity(_0x165ea7,null))[_0x3dc3('0x45')](handleError(_0x165ea7,null));}; \ No newline at end of file +var _0x9ad0=['length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','map','ZendeskField','rawAttributes','model','query','keys','filters','intersection','attributes','fields'];(function(_0x42508b,_0x693bd2){var _0x4739b6=function(_0x4cca9a){while(--_0x4cca9a){_0x42508b['push'](_0x42508b['shift']());}};_0x4739b6(++_0x693bd2);}(_0x9ad0,0xa8));var _0x09ad=function(_0x4bd9a9,_0x2fd838){_0x4bd9a9=_0x4bd9a9-0x0;var _0x2ee105=_0x9ad0[_0x4bd9a9];return _0x2ee105;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x09ad('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09ad('0x1'));var rp=require(_0x09ad('0x2'));var moment=require('moment');var BPromise=require(_0x09ad('0x3'));var Mustache=require(_0x09ad('0x4'));var util=require(_0x09ad('0x5'));var path=require(_0x09ad('0x6'));var sox=require(_0x09ad('0x7'));var csv=require(_0x09ad('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x09ad('0x9'));var crypto=require(_0x09ad('0xa'));var jsforce=require(_0x09ad('0xb'));var deskjs=require(_0x09ad('0xc'));var toCsv=require('to-csv');var querystring=require(_0x09ad('0xd'));var Papa=require(_0x09ad('0xe'));var Redis=require(_0x09ad('0xf'));var authService=require(_0x09ad('0x10'));var qs=require(_0x09ad('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09ad('0x12'));var logger=require(_0x09ad('0x13'))(_0x09ad('0x14'));var utils=require(_0x09ad('0x15'));var config=require(_0x09ad('0x16'));var db=require(_0x09ad('0x17'))['db'];function respondWithStatusCode(_0x5c7b27,_0x1b6df6){_0x1b6df6=_0x1b6df6||0xcc;return function(_0x5b377d){if(_0x5b377d){return _0x5c7b27[_0x09ad('0x18')](_0x1b6df6);}return _0x5c7b27[_0x09ad('0x19')](_0x1b6df6)[_0x09ad('0x1a')]();};}function respondWithResult(_0x3c7397,_0x5be2ca){_0x5be2ca=_0x5be2ca||0xc8;return function(_0x1608e5){if(_0x1608e5){return _0x3c7397[_0x09ad('0x19')](_0x5be2ca)['json'](_0x1608e5);}};}function respondWithFilteredResult(_0x535c1a,_0xb9b0e6){return function(_0x20cc6c){if(_0x20cc6c){var _0x4d17c5=_0x20cc6c[_0x09ad('0x1b')],_0x296395=_0xb9b0e6[_0x09ad('0x1c')],_0x18d551=_0xb9b0e6[_0x09ad('0x1c')]+_0xb9b0e6[_0x09ad('0x1d')],_0x1c405c;if(_0x18d551>=_0x4d17c5){_0x18d551=_0x4d17c5;_0x1c405c=0xc8;}else{_0x1c405c=0xce;}_0x535c1a[_0x09ad('0x19')](_0x1c405c);return _0x535c1a[_0x09ad('0x1e')](_0x09ad('0x1f'),_0x296395+'-'+_0x18d551+'/'+_0x4d17c5)[_0x09ad('0x20')](_0x20cc6c);}return null;};}function patchUpdates(_0x494098){return function(_0x5395d9){try{jsonpatch[_0x09ad('0x21')](_0x5395d9,_0x494098,!![]);}catch(_0xacb9b9){return BPromise[_0x09ad('0x22')](_0xacb9b9);}return _0x5395d9[_0x09ad('0x23')]();};}function saveUpdates(_0x47d403,_0xe380bf){return function(_0x2ca746){if(_0x2ca746){return _0x2ca746['update'](_0x47d403)[_0x09ad('0x24')](function(_0xcd774c){return _0xcd774c;});}return null;};}function removeEntity(_0x3f35d9,_0x3acaa5){return function(_0x353397){if(_0x353397){return _0x353397[_0x09ad('0x25')]()[_0x09ad('0x24')](function(){_0x3f35d9[_0x09ad('0x19')](0xcc)[_0x09ad('0x1a')]();});}};}function handleEntityNotFound(_0x1dcf20,_0x39f33d){return function(_0x2bb1f9){if(!_0x2bb1f9){_0x1dcf20[_0x09ad('0x18')](0x194);}return _0x2bb1f9;};}function handleError(_0x5e5098,_0x9323e){_0x9323e=_0x9323e||0x1f4;return function(_0x100455){logger['error'](_0x100455[_0x09ad('0x26')]);if(_0x100455['name']){delete _0x100455[_0x09ad('0x27')];}_0x5e5098[_0x09ad('0x19')](_0x9323e)[_0x09ad('0x28')](_0x100455);};}exports['index']=function(_0x28a32f,_0x4000b5){var _0x3968bf={},_0x51921b={},_0x359643={'count':0x0,'rows':[]};var _0x2a6aa4=_[_0x09ad('0x29')](db[_0x09ad('0x2a')][_0x09ad('0x2b')],function(_0x507708){return{'name':_0x507708['fieldName'],'type':_0x507708['type']['key']};});_0x51921b[_0x09ad('0x2c')]=_['map'](_0x2a6aa4,_0x09ad('0x27'));_0x51921b[_0x09ad('0x2d')]=_[_0x09ad('0x2e')](_0x28a32f[_0x09ad('0x2d')]);_0x51921b[_0x09ad('0x2f')]=_[_0x09ad('0x30')](_0x51921b[_0x09ad('0x2c')],_0x51921b[_0x09ad('0x2d')]);_0x3968bf[_0x09ad('0x31')]=_['intersection'](_0x51921b[_0x09ad('0x2c')],qs[_0x09ad('0x32')](_0x28a32f['query'][_0x09ad('0x32')]));_0x3968bf[_0x09ad('0x31')]=_0x3968bf[_0x09ad('0x31')][_0x09ad('0x33')]?_0x3968bf['attributes']:_0x51921b['model'];if(!_0x28a32f[_0x09ad('0x2d')][_0x09ad('0x34')](_0x09ad('0x35'))){_0x3968bf['limit']=qs['limit'](_0x28a32f[_0x09ad('0x2d')][_0x09ad('0x1d')]);_0x3968bf[_0x09ad('0x1c')]=qs['offset'](_0x28a32f[_0x09ad('0x2d')][_0x09ad('0x1c')]);}_0x3968bf[_0x09ad('0x36')]=qs[_0x09ad('0x37')](_0x28a32f[_0x09ad('0x2d')][_0x09ad('0x37')]);_0x3968bf['where']=qs[_0x09ad('0x2f')](_[_0x09ad('0x38')](_0x28a32f['query'],_0x51921b[_0x09ad('0x2f')]));if(_0x28a32f[_0x09ad('0x2d')][_0x09ad('0x39')]){_0x3968bf[_0x09ad('0x3a')]=_[_0x09ad('0x3b')](_0x3968bf[_0x09ad('0x3a')],{'$or':_['map'](_0x2a6aa4,function(_0x4cc4f6){if(_0x4cc4f6[_0x09ad('0x3c')]!==_0x09ad('0x3d')){var _0xc1c16f={};_0xc1c16f[_0x4cc4f6[_0x09ad('0x27')]]={'$like':'%'+_0x28a32f[_0x09ad('0x2d')]['filter']+'%'};return _0xc1c16f;}})});}_0x3968bf=_['merge']({},_0x3968bf,_0x28a32f[_0x09ad('0x3e')]);var _0x195e63={'where':_0x3968bf[_0x09ad('0x3a')]};return db['ZendeskField']['count'](_0x195e63)['then'](function(_0x41a199){_0x359643[_0x09ad('0x1b')]=_0x41a199;if(_0x28a32f['query'][_0x09ad('0x3f')]){_0x3968bf[_0x09ad('0x40')]=[{'all':!![]}];}return db['ZendeskField'][_0x09ad('0x41')](_0x3968bf);})[_0x09ad('0x24')](function(_0x237b46){_0x359643[_0x09ad('0x42')]=_0x237b46;return _0x359643;})[_0x09ad('0x24')](respondWithFilteredResult(_0x4000b5,_0x3968bf))[_0x09ad('0x43')](handleError(_0x4000b5,null));};exports[_0x09ad('0x44')]=function(_0x124897,_0x42977d){var _0x2c61b9={'raw':!![],'where':{'id':_0x124897[_0x09ad('0x45')]['id']}},_0xe7c6e={};_0xe7c6e[_0x09ad('0x2c')]=_[_0x09ad('0x2e')](db[_0x09ad('0x2a')][_0x09ad('0x2b')]);_0xe7c6e['query']=_[_0x09ad('0x2e')](_0x124897[_0x09ad('0x2d')]);_0xe7c6e[_0x09ad('0x2f')]=_[_0x09ad('0x30')](_0xe7c6e[_0x09ad('0x2c')],_0xe7c6e['query']);_0x2c61b9[_0x09ad('0x31')]=_['intersection'](_0xe7c6e[_0x09ad('0x2c')],qs['fields'](_0x124897[_0x09ad('0x2d')]['fields']));_0x2c61b9[_0x09ad('0x31')]=_0x2c61b9[_0x09ad('0x31')]['length']?_0x2c61b9['attributes']:_0xe7c6e[_0x09ad('0x2c')];if(_0x124897[_0x09ad('0x2d')][_0x09ad('0x3f')]){_0x2c61b9['include']=[{'all':!![]}];}_0x2c61b9=_[_0x09ad('0x3b')]({},_0x2c61b9,_0x124897[_0x09ad('0x3e')]);return db[_0x09ad('0x2a')][_0x09ad('0x46')](_0x2c61b9)[_0x09ad('0x24')](handleEntityNotFound(_0x42977d,null))[_0x09ad('0x24')](respondWithResult(_0x42977d,null))[_0x09ad('0x43')](handleError(_0x42977d,null));};exports['create']=function(_0x571d83,_0x34490a){return db[_0x09ad('0x2a')]['create'](_0x571d83['body'],{})[_0x09ad('0x24')](respondWithResult(_0x34490a,0xc9))['catch'](handleError(_0x34490a,null));};exports[_0x09ad('0x47')]=function(_0x372f08,_0x48706f){if(_0x372f08[_0x09ad('0x48')]['id']){delete _0x372f08[_0x09ad('0x48')]['id'];}return db[_0x09ad('0x2a')][_0x09ad('0x46')]({'where':{'id':_0x372f08['params']['id']}})[_0x09ad('0x24')](handleEntityNotFound(_0x48706f,null))['then'](saveUpdates(_0x372f08[_0x09ad('0x48')],null))[_0x09ad('0x24')](respondWithResult(_0x48706f,null))[_0x09ad('0x43')](handleError(_0x48706f,null));};exports[_0x09ad('0x25')]=function(_0x5b5840,_0x77f689){return db[_0x09ad('0x2a')][_0x09ad('0x46')]({'where':{'id':_0x5b5840[_0x09ad('0x45')]['id']}})[_0x09ad('0x24')](handleEntityNotFound(_0x77f689,null))[_0x09ad('0x24')](removeEntity(_0x77f689,null))[_0x09ad('0x43')](handleError(_0x77f689,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index bb880f5..d57740c 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 _0x8d05=['../../config/logger','api','moment','path','rimraf','../../config/environment','./intZendeskField.attributes','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','util'];(function(_0x1e399a,_0x351c59){var _0x539897=function(_0x2986fa){while(--_0x2986fa){_0x1e399a['push'](_0x1e399a['shift']());}};_0x539897(++_0x351c59);}(_0x8d05,0xe8));var _0x58d0=function(_0x5f2773,_0x1d25dc){_0x5f2773=_0x5f2773-0x0;var _0x4941af=_0x8d05[_0x5f2773];return _0x4941af;};'use strict';var _=require(_0x58d0('0x0'));var util=require(_0x58d0('0x1'));var logger=require(_0x58d0('0x2'))(_0x58d0('0x3'));var moment=require(_0x58d0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x58d0('0x5'));var rimraf=require(_0x58d0('0x6'));var config=require(_0x58d0('0x7'));var attributes=require(_0x58d0('0x8'));module['exports']=function(_0xdff7f2,_0xb300a9){return _0xdff7f2['define'](_0x58d0('0x9'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x58d0('0xa'),'fields':[_0x58d0('0xb'),_0x58d0('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfe9=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xdfe9,0xc3));var _0x9dfe=function(_0xe79381,_0x1619c3){_0xe79381=_0xe79381-0x0;var _0x59e28d=_0xdfe9[_0xe79381];return _0x59e28d;};'use strict';var _=require(_0x9dfe('0x0'));var util=require('util');var logger=require(_0x9dfe('0x1'))('api');var moment=require('moment');var BPromise=require(_0x9dfe('0x2'));var rp=require(_0x9dfe('0x3'));var fs=require('fs');var path=require(_0x9dfe('0x4'));var rimraf=require(_0x9dfe('0x5'));var config=require(_0x9dfe('0x6'));var attributes=require(_0x9dfe('0x7'));module[_0x9dfe('0x8')]=function(_0x3678b1,_0x2b0d0b){return _0x3678b1[_0x9dfe('0x9')](_0x9dfe('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x9dfe('0xb'),'fields':[_0x9dfe('0xc'),_0x9dfe('0xd')],'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 dfb0704..93e2f97 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 _0x6713=['debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0x6713,0xf7));var _0x3671=function(_0x1e9d62,_0x25bb8e){_0x1e9d62=_0x1e9d62-0x0;var _0x56c490=_0x6713[_0x1e9d62];return _0x56c490;};'use strict';var _=require(_0x3671('0x0'));var util=require('util');var moment=require(_0x3671('0x1'));var BPromise=require(_0x3671('0x2'));var rs=require(_0x3671('0x3'));var fs=require('fs');var Redis=require(_0x3671('0x4'));var db=require(_0x3671('0x5'))['db'];var utils=require(_0x3671('0x6'));var logger=require(_0x3671('0x7'))(_0x3671('0x8'));var config=require(_0x3671('0x9'));var jayson=require(_0x3671('0xa'));var client=jayson[_0x3671('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19bad5,_0x19b641,_0x138a3c){return new BPromise(function(_0xc30fe2,_0x3c53b1){return client[_0x3671('0xc')](_0x19bad5,_0x138a3c)[_0x3671('0xd')](function(_0x4e7f76){logger[_0x3671('0xe')](_0x3671('0xf'),_0x19b641,_0x3671('0x10'));logger[_0x3671('0x11')](_0x3671('0x12'),_0x19b641,'request\x20sent',JSON[_0x3671('0x13')](_0x4e7f76));if(_0x4e7f76[_0x3671('0x14')]){if(_0x4e7f76[_0x3671('0x14')][_0x3671('0x15')]===0x1f4){logger[_0x3671('0x14')](_0x3671('0xf'),_0x19b641,_0x4e7f76[_0x3671('0x14')]['message']);return _0x3c53b1(_0x4e7f76['error']['message']);}logger[_0x3671('0x14')](_0x3671('0xf'),_0x19b641,_0x4e7f76[_0x3671('0x14')]['message']);return _0xc30fe2(_0x4e7f76[_0x3671('0x14')][_0x3671('0x16')]);}else{logger[_0x3671('0xe')](_0x3671('0xf'),_0x19b641,_0x3671('0x10'));_0xc30fe2(_0x4e7f76['result']['message']);}})[_0x3671('0x17')](function(_0x534365){logger[_0x3671('0x14')]('ZendeskField,\x20%s,\x20%s',_0x19b641,_0x534365);_0x3c53b1(_0x534365);});});} \ No newline at end of file +var _0xb257=['../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','../../config/utils','../../config/logger','rpc'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0xb257,0x14f));var _0x7b25=function(_0x39921b,_0x2f1321){_0x39921b=_0x39921b-0x0;var _0x2b7f18=_0xb257[_0x39921b];return _0x2b7f18;};'use strict';var _=require(_0x7b25('0x0'));var util=require(_0x7b25('0x1'));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(_0x7b25('0x2'));var logger=require(_0x7b25('0x3'))(_0x7b25('0x4'));var config=require(_0x7b25('0x5'));var jayson=require(_0x7b25('0x6'));var client=jayson[_0x7b25('0x7')][_0x7b25('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f758e,_0x45587e,_0x59e116){return new BPromise(function(_0x39fc29,_0xde8faa){return client[_0x7b25('0x9')](_0x1f758e,_0x59e116)['then'](function(_0x283f83){logger[_0x7b25('0xa')](_0x7b25('0xb'),_0x45587e,_0x7b25('0xc'));logger[_0x7b25('0xd')](_0x7b25('0xe'),_0x45587e,'request\x20sent',JSON['stringify'](_0x283f83));if(_0x283f83[_0x7b25('0xf')]){if(_0x283f83['error'][_0x7b25('0x10')]===0x1f4){logger['error'](_0x7b25('0xb'),_0x45587e,_0x283f83[_0x7b25('0xf')][_0x7b25('0x11')]);return _0xde8faa(_0x283f83[_0x7b25('0xf')]['message']);}logger[_0x7b25('0xf')](_0x7b25('0xb'),_0x45587e,_0x283f83['error'][_0x7b25('0x11')]);return _0x39fc29(_0x283f83[_0x7b25('0xf')][_0x7b25('0x11')]);}else{logger[_0x7b25('0xa')](_0x7b25('0xb'),_0x45587e,_0x7b25('0xc'));_0x39fc29(_0x283f83[_0x7b25('0x12')]['message']);}})[_0x7b25('0x13')](function(_0x3145a4){logger[_0x7b25('0xf')](_0x7b25('0xb'),_0x45587e,_0x3145a4);_0xde8faa(_0x3145a4);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index f88180d..c96712a 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 _0x0580=['put','update','delete','/:id','destroy','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0xe8e396,_0x35a1aa){var _0x58dc43=function(_0x3f06fd){while(--_0x3f06fd){_0xe8e396['push'](_0xe8e396['shift']());}};_0x58dc43(++_0x35a1aa);}(_0x0580,0x1d4));var _0x0058=function(_0x530e3b,_0x56b1f5){_0x530e3b=_0x530e3b-0x0;var _0x1041bf=_0x0580[_0x530e3b];return _0x1041bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0058('0x0'));var timeout=require(_0x0058('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x0058('0x2'));var interaction=require(_0x0058('0x3'));var config=require(_0x0058('0x4'));var controller=require(_0x0058('0x5'));router[_0x0058('0x6')]('/',auth[_0x0058('0x7')](),controller[_0x0058('0x8')]);router[_0x0058('0x6')]('/:id',auth[_0x0058('0x7')](),controller['show']);router[_0x0058('0x6')](_0x0058('0x9'),auth[_0x0058('0x7')](),controller['getConfigurations']);router[_0x0058('0x6')](_0x0058('0xa'),auth['isAuthenticated'](),controller[_0x0058('0xb')]);router[_0x0058('0xc')]('/',auth['isAuthenticated'](),controller[_0x0058('0xd')]);router[_0x0058('0xc')]('/:id/configurations',auth[_0x0058('0x7')](),controller[_0x0058('0xe')]);router[_0x0058('0xf')]('/:id',auth[_0x0058('0x7')](),controller[_0x0058('0x10')]);router[_0x0058('0x11')](_0x0058('0x12'),auth[_0x0058('0x7')](),controller[_0x0058('0x13')]);module[_0x0058('0x14')]=router; \ No newline at end of file +var _0x27c9=['./intZohoAccount.controller','index','get','/:id','isAuthenticated','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/interaction/service','../../config/environment'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0x27c9,0xcd));var _0x927c=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x27c9[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x927c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x927c('0x1'));var express=require(_0x927c('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x927c('0x3'));var config=require(_0x927c('0x4'));var controller=require(_0x927c('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x927c('0x6')]);router[_0x927c('0x7')](_0x927c('0x8'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0x927c('0x9')](),controller['getConfigurations']);router[_0x927c('0x7')](_0x927c('0xa'),auth[_0x927c('0x9')](),controller[_0x927c('0xb')]);router[_0x927c('0xc')]('/',auth[_0x927c('0x9')](),controller[_0x927c('0xd')]);router['post'](_0x927c('0xe'),auth[_0x927c('0x9')](),controller[_0x927c('0xf')]);router[_0x927c('0x10')](_0x927c('0x8'),auth[_0x927c('0x9')](),controller[_0x927c('0x11')]);router[_0x927c('0x12')](_0x927c('0x8'),auth[_0x927c('0x9')](),controller[_0x927c('0x13')]);module[_0x927c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 1b9a892..d7f0794 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 _0xa4fb=['sequelize','STRING'];(function(_0x120643,_0x30d2d5){var _0x56fcfa=function(_0x46be07){while(--_0x46be07){_0x120643['push'](_0x120643['shift']());}};_0x56fcfa(++_0x30d2d5);}(_0xa4fb,0x142));var _0xba4f=function(_0x219fa0,_0x18b239){_0x219fa0=_0x219fa0-0x0;var _0xc603fb=_0xa4fb[_0x219fa0];return _0xc603fb;};'use strict';var Sequelize=require(_0xba4f('0x0'));module['exports']={'name':{'type':Sequelize[_0xba4f('0x1')]},'description':{'type':Sequelize[_0xba4f('0x1')]},'host':{'type':Sequelize[_0xba4f('0x1')]},'zone':{'type':Sequelize[_0xba4f('0x1')]},'clientId':{'type':Sequelize[_0xba4f('0x1')]},'clientSecret':{'type':Sequelize[_0xba4f('0x1')]},'serverUrl':{'type':Sequelize['STRING']},'code':{'type':Sequelize[_0xba4f('0x1')]},'refreshToken':{'type':Sequelize[_0xba4f('0x1')]}}; \ No newline at end of file +var _0xe3bd=['exports','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe3bd,0xaa));var _0xde3b=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0xe3bd[_0x562f3b];return _0x1edd55;};'use strict';var Sequelize=require(_0xde3b('0x0'));module[_0xde3b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xde3b('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xde3b('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xde3b('0x2')]},'serverUrl':{'type':Sequelize[_0xde3b('0x2')]},'code':{'type':Sequelize[_0xde3b('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 e24bd10..c296ab8 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 _0xce39=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','limit','set','Content-Range','apply','reject','save','update','end','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','nolimit','offset','sort','filter','merge','where','VIRTUAL','options','count','findAll','show','params','fields','length','includeAll','include','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','order','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','getFields','serverUrl','host','zoho.eu','com','slice','substring','lastIndexOf','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','custom_field','data_type','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x44abcb,_0x40f0ce){var _0x2288d9=function(_0x6a5237){while(--_0x6a5237){_0x44abcb['push'](_0x44abcb['shift']());}};_0x2288d9(++_0x40f0ce);}(_0xce39,0x198));var _0x9ce3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xce39[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x9ce3('0x0'));var emlformat=require(_0x9ce3('0x1'));var rimraf=require(_0x9ce3('0x2'));var zipdir=require(_0x9ce3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ce3('0x4'));var moment=require(_0x9ce3('0x5'));var BPromise=require(_0x9ce3('0x6'));var Mustache=require('mustache');var util=require(_0x9ce3('0x7'));var path=require(_0x9ce3('0x8'));var sox=require(_0x9ce3('0x9'));var csv=require(_0x9ce3('0xa'));var ejs=require(_0x9ce3('0xb'));var fs=require('fs');var _=require(_0x9ce3('0xc'));var squel=require(_0x9ce3('0xd'));var crypto=require('crypto');var jsforce=require(_0x9ce3('0xe'));var deskjs=require(_0x9ce3('0xf'));var toCsv=require(_0x9ce3('0xa'));var querystring=require(_0x9ce3('0x10'));var Papa=require(_0x9ce3('0x11'));var Redis=require(_0x9ce3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9ce3('0x13'));var as=require(_0x9ce3('0x14'));var hardwareService=require(_0x9ce3('0x15'));var logger=require(_0x9ce3('0x16'))(_0x9ce3('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9ce3('0x18'))['db'];var integrations=require(_0x9ce3('0x19'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x3a9839,_0x1092b7,_0x2f6efd){if(_0x2f6efd){var _0x16ca8a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16ca8a[_0x9ce3('0x1a')](_0x1092b7)){return _0x3a9839;}else{throw new db[(_0x9ce3('0x1b'))][(_0x9ce3('0x1c'))](_0x9ce3('0x1d'));}}else{return _0x3a9839;}}function respondWithRpcPromise(_0x505813,_0x2ad91c,_0x4e2ef1,_0x3f0862){return new BPromise(function(_0x3752cd,_0x470d91){var _0x556f51=_0x3f0862||client;return _0x556f51[_0x9ce3('0x1e')](_0x505813,_0x4e2ef1)[_0x9ce3('0x1f')](function(_0x18f809){logger[_0x9ce3('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x2ad91c,_0x9ce3('0x21'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x2ad91c,_0x9ce3('0x21'),JSON['stringify'](_0x18f809));if(_0x18f809[_0x9ce3('0x22')]){if(_0x18f809[_0x9ce3('0x22')][_0x9ce3('0x23')]===0x1f4){logger['error'](_0x9ce3('0x24'),_0x2ad91c,_0x18f809[_0x9ce3('0x22')]['message']);return _0x470d91(_0x18f809[_0x9ce3('0x22')]['message']);}logger[_0x9ce3('0x22')](_0x9ce3('0x24'),_0x2ad91c,_0x18f809[_0x9ce3('0x22')][_0x9ce3('0x25')]);return _0x3752cd(_0x18f809[_0x9ce3('0x22')][_0x9ce3('0x25')]);}else{logger['info'](_0x9ce3('0x24'),_0x2ad91c,_0x9ce3('0x21'));_0x3752cd(_0x18f809['result'][_0x9ce3('0x25')]);}})[_0x9ce3('0x26')](function(_0x3c3c24){logger['error'](_0x9ce3('0x24'),_0x2ad91c,_0x3c3c24);_0x470d91(_0x3c3c24);});});}function respondWithStatusCode(_0x279523,_0x2bf669){_0x2bf669=_0x2bf669||0xcc;return function(_0x542caf){if(_0x542caf){return _0x279523[_0x9ce3('0x27')](_0x2bf669);}return _0x279523[_0x9ce3('0x28')](_0x2bf669)['end']();};}function respondWithResult(_0x4bfd4f,_0x50ebd8){_0x50ebd8=_0x50ebd8||0xc8;return function(_0x56a259){if(_0x56a259){return _0x4bfd4f[_0x9ce3('0x28')](_0x50ebd8)[_0x9ce3('0x29')](_0x56a259);}};}function respondWithFilteredResult(_0x310b15,_0x165644){return function(_0x25d543){if(_0x25d543){var _0x3da41d=_0x25d543['count'],_0x1db59d=_0x165644['offset'],_0x55c97d=_0x165644['offset']+_0x165644[_0x9ce3('0x2a')],_0x3e3848;if(_0x55c97d>=_0x3da41d){_0x55c97d=_0x3da41d;_0x3e3848=0xc8;}else{_0x3e3848=0xce;}_0x310b15['status'](_0x3e3848);return _0x310b15[_0x9ce3('0x2b')](_0x9ce3('0x2c'),_0x1db59d+'-'+_0x55c97d+'/'+_0x3da41d)[_0x9ce3('0x29')](_0x25d543);}return null;};}function patchUpdates(_0x284d9b){return function(_0x34f8d7){try{jsonpatch[_0x9ce3('0x2d')](_0x34f8d7,_0x284d9b,!![]);}catch(_0x3cb911){return BPromise[_0x9ce3('0x2e')](_0x3cb911);}return _0x34f8d7[_0x9ce3('0x2f')]();};}function saveUpdates(_0x1d2471,_0x506b93){return function(_0xc4ba77){if(_0xc4ba77){return _0xc4ba77[_0x9ce3('0x30')](_0x1d2471)['then'](function(_0x2258d6){return _0x2258d6;});}return null;};}function removeEntity(_0x57f982,_0x304b4f){return function(_0x123d5a){if(_0x123d5a){return _0x123d5a['destroy']()['then'](function(){_0x57f982[_0x9ce3('0x28')](0xcc)[_0x9ce3('0x31')]();});}};}function handleEntityNotFound(_0x1c2b04,_0x573199){return function(_0x489d2f){if(!_0x489d2f){_0x1c2b04[_0x9ce3('0x27')](0x194);}return _0x489d2f;};}function handleError(_0x47a60c,_0x5ca200){_0x5ca200=_0x5ca200||0x1f4;return function(_0x1051e3){logger[_0x9ce3('0x22')](_0x1051e3['stack']);if(_0x1051e3['name']){delete _0x1051e3[_0x9ce3('0x32')];}_0x47a60c[_0x9ce3('0x28')](_0x5ca200)[_0x9ce3('0x33')](_0x1051e3);};}exports[_0x9ce3('0x34')]=function(_0x15ccc8,_0x62247){var _0xe370c5={},_0x180a2c={},_0x3e7696={'count':0x0,'rows':[]};var _0x471544=_[_0x9ce3('0x35')](db[_0x9ce3('0x36')][_0x9ce3('0x37')],function(_0x290713){return{'name':_0x290713[_0x9ce3('0x38')],'type':_0x290713[_0x9ce3('0x39')][_0x9ce3('0x3a')]};});_0x180a2c['model']=_[_0x9ce3('0x35')](_0x471544,_0x9ce3('0x32'));_0x180a2c[_0x9ce3('0x3b')]=_[_0x9ce3('0x3c')](_0x15ccc8[_0x9ce3('0x3b')]);_0x180a2c[_0x9ce3('0x3d')]=_['intersection'](_0x180a2c[_0x9ce3('0x3e')],_0x180a2c['query']);_0xe370c5[_0x9ce3('0x3f')]=_[_0x9ce3('0x40')](_0x180a2c['model'],qs['fields'](_0x15ccc8['query']['fields']));_0xe370c5['attributes']=_0xe370c5[_0x9ce3('0x3f')]['length']?_0xe370c5[_0x9ce3('0x3f')]:_0x180a2c['model'];if(!_0x15ccc8['query']['hasOwnProperty'](_0x9ce3('0x41'))){_0xe370c5[_0x9ce3('0x2a')]=qs['limit'](_0x15ccc8['query']['limit']);_0xe370c5['offset']=qs['offset'](_0x15ccc8['query'][_0x9ce3('0x42')]);}_0xe370c5['order']=qs['sort'](_0x15ccc8[_0x9ce3('0x3b')][_0x9ce3('0x43')]);_0xe370c5['where']=qs[_0x9ce3('0x3d')](_['pick'](_0x15ccc8[_0x9ce3('0x3b')],_0x180a2c['filters']));if(_0x15ccc8[_0x9ce3('0x3b')][_0x9ce3('0x44')]){_0xe370c5['where']=_[_0x9ce3('0x45')](_0xe370c5[_0x9ce3('0x46')],{'$or':_[_0x9ce3('0x35')](_0x471544,function(_0x94479){if(_0x94479['type']!==_0x9ce3('0x47')){var _0x54f578={};_0x54f578[_0x94479[_0x9ce3('0x32')]]={'$like':'%'+_0x15ccc8[_0x9ce3('0x3b')][_0x9ce3('0x44')]+'%'};return _0x54f578;}})});}_0xe370c5=_[_0x9ce3('0x45')]({},_0xe370c5,_0x15ccc8[_0x9ce3('0x48')]);var _0x318ecb={'where':_0xe370c5[_0x9ce3('0x46')]};return db['ZohoAccount'][_0x9ce3('0x49')](_0x318ecb)[_0x9ce3('0x1f')](function(_0x282a19){_0x3e7696[_0x9ce3('0x49')]=_0x282a19;if(_0x15ccc8[_0x9ce3('0x3b')]['includeAll']){_0xe370c5['include']=[{'all':!![]}];}return db[_0x9ce3('0x36')][_0x9ce3('0x4a')](_0xe370c5);})['then'](function(_0x474b56){_0x3e7696['rows']=_0x474b56;return _0x3e7696;})[_0x9ce3('0x1f')](respondWithFilteredResult(_0x62247,_0xe370c5))[_0x9ce3('0x26')](handleError(_0x62247,null));};exports[_0x9ce3('0x4b')]=function(_0x53528b,_0x3e2862){var _0xd8a9e={'raw':![],'where':{'id':_0x53528b[_0x9ce3('0x4c')]['id']}},_0x3cfe4b={};_0x3cfe4b['model']=_['keys'](db['ZohoAccount'][_0x9ce3('0x37')]);_0x3cfe4b['query']=_[_0x9ce3('0x3c')](_0x53528b[_0x9ce3('0x3b')]);_0x3cfe4b[_0x9ce3('0x3d')]=_[_0x9ce3('0x40')](_0x3cfe4b[_0x9ce3('0x3e')],_0x3cfe4b[_0x9ce3('0x3b')]);_0xd8a9e[_0x9ce3('0x3f')]=_['intersection'](_0x3cfe4b['model'],qs[_0x9ce3('0x4d')](_0x53528b[_0x9ce3('0x3b')][_0x9ce3('0x4d')]));_0xd8a9e['attributes']=_0xd8a9e['attributes'][_0x9ce3('0x4e')]?_0xd8a9e[_0x9ce3('0x3f')]:_0x3cfe4b['model'];if(_0x53528b[_0x9ce3('0x3b')][_0x9ce3('0x4f')]){_0xd8a9e[_0x9ce3('0x50')]=[{'all':!![]}];}_0xd8a9e=_[_0x9ce3('0x45')]({},_0xd8a9e,_0x53528b['options']);return db['ZohoAccount'][_0x9ce3('0x51')](_0xd8a9e)[_0x9ce3('0x1f')](handleEntityNotFound(_0x3e2862,null))[_0x9ce3('0x1f')](respondWithResult(_0x3e2862,null))[_0x9ce3('0x26')](handleError(_0x3e2862,null));};exports['create']=function(_0x24c72c,_0x1757f6){return db[_0x9ce3('0x36')][_0x9ce3('0x52')](_0x24c72c[_0x9ce3('0x53')],{})[_0x9ce3('0x1f')](respondWithResult(_0x1757f6,0xc9))[_0x9ce3('0x26')](handleError(_0x1757f6,null));};exports[_0x9ce3('0x30')]=function(_0x3aff47,_0x519c81){if(_0x3aff47[_0x9ce3('0x53')]['id']){delete _0x3aff47[_0x9ce3('0x53')]['id'];}return db['ZohoAccount'][_0x9ce3('0x51')]({'where':{'id':_0x3aff47[_0x9ce3('0x4c')]['id']}})[_0x9ce3('0x1f')](handleEntityNotFound(_0x519c81,null))['then'](saveUpdates(_0x3aff47[_0x9ce3('0x53')],null))[_0x9ce3('0x1f')](respondWithResult(_0x519c81,null))[_0x9ce3('0x26')](handleError(_0x519c81,null));};exports[_0x9ce3('0x54')]=function(_0x59f25d,_0x4a3992){return db[_0x9ce3('0x36')][_0x9ce3('0x51')]({'where':{'id':_0x59f25d[_0x9ce3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4a3992,null))[_0x9ce3('0x1f')](removeEntity(_0x4a3992,null))[_0x9ce3('0x26')](handleError(_0x4a3992,null));};exports[_0x9ce3('0x55')]=function(_0x14a994,_0xd5705b,_0x4802ee){var _0x2ed553={};var _0x9fb03f={};var _0x458825;var _0x539550;return db[_0x9ce3('0x36')][_0x9ce3('0x56')]({'where':{'id':_0x14a994[_0x9ce3('0x4c')]['id']}})[_0x9ce3('0x1f')](handleEntityNotFound(_0xd5705b,null))[_0x9ce3('0x1f')](function(_0x227759){if(_0x227759){_0x458825=_0x227759;_0x9fb03f[_0x9ce3('0x3e')]=_[_0x9ce3('0x3c')](db[_0x9ce3('0x57')]['rawAttributes']);_0x9fb03f[_0x9ce3('0x3b')]=_[_0x9ce3('0x3c')](_0x14a994[_0x9ce3('0x3b')]);_0x9fb03f['filters']=_['intersection'](_0x9fb03f[_0x9ce3('0x3e')],_0x9fb03f[_0x9ce3('0x3b')]);_0x2ed553[_0x9ce3('0x3f')]=_[_0x9ce3('0x40')](_0x9fb03f[_0x9ce3('0x3e')],qs[_0x9ce3('0x4d')](_0x14a994['query'][_0x9ce3('0x4d')]));_0x2ed553[_0x9ce3('0x3f')]=_0x2ed553[_0x9ce3('0x3f')][_0x9ce3('0x4e')]?_0x2ed553[_0x9ce3('0x3f')]:_0x9fb03f[_0x9ce3('0x3e')];_0x2ed553[_0x9ce3('0x58')]=qs['sort'](_0x14a994[_0x9ce3('0x3b')][_0x9ce3('0x43')]);_0x2ed553[_0x9ce3('0x46')]=qs[_0x9ce3('0x3d')](_[_0x9ce3('0x59')](_0x14a994['query'],_0x9fb03f[_0x9ce3('0x3d')]));if(_0x14a994['query'][_0x9ce3('0x44')]){_0x2ed553[_0x9ce3('0x46')]=_[_0x9ce3('0x45')](_0x2ed553['where'],{'$or':_['map'](_0x2ed553[_0x9ce3('0x3f')],function(_0x42b0ab){var _0x4f45df={};_0x4f45df[_0x42b0ab]={'$like':'%'+_0x14a994[_0x9ce3('0x3b')]['filter']+'%'};return _0x4f45df;})});}_0x2ed553=_[_0x9ce3('0x45')]({},_0x2ed553,_0x14a994[_0x9ce3('0x48')]);return _0x458825[_0x9ce3('0x55')](_0x2ed553);}})[_0x9ce3('0x1f')](function(_0x38ce94){if(_0x38ce94){_0x539550=_0x38ce94[_0x9ce3('0x4e')];if(!_0x14a994['query'][_0x9ce3('0x5a')]('nolimit')){_0x2ed553[_0x9ce3('0x2a')]=qs['limit'](_0x14a994[_0x9ce3('0x3b')]['limit']);_0x2ed553[_0x9ce3('0x42')]=qs[_0x9ce3('0x42')](_0x14a994[_0x9ce3('0x3b')][_0x9ce3('0x42')]);}return _0x458825['getConfigurations'](_0x2ed553);}})[_0x9ce3('0x1f')](function(_0x586a49){if(_0x586a49){return _0x586a49?{'count':_0x539550,'rows':_0x586a49}:null;}})[_0x9ce3('0x1f')](respondWithResult(_0xd5705b,null))[_0x9ce3('0x26')](handleError(_0xd5705b,null));};exports[_0x9ce3('0x5b')]=function(_0x40827f,_0x33c5c2,_0x6ac769){if(_0x40827f[_0x9ce3('0x53')]['id']){delete _0x40827f[_0x9ce3('0x53')]['id'];}return db[_0x9ce3('0x36')][_0x9ce3('0x56')]({'where':{'id':_0x40827f[_0x9ce3('0x4c')]['id']}})[_0x9ce3('0x1f')](handleEntityNotFound(_0x33c5c2,null))[_0x9ce3('0x1f')](function(_0x1fa6a1){if(_0x1fa6a1){_0x40827f[_0x9ce3('0x53')][_0x9ce3('0x5c')]=_0x1fa6a1['id'];_0x40827f[_0x9ce3('0x53')][_0x9ce3('0x5d')]=integrations[_0x9ce3('0x5e')](_0x40827f[_0x9ce3('0x53')][_0x9ce3('0x5f')],_0x40827f[_0x9ce3('0x53')][_0x9ce3('0x39')]);_0x40827f['body'][_0x9ce3('0x60')]=integrations[_0x9ce3('0x61')](_0x40827f[_0x9ce3('0x53')][_0x9ce3('0x5f')],_0x40827f[_0x9ce3('0x53')][_0x9ce3('0x39')]);return db[_0x9ce3('0x57')][_0x9ce3('0x52')](_0x40827f[_0x9ce3('0x53')],{'include':[{'model':db[_0x9ce3('0x62')],'as':_0x9ce3('0x5d')},{'model':db[_0x9ce3('0x62')],'as':_0x9ce3('0x60')}]});}return null;})['then'](respondWithResult(_0x33c5c2,null))[_0x9ce3('0x26')](handleError(_0x33c5c2,null));};function getAccessToken(_0x43555e){return new Promise(function(_0x335590,_0x2cb515){var _0x302c4d;switch(_0x43555e['zone']){case'US':_0x302c4d='https://accounts.zoho.com';break;case'AU':_0x302c4d=_0x9ce3('0x63');break;case'EU':_0x302c4d=_0x9ce3('0x64');break;case'IN':_0x302c4d=_0x9ce3('0x65');break;case'CN':_0x302c4d=_0x9ce3('0x66');break;default:_0x302c4d=_0x9ce3('0x64');break;}var _0x3c8c4e={'method':_0x9ce3('0x67'),'uri':_0x302c4d+_0x9ce3('0x68'),'qs':{'refresh_token':_0x43555e[_0x9ce3('0x69')],'client_id':_0x43555e[_0x9ce3('0x6a')],'client_secret':_0x43555e[_0x9ce3('0x6b')],'grant_type':_0x9ce3('0x6c')},'json':!![]};return rp(_0x3c8c4e)['then'](function(_0x569da1){if(_0x569da1[_0x9ce3('0x6d')]){_0x335590(_0x569da1[_0x9ce3('0x6d')]);}else{_0x2cb515('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x9ce3('0x26')](function(_0x85df6e){_0x2cb515(_0x85df6e);});});}exports[_0x9ce3('0x6e')]=function(_0x5e2f63,_0x3b215f,_0x400aed){var _0x2e1161,_0x53788e,_0x5cd0a9,_0x4f5aca,_0x5da1b4;return db[_0x9ce3('0x36')][_0x9ce3('0x56')]({'where':{'id':_0x5e2f63[_0x9ce3('0x4c')]['id']},'attributes':['id','host','zone','clientId',_0x9ce3('0x6b'),_0x9ce3('0x6f'),_0x9ce3('0x23'),_0x9ce3('0x69')]})['then'](handleEntityNotFound(_0x3b215f,null))['then'](function(_0x628737){_0x5da1b4=_0x628737;_0x2e1161=_0x5da1b4[_0x9ce3('0x70')];_0x53788e=_0x2e1161===_0x9ce3('0x71')?'eu':_0x9ce3('0x72');_0x5cd0a9=_0x5da1b4[_0x9ce3('0x6f')];var _0x5d0a77=_0x5cd0a9[_0x9ce3('0x73')](-0x1);if(_0x5d0a77==='/'||_0x5d0a77==='\x5c'||_0x5d0a77===':'){_0x5cd0a9=_0x5cd0a9[_0x9ce3('0x74')](0x0,_0x5cd0a9[_0x9ce3('0x75')](_0x5d0a77));}if(!_0x5da1b4[_0x9ce3('0x69')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x5da1b4);})[_0x9ce3('0x1f')](function(_0x5cfa6b){if(_0x5cfa6b){return rp({'method':_0x9ce3('0x76'),'uri':util['format'](_0x9ce3('0x77'),_0x53788e),'qs':{'module':'Calls'},'headers':{'Authorization':_0x9ce3('0x78')+_0x5cfa6b},'json':!![]});}})[_0x9ce3('0x1f')](function(_0x4ba806){if(_0x4ba806){if(_0x4ba806[_0x9ce3('0x79')]&&_0x4ba806[_0x9ce3('0x79')][_0x9ce3('0x22')]){throw new Error(_0x4ba806[_0x9ce3('0x79')][_0x9ce3('0x22')][_0x9ce3('0x25')]);}var _0x1103cc=[];var _0x378035=[];var _0x5745cd=[_0x9ce3('0x7a'),_0x9ce3('0x7b'),_0x9ce3('0x7c'),_0x9ce3('0x7d'),_0x9ce3('0x7e'),_0x9ce3('0x7f'),_0x9ce3('0x80'),'Call_Type'];_0x378035=_[_0x9ce3('0x81')](_0x4ba806[_0x9ce3('0x4d')],function(_0x3b07ad){return _0x5745cd[_0x9ce3('0x82')](_0x3b07ad[_0x9ce3('0x83')]);});for(var _0x28ae45=0x0;_0x28ae45<_0x378035[_0x9ce3('0x4e')];_0x28ae45++){if(_0x378035[_0x28ae45][_0x9ce3('0x84')]===![]){_0x1103cc[_0x9ce3('0x85')]({'id':_0x378035[_0x28ae45]['id'],'name':_0x378035[_0x28ae45]['display_label'],'custom':_0x378035[_0x28ae45][_0x9ce3('0x86')],'options':_0x378035[_0x28ae45][_0x9ce3('0x87')]==='picklist'&&_0x378035[_0x28ae45]['pick_list_values'][_0x9ce3('0x4e')]>-0x1?_[_0x9ce3('0x35')](_0x378035[_0x28ae45]['pick_list_values'],function(_0x153ece){return{'name':_0x153ece,'value':_0x153ece};}):[]});}}return{'count':_0x1103cc['length'],'rows':_0x1103cc};}else{return{'count':0x0,'rows':[]};}})[_0x9ce3('0x1f')](respondWithResult(_0x3b215f,null))[_0x9ce3('0x26')](function(_0x3ba35f){var _0x7f3b95=_0x5e2f63['query'][_0x9ce3('0x1a')]?0x1f4:_0x3ba35f[_0x9ce3('0x88')]||0x1f4;logger[_0x9ce3('0x22')](_0x9ce3('0x89'),_0x9ce3('0x6e'),_0x7f3b95,JSON[_0x9ce3('0x8a')](_0x3ba35f));delete _0x3ba35f[_0x9ce3('0x32')];if(_0x7f3b95===0x191){_0x7f3b95=0x190;}_0x3b215f[_0x9ce3('0x28')](_0x7f3b95)[_0x9ce3('0x33')](_0x5e2f63['query'][_0x9ce3('0x1a')]?{'message':_0x9ce3('0x8b'),'statusCode':_0x3ba35f[_0x9ce3('0x88')]}:_0x3ba35f);});}; \ No newline at end of file +var _0x82e0=['getConfigurations','nolimit','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','host','serverUrl','com','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Subject','WhoId','Call_Result','Call_Start_Time','remove','includes','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','sendStatus','end','json','count','offset','status','Content-Range','apply','save','update','destroy','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','findOne','length','order'];(function(_0x250c9b,_0x4b8cc8){var _0xc09774=function(_0x5117d2){while(--_0x5117d2){_0x250c9b['push'](_0x250c9b['shift']());}};_0xc09774(++_0x4b8cc8);}(_0x82e0,0xb5));var _0x082e=function(_0x43304b,_0x5ec697){_0x43304b=_0x43304b-0x0;var _0xe2f997=_0x82e0[_0x43304b];return _0xe2f997;};'use strict';var pdf=require(_0x082e('0x0'));var emlformat=require(_0x082e('0x1'));var rimraf=require(_0x082e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x082e('0x3'));var rp=require(_0x082e('0x4'));var moment=require(_0x082e('0x5'));var BPromise=require(_0x082e('0x6'));var Mustache=require(_0x082e('0x7'));var util=require('util');var path=require(_0x082e('0x8'));var sox=require(_0x082e('0x9'));var csv=require(_0x082e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x082e('0xb'));var squel=require(_0x082e('0xc'));var crypto=require('crypto');var jsforce=require(_0x082e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x082e('0xa'));var querystring=require(_0x082e('0xe'));var Papa=require(_0x082e('0xf'));var Redis=require(_0x082e('0x10'));var authService=require(_0x082e('0x11'));var qs=require(_0x082e('0x12'));var as=require(_0x082e('0x13'));var hardwareService=require(_0x082e('0x14'));var logger=require('../../config/logger')(_0x082e('0x15'));var utils=require('../../config/utils');var config=require(_0x082e('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x082e('0x17'));var client=jayson[_0x082e('0x18')][_0x082e('0x19')]({'port':0x232a});function checkPasswordPattern(_0x11c16e,_0x53bf8c,_0x185917){if(_0x185917){var _0x34c525=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x34c525[_0x082e('0x1a')](_0x53bf8c)){return _0x11c16e;}else{throw new db[(_0x082e('0x1b'))][(_0x082e('0x1c'))](_0x082e('0x1d'));}}else{return _0x11c16e;}}function respondWithRpcPromise(_0x395c10,_0x2ee940,_0x492389,_0xa365c){return new BPromise(function(_0xc54410,_0x3f31e0){var _0x1f6f61=_0xa365c||client;return _0x1f6f61[_0x082e('0x1e')](_0x395c10,_0x492389)[_0x082e('0x1f')](function(_0x5a4a91){logger[_0x082e('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x2ee940,_0x082e('0x21'));logger[_0x082e('0x22')](_0x082e('0x23'),_0x2ee940,_0x082e('0x21'),JSON[_0x082e('0x24')](_0x5a4a91));if(_0x5a4a91[_0x082e('0x25')]){if(_0x5a4a91[_0x082e('0x25')][_0x082e('0x26')]===0x1f4){logger[_0x082e('0x25')](_0x082e('0x27'),_0x2ee940,_0x5a4a91['error'][_0x082e('0x28')]);return _0x3f31e0(_0x5a4a91['error'][_0x082e('0x28')]);}logger[_0x082e('0x25')](_0x082e('0x27'),_0x2ee940,_0x5a4a91[_0x082e('0x25')][_0x082e('0x28')]);return _0xc54410(_0x5a4a91['error'][_0x082e('0x28')]);}else{logger[_0x082e('0x20')](_0x082e('0x27'),_0x2ee940,_0x082e('0x21'));_0xc54410(_0x5a4a91['result'][_0x082e('0x28')]);}})['catch'](function(_0xd95936){logger[_0x082e('0x25')]('ZohoAccount,\x20%s,\x20%s',_0x2ee940,_0xd95936);_0x3f31e0(_0xd95936);});});}function respondWithStatusCode(_0x55735f,_0x252478){_0x252478=_0x252478||0xcc;return function(_0x4b878e){if(_0x4b878e){return _0x55735f[_0x082e('0x29')](_0x252478);}return _0x55735f['status'](_0x252478)[_0x082e('0x2a')]();};}function respondWithResult(_0x1e80aa,_0x44b9f5){_0x44b9f5=_0x44b9f5||0xc8;return function(_0x10cdd6){if(_0x10cdd6){return _0x1e80aa['status'](_0x44b9f5)[_0x082e('0x2b')](_0x10cdd6);}};}function respondWithFilteredResult(_0x7e292a,_0x5d12f0){return function(_0x4b091b){if(_0x4b091b){var _0x2d4b72=_0x4b091b[_0x082e('0x2c')],_0xf841b2=_0x5d12f0[_0x082e('0x2d')],_0x4bc707=_0x5d12f0[_0x082e('0x2d')]+_0x5d12f0['limit'],_0x189878;if(_0x4bc707>=_0x2d4b72){_0x4bc707=_0x2d4b72;_0x189878=0xc8;}else{_0x189878=0xce;}_0x7e292a[_0x082e('0x2e')](_0x189878);return _0x7e292a['set'](_0x082e('0x2f'),_0xf841b2+'-'+_0x4bc707+'/'+_0x2d4b72)[_0x082e('0x2b')](_0x4b091b);}return null;};}function patchUpdates(_0x5773a3){return function(_0x29bbc1){try{jsonpatch[_0x082e('0x30')](_0x29bbc1,_0x5773a3,!![]);}catch(_0x5a144e){return BPromise['reject'](_0x5a144e);}return _0x29bbc1[_0x082e('0x31')]();};}function saveUpdates(_0x356f41,_0x169bc2){return function(_0x4d0e26){if(_0x4d0e26){return _0x4d0e26[_0x082e('0x32')](_0x356f41)[_0x082e('0x1f')](function(_0x59a194){return _0x59a194;});}return null;};}function removeEntity(_0x1888c8,_0x4b6e1c){return function(_0x4d2014){if(_0x4d2014){return _0x4d2014[_0x082e('0x33')]()[_0x082e('0x1f')](function(){_0x1888c8[_0x082e('0x2e')](0xcc)[_0x082e('0x2a')]();});}};}function handleEntityNotFound(_0x22544f,_0x223c02){return function(_0x15ea0f){if(!_0x15ea0f){_0x22544f[_0x082e('0x29')](0x194);}return _0x15ea0f;};}function handleError(_0x591872,_0x2f9be1){_0x2f9be1=_0x2f9be1||0x1f4;return function(_0x733e2){logger[_0x082e('0x25')](_0x733e2[_0x082e('0x34')]);if(_0x733e2[_0x082e('0x35')]){delete _0x733e2[_0x082e('0x35')];}_0x591872[_0x082e('0x2e')](_0x2f9be1)[_0x082e('0x36')](_0x733e2);};}exports[_0x082e('0x37')]=function(_0x10b4ec,_0x31d3d5){var _0x4b2cc1={},_0x351697={},_0x51db15={'count':0x0,'rows':[]};var _0x3d73ac=_[_0x082e('0x38')](db[_0x082e('0x39')][_0x082e('0x3a')],function(_0x4c25fd){return{'name':_0x4c25fd[_0x082e('0x3b')],'type':_0x4c25fd[_0x082e('0x3c')][_0x082e('0x3d')]};});_0x351697[_0x082e('0x3e')]=_[_0x082e('0x38')](_0x3d73ac,_0x082e('0x35'));_0x351697[_0x082e('0x3f')]=_[_0x082e('0x40')](_0x10b4ec[_0x082e('0x3f')]);_0x351697[_0x082e('0x41')]=_[_0x082e('0x42')](_0x351697['model'],_0x351697['query']);_0x4b2cc1['attributes']=_['intersection'](_0x351697[_0x082e('0x3e')],qs[_0x082e('0x43')](_0x10b4ec[_0x082e('0x3f')][_0x082e('0x43')]));_0x4b2cc1[_0x082e('0x44')]=_0x4b2cc1[_0x082e('0x44')]['length']?_0x4b2cc1[_0x082e('0x44')]:_0x351697['model'];if(!_0x10b4ec[_0x082e('0x3f')][_0x082e('0x45')]('nolimit')){_0x4b2cc1[_0x082e('0x46')]=qs[_0x082e('0x46')](_0x10b4ec['query'][_0x082e('0x46')]);_0x4b2cc1[_0x082e('0x2d')]=qs[_0x082e('0x2d')](_0x10b4ec[_0x082e('0x3f')][_0x082e('0x2d')]);}_0x4b2cc1['order']=qs[_0x082e('0x47')](_0x10b4ec['query'][_0x082e('0x47')]);_0x4b2cc1['where']=qs['filters'](_[_0x082e('0x48')](_0x10b4ec[_0x082e('0x3f')],_0x351697['filters']));if(_0x10b4ec[_0x082e('0x3f')][_0x082e('0x49')]){_0x4b2cc1[_0x082e('0x4a')]=_[_0x082e('0x4b')](_0x4b2cc1['where'],{'$or':_[_0x082e('0x38')](_0x3d73ac,function(_0x14529f){if(_0x14529f[_0x082e('0x3c')]!==_0x082e('0x4c')){var _0x58aee0={};_0x58aee0[_0x14529f[_0x082e('0x35')]]={'$like':'%'+_0x10b4ec[_0x082e('0x3f')][_0x082e('0x49')]+'%'};return _0x58aee0;}})});}_0x4b2cc1=_[_0x082e('0x4b')]({},_0x4b2cc1,_0x10b4ec[_0x082e('0x4d')]);var _0x124d99={'where':_0x4b2cc1[_0x082e('0x4a')]};return db[_0x082e('0x39')][_0x082e('0x2c')](_0x124d99)['then'](function(_0x42c686){_0x51db15[_0x082e('0x2c')]=_0x42c686;if(_0x10b4ec[_0x082e('0x3f')][_0x082e('0x4e')]){_0x4b2cc1['include']=[{'all':!![]}];}return db['ZohoAccount'][_0x082e('0x4f')](_0x4b2cc1);})[_0x082e('0x1f')](function(_0xf92299){_0x51db15[_0x082e('0x50')]=_0xf92299;return _0x51db15;})[_0x082e('0x1f')](respondWithFilteredResult(_0x31d3d5,_0x4b2cc1))[_0x082e('0x51')](handleError(_0x31d3d5,null));};exports[_0x082e('0x52')]=function(_0x18830e,_0xc87af){var _0x4bbb3f={'raw':![],'where':{'id':_0x18830e[_0x082e('0x53')]['id']}},_0x131b83={};_0x131b83[_0x082e('0x3e')]=_[_0x082e('0x40')](db[_0x082e('0x39')]['rawAttributes']);_0x131b83[_0x082e('0x3f')]=_[_0x082e('0x40')](_0x18830e[_0x082e('0x3f')]);_0x131b83['filters']=_[_0x082e('0x42')](_0x131b83[_0x082e('0x3e')],_0x131b83['query']);_0x4bbb3f[_0x082e('0x44')]=_['intersection'](_0x131b83[_0x082e('0x3e')],qs[_0x082e('0x43')](_0x18830e[_0x082e('0x3f')][_0x082e('0x43')]));_0x4bbb3f['attributes']=_0x4bbb3f[_0x082e('0x44')]['length']?_0x4bbb3f[_0x082e('0x44')]:_0x131b83['model'];if(_0x18830e[_0x082e('0x3f')][_0x082e('0x4e')]){_0x4bbb3f[_0x082e('0x54')]=[{'all':!![]}];}_0x4bbb3f=_[_0x082e('0x4b')]({},_0x4bbb3f,_0x18830e['options']);return db[_0x082e('0x39')][_0x082e('0x55')](_0x4bbb3f)[_0x082e('0x1f')](handleEntityNotFound(_0xc87af,null))[_0x082e('0x1f')](respondWithResult(_0xc87af,null))[_0x082e('0x51')](handleError(_0xc87af,null));};exports[_0x082e('0x56')]=function(_0x307e43,_0x15f733){return db[_0x082e('0x39')][_0x082e('0x56')](_0x307e43[_0x082e('0x57')],{})[_0x082e('0x1f')](respondWithResult(_0x15f733,0xc9))['catch'](handleError(_0x15f733,null));};exports['update']=function(_0x1cb813,_0x2455d1){if(_0x1cb813[_0x082e('0x57')]['id']){delete _0x1cb813[_0x082e('0x57')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x1cb813[_0x082e('0x53')]['id']}})[_0x082e('0x1f')](handleEntityNotFound(_0x2455d1,null))['then'](saveUpdates(_0x1cb813[_0x082e('0x57')],null))[_0x082e('0x1f')](respondWithResult(_0x2455d1,null))[_0x082e('0x51')](handleError(_0x2455d1,null));};exports[_0x082e('0x33')]=function(_0x1e9563,_0x27cb56){return db[_0x082e('0x39')]['find']({'where':{'id':_0x1e9563[_0x082e('0x53')]['id']}})[_0x082e('0x1f')](handleEntityNotFound(_0x27cb56,null))['then'](removeEntity(_0x27cb56,null))['catch'](handleError(_0x27cb56,null));};exports['getConfigurations']=function(_0x51a3b5,_0x2602c4,_0x5ef1f2){var _0x5c30d4={};var _0x182610={};var _0x216e3b;var _0xfd82e0;return db[_0x082e('0x39')][_0x082e('0x58')]({'where':{'id':_0x51a3b5['params']['id']}})[_0x082e('0x1f')](handleEntityNotFound(_0x2602c4,null))[_0x082e('0x1f')](function(_0x5ab6b5){if(_0x5ab6b5){_0x216e3b=_0x5ab6b5;_0x182610[_0x082e('0x3e')]=_[_0x082e('0x40')](db['ZohoConfiguration'][_0x082e('0x3a')]);_0x182610[_0x082e('0x3f')]=_['keys'](_0x51a3b5[_0x082e('0x3f')]);_0x182610[_0x082e('0x41')]=_[_0x082e('0x42')](_0x182610['model'],_0x182610[_0x082e('0x3f')]);_0x5c30d4[_0x082e('0x44')]=_[_0x082e('0x42')](_0x182610[_0x082e('0x3e')],qs[_0x082e('0x43')](_0x51a3b5['query'][_0x082e('0x43')]));_0x5c30d4[_0x082e('0x44')]=_0x5c30d4[_0x082e('0x44')][_0x082e('0x59')]?_0x5c30d4[_0x082e('0x44')]:_0x182610[_0x082e('0x3e')];_0x5c30d4[_0x082e('0x5a')]=qs[_0x082e('0x47')](_0x51a3b5[_0x082e('0x3f')][_0x082e('0x47')]);_0x5c30d4['where']=qs[_0x082e('0x41')](_['pick'](_0x51a3b5['query'],_0x182610['filters']));if(_0x51a3b5[_0x082e('0x3f')][_0x082e('0x49')]){_0x5c30d4[_0x082e('0x4a')]=_['merge'](_0x5c30d4['where'],{'$or':_[_0x082e('0x38')](_0x5c30d4['attributes'],function(_0x31f70d){var _0x129376={};_0x129376[_0x31f70d]={'$like':'%'+_0x51a3b5[_0x082e('0x3f')][_0x082e('0x49')]+'%'};return _0x129376;})});}_0x5c30d4=_[_0x082e('0x4b')]({},_0x5c30d4,_0x51a3b5[_0x082e('0x4d')]);return _0x216e3b[_0x082e('0x5b')](_0x5c30d4);}})[_0x082e('0x1f')](function(_0x6da46e){if(_0x6da46e){_0xfd82e0=_0x6da46e[_0x082e('0x59')];if(!_0x51a3b5[_0x082e('0x3f')][_0x082e('0x45')](_0x082e('0x5c'))){_0x5c30d4[_0x082e('0x46')]=qs[_0x082e('0x46')](_0x51a3b5['query'][_0x082e('0x46')]);_0x5c30d4[_0x082e('0x2d')]=qs[_0x082e('0x2d')](_0x51a3b5['query']['offset']);}return _0x216e3b[_0x082e('0x5b')](_0x5c30d4);}})[_0x082e('0x1f')](function(_0x39950f){if(_0x39950f){return _0x39950f?{'count':_0xfd82e0,'rows':_0x39950f}:null;}})[_0x082e('0x1f')](respondWithResult(_0x2602c4,null))['catch'](handleError(_0x2602c4,null));};exports['addConfiguration']=function(_0x187859,_0x41f816,_0x369143){if(_0x187859[_0x082e('0x57')]['id']){delete _0x187859[_0x082e('0x57')]['id'];}return db[_0x082e('0x39')]['findOne']({'where':{'id':_0x187859[_0x082e('0x53')]['id']}})['then'](handleEntityNotFound(_0x41f816,null))['then'](function(_0xe554dc){if(_0xe554dc){_0x187859[_0x082e('0x57')]['AccountId']=_0xe554dc['id'];_0x187859[_0x082e('0x57')][_0x082e('0x5d')]=integrations[_0x082e('0x5e')](_0x187859[_0x082e('0x57')][_0x082e('0x5f')],_0x187859['body'][_0x082e('0x3c')]);_0x187859['body'][_0x082e('0x60')]=integrations[_0x082e('0x61')](_0x187859['body'][_0x082e('0x5f')],_0x187859[_0x082e('0x57')][_0x082e('0x3c')]);return db[_0x082e('0x62')][_0x082e('0x56')](_0x187859[_0x082e('0x57')],{'include':[{'model':db[_0x082e('0x63')],'as':_0x082e('0x5d')},{'model':db['ZohoField'],'as':_0x082e('0x60')}]});}return null;})[_0x082e('0x1f')](respondWithResult(_0x41f816,null))[_0x082e('0x51')](handleError(_0x41f816,null));};function getAccessToken(_0x2b22cc){return new Promise(function(_0x55978b,_0x1f575a){var _0x580d9b;switch(_0x2b22cc[_0x082e('0x64')]){case'US':_0x580d9b=_0x082e('0x65');break;case'AU':_0x580d9b='https://accounts.zoho.com.au';break;case'EU':_0x580d9b=_0x082e('0x66');break;case'IN':_0x580d9b=_0x082e('0x67');break;case'CN':_0x580d9b='https://accounts.zoho.com.cn';break;default:_0x580d9b=_0x082e('0x66');break;}var _0x5d555a={'method':_0x082e('0x68'),'uri':_0x580d9b+_0x082e('0x69'),'qs':{'refresh_token':_0x2b22cc[_0x082e('0x6a')],'client_id':_0x2b22cc[_0x082e('0x6b')],'client_secret':_0x2b22cc[_0x082e('0x6c')],'grant_type':_0x082e('0x6d')},'json':!![]};return rp(_0x5d555a)[_0x082e('0x1f')](function(_0x2c6412){if(_0x2c6412[_0x082e('0x6e')]){_0x55978b(_0x2c6412[_0x082e('0x6e')]);}else{_0x1f575a('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})['catch'](function(_0x1bbc7b){_0x1f575a(_0x1bbc7b);});});}exports['getFields']=function(_0x412ce3,_0x15fc44,_0x4c3c3d){var _0x3a065b,_0x3dbb9e,_0x431c45,_0x1fb2bf,_0x4c01c9;return db[_0x082e('0x39')]['findOne']({'where':{'id':_0x412ce3[_0x082e('0x53')]['id']},'attributes':['id',_0x082e('0x6f'),_0x082e('0x64'),_0x082e('0x6b'),_0x082e('0x6c'),_0x082e('0x70'),_0x082e('0x26'),_0x082e('0x6a')]})['then'](handleEntityNotFound(_0x15fc44,null))[_0x082e('0x1f')](function(_0x11f80d){_0x4c01c9=_0x11f80d;_0x3a065b=_0x4c01c9[_0x082e('0x6f')];_0x3dbb9e=_0x3a065b==='zoho.eu'?'eu':_0x082e('0x71');_0x431c45=_0x4c01c9[_0x082e('0x70')];var _0x483a43=_0x431c45['slice'](-0x1);if(_0x483a43==='/'||_0x483a43==='\x5c'||_0x483a43===':'){_0x431c45=_0x431c45['substring'](0x0,_0x431c45[_0x082e('0x72')](_0x483a43));}if(!_0x4c01c9['refreshToken']){throw new Error(_0x082e('0x73'));}return getAccessToken(_0x4c01c9);})[_0x082e('0x1f')](function(_0xe71493){if(_0xe71493){return rp({'method':_0x082e('0x74'),'uri':util['format'](_0x082e('0x75'),_0x3dbb9e),'qs':{'module':'Calls'},'headers':{'Authorization':_0x082e('0x76')+_0xe71493},'json':!![]});}})[_0x082e('0x1f')](function(_0x85d77){if(_0x85d77){if(_0x85d77[_0x082e('0x77')]&&_0x85d77[_0x082e('0x77')]['error']){throw new Error(_0x85d77[_0x082e('0x77')][_0x082e('0x25')][_0x082e('0x28')]);}var _0x3bb222=[];var _0x18012c=[];var _0x2f3166=['Owner',_0x082e('0x78'),'Description',_0x082e('0x79'),'Call_Duration',_0x082e('0x7a'),_0x082e('0x7b'),'Call_Type'];_0x18012c=_[_0x082e('0x7c')](_0x85d77[_0x082e('0x43')],function(_0x3f5db9){return _0x2f3166[_0x082e('0x7d')](_0x3f5db9['api_name']);});for(var _0x155bd=0x0;_0x155bd<_0x18012c['length'];_0x155bd++){if(_0x18012c[_0x155bd][_0x082e('0x7e')]===![]){_0x3bb222[_0x082e('0x7f')]({'id':_0x18012c[_0x155bd]['id'],'name':_0x18012c[_0x155bd][_0x082e('0x80')],'custom':_0x18012c[_0x155bd][_0x082e('0x81')],'options':_0x18012c[_0x155bd]['data_type']===_0x082e('0x82')&&_0x18012c[_0x155bd][_0x082e('0x83')][_0x082e('0x59')]>-0x1?_[_0x082e('0x38')](_0x18012c[_0x155bd][_0x082e('0x83')],function(_0x16cd37){return{'name':_0x16cd37,'value':_0x16cd37};}):[]});}}return{'count':_0x3bb222[_0x082e('0x59')],'rows':_0x3bb222};}else{return{'count':0x0,'rows':[]};}})[_0x082e('0x1f')](respondWithResult(_0x15fc44,null))[_0x082e('0x51')](function(_0x19443b){var _0x3bb645=_0x412ce3[_0x082e('0x3f')]['test']?0x1f4:_0x19443b['statusCode']||0x1f4;logger[_0x082e('0x25')](_0x082e('0x84'),_0x082e('0x85'),_0x3bb645,JSON[_0x082e('0x24')](_0x19443b));delete _0x19443b['name'];if(_0x3bb645===0x191){_0x3bb645=0x190;}_0x15fc44['status'](_0x3bb645)['send'](_0x412ce3[_0x082e('0x3f')][_0x082e('0x1a')]?{'message':_0x082e('0x86'),'statusCode':_0x19443b[_0x082e('0x87')]}:_0x19443b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 39033e1..c6f56b6 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 _0x0ab6=['zone','parse','error','catch','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ZohoAccount','changed','serverUrl','code','host','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','application/x-www-form-urlencoded','then','refresh_token','refreshToken','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','clientSecret','slice'];(function(_0x530026,_0x58fd89){var _0x3bec31=function(_0x389c8a){while(--_0x389c8a){_0x530026['push'](_0x530026['shift']());}};_0x3bec31(++_0x58fd89);}(_0x0ab6,0x19e));var _0x60ab=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ab6[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x60ab('0x0'));var util=require(_0x60ab('0x1'));var logger=require(_0x60ab('0x2'))(_0x60ab('0x3'));var moment=require(_0x60ab('0x4'));var BPromise=require(_0x60ab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60ab('0x6'));var rimraf=require(_0x60ab('0x7'));var config=require(_0x60ab('0x8'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x60ab('0x9')]=function(_0x487103,_0x30a203){return _0x487103[_0x60ab('0xa')](_0x60ab('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x573e77,_0x4844d2,_0x296924){if(_0x573e77[_0x60ab('0xc')]('zone')||_0x573e77[_0x60ab('0xc')](_0x60ab('0xd'))||_0x573e77[_0x60ab('0xc')]('clientId')||_0x573e77[_0x60ab('0xc')]('clientSecret')||_0x573e77[_0x60ab('0xc')](_0x60ab('0xe'))||_0x573e77[_0x60ab('0xc')](_0x60ab('0xf'))){var _0x21411e,_0x2b3c34;_0x21411e=_0x573e77[_0x60ab('0xd')];var _0x2058a2=_0x21411e['slice'](-0x1);if(_0x2058a2==='/'||_0x2058a2==='\x5c'||_0x2058a2===':'){_0x21411e=_0x21411e[_0x60ab('0x10')](0x0,_0x21411e[_0x60ab('0x11')](_0x2058a2));}switch(_0x573e77['zone']){case'US':_0x2b3c34=_0x60ab('0x12');break;case'AU':_0x2b3c34=_0x60ab('0x13');break;case'IN':_0x2b3c34=_0x60ab('0x14');break;case'CN':_0x2b3c34=_0x60ab('0x15');break;default:_0x2b3c34=_0x60ab('0x16');break;}var _0x5b64cb={'method':_0x60ab('0x17'),'uri':_0x2b3c34+_0x60ab('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x573e77[_0x60ab('0x19')],'client_secret':_0x573e77['clientSecret'],'redirect_uri':_0x573e77[_0x60ab('0xd')],'code':_0x573e77[_0x60ab('0xe')]},'headers':{'Content-Type':_0x60ab('0x1a')}};return rp(_0x5b64cb)[_0x60ab('0x1b')](function(_0x94d50d){var _0x43f259=JSON['parse'](_0x94d50d);if(_0x43f259[_0x60ab('0x1c')]){_0x573e77[_0x60ab('0x1d')]=_0x43f259['refresh_token'];logger['info'](util[_0x60ab('0x1e')](_0x60ab('0x1f'),_0x573e77['name'],_0x573e77['id']));}else{logger['error'](util['format'](_0x60ab('0x20'),_0x573e77[_0x60ab('0x21')],_0x573e77['id']),util['inspect'](_0x43f259,{'showHidden':![],'depth':null}));}return _0x296924(null,_0x4844d2);})['catch'](function(_0x315178){logger['error'](util['format'](_0x60ab('0x20'),_0x573e77['name'],_0x573e77['id']),util[_0x60ab('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x296924(_0x315178);});}else{return _0x296924(null,_0x4844d2);}},'beforeUpdate':function(_0x5ce3f4,_0x2e2e1c,_0x30a85c){if(_0x5ce3f4[_0x60ab('0xc')]('zone')||_0x5ce3f4[_0x60ab('0xc')]('serverUrl')||_0x5ce3f4[_0x60ab('0xc')](_0x60ab('0x19'))||_0x5ce3f4[_0x60ab('0xc')](_0x60ab('0x23'))||_0x5ce3f4[_0x60ab('0xc')](_0x60ab('0xe'))||_0x5ce3f4[_0x60ab('0xc')](_0x60ab('0xf'))){var _0x552dbc,_0x390252;_0x552dbc=_0x5ce3f4['serverUrl'];var _0x2b46d8=_0x552dbc[_0x60ab('0x24')](-0x1);if(_0x2b46d8==='/'||_0x2b46d8==='\x5c'||_0x2b46d8===':'){_0x552dbc=_0x552dbc[_0x60ab('0x10')](0x0,_0x552dbc['lastIndexOf'](_0x2b46d8));}switch(_0x5ce3f4[_0x60ab('0x25')]){case'US':_0x390252=_0x60ab('0x12');break;case'AU':_0x390252=_0x60ab('0x13');break;case'IN':_0x390252=_0x60ab('0x14');break;case'CN':_0x390252=_0x60ab('0x15');break;default:_0x390252=_0x60ab('0x16');break;}var _0x2812d0={'method':_0x60ab('0x17'),'uri':_0x390252+_0x60ab('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x5ce3f4[_0x60ab('0x19')],'client_secret':_0x5ce3f4['clientSecret'],'redirect_uri':_0x5ce3f4['serverUrl'],'code':_0x5ce3f4[_0x60ab('0xe')]},'headers':{'Content-Type':_0x60ab('0x1a')}};return rp(_0x2812d0)[_0x60ab('0x1b')](function(_0x3a0a49){var _0x442dfe=JSON[_0x60ab('0x26')](_0x3a0a49);if(_0x442dfe[_0x60ab('0x1c')]){_0x5ce3f4[_0x60ab('0x1d')]=_0x442dfe[_0x60ab('0x1c')];logger['info'](util['format'](_0x60ab('0x1f'),_0x5ce3f4[_0x60ab('0x21')],_0x5ce3f4['id']));}else{logger[_0x60ab('0x27')](util[_0x60ab('0x1e')](_0x60ab('0x20'),_0x5ce3f4[_0x60ab('0x21')],_0x5ce3f4['id']),util[_0x60ab('0x22')](_0x442dfe,{'showHidden':![],'depth':null}));}return _0x30a85c(null,_0x2e2e1c);})[_0x60ab('0x28')](function(_0x43941c){logger[_0x60ab('0x27')](util[_0x60ab('0x1e')](_0x60ab('0x20'),_0x5ce3f4[_0x60ab('0x21')],_0x5ce3f4['id']),util[_0x60ab('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x30a85c(_0x43941c);});}else{return _0x30a85c(null,_0x2e2e1c);}}}});}; \ No newline at end of file +var _0xfdb4=['inspect','catch','name','slice','substring','https://accounts.zoho.eu','then','lodash','util','../../config/logger','moment','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x422faf,_0x6967d5){var _0x341573=function(_0x5d2f0e){while(--_0x5d2f0e){_0x422faf['push'](_0x422faf['shift']());}};_0x341573(++_0x6967d5);}(_0xfdb4,0x88));var _0x4fdb=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xfdb4[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0x4fdb('0x0'));var util=require(_0x4fdb('0x1'));var logger=require(_0x4fdb('0x2'))('api');var moment=require(_0x4fdb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fdb('0x4'));var rimraf=require('rimraf');var config=require(_0x4fdb('0x5'));var attributes=require(_0x4fdb('0x6'));var integrations=require(_0x4fdb('0x7'));module[_0x4fdb('0x8')]=function(_0x386b96,_0x1c6c11){return _0x386b96[_0x4fdb('0x9')](_0x4fdb('0xa'),attributes,{'tableName':_0x4fdb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x268d53,_0x38b8e1,_0x31cc6d){if(_0x268d53[_0x4fdb('0xc')]('zone')||_0x268d53[_0x4fdb('0xc')](_0x4fdb('0xd'))||_0x268d53[_0x4fdb('0xc')](_0x4fdb('0xe'))||_0x268d53[_0x4fdb('0xc')](_0x4fdb('0xf'))||_0x268d53[_0x4fdb('0xc')](_0x4fdb('0x10'))||_0x268d53[_0x4fdb('0xc')](_0x4fdb('0x11'))){var _0x20c8d2,_0x3fe01d;_0x20c8d2=_0x268d53[_0x4fdb('0xd')];var _0x2bad87=_0x20c8d2['slice'](-0x1);if(_0x2bad87==='/'||_0x2bad87==='\x5c'||_0x2bad87===':'){_0x20c8d2=_0x20c8d2['substring'](0x0,_0x20c8d2[_0x4fdb('0x12')](_0x2bad87));}switch(_0x268d53[_0x4fdb('0x13')]){case'US':_0x3fe01d=_0x4fdb('0x14');break;case'AU':_0x3fe01d=_0x4fdb('0x15');break;case'IN':_0x3fe01d=_0x4fdb('0x16');break;case'CN':_0x3fe01d=_0x4fdb('0x17');break;default:_0x3fe01d='https://accounts.zoho.eu';break;}var _0x62c131={'method':_0x4fdb('0x18'),'uri':_0x3fe01d+_0x4fdb('0x19'),'form':{'grant_type':_0x4fdb('0x1a'),'client_id':_0x268d53['clientId'],'client_secret':_0x268d53[_0x4fdb('0xf')],'redirect_uri':_0x268d53[_0x4fdb('0xd')],'code':_0x268d53['code']},'headers':{'Content-Type':_0x4fdb('0x1b')}};return rp(_0x62c131)['then'](function(_0x571721){var _0x4351c6=JSON[_0x4fdb('0x1c')](_0x571721);if(_0x4351c6['refresh_token']){_0x268d53[_0x4fdb('0x1d')]=_0x4351c6[_0x4fdb('0x1e')];logger[_0x4fdb('0x1f')](util[_0x4fdb('0x20')](_0x4fdb('0x21'),_0x268d53['name'],_0x268d53['id']));}else{logger[_0x4fdb('0x22')](util[_0x4fdb('0x20')](_0x4fdb('0x23'),_0x268d53['name'],_0x268d53['id']),util[_0x4fdb('0x24')](_0x4351c6,{'showHidden':![],'depth':null}));}return _0x31cc6d(null,_0x38b8e1);})[_0x4fdb('0x25')](function(_0x27c8a4){logger[_0x4fdb('0x22')](util[_0x4fdb('0x20')](_0x4fdb('0x23'),_0x268d53[_0x4fdb('0x26')],_0x268d53['id']),util[_0x4fdb('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x31cc6d(_0x27c8a4);});}else{return _0x31cc6d(null,_0x38b8e1);}},'beforeUpdate':function(_0x4b7e1b,_0x349249,_0x2cc089){if(_0x4b7e1b[_0x4fdb('0xc')](_0x4fdb('0x13'))||_0x4b7e1b['changed'](_0x4fdb('0xd'))||_0x4b7e1b[_0x4fdb('0xc')]('clientId')||_0x4b7e1b[_0x4fdb('0xc')]('clientSecret')||_0x4b7e1b['changed'](_0x4fdb('0x10'))||_0x4b7e1b[_0x4fdb('0xc')](_0x4fdb('0x11'))){var _0x1dc67e,_0x119b38;_0x1dc67e=_0x4b7e1b[_0x4fdb('0xd')];var _0x1cab50=_0x1dc67e[_0x4fdb('0x27')](-0x1);if(_0x1cab50==='/'||_0x1cab50==='\x5c'||_0x1cab50===':'){_0x1dc67e=_0x1dc67e[_0x4fdb('0x28')](0x0,_0x1dc67e[_0x4fdb('0x12')](_0x1cab50));}switch(_0x4b7e1b[_0x4fdb('0x13')]){case'US':_0x119b38=_0x4fdb('0x14');break;case'AU':_0x119b38=_0x4fdb('0x15');break;case'IN':_0x119b38=_0x4fdb('0x16');break;case'CN':_0x119b38=_0x4fdb('0x17');break;default:_0x119b38=_0x4fdb('0x29');break;}var _0x59a960={'method':'POST','uri':_0x119b38+_0x4fdb('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x4b7e1b[_0x4fdb('0xe')],'client_secret':_0x4b7e1b[_0x4fdb('0xf')],'redirect_uri':_0x4b7e1b[_0x4fdb('0xd')],'code':_0x4b7e1b[_0x4fdb('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x59a960)[_0x4fdb('0x2a')](function(_0x516086){var _0x5b87a9=JSON['parse'](_0x516086);if(_0x5b87a9['refresh_token']){_0x4b7e1b[_0x4fdb('0x1d')]=_0x5b87a9[_0x4fdb('0x1e')];logger[_0x4fdb('0x1f')](util[_0x4fdb('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4b7e1b[_0x4fdb('0x26')],_0x4b7e1b['id']));}else{logger['error'](util['format'](_0x4fdb('0x23'),_0x4b7e1b['name'],_0x4b7e1b['id']),util[_0x4fdb('0x24')](_0x5b87a9,{'showHidden':![],'depth':null}));}return _0x2cc089(null,_0x349249);})[_0x4fdb('0x25')](function(_0x405243){logger[_0x4fdb('0x22')](util[_0x4fdb('0x20')](_0x4fdb('0x23'),_0x4b7e1b[_0x4fdb('0x26')],_0x4b7e1b['id']),util[_0x4fdb('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x2cc089(_0x405243);});}else{return _0x2cc089(null,_0x349249);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 813041d..a54681d 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 _0xe66a=['include','map','model','then','GetZohoAccount','debug','stringify','ZohoAccount','find','raw','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','findAll','options','attributes'];(function(_0x1e9aed,_0x23c5be){var _0x3a8c81=function(_0x3e7d97){while(--_0x3e7d97){_0x1e9aed['push'](_0x1e9aed['shift']());}};_0x3a8c81(++_0x23c5be);}(_0xe66a,0x9b));var _0xae66=function(_0x5936ad,_0x199c60){_0x5936ad=_0x5936ad-0x0;var _0x26bed2=_0xe66a[_0x5936ad];return _0x26bed2;};'use strict';var _=require(_0xae66('0x0'));var util=require(_0xae66('0x1'));var moment=require(_0xae66('0x2'));var BPromise=require(_0xae66('0x3'));var rs=require(_0xae66('0x4'));var fs=require('fs');var Redis=require(_0xae66('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xae66('0x6'));var logger=require('../../config/logger')(_0xae66('0x7'));var config=require(_0xae66('0x8'));var jayson=require(_0xae66('0x9'));var client=jayson[_0xae66('0xa')][_0xae66('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f55e2,_0x3b702f,_0x3f705d){return new BPromise(function(_0xd1ecd3,_0x256849){return client[_0xae66('0xc')](_0x4f55e2,_0x3f705d)['then'](function(_0x83739){logger['info'](_0xae66('0xd'),_0x3b702f,_0xae66('0xe'));logger['debug'](_0xae66('0xf'),_0x3b702f,_0xae66('0xe'),JSON['stringify'](_0x83739));if(_0x83739[_0xae66('0x10')]){if(_0x83739[_0xae66('0x10')][_0xae66('0x11')]===0x1f4){logger[_0xae66('0x10')](_0xae66('0xd'),_0x3b702f,_0x83739['error'][_0xae66('0x12')]);return _0x256849(_0x83739[_0xae66('0x10')][_0xae66('0x12')]);}logger[_0xae66('0x10')](_0xae66('0xd'),_0x3b702f,_0x83739[_0xae66('0x10')][_0xae66('0x12')]);return _0xd1ecd3(_0x83739[_0xae66('0x10')]['message']);}else{logger[_0xae66('0x13')](_0xae66('0xd'),_0x3b702f,'request\x20sent');_0xd1ecd3(_0x83739[_0xae66('0x14')][_0xae66('0x12')]);}})[_0xae66('0x15')](function(_0x22006c){logger[_0xae66('0x10')]('ZohoAccount,\x20%s,\x20%s',_0x3b702f,_0x22006c);_0x256849(_0x22006c);});});}exports['GetZohoAccount']=function(_0x2de165){var _0x193a0b=this;return new Promise(function(_0x1b0563,_0x189d0f){return db['ZohoAccount'][_0xae66('0x16')]({'raw':_0x2de165['options']?_0x2de165['options']['raw']===undefined?!![]:![]:!![],'where':_0x2de165[_0xae66('0x17')]?_0x2de165['options']['where']||null:null,'attributes':_0x2de165['options']?_0x2de165[_0xae66('0x17')][_0xae66('0x18')]||null:null,'limit':_0x2de165['options']?_0x2de165['options']['limit']||null:null,'include':_0x2de165[_0xae66('0x17')]?_0x2de165[_0xae66('0x17')]['include']?_['map'](_0x2de165[_0xae66('0x17')][_0xae66('0x19')],function(_0x17888c){return{'model':db[_0x17888c['model']],'as':_0x17888c['as'],'attributes':_0x17888c[_0xae66('0x18')],'include':_0x17888c['include']?_[_0xae66('0x1a')](_0x17888c['include'],function(_0x1e4430){return{'model':db[_0x1e4430['model']],'as':_0x1e4430['as'],'attributes':_0x1e4430[_0xae66('0x18')],'include':_0x1e4430[_0xae66('0x19')]?_[_0xae66('0x1a')](_0x1e4430[_0xae66('0x19')],function(_0x38fb04){return{'model':db[_0x38fb04[_0xae66('0x1b')]],'as':_0x38fb04['as'],'attributes':_0x38fb04[_0xae66('0x18')]};}):[]};}):[]};}):[]:[]})[_0xae66('0x1c')](function(_0xdf7151){logger[_0xae66('0x13')](_0xae66('0x1d'),_0x2de165);logger[_0xae66('0x1e')](_0xae66('0x1d'),_0x2de165,JSON[_0xae66('0x1f')](_0xdf7151));_0x1b0563(_0xdf7151);})[_0xae66('0x15')](function(_0x5ade55){logger['error'](_0xae66('0x1d'),_0x5ade55[_0xae66('0x12')],_0x2de165);_0x189d0f(_0x193a0b[_0xae66('0x10')](0x1f4,_0x5ade55[_0xae66('0x12')]));});});};exports['ShowZohoAccount']=function(_0x3aefda){var _0x41f29c=this;return new Promise(function(_0x55b25a,_0x57c0ff){return db[_0xae66('0x20')][_0xae66('0x21')]({'raw':_0x3aefda[_0xae66('0x17')]?_0x3aefda['options'][_0xae66('0x22')]===undefined?!![]:![]:!![],'where':_0x3aefda[_0xae66('0x17')]?_0x3aefda['options']['where']||null:null,'attributes':_0x3aefda[_0xae66('0x17')]?_0x3aefda[_0xae66('0x17')]['attributes']||null:null,'include':_0x3aefda[_0xae66('0x17')]?_0x3aefda[_0xae66('0x17')]['include']?_['map'](_0x3aefda[_0xae66('0x17')][_0xae66('0x19')],function(_0xb90ded){return{'model':db[_0xb90ded['model']],'as':_0xb90ded['as'],'attributes':_0xb90ded['attributes'],'include':_0xb90ded[_0xae66('0x19')]?_[_0xae66('0x1a')](_0xb90ded[_0xae66('0x19')],function(_0x1e4a4d){return{'model':db[_0x1e4a4d['model']],'as':_0x1e4a4d['as'],'attributes':_0x1e4a4d['attributes'],'include':_0x1e4a4d[_0xae66('0x19')]?_[_0xae66('0x1a')](_0x1e4a4d[_0xae66('0x19')],function(_0x161a73){return{'model':db[_0x161a73['model']],'as':_0x161a73['as'],'attributes':_0x161a73[_0xae66('0x18')]};}):[]};}):[]};}):[]:[]})[_0xae66('0x1c')](function(_0x4b7092){logger[_0xae66('0x13')]('ShowZohoAccount',_0x3aefda);logger[_0xae66('0x1e')](_0xae66('0x23'),_0x3aefda,JSON[_0xae66('0x1f')](_0x4b7092));_0x55b25a(_0x4b7092);})[_0xae66('0x15')](function(_0x36808c){logger[_0xae66('0x10')](_0xae66('0x23'),_0x36808c[_0xae66('0x12')],_0x3aefda);_0x57c0ff(_0x41f29c[_0xae66('0x10')](0x1f4,_0x36808c[_0xae66('0x12')]));});});}; \ No newline at end of file +var _0x7aad=['attributes','GetZohoAccount','ShowZohoAccount','find','map','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount,\x20%s,\x20%s','result','catch','ZohoAccount','findAll','options','raw','where','include','model'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7aad,0x1e1));var _0xd7aa=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7aad[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0xd7aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd7aa('0x1'));var rs=require(_0xd7aa('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7aa('0x3'))['db'];var utils=require(_0xd7aa('0x4'));var logger=require('../../config/logger')(_0xd7aa('0x5'));var config=require(_0xd7aa('0x6'));var jayson=require(_0xd7aa('0x7'));var client=jayson[_0xd7aa('0x8')][_0xd7aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21bbca,_0x47e208,_0x352d93){return new BPromise(function(_0x36efec,_0x282498){return client[_0xd7aa('0xa')](_0x21bbca,_0x352d93)[_0xd7aa('0xb')](function(_0x42f83c){logger[_0xd7aa('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x47e208,_0xd7aa('0xd'));logger[_0xd7aa('0xe')](_0xd7aa('0xf'),_0x47e208,'request\x20sent',JSON[_0xd7aa('0x10')](_0x42f83c));if(_0x42f83c[_0xd7aa('0x11')]){if(_0x42f83c[_0xd7aa('0x11')]['code']===0x1f4){logger[_0xd7aa('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x47e208,_0x42f83c[_0xd7aa('0x11')][_0xd7aa('0x12')]);return _0x282498(_0x42f83c[_0xd7aa('0x11')][_0xd7aa('0x12')]);}logger['error'](_0xd7aa('0x13'),_0x47e208,_0x42f83c[_0xd7aa('0x11')][_0xd7aa('0x12')]);return _0x36efec(_0x42f83c['error'][_0xd7aa('0x12')]);}else{logger[_0xd7aa('0xc')](_0xd7aa('0x13'),_0x47e208,_0xd7aa('0xd'));_0x36efec(_0x42f83c[_0xd7aa('0x14')][_0xd7aa('0x12')]);}})[_0xd7aa('0x15')](function(_0x5f4eb3){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x47e208,_0x5f4eb3);_0x282498(_0x5f4eb3);});});}exports['GetZohoAccount']=function(_0x3d0266){var _0x1c1d55=this;return new Promise(function(_0x59313a,_0x1d9a81){return db[_0xd7aa('0x16')][_0xd7aa('0x17')]({'raw':_0x3d0266[_0xd7aa('0x18')]?_0x3d0266[_0xd7aa('0x18')][_0xd7aa('0x19')]===undefined?!![]:![]:!![],'where':_0x3d0266[_0xd7aa('0x18')]?_0x3d0266[_0xd7aa('0x18')][_0xd7aa('0x1a')]||null:null,'attributes':_0x3d0266[_0xd7aa('0x18')]?_0x3d0266[_0xd7aa('0x18')]['attributes']||null:null,'limit':_0x3d0266['options']?_0x3d0266[_0xd7aa('0x18')]['limit']||null:null,'include':_0x3d0266[_0xd7aa('0x18')]?_0x3d0266[_0xd7aa('0x18')][_0xd7aa('0x1b')]?_['map'](_0x3d0266[_0xd7aa('0x18')][_0xd7aa('0x1b')],function(_0x6cebe0){return{'model':db[_0x6cebe0[_0xd7aa('0x1c')]],'as':_0x6cebe0['as'],'attributes':_0x6cebe0[_0xd7aa('0x1d')],'include':_0x6cebe0[_0xd7aa('0x1b')]?_['map'](_0x6cebe0[_0xd7aa('0x1b')],function(_0x285952){return{'model':db[_0x285952[_0xd7aa('0x1c')]],'as':_0x285952['as'],'attributes':_0x285952[_0xd7aa('0x1d')],'include':_0x285952[_0xd7aa('0x1b')]?_['map'](_0x285952[_0xd7aa('0x1b')],function(_0x542a9e){return{'model':db[_0x542a9e['model']],'as':_0x542a9e['as'],'attributes':_0x542a9e['attributes']};}):[]};}):[]};}):[]:[]})[_0xd7aa('0xb')](function(_0x542793){logger['info'](_0xd7aa('0x1e'),_0x3d0266);logger['debug'](_0xd7aa('0x1e'),_0x3d0266,JSON[_0xd7aa('0x10')](_0x542793));_0x59313a(_0x542793);})[_0xd7aa('0x15')](function(_0x192b40){logger[_0xd7aa('0x11')](_0xd7aa('0x1e'),_0x192b40[_0xd7aa('0x12')],_0x3d0266);_0x1d9a81(_0x1c1d55[_0xd7aa('0x11')](0x1f4,_0x192b40[_0xd7aa('0x12')]));});});};exports[_0xd7aa('0x1f')]=function(_0x5dca3d){var _0x190438=this;return new Promise(function(_0x30be9c,_0x2f7fd6){return db[_0xd7aa('0x16')][_0xd7aa('0x20')]({'raw':_0x5dca3d['options']?_0x5dca3d[_0xd7aa('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5dca3d['options']?_0x5dca3d[_0xd7aa('0x18')][_0xd7aa('0x1a')]||null:null,'attributes':_0x5dca3d[_0xd7aa('0x18')]?_0x5dca3d[_0xd7aa('0x18')][_0xd7aa('0x1d')]||null:null,'include':_0x5dca3d['options']?_0x5dca3d[_0xd7aa('0x18')][_0xd7aa('0x1b')]?_['map'](_0x5dca3d[_0xd7aa('0x18')][_0xd7aa('0x1b')],function(_0x2653c3){return{'model':db[_0x2653c3[_0xd7aa('0x1c')]],'as':_0x2653c3['as'],'attributes':_0x2653c3['attributes'],'include':_0x2653c3[_0xd7aa('0x1b')]?_[_0xd7aa('0x21')](_0x2653c3[_0xd7aa('0x1b')],function(_0x47adea){return{'model':db[_0x47adea[_0xd7aa('0x1c')]],'as':_0x47adea['as'],'attributes':_0x47adea[_0xd7aa('0x1d')],'include':_0x47adea[_0xd7aa('0x1b')]?_[_0xd7aa('0x21')](_0x47adea[_0xd7aa('0x1b')],function(_0x2bdd2d){return{'model':db[_0x2bdd2d['model']],'as':_0x2bdd2d['as'],'attributes':_0x2bdd2d[_0xd7aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd7aa('0xb')](function(_0x4612ea){logger[_0xd7aa('0xc')](_0xd7aa('0x1f'),_0x5dca3d);logger['debug']('ShowZohoAccount',_0x5dca3d,JSON[_0xd7aa('0x10')](_0x4612ea));_0x30be9c(_0x4612ea);})[_0xd7aa('0x15')](function(_0xad91dc){logger[_0xd7aa('0x11')](_0xd7aa('0x1f'),_0xad91dc[_0xd7aa('0x12')],_0x5dca3d);_0x2f7fd6(_0x190438[_0xd7aa('0x11')](0x1f4,_0xad91dc[_0xd7aa('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index a4926f0..dc7b2e7 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 _0x7269=['get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller'];(function(_0x1a44a3,_0x415cd1){var _0x342d96=function(_0x5bb5a6){while(--_0x5bb5a6){_0x1a44a3['push'](_0x1a44a3['shift']());}};_0x342d96(++_0x415cd1);}(_0x7269,0x76));var _0x9726=function(_0x4d41e8,_0x58544d){_0x4d41e8=_0x4d41e8-0x0;var _0x474150=_0x7269[_0x4d41e8];return _0x474150;};'use strict';var multer=require(_0x9726('0x0'));var util=require(_0x9726('0x1'));var path=require(_0x9726('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9726('0x3')]();var auth=require(_0x9726('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9726('0x5'));var controller=require(_0x9726('0x6'));router[_0x9726('0x7')]('/',auth[_0x9726('0x8')](),controller[_0x9726('0x9')]);router[_0x9726('0x7')](_0x9726('0xa'),auth[_0x9726('0x8')](),controller[_0x9726('0xb')]);router['get'](_0x9726('0xc'),auth['isAuthenticated'](),controller[_0x9726('0xd')]);router[_0x9726('0x7')](_0x9726('0xe'),auth['isAuthenticated'](),controller[_0x9726('0xf')]);router[_0x9726('0x7')](_0x9726('0x10'),auth['isAuthenticated'](),controller[_0x9726('0x11')]);router[_0x9726('0x12')]('/',auth[_0x9726('0x8')](),controller[_0x9726('0x13')]);router[_0x9726('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x9726('0x15')]);router[_0x9726('0x16')]('/:id',auth[_0x9726('0x8')](),controller[_0x9726('0x17')]);module[_0x9726('0x18')]=router; \ No newline at end of file +var _0x6d2d=['/:id','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x2130f2,_0x1df01f){var _0x358d2f=function(_0x3744e2){while(--_0x3744e2){_0x2130f2['push'](_0x2130f2['shift']());}};_0x358d2f(++_0x1df01f);}(_0x6d2d,0xbc));var _0xd6d2=function(_0x53c8cb,_0x73348b){_0x53c8cb=_0x53c8cb-0x0;var _0x2ebc37=_0x6d2d[_0x53c8cb];return _0x2ebc37;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd6d2('0x0'));var timeout=require(_0xd6d2('0x1'));var express=require(_0xd6d2('0x2'));var router=express['Router']();var auth=require(_0xd6d2('0x3'));var interaction=require(_0xd6d2('0x4'));var config=require(_0xd6d2('0x5'));var controller=require(_0xd6d2('0x6'));router[_0xd6d2('0x7')]('/',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x9')]);router[_0xd6d2('0x7')]('/:id',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0xa')]);router[_0xd6d2('0x7')]('/:id/fields',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0xb')]);router[_0xd6d2('0x7')](_0xd6d2('0xc'),auth[_0xd6d2('0x8')](),controller[_0xd6d2('0xd')]);router[_0xd6d2('0x7')](_0xd6d2('0xe'),auth['isAuthenticated'](),controller[_0xd6d2('0xf')]);router[_0xd6d2('0x10')]('/',auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x11')]);router[_0xd6d2('0x12')](_0xd6d2('0x13'),auth[_0xd6d2('0x8')](),controller['update']);router[_0xd6d2('0x14')](_0xd6d2('0x13'),auth[_0xd6d2('0x8')](),controller[_0xd6d2('0x15')]);module[_0xd6d2('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index da756fe..4256857 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 _0x68dc=['contact','contact_lead','sequelize','exports','STRING','ENUM','lead'];(function(_0x4ed7b1,_0x321543){var _0x5dfe21=function(_0x4b1d59){while(--_0x4b1d59){_0x4ed7b1['push'](_0x4ed7b1['shift']());}};_0x5dfe21(++_0x321543);}(_0x68dc,0x1a6));var _0xc68d=function(_0x58c20f,_0x4cdb1b){_0x58c20f=_0x58c20f-0x0;var _0x3b0318=_0x68dc[_0x58c20f];return _0x3b0318;};'use strict';var Sequelize=require(_0xc68d('0x0'));module[_0xc68d('0x1')]={'name':{'type':Sequelize[_0xc68d('0x2')]},'moduleCreate':{'type':Sequelize[_0xc68d('0x3')](_0xc68d('0x4'),_0xc68d('0x5'),'nothing'),'defaultValue':_0xc68d('0x4')},'moduleSearch':{'type':Sequelize[_0xc68d('0x3')](_0xc68d('0x6'),_0xc68d('0x5'),_0xc68d('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xc68d('0x2')]}}; \ No newline at end of file +var _0x36de=['exports','ENUM','lead','nothing','contact_lead','contact','STRING','sequelize'];(function(_0x1b38ec,_0x13ec29){var _0x523f01=function(_0x17424a){while(--_0x17424a){_0x1b38ec['push'](_0x1b38ec['shift']());}};_0x523f01(++_0x13ec29);}(_0x36de,0xe7));var _0xe36d=function(_0x2bf521,_0x3e6103){_0x2bf521=_0x2bf521-0x0;var _0x1ca2e4=_0x36de[_0x2bf521];return _0x1ca2e4;};'use strict';var Sequelize=require(_0xe36d('0x0'));module[_0xe36d('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xe36d('0x2')](_0xe36d('0x3'),'contact',_0xe36d('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xe36d('0x2')](_0xe36d('0x5'),_0xe36d('0x6'),_0xe36d('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xe36d('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 7afc8a6..1dc0714 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 _0x9957=['result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','name','send','index','ZohoConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','pick','filter','where','merge','type','options','includeAll','findAll','rows','show','params','find','create','body','getFields','findOne','ZohoField','sort','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message'];(function(_0x50433d,_0x1d79bf){var _0x55e0e9=function(_0x1cea89){while(--_0x1cea89){_0x50433d['push'](_0x50433d['shift']());}};_0x55e0e9(++_0x1d79bf);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('ZohoConfiguration,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('ZohoConfiguration,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){_0x510841['status'](0xcc)[_0x7995('0x2d')]();});}};}function handleEntityNotFound(_0x3acfc3,_0x4a176f){return function(_0x3e7020){if(!_0x3e7020){_0x3acfc3['sendStatus'](0x194);}return _0x3e7020;};}function handleError(_0x37917b,_0x1cb058){_0x1cb058=_0x1cb058||0x1f4;return function(_0x177cb4){logger['error'](_0x177cb4['stack']);if(_0x177cb4[_0x7995('0x36')]){delete _0x177cb4['name'];}_0x37917b['status'](_0x1cb058)[_0x7995('0x37')](_0x177cb4);};}exports[_0x7995('0x38')]=function(_0x5212ff,_0x1baa15){var _0x1922b4={},_0x2b772f={},_0x18667c={'count':0x0,'rows':[]};var _0x1e3dbf=_['map'](db[_0x7995('0x39')][_0x7995('0x3a')],function(_0xf612e6){return{'name':_0xf612e6[_0x7995('0x3b')],'type':_0xf612e6['type'][_0x7995('0x3c')]};});_0x2b772f[_0x7995('0x3d')]=_[_0x7995('0x3e')](_0x1e3dbf,_0x7995('0x36'));_0x2b772f[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x5212ff['query']);_0x2b772f[_0x7995('0x41')]=_[_0x7995('0x42')](_0x2b772f[_0x7995('0x3d')],_0x2b772f[_0x7995('0x3f')]);_0x1922b4[_0x7995('0x43')]=_[_0x7995('0x42')](_0x2b772f[_0x7995('0x3d')],qs[_0x7995('0x44')](_0x5212ff[_0x7995('0x3f')][_0x7995('0x44')]));_0x1922b4[_0x7995('0x43')]=_0x1922b4[_0x7995('0x43')][_0x7995('0x45')]?_0x1922b4['attributes']:_0x2b772f['model'];if(!_0x5212ff[_0x7995('0x3f')][_0x7995('0x46')]('nolimit')){_0x1922b4['limit']=qs[_0x7995('0x47')](_0x5212ff['query']['limit']);_0x1922b4[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x5212ff[_0x7995('0x3f')]['offset']);}_0x1922b4[_0x7995('0x48')]=qs['sort'](_0x5212ff[_0x7995('0x3f')]['sort']);_0x1922b4['where']=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x5212ff[_0x7995('0x3f')],_0x2b772f[_0x7995('0x41')]));if(_0x5212ff['query'][_0x7995('0x4a')]){_0x1922b4[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x1922b4[_0x7995('0x4b')],{'$or':_['map'](_0x1e3dbf,function(_0x5f28e7){if(_0x5f28e7[_0x7995('0x4d')]!=='VIRTUAL'){var _0x23c41d={};_0x23c41d[_0x5f28e7['name']]={'$like':'%'+_0x5212ff[_0x7995('0x3f')]['filter']+'%'};return _0x23c41d;}})});}_0x1922b4=_[_0x7995('0x4c')]({},_0x1922b4,_0x5212ff[_0x7995('0x4e')]);var _0x4d9245={'where':_0x1922b4[_0x7995('0x4b')]};return db[_0x7995('0x39')][_0x7995('0x2f')](_0x4d9245)[_0x7995('0x20')](function(_0x4c6837){_0x18667c[_0x7995('0x2f')]=_0x4c6837;if(_0x5212ff[_0x7995('0x3f')][_0x7995('0x4f')]){_0x1922b4['include']=[{'all':!![]}];}return db[_0x7995('0x39')][_0x7995('0x50')](_0x1922b4);})[_0x7995('0x20')](function(_0x3d8ae3){_0x18667c[_0x7995('0x51')]=_0x3d8ae3;return _0x18667c;})['then'](respondWithFilteredResult(_0x1baa15,_0x1922b4))[_0x7995('0x2a')](handleError(_0x1baa15,null));};exports[_0x7995('0x52')]=function(_0x5921b9,_0x3d1dbb){var _0x5843ba={'raw':![],'where':{'id':_0x5921b9[_0x7995('0x53')]['id']}},_0x1d87f9={};_0x1d87f9[_0x7995('0x3d')]=_[_0x7995('0x40')](db[_0x7995('0x39')][_0x7995('0x3a')]);_0x1d87f9[_0x7995('0x3f')]=_['keys'](_0x5921b9[_0x7995('0x3f')]);_0x1d87f9[_0x7995('0x41')]=_[_0x7995('0x42')](_0x1d87f9['model'],_0x1d87f9[_0x7995('0x3f')]);_0x5843ba[_0x7995('0x43')]=_[_0x7995('0x42')](_0x1d87f9['model'],qs['fields'](_0x5921b9['query'][_0x7995('0x44')]));_0x5843ba[_0x7995('0x43')]=_0x5843ba['attributes'][_0x7995('0x45')]?_0x5843ba[_0x7995('0x43')]:_0x1d87f9[_0x7995('0x3d')];if(_0x5921b9[_0x7995('0x3f')][_0x7995('0x4f')]){_0x5843ba['include']=[{'all':!![]}];}_0x5843ba=_[_0x7995('0x4c')]({},_0x5843ba,_0x5921b9['options']);return db[_0x7995('0x39')][_0x7995('0x54')](_0x5843ba)[_0x7995('0x20')](handleEntityNotFound(_0x3d1dbb,null))['then'](respondWithResult(_0x3d1dbb,null))['catch'](handleError(_0x3d1dbb,null));};exports['create']=function(_0x563f8e,_0x2e13b0){return db[_0x7995('0x39')][_0x7995('0x55')](_0x563f8e[_0x7995('0x56')],{})[_0x7995('0x20')](respondWithResult(_0x2e13b0,0xc9))[_0x7995('0x2a')](handleError(_0x2e13b0,null));};exports[_0x7995('0x35')]=function(_0xda6ce8,_0x328671){if(_0xda6ce8[_0x7995('0x56')]['id']){delete _0xda6ce8[_0x7995('0x56')]['id'];}return db[_0x7995('0x39')][_0x7995('0x54')]({'where':{'id':_0xda6ce8[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x328671,null))[_0x7995('0x20')](saveUpdates(_0xda6ce8[_0x7995('0x56')],null))[_0x7995('0x20')](respondWithResult(_0x328671,null))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['destroy']=function(_0x56a374,_0x630737){return db[_0x7995('0x39')][_0x7995('0x54')]({'where':{'id':_0x56a374['params']['id']}})['then'](handleEntityNotFound(_0x630737,null))[_0x7995('0x20')](removeEntity(_0x630737,null))[_0x7995('0x2a')](handleError(_0x630737,null));};exports[_0x7995('0x57')]=function(_0x332a85,_0x51c50b,_0x13cd7b){var _0x74ff38={};var _0xef5044={};var _0x33c49c;var _0x502d43;return db['ZohoConfiguration'][_0x7995('0x58')]({'where':{'id':_0x332a85[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x51c50b,null))[_0x7995('0x20')](function(_0x37072){if(_0x37072){_0x33c49c=_0x37072;_0xef5044[_0x7995('0x3d')]=_[_0x7995('0x40')](db[_0x7995('0x59')][_0x7995('0x3a')]);_0xef5044['query']=_[_0x7995('0x40')](_0x332a85[_0x7995('0x3f')]);_0xef5044[_0x7995('0x41')]=_[_0x7995('0x42')](_0xef5044['model'],_0xef5044['query']);_0x74ff38[_0x7995('0x43')]=_[_0x7995('0x42')](_0xef5044['model'],qs[_0x7995('0x44')](_0x332a85[_0x7995('0x3f')][_0x7995('0x44')]));_0x74ff38[_0x7995('0x43')]=_0x74ff38[_0x7995('0x43')]['length']?_0x74ff38[_0x7995('0x43')]:_0xef5044['model'];_0x74ff38[_0x7995('0x48')]=qs[_0x7995('0x5a')](_0x332a85[_0x7995('0x3f')][_0x7995('0x5a')]);_0x74ff38[_0x7995('0x4b')]=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x332a85[_0x7995('0x3f')],_0xef5044[_0x7995('0x41')]));if(_0x332a85[_0x7995('0x3f')][_0x7995('0x4a')]){_0x74ff38[_0x7995('0x4b')]=_['merge'](_0x74ff38[_0x7995('0x4b')],{'$or':_[_0x7995('0x3e')](_0x74ff38[_0x7995('0x43')],function(_0xc2b660){var _0x2c6548={};_0x2c6548[_0xc2b660]={'$like':'%'+_0x332a85['query']['filter']+'%'};return _0x2c6548;})});}_0x74ff38=_[_0x7995('0x4c')]({},_0x74ff38,_0x332a85[_0x7995('0x4e')]);return _0x33c49c[_0x7995('0x57')](_0x74ff38);}})[_0x7995('0x20')](function(_0x5aa2ec){if(_0x5aa2ec){_0x502d43=_0x5aa2ec[_0x7995('0x45')];if(!_0x332a85['query']['hasOwnProperty'](_0x7995('0x5b'))){_0x74ff38[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x332a85[_0x7995('0x3f')][_0x7995('0x47')]);_0x74ff38[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x332a85[_0x7995('0x3f')][_0x7995('0x30')]);}return _0x33c49c[_0x7995('0x57')](_0x74ff38);}})['then'](function(_0x2dc1f7){if(_0x2dc1f7){return _0x2dc1f7?{'count':_0x502d43,'rows':_0x2dc1f7}:null;}})[_0x7995('0x20')](respondWithResult(_0x51c50b,null))[_0x7995('0x2a')](handleError(_0x51c50b,null));};exports['getSubjects']=function(_0x1fe1cb,_0x1d2f9d,_0x705f0){var _0x3a7d9d={};var _0x3b0d30={};var _0x51ab1e;var _0x550a10;return db[_0x7995('0x39')][_0x7995('0x58')]({'where':{'id':_0x1fe1cb[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x1d2f9d,null))['then'](function(_0x5e8b4c){if(_0x5e8b4c){_0x51ab1e=_0x5e8b4c;_0x3b0d30[_0x7995('0x3d')]=_[_0x7995('0x40')](db[_0x7995('0x59')][_0x7995('0x3a')]);_0x3b0d30['query']=_[_0x7995('0x40')](_0x1fe1cb[_0x7995('0x3f')]);_0x3b0d30['filters']=_['intersection'](_0x3b0d30[_0x7995('0x3d')],_0x3b0d30[_0x7995('0x3f')]);_0x3a7d9d['attributes']=_[_0x7995('0x42')](_0x3b0d30['model'],qs[_0x7995('0x44')](_0x1fe1cb[_0x7995('0x3f')]['fields']));_0x3a7d9d['attributes']=_0x3a7d9d[_0x7995('0x43')]['length']?_0x3a7d9d[_0x7995('0x43')]:_0x3b0d30[_0x7995('0x3d')];_0x3a7d9d[_0x7995('0x48')]=qs[_0x7995('0x5a')](_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x5a')]);_0x3a7d9d[_0x7995('0x4b')]=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x1fe1cb[_0x7995('0x3f')],_0x3b0d30[_0x7995('0x41')]));if(_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x4a')]){_0x3a7d9d[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x3a7d9d[_0x7995('0x4b')],{'$or':_[_0x7995('0x3e')](_0x3a7d9d[_0x7995('0x43')],function(_0x2ff7ba){var _0xa2fc8e={};_0xa2fc8e[_0x2ff7ba]={'$like':'%'+_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x4a')]+'%'};return _0xa2fc8e;})});}_0x3a7d9d=_[_0x7995('0x4c')]({},_0x3a7d9d,_0x1fe1cb[_0x7995('0x4e')]);return _0x51ab1e[_0x7995('0x5c')](_0x3a7d9d);}})[_0x7995('0x20')](function(_0x2f7f51){if(_0x2f7f51){_0x550a10=_0x2f7f51[_0x7995('0x45')];if(!_0x1fe1cb['query'][_0x7995('0x46')](_0x7995('0x5b'))){_0x3a7d9d['limit']=qs['limit'](_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x47')]);_0x3a7d9d[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x30')]);}return _0x51ab1e['getSubjects'](_0x3a7d9d);}})[_0x7995('0x20')](function(_0xb68962){if(_0xb68962){return _0xb68962?{'count':_0x550a10,'rows':_0xb68962}:null;}})[_0x7995('0x20')](respondWithResult(_0x1d2f9d,null))[_0x7995('0x2a')](handleError(_0x1d2f9d,null));};exports[_0x7995('0x5d')]=function(_0x3f0bff,_0x151d99,_0xc93dcb){var _0x560095={};var _0x1c8e7d={};var _0x2b8217;var _0x5c04c9;return db['ZohoConfiguration'][_0x7995('0x58')]({'where':{'id':_0x3f0bff[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x151d99,null))[_0x7995('0x20')](function(_0xe42797){if(_0xe42797){_0x2b8217=_0xe42797;_0x1c8e7d['model']=_[_0x7995('0x40')](db[_0x7995('0x59')]['rawAttributes']);_0x1c8e7d[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x3f0bff['query']);_0x1c8e7d[_0x7995('0x41')]=_['intersection'](_0x1c8e7d[_0x7995('0x3d')],_0x1c8e7d[_0x7995('0x3f')]);_0x560095[_0x7995('0x43')]=_[_0x7995('0x42')](_0x1c8e7d[_0x7995('0x3d')],qs['fields'](_0x3f0bff[_0x7995('0x3f')][_0x7995('0x44')]));_0x560095[_0x7995('0x43')]=_0x560095['attributes'][_0x7995('0x45')]?_0x560095[_0x7995('0x43')]:_0x1c8e7d[_0x7995('0x3d')];_0x560095[_0x7995('0x48')]=qs['sort'](_0x3f0bff[_0x7995('0x3f')][_0x7995('0x5a')]);_0x560095[_0x7995('0x4b')]=qs['filters'](_['pick'](_0x3f0bff[_0x7995('0x3f')],_0x1c8e7d[_0x7995('0x41')]));if(_0x3f0bff['query']['filter']){_0x560095[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x560095[_0x7995('0x4b')],{'$or':_[_0x7995('0x3e')](_0x560095[_0x7995('0x43')],function(_0x551b5e){var _0x56003d={};_0x56003d[_0x551b5e]={'$like':'%'+_0x3f0bff[_0x7995('0x3f')]['filter']+'%'};return _0x56003d;})});}_0x560095=_['merge']({},_0x560095,_0x3f0bff[_0x7995('0x4e')]);return _0x2b8217[_0x7995('0x5d')](_0x560095);}})[_0x7995('0x20')](function(_0x5eb360){if(_0x5eb360){_0x5c04c9=_0x5eb360[_0x7995('0x45')];if(!_0x3f0bff[_0x7995('0x3f')][_0x7995('0x46')](_0x7995('0x5b'))){_0x560095[_0x7995('0x47')]=qs['limit'](_0x3f0bff[_0x7995('0x3f')][_0x7995('0x47')]);_0x560095[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x3f0bff['query'][_0x7995('0x30')]);}return _0x2b8217[_0x7995('0x5d')](_0x560095);}})['then'](function(_0x310272){if(_0x310272){return _0x310272?{'count':_0x5c04c9,'rows':_0x310272}:null;}})[_0x7995('0x20')](respondWithResult(_0x151d99,null))['catch'](handleError(_0x151d99,null));}; \ No newline at end of file +var _0x3e74=['keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','options','ZohoConfiguration','include','findAll','rawAttributes','length','create','body','find','destroy','getFields','findOne','params','ZohoField','getSubjects','getDescriptions','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','jayson/promise','client','http','test','Sequelize','request','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','count','offset','limit','set','Content-Range','json','apply','save','update','send','map','fieldName','type','key','model','name','query'];(function(_0x4abfef,_0x2adf4a){var _0x302c24=function(_0x27cc35){while(--_0x27cc35){_0x4abfef['push'](_0x4abfef['shift']());}};_0x302c24(++_0x2adf4a);}(_0x3e74,0x175));var _0x43e7=function(_0x2a70b1,_0x14ba14){_0x2a70b1=_0x2a70b1-0x0;var _0x24cdb4=_0x3e74[_0x2a70b1];return _0x24cdb4;};'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'];var jayson=require(_0x43e7('0x14'));var client=jayson[_0x43e7('0x15')][_0x43e7('0x16')]({'port':0x232a});function checkPasswordPattern(_0x3bb83f,_0x4e008c,_0x583d85){if(_0x583d85){var _0x2fcb36=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2fcb36[_0x43e7('0x17')](_0x4e008c)){return _0x3bb83f;}else{throw new db[(_0x43e7('0x18'))]['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 _0x3bb83f;}}function respondWithRpcPromise(_0x16849c,_0x14c146,_0x203378,_0x328445){return new BPromise(function(_0x4de324,_0x5c4eaa){var _0xdf16c=_0x328445||client;return _0xdf16c[_0x43e7('0x19')](_0x16849c,_0x203378)[_0x43e7('0x1a')](function(_0x5d346f){logger['info'](_0x43e7('0x1b'),_0x14c146,_0x43e7('0x1c'));logger[_0x43e7('0x1d')](_0x43e7('0x1e'),_0x14c146,_0x43e7('0x1c'),JSON[_0x43e7('0x1f')](_0x5d346f));if(_0x5d346f[_0x43e7('0x20')]){if(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x21')]===0x1f4){logger[_0x43e7('0x20')](_0x43e7('0x1b'),_0x14c146,_0x5d346f[_0x43e7('0x20')]['message']);return _0x5c4eaa(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);}logger['error'](_0x43e7('0x1b'),_0x14c146,_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);return _0x4de324(_0x5d346f[_0x43e7('0x20')][_0x43e7('0x22')]);}else{logger[_0x43e7('0x23')]('ZohoConfiguration,\x20%s,\x20%s',_0x14c146,_0x43e7('0x1c'));_0x4de324(_0x5d346f['result']['message']);}})[_0x43e7('0x24')](function(_0x43f4ff){logger['error'](_0x43e7('0x1b'),_0x14c146,_0x43f4ff);_0x5c4eaa(_0x43f4ff);});});}function respondWithStatusCode(_0x4ca5cf,_0x326dab){_0x326dab=_0x326dab||0xcc;return function(_0x5c5e67){if(_0x5c5e67){return _0x4ca5cf[_0x43e7('0x25')](_0x326dab);}return _0x4ca5cf[_0x43e7('0x26')](_0x326dab)[_0x43e7('0x27')]();};}function respondWithResult(_0x405f85,_0x51f4d7){_0x51f4d7=_0x51f4d7||0xc8;return function(_0x52b7b3){if(_0x52b7b3){return _0x405f85[_0x43e7('0x26')](_0x51f4d7)['json'](_0x52b7b3);}};}function respondWithFilteredResult(_0x2dd5f,_0x40dc8f){return function(_0x3565cf){if(_0x3565cf){var _0xb1fc63=_0x3565cf[_0x43e7('0x28')],_0x5087d7=_0x40dc8f[_0x43e7('0x29')],_0x33a1a5=_0x40dc8f[_0x43e7('0x29')]+_0x40dc8f[_0x43e7('0x2a')],_0x4690a6;if(_0x33a1a5>=_0xb1fc63){_0x33a1a5=_0xb1fc63;_0x4690a6=0xc8;}else{_0x4690a6=0xce;}_0x2dd5f[_0x43e7('0x26')](_0x4690a6);return _0x2dd5f[_0x43e7('0x2b')](_0x43e7('0x2c'),_0x5087d7+'-'+_0x33a1a5+'/'+_0xb1fc63)[_0x43e7('0x2d')](_0x3565cf);}return null;};}function patchUpdates(_0x17df44){return function(_0x19725a){try{jsonpatch[_0x43e7('0x2e')](_0x19725a,_0x17df44,!![]);}catch(_0x208706){return BPromise['reject'](_0x208706);}return _0x19725a[_0x43e7('0x2f')]();};}function saveUpdates(_0x44f6b0,_0x3b8f78){return function(_0x183c81){if(_0x183c81){return _0x183c81[_0x43e7('0x30')](_0x44f6b0)['then'](function(_0x1eba65){return _0x1eba65;});}return null;};}function removeEntity(_0x49b83d,_0x30d47e){return function(_0x3f280d){if(_0x3f280d){return _0x3f280d['destroy']()['then'](function(){_0x49b83d['status'](0xcc)[_0x43e7('0x27')]();});}};}function handleEntityNotFound(_0xbe6e28,_0x117c07){return function(_0x234fe6){if(!_0x234fe6){_0xbe6e28[_0x43e7('0x25')](0x194);}return _0x234fe6;};}function handleError(_0xde7ed,_0x485c6c){_0x485c6c=_0x485c6c||0x1f4;return function(_0x47baee){logger['error'](_0x47baee['stack']);if(_0x47baee['name']){delete _0x47baee['name'];}_0xde7ed['status'](_0x485c6c)[_0x43e7('0x31')](_0x47baee);};}exports['index']=function(_0x2b4bfd,_0x8e9f40){var _0x31bc78={},_0x50a2d0={},_0x40f72f={'count':0x0,'rows':[]};var _0x449803=_[_0x43e7('0x32')](db['ZohoConfiguration']['rawAttributes'],function(_0x5d84f4){return{'name':_0x5d84f4[_0x43e7('0x33')],'type':_0x5d84f4[_0x43e7('0x34')][_0x43e7('0x35')]};});_0x50a2d0[_0x43e7('0x36')]=_[_0x43e7('0x32')](_0x449803,_0x43e7('0x37'));_0x50a2d0[_0x43e7('0x38')]=_[_0x43e7('0x39')](_0x2b4bfd['query']);_0x50a2d0[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0x50a2d0['model'],_0x50a2d0[_0x43e7('0x38')]);_0x31bc78['attributes']=_[_0x43e7('0x3b')](_0x50a2d0[_0x43e7('0x36')],qs[_0x43e7('0x3c')](_0x2b4bfd[_0x43e7('0x38')][_0x43e7('0x3c')]));_0x31bc78[_0x43e7('0x3d')]=_0x31bc78['attributes']['length']?_0x31bc78[_0x43e7('0x3d')]:_0x50a2d0[_0x43e7('0x36')];if(!_0x2b4bfd[_0x43e7('0x38')][_0x43e7('0x3e')](_0x43e7('0x3f'))){_0x31bc78['limit']=qs[_0x43e7('0x2a')](_0x2b4bfd[_0x43e7('0x38')]['limit']);_0x31bc78[_0x43e7('0x29')]=qs['offset'](_0x2b4bfd[_0x43e7('0x38')]['offset']);}_0x31bc78[_0x43e7('0x40')]=qs[_0x43e7('0x41')](_0x2b4bfd[_0x43e7('0x38')][_0x43e7('0x41')]);_0x31bc78['where']=qs['filters'](_[_0x43e7('0x42')](_0x2b4bfd[_0x43e7('0x38')],_0x50a2d0[_0x43e7('0x3a')]));if(_0x2b4bfd[_0x43e7('0x38')]['filter']){_0x31bc78['where']=_['merge'](_0x31bc78[_0x43e7('0x43')],{'$or':_['map'](_0x449803,function(_0x2ab022){if(_0x2ab022['type']!=='VIRTUAL'){var _0x46b2e6={};_0x46b2e6[_0x2ab022['name']]={'$like':'%'+_0x2b4bfd[_0x43e7('0x38')][_0x43e7('0x44')]+'%'};return _0x46b2e6;}})});}_0x31bc78=_[_0x43e7('0x45')]({},_0x31bc78,_0x2b4bfd[_0x43e7('0x46')]);var _0x4fc5e8={'where':_0x31bc78[_0x43e7('0x43')]};return db[_0x43e7('0x47')][_0x43e7('0x28')](_0x4fc5e8)[_0x43e7('0x1a')](function(_0x296dc8){_0x40f72f[_0x43e7('0x28')]=_0x296dc8;if(_0x2b4bfd['query']['includeAll']){_0x31bc78[_0x43e7('0x48')]=[{'all':!![]}];}return db[_0x43e7('0x47')][_0x43e7('0x49')](_0x31bc78);})['then'](function(_0x5c1c18){_0x40f72f['rows']=_0x5c1c18;return _0x40f72f;})[_0x43e7('0x1a')](respondWithFilteredResult(_0x8e9f40,_0x31bc78))[_0x43e7('0x24')](handleError(_0x8e9f40,null));};exports['show']=function(_0x351ca2,_0x47686e){var _0x3c96fe={'raw':![],'where':{'id':_0x351ca2['params']['id']}},_0x560329={};_0x560329['model']=_['keys'](db[_0x43e7('0x47')][_0x43e7('0x4a')]);_0x560329['query']=_[_0x43e7('0x39')](_0x351ca2[_0x43e7('0x38')]);_0x560329[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0x560329['model'],_0x560329[_0x43e7('0x38')]);_0x3c96fe['attributes']=_['intersection'](_0x560329[_0x43e7('0x36')],qs[_0x43e7('0x3c')](_0x351ca2[_0x43e7('0x38')][_0x43e7('0x3c')]));_0x3c96fe[_0x43e7('0x3d')]=_0x3c96fe[_0x43e7('0x3d')][_0x43e7('0x4b')]?_0x3c96fe[_0x43e7('0x3d')]:_0x560329[_0x43e7('0x36')];if(_0x351ca2[_0x43e7('0x38')]['includeAll']){_0x3c96fe[_0x43e7('0x48')]=[{'all':!![]}];}_0x3c96fe=_[_0x43e7('0x45')]({},_0x3c96fe,_0x351ca2['options']);return db[_0x43e7('0x47')]['find'](_0x3c96fe)[_0x43e7('0x1a')](handleEntityNotFound(_0x47686e,null))[_0x43e7('0x1a')](respondWithResult(_0x47686e,null))[_0x43e7('0x24')](handleError(_0x47686e,null));};exports[_0x43e7('0x4c')]=function(_0xfe13fa,_0x5e5556){return db['ZohoConfiguration'][_0x43e7('0x4c')](_0xfe13fa[_0x43e7('0x4d')],{})[_0x43e7('0x1a')](respondWithResult(_0x5e5556,0xc9))[_0x43e7('0x24')](handleError(_0x5e5556,null));};exports[_0x43e7('0x30')]=function(_0x25bb44,_0xa47464){if(_0x25bb44[_0x43e7('0x4d')]['id']){delete _0x25bb44[_0x43e7('0x4d')]['id'];}return db[_0x43e7('0x47')][_0x43e7('0x4e')]({'where':{'id':_0x25bb44['params']['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0xa47464,null))[_0x43e7('0x1a')](saveUpdates(_0x25bb44['body'],null))[_0x43e7('0x1a')](respondWithResult(_0xa47464,null))[_0x43e7('0x24')](handleError(_0xa47464,null));};exports[_0x43e7('0x4f')]=function(_0x558d54,_0x5d63c6){return db[_0x43e7('0x47')][_0x43e7('0x4e')]({'where':{'id':_0x558d54['params']['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x5d63c6,null))['then'](removeEntity(_0x5d63c6,null))['catch'](handleError(_0x5d63c6,null));};exports[_0x43e7('0x50')]=function(_0x4b6b7f,_0x1f7c02,_0x40155c){var _0x68697={};var _0x4dfdb0={};var _0xc3976;var _0xdb9fbe;return db['ZohoConfiguration'][_0x43e7('0x51')]({'where':{'id':_0x4b6b7f[_0x43e7('0x52')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x1f7c02,null))['then'](function(_0x5a4c95){if(_0x5a4c95){_0xc3976=_0x5a4c95;_0x4dfdb0['model']=_[_0x43e7('0x39')](db[_0x43e7('0x53')][_0x43e7('0x4a')]);_0x4dfdb0[_0x43e7('0x38')]=_['keys'](_0x4b6b7f['query']);_0x4dfdb0[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0x4dfdb0[_0x43e7('0x36')],_0x4dfdb0[_0x43e7('0x38')]);_0x68697['attributes']=_[_0x43e7('0x3b')](_0x4dfdb0[_0x43e7('0x36')],qs[_0x43e7('0x3c')](_0x4b6b7f[_0x43e7('0x38')][_0x43e7('0x3c')]));_0x68697[_0x43e7('0x3d')]=_0x68697[_0x43e7('0x3d')][_0x43e7('0x4b')]?_0x68697[_0x43e7('0x3d')]:_0x4dfdb0[_0x43e7('0x36')];_0x68697[_0x43e7('0x40')]=qs['sort'](_0x4b6b7f['query'][_0x43e7('0x41')]);_0x68697['where']=qs['filters'](_['pick'](_0x4b6b7f[_0x43e7('0x38')],_0x4dfdb0[_0x43e7('0x3a')]));if(_0x4b6b7f['query'][_0x43e7('0x44')]){_0x68697[_0x43e7('0x43')]=_[_0x43e7('0x45')](_0x68697['where'],{'$or':_[_0x43e7('0x32')](_0x68697[_0x43e7('0x3d')],function(_0x289f86){var _0xc9723={};_0xc9723[_0x289f86]={'$like':'%'+_0x4b6b7f[_0x43e7('0x38')][_0x43e7('0x44')]+'%'};return _0xc9723;})});}_0x68697=_[_0x43e7('0x45')]({},_0x68697,_0x4b6b7f['options']);return _0xc3976[_0x43e7('0x50')](_0x68697);}})[_0x43e7('0x1a')](function(_0x415f26){if(_0x415f26){_0xdb9fbe=_0x415f26['length'];if(!_0x4b6b7f['query'][_0x43e7('0x3e')]('nolimit')){_0x68697['limit']=qs[_0x43e7('0x2a')](_0x4b6b7f[_0x43e7('0x38')]['limit']);_0x68697[_0x43e7('0x29')]=qs[_0x43e7('0x29')](_0x4b6b7f[_0x43e7('0x38')][_0x43e7('0x29')]);}return _0xc3976[_0x43e7('0x50')](_0x68697);}})[_0x43e7('0x1a')](function(_0x398a78){if(_0x398a78){return _0x398a78?{'count':_0xdb9fbe,'rows':_0x398a78}:null;}})['then'](respondWithResult(_0x1f7c02,null))[_0x43e7('0x24')](handleError(_0x1f7c02,null));};exports[_0x43e7('0x54')]=function(_0x4e5956,_0x418213,_0x5c2c5f){var _0x26ee52={};var _0x248936={};var _0x37301b;var _0x1ca24b;return db['ZohoConfiguration'][_0x43e7('0x51')]({'where':{'id':_0x4e5956[_0x43e7('0x52')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x418213,null))['then'](function(_0x17889c){if(_0x17889c){_0x37301b=_0x17889c;_0x248936[_0x43e7('0x36')]=_[_0x43e7('0x39')](db[_0x43e7('0x53')][_0x43e7('0x4a')]);_0x248936['query']=_[_0x43e7('0x39')](_0x4e5956[_0x43e7('0x38')]);_0x248936[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0x248936[_0x43e7('0x36')],_0x248936[_0x43e7('0x38')]);_0x26ee52[_0x43e7('0x3d')]=_['intersection'](_0x248936['model'],qs[_0x43e7('0x3c')](_0x4e5956['query']['fields']));_0x26ee52['attributes']=_0x26ee52[_0x43e7('0x3d')][_0x43e7('0x4b')]?_0x26ee52[_0x43e7('0x3d')]:_0x248936[_0x43e7('0x36')];_0x26ee52[_0x43e7('0x40')]=qs[_0x43e7('0x41')](_0x4e5956['query'][_0x43e7('0x41')]);_0x26ee52[_0x43e7('0x43')]=qs[_0x43e7('0x3a')](_['pick'](_0x4e5956[_0x43e7('0x38')],_0x248936[_0x43e7('0x3a')]));if(_0x4e5956[_0x43e7('0x38')][_0x43e7('0x44')]){_0x26ee52[_0x43e7('0x43')]=_[_0x43e7('0x45')](_0x26ee52[_0x43e7('0x43')],{'$or':_[_0x43e7('0x32')](_0x26ee52['attributes'],function(_0x52c757){var _0x55990c={};_0x55990c[_0x52c757]={'$like':'%'+_0x4e5956[_0x43e7('0x38')][_0x43e7('0x44')]+'%'};return _0x55990c;})});}_0x26ee52=_['merge']({},_0x26ee52,_0x4e5956[_0x43e7('0x46')]);return _0x37301b[_0x43e7('0x54')](_0x26ee52);}})[_0x43e7('0x1a')](function(_0x8e60f1){if(_0x8e60f1){_0x1ca24b=_0x8e60f1['length'];if(!_0x4e5956['query']['hasOwnProperty'](_0x43e7('0x3f'))){_0x26ee52[_0x43e7('0x2a')]=qs['limit'](_0x4e5956['query'][_0x43e7('0x2a')]);_0x26ee52[_0x43e7('0x29')]=qs[_0x43e7('0x29')](_0x4e5956['query'][_0x43e7('0x29')]);}return _0x37301b[_0x43e7('0x54')](_0x26ee52);}})[_0x43e7('0x1a')](function(_0xb04082){if(_0xb04082){return _0xb04082?{'count':_0x1ca24b,'rows':_0xb04082}:null;}})['then'](respondWithResult(_0x418213,null))[_0x43e7('0x24')](handleError(_0x418213,null));};exports['getDescriptions']=function(_0xa66309,_0x3ab790,_0x24a168){var _0x90667c={};var _0xa7cb2c={};var _0x45adef;var _0x126133;return db['ZohoConfiguration'][_0x43e7('0x51')]({'where':{'id':_0xa66309[_0x43e7('0x52')]['id']}})[_0x43e7('0x1a')](handleEntityNotFound(_0x3ab790,null))[_0x43e7('0x1a')](function(_0x550960){if(_0x550960){_0x45adef=_0x550960;_0xa7cb2c['model']=_['keys'](db[_0x43e7('0x53')]['rawAttributes']);_0xa7cb2c[_0x43e7('0x38')]=_[_0x43e7('0x39')](_0xa66309[_0x43e7('0x38')]);_0xa7cb2c[_0x43e7('0x3a')]=_[_0x43e7('0x3b')](_0xa7cb2c[_0x43e7('0x36')],_0xa7cb2c[_0x43e7('0x38')]);_0x90667c[_0x43e7('0x3d')]=_[_0x43e7('0x3b')](_0xa7cb2c[_0x43e7('0x36')],qs[_0x43e7('0x3c')](_0xa66309['query'][_0x43e7('0x3c')]));_0x90667c[_0x43e7('0x3d')]=_0x90667c[_0x43e7('0x3d')][_0x43e7('0x4b')]?_0x90667c[_0x43e7('0x3d')]:_0xa7cb2c['model'];_0x90667c['order']=qs[_0x43e7('0x41')](_0xa66309[_0x43e7('0x38')]['sort']);_0x90667c[_0x43e7('0x43')]=qs[_0x43e7('0x3a')](_['pick'](_0xa66309['query'],_0xa7cb2c[_0x43e7('0x3a')]));if(_0xa66309[_0x43e7('0x38')][_0x43e7('0x44')]){_0x90667c[_0x43e7('0x43')]=_[_0x43e7('0x45')](_0x90667c['where'],{'$or':_['map'](_0x90667c[_0x43e7('0x3d')],function(_0x18c438){var _0x3ce34b={};_0x3ce34b[_0x18c438]={'$like':'%'+_0xa66309[_0x43e7('0x38')]['filter']+'%'};return _0x3ce34b;})});}_0x90667c=_[_0x43e7('0x45')]({},_0x90667c,_0xa66309[_0x43e7('0x46')]);return _0x45adef[_0x43e7('0x55')](_0x90667c);}})[_0x43e7('0x1a')](function(_0x5bc060){if(_0x5bc060){_0x126133=_0x5bc060[_0x43e7('0x4b')];if(!_0xa66309[_0x43e7('0x38')][_0x43e7('0x3e')](_0x43e7('0x3f'))){_0x90667c[_0x43e7('0x2a')]=qs['limit'](_0xa66309[_0x43e7('0x38')][_0x43e7('0x2a')]);_0x90667c['offset']=qs[_0x43e7('0x29')](_0xa66309[_0x43e7('0x38')][_0x43e7('0x29')]);}return _0x45adef[_0x43e7('0x55')](_0x90667c);}})['then'](function(_0x3da183){if(_0x3da183){return _0x3da183?{'count':_0x126133,'rows':_0x3da183}:null;}})['then'](respondWithResult(_0x3ab790,null))[_0x43e7('0x24')](handleError(_0x3ab790,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index b116ddc..2019078 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 _0x6186=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x6186,0xda));var _0x6618=function(_0x27650e,_0x278f7a){_0x27650e=_0x27650e-0x0;var _0x28fe08=_0x6186[_0x27650e];return _0x28fe08;};'use strict';var _=require(_0x6618('0x0'));var util=require(_0x6618('0x1'));var logger=require(_0x6618('0x2'))(_0x6618('0x3'));var moment=require(_0x6618('0x4'));var BPromise=require(_0x6618('0x5'));var rp=require(_0x6618('0x6'));var fs=require('fs');var path=require(_0x6618('0x7'));var rimraf=require(_0x6618('0x8'));var config=require(_0x6618('0x9'));var attributes=require(_0x6618('0xa'));module[_0x6618('0xb')]=function(_0x42080a,_0x38f93f){return _0x42080a[_0x6618('0xc')](_0x6618('0xd'),attributes,{'tableName':_0x6618('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x231e=['rimraf','../../config/environment','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','bluebird'];(function(_0x52acad,_0x482afd){var _0x378976=function(_0x55b53a){while(--_0x55b53a){_0x52acad['push'](_0x52acad['shift']());}};_0x378976(++_0x482afd);}(_0x231e,0xba));var _0xe231=function(_0x21f3c3,_0x42e32c){_0x21f3c3=_0x21f3c3-0x0;var _0x15957=_0x231e[_0x21f3c3];return _0x15957;};'use strict';var _=require(_0xe231('0x0'));var util=require(_0xe231('0x1'));var logger=require(_0xe231('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe231('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe231('0x4'));var config=require(_0xe231('0x5'));var attributes=require('./intZohoConfiguration.attributes');module[_0xe231('0x6')]=function(_0x2a1013,_0x11e567){return _0x2a1013[_0xe231('0x7')](_0xe231('0x8'),attributes,{'tableName':_0xe231('0x9'),'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 b9d6472..053e75d 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 _0xba21=['message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x466bfd,_0x56f4bb){var _0x29293d=function(_0x47298b){while(--_0x47298b){_0x466bfd['push'](_0x466bfd['shift']());}};_0x29293d(++_0x56f4bb);}(_0xba21,0xd5));var _0x1ba2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xba21[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x1ba2('0x0'));var util=require(_0x1ba2('0x1'));var moment=require(_0x1ba2('0x2'));var BPromise=require(_0x1ba2('0x3'));var rs=require(_0x1ba2('0x4'));var fs=require('fs');var Redis=require(_0x1ba2('0x5'));var db=require(_0x1ba2('0x6'))['db'];var utils=require(_0x1ba2('0x7'));var logger=require('../../config/logger')(_0x1ba2('0x8'));var config=require(_0x1ba2('0x9'));var jayson=require(_0x1ba2('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x507a07,_0x4a174b,_0x56a8f6){return new BPromise(function(_0x3117d8,_0x4e04c0){return client['request'](_0x507a07,_0x56a8f6)['then'](function(_0x2dae11){logger['info'](_0x1ba2('0xb'),_0x4a174b,_0x1ba2('0xc'));logger[_0x1ba2('0xd')](_0x1ba2('0xe'),_0x4a174b,_0x1ba2('0xc'),JSON[_0x1ba2('0xf')](_0x2dae11));if(_0x2dae11[_0x1ba2('0x10')]){if(_0x2dae11['error'][_0x1ba2('0x11')]===0x1f4){logger[_0x1ba2('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x4a174b,_0x2dae11[_0x1ba2('0x10')][_0x1ba2('0x12')]);return _0x4e04c0(_0x2dae11[_0x1ba2('0x10')][_0x1ba2('0x12')]);}logger[_0x1ba2('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x4a174b,_0x2dae11[_0x1ba2('0x10')][_0x1ba2('0x12')]);return _0x3117d8(_0x2dae11[_0x1ba2('0x10')]['message']);}else{logger[_0x1ba2('0x13')](_0x1ba2('0xb'),_0x4a174b,_0x1ba2('0xc'));_0x3117d8(_0x2dae11[_0x1ba2('0x14')][_0x1ba2('0x12')]);}})['catch'](function(_0x35ac91){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x4a174b,_0x35ac91);_0x4e04c0(_0x35ac91);});});} \ No newline at end of file +var _0x9aba=['message','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x101a61,_0xa9da5f){var _0x3a2788=function(_0x5e9a71){while(--_0x5e9a71){_0x101a61['push'](_0x101a61['shift']());}};_0x3a2788(++_0xa9da5f);}(_0x9aba,0x87));var _0xa9ab=function(_0x3f9c9c,_0x50640e){_0x3f9c9c=_0x3f9c9c-0x0;var _0x442353=_0x9aba[_0x3f9c9c];return _0x442353;};'use strict';var _=require(_0xa9ab('0x0'));var util=require(_0xa9ab('0x1'));var moment=require(_0xa9ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa9ab('0x4'))(_0xa9ab('0x5'));var config=require(_0xa9ab('0x6'));var jayson=require(_0xa9ab('0x7'));var client=jayson['client'][_0xa9ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x349985,_0x6c0951,_0x104363){return new BPromise(function(_0x55a6c0,_0x15ca55){return client[_0xa9ab('0x9')](_0x349985,_0x104363)['then'](function(_0x474687){logger[_0xa9ab('0xa')](_0xa9ab('0xb'),_0x6c0951,_0xa9ab('0xc'));logger[_0xa9ab('0xd')](_0xa9ab('0xe'),_0x6c0951,_0xa9ab('0xc'),JSON[_0xa9ab('0xf')](_0x474687));if(_0x474687['error']){if(_0x474687['error']['code']===0x1f4){logger[_0xa9ab('0x10')](_0xa9ab('0xb'),_0x6c0951,_0x474687[_0xa9ab('0x10')][_0xa9ab('0x11')]);return _0x15ca55(_0x474687['error'][_0xa9ab('0x11')]);}logger[_0xa9ab('0x10')](_0xa9ab('0xb'),_0x6c0951,_0x474687[_0xa9ab('0x10')][_0xa9ab('0x11')]);return _0x55a6c0(_0x474687[_0xa9ab('0x10')][_0xa9ab('0x11')]);}else{logger[_0xa9ab('0xa')](_0xa9ab('0xb'),_0x6c0951,_0xa9ab('0xc'));_0x55a6c0(_0x474687['result'][_0xa9ab('0x11')]);}})[_0xa9ab('0x12')](function(_0x9c3b5e){logger[_0xa9ab('0x10')](_0xa9ab('0xb'),_0x6c0951,_0x9c3b5e);_0x15ca55(_0x9c3b5e);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 24956f6..69d268d 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 _0xfef3=['/:id','show','post','create','put','update','delete','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xfef3,0x118));var _0x3fef=function(_0x5cfa6a,_0x4d69e8){_0x5cfa6a=_0x5cfa6a-0x0;var _0x204e10=_0xfef3[_0x5cfa6a];return _0x204e10;};'use strict';var multer=require(_0x3fef('0x0'));var util=require('util');var path=require(_0x3fef('0x1'));var timeout=require('connect-timeout');var express=require(_0x3fef('0x2'));var router=express[_0x3fef('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3fef('0x4'));var config=require(_0x3fef('0x5'));var controller=require('./intZohoField.controller');router[_0x3fef('0x6')]('/',auth[_0x3fef('0x7')](),controller['index']);router[_0x3fef('0x6')](_0x3fef('0x8'),auth[_0x3fef('0x7')](),controller[_0x3fef('0x9')]);router[_0x3fef('0xa')]('/',auth[_0x3fef('0x7')](),controller[_0x3fef('0xb')]);router[_0x3fef('0xc')](_0x3fef('0x8'),auth[_0x3fef('0x7')](),controller[_0x3fef('0xd')]);router[_0x3fef('0xe')](_0x3fef('0x8'),auth[_0x3fef('0x7')](),controller['destroy']);module[_0x3fef('0xf')]=router; \ No newline at end of file +var _0x32b6=['exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','put','destroy'];(function(_0x39f101,_0x59d2e4){var _0x28d6de=function(_0x1d2741){while(--_0x1d2741){_0x39f101['push'](_0x39f101['shift']());}};_0x28d6de(++_0x59d2e4);}(_0x32b6,0x1d1));var _0x632b=function(_0x1a3e48,_0x3a5c97){_0x1a3e48=_0x1a3e48-0x0;var _0x12b4e3=_0x32b6[_0x1a3e48];return _0x12b4e3;};'use strict';var multer=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var path=require('path');var timeout=require(_0x632b('0x2'));var express=require(_0x632b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x632b('0x4'));var config=require(_0x632b('0x5'));var controller=require(_0x632b('0x6'));router[_0x632b('0x7')]('/',auth[_0x632b('0x8')](),controller[_0x632b('0x9')]);router[_0x632b('0x7')](_0x632b('0xa'),auth[_0x632b('0x8')](),controller[_0x632b('0xb')]);router['post']('/',auth[_0x632b('0x8')](),controller[_0x632b('0xc')]);router[_0x632b('0xd')](_0x632b('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x632b('0xa'),auth['isAuthenticated'](),controller[_0x632b('0xe')]);module[_0x632b('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index bf476a0..acb3c85 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 _0x8558=['keyValue','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x9d0a41,_0x56337f){var _0x34b6ea=function(_0x3623ec){while(--_0x3623ec){_0x9d0a41['push'](_0x9d0a41['shift']());}};_0x34b6ea(++_0x56337f);}(_0x8558,0x103));var _0x8855=function(_0xf00441,_0x5c929d){_0xf00441=_0xf00441-0x0;var _0x2a8ccb=_0x8558[_0xf00441];return _0x2a8ccb;};'use strict';var Sequelize=require('sequelize');module[_0x8855('0x0')]={'type':{'type':Sequelize[_0x8855('0x1')](_0x8855('0x2'),_0x8855('0x3'),_0x8855('0x4'),_0x8855('0x5')),'defaultValue':_0x8855('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8855('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x8855('0x2'),'variable',_0x8855('0x4'))},'keyContent':{'type':Sequelize[_0x8855('0x6')]},'idField':{'type':Sequelize[_0x8855('0x6')]},'nameField':{'type':Sequelize[_0x8855('0x6')]},'customField':{'type':Sequelize[_0x8855('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8855('0x6')]}}; \ No newline at end of file +var _0xc57c=['sequelize','variable','string','STRING','ENUM','customVariable','BOOLEAN'];(function(_0x29183b,_0x8296f3){var _0x3cdbbf=function(_0x5d3909){while(--_0x5d3909){_0x29183b['push'](_0x29183b['shift']());}};_0x3cdbbf(++_0x8296f3);}(_0xc57c,0x149));var _0xcc57=function(_0x194ce2,_0x3c6d23){_0x194ce2=_0x194ce2-0x0;var _0x4281df=_0xc57c[_0x194ce2];return _0x4281df;};'use strict';var Sequelize=require(_0xcc57('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string',_0xcc57('0x1'),'customVariable','keyValue'),'defaultValue':_0xcc57('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xcc57('0x3')]},'keyType':{'type':Sequelize[_0xcc57('0x4')](_0xcc57('0x2'),_0xcc57('0x1'),_0xcc57('0x5'))},'keyContent':{'type':Sequelize[_0xcc57('0x3')]},'idField':{'type':Sequelize[_0xcc57('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xcc57('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcc57('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 4c68143..f1137a5 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 _0xb0a0=['sendStatus','error','stack','name','send','index','map','ZohoField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','status','json','count','offset','limit','Content-Range','update','then','end'];(function(_0x245fb2,_0x478484){var _0x27c690=function(_0x1cc29e){while(--_0x1cc29e){_0x245fb2['push'](_0x245fb2['shift']());}};_0x27c690(++_0x478484);}(_0xb0a0,0x1bf));var _0x0b0a=function(_0x936f18,_0x110725){_0x936f18=_0x936f18-0x0;var _0x36b3b7=_0xb0a0[_0x936f18];return _0x36b3b7;};'use strict';var pdf=require(_0x0b0a('0x0'));var emlformat=require(_0x0b0a('0x1'));var rimraf=require(_0x0b0a('0x2'));var zipdir=require(_0x0b0a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0b0a('0x4'));var moment=require(_0x0b0a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0b0a('0x6'));var util=require(_0x0b0a('0x7'));var path=require('path');var sox=require(_0x0b0a('0x8'));var csv=require(_0x0b0a('0x9'));var ejs=require(_0x0b0a('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0b0a('0xb'));var crypto=require(_0x0b0a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0b0a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0b0a('0xe'));var Redis=require(_0x0b0a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0b0a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0b0a('0x11'));var utils=require(_0x0b0a('0x12'));var config=require(_0x0b0a('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c0620,_0x4e19f4){_0x4e19f4=_0x4e19f4||0xcc;return function(_0x5e9cfb){if(_0x5e9cfb){return _0x3c0620['sendStatus'](_0x4e19f4);}return _0x3c0620[_0x0b0a('0x14')](_0x4e19f4)['end']();};}function respondWithResult(_0x295b45,_0x3b165f){_0x3b165f=_0x3b165f||0xc8;return function(_0x3df470){if(_0x3df470){return _0x295b45[_0x0b0a('0x14')](_0x3b165f)[_0x0b0a('0x15')](_0x3df470);}};}function respondWithFilteredResult(_0x51c15a,_0x4de88a){return function(_0x554e98){if(_0x554e98){var _0xd55977=_0x554e98[_0x0b0a('0x16')],_0x1645bd=_0x4de88a[_0x0b0a('0x17')],_0x4321fd=_0x4de88a[_0x0b0a('0x17')]+_0x4de88a[_0x0b0a('0x18')],_0x51be84;if(_0x4321fd>=_0xd55977){_0x4321fd=_0xd55977;_0x51be84=0xc8;}else{_0x51be84=0xce;}_0x51c15a[_0x0b0a('0x14')](_0x51be84);return _0x51c15a['set'](_0x0b0a('0x19'),_0x1645bd+'-'+_0x4321fd+'/'+_0xd55977)[_0x0b0a('0x15')](_0x554e98);}return null;};}function patchUpdates(_0x1089ff){return function(_0xa82192){try{jsonpatch['apply'](_0xa82192,_0x1089ff,!![]);}catch(_0x5be870){return BPromise['reject'](_0x5be870);}return _0xa82192['save']();};}function saveUpdates(_0x29837d,_0x14d7ee){return function(_0x1bd444){if(_0x1bd444){return _0x1bd444[_0x0b0a('0x1a')](_0x29837d)[_0x0b0a('0x1b')](function(_0xaabdb5){return _0xaabdb5;});}return null;};}function removeEntity(_0x37e965,_0x3d0483){return function(_0x451969){if(_0x451969){return _0x451969['destroy']()[_0x0b0a('0x1b')](function(){_0x37e965[_0x0b0a('0x14')](0xcc)[_0x0b0a('0x1c')]();});}};}function handleEntityNotFound(_0x24f3df,_0x130d69){return function(_0x425d6b){if(!_0x425d6b){_0x24f3df[_0x0b0a('0x1d')](0x194);}return _0x425d6b;};}function handleError(_0x45eb3d,_0x25c657){_0x25c657=_0x25c657||0x1f4;return function(_0x48f5a3){logger[_0x0b0a('0x1e')](_0x48f5a3[_0x0b0a('0x1f')]);if(_0x48f5a3[_0x0b0a('0x20')]){delete _0x48f5a3[_0x0b0a('0x20')];}_0x45eb3d[_0x0b0a('0x14')](_0x25c657)[_0x0b0a('0x21')](_0x48f5a3);};}exports[_0x0b0a('0x22')]=function(_0xe79ab2,_0x18c5f7){var _0x3845f9={},_0x25af08={},_0x5a1cf3={'count':0x0,'rows':[]};var _0x49de97=_[_0x0b0a('0x23')](db[_0x0b0a('0x24')][_0x0b0a('0x25')],function(_0x9b344){return{'name':_0x9b344['fieldName'],'type':_0x9b344[_0x0b0a('0x26')][_0x0b0a('0x27')]};});_0x25af08[_0x0b0a('0x28')]=_[_0x0b0a('0x23')](_0x49de97,_0x0b0a('0x20'));_0x25af08[_0x0b0a('0x29')]=_[_0x0b0a('0x2a')](_0xe79ab2[_0x0b0a('0x29')]);_0x25af08[_0x0b0a('0x2b')]=_['intersection'](_0x25af08[_0x0b0a('0x28')],_0x25af08['query']);_0x3845f9[_0x0b0a('0x2c')]=_[_0x0b0a('0x2d')](_0x25af08[_0x0b0a('0x28')],qs['fields'](_0xe79ab2[_0x0b0a('0x29')][_0x0b0a('0x2e')]));_0x3845f9[_0x0b0a('0x2c')]=_0x3845f9[_0x0b0a('0x2c')][_0x0b0a('0x2f')]?_0x3845f9[_0x0b0a('0x2c')]:_0x25af08[_0x0b0a('0x28')];if(!_0xe79ab2[_0x0b0a('0x29')][_0x0b0a('0x30')](_0x0b0a('0x31'))){_0x3845f9[_0x0b0a('0x18')]=qs[_0x0b0a('0x18')](_0xe79ab2['query'][_0x0b0a('0x18')]);_0x3845f9[_0x0b0a('0x17')]=qs[_0x0b0a('0x17')](_0xe79ab2[_0x0b0a('0x29')][_0x0b0a('0x17')]);}_0x3845f9[_0x0b0a('0x32')]=qs[_0x0b0a('0x33')](_0xe79ab2[_0x0b0a('0x29')][_0x0b0a('0x33')]);_0x3845f9['where']=qs['filters'](_['pick'](_0xe79ab2[_0x0b0a('0x29')],_0x25af08[_0x0b0a('0x2b')]));if(_0xe79ab2[_0x0b0a('0x29')][_0x0b0a('0x34')]){_0x3845f9[_0x0b0a('0x35')]=_[_0x0b0a('0x36')](_0x3845f9[_0x0b0a('0x35')],{'$or':_[_0x0b0a('0x23')](_0x49de97,function(_0x342395){if(_0x342395[_0x0b0a('0x26')]!==_0x0b0a('0x37')){var _0x4330ed={};_0x4330ed[_0x342395[_0x0b0a('0x20')]]={'$like':'%'+_0xe79ab2[_0x0b0a('0x29')][_0x0b0a('0x34')]+'%'};return _0x4330ed;}})});}_0x3845f9=_[_0x0b0a('0x36')]({},_0x3845f9,_0xe79ab2[_0x0b0a('0x38')]);var _0x5cfb68={'where':_0x3845f9[_0x0b0a('0x35')]};return db[_0x0b0a('0x24')]['count'](_0x5cfb68)[_0x0b0a('0x1b')](function(_0x5ad751){_0x5a1cf3[_0x0b0a('0x16')]=_0x5ad751;if(_0xe79ab2['query'][_0x0b0a('0x39')]){_0x3845f9[_0x0b0a('0x3a')]=[{'all':!![]}];}return db[_0x0b0a('0x24')][_0x0b0a('0x3b')](_0x3845f9);})[_0x0b0a('0x1b')](function(_0x460cb4){_0x5a1cf3[_0x0b0a('0x3c')]=_0x460cb4;return _0x5a1cf3;})[_0x0b0a('0x1b')](respondWithFilteredResult(_0x18c5f7,_0x3845f9))[_0x0b0a('0x3d')](handleError(_0x18c5f7,null));};exports[_0x0b0a('0x3e')]=function(_0x1f2c57,_0x2c76b8){var _0x4f4f34={'raw':!![],'where':{'id':_0x1f2c57[_0x0b0a('0x3f')]['id']}},_0x3291f2={};_0x3291f2['model']=_['keys'](db['ZohoField'][_0x0b0a('0x25')]);_0x3291f2[_0x0b0a('0x29')]=_['keys'](_0x1f2c57[_0x0b0a('0x29')]);_0x3291f2['filters']=_[_0x0b0a('0x2d')](_0x3291f2[_0x0b0a('0x28')],_0x3291f2[_0x0b0a('0x29')]);_0x4f4f34[_0x0b0a('0x2c')]=_[_0x0b0a('0x2d')](_0x3291f2[_0x0b0a('0x28')],qs['fields'](_0x1f2c57['query'][_0x0b0a('0x2e')]));_0x4f4f34[_0x0b0a('0x2c')]=_0x4f4f34['attributes'][_0x0b0a('0x2f')]?_0x4f4f34[_0x0b0a('0x2c')]:_0x3291f2[_0x0b0a('0x28')];if(_0x1f2c57['query']['includeAll']){_0x4f4f34[_0x0b0a('0x3a')]=[{'all':!![]}];}_0x4f4f34=_['merge']({},_0x4f4f34,_0x1f2c57['options']);return db['ZohoField'][_0x0b0a('0x40')](_0x4f4f34)[_0x0b0a('0x1b')](handleEntityNotFound(_0x2c76b8,null))['then'](respondWithResult(_0x2c76b8,null))[_0x0b0a('0x3d')](handleError(_0x2c76b8,null));};exports[_0x0b0a('0x41')]=function(_0x257b08,_0x371240){return db[_0x0b0a('0x24')][_0x0b0a('0x41')](_0x257b08[_0x0b0a('0x42')],{})[_0x0b0a('0x1b')](respondWithResult(_0x371240,0xc9))['catch'](handleError(_0x371240,null));};exports[_0x0b0a('0x1a')]=function(_0x2bdb7a,_0x3dd558){if(_0x2bdb7a[_0x0b0a('0x42')]['id']){delete _0x2bdb7a['body']['id'];}return db[_0x0b0a('0x24')]['find']({'where':{'id':_0x2bdb7a[_0x0b0a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3dd558,null))[_0x0b0a('0x1b')](saveUpdates(_0x2bdb7a[_0x0b0a('0x42')],null))[_0x0b0a('0x1b')](respondWithResult(_0x3dd558,null))[_0x0b0a('0x3d')](handleError(_0x3dd558,null));};exports[_0x0b0a('0x43')]=function(_0x332bae,_0x2fda8e){return db[_0x0b0a('0x24')][_0x0b0a('0x40')]({'where':{'id':_0x332bae[_0x0b0a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2fda8e,null))[_0x0b0a('0x1b')](removeEntity(_0x2fda8e,null))['catch'](handleError(_0x2fda8e,null));}; \ No newline at end of file +var _0x8854=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','ZohoField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','map','VIRTUAL','filter','includeAll','include','findAll','rows','catch','options','create','body','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs'];(function(_0x554ed8,_0x1aa9bd){var _0x21e355=function(_0x318ce5){while(--_0x318ce5){_0x554ed8['push'](_0x554ed8['shift']());}};_0x21e355(++_0x1aa9bd);}(_0x8854,0x15c));var _0x4885=function(_0x1bcd32,_0x397911){_0x1bcd32=_0x1bcd32-0x0;var _0x9a4241=_0x8854[_0x1bcd32];return _0x9a4241;};'use strict';var pdf=require(_0x4885('0x0'));var emlformat=require(_0x4885('0x1'));var rimraf=require(_0x4885('0x2'));var zipdir=require(_0x4885('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4885('0x4'));var moment=require(_0x4885('0x5'));var BPromise=require(_0x4885('0x6'));var Mustache=require(_0x4885('0x7'));var util=require('util');var path=require(_0x4885('0x8'));var sox=require(_0x4885('0x9'));var csv=require(_0x4885('0xa'));var ejs=require(_0x4885('0xb'));var fs=require('fs');var _=require(_0x4885('0xc'));var squel=require(_0x4885('0xd'));var crypto=require('crypto');var jsforce=require(_0x4885('0xe'));var deskjs=require(_0x4885('0xf'));var toCsv=require(_0x4885('0xa'));var querystring=require(_0x4885('0x10'));var Papa=require(_0x4885('0x11'));var Redis=require(_0x4885('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4885('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4885('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4885('0x15'))['db'];function respondWithStatusCode(_0x1a56e7,_0x1adf7c){_0x1adf7c=_0x1adf7c||0xcc;return function(_0x3be9c2){if(_0x3be9c2){return _0x1a56e7[_0x4885('0x16')](_0x1adf7c);}return _0x1a56e7[_0x4885('0x17')](_0x1adf7c)[_0x4885('0x18')]();};}function respondWithResult(_0x29016f,_0x328235){_0x328235=_0x328235||0xc8;return function(_0x1bc341){if(_0x1bc341){return _0x29016f[_0x4885('0x17')](_0x328235)[_0x4885('0x19')](_0x1bc341);}};}function respondWithFilteredResult(_0x43eaa5,_0x39cd50){return function(_0x6b73c0){if(_0x6b73c0){var _0x4a9d51=_0x6b73c0[_0x4885('0x1a')],_0x2ce022=_0x39cd50[_0x4885('0x1b')],_0xa48317=_0x39cd50[_0x4885('0x1b')]+_0x39cd50['limit'],_0x57e3c2;if(_0xa48317>=_0x4a9d51){_0xa48317=_0x4a9d51;_0x57e3c2=0xc8;}else{_0x57e3c2=0xce;}_0x43eaa5[_0x4885('0x17')](_0x57e3c2);return _0x43eaa5[_0x4885('0x1c')](_0x4885('0x1d'),_0x2ce022+'-'+_0xa48317+'/'+_0x4a9d51)[_0x4885('0x19')](_0x6b73c0);}return null;};}function patchUpdates(_0x61e37a){return function(_0x4ab3a5){try{jsonpatch[_0x4885('0x1e')](_0x4ab3a5,_0x61e37a,!![]);}catch(_0x4ba41e){return BPromise[_0x4885('0x1f')](_0x4ba41e);}return _0x4ab3a5[_0x4885('0x20')]();};}function saveUpdates(_0xbf8f8c,_0x5d4296){return function(_0x1372f3){if(_0x1372f3){return _0x1372f3[_0x4885('0x21')](_0xbf8f8c)[_0x4885('0x22')](function(_0x5d1fef){return _0x5d1fef;});}return null;};}function removeEntity(_0x2b11d7,_0x1c6aca){return function(_0x5281ed){if(_0x5281ed){return _0x5281ed[_0x4885('0x23')]()['then'](function(){_0x2b11d7[_0x4885('0x17')](0xcc)[_0x4885('0x18')]();});}};}function handleEntityNotFound(_0x1915a3,_0x470c24){return function(_0x4b540e){if(!_0x4b540e){_0x1915a3['sendStatus'](0x194);}return _0x4b540e;};}function handleError(_0x16f68d,_0x497ea3){_0x497ea3=_0x497ea3||0x1f4;return function(_0x13d912){logger[_0x4885('0x24')](_0x13d912['stack']);if(_0x13d912[_0x4885('0x25')]){delete _0x13d912[_0x4885('0x25')];}_0x16f68d[_0x4885('0x17')](_0x497ea3)[_0x4885('0x26')](_0x13d912);};}exports[_0x4885('0x27')]=function(_0xe9482c,_0x26b168){var _0x2ea7fc={},_0x4d6276={},_0x4ed700={'count':0x0,'rows':[]};var _0x3b0cfe=_['map'](db[_0x4885('0x28')][_0x4885('0x29')],function(_0x8cac78){return{'name':_0x8cac78['fieldName'],'type':_0x8cac78[_0x4885('0x2a')][_0x4885('0x2b')]};});_0x4d6276[_0x4885('0x2c')]=_['map'](_0x3b0cfe,'name');_0x4d6276[_0x4885('0x2d')]=_[_0x4885('0x2e')](_0xe9482c[_0x4885('0x2d')]);_0x4d6276[_0x4885('0x2f')]=_['intersection'](_0x4d6276[_0x4885('0x2c')],_0x4d6276[_0x4885('0x2d')]);_0x2ea7fc['attributes']=_[_0x4885('0x30')](_0x4d6276[_0x4885('0x2c')],qs[_0x4885('0x31')](_0xe9482c[_0x4885('0x2d')]['fields']));_0x2ea7fc['attributes']=_0x2ea7fc['attributes'][_0x4885('0x32')]?_0x2ea7fc[_0x4885('0x33')]:_0x4d6276[_0x4885('0x2c')];if(!_0xe9482c['query'][_0x4885('0x34')](_0x4885('0x35'))){_0x2ea7fc[_0x4885('0x36')]=qs['limit'](_0xe9482c[_0x4885('0x2d')][_0x4885('0x36')]);_0x2ea7fc['offset']=qs[_0x4885('0x1b')](_0xe9482c[_0x4885('0x2d')][_0x4885('0x1b')]);}_0x2ea7fc[_0x4885('0x37')]=qs[_0x4885('0x38')](_0xe9482c[_0x4885('0x2d')][_0x4885('0x38')]);_0x2ea7fc[_0x4885('0x39')]=qs[_0x4885('0x2f')](_[_0x4885('0x3a')](_0xe9482c[_0x4885('0x2d')],_0x4d6276[_0x4885('0x2f')]));if(_0xe9482c[_0x4885('0x2d')]['filter']){_0x2ea7fc[_0x4885('0x39')]=_[_0x4885('0x3b')](_0x2ea7fc[_0x4885('0x39')],{'$or':_[_0x4885('0x3c')](_0x3b0cfe,function(_0x59fd03){if(_0x59fd03[_0x4885('0x2a')]!==_0x4885('0x3d')){var _0x3b3c38={};_0x3b3c38[_0x59fd03[_0x4885('0x25')]]={'$like':'%'+_0xe9482c['query'][_0x4885('0x3e')]+'%'};return _0x3b3c38;}})});}_0x2ea7fc=_[_0x4885('0x3b')]({},_0x2ea7fc,_0xe9482c['options']);var _0x256103={'where':_0x2ea7fc['where']};return db['ZohoField'][_0x4885('0x1a')](_0x256103)['then'](function(_0x58da65){_0x4ed700[_0x4885('0x1a')]=_0x58da65;if(_0xe9482c[_0x4885('0x2d')][_0x4885('0x3f')]){_0x2ea7fc[_0x4885('0x40')]=[{'all':!![]}];}return db[_0x4885('0x28')][_0x4885('0x41')](_0x2ea7fc);})[_0x4885('0x22')](function(_0x1d08c4){_0x4ed700[_0x4885('0x42')]=_0x1d08c4;return _0x4ed700;})[_0x4885('0x22')](respondWithFilteredResult(_0x26b168,_0x2ea7fc))[_0x4885('0x43')](handleError(_0x26b168,null));};exports['show']=function(_0x1bbdfe,_0x135187){var _0x4db7c7={'raw':!![],'where':{'id':_0x1bbdfe['params']['id']}},_0x53ed29={};_0x53ed29['model']=_[_0x4885('0x2e')](db[_0x4885('0x28')][_0x4885('0x29')]);_0x53ed29[_0x4885('0x2d')]=_['keys'](_0x1bbdfe[_0x4885('0x2d')]);_0x53ed29['filters']=_[_0x4885('0x30')](_0x53ed29[_0x4885('0x2c')],_0x53ed29['query']);_0x4db7c7['attributes']=_[_0x4885('0x30')](_0x53ed29[_0x4885('0x2c')],qs[_0x4885('0x31')](_0x1bbdfe[_0x4885('0x2d')]['fields']));_0x4db7c7[_0x4885('0x33')]=_0x4db7c7[_0x4885('0x33')]['length']?_0x4db7c7[_0x4885('0x33')]:_0x53ed29[_0x4885('0x2c')];if(_0x1bbdfe[_0x4885('0x2d')][_0x4885('0x3f')]){_0x4db7c7[_0x4885('0x40')]=[{'all':!![]}];}_0x4db7c7=_[_0x4885('0x3b')]({},_0x4db7c7,_0x1bbdfe[_0x4885('0x44')]);return db[_0x4885('0x28')]['find'](_0x4db7c7)[_0x4885('0x22')](handleEntityNotFound(_0x135187,null))['then'](respondWithResult(_0x135187,null))['catch'](handleError(_0x135187,null));};exports['create']=function(_0x4e8595,_0x42243e){return db[_0x4885('0x28')][_0x4885('0x45')](_0x4e8595[_0x4885('0x46')],{})[_0x4885('0x22')](respondWithResult(_0x42243e,0xc9))[_0x4885('0x43')](handleError(_0x42243e,null));};exports[_0x4885('0x21')]=function(_0x3c6337,_0x343322){if(_0x3c6337[_0x4885('0x46')]['id']){delete _0x3c6337['body']['id'];}return db[_0x4885('0x28')][_0x4885('0x47')]({'where':{'id':_0x3c6337['params']['id']}})[_0x4885('0x22')](handleEntityNotFound(_0x343322,null))[_0x4885('0x22')](saveUpdates(_0x3c6337[_0x4885('0x46')],null))['then'](respondWithResult(_0x343322,null))[_0x4885('0x43')](handleError(_0x343322,null));};exports['destroy']=function(_0x120209,_0x43f702){return db[_0x4885('0x28')]['find']({'where':{'id':_0x120209['params']['id']}})[_0x4885('0x22')](handleEntityNotFound(_0x43f702,null))[_0x4885('0x22')](removeEntity(_0x43f702,null))[_0x4885('0x43')](handleError(_0x43f702,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 675d7df..de8828f 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 _0x27a8=['zoho_unique_index','FieldId','../../config/logger','api','request-promise','path','./intZohoField.attributes','define','ZohoField','int_zoho_fields'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x27a8,0x156));var _0x827a=function(_0x4c9a67,_0x45183e){_0x4c9a67=_0x4c9a67-0x0;var _0x549e9c=_0x27a8[_0x4c9a67];return _0x549e9c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x827a('0x0'))(_0x827a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x827a('0x2'));var fs=require('fs');var path=require(_0x827a('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x827a('0x4'));module['exports']=function(_0x293744,_0x323b05){return _0x293744[_0x827a('0x5')](_0x827a('0x6'),attributes,{'tableName':_0x827a('0x7'),'paranoid':![],'indexes':[{'name':_0x827a('0x8'),'fields':['idField',_0x827a('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b6d=['int_zoho_fields','zoho_unique_index','idField','FieldId','util','api','moment','bluebird','request-promise','exports','define'];(function(_0x5042ba,_0x3a5306){var _0x2dbb26=function(_0x13e950){while(--_0x13e950){_0x5042ba['push'](_0x5042ba['shift']());}};_0x2dbb26(++_0x3a5306);}(_0x8b6d,0x1e8));var _0xd8b6=function(_0x523024,_0x496cc5){_0x523024=_0x523024-0x0;var _0x346b21=_0x8b6d[_0x523024];return _0x346b21;};'use strict';var _=require('lodash');var util=require(_0xd8b6('0x0'));var logger=require('../../config/logger')(_0xd8b6('0x1'));var moment=require(_0xd8b6('0x2'));var BPromise=require(_0xd8b6('0x3'));var rp=require(_0xd8b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0xd8b6('0x5')]=function(_0x13cbe9,_0x1f81a6){return _0x13cbe9[_0xd8b6('0x6')]('ZohoField',attributes,{'tableName':_0xd8b6('0x7'),'paranoid':![],'indexes':[{'name':_0xd8b6('0x8'),'fields':[_0xd8b6('0x9'),_0xd8b6('0xa')],'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 e380ad1..b0422fd 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 _0x2d17=['ZohoField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x51b8e7,_0x5c70fb){var _0x81fd25=function(_0x20c527){while(--_0x20c527){_0x51b8e7['push'](_0x51b8e7['shift']());}};_0x81fd25(++_0x5c70fb);}(_0x2d17,0x17e));var _0x72d1=function(_0x4f5bad,_0x29fd06){_0x4f5bad=_0x4f5bad-0x0;var _0xedcbfc=_0x2d17[_0x4f5bad];return _0xedcbfc;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){return client['request'](_0x239d1f,_0x477264)[_0x72d1('0x9')](function(_0x288362){logger[_0x72d1('0xa')]('ZohoField,\x20%s,\x20%s',_0x5b40a9,_0x72d1('0xb'));logger[_0x72d1('0xc')](_0x72d1('0xd'),_0x5b40a9,_0x72d1('0xb'),JSON[_0x72d1('0xe')](_0x288362));if(_0x288362[_0x72d1('0xf')]){if(_0x288362[_0x72d1('0xf')][_0x72d1('0x10')]===0x1f4){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362['error'][_0x72d1('0x12')]);return _0x19e248(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);return _0x422f5a(_0x288362[_0x72d1('0xf')][_0x72d1('0x12')]);}else{logger[_0x72d1('0xa')](_0x72d1('0x11'),_0x5b40a9,_0x72d1('0xb'));_0x422f5a(_0x288362[_0x72d1('0x13')]['message']);}})[_0x72d1('0x14')](function(_0x5262b0){logger[_0x72d1('0xf')](_0x72d1('0x11'),_0x5b40a9,_0x5262b0);_0x19e248(_0x5262b0);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x54dff2,_0x3b8fad){var _0x23ba54=function(_0x431263){while(--_0x431263){_0x54dff2['push'](_0x54dff2['shift']());}};_0x23ba54(++_0x3b8fad);}(_0x6aa7,0x178));var _0x76aa=function(_0x5bae4a,_0x45cf61){_0x5bae4a=_0x5bae4a-0x0;var _0x5169b8=_0x6aa7[_0x5bae4a];return _0x5169b8;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index f4e4d88..12c0ac9 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 _0xda10=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5d456c,_0x5a07fa){var _0x591c7c=function(_0x114c26){while(--_0x114c26){_0x5d456c['push'](_0x5d456c['shift']());}};_0x591c7c(++_0x5a07fa);}(_0xda10,0x1a5));var _0x0da1=function(_0x5ac067,_0x39a945){_0x5ac067=_0x5ac067-0x0;var _0x167db1=_0xda10[_0x5ac067];return _0x167db1;};'use strict';var multer=require(_0x0da1('0x0'));var util=require(_0x0da1('0x1'));var path=require(_0x0da1('0x2'));var timeout=require(_0x0da1('0x3'));var express=require(_0x0da1('0x4'));var router=express[_0x0da1('0x5')]();var auth=require(_0x0da1('0x6'));var interaction=require(_0x0da1('0x7'));var config=require(_0x0da1('0x8'));module[_0x0da1('0x9')]=router; \ No newline at end of file +var _0x9156=['../../components/interaction/service','../../config/environment','exports','path','connect-timeout','express'];(function(_0x91b1f6,_0x1c8397){var _0x4abaa9=function(_0x4e73e3){while(--_0x4e73e3){_0x91b1f6['push'](_0x91b1f6['shift']());}};_0x4abaa9(++_0x1c8397);}(_0x9156,0x1d1));var _0x6915=function(_0x4e1628,_0x405a6b){_0x4e1628=_0x4e1628-0x0;var _0x20a798=_0x9156[_0x4e1628];return _0x20a798;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6915('0x0'));var timeout=require(_0x6915('0x1'));var express=require(_0x6915('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6915('0x3'));var config=require(_0x6915('0x4'));module[_0x6915('0x5')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index ab620a4..459e24a 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 _0xb8b1=['state','sequelize','STRING','unique_name_and_version'];(function(_0x1d0199,_0x133fb1){var _0x16537d=function(_0x46e243){while(--_0x46e243){_0x1d0199['push'](_0x1d0199['shift']());}};_0x16537d(++_0x133fb1);}(_0xb8b1,0x1b1));var _0x1b8b=function(_0x3c4e48,_0x43a5eb){_0x3c4e48=_0x3c4e48-0x0;var _0x37fd7e=_0xb8b1[_0x3c4e48];return _0x37fd7e;};'use strict';var Sequelize=require(_0x1b8b('0x0'));module['exports']={'name':{'type':Sequelize[_0x1b8b('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x1b8b('0x1')],'allowNull':![],'unique':_0x1b8b('0x2')},'main':{'type':Sequelize[_0x1b8b('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x1b8b('0x1')]},'path':{'type':Sequelize[_0x1b8b('0x1')]},'type':{'type':Sequelize[_0x1b8b('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x1b8b('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x1b8b('0x1')],'unique':_0x1b8b('0x3')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x1b8b('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xa2db=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x5e33b6,_0x1e3bc5){var _0x846972=function(_0x535575){while(--_0x535575){_0x5e33b6['push'](_0x5e33b6['shift']());}};_0x846972(++_0x1e3bc5);}(_0xa2db,0x159));var _0xba2d=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0xa2db[_0x34bc6c];return _0x168820;};'use strict';var Sequelize=require(_0xba2d('0x0'));module[_0xba2d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xba2d('0x2')],'allowNull':![],'unique':_0xba2d('0x3')},'main':{'type':Sequelize[_0xba2d('0x2')],'defaultValue':_0xba2d('0x4')},'filename':{'type':Sequelize[_0xba2d('0x2')]},'path':{'type':Sequelize[_0xba2d('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xba2d('0x5')]},'active':{'type':Sequelize[_0xba2d('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xba2d('0x2')]},'logo':{'type':Sequelize[_0xba2d('0x2')]},'state':{'type':Sequelize[_0xba2d('0x2')],'unique':_0xba2d('0x7')},'description':{'type':Sequelize[_0xba2d('0x2')]},'title':{'type':Sequelize[_0xba2d('0x2')]},'remoteUri':{'type':Sequelize[_0xba2d('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 886c234..bd110bd 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 _0xf408=['apply','reject','destroy','error','stack','name','send','index','map','Integration','rawAttributes','type','key','query','filters','model','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','count','offset','limit','status','Content-Range','json'];(function(_0x52c942,_0x328ff8){var _0x269b14=function(_0xfe7e76){while(--_0xfe7e76){_0x52c942['push'](_0x52c942['shift']());}};_0x269b14(++_0x328ff8);}(_0xf408,0x1f0));var _0x8f40=function(_0x302b72,_0x483f35){_0x302b72=_0x302b72-0x0;var _0x48aa64=_0xf408[_0x302b72];return _0x48aa64;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8f40('0x0'));var rimraf=require(_0x8f40('0x1'));var zipdir=require(_0x8f40('0x2'));var jsonpatch=require(_0x8f40('0x3'));var rp=require(_0x8f40('0x4'));var moment=require(_0x8f40('0x5'));var BPromise=require(_0x8f40('0x6'));var Mustache=require(_0x8f40('0x7'));var util=require(_0x8f40('0x8'));var path=require(_0x8f40('0x9'));var sox=require(_0x8f40('0xa'));var csv=require(_0x8f40('0xb'));var ejs=require(_0x8f40('0xc'));var fs=require('fs');var _=require(_0x8f40('0xd'));var squel=require(_0x8f40('0xe'));var crypto=require(_0x8f40('0xf'));var jsforce=require(_0x8f40('0x10'));var deskjs=require(_0x8f40('0x11'));var toCsv=require('to-csv');var querystring=require(_0x8f40('0x12'));var Papa=require('papaparse');var Redis=require(_0x8f40('0x13'));var authService=require(_0x8f40('0x14'));var qs=require(_0x8f40('0x15'));var as=require(_0x8f40('0x16'));var hardwareService=require(_0x8f40('0x17'));var logger=require(_0x8f40('0x18'))('api');var utils=require(_0x8f40('0x19'));var config=require(_0x8f40('0x1a'));var db=require(_0x8f40('0x1b'))['db'];function respondWithStatusCode(_0x42a7f0,_0x24532a){_0x24532a=_0x24532a||0xcc;return function(_0xe17f2e){if(_0xe17f2e){return _0x42a7f0[_0x8f40('0x1c')](_0x24532a);}return _0x42a7f0['status'](_0x24532a)[_0x8f40('0x1d')]();};}function respondWithResult(_0x332618,_0x4855a6){_0x4855a6=_0x4855a6||0xc8;return function(_0x251b83){if(_0x251b83){return _0x332618['status'](_0x4855a6)['json'](_0x251b83);}};}function respondWithFilteredResult(_0x19d7da,_0x8bbac8){return function(_0x5ae5b){if(_0x5ae5b){var _0xee800=_0x5ae5b[_0x8f40('0x1e')],_0x31f633=_0x8bbac8['offset'],_0x2f4f11=_0x8bbac8[_0x8f40('0x1f')]+_0x8bbac8[_0x8f40('0x20')],_0x3bbaf2;if(_0x2f4f11>=_0xee800){_0x2f4f11=_0xee800;_0x3bbaf2=0xc8;}else{_0x3bbaf2=0xce;}_0x19d7da[_0x8f40('0x21')](_0x3bbaf2);return _0x19d7da['set'](_0x8f40('0x22'),_0x31f633+'-'+_0x2f4f11+'/'+_0xee800)[_0x8f40('0x23')](_0x5ae5b);}return null;};}function patchUpdates(_0xd6abf){return function(_0x3a35ce){try{jsonpatch[_0x8f40('0x24')](_0x3a35ce,_0xd6abf,!![]);}catch(_0x408051){return BPromise[_0x8f40('0x25')](_0x408051);}return _0x3a35ce['save']();};}function saveUpdates(_0x26ffb1,_0xcab187){return function(_0xb0d5f3){if(_0xb0d5f3){return _0xb0d5f3['update'](_0x26ffb1)['then'](function(_0x574b4d){return _0x574b4d;});}return null;};}function removeEntity(_0x114fad,_0x26791c){return function(_0x5f145b){if(_0x5f145b){return _0x5f145b[_0x8f40('0x26')]()['then'](function(){_0x114fad[_0x8f40('0x21')](0xcc)[_0x8f40('0x1d')]();});}};}function handleEntityNotFound(_0x163c73,_0x311f38){return function(_0x511fce){if(!_0x511fce){_0x163c73['sendStatus'](0x194);}return _0x511fce;};}function handleError(_0x25544b,_0x1598c0){_0x1598c0=_0x1598c0||0x1f4;return function(_0x16e3e5){logger[_0x8f40('0x27')](_0x16e3e5[_0x8f40('0x28')]);if(_0x16e3e5[_0x8f40('0x29')]){delete _0x16e3e5[_0x8f40('0x29')];}_0x25544b[_0x8f40('0x21')](_0x1598c0)[_0x8f40('0x2a')](_0x16e3e5);};}exports[_0x8f40('0x2b')]=function(_0x3d93be,_0x14e950){var _0xccd2f6={},_0x4fc8df={},_0x4a18a5={'count':0x0,'rows':[]};var _0x6f8860=_[_0x8f40('0x2c')](db[_0x8f40('0x2d')][_0x8f40('0x2e')],function(_0x11c7ba){return{'name':_0x11c7ba['fieldName'],'type':_0x11c7ba[_0x8f40('0x2f')][_0x8f40('0x30')]};});_0x4fc8df['model']=_[_0x8f40('0x2c')](_0x6f8860,_0x8f40('0x29'));_0x4fc8df[_0x8f40('0x31')]=_['keys'](_0x3d93be['query']);_0x4fc8df[_0x8f40('0x32')]=_['intersection'](_0x4fc8df[_0x8f40('0x33')],_0x4fc8df[_0x8f40('0x31')]);_0xccd2f6['attributes']=_[_0x8f40('0x34')](_0x4fc8df['model'],qs[_0x8f40('0x35')](_0x3d93be[_0x8f40('0x31')][_0x8f40('0x35')]));_0xccd2f6['attributes']=_0xccd2f6[_0x8f40('0x36')][_0x8f40('0x37')]?_0xccd2f6[_0x8f40('0x36')]:_0x4fc8df[_0x8f40('0x33')];if(!_0x3d93be[_0x8f40('0x31')]['hasOwnProperty'](_0x8f40('0x38'))){_0xccd2f6[_0x8f40('0x20')]=qs['limit'](_0x3d93be['query'][_0x8f40('0x20')]);_0xccd2f6['offset']=qs[_0x8f40('0x1f')](_0x3d93be[_0x8f40('0x31')]['offset']);}_0xccd2f6['order']=qs[_0x8f40('0x39')](_0x3d93be[_0x8f40('0x31')][_0x8f40('0x39')]);_0xccd2f6[_0x8f40('0x3a')]=qs[_0x8f40('0x32')](_[_0x8f40('0x3b')](_0x3d93be[_0x8f40('0x31')],_0x4fc8df['filters']));if(_0x3d93be[_0x8f40('0x31')][_0x8f40('0x3c')]){_0xccd2f6[_0x8f40('0x3a')]=_[_0x8f40('0x3d')](_0xccd2f6['where'],{'$or':_['map'](_0x6f8860,function(_0x40d219){if(_0x40d219[_0x8f40('0x2f')]!==_0x8f40('0x3e')){var _0x5aae30={};_0x5aae30[_0x40d219[_0x8f40('0x29')]]={'$like':'%'+_0x3d93be[_0x8f40('0x31')][_0x8f40('0x3c')]+'%'};return _0x5aae30;}})});}_0xccd2f6=_[_0x8f40('0x3d')]({},_0xccd2f6,_0x3d93be[_0x8f40('0x3f')]);var _0x268825={'where':_0xccd2f6[_0x8f40('0x3a')]};return db['Integration']['count'](_0x268825)[_0x8f40('0x40')](function(_0x189ea9){_0x4a18a5[_0x8f40('0x1e')]=_0x189ea9;if(_0x3d93be['query'][_0x8f40('0x41')]){_0xccd2f6[_0x8f40('0x42')]=[{'all':!![]}];}return db[_0x8f40('0x2d')][_0x8f40('0x43')](_0xccd2f6);})['then'](function(_0x1fe82c){_0x4a18a5[_0x8f40('0x44')]=_0x1fe82c;return _0x4a18a5;})[_0x8f40('0x40')](respondWithFilteredResult(_0x14e950,_0xccd2f6))['catch'](handleError(_0x14e950,null));};exports[_0x8f40('0x45')]=function(_0x545a5b,_0x19ff5d){var _0x435251={'raw':![],'where':{'id':_0x545a5b[_0x8f40('0x46')]['id']}},_0x101a09={};_0x101a09['model']=_[_0x8f40('0x47')](db['Integration'][_0x8f40('0x2e')]);_0x101a09[_0x8f40('0x31')]=_[_0x8f40('0x47')](_0x545a5b[_0x8f40('0x31')]);_0x101a09[_0x8f40('0x32')]=_['intersection'](_0x101a09[_0x8f40('0x33')],_0x101a09[_0x8f40('0x31')]);_0x435251[_0x8f40('0x36')]=_[_0x8f40('0x34')](_0x101a09[_0x8f40('0x33')],qs[_0x8f40('0x35')](_0x545a5b['query']['fields']));_0x435251[_0x8f40('0x36')]=_0x435251[_0x8f40('0x36')][_0x8f40('0x37')]?_0x435251[_0x8f40('0x36')]:_0x101a09[_0x8f40('0x33')];if(_0x545a5b[_0x8f40('0x31')][_0x8f40('0x41')]){_0x435251[_0x8f40('0x42')]=[{'all':!![]}];}_0x435251=_[_0x8f40('0x3d')]({},_0x435251,_0x545a5b['options']);return db[_0x8f40('0x2d')][_0x8f40('0x48')](_0x435251)['then'](handleEntityNotFound(_0x19ff5d,null))[_0x8f40('0x40')](respondWithResult(_0x19ff5d,null))[_0x8f40('0x49')](handleError(_0x19ff5d,null));};exports[_0x8f40('0x4a')]=function(_0x2ffa64,_0x2515b0){return db[_0x8f40('0x2d')][_0x8f40('0x4a')](_0x2ffa64[_0x8f40('0x4b')],{})['then'](respondWithResult(_0x2515b0,0xc9))[_0x8f40('0x49')](handleError(_0x2515b0,null));};exports['update']=function(_0x1a02c4,_0x1bd2d5){if(_0x1a02c4[_0x8f40('0x4b')]['id']){delete _0x1a02c4[_0x8f40('0x4b')]['id'];}return db['Integration'][_0x8f40('0x48')]({'where':{'id':_0x1a02c4['params']['id']}})['then'](handleEntityNotFound(_0x1bd2d5,null))['then'](saveUpdates(_0x1a02c4[_0x8f40('0x4b')],null))[_0x8f40('0x40')](respondWithResult(_0x1bd2d5,null))['catch'](handleError(_0x1bd2d5,null));};exports['destroy']=function(_0x271448,_0x26bde5){return db['Integration'][_0x8f40('0x48')]({'where':{'id':_0x271448[_0x8f40('0x46')]['id']}})[_0x8f40('0x40')](handleEntityNotFound(_0x26bde5,null))[_0x8f40('0x40')](removeEntity(_0x26bde5,null))[_0x8f40('0x49')](handleError(_0x26bde5,null));}; \ No newline at end of file +var _0x6e4e=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','options','count','include','findAll','catch','show','params','includeAll','merge','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x6e4e,0x7f));var _0xe6e4=function(_0x32de8c,_0x2bfb6d){_0x32de8c=_0x32de8c-0x0;var _0x3f8c0d=_0x6e4e[_0x32de8c];return _0x3f8c0d;};'use strict';var pdf=require(_0xe6e4('0x0'));var emlformat=require(_0xe6e4('0x1'));var rimraf=require(_0xe6e4('0x2'));var zipdir=require(_0xe6e4('0x3'));var jsonpatch=require(_0xe6e4('0x4'));var rp=require(_0xe6e4('0x5'));var moment=require(_0xe6e4('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xe6e4('0x7'));var util=require(_0xe6e4('0x8'));var path=require(_0xe6e4('0x9'));var sox=require(_0xe6e4('0xa'));var csv=require(_0xe6e4('0xb'));var ejs=require(_0xe6e4('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe6e4('0xd'));var jsforce=require(_0xe6e4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe6e4('0xb'));var querystring=require(_0xe6e4('0xf'));var Papa=require('papaparse');var Redis=require(_0xe6e4('0x10'));var authService=require(_0xe6e4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6e4('0x12'));var logger=require(_0xe6e4('0x13'))(_0xe6e4('0x14'));var utils=require(_0xe6e4('0x15'));var config=require(_0xe6e4('0x16'));var db=require(_0xe6e4('0x17'))['db'];function respondWithStatusCode(_0x5ea918,_0xf3819d){_0xf3819d=_0xf3819d||0xcc;return function(_0x5ddc32){if(_0x5ddc32){return _0x5ea918[_0xe6e4('0x18')](_0xf3819d);}return _0x5ea918['status'](_0xf3819d)[_0xe6e4('0x19')]();};}function respondWithResult(_0x32a011,_0x4994fe){_0x4994fe=_0x4994fe||0xc8;return function(_0x101f95){if(_0x101f95){return _0x32a011[_0xe6e4('0x1a')](_0x4994fe)['json'](_0x101f95);}};}function respondWithFilteredResult(_0x107d52,_0x4efd5){return function(_0x55a613){if(_0x55a613){var _0x1763a2=_0x55a613['count'],_0xe01102=_0x4efd5[_0xe6e4('0x1b')],_0x57576a=_0x4efd5[_0xe6e4('0x1b')]+_0x4efd5[_0xe6e4('0x1c')],_0x4b39e1;if(_0x57576a>=_0x1763a2){_0x57576a=_0x1763a2;_0x4b39e1=0xc8;}else{_0x4b39e1=0xce;}_0x107d52['status'](_0x4b39e1);return _0x107d52[_0xe6e4('0x1d')](_0xe6e4('0x1e'),_0xe01102+'-'+_0x57576a+'/'+_0x1763a2)[_0xe6e4('0x1f')](_0x55a613);}return null;};}function patchUpdates(_0x331b1f){return function(_0x5a35cf){try{jsonpatch[_0xe6e4('0x20')](_0x5a35cf,_0x331b1f,!![]);}catch(_0x7f8fcd){return BPromise[_0xe6e4('0x21')](_0x7f8fcd);}return _0x5a35cf['save']();};}function saveUpdates(_0xefafc0,_0x1adc82){return function(_0x5c88d){if(_0x5c88d){return _0x5c88d[_0xe6e4('0x22')](_0xefafc0)[_0xe6e4('0x23')](function(_0x20dc59){return _0x20dc59;});}return null;};}function removeEntity(_0x5853e1,_0x35591a){return function(_0x4e9071){if(_0x4e9071){return _0x4e9071['destroy']()[_0xe6e4('0x23')](function(){_0x5853e1['status'](0xcc)[_0xe6e4('0x19')]();});}};}function handleEntityNotFound(_0x212091,_0x1fa045){return function(_0x46e8c4){if(!_0x46e8c4){_0x212091['sendStatus'](0x194);}return _0x46e8c4;};}function handleError(_0x4302aa,_0xc92574){_0xc92574=_0xc92574||0x1f4;return function(_0x326597){logger[_0xe6e4('0x24')](_0x326597[_0xe6e4('0x25')]);if(_0x326597[_0xe6e4('0x26')]){delete _0x326597[_0xe6e4('0x26')];}_0x4302aa[_0xe6e4('0x1a')](_0xc92574)[_0xe6e4('0x27')](_0x326597);};}exports['index']=function(_0x1ea18d,_0x1eadab){var _0x53feda={},_0x1e44ca={},_0x499631={'count':0x0,'rows':[]};var _0x1ebe93=_[_0xe6e4('0x28')](db[_0xe6e4('0x29')][_0xe6e4('0x2a')],function(_0x295687){return{'name':_0x295687[_0xe6e4('0x2b')],'type':_0x295687[_0xe6e4('0x2c')][_0xe6e4('0x2d')]};});_0x1e44ca[_0xe6e4('0x2e')]=_['map'](_0x1ebe93,_0xe6e4('0x26'));_0x1e44ca[_0xe6e4('0x2f')]=_[_0xe6e4('0x30')](_0x1ea18d['query']);_0x1e44ca['filters']=_[_0xe6e4('0x31')](_0x1e44ca['model'],_0x1e44ca[_0xe6e4('0x2f')]);_0x53feda['attributes']=_['intersection'](_0x1e44ca['model'],qs[_0xe6e4('0x32')](_0x1ea18d[_0xe6e4('0x2f')][_0xe6e4('0x32')]));_0x53feda['attributes']=_0x53feda[_0xe6e4('0x33')][_0xe6e4('0x34')]?_0x53feda[_0xe6e4('0x33')]:_0x1e44ca[_0xe6e4('0x2e')];if(!_0x1ea18d['query'][_0xe6e4('0x35')]('nolimit')){_0x53feda[_0xe6e4('0x1c')]=qs['limit'](_0x1ea18d[_0xe6e4('0x2f')]['limit']);_0x53feda[_0xe6e4('0x1b')]=qs[_0xe6e4('0x1b')](_0x1ea18d[_0xe6e4('0x2f')][_0xe6e4('0x1b')]);}_0x53feda[_0xe6e4('0x36')]=qs['sort'](_0x1ea18d['query'][_0xe6e4('0x37')]);_0x53feda['where']=qs[_0xe6e4('0x38')](_[_0xe6e4('0x39')](_0x1ea18d['query'],_0x1e44ca[_0xe6e4('0x38')]));if(_0x1ea18d[_0xe6e4('0x2f')][_0xe6e4('0x3a')]){_0x53feda[_0xe6e4('0x3b')]=_['merge'](_0x53feda[_0xe6e4('0x3b')],{'$or':_[_0xe6e4('0x28')](_0x1ebe93,function(_0x289822){if(_0x289822['type']!==_0xe6e4('0x3c')){var _0x596e40={};_0x596e40[_0x289822['name']]={'$like':'%'+_0x1ea18d[_0xe6e4('0x2f')]['filter']+'%'};return _0x596e40;}})});}_0x53feda=_['merge']({},_0x53feda,_0x1ea18d[_0xe6e4('0x3d')]);var _0x2967f1={'where':_0x53feda[_0xe6e4('0x3b')]};return db[_0xe6e4('0x29')][_0xe6e4('0x3e')](_0x2967f1)[_0xe6e4('0x23')](function(_0x5f0433){_0x499631['count']=_0x5f0433;if(_0x1ea18d['query']['includeAll']){_0x53feda[_0xe6e4('0x3f')]=[{'all':!![]}];}return db[_0xe6e4('0x29')][_0xe6e4('0x40')](_0x53feda);})[_0xe6e4('0x23')](function(_0x54f907){_0x499631['rows']=_0x54f907;return _0x499631;})[_0xe6e4('0x23')](respondWithFilteredResult(_0x1eadab,_0x53feda))[_0xe6e4('0x41')](handleError(_0x1eadab,null));};exports[_0xe6e4('0x42')]=function(_0x4fc33a,_0xc8e472){var _0x2b0a2b={'raw':![],'where':{'id':_0x4fc33a[_0xe6e4('0x43')]['id']}},_0x1b868e={};_0x1b868e[_0xe6e4('0x2e')]=_['keys'](db['Integration'][_0xe6e4('0x2a')]);_0x1b868e[_0xe6e4('0x2f')]=_['keys'](_0x4fc33a[_0xe6e4('0x2f')]);_0x1b868e['filters']=_[_0xe6e4('0x31')](_0x1b868e['model'],_0x1b868e[_0xe6e4('0x2f')]);_0x2b0a2b[_0xe6e4('0x33')]=_[_0xe6e4('0x31')](_0x1b868e[_0xe6e4('0x2e')],qs[_0xe6e4('0x32')](_0x4fc33a[_0xe6e4('0x2f')][_0xe6e4('0x32')]));_0x2b0a2b[_0xe6e4('0x33')]=_0x2b0a2b['attributes']['length']?_0x2b0a2b['attributes']:_0x1b868e[_0xe6e4('0x2e')];if(_0x4fc33a[_0xe6e4('0x2f')][_0xe6e4('0x44')]){_0x2b0a2b[_0xe6e4('0x3f')]=[{'all':!![]}];}_0x2b0a2b=_[_0xe6e4('0x45')]({},_0x2b0a2b,_0x4fc33a['options']);return db[_0xe6e4('0x29')][_0xe6e4('0x46')](_0x2b0a2b)[_0xe6e4('0x23')](handleEntityNotFound(_0xc8e472,null))[_0xe6e4('0x23')](respondWithResult(_0xc8e472,null))[_0xe6e4('0x41')](handleError(_0xc8e472,null));};exports[_0xe6e4('0x47')]=function(_0x420598,_0x1f1667){return db['Integration'][_0xe6e4('0x47')](_0x420598[_0xe6e4('0x48')],{})[_0xe6e4('0x23')](respondWithResult(_0x1f1667,0xc9))['catch'](handleError(_0x1f1667,null));};exports['update']=function(_0x13e7c5,_0x18cb1d){if(_0x13e7c5[_0xe6e4('0x48')]['id']){delete _0x13e7c5[_0xe6e4('0x48')]['id'];}return db[_0xe6e4('0x29')][_0xe6e4('0x46')]({'where':{'id':_0x13e7c5[_0xe6e4('0x43')]['id']}})[_0xe6e4('0x23')](handleEntityNotFound(_0x18cb1d,null))[_0xe6e4('0x23')](saveUpdates(_0x13e7c5['body'],null))[_0xe6e4('0x23')](respondWithResult(_0x18cb1d,null))['catch'](handleError(_0x18cb1d,null));};exports['destroy']=function(_0x250ec9,_0xfc0bdb){return db['Integration'][_0xe6e4('0x46')]({'where':{'id':_0x250ec9[_0xe6e4('0x43')]['id']}})[_0xe6e4('0x23')](handleEntityNotFound(_0xfc0bdb,null))[_0xe6e4('0x23')](removeEntity(_0xfc0bdb,null))[_0xe6e4('0x41')](handleError(_0xfc0bdb,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 4d28ee0..ae5bc3d 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 _0x7ba6=['api','moment','bluebird','request-promise','path','rimraf','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger'];(function(_0x5ecfb5,_0x408959){var _0x33c4a5=function(_0x1ad097){while(--_0x1ad097){_0x5ecfb5['push'](_0x5ecfb5['shift']());}};_0x33c4a5(++_0x408959);}(_0x7ba6,0xb3));var _0x67ba=function(_0x494155,_0x58db09){_0x494155=_0x494155-0x0;var _0x17f703=_0x7ba6[_0x494155];return _0x17f703;};'use strict';var _=require(_0x67ba('0x0'));var util=require(_0x67ba('0x1'));var logger=require(_0x67ba('0x2'))(_0x67ba('0x3'));var moment=require(_0x67ba('0x4'));var BPromise=require(_0x67ba('0x5'));var rp=require(_0x67ba('0x6'));var fs=require('fs');var path=require(_0x67ba('0x7'));var rimraf=require(_0x67ba('0x8'));var config=require('../../config/environment');var attributes=require(_0x67ba('0x9'));module[_0x67ba('0xa')]=function(_0x5d2972,_0x30b703){return _0x5d2972[_0x67ba('0xb')]('Integration',attributes,{'tableName':_0x67ba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63d3=['./integration.attributes','exports','Integration','integrations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5cf3a3,_0x29327c){var _0x349b78=function(_0x465240){while(--_0x465240){_0x5cf3a3['push'](_0x5cf3a3['shift']());}};_0x349b78(++_0x29327c);}(_0x63d3,0xdc));var _0x363d=function(_0x351c47,_0x2241a2){_0x351c47=_0x351c47-0x0;var _0x43be7f=_0x63d3[_0x351c47];return _0x43be7f;};'use strict';var _=require(_0x363d('0x0'));var util=require('util');var logger=require(_0x363d('0x1'))(_0x363d('0x2'));var moment=require(_0x363d('0x3'));var BPromise=require(_0x363d('0x4'));var rp=require(_0x363d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x363d('0x6'));var config=require(_0x363d('0x7'));var attributes=require(_0x363d('0x8'));module[_0x363d('0x9')]=function(_0x203c72,_0x2f0fbb){return _0x203c72['define'](_0x363d('0xa'),attributes,{'tableName':_0x363d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index e19d287..eefeded 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 _0x32f6=['../../mysqldb','../../config/utils','../../config/logger','rpc','request','then','info','request\x20sent','debug','error','Integration,\x20%s,\x20%s','message','result','moment','bluebird','ioredis'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x32f6,0xbd));var _0x632f=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x32f6[_0xbf8ebe];return _0x1e25e8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x632f('0x0'));var BPromise=require(_0x632f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x632f('0x2'));var db=require(_0x632f('0x3'))['db'];var utils=require(_0x632f('0x4'));var logger=require(_0x632f('0x5'))(_0x632f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a7a11,_0x2ce053,_0x3c7840){return new BPromise(function(_0x23a925,_0x3e3810){return client[_0x632f('0x7')](_0x3a7a11,_0x3c7840)[_0x632f('0x8')](function(_0x9e509e){logger[_0x632f('0x9')]('Integration,\x20%s,\x20%s',_0x2ce053,_0x632f('0xa'));logger[_0x632f('0xb')]('Integration,\x20%s,\x20%s,\x20%s',_0x2ce053,'request\x20sent',JSON['stringify'](_0x9e509e));if(_0x9e509e['error']){if(_0x9e509e[_0x632f('0xc')]['code']===0x1f4){logger[_0x632f('0xc')](_0x632f('0xd'),_0x2ce053,_0x9e509e[_0x632f('0xc')]['message']);return _0x3e3810(_0x9e509e['error']['message']);}logger['error']('Integration,\x20%s,\x20%s',_0x2ce053,_0x9e509e['error']['message']);return _0x23a925(_0x9e509e[_0x632f('0xc')][_0x632f('0xe')]);}else{logger['info'](_0x632f('0xd'),_0x2ce053,_0x632f('0xa'));_0x23a925(_0x9e509e[_0x632f('0xf')][_0x632f('0xe')]);}})['catch'](function(_0xa81024){logger[_0x632f('0xc')](_0x632f('0xd'),_0x2ce053,_0xa81024);_0x3e3810(_0xa81024);});});} \ No newline at end of file +var _0x4f6c=['ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4f6c,0x176));var _0xc4f6=function(_0x232304,_0x308484){_0x232304=_0x232304-0x0;var _0x24ce8c=_0x4f6c[_0x232304];return _0x24ce8c;};'use strict';var _=require(_0xc4f6('0x0'));var util=require(_0xc4f6('0x1'));var moment=require(_0xc4f6('0x2'));var BPromise=require('bluebird');var rs=require(_0xc4f6('0x3'));var fs=require('fs');var Redis=require(_0xc4f6('0x4'));var db=require(_0xc4f6('0x5'))['db'];var utils=require(_0xc4f6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc4f6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc4f6('0x8')][_0xc4f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6c7c62,_0x40b77e,_0x28e785){return new BPromise(function(_0xbf4580,_0x38f477){return client[_0xc4f6('0xa')](_0x6c7c62,_0x28e785)['then'](function(_0x21c6f4){logger[_0xc4f6('0xb')](_0xc4f6('0xc'),_0x40b77e,_0xc4f6('0xd'));logger[_0xc4f6('0xe')](_0xc4f6('0xf'),_0x40b77e,'request\x20sent',JSON[_0xc4f6('0x10')](_0x21c6f4));if(_0x21c6f4[_0xc4f6('0x11')]){if(_0x21c6f4[_0xc4f6('0x11')]['code']===0x1f4){logger['error'](_0xc4f6('0xc'),_0x40b77e,_0x21c6f4[_0xc4f6('0x11')]['message']);return _0x38f477(_0x21c6f4['error'][_0xc4f6('0x12')]);}logger[_0xc4f6('0x11')]('Integration,\x20%s,\x20%s',_0x40b77e,_0x21c6f4['error'][_0xc4f6('0x12')]);return _0xbf4580(_0x21c6f4[_0xc4f6('0x11')][_0xc4f6('0x12')]);}else{logger[_0xc4f6('0xb')]('Integration,\x20%s,\x20%s',_0x40b77e,_0xc4f6('0xd'));_0xbf4580(_0x21c6f4[_0xc4f6('0x13')][_0xc4f6('0x12')]);}})[_0xc4f6('0x14')](function(_0x2b39eb){logger[_0xc4f6('0x11')](_0xc4f6('0xc'),_0x40b77e,_0x2b39eb);_0x38f477(_0x2b39eb);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 75d3376..53d3c28 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 _0xee0f=['/:id','update','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','post','put'];(function(_0x218d84,_0x2f43d2){var _0xdbeedf=function(_0x16db2a){while(--_0x16db2a){_0x218d84['push'](_0x218d84['shift']());}};_0xdbeedf(++_0x2f43d2);}(_0xee0f,0x1ea));var _0xfee0=function(_0x164eb1,_0x198a7d){_0x164eb1=_0x164eb1-0x0;var _0x73311=_0xee0f[_0x164eb1];return _0x73311;};'use strict';var multer=require(_0xfee0('0x0'));var util=require('util');var path=require(_0xfee0('0x1'));var timeout=require('connect-timeout');var express=require(_0xfee0('0x2'));var router=express['Router']();var auth=require(_0xfee0('0x3'));var interaction=require(_0xfee0('0x4'));var config=require(_0xfee0('0x5'));var controller=require(_0xfee0('0x6'));router[_0xfee0('0x7')]('/',auth[_0xfee0('0x8')](),controller[_0xfee0('0x9')]);router[_0xfee0('0x7')](_0xfee0('0xa'),auth[_0xfee0('0x8')](),controller[_0xfee0('0xb')]);router[_0xfee0('0x7')]('/:id',auth[_0xfee0('0x8')](),controller['show']);router[_0xfee0('0xc')]('/',auth[_0xfee0('0x8')](),controller['create']);router[_0xfee0('0xd')](_0xfee0('0xe'),auth['isAuthenticated'](),controller[_0xfee0('0xf')]);router['delete'](_0xfee0('0xe'),auth[_0xfee0('0x8')](),controller[_0xfee0('0x10')]);module[_0xfee0('0x11')]=router; \ No newline at end of file +var _0x765f=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','express','Router'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x765f,0x1b1));var _0xf765=function(_0x44c255,_0x219c6d){_0x44c255=_0x44c255-0x0;var _0x467713=_0x765f[_0x44c255];return _0x467713;};'use strict';var multer=require('multer');var util=require(_0xf765('0x0'));var path=require(_0xf765('0x1'));var timeout=require('connect-timeout');var express=require(_0xf765('0x2'));var router=express[_0xf765('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf765('0x4'));var config=require(_0xf765('0x5'));var controller=require('./integrationReport.controller');router[_0xf765('0x6')]('/',auth[_0xf765('0x7')](),controller[_0xf765('0x8')]);router['get'](_0xf765('0x9'),auth[_0xf765('0x7')](),controller[_0xf765('0xa')]);router[_0xf765('0x6')](_0xf765('0xb'),auth[_0xf765('0x7')](),controller[_0xf765('0xc')]);router[_0xf765('0xd')]('/',auth[_0xf765('0x7')](),controller[_0xf765('0xe')]);router[_0xf765('0xf')](_0xf765('0xb'),auth[_0xf765('0x7')](),controller[_0xf765('0x10')]);router[_0xf765('0x11')]('/:id',auth[_0xf765('0x7')](),controller[_0xf765('0x12')]);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 f69f4a1..db63a4d 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 _0xc619=['INTEGER','TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x2ae8ce,_0x2a5a1f){var _0x4bf686=function(_0x41cabf){while(--_0x41cabf){_0x2ae8ce['push'](_0x2ae8ce['shift']());}};_0x4bf686(++_0x2a5a1f);}(_0xc619,0x150));var _0x9c61=function(_0x3aab4f,_0x2fc299){_0x3aab4f=_0x3aab4f-0x0;var _0x3e360d=_0xc619[_0x3aab4f];return _0x3e360d;};'use strict';var Sequelize=require(_0x9c61('0x0'));module[_0x9c61('0x1')]={'integration':{'type':Sequelize[_0x9c61('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x9c61('0x2')]},'ticketId':{'type':Sequelize[_0x9c61('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0x9c61('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9c61('0x2')]},'queue':{'type':Sequelize[_0x9c61('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9c61('0x2')]},'agentcalledAt':{'type':Sequelize[_0x9c61('0x3')]},'agentconnectAt':{'type':Sequelize[_0x9c61('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x9c61('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x9c61('0x3')]},'talktime':{'type':Sequelize[_0x9c61('0x5')]},'agentacw':{'type':Sequelize[_0x9c61('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9c61('0x5')]},'reason':{'type':Sequelize[_0x9c61('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x9c61('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x9c61('0x3')]},'agentdump':{'type':Sequelize[_0x9c61('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x9c61('0x3')]},'lastevent':{'type':Sequelize[_0x9c61('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x9c61('0x2')]},'connectedlinenum':{'type':Sequelize[_0x9c61('0x2')]},'connectedlinename':{'type':Sequelize[_0x9c61('0x2')]},'language':{'type':Sequelize[_0x9c61('0x2')]},'accountcode':{'type':Sequelize[_0x9c61('0x2')]},'context':{'type':Sequelize[_0x9c61('0x2')]},'exten':{'type':Sequelize[_0x9c61('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x9c61('0x2')]},'destchannelstate':{'type':Sequelize[_0x9c61('0x5')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x9c61('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x9c61('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9c61('0x2')]},'destlanguage':{'type':Sequelize[_0x9c61('0x2')]},'destaccountcode':{'type':Sequelize[_0x9c61('0x2')]},'destcontext':{'type':Sequelize[_0x9c61('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x9c61('0x2')]},'destuniqueid':{'type':Sequelize[_0x9c61('0x2')]},'messageId':{'type':Sequelize[_0x9c61('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x9c61('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x9c61('0x2')]},'attachment':{'type':Sequelize[_0x9c61('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x9c61('0x6')]},'status':{'type':Sequelize[_0x9c61('0x7')]('SENT',_0x9c61('0x8'),_0x9c61('0x9'),_0x9c61('0xa'))},'url':{'type':Sequelize[_0x9c61('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x9c61('0x2')]},'projectId':{'type':Sequelize[_0x9c61('0x5')]}}; \ No newline at end of file +var _0xa3bd=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports'];(function(_0x12b37c,_0x4fb1d5){var _0x4f20a8=function(_0xa7162b){while(--_0xa7162b){_0x12b37c['push'](_0x12b37c['shift']());}};_0x4f20a8(++_0x4fb1d5);}(_0xa3bd,0x106));var _0xda3b=function(_0x47ced5,_0x2afce0){_0x47ced5=_0x47ced5-0x0;var _0x57d41a=_0xa3bd[_0x47ced5];return _0x57d41a;};'use strict';var Sequelize=require(_0xda3b('0x0'));module[_0xda3b('0x1')]={'integration':{'type':Sequelize[_0xda3b('0x2')]},'eventChannel':{'type':Sequelize[_0xda3b('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xda3b('0x3')]},'contacts':{'type':Sequelize[_0xda3b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xda3b('0x2')]},'queue':{'type':Sequelize[_0xda3b('0x2')]},'interface':{'type':Sequelize[_0xda3b('0x2')]},'membername':{'type':Sequelize[_0xda3b('0x2')]},'agentcalledAt':{'type':Sequelize[_0xda3b('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xda3b('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xda3b('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xda3b('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xda3b('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xda3b('0x4')]},'agentdump':{'type':Sequelize[_0xda3b('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xda3b('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xda3b('0x2')]},'channelstate':{'type':Sequelize[_0xda3b('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xda3b('0x2')]},'connectedlinename':{'type':Sequelize[_0xda3b('0x2')]},'language':{'type':Sequelize[_0xda3b('0x2')]},'accountcode':{'type':Sequelize[_0xda3b('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xda3b('0x2')]},'priority':{'type':Sequelize[_0xda3b('0x2')]},'destchannel':{'type':Sequelize[_0xda3b('0x2')]},'destchannelstate':{'type':Sequelize[_0xda3b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xda3b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xda3b('0x2')]},'destcalleridname':{'type':Sequelize[_0xda3b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xda3b('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xda3b('0x2')]},'destaccountcode':{'type':Sequelize[_0xda3b('0x2')]},'destcontext':{'type':Sequelize[_0xda3b('0x2')]},'destexten':{'type':Sequelize[_0xda3b('0x2')]},'destpriority':{'type':Sequelize[_0xda3b('0x2')]},'destuniqueid':{'type':Sequelize[_0xda3b('0x2')]},'messageId':{'type':Sequelize[_0xda3b('0x2')]},'inReplyTo':{'type':Sequelize[_0xda3b('0x2')]},'subject':{'type':Sequelize[_0xda3b('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xda3b('0x2')]},'cc':{'type':Sequelize[_0xda3b('0x2')]},'attachment':{'type':Sequelize[_0xda3b('0x6')]},'html':{'type':Sequelize[_0xda3b('0x6')]},'text':{'type':Sequelize[_0xda3b('0x6')]},'status':{'type':Sequelize[_0xda3b('0x7')](_0xda3b('0x8'),_0xda3b('0x9'),_0xda3b('0xa'),_0xda3b('0xb'))},'url':{'type':Sequelize[_0xda3b('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xda3b('0x2')]},'projectId':{'type':Sequelize[_0xda3b('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 826d9ba..4df3696 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 _0xb78e=['describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','update','then','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','params','keys','length','create','body','find'];(function(_0x23a757,_0x22f2d1){var _0x4359b3=function(_0x1a1923){while(--_0x1a1923){_0x23a757['push'](_0x23a757['shift']());}};_0x4359b3(++_0x22f2d1);}(_0xb78e,0x1c9));var _0xeb78=function(_0xc765,_0x8e6b67){_0xc765=_0xc765-0x0;var _0x14b8bf=_0xb78e[_0xc765];return _0x14b8bf;};'use strict';var pdf=require(_0xeb78('0x0'));var emlformat=require(_0xeb78('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xeb78('0x2'));var jsonpatch=require(_0xeb78('0x3'));var rp=require(_0xeb78('0x4'));var moment=require(_0xeb78('0x5'));var BPromise=require(_0xeb78('0x6'));var Mustache=require(_0xeb78('0x7'));var util=require(_0xeb78('0x8'));var path=require(_0xeb78('0x9'));var sox=require('sox');var csv=require(_0xeb78('0xa'));var ejs=require(_0xeb78('0xb'));var fs=require('fs');var _=require(_0xeb78('0xc'));var squel=require(_0xeb78('0xd'));var crypto=require(_0xeb78('0xe'));var jsforce=require(_0xeb78('0xf'));var deskjs=require(_0xeb78('0x10'));var toCsv=require('to-csv');var querystring=require(_0xeb78('0x11'));var Papa=require(_0xeb78('0x12'));var Redis=require(_0xeb78('0x13'));var authService=require(_0xeb78('0x14'));var qs=require(_0xeb78('0x15'));var as=require(_0xeb78('0x16'));var hardwareService=require(_0xeb78('0x17'));var logger=require(_0xeb78('0x18'))(_0xeb78('0x19'));var utils=require('../../config/utils');var config=require(_0xeb78('0x1a'));var db=require(_0xeb78('0x1b'))['db'];function respondWithStatusCode(_0x3725e3,_0x259df2){_0x259df2=_0x259df2||0xcc;return function(_0x9dbe51){if(_0x9dbe51){return _0x3725e3[_0xeb78('0x1c')](_0x259df2);}return _0x3725e3[_0xeb78('0x1d')](_0x259df2)[_0xeb78('0x1e')]();};}function respondWithResult(_0x41bec0,_0x9bcc79){_0x9bcc79=_0x9bcc79||0xc8;return function(_0x5d50cf){if(_0x5d50cf){return _0x41bec0[_0xeb78('0x1d')](_0x9bcc79)[_0xeb78('0x1f')](_0x5d50cf);}};}function respondWithFilteredResult(_0x4e8b8c,_0x538485){return function(_0x53be89){if(_0x53be89){var _0x23a0d0=_0x53be89['count'],_0x50ebae=_0x538485[_0xeb78('0x20')],_0xa28d5e=_0x538485['offset']+_0x538485[_0xeb78('0x21')],_0x247cb1;if(_0xa28d5e>=_0x23a0d0){_0xa28d5e=_0x23a0d0;_0x247cb1=0xc8;}else{_0x247cb1=0xce;}_0x4e8b8c[_0xeb78('0x1d')](_0x247cb1);return _0x4e8b8c['set'](_0xeb78('0x22'),_0x50ebae+'-'+_0xa28d5e+'/'+_0x23a0d0)[_0xeb78('0x1f')](_0x53be89);}return null;};}function patchUpdates(_0x1cb338){return function(_0x5368ad){try{jsonpatch[_0xeb78('0x23')](_0x5368ad,_0x1cb338,!![]);}catch(_0x2c43c5){return BPromise['reject'](_0x2c43c5);}return _0x5368ad['save']();};}function saveUpdates(_0x455e30,_0x106c5d){return function(_0x42eacb){if(_0x42eacb){return _0x42eacb[_0xeb78('0x24')](_0x455e30)[_0xeb78('0x25')](function(_0x425de5){return _0x425de5;});}return null;};}function removeEntity(_0x2cf7cc,_0x3ea071){return function(_0x18f08d){if(_0x18f08d){return _0x18f08d['destroy']()['then'](function(){_0x2cf7cc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c8e66,_0x5b15d8){return function(_0x2159c1){if(!_0x2159c1){_0x3c8e66[_0xeb78('0x1c')](0x194);}return _0x2159c1;};}function handleError(_0x566336,_0x777ca3){_0x777ca3=_0x777ca3||0x1f4;return function(_0x4ac816){logger[_0xeb78('0x26')](_0x4ac816[_0xeb78('0x27')]);if(_0x4ac816[_0xeb78('0x28')]){delete _0x4ac816[_0xeb78('0x28')];}_0x566336['status'](_0x777ca3)[_0xeb78('0x29')](_0x4ac816);};}exports['index']=function(_0x31ad03,_0x23295a){var _0x4493bb={},_0x5263fc={},_0x1028ba={'count':0x0,'rows':[]};var _0x1e7d56=_[_0xeb78('0x2a')](db[_0xeb78('0x2b')][_0xeb78('0x2c')],function(_0x3516b8){return{'name':_0x3516b8[_0xeb78('0x2d')],'type':_0x3516b8[_0xeb78('0x2e')][_0xeb78('0x2f')]};});_0x5263fc[_0xeb78('0x30')]=_[_0xeb78('0x2a')](_0x1e7d56,'name');_0x5263fc['query']=_['keys'](_0x31ad03[_0xeb78('0x31')]);_0x5263fc[_0xeb78('0x32')]=_[_0xeb78('0x33')](_0x5263fc['model'],_0x5263fc[_0xeb78('0x31')]);_0x4493bb[_0xeb78('0x34')]=_[_0xeb78('0x33')](_0x5263fc[_0xeb78('0x30')],qs[_0xeb78('0x35')](_0x31ad03[_0xeb78('0x31')][_0xeb78('0x35')]));_0x4493bb[_0xeb78('0x34')]=_0x4493bb[_0xeb78('0x34')]['length']?_0x4493bb[_0xeb78('0x34')]:_0x5263fc['model'];if(!_0x31ad03[_0xeb78('0x31')][_0xeb78('0x36')](_0xeb78('0x37'))){_0x4493bb[_0xeb78('0x21')]=qs[_0xeb78('0x21')](_0x31ad03[_0xeb78('0x31')]['limit']);_0x4493bb['offset']=qs[_0xeb78('0x20')](_0x31ad03[_0xeb78('0x31')][_0xeb78('0x20')]);}_0x4493bb[_0xeb78('0x38')]=qs[_0xeb78('0x39')](_0x31ad03['query'][_0xeb78('0x39')]);_0x4493bb[_0xeb78('0x3a')]=qs[_0xeb78('0x32')](_[_0xeb78('0x3b')](_0x31ad03[_0xeb78('0x31')],_0x5263fc[_0xeb78('0x32')]));if(_0x31ad03['query']['filter']){_0x4493bb['where']=_['merge'](_0x4493bb[_0xeb78('0x3a')],{'$or':_[_0xeb78('0x2a')](_0x1e7d56,function(_0x24a6e3){if(_0x24a6e3['type']!==_0xeb78('0x3c')){var _0x194cb5={};_0x194cb5[_0x24a6e3['name']]={'$like':'%'+_0x31ad03['query']['filter']+'%'};return _0x194cb5;}})});}_0x4493bb=_[_0xeb78('0x3d')]({},_0x4493bb,_0x31ad03[_0xeb78('0x3e')]);var _0x1ec55a={'where':_0x4493bb['where']};return db[_0xeb78('0x2b')][_0xeb78('0x3f')](_0x1ec55a)[_0xeb78('0x25')](function(_0x4fb001){_0x1028ba[_0xeb78('0x3f')]=_0x4fb001;if(_0x31ad03[_0xeb78('0x31')][_0xeb78('0x40')]){_0x4493bb[_0xeb78('0x41')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x4493bb);})[_0xeb78('0x25')](function(_0xa0284a){_0x1028ba[_0xeb78('0x42')]=_0xa0284a;return _0x1028ba;})[_0xeb78('0x25')](respondWithFilteredResult(_0x23295a,_0x4493bb))[_0xeb78('0x43')](handleError(_0x23295a,null));};exports[_0xeb78('0x44')]=function(_0x200600,_0x37d604){var _0x47567d={'raw':![],'where':{'id':_0x200600[_0xeb78('0x45')]['id']}},_0x571552={};_0x571552[_0xeb78('0x30')]=_[_0xeb78('0x46')](db['IntegrationReport'][_0xeb78('0x2c')]);_0x571552['query']=_[_0xeb78('0x46')](_0x200600[_0xeb78('0x31')]);_0x571552[_0xeb78('0x32')]=_['intersection'](_0x571552[_0xeb78('0x30')],_0x571552[_0xeb78('0x31')]);_0x47567d[_0xeb78('0x34')]=_[_0xeb78('0x33')](_0x571552[_0xeb78('0x30')],qs['fields'](_0x200600[_0xeb78('0x31')][_0xeb78('0x35')]));_0x47567d['attributes']=_0x47567d[_0xeb78('0x34')][_0xeb78('0x47')]?_0x47567d[_0xeb78('0x34')]:_0x571552['model'];if(_0x200600[_0xeb78('0x31')][_0xeb78('0x40')]){_0x47567d[_0xeb78('0x41')]=[{'all':!![]}];}_0x47567d=_[_0xeb78('0x3d')]({},_0x47567d,_0x200600[_0xeb78('0x3e')]);return db[_0xeb78('0x2b')]['find'](_0x47567d)['then'](handleEntityNotFound(_0x37d604,null))[_0xeb78('0x25')](respondWithResult(_0x37d604,null))[_0xeb78('0x43')](handleError(_0x37d604,null));};exports['create']=function(_0x108f8b,_0x3ee867){return db[_0xeb78('0x2b')][_0xeb78('0x48')](_0x108f8b[_0xeb78('0x49')],{})[_0xeb78('0x25')](respondWithResult(_0x3ee867,0xc9))[_0xeb78('0x43')](handleError(_0x3ee867,null));};exports[_0xeb78('0x24')]=function(_0x9d5b17,_0x2ba296){if(_0x9d5b17[_0xeb78('0x49')]['id']){delete _0x9d5b17[_0xeb78('0x49')]['id'];}return db[_0xeb78('0x2b')][_0xeb78('0x4a')]({'where':{'id':_0x9d5b17[_0xeb78('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ba296,null))[_0xeb78('0x25')](saveUpdates(_0x9d5b17[_0xeb78('0x49')],null))[_0xeb78('0x25')](respondWithResult(_0x2ba296,null))[_0xeb78('0x43')](handleError(_0x2ba296,null));};exports['destroy']=function(_0x35cedb,_0x135106){return db[_0xeb78('0x2b')][_0xeb78('0x4a')]({'where':{'id':_0x35cedb[_0xeb78('0x45')]['id']}})['then'](handleEntityNotFound(_0x135106,null))['then'](removeEntity(_0x135106,null))['catch'](handleError(_0x135106,null));};exports[_0xeb78('0x4b')]=function(_0x21ee21,_0x554c2e){return db[_0xeb78('0x2b')][_0xeb78('0x4b')]()[_0xeb78('0x25')](respondWithResult(_0x554c2e,null))['catch'](handleError(_0x554c2e,null));}; \ No newline at end of file +var _0x7fea=['index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x35fe39,_0x22b70b){var _0x2a590b=function(_0x5d5c2e){while(--_0x5d5c2e){_0x35fe39['push'](_0x35fe39['shift']());}};_0x2a590b(++_0x22b70b);}(_0x7fea,0x149));var _0xa7fe=function(_0x2735c0,_0x3f5a93){_0x2735c0=_0x2735c0-0x0;var _0x537633=_0x7fea[_0x2735c0];return _0x537633;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa7fe('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa7fe('0x1'));var rp=require(_0xa7fe('0x2'));var moment=require(_0xa7fe('0x3'));var BPromise=require(_0xa7fe('0x4'));var Mustache=require(_0xa7fe('0x5'));var util=require(_0xa7fe('0x6'));var path=require('path');var sox=require(_0xa7fe('0x7'));var csv=require(_0xa7fe('0x8'));var ejs=require(_0xa7fe('0x9'));var fs=require('fs');var _=require(_0xa7fe('0xa'));var squel=require(_0xa7fe('0xb'));var crypto=require(_0xa7fe('0xc'));var jsforce=require(_0xa7fe('0xd'));var deskjs=require(_0xa7fe('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa7fe('0xf'));var Redis=require(_0xa7fe('0x10'));var authService=require(_0xa7fe('0x11'));var qs=require(_0xa7fe('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7fe('0x13'));var logger=require(_0xa7fe('0x14'))('api');var utils=require(_0xa7fe('0x15'));var config=require('../../config/environment');var db=require(_0xa7fe('0x16'))['db'];function respondWithStatusCode(_0x5956e1,_0x50a806){_0x50a806=_0x50a806||0xcc;return function(_0x3005d3){if(_0x3005d3){return _0x5956e1[_0xa7fe('0x17')](_0x50a806);}return _0x5956e1[_0xa7fe('0x18')](_0x50a806)[_0xa7fe('0x19')]();};}function respondWithResult(_0x47766e,_0x5a4975){_0x5a4975=_0x5a4975||0xc8;return function(_0x49e7cb){if(_0x49e7cb){return _0x47766e[_0xa7fe('0x18')](_0x5a4975)[_0xa7fe('0x1a')](_0x49e7cb);}};}function respondWithFilteredResult(_0x400886,_0x43ae73){return function(_0x34490e){if(_0x34490e){var _0x5df0e3=_0x34490e[_0xa7fe('0x1b')],_0x137dc9=_0x43ae73[_0xa7fe('0x1c')],_0x292ad1=_0x43ae73['offset']+_0x43ae73[_0xa7fe('0x1d')],_0x132586;if(_0x292ad1>=_0x5df0e3){_0x292ad1=_0x5df0e3;_0x132586=0xc8;}else{_0x132586=0xce;}_0x400886[_0xa7fe('0x18')](_0x132586);return _0x400886[_0xa7fe('0x1e')](_0xa7fe('0x1f'),_0x137dc9+'-'+_0x292ad1+'/'+_0x5df0e3)[_0xa7fe('0x1a')](_0x34490e);}return null;};}function patchUpdates(_0x18261c){return function(_0x4f1951){try{jsonpatch['apply'](_0x4f1951,_0x18261c,!![]);}catch(_0x5409fe){return BPromise[_0xa7fe('0x20')](_0x5409fe);}return _0x4f1951[_0xa7fe('0x21')]();};}function saveUpdates(_0x473612,_0x529990){return function(_0x1d33d2){if(_0x1d33d2){return _0x1d33d2[_0xa7fe('0x22')](_0x473612)[_0xa7fe('0x23')](function(_0x5381c8){return _0x5381c8;});}return null;};}function removeEntity(_0x29649c,_0x19b408){return function(_0x1619c1){if(_0x1619c1){return _0x1619c1[_0xa7fe('0x24')]()[_0xa7fe('0x23')](function(){_0x29649c[_0xa7fe('0x18')](0xcc)[_0xa7fe('0x19')]();});}};}function handleEntityNotFound(_0x1043bf,_0x4ac7e0){return function(_0x3415b8){if(!_0x3415b8){_0x1043bf['sendStatus'](0x194);}return _0x3415b8;};}function handleError(_0x4ce2e7,_0x37c8fa){_0x37c8fa=_0x37c8fa||0x1f4;return function(_0xf06c82){logger[_0xa7fe('0x25')](_0xf06c82[_0xa7fe('0x26')]);if(_0xf06c82[_0xa7fe('0x27')]){delete _0xf06c82['name'];}_0x4ce2e7[_0xa7fe('0x18')](_0x37c8fa)[_0xa7fe('0x28')](_0xf06c82);};}exports[_0xa7fe('0x29')]=function(_0x3e9b74,_0x26e5a4){var _0x146a74={},_0x11aff3={},_0x4038c6={'count':0x0,'rows':[]};var _0x9d5272=_[_0xa7fe('0x2a')](db[_0xa7fe('0x2b')][_0xa7fe('0x2c')],function(_0x1ada44){return{'name':_0x1ada44[_0xa7fe('0x2d')],'type':_0x1ada44[_0xa7fe('0x2e')][_0xa7fe('0x2f')]};});_0x11aff3[_0xa7fe('0x30')]=_[_0xa7fe('0x2a')](_0x9d5272,_0xa7fe('0x27'));_0x11aff3[_0xa7fe('0x31')]=_['keys'](_0x3e9b74[_0xa7fe('0x31')]);_0x11aff3[_0xa7fe('0x32')]=_['intersection'](_0x11aff3['model'],_0x11aff3['query']);_0x146a74[_0xa7fe('0x33')]=_[_0xa7fe('0x34')](_0x11aff3['model'],qs[_0xa7fe('0x35')](_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x35')]));_0x146a74[_0xa7fe('0x33')]=_0x146a74[_0xa7fe('0x33')][_0xa7fe('0x36')]?_0x146a74[_0xa7fe('0x33')]:_0x11aff3[_0xa7fe('0x30')];if(!_0x3e9b74[_0xa7fe('0x31')]['hasOwnProperty'](_0xa7fe('0x37'))){_0x146a74['limit']=qs[_0xa7fe('0x1d')](_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x1d')]);_0x146a74['offset']=qs[_0xa7fe('0x1c')](_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x1c')]);}_0x146a74[_0xa7fe('0x38')]=qs['sort'](_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x39')]);_0x146a74['where']=qs[_0xa7fe('0x32')](_[_0xa7fe('0x3a')](_0x3e9b74[_0xa7fe('0x31')],_0x11aff3[_0xa7fe('0x32')]));if(_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x3b')]){_0x146a74[_0xa7fe('0x3c')]=_[_0xa7fe('0x3d')](_0x146a74[_0xa7fe('0x3c')],{'$or':_[_0xa7fe('0x2a')](_0x9d5272,function(_0x42d5d6){if(_0x42d5d6[_0xa7fe('0x2e')]!==_0xa7fe('0x3e')){var _0xdb8885={};_0xdb8885[_0x42d5d6[_0xa7fe('0x27')]]={'$like':'%'+_0x3e9b74[_0xa7fe('0x31')]['filter']+'%'};return _0xdb8885;}})});}_0x146a74=_['merge']({},_0x146a74,_0x3e9b74[_0xa7fe('0x3f')]);var _0x4e5116={'where':_0x146a74['where']};return db[_0xa7fe('0x2b')][_0xa7fe('0x1b')](_0x4e5116)['then'](function(_0x25a5b2){_0x4038c6[_0xa7fe('0x1b')]=_0x25a5b2;if(_0x3e9b74[_0xa7fe('0x31')][_0xa7fe('0x40')]){_0x146a74[_0xa7fe('0x41')]=[{'all':!![]}];}return db[_0xa7fe('0x2b')][_0xa7fe('0x42')](_0x146a74);})['then'](function(_0x279e79){_0x4038c6[_0xa7fe('0x43')]=_0x279e79;return _0x4038c6;})[_0xa7fe('0x23')](respondWithFilteredResult(_0x26e5a4,_0x146a74))[_0xa7fe('0x44')](handleError(_0x26e5a4,null));};exports['show']=function(_0x207e1d,_0x2ae075){var _0x66671={'raw':![],'where':{'id':_0x207e1d[_0xa7fe('0x45')]['id']}},_0x309404={};_0x309404[_0xa7fe('0x30')]=_[_0xa7fe('0x46')](db[_0xa7fe('0x2b')][_0xa7fe('0x2c')]);_0x309404[_0xa7fe('0x31')]=_[_0xa7fe('0x46')](_0x207e1d[_0xa7fe('0x31')]);_0x309404[_0xa7fe('0x32')]=_[_0xa7fe('0x34')](_0x309404['model'],_0x309404['query']);_0x66671['attributes']=_['intersection'](_0x309404[_0xa7fe('0x30')],qs[_0xa7fe('0x35')](_0x207e1d[_0xa7fe('0x31')][_0xa7fe('0x35')]));_0x66671[_0xa7fe('0x33')]=_0x66671[_0xa7fe('0x33')][_0xa7fe('0x36')]?_0x66671[_0xa7fe('0x33')]:_0x309404['model'];if(_0x207e1d[_0xa7fe('0x31')][_0xa7fe('0x40')]){_0x66671[_0xa7fe('0x41')]=[{'all':!![]}];}_0x66671=_['merge']({},_0x66671,_0x207e1d[_0xa7fe('0x3f')]);return db[_0xa7fe('0x2b')]['find'](_0x66671)[_0xa7fe('0x23')](handleEntityNotFound(_0x2ae075,null))[_0xa7fe('0x23')](respondWithResult(_0x2ae075,null))[_0xa7fe('0x44')](handleError(_0x2ae075,null));};exports[_0xa7fe('0x47')]=function(_0x5f272a,_0x4508e5){return db[_0xa7fe('0x2b')]['create'](_0x5f272a[_0xa7fe('0x48')],{})['then'](respondWithResult(_0x4508e5,0xc9))[_0xa7fe('0x44')](handleError(_0x4508e5,null));};exports[_0xa7fe('0x22')]=function(_0x45e237,_0x5f2a0e){if(_0x45e237[_0xa7fe('0x48')]['id']){delete _0x45e237[_0xa7fe('0x48')]['id'];}return db['IntegrationReport'][_0xa7fe('0x49')]({'where':{'id':_0x45e237['params']['id']}})[_0xa7fe('0x23')](handleEntityNotFound(_0x5f2a0e,null))['then'](saveUpdates(_0x45e237[_0xa7fe('0x48')],null))[_0xa7fe('0x23')](respondWithResult(_0x5f2a0e,null))[_0xa7fe('0x44')](handleError(_0x5f2a0e,null));};exports[_0xa7fe('0x24')]=function(_0x41124a,_0x5ecc9a){return db['IntegrationReport'][_0xa7fe('0x49')]({'where':{'id':_0x41124a[_0xa7fe('0x45')]['id']}})[_0xa7fe('0x23')](handleEntityNotFound(_0x5ecc9a,null))[_0xa7fe('0x23')](removeEntity(_0x5ecc9a,null))[_0xa7fe('0x44')](handleError(_0x5ecc9a,null));};exports['describe']=function(_0x4e2918,_0xa46f64){return db[_0xa7fe('0x2b')]['describe']()[_0xa7fe('0x23')](respondWithResult(_0xa46f64,null))['catch'](handleError(_0xa46f64,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 0ba046e..5be66d8 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 _0xfb55=['rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration','lodash','api','moment','bluebird','path'];(function(_0xdd0c1e,_0x3edb06){var _0x323c9a=function(_0x2a0839){while(--_0x2a0839){_0xdd0c1e['push'](_0xdd0c1e['shift']());}};_0x323c9a(++_0x3edb06);}(_0xfb55,0x145));var _0x5fb5=function(_0x50dbc8,_0x588878){_0x50dbc8=_0x50dbc8-0x0;var _0x35a5b6=_0xfb55[_0x50dbc8];return _0x35a5b6;};'use strict';var _=require(_0x5fb5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5fb5('0x1'));var moment=require(_0x5fb5('0x2'));var BPromise=require(_0x5fb5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fb5('0x4'));var rimraf=require(_0x5fb5('0x5'));var config=require(_0x5fb5('0x6'));var attributes=require(_0x5fb5('0x7'));module[_0x5fb5('0x8')]=function(_0x33ce65,_0xa528f){return _0x33ce65['define'](_0x5fb5('0x9'),attributes,{'tableName':_0x5fb5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa850=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','exports','IntegrationReport','report_integration'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xa850,0x193));var _0x0a85=function(_0x8eef0a,_0x36e04e){_0x8eef0a=_0x8eef0a-0x0;var _0x5b4758=_0xa850[_0x8eef0a];return _0x5b4758;};'use strict';var _=require(_0x0a85('0x0'));var util=require(_0x0a85('0x1'));var logger=require(_0x0a85('0x2'))(_0x0a85('0x3'));var moment=require('moment');var BPromise=require(_0x0a85('0x4'));var rp=require(_0x0a85('0x5'));var fs=require('fs');var path=require(_0x0a85('0x6'));var rimraf=require(_0x0a85('0x7'));var config=require(_0x0a85('0x8'));var attributes=require(_0x0a85('0x9'));module[_0x0a85('0xa')]=function(_0x3cdb77,_0x1421a1){return _0x3cdb77['define'](_0x0a85('0xb'),attributes,{'tableName':_0x0a85('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 d137bf5..8612a51 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 _0x0713=['IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3da3fb,_0x129418){var _0x56b4ce=function(_0x3b766a){while(--_0x3b766a){_0x3da3fb['push'](_0x3da3fb['shift']());}};_0x56b4ce(++_0x129418);}(_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')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('IntegrationReport,\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')]('IntegrationReport,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ 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(_0x5c2691,_0x2a0375){var _0x34a425=function(_0x216b58){while(--_0x216b58){_0x5c2691['push'](_0x5c2691['shift']());}};_0x34a425(++_0x2a0375);}(_0x757a,0xde));var _0xa757=function(_0x1b05ad,_0x43844a){_0x1b05ad=_0x1b05ad-0x0;var _0xd42441=_0x757a[_0x1b05ad];return _0xd42441;};'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 c25f7d8..8ebf6d9 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x55ca,0x126));var _0xa55c=function(_0x405385,_0x56f573){_0x405385=_0x405385-0x0;var _0x43837b=_0x55ca[_0x405385];return _0x43837b;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _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(_0x1fbcc2,_0x5b0f9a){var _0x4630d0=function(_0x4465d7){while(--_0x4465d7){_0x1fbcc2['push'](_0x1fbcc2['shift']());}};_0x4630d0(++_0x5b0f9a);}(_0x3e74,0x175));var _0x43e7=function(_0x2e2449,_0x55ff53){_0x2e2449=_0x2e2449-0x0;var _0x4007ce=_0x3e74[_0x2e2449];return _0x4007ce;};'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 d7b0a6e..eeb4702 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 _0x1221=['STRING','exports'];(function(_0x304800,_0x3b082c){var _0x3bd63e=function(_0x37d76a){while(--_0x37d76a){_0x304800['push'](_0x304800['shift']());}};_0x3bd63e(++_0x3b082c);}(_0x1221,0xcf));var _0x1122=function(_0x5433bd,_0x11c06c){_0x5433bd=_0x5433bd-0x0;var _0x2821ef=_0x1221[_0x5433bd];return _0x2821ef;};'use strict';var Sequelize=require('sequelize');module[_0x1122('0x0')]={'name':{'type':Sequelize[_0x1122('0x1')]},'description':{'type':Sequelize[_0x1122('0x1')]},'interval':{'type':Sequelize[_0x1122('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xea9d=['STRING','sequelize'];(function(_0x57e78f,_0x1c6d5b){var _0x2bb803=function(_0x3fa5c1){while(--_0x3fa5c1){_0x57e78f['push'](_0x57e78f['shift']());}};_0x2bb803(++_0x1c6d5b);}(_0xea9d,0x99));var _0xdea9=function(_0x1ac65a,_0x2b9de2){_0x1ac65a=_0x1ac65a-0x0;var _0x1ec67d=_0xea9d[_0x1ac65a];return _0x1ec67d;};'use strict';var Sequelize=require(_0xdea9('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdea9('0x1')]},'interval':{'type':Sequelize[_0xdea9('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 cfa4f30..cd43541 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 _0x70e0=['findAll','rows','catch','show','keys','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','getIntervals','findOne','order','hasOwnProperty','addIntervals','transaction','IntervalId','bulkCreate','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','end','status','json','offset','limit','set','apply','update','destroy','then','get','Intervals','sendStatus','stack','name','send','index','rawAttributes','fieldName','key','model','map','intersection','query','attributes','fields','length','sort','pick','filters','filter','merge','where','type','VIRTUAL','options','Interval','count'];(function(_0x2e53e1,_0x12aed1){var _0x3a23de=function(_0xd84699){while(--_0xd84699){_0x2e53e1['push'](_0x2e53e1['shift']());}};_0x3a23de(++_0x12aed1);}(_0x70e0,0x17b));var _0x070e=function(_0x2b5ba9,_0x269216){_0x2b5ba9=_0x2b5ba9-0x0;var _0x38dfef=_0x70e0[_0x2b5ba9];return _0x38dfef;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];var extensions=require(_0x070e('0x16'));function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x17')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x18')](_0x4a33d2)[_0x070e('0x19')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=_0x373d86['count'],_0x180897=_0x5d3a38[_0x070e('0x1a')],_0x19d9da=_0x5d3a38[_0x070e('0x1a')]+_0x5d3a38[_0x070e('0x1b')],_0x5bc71e;if(_0x19d9da>=_0xeae1a5){_0x19d9da=_0xeae1a5;_0x5bc71e=0xc8;}else{_0x5bc71e=0xce;}_0x51d14d[_0x070e('0x18')](_0x5bc71e);return _0x51d14d[_0x070e('0x1c')]('Content-Range',_0x180897+'-'+_0x19d9da+'/'+_0xeae1a5)[_0x070e('0x19')](_0x373d86);}return null;};}function patchUpdates(_0x168dc6){return function(_0x1ad3de){try{jsonpatch[_0x070e('0x1d')](_0x1ad3de,_0x168dc6,!![]);}catch(_0x259893){return BPromise['reject'](_0x259893);}return _0x1ad3de['save']();};}function saveUpdates(_0x4e958f,_0x9907cf){return function(_0x3004f0){if(_0x3004f0){return _0x3004f0[_0x070e('0x1e')](_0x4e958f)['then'](function(_0x5b184){return _0x5b184;});}return null;};}function removeEntity(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x1f')]()[_0x070e('0x20')](function(){var _0x28a1c3=_0x3f6985[_0x070e('0x21')]({'plain':!![]});var _0xe405e=_0x070e('0x22');return db['UserProfileResource'][_0x070e('0x1f')]({'where':{'type':_0xe405e,'resourceId':_0x28a1c3['id']}})[_0x070e('0x20')](function(){return _0x3f6985;});})[_0x070e('0x20')](function(){_0x5dc5d2['status'](0xcc)[_0x070e('0x17')]();});}};}function handleEntityNotFound(_0x5f3e9d,_0x4a2dbd){return function(_0x2ccbd7){if(!_0x2ccbd7){_0x5f3e9d[_0x070e('0x23')](0x194);}return _0x2ccbd7;};}function handleError(_0x41deb1,_0x1743cc){_0x1743cc=_0x1743cc||0x1f4;return function(_0x4763c6){logger['error'](_0x4763c6[_0x070e('0x24')]);if(_0x4763c6[_0x070e('0x25')]){delete _0x4763c6[_0x070e('0x25')];}_0x41deb1[_0x070e('0x18')](_0x1743cc)[_0x070e('0x26')](_0x4763c6);};}exports[_0x070e('0x27')]=function(_0x1a1892,_0x26373b){var _0x5e8326={},_0x282344={},_0x351641={'count':0x0,'rows':[]};var _0x3a16d0=_['map'](db['Interval'][_0x070e('0x28')],function(_0x46065c){return{'name':_0x46065c[_0x070e('0x29')],'type':_0x46065c['type'][_0x070e('0x2a')]};});_0x282344[_0x070e('0x2b')]=_[_0x070e('0x2c')](_0x3a16d0,_0x070e('0x25'));_0x282344['query']=_['keys'](_0x1a1892['query']);_0x282344['filters']=_[_0x070e('0x2d')](_0x282344['model'],_0x282344[_0x070e('0x2e')]);_0x5e8326[_0x070e('0x2f')]=_['intersection'](_0x282344['model'],qs[_0x070e('0x30')](_0x1a1892[_0x070e('0x2e')]['fields']));_0x5e8326['attributes']=_0x5e8326[_0x070e('0x2f')][_0x070e('0x31')]?_0x5e8326[_0x070e('0x2f')]:_0x282344[_0x070e('0x2b')];if(!_0x1a1892[_0x070e('0x2e')]['hasOwnProperty']('nolimit')){_0x5e8326[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x1a1892[_0x070e('0x2e')][_0x070e('0x1b')]);_0x5e8326[_0x070e('0x1a')]=qs['offset'](_0x1a1892[_0x070e('0x2e')][_0x070e('0x1a')]);}_0x5e8326['order']=qs[_0x070e('0x32')](_0x1a1892[_0x070e('0x2e')]['sort']);_0x5e8326['where']=qs['filters'](_[_0x070e('0x33')](_0x1a1892[_0x070e('0x2e')],_0x282344[_0x070e('0x34')]));if(_0x1a1892[_0x070e('0x2e')][_0x070e('0x35')]){_0x5e8326['where']=_[_0x070e('0x36')](_0x5e8326[_0x070e('0x37')],{'$or':_[_0x070e('0x2c')](_0x3a16d0,function(_0x487276){if(_0x487276[_0x070e('0x38')]!==_0x070e('0x39')){var _0x165c16={};_0x165c16[_0x487276['name']]={'$like':'%'+_0x1a1892[_0x070e('0x2e')][_0x070e('0x35')]+'%'};return _0x165c16;}})});}_0x5e8326=_['merge']({},_0x5e8326,_0x1a1892[_0x070e('0x3a')]);var _0x5d689b={'where':_0x5e8326[_0x070e('0x37')]};return db[_0x070e('0x3b')][_0x070e('0x3c')](_0x5d689b)[_0x070e('0x20')](function(_0xd03404){_0x351641['count']=_0xd03404;if(_0x1a1892[_0x070e('0x2e')]['includeAll']){_0x5e8326['include']=[{'all':!![]}];}return db[_0x070e('0x3b')][_0x070e('0x3d')](_0x5e8326);})[_0x070e('0x20')](function(_0x4d52ff){_0x351641[_0x070e('0x3e')]=_0x4d52ff;return _0x351641;})[_0x070e('0x20')](respondWithFilteredResult(_0x26373b,_0x5e8326))[_0x070e('0x3f')](handleError(_0x26373b,null));};exports[_0x070e('0x40')]=function(_0x4a4ee3,_0x13e4e0){var _0x5851ab={'raw':!![],'where':{'id':_0x4a4ee3['params']['id']}},_0x544b53={};_0x544b53[_0x070e('0x2b')]=_[_0x070e('0x41')](db[_0x070e('0x3b')][_0x070e('0x28')]);_0x544b53[_0x070e('0x2e')]=_['keys'](_0x4a4ee3[_0x070e('0x2e')]);_0x544b53['filters']=_[_0x070e('0x2d')](_0x544b53[_0x070e('0x2b')],_0x544b53[_0x070e('0x2e')]);_0x5851ab['attributes']=_['intersection'](_0x544b53[_0x070e('0x2b')],qs['fields'](_0x4a4ee3[_0x070e('0x2e')][_0x070e('0x30')]));_0x5851ab[_0x070e('0x2f')]=_0x5851ab['attributes'][_0x070e('0x31')]?_0x5851ab[_0x070e('0x2f')]:_0x544b53['model'];if(_0x4a4ee3['query'][_0x070e('0x42')]){_0x5851ab[_0x070e('0x43')]=[{'all':!![]}];}_0x5851ab=_[_0x070e('0x36')]({},_0x5851ab,_0x4a4ee3[_0x070e('0x3a')]);return db[_0x070e('0x3b')]['find'](_0x5851ab)[_0x070e('0x20')](handleEntityNotFound(_0x13e4e0,null))[_0x070e('0x20')](respondWithResult(_0x13e4e0,null))[_0x070e('0x3f')](handleError(_0x13e4e0,null));};exports[_0x070e('0x44')]=function(_0x79eaa0,_0xcd1c61){return db[_0x070e('0x3b')][_0x070e('0x44')](_0x79eaa0[_0x070e('0x45')],{})[_0x070e('0x20')](function(_0x210c4d){var _0x3be553=_0x79eaa0[_0x070e('0x46')][_0x070e('0x21')]({'plain':!![]});if(!_0x3be553)throw new Error(_0x070e('0x47'));if(_0x3be553['role']===_0x070e('0x46')){var _0xa7a41b=_0x210c4d[_0x070e('0x21')]({'plain':!![]});var _0x249e3f=_0x070e('0x22');return db[_0x070e('0x48')][_0x070e('0x49')]({'where':{'name':_0x249e3f,'userProfileId':_0x3be553[_0x070e('0x4a')]},'raw':!![]})[_0x070e('0x20')](function(_0x5744c5){if(_0x5744c5&&_0x5744c5[_0x070e('0x4b')]===0x0){return db['UserProfileResource'][_0x070e('0x44')]({'name':_0xa7a41b[_0x070e('0x25')],'resourceId':_0xa7a41b['id'],'type':_0x5744c5['name'],'sectionId':_0x5744c5['id']},{})[_0x070e('0x20')](function(){return _0x210c4d;});}else{return _0x210c4d;}})[_0x070e('0x3f')](function(_0x25466f){logger[_0x070e('0x4c')](_0x070e('0x4d'),_0x25466f);throw _0x25466f;});}return _0x210c4d;})[_0x070e('0x20')](respondWithResult(_0xcd1c61,0xc9))[_0x070e('0x3f')](handleError(_0xcd1c61,null));};exports['update']=function(_0x296978,_0x5bacbd){if(_0x296978['body']['id']){delete _0x296978[_0x070e('0x45')]['id'];}return db[_0x070e('0x3b')][_0x070e('0x49')]({'where':{'id':_0x296978[_0x070e('0x4e')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x5bacbd,null))[_0x070e('0x20')](saveUpdates(_0x296978[_0x070e('0x45')],null))[_0x070e('0x20')](respondWithResult(_0x5bacbd,null))['catch'](handleError(_0x5bacbd,null));};exports[_0x070e('0x1f')]=function(_0x51d27d,_0x564d82){return db[_0x070e('0x3b')][_0x070e('0x49')]({'where':{'id':_0x51d27d['params']['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x564d82,null))[_0x070e('0x20')](removeEntity(_0x564d82,null))[_0x070e('0x3f')](handleError(_0x564d82,null));};exports[_0x070e('0x4f')]=function(_0x1aacfc,_0x382ce3,_0x1b36cd){if(_0x1aacfc['body']['id']){delete _0x1aacfc['body']['id'];}return db['Interval'][_0x070e('0x49')]({'where':{'id':_0x1aacfc[_0x070e('0x4e')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x382ce3,null))[_0x070e('0x20')](function(_0x5ac0b5){if(_0x5ac0b5){_0x1aacfc[_0x070e('0x45')]['IntervalId']=_0x5ac0b5['id'];return db[_0x070e('0x3b')][_0x070e('0x44')](_0x1aacfc[_0x070e('0x45')]);}})[_0x070e('0x20')](respondWithResult(_0x382ce3,null))[_0x070e('0x3f')](handleError(_0x382ce3,null));};exports[_0x070e('0x50')]=function(_0x5561ed,_0x20ff87,_0x18e8d0){var _0x8aaf00={};var _0x533431={};var _0x1d7873;var _0x1da803;return db['Interval'][_0x070e('0x51')]({'where':{'id':_0x5561ed['params']['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x20ff87,null))['then'](function(_0x4cb86f){if(_0x4cb86f){_0x1d7873=_0x4cb86f;_0x533431['model']=_[_0x070e('0x41')](db[_0x070e('0x3b')][_0x070e('0x28')]);_0x533431[_0x070e('0x2e')]=_[_0x070e('0x41')](_0x5561ed[_0x070e('0x2e')]);_0x533431['filters']=_[_0x070e('0x2d')](_0x533431['model'],_0x533431[_0x070e('0x2e')]);_0x8aaf00['attributes']=_[_0x070e('0x2d')](_0x533431[_0x070e('0x2b')],qs['fields'](_0x5561ed[_0x070e('0x2e')]['fields']));_0x8aaf00[_0x070e('0x2f')]=_0x8aaf00[_0x070e('0x2f')][_0x070e('0x31')]?_0x8aaf00[_0x070e('0x2f')]:_0x533431[_0x070e('0x2b')];_0x8aaf00[_0x070e('0x52')]=qs[_0x070e('0x32')](_0x5561ed[_0x070e('0x2e')][_0x070e('0x32')]);_0x8aaf00[_0x070e('0x37')]=qs[_0x070e('0x34')](_[_0x070e('0x33')](_0x5561ed[_0x070e('0x2e')],_0x533431[_0x070e('0x34')]));if(_0x5561ed['query'][_0x070e('0x35')]){_0x8aaf00[_0x070e('0x37')]=_[_0x070e('0x36')](_0x8aaf00[_0x070e('0x37')],{'$or':_['map'](_0x8aaf00[_0x070e('0x2f')],function(_0x4e8e58){var _0x398f54={};_0x398f54[_0x4e8e58]={'$like':'%'+_0x5561ed[_0x070e('0x2e')][_0x070e('0x35')]+'%'};return _0x398f54;})});}_0x8aaf00=_[_0x070e('0x36')]({},_0x8aaf00,_0x5561ed['options']);return _0x1d7873[_0x070e('0x50')](_0x8aaf00);}})[_0x070e('0x20')](function(_0x240ec9){if(_0x240ec9){_0x1da803=_0x240ec9[_0x070e('0x31')];if(!_0x5561ed['query'][_0x070e('0x53')]('nolimit')){_0x8aaf00[_0x070e('0x1b')]=qs[_0x070e('0x1b')](_0x5561ed[_0x070e('0x2e')][_0x070e('0x1b')]);_0x8aaf00[_0x070e('0x1a')]=qs['offset'](_0x5561ed[_0x070e('0x2e')][_0x070e('0x1a')]);}return _0x1d7873[_0x070e('0x50')](_0x8aaf00);}})[_0x070e('0x20')](function(_0x5591dd){if(_0x5591dd){return _0x5591dd?{'count':_0x1da803,'rows':_0x5591dd}:null;}})[_0x070e('0x20')](respondWithResult(_0x20ff87,null))['catch'](handleError(_0x20ff87,null));};exports[_0x070e('0x54')]=function(_0x44e465,_0x1214d2,_0x57585e){return db[_0x070e('0x3b')]['findOne']({'where':{'id':_0x44e465[_0x070e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1214d2,null))[_0x070e('0x20')](function(_0x17b28c){if(_0x17b28c){return db['sequelize'][_0x070e('0x55')](function(_0x53f9a8){return db[_0x070e('0x3b')][_0x070e('0x1f')]({'where':{'IntervalId':_0x44e465['params']['id']},'transaction':_0x53f9a8})['then'](function(_0x29ee66){var _0x3022cd=_[_0x070e('0x2c')](_0x44e465[_0x070e('0x45')],function(_0x25f1d0){delete _0x25f1d0['id'];_0x25f1d0[_0x070e('0x56')]=_0x44e465[_0x070e('0x4e')]['id'];return _0x25f1d0;});return db[_0x070e('0x3b')][_0x070e('0x57')](_0x3022cd,{'transaction':_0x53f9a8});});})[_0x070e('0x20')](function(){return db[_0x070e('0x3b')][_0x070e('0x3d')]({'where':{'IntervalId':_0x44e465[_0x070e('0x4e')]['id']}});});}})['then'](respondWithResult(_0x1214d2,null))[_0x070e('0x3f')](handleError(_0x1214d2,null));}; \ No newline at end of file +var _0xedd9=['sequelize','IntervalId','bulkCreate','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','../../components/extensions/rewrite','sendStatus','status','json','offset','limit','set','save','update','then','get','Intervals','destroy','end','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','userProfileId','UserProfileResource','error','getIntervals','addIntervals'];(function(_0x141590,_0x55c281){var _0xb8a437=function(_0x17fed6){while(--_0x17fed6){_0x141590['push'](_0x141590['shift']());}};_0xb8a437(++_0x55c281);}(_0xedd9,0xfc));var _0x9edd=function(_0x1792f5,_0x2da822){_0x1792f5=_0x1792f5-0x0;var _0x3266a7=_0xedd9[_0x1792f5];return _0x3266a7;};'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 extensions=require(_0x9edd('0x17'));function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=_0x75a4ab['count'],_0x5f5bf4=_0x1042aa[_0x9edd('0x1b')],_0x448996=_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1c')],_0x449cee;if(_0x448996>=_0x4ea60f){_0x448996=_0x4ea60f;_0x449cee=0xc8;}else{_0x449cee=0xce;}_0x338f3c['status'](_0x449cee);return _0x338f3c[_0x9edd('0x1d')]('Content-Range',_0x5f5bf4+'-'+_0x448996+'/'+_0x4ea60f)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x1083e4){return function(_0x4bdb88){try{jsonpatch['apply'](_0x4bdb88,_0x1083e4,!![]);}catch(_0x45c3ab){return BPromise['reject'](_0x45c3ab);}return _0x4bdb88[_0x9edd('0x1e')]();};}function saveUpdates(_0x54a03f,_0x535f37){return function(_0x356751){if(_0x356751){return _0x356751[_0x9edd('0x1f')](_0x54a03f)['then'](function(_0x5823bc){return _0x5823bc;});}return null;};}function removeEntity(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['destroy']()[_0x9edd('0x20')](function(){var _0x1dca43=_0x477878[_0x9edd('0x21')]({'plain':!![]});var _0x2ca65f=_0x9edd('0x22');return db['UserProfileResource'][_0x9edd('0x23')]({'where':{'type':_0x2ca65f,'resourceId':_0x1dca43['id']}})[_0x9edd('0x20')](function(){return _0x477878;});})[_0x9edd('0x20')](function(){_0x341d67[_0x9edd('0x19')](0xcc)[_0x9edd('0x24')]();});}};}function handleEntityNotFound(_0x4d507f,_0x4b3d1b){return function(_0x3276ee){if(!_0x3276ee){_0x4d507f[_0x9edd('0x18')](0x194);}return _0x3276ee;};}function handleError(_0x8d67aa,_0x25e135){_0x25e135=_0x25e135||0x1f4;return function(_0x3c2227){logger['error'](_0x3c2227['stack']);if(_0x3c2227[_0x9edd('0x25')]){delete _0x3c2227[_0x9edd('0x25')];}_0x8d67aa[_0x9edd('0x19')](_0x25e135)['send'](_0x3c2227);};}exports[_0x9edd('0x26')]=function(_0x28cfae,_0x2ae8dd){var _0x41af53={},_0x5eccfb={},_0x2155a1={'count':0x0,'rows':[]};var _0x3fb556=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x42e664){return{'name':_0x42e664[_0x9edd('0x2a')],'type':_0x42e664[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x5eccfb[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x3fb556,_0x9edd('0x25'));_0x5eccfb[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0x28cfae[_0x9edd('0x2e')]);_0x5eccfb['filters']=_[_0x9edd('0x30')](_0x5eccfb[_0x9edd('0x2d')],_0x5eccfb[_0x9edd('0x2e')]);_0x41af53['attributes']=_[_0x9edd('0x30')](_0x5eccfb[_0x9edd('0x2d')],qs[_0x9edd('0x31')](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x31')]));_0x41af53[_0x9edd('0x32')]=_0x41af53[_0x9edd('0x32')][_0x9edd('0x33')]?_0x41af53[_0x9edd('0x32')]:_0x5eccfb[_0x9edd('0x2d')];if(!_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x34')](_0x9edd('0x35'))){_0x41af53[_0x9edd('0x1c')]=qs['limit'](_0x28cfae[_0x9edd('0x2e')]['limit']);_0x41af53[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x1b')]);}_0x41af53[_0x9edd('0x36')]=qs['sort'](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x37')]);_0x41af53[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_[_0x9edd('0x3a')](_0x28cfae[_0x9edd('0x2e')],_0x5eccfb[_0x9edd('0x39')]));if(_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x3b')]){_0x41af53[_0x9edd('0x38')]=_['merge'](_0x41af53[_0x9edd('0x38')],{'$or':_['map'](_0x3fb556,function(_0x3ef1d5){if(_0x3ef1d5['type']!==_0x9edd('0x3c')){var _0x2858b5={};_0x2858b5[_0x3ef1d5[_0x9edd('0x25')]]={'$like':'%'+_0x28cfae['query'][_0x9edd('0x3b')]+'%'};return _0x2858b5;}})});}_0x41af53=_[_0x9edd('0x3d')]({},_0x41af53,_0x28cfae[_0x9edd('0x3e')]);var _0x48958a={'where':_0x41af53[_0x9edd('0x38')]};return db['Interval'][_0x9edd('0x3f')](_0x48958a)[_0x9edd('0x20')](function(_0x50be2c){_0x2155a1[_0x9edd('0x3f')]=_0x50be2c;if(_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x40')]){_0x41af53[_0x9edd('0x41')]=[{'all':!![]}];}return db['Interval'][_0x9edd('0x42')](_0x41af53);})['then'](function(_0x2bdb3f){_0x2155a1[_0x9edd('0x43')]=_0x2bdb3f;return _0x2155a1;})['then'](respondWithFilteredResult(_0x2ae8dd,_0x41af53))[_0x9edd('0x44')](handleError(_0x2ae8dd,null));};exports['show']=function(_0x548299,_0x369b69){var _0x9cab86={'raw':!![],'where':{'id':_0x548299[_0x9edd('0x45')]['id']}},_0x1f276b={};_0x1f276b[_0x9edd('0x2d')]=_[_0x9edd('0x2f')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x1f276b[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0x548299[_0x9edd('0x2e')]);_0x1f276b[_0x9edd('0x39')]=_[_0x9edd('0x30')](_0x1f276b[_0x9edd('0x2d')],_0x1f276b[_0x9edd('0x2e')]);_0x9cab86['attributes']=_[_0x9edd('0x30')](_0x1f276b[_0x9edd('0x2d')],qs[_0x9edd('0x31')](_0x548299[_0x9edd('0x2e')][_0x9edd('0x31')]));_0x9cab86[_0x9edd('0x32')]=_0x9cab86[_0x9edd('0x32')]['length']?_0x9cab86['attributes']:_0x1f276b['model'];if(_0x548299[_0x9edd('0x2e')]['includeAll']){_0x9cab86[_0x9edd('0x41')]=[{'all':!![]}];}_0x9cab86=_[_0x9edd('0x3d')]({},_0x9cab86,_0x548299[_0x9edd('0x3e')]);return db[_0x9edd('0x28')][_0x9edd('0x46')](_0x9cab86)['then'](handleEntityNotFound(_0x369b69,null))[_0x9edd('0x20')](respondWithResult(_0x369b69,null))[_0x9edd('0x44')](handleError(_0x369b69,null));};exports[_0x9edd('0x47')]=function(_0x4a89ae,_0x3626bc){return db[_0x9edd('0x28')][_0x9edd('0x47')](_0x4a89ae[_0x9edd('0x48')],{})[_0x9edd('0x20')](function(_0x35bdec){var _0x4d4f33=_0x4a89ae[_0x9edd('0x49')][_0x9edd('0x21')]({'plain':!![]});if(!_0x4d4f33)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d4f33[_0x9edd('0x4a')]===_0x9edd('0x49')){var _0x4bb324=_0x35bdec[_0x9edd('0x21')]({'plain':!![]});var _0x8134cd=_0x9edd('0x22');return db['UserProfileSection'][_0x9edd('0x46')]({'where':{'name':_0x8134cd,'userProfileId':_0x4d4f33[_0x9edd('0x4b')]},'raw':!![]})[_0x9edd('0x20')](function(_0x28c7bd){if(_0x28c7bd&&_0x28c7bd['autoAssociation']===0x0){return db[_0x9edd('0x4c')][_0x9edd('0x47')]({'name':_0x4bb324[_0x9edd('0x25')],'resourceId':_0x4bb324['id'],'type':_0x28c7bd['name'],'sectionId':_0x28c7bd['id']},{})[_0x9edd('0x20')](function(){return _0x35bdec;});}else{return _0x35bdec;}})[_0x9edd('0x44')](function(_0x57db43){logger[_0x9edd('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57db43);throw _0x57db43;});}return _0x35bdec;})[_0x9edd('0x20')](respondWithResult(_0x3626bc,0xc9))[_0x9edd('0x44')](handleError(_0x3626bc,null));};exports[_0x9edd('0x1f')]=function(_0x3fcdf5,_0x1e3c19){if(_0x3fcdf5[_0x9edd('0x48')]['id']){delete _0x3fcdf5[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x28')][_0x9edd('0x46')]({'where':{'id':_0x3fcdf5[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x1e3c19,null))['then'](saveUpdates(_0x3fcdf5[_0x9edd('0x48')],null))[_0x9edd('0x20')](respondWithResult(_0x1e3c19,null))[_0x9edd('0x44')](handleError(_0x1e3c19,null));};exports['destroy']=function(_0xe96d6a,_0x54a704){return db['Interval']['find']({'where':{'id':_0xe96d6a[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x54a704,null))[_0x9edd('0x20')](removeEntity(_0x54a704,null))[_0x9edd('0x44')](handleError(_0x54a704,null));};exports['addInterval']=function(_0x56b38b,_0x4e3c3e,_0x71820f){if(_0x56b38b[_0x9edd('0x48')]['id']){delete _0x56b38b[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x28')][_0x9edd('0x46')]({'where':{'id':_0x56b38b[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x4e3c3e,null))[_0x9edd('0x20')](function(_0x4eb780){if(_0x4eb780){_0x56b38b[_0x9edd('0x48')]['IntervalId']=_0x4eb780['id'];return db[_0x9edd('0x28')][_0x9edd('0x47')](_0x56b38b['body']);}})[_0x9edd('0x20')](respondWithResult(_0x4e3c3e,null))[_0x9edd('0x44')](handleError(_0x4e3c3e,null));};exports[_0x9edd('0x4e')]=function(_0x5ec9af,_0xc648c4,_0x2e1ce3){var _0x430eb4={};var _0x15ebfa={};var _0x1720b1;var _0x2c3173;return db['Interval']['findOne']({'where':{'id':_0x5ec9af[_0x9edd('0x45')]['id']}})['then'](handleEntityNotFound(_0xc648c4,null))[_0x9edd('0x20')](function(_0x3e9a3e){if(_0x3e9a3e){_0x1720b1=_0x3e9a3e;_0x15ebfa[_0x9edd('0x2d')]=_[_0x9edd('0x2f')](db['Interval'][_0x9edd('0x29')]);_0x15ebfa['query']=_[_0x9edd('0x2f')](_0x5ec9af[_0x9edd('0x2e')]);_0x15ebfa[_0x9edd('0x39')]=_['intersection'](_0x15ebfa[_0x9edd('0x2d')],_0x15ebfa['query']);_0x430eb4[_0x9edd('0x32')]=_[_0x9edd('0x30')](_0x15ebfa['model'],qs[_0x9edd('0x31')](_0x5ec9af['query'][_0x9edd('0x31')]));_0x430eb4[_0x9edd('0x32')]=_0x430eb4[_0x9edd('0x32')]['length']?_0x430eb4[_0x9edd('0x32')]:_0x15ebfa[_0x9edd('0x2d')];_0x430eb4[_0x9edd('0x36')]=qs[_0x9edd('0x37')](_0x5ec9af[_0x9edd('0x2e')]['sort']);_0x430eb4['where']=qs[_0x9edd('0x39')](_[_0x9edd('0x3a')](_0x5ec9af['query'],_0x15ebfa['filters']));if(_0x5ec9af['query'][_0x9edd('0x3b')]){_0x430eb4['where']=_['merge'](_0x430eb4[_0x9edd('0x38')],{'$or':_[_0x9edd('0x27')](_0x430eb4['attributes'],function(_0xb9ebeb){var _0x11e082={};_0x11e082[_0xb9ebeb]={'$like':'%'+_0x5ec9af[_0x9edd('0x2e')]['filter']+'%'};return _0x11e082;})});}_0x430eb4=_[_0x9edd('0x3d')]({},_0x430eb4,_0x5ec9af['options']);return _0x1720b1[_0x9edd('0x4e')](_0x430eb4);}})[_0x9edd('0x20')](function(_0x4c8d06){if(_0x4c8d06){_0x2c3173=_0x4c8d06[_0x9edd('0x33')];if(!_0x5ec9af[_0x9edd('0x2e')]['hasOwnProperty'](_0x9edd('0x35'))){_0x430eb4[_0x9edd('0x1c')]=qs[_0x9edd('0x1c')](_0x5ec9af[_0x9edd('0x2e')]['limit']);_0x430eb4[_0x9edd('0x1b')]=qs['offset'](_0x5ec9af[_0x9edd('0x2e')][_0x9edd('0x1b')]);}return _0x1720b1[_0x9edd('0x4e')](_0x430eb4);}})['then'](function(_0x106a67){if(_0x106a67){return _0x106a67?{'count':_0x2c3173,'rows':_0x106a67}:null;}})[_0x9edd('0x20')](respondWithResult(_0xc648c4,null))[_0x9edd('0x44')](handleError(_0xc648c4,null));};exports[_0x9edd('0x4f')]=function(_0x25626a,_0x14e2e5,_0x3fa4a9){return db['Interval']['findOne']({'where':{'id':_0x25626a[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x14e2e5,null))[_0x9edd('0x20')](function(_0x171403){if(_0x171403){return db[_0x9edd('0x50')]['transaction'](function(_0x2e40c8){return db[_0x9edd('0x28')][_0x9edd('0x23')]({'where':{'IntervalId':_0x25626a['params']['id']},'transaction':_0x2e40c8})[_0x9edd('0x20')](function(_0x29d70d){var _0x4b1c12=_[_0x9edd('0x27')](_0x25626a[_0x9edd('0x48')],function(_0x58c839){delete _0x58c839['id'];_0x58c839[_0x9edd('0x51')]=_0x25626a[_0x9edd('0x45')]['id'];return _0x58c839;});return db['Interval'][_0x9edd('0x52')](_0x4b1c12,{'transaction':_0x2e40c8});});})['then'](function(){return db['Interval'][_0x9edd('0x42')]({'where':{'IntervalId':_0x25626a[_0x9edd('0x45')]['id']}});});}})[_0x9edd('0x20')](respondWithResult(_0x14e2e5,null))['catch'](handleError(_0x14e2e5,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 981823c..2e3a9a0 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 _0x9809=['request-promise','path','rimraf','../../config/environment','./interval.attributes','exports','define','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5399bf,_0x3c697d){var _0x35f624=function(_0x431794){while(--_0x431794){_0x5399bf['push'](_0x5399bf['shift']());}};_0x35f624(++_0x3c697d);}(_0x9809,0x1da));var _0x9980=function(_0x103e46,_0x3377e9){_0x103e46=_0x103e46-0x0;var _0x3ed429=_0x9809[_0x103e46];return _0x3ed429;};'use strict';var _=require(_0x9980('0x0'));var util=require(_0x9980('0x1'));var logger=require(_0x9980('0x2'))(_0x9980('0x3'));var moment=require(_0x9980('0x4'));var BPromise=require(_0x9980('0x5'));var rp=require(_0x9980('0x6'));var fs=require('fs');var path=require(_0x9980('0x7'));var rimraf=require(_0x9980('0x8'));var config=require(_0x9980('0x9'));var attributes=require(_0x9980('0xa'));var extensions=require('../../components/extensions/rewrite');module[_0x9980('0xb')]=function(_0x477af4,_0x55914b){return _0x477af4[_0x9980('0xc')]('Interval',attributes,{'tableName':_0x9980('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x333a73,_0x4d545d){extensions[_0x9980('0xe')](_0x477af4,_0x333a73);},'afterBulkCreate':function(_0x2553c0,_0x2d893b,_0x29ec92){_0x29ec92();extensions[_0x9980('0xe')](_0x477af4,_0x2553c0[0x0]);},'afterUpdate':function(_0x3b118c,_0x119f9c){extensions[_0x9980('0xe')](_0x477af4,_0x3b118c);},'afterDestroy':function(_0x2f9459,_0x2d933b){extensions[_0x9980('0xe')](_0x477af4,_0x2f9459);}}});}; \ No newline at end of file +var _0xd228=['define','tools_intervals','rewrite','lodash','util','../../config/logger','api','bluebird','rimraf','./interval.attributes','exports'];(function(_0x57a5e5,_0x18b0d6){var _0x354012=function(_0x34d87b){while(--_0x34d87b){_0x57a5e5['push'](_0x57a5e5['shift']());}};_0x354012(++_0x18b0d6);}(_0xd228,0x1bb));var _0x8d22=function(_0x5c0dcb,_0x16cd83){_0x5c0dcb=_0x5c0dcb-0x0;var _0x183a0e=_0xd228[_0x5c0dcb];return _0x183a0e;};'use strict';var _=require(_0x8d22('0x0'));var util=require(_0x8d22('0x1'));var logger=require(_0x8d22('0x2'))(_0x8d22('0x3'));var moment=require('moment');var BPromise=require(_0x8d22('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8d22('0x5'));var config=require('../../config/environment');var attributes=require(_0x8d22('0x6'));var extensions=require('../../components/extensions/rewrite');module[_0x8d22('0x7')]=function(_0x7978f,_0x3ecce2){return _0x7978f[_0x8d22('0x8')]('Interval',attributes,{'tableName':_0x8d22('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x393941,_0xcf67b3){extensions[_0x8d22('0xa')](_0x7978f,_0x393941);},'afterBulkCreate':function(_0x2ea077,_0x2fb32a,_0x47767d){_0x47767d();extensions[_0x8d22('0xa')](_0x7978f,_0x2ea077[0x0]);},'afterUpdate':function(_0x2cf38e,_0x3b7d3a){extensions[_0x8d22('0xa')](_0x7978f,_0x2cf38e);},'afterDestroy':function(_0x9d233b,_0xf6ab5){extensions[_0x8d22('0xa')](_0x7978f,_0x9d233b);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index acca11b..779aabc 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 _0xa1a6=['Interval,\x20%s,\x20%s','catch','GetInterval','Interval','findAll','options','raw','where','attributes','limit','map','include','then','stringify','ShowInterval','find','model','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','error','code','message'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0xa1a6,0x165));var _0x6a1a=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0xa1a6[_0x178f52];return _0x556f99;};'use strict';var _=require(_0x6a1a('0x0'));var util=require(_0x6a1a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6a1a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a1a('0x3'))['db'];var utils=require(_0x6a1a('0x4'));var logger=require(_0x6a1a('0x5'))(_0x6a1a('0x6'));var config=require(_0x6a1a('0x7'));var jayson=require(_0x6a1a('0x8'));var client=jayson[_0x6a1a('0x9')][_0x6a1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d73fa,_0x30db00,_0x267014){return new BPromise(function(_0x55bfdd,_0x11c478){return client[_0x6a1a('0xb')](_0x4d73fa,_0x267014)['then'](function(_0x170ad1){logger[_0x6a1a('0xc')]('Interval,\x20%s,\x20%s',_0x30db00,_0x6a1a('0xd'));logger['debug']('Interval,\x20%s,\x20%s,\x20%s',_0x30db00,'request\x20sent',JSON['stringify'](_0x170ad1));if(_0x170ad1['error']){if(_0x170ad1[_0x6a1a('0xe')][_0x6a1a('0xf')]===0x1f4){logger[_0x6a1a('0xe')]('Interval,\x20%s,\x20%s',_0x30db00,_0x170ad1[_0x6a1a('0xe')][_0x6a1a('0x10')]);return _0x11c478(_0x170ad1[_0x6a1a('0xe')][_0x6a1a('0x10')]);}logger[_0x6a1a('0xe')](_0x6a1a('0x11'),_0x30db00,_0x170ad1['error'][_0x6a1a('0x10')]);return _0x55bfdd(_0x170ad1[_0x6a1a('0xe')]['message']);}else{logger[_0x6a1a('0xc')](_0x6a1a('0x11'),_0x30db00,_0x6a1a('0xd'));_0x55bfdd(_0x170ad1['result']['message']);}})[_0x6a1a('0x12')](function(_0x1fdba7){logger[_0x6a1a('0xe')]('Interval,\x20%s,\x20%s',_0x30db00,_0x1fdba7);_0x11c478(_0x1fdba7);});});}exports[_0x6a1a('0x13')]=function(_0x4e387a){var _0x207c4a=this;return new Promise(function(_0x48e86d,_0x16c7e6){return db[_0x6a1a('0x14')][_0x6a1a('0x15')]({'raw':_0x4e387a[_0x6a1a('0x16')]?_0x4e387a[_0x6a1a('0x16')][_0x6a1a('0x17')]===undefined?!![]:![]:!![],'where':_0x4e387a[_0x6a1a('0x16')]?_0x4e387a[_0x6a1a('0x16')][_0x6a1a('0x18')]||null:null,'attributes':_0x4e387a[_0x6a1a('0x16')]?_0x4e387a['options'][_0x6a1a('0x19')]||null:null,'limit':_0x4e387a[_0x6a1a('0x16')]?_0x4e387a['options'][_0x6a1a('0x1a')]||null:null,'include':_0x4e387a[_0x6a1a('0x16')]?_0x4e387a[_0x6a1a('0x16')]['include']?_[_0x6a1a('0x1b')](_0x4e387a['options'][_0x6a1a('0x1c')],function(_0x13cf65){return{'model':db[_0x13cf65['model']],'as':_0x13cf65['as'],'attributes':_0x13cf65[_0x6a1a('0x19')],'include':_0x13cf65[_0x6a1a('0x1c')]?_[_0x6a1a('0x1b')](_0x13cf65[_0x6a1a('0x1c')],function(_0x4318c3){return{'model':db[_0x4318c3['model']],'as':_0x4318c3['as'],'attributes':_0x4318c3['attributes'],'include':_0x4318c3[_0x6a1a('0x1c')]?_[_0x6a1a('0x1b')](_0x4318c3[_0x6a1a('0x1c')],function(_0x2b1068){return{'model':db[_0x2b1068['model']],'as':_0x2b1068['as'],'attributes':_0x2b1068[_0x6a1a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6a1a('0x1d')](function(_0x2edb4c){logger[_0x6a1a('0xc')]('GetInterval',_0x4e387a);logger['debug'](_0x6a1a('0x13'),_0x4e387a,JSON[_0x6a1a('0x1e')](_0x2edb4c));_0x48e86d(_0x2edb4c);})[_0x6a1a('0x12')](function(_0x46c7c6){logger[_0x6a1a('0xe')](_0x6a1a('0x13'),_0x46c7c6['message'],_0x4e387a);_0x16c7e6(_0x207c4a[_0x6a1a('0xe')](0x1f4,_0x46c7c6['message']));});});};exports[_0x6a1a('0x1f')]=function(_0x3a745f){var _0x5248ee=this;return new Promise(function(_0x59a3e4,_0x3f340b){return db[_0x6a1a('0x14')][_0x6a1a('0x20')]({'raw':_0x3a745f[_0x6a1a('0x16')]?_0x3a745f[_0x6a1a('0x16')][_0x6a1a('0x17')]===undefined?!![]:![]:!![],'where':_0x3a745f['options']?_0x3a745f['options'][_0x6a1a('0x18')]||null:null,'attributes':_0x3a745f['options']?_0x3a745f[_0x6a1a('0x16')][_0x6a1a('0x19')]||null:null,'include':_0x3a745f['options']?_0x3a745f['options'][_0x6a1a('0x1c')]?_[_0x6a1a('0x1b')](_0x3a745f['options'][_0x6a1a('0x1c')],function(_0x272c07){return{'model':db[_0x272c07[_0x6a1a('0x21')]],'as':_0x272c07['as'],'attributes':_0x272c07[_0x6a1a('0x19')],'include':_0x272c07[_0x6a1a('0x1c')]?_['map'](_0x272c07[_0x6a1a('0x1c')],function(_0x2e8927){return{'model':db[_0x2e8927[_0x6a1a('0x21')]],'as':_0x2e8927['as'],'attributes':_0x2e8927[_0x6a1a('0x19')],'include':_0x2e8927['include']?_[_0x6a1a('0x1b')](_0x2e8927['include'],function(_0xa1a7be){return{'model':db[_0xa1a7be[_0x6a1a('0x21')]],'as':_0xa1a7be['as'],'attributes':_0xa1a7be[_0x6a1a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6a1a('0x1d')](function(_0x278351){logger[_0x6a1a('0xc')](_0x6a1a('0x1f'),_0x3a745f);logger['debug'](_0x6a1a('0x1f'),_0x3a745f,JSON[_0x6a1a('0x1e')](_0x278351));_0x59a3e4(_0x278351);})['catch'](function(_0x3b2c1c){logger[_0x6a1a('0xe')](_0x6a1a('0x1f'),_0x3b2c1c[_0x6a1a('0x10')],_0x3a745f);_0x3f340b(_0x5248ee[_0x6a1a('0xe')](0x1f4,_0x3b2c1c[_0x6a1a('0x10')]));});});}; \ No newline at end of file +var _0x648a=['include','model','map','then','debug','ShowInterval','find','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options','raw','where','attributes','limit'];(function(_0x3a81f9,_0xa6a0e6){var _0x220e23=function(_0x22f720){while(--_0x22f720){_0x3a81f9['push'](_0x3a81f9['shift']());}};_0x220e23(++_0xa6a0e6);}(_0x648a,0xc0));var _0xa648=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x648a[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0xa648('0x0'));var util=require(_0xa648('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa648('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa648('0x3'))['db'];var utils=require(_0xa648('0x4'));var logger=require(_0xa648('0x5'))(_0xa648('0x6'));var config=require(_0xa648('0x7'));var jayson=require(_0xa648('0x8'));var client=jayson[_0xa648('0x9')][_0xa648('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46ca43,_0x2fe411,_0xcf694b){return new BPromise(function(_0x4c3e9f,_0x2e214c){return client[_0xa648('0xb')](_0x46ca43,_0xcf694b)['then'](function(_0x353714){logger[_0xa648('0xc')](_0xa648('0xd'),_0x2fe411,_0xa648('0xe'));logger['debug'](_0xa648('0xf'),_0x2fe411,'request\x20sent',JSON[_0xa648('0x10')](_0x353714));if(_0x353714[_0xa648('0x11')]){if(_0x353714[_0xa648('0x11')][_0xa648('0x12')]===0x1f4){logger[_0xa648('0x11')](_0xa648('0xd'),_0x2fe411,_0x353714[_0xa648('0x11')][_0xa648('0x13')]);return _0x2e214c(_0x353714[_0xa648('0x11')][_0xa648('0x13')]);}logger[_0xa648('0x11')](_0xa648('0xd'),_0x2fe411,_0x353714[_0xa648('0x11')][_0xa648('0x13')]);return _0x4c3e9f(_0x353714[_0xa648('0x11')]['message']);}else{logger[_0xa648('0xc')](_0xa648('0xd'),_0x2fe411,_0xa648('0xe'));_0x4c3e9f(_0x353714[_0xa648('0x14')][_0xa648('0x13')]);}})[_0xa648('0x15')](function(_0x395825){logger[_0xa648('0x11')](_0xa648('0xd'),_0x2fe411,_0x395825);_0x2e214c(_0x395825);});});}exports[_0xa648('0x16')]=function(_0x4ae268){var _0x2d523e=this;return new Promise(function(_0x349ec1,_0x38fa50){return db[_0xa648('0x17')][_0xa648('0x18')]({'raw':_0x4ae268[_0xa648('0x19')]?_0x4ae268[_0xa648('0x19')][_0xa648('0x1a')]===undefined?!![]:![]:!![],'where':_0x4ae268['options']?_0x4ae268['options'][_0xa648('0x1b')]||null:null,'attributes':_0x4ae268[_0xa648('0x19')]?_0x4ae268[_0xa648('0x19')][_0xa648('0x1c')]||null:null,'limit':_0x4ae268[_0xa648('0x19')]?_0x4ae268[_0xa648('0x19')][_0xa648('0x1d')]||null:null,'include':_0x4ae268[_0xa648('0x19')]?_0x4ae268[_0xa648('0x19')]['include']?_['map'](_0x4ae268[_0xa648('0x19')][_0xa648('0x1e')],function(_0x2889cf){return{'model':db[_0x2889cf[_0xa648('0x1f')]],'as':_0x2889cf['as'],'attributes':_0x2889cf[_0xa648('0x1c')],'include':_0x2889cf[_0xa648('0x1e')]?_[_0xa648('0x20')](_0x2889cf['include'],function(_0x27776b){return{'model':db[_0x27776b['model']],'as':_0x27776b['as'],'attributes':_0x27776b[_0xa648('0x1c')],'include':_0x27776b['include']?_[_0xa648('0x20')](_0x27776b[_0xa648('0x1e')],function(_0x549d97){return{'model':db[_0x549d97['model']],'as':_0x549d97['as'],'attributes':_0x549d97['attributes']};}):[]};}):[]};}):[]:[]})[_0xa648('0x21')](function(_0x2d2e8c){logger[_0xa648('0xc')](_0xa648('0x16'),_0x4ae268);logger[_0xa648('0x22')]('GetInterval',_0x4ae268,JSON[_0xa648('0x10')](_0x2d2e8c));_0x349ec1(_0x2d2e8c);})[_0xa648('0x15')](function(_0x47bb9c){logger[_0xa648('0x11')](_0xa648('0x16'),_0x47bb9c[_0xa648('0x13')],_0x4ae268);_0x38fa50(_0x2d523e[_0xa648('0x11')](0x1f4,_0x47bb9c['message']));});});};exports[_0xa648('0x23')]=function(_0x2b9a62){var _0x10b210=this;return new Promise(function(_0x15debf,_0x1276c5){return db[_0xa648('0x17')][_0xa648('0x24')]({'raw':_0x2b9a62[_0xa648('0x19')]?_0x2b9a62[_0xa648('0x19')][_0xa648('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b9a62[_0xa648('0x19')]?_0x2b9a62[_0xa648('0x19')][_0xa648('0x1b')]||null:null,'attributes':_0x2b9a62['options']?_0x2b9a62[_0xa648('0x19')][_0xa648('0x1c')]||null:null,'include':_0x2b9a62[_0xa648('0x19')]?_0x2b9a62[_0xa648('0x19')]['include']?_[_0xa648('0x20')](_0x2b9a62[_0xa648('0x19')][_0xa648('0x1e')],function(_0x31d2a1){return{'model':db[_0x31d2a1[_0xa648('0x1f')]],'as':_0x31d2a1['as'],'attributes':_0x31d2a1[_0xa648('0x1c')],'include':_0x31d2a1[_0xa648('0x1e')]?_[_0xa648('0x20')](_0x31d2a1[_0xa648('0x1e')],function(_0x35ddaf){return{'model':db[_0x35ddaf['model']],'as':_0x35ddaf['as'],'attributes':_0x35ddaf[_0xa648('0x1c')],'include':_0x35ddaf[_0xa648('0x1e')]?_['map'](_0x35ddaf[_0xa648('0x1e')],function(_0x55b1ac){return{'model':db[_0x55b1ac[_0xa648('0x1f')]],'as':_0x55b1ac['as'],'attributes':_0x55b1ac['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e896a){logger[_0xa648('0xc')]('ShowInterval',_0x2b9a62);logger['debug'](_0xa648('0x23'),_0x2b9a62,JSON[_0xa648('0x10')](_0x5e896a));_0x15debf(_0x5e896a);})[_0xa648('0x15')](function(_0xf55d4f){logger[_0xa648('0x11')](_0xa648('0x23'),_0xf55d4f[_0xa648('0x13')],_0x2b9a62);_0x1276c5(_0x10b210['error'](0x1f4,_0xf55d4f['message']));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 3597d2d..03099b7 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 _0xa7a7=['./jira.controller','post','isAuthenticated','send','exports','../../components/auth/service'];(function(_0x2bb8df,_0x2e3dff){var _0x11f564=function(_0x1fef02){while(--_0x1fef02){_0x2bb8df['push'](_0x2bb8df['shift']());}};_0x11f564(++_0x2e3dff);}(_0xa7a7,0xad));var _0x7a7a=function(_0x4547d5,_0x91d898){_0x4547d5=_0x4547d5-0x0;var _0x81ad1f=_0xa7a7[_0x4547d5];return _0x81ad1f;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x7a7a('0x0'));var controller=require(_0x7a7a('0x1'));router[_0x7a7a('0x2')]('/',auth[_0x7a7a('0x3')](),controller[_0x7a7a('0x4')]);module[_0x7a7a('0x5')]=router; \ No newline at end of file +var _0x1b63=['post','isAuthenticated','send','exports','Router','../../components/auth/service','./jira.controller'];(function(_0x237f4b,_0x485ba4){var _0x42bcf3=function(_0x3fcc37){while(--_0x3fcc37){_0x237f4b['push'](_0x237f4b['shift']());}};_0x42bcf3(++_0x485ba4);}(_0x1b63,0x90));var _0x31b6=function(_0x284a61,_0x231686){_0x284a61=_0x284a61-0x0;var _0x220e3c=_0x1b63[_0x284a61];return _0x220e3c;};'use strict';var express=require('express');var router=express[_0x31b6('0x0')]();var auth=require(_0x31b6('0x1'));var controller=require(_0x31b6('0x2'));router[_0x31b6('0x3')]('/',auth[_0x31b6('0x4')](),controller[_0x31b6('0x5')]);module[_0x31b6('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 cd2a72b..367b108 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 _0xcd67=['utf8','end','status','statusCode','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','Bug','customfield_11500','email','fields','customfield_11501','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','request','setEncoding'];(function(_0x3ee9b2,_0xa090bb){var _0x51ac3e=function(_0x8ba28d){while(--_0x8ba28d){_0x3ee9b2['push'](_0x3ee9b2['shift']());}};_0x51ac3e(++_0xa090bb);}(_0xcd67,0x11e));var _0x7cd6=function(_0x2f2bd8,_0x1638b5){_0x2f2bd8=_0x2f2bd8-0x0;var _0x30388a=_0xcd67[_0x2f2bd8];return _0x30388a;};'use strict';var BPromise=require(_0x7cd6('0x0'));var https=require(_0x7cd6('0x1'));var logger=require(_0x7cd6('0x2'))(_0x7cd6('0x3'));var USERNAME=_0x7cd6('0x4');var PASSWORD=_0x7cd6('0x5');function openIssue(_0x14c27c,_0x14a14d){var _0x59d874={'fields':{'project':{'key':_0x14c27c['key']||_0x7cd6('0x6')},'summary':(_0x14c27c[_0x7cd6('0x7')]||'Report')+_0x7cd6('0x8')+_0x14c27c['ip'],'description':_0x14c27c[_0x7cd6('0x9')]||JSON[_0x7cd6('0xa')](_0x14c27c),'issuetype':{'name':_0x14c27c['issuetype']||_0x7cd6('0xb')}}};_0x59d874['fields'][_0x7cd6('0xc')]=_0x14c27c[_0x7cd6('0xd')];_0x59d874[_0x7cd6('0xe')][_0x7cd6('0xf')]=_0x14c27c['oldToken'];_0x59d874[_0x7cd6('0xe')]['customfield_11502']=_0x14c27c[_0x7cd6('0x10')];_0x59d874['fields']['customfield_11503']=_0x14c27c[_0x7cd6('0x11')];_0x59d874[_0x7cd6('0xe')][_0x7cd6('0x12')]=_0x14c27c[_0x7cd6('0x13')];_0x59d874['fields'][_0x7cd6('0x14')]=_0x14c27c['ip'];var _0x5c7e94={'host':_0x7cd6('0x15'),'port':0x1bb,'path':_0x7cd6('0x16'),'method':_0x7cd6('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x7cd6('0x18'),'Authorization':_0x7cd6('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x7cd6('0x1a')]('base64')}};var _0x5a4374=JSON[_0x7cd6('0xa')](_0x59d874);var _0x382efc=https[_0x7cd6('0x1b')](_0x5c7e94,function(_0x19dc32){_0x19dc32[_0x7cd6('0x1c')](_0x7cd6('0x1d'));var _0x982912='';_0x19dc32['on']('data',function(_0xc45e97){_0x982912+=_0xc45e97;});_0x19dc32['on'](_0x7cd6('0x1e'),function(){if(_0x14a14d){return _0x14a14d[_0x7cd6('0x1f')](_0x19dc32[_0x7cd6('0x20')])['json'](JSON[_0x7cd6('0x21')](_0x982912));}});});_0x382efc['on'](_0x7cd6('0x22'),function(_0x4778dc){if(_0x14a14d){return _0x14a14d['status'](0x1f4)['json']({'errors':[{'message':_0x7cd6('0x23'),'type':_0x7cd6('0x24')}]});}});_0x382efc[_0x7cd6('0x25')](_0x5a4374);_0x382efc['end']();}exports[_0x7cd6('0x26')]=openIssue;exports[_0x7cd6('0x27')]=function(_0xd3282e,_0x35ce39){_0xd3282e[_0x7cd6('0x28')]['ip']=_0xd3282e['headers'][_0x7cd6('0x29')]||_0xd3282e[_0x7cd6('0x2a')]['remoteAddress']||_0xd3282e['socket']['remoteAddress']||_0xd3282e[_0x7cd6('0x2a')][_0x7cd6('0x2b')][_0x7cd6('0x2c')];return openIssue(_0xd3282e[_0x7cd6('0x28')],_0x35ce39);}; \ No newline at end of file +var _0x5899=['description','issuetype','Bug','fields','customfield_11502','customfield_11503','name','customfield_11504','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','base64','stringify','request','setEncoding','utf8','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20'];(function(_0x2263d6,_0x23ef72){var _0x392795=function(_0x555ceb){while(--_0x555ceb){_0x2263d6['push'](_0x2263d6['shift']());}};_0x392795(++_0x23ef72);}(_0x5899,0x15e));var _0x9589=function(_0x3e7a57,_0x4e8178){_0x3e7a57=_0x3e7a57-0x0;var _0x206acc=_0x5899[_0x3e7a57];return _0x206acc;};'use strict';var BPromise=require(_0x9589('0x0'));var https=require(_0x9589('0x1'));var logger=require(_0x9589('0x2'))(_0x9589('0x3'));var USERNAME=_0x9589('0x4');var PASSWORD=_0x9589('0x5');function openIssue(_0x111e6e,_0x5528e){var _0x23df1e={'fields':{'project':{'key':_0x111e6e[_0x9589('0x6')]||_0x9589('0x7')},'summary':(_0x111e6e['summary']||_0x9589('0x8'))+_0x9589('0x9')+_0x111e6e['ip'],'description':_0x111e6e[_0x9589('0xa')]||JSON['stringify'](_0x111e6e),'issuetype':{'name':_0x111e6e[_0x9589('0xb')]||_0x9589('0xc')}}};_0x23df1e['fields']['customfield_11500']=_0x111e6e['email'];_0x23df1e[_0x9589('0xd')]['customfield_11501']=_0x111e6e['oldToken'];_0x23df1e[_0x9589('0xd')][_0x9589('0xe')]=_0x111e6e['newToken'];_0x23df1e[_0x9589('0xd')][_0x9589('0xf')]=_0x111e6e[_0x9589('0x10')];_0x23df1e[_0x9589('0xd')][_0x9589('0x11')]=_0x111e6e[_0x9589('0x12')];_0x23df1e[_0x9589('0xd')]['customfield_10102']=_0x111e6e['ip'];var _0x2786b5={'host':_0x9589('0x13'),'port':0x1bb,'path':_0x9589('0x14'),'method':_0x9589('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x9589('0x16'),'Authorization':_0x9589('0x17')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x9589('0x18'))}};var _0x269282=JSON[_0x9589('0x19')](_0x23df1e);var _0x2ee9ff=https[_0x9589('0x1a')](_0x2786b5,function(_0xf0b3b1){_0xf0b3b1[_0x9589('0x1b')](_0x9589('0x1c'));var _0x1a943f='';_0xf0b3b1['on'](_0x9589('0x1d'),function(_0x170a0d){_0x1a943f+=_0x170a0d;});_0xf0b3b1['on'](_0x9589('0x1e'),function(){if(_0x5528e){return _0x5528e[_0x9589('0x1f')](_0xf0b3b1[_0x9589('0x20')])[_0x9589('0x21')](JSON['parse'](_0x1a943f));}});});_0x2ee9ff['on'](_0x9589('0x22'),function(_0x75411f){if(_0x5528e){return _0x5528e['status'](0x1f4)[_0x9589('0x21')]({'errors':[{'message':_0x9589('0x23'),'type':_0x9589('0x24')}]});}});_0x2ee9ff[_0x9589('0x25')](_0x269282);_0x2ee9ff[_0x9589('0x1e')]();}exports['openIssue']=openIssue;exports[_0x9589('0x26')]=function(_0x33ab53,_0x3b75c2){_0x33ab53[_0x9589('0x27')]['ip']=_0x33ab53[_0x9589('0x28')][_0x9589('0x29')]||_0x33ab53[_0x9589('0x2a')][_0x9589('0x2b')]||_0x33ab53[_0x9589('0x2c')][_0x9589('0x2b')]||_0x33ab53[_0x9589('0x2a')][_0x9589('0x2c')][_0x9589('0x2b')];return openIssue(_0x33ab53[_0x9589('0x27')],_0x3b75c2);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 3f31c38..09915c6 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 _0x3b31=['put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0x3dc269,_0x48a7d5){var _0x4e9df7=function(_0x541ddf){while(--_0x541ddf){_0x3dc269['push'](_0x3dc269['shift']());}};_0x4e9df7(++_0x48a7d5);}(_0x3b31,0x182));var _0x13b3=function(_0x161835,_0x3788eb){_0x161835=_0x161835-0x0;var _0x199077=_0x3b31[_0x161835];return _0x199077;};'use strict';var multer=require(_0x13b3('0x0'));var util=require('util');var path=require(_0x13b3('0x1'));var timeout=require(_0x13b3('0x2'));var express=require(_0x13b3('0x3'));var router=express['Router']();var auth=require(_0x13b3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x13b3('0x5'));var controller=require(_0x13b3('0x6'));router[_0x13b3('0x7')]('/',auth[_0x13b3('0x8')](),controller[_0x13b3('0x9')]);router[_0x13b3('0x7')](_0x13b3('0xa'),auth['isAuthenticated'](),controller[_0x13b3('0xb')]);router[_0x13b3('0x7')]('/:id',auth[_0x13b3('0x8')](),controller[_0x13b3('0xc')]);router[_0x13b3('0xd')]('/',auth[_0x13b3('0x8')](),controller['create']);router[_0x13b3('0xe')](_0x13b3('0xf'),auth['isAuthenticated'](),controller[_0x13b3('0x10')]);router[_0x13b3('0x11')](_0x13b3('0xf'),auth[_0x13b3('0x8')](),controller[_0x13b3('0x12')]);module[_0x13b3('0x13')]=router; \ No newline at end of file +var _0xa9bf=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','show','create','delete','/:id','destroy','multer','util','path','connect-timeout'];(function(_0x5c1899,_0x36f667){var _0x1bfaf8=function(_0x2a6711){while(--_0x2a6711){_0x5c1899['push'](_0x5c1899['shift']());}};_0x1bfaf8(++_0x36f667);}(_0xa9bf,0x94));var _0xfa9b=function(_0x387987,_0xd3c5a1){_0x387987=_0x387987-0x0;var _0x523042=_0xa9bf[_0x387987];return _0x523042;};'use strict';var multer=require(_0xfa9b('0x0'));var util=require(_0xfa9b('0x1'));var path=require(_0xfa9b('0x2'));var timeout=require(_0xfa9b('0x3'));var express=require('express');var router=express[_0xfa9b('0x4')]();var auth=require(_0xfa9b('0x5'));var interaction=require(_0xfa9b('0x6'));var config=require(_0xfa9b('0x7'));var controller=require(_0xfa9b('0x8'));router[_0xfa9b('0x9')]('/',auth[_0xfa9b('0xa')](),controller[_0xfa9b('0xb')]);router[_0xfa9b('0x9')](_0xfa9b('0xc'),auth['isAuthenticated'](),controller[_0xfa9b('0xd')]);router[_0xfa9b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xfa9b('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfa9b('0xf')]);router['put']('/:id',auth[_0xfa9b('0xa')](),controller['update']);router[_0xfa9b('0x10')](_0xfa9b('0x11'),auth[_0xfa9b('0xa')](),controller[_0xfa9b('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index e789b16..f716728 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 _0x66f5=['long','STRING','sequelize','exports'];(function(_0x287059,_0x499940){var _0x225c79=function(_0x3aa36e){while(--_0x3aa36e){_0x287059['push'](_0x287059['shift']());}};_0x225c79(++_0x499940);}(_0x66f5,0x1f2));var _0x566f=function(_0x165230,_0x10f019){_0x165230=_0x165230-0x0;var _0x3cc4e7=_0x66f5[_0x165230];return _0x3cc4e7;};'use strict';var Sequelize=require(_0x566f('0x0'));module[_0x566f('0x1')]={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize['TEXT'](_0x566f('0x2'))},'membername':{'type':Sequelize[_0x566f('0x3')]},'projectname':{'type':Sequelize[_0x566f('0x3')]},'queue':{'type':Sequelize[_0x566f('0x3')]},'uniqueid':{'type':Sequelize[_0x566f('0x3')]},'calleridname':{'type':Sequelize[_0x566f('0x3')]},'calleridnum':{'type':Sequelize[_0x566f('0x3')]},'questionId':{'type':Sequelize[_0x566f('0x3')]}}; \ No newline at end of file +var _0xa209=['sequelize','exports','STRING','TEXT','long'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa209,0xaf));var _0x9a20=function(_0x564cec,_0x242a2b){_0x564cec=_0x564cec-0x0;var _0x4ef7e6=_0xa209[_0x564cec];return _0x4ef7e6;};'use strict';var Sequelize=require(_0x9a20('0x0'));module[_0x9a20('0x1')]={'question':{'type':Sequelize[_0x9a20('0x2')]},'answer':{'type':Sequelize[_0x9a20('0x3')](_0x9a20('0x4'))},'membername':{'type':Sequelize[_0x9a20('0x2')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9a20('0x2')]},'uniqueid':{'type':Sequelize[_0x9a20('0x2')]},'calleridname':{'type':Sequelize[_0x9a20('0x2')]},'calleridnum':{'type':Sequelize[_0x9a20('0x2')]},'questionId':{'type':Sequelize[_0x9a20('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 2e34eed..4158bf4 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 _0xb838=['nolimit','order','sort','where','filter','type','VIRTUAL','merge','JscriptyAnswerReport','count','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0xe2d14f,_0x49fd0e){var _0x4522d2=function(_0x1bf09a){while(--_0x1bf09a){_0xe2d14f['push'](_0xe2d14f['shift']());}};_0x4522d2(++_0x49fd0e);}(_0xb838,0x14b));var _0x8b83=function(_0x3bd303,_0x4d74e0){_0x3bd303=_0x3bd303-0x0;var _0x4e1b05=_0xb838[_0x3bd303];return _0x4e1b05;};'use strict';var pdf=require(_0x8b83('0x0'));var emlformat=require(_0x8b83('0x1'));var rimraf=require(_0x8b83('0x2'));var zipdir=require(_0x8b83('0x3'));var jsonpatch=require(_0x8b83('0x4'));var rp=require(_0x8b83('0x5'));var moment=require(_0x8b83('0x6'));var BPromise=require(_0x8b83('0x7'));var Mustache=require(_0x8b83('0x8'));var util=require(_0x8b83('0x9'));var path=require(_0x8b83('0xa'));var sox=require(_0x8b83('0xb'));var csv=require(_0x8b83('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8b83('0xd'));var squel=require('squel');var crypto=require(_0x8b83('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8b83('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8b83('0x10'));var Redis=require(_0x8b83('0x11'));var authService=require(_0x8b83('0x12'));var qs=require(_0x8b83('0x13'));var as=require(_0x8b83('0x14'));var hardwareService=require(_0x8b83('0x15'));var logger=require('../../config/logger')(_0x8b83('0x16'));var utils=require(_0x8b83('0x17'));var config=require(_0x8b83('0x18'));var db=require(_0x8b83('0x19'))['db'];function respondWithStatusCode(_0x193663,_0x41faee){_0x41faee=_0x41faee||0xcc;return function(_0x1df688){if(_0x1df688){return _0x193663[_0x8b83('0x1a')](_0x41faee);}return _0x193663[_0x8b83('0x1b')](_0x41faee)[_0x8b83('0x1c')]();};}function respondWithResult(_0x4502d0,_0x238b99){_0x238b99=_0x238b99||0xc8;return function(_0x352a4d){if(_0x352a4d){return _0x4502d0['status'](_0x238b99)[_0x8b83('0x1d')](_0x352a4d);}};}function respondWithFilteredResult(_0x406517,_0x5bfa7e){return function(_0xd19fa5){if(_0xd19fa5){var _0x514382=_0xd19fa5['count'],_0x4ed029=_0x5bfa7e['offset'],_0x1db97f=_0x5bfa7e[_0x8b83('0x1e')]+_0x5bfa7e[_0x8b83('0x1f')],_0x57919d;if(_0x1db97f>=_0x514382){_0x1db97f=_0x514382;_0x57919d=0xc8;}else{_0x57919d=0xce;}_0x406517[_0x8b83('0x1b')](_0x57919d);return _0x406517['set'](_0x8b83('0x20'),_0x4ed029+'-'+_0x1db97f+'/'+_0x514382)['json'](_0xd19fa5);}return null;};}function patchUpdates(_0x2b5406){return function(_0x49f4e9){try{jsonpatch[_0x8b83('0x21')](_0x49f4e9,_0x2b5406,!![]);}catch(_0x12b219){return BPromise[_0x8b83('0x22')](_0x12b219);}return _0x49f4e9[_0x8b83('0x23')]();};}function saveUpdates(_0x1d69fa,_0x45774c){return function(_0xe8eb68){if(_0xe8eb68){return _0xe8eb68[_0x8b83('0x24')](_0x1d69fa)[_0x8b83('0x25')](function(_0xdef204){return _0xdef204;});}return null;};}function removeEntity(_0x3e1e1c,_0x5b83d2){return function(_0x4cbe4f){if(_0x4cbe4f){return _0x4cbe4f['destroy']()[_0x8b83('0x25')](function(){_0x3e1e1c[_0x8b83('0x1b')](0xcc)[_0x8b83('0x1c')]();});}};}function handleEntityNotFound(_0x40548b,_0x2bd977){return function(_0x224473){if(!_0x224473){_0x40548b['sendStatus'](0x194);}return _0x224473;};}function handleError(_0x81c677,_0x1463b4){_0x1463b4=_0x1463b4||0x1f4;return function(_0x31158f){logger['error'](_0x31158f['stack']);if(_0x31158f['name']){delete _0x31158f[_0x8b83('0x26')];}_0x81c677[_0x8b83('0x1b')](_0x1463b4)[_0x8b83('0x27')](_0x31158f);};}exports[_0x8b83('0x28')]=function(_0x2d7648,_0xc1da56){var _0x3eb22e={},_0x37961f={},_0x2e6e98={'count':0x0,'rows':[]};var _0x4bd1cc=_[_0x8b83('0x29')](db['JscriptyAnswerReport'][_0x8b83('0x2a')],function(_0x240ea5){return{'name':_0x240ea5[_0x8b83('0x2b')],'type':_0x240ea5['type'][_0x8b83('0x2c')]};});_0x37961f[_0x8b83('0x2d')]=_['map'](_0x4bd1cc,_0x8b83('0x26'));_0x37961f[_0x8b83('0x2e')]=_[_0x8b83('0x2f')](_0x2d7648['query']);_0x37961f[_0x8b83('0x30')]=_[_0x8b83('0x31')](_0x37961f[_0x8b83('0x2d')],_0x37961f[_0x8b83('0x2e')]);_0x3eb22e[_0x8b83('0x32')]=_[_0x8b83('0x31')](_0x37961f[_0x8b83('0x2d')],qs[_0x8b83('0x33')](_0x2d7648[_0x8b83('0x2e')]['fields']));_0x3eb22e['attributes']=_0x3eb22e['attributes'][_0x8b83('0x34')]?_0x3eb22e['attributes']:_0x37961f[_0x8b83('0x2d')];if(!_0x2d7648[_0x8b83('0x2e')][_0x8b83('0x35')](_0x8b83('0x36'))){_0x3eb22e['limit']=qs[_0x8b83('0x1f')](_0x2d7648[_0x8b83('0x2e')][_0x8b83('0x1f')]);_0x3eb22e['offset']=qs['offset'](_0x2d7648[_0x8b83('0x2e')][_0x8b83('0x1e')]);}_0x3eb22e[_0x8b83('0x37')]=qs['sort'](_0x2d7648[_0x8b83('0x2e')][_0x8b83('0x38')]);_0x3eb22e[_0x8b83('0x39')]=qs['filters'](_['pick'](_0x2d7648['query'],_0x37961f[_0x8b83('0x30')]));if(_0x2d7648[_0x8b83('0x2e')][_0x8b83('0x3a')]){_0x3eb22e[_0x8b83('0x39')]=_['merge'](_0x3eb22e[_0x8b83('0x39')],{'$or':_['map'](_0x4bd1cc,function(_0xcae600){if(_0xcae600[_0x8b83('0x3b')]!==_0x8b83('0x3c')){var _0x125120={};_0x125120[_0xcae600[_0x8b83('0x26')]]={'$like':'%'+_0x2d7648[_0x8b83('0x2e')]['filter']+'%'};return _0x125120;}})});}_0x3eb22e=_[_0x8b83('0x3d')]({},_0x3eb22e,_0x2d7648['options']);var _0x2cadce={'where':_0x3eb22e[_0x8b83('0x39')]};return db[_0x8b83('0x3e')][_0x8b83('0x3f')](_0x2cadce)[_0x8b83('0x25')](function(_0x34137c){_0x2e6e98[_0x8b83('0x3f')]=_0x34137c;if(_0x2d7648['query']['includeAll']){_0x3eb22e[_0x8b83('0x40')]=[{'all':!![]}];}return db[_0x8b83('0x3e')][_0x8b83('0x41')](_0x3eb22e);})[_0x8b83('0x25')](function(_0x503292){_0x2e6e98[_0x8b83('0x42')]=_0x503292;return _0x2e6e98;})[_0x8b83('0x25')](respondWithFilteredResult(_0xc1da56,_0x3eb22e))[_0x8b83('0x43')](handleError(_0xc1da56,null));};exports[_0x8b83('0x44')]=function(_0x435223,_0x450c60){var _0x39c531={'raw':!![],'where':{'id':_0x435223[_0x8b83('0x45')]['id']}},_0x57e28e={};_0x57e28e['model']=_[_0x8b83('0x2f')](db[_0x8b83('0x3e')][_0x8b83('0x2a')]);_0x57e28e[_0x8b83('0x2e')]=_[_0x8b83('0x2f')](_0x435223[_0x8b83('0x2e')]);_0x57e28e[_0x8b83('0x30')]=_[_0x8b83('0x31')](_0x57e28e['model'],_0x57e28e[_0x8b83('0x2e')]);_0x39c531[_0x8b83('0x32')]=_[_0x8b83('0x31')](_0x57e28e[_0x8b83('0x2d')],qs[_0x8b83('0x33')](_0x435223[_0x8b83('0x2e')][_0x8b83('0x33')]));_0x39c531[_0x8b83('0x32')]=_0x39c531['attributes'][_0x8b83('0x34')]?_0x39c531[_0x8b83('0x32')]:_0x57e28e[_0x8b83('0x2d')];if(_0x435223[_0x8b83('0x2e')][_0x8b83('0x46')]){_0x39c531[_0x8b83('0x40')]=[{'all':!![]}];}_0x39c531=_[_0x8b83('0x3d')]({},_0x39c531,_0x435223[_0x8b83('0x47')]);return db['JscriptyAnswerReport']['find'](_0x39c531)[_0x8b83('0x25')](handleEntityNotFound(_0x450c60,null))[_0x8b83('0x25')](respondWithResult(_0x450c60,null))['catch'](handleError(_0x450c60,null));};exports[_0x8b83('0x48')]=function(_0x292e83,_0x3111ea){return db['JscriptyAnswerReport'][_0x8b83('0x48')](_0x292e83[_0x8b83('0x49')],{})[_0x8b83('0x25')](respondWithResult(_0x3111ea,0xc9))[_0x8b83('0x43')](handleError(_0x3111ea,null));};exports[_0x8b83('0x24')]=function(_0x20fde5,_0xdd6af0){if(_0x20fde5[_0x8b83('0x49')]['id']){delete _0x20fde5[_0x8b83('0x49')]['id'];}return db['JscriptyAnswerReport'][_0x8b83('0x4a')]({'where':{'id':_0x20fde5[_0x8b83('0x45')]['id']}})[_0x8b83('0x25')](handleEntityNotFound(_0xdd6af0,null))[_0x8b83('0x25')](saveUpdates(_0x20fde5['body'],null))['then'](respondWithResult(_0xdd6af0,null))[_0x8b83('0x43')](handleError(_0xdd6af0,null));};exports[_0x8b83('0x4b')]=function(_0x8802a0,_0x55b734){return db['JscriptyAnswerReport'][_0x8b83('0x4a')]({'where':{'id':_0x8802a0['params']['id']}})[_0x8b83('0x25')](handleEntityNotFound(_0x55b734,null))['then'](removeEntity(_0x55b734,null))[_0x8b83('0x43')](handleError(_0x55b734,null));};exports[_0x8b83('0x4c')]=function(_0x3a9af6,_0x5da80c){return db[_0x8b83('0x3e')][_0x8b83('0x4c')]()[_0x8b83('0x25')](respondWithResult(_0x5da80c,null))['catch'](handleError(_0x5da80c,null));}; \ No newline at end of file +var _0xc24e=['end','json','count','offset','limit','status','set','apply','save','update','destroy','then','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','includeAll','include','rows','catch','show','options','create','body','find','params','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','sendStatus'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0xc24e,0x1d9));var _0xec24=function(_0x37a83b,_0x2a7cda){_0x37a83b=_0x37a83b-0x0;var _0x3a14d5=_0xc24e[_0x37a83b];return _0x3a14d5;};'use strict';var pdf=require(_0xec24('0x0'));var emlformat=require(_0xec24('0x1'));var rimraf=require(_0xec24('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xec24('0x3'));var rp=require(_0xec24('0x4'));var moment=require(_0xec24('0x5'));var BPromise=require(_0xec24('0x6'));var Mustache=require(_0xec24('0x7'));var util=require(_0xec24('0x8'));var path=require(_0xec24('0x9'));var sox=require(_0xec24('0xa'));var csv=require(_0xec24('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xec24('0xc'));var squel=require(_0xec24('0xd'));var crypto=require(_0xec24('0xe'));var jsforce=require(_0xec24('0xf'));var deskjs=require(_0xec24('0x10'));var toCsv=require(_0xec24('0xb'));var querystring=require(_0xec24('0x11'));var Papa=require(_0xec24('0x12'));var Redis=require(_0xec24('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xec24('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xec24('0x15'));var utils=require(_0xec24('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450d63,_0x528eb2){_0x528eb2=_0x528eb2||0xcc;return function(_0x565537){if(_0x565537){return _0x450d63[_0xec24('0x17')](_0x528eb2);}return _0x450d63['status'](_0x528eb2)[_0xec24('0x18')]();};}function respondWithResult(_0x4ba418,_0x165ff9){_0x165ff9=_0x165ff9||0xc8;return function(_0x4ba4b2){if(_0x4ba4b2){return _0x4ba418['status'](_0x165ff9)[_0xec24('0x19')](_0x4ba4b2);}};}function respondWithFilteredResult(_0x196a2a,_0x522451){return function(_0x4e426c){if(_0x4e426c){var _0x5768fa=_0x4e426c[_0xec24('0x1a')],_0x3ef9d0=_0x522451[_0xec24('0x1b')],_0x108e10=_0x522451['offset']+_0x522451[_0xec24('0x1c')],_0x2c0ffc;if(_0x108e10>=_0x5768fa){_0x108e10=_0x5768fa;_0x2c0ffc=0xc8;}else{_0x2c0ffc=0xce;}_0x196a2a[_0xec24('0x1d')](_0x2c0ffc);return _0x196a2a[_0xec24('0x1e')]('Content-Range',_0x3ef9d0+'-'+_0x108e10+'/'+_0x5768fa)[_0xec24('0x19')](_0x4e426c);}return null;};}function patchUpdates(_0x194f43){return function(_0xf61d9b){try{jsonpatch[_0xec24('0x1f')](_0xf61d9b,_0x194f43,!![]);}catch(_0x195fc3){return BPromise['reject'](_0x195fc3);}return _0xf61d9b[_0xec24('0x20')]();};}function saveUpdates(_0xe3481e,_0x3ff84c){return function(_0xb7eb20){if(_0xb7eb20){return _0xb7eb20[_0xec24('0x21')](_0xe3481e)['then'](function(_0x3afe94){return _0x3afe94;});}return null;};}function removeEntity(_0x18c744,_0x27969e){return function(_0x43bbd3){if(_0x43bbd3){return _0x43bbd3[_0xec24('0x22')]()[_0xec24('0x23')](function(){_0x18c744[_0xec24('0x1d')](0xcc)[_0xec24('0x18')]();});}};}function handleEntityNotFound(_0x5728f8,_0x51dccb){return function(_0x58c001){if(!_0x58c001){_0x5728f8[_0xec24('0x17')](0x194);}return _0x58c001;};}function handleError(_0x397021,_0x2fe3d1){_0x2fe3d1=_0x2fe3d1||0x1f4;return function(_0x22b1a6){logger[_0xec24('0x24')](_0x22b1a6[_0xec24('0x25')]);if(_0x22b1a6[_0xec24('0x26')]){delete _0x22b1a6[_0xec24('0x26')];}_0x397021[_0xec24('0x1d')](_0x2fe3d1)[_0xec24('0x27')](_0x22b1a6);};}exports['index']=function(_0x1c2a77,_0x41093e){var _0x376687={},_0x39709a={},_0x539031={'count':0x0,'rows':[]};var _0x228be9=_[_0xec24('0x28')](db[_0xec24('0x29')][_0xec24('0x2a')],function(_0x4096cb){return{'name':_0x4096cb[_0xec24('0x2b')],'type':_0x4096cb['type'][_0xec24('0x2c')]};});_0x39709a[_0xec24('0x2d')]=_['map'](_0x228be9,'name');_0x39709a[_0xec24('0x2e')]=_[_0xec24('0x2f')](_0x1c2a77['query']);_0x39709a['filters']=_[_0xec24('0x30')](_0x39709a[_0xec24('0x2d')],_0x39709a[_0xec24('0x2e')]);_0x376687['attributes']=_[_0xec24('0x30')](_0x39709a[_0xec24('0x2d')],qs['fields'](_0x1c2a77[_0xec24('0x2e')][_0xec24('0x31')]));_0x376687[_0xec24('0x32')]=_0x376687[_0xec24('0x32')]['length']?_0x376687['attributes']:_0x39709a[_0xec24('0x2d')];if(!_0x1c2a77[_0xec24('0x2e')][_0xec24('0x33')](_0xec24('0x34'))){_0x376687[_0xec24('0x1c')]=qs[_0xec24('0x1c')](_0x1c2a77[_0xec24('0x2e')][_0xec24('0x1c')]);_0x376687[_0xec24('0x1b')]=qs[_0xec24('0x1b')](_0x1c2a77['query'][_0xec24('0x1b')]);}_0x376687['order']=qs['sort'](_0x1c2a77[_0xec24('0x2e')][_0xec24('0x35')]);_0x376687[_0xec24('0x36')]=qs[_0xec24('0x37')](_[_0xec24('0x38')](_0x1c2a77[_0xec24('0x2e')],_0x39709a[_0xec24('0x37')]));if(_0x1c2a77[_0xec24('0x2e')][_0xec24('0x39')]){_0x376687['where']=_[_0xec24('0x3a')](_0x376687[_0xec24('0x36')],{'$or':_['map'](_0x228be9,function(_0x3f10e1){if(_0x3f10e1[_0xec24('0x3b')]!=='VIRTUAL'){var _0x4891dc={};_0x4891dc[_0x3f10e1[_0xec24('0x26')]]={'$like':'%'+_0x1c2a77[_0xec24('0x2e')][_0xec24('0x39')]+'%'};return _0x4891dc;}})});}_0x376687=_[_0xec24('0x3a')]({},_0x376687,_0x1c2a77['options']);var _0x52a4e2={'where':_0x376687[_0xec24('0x36')]};return db[_0xec24('0x29')]['count'](_0x52a4e2)[_0xec24('0x23')](function(_0x14682e){_0x539031[_0xec24('0x1a')]=_0x14682e;if(_0x1c2a77[_0xec24('0x2e')][_0xec24('0x3c')]){_0x376687[_0xec24('0x3d')]=[{'all':!![]}];}return db[_0xec24('0x29')]['findAll'](_0x376687);})[_0xec24('0x23')](function(_0x2374c7){_0x539031[_0xec24('0x3e')]=_0x2374c7;return _0x539031;})[_0xec24('0x23')](respondWithFilteredResult(_0x41093e,_0x376687))[_0xec24('0x3f')](handleError(_0x41093e,null));};exports[_0xec24('0x40')]=function(_0x3d5e03,_0x1cfe29){var _0xdb3e1b={'raw':!![],'where':{'id':_0x3d5e03['params']['id']}},_0x237e19={};_0x237e19['model']=_[_0xec24('0x2f')](db[_0xec24('0x29')][_0xec24('0x2a')]);_0x237e19['query']=_[_0xec24('0x2f')](_0x3d5e03[_0xec24('0x2e')]);_0x237e19[_0xec24('0x37')]=_[_0xec24('0x30')](_0x237e19[_0xec24('0x2d')],_0x237e19[_0xec24('0x2e')]);_0xdb3e1b[_0xec24('0x32')]=_[_0xec24('0x30')](_0x237e19[_0xec24('0x2d')],qs[_0xec24('0x31')](_0x3d5e03[_0xec24('0x2e')][_0xec24('0x31')]));_0xdb3e1b[_0xec24('0x32')]=_0xdb3e1b[_0xec24('0x32')]['length']?_0xdb3e1b['attributes']:_0x237e19[_0xec24('0x2d')];if(_0x3d5e03[_0xec24('0x2e')][_0xec24('0x3c')]){_0xdb3e1b['include']=[{'all':!![]}];}_0xdb3e1b=_[_0xec24('0x3a')]({},_0xdb3e1b,_0x3d5e03[_0xec24('0x41')]);return db[_0xec24('0x29')]['find'](_0xdb3e1b)[_0xec24('0x23')](handleEntityNotFound(_0x1cfe29,null))[_0xec24('0x23')](respondWithResult(_0x1cfe29,null))[_0xec24('0x3f')](handleError(_0x1cfe29,null));};exports[_0xec24('0x42')]=function(_0x145fa4,_0x56969c){return db['JscriptyAnswerReport'][_0xec24('0x42')](_0x145fa4[_0xec24('0x43')],{})['then'](respondWithResult(_0x56969c,0xc9))[_0xec24('0x3f')](handleError(_0x56969c,null));};exports['update']=function(_0x17626c,_0x3e016f){if(_0x17626c[_0xec24('0x43')]['id']){delete _0x17626c[_0xec24('0x43')]['id'];}return db[_0xec24('0x29')][_0xec24('0x44')]({'where':{'id':_0x17626c[_0xec24('0x45')]['id']}})[_0xec24('0x23')](handleEntityNotFound(_0x3e016f,null))[_0xec24('0x23')](saveUpdates(_0x17626c[_0xec24('0x43')],null))[_0xec24('0x23')](respondWithResult(_0x3e016f,null))['catch'](handleError(_0x3e016f,null));};exports[_0xec24('0x22')]=function(_0x3c96c5,_0x59e8b3){return db['JscriptyAnswerReport'][_0xec24('0x44')]({'where':{'id':_0x3c96c5[_0xec24('0x45')]['id']}})[_0xec24('0x23')](handleEntityNotFound(_0x59e8b3,null))[_0xec24('0x23')](removeEntity(_0x59e8b3,null))[_0xec24('0x3f')](handleError(_0x59e8b3,null));};exports[_0xec24('0x46')]=function(_0x114faa,_0x4f3861){return db[_0xec24('0x29')]['describe']()['then'](respondWithResult(_0x4f3861,null))[_0xec24('0x3f')](handleError(_0x4f3861,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 549d5eb..cfcfe46 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 _0xeea3=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeea3,0x1ad));var _0x3eea=function(_0x1ee879,_0x3bfed2){_0x1ee879=_0x1ee879-0x0;var _0x672a7a=_0xeea3[_0x1ee879];return _0x672a7a;};'use strict';var _=require(_0x3eea('0x0'));var util=require('util');var logger=require(_0x3eea('0x1'))(_0x3eea('0x2'));var moment=require(_0x3eea('0x3'));var BPromise=require(_0x3eea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3eea('0x5'));var rimraf=require(_0x3eea('0x6'));var config=require('../../config/environment');var attributes=require(_0x3eea('0x7'));module[_0x3eea('0x8')]=function(_0x2c4471,_0x446ef0){return _0x2c4471['define'](_0x3eea('0x9'),attributes,{'tableName':_0x3eea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x481c=['request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ae0b9,_0x1d8321){var _0x5002bf=function(_0x222153){while(--_0x222153){_0x1ae0b9['push'](_0x1ae0b9['shift']());}};_0x5002bf(++_0x1d8321);}(_0x481c,0x1ac));var _0xc481=function(_0x9ca34a,_0x38e6c1){_0x9ca34a=_0x9ca34a-0x0;var _0x53a640=_0x481c[_0x9ca34a];return _0x53a640;};'use strict';var _=require(_0xc481('0x0'));var util=require(_0xc481('0x1'));var logger=require(_0xc481('0x2'))(_0xc481('0x3'));var moment=require(_0xc481('0x4'));var BPromise=require(_0xc481('0x5'));var rp=require(_0xc481('0x6'));var fs=require('fs');var path=require(_0xc481('0x7'));var rimraf=require(_0xc481('0x8'));var config=require(_0xc481('0x9'));var attributes=require(_0xc481('0xa'));module['exports']=function(_0x5e2c13,_0x2b62a5){return _0x5e2c13[_0xc481('0xb')](_0xc481('0xc'),attributes,{'tableName':_0xc481('0xd'),'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 88be0d3..8008373 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 _0xe487=['util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','catch'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xe487,0x1a2));var _0x7e48=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe487[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x7e48('0x0'));var moment=require(_0x7e48('0x1'));var BPromise=require('bluebird');var rs=require(_0x7e48('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e48('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7e48('0x4'))(_0x7e48('0x5'));var config=require('../../config/environment');var jayson=require(_0x7e48('0x6'));var client=jayson[_0x7e48('0x7')][_0x7e48('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c8aba,_0x1fd30c,_0x2c7ca9){return new BPromise(function(_0x196e58,_0x3a39fc){return client[_0x7e48('0x9')](_0x3c8aba,_0x2c7ca9)[_0x7e48('0xa')](function(_0x15b815){logger[_0x7e48('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1fd30c,'request\x20sent');logger[_0x7e48('0xc')](_0x7e48('0xd'),_0x1fd30c,_0x7e48('0xe'),JSON[_0x7e48('0xf')](_0x15b815));if(_0x15b815[_0x7e48('0x10')]){if(_0x15b815['error'][_0x7e48('0x11')]===0x1f4){logger[_0x7e48('0x10')](_0x7e48('0x12'),_0x1fd30c,_0x15b815[_0x7e48('0x10')][_0x7e48('0x13')]);return _0x3a39fc(_0x15b815[_0x7e48('0x10')][_0x7e48('0x13')]);}logger[_0x7e48('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1fd30c,_0x15b815[_0x7e48('0x10')][_0x7e48('0x13')]);return _0x196e58(_0x15b815[_0x7e48('0x10')][_0x7e48('0x13')]);}else{logger[_0x7e48('0xb')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1fd30c,_0x7e48('0xe'));_0x196e58(_0x15b815[_0x7e48('0x14')][_0x7e48('0x13')]);}})[_0x7e48('0x15')](function(_0x45fd56){logger[_0x7e48('0x10')](_0x7e48('0x12'),_0x1fd30c,_0x45fd56);_0x3a39fc(_0x45fd56);});});} \ No newline at end of file +var _0xb54c=['../../config/utils','jayson/promise','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x45e74d,_0x27e18b){var _0x12b298=function(_0x21f720){while(--_0x21f720){_0x45e74d['push'](_0x45e74d['shift']());}};_0x12b298(++_0x27e18b);}(_0xb54c,0x118));var _0xcb54=function(_0x4e94d6,_0x42991a){_0x4e94d6=_0x4e94d6-0x0;var _0x48235e=_0xb54c[_0x4e94d6];return _0x48235e;};'use strict';var _=require(_0xcb54('0x0'));var util=require(_0xcb54('0x1'));var moment=require('moment');var BPromise=require(_0xcb54('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb54('0x3'));var db=require(_0xcb54('0x4'))['db'];var utils=require(_0xcb54('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xcb54('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4da02f,_0x5dbeb0,_0x432056){return new BPromise(function(_0x64080d,_0x27e2fa){return client[_0xcb54('0x7')](_0x4da02f,_0x432056)[_0xcb54('0x8')](function(_0x1f0415){logger[_0xcb54('0x9')](_0xcb54('0xa'),_0x5dbeb0,'request\x20sent');logger[_0xcb54('0xb')](_0xcb54('0xc'),_0x5dbeb0,_0xcb54('0xd'),JSON[_0xcb54('0xe')](_0x1f0415));if(_0x1f0415['error']){if(_0x1f0415[_0xcb54('0xf')][_0xcb54('0x10')]===0x1f4){logger[_0xcb54('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5dbeb0,_0x1f0415['error']['message']);return _0x27e2fa(_0x1f0415[_0xcb54('0xf')][_0xcb54('0x11')]);}logger[_0xcb54('0xf')](_0xcb54('0xa'),_0x5dbeb0,_0x1f0415[_0xcb54('0xf')]['message']);return _0x64080d(_0x1f0415[_0xcb54('0xf')][_0xcb54('0x11')]);}else{logger[_0xcb54('0x9')](_0xcb54('0xa'),_0x5dbeb0,_0xcb54('0xd'));_0x64080d(_0x1f0415['result'][_0xcb54('0x11')]);}})[_0xcb54('0x12')](function(_0x418f80){logger[_0xcb54('0xf')](_0xcb54('0xa'),_0x5dbeb0,_0x418f80);_0x27e2fa(_0x418f80);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index ca5978d..4f54a3d 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 _0x3e6f=['/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','/:id/clone','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions'];(function(_0x594d09,_0x302fb9){var _0xd07832=function(_0x2b6c14){while(--_0x2b6c14){_0x594d09['push'](_0x594d09['shift']());}};_0xd07832(++_0x302fb9);}(_0x3e6f,0x88));var _0xf3e6=function(_0x71f842,_0x4622a5){_0x71f842=_0x71f842-0x0;var _0x22f982=_0x3e6f[_0x71f842];return _0x22f982;};'use strict';var multer=require(_0xf3e6('0x0'));var util=require(_0xf3e6('0x1'));var path=require(_0xf3e6('0x2'));var timeout=require(_0xf3e6('0x3'));var express=require('express');var router=express[_0xf3e6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf3e6('0x5'));var config=require('../../config/environment');var controller=require(_0xf3e6('0x6'));router[_0xf3e6('0x7')]('/',auth[_0xf3e6('0x8')](),controller[_0xf3e6('0x9')]);router[_0xf3e6('0x7')](_0xf3e6('0xa'),auth[_0xf3e6('0x8')](),controller[_0xf3e6('0xb')]);router['get'](_0xf3e6('0xc'),auth[_0xf3e6('0x8')](),controller[_0xf3e6('0xd')]);router[_0xf3e6('0x7')](_0xf3e6('0xe'),auth['isAuthenticated'](),controller[_0xf3e6('0xf')]);router[_0xf3e6('0x7')](_0xf3e6('0x10'),auth[_0xf3e6('0x8')](),timeout(_0xf3e6('0x11')),controller[_0xf3e6('0x12')]);router[_0xf3e6('0x13')]('/',auth[_0xf3e6('0x8')](),controller['create']);router[_0xf3e6('0x13')](_0xf3e6('0x14'),auth['isAuthenticated'](),controller['clone']);router[_0xf3e6('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf3e6('0x16')]);router[_0xf3e6('0x17')](_0xf3e6('0xa'),auth[_0xf3e6('0x8')](),controller['destroy']);module[_0xf3e6('0x18')]=router; \ No newline at end of file +var _0x9d7a=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','show','/:id/sessions','getSessions','/:id/answers','getAnswers','get','/:id/summary','30s','getSummary','post','create','clone','put','/:id','delete','multer'];(function(_0x29f9af,_0x4f3d10){var _0x56e4a8=function(_0x2e2554){while(--_0x2e2554){_0x29f9af['push'](_0x29f9af['shift']());}};_0x56e4a8(++_0x4f3d10);}(_0x9d7a,0xd7));var _0xa9d7=function(_0x1d67bf,_0x2ff8f1){_0x1d67bf=_0x1d67bf-0x0;var _0x7ce418=_0x9d7a[_0x1d67bf];return _0x7ce418;};'use strict';var multer=require(_0xa9d7('0x0'));var util=require(_0xa9d7('0x1'));var path=require(_0xa9d7('0x2'));var timeout=require(_0xa9d7('0x3'));var express=require(_0xa9d7('0x4'));var router=express[_0xa9d7('0x5')]();var auth=require(_0xa9d7('0x6'));var interaction=require(_0xa9d7('0x7'));var config=require(_0xa9d7('0x8'));var controller=require(_0xa9d7('0x9'));router['get']('/',auth[_0xa9d7('0xa')](),controller[_0xa9d7('0xb')]);router['get']('/:id',auth[_0xa9d7('0xa')](),controller[_0xa9d7('0xc')]);router['get'](_0xa9d7('0xd'),auth['isAuthenticated'](),controller[_0xa9d7('0xe')]);router['get'](_0xa9d7('0xf'),auth[_0xa9d7('0xa')](),controller[_0xa9d7('0x10')]);router[_0xa9d7('0x11')](_0xa9d7('0x12'),auth[_0xa9d7('0xa')](),timeout(_0xa9d7('0x13')),controller[_0xa9d7('0x14')]);router[_0xa9d7('0x15')]('/',auth[_0xa9d7('0xa')](),controller[_0xa9d7('0x16')]);router['post']('/:id/clone',auth[_0xa9d7('0xa')](),controller[_0xa9d7('0x17')]);router[_0xa9d7('0x18')](_0xa9d7('0x19'),auth[_0xa9d7('0xa')](),controller['update']);router[_0xa9d7('0x1a')](_0xa9d7('0x19'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 87a6de3..4679f3c 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 _0x930a=['description','BOOLEAN','sequelize','STRING','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name'];(function(_0x5ac905,_0x1fb98a){var _0x5d4fcc=function(_0x1b8b84){while(--_0x1b8b84){_0x5ac905['push'](_0x5ac905['shift']());}};_0x5d4fcc(++_0x1fb98a);}(_0x930a,0x1a2));var _0xa930=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x930a[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require(_0xa930('0x0'));var _=require('lodash');var util=require('util');module['exports']={'name':{'type':Sequelize[_0xa930('0x1')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x25aa48){if(_[_0xa930('0x2')](_0x25aa48)){this['setDataValue'](_0xa930('0x3'),JSON[_0xa930('0x4')](_0x25aa48));}else if(_[_0xa930('0x5')](_0x25aa48)){this['setDataValue'](_0xa930('0x3'),_0x25aa48);}else{this[_0xa930('0x6')](_0xa930('0x3'),util[_0xa930('0x7')](_0xa930('0x8'),this[_0xa930('0x9')](_0xa930('0xa'))||'',this[_0xa930('0x9')](_0xa930('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xa930('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xa930('0xc')],'defaultValue':![]}}; \ No newline at end of file +var _0x40f6=['exports','STRING','name','TEXT','long','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x40f6,0xfd));var _0x640f=function(_0x31e2e0,_0x3238b2){_0x31e2e0=_0x31e2e0-0x0;var _0x4addef=_0x40f6[_0x31e2e0];return _0x4addef;};'use strict';var Sequelize=require(_0x640f('0x0'));var _=require(_0x640f('0x1'));var util=require(_0x640f('0x2'));module[_0x640f('0x3')]={'name':{'type':Sequelize[_0x640f('0x4')],'unique':_0x640f('0x5')},'description':{'type':Sequelize[_0x640f('0x4')]},'formData':{'type':Sequelize[_0x640f('0x6')](_0x640f('0x7')),'set':function(_0x3a83c0){if(_['isObjectLike'](_0x3a83c0)){this[_0x640f('0x8')](_0x640f('0x9'),JSON[_0x640f('0xa')](_0x3a83c0));}else if(_[_0x640f('0xb')](_0x3a83c0)){this[_0x640f('0x8')]('formData',_0x3a83c0);}else{this['setDataValue'](_0x640f('0x9'),util[_0x640f('0xc')](_0x640f('0xd'),this['getDataValue']('name')||'',this[_0x640f('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x640f('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x640f('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 6b5b4d9..f931b3c 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 _0x7298=['get','role','userProfileId','autoAssociation','error','clone','params','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','getSessions','JscriptySessionReport','hasOwnProperty','options','getAnswers','JscriptyAnswerReport','order','findAll','number','toString','indexOf','replace','getSummary','starttime','startTime','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','Projects','UserProfileResource','sendStatus','name','send','index','map','JscriptyProject','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','includeAll','rows','catch','show','keys','include','find','create','body','user'];(function(_0xd9fd40,_0x37d572){var _0x244d56=function(_0x4cefbc){while(--_0x4cefbc){_0xd9fd40['push'](_0xd9fd40['shift']());}};_0x244d56(++_0x37d572);}(_0x7298,0x177));var _0x8729=function(_0x14e43d,_0x818227){_0x14e43d=_0x14e43d-0x0;var _0xf59db5=_0x7298[_0x14e43d];return _0xf59db5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8729('0x0'));var rimraf=require(_0x8729('0x1'));var zipdir=require(_0x8729('0x2'));var jsonpatch=require(_0x8729('0x3'));var rp=require(_0x8729('0x4'));var moment=require(_0x8729('0x5'));var BPromise=require(_0x8729('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8729('0x7'));var sox=require('sox');var csv=require(_0x8729('0x8'));var ejs=require(_0x8729('0x9'));var fs=require('fs');var _=require(_0x8729('0xa'));var squel=require(_0x8729('0xb'));var crypto=require(_0x8729('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8729('0x8'));var querystring=require(_0x8729('0xd'));var Papa=require(_0x8729('0xe'));var Redis=require(_0x8729('0xf'));var authService=require(_0x8729('0x10'));var qs=require(_0x8729('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8729('0x12'))(_0x8729('0x13'));var utils=require(_0x8729('0x14'));var config=require(_0x8729('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28a14e,_0x5c536b){_0x5c536b=_0x5c536b||0xcc;return function(_0x495971){if(_0x495971){return _0x28a14e['sendStatus'](_0x5c536b);}return _0x28a14e[_0x8729('0x16')](_0x5c536b)[_0x8729('0x17')]();};}function respondWithResult(_0x1c606c,_0x3ee1a4){_0x3ee1a4=_0x3ee1a4||0xc8;return function(_0x34ebe9){if(_0x34ebe9){return _0x1c606c[_0x8729('0x16')](_0x3ee1a4)[_0x8729('0x18')](_0x34ebe9);}};}function respondWithFilteredResult(_0x33ab08,_0xc5b6d4){return function(_0x337088){if(_0x337088){var _0x1f0249=_0x337088[_0x8729('0x19')],_0x57bb8f=_0xc5b6d4['offset'],_0xf8c2f9=_0xc5b6d4[_0x8729('0x1a')]+_0xc5b6d4[_0x8729('0x1b')],_0x35844b;if(_0xf8c2f9>=_0x1f0249){_0xf8c2f9=_0x1f0249;_0x35844b=0xc8;}else{_0x35844b=0xce;}_0x33ab08[_0x8729('0x16')](_0x35844b);return _0x33ab08['set'](_0x8729('0x1c'),_0x57bb8f+'-'+_0xf8c2f9+'/'+_0x1f0249)[_0x8729('0x18')](_0x337088);}return null;};}function patchUpdates(_0x26b2ca){return function(_0x2f0ae5){try{jsonpatch[_0x8729('0x1d')](_0x2f0ae5,_0x26b2ca,!![]);}catch(_0x42f7fe){return BPromise[_0x8729('0x1e')](_0x42f7fe);}return _0x2f0ae5[_0x8729('0x1f')]();};}function saveUpdates(_0x18529d,_0x4718b2){return function(_0x3a60e9){if(_0x3a60e9){return _0x3a60e9['update'](_0x18529d)[_0x8729('0x20')](function(_0x5db599){return _0x5db599;});}return null;};}function removeEntity(_0x375696,_0x3c7c1c){return function(_0x2ab541){if(_0x2ab541){return _0x2ab541[_0x8729('0x21')]()[_0x8729('0x20')](function(){var _0x5b2ad4=_0x2ab541['get']({'plain':!![]});var _0x432d0e=_0x8729('0x22');return db[_0x8729('0x23')][_0x8729('0x21')]({'where':{'type':_0x432d0e,'resourceId':_0x5b2ad4['id']}})[_0x8729('0x20')](function(){return _0x2ab541;});})[_0x8729('0x20')](function(){_0x375696[_0x8729('0x16')](0xcc)[_0x8729('0x17')]();});}};}function handleEntityNotFound(_0x55fe7a,_0x359f57){return function(_0x51713a){if(!_0x51713a){_0x55fe7a[_0x8729('0x24')](0x194);}return _0x51713a;};}function handleError(_0x468e7c,_0x19d792){_0x19d792=_0x19d792||0x1f4;return function(_0x4a6818){logger['error'](_0x4a6818['stack']);if(_0x4a6818[_0x8729('0x25')]){delete _0x4a6818[_0x8729('0x25')];}_0x468e7c[_0x8729('0x16')](_0x19d792)[_0x8729('0x26')](_0x4a6818);};}exports[_0x8729('0x27')]=function(_0x5f2a67,_0x31f105){var _0x516cda={},_0x4aab03={},_0x319461={'count':0x0,'rows':[]};var _0x41db35=_[_0x8729('0x28')](db[_0x8729('0x29')][_0x8729('0x2a')],function(_0x3eaaee){return{'name':_0x3eaaee['fieldName'],'type':_0x3eaaee[_0x8729('0x2b')][_0x8729('0x2c')]};});_0x4aab03['model']=_['map'](_0x41db35,_0x8729('0x25'));_0x4aab03[_0x8729('0x2d')]=_['keys'](_0x5f2a67[_0x8729('0x2d')]);_0x4aab03[_0x8729('0x2e')]=_[_0x8729('0x2f')](_0x4aab03[_0x8729('0x30')],_0x4aab03[_0x8729('0x2d')]);_0x516cda[_0x8729('0x31')]=_[_0x8729('0x2f')](_0x4aab03[_0x8729('0x30')],qs[_0x8729('0x32')](_0x5f2a67[_0x8729('0x2d')]['fields']));_0x516cda[_0x8729('0x31')]=_0x516cda[_0x8729('0x31')][_0x8729('0x33')]?_0x516cda[_0x8729('0x31')]:_0x4aab03[_0x8729('0x30')];if(!_0x5f2a67[_0x8729('0x2d')]['hasOwnProperty'](_0x8729('0x34'))){_0x516cda[_0x8729('0x1b')]=qs[_0x8729('0x1b')](_0x5f2a67[_0x8729('0x2d')][_0x8729('0x1b')]);_0x516cda[_0x8729('0x1a')]=qs['offset'](_0x5f2a67[_0x8729('0x2d')][_0x8729('0x1a')]);}_0x516cda['order']=qs[_0x8729('0x35')](_0x5f2a67[_0x8729('0x2d')][_0x8729('0x35')]);_0x516cda['where']=qs[_0x8729('0x2e')](_[_0x8729('0x36')](_0x5f2a67[_0x8729('0x2d')],_0x4aab03['filters']));if(_0x5f2a67[_0x8729('0x2d')][_0x8729('0x37')]){_0x516cda[_0x8729('0x38')]=_['merge'](_0x516cda[_0x8729('0x38')],{'$or':_[_0x8729('0x28')](_0x41db35,function(_0x5cc06a){if(_0x5cc06a[_0x8729('0x2b')]!==_0x8729('0x39')){var _0x2fa298={};_0x2fa298[_0x5cc06a[_0x8729('0x25')]]={'$like':'%'+_0x5f2a67[_0x8729('0x2d')][_0x8729('0x37')]+'%'};return _0x2fa298;}})});}_0x516cda=_[_0x8729('0x3a')]({},_0x516cda,_0x5f2a67['options']);var _0x5b1322={'where':_0x516cda[_0x8729('0x38')]};return db[_0x8729('0x29')][_0x8729('0x19')](_0x5b1322)['then'](function(_0x2abd32){_0x319461[_0x8729('0x19')]=_0x2abd32;if(_0x5f2a67[_0x8729('0x2d')][_0x8729('0x3b')]){_0x516cda['include']=[{'all':!![]}];}return db[_0x8729('0x29')]['findAll'](_0x516cda);})['then'](function(_0x1e76b0){_0x319461[_0x8729('0x3c')]=_0x1e76b0;return _0x319461;})[_0x8729('0x20')](respondWithFilteredResult(_0x31f105,_0x516cda))[_0x8729('0x3d')](handleError(_0x31f105,null));};exports[_0x8729('0x3e')]=function(_0x349e99,_0x1768c6){var _0x33ed3b={'raw':![],'where':{'id':_0x349e99['params']['id']}},_0x4f2d2a={};_0x4f2d2a['model']=_[_0x8729('0x3f')](db['JscriptyProject']['rawAttributes']);_0x4f2d2a[_0x8729('0x2d')]=_['keys'](_0x349e99['query']);_0x4f2d2a[_0x8729('0x2e')]=_[_0x8729('0x2f')](_0x4f2d2a[_0x8729('0x30')],_0x4f2d2a['query']);_0x33ed3b[_0x8729('0x31')]=_[_0x8729('0x2f')](_0x4f2d2a['model'],qs['fields'](_0x349e99[_0x8729('0x2d')][_0x8729('0x32')]));_0x33ed3b[_0x8729('0x31')]=_0x33ed3b[_0x8729('0x31')][_0x8729('0x33')]?_0x33ed3b[_0x8729('0x31')]:_0x4f2d2a['model'];if(_0x349e99['query'][_0x8729('0x3b')]){_0x33ed3b[_0x8729('0x40')]=[{'all':!![]}];}_0x33ed3b=_['merge']({},_0x33ed3b,_0x349e99['options']);return db['JscriptyProject'][_0x8729('0x41')](_0x33ed3b)[_0x8729('0x20')](handleEntityNotFound(_0x1768c6,null))['then'](respondWithResult(_0x1768c6,null))[_0x8729('0x3d')](handleError(_0x1768c6,null));};exports[_0x8729('0x42')]=function(_0x51a6e8,_0x15a4ae){return db['JscriptyProject'][_0x8729('0x42')](_0x51a6e8[_0x8729('0x43')],{})[_0x8729('0x20')](function(_0x28ae0f){var _0x517bc1=_0x51a6e8[_0x8729('0x44')][_0x8729('0x45')]({'plain':!![]});if(!_0x517bc1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x517bc1[_0x8729('0x46')]===_0x8729('0x44')){var _0x56a52e=_0x28ae0f['get']({'plain':!![]});var _0x262b25=_0x8729('0x22');return db['UserProfileSection'][_0x8729('0x41')]({'where':{'name':_0x262b25,'userProfileId':_0x517bc1[_0x8729('0x47')]},'raw':!![]})[_0x8729('0x20')](function(_0x2e42f5){if(_0x2e42f5&&_0x2e42f5[_0x8729('0x48')]===0x0){return db[_0x8729('0x23')]['create']({'name':_0x56a52e[_0x8729('0x25')],'resourceId':_0x56a52e['id'],'type':_0x2e42f5['name'],'sectionId':_0x2e42f5['id']},{})[_0x8729('0x20')](function(){return _0x28ae0f;});}else{return _0x28ae0f;}})[_0x8729('0x3d')](function(_0x39ce9f){logger[_0x8729('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x39ce9f);throw _0x39ce9f;});}return _0x28ae0f;})['then'](respondWithResult(_0x15a4ae,0xc9))[_0x8729('0x3d')](handleError(_0x15a4ae,null));};exports[_0x8729('0x4a')]=function(_0x2b5df0,_0x39a91f){var _0x4e4561={'where':{'id':_0x2b5df0[_0x8729('0x4b')]['id']}},_0x470cf1={};_0x470cf1[_0x8729('0x30')]=_[_0x8729('0x3f')](db[_0x8729('0x29')]['rawAttributes']);_0x4e4561[_0x8729('0x31')]=_[_0x8729('0x2f')](_0x470cf1['model'],qs[_0x8729('0x32')](_0x2b5df0[_0x8729('0x2d')][_0x8729('0x32')]));_0x4e4561[_0x8729('0x31')]=_0x4e4561['attributes'][_0x8729('0x33')]?_0x4e4561[_0x8729('0x31')]:_0x470cf1[_0x8729('0x30')];if(_0x2b5df0['query']['includeAll']){_0x4e4561['include']=[{'all':!![]}];}_0x4e4561=_[_0x8729('0x3a')]({},_0x4e4561,_0x2b5df0['options']);return db['JscriptyProject']['find'](_0x4e4561)[_0x8729('0x20')](handleEntityNotFound(_0x39a91f,null))[_0x8729('0x20')](function(_0x49b6fd){if(_0x49b6fd){var _0x3fee07=_0x49b6fd[_0x8729('0x45')]({'plain':!![]});_0x3fee07=qs[_0x8729('0x4c')](_0x3fee07,['id',_0x8729('0x4d'),_0x8729('0x4e')]);_0x2b5df0[_0x8729('0x43')]=_[_0x8729('0x4c')](_0x2b5df0[_0x8729('0x43')],['id',_0x8729('0x4d'),_0x8729('0x4e')]);return db[_0x8729('0x29')][_0x8729('0x42')](_[_0x8729('0x3a')](_0x3fee07,_0x2b5df0[_0x8729('0x43')]),{'include':_0x2b5df0['query'][_0x8729('0x3b')]?[{'all':!![]}]:undefined})[_0x8729('0x20')](function(_0x6f1f6a){var _0x3cae34=_0x2b5df0[_0x8729('0x44')]['get']({'plain':!![]});if(!_0x3cae34)throw new Error(_0x8729('0x4f'));if(_0x3cae34['role']===_0x8729('0x44')){var _0x247640=_0x6f1f6a[_0x8729('0x45')]({'plain':!![]});var _0x30516b=_0x8729('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x30516b,'userProfileId':_0x3cae34['userProfileId']},'raw':!![]})[_0x8729('0x20')](function(_0x4b183c){if(_0x4b183c&&_0x4b183c[_0x8729('0x48')]===0x0){return db['UserProfileResource'][_0x8729('0x42')]({'name':_0x247640[_0x8729('0x25')],'resourceId':_0x247640['id'],'type':_0x4b183c['name'],'sectionId':_0x4b183c['id']},{})[_0x8729('0x20')](function(){return _0x6f1f6a;});}else{return _0x6f1f6a;}})['catch'](function(_0x471c16){logger[_0x8729('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x471c16);throw _0x471c16;});}return _0x6f1f6a;});}})[_0x8729('0x20')](respondWithResult(_0x39a91f,0xc9))[_0x8729('0x3d')](handleError(_0x39a91f,null));};exports[_0x8729('0x50')]=function(_0x4e9d87,_0x529c39){if(_0x4e9d87['body']['id']){delete _0x4e9d87['body']['id'];}return db[_0x8729('0x29')]['find']({'where':{'id':_0x4e9d87[_0x8729('0x4b')]['id']}})['then'](handleEntityNotFound(_0x529c39,null))[_0x8729('0x20')](saveUpdates(_0x4e9d87[_0x8729('0x43')],null))[_0x8729('0x20')](respondWithResult(_0x529c39,null))[_0x8729('0x3d')](handleError(_0x529c39,null));};exports[_0x8729('0x21')]=function(_0x54d3f9,_0x1cd922){return db[_0x8729('0x29')][_0x8729('0x41')]({'where':{'id':_0x54d3f9['params']['id']}})[_0x8729('0x20')](handleEntityNotFound(_0x1cd922,null))['then'](removeEntity(_0x1cd922,null))['catch'](handleError(_0x1cd922,null));};exports[_0x8729('0x51')]=function(_0x3897a9,_0x3c0bad,_0x2e65dc){var _0x438dc2={'raw':!![],'where':{}};var _0xed1230={};var _0x3b91af={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x3897a9[_0x8729('0x4b')]['id']}})[_0x8729('0x20')](handleEntityNotFound(_0x3c0bad,null))[_0x8729('0x20')](function(_0x131031){if(_0x131031){_0xed1230[_0x8729('0x30')]=_[_0x8729('0x3f')](db[_0x8729('0x52')][_0x8729('0x2a')]);_0xed1230[_0x8729('0x2d')]=_[_0x8729('0x3f')](_0x3897a9[_0x8729('0x2d')]);_0xed1230['filters']=_[_0x8729('0x2f')](_0xed1230['model'],_0xed1230['query']);_0x438dc2[_0x8729('0x31')]=_[_0x8729('0x2f')](_0xed1230['model'],qs[_0x8729('0x32')](_0x3897a9[_0x8729('0x2d')][_0x8729('0x32')]));_0x438dc2['attributes']=_0x438dc2[_0x8729('0x31')][_0x8729('0x33')]?_0x438dc2[_0x8729('0x31')]:_0xed1230[_0x8729('0x30')];if(!_0x3897a9['query'][_0x8729('0x53')](_0x8729('0x34'))){_0x438dc2[_0x8729('0x1b')]=qs[_0x8729('0x1b')](_0x3897a9[_0x8729('0x2d')][_0x8729('0x1b')]);_0x438dc2[_0x8729('0x1a')]=qs['offset'](_0x3897a9[_0x8729('0x2d')][_0x8729('0x1a')]);}_0x438dc2['order']=qs[_0x8729('0x35')](_0x3897a9[_0x8729('0x2d')]['sort']);_0x438dc2['where']=qs['filters'](_['pick'](_0x3897a9['query'],_0xed1230[_0x8729('0x2e')]));_0x438dc2[_0x8729('0x38')]['ProjectId']=_0x131031['id'];if(_0x3897a9[_0x8729('0x2d')]['filter']){_0x438dc2[_0x8729('0x38')]=_['merge'](_0x438dc2[_0x8729('0x38')],{'$or':_[_0x8729('0x28')](_0x438dc2['attributes'],function(_0xf2df22){var _0x1e8df0={};_0x1e8df0[_0xf2df22]={'$like':'%'+_0x3897a9[_0x8729('0x2d')]['filter']+'%'};return _0x1e8df0;})});}_0x438dc2=_[_0x8729('0x3a')]({},_0x438dc2,_0x3897a9[_0x8729('0x54')]);return db['JscriptySessionReport'][_0x8729('0x19')]({'where':_0x438dc2['where']})[_0x8729('0x20')](function(_0x25b4e1){_0x3b91af[_0x8729('0x19')]=_0x25b4e1;if(_0x3897a9[_0x8729('0x2d')][_0x8729('0x3b')]){_0x438dc2[_0x8729('0x40')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x438dc2);})[_0x8729('0x20')](function(_0x55cfaf){_0x3b91af[_0x8729('0x3c')]=_0x55cfaf;return _0x3b91af;});}})[_0x8729('0x20')](respondWithFilteredResult(_0x3c0bad,_0x438dc2))['catch'](handleError(_0x3c0bad,null));};exports[_0x8729('0x55')]=function(_0x1748d0,_0x18b9ac,_0x5ece50){var _0x2ba237={'raw':!![],'where':{}};var _0x13623c={};var _0x4b40a5={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x1748d0[_0x8729('0x4b')]['id']}})['then'](handleEntityNotFound(_0x18b9ac,null))[_0x8729('0x20')](function(_0x1176e5){if(_0x1176e5){_0x13623c[_0x8729('0x30')]=_[_0x8729('0x3f')](db[_0x8729('0x56')][_0x8729('0x2a')]);_0x13623c[_0x8729('0x2d')]=_[_0x8729('0x3f')](_0x1748d0[_0x8729('0x2d')]);_0x13623c[_0x8729('0x2e')]=_['intersection'](_0x13623c['model'],_0x13623c[_0x8729('0x2d')]);_0x2ba237['attributes']=_['intersection'](_0x13623c['model'],qs['fields'](_0x1748d0['query'][_0x8729('0x32')]));_0x2ba237[_0x8729('0x31')]=_0x2ba237[_0x8729('0x31')][_0x8729('0x33')]?_0x2ba237[_0x8729('0x31')]:_0x13623c['model'];if(!_0x1748d0['query'][_0x8729('0x53')](_0x8729('0x34'))){_0x2ba237[_0x8729('0x1b')]=qs[_0x8729('0x1b')](_0x1748d0['query'][_0x8729('0x1b')]);_0x2ba237[_0x8729('0x1a')]=qs[_0x8729('0x1a')](_0x1748d0[_0x8729('0x2d')][_0x8729('0x1a')]);}_0x2ba237[_0x8729('0x57')]=qs['sort'](_0x1748d0[_0x8729('0x2d')][_0x8729('0x35')]);_0x2ba237[_0x8729('0x38')]=qs[_0x8729('0x2e')](_[_0x8729('0x36')](_0x1748d0[_0x8729('0x2d')],_0x13623c[_0x8729('0x2e')]));_0x2ba237['where']['ProjectId']=_0x1176e5['id'];if(_0x1748d0[_0x8729('0x2d')]['filter']){_0x2ba237[_0x8729('0x38')]=_['merge'](_0x2ba237['where'],{'$or':_[_0x8729('0x28')](_0x2ba237[_0x8729('0x31')],function(_0x3a32d4){var _0x5dd31a={};_0x5dd31a[_0x3a32d4]={'$like':'%'+_0x1748d0[_0x8729('0x2d')][_0x8729('0x37')]+'%'};return _0x5dd31a;})});}_0x2ba237=_[_0x8729('0x3a')]({},_0x2ba237,_0x1748d0['options']);return db[_0x8729('0x56')]['count']({'where':_0x2ba237[_0x8729('0x38')]})[_0x8729('0x20')](function(_0x188dbe){_0x4b40a5[_0x8729('0x19')]=_0x188dbe;if(_0x1748d0[_0x8729('0x2d')][_0x8729('0x3b')]){_0x2ba237[_0x8729('0x40')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x8729('0x58')](_0x2ba237);})[_0x8729('0x20')](function(_0x239ab8){_0x4b40a5[_0x8729('0x3c')]=_0x239ab8;return _0x4b40a5;});}})['then'](respondWithFilteredResult(_0x18b9ac,_0x2ba237))[_0x8729('0x3d')](handleError(_0x18b9ac,null));};function char(_0x2fa41b){return _0x8729('0x59')===typeof _0x2fa41b?String['fromCharCode'][_0x8729('0x1d')](null,arguments):_0x2fa41b;}function needsEncapsulation(_0x2f3da3){return!!_0x2f3da3&&(_0x2f3da3[_0x8729('0x5a')]()['indexOf'](char(0xd))>=0x0||_0x2f3da3[_0x8729('0x5a')]()[_0x8729('0x5b')](char(0xa))>=0x0||_0x2f3da3[_0x8729('0x5a')]()[_0x8729('0x5b')](char(0x2c))>=0x0||_0x2f3da3[_0x8729('0x5a')]()[_0x8729('0x5b')](char(0x22))>=0x0);}function encapsulate(_0x59f94c){var _0x48ed72=char(0x22),_0xa29f46='\x5c'+char(0x22),_0x2e1d14=_0x59f94c[_0x8729('0x5a')]()[_0x8729('0x5c')](new RegExp(_0x48ed72,'g'),_0xa29f46);return _0x48ed72+_0x2e1d14+_0x48ed72;}exports[_0x8729('0x5d')]=function(_0x1674f5,_0x3d65e4,_0x1b5724){var _0x37c9f7,_0x522eaa;var _0x21c9ca={'where':{'ProjectId':_0x1674f5[_0x8729('0x4b')]['id']}};if(_0x1674f5[_0x8729('0x2d')]['startTime']){_0x21c9ca[_0x8729('0x38')][_0x8729('0x5e')]=JSON['parse'](_0x1674f5[_0x8729('0x2d')][_0x8729('0x5f')]);}return db[_0x8729('0x52')][_0x8729('0x58')](_0x21c9ca)[_0x8729('0x20')](handleEntityNotFound(_0x3d65e4,null))['then'](function(_0x209dd0){if(_0x209dd0){_0x37c9f7=_0x209dd0;return db['JscriptyQuestionReport'][_0x8729('0x58')]({'where':{'SessionId':{'$in':_['map'](_0x37c9f7,'id')},'ProjectId':_0x1674f5[_0x8729('0x4b')]['id']},'order':_0x8729('0x60')});}})[_0x8729('0x20')](handleEntityNotFound(_0x3d65e4,null))['then'](function(_0x48e791){if(_0x48e791){_0x522eaa=_0x48e791;var _0x3b557a={};for(var _0x31bdc9=0x0,_0x4d336f=_0x522eaa[_0x8729('0x33')];_0x31bdc9<_0x4d336f;_0x31bdc9++){if(!_0x3b557a[_0x8729('0x53')](_0x522eaa[_0x31bdc9][_0x8729('0x61')])){_0x3b557a[_0x522eaa[_0x31bdc9][_0x8729('0x61')]]=needsEncapsulation(_0x522eaa[_0x31bdc9]['question'])?encapsulate(_0x522eaa[_0x31bdc9]['question']):_0x522eaa[_0x31bdc9][_0x8729('0x62')];}}var _0x2136cb=[],_0x4628a6={};for(var _0x4ae3db=0x0,_0x5ba8c1=_0x37c9f7[_0x8729('0x33')];_0x4ae3db<_0x5ba8c1;_0x4ae3db++){_0x4628a6={'ProjectId':_0x1674f5[_0x8729('0x4b')]['id'],'SessionId':_0x37c9f7[_0x4ae3db]['id'],'StartTime':moment(_0x37c9f7[_0x4ae3db]['starttime'])['format'](_0x8729('0x63'))};for(var _0x32a979=0x0,_0x6ff061=_0x522eaa['length'];_0x32a979<_0x6ff061;_0x32a979++){if(_0x522eaa[_0x32a979][_0x8729('0x64')]==_0x37c9f7[_0x4ae3db]['id']&&_0x3b557a[_0x8729('0x53')](_0x522eaa[_0x32a979][_0x8729('0x61')])){_0x4628a6[_0x3b557a[_0x522eaa[_0x32a979]['questionId']]]=_0x522eaa[_0x32a979][_0x8729('0x65')];}}for(var _0x51b256 in _0x3b557a){if(!_0x4628a6[_0x8729('0x53')](_0x3b557a[_0x51b256])){_0x4628a6[_0x3b557a[_0x51b256]]=null;}}_0x2136cb[_0x8729('0x66')](_0x4628a6);}return _0x2136cb;}})[_0x8729('0x20')](function(_0xf396d5){if(!_[_0x8729('0x67')](_0xf396d5)){var _0x2067ba=toCsv(_0xf396d5);var _0x43a455=Date[_0x8729('0x68')]();fs['writeFileSync'](util[_0x8729('0x69')](_0x8729('0x6a'),_0x1674f5[_0x8729('0x4b')]['id'],_0x43a455),_0x2067ba);_0x3d65e4[_0x8729('0x6b')]('Content-disposition','attachment;\x20filename='+util[_0x8729('0x69')](_0x8729('0x6c'),_0x1674f5[_0x8729('0x4b')]['id'],_0x43a455));_0x3d65e4['setHeader']('Content-type',_0x8729('0x6d'));return _0x3d65e4[_0x8729('0x6e')](util[_0x8729('0x69')](_0x8729('0x6a'),_0x1674f5['params']['id'],_0x43a455));}else{return _0x3d65e4['sendStatus'](0xcc);}})[_0x8729('0x3d')](handleError(_0x3d65e4,null));}; \ No newline at end of file +var _0x0f59=['map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','filter','merge','where','VIRTUAL','JscriptyProject','findAll','rows','catch','show','params','includeAll','include','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','hasOwnProperty','sort','pick','getAnswers','JscriptyAnswerReport','number','toString','indexOf','getSummary','startTime','starttime','parse','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','sendStatus','html-pdf','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','Projects','UserProfileResource','error','stack','name','index'];(function(_0x51b0c8,_0x3cbf0d){var _0x50908c=function(_0x33a4df){while(--_0x33a4df){_0x51b0c8['push'](_0x51b0c8['shift']());}};_0x50908c(++_0x3cbf0d);}(_0x0f59,0x131));var _0x90f5=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x0f59[_0x95411e];return _0x2c8718;};'use strict';var pdf=require(_0x90f5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x90f5('0x1'));var zipdir=require(_0x90f5('0x2'));var jsonpatch=require(_0x90f5('0x3'));var rp=require(_0x90f5('0x4'));var moment=require(_0x90f5('0x5'));var BPromise=require(_0x90f5('0x6'));var Mustache=require(_0x90f5('0x7'));var util=require(_0x90f5('0x8'));var path=require(_0x90f5('0x9'));var sox=require(_0x90f5('0xa'));var csv=require(_0x90f5('0xb'));var ejs=require(_0x90f5('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x90f5('0xd'));var crypto=require('crypto');var jsforce=require(_0x90f5('0xe'));var deskjs=require(_0x90f5('0xf'));var toCsv=require(_0x90f5('0xb'));var querystring=require(_0x90f5('0x10'));var Papa=require(_0x90f5('0x11'));var Redis=require(_0x90f5('0x12'));var authService=require(_0x90f5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90f5('0x14'));var logger=require(_0x90f5('0x15'))('api');var utils=require(_0x90f5('0x16'));var config=require(_0x90f5('0x17'));var db=require(_0x90f5('0x18'))['db'];function respondWithStatusCode(_0x4e46f4,_0x202aaf){_0x202aaf=_0x202aaf||0xcc;return function(_0x5588c2){if(_0x5588c2){return _0x4e46f4['sendStatus'](_0x202aaf);}return _0x4e46f4[_0x90f5('0x19')](_0x202aaf)[_0x90f5('0x1a')]();};}function respondWithResult(_0x6271a0,_0x180984){_0x180984=_0x180984||0xc8;return function(_0x1756d7){if(_0x1756d7){return _0x6271a0[_0x90f5('0x19')](_0x180984)[_0x90f5('0x1b')](_0x1756d7);}};}function respondWithFilteredResult(_0x3e459c,_0x552516){return function(_0x285d48){if(_0x285d48){var _0x36f7a0=_0x285d48[_0x90f5('0x1c')],_0x1ad3ce=_0x552516[_0x90f5('0x1d')],_0x103b72=_0x552516[_0x90f5('0x1d')]+_0x552516[_0x90f5('0x1e')],_0x5957e9;if(_0x103b72>=_0x36f7a0){_0x103b72=_0x36f7a0;_0x5957e9=0xc8;}else{_0x5957e9=0xce;}_0x3e459c[_0x90f5('0x19')](_0x5957e9);return _0x3e459c['set'](_0x90f5('0x1f'),_0x1ad3ce+'-'+_0x103b72+'/'+_0x36f7a0)[_0x90f5('0x1b')](_0x285d48);}return null;};}function patchUpdates(_0xbe3cdb){return function(_0x282359){try{jsonpatch[_0x90f5('0x20')](_0x282359,_0xbe3cdb,!![]);}catch(_0x1ac4dd){return BPromise[_0x90f5('0x21')](_0x1ac4dd);}return _0x282359['save']();};}function saveUpdates(_0x11d30f,_0x178e3a){return function(_0x32dc01){if(_0x32dc01){return _0x32dc01[_0x90f5('0x22')](_0x11d30f)[_0x90f5('0x23')](function(_0x1cb935){return _0x1cb935;});}return null;};}function removeEntity(_0x5cbabb,_0x42ed59){return function(_0x5e0165){if(_0x5e0165){return _0x5e0165[_0x90f5('0x24')]()[_0x90f5('0x23')](function(){var _0x570494=_0x5e0165['get']({'plain':!![]});var _0x3fa336=_0x90f5('0x25');return db[_0x90f5('0x26')][_0x90f5('0x24')]({'where':{'type':_0x3fa336,'resourceId':_0x570494['id']}})[_0x90f5('0x23')](function(){return _0x5e0165;});})[_0x90f5('0x23')](function(){_0x5cbabb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x307816,_0x169ffb){return function(_0x36bd0e){if(!_0x36bd0e){_0x307816['sendStatus'](0x194);}return _0x36bd0e;};}function handleError(_0x583b7f,_0x7dab61){_0x7dab61=_0x7dab61||0x1f4;return function(_0x546430){logger[_0x90f5('0x27')](_0x546430[_0x90f5('0x28')]);if(_0x546430[_0x90f5('0x29')]){delete _0x546430[_0x90f5('0x29')];}_0x583b7f[_0x90f5('0x19')](_0x7dab61)['send'](_0x546430);};}exports[_0x90f5('0x2a')]=function(_0x452e4a,_0x13c9b1){var _0x335496={},_0x957dc3={},_0x3b6ca8={'count':0x0,'rows':[]};var _0xb7497b=_[_0x90f5('0x2b')](db['JscriptyProject'][_0x90f5('0x2c')],function(_0x48b45b){return{'name':_0x48b45b[_0x90f5('0x2d')],'type':_0x48b45b[_0x90f5('0x2e')][_0x90f5('0x2f')]};});_0x957dc3['model']=_['map'](_0xb7497b,_0x90f5('0x29'));_0x957dc3['query']=_[_0x90f5('0x30')](_0x452e4a[_0x90f5('0x31')]);_0x957dc3[_0x90f5('0x32')]=_[_0x90f5('0x33')](_0x957dc3[_0x90f5('0x34')],_0x957dc3['query']);_0x335496[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x957dc3[_0x90f5('0x34')],qs[_0x90f5('0x36')](_0x452e4a[_0x90f5('0x31')][_0x90f5('0x36')]));_0x335496[_0x90f5('0x35')]=_0x335496[_0x90f5('0x35')][_0x90f5('0x37')]?_0x335496[_0x90f5('0x35')]:_0x957dc3['model'];if(!_0x452e4a[_0x90f5('0x31')]['hasOwnProperty'](_0x90f5('0x38'))){_0x335496[_0x90f5('0x1e')]=qs[_0x90f5('0x1e')](_0x452e4a[_0x90f5('0x31')][_0x90f5('0x1e')]);_0x335496[_0x90f5('0x1d')]=qs[_0x90f5('0x1d')](_0x452e4a[_0x90f5('0x31')]['offset']);}_0x335496[_0x90f5('0x39')]=qs['sort'](_0x452e4a[_0x90f5('0x31')]['sort']);_0x335496['where']=qs['filters'](_['pick'](_0x452e4a['query'],_0x957dc3[_0x90f5('0x32')]));if(_0x452e4a['query'][_0x90f5('0x3a')]){_0x335496['where']=_[_0x90f5('0x3b')](_0x335496[_0x90f5('0x3c')],{'$or':_['map'](_0xb7497b,function(_0x4e9c32){if(_0x4e9c32[_0x90f5('0x2e')]!==_0x90f5('0x3d')){var _0x298380={};_0x298380[_0x4e9c32[_0x90f5('0x29')]]={'$like':'%'+_0x452e4a['query'][_0x90f5('0x3a')]+'%'};return _0x298380;}})});}_0x335496=_[_0x90f5('0x3b')]({},_0x335496,_0x452e4a['options']);var _0x138aff={'where':_0x335496[_0x90f5('0x3c')]};return db[_0x90f5('0x3e')][_0x90f5('0x1c')](_0x138aff)[_0x90f5('0x23')](function(_0x2226a6){_0x3b6ca8['count']=_0x2226a6;if(_0x452e4a[_0x90f5('0x31')]['includeAll']){_0x335496['include']=[{'all':!![]}];}return db[_0x90f5('0x3e')][_0x90f5('0x3f')](_0x335496);})[_0x90f5('0x23')](function(_0x521f24){_0x3b6ca8[_0x90f5('0x40')]=_0x521f24;return _0x3b6ca8;})[_0x90f5('0x23')](respondWithFilteredResult(_0x13c9b1,_0x335496))[_0x90f5('0x41')](handleError(_0x13c9b1,null));};exports[_0x90f5('0x42')]=function(_0x5325d0,_0x38dffb){var _0x1b6032={'raw':![],'where':{'id':_0x5325d0[_0x90f5('0x43')]['id']}},_0x413d40={};_0x413d40[_0x90f5('0x34')]=_[_0x90f5('0x30')](db[_0x90f5('0x3e')][_0x90f5('0x2c')]);_0x413d40[_0x90f5('0x31')]=_[_0x90f5('0x30')](_0x5325d0[_0x90f5('0x31')]);_0x413d40['filters']=_['intersection'](_0x413d40['model'],_0x413d40[_0x90f5('0x31')]);_0x1b6032[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x413d40[_0x90f5('0x34')],qs[_0x90f5('0x36')](_0x5325d0[_0x90f5('0x31')][_0x90f5('0x36')]));_0x1b6032[_0x90f5('0x35')]=_0x1b6032[_0x90f5('0x35')]['length']?_0x1b6032[_0x90f5('0x35')]:_0x413d40[_0x90f5('0x34')];if(_0x5325d0[_0x90f5('0x31')][_0x90f5('0x44')]){_0x1b6032[_0x90f5('0x45')]=[{'all':!![]}];}_0x1b6032=_['merge']({},_0x1b6032,_0x5325d0[_0x90f5('0x46')]);return db[_0x90f5('0x3e')]['find'](_0x1b6032)[_0x90f5('0x23')](handleEntityNotFound(_0x38dffb,null))[_0x90f5('0x23')](respondWithResult(_0x38dffb,null))[_0x90f5('0x41')](handleError(_0x38dffb,null));};exports[_0x90f5('0x47')]=function(_0x72099f,_0x299533){return db[_0x90f5('0x3e')][_0x90f5('0x47')](_0x72099f[_0x90f5('0x48')],{})[_0x90f5('0x23')](function(_0x5417e9){var _0x1e3362=_0x72099f[_0x90f5('0x49')][_0x90f5('0x4a')]({'plain':!![]});if(!_0x1e3362)throw new Error(_0x90f5('0x4b'));if(_0x1e3362[_0x90f5('0x4c')]===_0x90f5('0x49')){var _0x11f71e=_0x5417e9[_0x90f5('0x4a')]({'plain':!![]});var _0x142a62='Projects';return db[_0x90f5('0x4d')][_0x90f5('0x4e')]({'where':{'name':_0x142a62,'userProfileId':_0x1e3362[_0x90f5('0x4f')]},'raw':!![]})[_0x90f5('0x23')](function(_0x29daa3){if(_0x29daa3&&_0x29daa3[_0x90f5('0x50')]===0x0){return db[_0x90f5('0x26')][_0x90f5('0x47')]({'name':_0x11f71e[_0x90f5('0x29')],'resourceId':_0x11f71e['id'],'type':_0x29daa3[_0x90f5('0x29')],'sectionId':_0x29daa3['id']},{})['then'](function(){return _0x5417e9;});}else{return _0x5417e9;}})['catch'](function(_0xe4ddc9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe4ddc9);throw _0xe4ddc9;});}return _0x5417e9;})[_0x90f5('0x23')](respondWithResult(_0x299533,0xc9))['catch'](handleError(_0x299533,null));};exports[_0x90f5('0x51')]=function(_0x2d1484,_0x82fe1d){var _0x39fa3c={'where':{'id':_0x2d1484[_0x90f5('0x43')]['id']}},_0x15f38b={};_0x15f38b[_0x90f5('0x34')]=_[_0x90f5('0x30')](db[_0x90f5('0x3e')][_0x90f5('0x2c')]);_0x39fa3c[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x15f38b[_0x90f5('0x34')],qs[_0x90f5('0x36')](_0x2d1484[_0x90f5('0x31')][_0x90f5('0x36')]));_0x39fa3c['attributes']=_0x39fa3c['attributes'][_0x90f5('0x37')]?_0x39fa3c['attributes']:_0x15f38b['model'];if(_0x2d1484[_0x90f5('0x31')][_0x90f5('0x44')]){_0x39fa3c[_0x90f5('0x45')]=[{'all':!![]}];}_0x39fa3c=_[_0x90f5('0x3b')]({},_0x39fa3c,_0x2d1484[_0x90f5('0x46')]);return db[_0x90f5('0x3e')]['find'](_0x39fa3c)[_0x90f5('0x23')](handleEntityNotFound(_0x82fe1d,null))[_0x90f5('0x23')](function(_0x35d2e0){if(_0x35d2e0){var _0x49f95c=_0x35d2e0['get']({'plain':!![]});_0x49f95c=qs[_0x90f5('0x52')](_0x49f95c,['id',_0x90f5('0x53'),_0x90f5('0x54')]);_0x2d1484[_0x90f5('0x48')]=_[_0x90f5('0x52')](_0x2d1484['body'],['id',_0x90f5('0x53'),_0x90f5('0x54')]);return db[_0x90f5('0x3e')][_0x90f5('0x47')](_[_0x90f5('0x3b')](_0x49f95c,_0x2d1484[_0x90f5('0x48')]),{'include':_0x2d1484[_0x90f5('0x31')][_0x90f5('0x44')]?[{'all':!![]}]:undefined})[_0x90f5('0x23')](function(_0x644df5){var _0x503d8d=_0x2d1484[_0x90f5('0x49')]['get']({'plain':!![]});if(!_0x503d8d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x503d8d[_0x90f5('0x4c')]==='user'){var _0x531d93=_0x644df5[_0x90f5('0x4a')]({'plain':!![]});var _0x2f2fff=_0x90f5('0x25');return db['UserProfileSection'][_0x90f5('0x4e')]({'where':{'name':_0x2f2fff,'userProfileId':_0x503d8d[_0x90f5('0x4f')]},'raw':!![]})[_0x90f5('0x23')](function(_0x35786a){if(_0x35786a&&_0x35786a['autoAssociation']===0x0){return db['UserProfileResource'][_0x90f5('0x47')]({'name':_0x531d93['name'],'resourceId':_0x531d93['id'],'type':_0x35786a[_0x90f5('0x29')],'sectionId':_0x35786a['id']},{})[_0x90f5('0x23')](function(){return _0x644df5;});}else{return _0x644df5;}})[_0x90f5('0x41')](function(_0x1729b4){logger[_0x90f5('0x27')](_0x90f5('0x55'),_0x1729b4);throw _0x1729b4;});}return _0x644df5;});}})[_0x90f5('0x23')](respondWithResult(_0x82fe1d,0xc9))[_0x90f5('0x41')](handleError(_0x82fe1d,null));};exports['update']=function(_0x1fa0a4,_0x3a3ef9){if(_0x1fa0a4[_0x90f5('0x48')]['id']){delete _0x1fa0a4[_0x90f5('0x48')]['id'];}return db['JscriptyProject'][_0x90f5('0x4e')]({'where':{'id':_0x1fa0a4[_0x90f5('0x43')]['id']}})[_0x90f5('0x23')](handleEntityNotFound(_0x3a3ef9,null))[_0x90f5('0x23')](saveUpdates(_0x1fa0a4['body'],null))[_0x90f5('0x23')](respondWithResult(_0x3a3ef9,null))[_0x90f5('0x41')](handleError(_0x3a3ef9,null));};exports['destroy']=function(_0x1ef9f2,_0x230088){return db[_0x90f5('0x3e')][_0x90f5('0x4e')]({'where':{'id':_0x1ef9f2['params']['id']}})['then'](handleEntityNotFound(_0x230088,null))['then'](removeEntity(_0x230088,null))['catch'](handleError(_0x230088,null));};exports[_0x90f5('0x56')]=function(_0x299304,_0x6c47ea,_0x3ac859){var _0x11fb76={'raw':!![],'where':{}};var _0x1b7176={};var _0x37d906={'count':0x0,'rows':[]};return db[_0x90f5('0x3e')][_0x90f5('0x57')]({'where':{'id':_0x299304[_0x90f5('0x43')]['id']}})[_0x90f5('0x23')](handleEntityNotFound(_0x6c47ea,null))[_0x90f5('0x23')](function(_0x40589a){if(_0x40589a){_0x1b7176['model']=_[_0x90f5('0x30')](db[_0x90f5('0x58')][_0x90f5('0x2c')]);_0x1b7176[_0x90f5('0x31')]=_[_0x90f5('0x30')](_0x299304['query']);_0x1b7176[_0x90f5('0x32')]=_['intersection'](_0x1b7176[_0x90f5('0x34')],_0x1b7176['query']);_0x11fb76[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x1b7176['model'],qs[_0x90f5('0x36')](_0x299304[_0x90f5('0x31')][_0x90f5('0x36')]));_0x11fb76['attributes']=_0x11fb76[_0x90f5('0x35')]['length']?_0x11fb76[_0x90f5('0x35')]:_0x1b7176[_0x90f5('0x34')];if(!_0x299304[_0x90f5('0x31')][_0x90f5('0x59')](_0x90f5('0x38'))){_0x11fb76[_0x90f5('0x1e')]=qs['limit'](_0x299304[_0x90f5('0x31')]['limit']);_0x11fb76['offset']=qs[_0x90f5('0x1d')](_0x299304[_0x90f5('0x31')][_0x90f5('0x1d')]);}_0x11fb76[_0x90f5('0x39')]=qs[_0x90f5('0x5a')](_0x299304[_0x90f5('0x31')][_0x90f5('0x5a')]);_0x11fb76['where']=qs[_0x90f5('0x32')](_[_0x90f5('0x5b')](_0x299304[_0x90f5('0x31')],_0x1b7176[_0x90f5('0x32')]));_0x11fb76['where']['ProjectId']=_0x40589a['id'];if(_0x299304[_0x90f5('0x31')][_0x90f5('0x3a')]){_0x11fb76[_0x90f5('0x3c')]=_[_0x90f5('0x3b')](_0x11fb76['where'],{'$or':_['map'](_0x11fb76[_0x90f5('0x35')],function(_0x9714c4){var _0x260afd={};_0x260afd[_0x9714c4]={'$like':'%'+_0x299304[_0x90f5('0x31')][_0x90f5('0x3a')]+'%'};return _0x260afd;})});}_0x11fb76=_[_0x90f5('0x3b')]({},_0x11fb76,_0x299304['options']);return db['JscriptySessionReport'][_0x90f5('0x1c')]({'where':_0x11fb76[_0x90f5('0x3c')]})[_0x90f5('0x23')](function(_0x4b04a1){_0x37d906['count']=_0x4b04a1;if(_0x299304[_0x90f5('0x31')]['includeAll']){_0x11fb76[_0x90f5('0x45')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x90f5('0x3f')](_0x11fb76);})[_0x90f5('0x23')](function(_0x597bb9){_0x37d906[_0x90f5('0x40')]=_0x597bb9;return _0x37d906;});}})[_0x90f5('0x23')](respondWithFilteredResult(_0x6c47ea,_0x11fb76))[_0x90f5('0x41')](handleError(_0x6c47ea,null));};exports[_0x90f5('0x5c')]=function(_0x5b0fef,_0x16b966,_0x5d72f3){var _0x12e37c={'raw':!![],'where':{}};var _0x2d00be={};var _0x2f1119={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x90f5('0x57')]({'where':{'id':_0x5b0fef[_0x90f5('0x43')]['id']}})[_0x90f5('0x23')](handleEntityNotFound(_0x16b966,null))[_0x90f5('0x23')](function(_0x2a1492){if(_0x2a1492){_0x2d00be[_0x90f5('0x34')]=_[_0x90f5('0x30')](db['JscriptyAnswerReport'][_0x90f5('0x2c')]);_0x2d00be[_0x90f5('0x31')]=_[_0x90f5('0x30')](_0x5b0fef['query']);_0x2d00be[_0x90f5('0x32')]=_[_0x90f5('0x33')](_0x2d00be[_0x90f5('0x34')],_0x2d00be[_0x90f5('0x31')]);_0x12e37c[_0x90f5('0x35')]=_[_0x90f5('0x33')](_0x2d00be[_0x90f5('0x34')],qs[_0x90f5('0x36')](_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x36')]));_0x12e37c['attributes']=_0x12e37c[_0x90f5('0x35')][_0x90f5('0x37')]?_0x12e37c[_0x90f5('0x35')]:_0x2d00be[_0x90f5('0x34')];if(!_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x59')](_0x90f5('0x38'))){_0x12e37c[_0x90f5('0x1e')]=qs[_0x90f5('0x1e')](_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x1e')]);_0x12e37c[_0x90f5('0x1d')]=qs[_0x90f5('0x1d')](_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x1d')]);}_0x12e37c[_0x90f5('0x39')]=qs[_0x90f5('0x5a')](_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x5a')]);_0x12e37c[_0x90f5('0x3c')]=qs[_0x90f5('0x32')](_[_0x90f5('0x5b')](_0x5b0fef[_0x90f5('0x31')],_0x2d00be['filters']));_0x12e37c[_0x90f5('0x3c')]['ProjectId']=_0x2a1492['id'];if(_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x3a')]){_0x12e37c['where']=_[_0x90f5('0x3b')](_0x12e37c[_0x90f5('0x3c')],{'$or':_[_0x90f5('0x2b')](_0x12e37c['attributes'],function(_0x3ea600){var _0x5a6017={};_0x5a6017[_0x3ea600]={'$like':'%'+_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x3a')]+'%'};return _0x5a6017;})});}_0x12e37c=_[_0x90f5('0x3b')]({},_0x12e37c,_0x5b0fef[_0x90f5('0x46')]);return db[_0x90f5('0x5d')]['count']({'where':_0x12e37c['where']})[_0x90f5('0x23')](function(_0x260037){_0x2f1119[_0x90f5('0x1c')]=_0x260037;if(_0x5b0fef[_0x90f5('0x31')][_0x90f5('0x44')]){_0x12e37c[_0x90f5('0x45')]=[{'all':!![]}];}return db[_0x90f5('0x5d')][_0x90f5('0x3f')](_0x12e37c);})[_0x90f5('0x23')](function(_0x20184d){_0x2f1119[_0x90f5('0x40')]=_0x20184d;return _0x2f1119;});}})[_0x90f5('0x23')](respondWithFilteredResult(_0x16b966,_0x12e37c))[_0x90f5('0x41')](handleError(_0x16b966,null));};function char(_0x2d49b9){return _0x90f5('0x5e')===typeof _0x2d49b9?String['fromCharCode'][_0x90f5('0x20')](null,arguments):_0x2d49b9;}function needsEncapsulation(_0x19f633){return!!_0x19f633&&(_0x19f633[_0x90f5('0x5f')]()[_0x90f5('0x60')](char(0xd))>=0x0||_0x19f633['toString']()[_0x90f5('0x60')](char(0xa))>=0x0||_0x19f633[_0x90f5('0x5f')]()[_0x90f5('0x60')](char(0x2c))>=0x0||_0x19f633['toString']()[_0x90f5('0x60')](char(0x22))>=0x0);}function encapsulate(_0x34497e){var _0x24c9d8=char(0x22),_0x3dd947='\x5c'+char(0x22),_0x14c2f3=_0x34497e[_0x90f5('0x5f')]()['replace'](new RegExp(_0x24c9d8,'g'),_0x3dd947);return _0x24c9d8+_0x14c2f3+_0x24c9d8;}exports[_0x90f5('0x61')]=function(_0x5c47c5,_0x6eeea4,_0x3df13f){var _0x12a4e,_0x1ee8ee;var _0x1a6659={'where':{'ProjectId':_0x5c47c5[_0x90f5('0x43')]['id']}};if(_0x5c47c5[_0x90f5('0x31')][_0x90f5('0x62')]){_0x1a6659[_0x90f5('0x3c')][_0x90f5('0x63')]=JSON[_0x90f5('0x64')](_0x5c47c5[_0x90f5('0x31')][_0x90f5('0x62')]);}return db[_0x90f5('0x58')][_0x90f5('0x3f')](_0x1a6659)[_0x90f5('0x23')](handleEntityNotFound(_0x6eeea4,null))[_0x90f5('0x23')](function(_0x1f1721){if(_0x1f1721){_0x12a4e=_0x1f1721;return db['JscriptyQuestionReport'][_0x90f5('0x3f')]({'where':{'SessionId':{'$in':_['map'](_0x12a4e,'id')},'ProjectId':_0x5c47c5['params']['id']},'order':'-createdAt'});}})[_0x90f5('0x23')](handleEntityNotFound(_0x6eeea4,null))[_0x90f5('0x23')](function(_0xd87b66){if(_0xd87b66){_0x1ee8ee=_0xd87b66;var _0x4d95ac={};for(var _0x1bd2ae=0x0,_0x54f43b=_0x1ee8ee['length'];_0x1bd2ae<_0x54f43b;_0x1bd2ae++){if(!_0x4d95ac[_0x90f5('0x59')](_0x1ee8ee[_0x1bd2ae][_0x90f5('0x65')])){_0x4d95ac[_0x1ee8ee[_0x1bd2ae]['questionId']]=needsEncapsulation(_0x1ee8ee[_0x1bd2ae][_0x90f5('0x66')])?encapsulate(_0x1ee8ee[_0x1bd2ae][_0x90f5('0x66')]):_0x1ee8ee[_0x1bd2ae][_0x90f5('0x66')];}}var _0x23bfbc=[],_0x125bb7={};for(var _0x4b4331=0x0,_0x2fd380=_0x12a4e[_0x90f5('0x37')];_0x4b4331<_0x2fd380;_0x4b4331++){_0x125bb7={'ProjectId':_0x5c47c5[_0x90f5('0x43')]['id'],'SessionId':_0x12a4e[_0x4b4331]['id'],'StartTime':moment(_0x12a4e[_0x4b4331][_0x90f5('0x63')])[_0x90f5('0x67')](_0x90f5('0x68'))};for(var _0x3f554e=0x0,_0x5eb593=_0x1ee8ee[_0x90f5('0x37')];_0x3f554e<_0x5eb593;_0x3f554e++){if(_0x1ee8ee[_0x3f554e]['SessionId']==_0x12a4e[_0x4b4331]['id']&&_0x4d95ac[_0x90f5('0x59')](_0x1ee8ee[_0x3f554e][_0x90f5('0x65')])){_0x125bb7[_0x4d95ac[_0x1ee8ee[_0x3f554e][_0x90f5('0x65')]]]=_0x1ee8ee[_0x3f554e]['answer'];}}for(var _0x22af19 in _0x4d95ac){if(!_0x125bb7[_0x90f5('0x59')](_0x4d95ac[_0x22af19])){_0x125bb7[_0x4d95ac[_0x22af19]]=null;}}_0x23bfbc[_0x90f5('0x69')](_0x125bb7);}return _0x23bfbc;}})[_0x90f5('0x23')](function(_0x23a048){if(!_[_0x90f5('0x6a')](_0x23a048)){var _0x28c4cd=toCsv(_0x23a048);var _0x5b1c66=Date[_0x90f5('0x6b')]();fs['writeFileSync'](util[_0x90f5('0x67')](_0x90f5('0x6c'),_0x5c47c5['params']['id'],_0x5b1c66),_0x28c4cd);_0x6eeea4[_0x90f5('0x6d')](_0x90f5('0x6e'),'attachment;\x20filename='+util['format'](_0x90f5('0x6f'),_0x5c47c5[_0x90f5('0x43')]['id'],_0x5b1c66));_0x6eeea4['setHeader'](_0x90f5('0x70'),_0x90f5('0x71'));return _0x6eeea4[_0x90f5('0x72')](util[_0x90f5('0x67')](_0x90f5('0x6c'),_0x5c47c5['params']['id'],_0x5b1c66));}else{return _0x6eeea4[_0x90f5('0x73')](0xcc);}})[_0x90f5('0x41')](handleError(_0x6eeea4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 83c06a2..f6f5f92 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 _0xd166=['request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x44d5a4,_0x2e1506){var _0x285ba9=function(_0x57ec11){while(--_0x57ec11){_0x44d5a4['push'](_0x44d5a4['shift']());}};_0x285ba9(++_0x2e1506);}(_0xd166,0xf6));var _0x6d16=function(_0x2a1080,_0x4587c9){_0x2a1080=_0x2a1080-0x0;var _0x3a939a=_0xd166[_0x2a1080];return _0x3a939a;};'use strict';var _=require(_0x6d16('0x0'));var util=require(_0x6d16('0x1'));var logger=require(_0x6d16('0x2'))(_0x6d16('0x3'));var moment=require(_0x6d16('0x4'));var BPromise=require(_0x6d16('0x5'));var rp=require(_0x6d16('0x6'));var fs=require('fs');var path=require(_0x6d16('0x7'));var rimraf=require(_0x6d16('0x8'));var config=require(_0x6d16('0x9'));var attributes=require(_0x6d16('0xa'));module[_0x6d16('0xb')]=function(_0x4280e1,_0x2b3e31){return _0x4280e1['define'](_0x6d16('0xc'),attributes,{'tableName':_0x6d16('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc81a=['exports','define','JscriptyProject','lodash','util','../../config/logger','moment','request-promise','path','./jscriptyProject.attributes'];(function(_0x4d7f64,_0x53bf11){var _0x408104=function(_0x5b2041){while(--_0x5b2041){_0x4d7f64['push'](_0x4d7f64['shift']());}};_0x408104(++_0x53bf11);}(_0xc81a,0x16b));var _0xac81=function(_0x453b59,_0x317051){_0x453b59=_0x453b59-0x0;var _0x1407a8=_0xc81a[_0x453b59];return _0x1407a8;};'use strict';var _=require(_0xac81('0x0'));var util=require(_0xac81('0x1'));var logger=require(_0xac81('0x2'))('api');var moment=require(_0xac81('0x3'));var BPromise=require('bluebird');var rp=require(_0xac81('0x4'));var fs=require('fs');var path=require(_0xac81('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xac81('0x6'));module[_0xac81('0x7')]=function(_0x228469,_0x21bb17){return _0x228469[_0xac81('0x8')](_0xac81('0x9'),attributes,{'tableName':'jscripty_projects','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 b342aef..1cfaef1 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 _0x3b52=['result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3b52,0x1cf));var _0x23b5=function(_0x22a88c,_0x32e902){_0x22a88c=_0x22a88c-0x0;var _0x16beac=_0x3b52[_0x22a88c];return _0x16beac;};'use strict';var _=require(_0x23b5('0x0'));var util=require('util');var moment=require(_0x23b5('0x1'));var BPromise=require(_0x23b5('0x2'));var rs=require(_0x23b5('0x3'));var fs=require('fs');var Redis=require(_0x23b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x23b5('0x5'));var logger=require('../../config/logger')(_0x23b5('0x6'));var config=require(_0x23b5('0x7'));var jayson=require(_0x23b5('0x8'));var client=jayson['client'][_0x23b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3950ca,_0x4b45bc,_0x64f578){return new BPromise(function(_0x31a36a,_0x4b1844){return client[_0x23b5('0xa')](_0x3950ca,_0x64f578)[_0x23b5('0xb')](function(_0x24a6cc){logger[_0x23b5('0xc')](_0x23b5('0xd'),_0x4b45bc,_0x23b5('0xe'));logger[_0x23b5('0xf')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x4b45bc,_0x23b5('0xe'),JSON[_0x23b5('0x10')](_0x24a6cc));if(_0x24a6cc[_0x23b5('0x11')]){if(_0x24a6cc[_0x23b5('0x11')][_0x23b5('0x12')]===0x1f4){logger[_0x23b5('0x11')](_0x23b5('0xd'),_0x4b45bc,_0x24a6cc['error'][_0x23b5('0x13')]);return _0x4b1844(_0x24a6cc['error']['message']);}logger[_0x23b5('0x11')]('JscriptyProject,\x20%s,\x20%s',_0x4b45bc,_0x24a6cc['error'][_0x23b5('0x13')]);return _0x31a36a(_0x24a6cc['error'][_0x23b5('0x13')]);}else{logger[_0x23b5('0xc')](_0x23b5('0xd'),_0x4b45bc,_0x23b5('0xe'));_0x31a36a(_0x24a6cc[_0x23b5('0x14')][_0x23b5('0x13')]);}})['catch'](function(_0x26badd){logger[_0x23b5('0x11')]('JscriptyProject,\x20%s,\x20%s',_0x4b45bc,_0x26badd);_0x4b1844(_0x26badd);});});} \ No newline at end of file +var _0xd629=['request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x950bab,_0x16680b){var _0x54414c=function(_0x4ab089){while(--_0x4ab089){_0x950bab['push'](_0x950bab['shift']());}};_0x54414c(++_0x16680b);}(_0xd629,0x1d9));var _0x9d62=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd629[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x9d62('0x0'));var util=require(_0x9d62('0x1'));var moment=require(_0x9d62('0x2'));var BPromise=require(_0x9d62('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9d62('0x4'))['db'];var utils=require(_0x9d62('0x5'));var logger=require(_0x9d62('0x6'))('rpc');var config=require(_0x9d62('0x7'));var jayson=require(_0x9d62('0x8'));var client=jayson['client'][_0x9d62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c2f36,_0x548443,_0x585b22){return new BPromise(function(_0x3fe60b,_0x46be63){return client[_0x9d62('0xa')](_0x1c2f36,_0x585b22)[_0x9d62('0xb')](function(_0x26df29){logger[_0x9d62('0xc')](_0x9d62('0xd'),_0x548443,_0x9d62('0xe'));logger['debug'](_0x9d62('0xf'),_0x548443,_0x9d62('0xe'),JSON['stringify'](_0x26df29));if(_0x26df29['error']){if(_0x26df29[_0x9d62('0x10')][_0x9d62('0x11')]===0x1f4){logger['error'](_0x9d62('0xd'),_0x548443,_0x26df29['error'][_0x9d62('0x12')]);return _0x46be63(_0x26df29[_0x9d62('0x10')][_0x9d62('0x12')]);}logger[_0x9d62('0x10')](_0x9d62('0xd'),_0x548443,_0x26df29[_0x9d62('0x10')][_0x9d62('0x12')]);return _0x3fe60b(_0x26df29[_0x9d62('0x10')]['message']);}else{logger[_0x9d62('0xc')](_0x9d62('0xd'),_0x548443,_0x9d62('0xe'));_0x3fe60b(_0x26df29[_0x9d62('0x13')][_0x9d62('0x12')]);}})[_0x9d62('0x14')](function(_0x2d0820){logger['error'](_0x9d62('0xd'),_0x548443,_0x2d0820);_0x46be63(_0x2d0820);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 04e0af9..bd03da5 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 _0x53a0=['create','put','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0x53a0,0x1d8));var _0x053a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x53a0[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x053a('0x0'));var util=require(_0x053a('0x1'));var path=require('path');var timeout=require(_0x053a('0x2'));var express=require(_0x053a('0x3'));var router=express['Router']();var auth=require(_0x053a('0x4'));var interaction=require(_0x053a('0x5'));var config=require('../../config/environment');var controller=require(_0x053a('0x6'));router[_0x053a('0x7')]('/',auth[_0x053a('0x8')](),controller['index']);router[_0x053a('0x7')](_0x053a('0x9'),auth[_0x053a('0x8')](),controller[_0x053a('0xa')]);router['get'](_0x053a('0xb'),auth[_0x053a('0x8')](),controller[_0x053a('0xc')]);router[_0x053a('0xd')]('/',auth[_0x053a('0x8')](),controller[_0x053a('0xe')]);router[_0x053a('0xf')](_0x053a('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x053a('0x10')](_0x053a('0xb'),auth[_0x053a('0x8')](),controller[_0x053a('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0826=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0826,0x1a1));var _0x6082=function(_0x5a17b1,_0x1aa5ca){_0x5a17b1=_0x5a17b1-0x0;var _0x555f48=_0x0826[_0x5a17b1];return _0x555f48;};'use strict';var multer=require(_0x6082('0x0'));var util=require(_0x6082('0x1'));var path=require(_0x6082('0x2'));var timeout=require(_0x6082('0x3'));var express=require(_0x6082('0x4'));var router=express[_0x6082('0x5')]();var auth=require(_0x6082('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6082('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0x6082('0x8')]('/',auth[_0x6082('0x9')](),controller['index']);router[_0x6082('0x8')](_0x6082('0xa'),auth[_0x6082('0x9')](),controller[_0x6082('0xb')]);router[_0x6082('0x8')](_0x6082('0xc'),auth[_0x6082('0x9')](),controller[_0x6082('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6082('0xe')]);router['put'](_0x6082('0xc'),auth[_0x6082('0x9')](),controller[_0x6082('0xf')]);router['delete'](_0x6082('0xc'),auth['isAuthenticated'](),controller[_0x6082('0x10')]);module[_0x6082('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 40180c0..7010340 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 _0x66e3=['sequelize','STRING','TEXT','long'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x66e3,0xf0));var _0x366e=function(_0x48357b,_0x320618){_0x48357b=_0x48357b-0x0;var _0x29f49c=_0x66e3[_0x48357b];return _0x29f49c;};'use strict';var Sequelize=require(_0x366e('0x0'));module['exports']={'question':{'type':Sequelize[_0x366e('0x1')]},'answer':{'type':Sequelize[_0x366e('0x2')](_0x366e('0x3'))},'membername':{'type':Sequelize[_0x366e('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x366e('0x1')]},'uniqueid':{'type':Sequelize[_0x366e('0x1')]},'calleridname':{'type':Sequelize[_0x366e('0x1')]},'calleridnum':{'type':Sequelize[_0x366e('0x1')]},'questionId':{'type':Sequelize[_0x366e('0x1')]}}; \ No newline at end of file +var _0xa0e5=['TEXT','long','exports','STRING'];(function(_0xd6ce50,_0xb01a32){var _0x58c2e7=function(_0x13f266){while(--_0x13f266){_0xd6ce50['push'](_0xd6ce50['shift']());}};_0x58c2e7(++_0xb01a32);}(_0xa0e5,0x1b6));var _0x5a0e=function(_0x2072b2,_0x2e2b37){_0x2072b2=_0x2072b2-0x0;var _0x5ab501=_0xa0e5[_0x2072b2];return _0x5ab501;};'use strict';var Sequelize=require('sequelize');module[_0x5a0e('0x0')]={'question':{'type':Sequelize[_0x5a0e('0x1')]},'answer':{'type':Sequelize[_0x5a0e('0x2')](_0x5a0e('0x3'))},'membername':{'type':Sequelize[_0x5a0e('0x1')]},'projectname':{'type':Sequelize[_0x5a0e('0x1')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x5a0e('0x1')]},'calleridname':{'type':Sequelize[_0x5a0e('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x5a0e('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index f471f1d..32cf14e 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 _0xf286=['attributes','fields','query','length','hasOwnProperty','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','html-pdf','eml-format','zip-dir','mustache','util','path','to-csv','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','key','keys','intersection','model'];(function(_0x55f1e4,_0x2a7b9e){var _0x195102=function(_0x236b80){while(--_0x236b80){_0x55f1e4['push'](_0x55f1e4['shift']());}};_0x195102(++_0x2a7b9e);}(_0xf286,0x1de));var _0x6f28=function(_0x256d6a,_0x2f002f){_0x256d6a=_0x256d6a-0x0;var _0x460058=_0xf286[_0x256d6a];return _0x460058;};'use strict';var pdf=require(_0x6f28('0x0'));var emlformat=require(_0x6f28('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6f28('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6f28('0x3'));var util=require(_0x6f28('0x4'));var path=require(_0x6f28('0x5'));var sox=require('sox');var csv=require(_0x6f28('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f28('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6f28('0x8'));var toCsv=require(_0x6f28('0x6'));var querystring=require(_0x6f28('0x9'));var Papa=require(_0x6f28('0xa'));var Redis=require('ioredis');var authService=require(_0x6f28('0xb'));var qs=require(_0x6f28('0xc'));var as=require(_0x6f28('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6f28('0xe'));var utils=require(_0x6f28('0xf'));var config=require(_0x6f28('0x10'));var db=require(_0x6f28('0x11'))['db'];function respondWithStatusCode(_0x47b90a,_0x46b3d2){_0x46b3d2=_0x46b3d2||0xcc;return function(_0x3381fb){if(_0x3381fb){return _0x47b90a[_0x6f28('0x12')](_0x46b3d2);}return _0x47b90a[_0x6f28('0x13')](_0x46b3d2)[_0x6f28('0x14')]();};}function respondWithResult(_0x1bd900,_0x19f716){_0x19f716=_0x19f716||0xc8;return function(_0x967a11){if(_0x967a11){return _0x1bd900[_0x6f28('0x13')](_0x19f716)[_0x6f28('0x15')](_0x967a11);}};}function respondWithFilteredResult(_0x166b50,_0x8c0972){return function(_0xcf9a08){if(_0xcf9a08){var _0x4b9a98=_0xcf9a08[_0x6f28('0x16')],_0x34a558=_0x8c0972[_0x6f28('0x17')],_0x2c8f78=_0x8c0972[_0x6f28('0x17')]+_0x8c0972[_0x6f28('0x18')],_0xc42f18;if(_0x2c8f78>=_0x4b9a98){_0x2c8f78=_0x4b9a98;_0xc42f18=0xc8;}else{_0xc42f18=0xce;}_0x166b50[_0x6f28('0x13')](_0xc42f18);return _0x166b50['set'](_0x6f28('0x19'),_0x34a558+'-'+_0x2c8f78+'/'+_0x4b9a98)[_0x6f28('0x15')](_0xcf9a08);}return null;};}function patchUpdates(_0x37ab78){return function(_0x3cdfc6){try{jsonpatch['apply'](_0x3cdfc6,_0x37ab78,!![]);}catch(_0xd44add){return BPromise[_0x6f28('0x1a')](_0xd44add);}return _0x3cdfc6[_0x6f28('0x1b')]();};}function saveUpdates(_0x8aa0e2,_0x5576ee){return function(_0x1c5b41){if(_0x1c5b41){return _0x1c5b41[_0x6f28('0x1c')](_0x8aa0e2)['then'](function(_0x372bdd){return _0x372bdd;});}return null;};}function removeEntity(_0x5f02aa,_0x303327){return function(_0x4fc4fd){if(_0x4fc4fd){return _0x4fc4fd[_0x6f28('0x1d')]()[_0x6f28('0x1e')](function(){_0x5f02aa['status'](0xcc)[_0x6f28('0x14')]();});}};}function handleEntityNotFound(_0x5560ff,_0x31f460){return function(_0x5cc3c2){if(!_0x5cc3c2){_0x5560ff[_0x6f28('0x12')](0x194);}return _0x5cc3c2;};}function handleError(_0x455183,_0x128542){_0x128542=_0x128542||0x1f4;return function(_0x416c27){logger[_0x6f28('0x1f')](_0x416c27[_0x6f28('0x20')]);if(_0x416c27['name']){delete _0x416c27[_0x6f28('0x21')];}_0x455183[_0x6f28('0x13')](_0x128542)['send'](_0x416c27);};}exports[_0x6f28('0x22')]=function(_0x3b0c05,_0x4943f8){var _0x2ed005={},_0x3e5988={},_0x48ab68={'count':0x0,'rows':[]};var _0x2bba7a=_[_0x6f28('0x23')](db[_0x6f28('0x24')][_0x6f28('0x25')],function(_0xc0ffb4){return{'name':_0xc0ffb4['fieldName'],'type':_0xc0ffb4['type'][_0x6f28('0x26')]};});_0x3e5988['model']=_[_0x6f28('0x23')](_0x2bba7a,'name');_0x3e5988['query']=_[_0x6f28('0x27')](_0x3b0c05['query']);_0x3e5988['filters']=_[_0x6f28('0x28')](_0x3e5988[_0x6f28('0x29')],_0x3e5988['query']);_0x2ed005[_0x6f28('0x2a')]=_[_0x6f28('0x28')](_0x3e5988[_0x6f28('0x29')],qs[_0x6f28('0x2b')](_0x3b0c05[_0x6f28('0x2c')][_0x6f28('0x2b')]));_0x2ed005[_0x6f28('0x2a')]=_0x2ed005['attributes'][_0x6f28('0x2d')]?_0x2ed005[_0x6f28('0x2a')]:_0x3e5988['model'];if(!_0x3b0c05[_0x6f28('0x2c')][_0x6f28('0x2e')]('nolimit')){_0x2ed005['limit']=qs[_0x6f28('0x18')](_0x3b0c05[_0x6f28('0x2c')][_0x6f28('0x18')]);_0x2ed005[_0x6f28('0x17')]=qs['offset'](_0x3b0c05[_0x6f28('0x2c')]['offset']);}_0x2ed005['order']=qs['sort'](_0x3b0c05[_0x6f28('0x2c')][_0x6f28('0x2f')]);_0x2ed005[_0x6f28('0x30')]=qs[_0x6f28('0x31')](_['pick'](_0x3b0c05[_0x6f28('0x2c')],_0x3e5988[_0x6f28('0x31')]));if(_0x3b0c05[_0x6f28('0x2c')][_0x6f28('0x32')]){_0x2ed005[_0x6f28('0x30')]=_[_0x6f28('0x33')](_0x2ed005[_0x6f28('0x30')],{'$or':_[_0x6f28('0x23')](_0x2bba7a,function(_0x49439d){if(_0x49439d[_0x6f28('0x34')]!==_0x6f28('0x35')){var _0x1a3f07={};_0x1a3f07[_0x49439d[_0x6f28('0x21')]]={'$like':'%'+_0x3b0c05['query']['filter']+'%'};return _0x1a3f07;}})});}_0x2ed005=_[_0x6f28('0x33')]({},_0x2ed005,_0x3b0c05[_0x6f28('0x36')]);var _0x29352d={'where':_0x2ed005[_0x6f28('0x30')]};return db[_0x6f28('0x24')][_0x6f28('0x16')](_0x29352d)[_0x6f28('0x1e')](function(_0x46adc9){_0x48ab68[_0x6f28('0x16')]=_0x46adc9;if(_0x3b0c05[_0x6f28('0x2c')][_0x6f28('0x37')]){_0x2ed005[_0x6f28('0x38')]=[{'all':!![]}];}return db[_0x6f28('0x24')][_0x6f28('0x39')](_0x2ed005);})[_0x6f28('0x1e')](function(_0x50aabb){_0x48ab68[_0x6f28('0x3a')]=_0x50aabb;return _0x48ab68;})[_0x6f28('0x1e')](respondWithFilteredResult(_0x4943f8,_0x2ed005))[_0x6f28('0x3b')](handleError(_0x4943f8,null));};exports['show']=function(_0xa749cc,_0x54964c){var _0x716af2={'raw':!![],'where':{'id':_0xa749cc[_0x6f28('0x3c')]['id']}},_0x4b2c9f={};_0x4b2c9f[_0x6f28('0x29')]=_[_0x6f28('0x27')](db['JscriptyQuestionReport']['rawAttributes']);_0x4b2c9f[_0x6f28('0x2c')]=_[_0x6f28('0x27')](_0xa749cc[_0x6f28('0x2c')]);_0x4b2c9f[_0x6f28('0x31')]=_[_0x6f28('0x28')](_0x4b2c9f[_0x6f28('0x29')],_0x4b2c9f['query']);_0x716af2[_0x6f28('0x2a')]=_[_0x6f28('0x28')](_0x4b2c9f['model'],qs[_0x6f28('0x2b')](_0xa749cc[_0x6f28('0x2c')]['fields']));_0x716af2['attributes']=_0x716af2[_0x6f28('0x2a')]['length']?_0x716af2['attributes']:_0x4b2c9f[_0x6f28('0x29')];if(_0xa749cc[_0x6f28('0x2c')][_0x6f28('0x37')]){_0x716af2[_0x6f28('0x38')]=[{'all':!![]}];}_0x716af2=_[_0x6f28('0x33')]({},_0x716af2,_0xa749cc[_0x6f28('0x36')]);return db[_0x6f28('0x24')][_0x6f28('0x3d')](_0x716af2)['then'](handleEntityNotFound(_0x54964c,null))[_0x6f28('0x1e')](respondWithResult(_0x54964c,null))['catch'](handleError(_0x54964c,null));};exports[_0x6f28('0x3e')]=function(_0x45a45d,_0x2c65b3){return db['JscriptyQuestionReport'][_0x6f28('0x3e')](_0x45a45d[_0x6f28('0x3f')],{})[_0x6f28('0x1e')](respondWithResult(_0x2c65b3,0xc9))[_0x6f28('0x3b')](handleError(_0x2c65b3,null));};exports['update']=function(_0x5d95e2,_0x2dc78a){if(_0x5d95e2['body']['id']){delete _0x5d95e2[_0x6f28('0x3f')]['id'];}return db[_0x6f28('0x24')][_0x6f28('0x3d')]({'where':{'id':_0x5d95e2[_0x6f28('0x3c')]['id']}})[_0x6f28('0x1e')](handleEntityNotFound(_0x2dc78a,null))[_0x6f28('0x1e')](saveUpdates(_0x5d95e2[_0x6f28('0x3f')],null))[_0x6f28('0x1e')](respondWithResult(_0x2dc78a,null))[_0x6f28('0x3b')](handleError(_0x2dc78a,null));};exports[_0x6f28('0x1d')]=function(_0x54fb4d,_0x43bc9f){return db[_0x6f28('0x24')][_0x6f28('0x3d')]({'where':{'id':_0x54fb4d[_0x6f28('0x3c')]['id']}})[_0x6f28('0x1e')](handleEntityNotFound(_0x43bc9f,null))['then'](removeEntity(_0x43bc9f,null))['catch'](handleError(_0x43bc9f,null));};exports[_0x6f28('0x40')]=function(_0x4f0f75,_0x2e338e){return db[_0x6f28('0x24')][_0x6f28('0x40')]()['then'](respondWithResult(_0x2e338e,null))[_0x6f28('0x3b')](handleError(_0x2e338e,null));}; \ No newline at end of file +var _0x221b=['error','stack','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','rows','catch','show','params','options','create','update','body','find','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x1e2881,_0x5f13e4){var _0x58c864=function(_0x46586a){while(--_0x46586a){_0x1e2881['push'](_0x1e2881['shift']());}};_0x58c864(++_0x5f13e4);}(_0x221b,0x13c));var _0xb221=function(_0x40d079,_0xe78829){_0x40d079=_0x40d079-0x0;var _0x4f3f39=_0x221b[_0x40d079];return _0x4f3f39;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb221('0x0'));var rimraf=require(_0xb221('0x1'));var zipdir=require(_0xb221('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb221('0x3'));var moment=require('moment');var BPromise=require(_0xb221('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb221('0x5'));var sox=require(_0xb221('0x6'));var csv=require('to-csv');var ejs=require(_0xb221('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb221('0x8'));var crypto=require(_0xb221('0x9'));var jsforce=require(_0xb221('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb221('0xb'));var Papa=require(_0xb221('0xc'));var Redis=require(_0xb221('0xd'));var authService=require(_0xb221('0xe'));var qs=require(_0xb221('0xf'));var as=require(_0xb221('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb221('0x11'))('api');var utils=require(_0xb221('0x12'));var config=require(_0xb221('0x13'));var db=require(_0xb221('0x14'))['db'];function respondWithStatusCode(_0x544cac,_0x209f39){_0x209f39=_0x209f39||0xcc;return function(_0x2d6bfd){if(_0x2d6bfd){return _0x544cac['sendStatus'](_0x209f39);}return _0x544cac[_0xb221('0x15')](_0x209f39)[_0xb221('0x16')]();};}function respondWithResult(_0x189484,_0x41af78){_0x41af78=_0x41af78||0xc8;return function(_0xdcdbb2){if(_0xdcdbb2){return _0x189484[_0xb221('0x15')](_0x41af78)[_0xb221('0x17')](_0xdcdbb2);}};}function respondWithFilteredResult(_0x16ce4a,_0x40d2fa){return function(_0x392d94){if(_0x392d94){var _0x31b18b=_0x392d94[_0xb221('0x18')],_0xba7cdb=_0x40d2fa[_0xb221('0x19')],_0x19af75=_0x40d2fa[_0xb221('0x19')]+_0x40d2fa[_0xb221('0x1a')],_0x2cf53e;if(_0x19af75>=_0x31b18b){_0x19af75=_0x31b18b;_0x2cf53e=0xc8;}else{_0x2cf53e=0xce;}_0x16ce4a[_0xb221('0x15')](_0x2cf53e);return _0x16ce4a[_0xb221('0x1b')](_0xb221('0x1c'),_0xba7cdb+'-'+_0x19af75+'/'+_0x31b18b)['json'](_0x392d94);}return null;};}function patchUpdates(_0x72c462){return function(_0x259f2d){try{jsonpatch[_0xb221('0x1d')](_0x259f2d,_0x72c462,!![]);}catch(_0x33c127){return BPromise[_0xb221('0x1e')](_0x33c127);}return _0x259f2d[_0xb221('0x1f')]();};}function saveUpdates(_0xea6c,_0x3ad5ea){return function(_0x2a59f9){if(_0x2a59f9){return _0x2a59f9['update'](_0xea6c)[_0xb221('0x20')](function(_0x32ae90){return _0x32ae90;});}return null;};}function removeEntity(_0x42fcdb,_0x47fad5){return function(_0xc22f64){if(_0xc22f64){return _0xc22f64[_0xb221('0x21')]()[_0xb221('0x20')](function(){_0x42fcdb[_0xb221('0x15')](0xcc)[_0xb221('0x16')]();});}};}function handleEntityNotFound(_0x451384,_0x22cf98){return function(_0x3fbc48){if(!_0x3fbc48){_0x451384['sendStatus'](0x194);}return _0x3fbc48;};}function handleError(_0x218206,_0x549315){_0x549315=_0x549315||0x1f4;return function(_0x823563){logger[_0xb221('0x22')](_0x823563[_0xb221('0x23')]);if(_0x823563[_0xb221('0x24')]){delete _0x823563[_0xb221('0x24')];}_0x218206['status'](_0x549315)['send'](_0x823563);};}exports[_0xb221('0x25')]=function(_0x2d7c9b,_0x45a48f){var _0x4ef31b={},_0x56d2cc={},_0x5c4ae2={'count':0x0,'rows':[]};var _0x1e997d=_[_0xb221('0x26')](db[_0xb221('0x27')][_0xb221('0x28')],function(_0x17b336){return{'name':_0x17b336[_0xb221('0x29')],'type':_0x17b336[_0xb221('0x2a')]['key']};});_0x56d2cc[_0xb221('0x2b')]=_[_0xb221('0x26')](_0x1e997d,_0xb221('0x24'));_0x56d2cc['query']=_[_0xb221('0x2c')](_0x2d7c9b[_0xb221('0x2d')]);_0x56d2cc[_0xb221('0x2e')]=_[_0xb221('0x2f')](_0x56d2cc[_0xb221('0x2b')],_0x56d2cc[_0xb221('0x2d')]);_0x4ef31b[_0xb221('0x30')]=_[_0xb221('0x2f')](_0x56d2cc[_0xb221('0x2b')],qs[_0xb221('0x31')](_0x2d7c9b[_0xb221('0x2d')]['fields']));_0x4ef31b[_0xb221('0x30')]=_0x4ef31b[_0xb221('0x30')][_0xb221('0x32')]?_0x4ef31b[_0xb221('0x30')]:_0x56d2cc[_0xb221('0x2b')];if(!_0x2d7c9b[_0xb221('0x2d')][_0xb221('0x33')](_0xb221('0x34'))){_0x4ef31b[_0xb221('0x1a')]=qs[_0xb221('0x1a')](_0x2d7c9b['query'][_0xb221('0x1a')]);_0x4ef31b['offset']=qs[_0xb221('0x19')](_0x2d7c9b[_0xb221('0x2d')]['offset']);}_0x4ef31b[_0xb221('0x35')]=qs[_0xb221('0x36')](_0x2d7c9b['query'][_0xb221('0x36')]);_0x4ef31b[_0xb221('0x37')]=qs[_0xb221('0x2e')](_['pick'](_0x2d7c9b[_0xb221('0x2d')],_0x56d2cc['filters']));if(_0x2d7c9b['query'][_0xb221('0x38')]){_0x4ef31b[_0xb221('0x37')]=_['merge'](_0x4ef31b[_0xb221('0x37')],{'$or':_[_0xb221('0x26')](_0x1e997d,function(_0x579103){if(_0x579103[_0xb221('0x2a')]!=='VIRTUAL'){var _0x41fa70={};_0x41fa70[_0x579103['name']]={'$like':'%'+_0x2d7c9b[_0xb221('0x2d')][_0xb221('0x38')]+'%'};return _0x41fa70;}})});}_0x4ef31b=_[_0xb221('0x39')]({},_0x4ef31b,_0x2d7c9b['options']);var _0x57af5b={'where':_0x4ef31b['where']};return db['JscriptyQuestionReport'][_0xb221('0x18')](_0x57af5b)[_0xb221('0x20')](function(_0x24bb93){_0x5c4ae2[_0xb221('0x18')]=_0x24bb93;if(_0x2d7c9b[_0xb221('0x2d')][_0xb221('0x3a')]){_0x4ef31b[_0xb221('0x3b')]=[{'all':!![]}];}return db[_0xb221('0x27')]['findAll'](_0x4ef31b);})[_0xb221('0x20')](function(_0x113111){_0x5c4ae2[_0xb221('0x3c')]=_0x113111;return _0x5c4ae2;})[_0xb221('0x20')](respondWithFilteredResult(_0x45a48f,_0x4ef31b))[_0xb221('0x3d')](handleError(_0x45a48f,null));};exports[_0xb221('0x3e')]=function(_0x164029,_0x52b84d){var _0x5bb1f9={'raw':!![],'where':{'id':_0x164029[_0xb221('0x3f')]['id']}},_0x5b49c9={};_0x5b49c9[_0xb221('0x2b')]=_[_0xb221('0x2c')](db[_0xb221('0x27')][_0xb221('0x28')]);_0x5b49c9[_0xb221('0x2d')]=_[_0xb221('0x2c')](_0x164029[_0xb221('0x2d')]);_0x5b49c9['filters']=_[_0xb221('0x2f')](_0x5b49c9['model'],_0x5b49c9['query']);_0x5bb1f9[_0xb221('0x30')]=_[_0xb221('0x2f')](_0x5b49c9[_0xb221('0x2b')],qs['fields'](_0x164029[_0xb221('0x2d')]['fields']));_0x5bb1f9[_0xb221('0x30')]=_0x5bb1f9[_0xb221('0x30')][_0xb221('0x32')]?_0x5bb1f9[_0xb221('0x30')]:_0x5b49c9[_0xb221('0x2b')];if(_0x164029['query'][_0xb221('0x3a')]){_0x5bb1f9[_0xb221('0x3b')]=[{'all':!![]}];}_0x5bb1f9=_[_0xb221('0x39')]({},_0x5bb1f9,_0x164029[_0xb221('0x40')]);return db[_0xb221('0x27')]['find'](_0x5bb1f9)['then'](handleEntityNotFound(_0x52b84d,null))[_0xb221('0x20')](respondWithResult(_0x52b84d,null))[_0xb221('0x3d')](handleError(_0x52b84d,null));};exports[_0xb221('0x41')]=function(_0x1a929d,_0x1089dd){return db['JscriptyQuestionReport']['create'](_0x1a929d['body'],{})[_0xb221('0x20')](respondWithResult(_0x1089dd,0xc9))[_0xb221('0x3d')](handleError(_0x1089dd,null));};exports[_0xb221('0x42')]=function(_0x3eb7ce,_0x67d48a){if(_0x3eb7ce[_0xb221('0x43')]['id']){delete _0x3eb7ce[_0xb221('0x43')]['id'];}return db['JscriptyQuestionReport'][_0xb221('0x44')]({'where':{'id':_0x3eb7ce['params']['id']}})[_0xb221('0x20')](handleEntityNotFound(_0x67d48a,null))[_0xb221('0x20')](saveUpdates(_0x3eb7ce['body'],null))[_0xb221('0x20')](respondWithResult(_0x67d48a,null))[_0xb221('0x3d')](handleError(_0x67d48a,null));};exports[_0xb221('0x21')]=function(_0x3402b2,_0x5dd3a7){return db[_0xb221('0x27')]['find']({'where':{'id':_0x3402b2[_0xb221('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5dd3a7,null))[_0xb221('0x20')](removeEntity(_0x5dd3a7,null))[_0xb221('0x3d')](handleError(_0x5dd3a7,null));};exports[_0xb221('0x45')]=function(_0x5dc122,_0x1983eb){return db[_0xb221('0x27')][_0xb221('0x45')]()[_0xb221('0x20')](respondWithResult(_0x1983eb,null))[_0xb221('0x3d')](handleError(_0x1983eb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 647a5b3..983ab07 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 _0x3f5d=['JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x3f5d,0xaa));var _0xd3f5=function(_0x51e880,_0x50d425){_0x51e880=_0x51e880-0x0;var _0x3b6e64=_0x3f5d[_0x51e880];return _0x3b6e64;};'use strict';var _=require(_0xd3f5('0x0'));var util=require(_0xd3f5('0x1'));var logger=require(_0xd3f5('0x2'))(_0xd3f5('0x3'));var moment=require(_0xd3f5('0x4'));var BPromise=require(_0xd3f5('0x5'));var rp=require(_0xd3f5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3f5('0x7'));var config=require(_0xd3f5('0x8'));var attributes=require(_0xd3f5('0x9'));module[_0xd3f5('0xa')]=function(_0x6018ee,_0x715631){return _0x6018ee[_0xd3f5('0xb')](_0xd3f5('0xc'),attributes,{'tableName':_0xd3f5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37ea=['../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x3732b3,_0x1e9325){var _0x927d58=function(_0x207c15){while(--_0x207c15){_0x3732b3['push'](_0x3732b3['shift']());}};_0x927d58(++_0x1e9325);}(_0x37ea,0x130));var _0xa37e=function(_0x41a9ce,_0x4846b2){_0x41a9ce=_0x41a9ce-0x0;var _0x563c12=_0x37ea[_0x41a9ce];return _0x563c12;};'use strict';var _=require(_0xa37e('0x0'));var util=require(_0xa37e('0x1'));var logger=require(_0xa37e('0x2'))(_0xa37e('0x3'));var moment=require(_0xa37e('0x4'));var BPromise=require(_0xa37e('0x5'));var rp=require(_0xa37e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa37e('0x7'));var config=require(_0xa37e('0x8'));var attributes=require(_0xa37e('0x9'));module[_0xa37e('0xa')]=function(_0x574986,_0x5f4b6f){return _0x574986['define'](_0xa37e('0xb'),attributes,{'tableName':_0xa37e('0xc'),'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 40d17a0..ecf2054 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 _0x02ba=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x02ba,0xda));var _0xa02b=function(_0x486aa6,_0x34ce3d){_0x486aa6=_0x486aa6-0x0;var _0xb380f6=_0x02ba[_0x486aa6];return _0xb380f6;};'use strict';var _=require('lodash');var util=require(_0xa02b('0x0'));var moment=require('moment');var BPromise=require(_0xa02b('0x1'));var rs=require(_0xa02b('0x2'));var fs=require('fs');var Redis=require(_0xa02b('0x3'));var db=require(_0xa02b('0x4'))['db'];var utils=require(_0xa02b('0x5'));var logger=require(_0xa02b('0x6'))(_0xa02b('0x7'));var config=require('../../config/environment');var jayson=require(_0xa02b('0x8'));var client=jayson[_0xa02b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x101146,_0x4d86b7,_0x5f30f7){return new BPromise(function(_0x4fe0b9,_0x2c64c5){return client[_0xa02b('0xa')](_0x101146,_0x5f30f7)[_0xa02b('0xb')](function(_0x25700e){logger['info'](_0xa02b('0xc'),_0x4d86b7,'request\x20sent');logger[_0xa02b('0xd')](_0xa02b('0xe'),_0x4d86b7,_0xa02b('0xf'),JSON[_0xa02b('0x10')](_0x25700e));if(_0x25700e[_0xa02b('0x11')]){if(_0x25700e[_0xa02b('0x11')]['code']===0x1f4){logger[_0xa02b('0x11')](_0xa02b('0xc'),_0x4d86b7,_0x25700e['error'][_0xa02b('0x12')]);return _0x2c64c5(_0x25700e[_0xa02b('0x11')][_0xa02b('0x12')]);}logger[_0xa02b('0x11')](_0xa02b('0xc'),_0x4d86b7,_0x25700e[_0xa02b('0x11')]['message']);return _0x4fe0b9(_0x25700e[_0xa02b('0x11')]['message']);}else{logger[_0xa02b('0x13')](_0xa02b('0xc'),_0x4d86b7,_0xa02b('0xf'));_0x4fe0b9(_0x25700e['result'][_0xa02b('0x12')]);}})[_0xa02b('0x14')](function(_0x33bf53){logger['error'](_0xa02b('0xc'),_0x4d86b7,_0x33bf53);_0x2c64c5(_0x33bf53);});});} \ No newline at end of file +var _0x90bc=['stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s'];(function(_0x44009f,_0x2753b2){var _0x1d254d=function(_0x1249b0){while(--_0x1249b0){_0x44009f['push'](_0x44009f['shift']());}};_0x1d254d(++_0x2753b2);}(_0x90bc,0x77));var _0xc90b=function(_0x3d4488,_0x1b2b82){_0x3d4488=_0x3d4488-0x0;var _0x4a0548=_0x90bc[_0x3d4488];return _0x4a0548;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc90b('0x0'));var BPromise=require(_0xc90b('0x1'));var rs=require(_0xc90b('0x2'));var fs=require('fs');var Redis=require(_0xc90b('0x3'));var db=require(_0xc90b('0x4'))['db'];var utils=require(_0xc90b('0x5'));var logger=require('../../config/logger')(_0xc90b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc90b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x116542,_0x1d9fb8,_0x32b5bb){return new BPromise(function(_0xc73531,_0x20ff1a){return client[_0xc90b('0x8')](_0x116542,_0x32b5bb)['then'](function(_0x309aa4){logger[_0xc90b('0x9')](_0xc90b('0xa'),_0x1d9fb8,_0xc90b('0xb'));logger[_0xc90b('0xc')](_0xc90b('0xd'),_0x1d9fb8,_0xc90b('0xb'),JSON[_0xc90b('0xe')](_0x309aa4));if(_0x309aa4[_0xc90b('0xf')]){if(_0x309aa4[_0xc90b('0xf')][_0xc90b('0x10')]===0x1f4){logger[_0xc90b('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1d9fb8,_0x309aa4[_0xc90b('0xf')]['message']);return _0x20ff1a(_0x309aa4['error'][_0xc90b('0x11')]);}logger[_0xc90b('0xf')](_0xc90b('0xa'),_0x1d9fb8,_0x309aa4[_0xc90b('0xf')][_0xc90b('0x11')]);return _0xc73531(_0x309aa4['error']['message']);}else{logger['info'](_0xc90b('0xa'),_0x1d9fb8,'request\x20sent');_0xc73531(_0x309aa4[_0xc90b('0x12')][_0xc90b('0x11')]);}})['catch'](function(_0x49cf48){logger[_0xc90b('0xf')](_0xc90b('0xa'),_0x1d9fb8,_0x49cf48);_0x20ff1a(_0x49cf48);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 6163fa8..bfbd9f6 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 _0x2ce1=['delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/:id','/:id/questions','getQuestions','put','update'];(function(_0x391a96,_0x37fa91){var _0x3c9b51=function(_0x3d3737){while(--_0x3d3737){_0x391a96['push'](_0x391a96['shift']());}};_0x3c9b51(++_0x37fa91);}(_0x2ce1,0x8b));var _0x12ce=function(_0x4c7a74,_0x2ad0b4){_0x4c7a74=_0x4c7a74-0x0;var _0x5c4048=_0x2ce1[_0x4c7a74];return _0x5c4048;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x12ce('0x0'));var express=require(_0x12ce('0x1'));var router=express[_0x12ce('0x2')]();var auth=require(_0x12ce('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x12ce('0x4'));var controller=require(_0x12ce('0x5'));router['get']('/',auth[_0x12ce('0x6')](),controller[_0x12ce('0x7')]);router[_0x12ce('0x8')]('/describe',auth[_0x12ce('0x6')](),controller['describe']);router[_0x12ce('0x8')](_0x12ce('0x9'),auth[_0x12ce('0x6')](),controller['show']);router[_0x12ce('0x8')](_0x12ce('0xa'),auth[_0x12ce('0x6')](),controller[_0x12ce('0xb')]);router['post']('/',auth[_0x12ce('0x6')](),controller['create']);router[_0x12ce('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x12ce('0xd')]);router[_0x12ce('0xe')](_0x12ce('0x9'),auth[_0x12ce('0x6')](),controller[_0x12ce('0xf')]);module[_0x12ce('0x10')]=router; \ No newline at end of file +var _0x3148=['post','create','put','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x3148,0x1d3));var _0x8314=function(_0xb83515,_0x15f73b){_0xb83515=_0xb83515-0x0;var _0x57dc1f=_0x3148[_0xb83515];return _0x57dc1f;};'use strict';var multer=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var path=require('path');var timeout=require(_0x8314('0x2'));var express=require(_0x8314('0x3'));var router=express[_0x8314('0x4')]();var auth=require(_0x8314('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8314('0x6'));var controller=require(_0x8314('0x7'));router[_0x8314('0x8')]('/',auth[_0x8314('0x9')](),controller[_0x8314('0xa')]);router[_0x8314('0x8')](_0x8314('0xb'),auth['isAuthenticated'](),controller[_0x8314('0xc')]);router['get'](_0x8314('0xd'),auth[_0x8314('0x9')](),controller[_0x8314('0xe')]);router[_0x8314('0x8')](_0x8314('0xf'),auth['isAuthenticated'](),controller['getQuestions']);router[_0x8314('0x10')]('/',auth[_0x8314('0x9')](),controller[_0x8314('0x11')]);router[_0x8314('0x12')]('/:id',auth[_0x8314('0x9')](),controller[_0x8314('0x13')]);router['delete'](_0x8314('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x8314('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index b7d5eb1..cb2e295 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 _0x1ff5=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x2d4eba,_0x348848){var _0x21141d=function(_0x7f6893){while(--_0x7f6893){_0x2d4eba['push'](_0x2d4eba['shift']());}};_0x21141d(++_0x348848);}(_0x1ff5,0x190));var _0x51ff=function(_0x5abd83,_0x29f739){_0x5abd83=_0x5abd83-0x0;var _0x3810f7=_0x1ff5[_0x5abd83];return _0x3810f7;};'use strict';var moment=require('moment');var Sequelize=require(_0x51ff('0x0'));module[_0x51ff('0x1')]={'starttime':{'type':Sequelize[_0x51ff('0x2')],'set':function(_0x5e2816){this[_0x51ff('0x3')](_0x51ff('0x4'),_0x5e2816);this[_0x51ff('0x3')]('endtime',moment()[_0x51ff('0x5')](_0x51ff('0x6')));}},'endtime':{'type':Sequelize[_0x51ff('0x2')]},'membername':{'type':Sequelize[_0x51ff('0x7')]},'projectname':{'type':Sequelize[_0x51ff('0x7')]},'queue':{'type':Sequelize[_0x51ff('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x51ff('0x7')]},'completed':{'type':Sequelize[_0x51ff('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x7017=['STRING','BOOLEAN','moment','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x29457e,_0x3e0a29){var _0x5b6796=function(_0x584cee){while(--_0x584cee){_0x29457e['push'](_0x29457e['shift']());}};_0x5b6796(++_0x3e0a29);}(_0x7017,0x119));var _0x7701=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x7017[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0x7701('0x0'));var Sequelize=require('sequelize');module['exports']={'starttime':{'type':Sequelize[_0x7701('0x1')],'set':function(_0x1c886b){this[_0x7701('0x2')](_0x7701('0x3'),_0x1c886b);this['setDataValue'](_0x7701('0x4'),moment()[_0x7701('0x5')](_0x7701('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x7701('0x7')]},'queue':{'type':Sequelize[_0x7701('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7701('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x7701('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index c555ae5..bd4dfce 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 _0x980b=['rimraf','fast-json-patch','request-promise','moment','mustache','sox','ejs','crypto','jsforce','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','fieldName','type','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','JscriptySessionReport','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','params','getQuestions','findOne','JscriptyQuestionReport','html-pdf','eml-format'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x980b,0x1e1));var _0xb980=function(_0x247e28,_0x4e1eb7){_0x247e28=_0x247e28-0x0;var _0x5579b0=_0x980b[_0x247e28];return _0x5579b0;};'use strict';var pdf=require(_0xb980('0x0'));var emlformat=require(_0xb980('0x1'));var rimraf=require(_0xb980('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb980('0x3'));var rp=require(_0xb980('0x4'));var moment=require(_0xb980('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb980('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb980('0x7'));var csv=require('to-csv');var ejs=require(_0xb980('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb980('0x9'));var jsforce=require(_0xb980('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb980('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb980('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb980('0xd'));var logger=require(_0xb980('0xe'))('api');var utils=require(_0xb980('0xf'));var config=require(_0xb980('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b80a8,_0x3db893){_0x3db893=_0x3db893||0xcc;return function(_0x256eac){if(_0x256eac){return _0x4b80a8[_0xb980('0x11')](_0x3db893);}return _0x4b80a8[_0xb980('0x12')](_0x3db893)[_0xb980('0x13')]();};}function respondWithResult(_0xe4dd8e,_0x53fda3){_0x53fda3=_0x53fda3||0xc8;return function(_0x5c00dc){if(_0x5c00dc){return _0xe4dd8e[_0xb980('0x12')](_0x53fda3)[_0xb980('0x14')](_0x5c00dc);}};}function respondWithFilteredResult(_0x3d1dd0,_0x38a029){return function(_0x3670c6){if(_0x3670c6){var _0x55c729=_0x3670c6[_0xb980('0x15')],_0x42be45=_0x38a029[_0xb980('0x16')],_0x4e424b=_0x38a029['offset']+_0x38a029[_0xb980('0x17')],_0x37c3ef;if(_0x4e424b>=_0x55c729){_0x4e424b=_0x55c729;_0x37c3ef=0xc8;}else{_0x37c3ef=0xce;}_0x3d1dd0[_0xb980('0x12')](_0x37c3ef);return _0x3d1dd0[_0xb980('0x18')](_0xb980('0x19'),_0x42be45+'-'+_0x4e424b+'/'+_0x55c729)[_0xb980('0x14')](_0x3670c6);}return null;};}function patchUpdates(_0x57c1d8){return function(_0x15d7a3){try{jsonpatch[_0xb980('0x1a')](_0x15d7a3,_0x57c1d8,!![]);}catch(_0x145091){return BPromise[_0xb980('0x1b')](_0x145091);}return _0x15d7a3['save']();};}function saveUpdates(_0x473193,_0x4d6af9){return function(_0x119176){if(_0x119176){return _0x119176[_0xb980('0x1c')](_0x473193)['then'](function(_0x3792ea){return _0x3792ea;});}return null;};}function removeEntity(_0x10b699,_0x374314){return function(_0x4c80b6){if(_0x4c80b6){return _0x4c80b6[_0xb980('0x1d')]()[_0xb980('0x1e')](function(){_0x10b699[_0xb980('0x12')](0xcc)[_0xb980('0x13')]();});}};}function handleEntityNotFound(_0x143d27,_0x515178){return function(_0x2287d7){if(!_0x2287d7){_0x143d27[_0xb980('0x11')](0x194);}return _0x2287d7;};}function handleError(_0x8502a9,_0x414863){_0x414863=_0x414863||0x1f4;return function(_0x5bbbc3){logger[_0xb980('0x1f')](_0x5bbbc3[_0xb980('0x20')]);if(_0x5bbbc3[_0xb980('0x21')]){delete _0x5bbbc3['name'];}_0x8502a9[_0xb980('0x12')](_0x414863)['send'](_0x5bbbc3);};}exports['index']=function(_0x3e8595,_0x2464c1){var _0x14f32d={},_0x4db293={},_0x3c7a83={'count':0x0,'rows':[]};var _0x1d457f=_['map'](db['JscriptySessionReport']['rawAttributes'],function(_0x2492e3){return{'name':_0x2492e3[_0xb980('0x22')],'type':_0x2492e3[_0xb980('0x23')]['key']};});_0x4db293[_0xb980('0x24')]=_[_0xb980('0x25')](_0x1d457f,_0xb980('0x21'));_0x4db293[_0xb980('0x26')]=_[_0xb980('0x27')](_0x3e8595[_0xb980('0x26')]);_0x4db293['filters']=_['intersection'](_0x4db293['model'],_0x4db293[_0xb980('0x26')]);_0x14f32d[_0xb980('0x28')]=_[_0xb980('0x29')](_0x4db293[_0xb980('0x24')],qs[_0xb980('0x2a')](_0x3e8595[_0xb980('0x26')][_0xb980('0x2a')]));_0x14f32d[_0xb980('0x28')]=_0x14f32d[_0xb980('0x28')][_0xb980('0x2b')]?_0x14f32d[_0xb980('0x28')]:_0x4db293['model'];if(!_0x3e8595[_0xb980('0x26')][_0xb980('0x2c')](_0xb980('0x2d'))){_0x14f32d[_0xb980('0x17')]=qs[_0xb980('0x17')](_0x3e8595[_0xb980('0x26')][_0xb980('0x17')]);_0x14f32d['offset']=qs[_0xb980('0x16')](_0x3e8595[_0xb980('0x26')][_0xb980('0x16')]);}_0x14f32d[_0xb980('0x2e')]=qs[_0xb980('0x2f')](_0x3e8595[_0xb980('0x26')][_0xb980('0x2f')]);_0x14f32d['where']=qs['filters'](_[_0xb980('0x30')](_0x3e8595[_0xb980('0x26')],_0x4db293[_0xb980('0x31')]));if(_0x3e8595['query']['filter']){_0x14f32d[_0xb980('0x32')]=_[_0xb980('0x33')](_0x14f32d[_0xb980('0x32')],{'$or':_[_0xb980('0x25')](_0x1d457f,function(_0x23dc89){if(_0x23dc89[_0xb980('0x23')]!==_0xb980('0x34')){var _0xacb7aa={};_0xacb7aa[_0x23dc89[_0xb980('0x21')]]={'$like':'%'+_0x3e8595[_0xb980('0x26')][_0xb980('0x35')]+'%'};return _0xacb7aa;}})});}_0x14f32d=_[_0xb980('0x33')]({},_0x14f32d,_0x3e8595[_0xb980('0x36')]);var _0x578602={'where':_0x14f32d[_0xb980('0x32')]};return db[_0xb980('0x37')][_0xb980('0x15')](_0x578602)[_0xb980('0x1e')](function(_0x48a177){_0x3c7a83[_0xb980('0x15')]=_0x48a177;if(_0x3e8595[_0xb980('0x26')]['includeAll']){_0x14f32d['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0xb980('0x38')](_0x14f32d);})[_0xb980('0x1e')](function(_0x34d9d2){_0x3c7a83[_0xb980('0x39')]=_0x34d9d2;return _0x3c7a83;})['then'](respondWithFilteredResult(_0x2464c1,_0x14f32d))[_0xb980('0x3a')](handleError(_0x2464c1,null));};exports[_0xb980('0x3b')]=function(_0x16d965,_0x27caa5){var _0x4dcdac={'raw':!![],'where':{'id':_0x16d965['params']['id']}},_0x155577={};_0x155577['model']=_[_0xb980('0x27')](db[_0xb980('0x37')][_0xb980('0x3c')]);_0x155577[_0xb980('0x26')]=_[_0xb980('0x27')](_0x16d965[_0xb980('0x26')]);_0x155577['filters']=_[_0xb980('0x29')](_0x155577[_0xb980('0x24')],_0x155577['query']);_0x4dcdac[_0xb980('0x28')]=_[_0xb980('0x29')](_0x155577['model'],qs[_0xb980('0x2a')](_0x16d965[_0xb980('0x26')]['fields']));_0x4dcdac['attributes']=_0x4dcdac[_0xb980('0x28')][_0xb980('0x2b')]?_0x4dcdac[_0xb980('0x28')]:_0x155577[_0xb980('0x24')];if(_0x16d965[_0xb980('0x26')][_0xb980('0x3d')]){_0x4dcdac['include']=[{'all':!![]}];}_0x4dcdac=_[_0xb980('0x33')]({},_0x4dcdac,_0x16d965['options']);return db[_0xb980('0x37')][_0xb980('0x3e')](_0x4dcdac)[_0xb980('0x1e')](handleEntityNotFound(_0x27caa5,null))[_0xb980('0x1e')](respondWithResult(_0x27caa5,null))[_0xb980('0x3a')](handleError(_0x27caa5,null));};exports[_0xb980('0x3f')]=function(_0x5730df,_0xe5e09c){return db[_0xb980('0x37')][_0xb980('0x3f')](_0x5730df[_0xb980('0x40')],{})[_0xb980('0x1e')](respondWithResult(_0xe5e09c,0xc9))[_0xb980('0x3a')](handleError(_0xe5e09c,null));};exports[_0xb980('0x1c')]=function(_0x59e3d3,_0x3710f8){if(_0x59e3d3[_0xb980('0x40')]['id']){delete _0x59e3d3[_0xb980('0x40')]['id'];}return db['JscriptySessionReport'][_0xb980('0x3e')]({'where':{'id':_0x59e3d3['params']['id']}})[_0xb980('0x1e')](handleEntityNotFound(_0x3710f8,null))['then'](saveUpdates(_0x59e3d3[_0xb980('0x40')],null))[_0xb980('0x1e')](respondWithResult(_0x3710f8,null))[_0xb980('0x3a')](handleError(_0x3710f8,null));};exports['destroy']=function(_0x14fc4b,_0x2adf3b){return db[_0xb980('0x37')][_0xb980('0x3e')]({'where':{'id':_0x14fc4b[_0xb980('0x41')]['id']}})[_0xb980('0x1e')](handleEntityNotFound(_0x2adf3b,null))['then'](removeEntity(_0x2adf3b,null))[_0xb980('0x3a')](handleError(_0x2adf3b,null));};exports['describe']=function(_0xb77497,_0x3c37f2){return db['JscriptySessionReport']['describe']()[_0xb980('0x1e')](respondWithResult(_0x3c37f2,null))['catch'](handleError(_0x3c37f2,null));};exports[_0xb980('0x42')]=function(_0x47b995,_0x3dd1a9,_0x344137){var _0x69900c={'raw':!![],'where':{}};var _0x1af3bd={};var _0x3e4bac={'count':0x0,'rows':[]};return db[_0xb980('0x37')][_0xb980('0x43')]({'where':{'id':_0x47b995['params']['id']}})[_0xb980('0x1e')](handleEntityNotFound(_0x3dd1a9,null))[_0xb980('0x1e')](function(_0x11323b){if(_0x11323b){_0x1af3bd['model']=_[_0xb980('0x27')](db[_0xb980('0x44')][_0xb980('0x3c')]);_0x1af3bd[_0xb980('0x26')]=_[_0xb980('0x27')](_0x47b995['query']);_0x1af3bd[_0xb980('0x31')]=_[_0xb980('0x29')](_0x1af3bd[_0xb980('0x24')],_0x1af3bd[_0xb980('0x26')]);_0x69900c[_0xb980('0x28')]=_[_0xb980('0x29')](_0x1af3bd[_0xb980('0x24')],qs[_0xb980('0x2a')](_0x47b995[_0xb980('0x26')][_0xb980('0x2a')]));_0x69900c[_0xb980('0x28')]=_0x69900c[_0xb980('0x28')]['length']?_0x69900c[_0xb980('0x28')]:_0x1af3bd[_0xb980('0x24')];if(!_0x47b995[_0xb980('0x26')]['hasOwnProperty'](_0xb980('0x2d'))){_0x69900c[_0xb980('0x17')]=qs[_0xb980('0x17')](_0x47b995['query'][_0xb980('0x17')]);_0x69900c[_0xb980('0x16')]=qs[_0xb980('0x16')](_0x47b995[_0xb980('0x26')][_0xb980('0x16')]);}_0x69900c[_0xb980('0x2e')]=qs[_0xb980('0x2f')](_0x47b995[_0xb980('0x26')][_0xb980('0x2f')]);_0x69900c[_0xb980('0x32')]=qs['filters'](_[_0xb980('0x30')](_0x47b995[_0xb980('0x26')],_0x1af3bd['filters']));_0x69900c[_0xb980('0x32')]['SessionId']=_0x11323b['id'];if(_0x47b995['query'][_0xb980('0x35')]){_0x69900c[_0xb980('0x32')]=_['merge'](_0x69900c[_0xb980('0x32')],{'$or':_[_0xb980('0x25')](_0x69900c[_0xb980('0x28')],function(_0x428149){var _0x4634dc={};_0x4634dc[_0x428149]={'$like':'%'+_0x47b995[_0xb980('0x26')][_0xb980('0x35')]+'%'};return _0x4634dc;})});}_0x69900c=_['merge']({},_0x69900c,_0x47b995['options']);return db[_0xb980('0x44')][_0xb980('0x15')]({'where':_0x69900c[_0xb980('0x32')]})['then'](function(_0x38cda3){_0x3e4bac['count']=_0x38cda3;if(_0x47b995['query'][_0xb980('0x3d')]){_0x69900c['include']=[{'all':!![]}];}return db[_0xb980('0x44')][_0xb980('0x38')](_0x69900c);})[_0xb980('0x1e')](function(_0x53828d){_0x3e4bac['rows']=_0x53828d;return _0x3e4bac;});}})[_0xb980('0x1e')](respondWithFilteredResult(_0x3dd1a9,_0x69900c))['catch'](handleError(_0x3dd1a9,null));}; \ No newline at end of file +var _0x5f8d=['rows','catch','length','find','create','body','params','describe','getQuestions','JscriptyQuestionReport','rawAttributes','order','pick','SessionId','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','JscriptySessionReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','filter','merge','map','type','VIRTUAL','options','includeAll'];(function(_0x46f8f5,_0x1fec72){var _0x4d9846=function(_0x103b8a){while(--_0x103b8a){_0x46f8f5['push'](_0x46f8f5['shift']());}};_0x4d9846(++_0x1fec72);}(_0x5f8d,0xf6));var _0xd5f8=function(_0x42d529,_0x8438e0){_0x42d529=_0x42d529-0x0;var _0x40cb6e=_0x5f8d[_0x42d529];return _0x40cb6e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd5f8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd5f8('0x1'));var jsonpatch=require(_0xd5f8('0x2'));var rp=require(_0xd5f8('0x3'));var moment=require(_0xd5f8('0x4'));var BPromise=require(_0xd5f8('0x5'));var Mustache=require(_0xd5f8('0x6'));var util=require(_0xd5f8('0x7'));var path=require(_0xd5f8('0x8'));var sox=require(_0xd5f8('0x9'));var csv=require(_0xd5f8('0xa'));var ejs=require(_0xd5f8('0xb'));var fs=require('fs');var _=require(_0xd5f8('0xc'));var squel=require(_0xd5f8('0xd'));var crypto=require(_0xd5f8('0xe'));var jsforce=require(_0xd5f8('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd5f8('0xa'));var querystring=require(_0xd5f8('0x10'));var Papa=require('papaparse');var Redis=require(_0xd5f8('0x11'));var authService=require(_0xd5f8('0x12'));var qs=require(_0xd5f8('0x13'));var as=require(_0xd5f8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5f8('0x15'))('api');var utils=require(_0xd5f8('0x16'));var config=require(_0xd5f8('0x17'));var db=require(_0xd5f8('0x18'))['db'];function respondWithStatusCode(_0xac4b6f,_0x522ca5){_0x522ca5=_0x522ca5||0xcc;return function(_0x4c2dea){if(_0x4c2dea){return _0xac4b6f[_0xd5f8('0x19')](_0x522ca5);}return _0xac4b6f[_0xd5f8('0x1a')](_0x522ca5)[_0xd5f8('0x1b')]();};}function respondWithResult(_0xe6ab84,_0x2aac93){_0x2aac93=_0x2aac93||0xc8;return function(_0x29bc82){if(_0x29bc82){return _0xe6ab84['status'](_0x2aac93)[_0xd5f8('0x1c')](_0x29bc82);}};}function respondWithFilteredResult(_0x2ca22a,_0x3169fd){return function(_0x8266af){if(_0x8266af){var _0x5741f4=_0x8266af[_0xd5f8('0x1d')],_0x146753=_0x3169fd[_0xd5f8('0x1e')],_0xbfda7f=_0x3169fd[_0xd5f8('0x1e')]+_0x3169fd['limit'],_0xf91820;if(_0xbfda7f>=_0x5741f4){_0xbfda7f=_0x5741f4;_0xf91820=0xc8;}else{_0xf91820=0xce;}_0x2ca22a[_0xd5f8('0x1a')](_0xf91820);return _0x2ca22a['set'](_0xd5f8('0x1f'),_0x146753+'-'+_0xbfda7f+'/'+_0x5741f4)[_0xd5f8('0x1c')](_0x8266af);}return null;};}function patchUpdates(_0x252fe2){return function(_0x3c064e){try{jsonpatch['apply'](_0x3c064e,_0x252fe2,!![]);}catch(_0x2dd011){return BPromise[_0xd5f8('0x20')](_0x2dd011);}return _0x3c064e[_0xd5f8('0x21')]();};}function saveUpdates(_0x5b6616,_0x56be91){return function(_0x532143){if(_0x532143){return _0x532143[_0xd5f8('0x22')](_0x5b6616)[_0xd5f8('0x23')](function(_0x24d056){return _0x24d056;});}return null;};}function removeEntity(_0x528fec,_0x2a7fc4){return function(_0x3027be){if(_0x3027be){return _0x3027be[_0xd5f8('0x24')]()['then'](function(){_0x528fec[_0xd5f8('0x1a')](0xcc)[_0xd5f8('0x1b')]();});}};}function handleEntityNotFound(_0x935836,_0x744ffe){return function(_0x585baf){if(!_0x585baf){_0x935836['sendStatus'](0x194);}return _0x585baf;};}function handleError(_0x16c2ca,_0x3cf4cf){_0x3cf4cf=_0x3cf4cf||0x1f4;return function(_0x5c0605){logger[_0xd5f8('0x25')](_0x5c0605[_0xd5f8('0x26')]);if(_0x5c0605[_0xd5f8('0x27')]){delete _0x5c0605[_0xd5f8('0x27')];}_0x16c2ca[_0xd5f8('0x1a')](_0x3cf4cf)['send'](_0x5c0605);};}exports['index']=function(_0x22630c,_0x4a20b3){var _0x27c3fa={},_0x4452c0={},_0x1a98db={'count':0x0,'rows':[]};var _0x109f05=_['map'](db[_0xd5f8('0x28')]['rawAttributes'],function(_0x2744e7){return{'name':_0x2744e7[_0xd5f8('0x29')],'type':_0x2744e7['type'][_0xd5f8('0x2a')]};});_0x4452c0[_0xd5f8('0x2b')]=_['map'](_0x109f05,_0xd5f8('0x27'));_0x4452c0[_0xd5f8('0x2c')]=_[_0xd5f8('0x2d')](_0x22630c['query']);_0x4452c0[_0xd5f8('0x2e')]=_['intersection'](_0x4452c0[_0xd5f8('0x2b')],_0x4452c0[_0xd5f8('0x2c')]);_0x27c3fa['attributes']=_[_0xd5f8('0x2f')](_0x4452c0[_0xd5f8('0x2b')],qs['fields'](_0x22630c[_0xd5f8('0x2c')][_0xd5f8('0x30')]));_0x27c3fa['attributes']=_0x27c3fa[_0xd5f8('0x31')]['length']?_0x27c3fa[_0xd5f8('0x31')]:_0x4452c0[_0xd5f8('0x2b')];if(!_0x22630c[_0xd5f8('0x2c')][_0xd5f8('0x32')](_0xd5f8('0x33'))){_0x27c3fa[_0xd5f8('0x34')]=qs[_0xd5f8('0x34')](_0x22630c['query']['limit']);_0x27c3fa[_0xd5f8('0x1e')]=qs[_0xd5f8('0x1e')](_0x22630c[_0xd5f8('0x2c')]['offset']);}_0x27c3fa['order']=qs[_0xd5f8('0x35')](_0x22630c['query']['sort']);_0x27c3fa[_0xd5f8('0x36')]=qs[_0xd5f8('0x2e')](_['pick'](_0x22630c[_0xd5f8('0x2c')],_0x4452c0['filters']));if(_0x22630c[_0xd5f8('0x2c')][_0xd5f8('0x37')]){_0x27c3fa['where']=_[_0xd5f8('0x38')](_0x27c3fa[_0xd5f8('0x36')],{'$or':_[_0xd5f8('0x39')](_0x109f05,function(_0x16133a){if(_0x16133a[_0xd5f8('0x3a')]!==_0xd5f8('0x3b')){var _0x56a371={};_0x56a371[_0x16133a['name']]={'$like':'%'+_0x22630c[_0xd5f8('0x2c')][_0xd5f8('0x37')]+'%'};return _0x56a371;}})});}_0x27c3fa=_[_0xd5f8('0x38')]({},_0x27c3fa,_0x22630c[_0xd5f8('0x3c')]);var _0x3e431f={'where':_0x27c3fa['where']};return db['JscriptySessionReport']['count'](_0x3e431f)[_0xd5f8('0x23')](function(_0x362737){_0x1a98db['count']=_0x362737;if(_0x22630c[_0xd5f8('0x2c')][_0xd5f8('0x3d')]){_0x27c3fa['include']=[{'all':!![]}];}return db[_0xd5f8('0x28')]['findAll'](_0x27c3fa);})['then'](function(_0x52becc){_0x1a98db[_0xd5f8('0x3e')]=_0x52becc;return _0x1a98db;})[_0xd5f8('0x23')](respondWithFilteredResult(_0x4a20b3,_0x27c3fa))[_0xd5f8('0x3f')](handleError(_0x4a20b3,null));};exports['show']=function(_0xac0c85,_0x3baf7f){var _0x49032c={'raw':!![],'where':{'id':_0xac0c85['params']['id']}},_0x2e389a={};_0x2e389a[_0xd5f8('0x2b')]=_[_0xd5f8('0x2d')](db[_0xd5f8('0x28')]['rawAttributes']);_0x2e389a[_0xd5f8('0x2c')]=_[_0xd5f8('0x2d')](_0xac0c85[_0xd5f8('0x2c')]);_0x2e389a['filters']=_[_0xd5f8('0x2f')](_0x2e389a[_0xd5f8('0x2b')],_0x2e389a[_0xd5f8('0x2c')]);_0x49032c[_0xd5f8('0x31')]=_['intersection'](_0x2e389a[_0xd5f8('0x2b')],qs[_0xd5f8('0x30')](_0xac0c85['query'][_0xd5f8('0x30')]));_0x49032c['attributes']=_0x49032c['attributes'][_0xd5f8('0x40')]?_0x49032c[_0xd5f8('0x31')]:_0x2e389a['model'];if(_0xac0c85['query']['includeAll']){_0x49032c['include']=[{'all':!![]}];}_0x49032c=_[_0xd5f8('0x38')]({},_0x49032c,_0xac0c85[_0xd5f8('0x3c')]);return db[_0xd5f8('0x28')][_0xd5f8('0x41')](_0x49032c)['then'](handleEntityNotFound(_0x3baf7f,null))[_0xd5f8('0x23')](respondWithResult(_0x3baf7f,null))[_0xd5f8('0x3f')](handleError(_0x3baf7f,null));};exports[_0xd5f8('0x42')]=function(_0x70144,_0x5114dc){return db[_0xd5f8('0x28')][_0xd5f8('0x42')](_0x70144[_0xd5f8('0x43')],{})[_0xd5f8('0x23')](respondWithResult(_0x5114dc,0xc9))[_0xd5f8('0x3f')](handleError(_0x5114dc,null));};exports['update']=function(_0x573bab,_0x5739fe){if(_0x573bab[_0xd5f8('0x43')]['id']){delete _0x573bab['body']['id'];}return db['JscriptySessionReport'][_0xd5f8('0x41')]({'where':{'id':_0x573bab[_0xd5f8('0x44')]['id']}})[_0xd5f8('0x23')](handleEntityNotFound(_0x5739fe,null))[_0xd5f8('0x23')](saveUpdates(_0x573bab[_0xd5f8('0x43')],null))[_0xd5f8('0x23')](respondWithResult(_0x5739fe,null))['catch'](handleError(_0x5739fe,null));};exports[_0xd5f8('0x24')]=function(_0x24bfb5,_0x179aea){return db[_0xd5f8('0x28')]['find']({'where':{'id':_0x24bfb5['params']['id']}})['then'](handleEntityNotFound(_0x179aea,null))[_0xd5f8('0x23')](removeEntity(_0x179aea,null))['catch'](handleError(_0x179aea,null));};exports['describe']=function(_0x5726d8,_0x5c1c7b){return db[_0xd5f8('0x28')][_0xd5f8('0x45')]()[_0xd5f8('0x23')](respondWithResult(_0x5c1c7b,null))['catch'](handleError(_0x5c1c7b,null));};exports[_0xd5f8('0x46')]=function(_0x4b3993,_0x906785,_0x5181b8){var _0x1daf0c={'raw':!![],'where':{}};var _0x35fc50={};var _0x205950={'count':0x0,'rows':[]};return db[_0xd5f8('0x28')]['findOne']({'where':{'id':_0x4b3993[_0xd5f8('0x44')]['id']}})['then'](handleEntityNotFound(_0x906785,null))[_0xd5f8('0x23')](function(_0x32e35d){if(_0x32e35d){_0x35fc50['model']=_['keys'](db[_0xd5f8('0x47')][_0xd5f8('0x48')]);_0x35fc50[_0xd5f8('0x2c')]=_[_0xd5f8('0x2d')](_0x4b3993[_0xd5f8('0x2c')]);_0x35fc50[_0xd5f8('0x2e')]=_['intersection'](_0x35fc50[_0xd5f8('0x2b')],_0x35fc50['query']);_0x1daf0c[_0xd5f8('0x31')]=_['intersection'](_0x35fc50['model'],qs[_0xd5f8('0x30')](_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x30')]));_0x1daf0c[_0xd5f8('0x31')]=_0x1daf0c[_0xd5f8('0x31')][_0xd5f8('0x40')]?_0x1daf0c[_0xd5f8('0x31')]:_0x35fc50[_0xd5f8('0x2b')];if(!_0x4b3993['query'][_0xd5f8('0x32')](_0xd5f8('0x33'))){_0x1daf0c['limit']=qs[_0xd5f8('0x34')](_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x34')]);_0x1daf0c[_0xd5f8('0x1e')]=qs[_0xd5f8('0x1e')](_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x1e')]);}_0x1daf0c[_0xd5f8('0x49')]=qs[_0xd5f8('0x35')](_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x35')]);_0x1daf0c[_0xd5f8('0x36')]=qs[_0xd5f8('0x2e')](_[_0xd5f8('0x4a')](_0x4b3993[_0xd5f8('0x2c')],_0x35fc50[_0xd5f8('0x2e')]));_0x1daf0c['where'][_0xd5f8('0x4b')]=_0x32e35d['id'];if(_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x37')]){_0x1daf0c[_0xd5f8('0x36')]=_[_0xd5f8('0x38')](_0x1daf0c[_0xd5f8('0x36')],{'$or':_[_0xd5f8('0x39')](_0x1daf0c[_0xd5f8('0x31')],function(_0x2e26bc){var _0x5897c6={};_0x5897c6[_0x2e26bc]={'$like':'%'+_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x37')]+'%'};return _0x5897c6;})});}_0x1daf0c=_[_0xd5f8('0x38')]({},_0x1daf0c,_0x4b3993[_0xd5f8('0x3c')]);return db[_0xd5f8('0x47')]['count']({'where':_0x1daf0c[_0xd5f8('0x36')]})[_0xd5f8('0x23')](function(_0x560329){_0x205950[_0xd5f8('0x1d')]=_0x560329;if(_0x4b3993[_0xd5f8('0x2c')][_0xd5f8('0x3d')]){_0x1daf0c['include']=[{'all':!![]}];}return db[_0xd5f8('0x47')][_0xd5f8('0x4c')](_0x1daf0c);})[_0xd5f8('0x23')](function(_0x37f217){_0x205950['rows']=_0x37f217;return _0x205950;});}})[_0xd5f8('0x23')](respondWithFilteredResult(_0x906785,_0x1daf0c))[_0xd5f8('0x3f')](handleError(_0x906785,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 5fc2496..3af899d 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 _0x1f71=['JscriptySessionReport','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define'];(function(_0xb87d55,_0x578ce1){var _0x1c31c8=function(_0x2c0c64){while(--_0x2c0c64){_0xb87d55['push'](_0xb87d55['shift']());}};_0x1c31c8(++_0x578ce1);}(_0x1f71,0xaa));var _0x11f7=function(_0x5994bb,_0x35648c){_0x5994bb=_0x5994bb-0x0;var _0x2e1e11=_0x1f71[_0x5994bb];return _0x2e1e11;};'use strict';var _=require('lodash');var util=require(_0x11f7('0x0'));var logger=require(_0x11f7('0x1'))(_0x11f7('0x2'));var moment=require(_0x11f7('0x3'));var BPromise=require(_0x11f7('0x4'));var rp=require(_0x11f7('0x5'));var fs=require('fs');var path=require(_0x11f7('0x6'));var rimraf=require(_0x11f7('0x7'));var config=require(_0x11f7('0x8'));var attributes=require(_0x11f7('0x9'));module[_0x11f7('0xa')]=function(_0x5110aa,_0x48f717){return _0x5110aa[_0x11f7('0xb')](_0x11f7('0xc'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06b3=['api','moment','bluebird','../../config/environment','./jscriptySessionReport.attributes','define','report_jscripty_sessions','util','../../config/logger'];(function(_0x23f00c,_0x36b416){var _0x26754f=function(_0x356e66){while(--_0x356e66){_0x23f00c['push'](_0x23f00c['shift']());}};_0x26754f(++_0x36b416);}(_0x06b3,0xcd));var _0x306b=function(_0x21b93f,_0x13044f){_0x21b93f=_0x21b93f-0x0;var _0x56d5c4=_0x06b3[_0x21b93f];return _0x56d5c4;};'use strict';var _=require('lodash');var util=require(_0x306b('0x0'));var logger=require(_0x306b('0x1'))(_0x306b('0x2'));var moment=require(_0x306b('0x3'));var BPromise=require(_0x306b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x306b('0x5'));var attributes=require(_0x306b('0x6'));module['exports']=function(_0x4adae4,_0x5177e5){return _0x4adae4[_0x306b('0x7')]('JscriptySessionReport',attributes,{'tableName':_0x306b('0x8'),'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 59fd69f..3877b2c 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 _0x1b48=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb'];(function(_0x26b908,_0x2d1d49){var _0x2dcaa2=function(_0x37077b){while(--_0x37077b){_0x26b908['push'](_0x26b908['shift']());}};_0x2dcaa2(++_0x2d1d49);}(_0x1b48,0xc2));var _0x81b4=function(_0x5f2647,_0x3dfa49){_0x5f2647=_0x5f2647-0x0;var _0xb95215=_0x1b48[_0x5f2647];return _0xb95215;};'use strict';var _=require('lodash');var util=require(_0x81b4('0x0'));var moment=require(_0x81b4('0x1'));var BPromise=require(_0x81b4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81b4('0x3'))['db'];var utils=require(_0x81b4('0x4'));var logger=require(_0x81b4('0x5'))(_0x81b4('0x6'));var config=require(_0x81b4('0x7'));var jayson=require(_0x81b4('0x8'));var client=jayson['client'][_0x81b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1153ff,_0x3d82f3,_0x194f41){return new BPromise(function(_0x28557e,_0xa81e87){return client[_0x81b4('0xa')](_0x1153ff,_0x194f41)[_0x81b4('0xb')](function(_0x4d1219){logger[_0x81b4('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x3d82f3,'request\x20sent');logger[_0x81b4('0xd')](_0x81b4('0xe'),_0x3d82f3,_0x81b4('0xf'),JSON[_0x81b4('0x10')](_0x4d1219));if(_0x4d1219[_0x81b4('0x11')]){if(_0x4d1219[_0x81b4('0x11')]['code']===0x1f4){logger[_0x81b4('0x11')](_0x81b4('0x12'),_0x3d82f3,_0x4d1219[_0x81b4('0x11')]['message']);return _0xa81e87(_0x4d1219[_0x81b4('0x11')][_0x81b4('0x13')]);}logger[_0x81b4('0x11')](_0x81b4('0x12'),_0x3d82f3,_0x4d1219['error'][_0x81b4('0x13')]);return _0x28557e(_0x4d1219['error'][_0x81b4('0x13')]);}else{logger['info'](_0x81b4('0x12'),_0x3d82f3,'request\x20sent');_0x28557e(_0x4d1219[_0x81b4('0x14')][_0x81b4('0x13')]);}})[_0x81b4('0x15')](function(_0x2e3801){logger[_0x81b4('0x11')](_0x81b4('0x12'),_0x3d82f3,_0x2e3801);_0xa81e87(_0x2e3801);});});} \ No newline at end of file +var _0x0be1=['then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http'];(function(_0x19dab2,_0x3432ff){var _0x456066=function(_0x2766a9){while(--_0x2766a9){_0x19dab2['push'](_0x19dab2['shift']());}};_0x456066(++_0x3432ff);}(_0x0be1,0x156));var _0x10be=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x0be1[_0x1a72f3];return _0x57ef47;};'use strict';var _=require(_0x10be('0x0'));var util=require(_0x10be('0x1'));var moment=require(_0x10be('0x2'));var BPromise=require(_0x10be('0x3'));var rs=require(_0x10be('0x4'));var fs=require('fs');var Redis=require(_0x10be('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x10be('0x6'));var logger=require('../../config/logger')(_0x10be('0x7'));var config=require('../../config/environment');var jayson=require(_0x10be('0x8'));var client=jayson['client'][_0x10be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe85996,_0x58ba04,_0x493ba2){return new BPromise(function(_0x5cbe05,_0x1b743e){return client['request'](_0xe85996,_0x493ba2)[_0x10be('0xa')](function(_0x3507c1){logger['info'](_0x10be('0xb'),_0x58ba04,_0x10be('0xc'));logger[_0x10be('0xd')](_0x10be('0xe'),_0x58ba04,_0x10be('0xc'),JSON[_0x10be('0xf')](_0x3507c1));if(_0x3507c1['error']){if(_0x3507c1[_0x10be('0x10')][_0x10be('0x11')]===0x1f4){logger[_0x10be('0x10')](_0x10be('0xb'),_0x58ba04,_0x3507c1['error'][_0x10be('0x12')]);return _0x1b743e(_0x3507c1[_0x10be('0x10')][_0x10be('0x12')]);}logger['error'](_0x10be('0xb'),_0x58ba04,_0x3507c1[_0x10be('0x10')][_0x10be('0x12')]);return _0x5cbe05(_0x3507c1[_0x10be('0x10')]['message']);}else{logger[_0x10be('0x13')](_0x10be('0xb'),_0x58ba04,'request\x20sent');_0x5cbe05(_0x3507c1[_0x10be('0x14')]['message']);}})[_0x10be('0x15')](function(_0x3f0dfb){logger[_0x10be('0x10')](_0x10be('0xb'),_0x58ba04,_0x3f0dfb);_0x1b743e(_0x3f0dfb);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 85e9b69..aec33f1 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 _0x9d54=['../../config/environment','./license.controller','get','put','/:id','isAuthenticated','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9d54,0x19d));var _0x49d5=function(_0x48762c,_0x2c00e6){_0x48762c=_0x48762c-0x0;var _0x11296b=_0x9d54[_0x48762c];return _0x11296b;};'use strict';var multer=require(_0x49d5('0x0'));var util=require(_0x49d5('0x1'));var path=require(_0x49d5('0x2'));var timeout=require('connect-timeout');var express=require(_0x49d5('0x3'));var router=express[_0x49d5('0x4')]();var auth=require(_0x49d5('0x5'));var interaction=require(_0x49d5('0x6'));var config=require(_0x49d5('0x7'));var controller=require(_0x49d5('0x8'));router[_0x49d5('0x9')]('/',controller['index']);router[_0x49d5('0xa')](_0x49d5('0xb'),auth[_0x49d5('0xc')](),controller[_0x49d5('0xd')]);module[_0x49d5('0xe')]=router; \ No newline at end of file +var _0x9850=['../../config/environment','./license.controller','index','put','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x9850,0x157));var _0x0985=function(_0x8268d4,_0x5e608c){_0x8268d4=_0x8268d4-0x0;var _0x28b12f=_0x9850[_0x8268d4];return _0x28b12f;};'use strict';var multer=require(_0x0985('0x0'));var util=require(_0x0985('0x1'));var path=require(_0x0985('0x2'));var timeout=require(_0x0985('0x3'));var express=require(_0x0985('0x4'));var router=express[_0x0985('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0985('0x6'));var config=require(_0x0985('0x7'));var controller=require(_0x0985('0x8'));router['get']('/',controller[_0x0985('0x9')]);router[_0x0985('0xa')]('/:id',auth[_0x0985('0xb')](),controller[_0x0985('0xc')]);module[_0x0985('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 90de53a..55d62a7 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 _0x31f0=['TEXT','STRING','INTEGER','sequelize'];(function(_0x1e1d07,_0x299b1e){var _0x225dce=function(_0x21fb0a){while(--_0x21fb0a){_0x1e1d07['push'](_0x1e1d07['shift']());}};_0x225dce(++_0x299b1e);}(_0x31f0,0xb7));var _0x031f=function(_0x2264cd,_0x5eccdf){_0x2264cd=_0x2264cd-0x0;var _0xb422e0=_0x31f0[_0x2264cd];return _0xb422e0;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'license':{'type':Sequelize[_0x031f('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x031f('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x031f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x326f=['STRING','INTEGER','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x326f,0xd1));var _0xf326=function(_0x5cdc39,_0x5a69e7){_0x5cdc39=_0x5cdc39-0x0;var _0x37be04=_0x326f[_0x5cdc39];return _0x37be04;};'use strict';var Sequelize=require(_0xf326('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0xf326('0x1')]},'data2':{'type':Sequelize[_0xf326('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xf326('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index ebb4ba3..a884b05 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 _0x0dd3=['intersection','attributes','fields','merge','options','getLicense','body','find','get','checkLicense','key','demo','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','apply','save','update','then','destroy','error','name','send','../../config/license/util','model','License','rawAttributes','query','keys','filters'];(function(_0x3a1b66,_0x23203c){var _0x217090=function(_0x308d14){while(--_0x308d14){_0x3a1b66['push'](_0x3a1b66['shift']());}};_0x217090(++_0x23203c);}(_0x0dd3,0x1cd));var _0x30dd=function(_0x235484,_0x5c9e03){_0x235484=_0x235484-0x0;var _0x367a5d=_0x0dd3[_0x235484];return _0x367a5d;};'use strict';var pdf=require(_0x30dd('0x0'));var emlformat=require(_0x30dd('0x1'));var rimraf=require(_0x30dd('0x2'));var zipdir=require(_0x30dd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30dd('0x4'));var moment=require(_0x30dd('0x5'));var BPromise=require(_0x30dd('0x6'));var Mustache=require(_0x30dd('0x7'));var util=require(_0x30dd('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x30dd('0x9'));var ejs=require(_0x30dd('0xa'));var fs=require('fs');var _=require(_0x30dd('0xb'));var squel=require(_0x30dd('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x30dd('0xd'));var toCsv=require(_0x30dd('0x9'));var querystring=require(_0x30dd('0xe'));var Papa=require(_0x30dd('0xf'));var Redis=require(_0x30dd('0x10'));var authService=require(_0x30dd('0x11'));var qs=require(_0x30dd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30dd('0x13'));var logger=require(_0x30dd('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x30dd('0x15'));var db=require(_0x30dd('0x16'))['db'];function respondWithStatusCode(_0x42f216,_0x428e3a){_0x428e3a=_0x428e3a||0xcc;return function(_0x379ac5){if(_0x379ac5){return _0x42f216[_0x30dd('0x17')](_0x428e3a);}return _0x42f216[_0x30dd('0x18')](_0x428e3a)[_0x30dd('0x19')]();};}function respondWithResult(_0x20094f,_0x9824ac){_0x9824ac=_0x9824ac||0xc8;return function(_0x3b9a43){if(_0x3b9a43){return _0x20094f['status'](_0x9824ac)['json'](_0x3b9a43);}};}function respondWithFilteredResult(_0x2a7ba9,_0x52443e){return function(_0x2ccefc){if(_0x2ccefc){var _0x517184=_0x2ccefc[_0x30dd('0x1a')],_0xdf035d=_0x52443e[_0x30dd('0x1b')],_0x346b6b=_0x52443e['offset']+_0x52443e['limit'],_0x192815;if(_0x346b6b>=_0x517184){_0x346b6b=_0x517184;_0x192815=0xc8;}else{_0x192815=0xce;}_0x2a7ba9[_0x30dd('0x18')](_0x192815);return _0x2a7ba9['set']('Content-Range',_0xdf035d+'-'+_0x346b6b+'/'+_0x517184)['json'](_0x2ccefc);}return null;};}function patchUpdates(_0x283d69){return function(_0x1a72bb){try{jsonpatch[_0x30dd('0x1c')](_0x1a72bb,_0x283d69,!![]);}catch(_0x2ea908){return BPromise['reject'](_0x2ea908);}return _0x1a72bb[_0x30dd('0x1d')]();};}function saveUpdates(_0x5e5790,_0x37ea08){return function(_0x3cfba8){if(_0x3cfba8){return _0x3cfba8[_0x30dd('0x1e')](_0x5e5790)[_0x30dd('0x1f')](function(_0x1df909){return _0x1df909;});}return null;};}function removeEntity(_0x203645,_0x260f96){return function(_0x451157){if(_0x451157){return _0x451157[_0x30dd('0x20')]()[_0x30dd('0x1f')](function(){_0x203645['status'](0xcc)[_0x30dd('0x19')]();});}};}function handleEntityNotFound(_0x24e795,_0x3bfd7b){return function(_0x26a194){if(!_0x26a194){_0x24e795[_0x30dd('0x17')](0x194);}return _0x26a194;};}function handleError(_0x1a7655,_0x402ce6){_0x402ce6=_0x402ce6||0x1f4;return function(_0x1ef77f){logger[_0x30dd('0x21')](_0x1ef77f['stack']);if(_0x1ef77f[_0x30dd('0x22')]){delete _0x1ef77f[_0x30dd('0x22')];}_0x1a7655[_0x30dd('0x18')](_0x402ce6)[_0x30dd('0x23')](_0x1ef77f);};}var utilLicense=require(_0x30dd('0x24'));exports['index']=function(_0x95b56,_0x5bd496){var _0x2fc98d={'raw':!![],'where':{'id':0x1}},_0x4d1076={};_0x4d1076[_0x30dd('0x25')]=_['keys'](db[_0x30dd('0x26')][_0x30dd('0x27')]);_0x4d1076[_0x30dd('0x28')]=_[_0x30dd('0x29')](_0x95b56[_0x30dd('0x28')]);_0x4d1076[_0x30dd('0x2a')]=_[_0x30dd('0x2b')](_0x4d1076[_0x30dd('0x25')],_0x4d1076['query']);_0x2fc98d[_0x30dd('0x2c')]=_[_0x30dd('0x2b')](_0x4d1076[_0x30dd('0x25')],qs[_0x30dd('0x2d')](_0x95b56[_0x30dd('0x28')][_0x30dd('0x2d')]));_0x2fc98d[_0x30dd('0x2c')]=_0x2fc98d[_0x30dd('0x2c')]['length']?_0x2fc98d[_0x30dd('0x2c')]:_0x4d1076[_0x30dd('0x25')];_0x2fc98d=_[_0x30dd('0x2e')]({},_0x2fc98d,_0x95b56[_0x30dd('0x2f')]);return utilLicense[_0x30dd('0x30')](_0x2fc98d)[_0x30dd('0x1f')](respondWithResult(_0x5bd496,null))['catch'](handleError(_0x5bd496,null));};exports[_0x30dd('0x1e')]=function(_0x10523b,_0x10f7e9){if(_0x10523b['body']['id']){delete _0x10523b[_0x30dd('0x31')]['id'];}return db['License'][_0x30dd('0x32')]({'where':{'id':_0x10523b['params']['id']}})['then'](handleEntityNotFound(_0x10f7e9,null))['then'](function(_0x503cd0){var _0x47d8eb=_0x503cd0[_0x30dd('0x33')]({'plain':!![]});return utilLicense[_0x30dd('0x34')](_0x47d8eb,_0x10523b[_0x30dd('0x31')][_0x30dd('0x35')]);})[_0x30dd('0x1f')](function(_0xc33c86){if(!_0xc33c86[_0x30dd('0x36')]){return saveUpdates(_0x10523b[_0x30dd('0x31')],null);}return _0xc33c86;})[_0x30dd('0x1f')](respondWithResult(_0x10f7e9,null))[_0x30dd('0x37')](handleError(_0x10f7e9,null));}; \ No newline at end of file +var _0x1e8c=['update','then','destroy','error','name','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','getLicense','catch','body','find','params','get','checkLicense','key','demo','html-pdf','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','set','Content-Range','apply','reject','save'];(function(_0x599b73,_0x12cb1d){var _0x416aa4=function(_0x261003){while(--_0x261003){_0x599b73['push'](_0x599b73['shift']());}};_0x416aa4(++_0x12cb1d);}(_0x1e8c,0xc5));var _0xc1e8=function(_0x21f3c3,_0x42e32c){_0x21f3c3=_0x21f3c3-0x0;var _0x15957=_0x1e8c[_0x21f3c3];return _0x15957;};'use strict';var pdf=require(_0xc1e8('0x0'));var emlformat=require(_0xc1e8('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc1e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc1e8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc1e8('0x4'));var util=require(_0xc1e8('0x5'));var path=require(_0xc1e8('0x6'));var sox=require(_0xc1e8('0x7'));var csv=require(_0xc1e8('0x8'));var ejs=require(_0xc1e8('0x9'));var fs=require('fs');var _=require(_0xc1e8('0xa'));var squel=require('squel');var crypto=require(_0xc1e8('0xb'));var jsforce=require(_0xc1e8('0xc'));var deskjs=require(_0xc1e8('0xd'));var toCsv=require(_0xc1e8('0x8'));var querystring=require(_0xc1e8('0xe'));var Papa=require(_0xc1e8('0xf'));var Redis=require('ioredis');var authService=require(_0xc1e8('0x10'));var qs=require(_0xc1e8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc1e8('0x12'))('api');var utils=require(_0xc1e8('0x13'));var config=require(_0xc1e8('0x14'));var db=require(_0xc1e8('0x15'))['db'];function respondWithStatusCode(_0x19d7ff,_0x2eadb3){_0x2eadb3=_0x2eadb3||0xcc;return function(_0x59e876){if(_0x59e876){return _0x19d7ff[_0xc1e8('0x16')](_0x2eadb3);}return _0x19d7ff[_0xc1e8('0x17')](_0x2eadb3)[_0xc1e8('0x18')]();};}function respondWithResult(_0x2f1c8d,_0x474129){_0x474129=_0x474129||0xc8;return function(_0x407cee){if(_0x407cee){return _0x2f1c8d[_0xc1e8('0x17')](_0x474129)[_0xc1e8('0x19')](_0x407cee);}};}function respondWithFilteredResult(_0x5db2f5,_0x5692c6){return function(_0x3e1abf){if(_0x3e1abf){var _0x46f9a5=_0x3e1abf['count'],_0x58f1b6=_0x5692c6['offset'],_0x17ea23=_0x5692c6['offset']+_0x5692c6['limit'],_0x2962f1;if(_0x17ea23>=_0x46f9a5){_0x17ea23=_0x46f9a5;_0x2962f1=0xc8;}else{_0x2962f1=0xce;}_0x5db2f5['status'](_0x2962f1);return _0x5db2f5[_0xc1e8('0x1a')](_0xc1e8('0x1b'),_0x58f1b6+'-'+_0x17ea23+'/'+_0x46f9a5)[_0xc1e8('0x19')](_0x3e1abf);}return null;};}function patchUpdates(_0x4b27a0){return function(_0xaec8ac){try{jsonpatch[_0xc1e8('0x1c')](_0xaec8ac,_0x4b27a0,!![]);}catch(_0x2e27f1){return BPromise[_0xc1e8('0x1d')](_0x2e27f1);}return _0xaec8ac[_0xc1e8('0x1e')]();};}function saveUpdates(_0x46a4b6,_0x3c3ca8){return function(_0x1d6dc6){if(_0x1d6dc6){return _0x1d6dc6[_0xc1e8('0x1f')](_0x46a4b6)[_0xc1e8('0x20')](function(_0x443ad8){return _0x443ad8;});}return null;};}function removeEntity(_0x40b57c,_0x29e6ee){return function(_0x409a13){if(_0x409a13){return _0x409a13[_0xc1e8('0x21')]()['then'](function(){_0x40b57c['status'](0xcc)[_0xc1e8('0x18')]();});}};}function handleEntityNotFound(_0x38f683,_0x54af19){return function(_0x4eaeb8){if(!_0x4eaeb8){_0x38f683['sendStatus'](0x194);}return _0x4eaeb8;};}function handleError(_0x363d2a,_0x5440ce){_0x5440ce=_0x5440ce||0x1f4;return function(_0x9ee291){logger[_0xc1e8('0x22')](_0x9ee291['stack']);if(_0x9ee291[_0xc1e8('0x23')]){delete _0x9ee291[_0xc1e8('0x23')];}_0x363d2a[_0xc1e8('0x17')](_0x5440ce)['send'](_0x9ee291);};}var utilLicense=require('../../config/license/util');exports[_0xc1e8('0x24')]=function(_0x5f2601,_0x4ca011){var _0x2985bf={'raw':!![],'where':{'id':0x1}},_0x558232={};_0x558232[_0xc1e8('0x25')]=_[_0xc1e8('0x26')](db[_0xc1e8('0x27')][_0xc1e8('0x28')]);_0x558232['query']=_['keys'](_0x5f2601[_0xc1e8('0x29')]);_0x558232[_0xc1e8('0x2a')]=_[_0xc1e8('0x2b')](_0x558232[_0xc1e8('0x25')],_0x558232[_0xc1e8('0x29')]);_0x2985bf[_0xc1e8('0x2c')]=_[_0xc1e8('0x2b')](_0x558232[_0xc1e8('0x25')],qs[_0xc1e8('0x2d')](_0x5f2601[_0xc1e8('0x29')][_0xc1e8('0x2d')]));_0x2985bf[_0xc1e8('0x2c')]=_0x2985bf[_0xc1e8('0x2c')][_0xc1e8('0x2e')]?_0x2985bf[_0xc1e8('0x2c')]:_0x558232[_0xc1e8('0x25')];_0x2985bf=_[_0xc1e8('0x2f')]({},_0x2985bf,_0x5f2601['options']);return utilLicense[_0xc1e8('0x30')](_0x2985bf)[_0xc1e8('0x20')](respondWithResult(_0x4ca011,null))[_0xc1e8('0x31')](handleError(_0x4ca011,null));};exports[_0xc1e8('0x1f')]=function(_0x44af79,_0x29caf0){if(_0x44af79[_0xc1e8('0x32')]['id']){delete _0x44af79[_0xc1e8('0x32')]['id'];}return db[_0xc1e8('0x27')][_0xc1e8('0x33')]({'where':{'id':_0x44af79[_0xc1e8('0x34')]['id']}})[_0xc1e8('0x20')](handleEntityNotFound(_0x29caf0,null))[_0xc1e8('0x20')](function(_0x24750d){var _0x232d2d=_0x24750d[_0xc1e8('0x35')]({'plain':!![]});return utilLicense[_0xc1e8('0x36')](_0x232d2d,_0x44af79[_0xc1e8('0x32')][_0xc1e8('0x37')]);})[_0xc1e8('0x20')](function(_0x3196bb){if(!_0x3196bb[_0xc1e8('0x38')]){return saveUpdates(_0x44af79['body'],null);}return _0x3196bb;})['then'](respondWithResult(_0x29caf0,null))[_0xc1e8('0x31')](handleError(_0x29caf0,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index f2cdc71..59be0e3 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 _0x525e=['exports','define','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./license.attributes'];(function(_0x4d692a,_0x5c1506){var _0x9ef565=function(_0x2e17c8){while(--_0x2e17c8){_0x4d692a['push'](_0x4d692a['shift']());}};_0x9ef565(++_0x5c1506);}(_0x525e,0x78));var _0xe525=function(_0x423a08,_0x2448cb){_0x423a08=_0x423a08-0x0;var _0x1ee81e=_0x525e[_0x423a08];return _0x1ee81e;};'use strict';var _=require(_0xe525('0x0'));var util=require(_0xe525('0x1'));var logger=require(_0xe525('0x2'))(_0xe525('0x3'));var moment=require(_0xe525('0x4'));var BPromise=require(_0xe525('0x5'));var rp=require(_0xe525('0x6'));var fs=require('fs');var path=require(_0xe525('0x7'));var rimraf=require('rimraf');var config=require(_0xe525('0x8'));var attributes=require(_0xe525('0x9'));module[_0xe525('0xa')]=function(_0x59a6b6,_0x4c68a3){return _0x59a6b6[_0xe525('0xb')]('License',attributes,{'tableName':_0xe525('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbafd=['../../config/environment','exports','define','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xe4aed0,_0x34e4c2){var _0x25d87f=function(_0x59433c){while(--_0x59433c){_0xe4aed0['push'](_0xe4aed0['shift']());}};_0x25d87f(++_0x34e4c2);}(_0xbafd,0xac));var _0xdbaf=function(_0x276aa3,_0x4ca868){_0x276aa3=_0x276aa3-0x0;var _0x139ae5=_0xbafd[_0x276aa3];return _0x139ae5;};'use strict';var _=require(_0xdbaf('0x0'));var util=require(_0xdbaf('0x1'));var logger=require(_0xdbaf('0x2'))(_0xdbaf('0x3'));var moment=require(_0xdbaf('0x4'));var BPromise=require(_0xdbaf('0x5'));var rp=require(_0xdbaf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbaf('0x7'));var config=require(_0xdbaf('0x8'));var attributes=require('./license.attributes');module[_0xdbaf('0x9')]=function(_0x593cfc,_0xbc59f5){return _0x593cfc[_0xdbaf('0xa')]('License',attributes,{'tableName':_0xdbaf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index cde80e8..d6b919d 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 _0x58e5=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','License,\x20%s,\x20%s','message','result','catch'];(function(_0x3befb5,_0x35d658){var _0x19f257=function(_0x1a2bd4){while(--_0x1a2bd4){_0x3befb5['push'](_0x3befb5['shift']());}};_0x19f257(++_0x35d658);}(_0x58e5,0xd1));var _0x558e=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x58e5[_0xef8146];return _0x5a6cb0;};'use strict';var _=require(_0x558e('0x0'));var util=require(_0x558e('0x1'));var moment=require(_0x558e('0x2'));var BPromise=require(_0x558e('0x3'));var rs=require(_0x558e('0x4'));var fs=require('fs');var Redis=require(_0x558e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x558e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x558e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x558e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2887fe,_0xdf6e1e,_0x533a69){return new BPromise(function(_0x58c368,_0x5a26b8){return client['request'](_0x2887fe,_0x533a69)['then'](function(_0x29c7ac){logger[_0x558e('0x9')]('License,\x20%s,\x20%s',_0xdf6e1e,_0x558e('0xa'));logger[_0x558e('0xb')](_0x558e('0xc'),_0xdf6e1e,_0x558e('0xa'),JSON['stringify'](_0x29c7ac));if(_0x29c7ac[_0x558e('0xd')]){if(_0x29c7ac['error'][_0x558e('0xe')]===0x1f4){logger[_0x558e('0xd')](_0x558e('0xf'),_0xdf6e1e,_0x29c7ac[_0x558e('0xd')]['message']);return _0x5a26b8(_0x29c7ac[_0x558e('0xd')][_0x558e('0x10')]);}logger['error'](_0x558e('0xf'),_0xdf6e1e,_0x29c7ac[_0x558e('0xd')]['message']);return _0x58c368(_0x29c7ac[_0x558e('0xd')]['message']);}else{logger[_0x558e('0x9')](_0x558e('0xf'),_0xdf6e1e,'request\x20sent');_0x58c368(_0x29c7ac[_0x558e('0x11')][_0x558e('0x10')]);}})[_0x558e('0x12')](function(_0x15040f){logger['error'](_0x558e('0xf'),_0xdf6e1e,_0x15040f);_0x5a26b8(_0x15040f);});});} \ No newline at end of file +var _0x38c9=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x4ffff8,_0x10bbdb){var _0x3915f6=function(_0x863c0b){while(--_0x863c0b){_0x4ffff8['push'](_0x4ffff8['shift']());}};_0x3915f6(++_0x10bbdb);}(_0x38c9,0x199));var _0x938c=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0x38c9[_0x4cd21c];return _0x5d8e5e;};'use strict';var _=require(_0x938c('0x0'));var util=require(_0x938c('0x1'));var moment=require(_0x938c('0x2'));var BPromise=require('bluebird');var rs=require(_0x938c('0x3'));var fs=require('fs');var Redis=require(_0x938c('0x4'));var db=require(_0x938c('0x5'))['db'];var utils=require(_0x938c('0x6'));var logger=require('../../config/logger')(_0x938c('0x7'));var config=require(_0x938c('0x8'));var jayson=require(_0x938c('0x9'));var client=jayson[_0x938c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x283d42,_0x332b40,_0x412b77){return new BPromise(function(_0x2dd9f4,_0x4aa9a5){return client['request'](_0x283d42,_0x412b77)[_0x938c('0xb')](function(_0x706ab){logger[_0x938c('0xc')](_0x938c('0xd'),_0x332b40,_0x938c('0xe'));logger[_0x938c('0xf')](_0x938c('0x10'),_0x332b40,_0x938c('0xe'),JSON[_0x938c('0x11')](_0x706ab));if(_0x706ab[_0x938c('0x12')]){if(_0x706ab[_0x938c('0x12')][_0x938c('0x13')]===0x1f4){logger[_0x938c('0x12')](_0x938c('0xd'),_0x332b40,_0x706ab[_0x938c('0x12')]['message']);return _0x4aa9a5(_0x706ab[_0x938c('0x12')]['message']);}logger[_0x938c('0x12')](_0x938c('0xd'),_0x332b40,_0x706ab[_0x938c('0x12')]['message']);return _0x2dd9f4(_0x706ab[_0x938c('0x12')][_0x938c('0x14')]);}else{logger['info'](_0x938c('0xd'),_0x332b40,_0x938c('0xe'));_0x2dd9f4(_0x706ab[_0x938c('0x15')][_0x938c('0x14')]);}})[_0x938c('0x16')](function(_0x5b5858){logger[_0x938c('0x12')](_0x938c('0xd'),_0x332b40,_0x5b5858);_0x4aa9a5(_0x5b5858);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 704862e..9bd9570 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 _0x77c3=['removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','put','update','delete','removeDispositions'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x77c3,0x99));var _0x377c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77c3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x377c('0x0'));var path=require(_0x377c('0x1'));var timeout=require(_0x377c('0x2'));var express=require('express');var router=express[_0x377c('0x3')]();var auth=require(_0x377c('0x4'));var interaction=require(_0x377c('0x5'));var config=require(_0x377c('0x6'));var controller=require(_0x377c('0x7'));router[_0x377c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x377c('0x8')](_0x377c('0x9'),auth[_0x377c('0xa')](),controller[_0x377c('0xb')]);router[_0x377c('0x8')](_0x377c('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x377c('0xd'),auth['isAuthenticated'](),controller[_0x377c('0xe')]);router[_0x377c('0x8')]('/:id/canned_answers',auth[_0x377c('0xa')](),controller[_0x377c('0xf')]);router[_0x377c('0x8')](_0x377c('0x10'),auth[_0x377c('0xa')](),controller[_0x377c('0x11')]);router[_0x377c('0x8')](_0x377c('0x12'),auth[_0x377c('0xa')](),controller[_0x377c('0x13')]);router['get'](_0x377c('0x14'),auth[_0x377c('0xa')](),controller[_0x377c('0x15')]);router['get'](_0x377c('0x16'),auth[_0x377c('0xa')](),controller[_0x377c('0x17')]);router[_0x377c('0x8')]('/:id/messages',auth[_0x377c('0xa')](),controller[_0x377c('0x18')]);router['get'](_0x377c('0x19'),auth[_0x377c('0xa')](),controller[_0x377c('0x1a')]);router['get']('/:id/users',auth[_0x377c('0xa')](),controller[_0x377c('0x1b')]);router[_0x377c('0x1c')](_0x377c('0xd'),auth['isAuthenticated'](),controller[_0x377c('0x1d')]);router[_0x377c('0x1c')](_0x377c('0x1e'),auth[_0x377c('0xa')](),controller[_0x377c('0x1f')]);router[_0x377c('0x1c')]('/',auth[_0x377c('0xa')](),controller[_0x377c('0x20')]);router[_0x377c('0x1c')](_0x377c('0x10'),auth[_0x377c('0xa')](),controller['addImap']);router[_0x377c('0x1c')](_0x377c('0x12'),auth[_0x377c('0xa')](),controller[_0x377c('0x21')]);router[_0x377c('0x1c')]('/:id/interactions',auth[_0x377c('0xa')](),controller[_0x377c('0x22')]);router['post'](_0x377c('0x16'),auth[_0x377c('0xa')](),controller[_0x377c('0x23')]);router['post']('/:id/send',auth[_0x377c('0xa')](),controller[_0x377c('0x24')]);router[_0x377c('0x1c')](_0x377c('0x25'),auth[_0x377c('0xa')](),controller[_0x377c('0x26')]);router[_0x377c('0x27')](_0x377c('0xc'),auth[_0x377c('0xa')](),controller[_0x377c('0x28')]);router[_0x377c('0x29')](_0x377c('0xd'),auth[_0x377c('0xa')](),controller[_0x377c('0x2a')]);router[_0x377c('0x29')](_0x377c('0x1e'),auth[_0x377c('0xa')](),controller[_0x377c('0x2b')]);router[_0x377c('0x29')](_0x377c('0x10'),auth['isAuthenticated'](),controller[_0x377c('0x2c')]);router[_0x377c('0x29')](_0x377c('0x12'),auth['isAuthenticated'](),controller[_0x377c('0x2d')]);router['delete']('/:id',auth[_0x377c('0xa')](),controller[_0x377c('0x2e')]);router[_0x377c('0x29')](_0x377c('0x25'),auth[_0x377c('0xa')](),controller[_0x377c('0x2f')]);module[_0x377c('0x30')]=router; \ No newline at end of file +var _0x464f=['describe','/:id','isAuthenticated','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','addDisposition','post','addAnswer','create','/:id/in_servers','addSmtp','addInteraction','addApplications','/:id/send','send','put','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get'];(function(_0x28db27,_0x298a47){var _0x4555a0=function(_0x216112){while(--_0x216112){_0x28db27['push'](_0x28db27['shift']());}};_0x4555a0(++_0x298a47);}(_0x464f,0xc8));var _0xf464=function(_0x551fbe,_0x3a78b3){_0x551fbe=_0x551fbe-0x0;var _0x5b02ac=_0x464f[_0x551fbe];return _0x5b02ac;};'use strict';var multer=require(_0xf464('0x0'));var util=require(_0xf464('0x1'));var path=require(_0xf464('0x2'));var timeout=require(_0xf464('0x3'));var express=require(_0xf464('0x4'));var router=express[_0xf464('0x5')]();var auth=require(_0xf464('0x6'));var interaction=require(_0xf464('0x7'));var config=require('../../config/environment');var controller=require(_0xf464('0x8'));router[_0xf464('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf464('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xf464('0xa')]);router[_0xf464('0x9')](_0xf464('0xb'),auth[_0xf464('0xc')](),controller['show']);router['get'](_0xf464('0xd'),auth[_0xf464('0xc')](),controller[_0xf464('0xe')]);router['get'](_0xf464('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xf464('0x9')]('/:id/in_servers',auth['isAuthenticated'](),controller['getImap']);router[_0xf464('0x9')](_0xf464('0x10'),auth[_0xf464('0xc')](),controller[_0xf464('0x11')]);router[_0xf464('0x9')](_0xf464('0x12'),auth['isAuthenticated'](),controller[_0xf464('0x13')]);router[_0xf464('0x9')](_0xf464('0x14'),auth[_0xf464('0xc')](),controller[_0xf464('0x15')]);router['get'](_0xf464('0x16'),auth[_0xf464('0xc')](),controller['getMessages']);router[_0xf464('0x9')](_0xf464('0x17'),auth[_0xf464('0xc')](),controller[_0xf464('0x18')]);router['get'](_0xf464('0x19'),auth[_0xf464('0xc')](),controller[_0xf464('0x1a')]);router['post'](_0xf464('0xd'),auth['isAuthenticated'](),controller[_0xf464('0x1b')]);router[_0xf464('0x1c')](_0xf464('0xf'),auth[_0xf464('0xc')](),controller[_0xf464('0x1d')]);router['post']('/',auth[_0xf464('0xc')](),controller[_0xf464('0x1e')]);router[_0xf464('0x1c')](_0xf464('0x1f'),auth['isAuthenticated'](),controller['addImap']);router[_0xf464('0x1c')](_0xf464('0x10'),auth['isAuthenticated'](),controller[_0xf464('0x20')]);router[_0xf464('0x1c')](_0xf464('0x12'),auth[_0xf464('0xc')](),controller[_0xf464('0x21')]);router[_0xf464('0x1c')](_0xf464('0x14'),auth['isAuthenticated'](),controller[_0xf464('0x22')]);router[_0xf464('0x1c')](_0xf464('0x23'),auth['isAuthenticated'](),controller[_0xf464('0x24')]);router['post'](_0xf464('0x19'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf464('0x25')](_0xf464('0xb'),auth[_0xf464('0xc')](),controller['update']);router[_0xf464('0x26')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0xf464('0x26')](_0xf464('0xf'),auth[_0xf464('0xc')](),controller[_0xf464('0x27')]);router[_0xf464('0x26')](_0xf464('0x1f'),auth[_0xf464('0xc')](),controller['removeImap']);router[_0xf464('0x26')]('/:id/out_servers',auth[_0xf464('0xc')](),controller['removeSmtp']);router[_0xf464('0x26')](_0xf464('0xb'),auth[_0xf464('0xc')](),controller['destroy']);router[_0xf464('0x26')](_0xf464('0x19'),auth[_0xf464('0xc')](),controller[_0xf464('0x28')]);module[_0xf464('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 23be884..a4966ce 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 _0x8928=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}'];(function(_0x147497,_0x43e433){var _0x35f45=function(_0x584421){while(--_0x584421){_0x147497['push'](_0x147497['shift']());}};_0x35f45(++_0x43e433);}(_0x8928,0xf7));var _0x8892=function(_0x536a17,_0xbae71a){_0x536a17=_0x536a17-0x0;var _0x57a17f=_0x8928[_0x536a17];return _0x57a17f;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x8892('0x0')]},'name':{'type':Sequelize[_0x8892('0x0')],'allowNull':![]},'service':{'type':Sequelize[_0x8892('0x1')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x8892('0x1')],'defaultValue':!![]},'key':{'type':Sequelize[_0x8892('0x0')],'allowNull':![]},'template':{'type':Sequelize[_0x8892('0x2')]},'markAsUnread':{'type':Sequelize[_0x8892('0x1')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x8892('0x0')],'allowNull':![],'defaultValue':_0x8892('0x3')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x8892('0x4')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x8892('0x5');}},'notificationSound':{'type':Sequelize[_0x8892('0x1')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8892('0x1')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8892('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8892('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x8892('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x8892('0x1')],'defaultValue':![],'comment':_0x8892('0x8'),'set':function(_0x42ab06){if(!_0x42ab06)this[_0x8892('0x9')](_0x8892('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x42ab06);}}}; \ No newline at end of file +var _0xee9a=['STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xee9a,0x98));var _0xaee9=function(_0x4c648f,_0x3977dd){_0x4c648f=_0x4c648f-0x0;var _0x1dc3e5=_0xee9a[_0x4c648f];return _0x1dc3e5;};'use strict';var Sequelize=require(_0xaee9('0x0'));module[_0xaee9('0x1')]={'description':{'type':Sequelize[_0xaee9('0x2')]},'name':{'type':Sequelize[_0xaee9('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xaee9('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xaee9('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xaee9('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xaee9('0x2')],'allowNull':![],'defaultValue':_0xaee9('0x4')},'fontSize':{'type':Sequelize[_0xaee9('0x5')](0x2)[_0xaee9('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xaee9('0x7')],'defaultValue':function(){return _0xaee9('0x8');}},'notificationSound':{'type':Sequelize[_0xaee9('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xaee9('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xaee9('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xaee9('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xaee9('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xaee9('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xaee9('0x3')],'defaultValue':![],'comment':_0xaee9('0xa'),'set':function(_0x14710d){if(!_0x14710d)this[_0xaee9('0xb')](_0xaee9('0xc'),null);this[_0xaee9('0xb')](_0xaee9('0xd'),_0x14710d);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 7041002..67c98c9 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 _0x2a58=['Contact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','CmContact','Contacts','updatedAt','DESC','from','attachments','join','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','messageId','attach','out','Interaction','Messages','verifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','MailAccount,\x20%s,\x20%s','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','get','UserProfileResource','name','index','Imap','Smtp','Pause','map','MailAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','MailServerIn','MailServerOut','mandatoryDispositionPause','include','options','find','body','params','describe','addDisposition','Disposition','create','getDispositions','findOne','MailAccountId','removeDispositions','ids','CannedAnswer','removeAnswers','email','ListId','isNil','active','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','removeSmtp','MailInteraction','omit','getInteractions'];(function(_0xc9cd47,_0x35a546){var _0x26827e=function(_0x32d967){while(--_0x32d967){_0xc9cd47['push'](_0xc9cd47['shift']());}};_0x26827e(++_0x35a546);}(_0x2a58,0xef));var _0x82a5=function(_0x52857c,_0x2cd3ce){_0x52857c=_0x52857c-0x0;var _0x1aa01e=_0x2a58[_0x52857c];return _0x1aa01e;};'use strict';var pdf=require(_0x82a5('0x0'));var emlformat=require(_0x82a5('0x1'));var rimraf=require(_0x82a5('0x2'));var zipdir=require(_0x82a5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82a5('0x4'));var moment=require(_0x82a5('0x5'));var BPromise=require(_0x82a5('0x6'));var Mustache=require(_0x82a5('0x7'));var util=require(_0x82a5('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x82a5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x82a5('0xa'));var squel=require('squel');var crypto=require(_0x82a5('0xb'));var jsforce=require(_0x82a5('0xc'));var deskjs=require(_0x82a5('0xd'));var toCsv=require('to-csv');var querystring=require(_0x82a5('0xe'));var Papa=require(_0x82a5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x82a5('0x10'));var as=require(_0x82a5('0x11'));var hardwareService=require(_0x82a5('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x82a5('0x13'));var config=require(_0x82a5('0x14'));var db=require(_0x82a5('0x15'))['db'];config[_0x82a5('0x16')]=_['defaults'](config[_0x82a5('0x16')],{'host':_0x82a5('0x17'),'port':0x18eb});var socket=require(_0x82a5('0x18'))(new Redis(config[_0x82a5('0x16')]));require(_0x82a5('0x19'))[_0x82a5('0x1a')](socket);var jayson=require(_0x82a5('0x1b'));var client=jayson[_0x82a5('0x1c')][_0x82a5('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x37c1eb,_0x56be7e,_0x34d025){if(_0x34d025){var _0x39f49e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x39f49e[_0x82a5('0x1e')](_0x56be7e)){return _0x37c1eb;}else{throw new db[(_0x82a5('0x1f'))][(_0x82a5('0x20'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x37c1eb;}}function respondWithRpcPromise(_0x473f02,_0x1a307b,_0x3cbb30,_0x1a5f39){return new BPromise(function(_0x37ecae,_0x575d3b){var _0x1de5b2=_0x1a5f39||client;return _0x1de5b2[_0x82a5('0x21')](_0x473f02,_0x3cbb30)[_0x82a5('0x22')](function(_0x109673){logger[_0x82a5('0x23')]('MailAccount,\x20%s,\x20%s',_0x1a307b,_0x82a5('0x24'));logger[_0x82a5('0x25')](_0x82a5('0x26'),_0x1a307b,'request\x20sent',JSON['stringify'](_0x109673));if(_0x109673[_0x82a5('0x27')]){if(_0x109673[_0x82a5('0x27')][_0x82a5('0x28')]===0x1f4){logger[_0x82a5('0x27')]('MailAccount,\x20%s,\x20%s',_0x1a307b,_0x109673['error'][_0x82a5('0x29')]);return _0x575d3b(_0x109673['error'][_0x82a5('0x29')]);}logger[_0x82a5('0x27')](_0x82a5('0x2a'),_0x1a307b,_0x109673[_0x82a5('0x27')]['message']);return _0x37ecae(_0x109673[_0x82a5('0x27')]['message']);}else{logger[_0x82a5('0x23')](_0x82a5('0x2a'),_0x1a307b,'request\x20sent');_0x37ecae(_0x109673['result']['message']);}})[_0x82a5('0x2b')](function(_0x1a613f){logger['error'](_0x82a5('0x2a'),_0x1a307b,_0x1a613f);_0x575d3b(_0x1a613f);});});}function respondWithStatusCode(_0x5df928,_0x573850){_0x573850=_0x573850||0xcc;return function(_0x1ab2f0){if(_0x1ab2f0){return _0x5df928[_0x82a5('0x2c')](_0x573850);}return _0x5df928[_0x82a5('0x2d')](_0x573850)[_0x82a5('0x2e')]();};}function respondWithResult(_0x2563ac,_0x3be6b1){_0x3be6b1=_0x3be6b1||0xc8;return function(_0x5d0c91){if(_0x5d0c91){return _0x2563ac[_0x82a5('0x2d')](_0x3be6b1)[_0x82a5('0x2f')](_0x5d0c91);}};}function respondWithFilteredResult(_0xb27bf9,_0x471593){return function(_0x26953d){if(_0x26953d){var _0x277ffb=_0x26953d[_0x82a5('0x30')],_0x2c2bec=_0x471593[_0x82a5('0x31')],_0x36449=_0x471593[_0x82a5('0x31')]+_0x471593[_0x82a5('0x32')],_0x3e73cb;if(_0x36449>=_0x277ffb){_0x36449=_0x277ffb;_0x3e73cb=0xc8;}else{_0x3e73cb=0xce;}_0xb27bf9['status'](_0x3e73cb);return _0xb27bf9[_0x82a5('0x33')](_0x82a5('0x34'),_0x2c2bec+'-'+_0x36449+'/'+_0x277ffb)['json'](_0x26953d);}return null;};}function patchUpdates(_0x45ff53){return function(_0x2e0e4a){try{jsonpatch['apply'](_0x2e0e4a,_0x45ff53,!![]);}catch(_0x2db65d){return BPromise[_0x82a5('0x35')](_0x2db65d);}return _0x2e0e4a['save']();};}function saveUpdates(_0x2ee4d6,_0x424f0a){return function(_0x3dfc33){if(_0x3dfc33){return _0x3dfc33[_0x82a5('0x36')](_0x2ee4d6)[_0x82a5('0x22')](function(_0x1934b1){return _0x1934b1;});}return null;};}function removeEntity(_0x58fe9a,_0x52fc14){return function(_0x6e84ee){if(_0x6e84ee){return _0x6e84ee[_0x82a5('0x37')]()[_0x82a5('0x22')](function(){var _0x2c11b4=_0x6e84ee[_0x82a5('0x38')]({'plain':!![]});var _0x31ec04='MailAccounts';return db[_0x82a5('0x39')][_0x82a5('0x37')]({'where':{'type':_0x31ec04,'resourceId':_0x2c11b4['id']}})['then'](function(){return _0x6e84ee;});})[_0x82a5('0x22')](function(){_0x58fe9a[_0x82a5('0x2d')](0xcc)[_0x82a5('0x2e')]();});}};}function handleEntityNotFound(_0x14f605,_0x4b8f2a){return function(_0x451c9b){if(!_0x451c9b){_0x14f605[_0x82a5('0x2c')](0x194);}return _0x451c9b;};}function handleError(_0x3236c3,_0x5aecdc){_0x5aecdc=_0x5aecdc||0x1f4;return function(_0x4bc7ee){logger['error'](_0x4bc7ee['stack']);if(_0x4bc7ee[_0x82a5('0x3a')]){delete _0x4bc7ee[_0x82a5('0x3a')];}_0x3236c3['status'](_0x5aecdc)['send'](_0x4bc7ee);};}exports[_0x82a5('0x3b')]=function(_0x2064d6,_0x55f857){var _0x19283f={'include':[{'model':db['MailServerIn'],'as':_0x82a5('0x3c')},{'model':db['MailServerOut'],'as':_0x82a5('0x3d')},{'model':db[_0x82a5('0x3e')],'as':'mandatoryDispositionPause'}]},_0x9a22f7={},_0x613ced={'count':0x0,'rows':[]};var _0x5e8303=_[_0x82a5('0x3f')](db[_0x82a5('0x40')][_0x82a5('0x41')],function(_0x187ef0){return{'name':_0x187ef0[_0x82a5('0x42')],'type':_0x187ef0[_0x82a5('0x43')][_0x82a5('0x44')]};});_0x9a22f7[_0x82a5('0x45')]=_[_0x82a5('0x3f')](_0x5e8303,_0x82a5('0x3a'));_0x9a22f7[_0x82a5('0x46')]=_[_0x82a5('0x47')](_0x2064d6[_0x82a5('0x46')]);_0x9a22f7[_0x82a5('0x48')]=_[_0x82a5('0x49')](_0x9a22f7['model'],_0x9a22f7[_0x82a5('0x46')]);_0x19283f[_0x82a5('0x4a')]=_[_0x82a5('0x49')](_0x9a22f7['model'],qs[_0x82a5('0x4b')](_0x2064d6[_0x82a5('0x46')][_0x82a5('0x4b')]));_0x19283f[_0x82a5('0x4a')]=_0x19283f[_0x82a5('0x4a')][_0x82a5('0x4c')]?_0x19283f[_0x82a5('0x4a')]:_0x9a22f7[_0x82a5('0x45')];if(!_0x2064d6[_0x82a5('0x46')][_0x82a5('0x4d')](_0x82a5('0x4e'))){_0x19283f[_0x82a5('0x32')]=qs[_0x82a5('0x32')](_0x2064d6['query'][_0x82a5('0x32')]);_0x19283f[_0x82a5('0x31')]=qs['offset'](_0x2064d6[_0x82a5('0x46')][_0x82a5('0x31')]);}_0x19283f[_0x82a5('0x4f')]=qs[_0x82a5('0x50')](_0x2064d6[_0x82a5('0x46')][_0x82a5('0x50')]);_0x19283f[_0x82a5('0x51')]=qs[_0x82a5('0x48')](_[_0x82a5('0x52')](_0x2064d6['query'],_0x9a22f7[_0x82a5('0x48')]));if(_0x2064d6[_0x82a5('0x46')][_0x82a5('0x53')]){_0x19283f[_0x82a5('0x51')]=_[_0x82a5('0x54')](_0x19283f[_0x82a5('0x51')],{'$or':_[_0x82a5('0x3f')](_0x5e8303,function(_0x56074c){if(_0x56074c[_0x82a5('0x43')]!==_0x82a5('0x55')){var _0x11998e={};_0x11998e[_0x56074c[_0x82a5('0x3a')]]={'$like':'%'+_0x2064d6['query'][_0x82a5('0x53')]+'%'};return _0x11998e;}})});}_0x19283f=_[_0x82a5('0x54')]({},_0x19283f,_0x2064d6['options']);var _0x1aa2b5={'where':_0x19283f[_0x82a5('0x51')]};return db[_0x82a5('0x40')][_0x82a5('0x30')](_0x1aa2b5)[_0x82a5('0x22')](function(_0x569406){_0x613ced[_0x82a5('0x30')]=_0x569406;if(_0x2064d6['query'][_0x82a5('0x56')]){_0x19283f['include']=[{'all':!![]}];}return db[_0x82a5('0x40')][_0x82a5('0x57')](_0x19283f);})[_0x82a5('0x22')](function(_0x113ebf){_0x613ced[_0x82a5('0x58')]=_0x113ebf;return _0x613ced;})[_0x82a5('0x22')](respondWithFilteredResult(_0x55f857,_0x19283f))['catch'](handleError(_0x55f857,null));};exports[_0x82a5('0x59')]=function(_0x2ebe80,_0x322c37){var _0x55b7c5={'raw':![],'where':{'id':_0x2ebe80['params']['id']},'include':[{'model':db[_0x82a5('0x5a')],'as':_0x82a5('0x3c')},{'model':db[_0x82a5('0x5b')],'as':_0x82a5('0x3d')},{'model':db[_0x82a5('0x3e')],'as':_0x82a5('0x5c')}]},_0x1b4acf={};_0x1b4acf[_0x82a5('0x45')]=_[_0x82a5('0x47')](db[_0x82a5('0x40')][_0x82a5('0x41')]);_0x1b4acf['query']=_[_0x82a5('0x47')](_0x2ebe80['query']);_0x1b4acf[_0x82a5('0x48')]=_[_0x82a5('0x49')](_0x1b4acf[_0x82a5('0x45')],_0x1b4acf[_0x82a5('0x46')]);_0x55b7c5[_0x82a5('0x4a')]=_[_0x82a5('0x49')](_0x1b4acf[_0x82a5('0x45')],qs[_0x82a5('0x4b')](_0x2ebe80[_0x82a5('0x46')][_0x82a5('0x4b')]));_0x55b7c5['attributes']=_0x55b7c5[_0x82a5('0x4a')][_0x82a5('0x4c')]?_0x55b7c5[_0x82a5('0x4a')]:_0x1b4acf[_0x82a5('0x45')];if(_0x2ebe80[_0x82a5('0x46')][_0x82a5('0x56')]){_0x55b7c5[_0x82a5('0x5d')]=[{'all':!![]}];}_0x55b7c5=_[_0x82a5('0x54')]({},_0x55b7c5,_0x2ebe80[_0x82a5('0x5e')]);return db[_0x82a5('0x40')][_0x82a5('0x5f')](_0x55b7c5)['then'](handleEntityNotFound(_0x322c37,null))['then'](respondWithResult(_0x322c37,null))['catch'](handleError(_0x322c37,null));};exports['update']=function(_0x486995,_0x565e05){if(_0x486995[_0x82a5('0x60')]['id']){delete _0x486995['body']['id'];}return db[_0x82a5('0x40')][_0x82a5('0x5f')]({'where':{'id':_0x486995[_0x82a5('0x61')]['id']},'include':[{'model':db[_0x82a5('0x5a')],'as':_0x82a5('0x3c')},{'model':db[_0x82a5('0x5b')],'as':_0x82a5('0x3d')},{'model':db['Pause'],'as':_0x82a5('0x5c')}]})[_0x82a5('0x22')](handleEntityNotFound(_0x565e05,null))['then'](saveUpdates(_0x486995[_0x82a5('0x60')],null))[_0x82a5('0x22')](function(_0x15729a){if(_0x15729a&&_0x486995[_0x82a5('0x60')][_0x82a5('0x3c')]){return db[_0x82a5('0x5a')][_0x82a5('0x36')](_0x486995[_0x82a5('0x60')]['Imap'],{'where':{'MailAccountId':_0x15729a['id']}})[_0x82a5('0x22')](function(){return _0x15729a;});}return _0x15729a;})[_0x82a5('0x22')](function(_0xdf0d94){if(_0xdf0d94&&_0x486995[_0x82a5('0x60')][_0x82a5('0x3d')]){return db[_0x82a5('0x5b')]['update'](_0x486995['body'][_0x82a5('0x3d')],{'where':{'MailAccountId':_0xdf0d94['id']}})[_0x82a5('0x22')](function(){return _0xdf0d94;});}return _0xdf0d94;})[_0x82a5('0x22')](respondWithResult(_0x565e05,null))[_0x82a5('0x2b')](handleError(_0x565e05,null));};exports[_0x82a5('0x62')]=function(_0x34072f,_0x2f9ab3){return db[_0x82a5('0x40')][_0x82a5('0x62')]()[_0x82a5('0x22')](respondWithResult(_0x2f9ab3,null))[_0x82a5('0x2b')](handleError(_0x2f9ab3,null));};exports[_0x82a5('0x63')]=function(_0x19eaf3,_0x130b8c,_0x107c09){if(_0x19eaf3[_0x82a5('0x60')]['id']){delete _0x19eaf3[_0x82a5('0x60')]['id'];}return db[_0x82a5('0x40')]['find']({'where':{'id':_0x19eaf3[_0x82a5('0x61')]['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x130b8c,null))[_0x82a5('0x22')](function(_0x58fa1d){if(_0x58fa1d){_0x19eaf3[_0x82a5('0x60')]['MailAccountId']=_0x58fa1d['id'];return db[_0x82a5('0x64')][_0x82a5('0x65')](_0x19eaf3[_0x82a5('0x60')]);}})[_0x82a5('0x22')](respondWithResult(_0x130b8c,null))[_0x82a5('0x2b')](handleError(_0x130b8c,null));};exports[_0x82a5('0x66')]=function(_0xd24467,_0x28a0d8,_0x5c4531){var _0x225110={'raw':![],'where':{}};var _0x3e3ac0={};var _0x5a084c={'count':0x0,'rows':[]};return db[_0x82a5('0x40')][_0x82a5('0x67')]({'where':{'id':_0xd24467['params']['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x28a0d8,null))[_0x82a5('0x22')](function(_0x62dcec){if(_0x62dcec){_0x3e3ac0[_0x82a5('0x45')]=_[_0x82a5('0x47')](db[_0x82a5('0x64')][_0x82a5('0x41')]);_0x3e3ac0[_0x82a5('0x46')]=_[_0x82a5('0x47')](_0xd24467[_0x82a5('0x46')]);_0x3e3ac0[_0x82a5('0x48')]=_[_0x82a5('0x49')](_0x3e3ac0['model'],_0x3e3ac0[_0x82a5('0x46')]);_0x225110[_0x82a5('0x4a')]=_[_0x82a5('0x49')](_0x3e3ac0[_0x82a5('0x45')],qs[_0x82a5('0x4b')](_0xd24467['query'][_0x82a5('0x4b')]));_0x225110[_0x82a5('0x4a')]=_0x225110[_0x82a5('0x4a')][_0x82a5('0x4c')]?_0x225110[_0x82a5('0x4a')]:_0x3e3ac0[_0x82a5('0x45')];if(!_0xd24467[_0x82a5('0x46')][_0x82a5('0x4d')]('nolimit')){_0x225110[_0x82a5('0x32')]=qs[_0x82a5('0x32')](_0xd24467['query']['limit']);_0x225110[_0x82a5('0x31')]=qs[_0x82a5('0x31')](_0xd24467[_0x82a5('0x46')][_0x82a5('0x31')]);}_0x225110[_0x82a5('0x4f')]=qs[_0x82a5('0x50')](_0xd24467['query'][_0x82a5('0x50')]);_0x225110['where']=qs[_0x82a5('0x48')](_['pick'](_0xd24467[_0x82a5('0x46')],_0x3e3ac0[_0x82a5('0x48')]));_0x225110[_0x82a5('0x51')][_0x82a5('0x68')]=_0x62dcec['id'];if(_0xd24467['query'][_0x82a5('0x53')]){_0x225110[_0x82a5('0x51')]=_['merge'](_0x225110[_0x82a5('0x51')],{'$or':_[_0x82a5('0x3f')](_0x225110[_0x82a5('0x4a')],function(_0x5b2b72){var _0x1a4a6b={};_0x1a4a6b[_0x5b2b72]={'$like':'%'+_0xd24467[_0x82a5('0x46')][_0x82a5('0x53')]+'%'};return _0x1a4a6b;})});}_0x225110=_[_0x82a5('0x54')]({},_0x225110,_0xd24467[_0x82a5('0x5e')]);return db[_0x82a5('0x64')][_0x82a5('0x30')]({'where':_0x225110['where']})[_0x82a5('0x22')](function(_0x5577e4){_0x5a084c['count']=_0x5577e4;if(_0xd24467[_0x82a5('0x46')]['includeAll']){_0x225110[_0x82a5('0x5d')]=[{'all':!![]}];}return db[_0x82a5('0x64')][_0x82a5('0x57')](_0x225110);})[_0x82a5('0x22')](function(_0x14cfc){_0x5a084c[_0x82a5('0x58')]=_0x14cfc;return _0x5a084c;});}})[_0x82a5('0x22')](respondWithFilteredResult(_0x28a0d8,_0x225110))[_0x82a5('0x2b')](handleError(_0x28a0d8,null));};exports[_0x82a5('0x69')]=function(_0x1c0942,_0x1eaf31,_0x29eb0c){return db[_0x82a5('0x40')][_0x82a5('0x5f')]({'where':{'id':_0x1c0942[_0x82a5('0x61')]['id']}})['then'](handleEntityNotFound(_0x1eaf31,null))[_0x82a5('0x22')](function(_0x305d70){if(_0x305d70){return _0x305d70['removeDispositions'](_0x1c0942[_0x82a5('0x46')][_0x82a5('0x6a')]);}})[_0x82a5('0x22')](respondWithStatusCode(_0x1eaf31,null))[_0x82a5('0x2b')](handleError(_0x1eaf31,null));};exports['addAnswer']=function(_0x5b26e5,_0x3777f7,_0x2a8393){if(_0x5b26e5[_0x82a5('0x60')]['id']){delete _0x5b26e5[_0x82a5('0x60')]['id'];}return db['MailAccount'][_0x82a5('0x5f')]({'where':{'id':_0x5b26e5[_0x82a5('0x61')]['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x3777f7,null))[_0x82a5('0x22')](function(_0x3766bf){if(_0x3766bf){_0x5b26e5[_0x82a5('0x60')][_0x82a5('0x68')]=_0x3766bf['id'];return db[_0x82a5('0x6b')][_0x82a5('0x65')](_0x5b26e5['body']);}})['then'](respondWithResult(_0x3777f7,null))[_0x82a5('0x2b')](handleError(_0x3777f7,null));};exports['getAnswers']=function(_0x16bbe3,_0x2e5d0b,_0x22d9ab){var _0x172e79={'raw':![],'where':{}};var _0x43fdc8={};var _0x32033d={'count':0x0,'rows':[]};return db['MailAccount'][_0x82a5('0x67')]({'where':{'id':_0x16bbe3['params']['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x2e5d0b,null))[_0x82a5('0x22')](function(_0x81d23a){if(_0x81d23a){_0x43fdc8['model']=_[_0x82a5('0x47')](db[_0x82a5('0x6b')][_0x82a5('0x41')]);_0x43fdc8[_0x82a5('0x46')]=_[_0x82a5('0x47')](_0x16bbe3[_0x82a5('0x46')]);_0x43fdc8[_0x82a5('0x48')]=_[_0x82a5('0x49')](_0x43fdc8[_0x82a5('0x45')],_0x43fdc8[_0x82a5('0x46')]);_0x172e79['attributes']=_[_0x82a5('0x49')](_0x43fdc8[_0x82a5('0x45')],qs['fields'](_0x16bbe3['query'][_0x82a5('0x4b')]));_0x172e79[_0x82a5('0x4a')]=_0x172e79[_0x82a5('0x4a')][_0x82a5('0x4c')]?_0x172e79['attributes']:_0x43fdc8[_0x82a5('0x45')];if(!_0x16bbe3[_0x82a5('0x46')][_0x82a5('0x4d')]('nolimit')){_0x172e79[_0x82a5('0x32')]=qs[_0x82a5('0x32')](_0x16bbe3[_0x82a5('0x46')][_0x82a5('0x32')]);_0x172e79[_0x82a5('0x31')]=qs['offset'](_0x16bbe3[_0x82a5('0x46')][_0x82a5('0x31')]);}_0x172e79[_0x82a5('0x4f')]=qs[_0x82a5('0x50')](_0x16bbe3[_0x82a5('0x46')][_0x82a5('0x50')]);_0x172e79[_0x82a5('0x51')]=qs['filters'](_[_0x82a5('0x52')](_0x16bbe3[_0x82a5('0x46')],_0x43fdc8[_0x82a5('0x48')]));_0x172e79[_0x82a5('0x51')][_0x82a5('0x68')]=_0x81d23a['id'];if(_0x16bbe3[_0x82a5('0x46')][_0x82a5('0x53')]){_0x172e79['where']=_[_0x82a5('0x54')](_0x172e79['where'],{'$or':_[_0x82a5('0x3f')](_0x172e79[_0x82a5('0x4a')],function(_0x13e690){var _0xdf761b={};_0xdf761b[_0x13e690]={'$like':'%'+_0x16bbe3[_0x82a5('0x46')]['filter']+'%'};return _0xdf761b;})});}_0x172e79=_[_0x82a5('0x54')]({},_0x172e79,_0x16bbe3[_0x82a5('0x5e')]);return db[_0x82a5('0x6b')][_0x82a5('0x30')]({'where':_0x172e79[_0x82a5('0x51')]})[_0x82a5('0x22')](function(_0x3c758e){_0x32033d[_0x82a5('0x30')]=_0x3c758e;if(_0x16bbe3['query'][_0x82a5('0x56')]){_0x172e79[_0x82a5('0x5d')]=[{'all':!![]}];}return db[_0x82a5('0x6b')]['findAll'](_0x172e79);})['then'](function(_0x3a37d4){_0x32033d[_0x82a5('0x58')]=_0x3a37d4;return _0x32033d;});}})[_0x82a5('0x22')](respondWithFilteredResult(_0x2e5d0b,_0x172e79))['catch'](handleError(_0x2e5d0b,null));};exports[_0x82a5('0x6c')]=function(_0x27c71e,_0x170963,_0x3ac805){return db[_0x82a5('0x40')][_0x82a5('0x5f')]({'where':{'id':_0x27c71e[_0x82a5('0x61')]['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x170963,null))['then'](function(_0xa0a84a){if(_0xa0a84a){return _0xa0a84a[_0x82a5('0x6c')](_0x27c71e[_0x82a5('0x46')][_0x82a5('0x6a')]);}})['then'](respondWithStatusCode(_0x170963,null))[_0x82a5('0x2b')](handleError(_0x170963,null));};exports['create']=function(_0x1d7d06,_0x4448e0){var _0x251132={'name':_0x1d7d06[_0x82a5('0x60')][_0x82a5('0x3a')],'key':_0x1d7d06['body']['key'],'email':_0x1d7d06[_0x82a5('0x60')][_0x82a5('0x6d')],'ListId':_0x1d7d06[_0x82a5('0x60')][_0x82a5('0x6e')],'active':!_[_0x82a5('0x6f')](_0x1d7d06[_0x82a5('0x60')]['active'])?_0x1d7d06[_0x82a5('0x60')][_0x82a5('0x70')]:!![],'description':_0x1d7d06[_0x82a5('0x60')]['description']||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x1d7d06[_0x82a5('0x60')][_0x82a5('0x71')])){if(_0x1d7d06[_0x82a5('0x60')][_0x82a5('0x72')]){_0x251132[_0x82a5('0x3c')][_0x82a5('0x73')]=_0x251132[_0x82a5('0x3d')][_0x82a5('0x73')]=_0x1d7d06[_0x82a5('0x60')][_0x82a5('0x74')];_0x251132[_0x82a5('0x3c')][_0x82a5('0x75')]=_0x251132[_0x82a5('0x3d')][_0x82a5('0x76')]=_0x1d7d06['body'][_0x82a5('0x77')];}else{_0x251132[_0x82a5('0x3c')][_0x82a5('0x78')]=_0x251132[_0x82a5('0x3d')][_0x82a5('0x78')]=![];}_0x251132[_0x82a5('0x3c')][_0x82a5('0x79')]=_0x1d7d06['body'][_0x82a5('0x3c')][_0x82a5('0x79')];_0x251132[_0x82a5('0x3c')]['port']=_0x1d7d06['body'][_0x82a5('0x3c')]['port'];_0x251132[_0x82a5('0x3d')][_0x82a5('0x79')]=_0x1d7d06[_0x82a5('0x60')]['Smtp'][_0x82a5('0x79')];_0x251132[_0x82a5('0x3d')][_0x82a5('0x7a')]=_0x1d7d06[_0x82a5('0x60')]['Smtp'][_0x82a5('0x7a')];}else{_0x251132[_0x82a5('0x3c')][_0x82a5('0x7b')]=_0x251132[_0x82a5('0x3d')][_0x82a5('0x7b')]=_0x1d7d06[_0x82a5('0x60')][_0x82a5('0x71')];_0x251132['Imap'][_0x82a5('0x73')]=_0x251132[_0x82a5('0x3d')][_0x82a5('0x73')]=_0x1d7d06[_0x82a5('0x60')][_0x82a5('0x74')];_0x251132[_0x82a5('0x3c')][_0x82a5('0x75')]=_0x251132[_0x82a5('0x3d')][_0x82a5('0x76')]=_0x1d7d06[_0x82a5('0x60')][_0x82a5('0x77')];}return db[_0x82a5('0x40')][_0x82a5('0x65')](_0x251132,{'include':[{'model':db['MailServerOut'],'as':_0x82a5('0x3d')},{'model':db[_0x82a5('0x5a')],'as':_0x82a5('0x3c')}]})['then'](function(_0x38c82e){var _0x1348ec=_0x1d7d06[_0x82a5('0x73')][_0x82a5('0x38')]({'plain':!![]});if(!_0x1348ec)throw new Error(_0x82a5('0x7c'));if(_0x1348ec[_0x82a5('0x7d')]===_0x82a5('0x73')){var _0x2963fc=_0x38c82e['get']({'plain':!![]});return db[_0x82a5('0x7e')][_0x82a5('0x5f')]({'where':{'name':_0x82a5('0x7f'),'userProfileId':_0x1348ec['userProfileId']},'raw':!![]})[_0x82a5('0x22')](function(_0x44ba95){if(_0x44ba95&&_0x44ba95['autoAssociation']===0x0){return db[_0x82a5('0x39')][_0x82a5('0x65')]({'name':_0x2963fc[_0x82a5('0x3a')],'resourceId':_0x2963fc['id'],'type':_0x44ba95[_0x82a5('0x3a')],'sectionId':_0x44ba95['id']},{})[_0x82a5('0x22')](function(){return _0x38c82e;});}else{return _0x38c82e;}})[_0x82a5('0x2b')](function(_0x404a37){logger[_0x82a5('0x27')](_0x82a5('0x80'),_0x404a37);throw _0x404a37;});}return _0x38c82e;})[_0x82a5('0x22')](respondWithResult(_0x4448e0,0xc9))[_0x82a5('0x2b')](handleError(_0x4448e0,null));};exports[_0x82a5('0x81')]=function(_0x39c0cd,_0x228fea,_0x5f1005){return db['MailAccount']['findOne']({'where':{'id':_0x39c0cd[_0x82a5('0x61')]['id']}})['then'](handleEntityNotFound(_0x228fea,null))[_0x82a5('0x22')](function(_0x129ad1){if(_0x129ad1){return _0x129ad1[_0x82a5('0x81')]();}return null;})[_0x82a5('0x22')](respondWithResult(_0x228fea,null))[_0x82a5('0x2b')](handleError(_0x228fea,null));};exports[_0x82a5('0x82')]=function(_0x3c1e68,_0x5ad6b0,_0x51bba4){if(_0x3c1e68[_0x82a5('0x60')]['id']){delete _0x3c1e68[_0x82a5('0x60')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x3c1e68[_0x82a5('0x61')]['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x5ad6b0,null))[_0x82a5('0x22')](function(_0x1b6f55){if(_0x1b6f55){_0x3c1e68[_0x82a5('0x60')][_0x82a5('0x68')]=_0x1b6f55['id'];return db[_0x82a5('0x5a')][_0x82a5('0x65')](_0x3c1e68['body']);}})[_0x82a5('0x22')](respondWithResult(_0x5ad6b0,null))[_0x82a5('0x2b')](handleError(_0x5ad6b0,null));};exports['removeImap']=function(_0x2b4ea5,_0x4f0a0a,_0x50b600){return db[_0x82a5('0x40')]['findOne']({'where':{'id':_0x2b4ea5[_0x82a5('0x61')]['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x4f0a0a,null))[_0x82a5('0x22')](function(_0x13a77d){if(_0x13a77d){return _0x13a77d[_0x82a5('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x4f0a0a,null))[_0x82a5('0x2b')](handleError(_0x4f0a0a,null));};exports[_0x82a5('0x84')]=function(_0x4b8474,_0xac3592,_0x407506){return db[_0x82a5('0x40')][_0x82a5('0x67')]({'where':{'id':_0x4b8474[_0x82a5('0x61')]['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0xac3592,null))[_0x82a5('0x22')](function(_0x4e9393){if(_0x4e9393){return _0x4e9393[_0x82a5('0x84')]();}return null;})[_0x82a5('0x22')](respondWithResult(_0xac3592,null))[_0x82a5('0x2b')](handleError(_0xac3592,null));};exports['addSmtp']=function(_0x5b77b3,_0x4c951d,_0xbc8bd1){if(_0x5b77b3[_0x82a5('0x60')]['id']){delete _0x5b77b3['body']['id'];}return db[_0x82a5('0x40')][_0x82a5('0x5f')]({'where':{'id':_0x5b77b3['params']['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x4c951d,null))[_0x82a5('0x22')](function(_0x276be0){if(_0x276be0){_0x5b77b3[_0x82a5('0x60')]['MailAccountId']=_0x276be0['id'];return db[_0x82a5('0x5b')][_0x82a5('0x65')](_0x5b77b3['body']);}})[_0x82a5('0x22')](respondWithResult(_0x4c951d,null))[_0x82a5('0x2b')](handleError(_0x4c951d,null));};exports[_0x82a5('0x85')]=function(_0x31a63e,_0x4beac7,_0x43b47c){return db[_0x82a5('0x40')][_0x82a5('0x67')]({'where':{'id':_0x31a63e['params']['id']}})['then'](handleEntityNotFound(_0x4beac7,null))['then'](function(_0xb6ab9f){if(_0xb6ab9f){return _0xb6ab9f['setSmtp'](null);}return null;})[_0x82a5('0x22')](respondWithStatusCode(_0x4beac7,null))['catch'](handleError(_0x4beac7,null));};exports['addInteraction']=function(_0x1af473,_0x2701b8,_0x4abb33){return db[_0x82a5('0x86')][_0x82a5('0x5f')]({'where':{'id':_0x1af473[_0x82a5('0x61')]['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x2701b8,null))[_0x82a5('0x22')](function(_0x185cf5){if(_0x185cf5){return _0x185cf5['addInteraction'](_0x1af473[_0x82a5('0x60')]['ids'],_[_0x82a5('0x87')](_0x1af473[_0x82a5('0x60')],[_0x82a5('0x6a'),'id'])||{});}})[_0x82a5('0x22')](respondWithResult(_0x2701b8,null))[_0x82a5('0x2b')](handleError(_0x2701b8,null));};exports[_0x82a5('0x88')]=function(_0x3e9f03,_0x3b6fbd,_0x4904c9){var _0x5d53de={'raw':![],'where':{}};var _0x507f7d={};var _0x1a3a98={'count':0x0,'rows':[]};return db[_0x82a5('0x40')][_0x82a5('0x67')]({'where':{'id':_0x3e9f03[_0x82a5('0x61')]['id']}})['then'](handleEntityNotFound(_0x3b6fbd,null))[_0x82a5('0x22')](function(_0x4964e0){if(_0x4964e0){_0x507f7d['model']=_[_0x82a5('0x47')](db[_0x82a5('0x86')][_0x82a5('0x41')]);_0x507f7d['query']=_[_0x82a5('0x47')](_0x3e9f03['query']);_0x507f7d[_0x82a5('0x48')]=_[_0x82a5('0x49')](_0x507f7d['model'],_0x507f7d['query']);_0x5d53de[_0x82a5('0x4a')]=_['intersection'](_0x507f7d['model'],qs['fields'](_0x3e9f03['query']['fields']));_0x5d53de['attributes']=_0x5d53de[_0x82a5('0x4a')]['length']?_0x5d53de['attributes']:_0x507f7d['model'];if(!_0x3e9f03[_0x82a5('0x46')][_0x82a5('0x4d')]('nolimit')){_0x5d53de['limit']=qs[_0x82a5('0x32')](_0x3e9f03[_0x82a5('0x46')][_0x82a5('0x32')]);_0x5d53de[_0x82a5('0x31')]=qs[_0x82a5('0x31')](_0x3e9f03['query']['offset']);}_0x5d53de[_0x82a5('0x4f')]=qs[_0x82a5('0x50')](_0x3e9f03[_0x82a5('0x46')][_0x82a5('0x50')]);_0x5d53de[_0x82a5('0x51')]=qs[_0x82a5('0x48')](_[_0x82a5('0x52')](_0x3e9f03['query'],_0x507f7d['filters']));_0x5d53de[_0x82a5('0x51')][_0x82a5('0x68')]=_0x4964e0['id'];if(_0x3e9f03[_0x82a5('0x46')]['filter']){_0x5d53de[_0x82a5('0x51')]=_[_0x82a5('0x54')](_0x5d53de[_0x82a5('0x51')],{'$or':_[_0x82a5('0x3f')](_0x5d53de[_0x82a5('0x4a')],function(_0x40a1c1){var _0x579e12={};_0x579e12[_0x40a1c1]={'$like':'%'+_0x3e9f03[_0x82a5('0x46')][_0x82a5('0x53')]+'%'};return _0x579e12;})});}_0x5d53de=_[_0x82a5('0x54')]({},_0x5d53de,_0x3e9f03[_0x82a5('0x5e')]);return db[_0x82a5('0x86')][_0x82a5('0x30')]({'where':_0x5d53de['where']})[_0x82a5('0x22')](function(_0xb7ce75){_0x1a3a98[_0x82a5('0x30')]=_0xb7ce75;if(_0x3e9f03[_0x82a5('0x46')][_0x82a5('0x56')]){_0x5d53de[_0x82a5('0x5d')]=[{'model':db['CmContact'],'as':_0x82a5('0x89'),'required':![]},{'model':db[_0x82a5('0x8a')],'as':_0x82a5('0x8b'),'attributes':[_0x82a5('0x3a'),'fullname',_0x82a5('0x8c')],'required':![]},{'model':db[_0x82a5('0x8d')],'as':_0x82a5('0x8e'),'attributes':['id',_0x82a5('0x3a'),_0x82a5('0x8f')],'where':_0x3e9f03['query'][_0x82a5('0x90')]?{'id':_0x3e9f03[_0x82a5('0x46')][_0x82a5('0x90')]}:undefined,'required':_0x3e9f03[_0x82a5('0x46')][_0x82a5('0x90')]?!![]:![]}];}return db[_0x82a5('0x86')][_0x82a5('0x57')](_0x5d53de);})['then'](function(_0x3307b7){_0x1a3a98[_0x82a5('0x58')]=_0x3307b7;return _0x1a3a98;});}})['then'](respondWithFilteredResult(_0x3b6fbd,_0x5d53de))[_0x82a5('0x2b')](handleError(_0x3b6fbd,null));};exports[_0x82a5('0x91')]=function(_0x274248,_0x36c05f,_0x305728){return db[_0x82a5('0x40')][_0x82a5('0x67')]({'where':{'id':_0x274248[_0x82a5('0x61')]['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x36c05f,null))[_0x82a5('0x22')](function(_0x8d6f29){if(_0x8d6f29){return db[_0x82a5('0x92')][_0x82a5('0x93')](function(_0x1aa8cd){return db[_0x82a5('0x94')][_0x82a5('0x37')]({'where':{'MailAccountId':_0x274248['params']['id']},'transaction':_0x1aa8cd})['then'](function(_0x234062){var _0x2f5ce0=_[_0x82a5('0x3f')](_0x274248[_0x82a5('0x60')],function(_0x5f4fa7){_0x5f4fa7['MailAccountId']=_0x274248[_0x82a5('0x61')]['id'];return _0x5f4fa7;});return db[_0x82a5('0x94')]['bulkCreate'](_0x2f5ce0,{'transaction':_0x1aa8cd});});})[_0x82a5('0x22')](function(){return db[_0x82a5('0x94')][_0x82a5('0x95')]({'where':{'MailAccountId':_0x274248[_0x82a5('0x61')]['id']},'order':_0x82a5('0x96')});});}})['then'](respondWithResult(_0x36c05f,null))[_0x82a5('0x2b')](handleError(_0x36c05f,null));};exports['getApplications']=function(_0x596956,_0x381158,_0x21c4e9){var _0x3282c4={};var _0x5d326b={};var _0x1323bd;var _0x49bf95;return db[_0x82a5('0x40')][_0x82a5('0x67')]({'where':{'id':_0x596956[_0x82a5('0x61')]['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x381158,null))[_0x82a5('0x22')](function(_0x770463){if(_0x770463){_0x1323bd=_0x770463;_0x5d326b[_0x82a5('0x45')]=_[_0x82a5('0x47')](db['MailApplication'][_0x82a5('0x41')]);_0x5d326b[_0x82a5('0x46')]=_[_0x82a5('0x47')](_0x596956[_0x82a5('0x46')]);_0x5d326b['filters']=_[_0x82a5('0x49')](_0x5d326b[_0x82a5('0x45')],_0x5d326b[_0x82a5('0x46')]);_0x3282c4[_0x82a5('0x4a')]=_['intersection'](_0x5d326b[_0x82a5('0x45')],qs['fields'](_0x596956['query']['fields']));_0x3282c4[_0x82a5('0x4a')]=_0x3282c4[_0x82a5('0x4a')][_0x82a5('0x4c')]?_0x3282c4[_0x82a5('0x4a')]:_0x5d326b[_0x82a5('0x45')];_0x3282c4['order']=qs[_0x82a5('0x50')](_0x596956[_0x82a5('0x46')]['sort']);_0x3282c4['where']=qs['filters'](_[_0x82a5('0x52')](_0x596956[_0x82a5('0x46')],_0x5d326b[_0x82a5('0x48')]));if(_0x596956[_0x82a5('0x46')][_0x82a5('0x53')]){_0x3282c4[_0x82a5('0x51')]=_[_0x82a5('0x54')](_0x3282c4[_0x82a5('0x51')],{'$or':_[_0x82a5('0x3f')](_0x3282c4['attributes'],function(_0x23de64){var _0x481529={};_0x481529[_0x23de64]={'$like':'%'+_0x596956[_0x82a5('0x46')][_0x82a5('0x53')]+'%'};return _0x481529;})});}_0x3282c4=_[_0x82a5('0x54')]({},_0x3282c4,_0x596956[_0x82a5('0x5e')]);return _0x1323bd['getApplications'](_0x3282c4);}})[_0x82a5('0x22')](function(_0x2e7aa6){if(_0x2e7aa6){_0x49bf95=_0x2e7aa6[_0x82a5('0x4c')];if(!_0x596956[_0x82a5('0x46')][_0x82a5('0x4d')](_0x82a5('0x4e'))){_0x3282c4[_0x82a5('0x32')]=qs[_0x82a5('0x32')](_0x596956[_0x82a5('0x46')][_0x82a5('0x32')]);_0x3282c4[_0x82a5('0x31')]=qs['offset'](_0x596956['query'][_0x82a5('0x31')]);}return _0x1323bd[_0x82a5('0x97')](_0x3282c4);}})[_0x82a5('0x22')](function(_0xcbac19){if(_0xcbac19){return _0xcbac19?{'count':_0x49bf95,'rows':_0xcbac19}:null;}})[_0x82a5('0x22')](respondWithResult(_0x381158,null))[_0x82a5('0x2b')](handleError(_0x381158,null));};exports[_0x82a5('0x98')]=function(_0x6e383,_0x4d4fef,_0x588762){var _0x10dab2={'raw':!![],'where':{}};var _0x456927={};var _0x25a86a={'count':0x0,'rows':[]};return db['MailAccount'][_0x82a5('0x67')]({'where':{'id':_0x6e383[_0x82a5('0x61')]['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x4d4fef,null))[_0x82a5('0x22')](function(_0x54f318){if(_0x54f318){_0x456927['model']=_[_0x82a5('0x47')](db[_0x82a5('0x99')][_0x82a5('0x41')]);_0x456927[_0x82a5('0x46')]=_[_0x82a5('0x47')](_0x6e383[_0x82a5('0x46')]);_0x456927[_0x82a5('0x48')]=_[_0x82a5('0x49')](_0x456927['model'],_0x456927[_0x82a5('0x46')]);_0x10dab2['attributes']=_[_0x82a5('0x49')](_0x456927[_0x82a5('0x45')],qs['fields'](_0x6e383['query'][_0x82a5('0x4b')]));_0x10dab2[_0x82a5('0x4a')]=_0x10dab2['attributes'][_0x82a5('0x4c')]?_0x10dab2[_0x82a5('0x4a')]:_0x456927[_0x82a5('0x45')];if(!_0x6e383[_0x82a5('0x46')][_0x82a5('0x4d')](_0x82a5('0x4e'))){_0x10dab2[_0x82a5('0x32')]=qs[_0x82a5('0x32')](_0x6e383[_0x82a5('0x46')][_0x82a5('0x32')]);_0x10dab2['offset']=qs[_0x82a5('0x31')](_0x6e383[_0x82a5('0x46')][_0x82a5('0x31')]);}_0x10dab2[_0x82a5('0x4f')]=qs['sort'](_0x6e383['query'][_0x82a5('0x50')]);_0x10dab2[_0x82a5('0x51')]=qs['filters'](_[_0x82a5('0x52')](_0x6e383[_0x82a5('0x46')],_0x456927['filters']));_0x10dab2[_0x82a5('0x51')][_0x82a5('0x68')]=_0x54f318['id'];if(_0x6e383[_0x82a5('0x46')][_0x82a5('0x53')]){_0x10dab2[_0x82a5('0x51')]=_['merge'](_0x10dab2[_0x82a5('0x51')],{'$or':_[_0x82a5('0x3f')](_0x10dab2['attributes'],function(_0x1b34f6){var _0x1d0523={};_0x1d0523[_0x1b34f6]={'$like':'%'+_0x6e383[_0x82a5('0x46')]['filter']+'%'};return _0x1d0523;})});}if(_0x6e383[_0x82a5('0x46')][_0x82a5('0x9a')]){var _0x54d6fe=_0x6e383[_0x82a5('0x46')]['$gte'][_0x82a5('0x9b')](',');var _0x49ae87={};_0x49ae87[_0x54d6fe[0x0]]={'$gte':moment(_0x54d6fe[0x1])[_0x82a5('0x9c')](_0x82a5('0x9d'))};_0x10dab2[_0x82a5('0x51')]=_[_0x82a5('0x54')](_0x10dab2[_0x82a5('0x51')],_0x49ae87);}_0x10dab2=_[_0x82a5('0x54')]({},_0x10dab2,_0x6e383[_0x82a5('0x5e')]);return db['MailMessage'][_0x82a5('0x30')]({'where':_0x10dab2[_0x82a5('0x51')]})[_0x82a5('0x22')](function(_0x51ce25){_0x25a86a[_0x82a5('0x30')]=_0x51ce25;if(_0x6e383[_0x82a5('0x46')][_0x82a5('0x56')]){_0x10dab2[_0x82a5('0x5d')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x10dab2);})[_0x82a5('0x22')](function(_0x40ae13){_0x25a86a[_0x82a5('0x58')]=_0x40ae13;return _0x25a86a;});}})['then'](respondWithFilteredResult(_0x4d4fef,_0x10dab2))[_0x82a5('0x2b')](handleError(_0x4d4fef,null));};exports[_0x82a5('0x9e')]=function(_0x6efde5,_0x175354,_0x16a9b5){var _0x261269,_0x55fb98={},_0x387b79;if(_0x6efde5[_0x82a5('0x60')]['to']){_0x387b79=_0x6efde5['body']['to'][_0x82a5('0x9b')](',')[0x0];}return db[_0x82a5('0x40')][_0x82a5('0x5f')]({'where':{'id':_0x6efde5[_0x82a5('0x61')]['id']},'include':[{'model':db[_0x82a5('0x9f')],'as':_0x82a5('0xa0'),'include':[{'model':db[_0x82a5('0xa1')],'as':_0x82a5('0xa2'),'where':{'email':_0x387b79},'limit':0x1,'order':[[_0x82a5('0xa3'),_0x82a5('0xa4')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x82a5('0x22')](handleEntityNotFound(_0x175354,null))[_0x82a5('0x22')](function(_0x34d56f){if(_0x34d56f){_0x261269=_0x34d56f;if(_0x34d56f[_0x82a5('0x3d')]){if(_[_0x82a5('0x6f')](_0x6efde5['body'][_0x82a5('0xa5')])){_0x6efde5[_0x82a5('0x60')]['from']=util[_0x82a5('0x9c')]('%s\x20<%s>',_0x34d56f[_0x82a5('0x3a')],_0x34d56f[_0x82a5('0x6d')]||_0x34d56f['Smtp']['user']);}if(_0x6efde5[_0x82a5('0x60')][_0x82a5('0xa6')]&&_0x6efde5[_0x82a5('0x60')][_0x82a5('0xa6')][_0x82a5('0x4c')]){for(var _0x36acfe=0x0;_0x36acfe<_0x6efde5['body'][_0x82a5('0xa6')][_0x82a5('0x4c')];_0x36acfe+=0x1){_0x6efde5[_0x82a5('0x60')]['attachments'][_0x36acfe]={'filename':_0x6efde5[_0x82a5('0x60')][_0x82a5('0xa6')][_0x36acfe]['name'],'path':path[_0x82a5('0xa7')](config['root'],_0x82a5('0xa8'),_0x6efde5[_0x82a5('0x60')][_0x82a5('0xa6')][_0x36acfe][_0x82a5('0xa9')])};}}var _0x331ef3={'tls':{'rejectUnauthorized':![]}};if(_[_0x82a5('0x6f')](_0x34d56f[_0x82a5('0x3d')]['service'])){if(_0x34d56f[_0x82a5('0x3d')][_0x82a5('0x78')]){_0x331ef3[_0x82a5('0xaa')]={'user':_0x34d56f[_0x82a5('0x3d')][_0x82a5('0x73')],'pass':_0x34d56f[_0x82a5('0x3d')][_0x82a5('0x76')]};}_0x331ef3[_0x82a5('0x79')]=_0x34d56f['Smtp'][_0x82a5('0x79')];_0x331ef3[_0x82a5('0x7a')]=_0x34d56f[_0x82a5('0x3d')][_0x82a5('0x7a')];_0x331ef3[_0x82a5('0xab')]=_0x34d56f[_0x82a5('0x3d')][_0x82a5('0xab')];}else{_0x331ef3[_0x82a5('0x7b')]=_0x34d56f[_0x82a5('0x3d')]['service'];_0x331ef3['auth']={'user':_0x34d56f['Smtp'][_0x82a5('0x73')],'pass':_0x34d56f[_0x82a5('0x3d')][_0x82a5('0x76')]};}return respondWithRpcPromise(_0x82a5('0xac'),'sendMail',{'account':_0x331ef3,'message':_0x6efde5['body']});}else{throw new Error(_0x82a5('0xad'));}}})[_0x82a5('0x22')](function(_0x2de1d){if(_0x2de1d){_0x55fb98=_0x2de1d;if(_0x261269['List']){if(_0x261269[_0x82a5('0xa0')]['Contacts'][_0x82a5('0x4c')]){return _0x261269[_0x82a5('0xa0')][_0x82a5('0xa2')][0x0];}else{return db[_0x82a5('0xa1')][_0x82a5('0x65')](_['defaults'](_0x6efde5['body'],{'firstName':_0x6efde5['body']['to'],'email':_0x6efde5['body']['to'],'phone':_0x6efde5['body']['to'],'ListId':_0x261269[_0x82a5('0x6e')]}));}}else{throw new Error('List\x20not\x20found');}}})['then'](function(_0x166b6f){if(_0x166b6f){var _0x2e0ba9={'UserId':_0x6efde5['user']['id'],'ContactId':_0x166b6f['id'],'MailAccountId':_0x261269['id'],'inReplyTo':_0x55fb98[_0x82a5('0xae')],'to':_0x6efde5['body'][_0x82a5('0xa5')],'cc':_0x6efde5['body']['cc'],'subject':_0x6efde5[_0x82a5('0x60')]['subject'],'attach':_0x6efde5['body'][_0x82a5('0xaf')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x82a5('0x9c')](_0x82a5('0x9d')),'lastMsgDirection':_0x82a5('0xb0'),'lastMsgBody':_0x6efde5['body'][_0x82a5('0x60')],'Messages':[_[_0x82a5('0x54')](_0x6efde5[_0x82a5('0x60')],{'messageId':_0x55fb98[_0x82a5('0xae')],'sentAt':moment()[_0x82a5('0x9c')](_0x82a5('0x9d')),'read':!![],'MailAccountId':_0x261269['id'],'UserId':_0x6efde5['user']['id'],'ContactId':_0x166b6f['id']})]};if(_0x6efde5[_0x82a5('0x60')][_0x82a5('0xb1')]){_0x2e0ba9=_[_0x82a5('0x54')](_0x2e0ba9,_0x6efde5['body'][_0x82a5('0xb1')]);}return db[_0x82a5('0x86')][_0x82a5('0x65')](_0x2e0ba9,{'include':[{'model':db[_0x82a5('0x99')],'as':_0x82a5('0xb2')}]});}})[_0x82a5('0x22')](respondWithResult(_0x175354,null))[_0x82a5('0x2b')](handleError(_0x175354,null));};exports[_0x82a5('0xb3')]=function(_0x4f509e,_0x49ad27,_0x180f73){return db[_0x82a5('0x40')][_0x82a5('0x5f')]({'where':{'id':_0x4f509e['params']['id']},'include':[{'model':db[_0x82a5('0x5b')],'as':'Smtp','raw':!![]}]})[_0x82a5('0x22')](handleEntityNotFound(_0x49ad27,null))[_0x82a5('0x22')](function(_0x493311){if(_0x493311&&_0x493311['Smtp']){var _0xa3d3f0={'id':_0x493311['id'],'tls':{'rejectUnauthorized':![]}};if(_0x493311[_0x82a5('0x3d')][_0x82a5('0x7b')]){_0xa3d3f0[_0x82a5('0x7b')]=_0x493311[_0x82a5('0x3d')]['service'];}else{_0xa3d3f0['host']=_0x493311[_0x82a5('0x3d')][_0x82a5('0x79')];_0xa3d3f0[_0x82a5('0x7a')]=_0x493311['Smtp'][_0x82a5('0x7a')];_0xa3d3f0[_0x82a5('0xab')]=_0x493311['Smtp'][_0x82a5('0xab')];}if(_0x493311['Smtp'][_0x82a5('0x78')]){_0xa3d3f0['auth']={'user':_0x493311[_0x82a5('0x3d')][_0x82a5('0x73')],'pass':_0x493311['Smtp'][_0x82a5('0x76')]};}return respondWithRpcPromise('VerifySmtp',_0x82a5('0xb3'),{'account':_0xa3d3f0});}})[_0x82a5('0x22')](respondWithResult(_0x49ad27,null))[_0x82a5('0x2b')](handleError(_0x49ad27,null));};exports[_0x82a5('0x37')]=function(_0x1ca49f,_0x571f10){return db[_0x82a5('0x40')][_0x82a5('0x5f')]({'where':{'id':_0x1ca49f[_0x82a5('0x61')]['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x571f10,null))['then'](function(_0x1e8c16){if(_0x1e8c16&&_0x1e8c16['service']){throw new db[(_0x82a5('0x1f'))]['ValidationError'](_0x82a5('0xb4'));}return _0x1e8c16;})[_0x82a5('0x22')](removeEntity(_0x571f10,null))[_0x82a5('0x2b')](handleError(_0x571f10,null));};exports[_0x82a5('0xb5')]=function(_0x5c86b1,_0xaea271,_0x4e132a){return db[_0x82a5('0x40')]['find']({'where':{'id':_0x5c86b1[_0x82a5('0x61')]['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0xaea271,null))['then'](function(_0x2d0113){if(_0x2d0113){return _0x2d0113['addAgents'](_0x5c86b1[_0x82a5('0x60')]['ids'],_[_0x82a5('0x87')](_0x5c86b1[_0x82a5('0x60')],[_0x82a5('0x6a'),'id'])||{})[_0x82a5('0xb6')](function(_0x3f1bd3){for(var _0x9e263e=0x0;_0x9e263e<_0x5c86b1['body'][_0x82a5('0x6a')][_0x82a5('0x4c')];_0x9e263e+=0x1){socket[_0x82a5('0xb7')](_0x82a5('0xb8'),{'UserId':_0x5c86b1['body'][_0x82a5('0x6a')][_0x9e263e],'MailAccountId':_0x5c86b1[_0x82a5('0x61')]['id']});}return _0x3f1bd3;});}})[_0x82a5('0x22')](respondWithResult(_0xaea271,null))['catch'](handleError(_0xaea271,null));};exports[_0x82a5('0xb9')]=function(_0x1eb279,_0x3c3b2e,_0x30d320){return db[_0x82a5('0x40')][_0x82a5('0x5f')]({'where':{'id':_0x1eb279[_0x82a5('0x61')]['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x3c3b2e,null))[_0x82a5('0x22')](function(_0x4ada10){if(_0x4ada10){return _0x4ada10[_0x82a5('0xb9')](_0x1eb279[_0x82a5('0x46')][_0x82a5('0x6a')])[_0x82a5('0x22')](function(){if(_['isArray'](_0x1eb279[_0x82a5('0x46')][_0x82a5('0x6a')])){for(var _0x60783a=0x0;_0x60783a<_0x1eb279[_0x82a5('0x46')]['ids'][_0x82a5('0x4c')];_0x60783a+=0x1){socket[_0x82a5('0xb7')](_0x82a5('0xba'),{'UserId':Number(_0x1eb279[_0x82a5('0x46')][_0x82a5('0x6a')][_0x60783a]),'MailAccountId':Number(_0x1eb279['params']['id'])});}}else{socket['emit'](_0x82a5('0xba'),{'UserId':Number(_0x1eb279[_0x82a5('0x46')][_0x82a5('0x6a')]),'MailAccountId':Number(_0x1eb279[_0x82a5('0x61')]['id'])});}});}})['then'](respondWithStatusCode(_0x3c3b2e,null))[_0x82a5('0x2b')](handleError(_0x3c3b2e,null));};exports[_0x82a5('0xbb')]=function(_0x3f40f5,_0x2e8259,_0x51501b){var _0x515fa5={};var _0xda5e72={};var _0x423e0d;var _0x50f423;return db[_0x82a5('0x40')]['findOne']({'where':{'id':_0x3f40f5['params']['id']}})[_0x82a5('0x22')](handleEntityNotFound(_0x2e8259,null))[_0x82a5('0x22')](function(_0x1ec3f8){if(_0x1ec3f8){_0x423e0d=_0x1ec3f8;_0xda5e72['model']=_[_0x82a5('0x47')](db[_0x82a5('0x8a')][_0x82a5('0x41')]);_0xda5e72[_0x82a5('0x46')]=_[_0x82a5('0x47')](_0x3f40f5[_0x82a5('0x46')]);_0xda5e72['filters']=_[_0x82a5('0x49')](_0xda5e72['model'],_0xda5e72[_0x82a5('0x46')]);_0x515fa5['attributes']=_['intersection'](_0xda5e72[_0x82a5('0x45')],qs[_0x82a5('0x4b')](_0x3f40f5[_0x82a5('0x46')][_0x82a5('0x4b')]));_0x515fa5['attributes']=_0x515fa5['attributes'][_0x82a5('0x4c')]?_0x515fa5[_0x82a5('0x4a')]:_0xda5e72['model'];_0x515fa5[_0x82a5('0x4f')]=qs['sort'](_0x3f40f5[_0x82a5('0x46')][_0x82a5('0x50')]);_0x515fa5['where']=qs[_0x82a5('0x48')](_[_0x82a5('0x52')](_0x3f40f5[_0x82a5('0x46')],_0xda5e72[_0x82a5('0x48')]));if(_0x3f40f5[_0x82a5('0x46')][_0x82a5('0x53')]){_0x515fa5[_0x82a5('0x51')]=_[_0x82a5('0x54')](_0x515fa5[_0x82a5('0x51')],{'$or':_['map'](_0x515fa5['attributes'],function(_0x49ffdf){var _0x37bfb8={};_0x37bfb8[_0x49ffdf]={'$like':'%'+_0x3f40f5[_0x82a5('0x46')][_0x82a5('0x53')]+'%'};return _0x37bfb8;})});}_0x515fa5=_[_0x82a5('0x54')]({},_0x515fa5,_0x3f40f5[_0x82a5('0x5e')]);return _0x423e0d[_0x82a5('0xbb')](_0x515fa5);}})[_0x82a5('0x22')](function(_0x1ed208){if(_0x1ed208){_0x50f423=_0x1ed208[_0x82a5('0x4c')];if(!_0x3f40f5[_0x82a5('0x46')][_0x82a5('0x4d')]('nolimit')){_0x515fa5[_0x82a5('0x32')]=qs[_0x82a5('0x32')](_0x3f40f5['query'][_0x82a5('0x32')]);_0x515fa5[_0x82a5('0x31')]=qs['offset'](_0x3f40f5[_0x82a5('0x46')]['offset']);}return _0x423e0d[_0x82a5('0xbb')](_0x515fa5);}})[_0x82a5('0x22')](function(_0x57be76){if(_0x57be76){return _0x57be76?{'count':_0x50f423,'rows':_0x57be76}:null;}})[_0x82a5('0x22')](respondWithResult(_0x2e8259,null))[_0x82a5('0x2b')](handleError(_0x2e8259,null));}; \ No newline at end of file +var _0x6cf6=['filter','where','merge','options','includeAll','findAll','rows','show','params','Pause','include','find','update','body','MailServerIn','mandatoryDispositionPause','describe','addDisposition','MailAccountId','Disposition','create','removeDispositions','CannedAnswer','getAnswers','findOne','removeAnswers','ids','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','port','host','service','cpassword','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','getImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','getInteractions','MailInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','MailApplication','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','from','format','%s\x20<%s>','email','attachments','root','server/files/attachments','basename','secure','auth','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','defaults','redis','socket.io-emitter','register','client','http','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','destroy','MailAccounts','UserProfileResource','stack','name','send','index','Imap','MailServerOut','Smtp','map','MailAccount','rawAttributes','type','key','model','keys','filters','attributes','intersection','fields','query','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x550629,_0x30f09b){var _0x586fa8=function(_0x2bac31){while(--_0x2bac31){_0x550629['push'](_0x550629['shift']());}};_0x586fa8(++_0x30f09b);}(_0x6cf6,0x120));var _0x66cf=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x6cf6[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0x66cf('0x0'));var emlformat=require(_0x66cf('0x1'));var rimraf=require(_0x66cf('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x66cf('0x3'));var moment=require(_0x66cf('0x4'));var BPromise=require(_0x66cf('0x5'));var Mustache=require('mustache');var util=require(_0x66cf('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x66cf('0x7'));var ejs=require(_0x66cf('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x66cf('0x9'));var crypto=require(_0x66cf('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x66cf('0x7'));var querystring=require(_0x66cf('0xb'));var Papa=require(_0x66cf('0xc'));var Redis=require('ioredis');var authService=require(_0x66cf('0xd'));var qs=require(_0x66cf('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66cf('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x66cf('0x10'));var config=require('../../config/environment');var db=require(_0x66cf('0x11'))['db'];config['redis']=_[_0x66cf('0x12')](config[_0x66cf('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x66cf('0x14'))(new Redis(config[_0x66cf('0x13')]));require('./mailAccount.socket')[_0x66cf('0x15')](socket);var jayson=require('jayson/promise');var client=jayson[_0x66cf('0x16')][_0x66cf('0x17')]({'port':0x232b});function checkPasswordPattern(_0x5ccdba,_0x554bc4,_0x2e6667){if(_0x2e6667){var _0x55a77b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x55a77b['test'](_0x554bc4)){return _0x5ccdba;}else{throw new db[(_0x66cf('0x18'))]['ValidationError'](_0x66cf('0x19'));}}else{return _0x5ccdba;}}function respondWithRpcPromise(_0x5d7d2b,_0x3c13f1,_0x15ba0f,_0x4abae2){return new BPromise(function(_0xdd25bd,_0x250740){var _0x3dfcb0=_0x4abae2||client;return _0x3dfcb0[_0x66cf('0x1a')](_0x5d7d2b,_0x15ba0f)[_0x66cf('0x1b')](function(_0x2c5a88){logger[_0x66cf('0x1c')](_0x66cf('0x1d'),_0x3c13f1,_0x66cf('0x1e'));logger[_0x66cf('0x1f')](_0x66cf('0x20'),_0x3c13f1,_0x66cf('0x1e'),JSON[_0x66cf('0x21')](_0x2c5a88));if(_0x2c5a88[_0x66cf('0x22')]){if(_0x2c5a88[_0x66cf('0x22')]['code']===0x1f4){logger[_0x66cf('0x22')](_0x66cf('0x1d'),_0x3c13f1,_0x2c5a88[_0x66cf('0x22')]['message']);return _0x250740(_0x2c5a88[_0x66cf('0x22')][_0x66cf('0x23')]);}logger[_0x66cf('0x22')](_0x66cf('0x1d'),_0x3c13f1,_0x2c5a88[_0x66cf('0x22')][_0x66cf('0x23')]);return _0xdd25bd(_0x2c5a88['error']['message']);}else{logger['info'](_0x66cf('0x1d'),_0x3c13f1,_0x66cf('0x1e'));_0xdd25bd(_0x2c5a88['result'][_0x66cf('0x23')]);}})[_0x66cf('0x24')](function(_0x9ecb45){logger[_0x66cf('0x22')](_0x66cf('0x1d'),_0x3c13f1,_0x9ecb45);_0x250740(_0x9ecb45);});});}function respondWithStatusCode(_0x46a10b,_0x473a4a){_0x473a4a=_0x473a4a||0xcc;return function(_0x5d44ab){if(_0x5d44ab){return _0x46a10b[_0x66cf('0x25')](_0x473a4a);}return _0x46a10b['status'](_0x473a4a)[_0x66cf('0x26')]();};}function respondWithResult(_0x9a6820,_0x3159f6){_0x3159f6=_0x3159f6||0xc8;return function(_0x3569e6){if(_0x3569e6){return _0x9a6820[_0x66cf('0x27')](_0x3159f6)[_0x66cf('0x28')](_0x3569e6);}};}function respondWithFilteredResult(_0x327096,_0x4d41d1){return function(_0x301c3a){if(_0x301c3a){var _0x5d8efb=_0x301c3a[_0x66cf('0x29')],_0x54f2ab=_0x4d41d1['offset'],_0x235f88=_0x4d41d1[_0x66cf('0x2a')]+_0x4d41d1[_0x66cf('0x2b')],_0x326299;if(_0x235f88>=_0x5d8efb){_0x235f88=_0x5d8efb;_0x326299=0xc8;}else{_0x326299=0xce;}_0x327096['status'](_0x326299);return _0x327096[_0x66cf('0x2c')](_0x66cf('0x2d'),_0x54f2ab+'-'+_0x235f88+'/'+_0x5d8efb)[_0x66cf('0x28')](_0x301c3a);}return null;};}function patchUpdates(_0x4dd713){return function(_0x7abea7){try{jsonpatch['apply'](_0x7abea7,_0x4dd713,!![]);}catch(_0xa0f3e9){return BPromise['reject'](_0xa0f3e9);}return _0x7abea7['save']();};}function saveUpdates(_0x20cacf,_0x4d6f2c){return function(_0x1302ef){if(_0x1302ef){return _0x1302ef['update'](_0x20cacf)[_0x66cf('0x1b')](function(_0x5c54a9){return _0x5c54a9;});}return null;};}function removeEntity(_0x55bee2,_0xafe10){return function(_0x1e787c){if(_0x1e787c){return _0x1e787c[_0x66cf('0x2e')]()[_0x66cf('0x1b')](function(){var _0xb77b8a=_0x1e787c['get']({'plain':!![]});var _0x32f054=_0x66cf('0x2f');return db[_0x66cf('0x30')][_0x66cf('0x2e')]({'where':{'type':_0x32f054,'resourceId':_0xb77b8a['id']}})['then'](function(){return _0x1e787c;});})[_0x66cf('0x1b')](function(){_0x55bee2[_0x66cf('0x27')](0xcc)[_0x66cf('0x26')]();});}};}function handleEntityNotFound(_0x15e057,_0x3c53bb){return function(_0x9d85a9){if(!_0x9d85a9){_0x15e057[_0x66cf('0x25')](0x194);}return _0x9d85a9;};}function handleError(_0x4dc799,_0x8ba000){_0x8ba000=_0x8ba000||0x1f4;return function(_0x2ebc6f){logger[_0x66cf('0x22')](_0x2ebc6f[_0x66cf('0x31')]);if(_0x2ebc6f[_0x66cf('0x32')]){delete _0x2ebc6f[_0x66cf('0x32')];}_0x4dc799['status'](_0x8ba000)[_0x66cf('0x33')](_0x2ebc6f);};}exports[_0x66cf('0x34')]=function(_0x2e330a,_0x352c66){var _0x28cd50={'include':[{'model':db['MailServerIn'],'as':_0x66cf('0x35')},{'model':db[_0x66cf('0x36')],'as':_0x66cf('0x37')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2bd72c={},_0x7b7140={'count':0x0,'rows':[]};var _0x273e6a=_[_0x66cf('0x38')](db[_0x66cf('0x39')][_0x66cf('0x3a')],function(_0x1e25bb){return{'name':_0x1e25bb['fieldName'],'type':_0x1e25bb[_0x66cf('0x3b')][_0x66cf('0x3c')]};});_0x2bd72c[_0x66cf('0x3d')]=_[_0x66cf('0x38')](_0x273e6a,'name');_0x2bd72c['query']=_[_0x66cf('0x3e')](_0x2e330a['query']);_0x2bd72c[_0x66cf('0x3f')]=_['intersection'](_0x2bd72c[_0x66cf('0x3d')],_0x2bd72c['query']);_0x28cd50[_0x66cf('0x40')]=_[_0x66cf('0x41')](_0x2bd72c[_0x66cf('0x3d')],qs[_0x66cf('0x42')](_0x2e330a[_0x66cf('0x43')][_0x66cf('0x42')]));_0x28cd50[_0x66cf('0x40')]=_0x28cd50[_0x66cf('0x40')][_0x66cf('0x44')]?_0x28cd50['attributes']:_0x2bd72c[_0x66cf('0x3d')];if(!_0x2e330a[_0x66cf('0x43')][_0x66cf('0x45')](_0x66cf('0x46'))){_0x28cd50[_0x66cf('0x2b')]=qs[_0x66cf('0x2b')](_0x2e330a['query'][_0x66cf('0x2b')]);_0x28cd50[_0x66cf('0x2a')]=qs['offset'](_0x2e330a[_0x66cf('0x43')][_0x66cf('0x2a')]);}_0x28cd50[_0x66cf('0x47')]=qs['sort'](_0x2e330a[_0x66cf('0x43')][_0x66cf('0x48')]);_0x28cd50['where']=qs['filters'](_[_0x66cf('0x49')](_0x2e330a[_0x66cf('0x43')],_0x2bd72c[_0x66cf('0x3f')]));if(_0x2e330a[_0x66cf('0x43')][_0x66cf('0x4a')]){_0x28cd50[_0x66cf('0x4b')]=_[_0x66cf('0x4c')](_0x28cd50[_0x66cf('0x4b')],{'$or':_[_0x66cf('0x38')](_0x273e6a,function(_0x305f6a){if(_0x305f6a['type']!=='VIRTUAL'){var _0x25f63a={};_0x25f63a[_0x305f6a[_0x66cf('0x32')]]={'$like':'%'+_0x2e330a[_0x66cf('0x43')][_0x66cf('0x4a')]+'%'};return _0x25f63a;}})});}_0x28cd50=_['merge']({},_0x28cd50,_0x2e330a[_0x66cf('0x4d')]);var _0x440251={'where':_0x28cd50['where']};return db[_0x66cf('0x39')][_0x66cf('0x29')](_0x440251)['then'](function(_0x8f2aef){_0x7b7140[_0x66cf('0x29')]=_0x8f2aef;if(_0x2e330a[_0x66cf('0x43')][_0x66cf('0x4e')]){_0x28cd50['include']=[{'all':!![]}];}return db[_0x66cf('0x39')][_0x66cf('0x4f')](_0x28cd50);})['then'](function(_0x11ca55){_0x7b7140[_0x66cf('0x50')]=_0x11ca55;return _0x7b7140;})[_0x66cf('0x1b')](respondWithFilteredResult(_0x352c66,_0x28cd50))[_0x66cf('0x24')](handleError(_0x352c66,null));};exports[_0x66cf('0x51')]=function(_0x5c8049,_0x247443){var _0x20df93={'raw':![],'where':{'id':_0x5c8049[_0x66cf('0x52')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x66cf('0x35')},{'model':db[_0x66cf('0x36')],'as':_0x66cf('0x37')},{'model':db[_0x66cf('0x53')],'as':'mandatoryDispositionPause'}]},_0x283b3d={};_0x283b3d[_0x66cf('0x3d')]=_[_0x66cf('0x3e')](db['MailAccount'][_0x66cf('0x3a')]);_0x283b3d[_0x66cf('0x43')]=_[_0x66cf('0x3e')](_0x5c8049[_0x66cf('0x43')]);_0x283b3d[_0x66cf('0x3f')]=_['intersection'](_0x283b3d['model'],_0x283b3d[_0x66cf('0x43')]);_0x20df93[_0x66cf('0x40')]=_['intersection'](_0x283b3d[_0x66cf('0x3d')],qs[_0x66cf('0x42')](_0x5c8049['query'][_0x66cf('0x42')]));_0x20df93[_0x66cf('0x40')]=_0x20df93[_0x66cf('0x40')][_0x66cf('0x44')]?_0x20df93['attributes']:_0x283b3d['model'];if(_0x5c8049[_0x66cf('0x43')][_0x66cf('0x4e')]){_0x20df93[_0x66cf('0x54')]=[{'all':!![]}];}_0x20df93=_[_0x66cf('0x4c')]({},_0x20df93,_0x5c8049['options']);return db[_0x66cf('0x39')][_0x66cf('0x55')](_0x20df93)[_0x66cf('0x1b')](handleEntityNotFound(_0x247443,null))[_0x66cf('0x1b')](respondWithResult(_0x247443,null))[_0x66cf('0x24')](handleError(_0x247443,null));};exports[_0x66cf('0x56')]=function(_0x509d48,_0x439f3d){if(_0x509d48['body']['id']){delete _0x509d48[_0x66cf('0x57')]['id'];}return db['MailAccount'][_0x66cf('0x55')]({'where':{'id':_0x509d48[_0x66cf('0x52')]['id']},'include':[{'model':db[_0x66cf('0x58')],'as':_0x66cf('0x35')},{'model':db[_0x66cf('0x36')],'as':_0x66cf('0x37')},{'model':db[_0x66cf('0x53')],'as':_0x66cf('0x59')}]})['then'](handleEntityNotFound(_0x439f3d,null))[_0x66cf('0x1b')](saveUpdates(_0x509d48[_0x66cf('0x57')],null))['then'](function(_0x43ce55){if(_0x43ce55&&_0x509d48['body'][_0x66cf('0x35')]){return db['MailServerIn'][_0x66cf('0x56')](_0x509d48[_0x66cf('0x57')][_0x66cf('0x35')],{'where':{'MailAccountId':_0x43ce55['id']}})['then'](function(){return _0x43ce55;});}return _0x43ce55;})['then'](function(_0x29f494){if(_0x29f494&&_0x509d48['body'][_0x66cf('0x37')]){return db[_0x66cf('0x36')][_0x66cf('0x56')](_0x509d48['body']['Smtp'],{'where':{'MailAccountId':_0x29f494['id']}})[_0x66cf('0x1b')](function(){return _0x29f494;});}return _0x29f494;})[_0x66cf('0x1b')](respondWithResult(_0x439f3d,null))[_0x66cf('0x24')](handleError(_0x439f3d,null));};exports['describe']=function(_0x8ba77f,_0x2ed161){return db[_0x66cf('0x39')][_0x66cf('0x5a')]()[_0x66cf('0x1b')](respondWithResult(_0x2ed161,null))[_0x66cf('0x24')](handleError(_0x2ed161,null));};exports[_0x66cf('0x5b')]=function(_0x462c92,_0x32145a,_0xbca524){if(_0x462c92[_0x66cf('0x57')]['id']){delete _0x462c92['body']['id'];}return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x462c92[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x32145a,null))['then'](function(_0x2ac048){if(_0x2ac048){_0x462c92[_0x66cf('0x57')][_0x66cf('0x5c')]=_0x2ac048['id'];return db[_0x66cf('0x5d')][_0x66cf('0x5e')](_0x462c92[_0x66cf('0x57')]);}})['then'](respondWithResult(_0x32145a,null))['catch'](handleError(_0x32145a,null));};exports['getDispositions']=function(_0x22bfbb,_0x2b6a2c,_0x4fa62e){var _0x3518b4={'raw':![],'where':{}};var _0x24766c={};var _0x2c8897={'count':0x0,'rows':[]};return db[_0x66cf('0x39')]['findOne']({'where':{'id':_0x22bfbb['params']['id']}})['then'](handleEntityNotFound(_0x2b6a2c,null))[_0x66cf('0x1b')](function(_0x12693b){if(_0x12693b){_0x24766c[_0x66cf('0x3d')]=_[_0x66cf('0x3e')](db[_0x66cf('0x5d')][_0x66cf('0x3a')]);_0x24766c[_0x66cf('0x43')]=_[_0x66cf('0x3e')](_0x22bfbb[_0x66cf('0x43')]);_0x24766c[_0x66cf('0x3f')]=_[_0x66cf('0x41')](_0x24766c[_0x66cf('0x3d')],_0x24766c[_0x66cf('0x43')]);_0x3518b4[_0x66cf('0x40')]=_['intersection'](_0x24766c['model'],qs[_0x66cf('0x42')](_0x22bfbb[_0x66cf('0x43')]['fields']));_0x3518b4['attributes']=_0x3518b4[_0x66cf('0x40')][_0x66cf('0x44')]?_0x3518b4[_0x66cf('0x40')]:_0x24766c[_0x66cf('0x3d')];if(!_0x22bfbb[_0x66cf('0x43')][_0x66cf('0x45')](_0x66cf('0x46'))){_0x3518b4[_0x66cf('0x2b')]=qs[_0x66cf('0x2b')](_0x22bfbb[_0x66cf('0x43')]['limit']);_0x3518b4[_0x66cf('0x2a')]=qs[_0x66cf('0x2a')](_0x22bfbb[_0x66cf('0x43')][_0x66cf('0x2a')]);}_0x3518b4['order']=qs[_0x66cf('0x48')](_0x22bfbb[_0x66cf('0x43')][_0x66cf('0x48')]);_0x3518b4[_0x66cf('0x4b')]=qs[_0x66cf('0x3f')](_['pick'](_0x22bfbb[_0x66cf('0x43')],_0x24766c[_0x66cf('0x3f')]));_0x3518b4[_0x66cf('0x4b')][_0x66cf('0x5c')]=_0x12693b['id'];if(_0x22bfbb[_0x66cf('0x43')][_0x66cf('0x4a')]){_0x3518b4['where']=_[_0x66cf('0x4c')](_0x3518b4[_0x66cf('0x4b')],{'$or':_[_0x66cf('0x38')](_0x3518b4[_0x66cf('0x40')],function(_0x32f68f){var _0x1ebbec={};_0x1ebbec[_0x32f68f]={'$like':'%'+_0x22bfbb[_0x66cf('0x43')]['filter']+'%'};return _0x1ebbec;})});}_0x3518b4=_[_0x66cf('0x4c')]({},_0x3518b4,_0x22bfbb[_0x66cf('0x4d')]);return db[_0x66cf('0x5d')][_0x66cf('0x29')]({'where':_0x3518b4[_0x66cf('0x4b')]})[_0x66cf('0x1b')](function(_0x1f4fa5){_0x2c8897[_0x66cf('0x29')]=_0x1f4fa5;if(_0x22bfbb['query'][_0x66cf('0x4e')]){_0x3518b4[_0x66cf('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x66cf('0x4f')](_0x3518b4);})['then'](function(_0x26692f){_0x2c8897['rows']=_0x26692f;return _0x2c8897;});}})[_0x66cf('0x1b')](respondWithFilteredResult(_0x2b6a2c,_0x3518b4))['catch'](handleError(_0x2b6a2c,null));};exports[_0x66cf('0x5f')]=function(_0x2b57,_0x447694,_0x385ace){return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x2b57[_0x66cf('0x52')]['id']}})['then'](handleEntityNotFound(_0x447694,null))[_0x66cf('0x1b')](function(_0x19b926){if(_0x19b926){return _0x19b926[_0x66cf('0x5f')](_0x2b57[_0x66cf('0x43')]['ids']);}})[_0x66cf('0x1b')](respondWithStatusCode(_0x447694,null))[_0x66cf('0x24')](handleError(_0x447694,null));};exports['addAnswer']=function(_0x8b35f0,_0x39fc27,_0x3f7d1a){if(_0x8b35f0[_0x66cf('0x57')]['id']){delete _0x8b35f0[_0x66cf('0x57')]['id'];}return db[_0x66cf('0x39')]['find']({'where':{'id':_0x8b35f0[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x39fc27,null))['then'](function(_0x167a92){if(_0x167a92){_0x8b35f0[_0x66cf('0x57')]['MailAccountId']=_0x167a92['id'];return db[_0x66cf('0x60')]['create'](_0x8b35f0[_0x66cf('0x57')]);}})[_0x66cf('0x1b')](respondWithResult(_0x39fc27,null))[_0x66cf('0x24')](handleError(_0x39fc27,null));};exports[_0x66cf('0x61')]=function(_0x2cf23a,_0xd00682,_0x1f796e){var _0xae42ae={'raw':![],'where':{}};var _0x36f3db={};var _0x47b6ba={'count':0x0,'rows':[]};return db[_0x66cf('0x39')][_0x66cf('0x62')]({'where':{'id':_0x2cf23a['params']['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0xd00682,null))[_0x66cf('0x1b')](function(_0x364102){if(_0x364102){_0x36f3db['model']=_[_0x66cf('0x3e')](db[_0x66cf('0x60')][_0x66cf('0x3a')]);_0x36f3db['query']=_[_0x66cf('0x3e')](_0x2cf23a['query']);_0x36f3db['filters']=_[_0x66cf('0x41')](_0x36f3db[_0x66cf('0x3d')],_0x36f3db[_0x66cf('0x43')]);_0xae42ae[_0x66cf('0x40')]=_[_0x66cf('0x41')](_0x36f3db[_0x66cf('0x3d')],qs['fields'](_0x2cf23a[_0x66cf('0x43')]['fields']));_0xae42ae[_0x66cf('0x40')]=_0xae42ae[_0x66cf('0x40')]['length']?_0xae42ae[_0x66cf('0x40')]:_0x36f3db[_0x66cf('0x3d')];if(!_0x2cf23a[_0x66cf('0x43')][_0x66cf('0x45')](_0x66cf('0x46'))){_0xae42ae[_0x66cf('0x2b')]=qs[_0x66cf('0x2b')](_0x2cf23a[_0x66cf('0x43')][_0x66cf('0x2b')]);_0xae42ae['offset']=qs[_0x66cf('0x2a')](_0x2cf23a[_0x66cf('0x43')][_0x66cf('0x2a')]);}_0xae42ae[_0x66cf('0x47')]=qs[_0x66cf('0x48')](_0x2cf23a[_0x66cf('0x43')][_0x66cf('0x48')]);_0xae42ae[_0x66cf('0x4b')]=qs[_0x66cf('0x3f')](_[_0x66cf('0x49')](_0x2cf23a[_0x66cf('0x43')],_0x36f3db[_0x66cf('0x3f')]));_0xae42ae[_0x66cf('0x4b')][_0x66cf('0x5c')]=_0x364102['id'];if(_0x2cf23a[_0x66cf('0x43')]['filter']){_0xae42ae[_0x66cf('0x4b')]=_[_0x66cf('0x4c')](_0xae42ae[_0x66cf('0x4b')],{'$or':_[_0x66cf('0x38')](_0xae42ae['attributes'],function(_0x17b9db){var _0x5a093e={};_0x5a093e[_0x17b9db]={'$like':'%'+_0x2cf23a[_0x66cf('0x43')][_0x66cf('0x4a')]+'%'};return _0x5a093e;})});}_0xae42ae=_[_0x66cf('0x4c')]({},_0xae42ae,_0x2cf23a[_0x66cf('0x4d')]);return db['CannedAnswer'][_0x66cf('0x29')]({'where':_0xae42ae[_0x66cf('0x4b')]})[_0x66cf('0x1b')](function(_0x4fa253){_0x47b6ba['count']=_0x4fa253;if(_0x2cf23a['query'][_0x66cf('0x4e')]){_0xae42ae[_0x66cf('0x54')]=[{'all':!![]}];}return db[_0x66cf('0x60')]['findAll'](_0xae42ae);})[_0x66cf('0x1b')](function(_0x339fcf){_0x47b6ba[_0x66cf('0x50')]=_0x339fcf;return _0x47b6ba;});}})['then'](respondWithFilteredResult(_0xd00682,_0xae42ae))['catch'](handleError(_0xd00682,null));};exports[_0x66cf('0x63')]=function(_0x366f07,_0x27e572,_0x55b2fa){return db[_0x66cf('0x39')]['find']({'where':{'id':_0x366f07[_0x66cf('0x52')]['id']}})['then'](handleEntityNotFound(_0x27e572,null))[_0x66cf('0x1b')](function(_0x509878){if(_0x509878){return _0x509878[_0x66cf('0x63')](_0x366f07[_0x66cf('0x43')][_0x66cf('0x64')]);}})[_0x66cf('0x1b')](respondWithStatusCode(_0x27e572,null))[_0x66cf('0x24')](handleError(_0x27e572,null));};exports[_0x66cf('0x5e')]=function(_0x59f5d7,_0x821872){var _0x22e16b={'name':_0x59f5d7[_0x66cf('0x57')]['name'],'key':_0x59f5d7[_0x66cf('0x57')]['key'],'email':_0x59f5d7['body']['email'],'ListId':_0x59f5d7['body'][_0x66cf('0x65')],'active':!_[_0x66cf('0x66')](_0x59f5d7['body']['active'])?_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x67')]:!![],'description':_0x59f5d7['body'][_0x66cf('0x68')]||null,'Imap':{},'Smtp':{}};if(_[_0x66cf('0x66')](_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x69')])){if(_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x6a')]){_0x22e16b[_0x66cf('0x35')][_0x66cf('0x6b')]=_0x22e16b[_0x66cf('0x37')][_0x66cf('0x6b')]=_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x6c')];_0x22e16b['Imap'][_0x66cf('0x6d')]=_0x22e16b[_0x66cf('0x37')][_0x66cf('0x6e')]=_0x59f5d7['body']['cpassword'];}else{_0x22e16b[_0x66cf('0x35')][_0x66cf('0x6f')]=_0x22e16b['Smtp'][_0x66cf('0x6f')]=![];}_0x22e16b[_0x66cf('0x35')]['host']=_0x59f5d7[_0x66cf('0x57')]['Imap']['host'];_0x22e16b[_0x66cf('0x35')][_0x66cf('0x70')]=_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x35')]['port'];_0x22e16b[_0x66cf('0x37')][_0x66cf('0x71')]=_0x59f5d7['body']['Smtp'][_0x66cf('0x71')];_0x22e16b[_0x66cf('0x37')]['port']=_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x37')][_0x66cf('0x70')];}else{_0x22e16b[_0x66cf('0x35')][_0x66cf('0x72')]=_0x22e16b[_0x66cf('0x37')][_0x66cf('0x72')]=_0x59f5d7['body'][_0x66cf('0x69')];_0x22e16b[_0x66cf('0x35')][_0x66cf('0x6b')]=_0x22e16b[_0x66cf('0x37')][_0x66cf('0x6b')]=_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x6c')];_0x22e16b['Imap'][_0x66cf('0x6d')]=_0x22e16b['Smtp']['pass']=_0x59f5d7[_0x66cf('0x57')][_0x66cf('0x73')];}return db[_0x66cf('0x39')][_0x66cf('0x5e')](_0x22e16b,{'include':[{'model':db[_0x66cf('0x36')],'as':_0x66cf('0x37')},{'model':db[_0x66cf('0x58')],'as':'Imap'}]})['then'](function(_0x24500b){var _0x4c04ac=_0x59f5d7[_0x66cf('0x6b')][_0x66cf('0x74')]({'plain':!![]});if(!_0x4c04ac)throw new Error(_0x66cf('0x75'));if(_0x4c04ac['role']===_0x66cf('0x6b')){var _0x406d9b=_0x24500b[_0x66cf('0x74')]({'plain':!![]});return db[_0x66cf('0x76')]['find']({'where':{'name':_0x66cf('0x2f'),'userProfileId':_0x4c04ac[_0x66cf('0x77')]},'raw':!![]})[_0x66cf('0x1b')](function(_0x465a49){if(_0x465a49&&_0x465a49[_0x66cf('0x78')]===0x0){return db[_0x66cf('0x30')][_0x66cf('0x5e')]({'name':_0x406d9b[_0x66cf('0x32')],'resourceId':_0x406d9b['id'],'type':_0x465a49[_0x66cf('0x32')],'sectionId':_0x465a49['id']},{})['then'](function(){return _0x24500b;});}else{return _0x24500b;}})[_0x66cf('0x24')](function(_0xfb84aa){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfb84aa);throw _0xfb84aa;});}return _0x24500b;})[_0x66cf('0x1b')](respondWithResult(_0x821872,0xc9))[_0x66cf('0x24')](handleError(_0x821872,null));};exports[_0x66cf('0x79')]=function(_0x32ee54,_0x76590a,_0x337785){return db['MailAccount'][_0x66cf('0x62')]({'where':{'id':_0x32ee54[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x76590a,null))[_0x66cf('0x1b')](function(_0x522d5e){if(_0x522d5e){return _0x522d5e['getImap']();}return null;})[_0x66cf('0x1b')](respondWithResult(_0x76590a,null))[_0x66cf('0x24')](handleError(_0x76590a,null));};exports['addImap']=function(_0x1a187c,_0x4c23bd,_0x6e792c){if(_0x1a187c[_0x66cf('0x57')]['id']){delete _0x1a187c[_0x66cf('0x57')]['id'];}return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x1a187c[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x4c23bd,null))['then'](function(_0x4ffb0d){if(_0x4ffb0d){_0x1a187c[_0x66cf('0x57')][_0x66cf('0x5c')]=_0x4ffb0d['id'];return db[_0x66cf('0x58')][_0x66cf('0x5e')](_0x1a187c[_0x66cf('0x57')]);}})[_0x66cf('0x1b')](respondWithResult(_0x4c23bd,null))[_0x66cf('0x24')](handleError(_0x4c23bd,null));};exports[_0x66cf('0x7a')]=function(_0x368a52,_0x708b15,_0x24e205){return db[_0x66cf('0x39')][_0x66cf('0x62')]({'where':{'id':_0x368a52[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x708b15,null))[_0x66cf('0x1b')](function(_0x2f724d){if(_0x2f724d){return _0x2f724d['setImap'](null);}return null;})[_0x66cf('0x1b')](respondWithStatusCode(_0x708b15,null))['catch'](handleError(_0x708b15,null));};exports[_0x66cf('0x7b')]=function(_0x35fcb4,_0x27e101,_0x41fdf5){return db[_0x66cf('0x39')][_0x66cf('0x62')]({'where':{'id':_0x35fcb4[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x27e101,null))[_0x66cf('0x1b')](function(_0x14e50d){if(_0x14e50d){return _0x14e50d['getSmtp']();}return null;})['then'](respondWithResult(_0x27e101,null))[_0x66cf('0x24')](handleError(_0x27e101,null));};exports[_0x66cf('0x7c')]=function(_0x236449,_0x18084d,_0x5efa46){if(_0x236449['body']['id']){delete _0x236449[_0x66cf('0x57')]['id'];}return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x236449['params']['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x18084d,null))[_0x66cf('0x1b')](function(_0x5c2c70){if(_0x5c2c70){_0x236449['body'][_0x66cf('0x5c')]=_0x5c2c70['id'];return db[_0x66cf('0x36')][_0x66cf('0x5e')](_0x236449[_0x66cf('0x57')]);}})[_0x66cf('0x1b')](respondWithResult(_0x18084d,null))[_0x66cf('0x24')](handleError(_0x18084d,null));};exports[_0x66cf('0x7d')]=function(_0x463b70,_0xa8a4ec,_0x36ba98){return db[_0x66cf('0x39')][_0x66cf('0x62')]({'where':{'id':_0x463b70[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0xa8a4ec,null))[_0x66cf('0x1b')](function(_0xba4323){if(_0xba4323){return _0xba4323[_0x66cf('0x7e')](null);}return null;})['then'](respondWithStatusCode(_0xa8a4ec,null))[_0x66cf('0x24')](handleError(_0xa8a4ec,null));};exports['addInteraction']=function(_0x31f38d,_0x57af66,_0x25cbb2){return db['MailInteraction']['find']({'where':{'id':_0x31f38d[_0x66cf('0x52')]['id']}})['then'](handleEntityNotFound(_0x57af66,null))[_0x66cf('0x1b')](function(_0xdac608){if(_0xdac608){return _0xdac608[_0x66cf('0x7f')](_0x31f38d[_0x66cf('0x57')][_0x66cf('0x64')],_['omit'](_0x31f38d[_0x66cf('0x57')],[_0x66cf('0x64'),'id'])||{});}})[_0x66cf('0x1b')](respondWithResult(_0x57af66,null))[_0x66cf('0x24')](handleError(_0x57af66,null));};exports[_0x66cf('0x80')]=function(_0x163ffc,_0x3b8529,_0x560960){var _0x24bcab={'raw':![],'where':{}};var _0x4e81c8={};var _0x7663={'count':0x0,'rows':[]};return db[_0x66cf('0x39')][_0x66cf('0x62')]({'where':{'id':_0x163ffc[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x3b8529,null))[_0x66cf('0x1b')](function(_0x227f93){if(_0x227f93){_0x4e81c8[_0x66cf('0x3d')]=_[_0x66cf('0x3e')](db[_0x66cf('0x81')]['rawAttributes']);_0x4e81c8[_0x66cf('0x43')]=_[_0x66cf('0x3e')](_0x163ffc['query']);_0x4e81c8['filters']=_[_0x66cf('0x41')](_0x4e81c8[_0x66cf('0x3d')],_0x4e81c8[_0x66cf('0x43')]);_0x24bcab[_0x66cf('0x40')]=_['intersection'](_0x4e81c8[_0x66cf('0x3d')],qs[_0x66cf('0x42')](_0x163ffc[_0x66cf('0x43')]['fields']));_0x24bcab[_0x66cf('0x40')]=_0x24bcab[_0x66cf('0x40')]['length']?_0x24bcab[_0x66cf('0x40')]:_0x4e81c8[_0x66cf('0x3d')];if(!_0x163ffc[_0x66cf('0x43')]['hasOwnProperty'](_0x66cf('0x46'))){_0x24bcab[_0x66cf('0x2b')]=qs[_0x66cf('0x2b')](_0x163ffc[_0x66cf('0x43')][_0x66cf('0x2b')]);_0x24bcab[_0x66cf('0x2a')]=qs[_0x66cf('0x2a')](_0x163ffc[_0x66cf('0x43')][_0x66cf('0x2a')]);}_0x24bcab['order']=qs[_0x66cf('0x48')](_0x163ffc[_0x66cf('0x43')]['sort']);_0x24bcab[_0x66cf('0x4b')]=qs[_0x66cf('0x3f')](_[_0x66cf('0x49')](_0x163ffc[_0x66cf('0x43')],_0x4e81c8[_0x66cf('0x3f')]));_0x24bcab['where'][_0x66cf('0x5c')]=_0x227f93['id'];if(_0x163ffc[_0x66cf('0x43')][_0x66cf('0x4a')]){_0x24bcab[_0x66cf('0x4b')]=_['merge'](_0x24bcab['where'],{'$or':_['map'](_0x24bcab['attributes'],function(_0x4e7f0f){var _0x27aa11={};_0x27aa11[_0x4e7f0f]={'$like':'%'+_0x163ffc[_0x66cf('0x43')][_0x66cf('0x4a')]+'%'};return _0x27aa11;})});}_0x24bcab=_[_0x66cf('0x4c')]({},_0x24bcab,_0x163ffc[_0x66cf('0x4d')]);return db[_0x66cf('0x81')][_0x66cf('0x29')]({'where':_0x24bcab[_0x66cf('0x4b')]})[_0x66cf('0x1b')](function(_0x4c1473){_0x7663[_0x66cf('0x29')]=_0x4c1473;if(_0x163ffc['query']['includeAll']){_0x24bcab[_0x66cf('0x54')]=[{'model':db['CmContact'],'as':_0x66cf('0x82'),'required':![]},{'model':db[_0x66cf('0x83')],'as':_0x66cf('0x84'),'attributes':[_0x66cf('0x32'),_0x66cf('0x85'),_0x66cf('0x86')],'required':![]},{'model':db[_0x66cf('0x87')],'as':_0x66cf('0x88'),'attributes':['id',_0x66cf('0x32'),'color'],'where':_0x163ffc[_0x66cf('0x43')]['tag']?{'id':_0x163ffc[_0x66cf('0x43')][_0x66cf('0x89')]}:undefined,'required':_0x163ffc['query'][_0x66cf('0x89')]?!![]:![]}];}return db[_0x66cf('0x81')][_0x66cf('0x4f')](_0x24bcab);})['then'](function(_0x56559c){_0x7663[_0x66cf('0x50')]=_0x56559c;return _0x7663;});}})[_0x66cf('0x1b')](respondWithFilteredResult(_0x3b8529,_0x24bcab))[_0x66cf('0x24')](handleError(_0x3b8529,null));};exports[_0x66cf('0x8a')]=function(_0x53eee1,_0x1090e4,_0x2ddaf3){return db[_0x66cf('0x39')]['findOne']({'where':{'id':_0x53eee1[_0x66cf('0x52')]['id']}})['then'](handleEntityNotFound(_0x1090e4,null))[_0x66cf('0x1b')](function(_0x582bf5){if(_0x582bf5){return db[_0x66cf('0x8b')][_0x66cf('0x8c')](function(_0x355809){return db[_0x66cf('0x8d')]['destroy']({'where':{'MailAccountId':_0x53eee1['params']['id']},'transaction':_0x355809})[_0x66cf('0x1b')](function(_0x3b893d){var _0x36f042=_['map'](_0x53eee1['body'],function(_0x3fb5d4){_0x3fb5d4['MailAccountId']=_0x53eee1['params']['id'];return _0x3fb5d4;});return db['MailApplication']['bulkCreate'](_0x36f042,{'transaction':_0x355809});});})[_0x66cf('0x1b')](function(){return db[_0x66cf('0x8d')]['findAndCountAll']({'where':{'MailAccountId':_0x53eee1[_0x66cf('0x52')]['id']},'order':'priority'});});}})[_0x66cf('0x1b')](respondWithResult(_0x1090e4,null))[_0x66cf('0x24')](handleError(_0x1090e4,null));};exports['getApplications']=function(_0x41092a,_0x7fc064,_0x3b2872){var _0x457434={};var _0x49f4c7={};var _0x1a08c3;var _0x24c97a;return db['MailAccount'][_0x66cf('0x62')]({'where':{'id':_0x41092a[_0x66cf('0x52')]['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x7fc064,null))['then'](function(_0x21e309){if(_0x21e309){_0x1a08c3=_0x21e309;_0x49f4c7[_0x66cf('0x3d')]=_[_0x66cf('0x3e')](db[_0x66cf('0x8d')]['rawAttributes']);_0x49f4c7[_0x66cf('0x43')]=_[_0x66cf('0x3e')](_0x41092a[_0x66cf('0x43')]);_0x49f4c7[_0x66cf('0x3f')]=_[_0x66cf('0x41')](_0x49f4c7[_0x66cf('0x3d')],_0x49f4c7[_0x66cf('0x43')]);_0x457434['attributes']=_[_0x66cf('0x41')](_0x49f4c7[_0x66cf('0x3d')],qs[_0x66cf('0x42')](_0x41092a['query']['fields']));_0x457434['attributes']=_0x457434['attributes']['length']?_0x457434[_0x66cf('0x40')]:_0x49f4c7[_0x66cf('0x3d')];_0x457434[_0x66cf('0x47')]=qs[_0x66cf('0x48')](_0x41092a['query'][_0x66cf('0x48')]);_0x457434[_0x66cf('0x4b')]=qs['filters'](_['pick'](_0x41092a[_0x66cf('0x43')],_0x49f4c7['filters']));if(_0x41092a['query']['filter']){_0x457434[_0x66cf('0x4b')]=_['merge'](_0x457434[_0x66cf('0x4b')],{'$or':_[_0x66cf('0x38')](_0x457434[_0x66cf('0x40')],function(_0x4abb41){var _0x27b5c0={};_0x27b5c0[_0x4abb41]={'$like':'%'+_0x41092a[_0x66cf('0x43')]['filter']+'%'};return _0x27b5c0;})});}_0x457434=_[_0x66cf('0x4c')]({},_0x457434,_0x41092a['options']);return _0x1a08c3[_0x66cf('0x8e')](_0x457434);}})[_0x66cf('0x1b')](function(_0x55b7ef){if(_0x55b7ef){_0x24c97a=_0x55b7ef['length'];if(!_0x41092a[_0x66cf('0x43')][_0x66cf('0x45')](_0x66cf('0x46'))){_0x457434[_0x66cf('0x2b')]=qs['limit'](_0x41092a['query']['limit']);_0x457434[_0x66cf('0x2a')]=qs[_0x66cf('0x2a')](_0x41092a[_0x66cf('0x43')][_0x66cf('0x2a')]);}return _0x1a08c3[_0x66cf('0x8e')](_0x457434);}})[_0x66cf('0x1b')](function(_0x474982){if(_0x474982){return _0x474982?{'count':_0x24c97a,'rows':_0x474982}:null;}})[_0x66cf('0x1b')](respondWithResult(_0x7fc064,null))[_0x66cf('0x24')](handleError(_0x7fc064,null));};exports['getMessages']=function(_0x39823c,_0x49a684,_0x54f416){var _0x480355={'raw':!![],'where':{}};var _0x2a7f00={};var _0x1d8456={'count':0x0,'rows':[]};return db[_0x66cf('0x39')][_0x66cf('0x62')]({'where':{'id':_0x39823c['params']['id']}})['then'](handleEntityNotFound(_0x49a684,null))['then'](function(_0x2a4237){if(_0x2a4237){_0x2a7f00[_0x66cf('0x3d')]=_['keys'](db[_0x66cf('0x8f')]['rawAttributes']);_0x2a7f00[_0x66cf('0x43')]=_[_0x66cf('0x3e')](_0x39823c['query']);_0x2a7f00[_0x66cf('0x3f')]=_['intersection'](_0x2a7f00[_0x66cf('0x3d')],_0x2a7f00[_0x66cf('0x43')]);_0x480355[_0x66cf('0x40')]=_[_0x66cf('0x41')](_0x2a7f00[_0x66cf('0x3d')],qs[_0x66cf('0x42')](_0x39823c[_0x66cf('0x43')][_0x66cf('0x42')]));_0x480355[_0x66cf('0x40')]=_0x480355['attributes'][_0x66cf('0x44')]?_0x480355[_0x66cf('0x40')]:_0x2a7f00['model'];if(!_0x39823c[_0x66cf('0x43')]['hasOwnProperty'](_0x66cf('0x46'))){_0x480355[_0x66cf('0x2b')]=qs[_0x66cf('0x2b')](_0x39823c['query'][_0x66cf('0x2b')]);_0x480355[_0x66cf('0x2a')]=qs['offset'](_0x39823c[_0x66cf('0x43')][_0x66cf('0x2a')]);}_0x480355['order']=qs['sort'](_0x39823c['query'][_0x66cf('0x48')]);_0x480355[_0x66cf('0x4b')]=qs['filters'](_[_0x66cf('0x49')](_0x39823c[_0x66cf('0x43')],_0x2a7f00[_0x66cf('0x3f')]));_0x480355[_0x66cf('0x4b')][_0x66cf('0x5c')]=_0x2a4237['id'];if(_0x39823c[_0x66cf('0x43')][_0x66cf('0x4a')]){_0x480355[_0x66cf('0x4b')]=_[_0x66cf('0x4c')](_0x480355[_0x66cf('0x4b')],{'$or':_[_0x66cf('0x38')](_0x480355['attributes'],function(_0x4101cd){var _0x2386f8={};_0x2386f8[_0x4101cd]={'$like':'%'+_0x39823c['query'][_0x66cf('0x4a')]+'%'};return _0x2386f8;})});}if(_0x39823c[_0x66cf('0x43')]['$gte']){var _0x54f851=_0x39823c[_0x66cf('0x43')][_0x66cf('0x90')][_0x66cf('0x91')](',');var _0x26cdef={};_0x26cdef[_0x54f851[0x0]]={'$gte':moment(_0x54f851[0x1])['format'](_0x66cf('0x92'))};_0x480355[_0x66cf('0x4b')]=_[_0x66cf('0x4c')](_0x480355[_0x66cf('0x4b')],_0x26cdef);}_0x480355=_[_0x66cf('0x4c')]({},_0x480355,_0x39823c[_0x66cf('0x4d')]);return db[_0x66cf('0x8f')][_0x66cf('0x29')]({'where':_0x480355[_0x66cf('0x4b')]})[_0x66cf('0x1b')](function(_0x1f13ae){_0x1d8456['count']=_0x1f13ae;if(_0x39823c[_0x66cf('0x43')][_0x66cf('0x4e')]){_0x480355[_0x66cf('0x54')]=[{'all':!![]}];}return db[_0x66cf('0x8f')][_0x66cf('0x4f')](_0x480355);})[_0x66cf('0x1b')](function(_0x84ea8){_0x1d8456[_0x66cf('0x50')]=_0x84ea8;return _0x1d8456;});}})['then'](respondWithFilteredResult(_0x49a684,_0x480355))[_0x66cf('0x24')](handleError(_0x49a684,null));};exports[_0x66cf('0x33')]=function(_0x1b2e87,_0x5980bf,_0x39c88b){var _0xe24134,_0x163732={},_0x253f09;if(_0x1b2e87[_0x66cf('0x57')]['to']){_0x253f09=_0x1b2e87[_0x66cf('0x57')]['to'][_0x66cf('0x91')](',')[0x0];}return db[_0x66cf('0x39')]['find']({'where':{'id':_0x1b2e87[_0x66cf('0x52')]['id']},'include':[{'model':db[_0x66cf('0x93')],'as':_0x66cf('0x94'),'include':[{'model':db['CmContact'],'as':_0x66cf('0x95'),'where':{'email':_0x253f09},'limit':0x1,'order':[['updatedAt',_0x66cf('0x96')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})['then'](handleEntityNotFound(_0x5980bf,null))[_0x66cf('0x1b')](function(_0x43c427){if(_0x43c427){_0xe24134=_0x43c427;if(_0x43c427['Smtp']){if(_[_0x66cf('0x66')](_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x97')])){_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x97')]=util[_0x66cf('0x98')](_0x66cf('0x99'),_0x43c427['name'],_0x43c427[_0x66cf('0x9a')]||_0x43c427[_0x66cf('0x37')][_0x66cf('0x6b')]);}if(_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x9b')]&&_0x1b2e87[_0x66cf('0x57')]['attachments'][_0x66cf('0x44')]){for(var _0x4a85d1=0x0;_0x4a85d1<_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x9b')][_0x66cf('0x44')];_0x4a85d1+=0x1){_0x1b2e87[_0x66cf('0x57')]['attachments'][_0x4a85d1]={'filename':_0x1b2e87[_0x66cf('0x57')]['attachments'][_0x4a85d1][_0x66cf('0x32')],'path':path['join'](config[_0x66cf('0x9c')],_0x66cf('0x9d'),_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x9b')][_0x4a85d1][_0x66cf('0x9e')])};}}var _0x3bdb51={'tls':{'rejectUnauthorized':![]}};if(_[_0x66cf('0x66')](_0x43c427['Smtp']['service'])){if(_0x43c427[_0x66cf('0x37')][_0x66cf('0x6f')]){_0x3bdb51['auth']={'user':_0x43c427['Smtp'][_0x66cf('0x6b')],'pass':_0x43c427['Smtp'][_0x66cf('0x6e')]};}_0x3bdb51['host']=_0x43c427[_0x66cf('0x37')][_0x66cf('0x71')];_0x3bdb51[_0x66cf('0x70')]=_0x43c427[_0x66cf('0x37')][_0x66cf('0x70')];_0x3bdb51[_0x66cf('0x9f')]=_0x43c427[_0x66cf('0x37')][_0x66cf('0x9f')];}else{_0x3bdb51[_0x66cf('0x72')]=_0x43c427[_0x66cf('0x37')][_0x66cf('0x72')];_0x3bdb51[_0x66cf('0xa0')]={'user':_0x43c427[_0x66cf('0x37')][_0x66cf('0x6b')],'pass':_0x43c427['Smtp'][_0x66cf('0x6e')]};}return respondWithRpcPromise(_0x66cf('0xa1'),_0x66cf('0xa2'),{'account':_0x3bdb51,'message':_0x1b2e87['body']});}else{throw new Error(_0x66cf('0xa3'));}}})['then'](function(_0x3d7e96){if(_0x3d7e96){_0x163732=_0x3d7e96;if(_0xe24134['List']){if(_0xe24134[_0x66cf('0x94')][_0x66cf('0x95')][_0x66cf('0x44')]){return _0xe24134[_0x66cf('0x94')]['Contacts'][0x0];}else{return db['CmContact'][_0x66cf('0x5e')](_[_0x66cf('0x12')](_0x1b2e87[_0x66cf('0x57')],{'firstName':_0x1b2e87[_0x66cf('0x57')]['to'],'email':_0x1b2e87[_0x66cf('0x57')]['to'],'phone':_0x1b2e87[_0x66cf('0x57')]['to'],'ListId':_0xe24134[_0x66cf('0x65')]}));}}else{throw new Error(_0x66cf('0xa3'));}}})[_0x66cf('0x1b')](function(_0x3bc18c){if(_0x3bc18c){var _0x49b250={'UserId':_0x1b2e87[_0x66cf('0x6b')]['id'],'ContactId':_0x3bc18c['id'],'MailAccountId':_0xe24134['id'],'inReplyTo':_0x163732[_0x66cf('0xa4')],'to':_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x97')],'cc':_0x1b2e87[_0x66cf('0x57')]['cc'],'subject':_0x1b2e87[_0x66cf('0x57')][_0x66cf('0xa5')],'attach':_0x1b2e87[_0x66cf('0x57')][_0x66cf('0xa6')],'firstMsgDirection':_0x66cf('0xa7'),'lastMsgAt':moment()[_0x66cf('0x98')](_0x66cf('0x92')),'lastMsgDirection':_0x66cf('0xa7'),'lastMsgBody':_0x1b2e87[_0x66cf('0x57')][_0x66cf('0x57')],'Messages':[_[_0x66cf('0x4c')](_0x1b2e87[_0x66cf('0x57')],{'messageId':_0x163732[_0x66cf('0xa4')],'sentAt':moment()[_0x66cf('0x98')](_0x66cf('0x92')),'read':!![],'MailAccountId':_0xe24134['id'],'UserId':_0x1b2e87[_0x66cf('0x6b')]['id'],'ContactId':_0x3bc18c['id']})]};if(_0x1b2e87[_0x66cf('0x57')]['Interaction']){_0x49b250=_[_0x66cf('0x4c')](_0x49b250,_0x1b2e87['body'][_0x66cf('0xa8')]);}return db['MailInteraction'][_0x66cf('0x5e')](_0x49b250,{'include':[{'model':db[_0x66cf('0x8f')],'as':'Messages'}]});}})[_0x66cf('0x1b')](respondWithResult(_0x5980bf,null))[_0x66cf('0x24')](handleError(_0x5980bf,null));};exports[_0x66cf('0xa9')]=function(_0x15bbd0,_0x33cc5c,_0x47ae85){return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x15bbd0[_0x66cf('0x52')]['id']},'include':[{'model':db[_0x66cf('0x36')],'as':_0x66cf('0x37'),'raw':!![]}]})[_0x66cf('0x1b')](handleEntityNotFound(_0x33cc5c,null))[_0x66cf('0x1b')](function(_0x45df07){if(_0x45df07&&_0x45df07[_0x66cf('0x37')]){var _0xd1e3da={'id':_0x45df07['id'],'tls':{'rejectUnauthorized':![]}};if(_0x45df07['Smtp']['service']){_0xd1e3da[_0x66cf('0x72')]=_0x45df07[_0x66cf('0x37')][_0x66cf('0x72')];}else{_0xd1e3da[_0x66cf('0x71')]=_0x45df07['Smtp']['host'];_0xd1e3da[_0x66cf('0x70')]=_0x45df07[_0x66cf('0x37')][_0x66cf('0x70')];_0xd1e3da[_0x66cf('0x9f')]=_0x45df07[_0x66cf('0x37')][_0x66cf('0x9f')];}if(_0x45df07[_0x66cf('0x37')][_0x66cf('0x6f')]){_0xd1e3da[_0x66cf('0xa0')]={'user':_0x45df07['Smtp'][_0x66cf('0x6b')],'pass':_0x45df07[_0x66cf('0x37')][_0x66cf('0x6e')]};}return respondWithRpcPromise(_0x66cf('0xaa'),'verifySmtp',{'account':_0xd1e3da});}})[_0x66cf('0x1b')](respondWithResult(_0x33cc5c,null))[_0x66cf('0x24')](handleError(_0x33cc5c,null));};exports[_0x66cf('0x2e')]=function(_0x515b89,_0x3b96b9){return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x515b89['params']['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x3b96b9,null))[_0x66cf('0x1b')](function(_0x4c89a4){if(_0x4c89a4&&_0x4c89a4[_0x66cf('0x72')]){throw new db[(_0x66cf('0x18'))][(_0x66cf('0xab'))](_0x66cf('0xac'));}return _0x4c89a4;})['then'](removeEntity(_0x3b96b9,null))[_0x66cf('0x24')](handleError(_0x3b96b9,null));};exports['addAgents']=function(_0x314834,_0x11d12c,_0x44c851){return db['MailAccount']['find']({'where':{'id':_0x314834['params']['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x11d12c,null))[_0x66cf('0x1b')](function(_0x50bce0){if(_0x50bce0){return _0x50bce0[_0x66cf('0xad')](_0x314834[_0x66cf('0x57')][_0x66cf('0x64')],_['omit'](_0x314834[_0x66cf('0x57')],['ids','id'])||{})[_0x66cf('0xae')](function(_0xf1a731){for(var _0x2e6824=0x0;_0x2e6824<_0x314834[_0x66cf('0x57')][_0x66cf('0x64')][_0x66cf('0x44')];_0x2e6824+=0x1){socket[_0x66cf('0xaf')](_0x66cf('0xb0'),{'UserId':_0x314834['body']['ids'][_0x2e6824],'MailAccountId':_0x314834[_0x66cf('0x52')]['id']});}return _0xf1a731;});}})[_0x66cf('0x1b')](respondWithResult(_0x11d12c,null))[_0x66cf('0x24')](handleError(_0x11d12c,null));};exports[_0x66cf('0xb1')]=function(_0x3da832,_0x424e81,_0x1a0e59){return db[_0x66cf('0x39')][_0x66cf('0x55')]({'where':{'id':_0x3da832['params']['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x424e81,null))[_0x66cf('0x1b')](function(_0x445f3b){if(_0x445f3b){return _0x445f3b[_0x66cf('0xb1')](_0x3da832[_0x66cf('0x43')]['ids'])[_0x66cf('0x1b')](function(){if(_[_0x66cf('0xb2')](_0x3da832[_0x66cf('0x43')][_0x66cf('0x64')])){for(var _0x5e4403=0x0;_0x5e4403<_0x3da832['query']['ids'][_0x66cf('0x44')];_0x5e4403+=0x1){socket[_0x66cf('0xaf')]('userMailAccount:remove',{'UserId':Number(_0x3da832[_0x66cf('0x43')][_0x66cf('0x64')][_0x5e4403]),'MailAccountId':Number(_0x3da832[_0x66cf('0x52')]['id'])});}}else{socket['emit'](_0x66cf('0xb3'),{'UserId':Number(_0x3da832[_0x66cf('0x43')][_0x66cf('0x64')]),'MailAccountId':Number(_0x3da832[_0x66cf('0x52')]['id'])});}});}})[_0x66cf('0x1b')](respondWithStatusCode(_0x424e81,null))[_0x66cf('0x24')](handleError(_0x424e81,null));};exports[_0x66cf('0xb4')]=function(_0x4845fa,_0x56342c,_0x183499){var _0x178acc={};var _0x548a4a={};var _0x33b4cf;var _0x405007;return db['MailAccount']['findOne']({'where':{'id':_0x4845fa['params']['id']}})[_0x66cf('0x1b')](handleEntityNotFound(_0x56342c,null))[_0x66cf('0x1b')](function(_0x414dcb){if(_0x414dcb){_0x33b4cf=_0x414dcb;_0x548a4a[_0x66cf('0x3d')]=_['keys'](db[_0x66cf('0x83')]['rawAttributes']);_0x548a4a[_0x66cf('0x43')]=_['keys'](_0x4845fa['query']);_0x548a4a['filters']=_[_0x66cf('0x41')](_0x548a4a[_0x66cf('0x3d')],_0x548a4a['query']);_0x178acc[_0x66cf('0x40')]=_[_0x66cf('0x41')](_0x548a4a[_0x66cf('0x3d')],qs[_0x66cf('0x42')](_0x4845fa['query']['fields']));_0x178acc[_0x66cf('0x40')]=_0x178acc[_0x66cf('0x40')][_0x66cf('0x44')]?_0x178acc['attributes']:_0x548a4a[_0x66cf('0x3d')];_0x178acc[_0x66cf('0x47')]=qs[_0x66cf('0x48')](_0x4845fa[_0x66cf('0x43')][_0x66cf('0x48')]);_0x178acc['where']=qs[_0x66cf('0x3f')](_['pick'](_0x4845fa[_0x66cf('0x43')],_0x548a4a[_0x66cf('0x3f')]));if(_0x4845fa['query']['filter']){_0x178acc[_0x66cf('0x4b')]=_['merge'](_0x178acc[_0x66cf('0x4b')],{'$or':_[_0x66cf('0x38')](_0x178acc['attributes'],function(_0x1c336b){var _0x3c8552={};_0x3c8552[_0x1c336b]={'$like':'%'+_0x4845fa['query']['filter']+'%'};return _0x3c8552;})});}_0x178acc=_[_0x66cf('0x4c')]({},_0x178acc,_0x4845fa['options']);return _0x33b4cf['getAgents'](_0x178acc);}})[_0x66cf('0x1b')](function(_0x298254){if(_0x298254){_0x405007=_0x298254[_0x66cf('0x44')];if(!_0x4845fa[_0x66cf('0x43')][_0x66cf('0x45')](_0x66cf('0x46'))){_0x178acc['limit']=qs[_0x66cf('0x2b')](_0x4845fa[_0x66cf('0x43')][_0x66cf('0x2b')]);_0x178acc[_0x66cf('0x2a')]=qs[_0x66cf('0x2a')](_0x4845fa[_0x66cf('0x43')]['offset']);}return _0x33b4cf['getAgents'](_0x178acc);}})[_0x66cf('0x1b')](function(_0x55684e){if(_0x55684e){return _0x55684e?{'count':_0x405007,'rows':_0x55684e}:null;}})['then'](respondWithResult(_0x56342c,null))[_0x66cf('0x24')](handleError(_0x56342c,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index ec8a7be..63615b4 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 _0x02e9=['../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x2186b9,_0x3a655b){var _0x4cb478=function(_0x2fadfa){while(--_0x2fadfa){_0x2186b9['push'](_0x2186b9['shift']());}};_0x4cb478(++_0x3a655b);}(_0x02e9,0x116));var _0x902e=function(_0xf248ef,_0x1d057b){_0xf248ef=_0xf248ef-0x0;var _0x3cb062=_0x02e9[_0xf248ef];return _0x3cb062;};'use strict';var EventEmitter=require(_0x902e('0x0'));var MailAccount=require(_0x902e('0x1'))['db'][_0x902e('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x902e('0x3')](0x0);var events={'afterCreate':_0x902e('0x4'),'afterUpdate':_0x902e('0x5'),'afterDestroy':_0x902e('0x6')};function emitEvent(_0x42d579){return function(_0x13e5ee,_0x119add,_0x1ac0ec){MailAccountEvents[_0x902e('0x7')](_0x42d579+':'+_0x13e5ee['id'],_0x13e5ee);MailAccountEvents[_0x902e('0x7')](_0x42d579,_0x13e5ee);_0x1ac0ec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x902e('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xcb74=['hook','events','../../mysqldb','MailAccount','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x14b8aa,_0x21ffd0){var _0x16c10d=function(_0x3fa3e7){while(--_0x3fa3e7){_0x14b8aa['push'](_0x14b8aa['shift']());}};_0x16c10d(++_0x21ffd0);}(_0xcb74,0x7f));var _0x4cb7=function(_0x5ce43e,_0xc1c027){_0x5ce43e=_0x5ce43e-0x0;var _0x56daee=_0xcb74[_0x5ce43e];return _0x56daee;};'use strict';var EventEmitter=require(_0x4cb7('0x0'));var MailAccount=require(_0x4cb7('0x1'))['db'][_0x4cb7('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4cb7('0x3')](0x0);var events={'afterCreate':_0x4cb7('0x4'),'afterUpdate':'update','afterDestroy':_0x4cb7('0x5')};function emitEvent(_0x12f01c){return function(_0x67f20a,_0x1d62fe,_0x582eeb){MailAccountEvents[_0x4cb7('0x6')](_0x12f01c+':'+_0x67f20a['id'],_0x67f20a);MailAccountEvents[_0x4cb7('0x6')](_0x12f01c,_0x67f20a);_0x582eeb(null);};}for(var e in events){if(events[_0x4cb7('0x7')](e)){var event=events[e];MailAccount[_0x4cb7('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 549e71a..85168c7 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 _0x613c=['request-promise','path','rimraf','../../config/environment','exports','define','mail_accounts','lodash','util','api'];(function(_0x3c9bdf,_0x3b30cd){var _0x5664a6=function(_0x4ea55c){while(--_0x4ea55c){_0x3c9bdf['push'](_0x3c9bdf['shift']());}};_0x5664a6(++_0x3b30cd);}(_0x613c,0xd9));var _0xc613=function(_0x511637,_0x5467de){_0x511637=_0x511637-0x0;var _0x14d591=_0x613c[_0x511637];return _0x14d591;};'use strict';var _=require(_0xc613('0x0'));var util=require(_0xc613('0x1'));var logger=require('../../config/logger')(_0xc613('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc613('0x3'));var fs=require('fs');var path=require(_0xc613('0x4'));var rimraf=require(_0xc613('0x5'));var config=require(_0xc613('0x6'));var attributes=require('./mailAccount.attributes');module[_0xc613('0x7')]=function(_0x31d092,_0x441019){return _0x31d092[_0xc613('0x8')]('MailAccount',attributes,{'tableName':_0xc613('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4343=['./mailAccount.attributes','exports','mail_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x12065d,_0x105cec){var _0xf49d52=function(_0x54f322){while(--_0x54f322){_0x12065d['push'](_0x12065d['shift']());}};_0xf49d52(++_0x105cec);}(_0x4343,0x158));var _0x3434=function(_0x3444d5,_0x7de214){_0x3444d5=_0x3444d5-0x0;var _0x55e9d8=_0x4343[_0x3444d5];return _0x55e9d8;};'use strict';var _=require(_0x3434('0x0'));var util=require('util');var logger=require(_0x3434('0x1'))(_0x3434('0x2'));var moment=require(_0x3434('0x3'));var BPromise=require(_0x3434('0x4'));var rp=require(_0x3434('0x5'));var fs=require('fs');var path=require(_0x3434('0x6'));var rimraf=require(_0x3434('0x7'));var config=require('../../config/environment');var attributes=require(_0x3434('0x8'));module[_0x3434('0x9')]=function(_0x438e70,_0x367ffb){return _0x438e70['define']('MailAccount',attributes,{'tableName':_0x3434('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 6c980da..b20b115 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 _0xf2c7=['request\x20sent','debug','error','message','result','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','find','ShowMailAccount','NotifyMailAccount','body','difference','CmContact','rawAttributes','createdAt','updatedAt','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','MailApplication','Applications','Smtp','omit','applications','list','orderBy','priority','asc','push','length','close','autoclose','Contacts','ListId','create','List\x20not\x20found','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','inReplyTo','Contact\x20not\x20found','spread','interaction','created','MailMessage','contact','originTo','originCc','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s'];(function(_0x316624,_0x1d755c){var _0x1a1699=function(_0x13febc){while(--_0x13febc){_0x316624['push'](_0x316624['shift']());}};_0x1a1699(++_0x1d755c);}(_0xf2c7,0x1d8));var _0x7f2c=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xf2c7[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x7f2c('0x0'));var util=require(_0x7f2c('0x1'));var moment=require(_0x7f2c('0x2'));var BPromise=require(_0x7f2c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f2c('0x4'));var db=require(_0x7f2c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7f2c('0x6'));var config=require('../../config/environment');var jayson=require(_0x7f2c('0x7'));var client=jayson[_0x7f2c('0x8')]['http']({'port':0x232c});config[_0x7f2c('0x9')]=_[_0x7f2c('0xa')](config[_0x7f2c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7f2c('0xb'))(new Redis(config[_0x7f2c('0x9')]));require(_0x7f2c('0xc'))[_0x7f2c('0xd')](socket);function respondWithRpcPromise(_0x364e2a,_0x2e93d9,_0x4d60eb){return new BPromise(function(_0x34c9f2,_0x17754c){return client[_0x7f2c('0xe')](_0x364e2a,_0x4d60eb)[_0x7f2c('0xf')](function(_0x2247d3){logger[_0x7f2c('0x10')](_0x7f2c('0x11'),_0x2e93d9,_0x7f2c('0x12'));logger[_0x7f2c('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2e93d9,_0x7f2c('0x12'),JSON['stringify'](_0x2247d3));if(_0x2247d3[_0x7f2c('0x14')]){if(_0x2247d3[_0x7f2c('0x14')]['code']===0x1f4){logger['error'](_0x7f2c('0x11'),_0x2e93d9,_0x2247d3[_0x7f2c('0x14')]['message']);return _0x17754c(_0x2247d3[_0x7f2c('0x14')][_0x7f2c('0x15')]);}logger['error'](_0x7f2c('0x11'),_0x2e93d9,_0x2247d3[_0x7f2c('0x14')][_0x7f2c('0x15')]);return _0x34c9f2(_0x2247d3[_0x7f2c('0x14')][_0x7f2c('0x15')]);}else{logger[_0x7f2c('0x10')](_0x7f2c('0x11'),_0x2e93d9,_0x7f2c('0x12'));_0x34c9f2(_0x2247d3[_0x7f2c('0x16')][_0x7f2c('0x15')]);}})['catch'](function(_0x591f54){logger[_0x7f2c('0x14')](_0x7f2c('0x11'),_0x2e93d9,_0x591f54);_0x17754c(_0x591f54);});});}exports[_0x7f2c('0x17')]=function(_0x2d66d8){var _0x277164=this;return new Promise(function(_0x1d1528,_0x130e51){return db[_0x7f2c('0x18')][_0x7f2c('0x19')]({'raw':_0x2d66d8[_0x7f2c('0x1a')]?_0x2d66d8[_0x7f2c('0x1a')][_0x7f2c('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d66d8[_0x7f2c('0x1a')]?_0x2d66d8[_0x7f2c('0x1a')][_0x7f2c('0x1c')]||null:null,'attributes':_0x2d66d8[_0x7f2c('0x1a')]?_0x2d66d8['options'][_0x7f2c('0x1d')]||null:null,'limit':_0x2d66d8[_0x7f2c('0x1a')]?_0x2d66d8['options'][_0x7f2c('0x1e')]||null:null,'include':_0x2d66d8[_0x7f2c('0x1a')]?_0x2d66d8[_0x7f2c('0x1a')]['include']?_[_0x7f2c('0x1f')](_0x2d66d8[_0x7f2c('0x1a')][_0x7f2c('0x20')],function(_0x5198c9){return{'model':db[_0x5198c9[_0x7f2c('0x21')]],'as':_0x5198c9['as'],'attributes':_0x5198c9[_0x7f2c('0x1d')],'include':_0x5198c9[_0x7f2c('0x20')]?_['map'](_0x5198c9[_0x7f2c('0x20')],function(_0x4f5059){return{'model':db[_0x4f5059[_0x7f2c('0x21')]],'as':_0x4f5059['as'],'attributes':_0x4f5059[_0x7f2c('0x1d')],'include':_0x4f5059[_0x7f2c('0x20')]?_[_0x7f2c('0x1f')](_0x4f5059[_0x7f2c('0x20')],function(_0x50ad96){return{'model':db[_0x50ad96[_0x7f2c('0x21')]],'as':_0x50ad96['as'],'attributes':_0x50ad96[_0x7f2c('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f6729){logger[_0x7f2c('0x10')](_0x7f2c('0x17'),_0x2d66d8);logger[_0x7f2c('0x13')](_0x7f2c('0x17'),_0x2d66d8,JSON[_0x7f2c('0x22')](_0x2f6729));_0x1d1528(_0x2f6729);})[_0x7f2c('0x23')](function(_0x241a68){logger[_0x7f2c('0x14')](_0x7f2c('0x17'),_0x241a68[_0x7f2c('0x15')],_0x2d66d8);_0x130e51(_0x277164[_0x7f2c('0x14')](0x1f4,_0x241a68[_0x7f2c('0x15')]));});});};exports['ShowMailAccount']=function(_0x21e2e9){var _0x5613e9=this;return new Promise(function(_0xb69430,_0x192fd1){return db[_0x7f2c('0x18')][_0x7f2c('0x24')]({'raw':_0x21e2e9['options']?_0x21e2e9['options'][_0x7f2c('0x1b')]===undefined?!![]:![]:!![],'where':_0x21e2e9[_0x7f2c('0x1a')]?_0x21e2e9[_0x7f2c('0x1a')][_0x7f2c('0x1c')]||null:null,'attributes':_0x21e2e9[_0x7f2c('0x1a')]?_0x21e2e9[_0x7f2c('0x1a')][_0x7f2c('0x1d')]||null:null,'include':_0x21e2e9['options']?_0x21e2e9[_0x7f2c('0x1a')][_0x7f2c('0x20')]?_[_0x7f2c('0x1f')](_0x21e2e9[_0x7f2c('0x1a')][_0x7f2c('0x20')],function(_0x4faa68){return{'model':db[_0x4faa68[_0x7f2c('0x21')]],'as':_0x4faa68['as'],'attributes':_0x4faa68[_0x7f2c('0x1d')],'include':_0x4faa68[_0x7f2c('0x20')]?_[_0x7f2c('0x1f')](_0x4faa68[_0x7f2c('0x20')],function(_0x2683b2){return{'model':db[_0x2683b2[_0x7f2c('0x21')]],'as':_0x2683b2['as'],'attributes':_0x2683b2[_0x7f2c('0x1d')],'include':_0x2683b2[_0x7f2c('0x20')]?_[_0x7f2c('0x1f')](_0x2683b2['include'],function(_0x48ff74){return{'model':db[_0x48ff74[_0x7f2c('0x21')]],'as':_0x48ff74['as'],'attributes':_0x48ff74['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f2c('0xf')](function(_0xb35f03){logger[_0x7f2c('0x10')](_0x7f2c('0x25'),_0x21e2e9);logger['debug'](_0x7f2c('0x25'),_0x21e2e9,JSON['stringify'](_0xb35f03));_0xb69430(_0xb35f03);})[_0x7f2c('0x23')](function(_0xafd302){logger[_0x7f2c('0x14')](_0x7f2c('0x25'),_0xafd302[_0x7f2c('0x15')],_0x21e2e9);_0x192fd1(_0x5613e9[_0x7f2c('0x14')](0x1f4,_0xafd302['message']));});});};exports[_0x7f2c('0x26')]=function(_0x4cdc44){var _0x5eb47d=this;return new Promise(function(_0x292e45,_0xf7e6a9){var _0x562a0c={'body':_0x4cdc44[_0x7f2c('0x27')],'channel':'mail'};var _0x2ffb78=_[_0x7f2c('0x28')](_['keys'](db[_0x7f2c('0x29')][_0x7f2c('0x2a')]),[_0x7f2c('0x2b'),_0x7f2c('0x2c'),'CompanyId','ListId']);var _0x580836=![];if(_0x4cdc44[_0x7f2c('0x27')]['id']){delete _0x4cdc44[_0x7f2c('0x27')]['id'];}if(_[_0x7f2c('0x2d')](_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x2e')])){return _0xf7e6a9(_0x5eb47d['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x7f2c('0x2d')](_0x4cdc44[_0x7f2c('0x27')]['body'])||_0x4cdc44['body'][_0x7f2c('0x27')]===''){return _0xf7e6a9(_0x5eb47d[_0x7f2c('0x14')](0x1f4,_0x7f2c('0x2f')));}if(_[_0x7f2c('0x2d')](_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x30')])){return _0xf7e6a9(_0x5eb47d[_0x7f2c('0x14')](0x1f4,_0x7f2c('0x31')+_0x2ffb78));}if(!_[_0x7f2c('0x32')](_0x2ffb78,_0x4cdc44[_0x7f2c('0x27')]['mapKey'])){return _0xf7e6a9(_0x5eb47d['error'](0x1f4,_0x7f2c('0x33')+_0x2ffb78));}var _0x5c0c68={};_0x5c0c68[_0x4cdc44[_0x7f2c('0x27')]['mapKey']]=_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x2e')];return db[_0x7f2c('0x18')]['find']({'where':{'id':_0x4cdc44[_0x7f2c('0x34')]['id']},'include':[{'model':db[_0x7f2c('0x35')],'as':_0x7f2c('0x36'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5c0c68,'limit':0x1,'order':[[_0x7f2c('0x2c'),_0x7f2c('0x37')]]}]},{'model':db[_0x7f2c('0x38')],'as':_0x7f2c('0x39')},{'model':db['MailServerOut'],'as':_0x7f2c('0x3a')}]})[_0x7f2c('0xf')](function(_0x400a94){if(_0x400a94&&_0x400a94[_0x7f2c('0x36')]){var _0x669224=_0x400a94['get']({'plain':!![]});_0x562a0c[_0x7f2c('0x34')]=_[_0x7f2c('0x3b')](_0x669224,[_0x7f2c('0x39'),_0x7f2c('0x36')]);_0x562a0c[_0x7f2c('0x3c')]=_0x669224[_0x7f2c('0x39')];_0x562a0c[_0x7f2c('0x3d')]=_0x669224[_0x7f2c('0x36')];_0x562a0c['applications']=_[_0x7f2c('0x3e')](_0x562a0c[_0x7f2c('0x3c')],[_0x7f2c('0x3f')],[_0x7f2c('0x40')]);if(_0x562a0c[_0x7f2c('0x34')]&&_0x562a0c[_0x7f2c('0x34')]['autoclose']){_0x562a0c['applications'][_0x7f2c('0x41')]({'id':0x0,'priority':_0x562a0c[_0x7f2c('0x3c')][_0x7f2c('0x42')]+0x1,'app':_0x7f2c('0x43'),'appdata':_0x7f2c('0x44'),'interval':'*,*,*,*'});}if(_0x562a0c[_0x7f2c('0x34')]['Applications']){delete _0x562a0c[_0x7f2c('0x34')][_0x7f2c('0x39')];}if(_0x562a0c[_0x7f2c('0x34')][_0x7f2c('0x36')]){delete _0x562a0c[_0x7f2c('0x34')]['List'];}if(_0x669224[_0x7f2c('0x36')][_0x7f2c('0x45')][_0x7f2c('0x42')]){return _0x669224['List'][_0x7f2c('0x45')][0x0];}var _0x4d163a=_[_0x7f2c('0xa')](_0x4cdc44['body'],{'firstName':_0x4cdc44[_0x7f2c('0x27')]['from'],'ListId':_0x669224[_0x7f2c('0x46')]});_0x4d163a[_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x30')]]=_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x2e')];return db['CmContact'][_0x7f2c('0x47')](_0x4d163a);}else{throw new Error(_0x7f2c('0x48'));}})[_0x7f2c('0xf')](function(_0x1acba2){_0x562a0c['contact']=_0x1acba2;if(_0x1acba2){if(!_0x4cdc44[_0x7f2c('0x27')]['message'][_0x7f2c('0x49')]){_0x4cdc44[_0x7f2c('0x27')]['message'][_0x7f2c('0x49')]=rs['generate']()+'\x20'+_0x4cdc44['body']['message'][_0x7f2c('0x2e')];}var _0x48a1b8={'ContactId':_0x1acba2['id'],'MailAccountId':_0x4cdc44[_0x7f2c('0x34')]['id'],'inReplyTo':_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x15')][_0x7f2c('0x49')],'to':_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x15')]['from'],'cc':_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x15')]['cc'],'subject':_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x15')][_0x7f2c('0x4a')],'attach':_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x15')][_0x7f2c('0x4b')],'lastMsgAt':moment()[_0x7f2c('0x4c')](_0x7f2c('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x27')]};return db[_0x7f2c('0x4e')]['find']({'where':{'closed':![],'MailAccountId':_0x4cdc44[_0x7f2c('0x34')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x7f2c('0x49')],'where':{'messageId':_0x4cdc44['body'][_0x7f2c('0x15')][_0x7f2c('0x4f')]}}]})[_0x7f2c('0xf')](function(_0x30f0fe){if(_0x30f0fe){return[_0x30f0fe,![]];}return db[_0x7f2c('0x4e')][_0x7f2c('0x47')](_0x48a1b8)[_0x7f2c('0xf')](function(_0x5f3cfc){return[_0x5f3cfc,!![]];});});}else{throw new Error(_0x7f2c('0x50'));}})[_0x7f2c('0x51')](function(_0x1cf88e,_0x3a9604){if(_0x1cf88e){_0x580836=_0x3a9604;if(!_0x3a9604){return _0x1cf88e['update']({'inReplyTo':_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x15')]['messageId'],'to':_0x4cdc44[_0x7f2c('0x27')]['message'][_0x7f2c('0x2e')],'cc':_0x4cdc44['body'][_0x7f2c('0x15')]['cc'],'subject':_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x15')][_0x7f2c('0x4a')],'attach':_0x1cf88e[_0x7f2c('0x4b')]?_0x1cf88e['attach']:_0x4cdc44['body'][_0x7f2c('0x15')][_0x7f2c('0x4b')],'substatus':null,'substatusAt':moment()[_0x7f2c('0x4c')](_0x7f2c('0x4d')),'lastMsgAt':moment()[_0x7f2c('0x4c')](_0x7f2c('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x4cdc44['body'][_0x7f2c('0x27')]});}else{return _0x1cf88e;}}})[_0x7f2c('0xf')](function(_0x4e3733){_0x562a0c[_0x7f2c('0x52')]=_0x4e3733['get']({'plain':!![]});_0x562a0c['interaction'][_0x7f2c('0x53')]=_0x580836;return db[_0x7f2c('0x54')][_0x7f2c('0x47')]({'body':_0x4cdc44[_0x7f2c('0x27')]['body'],'MailAccountId':_0x4cdc44[_0x7f2c('0x34')]['id'],'MailInteractionId':_0x4e3733['id'],'direction':'in','ContactId':_0x562a0c[_0x7f2c('0x55')]['id'],'messageId':_0x4cdc44[_0x7f2c('0x27')]['message']['messageId'],'from':_0x4cdc44['body'][_0x7f2c('0x15')][_0x7f2c('0x2e')],'to':_0x4cdc44['body']['message']['to'],'cc':_0x4cdc44[_0x7f2c('0x27')]['message']['cc'],'subject':_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x15')]['subject'],'attach':_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x15')]['attach'],'Attachments':_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x15')]['attachments'],'originTo':_0x4cdc44['body']['message'][_0x7f2c('0x56')],'originCc':_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x15')][_0x7f2c('0x57')],'bcc':_0x4cdc44[_0x7f2c('0x27')][_0x7f2c('0x15')]['bcc']},{'include':[{'model':db[_0x7f2c('0x58')],'as':'Attachments'}]});})[_0x7f2c('0xf')](function(_0x41b4e2){_0x562a0c[_0x7f2c('0x15')]=_0x41b4e2;if(_0x562a0c[_0x7f2c('0x52')][_0x7f2c('0x59')]){return db[_0x7f2c('0x5a')][_0x7f2c('0x24')]({'attributes':['id',_0x7f2c('0x5b')],'where':{'id':_0x562a0c[_0x7f2c('0x52')][_0x7f2c('0x59')]}})['then'](function(_0x3ef9ef){if(_0x3ef9ef){_0x562a0c[_0x7f2c('0x3c')][_0x7f2c('0x5c')]({'id':0x0,'priority':0x0,'app':_0x7f2c('0x5d'),'appdata':_0x3ef9ef[_0x7f2c('0x5b')]+','+(_0x562a0c[_0x7f2c('0x34')][_0x7f2c('0x5e')]||0xa),'interval':_0x7f2c('0x5f')});}return respondWithRpcPromise('Start','startRouting',_0x562a0c);});}return respondWithRpcPromise(_0x7f2c('0x60'),_0x7f2c('0x61'),_0x562a0c);})[_0x7f2c('0xf')](function(_0x23e70){_0x292e45(_0x23e70);})[_0x7f2c('0x23')](function(_0x2b1a6e){_0xf7e6a9(_0x5eb47d['error'](0x1f4,_0x2b1a6e['message']));});});}; \ No newline at end of file +var _0x0b40=['result','catch','GetMailAccount','options','raw','limit','include','map','model','attributes','stringify','MailAccount','find','where','ShowMailAccount','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','get','omit','applications','list','priority','asc','autoclose','length','close','*,*,*,*','defaults','create','List\x20not\x20found','contact','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','subject','interaction','created','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','User','name','unshift','agent','Start','startRouting','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xa3ed10,_0xfcb86){var _0x4205c7=function(_0x4e0f73){while(--_0x4e0f73){_0xa3ed10['push'](_0xa3ed10['shift']());}};_0x4205c7(++_0xfcb86);}(_0x0b40,0xba));var _0x00b4=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x0b40[_0x425716];return _0x2d39af;};'use strict';var _=require('lodash');var util=require(_0x00b4('0x0'));var moment=require(_0x00b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x00b4('0x2'));var fs=require('fs');var Redis=require(_0x00b4('0x3'));var db=require(_0x00b4('0x4'))['db'];var utils=require(_0x00b4('0x5'));var logger=require(_0x00b4('0x6'))(_0x00b4('0x7'));var config=require('../../config/environment');var jayson=require(_0x00b4('0x8'));var client=jayson[_0x00b4('0x9')][_0x00b4('0xa')]({'port':0x232c});config[_0x00b4('0xb')]=_['defaults'](config[_0x00b4('0xb')],{'host':_0x00b4('0xc'),'port':0x18eb});var socket=require(_0x00b4('0xd'))(new Redis(config['redis']));require(_0x00b4('0xe'))[_0x00b4('0xf')](socket);function respondWithRpcPromise(_0x4eec0b,_0x55430e,_0x470e42){return new BPromise(function(_0x77fb86,_0x216426){return client[_0x00b4('0x10')](_0x4eec0b,_0x470e42)[_0x00b4('0x11')](function(_0x1c3892){logger[_0x00b4('0x12')](_0x00b4('0x13'),_0x55430e,_0x00b4('0x14'));logger[_0x00b4('0x15')](_0x00b4('0x16'),_0x55430e,_0x00b4('0x14'),JSON['stringify'](_0x1c3892));if(_0x1c3892['error']){if(_0x1c3892[_0x00b4('0x17')][_0x00b4('0x18')]===0x1f4){logger[_0x00b4('0x17')](_0x00b4('0x13'),_0x55430e,_0x1c3892['error'][_0x00b4('0x19')]);return _0x216426(_0x1c3892[_0x00b4('0x17')][_0x00b4('0x19')]);}logger[_0x00b4('0x17')](_0x00b4('0x13'),_0x55430e,_0x1c3892[_0x00b4('0x17')][_0x00b4('0x19')]);return _0x77fb86(_0x1c3892['error'][_0x00b4('0x19')]);}else{logger[_0x00b4('0x12')](_0x00b4('0x13'),_0x55430e,_0x00b4('0x14'));_0x77fb86(_0x1c3892[_0x00b4('0x1a')]['message']);}})[_0x00b4('0x1b')](function(_0x317bac){logger[_0x00b4('0x17')]('MailAccount,\x20%s,\x20%s',_0x55430e,_0x317bac);_0x216426(_0x317bac);});});}exports[_0x00b4('0x1c')]=function(_0x277e32){var _0xc50e86=this;return new Promise(function(_0x28b93e,_0xa7462a){return db['MailAccount']['findAll']({'raw':_0x277e32[_0x00b4('0x1d')]?_0x277e32[_0x00b4('0x1d')][_0x00b4('0x1e')]===undefined?!![]:![]:!![],'where':_0x277e32[_0x00b4('0x1d')]?_0x277e32[_0x00b4('0x1d')]['where']||null:null,'attributes':_0x277e32[_0x00b4('0x1d')]?_0x277e32[_0x00b4('0x1d')]['attributes']||null:null,'limit':_0x277e32[_0x00b4('0x1d')]?_0x277e32[_0x00b4('0x1d')][_0x00b4('0x1f')]||null:null,'include':_0x277e32['options']?_0x277e32[_0x00b4('0x1d')][_0x00b4('0x20')]?_[_0x00b4('0x21')](_0x277e32['options']['include'],function(_0xc695ca){return{'model':db[_0xc695ca[_0x00b4('0x22')]],'as':_0xc695ca['as'],'attributes':_0xc695ca[_0x00b4('0x23')],'include':_0xc695ca[_0x00b4('0x20')]?_[_0x00b4('0x21')](_0xc695ca[_0x00b4('0x20')],function(_0x591363){return{'model':db[_0x591363[_0x00b4('0x22')]],'as':_0x591363['as'],'attributes':_0x591363[_0x00b4('0x23')],'include':_0x591363[_0x00b4('0x20')]?_[_0x00b4('0x21')](_0x591363[_0x00b4('0x20')],function(_0x21cc39){return{'model':db[_0x21cc39[_0x00b4('0x22')]],'as':_0x21cc39['as'],'attributes':_0x21cc39[_0x00b4('0x23')]};}):[]};}):[]};}):[]:[]})[_0x00b4('0x11')](function(_0x35103e){logger[_0x00b4('0x12')]('GetMailAccount',_0x277e32);logger[_0x00b4('0x15')](_0x00b4('0x1c'),_0x277e32,JSON[_0x00b4('0x24')](_0x35103e));_0x28b93e(_0x35103e);})[_0x00b4('0x1b')](function(_0x24b8fb){logger['error'](_0x00b4('0x1c'),_0x24b8fb['message'],_0x277e32);_0xa7462a(_0xc50e86[_0x00b4('0x17')](0x1f4,_0x24b8fb[_0x00b4('0x19')]));});});};exports['ShowMailAccount']=function(_0x2d62d1){var _0x4d65df=this;return new Promise(function(_0x4d26c0,_0x4a5ad7){return db[_0x00b4('0x25')][_0x00b4('0x26')]({'raw':_0x2d62d1[_0x00b4('0x1d')]?_0x2d62d1[_0x00b4('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x2d62d1['options']?_0x2d62d1[_0x00b4('0x1d')][_0x00b4('0x27')]||null:null,'attributes':_0x2d62d1[_0x00b4('0x1d')]?_0x2d62d1[_0x00b4('0x1d')][_0x00b4('0x23')]||null:null,'include':_0x2d62d1[_0x00b4('0x1d')]?_0x2d62d1['options'][_0x00b4('0x20')]?_[_0x00b4('0x21')](_0x2d62d1['options']['include'],function(_0x36be57){return{'model':db[_0x36be57['model']],'as':_0x36be57['as'],'attributes':_0x36be57['attributes'],'include':_0x36be57[_0x00b4('0x20')]?_[_0x00b4('0x21')](_0x36be57[_0x00b4('0x20')],function(_0x4b77fc){return{'model':db[_0x4b77fc[_0x00b4('0x22')]],'as':_0x4b77fc['as'],'attributes':_0x4b77fc[_0x00b4('0x23')],'include':_0x4b77fc[_0x00b4('0x20')]?_[_0x00b4('0x21')](_0x4b77fc['include'],function(_0x3f35cd){return{'model':db[_0x3f35cd[_0x00b4('0x22')]],'as':_0x3f35cd['as'],'attributes':_0x3f35cd['attributes']};}):[]};}):[]};}):[]:[]})[_0x00b4('0x11')](function(_0x2aed9a){logger['info'](_0x00b4('0x28'),_0x2d62d1);logger['debug'](_0x00b4('0x28'),_0x2d62d1,JSON[_0x00b4('0x24')](_0x2aed9a));_0x4d26c0(_0x2aed9a);})[_0x00b4('0x1b')](function(_0x5287df){logger['error'](_0x00b4('0x28'),_0x5287df['message'],_0x2d62d1);_0x4a5ad7(_0x4d65df[_0x00b4('0x17')](0x1f4,_0x5287df[_0x00b4('0x19')]));});});};exports[_0x00b4('0x29')]=function(_0x329718){var _0x4b1f9f=this;return new Promise(function(_0x3a8ac1,_0xf2af5f){var _0x3db465={'body':_0x329718[_0x00b4('0x2a')],'channel':_0x00b4('0x2b')};var _0x4bbd37=_['difference'](_[_0x00b4('0x2c')](db[_0x00b4('0x2d')][_0x00b4('0x2e')]),[_0x00b4('0x2f'),_0x00b4('0x30'),_0x00b4('0x31'),_0x00b4('0x32')]);var _0x120739=![];if(_0x329718['body']['id']){delete _0x329718[_0x00b4('0x2a')]['id'];}if(_[_0x00b4('0x33')](_0x329718[_0x00b4('0x2a')]['from'])){return _0xf2af5f(_0x4b1f9f[_0x00b4('0x17')](0x1f4,_0x00b4('0x34')));}if(_[_0x00b4('0x33')](_0x329718[_0x00b4('0x2a')][_0x00b4('0x2a')])||_0x329718['body'][_0x00b4('0x2a')]===''){return _0xf2af5f(_0x4b1f9f[_0x00b4('0x17')](0x1f4,_0x00b4('0x35')));}if(_[_0x00b4('0x33')](_0x329718[_0x00b4('0x2a')][_0x00b4('0x36')])){return _0xf2af5f(_0x4b1f9f[_0x00b4('0x17')](0x1f4,_0x00b4('0x37')+_0x4bbd37));}if(!_[_0x00b4('0x38')](_0x4bbd37,_0x329718[_0x00b4('0x2a')][_0x00b4('0x36')])){return _0xf2af5f(_0x4b1f9f[_0x00b4('0x17')](0x1f4,_0x00b4('0x39')+_0x4bbd37));}var _0xcc7033={};_0xcc7033[_0x329718[_0x00b4('0x2a')][_0x00b4('0x36')]]=_0x329718[_0x00b4('0x2a')][_0x00b4('0x3a')];return db[_0x00b4('0x25')]['find']({'where':{'id':_0x329718[_0x00b4('0x3b')]['id']},'include':[{'model':db['CmList'],'as':_0x00b4('0x3c'),'include':[{'model':db[_0x00b4('0x2d')],'as':_0x00b4('0x3d'),'where':_0xcc7033,'limit':0x1,'order':[[_0x00b4('0x30'),_0x00b4('0x3e')]]}]},{'model':db[_0x00b4('0x3f')],'as':_0x00b4('0x40')},{'model':db[_0x00b4('0x41')],'as':_0x00b4('0x42')}]})[_0x00b4('0x11')](function(_0xdbc365){if(_0xdbc365&&_0xdbc365['List']){var _0x4994e0=_0xdbc365[_0x00b4('0x43')]({'plain':!![]});_0x3db465['account']=_[_0x00b4('0x44')](_0x4994e0,[_0x00b4('0x40'),'List']);_0x3db465[_0x00b4('0x45')]=_0x4994e0[_0x00b4('0x40')];_0x3db465[_0x00b4('0x46')]=_0x4994e0[_0x00b4('0x3c')];_0x3db465[_0x00b4('0x45')]=_['orderBy'](_0x3db465[_0x00b4('0x45')],[_0x00b4('0x47')],[_0x00b4('0x48')]);if(_0x3db465[_0x00b4('0x3b')]&&_0x3db465[_0x00b4('0x3b')][_0x00b4('0x49')]){_0x3db465[_0x00b4('0x45')]['push']({'id':0x0,'priority':_0x3db465[_0x00b4('0x45')][_0x00b4('0x4a')]+0x1,'app':_0x00b4('0x4b'),'appdata':_0x00b4('0x49'),'interval':_0x00b4('0x4c')});}if(_0x3db465[_0x00b4('0x3b')][_0x00b4('0x40')]){delete _0x3db465['account'][_0x00b4('0x40')];}if(_0x3db465[_0x00b4('0x3b')][_0x00b4('0x3c')]){delete _0x3db465[_0x00b4('0x3b')][_0x00b4('0x3c')];}if(_0x4994e0[_0x00b4('0x3c')][_0x00b4('0x3d')][_0x00b4('0x4a')]){return _0x4994e0[_0x00b4('0x3c')][_0x00b4('0x3d')][0x0];}var _0x1922d=_[_0x00b4('0x4d')](_0x329718[_0x00b4('0x2a')],{'firstName':_0x329718[_0x00b4('0x2a')][_0x00b4('0x3a')],'ListId':_0x4994e0['ListId']});_0x1922d[_0x329718[_0x00b4('0x2a')][_0x00b4('0x36')]]=_0x329718[_0x00b4('0x2a')]['from'];return db[_0x00b4('0x2d')][_0x00b4('0x4e')](_0x1922d);}else{throw new Error(_0x00b4('0x4f'));}})['then'](function(_0x469caa){_0x3db465[_0x00b4('0x50')]=_0x469caa;if(_0x469caa){if(!_0x329718['body'][_0x00b4('0x19')][_0x00b4('0x51')]){_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')]['messageId']=rs['generate']()+'\x20'+_0x329718[_0x00b4('0x2a')]['message'][_0x00b4('0x3a')];}var _0x3439ed={'ContactId':_0x469caa['id'],'MailAccountId':_0x329718[_0x00b4('0x3b')]['id'],'inReplyTo':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x51')],'to':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x3a')],'cc':_0x329718['body']['message']['cc'],'subject':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')]['subject'],'attach':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x52')],'lastMsgAt':moment()[_0x00b4('0x53')](_0x00b4('0x54')),'lastMsgDirection':'in','lastMsgBody':_0x329718['body'][_0x00b4('0x2a')]};return db[_0x00b4('0x55')]['find']({'where':{'closed':![],'MailAccountId':_0x329718[_0x00b4('0x3b')]['id']},'include':[{'model':db[_0x00b4('0x56')],'as':_0x00b4('0x57'),'attributes':['messageId'],'where':{'messageId':_0x329718['body'][_0x00b4('0x19')][_0x00b4('0x58')]}}]})[_0x00b4('0x11')](function(_0x36ccf8){if(_0x36ccf8){return[_0x36ccf8,![]];}return db[_0x00b4('0x55')][_0x00b4('0x4e')](_0x3439ed)[_0x00b4('0x11')](function(_0x280e66){return[_0x280e66,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x00b4('0x59')](function(_0x257fc8,_0x435050){if(_0x257fc8){_0x120739=_0x435050;if(!_0x435050){return _0x257fc8['update']({'inReplyTo':_0x329718[_0x00b4('0x2a')]['message'][_0x00b4('0x51')],'to':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x3a')],'cc':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')]['cc'],'subject':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x5a')],'attach':_0x257fc8[_0x00b4('0x52')]?_0x257fc8[_0x00b4('0x52')]:_0x329718['body'][_0x00b4('0x19')][_0x00b4('0x52')],'substatus':null,'substatusAt':moment()[_0x00b4('0x53')](_0x00b4('0x54')),'lastMsgAt':moment()['format'](_0x00b4('0x54')),'lastMsgDirection':'in','lastMsgBody':_0x329718[_0x00b4('0x2a')][_0x00b4('0x2a')]});}else{return _0x257fc8;}}})[_0x00b4('0x11')](function(_0x5496b9){_0x3db465[_0x00b4('0x5b')]=_0x5496b9[_0x00b4('0x43')]({'plain':!![]});_0x3db465[_0x00b4('0x5b')][_0x00b4('0x5c')]=_0x120739;return db[_0x00b4('0x56')][_0x00b4('0x4e')]({'body':_0x329718[_0x00b4('0x2a')][_0x00b4('0x2a')],'MailAccountId':_0x329718[_0x00b4('0x3b')]['id'],'MailInteractionId':_0x5496b9['id'],'direction':'in','ContactId':_0x3db465[_0x00b4('0x50')]['id'],'messageId':_0x329718[_0x00b4('0x2a')]['message']['messageId'],'from':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x3a')],'to':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')]['to'],'cc':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')]['cc'],'subject':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x5a')],'attach':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')]['attach'],'Attachments':_0x329718['body'][_0x00b4('0x19')][_0x00b4('0x5d')],'originTo':_0x329718[_0x00b4('0x2a')]['message'][_0x00b4('0x5e')],'originCc':_0x329718[_0x00b4('0x2a')][_0x00b4('0x19')][_0x00b4('0x5f')],'bcc':_0x329718['body'][_0x00b4('0x19')][_0x00b4('0x60')]},{'include':[{'model':db[_0x00b4('0x61')],'as':_0x00b4('0x62')}]});})['then'](function(_0x1c3b21){_0x3db465['message']=_0x1c3b21;if(_0x3db465[_0x00b4('0x5b')][_0x00b4('0x63')]){return db[_0x00b4('0x64')][_0x00b4('0x26')]({'attributes':['id',_0x00b4('0x65')],'where':{'id':_0x3db465[_0x00b4('0x5b')][_0x00b4('0x63')]}})[_0x00b4('0x11')](function(_0x43bd38){if(_0x43bd38){_0x3db465['applications'][_0x00b4('0x66')]({'id':0x0,'priority':0x0,'app':_0x00b4('0x67'),'appdata':_0x43bd38[_0x00b4('0x65')]+','+(_0x3db465['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x00b4('0x68'),_0x00b4('0x69'),_0x3db465);});}return respondWithRpcPromise(_0x00b4('0x68'),_0x00b4('0x69'),_0x3db465);})['then'](function(_0x5f003f){_0x3a8ac1(_0x5f003f);})['catch'](function(_0x475e3d){_0xf2af5f(_0x4b1f9f[_0x00b4('0x17')](0x1f4,_0x475e3d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 5fd7a4f..fc01a55 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 _0xfd6e=['./mailAccount.events','remove','length'];(function(_0x2718b1,_0x4e9a78){var _0x59bfb1=function(_0x10fdae){while(--_0x10fdae){_0x2718b1['push'](_0x2718b1['shift']());}};_0x59bfb1(++_0x4e9a78);}(_0xfd6e,0x16e));var _0xefd6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd6e[_0x2641f9];return _0x585741;};'use strict';var MailAccountEvents=require(_0xefd6('0x0'));var events=['save',_0xefd6('0x1'),'update'];function createListener(_0x229dfe,_0x41b7d0){return function(_0x54e608){_0x41b7d0['emit'](_0x229dfe,_0x54e608);};}function removeListener(_0x5f4c49,_0x27d881){return function(){MailAccountEvents['removeListener'](_0x5f4c49,_0x27d881);};}exports['register']=function(_0x24af45){for(var _0x23f8c3=0x0,_0x26e108=events[_0xefd6('0x2')];_0x23f8c3<_0x26e108;_0x23f8c3++){var _0x340765=events[_0x23f8c3];var _0x5da399=createListener('mailAccount:'+_0x340765,_0x24af45);MailAccountEvents['on'](_0x340765,_0x5da399);}}; \ No newline at end of file +var _0xdcf6=['update','emit','removeListener','save','remove'];(function(_0x390fac,_0x3f2e0b){var _0x4ef0d9=function(_0x7dd36b){while(--_0x7dd36b){_0x390fac['push'](_0x390fac['shift']());}};_0x4ef0d9(++_0x3f2e0b);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x2df84d,_0x56d874){_0x2df84d=_0x2df84d-0x0;var _0x2634ce=_0xdcf6[_0x2df84d];return _0x2634ce;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x6dcf('0x0'),_0x6dcf('0x1'),_0x6dcf('0x2')];function createListener(_0x4402e7,_0x34db3b){return function(_0x17056c){_0x34db3b[_0x6dcf('0x3')](_0x4402e7,_0x17056c);};}function removeListener(_0x513bcb,_0x69f442){return function(){MailAccountEvents[_0x6dcf('0x4')](_0x513bcb,_0x69f442);};}exports['register']=function(_0x1ff8b6){for(var _0x3364bd=0x0,_0x5abd79=events['length'];_0x3364bd<_0x5abd79;_0x3364bd++){var _0x5766db=events[_0x3364bd];var _0x34517a=createListener('mailAccount:'+_0x5766db,_0x1ff8b6);MailAccountEvents['on'](_0x5766db,_0x34517a);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index f922d7e..8b10e7b 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 _0x1d2d=['multer','util','path','connect-timeout','express','../../components/auth/service','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x519557,_0x1128a0){_0x519557=_0x519557-0x0;var _0x580b9e=_0x1d2d[_0x519557];return _0x580b9e;};'use strict';var multer=require(_0xd1d2('0x0'));var util=require(_0xd1d2('0x1'));var path=require(_0xd1d2('0x2'));var timeout=require(_0xd1d2('0x3'));var express=require(_0xd1d2('0x4'));var router=express['Router']();var auth=require(_0xd1d2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd1d2('0x6'));router[_0xd1d2('0x7')](_0xd1d2('0x8'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xa')]);router[_0xd1d2('0xb')]('/:id',auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xc')]);router[_0xd1d2('0xd')](_0xd1d2('0x8'),auth[_0xd1d2('0x9')](),controller[_0xd1d2('0xe')]);module[_0xd1d2('0xf')]=router; \ No newline at end of file +var _0xeffd=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer'];(function(_0x440604,_0x1f87c1){var _0x472ee1=function(_0x3fc59c){while(--_0x3fc59c){_0x440604['push'](_0x440604['shift']());}};_0x472ee1(++_0x1f87c1);}(_0xeffd,0x6b));var _0xdeff=function(_0x2ae4dd,_0x26f711){_0x2ae4dd=_0x2ae4dd-0x0;var _0x36b729=_0xeffd[_0x2ae4dd];return _0x36b729;};'use strict';var multer=require(_0xdeff('0x0'));var util=require('util');var path=require(_0xdeff('0x1'));var timeout=require(_0xdeff('0x2'));var express=require(_0xdeff('0x3'));var router=express[_0xdeff('0x4')]();var auth=require(_0xdeff('0x5'));var interaction=require(_0xdeff('0x6'));var config=require(_0xdeff('0x7'));var controller=require(_0xdeff('0x8'));router[_0xdeff('0x9')](_0xdeff('0xa'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xc')]);router[_0xdeff('0xd')](_0xdeff('0xa'),auth[_0xdeff('0xb')](),controller[_0xdeff('0xe')]);router[_0xdeff('0xf')]('/:id',auth[_0xdeff('0xb')](),controller[_0xdeff('0x10')]);module[_0xdeff('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index ad1a9f5..e793dff 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 _0x5121=['STRING','noop','TEXT','sequelize','exports'];(function(_0x42b551,_0x469d15){var _0x5797d0=function(_0x388913){while(--_0x388913){_0x42b551['push'](_0x42b551['shift']());}};_0x5797d0(++_0x469d15);}(_0x5121,0xa3));var _0x1512=function(_0x2df1f2,_0x58d388){_0x2df1f2=_0x2df1f2-0x0;var _0x38652b=_0x5121[_0x2df1f2];return _0x38652b;};'use strict';var Sequelize=require(_0x1512('0x0'));module[_0x1512('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1512('0x2')],'allowNull':![],'defaultValue':_0x1512('0x3')},'appdata':{'type':Sequelize[_0x1512('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1512('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x70a5=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0x4011b4,_0x5dee64){var _0x502430=function(_0x32bae6){while(--_0x32bae6){_0x4011b4['push'](_0x4011b4['shift']());}};_0x502430(++_0x5dee64);}(_0x70a5,0x7b));var _0x570a=function(_0x54f8b0,_0x2ed2d2){_0x54f8b0=_0x54f8b0-0x0;var _0x2e1d5c=_0x70a5[_0x54f8b0];return _0x2e1d5c;};'use strict';var Sequelize=require('sequelize');module[_0x570a('0x0')]={'priority':{'type':Sequelize[_0x570a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x570a('0x2')],'allowNull':![],'defaultValue':_0x570a('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x570a('0x2')]},'interval':{'type':Sequelize[_0x570a('0x2')],'defaultValue':_0x570a('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index c869213..33f6c5a 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 _0x150a=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','apply','reject','update','destroy','then','end','stack','name','show','params','model','keys','MailApplication','query','intersection','fields','attributes','includeAll','include','merge','options','catch','body','find','html-pdf','eml-format'];(function(_0x137963,_0x29f175){var _0x171aa9=function(_0x636f14){while(--_0x636f14){_0x137963['push'](_0x137963['shift']());}};_0x171aa9(++_0x29f175);}(_0x150a,0x148));var _0xa150=function(_0x3f8e20,_0x1daf92){_0x3f8e20=_0x3f8e20-0x0;var _0x54b65e=_0x150a[_0x3f8e20];return _0x54b65e;};'use strict';var pdf=require(_0xa150('0x0'));var emlformat=require(_0xa150('0x1'));var rimraf=require(_0xa150('0x2'));var zipdir=require(_0xa150('0x3'));var jsonpatch=require(_0xa150('0x4'));var rp=require(_0xa150('0x5'));var moment=require(_0xa150('0x6'));var BPromise=require(_0xa150('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa150('0x8'));var sox=require(_0xa150('0x9'));var csv=require(_0xa150('0xa'));var ejs=require(_0xa150('0xb'));var fs=require('fs');var _=require(_0xa150('0xc'));var squel=require(_0xa150('0xd'));var crypto=require(_0xa150('0xe'));var jsforce=require(_0xa150('0xf'));var deskjs=require(_0xa150('0x10'));var toCsv=require(_0xa150('0xa'));var querystring=require(_0xa150('0x11'));var Papa=require(_0xa150('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa150('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa150('0x14'));var logger=require(_0xa150('0x15'))(_0xa150('0x16'));var utils=require(_0xa150('0x17'));var config=require('../../config/environment');var db=require(_0xa150('0x18'))['db'];function respondWithStatusCode(_0x476e4f,_0x26d40e){_0x26d40e=_0x26d40e||0xcc;return function(_0x35bfd8){if(_0x35bfd8){return _0x476e4f[_0xa150('0x19')](_0x26d40e);}return _0x476e4f[_0xa150('0x1a')](_0x26d40e)['end']();};}function respondWithResult(_0x300029,_0x10e233){_0x10e233=_0x10e233||0xc8;return function(_0x1f529e){if(_0x1f529e){return _0x300029[_0xa150('0x1a')](_0x10e233)['json'](_0x1f529e);}};}function respondWithFilteredResult(_0x39b363,_0x46e60f){return function(_0x3e7311){if(_0x3e7311){var _0x636278=_0x3e7311[_0xa150('0x1b')],_0x2b96ef=_0x46e60f['offset'],_0x43b89a=_0x46e60f[_0xa150('0x1c')]+_0x46e60f[_0xa150('0x1d')],_0x5b18e0;if(_0x43b89a>=_0x636278){_0x43b89a=_0x636278;_0x5b18e0=0xc8;}else{_0x5b18e0=0xce;}_0x39b363[_0xa150('0x1a')](_0x5b18e0);return _0x39b363[_0xa150('0x1e')]('Content-Range',_0x2b96ef+'-'+_0x43b89a+'/'+_0x636278)['json'](_0x3e7311);}return null;};}function patchUpdates(_0x285662){return function(_0x398845){try{jsonpatch[_0xa150('0x1f')](_0x398845,_0x285662,!![]);}catch(_0x468449){return BPromise[_0xa150('0x20')](_0x468449);}return _0x398845['save']();};}function saveUpdates(_0x51dc06,_0x2a1f06){return function(_0x27d749){if(_0x27d749){return _0x27d749[_0xa150('0x21')](_0x51dc06)['then'](function(_0x25e611){return _0x25e611;});}return null;};}function removeEntity(_0x4efcc8,_0x8e9598){return function(_0x59b8d4){if(_0x59b8d4){return _0x59b8d4[_0xa150('0x22')]()[_0xa150('0x23')](function(){_0x4efcc8[_0xa150('0x1a')](0xcc)[_0xa150('0x24')]();});}};}function handleEntityNotFound(_0x3b98b4,_0xd73377){return function(_0x421d26){if(!_0x421d26){_0x3b98b4[_0xa150('0x19')](0x194);}return _0x421d26;};}function handleError(_0x5d85a2,_0x31aa27){_0x31aa27=_0x31aa27||0x1f4;return function(_0x3beaa7){logger['error'](_0x3beaa7[_0xa150('0x25')]);if(_0x3beaa7[_0xa150('0x26')]){delete _0x3beaa7[_0xa150('0x26')];}_0x5d85a2[_0xa150('0x1a')](_0x31aa27)['send'](_0x3beaa7);};}exports[_0xa150('0x27')]=function(_0x2c9892,_0x2ef714){var _0x2f8160={'raw':!![],'where':{'id':_0x2c9892[_0xa150('0x28')]['id']}},_0xc96662={};_0xc96662[_0xa150('0x29')]=_[_0xa150('0x2a')](db[_0xa150('0x2b')]['rawAttributes']);_0xc96662[_0xa150('0x2c')]=_[_0xa150('0x2a')](_0x2c9892[_0xa150('0x2c')]);_0xc96662['filters']=_[_0xa150('0x2d')](_0xc96662[_0xa150('0x29')],_0xc96662[_0xa150('0x2c')]);_0x2f8160['attributes']=_[_0xa150('0x2d')](_0xc96662[_0xa150('0x29')],qs[_0xa150('0x2e')](_0x2c9892[_0xa150('0x2c')][_0xa150('0x2e')]));_0x2f8160[_0xa150('0x2f')]=_0x2f8160['attributes']['length']?_0x2f8160[_0xa150('0x2f')]:_0xc96662[_0xa150('0x29')];if(_0x2c9892[_0xa150('0x2c')][_0xa150('0x30')]){_0x2f8160[_0xa150('0x31')]=[{'all':!![]}];}_0x2f8160=_[_0xa150('0x32')]({},_0x2f8160,_0x2c9892[_0xa150('0x33')]);return db[_0xa150('0x2b')]['find'](_0x2f8160)['then'](handleEntityNotFound(_0x2ef714,null))['then'](respondWithResult(_0x2ef714,null))[_0xa150('0x34')](handleError(_0x2ef714,null));};exports[_0xa150('0x21')]=function(_0x120e22,_0x3b481b){if(_0x120e22[_0xa150('0x35')]['id']){delete _0x120e22[_0xa150('0x35')]['id'];}return db[_0xa150('0x2b')][_0xa150('0x36')]({'where':{'id':_0x120e22[_0xa150('0x28')]['id']}})[_0xa150('0x23')](handleEntityNotFound(_0x3b481b,null))[_0xa150('0x23')](saveUpdates(_0x120e22[_0xa150('0x35')],null))[_0xa150('0x23')](respondWithResult(_0x3b481b,null))[_0xa150('0x34')](handleError(_0x3b481b,null));};exports[_0xa150('0x22')]=function(_0x524fe9,_0x51e4fd){return db['MailApplication'][_0xa150('0x36')]({'where':{'id':_0x524fe9['params']['id']}})['then'](handleEntityNotFound(_0x51e4fd,null))[_0xa150('0x23')](removeEntity(_0x51e4fd,null))['catch'](handleError(_0x51e4fd,null));}; \ No newline at end of file +var _0x374c=['apply','save','then','destroy','end','error','stack','name','params','keys','MailApplication','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x374c,0x1e3));var _0xc374=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x374c[_0x3ea913];return _0x2b4f28;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc374('0x0'));var rimraf=require(_0xc374('0x1'));var zipdir=require(_0xc374('0x2'));var jsonpatch=require(_0xc374('0x3'));var rp=require(_0xc374('0x4'));var moment=require('moment');var BPromise=require(_0xc374('0x5'));var Mustache=require('mustache');var util=require(_0xc374('0x6'));var path=require(_0xc374('0x7'));var sox=require('sox');var csv=require(_0xc374('0x8'));var ejs=require(_0xc374('0x9'));var fs=require('fs');var _=require(_0xc374('0xa'));var squel=require(_0xc374('0xb'));var crypto=require(_0xc374('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc374('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc374('0xe'));var Redis=require(_0xc374('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc374('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc374('0x11'));var logger=require(_0xc374('0x12'))(_0xc374('0x13'));var utils=require('../../config/utils');var config=require(_0xc374('0x14'));var db=require(_0xc374('0x15'))['db'];function respondWithStatusCode(_0xa4ab31,_0x5e0f82){_0x5e0f82=_0x5e0f82||0xcc;return function(_0x44eba3){if(_0x44eba3){return _0xa4ab31[_0xc374('0x16')](_0x5e0f82);}return _0xa4ab31[_0xc374('0x17')](_0x5e0f82)['end']();};}function respondWithResult(_0x166a78,_0x47a7bf){_0x47a7bf=_0x47a7bf||0xc8;return function(_0xae92ab){if(_0xae92ab){return _0x166a78[_0xc374('0x17')](_0x47a7bf)['json'](_0xae92ab);}};}function respondWithFilteredResult(_0x1e44f9,_0x3f868a){return function(_0x4109ec){if(_0x4109ec){var _0x198919=_0x4109ec[_0xc374('0x18')],_0x1178a1=_0x3f868a[_0xc374('0x19')],_0x115e8a=_0x3f868a[_0xc374('0x19')]+_0x3f868a[_0xc374('0x1a')],_0x132aff;if(_0x115e8a>=_0x198919){_0x115e8a=_0x198919;_0x132aff=0xc8;}else{_0x132aff=0xce;}_0x1e44f9['status'](_0x132aff);return _0x1e44f9[_0xc374('0x1b')](_0xc374('0x1c'),_0x1178a1+'-'+_0x115e8a+'/'+_0x198919)[_0xc374('0x1d')](_0x4109ec);}return null;};}function patchUpdates(_0x50e525){return function(_0x22d3be){try{jsonpatch[_0xc374('0x1e')](_0x22d3be,_0x50e525,!![]);}catch(_0x54b516){return BPromise['reject'](_0x54b516);}return _0x22d3be[_0xc374('0x1f')]();};}function saveUpdates(_0x3bf099,_0x4110bf){return function(_0x2beb98){if(_0x2beb98){return _0x2beb98['update'](_0x3bf099)[_0xc374('0x20')](function(_0x3d60d4){return _0x3d60d4;});}return null;};}function removeEntity(_0x21f741,_0x16959d){return function(_0x3cbbad){if(_0x3cbbad){return _0x3cbbad[_0xc374('0x21')]()[_0xc374('0x20')](function(){_0x21f741[_0xc374('0x17')](0xcc)[_0xc374('0x22')]();});}};}function handleEntityNotFound(_0x18699e,_0x4110a5){return function(_0x5b92c6){if(!_0x5b92c6){_0x18699e[_0xc374('0x16')](0x194);}return _0x5b92c6;};}function handleError(_0x6931d1,_0x2b31ad){_0x2b31ad=_0x2b31ad||0x1f4;return function(_0x5dd1e9){logger[_0xc374('0x23')](_0x5dd1e9[_0xc374('0x24')]);if(_0x5dd1e9[_0xc374('0x25')]){delete _0x5dd1e9[_0xc374('0x25')];}_0x6931d1['status'](_0x2b31ad)['send'](_0x5dd1e9);};}exports['show']=function(_0x17d02e,_0x2e7fad){var _0x187007={'raw':!![],'where':{'id':_0x17d02e[_0xc374('0x26')]['id']}},_0x5530a3={};_0x5530a3['model']=_[_0xc374('0x27')](db[_0xc374('0x28')][_0xc374('0x29')]);_0x5530a3[_0xc374('0x2a')]=_[_0xc374('0x27')](_0x17d02e[_0xc374('0x2a')]);_0x5530a3[_0xc374('0x2b')]=_[_0xc374('0x2c')](_0x5530a3['model'],_0x5530a3[_0xc374('0x2a')]);_0x187007['attributes']=_[_0xc374('0x2c')](_0x5530a3[_0xc374('0x2d')],qs[_0xc374('0x2e')](_0x17d02e[_0xc374('0x2a')]['fields']));_0x187007[_0xc374('0x2f')]=_0x187007['attributes'][_0xc374('0x30')]?_0x187007[_0xc374('0x2f')]:_0x5530a3[_0xc374('0x2d')];if(_0x17d02e[_0xc374('0x2a')][_0xc374('0x31')]){_0x187007[_0xc374('0x32')]=[{'all':!![]}];}_0x187007=_[_0xc374('0x33')]({},_0x187007,_0x17d02e[_0xc374('0x34')]);return db[_0xc374('0x28')][_0xc374('0x35')](_0x187007)[_0xc374('0x20')](handleEntityNotFound(_0x2e7fad,null))[_0xc374('0x20')](respondWithResult(_0x2e7fad,null))['catch'](handleError(_0x2e7fad,null));};exports[_0xc374('0x36')]=function(_0x5ab560,_0x2cd7fd){if(_0x5ab560[_0xc374('0x37')]['id']){delete _0x5ab560[_0xc374('0x37')]['id'];}return db['MailApplication'][_0xc374('0x35')]({'where':{'id':_0x5ab560[_0xc374('0x26')]['id']}})['then'](handleEntityNotFound(_0x2cd7fd,null))[_0xc374('0x20')](saveUpdates(_0x5ab560[_0xc374('0x37')],null))[_0xc374('0x20')](respondWithResult(_0x2cd7fd,null))[_0xc374('0x38')](handleError(_0x2cd7fd,null));};exports[_0xc374('0x21')]=function(_0x41dfac,_0x756eb7){return db['MailApplication']['find']({'where':{'id':_0x41dfac['params']['id']}})[_0xc374('0x20')](handleEntityNotFound(_0x756eb7,null))[_0xc374('0x20')](removeEntity(_0x756eb7,null))[_0xc374('0x38')](handleError(_0x756eb7,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index bc3305c..f33069f 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 _0xb44a=['moment','path','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','../../config/logger'];(function(_0x1f3f4f,_0x2eb964){var _0x1f85ec=function(_0x13189e){while(--_0x13189e){_0x1f3f4f['push'](_0x1f3f4f['shift']());}};_0x1f85ec(++_0x2eb964);}(_0xb44a,0x1c2));var _0xab44=function(_0x96ad7d,_0x1017ba){_0x96ad7d=_0x96ad7d-0x0;var _0x32d63a=_0xb44a[_0x96ad7d];return _0x32d63a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab44('0x0'))('api');var moment=require(_0xab44('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab44('0x2'));var rimraf=require('rimraf');var config=require(_0xab44('0x3'));var attributes=require(_0xab44('0x4'));module[_0xab44('0x5')]=function(_0x28681a,_0x2f3948){return _0x28681a[_0xab44('0x6')](_0xab44('0x7'),attributes,{'tableName':_0xab44('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xab44('0x9'),'collate':_0xab44('0xa')});}; \ No newline at end of file +var _0xdec3=['rimraf','../../config/environment','exports','define','MailApplication','mail_applications','utf8mb4','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x5df3bc,_0x5bc6d3){var _0x24e4e1=function(_0x47c7a4){while(--_0x47c7a4){_0x5df3bc['push'](_0x5df3bc['shift']());}};_0x24e4e1(++_0x5bc6d3);}(_0xdec3,0x89));var _0x3dec=function(_0x4de3ff,_0x4cb1d0){_0x4de3ff=_0x4de3ff-0x0;var _0x3b08fd=_0xdec3[_0x4de3ff];return _0x3b08fd;};'use strict';var _=require(_0x3dec('0x0'));var util=require('util');var logger=require(_0x3dec('0x1'))(_0x3dec('0x2'));var moment=require(_0x3dec('0x3'));var BPromise=require('bluebird');var rp=require(_0x3dec('0x4'));var fs=require('fs');var path=require(_0x3dec('0x5'));var rimraf=require(_0x3dec('0x6'));var config=require(_0x3dec('0x7'));var attributes=require('./mailApplication.attributes');module[_0x3dec('0x8')]=function(_0x2894eb,_0x347c06){return _0x2894eb[_0x3dec('0x9')](_0x3dec('0xa'),attributes,{'tableName':_0x3dec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3dec('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 503a9ad..f16d8df 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 _0xc145=['stringify','error','code','message','result','UpdateMailApplication','MailApplication','update','body','options','where','attributes','limit','then','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x463415,_0x37f55b){var _0x5580bc=function(_0x4a7b94){while(--_0x4a7b94){_0x463415['push'](_0x463415['shift']());}};_0x5580bc(++_0x37f55b);}(_0xc145,0x1a2));var _0x5c14=function(_0x25db8e,_0x1c74f6){_0x25db8e=_0x25db8e-0x0;var _0x4ce646=_0xc145[_0x25db8e];return _0x4ce646;};'use strict';var _=require('lodash');var util=require(_0x5c14('0x0'));var moment=require(_0x5c14('0x1'));var BPromise=require(_0x5c14('0x2'));var rs=require(_0x5c14('0x3'));var fs=require('fs');var Redis=require(_0x5c14('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c14('0x5'));var logger=require(_0x5c14('0x6'))(_0x5c14('0x7'));var config=require(_0x5c14('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5c14('0x9')][_0x5c14('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27d5d1,_0x418824,_0x5d845f){return new BPromise(function(_0x438c8f,_0x3e3470){return client[_0x5c14('0xb')](_0x27d5d1,_0x5d845f)['then'](function(_0x433d27){logger[_0x5c14('0xc')](_0x5c14('0xd'),_0x418824,_0x5c14('0xe'));logger[_0x5c14('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x418824,'request\x20sent',JSON[_0x5c14('0x10')](_0x433d27));if(_0x433d27[_0x5c14('0x11')]){if(_0x433d27['error'][_0x5c14('0x12')]===0x1f4){logger[_0x5c14('0x11')](_0x5c14('0xd'),_0x418824,_0x433d27['error'][_0x5c14('0x13')]);return _0x3e3470(_0x433d27['error'][_0x5c14('0x13')]);}logger[_0x5c14('0x11')]('MailApplication,\x20%s,\x20%s',_0x418824,_0x433d27[_0x5c14('0x11')][_0x5c14('0x13')]);return _0x438c8f(_0x433d27['error']['message']);}else{logger[_0x5c14('0xc')]('MailApplication,\x20%s,\x20%s',_0x418824,_0x5c14('0xe'));_0x438c8f(_0x433d27[_0x5c14('0x14')]['message']);}})['catch'](function(_0x2de9f9){logger[_0x5c14('0x11')](_0x5c14('0xd'),_0x418824,_0x2de9f9);_0x3e3470(_0x2de9f9);});});}exports[_0x5c14('0x15')]=function(_0x1c1b4e){var _0x400324=this;return new Promise(function(_0x53b014,_0x4ef432){return db[_0x5c14('0x16')][_0x5c14('0x17')](_0x1c1b4e[_0x5c14('0x18')],{'raw':_0x1c1b4e['options']?_0x1c1b4e[_0x5c14('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c1b4e[_0x5c14('0x19')]?_0x1c1b4e[_0x5c14('0x19')][_0x5c14('0x1a')]||null:null,'attributes':_0x1c1b4e['options']?_0x1c1b4e['options'][_0x5c14('0x1b')]||null:null,'limit':_0x1c1b4e[_0x5c14('0x19')]?_0x1c1b4e[_0x5c14('0x19')][_0x5c14('0x1c')]||null:null})[_0x5c14('0x1d')](function(_0x41e914){logger[_0x5c14('0xc')](_0x5c14('0x15'),_0x1c1b4e);logger[_0x5c14('0xf')](_0x5c14('0x15'),_0x1c1b4e,JSON['stringify'](_0x41e914));_0x53b014(_0x41e914);})[_0x5c14('0x1e')](function(_0x48d598){logger[_0x5c14('0x11')](_0x5c14('0x15'),_0x48d598[_0x5c14('0x13')],_0x1c1b4e);_0x4ef432(_0x400324[_0x5c14('0x11')](0x1f4,_0x48d598[_0x5c14('0x13')]));});});}; \ No newline at end of file +var _0x4de8=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','MailApplication,\x20%s,\x20%s','message','result','catch','MailApplication','update','body','options','where','attributes','limit','then','UpdateMailApplication','util','moment'];(function(_0x12ec65,_0x5bd7c9){var _0x28502f=function(_0x3958de){while(--_0x3958de){_0x12ec65['push'](_0x12ec65['shift']());}};_0x28502f(++_0x5bd7c9);}(_0x4de8,0x7a));var _0x84de=function(_0x3c7195,_0x589382){_0x3c7195=_0x3c7195-0x0;var _0x38d8cd=_0x4de8[_0x3c7195];return _0x38d8cd;};'use strict';var _=require('lodash');var util=require(_0x84de('0x0'));var moment=require(_0x84de('0x1'));var BPromise=require('bluebird');var rs=require(_0x84de('0x2'));var fs=require('fs');var Redis=require(_0x84de('0x3'));var db=require(_0x84de('0x4'))['db'];var utils=require(_0x84de('0x5'));var logger=require(_0x84de('0x6'))(_0x84de('0x7'));var config=require(_0x84de('0x8'));var jayson=require(_0x84de('0x9'));var client=jayson[_0x84de('0xa')][_0x84de('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x148db1,_0x1bbf5b,_0x306c34){return new BPromise(function(_0x20686a,_0x121775){return client[_0x84de('0xc')](_0x148db1,_0x306c34)['then'](function(_0x301e34){logger[_0x84de('0xd')]('MailApplication,\x20%s,\x20%s',_0x1bbf5b,_0x84de('0xe'));logger[_0x84de('0xf')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x1bbf5b,_0x84de('0xe'),JSON[_0x84de('0x10')](_0x301e34));if(_0x301e34[_0x84de('0x11')]){if(_0x301e34[_0x84de('0x11')]['code']===0x1f4){logger[_0x84de('0x11')](_0x84de('0x12'),_0x1bbf5b,_0x301e34[_0x84de('0x11')][_0x84de('0x13')]);return _0x121775(_0x301e34[_0x84de('0x11')][_0x84de('0x13')]);}logger['error'](_0x84de('0x12'),_0x1bbf5b,_0x301e34[_0x84de('0x11')]['message']);return _0x20686a(_0x301e34[_0x84de('0x11')][_0x84de('0x13')]);}else{logger[_0x84de('0xd')](_0x84de('0x12'),_0x1bbf5b,'request\x20sent');_0x20686a(_0x301e34[_0x84de('0x14')][_0x84de('0x13')]);}})[_0x84de('0x15')](function(_0x45d25f){logger[_0x84de('0x11')](_0x84de('0x12'),_0x1bbf5b,_0x45d25f);_0x121775(_0x45d25f);});});}exports['UpdateMailApplication']=function(_0x2a5def){var _0x278043=this;return new Promise(function(_0x51cfef,_0x2fcfd4){return db[_0x84de('0x16')][_0x84de('0x17')](_0x2a5def[_0x84de('0x18')],{'raw':_0x2a5def[_0x84de('0x19')]?_0x2a5def[_0x84de('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a5def[_0x84de('0x19')]?_0x2a5def['options'][_0x84de('0x1a')]||null:null,'attributes':_0x2a5def[_0x84de('0x19')]?_0x2a5def[_0x84de('0x19')][_0x84de('0x1b')]||null:null,'limit':_0x2a5def['options']?_0x2a5def[_0x84de('0x19')][_0x84de('0x1c')]||null:null})[_0x84de('0x1d')](function(_0x4d4617){logger[_0x84de('0xd')]('UpdateMailApplication',_0x2a5def);logger[_0x84de('0xf')](_0x84de('0x1e'),_0x2a5def,JSON[_0x84de('0x10')](_0x4d4617));_0x51cfef(_0x4d4617);})[_0x84de('0x15')](function(_0x5a212f){logger['error'](_0x84de('0x1e'),_0x5a212f[_0x84de('0x13')],_0x2a5def);_0x2fcfd4(_0x278043[_0x84de('0x11')](0x1f4,_0x5a212f[_0x84de('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index ac03922..0cea5b7 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 _0xedf2=['tracked','mailinteraction:addtags','addTags','/:id','mail','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','/:id/download','download','create','/:id/tags'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xedf2,0xa2));var _0x2edf=function(_0x32c772,_0x19d5d3){_0x32c772=_0x32c772-0x0;var _0x1f27f0=_0xedf2[_0x32c772];return _0x1f27f0;};'use strict';var multer=require('multer');var util=require(_0x2edf('0x0'));var path=require('path');var timeout=require(_0x2edf('0x1'));var express=require(_0x2edf('0x2'));var router=express[_0x2edf('0x3')]();var auth=require(_0x2edf('0x4'));var interaction=require(_0x2edf('0x5'));var config=require(_0x2edf('0x6'));var controller=require(_0x2edf('0x7'));router[_0x2edf('0x8')]('/',auth[_0x2edf('0x9')](),controller[_0x2edf('0xa')]);router[_0x2edf('0x8')](_0x2edf('0xb'),auth[_0x2edf('0x9')](),controller[_0x2edf('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2edf('0x8')](_0x2edf('0xd'),auth[_0x2edf('0x9')](),controller['getMessages']);router['get'](_0x2edf('0xe'),auth[_0x2edf('0x9')](),controller[_0x2edf('0xf')]);router['post']('/',auth[_0x2edf('0x9')](),controller[_0x2edf('0x10')]);router['post'](_0x2edf('0xd'),auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x2edf('0x11'),auth[_0x2edf('0x9')](),interaction[_0x2edf('0x12')]('mail',_0x2edf('0x13')),controller[_0x2edf('0x14')]);router['put'](_0x2edf('0x15'),auth[_0x2edf('0x9')](),interaction[_0x2edf('0x12')](_0x2edf('0x16'),_0x2edf('0x17')),controller[_0x2edf('0x18')]);router[_0x2edf('0x19')]('/:id',auth['isAuthenticated'](),interaction['tracked']('mail',_0x2edf('0x1a')),controller[_0x2edf('0x1b')]);router[_0x2edf('0x19')]('/:id/tags',auth[_0x2edf('0x9')](),controller[_0x2edf('0x1c')]);module[_0x2edf('0x1d')]=router; \ No newline at end of file +var _0x7f36=['util','path','connect-timeout','express','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','post','create','addMessage','tracked','mail','mailinteraction:addtags','mailinteraction:update','update','delete','/:id','destroy','/:id/tags','exports','multer'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7f36,0x1bf));var _0x67f3=function(_0x5c5abc,_0x284219){_0x5c5abc=_0x5c5abc-0x0;var _0x1c16d7=_0x7f36[_0x5c5abc];return _0x1c16d7;};'use strict';var multer=require(_0x67f3('0x0'));var util=require(_0x67f3('0x1'));var path=require(_0x67f3('0x2'));var timeout=require(_0x67f3('0x3'));var express=require(_0x67f3('0x4'));var router=express['Router']();var auth=require(_0x67f3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x67f3('0x6'));router[_0x67f3('0x7')]('/',auth[_0x67f3('0x8')](),controller[_0x67f3('0x9')]);router[_0x67f3('0x7')](_0x67f3('0xa'),auth[_0x67f3('0x8')](),controller[_0x67f3('0xb')]);router['get']('/:id',auth[_0x67f3('0x8')](),controller[_0x67f3('0xc')]);router[_0x67f3('0x7')](_0x67f3('0xd'),auth['isAuthenticated'](),controller[_0x67f3('0xe')]);router[_0x67f3('0x7')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x67f3('0xf')]('/',auth[_0x67f3('0x8')](),controller[_0x67f3('0x10')]);router[_0x67f3('0xf')](_0x67f3('0xd'),auth[_0x67f3('0x8')](),controller[_0x67f3('0x11')]);router[_0x67f3('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x67f3('0x12')](_0x67f3('0x13'),_0x67f3('0x14')),controller['addTags']);router['put']('/:id',auth[_0x67f3('0x8')](),interaction['tracked'](_0x67f3('0x13'),_0x67f3('0x15')),controller[_0x67f3('0x16')]);router[_0x67f3('0x17')](_0x67f3('0x18'),auth['isAuthenticated'](),interaction['tracked'](_0x67f3('0x13'),'mailinteraction:destroy'),controller[_0x67f3('0x19')]);router['delete'](_0x67f3('0x1a'),auth[_0x67f3('0x8')](),controller['removeTags']);module[_0x67f3('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 04e35d2..542a02f 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 _0x0271=['BOOLEAN','DATE','STRING','TEXT','long','ENUM','out','sequelize','exports'];(function(_0x295fe9,_0x345828){var _0x3b80df=function(_0x85b4dc){while(--_0x85b4dc){_0x295fe9['push'](_0x295fe9['shift']());}};_0x3b80df(++_0x345828);}(_0x0271,0x7c));var _0x1027=function(_0x235155,_0x369750){_0x235155=_0x235155-0x0;var _0x2432e3=_0x0271[_0x235155];return _0x2432e3;};'use strict';var Sequelize=require(_0x1027('0x0'));var iconv=require('iconv');module[_0x1027('0x1')]={'closed':{'type':Sequelize[_0x1027('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1027('0x3')]},'disposition':{'type':Sequelize[_0x1027('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x1027('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x1027('0x5')](_0x1027('0x6'))},'subject':{'type':Sequelize[_0x1027('0x5')]()},'attach':{'type':Sequelize[_0x1027('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x1027('0x3')]},'substatus':{'type':Sequelize[_0x1027('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x1027('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1027('0x7')]('in',_0x1027('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1027('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x1027('0x7')]('in',_0x1027('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x1027('0x5')](_0x1027('0x6'))},'lastMsgText':{'type':Sequelize[_0x1027('0x5')]('long')}}; \ No newline at end of file +var _0x1d21=['sequelize','iconv','DATE','STRING','TEXT','long','ENUM','out'];(function(_0x40008d,_0x923962){var _0x5ccba8=function(_0x2a1841){while(--_0x2a1841){_0x40008d['push'](_0x40008d['shift']());}};_0x5ccba8(++_0x923962);}(_0x1d21,0x1b0));var _0x11d2=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0x1d21[_0x1e91eb];return _0x2af75a;};'use strict';var Sequelize=require(_0x11d2('0x0'));var iconv=require(_0x11d2('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x11d2('0x2')]},'disposition':{'type':Sequelize[_0x11d2('0x3')]},'note':{'type':Sequelize[_0x11d2('0x3')]},'inReplyTo':{'type':Sequelize[_0x11d2('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x11d2('0x4')](_0x11d2('0x5'))},'subject':{'type':Sequelize[_0x11d2('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x11d2('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x11d2('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x11d2('0x6')]('in',_0x11d2('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x11d2('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x11d2('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x11d2('0x4')](_0x11d2('0x5'))},'lastMsgText':{'type':Sequelize['TEXT'](_0x11d2('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index a420d3b..ebec08f 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 _0xa991=['send','Users','map','fullname','TagIds','split','forEach','Tags','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','offset','order','sort','where','pick','select','field','color','u.id','u.fullname','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','mail_interactions','cm_contacts','a.id\x20=\x20i.MailAccountId','mail_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','sqlOperator','conditions','length','find','value','having','`\x20=\x200','Contact','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','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','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','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','MailAccountId','journey','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closedAt','i.attach','i.subject','i.disposition','i.to','i.ContactId','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','enableEmailPreview','all','show','params','includeAll','include','options','catch','create','body','destroy','describe','MailMessage','addMessage','omit','ids','getMessages','nolimit','MailInteractionId','findAll','rows','addTags','setTags','spread','emit','mailInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','bcc','subject','get','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','build','writeFileSync','message%d.eml','unlinkSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','status','end','count','limit','set','Content-Range','json','reject','save','update','then','sendStatus','error','name'];(function(_0x568f96,_0x32d489){var _0x5a053a=function(_0x5570ce){while(--_0x5570ce){_0x568f96['push'](_0x568f96['shift']());}};_0x5a053a(++_0x32d489);}(_0xa991,0xc0));var _0x1a99=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xa991[_0x6cf19c];return _0xce14f3;};'use strict';var pdf=require(_0x1a99('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1a99('0x1'));var zipdir=require(_0x1a99('0x2'));var jsonpatch=require(_0x1a99('0x3'));var rp=require(_0x1a99('0x4'));var moment=require(_0x1a99('0x5'));var BPromise=require(_0x1a99('0x6'));var Mustache=require(_0x1a99('0x7'));var util=require(_0x1a99('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x1a99('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1a99('0xa'));var squel=require('squel');var crypto=require(_0x1a99('0xb'));var jsforce=require(_0x1a99('0xc'));var deskjs=require(_0x1a99('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1a99('0xe'));var Papa=require('papaparse');var htmlToText=require('html-to-text');var Redis=require(_0x1a99('0xf'));var authService=require(_0x1a99('0x10'));var qs=require(_0x1a99('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1a99('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1a99('0x13'))['db'];config[_0x1a99('0x14')]=_[_0x1a99('0x15')](config['redis'],{'host':_0x1a99('0x16'),'port':0x18eb});var socket=require(_0x1a99('0x17'))(new Redis(config[_0x1a99('0x14')]));require(_0x1a99('0x18'))['register'](socket);function respondWithStatusCode(_0x5944be,_0x19f58){_0x19f58=_0x19f58||0xcc;return function(_0x1f0f54){if(_0x1f0f54){return _0x5944be['sendStatus'](_0x19f58);}return _0x5944be[_0x1a99('0x19')](_0x19f58)[_0x1a99('0x1a')]();};}function respondWithResult(_0x13521d,_0x4fbdee){_0x4fbdee=_0x4fbdee||0xc8;return function(_0x4d0ba0){if(_0x4d0ba0){return _0x13521d[_0x1a99('0x19')](_0x4fbdee)['json'](_0x4d0ba0);}};}function respondWithFilteredResult(_0x430151,_0x9a3fe6){return function(_0x3d8ef5){if(_0x3d8ef5){var _0x3dc6b5=_0x3d8ef5[_0x1a99('0x1b')],_0x3146d0=_0x9a3fe6['offset'],_0x163dfe=_0x9a3fe6['offset']+_0x9a3fe6[_0x1a99('0x1c')],_0x75fba6;if(_0x163dfe>=_0x3dc6b5){_0x163dfe=_0x3dc6b5;_0x75fba6=0xc8;}else{_0x75fba6=0xce;}_0x430151['status'](_0x75fba6);return _0x430151[_0x1a99('0x1d')](_0x1a99('0x1e'),_0x3146d0+'-'+_0x163dfe+'/'+_0x3dc6b5)[_0x1a99('0x1f')](_0x3d8ef5);}return null;};}function patchUpdates(_0xf31155){return function(_0x2a874b){try{jsonpatch['apply'](_0x2a874b,_0xf31155,!![]);}catch(_0x3812c4){return BPromise[_0x1a99('0x20')](_0x3812c4);}return _0x2a874b[_0x1a99('0x21')]();};}function saveUpdates(_0x408406,_0x2167a1){return function(_0x397d0a){if(_0x397d0a){return _0x397d0a[_0x1a99('0x22')](_0x408406)['then'](function(_0x2082d3){return _0x2082d3;});}return null;};}function removeEntity(_0x1db7f0,_0x5ae821){return function(_0x439fb5){if(_0x439fb5){return _0x439fb5['destroy']()[_0x1a99('0x23')](function(){_0x1db7f0['status'](0xcc)[_0x1a99('0x1a')]();});}};}function handleEntityNotFound(_0x9ea715,_0x1263ed){return function(_0x9c288a){if(!_0x9c288a){_0x9ea715[_0x1a99('0x24')](0x194);}return _0x9c288a;};}function handleError(_0x547185,_0x335fa0){_0x335fa0=_0x335fa0||0x1f4;return function(_0x4b69e5){logger[_0x1a99('0x25')](_0x4b69e5['stack']);if(_0x4b69e5['name']){delete _0x4b69e5[_0x1a99('0x26')];}_0x547185['status'](_0x335fa0)[_0x1a99('0x27')](_0x4b69e5);};}function getInteractionUsers(_0xe69dd6,_0x589a80){return new BPromise(function(_0x5f561b,_0x2d08bc){try{if(_0x589a80[_0xe69dd6['id']]){_0xe69dd6[_0x1a99('0x28')]=_[_0x1a99('0x29')](_0x589a80[_0xe69dd6['id']],function(_0x38c5f4){return{'id':_0x38c5f4['id'],'fullname':_0x38c5f4[_0x1a99('0x2a')]};});}}catch(_0x4eb491){_0x2d08bc(_0x4eb491);}_0x5f561b(_0xe69dd6);});}function getInteractionTags(_0x6c4e92,_0x44a1b7){return new BPromise(function(_0x41b1b7,_0x39b379){try{if(_0x6c4e92[_0x1a99('0x2b')]){_0x6c4e92['Tags']=[];_0x6c4e92[_0x1a99('0x2b')][_0x1a99('0x2c')](',')[_0x1a99('0x2d')](function(_0x483dcc){_0x6c4e92[_0x1a99('0x2e')][_0x1a99('0x2f')](_0x44a1b7[_0x483dcc]);});}delete _0x6c4e92[_0x1a99('0x2b')];}catch(_0x29de1e){_0x39b379(_0x29de1e);}_0x41b1b7(_0x6c4e92);});}function getLastMessageText(_0x1bc117){return new BPromise(function(_0x198489,_0x3c5fbf){return db[_0x1a99('0x30')][_0x1a99('0x31')]({'where':{'id':_0x1bc117['id']},'attributes':[_0x1a99('0x32'),_0x1a99('0x33')],'raw':!![]})[_0x1a99('0x23')](function(_0x27016a){if(!_0x27016a[_0x1a99('0x33')]){_0x1bc117[_0x1a99('0x33')]=_[_0x1a99('0x34')](htmlToText[_0x1a99('0x35')](_0x27016a[_0x1a99('0x32')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x1bc117[_0x1a99('0x33')]=_0x27016a['lastMsgText'];}_0x198489(_0x1bc117);})['catch'](function(_0xf2df38){_0x3c5fbf(_0xf2df38);});});}function updateMailInteraction(_0x17615f,_0x1cada5,_0x1f62d2,_0x426e4b){return new BPromise(function(_0xaf5b45,_0x2ca9ff){return getInteractionUsers(_0x17615f,_0x1f62d2)['then'](function(_0x252c66){return getInteractionTags(_0x252c66,_0x1cada5);})['then'](function(_0x4fb4bc){if(_0x426e4b){_0xaf5b45(getLastMessageText(_0x4fb4bc));}else{_0xaf5b45(_0x4fb4bc);}})['catch'](function(_0xf5a8a0){_0x2ca9ff(_0xf5a8a0);});});}exports['index']=function(_0x506791,_0x431fac){var _0x5d3163={},_0x575f01={},_0x31caea={'count':0x0,'rows':[]};var _0x2a0ffe=_['map'](db[_0x1a99('0x30')][_0x1a99('0x36')],function(_0x1540b4){return{'name':_0x1540b4[_0x1a99('0x37')],'type':_0x1540b4[_0x1a99('0x38')][_0x1a99('0x39')]};});_0x575f01['model']=_[_0x1a99('0x29')](_0x2a0ffe,_0x1a99('0x26'));_0x575f01[_0x1a99('0x3a')]=_[_0x1a99('0x3b')](_0x506791[_0x1a99('0x3a')]);_0x575f01[_0x1a99('0x3c')]=_[_0x1a99('0x3d')](_0x575f01[_0x1a99('0x3e')],_0x575f01[_0x1a99('0x3a')]);_0x5d3163[_0x1a99('0x3f')]=_[_0x1a99('0x3d')](_0x575f01['model'],qs['fields'](_0x506791[_0x1a99('0x3a')][_0x1a99('0x40')]));_0x5d3163[_0x1a99('0x3f')]=_0x5d3163[_0x1a99('0x3f')]['length']?_0x5d3163[_0x1a99('0x3f')]:_0x575f01[_0x1a99('0x3e')];if(!_0x506791['query'][_0x1a99('0x41')]('nolimit')){_0x5d3163[_0x1a99('0x1c')]=qs[_0x1a99('0x1c')](_0x506791['query'][_0x1a99('0x1c')]);_0x5d3163[_0x1a99('0x42')]=qs['offset'](_0x506791[_0x1a99('0x3a')][_0x1a99('0x42')]);}_0x5d3163[_0x1a99('0x43')]=qs[_0x1a99('0x44')](_0x506791['query']['sort']);_0x5d3163[_0x1a99('0x45')]=qs[_0x1a99('0x3c')](_[_0x1a99('0x46')](_0x506791[_0x1a99('0x3a')],_0x575f01['filters']));var _0x472167=[];var _0x14c52a=squel[_0x1a99('0x47')]()['field']('id')[_0x1a99('0x48')](_0x1a99('0x26'))[_0x1a99('0x48')](_0x1a99('0x49'))['from']('tools_tags');var _0xd721f8=squel[_0x1a99('0x47')]()[_0x1a99('0x48')](_0x1a99('0x4a'))[_0x1a99('0x48')](_0x1a99('0x4b'))[_0x1a99('0x48')](_0x1a99('0x4c'))[_0x1a99('0x4d')](_0x1a99('0x4e'),'ui')[_0x1a99('0x4f')](_0x1a99('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x137838=squel[_0x1a99('0x47')]()[_0x1a99('0x4d')](_0x1a99('0x51'),'i')[_0x1a99('0x4f')](_0x1a99('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1a99('0x4f')](_0x1a99('0x50'),'o','o.id\x20=\x20i.UserId')[_0x1a99('0x4f')]('mail_accounts','a',_0x1a99('0x53'))[_0x1a99('0x4f')]('mail_messages','me','me.MailInteractionId\x20=\x20i.id')['left_join'](_0x1a99('0x54'),'it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x1a99('0x55'),'t',_0x1a99('0x56'));var _0x21babb=squel[_0x1a99('0x57')]();var _0x7328b7=[];var _0x263679=squel[_0x1a99('0x57')]();var _0x405435;if(_0x506791[_0x1a99('0x3a')]['search']){_0x405435=as[_0x1a99('0x58')](_0x506791[_0x1a99('0x3a')]['search']);var _0x288e8e=_0x405435[_0x1a99('0x59')];for(var _0x5cb756=0x0;_0x5cb756<_0x405435[_0x1a99('0x5a')][_0x1a99('0x5b')];_0x5cb756++){var _0x1738c2=_0x405435[_0x1a99('0x5a')][_0x5cb756];var _0x54d0bc='i';var _0x328f1a=_[_0x1a99('0x5c')](_0x2a0ffe,[_0x1a99('0x26'),_0x1738c2[_0x1a99('0x48')]]);if(!_0x328f1a){switch(_0x1738c2[_0x1a99('0x48')]){case'unreadMessages':if(_0x1738c2[_0x1a99('0x5d')]==0x1){_0x137838[_0x1a99('0x5e')]('`'+_0x1738c2[_0x1a99('0x48')]+_0x1a99('0x5f'));}else{_0x137838[_0x1a99('0x5e')]('`'+_0x1738c2['field']+'`\x20>\x200');}break;case _0x1a99('0x60'):if(_0x1738c2['operator']==='$substring'){if(_0x1738c2[_0x1a99('0x5d')]['split']('\x20')[_0x1a99('0x5b')]>0x1){_0x21babb[_0x288e8e](_0x1a99('0x61'),qs['getFullTextValue'](_0x1738c2[_0x1a99('0x5d')]),null);}else{var _0xd7c3bd='%'+_0x1738c2['value']+'%';_0x21babb[_0x288e8e](_0x1a99('0x62'),_0xd7c3bd,_0xd7c3bd,_0xd7c3bd);}}else{_0x328f1a=_['find'](_0x2a0ffe,[_0x1a99('0x26'),_0x1a99('0x63')]);_0x1738c2[_0x1a99('0x48')]=_0x1a99('0x63');_0x5917f0=as[_0x1a99('0x64')](_0x54d0bc,_0x328f1a['type'],_0x1738c2);_0x21babb[_0x288e8e](_0x5917f0[_0x1a99('0x65')],_0x5917f0[_0x1a99('0x5d')][_0x1a99('0x66')],_0x5917f0[_0x1a99('0x5d')][_0x1a99('0x1a')]);}break;case'Tag':var _0x5b71c6=_0x1738c2['value'][_0x1a99('0x2c')](',')[_0x1a99('0x29')](function(_0x245faa){return Number(_0x245faa);});_0x5b71c6[_0x1a99('0x2d')](function(_0xc0357e){_0x263679['or'](_0x1a99('0x67'),'%,'+_0xc0357e+',%');});_0x7328b7=_[_0x1a99('0x68')](_0x7328b7,_0x5b71c6);break;case _0x1a99('0x69'):if(_0x1738c2['operator']==='$substring'){_0x21babb[_0x288e8e](_0x1a99('0x6a'),'%'+_0x1738c2['value']+'%',null);}else{_0x328f1a=_[_0x1a99('0x5c')](_0x2a0ffe,[_0x1a99('0x26'),_0x1a99('0x6b')]);_0x1738c2[_0x1a99('0x48')]=_0x1a99('0x6b');_0x5917f0=as[_0x1a99('0x64')](_0x54d0bc,_0x328f1a['type'],_0x1738c2);_0x21babb[_0x288e8e](_0x5917f0[_0x1a99('0x65')],_0x5917f0[_0x1a99('0x5d')][_0x1a99('0x66')],_0x5917f0[_0x1a99('0x5d')][_0x1a99('0x1a')]);}break;case _0x1a99('0x6c'):_0x5917f0=as['buildExpression']('me',null,_0x1738c2);_0x21babb[_0x288e8e](_0x5917f0[_0x1a99('0x65')],_0x5917f0[_0x1a99('0x5d')]['start'],_0x5917f0[_0x1a99('0x5d')]['end']);break;}}else{var _0x5917f0=as[_0x1a99('0x64')](_0x54d0bc,_0x328f1a[_0x1a99('0x38')],_0x1738c2);_0x21babb[_0x288e8e](_0x5917f0[_0x1a99('0x65')],_0x5917f0[_0x1a99('0x5d')][_0x1a99('0x66')],_0x5917f0[_0x1a99('0x5d')][_0x1a99('0x1a')]);}}}else{var _0x2b2de4=_(_0x506791[_0x1a99('0x3a')])[_0x1a99('0x3b')]()[_0x1a99('0x29')](function(_0x11439c){return _[_0x1a99('0x6d')](_0x2a0ffe,[_0x1a99('0x26'),_0x11439c])?_0x11439c:undefined;})[_0x1a99('0x6e')]()[_0x1a99('0x5d')]();if(!_[_0x1a99('0x6f')](_0x2b2de4)){_0x2b2de4['forEach'](function(_0x70c550){if(_0x70c550==='MailAccountId'){_0x137838[_0x1a99('0x45')](_0x1a99('0x70'),[]['concat'](_0x506791[_0x1a99('0x3a')][_0x70c550]));}else if(_0x70c550===_0x1a99('0x71')){var _0x48a74c=JSON[_0x1a99('0x72')](_0x506791[_0x1a99('0x3a')][_0x70c550])[_0x1a99('0x73')];var _0x6baa6e=JSON[_0x1a99('0x72')](_0x506791[_0x1a99('0x3a')][_0x70c550])[_0x1a99('0x74')];_0x137838['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x48a74c,_0x6baa6e);}else{if(_0x506791[_0x1a99('0x3a')][_0x70c550]===_0x1a99('0x75')){_0x137838[_0x1a99('0x45')]('i.'+_0x70c550+'\x20IS\x20NULL');}else{_0x137838[_0x1a99('0x45')]('i.'+_0x70c550+'\x20=\x20?',_0x506791[_0x1a99('0x3a')][_0x70c550]);}}});}if(_0x506791[_0x1a99('0x3a')][_0x1a99('0x76')]){if(_0x506791[_0x1a99('0x3a')][_0x1a99('0x76')]==0x1){_0x137838[_0x1a99('0x5e')](_0x1a99('0x77'));}else{_0x137838[_0x1a99('0x5e')](_0x1a99('0x78'));}}if(_0x506791['query'][_0x1a99('0x79')]){_0x7328b7=_[_0x1a99('0x7a')](_0x506791[_0x1a99('0x3a')][_0x1a99('0x79')])?_0x506791[_0x1a99('0x3a')][_0x1a99('0x79')]:new Array(_0x506791['query'][_0x1a99('0x79')]);_0x7328b7[_0x1a99('0x2d')](function(_0x4ec14d){_0x263679['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4ec14d+',%');});}if(_0x506791[_0x1a99('0x3a')]['filter']){var _0x133e9a=_0x506791[_0x1a99('0x3a')][_0x1a99('0x7b')]['replace']('\x5c','\x5c\x5c')[_0x1a99('0x7c')]('\x27\x27',_0x1a99('0x7d'));if(qs[_0x1a99('0x7e')](_0x133e9a)){_0x21babb['or'](_0x1a99('0x7f'),_0x133e9a+'%');}else if(qs[_0x1a99('0x80')](_0x133e9a)){_0x21babb['or']('c.email\x20LIKE\x20?',_0x133e9a+'%');}else{_0x21babb['or'](_0x1a99('0x81'),qs[_0x1a99('0x82')](_0x133e9a))['or'](_0x1a99('0x83'),qs[_0x1a99('0x82')](_0x133e9a));}}}_0x137838[_0x1a99('0x45')](_0x21babb);_0x137838[_0x1a99('0x84')](_0x1a99('0x85'));var _0x378c7f={'type':db[_0x1a99('0x86')][_0x1a99('0x87')][_0x1a99('0x88')],'raw':!![]};var _0x4fd7b9=_0x137838['clone']();_0x4fd7b9[_0x1a99('0x48')](_0x1a99('0x85'));_0x4fd7b9[_0x1a99('0x48')](_0x1a99('0x89'),_0x1a99('0x8a'));if(_0x5d3163['order']){_0x5d3163[_0x1a99('0x43')][_0x1a99('0x2d')](function(_0xb515ba){_0x137838[_0x1a99('0x43')]('i.'+_0xb515ba[0x0],_0xb515ba[0x1]===_0x1a99('0x8b')?![]:!![]);});}if(!_[_0x1a99('0x6f')](_0x7328b7)){_0x137838[_0x1a99('0x5e')](_0x263679);_0x4fd7b9['where'](_0x1a99('0x8c'),_0x7328b7);}BPromise[_0x1a99('0x8d')]()['then'](function(){if(!_0x405435){if(_0x506791[_0x1a99('0x3a')][_0x1a99('0x8e')]||_0x506791[_0x1a99('0x3a')][_0x1a99('0x8f')])return;_0x4fd7b9[_0x1a99('0x45')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x137838[_0x1a99('0x45')]('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}return _0x506791[_0x1a99('0x90')][_0x1a99('0x91')]({'attributes':['id'],'raw':!![]})[_0x1a99('0x23')](function(_0x18df1e){if(_[_0x1a99('0x6f')](_0x18df1e)){_0x4fd7b9[_0x1a99('0x45')](_0x1a99('0x92'));_0x137838[_0x1a99('0x45')](_0x1a99('0x92'));}else{_0x4fd7b9[_0x1a99('0x45')]('i.MailAccountId\x20IN\x20?',_[_0x1a99('0x29')](_0x18df1e,'id'));_0x137838[_0x1a99('0x45')](_0x1a99('0x70'),_[_0x1a99('0x29')](_0x18df1e,'id'));}});})[_0x1a99('0x23')](function(){db[_0x1a99('0x93')][_0x1a99('0x3a')](_0x4fd7b9[_0x1a99('0x94')](),_0x378c7f)[_0x1a99('0x23')](function(_0x4d777c){_0x31caea[_0x1a99('0x1b')]=_0x4d777c[_0x1a99('0x5b')];if(_0x31caea['count']===0x0)return[];return db[_0x1a99('0x93')]['query'](_0x14c52a['toString'](),_0x378c7f)[_0x1a99('0x23')](function(_0x14a489){_0x472167=_['keyBy'](_0x14a489,'id');_0x378c7f=_[_0x1a99('0x95')](_0x378c7f,{'model':db[_0x1a99('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x506791[_0x1a99('0x3a')][_0x1a99('0x40')]){_0x5d3163[_0x1a99('0x3f')][_0x1a99('0x2d')](function(_0x2b1d9a){_0x137838[_0x1a99('0x48')]('i.'+_0x2b1d9a);});}else{_0x137838[_0x1a99('0x48')](_0x1a99('0x89'),_0x1a99('0x8a'));_0x137838[_0x1a99('0x48')](_0x1a99('0x96'),_0x1a99('0x97'));_0x137838[_0x1a99('0x48')](_0x1a99('0x98'),_0x1a99('0x99'));_0x137838[_0x1a99('0x48')](_0x1a99('0x85'));_0x137838['field'](_0x1a99('0x9a'));_0x137838[_0x1a99('0x48')](_0x1a99('0x9b'));_0x137838[_0x1a99('0x48')]('i.closed');_0x137838[_0x1a99('0x48')](_0x1a99('0x9c'));_0x137838[_0x1a99('0x48')](_0x1a99('0x9d'));_0x137838['field']('i.lastMsgAt');_0x137838['field']('i.lastMsgDirection');_0x137838[_0x1a99('0x48')](_0x1a99('0x9e'));_0x137838[_0x1a99('0x48')](_0x1a99('0x9f'));_0x137838['field']('i.substatus');_0x137838[_0x1a99('0x48')](_0x1a99('0xa0'));_0x137838[_0x1a99('0x48')](_0x1a99('0xa1'));_0x137838[_0x1a99('0x48')](_0x1a99('0xa2'));_0x137838[_0x1a99('0x48')](_0x1a99('0xa3'));_0x137838[_0x1a99('0x48')](_0x1a99('0xa4'),_0x1a99('0xa5'));_0x137838['field'](_0x1a99('0xa6'),'Contact.lastName');_0x137838['field'](_0x1a99('0xa7'),_0x1a99('0xa8'));_0x137838['field'](_0x1a99('0xa9'),_0x1a99('0xaa'));_0x137838[_0x1a99('0x48')](_0x1a99('0xab'),'Contact.mobile');_0x137838[_0x1a99('0x48')](_0x1a99('0xac'),_0x1a99('0xad'));_0x137838[_0x1a99('0x48')](_0x1a99('0xae'),_0x1a99('0xaf'));_0x137838[_0x1a99('0x48')](_0x1a99('0xb0'),_0x1a99('0xb1'));_0x137838[_0x1a99('0x48')](_0x1a99('0xb2'),_0x1a99('0x2b'));}_0x137838[_0x1a99('0x1c')](_0x5d3163[_0x1a99('0x1c')]);_0x137838['offset'](_0x5d3163['offset']);return db[_0x1a99('0x93')][_0x1a99('0x3a')](_0x137838[_0x1a99('0x94')](),_0x378c7f);})[_0x1a99('0x23')](function(_0x53dca3){_0xd721f8[_0x1a99('0x45')]('ui.MailInteractionId\x20IN\x20?',_[_0x1a99('0x29')](_0x53dca3,'id'));return db[_0x1a99('0x93')][_0x1a99('0x3a')](_0xd721f8['toString'](),_0x378c7f)[_0x1a99('0x23')](function(_0x1953ec){var _0xf52d70=_[_0x1a99('0xb3')](_0x1953ec,'MailInteractionId');var _0x389467=[];return db['Setting'][_0x1a99('0x31')]({'attributes':[_0x1a99('0xb4')],'raw':!![]})[_0x1a99('0x23')](function(_0x2d90ee){var _0x11f3a2=_0x2d90ee[_0x1a99('0xb4')];_0x53dca3[_0x1a99('0x2d')](function(_0x298b93){_0x389467[_0x1a99('0x2f')](updateMailInteraction(_0x298b93,_0x472167,_0xf52d70,_0x11f3a2));});return BPromise[_0x1a99('0xb5')](_0x389467);});});});})[_0x1a99('0x23')](function(_0xc90ee0){_0x31caea['rows']=_0xc90ee0;return _0x31caea;})['then'](respondWithFilteredResult(_0x431fac,_0x5d3163));})['catch'](handleError(_0x431fac,null));};exports[_0x1a99('0xb6')]=function(_0x2ecef4,_0x477c18){var _0x118eac={'raw':![],'where':{'id':_0x2ecef4[_0x1a99('0xb7')]['id']}},_0x248386={};_0x248386[_0x1a99('0x3e')]=_[_0x1a99('0x3b')](db['MailInteraction'][_0x1a99('0x36')]);_0x248386['query']=_[_0x1a99('0x3b')](_0x2ecef4[_0x1a99('0x3a')]);_0x248386[_0x1a99('0x3c')]=_['intersection'](_0x248386[_0x1a99('0x3e')],_0x248386[_0x1a99('0x3a')]);_0x118eac['attributes']=_[_0x1a99('0x3d')](_0x248386[_0x1a99('0x3e')],qs['fields'](_0x2ecef4['query'][_0x1a99('0x40')]));_0x118eac[_0x1a99('0x3f')]=_0x118eac[_0x1a99('0x3f')]['length']?_0x118eac[_0x1a99('0x3f')]:_0x248386[_0x1a99('0x3e')];if(_0x2ecef4['query'][_0x1a99('0xb8')]){_0x118eac[_0x1a99('0xb9')]=[{'all':!![]}];}_0x118eac=_['merge']({},_0x118eac,_0x2ecef4[_0x1a99('0xba')]);return db[_0x1a99('0x30')][_0x1a99('0x5c')](_0x118eac)[_0x1a99('0x23')](handleEntityNotFound(_0x477c18,null))['then'](respondWithResult(_0x477c18,null))[_0x1a99('0xbb')](handleError(_0x477c18,null));};exports[_0x1a99('0xbc')]=function(_0x41cb1b,_0x206046){return db[_0x1a99('0x30')]['create'](_0x41cb1b[_0x1a99('0xbd')],{})[_0x1a99('0x23')](respondWithResult(_0x206046,0xc9))['catch'](handleError(_0x206046,null));};exports[_0x1a99('0x22')]=function(_0x283400,_0x6ccc0c){if(_0x283400['body']['id']){delete _0x283400['body']['id'];}return db[_0x1a99('0x30')][_0x1a99('0x5c')]({'where':{'id':_0x283400['params']['id']}})[_0x1a99('0x23')](handleEntityNotFound(_0x6ccc0c,null))['then'](saveUpdates(_0x283400['body'],null))[_0x1a99('0x23')](respondWithResult(_0x6ccc0c,null))[_0x1a99('0xbb')](handleError(_0x6ccc0c,null));};exports[_0x1a99('0xbe')]=function(_0x58ae89,_0xbbdcaa){return db['MailInteraction']['find']({'where':{'id':_0x58ae89['params']['id']}})['then'](handleEntityNotFound(_0xbbdcaa,null))['then'](removeEntity(_0xbbdcaa,null))[_0x1a99('0xbb')](handleError(_0xbbdcaa,null));};exports[_0x1a99('0xbf')]=function(_0x58eddd,_0x25bb34){return db[_0x1a99('0x30')][_0x1a99('0xbf')]()[_0x1a99('0x23')](respondWithResult(_0x25bb34,null))[_0x1a99('0xbb')](handleError(_0x25bb34,null));};exports['addMessage']=function(_0x4dd1ae,_0x5473fe,_0x299499){return db[_0x1a99('0xc0')][_0x1a99('0x5c')]({'where':{'id':_0x4dd1ae['params']['id']}})[_0x1a99('0x23')](handleEntityNotFound(_0x5473fe,null))[_0x1a99('0x23')](function(_0x2b41b9){if(_0x2b41b9){return _0x2b41b9[_0x1a99('0xc1')](_0x4dd1ae[_0x1a99('0xbd')]['ids'],_[_0x1a99('0xc2')](_0x4dd1ae[_0x1a99('0xbd')],[_0x1a99('0xc3'),'id'])||{});}})[_0x1a99('0x23')](respondWithResult(_0x5473fe,null))[_0x1a99('0xbb')](handleError(_0x5473fe,null));};exports[_0x1a99('0xc4')]=function(_0x3bc751,_0x3ce421,_0x579069){var _0xaaff95={'raw':![],'where':{}};var _0x1e105a={};var _0x46b183={'count':0x0,'rows':[]};return db[_0x1a99('0x30')][_0x1a99('0x31')]({'where':{'id':_0x3bc751[_0x1a99('0xb7')]['id']}})[_0x1a99('0x23')](handleEntityNotFound(_0x3ce421,null))[_0x1a99('0x23')](function(_0x50abc7){if(_0x50abc7){_0x1e105a[_0x1a99('0x3e')]=_['keys'](db['MailMessage']['rawAttributes']);_0x1e105a[_0x1a99('0x3a')]=_['keys'](_0x3bc751['query']);_0x1e105a['filters']=_[_0x1a99('0x3d')](_0x1e105a[_0x1a99('0x3e')],_0x1e105a[_0x1a99('0x3a')]);_0xaaff95['attributes']=_['intersection'](_0x1e105a['model'],qs[_0x1a99('0x40')](_0x3bc751[_0x1a99('0x3a')][_0x1a99('0x40')]));_0xaaff95[_0x1a99('0x3f')]=_0xaaff95[_0x1a99('0x3f')][_0x1a99('0x5b')]?_0xaaff95[_0x1a99('0x3f')]:_0x1e105a[_0x1a99('0x3e')];if(!_0x3bc751[_0x1a99('0x3a')][_0x1a99('0x41')](_0x1a99('0xc5'))){_0xaaff95[_0x1a99('0x1c')]=qs[_0x1a99('0x1c')](_0x3bc751['query'][_0x1a99('0x1c')]);_0xaaff95['offset']=qs[_0x1a99('0x42')](_0x3bc751[_0x1a99('0x3a')][_0x1a99('0x42')]);}_0xaaff95[_0x1a99('0x43')]=qs[_0x1a99('0x44')](_0x3bc751[_0x1a99('0x3a')][_0x1a99('0x44')]);_0xaaff95[_0x1a99('0x45')]=qs[_0x1a99('0x3c')](_[_0x1a99('0x46')](_0x3bc751[_0x1a99('0x3a')],_0x1e105a[_0x1a99('0x3c')]));_0xaaff95[_0x1a99('0x45')][_0x1a99('0xc6')]=_0x50abc7['id'];if(_0x3bc751[_0x1a99('0x3a')][_0x1a99('0x7b')]){_0xaaff95[_0x1a99('0x45')]=_[_0x1a99('0x95')](_0xaaff95[_0x1a99('0x45')],{'$or':_[_0x1a99('0x29')](_0xaaff95[_0x1a99('0x3f')],function(_0x336b15){var _0x12d3b2={};_0x12d3b2[_0x336b15]={'$like':'%'+_0x3bc751[_0x1a99('0x3a')]['filter']+'%'};return _0x12d3b2;})});}if(_0x3bc751['query'][_0x1a99('0x73')]){var _0x31546b=_0x3bc751[_0x1a99('0x3a')][_0x1a99('0x73')][_0x1a99('0x2c')](',');var _0x11edf2={};_0x11edf2[_0x31546b[0x0]]={'$gte':moment(_0x31546b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xaaff95[_0x1a99('0x45')]=_[_0x1a99('0x95')](_0xaaff95['where'],_0x11edf2);}_0xaaff95=_[_0x1a99('0x95')]({},_0xaaff95,_0x3bc751['options']);return db[_0x1a99('0xc0')][_0x1a99('0x1b')]({'where':_0xaaff95[_0x1a99('0x45')]})['then'](function(_0x2e48c9){_0x46b183[_0x1a99('0x1b')]=_0x2e48c9;if(_0x3bc751[_0x1a99('0x3a')][_0x1a99('0xb8')]){_0xaaff95['include']=[{'all':!![]}];}return db[_0x1a99('0xc0')][_0x1a99('0xc7')](_0xaaff95);})['then'](function(_0xe3e15b){_0x46b183[_0x1a99('0xc8')]=_0xe3e15b;return _0x46b183;});}})['then'](respondWithFilteredResult(_0x3ce421,_0xaaff95))[_0x1a99('0xbb')](handleError(_0x3ce421,null));};exports[_0x1a99('0xc9')]=function(_0x512083,_0x207cb8,_0x592aeb){return db[_0x1a99('0x30')]['find']({'where':{'id':_0x512083[_0x1a99('0xb7')]['id']}})[_0x1a99('0x23')](handleEntityNotFound(_0x207cb8,null))[_0x1a99('0x23')](function(_0x5ea892){if(_0x5ea892){return _0x5ea892[_0x1a99('0xca')](_0x512083[_0x1a99('0xbd')][_0x1a99('0xc3')],_[_0x1a99('0xc2')](_0x512083[_0x1a99('0xbd')],[_0x1a99('0xc3'),'id'])||{})[_0x1a99('0xcb')](function(){return db['Tag'][_0x1a99('0xc7')]({'attributes':['id','name',_0x1a99('0x49')],'where':{'id':_0x512083['body'][_0x1a99('0xc3')]}});})['then'](function(_0x49a6ce){socket[_0x1a99('0xcc')](_0x1a99('0xcd'),{'id':Number(_0x512083[_0x1a99('0xb7')]['id']),'tags':_0x49a6ce||[]});return{'id':Number(_0x512083[_0x1a99('0xb7')]['id']),'tags':_0x49a6ce||[]};});}})[_0x1a99('0x23')](respondWithResult(_0x207cb8,null))[_0x1a99('0xbb')](handleError(_0x207cb8,null));};exports[_0x1a99('0xce')]=function(_0x17de75,_0x2dbe32,_0x479dcd){return db[_0x1a99('0x30')][_0x1a99('0x5c')]({'where':{'id':_0x17de75[_0x1a99('0xb7')]['id']}})[_0x1a99('0x23')](handleEntityNotFound(_0x2dbe32,null))[_0x1a99('0x23')](function(_0x16a487){if(_0x16a487){return _0x16a487[_0x1a99('0xce')](_0x17de75[_0x1a99('0x3a')][_0x1a99('0xc3')]);}})[_0x1a99('0x23')](respondWithStatusCode(_0x2dbe32,null))['catch'](handleError(_0x2dbe32,null));};exports[_0x1a99('0xcf')]=function(_0xee1f0f,_0x139015){var _0x1ab6be=moment()['unix']()[_0x1a99('0x94')]();var _0x57601e=path[_0x1a99('0xd0')](config[_0x1a99('0xd1')],_0x1a99('0xd2'),_0x1a99('0xd3'),_0x1a99('0xd4'));var _0x8f4b=path[_0x1a99('0xd0')](config[_0x1a99('0xd1')],_0x1a99('0xd2'),'files',_0x1a99('0xd5'));var _0x537f10=path[_0x1a99('0xd0')](_0x57601e,_0x1ab6be);var _0x59f880=util['format'](_0x1a99('0xd6'),_0xee1f0f[_0x1a99('0xb7')]['id'],_0x1ab6be);var _0x5d0605=path[_0x1a99('0xd0')](_0x57601e,_0x59f880);var _0x2d50ff=[];if(_0xee1f0f[_0x1a99('0x3a')][_0x1a99('0xd5')]){_0x2d50ff['push']({'model':db[_0x1a99('0xd7')],'as':'Attachments','raw':!![]});}var _0x446b19=[{'model':db[_0x1a99('0xc0')],'as':_0x1a99('0xd8'),'attributes':['id',_0x1a99('0xbd'),_0x1a99('0x4d'),'to','cc',_0x1a99('0xd9'),_0x1a99('0xda'),_0x1a99('0x71')],'where':{'secret':![]},'order':qs[_0x1a99('0x44')]('id'),'include':_0x2d50ff}];return db[_0x1a99('0x30')][_0x1a99('0x5c')]({'where':{'id':_0xee1f0f[_0x1a99('0xb7')]['id']},'include':_0x446b19})[_0x1a99('0x23')](handleEntityNotFound(_0x139015,null))[_0x1a99('0x23')](function(_0x14aa56){if(_0x14aa56&&_0x14aa56[_0x1a99('0xd8')]){var _0x11b78c=_0x14aa56[_0x1a99('0xdb')]({'plain':!![]});fs['mkdirSync'](_0x537f10);return BPromise['each'](_0x11b78c['Messages'],function(_0x2e5627,_0x24bebf){var _0x5457cd={'from':_0x2e5627[_0x1a99('0x4d')],'to':_0x2e5627['to'],'subject':_0x2e5627['subject'],'html':_0x2e5627[_0x1a99('0xbd')],'headers':{'Date':moment(_0x2e5627[_0x1a99('0x71')])[_0x1a99('0xdc')](_0x1a99('0xdd'))},'attachments':[]};if(_0x2e5627['cc']){_0x5457cd[_0x1a99('0xde')]['Cc']=_0x2e5627['cc'];}if(_0x2e5627[_0x1a99('0xd9')]){_0x5457cd['headers'][_0x1a99('0xdf')]=_0x2e5627[_0x1a99('0xd9')];}return new BPromise(function(_0x4766e2,_0x368127){if(_0x2e5627['Attachments']){for(var _0x35d735=0x0;_0x35d735<_0x2e5627[_0x1a99('0xe0')][_0x1a99('0x5b')];_0x35d735++){var _0x2fb60d=_0x2e5627['Attachments'][_0x35d735];var _0x428033=path[_0x1a99('0xd0')](_0x8f4b,_0x2fb60d[_0x1a99('0xe1')]);if(fs[_0x1a99('0xe2')](_0x428033)){_0x5457cd[_0x1a99('0xd5')][_0x1a99('0x2f')]({'name':_0x2fb60d[_0x1a99('0x26')],'contentType':_0x2fb60d[_0x1a99('0x38')],'data':fs['readFileSync'](_0x428033)});}}}emlformat[_0x1a99('0xe3')](_0x5457cd,function(_0x295718,_0x2ab427){if(_0x295718)return _0x368127(_0x295718);fs[_0x1a99('0xe4')](path['join'](_0x537f10,util[_0x1a99('0xdc')](_0x1a99('0xe5'),_0x24bebf)),_0x2ab427);return _0x4766e2(_0x2ab427);});});})['then'](function(){return new BPromise(function(_0x3c929f,_0x453215){zipdir(_0x537f10,{'saveTo':_0x5d0605},function(_0x108dcc,_0x3a39ca){if(_0x108dcc)return _0x453215(_0x108dcc);return _0x3c929f(_0x3a39ca);});})[_0x1a99('0x23')](function(){return new BPromise(function(_0x3fb50e,_0x2be670){rimraf(_0x537f10,function(_0x1b98f8){if(_0x1b98f8)_0x2be670(_0x1b98f8);return _0x3fb50e();});});})[_0x1a99('0x23')](function(){return _0x139015[_0x1a99('0xcf')](_0x5d0605,_0x59f880,function(_0x3123cd){if(_0x3123cd){console['log']('err',_0x3123cd);}else{fs[_0x1a99('0xe6')](_0x5d0605);}});});});}else{return _0x139015[_0x1a99('0x24')](0xc8);}})[_0x1a99('0xbb')](handleError(_0x139015,null));}; \ No newline at end of file +var _0xf489=['include','options','create','body','params','describe','addMessage','MailMessage','omit','ids','getMessages','format','findAll','addTags','spread','removeTags','download','unix','join','root','server','files','attachments','Attachment','Attachments','Messages','subject','get','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','readFileSync','build','message%d.eml','log','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailInteraction.socket','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','Users','map','TagIds','Tags','forEach','push','findOne','lastMsgBody','lastMsgText','fromString','catch','index','MailInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','tools_tags','u.fullname','ui.MailInteractionId','from','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','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?','ContactId','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','UserId','buildExpression','some','MailAccountId','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','filter','replace','\x27\x27\x27\x27','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','i.MailAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','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','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','all','rows','show','includeAll'];(function(_0x2bd4de,_0x1dde2b){var _0x5a37e9=function(_0x3ddc7c){while(--_0x3ddc7c){_0x2bd4de['push'](_0x2bd4de['shift']());}};_0x5a37e9(++_0x1dde2b);}(_0xf489,0x114));var _0x9f48=function(_0x35cda2,_0x5f20f9){_0x35cda2=_0x35cda2-0x0;var _0x89f083=_0xf489[_0x35cda2];return _0x89f083;};'use strict';var pdf=require(_0x9f48('0x0'));var emlformat=require(_0x9f48('0x1'));var rimraf=require(_0x9f48('0x2'));var zipdir=require(_0x9f48('0x3'));var jsonpatch=require(_0x9f48('0x4'));var rp=require(_0x9f48('0x5'));var moment=require('moment');var BPromise=require(_0x9f48('0x6'));var Mustache=require(_0x9f48('0x7'));var util=require(_0x9f48('0x8'));var path=require(_0x9f48('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9f48('0xa'));var fs=require('fs');var _=require(_0x9f48('0xb'));var squel=require(_0x9f48('0xc'));var crypto=require(_0x9f48('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9f48('0xe'));var querystring=require(_0x9f48('0xf'));var Papa=require(_0x9f48('0x10'));var htmlToText=require(_0x9f48('0x11'));var Redis=require(_0x9f48('0x12'));var authService=require(_0x9f48('0x13'));var qs=require(_0x9f48('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f48('0x15'))(_0x9f48('0x16'));var utils=require(_0x9f48('0x17'));var config=require(_0x9f48('0x18'));var db=require(_0x9f48('0x19'))['db'];config[_0x9f48('0x1a')]=_['defaults'](config[_0x9f48('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x9f48('0x1b'))(new Redis(config[_0x9f48('0x1a')]));require(_0x9f48('0x1c'))['register'](socket);function respondWithStatusCode(_0x348a0b,_0x3b8c6){_0x3b8c6=_0x3b8c6||0xcc;return function(_0xab2b50){if(_0xab2b50){return _0x348a0b['sendStatus'](_0x3b8c6);}return _0x348a0b['status'](_0x3b8c6)[_0x9f48('0x1d')]();};}function respondWithResult(_0x57332d,_0x220595){_0x220595=_0x220595||0xc8;return function(_0x313ed4){if(_0x313ed4){return _0x57332d[_0x9f48('0x1e')](_0x220595)[_0x9f48('0x1f')](_0x313ed4);}};}function respondWithFilteredResult(_0x439156,_0x28a7ee){return function(_0x3bcc07){if(_0x3bcc07){var _0x2aee43=_0x3bcc07[_0x9f48('0x20')],_0x822089=_0x28a7ee[_0x9f48('0x21')],_0x2b7b27=_0x28a7ee['offset']+_0x28a7ee[_0x9f48('0x22')],_0x107094;if(_0x2b7b27>=_0x2aee43){_0x2b7b27=_0x2aee43;_0x107094=0xc8;}else{_0x107094=0xce;}_0x439156[_0x9f48('0x1e')](_0x107094);return _0x439156[_0x9f48('0x23')](_0x9f48('0x24'),_0x822089+'-'+_0x2b7b27+'/'+_0x2aee43)[_0x9f48('0x1f')](_0x3bcc07);}return null;};}function patchUpdates(_0x3df6a1){return function(_0x3cb1ef){try{jsonpatch[_0x9f48('0x25')](_0x3cb1ef,_0x3df6a1,!![]);}catch(_0x5edf09){return BPromise[_0x9f48('0x26')](_0x5edf09);}return _0x3cb1ef[_0x9f48('0x27')]();};}function saveUpdates(_0x263293,_0x5d7bfd){return function(_0x3dfa13){if(_0x3dfa13){return _0x3dfa13[_0x9f48('0x28')](_0x263293)[_0x9f48('0x29')](function(_0x31a243){return _0x31a243;});}return null;};}function removeEntity(_0x5e4d15,_0x5a8d7e){return function(_0x22bf96){if(_0x22bf96){return _0x22bf96['destroy']()[_0x9f48('0x29')](function(){_0x5e4d15[_0x9f48('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbe4068,_0x74c339){return function(_0xfa60b){if(!_0xfa60b){_0xbe4068[_0x9f48('0x2a')](0x194);}return _0xfa60b;};}function handleError(_0x178275,_0x2eba3b){_0x2eba3b=_0x2eba3b||0x1f4;return function(_0x2e7c1c){logger['error'](_0x2e7c1c[_0x9f48('0x2b')]);if(_0x2e7c1c['name']){delete _0x2e7c1c[_0x9f48('0x2c')];}_0x178275[_0x9f48('0x1e')](_0x2eba3b)['send'](_0x2e7c1c);};}function getInteractionUsers(_0x1f5893,_0x41d48f){return new BPromise(function(_0x372617,_0x23aed0){try{if(_0x41d48f[_0x1f5893['id']]){_0x1f5893[_0x9f48('0x2d')]=_[_0x9f48('0x2e')](_0x41d48f[_0x1f5893['id']],function(_0x34a8cb){return{'id':_0x34a8cb['id'],'fullname':_0x34a8cb['fullname']};});}}catch(_0x3d7e1f){_0x23aed0(_0x3d7e1f);}_0x372617(_0x1f5893);});}function getInteractionTags(_0x5b3a0f,_0x46200){return new BPromise(function(_0x5c6828,_0x31e9e8){try{if(_0x5b3a0f[_0x9f48('0x2f')]){_0x5b3a0f[_0x9f48('0x30')]=[];_0x5b3a0f[_0x9f48('0x2f')]['split'](',')[_0x9f48('0x31')](function(_0x72db04){_0x5b3a0f[_0x9f48('0x30')][_0x9f48('0x32')](_0x46200[_0x72db04]);});}delete _0x5b3a0f[_0x9f48('0x2f')];}catch(_0x551fbe){_0x31e9e8(_0x551fbe);}_0x5c6828(_0x5b3a0f);});}function getLastMessageText(_0x38ba32){return new BPromise(function(_0xd37c2b,_0x14e5e4){return db['MailInteraction'][_0x9f48('0x33')]({'where':{'id':_0x38ba32['id']},'attributes':[_0x9f48('0x34'),_0x9f48('0x35')],'raw':!![]})[_0x9f48('0x29')](function(_0x2784f6){if(!_0x2784f6['lastMsgText']){_0x38ba32[_0x9f48('0x35')]=_['trimStart'](htmlToText[_0x9f48('0x36')](_0x2784f6[_0x9f48('0x34')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x38ba32[_0x9f48('0x35')]=_0x2784f6[_0x9f48('0x35')];}_0xd37c2b(_0x38ba32);})[_0x9f48('0x37')](function(_0x3eec5c){_0x14e5e4(_0x3eec5c);});});}function updateMailInteraction(_0x49d250,_0x4a16c2,_0x347040,_0x29192d){return new BPromise(function(_0x32d2f5,_0x3b076a){return getInteractionUsers(_0x49d250,_0x347040)['then'](function(_0x100d51){return getInteractionTags(_0x100d51,_0x4a16c2);})[_0x9f48('0x29')](function(_0x4fb886){if(_0x29192d){_0x32d2f5(getLastMessageText(_0x4fb886));}else{_0x32d2f5(_0x4fb886);}})[_0x9f48('0x37')](function(_0xcdf984){_0x3b076a(_0xcdf984);});});}exports[_0x9f48('0x38')]=function(_0x3c4d16,_0x3c76b8){var _0x33f3c4={},_0x21d46f={},_0x133169={'count':0x0,'rows':[]};var _0x3dabda=_[_0x9f48('0x2e')](db[_0x9f48('0x39')][_0x9f48('0x3a')],function(_0xeb8434){return{'name':_0xeb8434[_0x9f48('0x3b')],'type':_0xeb8434['type'][_0x9f48('0x3c')]};});_0x21d46f[_0x9f48('0x3d')]=_[_0x9f48('0x2e')](_0x3dabda,_0x9f48('0x2c'));_0x21d46f[_0x9f48('0x3e')]=_[_0x9f48('0x3f')](_0x3c4d16[_0x9f48('0x3e')]);_0x21d46f[_0x9f48('0x40')]=_[_0x9f48('0x41')](_0x21d46f[_0x9f48('0x3d')],_0x21d46f[_0x9f48('0x3e')]);_0x33f3c4[_0x9f48('0x42')]=_[_0x9f48('0x41')](_0x21d46f[_0x9f48('0x3d')],qs[_0x9f48('0x43')](_0x3c4d16[_0x9f48('0x3e')]['fields']));_0x33f3c4[_0x9f48('0x42')]=_0x33f3c4[_0x9f48('0x42')][_0x9f48('0x44')]?_0x33f3c4['attributes']:_0x21d46f[_0x9f48('0x3d')];if(!_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x45')](_0x9f48('0x46'))){_0x33f3c4[_0x9f48('0x22')]=qs[_0x9f48('0x22')](_0x3c4d16['query'][_0x9f48('0x22')]);_0x33f3c4['offset']=qs['offset'](_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x21')]);}_0x33f3c4[_0x9f48('0x47')]=qs[_0x9f48('0x48')](_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x48')]);_0x33f3c4[_0x9f48('0x49')]=qs[_0x9f48('0x40')](_[_0x9f48('0x4a')](_0x3c4d16[_0x9f48('0x3e')],_0x21d46f['filters']));var _0x7f1c17=[];var _0xa6351e=squel[_0x9f48('0x4b')]()[_0x9f48('0x4c')]('id')['field']('name')[_0x9f48('0x4c')](_0x9f48('0x4d'))['from'](_0x9f48('0x4e'));var _0x564128=squel['select']()[_0x9f48('0x4c')]('u.id')['field'](_0x9f48('0x4f'))['field'](_0x9f48('0x50'))[_0x9f48('0x51')]('user_has_mail_interactions','ui')[_0x9f48('0x52')]('users','u','u.id\x20=\x20ui.UserId');var _0xdb38d4=squel['select']()['from']('mail_interactions','i')[_0x9f48('0x52')](_0x9f48('0x53'),'c',_0x9f48('0x54'))[_0x9f48('0x52')](_0x9f48('0x55'),'o','o.id\x20=\x20i.UserId')[_0x9f48('0x52')](_0x9f48('0x56'),'a',_0x9f48('0x57'))['left_join'](_0x9f48('0x58'),'me',_0x9f48('0x59'))['left_join'](_0x9f48('0x5a'),'it',_0x9f48('0x5b'))[_0x9f48('0x52')](_0x9f48('0x4e'),'t','t.id\x20=\x20it.TagId');var _0x542113=squel[_0x9f48('0x5c')]();var _0x235830=[];var _0x28f965=squel['expr']();var _0x145c17;if(_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x5d')]){_0x145c17=as[_0x9f48('0x5e')](_0x3c4d16['query'][_0x9f48('0x5d')]);var _0x17d030=_0x145c17[_0x9f48('0x5f')];for(var _0x16bf15=0x0;_0x16bf15<_0x145c17[_0x9f48('0x60')][_0x9f48('0x44')];_0x16bf15++){var _0x5d2f06=_0x145c17[_0x9f48('0x60')][_0x16bf15];var _0xaa708e='i';var _0x155515=_[_0x9f48('0x61')](_0x3dabda,[_0x9f48('0x2c'),_0x5d2f06[_0x9f48('0x4c')]]);if(!_0x155515){switch(_0x5d2f06['field']){case _0x9f48('0x62'):if(_0x5d2f06[_0x9f48('0x63')]==0x1){_0xdb38d4['having']('`'+_0x5d2f06[_0x9f48('0x4c')]+'`\x20=\x200');}else{_0xdb38d4[_0x9f48('0x64')]('`'+_0x5d2f06[_0x9f48('0x4c')]+_0x9f48('0x65'));}break;case _0x9f48('0x66'):if(_0x5d2f06['operator']===_0x9f48('0x67')){if(_0x5d2f06[_0x9f48('0x63')][_0x9f48('0x68')]('\x20')[_0x9f48('0x44')]>0x1){_0x542113[_0x17d030](_0x9f48('0x69'),qs[_0x9f48('0x6a')](_0x5d2f06[_0x9f48('0x63')]),null);}else{var _0x4b237d='%'+_0x5d2f06[_0x9f48('0x63')]+'%';_0x542113[_0x17d030](_0x9f48('0x6b'),_0x4b237d,_0x4b237d,_0x4b237d);}}else{_0x155515=_[_0x9f48('0x61')](_0x3dabda,['name',_0x9f48('0x6c')]);_0x5d2f06[_0x9f48('0x4c')]=_0x9f48('0x6c');_0x39c7bc=as['buildExpression'](_0xaa708e,_0x155515[_0x9f48('0x6d')],_0x5d2f06);_0x542113[_0x17d030](_0x39c7bc[_0x9f48('0x6e')],_0x39c7bc[_0x9f48('0x63')][_0x9f48('0x6f')],_0x39c7bc['value'][_0x9f48('0x1d')]);}break;case _0x9f48('0x70'):var _0x3a60cc=_0x5d2f06[_0x9f48('0x63')][_0x9f48('0x68')](',')[_0x9f48('0x2e')](function(_0x4c65d7){return Number(_0x4c65d7);});_0x3a60cc[_0x9f48('0x31')](function(_0x7ed951){_0x28f965['or'](_0x9f48('0x71'),'%,'+_0x7ed951+',%');});_0x235830=_[_0x9f48('0x72')](_0x235830,_0x3a60cc);break;case'User':if(_0x5d2f06[_0x9f48('0x73')]===_0x9f48('0x67')){_0x542113[_0x17d030]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5d2f06[_0x9f48('0x63')]+'%',null);}else{_0x155515=_[_0x9f48('0x61')](_0x3dabda,['name',_0x9f48('0x74')]);_0x5d2f06[_0x9f48('0x4c')]=_0x9f48('0x74');_0x39c7bc=as[_0x9f48('0x75')](_0xaa708e,_0x155515['type'],_0x5d2f06);_0x542113[_0x17d030](_0x39c7bc[_0x9f48('0x6e')],_0x39c7bc[_0x9f48('0x63')][_0x9f48('0x6f')],_0x39c7bc[_0x9f48('0x63')]['end']);}break;case'plainBody':_0x39c7bc=as['buildExpression']('me',null,_0x5d2f06);_0x542113[_0x17d030](_0x39c7bc['text'],_0x39c7bc[_0x9f48('0x63')][_0x9f48('0x6f')],_0x39c7bc[_0x9f48('0x63')]['end']);break;}}else{var _0x39c7bc=as['buildExpression'](_0xaa708e,_0x155515['type'],_0x5d2f06);_0x542113[_0x17d030](_0x39c7bc[_0x9f48('0x6e')],_0x39c7bc[_0x9f48('0x63')]['start'],_0x39c7bc['value'][_0x9f48('0x1d')]);}}}else{var _0x1a7a16=_(_0x3c4d16['query'])[_0x9f48('0x3f')]()[_0x9f48('0x2e')](function(_0xd0482e){return _[_0x9f48('0x76')](_0x3dabda,[_0x9f48('0x2c'),_0xd0482e])?_0xd0482e:undefined;})['compact']()[_0x9f48('0x63')]();if(!_['isEmpty'](_0x1a7a16)){_0x1a7a16[_0x9f48('0x31')](function(_0x409ace){if(_0x409ace===_0x9f48('0x77')){_0xdb38d4[_0x9f48('0x49')]('i.MailAccountId\x20IN\x20?',[][_0x9f48('0x78')](_0x3c4d16['query'][_0x409ace]));}else if(_0x409ace===_0x9f48('0x79')){var _0x558fc9=JSON[_0x9f48('0x7a')](_0x3c4d16[_0x9f48('0x3e')][_0x409ace])[_0x9f48('0x7b')];var _0x51f7bc=JSON[_0x9f48('0x7a')](_0x3c4d16['query'][_0x409ace])[_0x9f48('0x7c')];_0xdb38d4['where'](_0x9f48('0x7d'),_0x558fc9,_0x51f7bc);}else{if(_0x3c4d16[_0x9f48('0x3e')][_0x409ace]==='null'){_0xdb38d4[_0x9f48('0x49')]('i.'+_0x409ace+_0x9f48('0x7e'));}else{_0xdb38d4[_0x9f48('0x49')]('i.'+_0x409ace+'\x20=\x20?',_0x3c4d16[_0x9f48('0x3e')][_0x409ace]);}}});}if(_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x7f')]){if(_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x7f')]==0x1){_0xdb38d4[_0x9f48('0x64')]('`unreadMessages`\x20=\x200');}else{_0xdb38d4[_0x9f48('0x64')](_0x9f48('0x80'));}}if(_0x3c4d16[_0x9f48('0x3e')]['tag']){_0x235830=_['isArray'](_0x3c4d16['query'][_0x9f48('0x81')])?_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x81')]:new Array(_0x3c4d16['query'][_0x9f48('0x81')]);_0x235830[_0x9f48('0x31')](function(_0x29fd48){_0x28f965['or'](_0x9f48('0x71'),'%,'+_0x29fd48+',%');});}if(_0x3c4d16['query'][_0x9f48('0x82')]){var _0x10b5e3=_0x3c4d16['query']['filter']['replace']('\x5c','\x5c\x5c')[_0x9f48('0x83')]('\x27\x27',_0x9f48('0x84'));if(qs['isNumeric'](_0x10b5e3)){_0x542113['or']('i.id\x20LIKE\x20?',_0x10b5e3+'%');}else if(qs[_0x9f48('0x85')](_0x10b5e3)){_0x542113['or'](_0x9f48('0x86'),_0x10b5e3+'%');}else{_0x542113['or'](_0x9f48('0x87'),qs[_0x9f48('0x6a')](_0x10b5e3))['or'](_0x9f48('0x88'),qs[_0x9f48('0x6a')](_0x10b5e3));}}}_0xdb38d4[_0x9f48('0x49')](_0x542113);_0xdb38d4[_0x9f48('0x89')]('i.id');var _0x3e10ba={'type':db[_0x9f48('0x8a')][_0x9f48('0x8b')][_0x9f48('0x8c')],'raw':!![]};var _0x4b275b=_0xdb38d4[_0x9f48('0x8d')]();_0x4b275b[_0x9f48('0x4c')](_0x9f48('0x8e'));_0x4b275b[_0x9f48('0x4c')](_0x9f48('0x8f'),'unreadMessages');if(_0x33f3c4['order']){_0x33f3c4[_0x9f48('0x47')][_0x9f48('0x31')](function(_0x1e1f00){_0xdb38d4[_0x9f48('0x47')]('i.'+_0x1e1f00[0x0],_0x1e1f00[0x1]===_0x9f48('0x90')?![]:!![]);});}if(!_[_0x9f48('0x91')](_0x235830)){_0xdb38d4[_0x9f48('0x64')](_0x28f965);_0x4b275b[_0x9f48('0x49')](_0x9f48('0x92'),_0x235830);}BPromise[_0x9f48('0x93')]()[_0x9f48('0x29')](function(){if(!_0x145c17){if(_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x77')]||_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x94')])return;_0x4b275b[_0x9f48('0x49')](_0x9f48('0x95'));_0xdb38d4['where'](_0x9f48('0x95'));return;}return _0x3c4d16[_0x9f48('0x96')][_0x9f48('0x97')]({'attributes':['id'],'raw':!![]})[_0x9f48('0x29')](function(_0x4105de){if(_['isEmpty'](_0x4105de)){_0x4b275b[_0x9f48('0x49')]('i.MailAccountId\x20IS\x20NULL');_0xdb38d4[_0x9f48('0x49')](_0x9f48('0x98'));}else{_0x4b275b[_0x9f48('0x49')](_0x9f48('0x99'),_[_0x9f48('0x2e')](_0x4105de,'id'));_0xdb38d4[_0x9f48('0x49')](_0x9f48('0x99'),_[_0x9f48('0x2e')](_0x4105de,'id'));}});})[_0x9f48('0x29')](function(){db[_0x9f48('0x9a')][_0x9f48('0x3e')](_0x4b275b[_0x9f48('0x9b')](),_0x3e10ba)['then'](function(_0x4f9f20){_0x133169[_0x9f48('0x20')]=_0x4f9f20[_0x9f48('0x44')];if(_0x133169[_0x9f48('0x20')]===0x0)return[];return db[_0x9f48('0x9a')][_0x9f48('0x3e')](_0xa6351e[_0x9f48('0x9b')](),_0x3e10ba)[_0x9f48('0x29')](function(_0x4cda62){_0x7f1c17=_[_0x9f48('0x9c')](_0x4cda62,'id');_0x3e10ba=_[_0x9f48('0x9d')](_0x3e10ba,{'model':db[_0x9f48('0x39')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c4d16[_0x9f48('0x3e')][_0x9f48('0x43')]){_0x33f3c4[_0x9f48('0x42')]['forEach'](function(_0x5d547e){_0xdb38d4[_0x9f48('0x4c')]('i.'+_0x5d547e);});}else{_0xdb38d4['field'](_0x9f48('0x8f'),_0x9f48('0x62'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0x9e'),_0x9f48('0x9f'));_0xdb38d4[_0x9f48('0x4c')]('a.mandatoryDisposition',_0x9f48('0xa0'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0x8e'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa1'));_0xdb38d4['field'](_0x9f48('0xa2'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa3'));_0xdb38d4[_0x9f48('0x4c')]('i.closedAt');_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa4'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa5'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa6'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa7'));_0xdb38d4[_0x9f48('0x4c')]('i.disposition');_0xdb38d4['field'](_0x9f48('0xa8'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xa9'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xaa'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xab'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xac'));_0xdb38d4['field'](_0x9f48('0xad'),_0x9f48('0xae'));_0xdb38d4['field'](_0x9f48('0xaf'),_0x9f48('0xb0'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xb1'),_0x9f48('0xb2'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xb3'),_0x9f48('0xb4'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xb5'),_0x9f48('0xb6'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xb7'),_0x9f48('0xb8'));_0xdb38d4[_0x9f48('0x4c')]('o.fullname',_0x9f48('0xb9'));_0xdb38d4[_0x9f48('0x4c')](_0x9f48('0xba'),_0x9f48('0xbb'));_0xdb38d4['field'](_0x9f48('0xbc'),_0x9f48('0x2f'));}_0xdb38d4[_0x9f48('0x22')](_0x33f3c4['limit']);_0xdb38d4[_0x9f48('0x21')](_0x33f3c4[_0x9f48('0x21')]);return db[_0x9f48('0x9a')][_0x9f48('0x3e')](_0xdb38d4['toString'](),_0x3e10ba);})[_0x9f48('0x29')](function(_0x488f8a){_0x564128[_0x9f48('0x49')](_0x9f48('0xbd'),_[_0x9f48('0x2e')](_0x488f8a,'id'));return db[_0x9f48('0x9a')][_0x9f48('0x3e')](_0x564128[_0x9f48('0x9b')](),_0x3e10ba)[_0x9f48('0x29')](function(_0x1a0c86){var _0x58a3c6=_[_0x9f48('0xbe')](_0x1a0c86,_0x9f48('0xbf'));var _0x60c7f2=[];return db[_0x9f48('0xc0')][_0x9f48('0x33')]({'attributes':[_0x9f48('0xc1')],'raw':!![]})[_0x9f48('0x29')](function(_0x5db1af){var _0x43e692=_0x5db1af[_0x9f48('0xc1')];_0x488f8a[_0x9f48('0x31')](function(_0x2d8e64){_0x60c7f2[_0x9f48('0x32')](updateMailInteraction(_0x2d8e64,_0x7f1c17,_0x58a3c6,_0x43e692));});return BPromise[_0x9f48('0xc2')](_0x60c7f2);});});});})[_0x9f48('0x29')](function(_0x272847){_0x133169[_0x9f48('0xc3')]=_0x272847;return _0x133169;})[_0x9f48('0x29')](respondWithFilteredResult(_0x3c76b8,_0x33f3c4));})['catch'](handleError(_0x3c76b8,null));};exports[_0x9f48('0xc4')]=function(_0x391275,_0x24eb39){var _0x12398d={'raw':![],'where':{'id':_0x391275['params']['id']}},_0x1276f0={};_0x1276f0['model']=_['keys'](db[_0x9f48('0x39')][_0x9f48('0x3a')]);_0x1276f0[_0x9f48('0x3e')]=_[_0x9f48('0x3f')](_0x391275[_0x9f48('0x3e')]);_0x1276f0[_0x9f48('0x40')]=_[_0x9f48('0x41')](_0x1276f0[_0x9f48('0x3d')],_0x1276f0[_0x9f48('0x3e')]);_0x12398d[_0x9f48('0x42')]=_[_0x9f48('0x41')](_0x1276f0[_0x9f48('0x3d')],qs[_0x9f48('0x43')](_0x391275['query'][_0x9f48('0x43')]));_0x12398d['attributes']=_0x12398d[_0x9f48('0x42')][_0x9f48('0x44')]?_0x12398d[_0x9f48('0x42')]:_0x1276f0[_0x9f48('0x3d')];if(_0x391275[_0x9f48('0x3e')][_0x9f48('0xc5')]){_0x12398d[_0x9f48('0xc6')]=[{'all':!![]}];}_0x12398d=_['merge']({},_0x12398d,_0x391275[_0x9f48('0xc7')]);return db[_0x9f48('0x39')][_0x9f48('0x61')](_0x12398d)[_0x9f48('0x29')](handleEntityNotFound(_0x24eb39,null))[_0x9f48('0x29')](respondWithResult(_0x24eb39,null))[_0x9f48('0x37')](handleError(_0x24eb39,null));};exports[_0x9f48('0xc8')]=function(_0x970c11,_0x399ae8){return db[_0x9f48('0x39')]['create'](_0x970c11['body'],{})[_0x9f48('0x29')](respondWithResult(_0x399ae8,0xc9))[_0x9f48('0x37')](handleError(_0x399ae8,null));};exports['update']=function(_0x2780af,_0xa3a082){if(_0x2780af['body']['id']){delete _0x2780af[_0x9f48('0xc9')]['id'];}return db[_0x9f48('0x39')][_0x9f48('0x61')]({'where':{'id':_0x2780af[_0x9f48('0xca')]['id']}})[_0x9f48('0x29')](handleEntityNotFound(_0xa3a082,null))[_0x9f48('0x29')](saveUpdates(_0x2780af['body'],null))['then'](respondWithResult(_0xa3a082,null))[_0x9f48('0x37')](handleError(_0xa3a082,null));};exports['destroy']=function(_0x5247f2,_0x329fd1){return db[_0x9f48('0x39')]['find']({'where':{'id':_0x5247f2['params']['id']}})[_0x9f48('0x29')](handleEntityNotFound(_0x329fd1,null))['then'](removeEntity(_0x329fd1,null))[_0x9f48('0x37')](handleError(_0x329fd1,null));};exports['describe']=function(_0x5a096c,_0x2512c){return db['MailInteraction'][_0x9f48('0xcb')]()[_0x9f48('0x29')](respondWithResult(_0x2512c,null))[_0x9f48('0x37')](handleError(_0x2512c,null));};exports[_0x9f48('0xcc')]=function(_0x3e69a0,_0x4b35c3,_0x441c71){return db[_0x9f48('0xcd')][_0x9f48('0x61')]({'where':{'id':_0x3e69a0['params']['id']}})[_0x9f48('0x29')](handleEntityNotFound(_0x4b35c3,null))[_0x9f48('0x29')](function(_0x3ae44a){if(_0x3ae44a){return _0x3ae44a['addMessage'](_0x3e69a0[_0x9f48('0xc9')]['ids'],_[_0x9f48('0xce')](_0x3e69a0['body'],[_0x9f48('0xcf'),'id'])||{});}})['then'](respondWithResult(_0x4b35c3,null))[_0x9f48('0x37')](handleError(_0x4b35c3,null));};exports[_0x9f48('0xd0')]=function(_0x4aa5ca,_0x14e7fd,_0xf7029b){var _0x55160b={'raw':![],'where':{}};var _0x27d036={};var _0x16acbe={'count':0x0,'rows':[]};return db[_0x9f48('0x39')][_0x9f48('0x33')]({'where':{'id':_0x4aa5ca[_0x9f48('0xca')]['id']}})['then'](handleEntityNotFound(_0x14e7fd,null))[_0x9f48('0x29')](function(_0x2691e1){if(_0x2691e1){_0x27d036[_0x9f48('0x3d')]=_[_0x9f48('0x3f')](db[_0x9f48('0xcd')][_0x9f48('0x3a')]);_0x27d036['query']=_[_0x9f48('0x3f')](_0x4aa5ca[_0x9f48('0x3e')]);_0x27d036[_0x9f48('0x40')]=_[_0x9f48('0x41')](_0x27d036[_0x9f48('0x3d')],_0x27d036[_0x9f48('0x3e')]);_0x55160b[_0x9f48('0x42')]=_[_0x9f48('0x41')](_0x27d036[_0x9f48('0x3d')],qs['fields'](_0x4aa5ca[_0x9f48('0x3e')][_0x9f48('0x43')]));_0x55160b['attributes']=_0x55160b['attributes'][_0x9f48('0x44')]?_0x55160b[_0x9f48('0x42')]:_0x27d036['model'];if(!_0x4aa5ca[_0x9f48('0x3e')]['hasOwnProperty'](_0x9f48('0x46'))){_0x55160b[_0x9f48('0x22')]=qs['limit'](_0x4aa5ca[_0x9f48('0x3e')][_0x9f48('0x22')]);_0x55160b[_0x9f48('0x21')]=qs[_0x9f48('0x21')](_0x4aa5ca[_0x9f48('0x3e')][_0x9f48('0x21')]);}_0x55160b[_0x9f48('0x47')]=qs['sort'](_0x4aa5ca[_0x9f48('0x3e')]['sort']);_0x55160b[_0x9f48('0x49')]=qs[_0x9f48('0x40')](_[_0x9f48('0x4a')](_0x4aa5ca['query'],_0x27d036[_0x9f48('0x40')]));_0x55160b[_0x9f48('0x49')][_0x9f48('0xbf')]=_0x2691e1['id'];if(_0x4aa5ca[_0x9f48('0x3e')][_0x9f48('0x82')]){_0x55160b[_0x9f48('0x49')]=_[_0x9f48('0x9d')](_0x55160b['where'],{'$or':_[_0x9f48('0x2e')](_0x55160b[_0x9f48('0x42')],function(_0x4898d3){var _0x8e20c5={};_0x8e20c5[_0x4898d3]={'$like':'%'+_0x4aa5ca['query'][_0x9f48('0x82')]+'%'};return _0x8e20c5;})});}if(_0x4aa5ca['query']['$gte']){var _0x3233fb=_0x4aa5ca[_0x9f48('0x3e')]['$gte']['split'](',');var _0x18703a={};_0x18703a[_0x3233fb[0x0]]={'$gte':moment(_0x3233fb[0x1])[_0x9f48('0xd1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x55160b[_0x9f48('0x49')]=_[_0x9f48('0x9d')](_0x55160b['where'],_0x18703a);}_0x55160b=_[_0x9f48('0x9d')]({},_0x55160b,_0x4aa5ca[_0x9f48('0xc7')]);return db[_0x9f48('0xcd')][_0x9f48('0x20')]({'where':_0x55160b[_0x9f48('0x49')]})[_0x9f48('0x29')](function(_0x285719){_0x16acbe['count']=_0x285719;if(_0x4aa5ca[_0x9f48('0x3e')][_0x9f48('0xc5')]){_0x55160b[_0x9f48('0xc6')]=[{'all':!![]}];}return db[_0x9f48('0xcd')][_0x9f48('0xd2')](_0x55160b);})[_0x9f48('0x29')](function(_0x46c001){_0x16acbe['rows']=_0x46c001;return _0x16acbe;});}})['then'](respondWithFilteredResult(_0x14e7fd,_0x55160b))[_0x9f48('0x37')](handleError(_0x14e7fd,null));};exports[_0x9f48('0xd3')]=function(_0x519a88,_0x271f6a,_0x2963f9){return db[_0x9f48('0x39')][_0x9f48('0x61')]({'where':{'id':_0x519a88[_0x9f48('0xca')]['id']}})[_0x9f48('0x29')](handleEntityNotFound(_0x271f6a,null))[_0x9f48('0x29')](function(_0xdfefe8){if(_0xdfefe8){return _0xdfefe8['setTags'](_0x519a88[_0x9f48('0xc9')][_0x9f48('0xcf')],_[_0x9f48('0xce')](_0x519a88[_0x9f48('0xc9')],['ids','id'])||{})[_0x9f48('0xd4')](function(){return db[_0x9f48('0x70')][_0x9f48('0xd2')]({'attributes':['id','name',_0x9f48('0x4d')],'where':{'id':_0x519a88[_0x9f48('0xc9')][_0x9f48('0xcf')]}});})[_0x9f48('0x29')](function(_0x3ce9c1){socket['emit']('mailInteractionTags:save',{'id':Number(_0x519a88[_0x9f48('0xca')]['id']),'tags':_0x3ce9c1||[]});return{'id':Number(_0x519a88[_0x9f48('0xca')]['id']),'tags':_0x3ce9c1||[]};});}})[_0x9f48('0x29')](respondWithResult(_0x271f6a,null))['catch'](handleError(_0x271f6a,null));};exports[_0x9f48('0xd5')]=function(_0xfae03,_0x1b511c,_0x102f6e){return db[_0x9f48('0x39')]['find']({'where':{'id':_0xfae03['params']['id']}})[_0x9f48('0x29')](handleEntityNotFound(_0x1b511c,null))[_0x9f48('0x29')](function(_0x4dace4){if(_0x4dace4){return _0x4dace4[_0x9f48('0xd5')](_0xfae03[_0x9f48('0x3e')][_0x9f48('0xcf')]);}})['then'](respondWithStatusCode(_0x1b511c,null))['catch'](handleError(_0x1b511c,null));};exports[_0x9f48('0xd6')]=function(_0x4617d5,_0x466475){var _0x88fca5=moment()[_0x9f48('0xd7')]()[_0x9f48('0x9b')]();var _0x545e6c=path[_0x9f48('0xd8')](config[_0x9f48('0xd9')],_0x9f48('0xda'),_0x9f48('0xdb'),'tmp');var _0x3f6893=path[_0x9f48('0xd8')](config[_0x9f48('0xd9')],_0x9f48('0xda'),'files',_0x9f48('0xdc'));var _0x412ee4=path[_0x9f48('0xd8')](_0x545e6c,_0x88fca5);var _0x2699bc=util[_0x9f48('0xd1')]('transcript-%d-%s.zip',_0x4617d5['params']['id'],_0x88fca5);var _0x42ecb9=path[_0x9f48('0xd8')](_0x545e6c,_0x2699bc);var _0x5a690f=[];if(_0x4617d5[_0x9f48('0x3e')]['attachments']){_0x5a690f[_0x9f48('0x32')]({'model':db[_0x9f48('0xdd')],'as':_0x9f48('0xde'),'raw':!![]});}var _0x38e67c=[{'model':db['MailMessage'],'as':_0x9f48('0xdf'),'attributes':['id',_0x9f48('0xc9'),'from','to','cc','bcc',_0x9f48('0xe0'),_0x9f48('0x79')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x5a690f}];return db[_0x9f48('0x39')]['find']({'where':{'id':_0x4617d5[_0x9f48('0xca')]['id']},'include':_0x38e67c})[_0x9f48('0x29')](handleEntityNotFound(_0x466475,null))[_0x9f48('0x29')](function(_0x600cd2){if(_0x600cd2&&_0x600cd2[_0x9f48('0xdf')]){var _0x26bec1=_0x600cd2[_0x9f48('0xe1')]({'plain':!![]});fs[_0x9f48('0xe2')](_0x412ee4);return BPromise['each'](_0x26bec1['Messages'],function(_0x370729,_0x1e3957){var _0x351858={'from':_0x370729[_0x9f48('0x51')],'to':_0x370729['to'],'subject':_0x370729[_0x9f48('0xe0')],'html':_0x370729[_0x9f48('0xc9')],'headers':{'Date':moment(_0x370729[_0x9f48('0x79')])['format'](_0x9f48('0xe3'))},'attachments':[]};if(_0x370729['cc']){_0x351858[_0x9f48('0xe4')]['Cc']=_0x370729['cc'];}if(_0x370729[_0x9f48('0xe5')]){_0x351858[_0x9f48('0xe4')][_0x9f48('0xe6')]=_0x370729[_0x9f48('0xe5')];}return new BPromise(function(_0x3c7365,_0x173846){if(_0x370729[_0x9f48('0xde')]){for(var _0xf801da=0x0;_0xf801da<_0x370729['Attachments'][_0x9f48('0x44')];_0xf801da++){var _0x225b17=_0x370729[_0x9f48('0xde')][_0xf801da];var _0x4b3550=path['join'](_0x3f6893,_0x225b17[_0x9f48('0xe7')]);if(fs['existsSync'](_0x4b3550)){_0x351858[_0x9f48('0xdc')]['push']({'name':_0x225b17[_0x9f48('0x2c')],'contentType':_0x225b17[_0x9f48('0x6d')],'data':fs[_0x9f48('0xe8')](_0x4b3550)});}}}emlformat[_0x9f48('0xe9')](_0x351858,function(_0x1d2970,_0x2d8ee2){if(_0x1d2970)return _0x173846(_0x1d2970);fs['writeFileSync'](path[_0x9f48('0xd8')](_0x412ee4,util['format'](_0x9f48('0xea'),_0x1e3957)),_0x2d8ee2);return _0x3c7365(_0x2d8ee2);});});})[_0x9f48('0x29')](function(){return new BPromise(function(_0x5e9c26,_0x2845e1){zipdir(_0x412ee4,{'saveTo':_0x42ecb9},function(_0xc02a87,_0x1d755e){if(_0xc02a87)return _0x2845e1(_0xc02a87);return _0x5e9c26(_0x1d755e);});})[_0x9f48('0x29')](function(){return new BPromise(function(_0x487c99,_0x39a442){rimraf(_0x412ee4,function(_0x13e934){if(_0x13e934)_0x39a442(_0x13e934);return _0x487c99();});});})[_0x9f48('0x29')](function(){return _0x466475[_0x9f48('0xd6')](_0x42ecb9,_0x2699bc,function(_0x24e784){if(_0x24e784){console[_0x9f48('0xeb')](_0x9f48('0xec'),_0x24e784);}else{fs['unlinkSync'](_0x42ecb9);}});});});}else{return _0x466475[_0x9f48('0x2a')](0xc8);}})[_0x9f48('0x37')](handleError(_0x466475,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index a0a19d9..be23661 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 _0xdac5=['length','emit','catch','exports','events','../../mysqldb','MailInteraction','setMaxListeners','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0xdac5,0x64));var _0x5dac=function(_0x61318e,_0x257bc9){_0x61318e=_0x61318e-0x0;var _0x1c575b=_0xdac5[_0x61318e];return _0x1c575b;};'use strict';var EventEmitter=require(_0x5dac('0x0'));var MailInteraction=require(_0x5dac('0x1'))['db'][_0x5dac('0x2')];var MailMessage=require(_0x5dac('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x5dac('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5dac('0x4')};function emitEvent(_0x18466a){return function(_0x43a864,_0x824906,_0x369ddd){_0x43a864[_0x5dac('0x5')]({'attributes':['id'],'raw':!![]})[_0x5dac('0x6')](function(_0x29d49f){_0x43a864[_0x5dac('0x7')](_0x5dac('0x8'),_0x29d49f[_0x5dac('0x9')](function(_0x470e31){return{'id':_0x470e31['id']};}));return MailMessage[_0x5dac('0xa')]({'where':{'MailInteractionId':_0x43a864['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5dac('0x6')](function(_0x5f2b23){_0x43a864['setDataValue'](_0x5dac('0xb'),_0x5f2b23[_0x5dac('0xc')]);MailInteractionEvents[_0x5dac('0xd')](_0x18466a+':'+_0x43a864['id'],_0x43a864);MailInteractionEvents[_0x5dac('0xd')](_0x18466a,_0x43a864);_0x369ddd(null);})[_0x5dac('0xe')](_0x369ddd(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x5dac('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x0a86=['MailMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction'];(function(_0xfe3e58,_0x2b9ed6){var _0x1b27b7=function(_0x16cec0){while(--_0x16cec0){_0xfe3e58['push'](_0xfe3e58['shift']());}};_0x1b27b7(++_0x2b9ed6);}(_0x0a86,0x19b));var _0x60a8=function(_0x1c12bd,_0x348360){_0x1c12bd=_0x1c12bd-0x0;var _0x1de620=_0x0a86[_0x1c12bd];return _0x1de620;};'use strict';var EventEmitter=require(_0x60a8('0x0'));var MailInteraction=require(_0x60a8('0x1'))['db'][_0x60a8('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x60a8('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x60a8('0x4')](0x0);var events={'afterCreate':_0x60a8('0x5'),'afterUpdate':_0x60a8('0x6'),'afterDestroy':'remove'};function emitEvent(_0x107c63){return function(_0xd82d2a,_0x17ab16,_0x4d4257){_0xd82d2a[_0x60a8('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2a305c){_0xd82d2a[_0x60a8('0x8')](_0x60a8('0x9'),_0x2a305c[_0x60a8('0xa')](function(_0x556a7b){return{'id':_0x556a7b['id']};}));return MailMessage[_0x60a8('0xb')]({'where':{'MailInteractionId':_0xd82d2a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3f60ad){_0xd82d2a[_0x60a8('0x8')](_0x60a8('0xc'),_0x3f60ad['length']);MailInteractionEvents[_0x60a8('0xd')](_0x107c63+':'+_0xd82d2a['id'],_0xd82d2a);MailInteractionEvents[_0x60a8('0xd')](_0x107c63,_0xd82d2a);_0x4d4257(null);})[_0x60a8('0xe')](_0x4d4257(null));};}for(var e in events){if(events[_0x60a8('0xf')](e)){var event=events[e];MailInteraction[_0x60a8('0x10')](e,emitEvent(event));}}module[_0x60a8('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 f5b9cfb..8d37709 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 _0x9000=['closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','get','MailMessage','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','substatus','substatusAt','format','closed'];(function(_0x16d6a5,_0x51cabf){var _0x1bfc8f=function(_0x46c173){while(--_0x46c173){_0x16d6a5['push'](_0x16d6a5['shift']());}};_0x1bfc8f(++_0x51cabf);}(_0x9000,0x19e));var _0x0900=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x9000[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x0900('0x0'));var util=require(_0x0900('0x1'));var logger=require('../../config/logger')(_0x0900('0x2'));var moment=require(_0x0900('0x3'));var BPromise=require(_0x0900('0x4'));var rp=require(_0x0900('0x5'));var fs=require('fs');var path=require(_0x0900('0x6'));var rimraf=require(_0x0900('0x7'));var config=require(_0x0900('0x8'));var attributes=require(_0x0900('0x9'));module[_0x0900('0xa')]=function(_0x50b1ad,_0x1c7c0b){return _0x50b1ad['define'](_0x0900('0xb'),attributes,{'tableName':_0x0900('0xc'),'paranoid':![],'indexes':[{'name':_0x0900('0xd'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x30aff2,_0x75e296,_0x2c8efa){if(_0x30aff2[_0x0900('0xe')]){_0x30aff2[_0x0900('0xf')]=moment()[_0x0900('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x30aff2[_0x0900('0x11')]){_0x30aff2[_0x0900('0x12')]=moment()[_0x0900('0x10')](_0x0900('0x13'));}_0x2c8efa(null,_0x75e296);},'beforeUpdate':function(_0x101e43,_0x157701,_0xe8ae24){if(_0x101e43[_0x0900('0x14')](_0x0900('0xe'))){_0x101e43[_0x0900('0xf')]=_0x101e43['substatus']?moment()[_0x0900('0x10')](_0x0900('0x13')):null;}if(_0x101e43['changed'](_0x0900('0x11'))){_0x101e43[_0x0900('0x12')]=moment()['format'](_0x0900('0x13'));_0x101e43['substatus']=null;_0x101e43[_0x0900('0xf')]=null;}_0xe8ae24(null,_0x101e43);},'afterUpdate':function(_0xb184b6,_0x2eba4d,_0x34512f){var _0x4bbe8f=_0x50b1ad['models'];var _0x2a6b91=_0xb184b6[_0x0900('0x15')]({'plain':!![]});if(_0x2a6b91[_0x0900('0x11')]){return _0x4bbe8f[_0x0900('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x2a6b91['id']}})[_0x0900('0x17')](function(){_0x34512f();})[_0x0900('0x18')](function(_0x958b2f){_0x34512f(_0x958b2f);});}else{_0x34512f();}}},'charset':_0x0900('0x19'),'collate':_0x0900('0x1a')});}; \ No newline at end of file +var _0xd634=['then','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','models','get','MailMessage','update'];(function(_0x5086b1,_0x380c9b){var _0x28c0b0=function(_0x24da7a){while(--_0x24da7a){_0x5086b1['push'](_0x5086b1['shift']());}};_0x28c0b0(++_0x380c9b);}(_0xd634,0x151));var _0x4d63=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0xd634[_0x496333];return _0x44256e;};'use strict';var _=require(_0x4d63('0x0'));var util=require(_0x4d63('0x1'));var logger=require(_0x4d63('0x2'))(_0x4d63('0x3'));var moment=require(_0x4d63('0x4'));var BPromise=require(_0x4d63('0x5'));var rp=require(_0x4d63('0x6'));var fs=require('fs');var path=require(_0x4d63('0x7'));var rimraf=require(_0x4d63('0x8'));var config=require(_0x4d63('0x9'));var attributes=require('./mailInteraction.attributes');module[_0x4d63('0xa')]=function(_0x2c5bc6,_0x389e92){return _0x2c5bc6[_0x4d63('0xb')](_0x4d63('0xc'),attributes,{'tableName':_0x4d63('0xd'),'paranoid':![],'indexes':[{'name':_0x4d63('0xe'),'fields':[_0x4d63('0xf'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4fa60b,_0x16c4dc,_0x5b6421){if(_0x4fa60b[_0x4d63('0x10')]){_0x4fa60b[_0x4d63('0x11')]=moment()[_0x4d63('0x12')](_0x4d63('0x13'));}if(_0x4fa60b['closed']){_0x4fa60b[_0x4d63('0x14')]=moment()['format'](_0x4d63('0x13'));}_0x5b6421(null,_0x16c4dc);},'beforeUpdate':function(_0x305e60,_0x5a90fe,_0x4722e9){if(_0x305e60[_0x4d63('0x15')](_0x4d63('0x10'))){_0x305e60[_0x4d63('0x11')]=_0x305e60[_0x4d63('0x10')]?moment()[_0x4d63('0x12')](_0x4d63('0x13')):null;}if(_0x305e60[_0x4d63('0x15')](_0x4d63('0x16'))){_0x305e60[_0x4d63('0x14')]=moment()[_0x4d63('0x12')](_0x4d63('0x13'));_0x305e60[_0x4d63('0x10')]=null;_0x305e60['substatusAt']=null;}_0x4722e9(null,_0x305e60);},'afterUpdate':function(_0x38804a,_0x3ab719,_0x6c70){var _0x3ed512=_0x2c5bc6[_0x4d63('0x17')];var _0x3af0d7=_0x38804a[_0x4d63('0x18')]({'plain':!![]});if(_0x3af0d7[_0x4d63('0x16')]){return _0x3ed512[_0x4d63('0x19')][_0x4d63('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x3af0d7['id']}})[_0x4d63('0x1b')](function(){_0x6c70();})['catch'](function(_0x3b2695){_0x6c70(_0x3b2695);});}else{_0x6c70();}}},'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 9c935b5..158ba6c 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 _0x3299=['error','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','where','then','AddTagsToMailInteraction','find','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4fdf44,_0x4e8679){var _0x2c52b3=function(_0x52f92d){while(--_0x52f92d){_0x4fdf44['push'](_0x4fdf44['shift']());}};_0x2c52b3(++_0x4e8679);}(_0x3299,0x1bc));var _0x9329=function(_0x10fb07,_0xa5bcef){_0x10fb07=_0x10fb07-0x0;var _0x43389f=_0x3299[_0x10fb07];return _0x43389f;};'use strict';var _=require('lodash');var util=require(_0x9329('0x0'));var moment=require(_0x9329('0x1'));var BPromise=require(_0x9329('0x2'));var rs=require(_0x9329('0x3'));var fs=require('fs');var Redis=require(_0x9329('0x4'));var db=require(_0x9329('0x5'))['db'];var utils=require(_0x9329('0x6'));var logger=require(_0x9329('0x7'))(_0x9329('0x8'));var config=require(_0x9329('0x9'));var jayson=require(_0x9329('0xa'));var client=jayson[_0x9329('0xb')][_0x9329('0xc')]({'port':0x232a});config[_0x9329('0xd')]=_[_0x9329('0xe')](config[_0x9329('0xd')],{'host':_0x9329('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9329('0xd')]));require(_0x9329('0x10'))[_0x9329('0x11')](socket);function respondWithRpcPromise(_0x171f53,_0x330155,_0x53d176){return new BPromise(function(_0x181558,_0x354e9b){return client['request'](_0x171f53,_0x53d176)['then'](function(_0x5d72d0){logger[_0x9329('0x12')](_0x9329('0x13'),_0x330155,_0x9329('0x14'));logger[_0x9329('0x15')](_0x9329('0x16'),_0x330155,'request\x20sent',JSON[_0x9329('0x17')](_0x5d72d0));if(_0x5d72d0[_0x9329('0x18')]){if(_0x5d72d0[_0x9329('0x18')]['code']===0x1f4){logger[_0x9329('0x18')](_0x9329('0x13'),_0x330155,_0x5d72d0['error'][_0x9329('0x19')]);return _0x354e9b(_0x5d72d0[_0x9329('0x18')]['message']);}logger[_0x9329('0x18')](_0x9329('0x13'),_0x330155,_0x5d72d0[_0x9329('0x18')][_0x9329('0x19')]);return _0x181558(_0x5d72d0['error'][_0x9329('0x19')]);}else{logger['info'](_0x9329('0x13'),_0x330155,_0x9329('0x14'));_0x181558(_0x5d72d0['result'][_0x9329('0x19')]);}})[_0x9329('0x1a')](function(_0x5aa406){logger[_0x9329('0x18')]('MailInteraction,\x20%s,\x20%s',_0x330155,_0x5aa406);_0x354e9b(_0x5aa406);});});}exports[_0x9329('0x1b')]=function(_0x488ddc){var _0x38fdbf=this;return new Promise(function(_0x4d978a,_0x6676d7){return db[_0x9329('0x1c')][_0x9329('0x1d')](_0x488ddc[_0x9329('0x1e')],{'raw':_0x488ddc[_0x9329('0x1f')]?_0x488ddc[_0x9329('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x488ddc[_0x9329('0x1f')]?_0x488ddc[_0x9329('0x1f')][_0x9329('0x20')]||null:null,'attributes':_0x488ddc[_0x9329('0x1f')]?_0x488ddc[_0x9329('0x1f')]['attributes']||null:null,'limit':_0x488ddc[_0x9329('0x1f')]?_0x488ddc[_0x9329('0x1f')]['limit']||null:null})[_0x9329('0x21')](function(_0x84dacf){logger[_0x9329('0x12')](_0x9329('0x1b'),_0x488ddc);logger['debug']('UpdateMailInteraction',_0x488ddc,JSON[_0x9329('0x17')](_0x84dacf));_0x4d978a(_0x84dacf);})[_0x9329('0x1a')](function(_0x4419fc){logger['error'](_0x9329('0x1b'),_0x4419fc['message'],_0x488ddc);_0x6676d7(_0x38fdbf[_0x9329('0x18')](0x1f4,_0x4419fc[_0x9329('0x19')]));});});};exports[_0x9329('0x22')]=function(_0x573209){return new Promise(function(_0x57ba4b,_0x36765a){return db['MailInteraction'][_0x9329('0x23')]({'where':_0x573209['options']?_0x573209[_0x9329('0x1f')]['where']||null:null})[_0x9329('0x21')](function(_0x469fa5){if(_0x469fa5){return _0x469fa5['addTags'](_0x573209[_0x9329('0x1e')][_0x9329('0x24')],_['omit'](_0x573209[_0x9329('0x1e')],[_0x9329('0x24'),'id'])||{});}})[_0x9329('0x25')](function(_0x333bc2){logger['info']('AddTags',_0x573209);logger['debug'](_0x9329('0x26'),_0x573209,JSON['stringify'](_0x333bc2));_0x57ba4b(_0x333bc2);})[_0x9329('0x1a')](function(_0x5a1a33){logger[_0x9329('0x18')](_0x9329('0x26'),_0x5a1a33['message'],_0x573209);_0x36765a(_this[_0x9329('0x18')](0x1f4,_0x5a1a33[_0x9329('0x19')]));});});}; \ No newline at end of file +var _0xab3a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','where','attributes','limit','stringify','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1c76fa,_0x1a88c3){var _0x13ae6d=function(_0x3a2956){while(--_0x3a2956){_0x1c76fa['push'](_0x1c76fa['shift']());}};_0x13ae6d(++_0x1a88c3);}(_0xab3a,0x1d3));var _0xaab3=function(_0xbec8e6,_0x2841b5){_0xbec8e6=_0xbec8e6-0x0;var _0x4aa6f2=_0xab3a[_0xbec8e6];return _0x4aa6f2;};'use strict';var _=require(_0xaab3('0x0'));var util=require(_0xaab3('0x1'));var moment=require(_0xaab3('0x2'));var BPromise=require(_0xaab3('0x3'));var rs=require(_0xaab3('0x4'));var fs=require('fs');var Redis=require(_0xaab3('0x5'));var db=require(_0xaab3('0x6'))['db'];var utils=require(_0xaab3('0x7'));var logger=require(_0xaab3('0x8'))(_0xaab3('0x9'));var config=require(_0xaab3('0xa'));var jayson=require(_0xaab3('0xb'));var client=jayson[_0xaab3('0xc')]['http']({'port':0x232a});config['redis']=_[_0xaab3('0xd')](config[_0xaab3('0xe')],{'host':_0xaab3('0xf'),'port':0x18eb});var socket=require(_0xaab3('0x10'))(new Redis(config[_0xaab3('0xe')]));require(_0xaab3('0x11'))[_0xaab3('0x12')](socket);function respondWithRpcPromise(_0x2ee82a,_0x3595c0,_0x151330){return new BPromise(function(_0x404054,_0x54c60d){return client['request'](_0x2ee82a,_0x151330)[_0xaab3('0x13')](function(_0x45363f){logger[_0xaab3('0x14')](_0xaab3('0x15'),_0x3595c0,'request\x20sent');logger[_0xaab3('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x3595c0,_0xaab3('0x17'),JSON['stringify'](_0x45363f));if(_0x45363f[_0xaab3('0x18')]){if(_0x45363f[_0xaab3('0x18')][_0xaab3('0x19')]===0x1f4){logger['error'](_0xaab3('0x15'),_0x3595c0,_0x45363f[_0xaab3('0x18')]['message']);return _0x54c60d(_0x45363f[_0xaab3('0x18')][_0xaab3('0x1a')]);}logger[_0xaab3('0x18')]('MailInteraction,\x20%s,\x20%s',_0x3595c0,_0x45363f['error']['message']);return _0x404054(_0x45363f['error'][_0xaab3('0x1a')]);}else{logger[_0xaab3('0x14')](_0xaab3('0x15'),_0x3595c0,'request\x20sent');_0x404054(_0x45363f[_0xaab3('0x1b')][_0xaab3('0x1a')]);}})[_0xaab3('0x1c')](function(_0x13048f){logger[_0xaab3('0x18')](_0xaab3('0x15'),_0x3595c0,_0x13048f);_0x54c60d(_0x13048f);});});}exports[_0xaab3('0x1d')]=function(_0x5a865b){var _0x1b72a5=this;return new Promise(function(_0x3bcc3b,_0x43a8d4){return db[_0xaab3('0x1e')][_0xaab3('0x1f')](_0x5a865b['body'],{'raw':_0x5a865b['options']?_0x5a865b['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a865b['options']?_0x5a865b[_0xaab3('0x20')][_0xaab3('0x21')]||null:null,'attributes':_0x5a865b[_0xaab3('0x20')]?_0x5a865b[_0xaab3('0x20')][_0xaab3('0x22')]||null:null,'limit':_0x5a865b[_0xaab3('0x20')]?_0x5a865b[_0xaab3('0x20')][_0xaab3('0x23')]||null:null})[_0xaab3('0x13')](function(_0x46e004){logger[_0xaab3('0x14')](_0xaab3('0x1d'),_0x5a865b);logger[_0xaab3('0x16')]('UpdateMailInteraction',_0x5a865b,JSON[_0xaab3('0x24')](_0x46e004));_0x3bcc3b(_0x46e004);})['catch'](function(_0x28eaff){logger[_0xaab3('0x18')]('UpdateMailInteraction',_0x28eaff[_0xaab3('0x1a')],_0x5a865b);_0x43a8d4(_0x1b72a5[_0xaab3('0x18')](0x1f4,_0x28eaff[_0xaab3('0x1a')]));});});};exports['AddTagsToMailInteraction']=function(_0x4f5eec){return new Promise(function(_0x2f9833,_0x205996){return db[_0xaab3('0x1e')]['find']({'where':_0x4f5eec[_0xaab3('0x20')]?_0x4f5eec[_0xaab3('0x20')][_0xaab3('0x21')]||null:null})[_0xaab3('0x13')](function(_0x35a13d){if(_0x35a13d){return _0x35a13d[_0xaab3('0x25')](_0x4f5eec[_0xaab3('0x26')][_0xaab3('0x27')],_[_0xaab3('0x28')](_0x4f5eec[_0xaab3('0x26')],[_0xaab3('0x27'),'id'])||{});}})[_0xaab3('0x29')](function(_0xc33cb4){logger[_0xaab3('0x14')]('AddTags',_0x4f5eec);logger[_0xaab3('0x16')](_0xaab3('0x2a'),_0x4f5eec,JSON[_0xaab3('0x24')](_0xc33cb4));_0x2f9833(_0xc33cb4);})[_0xaab3('0x1c')](function(_0xc7cead){logger[_0xaab3('0x18')]('AddTags',_0xc7cead[_0xaab3('0x1a')],_0x4f5eec);_0x205996(_this['error'](0x1f4,_0xc7cead['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 8968cb6..16b6764 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 _0x0144=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','remove'];(function(_0x40579e,_0x1f4bcc){var _0x406aee=function(_0x149f47){while(--_0x149f47){_0x40579e['push'](_0x40579e['shift']());}};_0x406aee(++_0x1f4bcc);}(_0x0144,0x16e));var _0x4014=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x0144[_0x55e08b];return _0xd1a7ff;};'use strict';var MailInteractionEvents=require(_0x4014('0x0'));var events=['save',_0x4014('0x1'),_0x4014('0x2')];function createListener(_0xa9245b,_0x220b6b){return function(_0x54e407){_0x220b6b[_0x4014('0x3')](_0xa9245b,_0x54e407);};}function removeListener(_0x48cb88,_0x3cf902){return function(){MailInteractionEvents[_0x4014('0x4')](_0x48cb88,_0x3cf902);};}exports[_0x4014('0x5')]=function(_0x3b606b){for(var _0x43eba2=0x0,_0x1e0a51=events[_0x4014('0x6')];_0x43eba2<_0x1e0a51;_0x43eba2++){var _0x161980=events[_0x43eba2];var _0x5801ce=createListener(_0x4014('0x7')+_0x161980,_0x3b606b);MailInteractionEvents['on'](_0x161980,_0x5801ce);}}; \ No newline at end of file +var _0xb75e=['update','emit','removeListener','register','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x487131,_0x2c86e8){var _0xf320ff=function(_0x2a9a17){while(--_0x2a9a17){_0x487131['push'](_0x487131['shift']());}};_0xf320ff(++_0x2c86e8);}(_0xb75e,0x1de));var _0xeb75=function(_0x2687c5,_0x1fc9b){_0x2687c5=_0x2687c5-0x0;var _0x5aa160=_0xb75e[_0x2687c5];return _0x5aa160;};'use strict';var MailInteractionEvents=require(_0xeb75('0x0'));var events=[_0xeb75('0x1'),'remove',_0xeb75('0x2')];function createListener(_0x9ed34c,_0x2087c6){return function(_0x588569){_0x2087c6[_0xeb75('0x3')](_0x9ed34c,_0x588569);};}function removeListener(_0x3f558a,_0x267cbc){return function(){MailInteractionEvents[_0xeb75('0x4')](_0x3f558a,_0x267cbc);};}exports[_0xeb75('0x5')]=function(_0x19ac2f){for(var _0x56c177=0x0,_0x92d029=events[_0xeb75('0x6')];_0x56c177<_0x92d029;_0x56c177++){var _0x49ed4e=events[_0x56c177];var _0x1af864=createListener(_0xeb75('0x7')+_0x49ed4e,_0x19ac2f);MailInteractionEvents['on'](_0x49ed4e,_0x1af864);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 018507d..85fcb71 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 _0x9a19=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','/:id','/:id/download','download','post','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','express'];(function(_0x524584,_0x538dc6){var _0x4b99ca=function(_0x898ea1){while(--_0x898ea1){_0x524584['push'](_0x524584['shift']());}};_0x4b99ca(++_0x538dc6);}(_0x9a19,0x114));var _0x99a1=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x9a19[_0x53bcc3];return _0x47c959;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var auth=require(_0x99a1('0x5'));var interaction=require(_0x99a1('0x6'));var config=require(_0x99a1('0x7'));var controller=require(_0x99a1('0x8'));router[_0x99a1('0x9')]('/',auth[_0x99a1('0xa')](),controller[_0x99a1('0xb')]);router[_0x99a1('0x9')](_0x99a1('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller['show']);router['get'](_0x99a1('0xe'),auth[_0x99a1('0xa')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x10')]('/',auth[_0x99a1('0xa')](),interaction['tracked'](_0x99a1('0x11'),_0x99a1('0x12')),controller[_0x99a1('0x13')]);router[_0x99a1('0x14')](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller[_0x99a1('0x15')]);router[_0x99a1('0x14')](_0x99a1('0x16'),auth[_0x99a1('0xa')](),controller[_0x99a1('0x17')]);router[_0x99a1('0x14')](_0x99a1('0x18'),auth[_0x99a1('0xa')](),controller[_0x99a1('0x19')]);router['delete'](_0x99a1('0xd'),auth[_0x99a1('0xa')](),controller[_0x99a1('0x1a')]);module[_0x99a1('0x1b')]=router; \ No newline at end of file +var _0xa41a=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','describe','isAuthenticated','show','/:id/download','download','post','tracked','mailmessage:create','create','put','/:id/accept','accept','reject','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x42a0ab,_0x517517){var _0x2fa683=function(_0x5e811a){while(--_0x5e811a){_0x42a0ab['push'](_0x42a0ab['shift']());}};_0x2fa683(++_0x517517);}(_0xa41a,0x6b));var _0xaa41=function(_0x2621ea,_0x2162ae){_0x2621ea=_0x2621ea-0x0;var _0x3587dd=_0xa41a[_0x2621ea];return _0x3587dd;};'use strict';var multer=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var path=require('path');var timeout=require(_0xaa41('0x2'));var express=require(_0xaa41('0x3'));var router=express[_0xaa41('0x4')]();var auth=require(_0xaa41('0x5'));var interaction=require(_0xaa41('0x6'));var config=require(_0xaa41('0x7'));var controller=require(_0xaa41('0x8'));router[_0xaa41('0x9')]('/',auth['isAuthenticated'](),controller[_0xaa41('0xa')]);router[_0xaa41('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xaa41('0xb')]);router[_0xaa41('0x9')]('/:id',auth[_0xaa41('0xc')](),controller[_0xaa41('0xd')]);router[_0xaa41('0x9')](_0xaa41('0xe'),auth[_0xaa41('0xc')](),controller[_0xaa41('0xf')]);router[_0xaa41('0x10')]('/',auth[_0xaa41('0xc')](),interaction[_0xaa41('0x11')]('mail',_0xaa41('0x12')),controller[_0xaa41('0x13')]);router['put']('/:id',auth[_0xaa41('0xc')](),controller['update']);router[_0xaa41('0x14')](_0xaa41('0x15'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x16')]);router[_0xaa41('0x14')]('/:id/reject',auth[_0xaa41('0xc')](),controller[_0xaa41('0x17')]);router[_0xaa41('0x18')](_0xaa41('0x19'),auth[_0xaa41('0xc')](),controller[_0xaa41('0x1a')]);module[_0xaa41('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 98c311c..8b482bf 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 _0xcabe=['sequelize','exports','TEXT','medium','ENUM','out','STRING','long','DATE'];(function(_0x2882da,_0x467427){var _0x351813=function(_0x195616){while(--_0x195616){_0x2882da['push'](_0x2882da['shift']());}};_0x351813(++_0x467427);}(_0xcabe,0x1ef));var _0xecab=function(_0x1b2c64,_0x4d1ed0){_0x1b2c64=_0x1b2c64-0x0;var _0x22fb21=_0xcabe[_0x1b2c64];return _0x22fb21;};'use strict';var Sequelize=require(_0xecab('0x0'));var _=require('lodash');module[_0xecab('0x1')]={'body':{'type':Sequelize[_0xecab('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xecab('0x2')](_0xecab('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xecab('0x4')]('in',_0xecab('0x5')),'defaultValue':_0xecab('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0xecab('0x6')]},'to':{'type':Sequelize[_0xecab('0x2')](_0xecab('0x7'))},'cc':{'type':Sequelize[_0xecab('0x2')](_0xecab('0x7'))},'bcc':{'type':Sequelize[_0xecab('0x2')](_0xecab('0x7'))},'subject':{'type':Sequelize[_0xecab('0x2')]},'sentAt':{'type':Sequelize[_0xecab('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xecab('0x8')]},'originTo':{'type':Sequelize[_0xecab('0x2')]('long')},'originCc':{'type':Sequelize[_0xecab('0x2')](_0xecab('0x7'))}}; \ No newline at end of file +var _0xd448=['medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','lodash','exports','TEXT','long'];(function(_0x1cf5f4,_0x1c8185){var _0x340b7f=function(_0x249687){while(--_0x249687){_0x1cf5f4['push'](_0x1cf5f4['shift']());}};_0x340b7f(++_0x1c8185);}(_0xd448,0x172));var _0x8d44=function(_0x3266a6,_0x129966){_0x3266a6=_0x3266a6-0x0;var _0x10ee38=_0xd448[_0x3266a6];return _0x10ee38;};'use strict';var Sequelize=require('sequelize');var _=require(_0x8d44('0x0'));module[_0x8d44('0x1')]={'body':{'type':Sequelize[_0x8d44('0x2')](_0x8d44('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x8d44('0x2')](_0x8d44('0x4'))},'read':{'type':Sequelize[_0x8d44('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8d44('0x6')]('in',_0x8d44('0x7')),'defaultValue':_0x8d44('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x8d44('0x8')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x8d44('0x2')](_0x8d44('0x3'))},'bcc':{'type':Sequelize[_0x8d44('0x2')](_0x8d44('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x8d44('0x9')]},'attach':{'type':Sequelize[_0x8d44('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x8d44('0x2')](_0x8d44('0x3'))},'originCc':{'type':Sequelize[_0x8d44('0x2')]('long')}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 916895a..af11cb6 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 _0xec5e=['Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','server/files/attachments','basename','CmContact','defaults','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','get','MailInteraction','MailInteractionId','read1stAt','info','role','interaction','acceptMessage','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail-interactions','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','reject','download','unix','root','files','server','from','bcc','subject','createdAt','Attachment','headers','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request\x20sent','debug','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','sendStatus','status','end','offset','Content-Range','json','apply','update','then','destroy','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','find','body','params','describe','create','direction','out','split','MailAccountId','CmList','List'];(function(_0x39def1,_0xe38627){var _0x40ad14=function(_0x1cf573){while(--_0x1cf573){_0x39def1['push'](_0x39def1['shift']());}};_0x40ad14(++_0xe38627);}(_0xec5e,0x196));var _0xeec5=function(_0xa96436,_0x656eb1){_0xa96436=_0xa96436-0x0;var _0x310513=_0xec5e[_0xa96436];return _0x310513;};'use strict';var pdf=require(_0xeec5('0x0'));var emlformat=require(_0xeec5('0x1'));var rimraf=require(_0xeec5('0x2'));var zipdir=require(_0xeec5('0x3'));var jsonpatch=require(_0xeec5('0x4'));var rp=require(_0xeec5('0x5'));var moment=require(_0xeec5('0x6'));var BPromise=require(_0xeec5('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeec5('0x8'));var sox=require(_0xeec5('0x9'));var csv=require(_0xeec5('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xeec5('0xb'));var squel=require('squel');var crypto=require(_0xeec5('0xc'));var jsforce=require(_0xeec5('0xd'));var deskjs=require(_0xeec5('0xe'));var toCsv=require(_0xeec5('0xa'));var querystring=require(_0xeec5('0xf'));var Papa=require(_0xeec5('0x10'));var Redis=require(_0xeec5('0x11'));var authService=require(_0xeec5('0x12'));var qs=require(_0xeec5('0x13'));var as=require(_0xeec5('0x14'));var hardwareService=require(_0xeec5('0x15'));var logger=require(_0xeec5('0x16'))('api');var utils=require(_0xeec5('0x17'));var config=require(_0xeec5('0x18'));var db=require('../../mysqldb')['db'];config[_0xeec5('0x19')]=_['defaults'](config['redis'],{'host':_0xeec5('0x1a'),'port':0x18eb});var socket=require(_0xeec5('0x1b'))(new Redis(config['redis']));require(_0xeec5('0x1c'))[_0xeec5('0x1d')](socket);var jayson=require(_0xeec5('0x1e'));var client=jayson[_0xeec5('0x1f')][_0xeec5('0x20')]({'port':0x232c});var client9003=jayson[_0xeec5('0x1f')][_0xeec5('0x20')]({'port':0x232b});var client9002=jayson[_0xeec5('0x1f')][_0xeec5('0x20')]({'port':0x232a});function checkPasswordPattern(_0x1c0b87,_0x5d4b43,_0x1e39dd){if(_0x1e39dd){var _0x43ebd8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x43ebd8[_0xeec5('0x21')](_0x5d4b43)){return _0x1c0b87;}else{throw new db['Sequelize'][(_0xeec5('0x22'))](_0xeec5('0x23'));}}else{return _0x1c0b87;}}function respondWithRpcPromise(_0x286920,_0x5a675b,_0x5b1e15,_0x5139f0){return new BPromise(function(_0x336a80,_0x305950){var _0x365b9c=_0x5139f0||client;return _0x365b9c['request'](_0x286920,_0x5b1e15)['then'](function(_0x12b959){logger['info']('MailMessage,\x20%s,\x20%s',_0x5a675b,_0xeec5('0x24'));logger[_0xeec5('0x25')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x5a675b,_0xeec5('0x24'),JSON[_0xeec5('0x26')](_0x12b959));if(_0x12b959['error']){if(_0x12b959[_0xeec5('0x27')][_0xeec5('0x28')]===0x1f4){logger[_0xeec5('0x27')](_0xeec5('0x29'),_0x5a675b,_0x12b959['error'][_0xeec5('0x2a')]);return _0x305950(_0x12b959[_0xeec5('0x27')][_0xeec5('0x2a')]);}logger[_0xeec5('0x27')](_0xeec5('0x29'),_0x5a675b,_0x12b959[_0xeec5('0x27')]['message']);return _0x336a80(_0x12b959['error'][_0xeec5('0x2a')]);}else{logger['info'](_0xeec5('0x29'),_0x5a675b,_0xeec5('0x24'));_0x336a80(_0x12b959[_0xeec5('0x2b')]['message']);}})['catch'](function(_0x2f3327){logger['error'](_0xeec5('0x29'),_0x5a675b,_0x2f3327);_0x305950(_0x2f3327);});});}function respondWithStatusCode(_0x3ef1f0,_0xadd46d){_0xadd46d=_0xadd46d||0xcc;return function(_0x5e9f56){if(_0x5e9f56){return _0x3ef1f0[_0xeec5('0x2c')](_0xadd46d);}return _0x3ef1f0[_0xeec5('0x2d')](_0xadd46d)[_0xeec5('0x2e')]();};}function respondWithResult(_0x253fc7,_0xacefd3){_0xacefd3=_0xacefd3||0xc8;return function(_0xa5e7cf){if(_0xa5e7cf){return _0x253fc7[_0xeec5('0x2d')](_0xacefd3)['json'](_0xa5e7cf);}};}function respondWithFilteredResult(_0x5691ee,_0x556da8){return function(_0x2f8076){if(_0x2f8076){var _0x212e85=_0x2f8076['count'],_0x447ba0=_0x556da8[_0xeec5('0x2f')],_0x1b994a=_0x556da8[_0xeec5('0x2f')]+_0x556da8['limit'],_0xd7e2af;if(_0x1b994a>=_0x212e85){_0x1b994a=_0x212e85;_0xd7e2af=0xc8;}else{_0xd7e2af=0xce;}_0x5691ee[_0xeec5('0x2d')](_0xd7e2af);return _0x5691ee['set'](_0xeec5('0x30'),_0x447ba0+'-'+_0x1b994a+'/'+_0x212e85)[_0xeec5('0x31')](_0x2f8076);}return null;};}function patchUpdates(_0xa657b2){return function(_0x3172e4){try{jsonpatch[_0xeec5('0x32')](_0x3172e4,_0xa657b2,!![]);}catch(_0x3ddc55){return BPromise['reject'](_0x3ddc55);}return _0x3172e4['save']();};}function saveUpdates(_0x57dfb4,_0x4cec41){return function(_0x3544bb){if(_0x3544bb){return _0x3544bb[_0xeec5('0x33')](_0x57dfb4)[_0xeec5('0x34')](function(_0x125236){return _0x125236;});}return null;};}function removeEntity(_0x2f29ea,_0xec074e){return function(_0x419524){if(_0x419524){return _0x419524[_0xeec5('0x35')]()[_0xeec5('0x34')](function(){_0x2f29ea[_0xeec5('0x2d')](0xcc)[_0xeec5('0x2e')]();});}};}function handleEntityNotFound(_0x63780f,_0x2c7ed7){return function(_0x212bda){if(!_0x212bda){_0x63780f[_0xeec5('0x2c')](0x194);}return _0x212bda;};}function handleError(_0x424695,_0x42d71f){_0x42d71f=_0x42d71f||0x1f4;return function(_0xc0d5f0){logger[_0xeec5('0x27')](_0xc0d5f0['stack']);if(_0xc0d5f0['name']){delete _0xc0d5f0[_0xeec5('0x36')];}_0x424695[_0xeec5('0x2d')](_0x42d71f)[_0xeec5('0x37')](_0xc0d5f0);};}exports[_0xeec5('0x38')]=function(_0xe67143,_0x5b8dfa){var _0x2a1628={},_0x7e7ea8={},_0x2ab844={'count':0x0,'rows':[]};var _0x5bc25a=_[_0xeec5('0x39')](db[_0xeec5('0x3a')][_0xeec5('0x3b')],function(_0x548501){return{'name':_0x548501[_0xeec5('0x3c')],'type':_0x548501[_0xeec5('0x3d')][_0xeec5('0x3e')]};});_0x7e7ea8[_0xeec5('0x3f')]=_[_0xeec5('0x39')](_0x5bc25a,_0xeec5('0x36'));_0x7e7ea8['query']=_[_0xeec5('0x40')](_0xe67143[_0xeec5('0x41')]);_0x7e7ea8[_0xeec5('0x42')]=_[_0xeec5('0x43')](_0x7e7ea8[_0xeec5('0x3f')],_0x7e7ea8[_0xeec5('0x41')]);_0x2a1628['attributes']=_['intersection'](_0x7e7ea8['model'],qs[_0xeec5('0x44')](_0xe67143[_0xeec5('0x41')][_0xeec5('0x44')]));_0x2a1628[_0xeec5('0x45')]=_0x2a1628[_0xeec5('0x45')][_0xeec5('0x46')]?_0x2a1628[_0xeec5('0x45')]:_0x7e7ea8[_0xeec5('0x3f')];if(!_0xe67143[_0xeec5('0x41')]['hasOwnProperty'](_0xeec5('0x47'))){_0x2a1628[_0xeec5('0x48')]=qs[_0xeec5('0x48')](_0xe67143['query'][_0xeec5('0x48')]);_0x2a1628[_0xeec5('0x2f')]=qs['offset'](_0xe67143[_0xeec5('0x41')][_0xeec5('0x2f')]);}_0x2a1628[_0xeec5('0x49')]=qs[_0xeec5('0x4a')](_0xe67143[_0xeec5('0x41')][_0xeec5('0x4a')]);_0x2a1628[_0xeec5('0x4b')]=qs[_0xeec5('0x42')](_[_0xeec5('0x4c')](_0xe67143[_0xeec5('0x41')],_0x7e7ea8[_0xeec5('0x42')]));if(_0xe67143[_0xeec5('0x41')][_0xeec5('0x4d')]){_0x2a1628['where']=_[_0xeec5('0x4e')](_0x2a1628[_0xeec5('0x4b')],{'$or':_[_0xeec5('0x39')](_0x5bc25a,function(_0x23eb78){if(_0x23eb78[_0xeec5('0x3d')]!==_0xeec5('0x4f')){var _0x127b82={};_0x127b82[_0x23eb78['name']]={'$like':'%'+_0xe67143[_0xeec5('0x41')][_0xeec5('0x4d')]+'%'};return _0x127b82;}})});}_0x2a1628=_[_0xeec5('0x4e')]({},_0x2a1628,_0xe67143[_0xeec5('0x50')]);var _0x398aa2={'where':_0x2a1628[_0xeec5('0x4b')]};return db[_0xeec5('0x3a')][_0xeec5('0x51')](_0x398aa2)['then'](function(_0x7fd15a){_0x2ab844[_0xeec5('0x51')]=_0x7fd15a;if(_0xe67143[_0xeec5('0x41')][_0xeec5('0x52')]){_0x2a1628[_0xeec5('0x53')]=[{'all':!![]}];}return db[_0xeec5('0x3a')][_0xeec5('0x54')](_0x2a1628);})[_0xeec5('0x34')](function(_0x217bfb){_0x2ab844['rows']=_0x217bfb;return _0x2ab844;})[_0xeec5('0x34')](respondWithFilteredResult(_0x5b8dfa,_0x2a1628))[_0xeec5('0x55')](handleError(_0x5b8dfa,null));};exports[_0xeec5('0x56')]=function(_0x351fef,_0x20d4d1){var _0x1bbc14={'raw':!![],'where':{'id':_0x351fef['params']['id']}},_0x5d768f={};_0x5d768f[_0xeec5('0x3f')]=_[_0xeec5('0x40')](db['MailMessage'][_0xeec5('0x3b')]);_0x5d768f[_0xeec5('0x41')]=_[_0xeec5('0x40')](_0x351fef[_0xeec5('0x41')]);_0x5d768f[_0xeec5('0x42')]=_[_0xeec5('0x43')](_0x5d768f[_0xeec5('0x3f')],_0x5d768f['query']);_0x1bbc14['attributes']=_['intersection'](_0x5d768f['model'],qs[_0xeec5('0x44')](_0x351fef[_0xeec5('0x41')][_0xeec5('0x44')]));_0x1bbc14['attributes']=_0x1bbc14[_0xeec5('0x45')][_0xeec5('0x46')]?_0x1bbc14['attributes']:_0x5d768f[_0xeec5('0x3f')];if(_0x351fef[_0xeec5('0x41')][_0xeec5('0x52')]){_0x1bbc14[_0xeec5('0x53')]=[{'all':!![]}];}_0x1bbc14=_['merge']({},_0x1bbc14,_0x351fef[_0xeec5('0x50')]);return db[_0xeec5('0x3a')][_0xeec5('0x57')](_0x1bbc14)[_0xeec5('0x34')](handleEntityNotFound(_0x20d4d1,null))[_0xeec5('0x34')](respondWithResult(_0x20d4d1,null))[_0xeec5('0x55')](handleError(_0x20d4d1,null));};exports[_0xeec5('0x33')]=function(_0x42bd83,_0x5981f8){if(_0x42bd83[_0xeec5('0x58')]['id']){delete _0x42bd83[_0xeec5('0x58')]['id'];}return db[_0xeec5('0x3a')][_0xeec5('0x57')]({'where':{'id':_0x42bd83[_0xeec5('0x59')]['id']}})[_0xeec5('0x34')](handleEntityNotFound(_0x5981f8,null))[_0xeec5('0x34')](saveUpdates(_0x42bd83[_0xeec5('0x58')],null))['then'](respondWithResult(_0x5981f8,null))['catch'](handleError(_0x5981f8,null));};exports[_0xeec5('0x35')]=function(_0x4e3206,_0x35e9bc){return db[_0xeec5('0x3a')]['find']({'where':{'id':_0x4e3206[_0xeec5('0x59')]['id']}})[_0xeec5('0x34')](handleEntityNotFound(_0x35e9bc,null))[_0xeec5('0x34')](removeEntity(_0x35e9bc,null))['catch'](handleError(_0x35e9bc,null));};exports[_0xeec5('0x5a')]=function(_0x5b1b78,_0x59e11d){return db[_0xeec5('0x3a')][_0xeec5('0x5a')]()[_0xeec5('0x34')](respondWithResult(_0x59e11d,null))[_0xeec5('0x55')](handleError(_0x59e11d,null));};exports[_0xeec5('0x5b')]=function(_0x213f88,_0x115870){return db[_0xeec5('0x3a')][_0xeec5('0x5b')](_0x213f88[_0xeec5('0x58')])[_0xeec5('0x34')](function(_0x237b60){if(_0x237b60){if(_0x237b60[_0xeec5('0x5c')]===_0xeec5('0x5d')&&!_0x237b60['secret']){var _0x4c9767,_0x5a5707,_0x5308a5;if(_0x213f88[_0xeec5('0x58')]['to']){_0x5a5707=_0x213f88[_0xeec5('0x58')]['to'][_0xeec5('0x5e')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x237b60[_0xeec5('0x5f')]},'include':[{'model':db[_0xeec5('0x60')],'as':_0xeec5('0x61'),'include':[{'model':db['CmContact'],'as':_0xeec5('0x62'),'where':{'email':_0x5a5707},'limit':0x1,'order':[['updatedAt',_0xeec5('0x63')]]}]},{'model':db[_0xeec5('0x64')],'as':_0xeec5('0x65'),'raw':!![]}]})[_0xeec5('0x34')](function(_0x46eed0){_0x4c9767=_0x46eed0;if(_0x4c9767&&_0x4c9767[_0xeec5('0x65')]){var _0x2ccc2f={'tls':{'rejectUnauthorized':![]}};if(_[_0xeec5('0x66')](_0x4c9767[_0xeec5('0x65')][_0xeec5('0x67')])){_0x2ccc2f[_0xeec5('0x68')]=_0x4c9767['Smtp']['host'];_0x2ccc2f['port']=_0x4c9767[_0xeec5('0x65')][_0xeec5('0x69')];_0x2ccc2f[_0xeec5('0x6a')]=_0x4c9767['Smtp']['secure'];if(_0x4c9767['Smtp'][_0xeec5('0x6b')]){_0x2ccc2f[_0xeec5('0x6c')]={'user':_0x4c9767['Smtp'][_0xeec5('0x6d')],'pass':_0x4c9767[_0xeec5('0x65')][_0xeec5('0x6e')]};}}else{_0x2ccc2f['service']=_0x4c9767[_0xeec5('0x65')][_0xeec5('0x67')];_0x2ccc2f[_0xeec5('0x6c')]={'user':_0x4c9767[_0xeec5('0x65')][_0xeec5('0x6d')],'pass':_0x4c9767[_0xeec5('0x65')]['pass']};_0x2ccc2f[_0xeec5('0x6a')]=_0x4c9767['Smtp'][_0xeec5('0x6a')];}if(_0x213f88[_0xeec5('0x58')]['attachments']&&_0x213f88[_0xeec5('0x58')]['attachments'][_0xeec5('0x46')]){for(var _0x17f097=0x0;_0x17f097<_0x213f88['body']['attachments']['length'];_0x17f097+=0x1){_0x213f88[_0xeec5('0x58')]['attachments'][_0x17f097]={'filename':_0x213f88['body'][_0xeec5('0x6f')][_0x17f097][_0xeec5('0x36')],'path':path[_0xeec5('0x70')](config['root'],_0xeec5('0x71'),_0x213f88[_0xeec5('0x58')][_0xeec5('0x6f')][_0x17f097][_0xeec5('0x72')])};}}_0x5308a5={'account':_0x2ccc2f,'message':_0x213f88[_0xeec5('0x58')]};return;}})[_0xeec5('0x34')](function(){if(_0x4c9767[_0xeec5('0x61')]){if(_0x4c9767[_0xeec5('0x61')]['Contacts'][_0xeec5('0x46')]){return _0x4c9767[_0xeec5('0x61')][_0xeec5('0x62')][0x0];}else{return db[_0xeec5('0x73')][_0xeec5('0x5b')](_[_0xeec5('0x74')](_0x213f88[_0xeec5('0x58')],{'firstName':_0x213f88[_0xeec5('0x58')]['to'],'email':_0x213f88['body']['to'],'phone':_0x213f88[_0xeec5('0x58')]['to'],'ListId':_0x4c9767[_0xeec5('0x75')]}));}}else{throw new Error(_0xeec5('0x76'));}})[_0xeec5('0x34')](function(){if(_0x5308a5){return respondWithRpcPromise(_0xeec5('0x77'),_0xeec5('0x78'),_0x5308a5,client9003)[_0xeec5('0x34')](function(_0x347d4c){return _0x237b60[_0xeec5('0x33')]({'read':!![],'messageId':_0x347d4c[_0xeec5('0x79')],'sentAt':moment()[_0xeec5('0x7a')](_0xeec5('0x7b'))});})['catch'](function(_0x2b46e7){logger[_0xeec5('0x27')]('%s',JSON[_0xeec5('0x26')](_0x2b46e7));return _0x237b60;});}return _0x237b60;});}return _0x237b60;}})[_0xeec5('0x34')](respondWithResult(_0x115870,0xc9))[_0xeec5('0x55')](handleError(_0x115870,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0xeec5('0x7c')]=function(_0x4dbc45,_0x59a645,_0x1511c8){var _0x43d5e4={'channel':_0xeec5('0x7d')};if(_0x4dbc45[_0xeec5('0x58')]['id']){delete _0x4dbc45[_0xeec5('0x58')]['id'];}_0x4dbc45[_0xeec5('0x58')][_0xeec5('0x7e')]=!![];_0x4dbc45[_0xeec5('0x58')][_0xeec5('0x7f')]=moment()[_0xeec5('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');_0x4dbc45[_0xeec5('0x58')][_0xeec5('0x80')]=_0x4dbc45[_0xeec5('0x58')][_0xeec5('0x80')]||_0x4dbc45[_0xeec5('0x6d')]['id'];return db[_0xeec5('0x3a')][_0xeec5('0x57')]({'where':{'id':_0x4dbc45[_0xeec5('0x59')]['id'],'UserId':null},'include':[{'model':db[_0xeec5('0x73')],'as':'Contact'}]})[_0xeec5('0x34')](handleEntityNotFound(_0x59a645,null))[_0xeec5('0x34')](saveUpdates(_0x4dbc45[_0xeec5('0x58')],null))[_0xeec5('0x34')](function(_0x5214f4){if(_0x5214f4){_0x43d5e4[_0xeec5('0x2a')]=_0x5214f4[_0xeec5('0x81')]({'plain':!![]});return db[_0xeec5('0x82')][_0xeec5('0x57')]({'where':{'id':_0x5214f4[_0xeec5('0x83')]}});}return null;})[_0xeec5('0x34')](handleEntityNotFound(_0x59a645,null))[_0xeec5('0x34')](function(_0x315479){if(_0x315479){return _0x315479['update']({'UserId':_0x4dbc45['body'][_0xeec5('0x80')],'read1stAt':_[_0xeec5('0x66')](_0x315479[_0xeec5('0x84')])?moment()[_0xeec5('0x7a')](_0xeec5('0x7b')):undefined});}return null;})[_0xeec5('0x34')](function(_0x4dd18e){if(_0x4dd18e){_0x43d5e4['interaction']=_0x4dd18e['get']({'plain':!![]});interaction_log[_0xeec5('0x85')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4dbc45['user']['id'],_0x4dbc45[_0xeec5('0x6d')][_0xeec5('0x36')],_0x4dbc45[_0xeec5('0x6d')][_0xeec5('0x86')],_0x43d5e4[_0xeec5('0x87')]['id'],_0x4dbc45[_0xeec5('0x58')]?JSON[_0xeec5('0x26')](_0x4dbc45[_0xeec5('0x58')]):'null');return respondWithRpcPromise('AcceptMessage',_0xeec5('0x88'),_0x43d5e4);}return null;})['then'](function(_0x3024bd){if(_0x3024bd){if(_0x4dbc45[_0xeec5('0x58')]['manual']){_0x43d5e4[_0xeec5('0x2a')][_0xeec5('0x89')]=util[_0xeec5('0x7a')](_0xeec5('0x8a'),_0x4dbc45['user'][_0xeec5('0x36')]);_0x43d5e4[_0xeec5('0x2a')]['channel']=_0x43d5e4[_0xeec5('0x8b')];_0x43d5e4[_0xeec5('0x2a')][_0xeec5('0x8c')]='accept';return respondWithRpcPromise('EventManager',_0xeec5('0x8d'),{'event':_0xeec5('0x8e'),'message':_0x43d5e4[_0xeec5('0x2a')]},client9002)[_0xeec5('0x34')](function(){return _0x43d5e4;});}return _0x43d5e4;}return null;})['then'](respondWithResult(_0x59a645,null))[_0xeec5('0x55')](handleError(_0x59a645,null));};var interaction_log=require(_0xeec5('0x16'))(_0xeec5('0x8f'));exports['reject']=function(_0x1bca4c,_0x362b8c,_0x240c9b){var _0x176a44={'agent':{},'channel':_0xeec5('0x7d')};if(_0x1bca4c[_0xeec5('0x58')]['id']){delete _0x1bca4c[_0xeec5('0x58')]['id'];}_0x1bca4c[_0xeec5('0x58')][_0xeec5('0x80')]=_0x1bca4c[_0xeec5('0x58')][_0xeec5('0x80')]||_0x1bca4c['user']['id'];_0x176a44[_0xeec5('0x90')]['id']=_0x1bca4c[_0xeec5('0x58')][_0xeec5('0x80')];return db[_0xeec5('0x3a')][_0xeec5('0x57')]({'where':{'id':_0x1bca4c[_0xeec5('0x59')]['id'],'UserId':null}})[_0xeec5('0x34')](handleEntityNotFound(_0x362b8c,null))['then'](function(_0x99d74f){if(_0x99d74f){_0x176a44[_0xeec5('0x2a')]=_0x99d74f['get']({'plain':!![]});return db[_0xeec5('0x82')]['find']({'where':{'id':_0x99d74f[_0xeec5('0x83')]}});}return null;})[_0xeec5('0x34')](handleEntityNotFound(_0x362b8c,null))[_0xeec5('0x34')](function(_0x14bcb0){if(_0x14bcb0){_0x176a44[_0xeec5('0x87')]=_0x14bcb0[_0xeec5('0x81')]({'plain':!![]});interaction_log['info'](_0xeec5('0x91'),_0x1bca4c[_0xeec5('0x6d')]['id'],_0x1bca4c[_0xeec5('0x6d')][_0xeec5('0x36')],_0x1bca4c[_0xeec5('0x6d')]['role'],_0x176a44['interaction']['id'],_0x1bca4c[_0xeec5('0x58')]?JSON[_0xeec5('0x26')](_0x1bca4c['body']):_0xeec5('0x92'));return respondWithRpcPromise('RejectMessage',_0xeec5('0x93'),_0x176a44);}return null;})['then'](function(_0x482ad3){if(_0x482ad3){_0x482ad3[_0xeec5('0x2a')][_0xeec5('0x89')]=util[_0xeec5('0x7a')]('SIP/%s',_0x1bca4c[_0xeec5('0x6d')][_0xeec5('0x36')]);_0x482ad3[_0xeec5('0x2a')][_0xeec5('0x8b')]=_0x176a44[_0xeec5('0x8b')];_0x482ad3[_0xeec5('0x2a')][_0xeec5('0x8c')]=_0xeec5('0x94');respondWithRpcPromise(_0xeec5('0x8d'),_0xeec5('0x8d'),{'event':'rejectmessage','message':_0x482ad3[_0xeec5('0x2a')]},client9002);return _0x176a44;}return null;})[_0xeec5('0x34')](respondWithResult(_0x362b8c,null))[_0xeec5('0x55')](handleError(_0x362b8c,null));};exports[_0xeec5('0x95')]=function(_0x12464f,_0x2b0b9f){var _0x349716=moment()[_0xeec5('0x96')]()['toString']();var _0xa2e0cb=path[_0xeec5('0x70')](config[_0xeec5('0x97')],'server',_0xeec5('0x98'),'tmp');var _0x5f4974=path[_0xeec5('0x70')](config[_0xeec5('0x97')],_0xeec5('0x99'),_0xeec5('0x98'),_0xeec5('0x6f'));var _0x1f1db6=util[_0xeec5('0x7a')]('message-%s.eml',_0x349716);return db[_0xeec5('0x3a')][_0xeec5('0x57')]({'where':{'id':_0x12464f['params']['id']},'attributes':['id','body',_0xeec5('0x9a'),'to','cc',_0xeec5('0x9b'),_0xeec5('0x9c'),_0xeec5('0x9d')],'include':_0x12464f[_0xeec5('0x41')][_0xeec5('0x6f')]?[{'model':db[_0xeec5('0x9e')],'as':'Attachments'}]:undefined})[_0xeec5('0x34')](handleEntityNotFound(_0x2b0b9f,null))[_0xeec5('0x34')](function(_0x391f94){if(_0x391f94){var _0x3d7910=_0x391f94;var _0x4e260e={'from':_0x3d7910[_0xeec5('0x9a')],'to':_0x3d7910['to'],'subject':_0x3d7910[_0xeec5('0x9c')],'html':_0x3d7910[_0xeec5('0x58')],'headers':{'Date':moment(_0x3d7910[_0xeec5('0x9d')])[_0xeec5('0x7a')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x391f94['cc']){_0x4e260e[_0xeec5('0x9f')]['Cc']=_0x391f94['cc'];}if(_0x391f94['bcc']){_0x4e260e['headers'][_0xeec5('0xa0')]=_0x391f94['bcc'];}return new BPromise(function(_0x25e0d8,_0x15f2e2){if(_0x391f94[_0xeec5('0xa1')]){for(var _0x2aad79=0x0;_0x2aad79<_0x391f94[_0xeec5('0xa1')][_0xeec5('0x46')];_0x2aad79++){var _0x44cc83=_0x391f94[_0xeec5('0xa1')][_0x2aad79];var _0x154574=path[_0xeec5('0x70')](_0x5f4974,_0x44cc83[_0xeec5('0x72')]);if(fs[_0xeec5('0xa2')](_0x154574)){_0x4e260e[_0xeec5('0x6f')][_0xeec5('0xa3')]({'name':_0x44cc83[_0xeec5('0x36')],'contentType':_0x44cc83[_0xeec5('0x3d')],'data':fs[_0xeec5('0xa4')](_0x154574)});}}}emlformat[_0xeec5('0xa5')](_0x4e260e,function(_0x3bd762,_0xaa3d7a){if(_0x3bd762)return _0x15f2e2(_0x3bd762);fs[_0xeec5('0xa6')](path['join'](_0xa2e0cb,_0x1f1db6),_0xaa3d7a);return _0x25e0d8(_0xaa3d7a);});});}})['then'](function(_0x3c1bb3){if(_0x3c1bb3){return _0x2b0b9f[_0xeec5('0x95')](path['join'](_0xa2e0cb,_0x1f1db6),_0x1f1db6,function(_0x3a25c4){if(_0x3a25c4){console['log'](_0xeec5('0xa7'),_0x3a25c4);}else{fs['unlinkSync'](path[_0xeec5('0x70')](_0xa2e0cb,_0x1f1db6));}});}})[_0xeec5('0x55')](handleError(_0x2b0b9f,null));}; \ No newline at end of file +var _0xdca4=['describe','create','direction','out','secret','split','findOne','CmList','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','isNil','service','host','secure','authentication','auth','user','pass','attachments','root','server/files/attachments','basename','Contacts','defaults','List\x20not\x20found','SendMail','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','mail-interactions','mail','read','format','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','manual','interface','SIP/%s','channel','event','accept','EventManager','reject','RejectMessage','rejectMessage','rejectmessage','join','server','files','message-%s.eml','from','createdAt','Attachment','Attachments','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','build','writeFileSync','download','log','unlinkSync','html-pdf','eml-format','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','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','MailMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','MailMessage','includeAll','include','findAll','rows','show','params','keys','length','options','body','find'];(function(_0x34ba28,_0x4d8b09){var _0x419217=function(_0x372a22){while(--_0x372a22){_0x34ba28['push'](_0x34ba28['shift']());}};_0x419217(++_0x4d8b09);}(_0xdca4,0x19e));var _0x4dca=function(_0x5ec274,_0x579cea){_0x5ec274=_0x5ec274-0x0;var _0x234dff=_0xdca4[_0x5ec274];return _0x234dff;};'use strict';var pdf=require(_0x4dca('0x0'));var emlformat=require(_0x4dca('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4dca('0x2'));var rp=require(_0x4dca('0x3'));var moment=require('moment');var BPromise=require(_0x4dca('0x4'));var Mustache=require(_0x4dca('0x5'));var util=require(_0x4dca('0x6'));var path=require(_0x4dca('0x7'));var sox=require(_0x4dca('0x8'));var csv=require(_0x4dca('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4dca('0xa'));var squel=require(_0x4dca('0xb'));var crypto=require('crypto');var jsforce=require(_0x4dca('0xc'));var deskjs=require(_0x4dca('0xd'));var toCsv=require(_0x4dca('0x9'));var querystring=require(_0x4dca('0xe'));var Papa=require(_0x4dca('0xf'));var Redis=require(_0x4dca('0x10'));var authService=require(_0x4dca('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4dca('0x12'));var hardwareService=require(_0x4dca('0x13'));var logger=require(_0x4dca('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4dca('0x15'));var db=require(_0x4dca('0x16'))['db'];config[_0x4dca('0x17')]=_['defaults'](config[_0x4dca('0x17')],{'host':_0x4dca('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4dca('0x17')]));require('./mailMessage.socket')['register'](socket);var jayson=require(_0x4dca('0x19'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson['client'][_0x4dca('0x1a')]({'port':0x232b});var client9002=jayson[_0x4dca('0x1b')][_0x4dca('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4931c7,_0x407325,_0x418413){if(_0x418413){var _0xf16b88=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xf16b88[_0x4dca('0x1c')](_0x407325)){return _0x4931c7;}else{throw new db[(_0x4dca('0x1d'))][(_0x4dca('0x1e'))](_0x4dca('0x1f'));}}else{return _0x4931c7;}}function respondWithRpcPromise(_0x5de22e,_0x43bf97,_0x2c737f,_0x2cf47e){return new BPromise(function(_0x3fdd31,_0x58389a){var _0x5a932a=_0x2cf47e||client;return _0x5a932a[_0x4dca('0x20')](_0x5de22e,_0x2c737f)[_0x4dca('0x21')](function(_0x244061){logger[_0x4dca('0x22')](_0x4dca('0x23'),_0x43bf97,'request\x20sent');logger[_0x4dca('0x24')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x43bf97,_0x4dca('0x25'),JSON[_0x4dca('0x26')](_0x244061));if(_0x244061[_0x4dca('0x27')]){if(_0x244061['error'][_0x4dca('0x28')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x43bf97,_0x244061['error']['message']);return _0x58389a(_0x244061['error'][_0x4dca('0x29')]);}logger[_0x4dca('0x27')]('MailMessage,\x20%s,\x20%s',_0x43bf97,_0x244061[_0x4dca('0x27')]['message']);return _0x3fdd31(_0x244061[_0x4dca('0x27')][_0x4dca('0x29')]);}else{logger['info'](_0x4dca('0x23'),_0x43bf97,_0x4dca('0x25'));_0x3fdd31(_0x244061[_0x4dca('0x2a')]['message']);}})[_0x4dca('0x2b')](function(_0x32ba7d){logger[_0x4dca('0x27')](_0x4dca('0x23'),_0x43bf97,_0x32ba7d);_0x58389a(_0x32ba7d);});});}function respondWithStatusCode(_0x3644c2,_0x459a63){_0x459a63=_0x459a63||0xcc;return function(_0x24b650){if(_0x24b650){return _0x3644c2[_0x4dca('0x2c')](_0x459a63);}return _0x3644c2[_0x4dca('0x2d')](_0x459a63)[_0x4dca('0x2e')]();};}function respondWithResult(_0x5a48c7,_0x244ae1){_0x244ae1=_0x244ae1||0xc8;return function(_0x13c762){if(_0x13c762){return _0x5a48c7['status'](_0x244ae1)[_0x4dca('0x2f')](_0x13c762);}};}function respondWithFilteredResult(_0xaa9663,_0x49985b){return function(_0x187ee1){if(_0x187ee1){var _0xae1b5f=_0x187ee1[_0x4dca('0x30')],_0x22057c=_0x49985b['offset'],_0x26cd46=_0x49985b[_0x4dca('0x31')]+_0x49985b[_0x4dca('0x32')],_0x4f0c84;if(_0x26cd46>=_0xae1b5f){_0x26cd46=_0xae1b5f;_0x4f0c84=0xc8;}else{_0x4f0c84=0xce;}_0xaa9663[_0x4dca('0x2d')](_0x4f0c84);return _0xaa9663[_0x4dca('0x33')](_0x4dca('0x34'),_0x22057c+'-'+_0x26cd46+'/'+_0xae1b5f)[_0x4dca('0x2f')](_0x187ee1);}return null;};}function patchUpdates(_0x4e8e30){return function(_0x52d8ae){try{jsonpatch[_0x4dca('0x35')](_0x52d8ae,_0x4e8e30,!![]);}catch(_0x4ffa73){return BPromise['reject'](_0x4ffa73);}return _0x52d8ae[_0x4dca('0x36')]();};}function saveUpdates(_0x17559e,_0x4f5b3a){return function(_0x84b1f6){if(_0x84b1f6){return _0x84b1f6[_0x4dca('0x37')](_0x17559e)[_0x4dca('0x21')](function(_0x25076a){return _0x25076a;});}return null;};}function removeEntity(_0x1280c0,_0x512b68){return function(_0x2a07d8){if(_0x2a07d8){return _0x2a07d8[_0x4dca('0x38')]()[_0x4dca('0x21')](function(){_0x1280c0[_0x4dca('0x2d')](0xcc)[_0x4dca('0x2e')]();});}};}function handleEntityNotFound(_0x488d8c,_0x24d670){return function(_0x176c70){if(!_0x176c70){_0x488d8c[_0x4dca('0x2c')](0x194);}return _0x176c70;};}function handleError(_0x56b8cb,_0x31a419){_0x31a419=_0x31a419||0x1f4;return function(_0xebd6d0){logger['error'](_0xebd6d0[_0x4dca('0x39')]);if(_0xebd6d0['name']){delete _0xebd6d0[_0x4dca('0x3a')];}_0x56b8cb[_0x4dca('0x2d')](_0x31a419)['send'](_0xebd6d0);};}exports[_0x4dca('0x3b')]=function(_0x5f2a7b,_0x2bf868){var _0x5ab66c={},_0x30b63d={},_0xf913d={'count':0x0,'rows':[]};var _0x147c5c=_[_0x4dca('0x3c')](db['MailMessage'][_0x4dca('0x3d')],function(_0x931a90){return{'name':_0x931a90[_0x4dca('0x3e')],'type':_0x931a90['type'][_0x4dca('0x3f')]};});_0x30b63d[_0x4dca('0x40')]=_[_0x4dca('0x3c')](_0x147c5c,'name');_0x30b63d[_0x4dca('0x41')]=_['keys'](_0x5f2a7b['query']);_0x30b63d[_0x4dca('0x42')]=_[_0x4dca('0x43')](_0x30b63d[_0x4dca('0x40')],_0x30b63d[_0x4dca('0x41')]);_0x5ab66c[_0x4dca('0x44')]=_[_0x4dca('0x43')](_0x30b63d[_0x4dca('0x40')],qs[_0x4dca('0x45')](_0x5f2a7b[_0x4dca('0x41')][_0x4dca('0x45')]));_0x5ab66c[_0x4dca('0x44')]=_0x5ab66c[_0x4dca('0x44')]['length']?_0x5ab66c[_0x4dca('0x44')]:_0x30b63d[_0x4dca('0x40')];if(!_0x5f2a7b[_0x4dca('0x41')][_0x4dca('0x46')](_0x4dca('0x47'))){_0x5ab66c[_0x4dca('0x32')]=qs[_0x4dca('0x32')](_0x5f2a7b[_0x4dca('0x41')][_0x4dca('0x32')]);_0x5ab66c[_0x4dca('0x31')]=qs[_0x4dca('0x31')](_0x5f2a7b['query'][_0x4dca('0x31')]);}_0x5ab66c['order']=qs[_0x4dca('0x48')](_0x5f2a7b[_0x4dca('0x41')][_0x4dca('0x48')]);_0x5ab66c[_0x4dca('0x49')]=qs[_0x4dca('0x42')](_[_0x4dca('0x4a')](_0x5f2a7b[_0x4dca('0x41')],_0x30b63d['filters']));if(_0x5f2a7b['query'][_0x4dca('0x4b')]){_0x5ab66c['where']=_[_0x4dca('0x4c')](_0x5ab66c['where'],{'$or':_['map'](_0x147c5c,function(_0xae4be2){if(_0xae4be2[_0x4dca('0x4d')]!=='VIRTUAL'){var _0x1b75ed={};_0x1b75ed[_0xae4be2[_0x4dca('0x3a')]]={'$like':'%'+_0x5f2a7b[_0x4dca('0x41')][_0x4dca('0x4b')]+'%'};return _0x1b75ed;}})});}_0x5ab66c=_[_0x4dca('0x4c')]({},_0x5ab66c,_0x5f2a7b['options']);var _0x12fb78={'where':_0x5ab66c[_0x4dca('0x49')]};return db[_0x4dca('0x4e')][_0x4dca('0x30')](_0x12fb78)['then'](function(_0x54bb5a){_0xf913d[_0x4dca('0x30')]=_0x54bb5a;if(_0x5f2a7b['query'][_0x4dca('0x4f')]){_0x5ab66c[_0x4dca('0x50')]=[{'all':!![]}];}return db[_0x4dca('0x4e')][_0x4dca('0x51')](_0x5ab66c);})[_0x4dca('0x21')](function(_0x17a25a){_0xf913d[_0x4dca('0x52')]=_0x17a25a;return _0xf913d;})[_0x4dca('0x21')](respondWithFilteredResult(_0x2bf868,_0x5ab66c))[_0x4dca('0x2b')](handleError(_0x2bf868,null));};exports[_0x4dca('0x53')]=function(_0x194361,_0x25c95a){var _0x34b220={'raw':!![],'where':{'id':_0x194361[_0x4dca('0x54')]['id']}},_0x44be8d={};_0x44be8d['model']=_[_0x4dca('0x55')](db[_0x4dca('0x4e')]['rawAttributes']);_0x44be8d[_0x4dca('0x41')]=_[_0x4dca('0x55')](_0x194361[_0x4dca('0x41')]);_0x44be8d[_0x4dca('0x42')]=_['intersection'](_0x44be8d[_0x4dca('0x40')],_0x44be8d[_0x4dca('0x41')]);_0x34b220['attributes']=_[_0x4dca('0x43')](_0x44be8d['model'],qs[_0x4dca('0x45')](_0x194361[_0x4dca('0x41')]['fields']));_0x34b220['attributes']=_0x34b220['attributes'][_0x4dca('0x56')]?_0x34b220[_0x4dca('0x44')]:_0x44be8d['model'];if(_0x194361['query'][_0x4dca('0x4f')]){_0x34b220[_0x4dca('0x50')]=[{'all':!![]}];}_0x34b220=_[_0x4dca('0x4c')]({},_0x34b220,_0x194361[_0x4dca('0x57')]);return db[_0x4dca('0x4e')]['find'](_0x34b220)[_0x4dca('0x21')](handleEntityNotFound(_0x25c95a,null))[_0x4dca('0x21')](respondWithResult(_0x25c95a,null))[_0x4dca('0x2b')](handleError(_0x25c95a,null));};exports['update']=function(_0x27ce7f,_0x36a46b){if(_0x27ce7f[_0x4dca('0x58')]['id']){delete _0x27ce7f[_0x4dca('0x58')]['id'];}return db[_0x4dca('0x4e')][_0x4dca('0x59')]({'where':{'id':_0x27ce7f['params']['id']}})[_0x4dca('0x21')](handleEntityNotFound(_0x36a46b,null))[_0x4dca('0x21')](saveUpdates(_0x27ce7f['body'],null))[_0x4dca('0x21')](respondWithResult(_0x36a46b,null))[_0x4dca('0x2b')](handleError(_0x36a46b,null));};exports[_0x4dca('0x38')]=function(_0x5b7c7b,_0x4ae6cd){return db[_0x4dca('0x4e')][_0x4dca('0x59')]({'where':{'id':_0x5b7c7b['params']['id']}})[_0x4dca('0x21')](handleEntityNotFound(_0x4ae6cd,null))[_0x4dca('0x21')](removeEntity(_0x4ae6cd,null))[_0x4dca('0x2b')](handleError(_0x4ae6cd,null));};exports[_0x4dca('0x5a')]=function(_0x43f374,_0x3415a0){return db[_0x4dca('0x4e')][_0x4dca('0x5a')]()['then'](respondWithResult(_0x3415a0,null))[_0x4dca('0x2b')](handleError(_0x3415a0,null));};exports[_0x4dca('0x5b')]=function(_0x4e88e8,_0x315833){return db[_0x4dca('0x4e')]['create'](_0x4e88e8[_0x4dca('0x58')])['then'](function(_0x475a6e){if(_0x475a6e){if(_0x475a6e[_0x4dca('0x5c')]===_0x4dca('0x5d')&&!_0x475a6e[_0x4dca('0x5e')]){var _0x51ad92,_0x150172,_0x5a7c36;if(_0x4e88e8[_0x4dca('0x58')]['to']){_0x150172=_0x4e88e8[_0x4dca('0x58')]['to'][_0x4dca('0x5f')](',')[0x0];}return db['MailAccount'][_0x4dca('0x60')]({'where':{'id':_0x475a6e['MailAccountId']},'include':[{'model':db[_0x4dca('0x61')],'as':_0x4dca('0x62'),'include':[{'model':db[_0x4dca('0x63')],'as':'Contacts','where':{'email':_0x150172},'limit':0x1,'order':[[_0x4dca('0x64'),_0x4dca('0x65')]]}]},{'model':db[_0x4dca('0x66')],'as':'Smtp','raw':!![]}]})['then'](function(_0x46be52){_0x51ad92=_0x46be52;if(_0x51ad92&&_0x51ad92[_0x4dca('0x67')]){var _0x404097={'tls':{'rejectUnauthorized':![]}};if(_[_0x4dca('0x68')](_0x51ad92[_0x4dca('0x67')][_0x4dca('0x69')])){_0x404097[_0x4dca('0x6a')]=_0x51ad92[_0x4dca('0x67')][_0x4dca('0x6a')];_0x404097['port']=_0x51ad92['Smtp']['port'];_0x404097[_0x4dca('0x6b')]=_0x51ad92[_0x4dca('0x67')][_0x4dca('0x6b')];if(_0x51ad92[_0x4dca('0x67')][_0x4dca('0x6c')]){_0x404097[_0x4dca('0x6d')]={'user':_0x51ad92[_0x4dca('0x67')][_0x4dca('0x6e')],'pass':_0x51ad92[_0x4dca('0x67')]['pass']};}}else{_0x404097[_0x4dca('0x69')]=_0x51ad92[_0x4dca('0x67')]['service'];_0x404097['auth']={'user':_0x51ad92[_0x4dca('0x67')][_0x4dca('0x6e')],'pass':_0x51ad92[_0x4dca('0x67')][_0x4dca('0x6f')]};_0x404097['secure']=_0x51ad92['Smtp'][_0x4dca('0x6b')];}if(_0x4e88e8[_0x4dca('0x58')][_0x4dca('0x70')]&&_0x4e88e8[_0x4dca('0x58')][_0x4dca('0x70')]['length']){for(var _0xe22e96=0x0;_0xe22e96<_0x4e88e8[_0x4dca('0x58')]['attachments'][_0x4dca('0x56')];_0xe22e96+=0x1){_0x4e88e8[_0x4dca('0x58')][_0x4dca('0x70')][_0xe22e96]={'filename':_0x4e88e8[_0x4dca('0x58')]['attachments'][_0xe22e96][_0x4dca('0x3a')],'path':path['join'](config[_0x4dca('0x71')],_0x4dca('0x72'),_0x4e88e8[_0x4dca('0x58')][_0x4dca('0x70')][_0xe22e96][_0x4dca('0x73')])};}}_0x5a7c36={'account':_0x404097,'message':_0x4e88e8[_0x4dca('0x58')]};return;}})[_0x4dca('0x21')](function(){if(_0x51ad92[_0x4dca('0x62')]){if(_0x51ad92[_0x4dca('0x62')][_0x4dca('0x74')][_0x4dca('0x56')]){return _0x51ad92[_0x4dca('0x62')][_0x4dca('0x74')][0x0];}else{return db['CmContact'][_0x4dca('0x5b')](_[_0x4dca('0x75')](_0x4e88e8[_0x4dca('0x58')],{'firstName':_0x4e88e8['body']['to'],'email':_0x4e88e8[_0x4dca('0x58')]['to'],'phone':_0x4e88e8[_0x4dca('0x58')]['to'],'ListId':_0x51ad92['ListId']}));}}else{throw new Error(_0x4dca('0x76'));}})['then'](function(){if(_0x5a7c36){return respondWithRpcPromise(_0x4dca('0x77'),_0x4dca('0x78'),_0x5a7c36,client9003)[_0x4dca('0x21')](function(_0x4508b2){return _0x475a6e[_0x4dca('0x37')]({'read':!![],'messageId':_0x4508b2[_0x4dca('0x79')],'sentAt':moment()['format'](_0x4dca('0x7a'))});})[_0x4dca('0x2b')](function(_0x1f3d5f){logger[_0x4dca('0x27')]('%s',JSON[_0x4dca('0x26')](_0x1f3d5f));return _0x475a6e;});}return _0x475a6e;});}return _0x475a6e;}})[_0x4dca('0x21')](respondWithResult(_0x315833,0xc9))[_0x4dca('0x2b')](handleError(_0x315833,null));};var interaction_log=require(_0x4dca('0x14'))(_0x4dca('0x7b'));exports['accept']=function(_0x28ad9e,_0x2215d2,_0xef3952){var _0x1ce7da={'channel':_0x4dca('0x7c')};if(_0x28ad9e[_0x4dca('0x58')]['id']){delete _0x28ad9e['body']['id'];}_0x28ad9e[_0x4dca('0x58')][_0x4dca('0x7d')]=!![];_0x28ad9e['body']['readAt']=moment()[_0x4dca('0x7e')](_0x4dca('0x7a'));_0x28ad9e[_0x4dca('0x58')]['UserId']=_0x28ad9e[_0x4dca('0x58')][_0x4dca('0x7f')]||_0x28ad9e[_0x4dca('0x6e')]['id'];return db['MailMessage'][_0x4dca('0x59')]({'where':{'id':_0x28ad9e['params']['id'],'UserId':null},'include':[{'model':db[_0x4dca('0x63')],'as':_0x4dca('0x80')}]})[_0x4dca('0x21')](handleEntityNotFound(_0x2215d2,null))[_0x4dca('0x21')](saveUpdates(_0x28ad9e[_0x4dca('0x58')],null))[_0x4dca('0x21')](function(_0x5344ee){if(_0x5344ee){_0x1ce7da[_0x4dca('0x29')]=_0x5344ee[_0x4dca('0x81')]({'plain':!![]});return db[_0x4dca('0x82')]['find']({'where':{'id':_0x5344ee[_0x4dca('0x83')]}});}return null;})['then'](handleEntityNotFound(_0x2215d2,null))['then'](function(_0x5bd4d8){if(_0x5bd4d8){return _0x5bd4d8[_0x4dca('0x37')]({'UserId':_0x28ad9e['body']['UserId'],'read1stAt':_[_0x4dca('0x68')](_0x5bd4d8[_0x4dca('0x84')])?moment()[_0x4dca('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4dca('0x21')](function(_0x16402c){if(_0x16402c){_0x1ce7da[_0x4dca('0x85')]=_0x16402c['get']({'plain':!![]});interaction_log[_0x4dca('0x22')](_0x4dca('0x86'),_0x28ad9e[_0x4dca('0x6e')]['id'],_0x28ad9e[_0x4dca('0x6e')][_0x4dca('0x3a')],_0x28ad9e[_0x4dca('0x6e')][_0x4dca('0x87')],_0x1ce7da[_0x4dca('0x85')]['id'],_0x28ad9e[_0x4dca('0x58')]?JSON[_0x4dca('0x26')](_0x28ad9e[_0x4dca('0x58')]):_0x4dca('0x88'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x1ce7da);}return null;})['then'](function(_0x57ff89){if(_0x57ff89){if(_0x28ad9e['body'][_0x4dca('0x89')]){_0x1ce7da['message'][_0x4dca('0x8a')]=util[_0x4dca('0x7e')](_0x4dca('0x8b'),_0x28ad9e[_0x4dca('0x6e')][_0x4dca('0x3a')]);_0x1ce7da[_0x4dca('0x29')]['channel']=_0x1ce7da[_0x4dca('0x8c')];_0x1ce7da[_0x4dca('0x29')][_0x4dca('0x8d')]=_0x4dca('0x8e');return respondWithRpcPromise('EventManager',_0x4dca('0x8f'),{'event':'acceptmessage','message':_0x1ce7da[_0x4dca('0x29')]},client9002)[_0x4dca('0x21')](function(){return _0x1ce7da;});}return _0x1ce7da;}return null;})[_0x4dca('0x21')](respondWithResult(_0x2215d2,null))['catch'](handleError(_0x2215d2,null));};var interaction_log=require('../../config/logger')(_0x4dca('0x7b'));exports[_0x4dca('0x90')]=function(_0x4b190d,_0x46ac34,_0x2452e0){var _0x45ebb2={'agent':{},'channel':'mail'};if(_0x4b190d[_0x4dca('0x58')]['id']){delete _0x4b190d[_0x4dca('0x58')]['id'];}_0x4b190d[_0x4dca('0x58')][_0x4dca('0x7f')]=_0x4b190d[_0x4dca('0x58')][_0x4dca('0x7f')]||_0x4b190d[_0x4dca('0x6e')]['id'];_0x45ebb2['agent']['id']=_0x4b190d[_0x4dca('0x58')][_0x4dca('0x7f')];return db['MailMessage'][_0x4dca('0x59')]({'where':{'id':_0x4b190d[_0x4dca('0x54')]['id'],'UserId':null}})[_0x4dca('0x21')](handleEntityNotFound(_0x46ac34,null))[_0x4dca('0x21')](function(_0x12d27c){if(_0x12d27c){_0x45ebb2[_0x4dca('0x29')]=_0x12d27c['get']({'plain':!![]});return db[_0x4dca('0x82')][_0x4dca('0x59')]({'where':{'id':_0x12d27c[_0x4dca('0x83')]}});}return null;})[_0x4dca('0x21')](handleEntityNotFound(_0x46ac34,null))[_0x4dca('0x21')](function(_0x57be3d){if(_0x57be3d){_0x45ebb2[_0x4dca('0x85')]=_0x57be3d[_0x4dca('0x81')]({'plain':!![]});interaction_log[_0x4dca('0x22')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4b190d['user']['id'],_0x4b190d['user'][_0x4dca('0x3a')],_0x4b190d['user'][_0x4dca('0x87')],_0x45ebb2[_0x4dca('0x85')]['id'],_0x4b190d[_0x4dca('0x58')]?JSON[_0x4dca('0x26')](_0x4b190d[_0x4dca('0x58')]):_0x4dca('0x88'));return respondWithRpcPromise(_0x4dca('0x91'),_0x4dca('0x92'),_0x45ebb2);}return null;})[_0x4dca('0x21')](function(_0x44cab3){if(_0x44cab3){_0x44cab3[_0x4dca('0x29')][_0x4dca('0x8a')]=util[_0x4dca('0x7e')](_0x4dca('0x8b'),_0x4b190d[_0x4dca('0x6e')][_0x4dca('0x3a')]);_0x44cab3[_0x4dca('0x29')]['channel']=_0x45ebb2[_0x4dca('0x8c')];_0x44cab3['message']['event']=_0x4dca('0x90');respondWithRpcPromise(_0x4dca('0x8f'),_0x4dca('0x8f'),{'event':_0x4dca('0x93'),'message':_0x44cab3[_0x4dca('0x29')]},client9002);return _0x45ebb2;}return null;})[_0x4dca('0x21')](respondWithResult(_0x46ac34,null))[_0x4dca('0x2b')](handleError(_0x46ac34,null));};exports['download']=function(_0x4921dc,_0x10a8ab){var _0x3379e6=moment()['unix']()['toString']();var _0x586c25=path[_0x4dca('0x94')](config[_0x4dca('0x71')],_0x4dca('0x95'),_0x4dca('0x96'),'tmp');var _0x102081=path['join'](config['root'],_0x4dca('0x95'),_0x4dca('0x96'),_0x4dca('0x70'));var _0xfc3334=util[_0x4dca('0x7e')](_0x4dca('0x97'),_0x3379e6);return db[_0x4dca('0x4e')][_0x4dca('0x59')]({'where':{'id':_0x4921dc['params']['id']},'attributes':['id',_0x4dca('0x58'),_0x4dca('0x98'),'to','cc','bcc','subject',_0x4dca('0x99')],'include':_0x4921dc[_0x4dca('0x41')][_0x4dca('0x70')]?[{'model':db[_0x4dca('0x9a')],'as':_0x4dca('0x9b')}]:undefined})[_0x4dca('0x21')](handleEntityNotFound(_0x10a8ab,null))['then'](function(_0x849a30){if(_0x849a30){var _0x7c645e=_0x849a30;var _0x45384d={'from':_0x7c645e[_0x4dca('0x98')],'to':_0x7c645e['to'],'subject':_0x7c645e[_0x4dca('0x9c')],'html':_0x7c645e[_0x4dca('0x58')],'headers':{'Date':moment(_0x7c645e[_0x4dca('0x99')])['format'](_0x4dca('0x9d'))},'attachments':[]};if(_0x849a30['cc']){_0x45384d[_0x4dca('0x9e')]['Cc']=_0x849a30['cc'];}if(_0x849a30[_0x4dca('0x9f')]){_0x45384d[_0x4dca('0x9e')][_0x4dca('0xa0')]=_0x849a30['bcc'];}return new BPromise(function(_0x30781b,_0x222a81){if(_0x849a30[_0x4dca('0x9b')]){for(var _0x48d1e5=0x0;_0x48d1e5<_0x849a30['Attachments'][_0x4dca('0x56')];_0x48d1e5++){var _0x8e62c3=_0x849a30['Attachments'][_0x48d1e5];var _0x1de4a3=path[_0x4dca('0x94')](_0x102081,_0x8e62c3[_0x4dca('0x73')]);if(fs[_0x4dca('0xa1')](_0x1de4a3)){_0x45384d['attachments'][_0x4dca('0xa2')]({'name':_0x8e62c3['name'],'contentType':_0x8e62c3[_0x4dca('0x4d')],'data':fs['readFileSync'](_0x1de4a3)});}}}emlformat[_0x4dca('0xa3')](_0x45384d,function(_0x53d925,_0x45c379){if(_0x53d925)return _0x222a81(_0x53d925);fs[_0x4dca('0xa4')](path['join'](_0x586c25,_0xfc3334),_0x45c379);return _0x30781b(_0x45c379);});});}})['then'](function(_0x3ad342){if(_0x3ad342){return _0x10a8ab[_0x4dca('0xa5')](path[_0x4dca('0x94')](_0x586c25,_0xfc3334),_0xfc3334,function(_0x381bc){if(_0x381bc){console[_0x4dca('0xa6')]('err',_0x381bc);}else{fs[_0x4dca('0xa7')](path[_0x4dca('0x94')](_0x586c25,_0xfc3334));}});}})[_0x4dca('0x2b')](handleError(_0x10a8ab,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index fde51b1..fdde966 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 _0xb403=['exports','events','../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0xb403,0xf1));var _0x3b40=function(_0x1c37fe,_0x10a098){_0x1c37fe=_0x1c37fe-0x0;var _0x45e904=_0xb403[_0x1c37fe];return _0x45e904;};'use strict';var EventEmitter=require(_0x3b40('0x0'));var MailMessage=require(_0x3b40('0x1'))['db'][_0x3b40('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3b40('0x3'),'afterUpdate':_0x3b40('0x4'),'afterDestroy':_0x3b40('0x5')};function emitEvent(_0x21e554){return function(_0x27722f,_0x414e30,_0x35e197){MailMessageEvents[_0x3b40('0x6')](_0x21e554+':'+_0x27722f['id'],_0x27722f);MailMessageEvents[_0x3b40('0x6')](_0x21e554,_0x27722f);_0x35e197(null);};}for(var e in events){if(events[_0x3b40('0x7')](e)){var event=events[e];MailMessage[_0x3b40('0x8')](e,emitEvent(event));}}module[_0x3b40('0x9')]=MailMessageEvents; \ No newline at end of file +var _0xeaad=['hasOwnProperty','events','../../mysqldb','MailMessage','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeaad,0x163));var _0xdeaa=function(_0x4e0070,_0x260d2a){_0x4e0070=_0x4e0070-0x0;var _0x59655e=_0xeaad[_0x4e0070];return _0x59655e;};'use strict';var EventEmitter=require(_0xdeaa('0x0'));var MailMessage=require(_0xdeaa('0x1'))['db'][_0xdeaa('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdeaa('0x3'),'afterUpdate':_0xdeaa('0x4'),'afterDestroy':'remove'};function emitEvent(_0x54b8e3){return function(_0x57efdc,_0x484f60,_0x58a14f){MailMessageEvents['emit'](_0x54b8e3+':'+_0x57efdc['id'],_0x57efdc);MailMessageEvents['emit'](_0x54b8e3,_0x57efdc);_0x58a14f(null);};}for(var e in events){if(events[_0xdeaa('0x5')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 833623a..c68f04e 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 _0x6f56=['plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','html-to-text','./mailMessage.attributes','exports','MailMessage','messageId','fti_mail_messages'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x6f56,0xc7));var _0x66f5=function(_0x280fb3,_0x33d9a5){_0x280fb3=_0x280fb3-0x0;var _0x52f8bf=_0x6f56[_0x280fb3];return _0x52f8bf;};'use strict';var _=require(_0x66f5('0x0'));var util=require('util');var logger=require(_0x66f5('0x1'))(_0x66f5('0x2'));var moment=require('moment');var BPromise=require(_0x66f5('0x3'));var rp=require(_0x66f5('0x4'));var htmlToText=require(_0x66f5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x66f5('0x6'));module[_0x66f5('0x7')]=function(_0x958c16,_0x90a30e){return _0x958c16['define'](_0x66f5('0x8'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x66f5('0x9'),'fields':[_0x66f5('0x9')]},{'name':_0x66f5('0xa'),'fields':[_0x66f5('0xb'),_0x66f5('0xc')],'type':_0x66f5('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3770cb,_0x25803d,_0x5300bb){if(_0x3770cb[_0x66f5('0xe')]){_0x3770cb[_0x66f5('0xb')]=htmlToText[_0x66f5('0xf')](_0x3770cb[_0x66f5('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5300bb(null,_0x25803d);},'afterCreate':function(_0x25d7e4,_0x1c3e39,_0x407daa){var _0x173403=_0x958c16[_0x66f5('0x10')];var _0x149ee7=_0x25d7e4['get']({'plain':!![]});if(_0x149ee7[_0x66f5('0x11')][_0x66f5('0x12')]()==='in'||_0x149ee7['direction'][_0x66f5('0x12')]()===_0x66f5('0x13')&&!_0x149ee7[_0x66f5('0x14')]&&!_['isNil'](_0x149ee7[_0x66f5('0x15')])){_0x173403[_0x66f5('0x16')][_0x66f5('0x17')]({'where':{'id':_0x149ee7[_0x66f5('0x18')]}})[_0x66f5('0x19')](function(_0x3739c0){if(_0x3739c0){_0x3739c0[_0x66f5('0x1a')]({'lastMsgAt':_0x149ee7[_0x66f5('0x1b')],'lastMsgDirection':_0x149ee7['direction'][_0x66f5('0x12')](),'lastMsgBody':_0x149ee7[_0x66f5('0xe')]});}})['catch'](function(_0x378ecc){console[_0x66f5('0x1c')](_0x378ecc);});}_0x407daa();}},'charset':_0x66f5('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1b3a=['html-to-text','path','../../config/environment','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise'];(function(_0x1b87e5,_0x19a375){var _0x9bd700=function(_0x19d7ce){while(--_0x19d7ce){_0x1b87e5['push'](_0x1b87e5['shift']());}};_0x9bd700(++_0x19a375);}(_0x1b3a,0x132));var _0xa1b3=function(_0x48c2ad,_0x43a610){_0x48c2ad=_0x48c2ad-0x0;var _0x356dcd=_0x1b3a[_0x48c2ad];return _0x356dcd;};'use strict';var _=require(_0xa1b3('0x0'));var util=require('util');var logger=require(_0xa1b3('0x1'))(_0xa1b3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa1b3('0x3'));var htmlToText=require(_0xa1b3('0x4'));var fs=require('fs');var path=require(_0xa1b3('0x5'));var rimraf=require('rimraf');var config=require(_0xa1b3('0x6'));var attributes=require(_0xa1b3('0x7'));module['exports']=function(_0x2dbf51,_0x14c9ea){return _0x2dbf51[_0xa1b3('0x8')](_0xa1b3('0x9'),attributes,{'tableName':_0xa1b3('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa1b3('0xb')]},{'name':_0xa1b3('0xc'),'fields':[_0xa1b3('0xd'),_0xa1b3('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23e6e3,_0x16bdc2,_0x5a8000){if(_0x23e6e3[_0xa1b3('0xf')]){_0x23e6e3[_0xa1b3('0xd')]=htmlToText['fromString'](_0x23e6e3[_0xa1b3('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5a8000(null,_0x16bdc2);},'afterCreate':function(_0x41b229,_0x530bb9,_0x3fc276){var _0x458583=_0x2dbf51['models'];var _0xbcd37c=_0x41b229[_0xa1b3('0x10')]({'plain':!![]});if(_0xbcd37c[_0xa1b3('0x11')][_0xa1b3('0x12')]()==='in'||_0xbcd37c[_0xa1b3('0x11')][_0xa1b3('0x12')]()==='out'&&!_0xbcd37c[_0xa1b3('0x13')]&&!_[_0xa1b3('0x14')](_0xbcd37c[_0xa1b3('0x15')])){_0x458583[_0xa1b3('0x16')][_0xa1b3('0x17')]({'where':{'id':_0xbcd37c[_0xa1b3('0x18')]}})[_0xa1b3('0x19')](function(_0x2bc9ae){if(_0x2bc9ae){_0x2bc9ae['update']({'lastMsgAt':_0xbcd37c[_0xa1b3('0x1a')],'lastMsgDirection':_0xbcd37c[_0xa1b3('0x11')][_0xa1b3('0x12')](),'lastMsgBody':_0xbcd37c[_0xa1b3('0xf')]});}})[_0xa1b3('0x1b')](function(_0x2d2eb3){console[_0xa1b3('0x1c')](_0x2d2eb3);});}_0x3fc276();}},'charset':_0xa1b3('0x1d'),'collate':_0xa1b3('0x1e')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index cfed610..0e36657 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 _0x510e=['stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s'];(function(_0x47eb27,_0x22d4fc){var _0xe8cae8=function(_0x2fd189){while(--_0x2fd189){_0x47eb27['push'](_0x47eb27['shift']());}};_0xe8cae8(++_0x22d4fc);}(_0x510e,0x1ed));var _0xe510=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x510e[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0xe510('0x0'));var util=require(_0xe510('0x1'));var moment=require(_0xe510('0x2'));var BPromise=require(_0xe510('0x3'));var rs=require(_0xe510('0x4'));var fs=require('fs');var Redis=require(_0xe510('0x5'));var db=require(_0xe510('0x6'))['db'];var utils=require(_0xe510('0x7'));var logger=require(_0xe510('0x8'))('rpc');var config=require(_0xe510('0x9'));var jayson=require(_0xe510('0xa'));var client=jayson[_0xe510('0xb')][_0xe510('0xc')]({'port':0x232a});config[_0xe510('0xd')]=_[_0xe510('0xe')](config[_0xe510('0xd')],{'host':_0xe510('0xf'),'port':0x18eb});var socket=require(_0xe510('0x10'))(new Redis(config[_0xe510('0xd')]));require(_0xe510('0x11'))[_0xe510('0x12')](socket);function respondWithRpcPromise(_0x2f28c1,_0x149f35,_0x521561){return new BPromise(function(_0x23de7b,_0x34ee7d){return client[_0xe510('0x13')](_0x2f28c1,_0x521561)[_0xe510('0x14')](function(_0x46445a){logger[_0xe510('0x15')]('MailMessage,\x20%s,\x20%s',_0x149f35,_0xe510('0x16'));logger[_0xe510('0x17')](_0xe510('0x18'),_0x149f35,_0xe510('0x16'),JSON[_0xe510('0x19')](_0x46445a));if(_0x46445a[_0xe510('0x1a')]){if(_0x46445a[_0xe510('0x1a')][_0xe510('0x1b')]===0x1f4){logger[_0xe510('0x1a')](_0xe510('0x1c'),_0x149f35,_0x46445a[_0xe510('0x1a')][_0xe510('0x1d')]);return _0x34ee7d(_0x46445a['error'][_0xe510('0x1d')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x149f35,_0x46445a[_0xe510('0x1a')][_0xe510('0x1d')]);return _0x23de7b(_0x46445a[_0xe510('0x1a')][_0xe510('0x1d')]);}else{logger[_0xe510('0x15')](_0xe510('0x1c'),_0x149f35,_0xe510('0x16'));_0x23de7b(_0x46445a[_0xe510('0x1e')]['message']);}})[_0xe510('0x1f')](function(_0x421de0){logger[_0xe510('0x1a')](_0xe510('0x1c'),_0x149f35,_0x421de0);_0x34ee7d(_0x421de0);});});}exports[_0xe510('0x20')]=function(_0x228d03){var _0x3ac39c=this;return new Promise(function(_0x55222e,_0xd3237){return db[_0xe510('0x21')]['create'](_0x228d03[_0xe510('0x22')],{'raw':_0x228d03[_0xe510('0x23')]?_0x228d03['options'][_0xe510('0x24')]===undefined?!![]:![]:!![]})[_0xe510('0x14')](function(_0x4a0c3d){logger[_0xe510('0x15')](_0xe510('0x20'),_0x228d03);logger[_0xe510('0x17')](_0xe510('0x20'),_0x228d03,JSON[_0xe510('0x19')](_0x4a0c3d));_0x55222e(_0x4a0c3d);})['catch'](function(_0x3c3b0a){logger['error']('CreateMailMessage',_0x3c3b0a['message'],_0x228d03);_0xd3237(_0x3ac39c[_0xe510('0x1a')](0x1f4,_0x3c3b0a[_0xe510('0x1d')]));});});}; \ No newline at end of file +var _0xcaf2=['MailMessage','create','body','options','raw','then','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage'];(function(_0x485d7b,_0x3f3b52){var _0x899877=function(_0x34639c){while(--_0x34639c){_0x485d7b['push'](_0x485d7b['shift']());}};_0x899877(++_0x3f3b52);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2f6c3e,_0x579279){_0x2f6c3e=_0x2f6c3e-0x0;var _0x5bd3b0=_0xcaf2[_0x2f6c3e];return _0x5bd3b0;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});config[_0x2caf('0x9')]=_[_0x2caf('0xa')](config[_0x2caf('0x9')],{'host':_0x2caf('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2caf('0x9')]));require(_0x2caf('0xc'))[_0x2caf('0xd')](socket);function respondWithRpcPromise(_0x1ff859,_0x219d0f,_0x438434){return new BPromise(function(_0x1b20e3,_0x3b5631){return client[_0x2caf('0xe')](_0x1ff859,_0x438434)['then'](function(_0xd56396){logger[_0x2caf('0xf')](_0x2caf('0x10'),_0x219d0f,_0x2caf('0x11'));logger[_0x2caf('0x12')](_0x2caf('0x13'),_0x219d0f,_0x2caf('0x11'),JSON[_0x2caf('0x14')](_0xd56396));if(_0xd56396['error']){if(_0xd56396[_0x2caf('0x15')][_0x2caf('0x16')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x219d0f,_0xd56396['error'][_0x2caf('0x17')]);return _0x3b5631(_0xd56396['error'][_0x2caf('0x17')]);}logger[_0x2caf('0x15')](_0x2caf('0x10'),_0x219d0f,_0xd56396[_0x2caf('0x15')]['message']);return _0x1b20e3(_0xd56396[_0x2caf('0x15')]['message']);}else{logger[_0x2caf('0xf')]('MailMessage,\x20%s,\x20%s',_0x219d0f,'request\x20sent');_0x1b20e3(_0xd56396[_0x2caf('0x18')]['message']);}})[_0x2caf('0x19')](function(_0x9c7302){logger['error'](_0x2caf('0x10'),_0x219d0f,_0x9c7302);_0x3b5631(_0x9c7302);});});}exports[_0x2caf('0x1a')]=function(_0x6b3778){var _0x255c08=this;return new Promise(function(_0x20f7d3,_0x595f2f){return db[_0x2caf('0x1b')][_0x2caf('0x1c')](_0x6b3778[_0x2caf('0x1d')],{'raw':_0x6b3778[_0x2caf('0x1e')]?_0x6b3778[_0x2caf('0x1e')][_0x2caf('0x1f')]===undefined?!![]:![]:!![]})[_0x2caf('0x20')](function(_0x256cc4){logger[_0x2caf('0xf')](_0x2caf('0x1a'),_0x6b3778);logger[_0x2caf('0x12')]('CreateMailMessage',_0x6b3778,JSON[_0x2caf('0x14')](_0x256cc4));_0x20f7d3(_0x256cc4);})[_0x2caf('0x19')](function(_0x1f29b0){logger[_0x2caf('0x15')](_0x2caf('0x1a'),_0x1f29b0[_0x2caf('0x17')],_0x6b3778);_0x595f2f(_0x255c08[_0x2caf('0x15')](0x1f4,_0x1f29b0[_0x2caf('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 13fc091..7b89a3f 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 _0x5ee0=['update','emit','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x29f0f6,_0x28b548){var _0x333dfc=function(_0x3add8b){while(--_0x3add8b){_0x29f0f6['push'](_0x29f0f6['shift']());}};_0x333dfc(++_0x28b548);}(_0x5ee0,0x17e));var _0x05ee=function(_0x416450,_0x21192f){_0x416450=_0x416450-0x0;var _0x25e359=_0x5ee0[_0x416450];return _0x25e359;};'use strict';var MailMessageEvents=require(_0x05ee('0x0'));var events=[_0x05ee('0x1'),_0x05ee('0x2'),_0x05ee('0x3')];function createListener(_0x13e339,_0x25180c){return function(_0x46786b){_0x25180c[_0x05ee('0x4')](_0x13e339,_0x46786b);};}function removeListener(_0x503ba1,_0x48a7eb){return function(){MailMessageEvents['removeListener'](_0x503ba1,_0x48a7eb);};}exports['register']=function(_0x530802){for(var _0x32fd61=0x0,_0x232aff=events[_0x05ee('0x5')];_0x32fd61<_0x232aff;_0x32fd61++){var _0x57dd68=events[_0x32fd61];var _0x304238=createListener(_0x05ee('0x6')+_0x57dd68,_0x530802);MailMessageEvents['on'](_0x57dd68,_0x304238);}}; \ No newline at end of file +var _0x453a=['save','emit','removeListener','register','length','mailMessage:','./mailMessage.events'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x453a,0x8b));var _0xa453=function(_0x2a7812,_0x1ce83a){_0x2a7812=_0x2a7812-0x0;var _0x3e1342=_0x453a[_0x2a7812];return _0x3e1342;};'use strict';var MailMessageEvents=require(_0xa453('0x0'));var events=[_0xa453('0x1'),'remove','update'];function createListener(_0x964877,_0x382b33){return function(_0x3e09ea){_0x382b33[_0xa453('0x2')](_0x964877,_0x3e09ea);};}function removeListener(_0x24d284,_0x1d24a9){return function(){MailMessageEvents[_0xa453('0x3')](_0x24d284,_0x1d24a9);};}exports[_0xa453('0x4')]=function(_0x5bf452){for(var _0x394f72=0x0,_0xd21183=events[_0xa453('0x5')];_0x394f72<_0xd21183;_0x394f72++){var _0x4f83de=events[_0x394f72];var _0xa06651=createListener(_0xa453('0x6')+_0x4f83de,_0x5bf452);MailMessageEvents['on'](_0x4f83de,_0xa06651);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index d43058d..bbf6d77 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 _0xae7f=['/:id/members','/:id/teams','getTeams','/:id/users','post','create','addTeams','delete','removeTeams','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x3d84b6,_0x8f2138){var _0xc9b1b8=function(_0x3bc611){while(--_0x3bc611){_0x3d84b6['push'](_0x3d84b6['shift']());}};_0xc9b1b8(++_0x8f2138);}(_0xae7f,0x136));var _0xfae7=function(_0x16ecc5,_0x29b1f4){_0x16ecc5=_0x16ecc5-0x0;var _0x4bca5a=_0xae7f[_0x16ecc5];return _0x4bca5a;};'use strict';var multer=require('multer');var util=require(_0xfae7('0x0'));var path=require(_0xfae7('0x1'));var timeout=require('connect-timeout');var express=require(_0xfae7('0x2'));var router=express[_0xfae7('0x3')]();var auth=require(_0xfae7('0x4'));var interaction=require(_0xfae7('0x5'));var config=require(_0xfae7('0x6'));var controller=require(_0xfae7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xfae7('0x8')]);router[_0xfae7('0x9')](_0xfae7('0xa'),auth[_0xfae7('0xb')](),controller[_0xfae7('0xc')]);router['get'](_0xfae7('0xd'),auth[_0xfae7('0xb')](),controller[_0xfae7('0xe')]);router['get'](_0xfae7('0xf'),auth[_0xfae7('0xb')](),controller['getMembers']);router[_0xfae7('0x9')](_0xfae7('0x10'),auth[_0xfae7('0xb')](),controller[_0xfae7('0x11')]);router[_0xfae7('0x9')](_0xfae7('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0xfae7('0x13')]('/',auth[_0xfae7('0xb')](),controller[_0xfae7('0x14')]);router[_0xfae7('0x13')](_0xfae7('0x10'),auth[_0xfae7('0xb')](),controller[_0xfae7('0x15')]);router[_0xfae7('0x13')](_0xfae7('0x12'),auth['isAuthenticated'](),controller['addAgents']);router['put']('/:id',auth[_0xfae7('0xb')](),controller['update']);router[_0xfae7('0x16')](_0xfae7('0xd'),auth[_0xfae7('0xb')](),controller['destroy']);router['delete'](_0xfae7('0x10'),auth['isAuthenticated'](),controller[_0xfae7('0x17')]);router[_0xfae7('0x16')](_0xfae7('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xfae7('0x18')]=router; \ No newline at end of file +var _0x83cf=['removeTeams','multer','util','path','Router','../../components/auth/service','./mailQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','destroy'];(function(_0x424b9c,_0x4124f9){var _0x516468=function(_0x514d26){while(--_0x514d26){_0x424b9c['push'](_0x424b9c['shift']());}};_0x516468(++_0x4124f9);}(_0x83cf,0xa3));var _0xf83c=function(_0x51f6ab,_0x55bdb5){_0x51f6ab=_0x51f6ab-0x0;var _0x505b02=_0x83cf[_0x51f6ab];return _0x505b02;};'use strict';var multer=require(_0xf83c('0x0'));var util=require(_0xf83c('0x1'));var path=require(_0xf83c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf83c('0x3')]();var auth=require(_0xf83c('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf83c('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xf83c('0x6')]);router[_0xf83c('0x7')](_0xf83c('0x8'),auth[_0xf83c('0x9')](),controller[_0xf83c('0xa')]);router[_0xf83c('0x7')](_0xf83c('0xb'),auth[_0xf83c('0x9')](),controller[_0xf83c('0xc')]);router[_0xf83c('0x7')](_0xf83c('0xd'),auth[_0xf83c('0x9')](),controller[_0xf83c('0xe')]);router[_0xf83c('0x7')](_0xf83c('0xf'),auth[_0xf83c('0x9')](),controller[_0xf83c('0x10')]);router['get'](_0xf83c('0x11'),auth['isAuthenticated'](),controller[_0xf83c('0x12')]);router[_0xf83c('0x13')]('/',auth[_0xf83c('0x9')](),controller[_0xf83c('0x14')]);router['post']('/:id/teams',auth[_0xf83c('0x9')](),controller[_0xf83c('0x15')]);router['post'](_0xf83c('0x11'),auth[_0xf83c('0x9')](),controller['addAgents']);router[_0xf83c('0x16')]('/:id',auth[_0xf83c('0x9')](),controller[_0xf83c('0x17')]);router[_0xf83c('0x18')](_0xf83c('0xb'),auth['isAuthenticated'](),controller[_0xf83c('0x19')]);router[_0xf83c('0x18')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf83c('0x1a')]);router[_0xf83c('0x18')]('/:id/users',auth[_0xf83c('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 84e6e84..b57ad8d 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 _0x74cd=['beepall','roundrobin','sequelize','exports','name','STRING','ENUM','rrmemory'];(function(_0x3df84b,_0x580421){var _0x998783=function(_0x5092f3){while(--_0x5092f3){_0x3df84b['push'](_0x3df84b['shift']());}};_0x998783(++_0x580421);}(_0x74cd,0x162));var _0xd74c=function(_0x4eec9b,_0x4aea09){_0x4eec9b=_0x4eec9b-0x0;var _0x2e3849=_0x74cd[_0x4eec9b];return _0x2e3849;};'use strict';var Sequelize=require(_0xd74c('0x0'));module[_0xd74c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd74c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd74c('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd74c('0x4')](_0xd74c('0x5'),_0xd74c('0x6'),_0xd74c('0x7'))}}; \ No newline at end of file +var _0x7ebb=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x4dca94,_0x11c75c){var _0x3fc449=function(_0x2684be){while(--_0x2684be){_0x4dca94['push'](_0x4dca94['shift']());}};_0x3fc449(++_0x11c75c);}(_0x7ebb,0x161));var _0xb7eb=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x7ebb[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require(_0xb7eb('0x0'));module[_0xb7eb('0x1')]={'name':{'type':Sequelize[_0xb7eb('0x2')],'unique':_0xb7eb('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb7eb('0x2')]},'timeout':{'type':Sequelize[_0xb7eb('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb7eb('0x5')]('rrmemory',_0xb7eb('0x6'),_0xb7eb('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index cc425dd..28b4706 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 _0xa273=['%s/%s','SIP','mailPause','getTeams','findOne','nolimit','addTeams','Team','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','emit','removeTeams','ids','field','tq.TeamId','from','team_has_mail_queues','join','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','userMailQueue:save','isArray','getAgents','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','apply','save','update','destroy','then','MailQueues','end','error','name','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','order','sort','where','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserMailQueue','hasOwnProperty','pick','MailQueueId','filter','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format'];(function(_0x592b13,_0x3f3a48){var _0x362545=function(_0x25096c){while(--_0x25096c){_0x592b13['push'](_0x592b13['shift']());}};_0x362545(++_0x3f3a48);}(_0xa273,0x139));var _0x3a27=function(_0x5e4dec,_0x3da94a){_0x5e4dec=_0x5e4dec-0x0;var _0x39851b=_0xa273[_0x5e4dec];return _0x39851b;};'use strict';var pdf=require(_0x3a27('0x0'));var emlformat=require(_0x3a27('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3a27('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a27('0x3'));var moment=require('moment');var BPromise=require(_0x3a27('0x4'));var Mustache=require(_0x3a27('0x5'));var util=require('util');var path=require(_0x3a27('0x6'));var sox=require(_0x3a27('0x7'));var csv=require(_0x3a27('0x8'));var ejs=require(_0x3a27('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3a27('0xa'));var jsforce=require(_0x3a27('0xb'));var deskjs=require(_0x3a27('0xc'));var toCsv=require(_0x3a27('0x8'));var querystring=require(_0x3a27('0xd'));var Papa=require(_0x3a27('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3a27('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a27('0x10'))(_0x3a27('0x11'));var utils=require(_0x3a27('0x12'));var config=require(_0x3a27('0x13'));var db=require(_0x3a27('0x14'))['db'];config[_0x3a27('0x15')]=_['defaults'](config['redis'],{'host':_0x3a27('0x16'),'port':0x18eb});var socket=require(_0x3a27('0x17'))(new Redis(config[_0x3a27('0x15')]));require('./mailQueue.socket')[_0x3a27('0x18')](socket);function respondWithStatusCode(_0x578e9f,_0x238507){_0x238507=_0x238507||0xcc;return function(_0x509fb7){if(_0x509fb7){return _0x578e9f[_0x3a27('0x19')](_0x238507);}return _0x578e9f['status'](_0x238507)['end']();};}function respondWithResult(_0x2e75fd,_0x54faad){_0x54faad=_0x54faad||0xc8;return function(_0x5b6904){if(_0x5b6904){return _0x2e75fd[_0x3a27('0x1a')](_0x54faad)[_0x3a27('0x1b')](_0x5b6904);}};}function respondWithFilteredResult(_0x3a65cc,_0x5e385c){return function(_0x4f818a){if(_0x4f818a){var _0x340c28=_0x4f818a[_0x3a27('0x1c')],_0x7bc5c4=_0x5e385c[_0x3a27('0x1d')],_0x30a39c=_0x5e385c[_0x3a27('0x1d')]+_0x5e385c[_0x3a27('0x1e')],_0x4c8231;if(_0x30a39c>=_0x340c28){_0x30a39c=_0x340c28;_0x4c8231=0xc8;}else{_0x4c8231=0xce;}_0x3a65cc['status'](_0x4c8231);return _0x3a65cc[_0x3a27('0x1f')]('Content-Range',_0x7bc5c4+'-'+_0x30a39c+'/'+_0x340c28)[_0x3a27('0x1b')](_0x4f818a);}return null;};}function patchUpdates(_0x2435ec){return function(_0x4ef00a){try{jsonpatch[_0x3a27('0x20')](_0x4ef00a,_0x2435ec,!![]);}catch(_0x19b3aa){return BPromise['reject'](_0x19b3aa);}return _0x4ef00a[_0x3a27('0x21')]();};}function saveUpdates(_0x33c265,_0x233e3c){return function(_0x4989b9){if(_0x4989b9){return _0x4989b9[_0x3a27('0x22')](_0x33c265)['then'](function(_0x2b331b){return _0x2b331b;});}return null;};}function removeEntity(_0x174bef,_0x157d6a){return function(_0x11a237){if(_0x11a237){return _0x11a237[_0x3a27('0x23')]()[_0x3a27('0x24')](function(){var _0x37e2e8=_0x11a237['get']({'plain':!![]});var _0x2c61ea=_0x3a27('0x25');return db['UserProfileResource'][_0x3a27('0x23')]({'where':{'type':_0x2c61ea,'resourceId':_0x37e2e8['id']}})[_0x3a27('0x24')](function(){return _0x11a237;});})[_0x3a27('0x24')](function(){_0x174bef[_0x3a27('0x1a')](0xcc)[_0x3a27('0x26')]();});}};}function handleEntityNotFound(_0x323129,_0x17cf83){return function(_0x388c56){if(!_0x388c56){_0x323129[_0x3a27('0x19')](0x194);}return _0x388c56;};}function handleError(_0x57a06f,_0x505e63){_0x505e63=_0x505e63||0x1f4;return function(_0x6a8466){logger[_0x3a27('0x27')](_0x6a8466['stack']);if(_0x6a8466[_0x3a27('0x28')]){delete _0x6a8466[_0x3a27('0x28')];}_0x57a06f['status'](_0x505e63)['send'](_0x6a8466);};}exports[_0x3a27('0x29')]=function(_0x254e42,_0x106e7f){var _0x299288={},_0x3b1d79={},_0x255dff={'count':0x0,'rows':[]};var _0x29c815=_[_0x3a27('0x2a')](db[_0x3a27('0x2b')][_0x3a27('0x2c')],function(_0x83730e){return{'name':_0x83730e[_0x3a27('0x2d')],'type':_0x83730e[_0x3a27('0x2e')][_0x3a27('0x2f')]};});_0x3b1d79[_0x3a27('0x30')]=_[_0x3a27('0x2a')](_0x29c815,_0x3a27('0x28'));_0x3b1d79[_0x3a27('0x31')]=_['keys'](_0x254e42[_0x3a27('0x31')]);_0x3b1d79[_0x3a27('0x32')]=_['intersection'](_0x3b1d79[_0x3a27('0x30')],_0x3b1d79['query']);_0x299288[_0x3a27('0x33')]=_[_0x3a27('0x34')](_0x3b1d79['model'],qs[_0x3a27('0x35')](_0x254e42['query'][_0x3a27('0x35')]));_0x299288[_0x3a27('0x33')]=_0x299288[_0x3a27('0x33')][_0x3a27('0x36')]?_0x299288[_0x3a27('0x33')]:_0x3b1d79[_0x3a27('0x30')];if(!_0x254e42[_0x3a27('0x31')]['hasOwnProperty']('nolimit')){_0x299288[_0x3a27('0x1e')]=qs[_0x3a27('0x1e')](_0x254e42[_0x3a27('0x31')][_0x3a27('0x1e')]);_0x299288[_0x3a27('0x1d')]=qs[_0x3a27('0x1d')](_0x254e42['query']['offset']);}_0x299288[_0x3a27('0x37')]=qs['sort'](_0x254e42[_0x3a27('0x31')][_0x3a27('0x38')]);_0x299288[_0x3a27('0x39')]=qs[_0x3a27('0x32')](_['pick'](_0x254e42[_0x3a27('0x31')],_0x3b1d79[_0x3a27('0x32')]));if(_0x254e42[_0x3a27('0x31')]['filter']){_0x299288['where']=_[_0x3a27('0x3a')](_0x299288[_0x3a27('0x39')],{'$or':_['map'](_0x29c815,function(_0x403aed){if(_0x403aed[_0x3a27('0x2e')]!==_0x3a27('0x3b')){var _0x585884={};_0x585884[_0x403aed[_0x3a27('0x28')]]={'$like':'%'+_0x254e42[_0x3a27('0x31')]['filter']+'%'};return _0x585884;}})});}_0x299288=_[_0x3a27('0x3a')]({},_0x299288,_0x254e42[_0x3a27('0x3c')]);var _0x3a4e95={'where':_0x299288[_0x3a27('0x39')]};return db['MailQueue']['count'](_0x3a4e95)['then'](function(_0x5b93da){_0x255dff[_0x3a27('0x1c')]=_0x5b93da;if(_0x254e42['query']['includeAll']){_0x299288[_0x3a27('0x3d')]=[{'all':!![]}];}return db[_0x3a27('0x2b')][_0x3a27('0x3e')](_0x299288);})[_0x3a27('0x24')](function(_0x9980e3){_0x255dff[_0x3a27('0x3f')]=_0x9980e3;return _0x255dff;})[_0x3a27('0x24')](respondWithFilteredResult(_0x106e7f,_0x299288))['catch'](handleError(_0x106e7f,null));};exports[_0x3a27('0x40')]=function(_0x17ff53,_0x38d581){var _0x23cc37={'raw':!![],'where':{'id':_0x17ff53[_0x3a27('0x41')]['id']}},_0x2b0d6d={};_0x2b0d6d[_0x3a27('0x30')]=_[_0x3a27('0x42')](db[_0x3a27('0x2b')][_0x3a27('0x2c')]);_0x2b0d6d[_0x3a27('0x31')]=_[_0x3a27('0x42')](_0x17ff53[_0x3a27('0x31')]);_0x2b0d6d[_0x3a27('0x32')]=_[_0x3a27('0x34')](_0x2b0d6d['model'],_0x2b0d6d[_0x3a27('0x31')]);_0x23cc37['attributes']=_[_0x3a27('0x34')](_0x2b0d6d[_0x3a27('0x30')],qs[_0x3a27('0x35')](_0x17ff53[_0x3a27('0x31')][_0x3a27('0x35')]));_0x23cc37['attributes']=_0x23cc37[_0x3a27('0x33')][_0x3a27('0x36')]?_0x23cc37['attributes']:_0x2b0d6d[_0x3a27('0x30')];if(_0x17ff53[_0x3a27('0x31')]['includeAll']){_0x23cc37[_0x3a27('0x3d')]=[{'all':!![]}];}_0x23cc37=_[_0x3a27('0x3a')]({},_0x23cc37,_0x17ff53[_0x3a27('0x3c')]);return db['MailQueue'][_0x3a27('0x43')](_0x23cc37)[_0x3a27('0x24')](handleEntityNotFound(_0x38d581,null))[_0x3a27('0x24')](respondWithResult(_0x38d581,null))[_0x3a27('0x44')](handleError(_0x38d581,null));};exports[_0x3a27('0x45')]=function(_0x473425,_0x11d249){return db[_0x3a27('0x2b')]['create'](_0x473425['body'],{})[_0x3a27('0x24')](function(_0x2bce4e){var _0x3862d5=_0x473425[_0x3a27('0x46')]['get']({'plain':!![]});if(!_0x3862d5)throw new Error(_0x3a27('0x47'));if(_0x3862d5[_0x3a27('0x48')]===_0x3a27('0x46')){var _0x3f2256=_0x2bce4e[_0x3a27('0x49')]({'plain':!![]});var _0x1b712f=_0x3a27('0x25');return db[_0x3a27('0x4a')][_0x3a27('0x43')]({'where':{'name':_0x1b712f,'userProfileId':_0x3862d5['userProfileId']},'raw':!![]})[_0x3a27('0x24')](function(_0x1f0795){if(_0x1f0795&&_0x1f0795['autoAssociation']===0x0){return db[_0x3a27('0x4b')][_0x3a27('0x45')]({'name':_0x3f2256['name'],'resourceId':_0x3f2256['id'],'type':_0x1f0795[_0x3a27('0x28')],'sectionId':_0x1f0795['id']},{})[_0x3a27('0x24')](function(){return _0x2bce4e;});}else{return _0x2bce4e;}})['catch'](function(_0x314e00){logger['error'](_0x3a27('0x4c'),_0x314e00);throw _0x314e00;});}return _0x2bce4e;})['then'](respondWithResult(_0x11d249,0xc9))[_0x3a27('0x44')](handleError(_0x11d249,null));};exports['update']=function(_0x23929f,_0x52a59e){if(_0x23929f[_0x3a27('0x4d')]['id']){delete _0x23929f[_0x3a27('0x4d')]['id'];}return db[_0x3a27('0x2b')][_0x3a27('0x43')]({'where':{'id':_0x23929f[_0x3a27('0x41')]['id']}})['then'](handleEntityNotFound(_0x52a59e,null))[_0x3a27('0x24')](saveUpdates(_0x23929f[_0x3a27('0x4d')],null))['then'](respondWithResult(_0x52a59e,null))['catch'](handleError(_0x52a59e,null));};exports[_0x3a27('0x23')]=function(_0x2f2011,_0xd85eeb){return db[_0x3a27('0x2b')][_0x3a27('0x43')]({'where':{'id':_0x2f2011[_0x3a27('0x41')]['id']}})[_0x3a27('0x24')](handleEntityNotFound(_0xd85eeb,null))[_0x3a27('0x24')](removeEntity(_0xd85eeb,null))[_0x3a27('0x44')](handleError(_0xd85eeb,null));};exports['describe']=function(_0x57f4b4,_0x4d42ec){return db['MailQueue'][_0x3a27('0x4e')]()[_0x3a27('0x24')](respondWithResult(_0x4d42ec,null))['catch'](handleError(_0x4d42ec,null));};exports[_0x3a27('0x4f')]=function(_0x2f92e4,_0x545377,_0x30648a){var _0x49662a={'raw':!![],'where':{}},_0x250b9a={},_0x3610fe;return db[_0x3a27('0x2b')]['findOne']({'where':{'id':_0x2f92e4['params']['id']}})[_0x3a27('0x24')](handleEntityNotFound(_0x545377,null))['then'](function(_0x41d804){if(_0x41d804){_0x3610fe=_0x41d804[_0x3a27('0x49')]({'plain':!![]});_0x250b9a[_0x3a27('0x30')]=_[_0x3a27('0x42')](db[_0x3a27('0x50')]['rawAttributes']);_0x250b9a['query']=_[_0x3a27('0x42')](_0x2f92e4[_0x3a27('0x31')]);_0x250b9a[_0x3a27('0x32')]=_['intersection'](_0x250b9a['model'],_0x250b9a[_0x3a27('0x31')]);_0x49662a[_0x3a27('0x33')]=_['intersection'](_0x250b9a[_0x3a27('0x30')],qs['fields'](_0x2f92e4['query'][_0x3a27('0x35')]));_0x49662a['attributes']=_0x49662a[_0x3a27('0x33')][_0x3a27('0x36')]?_0x49662a['attributes']:_0x250b9a[_0x3a27('0x30')];if(!_0x2f92e4[_0x3a27('0x31')][_0x3a27('0x51')]('nolimit')){_0x49662a[_0x3a27('0x1e')]=qs[_0x3a27('0x1e')](_0x2f92e4[_0x3a27('0x31')]['limit']);_0x49662a[_0x3a27('0x1d')]=qs['offset'](_0x2f92e4['query']['offset']);}_0x49662a['order']=qs[_0x3a27('0x38')](_0x2f92e4[_0x3a27('0x31')][_0x3a27('0x38')]);_0x49662a['where']=qs[_0x3a27('0x32')](_[_0x3a27('0x52')](_0x2f92e4['query'],_0x250b9a['filters']));_0x49662a[_0x3a27('0x39')][_0x3a27('0x53')]=_0x41d804['id'];if(_0x2f92e4[_0x3a27('0x31')][_0x3a27('0x54')]){_0x49662a[_0x3a27('0x39')]=_['merge'](_0x49662a[_0x3a27('0x39')],{'$or':_[_0x3a27('0x2a')](_0x49662a[_0x3a27('0x33')],function(_0x2aab79){var _0xe20ecb={};_0xe20ecb[_0x2aab79]={'$like':'%'+_0x2f92e4[_0x3a27('0x31')][_0x3a27('0x54')]+'%'};return _0xe20ecb;})});}_0x49662a=_[_0x3a27('0x3a')]({},_0x49662a,_0x2f92e4[_0x3a27('0x3c')]);return db[_0x3a27('0x50')]['findAll'](_0x49662a);}})[_0x3a27('0x24')](function(_0x1afe88){if(_0x1afe88){return db[_0x3a27('0x55')][_0x3a27('0x56')]({'where':{'id':_['map'](_0x1afe88,_0x3a27('0x57')),'role':_0x3a27('0x58')},'attributes':['id',_0x3a27('0x28'),'mailPause',_0x3a27('0x59'),_0x3a27('0x5a')]});}})['then'](function(_0x1cd7ff){if(_0x1cd7ff){return{'count':_0x1cd7ff['count'],'rows':_[_0x3a27('0x2a')](_0x1cd7ff['rows'],function(_0x2d3eb3){return{'membername':_0x2d3eb3[_0x3a27('0x28')],'UserId':_0x2d3eb3['id'],'queue_name':_0x3610fe['name'],'MailQueueId':_0x3610fe['id'],'interface':util[_0x3a27('0x5b')](_0x3a27('0x5c'),_0x3a27('0x5d'),_0x2d3eb3['name']),'penalty':0x0,'paused':_0x2d3eb3[_0x3a27('0x5e')],'createdAt':_0x2d3eb3[_0x3a27('0x5a')],'updatedAt':_0x2d3eb3['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3a27('0x24')](respondWithFilteredResult(_0x545377,_0x49662a))['catch'](handleError(_0x545377,null));};exports[_0x3a27('0x5f')]=function(_0x5b28f7,_0x4ab577,_0x58c59e){var _0x5afa8b={};var _0x64c6e7={};var _0x4cf9d2;var _0x1a7cef;return db['MailQueue'][_0x3a27('0x60')]({'where':{'id':_0x5b28f7['params']['id']}})[_0x3a27('0x24')](handleEntityNotFound(_0x4ab577,null))[_0x3a27('0x24')](function(_0x1a90c7){if(_0x1a90c7){_0x4cf9d2=_0x1a90c7;_0x64c6e7[_0x3a27('0x30')]=_[_0x3a27('0x42')](db['Team']['rawAttributes']);_0x64c6e7['query']=_[_0x3a27('0x42')](_0x5b28f7['query']);_0x64c6e7[_0x3a27('0x32')]=_[_0x3a27('0x34')](_0x64c6e7[_0x3a27('0x30')],_0x64c6e7['query']);_0x5afa8b['attributes']=_[_0x3a27('0x34')](_0x64c6e7['model'],qs[_0x3a27('0x35')](_0x5b28f7['query']['fields']));_0x5afa8b['attributes']=_0x5afa8b[_0x3a27('0x33')]['length']?_0x5afa8b[_0x3a27('0x33')]:_0x64c6e7[_0x3a27('0x30')];_0x5afa8b[_0x3a27('0x37')]=qs[_0x3a27('0x38')](_0x5b28f7[_0x3a27('0x31')]['sort']);_0x5afa8b[_0x3a27('0x39')]=qs['filters'](_[_0x3a27('0x52')](_0x5b28f7['query'],_0x64c6e7[_0x3a27('0x32')]));if(_0x5b28f7[_0x3a27('0x31')][_0x3a27('0x54')]){_0x5afa8b[_0x3a27('0x39')]=_[_0x3a27('0x3a')](_0x5afa8b[_0x3a27('0x39')],{'$or':_[_0x3a27('0x2a')](_0x5afa8b['attributes'],function(_0x592a01){var _0x5f1e94={};_0x5f1e94[_0x592a01]={'$like':'%'+_0x5b28f7[_0x3a27('0x31')][_0x3a27('0x54')]+'%'};return _0x5f1e94;})});}_0x5afa8b=_[_0x3a27('0x3a')]({},_0x5afa8b,_0x5b28f7['options']);return _0x4cf9d2[_0x3a27('0x5f')](_0x5afa8b);}})['then'](function(_0x561207){if(_0x561207){_0x1a7cef=_0x561207[_0x3a27('0x36')];if(!_0x5b28f7['query']['hasOwnProperty'](_0x3a27('0x61'))){_0x5afa8b['limit']=qs['limit'](_0x5b28f7[_0x3a27('0x31')]['limit']);_0x5afa8b[_0x3a27('0x1d')]=qs['offset'](_0x5b28f7[_0x3a27('0x31')][_0x3a27('0x1d')]);}return _0x4cf9d2[_0x3a27('0x5f')](_0x5afa8b);}})[_0x3a27('0x24')](function(_0x32f505){if(_0x32f505){return _0x32f505?{'count':_0x1a7cef,'rows':_0x32f505}:null;}})['then'](respondWithResult(_0x4ab577,null))[_0x3a27('0x44')](handleError(_0x4ab577,null));};exports[_0x3a27('0x62')]=function(_0x15a23e,_0x257a78,_0x3608e0){var _0x5a7ec7=_0x15a23e[_0x3a27('0x4d')]['ids'];return db[_0x3a27('0x63')]['findAll']({'where':{'id':_0x5a7ec7},'attributes':['id'],'include':[{'model':db[_0x3a27('0x55')],'as':_0x3a27('0x64'),'attributes':['id',_0x3a27('0x28'),_0x3a27('0x65'),_0x3a27('0x66'),'interface'],'raw':!![]}]})[_0x3a27('0x24')](function(_0x568bc5){if(_0x568bc5){var _0x5602a8=_[_0x3a27('0x67')](_0x568bc5,function(_0x4c4d7c){var _0x9fd623=_0x4c4d7c[_0x3a27('0x49')]({'plain':!![]});return _0x9fd623[_0x3a27('0x64')];});return db[_0x3a27('0x2b')][_0x3a27('0x43')]({'where':{'id':_0x15a23e[_0x3a27('0x41')]['id']}})[_0x3a27('0x24')](function(_0x35e7bb){return db[_0x3a27('0x68')]['transaction'](function(_0x4863e8){return _0x35e7bb[_0x3a27('0x62')](_0x5a7ec7,{'transaction':_0x4863e8})[_0x3a27('0x24')](function(){return BPromise[_0x3a27('0x69')](_0x5602a8,function(_0x27aeae){return db['UserMailQueue'][_0x3a27('0x6a')]({'where':{'UserId':_0x27aeae['id'],'MailQueueId':_0x15a23e[_0x3a27('0x41')]['id']},'transaction':_0x4863e8});});})[_0x3a27('0x24')](function(){_0x5602a8[_0x3a27('0x6b')](function(_0x413576){socket[_0x3a27('0x6c')]('userMailQueue:save',{'UserId':_0x413576['id'],'MailQueueId':_0x35e7bb['id']});});});});});}})[_0x3a27('0x24')](respondWithStatusCode(_0x257a78,null))[_0x3a27('0x44')](handleError(_0x257a78,null));};exports[_0x3a27('0x6d')]=function(_0x98920b,_0x3de98c,_0x297619){return db[_0x3a27('0x63')][_0x3a27('0x3e')]({'where':{'id':_0x98920b[_0x3a27('0x31')][_0x3a27('0x6e')]},'attributes':['id'],'include':[{'model':db[_0x3a27('0x55')],'as':_0x3a27('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3de98c,null))[_0x3a27('0x24')](function(_0x233c8d){var _0x53deda=_[_0x3a27('0x2a')](_0x233c8d,'id');var _0x5e8d18=[];var _0x4b7687=[];var _0x3cd25e=squel['select']();_0x3cd25e[_0x3a27('0x6f')](_0x3a27('0x70'))[_0x3a27('0x71')](_0x3a27('0x72'),'tq')[_0x3a27('0x73')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3a27('0x39')](_0x3a27('0x74'),_0x98920b[_0x3a27('0x41')]['id']);for(var _0x8e15d3=0x0;_0x8e15d3<_0x233c8d[_0x3a27('0x36')];_0x8e15d3+=0x1){let _0x1b2b18=_0x233c8d[_0x8e15d3];for(var _0x467396=0x0;_0x467396<_0x1b2b18[_0x3a27('0x64')][_0x3a27('0x36')];_0x467396+=0x1){let _0x1da83c=_0x1b2b18[_0x3a27('0x64')][_0x467396];var _0x3b8252=_0x3cd25e['clone']();_0x3b8252[_0x3a27('0x39')](_0x3a27('0x75'),_0x1da83c['id']);_0x4b7687[_0x3a27('0x76')](db[_0x3a27('0x68')][_0x3a27('0x31')](_0x3b8252['toString'](),{'type':db[_0x3a27('0x68')][_0x3a27('0x77')][_0x3a27('0x78')]})[_0x3a27('0x24')](function(_0x572837){if(_0x572837[_0x3a27('0x36')]===0x1){return _0x1da83c['id'];}else{var _0x4899b2=_['every'](_[_0x3a27('0x2a')](_0x572837,_0x3a27('0x79')),function(_0x2c82bc){return _[_0x3a27('0x7a')](_0x53deda,_0x2c82bc);});if(_0x4899b2){return _0x1da83c['id'];}}}));}}return BPromise[_0x3a27('0x7b')](_0x4b7687)['then'](function(_0x592ca5){_0x5e8d18=_(_0x5e8d18)[_0x3a27('0x7c')](_0x592ca5)[_0x3a27('0x7d')]()[_0x3a27('0x7e')]();return db[_0x3a27('0x2b')][_0x3a27('0x43')]({'where':{'id':_0x98920b['params']['id']}})[_0x3a27('0x24')](function(_0x2eb06c){return db['sequelize']['transaction'](function(_0x4c0011){return _0x2eb06c[_0x3a27('0x6d')](_0x98920b[_0x3a27('0x31')][_0x3a27('0x6e')],{'transaction':_0x4c0011})[_0x3a27('0x24')](function(){if(!_[_0x3a27('0x7f')](_0x5e8d18)){return _0x2eb06c[_0x3a27('0x80')](_0x5e8d18,{'transaction':_0x4c0011});}})[_0x3a27('0x24')](function(){_0x5e8d18[_0x3a27('0x6b')](function(_0x5de6f3){socket['emit'](_0x3a27('0x81'),{'UserId':_0x5de6f3,'MailQueueId':_0x2eb06c['id']});});});});});});})[_0x3a27('0x24')](respondWithStatusCode(_0x3de98c,null))[_0x3a27('0x44')](handleError(_0x3de98c,null));};exports[_0x3a27('0x82')]=function(_0xe78408,_0x22e826,_0x738069){return db[_0x3a27('0x2b')][_0x3a27('0x43')]({'where':{'id':_0xe78408['params']['id']}})[_0x3a27('0x24')](handleEntityNotFound(_0x22e826,null))[_0x3a27('0x24')](function(_0x34f6e0){if(_0x34f6e0){return _0x34f6e0[_0x3a27('0x82')](_0xe78408[_0x3a27('0x4d')][_0x3a27('0x6e')],_[_0x3a27('0x83')](_0xe78408['body'],['ids','id'])||{})['spread'](function(_0x1406e6){for(var _0x139e7b=0x0;_0x139e7b<_0xe78408[_0x3a27('0x4d')][_0x3a27('0x6e')][_0x3a27('0x36')];_0x139e7b+=0x1){socket[_0x3a27('0x6c')](_0x3a27('0x84'),{'UserId':_0xe78408[_0x3a27('0x4d')][_0x3a27('0x6e')][_0x139e7b],'MailQueueId':_0xe78408['params']['id']});}return _0x1406e6;});}})[_0x3a27('0x24')](respondWithResult(_0x22e826,null))['catch'](handleError(_0x22e826,null));};exports[_0x3a27('0x80')]=function(_0x4eb315,_0x516018,_0xedb07b){return db[_0x3a27('0x2b')][_0x3a27('0x43')]({'where':{'id':_0x4eb315['params']['id']}})['then'](handleEntityNotFound(_0x516018,null))[_0x3a27('0x24')](function(_0x32f051){if(_0x32f051){return _0x32f051['removeAgents'](_0x4eb315[_0x3a27('0x31')]['ids'])['then'](function(){if(_[_0x3a27('0x85')](_0x4eb315[_0x3a27('0x31')][_0x3a27('0x6e')])){for(var _0x21f4b3=0x0;_0x21f4b3<_0x4eb315[_0x3a27('0x31')][_0x3a27('0x6e')]['length'];_0x21f4b3+=0x1){socket['emit'](_0x3a27('0x81'),{'UserId':Number(_0x4eb315[_0x3a27('0x31')][_0x3a27('0x6e')][_0x21f4b3]),'MailQueueId':Number(_0x4eb315[_0x3a27('0x41')]['id'])});}}else{socket[_0x3a27('0x6c')]('userMailQueue:remove',{'UserId':Number(_0x4eb315[_0x3a27('0x31')][_0x3a27('0x6e')]),'MailQueueId':Number(_0x4eb315['params']['id'])});}});}})[_0x3a27('0x24')](respondWithStatusCode(_0x516018,null))['catch'](handleError(_0x516018,null));};exports['getAgents']=function(_0x43432f,_0x54f4d7,_0x1bd94b){var _0x26ad88={};var _0x3239a9={};var _0x3a7130;var _0x49924a;return db['MailQueue'][_0x3a27('0x60')]({'where':{'id':_0x43432f['params']['id']}})[_0x3a27('0x24')](handleEntityNotFound(_0x54f4d7,null))[_0x3a27('0x24')](function(_0x4274cd){if(_0x4274cd){_0x3a7130=_0x4274cd;_0x3239a9[_0x3a27('0x30')]=_[_0x3a27('0x42')](db['User'][_0x3a27('0x2c')]);_0x3239a9[_0x3a27('0x31')]=_[_0x3a27('0x42')](_0x43432f[_0x3a27('0x31')]);_0x3239a9[_0x3a27('0x32')]=_['intersection'](_0x3239a9[_0x3a27('0x30')],_0x3239a9['query']);_0x26ad88[_0x3a27('0x33')]=_[_0x3a27('0x34')](_0x3239a9[_0x3a27('0x30')],qs[_0x3a27('0x35')](_0x43432f[_0x3a27('0x31')][_0x3a27('0x35')]));_0x26ad88[_0x3a27('0x33')]=_0x26ad88[_0x3a27('0x33')][_0x3a27('0x36')]?_0x26ad88[_0x3a27('0x33')]:_0x3239a9[_0x3a27('0x30')];_0x26ad88[_0x3a27('0x37')]=qs[_0x3a27('0x38')](_0x43432f[_0x3a27('0x31')]['sort']);_0x26ad88['where']=qs[_0x3a27('0x32')](_['pick'](_0x43432f[_0x3a27('0x31')],_0x3239a9[_0x3a27('0x32')]));if(_0x43432f[_0x3a27('0x31')][_0x3a27('0x54')]){_0x26ad88[_0x3a27('0x39')]=_[_0x3a27('0x3a')](_0x26ad88[_0x3a27('0x39')],{'$or':_['map'](_0x26ad88['attributes'],function(_0x2d1067){var _0x3700a0={};_0x3700a0[_0x2d1067]={'$like':'%'+_0x43432f[_0x3a27('0x31')][_0x3a27('0x54')]+'%'};return _0x3700a0;})});}_0x26ad88=_['merge']({},_0x26ad88,_0x43432f['options']);return _0x3a7130[_0x3a27('0x86')](_0x26ad88);}})['then'](function(_0x5750a5){if(_0x5750a5){_0x49924a=_0x5750a5[_0x3a27('0x36')];if(!_0x43432f[_0x3a27('0x31')][_0x3a27('0x51')](_0x3a27('0x61'))){_0x26ad88[_0x3a27('0x1e')]=qs[_0x3a27('0x1e')](_0x43432f[_0x3a27('0x31')][_0x3a27('0x1e')]);_0x26ad88[_0x3a27('0x1d')]=qs[_0x3a27('0x1d')](_0x43432f['query'][_0x3a27('0x1d')]);}return _0x3a7130['getAgents'](_0x26ad88);}})['then'](function(_0x5812ad){if(_0x5812ad){return _0x5812ad?{'count':_0x49924a,'rows':_0x5812ad}:null;}})[_0x3a27('0x24')](respondWithResult(_0x54f4d7,null))[_0x3a27('0x44')](handleError(_0x54f4d7,null));}; \ No newline at end of file +var _0x6b6c=['Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','MailQueue','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','name','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','getMembers','findOne','UserMailQueue','User','UserId','agent','mailPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','rawAttributes','Agents','voicePause','flatMap','sequelize','transaction','addTeams','each','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','pick','getAgents','html-pdf','eml-format','fast-json-patch','moment','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./mailQueue.socket','register','sendStatus','end','status','json','count','offset','limit','set'];(function(_0x190417,_0x54dc0d){var _0x110e9c=function(_0x517b86){while(--_0x517b86){_0x190417['push'](_0x190417['shift']());}};_0x110e9c(++_0x54dc0d);}(_0x6b6c,0x176));var _0xc6b6=function(_0x12408f,_0x56a9a5){_0x12408f=_0x12408f-0x0;var _0xccdd80=_0x6b6c[_0x12408f];return _0xccdd80;};'use strict';var pdf=require(_0xc6b6('0x0'));var emlformat=require(_0xc6b6('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc6b6('0x2'));var rp=require('request-promise');var moment=require(_0xc6b6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc6b6('0x4'));var csv=require(_0xc6b6('0x5'));var ejs=require(_0xc6b6('0x6'));var fs=require('fs');var _=require(_0xc6b6('0x7'));var squel=require(_0xc6b6('0x8'));var crypto=require(_0xc6b6('0x9'));var jsforce=require(_0xc6b6('0xa'));var deskjs=require(_0xc6b6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc6b6('0xc'));var Papa=require(_0xc6b6('0xd'));var Redis=require(_0xc6b6('0xe'));var authService=require(_0xc6b6('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6b6('0x10'));var logger=require(_0xc6b6('0x11'))(_0xc6b6('0x12'));var utils=require(_0xc6b6('0x13'));var config=require(_0xc6b6('0x14'));var db=require(_0xc6b6('0x15'))['db'];config[_0xc6b6('0x16')]=_['defaults'](config[_0xc6b6('0x16')],{'host':_0xc6b6('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc6b6('0x16')]));require(_0xc6b6('0x18'))[_0xc6b6('0x19')](socket);function respondWithStatusCode(_0x4025c5,_0x3283f2){_0x3283f2=_0x3283f2||0xcc;return function(_0x1cba0d){if(_0x1cba0d){return _0x4025c5[_0xc6b6('0x1a')](_0x3283f2);}return _0x4025c5['status'](_0x3283f2)[_0xc6b6('0x1b')]();};}function respondWithResult(_0x11dd50,_0x5b637a){_0x5b637a=_0x5b637a||0xc8;return function(_0x13fe3d){if(_0x13fe3d){return _0x11dd50[_0xc6b6('0x1c')](_0x5b637a)[_0xc6b6('0x1d')](_0x13fe3d);}};}function respondWithFilteredResult(_0x35e643,_0x2c3424){return function(_0xc9205d){if(_0xc9205d){var _0x428777=_0xc9205d[_0xc6b6('0x1e')],_0x4a1515=_0x2c3424[_0xc6b6('0x1f')],_0x580adc=_0x2c3424['offset']+_0x2c3424[_0xc6b6('0x20')],_0x4ddcd8;if(_0x580adc>=_0x428777){_0x580adc=_0x428777;_0x4ddcd8=0xc8;}else{_0x4ddcd8=0xce;}_0x35e643['status'](_0x4ddcd8);return _0x35e643[_0xc6b6('0x21')](_0xc6b6('0x22'),_0x4a1515+'-'+_0x580adc+'/'+_0x428777)[_0xc6b6('0x1d')](_0xc9205d);}return null;};}function patchUpdates(_0x1ef30f){return function(_0x36f5d1){try{jsonpatch[_0xc6b6('0x23')](_0x36f5d1,_0x1ef30f,!![]);}catch(_0x231f9a){return BPromise[_0xc6b6('0x24')](_0x231f9a);}return _0x36f5d1[_0xc6b6('0x25')]();};}function saveUpdates(_0x593802,_0x917962){return function(_0x15ece2){if(_0x15ece2){return _0x15ece2[_0xc6b6('0x26')](_0x593802)[_0xc6b6('0x27')](function(_0x51289c){return _0x51289c;});}return null;};}function removeEntity(_0x2fddf3,_0x522da0){return function(_0x4f5a8f){if(_0x4f5a8f){return _0x4f5a8f[_0xc6b6('0x28')]()[_0xc6b6('0x27')](function(){var _0x15c5bc=_0x4f5a8f['get']({'plain':!![]});var _0x1d4ffd='MailQueues';return db['UserProfileResource'][_0xc6b6('0x28')]({'where':{'type':_0x1d4ffd,'resourceId':_0x15c5bc['id']}})[_0xc6b6('0x27')](function(){return _0x4f5a8f;});})[_0xc6b6('0x27')](function(){_0x2fddf3[_0xc6b6('0x1c')](0xcc)[_0xc6b6('0x1b')]();});}};}function handleEntityNotFound(_0x2ed404,_0x366a29){return function(_0x231f15){if(!_0x231f15){_0x2ed404[_0xc6b6('0x1a')](0x194);}return _0x231f15;};}function handleError(_0x40718f,_0x408740){_0x408740=_0x408740||0x1f4;return function(_0x3e6a77){logger[_0xc6b6('0x29')](_0x3e6a77[_0xc6b6('0x2a')]);if(_0x3e6a77['name']){delete _0x3e6a77['name'];}_0x40718f['status'](_0x408740)[_0xc6b6('0x2b')](_0x3e6a77);};}exports[_0xc6b6('0x2c')]=function(_0x577348,_0x59ddfb){var _0x52bd4e={},_0x46b9d6={},_0x112baa={'count':0x0,'rows':[]};var _0x5ee16f=_['map'](db[_0xc6b6('0x2d')]['rawAttributes'],function(_0x1a3e7d){return{'name':_0x1a3e7d[_0xc6b6('0x2e')],'type':_0x1a3e7d[_0xc6b6('0x2f')]['key']};});_0x46b9d6[_0xc6b6('0x30')]=_[_0xc6b6('0x31')](_0x5ee16f,'name');_0x46b9d6[_0xc6b6('0x32')]=_[_0xc6b6('0x33')](_0x577348[_0xc6b6('0x32')]);_0x46b9d6[_0xc6b6('0x34')]=_[_0xc6b6('0x35')](_0x46b9d6[_0xc6b6('0x30')],_0x46b9d6[_0xc6b6('0x32')]);_0x52bd4e[_0xc6b6('0x36')]=_[_0xc6b6('0x35')](_0x46b9d6[_0xc6b6('0x30')],qs[_0xc6b6('0x37')](_0x577348[_0xc6b6('0x32')][_0xc6b6('0x37')]));_0x52bd4e['attributes']=_0x52bd4e[_0xc6b6('0x36')][_0xc6b6('0x38')]?_0x52bd4e[_0xc6b6('0x36')]:_0x46b9d6['model'];if(!_0x577348[_0xc6b6('0x32')][_0xc6b6('0x39')](_0xc6b6('0x3a'))){_0x52bd4e[_0xc6b6('0x20')]=qs[_0xc6b6('0x20')](_0x577348['query'][_0xc6b6('0x20')]);_0x52bd4e['offset']=qs[_0xc6b6('0x1f')](_0x577348[_0xc6b6('0x32')][_0xc6b6('0x1f')]);}_0x52bd4e[_0xc6b6('0x3b')]=qs['sort'](_0x577348[_0xc6b6('0x32')][_0xc6b6('0x3c')]);_0x52bd4e[_0xc6b6('0x3d')]=qs['filters'](_['pick'](_0x577348[_0xc6b6('0x32')],_0x46b9d6[_0xc6b6('0x34')]));if(_0x577348[_0xc6b6('0x32')]['filter']){_0x52bd4e[_0xc6b6('0x3d')]=_['merge'](_0x52bd4e['where'],{'$or':_[_0xc6b6('0x31')](_0x5ee16f,function(_0x11e2ac){if(_0x11e2ac[_0xc6b6('0x2f')]!==_0xc6b6('0x3e')){var _0x32f264={};_0x32f264[_0x11e2ac[_0xc6b6('0x3f')]]={'$like':'%'+_0x577348[_0xc6b6('0x32')][_0xc6b6('0x40')]+'%'};return _0x32f264;}})});}_0x52bd4e=_[_0xc6b6('0x41')]({},_0x52bd4e,_0x577348['options']);var _0x29dc6b={'where':_0x52bd4e[_0xc6b6('0x3d')]};return db[_0xc6b6('0x2d')]['count'](_0x29dc6b)['then'](function(_0x1433f3){_0x112baa['count']=_0x1433f3;if(_0x577348['query'][_0xc6b6('0x42')]){_0x52bd4e[_0xc6b6('0x43')]=[{'all':!![]}];}return db['MailQueue'][_0xc6b6('0x44')](_0x52bd4e);})['then'](function(_0x448ecc){_0x112baa[_0xc6b6('0x45')]=_0x448ecc;return _0x112baa;})[_0xc6b6('0x27')](respondWithFilteredResult(_0x59ddfb,_0x52bd4e))[_0xc6b6('0x46')](handleError(_0x59ddfb,null));};exports[_0xc6b6('0x47')]=function(_0x2335c3,_0x897c0e){var _0x1821c2={'raw':!![],'where':{'id':_0x2335c3[_0xc6b6('0x48')]['id']}},_0x208799={};_0x208799['model']=_[_0xc6b6('0x33')](db[_0xc6b6('0x2d')]['rawAttributes']);_0x208799[_0xc6b6('0x32')]=_[_0xc6b6('0x33')](_0x2335c3[_0xc6b6('0x32')]);_0x208799[_0xc6b6('0x34')]=_[_0xc6b6('0x35')](_0x208799['model'],_0x208799['query']);_0x1821c2['attributes']=_[_0xc6b6('0x35')](_0x208799['model'],qs[_0xc6b6('0x37')](_0x2335c3[_0xc6b6('0x32')][_0xc6b6('0x37')]));_0x1821c2[_0xc6b6('0x36')]=_0x1821c2[_0xc6b6('0x36')][_0xc6b6('0x38')]?_0x1821c2[_0xc6b6('0x36')]:_0x208799[_0xc6b6('0x30')];if(_0x2335c3[_0xc6b6('0x32')]['includeAll']){_0x1821c2[_0xc6b6('0x43')]=[{'all':!![]}];}_0x1821c2=_[_0xc6b6('0x41')]({},_0x1821c2,_0x2335c3[_0xc6b6('0x49')]);return db[_0xc6b6('0x2d')][_0xc6b6('0x4a')](_0x1821c2)[_0xc6b6('0x27')](handleEntityNotFound(_0x897c0e,null))['then'](respondWithResult(_0x897c0e,null))[_0xc6b6('0x46')](handleError(_0x897c0e,null));};exports[_0xc6b6('0x4b')]=function(_0x416798,_0x5e0519){return db[_0xc6b6('0x2d')][_0xc6b6('0x4b')](_0x416798[_0xc6b6('0x4c')],{})[_0xc6b6('0x27')](function(_0x2c4833){var _0x4ffcd8=_0x416798['user'][_0xc6b6('0x4d')]({'plain':!![]});if(!_0x4ffcd8)throw new Error(_0xc6b6('0x4e'));if(_0x4ffcd8[_0xc6b6('0x4f')]==='user'){var _0x54385d=_0x2c4833['get']({'plain':!![]});var _0x120f3f=_0xc6b6('0x50');return db[_0xc6b6('0x51')][_0xc6b6('0x4a')]({'where':{'name':_0x120f3f,'userProfileId':_0x4ffcd8[_0xc6b6('0x52')]},'raw':!![]})[_0xc6b6('0x27')](function(_0xc1025a){if(_0xc1025a&&_0xc1025a[_0xc6b6('0x53')]===0x0){return db[_0xc6b6('0x54')]['create']({'name':_0x54385d['name'],'resourceId':_0x54385d['id'],'type':_0xc1025a[_0xc6b6('0x3f')],'sectionId':_0xc1025a['id']},{})[_0xc6b6('0x27')](function(){return _0x2c4833;});}else{return _0x2c4833;}})[_0xc6b6('0x46')](function(_0x2e5cdc){logger[_0xc6b6('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e5cdc);throw _0x2e5cdc;});}return _0x2c4833;})[_0xc6b6('0x27')](respondWithResult(_0x5e0519,0xc9))[_0xc6b6('0x46')](handleError(_0x5e0519,null));};exports[_0xc6b6('0x26')]=function(_0x213372,_0x4cc89e){if(_0x213372['body']['id']){delete _0x213372[_0xc6b6('0x4c')]['id'];}return db[_0xc6b6('0x2d')][_0xc6b6('0x4a')]({'where':{'id':_0x213372[_0xc6b6('0x48')]['id']}})[_0xc6b6('0x27')](handleEntityNotFound(_0x4cc89e,null))[_0xc6b6('0x27')](saveUpdates(_0x213372['body'],null))[_0xc6b6('0x27')](respondWithResult(_0x4cc89e,null))['catch'](handleError(_0x4cc89e,null));};exports['destroy']=function(_0x58d041,_0x8247df){return db['MailQueue'][_0xc6b6('0x4a')]({'where':{'id':_0x58d041['params']['id']}})['then'](handleEntityNotFound(_0x8247df,null))[_0xc6b6('0x27')](removeEntity(_0x8247df,null))[_0xc6b6('0x46')](handleError(_0x8247df,null));};exports[_0xc6b6('0x55')]=function(_0x351251,_0x2efbca){return db[_0xc6b6('0x2d')][_0xc6b6('0x55')]()[_0xc6b6('0x27')](respondWithResult(_0x2efbca,null))[_0xc6b6('0x46')](handleError(_0x2efbca,null));};exports[_0xc6b6('0x56')]=function(_0x10db47,_0x47a18b,_0x25ae9f){var _0x174768={'raw':!![],'where':{}},_0x16666a={},_0x2d6338;return db[_0xc6b6('0x2d')][_0xc6b6('0x57')]({'where':{'id':_0x10db47[_0xc6b6('0x48')]['id']}})['then'](handleEntityNotFound(_0x47a18b,null))[_0xc6b6('0x27')](function(_0x135e19){if(_0x135e19){_0x2d6338=_0x135e19[_0xc6b6('0x4d')]({'plain':!![]});_0x16666a[_0xc6b6('0x30')]=_[_0xc6b6('0x33')](db[_0xc6b6('0x58')]['rawAttributes']);_0x16666a[_0xc6b6('0x32')]=_['keys'](_0x10db47[_0xc6b6('0x32')]);_0x16666a[_0xc6b6('0x34')]=_['intersection'](_0x16666a[_0xc6b6('0x30')],_0x16666a[_0xc6b6('0x32')]);_0x174768[_0xc6b6('0x36')]=_[_0xc6b6('0x35')](_0x16666a[_0xc6b6('0x30')],qs[_0xc6b6('0x37')](_0x10db47[_0xc6b6('0x32')][_0xc6b6('0x37')]));_0x174768[_0xc6b6('0x36')]=_0x174768[_0xc6b6('0x36')]['length']?_0x174768['attributes']:_0x16666a[_0xc6b6('0x30')];if(!_0x10db47[_0xc6b6('0x32')]['hasOwnProperty'](_0xc6b6('0x3a'))){_0x174768[_0xc6b6('0x20')]=qs['limit'](_0x10db47[_0xc6b6('0x32')][_0xc6b6('0x20')]);_0x174768[_0xc6b6('0x1f')]=qs[_0xc6b6('0x1f')](_0x10db47[_0xc6b6('0x32')][_0xc6b6('0x1f')]);}_0x174768[_0xc6b6('0x3b')]=qs[_0xc6b6('0x3c')](_0x10db47['query'][_0xc6b6('0x3c')]);_0x174768['where']=qs[_0xc6b6('0x34')](_['pick'](_0x10db47[_0xc6b6('0x32')],_0x16666a[_0xc6b6('0x34')]));_0x174768['where']['MailQueueId']=_0x135e19['id'];if(_0x10db47[_0xc6b6('0x32')][_0xc6b6('0x40')]){_0x174768[_0xc6b6('0x3d')]=_['merge'](_0x174768[_0xc6b6('0x3d')],{'$or':_[_0xc6b6('0x31')](_0x174768[_0xc6b6('0x36')],function(_0x59e13f){var _0x5bc4ba={};_0x5bc4ba[_0x59e13f]={'$like':'%'+_0x10db47[_0xc6b6('0x32')][_0xc6b6('0x40')]+'%'};return _0x5bc4ba;})});}_0x174768=_[_0xc6b6('0x41')]({},_0x174768,_0x10db47[_0xc6b6('0x49')]);return db['UserMailQueue'][_0xc6b6('0x44')](_0x174768);}})[_0xc6b6('0x27')](function(_0x48131f){if(_0x48131f){return db[_0xc6b6('0x59')]['findAndCountAll']({'where':{'id':_[_0xc6b6('0x31')](_0x48131f,_0xc6b6('0x5a')),'role':_0xc6b6('0x5b')},'attributes':['id',_0xc6b6('0x3f'),_0xc6b6('0x5c'),_0xc6b6('0x5d'),'createdAt']});}})['then'](function(_0xbf1d01){if(_0xbf1d01){return{'count':_0xbf1d01[_0xc6b6('0x1e')],'rows':_[_0xc6b6('0x31')](_0xbf1d01['rows'],function(_0x319b77){return{'membername':_0x319b77[_0xc6b6('0x3f')],'UserId':_0x319b77['id'],'queue_name':_0x2d6338[_0xc6b6('0x3f')],'MailQueueId':_0x2d6338['id'],'interface':util[_0xc6b6('0x5e')](_0xc6b6('0x5f'),_0xc6b6('0x60'),_0x319b77[_0xc6b6('0x3f')]),'penalty':0x0,'paused':_0x319b77[_0xc6b6('0x5c')],'createdAt':_0x319b77[_0xc6b6('0x61')],'updatedAt':_0x319b77[_0xc6b6('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc6b6('0x27')](respondWithFilteredResult(_0x47a18b,_0x174768))[_0xc6b6('0x46')](handleError(_0x47a18b,null));};exports[_0xc6b6('0x62')]=function(_0x30be44,_0x2c4fbf,_0x5342d6){var _0x198a11={};var _0x49770e={};var _0x37c62a;var _0x42f538;return db[_0xc6b6('0x2d')][_0xc6b6('0x57')]({'where':{'id':_0x30be44[_0xc6b6('0x48')]['id']}})[_0xc6b6('0x27')](handleEntityNotFound(_0x2c4fbf,null))['then'](function(_0x2a4dce){if(_0x2a4dce){_0x37c62a=_0x2a4dce;_0x49770e['model']=_['keys'](db[_0xc6b6('0x63')][_0xc6b6('0x64')]);_0x49770e['query']=_[_0xc6b6('0x33')](_0x30be44[_0xc6b6('0x32')]);_0x49770e[_0xc6b6('0x34')]=_[_0xc6b6('0x35')](_0x49770e[_0xc6b6('0x30')],_0x49770e[_0xc6b6('0x32')]);_0x198a11[_0xc6b6('0x36')]=_[_0xc6b6('0x35')](_0x49770e[_0xc6b6('0x30')],qs[_0xc6b6('0x37')](_0x30be44['query'][_0xc6b6('0x37')]));_0x198a11[_0xc6b6('0x36')]=_0x198a11['attributes']['length']?_0x198a11[_0xc6b6('0x36')]:_0x49770e['model'];_0x198a11['order']=qs[_0xc6b6('0x3c')](_0x30be44[_0xc6b6('0x32')][_0xc6b6('0x3c')]);_0x198a11[_0xc6b6('0x3d')]=qs['filters'](_['pick'](_0x30be44['query'],_0x49770e['filters']));if(_0x30be44['query']['filter']){_0x198a11['where']=_[_0xc6b6('0x41')](_0x198a11[_0xc6b6('0x3d')],{'$or':_[_0xc6b6('0x31')](_0x198a11[_0xc6b6('0x36')],function(_0x364728){var _0x207f2f={};_0x207f2f[_0x364728]={'$like':'%'+_0x30be44[_0xc6b6('0x32')][_0xc6b6('0x40')]+'%'};return _0x207f2f;})});}_0x198a11=_['merge']({},_0x198a11,_0x30be44['options']);return _0x37c62a[_0xc6b6('0x62')](_0x198a11);}})[_0xc6b6('0x27')](function(_0x5a4177){if(_0x5a4177){_0x42f538=_0x5a4177[_0xc6b6('0x38')];if(!_0x30be44['query'][_0xc6b6('0x39')](_0xc6b6('0x3a'))){_0x198a11[_0xc6b6('0x20')]=qs[_0xc6b6('0x20')](_0x30be44[_0xc6b6('0x32')]['limit']);_0x198a11[_0xc6b6('0x1f')]=qs[_0xc6b6('0x1f')](_0x30be44['query']['offset']);}return _0x37c62a[_0xc6b6('0x62')](_0x198a11);}})[_0xc6b6('0x27')](function(_0x58dfc0){if(_0x58dfc0){return _0x58dfc0?{'count':_0x42f538,'rows':_0x58dfc0}:null;}})[_0xc6b6('0x27')](respondWithResult(_0x2c4fbf,null))[_0xc6b6('0x46')](handleError(_0x2c4fbf,null));};exports['addTeams']=function(_0x1ef5f7,_0x140608,_0x4d611a){var _0x2eee57=_0x1ef5f7[_0xc6b6('0x4c')]['ids'];return db[_0xc6b6('0x63')][_0xc6b6('0x44')]({'where':{'id':_0x2eee57},'attributes':['id'],'include':[{'model':db[_0xc6b6('0x59')],'as':_0xc6b6('0x65'),'attributes':['id',_0xc6b6('0x3f'),'online',_0xc6b6('0x66'),'interface'],'raw':!![]}]})[_0xc6b6('0x27')](function(_0x21a9da){if(_0x21a9da){var _0xc16394=_[_0xc6b6('0x67')](_0x21a9da,function(_0x59137e){var _0x4d77cf=_0x59137e[_0xc6b6('0x4d')]({'plain':!![]});return _0x4d77cf[_0xc6b6('0x65')];});return db[_0xc6b6('0x2d')][_0xc6b6('0x4a')]({'where':{'id':_0x1ef5f7['params']['id']}})[_0xc6b6('0x27')](function(_0x3c340e){return db[_0xc6b6('0x68')][_0xc6b6('0x69')](function(_0x455aaf){return _0x3c340e[_0xc6b6('0x6a')](_0x2eee57,{'transaction':_0x455aaf})['then'](function(){return BPromise[_0xc6b6('0x6b')](_0xc16394,function(_0x205563){return db[_0xc6b6('0x58')]['findOrCreate']({'where':{'UserId':_0x205563['id'],'MailQueueId':_0x1ef5f7[_0xc6b6('0x48')]['id']},'transaction':_0x455aaf});});})[_0xc6b6('0x27')](function(){_0xc16394['forEach'](function(_0x2663e6){socket[_0xc6b6('0x6c')](_0xc6b6('0x6d'),{'UserId':_0x2663e6['id'],'MailQueueId':_0x3c340e['id']});});});});});}})[_0xc6b6('0x27')](respondWithStatusCode(_0x140608,null))['catch'](handleError(_0x140608,null));};exports[_0xc6b6('0x6e')]=function(_0x9c7a02,_0x479e58,_0x3f407e){return db[_0xc6b6('0x63')][_0xc6b6('0x44')]({'where':{'id':_0x9c7a02[_0xc6b6('0x32')][_0xc6b6('0x6f')]},'attributes':['id'],'include':[{'model':db[_0xc6b6('0x59')],'as':_0xc6b6('0x65'),'attributes':['id'],'raw':!![]}]})[_0xc6b6('0x27')](handleEntityNotFound(_0x479e58,null))[_0xc6b6('0x27')](function(_0x387d8d){var _0x37f85a=_['map'](_0x387d8d,'id');var _0x5c9e5a=[];var _0x5a31e5=[];var _0x269191=squel[_0xc6b6('0x70')]();_0x269191[_0xc6b6('0x71')](_0xc6b6('0x72'))[_0xc6b6('0x73')](_0xc6b6('0x74'),'tq')[_0xc6b6('0x75')]('user_has_teams','ut',_0xc6b6('0x76'))[_0xc6b6('0x3d')]('MailQueueId\x20=\x20?',_0x9c7a02['params']['id']);for(var _0x3013d3=0x0;_0x3013d3<_0x387d8d[_0xc6b6('0x38')];_0x3013d3+=0x1){let _0x438c37=_0x387d8d[_0x3013d3];for(var _0x4f4ae1=0x0;_0x4f4ae1<_0x438c37[_0xc6b6('0x65')][_0xc6b6('0x38')];_0x4f4ae1+=0x1){let _0x1c9ff4=_0x438c37[_0xc6b6('0x65')][_0x4f4ae1];var _0x127bf3=_0x269191[_0xc6b6('0x77')]();_0x127bf3['where'](_0xc6b6('0x78'),_0x1c9ff4['id']);_0x5a31e5['push'](db['sequelize']['query'](_0x127bf3[_0xc6b6('0x79')](),{'type':db[_0xc6b6('0x68')][_0xc6b6('0x7a')][_0xc6b6('0x7b')]})[_0xc6b6('0x27')](function(_0x4113cd){if(_0x4113cd[_0xc6b6('0x38')]===0x1){return _0x1c9ff4['id'];}else{var _0x4f8fdd=_[_0xc6b6('0x7c')](_[_0xc6b6('0x31')](_0x4113cd,'TeamId'),function(_0x70ab2b){return _['includes'](_0x37f85a,_0x70ab2b);});if(_0x4f8fdd){return _0x1c9ff4['id'];}}}));}}return BPromise['all'](_0x5a31e5)['then'](function(_0x4ffbf7){_0x5c9e5a=_(_0x5c9e5a)[_0xc6b6('0x7d')](_0x4ffbf7)[_0xc6b6('0x7e')]()[_0xc6b6('0x7f')]();return db[_0xc6b6('0x2d')][_0xc6b6('0x4a')]({'where':{'id':_0x9c7a02[_0xc6b6('0x48')]['id']}})[_0xc6b6('0x27')](function(_0x5f18db){return db[_0xc6b6('0x68')][_0xc6b6('0x69')](function(_0x501e2d){return _0x5f18db['removeTeams'](_0x9c7a02[_0xc6b6('0x32')][_0xc6b6('0x6f')],{'transaction':_0x501e2d})[_0xc6b6('0x27')](function(){if(!_[_0xc6b6('0x80')](_0x5c9e5a)){return _0x5f18db[_0xc6b6('0x81')](_0x5c9e5a,{'transaction':_0x501e2d});}})['then'](function(){_0x5c9e5a['forEach'](function(_0x4fbc91){socket[_0xc6b6('0x6c')](_0xc6b6('0x82'),{'UserId':_0x4fbc91,'MailQueueId':_0x5f18db['id']});});});});});});})[_0xc6b6('0x27')](respondWithStatusCode(_0x479e58,null))[_0xc6b6('0x46')](handleError(_0x479e58,null));};exports[_0xc6b6('0x83')]=function(_0x76af9d,_0x1d5d78,_0x339d7b){return db['MailQueue'][_0xc6b6('0x4a')]({'where':{'id':_0x76af9d[_0xc6b6('0x48')]['id']}})[_0xc6b6('0x27')](handleEntityNotFound(_0x1d5d78,null))[_0xc6b6('0x27')](function(_0x21c5c4){if(_0x21c5c4){return _0x21c5c4[_0xc6b6('0x83')](_0x76af9d[_0xc6b6('0x4c')][_0xc6b6('0x6f')],_[_0xc6b6('0x84')](_0x76af9d[_0xc6b6('0x4c')],[_0xc6b6('0x6f'),'id'])||{})[_0xc6b6('0x85')](function(_0x18a393){for(var _0x228356=0x0;_0x228356<_0x76af9d['body'][_0xc6b6('0x6f')][_0xc6b6('0x38')];_0x228356+=0x1){socket[_0xc6b6('0x6c')](_0xc6b6('0x6d'),{'UserId':_0x76af9d[_0xc6b6('0x4c')][_0xc6b6('0x6f')][_0x228356],'MailQueueId':_0x76af9d[_0xc6b6('0x48')]['id']});}return _0x18a393;});}})[_0xc6b6('0x27')](respondWithResult(_0x1d5d78,null))[_0xc6b6('0x46')](handleError(_0x1d5d78,null));};exports[_0xc6b6('0x81')]=function(_0x3aeb45,_0x5e60c1,_0x4873c8){return db[_0xc6b6('0x2d')][_0xc6b6('0x4a')]({'where':{'id':_0x3aeb45[_0xc6b6('0x48')]['id']}})[_0xc6b6('0x27')](handleEntityNotFound(_0x5e60c1,null))[_0xc6b6('0x27')](function(_0x3df4ed){if(_0x3df4ed){return _0x3df4ed[_0xc6b6('0x81')](_0x3aeb45[_0xc6b6('0x32')][_0xc6b6('0x6f')])[_0xc6b6('0x27')](function(){if(_['isArray'](_0x3aeb45['query'][_0xc6b6('0x6f')])){for(var _0x4e9993=0x0;_0x4e9993<_0x3aeb45[_0xc6b6('0x32')][_0xc6b6('0x6f')]['length'];_0x4e9993+=0x1){socket[_0xc6b6('0x6c')](_0xc6b6('0x82'),{'UserId':Number(_0x3aeb45[_0xc6b6('0x32')][_0xc6b6('0x6f')][_0x4e9993]),'MailQueueId':Number(_0x3aeb45[_0xc6b6('0x48')]['id'])});}}else{socket[_0xc6b6('0x6c')](_0xc6b6('0x82'),{'UserId':Number(_0x3aeb45[_0xc6b6('0x32')]['ids']),'MailQueueId':Number(_0x3aeb45[_0xc6b6('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e60c1,null))[_0xc6b6('0x46')](handleError(_0x5e60c1,null));};exports['getAgents']=function(_0x5592c8,_0x5b174f,_0x372f1c){var _0x438645={};var _0x1783a1={};var _0x8ded90;var _0x3cf4b5;return db[_0xc6b6('0x2d')][_0xc6b6('0x57')]({'where':{'id':_0x5592c8['params']['id']}})[_0xc6b6('0x27')](handleEntityNotFound(_0x5b174f,null))['then'](function(_0x123351){if(_0x123351){_0x8ded90=_0x123351;_0x1783a1[_0xc6b6('0x30')]=_[_0xc6b6('0x33')](db['User'][_0xc6b6('0x64')]);_0x1783a1['query']=_['keys'](_0x5592c8[_0xc6b6('0x32')]);_0x1783a1[_0xc6b6('0x34')]=_[_0xc6b6('0x35')](_0x1783a1[_0xc6b6('0x30')],_0x1783a1[_0xc6b6('0x32')]);_0x438645[_0xc6b6('0x36')]=_[_0xc6b6('0x35')](_0x1783a1[_0xc6b6('0x30')],qs[_0xc6b6('0x37')](_0x5592c8[_0xc6b6('0x32')]['fields']));_0x438645['attributes']=_0x438645[_0xc6b6('0x36')]['length']?_0x438645[_0xc6b6('0x36')]:_0x1783a1[_0xc6b6('0x30')];_0x438645[_0xc6b6('0x3b')]=qs[_0xc6b6('0x3c')](_0x5592c8[_0xc6b6('0x32')][_0xc6b6('0x3c')]);_0x438645[_0xc6b6('0x3d')]=qs['filters'](_[_0xc6b6('0x86')](_0x5592c8[_0xc6b6('0x32')],_0x1783a1[_0xc6b6('0x34')]));if(_0x5592c8[_0xc6b6('0x32')][_0xc6b6('0x40')]){_0x438645[_0xc6b6('0x3d')]=_['merge'](_0x438645['where'],{'$or':_[_0xc6b6('0x31')](_0x438645[_0xc6b6('0x36')],function(_0x69340f){var _0x47b44c={};_0x47b44c[_0x69340f]={'$like':'%'+_0x5592c8[_0xc6b6('0x32')][_0xc6b6('0x40')]+'%'};return _0x47b44c;})});}_0x438645=_[_0xc6b6('0x41')]({},_0x438645,_0x5592c8[_0xc6b6('0x49')]);return _0x8ded90[_0xc6b6('0x87')](_0x438645);}})['then'](function(_0x292088){if(_0x292088){_0x3cf4b5=_0x292088[_0xc6b6('0x38')];if(!_0x5592c8[_0xc6b6('0x32')]['hasOwnProperty'](_0xc6b6('0x3a'))){_0x438645['limit']=qs[_0xc6b6('0x20')](_0x5592c8[_0xc6b6('0x32')][_0xc6b6('0x20')]);_0x438645[_0xc6b6('0x1f')]=qs['offset'](_0x5592c8[_0xc6b6('0x32')][_0xc6b6('0x1f')]);}return _0x8ded90[_0xc6b6('0x87')](_0x438645);}})[_0xc6b6('0x27')](function(_0x570bdc){if(_0x570bdc){return _0x570bdc?{'count':_0x3cf4b5,'rows':_0x570bdc}:null;}})[_0xc6b6('0x27')](respondWithResult(_0x5b174f,null))['catch'](handleError(_0x5b174f,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index b0c9b1c..48f4a53 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 _0x1571=['../../mysqldb','update','remove','emit','hook'];(function(_0x59fef5,_0x4a0ac3){var _0x186f3c=function(_0x5c04d1){while(--_0x5c04d1){_0x59fef5['push'](_0x59fef5['shift']());}};_0x186f3c(++_0x4a0ac3);}(_0x1571,0xbe));var _0x1157=function(_0x506f64,_0x395f5a){_0x506f64=_0x506f64-0x0;var _0x389fdb=_0x1571[_0x506f64];return _0x389fdb;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x1157('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1157('0x1'),'afterDestroy':_0x1157('0x2')};function emitEvent(_0x19a3c0){return function(_0x59ec13,_0x419913,_0x18c887){MailQueueEvents['emit'](_0x19a3c0+':'+_0x59ec13['id'],_0x59ec13);MailQueueEvents[_0x1157('0x3')](_0x19a3c0,_0x59ec13);_0x18c887(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x1157('0x4')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x4830=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x17f8d8,_0x4d291b){var _0x5670d2=function(_0x3007d4){while(--_0x3007d4){_0x17f8d8['push'](_0x17f8d8['shift']());}};_0x5670d2(++_0x4d291b);}(_0x4830,0x140));var _0x0483=function(_0x306651,_0x1b8545){_0x306651=_0x306651-0x0;var _0xcf7db3=_0x4830[_0x306651];return _0xcf7db3;};'use strict';var EventEmitter=require(_0x0483('0x0'));var MailQueue=require(_0x0483('0x1'))['db'][_0x0483('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0483('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0483('0x4'),'afterDestroy':'remove'};function emitEvent(_0xc7cf41){return function(_0x47d17a,_0x2667be,_0x4136a9){MailQueueEvents[_0x0483('0x5')](_0xc7cf41+':'+_0x47d17a['id'],_0x47d17a);MailQueueEvents[_0x0483('0x5')](_0xc7cf41,_0x47d17a);_0x4136a9(null);};}for(var e in events){if(events[_0x0483('0x6')](e)){var event=events[e];MailQueue[_0x0483('0x7')](e,emitEvent(event));}}module[_0x0483('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index e90afd7..f6e086b 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 _0x01b0=['bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','define','MailQueue','mail_queues','lodash','../../config/logger','api','moment'];(function(_0x50aa28,_0x25c500){var _0x2f9b54=function(_0x46f767){while(--_0x46f767){_0x50aa28['push'](_0x50aa28['shift']());}};_0x2f9b54(++_0x25c500);}(_0x01b0,0x80));var _0x001b=function(_0x476b8b,_0x1ce6d9){_0x476b8b=_0x476b8b-0x0;var _0x30f928=_0x01b0[_0x476b8b];return _0x30f928;};'use strict';var _=require(_0x001b('0x0'));var util=require('util');var logger=require(_0x001b('0x1'))(_0x001b('0x2'));var moment=require(_0x001b('0x3'));var BPromise=require(_0x001b('0x4'));var rp=require(_0x001b('0x5'));var fs=require('fs');var path=require(_0x001b('0x6'));var rimraf=require('rimraf');var config=require(_0x001b('0x7'));var attributes=require(_0x001b('0x8'));module['exports']=function(_0x4f3db7,_0x4fdaaf){return _0x4f3db7[_0x001b('0x9')](_0x001b('0xa'),attributes,{'tableName':_0x001b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4f8=['mail_queues','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','MailQueue'];(function(_0xe0a6b3,_0x1a75f4){var _0x179504=function(_0x157095){while(--_0x157095){_0xe0a6b3['push'](_0xe0a6b3['shift']());}};_0x179504(++_0x1a75f4);}(_0xc4f8,0x1a3));var _0x8c4f=function(_0x20b536,_0x2c5a7d){_0x20b536=_0x20b536-0x0;var _0x36b59e=_0xc4f8[_0x20b536];return _0x36b59e;};'use strict';var _=require(_0x8c4f('0x0'));var util=require(_0x8c4f('0x1'));var logger=require('../../config/logger')(_0x8c4f('0x2'));var moment=require(_0x8c4f('0x3'));var BPromise=require('bluebird');var rp=require(_0x8c4f('0x4'));var fs=require('fs');var path=require(_0x8c4f('0x5'));var rimraf=require(_0x8c4f('0x6'));var config=require(_0x8c4f('0x7'));var attributes=require('./mailQueue.attributes');module[_0x8c4f('0x8')]=function(_0x12d729,_0x56e1e5){return _0x12d729['define'](_0x8c4f('0x9'),attributes,{'tableName':_0x8c4f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 28cd122..8c45b1f 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 _0xa0e5=['client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','MailQueue','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x11de96,_0x3b172b){var _0x26d213=function(_0x178662){while(--_0x178662){_0x11de96['push'](_0x11de96['shift']());}};_0x26d213(++_0x3b172b);}(_0xa0e5,0x6f));var _0x5a0e=function(_0x3530cd,_0x40dc83){_0x3530cd=_0x3530cd-0x0;var _0x4b6d19=_0xa0e5[_0x3530cd];return _0x4b6d19;};'use strict';var _=require(_0x5a0e('0x0'));var util=require('util');var moment=require(_0x5a0e('0x1'));var BPromise=require(_0x5a0e('0x2'));var rs=require(_0x5a0e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5a0e('0x4'))['db'];var utils=require(_0x5a0e('0x5'));var logger=require('../../config/logger')(_0x5a0e('0x6'));var config=require(_0x5a0e('0x7'));var jayson=require(_0x5a0e('0x8'));var client=jayson[_0x5a0e('0x9')]['http']({'port':0x232a});config[_0x5a0e('0xa')]=_[_0x5a0e('0xb')](config[_0x5a0e('0xa')],{'host':_0x5a0e('0xc'),'port':0x18eb});var socket=require(_0x5a0e('0xd'))(new Redis(config[_0x5a0e('0xa')]));require('./mailQueue.socket')[_0x5a0e('0xe')](socket);function respondWithRpcPromise(_0x275eb1,_0x817f95,_0x372335){return new BPromise(function(_0x40494d,_0xb3b4c9){return client[_0x5a0e('0xf')](_0x275eb1,_0x372335)[_0x5a0e('0x10')](function(_0x3ec250){logger[_0x5a0e('0x11')](_0x5a0e('0x12'),_0x817f95,'request\x20sent');logger['debug'](_0x5a0e('0x13'),_0x817f95,_0x5a0e('0x14'),JSON[_0x5a0e('0x15')](_0x3ec250));if(_0x3ec250['error']){if(_0x3ec250['error'][_0x5a0e('0x16')]===0x1f4){logger[_0x5a0e('0x17')]('MailQueue,\x20%s,\x20%s',_0x817f95,_0x3ec250['error'][_0x5a0e('0x18')]);return _0xb3b4c9(_0x3ec250[_0x5a0e('0x17')][_0x5a0e('0x18')]);}logger['error'](_0x5a0e('0x12'),_0x817f95,_0x3ec250[_0x5a0e('0x17')][_0x5a0e('0x18')]);return _0x40494d(_0x3ec250[_0x5a0e('0x17')][_0x5a0e('0x18')]);}else{logger[_0x5a0e('0x11')]('MailQueue,\x20%s,\x20%s',_0x817f95,_0x5a0e('0x14'));_0x40494d(_0x3ec250[_0x5a0e('0x19')][_0x5a0e('0x18')]);}})[_0x5a0e('0x1a')](function(_0x145d7f){logger[_0x5a0e('0x17')](_0x5a0e('0x12'),_0x817f95,_0x145d7f);_0xb3b4c9(_0x145d7f);});});}exports[_0x5a0e('0x1b')]=function(_0x315c81){var _0x5bcd62=this;return new Promise(function(_0xa89934,_0xb1026c){return db['MailQueue'][_0x5a0e('0x1c')]({'raw':_0x315c81[_0x5a0e('0x1d')]?_0x315c81[_0x5a0e('0x1d')][_0x5a0e('0x1e')]===undefined?!![]:![]:!![],'where':_0x315c81[_0x5a0e('0x1d')]?_0x315c81[_0x5a0e('0x1d')][_0x5a0e('0x1f')]||null:null,'attributes':_0x315c81[_0x5a0e('0x1d')]?_0x315c81[_0x5a0e('0x1d')][_0x5a0e('0x20')]||null:null,'limit':_0x315c81[_0x5a0e('0x1d')]?_0x315c81['options'][_0x5a0e('0x21')]||null:null,'include':_0x315c81[_0x5a0e('0x1d')]?_0x315c81[_0x5a0e('0x1d')][_0x5a0e('0x22')]?_[_0x5a0e('0x23')](_0x315c81[_0x5a0e('0x1d')][_0x5a0e('0x22')],function(_0x5ae36e){return{'model':db[_0x5ae36e[_0x5a0e('0x24')]],'as':_0x5ae36e['as'],'attributes':_0x5ae36e[_0x5a0e('0x20')],'include':_0x5ae36e['include']?_['map'](_0x5ae36e[_0x5a0e('0x22')],function(_0x3b6b61){return{'model':db[_0x3b6b61[_0x5a0e('0x24')]],'as':_0x3b6b61['as'],'attributes':_0x3b6b61['attributes'],'include':_0x3b6b61[_0x5a0e('0x22')]?_[_0x5a0e('0x23')](_0x3b6b61['include'],function(_0x5ca1e0){return{'model':db[_0x5ca1e0['model']],'as':_0x5ca1e0['as'],'attributes':_0x5ca1e0[_0x5a0e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c5c87){logger['info'](_0x5a0e('0x1b'),_0x315c81);logger['debug'](_0x5a0e('0x1b'),_0x315c81,JSON[_0x5a0e('0x15')](_0x1c5c87));_0xa89934(_0x1c5c87);})['catch'](function(_0x5adcae){logger[_0x5a0e('0x17')](_0x5a0e('0x1b'),_0x5adcae[_0x5a0e('0x18')],_0x315c81);_0xb1026c(_0x5bcd62['error'](0x1f4,_0x5adcae[_0x5a0e('0x18')]));});});};exports[_0x5a0e('0x25')]=function(_0x534647){var _0x1420ea=this;return new Promise(function(_0x4f88cd,_0x2f8493){return db[_0x5a0e('0x26')][_0x5a0e('0x27')]({'raw':_0x534647[_0x5a0e('0x1d')]?_0x534647[_0x5a0e('0x1d')][_0x5a0e('0x1e')]===undefined?!![]:![]:!![],'where':_0x534647['options']?_0x534647[_0x5a0e('0x1d')][_0x5a0e('0x1f')]||null:null,'attributes':_0x534647[_0x5a0e('0x1d')]?_0x534647[_0x5a0e('0x1d')]['attributes']||null:null,'include':_0x534647['options']?_0x534647[_0x5a0e('0x1d')][_0x5a0e('0x22')]?_[_0x5a0e('0x23')](_0x534647['options'][_0x5a0e('0x22')],function(_0x36f908){return{'model':db[_0x36f908['model']],'as':_0x36f908['as'],'attributes':_0x36f908[_0x5a0e('0x20')],'include':_0x36f908['include']?_['map'](_0x36f908[_0x5a0e('0x22')],function(_0x3d117c){return{'model':db[_0x3d117c[_0x5a0e('0x24')]],'as':_0x3d117c['as'],'attributes':_0x3d117c[_0x5a0e('0x20')],'include':_0x3d117c[_0x5a0e('0x22')]?_[_0x5a0e('0x23')](_0x3d117c['include'],function(_0x2b6cb6){return{'model':db[_0x2b6cb6['model']],'as':_0x2b6cb6['as'],'attributes':_0x2b6cb6[_0x5a0e('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d9cf9){logger[_0x5a0e('0x11')]('ShowMailQueue',_0x534647);logger['debug'](_0x5a0e('0x25'),_0x534647,JSON[_0x5a0e('0x15')](_0x1d9cf9));_0x4f88cd(_0x1d9cf9);})[_0x5a0e('0x1a')](function(_0x547ac4){logger[_0x5a0e('0x17')](_0x5a0e('0x25'),_0x547ac4['message'],_0x534647);_0x2f8493(_0x1420ea['error'](0x1f4,_0x547ac4[_0x5a0e('0x18')]));});});}; \ No newline at end of file +var _0xb455=['request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetMailQueue','findAll','options','raw','where','include','map','attributes','model','debug','catch','MailQueue','ShowMailQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','./mailQueue.socket','register'];(function(_0x3e3646,_0x35c8d9){var _0x24ec32=function(_0x3af02c){while(--_0x3af02c){_0x3e3646['push'](_0x3e3646['shift']());}};_0x24ec32(++_0x35c8d9);}(_0xb455,0xdf));var _0x5b45=function(_0x5e9ca8,_0x277320){_0x5e9ca8=_0x5e9ca8-0x0;var _0x3daccb=_0xb455[_0x5e9ca8];return _0x3daccb;};'use strict';var _=require(_0x5b45('0x0'));var util=require(_0x5b45('0x1'));var moment=require(_0x5b45('0x2'));var BPromise=require(_0x5b45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b45('0x4'));var db=require(_0x5b45('0x5'))['db'];var utils=require(_0x5b45('0x6'));var logger=require(_0x5b45('0x7'))(_0x5b45('0x8'));var config=require(_0x5b45('0x9'));var jayson=require(_0x5b45('0xa'));var client=jayson['client'][_0x5b45('0xb')]({'port':0x232a});config['redis']=_[_0x5b45('0xc')](config['redis'],{'host':_0x5b45('0xd'),'port':0x18eb});var socket=require(_0x5b45('0xe'))(new Redis(config['redis']));require(_0x5b45('0xf'))[_0x5b45('0x10')](socket);function respondWithRpcPromise(_0x4ac3e9,_0x1f9863,_0x18c4a7){return new BPromise(function(_0xf2f04b,_0x2d50c3){return client[_0x5b45('0x11')](_0x4ac3e9,_0x18c4a7)[_0x5b45('0x12')](function(_0x459735){logger[_0x5b45('0x13')](_0x5b45('0x14'),_0x1f9863,_0x5b45('0x15'));logger['debug'](_0x5b45('0x16'),_0x1f9863,_0x5b45('0x15'),JSON[_0x5b45('0x17')](_0x459735));if(_0x459735[_0x5b45('0x18')]){if(_0x459735[_0x5b45('0x18')]['code']===0x1f4){logger[_0x5b45('0x18')](_0x5b45('0x14'),_0x1f9863,_0x459735['error'][_0x5b45('0x19')]);return _0x2d50c3(_0x459735[_0x5b45('0x18')]['message']);}logger[_0x5b45('0x18')]('MailQueue,\x20%s,\x20%s',_0x1f9863,_0x459735[_0x5b45('0x18')][_0x5b45('0x19')]);return _0xf2f04b(_0x459735[_0x5b45('0x18')][_0x5b45('0x19')]);}else{logger[_0x5b45('0x13')](_0x5b45('0x14'),_0x1f9863,_0x5b45('0x15'));_0xf2f04b(_0x459735[_0x5b45('0x1a')][_0x5b45('0x19')]);}})['catch'](function(_0x4d454d){logger['error'](_0x5b45('0x14'),_0x1f9863,_0x4d454d);_0x2d50c3(_0x4d454d);});});}exports[_0x5b45('0x1b')]=function(_0x1026de){var _0x106992=this;return new Promise(function(_0x16dbdc,_0x5eb97b){return db['MailQueue'][_0x5b45('0x1c')]({'raw':_0x1026de[_0x5b45('0x1d')]?_0x1026de[_0x5b45('0x1d')][_0x5b45('0x1e')]===undefined?!![]:![]:!![],'where':_0x1026de['options']?_0x1026de[_0x5b45('0x1d')][_0x5b45('0x1f')]||null:null,'attributes':_0x1026de[_0x5b45('0x1d')]?_0x1026de[_0x5b45('0x1d')]['attributes']||null:null,'limit':_0x1026de[_0x5b45('0x1d')]?_0x1026de[_0x5b45('0x1d')]['limit']||null:null,'include':_0x1026de['options']?_0x1026de[_0x5b45('0x1d')][_0x5b45('0x20')]?_[_0x5b45('0x21')](_0x1026de['options'][_0x5b45('0x20')],function(_0xa1245f){return{'model':db[_0xa1245f['model']],'as':_0xa1245f['as'],'attributes':_0xa1245f[_0x5b45('0x22')],'include':_0xa1245f[_0x5b45('0x20')]?_[_0x5b45('0x21')](_0xa1245f[_0x5b45('0x20')],function(_0x2edd57){return{'model':db[_0x2edd57['model']],'as':_0x2edd57['as'],'attributes':_0x2edd57[_0x5b45('0x22')],'include':_0x2edd57[_0x5b45('0x20')]?_['map'](_0x2edd57[_0x5b45('0x20')],function(_0x50cca4){return{'model':db[_0x50cca4[_0x5b45('0x23')]],'as':_0x50cca4['as'],'attributes':_0x50cca4[_0x5b45('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2eb1ed){logger[_0x5b45('0x13')](_0x5b45('0x1b'),_0x1026de);logger[_0x5b45('0x24')](_0x5b45('0x1b'),_0x1026de,JSON[_0x5b45('0x17')](_0x2eb1ed));_0x16dbdc(_0x2eb1ed);})[_0x5b45('0x25')](function(_0x3e1d3c){logger[_0x5b45('0x18')](_0x5b45('0x1b'),_0x3e1d3c['message'],_0x1026de);_0x5eb97b(_0x106992['error'](0x1f4,_0x3e1d3c[_0x5b45('0x19')]));});});};exports['ShowMailQueue']=function(_0x147c98){var _0x2e5bd5=this;return new Promise(function(_0x393a85,_0x4bc817){return db[_0x5b45('0x26')]['find']({'raw':_0x147c98[_0x5b45('0x1d')]?_0x147c98[_0x5b45('0x1d')][_0x5b45('0x1e')]===undefined?!![]:![]:!![],'where':_0x147c98['options']?_0x147c98[_0x5b45('0x1d')]['where']||null:null,'attributes':_0x147c98[_0x5b45('0x1d')]?_0x147c98[_0x5b45('0x1d')][_0x5b45('0x22')]||null:null,'include':_0x147c98[_0x5b45('0x1d')]?_0x147c98['options'][_0x5b45('0x20')]?_['map'](_0x147c98[_0x5b45('0x1d')]['include'],function(_0x57c26e){return{'model':db[_0x57c26e[_0x5b45('0x23')]],'as':_0x57c26e['as'],'attributes':_0x57c26e['attributes'],'include':_0x57c26e['include']?_[_0x5b45('0x21')](_0x57c26e[_0x5b45('0x20')],function(_0x547671){return{'model':db[_0x547671[_0x5b45('0x23')]],'as':_0x547671['as'],'attributes':_0x547671['attributes'],'include':_0x547671[_0x5b45('0x20')]?_[_0x5b45('0x21')](_0x547671[_0x5b45('0x20')],function(_0x135a87){return{'model':db[_0x135a87[_0x5b45('0x23')]],'as':_0x135a87['as'],'attributes':_0x135a87[_0x5b45('0x22')]};}):[]};}):[]};}):[]:[]})[_0x5b45('0x12')](function(_0x9ec4e){logger[_0x5b45('0x13')](_0x5b45('0x27'),_0x147c98);logger[_0x5b45('0x24')]('ShowMailQueue',_0x147c98,JSON[_0x5b45('0x17')](_0x9ec4e));_0x393a85(_0x9ec4e);})[_0x5b45('0x25')](function(_0x4cf388){logger[_0x5b45('0x18')](_0x5b45('0x27'),_0x4cf388['message'],_0x147c98);_0x4bc817(_0x2e5bd5[_0x5b45('0x18')](0x1f4,_0x4cf388[_0x5b45('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 5cb068d..1426816 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 _0x438a=['removeListener','register','mailQueue:','./mailQueue.events','save','update','emit'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x438a,0xf1));var _0xa438=function(_0x521b4c,_0x31b98d){_0x521b4c=_0x521b4c-0x0;var _0x18c2b0=_0x438a[_0x521b4c];return _0x18c2b0;};'use strict';var MailQueueEvents=require(_0xa438('0x0'));var events=[_0xa438('0x1'),'remove',_0xa438('0x2')];function createListener(_0x43c1f8,_0x363939){return function(_0x534a7a){_0x363939[_0xa438('0x3')](_0x43c1f8,_0x534a7a);};}function removeListener(_0x2e5b67,_0x29e080){return function(){MailQueueEvents[_0xa438('0x4')](_0x2e5b67,_0x29e080);};}exports[_0xa438('0x5')]=function(_0x1ba2fe){for(var _0xfd93e6=0x0,_0x56e046=events['length'];_0xfd93e6<_0x56e046;_0xfd93e6++){var _0x150253=events[_0xfd93e6];var _0x5f5b4d=createListener(_0xa438('0x6')+_0x150253,_0x1ba2fe);MailQueueEvents['on'](_0x150253,_0x5f5b4d);}}; \ No newline at end of file +var _0x4cca=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove'];(function(_0x49371f,_0x375326){var _0x542f79=function(_0x230ba2){while(--_0x230ba2){_0x49371f['push'](_0x49371f['shift']());}};_0x542f79(++_0x375326);}(_0x4cca,0xe7));var _0xa4cc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4cca[_0x20a584];return _0x4b41a8;};'use strict';var MailQueueEvents=require(_0xa4cc('0x0'));var events=[_0xa4cc('0x1'),_0xa4cc('0x2'),_0xa4cc('0x3')];function createListener(_0x537281,_0x5e4cd2){return function(_0x15a68e){_0x5e4cd2[_0xa4cc('0x4')](_0x537281,_0x15a68e);};}function removeListener(_0x51c7aa,_0x36441f){return function(){MailQueueEvents[_0xa4cc('0x5')](_0x51c7aa,_0x36441f);};}exports[_0xa4cc('0x6')]=function(_0x42f9ec){for(var _0x59f0f0=0x0,_0x34e87a=events[_0xa4cc('0x7')];_0x59f0f0<_0x34e87a;_0x59f0f0++){var _0x50848e=events[_0x59f0f0];var _0x582dc0=createListener(_0xa4cc('0x8')+_0x50848e,_0x42f9ec);MailQueueEvents['on'](_0x50848e,_0x582dc0);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index a7258e4..7486431 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 _0xedfb=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete'];(function(_0x5e8460,_0x2003b5){var _0x3d50fd=function(_0x4c499f){while(--_0x4c499f){_0x5e8460['push'](_0x5e8460['shift']());}};_0x3d50fd(++_0x2003b5);}(_0xedfb,0x191));var _0xbedf=function(_0x1fbdd1,_0x17323f){_0x1fbdd1=_0x1fbdd1-0x0;var _0x3319a2=_0xedfb[_0x1fbdd1];return _0x3319a2;};'use strict';var multer=require(_0xbedf('0x0'));var util=require(_0xbedf('0x1'));var path=require(_0xbedf('0x2'));var timeout=require(_0xbedf('0x3'));var express=require(_0xbedf('0x4'));var router=express['Router']();var auth=require(_0xbedf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbedf('0x6'));var controller=require(_0xbedf('0x7'));router[_0xbedf('0x8')]('/',auth[_0xbedf('0x9')](),controller[_0xbedf('0xa')]);router['get'](_0xbedf('0xb'),auth[_0xbedf('0x9')](),controller['describe']);router[_0xbedf('0x8')](_0xbedf('0xc'),auth[_0xbedf('0x9')](),controller[_0xbedf('0xd')]);router[_0xbedf('0xe')]('/',auth[_0xbedf('0x9')](),controller[_0xbedf('0xf')]);router[_0xbedf('0x10')]('/:id',auth[_0xbedf('0x9')](),controller[_0xbedf('0x11')]);router[_0xbedf('0x12')](_0xbedf('0xc'),auth['isAuthenticated'](),controller[_0xbedf('0x13')]);module[_0xbedf('0x14')]=router; \ No newline at end of file +var _0xe778=['get','isAuthenticated','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller'];(function(_0x11c090,_0x7d8e4e){var _0x444c13=function(_0x2fd312){while(--_0x2fd312){_0x11c090['push'](_0x11c090['shift']());}};_0x444c13(++_0x7d8e4e);}(_0xe778,0x128));var _0x8e77=function(_0x41925c,_0xf815ba){_0x41925c=_0x41925c-0x0;var _0x4fd288=_0xe778[_0x41925c];return _0x4fd288;};'use strict';var multer=require(_0x8e77('0x0'));var util=require(_0x8e77('0x1'));var path=require(_0x8e77('0x2'));var timeout=require(_0x8e77('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x8e77('0x4'));var interaction=require(_0x8e77('0x5'));var config=require(_0x8e77('0x6'));var controller=require(_0x8e77('0x7'));router[_0x8e77('0x8')]('/',auth[_0x8e77('0x9')](),controller['index']);router[_0x8e77('0x8')](_0x8e77('0xa'),auth[_0x8e77('0x9')](),controller[_0x8e77('0xb')]);router[_0x8e77('0x8')](_0x8e77('0xc'),auth[_0x8e77('0x9')](),controller[_0x8e77('0xd')]);router[_0x8e77('0xe')]('/',auth[_0x8e77('0x9')](),controller['create']);router[_0x8e77('0xf')](_0x8e77('0xc'),auth[_0x8e77('0x9')](),controller['update']);router[_0x8e77('0x10')](_0x8e77('0xc'),auth[_0x8e77('0x9')](),controller[_0x8e77('0x11')]);module[_0x8e77('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 17619d3..4a0a633 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 _0x41cf=['exports','STRING','DATE','moment','sequelize'];(function(_0x49748c,_0x3d2005){var _0xedf6b6=function(_0x11628d){while(--_0x11628d){_0x49748c['push'](_0x49748c['shift']());}};_0xedf6b6(++_0x3d2005);}(_0x41cf,0x1e3));var _0xf41c=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x41cf[_0x3b0731];return _0x4204d7;};'use strict';var moment=require(_0xf41c('0x0'));var Sequelize=require(_0xf41c('0x1'));module[_0xf41c('0x2')]={'uniqueid':{'type':Sequelize[_0xf41c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf41c('0x3')]},'joinAt':{'type':Sequelize[_0xf41c('0x4')]},'leaveAt':{'type':Sequelize[_0xf41c('0x4')]},'acceptAt':{'type':Sequelize[_0xf41c('0x4')]},'exitAt':{'type':Sequelize[_0xf41c('0x4')]},'reason':{'type':Sequelize[_0xf41c('0x3')]}}; \ No newline at end of file +var _0x99a3=['DATE','moment','sequelize','exports','STRING'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x99a3,0x1eb));var _0x399a=function(_0x48a6f3,_0xecaada){_0x48a6f3=_0x48a6f3-0x0;var _0x4a236e=_0x99a3[_0x48a6f3];return _0x4a236e;};'use strict';var moment=require(_0x399a('0x0'));var Sequelize=require(_0x399a('0x1'));module[_0x399a('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x399a('0x3')]},'joinAt':{'type':Sequelize[_0x399a('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x399a('0x4')]},'exitAt':{'type':Sequelize[_0x399a('0x4')]},'reason':{'type':Sequelize[_0x399a('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 326f078..4b4f541 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 _0xe1e4=['describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','fieldName','type','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','filters','pick','filter','where','merge','MailQueueReport','count','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','create','body','find'];(function(_0x10bdbd,_0x419ac7){var _0x5a8d17=function(_0x40e534){while(--_0x40e534){_0x10bdbd['push'](_0x10bdbd['shift']());}};_0x5a8d17(++_0x419ac7);}(_0xe1e4,0x178));var _0x4e1e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe1e4[_0x4565bf];return _0x5610ba;};'use strict';var pdf=require(_0x4e1e('0x0'));var emlformat=require(_0x4e1e('0x1'));var rimraf=require(_0x4e1e('0x2'));var zipdir=require(_0x4e1e('0x3'));var jsonpatch=require(_0x4e1e('0x4'));var rp=require(_0x4e1e('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4e1e('0x6'));var util=require(_0x4e1e('0x7'));var path=require(_0x4e1e('0x8'));var sox=require(_0x4e1e('0x9'));var csv=require(_0x4e1e('0xa'));var ejs=require(_0x4e1e('0xb'));var fs=require('fs');var _=require(_0x4e1e('0xc'));var squel=require(_0x4e1e('0xd'));var crypto=require(_0x4e1e('0xe'));var jsforce=require(_0x4e1e('0xf'));var deskjs=require(_0x4e1e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4e1e('0x11'));var Papa=require('papaparse');var Redis=require(_0x4e1e('0x12'));var authService=require(_0x4e1e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4e1e('0x14'));var hardwareService=require(_0x4e1e('0x15'));var logger=require(_0x4e1e('0x16'))(_0x4e1e('0x17'));var utils=require(_0x4e1e('0x18'));var config=require(_0x4e1e('0x19'));var db=require(_0x4e1e('0x1a'))['db'];function respondWithStatusCode(_0x1aed40,_0xd646c7){_0xd646c7=_0xd646c7||0xcc;return function(_0x51ccd3){if(_0x51ccd3){return _0x1aed40[_0x4e1e('0x1b')](_0xd646c7);}return _0x1aed40['status'](_0xd646c7)[_0x4e1e('0x1c')]();};}function respondWithResult(_0x1686ba,_0x1995a7){_0x1995a7=_0x1995a7||0xc8;return function(_0x3678bd){if(_0x3678bd){return _0x1686ba[_0x4e1e('0x1d')](_0x1995a7)[_0x4e1e('0x1e')](_0x3678bd);}};}function respondWithFilteredResult(_0x49d680,_0x52b2e6){return function(_0x4777e2){if(_0x4777e2){var _0xb55bf3=_0x4777e2['count'],_0x4162d5=_0x52b2e6[_0x4e1e('0x1f')],_0xcecc79=_0x52b2e6[_0x4e1e('0x1f')]+_0x52b2e6['limit'],_0x3e96f3;if(_0xcecc79>=_0xb55bf3){_0xcecc79=_0xb55bf3;_0x3e96f3=0xc8;}else{_0x3e96f3=0xce;}_0x49d680[_0x4e1e('0x1d')](_0x3e96f3);return _0x49d680[_0x4e1e('0x20')](_0x4e1e('0x21'),_0x4162d5+'-'+_0xcecc79+'/'+_0xb55bf3)[_0x4e1e('0x1e')](_0x4777e2);}return null;};}function patchUpdates(_0x2cbcb9){return function(_0x386bb3){try{jsonpatch['apply'](_0x386bb3,_0x2cbcb9,!![]);}catch(_0x1252ab){return BPromise[_0x4e1e('0x22')](_0x1252ab);}return _0x386bb3[_0x4e1e('0x23')]();};}function saveUpdates(_0x32830e,_0x94fbb7){return function(_0xe0a35d){if(_0xe0a35d){return _0xe0a35d[_0x4e1e('0x24')](_0x32830e)[_0x4e1e('0x25')](function(_0x44a89b){return _0x44a89b;});}return null;};}function removeEntity(_0xbfe123,_0xde5637){return function(_0x119683){if(_0x119683){return _0x119683[_0x4e1e('0x26')]()[_0x4e1e('0x25')](function(){_0xbfe123[_0x4e1e('0x1d')](0xcc)[_0x4e1e('0x1c')]();});}};}function handleEntityNotFound(_0x3fe2a1,_0x3d6ca0){return function(_0x223a7d){if(!_0x223a7d){_0x3fe2a1[_0x4e1e('0x1b')](0x194);}return _0x223a7d;};}function handleError(_0x5e9091,_0x6c0fd1){_0x6c0fd1=_0x6c0fd1||0x1f4;return function(_0x3e7d7c){logger[_0x4e1e('0x27')](_0x3e7d7c['stack']);if(_0x3e7d7c['name']){delete _0x3e7d7c[_0x4e1e('0x28')];}_0x5e9091['status'](_0x6c0fd1)[_0x4e1e('0x29')](_0x3e7d7c);};}exports[_0x4e1e('0x2a')]=function(_0x2ad2f1,_0x20b289){var _0xe85588={},_0x9567ba={},_0x17af2a={'count':0x0,'rows':[]};var _0x3bee7d=_[_0x4e1e('0x2b')](db['MailQueueReport']['rawAttributes'],function(_0x3e0336){return{'name':_0x3e0336[_0x4e1e('0x2c')],'type':_0x3e0336[_0x4e1e('0x2d')]['key']};});_0x9567ba['model']=_[_0x4e1e('0x2b')](_0x3bee7d,_0x4e1e('0x28'));_0x9567ba[_0x4e1e('0x2e')]=_['keys'](_0x2ad2f1['query']);_0x9567ba['filters']=_[_0x4e1e('0x2f')](_0x9567ba[_0x4e1e('0x30')],_0x9567ba[_0x4e1e('0x2e')]);_0xe85588[_0x4e1e('0x31')]=_[_0x4e1e('0x2f')](_0x9567ba['model'],qs[_0x4e1e('0x32')](_0x2ad2f1[_0x4e1e('0x2e')][_0x4e1e('0x32')]));_0xe85588['attributes']=_0xe85588[_0x4e1e('0x31')][_0x4e1e('0x33')]?_0xe85588[_0x4e1e('0x31')]:_0x9567ba[_0x4e1e('0x30')];if(!_0x2ad2f1['query'][_0x4e1e('0x34')](_0x4e1e('0x35'))){_0xe85588['limit']=qs['limit'](_0x2ad2f1['query'][_0x4e1e('0x36')]);_0xe85588[_0x4e1e('0x1f')]=qs[_0x4e1e('0x1f')](_0x2ad2f1[_0x4e1e('0x2e')]['offset']);}_0xe85588[_0x4e1e('0x37')]=qs['sort'](_0x2ad2f1[_0x4e1e('0x2e')]['sort']);_0xe85588['where']=qs[_0x4e1e('0x38')](_[_0x4e1e('0x39')](_0x2ad2f1[_0x4e1e('0x2e')],_0x9567ba[_0x4e1e('0x38')]));if(_0x2ad2f1[_0x4e1e('0x2e')][_0x4e1e('0x3a')]){_0xe85588[_0x4e1e('0x3b')]=_['merge'](_0xe85588[_0x4e1e('0x3b')],{'$or':_['map'](_0x3bee7d,function(_0x1b021a){if(_0x1b021a[_0x4e1e('0x2d')]!=='VIRTUAL'){var _0x152c24={};_0x152c24[_0x1b021a[_0x4e1e('0x28')]]={'$like':'%'+_0x2ad2f1[_0x4e1e('0x2e')][_0x4e1e('0x3a')]+'%'};return _0x152c24;}})});}_0xe85588=_[_0x4e1e('0x3c')]({},_0xe85588,_0x2ad2f1['options']);var _0x95916c={'where':_0xe85588[_0x4e1e('0x3b')]};return db[_0x4e1e('0x3d')][_0x4e1e('0x3e')](_0x95916c)['then'](function(_0x40bf91){_0x17af2a['count']=_0x40bf91;if(_0x2ad2f1[_0x4e1e('0x2e')]['includeAll']){_0xe85588['include']=[{'all':!![]}];}return db['MailQueueReport'][_0x4e1e('0x3f')](_0xe85588);})[_0x4e1e('0x25')](function(_0x17973a){_0x17af2a[_0x4e1e('0x40')]=_0x17973a;return _0x17af2a;})['then'](respondWithFilteredResult(_0x20b289,_0xe85588))[_0x4e1e('0x41')](handleError(_0x20b289,null));};exports[_0x4e1e('0x42')]=function(_0x151c14,_0x592ab3){var _0x111cd8={'raw':!![],'where':{'id':_0x151c14[_0x4e1e('0x43')]['id']}},_0x101970={};_0x101970[_0x4e1e('0x30')]=_[_0x4e1e('0x44')](db[_0x4e1e('0x3d')][_0x4e1e('0x45')]);_0x101970[_0x4e1e('0x2e')]=_[_0x4e1e('0x44')](_0x151c14[_0x4e1e('0x2e')]);_0x101970['filters']=_[_0x4e1e('0x2f')](_0x101970[_0x4e1e('0x30')],_0x101970['query']);_0x111cd8[_0x4e1e('0x31')]=_[_0x4e1e('0x2f')](_0x101970[_0x4e1e('0x30')],qs[_0x4e1e('0x32')](_0x151c14[_0x4e1e('0x2e')][_0x4e1e('0x32')]));_0x111cd8[_0x4e1e('0x31')]=_0x111cd8[_0x4e1e('0x31')][_0x4e1e('0x33')]?_0x111cd8['attributes']:_0x101970[_0x4e1e('0x30')];if(_0x151c14[_0x4e1e('0x2e')][_0x4e1e('0x46')]){_0x111cd8['include']=[{'all':!![]}];}_0x111cd8=_['merge']({},_0x111cd8,_0x151c14['options']);return db['MailQueueReport']['find'](_0x111cd8)[_0x4e1e('0x25')](handleEntityNotFound(_0x592ab3,null))[_0x4e1e('0x25')](respondWithResult(_0x592ab3,null))['catch'](handleError(_0x592ab3,null));};exports[_0x4e1e('0x47')]=function(_0x387ef9,_0x5c22a9){return db['MailQueueReport'][_0x4e1e('0x47')](_0x387ef9[_0x4e1e('0x48')],{})['then'](respondWithResult(_0x5c22a9,0xc9))[_0x4e1e('0x41')](handleError(_0x5c22a9,null));};exports['update']=function(_0x50bf2c,_0x2c0ad4){if(_0x50bf2c[_0x4e1e('0x48')]['id']){delete _0x50bf2c['body']['id'];}return db[_0x4e1e('0x3d')]['find']({'where':{'id':_0x50bf2c[_0x4e1e('0x43')]['id']}})[_0x4e1e('0x25')](handleEntityNotFound(_0x2c0ad4,null))[_0x4e1e('0x25')](saveUpdates(_0x50bf2c[_0x4e1e('0x48')],null))[_0x4e1e('0x25')](respondWithResult(_0x2c0ad4,null))[_0x4e1e('0x41')](handleError(_0x2c0ad4,null));};exports['destroy']=function(_0x3da405,_0x2d18e8){return db[_0x4e1e('0x3d')][_0x4e1e('0x49')]({'where':{'id':_0x3da405['params']['id']}})[_0x4e1e('0x25')](handleEntityNotFound(_0x2d18e8,null))['then'](removeEntity(_0x2d18e8,null))[_0x4e1e('0x41')](handleError(_0x2d18e8,null));};exports['describe']=function(_0x5e42f8,_0x1ae6d0){return db[_0x4e1e('0x3d')][_0x4e1e('0x4a')]()[_0x4e1e('0x25')](respondWithResult(_0x1ae6d0,null))[_0x4e1e('0x41')](handleError(_0x1ae6d0,null));}; \ No newline at end of file +var _0x64b8=['bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','includeAll','findAll','rows','catch','params','keys','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x55cced,_0x2b93ae){var _0x56fad9=function(_0x593788){while(--_0x593788){_0x55cced['push'](_0x55cced['shift']());}};_0x56fad9(++_0x2b93ae);}(_0x64b8,0xde));var _0x864b=function(_0x20c769,_0x3ee17d){_0x20c769=_0x20c769-0x0;var _0xb4c58e=_0x64b8[_0x20c769];return _0xb4c58e;};'use strict';var pdf=require(_0x864b('0x0'));var emlformat=require(_0x864b('0x1'));var rimraf=require(_0x864b('0x2'));var zipdir=require(_0x864b('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x864b('0x4'));var moment=require(_0x864b('0x5'));var BPromise=require(_0x864b('0x6'));var Mustache=require(_0x864b('0x7'));var util=require(_0x864b('0x8'));var path=require(_0x864b('0x9'));var sox=require(_0x864b('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x864b('0xb'));var squel=require(_0x864b('0xc'));var crypto=require(_0x864b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x864b('0xe'));var toCsv=require(_0x864b('0xf'));var querystring=require(_0x864b('0x10'));var Papa=require(_0x864b('0x11'));var Redis=require(_0x864b('0x12'));var authService=require(_0x864b('0x13'));var qs=require(_0x864b('0x14'));var as=require(_0x864b('0x15'));var hardwareService=require(_0x864b('0x16'));var logger=require(_0x864b('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x864b('0x18'));var db=require(_0x864b('0x19'))['db'];function respondWithStatusCode(_0x527849,_0x5a17c4){_0x5a17c4=_0x5a17c4||0xcc;return function(_0x3030fc){if(_0x3030fc){return _0x527849[_0x864b('0x1a')](_0x5a17c4);}return _0x527849['status'](_0x5a17c4)['end']();};}function respondWithResult(_0x24ea70,_0xd5ff57){_0xd5ff57=_0xd5ff57||0xc8;return function(_0x18ed73){if(_0x18ed73){return _0x24ea70[_0x864b('0x1b')](_0xd5ff57)[_0x864b('0x1c')](_0x18ed73);}};}function respondWithFilteredResult(_0x2ea53e,_0x147d15){return function(_0xa8e9aa){if(_0xa8e9aa){var _0x33700f=_0xa8e9aa[_0x864b('0x1d')],_0x4fc9cd=_0x147d15[_0x864b('0x1e')],_0x1e0deb=_0x147d15[_0x864b('0x1e')]+_0x147d15[_0x864b('0x1f')],_0x408b2f;if(_0x1e0deb>=_0x33700f){_0x1e0deb=_0x33700f;_0x408b2f=0xc8;}else{_0x408b2f=0xce;}_0x2ea53e[_0x864b('0x1b')](_0x408b2f);return _0x2ea53e[_0x864b('0x20')](_0x864b('0x21'),_0x4fc9cd+'-'+_0x1e0deb+'/'+_0x33700f)['json'](_0xa8e9aa);}return null;};}function patchUpdates(_0x31d4f9){return function(_0x5e5dbc){try{jsonpatch['apply'](_0x5e5dbc,_0x31d4f9,!![]);}catch(_0xa11f38){return BPromise[_0x864b('0x22')](_0xa11f38);}return _0x5e5dbc[_0x864b('0x23')]();};}function saveUpdates(_0x583759,_0xbde592){return function(_0x57fd31){if(_0x57fd31){return _0x57fd31[_0x864b('0x24')](_0x583759)[_0x864b('0x25')](function(_0x4f78aa){return _0x4f78aa;});}return null;};}function removeEntity(_0x31074d,_0x48015b){return function(_0x4c8196){if(_0x4c8196){return _0x4c8196[_0x864b('0x26')]()[_0x864b('0x25')](function(){_0x31074d[_0x864b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54160f,_0x2e2077){return function(_0xd21cb6){if(!_0xd21cb6){_0x54160f[_0x864b('0x1a')](0x194);}return _0xd21cb6;};}function handleError(_0x28f229,_0x1eb948){_0x1eb948=_0x1eb948||0x1f4;return function(_0x21c658){logger[_0x864b('0x27')](_0x21c658[_0x864b('0x28')]);if(_0x21c658[_0x864b('0x29')]){delete _0x21c658['name'];}_0x28f229[_0x864b('0x1b')](_0x1eb948)[_0x864b('0x2a')](_0x21c658);};}exports[_0x864b('0x2b')]=function(_0x505a07,_0x5cb24d){var _0x34ec0e={},_0x51b1e8={},_0x58a41f={'count':0x0,'rows':[]};var _0x556613=_[_0x864b('0x2c')](db['MailQueueReport'][_0x864b('0x2d')],function(_0x1d69a4){return{'name':_0x1d69a4[_0x864b('0x2e')],'type':_0x1d69a4[_0x864b('0x2f')][_0x864b('0x30')]};});_0x51b1e8[_0x864b('0x31')]=_[_0x864b('0x2c')](_0x556613,_0x864b('0x29'));_0x51b1e8[_0x864b('0x32')]=_['keys'](_0x505a07[_0x864b('0x32')]);_0x51b1e8[_0x864b('0x33')]=_['intersection'](_0x51b1e8[_0x864b('0x31')],_0x51b1e8[_0x864b('0x32')]);_0x34ec0e[_0x864b('0x34')]=_[_0x864b('0x35')](_0x51b1e8['model'],qs[_0x864b('0x36')](_0x505a07['query'][_0x864b('0x36')]));_0x34ec0e[_0x864b('0x34')]=_0x34ec0e[_0x864b('0x34')][_0x864b('0x37')]?_0x34ec0e[_0x864b('0x34')]:_0x51b1e8[_0x864b('0x31')];if(!_0x505a07['query']['hasOwnProperty'](_0x864b('0x38'))){_0x34ec0e['limit']=qs[_0x864b('0x1f')](_0x505a07['query'][_0x864b('0x1f')]);_0x34ec0e[_0x864b('0x1e')]=qs[_0x864b('0x1e')](_0x505a07[_0x864b('0x32')][_0x864b('0x1e')]);}_0x34ec0e[_0x864b('0x39')]=qs['sort'](_0x505a07[_0x864b('0x32')][_0x864b('0x3a')]);_0x34ec0e[_0x864b('0x3b')]=qs[_0x864b('0x33')](_[_0x864b('0x3c')](_0x505a07[_0x864b('0x32')],_0x51b1e8['filters']));if(_0x505a07[_0x864b('0x32')][_0x864b('0x3d')]){_0x34ec0e['where']=_[_0x864b('0x3e')](_0x34ec0e['where'],{'$or':_[_0x864b('0x2c')](_0x556613,function(_0x39db5b){if(_0x39db5b['type']!==_0x864b('0x3f')){var _0x2ae249={};_0x2ae249[_0x39db5b[_0x864b('0x29')]]={'$like':'%'+_0x505a07[_0x864b('0x32')][_0x864b('0x3d')]+'%'};return _0x2ae249;}})});}_0x34ec0e=_[_0x864b('0x3e')]({},_0x34ec0e,_0x505a07[_0x864b('0x40')]);var _0x12f613={'where':_0x34ec0e[_0x864b('0x3b')]};return db[_0x864b('0x41')]['count'](_0x12f613)['then'](function(_0x4a0dc2){_0x58a41f[_0x864b('0x1d')]=_0x4a0dc2;if(_0x505a07[_0x864b('0x32')][_0x864b('0x42')]){_0x34ec0e['include']=[{'all':!![]}];}return db[_0x864b('0x41')][_0x864b('0x43')](_0x34ec0e);})[_0x864b('0x25')](function(_0x32892b){_0x58a41f[_0x864b('0x44')]=_0x32892b;return _0x58a41f;})[_0x864b('0x25')](respondWithFilteredResult(_0x5cb24d,_0x34ec0e))[_0x864b('0x45')](handleError(_0x5cb24d,null));};exports['show']=function(_0x7a3082,_0x35fd0a){var _0x2abe5d={'raw':!![],'where':{'id':_0x7a3082[_0x864b('0x46')]['id']}},_0x573f0b={};_0x573f0b['model']=_[_0x864b('0x47')](db[_0x864b('0x41')]['rawAttributes']);_0x573f0b[_0x864b('0x32')]=_['keys'](_0x7a3082[_0x864b('0x32')]);_0x573f0b[_0x864b('0x33')]=_['intersection'](_0x573f0b[_0x864b('0x31')],_0x573f0b['query']);_0x2abe5d[_0x864b('0x34')]=_['intersection'](_0x573f0b['model'],qs[_0x864b('0x36')](_0x7a3082[_0x864b('0x32')][_0x864b('0x36')]));_0x2abe5d[_0x864b('0x34')]=_0x2abe5d[_0x864b('0x34')]['length']?_0x2abe5d[_0x864b('0x34')]:_0x573f0b[_0x864b('0x31')];if(_0x7a3082[_0x864b('0x32')][_0x864b('0x42')]){_0x2abe5d['include']=[{'all':!![]}];}_0x2abe5d=_[_0x864b('0x3e')]({},_0x2abe5d,_0x7a3082[_0x864b('0x40')]);return db[_0x864b('0x41')][_0x864b('0x48')](_0x2abe5d)['then'](handleEntityNotFound(_0x35fd0a,null))[_0x864b('0x25')](respondWithResult(_0x35fd0a,null))['catch'](handleError(_0x35fd0a,null));};exports[_0x864b('0x49')]=function(_0x2b301c,_0x24fa0b){return db[_0x864b('0x41')]['create'](_0x2b301c[_0x864b('0x4a')],{})[_0x864b('0x25')](respondWithResult(_0x24fa0b,0xc9))[_0x864b('0x45')](handleError(_0x24fa0b,null));};exports['update']=function(_0x1ab499,_0x34d066){if(_0x1ab499[_0x864b('0x4a')]['id']){delete _0x1ab499['body']['id'];}return db[_0x864b('0x41')][_0x864b('0x48')]({'where':{'id':_0x1ab499[_0x864b('0x46')]['id']}})[_0x864b('0x25')](handleEntityNotFound(_0x34d066,null))[_0x864b('0x25')](saveUpdates(_0x1ab499[_0x864b('0x4a')],null))[_0x864b('0x25')](respondWithResult(_0x34d066,null))[_0x864b('0x45')](handleError(_0x34d066,null));};exports[_0x864b('0x26')]=function(_0x19fd63,_0x122982){return db[_0x864b('0x41')][_0x864b('0x48')]({'where':{'id':_0x19fd63['params']['id']}})[_0x864b('0x25')](handleEntityNotFound(_0x122982,null))[_0x864b('0x25')](removeEntity(_0x122982,null))[_0x864b('0x45')](handleError(_0x122982,null));};exports[_0x864b('0x4b')]=function(_0x2709a5,_0x2bdfa5){return db[_0x864b('0x41')][_0x864b('0x4b')]()[_0x864b('0x25')](respondWithResult(_0x2bdfa5,null))[_0x864b('0x45')](handleError(_0x2bdfa5,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index cc4ec04..2c277ad 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 _0x4783=['MailQueueReport','report_mail_queue','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','define'];(function(_0x9071ce,_0x5dc2a4){var _0x233f59=function(_0x34f55a){while(--_0x34f55a){_0x9071ce['push'](_0x9071ce['shift']());}};_0x233f59(++_0x5dc2a4);}(_0x4783,0xce));var _0x3478=function(_0x37df59,_0x5aad35){_0x37df59=_0x37df59-0x0;var _0x4860ef=_0x4783[_0x37df59];return _0x4860ef;};'use strict';var _=require('lodash');var util=require(_0x3478('0x0'));var logger=require(_0x3478('0x1'))(_0x3478('0x2'));var moment=require(_0x3478('0x3'));var BPromise=require(_0x3478('0x4'));var rp=require(_0x3478('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3478('0x6'));var config=require(_0x3478('0x7'));var attributes=require(_0x3478('0x8'));module['exports']=function(_0x457090,_0x6cd5e4){return _0x457090[_0x3478('0x9')](_0x3478('0xa'),attributes,{'tableName':_0x3478('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x578a=['define','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./mailQueueReport.attributes','exports'];(function(_0x478978,_0x287bd7){var _0x48cac6=function(_0x536571){while(--_0x536571){_0x478978['push'](_0x478978['shift']());}};_0x48cac6(++_0x287bd7);}(_0x578a,0x1db));var _0xa578=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0x578a[_0x2abc3d];return _0x252745;};'use strict';var _=require(_0xa578('0x0'));var util=require(_0xa578('0x1'));var logger=require(_0xa578('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa578('0x3'));var rp=require(_0xa578('0x4'));var fs=require('fs');var path=require(_0xa578('0x5'));var rimraf=require(_0xa578('0x6'));var config=require('../../config/environment');var attributes=require(_0xa578('0x7'));module[_0xa578('0x8')]=function(_0x402f56,_0x4d3fce){return _0x402f56[_0xa578('0x9')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xa578('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 586d1c8..5723132 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 _0x2542=['info','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','CreateMailQueueReport','create','body','options','raw','MailQueueReport','update','where','attributes','limit','UpdateMailQueueReport','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x5b9cd5,_0x12d891){var _0x3f1db1=function(_0x3731d4){while(--_0x3731d4){_0x5b9cd5['push'](_0x5b9cd5['shift']());}};_0x3f1db1(++_0x12d891);}(_0x2542,0x169));var _0x2254=function(_0x27919b,_0x47449e){_0x27919b=_0x27919b-0x0;var _0x594fc8=_0x2542[_0x27919b];return _0x594fc8;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});}exports[_0x2254('0x16')]=function(_0x1ae11e){var _0x34f90e=this;return new Promise(function(_0x497724,_0x51b395){return db['MailQueueReport'][_0x2254('0x17')](_0x1ae11e[_0x2254('0x18')],{'raw':_0x1ae11e[_0x2254('0x19')]?_0x1ae11e[_0x2254('0x19')][_0x2254('0x1a')]===undefined?!![]:![]:!![]})[_0x2254('0xc')](function(_0x487f72){logger[_0x2254('0xd')](_0x2254('0x16'),_0x1ae11e);logger[_0x2254('0xf')]('CreateMailQueueReport',_0x1ae11e,JSON['stringify'](_0x487f72));_0x497724(_0x487f72);})['catch'](function(_0x1e8a98){logger[_0x2254('0x14')](_0x2254('0x16'),_0x1e8a98['message'],_0x1ae11e);_0x51b395(_0x34f90e['error'](0x1f4,_0x1e8a98['message']));});});};exports['UpdateMailQueueReport']=function(_0x5e5edb){var _0x4f797d=this;return new Promise(function(_0x1aa71f,_0x9d6ccf){return db[_0x2254('0x1b')][_0x2254('0x1c')](_0x5e5edb[_0x2254('0x18')],{'raw':_0x5e5edb[_0x2254('0x19')]?_0x5e5edb['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e5edb[_0x2254('0x19')]?_0x5e5edb['options'][_0x2254('0x1d')]||null:null,'attributes':_0x5e5edb[_0x2254('0x19')]?_0x5e5edb[_0x2254('0x19')][_0x2254('0x1e')]||null:null,'limit':_0x5e5edb[_0x2254('0x19')]?_0x5e5edb['options'][_0x2254('0x1f')]||null:null})[_0x2254('0xc')](function(_0x21285d){logger[_0x2254('0xd')](_0x2254('0x20'),_0x5e5edb);logger[_0x2254('0xf')](_0x2254('0x20'),_0x5e5edb,JSON[_0x2254('0x12')](_0x21285d));_0x1aa71f(_0x21285d);})[_0x2254('0x21')](function(_0x221db9){logger[_0x2254('0x14')](_0x2254('0x20'),_0x221db9[_0x2254('0x15')],_0x5e5edb);_0x9d6ccf(_0x4f797d[_0x2254('0x14')](0x1f4,_0x221db9[_0x2254('0x15')]));});});}; \ No newline at end of file +var _0x4975=['attributes','UpdateMailQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailQueueReport','create','body','options','raw','then','CreateMailQueueReport','where'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x4975,0x86));var _0x5497=function(_0x421fba,_0x17444e){_0x421fba=_0x421fba-0x0;var _0x4a0dad=_0x4975[_0x421fba];return _0x4a0dad;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('MailQueueReport,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});}exports['CreateMailQueueReport']=function(_0x3f4d20){var _0x1bf442=this;return new Promise(function(_0x3a47fd,_0x5d9e24){return db[_0x5497('0x17')][_0x5497('0x18')](_0x3f4d20[_0x5497('0x19')],{'raw':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')][_0x5497('0x1b')]===undefined?!![]:![]:!![]})[_0x5497('0x1c')](function(_0x10226f){logger[_0x5497('0xd')](_0x5497('0x1d'),_0x3f4d20);logger[_0x5497('0x10')]('CreateMailQueueReport',_0x3f4d20,JSON[_0x5497('0x12')](_0x10226f));_0x3a47fd(_0x10226f);})['catch'](function(_0x19200a){logger[_0x5497('0x13')](_0x5497('0x1d'),_0x19200a[_0x5497('0x14')],_0x3f4d20);_0x5d9e24(_0x1bf442[_0x5497('0x13')](0x1f4,_0x19200a[_0x5497('0x14')]));});});};exports['UpdateMailQueueReport']=function(_0x54043a){var _0x1eefce=this;return new Promise(function(_0x34b97f,_0x24482a){return db[_0x5497('0x17')]['update'](_0x54043a[_0x5497('0x19')],{'raw':_0x54043a['options']?_0x54043a[_0x5497('0x1a')][_0x5497('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54043a[_0x5497('0x1a')]?_0x54043a[_0x5497('0x1a')][_0x5497('0x1e')]||null:null,'attributes':_0x54043a[_0x5497('0x1a')]?_0x54043a['options'][_0x5497('0x1f')]||null:null,'limit':_0x54043a['options']?_0x54043a['options']['limit']||null:null})[_0x5497('0x1c')](function(_0x48d146){logger['info'](_0x5497('0x20'),_0x54043a);logger[_0x5497('0x10')](_0x5497('0x20'),_0x54043a,JSON['stringify'](_0x48d146));_0x34b97f(_0x48d146);})['catch'](function(_0x58230b){logger[_0x5497('0x13')](_0x5497('0x20'),_0x58230b[_0x5497('0x14')],_0x54043a);_0x24482a(_0x1eefce['error'](0x1f4,_0x58230b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index adce9a9..18a0715 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 _0xdfcd=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout'];(function(_0x161985,_0x202209){var _0x1cbd5b=function(_0x39e8bd){while(--_0x39e8bd){_0x161985['push'](_0x161985['shift']());}};_0x1cbd5b(++_0x202209);}(_0xdfcd,0x135));var _0xddfc=function(_0x480f2e,_0x43dc06){_0x480f2e=_0x480f2e-0x0;var _0x31d315=_0xdfcd[_0x480f2e];return _0x31d315;};'use strict';var multer=require('multer');var util=require(_0xddfc('0x0'));var path=require(_0xddfc('0x1'));var timeout=require(_0xddfc('0x2'));var express=require('express');var router=express[_0xddfc('0x3')]();var auth=require(_0xddfc('0x4'));var interaction=require(_0xddfc('0x5'));var config=require(_0xddfc('0x6'));module[_0xddfc('0x7')]=router; \ No newline at end of file +var _0x0c54=['express','Router','../../components/interaction/service','../../config/environment','multer','util','connect-timeout'];(function(_0x3a4c64,_0xeef897){var _0x445832=function(_0x2a0c07){while(--_0x2a0c07){_0x3a4c64['push'](_0x3a4c64['shift']());}};_0x445832(++_0xeef897);}(_0x0c54,0xba));var _0x40c5=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x0c54[_0x386525];return _0x14d015;};'use strict';var multer=require(_0x40c5('0x0'));var util=require(_0x40c5('0x1'));var path=require('path');var timeout=require(_0x40c5('0x2'));var express=require(_0x40c5('0x3'));var router=express[_0x40c5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x40c5('0x5'));var config=require(_0x40c5('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 1dbcfb1..a8c5958 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 _0x0c86=['sequelize','exports','STRING','BOOLEAN','username','INTEGER'];(function(_0x4dc998,_0xc89c5b){var _0x533a5a=function(_0x1eb262){while(--_0x1eb262){_0x4dc998['push'](_0x4dc998['shift']());}};_0x533a5a(++_0xc89c5b);}(_0x0c86,0x1c2));var _0x60c8=function(_0x5dd511,_0x375d07){_0x5dd511=_0x5dd511-0x0;var _0x128597=_0x0c86[_0x5dd511];return _0x128597;};'use strict';var Sequelize=require(_0x60c8('0x0'));module[_0x60c8('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x60c8('0x2')]},'authentication':{'type':Sequelize[_0x60c8('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x60c8('0x2')],'unique':_0x60c8('0x4')},'password':{'type':Sequelize[_0x60c8('0x2')]},'port':{'type':Sequelize[_0x60c8('0x5')]},'tls':{'type':Sequelize[_0x60c8('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x60c8('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x60c8('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x60c8('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x60c8('0x2')]}}; \ No newline at end of file +var _0x606c=['INTEGER','sequelize','exports','STRING','BOOLEAN','username','INBOX'];(function(_0x5a38c8,_0x9dec30){var _0x10db74=function(_0x1a940a){while(--_0x1a940a){_0x5a38c8['push'](_0x5a38c8['shift']());}};_0x10db74(++_0x9dec30);}(_0x606c,0x71));var _0xc606=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0x606c[_0x35d8af];return _0x1d08b0;};'use strict';var Sequelize=require(_0xc606('0x0'));module[_0xc606('0x1')]={'description':{'type':Sequelize[_0xc606('0x2')]},'host':{'type':Sequelize[_0xc606('0x2')]},'authentication':{'type':Sequelize[_0xc606('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xc606('0x2')],'unique':_0xc606('0x4')},'password':{'type':Sequelize[_0xc606('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xc606('0x2')],'defaultValue':_0xc606('0x5')},'connTimeout':{'type':Sequelize[_0xc606('0x6')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xc606('0x6')],'defaultValue':0x5},'service':{'type':Sequelize[_0xc606('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 0482f29..2f34a85 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 _0xb6fa=['lodash','api','request-promise','path','../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x26da06,_0x44caa0){var _0x30d5a0=function(_0x4f4cf0){while(--_0x4f4cf0){_0x26da06['push'](_0x26da06['shift']());}};_0x30d5a0(++_0x44caa0);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0xb6fa[_0x5cc8];return _0x450661;};'use strict';var _=require(_0xab6f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xab6f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xab6f('0x2'));var fs=require('fs');var path=require(_0xab6f('0x3'));var rimraf=require('rimraf');var config=require(_0xab6f('0x4'));var attributes=require(_0xab6f('0x5'));module[_0xab6f('0x6')]=function(_0x2d9d01,_0x156df7){return _0x2d9d01[_0xab6f('0x7')](_0xab6f('0x8'),attributes,{'tableName':_0xab6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb688=['exports','MailServerIn','mail_servers_in','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x58ceab,_0x3973de){var _0x579fff=function(_0x1a7318){while(--_0x1a7318){_0x58ceab['push'](_0x58ceab['shift']());}};_0x579fff(++_0x3973de);}(_0xb688,0xcf));var _0x8b68=function(_0x303411,_0x32e28f){_0x303411=_0x303411-0x0;var _0x4353b5=_0xb688[_0x303411];return _0x4353b5;};'use strict';var _=require('lodash');var util=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var moment=require(_0x8b68('0x3'));var BPromise=require(_0x8b68('0x4'));var rp=require(_0x8b68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var attributes=require(_0x8b68('0x8'));module[_0x8b68('0x9')]=function(_0x583d16,_0x34314e){return _0x583d16['define'](_0x8b68('0xa'),attributes,{'tableName':_0x8b68('0xb'),'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 3a5e8cb..d9e0276 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 _0x6b63=['attributes','map','GetMailServerIn','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','findAll','options','raw','where','include','model'];(function(_0x3888ae,_0x5c8de7){var _0x2e8ad7=function(_0x423ff8){while(--_0x423ff8){_0x3888ae['push'](_0x3888ae['shift']());}};_0x2e8ad7(++_0x5c8de7);}(_0x6b63,0x19b));var _0x36b6=function(_0x2ace8c,_0x521a13){_0x2ace8c=_0x2ace8c-0x0;var _0x5cfdf9=_0x6b63[_0x2ace8c];return _0x5cfdf9;};'use strict';var _=require(_0x36b6('0x0'));var util=require('util');var moment=require(_0x36b6('0x1'));var BPromise=require(_0x36b6('0x2'));var rs=require(_0x36b6('0x3'));var fs=require('fs');var Redis=require(_0x36b6('0x4'));var db=require(_0x36b6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x36b6('0x6'))(_0x36b6('0x7'));var config=require(_0x36b6('0x8'));var jayson=require(_0x36b6('0x9'));var client=jayson[_0x36b6('0xa')][_0x36b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d8d77,_0x30e796,_0xfb11df){return new BPromise(function(_0x44cc1a,_0x104649){return client[_0x36b6('0xc')](_0x4d8d77,_0xfb11df)[_0x36b6('0xd')](function(_0xc4bb7b){logger['info'](_0x36b6('0xe'),_0x30e796,_0x36b6('0xf'));logger[_0x36b6('0x10')](_0x36b6('0x11'),_0x30e796,'request\x20sent',JSON[_0x36b6('0x12')](_0xc4bb7b));if(_0xc4bb7b[_0x36b6('0x13')]){if(_0xc4bb7b['error'][_0x36b6('0x14')]===0x1f4){logger[_0x36b6('0x13')](_0x36b6('0xe'),_0x30e796,_0xc4bb7b[_0x36b6('0x13')]['message']);return _0x104649(_0xc4bb7b[_0x36b6('0x13')]['message']);}logger[_0x36b6('0x13')](_0x36b6('0xe'),_0x30e796,_0xc4bb7b[_0x36b6('0x13')][_0x36b6('0x15')]);return _0x44cc1a(_0xc4bb7b[_0x36b6('0x13')][_0x36b6('0x15')]);}else{logger[_0x36b6('0x16')](_0x36b6('0xe'),_0x30e796,_0x36b6('0xf'));_0x44cc1a(_0xc4bb7b[_0x36b6('0x17')][_0x36b6('0x15')]);}})[_0x36b6('0x18')](function(_0x3eefa8){logger[_0x36b6('0x13')](_0x36b6('0xe'),_0x30e796,_0x3eefa8);_0x104649(_0x3eefa8);});});}exports['GetMailServerIn']=function(_0x2e8ff0){var _0xc7429a=this;return new Promise(function(_0x357955,_0x3ed596){return db['MailServerIn'][_0x36b6('0x19')]({'raw':_0x2e8ff0[_0x36b6('0x1a')]?_0x2e8ff0[_0x36b6('0x1a')][_0x36b6('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e8ff0[_0x36b6('0x1a')]?_0x2e8ff0[_0x36b6('0x1a')][_0x36b6('0x1c')]||null:null,'attributes':_0x2e8ff0[_0x36b6('0x1a')]?_0x2e8ff0[_0x36b6('0x1a')]['attributes']||null:null,'limit':_0x2e8ff0[_0x36b6('0x1a')]?_0x2e8ff0[_0x36b6('0x1a')]['limit']||null:null,'include':_0x2e8ff0[_0x36b6('0x1a')]?_0x2e8ff0[_0x36b6('0x1a')][_0x36b6('0x1d')]?_['map'](_0x2e8ff0['options']['include'],function(_0xb4e9c8){return{'model':db[_0xb4e9c8[_0x36b6('0x1e')]],'as':_0xb4e9c8['as'],'attributes':_0xb4e9c8[_0x36b6('0x1f')],'include':_0xb4e9c8[_0x36b6('0x1d')]?_['map'](_0xb4e9c8['include'],function(_0x3eb50d){return{'model':db[_0x3eb50d[_0x36b6('0x1e')]],'as':_0x3eb50d['as'],'attributes':_0x3eb50d[_0x36b6('0x1f')],'include':_0x3eb50d[_0x36b6('0x1d')]?_[_0x36b6('0x20')](_0x3eb50d['include'],function(_0x19d384){return{'model':db[_0x19d384[_0x36b6('0x1e')]],'as':_0x19d384['as'],'attributes':_0x19d384[_0x36b6('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x36b6('0xd')](function(_0x5807bd){logger[_0x36b6('0x16')](_0x36b6('0x21'),_0x2e8ff0);logger[_0x36b6('0x10')](_0x36b6('0x21'),_0x2e8ff0,JSON[_0x36b6('0x12')](_0x5807bd));_0x357955(_0x5807bd);})[_0x36b6('0x18')](function(_0x585116){logger[_0x36b6('0x13')](_0x36b6('0x21'),_0x585116[_0x36b6('0x15')],_0x2e8ff0);_0x3ed596(_0xc7429a[_0x36b6('0x13')](0x1f4,_0x585116['message']));});});}; \ No newline at end of file +var _0xb9fd=['options','raw','include','map','model','attributes','lodash','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetMailServerIn','MailServerIn'];(function(_0x1460f6,_0x59051a){var _0x46ce94=function(_0x1c3ddf){while(--_0x1c3ddf){_0x1460f6['push'](_0x1460f6['shift']());}};_0x46ce94(++_0x59051a);}(_0xb9fd,0x165));var _0xdb9f=function(_0x3b5049,_0x495a94){_0x3b5049=_0x3b5049-0x0;var _0x12454e=_0xb9fd[_0x3b5049];return _0x12454e;};'use strict';var _=require(_0xdb9f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdb9f('0x1'));var rs=require(_0xdb9f('0x2'));var fs=require('fs');var Redis=require(_0xdb9f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdb9f('0x4'));var config=require(_0xdb9f('0x5'));var jayson=require(_0xdb9f('0x6'));var client=jayson[_0xdb9f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x303a92,_0x3c7cfc,_0x5cb61c){return new BPromise(function(_0x37235c,_0x4baccd){return client['request'](_0x303a92,_0x5cb61c)[_0xdb9f('0x8')](function(_0xa10aa2){logger['info'](_0xdb9f('0x9'),_0x3c7cfc,_0xdb9f('0xa'));logger[_0xdb9f('0xb')](_0xdb9f('0xc'),_0x3c7cfc,'request\x20sent',JSON[_0xdb9f('0xd')](_0xa10aa2));if(_0xa10aa2['error']){if(_0xa10aa2[_0xdb9f('0xe')][_0xdb9f('0xf')]===0x1f4){logger[_0xdb9f('0xe')](_0xdb9f('0x9'),_0x3c7cfc,_0xa10aa2[_0xdb9f('0xe')][_0xdb9f('0x10')]);return _0x4baccd(_0xa10aa2[_0xdb9f('0xe')][_0xdb9f('0x10')]);}logger[_0xdb9f('0xe')](_0xdb9f('0x9'),_0x3c7cfc,_0xa10aa2[_0xdb9f('0xe')][_0xdb9f('0x10')]);return _0x37235c(_0xa10aa2[_0xdb9f('0xe')]['message']);}else{logger[_0xdb9f('0x11')](_0xdb9f('0x9'),_0x3c7cfc,_0xdb9f('0xa'));_0x37235c(_0xa10aa2['result']['message']);}})[_0xdb9f('0x12')](function(_0x3f73ea){logger[_0xdb9f('0xe')](_0xdb9f('0x9'),_0x3c7cfc,_0x3f73ea);_0x4baccd(_0x3f73ea);});});}exports[_0xdb9f('0x13')]=function(_0xddf6bc){var _0x26e710=this;return new Promise(function(_0x28e2a3,_0x4e27c9){return db[_0xdb9f('0x14')]['findAll']({'raw':_0xddf6bc[_0xdb9f('0x15')]?_0xddf6bc[_0xdb9f('0x15')][_0xdb9f('0x16')]===undefined?!![]:![]:!![],'where':_0xddf6bc['options']?_0xddf6bc[_0xdb9f('0x15')]['where']||null:null,'attributes':_0xddf6bc[_0xdb9f('0x15')]?_0xddf6bc[_0xdb9f('0x15')]['attributes']||null:null,'limit':_0xddf6bc[_0xdb9f('0x15')]?_0xddf6bc[_0xdb9f('0x15')]['limit']||null:null,'include':_0xddf6bc[_0xdb9f('0x15')]?_0xddf6bc[_0xdb9f('0x15')][_0xdb9f('0x17')]?_[_0xdb9f('0x18')](_0xddf6bc['options']['include'],function(_0x2e7675){return{'model':db[_0x2e7675[_0xdb9f('0x19')]],'as':_0x2e7675['as'],'attributes':_0x2e7675[_0xdb9f('0x1a')],'include':_0x2e7675['include']?_[_0xdb9f('0x18')](_0x2e7675[_0xdb9f('0x17')],function(_0x5a6dfe){return{'model':db[_0x5a6dfe['model']],'as':_0x5a6dfe['as'],'attributes':_0x5a6dfe[_0xdb9f('0x1a')],'include':_0x5a6dfe[_0xdb9f('0x17')]?_[_0xdb9f('0x18')](_0x5a6dfe['include'],function(_0x209c71){return{'model':db[_0x209c71[_0xdb9f('0x19')]],'as':_0x209c71['as'],'attributes':_0x209c71['attributes']};}):[]};}):[]};}):[]:[]})[_0xdb9f('0x8')](function(_0x466eeb){logger[_0xdb9f('0x11')]('GetMailServerIn',_0xddf6bc);logger[_0xdb9f('0xb')](_0xdb9f('0x13'),_0xddf6bc,JSON[_0xdb9f('0xd')](_0x466eeb));_0x28e2a3(_0x466eeb);})[_0xdb9f('0x12')](function(_0x3aaff9){logger[_0xdb9f('0xe')]('GetMailServerIn',_0x3aaff9[_0xdb9f('0x10')],_0xddf6bc);_0x4e27c9(_0x26e710[_0xdb9f('0xe')](0x1f4,_0x3aaff9['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 37abed5..03240e5 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 _0xbfd8=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','multer','path'];(function(_0x3f479b,_0xaea36b){var _0x3fe57f=function(_0x3e5cfd){while(--_0x3e5cfd){_0x3f479b['push'](_0x3f479b['shift']());}};_0x3fe57f(++_0xaea36b);}(_0xbfd8,0x154));var _0x8bfd=function(_0x533bcc,_0x1ba26f){_0x533bcc=_0x533bcc-0x0;var _0x364d38=_0xbfd8[_0x533bcc];return _0x364d38;};'use strict';var multer=require(_0x8bfd('0x0'));var util=require('util');var path=require(_0x8bfd('0x1'));var timeout=require(_0x8bfd('0x2'));var express=require(_0x8bfd('0x3'));var router=express[_0x8bfd('0x4')]();var auth=require(_0x8bfd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8bfd('0x6'));var controller=require(_0x8bfd('0x7'));router[_0x8bfd('0x8')]('/',auth['isAuthenticated'](),controller[_0x8bfd('0x9')]);router[_0x8bfd('0x8')](_0x8bfd('0xa'),auth[_0x8bfd('0xb')](),controller['show']);router[_0x8bfd('0xc')]('/',auth[_0x8bfd('0xb')](),controller[_0x8bfd('0xd')]);router[_0x8bfd('0xe')](_0x8bfd('0xa'),auth[_0x8bfd('0xb')](),controller[_0x8bfd('0xf')]);router[_0x8bfd('0x10')](_0x8bfd('0xa'),auth[_0x8bfd('0xb')](),controller[_0x8bfd('0x11')]);module['exports']=router; \ No newline at end of file +var _0xbe29=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','post','put','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0xbe29,0xed));var _0x9be2=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0xbe29[_0x56e4e7];return _0x383618;};'use strict';var multer=require(_0x9be2('0x0'));var util=require(_0x9be2('0x1'));var path=require('path');var timeout=require(_0x9be2('0x2'));var express=require(_0x9be2('0x3'));var router=express['Router']();var auth=require(_0x9be2('0x4'));var interaction=require(_0x9be2('0x5'));var config=require(_0x9be2('0x6'));var controller=require(_0x9be2('0x7'));router[_0x9be2('0x8')]('/',auth[_0x9be2('0x9')](),controller['index']);router[_0x9be2('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9be2('0xa')]('/',auth[_0x9be2('0x9')](),controller['create']);router[_0x9be2('0xb')](_0x9be2('0xc'),auth[_0x9be2('0x9')](),controller['update']);router['delete'](_0x9be2('0xc'),auth['isAuthenticated'](),controller[_0x9be2('0xd')]);module[_0x9be2('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index f1c2422..251b05e 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 _0x6d38=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0x6d38,0x1ef));var _0x86d3=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6d38[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0x86d3('0x0')]={'description':{'type':Sequelize[_0x86d3('0x1')]},'host':{'type':Sequelize[_0x86d3('0x1')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x86d3('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x86d3('0x1')]},'authentication':{'type':Sequelize[_0x86d3('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc1d3=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x48d024,_0x3466b2){var _0x2c5803=function(_0x2d7327){while(--_0x2d7327){_0x48d024['push'](_0x48d024['shift']());}};_0x2c5803(++_0x3466b2);}(_0xc1d3,0x147));var _0x3c1d=function(_0x4f4c53,_0x58ba7b){_0x4f4c53=_0x4f4c53-0x0;var _0x568ff1=_0xc1d3[_0x4f4c53];return _0x568ff1;};'use strict';var Sequelize=require(_0x3c1d('0x0'));module[_0x3c1d('0x1')]={'description':{'type':Sequelize[_0x3c1d('0x2')]},'host':{'type':Sequelize[_0x3c1d('0x2')]},'user':{'type':Sequelize[_0x3c1d('0x2')]},'pass':{'type':Sequelize[_0x3c1d('0x2')]},'port':{'type':Sequelize[_0x3c1d('0x3')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x3c1d('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 4913167..5d4f55d 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 _0xbf24=['update','then','destroy','sendStatus','stack','name','send','MailServerOut','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','params','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','status','end','count','offset','set','Content-Range','json','apply','reject','save'];(function(_0x553a87,_0x1d621f){var _0x12d1e6=function(_0x41ae48){while(--_0x41ae48){_0x553a87['push'](_0x553a87['shift']());}};_0x12d1e6(++_0x1d621f);}(_0xbf24,0x187));var _0x4bf2=function(_0x9bb5cb,_0x1f8301){_0x9bb5cb=_0x9bb5cb-0x0;var _0x3d611c=_0xbf24[_0x9bb5cb];return _0x3d611c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4bf2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4bf2('0x1'));var jsonpatch=require(_0x4bf2('0x2'));var rp=require('request-promise');var moment=require(_0x4bf2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4bf2('0x4'));var util=require(_0x4bf2('0x5'));var path=require(_0x4bf2('0x6'));var sox=require('sox');var csv=require(_0x4bf2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4bf2('0x8'));var squel=require(_0x4bf2('0x9'));var crypto=require(_0x4bf2('0xa'));var jsforce=require(_0x4bf2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4bf2('0x7'));var querystring=require(_0x4bf2('0xc'));var Papa=require('papaparse');var Redis=require(_0x4bf2('0xd'));var authService=require(_0x4bf2('0xe'));var qs=require(_0x4bf2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4bf2('0x10'));var logger=require(_0x4bf2('0x11'))('api');var utils=require(_0x4bf2('0x12'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x323237,_0x54349a){_0x54349a=_0x54349a||0xcc;return function(_0x343863){if(_0x343863){return _0x323237['sendStatus'](_0x54349a);}return _0x323237[_0x4bf2('0x13')](_0x54349a)[_0x4bf2('0x14')]();};}function respondWithResult(_0x37c731,_0x47a90f){_0x47a90f=_0x47a90f||0xc8;return function(_0x342f47){if(_0x342f47){return _0x37c731[_0x4bf2('0x13')](_0x47a90f)['json'](_0x342f47);}};}function respondWithFilteredResult(_0x40fbdd,_0x386a9a){return function(_0x513760){if(_0x513760){var _0x421538=_0x513760[_0x4bf2('0x15')],_0x34c5a8=_0x386a9a[_0x4bf2('0x16')],_0x46e6f7=_0x386a9a['offset']+_0x386a9a['limit'],_0x2a3215;if(_0x46e6f7>=_0x421538){_0x46e6f7=_0x421538;_0x2a3215=0xc8;}else{_0x2a3215=0xce;}_0x40fbdd[_0x4bf2('0x13')](_0x2a3215);return _0x40fbdd[_0x4bf2('0x17')](_0x4bf2('0x18'),_0x34c5a8+'-'+_0x46e6f7+'/'+_0x421538)[_0x4bf2('0x19')](_0x513760);}return null;};}function patchUpdates(_0x268f6c){return function(_0xc5403d){try{jsonpatch[_0x4bf2('0x1a')](_0xc5403d,_0x268f6c,!![]);}catch(_0xde15f){return BPromise[_0x4bf2('0x1b')](_0xde15f);}return _0xc5403d[_0x4bf2('0x1c')]();};}function saveUpdates(_0xb666b0,_0x10236b){return function(_0x17848b){if(_0x17848b){return _0x17848b[_0x4bf2('0x1d')](_0xb666b0)[_0x4bf2('0x1e')](function(_0x2e20f7){return _0x2e20f7;});}return null;};}function removeEntity(_0x2e4da7,_0xc0d451){return function(_0x30489){if(_0x30489){return _0x30489[_0x4bf2('0x1f')]()['then'](function(){_0x2e4da7[_0x4bf2('0x13')](0xcc)[_0x4bf2('0x14')]();});}};}function handleEntityNotFound(_0x53bf08,_0x20e558){return function(_0x29a02b){if(!_0x29a02b){_0x53bf08[_0x4bf2('0x20')](0x194);}return _0x29a02b;};}function handleError(_0x3befac,_0xebbcbe){_0xebbcbe=_0xebbcbe||0x1f4;return function(_0x3199f7){logger['error'](_0x3199f7[_0x4bf2('0x21')]);if(_0x3199f7[_0x4bf2('0x22')]){delete _0x3199f7[_0x4bf2('0x22')];}_0x3befac['status'](_0xebbcbe)[_0x4bf2('0x23')](_0x3199f7);};}exports['index']=function(_0x345893,_0x207351){var _0x364d25={},_0x479c3c={},_0x86444e={'count':0x0,'rows':[]};var _0x5a136c=_['map'](db[_0x4bf2('0x24')][_0x4bf2('0x25')],function(_0x5a7a7c){return{'name':_0x5a7a7c[_0x4bf2('0x26')],'type':_0x5a7a7c['type'][_0x4bf2('0x27')]};});_0x479c3c[_0x4bf2('0x28')]=_[_0x4bf2('0x29')](_0x5a136c,_0x4bf2('0x22'));_0x479c3c[_0x4bf2('0x2a')]=_['keys'](_0x345893[_0x4bf2('0x2a')]);_0x479c3c[_0x4bf2('0x2b')]=_[_0x4bf2('0x2c')](_0x479c3c[_0x4bf2('0x28')],_0x479c3c[_0x4bf2('0x2a')]);_0x364d25[_0x4bf2('0x2d')]=_[_0x4bf2('0x2c')](_0x479c3c['model'],qs['fields'](_0x345893[_0x4bf2('0x2a')][_0x4bf2('0x2e')]));_0x364d25['attributes']=_0x364d25['attributes'][_0x4bf2('0x2f')]?_0x364d25[_0x4bf2('0x2d')]:_0x479c3c[_0x4bf2('0x28')];if(!_0x345893['query'][_0x4bf2('0x30')](_0x4bf2('0x31'))){_0x364d25[_0x4bf2('0x32')]=qs['limit'](_0x345893[_0x4bf2('0x2a')][_0x4bf2('0x32')]);_0x364d25['offset']=qs[_0x4bf2('0x16')](_0x345893['query']['offset']);}_0x364d25[_0x4bf2('0x33')]=qs[_0x4bf2('0x34')](_0x345893[_0x4bf2('0x2a')][_0x4bf2('0x34')]);_0x364d25['where']=qs[_0x4bf2('0x2b')](_[_0x4bf2('0x35')](_0x345893[_0x4bf2('0x2a')],_0x479c3c[_0x4bf2('0x2b')]));if(_0x345893['query'][_0x4bf2('0x36')]){_0x364d25[_0x4bf2('0x37')]=_[_0x4bf2('0x38')](_0x364d25[_0x4bf2('0x37')],{'$or':_[_0x4bf2('0x29')](_0x5a136c,function(_0x10a869){if(_0x10a869['type']!==_0x4bf2('0x39')){var _0x2ed333={};_0x2ed333[_0x10a869[_0x4bf2('0x22')]]={'$like':'%'+_0x345893[_0x4bf2('0x2a')][_0x4bf2('0x36')]+'%'};return _0x2ed333;}})});}_0x364d25=_[_0x4bf2('0x38')]({},_0x364d25,_0x345893[_0x4bf2('0x3a')]);var _0x3a97b7={'where':_0x364d25[_0x4bf2('0x37')]};return db[_0x4bf2('0x24')][_0x4bf2('0x15')](_0x3a97b7)['then'](function(_0x5b741d){_0x86444e[_0x4bf2('0x15')]=_0x5b741d;if(_0x345893[_0x4bf2('0x2a')][_0x4bf2('0x3b')]){_0x364d25[_0x4bf2('0x3c')]=[{'all':!![]}];}return db['MailServerOut'][_0x4bf2('0x3d')](_0x364d25);})['then'](function(_0x523427){_0x86444e[_0x4bf2('0x3e')]=_0x523427;return _0x86444e;})[_0x4bf2('0x1e')](respondWithFilteredResult(_0x207351,_0x364d25))[_0x4bf2('0x3f')](handleError(_0x207351,null));};exports[_0x4bf2('0x40')]=function(_0x532f8e,_0x365d5d){var _0x55a296={'raw':!![],'where':{'id':_0x532f8e['params']['id']}},_0x5a531b={};_0x5a531b['model']=_[_0x4bf2('0x41')](db[_0x4bf2('0x24')][_0x4bf2('0x25')]);_0x5a531b[_0x4bf2('0x2a')]=_[_0x4bf2('0x41')](_0x532f8e['query']);_0x5a531b['filters']=_[_0x4bf2('0x2c')](_0x5a531b[_0x4bf2('0x28')],_0x5a531b[_0x4bf2('0x2a')]);_0x55a296[_0x4bf2('0x2d')]=_[_0x4bf2('0x2c')](_0x5a531b[_0x4bf2('0x28')],qs['fields'](_0x532f8e[_0x4bf2('0x2a')]['fields']));_0x55a296[_0x4bf2('0x2d')]=_0x55a296['attributes'][_0x4bf2('0x2f')]?_0x55a296[_0x4bf2('0x2d')]:_0x5a531b[_0x4bf2('0x28')];if(_0x532f8e[_0x4bf2('0x2a')][_0x4bf2('0x3b')]){_0x55a296[_0x4bf2('0x3c')]=[{'all':!![]}];}_0x55a296=_['merge']({},_0x55a296,_0x532f8e[_0x4bf2('0x3a')]);return db[_0x4bf2('0x24')][_0x4bf2('0x42')](_0x55a296)[_0x4bf2('0x1e')](handleEntityNotFound(_0x365d5d,null))[_0x4bf2('0x1e')](respondWithResult(_0x365d5d,null))[_0x4bf2('0x3f')](handleError(_0x365d5d,null));};exports[_0x4bf2('0x43')]=function(_0x55c6d1,_0x21fb96){return db[_0x4bf2('0x24')][_0x4bf2('0x43')](_0x55c6d1['body'],{})[_0x4bf2('0x1e')](respondWithResult(_0x21fb96,0xc9))[_0x4bf2('0x3f')](handleError(_0x21fb96,null));};exports['update']=function(_0x1e2475,_0x3f8317){if(_0x1e2475[_0x4bf2('0x44')]['id']){delete _0x1e2475['body']['id'];}return db[_0x4bf2('0x24')][_0x4bf2('0x42')]({'where':{'id':_0x1e2475[_0x4bf2('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f8317,null))['then'](saveUpdates(_0x1e2475[_0x4bf2('0x44')],null))['then'](respondWithResult(_0x3f8317,null))[_0x4bf2('0x3f')](handleError(_0x3f8317,null));};exports[_0x4bf2('0x1f')]=function(_0x3430a9,_0x1cac71){return db[_0x4bf2('0x24')][_0x4bf2('0x42')]({'where':{'id':_0x3430a9[_0x4bf2('0x45')]['id']}})[_0x4bf2('0x1e')](handleEntityNotFound(_0x1cac71,null))[_0x4bf2('0x1e')](removeEntity(_0x1cac71,null))[_0x4bf2('0x3f')](handleError(_0x1cac71,null));}; \ No newline at end of file +var _0x72fb=['path','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','MailServerOut','rawAttributes','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0xdb894b,_0x39a34e){var _0x979022=function(_0xee62c2){while(--_0xee62c2){_0xdb894b['push'](_0xdb894b['shift']());}};_0x979022(++_0x39a34e);}(_0x72fb,0x1f1));var _0xb72f=function(_0x404eed,_0x5390c5){_0x404eed=_0x404eed-0x0;var _0xd45887=_0x72fb[_0x404eed];return _0xd45887;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb72f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb72f('0x1'));var jsonpatch=require(_0xb72f('0x2'));var rp=require(_0xb72f('0x3'));var moment=require(_0xb72f('0x4'));var BPromise=require(_0xb72f('0x5'));var Mustache=require(_0xb72f('0x6'));var util=require('util');var path=require(_0xb72f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb72f('0x8'));var fs=require('fs');var _=require(_0xb72f('0x9'));var squel=require('squel');var crypto=require(_0xb72f('0xa'));var jsforce=require(_0xb72f('0xb'));var deskjs=require(_0xb72f('0xc'));var toCsv=require(_0xb72f('0xd'));var querystring=require('querystring');var Papa=require(_0xb72f('0xe'));var Redis=require(_0xb72f('0xf'));var authService=require(_0xb72f('0x10'));var qs=require(_0xb72f('0x11'));var as=require(_0xb72f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb72f('0x13'))(_0xb72f('0x14'));var utils=require(_0xb72f('0x15'));var config=require(_0xb72f('0x16'));var db=require(_0xb72f('0x17'))['db'];function respondWithStatusCode(_0x487593,_0x3f8397){_0x3f8397=_0x3f8397||0xcc;return function(_0x749fb1){if(_0x749fb1){return _0x487593[_0xb72f('0x18')](_0x3f8397);}return _0x487593[_0xb72f('0x19')](_0x3f8397)[_0xb72f('0x1a')]();};}function respondWithResult(_0x4cd532,_0x17c3ff){_0x17c3ff=_0x17c3ff||0xc8;return function(_0x37faeb){if(_0x37faeb){return _0x4cd532[_0xb72f('0x19')](_0x17c3ff)[_0xb72f('0x1b')](_0x37faeb);}};}function respondWithFilteredResult(_0xeb14da,_0x3b3611){return function(_0x23fcf7){if(_0x23fcf7){var _0x4e63ef=_0x23fcf7[_0xb72f('0x1c')],_0x15b9e6=_0x3b3611[_0xb72f('0x1d')],_0x48ae05=_0x3b3611['offset']+_0x3b3611[_0xb72f('0x1e')],_0x5119a7;if(_0x48ae05>=_0x4e63ef){_0x48ae05=_0x4e63ef;_0x5119a7=0xc8;}else{_0x5119a7=0xce;}_0xeb14da[_0xb72f('0x19')](_0x5119a7);return _0xeb14da[_0xb72f('0x1f')](_0xb72f('0x20'),_0x15b9e6+'-'+_0x48ae05+'/'+_0x4e63ef)[_0xb72f('0x1b')](_0x23fcf7);}return null;};}function patchUpdates(_0x18783e){return function(_0x586b66){try{jsonpatch[_0xb72f('0x21')](_0x586b66,_0x18783e,!![]);}catch(_0x1e723d){return BPromise[_0xb72f('0x22')](_0x1e723d);}return _0x586b66[_0xb72f('0x23')]();};}function saveUpdates(_0x439351,_0x1f9cfe){return function(_0x3c56d9){if(_0x3c56d9){return _0x3c56d9[_0xb72f('0x24')](_0x439351)[_0xb72f('0x25')](function(_0x32f60f){return _0x32f60f;});}return null;};}function removeEntity(_0x284b95,_0x2b2d50){return function(_0x2038a3){if(_0x2038a3){return _0x2038a3[_0xb72f('0x26')]()[_0xb72f('0x25')](function(){_0x284b95[_0xb72f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x295ccd,_0x2d7137){return function(_0x49f2dd){if(!_0x49f2dd){_0x295ccd[_0xb72f('0x18')](0x194);}return _0x49f2dd;};}function handleError(_0x2d2623,_0x10be1d){_0x10be1d=_0x10be1d||0x1f4;return function(_0x6ae801){logger[_0xb72f('0x27')](_0x6ae801[_0xb72f('0x28')]);if(_0x6ae801[_0xb72f('0x29')]){delete _0x6ae801[_0xb72f('0x29')];}_0x2d2623[_0xb72f('0x19')](_0x10be1d)['send'](_0x6ae801);};}exports[_0xb72f('0x2a')]=function(_0x5d871f,_0x13c44a){var _0xa1ee2f={},_0x5ddbb3={},_0x704c53={'count':0x0,'rows':[]};var _0xc51d5c=_['map'](db[_0xb72f('0x2b')][_0xb72f('0x2c')],function(_0xd48ae2){return{'name':_0xd48ae2['fieldName'],'type':_0xd48ae2[_0xb72f('0x2d')][_0xb72f('0x2e')]};});_0x5ddbb3['model']=_[_0xb72f('0x2f')](_0xc51d5c,_0xb72f('0x29'));_0x5ddbb3[_0xb72f('0x30')]=_['keys'](_0x5d871f[_0xb72f('0x30')]);_0x5ddbb3[_0xb72f('0x31')]=_['intersection'](_0x5ddbb3[_0xb72f('0x32')],_0x5ddbb3[_0xb72f('0x30')]);_0xa1ee2f[_0xb72f('0x33')]=_[_0xb72f('0x34')](_0x5ddbb3[_0xb72f('0x32')],qs[_0xb72f('0x35')](_0x5d871f[_0xb72f('0x30')]['fields']));_0xa1ee2f[_0xb72f('0x33')]=_0xa1ee2f[_0xb72f('0x33')][_0xb72f('0x36')]?_0xa1ee2f[_0xb72f('0x33')]:_0x5ddbb3[_0xb72f('0x32')];if(!_0x5d871f['query'][_0xb72f('0x37')](_0xb72f('0x38'))){_0xa1ee2f['limit']=qs[_0xb72f('0x1e')](_0x5d871f[_0xb72f('0x30')]['limit']);_0xa1ee2f[_0xb72f('0x1d')]=qs[_0xb72f('0x1d')](_0x5d871f['query'][_0xb72f('0x1d')]);}_0xa1ee2f[_0xb72f('0x39')]=qs['sort'](_0x5d871f['query']['sort']);_0xa1ee2f[_0xb72f('0x3a')]=qs[_0xb72f('0x31')](_['pick'](_0x5d871f[_0xb72f('0x30')],_0x5ddbb3[_0xb72f('0x31')]));if(_0x5d871f[_0xb72f('0x30')]['filter']){_0xa1ee2f[_0xb72f('0x3a')]=_['merge'](_0xa1ee2f[_0xb72f('0x3a')],{'$or':_['map'](_0xc51d5c,function(_0x28dee5){if(_0x28dee5[_0xb72f('0x2d')]!==_0xb72f('0x3b')){var _0x4c58d2={};_0x4c58d2[_0x28dee5[_0xb72f('0x29')]]={'$like':'%'+_0x5d871f['query'][_0xb72f('0x3c')]+'%'};return _0x4c58d2;}})});}_0xa1ee2f=_[_0xb72f('0x3d')]({},_0xa1ee2f,_0x5d871f['options']);var _0x4f6af9={'where':_0xa1ee2f[_0xb72f('0x3a')]};return db[_0xb72f('0x2b')][_0xb72f('0x1c')](_0x4f6af9)['then'](function(_0x326c03){_0x704c53[_0xb72f('0x1c')]=_0x326c03;if(_0x5d871f['query'][_0xb72f('0x3e')]){_0xa1ee2f[_0xb72f('0x3f')]=[{'all':!![]}];}return db[_0xb72f('0x2b')]['findAll'](_0xa1ee2f);})[_0xb72f('0x25')](function(_0x38dfe1){_0x704c53[_0xb72f('0x40')]=_0x38dfe1;return _0x704c53;})[_0xb72f('0x25')](respondWithFilteredResult(_0x13c44a,_0xa1ee2f))[_0xb72f('0x41')](handleError(_0x13c44a,null));};exports[_0xb72f('0x42')]=function(_0x4ede0a,_0x24cd53){var _0x54096b={'raw':!![],'where':{'id':_0x4ede0a[_0xb72f('0x43')]['id']}},_0x57da19={};_0x57da19[_0xb72f('0x32')]=_[_0xb72f('0x44')](db[_0xb72f('0x2b')]['rawAttributes']);_0x57da19['query']=_[_0xb72f('0x44')](_0x4ede0a[_0xb72f('0x30')]);_0x57da19[_0xb72f('0x31')]=_[_0xb72f('0x34')](_0x57da19[_0xb72f('0x32')],_0x57da19[_0xb72f('0x30')]);_0x54096b[_0xb72f('0x33')]=_[_0xb72f('0x34')](_0x57da19['model'],qs[_0xb72f('0x35')](_0x4ede0a[_0xb72f('0x30')][_0xb72f('0x35')]));_0x54096b[_0xb72f('0x33')]=_0x54096b[_0xb72f('0x33')][_0xb72f('0x36')]?_0x54096b['attributes']:_0x57da19[_0xb72f('0x32')];if(_0x4ede0a[_0xb72f('0x30')][_0xb72f('0x3e')]){_0x54096b[_0xb72f('0x3f')]=[{'all':!![]}];}_0x54096b=_[_0xb72f('0x3d')]({},_0x54096b,_0x4ede0a['options']);return db[_0xb72f('0x2b')][_0xb72f('0x45')](_0x54096b)[_0xb72f('0x25')](handleEntityNotFound(_0x24cd53,null))[_0xb72f('0x25')](respondWithResult(_0x24cd53,null))['catch'](handleError(_0x24cd53,null));};exports[_0xb72f('0x46')]=function(_0x4710e6,_0x4f8f94){return db[_0xb72f('0x2b')]['create'](_0x4710e6[_0xb72f('0x47')],{})['then'](respondWithResult(_0x4f8f94,0xc9))[_0xb72f('0x41')](handleError(_0x4f8f94,null));};exports[_0xb72f('0x24')]=function(_0x40d187,_0x449402){if(_0x40d187[_0xb72f('0x47')]['id']){delete _0x40d187[_0xb72f('0x47')]['id'];}return db[_0xb72f('0x2b')][_0xb72f('0x45')]({'where':{'id':_0x40d187['params']['id']}})['then'](handleEntityNotFound(_0x449402,null))[_0xb72f('0x25')](saveUpdates(_0x40d187[_0xb72f('0x47')],null))[_0xb72f('0x25')](respondWithResult(_0x449402,null))[_0xb72f('0x41')](handleError(_0x449402,null));};exports[_0xb72f('0x26')]=function(_0x37be09,_0x33d92b){return db[_0xb72f('0x2b')][_0xb72f('0x45')]({'where':{'id':_0x37be09['params']['id']}})[_0xb72f('0x25')](handleEntityNotFound(_0x33d92b,null))[_0xb72f('0x25')](removeEntity(_0x33d92b,null))['catch'](handleError(_0x33d92b,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index deec08b..3da4a47 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 _0x53ec=['bluebird','path','../../config/environment','./mailServerOut.attributes','define','MailServerOut','lodash','util','../../config/logger','api','moment'];(function(_0x1ba70a,_0x25c208){var _0x30857a=function(_0x289925){while(--_0x289925){_0x1ba70a['push'](_0x1ba70a['shift']());}};_0x30857a(++_0x25c208);}(_0x53ec,0x192));var _0xc53e=function(_0x35f2d6,_0x1eacc1){_0x35f2d6=_0x35f2d6-0x0;var _0x33a492=_0x53ec[_0x35f2d6];return _0x33a492;};'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':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4e7abc,_0x2aeca1){_0x4e7abc=_0x4e7abc-0x0;var _0x428796=_0x7fbe[_0x4e7abc];return _0x428796;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index c38f194..0cd7f55 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 _0x2f9f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','message','MailServerOut,\x20%s,\x20%s','catch'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x2f9f,0x1d4));var _0xf2f9=function(_0x4c3d23,_0xeb5cfa){_0x4c3d23=_0x4c3d23-0x0;var _0x5d46bc=_0x2f9f[_0x4c3d23];return _0x5d46bc;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xf2f9('0x0'));var rs=require(_0xf2f9('0x1'));var fs=require('fs');var Redis=require(_0xf2f9('0x2'));var db=require(_0xf2f9('0x3'))['db'];var utils=require(_0xf2f9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf2f9('0x5'));var jayson=require(_0xf2f9('0x6'));var client=jayson['client'][_0xf2f9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5a2764,_0x346c2f,_0x2cdf6f){return new BPromise(function(_0x4da350,_0x54451e){return client[_0xf2f9('0x8')](_0x5a2764,_0x2cdf6f)[_0xf2f9('0x9')](function(_0x285cf3){logger[_0xf2f9('0xa')]('MailServerOut,\x20%s,\x20%s',_0x346c2f,_0xf2f9('0xb'));logger[_0xf2f9('0xc')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x346c2f,_0xf2f9('0xb'),JSON['stringify'](_0x285cf3));if(_0x285cf3[_0xf2f9('0xd')]){if(_0x285cf3[_0xf2f9('0xd')][_0xf2f9('0xe')]===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x346c2f,_0x285cf3[_0xf2f9('0xd')][_0xf2f9('0xf')]);return _0x54451e(_0x285cf3[_0xf2f9('0xd')][_0xf2f9('0xf')]);}logger[_0xf2f9('0xd')](_0xf2f9('0x10'),_0x346c2f,_0x285cf3[_0xf2f9('0xd')][_0xf2f9('0xf')]);return _0x4da350(_0x285cf3[_0xf2f9('0xd')][_0xf2f9('0xf')]);}else{logger[_0xf2f9('0xa')](_0xf2f9('0x10'),_0x346c2f,_0xf2f9('0xb'));_0x4da350(_0x285cf3['result']['message']);}})[_0xf2f9('0x11')](function(_0x5efc6f){logger['error'](_0xf2f9('0x10'),_0x346c2f,_0x5efc6f);_0x54451e(_0x5efc6f);});});} \ No newline at end of file +var _0xd0ad=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x12af14,_0x135bc5){var _0x100286=function(_0x49ba84){while(--_0x49ba84){_0x12af14['push'](_0x12af14['shift']());}};_0x100286(++_0x135bc5);}(_0xd0ad,0x1c3));var _0xdd0a=function(_0x3b9098,_0x4abc92){_0x3b9098=_0x3b9098-0x0;var _0x23bda6=_0xd0ad[_0x3b9098];return _0x23bda6;};'use strict';var _=require(_0xdd0a('0x0'));var util=require('util');var moment=require(_0xdd0a('0x1'));var BPromise=require(_0xdd0a('0x2'));var rs=require(_0xdd0a('0x3'));var fs=require('fs');var Redis=require(_0xdd0a('0x4'));var db=require(_0xdd0a('0x5'))['db'];var utils=require(_0xdd0a('0x6'));var logger=require(_0xdd0a('0x7'))(_0xdd0a('0x8'));var config=require(_0xdd0a('0x9'));var jayson=require(_0xdd0a('0xa'));var client=jayson[_0xdd0a('0xb')][_0xdd0a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f5b82,_0x30406b,_0x4eaf25){return new BPromise(function(_0x301460,_0x41b4c3){return client[_0xdd0a('0xd')](_0x3f5b82,_0x4eaf25)[_0xdd0a('0xe')](function(_0x42ba7e){logger[_0xdd0a('0xf')](_0xdd0a('0x10'),_0x30406b,_0xdd0a('0x11'));logger[_0xdd0a('0x12')](_0xdd0a('0x13'),_0x30406b,_0xdd0a('0x11'),JSON[_0xdd0a('0x14')](_0x42ba7e));if(_0x42ba7e[_0xdd0a('0x15')]){if(_0x42ba7e[_0xdd0a('0x15')]['code']===0x1f4){logger[_0xdd0a('0x15')]('MailServerOut,\x20%s,\x20%s',_0x30406b,_0x42ba7e[_0xdd0a('0x15')][_0xdd0a('0x16')]);return _0x41b4c3(_0x42ba7e[_0xdd0a('0x15')]['message']);}logger[_0xdd0a('0x15')](_0xdd0a('0x10'),_0x30406b,_0x42ba7e[_0xdd0a('0x15')][_0xdd0a('0x16')]);return _0x301460(_0x42ba7e[_0xdd0a('0x15')][_0xdd0a('0x16')]);}else{logger[_0xdd0a('0xf')](_0xdd0a('0x10'),_0x30406b,_0xdd0a('0x11'));_0x301460(_0x42ba7e[_0xdd0a('0x17')][_0xdd0a('0x16')]);}})[_0xdd0a('0x18')](function(_0x7a6d19){logger[_0xdd0a('0x15')](_0xdd0a('0x10'),_0x30406b,_0x7a6d19);_0x41b4c3(_0x7a6d19);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 151c29b..322918a 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 _0x60e3=['get','index','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','./mailSubstatus.controller'];(function(_0x1df9b0,_0x38552e){var _0x30f032=function(_0x443812){while(--_0x443812){_0x1df9b0['push'](_0x1df9b0['shift']());}};_0x30f032(++_0x38552e);}(_0x60e3,0x1c5));var _0x360e=function(_0x411050,_0x45bf98){_0x411050=_0x411050-0x0;var _0x21f0e3=_0x60e3[_0x411050];return _0x21f0e3;};'use strict';var multer=require(_0x360e('0x0'));var util=require(_0x360e('0x1'));var path=require('path');var timeout=require(_0x360e('0x2'));var express=require('express');var router=express[_0x360e('0x3')]();var auth=require(_0x360e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x360e('0x5'));router[_0x360e('0x6')]('/',auth['isAuthenticated'](),controller[_0x360e('0x7')]);router[_0x360e('0x6')]('/describe',auth[_0x360e('0x8')](),controller['describe']);router[_0x360e('0x6')](_0x360e('0x9'),auth[_0x360e('0x8')](),controller[_0x360e('0xa')]);router[_0x360e('0xb')]('/',auth['isAuthenticated'](),controller[_0x360e('0xc')]);router[_0x360e('0xd')](_0x360e('0x9'),auth[_0x360e('0x8')](),controller[_0x360e('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x360e('0xf')]);module[_0x360e('0x10')]=router; \ No newline at end of file +var _0x2003=['/:id','delete','exports','util','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2003,0x102));var _0x3200=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0x2003[_0x100e36];return _0x1df0c9;};'use strict';var multer=require('multer');var util=require(_0x3200('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3200('0x1'));var router=express['Router']();var auth=require(_0x3200('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x3200('0x3'));var controller=require('./mailSubstatus.controller');router[_0x3200('0x4')]('/',auth[_0x3200('0x5')](),controller[_0x3200('0x6')]);router[_0x3200('0x4')](_0x3200('0x7'),auth[_0x3200('0x5')](),controller[_0x3200('0x8')]);router[_0x3200('0x4')]('/:id',auth[_0x3200('0x5')](),controller[_0x3200('0x9')]);router[_0x3200('0xa')]('/',auth[_0x3200('0x5')](),controller[_0x3200('0xb')]);router['put'](_0x3200('0xc'),auth[_0x3200('0x5')](),controller['update']);router[_0x3200('0xd')]('/:id',auth[_0x3200('0x5')](),controller['destroy']);module[_0x3200('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 0150e85..e7cbade 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 _0x7409=['name','STRING','sequelize','exports'];(function(_0x1fb161,_0x4b42f7){var _0x217efd=function(_0x5b3166){while(--_0x5b3166){_0x1fb161['push'](_0x1fb161['shift']());}};_0x217efd(++_0x4b42f7);}(_0x7409,0x6e));var _0x9740=function(_0x2330fd,_0x56e9c7){_0x2330fd=_0x2330fd-0x0;var _0x5c1eba=_0x7409[_0x2330fd];return _0x5c1eba;};'use strict';var Sequelize=require(_0x9740('0x0'));module[_0x9740('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9740('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9740('0x3')]}}; \ No newline at end of file +var _0x8325=['STRING','sequelize'];(function(_0xe3b694,_0x2cd500){var _0x43033c=function(_0x45ec75){while(--_0x45ec75){_0xe3b694['push'](_0xe3b694['shift']());}};_0x43033c(++_0x2cd500);}(_0x8325,0x1f1));var _0x5832=function(_0x19a60b,_0x173450){_0x19a60b=_0x19a60b-0x0;var _0x351777=_0x8325[_0x19a60b];return _0x351777;};'use strict';var Sequelize=require(_0x5832('0x0'));module['exports']={'name':{'type':Sequelize[_0x5832('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5832('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d97e526..61dd4c0 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 _0xd8fb=['order','sort','where','filter','merge','VIRTUAL','count','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','save','update','then','destroy','error','stack','name','index','map','MailSubstatus','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','limit'];(function(_0x3bb83b,_0x1e17ae){var _0x371429=function(_0x608dd){while(--_0x608dd){_0x3bb83b['push'](_0x3bb83b['shift']());}};_0x371429(++_0x1e17ae);}(_0xd8fb,0x99));var _0xbd8f=function(_0x19a2fe,_0x2dfc81){_0x19a2fe=_0x19a2fe-0x0;var _0x205e42=_0xd8fb[_0x19a2fe];return _0x205e42;};'use strict';var pdf=require(_0xbd8f('0x0'));var emlformat=require(_0xbd8f('0x1'));var rimraf=require(_0xbd8f('0x2'));var zipdir=require(_0xbd8f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbd8f('0x4'));var Mustache=require(_0xbd8f('0x5'));var util=require('util');var path=require(_0xbd8f('0x6'));var sox=require(_0xbd8f('0x7'));var csv=require('to-csv');var ejs=require(_0xbd8f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbd8f('0x9'));var crypto=require('crypto');var jsforce=require(_0xbd8f('0xa'));var deskjs=require(_0xbd8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd8f('0xc'));var Redis=require(_0xbd8f('0xd'));var authService=require(_0xbd8f('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbd8f('0xf'));var hardwareService=require(_0xbd8f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xbd8f('0x11'));var config=require(_0xbd8f('0x12'));var db=require(_0xbd8f('0x13'))['db'];function respondWithStatusCode(_0x5d5705,_0x230988){_0x230988=_0x230988||0xcc;return function(_0x159f09){if(_0x159f09){return _0x5d5705[_0xbd8f('0x14')](_0x230988);}return _0x5d5705[_0xbd8f('0x15')](_0x230988)[_0xbd8f('0x16')]();};}function respondWithResult(_0x383ea5,_0x37d4d5){_0x37d4d5=_0x37d4d5||0xc8;return function(_0x29ffe8){if(_0x29ffe8){return _0x383ea5[_0xbd8f('0x15')](_0x37d4d5)['json'](_0x29ffe8);}};}function respondWithFilteredResult(_0x31573c,_0x829fb2){return function(_0xa57e91){if(_0xa57e91){var _0x10d72e=_0xa57e91['count'],_0x4da96f=_0x829fb2[_0xbd8f('0x17')],_0x174929=_0x829fb2[_0xbd8f('0x17')]+_0x829fb2['limit'],_0x63db18;if(_0x174929>=_0x10d72e){_0x174929=_0x10d72e;_0x63db18=0xc8;}else{_0x63db18=0xce;}_0x31573c[_0xbd8f('0x15')](_0x63db18);return _0x31573c[_0xbd8f('0x18')]('Content-Range',_0x4da96f+'-'+_0x174929+'/'+_0x10d72e)['json'](_0xa57e91);}return null;};}function patchUpdates(_0x33f77c){return function(_0x5d2fdb){try{jsonpatch['apply'](_0x5d2fdb,_0x33f77c,!![]);}catch(_0x159c7b){return BPromise['reject'](_0x159c7b);}return _0x5d2fdb[_0xbd8f('0x19')]();};}function saveUpdates(_0x7f46d4,_0xb47c8e){return function(_0x897f25){if(_0x897f25){return _0x897f25[_0xbd8f('0x1a')](_0x7f46d4)[_0xbd8f('0x1b')](function(_0x24cff5){return _0x24cff5;});}return null;};}function removeEntity(_0x90eff8,_0x2fbe3b){return function(_0x775acc){if(_0x775acc){return _0x775acc[_0xbd8f('0x1c')]()[_0xbd8f('0x1b')](function(){_0x90eff8[_0xbd8f('0x15')](0xcc)[_0xbd8f('0x16')]();});}};}function handleEntityNotFound(_0x320ede,_0xd11ae){return function(_0x395b1b){if(!_0x395b1b){_0x320ede['sendStatus'](0x194);}return _0x395b1b;};}function handleError(_0x359ead,_0x9fa3b1){_0x9fa3b1=_0x9fa3b1||0x1f4;return function(_0x1f9fcc){logger[_0xbd8f('0x1d')](_0x1f9fcc[_0xbd8f('0x1e')]);if(_0x1f9fcc[_0xbd8f('0x1f')]){delete _0x1f9fcc[_0xbd8f('0x1f')];}_0x359ead[_0xbd8f('0x15')](_0x9fa3b1)['send'](_0x1f9fcc);};}exports[_0xbd8f('0x20')]=function(_0x421f3e,_0x5a3a8c){var _0x339df7={},_0x557daa={},_0x41b2a6={'count':0x0,'rows':[]};var _0x30d62e=_[_0xbd8f('0x21')](db[_0xbd8f('0x22')][_0xbd8f('0x23')],function(_0x247b07){return{'name':_0x247b07['fieldName'],'type':_0x247b07[_0xbd8f('0x24')][_0xbd8f('0x25')]};});_0x557daa[_0xbd8f('0x26')]=_[_0xbd8f('0x21')](_0x30d62e,_0xbd8f('0x1f'));_0x557daa[_0xbd8f('0x27')]=_[_0xbd8f('0x28')](_0x421f3e['query']);_0x557daa[_0xbd8f('0x29')]=_[_0xbd8f('0x2a')](_0x557daa[_0xbd8f('0x26')],_0x557daa[_0xbd8f('0x27')]);_0x339df7['attributes']=_['intersection'](_0x557daa[_0xbd8f('0x26')],qs[_0xbd8f('0x2b')](_0x421f3e[_0xbd8f('0x27')][_0xbd8f('0x2b')]));_0x339df7['attributes']=_0x339df7[_0xbd8f('0x2c')][_0xbd8f('0x2d')]?_0x339df7[_0xbd8f('0x2c')]:_0x557daa[_0xbd8f('0x26')];if(!_0x421f3e[_0xbd8f('0x27')]['hasOwnProperty'](_0xbd8f('0x2e'))){_0x339df7[_0xbd8f('0x2f')]=qs[_0xbd8f('0x2f')](_0x421f3e[_0xbd8f('0x27')][_0xbd8f('0x2f')]);_0x339df7['offset']=qs[_0xbd8f('0x17')](_0x421f3e['query'][_0xbd8f('0x17')]);}_0x339df7[_0xbd8f('0x30')]=qs[_0xbd8f('0x31')](_0x421f3e[_0xbd8f('0x27')][_0xbd8f('0x31')]);_0x339df7[_0xbd8f('0x32')]=qs['filters'](_['pick'](_0x421f3e['query'],_0x557daa[_0xbd8f('0x29')]));if(_0x421f3e[_0xbd8f('0x27')][_0xbd8f('0x33')]){_0x339df7[_0xbd8f('0x32')]=_[_0xbd8f('0x34')](_0x339df7[_0xbd8f('0x32')],{'$or':_[_0xbd8f('0x21')](_0x30d62e,function(_0x30c1c2){if(_0x30c1c2[_0xbd8f('0x24')]!==_0xbd8f('0x35')){var _0x3d4c9a={};_0x3d4c9a[_0x30c1c2[_0xbd8f('0x1f')]]={'$like':'%'+_0x421f3e[_0xbd8f('0x27')][_0xbd8f('0x33')]+'%'};return _0x3d4c9a;}})});}_0x339df7=_[_0xbd8f('0x34')]({},_0x339df7,_0x421f3e['options']);var _0x2f22e1={'where':_0x339df7[_0xbd8f('0x32')]};return db['MailSubstatus'][_0xbd8f('0x36')](_0x2f22e1)[_0xbd8f('0x1b')](function(_0x3d3902){_0x41b2a6['count']=_0x3d3902;if(_0x421f3e[_0xbd8f('0x27')]['includeAll']){_0x339df7[_0xbd8f('0x37')]=[{'all':!![]}];}return db[_0xbd8f('0x22')][_0xbd8f('0x38')](_0x339df7);})['then'](function(_0x25031d){_0x41b2a6[_0xbd8f('0x39')]=_0x25031d;return _0x41b2a6;})[_0xbd8f('0x1b')](respondWithFilteredResult(_0x5a3a8c,_0x339df7))['catch'](handleError(_0x5a3a8c,null));};exports[_0xbd8f('0x3a')]=function(_0x3d82ef,_0x2c1397){var _0x351027={'raw':!![],'where':{'id':_0x3d82ef[_0xbd8f('0x3b')]['id']}},_0x280d95={};_0x280d95[_0xbd8f('0x26')]=_[_0xbd8f('0x28')](db[_0xbd8f('0x22')]['rawAttributes']);_0x280d95['query']=_[_0xbd8f('0x28')](_0x3d82ef[_0xbd8f('0x27')]);_0x280d95[_0xbd8f('0x29')]=_[_0xbd8f('0x2a')](_0x280d95['model'],_0x280d95[_0xbd8f('0x27')]);_0x351027[_0xbd8f('0x2c')]=_[_0xbd8f('0x2a')](_0x280d95[_0xbd8f('0x26')],qs[_0xbd8f('0x2b')](_0x3d82ef['query']['fields']));_0x351027[_0xbd8f('0x2c')]=_0x351027['attributes'][_0xbd8f('0x2d')]?_0x351027[_0xbd8f('0x2c')]:_0x280d95[_0xbd8f('0x26')];if(_0x3d82ef[_0xbd8f('0x27')][_0xbd8f('0x3c')]){_0x351027[_0xbd8f('0x37')]=[{'all':!![]}];}_0x351027=_[_0xbd8f('0x34')]({},_0x351027,_0x3d82ef[_0xbd8f('0x3d')]);return db['MailSubstatus'][_0xbd8f('0x3e')](_0x351027)[_0xbd8f('0x1b')](handleEntityNotFound(_0x2c1397,null))[_0xbd8f('0x1b')](respondWithResult(_0x2c1397,null))[_0xbd8f('0x3f')](handleError(_0x2c1397,null));};exports[_0xbd8f('0x40')]=function(_0x43298f,_0x272f70){return db[_0xbd8f('0x22')]['create'](_0x43298f[_0xbd8f('0x41')],{})[_0xbd8f('0x1b')](respondWithResult(_0x272f70,0xc9))[_0xbd8f('0x3f')](handleError(_0x272f70,null));};exports[_0xbd8f('0x1a')]=function(_0x2fdbd0,_0x1e40f2){if(_0x2fdbd0[_0xbd8f('0x41')]['id']){delete _0x2fdbd0[_0xbd8f('0x41')]['id'];}return db[_0xbd8f('0x22')][_0xbd8f('0x3e')]({'where':{'id':_0x2fdbd0[_0xbd8f('0x3b')]['id']}})[_0xbd8f('0x1b')](handleEntityNotFound(_0x1e40f2,null))[_0xbd8f('0x1b')](saveUpdates(_0x2fdbd0[_0xbd8f('0x41')],null))[_0xbd8f('0x1b')](respondWithResult(_0x1e40f2,null))[_0xbd8f('0x3f')](handleError(_0x1e40f2,null));};exports[_0xbd8f('0x1c')]=function(_0x148293,_0x2668a4){return db['MailSubstatus'][_0xbd8f('0x3e')]({'where':{'id':_0x148293[_0xbd8f('0x3b')]['id']}})[_0xbd8f('0x1b')](handleEntityNotFound(_0x2668a4,null))[_0xbd8f('0x1b')](removeEntity(_0x2668a4,null))['catch'](handleError(_0x2668a4,null));};exports[_0xbd8f('0x42')]=function(_0x5a33c5,_0x9bfe93){return db[_0xbd8f('0x22')][_0xbd8f('0x42')]()[_0xbd8f('0x1b')](respondWithResult(_0x9bfe93,null))['catch'](handleError(_0x9bfe93,null));}; \ No newline at end of file +var _0xfcf0=['rawAttributes','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailSubstatus'];(function(_0x41085f,_0x4c4675){var _0x1fb4b2=function(_0x1a7b51){while(--_0x1a7b51){_0x41085f['push'](_0x41085f['shift']());}};_0x1fb4b2(++_0x4c4675);}(_0xfcf0,0x138));var _0x0fcf=function(_0x108d5f,_0x33f82d){_0x108d5f=_0x108d5f-0x0;var _0x456ea3=_0xfcf0[_0x108d5f];return _0x456ea3;};'use strict';var pdf=require(_0x0fcf('0x0'));var emlformat=require(_0x0fcf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0fcf('0x2'));var jsonpatch=require(_0x0fcf('0x3'));var rp=require(_0x0fcf('0x4'));var moment=require(_0x0fcf('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0fcf('0x6'));var util=require(_0x0fcf('0x7'));var path=require(_0x0fcf('0x8'));var sox=require(_0x0fcf('0x9'));var csv=require(_0x0fcf('0xa'));var ejs=require(_0x0fcf('0xb'));var fs=require('fs');var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0xa'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29336a,_0x3c999e){_0x3c999e=_0x3c999e||0xcc;return function(_0x4b4904){if(_0x4b4904){return _0x29336a[_0x0fcf('0x17')](_0x3c999e);}return _0x29336a[_0x0fcf('0x18')](_0x3c999e)[_0x0fcf('0x19')]();};}function respondWithResult(_0x26b169,_0x25fadc){_0x25fadc=_0x25fadc||0xc8;return function(_0x48bba6){if(_0x48bba6){return _0x26b169[_0x0fcf('0x18')](_0x25fadc)[_0x0fcf('0x1a')](_0x48bba6);}};}function respondWithFilteredResult(_0x1fcb47,_0x5e867f){return function(_0x3c09c4){if(_0x3c09c4){var _0x610106=_0x3c09c4[_0x0fcf('0x1b')],_0x445207=_0x5e867f[_0x0fcf('0x1c')],_0x177c8f=_0x5e867f[_0x0fcf('0x1c')]+_0x5e867f[_0x0fcf('0x1d')],_0x48dd53;if(_0x177c8f>=_0x610106){_0x177c8f=_0x610106;_0x48dd53=0xc8;}else{_0x48dd53=0xce;}_0x1fcb47[_0x0fcf('0x18')](_0x48dd53);return _0x1fcb47['set'](_0x0fcf('0x1e'),_0x445207+'-'+_0x177c8f+'/'+_0x610106)[_0x0fcf('0x1a')](_0x3c09c4);}return null;};}function patchUpdates(_0x5dad87){return function(_0x152686){try{jsonpatch[_0x0fcf('0x1f')](_0x152686,_0x5dad87,!![]);}catch(_0x4da7e3){return BPromise[_0x0fcf('0x20')](_0x4da7e3);}return _0x152686['save']();};}function saveUpdates(_0x3fc9e6,_0x13454e){return function(_0x5c8279){if(_0x5c8279){return _0x5c8279[_0x0fcf('0x21')](_0x3fc9e6)[_0x0fcf('0x22')](function(_0x29dbdf){return _0x29dbdf;});}return null;};}function removeEntity(_0x5c459c,_0x2f03ce){return function(_0x1dafc8){if(_0x1dafc8){return _0x1dafc8[_0x0fcf('0x23')]()[_0x0fcf('0x22')](function(){_0x5c459c[_0x0fcf('0x18')](0xcc)[_0x0fcf('0x19')]();});}};}function handleEntityNotFound(_0x5841a9,_0x2eef74){return function(_0x253641){if(!_0x253641){_0x5841a9[_0x0fcf('0x17')](0x194);}return _0x253641;};}function handleError(_0xd6f8b5,_0x233ac9){_0x233ac9=_0x233ac9||0x1f4;return function(_0x3cf074){logger[_0x0fcf('0x24')](_0x3cf074[_0x0fcf('0x25')]);if(_0x3cf074[_0x0fcf('0x26')]){delete _0x3cf074['name'];}_0xd6f8b5[_0x0fcf('0x18')](_0x233ac9)[_0x0fcf('0x27')](_0x3cf074);};}exports[_0x0fcf('0x28')]=function(_0x2f198b,_0x3876ed){var _0x38fe0e={},_0x2730b0={},_0x527d43={'count':0x0,'rows':[]};var _0x137e10=_[_0x0fcf('0x29')](db[_0x0fcf('0x2a')][_0x0fcf('0x2b')],function(_0x49fd0e){return{'name':_0x49fd0e['fieldName'],'type':_0x49fd0e['type'][_0x0fcf('0x2c')]};});_0x2730b0['model']=_[_0x0fcf('0x29')](_0x137e10,_0x0fcf('0x26'));_0x2730b0['query']=_[_0x0fcf('0x2d')](_0x2f198b[_0x0fcf('0x2e')]);_0x2730b0[_0x0fcf('0x2f')]=_[_0x0fcf('0x30')](_0x2730b0[_0x0fcf('0x31')],_0x2730b0[_0x0fcf('0x2e')]);_0x38fe0e['attributes']=_[_0x0fcf('0x30')](_0x2730b0[_0x0fcf('0x31')],qs[_0x0fcf('0x32')](_0x2f198b[_0x0fcf('0x2e')][_0x0fcf('0x32')]));_0x38fe0e[_0x0fcf('0x33')]=_0x38fe0e['attributes'][_0x0fcf('0x34')]?_0x38fe0e[_0x0fcf('0x33')]:_0x2730b0[_0x0fcf('0x31')];if(!_0x2f198b[_0x0fcf('0x2e')][_0x0fcf('0x35')](_0x0fcf('0x36'))){_0x38fe0e[_0x0fcf('0x1d')]=qs[_0x0fcf('0x1d')](_0x2f198b[_0x0fcf('0x2e')][_0x0fcf('0x1d')]);_0x38fe0e[_0x0fcf('0x1c')]=qs[_0x0fcf('0x1c')](_0x2f198b[_0x0fcf('0x2e')][_0x0fcf('0x1c')]);}_0x38fe0e['order']=qs['sort'](_0x2f198b[_0x0fcf('0x2e')]['sort']);_0x38fe0e['where']=qs[_0x0fcf('0x2f')](_[_0x0fcf('0x37')](_0x2f198b[_0x0fcf('0x2e')],_0x2730b0['filters']));if(_0x2f198b['query'][_0x0fcf('0x38')]){_0x38fe0e[_0x0fcf('0x39')]=_[_0x0fcf('0x3a')](_0x38fe0e['where'],{'$or':_[_0x0fcf('0x29')](_0x137e10,function(_0x1d2f3b){if(_0x1d2f3b[_0x0fcf('0x3b')]!=='VIRTUAL'){var _0x4c75e6={};_0x4c75e6[_0x1d2f3b['name']]={'$like':'%'+_0x2f198b[_0x0fcf('0x2e')][_0x0fcf('0x38')]+'%'};return _0x4c75e6;}})});}_0x38fe0e=_[_0x0fcf('0x3a')]({},_0x38fe0e,_0x2f198b[_0x0fcf('0x3c')]);var _0x370699={'where':_0x38fe0e['where']};return db[_0x0fcf('0x2a')][_0x0fcf('0x1b')](_0x370699)[_0x0fcf('0x22')](function(_0x4cbc84){_0x527d43['count']=_0x4cbc84;if(_0x2f198b[_0x0fcf('0x2e')][_0x0fcf('0x3d')]){_0x38fe0e[_0x0fcf('0x3e')]=[{'all':!![]}];}return db[_0x0fcf('0x2a')][_0x0fcf('0x3f')](_0x38fe0e);})['then'](function(_0x1dc2f7){_0x527d43[_0x0fcf('0x40')]=_0x1dc2f7;return _0x527d43;})[_0x0fcf('0x22')](respondWithFilteredResult(_0x3876ed,_0x38fe0e))[_0x0fcf('0x41')](handleError(_0x3876ed,null));};exports['show']=function(_0x5f3800,_0x252000){var _0x2444a6={'raw':!![],'where':{'id':_0x5f3800[_0x0fcf('0x42')]['id']}},_0x5544e3={};_0x5544e3[_0x0fcf('0x31')]=_['keys'](db[_0x0fcf('0x2a')][_0x0fcf('0x2b')]);_0x5544e3[_0x0fcf('0x2e')]=_[_0x0fcf('0x2d')](_0x5f3800[_0x0fcf('0x2e')]);_0x5544e3['filters']=_[_0x0fcf('0x30')](_0x5544e3[_0x0fcf('0x31')],_0x5544e3['query']);_0x2444a6['attributes']=_[_0x0fcf('0x30')](_0x5544e3['model'],qs['fields'](_0x5f3800[_0x0fcf('0x2e')][_0x0fcf('0x32')]));_0x2444a6[_0x0fcf('0x33')]=_0x2444a6[_0x0fcf('0x33')][_0x0fcf('0x34')]?_0x2444a6[_0x0fcf('0x33')]:_0x5544e3[_0x0fcf('0x31')];if(_0x5f3800[_0x0fcf('0x2e')][_0x0fcf('0x3d')]){_0x2444a6[_0x0fcf('0x3e')]=[{'all':!![]}];}_0x2444a6=_['merge']({},_0x2444a6,_0x5f3800[_0x0fcf('0x3c')]);return db[_0x0fcf('0x2a')][_0x0fcf('0x43')](_0x2444a6)['then'](handleEntityNotFound(_0x252000,null))['then'](respondWithResult(_0x252000,null))[_0x0fcf('0x41')](handleError(_0x252000,null));};exports[_0x0fcf('0x44')]=function(_0x1587df,_0x405bbe){return db['MailSubstatus']['create'](_0x1587df[_0x0fcf('0x45')],{})[_0x0fcf('0x22')](respondWithResult(_0x405bbe,0xc9))[_0x0fcf('0x41')](handleError(_0x405bbe,null));};exports[_0x0fcf('0x21')]=function(_0x345188,_0x1a7475){if(_0x345188[_0x0fcf('0x45')]['id']){delete _0x345188[_0x0fcf('0x45')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x345188[_0x0fcf('0x42')]['id']}})[_0x0fcf('0x22')](handleEntityNotFound(_0x1a7475,null))[_0x0fcf('0x22')](saveUpdates(_0x345188[_0x0fcf('0x45')],null))[_0x0fcf('0x22')](respondWithResult(_0x1a7475,null))[_0x0fcf('0x41')](handleError(_0x1a7475,null));};exports['destroy']=function(_0x2b6ad3,_0x2aa7c4){return db['MailSubstatus'][_0x0fcf('0x43')]({'where':{'id':_0x2b6ad3[_0x0fcf('0x42')]['id']}})[_0x0fcf('0x22')](handleEntityNotFound(_0x2aa7c4,null))[_0x0fcf('0x22')](removeEntity(_0x2aa7c4,null))['catch'](handleError(_0x2aa7c4,null));};exports[_0x0fcf('0x46')]=function(_0x382448,_0x1bb062){return db[_0x0fcf('0x2a')][_0x0fcf('0x46')]()[_0x0fcf('0x22')](respondWithResult(_0x1bb062,null))[_0x0fcf('0x41')](handleError(_0x1bb062,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 1aab054..f890ae4 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 _0x1131=['define','util','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x1131,0x71));var _0x1113=function(_0x47b84e,_0x38c1d0){_0x47b84e=_0x47b84e-0x0;var _0x39b582=_0x1131[_0x47b84e];return _0x39b582;};'use strict';var _=require('lodash');var util=require(_0x1113('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x1113('0x1'));var rp=require(_0x1113('0x2'));var fs=require('fs');var path=require(_0x1113('0x3'));var rimraf=require(_0x1113('0x4'));var config=require(_0x1113('0x5'));var attributes=require(_0x1113('0x6'));module['exports']=function(_0x3880aa,_0x4e6389){return _0x3880aa[_0x1113('0x7')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8a0=['./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','../../config/logger','api','bluebird'];(function(_0x86597f,_0x5dc3b3){var _0x1f4e98=function(_0x5ed703){while(--_0x5ed703){_0x86597f['push'](_0x86597f['shift']());}};_0x1f4e98(++_0x5dc3b3);}(_0xb8a0,0x1d5));var _0x0b8a=function(_0x1902b7,_0x513502){_0x1902b7=_0x1902b7-0x0;var _0x568b41=_0xb8a0[_0x1902b7];return _0x568b41;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b8a('0x0'))(_0x0b8a('0x1'));var moment=require('moment');var BPromise=require(_0x0b8a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0b8a('0x3'));module[_0x0b8a('0x4')]=function(_0x381b17,_0x165710){return _0x381b17[_0x0b8a('0x5')](_0x0b8a('0x6'),attributes,{'tableName':_0x0b8a('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 21d3d1a..4ff536e 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 _0xa75b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2f6c2e,_0x3af1a9){var _0x5c2e2d=function(_0x5928bf){while(--_0x5928bf){_0x2f6c2e['push'](_0x2f6c2e['shift']());}};_0x5c2e2d(++_0x3af1a9);}(_0xa75b,0x170));var _0xba75=function(_0x5263ea,_0x4f75f6){_0x5263ea=_0x5263ea-0x0;var _0x2cca92=_0xa75b[_0x5263ea];return _0x2cca92;};'use strict';var _=require(_0xba75('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba75('0x1'));var rs=require(_0xba75('0x2'));var fs=require('fs');var Redis=require(_0xba75('0x3'));var db=require(_0xba75('0x4'))['db'];var utils=require(_0xba75('0x5'));var logger=require(_0xba75('0x6'))(_0xba75('0x7'));var config=require(_0xba75('0x8'));var jayson=require(_0xba75('0x9'));var client=jayson[_0xba75('0xa')][_0xba75('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238a33,_0x3ccab5,_0x5c79e3){return new BPromise(function(_0x4b842d,_0x731cae){return client['request'](_0x238a33,_0x5c79e3)['then'](function(_0x218dbd){logger['info'](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));logger[_0xba75('0xe')](_0xba75('0xf'),_0x3ccab5,_0xba75('0xd'),JSON[_0xba75('0x10')](_0x218dbd));if(_0x218dbd[_0xba75('0x11')]){if(_0x218dbd[_0xba75('0x11')][_0xba75('0x12')]===0x1f4){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')]['message']);return _0x731cae(_0x218dbd['error'][_0xba75('0x13')]);}logger['error'](_0xba75('0xc'),_0x3ccab5,_0x218dbd[_0xba75('0x11')][_0xba75('0x13')]);return _0x4b842d(_0x218dbd[_0xba75('0x11')]['message']);}else{logger[_0xba75('0x14')](_0xba75('0xc'),_0x3ccab5,_0xba75('0xd'));_0x4b842d(_0x218dbd[_0xba75('0x15')][_0xba75('0x13')]);}})['catch'](function(_0x350a9d){logger[_0xba75('0x11')](_0xba75('0xc'),_0x3ccab5,_0x350a9d);_0x731cae(_0x350a9d);});});} \ No newline at end of file +var _0xa8a8=['stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x20a46d,_0x3f4bfd){var _0x5e91e7=function(_0x410156){while(--_0x410156){_0x20a46d['push'](_0x20a46d['shift']());}};_0x5e91e7(++_0x3f4bfd);}(_0xa8a8,0xec));var _0x8a8a=function(_0x21942b,_0x367135){_0x21942b=_0x21942b-0x0;var _0x4f875e=_0xa8a8[_0x21942b];return _0x4f875e;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 41bbb80..f881c03 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 _0x1de8=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','create'];(function(_0x73b866,_0x44f23b){var _0x2d6b32=function(_0x230993){while(--_0x230993){_0x73b866['push'](_0x73b866['shift']());}};_0x2d6b32(++_0x44f23b);}(_0x1de8,0x182));var _0x81de=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x1de8[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x81de('0x0'));var util=require('util');var path=require(_0x81de('0x1'));var timeout=require(_0x81de('0x2'));var express=require(_0x81de('0x3'));var router=express[_0x81de('0x4')]();var auth=require(_0x81de('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x81de('0x6'));var controller=require('./mailTransferReport.controller');router[_0x81de('0x7')]('/',auth[_0x81de('0x8')](),controller['index']);router['get'](_0x81de('0x9'),auth[_0x81de('0x8')](),controller[_0x81de('0xa')]);router[_0x81de('0x7')](_0x81de('0xb'),auth[_0x81de('0x8')](),controller['show']);router[_0x81de('0xc')]('/',auth[_0x81de('0x8')](),controller[_0x81de('0xd')]);router['put'](_0x81de('0xb'),auth[_0x81de('0x8')](),controller['update']);router['delete'](_0x81de('0xb'),auth[_0x81de('0x8')](),controller[_0x81de('0xe')]);module[_0x81de('0xf')]=router; \ No newline at end of file +var _0x2040=['put','/:id','update','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','describe','show','post'];(function(_0x4a0cc1,_0x865fb2){var _0x167d22=function(_0x4672c9){while(--_0x4672c9){_0x4a0cc1['push'](_0x4a0cc1['shift']());}};_0x167d22(++_0x865fb2);}(_0x2040,0x180));var _0x0204=function(_0x4bbaf9,_0x5d3179){_0x4bbaf9=_0x4bbaf9-0x0;var _0x1112a8=_0x2040[_0x4bbaf9];return _0x1112a8;};'use strict';var multer=require(_0x0204('0x0'));var util=require(_0x0204('0x1'));var path=require(_0x0204('0x2'));var timeout=require(_0x0204('0x3'));var express=require(_0x0204('0x4'));var router=express[_0x0204('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x0204('0x6'));var config=require(_0x0204('0x7'));var controller=require(_0x0204('0x8'));router[_0x0204('0x9')]('/',auth[_0x0204('0xa')](),controller[_0x0204('0xb')]);router[_0x0204('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x0204('0xc')]);router[_0x0204('0x9')]('/:id',auth[_0x0204('0xa')](),controller[_0x0204('0xd')]);router[_0x0204('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0204('0xf')](_0x0204('0x10'),auth['isAuthenticated'](),controller[_0x0204('0x11')]);router['delete']('/:id',auth[_0x0204('0xa')](),controller['destroy']);module[_0x0204('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 8512a15..7358e8c 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 _0xfc11=['agent','queue','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0xad2680,_0x46aeda){var _0x16a60b=function(_0x204606){while(--_0x204606){_0xad2680['push'](_0xad2680['shift']());}};_0x16a60b(++_0x46aeda);}(_0xfc11,0x8a));var _0x1fc1=function(_0x3a333a,_0x417b45){_0x3a333a=_0x3a333a-0x0;var _0x21f515=_0xfc11[_0x3a333a];return _0x21f515;};'use strict';var moment=require(_0x1fc1('0x0'));var Sequelize=require(_0x1fc1('0x1'));module[_0x1fc1('0x2')]={'uniqueid':{'type':Sequelize[_0x1fc1('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1fc1('0x4')](_0x1fc1('0x5'),_0x1fc1('0x6'),_0x1fc1('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1fc1('0x8')]}}; \ No newline at end of file +var _0x6f98=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x58b89c,_0x4a0753){var _0x200ee0=function(_0x13f0f8){while(--_0x13f0f8){_0x58b89c['push'](_0x58b89c['shift']());}};_0x200ee0(++_0x4a0753);}(_0x6f98,0x1a3));var _0x86f9=function(_0x2df344,_0x20f615){_0x2df344=_0x2df344-0x0;var _0x47af45=_0x6f98[_0x2df344];return _0x47af45;};'use strict';var moment=require(_0x86f9('0x0'));var Sequelize=require(_0x86f9('0x1'));module[_0x86f9('0x2')]={'uniqueid':{'type':Sequelize[_0x86f9('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x86f9('0x4'),_0x86f9('0x5'),_0x86f9('0x6')),'allowNull':![],'defaultValue':_0x86f9('0x6')},'transferredAt':{'type':Sequelize[_0x86f9('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x86f9('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 9aa090c..de02c00 100644 --- a/server/api/mailTransferReport/mailTransferReport.controller.js +++ b/server/api/mailTransferReport/mailTransferReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set'];(function(_0x3b0c1e,_0x19b87d){var _0x2af679=function(_0x13869d){while(--_0x13869d){_0x3b0c1e['push'](_0x3b0c1e['shift']());}};_0x2af679(++_0x19b87d);}(_0x7a54,0x106));var _0x47a5=function(_0x4a38e6,_0x57e658){_0x4a38e6=_0x4a38e6-0x0;var _0xeb1143=_0x7a54[_0x4a38e6];return _0xeb1143;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];function respondWithStatusCode(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0xcc;return function(_0x1eae59){if(_0x1eae59){return _0xd612dd['sendStatus'](_0xd308b8);}return _0xd612dd[_0x47a5('0x15')](_0xd308b8)[_0x47a5('0x16')]();};}function respondWithResult(_0x1cf309,_0x711793){_0x711793=_0x711793||0xc8;return function(_0x139f25){if(_0x139f25){return _0x1cf309[_0x47a5('0x15')](_0x711793)[_0x47a5('0x17')](_0x139f25);}};}function respondWithFilteredResult(_0x190faa,_0x4e99a8){return function(_0x362359){if(_0x362359){var _0x11faf5=_0x362359['count'],_0x3b001e=_0x4e99a8['offset'],_0x2a2cbb=_0x4e99a8[_0x47a5('0x18')]+_0x4e99a8['limit'],_0x1ef44c;if(_0x2a2cbb>=_0x11faf5){_0x2a2cbb=_0x11faf5;_0x1ef44c=0xc8;}else{_0x1ef44c=0xce;}_0x190faa['status'](_0x1ef44c);return _0x190faa[_0x47a5('0x19')](_0x47a5('0x1a'),_0x3b001e+'-'+_0x2a2cbb+'/'+_0x11faf5)[_0x47a5('0x17')](_0x362359);}return null;};}function patchUpdates(_0x1ef371){return function(_0x477b1d){try{jsonpatch[_0x47a5('0x1b')](_0x477b1d,_0x1ef371,!![]);}catch(_0x2763d6){return BPromise[_0x47a5('0x1c')](_0x2763d6);}return _0x477b1d[_0x47a5('0x1d')]();};}function saveUpdates(_0x4a9fcb,_0x1570bc){return function(_0xf160ba){if(_0xf160ba){return _0xf160ba['update'](_0x4a9fcb)[_0x47a5('0x1e')](function(_0x1f03f7){return _0x1f03f7;});}return null;};}function removeEntity(_0x36874d,_0x4c5910){return function(_0xb8ae6c){if(_0xb8ae6c){return _0xb8ae6c[_0x47a5('0x1f')]()[_0x47a5('0x1e')](function(){_0x36874d[_0x47a5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2dea9,_0x385687){return function(_0x513981){if(!_0x513981){_0xe2dea9[_0x47a5('0x20')](0x194);}return _0x513981;};}function handleError(_0xc4cd63,_0x4437f1){_0x4437f1=_0x4437f1||0x1f4;return function(_0x129ce5){logger[_0x47a5('0x21')](_0x129ce5['stack']);if(_0x129ce5['name']){delete _0x129ce5[_0x47a5('0x22')];}_0xc4cd63['status'](_0x4437f1)[_0x47a5('0x23')](_0x129ce5);};}exports['index']=function(_0x23cb77,_0x378208){var _0x36ad34={},_0x1dac65={},_0x21f296={'count':0x0,'rows':[]};var _0x3ba0b7=_[_0x47a5('0x24')](db[_0x47a5('0x25')][_0x47a5('0x26')],function(_0x361bfa){return{'name':_0x361bfa[_0x47a5('0x27')],'type':_0x361bfa[_0x47a5('0x28')][_0x47a5('0x29')]};});_0x1dac65['model']=_[_0x47a5('0x24')](_0x3ba0b7,'name');_0x1dac65[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x23cb77[_0x47a5('0x2a')]);_0x1dac65['filters']=_[_0x47a5('0x2c')](_0x1dac65[_0x47a5('0x2d')],_0x1dac65[_0x47a5('0x2a')]);_0x36ad34[_0x47a5('0x2e')]=_['intersection'](_0x1dac65['model'],qs[_0x47a5('0x2f')](_0x23cb77[_0x47a5('0x2a')]['fields']));_0x36ad34['attributes']=_0x36ad34[_0x47a5('0x2e')][_0x47a5('0x30')]?_0x36ad34['attributes']:_0x1dac65[_0x47a5('0x2d')];if(!_0x23cb77['query'][_0x47a5('0x31')](_0x47a5('0x32'))){_0x36ad34['limit']=qs['limit'](_0x23cb77[_0x47a5('0x2a')]['limit']);_0x36ad34[_0x47a5('0x18')]=qs[_0x47a5('0x18')](_0x23cb77[_0x47a5('0x2a')]['offset']);}_0x36ad34[_0x47a5('0x33')]=qs['sort'](_0x23cb77['query'][_0x47a5('0x34')]);_0x36ad34['where']=qs[_0x47a5('0x35')](_['pick'](_0x23cb77[_0x47a5('0x2a')],_0x1dac65[_0x47a5('0x35')]));if(_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]){_0x36ad34[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x36ad34[_0x47a5('0x37')],{'$or':_[_0x47a5('0x24')](_0x3ba0b7,function(_0x1a0d23){if(_0x1a0d23['type']!==_0x47a5('0x39')){var _0x10f136={};_0x10f136[_0x1a0d23['name']]={'$like':'%'+_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]+'%'};return _0x10f136;}})});}_0x36ad34=_[_0x47a5('0x38')]({},_0x36ad34,_0x23cb77['options']);var _0x101f70={'where':_0x36ad34[_0x47a5('0x37')]};return db['MailTransferReport'][_0x47a5('0x3a')](_0x101f70)[_0x47a5('0x1e')](function(_0x54ae35){_0x21f296['count']=_0x54ae35;if(_0x23cb77['query'][_0x47a5('0x3b')]){_0x36ad34['include']=[{'all':!![]}];}return db[_0x47a5('0x25')][_0x47a5('0x3c')](_0x36ad34);})[_0x47a5('0x1e')](function(_0x111f0d){_0x21f296[_0x47a5('0x3d')]=_0x111f0d;return _0x21f296;})[_0x47a5('0x1e')](respondWithFilteredResult(_0x378208,_0x36ad34))[_0x47a5('0x3e')](handleError(_0x378208,null));};exports[_0x47a5('0x3f')]=function(_0x3fa2a8,_0x36a24e){var _0x280500={'raw':!![],'where':{'id':_0x3fa2a8[_0x47a5('0x40')]['id']}},_0x1658e8={};_0x1658e8['model']=_[_0x47a5('0x2b')](db[_0x47a5('0x25')][_0x47a5('0x26')]);_0x1658e8[_0x47a5('0x2a')]=_['keys'](_0x3fa2a8[_0x47a5('0x2a')]);_0x1658e8['filters']=_['intersection'](_0x1658e8['model'],_0x1658e8['query']);_0x280500[_0x47a5('0x2e')]=_['intersection'](_0x1658e8[_0x47a5('0x2d')],qs[_0x47a5('0x2f')](_0x3fa2a8[_0x47a5('0x2a')]['fields']));_0x280500[_0x47a5('0x2e')]=_0x280500[_0x47a5('0x2e')]['length']?_0x280500['attributes']:_0x1658e8[_0x47a5('0x2d')];if(_0x3fa2a8['query'][_0x47a5('0x3b')]){_0x280500[_0x47a5('0x41')]=[{'all':!![]}];}_0x280500=_[_0x47a5('0x38')]({},_0x280500,_0x3fa2a8[_0x47a5('0x42')]);return db[_0x47a5('0x25')][_0x47a5('0x43')](_0x280500)[_0x47a5('0x1e')](handleEntityNotFound(_0x36a24e,null))[_0x47a5('0x1e')](respondWithResult(_0x36a24e,null))[_0x47a5('0x3e')](handleError(_0x36a24e,null));};exports[_0x47a5('0x44')]=function(_0x24ecb1,_0x3c3ebf){return db[_0x47a5('0x25')][_0x47a5('0x44')](_0x24ecb1[_0x47a5('0x45')],{})[_0x47a5('0x1e')](respondWithResult(_0x3c3ebf,0xc9))['catch'](handleError(_0x3c3ebf,null));};exports[_0x47a5('0x46')]=function(_0x23bb04,_0x49eab1){if(_0x23bb04['body']['id']){delete _0x23bb04[_0x47a5('0x45')]['id'];}return db['MailTransferReport'][_0x47a5('0x43')]({'where':{'id':_0x23bb04[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x49eab1,null))['then'](saveUpdates(_0x23bb04[_0x47a5('0x45')],null))['then'](respondWithResult(_0x49eab1,null))[_0x47a5('0x3e')](handleError(_0x49eab1,null));};exports[_0x47a5('0x1f')]=function(_0x3548bc,_0x3e12a7){return db[_0x47a5('0x25')][_0x47a5('0x43')]({'where':{'id':_0x3548bc[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e12a7,null))['then'](removeEntity(_0x3e12a7,null))[_0x47a5('0x3e')](handleError(_0x3e12a7,null));};exports[_0x47a5('0x47')]=function(_0x1163e3,_0x9ea93e){return db[_0x47a5('0x25')][_0x47a5('0x47')]()[_0x47a5('0x1e')](respondWithResult(_0x9ea93e,null))['catch'](handleError(_0x9ea93e,null));}; \ No newline at end of file +var _0x7a54=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set'];(function(_0x8317f1,_0x2406a3){var _0x1c582b=function(_0x59fe94){while(--_0x59fe94){_0x8317f1['push'](_0x8317f1['shift']());}};_0x1c582b(++_0x2406a3);}(_0x7a54,0x106));var _0x47a5=function(_0x5160ec,_0x176b5d){_0x5160ec=_0x5160ec-0x0;var _0x179b81=_0x7a54[_0x5160ec];return _0x179b81;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];function respondWithStatusCode(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0xcc;return function(_0x1eae59){if(_0x1eae59){return _0xd612dd['sendStatus'](_0xd308b8);}return _0xd612dd[_0x47a5('0x15')](_0xd308b8)[_0x47a5('0x16')]();};}function respondWithResult(_0x1cf309,_0x711793){_0x711793=_0x711793||0xc8;return function(_0x139f25){if(_0x139f25){return _0x1cf309[_0x47a5('0x15')](_0x711793)[_0x47a5('0x17')](_0x139f25);}};}function respondWithFilteredResult(_0x190faa,_0x4e99a8){return function(_0x362359){if(_0x362359){var _0x11faf5=_0x362359['count'],_0x3b001e=_0x4e99a8['offset'],_0x2a2cbb=_0x4e99a8[_0x47a5('0x18')]+_0x4e99a8['limit'],_0x1ef44c;if(_0x2a2cbb>=_0x11faf5){_0x2a2cbb=_0x11faf5;_0x1ef44c=0xc8;}else{_0x1ef44c=0xce;}_0x190faa['status'](_0x1ef44c);return _0x190faa[_0x47a5('0x19')](_0x47a5('0x1a'),_0x3b001e+'-'+_0x2a2cbb+'/'+_0x11faf5)[_0x47a5('0x17')](_0x362359);}return null;};}function patchUpdates(_0x1ef371){return function(_0x477b1d){try{jsonpatch[_0x47a5('0x1b')](_0x477b1d,_0x1ef371,!![]);}catch(_0x2763d6){return BPromise[_0x47a5('0x1c')](_0x2763d6);}return _0x477b1d[_0x47a5('0x1d')]();};}function saveUpdates(_0x4a9fcb,_0x1570bc){return function(_0xf160ba){if(_0xf160ba){return _0xf160ba['update'](_0x4a9fcb)[_0x47a5('0x1e')](function(_0x1f03f7){return _0x1f03f7;});}return null;};}function removeEntity(_0x36874d,_0x4c5910){return function(_0xb8ae6c){if(_0xb8ae6c){return _0xb8ae6c[_0x47a5('0x1f')]()[_0x47a5('0x1e')](function(){_0x36874d[_0x47a5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2dea9,_0x385687){return function(_0x513981){if(!_0x513981){_0xe2dea9[_0x47a5('0x20')](0x194);}return _0x513981;};}function handleError(_0xc4cd63,_0x4437f1){_0x4437f1=_0x4437f1||0x1f4;return function(_0x129ce5){logger[_0x47a5('0x21')](_0x129ce5['stack']);if(_0x129ce5['name']){delete _0x129ce5[_0x47a5('0x22')];}_0xc4cd63['status'](_0x4437f1)[_0x47a5('0x23')](_0x129ce5);};}exports['index']=function(_0x23cb77,_0x378208){var _0x36ad34={},_0x1dac65={},_0x21f296={'count':0x0,'rows':[]};var _0x3ba0b7=_[_0x47a5('0x24')](db[_0x47a5('0x25')][_0x47a5('0x26')],function(_0x361bfa){return{'name':_0x361bfa[_0x47a5('0x27')],'type':_0x361bfa[_0x47a5('0x28')][_0x47a5('0x29')]};});_0x1dac65['model']=_[_0x47a5('0x24')](_0x3ba0b7,'name');_0x1dac65[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x23cb77[_0x47a5('0x2a')]);_0x1dac65['filters']=_[_0x47a5('0x2c')](_0x1dac65[_0x47a5('0x2d')],_0x1dac65[_0x47a5('0x2a')]);_0x36ad34[_0x47a5('0x2e')]=_['intersection'](_0x1dac65['model'],qs[_0x47a5('0x2f')](_0x23cb77[_0x47a5('0x2a')]['fields']));_0x36ad34['attributes']=_0x36ad34[_0x47a5('0x2e')][_0x47a5('0x30')]?_0x36ad34['attributes']:_0x1dac65[_0x47a5('0x2d')];if(!_0x23cb77['query'][_0x47a5('0x31')](_0x47a5('0x32'))){_0x36ad34['limit']=qs['limit'](_0x23cb77[_0x47a5('0x2a')]['limit']);_0x36ad34[_0x47a5('0x18')]=qs[_0x47a5('0x18')](_0x23cb77[_0x47a5('0x2a')]['offset']);}_0x36ad34[_0x47a5('0x33')]=qs['sort'](_0x23cb77['query'][_0x47a5('0x34')]);_0x36ad34['where']=qs[_0x47a5('0x35')](_['pick'](_0x23cb77[_0x47a5('0x2a')],_0x1dac65[_0x47a5('0x35')]));if(_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]){_0x36ad34[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x36ad34[_0x47a5('0x37')],{'$or':_[_0x47a5('0x24')](_0x3ba0b7,function(_0x1a0d23){if(_0x1a0d23['type']!==_0x47a5('0x39')){var _0x10f136={};_0x10f136[_0x1a0d23['name']]={'$like':'%'+_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]+'%'};return _0x10f136;}})});}_0x36ad34=_[_0x47a5('0x38')]({},_0x36ad34,_0x23cb77['options']);var _0x101f70={'where':_0x36ad34[_0x47a5('0x37')]};return db['MailTransferReport'][_0x47a5('0x3a')](_0x101f70)[_0x47a5('0x1e')](function(_0x54ae35){_0x21f296['count']=_0x54ae35;if(_0x23cb77['query'][_0x47a5('0x3b')]){_0x36ad34['include']=[{'all':!![]}];}return db[_0x47a5('0x25')][_0x47a5('0x3c')](_0x36ad34);})[_0x47a5('0x1e')](function(_0x111f0d){_0x21f296[_0x47a5('0x3d')]=_0x111f0d;return _0x21f296;})[_0x47a5('0x1e')](respondWithFilteredResult(_0x378208,_0x36ad34))[_0x47a5('0x3e')](handleError(_0x378208,null));};exports[_0x47a5('0x3f')]=function(_0x3fa2a8,_0x36a24e){var _0x280500={'raw':!![],'where':{'id':_0x3fa2a8[_0x47a5('0x40')]['id']}},_0x1658e8={};_0x1658e8['model']=_[_0x47a5('0x2b')](db[_0x47a5('0x25')][_0x47a5('0x26')]);_0x1658e8[_0x47a5('0x2a')]=_['keys'](_0x3fa2a8[_0x47a5('0x2a')]);_0x1658e8['filters']=_['intersection'](_0x1658e8['model'],_0x1658e8['query']);_0x280500[_0x47a5('0x2e')]=_['intersection'](_0x1658e8[_0x47a5('0x2d')],qs[_0x47a5('0x2f')](_0x3fa2a8[_0x47a5('0x2a')]['fields']));_0x280500[_0x47a5('0x2e')]=_0x280500[_0x47a5('0x2e')]['length']?_0x280500['attributes']:_0x1658e8[_0x47a5('0x2d')];if(_0x3fa2a8['query'][_0x47a5('0x3b')]){_0x280500[_0x47a5('0x41')]=[{'all':!![]}];}_0x280500=_[_0x47a5('0x38')]({},_0x280500,_0x3fa2a8[_0x47a5('0x42')]);return db[_0x47a5('0x25')][_0x47a5('0x43')](_0x280500)[_0x47a5('0x1e')](handleEntityNotFound(_0x36a24e,null))[_0x47a5('0x1e')](respondWithResult(_0x36a24e,null))[_0x47a5('0x3e')](handleError(_0x36a24e,null));};exports[_0x47a5('0x44')]=function(_0x24ecb1,_0x3c3ebf){return db[_0x47a5('0x25')][_0x47a5('0x44')](_0x24ecb1[_0x47a5('0x45')],{})[_0x47a5('0x1e')](respondWithResult(_0x3c3ebf,0xc9))['catch'](handleError(_0x3c3ebf,null));};exports[_0x47a5('0x46')]=function(_0x23bb04,_0x49eab1){if(_0x23bb04['body']['id']){delete _0x23bb04[_0x47a5('0x45')]['id'];}return db['MailTransferReport'][_0x47a5('0x43')]({'where':{'id':_0x23bb04[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x49eab1,null))['then'](saveUpdates(_0x23bb04[_0x47a5('0x45')],null))['then'](respondWithResult(_0x49eab1,null))[_0x47a5('0x3e')](handleError(_0x49eab1,null));};exports[_0x47a5('0x1f')]=function(_0x3548bc,_0x3e12a7){return db[_0x47a5('0x25')][_0x47a5('0x43')]({'where':{'id':_0x3548bc[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e12a7,null))['then'](removeEntity(_0x3e12a7,null))[_0x47a5('0x3e')](handleError(_0x3e12a7,null));};exports[_0x47a5('0x47')]=function(_0x1163e3,_0x9ea93e){return db[_0x47a5('0x25')][_0x47a5('0x47')]()[_0x47a5('0x1e')](respondWithResult(_0x9ea93e,null))['catch'](handleError(_0x9ea93e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 5523ef9..481aded 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 _0x78e2=['bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','../../config/logger','api','moment'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x78e2,0x8c));var _0x278e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78e2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x278e('0x0'))(_0x278e('0x1'));var moment=require(_0x278e('0x2'));var BPromise=require(_0x278e('0x3'));var rp=require(_0x278e('0x4'));var fs=require('fs');var path=require(_0x278e('0x5'));var rimraf=require(_0x278e('0x6'));var config=require(_0x278e('0x7'));var attributes=require(_0x278e('0x8'));module[_0x278e('0x9')]=function(_0x40f058,_0x33a3ce){return _0x40f058['define'](_0x278e('0xa'),attributes,{'tableName':_0x278e('0xb'),'paranoid':![],'indexes':[{'name':_0x278e('0xc'),'fields':[_0x278e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7164=['util','../../config/logger','api','moment','bluebird','request-promise','path','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash'];(function(_0x2d2685,_0x5b7112){var _0x113020=function(_0x53e18b){while(--_0x53e18b){_0x2d2685['push'](_0x2d2685['shift']());}};_0x113020(++_0x5b7112);}(_0x7164,0xb5));var _0x4716=function(_0x42c341,_0x31d467){_0x42c341=_0x42c341-0x0;var _0x43621b=_0x7164[_0x42c341];return _0x43621b;};'use strict';var _=require(_0x4716('0x0'));var util=require(_0x4716('0x1'));var logger=require(_0x4716('0x2'))(_0x4716('0x3'));var moment=require(_0x4716('0x4'));var BPromise=require(_0x4716('0x5'));var rp=require(_0x4716('0x6'));var fs=require('fs');var path=require(_0x4716('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4716('0x8'));module[_0x4716('0x9')]=function(_0x56cb16,_0x2f7bf0){return _0x56cb16[_0x4716('0xa')](_0x4716('0xb'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x4716('0xc'),'fields':[_0x4716('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index ed72163..50b1cb8 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 _0x2e18=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3d2b8d,_0xc6912e){var _0x466678=function(_0x3ec57c){while(--_0x3ec57c){_0x3d2b8d['push'](_0x3d2b8d['shift']());}};_0x466678(++_0xc6912e);}(_0x2e18,0x1c6));var _0x82e1=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x2e18[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0x82e1('0x0'));var util=require(_0x82e1('0x1'));var moment=require(_0x82e1('0x2'));var BPromise=require('bluebird');var rs=require(_0x82e1('0x3'));var fs=require('fs');var Redis=require(_0x82e1('0x4'));var db=require(_0x82e1('0x5'))['db'];var utils=require(_0x82e1('0x6'));var logger=require(_0x82e1('0x7'))(_0x82e1('0x8'));var config=require(_0x82e1('0x9'));var jayson=require(_0x82e1('0xa'));var client=jayson[_0x82e1('0xb')][_0x82e1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x251c14,_0x4f8d59,_0x196382){return new BPromise(function(_0x4a5a1a,_0x5f5770){return client[_0x82e1('0xd')](_0x251c14,_0x196382)[_0x82e1('0xe')](function(_0xe8da38){logger[_0x82e1('0xf')](_0x82e1('0x10'),_0x4f8d59,_0x82e1('0x11'));logger['debug'](_0x82e1('0x12'),_0x4f8d59,'request\x20sent',JSON[_0x82e1('0x13')](_0xe8da38));if(_0xe8da38[_0x82e1('0x14')]){if(_0xe8da38[_0x82e1('0x14')][_0x82e1('0x15')]===0x1f4){logger[_0x82e1('0x14')](_0x82e1('0x10'),_0x4f8d59,_0xe8da38[_0x82e1('0x14')]['message']);return _0x5f5770(_0xe8da38[_0x82e1('0x14')][_0x82e1('0x16')]);}logger['error'](_0x82e1('0x10'),_0x4f8d59,_0xe8da38[_0x82e1('0x14')]['message']);return _0x4a5a1a(_0xe8da38['error'][_0x82e1('0x16')]);}else{logger['info'](_0x82e1('0x10'),_0x4f8d59,_0x82e1('0x11'));_0x4a5a1a(_0xe8da38['result'][_0x82e1('0x16')]);}})['catch'](function(_0x56b853){logger[_0x82e1('0x14')](_0x82e1('0x10'),_0x4f8d59,_0x56b853);_0x5f5770(_0x56b853);});});} \ No newline at end of file +var _0x3dcf=['stringify','error','message','MailTransferReport,\x20%s,\x20%s','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x50f42c,_0x184ebc){var _0x1eb7ff=function(_0xd560da){while(--_0xd560da){_0x50f42c['push'](_0x50f42c['shift']());}};_0x1eb7ff(++_0x184ebc);}(_0x3dcf,0x1ce));var _0xf3dc=function(_0x57fc17,_0x41df14){_0x57fc17=_0x57fc17-0x0;var _0x18dc70=_0x3dcf[_0x57fc17];return _0x18dc70;};'use strict';var _=require(_0xf3dc('0x0'));var util=require(_0xf3dc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3dc('0x2'))['db'];var utils=require(_0xf3dc('0x3'));var logger=require(_0xf3dc('0x4'))(_0xf3dc('0x5'));var config=require(_0xf3dc('0x6'));var jayson=require(_0xf3dc('0x7'));var client=jayson[_0xf3dc('0x8')][_0xf3dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1033e8,_0x361e22,_0x5786c1){return new BPromise(function(_0x38b43e,_0x1220f6){return client['request'](_0x1033e8,_0x5786c1)[_0xf3dc('0xa')](function(_0x3bd32b){logger[_0xf3dc('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x361e22,_0xf3dc('0xc'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x361e22,_0xf3dc('0xc'),JSON[_0xf3dc('0xd')](_0x3bd32b));if(_0x3bd32b[_0xf3dc('0xe')]){if(_0x3bd32b[_0xf3dc('0xe')]['code']===0x1f4){logger[_0xf3dc('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x361e22,_0x3bd32b[_0xf3dc('0xe')][_0xf3dc('0xf')]);return _0x1220f6(_0x3bd32b[_0xf3dc('0xe')][_0xf3dc('0xf')]);}logger[_0xf3dc('0xe')](_0xf3dc('0x10'),_0x361e22,_0x3bd32b[_0xf3dc('0xe')]['message']);return _0x38b43e(_0x3bd32b[_0xf3dc('0xe')][_0xf3dc('0xf')]);}else{logger[_0xf3dc('0xb')](_0xf3dc('0x10'),_0x361e22,_0xf3dc('0xc'));_0x38b43e(_0x3bd32b[_0xf3dc('0x11')][_0xf3dc('0xf')]);}})[_0xf3dc('0x12')](function(_0x166a15){logger[_0xf3dc('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x361e22,_0x166a15);_0x1220f6(_0x166a15);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 66af711..f1f6a23 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 _0x27c9=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x27c9,0x1e7));var _0x927c=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x27c9[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x927c('0x0'));var util=require(_0x927c('0x1'));var path=require(_0x927c('0x2'));var timeout=require('connect-timeout');var express=require(_0x927c('0x3'));var router=express[_0x927c('0x4')]();var auth=require(_0x927c('0x5'));var interaction=require(_0x927c('0x6'));var config=require(_0x927c('0x7'));var controller=require(_0x927c('0x8'));router[_0x927c('0x9')]('/',auth[_0x927c('0xa')](),controller[_0x927c('0xb')]);router['get'](_0x927c('0xc'),auth[_0x927c('0xa')](),controller[_0x927c('0xd')]);router[_0x927c('0x9')](_0x927c('0xe'),auth[_0x927c('0xa')](),controller[_0x927c('0xf')]);router['post']('/',auth[_0x927c('0xa')](),controller[_0x927c('0x10')]);router[_0x927c('0x11')](_0x927c('0xe'),auth[_0x927c('0xa')](),controller[_0x927c('0x12')]);router[_0x927c('0x13')](_0x927c('0xe'),auth[_0x927c('0xa')](),controller[_0x927c('0x14')]);module[_0x927c('0x15')]=router; \ No newline at end of file +var _0x6e30=['update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put'];(function(_0x496769,_0x8b8afd){var _0x5d12c3=function(_0x562337){while(--_0x562337){_0x496769['push'](_0x496769['shift']());}};_0x5d12c3(++_0x8b8afd);}(_0x6e30,0x90));var _0x06e3=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0x6e30[_0x496738];return _0xee1381;};'use strict';var multer=require(_0x06e3('0x0'));var util=require(_0x06e3('0x1'));var path=require(_0x06e3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x06e3('0x3')]();var auth=require(_0x06e3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x06e3('0x5'));var controller=require(_0x06e3('0x6'));router[_0x06e3('0x7')]('/',auth[_0x06e3('0x8')](),controller[_0x06e3('0x9')]);router['get'](_0x06e3('0xa'),auth['isAuthenticated'](),controller[_0x06e3('0xb')]);router['get'](_0x06e3('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x06e3('0xd')]('/',auth['isAuthenticated'](),controller[_0x06e3('0xe')]);router[_0x06e3('0xf')]('/:id',auth[_0x06e3('0x8')](),controller[_0x06e3('0x10')]);router[_0x06e3('0x11')](_0x06e3('0xc'),auth[_0x06e3('0x8')](),controller[_0x06e3('0x12')]);module[_0x06e3('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index b093750..8ac9caa 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 _0x405c=['talk:[queue]','sequelize','moment','exports','STRING','DATE','getDataValue','enterAt','diff','setDataValue','duration','talk:[destination]','talk:[dial\x20string]'];(function(_0x307c41,_0x22d7d1){var _0xea2d0=function(_0x97cb9a){while(--_0x97cb9a){_0x307c41['push'](_0x307c41['shift']());}};_0xea2d0(++_0x22d7d1);}(_0x405c,0x187));var _0xc405=function(_0x281165,_0x47220d){_0x281165=_0x281165-0x0;var _0x4c70df=_0x405c[_0x281165];return _0x4c70df;};'use strict';var Sequelize=require(_0xc405('0x0'));var moment=require(_0xc405('0x1'));module[_0xc405('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc405('0x3')]},'interface':{'type':Sequelize[_0xc405('0x3')]},'type':{'type':Sequelize[_0xc405('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0xc405('0x4')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x447f9a){var _0x3b0e80=moment(_0x447f9a);var _0x5185b7=moment(this[_0xc405('0x5')](_0xc405('0x6')));var _0x39810f=_0x3b0e80[_0xc405('0x7')](_0x5185b7,'seconds');this[_0xc405('0x8')]('exitAt',_0x447f9a);this[_0xc405('0x8')](_0xc405('0x9'),_0x39810f||null);}},'data1':{'type':Sequelize[_0xc405('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xc405('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0xc405('0xa')},'data4':{'type':Sequelize[_0xc405('0x3')],'comment':_0xc405('0xb')},'data5':{'type':Sequelize['STRING'],'comment':_0xc405('0xc')},'role':{'type':Sequelize[_0xc405('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xc405('0x3')]}}; \ No newline at end of file +var _0x709a=['seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','enterAt'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x709a,0x75));var _0xa709=function(_0x46c163,_0x5c5488){_0x46c163=_0x46c163-0x0;var _0x30e117=_0x709a[_0x46c163];return _0x30e117;};'use strict';var Sequelize=require(_0xa709('0x0'));var moment=require(_0xa709('0x1'));module[_0xa709('0x2')]={'channel':{'type':Sequelize[_0xa709('0x3')]},'membername':{'type':Sequelize[_0xa709('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa709('0x3')],'defaultValue':_0xa709('0x4'),'comment':_0xa709('0x5')},'duration':{'type':Sequelize[_0xa709('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x106ef8){var _0x438d67=moment(_0x106ef8);var _0x306e06=moment(this[_0xa709('0x7')](_0xa709('0x8')));var _0x4343d1=_0x438d67['diff'](_0x306e06,_0xa709('0x9'));this['setDataValue'](_0xa709('0xa'),_0x106ef8);this[_0xa709('0xb')](_0xa709('0xc'),_0x4343d1||null);}},'data1':{'type':Sequelize[_0xa709('0x3')],'comment':_0xa709('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0xa709('0xe')},'data3':{'type':Sequelize[_0xa709('0x3')],'comment':_0xa709('0xf')},'data4':{'type':Sequelize[_0xa709('0x3')],'comment':_0xa709('0x10')},'data5':{'type':Sequelize[_0xa709('0x3')],'comment':_0xa709('0x11')},'role':{'type':Sequelize[_0xa709('0x3')]},'internal':{'type':Sequelize[_0xa709('0x6')]},'uniqueid':{'type':Sequelize[_0xa709('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 709aad2..426def9 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 _0x5b9c=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','eml-format','rimraf','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','json','apply','reject','save','update','then','destroy','error','name','index','map','MemberReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x188832,_0x49101d){var _0x2b990f=function(_0x231635){while(--_0x231635){_0x188832['push'](_0x188832['shift']());}};_0x2b990f(++_0x49101d);}(_0x5b9c,0xa3));var _0xc5b9=function(_0x34ecb3,_0x458c4e){_0x34ecb3=_0x34ecb3-0x0;var _0x571db7=_0x5b9c[_0x34ecb3];return _0x571db7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc5b9('0x0'));var rimraf=require(_0xc5b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc5b9('0x2'));var moment=require(_0xc5b9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc5b9('0x4'));var path=require('path');var sox=require(_0xc5b9('0x5'));var csv=require(_0xc5b9('0x6'));var ejs=require(_0xc5b9('0x7'));var fs=require('fs');var _=require(_0xc5b9('0x8'));var squel=require(_0xc5b9('0x9'));var crypto=require(_0xc5b9('0xa'));var jsforce=require(_0xc5b9('0xb'));var deskjs=require(_0xc5b9('0xc'));var toCsv=require(_0xc5b9('0x6'));var querystring=require('querystring');var Papa=require(_0xc5b9('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc5b9('0xe'));var as=require(_0xc5b9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc5b9('0x10'))(_0xc5b9('0x11'));var utils=require(_0xc5b9('0x12'));var config=require(_0xc5b9('0x13'));var db=require(_0xc5b9('0x14'))['db'];function respondWithStatusCode(_0x33a852,_0x253f1d){_0x253f1d=_0x253f1d||0xcc;return function(_0xbb379a){if(_0xbb379a){return _0x33a852[_0xc5b9('0x15')](_0x253f1d);}return _0x33a852[_0xc5b9('0x16')](_0x253f1d)[_0xc5b9('0x17')]();};}function respondWithResult(_0x4fe83b,_0x18be77){_0x18be77=_0x18be77||0xc8;return function(_0x168f7b){if(_0x168f7b){return _0x4fe83b[_0xc5b9('0x16')](_0x18be77)['json'](_0x168f7b);}};}function respondWithFilteredResult(_0x367d98,_0x29cfbf){return function(_0xa14994){if(_0xa14994){var _0x4b2415=_0xa14994[_0xc5b9('0x18')],_0x47ccb7=_0x29cfbf[_0xc5b9('0x19')],_0x1788e2=_0x29cfbf[_0xc5b9('0x19')]+_0x29cfbf[_0xc5b9('0x1a')],_0x59f088;if(_0x1788e2>=_0x4b2415){_0x1788e2=_0x4b2415;_0x59f088=0xc8;}else{_0x59f088=0xce;}_0x367d98[_0xc5b9('0x16')](_0x59f088);return _0x367d98['set']('Content-Range',_0x47ccb7+'-'+_0x1788e2+'/'+_0x4b2415)[_0xc5b9('0x1b')](_0xa14994);}return null;};}function patchUpdates(_0x5ca4f8){return function(_0x4ef974){try{jsonpatch[_0xc5b9('0x1c')](_0x4ef974,_0x5ca4f8,!![]);}catch(_0x916512){return BPromise[_0xc5b9('0x1d')](_0x916512);}return _0x4ef974[_0xc5b9('0x1e')]();};}function saveUpdates(_0x12daa4,_0x3b192d){return function(_0x8bb669){if(_0x8bb669){return _0x8bb669[_0xc5b9('0x1f')](_0x12daa4)[_0xc5b9('0x20')](function(_0x4975b2){return _0x4975b2;});}return null;};}function removeEntity(_0x520c0b,_0x38b6ee){return function(_0x158877){if(_0x158877){return _0x158877[_0xc5b9('0x21')]()[_0xc5b9('0x20')](function(){_0x520c0b[_0xc5b9('0x16')](0xcc)[_0xc5b9('0x17')]();});}};}function handleEntityNotFound(_0x45274b,_0x481a84){return function(_0x2189d2){if(!_0x2189d2){_0x45274b[_0xc5b9('0x15')](0x194);}return _0x2189d2;};}function handleError(_0x2358b4,_0x3f24f3){_0x3f24f3=_0x3f24f3||0x1f4;return function(_0x30e2a3){logger[_0xc5b9('0x22')](_0x30e2a3['stack']);if(_0x30e2a3[_0xc5b9('0x23')]){delete _0x30e2a3[_0xc5b9('0x23')];}_0x2358b4['status'](_0x3f24f3)['send'](_0x30e2a3);};}exports[_0xc5b9('0x24')]=function(_0x185ab0,_0x264187){var _0x484d1e={},_0x32252f={},_0x19569e={'count':0x0,'rows':[]};var _0x58a1c9=_[_0xc5b9('0x25')](db[_0xc5b9('0x26')][_0xc5b9('0x27')],function(_0x3e634b){return{'name':_0x3e634b[_0xc5b9('0x28')],'type':_0x3e634b[_0xc5b9('0x29')]['key']};});_0x32252f[_0xc5b9('0x2a')]=_[_0xc5b9('0x25')](_0x58a1c9,_0xc5b9('0x23'));_0x32252f[_0xc5b9('0x2b')]=_[_0xc5b9('0x2c')](_0x185ab0[_0xc5b9('0x2b')]);_0x32252f[_0xc5b9('0x2d')]=_[_0xc5b9('0x2e')](_0x32252f[_0xc5b9('0x2a')],_0x32252f[_0xc5b9('0x2b')]);_0x484d1e[_0xc5b9('0x2f')]=_[_0xc5b9('0x2e')](_0x32252f[_0xc5b9('0x2a')],qs[_0xc5b9('0x30')](_0x185ab0[_0xc5b9('0x2b')][_0xc5b9('0x30')]));_0x484d1e[_0xc5b9('0x2f')]=_0x484d1e['attributes']['length']?_0x484d1e[_0xc5b9('0x2f')]:_0x32252f[_0xc5b9('0x2a')];if(!_0x185ab0[_0xc5b9('0x2b')][_0xc5b9('0x31')](_0xc5b9('0x32'))){_0x484d1e[_0xc5b9('0x1a')]=qs[_0xc5b9('0x1a')](_0x185ab0[_0xc5b9('0x2b')]['limit']);_0x484d1e[_0xc5b9('0x19')]=qs[_0xc5b9('0x19')](_0x185ab0[_0xc5b9('0x2b')][_0xc5b9('0x19')]);}_0x484d1e[_0xc5b9('0x33')]=qs[_0xc5b9('0x34')](_0x185ab0['query'][_0xc5b9('0x34')]);_0x484d1e['where']=qs[_0xc5b9('0x2d')](_[_0xc5b9('0x35')](_0x185ab0[_0xc5b9('0x2b')],_0x32252f[_0xc5b9('0x2d')]));if(_0x185ab0[_0xc5b9('0x2b')][_0xc5b9('0x36')]){_0x484d1e[_0xc5b9('0x37')]=_[_0xc5b9('0x38')](_0x484d1e[_0xc5b9('0x37')],{'$or':_[_0xc5b9('0x25')](_0x58a1c9,function(_0x131333){if(_0x131333['type']!==_0xc5b9('0x39')){var _0x4c62a4={};_0x4c62a4[_0x131333[_0xc5b9('0x23')]]={'$like':'%'+_0x185ab0['query'][_0xc5b9('0x36')]+'%'};return _0x4c62a4;}})});}_0x484d1e=_[_0xc5b9('0x38')]({},_0x484d1e,_0x185ab0[_0xc5b9('0x3a')]);var _0x2b5adb={'where':_0x484d1e[_0xc5b9('0x37')]};return db[_0xc5b9('0x26')]['count'](_0x2b5adb)['then'](function(_0x41faa){_0x19569e[_0xc5b9('0x18')]=_0x41faa;if(_0x185ab0[_0xc5b9('0x2b')][_0xc5b9('0x3b')]){_0x484d1e[_0xc5b9('0x3c')]=[{'all':!![]}];}return db[_0xc5b9('0x26')][_0xc5b9('0x3d')](_0x484d1e);})[_0xc5b9('0x20')](function(_0x42f342){_0x19569e[_0xc5b9('0x3e')]=_0x42f342;return _0x19569e;})[_0xc5b9('0x20')](respondWithFilteredResult(_0x264187,_0x484d1e))[_0xc5b9('0x3f')](handleError(_0x264187,null));};exports[_0xc5b9('0x40')]=function(_0x1e2082,_0x238bec){var _0x36bcc3={'raw':!![],'where':{'id':_0x1e2082['params']['id']}},_0x4715bf={};_0x4715bf[_0xc5b9('0x2a')]=_[_0xc5b9('0x2c')](db['MemberReport'][_0xc5b9('0x27')]);_0x4715bf[_0xc5b9('0x2b')]=_[_0xc5b9('0x2c')](_0x1e2082[_0xc5b9('0x2b')]);_0x4715bf[_0xc5b9('0x2d')]=_[_0xc5b9('0x2e')](_0x4715bf['model'],_0x4715bf[_0xc5b9('0x2b')]);_0x36bcc3['attributes']=_[_0xc5b9('0x2e')](_0x4715bf[_0xc5b9('0x2a')],qs[_0xc5b9('0x30')](_0x1e2082['query']['fields']));_0x36bcc3[_0xc5b9('0x2f')]=_0x36bcc3[_0xc5b9('0x2f')][_0xc5b9('0x41')]?_0x36bcc3['attributes']:_0x4715bf[_0xc5b9('0x2a')];if(_0x1e2082[_0xc5b9('0x2b')][_0xc5b9('0x3b')]){_0x36bcc3['include']=[{'all':!![]}];}_0x36bcc3=_[_0xc5b9('0x38')]({},_0x36bcc3,_0x1e2082[_0xc5b9('0x3a')]);return db['MemberReport'][_0xc5b9('0x42')](_0x36bcc3)[_0xc5b9('0x20')](handleEntityNotFound(_0x238bec,null))[_0xc5b9('0x20')](respondWithResult(_0x238bec,null))['catch'](handleError(_0x238bec,null));};exports[_0xc5b9('0x43')]=function(_0x5074a9,_0x141f4e){return db[_0xc5b9('0x26')]['create'](_0x5074a9[_0xc5b9('0x44')],{})[_0xc5b9('0x20')](respondWithResult(_0x141f4e,0xc9))[_0xc5b9('0x3f')](handleError(_0x141f4e,null));};exports[_0xc5b9('0x1f')]=function(_0x32c9ce,_0x469d80){if(_0x32c9ce[_0xc5b9('0x44')]['id']){delete _0x32c9ce['body']['id'];}return db['MemberReport'][_0xc5b9('0x42')]({'where':{'id':_0x32c9ce[_0xc5b9('0x45')]['id']}})[_0xc5b9('0x20')](handleEntityNotFound(_0x469d80,null))[_0xc5b9('0x20')](saveUpdates(_0x32c9ce[_0xc5b9('0x44')],null))[_0xc5b9('0x20')](respondWithResult(_0x469d80,null))[_0xc5b9('0x3f')](handleError(_0x469d80,null));};exports[_0xc5b9('0x21')]=function(_0x386c98,_0x349f39){return db[_0xc5b9('0x26')][_0xc5b9('0x42')]({'where':{'id':_0x386c98[_0xc5b9('0x45')]['id']}})[_0xc5b9('0x20')](handleEntityNotFound(_0x349f39,null))[_0xc5b9('0x20')](removeEntity(_0x349f39,null))[_0xc5b9('0x3f')](handleError(_0x349f39,null));};exports[_0xc5b9('0x46')]=function(_0x1e4991,_0xebe934){return db[_0xc5b9('0x26')][_0xc5b9('0x46')]()[_0xc5b9('0x20')](respondWithResult(_0xebe934,null))[_0xc5b9('0x3f')](handleError(_0xebe934,null));}; \ No newline at end of file +var _0xb1d7=['filters','intersection','query','attributes','length','nolimit','limit','sort','where','pick','merge','VIRTUAL','options','MemberReport','includeAll','include','findAll','rows','catch','params','fields','find','create','body','describe','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys'];(function(_0x1d78bc,_0x4a6cca){var _0x5eb763=function(_0x48475d){while(--_0x48475d){_0x1d78bc['push'](_0x1d78bc['shift']());}};_0x5eb763(++_0x4a6cca);}(_0xb1d7,0x66));var _0x7b1d=function(_0x4a0411,_0x5a91d4){_0x4a0411=_0x4a0411-0x0;var _0x248d1f=_0xb1d7[_0x4a0411];return _0x248d1f;};'use strict';var pdf=require(_0x7b1d('0x0'));var emlformat=require(_0x7b1d('0x1'));var rimraf=require(_0x7b1d('0x2'));var zipdir=require(_0x7b1d('0x3'));var jsonpatch=require(_0x7b1d('0x4'));var rp=require('request-promise');var moment=require(_0x7b1d('0x5'));var BPromise=require(_0x7b1d('0x6'));var Mustache=require(_0x7b1d('0x7'));var util=require(_0x7b1d('0x8'));var path=require(_0x7b1d('0x9'));var sox=require(_0x7b1d('0xa'));var csv=require(_0x7b1d('0xb'));var ejs=require(_0x7b1d('0xc'));var fs=require('fs');var _=require(_0x7b1d('0xd'));var squel=require(_0x7b1d('0xe'));var crypto=require(_0x7b1d('0xf'));var jsforce=require(_0x7b1d('0x10'));var deskjs=require(_0x7b1d('0x11'));var toCsv=require(_0x7b1d('0xb'));var querystring=require(_0x7b1d('0x12'));var Papa=require(_0x7b1d('0x13'));var Redis=require(_0x7b1d('0x14'));var authService=require(_0x7b1d('0x15'));var qs=require(_0x7b1d('0x16'));var as=require(_0x7b1d('0x17'));var hardwareService=require(_0x7b1d('0x18'));var logger=require(_0x7b1d('0x19'))(_0x7b1d('0x1a'));var utils=require(_0x7b1d('0x1b'));var config=require(_0x7b1d('0x1c'));var db=require(_0x7b1d('0x1d'))['db'];function respondWithStatusCode(_0x8d7013,_0x13a3ca){_0x13a3ca=_0x13a3ca||0xcc;return function(_0x37e3c5){if(_0x37e3c5){return _0x8d7013[_0x7b1d('0x1e')](_0x13a3ca);}return _0x8d7013[_0x7b1d('0x1f')](_0x13a3ca)[_0x7b1d('0x20')]();};}function respondWithResult(_0xc0cf53,_0xe74482){_0xe74482=_0xe74482||0xc8;return function(_0x1f3734){if(_0x1f3734){return _0xc0cf53[_0x7b1d('0x1f')](_0xe74482)[_0x7b1d('0x21')](_0x1f3734);}};}function respondWithFilteredResult(_0x1b19df,_0x222fb5){return function(_0x5cb695){if(_0x5cb695){var _0x27930e=_0x5cb695[_0x7b1d('0x22')],_0x339336=_0x222fb5[_0x7b1d('0x23')],_0x12d491=_0x222fb5['offset']+_0x222fb5['limit'],_0x524d72;if(_0x12d491>=_0x27930e){_0x12d491=_0x27930e;_0x524d72=0xc8;}else{_0x524d72=0xce;}_0x1b19df['status'](_0x524d72);return _0x1b19df[_0x7b1d('0x24')]('Content-Range',_0x339336+'-'+_0x12d491+'/'+_0x27930e)['json'](_0x5cb695);}return null;};}function patchUpdates(_0x31224b){return function(_0x5bfe7d){try{jsonpatch[_0x7b1d('0x25')](_0x5bfe7d,_0x31224b,!![]);}catch(_0x281d58){return BPromise[_0x7b1d('0x26')](_0x281d58);}return _0x5bfe7d['save']();};}function saveUpdates(_0xc99f20,_0x552e08){return function(_0x4a16cd){if(_0x4a16cd){return _0x4a16cd[_0x7b1d('0x27')](_0xc99f20)[_0x7b1d('0x28')](function(_0xc0adc){return _0xc0adc;});}return null;};}function removeEntity(_0x2b99bd,_0x55cfb0){return function(_0x53ee75){if(_0x53ee75){return _0x53ee75[_0x7b1d('0x29')]()[_0x7b1d('0x28')](function(){_0x2b99bd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4501c3,_0x1c5be5){return function(_0xc84c6){if(!_0xc84c6){_0x4501c3[_0x7b1d('0x1e')](0x194);}return _0xc84c6;};}function handleError(_0xe5aec4,_0x28d2dc){_0x28d2dc=_0x28d2dc||0x1f4;return function(_0xd3fefe){logger['error'](_0xd3fefe[_0x7b1d('0x2a')]);if(_0xd3fefe[_0x7b1d('0x2b')]){delete _0xd3fefe[_0x7b1d('0x2b')];}_0xe5aec4[_0x7b1d('0x1f')](_0x28d2dc)[_0x7b1d('0x2c')](_0xd3fefe);};}exports['index']=function(_0x5b224e,_0x49cf09){var _0x369eea={},_0x3b3800={},_0x31deec={'count':0x0,'rows':[]};var _0x13f485=_[_0x7b1d('0x2d')](db['MemberReport'][_0x7b1d('0x2e')],function(_0x202193){return{'name':_0x202193[_0x7b1d('0x2f')],'type':_0x202193[_0x7b1d('0x30')][_0x7b1d('0x31')]};});_0x3b3800[_0x7b1d('0x32')]=_[_0x7b1d('0x2d')](_0x13f485,_0x7b1d('0x2b'));_0x3b3800['query']=_[_0x7b1d('0x33')](_0x5b224e['query']);_0x3b3800[_0x7b1d('0x34')]=_[_0x7b1d('0x35')](_0x3b3800[_0x7b1d('0x32')],_0x3b3800[_0x7b1d('0x36')]);_0x369eea[_0x7b1d('0x37')]=_[_0x7b1d('0x35')](_0x3b3800[_0x7b1d('0x32')],qs['fields'](_0x5b224e[_0x7b1d('0x36')]['fields']));_0x369eea[_0x7b1d('0x37')]=_0x369eea[_0x7b1d('0x37')][_0x7b1d('0x38')]?_0x369eea[_0x7b1d('0x37')]:_0x3b3800[_0x7b1d('0x32')];if(!_0x5b224e[_0x7b1d('0x36')]['hasOwnProperty'](_0x7b1d('0x39'))){_0x369eea[_0x7b1d('0x3a')]=qs[_0x7b1d('0x3a')](_0x5b224e[_0x7b1d('0x36')][_0x7b1d('0x3a')]);_0x369eea[_0x7b1d('0x23')]=qs[_0x7b1d('0x23')](_0x5b224e[_0x7b1d('0x36')][_0x7b1d('0x23')]);}_0x369eea['order']=qs[_0x7b1d('0x3b')](_0x5b224e['query'][_0x7b1d('0x3b')]);_0x369eea[_0x7b1d('0x3c')]=qs[_0x7b1d('0x34')](_[_0x7b1d('0x3d')](_0x5b224e[_0x7b1d('0x36')],_0x3b3800[_0x7b1d('0x34')]));if(_0x5b224e[_0x7b1d('0x36')]['filter']){_0x369eea[_0x7b1d('0x3c')]=_[_0x7b1d('0x3e')](_0x369eea['where'],{'$or':_[_0x7b1d('0x2d')](_0x13f485,function(_0x44a474){if(_0x44a474['type']!==_0x7b1d('0x3f')){var _0x4d6ec8={};_0x4d6ec8[_0x44a474[_0x7b1d('0x2b')]]={'$like':'%'+_0x5b224e['query']['filter']+'%'};return _0x4d6ec8;}})});}_0x369eea=_[_0x7b1d('0x3e')]({},_0x369eea,_0x5b224e[_0x7b1d('0x40')]);var _0x11a19f={'where':_0x369eea['where']};return db[_0x7b1d('0x41')][_0x7b1d('0x22')](_0x11a19f)[_0x7b1d('0x28')](function(_0x5d805c){_0x31deec[_0x7b1d('0x22')]=_0x5d805c;if(_0x5b224e['query'][_0x7b1d('0x42')]){_0x369eea[_0x7b1d('0x43')]=[{'all':!![]}];}return db['MemberReport'][_0x7b1d('0x44')](_0x369eea);})['then'](function(_0x16567c){_0x31deec[_0x7b1d('0x45')]=_0x16567c;return _0x31deec;})[_0x7b1d('0x28')](respondWithFilteredResult(_0x49cf09,_0x369eea))[_0x7b1d('0x46')](handleError(_0x49cf09,null));};exports['show']=function(_0x5917f0,_0xe2ce07){var _0x38a66d={'raw':!![],'where':{'id':_0x5917f0[_0x7b1d('0x47')]['id']}},_0x361af1={};_0x361af1[_0x7b1d('0x32')]=_[_0x7b1d('0x33')](db[_0x7b1d('0x41')][_0x7b1d('0x2e')]);_0x361af1['query']=_[_0x7b1d('0x33')](_0x5917f0['query']);_0x361af1[_0x7b1d('0x34')]=_[_0x7b1d('0x35')](_0x361af1[_0x7b1d('0x32')],_0x361af1[_0x7b1d('0x36')]);_0x38a66d['attributes']=_[_0x7b1d('0x35')](_0x361af1[_0x7b1d('0x32')],qs[_0x7b1d('0x48')](_0x5917f0[_0x7b1d('0x36')][_0x7b1d('0x48')]));_0x38a66d[_0x7b1d('0x37')]=_0x38a66d[_0x7b1d('0x37')][_0x7b1d('0x38')]?_0x38a66d[_0x7b1d('0x37')]:_0x361af1['model'];if(_0x5917f0[_0x7b1d('0x36')][_0x7b1d('0x42')]){_0x38a66d[_0x7b1d('0x43')]=[{'all':!![]}];}_0x38a66d=_[_0x7b1d('0x3e')]({},_0x38a66d,_0x5917f0[_0x7b1d('0x40')]);return db[_0x7b1d('0x41')][_0x7b1d('0x49')](_0x38a66d)[_0x7b1d('0x28')](handleEntityNotFound(_0xe2ce07,null))[_0x7b1d('0x28')](respondWithResult(_0xe2ce07,null))[_0x7b1d('0x46')](handleError(_0xe2ce07,null));};exports['create']=function(_0x152d0f,_0x4c545f){return db[_0x7b1d('0x41')][_0x7b1d('0x4a')](_0x152d0f['body'],{})[_0x7b1d('0x28')](respondWithResult(_0x4c545f,0xc9))[_0x7b1d('0x46')](handleError(_0x4c545f,null));};exports[_0x7b1d('0x27')]=function(_0x353c11,_0x3e0d79){if(_0x353c11[_0x7b1d('0x4b')]['id']){delete _0x353c11[_0x7b1d('0x4b')]['id'];}return db[_0x7b1d('0x41')][_0x7b1d('0x49')]({'where':{'id':_0x353c11['params']['id']}})[_0x7b1d('0x28')](handleEntityNotFound(_0x3e0d79,null))[_0x7b1d('0x28')](saveUpdates(_0x353c11[_0x7b1d('0x4b')],null))[_0x7b1d('0x28')](respondWithResult(_0x3e0d79,null))[_0x7b1d('0x46')](handleError(_0x3e0d79,null));};exports[_0x7b1d('0x29')]=function(_0x56ec71,_0x400522){return db[_0x7b1d('0x41')]['find']({'where':{'id':_0x56ec71[_0x7b1d('0x47')]['id']}})['then'](handleEntityNotFound(_0x400522,null))[_0x7b1d('0x28')](removeEntity(_0x400522,null))[_0x7b1d('0x46')](handleError(_0x400522,null));};exports[_0x7b1d('0x4c')]=function(_0x4f1370,_0x2774eb){return db[_0x7b1d('0x41')][_0x7b1d('0x4c')]()[_0x7b1d('0x28')](respondWithResult(_0x2774eb,null))['catch'](handleError(_0x2774eb,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 22148bb..54b7e3c 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 _0x2bab=['report_member','membername_interface','membername','interface','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','MemberReport'];(function(_0x41edd2,_0x589c5b){var _0x2e5f55=function(_0x4ed187){while(--_0x4ed187){_0x41edd2['push'](_0x41edd2['shift']());}};_0x2e5f55(++_0x589c5b);}(_0x2bab,0x6d));var _0xb2ba=function(_0xe70e4b,_0x37b706){_0xe70e4b=_0xe70e4b-0x0;var _0x47e28f=_0x2bab[_0xe70e4b];return _0x47e28f;};'use strict';var _=require(_0xb2ba('0x0'));var util=require(_0xb2ba('0x1'));var logger=require(_0xb2ba('0x2'))(_0xb2ba('0x3'));var moment=require(_0xb2ba('0x4'));var BPromise=require(_0xb2ba('0x5'));var rp=require(_0xb2ba('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2ba('0x7'));var config=require(_0xb2ba('0x8'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x53171c,_0xe234df){return _0x53171c[_0xb2ba('0x9')](_0xb2ba('0xa'),attributes,{'tableName':_0xb2ba('0xb'),'paranoid':![],'indexes':[{'name':_0xb2ba('0xc'),'fields':[_0xb2ba('0xd'),_0xb2ba('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5aee=['util','api','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','interface','lodash'];(function(_0x2c6fb9,_0x45ed8e){var _0x42bcc4=function(_0x4b3cd6){while(--_0x4b3cd6){_0x2c6fb9['push'](_0x2c6fb9['shift']());}};_0x42bcc4(++_0x45ed8e);}(_0x5aee,0x143));var _0xe5ae=function(_0x2c989b,_0x340ec7){_0x2c989b=_0x2c989b-0x0;var _0x44054f=_0x5aee[_0x2c989b];return _0x44054f;};'use strict';var _=require(_0xe5ae('0x0'));var util=require(_0xe5ae('0x1'));var logger=require('../../config/logger')(_0xe5ae('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe5ae('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe5ae('0x4'));var config=require(_0xe5ae('0x5'));var attributes=require(_0xe5ae('0x6'));module[_0xe5ae('0x7')]=function(_0x1625da,_0x894ff5){return _0x1625da[_0xe5ae('0x8')](_0xe5ae('0x9'),attributes,{'tableName':_0xe5ae('0xa'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0xe5ae('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 9b6b743..c7b88c2 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 _0x7f21=['rpc','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetMemberReport','MemberReport','options','raw','where','limit','include','map','attributes','model','stringify','catch','CreateMemberReport','create','body','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x524768,_0x5aaaf5){var _0x306773=function(_0x55c79c){while(--_0x55c79c){_0x524768['push'](_0x524768['shift']());}};_0x306773(++_0x5aaaf5);}(_0x7f21,0x1d7));var _0x17f2=function(_0x3b2c7d,_0x5704e7){_0x3b2c7d=_0x3b2c7d-0x0;var _0x382143=_0x7f21[_0x3b2c7d];return _0x382143;};'use strict';var _=require(_0x17f2('0x0'));var util=require(_0x17f2('0x1'));var moment=require(_0x17f2('0x2'));var BPromise=require(_0x17f2('0x3'));var rs=require(_0x17f2('0x4'));var fs=require('fs');var Redis=require(_0x17f2('0x5'));var db=require(_0x17f2('0x6'))['db'];var utils=require(_0x17f2('0x7'));var logger=require(_0x17f2('0x8'))(_0x17f2('0x9'));var config=require(_0x17f2('0xa'));var jayson=require(_0x17f2('0xb'));var client=jayson['client'][_0x17f2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x358203,_0x288939,_0x23ec35){return new BPromise(function(_0x2cc54a,_0x2a27ee){return client[_0x17f2('0xd')](_0x358203,_0x23ec35)[_0x17f2('0xe')](function(_0x131a98){logger[_0x17f2('0xf')](_0x17f2('0x10'),_0x288939,_0x17f2('0x11'));logger[_0x17f2('0x12')](_0x17f2('0x13'),_0x288939,_0x17f2('0x11'),JSON['stringify'](_0x131a98));if(_0x131a98[_0x17f2('0x14')]){if(_0x131a98[_0x17f2('0x14')][_0x17f2('0x15')]===0x1f4){logger['error'](_0x17f2('0x10'),_0x288939,_0x131a98[_0x17f2('0x14')][_0x17f2('0x16')]);return _0x2a27ee(_0x131a98[_0x17f2('0x14')][_0x17f2('0x16')]);}logger[_0x17f2('0x14')](_0x17f2('0x10'),_0x288939,_0x131a98['error'][_0x17f2('0x16')]);return _0x2cc54a(_0x131a98[_0x17f2('0x14')]['message']);}else{logger[_0x17f2('0xf')](_0x17f2('0x10'),_0x288939,'request\x20sent');_0x2cc54a(_0x131a98[_0x17f2('0x17')][_0x17f2('0x16')]);}})['catch'](function(_0x199840){logger[_0x17f2('0x14')]('MemberReport,\x20%s,\x20%s',_0x288939,_0x199840);_0x2a27ee(_0x199840);});});}exports[_0x17f2('0x18')]=function(_0x55a717){var _0x50e461=this;return new Promise(function(_0x36155e,_0x2a2a98){return db[_0x17f2('0x19')]['findAll']({'raw':_0x55a717[_0x17f2('0x1a')]?_0x55a717[_0x17f2('0x1a')][_0x17f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x55a717['options']?_0x55a717[_0x17f2('0x1a')][_0x17f2('0x1c')]||null:null,'attributes':_0x55a717[_0x17f2('0x1a')]?_0x55a717[_0x17f2('0x1a')]['attributes']||null:null,'limit':_0x55a717[_0x17f2('0x1a')]?_0x55a717[_0x17f2('0x1a')][_0x17f2('0x1d')]||null:null,'include':_0x55a717[_0x17f2('0x1a')]?_0x55a717[_0x17f2('0x1a')][_0x17f2('0x1e')]?_[_0x17f2('0x1f')](_0x55a717[_0x17f2('0x1a')]['include'],function(_0x50f467){return{'model':db[_0x50f467['model']],'as':_0x50f467['as'],'attributes':_0x50f467[_0x17f2('0x20')],'include':_0x50f467[_0x17f2('0x1e')]?_[_0x17f2('0x1f')](_0x50f467[_0x17f2('0x1e')],function(_0x55da77){return{'model':db[_0x55da77[_0x17f2('0x21')]],'as':_0x55da77['as'],'attributes':_0x55da77[_0x17f2('0x20')],'include':_0x55da77[_0x17f2('0x1e')]?_[_0x17f2('0x1f')](_0x55da77['include'],function(_0x2a7bd2){return{'model':db[_0x2a7bd2['model']],'as':_0x2a7bd2['as'],'attributes':_0x2a7bd2[_0x17f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x17f2('0xe')](function(_0xc54bae){logger[_0x17f2('0xf')](_0x17f2('0x18'),_0x55a717);logger['debug']('GetMemberReport',_0x55a717,JSON[_0x17f2('0x22')](_0xc54bae));_0x36155e(_0xc54bae);})[_0x17f2('0x23')](function(_0x2de99f){logger['error']('GetMemberReport',_0x2de99f['message'],_0x55a717);_0x2a2a98(_0x50e461[_0x17f2('0x14')](0x1f4,_0x2de99f[_0x17f2('0x16')]));});});};exports[_0x17f2('0x24')]=function(_0x340b04){var _0x4eb3b5=this;return new Promise(function(_0x34bc02,_0x2f5f65){return db[_0x17f2('0x19')][_0x17f2('0x25')](_0x340b04[_0x17f2('0x26')],{'raw':_0x340b04[_0x17f2('0x1a')]?_0x340b04[_0x17f2('0x1a')][_0x17f2('0x1b')]===undefined?!![]:![]:!![]})[_0x17f2('0xe')](function(_0x1e6ed4){logger['info'](_0x17f2('0x24'),_0x340b04);logger[_0x17f2('0x12')](_0x17f2('0x24'),_0x340b04,JSON[_0x17f2('0x22')](_0x1e6ed4));_0x34bc02(_0x1e6ed4);})[_0x17f2('0x23')](function(_0x1bcf89){logger['error'](_0x17f2('0x24'),_0x1bcf89[_0x17f2('0x16')],_0x340b04);_0x2f5f65(_0x4eb3b5[_0x17f2('0x14')](0x1f4,_0x1bcf89[_0x17f2('0x16')]));});});};exports['UpdateMemberReport']=function(_0x3f06f6){var _0x2ab628=this;return new Promise(function(_0x4dc518,_0x6c43e2){return db[_0x17f2('0x19')]['update'](_0x3f06f6['body'],{'raw':_0x3f06f6[_0x17f2('0x1a')]?_0x3f06f6[_0x17f2('0x1a')][_0x17f2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f06f6[_0x17f2('0x1a')]?_0x3f06f6[_0x17f2('0x1a')][_0x17f2('0x1c')]||null:null,'attributes':_0x3f06f6['options']?_0x3f06f6[_0x17f2('0x1a')][_0x17f2('0x20')]||null:null,'limit':_0x3f06f6[_0x17f2('0x1a')]?_0x3f06f6['options'][_0x17f2('0x1d')]||null:null})[_0x17f2('0xe')](function(_0x1caf40){logger[_0x17f2('0xf')](_0x17f2('0x27'),_0x3f06f6);logger[_0x17f2('0x12')]('UpdateMemberReport',_0x3f06f6,JSON[_0x17f2('0x22')](_0x1caf40));_0x4dc518(_0x1caf40);})[_0x17f2('0x23')](function(_0x57526a){logger['error'](_0x17f2('0x27'),_0x57526a[_0x17f2('0x16')],_0x3f06f6);_0x6c43e2(_0x2ab628[_0x17f2('0x14')](0x1f4,_0x57526a[_0x17f2('0x16')]));});});}; \ No newline at end of file +var _0x1c9c=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','MemberReport','findAll','options','where','attributes','limit','include','map','model','then','GetMemberReport','CreateMemberReport','create','body','UpdateMemberReport'];(function(_0x4d79d9,_0x3e0f22){var _0x51bbc4=function(_0x5e6e91){while(--_0x5e6e91){_0x4d79d9['push'](_0x4d79d9['shift']());}};_0x51bbc4(++_0x3e0f22);}(_0x1c9c,0x172));var _0xc1c9=function(_0x2ed3a2,_0x5cc62a){_0x2ed3a2=_0x2ed3a2-0x0;var _0xf11bbc=_0x1c9c[_0x2ed3a2];return _0xf11bbc;};'use strict';var _=require(_0xc1c9('0x0'));var util=require(_0xc1c9('0x1'));var moment=require(_0xc1c9('0x2'));var BPromise=require(_0xc1c9('0x3'));var rs=require(_0xc1c9('0x4'));var fs=require('fs');var Redis=require(_0xc1c9('0x5'));var db=require(_0xc1c9('0x6'))['db'];var utils=require(_0xc1c9('0x7'));var logger=require(_0xc1c9('0x8'))(_0xc1c9('0x9'));var config=require(_0xc1c9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc1c9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4de1cf,_0x22f416,_0x51e279){return new BPromise(function(_0x5cf08f,_0x1aaf46){return client[_0xc1c9('0xc')](_0x4de1cf,_0x51e279)['then'](function(_0x376ffa){logger[_0xc1c9('0xd')](_0xc1c9('0xe'),_0x22f416,_0xc1c9('0xf'));logger[_0xc1c9('0x10')](_0xc1c9('0x11'),_0x22f416,_0xc1c9('0xf'),JSON[_0xc1c9('0x12')](_0x376ffa));if(_0x376ffa[_0xc1c9('0x13')]){if(_0x376ffa[_0xc1c9('0x13')]['code']===0x1f4){logger[_0xc1c9('0x13')](_0xc1c9('0xe'),_0x22f416,_0x376ffa[_0xc1c9('0x13')][_0xc1c9('0x14')]);return _0x1aaf46(_0x376ffa['error'][_0xc1c9('0x14')]);}logger['error'](_0xc1c9('0xe'),_0x22f416,_0x376ffa[_0xc1c9('0x13')][_0xc1c9('0x14')]);return _0x5cf08f(_0x376ffa[_0xc1c9('0x13')][_0xc1c9('0x14')]);}else{logger['info'](_0xc1c9('0xe'),_0x22f416,_0xc1c9('0xf'));_0x5cf08f(_0x376ffa['result'][_0xc1c9('0x14')]);}})[_0xc1c9('0x15')](function(_0x24a034){logger[_0xc1c9('0x13')](_0xc1c9('0xe'),_0x22f416,_0x24a034);_0x1aaf46(_0x24a034);});});}exports['GetMemberReport']=function(_0x203675){var _0x59eebe=this;return new Promise(function(_0x511a0a,_0x5e0693){return db[_0xc1c9('0x16')][_0xc1c9('0x17')]({'raw':_0x203675[_0xc1c9('0x18')]?_0x203675[_0xc1c9('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x203675[_0xc1c9('0x18')]?_0x203675[_0xc1c9('0x18')][_0xc1c9('0x19')]||null:null,'attributes':_0x203675[_0xc1c9('0x18')]?_0x203675[_0xc1c9('0x18')][_0xc1c9('0x1a')]||null:null,'limit':_0x203675[_0xc1c9('0x18')]?_0x203675[_0xc1c9('0x18')][_0xc1c9('0x1b')]||null:null,'include':_0x203675[_0xc1c9('0x18')]?_0x203675[_0xc1c9('0x18')][_0xc1c9('0x1c')]?_[_0xc1c9('0x1d')](_0x203675[_0xc1c9('0x18')]['include'],function(_0x5a2be3){return{'model':db[_0x5a2be3[_0xc1c9('0x1e')]],'as':_0x5a2be3['as'],'attributes':_0x5a2be3[_0xc1c9('0x1a')],'include':_0x5a2be3[_0xc1c9('0x1c')]?_[_0xc1c9('0x1d')](_0x5a2be3[_0xc1c9('0x1c')],function(_0x108377){return{'model':db[_0x108377[_0xc1c9('0x1e')]],'as':_0x108377['as'],'attributes':_0x108377[_0xc1c9('0x1a')],'include':_0x108377[_0xc1c9('0x1c')]?_[_0xc1c9('0x1d')](_0x108377[_0xc1c9('0x1c')],function(_0x58c913){return{'model':db[_0x58c913[_0xc1c9('0x1e')]],'as':_0x58c913['as'],'attributes':_0x58c913[_0xc1c9('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc1c9('0x1f')](function(_0x30a3ac){logger['info']('GetMemberReport',_0x203675);logger['debug'](_0xc1c9('0x20'),_0x203675,JSON[_0xc1c9('0x12')](_0x30a3ac));_0x511a0a(_0x30a3ac);})[_0xc1c9('0x15')](function(_0x5bfed6){logger[_0xc1c9('0x13')]('GetMemberReport',_0x5bfed6[_0xc1c9('0x14')],_0x203675);_0x5e0693(_0x59eebe[_0xc1c9('0x13')](0x1f4,_0x5bfed6['message']));});});};exports[_0xc1c9('0x21')]=function(_0x4c6d11){var _0x2fecb1=this;return new Promise(function(_0x5482a7,_0x1949f6){return db['MemberReport'][_0xc1c9('0x22')](_0x4c6d11[_0xc1c9('0x23')],{'raw':_0x4c6d11[_0xc1c9('0x18')]?_0x4c6d11[_0xc1c9('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xc1c9('0x1f')](function(_0x11aa57){logger[_0xc1c9('0xd')](_0xc1c9('0x21'),_0x4c6d11);logger[_0xc1c9('0x10')](_0xc1c9('0x21'),_0x4c6d11,JSON[_0xc1c9('0x12')](_0x11aa57));_0x5482a7(_0x11aa57);})[_0xc1c9('0x15')](function(_0x3513a4){logger[_0xc1c9('0x13')](_0xc1c9('0x21'),_0x3513a4['message'],_0x4c6d11);_0x1949f6(_0x2fecb1[_0xc1c9('0x13')](0x1f4,_0x3513a4[_0xc1c9('0x14')]));});});};exports[_0xc1c9('0x24')]=function(_0x40a939){var _0x502e92=this;return new Promise(function(_0x2acecc,_0x299d47){return db[_0xc1c9('0x16')]['update'](_0x40a939[_0xc1c9('0x23')],{'raw':_0x40a939[_0xc1c9('0x18')]?_0x40a939['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40a939[_0xc1c9('0x18')]?_0x40a939[_0xc1c9('0x18')][_0xc1c9('0x19')]||null:null,'attributes':_0x40a939[_0xc1c9('0x18')]?_0x40a939[_0xc1c9('0x18')][_0xc1c9('0x1a')]||null:null,'limit':_0x40a939['options']?_0x40a939['options'][_0xc1c9('0x1b')]||null:null})['then'](function(_0x14a32e){logger[_0xc1c9('0xd')](_0xc1c9('0x24'),_0x40a939);logger['debug'](_0xc1c9('0x24'),_0x40a939,JSON[_0xc1c9('0x12')](_0x14a32e));_0x2acecc(_0x14a32e);})[_0xc1c9('0x15')](function(_0x2c4e8b){logger[_0xc1c9('0x13')](_0xc1c9('0x24'),_0x2c4e8b['message'],_0x40a939);_0x299d47(_0x502e92[_0xc1c9('0x13')](0x1f4,_0x2c4e8b[_0xc1c9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 2977dd4..cc63788 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 _0x02ce=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer'];(function(_0x28a482,_0x16363b){var _0x31fd07=function(_0x272f9f){while(--_0x272f9f){_0x28a482['push'](_0x28a482['shift']());}};_0x31fd07(++_0x16363b);}(_0x02ce,0x1ac));var _0xe02c=function(_0x776c0f,_0x5f5a9a){_0x776c0f=_0x776c0f-0x0;var _0x3e6caa=_0x02ce[_0x776c0f];return _0x3e6caa;};'use strict';var multer=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var path=require(_0xe02c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe02c('0x3'));var router=express['Router']();var auth=require(_0xe02c('0x4'));var interaction=require(_0xe02c('0x5'));var config=require(_0xe02c('0x6'));var controller=require(_0xe02c('0x7'));router[_0xe02c('0x8')]('/',controller[_0xe02c('0x9')]);module[_0xe02c('0xa')]=router; \ No newline at end of file +var _0x5eb8=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x11dfbb,_0x1f4c8a){var _0x22d016=function(_0x38285c){while(--_0x38285c){_0x11dfbb['push'](_0x11dfbb['shift']());}};_0x22d016(++_0x1f4c8a);}(_0x5eb8,0xb0));var _0x85eb=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0x5eb8[_0x38c652];return _0x218a37;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var auth=require(_0x85eb('0x4'));var interaction=require(_0x85eb('0x5'));var config=require(_0x85eb('0x6'));var controller=require(_0x85eb('0x7'));router[_0x85eb('0x8')]('/',controller[_0x85eb('0x9')]);module[_0x85eb('0xa')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 4fa1edb..23efdc3 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 _0x2381=['version','exports','STRING'];(function(_0x1e2112,_0x2b2e6c){var _0x492d2d=function(_0x457b10){while(--_0x457b10){_0x1e2112['push'](_0x1e2112['shift']());}};_0x492d2d(++_0x2b2e6c);}(_0x2381,0xcd));var _0x1238=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x2381[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require('sequelize');module[_0x1238('0x0')]={'version':{'type':Sequelize[_0x1238('0x1')],'unique':_0x1238('0x2')}}; \ No newline at end of file +var _0xe514=['version','sequelize','STRING'];(function(_0x22e870,_0x4ecf1f){var _0x2b7acb=function(_0x251348){while(--_0x251348){_0x22e870['push'](_0x22e870['shift']());}};_0x2b7acb(++_0x4ecf1f);}(_0xe514,0x175));var _0x4e51=function(_0x4a52ed,_0x25b476){_0x4a52ed=_0x4a52ed-0x0;var _0x2fa11b=_0xe514[_0x4a52ed];return _0x2fa11b;};'use strict';var Sequelize=require(_0x4e51('0x0'));module['exports']={'version':{'type':Sequelize[_0x4e51('0x1')],'unique':_0x4e51('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 18ce3b6..bf9224a 100644 --- a/server/api/migration/migration.controller.js +++ b/server/api/migration/migration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','Migration','then','include','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x2f7eaf,_0x1847f7){var _0x165904=function(_0x2afcf6){while(--_0x2afcf6){_0x2f7eaf['push'](_0x2f7eaf['shift']());}};_0x165904(++_0x1847f7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x15dbd4,_0x42be0d){_0x15dbd4=_0x15dbd4-0x0;var _0x4ecafc=_0x5f2f[_0x15dbd4];return _0x4ecafc;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['Migration']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]));if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));}; \ No newline at end of file +var _0x5f2f=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','Migration','then','include','rows','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x250ef7,_0x5735cf){var _0xe0b8b=function(_0x5a8c34){while(--_0x5a8c34){_0x250ef7['push'](_0x250ef7['shift']());}};_0xe0b8b(++_0x5735cf);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1084a8,_0x4ab7bb){_0x1084a8=_0x1084a8-0x0;var _0x514e8c=_0x5f2f[_0x1084a8];return _0x514e8c;};'use strict';var pdf=require(_0xf5f2('0x0'));var emlformat=require(_0xf5f2('0x1'));var rimraf=require(_0xf5f2('0x2'));var zipdir=require(_0xf5f2('0x3'));var jsonpatch=require(_0xf5f2('0x4'));var rp=require(_0xf5f2('0x5'));var moment=require(_0xf5f2('0x6'));var BPromise=require(_0xf5f2('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf5f2('0x8'));var sox=require(_0xf5f2('0x9'));var csv=require(_0xf5f2('0xa'));var ejs=require(_0xf5f2('0xb'));var fs=require('fs');var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0xa'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var db=require(_0xf5f2('0x16'))['db'];function respondWithStatusCode(_0x14b51f,_0x331482){_0x331482=_0x331482||0xcc;return function(_0x3f2997){if(_0x3f2997){return _0x14b51f[_0xf5f2('0x17')](_0x331482);}return _0x14b51f[_0xf5f2('0x18')](_0x331482)['end']();};}function respondWithResult(_0x5850f4,_0xea612c){_0xea612c=_0xea612c||0xc8;return function(_0x269909){if(_0x269909){return _0x5850f4[_0xf5f2('0x18')](_0xea612c)[_0xf5f2('0x19')](_0x269909);}};}function respondWithFilteredResult(_0x4d97fc,_0xafe430){return function(_0x286197){if(_0x286197){var _0x17d656=_0x286197[_0xf5f2('0x1a')],_0x1b6dd2=_0xafe430[_0xf5f2('0x1b')],_0x23e23a=_0xafe430[_0xf5f2('0x1b')]+_0xafe430[_0xf5f2('0x1c')],_0x3a9dbb;if(_0x23e23a>=_0x17d656){_0x23e23a=_0x17d656;_0x3a9dbb=0xc8;}else{_0x3a9dbb=0xce;}_0x4d97fc[_0xf5f2('0x18')](_0x3a9dbb);return _0x4d97fc[_0xf5f2('0x1d')](_0xf5f2('0x1e'),_0x1b6dd2+'-'+_0x23e23a+'/'+_0x17d656)[_0xf5f2('0x19')](_0x286197);}return null;};}function patchUpdates(_0x3cf5ea){return function(_0x626999){try{jsonpatch[_0xf5f2('0x1f')](_0x626999,_0x3cf5ea,!![]);}catch(_0x56acc5){return BPromise[_0xf5f2('0x20')](_0x56acc5);}return _0x626999[_0xf5f2('0x21')]();};}function saveUpdates(_0x49dac2,_0x47acfc){return function(_0x2d2805){if(_0x2d2805){return _0x2d2805[_0xf5f2('0x22')](_0x49dac2)['then'](function(_0x45b74f){return _0x45b74f;});}return null;};}function removeEntity(_0x170042,_0x39e44a){return function(_0x39c024){if(_0x39c024){return _0x39c024[_0xf5f2('0x23')]()['then'](function(){_0x170042[_0xf5f2('0x18')](0xcc)[_0xf5f2('0x24')]();});}};}function handleEntityNotFound(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(!_0x287ad5){_0x4e8bda['sendStatus'](0x194);}return _0x287ad5;};}function handleError(_0x529f07,_0x5f1124){_0x5f1124=_0x5f1124||0x1f4;return function(_0x3f79d5){logger[_0xf5f2('0x25')](_0x3f79d5[_0xf5f2('0x26')]);if(_0x3f79d5[_0xf5f2('0x27')]){delete _0x3f79d5[_0xf5f2('0x27')];}_0x529f07[_0xf5f2('0x18')](_0x5f1124)[_0xf5f2('0x28')](_0x3f79d5);};}exports[_0xf5f2('0x29')]=function(_0x4ab014,_0xaa2602){var _0x102449={},_0x375ca8={},_0x31bfcb={'count':0x0,'rows':[]};var _0x198c73=_[_0xf5f2('0x2a')](db['Migration']['rawAttributes'],function(_0x22c826){return{'name':_0x22c826[_0xf5f2('0x2b')],'type':_0x22c826[_0xf5f2('0x2c')]['key']};});_0x375ca8['model']=_[_0xf5f2('0x2a')](_0x198c73,_0xf5f2('0x27'));_0x375ca8[_0xf5f2('0x2d')]=_[_0xf5f2('0x2e')](_0x4ab014[_0xf5f2('0x2d')]);_0x375ca8['filters']=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],_0x375ca8['query']);_0x102449[_0xf5f2('0x30')]=_['intersection'](_0x375ca8[_0xf5f2('0x2f')],qs[_0xf5f2('0x31')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x31')]));_0x102449[_0xf5f2('0x30')]=_0x102449[_0xf5f2('0x30')][_0xf5f2('0x32')]?_0x102449[_0xf5f2('0x30')]:_0x375ca8['model'];if(!_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x33')](_0xf5f2('0x34'))){_0x102449[_0xf5f2('0x1c')]=qs[_0xf5f2('0x1c')](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x1c')]);_0x102449['offset']=qs[_0xf5f2('0x1b')](_0x4ab014[_0xf5f2('0x2d')]['offset']);}_0x102449[_0xf5f2('0x35')]=qs['sort'](_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x36')]);_0x102449[_0xf5f2('0x37')]=qs[_0xf5f2('0x38')](_['pick'](_0x4ab014['query'],_0x375ca8[_0xf5f2('0x38')]));if(_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]){_0x102449['where']=_[_0xf5f2('0x3a')](_0x102449['where'],{'$or':_[_0xf5f2('0x2a')](_0x198c73,function(_0x566c47){if(_0x566c47[_0xf5f2('0x2c')]!==_0xf5f2('0x3b')){var _0x5337a6={};_0x5337a6[_0x566c47[_0xf5f2('0x27')]]={'$like':'%'+_0x4ab014[_0xf5f2('0x2d')][_0xf5f2('0x39')]+'%'};return _0x5337a6;}})});}_0x102449=_[_0xf5f2('0x3a')]({},_0x102449,_0x4ab014['options']);var _0x5d2d82={'where':_0x102449[_0xf5f2('0x37')]};return db[_0xf5f2('0x3c')][_0xf5f2('0x1a')](_0x5d2d82)[_0xf5f2('0x3d')](function(_0x2c7f65){_0x31bfcb[_0xf5f2('0x1a')]=_0x2c7f65;if(_0x4ab014[_0xf5f2('0x2d')]['includeAll']){_0x102449[_0xf5f2('0x3e')]=[{'all':!![]}];}return db[_0xf5f2('0x3c')]['findAll'](_0x102449);})[_0xf5f2('0x3d')](function(_0x3f3895){_0x31bfcb[_0xf5f2('0x3f')]=_0x3f3895;return _0x31bfcb;})[_0xf5f2('0x3d')](respondWithFilteredResult(_0xaa2602,_0x102449))[_0xf5f2('0x40')](handleError(_0xaa2602,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index aaed71a..053b4df 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 _0xbfa4=['./migration.attributes','exports','Migration','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x5f363e,_0x5c29e8){var _0x263a9f=function(_0x5eec9a){while(--_0x5eec9a){_0x5f363e['push'](_0x5f363e['shift']());}};_0x263a9f(++_0x5c29e8);}(_0xbfa4,0xf3));var _0x4bfa=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xbfa4[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x4bfa('0x0'));var util=require(_0x4bfa('0x1'));var logger=require('../../config/logger')(_0x4bfa('0x2'));var moment=require(_0x4bfa('0x3'));var BPromise=require('bluebird');var rp=require(_0x4bfa('0x4'));var fs=require('fs');var path=require(_0x4bfa('0x5'));var rimraf=require(_0x4bfa('0x6'));var config=require('../../config/environment');var attributes=require(_0x4bfa('0x7'));module[_0x4bfa('0x8')]=function(_0x26f404,_0x2775f7){return _0x26f404['define'](_0x4bfa('0x9'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82de=['moment','request-promise','path','rimraf','../../config/environment','exports','Migration','migrations','lodash','util','../../config/logger','api'];(function(_0x239a00,_0x1cc049){var _0x248dd3=function(_0x4fd868){while(--_0x4fd868){_0x239a00['push'](_0x239a00['shift']());}};_0x248dd3(++_0x1cc049);}(_0x82de,0x188));var _0xe82d=function(_0x9a18d0,_0x24ae9b){_0x9a18d0=_0x9a18d0-0x0;var _0x561924=_0x82de[_0x9a18d0];return _0x561924;};'use strict';var _=require(_0xe82d('0x0'));var util=require(_0xe82d('0x1'));var logger=require(_0xe82d('0x2'))(_0xe82d('0x3'));var moment=require(_0xe82d('0x4'));var BPromise=require('bluebird');var rp=require(_0xe82d('0x5'));var fs=require('fs');var path=require(_0xe82d('0x6'));var rimraf=require(_0xe82d('0x7'));var config=require(_0xe82d('0x8'));var attributes=require('./migration.attributes');module[_0xe82d('0x9')]=function(_0x5b110c,_0x10ae76){return _0x5b110c['define'](_0xe82d('0xa'),attributes,{'tableName':_0xe82d('0xb'),'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 1e1da87..49fa630 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 _0xcfaa=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch'];(function(_0x17eda4,_0x361e23){var _0x3036d5=function(_0x3a05b2){while(--_0x3a05b2){_0x17eda4['push'](_0x17eda4['shift']());}};_0x3036d5(++_0x361e23);}(_0xcfaa,0xdc));var _0xacfa=function(_0x1447c5,_0x5ed413){_0x1447c5=_0x1447c5-0x0;var _0x393a79=_0xcfaa[_0x1447c5];return _0x393a79;};'use strict';var _=require(_0xacfa('0x0'));var util=require(_0xacfa('0x1'));var moment=require(_0xacfa('0x2'));var BPromise=require(_0xacfa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacfa('0x4'));var db=require(_0xacfa('0x5'))['db'];var utils=require(_0xacfa('0x6'));var logger=require('../../config/logger')(_0xacfa('0x7'));var config=require(_0xacfa('0x8'));var jayson=require(_0xacfa('0x9'));var client=jayson[_0xacfa('0xa')][_0xacfa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54ba21,_0x5d33c7,_0x12ba2a){return new BPromise(function(_0x539857,_0x4eaf0e){return client[_0xacfa('0xc')](_0x54ba21,_0x12ba2a)['then'](function(_0x25276a){logger['info'](_0xacfa('0xd'),_0x5d33c7,_0xacfa('0xe'));logger[_0xacfa('0xf')]('Migration,\x20%s,\x20%s,\x20%s',_0x5d33c7,_0xacfa('0xe'),JSON[_0xacfa('0x10')](_0x25276a));if(_0x25276a[_0xacfa('0x11')]){if(_0x25276a[_0xacfa('0x11')][_0xacfa('0x12')]===0x1f4){logger[_0xacfa('0x11')](_0xacfa('0xd'),_0x5d33c7,_0x25276a['error'][_0xacfa('0x13')]);return _0x4eaf0e(_0x25276a[_0xacfa('0x11')][_0xacfa('0x13')]);}logger[_0xacfa('0x11')]('Migration,\x20%s,\x20%s',_0x5d33c7,_0x25276a[_0xacfa('0x11')]['message']);return _0x539857(_0x25276a[_0xacfa('0x11')][_0xacfa('0x13')]);}else{logger[_0xacfa('0x14')](_0xacfa('0xd'),_0x5d33c7,'request\x20sent');_0x539857(_0x25276a['result'][_0xacfa('0x13')]);}})[_0xacfa('0x15')](function(_0x50a804){logger[_0xacfa('0x11')]('Migration,\x20%s,\x20%s',_0x5d33c7,_0x50a804);_0x4eaf0e(_0x50a804);});});} \ No newline at end of file +var _0x7e83=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','message','Migration,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0x7e83,0x7c));var _0x37e8=function(_0x547587,_0x48cbd9){_0x547587=_0x547587-0x0;var _0x3d7777=_0x7e83[_0x547587];return _0x3d7777;};'use strict';var _=require(_0x37e8('0x0'));var util=require(_0x37e8('0x1'));var moment=require(_0x37e8('0x2'));var BPromise=require(_0x37e8('0x3'));var rs=require(_0x37e8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x37e8('0x5'));var logger=require(_0x37e8('0x6'))(_0x37e8('0x7'));var config=require('../../config/environment');var jayson=require(_0x37e8('0x8'));var client=jayson[_0x37e8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21f644,_0x2d4f25,_0x4a669c){return new BPromise(function(_0x18c5ed,_0x396fdf){return client[_0x37e8('0xa')](_0x21f644,_0x4a669c)[_0x37e8('0xb')](function(_0x50680c){logger[_0x37e8('0xc')]('Migration,\x20%s,\x20%s',_0x2d4f25,_0x37e8('0xd'));logger[_0x37e8('0xe')](_0x37e8('0xf'),_0x2d4f25,_0x37e8('0xd'),JSON['stringify'](_0x50680c));if(_0x50680c[_0x37e8('0x10')]){if(_0x50680c[_0x37e8('0x10')]['code']===0x1f4){logger[_0x37e8('0x10')]('Migration,\x20%s,\x20%s',_0x2d4f25,_0x50680c['error'][_0x37e8('0x11')]);return _0x396fdf(_0x50680c[_0x37e8('0x10')][_0x37e8('0x11')]);}logger[_0x37e8('0x10')](_0x37e8('0x12'),_0x2d4f25,_0x50680c['error'][_0x37e8('0x11')]);return _0x18c5ed(_0x50680c[_0x37e8('0x10')]['message']);}else{logger['info'](_0x37e8('0x12'),_0x2d4f25,_0x37e8('0xd'));_0x18c5ed(_0x50680c[_0x37e8('0x13')][_0x37e8('0x11')]);}})[_0x37e8('0x14')](function(_0x3a333e){logger[_0x37e8('0x10')](_0x37e8('0x12'),_0x2d4f25,_0x3a333e);_0x396fdf(_0x3a333e);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 99a81fb..116e8d0 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 _0x6717=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','post','create','put','/:id','delete','destroy'];(function(_0x47abd0,_0x23c009){var _0x1b66bf=function(_0x37ca4d){while(--_0x37ca4d){_0x47abd0['push'](_0x47abd0['shift']());}};_0x1b66bf(++_0x23c009);}(_0x6717,0x1a1));var _0x7671=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6717[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x7671('0x0'));var path=require('path');var timeout=require(_0x7671('0x1'));var express=require(_0x7671('0x2'));var router=express[_0x7671('0x3')]();var auth=require(_0x7671('0x4'));var interaction=require(_0x7671('0x5'));var config=require('../../config/environment');var controller=require('./network.controller');router[_0x7671('0x6')]('/',auth[_0x7671('0x7')](),controller[_0x7671('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7671('0x9')]('/',auth[_0x7671('0x7')](),controller[_0x7671('0xa')]);router[_0x7671('0xb')](_0x7671('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x7671('0xd')](_0x7671('0xc'),auth[_0x7671('0x7')](),controller[_0x7671('0xe')]);module[_0x7671('0xf')]=router; \ No newline at end of file +var _0x241f=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','index','get','show','create','/:id','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x241f,0x169));var _0xf241=function(_0xa4b8e1,_0x49d30b){_0xa4b8e1=_0xa4b8e1-0x0;var _0x507e42=_0x241f[_0xa4b8e1];return _0x507e42;};'use strict';var multer=require(_0xf241('0x0'));var util=require(_0xf241('0x1'));var path=require(_0xf241('0x2'));var timeout=require(_0xf241('0x3'));var express=require(_0xf241('0x4'));var router=express['Router']();var auth=require(_0xf241('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf241('0x6'));var controller=require(_0xf241('0x7'));router['get']('/',auth[_0xf241('0x8')](),controller[_0xf241('0x9')]);router[_0xf241('0xa')]('/:id',auth[_0xf241('0x8')](),controller[_0xf241('0xb')]);router['post']('/',auth[_0xf241('0x8')](),controller[_0xf241('0xc')]);router['put'](_0xf241('0xd'),auth['isAuthenticated'](),controller[_0xf241('0xe')]);router[_0xf241('0xf')](_0xf241('0xd'),auth['isAuthenticated'](),controller[_0xf241('0x10')]);module[_0xf241('0x11')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 5227a76..c955c59 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(_0x3059b6,_0x1304d8){var _0x55cfc9=function(_0x21133e){while(--_0x21133e){_0x3059b6['push'](_0x3059b6['shift']());}};_0x55cfc9(++_0x1304d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x5e3898,_0x39f21a){var _0xd775f6=function(_0x4c6831){while(--_0x4c6831){_0x5e3898['push'](_0x5e3898['shift']());}};_0xd775f6(++_0x39f21a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 298a43e..ec94b25 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 _0x1474=['count','offset','limit','Content-Range','apply','save','update','then','stack','name','send','map','Network','type','key','query','keys','filters','intersection','attributes','model','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','readFileSync','writeFileSync','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','transaction','find','format','toLowerCase','chan_sip.so','destroy','server/files/templates/turn_multiple.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','end','status','json'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1474,0x114));var _0x4147=function(_0xd49fef,_0x23f01e){_0xd49fef=_0xd49fef-0x0;var _0x304be8=_0x1474[_0xd49fef];return _0x304be8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4147('0x0'));var rimraf=require(_0x4147('0x1'));var zipdir=require(_0x4147('0x2'));var jsonpatch=require(_0x4147('0x3'));var rp=require(_0x4147('0x4'));var moment=require(_0x4147('0x5'));var BPromise=require(_0x4147('0x6'));var Mustache=require(_0x4147('0x7'));var util=require('util');var path=require(_0x4147('0x8'));var sox=require(_0x4147('0x9'));var csv=require(_0x4147('0xa'));var ejs=require(_0x4147('0xb'));var fs=require('fs');var _=require(_0x4147('0xc'));var squel=require(_0x4147('0xd'));var crypto=require('crypto');var jsforce=require(_0x4147('0xe'));var deskjs=require(_0x4147('0xf'));var toCsv=require(_0x4147('0xa'));var querystring=require(_0x4147('0x10'));var Papa=require(_0x4147('0x11'));var Redis=require(_0x4147('0x12'));var authService=require(_0x4147('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4147('0x14'));var hardwareService=require(_0x4147('0x15'));var logger=require(_0x4147('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x4147('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4147('0x18'));var client=jayson[_0x4147('0x19')][_0x4147('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x566378,_0x43eb1a,_0x634e74){if(_0x634e74){var _0x45c450=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x45c450[_0x4147('0x1b')](_0x43eb1a)){return _0x566378;}else{throw new db[(_0x4147('0x1c'))][(_0x4147('0x1d'))](_0x4147('0x1e'));}}else{return _0x566378;}}function respondWithRpcPromise(_0x4eee6d,_0x417c4d,_0x2a6253,_0x46107d){return new BPromise(function(_0x2d0e31,_0x5a2509){var _0x466655=_0x46107d||client;return _0x466655[_0x4147('0x1f')](_0x4eee6d,_0x2a6253)['then'](function(_0x34d51a){logger[_0x4147('0x20')](_0x4147('0x21'),_0x417c4d,'request\x20sent');logger[_0x4147('0x22')](_0x4147('0x23'),_0x417c4d,_0x4147('0x24'),JSON[_0x4147('0x25')](_0x34d51a));if(_0x34d51a[_0x4147('0x26')]){if(_0x34d51a[_0x4147('0x26')]['code']===0x1f4){logger[_0x4147('0x26')](_0x4147('0x21'),_0x417c4d,_0x34d51a[_0x4147('0x26')][_0x4147('0x27')]);return _0x5a2509(_0x34d51a[_0x4147('0x26')][_0x4147('0x27')]);}logger[_0x4147('0x26')]('Network,\x20%s,\x20%s',_0x417c4d,_0x34d51a['error'][_0x4147('0x27')]);return _0x2d0e31(_0x34d51a['error']['message']);}else{logger[_0x4147('0x20')](_0x4147('0x21'),_0x417c4d,_0x4147('0x24'));_0x2d0e31(_0x34d51a[_0x4147('0x28')][_0x4147('0x27')]);}})['catch'](function(_0x1b69ea){logger['error'](_0x4147('0x21'),_0x417c4d,_0x1b69ea);_0x5a2509(_0x1b69ea);});});}function respondWithStatusCode(_0x4789e4,_0x26ffa9){_0x26ffa9=_0x26ffa9||0xcc;return function(_0x4e39a9){if(_0x4e39a9){return _0x4789e4[_0x4147('0x29')](_0x26ffa9);}return _0x4789e4['status'](_0x26ffa9)[_0x4147('0x2a')]();};}function respondWithResult(_0x18581b,_0x230bc8){_0x230bc8=_0x230bc8||0xc8;return function(_0x39bca9){if(_0x39bca9){return _0x18581b[_0x4147('0x2b')](_0x230bc8)[_0x4147('0x2c')](_0x39bca9);}};}function respondWithFilteredResult(_0x2bf7d7,_0xd6e073){return function(_0x18a912){if(_0x18a912){var _0x22b253=_0x18a912[_0x4147('0x2d')],_0x264b91=_0xd6e073[_0x4147('0x2e')],_0x3e570b=_0xd6e073['offset']+_0xd6e073[_0x4147('0x2f')],_0x497643;if(_0x3e570b>=_0x22b253){_0x3e570b=_0x22b253;_0x497643=0xc8;}else{_0x497643=0xce;}_0x2bf7d7[_0x4147('0x2b')](_0x497643);return _0x2bf7d7['set'](_0x4147('0x30'),_0x264b91+'-'+_0x3e570b+'/'+_0x22b253)[_0x4147('0x2c')](_0x18a912);}return null;};}function patchUpdates(_0x52c9e9){return function(_0x57f80e){try{jsonpatch[_0x4147('0x31')](_0x57f80e,_0x52c9e9,!![]);}catch(_0x1945e5){return BPromise['reject'](_0x1945e5);}return _0x57f80e[_0x4147('0x32')]();};}function saveUpdates(_0x2366df,_0x4f08c7){return function(_0x416b67){if(_0x416b67){return _0x416b67[_0x4147('0x33')](_0x2366df)[_0x4147('0x34')](function(_0x3940ad){return _0x3940ad;});}return null;};}function removeEntity(_0x3e4545,_0x31295e){return function(_0x14a2c6){if(_0x14a2c6){return _0x14a2c6['destroy']()[_0x4147('0x34')](function(){_0x3e4545['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x51e96d,_0x5ad9be){return function(_0x24e09e){if(!_0x24e09e){_0x51e96d[_0x4147('0x29')](0x194);}return _0x24e09e;};}function handleError(_0x18fb15,_0x5761a7){_0x5761a7=_0x5761a7||0x1f4;return function(_0x5d6bec){logger['error'](_0x5d6bec[_0x4147('0x35')]);if(_0x5d6bec['name']){delete _0x5d6bec[_0x4147('0x36')];}_0x18fb15['status'](_0x5761a7)[_0x4147('0x37')](_0x5d6bec);};}exports['index']=function(_0x4f34ea,_0x3b248a){var _0x16ed90={},_0x14acbf={},_0x539e60={'count':0x0,'rows':[]};var _0x2bf1b3=_[_0x4147('0x38')](db[_0x4147('0x39')]['rawAttributes'],function(_0x5c67b2){return{'name':_0x5c67b2['fieldName'],'type':_0x5c67b2[_0x4147('0x3a')][_0x4147('0x3b')]};});_0x14acbf['model']=_[_0x4147('0x38')](_0x2bf1b3,_0x4147('0x36'));_0x14acbf[_0x4147('0x3c')]=_[_0x4147('0x3d')](_0x4f34ea[_0x4147('0x3c')]);_0x14acbf[_0x4147('0x3e')]=_[_0x4147('0x3f')](_0x14acbf['model'],_0x14acbf['query']);_0x16ed90[_0x4147('0x40')]=_[_0x4147('0x3f')](_0x14acbf[_0x4147('0x41')],qs[_0x4147('0x42')](_0x4f34ea['query'][_0x4147('0x42')]));_0x16ed90[_0x4147('0x40')]=_0x16ed90[_0x4147('0x40')][_0x4147('0x43')]?_0x16ed90['attributes']:_0x14acbf['model'];if(!_0x4f34ea['query']['hasOwnProperty']('nolimit')){_0x16ed90[_0x4147('0x2f')]=qs[_0x4147('0x2f')](_0x4f34ea[_0x4147('0x3c')]['limit']);_0x16ed90[_0x4147('0x2e')]=qs[_0x4147('0x2e')](_0x4f34ea[_0x4147('0x3c')][_0x4147('0x2e')]);}_0x16ed90[_0x4147('0x44')]=qs['sort'](_0x4f34ea['query'][_0x4147('0x45')]);_0x16ed90[_0x4147('0x46')]=qs[_0x4147('0x3e')](_['pick'](_0x4f34ea[_0x4147('0x3c')],_0x14acbf['filters']));if(_0x4f34ea[_0x4147('0x3c')][_0x4147('0x47')]){_0x16ed90[_0x4147('0x46')]=_[_0x4147('0x48')](_0x16ed90[_0x4147('0x46')],{'$or':_[_0x4147('0x38')](_0x2bf1b3,function(_0x3c582a){if(_0x3c582a[_0x4147('0x3a')]!==_0x4147('0x49')){var _0x2f6508={};_0x2f6508[_0x3c582a[_0x4147('0x36')]]={'$like':'%'+_0x4f34ea[_0x4147('0x3c')]['filter']+'%'};return _0x2f6508;}})});}_0x16ed90=_[_0x4147('0x48')]({},_0x16ed90,_0x4f34ea[_0x4147('0x4a')]);var _0x787fd={'where':_0x16ed90['where']};return db[_0x4147('0x39')][_0x4147('0x2d')](_0x787fd)[_0x4147('0x34')](function(_0x35145a){_0x539e60[_0x4147('0x2d')]=_0x35145a;if(_0x4f34ea[_0x4147('0x3c')][_0x4147('0x4b')]){_0x16ed90[_0x4147('0x4c')]=[{'all':!![]}];}return db[_0x4147('0x39')][_0x4147('0x4d')](_0x16ed90);})[_0x4147('0x34')](function(_0x4de49c){_0x539e60[_0x4147('0x4e')]=_0x4de49c;return _0x539e60;})[_0x4147('0x34')](respondWithFilteredResult(_0x3b248a,_0x16ed90))[_0x4147('0x4f')](handleError(_0x3b248a,null));};exports[_0x4147('0x50')]=function(_0x215692,_0x35a725){var _0x2ef70e={'raw':!![],'where':{'id':_0x215692[_0x4147('0x51')]['id']}},_0x3a041b={};_0x3a041b[_0x4147('0x41')]=_[_0x4147('0x3d')](db['Network']['rawAttributes']);_0x3a041b[_0x4147('0x3c')]=_[_0x4147('0x3d')](_0x215692['query']);_0x3a041b[_0x4147('0x3e')]=_[_0x4147('0x3f')](_0x3a041b['model'],_0x3a041b[_0x4147('0x3c')]);_0x2ef70e[_0x4147('0x40')]=_[_0x4147('0x3f')](_0x3a041b[_0x4147('0x41')],qs['fields'](_0x215692[_0x4147('0x3c')][_0x4147('0x42')]));_0x2ef70e[_0x4147('0x40')]=_0x2ef70e[_0x4147('0x40')][_0x4147('0x43')]?_0x2ef70e[_0x4147('0x40')]:_0x3a041b[_0x4147('0x41')];if(_0x215692[_0x4147('0x3c')][_0x4147('0x4b')]){_0x2ef70e[_0x4147('0x4c')]=[{'all':!![]}];}_0x2ef70e=_['merge']({},_0x2ef70e,_0x215692[_0x4147('0x4a')]);return db[_0x4147('0x39')]['find'](_0x2ef70e)[_0x4147('0x34')](handleEntityNotFound(_0x35a725,null))[_0x4147('0x34')](respondWithResult(_0x35a725,null))[_0x4147('0x4f')](handleError(_0x35a725,null));};exports[_0x4147('0x52')]=function(_0x254806,_0x2cdb24,_0x47a115){var _0xf6761e;return db['sequelize']['transaction'](function(_0x2c8a3a){return db[_0x4147('0x39')][_0x4147('0x52')](_0x254806[_0x4147('0x53')],{'raw':!![]})[_0x4147('0x34')](function(_0x2d4c1b){_0xf6761e=_0x2d4c1b;return db[_0x4147('0x39')][_0x4147('0x4d')]({'where':{'type':_0x254806[_0x4147('0x53')][_0x4147('0x3a')]},'raw':!![]});})[_0x4147('0x34')](function(_0x51db3f){if(_0xf6761e[_0x4147('0x3a')][_0x4147('0x54')]()==_0x4147('0x55')){var _0x1a5b7b=fs['readFileSync'](path[_0x4147('0x56')](config[_0x4147('0x57')],_0x4147('0x58')),_0x4147('0x59'));var _0x2be9a3=ejs[_0x4147('0x5a')](_0x1a5b7b,{'networks':_0x51db3f||[]});fs['writeFileSync'](_0x4147('0x5b'),_0x2be9a3);return respondWithRpcPromise('Reload',_0x4147('0x52'),{'module':_0x4147('0x5c')});}else if(_0xf6761e[_0x4147('0x3a')]['toUpperCase']()==_0x4147('0x5d')){var _0x4e9732=fs[_0x4147('0x5e')](path[_0x4147('0x56')](config[_0x4147('0x57')],'server/files/templates/turn_multiple.ejs'),_0x4147('0x59'));var _0x4d4924=ejs['render'](_0x4e9732,{'networks':_0x51db3f||[]});fs[_0x4147('0x5f')](_0x4147('0x60'),_0x4d4924);return respondWithRpcPromise(_0x4147('0x61'),_0x4147('0x52'),{'module':_0x4147('0x5c')});}else{var _0x276a8c=fs[_0x4147('0x5e')](path[_0x4147('0x56')](config[_0x4147('0x57')],_0x4147('0x62')),_0x4147('0x59'));var _0x46b4ec=ejs[_0x4147('0x5a')](_0x276a8c,{'networks':_0x51db3f||[]});fs[_0x4147('0x5f')](util['format'](_0x4147('0x63'),_0x254806[_0x4147('0x53')]['type']['toLowerCase']()),_0x46b4ec);return respondWithRpcPromise(_0x4147('0x61'),_0x4147('0x52'),{'module':'chan_sip.so'});}return null;})[_0x4147('0x34')](function(){return _0xf6761e;});})['then'](respondWithResult(_0x2cdb24,0xc9))[_0x4147('0x4f')](handleError(_0x2cdb24,null));};exports['update']=function(_0x2eb9f5,_0x5861ef,_0x1e5546){var _0x4240c9;return db['sequelize'][_0x4147('0x64')](function(_0x5d2921){return db['Network'][_0x4147('0x65')]({'where':{'id':_0x2eb9f5[_0x4147('0x51')]['id']}})[_0x4147('0x34')](handleEntityNotFound(_0x5861ef,null))['then'](saveUpdates(_0x2eb9f5['body'],null))[_0x4147('0x34')](function(_0x2eb80e){if(_0x2eb80e){_0x4240c9=_0x2eb80e;return db['Network']['findAll']({'where':{'type':_0x4240c9[_0x4147('0x3a')]},'raw':!![]});}return null;})[_0x4147('0x34')](function(_0x1700fb){if(_0x4240c9[_0x4147('0x3a')][_0x4147('0x54')]()==_0x4147('0x55')){var _0x4f9b5b=fs[_0x4147('0x5e')](path[_0x4147('0x56')](config['root'],_0x4147('0x58')),'utf8');var _0x501e64=ejs[_0x4147('0x5a')](_0x4f9b5b,{'networks':_0x1700fb||[]});fs[_0x4147('0x5f')](_0x4147('0x5b'),_0x501e64);return respondWithRpcPromise(_0x4147('0x61'),_0x4147('0x33'),{'module':_0x4147('0x5c')});}else if(_0x4240c9['type'][_0x4147('0x54')]()==_0x4147('0x5d')){var _0x27cd2e=fs[_0x4147('0x5e')](path[_0x4147('0x56')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x4147('0x59'));var _0x1f7493=ejs['render'](_0x27cd2e,{'networks':_0x1700fb||[]});fs['writeFileSync'](_0x4147('0x60'),_0x1f7493);return respondWithRpcPromise(_0x4147('0x61'),_0x4147('0x33'),{'module':'res_stun_monitor.so'});}else{var _0x226532=fs['readFileSync'](path[_0x4147('0x56')](config[_0x4147('0x57')],'server/files/templates/network.ejs'),_0x4147('0x59'));var _0x55dc72=ejs['render'](_0x226532,{'networks':_0x1700fb||[]});fs[_0x4147('0x5f')](util[_0x4147('0x66')](_0x4147('0x63'),_0x2eb9f5[_0x4147('0x53')]['type'][_0x4147('0x67')]()),_0x55dc72);return respondWithRpcPromise(_0x4147('0x61'),_0x4147('0x33'),{'module':_0x4147('0x68')});}return null;})['then'](function(_0x4f5278){if(_0x4f5278){return _0x4240c9;}return null;});})['then'](respondWithResult(_0x5861ef,null))[_0x4147('0x4f')](handleError(_0x5861ef,null));};exports['destroy']=function(_0x36686c,_0x1d9339,_0x37f470){var _0x41db02;return db[_0x4147('0x39')][_0x4147('0x65')]({'where':{'id':_0x36686c[_0x4147('0x51')]['id']}})['then'](function(_0x584fc6){_0x41db02=_0x584fc6;return _0x584fc6;})['then'](handleEntityNotFound(_0x1d9339,null))[_0x4147('0x34')](removeEntity(_0x1d9339,null))[_0x4147('0x34')](function(){if(_0x41db02){return db['Network'][_0x4147('0x4d')]({'where':{'type':_0x41db02[_0x4147('0x3a')]},'raw':!![]});}})[_0x4147('0x34')](function(_0x3dc50d){if(_0x41db02['type'][_0x4147('0x54')]()==_0x4147('0x55')){var _0x15aeeb=fs[_0x4147('0x5e')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0x4147('0x59'));var _0x470ce3=ejs[_0x4147('0x5a')](_0x15aeeb,{'networks':_0x3dc50d||[]});fs[_0x4147('0x5f')](_0x4147('0x5b'),_0x470ce3);return respondWithRpcPromise('Reload',_0x4147('0x69'),{'module':_0x4147('0x5c')});}else if(_0x41db02[_0x4147('0x3a')]['toUpperCase']()=='TURN'){var _0x1b04fe=fs[_0x4147('0x5e')](path[_0x4147('0x56')](config[_0x4147('0x57')],_0x4147('0x6a')),_0x4147('0x59'));var _0x4db708=ejs[_0x4147('0x5a')](_0x1b04fe,{'networks':_0x3dc50d||[]});fs['writeFileSync'](_0x4147('0x60'),_0x4db708);return respondWithRpcPromise('Reload',_0x4147('0x69'),{'module':_0x4147('0x5c')});}else{var _0x31938b=fs[_0x4147('0x5e')](path[_0x4147('0x56')](config[_0x4147('0x57')],_0x4147('0x62')),_0x4147('0x59'));var _0xef0932=ejs['render'](_0x31938b,{'networks':_0x3dc50d||[]});fs['writeFileSync'](util[_0x4147('0x66')](_0x4147('0x63'),_0x36686c[_0x4147('0x53')]['type'][_0x4147('0x67')]()),_0xef0932);return respondWithRpcPromise(_0x4147('0x61'),_0x4147('0x69'),{'module':_0x4147('0x68')});}return null;})[_0x4147('0x4f')](handleError(_0x1d9339,null));}; \ No newline at end of file +var _0xc4d6=['destroy','stack','name','index','map','Network','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','create','sequelize','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','join','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','format','html-pdf','eml-format','rimraf','zip-dir','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','jayson/promise','http','test','Sequelize','request','info','request\x20sent','debug','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then'];(function(_0x4f9ba8,_0x87b3bb){var _0x5ad37f=function(_0xa34cb){while(--_0xa34cb){_0x4f9ba8['push'](_0x4f9ba8['shift']());}};_0x5ad37f(++_0x87b3bb);}(_0xc4d6,0x16e));var _0x6c4d=function(_0x1fb4a0,_0x48a602){_0x1fb4a0=_0x1fb4a0-0x0;var _0x1094e7=_0xc4d6[_0x1fb4a0];return _0x1094e7;};'use strict';var pdf=require(_0x6c4d('0x0'));var emlformat=require(_0x6c4d('0x1'));var rimraf=require(_0x6c4d('0x2'));var zipdir=require(_0x6c4d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6c4d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6c4d('0x5'));var sox=require('sox');var csv=require(_0x6c4d('0x6'));var ejs=require(_0x6c4d('0x7'));var fs=require('fs');var _=require(_0x6c4d('0x8'));var squel=require(_0x6c4d('0x9'));var crypto=require(_0x6c4d('0xa'));var jsforce=require(_0x6c4d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6c4d('0x6'));var querystring=require(_0x6c4d('0xc'));var Papa=require(_0x6c4d('0xd'));var Redis=require(_0x6c4d('0xe'));var authService=require(_0x6c4d('0xf'));var qs=require(_0x6c4d('0x10'));var as=require(_0x6c4d('0x11'));var hardwareService=require(_0x6c4d('0x12'));var logger=require(_0x6c4d('0x13'))(_0x6c4d('0x14'));var utils=require('../../config/utils');var config=require(_0x6c4d('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x6c4d('0x16'));var client=jayson['client'][_0x6c4d('0x17')]({'port':0x232a});function checkPasswordPattern(_0x211ee4,_0x549c89,_0x4c9d28){if(_0x4c9d28){var _0x45e139=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x45e139[_0x6c4d('0x18')](_0x549c89)){return _0x211ee4;}else{throw new db[(_0x6c4d('0x19'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x211ee4;}}function respondWithRpcPromise(_0x3123e6,_0x29ef71,_0x294e47,_0x224569){return new BPromise(function(_0x28783b,_0x4e0103){var _0xd620d7=_0x224569||client;return _0xd620d7[_0x6c4d('0x1a')](_0x3123e6,_0x294e47)['then'](function(_0x20d829){logger[_0x6c4d('0x1b')]('Network,\x20%s,\x20%s',_0x29ef71,_0x6c4d('0x1c'));logger[_0x6c4d('0x1d')]('Network,\x20%s,\x20%s,\x20%s',_0x29ef71,'request\x20sent',JSON[_0x6c4d('0x1e')](_0x20d829));if(_0x20d829[_0x6c4d('0x1f')]){if(_0x20d829[_0x6c4d('0x1f')][_0x6c4d('0x20')]===0x1f4){logger['error'](_0x6c4d('0x21'),_0x29ef71,_0x20d829['error'][_0x6c4d('0x22')]);return _0x4e0103(_0x20d829[_0x6c4d('0x1f')]['message']);}logger[_0x6c4d('0x1f')]('Network,\x20%s,\x20%s',_0x29ef71,_0x20d829[_0x6c4d('0x1f')][_0x6c4d('0x22')]);return _0x28783b(_0x20d829[_0x6c4d('0x1f')][_0x6c4d('0x22')]);}else{logger[_0x6c4d('0x1b')](_0x6c4d('0x21'),_0x29ef71,_0x6c4d('0x1c'));_0x28783b(_0x20d829[_0x6c4d('0x23')][_0x6c4d('0x22')]);}})[_0x6c4d('0x24')](function(_0x35c9d7){logger[_0x6c4d('0x1f')](_0x6c4d('0x21'),_0x29ef71,_0x35c9d7);_0x4e0103(_0x35c9d7);});});}function respondWithStatusCode(_0x4a4fa8,_0x539dc4){_0x539dc4=_0x539dc4||0xcc;return function(_0x530e13){if(_0x530e13){return _0x4a4fa8[_0x6c4d('0x25')](_0x539dc4);}return _0x4a4fa8['status'](_0x539dc4)[_0x6c4d('0x26')]();};}function respondWithResult(_0x349379,_0x587869){_0x587869=_0x587869||0xc8;return function(_0x1c3f39){if(_0x1c3f39){return _0x349379[_0x6c4d('0x27')](_0x587869)[_0x6c4d('0x28')](_0x1c3f39);}};}function respondWithFilteredResult(_0x5ddbee,_0x880430){return function(_0x2bb954){if(_0x2bb954){var _0x10c0bd=_0x2bb954[_0x6c4d('0x29')],_0x5eced5=_0x880430[_0x6c4d('0x2a')],_0x685f25=_0x880430['offset']+_0x880430[_0x6c4d('0x2b')],_0x2cce6c;if(_0x685f25>=_0x10c0bd){_0x685f25=_0x10c0bd;_0x2cce6c=0xc8;}else{_0x2cce6c=0xce;}_0x5ddbee[_0x6c4d('0x27')](_0x2cce6c);return _0x5ddbee[_0x6c4d('0x2c')](_0x6c4d('0x2d'),_0x5eced5+'-'+_0x685f25+'/'+_0x10c0bd)[_0x6c4d('0x28')](_0x2bb954);}return null;};}function patchUpdates(_0x5c6aef){return function(_0x3ea302){try{jsonpatch['apply'](_0x3ea302,_0x5c6aef,!![]);}catch(_0x2b62d3){return BPromise[_0x6c4d('0x2e')](_0x2b62d3);}return _0x3ea302[_0x6c4d('0x2f')]();};}function saveUpdates(_0x409247,_0x593ca){return function(_0x9f2b27){if(_0x9f2b27){return _0x9f2b27[_0x6c4d('0x30')](_0x409247)[_0x6c4d('0x31')](function(_0x25a9ac){return _0x25a9ac;});}return null;};}function removeEntity(_0x41613f,_0x274b62){return function(_0x40d412){if(_0x40d412){return _0x40d412[_0x6c4d('0x32')]()[_0x6c4d('0x31')](function(){_0x41613f[_0x6c4d('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cd86e,_0x159627){return function(_0x2baed5){if(!_0x2baed5){_0x5cd86e[_0x6c4d('0x25')](0x194);}return _0x2baed5;};}function handleError(_0x21d4bb,_0x13fc16){_0x13fc16=_0x13fc16||0x1f4;return function(_0x1c1042){logger[_0x6c4d('0x1f')](_0x1c1042[_0x6c4d('0x33')]);if(_0x1c1042[_0x6c4d('0x34')]){delete _0x1c1042[_0x6c4d('0x34')];}_0x21d4bb[_0x6c4d('0x27')](_0x13fc16)['send'](_0x1c1042);};}exports[_0x6c4d('0x35')]=function(_0x43678b,_0x1b0aef){var _0x4d7120={},_0x4394c1={},_0x3fa56b={'count':0x0,'rows':[]};var _0x5ec631=_[_0x6c4d('0x36')](db[_0x6c4d('0x37')][_0x6c4d('0x38')],function(_0x505e29){return{'name':_0x505e29[_0x6c4d('0x39')],'type':_0x505e29[_0x6c4d('0x3a')][_0x6c4d('0x3b')]};});_0x4394c1[_0x6c4d('0x3c')]=_[_0x6c4d('0x36')](_0x5ec631,_0x6c4d('0x34'));_0x4394c1[_0x6c4d('0x3d')]=_[_0x6c4d('0x3e')](_0x43678b[_0x6c4d('0x3d')]);_0x4394c1['filters']=_['intersection'](_0x4394c1[_0x6c4d('0x3c')],_0x4394c1[_0x6c4d('0x3d')]);_0x4d7120[_0x6c4d('0x3f')]=_[_0x6c4d('0x40')](_0x4394c1[_0x6c4d('0x3c')],qs[_0x6c4d('0x41')](_0x43678b[_0x6c4d('0x3d')][_0x6c4d('0x41')]));_0x4d7120['attributes']=_0x4d7120[_0x6c4d('0x3f')][_0x6c4d('0x42')]?_0x4d7120['attributes']:_0x4394c1['model'];if(!_0x43678b[_0x6c4d('0x3d')]['hasOwnProperty'](_0x6c4d('0x43'))){_0x4d7120[_0x6c4d('0x2b')]=qs[_0x6c4d('0x2b')](_0x43678b[_0x6c4d('0x3d')]['limit']);_0x4d7120[_0x6c4d('0x2a')]=qs['offset'](_0x43678b[_0x6c4d('0x3d')][_0x6c4d('0x2a')]);}_0x4d7120['order']=qs[_0x6c4d('0x44')](_0x43678b[_0x6c4d('0x3d')][_0x6c4d('0x44')]);_0x4d7120[_0x6c4d('0x45')]=qs[_0x6c4d('0x46')](_['pick'](_0x43678b[_0x6c4d('0x3d')],_0x4394c1['filters']));if(_0x43678b[_0x6c4d('0x3d')][_0x6c4d('0x47')]){_0x4d7120[_0x6c4d('0x45')]=_[_0x6c4d('0x48')](_0x4d7120[_0x6c4d('0x45')],{'$or':_['map'](_0x5ec631,function(_0x45e2b9){if(_0x45e2b9[_0x6c4d('0x3a')]!==_0x6c4d('0x49')){var _0x2fbe1e={};_0x2fbe1e[_0x45e2b9[_0x6c4d('0x34')]]={'$like':'%'+_0x43678b[_0x6c4d('0x3d')]['filter']+'%'};return _0x2fbe1e;}})});}_0x4d7120=_[_0x6c4d('0x48')]({},_0x4d7120,_0x43678b['options']);var _0x56f08d={'where':_0x4d7120['where']};return db['Network']['count'](_0x56f08d)[_0x6c4d('0x31')](function(_0x27545c){_0x3fa56b[_0x6c4d('0x29')]=_0x27545c;if(_0x43678b['query'][_0x6c4d('0x4a')]){_0x4d7120[_0x6c4d('0x4b')]=[{'all':!![]}];}return db[_0x6c4d('0x37')][_0x6c4d('0x4c')](_0x4d7120);})[_0x6c4d('0x31')](function(_0x581336){_0x3fa56b[_0x6c4d('0x4d')]=_0x581336;return _0x3fa56b;})['then'](respondWithFilteredResult(_0x1b0aef,_0x4d7120))['catch'](handleError(_0x1b0aef,null));};exports['show']=function(_0x541c09,_0xa14216){var _0x1ee494={'raw':!![],'where':{'id':_0x541c09[_0x6c4d('0x4e')]['id']}},_0x2ce55b={};_0x2ce55b['model']=_[_0x6c4d('0x3e')](db[_0x6c4d('0x37')]['rawAttributes']);_0x2ce55b[_0x6c4d('0x3d')]=_[_0x6c4d('0x3e')](_0x541c09[_0x6c4d('0x3d')]);_0x2ce55b[_0x6c4d('0x46')]=_[_0x6c4d('0x40')](_0x2ce55b[_0x6c4d('0x3c')],_0x2ce55b[_0x6c4d('0x3d')]);_0x1ee494[_0x6c4d('0x3f')]=_['intersection'](_0x2ce55b[_0x6c4d('0x3c')],qs[_0x6c4d('0x41')](_0x541c09['query'][_0x6c4d('0x41')]));_0x1ee494[_0x6c4d('0x3f')]=_0x1ee494['attributes'][_0x6c4d('0x42')]?_0x1ee494['attributes']:_0x2ce55b[_0x6c4d('0x3c')];if(_0x541c09['query']['includeAll']){_0x1ee494[_0x6c4d('0x4b')]=[{'all':!![]}];}_0x1ee494=_['merge']({},_0x1ee494,_0x541c09[_0x6c4d('0x4f')]);return db[_0x6c4d('0x37')][_0x6c4d('0x50')](_0x1ee494)['then'](handleEntityNotFound(_0xa14216,null))[_0x6c4d('0x31')](respondWithResult(_0xa14216,null))[_0x6c4d('0x24')](handleError(_0xa14216,null));};exports[_0x6c4d('0x51')]=function(_0x5e990f,_0x30271c,_0x3b0846){var _0x1b2129;return db[_0x6c4d('0x52')]['transaction'](function(_0x4d0821){return db[_0x6c4d('0x37')]['create'](_0x5e990f[_0x6c4d('0x53')],{'raw':!![]})['then'](function(_0x48c6cd){_0x1b2129=_0x48c6cd;return db[_0x6c4d('0x37')][_0x6c4d('0x4c')]({'where':{'type':_0x5e990f[_0x6c4d('0x53')][_0x6c4d('0x3a')]},'raw':!![]});})['then'](function(_0x45c0eb){if(_0x1b2129[_0x6c4d('0x3a')][_0x6c4d('0x54')]()==_0x6c4d('0x55')){var _0x3375aa=fs[_0x6c4d('0x56')](path['join'](config[_0x6c4d('0x57')],_0x6c4d('0x58')),_0x6c4d('0x59'));var _0x3c15d0=ejs[_0x6c4d('0x5a')](_0x3375aa,{'networks':_0x45c0eb||[]});fs[_0x6c4d('0x5b')](_0x6c4d('0x5c'),_0x3c15d0);return respondWithRpcPromise('Reload','create',{'module':_0x6c4d('0x5d')});}else if(_0x1b2129[_0x6c4d('0x3a')]['toUpperCase']()==_0x6c4d('0x5e')){var _0x690c5f=fs['readFileSync'](path['join'](config[_0x6c4d('0x57')],_0x6c4d('0x5f')),_0x6c4d('0x59'));var _0x27a06a=ejs[_0x6c4d('0x5a')](_0x690c5f,{'networks':_0x45c0eb||[]});fs[_0x6c4d('0x5b')](_0x6c4d('0x60'),_0x27a06a);return respondWithRpcPromise(_0x6c4d('0x61'),_0x6c4d('0x51'),{'module':_0x6c4d('0x5d')});}else{var _0x2ee181=fs['readFileSync'](path[_0x6c4d('0x62')](config['root'],_0x6c4d('0x63')),_0x6c4d('0x59'));var _0x50739c=ejs['render'](_0x2ee181,{'networks':_0x45c0eb||[]});fs[_0x6c4d('0x5b')](util['format'](_0x6c4d('0x64'),_0x5e990f[_0x6c4d('0x53')][_0x6c4d('0x3a')][_0x6c4d('0x65')]()),_0x50739c);return respondWithRpcPromise(_0x6c4d('0x61'),'create',{'module':_0x6c4d('0x66')});}return null;})[_0x6c4d('0x31')](function(){return _0x1b2129;});})[_0x6c4d('0x31')](respondWithResult(_0x30271c,0xc9))['catch'](handleError(_0x30271c,null));};exports[_0x6c4d('0x30')]=function(_0x223343,_0x16d792,_0x4e4631){var _0x42b177;return db[_0x6c4d('0x52')]['transaction'](function(_0x2dbe77){return db[_0x6c4d('0x37')]['find']({'where':{'id':_0x223343[_0x6c4d('0x4e')]['id']}})[_0x6c4d('0x31')](handleEntityNotFound(_0x16d792,null))[_0x6c4d('0x31')](saveUpdates(_0x223343[_0x6c4d('0x53')],null))['then'](function(_0xd0027a){if(_0xd0027a){_0x42b177=_0xd0027a;return db[_0x6c4d('0x37')]['findAll']({'where':{'type':_0x42b177[_0x6c4d('0x3a')]},'raw':!![]});}return null;})[_0x6c4d('0x31')](function(_0x157a4e){if(_0x42b177[_0x6c4d('0x3a')][_0x6c4d('0x54')]()=='STUN'){var _0x1695a3=fs[_0x6c4d('0x56')](path['join'](config['root'],_0x6c4d('0x58')),_0x6c4d('0x59'));var _0x15f296=ejs['render'](_0x1695a3,{'networks':_0x157a4e||[]});fs['writeFileSync'](_0x6c4d('0x5c'),_0x15f296);return respondWithRpcPromise(_0x6c4d('0x61'),'update',{'module':'res_stun_monitor.so'});}else if(_0x42b177[_0x6c4d('0x3a')]['toUpperCase']()=='TURN'){var _0x36280b=fs[_0x6c4d('0x56')](path['join'](config[_0x6c4d('0x57')],_0x6c4d('0x5f')),_0x6c4d('0x59'));var _0x391864=ejs[_0x6c4d('0x5a')](_0x36280b,{'networks':_0x157a4e||[]});fs[_0x6c4d('0x5b')](_0x6c4d('0x60'),_0x391864);return respondWithRpcPromise(_0x6c4d('0x61'),_0x6c4d('0x30'),{'module':_0x6c4d('0x5d')});}else{var _0x54eae2=fs['readFileSync'](path[_0x6c4d('0x62')](config['root'],_0x6c4d('0x63')),_0x6c4d('0x59'));var _0x4c1b5c=ejs[_0x6c4d('0x5a')](_0x54eae2,{'networks':_0x157a4e||[]});fs[_0x6c4d('0x5b')](util[_0x6c4d('0x67')](_0x6c4d('0x64'),_0x223343[_0x6c4d('0x53')]['type'][_0x6c4d('0x65')]()),_0x4c1b5c);return respondWithRpcPromise(_0x6c4d('0x61'),_0x6c4d('0x30'),{'module':_0x6c4d('0x66')});}return null;})[_0x6c4d('0x31')](function(_0x1224f5){if(_0x1224f5){return _0x42b177;}return null;});})[_0x6c4d('0x31')](respondWithResult(_0x16d792,null))[_0x6c4d('0x24')](handleError(_0x16d792,null));};exports['destroy']=function(_0x3e73c6,_0x1da4f9,_0x191043){var _0x4fe3b5;return db[_0x6c4d('0x37')][_0x6c4d('0x50')]({'where':{'id':_0x3e73c6['params']['id']}})['then'](function(_0x3673d4){_0x4fe3b5=_0x3673d4;return _0x3673d4;})[_0x6c4d('0x31')](handleEntityNotFound(_0x1da4f9,null))['then'](removeEntity(_0x1da4f9,null))[_0x6c4d('0x31')](function(){if(_0x4fe3b5){return db[_0x6c4d('0x37')][_0x6c4d('0x4c')]({'where':{'type':_0x4fe3b5[_0x6c4d('0x3a')]},'raw':!![]});}})['then'](function(_0xea8447){if(_0x4fe3b5[_0x6c4d('0x3a')][_0x6c4d('0x54')]()==_0x6c4d('0x55')){var _0x1779cd=fs['readFileSync'](path[_0x6c4d('0x62')](config[_0x6c4d('0x57')],'server/files/templates/stun_multiple.ejs'),_0x6c4d('0x59'));var _0x3e316c=ejs[_0x6c4d('0x5a')](_0x1779cd,{'networks':_0xea8447||[]});fs[_0x6c4d('0x5b')](_0x6c4d('0x5c'),_0x3e316c);return respondWithRpcPromise(_0x6c4d('0x61'),_0x6c4d('0x32'),{'module':'res_stun_monitor.so'});}else if(_0x4fe3b5[_0x6c4d('0x3a')][_0x6c4d('0x54')]()==_0x6c4d('0x5e')){var _0x248286=fs[_0x6c4d('0x56')](path['join'](config[_0x6c4d('0x57')],_0x6c4d('0x5f')),_0x6c4d('0x59'));var _0x15cad3=ejs['render'](_0x248286,{'networks':_0xea8447||[]});fs[_0x6c4d('0x5b')](_0x6c4d('0x60'),_0x15cad3);return respondWithRpcPromise(_0x6c4d('0x61'),'destroy',{'module':_0x6c4d('0x5d')});}else{var _0xac1717=fs[_0x6c4d('0x56')](path['join'](config['root'],'server/files/templates/network.ejs'),_0x6c4d('0x59'));var _0x317068=ejs[_0x6c4d('0x5a')](_0xac1717,{'networks':_0xea8447||[]});fs[_0x6c4d('0x5b')](util[_0x6c4d('0x67')](_0x6c4d('0x64'),_0x3e73c6[_0x6c4d('0x53')][_0x6c4d('0x3a')]['toLowerCase']()),_0x317068);return respondWithRpcPromise(_0x6c4d('0x61'),'destroy',{'module':'chan_sip.so'});}return null;})[_0x6c4d('0x24')](handleError(_0x1da4f9,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index fae3adc..8732af0 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 _0x7b22=['moment','request-promise','path','rimraf','../../config/environment','exports','define','network','lodash','util','api'];(function(_0x438d47,_0x3b9e59){var _0x175b21=function(_0x422f8d){while(--_0x422f8d){_0x438d47['push'](_0x438d47['shift']());}};_0x175b21(++_0x3b9e59);}(_0x7b22,0x17e));var _0x27b2=function(_0x5c846d,_0x5c02ce){_0x5c846d=_0x5c846d-0x0;var _0xd064e4=_0x7b22[_0x5c846d];return _0xd064e4;};'use strict';var _=require(_0x27b2('0x0'));var util=require(_0x27b2('0x1'));var logger=require('../../config/logger')(_0x27b2('0x2'));var moment=require(_0x27b2('0x3'));var BPromise=require('bluebird');var rp=require(_0x27b2('0x4'));var fs=require('fs');var path=require(_0x27b2('0x5'));var rimraf=require(_0x27b2('0x6'));var config=require(_0x27b2('0x7'));var attributes=require('./network.attributes');module[_0x27b2('0x8')]=function(_0x386b0e,_0x164226){return _0x386b0e[_0x27b2('0x9')]('Network',attributes,{'tableName':_0x27b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66ff=['request-promise','rimraf','../../config/environment','define','network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1529a3,_0x529f63){var _0x1a0d4b=function(_0x6f1058){while(--_0x6f1058){_0x1529a3['push'](_0x1529a3['shift']());}};_0x1a0d4b(++_0x529f63);}(_0x66ff,0x73));var _0xf66f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66ff[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf66f('0x0'));var util=require(_0xf66f('0x1'));var logger=require(_0xf66f('0x2'))(_0xf66f('0x3'));var moment=require(_0xf66f('0x4'));var BPromise=require(_0xf66f('0x5'));var rp=require(_0xf66f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf66f('0x7'));var config=require(_0xf66f('0x8'));var attributes=require('./network.attributes');module['exports']=function(_0x58e441,_0x3eb340){return _0x58e441[_0xf66f('0x9')]('Network',attributes,{'tableName':_0xf66f('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 d3525ed..9f940ac 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 _0x39c9=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x23e999,_0x11297a){var _0xedb644=function(_0xb37c91){while(--_0xb37c91){_0x23e999['push'](_0x23e999['shift']());}};_0xedb644(++_0x11297a);}(_0x39c9,0x1c5));var _0x939c=function(_0x41d9a8,_0x386c27){_0x41d9a8=_0x41d9a8-0x0;var _0x146498=_0x39c9[_0x41d9a8];return _0x146498;};'use strict';var _=require(_0x939c('0x0'));var util=require(_0x939c('0x1'));var moment=require(_0x939c('0x2'));var BPromise=require(_0x939c('0x3'));var rs=require(_0x939c('0x4'));var fs=require('fs');var Redis=require(_0x939c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x939c('0x6'));var logger=require('../../config/logger')(_0x939c('0x7'));var config=require(_0x939c('0x8'));var jayson=require(_0x939c('0x9'));var client=jayson[_0x939c('0xa')][_0x939c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x81b6ad,_0x43089c,_0x1ea9f0){return new BPromise(function(_0x23a11b,_0x21ed1b){return client['request'](_0x81b6ad,_0x1ea9f0)[_0x939c('0xc')](function(_0x334cb3){logger[_0x939c('0xd')](_0x939c('0xe'),_0x43089c,'request\x20sent');logger[_0x939c('0xf')](_0x939c('0x10'),_0x43089c,_0x939c('0x11'),JSON[_0x939c('0x12')](_0x334cb3));if(_0x334cb3['error']){if(_0x334cb3[_0x939c('0x13')][_0x939c('0x14')]===0x1f4){logger[_0x939c('0x13')](_0x939c('0xe'),_0x43089c,_0x334cb3[_0x939c('0x13')][_0x939c('0x15')]);return _0x21ed1b(_0x334cb3[_0x939c('0x13')][_0x939c('0x15')]);}logger[_0x939c('0x13')](_0x939c('0xe'),_0x43089c,_0x334cb3['error'][_0x939c('0x15')]);return _0x23a11b(_0x334cb3['error'][_0x939c('0x15')]);}else{logger['info'](_0x939c('0xe'),_0x43089c,_0x939c('0x11'));_0x23a11b(_0x334cb3[_0x939c('0x16')][_0x939c('0x15')]);}})[_0x939c('0x17')](function(_0x5d509b){logger['error'](_0x939c('0xe'),_0x43089c,_0x5d509b);_0x21ed1b(_0x5d509b);});});} \ No newline at end of file +var _0xc627=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils'];(function(_0x9d425b,_0x4dc33f){var _0x442621=function(_0x32e1ab){while(--_0x32e1ab){_0x9d425b['push'](_0x9d425b['shift']());}};_0x442621(++_0x4dc33f);}(_0xc627,0x126));var _0x7c62=function(_0x368f2b,_0xc912a9){_0x368f2b=_0x368f2b-0x0;var _0x1bb808=_0xc627[_0x368f2b];return _0x1bb808;};'use strict';var _=require(_0x7c62('0x0'));var util=require('util');var moment=require(_0x7c62('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c62('0x2'));var db=require(_0x7c62('0x3'))['db'];var utils=require(_0x7c62('0x4'));var logger=require(_0x7c62('0x5'))(_0x7c62('0x6'));var config=require(_0x7c62('0x7'));var jayson=require(_0x7c62('0x8'));var client=jayson[_0x7c62('0x9')][_0x7c62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c4c5f,_0x9ded2e,_0x852951){return new BPromise(function(_0x724e74,_0x41535d){return client['request'](_0x1c4c5f,_0x852951)[_0x7c62('0xb')](function(_0x81f640){logger[_0x7c62('0xc')](_0x7c62('0xd'),_0x9ded2e,'request\x20sent');logger[_0x7c62('0xe')](_0x7c62('0xf'),_0x9ded2e,'request\x20sent',JSON[_0x7c62('0x10')](_0x81f640));if(_0x81f640[_0x7c62('0x11')]){if(_0x81f640[_0x7c62('0x11')][_0x7c62('0x12')]===0x1f4){logger[_0x7c62('0x11')](_0x7c62('0xd'),_0x9ded2e,_0x81f640['error'][_0x7c62('0x13')]);return _0x41535d(_0x81f640[_0x7c62('0x11')][_0x7c62('0x13')]);}logger['error']('Network,\x20%s,\x20%s',_0x9ded2e,_0x81f640[_0x7c62('0x11')][_0x7c62('0x13')]);return _0x724e74(_0x81f640['error'][_0x7c62('0x13')]);}else{logger[_0x7c62('0xc')]('Network,\x20%s,\x20%s',_0x9ded2e,_0x7c62('0x14'));_0x724e74(_0x81f640[_0x7c62('0x15')][_0x7c62('0x13')]);}})[_0x7c62('0x16')](function(_0x4cd9d5){logger[_0x7c62('0x11')]('Network,\x20%s,\x20%s',_0x9ded2e,_0x4cd9d5);_0x41535d(_0x4cd9d5);});});} \ No newline at end of file diff --git a/server/api/notification/index.js b/server/api/notification/index.js index 8bd7779..6d85dfd 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 _0xf2ee=['./notification.controller','post','isAuthenticated','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x4968ab,_0x484549){var _0x34a589=function(_0xa21184){while(--_0xa21184){_0x4968ab['push'](_0x4968ab['shift']());}};_0x34a589(++_0x484549);}(_0xf2ee,0x1a6));var _0xef2e=function(_0x2798a9,_0x5649ca){_0x2798a9=_0x2798a9-0x0;var _0x5e4a3c=_0xf2ee[_0x2798a9];return _0x5e4a3c;};'use strict';var multer=require(_0xef2e('0x0'));var util=require(_0xef2e('0x1'));var path=require(_0xef2e('0x2'));var timeout=require(_0xef2e('0x3'));var express=require(_0xef2e('0x4'));var router=express['Router']();var auth=require(_0xef2e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xef2e('0x6'));var controller=require(_0xef2e('0x7'));router[_0xef2e('0x8')]('/',auth[_0xef2e('0x9')](),controller['sendNotification']);module[_0xef2e('0xa')]=router; \ No newline at end of file +var _0x2df6=['../../components/interaction/service','../../config/environment','./notification.controller','post','isAuthenticated','sendNotification','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3a368d,_0x1fe235){var _0xf8a17e=function(_0x327e1e){while(--_0x327e1e){_0x3a368d['push'](_0x3a368d['shift']());}};_0xf8a17e(++_0x1fe235);}(_0x2df6,0xb0));var _0x62df=function(_0x5b8723,_0x171c83){_0x5b8723=_0x5b8723-0x0;var _0x44d58e=_0x2df6[_0x5b8723];return _0x44d58e;};'use strict';var multer=require(_0x62df('0x0'));var util=require(_0x62df('0x1'));var path=require(_0x62df('0x2'));var timeout=require(_0x62df('0x3'));var express=require(_0x62df('0x4'));var router=express[_0x62df('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x62df('0x6'));var config=require(_0x62df('0x7'));var controller=require(_0x62df('0x8'));router[_0x62df('0x9')]('/',auth[_0x62df('0xa')](),controller[_0x62df('0xb')]);module[_0x62df('0xc')]=router; \ No newline at end of file diff --git a/server/api/notification/notification.attributes.js b/server/api/notification/notification.attributes.js index 5375f3f..8c88267 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 _0xc948=['BOOLEAN','sequelize','exports','STRING','TEXT'];(function(_0x320e1f,_0x1ada5e){var _0x1c7ae2=function(_0x13e28c){while(--_0x13e28c){_0x320e1f['push'](_0x320e1f['shift']());}};_0x1c7ae2(++_0x1ada5e);}(_0xc948,0x1aa));var _0x8c94=function(_0xff471b,_0x190835){_0xff471b=_0xff471b-0x0;var _0x2b0d1b=_0xc948[_0xff471b];return _0x2b0d1b;};'use strict';var Sequelize=require(_0x8c94('0x0'));module[_0x8c94('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x8c94('0x2')]},'recipientsId':{'type':Sequelize[_0x8c94('0x3')]},'recipientsDescription':{'type':Sequelize[_0x8c94('0x2')]},'beep':{'type':Sequelize[_0x8c94('0x4')]}}; \ No newline at end of file +var _0x73d6=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x73d6,0x172));var _0x673d=function(_0xa72a90,_0x3d2ff5){_0xa72a90=_0xa72a90-0x0;var _0x264a45=_0x73d6[_0xa72a90];return _0x264a45;};'use strict';var Sequelize=require(_0x673d('0x0'));module[_0x673d('0x1')]={'body':{'type':Sequelize[_0x673d('0x2')]},'senderName':{'type':Sequelize[_0x673d('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x673d('0x3')]},'beep':{'type':Sequelize[_0x673d('0x4')]}}; \ No newline at end of file diff --git a/server/api/notification/notification.controller.js b/server/api/notification/notification.controller.js index 543c755..1b07361 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 _0x7480=['destroy','error','name','send','sendNotification','text','body','hasOwnProperty','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','ValidationError','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','voicequeue','whatsappqueue','team','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','sequelize','Notification','forEach','recipient','emit','notification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','replace','all','flatten','map','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','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/environment','redis','defaults','localhost','socket.io-emitter','end','status','json','offset','limit','Content-Range','reject','update','then'];(function(_0x4036b6,_0x5adaf2){var _0x358588=function(_0x1e817e){while(--_0x1e817e){_0x4036b6['push'](_0x4036b6['shift']());}};_0x358588(++_0x5adaf2);}(_0x7480,0x94));var _0x0748=function(_0x1b00b8,_0x52cef9){_0x1b00b8=_0x1b00b8-0x0;var _0x11248a=_0x7480[_0x1b00b8];return _0x11248a;};'use strict';var pdf=require(_0x0748('0x0'));var emlformat=require(_0x0748('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0748('0x2'));var jsonpatch=require(_0x0748('0x3'));var rp=require(_0x0748('0x4'));var moment=require(_0x0748('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0748('0x6'));var util=require('util');var path=require(_0x0748('0x7'));var sox=require(_0x0748('0x8'));var csv=require(_0x0748('0x9'));var ejs=require(_0x0748('0xa'));var fs=require('fs');var _=require(_0x0748('0xb'));var squel=require(_0x0748('0xc'));var crypto=require(_0x0748('0xd'));var jsforce=require(_0x0748('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0748('0x9'));var querystring=require(_0x0748('0xf'));var Papa=require(_0x0748('0x10'));var Redis=require(_0x0748('0x11'));var authService=require(_0x0748('0x12'));var qs=require(_0x0748('0x13'));var as=require(_0x0748('0x14'));var hardwareService=require(_0x0748('0x15'));var logger=require(_0x0748('0x16'))(_0x0748('0x17'));var utils=require('../../config/utils');var config=require(_0x0748('0x18'));var db=require('../../mysqldb')['db'];config[_0x0748('0x19')]=_[_0x0748('0x1a')](config[_0x0748('0x19')],{'host':_0x0748('0x1b'),'port':0x18eb});var socket=require(_0x0748('0x1c'))(new Redis(config[_0x0748('0x19')]));require('./notification.socket')['register'](socket);function respondWithStatusCode(_0x47cb28,_0xe177cd){_0xe177cd=_0xe177cd||0xcc;return function(_0x1eb70c){if(_0x1eb70c){return _0x47cb28['sendStatus'](_0xe177cd);}return _0x47cb28['status'](_0xe177cd)[_0x0748('0x1d')]();};}function respondWithResult(_0x150ec7,_0x511eb5){_0x511eb5=_0x511eb5||0xc8;return function(_0x51ac85){if(_0x51ac85){return _0x150ec7[_0x0748('0x1e')](_0x511eb5)[_0x0748('0x1f')](_0x51ac85);}};}function respondWithFilteredResult(_0x761441,_0x2630be){return function(_0x41afc4){if(_0x41afc4){var _0x4384ae=_0x41afc4['count'],_0x34684d=_0x2630be['offset'],_0x1648aa=_0x2630be[_0x0748('0x20')]+_0x2630be[_0x0748('0x21')],_0x552997;if(_0x1648aa>=_0x4384ae){_0x1648aa=_0x4384ae;_0x552997=0xc8;}else{_0x552997=0xce;}_0x761441['status'](_0x552997);return _0x761441['set'](_0x0748('0x22'),_0x34684d+'-'+_0x1648aa+'/'+_0x4384ae)[_0x0748('0x1f')](_0x41afc4);}return null;};}function patchUpdates(_0x4cec35){return function(_0x4dbbf4){try{jsonpatch['apply'](_0x4dbbf4,_0x4cec35,!![]);}catch(_0x35f552){return BPromise[_0x0748('0x23')](_0x35f552);}return _0x4dbbf4['save']();};}function saveUpdates(_0x484953,_0x5f5897){return function(_0x4bb776){if(_0x4bb776){return _0x4bb776[_0x0748('0x24')](_0x484953)[_0x0748('0x25')](function(_0x14cfdf){return _0x14cfdf;});}return null;};}function removeEntity(_0x551292,_0x2db83a){return function(_0x406dcc){if(_0x406dcc){return _0x406dcc[_0x0748('0x26')]()[_0x0748('0x25')](function(){_0x551292['status'](0xcc)[_0x0748('0x1d')]();});}};}function handleEntityNotFound(_0x1adf05,_0x511ee9){return function(_0x198b5a){if(!_0x198b5a){_0x1adf05['sendStatus'](0x194);}return _0x198b5a;};}function handleError(_0x3551bb,_0x1d1037){_0x1d1037=_0x1d1037||0x1f4;return function(_0x2d6c82){logger[_0x0748('0x27')](_0x2d6c82['stack']);if(_0x2d6c82['name']){delete _0x2d6c82[_0x0748('0x28')];}_0x3551bb[_0x0748('0x1e')](_0x1d1037)[_0x0748('0x29')](_0x2d6c82);};}exports[_0x0748('0x2a')]=function(_0x2636c4,_0x357ba7,_0x10fb92){if(!_0x2636c4['body']['hasOwnProperty'](_0x0748('0x2b'))&&!_0x2636c4[_0x0748('0x2c')][_0x0748('0x2d')]('TemplateId')){throw new db[(_0x0748('0x2e'))]['ValidationError'](_0x0748('0x2f'));}else{if(_0x2636c4[_0x0748('0x2c')][_0x0748('0x2d')](_0x0748('0x30'))&&!_0x2636c4[_0x0748('0x2c')][_0x0748('0x2d')](_0x0748('0x31'))){throw new db[(_0x0748('0x2e'))][(_0x0748('0x32'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x2636c4[_0x0748('0x2c')][_0x0748('0x2d')](_0x0748('0x33'))){throw new db[(_0x0748('0x2e'))]['ValidationError'](_0x0748('0x34'));}else{try{var _0x3f5b9b=JSON[_0x0748('0x35')](_0x2636c4[_0x0748('0x2c')]['recipients']);}catch(_0x1fdf83){logger[_0x0748('0x27')](_0x1fdf83);throw new db[(_0x0748('0x2e'))][(_0x0748('0x32'))](_0x0748('0x36'));}var _0x81d104=[_0x0748('0x37'),_0x0748('0x38'),_0x0748('0x39'),'openchannelqueue','smsqueue',_0x0748('0x3a'),_0x0748('0x3b'),_0x0748('0x3c'),'user'];if(_['some'](_0x3f5b9b,function(_0x360b23){return!_[_0x0748('0x3d')](_0x81d104,_0x360b23[_0x0748('0x3e')][_0x0748('0x3f')]());})){throw new db[(_0x0748('0x2e'))]['ValidationError'](_0x0748('0x40'));}}}var _0x271451={};_0x271451[_0x0748('0x41')]=_0x2636c4[_0x0748('0x2c')]['hasOwnProperty'](_0x0748('0x41'))?_0x2636c4[_0x0748('0x2c')][_0x0748('0x41')]:_0x2636c4[_0x0748('0x42')]['fullname'];_0x271451[_0x0748('0x43')]=_[_0x0748('0x44')](_0x2636c4[_0x0748('0x2c')][_0x0748('0x43')])?null:_0x2636c4[_0x0748('0x2c')][_0x0748('0x43')];_0x271451[_0x0748('0x45')]=_0x2636c4['body'][_0x0748('0x45')]||![];_0x271451[_0x0748('0x46')]=_0x2636c4[_0x0748('0x42')]['id'];return getContent(_0x2636c4[_0x0748('0x2c')])[_0x0748('0x25')](function(_0x455e34){_0x271451[_0x0748('0x2c')]=_0x455e34;return getRecipients(_0x3f5b9b);})[_0x0748('0x25')](function(_0x3827a9){_0x271451[_0x0748('0x47')]=_[_0x0748('0x48')](_0x3827a9)['join'](',');return db[_0x0748('0x49')]['transaction'](function(_0x1e789d){return db[_0x0748('0x4a')]['create'](_0x271451,{'raw':!![],'transaction':_0x1e789d})[_0x0748('0x25')](function(_0x1c11f2){var _0x1e5191={'sender':_0x271451[_0x0748('0x41')],'description':_0x271451['recipientsDescription'],'content':_0x271451[_0x0748('0x2c')],'beep':_0x271451[_0x0748('0x45')]};_0x3827a9[_0x0748('0x4b')](function(_0x122243){_0x1e5191[_0x0748('0x4c')]=_0x122243;socket[_0x0748('0x4d')](_0x0748('0x4e'),_0x1e5191);});return _0x1c11f2;});});})[_0x0748('0x25')](respondWithResult(_0x357ba7,0xc9))[_0x0748('0x4f')](handleError(_0x357ba7,null));};function getContent(_0x2497f4){return new BPromise(function(_0x541450,_0x1e2914){if(_0x2497f4[_0x0748('0x2b')]){_0x541450(_0x2497f4[_0x0748('0x2b')]);return;}return db[_0x0748('0x50')][_0x0748('0x51')]({'attributes':[_0x0748('0x52')],'where':{'id':_0x2497f4[_0x0748('0x30')]},'raw':!![]})[_0x0748('0x25')](function(_0x4f7791){if(!_0x4f7791)throw new db[(_0x0748('0x2e'))][(_0x0748('0x32'))](_0x0748('0x53'));var _0x17659c=Mustache[_0x0748('0x54')](_0x4f7791['html'],_0x2497f4[_0x0748('0x31')]);_0x541450(_0x17659c);})['catch'](function(_0x5597cd){_0x1e2914(_0x5597cd);});});}function getRecipients(_0x2305ea){return new BPromise(function(_0x4d7d64,_0x555bd9){var _0x5a396a=[];var _0x255544=[];_0x2305ea[_0x0748('0x4b')](function(_0x1a8eee){var _0x2f9843=_[_0x0748('0x55')](_0x1a8eee[_0x0748('0x3e')]['toLowerCase']());if(_0x2f9843===_0x0748('0x56')){_0x5a396a=_[_0x0748('0x57')](_0x5a396a,_0x1a8eee[_0x0748('0x58')]);}else{if(_['includes'](_0x2f9843,'queue'))_0x2f9843=_0x2f9843[_0x0748('0x59')]('queue','Queue');_0x1a8eee[_0x0748('0x58')][_0x0748('0x4b')](function(_0x2d3cb2){_0x255544['push'](getAgents(_0x2f9843,_0x2d3cb2));});}});return BPromise[_0x0748('0x5a')](_0x255544)[_0x0748('0x25')](function(_0x21f856){_0x5a396a=_[_0x0748('0x57')](_0x5a396a,_[_0x0748('0x5b')](_0x21f856));_0x4d7d64(_0x5a396a);})[_0x0748('0x4f')](function(_0xabe2d2){_0x555bd9(_0xabe2d2);});});}function getAgents(_0x5a3220,_0x1a8e1a){return new BPromise(function(_0x480da8,_0x16a901){return db[_0x5a3220]['findOne']({'where':{'id':_0x1a8e1a}})[_0x0748('0x25')](function(_0x5c3f76){return _0x5c3f76['getAgents']({'attributes':['id'],'raw':!![]})['then'](function(_0x2a21cf){var _0x3cf02e=_[_0x0748('0x5c')](_0x2a21cf,'id');_0x480da8(_0x3cf02e);});})[_0x0748('0x4f')](function(_0x5e6781){_0x16a901(_0x5e6781);});});} \ No newline at end of file +var _0xbef9=['Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','join','sequelize','transaction','create','recipient','emit','notification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','view','forEach','startCase','User','union','ids','queue','Queue','push','all','flatten','findOne','getAgents','map','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./notification.socket','register','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','then','destroy','stack','name','send','sendNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients'];(function(_0x1bcb17,_0x492d13){var _0x21432d=function(_0x11b25a){while(--_0x11b25a){_0x1bcb17['push'](_0x1bcb17['shift']());}};_0x21432d(++_0x492d13);}(_0xbef9,0x1b7));var _0x9bef=function(_0x471a31,_0x2bf98e){_0x471a31=_0x471a31-0x0;var _0x4aa01e=_0xbef9[_0x471a31];return _0x4aa01e;};'use strict';var pdf=require(_0x9bef('0x0'));var emlformat=require(_0x9bef('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9bef('0x2'));var jsonpatch=require(_0x9bef('0x3'));var rp=require(_0x9bef('0x4'));var moment=require('moment');var BPromise=require(_0x9bef('0x5'));var Mustache=require(_0x9bef('0x6'));var util=require(_0x9bef('0x7'));var path=require(_0x9bef('0x8'));var sox=require(_0x9bef('0x9'));var csv=require(_0x9bef('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9bef('0xb'));var crypto=require(_0x9bef('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9bef('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9bef('0xe'));var Redis=require('ioredis');var authService=require(_0x9bef('0xf'));var qs=require(_0x9bef('0x10'));var as=require(_0x9bef('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9bef('0x12'));var utils=require(_0x9bef('0x13'));var config=require('../../config/environment');var db=require(_0x9bef('0x14'))['db'];config[_0x9bef('0x15')]=_[_0x9bef('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9bef('0x17'))(new Redis(config[_0x9bef('0x15')]));require(_0x9bef('0x18'))[_0x9bef('0x19')](socket);function respondWithStatusCode(_0x5dff5c,_0x200ab9){_0x200ab9=_0x200ab9||0xcc;return function(_0x5a6043){if(_0x5a6043){return _0x5dff5c[_0x9bef('0x1a')](_0x200ab9);}return _0x5dff5c[_0x9bef('0x1b')](_0x200ab9)[_0x9bef('0x1c')]();};}function respondWithResult(_0x21cf82,_0x6de056){_0x6de056=_0x6de056||0xc8;return function(_0x2ca774){if(_0x2ca774){return _0x21cf82[_0x9bef('0x1b')](_0x6de056)['json'](_0x2ca774);}};}function respondWithFilteredResult(_0x2f7c3b,_0xc00e19){return function(_0x1fce76){if(_0x1fce76){var _0x3b62bd=_0x1fce76[_0x9bef('0x1d')],_0x2f0a61=_0xc00e19[_0x9bef('0x1e')],_0x107a03=_0xc00e19['offset']+_0xc00e19['limit'],_0x2532bf;if(_0x107a03>=_0x3b62bd){_0x107a03=_0x3b62bd;_0x2532bf=0xc8;}else{_0x2532bf=0xce;}_0x2f7c3b[_0x9bef('0x1b')](_0x2532bf);return _0x2f7c3b[_0x9bef('0x1f')](_0x9bef('0x20'),_0x2f0a61+'-'+_0x107a03+'/'+_0x3b62bd)[_0x9bef('0x21')](_0x1fce76);}return null;};}function patchUpdates(_0x5c26bc){return function(_0x2b408a){try{jsonpatch[_0x9bef('0x22')](_0x2b408a,_0x5c26bc,!![]);}catch(_0x3f5036){return BPromise[_0x9bef('0x23')](_0x3f5036);}return _0x2b408a['save']();};}function saveUpdates(_0x909204,_0x582bfc){return function(_0x559723){if(_0x559723){return _0x559723['update'](_0x909204)[_0x9bef('0x24')](function(_0x2f1e84){return _0x2f1e84;});}return null;};}function removeEntity(_0x582a0f,_0xb6c6fd){return function(_0x773430){if(_0x773430){return _0x773430[_0x9bef('0x25')]()[_0x9bef('0x24')](function(){_0x582a0f[_0x9bef('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fce3e,_0x1d9a8f){return function(_0x279831){if(!_0x279831){_0x4fce3e[_0x9bef('0x1a')](0x194);}return _0x279831;};}function handleError(_0x57a894,_0x4cdeb9){_0x4cdeb9=_0x4cdeb9||0x1f4;return function(_0x24025f){logger['error'](_0x24025f[_0x9bef('0x26')]);if(_0x24025f[_0x9bef('0x27')]){delete _0x24025f[_0x9bef('0x27')];}_0x57a894[_0x9bef('0x1b')](_0x4cdeb9)[_0x9bef('0x28')](_0x24025f);};}exports[_0x9bef('0x29')]=function(_0x41e169,_0x89cf83,_0x4539fa){if(!_0x41e169[_0x9bef('0x2a')][_0x9bef('0x2b')](_0x9bef('0x2c'))&&!_0x41e169[_0x9bef('0x2a')][_0x9bef('0x2b')](_0x9bef('0x2d'))){throw new db[(_0x9bef('0x2e'))][(_0x9bef('0x2f'))](_0x9bef('0x30'));}else{if(_0x41e169[_0x9bef('0x2a')]['hasOwnProperty'](_0x9bef('0x2d'))&&!_0x41e169[_0x9bef('0x2a')][_0x9bef('0x2b')]('view')){throw new db['Sequelize'][(_0x9bef('0x2f'))](_0x9bef('0x31'));}if(!_0x41e169['body'][_0x9bef('0x2b')](_0x9bef('0x32'))){throw new db['Sequelize'][(_0x9bef('0x2f'))](_0x9bef('0x33'));}else{try{var _0x3e886d=JSON[_0x9bef('0x34')](_0x41e169[_0x9bef('0x2a')]['recipients']);}catch(_0x928265){logger['error'](_0x928265);throw new db[(_0x9bef('0x2e'))][(_0x9bef('0x2f'))](_0x9bef('0x35'));}var _0x131177=[_0x9bef('0x36'),_0x9bef('0x37'),_0x9bef('0x38'),_0x9bef('0x39'),'smsqueue','voicequeue',_0x9bef('0x3a'),_0x9bef('0x3b'),_0x9bef('0x3c')];if(_[_0x9bef('0x3d')](_0x3e886d,function(_0x5b7165){return!_[_0x9bef('0x3e')](_0x131177,_0x5b7165[_0x9bef('0x3f')][_0x9bef('0x40')]());})){throw new db['Sequelize'][(_0x9bef('0x2f'))](_0x9bef('0x41'));}}}var _0xa25749={};_0xa25749[_0x9bef('0x42')]=_0x41e169[_0x9bef('0x2a')][_0x9bef('0x2b')](_0x9bef('0x42'))?_0x41e169['body'][_0x9bef('0x42')]:_0x41e169['user'][_0x9bef('0x43')];_0xa25749[_0x9bef('0x44')]=_['isEmpty'](_0x41e169['body'][_0x9bef('0x44')])?null:_0x41e169[_0x9bef('0x2a')][_0x9bef('0x44')];_0xa25749[_0x9bef('0x45')]=_0x41e169[_0x9bef('0x2a')][_0x9bef('0x45')]||![];_0xa25749[_0x9bef('0x46')]=_0x41e169[_0x9bef('0x3c')]['id'];return getContent(_0x41e169[_0x9bef('0x2a')])[_0x9bef('0x24')](function(_0x58d061){_0xa25749[_0x9bef('0x2a')]=_0x58d061;return getRecipients(_0x3e886d);})['then'](function(_0x268843){_0xa25749[_0x9bef('0x47')]=_['sortBy'](_0x268843)[_0x9bef('0x48')](',');return db[_0x9bef('0x49')][_0x9bef('0x4a')](function(_0x5fb676){return db['Notification'][_0x9bef('0x4b')](_0xa25749,{'raw':!![],'transaction':_0x5fb676})[_0x9bef('0x24')](function(_0x24a0fa){var _0x22d28c={'sender':_0xa25749[_0x9bef('0x42')],'description':_0xa25749[_0x9bef('0x44')],'content':_0xa25749['body'],'beep':_0xa25749[_0x9bef('0x45')]};_0x268843['forEach'](function(_0x362af0){_0x22d28c[_0x9bef('0x4c')]=_0x362af0;socket[_0x9bef('0x4d')](_0x9bef('0x4e'),_0x22d28c);});return _0x24a0fa;});});})[_0x9bef('0x24')](respondWithResult(_0x89cf83,0xc9))[_0x9bef('0x4f')](handleError(_0x89cf83,null));};function getContent(_0x5f5424){return new BPromise(function(_0x151436,_0x2d9670){if(_0x5f5424[_0x9bef('0x2c')]){_0x151436(_0x5f5424[_0x9bef('0x2c')]);return;}return db[_0x9bef('0x50')]['findOne']({'attributes':[_0x9bef('0x51')],'where':{'id':_0x5f5424[_0x9bef('0x2d')]},'raw':!![]})['then'](function(_0x159a3f){if(!_0x159a3f)throw new db[(_0x9bef('0x2e'))][(_0x9bef('0x2f'))](_0x9bef('0x52'));var _0x70acf8=Mustache[_0x9bef('0x53')](_0x159a3f[_0x9bef('0x51')],_0x5f5424[_0x9bef('0x54')]);_0x151436(_0x70acf8);})[_0x9bef('0x4f')](function(_0x3f7248){_0x2d9670(_0x3f7248);});});}function getRecipients(_0x4ace99){return new BPromise(function(_0x1d4bd5,_0x42c7f0){var _0x352f86=[];var _0x2e3ab1=[];_0x4ace99[_0x9bef('0x55')](function(_0x51ca40){var _0x5b84b2=_[_0x9bef('0x56')](_0x51ca40['model']['toLowerCase']());if(_0x5b84b2===_0x9bef('0x57')){_0x352f86=_[_0x9bef('0x58')](_0x352f86,_0x51ca40[_0x9bef('0x59')]);}else{if(_[_0x9bef('0x3e')](_0x5b84b2,_0x9bef('0x5a')))_0x5b84b2=_0x5b84b2['replace'](_0x9bef('0x5a'),_0x9bef('0x5b'));_0x51ca40[_0x9bef('0x59')][_0x9bef('0x55')](function(_0x304072){_0x2e3ab1[_0x9bef('0x5c')](getAgents(_0x5b84b2,_0x304072));});}});return BPromise[_0x9bef('0x5d')](_0x2e3ab1)[_0x9bef('0x24')](function(_0x47149e){_0x352f86=_[_0x9bef('0x58')](_0x352f86,_[_0x9bef('0x5e')](_0x47149e));_0x1d4bd5(_0x352f86);})['catch'](function(_0x36af74){_0x42c7f0(_0x36af74);});});}function getAgents(_0x1e9dfd,_0x371e5c){return new BPromise(function(_0x56ce01,_0xfcafc4){return db[_0x1e9dfd][_0x9bef('0x5f')]({'where':{'id':_0x371e5c}})[_0x9bef('0x24')](function(_0x542de9){return _0x542de9[_0x9bef('0x60')]({'attributes':['id'],'raw':!![]})['then'](function(_0x44ee81){var _0x3d9bac=_[_0x9bef('0x61')](_0x44ee81,'id');_0x56ce01(_0x3d9bac);});})['catch'](function(_0x1f6c9a){_0xfcafc4(_0x1f6c9a);});});} \ No newline at end of file diff --git a/server/api/notification/notification.events.js b/server/api/notification/notification.events.js index 36d7160..c305f1e 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 _0x757a=['../../mysqldb','Notification','remove','emit','hasOwnProperty','hook'];(function(_0x176dae,_0xe1b203){var _0x2fc794=function(_0x499717){while(--_0x499717){_0x176dae['push'](_0x176dae['shift']());}};_0x2fc794(++_0xe1b203);}(_0x757a,0xde));var _0xa757=function(_0x4683f8,_0x2db7bb){_0x4683f8=_0x4683f8-0x0;var _0x38dcb3=_0x757a[_0x4683f8];return _0x38dcb3;};'use strict';var EventEmitter=require('events');var Notification=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var NotificationEvents=new EventEmitter();NotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa757('0x2')};function emitEvent(_0x1721c6){return function(_0x1c2932,_0x453d07,_0x32630d){NotificationEvents[_0xa757('0x3')](_0x1721c6+':'+_0x1c2932['id'],_0x1c2932);NotificationEvents['emit'](_0x1721c6,_0x1c2932);_0x32630d(null);};}for(var e in events){if(events[_0xa757('0x4')](e)){var event=events[e];Notification[_0xa757('0x5')](e,emitEvent(event));}}module['exports']=NotificationEvents; \ No newline at end of file +var _0xdb28=['Notification','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x39b0c4,_0x4f59c1){var _0x1af9c1=function(_0xea49c2){while(--_0xea49c2){_0x39b0c4['push'](_0x39b0c4['shift']());}};_0x1af9c1(++_0x4f59c1);}(_0xdb28,0x106));var _0x8db2=function(_0x47459b,_0x18e5ce){_0x47459b=_0x47459b-0x0;var _0x3b83ab=_0xdb28[_0x47459b];return _0x3b83ab;};'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 bd9dcd4..acab81d 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 _0x09f2=['moment','bluebird','path','rimraf','../../config/environment','./notification.attributes','Notification','notifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x8663dc,_0x28b7ad){var _0x4440d7=function(_0x406bc0){while(--_0x406bc0){_0x8663dc['push'](_0x8663dc['shift']());}};_0x4440d7(++_0x28b7ad);}(_0x09f2,0xf3));var _0x209f=function(_0x41047d,_0x335179){_0x41047d=_0x41047d-0x0;var _0x50148b=_0x09f2[_0x41047d];return _0x50148b;};'use strict';var _=require(_0x209f('0x0'));var util=require(_0x209f('0x1'));var logger=require(_0x209f('0x2'))(_0x209f('0x3'));var moment=require(_0x209f('0x4'));var BPromise=require(_0x209f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x209f('0x6'));var rimraf=require(_0x209f('0x7'));var config=require(_0x209f('0x8'));var attributes=require(_0x209f('0x9'));module['exports']=function(_0x5b9d27,_0xebeffe){return _0x5b9d27['define'](_0x209f('0xa'),attributes,{'tableName':_0x209f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x209f('0xc')});}; \ No newline at end of file +var _0xa3a7=['define','notifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','rimraf','exports'];(function(_0x33dbe5,_0x5e532f){var _0x1438bb=function(_0x40d3c6){while(--_0x40d3c6){_0x33dbe5['push'](_0x33dbe5['shift']());}};_0x1438bb(++_0x5e532f);}(_0xa3a7,0x175));var _0x7a3a=function(_0x4d7d43,_0x5ecccb){_0x4d7d43=_0x4d7d43-0x0;var _0x9e0feb=_0xa3a7[_0x4d7d43];return _0x9e0feb;};'use strict';var _=require(_0x7a3a('0x0'));var util=require(_0x7a3a('0x1'));var logger=require(_0x7a3a('0x2'))(_0x7a3a('0x3'));var moment=require(_0x7a3a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7a3a('0x5'));var config=require('../../config/environment');var attributes=require('./notification.attributes');module[_0x7a3a('0x6')]=function(_0x3130f8,_0x163bea){return _0x3130f8[_0x7a3a('0x7')]('Notification',attributes,{'tableName':_0x7a3a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7a3a('0x9')});}; \ No newline at end of file diff --git a/server/api/notification/notification.rpc.js b/server/api/notification/notification.rpc.js index 2b1219a..af979fb 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 _0x6120=['then','debug','Notification,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Notification,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./notification.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6120,0xad));var _0x0612=function(_0x38e6f5,_0x119f80){_0x38e6f5=_0x38e6f5-0x0;var _0x559763=_0x6120[_0x38e6f5];return _0x559763;};'use strict';var _=require(_0x0612('0x0'));var util=require(_0x0612('0x1'));var moment=require(_0x0612('0x2'));var BPromise=require(_0x0612('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0612('0x4'));var db=require(_0x0612('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0612('0x6'))(_0x0612('0x7'));var config=require('../../config/environment');var jayson=require(_0x0612('0x8'));var client=jayson[_0x0612('0x9')][_0x0612('0xa')]({'port':0x232a});config[_0x0612('0xb')]=_[_0x0612('0xc')](config[_0x0612('0xb')],{'host':_0x0612('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0612('0xb')]));require(_0x0612('0xe'))[_0x0612('0xf')](socket);function respondWithRpcPromise(_0x29fef6,_0x52edcd,_0x4c9a26){return new BPromise(function(_0xb4a213,_0xbfd80e){return client['request'](_0x29fef6,_0x4c9a26)[_0x0612('0x10')](function(_0x2ded70){logger['info']('Notification,\x20%s,\x20%s',_0x52edcd,'request\x20sent');logger[_0x0612('0x11')](_0x0612('0x12'),_0x52edcd,_0x0612('0x13'),JSON['stringify'](_0x2ded70));if(_0x2ded70[_0x0612('0x14')]){if(_0x2ded70[_0x0612('0x14')][_0x0612('0x15')]===0x1f4){logger[_0x0612('0x14')](_0x0612('0x16'),_0x52edcd,_0x2ded70[_0x0612('0x14')][_0x0612('0x17')]);return _0xbfd80e(_0x2ded70['error'][_0x0612('0x17')]);}logger['error'](_0x0612('0x16'),_0x52edcd,_0x2ded70[_0x0612('0x14')][_0x0612('0x17')]);return _0xb4a213(_0x2ded70['error']['message']);}else{logger[_0x0612('0x18')](_0x0612('0x16'),_0x52edcd,_0x0612('0x13'));_0xb4a213(_0x2ded70[_0x0612('0x19')]['message']);}})[_0x0612('0x1a')](function(_0x2d4a4b){logger[_0x0612('0x14')](_0x0612('0x16'),_0x52edcd,_0x2d4a4b);_0xbfd80e(_0x2d4a4b);});});} \ No newline at end of file +var _0x22bc=['../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','Notification,\x20%s,\x20%s,\x20%s','stringify','error','code','Notification,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x59ee66,_0x9dffe8){var _0x433201=function(_0x1adde0){while(--_0x1adde0){_0x59ee66['push'](_0x59ee66['shift']());}};_0x433201(++_0x9dffe8);}(_0x22bc,0x172));var _0xc22b=function(_0x20da8b,_0x23df88){_0x20da8b=_0x20da8b-0x0;var _0x138b53=_0x22bc[_0x20da8b];return _0x138b53;};'use strict';var _=require(_0xc22b('0x0'));var util=require(_0xc22b('0x1'));var moment=require(_0xc22b('0x2'));var BPromise=require(_0xc22b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc22b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc22b('0x5'))(_0xc22b('0x6'));var config=require('../../config/environment');var jayson=require(_0xc22b('0x7'));var client=jayson['client'][_0xc22b('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc22b('0x9')],{'host':_0xc22b('0xa'),'port':0x18eb});var socket=require(_0xc22b('0xb'))(new Redis(config['redis']));require('./notification.socket')[_0xc22b('0xc')](socket);function respondWithRpcPromise(_0x34d6d6,_0xb2e94a,_0x58ad18){return new BPromise(function(_0x40d1e9,_0x2f05ed){return client['request'](_0x34d6d6,_0x58ad18)[_0xc22b('0xd')](function(_0x3b60de){logger[_0xc22b('0xe')]('Notification,\x20%s,\x20%s',_0xb2e94a,_0xc22b('0xf'));logger[_0xc22b('0x10')](_0xc22b('0x11'),_0xb2e94a,_0xc22b('0xf'),JSON[_0xc22b('0x12')](_0x3b60de));if(_0x3b60de[_0xc22b('0x13')]){if(_0x3b60de['error'][_0xc22b('0x14')]===0x1f4){logger[_0xc22b('0x13')](_0xc22b('0x15'),_0xb2e94a,_0x3b60de[_0xc22b('0x13')][_0xc22b('0x16')]);return _0x2f05ed(_0x3b60de[_0xc22b('0x13')]['message']);}logger[_0xc22b('0x13')](_0xc22b('0x15'),_0xb2e94a,_0x3b60de[_0xc22b('0x13')]['message']);return _0x40d1e9(_0x3b60de['error'][_0xc22b('0x16')]);}else{logger[_0xc22b('0xe')](_0xc22b('0x15'),_0xb2e94a,_0xc22b('0xf'));_0x40d1e9(_0x3b60de[_0xc22b('0x17')][_0xc22b('0x16')]);}})[_0xc22b('0x18')](function(_0x10b082){logger['error'](_0xc22b('0x15'),_0xb2e94a,_0x10b082);_0x2f05ed(_0x10b082);});});} \ No newline at end of file diff --git a/server/api/notification/notification.socket.js b/server/api/notification/notification.socket.js index d6b74b4..07eea78 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 _0xdb0a=['notification:','./notification.events','update','emit','removeListener','register'];(function(_0x1d6f82,_0x1e3208){var _0x1d9c09=function(_0x1312a3){while(--_0x1312a3){_0x1d6f82['push'](_0x1d6f82['shift']());}};_0x1d9c09(++_0x1e3208);}(_0xdb0a,0x1b1));var _0xadb0=function(_0x33e76f,_0x3dc4c3){_0x33e76f=_0x33e76f-0x0;var _0x5edadc=_0xdb0a[_0x33e76f];return _0x5edadc;};'use strict';var NotificationEvents=require(_0xadb0('0x0'));var events=['save','remove',_0xadb0('0x1')];function createListener(_0x50d857,_0xc9947c){return function(_0xab0f4b){_0xc9947c[_0xadb0('0x2')](_0x50d857,_0xab0f4b);};}function removeListener(_0x146cfd,_0x47a3d1){return function(){NotificationEvents[_0xadb0('0x3')](_0x146cfd,_0x47a3d1);};}exports[_0xadb0('0x4')]=function(_0x38f0b7){for(var _0x35a5df=0x0,_0x533182=events['length'];_0x35a5df<_0x533182;_0x35a5df++){var _0xa3330f=events[_0x35a5df];var _0x2d2475=createListener(_0xadb0('0x5')+_0xa3330f,_0x38f0b7);NotificationEvents['on'](_0xa3330f,_0x2d2475);}}; \ No newline at end of file +var _0xb81e=['./notification.events','remove','update','emit','register'];(function(_0x4ede67,_0x2ff0a7){var _0x40ab3a=function(_0x3179be){while(--_0x3179be){_0x4ede67['push'](_0x4ede67['shift']());}};_0x40ab3a(++_0x2ff0a7);}(_0xb81e,0x9b));var _0xeb81=function(_0x24f951,_0x1b9836){_0x24f951=_0x24f951-0x0;var _0x5d0a66=_0xb81e[_0x24f951];return _0x5d0a66;};'use strict';var NotificationEvents=require(_0xeb81('0x0'));var events=['save',_0xeb81('0x1'),_0xeb81('0x2')];function createListener(_0x528048,_0x16fa3b){return function(_0x55ea97){_0x16fa3b[_0xeb81('0x3')](_0x528048,_0x55ea97);};}function removeListener(_0x69c463,_0x5caf1e){return function(){NotificationEvents['removeListener'](_0x69c463,_0x5caf1e);};}exports[_0xeb81('0x4')]=function(_0x459fde){for(var _0x22cea3=0x0,_0x52634c=events['length'];_0x22cea3<_0x52634c;_0x22cea3++){var _0x3199df=events[_0x22cea3];var _0x383ca4=createListener('notification:'+_0x3199df,_0x459fde);NotificationEvents['on'](_0x3199df,_0x383ca4);}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 8c53e0e..1cf8a8b 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 _0xe539=['destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','send','update'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe539,0x163));var _0x9e53=function(_0x1778e1,_0x3e1727){_0x1778e1=_0x1778e1-0x0;var _0x2bc4c6=_0xe539[_0x1778e1];return _0x2bc4c6;};'use strict';var multer=require(_0x9e53('0x0'));var util=require('util');var path=require(_0x9e53('0x1'));var timeout=require(_0x9e53('0x2'));var express=require(_0x9e53('0x3'));var router=express[_0x9e53('0x4')]();var auth=require(_0x9e53('0x5'));var interaction=require(_0x9e53('0x6'));var config=require('../../config/environment');var controller=require(_0x9e53('0x7'));router[_0x9e53('0x8')]('/',auth[_0x9e53('0x9')](),controller[_0x9e53('0xa')]);router[_0x9e53('0x8')]('/describe',auth[_0x9e53('0x9')](),controller[_0x9e53('0xb')]);router[_0x9e53('0x8')]('/:id',auth[_0x9e53('0x9')](),controller['show']);router[_0x9e53('0x8')](_0x9e53('0xc'),auth['isAuthenticated'](),controller[_0x9e53('0xd')]);router[_0x9e53('0x8')](_0x9e53('0xe'),auth[_0x9e53('0x9')](),controller[_0x9e53('0xf')]);router['get']('/:id/applications',auth[_0x9e53('0x9')](),controller['getApplications']);router[_0x9e53('0x8')](_0x9e53('0x10'),auth['isAuthenticated'](),controller[_0x9e53('0x11')]);router[_0x9e53('0x8')](_0x9e53('0x12'),auth[_0x9e53('0x9')](),controller['getAgents']);router[_0x9e53('0x13')]('/',auth[_0x9e53('0x9')](),controller[_0x9e53('0x14')]);router[_0x9e53('0x13')](_0x9e53('0xc'),auth[_0x9e53('0x9')](),controller[_0x9e53('0x15')]);router[_0x9e53('0x13')](_0x9e53('0xe'),auth['isAuthenticated'](),controller[_0x9e53('0x16')]);router[_0x9e53('0x13')](_0x9e53('0x17'),controller[_0x9e53('0x18')]);router['post'](_0x9e53('0x19'),auth[_0x9e53('0x9')](),controller[_0x9e53('0x1a')]);router['post'](_0x9e53('0x12'),auth[_0x9e53('0x9')](),controller[_0x9e53('0x1b')]);router[_0x9e53('0x13')]('/:id/send',auth['isAuthenticated'](),controller[_0x9e53('0x1c')]);router['put']('/:id',auth[_0x9e53('0x9')](),controller[_0x9e53('0x1d')]);router['delete']('/:id',auth[_0x9e53('0x9')](),controller[_0x9e53('0x1e')]);router[_0x9e53('0x1f')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x9e53('0x20')]);router['delete'](_0x9e53('0xe'),auth['isAuthenticated'](),controller[_0x9e53('0x21')]);router[_0x9e53('0x1f')](_0x9e53('0x12'),auth[_0x9e53('0x9')](),controller[_0x9e53('0x22')]);module['exports']=router; \ No newline at end of file +var _0x84b2=['getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addAnswer','notify','addAgents','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x2f7cc4,_0x24d6df){var _0xcfd88c=function(_0x46da0c){while(--_0x46da0c){_0x2f7cc4['push'](_0x2f7cc4['shift']());}};_0xcfd88c(++_0x24d6df);}(_0x84b2,0x64));var _0x284b=function(_0xcc499b,_0x1802f){_0xcc499b=_0xcc499b-0x0;var _0xa1dd8e=_0x84b2[_0xcc499b];return _0xa1dd8e;};'use strict';var multer=require(_0x284b('0x0'));var util=require(_0x284b('0x1'));var path=require(_0x284b('0x2'));var timeout=require(_0x284b('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x284b('0x4'));var interaction=require(_0x284b('0x5'));var config=require(_0x284b('0x6'));var controller=require(_0x284b('0x7'));router[_0x284b('0x8')]('/',auth[_0x284b('0x9')](),controller[_0x284b('0xa')]);router['get'](_0x284b('0xb'),auth[_0x284b('0x9')](),controller[_0x284b('0xc')]);router[_0x284b('0x8')](_0x284b('0xd'),auth[_0x284b('0x9')](),controller['show']);router[_0x284b('0x8')](_0x284b('0xe'),auth[_0x284b('0x9')](),controller[_0x284b('0xf')]);router[_0x284b('0x8')](_0x284b('0x10'),auth[_0x284b('0x9')](),controller[_0x284b('0x11')]);router['get'](_0x284b('0x12'),auth['isAuthenticated'](),controller[_0x284b('0x13')]);router[_0x284b('0x8')](_0x284b('0x14'),auth['isAuthenticated'](),controller[_0x284b('0x15')]);router[_0x284b('0x8')](_0x284b('0x16'),auth[_0x284b('0x9')](),controller[_0x284b('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0x284b('0x18')]);router[_0x284b('0x19')](_0x284b('0xe'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x284b('0x19')](_0x284b('0x10'),auth[_0x284b('0x9')](),controller[_0x284b('0x1a')]);router[_0x284b('0x19')]('/:id/notify',controller[_0x284b('0x1b')]);router[_0x284b('0x19')](_0x284b('0x12'),auth[_0x284b('0x9')](),controller['addApplications']);router[_0x284b('0x19')](_0x284b('0x16'),auth[_0x284b('0x9')](),controller[_0x284b('0x1c')]);router[_0x284b('0x19')](_0x284b('0x1d'),auth[_0x284b('0x9')](),controller[_0x284b('0x1e')]);router[_0x284b('0x1f')](_0x284b('0xd'),auth[_0x284b('0x9')](),controller[_0x284b('0x20')]);router['delete']('/:id',auth[_0x284b('0x9')](),controller[_0x284b('0x21')]);router[_0x284b('0x22')](_0x284b('0xe'),auth[_0x284b('0x9')](),controller[_0x284b('0x23')]);router[_0x284b('0x22')]('/:id/canned_answers',auth[_0x284b('0x9')](),controller[_0x284b('0x24')]);router[_0x284b('0x22')]('/:id/users',auth[_0x284b('0x9')](),controller[_0x284b('0x25')]);module[_0x284b('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 3546369..8c6d211 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 _0x0740=['mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x5c79ff,_0x133442){var _0x53acc6=function(_0x6ded20){while(--_0x6ded20){_0x5c79ff['push'](_0x5c79ff['shift']());}};_0x53acc6(++_0x133442);}(_0x0740,0xc1));var _0x0074=function(_0x4435f3,_0x3efd2a){_0x4435f3=_0x4435f3-0x0;var _0x1c5e1d=_0x0740[_0x4435f3];return _0x1c5e1d;};'use strict';var Sequelize=require(_0x0074('0x0'));var rs=require(_0x0074('0x1'));module[_0x0074('0x2')]={'name':{'type':Sequelize[_0x0074('0x3')],'unique':_0x0074('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x0074('0x3')],'defaultValue':function(){return rs[_0x0074('0x5')]();}},'replyUri':{'type':Sequelize[_0x0074('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0074('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0074('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0074('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x0074('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0074('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0074('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x0074('0x7')],'defaultValue':![],'comment':_0x0074('0x9'),'set':function(_0x1392cf){if(!_0x1392cf)this[_0x0074('0xa')](_0x0074('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x1392cf);}}}; \ No newline at end of file +var _0xc8b6=['sequelize','randomstring','exports','STRING','name','generate','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'];(function(_0x37fd17,_0x448615){var _0x548ff6=function(_0x3a79d0){while(--_0x3a79d0){_0x37fd17['push'](_0x37fd17['shift']());}};_0x548ff6(++_0x448615);}(_0xc8b6,0x118));var _0x6c8b=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0xc8b6[_0x1e2321];return _0x1d346d;};'use strict';var Sequelize=require(_0x6c8b('0x0'));var rs=require(_0x6c8b('0x1'));module[_0x6c8b('0x2')]={'name':{'type':Sequelize[_0x6c8b('0x3')],'unique':_0x6c8b('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6c8b('0x3')],'defaultValue':function(){return rs[_0x6c8b('0x5')]();}},'replyUri':{'type':Sequelize[_0x6c8b('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6c8b('0x6');}},'notificationSound':{'type':Sequelize[_0x6c8b('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6c8b('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6c8b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6c8b('0x3')]},'queueTransfer':{'type':Sequelize[_0x6c8b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6c8b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6c8b('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x6c8b('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6c8b('0xa'),'set':function(_0xd2d92d){if(!_0xd2d92d)this[_0x6c8b('0xb')](_0x6c8b('0xc'),null);this[_0x6c8b('0xb')](_0x6c8b('0xd'),_0xd2d92d);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 2983df3..b422257 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 _0xe750=['getApplications','Contact','Owner','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','jayson/promise','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','OpenchannelAccounts','sendStatus','stack','name','send','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','Pause','keys','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','OpnechannelAccountId','Disposition','getDispositions','findOne','nolimit','order','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','OpenchannelApplication','Applications','List','account','applications','orderBy','priority','asc','Contacts','defaults','contact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','findAndCountAll'];(function(_0x1be0fe,_0x39708b){var _0x56a675=function(_0x131420){while(--_0x131420){_0x1be0fe['push'](_0x1be0fe['shift']());}};_0x56a675(++_0x39708b);}(_0xe750,0xc6));var _0x0e75=function(_0x1b9bcb,_0x4cdba9){_0x1b9bcb=_0x1b9bcb-0x0;var _0x462588=_0xe750[_0x1b9bcb];return _0x462588;};'use strict';var pdf=require(_0x0e75('0x0'));var emlformat=require(_0x0e75('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0e75('0x2'));var rp=require(_0x0e75('0x3'));var moment=require(_0x0e75('0x4'));var BPromise=require(_0x0e75('0x5'));var Mustache=require('mustache');var util=require(_0x0e75('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e75('0x7'));var squel=require(_0x0e75('0x8'));var crypto=require(_0x0e75('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0e75('0xa'));var toCsv=require(_0x0e75('0xb'));var querystring=require(_0x0e75('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0e75('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0e75('0xe'));var logger=require('../../config/logger')(_0x0e75('0xf'));var utils=require(_0x0e75('0x10'));var config=require(_0x0e75('0x11'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x0e75('0x12')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0x0e75('0x13'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x0e75('0x14')][_0x0e75('0x15')]({'port':0x232a});function checkPasswordPattern(_0x78634d,_0x4f69b6,_0x46eb09){if(_0x46eb09){var _0xf84b80=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xf84b80[_0x0e75('0x16')](_0x4f69b6)){return _0x78634d;}else{throw new db[(_0x0e75('0x17'))]['ValidationError'](_0x0e75('0x18'));}}else{return _0x78634d;}}function respondWithRpcPromise(_0x5d4691,_0x5ed682,_0x1a7545,_0x485e25){return new BPromise(function(_0x5ca91c,_0x1079f7){var _0x400df4=_0x485e25||client;return _0x400df4[_0x0e75('0x19')](_0x5d4691,_0x1a7545)[_0x0e75('0x1a')](function(_0x1de84d){logger[_0x0e75('0x1b')](_0x0e75('0x1c'),_0x5ed682,_0x0e75('0x1d'));logger[_0x0e75('0x1e')](_0x0e75('0x1f'),_0x5ed682,_0x0e75('0x1d'),JSON[_0x0e75('0x20')](_0x1de84d));if(_0x1de84d['error']){if(_0x1de84d[_0x0e75('0x21')]['code']===0x1f4){logger[_0x0e75('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x5ed682,_0x1de84d[_0x0e75('0x21')]['message']);return _0x1079f7(_0x1de84d[_0x0e75('0x21')][_0x0e75('0x22')]);}logger['error'](_0x0e75('0x1c'),_0x5ed682,_0x1de84d[_0x0e75('0x21')][_0x0e75('0x22')]);return _0x5ca91c(_0x1de84d[_0x0e75('0x21')][_0x0e75('0x22')]);}else{logger[_0x0e75('0x1b')](_0x0e75('0x1c'),_0x5ed682,_0x0e75('0x1d'));_0x5ca91c(_0x1de84d[_0x0e75('0x23')][_0x0e75('0x22')]);}})[_0x0e75('0x24')](function(_0x3b32f6){logger[_0x0e75('0x21')](_0x0e75('0x1c'),_0x5ed682,_0x3b32f6);_0x1079f7(_0x3b32f6);});});}function respondWithStatusCode(_0x474409,_0x263a35){_0x263a35=_0x263a35||0xcc;return function(_0x216f66){if(_0x216f66){return _0x474409['sendStatus'](_0x263a35);}return _0x474409['status'](_0x263a35)[_0x0e75('0x25')]();};}function respondWithResult(_0x477a0e,_0x4b59e8){_0x4b59e8=_0x4b59e8||0xc8;return function(_0x3c85a7){if(_0x3c85a7){return _0x477a0e[_0x0e75('0x26')](_0x4b59e8)['json'](_0x3c85a7);}};}function respondWithFilteredResult(_0x57dcfa,_0x5c61d3){return function(_0x4fa329){if(_0x4fa329){var _0x5e1381=_0x4fa329[_0x0e75('0x27')],_0x223377=_0x5c61d3[_0x0e75('0x28')],_0x2bdc34=_0x5c61d3[_0x0e75('0x28')]+_0x5c61d3[_0x0e75('0x29')],_0x429027;if(_0x2bdc34>=_0x5e1381){_0x2bdc34=_0x5e1381;_0x429027=0xc8;}else{_0x429027=0xce;}_0x57dcfa[_0x0e75('0x26')](_0x429027);return _0x57dcfa[_0x0e75('0x2a')](_0x0e75('0x2b'),_0x223377+'-'+_0x2bdc34+'/'+_0x5e1381)[_0x0e75('0x2c')](_0x4fa329);}return null;};}function patchUpdates(_0x27e44b){return function(_0x4f8f85){try{jsonpatch[_0x0e75('0x2d')](_0x4f8f85,_0x27e44b,!![]);}catch(_0x1196c4){return BPromise[_0x0e75('0x2e')](_0x1196c4);}return _0x4f8f85[_0x0e75('0x2f')]();};}function saveUpdates(_0x47e806,_0x1ff227){return function(_0x4c18c5){if(_0x4c18c5){return _0x4c18c5[_0x0e75('0x30')](_0x47e806)[_0x0e75('0x1a')](function(_0x4ada52){return _0x4ada52;});}return null;};}function removeEntity(_0x26f13f,_0x5799d3){return function(_0x517b41){if(_0x517b41){return _0x517b41[_0x0e75('0x31')]()[_0x0e75('0x1a')](function(){var _0x4393c6=_0x517b41['get']({'plain':!![]});var _0x1c6812=_0x0e75('0x32');return db['UserProfileResource'][_0x0e75('0x31')]({'where':{'type':_0x1c6812,'resourceId':_0x4393c6['id']}})[_0x0e75('0x1a')](function(){return _0x517b41;});})['then'](function(){_0x26f13f[_0x0e75('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53e57e,_0x24f59b){return function(_0x490d3c){if(!_0x490d3c){_0x53e57e[_0x0e75('0x33')](0x194);}return _0x490d3c;};}function handleError(_0x342ad9,_0x3fbd29){_0x3fbd29=_0x3fbd29||0x1f4;return function(_0x294a15){logger['error'](_0x294a15[_0x0e75('0x34')]);if(_0x294a15[_0x0e75('0x35')]){delete _0x294a15[_0x0e75('0x35')];}_0x342ad9[_0x0e75('0x26')](_0x3fbd29)[_0x0e75('0x36')](_0x294a15);};}exports[_0x0e75('0x37')]=function(_0x27a9fd,_0x47a7ca){var _0x57a606={'include':[{'model':db['Pause'],'as':_0x0e75('0x38')}]},_0x20364f={},_0x1f62b5={'count':0x0,'rows':[]};var _0xf2414d=_['map'](db[_0x0e75('0x39')][_0x0e75('0x3a')],function(_0x45d823){return{'name':_0x45d823[_0x0e75('0x3b')],'type':_0x45d823[_0x0e75('0x3c')][_0x0e75('0x3d')]};});_0x20364f[_0x0e75('0x3e')]=_['map'](_0xf2414d,_0x0e75('0x35'));_0x20364f[_0x0e75('0x3f')]=_['keys'](_0x27a9fd[_0x0e75('0x3f')]);_0x20364f[_0x0e75('0x40')]=_[_0x0e75('0x41')](_0x20364f['model'],_0x20364f[_0x0e75('0x3f')]);_0x57a606['attributes']=_['intersection'](_0x20364f['model'],qs[_0x0e75('0x42')](_0x27a9fd['query']['fields']));_0x57a606['attributes']=_0x57a606[_0x0e75('0x43')][_0x0e75('0x44')]?_0x57a606[_0x0e75('0x43')]:_0x20364f[_0x0e75('0x3e')];if(!_0x27a9fd[_0x0e75('0x3f')][_0x0e75('0x45')]('nolimit')){_0x57a606[_0x0e75('0x29')]=qs[_0x0e75('0x29')](_0x27a9fd['query'][_0x0e75('0x29')]);_0x57a606[_0x0e75('0x28')]=qs[_0x0e75('0x28')](_0x27a9fd['query'][_0x0e75('0x28')]);}_0x57a606['order']=qs[_0x0e75('0x46')](_0x27a9fd[_0x0e75('0x3f')][_0x0e75('0x46')]);_0x57a606[_0x0e75('0x47')]=qs['filters'](_[_0x0e75('0x48')](_0x27a9fd[_0x0e75('0x3f')],_0x20364f[_0x0e75('0x40')]));if(_0x27a9fd[_0x0e75('0x3f')][_0x0e75('0x49')]){_0x57a606[_0x0e75('0x47')]=_['merge'](_0x57a606[_0x0e75('0x47')],{'$or':_[_0x0e75('0x4a')](_0xf2414d,function(_0x262b90){if(_0x262b90['type']!==_0x0e75('0x4b')){var _0x264516={};_0x264516[_0x262b90[_0x0e75('0x35')]]={'$like':'%'+_0x27a9fd[_0x0e75('0x3f')][_0x0e75('0x49')]+'%'};return _0x264516;}})});}_0x57a606=_[_0x0e75('0x4c')]({},_0x57a606,_0x27a9fd[_0x0e75('0x4d')]);var _0x938735={'where':_0x57a606[_0x0e75('0x47')]};return db['OpenchannelAccount'][_0x0e75('0x27')](_0x938735)[_0x0e75('0x1a')](function(_0x36cc17){_0x1f62b5['count']=_0x36cc17;if(_0x27a9fd[_0x0e75('0x3f')][_0x0e75('0x4e')]){_0x57a606[_0x0e75('0x4f')]=[{'all':!![]}];}return db[_0x0e75('0x39')][_0x0e75('0x50')](_0x57a606);})[_0x0e75('0x1a')](function(_0x2fe257){_0x1f62b5[_0x0e75('0x51')]=_0x2fe257;return _0x1f62b5;})['then'](respondWithFilteredResult(_0x47a7ca,_0x57a606))[_0x0e75('0x24')](handleError(_0x47a7ca,null));};exports['show']=function(_0x52cff4,_0x74ee0){var _0x8c99db={'raw':![],'where':{'id':_0x52cff4['params']['id']},'include':[{'model':db[_0x0e75('0x52')],'as':'mandatoryDispositionPause'}]},_0x3a61f0={};_0x3a61f0['model']=_[_0x0e75('0x53')](db[_0x0e75('0x39')][_0x0e75('0x3a')]);_0x3a61f0['query']=_[_0x0e75('0x53')](_0x52cff4[_0x0e75('0x3f')]);_0x3a61f0[_0x0e75('0x40')]=_[_0x0e75('0x41')](_0x3a61f0[_0x0e75('0x3e')],_0x3a61f0[_0x0e75('0x3f')]);_0x8c99db[_0x0e75('0x43')]=_[_0x0e75('0x41')](_0x3a61f0[_0x0e75('0x3e')],qs[_0x0e75('0x42')](_0x52cff4[_0x0e75('0x3f')][_0x0e75('0x42')]));_0x8c99db['attributes']=_0x8c99db[_0x0e75('0x43')][_0x0e75('0x44')]?_0x8c99db[_0x0e75('0x43')]:_0x3a61f0['model'];if(_0x52cff4[_0x0e75('0x3f')]['includeAll']){_0x8c99db[_0x0e75('0x4f')]=[{'all':!![]}];}_0x8c99db=_[_0x0e75('0x4c')]({},_0x8c99db,_0x52cff4[_0x0e75('0x4d')]);return db['OpenchannelAccount']['find'](_0x8c99db)[_0x0e75('0x1a')](handleEntityNotFound(_0x74ee0,null))[_0x0e75('0x1a')](respondWithResult(_0x74ee0,null))[_0x0e75('0x24')](handleError(_0x74ee0,null));};exports[_0x0e75('0x54')]=function(_0x32a537,_0x17ad9b){return db[_0x0e75('0x39')][_0x0e75('0x54')](_0x32a537[_0x0e75('0x55')],{})[_0x0e75('0x1a')](function(_0x375dda){var _0x4b6dbd=_0x32a537['user'][_0x0e75('0x56')]({'plain':!![]});if(!_0x4b6dbd)throw new Error(_0x0e75('0x57'));if(_0x4b6dbd[_0x0e75('0x58')]===_0x0e75('0x59')){var _0x1a8aad=_0x375dda[_0x0e75('0x56')]({'plain':!![]});var _0x8a654f=_0x0e75('0x32');return db[_0x0e75('0x5a')][_0x0e75('0x5b')]({'where':{'name':_0x8a654f,'userProfileId':_0x4b6dbd['userProfileId']},'raw':!![]})[_0x0e75('0x1a')](function(_0x2390b3){if(_0x2390b3&&_0x2390b3[_0x0e75('0x5c')]===0x0){return db[_0x0e75('0x5d')]['create']({'name':_0x1a8aad['name'],'resourceId':_0x1a8aad['id'],'type':_0x2390b3[_0x0e75('0x35')],'sectionId':_0x2390b3['id']},{})[_0x0e75('0x1a')](function(){return _0x375dda;});}else{return _0x375dda;}})[_0x0e75('0x24')](function(_0x48d950){logger[_0x0e75('0x21')](_0x0e75('0x5e'),_0x48d950);throw _0x48d950;});}return _0x375dda;})['then'](respondWithResult(_0x17ad9b,0xc9))['catch'](handleError(_0x17ad9b,null));};exports[_0x0e75('0x30')]=function(_0x176c83,_0x54decc){if(_0x176c83['body']['id']){delete _0x176c83[_0x0e75('0x55')]['id'];}return db[_0x0e75('0x39')]['find']({'where':{'id':_0x176c83[_0x0e75('0x5f')]['id']},'include':[{'model':db[_0x0e75('0x52')],'as':_0x0e75('0x38')}]})['then'](handleEntityNotFound(_0x54decc,null))[_0x0e75('0x1a')](saveUpdates(_0x176c83['body'],null))[_0x0e75('0x1a')](respondWithResult(_0x54decc,null))['catch'](handleError(_0x54decc,null));};exports[_0x0e75('0x31')]=function(_0x11d41d,_0x3e80c0){return db[_0x0e75('0x39')]['find']({'where':{'id':_0x11d41d['params']['id']}})[_0x0e75('0x1a')](handleEntityNotFound(_0x3e80c0,null))['then'](removeEntity(_0x3e80c0,null))[_0x0e75('0x24')](handleError(_0x3e80c0,null));};exports[_0x0e75('0x60')]=function(_0x127dbe,_0x384978){return db['OpenchannelAccount'][_0x0e75('0x60')]()['then'](respondWithResult(_0x384978,null))[_0x0e75('0x24')](handleError(_0x384978,null));};exports['addDisposition']=function(_0x5e2daa,_0x1c55df,_0x40960c){if(_0x5e2daa[_0x0e75('0x55')]['id']){delete _0x5e2daa[_0x0e75('0x55')]['id'];}return db[_0x0e75('0x39')][_0x0e75('0x5b')]({'where':{'id':_0x5e2daa[_0x0e75('0x5f')]['id']}})[_0x0e75('0x1a')](handleEntityNotFound(_0x1c55df,null))[_0x0e75('0x1a')](function(_0x1cccd8){if(_0x1cccd8){_0x5e2daa[_0x0e75('0x55')][_0x0e75('0x61')]=_0x1cccd8['id'];return db[_0x0e75('0x62')][_0x0e75('0x54')](_0x5e2daa[_0x0e75('0x55')]);}})[_0x0e75('0x1a')](respondWithResult(_0x1c55df,null))[_0x0e75('0x24')](handleError(_0x1c55df,null));};exports[_0x0e75('0x63')]=function(_0x40f91f,_0x3732cf,_0x3890b8){var _0x4c6072={'raw':![],'where':{}};var _0x41d50e={};var _0x20d331={'count':0x0,'rows':[]};return db[_0x0e75('0x39')][_0x0e75('0x64')]({'where':{'id':_0x40f91f[_0x0e75('0x5f')]['id']}})[_0x0e75('0x1a')](handleEntityNotFound(_0x3732cf,null))[_0x0e75('0x1a')](function(_0x22468d){if(_0x22468d){_0x41d50e[_0x0e75('0x3e')]=_['keys'](db['Disposition'][_0x0e75('0x3a')]);_0x41d50e[_0x0e75('0x3f')]=_['keys'](_0x40f91f[_0x0e75('0x3f')]);_0x41d50e[_0x0e75('0x40')]=_[_0x0e75('0x41')](_0x41d50e['model'],_0x41d50e['query']);_0x4c6072[_0x0e75('0x43')]=_[_0x0e75('0x41')](_0x41d50e[_0x0e75('0x3e')],qs[_0x0e75('0x42')](_0x40f91f[_0x0e75('0x3f')][_0x0e75('0x42')]));_0x4c6072[_0x0e75('0x43')]=_0x4c6072[_0x0e75('0x43')][_0x0e75('0x44')]?_0x4c6072[_0x0e75('0x43')]:_0x41d50e['model'];if(!_0x40f91f[_0x0e75('0x3f')]['hasOwnProperty'](_0x0e75('0x65'))){_0x4c6072[_0x0e75('0x29')]=qs['limit'](_0x40f91f[_0x0e75('0x3f')][_0x0e75('0x29')]);_0x4c6072[_0x0e75('0x28')]=qs[_0x0e75('0x28')](_0x40f91f[_0x0e75('0x3f')]['offset']);}_0x4c6072[_0x0e75('0x66')]=qs['sort'](_0x40f91f[_0x0e75('0x3f')][_0x0e75('0x46')]);_0x4c6072[_0x0e75('0x47')]=qs[_0x0e75('0x40')](_[_0x0e75('0x48')](_0x40f91f[_0x0e75('0x3f')],_0x41d50e['filters']));_0x4c6072['where'][_0x0e75('0x67')]=_0x22468d['id'];if(_0x40f91f[_0x0e75('0x3f')]['filter']){_0x4c6072[_0x0e75('0x47')]=_['merge'](_0x4c6072[_0x0e75('0x47')],{'$or':_['map'](_0x4c6072[_0x0e75('0x43')],function(_0x279552){var _0x19ba50={};_0x19ba50[_0x279552]={'$like':'%'+_0x40f91f[_0x0e75('0x3f')][_0x0e75('0x49')]+'%'};return _0x19ba50;})});}_0x4c6072=_[_0x0e75('0x4c')]({},_0x4c6072,_0x40f91f[_0x0e75('0x4d')]);return db['Disposition'][_0x0e75('0x27')]({'where':_0x4c6072['where']})['then'](function(_0x5ab703){_0x20d331['count']=_0x5ab703;if(_0x40f91f[_0x0e75('0x3f')][_0x0e75('0x4e')]){_0x4c6072[_0x0e75('0x4f')]=[{'all':!![]}];}return db[_0x0e75('0x62')][_0x0e75('0x50')](_0x4c6072);})[_0x0e75('0x1a')](function(_0x8747ee){_0x20d331[_0x0e75('0x51')]=_0x8747ee;return _0x20d331;});}})[_0x0e75('0x1a')](respondWithFilteredResult(_0x3732cf,_0x4c6072))[_0x0e75('0x24')](handleError(_0x3732cf,null));};exports[_0x0e75('0x68')]=function(_0xdb63ed,_0x387493,_0x1662b8){return db[_0x0e75('0x39')]['find']({'where':{'id':_0xdb63ed['params']['id']}})[_0x0e75('0x1a')](handleEntityNotFound(_0x387493,null))['then'](function(_0x4989f4){if(_0x4989f4){return _0x4989f4[_0x0e75('0x68')](_0xdb63ed[_0x0e75('0x3f')][_0x0e75('0x69')]);}})[_0x0e75('0x1a')](respondWithStatusCode(_0x387493,null))[_0x0e75('0x24')](handleError(_0x387493,null));};exports[_0x0e75('0x6a')]=function(_0x40530c,_0x9ae6b2,_0x3862b6){if(_0x40530c[_0x0e75('0x55')]['id']){delete _0x40530c['body']['id'];}return db['OpenchannelAccount'][_0x0e75('0x5b')]({'where':{'id':_0x40530c['params']['id']}})[_0x0e75('0x1a')](handleEntityNotFound(_0x9ae6b2,null))['then'](function(_0x49daeb){if(_0x49daeb){_0x40530c['body'][_0x0e75('0x67')]=_0x49daeb['id'];return db[_0x0e75('0x6b')]['create'](_0x40530c['body']);}})['then'](respondWithResult(_0x9ae6b2,null))[_0x0e75('0x24')](handleError(_0x9ae6b2,null));};exports['getAnswers']=function(_0x47594a,_0x4e16d2,_0x1a7900){var _0x16758a={'raw':![],'where':{}};var _0x40b650={};var _0x5819dd={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0e75('0x64')]({'where':{'id':_0x47594a[_0x0e75('0x5f')]['id']}})[_0x0e75('0x1a')](handleEntityNotFound(_0x4e16d2,null))[_0x0e75('0x1a')](function(_0x9dad8f){if(_0x9dad8f){_0x40b650[_0x0e75('0x3e')]=_['keys'](db[_0x0e75('0x6b')][_0x0e75('0x3a')]);_0x40b650['query']=_[_0x0e75('0x53')](_0x47594a[_0x0e75('0x3f')]);_0x40b650[_0x0e75('0x40')]=_[_0x0e75('0x41')](_0x40b650[_0x0e75('0x3e')],_0x40b650[_0x0e75('0x3f')]);_0x16758a['attributes']=_[_0x0e75('0x41')](_0x40b650[_0x0e75('0x3e')],qs[_0x0e75('0x42')](_0x47594a[_0x0e75('0x3f')][_0x0e75('0x42')]));_0x16758a[_0x0e75('0x43')]=_0x16758a[_0x0e75('0x43')]['length']?_0x16758a[_0x0e75('0x43')]:_0x40b650[_0x0e75('0x3e')];if(!_0x47594a[_0x0e75('0x3f')][_0x0e75('0x45')](_0x0e75('0x65'))){_0x16758a[_0x0e75('0x29')]=qs[_0x0e75('0x29')](_0x47594a[_0x0e75('0x3f')]['limit']);_0x16758a[_0x0e75('0x28')]=qs['offset'](_0x47594a[_0x0e75('0x3f')][_0x0e75('0x28')]);}_0x16758a[_0x0e75('0x66')]=qs[_0x0e75('0x46')](_0x47594a[_0x0e75('0x3f')][_0x0e75('0x46')]);_0x16758a['where']=qs[_0x0e75('0x40')](_[_0x0e75('0x48')](_0x47594a[_0x0e75('0x3f')],_0x40b650[_0x0e75('0x40')]));_0x16758a[_0x0e75('0x47')][_0x0e75('0x67')]=_0x9dad8f['id'];if(_0x47594a['query'][_0x0e75('0x49')]){_0x16758a[_0x0e75('0x47')]=_['merge'](_0x16758a['where'],{'$or':_[_0x0e75('0x4a')](_0x16758a[_0x0e75('0x43')],function(_0x3574ca){var _0x1f6811={};_0x1f6811[_0x3574ca]={'$like':'%'+_0x47594a[_0x0e75('0x3f')][_0x0e75('0x49')]+'%'};return _0x1f6811;})});}_0x16758a=_[_0x0e75('0x4c')]({},_0x16758a,_0x47594a[_0x0e75('0x4d')]);return db[_0x0e75('0x6b')][_0x0e75('0x27')]({'where':_0x16758a['where']})[_0x0e75('0x1a')](function(_0x403353){_0x5819dd[_0x0e75('0x27')]=_0x403353;if(_0x47594a[_0x0e75('0x3f')]['includeAll']){_0x16758a[_0x0e75('0x4f')]=[{'all':!![]}];}return db[_0x0e75('0x6b')][_0x0e75('0x50')](_0x16758a);})[_0x0e75('0x1a')](function(_0xcbfc8c){_0x5819dd[_0x0e75('0x51')]=_0xcbfc8c;return _0x5819dd;});}})[_0x0e75('0x1a')](respondWithFilteredResult(_0x4e16d2,_0x16758a))[_0x0e75('0x24')](handleError(_0x4e16d2,null));};exports['removeAnswers']=function(_0x2b7612,_0x1718b0,_0x3a70e1){return db[_0x0e75('0x39')][_0x0e75('0x5b')]({'where':{'id':_0x2b7612[_0x0e75('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1718b0,null))[_0x0e75('0x1a')](function(_0x567724){if(_0x567724){return _0x567724[_0x0e75('0x6c')](_0x2b7612[_0x0e75('0x3f')][_0x0e75('0x69')]);}})[_0x0e75('0x1a')](respondWithStatusCode(_0x1718b0,null))[_0x0e75('0x24')](handleError(_0x1718b0,null));};exports[_0x0e75('0x6d')]=function(_0x25fd65,_0x293ed1,_0x25fa18){var _0x4f9c80={'body':_0x25fd65['body'],'channel':'openchannel'};var _0x5a607e=[];var _0x46784c=[];var _0x103802={};var _0x380fee=![];return db[_0x0e75('0x6e')][_0x0e75('0x60')]()['then'](function(_0x2e2469){if(!_0x2e2469){throw new db[(_0x0e75('0x17'))][(_0x0e75('0x6f'))]('no\x20available\x20attributes');}_0x5a607e=_[_0x0e75('0x70')](_['keys'](_0x2e2469),[_0x0e75('0x71'),_0x0e75('0x72')]);_0x46784c=_['difference'](_['keys'](_0x2e2469),['createdAt',_0x0e75('0x72'),_0x0e75('0x73'),_0x0e75('0x74')]);if(_0x25fd65[_0x0e75('0x55')]['id']){delete _0x25fd65[_0x0e75('0x55')]['id'];}if(_['isNil'](_0x25fd65[_0x0e75('0x55')][_0x0e75('0x75')])){throw new db[(_0x0e75('0x17'))][(_0x0e75('0x6f'))](_0x0e75('0x76'));}if(_[_0x0e75('0x77')](_0x25fd65['body'][_0x0e75('0x55')])||_0x25fd65[_0x0e75('0x55')][_0x0e75('0x55')]===''){throw new db[(_0x0e75('0x17'))][(_0x0e75('0x6f'))](_0x0e75('0x78'));}if(_['isNil'](_0x25fd65[_0x0e75('0x55')][_0x0e75('0x79')])){throw new db['Sequelize'][(_0x0e75('0x6f'))](_0x0e75('0x7a')+_0x46784c);}if(!_['includes'](_0x46784c,_0x25fd65[_0x0e75('0x55')]['mapKey'])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x46784c);}_0x103802[_0x25fd65['body'][_0x0e75('0x79')]]=_0x25fd65['body'][_0x0e75('0x75')];})['then'](function(){return db[_0x0e75('0x39')][_0x0e75('0x5b')]({'where':{'id':_0x25fd65[_0x0e75('0x5f')]['id']},'include':[{'model':db[_0x0e75('0x7b')],'as':'List','include':[{'model':db[_0x0e75('0x6e')],'as':'Contacts','where':_0x103802,'limit':0x1,'order':[[_0x0e75('0x72'),_0x0e75('0x7c')]]}]},{'model':db[_0x0e75('0x7d')],'as':_0x0e75('0x7e')}]});})['then'](handleEntityNotFound(_0x293ed1,null))[_0x0e75('0x1a')](function(_0x2f9da7){if(_0x2f9da7&&_0x2f9da7[_0x0e75('0x7f')]){_0x4f9c80[_0x0e75('0x80')]=_0x2f9da7;_0x4f9c80[_0x0e75('0x81')]=_0x2f9da7[_0x0e75('0x7e')];_0x4f9c80['list']=_0x2f9da7['List'];_0x4f9c80[_0x0e75('0x81')]=_[_0x0e75('0x82')](_0x4f9c80['applications'],[_0x0e75('0x83')],[_0x0e75('0x84')]);if(_0x4f9c80['account'][_0x0e75('0x7e')]){delete _0x4f9c80[_0x0e75('0x80')][_0x0e75('0x7e')];}if(_0x4f9c80[_0x0e75('0x80')][_0x0e75('0x7f')]&&_0x4f9c80[_0x0e75('0x80')]['List']['Contacts'][_0x0e75('0x44')]){return _0x4f9c80[_0x0e75('0x80')]['List'][_0x0e75('0x85')][0x0];}var _0x540999=_[_0x0e75('0x86')](_0x25fd65[_0x0e75('0x55')],{'firstName':_0x25fd65[_0x0e75('0x55')][_0x0e75('0x75')],'ListId':_0x2f9da7[_0x0e75('0x74')]});_0x540999[_0x25fd65[_0x0e75('0x55')]['mapKey']]=_0x25fd65[_0x0e75('0x55')][_0x0e75('0x75')];return db[_0x0e75('0x6e')][_0x0e75('0x54')](_0x540999,{'fields':_0x5a607e,'raw':!![]});}})[_0x0e75('0x1a')](handleEntityNotFound(_0x293ed1,null))['then'](function(_0x52dc04){_0x4f9c80[_0x0e75('0x87')]=_0x52dc04;if(_0x52dc04){var _0x539736={'ContactId':_0x52dc04['id'],'OpenchannelAccountId':_0x25fd65[_0x0e75('0x5f')]['id'],'from':(_0x52dc04[_0x0e75('0x88')]||'')+'\x20'+(_0x52dc04['lastName']||'')};var _0x212d81={'OpenchannelAccountId':_0x25fd65[_0x0e75('0x5f')]['id'],'closed':![]};if(_0x25fd65[_0x0e75('0x55')][_0x0e75('0x89')]){_0x212d81[_0x0e75('0x89')]=_0x25fd65[_0x0e75('0x55')][_0x0e75('0x89')];return db[_0x0e75('0x8a')]['find']({'where':_0x212d81})['then'](function(_0xcb5baa){if(_0xcb5baa){return[_0xcb5baa,![]];}_0x539736[_0x0e75('0x89')]=_0x25fd65['body'][_0x0e75('0x89')];_0x539736['externalUrl']=_0x25fd65[_0x0e75('0x55')][_0x0e75('0x8b')];return db[_0x0e75('0x8a')][_0x0e75('0x54')](_0x539736)[_0x0e75('0x1a')](function(_0x3dff55){return[_0x3dff55,!![]];});});}else{_0x212d81[_0x0e75('0x89')]=null;}_0x212d81['ContactId']=_0x52dc04['id'];return db[_0x0e75('0x8a')][_0x0e75('0x5b')]({'where':_0x212d81})[_0x0e75('0x1a')](function(_0x26a2d4){if(_0x26a2d4){return[_0x26a2d4,![]];}return db[_0x0e75('0x8a')]['create'](_0x539736)[_0x0e75('0x1a')](function(_0x996848){return[_0x996848,!![]];});});}})[_0x0e75('0x8c')](function(_0x115a28,_0x4758be){if(_0x115a28){_0x380fee=_0x4758be;if(!_0x4758be){var _0x19da92={'from':(_0x4f9c80[_0x0e75('0x87')]['firstName']||'')+'\x20'+(_0x4f9c80[_0x0e75('0x87')][_0x0e75('0x8d')]||'')};if(_0x25fd65[_0x0e75('0x55')][_0x0e75('0x89')]&&_0x25fd65[_0x0e75('0x55')][_0x0e75('0x8e')]&&_0x25fd65[_0x0e75('0x55')][_0x0e75('0x89')]!=_0x25fd65[_0x0e75('0x55')][_0x0e75('0x8e')]){_0x19da92[_0x0e75('0x89')]=_0x25fd65[_0x0e75('0x55')][_0x0e75('0x8e')];}return _0x115a28['update'](_0x19da92);}else{return _0x115a28;}}})[_0x0e75('0x1a')](function(_0x3394c2){_0x4f9c80[_0x0e75('0x8f')]=_0x3394c2[_0x0e75('0x56')]({'plain':!![]});_0x4f9c80[_0x0e75('0x8f')]['created']=_0x380fee;if(_0x4f9c80['interaction'][_0x0e75('0x90')]){if(_0x4f9c80[_0x0e75('0x80')][_0x0e75('0x91')]){_0x4f9c80[_0x0e75('0x81')][_0x0e75('0x92')]({'id':0x0,'priority':_0x4f9c80['applications']['length']+0x1,'app':_0x0e75('0x93'),'appdata':_0x0e75('0x94'),'interval':_0x0e75('0x95')});}}return db['OpenchannelMessage']['create']({'body':_0x25fd65['body']['body'],'OpenchannelAccountId':_0x25fd65[_0x0e75('0x5f')]['id'],'OpenchannelInteractionId':_0x3394c2['id'],'direction':'in','ContactId':_0x4f9c80['contact']['id'],'AttachmentId':_0x25fd65[_0x0e75('0x55')][_0x0e75('0x96')]});})['then'](function(_0x35732c){_0x4f9c80[_0x0e75('0x22')]=_0x35732c;if(_0x4f9c80[_0x0e75('0x8f')][_0x0e75('0x97')]){return db[_0x0e75('0x98')]['find']({'attributes':['id',_0x0e75('0x35')],'where':{'id':_0x4f9c80['interaction'][_0x0e75('0x97')]}})[_0x0e75('0x1a')](function(_0x2c383a){if(_0x2c383a){_0x4f9c80[_0x0e75('0x81')][_0x0e75('0x99')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2c383a[_0x0e75('0x35')]+','+(_0x4f9c80[_0x0e75('0x80')][_0x0e75('0x9a')]||0xa),'interval':_0x0e75('0x95')});_0x4f9c80[_0x0e75('0x9b')]=![];}return respondWithRpcPromise(_0x0e75('0x9c'),'startRouting',_0x4f9c80);});}return respondWithRpcPromise(_0x0e75('0x9c'),_0x0e75('0x9d'),_0x4f9c80);})[_0x0e75('0x1a')](function(_0xd8034b){respondWithRpcPromise(_0x0e75('0x9e'),_0x0e75('0x9e'),{'event':_0x0e75('0x6d'),'message':_0xd8034b},client9002);return _0xd8034b;})[_0x0e75('0x1a')](respondWithResult(_0x293ed1,null))[_0x0e75('0x24')](handleError(_0x293ed1,null));};exports[_0x0e75('0x9f')]=function(_0x32b2cb,_0x17eb3f,_0x24f62c){return db['OpenchannelAccount'][_0x0e75('0x64')]({'where':{'id':_0x32b2cb[_0x0e75('0x5f')]['id']}})[_0x0e75('0x1a')](handleEntityNotFound(_0x17eb3f,null))['then'](function(_0x4fcff0){if(_0x4fcff0){return db[_0x0e75('0xa0')][_0x0e75('0xa1')](function(_0x4db625){return db[_0x0e75('0x7d')][_0x0e75('0x31')]({'where':{'OpenchannelAccountId':_0x32b2cb[_0x0e75('0x5f')]['id']},'transaction':_0x4db625})['then'](function(_0x4637e7){var _0x113eea=_['map'](_0x32b2cb[_0x0e75('0x55')],function(_0x1e389e){_0x1e389e['OpenchannelAccountId']=_0x32b2cb['params']['id'];return _0x1e389e;});return db[_0x0e75('0x7d')][_0x0e75('0xa2')](_0x113eea,{'transaction':_0x4db625});});})[_0x0e75('0x1a')](function(){return db['OpenchannelApplication'][_0x0e75('0xa3')]({'where':{'OpenchannelAccountId':_0x32b2cb['params']['id']},'order':_0x0e75('0x83')});});}})[_0x0e75('0x1a')](respondWithResult(_0x17eb3f,null))[_0x0e75('0x24')](handleError(_0x17eb3f,null));};exports[_0x0e75('0xa4')]=function(_0x4a2a30,_0x2485d5,_0x1d75c5){var _0x2a1a33={};var _0x153e69={};var _0x157805;var _0x1f8e7a;return db[_0x0e75('0x39')][_0x0e75('0x64')]({'where':{'id':_0x4a2a30[_0x0e75('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2485d5,null))[_0x0e75('0x1a')](function(_0x397926){if(_0x397926){_0x157805=_0x397926;_0x153e69[_0x0e75('0x3e')]=_[_0x0e75('0x53')](db[_0x0e75('0x7d')]['rawAttributes']);_0x153e69[_0x0e75('0x3f')]=_[_0x0e75('0x53')](_0x4a2a30[_0x0e75('0x3f')]);_0x153e69[_0x0e75('0x40')]=_['intersection'](_0x153e69[_0x0e75('0x3e')],_0x153e69[_0x0e75('0x3f')]);_0x2a1a33[_0x0e75('0x43')]=_[_0x0e75('0x41')](_0x153e69['model'],qs['fields'](_0x4a2a30['query'][_0x0e75('0x42')]));_0x2a1a33['attributes']=_0x2a1a33[_0x0e75('0x43')][_0x0e75('0x44')]?_0x2a1a33['attributes']:_0x153e69[_0x0e75('0x3e')];_0x2a1a33[_0x0e75('0x66')]=qs[_0x0e75('0x46')](_0x4a2a30[_0x0e75('0x3f')][_0x0e75('0x46')]);_0x2a1a33['where']=qs[_0x0e75('0x40')](_[_0x0e75('0x48')](_0x4a2a30[_0x0e75('0x3f')],_0x153e69[_0x0e75('0x40')]));if(_0x4a2a30[_0x0e75('0x3f')][_0x0e75('0x49')]){_0x2a1a33[_0x0e75('0x47')]=_[_0x0e75('0x4c')](_0x2a1a33[_0x0e75('0x47')],{'$or':_[_0x0e75('0x4a')](_0x2a1a33['attributes'],function(_0x4e55ea){var _0x31b9b8={};_0x31b9b8[_0x4e55ea]={'$like':'%'+_0x4a2a30[_0x0e75('0x3f')]['filter']+'%'};return _0x31b9b8;})});}_0x2a1a33=_[_0x0e75('0x4c')]({},_0x2a1a33,_0x4a2a30[_0x0e75('0x4d')]);return _0x157805[_0x0e75('0xa4')](_0x2a1a33);}})[_0x0e75('0x1a')](function(_0x333d7b){if(_0x333d7b){_0x1f8e7a=_0x333d7b['length'];if(!_0x4a2a30[_0x0e75('0x3f')][_0x0e75('0x45')](_0x0e75('0x65'))){_0x2a1a33[_0x0e75('0x29')]=qs[_0x0e75('0x29')](_0x4a2a30[_0x0e75('0x3f')][_0x0e75('0x29')]);_0x2a1a33[_0x0e75('0x28')]=qs[_0x0e75('0x28')](_0x4a2a30['query'][_0x0e75('0x28')]);}return _0x157805[_0x0e75('0xa4')](_0x2a1a33);}})[_0x0e75('0x1a')](function(_0x1d6f09){if(_0x1d6f09){return _0x1d6f09?{'count':_0x1f8e7a,'rows':_0x1d6f09}:null;}})['then'](respondWithResult(_0x2485d5,null))[_0x0e75('0x24')](handleError(_0x2485d5,null));};exports['getInteractions']=function(_0x17e7cd,_0x1176dd,_0x2e20ab){var _0x1f3755={'raw':![],'where':{}};var _0x868b60={};var _0x17aeee={'count':0x0,'rows':[]};return db[_0x0e75('0x39')][_0x0e75('0x64')]({'where':{'id':_0x17e7cd[_0x0e75('0x5f')]['id']}})['then'](handleEntityNotFound(_0x1176dd,null))[_0x0e75('0x1a')](function(_0x5511e5){if(_0x5511e5){_0x868b60[_0x0e75('0x3e')]=_[_0x0e75('0x53')](db['OpenchannelInteraction']['rawAttributes']);_0x868b60['query']=_[_0x0e75('0x53')](_0x17e7cd[_0x0e75('0x3f')]);_0x868b60['filters']=_[_0x0e75('0x41')](_0x868b60['model'],_0x868b60[_0x0e75('0x3f')]);_0x1f3755[_0x0e75('0x43')]=_[_0x0e75('0x41')](_0x868b60[_0x0e75('0x3e')],qs['fields'](_0x17e7cd[_0x0e75('0x3f')][_0x0e75('0x42')]));_0x1f3755['attributes']=_0x1f3755[_0x0e75('0x43')]['length']?_0x1f3755[_0x0e75('0x43')]:_0x868b60['model'];if(!_0x17e7cd[_0x0e75('0x3f')][_0x0e75('0x45')]('nolimit')){_0x1f3755[_0x0e75('0x29')]=qs[_0x0e75('0x29')](_0x17e7cd[_0x0e75('0x3f')][_0x0e75('0x29')]);_0x1f3755[_0x0e75('0x28')]=qs[_0x0e75('0x28')](_0x17e7cd[_0x0e75('0x3f')]['offset']);}_0x1f3755[_0x0e75('0x66')]=qs[_0x0e75('0x46')](_0x17e7cd[_0x0e75('0x3f')][_0x0e75('0x46')]);_0x1f3755[_0x0e75('0x47')]=qs[_0x0e75('0x40')](_[_0x0e75('0x48')](_0x17e7cd[_0x0e75('0x3f')],_0x868b60[_0x0e75('0x40')]));_0x1f3755[_0x0e75('0x47')]['OpenchannelAccountId']=_0x5511e5['id'];if(_0x17e7cd[_0x0e75('0x3f')]['filter']){_0x1f3755[_0x0e75('0x47')]=_[_0x0e75('0x4c')](_0x1f3755['where'],{'$or':_[_0x0e75('0x4a')](_0x1f3755['attributes'],function(_0x102f23){var _0x40e949={};_0x40e949[_0x102f23]={'$like':'%'+_0x17e7cd[_0x0e75('0x3f')]['filter']+'%'};return _0x40e949;})});}_0x1f3755=_[_0x0e75('0x4c')]({},_0x1f3755,_0x17e7cd[_0x0e75('0x4d')]);return db[_0x0e75('0x8a')]['count']({'where':_0x1f3755['where']})[_0x0e75('0x1a')](function(_0x53188b){_0x17aeee[_0x0e75('0x27')]=_0x53188b;if(_0x17e7cd[_0x0e75('0x3f')][_0x0e75('0x4e')]){_0x1f3755[_0x0e75('0x4f')]=[{'model':db['CmContact'],'as':_0x0e75('0xa5'),'required':![]},{'model':db[_0x0e75('0x98')],'as':_0x0e75('0xa6'),'attributes':[_0x0e75('0x35'),'fullname','internal'],'required':![]},{'model':db[_0x0e75('0xa7')],'as':_0x0e75('0xa8'),'attributes':['id',_0x0e75('0x35'),_0x0e75('0xa9')],'where':_0x17e7cd[_0x0e75('0x3f')][_0x0e75('0xaa')]?{'id':_0x17e7cd['query']['tag']}:undefined,'required':_0x17e7cd['query'][_0x0e75('0xaa')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x0e75('0x50')](_0x1f3755);})[_0x0e75('0x1a')](function(_0x42bb7d){_0x17aeee[_0x0e75('0x51')]=_0x42bb7d;return _0x17aeee;});}})[_0x0e75('0x1a')](respondWithFilteredResult(_0x1176dd,_0x1f3755))[_0x0e75('0x24')](handleError(_0x1176dd,null));};exports[_0x0e75('0xab')]=function(_0x996a43,_0x56af3b,_0x5d38c1){return db[_0x0e75('0x39')]['find']({'where':{'id':_0x996a43[_0x0e75('0x5f')]['id']}})['then'](handleEntityNotFound(_0x56af3b,null))['then'](function(_0x3957e6){if(_0x3957e6){return _0x3957e6[_0x0e75('0xab')](_0x996a43[_0x0e75('0x55')]['ids'],_[_0x0e75('0xac')](_0x996a43[_0x0e75('0x55')],['ids','id'])||{})[_0x0e75('0x8c')](function(_0xc78dc){for(var _0x1aad37=0x0;_0x1aad37<_0x996a43['body'][_0x0e75('0x69')][_0x0e75('0x44')];_0x1aad37+=0x1){socket[_0x0e75('0xad')]('userOpenchannelAccount:save',{'UserId':_0x996a43['body'][_0x0e75('0x69')][_0x1aad37],'OpenchannelAccountId':_0x996a43[_0x0e75('0x5f')]['id']});}return _0xc78dc;});}})[_0x0e75('0x1a')](respondWithResult(_0x56af3b,null))[_0x0e75('0x24')](handleError(_0x56af3b,null));};exports[_0x0e75('0xae')]=function(_0x5b0f1f,_0x1ee59e,_0x1840a0){return db[_0x0e75('0x39')]['find']({'where':{'id':_0x5b0f1f[_0x0e75('0x5f')]['id']}})[_0x0e75('0x1a')](handleEntityNotFound(_0x1ee59e,null))[_0x0e75('0x1a')](function(_0x9a55d8){if(_0x9a55d8){return _0x9a55d8[_0x0e75('0xae')](_0x5b0f1f[_0x0e75('0x3f')]['ids'])[_0x0e75('0x1a')](function(){if(_[_0x0e75('0xaf')](_0x5b0f1f['query'][_0x0e75('0x69')])){for(var _0xa636fd=0x0;_0xa636fd<_0x5b0f1f[_0x0e75('0x3f')][_0x0e75('0x69')][_0x0e75('0x44')];_0xa636fd+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x5b0f1f[_0x0e75('0x3f')][_0x0e75('0x69')][_0xa636fd]),'OpenchannelAccountId':Number(_0x5b0f1f[_0x0e75('0x5f')]['id'])});}}else{socket[_0x0e75('0xad')](_0x0e75('0xb0'),{'UserId':Number(_0x5b0f1f[_0x0e75('0x3f')][_0x0e75('0x69')]),'OpenchannelAccountId':Number(_0x5b0f1f[_0x0e75('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x1ee59e,null))['catch'](handleError(_0x1ee59e,null));};exports[_0x0e75('0xb1')]=function(_0x4d42d8,_0x465ada,_0x3fd662){var _0x3e7deb={};var _0x440225={};var _0x2cb66f;var _0x26379f;return db[_0x0e75('0x39')][_0x0e75('0x64')]({'where':{'id':_0x4d42d8[_0x0e75('0x5f')]['id']}})[_0x0e75('0x1a')](handleEntityNotFound(_0x465ada,null))[_0x0e75('0x1a')](function(_0x48cf60){if(_0x48cf60){_0x2cb66f=_0x48cf60;_0x440225[_0x0e75('0x3e')]=_[_0x0e75('0x53')](db[_0x0e75('0x98')][_0x0e75('0x3a')]);_0x440225[_0x0e75('0x3f')]=_[_0x0e75('0x53')](_0x4d42d8['query']);_0x440225['filters']=_[_0x0e75('0x41')](_0x440225[_0x0e75('0x3e')],_0x440225[_0x0e75('0x3f')]);_0x3e7deb[_0x0e75('0x43')]=_[_0x0e75('0x41')](_0x440225[_0x0e75('0x3e')],qs[_0x0e75('0x42')](_0x4d42d8['query'][_0x0e75('0x42')]));_0x3e7deb[_0x0e75('0x43')]=_0x3e7deb[_0x0e75('0x43')][_0x0e75('0x44')]?_0x3e7deb[_0x0e75('0x43')]:_0x440225[_0x0e75('0x3e')];_0x3e7deb[_0x0e75('0x66')]=qs['sort'](_0x4d42d8[_0x0e75('0x3f')][_0x0e75('0x46')]);_0x3e7deb[_0x0e75('0x47')]=qs['filters'](_['pick'](_0x4d42d8[_0x0e75('0x3f')],_0x440225['filters']));if(_0x4d42d8['query'][_0x0e75('0x49')]){_0x3e7deb[_0x0e75('0x47')]=_[_0x0e75('0x4c')](_0x3e7deb[_0x0e75('0x47')],{'$or':_[_0x0e75('0x4a')](_0x3e7deb[_0x0e75('0x43')],function(_0x441944){var _0x267d6a={};_0x267d6a[_0x441944]={'$like':'%'+_0x4d42d8[_0x0e75('0x3f')]['filter']+'%'};return _0x267d6a;})});}_0x3e7deb=_[_0x0e75('0x4c')]({},_0x3e7deb,_0x4d42d8['options']);return _0x2cb66f[_0x0e75('0xb1')](_0x3e7deb);}})[_0x0e75('0x1a')](function(_0x18231d){if(_0x18231d){_0x26379f=_0x18231d[_0x0e75('0x44')];if(!_0x4d42d8[_0x0e75('0x3f')][_0x0e75('0x45')](_0x0e75('0x65'))){_0x3e7deb['limit']=qs[_0x0e75('0x29')](_0x4d42d8['query'][_0x0e75('0x29')]);_0x3e7deb[_0x0e75('0x28')]=qs[_0x0e75('0x28')](_0x4d42d8[_0x0e75('0x3f')][_0x0e75('0x28')]);}return _0x2cb66f[_0x0e75('0xb1')](_0x3e7deb);}})[_0x0e75('0x1a')](function(_0x461df7){if(_0x461df7){return _0x461df7?{'count':_0x26379f,'rows':_0x461df7}:null;}})[_0x0e75('0x1a')](respondWithResult(_0x465ada,null))[_0x0e75('0x24')](handleError(_0x465ada,null));};exports[_0x0e75('0x36')]=function(_0x3e30fc,_0x170740,_0x38b369){var _0x2baebf,_0x2f5989,_0x559e07;if(_[_0x0e75('0x77')](_0x3e30fc[_0x0e75('0x55')][_0x0e75('0x55')])||_0x3e30fc[_0x0e75('0x55')][_0x0e75('0x55')]===''){throw new db[(_0x0e75('0x17'))][(_0x0e75('0x6f'))](_0x0e75('0x78'));}if(_[_0x0e75('0x77')](_0x3e30fc['body']['to'])){}_0x2baebf=_0x3e30fc['body']['to'];return db[_0x0e75('0x39')]['findOne']({'where':{'id':_0x3e30fc[_0x0e75('0x5f')]['id']}})['then'](handleEntityNotFound(_0x170740,null))[_0x0e75('0x1a')](function(_0x4f6ff1){if(_0x4f6ff1){return db['OpenchannelAccount']['find']({'where':{'id':_0x4f6ff1['id']},'include':[{'model':db[_0x0e75('0x7b')],'as':_0x0e75('0x7f'),'include':[{'model':db['CmContact'],'as':_0x0e75('0x85'),'where':{[_0x4f6ff1['mapKey']]:_0x2baebf},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x170740,null))[_0x0e75('0x1a')](function(_0x18f41f){if(_0x18f41f&&_0x18f41f[_0x0e75('0x7f')]){_0x2f5989=_0x18f41f[_0x0e75('0x56')]({'plain':!![]});if(_0x2f5989[_0x0e75('0x7f')]&&_0x2f5989[_0x0e75('0x7f')]['Contacts'][_0x0e75('0x44')]){return _0x2f5989['List'][_0x0e75('0x85')][0x0];}return db[_0x0e75('0x6e')]['create'](_[_0x0e75('0x86')](_0x3e30fc[_0x0e75('0x55')],{'firstName':_0x2baebf,[_0x18f41f[_0x0e75('0x79')]]:_0x2baebf,'phone':_0x2baebf,'ListId':_0x2f5989[_0x0e75('0x74')]}));}})[_0x0e75('0x1a')](handleEntityNotFound(_0x170740,null))['then'](function(_0x5f3e9a){if(_0x5f3e9a){_0x559e07=_0x5f3e9a;return db[_0x0e75('0x8a')]['find']({'where':{'ContactId':_0x559e07['id'],'closed':![],'OpenchannelAccountId':_0x2f5989['id']}})['then'](function(_0x1c2e62){if(_0x1c2e62){return[_0x1c2e62,![]];}return db[_0x0e75('0x8a')][_0x0e75('0x54')]({'UserId':_0x3e30fc['user']['id'],'ContactId':_0x559e07['id'],'OpenchannelAccountId':_0x2f5989['id'],'lastMsgDirection':_0x0e75('0xb2'),'Messages':[_[_0x0e75('0x4c')](_0x3e30fc[_0x0e75('0x55')],{'read':![],'body':_0x3e30fc[_0x0e75('0x55')][_0x0e75('0x55')],'OpenchannelAccountId':_0x2f5989['id'],'UserId':_0x3e30fc[_0x0e75('0x59')]['id'],'ContactId':_0x559e07['id']})]},{'include':[{'model':db[_0x0e75('0xb3')],'as':'Messages'}]})[_0x0e75('0x1a')](function(_0x57cd72){return[_0x57cd72,!![]];});});}})[_0x0e75('0x8c')](function(_0x52db01,_0x4f6aeb){if(_0x4f6aeb){return _0x52db01;}return db[_0x0e75('0xb3')][_0x0e75('0x54')](_['merge'](_0x3e30fc[_0x0e75('0x55')],{'read':![],'body':_0x3e30fc['body']['body'],'OpenchannelAccountId':_0x2f5989['id'],'OpenchannelInteractionId':_0x52db01['id'],'UserId':_0x3e30fc[_0x0e75('0x59')]['id'],'ContactId':_0x559e07['id']}))[_0x0e75('0x1a')](function(_0x192c65){_0x52db01['dataValues'][_0x0e75('0xb4')]=[];_0x52db01['dataValues'][_0x0e75('0xb4')][_0x0e75('0x92')](_0x192c65['dataValues']);return _0x52db01;});});}})[_0x0e75('0x1a')](respondWithResult(_0x170740,null))[_0x0e75('0x24')](handleError(_0x170740,null));}; \ No newline at end of file +var _0x5a24=['send','index','mandatoryDispositionPause','OpenchannelAccount','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','Pause','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','Disposition','findOne','rawAttributes','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','OpenchannelApplication','Applications','account','applications','list','List','orderBy','priority','asc','contact','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','bulkCreate','getApplications','Contact','User','Owner','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','set','apply','reject','save','update','then','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name'];(function(_0x1d44d7,_0x3619fd){var _0x31105=function(_0xf8a5a0){while(--_0xf8a5a0){_0x1d44d7['push'](_0x1d44d7['shift']());}};_0x31105(++_0x3619fd);}(_0x5a24,0x1ef));var _0x45a2=function(_0x194f46,_0x2bb869){_0x194f46=_0x194f46-0x0;var _0x1925df=_0x5a24[_0x194f46];return _0x1925df;};'use strict';var pdf=require(_0x45a2('0x0'));var emlformat=require(_0x45a2('0x1'));var rimraf=require(_0x45a2('0x2'));var zipdir=require(_0x45a2('0x3'));var jsonpatch=require(_0x45a2('0x4'));var rp=require(_0x45a2('0x5'));var moment=require('moment');var BPromise=require(_0x45a2('0x6'));var Mustache=require(_0x45a2('0x7'));var util=require(_0x45a2('0x8'));var path=require(_0x45a2('0x9'));var sox=require(_0x45a2('0xa'));var csv=require('to-csv');var ejs=require(_0x45a2('0xb'));var fs=require('fs');var _=require(_0x45a2('0xc'));var squel=require('squel');var crypto=require(_0x45a2('0xd'));var jsforce=require(_0x45a2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x45a2('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x45a2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x45a2('0x11'));var as=require(_0x45a2('0x12'));var hardwareService=require(_0x45a2('0x13'));var logger=require('../../config/logger')(_0x45a2('0x14'));var utils=require('../../config/utils');var config=require(_0x45a2('0x15'));var db=require('../../mysqldb')['db'];config[_0x45a2('0x16')]=_[_0x45a2('0x17')](config[_0x45a2('0x16')],{'host':_0x45a2('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x45a2('0x19')](socket);var jayson=require(_0x45a2('0x1a'));var client=jayson[_0x45a2('0x1b')]['http']({'port':0x232c});var client9002=jayson['client'][_0x45a2('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x369011,_0x3d47c2,_0x4398ae){if(_0x4398ae){var _0x54bfd8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x54bfd8[_0x45a2('0x1d')](_0x3d47c2)){return _0x369011;}else{throw new db[(_0x45a2('0x1e'))][(_0x45a2('0x1f'))](_0x45a2('0x20'));}}else{return _0x369011;}}function respondWithRpcPromise(_0x288311,_0x190523,_0x5264b1,_0x1d6bc0){return new BPromise(function(_0xb4f977,_0x25ae8f){var _0x2df218=_0x1d6bc0||client;return _0x2df218[_0x45a2('0x21')](_0x288311,_0x5264b1)['then'](function(_0x3e7f0c){logger[_0x45a2('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x190523,'request\x20sent');logger[_0x45a2('0x23')](_0x45a2('0x24'),_0x190523,_0x45a2('0x25'),JSON[_0x45a2('0x26')](_0x3e7f0c));if(_0x3e7f0c[_0x45a2('0x27')]){if(_0x3e7f0c[_0x45a2('0x27')][_0x45a2('0x28')]===0x1f4){logger[_0x45a2('0x27')](_0x45a2('0x29'),_0x190523,_0x3e7f0c[_0x45a2('0x27')]['message']);return _0x25ae8f(_0x3e7f0c[_0x45a2('0x27')][_0x45a2('0x2a')]);}logger[_0x45a2('0x27')](_0x45a2('0x29'),_0x190523,_0x3e7f0c[_0x45a2('0x27')][_0x45a2('0x2a')]);return _0xb4f977(_0x3e7f0c['error'][_0x45a2('0x2a')]);}else{logger[_0x45a2('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x190523,'request\x20sent');_0xb4f977(_0x3e7f0c[_0x45a2('0x2b')][_0x45a2('0x2a')]);}})[_0x45a2('0x2c')](function(_0x87c09f){logger['error'](_0x45a2('0x29'),_0x190523,_0x87c09f);_0x25ae8f(_0x87c09f);});});}function respondWithStatusCode(_0x15dd97,_0x3f13f1){_0x3f13f1=_0x3f13f1||0xcc;return function(_0x5c30d1){if(_0x5c30d1){return _0x15dd97[_0x45a2('0x2d')](_0x3f13f1);}return _0x15dd97['status'](_0x3f13f1)[_0x45a2('0x2e')]();};}function respondWithResult(_0x49c4a1,_0x431521){_0x431521=_0x431521||0xc8;return function(_0x59c599){if(_0x59c599){return _0x49c4a1[_0x45a2('0x2f')](_0x431521)[_0x45a2('0x30')](_0x59c599);}};}function respondWithFilteredResult(_0x5c2929,_0x37c784){return function(_0x6f3835){if(_0x6f3835){var _0x5b4c28=_0x6f3835[_0x45a2('0x31')],_0x3889dd=_0x37c784[_0x45a2('0x32')],_0xb9f7d1=_0x37c784[_0x45a2('0x32')]+_0x37c784['limit'],_0x513ccf;if(_0xb9f7d1>=_0x5b4c28){_0xb9f7d1=_0x5b4c28;_0x513ccf=0xc8;}else{_0x513ccf=0xce;}_0x5c2929['status'](_0x513ccf);return _0x5c2929[_0x45a2('0x33')]('Content-Range',_0x3889dd+'-'+_0xb9f7d1+'/'+_0x5b4c28)[_0x45a2('0x30')](_0x6f3835);}return null;};}function patchUpdates(_0x22f7d7){return function(_0xdf8ccf){try{jsonpatch[_0x45a2('0x34')](_0xdf8ccf,_0x22f7d7,!![]);}catch(_0xfa7e97){return BPromise[_0x45a2('0x35')](_0xfa7e97);}return _0xdf8ccf[_0x45a2('0x36')]();};}function saveUpdates(_0x1bda7d,_0x49e17c){return function(_0x1efd24){if(_0x1efd24){return _0x1efd24[_0x45a2('0x37')](_0x1bda7d)[_0x45a2('0x38')](function(_0x83a3f){return _0x83a3f;});}return null;};}function removeEntity(_0x1da7fc,_0x42b0a8){return function(_0x7e2a5){if(_0x7e2a5){return _0x7e2a5[_0x45a2('0x39')]()[_0x45a2('0x38')](function(){var _0xf20d48=_0x7e2a5[_0x45a2('0x3a')]({'plain':!![]});var _0x5ab1c2=_0x45a2('0x3b');return db[_0x45a2('0x3c')][_0x45a2('0x39')]({'where':{'type':_0x5ab1c2,'resourceId':_0xf20d48['id']}})[_0x45a2('0x38')](function(){return _0x7e2a5;});})[_0x45a2('0x38')](function(){_0x1da7fc[_0x45a2('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d6ddc,_0x1bbbea){return function(_0x3b8d96){if(!_0x3b8d96){_0x5d6ddc[_0x45a2('0x2d')](0x194);}return _0x3b8d96;};}function handleError(_0x36f9b5,_0x875a82){_0x875a82=_0x875a82||0x1f4;return function(_0x162a12){logger[_0x45a2('0x27')](_0x162a12[_0x45a2('0x3d')]);if(_0x162a12[_0x45a2('0x3e')]){delete _0x162a12['name'];}_0x36f9b5[_0x45a2('0x2f')](_0x875a82)[_0x45a2('0x3f')](_0x162a12);};}exports[_0x45a2('0x40')]=function(_0x2124ca,_0x45d925){var _0x398b03={'include':[{'model':db['Pause'],'as':_0x45a2('0x41')}]},_0x43d6bc={},_0x2efa42={'count':0x0,'rows':[]};var _0x23e068=_['map'](db[_0x45a2('0x42')]['rawAttributes'],function(_0x3bb2d8){return{'name':_0x3bb2d8['fieldName'],'type':_0x3bb2d8[_0x45a2('0x43')]['key']};});_0x43d6bc[_0x45a2('0x44')]=_[_0x45a2('0x45')](_0x23e068,_0x45a2('0x3e'));_0x43d6bc['query']=_['keys'](_0x2124ca[_0x45a2('0x46')]);_0x43d6bc[_0x45a2('0x47')]=_[_0x45a2('0x48')](_0x43d6bc[_0x45a2('0x44')],_0x43d6bc[_0x45a2('0x46')]);_0x398b03[_0x45a2('0x49')]=_[_0x45a2('0x48')](_0x43d6bc[_0x45a2('0x44')],qs[_0x45a2('0x4a')](_0x2124ca['query'][_0x45a2('0x4a')]));_0x398b03[_0x45a2('0x49')]=_0x398b03[_0x45a2('0x49')][_0x45a2('0x4b')]?_0x398b03[_0x45a2('0x49')]:_0x43d6bc[_0x45a2('0x44')];if(!_0x2124ca['query'][_0x45a2('0x4c')](_0x45a2('0x4d'))){_0x398b03[_0x45a2('0x4e')]=qs['limit'](_0x2124ca[_0x45a2('0x46')]['limit']);_0x398b03[_0x45a2('0x32')]=qs[_0x45a2('0x32')](_0x2124ca[_0x45a2('0x46')][_0x45a2('0x32')]);}_0x398b03[_0x45a2('0x4f')]=qs[_0x45a2('0x50')](_0x2124ca[_0x45a2('0x46')][_0x45a2('0x50')]);_0x398b03[_0x45a2('0x51')]=qs[_0x45a2('0x47')](_[_0x45a2('0x52')](_0x2124ca[_0x45a2('0x46')],_0x43d6bc[_0x45a2('0x47')]));if(_0x2124ca[_0x45a2('0x46')][_0x45a2('0x53')]){_0x398b03[_0x45a2('0x51')]=_[_0x45a2('0x54')](_0x398b03[_0x45a2('0x51')],{'$or':_[_0x45a2('0x45')](_0x23e068,function(_0x1cb04a){if(_0x1cb04a[_0x45a2('0x43')]!==_0x45a2('0x55')){var _0x3ee26d={};_0x3ee26d[_0x1cb04a['name']]={'$like':'%'+_0x2124ca[_0x45a2('0x46')][_0x45a2('0x53')]+'%'};return _0x3ee26d;}})});}_0x398b03=_[_0x45a2('0x54')]({},_0x398b03,_0x2124ca['options']);var _0x5dc7d2={'where':_0x398b03[_0x45a2('0x51')]};return db[_0x45a2('0x42')][_0x45a2('0x31')](_0x5dc7d2)[_0x45a2('0x38')](function(_0x52b600){_0x2efa42['count']=_0x52b600;if(_0x2124ca['query'][_0x45a2('0x56')]){_0x398b03[_0x45a2('0x57')]=[{'all':!![]}];}return db[_0x45a2('0x42')][_0x45a2('0x58')](_0x398b03);})['then'](function(_0x2a7673){_0x2efa42[_0x45a2('0x59')]=_0x2a7673;return _0x2efa42;})[_0x45a2('0x38')](respondWithFilteredResult(_0x45d925,_0x398b03))[_0x45a2('0x2c')](handleError(_0x45d925,null));};exports[_0x45a2('0x5a')]=function(_0x185072,_0x5d0ef5){var _0x2a0415={'raw':![],'where':{'id':_0x185072[_0x45a2('0x5b')]['id']},'include':[{'model':db[_0x45a2('0x5c')],'as':_0x45a2('0x41')}]},_0x3a21b0={};_0x3a21b0['model']=_[_0x45a2('0x5d')](db['OpenchannelAccount']['rawAttributes']);_0x3a21b0[_0x45a2('0x46')]=_['keys'](_0x185072['query']);_0x3a21b0[_0x45a2('0x47')]=_['intersection'](_0x3a21b0[_0x45a2('0x44')],_0x3a21b0[_0x45a2('0x46')]);_0x2a0415[_0x45a2('0x49')]=_[_0x45a2('0x48')](_0x3a21b0[_0x45a2('0x44')],qs[_0x45a2('0x4a')](_0x185072[_0x45a2('0x46')][_0x45a2('0x4a')]));_0x2a0415[_0x45a2('0x49')]=_0x2a0415[_0x45a2('0x49')]['length']?_0x2a0415[_0x45a2('0x49')]:_0x3a21b0[_0x45a2('0x44')];if(_0x185072['query'][_0x45a2('0x56')]){_0x2a0415[_0x45a2('0x57')]=[{'all':!![]}];}_0x2a0415=_[_0x45a2('0x54')]({},_0x2a0415,_0x185072[_0x45a2('0x5e')]);return db['OpenchannelAccount']['find'](_0x2a0415)[_0x45a2('0x38')](handleEntityNotFound(_0x5d0ef5,null))[_0x45a2('0x38')](respondWithResult(_0x5d0ef5,null))['catch'](handleError(_0x5d0ef5,null));};exports[_0x45a2('0x5f')]=function(_0x355dc7,_0x16eb47){return db[_0x45a2('0x42')][_0x45a2('0x5f')](_0x355dc7[_0x45a2('0x60')],{})['then'](function(_0x1502fd){var _0x2d123e=_0x355dc7[_0x45a2('0x61')][_0x45a2('0x3a')]({'plain':!![]});if(!_0x2d123e)throw new Error(_0x45a2('0x62'));if(_0x2d123e[_0x45a2('0x63')]===_0x45a2('0x61')){var _0xbdecd5=_0x1502fd[_0x45a2('0x3a')]({'plain':!![]});var _0x160c31='OpenchannelAccounts';return db[_0x45a2('0x64')]['find']({'where':{'name':_0x160c31,'userProfileId':_0x2d123e[_0x45a2('0x65')]},'raw':!![]})[_0x45a2('0x38')](function(_0x47305f){if(_0x47305f&&_0x47305f['autoAssociation']===0x0){return db[_0x45a2('0x3c')][_0x45a2('0x5f')]({'name':_0xbdecd5[_0x45a2('0x3e')],'resourceId':_0xbdecd5['id'],'type':_0x47305f[_0x45a2('0x3e')],'sectionId':_0x47305f['id']},{})[_0x45a2('0x38')](function(){return _0x1502fd;});}else{return _0x1502fd;}})[_0x45a2('0x2c')](function(_0x2b6d1e){logger[_0x45a2('0x27')](_0x45a2('0x66'),_0x2b6d1e);throw _0x2b6d1e;});}return _0x1502fd;})[_0x45a2('0x38')](respondWithResult(_0x16eb47,0xc9))[_0x45a2('0x2c')](handleError(_0x16eb47,null));};exports['update']=function(_0x254f5a,_0x36ee92){if(_0x254f5a['body']['id']){delete _0x254f5a['body']['id'];}return db['OpenchannelAccount'][_0x45a2('0x67')]({'where':{'id':_0x254f5a['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x45a2('0x38')](handleEntityNotFound(_0x36ee92,null))[_0x45a2('0x38')](saveUpdates(_0x254f5a[_0x45a2('0x60')],null))['then'](respondWithResult(_0x36ee92,null))[_0x45a2('0x2c')](handleError(_0x36ee92,null));};exports[_0x45a2('0x39')]=function(_0x5646f6,_0x11b870){return db[_0x45a2('0x42')][_0x45a2('0x67')]({'where':{'id':_0x5646f6[_0x45a2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x11b870,null))[_0x45a2('0x38')](removeEntity(_0x11b870,null))[_0x45a2('0x2c')](handleError(_0x11b870,null));};exports['describe']=function(_0x15e91c,_0x45f8d){return db['OpenchannelAccount'][_0x45a2('0x68')]()[_0x45a2('0x38')](respondWithResult(_0x45f8d,null))[_0x45a2('0x2c')](handleError(_0x45f8d,null));};exports[_0x45a2('0x69')]=function(_0x2a5cee,_0x48e729,_0x451ccb){if(_0x2a5cee[_0x45a2('0x60')]['id']){delete _0x2a5cee[_0x45a2('0x60')]['id'];}return db['OpenchannelAccount'][_0x45a2('0x67')]({'where':{'id':_0x2a5cee[_0x45a2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x48e729,null))[_0x45a2('0x38')](function(_0x6cbe28){if(_0x6cbe28){_0x2a5cee[_0x45a2('0x60')]['OpnechannelAccountId']=_0x6cbe28['id'];return db[_0x45a2('0x6a')]['create'](_0x2a5cee['body']);}})['then'](respondWithResult(_0x48e729,null))['catch'](handleError(_0x48e729,null));};exports['getDispositions']=function(_0x38271a,_0x5ca169,_0xa29792){var _0x18881a={'raw':![],'where':{}};var _0x535ade={};var _0x3909bf={'count':0x0,'rows':[]};return db[_0x45a2('0x42')][_0x45a2('0x6b')]({'where':{'id':_0x38271a[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x5ca169,null))[_0x45a2('0x38')](function(_0x148519){if(_0x148519){_0x535ade[_0x45a2('0x44')]=_[_0x45a2('0x5d')](db[_0x45a2('0x6a')][_0x45a2('0x6c')]);_0x535ade[_0x45a2('0x46')]=_[_0x45a2('0x5d')](_0x38271a[_0x45a2('0x46')]);_0x535ade[_0x45a2('0x47')]=_[_0x45a2('0x48')](_0x535ade[_0x45a2('0x44')],_0x535ade[_0x45a2('0x46')]);_0x18881a[_0x45a2('0x49')]=_[_0x45a2('0x48')](_0x535ade[_0x45a2('0x44')],qs[_0x45a2('0x4a')](_0x38271a[_0x45a2('0x46')][_0x45a2('0x4a')]));_0x18881a[_0x45a2('0x49')]=_0x18881a['attributes']['length']?_0x18881a[_0x45a2('0x49')]:_0x535ade[_0x45a2('0x44')];if(!_0x38271a[_0x45a2('0x46')][_0x45a2('0x4c')]('nolimit')){_0x18881a[_0x45a2('0x4e')]=qs[_0x45a2('0x4e')](_0x38271a[_0x45a2('0x46')]['limit']);_0x18881a[_0x45a2('0x32')]=qs[_0x45a2('0x32')](_0x38271a[_0x45a2('0x46')][_0x45a2('0x32')]);}_0x18881a[_0x45a2('0x4f')]=qs[_0x45a2('0x50')](_0x38271a[_0x45a2('0x46')][_0x45a2('0x50')]);_0x18881a[_0x45a2('0x51')]=qs['filters'](_[_0x45a2('0x52')](_0x38271a[_0x45a2('0x46')],_0x535ade[_0x45a2('0x47')]));_0x18881a[_0x45a2('0x51')][_0x45a2('0x6d')]=_0x148519['id'];if(_0x38271a[_0x45a2('0x46')][_0x45a2('0x53')]){_0x18881a[_0x45a2('0x51')]=_[_0x45a2('0x54')](_0x18881a[_0x45a2('0x51')],{'$or':_['map'](_0x18881a[_0x45a2('0x49')],function(_0x4d5bdc){var _0x2f969c={};_0x2f969c[_0x4d5bdc]={'$like':'%'+_0x38271a['query'][_0x45a2('0x53')]+'%'};return _0x2f969c;})});}_0x18881a=_['merge']({},_0x18881a,_0x38271a['options']);return db['Disposition'][_0x45a2('0x31')]({'where':_0x18881a[_0x45a2('0x51')]})[_0x45a2('0x38')](function(_0x29c826){_0x3909bf[_0x45a2('0x31')]=_0x29c826;if(_0x38271a[_0x45a2('0x46')][_0x45a2('0x56')]){_0x18881a[_0x45a2('0x57')]=[{'all':!![]}];}return db[_0x45a2('0x6a')][_0x45a2('0x58')](_0x18881a);})['then'](function(_0x1ae54b){_0x3909bf[_0x45a2('0x59')]=_0x1ae54b;return _0x3909bf;});}})[_0x45a2('0x38')](respondWithFilteredResult(_0x5ca169,_0x18881a))[_0x45a2('0x2c')](handleError(_0x5ca169,null));};exports[_0x45a2('0x6e')]=function(_0x11ba5a,_0x19dd8c,_0x152b34){return db[_0x45a2('0x42')][_0x45a2('0x67')]({'where':{'id':_0x11ba5a[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x19dd8c,null))['then'](function(_0x33b63c){if(_0x33b63c){return _0x33b63c['removeDispositions'](_0x11ba5a[_0x45a2('0x46')][_0x45a2('0x6f')]);}})[_0x45a2('0x38')](respondWithStatusCode(_0x19dd8c,null))[_0x45a2('0x2c')](handleError(_0x19dd8c,null));};exports[_0x45a2('0x70')]=function(_0x236a59,_0x3c23da,_0x1a2e81){if(_0x236a59['body']['id']){delete _0x236a59[_0x45a2('0x60')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x236a59[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x3c23da,null))[_0x45a2('0x38')](function(_0x141790){if(_0x141790){_0x236a59['body'][_0x45a2('0x6d')]=_0x141790['id'];return db[_0x45a2('0x71')][_0x45a2('0x5f')](_0x236a59[_0x45a2('0x60')]);}})[_0x45a2('0x38')](respondWithResult(_0x3c23da,null))['catch'](handleError(_0x3c23da,null));};exports[_0x45a2('0x72')]=function(_0x42ad81,_0x587894,_0x1966c4){var _0x3e11cf={'raw':![],'where':{}};var _0x3b807f={};var _0x443f43={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x45a2('0x6b')]({'where':{'id':_0x42ad81[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x587894,null))[_0x45a2('0x38')](function(_0x30e389){if(_0x30e389){_0x3b807f[_0x45a2('0x44')]=_['keys'](db[_0x45a2('0x71')]['rawAttributes']);_0x3b807f[_0x45a2('0x46')]=_['keys'](_0x42ad81[_0x45a2('0x46')]);_0x3b807f['filters']=_['intersection'](_0x3b807f[_0x45a2('0x44')],_0x3b807f['query']);_0x3e11cf[_0x45a2('0x49')]=_['intersection'](_0x3b807f[_0x45a2('0x44')],qs[_0x45a2('0x4a')](_0x42ad81[_0x45a2('0x46')][_0x45a2('0x4a')]));_0x3e11cf['attributes']=_0x3e11cf[_0x45a2('0x49')][_0x45a2('0x4b')]?_0x3e11cf['attributes']:_0x3b807f[_0x45a2('0x44')];if(!_0x42ad81['query']['hasOwnProperty'](_0x45a2('0x4d'))){_0x3e11cf[_0x45a2('0x4e')]=qs['limit'](_0x42ad81[_0x45a2('0x46')][_0x45a2('0x4e')]);_0x3e11cf[_0x45a2('0x32')]=qs[_0x45a2('0x32')](_0x42ad81[_0x45a2('0x46')][_0x45a2('0x32')]);}_0x3e11cf[_0x45a2('0x4f')]=qs[_0x45a2('0x50')](_0x42ad81['query']['sort']);_0x3e11cf['where']=qs[_0x45a2('0x47')](_[_0x45a2('0x52')](_0x42ad81['query'],_0x3b807f[_0x45a2('0x47')]));_0x3e11cf[_0x45a2('0x51')][_0x45a2('0x6d')]=_0x30e389['id'];if(_0x42ad81[_0x45a2('0x46')][_0x45a2('0x53')]){_0x3e11cf[_0x45a2('0x51')]=_['merge'](_0x3e11cf[_0x45a2('0x51')],{'$or':_['map'](_0x3e11cf[_0x45a2('0x49')],function(_0x25be9f){var _0x54fc91={};_0x54fc91[_0x25be9f]={'$like':'%'+_0x42ad81[_0x45a2('0x46')][_0x45a2('0x53')]+'%'};return _0x54fc91;})});}_0x3e11cf=_['merge']({},_0x3e11cf,_0x42ad81[_0x45a2('0x5e')]);return db[_0x45a2('0x71')][_0x45a2('0x31')]({'where':_0x3e11cf[_0x45a2('0x51')]})[_0x45a2('0x38')](function(_0x1824e8){_0x443f43['count']=_0x1824e8;if(_0x42ad81['query'][_0x45a2('0x56')]){_0x3e11cf[_0x45a2('0x57')]=[{'all':!![]}];}return db[_0x45a2('0x71')][_0x45a2('0x58')](_0x3e11cf);})[_0x45a2('0x38')](function(_0x3281ee){_0x443f43[_0x45a2('0x59')]=_0x3281ee;return _0x443f43;});}})[_0x45a2('0x38')](respondWithFilteredResult(_0x587894,_0x3e11cf))['catch'](handleError(_0x587894,null));};exports[_0x45a2('0x73')]=function(_0x13bd57,_0x131383,_0xaa2bec){return db['OpenchannelAccount']['find']({'where':{'id':_0x13bd57['params']['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x131383,null))[_0x45a2('0x38')](function(_0x44f0d0){if(_0x44f0d0){return _0x44f0d0[_0x45a2('0x73')](_0x13bd57[_0x45a2('0x46')][_0x45a2('0x6f')]);}})[_0x45a2('0x38')](respondWithStatusCode(_0x131383,null))[_0x45a2('0x2c')](handleError(_0x131383,null));};exports[_0x45a2('0x74')]=function(_0x42a0c9,_0x9ae6c7,_0x24aab1){var _0x3cd5d0={'body':_0x42a0c9[_0x45a2('0x60')],'channel':'openchannel'};var _0xbf79d9=[];var _0x11f378=[];var _0x860911={};var _0x27f24d=![];return db[_0x45a2('0x75')]['describe']()[_0x45a2('0x38')](function(_0x510a0b){if(!_0x510a0b){throw new db[(_0x45a2('0x1e'))][(_0x45a2('0x1f'))](_0x45a2('0x76'));}_0xbf79d9=_[_0x45a2('0x77')](_['keys'](_0x510a0b),[_0x45a2('0x78'),_0x45a2('0x79')]);_0x11f378=_[_0x45a2('0x77')](_['keys'](_0x510a0b),['createdAt','updatedAt',_0x45a2('0x7a'),_0x45a2('0x7b')]);if(_0x42a0c9[_0x45a2('0x60')]['id']){delete _0x42a0c9[_0x45a2('0x60')]['id'];}if(_[_0x45a2('0x7c')](_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x7d')])){throw new db[(_0x45a2('0x1e'))][(_0x45a2('0x1f'))](_0x45a2('0x7e'));}if(_[_0x45a2('0x7c')](_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x60')])||_0x42a0c9[_0x45a2('0x60')]['body']===''){throw new db[(_0x45a2('0x1e'))][(_0x45a2('0x1f'))](_0x45a2('0x7f'));}if(_['isNil'](_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x80')])){throw new db['Sequelize'][(_0x45a2('0x1f'))](_0x45a2('0x81')+_0x11f378);}if(!_[_0x45a2('0x82')](_0x11f378,_0x42a0c9['body'][_0x45a2('0x80')])){throw new db['Sequelize'][(_0x45a2('0x1f'))](_0x45a2('0x83')+_0x11f378);}_0x860911[_0x42a0c9[_0x45a2('0x60')]['mapKey']]=_0x42a0c9['body'][_0x45a2('0x7d')];})[_0x45a2('0x38')](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x42a0c9[_0x45a2('0x5b')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x45a2('0x75')],'as':_0x45a2('0x84'),'where':_0x860911,'limit':0x1,'order':[[_0x45a2('0x79'),_0x45a2('0x85')]]}]},{'model':db[_0x45a2('0x86')],'as':_0x45a2('0x87')}]});})[_0x45a2('0x38')](handleEntityNotFound(_0x9ae6c7,null))[_0x45a2('0x38')](function(_0x362993){if(_0x362993&&_0x362993['List']){_0x3cd5d0[_0x45a2('0x88')]=_0x362993;_0x3cd5d0[_0x45a2('0x89')]=_0x362993[_0x45a2('0x87')];_0x3cd5d0[_0x45a2('0x8a')]=_0x362993[_0x45a2('0x8b')];_0x3cd5d0['applications']=_[_0x45a2('0x8c')](_0x3cd5d0[_0x45a2('0x89')],[_0x45a2('0x8d')],[_0x45a2('0x8e')]);if(_0x3cd5d0[_0x45a2('0x88')][_0x45a2('0x87')]){delete _0x3cd5d0[_0x45a2('0x88')][_0x45a2('0x87')];}if(_0x3cd5d0['account']['List']&&_0x3cd5d0[_0x45a2('0x88')][_0x45a2('0x8b')]['Contacts']['length']){return _0x3cd5d0[_0x45a2('0x88')][_0x45a2('0x8b')]['Contacts'][0x0];}var _0xe7a929=_[_0x45a2('0x17')](_0x42a0c9[_0x45a2('0x60')],{'firstName':_0x42a0c9[_0x45a2('0x60')]['from'],'ListId':_0x362993['ListId']});_0xe7a929[_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x80')]]=_0x42a0c9['body'][_0x45a2('0x7d')];return db['CmContact']['create'](_0xe7a929,{'fields':_0xbf79d9,'raw':!![]});}})[_0x45a2('0x38')](handleEntityNotFound(_0x9ae6c7,null))[_0x45a2('0x38')](function(_0x41d421){_0x3cd5d0[_0x45a2('0x8f')]=_0x41d421;if(_0x41d421){var _0x239cb3={'ContactId':_0x41d421['id'],'OpenchannelAccountId':_0x42a0c9[_0x45a2('0x5b')]['id'],'from':(_0x41d421[_0x45a2('0x90')]||'')+'\x20'+(_0x41d421['lastName']||'')};var _0x980e53={'OpenchannelAccountId':_0x42a0c9[_0x45a2('0x5b')]['id'],'closed':![]};if(_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x91')]){_0x980e53[_0x45a2('0x91')]=_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x91')];return db[_0x45a2('0x92')][_0x45a2('0x67')]({'where':_0x980e53})['then'](function(_0x117c8f){if(_0x117c8f){return[_0x117c8f,![]];}_0x239cb3['threadId']=_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x91')];_0x239cb3[_0x45a2('0x93')]=_0x42a0c9['body'][_0x45a2('0x93')];return db['OpenchannelInteraction'][_0x45a2('0x5f')](_0x239cb3)['then'](function(_0xe91a4){return[_0xe91a4,!![]];});});}else{_0x980e53[_0x45a2('0x91')]=null;}_0x980e53[_0x45a2('0x94')]=_0x41d421['id'];return db[_0x45a2('0x92')]['find']({'where':_0x980e53})[_0x45a2('0x38')](function(_0x34e497){if(_0x34e497){return[_0x34e497,![]];}return db[_0x45a2('0x92')]['create'](_0x239cb3)[_0x45a2('0x38')](function(_0x135259){return[_0x135259,!![]];});});}})[_0x45a2('0x95')](function(_0x2b988a,_0x3a7058){if(_0x2b988a){_0x27f24d=_0x3a7058;if(!_0x3a7058){var _0x554b29={'from':(_0x3cd5d0[_0x45a2('0x8f')]['firstName']||'')+'\x20'+(_0x3cd5d0[_0x45a2('0x8f')]['lastName']||'')};if(_0x42a0c9[_0x45a2('0x60')]['threadId']&&_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x96')]&&_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x91')]!=_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x96')]){_0x554b29['threadId']=_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x96')];}return _0x2b988a['update'](_0x554b29);}else{return _0x2b988a;}}})[_0x45a2('0x38')](function(_0x13a5e1){_0x3cd5d0[_0x45a2('0x97')]=_0x13a5e1[_0x45a2('0x3a')]({'plain':!![]});_0x3cd5d0[_0x45a2('0x97')]['created']=_0x27f24d;if(_0x3cd5d0[_0x45a2('0x97')]['created']){if(_0x3cd5d0[_0x45a2('0x88')]['autoclose']){_0x3cd5d0[_0x45a2('0x89')]['push']({'id':0x0,'priority':_0x3cd5d0['applications']['length']+0x1,'app':_0x45a2('0x98'),'appdata':_0x45a2('0x99'),'interval':_0x45a2('0x9a')});}}return db[_0x45a2('0x9b')]['create']({'body':_0x42a0c9[_0x45a2('0x60')]['body'],'OpenchannelAccountId':_0x42a0c9[_0x45a2('0x5b')]['id'],'OpenchannelInteractionId':_0x13a5e1['id'],'direction':'in','ContactId':_0x3cd5d0[_0x45a2('0x8f')]['id'],'AttachmentId':_0x42a0c9[_0x45a2('0x60')][_0x45a2('0x9c')]});})['then'](function(_0x3c90d2){_0x3cd5d0[_0x45a2('0x2a')]=_0x3c90d2;if(_0x3cd5d0[_0x45a2('0x97')][_0x45a2('0x9d')]){return db['User'][_0x45a2('0x67')]({'attributes':['id',_0x45a2('0x3e')],'where':{'id':_0x3cd5d0['interaction'][_0x45a2('0x9d')]}})[_0x45a2('0x38')](function(_0x582ad8){if(_0x582ad8){_0x3cd5d0['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x45a2('0x9e'),'appdata':_0x582ad8[_0x45a2('0x3e')]+','+(_0x3cd5d0['account'][_0x45a2('0x9f')]||0xa),'interval':_0x45a2('0x9a')});_0x3cd5d0[_0x45a2('0xa0')]=![];}return respondWithRpcPromise(_0x45a2('0xa1'),'startRouting',_0x3cd5d0);});}return respondWithRpcPromise('Start',_0x45a2('0xa2'),_0x3cd5d0);})['then'](function(_0x3a14b2){respondWithRpcPromise('EventManager',_0x45a2('0xa3'),{'event':_0x45a2('0x74'),'message':_0x3a14b2},client9002);return _0x3a14b2;})[_0x45a2('0x38')](respondWithResult(_0x9ae6c7,null))[_0x45a2('0x2c')](handleError(_0x9ae6c7,null));};exports[_0x45a2('0xa4')]=function(_0x97c5d6,_0x2ab946,_0x31bee6){return db[_0x45a2('0x42')][_0x45a2('0x6b')]({'where':{'id':_0x97c5d6[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x2ab946,null))[_0x45a2('0x38')](function(_0x157ee2){if(_0x157ee2){return db['sequelize'][_0x45a2('0xa5')](function(_0x21e315){return db[_0x45a2('0x86')][_0x45a2('0x39')]({'where':{'OpenchannelAccountId':_0x97c5d6[_0x45a2('0x5b')]['id']},'transaction':_0x21e315})[_0x45a2('0x38')](function(_0x606d25){var _0x2f8abe=_[_0x45a2('0x45')](_0x97c5d6[_0x45a2('0x60')],function(_0x2758b4){_0x2758b4[_0x45a2('0x6d')]=_0x97c5d6[_0x45a2('0x5b')]['id'];return _0x2758b4;});return db[_0x45a2('0x86')][_0x45a2('0xa6')](_0x2f8abe,{'transaction':_0x21e315});});})[_0x45a2('0x38')](function(){return db[_0x45a2('0x86')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x97c5d6['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x2ab946,null))[_0x45a2('0x2c')](handleError(_0x2ab946,null));};exports[_0x45a2('0xa7')]=function(_0x2238ca,_0x1faace,_0x292c94){var _0x5aa97c={};var _0x52eece={};var _0x33d19e;var _0x92149d;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x2238ca[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x1faace,null))['then'](function(_0x1e18ae){if(_0x1e18ae){_0x33d19e=_0x1e18ae;_0x52eece[_0x45a2('0x44')]=_[_0x45a2('0x5d')](db[_0x45a2('0x86')]['rawAttributes']);_0x52eece[_0x45a2('0x46')]=_[_0x45a2('0x5d')](_0x2238ca[_0x45a2('0x46')]);_0x52eece[_0x45a2('0x47')]=_[_0x45a2('0x48')](_0x52eece[_0x45a2('0x44')],_0x52eece[_0x45a2('0x46')]);_0x5aa97c[_0x45a2('0x49')]=_['intersection'](_0x52eece[_0x45a2('0x44')],qs[_0x45a2('0x4a')](_0x2238ca[_0x45a2('0x46')][_0x45a2('0x4a')]));_0x5aa97c[_0x45a2('0x49')]=_0x5aa97c[_0x45a2('0x49')][_0x45a2('0x4b')]?_0x5aa97c['attributes']:_0x52eece[_0x45a2('0x44')];_0x5aa97c['order']=qs[_0x45a2('0x50')](_0x2238ca['query']['sort']);_0x5aa97c[_0x45a2('0x51')]=qs[_0x45a2('0x47')](_[_0x45a2('0x52')](_0x2238ca[_0x45a2('0x46')],_0x52eece[_0x45a2('0x47')]));if(_0x2238ca[_0x45a2('0x46')][_0x45a2('0x53')]){_0x5aa97c[_0x45a2('0x51')]=_['merge'](_0x5aa97c[_0x45a2('0x51')],{'$or':_[_0x45a2('0x45')](_0x5aa97c['attributes'],function(_0x4fe0df){var _0xf2930b={};_0xf2930b[_0x4fe0df]={'$like':'%'+_0x2238ca[_0x45a2('0x46')][_0x45a2('0x53')]+'%'};return _0xf2930b;})});}_0x5aa97c=_[_0x45a2('0x54')]({},_0x5aa97c,_0x2238ca[_0x45a2('0x5e')]);return _0x33d19e[_0x45a2('0xa7')](_0x5aa97c);}})[_0x45a2('0x38')](function(_0x537e7b){if(_0x537e7b){_0x92149d=_0x537e7b['length'];if(!_0x2238ca[_0x45a2('0x46')]['hasOwnProperty'](_0x45a2('0x4d'))){_0x5aa97c[_0x45a2('0x4e')]=qs[_0x45a2('0x4e')](_0x2238ca[_0x45a2('0x46')][_0x45a2('0x4e')]);_0x5aa97c[_0x45a2('0x32')]=qs['offset'](_0x2238ca['query'][_0x45a2('0x32')]);}return _0x33d19e[_0x45a2('0xa7')](_0x5aa97c);}})[_0x45a2('0x38')](function(_0x1f61b0){if(_0x1f61b0){return _0x1f61b0?{'count':_0x92149d,'rows':_0x1f61b0}:null;}})[_0x45a2('0x38')](respondWithResult(_0x1faace,null))[_0x45a2('0x2c')](handleError(_0x1faace,null));};exports['getInteractions']=function(_0x23b15b,_0x5108de,_0x17cc55){var _0x281586={'raw':![],'where':{}};var _0x54f8e4={};var _0x339cf1={'count':0x0,'rows':[]};return db[_0x45a2('0x42')][_0x45a2('0x6b')]({'where':{'id':_0x23b15b[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x5108de,null))[_0x45a2('0x38')](function(_0xb5c22d){if(_0xb5c22d){_0x54f8e4['model']=_[_0x45a2('0x5d')](db[_0x45a2('0x92')][_0x45a2('0x6c')]);_0x54f8e4[_0x45a2('0x46')]=_[_0x45a2('0x5d')](_0x23b15b[_0x45a2('0x46')]);_0x54f8e4['filters']=_[_0x45a2('0x48')](_0x54f8e4[_0x45a2('0x44')],_0x54f8e4[_0x45a2('0x46')]);_0x281586[_0x45a2('0x49')]=_[_0x45a2('0x48')](_0x54f8e4[_0x45a2('0x44')],qs['fields'](_0x23b15b['query'][_0x45a2('0x4a')]));_0x281586[_0x45a2('0x49')]=_0x281586['attributes'][_0x45a2('0x4b')]?_0x281586[_0x45a2('0x49')]:_0x54f8e4[_0x45a2('0x44')];if(!_0x23b15b[_0x45a2('0x46')][_0x45a2('0x4c')](_0x45a2('0x4d'))){_0x281586[_0x45a2('0x4e')]=qs['limit'](_0x23b15b['query'][_0x45a2('0x4e')]);_0x281586[_0x45a2('0x32')]=qs['offset'](_0x23b15b[_0x45a2('0x46')][_0x45a2('0x32')]);}_0x281586['order']=qs[_0x45a2('0x50')](_0x23b15b[_0x45a2('0x46')][_0x45a2('0x50')]);_0x281586[_0x45a2('0x51')]=qs[_0x45a2('0x47')](_[_0x45a2('0x52')](_0x23b15b['query'],_0x54f8e4[_0x45a2('0x47')]));_0x281586[_0x45a2('0x51')]['OpenchannelAccountId']=_0xb5c22d['id'];if(_0x23b15b['query']['filter']){_0x281586[_0x45a2('0x51')]=_[_0x45a2('0x54')](_0x281586['where'],{'$or':_[_0x45a2('0x45')](_0x281586[_0x45a2('0x49')],function(_0x10157a){var _0x326749={};_0x326749[_0x10157a]={'$like':'%'+_0x23b15b[_0x45a2('0x46')][_0x45a2('0x53')]+'%'};return _0x326749;})});}_0x281586=_[_0x45a2('0x54')]({},_0x281586,_0x23b15b[_0x45a2('0x5e')]);return db[_0x45a2('0x92')][_0x45a2('0x31')]({'where':_0x281586[_0x45a2('0x51')]})['then'](function(_0x2f88fb){_0x339cf1['count']=_0x2f88fb;if(_0x23b15b['query'][_0x45a2('0x56')]){_0x281586['include']=[{'model':db['CmContact'],'as':_0x45a2('0xa8'),'required':![]},{'model':db[_0x45a2('0xa9')],'as':_0x45a2('0xaa'),'attributes':[_0x45a2('0x3e'),_0x45a2('0xab'),_0x45a2('0xac')],'required':![]},{'model':db[_0x45a2('0xad')],'as':_0x45a2('0xae'),'attributes':['id','name','color'],'where':_0x23b15b[_0x45a2('0x46')][_0x45a2('0xaf')]?{'id':_0x23b15b[_0x45a2('0x46')][_0x45a2('0xaf')]}:undefined,'required':_0x23b15b['query'][_0x45a2('0xaf')]?!![]:![]}];}return db[_0x45a2('0x92')][_0x45a2('0x58')](_0x281586);})[_0x45a2('0x38')](function(_0x54b2ba){_0x339cf1[_0x45a2('0x59')]=_0x54b2ba;return _0x339cf1;});}})[_0x45a2('0x38')](respondWithFilteredResult(_0x5108de,_0x281586))[_0x45a2('0x2c')](handleError(_0x5108de,null));};exports[_0x45a2('0xb0')]=function(_0x1a59df,_0x1bd5c5,_0x266997){return db['OpenchannelAccount'][_0x45a2('0x67')]({'where':{'id':_0x1a59df['params']['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x1bd5c5,null))[_0x45a2('0x38')](function(_0x49eb16){if(_0x49eb16){return _0x49eb16[_0x45a2('0xb0')](_0x1a59df['body'][_0x45a2('0x6f')],_[_0x45a2('0xb1')](_0x1a59df[_0x45a2('0x60')],[_0x45a2('0x6f'),'id'])||{})['spread'](function(_0x1fcc78){for(var _0x46d475=0x0;_0x46d475<_0x1a59df[_0x45a2('0x60')][_0x45a2('0x6f')]['length'];_0x46d475+=0x1){socket[_0x45a2('0xb2')](_0x45a2('0xb3'),{'UserId':_0x1a59df['body'][_0x45a2('0x6f')][_0x46d475],'OpenchannelAccountId':_0x1a59df['params']['id']});}return _0x1fcc78;});}})[_0x45a2('0x38')](respondWithResult(_0x1bd5c5,null))['catch'](handleError(_0x1bd5c5,null));};exports[_0x45a2('0xb4')]=function(_0x1e7cf4,_0x530039,_0x1b019f){return db[_0x45a2('0x42')][_0x45a2('0x67')]({'where':{'id':_0x1e7cf4[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x530039,null))['then'](function(_0x252da8){if(_0x252da8){return _0x252da8[_0x45a2('0xb4')](_0x1e7cf4[_0x45a2('0x46')][_0x45a2('0x6f')])['then'](function(){if(_['isArray'](_0x1e7cf4[_0x45a2('0x46')]['ids'])){for(var _0x2d55bb=0x0;_0x2d55bb<_0x1e7cf4[_0x45a2('0x46')][_0x45a2('0x6f')][_0x45a2('0x4b')];_0x2d55bb+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x1e7cf4[_0x45a2('0x46')]['ids'][_0x2d55bb]),'OpenchannelAccountId':Number(_0x1e7cf4['params']['id'])});}}else{socket['emit'](_0x45a2('0xb5'),{'UserId':Number(_0x1e7cf4[_0x45a2('0x46')][_0x45a2('0x6f')]),'OpenchannelAccountId':Number(_0x1e7cf4['params']['id'])});}});}})[_0x45a2('0x38')](respondWithStatusCode(_0x530039,null))[_0x45a2('0x2c')](handleError(_0x530039,null));};exports['getAgents']=function(_0x43b1e6,_0xe7a80d,_0x376c17){var _0xd74dad={};var _0x1ea9a5={};var _0x51bdf4;var _0x6c1ab3;return db[_0x45a2('0x42')][_0x45a2('0x6b')]({'where':{'id':_0x43b1e6[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0xe7a80d,null))[_0x45a2('0x38')](function(_0x51d74e){if(_0x51d74e){_0x51bdf4=_0x51d74e;_0x1ea9a5[_0x45a2('0x44')]=_[_0x45a2('0x5d')](db['User']['rawAttributes']);_0x1ea9a5[_0x45a2('0x46')]=_[_0x45a2('0x5d')](_0x43b1e6[_0x45a2('0x46')]);_0x1ea9a5[_0x45a2('0x47')]=_['intersection'](_0x1ea9a5['model'],_0x1ea9a5['query']);_0xd74dad[_0x45a2('0x49')]=_[_0x45a2('0x48')](_0x1ea9a5['model'],qs[_0x45a2('0x4a')](_0x43b1e6['query']['fields']));_0xd74dad[_0x45a2('0x49')]=_0xd74dad[_0x45a2('0x49')][_0x45a2('0x4b')]?_0xd74dad[_0x45a2('0x49')]:_0x1ea9a5[_0x45a2('0x44')];_0xd74dad[_0x45a2('0x4f')]=qs[_0x45a2('0x50')](_0x43b1e6[_0x45a2('0x46')]['sort']);_0xd74dad[_0x45a2('0x51')]=qs[_0x45a2('0x47')](_['pick'](_0x43b1e6[_0x45a2('0x46')],_0x1ea9a5[_0x45a2('0x47')]));if(_0x43b1e6[_0x45a2('0x46')][_0x45a2('0x53')]){_0xd74dad[_0x45a2('0x51')]=_['merge'](_0xd74dad[_0x45a2('0x51')],{'$or':_['map'](_0xd74dad[_0x45a2('0x49')],function(_0x4969e3){var _0x2ae9a1={};_0x2ae9a1[_0x4969e3]={'$like':'%'+_0x43b1e6[_0x45a2('0x46')][_0x45a2('0x53')]+'%'};return _0x2ae9a1;})});}_0xd74dad=_['merge']({},_0xd74dad,_0x43b1e6[_0x45a2('0x5e')]);return _0x51bdf4[_0x45a2('0xb6')](_0xd74dad);}})[_0x45a2('0x38')](function(_0x475ad1){if(_0x475ad1){_0x6c1ab3=_0x475ad1[_0x45a2('0x4b')];if(!_0x43b1e6[_0x45a2('0x46')][_0x45a2('0x4c')]('nolimit')){_0xd74dad[_0x45a2('0x4e')]=qs[_0x45a2('0x4e')](_0x43b1e6[_0x45a2('0x46')]['limit']);_0xd74dad['offset']=qs[_0x45a2('0x32')](_0x43b1e6[_0x45a2('0x46')][_0x45a2('0x32')]);}return _0x51bdf4['getAgents'](_0xd74dad);}})[_0x45a2('0x38')](function(_0x27441e){if(_0x27441e){return _0x27441e?{'count':_0x6c1ab3,'rows':_0x27441e}:null;}})[_0x45a2('0x38')](respondWithResult(_0xe7a80d,null))[_0x45a2('0x2c')](handleError(_0xe7a80d,null));};exports[_0x45a2('0x3f')]=function(_0x1e0bc9,_0x59cb81,_0x158336){var _0x15b28f,_0x1049f3,_0x3e34f9;if(_[_0x45a2('0x7c')](_0x1e0bc9['body'][_0x45a2('0x60')])||_0x1e0bc9[_0x45a2('0x60')][_0x45a2('0x60')]===''){throw new db[(_0x45a2('0x1e'))]['ValidationError'](_0x45a2('0x7f'));}if(_['isNil'](_0x1e0bc9['body']['to'])){}_0x15b28f=_0x1e0bc9[_0x45a2('0x60')]['to'];return db[_0x45a2('0x42')][_0x45a2('0x6b')]({'where':{'id':_0x1e0bc9[_0x45a2('0x5b')]['id']}})[_0x45a2('0x38')](handleEntityNotFound(_0x59cb81,null))[_0x45a2('0x38')](function(_0x37cd61){if(_0x37cd61){return db[_0x45a2('0x42')][_0x45a2('0x67')]({'where':{'id':_0x37cd61['id']},'include':[{'model':db['CmList'],'as':_0x45a2('0x8b'),'include':[{'model':db[_0x45a2('0x75')],'as':_0x45a2('0x84'),'where':{[_0x37cd61[_0x45a2('0x80')]]:_0x15b28f},'limit':0x1,'order':[[_0x45a2('0x79'),_0x45a2('0x85')]]}]}]})[_0x45a2('0x38')](handleEntityNotFound(_0x59cb81,null))[_0x45a2('0x38')](function(_0x5b5ffa){if(_0x5b5ffa&&_0x5b5ffa['List']){_0x1049f3=_0x5b5ffa['get']({'plain':!![]});if(_0x1049f3[_0x45a2('0x8b')]&&_0x1049f3['List'][_0x45a2('0x84')][_0x45a2('0x4b')]){return _0x1049f3['List'][_0x45a2('0x84')][0x0];}return db[_0x45a2('0x75')][_0x45a2('0x5f')](_['defaults'](_0x1e0bc9[_0x45a2('0x60')],{'firstName':_0x15b28f,[_0x5b5ffa[_0x45a2('0x80')]]:_0x15b28f,'phone':_0x15b28f,'ListId':_0x1049f3[_0x45a2('0x7b')]}));}})[_0x45a2('0x38')](handleEntityNotFound(_0x59cb81,null))[_0x45a2('0x38')](function(_0x5a5ef5){if(_0x5a5ef5){_0x3e34f9=_0x5a5ef5;return db[_0x45a2('0x92')][_0x45a2('0x67')]({'where':{'ContactId':_0x3e34f9['id'],'closed':![],'OpenchannelAccountId':_0x1049f3['id']}})[_0x45a2('0x38')](function(_0x362141){if(_0x362141){return[_0x362141,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x1e0bc9[_0x45a2('0x61')]['id'],'ContactId':_0x3e34f9['id'],'OpenchannelAccountId':_0x1049f3['id'],'lastMsgDirection':_0x45a2('0xb7'),'Messages':[_[_0x45a2('0x54')](_0x1e0bc9['body'],{'read':![],'body':_0x1e0bc9[_0x45a2('0x60')][_0x45a2('0x60')],'OpenchannelAccountId':_0x1049f3['id'],'UserId':_0x1e0bc9[_0x45a2('0x61')]['id'],'ContactId':_0x3e34f9['id']})]},{'include':[{'model':db[_0x45a2('0x9b')],'as':_0x45a2('0xb8')}]})[_0x45a2('0x38')](function(_0x4d34d4){return[_0x4d34d4,!![]];});});}})[_0x45a2('0x95')](function(_0x121b14,_0x501196){if(_0x501196){return _0x121b14;}return db[_0x45a2('0x9b')]['create'](_[_0x45a2('0x54')](_0x1e0bc9[_0x45a2('0x60')],{'read':![],'body':_0x1e0bc9[_0x45a2('0x60')]['body'],'OpenchannelAccountId':_0x1049f3['id'],'OpenchannelInteractionId':_0x121b14['id'],'UserId':_0x1e0bc9[_0x45a2('0x61')]['id'],'ContactId':_0x3e34f9['id']}))[_0x45a2('0x38')](function(_0x389f94){_0x121b14[_0x45a2('0xb9')][_0x45a2('0xb8')]=[];_0x121b14[_0x45a2('0xb9')][_0x45a2('0xb8')]['push'](_0x389f94[_0x45a2('0xb9')]);return _0x121b14;});});}})[_0x45a2('0x38')](respondWithResult(_0x59cb81,null))[_0x45a2('0x2c')](handleError(_0x59cb81,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b77dfa6..135d7a8 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 _0xeaaa=['emit','hook','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x4d2b0a,_0x1c7a43){var _0x26eac2=function(_0x5d85ac){while(--_0x5d85ac){_0x4d2b0a['push'](_0x4d2b0a['shift']());}};_0x26eac2(++_0x1c7a43);}(_0xeaaa,0x1d8));var _0xaeaa=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xeaaa[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xaeaa('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xaeaa('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaeaa('0x2'),'afterDestroy':_0xaeaa('0x3')};function emitEvent(_0x30441d){return function(_0x727cfb,_0x244bc3,_0x35cee6){OpenchannelAccountEvents[_0xaeaa('0x4')](_0x30441d+':'+_0x727cfb['id'],_0x727cfb);OpenchannelAccountEvents[_0xaeaa('0x4')](_0x30441d,_0x727cfb);_0x35cee6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xaeaa('0x5')](e,emitEvent(event));}}module[_0xaeaa('0x6')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x7531=['update','emit','hook','exports','events','../../mysqldb','OpenchannelAccount','setMaxListeners','save'];(function(_0x200eaf,_0x51f6b6){var _0x2d649a=function(_0x4fd875){while(--_0x4fd875){_0x200eaf['push'](_0x200eaf['shift']());}};_0x2d649a(++_0x51f6b6);}(_0x7531,0x67));var _0x1753=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x7531[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x1753('0x0'));var OpenchannelAccount=require(_0x1753('0x1'))['db'][_0x1753('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1753('0x3')](0x0);var events={'afterCreate':_0x1753('0x4'),'afterUpdate':_0x1753('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4c4395){return function(_0x38f6d2,_0x2b1d13,_0x38ba51){OpenchannelAccountEvents[_0x1753('0x6')](_0x4c4395+':'+_0x38f6d2['id'],_0x38f6d2);OpenchannelAccountEvents[_0x1753('0x6')](_0x4c4395,_0x38f6d2);_0x38ba51(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x1753('0x7')](e,emitEvent(event));}}module[_0x1753('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 b9349e2..e5243b7 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 _0x6edf=['rimraf','./openchannelAccount.attributes','exports','define','OpenchannelAccount','openchannel_accounts','lodash','../../config/logger','api','request-promise'];(function(_0x22adff,_0x502139){var _0x44d32b=function(_0x5e410e){while(--_0x5e410e){_0x22adff['push'](_0x22adff['shift']());}};_0x44d32b(++_0x502139);}(_0x6edf,0xd8));var _0xf6ed=function(_0x4163e5,_0x2f0071){_0x4163e5=_0x4163e5-0x0;var _0x4c600a=_0x6edf[_0x4163e5];return _0x4c600a;};'use strict';var _=require(_0xf6ed('0x0'));var util=require('util');var logger=require(_0xf6ed('0x1'))(_0xf6ed('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6ed('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6ed('0x4'));var config=require('../../config/environment');var attributes=require(_0xf6ed('0x5'));module[_0xf6ed('0x6')]=function(_0x223dee,_0x302f69){return _0x223dee[_0xf6ed('0x7')](_0xf6ed('0x8'),attributes,{'tableName':_0xf6ed('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb4b=['rimraf','../../config/environment','exports','define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x129c27,_0x333c44){var _0x5a8017=function(_0x5c5083){while(--_0x5c5083){_0x129c27['push'](_0x129c27['shift']());}};_0x5a8017(++_0x333c44);}(_0xbb4b,0x13e));var _0xbbb4=function(_0x21d53f,_0x1616af){_0x21d53f=_0x21d53f-0x0;var _0x1fa7a9=_0xbb4b[_0x21d53f];return _0x1fa7a9;};'use strict';var _=require(_0xbbb4('0x0'));var util=require(_0xbbb4('0x1'));var logger=require(_0xbbb4('0x2'))('api');var moment=require(_0xbbb4('0x3'));var BPromise=require(_0xbbb4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbbb4('0x5'));var rimraf=require(_0xbbb4('0x6'));var config=require(_0xbbb4('0x7'));var attributes=require('./openchannelAccount.attributes');module[_0xbbb4('0x8')]=function(_0x41f0e9,_0xac6972){return _0x41f0e9[_0xbbb4('0x9')](_0xbbb4('0xa'),attributes,{'tableName':_0xbbb4('0xb'),'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 169955b..7ff8d9b 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 _0xca2a=['socket.io-emitter','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0xca2a,0x188));var _0xaca2=function(_0x1f4a96,_0x247bd0){_0x1f4a96=_0x1f4a96-0x0;var _0x2edc06=_0xca2a[_0x1f4a96];return _0x2edc06;};'use strict';var _=require(_0xaca2('0x0'));var util=require(_0xaca2('0x1'));var moment=require('moment');var BPromise=require(_0xaca2('0x2'));var rs=require(_0xaca2('0x3'));var fs=require('fs');var Redis=require(_0xaca2('0x4'));var db=require(_0xaca2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaca2('0x6'))(_0xaca2('0x7'));var config=require('../../config/environment');var jayson=require(_0xaca2('0x8'));var client=jayson[_0xaca2('0x9')]['http']({'port':0x232a});config[_0xaca2('0xa')]=_[_0xaca2('0xb')](config[_0xaca2('0xa')],{'host':_0xaca2('0xc'),'port':0x18eb});var socket=require(_0xaca2('0xd'))(new Redis(config[_0xaca2('0xa')]));require(_0xaca2('0xe'))[_0xaca2('0xf')](socket);function respondWithRpcPromise(_0x46a110,_0x54b8ee,_0x2e9032){return new BPromise(function(_0x84100,_0x1873b4){return client['request'](_0x46a110,_0x2e9032)[_0xaca2('0x10')](function(_0x117dce){logger[_0xaca2('0x11')](_0xaca2('0x12'),_0x54b8ee,'request\x20sent');logger[_0xaca2('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x54b8ee,_0xaca2('0x14'),JSON[_0xaca2('0x15')](_0x117dce));if(_0x117dce[_0xaca2('0x16')]){if(_0x117dce['error'][_0xaca2('0x17')]===0x1f4){logger[_0xaca2('0x16')](_0xaca2('0x12'),_0x54b8ee,_0x117dce['error'][_0xaca2('0x18')]);return _0x1873b4(_0x117dce[_0xaca2('0x16')][_0xaca2('0x18')]);}logger['error'](_0xaca2('0x12'),_0x54b8ee,_0x117dce['error'][_0xaca2('0x18')]);return _0x84100(_0x117dce[_0xaca2('0x16')][_0xaca2('0x18')]);}else{logger[_0xaca2('0x11')](_0xaca2('0x12'),_0x54b8ee,_0xaca2('0x14'));_0x84100(_0x117dce[_0xaca2('0x19')][_0xaca2('0x18')]);}})[_0xaca2('0x1a')](function(_0x1c0fe5){logger[_0xaca2('0x16')](_0xaca2('0x12'),_0x54b8ee,_0x1c0fe5);_0x1873b4(_0x1c0fe5);});});} \ No newline at end of file +var _0xc033=['socket.io-emitter','./openchannelAccount.socket','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x4ebf50,_0x2ff389){var _0x100eaa=function(_0x5986f0){while(--_0x5986f0){_0x4ebf50['push'](_0x4ebf50['shift']());}};_0x100eaa(++_0x2ff389);}(_0xc033,0x1c7));var _0x3c03=function(_0x4b6a01,_0x386039){_0x4b6a01=_0x4b6a01-0x0;var _0xc374a3=_0xc033[_0x4b6a01];return _0xc374a3;};'use strict';var _=require(_0x3c03('0x0'));var util=require(_0x3c03('0x1'));var moment=require(_0x3c03('0x2'));var BPromise=require(_0x3c03('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c03('0x4'))['db'];var utils=require(_0x3c03('0x5'));var logger=require('../../config/logger')(_0x3c03('0x6'));var config=require('../../config/environment');var jayson=require(_0x3c03('0x7'));var client=jayson[_0x3c03('0x8')][_0x3c03('0x9')]({'port':0x232a});config[_0x3c03('0xa')]=_[_0x3c03('0xb')](config[_0x3c03('0xa')],{'host':_0x3c03('0xc'),'port':0x18eb});var socket=require(_0x3c03('0xd'))(new Redis(config['redis']));require(_0x3c03('0xe'))[_0x3c03('0xf')](socket);function respondWithRpcPromise(_0x2c8c87,_0x387d6a,_0x4b0dca){return new BPromise(function(_0x10fb5f,_0x4d5085){return client[_0x3c03('0x10')](_0x2c8c87,_0x4b0dca)['then'](function(_0x3c8179){logger['info'](_0x3c03('0x11'),_0x387d6a,_0x3c03('0x12'));logger[_0x3c03('0x13')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x387d6a,_0x3c03('0x12'),JSON[_0x3c03('0x14')](_0x3c8179));if(_0x3c8179[_0x3c03('0x15')]){if(_0x3c8179[_0x3c03('0x15')]['code']===0x1f4){logger[_0x3c03('0x15')](_0x3c03('0x11'),_0x387d6a,_0x3c8179[_0x3c03('0x15')][_0x3c03('0x16')]);return _0x4d5085(_0x3c8179['error'][_0x3c03('0x16')]);}logger[_0x3c03('0x15')](_0x3c03('0x11'),_0x387d6a,_0x3c8179[_0x3c03('0x15')][_0x3c03('0x16')]);return _0x10fb5f(_0x3c8179['error']['message']);}else{logger[_0x3c03('0x17')](_0x3c03('0x11'),_0x387d6a,_0x3c03('0x12'));_0x10fb5f(_0x3c8179[_0x3c03('0x18')][_0x3c03('0x16')]);}})[_0x3c03('0x19')](function(_0x1c20a0){logger['error'](_0x3c03('0x11'),_0x387d6a,_0x1c20a0);_0x4d5085(_0x1c20a0);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index b3d9c93..238ea86 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 _0xee02=['./openchannelAccount.events','save','remove','update','emit','openchannelAccount:'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xee02,0xfc));var _0x2ee0=function(_0x319e2e,_0x2f727f){_0x319e2e=_0x319e2e-0x0;var _0x302524=_0xee02[_0x319e2e];return _0x302524;};'use strict';var OpenchannelAccountEvents=require(_0x2ee0('0x0'));var events=[_0x2ee0('0x1'),_0x2ee0('0x2'),_0x2ee0('0x3')];function createListener(_0x53f91a,_0x1c0b07){return function(_0x557b89){_0x1c0b07[_0x2ee0('0x4')](_0x53f91a,_0x557b89);};}function removeListener(_0x6a2607,_0x58828e){return function(){OpenchannelAccountEvents['removeListener'](_0x6a2607,_0x58828e);};}exports['register']=function(_0x4ed21e){for(var _0x475221=0x0,_0x5cf220=events['length'];_0x475221<_0x5cf220;_0x475221++){var _0x507a4a=events[_0x475221];var _0x12f48a=createListener(_0x2ee0('0x5')+_0x507a4a,_0x4ed21e);OpenchannelAccountEvents['on'](_0x507a4a,_0x12f48a);}}; \ No newline at end of file +var _0xdf2a=['register','length','./openchannelAccount.events','save','update','removeListener'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xdf2a,0x9e));var _0xadf2=function(_0x29ac9e,_0x150921){_0x29ac9e=_0x29ac9e-0x0;var _0xef5c34=_0xdf2a[_0x29ac9e];return _0xef5c34;};'use strict';var OpenchannelAccountEvents=require(_0xadf2('0x0'));var events=[_0xadf2('0x1'),'remove',_0xadf2('0x2')];function createListener(_0x1e83db,_0x3a1ae6){return function(_0x390d69){_0x3a1ae6['emit'](_0x1e83db,_0x390d69);};}function removeListener(_0xe82324,_0x17a3b3){return function(){OpenchannelAccountEvents[_0xadf2('0x3')](_0xe82324,_0x17a3b3);};}exports[_0xadf2('0x4')]=function(_0x1174c0){for(var _0x5a3810=0x0,_0x21f956=events[_0xadf2('0x5')];_0x5a3810<_0x21f956;_0x5a3810++){var _0x1e4434=events[_0x5a3810];var _0x1df6eb=createListener('openchannelAccount:'+_0x1e4434,_0x1174c0);OpenchannelAccountEvents['on'](_0x1e4434,_0x1df6eb);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 9fb353d..512b3a8 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 _0x3f29=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f29,0x1dc));var _0x93f2=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x3f29[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0x93f2('0x0'));var util=require('util');var path=require(_0x93f2('0x1'));var timeout=require('connect-timeout');var express=require(_0x93f2('0x2'));var router=express[_0x93f2('0x3')]();var auth=require(_0x93f2('0x4'));var interaction=require(_0x93f2('0x5'));var config=require(_0x93f2('0x6'));var controller=require(_0x93f2('0x7'));router[_0x93f2('0x8')]('/',auth['isAuthenticated'](),controller[_0x93f2('0x9')]);router['get'](_0x93f2('0xa'),auth[_0x93f2('0xb')](),controller[_0x93f2('0xc')]);router[_0x93f2('0xd')]('/',auth[_0x93f2('0xb')](),controller['create']);router[_0x93f2('0xe')](_0x93f2('0xa'),auth[_0x93f2('0xb')](),controller[_0x93f2('0xf')]);router[_0x93f2('0x10')](_0x93f2('0xa'),auth[_0x93f2('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5a6c=['/:id','show','post','put','update','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x5a6c,0x103));var _0xc5a6=function(_0x30e86a,_0xdb8ad1){_0x30e86a=_0x30e86a-0x0;var _0x484b30=_0x5a6c[_0x30e86a];return _0x484b30;};'use strict';var multer=require(_0xc5a6('0x0'));var util=require('util');var path=require(_0xc5a6('0x1'));var timeout=require(_0xc5a6('0x2'));var express=require('express');var router=express[_0xc5a6('0x3')]();var auth=require(_0xc5a6('0x4'));var interaction=require(_0xc5a6('0x5'));var config=require(_0xc5a6('0x6'));var controller=require(_0xc5a6('0x7'));router[_0xc5a6('0x8')]('/',auth[_0xc5a6('0x9')](),controller[_0xc5a6('0xa')]);router[_0xc5a6('0x8')](_0xc5a6('0xb'),auth[_0xc5a6('0x9')](),controller[_0xc5a6('0xc')]);router[_0xc5a6('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc5a6('0xe')](_0xc5a6('0xb'),auth[_0xc5a6('0x9')](),controller[_0xc5a6('0xf')]);router['delete'](_0xc5a6('0xb'),auth[_0xc5a6('0x9')](),controller[_0xc5a6('0x10')]);module[_0xc5a6('0x11')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 73e9fa8..9436e8a 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 _0xe6b7=['sequelize','INTEGER','STRING','*,*,*,*'];(function(_0x1f3505,_0x23fb16){var _0x330c1f=function(_0x464bbc){while(--_0x464bbc){_0x1f3505['push'](_0x1f3505['shift']());}};_0x330c1f(++_0x23fb16);}(_0xe6b7,0x118));var _0x7e6b=function(_0x134448,_0x591d7b){_0x134448=_0x134448-0x0;var _0x2d52a1=_0xe6b7[_0x134448];return _0x2d52a1;};'use strict';var Sequelize=require(_0x7e6b('0x0'));module['exports']={'priority':{'type':Sequelize[_0x7e6b('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7e6b('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x7e6b('0x3')}}; \ No newline at end of file +var _0x4c55=['STRING','noop','TEXT','*,*,*,*','INTEGER'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x4c55,0x16c));var _0x54c5=function(_0x44cb92,_0x59afa3){_0x44cb92=_0x44cb92-0x0;var _0x56b9e6=_0x4c55[_0x44cb92];return _0x56b9e6;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x54c5('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x54c5('0x1')],'allowNull':![],'defaultValue':_0x54c5('0x2')},'appdata':{'type':Sequelize[_0x54c5('0x3')]()},'description':{'type':Sequelize[_0x54c5('0x1')]},'interval':{'type':Sequelize[_0x54c5('0x1')],'defaultValue':_0x54c5('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 6080d69..1085ae8 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 _0x7b37=['include','OpenchannelApplication','findAll','rows','show','params','keys','filters','length','find','catch','create','body','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','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','send','index','fieldName','type','key','map','name','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll'];(function(_0x11c93e,_0xd3235e){var _0x3d1726=function(_0x3dc228){while(--_0x3dc228){_0x11c93e['push'](_0x11c93e['shift']());}};_0x3d1726(++_0xd3235e);}(_0x7b37,0x141));var _0x77b3=function(_0x52ab84,_0x384d32){_0x52ab84=_0x52ab84-0x0;var _0x481d6a=_0x7b37[_0x52ab84];return _0x481d6a;};'use strict';var pdf=require(_0x77b3('0x0'));var emlformat=require(_0x77b3('0x1'));var rimraf=require(_0x77b3('0x2'));var zipdir=require(_0x77b3('0x3'));var jsonpatch=require(_0x77b3('0x4'));var rp=require(_0x77b3('0x5'));var moment=require(_0x77b3('0x6'));var BPromise=require(_0x77b3('0x7'));var Mustache=require(_0x77b3('0x8'));var util=require(_0x77b3('0x9'));var path=require(_0x77b3('0xa'));var sox=require(_0x77b3('0xb'));var csv=require(_0x77b3('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x77b3('0xd'));var squel=require(_0x77b3('0xe'));var crypto=require(_0x77b3('0xf'));var jsforce=require(_0x77b3('0x10'));var deskjs=require(_0x77b3('0x11'));var toCsv=require(_0x77b3('0xc'));var querystring=require('querystring');var Papa=require(_0x77b3('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x77b3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77b3('0x14'));var logger=require(_0x77b3('0x15'))(_0x77b3('0x16'));var utils=require('../../config/utils');var config=require(_0x77b3('0x17'));var db=require(_0x77b3('0x18'))['db'];function respondWithStatusCode(_0x23dc15,_0x56657c){_0x56657c=_0x56657c||0xcc;return function(_0x317c27){if(_0x317c27){return _0x23dc15['sendStatus'](_0x56657c);}return _0x23dc15[_0x77b3('0x19')](_0x56657c)['end']();};}function respondWithResult(_0x42cc7d,_0x375820){_0x375820=_0x375820||0xc8;return function(_0x4270f2){if(_0x4270f2){return _0x42cc7d['status'](_0x375820)['json'](_0x4270f2);}};}function respondWithFilteredResult(_0x4570fc,_0x311b5e){return function(_0x57b499){if(_0x57b499){var _0x16ea78=_0x57b499[_0x77b3('0x1a')],_0x2721eb=_0x311b5e[_0x77b3('0x1b')],_0x389922=_0x311b5e[_0x77b3('0x1b')]+_0x311b5e[_0x77b3('0x1c')],_0xd1b3d8;if(_0x389922>=_0x16ea78){_0x389922=_0x16ea78;_0xd1b3d8=0xc8;}else{_0xd1b3d8=0xce;}_0x4570fc['status'](_0xd1b3d8);return _0x4570fc[_0x77b3('0x1d')](_0x77b3('0x1e'),_0x2721eb+'-'+_0x389922+'/'+_0x16ea78)['json'](_0x57b499);}return null;};}function patchUpdates(_0x3ee092){return function(_0x9abfa5){try{jsonpatch[_0x77b3('0x1f')](_0x9abfa5,_0x3ee092,!![]);}catch(_0x53c1bf){return BPromise[_0x77b3('0x20')](_0x53c1bf);}return _0x9abfa5[_0x77b3('0x21')]();};}function saveUpdates(_0x1ae2d8,_0x202b06){return function(_0x1269bc){if(_0x1269bc){return _0x1269bc[_0x77b3('0x22')](_0x1ae2d8)[_0x77b3('0x23')](function(_0x4a4ff3){return _0x4a4ff3;});}return null;};}function removeEntity(_0x195a54,_0x18f952){return function(_0x56bb96){if(_0x56bb96){return _0x56bb96[_0x77b3('0x24')]()[_0x77b3('0x23')](function(){_0x195a54[_0x77b3('0x19')](0xcc)[_0x77b3('0x25')]();});}};}function handleEntityNotFound(_0x4134ab,_0x216b6a){return function(_0x4f327a){if(!_0x4f327a){_0x4134ab[_0x77b3('0x26')](0x194);}return _0x4f327a;};}function handleError(_0x7087a9,_0x480178){_0x480178=_0x480178||0x1f4;return function(_0x3c9116){logger[_0x77b3('0x27')](_0x3c9116[_0x77b3('0x28')]);if(_0x3c9116['name']){delete _0x3c9116['name'];}_0x7087a9['status'](_0x480178)[_0x77b3('0x29')](_0x3c9116);};}exports[_0x77b3('0x2a')]=function(_0xfac6fb,_0x1274f5){var _0x45bfd5={},_0x306703={},_0xc99b44={'count':0x0,'rows':[]};var _0x1da9ee=_['map'](db['OpenchannelApplication']['rawAttributes'],function(_0x4fd810){return{'name':_0x4fd810[_0x77b3('0x2b')],'type':_0x4fd810[_0x77b3('0x2c')][_0x77b3('0x2d')]};});_0x306703['model']=_[_0x77b3('0x2e')](_0x1da9ee,_0x77b3('0x2f'));_0x306703[_0x77b3('0x30')]=_['keys'](_0xfac6fb[_0x77b3('0x30')]);_0x306703['filters']=_[_0x77b3('0x31')](_0x306703[_0x77b3('0x32')],_0x306703['query']);_0x45bfd5[_0x77b3('0x33')]=_[_0x77b3('0x31')](_0x306703[_0x77b3('0x32')],qs[_0x77b3('0x34')](_0xfac6fb['query'][_0x77b3('0x34')]));_0x45bfd5[_0x77b3('0x33')]=_0x45bfd5[_0x77b3('0x33')]['length']?_0x45bfd5[_0x77b3('0x33')]:_0x306703[_0x77b3('0x32')];if(!_0xfac6fb[_0x77b3('0x30')][_0x77b3('0x35')](_0x77b3('0x36'))){_0x45bfd5['limit']=qs['limit'](_0xfac6fb['query'][_0x77b3('0x1c')]);_0x45bfd5[_0x77b3('0x1b')]=qs[_0x77b3('0x1b')](_0xfac6fb[_0x77b3('0x30')][_0x77b3('0x1b')]);}_0x45bfd5[_0x77b3('0x37')]=qs[_0x77b3('0x38')](_0xfac6fb[_0x77b3('0x30')][_0x77b3('0x38')]);_0x45bfd5['where']=qs['filters'](_[_0x77b3('0x39')](_0xfac6fb[_0x77b3('0x30')],_0x306703['filters']));if(_0xfac6fb['query']['filter']){_0x45bfd5[_0x77b3('0x3a')]=_[_0x77b3('0x3b')](_0x45bfd5[_0x77b3('0x3a')],{'$or':_[_0x77b3('0x2e')](_0x1da9ee,function(_0x41c503){if(_0x41c503[_0x77b3('0x2c')]!==_0x77b3('0x3c')){var _0x445d27={};_0x445d27[_0x41c503[_0x77b3('0x2f')]]={'$like':'%'+_0xfac6fb[_0x77b3('0x30')][_0x77b3('0x3d')]+'%'};return _0x445d27;}})});}_0x45bfd5=_['merge']({},_0x45bfd5,_0xfac6fb[_0x77b3('0x3e')]);var _0x3da990={'where':_0x45bfd5[_0x77b3('0x3a')]};return db['OpenchannelApplication']['count'](_0x3da990)[_0x77b3('0x23')](function(_0x367c5b){_0xc99b44['count']=_0x367c5b;if(_0xfac6fb['query'][_0x77b3('0x3f')]){_0x45bfd5[_0x77b3('0x40')]=[{'all':!![]}];}return db[_0x77b3('0x41')][_0x77b3('0x42')](_0x45bfd5);})[_0x77b3('0x23')](function(_0x4715eb){_0xc99b44[_0x77b3('0x43')]=_0x4715eb;return _0xc99b44;})[_0x77b3('0x23')](respondWithFilteredResult(_0x1274f5,_0x45bfd5))['catch'](handleError(_0x1274f5,null));};exports[_0x77b3('0x44')]=function(_0x2adae9,_0x4d0d14){var _0x3606c1={'raw':!![],'where':{'id':_0x2adae9[_0x77b3('0x45')]['id']}},_0x501d6a={};_0x501d6a['model']=_[_0x77b3('0x46')](db['OpenchannelApplication']['rawAttributes']);_0x501d6a[_0x77b3('0x30')]=_[_0x77b3('0x46')](_0x2adae9[_0x77b3('0x30')]);_0x501d6a[_0x77b3('0x47')]=_['intersection'](_0x501d6a[_0x77b3('0x32')],_0x501d6a[_0x77b3('0x30')]);_0x3606c1[_0x77b3('0x33')]=_[_0x77b3('0x31')](_0x501d6a[_0x77b3('0x32')],qs[_0x77b3('0x34')](_0x2adae9['query'][_0x77b3('0x34')]));_0x3606c1[_0x77b3('0x33')]=_0x3606c1['attributes'][_0x77b3('0x48')]?_0x3606c1['attributes']:_0x501d6a[_0x77b3('0x32')];if(_0x2adae9[_0x77b3('0x30')][_0x77b3('0x3f')]){_0x3606c1['include']=[{'all':!![]}];}_0x3606c1=_['merge']({},_0x3606c1,_0x2adae9['options']);return db['OpenchannelApplication'][_0x77b3('0x49')](_0x3606c1)[_0x77b3('0x23')](handleEntityNotFound(_0x4d0d14,null))[_0x77b3('0x23')](respondWithResult(_0x4d0d14,null))[_0x77b3('0x4a')](handleError(_0x4d0d14,null));};exports[_0x77b3('0x4b')]=function(_0x5ec8d6,_0x3e5435){return db[_0x77b3('0x41')][_0x77b3('0x4b')](_0x5ec8d6['body'],{})[_0x77b3('0x23')](respondWithResult(_0x3e5435,0xc9))[_0x77b3('0x4a')](handleError(_0x3e5435,null));};exports[_0x77b3('0x22')]=function(_0x502525,_0x5f4de0){if(_0x502525[_0x77b3('0x4c')]['id']){delete _0x502525[_0x77b3('0x4c')]['id'];}return db[_0x77b3('0x41')][_0x77b3('0x49')]({'where':{'id':_0x502525[_0x77b3('0x45')]['id']}})[_0x77b3('0x23')](handleEntityNotFound(_0x5f4de0,null))['then'](saveUpdates(_0x502525['body'],null))[_0x77b3('0x23')](respondWithResult(_0x5f4de0,null))[_0x77b3('0x4a')](handleError(_0x5f4de0,null));};exports[_0x77b3('0x24')]=function(_0x5e9a10,_0x50d20d){return db['OpenchannelApplication'][_0x77b3('0x49')]({'where':{'id':_0x5e9a10[_0x77b3('0x45')]['id']}})[_0x77b3('0x23')](handleEntityNotFound(_0x50d20d,null))[_0x77b3('0x23')](removeEntity(_0x50d20d,null))[_0x77b3('0x4a')](handleError(_0x50d20d,null));}; \ No newline at end of file +var _0x1ec8=['sendStatus','json','offset','limit','status','apply','reject','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','catch','params','keys','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x34ec98,_0x360b84){var _0x33b961=function(_0x49e418){while(--_0x49e418){_0x34ec98['push'](_0x34ec98['shift']());}};_0x33b961(++_0x360b84);}(_0x1ec8,0x72));var _0x81ec=function(_0xbe87de,_0x5d1eeb){_0xbe87de=_0xbe87de-0x0;var _0x41d692=_0x1ec8[_0xbe87de];return _0x41d692;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x81ec('0x0'));var zipdir=require(_0x81ec('0x1'));var jsonpatch=require(_0x81ec('0x2'));var rp=require(_0x81ec('0x3'));var moment=require(_0x81ec('0x4'));var BPromise=require(_0x81ec('0x5'));var Mustache=require(_0x81ec('0x6'));var util=require('util');var path=require(_0x81ec('0x7'));var sox=require('sox');var csv=require(_0x81ec('0x8'));var ejs=require(_0x81ec('0x9'));var fs=require('fs');var _=require(_0x81ec('0xa'));var squel=require(_0x81ec('0xb'));var crypto=require('crypto');var jsforce=require(_0x81ec('0xc'));var deskjs=require(_0x81ec('0xd'));var toCsv=require(_0x81ec('0x8'));var querystring=require(_0x81ec('0xe'));var Papa=require(_0x81ec('0xf'));var Redis=require(_0x81ec('0x10'));var authService=require(_0x81ec('0x11'));var qs=require(_0x81ec('0x12'));var as=require(_0x81ec('0x13'));var hardwareService=require(_0x81ec('0x14'));var logger=require(_0x81ec('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x81ec('0x16'));var db=require(_0x81ec('0x17'))['db'];function respondWithStatusCode(_0x5035d3,_0x14466d){_0x14466d=_0x14466d||0xcc;return function(_0x253a4e){if(_0x253a4e){return _0x5035d3[_0x81ec('0x18')](_0x14466d);}return _0x5035d3['status'](_0x14466d)['end']();};}function respondWithResult(_0x437542,_0x355f34){_0x355f34=_0x355f34||0xc8;return function(_0x235424){if(_0x235424){return _0x437542['status'](_0x355f34)[_0x81ec('0x19')](_0x235424);}};}function respondWithFilteredResult(_0x28c231,_0x24f913){return function(_0x37f655){if(_0x37f655){var _0x5850a5=_0x37f655['count'],_0x101c48=_0x24f913[_0x81ec('0x1a')],_0x925263=_0x24f913['offset']+_0x24f913[_0x81ec('0x1b')],_0x3e8e0a;if(_0x925263>=_0x5850a5){_0x925263=_0x5850a5;_0x3e8e0a=0xc8;}else{_0x3e8e0a=0xce;}_0x28c231[_0x81ec('0x1c')](_0x3e8e0a);return _0x28c231['set']('Content-Range',_0x101c48+'-'+_0x925263+'/'+_0x5850a5)[_0x81ec('0x19')](_0x37f655);}return null;};}function patchUpdates(_0xb05327){return function(_0x11a382){try{jsonpatch[_0x81ec('0x1d')](_0x11a382,_0xb05327,!![]);}catch(_0x5f3fc1){return BPromise[_0x81ec('0x1e')](_0x5f3fc1);}return _0x11a382['save']();};}function saveUpdates(_0x1670fe,_0x425ff5){return function(_0x254517){if(_0x254517){return _0x254517[_0x81ec('0x1f')](_0x1670fe)[_0x81ec('0x20')](function(_0x2d4129){return _0x2d4129;});}return null;};}function removeEntity(_0x386741,_0x4f2dce){return function(_0x3b8f91){if(_0x3b8f91){return _0x3b8f91[_0x81ec('0x21')]()[_0x81ec('0x20')](function(){_0x386741[_0x81ec('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53ab2d,_0x2ec7e7){return function(_0x3f7841){if(!_0x3f7841){_0x53ab2d[_0x81ec('0x18')](0x194);}return _0x3f7841;};}function handleError(_0x1091c2,_0x4669f7){_0x4669f7=_0x4669f7||0x1f4;return function(_0x25ef69){logger[_0x81ec('0x22')](_0x25ef69[_0x81ec('0x23')]);if(_0x25ef69[_0x81ec('0x24')]){delete _0x25ef69['name'];}_0x1091c2[_0x81ec('0x1c')](_0x4669f7)[_0x81ec('0x25')](_0x25ef69);};}exports[_0x81ec('0x26')]=function(_0x4ecf45,_0x159508){var _0x501af2={},_0x4453dd={},_0x5c4abc={'count':0x0,'rows':[]};var _0x53ef0b=_[_0x81ec('0x27')](db[_0x81ec('0x28')][_0x81ec('0x29')],function(_0x374a16){return{'name':_0x374a16['fieldName'],'type':_0x374a16[_0x81ec('0x2a')]['key']};});_0x4453dd[_0x81ec('0x2b')]=_[_0x81ec('0x27')](_0x53ef0b,_0x81ec('0x24'));_0x4453dd[_0x81ec('0x2c')]=_['keys'](_0x4ecf45[_0x81ec('0x2c')]);_0x4453dd[_0x81ec('0x2d')]=_[_0x81ec('0x2e')](_0x4453dd[_0x81ec('0x2b')],_0x4453dd[_0x81ec('0x2c')]);_0x501af2['attributes']=_[_0x81ec('0x2e')](_0x4453dd[_0x81ec('0x2b')],qs['fields'](_0x4ecf45[_0x81ec('0x2c')][_0x81ec('0x2f')]));_0x501af2[_0x81ec('0x30')]=_0x501af2[_0x81ec('0x30')][_0x81ec('0x31')]?_0x501af2['attributes']:_0x4453dd[_0x81ec('0x2b')];if(!_0x4ecf45['query']['hasOwnProperty'](_0x81ec('0x32'))){_0x501af2[_0x81ec('0x1b')]=qs[_0x81ec('0x1b')](_0x4ecf45[_0x81ec('0x2c')][_0x81ec('0x1b')]);_0x501af2[_0x81ec('0x1a')]=qs[_0x81ec('0x1a')](_0x4ecf45[_0x81ec('0x2c')][_0x81ec('0x1a')]);}_0x501af2[_0x81ec('0x33')]=qs[_0x81ec('0x34')](_0x4ecf45['query'][_0x81ec('0x34')]);_0x501af2[_0x81ec('0x35')]=qs[_0x81ec('0x2d')](_[_0x81ec('0x36')](_0x4ecf45[_0x81ec('0x2c')],_0x4453dd[_0x81ec('0x2d')]));if(_0x4ecf45['query'][_0x81ec('0x37')]){_0x501af2['where']=_[_0x81ec('0x38')](_0x501af2[_0x81ec('0x35')],{'$or':_[_0x81ec('0x27')](_0x53ef0b,function(_0x5c12fd){if(_0x5c12fd[_0x81ec('0x2a')]!==_0x81ec('0x39')){var _0x2876f1={};_0x2876f1[_0x5c12fd[_0x81ec('0x24')]]={'$like':'%'+_0x4ecf45[_0x81ec('0x2c')][_0x81ec('0x37')]+'%'};return _0x2876f1;}})});}_0x501af2=_[_0x81ec('0x38')]({},_0x501af2,_0x4ecf45['options']);var _0x23de64={'where':_0x501af2[_0x81ec('0x35')]};return db[_0x81ec('0x28')][_0x81ec('0x3a')](_0x23de64)['then'](function(_0x210b1e){_0x5c4abc[_0x81ec('0x3a')]=_0x210b1e;if(_0x4ecf45[_0x81ec('0x2c')][_0x81ec('0x3b')]){_0x501af2[_0x81ec('0x3c')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x81ec('0x3d')](_0x501af2);})[_0x81ec('0x20')](function(_0x480ffe){_0x5c4abc['rows']=_0x480ffe;return _0x5c4abc;})[_0x81ec('0x20')](respondWithFilteredResult(_0x159508,_0x501af2))[_0x81ec('0x3e')](handleError(_0x159508,null));};exports['show']=function(_0x3de264,_0x1dd689){var _0x5968db={'raw':!![],'where':{'id':_0x3de264[_0x81ec('0x3f')]['id']}},_0x56f3bf={};_0x56f3bf['model']=_[_0x81ec('0x40')](db[_0x81ec('0x28')][_0x81ec('0x29')]);_0x56f3bf['query']=_[_0x81ec('0x40')](_0x3de264['query']);_0x56f3bf[_0x81ec('0x2d')]=_[_0x81ec('0x2e')](_0x56f3bf['model'],_0x56f3bf[_0x81ec('0x2c')]);_0x5968db[_0x81ec('0x30')]=_[_0x81ec('0x2e')](_0x56f3bf[_0x81ec('0x2b')],qs[_0x81ec('0x2f')](_0x3de264['query'][_0x81ec('0x2f')]));_0x5968db[_0x81ec('0x30')]=_0x5968db[_0x81ec('0x30')][_0x81ec('0x31')]?_0x5968db['attributes']:_0x56f3bf[_0x81ec('0x2b')];if(_0x3de264['query'][_0x81ec('0x3b')]){_0x5968db[_0x81ec('0x3c')]=[{'all':!![]}];}_0x5968db=_[_0x81ec('0x38')]({},_0x5968db,_0x3de264[_0x81ec('0x41')]);return db[_0x81ec('0x28')][_0x81ec('0x42')](_0x5968db)[_0x81ec('0x20')](handleEntityNotFound(_0x1dd689,null))['then'](respondWithResult(_0x1dd689,null))[_0x81ec('0x3e')](handleError(_0x1dd689,null));};exports[_0x81ec('0x43')]=function(_0x1bf8dd,_0x523550){return db['OpenchannelApplication'][_0x81ec('0x43')](_0x1bf8dd[_0x81ec('0x44')],{})[_0x81ec('0x20')](respondWithResult(_0x523550,0xc9))[_0x81ec('0x3e')](handleError(_0x523550,null));};exports[_0x81ec('0x1f')]=function(_0x2bdf43,_0x3e805c){if(_0x2bdf43[_0x81ec('0x44')]['id']){delete _0x2bdf43[_0x81ec('0x44')]['id'];}return db['OpenchannelApplication'][_0x81ec('0x42')]({'where':{'id':_0x2bdf43[_0x81ec('0x3f')]['id']}})[_0x81ec('0x20')](handleEntityNotFound(_0x3e805c,null))[_0x81ec('0x20')](saveUpdates(_0x2bdf43[_0x81ec('0x44')],null))[_0x81ec('0x20')](respondWithResult(_0x3e805c,null))[_0x81ec('0x3e')](handleError(_0x3e805c,null));};exports[_0x81ec('0x21')]=function(_0x48c1f5,_0x2654c2){return db[_0x81ec('0x28')][_0x81ec('0x42')]({'where':{'id':_0x48c1f5[_0x81ec('0x3f')]['id']}})[_0x81ec('0x20')](handleEntityNotFound(_0x2654c2,null))[_0x81ec('0x20')](removeEntity(_0x2654c2,null))['catch'](handleError(_0x2654c2,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 4f9fc29..1acf87e 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 _0x7067=['OpenchannelApplication','utf8mb4','lodash','bluebird','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define'];(function(_0x270f68,_0x27b339){var _0x3fb87c=function(_0x221e7a){while(--_0x221e7a){_0x270f68['push'](_0x270f68['shift']());}};_0x3fb87c(++_0x27b339);}(_0x7067,0x160));var _0x7706=function(_0x11d7e4,_0x3382b0){_0x11d7e4=_0x11d7e4-0x0;var _0x17e252=_0x7067[_0x11d7e4];return _0x17e252;};'use strict';var _=require(_0x7706('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7706('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7706('0x2'));var rimraf=require(_0x7706('0x3'));var config=require(_0x7706('0x4'));var attributes=require(_0x7706('0x5'));module[_0x7706('0x6')]=function(_0x3937f8,_0x334d49){return _0x3937f8[_0x7706('0x7')](_0x7706('0x8'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7706('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0436=['util','../../config/logger','api','moment','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4_unicode_ci'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x0436,0xbe));var _0x6043=function(_0x452217,_0x54024a){_0x452217=_0x452217-0x0;var _0x562e46=_0x0436[_0x452217];return _0x562e46;};'use strict';var _=require('lodash');var util=require(_0x6043('0x0'));var logger=require(_0x6043('0x1'))(_0x6043('0x2'));var moment=require(_0x6043('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(_0x6043('0x4'));var attributes=require(_0x6043('0x5'));module[_0x6043('0x6')]=function(_0x276f4b,_0x314f3c){return _0x276f4b[_0x6043('0x7')]('OpenchannelApplication',attributes,{'tableName':_0x6043('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6043('0x9')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 46665bc..02af06d 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x687c6a,_0x106f7c){var _0x597248=function(_0x5d91d1){while(--_0x5d91d1){_0x687c6a['push'](_0x687c6a['shift']());}};_0x597248(++_0x106f7c);}(_0xb10b,0x12a));var _0xbb10=function(_0x48c612,_0x432076){_0x48c612=_0x48c612-0x0;var _0x5f0583=_0xb10b[_0x48c612];return _0x5f0583;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','debug','stringify'];(function(_0x123df5,_0x5a535b){var _0x115fc5=function(_0x44e410){while(--_0x44e410){_0x123df5['push'](_0x123df5['shift']());}};_0x115fc5(++_0x5a535b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x23059a,_0x22a394){_0x23059a=_0x23059a-0x0;var _0x5aef66=_0x5f2f[_0x23059a];return _0x5aef66;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 3161eb8..685c0ed 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 _0x69f0=['get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','openchannelinteraction:addtags','openchannelinteraction:update','update','delete','openchannel','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xae60e2,_0x8508c9){var _0x48eee6=function(_0x5c3e9f){while(--_0x5c3e9f){_0xae60e2['push'](_0xae60e2['shift']());}};_0x48eee6(++_0x8508c9);}(_0x69f0,0xb6));var _0x069f=function(_0x48413f,_0x58c0d2){_0x48413f=_0x48413f-0x0;var _0x2d9cc7=_0x69f0[_0x48413f];return _0x2d9cc7;};'use strict';var multer=require(_0x069f('0x0'));var util=require(_0x069f('0x1'));var path=require(_0x069f('0x2'));var timeout=require(_0x069f('0x3'));var express=require('express');var router=express[_0x069f('0x4')]();var auth=require(_0x069f('0x5'));var interaction=require(_0x069f('0x6'));var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0x069f('0x7')]('/',auth[_0x069f('0x8')](),controller[_0x069f('0x9')]);router[_0x069f('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x069f('0x7')](_0x069f('0xa'),auth['isAuthenticated'](),controller[_0x069f('0xb')]);router[_0x069f('0x7')](_0x069f('0xc'),auth[_0x069f('0x8')](),controller[_0x069f('0xd')]);router['get'](_0x069f('0xe'),auth[_0x069f('0x8')](),controller[_0x069f('0xf')]);router[_0x069f('0x10')]('/',auth[_0x069f('0x8')](),controller[_0x069f('0x11')]);router[_0x069f('0x10')]('/:id/messages',auth[_0x069f('0x8')](),controller['addMessage']);router['post'](_0x069f('0x12'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0x069f('0x13')),controller['addTags']);router['put'](_0x069f('0xa'),auth['isAuthenticated'](),interaction['tracked']('openchannel',_0x069f('0x14')),controller[_0x069f('0x15')]);router[_0x069f('0x16')](_0x069f('0xa'),auth['isAuthenticated'](),interaction['tracked'](_0x069f('0x17'),_0x069f('0x18')),controller[_0x069f('0x19')]);router[_0x069f('0x16')](_0x069f('0x12'),auth[_0x069f('0x8')](),controller['removeTags']);module[_0x069f('0x1a')]=router; \ No newline at end of file +var _0x1926=['Router','../../components/auth/service','./openchannelInteraction.controller','get','isAuthenticated','/:id','getMessages','/:id/download','download','create','/:id/messages','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','tracked','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x568750,_0x295b25){var _0x37644f=function(_0x59e2ef){while(--_0x59e2ef){_0x568750['push'](_0x568750['shift']());}};_0x37644f(++_0x295b25);}(_0x1926,0x124));var _0x6192=function(_0x48297f,_0x132aec){_0x48297f=_0x48297f-0x0;var _0x405872=_0x1926[_0x48297f];return _0x405872;};'use strict';var multer=require(_0x6192('0x0'));var util=require(_0x6192('0x1'));var path=require(_0x6192('0x2'));var timeout=require(_0x6192('0x3'));var express=require(_0x6192('0x4'));var router=express[_0x6192('0x5')]();var auth=require(_0x6192('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6192('0x7'));router[_0x6192('0x8')]('/',auth[_0x6192('0x9')](),controller['index']);router['get']('/describe',auth[_0x6192('0x9')](),controller['describe']);router[_0x6192('0x8')](_0x6192('0xa'),auth[_0x6192('0x9')](),controller['show']);router[_0x6192('0x8')]('/:id/messages',auth[_0x6192('0x9')](),controller[_0x6192('0xb')]);router['get'](_0x6192('0xc'),auth[_0x6192('0x9')](),controller[_0x6192('0xd')]);router['post']('/',auth[_0x6192('0x9')](),controller[_0x6192('0xe')]);router['post'](_0x6192('0xf'),auth[_0x6192('0x9')](),controller[_0x6192('0x10')]);router['post'](_0x6192('0x11'),auth['isAuthenticated'](),interaction['tracked'](_0x6192('0x12'),_0x6192('0x13')),controller['addTags']);router[_0x6192('0x14')](_0x6192('0xa'),auth[_0x6192('0x9')](),interaction['tracked'](_0x6192('0x12'),_0x6192('0x15')),controller[_0x6192('0x16')]);router[_0x6192('0x17')](_0x6192('0xa'),auth[_0x6192('0x9')](),interaction[_0x6192('0x18')](_0x6192('0x12'),'openchannelinteraction:destroy'),controller[_0x6192('0x19')]);router['delete']('/:id/tags',auth[_0x6192('0x9')](),controller['removeTags']);module[_0x6192('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 444ca2f..afbe120 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 _0xc0b9=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x4ba30a,_0x21acc9){var _0x432587=function(_0xfcd330){while(--_0xfcd330){_0x4ba30a['push'](_0x4ba30a['shift']());}};_0x432587(++_0x21acc9);}(_0xc0b9,0x1e2));var _0x9c0b=function(_0x234764,_0x46a96e){_0x234764=_0x234764-0x0;var _0x12d8da=_0xc0b9[_0x234764];return _0x12d8da;};'use strict';var Sequelize=require(_0x9c0b('0x0'));module[_0x9c0b('0x1')]={'closed':{'type':Sequelize[_0x9c0b('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9c0b('0x3')]},'threadId':{'type':Sequelize[_0x9c0b('0x4')]},'externalUrl':{'type':Sequelize[_0x9c0b('0x4')]},'lastMsgAt':{'type':Sequelize[_0x9c0b('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9c0b('0x5')]('in',_0x9c0b('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x9c0b('0x4')]}}; \ No newline at end of file +var _0x4803=['sequelize','exports','DATE','STRING'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x4803,0x1d4));var _0x3480=function(_0x1f2d62,_0x26b666){_0x1f2d62=_0x1f2d62-0x0;var _0x40f3a6=_0x4803[_0x1f2d62];return _0x40f3a6;};'use strict';var Sequelize=require(_0x3480('0x0'));module[_0x3480('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3480('0x2')]},'disposition':{'type':Sequelize[_0x3480('0x3')]},'note':{'type':Sequelize[_0x3480('0x3')]},'read1stAt':{'type':Sequelize[_0x3480('0x2')]},'threadId':{'type':Sequelize[_0x3480('0x3')]},'externalUrl':{'type':Sequelize[_0x3480('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3480('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index bac3eec..f320b2d 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 _0x6a4a=['update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','push','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','isEmpty','forEach','OpenchannelAccountId','where','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','sequelize','toString','length','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','catch','show','params','include','merge','create','body','describe','addMessage','ids','findOne','OpenchannelMessage','filter','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','setTags','omit','Tag','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','Attachment','Messages','direction','Owner','get','mkdirSync','10px','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','Account','N.A.','closed','closedAt','disposition','threadId','Public','Private','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','renderFile','views','toFile','transcript-','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save'];(function(_0x4c57f3,_0x9f9270){var _0x2ac0bc=function(_0x48ecff){while(--_0x48ecff){_0x4c57f3['push'](_0x4c57f3['shift']());}};_0x2ac0bc(++_0x9f9270);}(_0x6a4a,0xcc));var _0xa6a4=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x6a4a[_0x3cae69];return _0x3128eb;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa6a4('0x0'));var jsonpatch=require(_0xa6a4('0x1'));var rp=require(_0xa6a4('0x2'));var moment=require(_0xa6a4('0x3'));var BPromise=require(_0xa6a4('0x4'));var Mustache=require('mustache');var util=require(_0xa6a4('0x5'));var path=require('path');var sox=require(_0xa6a4('0x6'));var csv=require('to-csv');var ejs=require(_0xa6a4('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa6a4('0x8'));var crypto=require('crypto');var jsforce=require(_0xa6a4('0x9'));var deskjs=require(_0xa6a4('0xa'));var toCsv=require(_0xa6a4('0xb'));var querystring=require(_0xa6a4('0xc'));var Papa=require(_0xa6a4('0xd'));var Redis=require(_0xa6a4('0xe'));var authService=require(_0xa6a4('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa6a4('0x10'));var hardwareService=require(_0xa6a4('0x11'));var logger=require(_0xa6a4('0x12'))(_0xa6a4('0x13'));var utils=require(_0xa6a4('0x14'));var config=require(_0xa6a4('0x15'));var db=require('../../mysqldb')['db'];config[_0xa6a4('0x16')]=_[_0xa6a4('0x17')](config[_0xa6a4('0x16')],{'host':_0xa6a4('0x18'),'port':0x18eb});var socket=require(_0xa6a4('0x19'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x53fe1c,_0x9b47b5){_0x9b47b5=_0x9b47b5||0xcc;return function(_0x5ce93f){if(_0x5ce93f){return _0x53fe1c[_0xa6a4('0x1a')](_0x9b47b5);}return _0x53fe1c[_0xa6a4('0x1b')](_0x9b47b5)[_0xa6a4('0x1c')]();};}function respondWithResult(_0xa231af,_0x364f0a){_0x364f0a=_0x364f0a||0xc8;return function(_0x1def44){if(_0x1def44){return _0xa231af[_0xa6a4('0x1b')](_0x364f0a)[_0xa6a4('0x1d')](_0x1def44);}};}function respondWithFilteredResult(_0x4ecab5,_0x3561b8){return function(_0x1aaf71){if(_0x1aaf71){var _0x57a4ec=_0x1aaf71[_0xa6a4('0x1e')],_0x29c5c8=_0x3561b8[_0xa6a4('0x1f')],_0x3f7565=_0x3561b8[_0xa6a4('0x1f')]+_0x3561b8[_0xa6a4('0x20')],_0x3ef5e8;if(_0x3f7565>=_0x57a4ec){_0x3f7565=_0x57a4ec;_0x3ef5e8=0xc8;}else{_0x3ef5e8=0xce;}_0x4ecab5[_0xa6a4('0x1b')](_0x3ef5e8);return _0x4ecab5[_0xa6a4('0x21')]('Content-Range',_0x29c5c8+'-'+_0x3f7565+'/'+_0x57a4ec)['json'](_0x1aaf71);}return null;};}function patchUpdates(_0x452f25){return function(_0x5a0645){try{jsonpatch[_0xa6a4('0x22')](_0x5a0645,_0x452f25,!![]);}catch(_0x4d0032){return BPromise[_0xa6a4('0x23')](_0x4d0032);}return _0x5a0645[_0xa6a4('0x24')]();};}function saveUpdates(_0x399897,_0x4d06b2){return function(_0x481e00){if(_0x481e00){return _0x481e00[_0xa6a4('0x25')](_0x399897)[_0xa6a4('0x26')](function(_0x1cc4f6){return _0x1cc4f6;});}return null;};}function removeEntity(_0x3ac3f4,_0x1ecc9f){return function(_0x5cd00b){if(_0x5cd00b){return _0x5cd00b[_0xa6a4('0x27')]()[_0xa6a4('0x26')](function(){_0x3ac3f4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12ed73,_0x477ef5){return function(_0x208d57){if(!_0x208d57){_0x12ed73['sendStatus'](0x194);}return _0x208d57;};}function handleError(_0x24c4c6,_0x4b54f1){_0x4b54f1=_0x4b54f1||0x1f4;return function(_0x1de189){logger[_0xa6a4('0x28')](_0x1de189[_0xa6a4('0x29')]);if(_0x1de189[_0xa6a4('0x2a')]){delete _0x1de189[_0xa6a4('0x2a')];}_0x24c4c6[_0xa6a4('0x1b')](_0x4b54f1)[_0xa6a4('0x2b')](_0x1de189);};}function getInteractionUsers(_0x1bf671,_0x38bed9){return new BPromise(function(_0x58c5d9,_0x9f946e){try{if(_0x38bed9[_0x1bf671['id']]){_0x1bf671[_0xa6a4('0x2c')]=_[_0xa6a4('0x2d')](_0x38bed9[_0x1bf671['id']],function(_0x291f8c){return{'id':_0x291f8c['id'],'fullname':_0x291f8c[_0xa6a4('0x2e')]};});}}catch(_0x247ef6){_0x9f946e(_0x247ef6);}_0x58c5d9(_0x1bf671);});}function getInteractionTags(_0x27da55,_0x5342b6){return new BPromise(function(_0x556657,_0x3c7930){try{if(_0x27da55[_0xa6a4('0x2f')]){_0x27da55[_0xa6a4('0x30')]=[];_0x27da55[_0xa6a4('0x2f')]['split'](',')['forEach'](function(_0x1b4d78){_0x27da55[_0xa6a4('0x30')][_0xa6a4('0x31')](_0x5342b6[_0x1b4d78]);});}delete _0x27da55[_0xa6a4('0x2f')];}catch(_0x1cb2a8){_0x3c7930(_0x1cb2a8);}_0x556657(_0x27da55);});}function updateOpenchannelInteraction(_0x466ad5,_0x542353,_0x33a6bb){return new BPromise(function(_0x5d17d7,_0x2519c5){return getInteractionUsers(_0x466ad5,_0x33a6bb)[_0xa6a4('0x26')](function(_0x245af2){return getInteractionTags(_0x245af2,_0x542353);})[_0xa6a4('0x26')](function(_0x4eb588){_0x5d17d7(_0x4eb588);})['catch'](function(_0x3a58e7){_0x2519c5(_0x3a58e7);});});}exports['index']=function(_0x1a3b88,_0x5157d0){var _0x209b4f={},_0x1275a9={},_0x61177e={'count':0x0,'rows':[]};var _0x16fcae=_[_0xa6a4('0x2d')](db['OpenchannelInteraction'][_0xa6a4('0x32')],function(_0x1aa32e){return{'name':_0x1aa32e[_0xa6a4('0x33')],'type':_0x1aa32e['type'][_0xa6a4('0x34')]};});_0x1275a9[_0xa6a4('0x35')]=_['map'](_0x16fcae,'name');_0x1275a9['query']=_[_0xa6a4('0x36')](_0x1a3b88[_0xa6a4('0x37')]);_0x1275a9[_0xa6a4('0x38')]=_[_0xa6a4('0x39')](_0x1275a9['model'],_0x1275a9[_0xa6a4('0x37')]);_0x209b4f[_0xa6a4('0x3a')]=_[_0xa6a4('0x39')](_0x1275a9['model'],qs[_0xa6a4('0x3b')](_0x1a3b88['query'][_0xa6a4('0x3b')]));_0x209b4f[_0xa6a4('0x3a')]=_0x209b4f['attributes']['length']?_0x209b4f[_0xa6a4('0x3a')]:_0x1275a9[_0xa6a4('0x35')];if(!_0x1a3b88[_0xa6a4('0x37')]['hasOwnProperty'](_0xa6a4('0x3c'))){_0x209b4f['limit']=qs['limit'](_0x1a3b88['query'][_0xa6a4('0x20')]);_0x209b4f[_0xa6a4('0x1f')]=qs[_0xa6a4('0x1f')](_0x1a3b88[_0xa6a4('0x37')][_0xa6a4('0x1f')]);}_0x209b4f[_0xa6a4('0x3d')]=qs[_0xa6a4('0x3e')](_0x1a3b88[_0xa6a4('0x37')][_0xa6a4('0x3e')]);_0x209b4f['where']=qs[_0xa6a4('0x38')](_[_0xa6a4('0x3f')](_0x1a3b88[_0xa6a4('0x37')],_0x1275a9['filters']));var _0x4b6706=[];var _0x3598e4=squel[_0xa6a4('0x40')]()[_0xa6a4('0x41')]('id')[_0xa6a4('0x41')]('name')['field'](_0xa6a4('0x42'))[_0xa6a4('0x43')](_0xa6a4('0x44'));var _0x326439=squel['select']()[_0xa6a4('0x41')]('u.id')[_0xa6a4('0x41')](_0xa6a4('0x45'))['field'](_0xa6a4('0x46'))[_0xa6a4('0x43')](_0xa6a4('0x47'),'ui')[_0xa6a4('0x48')](_0xa6a4('0x49'),'u',_0xa6a4('0x4a'));var _0x263687=squel[_0xa6a4('0x40')]()[_0xa6a4('0x43')](_0xa6a4('0x4b'),'i')[_0xa6a4('0x48')](_0xa6a4('0x4c'),'c',_0xa6a4('0x4d'))[_0xa6a4('0x48')](_0xa6a4('0x49'),'o','o.id\x20=\x20i.UserId')[_0xa6a4('0x48')](_0xa6a4('0x4e'),'a',_0xa6a4('0x4f'))[_0xa6a4('0x48')](_0xa6a4('0x50'),'me',_0xa6a4('0x51'))['left_join'](_0xa6a4('0x52'),'it',_0xa6a4('0x53'))['left_join'](_0xa6a4('0x44'),'t',_0xa6a4('0x54'));var _0x4a8f36=squel[_0xa6a4('0x55')]();var _0x3da966=[];var _0x270582=squel['expr']();var _0x3660ab;if(_0x1a3b88[_0xa6a4('0x37')][_0xa6a4('0x56')]){_0x3660ab=as[_0xa6a4('0x57')](_0x1a3b88[_0xa6a4('0x37')][_0xa6a4('0x56')]);var _0x1430fe=_0x3660ab[_0xa6a4('0x58')];for(var _0x323965=0x0;_0x323965<_0x3660ab[_0xa6a4('0x59')]['length'];_0x323965++){var _0x1a2b80=_0x3660ab['conditions'][_0x323965];var _0x405a49='i';var _0x2d03bc=_[_0xa6a4('0x5a')](_0x16fcae,['name',_0x1a2b80[_0xa6a4('0x41')]]);if(!_0x2d03bc){switch(_0x1a2b80[_0xa6a4('0x41')]){case'unreadMessages':if(_0x1a2b80[_0xa6a4('0x5b')]==0x1){_0x263687[_0xa6a4('0x5c')]('`'+_0x1a2b80[_0xa6a4('0x41')]+_0xa6a4('0x5d'));}else{_0x263687[_0xa6a4('0x5c')]('`'+_0x1a2b80['field']+_0xa6a4('0x5e'));}break;case _0xa6a4('0x5f'):if(_0x1a2b80[_0xa6a4('0x60')]===_0xa6a4('0x61')){if(_0x1a2b80['value'][_0xa6a4('0x62')]('\x20')['length']>0x1){_0x4a8f36[_0x1430fe](_0xa6a4('0x63'),qs[_0xa6a4('0x64')](_0x1a2b80['value']),null);}else{var _0x3fdd42='%'+_0x1a2b80['value']+'%';_0x4a8f36[_0x1430fe](_0xa6a4('0x65'),_0x3fdd42,_0x3fdd42,_0x3fdd42);}}else{_0x2d03bc=_[_0xa6a4('0x5a')](_0x16fcae,[_0xa6a4('0x2a'),_0xa6a4('0x66')]);_0x1a2b80[_0xa6a4('0x41')]='ContactId';_0x3d5224=as[_0xa6a4('0x67')](_0x405a49,_0x2d03bc[_0xa6a4('0x68')],_0x1a2b80);_0x4a8f36[_0x1430fe](_0x3d5224[_0xa6a4('0x69')],_0x3d5224['value']['start'],_0x3d5224[_0xa6a4('0x5b')][_0xa6a4('0x1c')]);}break;case'Tag':var _0x5b31d0=_0x1a2b80[_0xa6a4('0x5b')]['split'](',')[_0xa6a4('0x2d')](function(_0x61ce67){return Number(_0x61ce67);});_0x5b31d0['forEach'](function(_0x589c9c){_0x270582['or'](_0xa6a4('0x6a'),'%,'+_0x589c9c+',%');});_0x3da966=_[_0xa6a4('0x6b')](_0x3da966,_0x5b31d0);break;case _0xa6a4('0x6c'):if(_0x1a2b80['operator']===_0xa6a4('0x61')){_0x4a8f36[_0x1430fe](_0xa6a4('0x6d'),'%'+_0x1a2b80[_0xa6a4('0x5b')]+'%',null);}else{_0x2d03bc=_[_0xa6a4('0x5a')](_0x16fcae,['name',_0xa6a4('0x6e')]);_0x1a2b80[_0xa6a4('0x41')]=_0xa6a4('0x6e');_0x3d5224=as['buildExpression'](_0x405a49,_0x2d03bc[_0xa6a4('0x68')],_0x1a2b80);_0x4a8f36[_0x1430fe](_0x3d5224[_0xa6a4('0x69')],_0x3d5224[_0xa6a4('0x5b')][_0xa6a4('0x6f')],_0x3d5224[_0xa6a4('0x5b')]['end']);}break;case'body':_0x3d5224=as[_0xa6a4('0x67')]('me',null,_0x1a2b80);_0x4a8f36[_0x1430fe](_0x3d5224[_0xa6a4('0x69')],_0x3d5224[_0xa6a4('0x5b')][_0xa6a4('0x6f')],_0x3d5224['value'][_0xa6a4('0x1c')]);break;}}else{var _0x3d5224=as[_0xa6a4('0x67')](_0x405a49,_0x2d03bc['type'],_0x1a2b80);_0x4a8f36[_0x1430fe](_0x3d5224[_0xa6a4('0x69')],_0x3d5224[_0xa6a4('0x5b')][_0xa6a4('0x6f')],_0x3d5224[_0xa6a4('0x5b')]['end']);}}}else{var _0x5ab3e5=_(_0x1a3b88[_0xa6a4('0x37')])['keys']()['map'](function(_0x2072ad){return _[_0xa6a4('0x70')](_0x16fcae,[_0xa6a4('0x2a'),_0x2072ad])?_0x2072ad:undefined;})['compact']()[_0xa6a4('0x5b')]();if(!_[_0xa6a4('0x71')](_0x5ab3e5)){_0x5ab3e5[_0xa6a4('0x72')](function(_0x16180e){if(_0x16180e===_0xa6a4('0x73')){_0x263687[_0xa6a4('0x74')]('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x1a3b88[_0xa6a4('0x37')][_0x16180e]));}else if(_0x16180e===_0xa6a4('0x75')){var _0x29b21e=JSON[_0xa6a4('0x76')](_0x1a3b88[_0xa6a4('0x37')][_0x16180e])[_0xa6a4('0x77')];var _0x396a33=JSON[_0xa6a4('0x76')](_0x1a3b88['query'][_0x16180e])[_0xa6a4('0x78')];_0x263687[_0xa6a4('0x74')](_0xa6a4('0x79'),_0x29b21e,_0x396a33);}else{if(_0x1a3b88[_0xa6a4('0x37')][_0x16180e]===_0xa6a4('0x7a')){_0x263687['where']('i.'+_0x16180e+'\x20IS\x20NULL');}else{_0x263687[_0xa6a4('0x74')]('i.'+_0x16180e+_0xa6a4('0x7b'),_0x1a3b88[_0xa6a4('0x37')][_0x16180e]);}}});}if(_0x1a3b88[_0xa6a4('0x37')]['read']){if(_0x1a3b88[_0xa6a4('0x37')][_0xa6a4('0x7c')]==0x1){_0x263687['having']('`unreadMessages`\x20=\x200');}else{_0x263687['having'](_0xa6a4('0x7d'));}}if(_0x1a3b88[_0xa6a4('0x37')]['tag']){_0x3da966=_[_0xa6a4('0x7e')](_0x1a3b88[_0xa6a4('0x37')]['tag'])?_0x1a3b88['query'][_0xa6a4('0x7f')]:new Array(_0x1a3b88[_0xa6a4('0x37')][_0xa6a4('0x7f')]);_0x3da966[_0xa6a4('0x72')](function(_0x2580e8){_0x270582['or'](_0xa6a4('0x6a'),'%,'+_0x2580e8+',%');});}if(_0x1a3b88[_0xa6a4('0x37')]['filter']){var _0x2bdcc3=_0x1a3b88['query']['filter'][_0xa6a4('0x80')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xa6a4('0x81'));if(qs[_0xa6a4('0x82')](_0x2bdcc3)){_0x4a8f36['or'](_0xa6a4('0x83'),_0x2bdcc3+'%');}else{_0x4a8f36['or'](_0xa6a4('0x84'),qs[_0xa6a4('0x64')](_0x2bdcc3))['or'](_0xa6a4('0x85'),_0x2bdcc3+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2bdcc3+'%');}}}_0x263687[_0xa6a4('0x74')](_0x4a8f36);_0x263687[_0xa6a4('0x86')](_0xa6a4('0x87'));var _0x377d21={'type':db[_0xa6a4('0x88')][_0xa6a4('0x89')]['SELECT'],'raw':!![]};var _0x2c3a22=_0x263687[_0xa6a4('0x8a')]();_0x2c3a22[_0xa6a4('0x41')](_0xa6a4('0x87'));_0x2c3a22['field'](_0xa6a4('0x8b'),_0xa6a4('0x8c'));if(_0x209b4f[_0xa6a4('0x3d')]){_0x209b4f[_0xa6a4('0x3d')][_0xa6a4('0x72')](function(_0x3b2873){_0x263687[_0xa6a4('0x3d')]('i.'+_0x3b2873[0x0],_0x3b2873[0x1]===_0xa6a4('0x8d')?![]:!![]);});}if(!_['isEmpty'](_0x3da966)){_0x263687['having'](_0x270582);_0x2c3a22[_0xa6a4('0x74')](_0xa6a4('0x8e'),_0x3da966);}BPromise['resolve']()['then'](function(){if(!_0x3660ab){if(_0x1a3b88[_0xa6a4('0x37')][_0xa6a4('0x73')]||_0x1a3b88[_0xa6a4('0x37')][_0xa6a4('0x8f')])return;_0x2c3a22[_0xa6a4('0x74')](_0xa6a4('0x90'));_0x263687[_0xa6a4('0x74')](_0xa6a4('0x90'));return;}return _0x1a3b88[_0xa6a4('0x91')][_0xa6a4('0x92')]({'attributes':['id'],'raw':!![]})[_0xa6a4('0x26')](function(_0x310804){if(_[_0xa6a4('0x71')](_0x310804)){_0x2c3a22[_0xa6a4('0x74')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x263687[_0xa6a4('0x74')](_0xa6a4('0x93'));}else{_0x2c3a22['where'](_0xa6a4('0x94'),_[_0xa6a4('0x2d')](_0x310804,'id'));_0x263687[_0xa6a4('0x74')](_0xa6a4('0x94'),_[_0xa6a4('0x2d')](_0x310804,'id'));}});})[_0xa6a4('0x26')](function(){db[_0xa6a4('0x95')]['query'](_0x2c3a22[_0xa6a4('0x96')](),_0x377d21)[_0xa6a4('0x26')](function(_0x1433a6){_0x61177e['count']=_0x1433a6[_0xa6a4('0x97')];if(_0x61177e['count']===0x0)return[];return db[_0xa6a4('0x95')][_0xa6a4('0x37')](_0x3598e4[_0xa6a4('0x96')](),_0x377d21)[_0xa6a4('0x26')](function(_0x4537a0){_0x4b6706=_['keyBy'](_0x4537a0,'id');_0x377d21=_['merge'](_0x377d21,{'model':db[_0xa6a4('0x98')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a3b88[_0xa6a4('0x37')][_0xa6a4('0x3b')]){_0x209b4f[_0xa6a4('0x3a')][_0xa6a4('0x72')](function(_0x266fdd){_0x263687[_0xa6a4('0x41')]('i.'+_0x266fdd);});}else{_0x263687[_0xa6a4('0x41')](_0xa6a4('0x8b'),_0xa6a4('0x8c'));_0x263687[_0xa6a4('0x41')](_0xa6a4('0x99'),_0xa6a4('0x9a'));_0x263687[_0xa6a4('0x41')](_0xa6a4('0x9b'),_0xa6a4('0x9c'));_0x263687[_0xa6a4('0x41')](_0xa6a4('0x9d'));_0x263687[_0xa6a4('0x41')](_0xa6a4('0x9e'),'Contact.firstName');_0x263687[_0xa6a4('0x41')](_0xa6a4('0x9f'),'Contact.lastName');_0x263687[_0xa6a4('0x41')](_0xa6a4('0xa0'),_0xa6a4('0xa1'));_0x263687['field'](_0xa6a4('0xa2'),_0xa6a4('0xa3'));_0x263687[_0xa6a4('0x41')](_0xa6a4('0xa4'),_0xa6a4('0xa5'));_0x263687[_0xa6a4('0x41')](_0xa6a4('0xa6'),'Contact.fax');_0x263687[_0xa6a4('0x41')](_0xa6a4('0xa7'),_0xa6a4('0xa8'));_0x263687[_0xa6a4('0x41')](_0xa6a4('0xa9'),_0xa6a4('0xaa'));_0x263687[_0xa6a4('0x41')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}_0x263687[_0xa6a4('0x20')](_0x209b4f[_0xa6a4('0x20')]);_0x263687[_0xa6a4('0x1f')](_0x209b4f[_0xa6a4('0x1f')]);return db[_0xa6a4('0x95')]['query'](_0x263687['toString'](),_0x377d21);})[_0xa6a4('0x26')](function(_0xc1c262){_0x326439[_0xa6a4('0x74')](_0xa6a4('0xab'),_[_0xa6a4('0x2d')](_0xc1c262,'id'));return db[_0xa6a4('0x95')][_0xa6a4('0x37')](_0x326439[_0xa6a4('0x96')](),_0x377d21)[_0xa6a4('0x26')](function(_0x4f97e9){var _0x3d0512=_[_0xa6a4('0xac')](_0x4f97e9,_0xa6a4('0xad'));var _0x1cca43=[];_0xc1c262['forEach'](function(_0xc3b8d1){_0x1cca43[_0xa6a4('0x31')](updateOpenchannelInteraction(_0xc3b8d1,_0x4b6706,_0x3d0512));});return BPromise[_0xa6a4('0xae')](_0x1cca43);});});})['then'](function(_0x385acd){_0x61177e[_0xa6a4('0xaf')]=_0x385acd;return _0x61177e;})['then'](respondWithFilteredResult(_0x5157d0,_0x209b4f));})[_0xa6a4('0xb0')](handleError(_0x5157d0,null));};exports[_0xa6a4('0xb1')]=function(_0x52e7cb,_0x4d4c66){var _0x360d9c={'raw':![],'where':{'id':_0x52e7cb[_0xa6a4('0xb2')]['id']}},_0xdf388d={};_0xdf388d[_0xa6a4('0x35')]=_[_0xa6a4('0x36')](db[_0xa6a4('0x98')][_0xa6a4('0x32')]);_0xdf388d[_0xa6a4('0x37')]=_['keys'](_0x52e7cb[_0xa6a4('0x37')]);_0xdf388d[_0xa6a4('0x38')]=_[_0xa6a4('0x39')](_0xdf388d[_0xa6a4('0x35')],_0xdf388d[_0xa6a4('0x37')]);_0x360d9c[_0xa6a4('0x3a')]=_[_0xa6a4('0x39')](_0xdf388d[_0xa6a4('0x35')],qs[_0xa6a4('0x3b')](_0x52e7cb[_0xa6a4('0x37')][_0xa6a4('0x3b')]));_0x360d9c['attributes']=_0x360d9c[_0xa6a4('0x3a')]['length']?_0x360d9c['attributes']:_0xdf388d[_0xa6a4('0x35')];if(_0x52e7cb[_0xa6a4('0x37')]['includeAll']){_0x360d9c[_0xa6a4('0xb3')]=[{'all':!![]}];}_0x360d9c=_[_0xa6a4('0xb4')]({},_0x360d9c,_0x52e7cb['options']);return db['OpenchannelInteraction'][_0xa6a4('0x5a')](_0x360d9c)[_0xa6a4('0x26')](handleEntityNotFound(_0x4d4c66,null))[_0xa6a4('0x26')](respondWithResult(_0x4d4c66,null))[_0xa6a4('0xb0')](handleError(_0x4d4c66,null));};exports[_0xa6a4('0xb5')]=function(_0x4f9cd7,_0x43c408){return db[_0xa6a4('0x98')][_0xa6a4('0xb5')](_0x4f9cd7[_0xa6a4('0xb6')],{})[_0xa6a4('0x26')](respondWithResult(_0x43c408,0xc9))[_0xa6a4('0xb0')](handleError(_0x43c408,null));};exports[_0xa6a4('0x25')]=function(_0x1c2261,_0x384bba){if(_0x1c2261['body']['id']){delete _0x1c2261['body']['id'];}return db[_0xa6a4('0x98')][_0xa6a4('0x5a')]({'where':{'id':_0x1c2261[_0xa6a4('0xb2')]['id']}})[_0xa6a4('0x26')](handleEntityNotFound(_0x384bba,null))[_0xa6a4('0x26')](saveUpdates(_0x1c2261[_0xa6a4('0xb6')],null))['then'](respondWithResult(_0x384bba,null))[_0xa6a4('0xb0')](handleError(_0x384bba,null));};exports['destroy']=function(_0x151936,_0x21f76f){return db['OpenchannelInteraction'][_0xa6a4('0x5a')]({'where':{'id':_0x151936[_0xa6a4('0xb2')]['id']}})[_0xa6a4('0x26')](handleEntityNotFound(_0x21f76f,null))[_0xa6a4('0x26')](removeEntity(_0x21f76f,null))['catch'](handleError(_0x21f76f,null));};exports['describe']=function(_0x14a768,_0x249cac){return db[_0xa6a4('0x98')][_0xa6a4('0xb7')]()[_0xa6a4('0x26')](respondWithResult(_0x249cac,null))[_0xa6a4('0xb0')](handleError(_0x249cac,null));};exports[_0xa6a4('0xb8')]=function(_0x4414a5,_0x3dcaa9,_0x42f915){return db['OpenchannelMessage'][_0xa6a4('0x5a')]({'where':{'id':_0x4414a5['params']['id']}})[_0xa6a4('0x26')](handleEntityNotFound(_0x3dcaa9,null))[_0xa6a4('0x26')](function(_0x293c29){if(_0x293c29){return _0x293c29[_0xa6a4('0xb8')](_0x4414a5[_0xa6a4('0xb6')][_0xa6a4('0xb9')],_['omit'](_0x4414a5['body'],[_0xa6a4('0xb9'),'id'])||{});}})[_0xa6a4('0x26')](respondWithResult(_0x3dcaa9,null))['catch'](handleError(_0x3dcaa9,null));};exports['getMessages']=function(_0x5c660d,_0x348fa5,_0x553aee){var _0x1e26ea={'raw':![],'where':{}};var _0x116cd0={};var _0x4fbcef={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xa6a4('0xba')]({'where':{'id':_0x5c660d[_0xa6a4('0xb2')]['id']}})[_0xa6a4('0x26')](handleEntityNotFound(_0x348fa5,null))[_0xa6a4('0x26')](function(_0x219eff){if(_0x219eff){_0x116cd0[_0xa6a4('0x35')]=_[_0xa6a4('0x36')](db[_0xa6a4('0xbb')][_0xa6a4('0x32')]);_0x116cd0[_0xa6a4('0x37')]=_[_0xa6a4('0x36')](_0x5c660d[_0xa6a4('0x37')]);_0x116cd0[_0xa6a4('0x38')]=_[_0xa6a4('0x39')](_0x116cd0['model'],_0x116cd0[_0xa6a4('0x37')]);_0x1e26ea['attributes']=_['intersection'](_0x116cd0[_0xa6a4('0x35')],qs['fields'](_0x5c660d[_0xa6a4('0x37')][_0xa6a4('0x3b')]));_0x1e26ea[_0xa6a4('0x3a')]=_0x1e26ea[_0xa6a4('0x3a')]['length']?_0x1e26ea[_0xa6a4('0x3a')]:_0x116cd0[_0xa6a4('0x35')];if(!_0x5c660d['query']['hasOwnProperty'](_0xa6a4('0x3c'))){_0x1e26ea[_0xa6a4('0x20')]=qs['limit'](_0x5c660d[_0xa6a4('0x37')][_0xa6a4('0x20')]);_0x1e26ea[_0xa6a4('0x1f')]=qs['offset'](_0x5c660d[_0xa6a4('0x37')][_0xa6a4('0x1f')]);}_0x1e26ea[_0xa6a4('0x3d')]=qs[_0xa6a4('0x3e')](_0x5c660d[_0xa6a4('0x37')][_0xa6a4('0x3e')]);_0x1e26ea['where']=qs[_0xa6a4('0x38')](_[_0xa6a4('0x3f')](_0x5c660d[_0xa6a4('0x37')],_0x116cd0['filters']));_0x1e26ea[_0xa6a4('0x74')][_0xa6a4('0xad')]=_0x219eff['id'];if(_0x5c660d['query'][_0xa6a4('0xbc')]){_0x1e26ea['where']=_[_0xa6a4('0xb4')](_0x1e26ea['where'],{'$or':_[_0xa6a4('0x2d')](_0x1e26ea[_0xa6a4('0x3a')],function(_0x24e476){var _0x57c8c9={};_0x57c8c9[_0x24e476]={'$like':'%'+_0x5c660d['query']['filter']+'%'};return _0x57c8c9;})});}if(_0x5c660d[_0xa6a4('0x37')][_0xa6a4('0x77')]){var _0x16be2c=_0x5c660d['query'][_0xa6a4('0x77')]['split'](',');var _0x42c169={};_0x42c169[_0x16be2c[0x0]]={'$gte':moment(_0x16be2c[0x1])[_0xa6a4('0xbd')](_0xa6a4('0xbe'))};_0x1e26ea[_0xa6a4('0x74')]=_[_0xa6a4('0xb4')](_0x1e26ea[_0xa6a4('0x74')],_0x42c169);}_0x1e26ea=_['merge']({},_0x1e26ea,_0x5c660d['options']);return db[_0xa6a4('0xbb')][_0xa6a4('0x1e')]({'where':_0x1e26ea[_0xa6a4('0x74')]})[_0xa6a4('0x26')](function(_0x5a3983){_0x4fbcef[_0xa6a4('0x1e')]=_0x5a3983;if(_0x5c660d[_0xa6a4('0x37')][_0xa6a4('0xbf')]){_0x1e26ea[_0xa6a4('0xb3')]=[{'all':!![]}];}return db[_0xa6a4('0xbb')][_0xa6a4('0xc0')](_0x1e26ea);})[_0xa6a4('0x26')](function(_0xf9a356){_0x4fbcef['rows']=_0xf9a356;return _0x4fbcef;});}})['then'](respondWithFilteredResult(_0x348fa5,_0x1e26ea))['catch'](handleError(_0x348fa5,null));};exports['addTags']=function(_0x59ca92,_0x4b64e4,_0xc07e66){return db[_0xa6a4('0x98')][_0xa6a4('0x5a')]({'where':{'id':_0x59ca92[_0xa6a4('0xb2')]['id']}})['then'](handleEntityNotFound(_0x4b64e4,null))[_0xa6a4('0x26')](function(_0x1d5473){if(_0x1d5473){return _0x1d5473[_0xa6a4('0xc1')](_0x59ca92[_0xa6a4('0xb6')][_0xa6a4('0xb9')],_[_0xa6a4('0xc2')](_0x59ca92['body'],[_0xa6a4('0xb9'),'id'])||{})['spread'](function(){return db[_0xa6a4('0xc3')]['findAll']({'attributes':['id',_0xa6a4('0x2a'),_0xa6a4('0x42')],'where':{'id':_0x59ca92[_0xa6a4('0xb6')][_0xa6a4('0xb9')]}});})[_0xa6a4('0x26')](function(_0x3d80f6){socket['emit'](_0xa6a4('0xc4'),{'id':Number(_0x59ca92['params']['id']),'tags':_0x3d80f6||[]});return{'id':Number(_0x59ca92[_0xa6a4('0xb2')]['id']),'tags':_0x3d80f6||[]};});}})['then'](respondWithResult(_0x4b64e4,null))[_0xa6a4('0xb0')](handleError(_0x4b64e4,null));};exports[_0xa6a4('0xc5')]=function(_0x3794a5,_0x376c5c,_0x56aef7){return db[_0xa6a4('0x98')][_0xa6a4('0x5a')]({'where':{'id':_0x3794a5[_0xa6a4('0xb2')]['id']}})[_0xa6a4('0x26')](handleEntityNotFound(_0x376c5c,null))[_0xa6a4('0x26')](function(_0xabaf16){if(_0xabaf16){return _0xabaf16[_0xa6a4('0xc5')](_0x3794a5[_0xa6a4('0x37')]['ids']);}})[_0xa6a4('0x26')](respondWithStatusCode(_0x376c5c,null))[_0xa6a4('0xb0')](handleError(_0x376c5c,null));};exports[_0xa6a4('0xc6')]=function(_0x5e8ba4,_0x542ae5){var _0x10b7c5=moment()[_0xa6a4('0xc7')]()[_0xa6a4('0x96')]();var _0x274a2d=path['join'](config[_0xa6a4('0xc8')],_0xa6a4('0xc9'),_0xa6a4('0xca'),_0xa6a4('0xcb'));var _0x29a037=path[_0xa6a4('0xcc')](config['root'],_0xa6a4('0xc9'),_0xa6a4('0xca'),'attachments');var _0x5a10ac=path[_0xa6a4('0xcc')](_0x274a2d,_0x10b7c5);var _0x38fec9=util[_0xa6a4('0xbd')](_0xa6a4('0xcd'),_0x5e8ba4['params']['id'],_0x10b7c5);var _0x1fcdd4=path[_0xa6a4('0xcc')](_0x274a2d,_0x38fec9);var _0x583955=[];_0x583955[_0xa6a4('0x31')]({'model':db['User'],'as':_0xa6a4('0x6c'),'attributes':['id',_0xa6a4('0x2e')],'raw':!![]});_0x583955[_0xa6a4('0x31')]({'model':db[_0xa6a4('0xce')],'as':'Contact','attributes':['id','firstName',_0xa6a4('0xcf')],'raw':!![]});if(_0x5e8ba4[_0xa6a4('0x37')]['attachments']){_0x583955['push']({'model':db[_0xa6a4('0xd0')],'as':_0xa6a4('0xd0'),'raw':!![]});}var _0x3770c6=[{'model':db[_0xa6a4('0xbb')],'as':_0xa6a4('0xd1'),'attributes':['id',_0xa6a4('0xb6'),'createdAt',_0xa6a4('0xd2'),'secret',_0xa6a4('0x7c')],'include':_0x583955}];_0x3770c6[_0xa6a4('0x31')]({'model':db['OpenchannelAccount'],'as':'Account','attributes':['id',_0xa6a4('0x2a')]});_0x3770c6['push']({'model':db[_0xa6a4('0x6c')],'as':_0xa6a4('0xd3'),'attributes':['id','fullname']});return db[_0xa6a4('0x98')][_0xa6a4('0x5a')]({'where':{'id':_0x5e8ba4[_0xa6a4('0xb2')]['id']},'include':_0x3770c6})[_0xa6a4('0x26')](handleEntityNotFound(_0x542ae5,null))[_0xa6a4('0x26')](function(_0x53a7ac){if(_0x53a7ac){var _0x219a0a=_0x53a7ac[_0xa6a4('0xd4')]({'plain':!![]});fs[_0xa6a4('0xd5')](_0x5a10ac);var _0x2eb875={'format':'A4','border':_0xa6a4('0xd6'),'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':_0xa6a4('0xd7'),'contents':{'default':util[_0xa6a4('0xbd')](_0xa6a4('0xd8'),util[_0xa6a4('0xbd')](_0xa6a4('0xd9'),_0xa6a4('0xda'),_0x219a0a['id']),moment()['format'](_0xa6a4('0xdb'))['toString']())}}};var _0x3494d2={'channel':_0xa6a4('0xda'),'account':_0x219a0a[_0xa6a4('0xdc')]['name'],'agent':_0x219a0a['Owner']?_0x219a0a[_0xa6a4('0xd3')][_0xa6a4('0x2e')]:_0xa6a4('0xdd'),'createdAt':moment(_0x219a0a['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xa6a4('0x96')](),'closedAt':_0x219a0a[_0xa6a4('0xde')]?moment(_0x219a0a[_0xa6a4('0xdf')])[_0xa6a4('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa6a4('0x96')]():'','disposition':_0x219a0a[_0xa6a4('0xe0')],'visibility':_0x219a0a[_0xa6a4('0xe1')]?_0xa6a4('0xe2'):_0xa6a4('0xe3'),'messages':_(_0x219a0a[_0xa6a4('0xd1')])[_0xa6a4('0xbc')]({'secret':![]})['map'](function(_0x46a4e4){if(_0x46a4e4[_0xa6a4('0xd0')]){var _0x24b683=path[_0xa6a4('0xcc')](_0x29a037,_0x46a4e4[_0xa6a4('0xd0')]['basename']);if(fs[_0xa6a4('0xe4')](_0x24b683)){fs[_0xa6a4('0xe5')](_0x24b683)[_0xa6a4('0xe6')](fs[_0xa6a4('0xe7')](path['join'](_0x5a10ac,_0x46a4e4[_0xa6a4('0xd0')][_0xa6a4('0xe8')])));}}return{'date':moment(_0x46a4e4[_0xa6a4('0x75')])[_0xa6a4('0xbd')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa6a4('0x96')](),'sender':_0x46a4e4[_0xa6a4('0xd2')]===_0xa6a4('0xe9')?_0x46a4e4[_0xa6a4('0x6c')]?_0x46a4e4[_0xa6a4('0x6c')][_0xa6a4('0x2e')]:_0xa6a4('0xea'):_0x46a4e4[_0xa6a4('0x5f')]['firstName']+(_0x46a4e4['Contact'][_0xa6a4('0xcf')]?'\x20'+_0x46a4e4[_0xa6a4('0x5f')]['lastName']:''),'body':_0x46a4e4[_0xa6a4('0xd0')]?_0x46a4e4['Attachment'][_0xa6a4('0xe8')]:_0x46a4e4[_0xa6a4('0xb6')],'direction':_0x46a4e4[_0xa6a4('0xd2')]===_0xa6a4('0xe9')?'A':'C','secret':_0x46a4e4['secret'],'read':_0x46a4e4['read'],'attachment':_0x46a4e4[_0xa6a4('0xd0')]};})['value']()};return ejs[_0xa6a4('0xeb')](path[_0xa6a4('0xcc')](config[_0xa6a4('0xc8')],'server',_0xa6a4('0xec'),'downloadInteraction.html'),{'interaction':_0x3494d2})[_0xa6a4('0x26')](function(_0x425ffb){return new BPromise(function(_0x3ef0d0,_0x5d2c03){pdf[_0xa6a4('0xb5')](_0x425ffb,_0x2eb875)[_0xa6a4('0xed')](path[_0xa6a4('0xcc')](_0x5a10ac,_0xa6a4('0xee')+_0x219a0a['id']+'-'+_0x10b7c5+'.pdf'),function(_0x12aff1,_0x225ebc){if(_0x12aff1)return _0x5d2c03(_0x12aff1);_0x3ef0d0(_0x225ebc);});});})[_0xa6a4('0x26')](function(){return new BPromise(function(_0xce72f4,_0x6eca10){zipdir(_0x5a10ac,{'saveTo':_0x1fcdd4},function(_0x21c0fc,_0xd6ba14){if(_0x21c0fc)return _0x6eca10(_0x21c0fc);return _0xce72f4(_0xd6ba14);});})[_0xa6a4('0x26')](function(){return new BPromise(function(_0x9ac4bd,_0x5e99a3){rimraf(_0x5a10ac,function(_0x51b740){if(_0x51b740)_0x5e99a3(_0x51b740);return _0x9ac4bd();});});})[_0xa6a4('0x26')](function(){return _0x542ae5[_0xa6a4('0xc6')](_0x1fcdd4,_0x38fec9,function(_0x1d3262){if(_0x1d3262){console['log'](_0xa6a4('0xef'),_0x1d3262);}else{fs[_0xa6a4('0xf0')](_0x1fcdd4);}});});});}else{return _0x542ae5[_0xa6a4('0x1a')](0xc8);}})[_0xa6a4('0xb0')](handleError(_0x542ae5,null));}; \ No newline at end of file +var _0x96a8=['Openchannel','YYYY-MM-DD','Account','N.A.','closed','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','out','System','secret','renderFile','server','views','downloadInteraction.html','toFile','transcript-','.pdf','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','send','Users','map','fullname','TagIds','Tags','split','forEach','catch','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','sort','where','select','field','color','from','tools_tags','u.id','u.fullname','ui.OpenchannelInteractionId','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','`\x20>\x200','Contact','$substring','value','length','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','read','having','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','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','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','OpenchannelInteractionId','push','all','show','params','includeAll','include','merge','options','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','hasOwnProperty','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','spread','unix','join','root','files','tmp','transcript-%d-%s.zip','User','firstName','lastName','Attachment','Messages','direction','OpenchannelAccount','Owner','get','mkdirSync','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d'];(function(_0x16a17a,_0x22b8ac){var _0x569e87=function(_0x44f026){while(--_0x44f026){_0x16a17a['push'](_0x16a17a['shift']());}};_0x569e87(++_0x22b8ac);}(_0x96a8,0x103));var _0x896a=function(_0x2ea6d1,_0x56636a){_0x2ea6d1=_0x2ea6d1-0x0;var _0x381137=_0x96a8[_0x2ea6d1];return _0x381137;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x896a('0x0'));var rimraf=require(_0x896a('0x1'));var zipdir=require(_0x896a('0x2'));var jsonpatch=require(_0x896a('0x3'));var rp=require(_0x896a('0x4'));var moment=require('moment');var BPromise=require(_0x896a('0x5'));var Mustache=require(_0x896a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x896a('0x7'));var csv=require(_0x896a('0x8'));var ejs=require(_0x896a('0x9'));var fs=require('fs');var _=require(_0x896a('0xa'));var squel=require(_0x896a('0xb'));var crypto=require(_0x896a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x896a('0xd'));var toCsv=require(_0x896a('0x8'));var querystring=require(_0x896a('0xe'));var Papa=require(_0x896a('0xf'));var Redis=require(_0x896a('0x10'));var authService=require(_0x896a('0x11'));var qs=require(_0x896a('0x12'));var as=require(_0x896a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x896a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x896a('0x15'));var db=require('../../mysqldb')['db'];config[_0x896a('0x16')]=_[_0x896a('0x17')](config[_0x896a('0x16')],{'host':_0x896a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x896a('0x16')]));require(_0x896a('0x19'))[_0x896a('0x1a')](socket);function respondWithStatusCode(_0x25f59c,_0x1147da){_0x1147da=_0x1147da||0xcc;return function(_0x119356){if(_0x119356){return _0x25f59c[_0x896a('0x1b')](_0x1147da);}return _0x25f59c['status'](_0x1147da)['end']();};}function respondWithResult(_0x5dcf3b,_0x93b65e){_0x93b65e=_0x93b65e||0xc8;return function(_0x4e19f7){if(_0x4e19f7){return _0x5dcf3b[_0x896a('0x1c')](_0x93b65e)[_0x896a('0x1d')](_0x4e19f7);}};}function respondWithFilteredResult(_0x914e1d,_0x33474e){return function(_0x3eb298){if(_0x3eb298){var _0x397a4b=_0x3eb298[_0x896a('0x1e')],_0x494e49=_0x33474e['offset'],_0x20cfb6=_0x33474e[_0x896a('0x1f')]+_0x33474e[_0x896a('0x20')],_0x406d82;if(_0x20cfb6>=_0x397a4b){_0x20cfb6=_0x397a4b;_0x406d82=0xc8;}else{_0x406d82=0xce;}_0x914e1d[_0x896a('0x1c')](_0x406d82);return _0x914e1d[_0x896a('0x21')](_0x896a('0x22'),_0x494e49+'-'+_0x20cfb6+'/'+_0x397a4b)[_0x896a('0x1d')](_0x3eb298);}return null;};}function patchUpdates(_0x537b1d){return function(_0x37489c){try{jsonpatch[_0x896a('0x23')](_0x37489c,_0x537b1d,!![]);}catch(_0x42bcf8){return BPromise['reject'](_0x42bcf8);}return _0x37489c[_0x896a('0x24')]();};}function saveUpdates(_0x288eea,_0x24ac7c){return function(_0x3f70f0){if(_0x3f70f0){return _0x3f70f0[_0x896a('0x25')](_0x288eea)[_0x896a('0x26')](function(_0x5c76c4){return _0x5c76c4;});}return null;};}function removeEntity(_0x2749f4,_0x3ef060){return function(_0x284b8b){if(_0x284b8b){return _0x284b8b[_0x896a('0x27')]()['then'](function(){_0x2749f4[_0x896a('0x1c')](0xcc)[_0x896a('0x28')]();});}};}function handleEntityNotFound(_0x1ab07e,_0xfc125b){return function(_0x4f22eb){if(!_0x4f22eb){_0x1ab07e[_0x896a('0x1b')](0x194);}return _0x4f22eb;};}function handleError(_0x3888d5,_0x2d1174){_0x2d1174=_0x2d1174||0x1f4;return function(_0xbef32c){logger['error'](_0xbef32c[_0x896a('0x29')]);if(_0xbef32c['name']){delete _0xbef32c['name'];}_0x3888d5[_0x896a('0x1c')](_0x2d1174)[_0x896a('0x2a')](_0xbef32c);};}function getInteractionUsers(_0x273e98,_0x3e5dc4){return new BPromise(function(_0x278081,_0x3a277d){try{if(_0x3e5dc4[_0x273e98['id']]){_0x273e98[_0x896a('0x2b')]=_[_0x896a('0x2c')](_0x3e5dc4[_0x273e98['id']],function(_0xc9699){return{'id':_0xc9699['id'],'fullname':_0xc9699[_0x896a('0x2d')]};});}}catch(_0x539fa6){_0x3a277d(_0x539fa6);}_0x278081(_0x273e98);});}function getInteractionTags(_0x48920c,_0x52d108){return new BPromise(function(_0x25dd27,_0x157a17){try{if(_0x48920c[_0x896a('0x2e')]){_0x48920c[_0x896a('0x2f')]=[];_0x48920c[_0x896a('0x2e')][_0x896a('0x30')](',')[_0x896a('0x31')](function(_0x477835){_0x48920c['Tags']['push'](_0x52d108[_0x477835]);});}delete _0x48920c[_0x896a('0x2e')];}catch(_0x189b68){_0x157a17(_0x189b68);}_0x25dd27(_0x48920c);});}function updateOpenchannelInteraction(_0x207436,_0x2c1997,_0x1ba2a7){return new BPromise(function(_0x25aa99,_0x16f098){return getInteractionUsers(_0x207436,_0x1ba2a7)['then'](function(_0x4dcd91){return getInteractionTags(_0x4dcd91,_0x2c1997);})[_0x896a('0x26')](function(_0x4a06da){_0x25aa99(_0x4a06da);})[_0x896a('0x32')](function(_0x3a7239){_0x16f098(_0x3a7239);});});}exports['index']=function(_0x43b136,_0x68797b){var _0x46694e={},_0x560ca1={},_0x36c906={'count':0x0,'rows':[]};var _0x1927be=_['map'](db[_0x896a('0x33')][_0x896a('0x34')],function(_0x32cc42){return{'name':_0x32cc42[_0x896a('0x35')],'type':_0x32cc42[_0x896a('0x36')][_0x896a('0x37')]};});_0x560ca1[_0x896a('0x38')]=_[_0x896a('0x2c')](_0x1927be,_0x896a('0x39'));_0x560ca1['query']=_[_0x896a('0x3a')](_0x43b136[_0x896a('0x3b')]);_0x560ca1[_0x896a('0x3c')]=_[_0x896a('0x3d')](_0x560ca1[_0x896a('0x38')],_0x560ca1[_0x896a('0x3b')]);_0x46694e['attributes']=_[_0x896a('0x3d')](_0x560ca1['model'],qs[_0x896a('0x3e')](_0x43b136[_0x896a('0x3b')]['fields']));_0x46694e['attributes']=_0x46694e['attributes']['length']?_0x46694e[_0x896a('0x3f')]:_0x560ca1[_0x896a('0x38')];if(!_0x43b136[_0x896a('0x3b')]['hasOwnProperty']('nolimit')){_0x46694e[_0x896a('0x20')]=qs['limit'](_0x43b136[_0x896a('0x3b')][_0x896a('0x20')]);_0x46694e['offset']=qs[_0x896a('0x1f')](_0x43b136[_0x896a('0x3b')][_0x896a('0x1f')]);}_0x46694e['order']=qs[_0x896a('0x40')](_0x43b136[_0x896a('0x3b')]['sort']);_0x46694e[_0x896a('0x41')]=qs[_0x896a('0x3c')](_['pick'](_0x43b136[_0x896a('0x3b')],_0x560ca1['filters']));var _0x4ba48a=[];var _0x4ced17=squel[_0x896a('0x42')]()[_0x896a('0x43')]('id')['field'](_0x896a('0x39'))[_0x896a('0x43')](_0x896a('0x44'))[_0x896a('0x45')](_0x896a('0x46'));var _0x13d936=squel['select']()[_0x896a('0x43')](_0x896a('0x47'))[_0x896a('0x43')](_0x896a('0x48'))['field'](_0x896a('0x49'))[_0x896a('0x45')]('user_has_openchannel_interactions','ui')[_0x896a('0x4a')]('users','u',_0x896a('0x4b'));var _0x1fdab1=squel[_0x896a('0x42')]()[_0x896a('0x45')](_0x896a('0x4c'),'i')[_0x896a('0x4a')](_0x896a('0x4d'),'c',_0x896a('0x4e'))[_0x896a('0x4a')](_0x896a('0x4f'),'o','o.id\x20=\x20i.UserId')[_0x896a('0x4a')]('openchannel_accounts','a','a.id\x20=\x20i.OpenchannelAccountId')['left_join'](_0x896a('0x50'),'me',_0x896a('0x51'))[_0x896a('0x4a')](_0x896a('0x52'),'it',_0x896a('0x53'))[_0x896a('0x4a')](_0x896a('0x46'),'t',_0x896a('0x54'));var _0x26f326=squel['expr']();var _0x27e5f1=[];var _0x38a23a=squel[_0x896a('0x55')]();var _0x437c9f;if(_0x43b136[_0x896a('0x3b')]['search']){_0x437c9f=as[_0x896a('0x56')](_0x43b136[_0x896a('0x3b')][_0x896a('0x57')]);var _0x212b6c=_0x437c9f[_0x896a('0x58')];for(var _0x31af48=0x0;_0x31af48<_0x437c9f[_0x896a('0x59')]['length'];_0x31af48++){var _0xf356d4=_0x437c9f['conditions'][_0x31af48];var _0x4e3bb5='i';var _0x1bb578=_[_0x896a('0x5a')](_0x1927be,['name',_0xf356d4['field']]);if(!_0x1bb578){switch(_0xf356d4[_0x896a('0x43')]){case _0x896a('0x5b'):if(_0xf356d4['value']==0x1){_0x1fdab1['having']('`'+_0xf356d4['field']+_0x896a('0x5c'));}else{_0x1fdab1['having']('`'+_0xf356d4[_0x896a('0x43')]+_0x896a('0x5d'));}break;case _0x896a('0x5e'):if(_0xf356d4['operator']===_0x896a('0x5f')){if(_0xf356d4[_0x896a('0x60')][_0x896a('0x30')]('\x20')[_0x896a('0x61')]>0x1){_0x26f326[_0x212b6c]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x896a('0x62')](_0xf356d4[_0x896a('0x60')]),null);}else{var _0x513abb='%'+_0xf356d4['value']+'%';_0x26f326[_0x212b6c](_0x896a('0x63'),_0x513abb,_0x513abb,_0x513abb);}}else{_0x1bb578=_[_0x896a('0x5a')](_0x1927be,['name',_0x896a('0x64')]);_0xf356d4['field']=_0x896a('0x64');_0x237b1c=as[_0x896a('0x65')](_0x4e3bb5,_0x1bb578[_0x896a('0x36')],_0xf356d4);_0x26f326[_0x212b6c](_0x237b1c[_0x896a('0x66')],_0x237b1c[_0x896a('0x60')][_0x896a('0x67')],_0x237b1c['value'][_0x896a('0x28')]);}break;case _0x896a('0x68'):var _0x180391=_0xf356d4['value'][_0x896a('0x30')](',')[_0x896a('0x2c')](function(_0xa1d3aa){return Number(_0xa1d3aa);});_0x180391['forEach'](function(_0x4b8856){_0x38a23a['or'](_0x896a('0x69'),'%,'+_0x4b8856+',%');});_0x27e5f1=_[_0x896a('0x6a')](_0x27e5f1,_0x180391);break;case'User':if(_0xf356d4[_0x896a('0x6b')]===_0x896a('0x5f')){_0x26f326[_0x212b6c](_0x896a('0x6c'),'%'+_0xf356d4[_0x896a('0x60')]+'%',null);}else{_0x1bb578=_[_0x896a('0x5a')](_0x1927be,[_0x896a('0x39'),_0x896a('0x6d')]);_0xf356d4[_0x896a('0x43')]='UserId';_0x237b1c=as[_0x896a('0x65')](_0x4e3bb5,_0x1bb578['type'],_0xf356d4);_0x26f326[_0x212b6c](_0x237b1c[_0x896a('0x66')],_0x237b1c['value'][_0x896a('0x67')],_0x237b1c[_0x896a('0x60')]['end']);}break;case _0x896a('0x6e'):_0x237b1c=as[_0x896a('0x65')]('me',null,_0xf356d4);_0x26f326[_0x212b6c](_0x237b1c[_0x896a('0x66')],_0x237b1c[_0x896a('0x60')][_0x896a('0x67')],_0x237b1c[_0x896a('0x60')][_0x896a('0x28')]);break;}}else{var _0x237b1c=as['buildExpression'](_0x4e3bb5,_0x1bb578['type'],_0xf356d4);_0x26f326[_0x212b6c](_0x237b1c[_0x896a('0x66')],_0x237b1c['value'][_0x896a('0x67')],_0x237b1c[_0x896a('0x60')][_0x896a('0x28')]);}}}else{var _0x301524=_(_0x43b136[_0x896a('0x3b')])[_0x896a('0x3a')]()['map'](function(_0x233e3e){return _[_0x896a('0x6f')](_0x1927be,['name',_0x233e3e])?_0x233e3e:undefined;})[_0x896a('0x70')]()[_0x896a('0x60')]();if(!_[_0x896a('0x71')](_0x301524)){_0x301524[_0x896a('0x31')](function(_0x3e9b07){if(_0x3e9b07===_0x896a('0x72')){_0x1fdab1[_0x896a('0x41')](_0x896a('0x73'),[][_0x896a('0x74')](_0x43b136[_0x896a('0x3b')][_0x3e9b07]));}else if(_0x3e9b07===_0x896a('0x75')){var _0x379736=JSON[_0x896a('0x76')](_0x43b136[_0x896a('0x3b')][_0x3e9b07])['$gte'];var _0x246738=JSON['parse'](_0x43b136['query'][_0x3e9b07])[_0x896a('0x77')];_0x1fdab1[_0x896a('0x41')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x379736,_0x246738);}else{if(_0x43b136[_0x896a('0x3b')][_0x3e9b07]===_0x896a('0x78')){_0x1fdab1[_0x896a('0x41')]('i.'+_0x3e9b07+_0x896a('0x79'));}else{_0x1fdab1[_0x896a('0x41')]('i.'+_0x3e9b07+'\x20=\x20?',_0x43b136['query'][_0x3e9b07]);}}});}if(_0x43b136[_0x896a('0x3b')][_0x896a('0x7a')]){if(_0x43b136[_0x896a('0x3b')][_0x896a('0x7a')]==0x1){_0x1fdab1[_0x896a('0x7b')](_0x896a('0x7c'));}else{_0x1fdab1[_0x896a('0x7b')]('`unreadMessages`\x20>\x200');}}if(_0x43b136[_0x896a('0x3b')][_0x896a('0x7d')]){_0x27e5f1=_[_0x896a('0x7e')](_0x43b136[_0x896a('0x3b')][_0x896a('0x7d')])?_0x43b136[_0x896a('0x3b')][_0x896a('0x7d')]:new Array(_0x43b136['query']['tag']);_0x27e5f1[_0x896a('0x31')](function(_0x189a49){_0x38a23a['or'](_0x896a('0x69'),'%,'+_0x189a49+',%');});}if(_0x43b136[_0x896a('0x3b')][_0x896a('0x7f')]){var _0x5e3807=_0x43b136['query'][_0x896a('0x7f')][_0x896a('0x80')]('\x5c','\x5c\x5c')[_0x896a('0x80')]('\x27\x27',_0x896a('0x81'));if(qs['isNumeric'](_0x5e3807)){_0x26f326['or'](_0x896a('0x82'),_0x5e3807+'%');}else{_0x26f326['or'](_0x896a('0x83'),qs[_0x896a('0x62')](_0x5e3807))['or'](_0x896a('0x84'),_0x5e3807+'%')['or'](_0x896a('0x85'),_0x5e3807+'%');}}}_0x1fdab1[_0x896a('0x41')](_0x26f326);_0x1fdab1[_0x896a('0x86')](_0x896a('0x87'));var _0x203dce={'type':db['Sequelize'][_0x896a('0x88')][_0x896a('0x89')],'raw':!![]};var _0x212e58=_0x1fdab1['clone']();_0x212e58[_0x896a('0x43')]('i.id');_0x212e58[_0x896a('0x43')](_0x896a('0x8a'),'unreadMessages');if(_0x46694e[_0x896a('0x8b')]){_0x46694e['order'][_0x896a('0x31')](function(_0x2b4222){_0x1fdab1[_0x896a('0x8b')]('i.'+_0x2b4222[0x0],_0x2b4222[0x1]===_0x896a('0x8c')?![]:!![]);});}if(!_[_0x896a('0x71')](_0x27e5f1)){_0x1fdab1['having'](_0x38a23a);_0x212e58[_0x896a('0x41')](_0x896a('0x8d'),_0x27e5f1);}BPromise[_0x896a('0x8e')]()[_0x896a('0x26')](function(){if(!_0x437c9f){if(_0x43b136[_0x896a('0x3b')]['OpenchannelAccountId']||_0x43b136[_0x896a('0x3b')][_0x896a('0x8f')])return;_0x212e58[_0x896a('0x41')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x1fdab1[_0x896a('0x41')](_0x896a('0x90'));return;}return _0x43b136[_0x896a('0x91')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x896a('0x26')](function(_0x9e8006){if(_[_0x896a('0x71')](_0x9e8006)){_0x212e58['where'](_0x896a('0x92'));_0x1fdab1[_0x896a('0x41')]('i.OpenchannelAccountId\x20IS\x20NULL');}else{_0x212e58[_0x896a('0x41')](_0x896a('0x73'),_['map'](_0x9e8006,'id'));_0x1fdab1[_0x896a('0x41')](_0x896a('0x73'),_[_0x896a('0x2c')](_0x9e8006,'id'));}});})[_0x896a('0x26')](function(){db[_0x896a('0x93')][_0x896a('0x3b')](_0x212e58[_0x896a('0x94')](),_0x203dce)[_0x896a('0x26')](function(_0x31fa5a){_0x36c906['count']=_0x31fa5a[_0x896a('0x61')];if(_0x36c906['count']===0x0)return[];return db['sequelize'][_0x896a('0x3b')](_0x4ced17[_0x896a('0x94')](),_0x203dce)[_0x896a('0x26')](function(_0x2a3f1b){_0x4ba48a=_[_0x896a('0x95')](_0x2a3f1b,'id');_0x203dce=_['merge'](_0x203dce,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x43b136[_0x896a('0x3b')]['fields']){_0x46694e[_0x896a('0x3f')][_0x896a('0x31')](function(_0x392338){_0x1fdab1[_0x896a('0x43')]('i.'+_0x392338);});}else{_0x1fdab1[_0x896a('0x43')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x896a('0x5b'));_0x1fdab1['field'](_0x896a('0x96'),_0x896a('0x97'));_0x1fdab1[_0x896a('0x43')](_0x896a('0x98'),_0x896a('0x99'));_0x1fdab1[_0x896a('0x43')]('i.*');_0x1fdab1[_0x896a('0x43')](_0x896a('0x9a'),_0x896a('0x9b'));_0x1fdab1[_0x896a('0x43')](_0x896a('0x9c'),'Contact.lastName');_0x1fdab1[_0x896a('0x43')]('c.email',_0x896a('0x9d'));_0x1fdab1[_0x896a('0x43')](_0x896a('0x9e'),_0x896a('0x9f'));_0x1fdab1[_0x896a('0x43')]('c.mobile','Contact.mobile');_0x1fdab1[_0x896a('0x43')](_0x896a('0xa0'),_0x896a('0xa1'));_0x1fdab1['field'](_0x896a('0xa2'),'Owner.fullname');_0x1fdab1[_0x896a('0x43')](_0x896a('0xa3'),_0x896a('0xa4'));_0x1fdab1[_0x896a('0x43')](_0x896a('0xa5'),_0x896a('0x2e'));}_0x1fdab1[_0x896a('0x20')](_0x46694e['limit']);_0x1fdab1[_0x896a('0x1f')](_0x46694e[_0x896a('0x1f')]);return db['sequelize'][_0x896a('0x3b')](_0x1fdab1[_0x896a('0x94')](),_0x203dce);})[_0x896a('0x26')](function(_0x436744){_0x13d936[_0x896a('0x41')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x436744,'id'));return db[_0x896a('0x93')][_0x896a('0x3b')](_0x13d936['toString'](),_0x203dce)[_0x896a('0x26')](function(_0x550a00){var _0x56a211=_['groupBy'](_0x550a00,_0x896a('0xa6'));var _0x3c3cb9=[];_0x436744[_0x896a('0x31')](function(_0x5e2905){_0x3c3cb9[_0x896a('0xa7')](updateOpenchannelInteraction(_0x5e2905,_0x4ba48a,_0x56a211));});return BPromise[_0x896a('0xa8')](_0x3c3cb9);});});})[_0x896a('0x26')](function(_0x6f6a84){_0x36c906['rows']=_0x6f6a84;return _0x36c906;})[_0x896a('0x26')](respondWithFilteredResult(_0x68797b,_0x46694e));})[_0x896a('0x32')](handleError(_0x68797b,null));};exports[_0x896a('0xa9')]=function(_0x353b88,_0x1f83c7){var _0x16e08f={'raw':![],'where':{'id':_0x353b88[_0x896a('0xaa')]['id']}},_0xa18032={};_0xa18032[_0x896a('0x38')]=_[_0x896a('0x3a')](db['OpenchannelInteraction']['rawAttributes']);_0xa18032['query']=_[_0x896a('0x3a')](_0x353b88[_0x896a('0x3b')]);_0xa18032['filters']=_[_0x896a('0x3d')](_0xa18032[_0x896a('0x38')],_0xa18032[_0x896a('0x3b')]);_0x16e08f[_0x896a('0x3f')]=_[_0x896a('0x3d')](_0xa18032[_0x896a('0x38')],qs['fields'](_0x353b88[_0x896a('0x3b')][_0x896a('0x3e')]));_0x16e08f['attributes']=_0x16e08f[_0x896a('0x3f')]['length']?_0x16e08f[_0x896a('0x3f')]:_0xa18032[_0x896a('0x38')];if(_0x353b88[_0x896a('0x3b')][_0x896a('0xab')]){_0x16e08f[_0x896a('0xac')]=[{'all':!![]}];}_0x16e08f=_[_0x896a('0xad')]({},_0x16e08f,_0x353b88[_0x896a('0xae')]);return db[_0x896a('0x33')]['find'](_0x16e08f)[_0x896a('0x26')](handleEntityNotFound(_0x1f83c7,null))[_0x896a('0x26')](respondWithResult(_0x1f83c7,null))[_0x896a('0x32')](handleError(_0x1f83c7,null));};exports[_0x896a('0xaf')]=function(_0x5204ee,_0x3c29c9){return db['OpenchannelInteraction'][_0x896a('0xaf')](_0x5204ee[_0x896a('0x6e')],{})[_0x896a('0x26')](respondWithResult(_0x3c29c9,0xc9))[_0x896a('0x32')](handleError(_0x3c29c9,null));};exports['update']=function(_0x3d1cd5,_0x237cd3){if(_0x3d1cd5[_0x896a('0x6e')]['id']){delete _0x3d1cd5['body']['id'];}return db[_0x896a('0x33')][_0x896a('0x5a')]({'where':{'id':_0x3d1cd5[_0x896a('0xaa')]['id']}})[_0x896a('0x26')](handleEntityNotFound(_0x237cd3,null))['then'](saveUpdates(_0x3d1cd5[_0x896a('0x6e')],null))[_0x896a('0x26')](respondWithResult(_0x237cd3,null))[_0x896a('0x32')](handleError(_0x237cd3,null));};exports['destroy']=function(_0x23a6ad,_0x300b8b){return db[_0x896a('0x33')][_0x896a('0x5a')]({'where':{'id':_0x23a6ad[_0x896a('0xaa')]['id']}})['then'](handleEntityNotFound(_0x300b8b,null))['then'](removeEntity(_0x300b8b,null))['catch'](handleError(_0x300b8b,null));};exports['describe']=function(_0x24a278,_0x2d8d08){return db[_0x896a('0x33')][_0x896a('0xb0')]()['then'](respondWithResult(_0x2d8d08,null))[_0x896a('0x32')](handleError(_0x2d8d08,null));};exports[_0x896a('0xb1')]=function(_0x9aa1be,_0x51423d,_0x50eeea){return db[_0x896a('0xb2')]['find']({'where':{'id':_0x9aa1be['params']['id']}})[_0x896a('0x26')](handleEntityNotFound(_0x51423d,null))[_0x896a('0x26')](function(_0x40f87){if(_0x40f87){return _0x40f87[_0x896a('0xb1')](_0x9aa1be[_0x896a('0x6e')][_0x896a('0xb3')],_[_0x896a('0xb4')](_0x9aa1be['body'],['ids','id'])||{});}})[_0x896a('0x26')](respondWithResult(_0x51423d,null))[_0x896a('0x32')](handleError(_0x51423d,null));};exports[_0x896a('0xb5')]=function(_0x4c116d,_0x5ba76e,_0x429105){var _0x156064={'raw':![],'where':{}};var _0x231e2e={};var _0x1219da={'count':0x0,'rows':[]};return db[_0x896a('0x33')]['findOne']({'where':{'id':_0x4c116d[_0x896a('0xaa')]['id']}})[_0x896a('0x26')](handleEntityNotFound(_0x5ba76e,null))[_0x896a('0x26')](function(_0x272840){if(_0x272840){_0x231e2e['model']=_['keys'](db[_0x896a('0xb2')][_0x896a('0x34')]);_0x231e2e[_0x896a('0x3b')]=_[_0x896a('0x3a')](_0x4c116d[_0x896a('0x3b')]);_0x231e2e[_0x896a('0x3c')]=_['intersection'](_0x231e2e[_0x896a('0x38')],_0x231e2e[_0x896a('0x3b')]);_0x156064[_0x896a('0x3f')]=_[_0x896a('0x3d')](_0x231e2e[_0x896a('0x38')],qs[_0x896a('0x3e')](_0x4c116d[_0x896a('0x3b')]['fields']));_0x156064[_0x896a('0x3f')]=_0x156064[_0x896a('0x3f')][_0x896a('0x61')]?_0x156064[_0x896a('0x3f')]:_0x231e2e['model'];if(!_0x4c116d[_0x896a('0x3b')][_0x896a('0xb6')]('nolimit')){_0x156064[_0x896a('0x20')]=qs[_0x896a('0x20')](_0x4c116d[_0x896a('0x3b')][_0x896a('0x20')]);_0x156064[_0x896a('0x1f')]=qs[_0x896a('0x1f')](_0x4c116d[_0x896a('0x3b')][_0x896a('0x1f')]);}_0x156064[_0x896a('0x8b')]=qs[_0x896a('0x40')](_0x4c116d[_0x896a('0x3b')][_0x896a('0x40')]);_0x156064['where']=qs[_0x896a('0x3c')](_[_0x896a('0xb7')](_0x4c116d[_0x896a('0x3b')],_0x231e2e[_0x896a('0x3c')]));_0x156064['where'][_0x896a('0xa6')]=_0x272840['id'];if(_0x4c116d[_0x896a('0x3b')][_0x896a('0x7f')]){_0x156064[_0x896a('0x41')]=_[_0x896a('0xad')](_0x156064[_0x896a('0x41')],{'$or':_['map'](_0x156064[_0x896a('0x3f')],function(_0x6885de){var _0x259944={};_0x259944[_0x6885de]={'$like':'%'+_0x4c116d[_0x896a('0x3b')][_0x896a('0x7f')]+'%'};return _0x259944;})});}if(_0x4c116d[_0x896a('0x3b')]['$gte']){var _0x26a64f=_0x4c116d['query'][_0x896a('0xb8')][_0x896a('0x30')](',');var _0x18c77f={};_0x18c77f[_0x26a64f[0x0]]={'$gte':moment(_0x26a64f[0x1])[_0x896a('0xb9')](_0x896a('0xba'))};_0x156064[_0x896a('0x41')]=_[_0x896a('0xad')](_0x156064[_0x896a('0x41')],_0x18c77f);}_0x156064=_[_0x896a('0xad')]({},_0x156064,_0x4c116d[_0x896a('0xae')]);return db[_0x896a('0xb2')][_0x896a('0x1e')]({'where':_0x156064['where']})[_0x896a('0x26')](function(_0x3fdc39){_0x1219da[_0x896a('0x1e')]=_0x3fdc39;if(_0x4c116d[_0x896a('0x3b')][_0x896a('0xab')]){_0x156064[_0x896a('0xac')]=[{'all':!![]}];}return db[_0x896a('0xb2')][_0x896a('0xbb')](_0x156064);})[_0x896a('0x26')](function(_0x5de906){_0x1219da[_0x896a('0xbc')]=_0x5de906;return _0x1219da;});}})['then'](respondWithFilteredResult(_0x5ba76e,_0x156064))[_0x896a('0x32')](handleError(_0x5ba76e,null));};exports[_0x896a('0xbd')]=function(_0x4dac79,_0x1d0239,_0x337148){return db[_0x896a('0x33')]['find']({'where':{'id':_0x4dac79[_0x896a('0xaa')]['id']}})[_0x896a('0x26')](handleEntityNotFound(_0x1d0239,null))[_0x896a('0x26')](function(_0x5debc2){if(_0x5debc2){return _0x5debc2[_0x896a('0xbe')](_0x4dac79['body'][_0x896a('0xb3')],_[_0x896a('0xb4')](_0x4dac79[_0x896a('0x6e')],['ids','id'])||{})[_0x896a('0xbf')](function(){return db[_0x896a('0x68')]['findAll']({'attributes':['id','name',_0x896a('0x44')],'where':{'id':_0x4dac79[_0x896a('0x6e')][_0x896a('0xb3')]}});})['then'](function(_0x1d6b4f){socket['emit']('openchannelInteractionTags:save',{'id':Number(_0x4dac79[_0x896a('0xaa')]['id']),'tags':_0x1d6b4f||[]});return{'id':Number(_0x4dac79['params']['id']),'tags':_0x1d6b4f||[]};});}})[_0x896a('0x26')](respondWithResult(_0x1d0239,null))['catch'](handleError(_0x1d0239,null));};exports['removeTags']=function(_0x1bff02,_0x4e22b8,_0x28d292){return db['OpenchannelInteraction'][_0x896a('0x5a')]({'where':{'id':_0x1bff02[_0x896a('0xaa')]['id']}})['then'](handleEntityNotFound(_0x4e22b8,null))['then'](function(_0x4c708d){if(_0x4c708d){return _0x4c708d['removeTags'](_0x1bff02[_0x896a('0x3b')]['ids']);}})[_0x896a('0x26')](respondWithStatusCode(_0x4e22b8,null))[_0x896a('0x32')](handleError(_0x4e22b8,null));};exports['download']=function(_0x399674,_0x1b960d){var _0x476b3f=moment()[_0x896a('0xc0')]()[_0x896a('0x94')]();var _0x664d6b=path[_0x896a('0xc1')](config[_0x896a('0xc2')],'server',_0x896a('0xc3'),_0x896a('0xc4'));var _0x52c24a=path[_0x896a('0xc1')](config[_0x896a('0xc2')],'server',_0x896a('0xc3'),'attachments');var _0x521f52=path[_0x896a('0xc1')](_0x664d6b,_0x476b3f);var _0x18f040=util[_0x896a('0xb9')](_0x896a('0xc5'),_0x399674[_0x896a('0xaa')]['id'],_0x476b3f);var _0x1bb56b=path['join'](_0x664d6b,_0x18f040);var _0x1504a0=[];_0x1504a0[_0x896a('0xa7')]({'model':db[_0x896a('0xc6')],'as':_0x896a('0xc6'),'attributes':['id',_0x896a('0x2d')],'raw':!![]});_0x1504a0[_0x896a('0xa7')]({'model':db['CmContact'],'as':_0x896a('0x5e'),'attributes':['id',_0x896a('0xc7'),_0x896a('0xc8')],'raw':!![]});if(_0x399674[_0x896a('0x3b')]['attachments']){_0x1504a0[_0x896a('0xa7')]({'model':db[_0x896a('0xc9')],'as':'Attachment','raw':!![]});}var _0x20b923=[{'model':db[_0x896a('0xb2')],'as':_0x896a('0xca'),'attributes':['id',_0x896a('0x6e'),'createdAt',_0x896a('0xcb'),'secret',_0x896a('0x7a')],'include':_0x1504a0}];_0x20b923[_0x896a('0xa7')]({'model':db[_0x896a('0xcc')],'as':'Account','attributes':['id',_0x896a('0x39')]});_0x20b923[_0x896a('0xa7')]({'model':db[_0x896a('0xc6')],'as':_0x896a('0xcd'),'attributes':['id',_0x896a('0x2d')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x399674['params']['id']},'include':_0x20b923})['then'](handleEntityNotFound(_0x1b960d,null))[_0x896a('0x26')](function(_0x381bac){if(_0x381bac){var _0x3bf5b3=_0x381bac[_0x896a('0xce')]({'plain':!![]});fs[_0x896a('0xcf')](_0x521f52);var _0xac6b64={'format':'A4','border':'10px','header':{'height':'40px','contents':{'first':_0x896a('0xd0')}},'footer':{'height':'30px','contents':{'default':util['format'](_0x896a('0xd1'),util['format'](_0x896a('0xd2'),_0x896a('0xd3'),_0x3bf5b3['id']),moment()[_0x896a('0xb9')](_0x896a('0xd4'))[_0x896a('0x94')]())}}};var _0x400206={'channel':_0x896a('0xd3'),'account':_0x3bf5b3[_0x896a('0xd5')][_0x896a('0x39')],'agent':_0x3bf5b3[_0x896a('0xcd')]?_0x3bf5b3[_0x896a('0xcd')][_0x896a('0x2d')]:_0x896a('0xd6'),'createdAt':moment(_0x3bf5b3[_0x896a('0x75')])[_0x896a('0xb9')](_0x896a('0xba'))[_0x896a('0x94')](),'closedAt':_0x3bf5b3[_0x896a('0xd7')]?moment(_0x3bf5b3[_0x896a('0xd8')])[_0x896a('0xb9')](_0x896a('0xba'))[_0x896a('0x94')]():'','disposition':_0x3bf5b3['disposition'],'visibility':_0x3bf5b3[_0x896a('0xd9')]?_0x896a('0xda'):_0x896a('0xdb'),'messages':_(_0x3bf5b3[_0x896a('0xca')])['filter']({'secret':![]})[_0x896a('0x2c')](function(_0x24dc51){if(_0x24dc51[_0x896a('0xc9')]){var _0x3327b0=path[_0x896a('0xc1')](_0x52c24a,_0x24dc51[_0x896a('0xc9')][_0x896a('0xdc')]);if(fs[_0x896a('0xdd')](_0x3327b0)){fs[_0x896a('0xde')](_0x3327b0)[_0x896a('0xdf')](fs['createWriteStream'](path['join'](_0x521f52,_0x24dc51['Attachment'][_0x896a('0xdc')])));}}return{'date':moment(_0x24dc51[_0x896a('0x75')])[_0x896a('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')[_0x896a('0x94')](),'sender':_0x24dc51['direction']===_0x896a('0xe0')?_0x24dc51['User']?_0x24dc51['User'][_0x896a('0x2d')]:_0x896a('0xe1'):_0x24dc51[_0x896a('0x5e')][_0x896a('0xc7')]+(_0x24dc51[_0x896a('0x5e')][_0x896a('0xc8')]?'\x20'+_0x24dc51[_0x896a('0x5e')][_0x896a('0xc8')]:''),'body':_0x24dc51['Attachment']?_0x24dc51[_0x896a('0xc9')][_0x896a('0xdc')]:_0x24dc51['body'],'direction':_0x24dc51[_0x896a('0xcb')]===_0x896a('0xe0')?'A':'C','secret':_0x24dc51[_0x896a('0xe2')],'read':_0x24dc51[_0x896a('0x7a')],'attachment':_0x24dc51[_0x896a('0xc9')]};})[_0x896a('0x60')]()};return ejs[_0x896a('0xe3')](path[_0x896a('0xc1')](config[_0x896a('0xc2')],_0x896a('0xe4'),_0x896a('0xe5'),_0x896a('0xe6')),{'interaction':_0x400206})[_0x896a('0x26')](function(_0x28e4df){return new BPromise(function(_0x1c29e9,_0x16db58){pdf[_0x896a('0xaf')](_0x28e4df,_0xac6b64)[_0x896a('0xe7')](path[_0x896a('0xc1')](_0x521f52,_0x896a('0xe8')+_0x3bf5b3['id']+'-'+_0x476b3f+_0x896a('0xe9')),function(_0x439c9b,_0x1e7fe8){if(_0x439c9b)return _0x16db58(_0x439c9b);_0x1c29e9(_0x1e7fe8);});});})[_0x896a('0x26')](function(){return new BPromise(function(_0xa1da4c,_0x1c6330){zipdir(_0x521f52,{'saveTo':_0x1bb56b},function(_0x53744b,_0x33c2f6){if(_0x53744b)return _0x1c6330(_0x53744b);return _0xa1da4c(_0x33c2f6);});})[_0x896a('0x26')](function(){return new BPromise(function(_0xe8a9c1,_0x15f36a){rimraf(_0x521f52,function(_0x52eb08){if(_0x52eb08)_0x15f36a(_0x52eb08);return _0xe8a9c1();});});})[_0x896a('0x26')](function(){return _0x1b960d['download'](_0x1bb56b,_0x18f040,function(_0x35de0b){if(_0x35de0b){console['log'](_0x896a('0xea'),_0x35de0b);}else{fs['unlinkSync'](_0x1bb56b);}});});});}else{return _0x1b960d[_0x896a('0x1b')](0xc8);}})['catch'](handleError(_0x1b960d,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 36d52fb..6a0263e 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 _0x1363=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','getUsers','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','OpenchannelInteraction'];(function(_0x2d37f4,_0x4384b8){var _0x396225=function(_0x56e51f){while(--_0x56e51f){_0x2d37f4['push'](_0x2d37f4['shift']());}};_0x396225(++_0x4384b8);}(_0x1363,0xec));var _0x3136=function(_0x13fd84,_0x77c1b2){_0x13fd84=_0x13fd84-0x0;var _0x5680b4=_0x1363[_0x13fd84];return _0x5680b4;};'use strict';var EventEmitter=require(_0x3136('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x3136('0x1')];var OpenchannelMessage=require(_0x3136('0x2'))['db'][_0x3136('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x3136('0x4')](0x0);var events={'afterCreate':_0x3136('0x5'),'afterUpdate':'update','afterDestroy':_0x3136('0x6')};function emitEvent(_0xfb910f){return function(_0x57656a,_0x19a10c,_0x48738b){_0x57656a[_0x3136('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2427d6){_0x57656a[_0x3136('0x8')]('Users',_0x2427d6[_0x3136('0x9')](function(_0x215668){return{'id':_0x215668['id']};}));return OpenchannelMessage[_0x3136('0xa')]({'where':{'OpenchannelInteractionId':_0x57656a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5f11d1){_0x57656a[_0x3136('0x8')](_0x3136('0xb'),_0x5f11d1[_0x3136('0xc')]);OpenchannelInteractionEvents[_0x3136('0xd')](_0xfb910f+':'+_0x57656a['id'],_0x57656a);OpenchannelInteractionEvents['emit'](_0xfb910f,_0x57656a);_0x48738b(null);})[_0x3136('0xe')](_0x48738b(null));};}for(var e in events){if(events[_0x3136('0xf')](e)){var event=events[e];OpenchannelInteraction[_0x3136('0x10')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xbbc4=['map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','setMaxListeners','save','update','getUsers','then','setDataValue','Users'];(function(_0x316e2b,_0x40efd7){var _0x2e4809=function(_0x145130){while(--_0x145130){_0x316e2b['push'](_0x316e2b['shift']());}};_0x2e4809(++_0x40efd7);}(_0xbbc4,0x139));var _0x4bbc=function(_0x2a3382,_0x3ed2e4){_0x2a3382=_0x2a3382-0x0;var _0x507f4a=_0xbbc4[_0x2a3382];return _0x507f4a;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4bbc('0x0')](0x0);var events={'afterCreate':_0x4bbc('0x1'),'afterUpdate':_0x4bbc('0x2'),'afterDestroy':'remove'};function emitEvent(_0x18317f){return function(_0x5ce1df,_0x975e9c,_0x20c5ae){_0x5ce1df[_0x4bbc('0x3')]({'attributes':['id'],'raw':!![]})[_0x4bbc('0x4')](function(_0x3a9918){_0x5ce1df[_0x4bbc('0x5')](_0x4bbc('0x6'),_0x3a9918[_0x4bbc('0x7')](function(_0x363e7b){return{'id':_0x363e7b['id']};}));return OpenchannelMessage[_0x4bbc('0x8')]({'where':{'OpenchannelInteractionId':_0x5ce1df['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4bbc('0x4')](function(_0x456a3){_0x5ce1df[_0x4bbc('0x5')](_0x4bbc('0x9'),_0x456a3[_0x4bbc('0xa')]);OpenchannelInteractionEvents[_0x4bbc('0xb')](_0x18317f+':'+_0x5ce1df['id'],_0x5ce1df);OpenchannelInteractionEvents[_0x4bbc('0xb')](_0x18317f,_0x5ce1df);_0x20c5ae(null);})[_0x4bbc('0xc')](_0x20c5ae(null));};}for(var e in events){if(events[_0x4bbc('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x4bbc('0xe')](e,emitEvent(event));}}module[_0x4bbc('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 e794bde..64d1ca2 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 _0x038b=['path','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','bluebird'];(function(_0x5eb546,_0x1773b7){var _0x50419d=function(_0x28aa79){while(--_0x28aa79){_0x5eb546['push'](_0x5eb546['shift']());}};_0x50419d(++_0x1773b7);}(_0x038b,0x114));var _0xb038=function(_0x3927cc,_0x558330){_0x3927cc=_0x3927cc-0x0;var _0x2cd444=_0x038b[_0x3927cc];return _0x2cd444;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));module[_0xb038('0x7')]=function(_0x4fe092,_0x54e1e7){return _0x4fe092[_0xb038('0x8')](_0xb038('0x9'),attributes,{'tableName':_0xb038('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b4085,_0x48a4d7,_0x462e8f){if(_0x4b4085[_0xb038('0xb')]('closed')){_0x4b4085['closedAt']=moment()[_0xb038('0xc')](_0xb038('0xd'));}_0x462e8f(null,_0x4b4085);}}});}; \ No newline at end of file +var _0xf494=['request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird'];(function(_0x752005,_0x14dc74){var _0x40629c=function(_0x189e3d){while(--_0x189e3d){_0x752005['push'](_0x752005['shift']());}};_0x40629c(++_0x14dc74);}(_0xf494,0x1c6));var _0x4f49=function(_0xd78d44,_0x508879){_0xd78d44=_0xd78d44-0x0;var _0x373342=_0xf494[_0xd78d44];return _0x373342;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x169c95,_0x327bd5,_0x31a725){if(_0x169c95[_0x4f49('0xc')](_0x4f49('0xd'))){_0x169c95[_0x4f49('0xe')]=moment()[_0x4f49('0xf')](_0x4f49('0x10'));}_0x31a725(null,_0x169c95);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 3691917..4f97b13 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 _0x0823=['redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','attributes','limit','catch','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0823,0x119));var _0x3082=function(_0xe3d4a2,_0x5dbf95){_0xe3d4a2=_0xe3d4a2-0x0;var _0x131efb=_0x0823[_0xe3d4a2];return _0x131efb;};'use strict';var _=require(_0x3082('0x0'));var util=require(_0x3082('0x1'));var moment=require(_0x3082('0x2'));var BPromise=require(_0x3082('0x3'));var rs=require(_0x3082('0x4'));var fs=require('fs');var Redis=require(_0x3082('0x5'));var db=require(_0x3082('0x6'))['db'];var utils=require(_0x3082('0x7'));var logger=require('../../config/logger')(_0x3082('0x8'));var config=require(_0x3082('0x9'));var jayson=require(_0x3082('0xa'));var client=jayson[_0x3082('0xb')][_0x3082('0xc')]({'port':0x232a});config[_0x3082('0xd')]=_['defaults'](config[_0x3082('0xd')],{'host':_0x3082('0xe'),'port':0x18eb});var socket=require(_0x3082('0xf'))(new Redis(config[_0x3082('0xd')]));require(_0x3082('0x10'))[_0x3082('0x11')](socket);function respondWithRpcPromise(_0x25991e,_0x742f86,_0x244d4a){return new BPromise(function(_0x37bc0c,_0x12df6f){return client[_0x3082('0x12')](_0x25991e,_0x244d4a)[_0x3082('0x13')](function(_0x2ddf39){logger[_0x3082('0x14')](_0x3082('0x15'),_0x742f86,_0x3082('0x16'));logger[_0x3082('0x17')](_0x3082('0x18'),_0x742f86,_0x3082('0x16'),JSON[_0x3082('0x19')](_0x2ddf39));if(_0x2ddf39[_0x3082('0x1a')]){if(_0x2ddf39['error']['code']===0x1f4){logger[_0x3082('0x1a')](_0x3082('0x15'),_0x742f86,_0x2ddf39[_0x3082('0x1a')]['message']);return _0x12df6f(_0x2ddf39[_0x3082('0x1a')][_0x3082('0x1b')]);}logger[_0x3082('0x1a')]('OpenchannelInteraction,\x20%s,\x20%s',_0x742f86,_0x2ddf39[_0x3082('0x1a')]['message']);return _0x37bc0c(_0x2ddf39[_0x3082('0x1a')][_0x3082('0x1b')]);}else{logger[_0x3082('0x14')](_0x3082('0x15'),_0x742f86,'request\x20sent');_0x37bc0c(_0x2ddf39[_0x3082('0x1c')][_0x3082('0x1b')]);}})['catch'](function(_0x3b4164){logger[_0x3082('0x1a')](_0x3082('0x15'),_0x742f86,_0x3b4164);_0x12df6f(_0x3b4164);});});}exports[_0x3082('0x1d')]=function(_0x59f2ed){var _0x25142a=this;return new Promise(function(_0x4af899,_0x212787){return db[_0x3082('0x1e')][_0x3082('0x1f')](_0x59f2ed['body'],{'raw':_0x59f2ed[_0x3082('0x20')]?_0x59f2ed[_0x3082('0x20')][_0x3082('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59f2ed[_0x3082('0x20')]?_0x59f2ed[_0x3082('0x20')]['where']||null:null,'attributes':_0x59f2ed[_0x3082('0x20')]?_0x59f2ed[_0x3082('0x20')][_0x3082('0x22')]||null:null,'limit':_0x59f2ed[_0x3082('0x20')]?_0x59f2ed[_0x3082('0x20')][_0x3082('0x23')]||null:null})[_0x3082('0x13')](function(_0x10800d){logger[_0x3082('0x14')](_0x3082('0x1d'),_0x59f2ed);logger['debug'](_0x3082('0x1d'),_0x59f2ed,JSON['stringify'](_0x10800d));_0x4af899(_0x10800d);})[_0x3082('0x24')](function(_0x4f9eaf){logger[_0x3082('0x1a')](_0x3082('0x1d'),_0x4f9eaf[_0x3082('0x1b')],_0x59f2ed);_0x212787(_0x25142a['error'](0x1f4,_0x4f9eaf[_0x3082('0x1b')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x3b2a59){return new Promise(function(_0x52ef01,_0x3c342b){return db[_0x3082('0x1e')]['find']({'where':_0x3b2a59[_0x3082('0x20')]?_0x3b2a59[_0x3082('0x20')]['where']||null:null})[_0x3082('0x13')](function(_0x5d0021){if(_0x5d0021){return _0x5d0021[_0x3082('0x25')](_0x3b2a59[_0x3082('0x26')][_0x3082('0x27')],_['omit'](_0x3b2a59['body'],[_0x3082('0x27'),'id'])||{});}})[_0x3082('0x28')](function(_0x9d3a4b){logger[_0x3082('0x14')]('AddTags',_0x3b2a59);logger[_0x3082('0x17')](_0x3082('0x29'),_0x3b2a59,JSON[_0x3082('0x19')](_0x9d3a4b));_0x52ef01(_0x9d3a4b);})[_0x3082('0x24')](function(_0x1d3ed1){logger[_0x3082('0x1a')](_0x3082('0x29'),_0x1d3ed1['message'],_0x3b2a59);_0x3c342b(_this['error'](0x1f4,_0x1d3ed1[_0x3082('0x1b')]));});});}; \ No newline at end of file +var _0x43f0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./openchannelInteraction.socket','register','request','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','catch','UpdateOpenchannelInteraction','update','raw','options','where','then','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','ids','omit','body','spread','AddTags','lodash'];(function(_0x1ded13,_0x575e99){var _0x4f12d9=function(_0x53c6b5){while(--_0x53c6b5){_0x1ded13['push'](_0x1ded13['shift']());}};_0x4f12d9(++_0x575e99);}(_0x43f0,0x110));var _0x043f=function(_0xad7541,_0x2c3714){_0xad7541=_0xad7541-0x0;var _0x488e1b=_0x43f0[_0xad7541];return _0x488e1b;};'use strict';var _=require(_0x043f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x043f('0x1'));var rs=require(_0x043f('0x2'));var fs=require('fs');var Redis=require(_0x043f('0x3'));var db=require(_0x043f('0x4'))['db'];var utils=require(_0x043f('0x5'));var logger=require(_0x043f('0x6'))(_0x043f('0x7'));var config=require(_0x043f('0x8'));var jayson=require(_0x043f('0x9'));var client=jayson[_0x043f('0xa')][_0x043f('0xb')]({'port':0x232a});config[_0x043f('0xc')]=_['defaults'](config[_0x043f('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x043f('0xc')]));require(_0x043f('0xd'))[_0x043f('0xe')](socket);function respondWithRpcPromise(_0x53d338,_0x28fc86,_0x42060c){return new BPromise(function(_0x33b2f4,_0x2ebf24){return client[_0x043f('0xf')](_0x53d338,_0x42060c)['then'](function(_0xb28adb){logger[_0x043f('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x28fc86,_0x043f('0x11'));logger[_0x043f('0x12')](_0x043f('0x13'),_0x28fc86,_0x043f('0x11'),JSON['stringify'](_0xb28adb));if(_0xb28adb['error']){if(_0xb28adb[_0x043f('0x14')][_0x043f('0x15')]===0x1f4){logger[_0x043f('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x28fc86,_0xb28adb['error']['message']);return _0x2ebf24(_0xb28adb[_0x043f('0x14')][_0x043f('0x16')]);}logger[_0x043f('0x14')](_0x043f('0x17'),_0x28fc86,_0xb28adb[_0x043f('0x14')][_0x043f('0x16')]);return _0x33b2f4(_0xb28adb[_0x043f('0x14')][_0x043f('0x16')]);}else{logger[_0x043f('0x10')](_0x043f('0x17'),_0x28fc86,_0x043f('0x11'));_0x33b2f4(_0xb28adb['result'][_0x043f('0x16')]);}})[_0x043f('0x18')](function(_0x54b302){logger[_0x043f('0x14')](_0x043f('0x17'),_0x28fc86,_0x54b302);_0x2ebf24(_0x54b302);});});}exports[_0x043f('0x19')]=function(_0xce87ac){var _0x1ad1a5=this;return new Promise(function(_0x194337,_0x47bff1){return db['OpenchannelInteraction'][_0x043f('0x1a')](_0xce87ac['body'],{'raw':_0xce87ac['options']?_0xce87ac['options'][_0x043f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xce87ac[_0x043f('0x1c')]?_0xce87ac[_0x043f('0x1c')][_0x043f('0x1d')]||null:null,'attributes':_0xce87ac[_0x043f('0x1c')]?_0xce87ac['options']['attributes']||null:null,'limit':_0xce87ac['options']?_0xce87ac[_0x043f('0x1c')]['limit']||null:null})[_0x043f('0x1e')](function(_0x4f9434){logger[_0x043f('0x10')]('UpdateOpenchannelInteraction',_0xce87ac);logger[_0x043f('0x12')]('UpdateOpenchannelInteraction',_0xce87ac,JSON[_0x043f('0x1f')](_0x4f9434));_0x194337(_0x4f9434);})[_0x043f('0x18')](function(_0x1ce74a){logger[_0x043f('0x14')](_0x043f('0x19'),_0x1ce74a[_0x043f('0x16')],_0xce87ac);_0x47bff1(_0x1ad1a5['error'](0x1f4,_0x1ce74a['message']));});});};exports[_0x043f('0x20')]=function(_0x2f2347){return new Promise(function(_0x585c44,_0x26926f){return db[_0x043f('0x21')]['find']({'where':_0x2f2347[_0x043f('0x1c')]?_0x2f2347[_0x043f('0x1c')][_0x043f('0x1d')]||null:null})[_0x043f('0x1e')](function(_0x3296ac){if(_0x3296ac){return _0x3296ac['addTags'](_0x2f2347['body'][_0x043f('0x22')],_[_0x043f('0x23')](_0x2f2347[_0x043f('0x24')],[_0x043f('0x22'),'id'])||{});}})[_0x043f('0x25')](function(_0x9f3f35){logger['info']('AddTags',_0x2f2347);logger[_0x043f('0x12')](_0x043f('0x26'),_0x2f2347,JSON['stringify'](_0x9f3f35));_0x585c44(_0x9f3f35);})['catch'](function(_0x5422bd){logger['error'](_0x043f('0x26'),_0x5422bd[_0x043f('0x16')],_0x2f2347);_0x26926f(_this['error'](0x1f4,_0x5422bd['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index c7d6bcb..27ad7dd 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 _0xffc7=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','register'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xffc7,0x192));var _0x7ffc=function(_0x142762,_0x5520b3){_0x142762=_0x142762-0x0;var _0x22281e=_0xffc7[_0x142762];return _0x22281e;};'use strict';var OpenchannelInteractionEvents=require(_0x7ffc('0x0'));var events=[_0x7ffc('0x1'),_0x7ffc('0x2'),_0x7ffc('0x3')];function createListener(_0x263751,_0x563381){return function(_0x239729){_0x563381[_0x7ffc('0x4')](_0x263751,_0x239729);};}function removeListener(_0x31dbaf,_0x1ffb8c){return function(){OpenchannelInteractionEvents['removeListener'](_0x31dbaf,_0x1ffb8c);};}exports[_0x7ffc('0x5')]=function(_0x109b9f){for(var _0x4c4106=0x0,_0x500531=events[_0x7ffc('0x6')];_0x4c4106<_0x500531;_0x4c4106++){var _0x35d825=events[_0x4c4106];var _0x4c4a62=createListener(_0x7ffc('0x7')+_0x35d825,_0x109b9f);OpenchannelInteractionEvents['on'](_0x35d825,_0x4c4a62);}}; \ No newline at end of file +var _0x3a65=['save','remove','removeListener','register','length','./openchannelInteraction.events'];(function(_0x6261e0,_0xbe1bce){var _0x58e6b4=function(_0x2d2caa){while(--_0x2d2caa){_0x6261e0['push'](_0x6261e0['shift']());}};_0x58e6b4(++_0xbe1bce);}(_0x3a65,0x155));var _0x53a6=function(_0xa5434,_0x37cddc){_0xa5434=_0xa5434-0x0;var _0x3df2d0=_0x3a65[_0xa5434];return _0x3df2d0;};'use strict';var OpenchannelInteractionEvents=require(_0x53a6('0x0'));var events=[_0x53a6('0x1'),_0x53a6('0x2'),'update'];function createListener(_0xeef894,_0x17d1a6){return function(_0x4db087){_0x17d1a6['emit'](_0xeef894,_0x4db087);};}function removeListener(_0x39eec8,_0x5db043){return function(){OpenchannelInteractionEvents[_0x53a6('0x3')](_0x39eec8,_0x5db043);};}exports[_0x53a6('0x4')]=function(_0x455430){for(var _0x28f7ec=0x0,_0x1d3970=events[_0x53a6('0x5')];_0x28f7ec<_0x1d3970;_0x28f7ec++){var _0x3c5168=events[_0x28f7ec];var _0x1108c0=createListener('openchannelInteraction:'+_0x3c5168,_0x455430);OpenchannelInteractionEvents['on'](_0x3c5168,_0x1108c0);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 0288c18..b6adc6e 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 _0x1dcb=['destroy','exports','util','path','connect-timeout','../../components/auth/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','openchannel','create','update','put','/:id/accept','accept','/:id/reject'];(function(_0x3a4564,_0x2f661c){var _0x1bafdb=function(_0x284c91){while(--_0x284c91){_0x3a4564['push'](_0x3a4564['shift']());}};_0x1bafdb(++_0x2f661c);}(_0x1dcb,0x1a6));var _0xb1dc=function(_0xb3ca6a,_0x551f45){_0xb3ca6a=_0xb3ca6a-0x0;var _0x5946c2=_0x1dcb[_0xb3ca6a];return _0x5946c2;};'use strict';var multer=require('multer');var util=require(_0xb1dc('0x0'));var path=require(_0xb1dc('0x1'));var timeout=require(_0xb1dc('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb1dc('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb1dc('0x4'));var controller=require(_0xb1dc('0x5'));router[_0xb1dc('0x6')]('/',auth[_0xb1dc('0x7')](),controller['index']);router[_0xb1dc('0x6')](_0xb1dc('0x8'),auth[_0xb1dc('0x7')](),controller[_0xb1dc('0x9')]);router[_0xb1dc('0x6')](_0xb1dc('0xa'),auth[_0xb1dc('0x7')](),controller[_0xb1dc('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xb1dc('0xc'),'openchannelmessage:create'),controller[_0xb1dc('0xd')]);router['put'](_0xb1dc('0xa'),auth[_0xb1dc('0x7')](),controller[_0xb1dc('0xe')]);router[_0xb1dc('0xf')](_0xb1dc('0x10'),auth[_0xb1dc('0x7')](),controller[_0xb1dc('0x11')]);router[_0xb1dc('0xf')](_0xb1dc('0x12'),auth[_0xb1dc('0x7')](),controller['reject']);router['delete'](_0xb1dc('0xa'),auth['isAuthenticated'](),controller[_0xb1dc('0x13')]);module[_0xb1dc('0x14')]=router; \ No newline at end of file +var _0x246f=['../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','get','/describe','describe','show','post','tracked','openchannel','openchannelmessage:create','create','put','/:id','update','accept','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x51a3cc,_0x16a5ef){var _0x151fc=function(_0x1498a2){while(--_0x1498a2){_0x51a3cc['push'](_0x51a3cc['shift']());}};_0x151fc(++_0x16a5ef);}(_0x246f,0x1b4));var _0xf246=function(_0x29e100,_0x4d7a2d){_0x29e100=_0x29e100-0x0;var _0x5cbc6c=_0x246f[_0x29e100];return _0x5cbc6c;};'use strict';var multer=require(_0xf246('0x0'));var util=require('util');var path=require(_0xf246('0x1'));var timeout=require(_0xf246('0x2'));var express=require(_0xf246('0x3'));var router=express[_0xf246('0x4')]();var auth=require(_0xf246('0x5'));var interaction=require(_0xf246('0x6'));var config=require('../../config/environment');var controller=require(_0xf246('0x7'));router['get']('/',auth[_0xf246('0x8')](),controller['index']);router[_0xf246('0x9')](_0xf246('0xa'),auth[_0xf246('0x8')](),controller[_0xf246('0xb')]);router[_0xf246('0x9')]('/:id',auth[_0xf246('0x8')](),controller[_0xf246('0xc')]);router[_0xf246('0xd')]('/',auth[_0xf246('0x8')](),interaction[_0xf246('0xe')](_0xf246('0xf'),_0xf246('0x10')),controller[_0xf246('0x11')]);router[_0xf246('0x12')](_0xf246('0x13'),auth[_0xf246('0x8')](),controller[_0xf246('0x14')]);router[_0xf246('0x12')]('/:id/accept',auth[_0xf246('0x8')](),controller[_0xf246('0x15')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xf246('0x16')]);router[_0xf246('0x17')]('/:id',auth[_0xf246('0x8')](),controller[_0xf246('0x18')]);module[_0xf246('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 8c6ccab..2440017 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 _0xf530=['BOOLEAN','ENUM','DATE','sequelize','exports','TEXT','medium'];(function(_0x4fa969,_0x5757a9){var _0x186f76=function(_0x1cfe2c){while(--_0x1cfe2c){_0x4fa969['push'](_0x4fa969['shift']());}};_0x186f76(++_0x5757a9);}(_0xf530,0xc0));var _0x0f53=function(_0x5ba5f2,_0x5dbf18){_0x5ba5f2=_0x5ba5f2-0x0;var _0x377fdb=_0xf530[_0x5ba5f2];return _0x377fdb;};'use strict';var Sequelize=require(_0x0f53('0x0'));module[_0x0f53('0x1')]={'body':{'type':Sequelize[_0x0f53('0x2')](_0x0f53('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x0f53('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0f53('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x0f53('0x6')]}}; \ No newline at end of file +var _0xe763=['exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x14a1da,_0x24f2e5){var _0x201fe1=function(_0xc2e852){while(--_0xc2e852){_0x14a1da['push'](_0x14a1da['shift']());}};_0x201fe1(++_0x24f2e5);}(_0xe763,0x16e));var _0x3e76=function(_0x45f6cb,_0x531af6){_0x45f6cb=_0x45f6cb-0x0;var _0x5b7f93=_0xe763[_0x45f6cb];return _0x5b7f93;};'use strict';var Sequelize=require('sequelize');module[_0x3e76('0x0')]={'body':{'type':Sequelize[_0x3e76('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x3e76('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3e76('0x3')]('in',_0x3e76('0x4')),'defaultValue':_0x3e76('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3e76('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 31e1da8..d0d8b7e 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 _0xef94=['../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','Sequelize','ValidationError','request','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','status','end','json','count','offset','limit','Content-Range','save','update','then','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','nolimit','order','sort','filters','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','destroy','describe','openchannel-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','reject','openchannel','agent','null','RejectMessage','rejectMessage','interface','rejectmessage','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x175efc,_0x100325){var _0xac1bf3=function(_0x11f832){while(--_0x11f832){_0x175efc['push'](_0x175efc['shift']());}};_0xac1bf3(++_0x100325);}(_0xef94,0x151));var _0x4ef9=function(_0xf8faf8,_0x27fe3f){_0xf8faf8=_0xf8faf8-0x0;var _0x5ad0ba=_0xef94[_0xf8faf8];return _0x5ad0ba;};'use strict';var pdf=require(_0x4ef9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4ef9('0x1'));var zipdir=require(_0x4ef9('0x2'));var jsonpatch=require(_0x4ef9('0x3'));var rp=require('request-promise');var moment=require(_0x4ef9('0x4'));var BPromise=require(_0x4ef9('0x5'));var Mustache=require(_0x4ef9('0x6'));var util=require(_0x4ef9('0x7'));var path=require(_0x4ef9('0x8'));var sox=require(_0x4ef9('0x9'));var csv=require(_0x4ef9('0xa'));var ejs=require(_0x4ef9('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4ef9('0xc'));var jsforce=require(_0x4ef9('0xd'));var deskjs=require(_0x4ef9('0xe'));var toCsv=require(_0x4ef9('0xa'));var querystring=require('querystring');var Papa=require(_0x4ef9('0xf'));var Redis=require(_0x4ef9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4ef9('0x11'));var as=require(_0x4ef9('0x12'));var hardwareService=require(_0x4ef9('0x13'));var logger=require(_0x4ef9('0x14'))(_0x4ef9('0x15'));var utils=require(_0x4ef9('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4ef9('0x17')]=_[_0x4ef9('0x18')](config[_0x4ef9('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x4ef9('0x19'))(new Redis(config[_0x4ef9('0x17')]));require(_0x4ef9('0x1a'))[_0x4ef9('0x1b')](socket);var jayson=require(_0x4ef9('0x1c'));var client=jayson[_0x4ef9('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x4ef9('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x3c7aec,_0x23ae44,_0x4c85ae){if(_0x4c85ae){var _0x2e8b5d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e8b5d['test'](_0x23ae44)){return _0x3c7aec;}else{throw new db[(_0x4ef9('0x1e'))][(_0x4ef9('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 _0x3c7aec;}}function respondWithRpcPromise(_0x19be73,_0x3e1f75,_0x3497ec,_0x5a9306){return new BPromise(function(_0x2300a0,_0x52b939){var _0x113f88=_0x5a9306||client;return _0x113f88[_0x4ef9('0x20')](_0x19be73,_0x3497ec)['then'](function(_0x34f761){logger[_0x4ef9('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e1f75,_0x4ef9('0x22'));logger[_0x4ef9('0x23')](_0x4ef9('0x24'),_0x3e1f75,_0x4ef9('0x22'),JSON[_0x4ef9('0x25')](_0x34f761));if(_0x34f761[_0x4ef9('0x26')]){if(_0x34f761[_0x4ef9('0x26')][_0x4ef9('0x27')]===0x1f4){logger[_0x4ef9('0x26')](_0x4ef9('0x28'),_0x3e1f75,_0x34f761[_0x4ef9('0x26')][_0x4ef9('0x29')]);return _0x52b939(_0x34f761[_0x4ef9('0x26')]['message']);}logger['error'](_0x4ef9('0x28'),_0x3e1f75,_0x34f761[_0x4ef9('0x26')][_0x4ef9('0x29')]);return _0x2300a0(_0x34f761[_0x4ef9('0x26')][_0x4ef9('0x29')]);}else{logger[_0x4ef9('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e1f75,_0x4ef9('0x22'));_0x2300a0(_0x34f761['result'][_0x4ef9('0x29')]);}})['catch'](function(_0x2e23e7){logger[_0x4ef9('0x26')](_0x4ef9('0x28'),_0x3e1f75,_0x2e23e7);_0x52b939(_0x2e23e7);});});}function respondWithStatusCode(_0x7c3521,_0x19840e){_0x19840e=_0x19840e||0xcc;return function(_0x47ec86){if(_0x47ec86){return _0x7c3521['sendStatus'](_0x19840e);}return _0x7c3521[_0x4ef9('0x2a')](_0x19840e)[_0x4ef9('0x2b')]();};}function respondWithResult(_0x24ccc1,_0x25c8a6){_0x25c8a6=_0x25c8a6||0xc8;return function(_0x2292cc){if(_0x2292cc){return _0x24ccc1[_0x4ef9('0x2a')](_0x25c8a6)[_0x4ef9('0x2c')](_0x2292cc);}};}function respondWithFilteredResult(_0x2bfd28,_0x76ad5d){return function(_0x33e11a){if(_0x33e11a){var _0x48223e=_0x33e11a[_0x4ef9('0x2d')],_0x3c64ca=_0x76ad5d[_0x4ef9('0x2e')],_0x20b67e=_0x76ad5d[_0x4ef9('0x2e')]+_0x76ad5d[_0x4ef9('0x2f')],_0x8ff677;if(_0x20b67e>=_0x48223e){_0x20b67e=_0x48223e;_0x8ff677=0xc8;}else{_0x8ff677=0xce;}_0x2bfd28[_0x4ef9('0x2a')](_0x8ff677);return _0x2bfd28['set'](_0x4ef9('0x30'),_0x3c64ca+'-'+_0x20b67e+'/'+_0x48223e)[_0x4ef9('0x2c')](_0x33e11a);}return null;};}function patchUpdates(_0x237ca2){return function(_0xe78c5e){try{jsonpatch['apply'](_0xe78c5e,_0x237ca2,!![]);}catch(_0x332c38){return BPromise['reject'](_0x332c38);}return _0xe78c5e[_0x4ef9('0x31')]();};}function saveUpdates(_0x1dc8cc,_0x270044){return function(_0x583b34){if(_0x583b34){return _0x583b34[_0x4ef9('0x32')](_0x1dc8cc)[_0x4ef9('0x33')](function(_0x1a5ce7){return _0x1a5ce7;});}return null;};}function removeEntity(_0x352c69,_0x19d14d){return function(_0x3280f9){if(_0x3280f9){return _0x3280f9['destroy']()[_0x4ef9('0x33')](function(){_0x352c69['status'](0xcc)[_0x4ef9('0x2b')]();});}};}function handleEntityNotFound(_0x48b3d5,_0x184458){return function(_0x1a5cd7){if(!_0x1a5cd7){_0x48b3d5['sendStatus'](0x194);}return _0x1a5cd7;};}function handleError(_0x425b74,_0x215c66){_0x215c66=_0x215c66||0x1f4;return function(_0x1d2355){logger['error'](_0x1d2355['stack']);if(_0x1d2355[_0x4ef9('0x34')]){delete _0x1d2355[_0x4ef9('0x34')];}_0x425b74['status'](_0x215c66)[_0x4ef9('0x35')](_0x1d2355);};}exports[_0x4ef9('0x36')]=function(_0x2ec962,_0x2dd04e){var _0x546abb={},_0x1f24ec={},_0x47a261={'count':0x0,'rows':[]};var _0x31f88f=_[_0x4ef9('0x37')](db[_0x4ef9('0x38')][_0x4ef9('0x39')],function(_0x57c7fa){return{'name':_0x57c7fa[_0x4ef9('0x3a')],'type':_0x57c7fa[_0x4ef9('0x3b')]['key']};});_0x1f24ec['model']=_[_0x4ef9('0x37')](_0x31f88f,'name');_0x1f24ec[_0x4ef9('0x3c')]=_['keys'](_0x2ec962[_0x4ef9('0x3c')]);_0x1f24ec['filters']=_[_0x4ef9('0x3d')](_0x1f24ec[_0x4ef9('0x3e')],_0x1f24ec[_0x4ef9('0x3c')]);_0x546abb[_0x4ef9('0x3f')]=_[_0x4ef9('0x3d')](_0x1f24ec[_0x4ef9('0x3e')],qs[_0x4ef9('0x40')](_0x2ec962['query'][_0x4ef9('0x40')]));_0x546abb[_0x4ef9('0x3f')]=_0x546abb[_0x4ef9('0x3f')][_0x4ef9('0x41')]?_0x546abb['attributes']:_0x1f24ec[_0x4ef9('0x3e')];if(!_0x2ec962[_0x4ef9('0x3c')]['hasOwnProperty'](_0x4ef9('0x42'))){_0x546abb[_0x4ef9('0x2f')]=qs[_0x4ef9('0x2f')](_0x2ec962[_0x4ef9('0x3c')][_0x4ef9('0x2f')]);_0x546abb[_0x4ef9('0x2e')]=qs[_0x4ef9('0x2e')](_0x2ec962['query'][_0x4ef9('0x2e')]);}_0x546abb[_0x4ef9('0x43')]=qs['sort'](_0x2ec962[_0x4ef9('0x3c')][_0x4ef9('0x44')]);_0x546abb['where']=qs[_0x4ef9('0x45')](_['pick'](_0x2ec962['query'],_0x1f24ec[_0x4ef9('0x45')]));if(_0x2ec962['query'][_0x4ef9('0x46')]){_0x546abb[_0x4ef9('0x47')]=_[_0x4ef9('0x48')](_0x546abb[_0x4ef9('0x47')],{'$or':_[_0x4ef9('0x37')](_0x31f88f,function(_0x4b20da){if(_0x4b20da[_0x4ef9('0x3b')]!=='VIRTUAL'){var _0x6a3f4f={};_0x6a3f4f[_0x4b20da[_0x4ef9('0x34')]]={'$like':'%'+_0x2ec962['query'][_0x4ef9('0x46')]+'%'};return _0x6a3f4f;}})});}_0x546abb=_['merge']({},_0x546abb,_0x2ec962[_0x4ef9('0x49')]);var _0x11d3ea={'where':_0x546abb['where']};return db[_0x4ef9('0x38')]['count'](_0x11d3ea)[_0x4ef9('0x33')](function(_0x34a65f){_0x47a261[_0x4ef9('0x2d')]=_0x34a65f;if(_0x2ec962['query'][_0x4ef9('0x4a')]){_0x546abb['include']=[{'all':!![]}];}return db[_0x4ef9('0x38')][_0x4ef9('0x4b')](_0x546abb);})[_0x4ef9('0x33')](function(_0x21715e){_0x47a261[_0x4ef9('0x4c')]=_0x21715e;return _0x47a261;})[_0x4ef9('0x33')](respondWithFilteredResult(_0x2dd04e,_0x546abb))[_0x4ef9('0x4d')](handleError(_0x2dd04e,null));};exports[_0x4ef9('0x4e')]=function(_0x12d0d4,_0x47a2f6){var _0x60e84a={'raw':!![],'where':{'id':_0x12d0d4[_0x4ef9('0x4f')]['id']}},_0x1a0c76={};_0x1a0c76['model']=_[_0x4ef9('0x50')](db[_0x4ef9('0x38')]['rawAttributes']);_0x1a0c76[_0x4ef9('0x3c')]=_['keys'](_0x12d0d4[_0x4ef9('0x3c')]);_0x1a0c76[_0x4ef9('0x45')]=_[_0x4ef9('0x3d')](_0x1a0c76[_0x4ef9('0x3e')],_0x1a0c76['query']);_0x60e84a['attributes']=_[_0x4ef9('0x3d')](_0x1a0c76[_0x4ef9('0x3e')],qs[_0x4ef9('0x40')](_0x12d0d4['query']['fields']));_0x60e84a[_0x4ef9('0x3f')]=_0x60e84a['attributes']['length']?_0x60e84a[_0x4ef9('0x3f')]:_0x1a0c76[_0x4ef9('0x3e')];if(_0x12d0d4[_0x4ef9('0x3c')][_0x4ef9('0x4a')]){_0x60e84a[_0x4ef9('0x51')]=[{'all':!![]}];}_0x60e84a=_['merge']({},_0x60e84a,_0x12d0d4[_0x4ef9('0x49')]);return db[_0x4ef9('0x38')][_0x4ef9('0x52')](_0x60e84a)['then'](handleEntityNotFound(_0x47a2f6,null))[_0x4ef9('0x33')](respondWithResult(_0x47a2f6,null))['catch'](handleError(_0x47a2f6,null));};exports[_0x4ef9('0x53')]=function(_0x2a3ca3,_0x5d444f){return db[_0x4ef9('0x38')][_0x4ef9('0x53')](_0x2a3ca3[_0x4ef9('0x54')],{})[_0x4ef9('0x33')](respondWithResult(_0x5d444f,0xc9))['catch'](handleError(_0x5d444f,null));};exports['update']=function(_0x1ba869,_0x434df7){if(_0x1ba869[_0x4ef9('0x54')]['id']){delete _0x1ba869['body']['id'];}return db[_0x4ef9('0x38')][_0x4ef9('0x52')]({'where':{'id':_0x1ba869[_0x4ef9('0x4f')]['id']}})[_0x4ef9('0x33')](handleEntityNotFound(_0x434df7,null))['then'](saveUpdates(_0x1ba869[_0x4ef9('0x54')],null))[_0x4ef9('0x33')](respondWithResult(_0x434df7,null))[_0x4ef9('0x4d')](handleError(_0x434df7,null));};exports[_0x4ef9('0x55')]=function(_0x4af0bd,_0x56b584){return db[_0x4ef9('0x38')]['find']({'where':{'id':_0x4af0bd[_0x4ef9('0x4f')]['id']}})[_0x4ef9('0x33')](handleEntityNotFound(_0x56b584,null))[_0x4ef9('0x33')](removeEntity(_0x56b584,null))[_0x4ef9('0x4d')](handleError(_0x56b584,null));};exports[_0x4ef9('0x56')]=function(_0xa54620,_0x374a91){return db['OpenchannelMessage']['describe']()[_0x4ef9('0x33')](respondWithResult(_0x374a91,null))['catch'](handleError(_0x374a91,null));};var interaction_log=require(_0x4ef9('0x14'))(_0x4ef9('0x57'));exports[_0x4ef9('0x58')]=function(_0x477809,_0x3e6ad4,_0x21c086){var _0x29dfac={'channel':'openchannel'};if(_0x477809[_0x4ef9('0x54')]['id']){delete _0x477809[_0x4ef9('0x54')]['id'];}_0x477809[_0x4ef9('0x54')][_0x4ef9('0x59')]=!![];_0x477809[_0x4ef9('0x54')][_0x4ef9('0x5a')]=moment()[_0x4ef9('0x5b')](_0x4ef9('0x5c'));_0x477809[_0x4ef9('0x54')]['UserId']=_0x477809[_0x4ef9('0x54')][_0x4ef9('0x5d')]||_0x477809[_0x4ef9('0x5e')]['id'];return db['OpenchannelMessage'][_0x4ef9('0x52')]({'where':{'id':_0x477809[_0x4ef9('0x4f')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x4ef9('0x5f')}]})[_0x4ef9('0x33')](handleEntityNotFound(_0x3e6ad4,null))[_0x4ef9('0x33')](saveUpdates(_0x477809[_0x4ef9('0x54')],null))['then'](function(_0x2eb599){if(_0x2eb599){_0x29dfac[_0x4ef9('0x29')]=_0x2eb599[_0x4ef9('0x60')]({'plain':!![]});return db[_0x4ef9('0x61')]['find']({'where':{'id':_0x2eb599[_0x4ef9('0x62')]}});}return null;})[_0x4ef9('0x33')](handleEntityNotFound(_0x3e6ad4,null))[_0x4ef9('0x33')](function(_0x329339){if(_0x329339){return _0x329339[_0x4ef9('0x32')]({'UserId':_0x477809['body'][_0x4ef9('0x5d')],'read1stAt':_[_0x4ef9('0x63')](_0x329339['read1stAt'])?moment()[_0x4ef9('0x5b')](_0x4ef9('0x5c')):undefined});}return null;})[_0x4ef9('0x33')](function(_0x3dcd5c){if(_0x3dcd5c){_0x29dfac[_0x4ef9('0x64')]=_0x3dcd5c[_0x4ef9('0x60')]({'plain':!![]});interaction_log[_0x4ef9('0x21')](_0x4ef9('0x65'),_0x477809[_0x4ef9('0x5e')]['id'],_0x477809[_0x4ef9('0x5e')][_0x4ef9('0x34')],_0x477809[_0x4ef9('0x5e')][_0x4ef9('0x66')],_0x29dfac['interaction']['id'],_0x477809[_0x4ef9('0x54')]?JSON[_0x4ef9('0x25')](_0x477809[_0x4ef9('0x54')]):'null');return respondWithRpcPromise(_0x4ef9('0x67'),_0x4ef9('0x68'),_0x29dfac);}return null;})[_0x4ef9('0x33')](function(_0x31eb21){if(_0x31eb21){if(_0x477809['body'][_0x4ef9('0x69')]){_0x29dfac[_0x4ef9('0x29')]['interface']=util[_0x4ef9('0x5b')](_0x4ef9('0x6a'),_0x477809[_0x4ef9('0x5e')][_0x4ef9('0x34')]);_0x29dfac[_0x4ef9('0x29')][_0x4ef9('0x6b')]=_0x29dfac['channel'];_0x29dfac['message'][_0x4ef9('0x6c')]='accept';return respondWithRpcPromise(_0x4ef9('0x6d'),_0x4ef9('0x6d'),{'event':_0x4ef9('0x6e'),'message':_0x29dfac[_0x4ef9('0x29')]},client9002)[_0x4ef9('0x33')](function(){return _0x29dfac;});}return _0x29dfac;}return null;})[_0x4ef9('0x33')](respondWithResult(_0x3e6ad4,null))[_0x4ef9('0x4d')](handleError(_0x3e6ad4,null));};var interaction_log=require(_0x4ef9('0x14'))(_0x4ef9('0x57'));exports[_0x4ef9('0x6f')]=function(_0x4d4aac,_0x2b45b1,_0x3c9bc1){var _0x26054c={'agent':{},'channel':_0x4ef9('0x70')};if(_0x4d4aac[_0x4ef9('0x54')]['id']){delete _0x4d4aac[_0x4ef9('0x54')]['id'];}_0x4d4aac['body'][_0x4ef9('0x5d')]=_0x4d4aac[_0x4ef9('0x54')]['UserId']||_0x4d4aac[_0x4ef9('0x5e')]['id'];_0x26054c[_0x4ef9('0x71')]['id']=_0x4d4aac[_0x4ef9('0x54')][_0x4ef9('0x5d')];return db[_0x4ef9('0x38')][_0x4ef9('0x52')]({'where':{'id':_0x4d4aac[_0x4ef9('0x4f')]['id'],'UserId':null}})[_0x4ef9('0x33')](handleEntityNotFound(_0x2b45b1,null))['then'](function(_0x2d59ce){if(_0x2d59ce){_0x26054c[_0x4ef9('0x29')]=_0x2d59ce['get']({'plain':!![]});return db[_0x4ef9('0x61')][_0x4ef9('0x52')]({'where':{'id':_0x2d59ce['OpenchannelInteractionId']}});}return null;})[_0x4ef9('0x33')](handleEntityNotFound(_0x2b45b1,null))[_0x4ef9('0x33')](function(_0x285b89){if(_0x285b89){_0x26054c['interaction']=_0x285b89[_0x4ef9('0x60')]({'plain':!![]});interaction_log[_0x4ef9('0x21')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d4aac[_0x4ef9('0x5e')]['id'],_0x4d4aac[_0x4ef9('0x5e')][_0x4ef9('0x34')],_0x4d4aac[_0x4ef9('0x5e')][_0x4ef9('0x66')],_0x26054c['interaction']['id'],_0x4d4aac[_0x4ef9('0x54')]?JSON[_0x4ef9('0x25')](_0x4d4aac['body']):_0x4ef9('0x72'));return respondWithRpcPromise(_0x4ef9('0x73'),_0x4ef9('0x74'),_0x26054c);}return null;})[_0x4ef9('0x33')](function(_0x38fa01){if(_0x38fa01){_0x38fa01[_0x4ef9('0x29')][_0x4ef9('0x75')]=util['format'](_0x4ef9('0x6a'),_0x4d4aac[_0x4ef9('0x5e')][_0x4ef9('0x34')]);_0x38fa01[_0x4ef9('0x29')][_0x4ef9('0x6b')]=_0x26054c[_0x4ef9('0x6b')];_0x38fa01[_0x4ef9('0x29')]['event']='reject';respondWithRpcPromise(_0x4ef9('0x6d'),_0x4ef9('0x6d'),{'event':_0x4ef9('0x76'),'message':_0x38fa01[_0x4ef9('0x29')]},client9002);return _0x26054c;}return null;})[_0x4ef9('0x33')](respondWithResult(_0x2b45b1,null))['catch'](handleError(_0x2b45b1,null));}; \ No newline at end of file +var _0x8ae6=['register','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','OpenchannelMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','stack','name','send','rawAttributes','fieldName','type','key','map','query','intersection','attributes','model','length','order','sort','where','pick','filters','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','findAll','rows','show','params','keys','fields','create','body','find','describe','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','openchannel-interactions','reject','agent','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','moment','util','path','to-csv','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ae6,0x155));var _0x68ae=function(_0xfb4ee5,_0x4ab1ae){_0xfb4ee5=_0xfb4ee5-0x0;var _0x522e89=_0x8ae6[_0xfb4ee5];return _0x522e89;};'use strict';var pdf=require(_0x68ae('0x0'));var emlformat=require(_0x68ae('0x1'));var rimraf=require(_0x68ae('0x2'));var zipdir=require(_0x68ae('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x68ae('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x68ae('0x5'));var path=require(_0x68ae('0x6'));var sox=require('sox');var csv=require(_0x68ae('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x68ae('0x8'));var crypto=require('crypto');var jsforce=require(_0x68ae('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x68ae('0x7'));var querystring=require(_0x68ae('0xa'));var Papa=require(_0x68ae('0xb'));var Redis=require(_0x68ae('0xc'));var authService=require(_0x68ae('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x68ae('0xe'));var hardwareService=require(_0x68ae('0xf'));var logger=require(_0x68ae('0x10'))(_0x68ae('0x11'));var utils=require('../../config/utils');var config=require(_0x68ae('0x12'));var db=require(_0x68ae('0x13'))['db'];config[_0x68ae('0x14')]=_[_0x68ae('0x15')](config[_0x68ae('0x14')],{'host':_0x68ae('0x16'),'port':0x18eb});var socket=require(_0x68ae('0x17'))(new Redis(config[_0x68ae('0x14')]));require(_0x68ae('0x18'))[_0x68ae('0x19')](socket);var jayson=require(_0x68ae('0x1a'));var client=jayson[_0x68ae('0x1b')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x23d526,_0x366fd7,_0x384f1c){if(_0x384f1c){var _0x50a0c5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x50a0c5[_0x68ae('0x1c')](_0x366fd7)){return _0x23d526;}else{throw new db[(_0x68ae('0x1d'))][(_0x68ae('0x1e'))](_0x68ae('0x1f'));}}else{return _0x23d526;}}function respondWithRpcPromise(_0x46fc07,_0x2ce1bf,_0x1673a6,_0x30f557){return new BPromise(function(_0x8e65f6,_0x5edf94){var _0x33bf3b=_0x30f557||client;return _0x33bf3b['request'](_0x46fc07,_0x1673a6)[_0x68ae('0x20')](function(_0x4d6e08){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x2ce1bf,_0x68ae('0x21'));logger['debug'](_0x68ae('0x22'),_0x2ce1bf,_0x68ae('0x21'),JSON[_0x68ae('0x23')](_0x4d6e08));if(_0x4d6e08['error']){if(_0x4d6e08['error'][_0x68ae('0x24')]===0x1f4){logger[_0x68ae('0x25')](_0x68ae('0x26'),_0x2ce1bf,_0x4d6e08[_0x68ae('0x25')][_0x68ae('0x27')]);return _0x5edf94(_0x4d6e08[_0x68ae('0x25')][_0x68ae('0x27')]);}logger[_0x68ae('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x2ce1bf,_0x4d6e08['error']['message']);return _0x8e65f6(_0x4d6e08[_0x68ae('0x25')][_0x68ae('0x27')]);}else{logger[_0x68ae('0x28')](_0x68ae('0x26'),_0x2ce1bf,_0x68ae('0x21'));_0x8e65f6(_0x4d6e08[_0x68ae('0x29')][_0x68ae('0x27')]);}})[_0x68ae('0x2a')](function(_0x42abe2){logger[_0x68ae('0x25')](_0x68ae('0x26'),_0x2ce1bf,_0x42abe2);_0x5edf94(_0x42abe2);});});}function respondWithStatusCode(_0x40ff97,_0x25d793){_0x25d793=_0x25d793||0xcc;return function(_0x57c40b){if(_0x57c40b){return _0x40ff97[_0x68ae('0x2b')](_0x25d793);}return _0x40ff97[_0x68ae('0x2c')](_0x25d793)[_0x68ae('0x2d')]();};}function respondWithResult(_0x2f1c09,_0x51f5ed){_0x51f5ed=_0x51f5ed||0xc8;return function(_0x2d3f5){if(_0x2d3f5){return _0x2f1c09[_0x68ae('0x2c')](_0x51f5ed)[_0x68ae('0x2e')](_0x2d3f5);}};}function respondWithFilteredResult(_0x221378,_0x340137){return function(_0x1bd7b2){if(_0x1bd7b2){var _0x538b5b=_0x1bd7b2[_0x68ae('0x2f')],_0x54deed=_0x340137[_0x68ae('0x30')],_0x5d67c0=_0x340137['offset']+_0x340137[_0x68ae('0x31')],_0x10677c;if(_0x5d67c0>=_0x538b5b){_0x5d67c0=_0x538b5b;_0x10677c=0xc8;}else{_0x10677c=0xce;}_0x221378[_0x68ae('0x2c')](_0x10677c);return _0x221378[_0x68ae('0x32')](_0x68ae('0x33'),_0x54deed+'-'+_0x5d67c0+'/'+_0x538b5b)[_0x68ae('0x2e')](_0x1bd7b2);}return null;};}function patchUpdates(_0x375583){return function(_0x56e34b){try{jsonpatch[_0x68ae('0x34')](_0x56e34b,_0x375583,!![]);}catch(_0x1687c9){return BPromise['reject'](_0x1687c9);}return _0x56e34b[_0x68ae('0x35')]();};}function saveUpdates(_0x2e6c1b,_0x506902){return function(_0x3f64fa){if(_0x3f64fa){return _0x3f64fa[_0x68ae('0x36')](_0x2e6c1b)[_0x68ae('0x20')](function(_0x2d99e6){return _0x2d99e6;});}return null;};}function removeEntity(_0x2874e3,_0x1d62c9){return function(_0x15567a){if(_0x15567a){return _0x15567a['destroy']()[_0x68ae('0x20')](function(){_0x2874e3[_0x68ae('0x2c')](0xcc)[_0x68ae('0x2d')]();});}};}function handleEntityNotFound(_0x3e8d77,_0x16a3d5){return function(_0x453711){if(!_0x453711){_0x3e8d77['sendStatus'](0x194);}return _0x453711;};}function handleError(_0x43903f,_0x372707){_0x372707=_0x372707||0x1f4;return function(_0xc23e3d){logger[_0x68ae('0x25')](_0xc23e3d[_0x68ae('0x37')]);if(_0xc23e3d['name']){delete _0xc23e3d[_0x68ae('0x38')];}_0x43903f[_0x68ae('0x2c')](_0x372707)[_0x68ae('0x39')](_0xc23e3d);};}exports['index']=function(_0x1d7409,_0x514213){var _0x30d120={},_0x69923f={},_0xfd9240={'count':0x0,'rows':[]};var _0x5b607d=_['map'](db['OpenchannelMessage'][_0x68ae('0x3a')],function(_0x33e89b){return{'name':_0x33e89b[_0x68ae('0x3b')],'type':_0x33e89b[_0x68ae('0x3c')][_0x68ae('0x3d')]};});_0x69923f['model']=_[_0x68ae('0x3e')](_0x5b607d,_0x68ae('0x38'));_0x69923f[_0x68ae('0x3f')]=_['keys'](_0x1d7409[_0x68ae('0x3f')]);_0x69923f['filters']=_[_0x68ae('0x40')](_0x69923f['model'],_0x69923f[_0x68ae('0x3f')]);_0x30d120[_0x68ae('0x41')]=_['intersection'](_0x69923f[_0x68ae('0x42')],qs['fields'](_0x1d7409['query']['fields']));_0x30d120[_0x68ae('0x41')]=_0x30d120['attributes'][_0x68ae('0x43')]?_0x30d120[_0x68ae('0x41')]:_0x69923f[_0x68ae('0x42')];if(!_0x1d7409['query']['hasOwnProperty']('nolimit')){_0x30d120[_0x68ae('0x31')]=qs[_0x68ae('0x31')](_0x1d7409[_0x68ae('0x3f')][_0x68ae('0x31')]);_0x30d120['offset']=qs[_0x68ae('0x30')](_0x1d7409[_0x68ae('0x3f')][_0x68ae('0x30')]);}_0x30d120[_0x68ae('0x44')]=qs[_0x68ae('0x45')](_0x1d7409['query'][_0x68ae('0x45')]);_0x30d120[_0x68ae('0x46')]=qs['filters'](_[_0x68ae('0x47')](_0x1d7409[_0x68ae('0x3f')],_0x69923f[_0x68ae('0x48')]));if(_0x1d7409[_0x68ae('0x3f')]['filter']){_0x30d120[_0x68ae('0x46')]=_[_0x68ae('0x49')](_0x30d120[_0x68ae('0x46')],{'$or':_[_0x68ae('0x3e')](_0x5b607d,function(_0x5547ac){if(_0x5547ac[_0x68ae('0x3c')]!==_0x68ae('0x4a')){var _0x171023={};_0x171023[_0x5547ac['name']]={'$like':'%'+_0x1d7409['query']['filter']+'%'};return _0x171023;}})});}_0x30d120=_[_0x68ae('0x49')]({},_0x30d120,_0x1d7409[_0x68ae('0x4b')]);var _0x447836={'where':_0x30d120['where']};return db[_0x68ae('0x4c')][_0x68ae('0x2f')](_0x447836)[_0x68ae('0x20')](function(_0x31d39e){_0xfd9240[_0x68ae('0x2f')]=_0x31d39e;if(_0x1d7409['query'][_0x68ae('0x4d')]){_0x30d120[_0x68ae('0x4e')]=[{'all':!![]}];}return db[_0x68ae('0x4c')][_0x68ae('0x4f')](_0x30d120);})['then'](function(_0xcd2d10){_0xfd9240[_0x68ae('0x50')]=_0xcd2d10;return _0xfd9240;})['then'](respondWithFilteredResult(_0x514213,_0x30d120))[_0x68ae('0x2a')](handleError(_0x514213,null));};exports[_0x68ae('0x51')]=function(_0x2e9c97,_0xa40125){var _0x14abcf={'raw':!![],'where':{'id':_0x2e9c97[_0x68ae('0x52')]['id']}},_0x2cf13c={};_0x2cf13c['model']=_['keys'](db[_0x68ae('0x4c')][_0x68ae('0x3a')]);_0x2cf13c[_0x68ae('0x3f')]=_[_0x68ae('0x53')](_0x2e9c97[_0x68ae('0x3f')]);_0x2cf13c['filters']=_['intersection'](_0x2cf13c[_0x68ae('0x42')],_0x2cf13c[_0x68ae('0x3f')]);_0x14abcf[_0x68ae('0x41')]=_[_0x68ae('0x40')](_0x2cf13c[_0x68ae('0x42')],qs[_0x68ae('0x54')](_0x2e9c97['query'][_0x68ae('0x54')]));_0x14abcf[_0x68ae('0x41')]=_0x14abcf['attributes'][_0x68ae('0x43')]?_0x14abcf[_0x68ae('0x41')]:_0x2cf13c[_0x68ae('0x42')];if(_0x2e9c97[_0x68ae('0x3f')][_0x68ae('0x4d')]){_0x14abcf['include']=[{'all':!![]}];}_0x14abcf=_[_0x68ae('0x49')]({},_0x14abcf,_0x2e9c97[_0x68ae('0x4b')]);return db[_0x68ae('0x4c')]['find'](_0x14abcf)[_0x68ae('0x20')](handleEntityNotFound(_0xa40125,null))[_0x68ae('0x20')](respondWithResult(_0xa40125,null))[_0x68ae('0x2a')](handleError(_0xa40125,null));};exports[_0x68ae('0x55')]=function(_0x588ebd,_0x2fa49f){return db[_0x68ae('0x4c')][_0x68ae('0x55')](_0x588ebd[_0x68ae('0x56')],{})['then'](respondWithResult(_0x2fa49f,0xc9))['catch'](handleError(_0x2fa49f,null));};exports['update']=function(_0x4714ff,_0x381442){if(_0x4714ff['body']['id']){delete _0x4714ff[_0x68ae('0x56')]['id'];}return db['OpenchannelMessage'][_0x68ae('0x57')]({'where':{'id':_0x4714ff[_0x68ae('0x52')]['id']}})[_0x68ae('0x20')](handleEntityNotFound(_0x381442,null))[_0x68ae('0x20')](saveUpdates(_0x4714ff[_0x68ae('0x56')],null))[_0x68ae('0x20')](respondWithResult(_0x381442,null))[_0x68ae('0x2a')](handleError(_0x381442,null));};exports['destroy']=function(_0x47f3e6,_0x23c55d){return db[_0x68ae('0x4c')]['find']({'where':{'id':_0x47f3e6[_0x68ae('0x52')]['id']}})[_0x68ae('0x20')](handleEntityNotFound(_0x23c55d,null))[_0x68ae('0x20')](removeEntity(_0x23c55d,null))[_0x68ae('0x2a')](handleError(_0x23c55d,null));};exports[_0x68ae('0x58')]=function(_0x28a682,_0x2e0280){return db['OpenchannelMessage'][_0x68ae('0x58')]()['then'](respondWithResult(_0x2e0280,null))[_0x68ae('0x2a')](handleError(_0x2e0280,null));};var interaction_log=require(_0x68ae('0x10'))('openchannel-interactions');exports[_0x68ae('0x59')]=function(_0x2440ba,_0x6a4a0f,_0x18f7b2){var _0xbe19a4={'channel':_0x68ae('0x5a')};if(_0x2440ba[_0x68ae('0x56')]['id']){delete _0x2440ba[_0x68ae('0x56')]['id'];}_0x2440ba[_0x68ae('0x56')][_0x68ae('0x5b')]=!![];_0x2440ba['body'][_0x68ae('0x5c')]=moment()[_0x68ae('0x5d')](_0x68ae('0x5e'));_0x2440ba[_0x68ae('0x56')]['UserId']=_0x2440ba[_0x68ae('0x56')][_0x68ae('0x5f')]||_0x2440ba[_0x68ae('0x60')]['id'];return db[_0x68ae('0x4c')][_0x68ae('0x57')]({'where':{'id':_0x2440ba[_0x68ae('0x52')]['id'],'UserId':null},'include':[{'model':db[_0x68ae('0x61')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x6a4a0f,null))[_0x68ae('0x20')](saveUpdates(_0x2440ba[_0x68ae('0x56')],null))[_0x68ae('0x20')](function(_0x3ca813){if(_0x3ca813){_0xbe19a4[_0x68ae('0x27')]=_0x3ca813[_0x68ae('0x62')]({'plain':!![]});return db[_0x68ae('0x63')]['find']({'where':{'id':_0x3ca813[_0x68ae('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x6a4a0f,null))[_0x68ae('0x20')](function(_0x4df909){if(_0x4df909){return _0x4df909[_0x68ae('0x36')]({'UserId':_0x2440ba['body'][_0x68ae('0x5f')],'read1stAt':_[_0x68ae('0x65')](_0x4df909[_0x68ae('0x66')])?moment()[_0x68ae('0x5d')](_0x68ae('0x5e')):undefined});}return null;})[_0x68ae('0x20')](function(_0xad9009){if(_0xad9009){_0xbe19a4[_0x68ae('0x67')]=_0xad9009[_0x68ae('0x62')]({'plain':!![]});interaction_log[_0x68ae('0x28')](_0x68ae('0x68'),_0x2440ba[_0x68ae('0x60')]['id'],_0x2440ba[_0x68ae('0x60')][_0x68ae('0x38')],_0x2440ba[_0x68ae('0x60')][_0x68ae('0x69')],_0xbe19a4[_0x68ae('0x67')]['id'],_0x2440ba[_0x68ae('0x56')]?JSON[_0x68ae('0x23')](_0x2440ba[_0x68ae('0x56')]):_0x68ae('0x6a'));return respondWithRpcPromise(_0x68ae('0x6b'),_0x68ae('0x6c'),_0xbe19a4);}return null;})['then'](function(_0x227a68){if(_0x227a68){if(_0x2440ba['body'][_0x68ae('0x6d')]){_0xbe19a4['message'][_0x68ae('0x6e')]=util[_0x68ae('0x5d')](_0x68ae('0x6f'),_0x2440ba[_0x68ae('0x60')][_0x68ae('0x38')]);_0xbe19a4[_0x68ae('0x27')][_0x68ae('0x70')]=_0xbe19a4[_0x68ae('0x70')];_0xbe19a4[_0x68ae('0x27')][_0x68ae('0x71')]='accept';return respondWithRpcPromise(_0x68ae('0x72'),_0x68ae('0x72'),{'event':'acceptmessage','message':_0xbe19a4[_0x68ae('0x27')]},client9002)[_0x68ae('0x20')](function(){return _0xbe19a4;});}return _0xbe19a4;}return null;})[_0x68ae('0x20')](respondWithResult(_0x6a4a0f,null))[_0x68ae('0x2a')](handleError(_0x6a4a0f,null));};var interaction_log=require(_0x68ae('0x10'))(_0x68ae('0x73'));exports[_0x68ae('0x74')]=function(_0x436b0e,_0x34ab81,_0x12a3f8){var _0x24c340={'agent':{},'channel':_0x68ae('0x5a')};if(_0x436b0e[_0x68ae('0x56')]['id']){delete _0x436b0e[_0x68ae('0x56')]['id'];}_0x436b0e[_0x68ae('0x56')][_0x68ae('0x5f')]=_0x436b0e[_0x68ae('0x56')][_0x68ae('0x5f')]||_0x436b0e[_0x68ae('0x60')]['id'];_0x24c340[_0x68ae('0x75')]['id']=_0x436b0e['body'][_0x68ae('0x5f')];return db[_0x68ae('0x4c')][_0x68ae('0x57')]({'where':{'id':_0x436b0e['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x34ab81,null))[_0x68ae('0x20')](function(_0x41b044){if(_0x41b044){_0x24c340[_0x68ae('0x27')]=_0x41b044[_0x68ae('0x62')]({'plain':!![]});return db[_0x68ae('0x63')][_0x68ae('0x57')]({'where':{'id':_0x41b044[_0x68ae('0x64')]}});}return null;})[_0x68ae('0x20')](handleEntityNotFound(_0x34ab81,null))[_0x68ae('0x20')](function(_0x25f713){if(_0x25f713){_0x24c340[_0x68ae('0x67')]=_0x25f713[_0x68ae('0x62')]({'plain':!![]});interaction_log['info'](_0x68ae('0x76'),_0x436b0e[_0x68ae('0x60')]['id'],_0x436b0e[_0x68ae('0x60')]['name'],_0x436b0e[_0x68ae('0x60')][_0x68ae('0x69')],_0x24c340[_0x68ae('0x67')]['id'],_0x436b0e[_0x68ae('0x56')]?JSON[_0x68ae('0x23')](_0x436b0e[_0x68ae('0x56')]):'null');return respondWithRpcPromise(_0x68ae('0x77'),_0x68ae('0x78'),_0x24c340);}return null;})[_0x68ae('0x20')](function(_0x11fbf2){if(_0x11fbf2){_0x11fbf2[_0x68ae('0x27')][_0x68ae('0x6e')]=util['format']('SIP/%s',_0x436b0e[_0x68ae('0x60')][_0x68ae('0x38')]);_0x11fbf2['message'][_0x68ae('0x70')]=_0x24c340[_0x68ae('0x70')];_0x11fbf2[_0x68ae('0x27')]['event']=_0x68ae('0x74');respondWithRpcPromise(_0x68ae('0x72'),'EventManager',{'event':_0x68ae('0x79'),'message':_0x11fbf2['message']},client9002);return _0x24c340;}return null;})[_0x68ae('0x20')](respondWithResult(_0x34ab81,null))['catch'](handleError(_0x34ab81,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 2a83520..10fa134 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 _0x7fb0=['exports','events','../../mysqldb','save','remove','emit','hook'];(function(_0x1029c4,_0x5beaab){var _0x505371=function(_0xd33d47){while(--_0xd33d47){_0x1029c4['push'](_0x1029c4['shift']());}};_0x505371(++_0x5beaab);}(_0x7fb0,0x189));var _0x07fb=function(_0x3f3b41,_0x41d7c4){_0x3f3b41=_0x3f3b41-0x0;var _0x50cb76=_0x7fb0[_0x3f3b41];return _0x50cb76;};'use strict';var EventEmitter=require(_0x07fb('0x0'));var OpenchannelMessage=require(_0x07fb('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x07fb('0x2'),'afterUpdate':'update','afterDestroy':_0x07fb('0x3')};function emitEvent(_0x5e19fc){return function(_0x35ef83,_0x1eb5ef,_0x46fb08){OpenchannelMessageEvents['emit'](_0x5e19fc+':'+_0x35ef83['id'],_0x35ef83);OpenchannelMessageEvents[_0x07fb('0x4')](_0x5e19fc,_0x35ef83);_0x46fb08(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x07fb('0x5')](e,emitEvent(event));}}module[_0x07fb('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x27e8=['update','emit','hasOwnProperty','hook','exports','events','setMaxListeners','save'];(function(_0x4ddfe9,_0x11daa8){var _0xb09fb7=function(_0x78002){while(--_0x78002){_0x4ddfe9['push'](_0x4ddfe9['shift']());}};_0xb09fb7(++_0x11daa8);}(_0x27e8,0x1bd));var _0x827e=function(_0x293417,_0x42eeec){_0x293417=_0x293417-0x0;var _0x446250=_0x27e8[_0x293417];return _0x446250;};'use strict';var EventEmitter=require(_0x827e('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x827e('0x1')](0x0);var events={'afterCreate':_0x827e('0x2'),'afterUpdate':_0x827e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x16be3e){return function(_0x2f27e0,_0x1d3959,_0x4d394a){OpenchannelMessageEvents['emit'](_0x16be3e+':'+_0x2f27e0['id'],_0x2f27e0);OpenchannelMessageEvents[_0x827e('0x4')](_0x16be3e,_0x2f27e0);_0x4d394a(null);};}for(var e in events){if(events[_0x827e('0x5')](e)){var event=events[e];OpenchannelMessage[_0x827e('0x6')](e,emitEvent(event));}}module[_0x827e('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 883eb1b..90019f3 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 _0xb146=['api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','out','CmContact','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','keys','get','replyUri','info','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','method','GET','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4','lodash','util','../../config/logger'];(function(_0x1c32eb,_0x5db92c){var _0x41f4bd=function(_0x209b40){while(--_0x209b40){_0x1c32eb['push'](_0x1c32eb['shift']());}};_0x41f4bd(++_0x5db92c);}(_0xb146,0x1da));var _0x6b14=function(_0xda12de,_0x321368){_0xda12de=_0xda12de-0x0;var _0x523c3d=_0xb146[_0xda12de];return _0x523c3d;};'use strict';var _=require(_0x6b14('0x0'));var util=require(_0x6b14('0x1'));var logger=require(_0x6b14('0x2'))(_0x6b14('0x3'));var moment=require('moment');var BPromise=require(_0x6b14('0x4'));var rp=require(_0x6b14('0x5'));var fs=require('fs');var path=require(_0x6b14('0x6'));var rimraf=require(_0x6b14('0x7'));var config=require(_0x6b14('0x8'));var attributes=require('./openchannelMessage.attributes');module[_0x6b14('0x9')]=function(_0x49fecd,_0x218fa){return _0x49fecd[_0x6b14('0xa')](_0x6b14('0xb'),attributes,{'tableName':_0x6b14('0xc'),'paranoid':![],'indexes':[{'name':_0x6b14('0xd'),'fields':[_0x6b14('0xe')],'type':_0x6b14('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd181bd,_0x25106d,_0x16e298){var _0x1646e9=_0x49fecd[_0x6b14('0x10')];var _0x347337=_0xd181bd['get']({'plain':!![]});if(_0x347337[_0x6b14('0x11')][_0x6b14('0x12')]()==='in'||_0x347337[_0x6b14('0x11')][_0x6b14('0x12')]()==='out'&&!_0x347337[_0x6b14('0x13')]&&!_[_0x6b14('0x14')](_0x347337['UserId'])){_0x1646e9[_0x6b14('0x15')][_0x6b14('0x16')]({'where':{'id':_0x347337[_0x6b14('0x17')]}})[_0x6b14('0x18')](function(_0x1bbe01){if(_0x1bbe01){_0x1bbe01[_0x6b14('0x19')]({'lastMsgAt':_0x347337[_0x6b14('0x1a')],'lastMsgDirection':_0x347337[_0x6b14('0x11')][_0x6b14('0x12')]()});}})[_0x6b14('0x1b')](function(_0x113d06){console[_0x6b14('0x1c')](_0x113d06);});}if(_0x347337[_0x6b14('0x11')]===_0x6b14('0x1d')&&!_0x347337[_0x6b14('0x13')]){var _0x129196;_0x1646e9[_0x6b14('0x1e')]['describe']()[_0x6b14('0x18')](function(_0x12fb98){return _0x1646e9[_0x6b14('0x1f')]['find']({'where':{'id':_0x347337[_0x6b14('0x20')]},'include':[{'model':_0x1646e9[_0x6b14('0x15')],'as':_0x6b14('0x21'),'where':{'id':_0x347337[_0x6b14('0x17')]},'limit':0x1,'include':[{'model':_0x1646e9['CmContact'],'as':_0x6b14('0x22'),'attributes':_[_0x6b14('0x23')](_0x12fb98)}]}]});})['then'](function(_0x3736a1){_0x129196=_0x3736a1[_0x6b14('0x24')]({'plain':!![]});if(_0x129196&&_0x129196[_0x6b14('0x25')]){logger[_0x6b14('0x26')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x6b14('0x27')](_0x6b14('0x28'),_0x347337['id'],_0x129196[_0x6b14('0x25')]));if(_0x129196[_0x6b14('0x21')]&&_0x129196[_0x6b14('0x21')]['length']){_0x347337[_0x6b14('0x29')]=_[_0x6b14('0x2a')](_0x129196['Interactions'][0x0],_0x6b14('0x22'));_0x347337[_0x6b14('0x22')]=_0x129196['Interactions'][0x0]['Contact'];}var _0x25106d={'method':_0x6b14('0x2b'),'uri':encodeURI(_0x129196[_0x6b14('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x25106d[_0x6b14('0x2c')]){case _0x6b14('0x2d'):_0x25106d['qs']=_0x347337;break;case'POST':_0x25106d[_0x6b14('0xe')]=_0x347337;break;}return rp(_0x25106d)['then'](function(_0x2eb94e){logger[_0x6b14('0x26')](_0x6b14('0x2e'),_0x6b14('0x2f'),util[_0x6b14('0x27')](_0x6b14('0x30'),_0x347337['id'],_0x129196['replyUri']));if(_0x2eb94e[_0x6b14('0xe')]['threadId']&&_0x2eb94e[_0x6b14('0xe')][_0x6b14('0x31')]!=_0x347337['Interaction'][_0x6b14('0x31')]){return _0x1646e9[_0x6b14('0x15')][_0x6b14('0x19')]({'threadId':_0x2eb94e[_0x6b14('0xe')][_0x6b14('0x31')]},{'logging':!![],'where':{'id':_0x347337['Interaction']['id']}});}else{return;}})[_0x6b14('0x18')](function(){return _0xd181bd['update']({'read':!![]});})['catch'](function(_0x46b709){logger[_0x6b14('0x1c')](_0x6b14('0x2e'),'afterCreate',util[_0x6b14('0x32')](_0x46b709,{'showHidden':![],'depth':null}));_0x16e298();});}else{_0x16e298();}})[_0x6b14('0x33')](function(){_0x16e298();});}else{_0x16e298();}}},'charset':_0x6b14('0x34'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x30d7=['Interaction','omit','replyUri','method','GET','POST','body','Message\x20%d\x20forwarded\x20to\x20%s','threadId','afterCreate','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0x30d7,0x1d8));var _0x730d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x730d('0x0'));var util=require(_0x730d('0x1'));var logger=require('../../config/logger')(_0x730d('0x2'));var moment=require(_0x730d('0x3'));var BPromise=require(_0x730d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x730d('0x5'));var rimraf=require(_0x730d('0x6'));var config=require(_0x730d('0x7'));var attributes=require(_0x730d('0x8'));module[_0x730d('0x9')]=function(_0x15bc14,_0x56221e){return _0x15bc14[_0x730d('0xa')](_0x730d('0xb'),attributes,{'tableName':_0x730d('0xc'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':_0x730d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53e983,_0x480cf5,_0xf188c8){var _0x433228=_0x15bc14['models'];var _0x415908=_0x53e983[_0x730d('0xe')]({'plain':!![]});if(_0x415908[_0x730d('0xf')][_0x730d('0x10')]()==='in'||_0x415908['direction'][_0x730d('0x10')]()===_0x730d('0x11')&&!_0x415908[_0x730d('0x12')]&&!_[_0x730d('0x13')](_0x415908[_0x730d('0x14')])){_0x433228[_0x730d('0x15')]['findOne']({'where':{'id':_0x415908[_0x730d('0x16')]}})[_0x730d('0x17')](function(_0x354ad3){if(_0x354ad3){_0x354ad3[_0x730d('0x18')]({'lastMsgAt':_0x415908[_0x730d('0x19')],'lastMsgDirection':_0x415908[_0x730d('0xf')][_0x730d('0x10')]()});}})[_0x730d('0x1a')](function(_0x5a03d7){console[_0x730d('0x1b')](_0x5a03d7);});}if(_0x415908[_0x730d('0xf')]===_0x730d('0x11')&&!_0x415908[_0x730d('0x12')]){var _0x449670;_0x433228[_0x730d('0x1c')][_0x730d('0x1d')]()[_0x730d('0x17')](function(_0x551a17){return _0x433228[_0x730d('0x1e')][_0x730d('0x1f')]({'where':{'id':_0x415908['OpenchannelAccountId']},'include':[{'model':_0x433228[_0x730d('0x15')],'as':_0x730d('0x20'),'where':{'id':_0x415908[_0x730d('0x16')]},'limit':0x1,'include':[{'model':_0x433228['CmContact'],'as':_0x730d('0x21'),'attributes':_[_0x730d('0x22')](_0x551a17)}]}]});})[_0x730d('0x17')](function(_0x1886a3){_0x449670=_0x1886a3[_0x730d('0xe')]({'plain':!![]});if(_0x449670&&_0x449670['replyUri']){logger[_0x730d('0x23')](_0x730d('0x24'),'afterCreate',util['format'](_0x730d('0x25'),_0x415908['id'],_0x449670['replyUri']));if(_0x449670[_0x730d('0x20')]&&_0x449670['Interactions']['length']){_0x415908[_0x730d('0x26')]=_[_0x730d('0x27')](_0x449670['Interactions'][0x0],'Contact');_0x415908[_0x730d('0x21')]=_0x449670['Interactions'][0x0]['Contact'];}var _0x480cf5={'method':'POST','uri':encodeURI(_0x449670[_0x730d('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x480cf5[_0x730d('0x29')]){case _0x730d('0x2a'):_0x480cf5['qs']=_0x415908;break;case _0x730d('0x2b'):_0x480cf5[_0x730d('0x2c')]=_0x415908;break;}return rp(_0x480cf5)['then'](function(_0x1e1065){logger['info'](_0x730d('0x24'),'afterCreate',util['format'](_0x730d('0x2d'),_0x415908['id'],_0x449670['replyUri']));if(_0x1e1065[_0x730d('0x2c')][_0x730d('0x2e')]&&_0x1e1065[_0x730d('0x2c')][_0x730d('0x2e')]!=_0x415908[_0x730d('0x26')]['threadId']){return _0x433228[_0x730d('0x15')]['update']({'threadId':_0x1e1065[_0x730d('0x2c')][_0x730d('0x2e')]},{'logging':!![],'where':{'id':_0x415908[_0x730d('0x26')]['id']}});}else{return;}})[_0x730d('0x17')](function(){return _0x53e983[_0x730d('0x18')]({'read':!![]});})['catch'](function(_0x4534ac){logger[_0x730d('0x1b')](_0x730d('0x24'),_0x730d('0x2f'),util[_0x730d('0x30')](_0x4534ac,{'showHidden':![],'depth':null}));_0xf188c8();});}else{_0xf188c8();}})['finally'](function(){_0xf188c8();});}else{_0xf188c8();}}},'charset':_0x730d('0x31'),'collate':_0x730d('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 267aff9..c72030f 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 _0x287e=['./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','result','CreateOpenchannelMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','socket.io-emitter'];(function(_0x410ca2,_0x4359b7){var _0xa7b1f7=function(_0x817a13){while(--_0x817a13){_0x410ca2['push'](_0x410ca2['shift']());}};_0xa7b1f7(++_0x4359b7);}(_0x287e,0x1e3));var _0xe287=function(_0x331569,_0x42a73f){_0x331569=_0x331569-0x0;var _0x2bef37=_0x287e[_0x331569];return _0x2bef37;};'use strict';var _=require(_0xe287('0x0'));var util=require(_0xe287('0x1'));var moment=require(_0xe287('0x2'));var BPromise=require(_0xe287('0x3'));var rs=require(_0xe287('0x4'));var fs=require('fs');var Redis=require(_0xe287('0x5'));var db=require(_0xe287('0x6'))['db'];var utils=require(_0xe287('0x7'));var logger=require(_0xe287('0x8'))('rpc');var config=require(_0xe287('0x9'));var jayson=require(_0xe287('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xe287('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe287('0xc'))(new Redis(config[_0xe287('0xb')]));require(_0xe287('0xd'))[_0xe287('0xe')](socket);function respondWithRpcPromise(_0x1e781d,_0x3e82a2,_0x3a492a){return new BPromise(function(_0x3dddb2,_0x2690e6){return client[_0xe287('0xf')](_0x1e781d,_0x3a492a)[_0xe287('0x10')](function(_0x1c200f){logger['info'](_0xe287('0x11'),_0x3e82a2,'request\x20sent');logger[_0xe287('0x12')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3e82a2,_0xe287('0x13'),JSON['stringify'](_0x1c200f));if(_0x1c200f[_0xe287('0x14')]){if(_0x1c200f[_0xe287('0x14')][_0xe287('0x15')]===0x1f4){logger[_0xe287('0x14')](_0xe287('0x11'),_0x3e82a2,_0x1c200f['error'][_0xe287('0x16')]);return _0x2690e6(_0x1c200f['error'][_0xe287('0x16')]);}logger[_0xe287('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e82a2,_0x1c200f[_0xe287('0x14')]['message']);return _0x3dddb2(_0x1c200f['error'][_0xe287('0x16')]);}else{logger[_0xe287('0x17')](_0xe287('0x11'),_0x3e82a2,'request\x20sent');_0x3dddb2(_0x1c200f[_0xe287('0x18')]['message']);}})['catch'](function(_0x1f23df){logger[_0xe287('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e82a2,_0x1f23df);_0x2690e6(_0x1f23df);});});}exports[_0xe287('0x19')]=function(_0x509877){var _0x241873=this;return new Promise(function(_0x219b2f,_0x411e16){return db['OpenchannelMessage'][_0xe287('0x1a')](_0x509877[_0xe287('0x1b')],{'raw':_0x509877[_0xe287('0x1c')]?_0x509877[_0xe287('0x1c')][_0xe287('0x1d')]===undefined?!![]:![]:!![]})[_0xe287('0x10')](function(_0x3e971a){logger[_0xe287('0x17')]('CreateOpenchannelMessage',_0x509877);logger[_0xe287('0x12')](_0xe287('0x19'),_0x509877,JSON['stringify'](_0x3e971a));_0x219b2f(_0x3e971a);})[_0xe287('0x1e')](function(_0x4da623){logger[_0xe287('0x14')](_0xe287('0x19'),_0x4da623[_0xe287('0x16')],_0x509877);_0x411e16(_0x241873['error'](0x1f4,_0x4da623['message']));});});}; \ No newline at end of file +var _0xaa64=['client','http','redis','defaults','socket.io-emitter','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateOpenchannelMessage','OpenchannelMessage','create','body','options','raw','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x25b40d,_0x3d8e6c){var _0x25adab=function(_0x44de2b){while(--_0x44de2b){_0x25b40d['push'](_0x25b40d['shift']());}};_0x25adab(++_0x3d8e6c);}(_0xaa64,0xf7));var _0x4aa6=function(_0x128de4,_0x511592){_0x128de4=_0x128de4-0x0;var _0x167659=_0xaa64[_0x128de4];return _0x167659;};'use strict';var _=require(_0x4aa6('0x0'));var util=require(_0x4aa6('0x1'));var moment=require('moment');var BPromise=require(_0x4aa6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4aa6('0x3'));var db=require(_0x4aa6('0x4'))['db'];var utils=require(_0x4aa6('0x5'));var logger=require('../../config/logger')(_0x4aa6('0x6'));var config=require(_0x4aa6('0x7'));var jayson=require(_0x4aa6('0x8'));var client=jayson[_0x4aa6('0x9')][_0x4aa6('0xa')]({'port':0x232a});config[_0x4aa6('0xb')]=_[_0x4aa6('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4aa6('0xd'))(new Redis(config[_0x4aa6('0xb')]));require('./openchannelMessage.socket')[_0x4aa6('0xe')](socket);function respondWithRpcPromise(_0x521ae3,_0x1df231,_0xf48bbb){return new BPromise(function(_0x205770,_0x136e55){return client['request'](_0x521ae3,_0xf48bbb)[_0x4aa6('0xf')](function(_0x1d23d2){logger[_0x4aa6('0x10')](_0x4aa6('0x11'),_0x1df231,_0x4aa6('0x12'));logger[_0x4aa6('0x13')](_0x4aa6('0x14'),_0x1df231,_0x4aa6('0x12'),JSON[_0x4aa6('0x15')](_0x1d23d2));if(_0x1d23d2[_0x4aa6('0x16')]){if(_0x1d23d2['error'][_0x4aa6('0x17')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x1df231,_0x1d23d2[_0x4aa6('0x16')][_0x4aa6('0x18')]);return _0x136e55(_0x1d23d2[_0x4aa6('0x16')][_0x4aa6('0x18')]);}logger[_0x4aa6('0x16')](_0x4aa6('0x11'),_0x1df231,_0x1d23d2[_0x4aa6('0x16')][_0x4aa6('0x18')]);return _0x205770(_0x1d23d2['error'][_0x4aa6('0x18')]);}else{logger['info'](_0x4aa6('0x11'),_0x1df231,'request\x20sent');_0x205770(_0x1d23d2['result'][_0x4aa6('0x18')]);}})[_0x4aa6('0x19')](function(_0x2458fd){logger[_0x4aa6('0x16')](_0x4aa6('0x11'),_0x1df231,_0x2458fd);_0x136e55(_0x2458fd);});});}exports[_0x4aa6('0x1a')]=function(_0x1d4a09){var _0x10a2e7=this;return new Promise(function(_0x15365e,_0x4c9159){return db[_0x4aa6('0x1b')][_0x4aa6('0x1c')](_0x1d4a09[_0x4aa6('0x1d')],{'raw':_0x1d4a09[_0x4aa6('0x1e')]?_0x1d4a09[_0x4aa6('0x1e')][_0x4aa6('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0xa0f5be){logger[_0x4aa6('0x10')](_0x4aa6('0x1a'),_0x1d4a09);logger[_0x4aa6('0x13')](_0x4aa6('0x1a'),_0x1d4a09,JSON[_0x4aa6('0x15')](_0xa0f5be));_0x15365e(_0xa0f5be);})['catch'](function(_0x2f4943){logger[_0x4aa6('0x16')]('CreateOpenchannelMessage',_0x2f4943['message'],_0x1d4a09);_0x4c9159(_0x10a2e7[_0x4aa6('0x16')](0x1f4,_0x2f4943[_0x4aa6('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 3967502..86b6449 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 _0xb43b=['./openchannelMessage.events','save','update','emit','removeListener','length','openchannelMessage:'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x5d2f23,_0x1152cb){_0x5d2f23=_0x5d2f23-0x0;var _0x10f629=_0xb43b[_0x5d2f23];return _0x10f629;};'use strict';var OpenchannelMessageEvents=require(_0xbb43('0x0'));var events=[_0xbb43('0x1'),'remove',_0xbb43('0x2')];function createListener(_0x1995f8,_0x22bc86){return function(_0x4cf605){_0x22bc86[_0xbb43('0x3')](_0x1995f8,_0x4cf605);};}function removeListener(_0x41aff6,_0x351254){return function(){OpenchannelMessageEvents[_0xbb43('0x4')](_0x41aff6,_0x351254);};}exports['register']=function(_0x491fb9){for(var _0x378df5=0x0,_0x553520=events[_0xbb43('0x5')];_0x378df5<_0x553520;_0x378df5++){var _0x1ccd49=events[_0x378df5];var _0x2a2f11=createListener(_0xbb43('0x6')+_0x1ccd49,_0x491fb9);OpenchannelMessageEvents['on'](_0x1ccd49,_0x2a2f11);}}; \ No newline at end of file +var _0x0713=['removeListener','register','length','openchannelMessage:','remove','update'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){OpenchannelMessageEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);OpenchannelMessageEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 45a8dc6..273d05b 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 _0x8ba0=['update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../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','put'];(function(_0x357765,_0x9d9c7){var _0xd19403=function(_0x185730){while(--_0x185730){_0x357765['push'](_0x357765['shift']());}};_0xd19403(++_0x9d9c7);}(_0x8ba0,0x1c7));var _0x08ba=function(_0x447cae,_0x4d1684){_0x447cae=_0x447cae-0x0;var _0x4870ec=_0x8ba0[_0x447cae];return _0x4870ec;};'use strict';var multer=require(_0x08ba('0x0'));var util=require(_0x08ba('0x1'));var path=require(_0x08ba('0x2'));var timeout=require(_0x08ba('0x3'));var express=require(_0x08ba('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x08ba('0x5'));var config=require(_0x08ba('0x6'));var controller=require(_0x08ba('0x7'));router[_0x08ba('0x8')]('/',auth[_0x08ba('0x9')](),controller[_0x08ba('0xa')]);router['get'](_0x08ba('0xb'),auth[_0x08ba('0x9')](),controller[_0x08ba('0xc')]);router[_0x08ba('0x8')](_0x08ba('0xd'),auth['isAuthenticated'](),controller[_0x08ba('0xe')]);router['get'](_0x08ba('0xf'),auth['isAuthenticated'](),controller[_0x08ba('0x10')]);router[_0x08ba('0x8')](_0x08ba('0x11'),auth[_0x08ba('0x9')](),controller[_0x08ba('0x12')]);router[_0x08ba('0x8')](_0x08ba('0x13'),auth[_0x08ba('0x9')](),controller[_0x08ba('0x14')]);router[_0x08ba('0x15')]('/',auth[_0x08ba('0x9')](),controller[_0x08ba('0x16')]);router['post'](_0x08ba('0x11'),auth[_0x08ba('0x9')](),controller[_0x08ba('0x17')]);router[_0x08ba('0x15')](_0x08ba('0x13'),auth[_0x08ba('0x9')](),controller['addAgents']);router[_0x08ba('0x18')](_0x08ba('0xd'),auth[_0x08ba('0x9')](),controller[_0x08ba('0x19')]);router[_0x08ba('0x1a')]('/:id',auth[_0x08ba('0x9')](),controller[_0x08ba('0x1b')]);router['delete'](_0x08ba('0x11'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x08ba('0x1a')](_0x08ba('0x13'),auth[_0x08ba('0x9')](),controller[_0x08ba('0x1c')]);module[_0x08ba('0x1d')]=router; \ No newline at end of file +var _0x02a7=['index','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','update','destroy','delete','removeTeams','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get'];(function(_0x56c70f,_0x4e4493){var _0x3812ed=function(_0x25460f){while(--_0x25460f){_0x56c70f['push'](_0x56c70f['shift']());}};_0x3812ed(++_0x4e4493);}(_0x02a7,0x7a));var _0x702a=function(_0xb9c1ec,_0x4ff82e){_0xb9c1ec=_0xb9c1ec-0x0;var _0x3739ca=_0x02a7[_0xb9c1ec];return _0x3739ca;};'use strict';var multer=require('multer');var util=require(_0x702a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x702a('0x1'));var router=express[_0x702a('0x2')]();var auth=require(_0x702a('0x3'));var interaction=require(_0x702a('0x4'));var config=require(_0x702a('0x5'));var controller=require(_0x702a('0x6'));router[_0x702a('0x7')]('/',auth['isAuthenticated'](),controller[_0x702a('0x8')]);router['get'](_0x702a('0x9'),auth[_0x702a('0xa')](),controller[_0x702a('0xb')]);router[_0x702a('0x7')](_0x702a('0xc'),auth[_0x702a('0xa')](),controller[_0x702a('0xd')]);router['get'](_0x702a('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0x702a('0x7')](_0x702a('0xf'),auth[_0x702a('0xa')](),controller[_0x702a('0x10')]);router['get'](_0x702a('0x11'),auth[_0x702a('0xa')](),controller[_0x702a('0x12')]);router[_0x702a('0x13')]('/',auth[_0x702a('0xa')](),controller[_0x702a('0x14')]);router[_0x702a('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x702a('0x15')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x702a('0xc'),auth[_0x702a('0xa')](),controller[_0x702a('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x702a('0x17')]);router[_0x702a('0x18')](_0x702a('0xf'),auth['isAuthenticated'](),controller[_0x702a('0x19')]);router['delete'](_0x702a('0x11'),auth[_0x702a('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index e4119de..8e83bc4 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 _0x2525=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x4dfd91,_0x48f645){var _0x2da8d4=function(_0x4644ae){while(--_0x4644ae){_0x4dfd91['push'](_0x4dfd91['shift']());}};_0x2da8d4(++_0x48f645);}(_0x2525,0x1f0));var _0x5252=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x2525[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x5252('0x0'));module[_0x5252('0x1')]={'name':{'type':Sequelize[_0x5252('0x2')],'unique':_0x5252('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5252('0x2')]},'timeout':{'type':Sequelize[_0x5252('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5252('0x5')](_0x5252('0x6'),_0x5252('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x4325=['name','STRING','INTEGER','beepall','roundrobin','sequelize','exports'];(function(_0x2a4468,_0x577f1f){var _0x45d2c9=function(_0x29ce2a){while(--_0x29ce2a){_0x2a4468['push'](_0x2a4468['shift']());}};_0x45d2c9(++_0x577f1f);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5432('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5432('0x3')]},'timeout':{'type':Sequelize[_0x5432('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x5432('0x5'),_0x5432('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 934b99c..904d6c5 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 _0x5961=['defaults','localhost','socket.io-emitter','redis','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','nolimit','pick','OpenchannelQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','getTeams','Team','hasOwnProperty','addTeams','ids','voicePause','flatMap','Agents','sequelize','findOrCreate','forEach','emit','removeTeams','select','tq.TeamId','from','team_has_openchannel_queues','join','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','value','transaction','isEmpty','removeAgents','addAgents','spread','userOpenchannelQueue:save','userOpenchannelQueue:remove','getAgents','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x431477,_0xbc03e6){var _0x11826f=function(_0xaad378){while(--_0xaad378){_0x431477['push'](_0x431477['shift']());}};_0x11826f(++_0xbc03e6);}(_0x5961,0x6f));var _0x1596=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0x5961[_0x445101];return _0x3c3d04;};'use strict';var pdf=require(_0x1596('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1596('0x1'));var jsonpatch=require(_0x1596('0x2'));var rp=require('request-promise');var moment=require(_0x1596('0x3'));var BPromise=require(_0x1596('0x4'));var Mustache=require(_0x1596('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1596('0x6'));var ejs=require(_0x1596('0x7'));var fs=require('fs');var _=require(_0x1596('0x8'));var squel=require(_0x1596('0x9'));var crypto=require(_0x1596('0xa'));var jsforce=require(_0x1596('0xb'));var deskjs=require(_0x1596('0xc'));var toCsv=require(_0x1596('0x6'));var querystring=require(_0x1596('0xd'));var Papa=require(_0x1596('0xe'));var Redis=require(_0x1596('0xf'));var authService=require(_0x1596('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1596('0x11'));var hardwareService=require(_0x1596('0x12'));var logger=require(_0x1596('0x13'))(_0x1596('0x14'));var utils=require('../../config/utils');var config=require(_0x1596('0x15'));var db=require(_0x1596('0x16'))['db'];config['redis']=_[_0x1596('0x17')](config['redis'],{'host':_0x1596('0x18'),'port':0x18eb});var socket=require(_0x1596('0x19'))(new Redis(config[_0x1596('0x1a')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x5ae247,_0x1bb3db){_0x1bb3db=_0x1bb3db||0xcc;return function(_0x1fd329){if(_0x1fd329){return _0x5ae247[_0x1596('0x1b')](_0x1bb3db);}return _0x5ae247[_0x1596('0x1c')](_0x1bb3db)['end']();};}function respondWithResult(_0x384f35,_0x37626f){_0x37626f=_0x37626f||0xc8;return function(_0x39e714){if(_0x39e714){return _0x384f35[_0x1596('0x1c')](_0x37626f)[_0x1596('0x1d')](_0x39e714);}};}function respondWithFilteredResult(_0x57a75c,_0x1af66f){return function(_0x1da2c0){if(_0x1da2c0){var _0x368044=_0x1da2c0[_0x1596('0x1e')],_0x31cf6a=_0x1af66f[_0x1596('0x1f')],_0x2a9b86=_0x1af66f['offset']+_0x1af66f[_0x1596('0x20')],_0x56817d;if(_0x2a9b86>=_0x368044){_0x2a9b86=_0x368044;_0x56817d=0xc8;}else{_0x56817d=0xce;}_0x57a75c[_0x1596('0x1c')](_0x56817d);return _0x57a75c[_0x1596('0x21')](_0x1596('0x22'),_0x31cf6a+'-'+_0x2a9b86+'/'+_0x368044)[_0x1596('0x1d')](_0x1da2c0);}return null;};}function patchUpdates(_0x4880e7){return function(_0x4fa13d){try{jsonpatch[_0x1596('0x23')](_0x4fa13d,_0x4880e7,!![]);}catch(_0x45ea16){return BPromise[_0x1596('0x24')](_0x45ea16);}return _0x4fa13d[_0x1596('0x25')]();};}function saveUpdates(_0x547b68,_0x2b224f){return function(_0x229f74){if(_0x229f74){return _0x229f74[_0x1596('0x26')](_0x547b68)[_0x1596('0x27')](function(_0x43e2c6){return _0x43e2c6;});}return null;};}function removeEntity(_0x2012c9,_0xef5dda){return function(_0x1d1ce2){if(_0x1d1ce2){return _0x1d1ce2['destroy']()[_0x1596('0x27')](function(){var _0x28616a=_0x1d1ce2[_0x1596('0x28')]({'plain':!![]});var _0x3a19cf=_0x1596('0x29');return db[_0x1596('0x2a')][_0x1596('0x2b')]({'where':{'type':_0x3a19cf,'resourceId':_0x28616a['id']}})[_0x1596('0x27')](function(){return _0x1d1ce2;});})['then'](function(){_0x2012c9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c591d,_0x718118){return function(_0x480693){if(!_0x480693){_0x3c591d['sendStatus'](0x194);}return _0x480693;};}function handleError(_0x2fc1c9,_0x1564cd){_0x1564cd=_0x1564cd||0x1f4;return function(_0x1373e4){logger[_0x1596('0x2c')](_0x1373e4[_0x1596('0x2d')]);if(_0x1373e4[_0x1596('0x2e')]){delete _0x1373e4[_0x1596('0x2e')];}_0x2fc1c9[_0x1596('0x1c')](_0x1564cd)[_0x1596('0x2f')](_0x1373e4);};}exports[_0x1596('0x30')]=function(_0x2e4af1,_0x3d01a6){var _0x36bee5={},_0x59e0f0={},_0x399721={'count':0x0,'rows':[]};var _0x4793b1=_[_0x1596('0x31')](db[_0x1596('0x32')][_0x1596('0x33')],function(_0x257aae){return{'name':_0x257aae[_0x1596('0x34')],'type':_0x257aae[_0x1596('0x35')][_0x1596('0x36')]};});_0x59e0f0[_0x1596('0x37')]=_['map'](_0x4793b1,_0x1596('0x2e'));_0x59e0f0[_0x1596('0x38')]=_[_0x1596('0x39')](_0x2e4af1[_0x1596('0x38')]);_0x59e0f0[_0x1596('0x3a')]=_[_0x1596('0x3b')](_0x59e0f0['model'],_0x59e0f0[_0x1596('0x38')]);_0x36bee5[_0x1596('0x3c')]=_[_0x1596('0x3b')](_0x59e0f0[_0x1596('0x37')],qs['fields'](_0x2e4af1['query'][_0x1596('0x3d')]));_0x36bee5['attributes']=_0x36bee5[_0x1596('0x3c')][_0x1596('0x3e')]?_0x36bee5['attributes']:_0x59e0f0[_0x1596('0x37')];if(!_0x2e4af1[_0x1596('0x38')]['hasOwnProperty']('nolimit')){_0x36bee5['limit']=qs[_0x1596('0x20')](_0x2e4af1[_0x1596('0x38')][_0x1596('0x20')]);_0x36bee5['offset']=qs[_0x1596('0x1f')](_0x2e4af1[_0x1596('0x38')][_0x1596('0x1f')]);}_0x36bee5[_0x1596('0x3f')]=qs[_0x1596('0x40')](_0x2e4af1[_0x1596('0x38')][_0x1596('0x40')]);_0x36bee5[_0x1596('0x41')]=qs[_0x1596('0x3a')](_['pick'](_0x2e4af1['query'],_0x59e0f0['filters']));if(_0x2e4af1[_0x1596('0x38')]['filter']){_0x36bee5[_0x1596('0x41')]=_[_0x1596('0x42')](_0x36bee5[_0x1596('0x41')],{'$or':_[_0x1596('0x31')](_0x4793b1,function(_0x5e1cb7){if(_0x5e1cb7['type']!==_0x1596('0x43')){var _0x54e1ee={};_0x54e1ee[_0x5e1cb7['name']]={'$like':'%'+_0x2e4af1['query'][_0x1596('0x44')]+'%'};return _0x54e1ee;}})});}_0x36bee5=_['merge']({},_0x36bee5,_0x2e4af1[_0x1596('0x45')]);var _0x404928={'where':_0x36bee5[_0x1596('0x41')]};return db[_0x1596('0x32')][_0x1596('0x1e')](_0x404928)['then'](function(_0x154f35){_0x399721[_0x1596('0x1e')]=_0x154f35;if(_0x2e4af1[_0x1596('0x38')][_0x1596('0x46')]){_0x36bee5['include']=[{'all':!![]}];}return db[_0x1596('0x32')][_0x1596('0x47')](_0x36bee5);})[_0x1596('0x27')](function(_0x52131e){_0x399721[_0x1596('0x48')]=_0x52131e;return _0x399721;})[_0x1596('0x27')](respondWithFilteredResult(_0x3d01a6,_0x36bee5))[_0x1596('0x49')](handleError(_0x3d01a6,null));};exports['show']=function(_0x2b0c00,_0x24ccd8){var _0x58457a={'raw':!![],'where':{'id':_0x2b0c00[_0x1596('0x4a')]['id']}},_0x4acfc5={};_0x4acfc5[_0x1596('0x37')]=_[_0x1596('0x39')](db['OpenchannelQueue'][_0x1596('0x33')]);_0x4acfc5[_0x1596('0x38')]=_['keys'](_0x2b0c00[_0x1596('0x38')]);_0x4acfc5[_0x1596('0x3a')]=_[_0x1596('0x3b')](_0x4acfc5[_0x1596('0x37')],_0x4acfc5[_0x1596('0x38')]);_0x58457a[_0x1596('0x3c')]=_[_0x1596('0x3b')](_0x4acfc5[_0x1596('0x37')],qs[_0x1596('0x3d')](_0x2b0c00[_0x1596('0x38')]['fields']));_0x58457a[_0x1596('0x3c')]=_0x58457a[_0x1596('0x3c')][_0x1596('0x3e')]?_0x58457a['attributes']:_0x4acfc5['model'];if(_0x2b0c00['query']['includeAll']){_0x58457a[_0x1596('0x4b')]=[{'all':!![]}];}_0x58457a=_[_0x1596('0x42')]({},_0x58457a,_0x2b0c00['options']);return db[_0x1596('0x32')][_0x1596('0x4c')](_0x58457a)['then'](handleEntityNotFound(_0x24ccd8,null))['then'](respondWithResult(_0x24ccd8,null))[_0x1596('0x49')](handleError(_0x24ccd8,null));};exports['create']=function(_0x277f73,_0xf58242){return db[_0x1596('0x32')][_0x1596('0x4d')](_0x277f73[_0x1596('0x4e')],{})[_0x1596('0x27')](function(_0x5ae536){var _0x53f644=_0x277f73[_0x1596('0x4f')][_0x1596('0x28')]({'plain':!![]});if(!_0x53f644)throw new Error(_0x1596('0x50'));if(_0x53f644[_0x1596('0x51')]===_0x1596('0x4f')){var _0x49d7f9=_0x5ae536[_0x1596('0x28')]({'plain':!![]});var _0x1fdad7=_0x1596('0x29');return db['UserProfileSection'][_0x1596('0x4c')]({'where':{'name':_0x1fdad7,'userProfileId':_0x53f644[_0x1596('0x52')]},'raw':!![]})[_0x1596('0x27')](function(_0xbd62fb){if(_0xbd62fb&&_0xbd62fb['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x49d7f9['name'],'resourceId':_0x49d7f9['id'],'type':_0xbd62fb['name'],'sectionId':_0xbd62fb['id']},{})[_0x1596('0x27')](function(){return _0x5ae536;});}else{return _0x5ae536;}})[_0x1596('0x49')](function(_0x28268e){logger[_0x1596('0x2c')](_0x1596('0x53'),_0x28268e);throw _0x28268e;});}return _0x5ae536;})['then'](respondWithResult(_0xf58242,0xc9))[_0x1596('0x49')](handleError(_0xf58242,null));};exports[_0x1596('0x26')]=function(_0x506583,_0xee8487){if(_0x506583[_0x1596('0x4e')]['id']){delete _0x506583[_0x1596('0x4e')]['id'];}return db[_0x1596('0x32')]['find']({'where':{'id':_0x506583[_0x1596('0x4a')]['id']}})['then'](handleEntityNotFound(_0xee8487,null))[_0x1596('0x27')](saveUpdates(_0x506583[_0x1596('0x4e')],null))[_0x1596('0x27')](respondWithResult(_0xee8487,null))[_0x1596('0x49')](handleError(_0xee8487,null));};exports[_0x1596('0x2b')]=function(_0x232145,_0x45c053){return db[_0x1596('0x32')][_0x1596('0x4c')]({'where':{'id':_0x232145['params']['id']}})['then'](handleEntityNotFound(_0x45c053,null))['then'](removeEntity(_0x45c053,null))[_0x1596('0x49')](handleError(_0x45c053,null));};exports[_0x1596('0x54')]=function(_0x38f673,_0x2f0581){return db[_0x1596('0x32')][_0x1596('0x54')]()[_0x1596('0x27')](respondWithResult(_0x2f0581,null))['catch'](handleError(_0x2f0581,null));};exports['getMembers']=function(_0x2a46ae,_0x403f3f,_0x186763){var _0xbe4495={'raw':!![],'where':{}},_0x354d91={},_0x42bfc9;return db['OpenchannelQueue'][_0x1596('0x55')]({'where':{'id':_0x2a46ae[_0x1596('0x4a')]['id']}})[_0x1596('0x27')](handleEntityNotFound(_0x403f3f,null))[_0x1596('0x27')](function(_0x59bc36){if(_0x59bc36){_0x42bfc9=_0x59bc36[_0x1596('0x28')]({'plain':!![]});_0x354d91[_0x1596('0x37')]=_[_0x1596('0x39')](db[_0x1596('0x56')][_0x1596('0x33')]);_0x354d91[_0x1596('0x38')]=_['keys'](_0x2a46ae[_0x1596('0x38')]);_0x354d91['filters']=_[_0x1596('0x3b')](_0x354d91['model'],_0x354d91[_0x1596('0x38')]);_0xbe4495[_0x1596('0x3c')]=_[_0x1596('0x3b')](_0x354d91[_0x1596('0x37')],qs[_0x1596('0x3d')](_0x2a46ae['query'][_0x1596('0x3d')]));_0xbe4495[_0x1596('0x3c')]=_0xbe4495[_0x1596('0x3c')][_0x1596('0x3e')]?_0xbe4495[_0x1596('0x3c')]:_0x354d91[_0x1596('0x37')];if(!_0x2a46ae[_0x1596('0x38')]['hasOwnProperty'](_0x1596('0x57'))){_0xbe4495[_0x1596('0x20')]=qs[_0x1596('0x20')](_0x2a46ae[_0x1596('0x38')][_0x1596('0x20')]);_0xbe4495['offset']=qs[_0x1596('0x1f')](_0x2a46ae[_0x1596('0x38')]['offset']);}_0xbe4495[_0x1596('0x3f')]=qs[_0x1596('0x40')](_0x2a46ae[_0x1596('0x38')][_0x1596('0x40')]);_0xbe4495[_0x1596('0x41')]=qs['filters'](_[_0x1596('0x58')](_0x2a46ae['query'],_0x354d91[_0x1596('0x3a')]));_0xbe4495[_0x1596('0x41')][_0x1596('0x59')]=_0x59bc36['id'];if(_0x2a46ae['query'][_0x1596('0x44')]){_0xbe4495[_0x1596('0x41')]=_[_0x1596('0x42')](_0xbe4495[_0x1596('0x41')],{'$or':_[_0x1596('0x31')](_0xbe4495[_0x1596('0x3c')],function(_0x5ae649){var _0xcfaf33={};_0xcfaf33[_0x5ae649]={'$like':'%'+_0x2a46ae[_0x1596('0x38')]['filter']+'%'};return _0xcfaf33;})});}_0xbe4495=_['merge']({},_0xbe4495,_0x2a46ae[_0x1596('0x45')]);return db[_0x1596('0x56')]['findAll'](_0xbe4495);}})[_0x1596('0x27')](function(_0x1c39af){if(_0x1c39af){return db[_0x1596('0x5a')][_0x1596('0x5b')]({'where':{'id':_[_0x1596('0x31')](_0x1c39af,_0x1596('0x5c')),'role':'agent'},'attributes':['id',_0x1596('0x2e'),'openchannelPause',_0x1596('0x5d'),_0x1596('0x5e')]});}})['then'](function(_0x3e20d9){if(_0x3e20d9){return{'count':_0x3e20d9[_0x1596('0x1e')],'rows':_[_0x1596('0x31')](_0x3e20d9[_0x1596('0x48')],function(_0x1903a6){return{'membername':_0x1903a6['name'],'UserId':_0x1903a6['id'],'queue_name':_0x42bfc9[_0x1596('0x2e')],'OpenchannelQueueId':_0x42bfc9['id'],'interface':util[_0x1596('0x5f')](_0x1596('0x60'),'SIP',_0x1903a6[_0x1596('0x2e')]),'penalty':0x0,'paused':_0x1903a6['openchannelPause'],'createdAt':_0x1903a6[_0x1596('0x5e')],'updatedAt':_0x1903a6[_0x1596('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1596('0x27')](respondWithFilteredResult(_0x403f3f,_0xbe4495))[_0x1596('0x49')](handleError(_0x403f3f,null));};exports[_0x1596('0x61')]=function(_0xa0a4da,_0x487eae,_0x3001f7){var _0x1763ed={};var _0x516ff4={};var _0x257c76;var _0x132093;return db[_0x1596('0x32')][_0x1596('0x55')]({'where':{'id':_0xa0a4da[_0x1596('0x4a')]['id']}})['then'](handleEntityNotFound(_0x487eae,null))[_0x1596('0x27')](function(_0x1958d3){if(_0x1958d3){_0x257c76=_0x1958d3;_0x516ff4['model']=_[_0x1596('0x39')](db[_0x1596('0x62')][_0x1596('0x33')]);_0x516ff4[_0x1596('0x38')]=_[_0x1596('0x39')](_0xa0a4da[_0x1596('0x38')]);_0x516ff4[_0x1596('0x3a')]=_[_0x1596('0x3b')](_0x516ff4[_0x1596('0x37')],_0x516ff4[_0x1596('0x38')]);_0x1763ed[_0x1596('0x3c')]=_[_0x1596('0x3b')](_0x516ff4[_0x1596('0x37')],qs[_0x1596('0x3d')](_0xa0a4da[_0x1596('0x38')]['fields']));_0x1763ed['attributes']=_0x1763ed[_0x1596('0x3c')][_0x1596('0x3e')]?_0x1763ed[_0x1596('0x3c')]:_0x516ff4[_0x1596('0x37')];_0x1763ed[_0x1596('0x3f')]=qs[_0x1596('0x40')](_0xa0a4da[_0x1596('0x38')][_0x1596('0x40')]);_0x1763ed['where']=qs['filters'](_[_0x1596('0x58')](_0xa0a4da[_0x1596('0x38')],_0x516ff4[_0x1596('0x3a')]));if(_0xa0a4da[_0x1596('0x38')]['filter']){_0x1763ed[_0x1596('0x41')]=_['merge'](_0x1763ed['where'],{'$or':_[_0x1596('0x31')](_0x1763ed['attributes'],function(_0x1f4f3d){var _0x299e5d={};_0x299e5d[_0x1f4f3d]={'$like':'%'+_0xa0a4da['query'][_0x1596('0x44')]+'%'};return _0x299e5d;})});}_0x1763ed=_[_0x1596('0x42')]({},_0x1763ed,_0xa0a4da[_0x1596('0x45')]);return _0x257c76[_0x1596('0x61')](_0x1763ed);}})[_0x1596('0x27')](function(_0x4a5b1b){if(_0x4a5b1b){_0x132093=_0x4a5b1b['length'];if(!_0xa0a4da[_0x1596('0x38')][_0x1596('0x63')](_0x1596('0x57'))){_0x1763ed[_0x1596('0x20')]=qs[_0x1596('0x20')](_0xa0a4da[_0x1596('0x38')][_0x1596('0x20')]);_0x1763ed[_0x1596('0x1f')]=qs[_0x1596('0x1f')](_0xa0a4da[_0x1596('0x38')]['offset']);}return _0x257c76['getTeams'](_0x1763ed);}})[_0x1596('0x27')](function(_0xf04684){if(_0xf04684){return _0xf04684?{'count':_0x132093,'rows':_0xf04684}:null;}})[_0x1596('0x27')](respondWithResult(_0x487eae,null))[_0x1596('0x49')](handleError(_0x487eae,null));};exports[_0x1596('0x64')]=function(_0x2d1a38,_0x5b12ad,_0x392246){var _0x44c303=_0x2d1a38[_0x1596('0x4e')][_0x1596('0x65')];return db['Team'][_0x1596('0x47')]({'where':{'id':_0x44c303},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x1596('0x2e'),'online',_0x1596('0x66'),'interface'],'raw':!![]}]})[_0x1596('0x27')](function(_0x1ca0bd){if(_0x1ca0bd){var _0x548b59=_[_0x1596('0x67')](_0x1ca0bd,function(_0x41305a){var _0x4a2649=_0x41305a[_0x1596('0x28')]({'plain':!![]});return _0x4a2649[_0x1596('0x68')];});return db[_0x1596('0x32')][_0x1596('0x4c')]({'where':{'id':_0x2d1a38[_0x1596('0x4a')]['id']}})[_0x1596('0x27')](function(_0x1b8922){return db[_0x1596('0x69')]['transaction'](function(_0x538918){return _0x1b8922['addTeams'](_0x44c303,{'transaction':_0x538918})[_0x1596('0x27')](function(){return BPromise['each'](_0x548b59,function(_0x1e3370){return db['UserOpenchannelQueue'][_0x1596('0x6a')]({'where':{'UserId':_0x1e3370['id'],'OpenchannelQueueId':_0x2d1a38[_0x1596('0x4a')]['id']},'transaction':_0x538918});});})[_0x1596('0x27')](function(){_0x548b59[_0x1596('0x6b')](function(_0x2bd871){socket[_0x1596('0x6c')]('userOpenchannelQueue:save',{'UserId':_0x2bd871['id'],'OpenchannelQueueId':_0x1b8922['id']});});});});});}})[_0x1596('0x27')](respondWithStatusCode(_0x5b12ad,null))['catch'](handleError(_0x5b12ad,null));};exports[_0x1596('0x6d')]=function(_0x244a9d,_0x5b7e59,_0x30a6a5){return db[_0x1596('0x62')][_0x1596('0x47')]({'where':{'id':_0x244a9d['query'][_0x1596('0x65')]},'attributes':['id'],'include':[{'model':db[_0x1596('0x5a')],'as':_0x1596('0x68'),'attributes':['id'],'raw':!![]}]})[_0x1596('0x27')](handleEntityNotFound(_0x5b7e59,null))[_0x1596('0x27')](function(_0x3b9aab){var _0x39775a=_['map'](_0x3b9aab,'id');var _0xcc0434=[];var _0x2fcd93=[];var _0x2c314e=squel[_0x1596('0x6e')]();_0x2c314e['field'](_0x1596('0x6f'))[_0x1596('0x70')](_0x1596('0x71'),'tq')[_0x1596('0x72')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x1596('0x41')]('OpenchannelQueueId\x20=\x20?',_0x244a9d[_0x1596('0x4a')]['id']);for(var _0x3031b4=0x0;_0x3031b4<_0x3b9aab['length'];_0x3031b4+=0x1){let _0x2a020d=_0x3b9aab[_0x3031b4];for(var _0x5bf496=0x0;_0x5bf496<_0x2a020d[_0x1596('0x68')][_0x1596('0x3e')];_0x5bf496+=0x1){let _0x39580a=_0x2a020d['Agents'][_0x5bf496];var _0x3d60ef=_0x2c314e[_0x1596('0x73')]();_0x3d60ef[_0x1596('0x41')](_0x1596('0x74'),_0x39580a['id']);_0x2fcd93[_0x1596('0x75')](db[_0x1596('0x69')][_0x1596('0x38')](_0x3d60ef[_0x1596('0x76')](),{'type':db[_0x1596('0x69')]['QueryTypes'][_0x1596('0x77')]})['then'](function(_0x1f25e8){if(_0x1f25e8[_0x1596('0x3e')]===0x1){return _0x39580a['id'];}else{var _0x3e40a2=_[_0x1596('0x78')](_['map'](_0x1f25e8,_0x1596('0x79')),function(_0x49e29b){return _[_0x1596('0x7a')](_0x39775a,_0x49e29b);});if(_0x3e40a2){return _0x39580a['id'];}}}));}}return BPromise[_0x1596('0x7b')](_0x2fcd93)[_0x1596('0x27')](function(_0x4ae7b3){_0xcc0434=_(_0xcc0434)['union'](_0x4ae7b3)[_0x1596('0x7c')]()[_0x1596('0x7d')]();return db[_0x1596('0x32')][_0x1596('0x4c')]({'where':{'id':_0x244a9d[_0x1596('0x4a')]['id']}})[_0x1596('0x27')](function(_0x43ebac){return db[_0x1596('0x69')][_0x1596('0x7e')](function(_0x456b59){return _0x43ebac[_0x1596('0x6d')](_0x244a9d[_0x1596('0x38')][_0x1596('0x65')],{'transaction':_0x456b59})[_0x1596('0x27')](function(){if(!_[_0x1596('0x7f')](_0xcc0434)){return _0x43ebac[_0x1596('0x80')](_0xcc0434,{'transaction':_0x456b59});}})[_0x1596('0x27')](function(){_0xcc0434[_0x1596('0x6b')](function(_0x28825d){socket[_0x1596('0x6c')]('userOpenchannelQueue:remove',{'UserId':_0x28825d,'OpenchannelQueueId':_0x43ebac['id']});});});});});});})['then'](respondWithStatusCode(_0x5b7e59,null))[_0x1596('0x49')](handleError(_0x5b7e59,null));};exports[_0x1596('0x81')]=function(_0x35bd4e,_0x1e3ea5,_0x5fc05f){return db[_0x1596('0x32')][_0x1596('0x4c')]({'where':{'id':_0x35bd4e[_0x1596('0x4a')]['id']}})[_0x1596('0x27')](handleEntityNotFound(_0x1e3ea5,null))[_0x1596('0x27')](function(_0x44543c){if(_0x44543c){return _0x44543c[_0x1596('0x81')](_0x35bd4e[_0x1596('0x4e')][_0x1596('0x65')],_['omit'](_0x35bd4e[_0x1596('0x4e')],['ids','id'])||{})[_0x1596('0x82')](function(_0x37bc91){for(var _0x13b446=0x0;_0x13b446<_0x35bd4e[_0x1596('0x4e')][_0x1596('0x65')][_0x1596('0x3e')];_0x13b446+=0x1){socket[_0x1596('0x6c')](_0x1596('0x83'),{'UserId':_0x35bd4e[_0x1596('0x4e')][_0x1596('0x65')][_0x13b446],'OpenchannelQueueId':_0x35bd4e['params']['id']});}return _0x37bc91;});}})[_0x1596('0x27')](respondWithResult(_0x1e3ea5,null))[_0x1596('0x49')](handleError(_0x1e3ea5,null));};exports[_0x1596('0x80')]=function(_0x2a785c,_0x37ad98,_0x5c1ece){return db[_0x1596('0x32')][_0x1596('0x4c')]({'where':{'id':_0x2a785c[_0x1596('0x4a')]['id']}})[_0x1596('0x27')](handleEntityNotFound(_0x37ad98,null))[_0x1596('0x27')](function(_0x9f68fc){if(_0x9f68fc){return _0x9f68fc[_0x1596('0x80')](_0x2a785c[_0x1596('0x38')][_0x1596('0x65')])['then'](function(){if(_['isArray'](_0x2a785c[_0x1596('0x38')][_0x1596('0x65')])){for(var _0x1c8345=0x0;_0x1c8345<_0x2a785c[_0x1596('0x38')][_0x1596('0x65')][_0x1596('0x3e')];_0x1c8345+=0x1){socket[_0x1596('0x6c')](_0x1596('0x84'),{'UserId':Number(_0x2a785c['query'][_0x1596('0x65')][_0x1c8345]),'OpenchannelQueueId':Number(_0x2a785c[_0x1596('0x4a')]['id'])});}}else{socket[_0x1596('0x6c')](_0x1596('0x84'),{'UserId':Number(_0x2a785c[_0x1596('0x38')][_0x1596('0x65')]),'OpenchannelQueueId':Number(_0x2a785c[_0x1596('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x37ad98,null))[_0x1596('0x49')](handleError(_0x37ad98,null));};exports[_0x1596('0x85')]=function(_0x41e170,_0x51dff3,_0x4766cc){var _0xdcc112={};var _0x259929={};var _0x52902b;var _0x16f3ff;return db['OpenchannelQueue'][_0x1596('0x55')]({'where':{'id':_0x41e170[_0x1596('0x4a')]['id']}})[_0x1596('0x27')](handleEntityNotFound(_0x51dff3,null))[_0x1596('0x27')](function(_0x2d9e10){if(_0x2d9e10){_0x52902b=_0x2d9e10;_0x259929['model']=_[_0x1596('0x39')](db['User'][_0x1596('0x33')]);_0x259929[_0x1596('0x38')]=_[_0x1596('0x39')](_0x41e170[_0x1596('0x38')]);_0x259929[_0x1596('0x3a')]=_[_0x1596('0x3b')](_0x259929[_0x1596('0x37')],_0x259929['query']);_0xdcc112[_0x1596('0x3c')]=_[_0x1596('0x3b')](_0x259929[_0x1596('0x37')],qs[_0x1596('0x3d')](_0x41e170[_0x1596('0x38')][_0x1596('0x3d')]));_0xdcc112[_0x1596('0x3c')]=_0xdcc112[_0x1596('0x3c')][_0x1596('0x3e')]?_0xdcc112[_0x1596('0x3c')]:_0x259929['model'];_0xdcc112[_0x1596('0x3f')]=qs[_0x1596('0x40')](_0x41e170[_0x1596('0x38')][_0x1596('0x40')]);_0xdcc112[_0x1596('0x41')]=qs['filters'](_[_0x1596('0x58')](_0x41e170[_0x1596('0x38')],_0x259929[_0x1596('0x3a')]));if(_0x41e170[_0x1596('0x38')]['filter']){_0xdcc112['where']=_['merge'](_0xdcc112[_0x1596('0x41')],{'$or':_['map'](_0xdcc112[_0x1596('0x3c')],function(_0x4c3e46){var _0x1d7439={};_0x1d7439[_0x4c3e46]={'$like':'%'+_0x41e170[_0x1596('0x38')][_0x1596('0x44')]+'%'};return _0x1d7439;})});}_0xdcc112=_[_0x1596('0x42')]({},_0xdcc112,_0x41e170[_0x1596('0x45')]);return _0x52902b[_0x1596('0x85')](_0xdcc112);}})[_0x1596('0x27')](function(_0x79dd16){if(_0x79dd16){_0x16f3ff=_0x79dd16[_0x1596('0x3e')];if(!_0x41e170['query']['hasOwnProperty'](_0x1596('0x57'))){_0xdcc112[_0x1596('0x20')]=qs[_0x1596('0x20')](_0x41e170[_0x1596('0x38')][_0x1596('0x20')]);_0xdcc112['offset']=qs[_0x1596('0x1f')](_0x41e170[_0x1596('0x38')][_0x1596('0x1f')]);}return _0x52902b[_0x1596('0x85')](_0xdcc112);}})['then'](function(_0x653cc9){if(_0x653cc9){return _0x653cc9?{'count':_0x16f3ff,'rows':_0x653cc9}:null;}})[_0x1596('0x27')](respondWithResult(_0x51dff3,null))[_0x1596('0x49')](handleError(_0x51dff3,null));}; \ No newline at end of file +var _0xde49=['value','isEmpty','forEach','addAgents','omit','emit','removeAgents','userOpenchannelQueue:remove','getAgents','html-pdf','eml-format','fast-json-patch','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelQueue.socket','register','end','status','json','count','set','Content-Range','reject','update','then','get','OpenchannelQueues','UserProfileResource','destroy','sendStatus','name','send','map','OpenchannelQueue','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','catch','params','keys','model','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','all','union','compact'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0xde49,0x119));var _0x9de4=function(_0x1e68da,_0x28c012){_0x1e68da=_0x1e68da-0x0;var _0x2b845e=_0xde49[_0x1e68da];return _0x2b845e;};'use strict';var pdf=require(_0x9de4('0x0'));var emlformat=require(_0x9de4('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9de4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9de4('0x3'));var util=require(_0x9de4('0x4'));var path=require(_0x9de4('0x5'));var sox=require(_0x9de4('0x6'));var csv=require(_0x9de4('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9de4('0x8'));var squel=require(_0x9de4('0x9'));var crypto=require('crypto');var jsforce=require(_0x9de4('0xa'));var deskjs=require(_0x9de4('0xb'));var toCsv=require(_0x9de4('0x7'));var querystring=require(_0x9de4('0xc'));var Papa=require('papaparse');var Redis=require(_0x9de4('0xd'));var authService=require(_0x9de4('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9de4('0xf'));var utils=require('../../config/utils');var config=require(_0x9de4('0x10'));var db=require(_0x9de4('0x11'))['db'];config[_0x9de4('0x12')]=_[_0x9de4('0x13')](config[_0x9de4('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0x9de4('0x14'))(new Redis(config[_0x9de4('0x12')]));require(_0x9de4('0x15'))[_0x9de4('0x16')](socket);function respondWithStatusCode(_0x157a79,_0x19e7cc){_0x19e7cc=_0x19e7cc||0xcc;return function(_0x881ff6){if(_0x881ff6){return _0x157a79['sendStatus'](_0x19e7cc);}return _0x157a79['status'](_0x19e7cc)[_0x9de4('0x17')]();};}function respondWithResult(_0x338df5,_0x176683){_0x176683=_0x176683||0xc8;return function(_0x123b0d){if(_0x123b0d){return _0x338df5[_0x9de4('0x18')](_0x176683)[_0x9de4('0x19')](_0x123b0d);}};}function respondWithFilteredResult(_0x49d426,_0x43babe){return function(_0x112bc4){if(_0x112bc4){var _0x7f3167=_0x112bc4[_0x9de4('0x1a')],_0x1b16b6=_0x43babe['offset'],_0x154047=_0x43babe['offset']+_0x43babe['limit'],_0x593b8e;if(_0x154047>=_0x7f3167){_0x154047=_0x7f3167;_0x593b8e=0xc8;}else{_0x593b8e=0xce;}_0x49d426[_0x9de4('0x18')](_0x593b8e);return _0x49d426[_0x9de4('0x1b')](_0x9de4('0x1c'),_0x1b16b6+'-'+_0x154047+'/'+_0x7f3167)[_0x9de4('0x19')](_0x112bc4);}return null;};}function patchUpdates(_0x285983){return function(_0x451edb){try{jsonpatch['apply'](_0x451edb,_0x285983,!![]);}catch(_0x185134){return BPromise[_0x9de4('0x1d')](_0x185134);}return _0x451edb['save']();};}function saveUpdates(_0xd6a2d6,_0x6574b4){return function(_0x5efac1){if(_0x5efac1){return _0x5efac1[_0x9de4('0x1e')](_0xd6a2d6)[_0x9de4('0x1f')](function(_0x5f08ed){return _0x5f08ed;});}return null;};}function removeEntity(_0x2b507d,_0x2b4cfa){return function(_0x5ab7d8){if(_0x5ab7d8){return _0x5ab7d8['destroy']()[_0x9de4('0x1f')](function(){var _0x521c33=_0x5ab7d8[_0x9de4('0x20')]({'plain':!![]});var _0x3ec014=_0x9de4('0x21');return db[_0x9de4('0x22')][_0x9de4('0x23')]({'where':{'type':_0x3ec014,'resourceId':_0x521c33['id']}})[_0x9de4('0x1f')](function(){return _0x5ab7d8;});})[_0x9de4('0x1f')](function(){_0x2b507d[_0x9de4('0x18')](0xcc)[_0x9de4('0x17')]();});}};}function handleEntityNotFound(_0x163191,_0x265287){return function(_0x16a1b6){if(!_0x16a1b6){_0x163191[_0x9de4('0x24')](0x194);}return _0x16a1b6;};}function handleError(_0x14a335,_0x14f1a5){_0x14f1a5=_0x14f1a5||0x1f4;return function(_0x31cfed){logger['error'](_0x31cfed['stack']);if(_0x31cfed[_0x9de4('0x25')]){delete _0x31cfed[_0x9de4('0x25')];}_0x14a335[_0x9de4('0x18')](_0x14f1a5)[_0x9de4('0x26')](_0x31cfed);};}exports['index']=function(_0x4ed337,_0x3db2d2){var _0x3fc68a={},_0x64402={},_0x2c5eef={'count':0x0,'rows':[]};var _0x4e7800=_[_0x9de4('0x27')](db[_0x9de4('0x28')][_0x9de4('0x29')],function(_0x1ade13){return{'name':_0x1ade13[_0x9de4('0x2a')],'type':_0x1ade13[_0x9de4('0x2b')][_0x9de4('0x2c')]};});_0x64402['model']=_['map'](_0x4e7800,'name');_0x64402[_0x9de4('0x2d')]=_['keys'](_0x4ed337[_0x9de4('0x2d')]);_0x64402[_0x9de4('0x2e')]=_['intersection'](_0x64402['model'],_0x64402[_0x9de4('0x2d')]);_0x3fc68a[_0x9de4('0x2f')]=_[_0x9de4('0x30')](_0x64402['model'],qs[_0x9de4('0x31')](_0x4ed337[_0x9de4('0x2d')][_0x9de4('0x31')]));_0x3fc68a[_0x9de4('0x2f')]=_0x3fc68a['attributes'][_0x9de4('0x32')]?_0x3fc68a['attributes']:_0x64402['model'];if(!_0x4ed337['query'][_0x9de4('0x33')](_0x9de4('0x34'))){_0x3fc68a[_0x9de4('0x35')]=qs[_0x9de4('0x35')](_0x4ed337[_0x9de4('0x2d')][_0x9de4('0x35')]);_0x3fc68a[_0x9de4('0x36')]=qs[_0x9de4('0x36')](_0x4ed337[_0x9de4('0x2d')]['offset']);}_0x3fc68a[_0x9de4('0x37')]=qs[_0x9de4('0x38')](_0x4ed337[_0x9de4('0x2d')]['sort']);_0x3fc68a['where']=qs[_0x9de4('0x2e')](_[_0x9de4('0x39')](_0x4ed337[_0x9de4('0x2d')],_0x64402['filters']));if(_0x4ed337[_0x9de4('0x2d')][_0x9de4('0x3a')]){_0x3fc68a['where']=_[_0x9de4('0x3b')](_0x3fc68a[_0x9de4('0x3c')],{'$or':_['map'](_0x4e7800,function(_0x3a4019){if(_0x3a4019['type']!=='VIRTUAL'){var _0x6c1e0={};_0x6c1e0[_0x3a4019[_0x9de4('0x25')]]={'$like':'%'+_0x4ed337['query']['filter']+'%'};return _0x6c1e0;}})});}_0x3fc68a=_[_0x9de4('0x3b')]({},_0x3fc68a,_0x4ed337[_0x9de4('0x3d')]);var _0x24633a={'where':_0x3fc68a[_0x9de4('0x3c')]};return db['OpenchannelQueue']['count'](_0x24633a)['then'](function(_0x541782){_0x2c5eef['count']=_0x541782;if(_0x4ed337[_0x9de4('0x2d')][_0x9de4('0x3e')]){_0x3fc68a[_0x9de4('0x3f')]=[{'all':!![]}];}return db[_0x9de4('0x28')][_0x9de4('0x40')](_0x3fc68a);})['then'](function(_0x421ce9){_0x2c5eef[_0x9de4('0x41')]=_0x421ce9;return _0x2c5eef;})[_0x9de4('0x1f')](respondWithFilteredResult(_0x3db2d2,_0x3fc68a))[_0x9de4('0x42')](handleError(_0x3db2d2,null));};exports['show']=function(_0x116ede,_0x5c2d21){var _0x277c2c={'raw':!![],'where':{'id':_0x116ede[_0x9de4('0x43')]['id']}},_0x5757f1={};_0x5757f1['model']=_['keys'](db['OpenchannelQueue'][_0x9de4('0x29')]);_0x5757f1['query']=_[_0x9de4('0x44')](_0x116ede[_0x9de4('0x2d')]);_0x5757f1[_0x9de4('0x2e')]=_[_0x9de4('0x30')](_0x5757f1['model'],_0x5757f1[_0x9de4('0x2d')]);_0x277c2c[_0x9de4('0x2f')]=_[_0x9de4('0x30')](_0x5757f1[_0x9de4('0x45')],qs[_0x9de4('0x31')](_0x116ede[_0x9de4('0x2d')][_0x9de4('0x31')]));_0x277c2c['attributes']=_0x277c2c['attributes'][_0x9de4('0x32')]?_0x277c2c['attributes']:_0x5757f1['model'];if(_0x116ede[_0x9de4('0x2d')][_0x9de4('0x3e')]){_0x277c2c['include']=[{'all':!![]}];}_0x277c2c=_[_0x9de4('0x3b')]({},_0x277c2c,_0x116ede[_0x9de4('0x3d')]);return db[_0x9de4('0x28')]['find'](_0x277c2c)[_0x9de4('0x1f')](handleEntityNotFound(_0x5c2d21,null))[_0x9de4('0x1f')](respondWithResult(_0x5c2d21,null))[_0x9de4('0x42')](handleError(_0x5c2d21,null));};exports['create']=function(_0x150821,_0x46a79f){return db[_0x9de4('0x28')][_0x9de4('0x46')](_0x150821['body'],{})[_0x9de4('0x1f')](function(_0x5f2a59){var _0x5ce952=_0x150821[_0x9de4('0x47')][_0x9de4('0x20')]({'plain':!![]});if(!_0x5ce952)throw new Error(_0x9de4('0x48'));if(_0x5ce952[_0x9de4('0x49')]===_0x9de4('0x47')){var _0x4c5251=_0x5f2a59[_0x9de4('0x20')]({'plain':!![]});var _0x269bb0=_0x9de4('0x21');return db[_0x9de4('0x4a')][_0x9de4('0x4b')]({'where':{'name':_0x269bb0,'userProfileId':_0x5ce952[_0x9de4('0x4c')]},'raw':!![]})['then'](function(_0x2cc3e0){if(_0x2cc3e0&&_0x2cc3e0[_0x9de4('0x4d')]===0x0){return db[_0x9de4('0x22')][_0x9de4('0x46')]({'name':_0x4c5251[_0x9de4('0x25')],'resourceId':_0x4c5251['id'],'type':_0x2cc3e0[_0x9de4('0x25')],'sectionId':_0x2cc3e0['id']},{})[_0x9de4('0x1f')](function(){return _0x5f2a59;});}else{return _0x5f2a59;}})[_0x9de4('0x42')](function(_0x5429e8){logger[_0x9de4('0x4e')](_0x9de4('0x4f'),_0x5429e8);throw _0x5429e8;});}return _0x5f2a59;})[_0x9de4('0x1f')](respondWithResult(_0x46a79f,0xc9))['catch'](handleError(_0x46a79f,null));};exports[_0x9de4('0x1e')]=function(_0x1dcc49,_0x3453b9){if(_0x1dcc49[_0x9de4('0x50')]['id']){delete _0x1dcc49['body']['id'];}return db['OpenchannelQueue'][_0x9de4('0x4b')]({'where':{'id':_0x1dcc49[_0x9de4('0x43')]['id']}})['then'](handleEntityNotFound(_0x3453b9,null))[_0x9de4('0x1f')](saveUpdates(_0x1dcc49[_0x9de4('0x50')],null))[_0x9de4('0x1f')](respondWithResult(_0x3453b9,null))['catch'](handleError(_0x3453b9,null));};exports[_0x9de4('0x23')]=function(_0x277e7f,_0x5ee610){return db[_0x9de4('0x28')]['find']({'where':{'id':_0x277e7f[_0x9de4('0x43')]['id']}})['then'](handleEntityNotFound(_0x5ee610,null))[_0x9de4('0x1f')](removeEntity(_0x5ee610,null))[_0x9de4('0x42')](handleError(_0x5ee610,null));};exports['describe']=function(_0x9c8767,_0x37029c){return db[_0x9de4('0x28')][_0x9de4('0x51')]()[_0x9de4('0x1f')](respondWithResult(_0x37029c,null))['catch'](handleError(_0x37029c,null));};exports[_0x9de4('0x52')]=function(_0x1fbfaa,_0x21e155,_0x1d2378){var _0x48cea8={'raw':!![],'where':{}},_0x57a1a5={},_0x39d686;return db['OpenchannelQueue'][_0x9de4('0x53')]({'where':{'id':_0x1fbfaa['params']['id']}})[_0x9de4('0x1f')](handleEntityNotFound(_0x21e155,null))[_0x9de4('0x1f')](function(_0xcc76be){if(_0xcc76be){_0x39d686=_0xcc76be[_0x9de4('0x20')]({'plain':!![]});_0x57a1a5[_0x9de4('0x45')]=_[_0x9de4('0x44')](db[_0x9de4('0x54')]['rawAttributes']);_0x57a1a5['query']=_[_0x9de4('0x44')](_0x1fbfaa[_0x9de4('0x2d')]);_0x57a1a5[_0x9de4('0x2e')]=_[_0x9de4('0x30')](_0x57a1a5[_0x9de4('0x45')],_0x57a1a5[_0x9de4('0x2d')]);_0x48cea8[_0x9de4('0x2f')]=_['intersection'](_0x57a1a5[_0x9de4('0x45')],qs[_0x9de4('0x31')](_0x1fbfaa[_0x9de4('0x2d')][_0x9de4('0x31')]));_0x48cea8[_0x9de4('0x2f')]=_0x48cea8[_0x9de4('0x2f')][_0x9de4('0x32')]?_0x48cea8[_0x9de4('0x2f')]:_0x57a1a5[_0x9de4('0x45')];if(!_0x1fbfaa[_0x9de4('0x2d')][_0x9de4('0x33')](_0x9de4('0x34'))){_0x48cea8[_0x9de4('0x35')]=qs[_0x9de4('0x35')](_0x1fbfaa['query']['limit']);_0x48cea8['offset']=qs[_0x9de4('0x36')](_0x1fbfaa[_0x9de4('0x2d')][_0x9de4('0x36')]);}_0x48cea8['order']=qs[_0x9de4('0x38')](_0x1fbfaa[_0x9de4('0x2d')][_0x9de4('0x38')]);_0x48cea8[_0x9de4('0x3c')]=qs[_0x9de4('0x2e')](_[_0x9de4('0x39')](_0x1fbfaa[_0x9de4('0x2d')],_0x57a1a5['filters']));_0x48cea8['where'][_0x9de4('0x55')]=_0xcc76be['id'];if(_0x1fbfaa[_0x9de4('0x2d')][_0x9de4('0x3a')]){_0x48cea8[_0x9de4('0x3c')]=_[_0x9de4('0x3b')](_0x48cea8[_0x9de4('0x3c')],{'$or':_[_0x9de4('0x27')](_0x48cea8[_0x9de4('0x2f')],function(_0x5553fe){var _0x9477c2={};_0x9477c2[_0x5553fe]={'$like':'%'+_0x1fbfaa['query']['filter']+'%'};return _0x9477c2;})});}_0x48cea8=_[_0x9de4('0x3b')]({},_0x48cea8,_0x1fbfaa['options']);return db[_0x9de4('0x54')][_0x9de4('0x40')](_0x48cea8);}})[_0x9de4('0x1f')](function(_0x4babed){if(_0x4babed){return db[_0x9de4('0x56')][_0x9de4('0x57')]({'where':{'id':_['map'](_0x4babed,_0x9de4('0x58')),'role':_0x9de4('0x59')},'attributes':['id',_0x9de4('0x25'),_0x9de4('0x5a'),_0x9de4('0x5b'),'createdAt']});}})[_0x9de4('0x1f')](function(_0x5c1d74){if(_0x5c1d74){return{'count':_0x5c1d74['count'],'rows':_[_0x9de4('0x27')](_0x5c1d74['rows'],function(_0x23a6b1){return{'membername':_0x23a6b1[_0x9de4('0x25')],'UserId':_0x23a6b1['id'],'queue_name':_0x39d686[_0x9de4('0x25')],'OpenchannelQueueId':_0x39d686['id'],'interface':util[_0x9de4('0x5c')](_0x9de4('0x5d'),_0x9de4('0x5e'),_0x23a6b1[_0x9de4('0x25')]),'penalty':0x0,'paused':_0x23a6b1['openchannelPause'],'createdAt':_0x23a6b1[_0x9de4('0x5f')],'updatedAt':_0x23a6b1[_0x9de4('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9de4('0x1f')](respondWithFilteredResult(_0x21e155,_0x48cea8))['catch'](handleError(_0x21e155,null));};exports[_0x9de4('0x60')]=function(_0x569d55,_0x3718d4,_0x4d614e){var _0x40edef={};var _0x1c33ea={};var _0x17a884;var _0x6bb1e2;return db[_0x9de4('0x28')][_0x9de4('0x53')]({'where':{'id':_0x569d55['params']['id']}})['then'](handleEntityNotFound(_0x3718d4,null))[_0x9de4('0x1f')](function(_0x156c73){if(_0x156c73){_0x17a884=_0x156c73;_0x1c33ea['model']=_['keys'](db[_0x9de4('0x61')][_0x9de4('0x29')]);_0x1c33ea[_0x9de4('0x2d')]=_['keys'](_0x569d55['query']);_0x1c33ea['filters']=_[_0x9de4('0x30')](_0x1c33ea[_0x9de4('0x45')],_0x1c33ea['query']);_0x40edef[_0x9de4('0x2f')]=_[_0x9de4('0x30')](_0x1c33ea['model'],qs[_0x9de4('0x31')](_0x569d55['query'][_0x9de4('0x31')]));_0x40edef[_0x9de4('0x2f')]=_0x40edef[_0x9de4('0x2f')][_0x9de4('0x32')]?_0x40edef[_0x9de4('0x2f')]:_0x1c33ea['model'];_0x40edef[_0x9de4('0x37')]=qs[_0x9de4('0x38')](_0x569d55[_0x9de4('0x2d')][_0x9de4('0x38')]);_0x40edef[_0x9de4('0x3c')]=qs[_0x9de4('0x2e')](_['pick'](_0x569d55[_0x9de4('0x2d')],_0x1c33ea[_0x9de4('0x2e')]));if(_0x569d55['query'][_0x9de4('0x3a')]){_0x40edef['where']=_[_0x9de4('0x3b')](_0x40edef['where'],{'$or':_[_0x9de4('0x27')](_0x40edef[_0x9de4('0x2f')],function(_0x3e6aa1){var _0x9b4eb3={};_0x9b4eb3[_0x3e6aa1]={'$like':'%'+_0x569d55[_0x9de4('0x2d')][_0x9de4('0x3a')]+'%'};return _0x9b4eb3;})});}_0x40edef=_[_0x9de4('0x3b')]({},_0x40edef,_0x569d55['options']);return _0x17a884['getTeams'](_0x40edef);}})['then'](function(_0x5d3669){if(_0x5d3669){_0x6bb1e2=_0x5d3669['length'];if(!_0x569d55[_0x9de4('0x2d')][_0x9de4('0x33')]('nolimit')){_0x40edef[_0x9de4('0x35')]=qs[_0x9de4('0x35')](_0x569d55[_0x9de4('0x2d')][_0x9de4('0x35')]);_0x40edef[_0x9de4('0x36')]=qs[_0x9de4('0x36')](_0x569d55[_0x9de4('0x2d')]['offset']);}return _0x17a884[_0x9de4('0x60')](_0x40edef);}})[_0x9de4('0x1f')](function(_0x2453c4){if(_0x2453c4){return _0x2453c4?{'count':_0x6bb1e2,'rows':_0x2453c4}:null;}})[_0x9de4('0x1f')](respondWithResult(_0x3718d4,null))[_0x9de4('0x42')](handleError(_0x3718d4,null));};exports[_0x9de4('0x62')]=function(_0x491b91,_0x357883,_0x5322d0){var _0x2ffc57=_0x491b91[_0x9de4('0x50')][_0x9de4('0x63')];return db[_0x9de4('0x61')][_0x9de4('0x40')]({'where':{'id':_0x2ffc57},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9de4('0x64'),'attributes':['id',_0x9de4('0x25'),_0x9de4('0x65'),'voicePause',_0x9de4('0x66')],'raw':!![]}]})[_0x9de4('0x1f')](function(_0x3f46fd){if(_0x3f46fd){var _0x96d766=_[_0x9de4('0x67')](_0x3f46fd,function(_0x17d824){var _0x414b46=_0x17d824[_0x9de4('0x20')]({'plain':!![]});return _0x414b46[_0x9de4('0x64')];});return db[_0x9de4('0x28')][_0x9de4('0x4b')]({'where':{'id':_0x491b91['params']['id']}})[_0x9de4('0x1f')](function(_0x408d3e){return db[_0x9de4('0x68')][_0x9de4('0x69')](function(_0x209d10){return _0x408d3e[_0x9de4('0x62')](_0x2ffc57,{'transaction':_0x209d10})[_0x9de4('0x1f')](function(){return BPromise[_0x9de4('0x6a')](_0x96d766,function(_0x5a6cd0){return db['UserOpenchannelQueue'][_0x9de4('0x6b')]({'where':{'UserId':_0x5a6cd0['id'],'OpenchannelQueueId':_0x491b91['params']['id']},'transaction':_0x209d10});});})['then'](function(){_0x96d766['forEach'](function(_0x91b74c){socket['emit'](_0x9de4('0x6c'),{'UserId':_0x91b74c['id'],'OpenchannelQueueId':_0x408d3e['id']});});});});});}})[_0x9de4('0x1f')](respondWithStatusCode(_0x357883,null))[_0x9de4('0x42')](handleError(_0x357883,null));};exports[_0x9de4('0x6d')]=function(_0x3e5047,_0x5cd6f7,_0x58ca45){return db[_0x9de4('0x61')]['findAll']({'where':{'id':_0x3e5047['query'][_0x9de4('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9de4('0x64'),'attributes':['id'],'raw':!![]}]})[_0x9de4('0x1f')](handleEntityNotFound(_0x5cd6f7,null))[_0x9de4('0x1f')](function(_0x4e06df){var _0xb4afed=_[_0x9de4('0x27')](_0x4e06df,'id');var _0x1ba9e1=[];var _0x5442fc=[];var _0x2e3a70=squel[_0x9de4('0x6e')]();_0x2e3a70[_0x9de4('0x6f')](_0x9de4('0x70'))[_0x9de4('0x71')](_0x9de4('0x72'),'tq')[_0x9de4('0x73')](_0x9de4('0x74'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9de4('0x3c')](_0x9de4('0x75'),_0x3e5047[_0x9de4('0x43')]['id']);for(var _0x34c8a0=0x0;_0x34c8a0<_0x4e06df[_0x9de4('0x32')];_0x34c8a0+=0x1){let _0x29c345=_0x4e06df[_0x34c8a0];for(var _0x150750=0x0;_0x150750<_0x29c345['Agents']['length'];_0x150750+=0x1){let _0x40c1cc=_0x29c345['Agents'][_0x150750];var _0x473d13=_0x2e3a70[_0x9de4('0x76')]();_0x473d13[_0x9de4('0x3c')]('ut.UserId\x20=\x20?',_0x40c1cc['id']);_0x5442fc[_0x9de4('0x77')](db['sequelize']['query'](_0x473d13['toString'](),{'type':db[_0x9de4('0x68')][_0x9de4('0x78')][_0x9de4('0x79')]})['then'](function(_0x4737bd){if(_0x4737bd[_0x9de4('0x32')]===0x1){return _0x40c1cc['id'];}else{var _0x10c930=_[_0x9de4('0x7a')](_[_0x9de4('0x27')](_0x4737bd,_0x9de4('0x7b')),function(_0x4c3f28){return _['includes'](_0xb4afed,_0x4c3f28);});if(_0x10c930){return _0x40c1cc['id'];}}}));}}return BPromise[_0x9de4('0x7c')](_0x5442fc)[_0x9de4('0x1f')](function(_0xaf27c3){_0x1ba9e1=_(_0x1ba9e1)[_0x9de4('0x7d')](_0xaf27c3)[_0x9de4('0x7e')]()[_0x9de4('0x7f')]();return db[_0x9de4('0x28')][_0x9de4('0x4b')]({'where':{'id':_0x3e5047[_0x9de4('0x43')]['id']}})[_0x9de4('0x1f')](function(_0x51ae10){return db[_0x9de4('0x68')][_0x9de4('0x69')](function(_0x2a7d75){return _0x51ae10[_0x9de4('0x6d')](_0x3e5047[_0x9de4('0x2d')][_0x9de4('0x63')],{'transaction':_0x2a7d75})[_0x9de4('0x1f')](function(){if(!_[_0x9de4('0x80')](_0x1ba9e1)){return _0x51ae10['removeAgents'](_0x1ba9e1,{'transaction':_0x2a7d75});}})['then'](function(){_0x1ba9e1[_0x9de4('0x81')](function(_0x1fa1f3){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x1fa1f3,'OpenchannelQueueId':_0x51ae10['id']});});});});});});})['then'](respondWithStatusCode(_0x5cd6f7,null))[_0x9de4('0x42')](handleError(_0x5cd6f7,null));};exports[_0x9de4('0x82')]=function(_0x1aa74b,_0x3baf4e,_0x5f37e7){return db[_0x9de4('0x28')][_0x9de4('0x4b')]({'where':{'id':_0x1aa74b[_0x9de4('0x43')]['id']}})[_0x9de4('0x1f')](handleEntityNotFound(_0x3baf4e,null))[_0x9de4('0x1f')](function(_0x1d4584){if(_0x1d4584){return _0x1d4584[_0x9de4('0x82')](_0x1aa74b[_0x9de4('0x50')][_0x9de4('0x63')],_[_0x9de4('0x83')](_0x1aa74b[_0x9de4('0x50')],['ids','id'])||{})['spread'](function(_0x13460e){for(var _0x56663f=0x0;_0x56663f<_0x1aa74b['body'][_0x9de4('0x63')][_0x9de4('0x32')];_0x56663f+=0x1){socket[_0x9de4('0x84')](_0x9de4('0x6c'),{'UserId':_0x1aa74b[_0x9de4('0x50')][_0x9de4('0x63')][_0x56663f],'OpenchannelQueueId':_0x1aa74b[_0x9de4('0x43')]['id']});}return _0x13460e;});}})[_0x9de4('0x1f')](respondWithResult(_0x3baf4e,null))['catch'](handleError(_0x3baf4e,null));};exports[_0x9de4('0x85')]=function(_0x3fd98a,_0x116c9c,_0x1ba27c){return db[_0x9de4('0x28')][_0x9de4('0x4b')]({'where':{'id':_0x3fd98a[_0x9de4('0x43')]['id']}})[_0x9de4('0x1f')](handleEntityNotFound(_0x116c9c,null))[_0x9de4('0x1f')](function(_0x459bfc){if(_0x459bfc){return _0x459bfc['removeAgents'](_0x3fd98a[_0x9de4('0x2d')][_0x9de4('0x63')])[_0x9de4('0x1f')](function(){if(_['isArray'](_0x3fd98a[_0x9de4('0x2d')][_0x9de4('0x63')])){for(var _0x3c97d4=0x0;_0x3c97d4<_0x3fd98a[_0x9de4('0x2d')][_0x9de4('0x63')]['length'];_0x3c97d4+=0x1){socket['emit'](_0x9de4('0x86'),{'UserId':Number(_0x3fd98a[_0x9de4('0x2d')][_0x9de4('0x63')][_0x3c97d4]),'OpenchannelQueueId':Number(_0x3fd98a[_0x9de4('0x43')]['id'])});}}else{socket[_0x9de4('0x84')]('userOpenchannelQueue:remove',{'UserId':Number(_0x3fd98a[_0x9de4('0x2d')]['ids']),'OpenchannelQueueId':Number(_0x3fd98a[_0x9de4('0x43')]['id'])});}});}})[_0x9de4('0x1f')](respondWithStatusCode(_0x116c9c,null))['catch'](handleError(_0x116c9c,null));};exports[_0x9de4('0x87')]=function(_0xc29e5d,_0x132fae,_0x59ad38){var _0x2dd99f={};var _0x5ea042={};var _0x2dca51;var _0x5ddea7;return db['OpenchannelQueue'][_0x9de4('0x53')]({'where':{'id':_0xc29e5d[_0x9de4('0x43')]['id']}})[_0x9de4('0x1f')](handleEntityNotFound(_0x132fae,null))['then'](function(_0x33dc3c){if(_0x33dc3c){_0x2dca51=_0x33dc3c;_0x5ea042['model']=_[_0x9de4('0x44')](db[_0x9de4('0x56')][_0x9de4('0x29')]);_0x5ea042[_0x9de4('0x2d')]=_[_0x9de4('0x44')](_0xc29e5d[_0x9de4('0x2d')]);_0x5ea042[_0x9de4('0x2e')]=_[_0x9de4('0x30')](_0x5ea042[_0x9de4('0x45')],_0x5ea042[_0x9de4('0x2d')]);_0x2dd99f[_0x9de4('0x2f')]=_[_0x9de4('0x30')](_0x5ea042['model'],qs['fields'](_0xc29e5d[_0x9de4('0x2d')]['fields']));_0x2dd99f[_0x9de4('0x2f')]=_0x2dd99f['attributes'][_0x9de4('0x32')]?_0x2dd99f['attributes']:_0x5ea042[_0x9de4('0x45')];_0x2dd99f[_0x9de4('0x37')]=qs[_0x9de4('0x38')](_0xc29e5d[_0x9de4('0x2d')][_0x9de4('0x38')]);_0x2dd99f[_0x9de4('0x3c')]=qs[_0x9de4('0x2e')](_[_0x9de4('0x39')](_0xc29e5d[_0x9de4('0x2d')],_0x5ea042[_0x9de4('0x2e')]));if(_0xc29e5d['query']['filter']){_0x2dd99f[_0x9de4('0x3c')]=_['merge'](_0x2dd99f[_0x9de4('0x3c')],{'$or':_[_0x9de4('0x27')](_0x2dd99f[_0x9de4('0x2f')],function(_0x1a2891){var _0x338961={};_0x338961[_0x1a2891]={'$like':'%'+_0xc29e5d[_0x9de4('0x2d')][_0x9de4('0x3a')]+'%'};return _0x338961;})});}_0x2dd99f=_[_0x9de4('0x3b')]({},_0x2dd99f,_0xc29e5d[_0x9de4('0x3d')]);return _0x2dca51['getAgents'](_0x2dd99f);}})[_0x9de4('0x1f')](function(_0x5c2e8f){if(_0x5c2e8f){_0x5ddea7=_0x5c2e8f[_0x9de4('0x32')];if(!_0xc29e5d['query']['hasOwnProperty'](_0x9de4('0x34'))){_0x2dd99f[_0x9de4('0x35')]=qs[_0x9de4('0x35')](_0xc29e5d[_0x9de4('0x2d')][_0x9de4('0x35')]);_0x2dd99f[_0x9de4('0x36')]=qs['offset'](_0xc29e5d[_0x9de4('0x2d')][_0x9de4('0x36')]);}return _0x2dca51[_0x9de4('0x87')](_0x2dd99f);}})[_0x9de4('0x1f')](function(_0x5c619f){if(_0x5c619f){return _0x5c619f?{'count':_0x5ddea7,'rows':_0x5c619f}:null;}})[_0x9de4('0x1f')](respondWithResult(_0x132fae,null))[_0x9de4('0x42')](handleError(_0x132fae,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8916ac9..f512cee 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 _0xeef9=['../../mysqldb','OpenchannelQueue','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x45a6ef,_0x4e9b9e){var _0x3867e6=function(_0x344add){while(--_0x344add){_0x45a6ef['push'](_0x45a6ef['shift']());}};_0x3867e6(++_0x4e9b9e);}(_0xeef9,0x7f));var _0x9eef=function(_0x50e545,_0x342948){_0x50e545=_0x50e545-0x0;var _0x181af8=_0xeef9[_0x50e545];return _0x181af8;};'use strict';var EventEmitter=require(_0x9eef('0x0'));var OpenchannelQueue=require(_0x9eef('0x1'))['db'][_0x9eef('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9eef('0x3'),'afterDestroy':_0x9eef('0x4')};function emitEvent(_0x289960){return function(_0x3aaa7c,_0xb32f07,_0x9a49e6){OpenchannelQueueEvents['emit'](_0x289960+':'+_0x3aaa7c['id'],_0x3aaa7c);OpenchannelQueueEvents[_0x9eef('0x5')](_0x289960,_0x3aaa7c);_0x9a49e6(null);};}for(var e in events){if(events[_0x9eef('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x9eef('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x988b=['exports','events','../../mysqldb','setMaxListeners','save','hasOwnProperty','hook'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0x988b,0x14a));var _0xb988=function(_0x5a2424,_0x33d683){_0x5a2424=_0x5a2424-0x0;var _0x449398=_0x988b[_0x5a2424];return _0x449398;};'use strict';var EventEmitter=require(_0xb988('0x0'));var OpenchannelQueue=require(_0xb988('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb988('0x2')](0x0);var events={'afterCreate':_0xb988('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xb32997){return function(_0x54c037,_0xde92f6,_0x1fbc89){OpenchannelQueueEvents['emit'](_0xb32997+':'+_0x54c037['id'],_0x54c037);OpenchannelQueueEvents['emit'](_0xb32997,_0x54c037);_0x1fbc89(null);};}for(var e in events){if(events[_0xb988('0x4')](e)){var event=events[e];OpenchannelQueue[_0xb988('0x5')](e,emitEvent(event));}}module[_0xb988('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 90c6a76..c386dc9 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 _0x0f0a=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues'];(function(_0x125a77,_0x5ca9a9){var _0x303b64=function(_0x8ae0e0){while(--_0x8ae0e0){_0x125a77['push'](_0x125a77['shift']());}};_0x303b64(++_0x5ca9a9);}(_0x0f0a,0x6c));var _0xa0f0=function(_0x507188,_0x5b0cac){_0x507188=_0x507188-0x0;var _0x597cda=_0x0f0a[_0x507188];return _0x597cda;};'use strict';var _=require(_0xa0f0('0x0'));var util=require(_0xa0f0('0x1'));var logger=require(_0xa0f0('0x2'))(_0xa0f0('0x3'));var moment=require('moment');var BPromise=require(_0xa0f0('0x4'));var rp=require(_0xa0f0('0x5'));var fs=require('fs');var path=require(_0xa0f0('0x6'));var rimraf=require('rimraf');var config=require(_0xa0f0('0x7'));var attributes=require(_0xa0f0('0x8'));module[_0xa0f0('0x9')]=function(_0x475050,_0x434e69){return _0x475050[_0xa0f0('0xa')]('OpenchannelQueue',attributes,{'tableName':_0xa0f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57b2=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define','openchannel_queues','lodash','util'];(function(_0x4d5787,_0x1f1e69){var _0x2eb57b=function(_0x272f00){while(--_0x272f00){_0x4d5787['push'](_0x4d5787['shift']());}};_0x2eb57b(++_0x1f1e69);}(_0x57b2,0xda));var _0x257b=function(_0x50564e,_0x10299f){_0x50564e=_0x50564e-0x0;var _0x54550b=_0x57b2[_0x50564e];return _0x54550b;};'use strict';var _=require(_0x257b('0x0'));var util=require(_0x257b('0x1'));var logger=require(_0x257b('0x2'))(_0x257b('0x3'));var moment=require(_0x257b('0x4'));var BPromise=require(_0x257b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x257b('0x6'));var rimraf=require(_0x257b('0x7'));var config=require(_0x257b('0x8'));var attributes=require('./openchannelQueue.attributes');module['exports']=function(_0x49c567,_0x561728){return _0x49c567[_0x257b('0x9')]('OpenchannelQueue',attributes,{'tableName':_0x257b('0xa'),'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 cbf7911..d0da931 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 _0x29d0=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowOpenchannelQueue','lodash','util','moment','bluebird','randomstring'];(function(_0x4a0d90,_0x1440d7){var _0x4074ef=function(_0x43049c){while(--_0x43049c){_0x4a0d90['push'](_0x4a0d90['shift']());}};_0x4074ef(++_0x1440d7);}(_0x29d0,0x82));var _0x029d=function(_0x8f3e8f,_0xf5e227){_0x8f3e8f=_0x8f3e8f-0x0;var _0x48b7bc=_0x29d0[_0x8f3e8f];return _0x48b7bc;};'use strict';var _=require(_0x029d('0x0'));var util=require(_0x029d('0x1'));var moment=require(_0x029d('0x2'));var BPromise=require(_0x029d('0x3'));var rs=require(_0x029d('0x4'));var fs=require('fs');var Redis=require(_0x029d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x029d('0x6'));var logger=require(_0x029d('0x7'))(_0x029d('0x8'));var config=require(_0x029d('0x9'));var jayson=require(_0x029d('0xa'));var client=jayson[_0x029d('0xb')][_0x029d('0xc')]({'port':0x232a});config[_0x029d('0xd')]=_[_0x029d('0xe')](config[_0x029d('0xd')],{'host':_0x029d('0xf'),'port':0x18eb});var socket=require(_0x029d('0x10'))(new Redis(config[_0x029d('0xd')]));require(_0x029d('0x11'))[_0x029d('0x12')](socket);function respondWithRpcPromise(_0x384534,_0x4725ac,_0x545890){return new BPromise(function(_0x197706,_0x1aca1a){return client[_0x029d('0x13')](_0x384534,_0x545890)['then'](function(_0x1b0b2e){logger['info'](_0x029d('0x14'),_0x4725ac,_0x029d('0x15'));logger[_0x029d('0x16')](_0x029d('0x17'),_0x4725ac,_0x029d('0x15'),JSON[_0x029d('0x18')](_0x1b0b2e));if(_0x1b0b2e['error']){if(_0x1b0b2e[_0x029d('0x19')][_0x029d('0x1a')]===0x1f4){logger['error'](_0x029d('0x14'),_0x4725ac,_0x1b0b2e['error'][_0x029d('0x1b')]);return _0x1aca1a(_0x1b0b2e[_0x029d('0x19')][_0x029d('0x1b')]);}logger[_0x029d('0x19')](_0x029d('0x14'),_0x4725ac,_0x1b0b2e[_0x029d('0x19')]['message']);return _0x197706(_0x1b0b2e[_0x029d('0x19')][_0x029d('0x1b')]);}else{logger[_0x029d('0x1c')](_0x029d('0x14'),_0x4725ac,'request\x20sent');_0x197706(_0x1b0b2e[_0x029d('0x1d')][_0x029d('0x1b')]);}})[_0x029d('0x1e')](function(_0x25c081){logger[_0x029d('0x19')](_0x029d('0x14'),_0x4725ac,_0x25c081);_0x1aca1a(_0x25c081);});});}exports[_0x029d('0x1f')]=function(_0x1688f4){var _0xeff588=this;return new Promise(function(_0x3ed2f4,_0x420125){return db[_0x029d('0x20')][_0x029d('0x21')]({'raw':_0x1688f4[_0x029d('0x22')]?_0x1688f4[_0x029d('0x22')][_0x029d('0x23')]===undefined?!![]:![]:!![],'where':_0x1688f4[_0x029d('0x22')]?_0x1688f4[_0x029d('0x22')][_0x029d('0x24')]||null:null,'attributes':_0x1688f4['options']?_0x1688f4[_0x029d('0x22')][_0x029d('0x25')]||null:null,'limit':_0x1688f4[_0x029d('0x22')]?_0x1688f4[_0x029d('0x22')][_0x029d('0x26')]||null:null,'include':_0x1688f4[_0x029d('0x22')]?_0x1688f4[_0x029d('0x22')][_0x029d('0x27')]?_[_0x029d('0x28')](_0x1688f4['options']['include'],function(_0x2abec9){return{'model':db[_0x2abec9['model']],'as':_0x2abec9['as'],'attributes':_0x2abec9[_0x029d('0x25')],'include':_0x2abec9[_0x029d('0x27')]?_[_0x029d('0x28')](_0x2abec9[_0x029d('0x27')],function(_0x4176e5){return{'model':db[_0x4176e5['model']],'as':_0x4176e5['as'],'attributes':_0x4176e5[_0x029d('0x25')],'include':_0x4176e5[_0x029d('0x27')]?_[_0x029d('0x28')](_0x4176e5[_0x029d('0x27')],function(_0x1055b2){return{'model':db[_0x1055b2[_0x029d('0x29')]],'as':_0x1055b2['as'],'attributes':_0x1055b2[_0x029d('0x25')]};}):[]};}):[]};}):[]:[]})[_0x029d('0x2a')](function(_0x45250){logger[_0x029d('0x1c')](_0x029d('0x1f'),_0x1688f4);logger[_0x029d('0x16')](_0x029d('0x1f'),_0x1688f4,JSON[_0x029d('0x18')](_0x45250));_0x3ed2f4(_0x45250);})['catch'](function(_0x334a7e){logger[_0x029d('0x19')]('GetOpenchannelQueue',_0x334a7e[_0x029d('0x1b')],_0x1688f4);_0x420125(_0xeff588['error'](0x1f4,_0x334a7e['message']));});});};exports['ShowOpenchannelQueue']=function(_0x1ff1e0){var _0x1363cd=this;return new Promise(function(_0x4ef667,_0x174fed){return db[_0x029d('0x20')][_0x029d('0x2b')]({'raw':_0x1ff1e0['options']?_0x1ff1e0['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ff1e0[_0x029d('0x22')]?_0x1ff1e0[_0x029d('0x22')][_0x029d('0x24')]||null:null,'attributes':_0x1ff1e0[_0x029d('0x22')]?_0x1ff1e0[_0x029d('0x22')][_0x029d('0x25')]||null:null,'include':_0x1ff1e0[_0x029d('0x22')]?_0x1ff1e0['options']['include']?_['map'](_0x1ff1e0[_0x029d('0x22')][_0x029d('0x27')],function(_0x3c4b66){return{'model':db[_0x3c4b66[_0x029d('0x29')]],'as':_0x3c4b66['as'],'attributes':_0x3c4b66[_0x029d('0x25')],'include':_0x3c4b66[_0x029d('0x27')]?_[_0x029d('0x28')](_0x3c4b66['include'],function(_0x433210){return{'model':db[_0x433210[_0x029d('0x29')]],'as':_0x433210['as'],'attributes':_0x433210['attributes'],'include':_0x433210[_0x029d('0x27')]?_[_0x029d('0x28')](_0x433210[_0x029d('0x27')],function(_0x169a42){return{'model':db[_0x169a42[_0x029d('0x29')]],'as':_0x169a42['as'],'attributes':_0x169a42[_0x029d('0x25')]};}):[]};}):[]};}):[]:[]})[_0x029d('0x2a')](function(_0x183dec){logger['info'](_0x029d('0x2c'),_0x1ff1e0);logger['debug'](_0x029d('0x2c'),_0x1ff1e0,JSON['stringify'](_0x183dec));_0x4ef667(_0x183dec);})['catch'](function(_0x548b31){logger[_0x029d('0x19')](_0x029d('0x2c'),_0x548b31[_0x029d('0x1b')],_0x1ff1e0);_0x174fed(_0x1363cd[_0x029d('0x19')](0x1f4,_0x548b31['message']));});});}; \ No newline at end of file +var _0xa1eb=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','where','limit','include','map','model','attributes','ShowOpenchannelQueue','raw','lodash','util','bluebird','randomstring'];(function(_0x3893b8,_0xa8b6f6){var _0x48421e=function(_0x341bef){while(--_0x341bef){_0x3893b8['push'](_0x3893b8['shift']());}};_0x48421e(++_0xa8b6f6);}(_0xa1eb,0x134));var _0xba1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1eb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xba1e('0x0'));var util=require(_0xba1e('0x1'));var moment=require('moment');var BPromise=require(_0xba1e('0x2'));var rs=require(_0xba1e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xba1e('0x4'))['db'];var utils=require(_0xba1e('0x5'));var logger=require(_0xba1e('0x6'))(_0xba1e('0x7'));var config=require(_0xba1e('0x8'));var jayson=require(_0xba1e('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xba1e('0xa')]=_[_0xba1e('0xb')](config[_0xba1e('0xa')],{'host':_0xba1e('0xc'),'port':0x18eb});var socket=require(_0xba1e('0xd'))(new Redis(config[_0xba1e('0xa')]));require(_0xba1e('0xe'))[_0xba1e('0xf')](socket);function respondWithRpcPromise(_0x40dce7,_0x5189bb,_0x13fbc8){return new BPromise(function(_0x2bbbd4,_0x526ff9){return client['request'](_0x40dce7,_0x13fbc8)[_0xba1e('0x10')](function(_0x1ece36){logger['info'](_0xba1e('0x11'),_0x5189bb,'request\x20sent');logger[_0xba1e('0x12')](_0xba1e('0x13'),_0x5189bb,_0xba1e('0x14'),JSON[_0xba1e('0x15')](_0x1ece36));if(_0x1ece36[_0xba1e('0x16')]){if(_0x1ece36[_0xba1e('0x16')][_0xba1e('0x17')]===0x1f4){logger[_0xba1e('0x16')](_0xba1e('0x11'),_0x5189bb,_0x1ece36[_0xba1e('0x16')][_0xba1e('0x18')]);return _0x526ff9(_0x1ece36['error']['message']);}logger['error'](_0xba1e('0x11'),_0x5189bb,_0x1ece36[_0xba1e('0x16')][_0xba1e('0x18')]);return _0x2bbbd4(_0x1ece36[_0xba1e('0x16')][_0xba1e('0x18')]);}else{logger[_0xba1e('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x5189bb,_0xba1e('0x14'));_0x2bbbd4(_0x1ece36[_0xba1e('0x1a')]['message']);}})[_0xba1e('0x1b')](function(_0xd6cfd0){logger[_0xba1e('0x16')](_0xba1e('0x11'),_0x5189bb,_0xd6cfd0);_0x526ff9(_0xd6cfd0);});});}exports[_0xba1e('0x1c')]=function(_0x5394b3){var _0x132cf2=this;return new Promise(function(_0x2bf46e,_0x5d7358){return db[_0xba1e('0x1d')]['findAll']({'raw':_0x5394b3['options']?_0x5394b3[_0xba1e('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5394b3[_0xba1e('0x1e')]?_0x5394b3['options'][_0xba1e('0x1f')]||null:null,'attributes':_0x5394b3[_0xba1e('0x1e')]?_0x5394b3['options']['attributes']||null:null,'limit':_0x5394b3[_0xba1e('0x1e')]?_0x5394b3[_0xba1e('0x1e')][_0xba1e('0x20')]||null:null,'include':_0x5394b3['options']?_0x5394b3[_0xba1e('0x1e')][_0xba1e('0x21')]?_[_0xba1e('0x22')](_0x5394b3[_0xba1e('0x1e')][_0xba1e('0x21')],function(_0x4a014c){return{'model':db[_0x4a014c[_0xba1e('0x23')]],'as':_0x4a014c['as'],'attributes':_0x4a014c[_0xba1e('0x24')],'include':_0x4a014c['include']?_['map'](_0x4a014c[_0xba1e('0x21')],function(_0x587521){return{'model':db[_0x587521['model']],'as':_0x587521['as'],'attributes':_0x587521[_0xba1e('0x24')],'include':_0x587521[_0xba1e('0x21')]?_[_0xba1e('0x22')](_0x587521[_0xba1e('0x21')],function(_0x36b175){return{'model':db[_0x36b175[_0xba1e('0x23')]],'as':_0x36b175['as'],'attributes':_0x36b175[_0xba1e('0x24')]};}):[]};}):[]};}):[]:[]})[_0xba1e('0x10')](function(_0x3066ca){logger[_0xba1e('0x19')](_0xba1e('0x1c'),_0x5394b3);logger[_0xba1e('0x12')]('GetOpenchannelQueue',_0x5394b3,JSON[_0xba1e('0x15')](_0x3066ca));_0x2bf46e(_0x3066ca);})['catch'](function(_0x2a177b){logger[_0xba1e('0x16')]('GetOpenchannelQueue',_0x2a177b[_0xba1e('0x18')],_0x5394b3);_0x5d7358(_0x132cf2['error'](0x1f4,_0x2a177b[_0xba1e('0x18')]));});});};exports[_0xba1e('0x25')]=function(_0x3e9344){var _0x5f565f=this;return new Promise(function(_0x3e2711,_0x584c8d){return db[_0xba1e('0x1d')]['find']({'raw':_0x3e9344['options']?_0x3e9344[_0xba1e('0x1e')][_0xba1e('0x26')]===undefined?!![]:![]:!![],'where':_0x3e9344[_0xba1e('0x1e')]?_0x3e9344[_0xba1e('0x1e')]['where']||null:null,'attributes':_0x3e9344[_0xba1e('0x1e')]?_0x3e9344[_0xba1e('0x1e')][_0xba1e('0x24')]||null:null,'include':_0x3e9344[_0xba1e('0x1e')]?_0x3e9344[_0xba1e('0x1e')]['include']?_['map'](_0x3e9344[_0xba1e('0x1e')][_0xba1e('0x21')],function(_0xf1b8b8){return{'model':db[_0xf1b8b8[_0xba1e('0x23')]],'as':_0xf1b8b8['as'],'attributes':_0xf1b8b8[_0xba1e('0x24')],'include':_0xf1b8b8[_0xba1e('0x21')]?_[_0xba1e('0x22')](_0xf1b8b8[_0xba1e('0x21')],function(_0x3cbcea){return{'model':db[_0x3cbcea[_0xba1e('0x23')]],'as':_0x3cbcea['as'],'attributes':_0x3cbcea['attributes'],'include':_0x3cbcea['include']?_['map'](_0x3cbcea[_0xba1e('0x21')],function(_0x299eed){return{'model':db[_0x299eed[_0xba1e('0x23')]],'as':_0x299eed['as'],'attributes':_0x299eed[_0xba1e('0x24')]};}):[]};}):[]};}):[]:[]})[_0xba1e('0x10')](function(_0x50367b){logger[_0xba1e('0x19')](_0xba1e('0x25'),_0x3e9344);logger[_0xba1e('0x12')](_0xba1e('0x25'),_0x3e9344,JSON[_0xba1e('0x15')](_0x50367b));_0x3e2711(_0x50367b);})[_0xba1e('0x1b')](function(_0x1b70c7){logger['error']('ShowOpenchannelQueue',_0x1b70c7[_0xba1e('0x18')],_0x3e9344);_0x584c8d(_0x5f565f[_0xba1e('0x16')](0x1f4,_0x1b70c7[_0xba1e('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 14e5788..8eed2f3 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 _0x994b=['register','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','removeListener'];(function(_0xe391c1,_0x27eaef){var _0x558743=function(_0x5d638a){while(--_0x5d638a){_0xe391c1['push'](_0xe391c1['shift']());}};_0x558743(++_0x27eaef);}(_0x994b,0x12a));var _0xb994=function(_0x5b58ba,_0x16159f){_0x5b58ba=_0x5b58ba-0x0;var _0xc67099=_0x994b[_0x5b58ba];return _0xc67099;};'use strict';var OpenchannelQueueEvents=require(_0xb994('0x0'));var events=[_0xb994('0x1'),_0xb994('0x2'),_0xb994('0x3')];function createListener(_0x17d8fa,_0x3954f0){return function(_0x5d45c1){_0x3954f0[_0xb994('0x4')](_0x17d8fa,_0x5d45c1);};}function removeListener(_0x36f26b,_0x3d5794){return function(){OpenchannelQueueEvents[_0xb994('0x5')](_0x36f26b,_0x3d5794);};}exports[_0xb994('0x6')]=function(_0x57aef9){for(var _0x88ef5=0x0,_0x413203=events['length'];_0x88ef5<_0x413203;_0x88ef5++){var _0x497636=events[_0x88ef5];var _0x4ee4ba=createListener(_0xb994('0x7')+_0x497636,_0x57aef9);OpenchannelQueueEvents['on'](_0x497636,_0x4ee4ba);}}; \ No newline at end of file +var _0xad45=['remove','update','removeListener','register','length','./openchannelQueue.events'];(function(_0x2c52a5,_0x350627){var _0x55f434=function(_0x31e26d){while(--_0x31e26d){_0x2c52a5['push'](_0x2c52a5['shift']());}};_0x55f434(++_0x350627);}(_0xad45,0x113));var _0x5ad4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xad45[_0x14add3];return _0x4a174f;};'use strict';var OpenchannelQueueEvents=require(_0x5ad4('0x0'));var events=['save',_0x5ad4('0x1'),_0x5ad4('0x2')];function createListener(_0xd8453e,_0x4ccbb2){return function(_0x1cfafc){_0x4ccbb2['emit'](_0xd8453e,_0x1cfafc);};}function removeListener(_0x4c9e29,_0x12e7bb){return function(){OpenchannelQueueEvents[_0x5ad4('0x3')](_0x4c9e29,_0x12e7bb);};}exports[_0x5ad4('0x4')]=function(_0x1d83f8){for(var _0x1516b3=0x0,_0x3825db=events[_0x5ad4('0x5')];_0x1516b3<_0x3825db;_0x1516b3++){var _0x4502d0=events[_0x1516b3];var _0xfb6f4=createListener('openchannelQueue:'+_0x4502d0,_0x1d83f8);OpenchannelQueueEvents['on'](_0x4502d0,_0xfb6f4);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 4f48f4e..1c198a7 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 _0xc7a3=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update'];(function(_0x2f2d88,_0x33a00a){var _0xb34fd3=function(_0x59fe77){while(--_0x59fe77){_0x2f2d88['push'](_0x2f2d88['shift']());}};_0xb34fd3(++_0x33a00a);}(_0xc7a3,0x10b));var _0x3c7a=function(_0x850c3,_0x1c58d7){_0x850c3=_0x850c3-0x0;var _0xd669a6=_0xc7a3[_0x850c3];return _0xd669a6;};'use strict';var multer=require(_0x3c7a('0x0'));var util=require(_0x3c7a('0x1'));var path=require(_0x3c7a('0x2'));var timeout=require(_0x3c7a('0x3'));var express=require(_0x3c7a('0x4'));var router=express[_0x3c7a('0x5')]();var auth=require(_0x3c7a('0x6'));var interaction=require(_0x3c7a('0x7'));var config=require(_0x3c7a('0x8'));var controller=require(_0x3c7a('0x9'));router[_0x3c7a('0xa')]('/',auth[_0x3c7a('0xb')](),controller[_0x3c7a('0xc')]);router['get'](_0x3c7a('0xd'),auth[_0x3c7a('0xb')](),controller[_0x3c7a('0xe')]);router[_0x3c7a('0xa')](_0x3c7a('0xf'),auth[_0x3c7a('0xb')](),controller[_0x3c7a('0x10')]);router[_0x3c7a('0x11')]('/',auth[_0x3c7a('0xb')](),controller[_0x3c7a('0x12')]);router[_0x3c7a('0x13')]('/:id',auth[_0x3c7a('0xb')](),controller[_0x3c7a('0x14')]);router[_0x3c7a('0x15')](_0x3c7a('0xf'),auth[_0x3c7a('0xb')](),controller[_0x3c7a('0x16')]);module[_0x3c7a('0x17')]=router; \ No newline at end of file +var _0xd539=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x103478,_0x353eca){var _0x55d015=function(_0x5a8665){while(--_0x5a8665){_0x103478['push'](_0x103478['shift']());}};_0x55d015(++_0x353eca);}(_0xd539,0x1b8));var _0x9d53=function(_0x1f8570,_0x4cbcf9){_0x1f8570=_0x1f8570-0x0;var _0x2e7db3=_0xd539[_0x1f8570];return _0x2e7db3;};'use strict';var multer=require(_0x9d53('0x0'));var util=require(_0x9d53('0x1'));var path=require(_0x9d53('0x2'));var timeout=require(_0x9d53('0x3'));var express=require(_0x9d53('0x4'));var router=express[_0x9d53('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x9d53('0x6'));var config=require(_0x9d53('0x7'));var controller=require('./openchannelQueueReport.controller');router[_0x9d53('0x8')]('/',auth[_0x9d53('0x9')](),controller[_0x9d53('0xa')]);router[_0x9d53('0x8')]('/describe',auth[_0x9d53('0x9')](),controller[_0x9d53('0xb')]);router['get'](_0x9d53('0xc'),auth['isAuthenticated'](),controller[_0x9d53('0xd')]);router[_0x9d53('0xe')]('/',auth[_0x9d53('0x9')](),controller[_0x9d53('0xf')]);router['put'](_0x9d53('0xc'),auth['isAuthenticated'](),controller[_0x9d53('0x10')]);router[_0x9d53('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x9d53('0x12')]);module[_0x9d53('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 9b476e3..2253ee2 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 _0x17b9=['sequelize','exports','STRING','DATE'];(function(_0x31d6b8,_0x2dd463){var _0xc5f68d=function(_0x3eae93){while(--_0x3eae93){_0x31d6b8['push'](_0x31d6b8['shift']());}};_0xc5f68d(++_0x2dd463);}(_0x17b9,0xfc));var _0x917b=function(_0x520454,_0x6b780c){_0x520454=_0x520454-0x0;var _0x2f3996=_0x17b9[_0x520454];return _0x2f3996;};'use strict';var moment=require('moment');var Sequelize=require(_0x917b('0x0'));module[_0x917b('0x1')]={'uniqueid':{'type':Sequelize[_0x917b('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x917b('0x2')]},'joinAt':{'type':Sequelize[_0x917b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x917b('0x3')]},'exitAt':{'type':Sequelize[_0x917b('0x3')]},'reason':{'type':Sequelize[_0x917b('0x2')]}}; \ No newline at end of file +var _0x9b08=['sequelize','STRING','DATE','moment'];(function(_0x3b6184,_0x1e3d52){var _0x1548c9=function(_0x329f5a){while(--_0x329f5a){_0x3b6184['push'](_0x3b6184['shift']());}};_0x1548c9(++_0x1e3d52);}(_0x9b08,0xb7));var _0x89b0=function(_0x1d8119,_0xc98f17){_0x1d8119=_0x1d8119-0x0;var _0x3e30f6=_0x9b08[_0x1d8119];return _0x3e30f6;};'use strict';var moment=require(_0x89b0('0x0'));var Sequelize=require(_0x89b0('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x89b0('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x89b0('0x2')]},'joinAt':{'type':Sequelize[_0x89b0('0x3')]},'leaveAt':{'type':Sequelize[_0x89b0('0x3')]},'acceptAt':{'type':Sequelize[_0x89b0('0x3')]},'exitAt':{'type':Sequelize[_0x89b0('0x3')]},'reason':{'type':Sequelize[_0x89b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 08ce371..c4072f9 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 _0x9f0e=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','OpenchannelQueueReport','includeAll','include','findAll','rows','catch','options','find','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x4d3b50,_0x362d0c){var _0x257998=function(_0x500790){while(--_0x500790){_0x4d3b50['push'](_0x4d3b50['shift']());}};_0x257998(++_0x362d0c);}(_0x9f0e,0x116));var _0xe9f0=function(_0x4bd2c3,_0x9de6c1){_0x4bd2c3=_0x4bd2c3-0x0;var _0x52e14c=_0x9f0e[_0x4bd2c3];return _0x52e14c;};'use strict';var pdf=require(_0xe9f0('0x0'));var emlformat=require(_0xe9f0('0x1'));var rimraf=require(_0xe9f0('0x2'));var zipdir=require(_0xe9f0('0x3'));var jsonpatch=require(_0xe9f0('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe9f0('0x5'));var Mustache=require(_0xe9f0('0x6'));var util=require(_0xe9f0('0x7'));var path=require(_0xe9f0('0x8'));var sox=require(_0xe9f0('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0xe'));var querystring=require(_0xe9f0('0xf'));var Papa=require(_0xe9f0('0x10'));var Redis=require(_0xe9f0('0x11'));var authService=require(_0xe9f0('0x12'));var qs=require(_0xe9f0('0x13'));var as=require(_0xe9f0('0x14'));var hardwareService=require(_0xe9f0('0x15'));var logger=require('../../config/logger')(_0xe9f0('0x16'));var utils=require(_0xe9f0('0x17'));var config=require(_0xe9f0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x207fac,_0x586763){_0x586763=_0x586763||0xcc;return function(_0x367545){if(_0x367545){return _0x207fac[_0xe9f0('0x19')](_0x586763);}return _0x207fac[_0xe9f0('0x1a')](_0x586763)[_0xe9f0('0x1b')]();};}function respondWithResult(_0x55a388,_0x2cf75d){_0x2cf75d=_0x2cf75d||0xc8;return function(_0x5a10c6){if(_0x5a10c6){return _0x55a388[_0xe9f0('0x1a')](_0x2cf75d)[_0xe9f0('0x1c')](_0x5a10c6);}};}function respondWithFilteredResult(_0x3800e8,_0x59320d){return function(_0x28bfac){if(_0x28bfac){var _0x33e9e4=_0x28bfac[_0xe9f0('0x1d')],_0x2e68ef=_0x59320d[_0xe9f0('0x1e')],_0x598eee=_0x59320d[_0xe9f0('0x1e')]+_0x59320d[_0xe9f0('0x1f')],_0xaa7aa6;if(_0x598eee>=_0x33e9e4){_0x598eee=_0x33e9e4;_0xaa7aa6=0xc8;}else{_0xaa7aa6=0xce;}_0x3800e8[_0xe9f0('0x1a')](_0xaa7aa6);return _0x3800e8[_0xe9f0('0x20')]('Content-Range',_0x2e68ef+'-'+_0x598eee+'/'+_0x33e9e4)[_0xe9f0('0x1c')](_0x28bfac);}return null;};}function patchUpdates(_0x19e090){return function(_0x232f2c){try{jsonpatch['apply'](_0x232f2c,_0x19e090,!![]);}catch(_0x35e841){return BPromise[_0xe9f0('0x21')](_0x35e841);}return _0x232f2c[_0xe9f0('0x22')]();};}function saveUpdates(_0x43f399,_0x5ba788){return function(_0x33f143){if(_0x33f143){return _0x33f143[_0xe9f0('0x23')](_0x43f399)['then'](function(_0x51e03f){return _0x51e03f;});}return null;};}function removeEntity(_0x4cc403,_0x12fe9f){return function(_0xa1ddc){if(_0xa1ddc){return _0xa1ddc[_0xe9f0('0x24')]()[_0xe9f0('0x25')](function(){_0x4cc403[_0xe9f0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(!_0x437d43){_0x229fe0[_0xe9f0('0x19')](0x194);}return _0x437d43;};}function handleError(_0x3ca991,_0x372ffd){_0x372ffd=_0x372ffd||0x1f4;return function(_0x37c0fc){logger[_0xe9f0('0x26')](_0x37c0fc[_0xe9f0('0x27')]);if(_0x37c0fc[_0xe9f0('0x28')]){delete _0x37c0fc['name'];}_0x3ca991[_0xe9f0('0x1a')](_0x372ffd)[_0xe9f0('0x29')](_0x37c0fc);};}exports[_0xe9f0('0x2a')]=function(_0x1a8478,_0x4cf1b1){var _0x212a38={},_0x2613fd={},_0x856ac8={'count':0x0,'rows':[]};var _0x1f98a7=_[_0xe9f0('0x2b')](db['OpenchannelQueueReport'][_0xe9f0('0x2c')],function(_0xdc16bc){return{'name':_0xdc16bc[_0xe9f0('0x2d')],'type':_0xdc16bc[_0xe9f0('0x2e')][_0xe9f0('0x2f')]};});_0x2613fd[_0xe9f0('0x30')]=_[_0xe9f0('0x2b')](_0x1f98a7,_0xe9f0('0x28'));_0x2613fd[_0xe9f0('0x31')]=_[_0xe9f0('0x32')](_0x1a8478[_0xe9f0('0x31')]);_0x2613fd[_0xe9f0('0x33')]=_[_0xe9f0('0x34')](_0x2613fd[_0xe9f0('0x30')],_0x2613fd[_0xe9f0('0x31')]);_0x212a38[_0xe9f0('0x35')]=_[_0xe9f0('0x34')](_0x2613fd[_0xe9f0('0x30')],qs[_0xe9f0('0x36')](_0x1a8478[_0xe9f0('0x31')][_0xe9f0('0x36')]));_0x212a38[_0xe9f0('0x35')]=_0x212a38[_0xe9f0('0x35')][_0xe9f0('0x37')]?_0x212a38['attributes']:_0x2613fd['model'];if(!_0x1a8478['query'][_0xe9f0('0x38')]('nolimit')){_0x212a38[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x1a8478['query'][_0xe9f0('0x1f')]);_0x212a38['offset']=qs['offset'](_0x1a8478['query'][_0xe9f0('0x1e')]);}_0x212a38[_0xe9f0('0x39')]=qs['sort'](_0x1a8478[_0xe9f0('0x31')][_0xe9f0('0x3a')]);_0x212a38[_0xe9f0('0x3b')]=qs['filters'](_['pick'](_0x1a8478[_0xe9f0('0x31')],_0x2613fd[_0xe9f0('0x33')]));if(_0x1a8478[_0xe9f0('0x31')]['filter']){_0x212a38[_0xe9f0('0x3b')]=_[_0xe9f0('0x3c')](_0x212a38[_0xe9f0('0x3b')],{'$or':_[_0xe9f0('0x2b')](_0x1f98a7,function(_0x2b38de){if(_0x2b38de['type']!==_0xe9f0('0x3d')){var _0x3a2b23={};_0x3a2b23[_0x2b38de[_0xe9f0('0x28')]]={'$like':'%'+_0x1a8478['query'][_0xe9f0('0x3e')]+'%'};return _0x3a2b23;}})});}_0x212a38=_[_0xe9f0('0x3c')]({},_0x212a38,_0x1a8478['options']);var _0x317278={'where':_0x212a38['where']};return db[_0xe9f0('0x3f')]['count'](_0x317278)['then'](function(_0x51eda3){_0x856ac8['count']=_0x51eda3;if(_0x1a8478['query'][_0xe9f0('0x40')]){_0x212a38[_0xe9f0('0x41')]=[{'all':!![]}];}return db[_0xe9f0('0x3f')][_0xe9f0('0x42')](_0x212a38);})[_0xe9f0('0x25')](function(_0xd9b61b){_0x856ac8[_0xe9f0('0x43')]=_0xd9b61b;return _0x856ac8;})[_0xe9f0('0x25')](respondWithFilteredResult(_0x4cf1b1,_0x212a38))[_0xe9f0('0x44')](handleError(_0x4cf1b1,null));};exports['show']=function(_0x1e2016,_0x3eeea3){var _0x36b00a={'raw':!![],'where':{'id':_0x1e2016['params']['id']}},_0x571366={};_0x571366[_0xe9f0('0x30')]=_['keys'](db[_0xe9f0('0x3f')][_0xe9f0('0x2c')]);_0x571366[_0xe9f0('0x31')]=_[_0xe9f0('0x32')](_0x1e2016['query']);_0x571366[_0xe9f0('0x33')]=_[_0xe9f0('0x34')](_0x571366[_0xe9f0('0x30')],_0x571366[_0xe9f0('0x31')]);_0x36b00a[_0xe9f0('0x35')]=_['intersection'](_0x571366[_0xe9f0('0x30')],qs[_0xe9f0('0x36')](_0x1e2016[_0xe9f0('0x31')][_0xe9f0('0x36')]));_0x36b00a[_0xe9f0('0x35')]=_0x36b00a['attributes'][_0xe9f0('0x37')]?_0x36b00a['attributes']:_0x571366['model'];if(_0x1e2016[_0xe9f0('0x31')][_0xe9f0('0x40')]){_0x36b00a['include']=[{'all':!![]}];}_0x36b00a=_[_0xe9f0('0x3c')]({},_0x36b00a,_0x1e2016[_0xe9f0('0x45')]);return db[_0xe9f0('0x3f')][_0xe9f0('0x46')](_0x36b00a)[_0xe9f0('0x25')](handleEntityNotFound(_0x3eeea3,null))[_0xe9f0('0x25')](respondWithResult(_0x3eeea3,null))[_0xe9f0('0x44')](handleError(_0x3eeea3,null));};exports['create']=function(_0x8b8da3,_0x4a6e2a){return db[_0xe9f0('0x3f')]['create'](_0x8b8da3[_0xe9f0('0x47')],{})['then'](respondWithResult(_0x4a6e2a,0xc9))[_0xe9f0('0x44')](handleError(_0x4a6e2a,null));};exports[_0xe9f0('0x23')]=function(_0x422324,_0x4c94e9){if(_0x422324[_0xe9f0('0x47')]['id']){delete _0x422324[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x3f')][_0xe9f0('0x46')]({'where':{'id':_0x422324[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x25')](handleEntityNotFound(_0x4c94e9,null))[_0xe9f0('0x25')](saveUpdates(_0x422324[_0xe9f0('0x47')],null))[_0xe9f0('0x25')](respondWithResult(_0x4c94e9,null))[_0xe9f0('0x44')](handleError(_0x4c94e9,null));};exports[_0xe9f0('0x24')]=function(_0x1325a2,_0x57beee){return db['OpenchannelQueueReport'][_0xe9f0('0x46')]({'where':{'id':_0x1325a2[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x25')](handleEntityNotFound(_0x57beee,null))['then'](removeEntity(_0x57beee,null))[_0xe9f0('0x44')](handleError(_0x57beee,null));};exports['describe']=function(_0x323e1e,_0x3c69c0){return db[_0xe9f0('0x3f')][_0xe9f0('0x49')]()['then'](respondWithResult(_0x3c69c0,null))[_0xe9f0('0x44')](handleError(_0x3c69c0,null));}; \ No newline at end of file +var _0xb6fa=['where','pick','merge','VIRTUAL','filter','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','html-pdf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','OpenchannelQueueReport','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x4b5394,_0x5def8c){var _0x4dc370=function(_0x3386ee){while(--_0x3386ee){_0x4b5394['push'](_0x4b5394['shift']());}};_0x4dc370(++_0x5def8c);}(_0xb6fa,0x1c2));var _0xab6f=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0xb6fa[_0x5e9a69];return _0x5979c8;};'use strict';var pdf=require(_0xab6f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab6f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xab6f('0x2'));var BPromise=require(_0xab6f('0x3'));var Mustache=require('mustache');var util=require(_0xab6f('0x4'));var path=require(_0xab6f('0x5'));var sox=require(_0xab6f('0x6'));var csv=require(_0xab6f('0x7'));var ejs=require(_0xab6f('0x8'));var fs=require('fs');var _=require(_0xab6f('0x9'));var squel=require(_0xab6f('0xa'));var crypto=require(_0xab6f('0xb'));var jsforce=require(_0xab6f('0xc'));var deskjs=require(_0xab6f('0xd'));var toCsv=require(_0xab6f('0x7'));var querystring=require(_0xab6f('0xe'));var Papa=require(_0xab6f('0xf'));var Redis=require(_0xab6f('0x10'));var authService=require(_0xab6f('0x11'));var qs=require(_0xab6f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab6f('0x13'))(_0xab6f('0x14'));var utils=require('../../config/utils');var config=require(_0xab6f('0x15'));var db=require(_0xab6f('0x16'))['db'];function respondWithStatusCode(_0x318c53,_0x437b32){_0x437b32=_0x437b32||0xcc;return function(_0x139fcf){if(_0x139fcf){return _0x318c53[_0xab6f('0x17')](_0x437b32);}return _0x318c53[_0xab6f('0x18')](_0x437b32)['end']();};}function respondWithResult(_0x383c30,_0x17d180){_0x17d180=_0x17d180||0xc8;return function(_0x3b5791){if(_0x3b5791){return _0x383c30['status'](_0x17d180)[_0xab6f('0x19')](_0x3b5791);}};}function respondWithFilteredResult(_0x53d5e2,_0x49d9f1){return function(_0x2a6aac){if(_0x2a6aac){var _0x5eed74=_0x2a6aac['count'],_0x422850=_0x49d9f1[_0xab6f('0x1a')],_0x3653f0=_0x49d9f1['offset']+_0x49d9f1[_0xab6f('0x1b')],_0x14447f;if(_0x3653f0>=_0x5eed74){_0x3653f0=_0x5eed74;_0x14447f=0xc8;}else{_0x14447f=0xce;}_0x53d5e2[_0xab6f('0x18')](_0x14447f);return _0x53d5e2[_0xab6f('0x1c')](_0xab6f('0x1d'),_0x422850+'-'+_0x3653f0+'/'+_0x5eed74)[_0xab6f('0x19')](_0x2a6aac);}return null;};}function patchUpdates(_0x63d478){return function(_0x455c20){try{jsonpatch['apply'](_0x455c20,_0x63d478,!![]);}catch(_0x1f7322){return BPromise[_0xab6f('0x1e')](_0x1f7322);}return _0x455c20[_0xab6f('0x1f')]();};}function saveUpdates(_0x485200,_0x43eda0){return function(_0x375e68){if(_0x375e68){return _0x375e68[_0xab6f('0x20')](_0x485200)[_0xab6f('0x21')](function(_0x2c20cc){return _0x2c20cc;});}return null;};}function removeEntity(_0x210d19,_0x47fead){return function(_0x4dc7c1){if(_0x4dc7c1){return _0x4dc7c1[_0xab6f('0x22')]()[_0xab6f('0x21')](function(){_0x210d19[_0xab6f('0x18')](0xcc)[_0xab6f('0x23')]();});}};}function handleEntityNotFound(_0x15c3e6,_0x149321){return function(_0xb1ef77){if(!_0xb1ef77){_0x15c3e6['sendStatus'](0x194);}return _0xb1ef77;};}function handleError(_0x1294d3,_0xf849b5){_0xf849b5=_0xf849b5||0x1f4;return function(_0x4f6659){logger[_0xab6f('0x24')](_0x4f6659[_0xab6f('0x25')]);if(_0x4f6659[_0xab6f('0x26')]){delete _0x4f6659[_0xab6f('0x26')];}_0x1294d3[_0xab6f('0x18')](_0xf849b5)['send'](_0x4f6659);};}exports[_0xab6f('0x27')]=function(_0x205926,_0x4bcedd){var _0x149fad={},_0x30e0fa={},_0x441423={'count':0x0,'rows':[]};var _0x2f8ebc=_[_0xab6f('0x28')](db[_0xab6f('0x29')]['rawAttributes'],function(_0x3f95e8){return{'name':_0x3f95e8['fieldName'],'type':_0x3f95e8['type']['key']};});_0x30e0fa['model']=_['map'](_0x2f8ebc,_0xab6f('0x26'));_0x30e0fa[_0xab6f('0x2a')]=_[_0xab6f('0x2b')](_0x205926[_0xab6f('0x2a')]);_0x30e0fa[_0xab6f('0x2c')]=_['intersection'](_0x30e0fa[_0xab6f('0x2d')],_0x30e0fa[_0xab6f('0x2a')]);_0x149fad[_0xab6f('0x2e')]=_[_0xab6f('0x2f')](_0x30e0fa[_0xab6f('0x2d')],qs[_0xab6f('0x30')](_0x205926[_0xab6f('0x2a')]['fields']));_0x149fad[_0xab6f('0x2e')]=_0x149fad[_0xab6f('0x2e')][_0xab6f('0x31')]?_0x149fad['attributes']:_0x30e0fa[_0xab6f('0x2d')];if(!_0x205926['query'][_0xab6f('0x32')](_0xab6f('0x33'))){_0x149fad[_0xab6f('0x1b')]=qs[_0xab6f('0x1b')](_0x205926[_0xab6f('0x2a')][_0xab6f('0x1b')]);_0x149fad[_0xab6f('0x1a')]=qs[_0xab6f('0x1a')](_0x205926[_0xab6f('0x2a')]['offset']);}_0x149fad[_0xab6f('0x34')]=qs['sort'](_0x205926['query'][_0xab6f('0x35')]);_0x149fad[_0xab6f('0x36')]=qs[_0xab6f('0x2c')](_[_0xab6f('0x37')](_0x205926[_0xab6f('0x2a')],_0x30e0fa[_0xab6f('0x2c')]));if(_0x205926['query']['filter']){_0x149fad['where']=_[_0xab6f('0x38')](_0x149fad[_0xab6f('0x36')],{'$or':_[_0xab6f('0x28')](_0x2f8ebc,function(_0x421bd2){if(_0x421bd2['type']!==_0xab6f('0x39')){var _0x33ce7d={};_0x33ce7d[_0x421bd2['name']]={'$like':'%'+_0x205926['query'][_0xab6f('0x3a')]+'%'};return _0x33ce7d;}})});}_0x149fad=_[_0xab6f('0x38')]({},_0x149fad,_0x205926[_0xab6f('0x3b')]);var _0x347988={'where':_0x149fad['where']};return db['OpenchannelQueueReport'][_0xab6f('0x3c')](_0x347988)[_0xab6f('0x21')](function(_0x2228f4){_0x441423[_0xab6f('0x3c')]=_0x2228f4;if(_0x205926[_0xab6f('0x2a')][_0xab6f('0x3d')]){_0x149fad['include']=[{'all':!![]}];}return db[_0xab6f('0x29')][_0xab6f('0x3e')](_0x149fad);})[_0xab6f('0x21')](function(_0x435525){_0x441423[_0xab6f('0x3f')]=_0x435525;return _0x441423;})[_0xab6f('0x21')](respondWithFilteredResult(_0x4bcedd,_0x149fad))[_0xab6f('0x40')](handleError(_0x4bcedd,null));};exports[_0xab6f('0x41')]=function(_0x43d307,_0xe12df6){var _0x3df7f1={'raw':!![],'where':{'id':_0x43d307[_0xab6f('0x42')]['id']}},_0x3f6fcb={};_0x3f6fcb[_0xab6f('0x2d')]=_[_0xab6f('0x2b')](db[_0xab6f('0x29')]['rawAttributes']);_0x3f6fcb[_0xab6f('0x2a')]=_[_0xab6f('0x2b')](_0x43d307[_0xab6f('0x2a')]);_0x3f6fcb[_0xab6f('0x2c')]=_[_0xab6f('0x2f')](_0x3f6fcb['model'],_0x3f6fcb['query']);_0x3df7f1[_0xab6f('0x2e')]=_[_0xab6f('0x2f')](_0x3f6fcb[_0xab6f('0x2d')],qs[_0xab6f('0x30')](_0x43d307[_0xab6f('0x2a')]['fields']));_0x3df7f1[_0xab6f('0x2e')]=_0x3df7f1[_0xab6f('0x2e')]['length']?_0x3df7f1['attributes']:_0x3f6fcb[_0xab6f('0x2d')];if(_0x43d307[_0xab6f('0x2a')]['includeAll']){_0x3df7f1[_0xab6f('0x43')]=[{'all':!![]}];}_0x3df7f1=_[_0xab6f('0x38')]({},_0x3df7f1,_0x43d307[_0xab6f('0x3b')]);return db[_0xab6f('0x29')][_0xab6f('0x44')](_0x3df7f1)[_0xab6f('0x21')](handleEntityNotFound(_0xe12df6,null))['then'](respondWithResult(_0xe12df6,null))[_0xab6f('0x40')](handleError(_0xe12df6,null));};exports[_0xab6f('0x45')]=function(_0x1f4f08,_0x326c7c){return db[_0xab6f('0x29')][_0xab6f('0x45')](_0x1f4f08[_0xab6f('0x46')],{})[_0xab6f('0x21')](respondWithResult(_0x326c7c,0xc9))[_0xab6f('0x40')](handleError(_0x326c7c,null));};exports[_0xab6f('0x20')]=function(_0x6f0f4c,_0x298690){if(_0x6f0f4c[_0xab6f('0x46')]['id']){delete _0x6f0f4c['body']['id'];}return db[_0xab6f('0x29')][_0xab6f('0x44')]({'where':{'id':_0x6f0f4c['params']['id']}})[_0xab6f('0x21')](handleEntityNotFound(_0x298690,null))[_0xab6f('0x21')](saveUpdates(_0x6f0f4c[_0xab6f('0x46')],null))[_0xab6f('0x21')](respondWithResult(_0x298690,null))[_0xab6f('0x40')](handleError(_0x298690,null));};exports[_0xab6f('0x22')]=function(_0x12e1f8,_0x438ca4){return db[_0xab6f('0x29')][_0xab6f('0x44')]({'where':{'id':_0x12e1f8[_0xab6f('0x42')]['id']}})[_0xab6f('0x21')](handleEntityNotFound(_0x438ca4,null))[_0xab6f('0x21')](removeEntity(_0x438ca4,null))[_0xab6f('0x40')](handleError(_0x438ca4,null));};exports['describe']=function(_0x2a7966,_0x5af17e){return db['OpenchannelQueueReport'][_0xab6f('0x47')]()[_0xab6f('0x21')](respondWithResult(_0x5af17e,null))['catch'](handleError(_0x5af17e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index c476059..3e258d5 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 _0x80fb=['./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3c4fd4,_0x31ba50){var _0x4f8458=function(_0x5e1d3e){while(--_0x5e1d3e){_0x3c4fd4['push'](_0x3c4fd4['shift']());}};_0x4f8458(++_0x31ba50);}(_0x80fb,0x11e));var _0xb80f=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x80fb[_0x3c2a69];return _0x596bc8;};'use strict';var _=require('lodash');var util=require(_0xb80f('0x0'));var logger=require(_0xb80f('0x1'))('api');var moment=require(_0xb80f('0x2'));var BPromise=require(_0xb80f('0x3'));var rp=require(_0xb80f('0x4'));var fs=require('fs');var path=require(_0xb80f('0x5'));var rimraf=require(_0xb80f('0x6'));var config=require(_0xb80f('0x7'));var attributes=require(_0xb80f('0x8'));module[_0xb80f('0x9')]=function(_0x52d81c,_0x1676a9){return _0x52d81c[_0xb80f('0xa')](_0xb80f('0xb'),attributes,{'tableName':_0xb80f('0xc'),'paranoid':![],'indexes':[{'name':_0xb80f('0xd'),'fields':[_0xb80f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf961=['request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xf961,0x1cf));var _0x1f96=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xf961[_0x24259d];return _0x5a701;};'use strict';var _=require(_0x1f96('0x0'));var util=require(_0x1f96('0x1'));var logger=require(_0x1f96('0x2'))(_0x1f96('0x3'));var moment=require('moment');var BPromise=require(_0x1f96('0x4'));var rp=require(_0x1f96('0x5'));var fs=require('fs');var path=require(_0x1f96('0x6'));var rimraf=require('rimraf');var config=require(_0x1f96('0x7'));var attributes=require(_0x1f96('0x8'));module[_0x1f96('0x9')]=function(_0x518062,_0x40caad){return _0x518062['define'](_0x1f96('0xa'),attributes,{'tableName':_0x1f96('0xb'),'paranoid':![],'indexes':[{'name':_0x1f96('0xc'),'fields':[_0x1f96('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 42d75b9..a8d293c 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 _0x430c=['limit','lodash','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','body','options','raw','catch','UpdateOpenchannelQueueReport','OpenchannelQueueReport','where','attributes'];(function(_0x245545,_0x4983b3){var _0x106a5f=function(_0x278277){while(--_0x278277){_0x245545['push'](_0x245545['shift']());}};_0x106a5f(++_0x4983b3);}(_0x430c,0x1a1));var _0xc430=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x430c[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc430('0x1'));var rs=require(_0xc430('0x2'));var fs=require('fs');var Redis=require(_0xc430('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xc430('0x4'));var jayson=require(_0xc430('0x5'));var client=jayson['client'][_0xc430('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4de44f,_0x212354,_0x2e51c6){return new BPromise(function(_0x814a90,_0x13ae66){return client[_0xc430('0x7')](_0x4de44f,_0x2e51c6)[_0xc430('0x8')](function(_0x861581){logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');logger[_0xc430('0xb')](_0xc430('0xc'),_0x212354,'request\x20sent',JSON[_0xc430('0xd')](_0x861581));if(_0x861581['error']){if(_0x861581[_0xc430('0xe')]['code']===0x1f4){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x861581[_0xc430('0xe')][_0xc430('0xf')]);return _0x13ae66(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}logger[_0xc430('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x212354,_0x861581['error'][_0xc430('0xf')]);return _0x814a90(_0x861581[_0xc430('0xe')][_0xc430('0xf')]);}else{logger[_0xc430('0x9')](_0xc430('0xa'),_0x212354,'request\x20sent');_0x814a90(_0x861581[_0xc430('0x10')]['message']);}})['catch'](function(_0x2e7987){logger[_0xc430('0xe')](_0xc430('0xa'),_0x212354,_0x2e7987);_0x13ae66(_0x2e7987);});});}exports['CreateOpenchannelQueueReport']=function(_0x5d3acc){var _0x36d112=this;return new Promise(function(_0x4c1937,_0x2bcb21){return db['OpenchannelQueueReport']['create'](_0x5d3acc[_0xc430('0x11')],{'raw':_0x5d3acc['options']?_0x5d3acc[_0xc430('0x12')][_0xc430('0x13')]===undefined?!![]:![]:!![]})[_0xc430('0x8')](function(_0x1f90bb){logger[_0xc430('0x9')]('CreateOpenchannelQueueReport',_0x5d3acc);logger[_0xc430('0xb')]('CreateOpenchannelQueueReport',_0x5d3acc,JSON['stringify'](_0x1f90bb));_0x4c1937(_0x1f90bb);})[_0xc430('0x14')](function(_0x2ea352){logger[_0xc430('0xe')]('CreateOpenchannelQueueReport',_0x2ea352[_0xc430('0xf')],_0x5d3acc);_0x2bcb21(_0x36d112['error'](0x1f4,_0x2ea352[_0xc430('0xf')]));});});};exports[_0xc430('0x15')]=function(_0x4efecd){var _0x31b4f1=this;return new Promise(function(_0x3cdbd3,_0x48f67a){return db[_0xc430('0x16')]['update'](_0x4efecd[_0xc430('0x11')],{'raw':_0x4efecd['options']?_0x4efecd[_0xc430('0x12')][_0xc430('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4efecd['options']?_0x4efecd[_0xc430('0x12')][_0xc430('0x17')]||null:null,'attributes':_0x4efecd[_0xc430('0x12')]?_0x4efecd[_0xc430('0x12')][_0xc430('0x18')]||null:null,'limit':_0x4efecd['options']?_0x4efecd[_0xc430('0x12')][_0xc430('0x19')]||null:null})[_0xc430('0x8')](function(_0x1591e3){logger['info'](_0xc430('0x15'),_0x4efecd);logger['debug'](_0xc430('0x15'),_0x4efecd,JSON['stringify'](_0x1591e3));_0x3cdbd3(_0x1591e3);})[_0xc430('0x14')](function(_0x1045c0){logger[_0xc430('0xe')](_0xc430('0x15'),_0x1045c0['message'],_0x4efecd);_0x48f67a(_0x31b4f1[_0xc430('0xe')](0x1f4,_0x1045c0[_0xc430('0xf')]));});});}; \ No newline at end of file +var _0xfbbb=['message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelQueueReport,\x20%s,\x20%s'];(function(_0x33a61e,_0x159e28){var _0xc6a2e3=function(_0x51b464){while(--_0x51b464){_0x33a61e['push'](_0x33a61e['shift']());}};_0xc6a2e3(++_0x159e28);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x590096,_0x1ad366){_0x590096=_0x590096-0x0;var _0xbd6ea2=_0xfbbb[_0x590096];return _0xbd6ea2;};'use strict';var _=require(_0xbfbb('0x0'));var util=require(_0xbfbb('0x1'));var moment=require(_0xbfbb('0x2'));var BPromise=require(_0xbfbb('0x3'));var rs=require(_0xbfbb('0x4'));var fs=require('fs');var Redis=require(_0xbfbb('0x5'));var db=require(_0xbfbb('0x6'))['db'];var utils=require(_0xbfbb('0x7'));var logger=require(_0xbfbb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbfbb('0x9'));var client=jayson['client'][_0xbfbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16c6cc,_0x16a41c,_0x5a69b3){return new BPromise(function(_0x1f2c31,_0x3260a7){return client[_0xbfbb('0xb')](_0x16c6cc,_0x5a69b3)[_0xbfbb('0xc')](function(_0x1baefa){logger[_0xbfbb('0xd')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x16a41c,_0xbfbb('0xe'));logger[_0xbfbb('0xf')](_0xbfbb('0x10'),_0x16a41c,_0xbfbb('0xe'),JSON['stringify'](_0x1baefa));if(_0x1baefa[_0xbfbb('0x11')]){if(_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x12')]===0x1f4){logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x3260a7(_0x1baefa[_0xbfbb('0x11')]['message']);}logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x1f2c31(_0x1baefa[_0xbfbb('0x11')]['message']);}else{logger[_0xbfbb('0xd')](_0xbfbb('0x13'),_0x16a41c,_0xbfbb('0xe'));_0x1f2c31(_0x1baefa[_0xbfbb('0x15')][_0xbfbb('0x14')]);}})[_0xbfbb('0x16')](function(_0x2f49e5){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x16a41c,_0x2f49e5);_0x3260a7(_0x2f49e5);});});}exports[_0xbfbb('0x17')]=function(_0x4be5df){var _0xc18041=this;return new Promise(function(_0x4834a9,_0x20337e){return db[_0xbfbb('0x18')][_0xbfbb('0x19')](_0x4be5df[_0xbfbb('0x1a')],{'raw':_0x4be5df[_0xbfbb('0x1b')]?_0x4be5df['options'][_0xbfbb('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x26c69f){logger[_0xbfbb('0xd')](_0xbfbb('0x17'),_0x4be5df);logger[_0xbfbb('0xf')](_0xbfbb('0x17'),_0x4be5df,JSON[_0xbfbb('0x1d')](_0x26c69f));_0x4834a9(_0x26c69f);})[_0xbfbb('0x16')](function(_0x1c9943){logger['error'](_0xbfbb('0x17'),_0x1c9943[_0xbfbb('0x14')],_0x4be5df);_0x20337e(_0xc18041['error'](0x1f4,_0x1c9943[_0xbfbb('0x14')]));});});};exports[_0xbfbb('0x1e')]=function(_0x44bf61){var _0x26b9d6=this;return new Promise(function(_0x5adf09,_0x1116d1){return db['OpenchannelQueueReport'][_0xbfbb('0x1f')](_0x44bf61[_0xbfbb('0x1a')],{'raw':_0x44bf61[_0xbfbb('0x1b')]?_0x44bf61[_0xbfbb('0x1b')][_0xbfbb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44bf61[_0xbfbb('0x1b')]?_0x44bf61[_0xbfbb('0x1b')][_0xbfbb('0x20')]||null:null,'attributes':_0x44bf61[_0xbfbb('0x1b')]?_0x44bf61[_0xbfbb('0x1b')][_0xbfbb('0x21')]||null:null,'limit':_0x44bf61[_0xbfbb('0x1b')]?_0x44bf61[_0xbfbb('0x1b')][_0xbfbb('0x22')]||null:null})['then'](function(_0x21a72a){logger[_0xbfbb('0xd')](_0xbfbb('0x1e'),_0x44bf61);logger[_0xbfbb('0xf')]('UpdateOpenchannelQueueReport',_0x44bf61,JSON[_0xbfbb('0x1d')](_0x21a72a));_0x5adf09(_0x21a72a);})[_0xbfbb('0x16')](function(_0x303f3b){logger['error'](_0xbfbb('0x1e'),_0x303f3b[_0xbfbb('0x14')],_0x44bf61);_0x1116d1(_0x26b9d6[_0xbfbb('0x11')](0x1f4,_0x303f3b[_0xbfbb('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 948cc8a..b77a3c0 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(_0x48961c,_0x280e9d){var _0x1d895d=function(_0x248ffa){while(--_0x248ffa){_0x48961c['push'](_0x48961c['shift']());}};_0x1d895d(++_0x280e9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 6df2bc5..25b9d8e 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 _0x5c5c=['exports','ENUM','queue','DATE','NOW','sequelize'];(function(_0x431c88,_0x2fe00e){var _0x3603a8=function(_0x2ba08c){while(--_0x2ba08c){_0x431c88['push'](_0x431c88['shift']());}};_0x3603a8(++_0x2fe00e);}(_0x5c5c,0x65));var _0xc5c5=function(_0x15251b,_0x1f22f0){_0x15251b=_0x15251b-0x0;var _0x181da3=_0x5c5c[_0x15251b];return _0x181da3;};'use strict';var moment=require('moment');var Sequelize=require(_0xc5c5('0x0'));module[_0xc5c5('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xc5c5('0x2')]('account','agent',_0xc5c5('0x3')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xc5c5('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xc5c5('0x5')]}}; \ No newline at end of file +var _0x3df4=['exports','STRING','ENUM','account','agent','queue','moment','sequelize'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3df4,0x1e6));var _0x43df=function(_0x1d0896,_0x35be56){_0x1d0896=_0x1d0896-0x0;var _0x504899=_0x3df4[_0x1d0896];return _0x504899;};'use strict';var moment=require(_0x43df('0x0'));var Sequelize=require(_0x43df('0x1'));module[_0x43df('0x2')]={'uniqueid':{'type':Sequelize[_0x43df('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x43df('0x4')](_0x43df('0x5'),_0x43df('0x6'),_0x43df('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'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 77b0190..904109e 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 _0x76f3=['where','filter','VIRTUAL','findAll','rows','catch','params','rawAttributes','include','merge','options','find','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','error','name','send','map','OpenchannelTransferReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0x373417,_0x2fd862){var _0x529e45=function(_0x4aface){while(--_0x4aface){_0x373417['push'](_0x373417['shift']());}};_0x529e45(++_0x2fd862);}(_0x76f3,0x182));var _0x376f=function(_0x364677,_0x2aca45){_0x364677=_0x364677-0x0;var _0x4281ba=_0x76f3[_0x364677];return _0x4281ba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x376f('0x0'));var rimraf=require(_0x376f('0x1'));var zipdir=require(_0x376f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x376f('0x3'));var moment=require(_0x376f('0x4'));var BPromise=require(_0x376f('0x5'));var Mustache=require(_0x376f('0x6'));var util=require(_0x376f('0x7'));var path=require(_0x376f('0x8'));var sox=require(_0x376f('0x9'));var csv=require('to-csv');var ejs=require(_0x376f('0xa'));var fs=require('fs');var _=require(_0x376f('0xb'));var squel=require('squel');var crypto=require(_0x376f('0xc'));var jsforce=require(_0x376f('0xd'));var deskjs=require(_0x376f('0xe'));var toCsv=require(_0x376f('0xf'));var querystring=require(_0x376f('0x10'));var Papa=require('papaparse');var Redis=require(_0x376f('0x11'));var authService=require(_0x376f('0x12'));var qs=require(_0x376f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x376f('0x14'));var logger=require(_0x376f('0x15'))('api');var utils=require(_0x376f('0x16'));var config=require('../../config/environment');var db=require(_0x376f('0x17'))['db'];function respondWithStatusCode(_0x306213,_0x6c7844){_0x6c7844=_0x6c7844||0xcc;return function(_0x488ead){if(_0x488ead){return _0x306213[_0x376f('0x18')](_0x6c7844);}return _0x306213[_0x376f('0x19')](_0x6c7844)[_0x376f('0x1a')]();};}function respondWithResult(_0x5a2598,_0x470038){_0x470038=_0x470038||0xc8;return function(_0x2fe5f4){if(_0x2fe5f4){return _0x5a2598[_0x376f('0x19')](_0x470038)[_0x376f('0x1b')](_0x2fe5f4);}};}function respondWithFilteredResult(_0x2c35b9,_0x3d1f1d){return function(_0x20e2f1){if(_0x20e2f1){var _0x409613=_0x20e2f1[_0x376f('0x1c')],_0x40c785=_0x3d1f1d[_0x376f('0x1d')],_0x43b993=_0x3d1f1d['offset']+_0x3d1f1d['limit'],_0x52371f;if(_0x43b993>=_0x409613){_0x43b993=_0x409613;_0x52371f=0xc8;}else{_0x52371f=0xce;}_0x2c35b9[_0x376f('0x19')](_0x52371f);return _0x2c35b9[_0x376f('0x1e')](_0x376f('0x1f'),_0x40c785+'-'+_0x43b993+'/'+_0x409613)[_0x376f('0x1b')](_0x20e2f1);}return null;};}function patchUpdates(_0x22386e){return function(_0x4ea285){try{jsonpatch[_0x376f('0x20')](_0x4ea285,_0x22386e,!![]);}catch(_0x3e2216){return BPromise[_0x376f('0x21')](_0x3e2216);}return _0x4ea285[_0x376f('0x22')]();};}function saveUpdates(_0x5c9803,_0x4682c7){return function(_0x897694){if(_0x897694){return _0x897694['update'](_0x5c9803)[_0x376f('0x23')](function(_0x24df4e){return _0x24df4e;});}return null;};}function removeEntity(_0x406dbd,_0x30b0d8){return function(_0x3b76e9){if(_0x3b76e9){return _0x3b76e9[_0x376f('0x24')]()['then'](function(){_0x406dbd[_0x376f('0x19')](0xcc)[_0x376f('0x1a')]();});}};}function handleEntityNotFound(_0x4c4e19,_0x5e2870){return function(_0x1bd006){if(!_0x1bd006){_0x4c4e19[_0x376f('0x18')](0x194);}return _0x1bd006;};}function handleError(_0x70fb03,_0x2b2fe8){_0x2b2fe8=_0x2b2fe8||0x1f4;return function(_0x3fdccd){logger[_0x376f('0x25')](_0x3fdccd['stack']);if(_0x3fdccd[_0x376f('0x26')]){delete _0x3fdccd['name'];}_0x70fb03[_0x376f('0x19')](_0x2b2fe8)[_0x376f('0x27')](_0x3fdccd);};}exports['index']=function(_0x4f7f26,_0x39599b){var _0x56894e={},_0x5597a4={},_0x378a28={'count':0x0,'rows':[]};var _0x10969f=_[_0x376f('0x28')](db[_0x376f('0x29')]['rawAttributes'],function(_0x248ce4){return{'name':_0x248ce4[_0x376f('0x2a')],'type':_0x248ce4[_0x376f('0x2b')][_0x376f('0x2c')]};});_0x5597a4[_0x376f('0x2d')]=_[_0x376f('0x28')](_0x10969f,_0x376f('0x26'));_0x5597a4[_0x376f('0x2e')]=_[_0x376f('0x2f')](_0x4f7f26['query']);_0x5597a4[_0x376f('0x30')]=_['intersection'](_0x5597a4[_0x376f('0x2d')],_0x5597a4[_0x376f('0x2e')]);_0x56894e[_0x376f('0x31')]=_[_0x376f('0x32')](_0x5597a4['model'],qs[_0x376f('0x33')](_0x4f7f26[_0x376f('0x2e')][_0x376f('0x33')]));_0x56894e[_0x376f('0x31')]=_0x56894e[_0x376f('0x31')][_0x376f('0x34')]?_0x56894e['attributes']:_0x5597a4[_0x376f('0x2d')];if(!_0x4f7f26[_0x376f('0x2e')][_0x376f('0x35')](_0x376f('0x36'))){_0x56894e['limit']=qs[_0x376f('0x37')](_0x4f7f26['query'][_0x376f('0x37')]);_0x56894e[_0x376f('0x1d')]=qs[_0x376f('0x1d')](_0x4f7f26[_0x376f('0x2e')][_0x376f('0x1d')]);}_0x56894e[_0x376f('0x38')]=qs[_0x376f('0x39')](_0x4f7f26[_0x376f('0x2e')][_0x376f('0x39')]);_0x56894e[_0x376f('0x3a')]=qs[_0x376f('0x30')](_['pick'](_0x4f7f26[_0x376f('0x2e')],_0x5597a4[_0x376f('0x30')]));if(_0x4f7f26[_0x376f('0x2e')][_0x376f('0x3b')]){_0x56894e[_0x376f('0x3a')]=_['merge'](_0x56894e[_0x376f('0x3a')],{'$or':_['map'](_0x10969f,function(_0xd1e0d4){if(_0xd1e0d4[_0x376f('0x2b')]!==_0x376f('0x3c')){var _0x3643ae={};_0x3643ae[_0xd1e0d4['name']]={'$like':'%'+_0x4f7f26['query'][_0x376f('0x3b')]+'%'};return _0x3643ae;}})});}_0x56894e=_['merge']({},_0x56894e,_0x4f7f26['options']);var _0x2da704={'where':_0x56894e['where']};return db['OpenchannelTransferReport']['count'](_0x2da704)[_0x376f('0x23')](function(_0x54add5){_0x378a28[_0x376f('0x1c')]=_0x54add5;if(_0x4f7f26['query']['includeAll']){_0x56894e['include']=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x376f('0x3d')](_0x56894e);})['then'](function(_0xa0bdb5){_0x378a28[_0x376f('0x3e')]=_0xa0bdb5;return _0x378a28;})[_0x376f('0x23')](respondWithFilteredResult(_0x39599b,_0x56894e))[_0x376f('0x3f')](handleError(_0x39599b,null));};exports['show']=function(_0x1cc606,_0x4b0710){var _0x12e206={'raw':!![],'where':{'id':_0x1cc606[_0x376f('0x40')]['id']}},_0x5b697d={};_0x5b697d[_0x376f('0x2d')]=_[_0x376f('0x2f')](db[_0x376f('0x29')][_0x376f('0x41')]);_0x5b697d[_0x376f('0x2e')]=_['keys'](_0x1cc606[_0x376f('0x2e')]);_0x5b697d[_0x376f('0x30')]=_[_0x376f('0x32')](_0x5b697d[_0x376f('0x2d')],_0x5b697d[_0x376f('0x2e')]);_0x12e206['attributes']=_['intersection'](_0x5b697d['model'],qs[_0x376f('0x33')](_0x1cc606[_0x376f('0x2e')][_0x376f('0x33')]));_0x12e206['attributes']=_0x12e206['attributes'][_0x376f('0x34')]?_0x12e206[_0x376f('0x31')]:_0x5b697d['model'];if(_0x1cc606['query']['includeAll']){_0x12e206[_0x376f('0x42')]=[{'all':!![]}];}_0x12e206=_[_0x376f('0x43')]({},_0x12e206,_0x1cc606[_0x376f('0x44')]);return db[_0x376f('0x29')][_0x376f('0x45')](_0x12e206)['then'](handleEntityNotFound(_0x4b0710,null))[_0x376f('0x23')](respondWithResult(_0x4b0710,null))[_0x376f('0x3f')](handleError(_0x4b0710,null));};exports[_0x376f('0x46')]=function(_0x5f36a1,_0xfc322){return db[_0x376f('0x29')][_0x376f('0x46')](_0x5f36a1['body'],{})['then'](respondWithResult(_0xfc322,0xc9))[_0x376f('0x3f')](handleError(_0xfc322,null));};exports[_0x376f('0x47')]=function(_0x52f936,_0xfe536e){if(_0x52f936[_0x376f('0x48')]['id']){delete _0x52f936['body']['id'];}return db['OpenchannelTransferReport'][_0x376f('0x45')]({'where':{'id':_0x52f936[_0x376f('0x40')]['id']}})[_0x376f('0x23')](handleEntityNotFound(_0xfe536e,null))[_0x376f('0x23')](saveUpdates(_0x52f936[_0x376f('0x48')],null))[_0x376f('0x23')](respondWithResult(_0xfe536e,null))['catch'](handleError(_0xfe536e,null));};exports[_0x376f('0x24')]=function(_0x19d3eb,_0x2aac69){return db[_0x376f('0x29')][_0x376f('0x45')]({'where':{'id':_0x19d3eb[_0x376f('0x40')]['id']}})[_0x376f('0x23')](handleEntityNotFound(_0x2aac69,null))[_0x376f('0x23')](removeEntity(_0x2aac69,null))[_0x376f('0x3f')](handleError(_0x2aac69,null));};exports[_0x376f('0x49')]=function(_0x21c973,_0x5142bc){return db[_0x376f('0x29')]['describe']()[_0x376f('0x23')](respondWithResult(_0x5142bc,null))[_0x376f('0x3f')](handleError(_0x5142bc,null));}; \ No newline at end of file +var _0x561a=['../../mysqldb','sendStatus','end','status','json','count','offset','Content-Range','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x561a,0x1a9));var _0xa561=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0x561a[_0x376db5];return _0x304c17;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa561('0x0'));var rimraf=require(_0xa561('0x1'));var zipdir=require(_0xa561('0x2'));var jsonpatch=require(_0xa561('0x3'));var rp=require('request-promise');var moment=require(_0xa561('0x4'));var BPromise=require(_0xa561('0x5'));var Mustache=require(_0xa561('0x6'));var util=require(_0xa561('0x7'));var path=require(_0xa561('0x8'));var sox=require(_0xa561('0x9'));var csv=require(_0xa561('0xa'));var ejs=require(_0xa561('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa561('0xc'));var crypto=require(_0xa561('0xd'));var jsforce=require(_0xa561('0xe'));var deskjs=require(_0xa561('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa561('0x10'));var Papa=require(_0xa561('0x11'));var Redis=require('ioredis');var authService=require(_0xa561('0x12'));var qs=require(_0xa561('0x13'));var as=require(_0xa561('0x14'));var hardwareService=require(_0xa561('0x15'));var logger=require(_0xa561('0x16'))('api');var utils=require(_0xa561('0x17'));var config=require(_0xa561('0x18'));var db=require(_0xa561('0x19'))['db'];function respondWithStatusCode(_0x254d84,_0xba7dc2){_0xba7dc2=_0xba7dc2||0xcc;return function(_0x2cabc7){if(_0x2cabc7){return _0x254d84[_0xa561('0x1a')](_0xba7dc2);}return _0x254d84['status'](_0xba7dc2)[_0xa561('0x1b')]();};}function respondWithResult(_0x5e1f55,_0x1d2814){_0x1d2814=_0x1d2814||0xc8;return function(_0x41dbdf){if(_0x41dbdf){return _0x5e1f55[_0xa561('0x1c')](_0x1d2814)[_0xa561('0x1d')](_0x41dbdf);}};}function respondWithFilteredResult(_0x2764da,_0x509bfd){return function(_0x2507fe){if(_0x2507fe){var _0x3b1cad=_0x2507fe[_0xa561('0x1e')],_0x2a64df=_0x509bfd[_0xa561('0x1f')],_0x3fa486=_0x509bfd[_0xa561('0x1f')]+_0x509bfd['limit'],_0x3914af;if(_0x3fa486>=_0x3b1cad){_0x3fa486=_0x3b1cad;_0x3914af=0xc8;}else{_0x3914af=0xce;}_0x2764da['status'](_0x3914af);return _0x2764da['set'](_0xa561('0x20'),_0x2a64df+'-'+_0x3fa486+'/'+_0x3b1cad)[_0xa561('0x1d')](_0x2507fe);}return null;};}function patchUpdates(_0x1911b1){return function(_0xfcb67a){try{jsonpatch['apply'](_0xfcb67a,_0x1911b1,!![]);}catch(_0x5d9f0a){return BPromise['reject'](_0x5d9f0a);}return _0xfcb67a[_0xa561('0x21')]();};}function saveUpdates(_0x345422,_0x1862de){return function(_0x1407ab){if(_0x1407ab){return _0x1407ab[_0xa561('0x22')](_0x345422)[_0xa561('0x23')](function(_0x59faba){return _0x59faba;});}return null;};}function removeEntity(_0x39a617,_0x2e7e7c){return function(_0x183951){if(_0x183951){return _0x183951[_0xa561('0x24')]()[_0xa561('0x23')](function(){_0x39a617[_0xa561('0x1c')](0xcc)[_0xa561('0x1b')]();});}};}function handleEntityNotFound(_0x5d7e98,_0x1510d0){return function(_0x11c6b7){if(!_0x11c6b7){_0x5d7e98[_0xa561('0x1a')](0x194);}return _0x11c6b7;};}function handleError(_0x202363,_0x1c2469){_0x1c2469=_0x1c2469||0x1f4;return function(_0x193728){logger[_0xa561('0x25')](_0x193728[_0xa561('0x26')]);if(_0x193728[_0xa561('0x27')]){delete _0x193728[_0xa561('0x27')];}_0x202363[_0xa561('0x1c')](_0x1c2469)[_0xa561('0x28')](_0x193728);};}exports[_0xa561('0x29')]=function(_0x15e49e,_0x2a99a6){var _0x40da6f={},_0x50177d={},_0x57bf31={'count':0x0,'rows':[]};var _0x4ed770=_[_0xa561('0x2a')](db[_0xa561('0x2b')][_0xa561('0x2c')],function(_0x4f12a3){return{'name':_0x4f12a3['fieldName'],'type':_0x4f12a3['type']['key']};});_0x50177d[_0xa561('0x2d')]=_['map'](_0x4ed770,'name');_0x50177d[_0xa561('0x2e')]=_[_0xa561('0x2f')](_0x15e49e['query']);_0x50177d[_0xa561('0x30')]=_[_0xa561('0x31')](_0x50177d[_0xa561('0x2d')],_0x50177d[_0xa561('0x2e')]);_0x40da6f[_0xa561('0x32')]=_['intersection'](_0x50177d[_0xa561('0x2d')],qs['fields'](_0x15e49e[_0xa561('0x2e')][_0xa561('0x33')]));_0x40da6f['attributes']=_0x40da6f['attributes'][_0xa561('0x34')]?_0x40da6f[_0xa561('0x32')]:_0x50177d[_0xa561('0x2d')];if(!_0x15e49e[_0xa561('0x2e')][_0xa561('0x35')]('nolimit')){_0x40da6f[_0xa561('0x36')]=qs[_0xa561('0x36')](_0x15e49e[_0xa561('0x2e')][_0xa561('0x36')]);_0x40da6f[_0xa561('0x1f')]=qs[_0xa561('0x1f')](_0x15e49e[_0xa561('0x2e')][_0xa561('0x1f')]);}_0x40da6f[_0xa561('0x37')]=qs[_0xa561('0x38')](_0x15e49e[_0xa561('0x2e')][_0xa561('0x38')]);_0x40da6f[_0xa561('0x39')]=qs[_0xa561('0x30')](_[_0xa561('0x3a')](_0x15e49e[_0xa561('0x2e')],_0x50177d[_0xa561('0x30')]));if(_0x15e49e[_0xa561('0x2e')]['filter']){_0x40da6f[_0xa561('0x39')]=_[_0xa561('0x3b')](_0x40da6f[_0xa561('0x39')],{'$or':_[_0xa561('0x2a')](_0x4ed770,function(_0x154910){if(_0x154910[_0xa561('0x3c')]!==_0xa561('0x3d')){var _0x6492c8={};_0x6492c8[_0x154910[_0xa561('0x27')]]={'$like':'%'+_0x15e49e['query'][_0xa561('0x3e')]+'%'};return _0x6492c8;}})});}_0x40da6f=_[_0xa561('0x3b')]({},_0x40da6f,_0x15e49e[_0xa561('0x3f')]);var _0x5283b4={'where':_0x40da6f[_0xa561('0x39')]};return db[_0xa561('0x2b')][_0xa561('0x1e')](_0x5283b4)[_0xa561('0x23')](function(_0x374918){_0x57bf31['count']=_0x374918;if(_0x15e49e[_0xa561('0x2e')]['includeAll']){_0x40da6f[_0xa561('0x40')]=[{'all':!![]}];}return db[_0xa561('0x2b')][_0xa561('0x41')](_0x40da6f);})[_0xa561('0x23')](function(_0x2827d0){_0x57bf31[_0xa561('0x42')]=_0x2827d0;return _0x57bf31;})['then'](respondWithFilteredResult(_0x2a99a6,_0x40da6f))[_0xa561('0x43')](handleError(_0x2a99a6,null));};exports[_0xa561('0x44')]=function(_0x214585,_0x524db9){var _0x215f0f={'raw':!![],'where':{'id':_0x214585[_0xa561('0x45')]['id']}},_0x14e59f={};_0x14e59f[_0xa561('0x2d')]=_[_0xa561('0x2f')](db[_0xa561('0x2b')][_0xa561('0x2c')]);_0x14e59f['query']=_[_0xa561('0x2f')](_0x214585['query']);_0x14e59f[_0xa561('0x30')]=_[_0xa561('0x31')](_0x14e59f[_0xa561('0x2d')],_0x14e59f[_0xa561('0x2e')]);_0x215f0f['attributes']=_[_0xa561('0x31')](_0x14e59f[_0xa561('0x2d')],qs[_0xa561('0x33')](_0x214585[_0xa561('0x2e')][_0xa561('0x33')]));_0x215f0f[_0xa561('0x32')]=_0x215f0f[_0xa561('0x32')][_0xa561('0x34')]?_0x215f0f[_0xa561('0x32')]:_0x14e59f[_0xa561('0x2d')];if(_0x214585[_0xa561('0x2e')][_0xa561('0x46')]){_0x215f0f[_0xa561('0x40')]=[{'all':!![]}];}_0x215f0f=_[_0xa561('0x3b')]({},_0x215f0f,_0x214585[_0xa561('0x3f')]);return db[_0xa561('0x2b')][_0xa561('0x47')](_0x215f0f)[_0xa561('0x23')](handleEntityNotFound(_0x524db9,null))[_0xa561('0x23')](respondWithResult(_0x524db9,null))[_0xa561('0x43')](handleError(_0x524db9,null));};exports[_0xa561('0x48')]=function(_0x135d7a,_0xf2c733){return db['OpenchannelTransferReport']['create'](_0x135d7a[_0xa561('0x49')],{})['then'](respondWithResult(_0xf2c733,0xc9))[_0xa561('0x43')](handleError(_0xf2c733,null));};exports['update']=function(_0x156219,_0x2a8ec4){if(_0x156219[_0xa561('0x49')]['id']){delete _0x156219[_0xa561('0x49')]['id'];}return db[_0xa561('0x2b')][_0xa561('0x47')]({'where':{'id':_0x156219[_0xa561('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a8ec4,null))[_0xa561('0x23')](saveUpdates(_0x156219[_0xa561('0x49')],null))[_0xa561('0x23')](respondWithResult(_0x2a8ec4,null))[_0xa561('0x43')](handleError(_0x2a8ec4,null));};exports[_0xa561('0x24')]=function(_0x10fc5d,_0x298ad8){return db[_0xa561('0x2b')][_0xa561('0x47')]({'where':{'id':_0x10fc5d[_0xa561('0x45')]['id']}})[_0xa561('0x23')](handleEntityNotFound(_0x298ad8,null))[_0xa561('0x23')](removeEntity(_0x298ad8,null))['catch'](handleError(_0x298ad8,null));};exports[_0xa561('0x4a')]=function(_0x5f33a1,_0x1ea418){return db['OpenchannelTransferReport'][_0xa561('0x4a')]()[_0xa561('0x23')](respondWithResult(_0x1ea418,null))[_0xa561('0x43')](handleError(_0x1ea418,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 7eb1d96..5674a28 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 _0xbc8d=['uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer'];(function(_0x3bae6c,_0x2a0be4){var _0x2954e8=function(_0x2e7b20){while(--_0x2e7b20){_0x3bae6c['push'](_0x3bae6c['shift']());}};_0x2954e8(++_0x2a0be4);}(_0xbc8d,0x17a));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdbc8('0x0'));var util=require('util');var logger=require(_0xdbc8('0x1'))(_0xdbc8('0x2'));var moment=require(_0xdbc8('0x3'));var BPromise=require(_0xdbc8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdbc8('0x5'));var rimraf=require(_0xdbc8('0x6'));var config=require(_0xdbc8('0x7'));var attributes=require(_0xdbc8('0x8'));module[_0xdbc8('0x9')]=function(_0x55cd8b,_0x16bee1){return _0x55cd8b[_0xdbc8('0xa')]('OpenchannelTransferReport',attributes,{'tableName':_0xdbc8('0xb'),'paranoid':![],'indexes':[{'name':_0xdbc8('0xc'),'fields':[_0xdbc8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6613=['bluebird','request-promise','./openchannelTransferReport.attributes','exports','define','report_openchannel_transfer','uniqueid','lodash','util','api'];(function(_0xc6cd9,_0x24938f){var _0x39ca4b=function(_0x454857){while(--_0x454857){_0xc6cd9['push'](_0xc6cd9['shift']());}};_0x39ca4b(++_0x24938f);}(_0x6613,0x1b5));var _0x3661=function(_0x5c6a30,_0x498d4f){_0x5c6a30=_0x5c6a30-0x0;var _0x40dc55=_0x6613[_0x5c6a30];return _0x40dc55;};'use strict';var _=require(_0x3661('0x0'));var util=require(_0x3661('0x1'));var logger=require('../../config/logger')(_0x3661('0x2'));var moment=require('moment');var BPromise=require(_0x3661('0x3'));var rp=require(_0x3661('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3661('0x5'));module[_0x3661('0x6')]=function(_0xebd361,_0xd2270f){return _0xebd361[_0x3661('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x3661('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3661('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index b69bb12..30b3532 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 _0x2706=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','util'];(function(_0xf9d4aa,_0x3a58e1){var _0x5d32ed=function(_0x330f0c){while(--_0x330f0c){_0xf9d4aa['push'](_0xf9d4aa['shift']());}};_0x5d32ed(++_0x3a58e1);}(_0x2706,0x107));var _0x6270=function(_0x308189,_0x501a2b){_0x308189=_0x308189-0x0;var _0x468397=_0x2706[_0x308189];return _0x468397;};'use strict';var _=require('lodash');var util=require(_0x6270('0x0'));var moment=require(_0x6270('0x1'));var BPromise=require(_0x6270('0x2'));var rs=require(_0x6270('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6270('0x4'))['db'];var utils=require(_0x6270('0x5'));var logger=require(_0x6270('0x6'))(_0x6270('0x7'));var config=require(_0x6270('0x8'));var jayson=require(_0x6270('0x9'));var client=jayson[_0x6270('0xa')][_0x6270('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fac3f,_0x4f700e,_0x2e6a1b){return new BPromise(function(_0x585bc1,_0x35a6e3){return client[_0x6270('0xc')](_0x4fac3f,_0x2e6a1b)[_0x6270('0xd')](function(_0xea69a0){logger[_0x6270('0xe')](_0x6270('0xf'),_0x4f700e,'request\x20sent');logger[_0x6270('0x10')](_0x6270('0x11'),_0x4f700e,_0x6270('0x12'),JSON[_0x6270('0x13')](_0xea69a0));if(_0xea69a0[_0x6270('0x14')]){if(_0xea69a0['error']['code']===0x1f4){logger[_0x6270('0x14')](_0x6270('0xf'),_0x4f700e,_0xea69a0['error']['message']);return _0x35a6e3(_0xea69a0['error'][_0x6270('0x15')]);}logger['error'](_0x6270('0xf'),_0x4f700e,_0xea69a0['error']['message']);return _0x585bc1(_0xea69a0['error'][_0x6270('0x15')]);}else{logger[_0x6270('0xe')](_0x6270('0xf'),_0x4f700e,'request\x20sent');_0x585bc1(_0xea69a0['result'][_0x6270('0x15')]);}})['catch'](function(_0x26ceb9){logger[_0x6270('0x14')](_0x6270('0xf'),_0x4f700e,_0x26ceb9);_0x35a6e3(_0x26ceb9);});});} \ No newline at end of file +var _0x714b=['code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x714b,0xed));var _0xb714=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x714b[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xb714('0x0'));var moment=require(_0xb714('0x1'));var BPromise=require(_0xb714('0x2'));var rs=require(_0xb714('0x3'));var fs=require('fs');var Redis=require(_0xb714('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb714('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb714('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb714('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c83e7,_0x1339e5,_0x15c851){return new BPromise(function(_0x53f18a,_0x45cf6d){return client['request'](_0x3c83e7,_0x15c851)[_0xb714('0x8')](function(_0xf92413){logger['info'](_0xb714('0x9'),_0x1339e5,_0xb714('0xa'));logger[_0xb714('0xb')](_0xb714('0xc'),_0x1339e5,'request\x20sent',JSON[_0xb714('0xd')](_0xf92413));if(_0xf92413[_0xb714('0xe')]){if(_0xf92413[_0xb714('0xe')][_0xb714('0xf')]===0x1f4){logger[_0xb714('0xe')](_0xb714('0x9'),_0x1339e5,_0xf92413[_0xb714('0xe')][_0xb714('0x10')]);return _0x45cf6d(_0xf92413[_0xb714('0xe')][_0xb714('0x10')]);}logger[_0xb714('0xe')](_0xb714('0x9'),_0x1339e5,_0xf92413[_0xb714('0xe')][_0xb714('0x10')]);return _0x53f18a(_0xf92413['error']['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x1339e5,_0xb714('0xa'));_0x53f18a(_0xf92413['result'][_0xb714('0x10')]);}})[_0xb714('0x11')](function(_0x388f5d){logger['error'](_0xb714('0x9'),_0x1339e5,_0x388f5d);_0x45cf6d(_0x388f5d);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 8531a19..b474155 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 _0xaa9e=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','index','/:id','isAuthenticated','show'];(function(_0x445830,_0x3d15d0){var _0x14116b=function(_0x2d40a9){while(--_0x2d40a9){_0x445830['push'](_0x445830['shift']());}};_0x14116b(++_0x3d15d0);}(_0xaa9e,0x148));var _0xeaa9=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xaa9e[_0x525c7b];return _0x27b33e;};'use strict';var multer=require(_0xeaa9('0x0'));var util=require(_0xeaa9('0x1'));var path=require(_0xeaa9('0x2'));var timeout=require(_0xeaa9('0x3'));var express=require(_0xeaa9('0x4'));var router=express['Router']();var auth=require(_0xeaa9('0x5'));var interaction=require(_0xeaa9('0x6'));var config=require(_0xeaa9('0x7'));var controller=require(_0xeaa9('0x8'));router[_0xeaa9('0x9')]('/',auth['isAuthenticated'](),controller[_0xeaa9('0xa')]);router[_0xeaa9('0x9')](_0xeaa9('0xb'),auth[_0xeaa9('0xc')](),controller[_0xeaa9('0xd')]);router['post']('/',auth[_0xeaa9('0xc')](),controller[_0xeaa9('0xe')]);router[_0xeaa9('0xf')](_0xeaa9('0xb'),auth[_0xeaa9('0xc')](),controller[_0xeaa9('0x10')]);router[_0xeaa9('0x11')](_0xeaa9('0xb'),auth[_0xeaa9('0xc')](),controller[_0xeaa9('0x12')]);module['exports']=router; \ No newline at end of file +var _0x09d4=['index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated'];(function(_0x2465c0,_0x44e2b0){var _0x52ca9d=function(_0x5ce8f8){while(--_0x5ce8f8){_0x2465c0['push'](_0x2465c0['shift']());}};_0x52ca9d(++_0x44e2b0);}(_0x09d4,0x171));var _0x409d=function(_0x54eb4d,_0x55b9c8){_0x54eb4d=_0x54eb4d-0x0;var _0x4b15da=_0x09d4[_0x54eb4d];return _0x4b15da;};'use strict';var multer=require(_0x409d('0x0'));var util=require(_0x409d('0x1'));var path=require(_0x409d('0x2'));var timeout=require(_0x409d('0x3'));var express=require(_0x409d('0x4'));var router=express['Router']();var auth=require(_0x409d('0x5'));var interaction=require(_0x409d('0x6'));var config=require(_0x409d('0x7'));var controller=require(_0x409d('0x8'));router[_0x409d('0x9')]('/',auth[_0x409d('0xa')](),controller[_0x409d('0xb')]);router[_0x409d('0x9')](_0x409d('0xc'),auth[_0x409d('0xa')](),controller[_0x409d('0xd')]);router[_0x409d('0xe')]('/',auth[_0x409d('0xa')](),controller[_0x409d('0xf')]);router[_0x409d('0x10')](_0x409d('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x409d('0x11')](_0x409d('0xc'),auth[_0x409d('0xa')](),controller[_0x409d('0x12')]);module[_0x409d('0x13')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index db9bc97..7687fb6 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 _0x8cb5=['STRING','name','sequelize','exports'];(function(_0xb27b8b,_0x4e2965){var _0x356ea5=function(_0x3b65d6){while(--_0x3b65d6){_0xb27b8b['push'](_0xb27b8b['shift']());}};_0x356ea5(++_0x4e2965);}(_0x8cb5,0x6e));var _0x58cb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x8cb5[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x58cb('0x0'));module[_0x58cb('0x1')]={'name':{'type':Sequelize[_0x58cb('0x2')],'unique':_0x58cb('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x684c=['exports','STRING','name','sequelize'];(function(_0x15eab7,_0x49bed6){var _0x1f15c6=function(_0x33acb0){while(--_0x33acb0){_0x15eab7['push'](_0x15eab7['shift']());}};_0x1f15c6(++_0x49bed6);}(_0x684c,0x6f));var _0xc684=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x684c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc684('0x0'));module[_0xc684('0x1')]={'name':{'type':Sequelize[_0xc684('0x2')],'unique':_0xc684('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc684('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 6122ed5..e336888 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 _0xd639=['fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','params','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','get','Pauses','UserProfileResource','destroy','sendStatus','error','name','index','map','Pause','rawAttributes'];(function(_0x91ed5c,_0xdb6b34){var _0x2387d8=function(_0x1a9d15){while(--_0x1a9d15){_0x91ed5c['push'](_0x91ed5c['shift']());}};_0x2387d8(++_0xdb6b34);}(_0xd639,0x1b1));var _0x9d63=function(_0x59bf25,_0x21bcdf){_0x59bf25=_0x59bf25-0x0;var _0x42f222=_0xd639[_0x59bf25];return _0x42f222;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9d63('0x0'));var rimraf=require(_0x9d63('0x1'));var zipdir=require(_0x9d63('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9d63('0x3'));var moment=require(_0x9d63('0x4'));var BPromise=require(_0x9d63('0x5'));var Mustache=require(_0x9d63('0x6'));var util=require('util');var path=require(_0x9d63('0x7'));var sox=require(_0x9d63('0x8'));var csv=require(_0x9d63('0x9'));var ejs=require(_0x9d63('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9d63('0xb'));var crypto=require('crypto');var jsforce=require(_0x9d63('0xc'));var deskjs=require(_0x9d63('0xd'));var toCsv=require(_0x9d63('0x9'));var querystring=require('querystring');var Papa=require(_0x9d63('0xe'));var Redis=require(_0x9d63('0xf'));var authService=require(_0x9d63('0x10'));var qs=require(_0x9d63('0x11'));var as=require(_0x9d63('0x12'));var hardwareService=require(_0x9d63('0x13'));var logger=require(_0x9d63('0x14'))(_0x9d63('0x15'));var utils=require(_0x9d63('0x16'));var config=require(_0x9d63('0x17'));var db=require(_0x9d63('0x18'))['db'];function respondWithStatusCode(_0x47d72e,_0x1a50dc){_0x1a50dc=_0x1a50dc||0xcc;return function(_0x4de57c){if(_0x4de57c){return _0x47d72e['sendStatus'](_0x1a50dc);}return _0x47d72e[_0x9d63('0x19')](_0x1a50dc)[_0x9d63('0x1a')]();};}function respondWithResult(_0x2bc37a,_0x5069d4){_0x5069d4=_0x5069d4||0xc8;return function(_0x229e2c){if(_0x229e2c){return _0x2bc37a[_0x9d63('0x19')](_0x5069d4)[_0x9d63('0x1b')](_0x229e2c);}};}function respondWithFilteredResult(_0x168900,_0x361118){return function(_0x4e946d){if(_0x4e946d){var _0x56a94f=_0x4e946d[_0x9d63('0x1c')],_0x5742de=_0x361118[_0x9d63('0x1d')],_0x555bc0=_0x361118[_0x9d63('0x1d')]+_0x361118[_0x9d63('0x1e')],_0x436aaa;if(_0x555bc0>=_0x56a94f){_0x555bc0=_0x56a94f;_0x436aaa=0xc8;}else{_0x436aaa=0xce;}_0x168900[_0x9d63('0x19')](_0x436aaa);return _0x168900['set'](_0x9d63('0x1f'),_0x5742de+'-'+_0x555bc0+'/'+_0x56a94f)[_0x9d63('0x1b')](_0x4e946d);}return null;};}function patchUpdates(_0x329098){return function(_0x1d6c81){try{jsonpatch[_0x9d63('0x20')](_0x1d6c81,_0x329098,!![]);}catch(_0x394277){return BPromise[_0x9d63('0x21')](_0x394277);}return _0x1d6c81[_0x9d63('0x22')]();};}function saveUpdates(_0x5a0250,_0xd42853){return function(_0x283667){if(_0x283667){return _0x283667['update'](_0x5a0250)[_0x9d63('0x23')](function(_0x53ea7a){return _0x53ea7a;});}return null;};}function removeEntity(_0x30bef3,_0x18a48f){return function(_0x82791f){if(_0x82791f){return _0x82791f['destroy']()['then'](function(){var _0xb07f36=_0x82791f[_0x9d63('0x24')]({'plain':!![]});var _0x44e2f9=_0x9d63('0x25');return db[_0x9d63('0x26')][_0x9d63('0x27')]({'where':{'type':_0x44e2f9,'resourceId':_0xb07f36['id']}})[_0x9d63('0x23')](function(){return _0x82791f;});})['then'](function(){_0x30bef3[_0x9d63('0x19')](0xcc)[_0x9d63('0x1a')]();});}};}function handleEntityNotFound(_0xc6ca0,_0x4536c6){return function(_0xb93c9f){if(!_0xb93c9f){_0xc6ca0[_0x9d63('0x28')](0x194);}return _0xb93c9f;};}function handleError(_0x260b80,_0x4bee8e){_0x4bee8e=_0x4bee8e||0x1f4;return function(_0x10783a){logger[_0x9d63('0x29')](_0x10783a['stack']);if(_0x10783a[_0x9d63('0x2a')]){delete _0x10783a[_0x9d63('0x2a')];}_0x260b80[_0x9d63('0x19')](_0x4bee8e)['send'](_0x10783a);};}exports[_0x9d63('0x2b')]=function(_0x52593a,_0x34f6ec){var _0x11452e={},_0x371635={},_0x311e63={'count':0x0,'rows':[]};var _0x411533=_[_0x9d63('0x2c')](db[_0x9d63('0x2d')][_0x9d63('0x2e')],function(_0x5e8163){return{'name':_0x5e8163[_0x9d63('0x2f')],'type':_0x5e8163[_0x9d63('0x30')]['key']};});_0x371635[_0x9d63('0x31')]=_['map'](_0x411533,'name');_0x371635[_0x9d63('0x32')]=_[_0x9d63('0x33')](_0x52593a[_0x9d63('0x32')]);_0x371635[_0x9d63('0x34')]=_[_0x9d63('0x35')](_0x371635['model'],_0x371635[_0x9d63('0x32')]);_0x11452e[_0x9d63('0x36')]=_[_0x9d63('0x35')](_0x371635[_0x9d63('0x31')],qs[_0x9d63('0x37')](_0x52593a[_0x9d63('0x32')]['fields']));_0x11452e[_0x9d63('0x36')]=_0x11452e['attributes'][_0x9d63('0x38')]?_0x11452e['attributes']:_0x371635[_0x9d63('0x31')];if(!_0x52593a[_0x9d63('0x32')][_0x9d63('0x39')](_0x9d63('0x3a'))){_0x11452e[_0x9d63('0x1e')]=qs['limit'](_0x52593a[_0x9d63('0x32')]['limit']);_0x11452e[_0x9d63('0x1d')]=qs[_0x9d63('0x1d')](_0x52593a[_0x9d63('0x32')][_0x9d63('0x1d')]);}_0x11452e[_0x9d63('0x3b')]=qs[_0x9d63('0x3c')](_0x52593a[_0x9d63('0x32')]['sort']);_0x11452e[_0x9d63('0x3d')]=qs[_0x9d63('0x34')](_[_0x9d63('0x3e')](_0x52593a['query'],_0x371635[_0x9d63('0x34')]));if(_0x52593a[_0x9d63('0x32')][_0x9d63('0x3f')]){_0x11452e[_0x9d63('0x3d')]=_[_0x9d63('0x40')](_0x11452e['where'],{'$or':_[_0x9d63('0x2c')](_0x411533,function(_0x1f2f8a){if(_0x1f2f8a[_0x9d63('0x30')]!==_0x9d63('0x41')){var _0x420071={};_0x420071[_0x1f2f8a[_0x9d63('0x2a')]]={'$like':'%'+_0x52593a[_0x9d63('0x32')][_0x9d63('0x3f')]+'%'};return _0x420071;}})});}_0x11452e=_['merge']({},_0x11452e,_0x52593a[_0x9d63('0x42')]);var _0x51602a={'where':_0x11452e[_0x9d63('0x3d')]};return db['Pause'][_0x9d63('0x1c')](_0x51602a)[_0x9d63('0x23')](function(_0x50b12d){_0x311e63[_0x9d63('0x1c')]=_0x50b12d;if(_0x52593a[_0x9d63('0x32')]['includeAll']){_0x11452e['include']=[{'all':!![]}];}return db[_0x9d63('0x2d')]['findAll'](_0x11452e);})[_0x9d63('0x23')](function(_0x2d0440){_0x311e63[_0x9d63('0x43')]=_0x2d0440;return _0x311e63;})['then'](respondWithFilteredResult(_0x34f6ec,_0x11452e))[_0x9d63('0x44')](handleError(_0x34f6ec,null));};exports['show']=function(_0x3a53c2,_0x1b5f4a){var _0x142dfe={'raw':!![],'where':{'id':_0x3a53c2[_0x9d63('0x45')]['id']}},_0x136e6d={};_0x136e6d[_0x9d63('0x31')]=_[_0x9d63('0x33')](db[_0x9d63('0x2d')][_0x9d63('0x2e')]);_0x136e6d[_0x9d63('0x32')]=_[_0x9d63('0x33')](_0x3a53c2[_0x9d63('0x32')]);_0x136e6d[_0x9d63('0x34')]=_[_0x9d63('0x35')](_0x136e6d[_0x9d63('0x31')],_0x136e6d[_0x9d63('0x32')]);_0x142dfe[_0x9d63('0x36')]=_[_0x9d63('0x35')](_0x136e6d['model'],qs[_0x9d63('0x37')](_0x3a53c2['query']['fields']));_0x142dfe['attributes']=_0x142dfe[_0x9d63('0x36')][_0x9d63('0x38')]?_0x142dfe[_0x9d63('0x36')]:_0x136e6d[_0x9d63('0x31')];if(_0x3a53c2[_0x9d63('0x32')]['includeAll']){_0x142dfe['include']=[{'all':!![]}];}_0x142dfe=_['merge']({},_0x142dfe,_0x3a53c2[_0x9d63('0x42')]);return db[_0x9d63('0x2d')]['find'](_0x142dfe)[_0x9d63('0x23')](handleEntityNotFound(_0x1b5f4a,null))[_0x9d63('0x23')](respondWithResult(_0x1b5f4a,null))[_0x9d63('0x44')](handleError(_0x1b5f4a,null));};exports[_0x9d63('0x46')]=function(_0x1b1353,_0x29281f){return db[_0x9d63('0x2d')][_0x9d63('0x46')](_0x1b1353['body'],{})[_0x9d63('0x23')](function(_0x7ba95b){var _0x37bc9a=_0x1b1353[_0x9d63('0x47')]['get']({'plain':!![]});if(!_0x37bc9a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37bc9a[_0x9d63('0x48')]===_0x9d63('0x47')){var _0x3b50e5=_0x7ba95b['get']({'plain':!![]});var _0x3156dc='Pauses';return db[_0x9d63('0x49')][_0x9d63('0x4a')]({'where':{'name':_0x3156dc,'userProfileId':_0x37bc9a[_0x9d63('0x4b')]},'raw':!![]})[_0x9d63('0x23')](function(_0x137149){if(_0x137149&&_0x137149[_0x9d63('0x4c')]===0x0){return db[_0x9d63('0x26')][_0x9d63('0x46')]({'name':_0x3b50e5[_0x9d63('0x2a')],'resourceId':_0x3b50e5['id'],'type':_0x137149[_0x9d63('0x2a')],'sectionId':_0x137149['id']},{})[_0x9d63('0x23')](function(){return _0x7ba95b;});}else{return _0x7ba95b;}})[_0x9d63('0x44')](function(_0x6ac14){logger[_0x9d63('0x29')](_0x9d63('0x4d'),_0x6ac14);throw _0x6ac14;});}return _0x7ba95b;})[_0x9d63('0x23')](respondWithResult(_0x29281f,0xc9))[_0x9d63('0x44')](handleError(_0x29281f,null));};exports[_0x9d63('0x4e')]=function(_0x10265e,_0x41c40d){if(_0x10265e[_0x9d63('0x4f')]['id']){delete _0x10265e[_0x9d63('0x4f')]['id'];}return db[_0x9d63('0x2d')][_0x9d63('0x4a')]({'where':{'id':_0x10265e['params']['id']}})[_0x9d63('0x23')](handleEntityNotFound(_0x41c40d,null))['then'](saveUpdates(_0x10265e[_0x9d63('0x4f')],null))[_0x9d63('0x23')](respondWithResult(_0x41c40d,null))[_0x9d63('0x44')](handleError(_0x41c40d,null));};exports[_0x9d63('0x27')]=function(_0xde97aa,_0x588860){return db[_0x9d63('0x2d')]['find']({'where':{'id':_0xde97aa['params']['id']}})[_0x9d63('0x23')](handleEntityNotFound(_0x588860,null))[_0x9d63('0x23')](removeEntity(_0x588860,null))[_0x9d63('0x44')](handleError(_0x588860,null));}; \ No newline at end of file +var _0xf955=['util','path','ejs','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','Pauses','error','stack','name','send','map','Pause','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0xf955,0x176));var _0x5f95=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xf955[_0x3c4737];return _0x2bb926;};'use strict';var pdf=require(_0x5f95('0x0'));var emlformat=require(_0x5f95('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5f95('0x2'));var jsonpatch=require(_0x5f95('0x3'));var rp=require(_0x5f95('0x4'));var moment=require('moment');var BPromise=require(_0x5f95('0x5'));var Mustache=require('mustache');var util=require(_0x5f95('0x6'));var path=require(_0x5f95('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5f95('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5f95('0x9'));var crypto=require('crypto');var jsforce=require(_0x5f95('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5f95('0xb'));var Papa=require(_0x5f95('0xc'));var Redis=require(_0x5f95('0xd'));var authService=require(_0x5f95('0xe'));var qs=require(_0x5f95('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f95('0x10'));var logger=require('../../config/logger')(_0x5f95('0x11'));var utils=require(_0x5f95('0x12'));var config=require('../../config/environment');var db=require(_0x5f95('0x13'))['db'];function respondWithStatusCode(_0x105963,_0x5674e9){_0x5674e9=_0x5674e9||0xcc;return function(_0x59b041){if(_0x59b041){return _0x105963[_0x5f95('0x14')](_0x5674e9);}return _0x105963['status'](_0x5674e9)[_0x5f95('0x15')]();};}function respondWithResult(_0x8b6a44,_0xcc9668){_0xcc9668=_0xcc9668||0xc8;return function(_0x5aa243){if(_0x5aa243){return _0x8b6a44[_0x5f95('0x16')](_0xcc9668)[_0x5f95('0x17')](_0x5aa243);}};}function respondWithFilteredResult(_0x418063,_0x35fa25){return function(_0x3b0535){if(_0x3b0535){var _0x119ede=_0x3b0535[_0x5f95('0x18')],_0x1d61a1=_0x35fa25[_0x5f95('0x19')],_0x4e57f3=_0x35fa25[_0x5f95('0x19')]+_0x35fa25[_0x5f95('0x1a')],_0x2d613c;if(_0x4e57f3>=_0x119ede){_0x4e57f3=_0x119ede;_0x2d613c=0xc8;}else{_0x2d613c=0xce;}_0x418063[_0x5f95('0x16')](_0x2d613c);return _0x418063[_0x5f95('0x1b')](_0x5f95('0x1c'),_0x1d61a1+'-'+_0x4e57f3+'/'+_0x119ede)[_0x5f95('0x17')](_0x3b0535);}return null;};}function patchUpdates(_0x553cfe){return function(_0x1f8781){try{jsonpatch[_0x5f95('0x1d')](_0x1f8781,_0x553cfe,!![]);}catch(_0x397ec9){return BPromise[_0x5f95('0x1e')](_0x397ec9);}return _0x1f8781[_0x5f95('0x1f')]();};}function saveUpdates(_0x515fcb,_0x10a2d6){return function(_0x1457b1){if(_0x1457b1){return _0x1457b1['update'](_0x515fcb)['then'](function(_0x1e3a6c){return _0x1e3a6c;});}return null;};}function removeEntity(_0x2d9dc9,_0x44d994){return function(_0x429908){if(_0x429908){return _0x429908[_0x5f95('0x20')]()[_0x5f95('0x21')](function(){var _0x43d8aa=_0x429908[_0x5f95('0x22')]({'plain':!![]});var _0x157498=_0x5f95('0x23');return db['UserProfileResource'][_0x5f95('0x20')]({'where':{'type':_0x157498,'resourceId':_0x43d8aa['id']}})[_0x5f95('0x21')](function(){return _0x429908;});})['then'](function(){_0x2d9dc9[_0x5f95('0x16')](0xcc)[_0x5f95('0x15')]();});}};}function handleEntityNotFound(_0x343d63,_0x1b9a1e){return function(_0x58857b){if(!_0x58857b){_0x343d63['sendStatus'](0x194);}return _0x58857b;};}function handleError(_0x4d7e64,_0x459889){_0x459889=_0x459889||0x1f4;return function(_0x5d73a2){logger[_0x5f95('0x24')](_0x5d73a2[_0x5f95('0x25')]);if(_0x5d73a2['name']){delete _0x5d73a2[_0x5f95('0x26')];}_0x4d7e64['status'](_0x459889)[_0x5f95('0x27')](_0x5d73a2);};}exports['index']=function(_0x1c3fea,_0x2fb5e5){var _0x2fa941={},_0x535b01={},_0xe182fb={'count':0x0,'rows':[]};var _0x245dbb=_[_0x5f95('0x28')](db[_0x5f95('0x29')]['rawAttributes'],function(_0x16901){return{'name':_0x16901[_0x5f95('0x2a')],'type':_0x16901[_0x5f95('0x2b')][_0x5f95('0x2c')]};});_0x535b01['model']=_[_0x5f95('0x28')](_0x245dbb,_0x5f95('0x26'));_0x535b01['query']=_[_0x5f95('0x2d')](_0x1c3fea[_0x5f95('0x2e')]);_0x535b01[_0x5f95('0x2f')]=_[_0x5f95('0x30')](_0x535b01['model'],_0x535b01[_0x5f95('0x2e')]);_0x2fa941['attributes']=_[_0x5f95('0x30')](_0x535b01[_0x5f95('0x31')],qs[_0x5f95('0x32')](_0x1c3fea[_0x5f95('0x2e')][_0x5f95('0x32')]));_0x2fa941[_0x5f95('0x33')]=_0x2fa941[_0x5f95('0x33')][_0x5f95('0x34')]?_0x2fa941[_0x5f95('0x33')]:_0x535b01[_0x5f95('0x31')];if(!_0x1c3fea[_0x5f95('0x2e')][_0x5f95('0x35')](_0x5f95('0x36'))){_0x2fa941[_0x5f95('0x1a')]=qs[_0x5f95('0x1a')](_0x1c3fea[_0x5f95('0x2e')][_0x5f95('0x1a')]);_0x2fa941[_0x5f95('0x19')]=qs[_0x5f95('0x19')](_0x1c3fea['query'][_0x5f95('0x19')]);}_0x2fa941['order']=qs[_0x5f95('0x37')](_0x1c3fea['query'][_0x5f95('0x37')]);_0x2fa941['where']=qs[_0x5f95('0x2f')](_['pick'](_0x1c3fea[_0x5f95('0x2e')],_0x535b01['filters']));if(_0x1c3fea['query']['filter']){_0x2fa941[_0x5f95('0x38')]=_[_0x5f95('0x39')](_0x2fa941[_0x5f95('0x38')],{'$or':_[_0x5f95('0x28')](_0x245dbb,function(_0x3f1da8){if(_0x3f1da8[_0x5f95('0x2b')]!=='VIRTUAL'){var _0x3d9d9d={};_0x3d9d9d[_0x3f1da8[_0x5f95('0x26')]]={'$like':'%'+_0x1c3fea[_0x5f95('0x2e')]['filter']+'%'};return _0x3d9d9d;}})});}_0x2fa941=_[_0x5f95('0x39')]({},_0x2fa941,_0x1c3fea[_0x5f95('0x3a')]);var _0x167dc3={'where':_0x2fa941['where']};return db[_0x5f95('0x29')][_0x5f95('0x18')](_0x167dc3)[_0x5f95('0x21')](function(_0x5b58e7){_0xe182fb[_0x5f95('0x18')]=_0x5b58e7;if(_0x1c3fea[_0x5f95('0x2e')][_0x5f95('0x3b')]){_0x2fa941[_0x5f95('0x3c')]=[{'all':!![]}];}return db[_0x5f95('0x29')]['findAll'](_0x2fa941);})[_0x5f95('0x21')](function(_0xec4b4c){_0xe182fb[_0x5f95('0x3d')]=_0xec4b4c;return _0xe182fb;})['then'](respondWithFilteredResult(_0x2fb5e5,_0x2fa941))[_0x5f95('0x3e')](handleError(_0x2fb5e5,null));};exports[_0x5f95('0x3f')]=function(_0x2a86e6,_0x41ec39){var _0x517b86={'raw':!![],'where':{'id':_0x2a86e6[_0x5f95('0x40')]['id']}},_0x4b6ec1={};_0x4b6ec1[_0x5f95('0x31')]=_[_0x5f95('0x2d')](db[_0x5f95('0x29')][_0x5f95('0x41')]);_0x4b6ec1[_0x5f95('0x2e')]=_[_0x5f95('0x2d')](_0x2a86e6[_0x5f95('0x2e')]);_0x4b6ec1[_0x5f95('0x2f')]=_[_0x5f95('0x30')](_0x4b6ec1[_0x5f95('0x31')],_0x4b6ec1[_0x5f95('0x2e')]);_0x517b86[_0x5f95('0x33')]=_[_0x5f95('0x30')](_0x4b6ec1[_0x5f95('0x31')],qs['fields'](_0x2a86e6[_0x5f95('0x2e')][_0x5f95('0x32')]));_0x517b86['attributes']=_0x517b86['attributes'][_0x5f95('0x34')]?_0x517b86['attributes']:_0x4b6ec1['model'];if(_0x2a86e6[_0x5f95('0x2e')]['includeAll']){_0x517b86[_0x5f95('0x3c')]=[{'all':!![]}];}_0x517b86=_['merge']({},_0x517b86,_0x2a86e6['options']);return db[_0x5f95('0x29')][_0x5f95('0x42')](_0x517b86)[_0x5f95('0x21')](handleEntityNotFound(_0x41ec39,null))[_0x5f95('0x21')](respondWithResult(_0x41ec39,null))[_0x5f95('0x3e')](handleError(_0x41ec39,null));};exports[_0x5f95('0x43')]=function(_0x2471f6,_0x18047e){return db[_0x5f95('0x29')][_0x5f95('0x43')](_0x2471f6[_0x5f95('0x44')],{})[_0x5f95('0x21')](function(_0x2f4cd5){var _0x31a4cd=_0x2471f6[_0x5f95('0x45')][_0x5f95('0x22')]({'plain':!![]});if(!_0x31a4cd)throw new Error(_0x5f95('0x46'));if(_0x31a4cd[_0x5f95('0x47')]===_0x5f95('0x45')){var _0x551307=_0x2f4cd5[_0x5f95('0x22')]({'plain':!![]});var _0x4e00ba='Pauses';return db[_0x5f95('0x48')]['find']({'where':{'name':_0x4e00ba,'userProfileId':_0x31a4cd[_0x5f95('0x49')]},'raw':!![]})[_0x5f95('0x21')](function(_0x11b8f9){if(_0x11b8f9&&_0x11b8f9[_0x5f95('0x4a')]===0x0){return db['UserProfileResource'][_0x5f95('0x43')]({'name':_0x551307['name'],'resourceId':_0x551307['id'],'type':_0x11b8f9[_0x5f95('0x26')],'sectionId':_0x11b8f9['id']},{})[_0x5f95('0x21')](function(){return _0x2f4cd5;});}else{return _0x2f4cd5;}})[_0x5f95('0x3e')](function(_0x3ca157){logger[_0x5f95('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ca157);throw _0x3ca157;});}return _0x2f4cd5;})['then'](respondWithResult(_0x18047e,0xc9))['catch'](handleError(_0x18047e,null));};exports[_0x5f95('0x4b')]=function(_0x6bb44c,_0x4a25b1){if(_0x6bb44c[_0x5f95('0x44')]['id']){delete _0x6bb44c[_0x5f95('0x44')]['id'];}return db['Pause'][_0x5f95('0x42')]({'where':{'id':_0x6bb44c[_0x5f95('0x40')]['id']}})[_0x5f95('0x21')](handleEntityNotFound(_0x4a25b1,null))['then'](saveUpdates(_0x6bb44c[_0x5f95('0x44')],null))['then'](respondWithResult(_0x4a25b1,null))[_0x5f95('0x3e')](handleError(_0x4a25b1,null));};exports[_0x5f95('0x20')]=function(_0x3b3236,_0x557fda){return db[_0x5f95('0x29')][_0x5f95('0x42')]({'where':{'id':_0x3b3236[_0x5f95('0x40')]['id']}})[_0x5f95('0x21')](handleEntityNotFound(_0x557fda,null))['then'](removeEntity(_0x557fda,null))[_0x5f95('0x3e')](handleError(_0x557fda,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index f6402fe..56ad02f 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 _0xdf4d=['rimraf','../../config/environment','define','Pause','tools_pauses','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x17c5d4,_0x54ed79){var _0x1fcf5f=function(_0x4bf1d8){while(--_0x4bf1d8){_0x17c5d4['push'](_0x17c5d4['shift']());}};_0x1fcf5f(++_0x54ed79);}(_0xdf4d,0xcb));var _0xddf4=function(_0x358881,_0x1b748c){_0x358881=_0x358881-0x0;var _0x76792d=_0xdf4d[_0x358881];return _0x76792d;};'use strict';var _=require('lodash');var util=require(_0xddf4('0x0'));var logger=require(_0xddf4('0x1'))('api');var moment=require(_0xddf4('0x2'));var BPromise=require(_0xddf4('0x3'));var rp=require(_0xddf4('0x4'));var fs=require('fs');var path=require(_0xddf4('0x5'));var rimraf=require(_0xddf4('0x6'));var config=require(_0xddf4('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1472f7,_0x33cca5){return _0x1472f7[_0xddf4('0x8')](_0xddf4('0x9'),attributes,{'tableName':_0xddf4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4dc=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x1ebdc9,_0x2b1455){var _0x175c0c=function(_0x480ed1){while(--_0x480ed1){_0x1ebdc9['push'](_0x1ebdc9['shift']());}};_0x175c0c(++_0x2b1455);}(_0xd4dc,0xff));var _0xcd4d=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xd4dc[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0xcd4d('0x0'));var util=require('util');var logger=require(_0xcd4d('0x1'))(_0xcd4d('0x2'));var moment=require(_0xcd4d('0x3'));var BPromise=require(_0xcd4d('0x4'));var rp=require(_0xcd4d('0x5'));var fs=require('fs');var path=require(_0xcd4d('0x6'));var rimraf=require(_0xcd4d('0x7'));var config=require('../../config/environment');var attributes=require(_0xcd4d('0x8'));module['exports']=function(_0x5d70fb,_0x3c5bbd){return _0x5d70fb['define'](_0xcd4d('0x9'),attributes,{'tableName':_0xcd4d('0xa'),'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 e72ed3a..32a2f70 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 _0xf21a=['stringify','error','code','Pause,\x20%s,\x20%s','message','info','catch','ShowPause','Pause','find','options','raw','where','attributes','include','map','model','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','debug','Pause,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf21a,0x1aa));var _0xaf21=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xf21a[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xaf21('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaf21('0x1'));var rs=require(_0xaf21('0x2'));var fs=require('fs');var Redis=require(_0xaf21('0x3'));var db=require(_0xaf21('0x4'))['db'];var utils=require(_0xaf21('0x5'));var logger=require(_0xaf21('0x6'))(_0xaf21('0x7'));var config=require(_0xaf21('0x8'));var jayson=require(_0xaf21('0x9'));var client=jayson[_0xaf21('0xa')][_0xaf21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x561470,_0x166466,_0x1340bf){return new BPromise(function(_0x37f5d0,_0x2137c6){return client[_0xaf21('0xc')](_0x561470,_0x1340bf)['then'](function(_0x33e7e7){logger['info']('Pause,\x20%s,\x20%s',_0x166466,'request\x20sent');logger[_0xaf21('0xd')](_0xaf21('0xe'),_0x166466,_0xaf21('0xf'),JSON[_0xaf21('0x10')](_0x33e7e7));if(_0x33e7e7[_0xaf21('0x11')]){if(_0x33e7e7[_0xaf21('0x11')][_0xaf21('0x12')]===0x1f4){logger[_0xaf21('0x11')](_0xaf21('0x13'),_0x166466,_0x33e7e7[_0xaf21('0x11')]['message']);return _0x2137c6(_0x33e7e7[_0xaf21('0x11')][_0xaf21('0x14')]);}logger[_0xaf21('0x11')](_0xaf21('0x13'),_0x166466,_0x33e7e7[_0xaf21('0x11')][_0xaf21('0x14')]);return _0x37f5d0(_0x33e7e7[_0xaf21('0x11')]['message']);}else{logger[_0xaf21('0x15')](_0xaf21('0x13'),_0x166466,_0xaf21('0xf'));_0x37f5d0(_0x33e7e7['result']['message']);}})[_0xaf21('0x16')](function(_0x36c92f){logger[_0xaf21('0x11')](_0xaf21('0x13'),_0x166466,_0x36c92f);_0x2137c6(_0x36c92f);});});}exports[_0xaf21('0x17')]=function(_0x26eb37){var _0x1119b4=this;return new Promise(function(_0x9293ab,_0x233b81){return db[_0xaf21('0x18')][_0xaf21('0x19')]({'raw':_0x26eb37[_0xaf21('0x1a')]?_0x26eb37[_0xaf21('0x1a')][_0xaf21('0x1b')]===undefined?!![]:![]:!![],'where':_0x26eb37[_0xaf21('0x1a')]?_0x26eb37[_0xaf21('0x1a')][_0xaf21('0x1c')]||null:null,'attributes':_0x26eb37[_0xaf21('0x1a')]?_0x26eb37['options'][_0xaf21('0x1d')]||null:null,'include':_0x26eb37[_0xaf21('0x1a')]?_0x26eb37[_0xaf21('0x1a')][_0xaf21('0x1e')]?_[_0xaf21('0x1f')](_0x26eb37[_0xaf21('0x1a')][_0xaf21('0x1e')],function(_0x25fc88){return{'model':db[_0x25fc88['model']],'as':_0x25fc88['as'],'attributes':_0x25fc88[_0xaf21('0x1d')],'include':_0x25fc88['include']?_['map'](_0x25fc88[_0xaf21('0x1e')],function(_0x35fabf){return{'model':db[_0x35fabf[_0xaf21('0x20')]],'as':_0x35fabf['as'],'attributes':_0x35fabf[_0xaf21('0x1d')],'include':_0x35fabf['include']?_[_0xaf21('0x1f')](_0x35fabf['include'],function(_0x34ac6a){return{'model':db[_0x34ac6a[_0xaf21('0x20')]],'as':_0x34ac6a['as'],'attributes':_0x34ac6a[_0xaf21('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaf21('0x21')](function(_0x4db715){logger['info'](_0xaf21('0x17'),_0x26eb37);logger[_0xaf21('0xd')](_0xaf21('0x17'),_0x26eb37,JSON[_0xaf21('0x10')](_0x4db715));_0x9293ab(_0x4db715);})[_0xaf21('0x16')](function(_0x558e0f){logger[_0xaf21('0x11')](_0xaf21('0x17'),_0x558e0f[_0xaf21('0x14')],_0x26eb37);_0x233b81(_0x1119b4[_0xaf21('0x11')](0x1f4,_0x558e0f['message']));});});}; \ No newline at end of file +var _0x04cc=['find','options','attributes','include','map','model','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug','error','code','Pause,\x20%s,\x20%s','message','ShowPause','Pause'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x04cc,0x10d));var _0xc04c=function(_0x169790,_0x48aa33){_0x169790=_0x169790-0x0;var _0x4d0f36=_0x04cc[_0x169790];return _0x4d0f36;};'use strict';var _=require(_0xc04c('0x0'));var util=require(_0xc04c('0x1'));var moment=require(_0xc04c('0x2'));var BPromise=require('bluebird');var rs=require(_0xc04c('0x3'));var fs=require('fs');var Redis=require(_0xc04c('0x4'));var db=require(_0xc04c('0x5'))['db'];var utils=require(_0xc04c('0x6'));var logger=require(_0xc04c('0x7'))('rpc');var config=require(_0xc04c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc04c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x321533,_0x4bbe70,_0x4a1cd3){return new BPromise(function(_0x1534d4,_0x3699ca){return client[_0xc04c('0xa')](_0x321533,_0x4a1cd3)[_0xc04c('0xb')](function(_0x440084){logger[_0xc04c('0xc')]('Pause,\x20%s,\x20%s',_0x4bbe70,_0xc04c('0xd'));logger[_0xc04c('0xe')]('Pause,\x20%s,\x20%s,\x20%s',_0x4bbe70,_0xc04c('0xd'),JSON['stringify'](_0x440084));if(_0x440084[_0xc04c('0xf')]){if(_0x440084[_0xc04c('0xf')][_0xc04c('0x10')]===0x1f4){logger[_0xc04c('0xf')](_0xc04c('0x11'),_0x4bbe70,_0x440084[_0xc04c('0xf')][_0xc04c('0x12')]);return _0x3699ca(_0x440084[_0xc04c('0xf')]['message']);}logger[_0xc04c('0xf')](_0xc04c('0x11'),_0x4bbe70,_0x440084[_0xc04c('0xf')][_0xc04c('0x12')]);return _0x1534d4(_0x440084['error'][_0xc04c('0x12')]);}else{logger[_0xc04c('0xc')](_0xc04c('0x11'),_0x4bbe70,_0xc04c('0xd'));_0x1534d4(_0x440084['result'][_0xc04c('0x12')]);}})['catch'](function(_0x416031){logger[_0xc04c('0xf')](_0xc04c('0x11'),_0x4bbe70,_0x416031);_0x3699ca(_0x416031);});});}exports[_0xc04c('0x13')]=function(_0x34757a){var _0x59d334=this;return new Promise(function(_0x14d60e,_0x44d514){return db[_0xc04c('0x14')][_0xc04c('0x15')]({'raw':_0x34757a[_0xc04c('0x16')]?_0x34757a[_0xc04c('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x34757a[_0xc04c('0x16')]?_0x34757a[_0xc04c('0x16')]['where']||null:null,'attributes':_0x34757a[_0xc04c('0x16')]?_0x34757a['options'][_0xc04c('0x17')]||null:null,'include':_0x34757a[_0xc04c('0x16')]?_0x34757a[_0xc04c('0x16')][_0xc04c('0x18')]?_[_0xc04c('0x19')](_0x34757a[_0xc04c('0x16')][_0xc04c('0x18')],function(_0x341d49){return{'model':db[_0x341d49[_0xc04c('0x1a')]],'as':_0x341d49['as'],'attributes':_0x341d49[_0xc04c('0x17')],'include':_0x341d49['include']?_['map'](_0x341d49['include'],function(_0x25c10d){return{'model':db[_0x25c10d[_0xc04c('0x1a')]],'as':_0x25c10d['as'],'attributes':_0x25c10d[_0xc04c('0x17')],'include':_0x25c10d[_0xc04c('0x18')]?_[_0xc04c('0x19')](_0x25c10d[_0xc04c('0x18')],function(_0xb5d96e){return{'model':db[_0xb5d96e['model']],'as':_0xb5d96e['as'],'attributes':_0xb5d96e[_0xc04c('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc04c('0xb')](function(_0x5e67b0){logger[_0xc04c('0xc')](_0xc04c('0x13'),_0x34757a);logger['debug'](_0xc04c('0x13'),_0x34757a,JSON[_0xc04c('0x1b')](_0x5e67b0));_0x14d60e(_0x5e67b0);})[_0xc04c('0x1c')](function(_0x31f038){logger[_0xc04c('0xf')](_0xc04c('0x13'),_0x31f038[_0xc04c('0x12')],_0x34757a);_0x44d514(_0x59d334[_0xc04c('0xf')](0x1f4,_0x31f038[_0xc04c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 6c57c73..55ace8e 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 _0xa201=['originalname','replace','format','basename','extname','post','single','file','/webhook','webhookPost','put','update','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins'];(function(_0x596fba,_0x34ad5e){var _0x3ed0f8=function(_0x771b4d){while(--_0x771b4d){_0x596fba['push'](_0x596fba['shift']());}};_0x3ed0f8(++_0x34ad5e);}(_0xa201,0x8d));var _0x1a20=function(_0x5c9a1c,_0x5d85e1){_0x5c9a1c=_0x5c9a1c-0x0;var _0x63d9ce=_0xa201[_0x5c9a1c];return _0x63d9ce;};'use strict';var multer=require(_0x1a20('0x0'));var util=require('util');var path=require(_0x1a20('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1a20('0x2')]();var auth=require(_0x1a20('0x3'));var interaction=require(_0x1a20('0x4'));var config=require(_0x1a20('0x5'));var controller=require(_0x1a20('0x6'));router['get']('/',auth[_0x1a20('0x7')](),controller[_0x1a20('0x8')]);router[_0x1a20('0x9')]('/webhook',controller[_0x1a20('0xa')]);router[_0x1a20('0x9')](_0x1a20('0xb'),auth[_0x1a20('0x7')](),controller[_0x1a20('0xc')]);router['get'](_0x1a20('0xd'),auth[_0x1a20('0x7')](),controller[_0x1a20('0xe')]);var upload=multer({'storage':multer[_0x1a20('0xf')]({'destination':function(_0x33c2af,_0x47c2a4,_0x1a3fdc){_0x1a3fdc(null,path[_0x1a20('0x10')](config[_0x1a20('0x11')],_0x1a20('0x12')));},'filename':function(_0x55ed66,_0x12bff6,_0x8c777e){_0x12bff6[_0x1a20('0x13')]=_0x12bff6['originalname'][_0x1a20('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x8c777e(null,util[_0x1a20('0x15')]('%s-%s%s',path[_0x1a20('0x16')](_0x12bff6[_0x1a20('0x13')],path[_0x1a20('0x17')](_0x12bff6[_0x1a20('0x13')])),Date['now'](),path[_0x1a20('0x17')](_0x12bff6['originalname'])));}})});router[_0x1a20('0x18')]('/',upload[_0x1a20('0x19')](_0x1a20('0x1a')),controller['upload']);router[_0x1a20('0x18')](_0x1a20('0x1b'),controller[_0x1a20('0x1c')]);router[_0x1a20('0x1d')](_0x1a20('0xb'),auth[_0x1a20('0x7')](),controller[_0x1a20('0x1e')]);router['delete'](_0x1a20('0xb'),auth[_0x1a20('0x7')](),controller['delete']);module[_0x1a20('0x1f')]=router; \ No newline at end of file +var _0xa95f=['get','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','originalname','replace','%s-%s%s','basename','extname','now','upload','post','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','index'];(function(_0x58014d,_0x148f70){var _0x500dbc=function(_0x4225b4){while(--_0x4225b4){_0x58014d['push'](_0x58014d['shift']());}};_0x500dbc(++_0x148f70);}(_0xa95f,0xd6));var _0xfa95=function(_0x4f1e9d,_0x2bd07a){_0x4f1e9d=_0x4f1e9d-0x0;var _0x17eef7=_0xa95f[_0x4f1e9d];return _0x17eef7;};'use strict';var multer=require('multer');var util=require(_0xfa95('0x0'));var path=require(_0xfa95('0x1'));var timeout=require(_0xfa95('0x2'));var express=require(_0xfa95('0x3'));var router=express[_0xfa95('0x4')]();var auth=require(_0xfa95('0x5'));var interaction=require(_0xfa95('0x6'));var config=require('../../config/environment');var controller=require(_0xfa95('0x7'));router['get']('/',auth[_0xfa95('0x8')](),controller[_0xfa95('0x9')]);router[_0xfa95('0xa')](_0xfa95('0xb'),controller[_0xfa95('0xc')]);router[_0xfa95('0xa')](_0xfa95('0xd'),auth[_0xfa95('0x8')](),controller[_0xfa95('0xe')]);router['get'](_0xfa95('0xf'),auth[_0xfa95('0x8')](),controller[_0xfa95('0x10')]);var upload=multer({'storage':multer[_0xfa95('0x11')]({'destination':function(_0xefbc72,_0x2ac7f9,_0x1c8dc5){_0x1c8dc5(null,path[_0xfa95('0x12')](config[_0xfa95('0x13')],'server/files/plugins'));},'filename':function(_0x5752ae,_0x2ce600,_0x21696d){_0x2ce600['originalname']=_0x2ce600[_0xfa95('0x14')][_0xfa95('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x21696d(null,util['format'](_0xfa95('0x16'),path[_0xfa95('0x17')](_0x2ce600[_0xfa95('0x14')],path[_0xfa95('0x18')](_0x2ce600[_0xfa95('0x14')])),Date[_0xfa95('0x19')](),path[_0xfa95('0x18')](_0x2ce600[_0xfa95('0x14')])));}})});router['post']('/',upload['single']('file'),controller[_0xfa95('0x1a')]);router[_0xfa95('0x1b')](_0xfa95('0xb'),controller['webhookPost']);router[_0xfa95('0x1c')]('/:id',auth[_0xfa95('0x8')](),controller[_0xfa95('0x1d')]);router['delete'](_0xfa95('0xd'),auth[_0xfa95('0x8')](),controller[_0xfa95('0x1e')]);module[_0xfa95('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 5f54d98..479afe4 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 _0xd93c=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','script','TEXT','BOOLEAN','adminOnly','agentOnly','always','never'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd93c,0x1bd));var _0xcd93=function(_0x30080e,_0x23e2d5){_0x30080e=_0x30080e-0x0;var _0x54f5bd=_0xd93c[_0x30080e];return _0x54f5bd;};'use strict';var Sequelize=require(_0xcd93('0x0'));module[_0xcd93('0x1')]={'name':{'type':Sequelize[_0xcd93('0x2')]},'type':{'type':Sequelize[_0xcd93('0x3')]('html',_0xcd93('0x4'))},'description':{'type':Sequelize[_0xcd93('0x5')]},'version':{'type':Sequelize[_0xcd93('0x5')]},'path':{'type':Sequelize[_0xcd93('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xcd93('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xcd93('0x7'),_0xcd93('0x8'),_0xcd93('0x9'),_0xcd93('0xa')),'defaultValue':_0xcd93('0x9'),'comment':_0xcd93('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xcd93('0x2')]},'agentUrl':{'type':Sequelize[_0xcd93('0x2')]},'scriptName':{'type':Sequelize[_0xcd93('0x2')]},'scriptPath':{'type':Sequelize[_0xcd93('0x2')]}}; \ No newline at end of file +var _0xcec9=['sequelize','STRING','ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x12e3e3,_0x501eaf){var _0x26602e=function(_0x427882){while(--_0x427882){_0x12e3e3['push'](_0x12e3e3['shift']());}};_0x26602e(++_0x501eaf);}(_0xcec9,0x78));var _0x9cec=function(_0x57fd39,_0x4c2473){_0x57fd39=_0x57fd39-0x0;var _0x4aa88c=_0xcec9[_0x57fd39];return _0x4aa88c;};'use strict';var Sequelize=require(_0x9cec('0x0'));module['exports']={'name':{'type':Sequelize[_0x9cec('0x1')]},'type':{'type':Sequelize[_0x9cec('0x2')](_0x9cec('0x3'),_0x9cec('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x9cec('0x5')},'active':{'type':Sequelize[_0x9cec('0x6')],'defaultValue':0x0,'comment':_0x9cec('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x9cec('0x8'),'agentOnly',_0x9cec('0x9'),_0x9cec('0xa')),'defaultValue':'always','comment':_0x9cec('0xb')},'icon':{'type':Sequelize[_0x9cec('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x9cec('0x1')]},'scriptName':{'type':Sequelize[_0x9cec('0x1')]},'scriptPath':{'type':Sequelize[_0x9cec('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 9cbaa84..3d60976 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 _0x2f38=['Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','script','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','userProfileId','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','http://localhost:','encoding','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','register','sendStatus','status','json','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','map','Plugin','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','limit','offset','sort','filters','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','catch','show','options','find','download','params','join','root','format','%s.zip','createWriteStream','zip','code','ENOENT','Sequelize','Error','**/*','server/files/plugins','dirname','basename','path','attachments/**/*','finalize','close','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0x2f38,0xdf));var _0x82f3=function(_0x23d78e,_0x263ad3){_0x23d78e=_0x23d78e-0x0;var _0x20d0f1=_0x2f38[_0x23d78e];return _0x20d0f1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x82f3('0x0'));var rimraf=require(_0x82f3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x82f3('0x2'));var rp=require(_0x82f3('0x3'));var moment=require(_0x82f3('0x4'));var BPromise=require(_0x82f3('0x5'));var Mustache=require(_0x82f3('0x6'));var util=require(_0x82f3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x82f3('0x8'));var ejs=require(_0x82f3('0x9'));var fs=require('fs');var _=require(_0x82f3('0xa'));var squel=require('squel');var crypto=require(_0x82f3('0xb'));var jsforce=require(_0x82f3('0xc'));var deskjs=require(_0x82f3('0xd'));var toCsv=require(_0x82f3('0x8'));var querystring=require(_0x82f3('0xe'));var Papa=require(_0x82f3('0xf'));var extract=require(_0x82f3('0x10'));var rimraf=require('rimraf');var archiver=require(_0x82f3('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x82f3('0x12'));var as=require(_0x82f3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x82f3('0x14'))(_0x82f3('0x15'));var utils=require(_0x82f3('0x16'));var config=require(_0x82f3('0x17'));var db=require('../../mysqldb')['db'];config[_0x82f3('0x18')]=_['defaults'](config[_0x82f3('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x82f3('0x19'))(new Redis(config[_0x82f3('0x18')]));require('./plugin.socket')[_0x82f3('0x1a')](socket);function respondWithStatusCode(_0x55beeb,_0x4f2d2d){_0x4f2d2d=_0x4f2d2d||0xcc;return function(_0xe980b4){if(_0xe980b4){return _0x55beeb[_0x82f3('0x1b')](_0x4f2d2d);}return _0x55beeb[_0x82f3('0x1c')](_0x4f2d2d)['end']();};}function respondWithResult(_0xecc3f1,_0x426758){_0x426758=_0x426758||0xc8;return function(_0x19a1df){if(_0x19a1df){return _0xecc3f1[_0x82f3('0x1c')](_0x426758)[_0x82f3('0x1d')](_0x19a1df);}};}function respondWithFilteredResult(_0x4342f3,_0x30374b){return function(_0x3c68dc){if(_0x3c68dc){var _0x2f8ebd=_0x3c68dc['count'],_0x5a17e8=_0x30374b['offset'],_0x2552c3=_0x30374b['offset']+_0x30374b['limit'],_0x1bc048;if(_0x2552c3>=_0x2f8ebd){_0x2552c3=_0x2f8ebd;_0x1bc048=0xc8;}else{_0x1bc048=0xce;}_0x4342f3[_0x82f3('0x1c')](_0x1bc048);return _0x4342f3[_0x82f3('0x1e')](_0x82f3('0x1f'),_0x5a17e8+'-'+_0x2552c3+'/'+_0x2f8ebd)[_0x82f3('0x1d')](_0x3c68dc);}return null;};}function patchUpdates(_0x40ce83){return function(_0x26b2c0){try{jsonpatch[_0x82f3('0x20')](_0x26b2c0,_0x40ce83,!![]);}catch(_0x5da463){return BPromise[_0x82f3('0x21')](_0x5da463);}return _0x26b2c0[_0x82f3('0x22')]();};}function saveUpdates(_0x315240,_0x465b2e){return function(_0x8d4d86){if(_0x8d4d86){return _0x8d4d86[_0x82f3('0x23')](_0x315240)[_0x82f3('0x24')](function(_0x1fff15){return _0x1fff15;});}return null;};}function removeEntity(_0x2696f2,_0x47ff0a){return function(_0xeab921){if(_0xeab921){return _0xeab921[_0x82f3('0x25')]()[_0x82f3('0x24')](function(){var _0x32f7ec=_0xeab921[_0x82f3('0x26')]({'plain':!![]});var _0x1ff74a='Plugins';return db[_0x82f3('0x27')][_0x82f3('0x25')]({'where':{'type':_0x1ff74a,'resourceId':_0x32f7ec['id']}})[_0x82f3('0x24')](function(){return _0xeab921;});})[_0x82f3('0x24')](function(){_0x2696f2[_0x82f3('0x1c')](0xcc)[_0x82f3('0x28')]();});}};}function handleEntityNotFound(_0x2ee313,_0x14c2fa){return function(_0x27205c){if(!_0x27205c){_0x2ee313['sendStatus'](0x194);}return _0x27205c;};}function handleError(_0x22f667,_0x3c4eef){_0x3c4eef=_0x3c4eef||0x1f4;return function(_0x51b443){logger[_0x82f3('0x29')](_0x51b443['stack']);if(_0x51b443['name']){delete _0x51b443[_0x82f3('0x2a')];}_0x22f667[_0x82f3('0x1c')](_0x3c4eef)[_0x82f3('0x2b')](_0x51b443);};}exports[_0x82f3('0x2c')]=function(_0x233a0a,_0x454851){var _0x1ad59b={},_0x2990b9={},_0x1444f7={'count':0x0,'rows':[]};var _0x4ff25b=_[_0x82f3('0x2d')](db[_0x82f3('0x2e')][_0x82f3('0x2f')],function(_0x57ef1d){return{'name':_0x57ef1d['fieldName'],'type':_0x57ef1d[_0x82f3('0x30')][_0x82f3('0x31')]};});_0x2990b9[_0x82f3('0x32')]=_['map'](_0x4ff25b,_0x82f3('0x2a'));_0x2990b9[_0x82f3('0x33')]=_[_0x82f3('0x34')](_0x233a0a[_0x82f3('0x33')]);_0x2990b9['filters']=_['intersection'](_0x2990b9['model'],_0x2990b9[_0x82f3('0x33')]);_0x1ad59b['attributes']=_[_0x82f3('0x35')](_0x2990b9[_0x82f3('0x32')],qs['fields'](_0x233a0a[_0x82f3('0x33')][_0x82f3('0x36')]));_0x1ad59b[_0x82f3('0x37')]=_0x1ad59b[_0x82f3('0x37')][_0x82f3('0x38')]?_0x1ad59b[_0x82f3('0x37')]:_0x2990b9['model'];if(!_0x233a0a[_0x82f3('0x33')][_0x82f3('0x39')]('nolimit')){_0x1ad59b['limit']=qs['limit'](_0x233a0a['query'][_0x82f3('0x3a')]);_0x1ad59b['offset']=qs[_0x82f3('0x3b')](_0x233a0a[_0x82f3('0x33')]['offset']);}_0x1ad59b['order']=qs[_0x82f3('0x3c')](_0x233a0a[_0x82f3('0x33')][_0x82f3('0x3c')]);_0x1ad59b['where']=qs[_0x82f3('0x3d')](_[_0x82f3('0x3e')](_0x233a0a[_0x82f3('0x33')],_0x2990b9['filters']));if(_0x233a0a[_0x82f3('0x33')][_0x82f3('0x3f')]){_0x1ad59b[_0x82f3('0x40')]=_[_0x82f3('0x41')](_0x1ad59b[_0x82f3('0x40')],{'$or':_['map'](_0x4ff25b,function(_0x482c90){if(_0x482c90[_0x82f3('0x30')]!==_0x82f3('0x42')){var _0xecba4a={};_0xecba4a[_0x482c90[_0x82f3('0x2a')]]={'$like':'%'+_0x233a0a[_0x82f3('0x33')][_0x82f3('0x3f')]+'%'};return _0xecba4a;}})});}_0x1ad59b=_[_0x82f3('0x41')]({},_0x1ad59b,_0x233a0a['options']);var _0x24f056={'where':_0x1ad59b[_0x82f3('0x40')]};return db[_0x82f3('0x2e')][_0x82f3('0x43')](_0x24f056)[_0x82f3('0x24')](function(_0xced682){_0x1444f7[_0x82f3('0x43')]=_0xced682;if(_0x233a0a[_0x82f3('0x33')][_0x82f3('0x44')]){_0x1ad59b[_0x82f3('0x45')]=[{'all':!![]}];}return db[_0x82f3('0x2e')][_0x82f3('0x46')](_0x1ad59b);})[_0x82f3('0x24')](function(_0x259f98){_0x1444f7['rows']=_0x259f98;return _0x1444f7;})[_0x82f3('0x24')](respondWithFilteredResult(_0x454851,_0x1ad59b))[_0x82f3('0x47')](handleError(_0x454851,null));};exports[_0x82f3('0x48')]=function(_0x595862,_0xe67edd){var _0x178225={'raw':!![],'where':{'id':_0x595862['params']['id']}},_0x14d6ba={};_0x14d6ba[_0x82f3('0x32')]=_[_0x82f3('0x34')](db[_0x82f3('0x2e')][_0x82f3('0x2f')]);_0x14d6ba['query']=_[_0x82f3('0x34')](_0x595862[_0x82f3('0x33')]);_0x14d6ba[_0x82f3('0x3d')]=_['intersection'](_0x14d6ba[_0x82f3('0x32')],_0x14d6ba[_0x82f3('0x33')]);_0x178225['attributes']=_['intersection'](_0x14d6ba['model'],qs[_0x82f3('0x36')](_0x595862[_0x82f3('0x33')]['fields']));_0x178225['attributes']=_0x178225[_0x82f3('0x37')][_0x82f3('0x38')]?_0x178225[_0x82f3('0x37')]:_0x14d6ba[_0x82f3('0x32')];if(_0x595862[_0x82f3('0x33')][_0x82f3('0x44')]){_0x178225[_0x82f3('0x45')]=[{'all':!![]}];}_0x178225=_[_0x82f3('0x41')]({},_0x178225,_0x595862[_0x82f3('0x49')]);return db[_0x82f3('0x2e')][_0x82f3('0x4a')](_0x178225)['then'](handleEntityNotFound(_0xe67edd,null))[_0x82f3('0x24')](respondWithResult(_0xe67edd,null))[_0x82f3('0x47')](handleError(_0xe67edd,null));};exports[_0x82f3('0x4b')]=function(_0x12824a,_0x36efe9,_0xc770e6){return db['Plugin'][_0x82f3('0x4a')]({'where':{'id':_0x12824a[_0x82f3('0x4c')]['id']},'attributes':[_0x82f3('0x2a'),'path'],'raw':!![]})[_0x82f3('0x24')](handleEntityNotFound(_0x36efe9,null))[_0x82f3('0x24')](function(_0x881fde){if(_0x881fde){var _0x335505=path[_0x82f3('0x4d')](config[_0x82f3('0x4e')],'server/files/plugins',util[_0x82f3('0x4f')](_0x82f3('0x50'),path['basename'](_0x881fde['path'])));var _0x51a6f8=fs[_0x82f3('0x51')](_0x335505);var _0xd08720=archiver(_0x82f3('0x52'),{'zlib':{'level':0x9}});_0xd08720['on']('warning',function(_0x293069){if(_0x293069[_0x82f3('0x53')]===_0x82f3('0x54')){logger[_0x82f3('0x29')](_0x293069);}else{throw new db[(_0x82f3('0x55'))][(_0x82f3('0x56'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0xd08720['on'](_0x82f3('0x29'),function(_0x174e12){throw new db['Sequelize'][(_0x82f3('0x56'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xd08720['pipe'](_0x51a6f8);_0xd08720['glob'](_0x82f3('0x57'),{'cwd':path['join'](config['root'],_0x82f3('0x58'),path[_0x82f3('0x59')](_0x881fde['path'])),'ignore':[path[_0x82f3('0x4d')](path[_0x82f3('0x5a')](_0x881fde['path']),'node_modules/**/*'),path[_0x82f3('0x4d')](path['basename'](_0x881fde[_0x82f3('0x5b')]),_0x82f3('0x5c'))],'nodir':!![]})[_0x82f3('0x5d')]();_0x51a6f8['on'](_0x82f3('0x5e'),function(){if(!fs['existsSync'](_0x335505)){throw new db[(_0x82f3('0x55'))][(_0x82f3('0x56'))](_0x82f3('0x5f'));}return _0x36efe9[_0x82f3('0x4b')](_0x335505,util['format'](_0x82f3('0x50'),path[_0x82f3('0x5a')](_0x881fde[_0x82f3('0x5b')])),function(_0x4397cf){if(_0x4397cf){throw new db[(_0x82f3('0x55'))]['Error'](_0x82f3('0x60'));}fs[_0x82f3('0x61')](_0x335505);logger[_0x82f3('0x62')](_0x82f3('0x63'));logger[_0x82f3('0x62')](_0x82f3('0x64'));});});}return null;})[_0x82f3('0x47')](handleError(_0x36efe9,null));};exports['upload']=function(_0x128c86,_0x1543e2,_0x38326c){var _0x32187d=path['basename'](_0x128c86[_0x82f3('0x65')][_0x82f3('0x66')],path[_0x82f3('0x67')](_0x128c86[_0x82f3('0x65')]['filename']));var _0x2bcc13=path[_0x82f3('0x4d')](config[_0x82f3('0x4e')],_0x82f3('0x58'),_0x128c86[_0x82f3('0x65')]['filename']);var _0x5c1db5=path[_0x82f3('0x4d')](config['root'],_0x82f3('0x58'),_0x32187d);logger[_0x82f3('0x62')](_0x82f3('0x68'),_0x2bcc13);logger[_0x82f3('0x62')](_0x82f3('0x69'),_0x5c1db5);try{fs[_0x82f3('0x6a')](_0x2bcc13,parseInt(_0x82f3('0x6b'),0x8));extract(_0x2bcc13,{'dir':_0x5c1db5},function(_0x4a64a6){if(_0x4a64a6){logger[_0x82f3('0x29')](_0x4a64a6);handleError(_0x4a64a6,!![]);};var _0x365e37=fs[_0x82f3('0x6c')](_0x5c1db5);if(_0x365e37['length']>0x1){removeReferences(_0x2bcc13,_0x5c1db5);logger[_0x82f3('0x29')](_0x82f3('0x6d'));return _0x38326c(new Error(_0x82f3('0x6d')));}var _0xa2d7f3=fs[_0x82f3('0x6e')](path['join'](_0x5c1db5,_0x365e37[0x0]));if(_0xa2d7f3[_0x82f3('0x6f')]()){removeReferences(_0x2bcc13,_0x5c1db5);logger[_0x82f3('0x29')](_0x82f3('0x6d'));return _0x38326c(new Error(_0x82f3('0x6d')));}if(_0xa2d7f3[_0x82f3('0x70')]()){var _0x3580c1=fs[_0x82f3('0x6c')](path[_0x82f3('0x4d')](_0x5c1db5,_0x365e37[0x0]));if(_0x3580c1[_0x82f3('0x38')]===0x0){removeReferences(_0x2bcc13,_0x5c1db5);logger[_0x82f3('0x29')]('Invalid\x20plugin\x20structure');return _0x38326c(new Error(_0x82f3('0x6d')));}var _0x496bff=_0x3580c1[_0x82f3('0x71')](function(_0x1b337e){return _0x1b337e===_0x82f3('0x72');});if(!_0x496bff){return _0x38326c(new Error(_0x82f3('0x73')));}var _0x5d12db=fs[_0x82f3('0x74')](path['join'](_0x5c1db5,_0x365e37[0x0],_0x82f3('0x72')));var _0x3ca7b2=JSON[_0x82f3('0x75')](_0x5d12db);if(_0x82f3('0x76')==typeof _0x3ca7b2[_0x82f3('0x2a')]){return _0x38326c(new Error(_0x82f3('0x77')));}if(_0x82f3('0x76')==typeof _0x3ca7b2[_0x82f3('0x30')]){return _0x38326c(new Error(_0x82f3('0x78')));}if(_0x82f3('0x76')==typeof _0x3ca7b2[_0x82f3('0x79')]){return _0x38326c(new Error(_0x82f3('0x7a')));}if(_0x82f3('0x76')==typeof _0x3ca7b2[_0x82f3('0x7b')]){return _0x38326c(new Error(_0x82f3('0x7c')));}if(_0x3ca7b2[_0x82f3('0x30')]===_0x82f3('0x7d')){if(_0x82f3('0x76')==typeof _0x3ca7b2[_0x82f3('0x7b')]['views']){return _0x38326c(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x3ca7b2[_0x82f3('0x7b')][_0x82f3('0x7e')][_0x82f3('0x7f')]&&_0x82f3('0x76')==typeof _0x3ca7b2['parameters'][_0x82f3('0x7e')][_0x82f3('0x80')]){return _0x38326c(new Error(_0x82f3('0x81')));}}else if(_0x3ca7b2[_0x82f3('0x30')]==='script'){if('undefined'==typeof _0x3ca7b2[_0x82f3('0x7b')][_0x82f3('0x82')]){return _0x38326c(new Error(_0x82f3('0x83')));}if(_0x82f3('0x76')==typeof _0x3ca7b2[_0x82f3('0x7b')][_0x82f3('0x84')]){return _0x38326c(new Error(_0x82f3('0x85')));}}else{return _0x38326c(new Error(_0x82f3('0x86')));}var _0x23bbb4=_0x3ca7b2[_0x82f3('0x2a')];var _0x494bb9=_0x3ca7b2['description'];var _0x2b1aee=_0x3ca7b2[_0x82f3('0x30')];var _0x37e215=_0x3ca7b2['sidebar']?_0x3ca7b2[_0x82f3('0x87')]:_0x82f3('0x88');var _0xa134b5=_0x3ca7b2[_0x82f3('0x89')]?_0x3ca7b2[_0x82f3('0x89')]:_0x82f3('0x8a');var _0x3c183e='';var _0x2f44b0='';var _0x18c860='';var _0x2fac0f='';var _0x5d0faa=_0x3ca7b2[_0x82f3('0x79')];if(_0x2b1aee===_0x82f3('0x7d')){if('undefined'!=typeof _0x3ca7b2[_0x82f3('0x7b')][_0x82f3('0x7e')][_0x82f3('0x7f')]){var _0x278188=_0x3ca7b2[_0x82f3('0x7b')][_0x82f3('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x278188)){_0x3c183e=path[_0x82f3('0x4d')]('plugins',_0x32187d,_0x365e37[0x0],_0x278188);}else{_0x3c183e=_0x278188;}}else{logger[_0x82f3('0x62')](_0x82f3('0x8b'));}if(_0x82f3('0x76')!=typeof _0x3ca7b2[_0x82f3('0x7b')]['views']['agent']){var _0x1cd074=_0x3ca7b2['parameters']['views'][_0x82f3('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x82f3('0x8c')](_0x1cd074)){_0x2f44b0=path[_0x82f3('0x4d')](_0x82f3('0x8d'),_0x32187d,_0x365e37[0x0],_0x1cd074);}else{_0x2f44b0=_0x1cd074;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2b1aee===_0x82f3('0x8e')){_0x18c860=_0x3ca7b2['parameters'][_0x82f3('0x82')];_0x2fac0f=_0x3ca7b2[_0x82f3('0x7b')][_0x82f3('0x84')];if(_0x82f3('0x76')!=typeof _0x3ca7b2['parameters'][_0x82f3('0x7e')]){if(_0x82f3('0x76')!=typeof _0x3ca7b2[_0x82f3('0x7b')][_0x82f3('0x7e')][_0x82f3('0x7f')]){var _0x278188=_0x3ca7b2[_0x82f3('0x7b')][_0x82f3('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x278188)){_0x3c183e=path[_0x82f3('0x4d')](_0x82f3('0x8d'),_0x32187d,_0x365e37[0x0],_0x278188);}else{_0x3c183e=_0x278188;}}if(_0x82f3('0x76')!=typeof _0x3ca7b2[_0x82f3('0x7b')][_0x82f3('0x7e')][_0x82f3('0x80')]){var _0x1cd074=_0x3ca7b2[_0x82f3('0x7b')][_0x82f3('0x7e')][_0x82f3('0x80')];if(!/^(f|ht)tps?:\/\//i[_0x82f3('0x8c')](_0x1cd074)){_0x2f44b0=path['join'](_0x82f3('0x8d'),_0x32187d,_0x365e37[0x0],_0x1cd074);}else{_0x2f44b0=_0x1cd074;}}}}var _0x39d869={'name':_0x23bbb4,'description':_0x494bb9,'path':path[_0x82f3('0x4d')](_0x32187d,_0x365e37[0x0]),'type':_0x2b1aee,'sidebar':_0x37e215,'icon':_0xa134b5,'adminUrl':_0x3c183e,'agentUrl':_0x2f44b0,'scriptName':_0x18c860,'scriptPath':_0x2fac0f,'version':_0x5d0faa};removeReferences(_0x2bcc13,null);return db['Plugin'][_0x82f3('0x8f')](_0x39d869)[_0x82f3('0x24')](function(_0x195b1b){var _0x3779ab={'role':_0x128c86[_0x82f3('0x90')][_0x82f3('0x91')],'userProfileId':_0x128c86[_0x82f3('0x90')]['userProfileId']};if(!_0x3779ab)throw new Error(_0x82f3('0x92'));if(_0x3779ab[_0x82f3('0x91')]===_0x82f3('0x93')){var _0x2d91d1=_0x195b1b[_0x82f3('0x26')]({'plain':!![]});return db[_0x82f3('0x94')][_0x82f3('0x4a')]({'where':{'name':_0x82f3('0x95'),'userProfileId':_0x3779ab[_0x82f3('0x96')]},'raw':!![]})['then'](function(_0x2a61e6){if(_0x2a61e6&&_0x2a61e6[_0x82f3('0x97')]===0x0){return db[_0x82f3('0x27')][_0x82f3('0x8f')]({'name':_0x2d91d1[_0x82f3('0x2a')],'resourceId':_0x2d91d1['id'],'type':_0x2a61e6[_0x82f3('0x2a')],'sectionId':_0x2a61e6['id']},{})[_0x82f3('0x24')](function(){return _0x195b1b;});}else{return _0x195b1b;}})[_0x82f3('0x47')](function(_0x425cdd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x425cdd);throw _0x425cdd;});}return _0x195b1b;})['then'](respondWithResult(_0x1543e2,null))[_0x82f3('0x47')](handleError(_0x1543e2,null));}});}catch(_0xa6f190){_0x1543e2[_0x82f3('0x1c')](0x1f4)[_0x82f3('0x2b')](_0xa6f190);}};function removeReferences(_0x4f145f,_0x319871){try{if(_0x4f145f){fs[_0x82f3('0x61')](_0x4f145f);logger[_0x82f3('0x62')](_0x82f3('0x98'));}if(_0x319871){rimraf(_0x319871,function(){});logger['info'](_0x82f3('0x99'));}}catch(_0x332b38){logger[_0x82f3('0x29')](_0x332b38);}}exports[_0x82f3('0x23')]=function(_0x46e9ae,_0x30530e,_0x563aef){return db[_0x82f3('0x2e')][_0x82f3('0x4a')]({'where':{'id':_0x46e9ae[_0x82f3('0x4c')]['id']}})[_0x82f3('0x24')](handleEntityNotFound(_0x30530e,null))[_0x82f3('0x24')](saveUpdates(_0x46e9ae[_0x82f3('0x90')],null))[_0x82f3('0x24')](respondWithResult(_0x30530e,null))[_0x82f3('0x47')](handleError(_0x30530e,null));};exports['delete']=function(_0x58114f,_0x4a7c49,_0x301c75){return db[_0x82f3('0x2e')]['find']({'where':{'id':_0x58114f[_0x82f3('0x4c')]['id']}})[_0x82f3('0x24')](function(_0x2790f7){if(_0x2790f7){return _0x2790f7['destroy']();}})[_0x82f3('0x24')](function(_0x403615){rimraf(path[_0x82f3('0x4d')](config[_0x82f3('0x4e')],_0x82f3('0x58'),path['dirname'](_0x403615[_0x82f3('0x5b')])),function(){});return _0x403615;})[_0x82f3('0x24')](handleEntityNotFound(_0x4a7c49,null))[_0x82f3('0x24')](respondWithStatusCode(_0x4a7c49,null))[_0x82f3('0x47')](handleError(_0x4a7c49,null));};exports[_0x82f3('0x9a')]=function(_0x4bc01f,_0x514f22,_0x2e66e6){return BPromise[_0x82f3('0x9b')]()[_0x82f3('0x24')](function(){if(!_0x4bc01f['query']['path']){throw new Error(_0x82f3('0x9c'));}if(!_0x4bc01f[_0x82f3('0x33')][_0x82f3('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3e65d8=_0x4bc01f[_0x82f3('0x33')][_0x82f3('0x9e')]?_0x4bc01f[_0x82f3('0x33')][_0x82f3('0x9e')]+':'+_0x4bc01f['query'][_0x82f3('0x9d')]:'http://localhost:'+_0x4bc01f[_0x82f3('0x33')][_0x82f3('0x9d')];var _0x51522e=_0x4bc01f[_0x82f3('0x33')][_0x82f3('0x1d')]?_0x4bc01f[_0x82f3('0x33')][_0x82f3('0x1d')]:!![];var _0x2443bb=_0x4bc01f[_0x82f3('0x33')]['encoding']?_0x4bc01f[_0x82f3('0x33')]['encoding']:null;var _0x2e7555={'method':_0x4bc01f[_0x82f3('0x9f')],'uri':util['format'](_0x82f3('0xa0'),_0x3e65d8,_0x4bc01f[_0x82f3('0x33')]['path']),'json':_0x51522e,'resolveWithFullResponse':!![],'encoding':_0x2443bb,'qs':_0x4bc01f[_0x82f3('0x33')]};if(_0x4bc01f[_0x82f3('0xa1')]){_0x2e7555['headers']=_0x4bc01f['headers'];if(_0x2e7555['headers']['content-length']){delete _0x2e7555[_0x82f3('0xa1')][_0x82f3('0xa2')];}}if(_0x2e7555[_0x82f3('0xa1')][_0x82f3('0xa3')]){delete _0x2e7555[_0x82f3('0xa1')]['content-type'];}return rp(_0x2e7555);})['then'](function(_0xc7add7){if(_0xc7add7){_0x514f22[_0x82f3('0x1e')](_0xc7add7[_0x82f3('0xa1')]);logger[_0x82f3('0x62')](_0xc7add7[_0x82f3('0x90')]);if(_[_0x82f3('0xa4')](_0x4bc01f[_0x82f3('0x33')]['path'],_0x82f3('0x4b'))&&_0xc7add7[_0x82f3('0xa5')]==0x1f4){return _0x514f22[_0x82f3('0x1b')](_0xc7add7[_0x82f3('0xa5')]);}else{return _0x514f22[_0x82f3('0x1c')](_0xc7add7[_0x82f3('0xa5')])[_0x82f3('0x2b')](_0xc7add7['body']);}}else{return _0x514f22[_0x82f3('0x1b')](0xc8);}})['catch'](handleError(_0x514f22,null));};exports[_0x82f3('0xa6')]=function(_0x5cf417,_0x6ccb5,_0x334c47){return BPromise[_0x82f3('0x9b')]()[_0x82f3('0x24')](function(){if(!_0x5cf417['query'][_0x82f3('0x5b')]){throw new Error(_0x82f3('0x9c'));}if(!_0x5cf417[_0x82f3('0x33')][_0x82f3('0x9d')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x3b813e=_0x5cf417[_0x82f3('0x33')][_0x82f3('0x9e')]?_0x5cf417[_0x82f3('0x33')]['hostname']+':'+_0x5cf417['query'][_0x82f3('0x9d')]:_0x82f3('0xa7')+_0x5cf417[_0x82f3('0x33')][_0x82f3('0x9d')];var _0xf1f521=_0x5cf417[_0x82f3('0x33')][_0x82f3('0x1d')]?_0x5cf417[_0x82f3('0x33')]['json']:!![];var _0x45456f=_0x5cf417['query'][_0x82f3('0xa8')]?_0x5cf417['query'][_0x82f3('0xa8')]:null;var _0x3a63af={'method':_0x5cf417['method'],'uri':util[_0x82f3('0x4f')](_0x82f3('0xa0'),_0x3b813e,_0x5cf417[_0x82f3('0x33')][_0x82f3('0x5b')]),'json':_0xf1f521,'resolveWithFullResponse':!![],'encoding':_0x45456f,'body':_0x5cf417['body']};if(_0x5cf417[_0x82f3('0xa1')]){_0x3a63af[_0x82f3('0xa1')]=_0x5cf417['headers'];if(_0x3a63af[_0x82f3('0xa1')][_0x82f3('0xa2')]){delete _0x3a63af[_0x82f3('0xa1')][_0x82f3('0xa2')];}}if(_0x3a63af['headers'][_0x82f3('0xa3')]){delete _0x3a63af[_0x82f3('0xa1')][_0x82f3('0xa3')];}return rp(_0x3a63af);})[_0x82f3('0x24')](function(_0x2a8bee){if(_0x2a8bee){_0x6ccb5[_0x82f3('0x1e')](_0x2a8bee['headers']);logger['info'](_0x2a8bee[_0x82f3('0x90')]);return _0x6ccb5[_0x82f3('0x1c')](_0x2a8bee[_0x82f3('0xa5')])[_0x82f3('0x2b')](_0x2a8bee[_0x82f3('0x90')]);}else{return _0x6ccb5['sendStatus'](0xc8);}})[_0x82f3('0x47')](handleError(_0x6ccb5,null));}; \ No newline at end of file +var _0x53d8=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./plugin.socket','register','sendStatus','status','count','offset','limit','json','apply','save','update','then','get','Plugins','UserProfileResource','end','error','stack','name','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','find','download','params','root','server/files/plugins','%s.zip','basename','zip','warning','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','dirname','join','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','undefined','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','send','Zip\x20archive\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','resolve','html-pdf','eml-format','rimraf','zip-dir','request-promise'];(function(_0x46d87a,_0x5183db){var _0x115296=function(_0x880a1c){while(--_0x880a1c){_0x46d87a['push'](_0x46d87a['shift']());}};_0x115296(++_0x5183db);}(_0x53d8,0x147));var _0x853d=function(_0x39f643,_0x4f4be2){_0x39f643=_0x39f643-0x0;var _0x1b2fcf=_0x53d8[_0x39f643];return _0x1b2fcf;};'use strict';var pdf=require(_0x853d('0x0'));var emlformat=require(_0x853d('0x1'));var rimraf=require(_0x853d('0x2'));var zipdir=require(_0x853d('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x853d('0x4'));var moment=require(_0x853d('0x5'));var BPromise=require(_0x853d('0x6'));var Mustache=require(_0x853d('0x7'));var util=require(_0x853d('0x8'));var path=require(_0x853d('0x9'));var sox=require(_0x853d('0xa'));var csv=require(_0x853d('0xb'));var ejs=require(_0x853d('0xc'));var fs=require('fs');var _=require(_0x853d('0xd'));var squel=require(_0x853d('0xe'));var crypto=require(_0x853d('0xf'));var jsforce=require(_0x853d('0x10'));var deskjs=require(_0x853d('0x11'));var toCsv=require(_0x853d('0xb'));var querystring=require('querystring');var Papa=require(_0x853d('0x12'));var extract=require('extract-zip');var rimraf=require(_0x853d('0x2'));var archiver=require(_0x853d('0x13'));var Redis=require(_0x853d('0x14'));var authService=require(_0x853d('0x15'));var qs=require(_0x853d('0x16'));var as=require(_0x853d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x853d('0x18'))(_0x853d('0x19'));var utils=require('../../config/utils');var config=require(_0x853d('0x1a'));var db=require(_0x853d('0x1b'))['db'];config[_0x853d('0x1c')]=_['defaults'](config[_0x853d('0x1c')],{'host':_0x853d('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x853d('0x1c')]));require(_0x853d('0x1e'))[_0x853d('0x1f')](socket);function respondWithStatusCode(_0x5b109d,_0x307c4c){_0x307c4c=_0x307c4c||0xcc;return function(_0x56c10b){if(_0x56c10b){return _0x5b109d[_0x853d('0x20')](_0x307c4c);}return _0x5b109d[_0x853d('0x21')](_0x307c4c)['end']();};}function respondWithResult(_0xbca897,_0x2f07d7){_0x2f07d7=_0x2f07d7||0xc8;return function(_0xe58be){if(_0xe58be){return _0xbca897[_0x853d('0x21')](_0x2f07d7)['json'](_0xe58be);}};}function respondWithFilteredResult(_0x26130a,_0x46aead){return function(_0xfb45d3){if(_0xfb45d3){var _0x403f5e=_0xfb45d3[_0x853d('0x22')],_0x7c1b7a=_0x46aead['offset'],_0x1261a2=_0x46aead[_0x853d('0x23')]+_0x46aead[_0x853d('0x24')],_0x24ea94;if(_0x1261a2>=_0x403f5e){_0x1261a2=_0x403f5e;_0x24ea94=0xc8;}else{_0x24ea94=0xce;}_0x26130a[_0x853d('0x21')](_0x24ea94);return _0x26130a['set']('Content-Range',_0x7c1b7a+'-'+_0x1261a2+'/'+_0x403f5e)[_0x853d('0x25')](_0xfb45d3);}return null;};}function patchUpdates(_0x2fd11b){return function(_0x14fec0){try{jsonpatch[_0x853d('0x26')](_0x14fec0,_0x2fd11b,!![]);}catch(_0x156bdf){return BPromise['reject'](_0x156bdf);}return _0x14fec0[_0x853d('0x27')]();};}function saveUpdates(_0x4b0862,_0x457f40){return function(_0x48e218){if(_0x48e218){return _0x48e218[_0x853d('0x28')](_0x4b0862)[_0x853d('0x29')](function(_0x1bd913){return _0x1bd913;});}return null;};}function removeEntity(_0xcd36b6,_0x3afc23){return function(_0x37c46c){if(_0x37c46c){return _0x37c46c['destroy']()[_0x853d('0x29')](function(){var _0x3bb534=_0x37c46c[_0x853d('0x2a')]({'plain':!![]});var _0x3b9d10=_0x853d('0x2b');return db[_0x853d('0x2c')]['destroy']({'where':{'type':_0x3b9d10,'resourceId':_0x3bb534['id']}})[_0x853d('0x29')](function(){return _0x37c46c;});})[_0x853d('0x29')](function(){_0xcd36b6['status'](0xcc)[_0x853d('0x2d')]();});}};}function handleEntityNotFound(_0x2f8493,_0x58698f){return function(_0x39673d){if(!_0x39673d){_0x2f8493[_0x853d('0x20')](0x194);}return _0x39673d;};}function handleError(_0x26fb47,_0x3f2552){_0x3f2552=_0x3f2552||0x1f4;return function(_0x541cab){logger[_0x853d('0x2e')](_0x541cab[_0x853d('0x2f')]);if(_0x541cab[_0x853d('0x30')]){delete _0x541cab[_0x853d('0x30')];}_0x26fb47[_0x853d('0x21')](_0x3f2552)['send'](_0x541cab);};}exports[_0x853d('0x31')]=function(_0xa0b52f,_0xe4fd07){var _0x59b854={},_0x5982ed={},_0x2afa1c={'count':0x0,'rows':[]};var _0x8a8cfc=_[_0x853d('0x32')](db[_0x853d('0x33')][_0x853d('0x34')],function(_0x1e7a87){return{'name':_0x1e7a87[_0x853d('0x35')],'type':_0x1e7a87[_0x853d('0x36')][_0x853d('0x37')]};});_0x5982ed[_0x853d('0x38')]=_[_0x853d('0x32')](_0x8a8cfc,_0x853d('0x30'));_0x5982ed[_0x853d('0x39')]=_[_0x853d('0x3a')](_0xa0b52f[_0x853d('0x39')]);_0x5982ed[_0x853d('0x3b')]=_['intersection'](_0x5982ed[_0x853d('0x38')],_0x5982ed['query']);_0x59b854[_0x853d('0x3c')]=_[_0x853d('0x3d')](_0x5982ed[_0x853d('0x38')],qs[_0x853d('0x3e')](_0xa0b52f['query'][_0x853d('0x3e')]));_0x59b854[_0x853d('0x3c')]=_0x59b854[_0x853d('0x3c')][_0x853d('0x3f')]?_0x59b854['attributes']:_0x5982ed[_0x853d('0x38')];if(!_0xa0b52f[_0x853d('0x39')]['hasOwnProperty'](_0x853d('0x40'))){_0x59b854[_0x853d('0x24')]=qs[_0x853d('0x24')](_0xa0b52f[_0x853d('0x39')][_0x853d('0x24')]);_0x59b854[_0x853d('0x23')]=qs[_0x853d('0x23')](_0xa0b52f[_0x853d('0x39')][_0x853d('0x23')]);}_0x59b854[_0x853d('0x41')]=qs[_0x853d('0x42')](_0xa0b52f[_0x853d('0x39')][_0x853d('0x42')]);_0x59b854[_0x853d('0x43')]=qs[_0x853d('0x3b')](_[_0x853d('0x44')](_0xa0b52f[_0x853d('0x39')],_0x5982ed['filters']));if(_0xa0b52f[_0x853d('0x39')][_0x853d('0x45')]){_0x59b854[_0x853d('0x43')]=_[_0x853d('0x46')](_0x59b854['where'],{'$or':_[_0x853d('0x32')](_0x8a8cfc,function(_0xf78717){if(_0xf78717['type']!==_0x853d('0x47')){var _0x1592e3={};_0x1592e3[_0xf78717[_0x853d('0x30')]]={'$like':'%'+_0xa0b52f[_0x853d('0x39')][_0x853d('0x45')]+'%'};return _0x1592e3;}})});}_0x59b854=_['merge']({},_0x59b854,_0xa0b52f[_0x853d('0x48')]);var _0x269ebb={'where':_0x59b854['where']};return db[_0x853d('0x33')][_0x853d('0x22')](_0x269ebb)[_0x853d('0x29')](function(_0x3d57e0){_0x2afa1c[_0x853d('0x22')]=_0x3d57e0;if(_0xa0b52f[_0x853d('0x39')][_0x853d('0x49')]){_0x59b854['include']=[{'all':!![]}];}return db[_0x853d('0x33')][_0x853d('0x4a')](_0x59b854);})[_0x853d('0x29')](function(_0x155a4e){_0x2afa1c['rows']=_0x155a4e;return _0x2afa1c;})['then'](respondWithFilteredResult(_0xe4fd07,_0x59b854))[_0x853d('0x4b')](handleError(_0xe4fd07,null));};exports[_0x853d('0x4c')]=function(_0x4d8430,_0x570a75){var _0x401c81={'raw':!![],'where':{'id':_0x4d8430['params']['id']}},_0x2dbe3b={};_0x2dbe3b[_0x853d('0x38')]=_[_0x853d('0x3a')](db[_0x853d('0x33')]['rawAttributes']);_0x2dbe3b['query']=_[_0x853d('0x3a')](_0x4d8430[_0x853d('0x39')]);_0x2dbe3b[_0x853d('0x3b')]=_[_0x853d('0x3d')](_0x2dbe3b[_0x853d('0x38')],_0x2dbe3b['query']);_0x401c81['attributes']=_[_0x853d('0x3d')](_0x2dbe3b['model'],qs['fields'](_0x4d8430[_0x853d('0x39')]['fields']));_0x401c81[_0x853d('0x3c')]=_0x401c81[_0x853d('0x3c')][_0x853d('0x3f')]?_0x401c81[_0x853d('0x3c')]:_0x2dbe3b[_0x853d('0x38')];if(_0x4d8430['query'][_0x853d('0x49')]){_0x401c81[_0x853d('0x4d')]=[{'all':!![]}];}_0x401c81=_['merge']({},_0x401c81,_0x4d8430[_0x853d('0x48')]);return db['Plugin'][_0x853d('0x4e')](_0x401c81)[_0x853d('0x29')](handleEntityNotFound(_0x570a75,null))[_0x853d('0x29')](respondWithResult(_0x570a75,null))[_0x853d('0x4b')](handleError(_0x570a75,null));};exports[_0x853d('0x4f')]=function(_0x219bd2,_0x293ca5,_0x3ca7e6){return db[_0x853d('0x33')][_0x853d('0x4e')]({'where':{'id':_0x219bd2[_0x853d('0x50')]['id']},'attributes':['name','path'],'raw':!![]})[_0x853d('0x29')](handleEntityNotFound(_0x293ca5,null))[_0x853d('0x29')](function(_0x1f5021){if(_0x1f5021){var _0x3e8a18=path['join'](config[_0x853d('0x51')],_0x853d('0x52'),util['format'](_0x853d('0x53'),path[_0x853d('0x54')](_0x1f5021[_0x853d('0x9')])));var _0x4fa76b=fs['createWriteStream'](_0x3e8a18);var _0x300ddf=archiver(_0x853d('0x55'),{'zlib':{'level':0x9}});_0x300ddf['on'](_0x853d('0x56'),function(_0x5c78a4){if(_0x5c78a4['code']==='ENOENT'){logger['error'](_0x5c78a4);}else{throw new db['Sequelize']['Error'](_0x853d('0x57'));}});_0x300ddf['on'](_0x853d('0x2e'),function(_0x335a1a){throw new db[(_0x853d('0x58'))][(_0x853d('0x59'))](_0x853d('0x57'));});_0x300ddf[_0x853d('0x5a')](_0x4fa76b);_0x300ddf[_0x853d('0x5b')]('**/*',{'cwd':path['join'](config[_0x853d('0x51')],'server/files/plugins',path[_0x853d('0x5c')](_0x1f5021[_0x853d('0x9')])),'ignore':[path[_0x853d('0x5d')](path[_0x853d('0x54')](_0x1f5021['path']),_0x853d('0x5e')),path[_0x853d('0x5d')](path['basename'](_0x1f5021[_0x853d('0x9')]),_0x853d('0x5f'))],'nodir':!![]})[_0x853d('0x60')]();_0x4fa76b['on'](_0x853d('0x61'),function(){if(!fs[_0x853d('0x62')](_0x3e8a18)){throw new db[(_0x853d('0x58'))][(_0x853d('0x59'))](_0x853d('0x63'));}return _0x293ca5[_0x853d('0x4f')](_0x3e8a18,util[_0x853d('0x64')](_0x853d('0x53'),path['basename'](_0x1f5021[_0x853d('0x9')])),function(_0x5a26e1){if(_0x5a26e1){throw new db[(_0x853d('0x58'))][(_0x853d('0x59'))](_0x853d('0x65'));}fs['unlinkSync'](_0x3e8a18);logger['info'](_0x853d('0x66'));logger[_0x853d('0x67')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x293ca5,null));};exports['upload']=function(_0x1fbcbb,_0x283e7e,_0x5ec07f){var _0x1157b9=path[_0x853d('0x54')](_0x1fbcbb[_0x853d('0x68')][_0x853d('0x69')],path['extname'](_0x1fbcbb[_0x853d('0x68')]['filename']));var _0x124341=path['join'](config['root'],_0x853d('0x52'),_0x1fbcbb[_0x853d('0x68')][_0x853d('0x69')]);var _0x3f474c=path['join'](config[_0x853d('0x51')],_0x853d('0x52'),_0x1157b9);logger[_0x853d('0x67')](_0x853d('0x6a'),_0x124341);logger[_0x853d('0x67')](_0x853d('0x6b'),_0x3f474c);try{fs['chmodSync'](_0x124341,parseInt(_0x853d('0x6c'),0x8));extract(_0x124341,{'dir':_0x3f474c},function(_0x4a52ba){if(_0x4a52ba){logger[_0x853d('0x2e')](_0x4a52ba);handleError(_0x4a52ba,!![]);};var _0x4a5463=fs['readdirSync'](_0x3f474c);if(_0x4a5463[_0x853d('0x3f')]>0x1){removeReferences(_0x124341,_0x3f474c);logger[_0x853d('0x2e')](_0x853d('0x6d'));return _0x5ec07f(new Error('Invalid\x20plugin\x20structure'));}var _0x2b082a=fs['lstatSync'](path[_0x853d('0x5d')](_0x3f474c,_0x4a5463[0x0]));if(_0x2b082a[_0x853d('0x6e')]()){removeReferences(_0x124341,_0x3f474c);logger['error'](_0x853d('0x6d'));return _0x5ec07f(new Error(_0x853d('0x6d')));}if(_0x2b082a[_0x853d('0x6f')]()){var _0x4a24f2=fs[_0x853d('0x70')](path[_0x853d('0x5d')](_0x3f474c,_0x4a5463[0x0]));if(_0x4a24f2[_0x853d('0x3f')]===0x0){removeReferences(_0x124341,_0x3f474c);logger[_0x853d('0x2e')](_0x853d('0x6d'));return _0x5ec07f(new Error(_0x853d('0x6d')));}var _0xe59474=_0x4a24f2[_0x853d('0x71')](function(_0x38b9de){return _0x38b9de==='manifest.json';});if(!_0xe59474){return _0x5ec07f(new Error(_0x853d('0x72')));}var _0x581dde=fs['readFileSync'](path['join'](_0x3f474c,_0x4a5463[0x0],_0x853d('0x73')));var _0x3ba303=JSON[_0x853d('0x74')](_0x581dde);if('undefined'==typeof _0x3ba303[_0x853d('0x30')]){return _0x5ec07f(new Error(_0x853d('0x75')));}if(_0x853d('0x76')==typeof _0x3ba303[_0x853d('0x36')]){return _0x5ec07f(new Error(_0x853d('0x77')));}if(_0x853d('0x76')==typeof _0x3ba303[_0x853d('0x78')]){return _0x5ec07f(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x853d('0x76')==typeof _0x3ba303['parameters']){return _0x5ec07f(new Error(_0x853d('0x79')));}if(_0x3ba303[_0x853d('0x36')]===_0x853d('0x7a')){if(_0x853d('0x76')==typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')]){return _0x5ec07f(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7d')]&&_0x853d('0x76')==typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7e')]){return _0x5ec07f(new Error(_0x853d('0x7f')));}}else if(_0x3ba303[_0x853d('0x36')]==='script'){if('undefined'==typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x80')]){return _0x5ec07f(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x853d('0x76')==typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x81')]){return _0x5ec07f(new Error(_0x853d('0x82')));}}else{return _0x5ec07f(new Error(_0x853d('0x83')));}var _0x25421f=_0x3ba303['name'];var _0x3e7ed5=_0x3ba303[_0x853d('0x84')];var _0x28dd42=_0x3ba303[_0x853d('0x36')];var _0x362f6f=_0x3ba303[_0x853d('0x85')]?_0x3ba303['sidebar']:'always';var _0x1f2d72=_0x3ba303[_0x853d('0x86')]?_0x3ba303['icon']:'icon-apps';var _0x33b33='';var _0x2382ca='';var _0x54d003='';var _0x211696='';var _0x47e8c6=_0x3ba303[_0x853d('0x78')];if(_0x28dd42==='html'){if(_0x853d('0x76')!=typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7d')]){var _0x5bf391=_0x3ba303[_0x853d('0x7b')]['views'][_0x853d('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x853d('0x87')](_0x5bf391)){_0x33b33=path[_0x853d('0x5d')](_0x853d('0x88'),_0x1157b9,_0x4a5463[0x0],_0x5bf391);}else{_0x33b33=_0x5bf391;}}else{logger[_0x853d('0x67')](_0x853d('0x89'));}if(_0x853d('0x76')!=typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7e')]){var _0x41a4b5=_0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x853d('0x87')](_0x41a4b5)){_0x2382ca=path[_0x853d('0x5d')](_0x853d('0x88'),_0x1157b9,_0x4a5463[0x0],_0x41a4b5);}else{_0x2382ca=_0x41a4b5;}}else{logger[_0x853d('0x67')](_0x853d('0x8a'));}}else if(_0x28dd42===_0x853d('0x8b')){_0x54d003=_0x3ba303[_0x853d('0x7b')][_0x853d('0x80')];_0x211696=_0x3ba303[_0x853d('0x7b')]['scriptPath'];if(_0x853d('0x76')!=typeof _0x3ba303['parameters']['views']){if('undefined'!=typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7d')]){var _0x5bf391=_0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x853d('0x87')](_0x5bf391)){_0x33b33=path[_0x853d('0x5d')](_0x853d('0x88'),_0x1157b9,_0x4a5463[0x0],_0x5bf391);}else{_0x33b33=_0x5bf391;}}if(_0x853d('0x76')!=typeof _0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')]['agent']){var _0x41a4b5=_0x3ba303[_0x853d('0x7b')][_0x853d('0x7c')][_0x853d('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x853d('0x87')](_0x41a4b5)){_0x2382ca=path['join'](_0x853d('0x88'),_0x1157b9,_0x4a5463[0x0],_0x41a4b5);}else{_0x2382ca=_0x41a4b5;}}}}var _0x50e4bf={'name':_0x25421f,'description':_0x3e7ed5,'path':path[_0x853d('0x5d')](_0x1157b9,_0x4a5463[0x0]),'type':_0x28dd42,'sidebar':_0x362f6f,'icon':_0x1f2d72,'adminUrl':_0x33b33,'agentUrl':_0x2382ca,'scriptName':_0x54d003,'scriptPath':_0x211696,'version':_0x47e8c6};removeReferences(_0x124341,null);return db['Plugin'][_0x853d('0x8c')](_0x50e4bf)[_0x853d('0x29')](function(_0x3ec812){var _0x3183a3={'role':_0x1fbcbb[_0x853d('0x8d')]['role'],'userProfileId':_0x1fbcbb[_0x853d('0x8d')]['userProfileId']};if(!_0x3183a3)throw new Error(_0x853d('0x8e'));if(_0x3183a3['role']==='user'){var _0x4e26e0=_0x3ec812[_0x853d('0x2a')]({'plain':!![]});return db[_0x853d('0x8f')][_0x853d('0x4e')]({'where':{'name':_0x853d('0x2b'),'userProfileId':_0x3183a3[_0x853d('0x90')]},'raw':!![]})[_0x853d('0x29')](function(_0x488669){if(_0x488669&&_0x488669[_0x853d('0x91')]===0x0){return db[_0x853d('0x2c')][_0x853d('0x8c')]({'name':_0x4e26e0[_0x853d('0x30')],'resourceId':_0x4e26e0['id'],'type':_0x488669['name'],'sectionId':_0x488669['id']},{})['then'](function(){return _0x3ec812;});}else{return _0x3ec812;}})[_0x853d('0x4b')](function(_0x4f59c9){logger[_0x853d('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f59c9);throw _0x4f59c9;});}return _0x3ec812;})[_0x853d('0x29')](respondWithResult(_0x283e7e,null))['catch'](handleError(_0x283e7e,null));}});}catch(_0x11e44d){_0x283e7e[_0x853d('0x21')](0x1f4)[_0x853d('0x92')](_0x11e44d);}};function removeReferences(_0x2f76fa,_0x409ea4){try{if(_0x2f76fa){fs['unlinkSync'](_0x2f76fa);logger['info'](_0x853d('0x93'));}if(_0x409ea4){rimraf(_0x409ea4,function(){});logger[_0x853d('0x67')]('Extracted\x20folder\x20removed');}}catch(_0x42e95a){logger['error'](_0x42e95a);}}exports[_0x853d('0x28')]=function(_0x3d9130,_0x1df96c,_0x1f1f89){return db[_0x853d('0x33')]['find']({'where':{'id':_0x3d9130[_0x853d('0x50')]['id']}})[_0x853d('0x29')](handleEntityNotFound(_0x1df96c,null))[_0x853d('0x29')](saveUpdates(_0x3d9130[_0x853d('0x8d')],null))[_0x853d('0x29')](respondWithResult(_0x1df96c,null))[_0x853d('0x4b')](handleError(_0x1df96c,null));};exports[_0x853d('0x94')]=function(_0x128da,_0x313994,_0xc4fdc7){return db[_0x853d('0x33')][_0x853d('0x4e')]({'where':{'id':_0x128da['params']['id']}})[_0x853d('0x29')](function(_0x5dc5ad){if(_0x5dc5ad){return _0x5dc5ad['destroy']();}})['then'](function(_0xb52b02){rimraf(path['join'](config[_0x853d('0x51')],_0x853d('0x52'),path[_0x853d('0x5c')](_0xb52b02['path'])),function(){});return _0xb52b02;})[_0x853d('0x29')](handleEntityNotFound(_0x313994,null))[_0x853d('0x29')](respondWithStatusCode(_0x313994,null))['catch'](handleError(_0x313994,null));};exports[_0x853d('0x95')]=function(_0x277c01,_0x84723d,_0x109602){return BPromise['resolve']()[_0x853d('0x29')](function(){if(!_0x277c01[_0x853d('0x39')][_0x853d('0x9')]){throw new Error(_0x853d('0x96'));}if(!_0x277c01[_0x853d('0x39')][_0x853d('0x97')]){throw new Error(_0x853d('0x98'));}var _0x1b6024=_0x277c01[_0x853d('0x39')][_0x853d('0x99')]?_0x277c01[_0x853d('0x39')][_0x853d('0x99')]+':'+_0x277c01[_0x853d('0x39')][_0x853d('0x97')]:_0x853d('0x9a')+_0x277c01[_0x853d('0x39')][_0x853d('0x97')];var _0x56d79d=_0x277c01[_0x853d('0x39')][_0x853d('0x25')]?_0x277c01[_0x853d('0x39')][_0x853d('0x25')]:!![];var _0xe83c28=_0x277c01[_0x853d('0x39')][_0x853d('0x9b')]?_0x277c01[_0x853d('0x39')][_0x853d('0x9b')]:null;var _0x2e1f01={'method':_0x277c01[_0x853d('0x9c')],'uri':util[_0x853d('0x64')](_0x853d('0x9d'),_0x1b6024,_0x277c01[_0x853d('0x39')][_0x853d('0x9')]),'json':_0x56d79d,'resolveWithFullResponse':!![],'encoding':_0xe83c28,'qs':_0x277c01['query']};if(_0x277c01['headers']){_0x2e1f01['headers']=_0x277c01[_0x853d('0x9e')];if(_0x2e1f01[_0x853d('0x9e')][_0x853d('0x9f')]){delete _0x2e1f01['headers'][_0x853d('0x9f')];}}if(_0x2e1f01[_0x853d('0x9e')][_0x853d('0xa0')]){delete _0x2e1f01[_0x853d('0x9e')][_0x853d('0xa0')];}return rp(_0x2e1f01);})['then'](function(_0x537b9f){if(_0x537b9f){_0x84723d[_0x853d('0xa1')](_0x537b9f[_0x853d('0x9e')]);logger[_0x853d('0x67')](_0x537b9f[_0x853d('0x8d')]);if(_[_0x853d('0xa2')](_0x277c01[_0x853d('0x39')]['path'],_0x853d('0x4f'))&&_0x537b9f['statusCode']==0x1f4){return _0x84723d[_0x853d('0x20')](_0x537b9f[_0x853d('0xa3')]);}else{return _0x84723d['status'](_0x537b9f[_0x853d('0xa3')])[_0x853d('0x92')](_0x537b9f['body']);}}else{return _0x84723d['sendStatus'](0xc8);}})[_0x853d('0x4b')](handleError(_0x84723d,null));};exports[_0x853d('0xa4')]=function(_0x32f3ae,_0x5d1030,_0x572dec){return BPromise[_0x853d('0xa5')]()[_0x853d('0x29')](function(){if(!_0x32f3ae[_0x853d('0x39')][_0x853d('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x32f3ae[_0x853d('0x39')]['port']){throw new Error(_0x853d('0x98'));}var _0x11f374=_0x32f3ae[_0x853d('0x39')][_0x853d('0x99')]?_0x32f3ae[_0x853d('0x39')][_0x853d('0x99')]+':'+_0x32f3ae[_0x853d('0x39')]['port']:_0x853d('0x9a')+_0x32f3ae[_0x853d('0x39')][_0x853d('0x97')];var _0x33f9b7=_0x32f3ae[_0x853d('0x39')][_0x853d('0x25')]?_0x32f3ae[_0x853d('0x39')][_0x853d('0x25')]:!![];var _0x5bf131=_0x32f3ae[_0x853d('0x39')][_0x853d('0x9b')]?_0x32f3ae[_0x853d('0x39')][_0x853d('0x9b')]:null;var _0x455e6f={'method':_0x32f3ae['method'],'uri':util[_0x853d('0x64')](_0x853d('0x9d'),_0x11f374,_0x32f3ae[_0x853d('0x39')]['path']),'json':_0x33f9b7,'resolveWithFullResponse':!![],'encoding':_0x5bf131,'body':_0x32f3ae[_0x853d('0x8d')]};if(_0x32f3ae[_0x853d('0x9e')]){_0x455e6f['headers']=_0x32f3ae['headers'];if(_0x455e6f['headers']['content-length']){delete _0x455e6f[_0x853d('0x9e')][_0x853d('0x9f')];}}if(_0x455e6f['headers'][_0x853d('0xa0')]){delete _0x455e6f[_0x853d('0x9e')][_0x853d('0xa0')];}return rp(_0x455e6f);})['then'](function(_0x4f0561){if(_0x4f0561){_0x5d1030[_0x853d('0xa1')](_0x4f0561[_0x853d('0x9e')]);logger['info'](_0x4f0561[_0x853d('0x8d')]);return _0x5d1030[_0x853d('0x21')](_0x4f0561[_0x853d('0xa3')])[_0x853d('0x92')](_0x4f0561[_0x853d('0x8d')]);}else{return _0x5d1030[_0x853d('0x20')](0xc8);}})[_0x853d('0x4b')](handleError(_0x5d1030,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 37c84c5..b4da604 100644 --- a/server/api/plugin/plugin.events.js +++ b/server/api/plugin/plugin.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x781d=['hasOwnProperty','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x781d,0x14a));var _0xd781=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x781d[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0xd781('0x0'));var Plugin=require(_0xd781('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd781('0x2'),'afterUpdate':_0xd781('0x3'),'afterDestroy':_0xd781('0x4')};function emitEvent(_0x1a9f94){return function(_0xfd915d,_0x42258e,_0x446534){PluginEvents[_0xd781('0x5')](_0x1a9f94+':'+_0xfd915d['id'],_0xfd915d);PluginEvents[_0xd781('0x5')](_0x1a9f94,_0xfd915d);_0x446534(null);};}for(var e in events){if(events[_0xd781('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xd781('0x7')]=PluginEvents; \ No newline at end of file +var _0x4888=['emit','hasOwnProperty','hook','../../mysqldb','Plugin','setMaxListeners','save','update','remove'];(function(_0x2dd752,_0x59b4fc){var _0x297823=function(_0x44a37f){while(--_0x44a37f){_0x2dd752['push'](_0x2dd752['shift']());}};_0x297823(++_0x59b4fc);}(_0x4888,0x198));var _0x8488=function(_0x36199a,_0x4f756c){_0x36199a=_0x36199a-0x0;var _0x5b36f1=_0x4888[_0x36199a];return _0x5b36f1;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x8488('0x0'))['db'][_0x8488('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x8488('0x2')](0x0);var events={'afterCreate':_0x8488('0x3'),'afterUpdate':_0x8488('0x4'),'afterDestroy':_0x8488('0x5')};function emitEvent(_0x19e51d){return function(_0x571e4b,_0x267093,_0xf45c3f){PluginEvents[_0x8488('0x6')](_0x19e51d+':'+_0x571e4b['id'],_0x571e4b);PluginEvents[_0x8488('0x6')](_0x19e51d,_0x571e4b);_0xf45c3f(null);};}for(var e in events){if(events[_0x8488('0x7')](e)){var event=events[e];Plugin[_0x8488('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index e980efb..57547c3 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 _0x0e85=['api','moment','rimraf','./plugin.attributes','exports','Plugin','plugins','lodash','util'];(function(_0x5c7b0c,_0x248628){var _0x5318b9=function(_0x45ed9d){while(--_0x45ed9d){_0x5c7b0c['push'](_0x5c7b0c['shift']());}};_0x5318b9(++_0x248628);}(_0x0e85,0x7c));var _0x50e8=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x0e85[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var logger=require('../../config/logger')(_0x50e8('0x2'));var moment=require(_0x50e8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50e8('0x4'));var config=require('../../config/environment');var attributes=require(_0x50e8('0x5'));module[_0x50e8('0x6')]=function(_0xe3151e,_0xfde42){return _0xe3151e['define'](_0x50e8('0x7'),attributes,{'tableName':_0x50e8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2d17=['define','plugins','lodash','util','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x1b2efa,_0x140918){var _0x451b76=function(_0x11d0fd){while(--_0x11d0fd){_0x1b2efa['push'](_0x1b2efa['shift']());}};_0x451b76(++_0x140918);}(_0x2d17,0x17e));var _0x72d1=function(_0x389b45,_0x31d117){_0x389b45=_0x389b45-0x0;var _0x3ad29=_0x2d17[_0x389b45];return _0x3ad29;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var logger=require('../../config/logger')(_0x72d1('0x2'));var moment=require(_0x72d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d1('0x4'));var fs=require('fs');var path=require(_0x72d1('0x5'));var rimraf=require('rimraf');var config=require(_0x72d1('0x6'));var attributes=require('./plugin.attributes');module[_0x72d1('0x7')]=function(_0x50f551,_0x139ba0){return _0x50f551[_0x72d1('0x8')]('Plugin',attributes,{'tableName':_0x72d1('0x9'),'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 ff109af..a5c49c7 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 _0x726e=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','register','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','raw','then','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ee36a,_0x251663){var _0x275e3a=function(_0x480321){while(--_0x480321){_0x4ee36a['push'](_0x4ee36a['shift']());}};_0x275e3a(++_0x251663);}(_0x726e,0x130));var _0xe726=function(_0x588791,_0x35a42e){_0x588791=_0x588791-0x0;var _0x28937a=_0x726e[_0x588791];return _0x28937a;};'use strict';var _=require(_0xe726('0x0'));var util=require(_0xe726('0x1'));var moment=require('moment');var BPromise=require(_0xe726('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe726('0x3'))['db'];var utils=require(_0xe726('0x4'));var logger=require(_0xe726('0x5'))(_0xe726('0x6'));var config=require(_0xe726('0x7'));var jayson=require(_0xe726('0x8'));var client=jayson[_0xe726('0x9')][_0xe726('0xa')]({'port':0x232a});config[_0xe726('0xb')]=_[_0xe726('0xc')](config[_0xe726('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xe726('0xd'))(new Redis(config[_0xe726('0xb')]));require(_0xe726('0xe'))[_0xe726('0xf')](socket);function respondWithRpcPromise(_0x16fa33,_0x362288,_0xbdc433){return new BPromise(function(_0x2f7588,_0x3418f5){return client['request'](_0x16fa33,_0xbdc433)['then'](function(_0x5d5599){logger[_0xe726('0x10')](_0xe726('0x11'),_0x362288,_0xe726('0x12'));logger[_0xe726('0x13')](_0xe726('0x14'),_0x362288,_0xe726('0x12'),JSON[_0xe726('0x15')](_0x5d5599));if(_0x5d5599['error']){if(_0x5d5599[_0xe726('0x16')][_0xe726('0x17')]===0x1f4){logger[_0xe726('0x16')](_0xe726('0x11'),_0x362288,_0x5d5599[_0xe726('0x16')][_0xe726('0x18')]);return _0x3418f5(_0x5d5599[_0xe726('0x16')][_0xe726('0x18')]);}logger[_0xe726('0x16')](_0xe726('0x11'),_0x362288,_0x5d5599['error'][_0xe726('0x18')]);return _0x2f7588(_0x5d5599['error'][_0xe726('0x18')]);}else{logger[_0xe726('0x10')](_0xe726('0x11'),_0x362288,_0xe726('0x12'));_0x2f7588(_0x5d5599[_0xe726('0x19')]['message']);}})[_0xe726('0x1a')](function(_0x36369a){logger[_0xe726('0x16')]('Plugin,\x20%s,\x20%s',_0x362288,_0x36369a);_0x3418f5(_0x36369a);});});}exports[_0xe726('0x1b')]=function(_0x2816b2){var _0x345b8c=this;return new Promise(function(_0x5d7dcc,_0x4ae112){return db[_0xe726('0x1c')]['create'](_0x2816b2['body'],{'raw':_0x2816b2['options']?_0x2816b2['options'][_0xe726('0x1d')]===undefined?!![]:![]:!![]})[_0xe726('0x1e')](function(_0x3cfabb){logger[_0xe726('0x10')]('CreatePlugin',_0x2816b2);logger[_0xe726('0x13')]('CreatePlugin',_0x2816b2,JSON['stringify'](_0x3cfabb));_0x5d7dcc(_0x3cfabb);})['catch'](function(_0x130c04){logger[_0xe726('0x16')](_0xe726('0x1b'),_0x130c04[_0xe726('0x18')],_0x2816b2);_0x4ae112(_0x345b8c[_0xe726('0x16')](0x1f4,_0x130c04['message']));});});}; \ No newline at end of file +var _0x1b01=['code','message','catch','CreatePlugin','Plugin','create','body','raw','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./plugin.socket','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3bdf4b,_0x3e87d6){var _0x18dc5b=function(_0x18db8f){while(--_0x18db8f){_0x3bdf4b['push'](_0x3bdf4b['shift']());}};_0x18dc5b(++_0x3e87d6);}(_0x1b01,0xc8));var _0x11b0=function(_0x13d4f8,_0x2657ef){_0x13d4f8=_0x13d4f8-0x0;var _0x424d9d=_0x1b01[_0x13d4f8];return _0x424d9d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11b0('0x0'));var BPromise=require(_0x11b0('0x1'));var rs=require(_0x11b0('0x2'));var fs=require('fs');var Redis=require(_0x11b0('0x3'));var db=require(_0x11b0('0x4'))['db'];var utils=require(_0x11b0('0x5'));var logger=require(_0x11b0('0x6'))(_0x11b0('0x7'));var config=require(_0x11b0('0x8'));var jayson=require(_0x11b0('0x9'));var client=jayson['client'][_0x11b0('0xa')]({'port':0x232a});config[_0x11b0('0xb')]=_[_0x11b0('0xc')](config[_0x11b0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x11b0('0xd'))(new Redis(config[_0x11b0('0xb')]));require(_0x11b0('0xe'))[_0x11b0('0xf')](socket);function respondWithRpcPromise(_0x644d5a,_0x3893be,_0x5aa251){return new BPromise(function(_0x1d1a84,_0x10730f){return client['request'](_0x644d5a,_0x5aa251)[_0x11b0('0x10')](function(_0x2afc06){logger[_0x11b0('0x11')](_0x11b0('0x12'),_0x3893be,_0x11b0('0x13'));logger[_0x11b0('0x14')](_0x11b0('0x15'),_0x3893be,'request\x20sent',JSON[_0x11b0('0x16')](_0x2afc06));if(_0x2afc06[_0x11b0('0x17')]){if(_0x2afc06[_0x11b0('0x17')][_0x11b0('0x18')]===0x1f4){logger[_0x11b0('0x17')](_0x11b0('0x12'),_0x3893be,_0x2afc06[_0x11b0('0x17')][_0x11b0('0x19')]);return _0x10730f(_0x2afc06['error'][_0x11b0('0x19')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x3893be,_0x2afc06[_0x11b0('0x17')][_0x11b0('0x19')]);return _0x1d1a84(_0x2afc06[_0x11b0('0x17')][_0x11b0('0x19')]);}else{logger[_0x11b0('0x11')](_0x11b0('0x12'),_0x3893be,_0x11b0('0x13'));_0x1d1a84(_0x2afc06['result'][_0x11b0('0x19')]);}})[_0x11b0('0x1a')](function(_0x1fd10b){logger[_0x11b0('0x17')]('Plugin,\x20%s,\x20%s',_0x3893be,_0x1fd10b);_0x10730f(_0x1fd10b);});});}exports[_0x11b0('0x1b')]=function(_0x186ee5){var _0x557ea3=this;return new Promise(function(_0xb2228e,_0x44840c){return db[_0x11b0('0x1c')][_0x11b0('0x1d')](_0x186ee5[_0x11b0('0x1e')],{'raw':_0x186ee5['options']?_0x186ee5['options'][_0x11b0('0x1f')]===undefined?!![]:![]:!![]})[_0x11b0('0x10')](function(_0x238fbc){logger[_0x11b0('0x11')](_0x11b0('0x1b'),_0x186ee5);logger['debug'](_0x11b0('0x1b'),_0x186ee5,JSON[_0x11b0('0x16')](_0x238fbc));_0xb2228e(_0x238fbc);})[_0x11b0('0x1a')](function(_0x3d87bd){logger[_0x11b0('0x17')]('CreatePlugin',_0x3d87bd['message'],_0x186ee5);_0x44840c(_0x557ea3[_0x11b0('0x17')](0x1f4,_0x3d87bd[_0x11b0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 3c52f3d..abd0b85 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 _0x83f6=['plugin:','./plugin.events','save','remove','emit','removeListener','register'];(function(_0xae2a1f,_0x29eaca){var _0x3fc6e2=function(_0x4288f0){while(--_0x4288f0){_0xae2a1f['push'](_0xae2a1f['shift']());}};_0x3fc6e2(++_0x29eaca);}(_0x83f6,0x1dd));var _0x683f=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0x83f6[_0x55c485];return _0x6bb521;};'use strict';var PluginEvents=require(_0x683f('0x0'));var events=[_0x683f('0x1'),_0x683f('0x2'),'update'];function createListener(_0x3e61f5,_0x3b83a7){return function(_0x6ccab){_0x3b83a7[_0x683f('0x3')](_0x3e61f5,_0x6ccab);};}function removeListener(_0x14a988,_0x5ccb79){return function(){PluginEvents[_0x683f('0x4')](_0x14a988,_0x5ccb79);};}exports[_0x683f('0x5')]=function(_0x36ba4c){for(var _0x59fe20=0x0,_0x32a955=events['length'];_0x59fe20<_0x32a955;_0x59fe20++){var _0x815ad=events[_0x59fe20];var _0x27760f=createListener(_0x683f('0x6')+_0x815ad,_0x36ba4c);PluginEvents['on'](_0x815ad,_0x27760f);}}; \ No newline at end of file +var _0x6569=['removeListener','plugin:','save','remove','emit'];(function(_0x257e65,_0x3f4a68){var _0x3eef2f=function(_0x1c61e2){while(--_0x1c61e2){_0x257e65['push'](_0x257e65['shift']());}};_0x3eef2f(++_0x3f4a68);}(_0x6569,0x129));var _0x9656=function(_0x2536d0,_0x308433){_0x2536d0=_0x2536d0-0x0;var _0x53691d=_0x6569[_0x2536d0];return _0x53691d;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x9656('0x0'),_0x9656('0x1'),'update'];function createListener(_0x1c01a0,_0x5c089e){return function(_0x108dcf){_0x5c089e[_0x9656('0x2')](_0x1c01a0,_0x108dcf);};}function removeListener(_0x3edc60,_0x5acbc0){return function(){PluginEvents[_0x9656('0x3')](_0x3edc60,_0x5acbc0);};}exports['register']=function(_0x17c46e){for(var _0x5ec825=0x0,_0x50dbeb=events['length'];_0x5ec825<_0x50dbeb;_0x5ec825++){var _0x3a08bf=events[_0x5ec825];var _0x23de68=createListener(_0x9656('0x4')+_0x3a08bf,_0x17c46e);PluginEvents['on'](_0x3a08bf,_0x23de68);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index f8d6f48..cc2686e 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 _0xb084=['isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','express','./pm2.controller','get'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xb084,0x169));var _0x4b08=function(_0x95095e,_0x1151a6){_0x95095e=_0x95095e-0x0;var _0x3ea7f7=_0xb084[_0x95095e];return _0x3ea7f7;};'use strict';var express=require(_0x4b08('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x4b08('0x1'));router[_0x4b08('0x2')]('/',auth[_0x4b08('0x3')](),controller[_0x4b08('0x4')]);router[_0x4b08('0x2')](_0x4b08('0x5'),auth['isAuthenticated'](),controller[_0x4b08('0x6')]);router['post']('/',auth[_0x4b08('0x3')](),controller[_0x4b08('0x7')]);router[_0x4b08('0x8')](_0x4b08('0x5'),auth[_0x4b08('0x3')](),controller[_0x4b08('0x9')]);router[_0x4b08('0xa')](_0x4b08('0x5'),auth[_0x4b08('0x3')](),controller[_0x4b08('0xb')]);module[_0x4b08('0xc')]=router; \ No newline at end of file +var _0x3dc9=['create','put','update','delete','express','Router','./pm2.controller','get','isAuthenticated','index','/:id','show'];(function(_0x454f30,_0x576cde){var _0x3c16c1=function(_0x29a727){while(--_0x29a727){_0x454f30['push'](_0x454f30['shift']());}};_0x3c16c1(++_0x576cde);}(_0x3dc9,0x94));var _0x93dc=function(_0x1aea31,_0x2c9184){_0x1aea31=_0x1aea31-0x0;var _0x2b6f52=_0x3dc9[_0x1aea31];return _0x2b6f52;};'use strict';var express=require(_0x93dc('0x0'));var router=express[_0x93dc('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x93dc('0x2'));router[_0x93dc('0x3')]('/',auth[_0x93dc('0x4')](),controller[_0x93dc('0x5')]);router['get'](_0x93dc('0x6'),auth['isAuthenticated'](),controller[_0x93dc('0x7')]);router['post']('/',auth[_0x93dc('0x4')](),controller[_0x93dc('0x8')]);router[_0x93dc('0x9')](_0x93dc('0x6'),auth['isAuthenticated'](),controller[_0x93dc('0xa')]);router[_0x93dc('0xb')](_0x93dc('0x6'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 7b7818d..ae21edf 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 _0xfd3e=['api','child_process','exec','bluebird','sendStatus','json','error','name','send','npm\x20install','info','index','list','then','express','motion2','length','catch','show','describe','params','create','body','../../files/plugins','script','cwd','dirname','chdir','start','status','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','destroy','delete','dump','lodash','../../config/logger'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xfd3e,0x1d2));var _0xefd3=function(_0x45f697,_0x58dfda){_0x45f697=_0x45f697-0x0;var _0x1a579f=_0xfd3e[_0x45f697];return _0x1a579f;};'use strict';var _=require(_0xefd3('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xefd3('0x1'))(_0xefd3('0x2'));var path=require('path');var exec=require(_0xefd3('0x3'))[_0xefd3('0x4')];var BPromise=require(_0xefd3('0x5'));function handleEntityNotFound(_0x1f104d,_0x568273){return function(_0x3cf9e6){if(!_0x3cf9e6){_0x1f104d[_0xefd3('0x6')](0x194);;}return _0x3cf9e6;};}function respondWithResult(_0x524e4c,_0x54ee3c){_0x54ee3c=_0x54ee3c||0xc8;return function(_0x12028f){if(_0x12028f){return _0x524e4c['status'](_0x54ee3c)[_0xefd3('0x7')](_0x12028f);}return null;};}function handleError(_0x2a6315,_0x3c00c9){_0x3c00c9=_0x3c00c9||0x1f4;return function(_0x3eef6c){logger[_0xefd3('0x8')](_0x3eef6c['stack']);if(_0x3eef6c[_0xefd3('0x9')]){delete _0x3eef6c[_0xefd3('0x9')];}_0x2a6315['status'](_0x3c00c9)[_0xefd3('0xa')](_0x3eef6c);};}function execChildProcess(){return new BPromise(function(_0x2dc9c3,_0xbc071b){exec(_0xefd3('0xb'),function(_0x52adaa,_0x1252db,_0x5b34a0){logger[_0xefd3('0xc')](_0x1252db);logger['info'](_0x5b34a0);if(_0x52adaa){logger[_0xefd3('0x8')](_0x52adaa);return _0xbc071b(_0x52adaa);}return _0x2dc9c3(_0x1252db);});});}exports[_0xefd3('0xd')]=function(_0x5209e6,_0x55d6ca){return pm2[_0xefd3('0xe')]()[_0xefd3('0xf')](function(_0x97bf66){if(_0x97bf66){var _0x19296c=_['reject'](_0x97bf66,function(_0x3d11ae){return _0x3d11ae[_0xefd3('0x9')]===_0xefd3('0x10')||_0x3d11ae[_0xefd3('0x9')]===_0xefd3('0x11');});return{'rows':_0x19296c,'count':_0x19296c[_0xefd3('0x12')]};}return null;})[_0xefd3('0xf')](respondWithResult(_0x55d6ca,null))[_0xefd3('0x13')](handleError(_0x55d6ca,null));};exports[_0xefd3('0x14')]=function(_0x8d4521,_0x432633){return pm2[_0xefd3('0x15')](_0x8d4521[_0xefd3('0x16')]['id'])[_0xefd3('0xf')](respondWithResult(_0x432633,null))['then'](handleEntityNotFound(_0x432633,null))[_0xefd3('0x13')](handleError(_0x432633,null));};exports[_0xefd3('0x17')]=function(_0x48b978,_0x292d6b){if(_0x48b978[_0xefd3('0x18')][_0xefd3('0x9')]&&_0x48b978[_0xefd3('0x18')]['script']){var _0x34b174=path['join'](__dirname,_0xefd3('0x19'),_0x48b978[_0xefd3('0x18')][_0xefd3('0x1a')]);var _0x1842fd=process[_0xefd3('0x1b')]();process['chdir'](path[_0xefd3('0x1c')](_0x34b174));return execChildProcess()[_0xefd3('0xf')](function(_0x28de9b){process[_0xefd3('0x1d')](_0x1842fd);return pm2[_0xefd3('0x1e')]({'name':_0x48b978['body'][_0xefd3('0x9')],'script':_0x34b174});})[_0xefd3('0xf')](function(_0x291097){pm2['dump']();return _0x291097[0x0];})[_0xefd3('0xf')](respondWithResult(_0x292d6b,0xc9))['catch'](handleError(_0x292d6b,null));}else{return _0x292d6b[_0xefd3('0x1f')](0x1f4)[_0xefd3('0xa')]({'message':_0xefd3('0x20')});}};exports[_0xefd3('0x21')]=function(_0x43aaeb,_0x499ac2){if(_0x43aaeb['body']['id']){delete _0x43aaeb[_0xefd3('0x18')]['id'];}var _0x10a204={'online':_0xefd3('0x22'),'stopped':'stop'};if(_0x10a204[_0xefd3('0x23')](_0x43aaeb[_0xefd3('0x18')][_0xefd3('0x1f')])){return pm2[_0x10a204[_0x43aaeb['body'][_0xefd3('0x1f')]]](_0x43aaeb[_0xefd3('0x16')]['id'])['then'](respondWithResult(_0x499ac2,0xc8))[_0xefd3('0x13')](handleError(_0x499ac2,null));}else{return _0x499ac2['status'](0x1f4)[_0xefd3('0xa')]({'message':'Unknown\x20status'});}};exports[_0xefd3('0x24')]=function(_0x1d16c4,_0x3a0a41){if(_0x1d16c4[_0xefd3('0x18')]['id']){delete _0x1d16c4[_0xefd3('0x18')]['id'];}if(_0x1d16c4['params']['id']){return pm2[_0xefd3('0x25')](_0x1d16c4['params']['id'])[_0xefd3('0xf')](function(_0x44f2a1){pm2[_0xefd3('0x26')]();return _0x44f2a1[0x0];})['then'](respondWithResult(_0x3a0a41,null))['catch'](handleError(_0x3a0a41,null));}else{return _0x3a0a41[_0xefd3('0x1f')](0x1f4)[_0xefd3('0xa')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xa34f=['length','then','catch','show','params','create','body','script','cwd','chdir','dirname','dump','update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','reject'];(function(_0x33d318,_0x6bd7ad){var _0x219840=function(_0x17c17a){while(--_0x17c17a){_0x33d318['push'](_0x33d318['shift']());}};_0x219840(++_0x6bd7ad);}(_0xa34f,0xcc));var _0xfa34=function(_0x5bc279,_0x2f4f84){_0x5bc279=_0x5bc279-0x0;var _0x2467eb=_0xa34f[_0x5bc279];return _0x2467eb;};'use strict';var _=require(_0xfa34('0x0'));var pm2=require(_0xfa34('0x1'));var logger=require(_0xfa34('0x2'))(_0xfa34('0x3'));var path=require('path');var exec=require(_0xfa34('0x4'))[_0xfa34('0x5')];var BPromise=require(_0xfa34('0x6'));function handleEntityNotFound(_0x68b4b,_0x5755d2){return function(_0x521b80){if(!_0x521b80){_0x68b4b[_0xfa34('0x7')](0x194);;}return _0x521b80;};}function respondWithResult(_0x3009c3,_0x5a1fbc){_0x5a1fbc=_0x5a1fbc||0xc8;return function(_0x1c4659){if(_0x1c4659){return _0x3009c3[_0xfa34('0x8')](_0x5a1fbc)[_0xfa34('0x9')](_0x1c4659);}return null;};}function handleError(_0x4f8ab0,_0x1fc995){_0x1fc995=_0x1fc995||0x1f4;return function(_0x13192e){logger[_0xfa34('0xa')](_0x13192e[_0xfa34('0xb')]);if(_0x13192e[_0xfa34('0xc')]){delete _0x13192e[_0xfa34('0xc')];}_0x4f8ab0[_0xfa34('0x8')](_0x1fc995)[_0xfa34('0xd')](_0x13192e);};}function execChildProcess(){return new BPromise(function(_0x5661fb,_0x140c49){exec(_0xfa34('0xe'),function(_0x34218c,_0x5c6a68,_0x3cb38f){logger['info'](_0x5c6a68);logger[_0xfa34('0xf')](_0x3cb38f);if(_0x34218c){logger[_0xfa34('0xa')](_0x34218c);return _0x140c49(_0x34218c);}return _0x5661fb(_0x5c6a68);});});}exports[_0xfa34('0x10')]=function(_0x13be44,_0x2380ea){return pm2['list']()['then'](function(_0x921276){if(_0x921276){var _0x156c22=_[_0xfa34('0x11')](_0x921276,function(_0x3cab8b){return _0x3cab8b[_0xfa34('0xc')]==='express'||_0x3cab8b[_0xfa34('0xc')]==='motion2';});return{'rows':_0x156c22,'count':_0x156c22[_0xfa34('0x12')]};}return null;})[_0xfa34('0x13')](respondWithResult(_0x2380ea,null))[_0xfa34('0x14')](handleError(_0x2380ea,null));};exports[_0xfa34('0x15')]=function(_0x572403,_0x7127a6){return pm2['describe'](_0x572403[_0xfa34('0x16')]['id'])[_0xfa34('0x13')](respondWithResult(_0x7127a6,null))['then'](handleEntityNotFound(_0x7127a6,null))[_0xfa34('0x14')](handleError(_0x7127a6,null));};exports[_0xfa34('0x17')]=function(_0x329ee8,_0x142cd8){if(_0x329ee8[_0xfa34('0x18')][_0xfa34('0xc')]&&_0x329ee8[_0xfa34('0x18')]['script']){var _0x47377a=path['join'](__dirname,'../../files/plugins',_0x329ee8[_0xfa34('0x18')][_0xfa34('0x19')]);var _0x57746=process[_0xfa34('0x1a')]();process[_0xfa34('0x1b')](path[_0xfa34('0x1c')](_0x47377a));return execChildProcess()[_0xfa34('0x13')](function(_0x2a2f71){process[_0xfa34('0x1b')](_0x57746);return pm2['start']({'name':_0x329ee8[_0xfa34('0x18')][_0xfa34('0xc')],'script':_0x47377a});})[_0xfa34('0x13')](function(_0x5647ac){pm2[_0xfa34('0x1d')]();return _0x5647ac[0x0];})[_0xfa34('0x13')](respondWithResult(_0x142cd8,0xc9))[_0xfa34('0x14')](handleError(_0x142cd8,null));}else{return _0x142cd8[_0xfa34('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xfa34('0x1e')]=function(_0x52b131,_0x1ca9eb){if(_0x52b131[_0xfa34('0x18')]['id']){delete _0x52b131[_0xfa34('0x18')]['id'];}var _0x4de973={'online':_0xfa34('0x1f'),'stopped':_0xfa34('0x20')};if(_0x4de973[_0xfa34('0x21')](_0x52b131['body'][_0xfa34('0x8')])){return pm2[_0x4de973[_0x52b131[_0xfa34('0x18')][_0xfa34('0x8')]]](_0x52b131[_0xfa34('0x16')]['id'])[_0xfa34('0x13')](respondWithResult(_0x1ca9eb,0xc8))[_0xfa34('0x14')](handleError(_0x1ca9eb,null));}else{return _0x1ca9eb['status'](0x1f4)[_0xfa34('0xd')]({'message':_0xfa34('0x22')});}};exports[_0xfa34('0x23')]=function(_0x14e036,_0x133137){if(_0x14e036[_0xfa34('0x18')]['id']){delete _0x14e036[_0xfa34('0x18')]['id'];}if(_0x14e036['params']['id']){return pm2[_0xfa34('0x24')](_0x14e036['params']['id'])[_0xfa34('0x13')](function(_0x418961){pm2[_0xfa34('0x1d')]();return _0x418961[0x0];})[_0xfa34('0x13')](respondWithResult(_0x133137,null))[_0xfa34('0x14')](handleError(_0x133137,null));}else{return _0x133137['status'](0x1f4)[_0xfa34('0xd')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index df3e717..6facaac 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 _0xd77f=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','exports'];(function(_0x1db9c9,_0x358fb5){var _0x2e02ef=function(_0x4e3b6d){while(--_0x4e3b6d){_0x1db9c9['push'](_0x1db9c9['shift']());}};_0x2e02ef(++_0x358fb5);}(_0xd77f,0x150));var _0xfd77=function(_0x50ff21,_0x5a2db4){_0x50ff21=_0x50ff21-0x0;var _0x7ba395=_0xd77f[_0x50ff21];return _0x7ba395;};'use strict';var multer=require(_0xfd77('0x0'));var util=require('util');var path=require(_0xfd77('0x1'));var timeout=require(_0xfd77('0x2'));var express=require(_0xfd77('0x3'));var router=express[_0xfd77('0x4')]();var auth=require(_0xfd77('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfd77('0x6'));module[_0xfd77('0x7')]=router; \ No newline at end of file +var _0x35ba=['connect-timeout','express','Router','../../config/environment','multer','util','path'];(function(_0x2d4e29,_0x507c12){var _0x3e6792=function(_0x274685){while(--_0x274685){_0x2d4e29['push'](_0x2d4e29['shift']());}};_0x3e6792(++_0x507c12);}(_0x35ba,0x19a));var _0xa35b=function(_0x1ec7b0,_0x2eb52a){_0x1ec7b0=_0x1ec7b0-0x0;var _0x5aff54=_0x35ba[_0x1ec7b0];return _0x5aff54;};'use strict';var multer=require(_0xa35b('0x0'));var util=require(_0xa35b('0x1'));var path=require(_0xa35b('0x2'));var timeout=require(_0xa35b('0x3'));var express=require(_0xa35b('0x4'));var router=express[_0xa35b('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa35b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 9baf8bc..f2ef5c6 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 _0x71bf=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x5c6039,_0x4d1b84){var _0x342226=function(_0x3d2654){while(--_0x3d2654){_0x5c6039['push'](_0x5c6039['shift']());}};_0x342226(++_0x4d1b84);}(_0x71bf,0xf0));var _0xf71b=function(_0x5a4c93,_0x283aa8){_0x5a4c93=_0x5a4c93-0x0;var _0x421ff4=_0x71bf[_0x5a4c93];return _0x421ff4;};'use strict';var Sequelize=require(_0xf71b('0x0'));module[_0xf71b('0x1')]={'state':{'type':Sequelize[_0xf71b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf71b('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xf71b('0x3')]},'starttime':{'type':Sequelize[_0xf71b('0x4')]},'responsetime':{'type':Sequelize[_0xf71b('0x4')]},'ringtime':{'type':Sequelize[_0xf71b('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf71b('0x3')]},'campaigntype':{'type':Sequelize[_0xf71b('0x3')]},'membername':{'type':Sequelize[_0xf71b('0x3')]}}; \ No newline at end of file +var _0x8eaf=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x8eaf,0x182));var _0xf8ea=function(_0x404458,_0x320912){_0x404458=_0x404458-0x0;var _0x5313c9=_0x8eaf[_0x404458];return _0x5313c9;};'use strict';var Sequelize=require(_0xf8ea('0x0'));module[_0xf8ea('0x1')]={'state':{'type':Sequelize[_0xf8ea('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf8ea('0x3')]},'scheduledat':{'type':Sequelize[_0xf8ea('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xf8ea('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf8ea('0x3')]},'campaigntype':{'type':Sequelize[_0xf8ea('0x3')]},'membername':{'type':Sequelize[_0xf8ea('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a0fcf8a..adfdd89 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 _0x6b29=['util','api','moment','bluebird','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash'];(function(_0x2def84,_0x22a636){var _0xf7c73e=function(_0x5519b6){while(--_0x5519b6){_0x2def84['push'](_0x2def84['shift']());}};_0xf7c73e(++_0x22a636);}(_0x6b29,0x128));var _0x96b2=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x6b29[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0x96b2('0x0'));var util=require(_0x96b2('0x1'));var logger=require('../../config/logger')(_0x96b2('0x2'));var moment=require(_0x96b2('0x3'));var BPromise=require(_0x96b2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x96b2('0x5'));var attributes=require(_0x96b2('0x6'));module[_0x96b2('0x7')]=function(_0x47d896,_0x1095db){return _0x47d896[_0x96b2('0x8')](_0x96b2('0x9'),attributes,{'tableName':_0x96b2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf224=['report_agent_preview','lodash','../../config/logger','api','bluebird','path','../../config/environment','exports','define','ReportAgentPreview'];(function(_0x539855,_0x2276cc){var _0x545af4=function(_0x3c3ac6){while(--_0x3c3ac6){_0x539855['push'](_0x539855['shift']());}};_0x545af4(++_0x2276cc);}(_0xf224,0xdd));var _0x4f22=function(_0x58829e,_0xcf066a){_0x58829e=_0x58829e-0x0;var _0x27faba=_0xf224[_0x58829e];return _0x27faba;};'use strict';var _=require(_0x4f22('0x0'));var util=require('util');var logger=require(_0x4f22('0x1'))(_0x4f22('0x2'));var moment=require('moment');var BPromise=require(_0x4f22('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f22('0x4'));var rimraf=require('rimraf');var config=require(_0x4f22('0x5'));var attributes=require('./reportAgentPreview.attributes');module[_0x4f22('0x6')]=function(_0x1cf89a,_0x166c33){return _0x1cf89a[_0x4f22('0x7')](_0x4f22('0x8'),attributes,{'tableName':_0x4f22('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index f225ba3..3ec0500 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 _0x3de2=['info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','ReportAgentPreview','options','raw','CreateReportAgentPreview','debug','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x4991d2,_0x405d04){var _0x580e2e=function(_0x4ccd0e){while(--_0x4ccd0e){_0x4991d2['push'](_0x4991d2['shift']());}};_0x580e2e(++_0x405d04);}(_0x3de2,0x98));var _0x23de=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x3de2[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require(_0x23de('0x0'));var moment=require('moment');var BPromise=require(_0x23de('0x1'));var rs=require(_0x23de('0x2'));var fs=require('fs');var Redis=require(_0x23de('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x23de('0x4'));var config=require(_0x23de('0x5'));var jayson=require(_0x23de('0x6'));var client=jayson[_0x23de('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a3d7c,_0x4f117e,_0x239268){return new BPromise(function(_0x130ad2,_0x233f9c){return client['request'](_0x4a3d7c,_0x239268)[_0x23de('0x8')](function(_0x2b0950){logger[_0x23de('0x9')]('ReportAgentPreview,\x20%s,\x20%s',_0x4f117e,_0x23de('0xa'));logger['debug'](_0x23de('0xb'),_0x4f117e,_0x23de('0xa'),JSON[_0x23de('0xc')](_0x2b0950));if(_0x2b0950['error']){if(_0x2b0950[_0x23de('0xd')]['code']===0x1f4){logger[_0x23de('0xd')](_0x23de('0xe'),_0x4f117e,_0x2b0950[_0x23de('0xd')][_0x23de('0xf')]);return _0x233f9c(_0x2b0950[_0x23de('0xd')]['message']);}logger[_0x23de('0xd')](_0x23de('0xe'),_0x4f117e,_0x2b0950[_0x23de('0xd')]['message']);return _0x130ad2(_0x2b0950[_0x23de('0xd')][_0x23de('0xf')]);}else{logger[_0x23de('0x9')]('ReportAgentPreview,\x20%s,\x20%s',_0x4f117e,_0x23de('0xa'));_0x130ad2(_0x2b0950[_0x23de('0x10')][_0x23de('0xf')]);}})[_0x23de('0x11')](function(_0x26836b){logger[_0x23de('0xd')](_0x23de('0xe'),_0x4f117e,_0x26836b);_0x233f9c(_0x26836b);});});}exports['CreateReportAgentPreview']=function(_0x52b859){var _0x14eada=this;return new Promise(function(_0x50935a,_0x43efb3){return db[_0x23de('0x12')]['create'](_0x52b859['body'],{'raw':_0x52b859[_0x23de('0x13')]?_0x52b859[_0x23de('0x13')][_0x23de('0x14')]===undefined?!![]:![]:!![]})[_0x23de('0x8')](function(_0x44b646){logger[_0x23de('0x9')](_0x23de('0x15'),_0x52b859);logger[_0x23de('0x16')](_0x23de('0x15'),_0x52b859,JSON[_0x23de('0xc')](_0x44b646));_0x50935a(_0x44b646);})[_0x23de('0x11')](function(_0x33895f){logger[_0x23de('0xd')](_0x23de('0x15'),_0x33895f['message'],_0x52b859);_0x43efb3(_0x14eada[_0x23de('0xd')](0x1f4,_0x33895f[_0x23de('0xf')]));});});}; \ No newline at end of file +var _0x536d=['then','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ReportAgentPreview','create','options','raw','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x591f7b,_0x1e1cd1){var _0x21a460=function(_0x4c7888){while(--_0x4c7888){_0x591f7b['push'](_0x591f7b['shift']());}};_0x21a460(++_0x1e1cd1);}(_0x536d,0xe2));var _0xd536=function(_0x2e23c1,_0xde9a8b){_0x2e23c1=_0x2e23c1-0x0;var _0x564041=_0x536d[_0x2e23c1];return _0x564041;};'use strict';var _=require(_0xd536('0x0'));var util=require(_0xd536('0x1'));var moment=require(_0xd536('0x2'));var BPromise=require(_0xd536('0x3'));var rs=require(_0xd536('0x4'));var fs=require('fs');var Redis=require(_0xd536('0x5'));var db=require(_0xd536('0x6'))['db'];var utils=require(_0xd536('0x7'));var logger=require(_0xd536('0x8'))('rpc');var config=require(_0xd536('0x9'));var jayson=require(_0xd536('0xa'));var client=jayson[_0xd536('0xb')][_0xd536('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5af02d,_0x30365d,_0x52f311){return new BPromise(function(_0x1a9766,_0x125b58){return client[_0xd536('0xd')](_0x5af02d,_0x52f311)[_0xd536('0xe')](function(_0x35a856){logger['info'](_0xd536('0xf'),_0x30365d,'request\x20sent');logger[_0xd536('0x10')](_0xd536('0x11'),_0x30365d,'request\x20sent',JSON[_0xd536('0x12')](_0x35a856));if(_0x35a856[_0xd536('0x13')]){if(_0x35a856[_0xd536('0x13')][_0xd536('0x14')]===0x1f4){logger['error'](_0xd536('0xf'),_0x30365d,_0x35a856['error'][_0xd536('0x15')]);return _0x125b58(_0x35a856['error'][_0xd536('0x15')]);}logger['error'](_0xd536('0xf'),_0x30365d,_0x35a856[_0xd536('0x13')]['message']);return _0x1a9766(_0x35a856[_0xd536('0x13')]['message']);}else{logger[_0xd536('0x16')]('ReportAgentPreview,\x20%s,\x20%s',_0x30365d,'request\x20sent');_0x1a9766(_0x35a856[_0xd536('0x17')][_0xd536('0x15')]);}})[_0xd536('0x18')](function(_0xc86292){logger['error'](_0xd536('0xf'),_0x30365d,_0xc86292);_0x125b58(_0xc86292);});});}exports['CreateReportAgentPreview']=function(_0x28955a){var _0x98d776=this;return new Promise(function(_0x322ebf,_0x248126){return db[_0xd536('0x19')][_0xd536('0x1a')](_0x28955a['body'],{'raw':_0x28955a[_0xd536('0x1b')]?_0x28955a['options'][_0xd536('0x1c')]===undefined?!![]:![]:!![]})[_0xd536('0xe')](function(_0x4413c7){logger['info']('CreateReportAgentPreview',_0x28955a);logger[_0xd536('0x10')](_0xd536('0x1d'),_0x28955a,JSON[_0xd536('0x12')](_0x4413c7));_0x322ebf(_0x4413c7);})[_0xd536('0x18')](function(_0x5df121){logger['error'](_0xd536('0x1d'),_0x5df121['message'],_0x28955a);_0x248126(_0x98d776[_0xd536('0x13')](0x1f4,_0x5df121['message']));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 41b10e1..e2be831 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 _0x4bf7=['multer','path','Router','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/sms/queues','smsQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','showMailQueues','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','queueNotify','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','exports'];(function(_0x272155,_0x94dfb8){var _0x34ac16=function(_0x6197e2){while(--_0x6197e2){_0x272155['push'](_0x272155['shift']());}};_0x34ac16(++_0x94dfb8);}(_0x4bf7,0x198));var _0x74bf=function(_0x4b5344,_0x92959){_0x4b5344=_0x4b5344-0x0;var _0x2317d3=_0x4bf7[_0x4b5344];return _0x2317d3;};'use strict';var multer=require(_0x74bf('0x0'));var util=require('util');var path=require(_0x74bf('0x1'));var express=require('express');var router=express[_0x74bf('0x2')]();var auth=require('../../components/auth/service');var controller=require(_0x74bf('0x3'));router[_0x74bf('0x4')](_0x74bf('0x5'),auth[_0x74bf('0x6')](),controller['voiceChannels']);router['get'](_0x74bf('0x7'),auth['isAuthenticated'](),controller[_0x74bf('0x8')]);router[_0x74bf('0x4')](_0x74bf('0x9'),auth[_0x74bf('0x6')](),controller['voiceChannelStopMixMonitor']);router['get'](_0x74bf('0xa'),auth[_0x74bf('0x6')](),controller[_0x74bf('0xb')]);router[_0x74bf('0x4')](_0x74bf('0xc'),auth[_0x74bf('0x6')](),controller[_0x74bf('0xd')]);router['get'](_0x74bf('0xe'),auth[_0x74bf('0x6')](),controller[_0x74bf('0xf')]);router[_0x74bf('0x4')](_0x74bf('0x10'),auth[_0x74bf('0x6')](),controller['mailAccounts']);router[_0x74bf('0x4')]('/openchannel/queues',auth['isAuthenticated'](),controller['openchannelQueues']);router[_0x74bf('0x4')](_0x74bf('0x11'),auth['isAuthenticated'](),controller[_0x74bf('0x12')]);router['get']('/fax/queues',auth['isAuthenticated'](),controller[_0x74bf('0x13')]);router[_0x74bf('0x4')](_0x74bf('0x14'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x15')]);router[_0x74bf('0x4')](_0x74bf('0x16'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x17')]);router[_0x74bf('0x4')]('/voice/queues/channels/:uniqueid',auth[_0x74bf('0x6')](),controller[_0x74bf('0x18')]);router['get'](_0x74bf('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannelHangup']);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x74bf('0x6')](),controller[_0x74bf('0x1a')]);router[_0x74bf('0x4')](_0x74bf('0x1b'),auth['isAuthenticated'](),controller[_0x74bf('0x1c')]);router[_0x74bf('0x4')](_0x74bf('0x1d'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x1e')]);router[_0x74bf('0x4')](_0x74bf('0x1f'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x20')]);router['get']('/agents',auth[_0x74bf('0x6')](),controller[_0x74bf('0x21')]);router[_0x74bf('0x22')](_0x74bf('0x23'),auth[_0x74bf('0x6')](),controller['agentCapacity']);router[_0x74bf('0x4')](_0x74bf('0x24'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x25')]);router['get'](_0x74bf('0x26'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x27')]);router[_0x74bf('0x4')](_0x74bf('0x28'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x29')]);router[_0x74bf('0x4')](_0x74bf('0x2a'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x2b')]);router[_0x74bf('0x4')](_0x74bf('0x2c'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x2d')]);router['get'](_0x74bf('0x2e'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x2f')]);router[_0x74bf('0x4')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x74bf('0x30')]);router[_0x74bf('0x4')](_0x74bf('0x31'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x32')]);router['get'](_0x74bf('0x33'),auth['isAuthenticated'](),controller[_0x74bf('0x34')]);router[_0x74bf('0x35')](_0x74bf('0x36'),auth['isAuthenticated'](),controller['queueNotify']('mail'));router[_0x74bf('0x4')]('/mail/queues/:id',auth[_0x74bf('0x6')](),controller[_0x74bf('0x37')]);router['post']('/chat/queues/:id/notify',auth[_0x74bf('0x6')](),controller['queueNotify']('chat'));router['get'](_0x74bf('0x38'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x39')]);router[_0x74bf('0x35')](_0x74bf('0x3a'),auth[_0x74bf('0x6')](),controller['queueNotify'](_0x74bf('0x3b')));router[_0x74bf('0x4')](_0x74bf('0x3c'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x3d')]);router['post']('/openchannel/queues/:id/notify',auth[_0x74bf('0x6')](),controller[_0x74bf('0x3e')]('openchannel'));router[_0x74bf('0x4')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x74bf('0x35')]('/sms/queues/:id/notify',auth[_0x74bf('0x6')](),controller[_0x74bf('0x3e')]('sms'));router[_0x74bf('0x4')](_0x74bf('0x3f'),auth[_0x74bf('0x6')](),controller[_0x74bf('0x40')]);router[_0x74bf('0x35')](_0x74bf('0x41'),auth['isAuthenticated'](),controller[_0x74bf('0x42')]);module[_0x74bf('0x43')]=router; \ No newline at end of file +var _0xce31=['post','queueNotify','mail','chat','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','showOpenchannelQueues','sms','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','get','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions'];(function(_0x587a80,_0x4b0de4){var _0x35926d=function(_0x11dce1){while(--_0x11dce1){_0x587a80['push'](_0x587a80['shift']());}};_0x35926d(++_0x4b0de4);}(_0xce31,0x1d5));var _0x1ce3=function(_0x252bb8,_0x23f657){_0x252bb8=_0x252bb8-0x0;var _0x21da54=_0xce31[_0x252bb8];return _0x21da54;};'use strict';var multer=require(_0x1ce3('0x0'));var util=require(_0x1ce3('0x1'));var path=require('path');var express=require(_0x1ce3('0x2'));var router=express[_0x1ce3('0x3')]();var auth=require(_0x1ce3('0x4'));var controller=require(_0x1ce3('0x5'));router['get']('/voice/channels',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x7')]);router['get'](_0x1ce3('0x8'),auth['isAuthenticated'](),controller[_0x1ce3('0x9')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0xa')]);router[_0x1ce3('0xb')](_0x1ce3('0xc'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0xd')]);router[_0x1ce3('0xb')](_0x1ce3('0xe'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0xf')]);router[_0x1ce3('0xb')](_0x1ce3('0x10'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x11')]);router['get'](_0x1ce3('0x12'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x13')]);router[_0x1ce3('0xb')](_0x1ce3('0x14'),auth['isAuthenticated'](),controller[_0x1ce3('0x15')]);router[_0x1ce3('0xb')](_0x1ce3('0x16'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x17')]);router[_0x1ce3('0xb')](_0x1ce3('0x18'),auth['isAuthenticated'](),controller[_0x1ce3('0x19')]);router[_0x1ce3('0xb')](_0x1ce3('0x1a'),auth[_0x1ce3('0x6')](),controller['voiceQueuesPreview']);router[_0x1ce3('0xb')](_0x1ce3('0x1b'),auth[_0x1ce3('0x6')](),controller['voiceQueuesChannels']);router[_0x1ce3('0xb')](_0x1ce3('0x1c'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0x1ce3('0xb')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x1ce3('0x6')](),controller['voiceQueuesChannelHangup']);router[_0x1ce3('0xb')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x1d')]);router[_0x1ce3('0xb')](_0x1ce3('0x1e'),auth[_0x1ce3('0x6')](),controller['showVoiceQueues']);router[_0x1ce3('0xb')](_0x1ce3('0x1f'),auth['isAuthenticated'](),controller[_0x1ce3('0x20')]);router[_0x1ce3('0xb')](_0x1ce3('0x21'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x22')]);router[_0x1ce3('0xb')](_0x1ce3('0x23'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x24')]);router[_0x1ce3('0x25')](_0x1ce3('0x26'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x27')]);router[_0x1ce3('0xb')](_0x1ce3('0x28'),auth['isAuthenticated'](),controller[_0x1ce3('0x29')]);router[_0x1ce3('0xb')]('/trunks',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x2a')]);router[_0x1ce3('0xb')](_0x1ce3('0x2b'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x2c')]);router[_0x1ce3('0xb')](_0x1ce3('0x2d'),auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x2e')]);router[_0x1ce3('0xb')]('/chat/queues/waitinginteractions',auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x1ce3('0xb')](_0x1ce3('0x2f'),auth[_0x1ce3('0x6')](),controller['mailQueuesWaitingInteractions']);router[_0x1ce3('0xb')](_0x1ce3('0x30'),auth[_0x1ce3('0x6')](),controller['openchannelQueuesWaitingInteractions']);router[_0x1ce3('0xb')]('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x1ce3('0x31')]);router[_0x1ce3('0xb')](_0x1ce3('0x32'),auth[_0x1ce3('0x6')](),controller['faxQueuesWaitingInteractions']);router[_0x1ce3('0x33')]('/mail/queues/:id/notify',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x34')](_0x1ce3('0x35')));router['get']('/mail/queues/:id',auth[_0x1ce3('0x6')](),controller['showMailQueues']);router[_0x1ce3('0x33')]('/chat/queues/:id/notify',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x34')](_0x1ce3('0x36')));router['get']('/chat/queues/:id',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x37')]);router[_0x1ce3('0x33')](_0x1ce3('0x38'),auth['isAuthenticated'](),controller[_0x1ce3('0x34')](_0x1ce3('0x39')));router['get']('/fax/queues/:id',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x3a')]);router[_0x1ce3('0x33')](_0x1ce3('0x3b'),auth[_0x1ce3('0x6')](),controller['queueNotify']('openchannel'));router[_0x1ce3('0xb')]('/openchannel/queues/:id',auth[_0x1ce3('0x6')](),controller[_0x1ce3('0x3c')]);router['post']('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0x1ce3('0x34')](_0x1ce3('0x3d')));router['get']('/sms/queues/:id',auth[_0x1ce3('0x6')](),controller['showSmsQueues']);router[_0x1ce3('0x33')](_0x1ce3('0x3e'),auth['isAuthenticated'](),controller[_0x1ce3('0x3f')]);module[_0x1ce3('0x40')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index a53e3e4..1197c23 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 _0x1d07=['hasOwnProperty','MemberReport','findAll','INTERACTION','format','length','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','Campaigns','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','findOne','Message','Interaction','Account','\x20Message\x20not\x20found','queue','MessageId','InteractionId','TransferReport','create','Start','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','chat','Website','User','update','From','agentTransferTimeout','moment','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','agents','Agents','agentCapacity','body','interaction','user'];(function(_0xd108b7,_0x8acbc8){var _0x529edd=function(_0x2cd9dc){while(--_0x2cd9dc){_0xd108b7['push'](_0xd108b7['shift']());}};_0x529edd(++_0x8acbc8);}(_0x1d07,0x1c8));var _0x71d0=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x1d07[_0x51020b];return _0x371e47;};'use strict';var BPromise=require('bluebird');var moment=require(_0x71d0('0x0'));var _=require('lodash');var util=require('util');var db=require(_0x71d0('0x1'))['db'];var logger=require(_0x71d0('0x2'))(_0x71d0('0x3'));var jayson=require(_0x71d0('0x4'));var amiClient=jayson[_0x71d0('0x5')]['http']({'port':0x232a});var mailClient=jayson[_0x71d0('0x5')][_0x71d0('0x6')]({'port':0x232b});var routingClient=jayson[_0x71d0('0x5')][_0x71d0('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x1aacc3,_0x259c20,_0x497e70){return new BPromise(function(_0x1e9cbd,_0x304e60){var _0x189511=_0x497e70?_0x497e70:amiClient;return _0x189511[_0x71d0('0x7')](_0x1aacc3,_0x259c20)[_0x71d0('0x8')](function(_0x1055f5){if(_0x1055f5[_0x71d0('0x9')]){if(_0x1055f5[_0x71d0('0x9')][_0x71d0('0xa')]===0x1f4){return _0x304e60(_0x1055f5['error'][_0x71d0('0xb')]);}return _0x1e9cbd(_0x1055f5[_0x71d0('0x9')][_0x71d0('0xb')]);}else{_0x1e9cbd(_0x1055f5[_0x71d0('0xc')]);}})[_0x71d0('0xd')](function(_0x1d3505){_0x304e60(_0x1d3505);});});}function respondWithResult(_0x251578,_0x4a9eb0){_0x4a9eb0=_0x4a9eb0||0xc8;return function(_0x49eead){if(_0x49eead){return _0x251578['status'](_0x4a9eb0)[_0x71d0('0xe')](_0x49eead);}return _0x251578[_0x71d0('0xf')](0x194);};}function handleError(_0x39e6ef,_0x301ca5){_0x301ca5=_0x301ca5||0x1f4;return function(_0x1bce34){logger[_0x71d0('0x9')](_0x1bce34[_0x71d0('0x10')]);if(_0x1bce34[_0x71d0('0x11')]){delete _0x1bce34[_0x71d0('0x11')];}_0x39e6ef['status'](_0x301ca5)[_0x71d0('0x12')](_0x1bce34);};}function findById(_0x44bcc4){return function(_0x2f05f2){if(!_[_0x71d0('0x13')](_0x44bcc4)&&!_[_0x71d0('0x13')](_0x2f05f2)&&!_[_0x71d0('0x13')](_0x2f05f2[_0x71d0('0x14')])){return _[_0x71d0('0x15')](_0x2f05f2[_0x71d0('0x14')],function(_0x2e377a){return _0x2e377a['id']==_0x44bcc4;});}return null;};}exports[_0x71d0('0x16')]=function(_0x228114,_0x32921f){return respondWithRpcPromise('VoiceChannels',_0x228114[_0x71d0('0x17')])[_0x71d0('0x8')](respondWithResult(_0x32921f,null))[_0x71d0('0xd')](handleError(_0x32921f,null));};exports[_0x71d0('0x18')]=function(_0x1cf20c,_0xfb4b7c){return respondWithRpcPromise(_0x71d0('0x19'),_[_0x71d0('0x1a')](_0x1cf20c['query'],_0x1cf20c[_0x71d0('0x1b')]))[_0x71d0('0x8')](respondWithResult(_0xfb4b7c,null))[_0x71d0('0xd')](handleError(_0xfb4b7c,null));};exports[_0x71d0('0x1c')]=function(_0x37d733,_0x1c53b7){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0x71d0('0x1a')](_0x37d733[_0x71d0('0x17')],_0x37d733['params']))[_0x71d0('0x8')](respondWithResult(_0x1c53b7,null))[_0x71d0('0xd')](handleError(_0x1c53b7,null));};exports['voiceQueues']=function(_0x46cba5,_0x39abd1){return respondWithRpcPromise(_0x71d0('0x1d'),_0x46cba5['query'])[_0x71d0('0x8')](respondWithResult(_0x39abd1,null))['catch'](handleError(_0x39abd1,null));};exports[_0x71d0('0x1e')]=function(_0x5d2834,_0x560ba4){return respondWithRpcPromise(_0x71d0('0x1d'),_0x5d2834[_0x71d0('0x17')])[_0x71d0('0x8')](findById(_0x5d2834[_0x71d0('0x1b')]['id']))[_0x71d0('0x8')](respondWithResult(_0x560ba4,null))[_0x71d0('0xd')](handleError(_0x560ba4,null));};exports['voiceQueuesPreview']=function(_0x43b763,_0x42360e){return respondWithRpcPromise(_0x71d0('0x1f'),_[_0x71d0('0x1a')](_0x43b763['query'],_0x43b763['params']))[_0x71d0('0x8')](respondWithResult(_0x42360e,null))['catch'](handleError(_0x42360e,null));};exports[_0x71d0('0x20')]=function(_0x151746,_0x3df253){return respondWithRpcPromise(_0x71d0('0x21'),_0x151746[_0x71d0('0x17')])[_0x71d0('0x8')](respondWithResult(_0x3df253,null))[_0x71d0('0xd')](handleError(_0x3df253,null));};exports[_0x71d0('0x22')]=function(_0x716a6e,_0x454af4){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x71d0('0x1a')](_0x716a6e[_0x71d0('0x17')],_0x716a6e[_0x71d0('0x1b')]))[_0x71d0('0x8')](respondWithResult(_0x454af4,null))['catch'](handleError(_0x454af4,null));};exports['voiceQueuesChannelHangup']=function(_0x5e6a3e,_0x3018c3){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x71d0('0x1a')](_0x5e6a3e[_0x71d0('0x17')],_0x5e6a3e[_0x71d0('0x1b')]))[_0x71d0('0x8')](respondWithResult(_0x3018c3,null))['catch'](handleError(_0x3018c3,null));};exports[_0x71d0('0x23')]=function(_0xfe9c09,_0x50b72b){return respondWithRpcPromise(_0x71d0('0x24'),_[_0x71d0('0x1a')](_0xfe9c09[_0x71d0('0x17')],_0xfe9c09['params']))[_0x71d0('0x8')](respondWithResult(_0x50b72b,null))[_0x71d0('0xd')](handleError(_0x50b72b,null));};exports['outbound']=function(_0xd7f466,_0x33ffe9){return respondWithRpcPromise(_0x71d0('0x25'),_0xd7f466[_0x71d0('0x17')])[_0x71d0('0x8')](respondWithResult(_0x33ffe9,null))[_0x71d0('0xd')](handleError(_0x33ffe9,null));};exports['outboundChannels']=function(_0x58c4c8,_0x48bc0a){return respondWithRpcPromise('OutboundChannels',_0x58c4c8['query'])[_0x71d0('0x8')](respondWithResult(_0x48bc0a,null))['catch'](handleError(_0x48bc0a,null));};exports[_0x71d0('0x26')]=function(_0x15e06a,_0x316907){var _0x23bbd8;return respondWithRpcPromise('Agents',_0x15e06a[_0x71d0('0x17')])[_0x71d0('0x8')](function(_0x2120dc){_0x23bbd8=_0x2120dc;return respondWithRpcPromise(_0x71d0('0x27'),_0x15e06a['query'],routingClient);})['then'](function(_0x4182ca){return _[_0x71d0('0x1a')]({},_0x4182ca,_0x23bbd8);})[_0x71d0('0x8')](respondWithResult(_0x316907,null))[_0x71d0('0xd')](handleError(_0x316907,null));};exports[_0x71d0('0x28')]=function(_0x40c817,_0x333a73){if(_0x40c817['body']&&_0x40c817[_0x71d0('0x29')][_0x71d0('0x2a')]&&_0x40c817['user']&&_0x40c817[_0x71d0('0x2b')][_0x71d0('0x11')]){for(var _0x5eaa8d in _0x40c817[_0x71d0('0x29')][_0x71d0('0x2a')]){if(_0x40c817['body'][_0x71d0('0x2a')][_0x71d0('0x2c')](_0x5eaa8d)){db[_0x71d0('0x2d')][_0x71d0('0x2e')]({'where':{'channel':_0x5eaa8d,'membername':_0x40c817[_0x71d0('0x2b')][_0x71d0('0x11')],'type':_0x71d0('0x2f'),'exitAt':null,'uniqueid':_0x40c817['body']['interaction'][_0x5eaa8d]&&_0x40c817[_0x71d0('0x29')][_0x71d0('0x2a')][_0x5eaa8d]['length']?{'$notIn':_0x40c817[_0x71d0('0x29')]['interaction'][_0x5eaa8d]}:{'$ne':null}}})[_0x71d0('0x8')](function(_0x573a0f){var _0x1a0c00=moment()[_0x71d0('0x30')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x32c8fe=0x0,_0x540df2=_0x573a0f[_0x71d0('0x31')];_0x32c8fe<_0x540df2;_0x32c8fe+=0x1){_0x573a0f[_0x32c8fe]['updateAttributes']({'exitAt':_0x1a0c00});}});for(var _0x3ec230=0x0;_0x3ec230<_0x40c817[_0x71d0('0x29')][_0x71d0('0x2a')][_0x5eaa8d][_0x71d0('0x31')];_0x3ec230+=0x1){db[_0x71d0('0x2d')][_0x71d0('0x32')]({'where':{'channel':_0x5eaa8d,'membername':_0x40c817['user'][_0x71d0('0x11')],'type':_0x71d0('0x2f'),'uniqueid':_0x40c817['body'][_0x71d0('0x2a')][_0x5eaa8d][_0x3ec230],'exitAt':null},'defaults':{'channel':_0x5eaa8d,'membername':_0x40c817[_0x71d0('0x2b')][_0x71d0('0x11')],'interface':_[_0x71d0('0x13')](_0x40c817[_0x71d0('0x2b')][_0x71d0('0x33')])?util[_0x71d0('0x30')](_0x71d0('0x34'),_0x40c817[_0x71d0('0x2b')][_0x71d0('0x11')]):_0x40c817[_0x71d0('0x2b')][_0x71d0('0x33')],'type':_0x71d0('0x2f'),'enterAt':moment()[_0x71d0('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x71d0('0x35'),'internal':_0x40c817[_0x71d0('0x2b')][_0x71d0('0x36')],'uniqueid':_0x40c817[_0x71d0('0x29')][_0x71d0('0x2a')][_0x5eaa8d][_0x3ec230]}});}}}}return respondWithRpcPromise(_0x71d0('0x37'),{'id':_0x40c817[_0x71d0('0x1b')]['id'],'capacity':_0x40c817[_0x71d0('0x29')][_0x71d0('0x38')]},routingClient)['then'](respondWithResult(_0x333a73,null))[_0x71d0('0xd')](handleError(_0x333a73,null));};exports['telephones']=function(_0x432c4d,_0x11e019){return respondWithRpcPromise('Telephones',_0x432c4d[_0x71d0('0x17')])['then'](respondWithResult(_0x11e019,null))[_0x71d0('0xd')](handleError(_0x11e019,null));};exports['trunks']=function(_0x5f2be7,_0x206a63){return respondWithRpcPromise('Trunks',_0x5f2be7[_0x71d0('0x17')])[_0x71d0('0x8')](respondWithResult(_0x206a63,null))['catch'](handleError(_0x206a63,null));};exports['campaigns']=function(_0x2e5917,_0x5a3a8f){return respondWithRpcPromise(_0x71d0('0x39'),_0x2e5917[_0x71d0('0x17')])[_0x71d0('0x8')](respondWithResult(_0x5a3a8f,null))[_0x71d0('0xd')](handleError(_0x5a3a8f,null));};exports['chatQueues']=function(_0x36347e,_0x12b4fd){return respondWithRpcPromise(_0x71d0('0x3a'),_0x36347e[_0x71d0('0x17')],routingClient)['then'](respondWithResult(_0x12b4fd,null))[_0x71d0('0xd')](handleError(_0x12b4fd,null));};exports['showChatQueues']=function(_0xe448ad,_0x3cf71b){return respondWithRpcPromise('ChatQueues',_0xe448ad[_0x71d0('0x17')],routingClient)[_0x71d0('0x8')](findById(_0xe448ad[_0x71d0('0x1b')]['id']))[_0x71d0('0x8')](respondWithResult(_0x3cf71b,null))[_0x71d0('0xd')](handleError(_0x3cf71b,null));};exports[_0x71d0('0x3b')]=function(_0xde035e,_0x23191a){return respondWithRpcPromise(_0x71d0('0x3c'),_0xde035e[_0x71d0('0x17')],routingClient)[_0x71d0('0x8')](respondWithResult(_0x23191a,null))[_0x71d0('0xd')](handleError(_0x23191a,null));};exports[_0x71d0('0x3d')]=function(_0x5acd21,_0x3b4d75){return respondWithRpcPromise('MailQueues',_0x5acd21[_0x71d0('0x17')],routingClient)[_0x71d0('0x8')](findById(_0x5acd21[_0x71d0('0x1b')]['id']))[_0x71d0('0x8')](respondWithResult(_0x3b4d75,null))[_0x71d0('0xd')](handleError(_0x3b4d75,null));};exports[_0x71d0('0x3e')]=function(_0x366092,_0x53978f){return respondWithRpcPromise('MailAccounts',_0x366092[_0x71d0('0x17')],mailClient)[_0x71d0('0x8')](respondWithResult(_0x53978f,null))[_0x71d0('0xd')](handleError(_0x53978f,null));};exports[_0x71d0('0x3f')]=function(_0x2bfe6b,_0x20db5d){return respondWithRpcPromise(_0x71d0('0x40'),_0x2bfe6b[_0x71d0('0x17')],routingClient)[_0x71d0('0x8')](respondWithResult(_0x20db5d,null))['catch'](handleError(_0x20db5d,null));};exports['showOpenchannelQueues']=function(_0x202691,_0x2298d1){return respondWithRpcPromise(_0x71d0('0x40'),_0x202691[_0x71d0('0x17')],routingClient)[_0x71d0('0x8')](findById(_0x202691[_0x71d0('0x1b')]['id']))[_0x71d0('0x8')](respondWithResult(_0x2298d1,null))['catch'](handleError(_0x2298d1,null));};exports[_0x71d0('0x41')]=function(_0x3158fa,_0x26ed3b){return respondWithRpcPromise(_0x71d0('0x42'),_0x3158fa[_0x71d0('0x17')],routingClient)[_0x71d0('0x8')](respondWithResult(_0x26ed3b,null))[_0x71d0('0xd')](handleError(_0x26ed3b,null));};exports[_0x71d0('0x43')]=function(_0x423e7e,_0x59e39a){return respondWithRpcPromise(_0x71d0('0x42'),_0x423e7e[_0x71d0('0x17')],routingClient)['then'](findById(_0x423e7e[_0x71d0('0x1b')]['id']))['then'](respondWithResult(_0x59e39a,null))[_0x71d0('0xd')](handleError(_0x59e39a,null));};exports['faxQueues']=function(_0x2a9606,_0x2c8fce){return respondWithRpcPromise('FaxQueues',_0x2a9606['query'],routingClient)[_0x71d0('0x8')](respondWithResult(_0x2c8fce,null))[_0x71d0('0xd')](handleError(_0x2c8fce,null));};exports[_0x71d0('0x44')]=function(_0x37e156,_0x51579f){return respondWithRpcPromise('FaxQueues',_0x37e156['query'],routingClient)['then'](findById(_0x37e156['params']['id']))[_0x71d0('0x8')](respondWithResult(_0x51579f,null))[_0x71d0('0xd')](handleError(_0x51579f,null));};exports[_0x71d0('0x45')]=function(_0x1c25ff,_0x4610f7){return respondWithRpcPromise(_0x71d0('0x46'),_0x1c25ff[_0x71d0('0x17')])['then'](respondWithResult(_0x4610f7,null))['catch'](handleError(_0x4610f7,null));};exports[_0x71d0('0x47')]=function(_0x5469cc,_0x40123c){return respondWithRpcPromise(_0x71d0('0x48'),_0x5469cc[_0x71d0('0x17')],routingClient)[_0x71d0('0x8')](respondWithResult(_0x40123c,null))['catch'](handleError(_0x40123c,null));};exports['mailQueuesWaitingInteractions']=function(_0x3904d1,_0x4f015a){return respondWithRpcPromise(_0x71d0('0x49'),_0x3904d1[_0x71d0('0x17')],routingClient)[_0x71d0('0x8')](respondWithResult(_0x4f015a,null))[_0x71d0('0xd')](handleError(_0x4f015a,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x32aa91,_0x132fb6){return respondWithRpcPromise(_0x71d0('0x4a'),_0x32aa91[_0x71d0('0x17')],routingClient)[_0x71d0('0x8')](respondWithResult(_0x132fb6,null))[_0x71d0('0xd')](handleError(_0x132fb6,null));};exports[_0x71d0('0x4b')]=function(_0x58cdc4,_0x1f8571){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x58cdc4[_0x71d0('0x17')],routingClient)[_0x71d0('0x8')](respondWithResult(_0x1f8571,null))[_0x71d0('0xd')](handleError(_0x1f8571,null));};exports[_0x71d0('0x4c')]=function(_0x3dcb6b,_0x1527b9){return respondWithRpcPromise(_0x71d0('0x4d'),_0x3dcb6b[_0x71d0('0x17')],routingClient)['then'](respondWithResult(_0x1527b9,null))[_0x71d0('0xd')](handleError(_0x1527b9,null));};exports[_0x71d0('0x4e')]=function(_0x7e785c){return function(_0x1ec40d,_0x340334){var _0x404fea,_0x18989a;var _0x2384bc=_[_0x71d0('0x4f')](_0x7e785c);var _0x5573f6=_0x7e785c==='chat'?'Website':'Account';return db[_0x2384bc+'Queue'][_0x71d0('0x50')]({'raw':!![],'where':{'id':_0x1ec40d[_0x71d0('0x1b')]['id']}})[_0x71d0('0x8')](function(_0x47b5e5){if(_[_0x71d0('0x13')](_0x47b5e5)){throw new Error(_0x2384bc+'\x20Queue\x20not\x20found');}_0x404fea=_0x47b5e5;return db[_0x2384bc+_0x71d0('0x51')][_0x71d0('0x50')]({'where':{'id':_0x1ec40d[_0x71d0('0x29')]['messageId']},'include':[{'model':db[_0x2384bc+_0x71d0('0x52')],'as':_0x71d0('0x52')},{'model':db[_0x2384bc+_0x5573f6],'as':_0x71d0('0x53')}]});})[_0x71d0('0x8')](function(_0x4dcbd8){if(_['isNil'](_0x4dcbd8)){throw new Error(_0x2384bc+_0x71d0('0x54'));}_0x18989a=_0x4dcbd8;return _0x4dcbd8['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x71d0('0x8')](function(){var _0x451c60={'uniqueid':_0x7e785c+'.'+_0x18989a['id']+'.'+_0x18989a[_0x71d0('0x52')]['id'],'FromUserId':_0x1ec40d[_0x71d0('0x2b')]['id'],'type':_0x71d0('0x55')};_0x451c60[_0x2384bc+_0x71d0('0x56')]=_0x18989a['id'];_0x451c60[_0x2384bc+_0x71d0('0x57')]=_0x18989a['Interaction']['id'];_0x451c60['From'+_0x2384bc+_0x5573f6+'Id']=_0x18989a['Account']['id'];_0x451c60['To'+_0x2384bc+'QueueId']=_0x404fea['id'];return db[_0x2384bc+_0x71d0('0x58')][_0x71d0('0x59')](_0x451c60);})[_0x71d0('0x8')](function(){return respondWithRpcPromise(_0x71d0('0x5a'),{'channel':_0x7e785c,'interaction':_0x18989a[_0x71d0('0x52')],'message':_0x18989a,'account':_0x18989a[_0x71d0('0x53')],'applications':[{'id':0x0,'priority':0x1,'app':_0x71d0('0x55'),'appdata':_0x404fea['name']+','+(_0x18989a[_0x71d0('0x53')]['queueTransferTimeout']||0x12c),'interval':_0x71d0('0x5b')}]},routingClient);})[_0x71d0('0x8')](respondWithResult(_0x340334,null))['catch'](handleError(_0x340334,null));};};exports['agentNotify']=function(_0x479ece,_0x3fc4a1){var _0x507643,_0x47ef02;if(_[_0x71d0('0x13')](_0x479ece[_0x71d0('0x29')][_0x71d0('0x5c')])){throw new Error(_0x71d0('0x5d'));}var _0x561431=_0x479ece[_0x71d0('0x29')]['channel'];var _0x1d4423=_[_0x71d0('0x4f')](_0x561431);var _0x40e6b9=_0x561431===_0x71d0('0x5e')?_0x71d0('0x5f'):'Account';return db[_0x71d0('0x60')]['findOne']({'raw':!![],'where':{'id':_0x479ece[_0x71d0('0x1b')]['id'],'role':_0x71d0('0x35')}})[_0x71d0('0x8')](function(_0x12a93e){if(_[_0x71d0('0x13')](_0x12a93e)){throw new Error('Agent\x20not\x20found');}_0x507643=_0x12a93e;return db[_0x1d4423+_0x71d0('0x51')][_0x71d0('0x50')]({'where':{'id':_0x479ece[_0x71d0('0x29')]['messageId']},'include':[{'model':db[_0x1d4423+_0x71d0('0x52')],'as':'Interaction'},{'model':db[_0x1d4423+_0x40e6b9],'as':_0x71d0('0x53')}]});})[_0x71d0('0x8')](function(_0x107025){if(_[_0x71d0('0x13')](_0x107025)){throw new Error(_0x1d4423+_0x71d0('0x54'));}_0x47ef02=_0x107025;return _0x107025[_0x71d0('0x61')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x2753ab={'uniqueid':_0x561431+'.'+_0x47ef02['id']+'.'+_0x47ef02[_0x71d0('0x52')]['id'],'FromUserId':_0x479ece[_0x71d0('0x2b')]['id'],'type':_0x71d0('0x55'),'ToUserId':_0x507643['id']};_0x2753ab[_0x1d4423+_0x71d0('0x56')]=_0x47ef02['id'];_0x2753ab[_0x1d4423+_0x71d0('0x57')]=_0x47ef02[_0x71d0('0x52')]['id'];_0x2753ab[_0x71d0('0x62')+_0x1d4423+_0x40e6b9+'Id']=_0x47ef02[_0x71d0('0x53')]['id'];return db[_0x1d4423+_0x71d0('0x58')]['create'](_0x2753ab);})[_0x71d0('0x8')](function(){return respondWithRpcPromise(_0x71d0('0x5a'),{'channel':_0x561431,'interaction':_0x47ef02[_0x71d0('0x52')],'message':_0x47ef02,'account':_0x47ef02[_0x71d0('0x53')],'applications':[{'id':0x0,'priority':0x1,'app':_0x71d0('0x35'),'appdata':_0x507643['name']+','+(_0x47ef02[_0x71d0('0x53')][_0x71d0('0x63')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x71d0('0x8')](respondWithResult(_0x3fc4a1,null))[_0x71d0('0xd')](handleError(_0x3fc4a1,null));}; \ No newline at end of file +var _0x95df=['INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','showFaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','\x20Queue\x20not\x20found','Message','messageId','Interaction','update','queue','MessageId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','User','findOne','Agent\x20not\x20found','\x20Message\x20not\x20found','agentTransferTimeout','bluebird','moment','lodash','util','api','jayson/promise','http','client','request','then','error','code','message','result','catch','json','sendStatus','name','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','showVoiceQueues','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport'];(function(_0x21b7f5,_0x54fe00){var _0x1f184f=function(_0x103317){while(--_0x103317){_0x21b7f5['push'](_0x21b7f5['shift']());}};_0x1f184f(++_0x54fe00);}(_0x95df,0x11c));var _0xf95d=function(_0x236fbb,_0xa721d9){_0x236fbb=_0x236fbb-0x0;var _0x4d9c67=_0x95df[_0x236fbb];return _0x4d9c67;};'use strict';var BPromise=require(_0xf95d('0x0'));var moment=require(_0xf95d('0x1'));var _=require(_0xf95d('0x2'));var util=require(_0xf95d('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xf95d('0x4'));var jayson=require(_0xf95d('0x5'));var amiClient=jayson['client'][_0xf95d('0x6')]({'port':0x232a});var mailClient=jayson[_0xf95d('0x7')][_0xf95d('0x6')]({'port':0x232b});var routingClient=jayson[_0xf95d('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x4b58dd,_0x1adb85,_0x15660a){return new BPromise(function(_0x9e553f,_0x42379f){var _0x1464fb=_0x15660a?_0x15660a:amiClient;return _0x1464fb[_0xf95d('0x8')](_0x4b58dd,_0x1adb85)[_0xf95d('0x9')](function(_0x54f1b9){if(_0x54f1b9[_0xf95d('0xa')]){if(_0x54f1b9[_0xf95d('0xa')][_0xf95d('0xb')]===0x1f4){return _0x42379f(_0x54f1b9[_0xf95d('0xa')][_0xf95d('0xc')]);}return _0x9e553f(_0x54f1b9[_0xf95d('0xa')][_0xf95d('0xc')]);}else{_0x9e553f(_0x54f1b9[_0xf95d('0xd')]);}})[_0xf95d('0xe')](function(_0x15d19c){_0x42379f(_0x15d19c);});});}function respondWithResult(_0x245248,_0x524ccd){_0x524ccd=_0x524ccd||0xc8;return function(_0x43dab0){if(_0x43dab0){return _0x245248['status'](_0x524ccd)[_0xf95d('0xf')](_0x43dab0);}return _0x245248[_0xf95d('0x10')](0x194);};}function handleError(_0x425ddc,_0x1b4f67){_0x1b4f67=_0x1b4f67||0x1f4;return function(_0x16649f){logger[_0xf95d('0xa')](_0x16649f['stack']);if(_0x16649f[_0xf95d('0x11')]){delete _0x16649f[_0xf95d('0x11')];}_0x425ddc['status'](_0x1b4f67)['send'](_0x16649f);};}function findById(_0x2e0045){return function(_0x555bff){if(!_[_0xf95d('0x12')](_0x2e0045)&&!_['isNil'](_0x555bff)&&!_[_0xf95d('0x12')](_0x555bff['rows'])){return _[_0xf95d('0x13')](_0x555bff[_0xf95d('0x14')],function(_0x49dd36){return _0x49dd36['id']==_0x2e0045;});}return null;};}exports[_0xf95d('0x15')]=function(_0x2f33e1,_0x3186cf){return respondWithRpcPromise(_0xf95d('0x16'),_0x2f33e1[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x3186cf,null))[_0xf95d('0xe')](handleError(_0x3186cf,null));};exports[_0xf95d('0x18')]=function(_0x454361,_0x59b2ab){return respondWithRpcPromise(_0xf95d('0x19'),_[_0xf95d('0x1a')](_0x454361[_0xf95d('0x17')],_0x454361[_0xf95d('0x1b')]))['then'](respondWithResult(_0x59b2ab,null))[_0xf95d('0xe')](handleError(_0x59b2ab,null));};exports[_0xf95d('0x1c')]=function(_0x5e3090,_0x4fb9e5){return respondWithRpcPromise(_0xf95d('0x1d'),_[_0xf95d('0x1a')](_0x5e3090[_0xf95d('0x17')],_0x5e3090[_0xf95d('0x1b')]))[_0xf95d('0x9')](respondWithResult(_0x4fb9e5,null))[_0xf95d('0xe')](handleError(_0x4fb9e5,null));};exports['voiceQueues']=function(_0x386ab0,_0x549bd0){return respondWithRpcPromise('VoiceQueues',_0x386ab0[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x549bd0,null))[_0xf95d('0xe')](handleError(_0x549bd0,null));};exports[_0xf95d('0x1e')]=function(_0x1751db,_0x196708){return respondWithRpcPromise('VoiceQueues',_0x1751db[_0xf95d('0x17')])[_0xf95d('0x9')](findById(_0x1751db[_0xf95d('0x1b')]['id']))[_0xf95d('0x9')](respondWithResult(_0x196708,null))['catch'](handleError(_0x196708,null));};exports['voiceQueuesPreview']=function(_0x13c6c1,_0x4a4172){return respondWithRpcPromise(_0xf95d('0x1f'),_[_0xf95d('0x1a')](_0x13c6c1[_0xf95d('0x17')],_0x13c6c1[_0xf95d('0x1b')]))[_0xf95d('0x9')](respondWithResult(_0x4a4172,null))[_0xf95d('0xe')](handleError(_0x4a4172,null));};exports[_0xf95d('0x20')]=function(_0x14921c,_0x1d696b){return respondWithRpcPromise(_0xf95d('0x21'),_0x14921c[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x1d696b,null))['catch'](handleError(_0x1d696b,null));};exports[_0xf95d('0x22')]=function(_0x4436b4,_0x421514){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x4436b4[_0xf95d('0x17')],_0x4436b4[_0xf95d('0x1b')]))[_0xf95d('0x9')](respondWithResult(_0x421514,null))[_0xf95d('0xe')](handleError(_0x421514,null));};exports[_0xf95d('0x23')]=function(_0x4bee86,_0x33877c){return respondWithRpcPromise(_0xf95d('0x24'),_[_0xf95d('0x1a')](_0x4bee86[_0xf95d('0x17')],_0x4bee86[_0xf95d('0x1b')]))[_0xf95d('0x9')](respondWithResult(_0x33877c,null))[_0xf95d('0xe')](handleError(_0x33877c,null));};exports[_0xf95d('0x25')]=function(_0x3afc8a,_0x34ac3f){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x3afc8a['query'],_0x3afc8a['params']))[_0xf95d('0x9')](respondWithResult(_0x34ac3f,null))[_0xf95d('0xe')](handleError(_0x34ac3f,null));};exports[_0xf95d('0x26')]=function(_0x56fb11,_0x4b9e4e){return respondWithRpcPromise(_0xf95d('0x27'),_0x56fb11[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x4b9e4e,null))[_0xf95d('0xe')](handleError(_0x4b9e4e,null));};exports[_0xf95d('0x28')]=function(_0x514195,_0x1817d3){return respondWithRpcPromise(_0xf95d('0x29'),_0x514195[_0xf95d('0x17')])['then'](respondWithResult(_0x1817d3,null))[_0xf95d('0xe')](handleError(_0x1817d3,null));};exports[_0xf95d('0x2a')]=function(_0x4eb08a,_0x340a9c){var _0xa53488;return respondWithRpcPromise(_0xf95d('0x2b'),_0x4eb08a[_0xf95d('0x17')])[_0xf95d('0x9')](function(_0x1432be){_0xa53488=_0x1432be;return respondWithRpcPromise(_0xf95d('0x2b'),_0x4eb08a[_0xf95d('0x17')],routingClient);})[_0xf95d('0x9')](function(_0x3392d6){return _['merge']({},_0x3392d6,_0xa53488);})['then'](respondWithResult(_0x340a9c,null))[_0xf95d('0xe')](handleError(_0x340a9c,null));};exports['agentCapacity']=function(_0x4a0139,_0x107f52){if(_0x4a0139[_0xf95d('0x2c')]&&_0x4a0139[_0xf95d('0x2c')]['interaction']&&_0x4a0139[_0xf95d('0x2d')]&&_0x4a0139[_0xf95d('0x2d')][_0xf95d('0x11')]){for(var _0x379d40 in _0x4a0139[_0xf95d('0x2c')][_0xf95d('0x2e')]){if(_0x4a0139[_0xf95d('0x2c')]['interaction'][_0xf95d('0x2f')](_0x379d40)){db[_0xf95d('0x30')]['findAll']({'where':{'channel':_0x379d40,'membername':_0x4a0139[_0xf95d('0x2d')][_0xf95d('0x11')],'type':_0xf95d('0x31'),'exitAt':null,'uniqueid':_0x4a0139[_0xf95d('0x2c')][_0xf95d('0x2e')][_0x379d40]&&_0x4a0139[_0xf95d('0x2c')][_0xf95d('0x2e')][_0x379d40]['length']?{'$notIn':_0x4a0139['body'][_0xf95d('0x2e')][_0x379d40]}:{'$ne':null}}})['then'](function(_0x1030b5){var _0x43ba61=moment()[_0xf95d('0x32')](_0xf95d('0x33'));for(var _0x4d8c3b=0x0,_0x336480=_0x1030b5[_0xf95d('0x34')];_0x4d8c3b<_0x336480;_0x4d8c3b+=0x1){_0x1030b5[_0x4d8c3b][_0xf95d('0x35')]({'exitAt':_0x43ba61});}});for(var _0x289ba9=0x0;_0x289ba9<_0x4a0139[_0xf95d('0x2c')][_0xf95d('0x2e')][_0x379d40][_0xf95d('0x34')];_0x289ba9+=0x1){db[_0xf95d('0x30')]['findOrCreate']({'where':{'channel':_0x379d40,'membername':_0x4a0139[_0xf95d('0x2d')][_0xf95d('0x11')],'type':_0xf95d('0x31'),'uniqueid':_0x4a0139[_0xf95d('0x2c')][_0xf95d('0x2e')][_0x379d40][_0x289ba9],'exitAt':null},'defaults':{'channel':_0x379d40,'membername':_0x4a0139[_0xf95d('0x2d')]['name'],'interface':_[_0xf95d('0x12')](_0x4a0139[_0xf95d('0x2d')][_0xf95d('0x36')])?util[_0xf95d('0x32')](_0xf95d('0x37'),_0x4a0139[_0xf95d('0x2d')][_0xf95d('0x11')]):_0x4a0139[_0xf95d('0x2d')][_0xf95d('0x36')],'type':_0xf95d('0x31'),'enterAt':moment()[_0xf95d('0x32')](_0xf95d('0x33')),'role':_0xf95d('0x38'),'internal':_0x4a0139['user'][_0xf95d('0x39')],'uniqueid':_0x4a0139[_0xf95d('0x2c')][_0xf95d('0x2e')][_0x379d40][_0x289ba9]}});}}}}return respondWithRpcPromise(_0xf95d('0x3a'),{'id':_0x4a0139[_0xf95d('0x1b')]['id'],'capacity':_0x4a0139['body']['capacity']},routingClient)[_0xf95d('0x9')](respondWithResult(_0x107f52,null))[_0xf95d('0xe')](handleError(_0x107f52,null));};exports[_0xf95d('0x3b')]=function(_0x12ac53,_0x5b0775){return respondWithRpcPromise(_0xf95d('0x3c'),_0x12ac53[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x5b0775,null))[_0xf95d('0xe')](handleError(_0x5b0775,null));};exports['trunks']=function(_0x1618d3,_0x485f60){return respondWithRpcPromise(_0xf95d('0x3d'),_0x1618d3[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x485f60,null))[_0xf95d('0xe')](handleError(_0x485f60,null));};exports['campaigns']=function(_0x2bad3d,_0x31d389){return respondWithRpcPromise(_0xf95d('0x3e'),_0x2bad3d[_0xf95d('0x17')])[_0xf95d('0x9')](respondWithResult(_0x31d389,null))[_0xf95d('0xe')](handleError(_0x31d389,null));};exports[_0xf95d('0x3f')]=function(_0x300be4,_0x3c5d9e){return respondWithRpcPromise(_0xf95d('0x40'),_0x300be4[_0xf95d('0x17')],routingClient)['then'](respondWithResult(_0x3c5d9e,null))[_0xf95d('0xe')](handleError(_0x3c5d9e,null));};exports[_0xf95d('0x41')]=function(_0x3fb4cb,_0x4bf6c2){return respondWithRpcPromise(_0xf95d('0x40'),_0x3fb4cb[_0xf95d('0x17')],routingClient)[_0xf95d('0x9')](findById(_0x3fb4cb['params']['id']))[_0xf95d('0x9')](respondWithResult(_0x4bf6c2,null))[_0xf95d('0xe')](handleError(_0x4bf6c2,null));};exports['mailQueues']=function(_0x558dae,_0x32fc7a){return respondWithRpcPromise('MailQueues',_0x558dae['query'],routingClient)[_0xf95d('0x9')](respondWithResult(_0x32fc7a,null))[_0xf95d('0xe')](handleError(_0x32fc7a,null));};exports[_0xf95d('0x42')]=function(_0x2db4cd,_0x5b1a84){return respondWithRpcPromise(_0xf95d('0x43'),_0x2db4cd[_0xf95d('0x17')],routingClient)[_0xf95d('0x9')](findById(_0x2db4cd[_0xf95d('0x1b')]['id']))[_0xf95d('0x9')](respondWithResult(_0x5b1a84,null))[_0xf95d('0xe')](handleError(_0x5b1a84,null));};exports[_0xf95d('0x44')]=function(_0x186093,_0x5975b2){return respondWithRpcPromise(_0xf95d('0x45'),_0x186093['query'],mailClient)[_0xf95d('0x9')](respondWithResult(_0x5975b2,null))['catch'](handleError(_0x5975b2,null));};exports['openchannelQueues']=function(_0x124f78,_0x146ca7){return respondWithRpcPromise(_0xf95d('0x46'),_0x124f78[_0xf95d('0x17')],routingClient)[_0xf95d('0x9')](respondWithResult(_0x146ca7,null))[_0xf95d('0xe')](handleError(_0x146ca7,null));};exports[_0xf95d('0x47')]=function(_0x2be7b1,_0x490ee6){return respondWithRpcPromise(_0xf95d('0x46'),_0x2be7b1[_0xf95d('0x17')],routingClient)['then'](findById(_0x2be7b1[_0xf95d('0x1b')]['id']))[_0xf95d('0x9')](respondWithResult(_0x490ee6,null))[_0xf95d('0xe')](handleError(_0x490ee6,null));};exports['smsQueues']=function(_0x587220,_0x293362){return respondWithRpcPromise(_0xf95d('0x48'),_0x587220[_0xf95d('0x17')],routingClient)[_0xf95d('0x9')](respondWithResult(_0x293362,null))['catch'](handleError(_0x293362,null));};exports[_0xf95d('0x49')]=function(_0x2cf930,_0x1b8315){return respondWithRpcPromise('SmsQueues',_0x2cf930[_0xf95d('0x17')],routingClient)[_0xf95d('0x9')](findById(_0x2cf930[_0xf95d('0x1b')]['id']))['then'](respondWithResult(_0x1b8315,null))[_0xf95d('0xe')](handleError(_0x1b8315,null));};exports[_0xf95d('0x4a')]=function(_0x49fb01,_0x27c65a){return respondWithRpcPromise(_0xf95d('0x4b'),_0x49fb01[_0xf95d('0x17')],routingClient)['then'](respondWithResult(_0x27c65a,null))[_0xf95d('0xe')](handleError(_0x27c65a,null));};exports[_0xf95d('0x4c')]=function(_0x4e8480,_0x3aa0a9){return respondWithRpcPromise(_0xf95d('0x4b'),_0x4e8480[_0xf95d('0x17')],routingClient)['then'](findById(_0x4e8480[_0xf95d('0x1b')]['id']))['then'](respondWithResult(_0x3aa0a9,null))['catch'](handleError(_0x3aa0a9,null));};exports['faxAccounts']=function(_0x2df822,_0x8214a2){return respondWithRpcPromise(_0xf95d('0x4d'),_0x2df822[_0xf95d('0x17')])['then'](respondWithResult(_0x8214a2,null))['catch'](handleError(_0x8214a2,null));};exports['chatQueuesWaitingInteractions']=function(_0x5b6720,_0x3b903b){return respondWithRpcPromise(_0xf95d('0x4e'),_0x5b6720[_0xf95d('0x17')],routingClient)['then'](respondWithResult(_0x3b903b,null))[_0xf95d('0xe')](handleError(_0x3b903b,null));};exports['mailQueuesWaitingInteractions']=function(_0x5db9f8,_0xf5f074){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x5db9f8[_0xf95d('0x17')],routingClient)['then'](respondWithResult(_0xf5f074,null))[_0xf95d('0xe')](handleError(_0xf5f074,null));};exports[_0xf95d('0x4f')]=function(_0x558355,_0x28d171){return respondWithRpcPromise(_0xf95d('0x50'),_0x558355[_0xf95d('0x17')],routingClient)['then'](respondWithResult(_0x28d171,null))['catch'](handleError(_0x28d171,null));};exports[_0xf95d('0x51')]=function(_0x5ed6e8,_0x1f6b0e){return respondWithRpcPromise(_0xf95d('0x52'),_0x5ed6e8['query'],routingClient)[_0xf95d('0x9')](respondWithResult(_0x1f6b0e,null))[_0xf95d('0xe')](handleError(_0x1f6b0e,null));};exports[_0xf95d('0x53')]=function(_0x122752,_0x246a6e){return respondWithRpcPromise(_0xf95d('0x54'),_0x122752[_0xf95d('0x17')],routingClient)[_0xf95d('0x9')](respondWithResult(_0x246a6e,null))[_0xf95d('0xe')](handleError(_0x246a6e,null));};exports[_0xf95d('0x55')]=function(_0x447eb3){return function(_0x566452,_0x3e3ccd){var _0x3334f2,_0xae598c;var _0x3c6667=_[_0xf95d('0x56')](_0x447eb3);var _0x1ebb51=_0x447eb3===_0xf95d('0x57')?_0xf95d('0x58'):_0xf95d('0x59');return db[_0x3c6667+'Queue']['findOne']({'raw':!![],'where':{'id':_0x566452[_0xf95d('0x1b')]['id']}})['then'](function(_0xd296f8){if(_['isNil'](_0xd296f8)){throw new Error(_0x3c6667+_0xf95d('0x5a'));}_0x3334f2=_0xd296f8;return db[_0x3c6667+_0xf95d('0x5b')]['findOne']({'where':{'id':_0x566452[_0xf95d('0x2c')][_0xf95d('0x5c')]},'include':[{'model':db[_0x3c6667+_0xf95d('0x5d')],'as':_0xf95d('0x5d')},{'model':db[_0x3c6667+_0x1ebb51],'as':_0xf95d('0x59')}]});})[_0xf95d('0x9')](function(_0x5622f1){if(_[_0xf95d('0x12')](_0x5622f1)){throw new Error(_0x3c6667+'\x20Message\x20not\x20found');}_0xae598c=_0x5622f1;return _0x5622f1[_0xf95d('0x5e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xf95d('0x9')](function(){var _0x1c486e={'uniqueid':_0x447eb3+'.'+_0xae598c['id']+'.'+_0xae598c[_0xf95d('0x5d')]['id'],'FromUserId':_0x566452[_0xf95d('0x2d')]['id'],'type':_0xf95d('0x5f')};_0x1c486e[_0x3c6667+_0xf95d('0x60')]=_0xae598c['id'];_0x1c486e[_0x3c6667+'InteractionId']=_0xae598c[_0xf95d('0x5d')]['id'];_0x1c486e[_0xf95d('0x61')+_0x3c6667+_0x1ebb51+'Id']=_0xae598c[_0xf95d('0x59')]['id'];_0x1c486e['To'+_0x3c6667+_0xf95d('0x62')]=_0x3334f2['id'];return db[_0x3c6667+_0xf95d('0x63')][_0xf95d('0x64')](_0x1c486e);})[_0xf95d('0x9')](function(){return respondWithRpcPromise(_0xf95d('0x65'),{'channel':_0x447eb3,'interaction':_0xae598c['Interaction'],'message':_0xae598c,'account':_0xae598c[_0xf95d('0x59')],'applications':[{'id':0x0,'priority':0x1,'app':_0xf95d('0x5f'),'appdata':_0x3334f2['name']+','+(_0xae598c[_0xf95d('0x59')][_0xf95d('0x66')]||0x12c),'interval':_0xf95d('0x67')}]},routingClient);})[_0xf95d('0x9')](respondWithResult(_0x3e3ccd,null))[_0xf95d('0xe')](handleError(_0x3e3ccd,null));};};exports[_0xf95d('0x68')]=function(_0x10f2d1,_0x327fed){var _0x465665,_0x4562cf;if(_['isNil'](_0x10f2d1['body']['channel'])){throw new Error(_0xf95d('0x69'));}var _0x555083=_0x10f2d1['body']['channel'];var _0x92cb71=_[_0xf95d('0x56')](_0x555083);var _0x287df1=_0x555083==='chat'?_0xf95d('0x58'):_0xf95d('0x59');return db[_0xf95d('0x6a')][_0xf95d('0x6b')]({'raw':!![],'where':{'id':_0x10f2d1['params']['id'],'role':_0xf95d('0x38')}})[_0xf95d('0x9')](function(_0x4c1ce4){if(_['isNil'](_0x4c1ce4)){throw new Error(_0xf95d('0x6c'));}_0x465665=_0x4c1ce4;return db[_0x92cb71+_0xf95d('0x5b')][_0xf95d('0x6b')]({'where':{'id':_0x10f2d1[_0xf95d('0x2c')][_0xf95d('0x5c')]},'include':[{'model':db[_0x92cb71+_0xf95d('0x5d')],'as':'Interaction'},{'model':db[_0x92cb71+_0x287df1],'as':_0xf95d('0x59')}]});})['then'](function(_0x4e3bad){if(_[_0xf95d('0x12')](_0x4e3bad)){throw new Error(_0x92cb71+_0xf95d('0x6d'));}_0x4562cf=_0x4e3bad;return _0x4e3bad[_0xf95d('0x5e')]({'read':0x0,'readAt':null,'UserId':null});})[_0xf95d('0x9')](function(){var _0x1c6f84={'uniqueid':_0x555083+'.'+_0x4562cf['id']+'.'+_0x4562cf[_0xf95d('0x5d')]['id'],'FromUserId':_0x10f2d1[_0xf95d('0x2d')]['id'],'type':_0xf95d('0x5f'),'ToUserId':_0x465665['id']};_0x1c6f84[_0x92cb71+_0xf95d('0x60')]=_0x4562cf['id'];_0x1c6f84[_0x92cb71+'InteractionId']=_0x4562cf[_0xf95d('0x5d')]['id'];_0x1c6f84[_0xf95d('0x61')+_0x92cb71+_0x287df1+'Id']=_0x4562cf[_0xf95d('0x59')]['id'];return db[_0x92cb71+_0xf95d('0x63')][_0xf95d('0x64')](_0x1c6f84);})[_0xf95d('0x9')](function(){return respondWithRpcPromise(_0xf95d('0x65'),{'channel':_0x555083,'interaction':_0x4562cf[_0xf95d('0x5d')],'message':_0x4562cf,'account':_0x4562cf[_0xf95d('0x59')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x465665[_0xf95d('0x11')]+','+(_0x4562cf[_0xf95d('0x59')][_0xf95d('0x6e')]||0x12c),'interval':_0xf95d('0x67')}]},routingClient);})[_0xf95d('0x9')](respondWithResult(_0x327fed,null))[_0xf95d('0xe')](handleError(_0x327fed,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 6acb8f9..3d06ceb 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 _0x194e=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','run','create','put','update'];(function(_0x2a2673,_0x368539){var _0x475bc5=function(_0x44ef62){while(--_0x44ef62){_0x2a2673['push'](_0x2a2673['shift']());}};_0x475bc5(++_0x368539);}(_0x194e,0x1de));var _0xe194=function(_0x6cef08,_0x493c5e){_0x6cef08=_0x6cef08-0x0;var _0x5a002f=_0x194e[_0x6cef08];return _0x5a002f;};'use strict';var multer=require(_0xe194('0x0'));var util=require(_0xe194('0x1'));var path=require('path');var timeout=require(_0xe194('0x2'));var express=require(_0xe194('0x3'));var router=express[_0xe194('0x4')]();var auth=require(_0xe194('0x5'));var interaction=require(_0xe194('0x6'));var config=require(_0xe194('0x7'));var controller=require('./schedule.controller');router[_0xe194('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe194('0x8')](_0xe194('0x9'),auth[_0xe194('0xa')](),controller[_0xe194('0xb')]);router[_0xe194('0x8')]('/:id/run',auth['isAuthenticated'](),controller[_0xe194('0xc')]);router['post']('/',auth[_0xe194('0xa')](),controller[_0xe194('0xd')]);router[_0xe194('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xe194('0xf')]);router[_0xe194('0x10')](_0xe194('0x9'),auth[_0xe194('0xa')](),controller[_0xe194('0x11')]);module[_0xe194('0x12')]=router; \ No newline at end of file +var _0xb4ec=['get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x4c2750,_0x28b841){var _0x15faff=function(_0x4c1df1){while(--_0x4c1df1){_0x4c2750['push'](_0x4c2750['shift']());}};_0x15faff(++_0x28b841);}(_0xb4ec,0x6f));var _0xcb4e=function(_0x17178a,_0x23b5a0){_0x17178a=_0x17178a-0x0;var _0x883dd1=_0xb4ec[_0x17178a];return _0x883dd1;};'use strict';var multer=require(_0xcb4e('0x0'));var util=require(_0xcb4e('0x1'));var path=require(_0xcb4e('0x2'));var timeout=require('connect-timeout');var express=require(_0xcb4e('0x3'));var router=express[_0xcb4e('0x4')]();var auth=require(_0xcb4e('0x5'));var interaction=require(_0xcb4e('0x6'));var config=require(_0xcb4e('0x7'));var controller=require(_0xcb4e('0x8'));router[_0xcb4e('0x9')]('/',auth[_0xcb4e('0xa')](),controller[_0xcb4e('0xb')]);router['get'](_0xcb4e('0xc'),auth['isAuthenticated'](),controller[_0xcb4e('0xd')]);router[_0xcb4e('0x9')]('/:id/run',auth[_0xcb4e('0xa')](),controller['run']);router[_0xcb4e('0xe')]('/',auth[_0xcb4e('0xa')](),controller[_0xcb4e('0xf')]);router['put']('/:id',auth[_0xcb4e('0xa')](),controller[_0xcb4e('0x10')]);router[_0xcb4e('0x11')](_0xcb4e('0xc'),auth[_0xcb4e('0xa')](),controller[_0xcb4e('0x12')]);module[_0xcb4e('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index b076903..e24e958 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 _0x553a=['STRING','BOOLEAN','DATE','years','weeks','days','hours','csv','pdf','xlsx','custom','TEXT','exports'];(function(_0x1e7944,_0x5a1ee7){var _0x4be825=function(_0x14932d){while(--_0x14932d){_0x1e7944['push'](_0x1e7944['shift']());}};_0x4be825(++_0x5a1ee7);}(_0x553a,0x192));var _0xa553=function(_0x25a386,_0x4acd61){_0x25a386=_0x25a386-0x0;var _0x4d3d47=_0x553a[_0x25a386];return _0x4d3d47;};'use strict';var Sequelize=require('sequelize');module[_0xa553('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa553('0x1')]},'active':{'type':Sequelize[_0xa553('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa553('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xa553('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xa553('0x4'),'quarters','months',_0xa553('0x5'),_0xa553('0x6'),_0xa553('0x7'),'minutes'),'allowNull':![],'defaultValue':_0xa553('0x6')},'output':{'type':Sequelize['ENUM'](_0xa553('0x8'),_0xa553('0x9'),_0xa553('0xa')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize['ENUM'](_0xa553('0xb'),'default'),'allowNull':![],'defaultValue':_0xa553('0xb')},'sendMail':{'type':Sequelize[_0xa553('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xa553('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xa553('0xc')]},'sendIfEmpty':{'type':Sequelize[_0xa553('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x80c3=['days','hours','ENUM','pdf','xlsx','custom','default','BOOLEAN','TEXT','sequelize','STRING','0\x200\x20*\x20*\x20*','DATE','years','weeks'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x80c3,0x18f));var _0x380c=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0x80c3[_0x5f4cd7];return _0x47c93f;};'use strict';var Sequelize=require(_0x380c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x380c('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x380c('0x1')],'allowNull':![],'defaultValue':_0x380c('0x2')},'startAt':{'type':Sequelize[_0x380c('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x380c('0x4'),'quarters','months',_0x380c('0x5'),_0x380c('0x6'),_0x380c('0x7'),'minutes'),'allowNull':![],'defaultValue':_0x380c('0x6')},'output':{'type':Sequelize[_0x380c('0x8')]('csv',_0x380c('0x9'),_0x380c('0xa')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x380c('0x8')](_0x380c('0xb'),_0x380c('0xc')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x380c('0xd')],'defaultValue':![]},'email':{'type':Sequelize[_0x380c('0x1')]},'cc':{'type':Sequelize[_0x380c('0xe')]},'bcc':{'type':Sequelize[_0x380c('0xe')]},'sendIfEmpty':{'type':Sequelize[_0x380c('0xd')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index f107e12..1b93020 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 _0x714a=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','set','Content-Range','reject','save','update','destroy','then','get','Scheduler','UserProfileResource','error','stack','name','index','map','Schedule','rawAttributes','type','key','model','query','keys','intersection','attributes','length','nolimit','limit','offset','order','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs'];(function(_0x1fe01d,_0x5c5cb6){var _0x3a4d48=function(_0x4636a0){while(--_0x4636a0){_0x1fe01d['push'](_0x1fe01d['shift']());}};_0x3a4d48(++_0x5c5cb6);}(_0x714a,0x18b));var _0xa714=function(_0x546106,_0x3845b3){_0x546106=_0x546106-0x0;var _0x3d0f34=_0x714a[_0x546106];return _0x3d0f34;};'use strict';var pdf=require(_0xa714('0x0'));var emlformat=require(_0xa714('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa714('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa714('0x3'));var moment=require(_0xa714('0x4'));var BPromise=require(_0xa714('0x5'));var Mustache=require('mustache');var util=require(_0xa714('0x6'));var path=require(_0xa714('0x7'));var sox=require(_0xa714('0x8'));var csv=require('to-csv');var ejs=require(_0xa714('0x9'));var fs=require('fs');var _=require(_0xa714('0xa'));var squel=require(_0xa714('0xb'));var crypto=require(_0xa714('0xc'));var jsforce=require(_0xa714('0xd'));var deskjs=require(_0xa714('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa714('0xf'));var Papa=require('papaparse');var Redis=require(_0xa714('0x10'));var authService=require(_0xa714('0x11'));var qs=require(_0xa714('0x12'));var as=require(_0xa714('0x13'));var hardwareService=require(_0xa714('0x14'));var logger=require(_0xa714('0x15'))(_0xa714('0x16'));var utils=require(_0xa714('0x17'));var config=require(_0xa714('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fc7d3,_0x4375a9){_0x4375a9=_0x4375a9||0xcc;return function(_0x18b494){if(_0x18b494){return _0x4fc7d3[_0xa714('0x19')](_0x4375a9);}return _0x4fc7d3[_0xa714('0x1a')](_0x4375a9)[_0xa714('0x1b')]();};}function respondWithResult(_0x13b8c8,_0x545360){_0x545360=_0x545360||0xc8;return function(_0x4ce347){if(_0x4ce347){return _0x13b8c8[_0xa714('0x1a')](_0x545360)[_0xa714('0x1c')](_0x4ce347);}};}function respondWithFilteredResult(_0x4b83af,_0x2d12f7){return function(_0x5ab1d5){if(_0x5ab1d5){var _0x529a75=_0x5ab1d5['count'],_0x69defa=_0x2d12f7['offset'],_0x5c5556=_0x2d12f7['offset']+_0x2d12f7['limit'],_0x563cc9;if(_0x5c5556>=_0x529a75){_0x5c5556=_0x529a75;_0x563cc9=0xc8;}else{_0x563cc9=0xce;}_0x4b83af[_0xa714('0x1a')](_0x563cc9);return _0x4b83af[_0xa714('0x1d')](_0xa714('0x1e'),_0x69defa+'-'+_0x5c5556+'/'+_0x529a75)['json'](_0x5ab1d5);}return null;};}function patchUpdates(_0x1b502a){return function(_0x463bb7){try{jsonpatch['apply'](_0x463bb7,_0x1b502a,!![]);}catch(_0x28cb54){return BPromise[_0xa714('0x1f')](_0x28cb54);}return _0x463bb7[_0xa714('0x20')]();};}function saveUpdates(_0x332d6f,_0x5af93f){return function(_0x550bac){if(_0x550bac){return _0x550bac[_0xa714('0x21')](_0x332d6f)['then'](function(_0x41432d){return _0x41432d;});}return null;};}function removeEntity(_0x33ca25,_0x77c119){return function(_0x49a50e){if(_0x49a50e){return _0x49a50e[_0xa714('0x22')]()[_0xa714('0x23')](function(){var _0x3315fa=_0x49a50e[_0xa714('0x24')]({'plain':!![]});var _0x393fd2=_0xa714('0x25');return db[_0xa714('0x26')][_0xa714('0x22')]({'where':{'type':_0x393fd2,'resourceId':_0x3315fa['id']}})[_0xa714('0x23')](function(){return _0x49a50e;});})['then'](function(){_0x33ca25[_0xa714('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x263548,_0x301bf6){return function(_0x5cb494){if(!_0x5cb494){_0x263548[_0xa714('0x19')](0x194);}return _0x5cb494;};}function handleError(_0x5315b0,_0x521498){_0x521498=_0x521498||0x1f4;return function(_0x1ef3ab){logger[_0xa714('0x27')](_0x1ef3ab[_0xa714('0x28')]);if(_0x1ef3ab[_0xa714('0x29')]){delete _0x1ef3ab[_0xa714('0x29')];}_0x5315b0[_0xa714('0x1a')](_0x521498)['send'](_0x1ef3ab);};}exports[_0xa714('0x2a')]=function(_0x3e1260,_0x115f28){var _0x5beb67={},_0x17b813={},_0x34e128={'count':0x0,'rows':[]};var _0x462602=_[_0xa714('0x2b')](db[_0xa714('0x2c')][_0xa714('0x2d')],function(_0x27ceb9){return{'name':_0x27ceb9['fieldName'],'type':_0x27ceb9[_0xa714('0x2e')][_0xa714('0x2f')]};});_0x17b813[_0xa714('0x30')]=_['map'](_0x462602,_0xa714('0x29'));_0x17b813[_0xa714('0x31')]=_[_0xa714('0x32')](_0x3e1260[_0xa714('0x31')]);_0x17b813['filters']=_[_0xa714('0x33')](_0x17b813['model'],_0x17b813[_0xa714('0x31')]);_0x5beb67[_0xa714('0x34')]=_[_0xa714('0x33')](_0x17b813[_0xa714('0x30')],qs['fields'](_0x3e1260[_0xa714('0x31')]['fields']));_0x5beb67[_0xa714('0x34')]=_0x5beb67[_0xa714('0x34')][_0xa714('0x35')]?_0x5beb67[_0xa714('0x34')]:_0x17b813[_0xa714('0x30')];if(!_0x3e1260[_0xa714('0x31')]['hasOwnProperty'](_0xa714('0x36'))){_0x5beb67[_0xa714('0x37')]=qs['limit'](_0x3e1260['query'][_0xa714('0x37')]);_0x5beb67[_0xa714('0x38')]=qs[_0xa714('0x38')](_0x3e1260['query'][_0xa714('0x38')]);}_0x5beb67[_0xa714('0x39')]=qs['sort'](_0x3e1260[_0xa714('0x31')]['sort']);_0x5beb67[_0xa714('0x3a')]=qs[_0xa714('0x3b')](_[_0xa714('0x3c')](_0x3e1260['query'],_0x17b813['filters']));if(_0x3e1260['query'][_0xa714('0x3d')]){_0x5beb67['where']=_['merge'](_0x5beb67[_0xa714('0x3a')],{'$or':_[_0xa714('0x2b')](_0x462602,function(_0x3e320d){if(_0x3e320d[_0xa714('0x2e')]!==_0xa714('0x3e')){var _0x4bc9b3={};_0x4bc9b3[_0x3e320d['name']]={'$like':'%'+_0x3e1260[_0xa714('0x31')][_0xa714('0x3d')]+'%'};return _0x4bc9b3;}})});}_0x5beb67=_[_0xa714('0x3f')]({},_0x5beb67,_0x3e1260[_0xa714('0x40')]);var _0xe8c155={'where':_0x5beb67[_0xa714('0x3a')]};return db['Schedule'][_0xa714('0x41')](_0xe8c155)[_0xa714('0x23')](function(_0x3316ec){_0x34e128[_0xa714('0x41')]=_0x3316ec;if(_0x3e1260[_0xa714('0x31')][_0xa714('0x42')]){_0x5beb67[_0xa714('0x43')]=[{'all':!![]}];}return db[_0xa714('0x2c')]['findAll'](_0x5beb67);})[_0xa714('0x23')](function(_0x551f02){_0x34e128[_0xa714('0x44')]=_0x551f02;return _0x34e128;})['then'](respondWithFilteredResult(_0x115f28,_0x5beb67))[_0xa714('0x45')](handleError(_0x115f28,null));};exports[_0xa714('0x46')]=function(_0x36d66e,_0x70e0cf){var _0x2fc6d1={'raw':![],'where':{'id':_0x36d66e[_0xa714('0x47')]['id']}},_0x3733b1={};_0x3733b1[_0xa714('0x30')]=_[_0xa714('0x32')](db[_0xa714('0x2c')][_0xa714('0x2d')]);_0x3733b1['query']=_[_0xa714('0x32')](_0x36d66e['query']);_0x3733b1[_0xa714('0x3b')]=_[_0xa714('0x33')](_0x3733b1[_0xa714('0x30')],_0x3733b1[_0xa714('0x31')]);_0x2fc6d1[_0xa714('0x34')]=_[_0xa714('0x33')](_0x3733b1[_0xa714('0x30')],qs['fields'](_0x36d66e[_0xa714('0x31')]['fields']));_0x2fc6d1[_0xa714('0x34')]=_0x2fc6d1[_0xa714('0x34')][_0xa714('0x35')]?_0x2fc6d1[_0xa714('0x34')]:_0x3733b1['model'];if(_0x36d66e['query'][_0xa714('0x42')]){_0x2fc6d1[_0xa714('0x43')]=[{'all':!![]}];}_0x2fc6d1=_[_0xa714('0x3f')]({},_0x2fc6d1,_0x36d66e[_0xa714('0x40')]);return db[_0xa714('0x2c')][_0xa714('0x48')](_0x2fc6d1)[_0xa714('0x23')](handleEntityNotFound(_0x70e0cf,null))[_0xa714('0x23')](respondWithResult(_0x70e0cf,null))[_0xa714('0x45')](handleError(_0x70e0cf,null));};exports[_0xa714('0x49')]=function(_0x217c2f,_0x55423c){return db[_0xa714('0x2c')][_0xa714('0x49')](_0x217c2f[_0xa714('0x4a')],{})[_0xa714('0x23')](function(_0x4f749b){var _0x2d0697=_0x217c2f[_0xa714('0x4b')][_0xa714('0x24')]({'plain':!![]});if(!_0x2d0697)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d0697[_0xa714('0x4c')]===_0xa714('0x4b')){var _0x25283e=_0x4f749b[_0xa714('0x24')]({'plain':!![]});var _0x31633e='Scheduler';return db[_0xa714('0x4d')][_0xa714('0x48')]({'where':{'name':_0x31633e,'userProfileId':_0x2d0697['userProfileId']},'raw':!![]})[_0xa714('0x23')](function(_0x492eef){if(_0x492eef&&_0x492eef[_0xa714('0x4e')]===0x0){return db[_0xa714('0x26')][_0xa714('0x49')]({'name':_0x25283e['name'],'resourceId':_0x25283e['id'],'type':_0x492eef[_0xa714('0x29')],'sectionId':_0x492eef['id']},{})[_0xa714('0x23')](function(){return _0x4f749b;});}else{return _0x4f749b;}})['catch'](function(_0x118e65){logger['error'](_0xa714('0x4f'),_0x118e65);throw _0x118e65;});}return _0x4f749b;})[_0xa714('0x23')](respondWithResult(_0x55423c,0xc9))[_0xa714('0x45')](handleError(_0x55423c,null));};exports[_0xa714('0x21')]=function(_0x5437f0,_0x30d57a){if(_0x5437f0['body']['id']){delete _0x5437f0[_0xa714('0x4a')]['id'];}return db[_0xa714('0x2c')]['find']({'where':{'id':_0x5437f0[_0xa714('0x47')]['id']}})[_0xa714('0x23')](handleEntityNotFound(_0x30d57a,null))[_0xa714('0x23')](saveUpdates(_0x5437f0['body'],null))[_0xa714('0x23')](respondWithResult(_0x30d57a,null))[_0xa714('0x45')](handleError(_0x30d57a,null));};exports[_0xa714('0x22')]=function(_0x4097b0,_0xf28338){return db[_0xa714('0x2c')][_0xa714('0x48')]({'where':{'id':_0x4097b0['params']['id']}})[_0xa714('0x23')](handleEntityNotFound(_0xf28338,null))[_0xa714('0x23')](removeEntity(_0xf28338,null))['catch'](handleError(_0xf28338,null));};exports[_0xa714('0x50')]=function(_0x3a48e3,_0x24ff5a,_0x58b8e9){var _0x23660c=require('../../config/schedule');return db[_0xa714('0x2c')][_0xa714('0x48')]({'where':{'id':_0x3a48e3['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x24ff5a,null))['then'](function(){_0x23660c[_0xa714('0x50')](_0x3a48e3['params']['id']);})['then'](respondWithStatusCode(_0x24ff5a,null))[_0xa714('0x45')](handleError(_0x24ff5a,null));}; \ No newline at end of file +var _0xebc7=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','../../config/schedule','run','html-pdf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','stack','name','send','Schedule','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields'];(function(_0xd0e550,_0x566add){var _0x59ec51=function(_0x26b994){while(--_0x26b994){_0xd0e550['push'](_0xd0e550['shift']());}};_0x59ec51(++_0x566add);}(_0xebc7,0x111));var _0x7ebc=function(_0x1690fb,_0x22ffcb){_0x1690fb=_0x1690fb-0x0;var _0xbec96f=_0xebc7[_0x1690fb];return _0xbec96f;};'use strict';var pdf=require(_0x7ebc('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7ebc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7ebc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7ebc('0x3'));var util=require(_0x7ebc('0x4'));var path=require(_0x7ebc('0x5'));var sox=require(_0x7ebc('0x6'));var csv=require(_0x7ebc('0x7'));var ejs=require(_0x7ebc('0x8'));var fs=require('fs');var _=require(_0x7ebc('0x9'));var squel=require(_0x7ebc('0xa'));var crypto=require('crypto');var jsforce=require(_0x7ebc('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7ebc('0xc'));var Papa=require(_0x7ebc('0xd'));var Redis=require(_0x7ebc('0xe'));var authService=require(_0x7ebc('0xf'));var qs=require(_0x7ebc('0x10'));var as=require(_0x7ebc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7ebc('0x12'))(_0x7ebc('0x13'));var utils=require(_0x7ebc('0x14'));var config=require(_0x7ebc('0x15'));var db=require(_0x7ebc('0x16'))['db'];function respondWithStatusCode(_0x3cc213,_0x27d001){_0x27d001=_0x27d001||0xcc;return function(_0x4700ad){if(_0x4700ad){return _0x3cc213[_0x7ebc('0x17')](_0x27d001);}return _0x3cc213['status'](_0x27d001)[_0x7ebc('0x18')]();};}function respondWithResult(_0x278d01,_0x483071){_0x483071=_0x483071||0xc8;return function(_0x4c2092){if(_0x4c2092){return _0x278d01['status'](_0x483071)[_0x7ebc('0x19')](_0x4c2092);}};}function respondWithFilteredResult(_0x3e3bcc,_0x2c4cae){return function(_0x3e3bd6){if(_0x3e3bd6){var _0x5260af=_0x3e3bd6[_0x7ebc('0x1a')],_0x598fd1=_0x2c4cae[_0x7ebc('0x1b')],_0xa8d27b=_0x2c4cae[_0x7ebc('0x1b')]+_0x2c4cae['limit'],_0x10c5d2;if(_0xa8d27b>=_0x5260af){_0xa8d27b=_0x5260af;_0x10c5d2=0xc8;}else{_0x10c5d2=0xce;}_0x3e3bcc[_0x7ebc('0x1c')](_0x10c5d2);return _0x3e3bcc[_0x7ebc('0x1d')](_0x7ebc('0x1e'),_0x598fd1+'-'+_0xa8d27b+'/'+_0x5260af)[_0x7ebc('0x19')](_0x3e3bd6);}return null;};}function patchUpdates(_0x4af4e3){return function(_0x7fbb2e){try{jsonpatch[_0x7ebc('0x1f')](_0x7fbb2e,_0x4af4e3,!![]);}catch(_0x68a664){return BPromise[_0x7ebc('0x20')](_0x68a664);}return _0x7fbb2e[_0x7ebc('0x21')]();};}function saveUpdates(_0x32372a,_0x19ad42){return function(_0x2bff51){if(_0x2bff51){return _0x2bff51[_0x7ebc('0x22')](_0x32372a)[_0x7ebc('0x23')](function(_0x31f8b3){return _0x31f8b3;});}return null;};}function removeEntity(_0x186a59,_0x35d307){return function(_0x2f9834){if(_0x2f9834){return _0x2f9834[_0x7ebc('0x24')]()[_0x7ebc('0x23')](function(){var _0x4bb6e3=_0x2f9834[_0x7ebc('0x25')]({'plain':!![]});var _0x337e56=_0x7ebc('0x26');return db[_0x7ebc('0x27')][_0x7ebc('0x24')]({'where':{'type':_0x337e56,'resourceId':_0x4bb6e3['id']}})[_0x7ebc('0x23')](function(){return _0x2f9834;});})[_0x7ebc('0x23')](function(){_0x186a59[_0x7ebc('0x1c')](0xcc)[_0x7ebc('0x18')]();});}};}function handleEntityNotFound(_0x35fe52,_0x3f88b2){return function(_0x2f0243){if(!_0x2f0243){_0x35fe52[_0x7ebc('0x17')](0x194);}return _0x2f0243;};}function handleError(_0x4e486e,_0x6c8dff){_0x6c8dff=_0x6c8dff||0x1f4;return function(_0x388a12){logger[_0x7ebc('0x28')](_0x388a12[_0x7ebc('0x29')]);if(_0x388a12[_0x7ebc('0x2a')]){delete _0x388a12[_0x7ebc('0x2a')];}_0x4e486e[_0x7ebc('0x1c')](_0x6c8dff)[_0x7ebc('0x2b')](_0x388a12);};}exports['index']=function(_0x31f011,_0x53356f){var _0x2642fd={},_0x1318f5={},_0x4b19ee={'count':0x0,'rows':[]};var _0x913c7c=_['map'](db[_0x7ebc('0x2c')]['rawAttributes'],function(_0xd61a03){return{'name':_0xd61a03[_0x7ebc('0x2d')],'type':_0xd61a03['type'][_0x7ebc('0x2e')]};});_0x1318f5[_0x7ebc('0x2f')]=_[_0x7ebc('0x30')](_0x913c7c,'name');_0x1318f5[_0x7ebc('0x31')]=_[_0x7ebc('0x32')](_0x31f011['query']);_0x1318f5[_0x7ebc('0x33')]=_[_0x7ebc('0x34')](_0x1318f5[_0x7ebc('0x2f')],_0x1318f5[_0x7ebc('0x31')]);_0x2642fd[_0x7ebc('0x35')]=_[_0x7ebc('0x34')](_0x1318f5[_0x7ebc('0x2f')],qs[_0x7ebc('0x36')](_0x31f011[_0x7ebc('0x31')][_0x7ebc('0x36')]));_0x2642fd[_0x7ebc('0x35')]=_0x2642fd[_0x7ebc('0x35')][_0x7ebc('0x37')]?_0x2642fd[_0x7ebc('0x35')]:_0x1318f5[_0x7ebc('0x2f')];if(!_0x31f011[_0x7ebc('0x31')][_0x7ebc('0x38')](_0x7ebc('0x39'))){_0x2642fd[_0x7ebc('0x3a')]=qs[_0x7ebc('0x3a')](_0x31f011[_0x7ebc('0x31')]['limit']);_0x2642fd['offset']=qs[_0x7ebc('0x1b')](_0x31f011[_0x7ebc('0x31')][_0x7ebc('0x1b')]);}_0x2642fd[_0x7ebc('0x3b')]=qs[_0x7ebc('0x3c')](_0x31f011[_0x7ebc('0x31')]['sort']);_0x2642fd[_0x7ebc('0x3d')]=qs[_0x7ebc('0x33')](_[_0x7ebc('0x3e')](_0x31f011[_0x7ebc('0x31')],_0x1318f5[_0x7ebc('0x33')]));if(_0x31f011[_0x7ebc('0x31')][_0x7ebc('0x3f')]){_0x2642fd['where']=_['merge'](_0x2642fd[_0x7ebc('0x3d')],{'$or':_[_0x7ebc('0x30')](_0x913c7c,function(_0x455d5e){if(_0x455d5e[_0x7ebc('0x40')]!=='VIRTUAL'){var _0x219236={};_0x219236[_0x455d5e['name']]={'$like':'%'+_0x31f011[_0x7ebc('0x31')]['filter']+'%'};return _0x219236;}})});}_0x2642fd=_['merge']({},_0x2642fd,_0x31f011[_0x7ebc('0x41')]);var _0x25358e={'where':_0x2642fd[_0x7ebc('0x3d')]};return db[_0x7ebc('0x2c')]['count'](_0x25358e)['then'](function(_0x29e33a){_0x4b19ee[_0x7ebc('0x1a')]=_0x29e33a;if(_0x31f011[_0x7ebc('0x31')][_0x7ebc('0x42')]){_0x2642fd[_0x7ebc('0x43')]=[{'all':!![]}];}return db[_0x7ebc('0x2c')][_0x7ebc('0x44')](_0x2642fd);})[_0x7ebc('0x23')](function(_0x375d03){_0x4b19ee[_0x7ebc('0x45')]=_0x375d03;return _0x4b19ee;})[_0x7ebc('0x23')](respondWithFilteredResult(_0x53356f,_0x2642fd))[_0x7ebc('0x46')](handleError(_0x53356f,null));};exports['show']=function(_0x57ccb5,_0x1a2230){var _0x655b35={'raw':![],'where':{'id':_0x57ccb5[_0x7ebc('0x47')]['id']}},_0x2aef23={};_0x2aef23[_0x7ebc('0x2f')]=_[_0x7ebc('0x32')](db['Schedule'][_0x7ebc('0x48')]);_0x2aef23[_0x7ebc('0x31')]=_[_0x7ebc('0x32')](_0x57ccb5[_0x7ebc('0x31')]);_0x2aef23['filters']=_[_0x7ebc('0x34')](_0x2aef23[_0x7ebc('0x2f')],_0x2aef23[_0x7ebc('0x31')]);_0x655b35['attributes']=_[_0x7ebc('0x34')](_0x2aef23[_0x7ebc('0x2f')],qs[_0x7ebc('0x36')](_0x57ccb5[_0x7ebc('0x31')]['fields']));_0x655b35[_0x7ebc('0x35')]=_0x655b35[_0x7ebc('0x35')][_0x7ebc('0x37')]?_0x655b35['attributes']:_0x2aef23[_0x7ebc('0x2f')];if(_0x57ccb5[_0x7ebc('0x31')]['includeAll']){_0x655b35[_0x7ebc('0x43')]=[{'all':!![]}];}_0x655b35=_['merge']({},_0x655b35,_0x57ccb5['options']);return db['Schedule'][_0x7ebc('0x49')](_0x655b35)[_0x7ebc('0x23')](handleEntityNotFound(_0x1a2230,null))[_0x7ebc('0x23')](respondWithResult(_0x1a2230,null))[_0x7ebc('0x46')](handleError(_0x1a2230,null));};exports[_0x7ebc('0x4a')]=function(_0xa0ab6c,_0x49ed8d){return db[_0x7ebc('0x2c')][_0x7ebc('0x4a')](_0xa0ab6c[_0x7ebc('0x4b')],{})[_0x7ebc('0x23')](function(_0x2f6cd4){var _0x4661af=_0xa0ab6c[_0x7ebc('0x4c')][_0x7ebc('0x25')]({'plain':!![]});if(!_0x4661af)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4661af['role']===_0x7ebc('0x4c')){var _0x56673a=_0x2f6cd4[_0x7ebc('0x25')]({'plain':!![]});var _0x1496d0='Scheduler';return db[_0x7ebc('0x4d')][_0x7ebc('0x49')]({'where':{'name':_0x1496d0,'userProfileId':_0x4661af[_0x7ebc('0x4e')]},'raw':!![]})['then'](function(_0x2f7088){if(_0x2f7088&&_0x2f7088[_0x7ebc('0x4f')]===0x0){return db[_0x7ebc('0x27')][_0x7ebc('0x4a')]({'name':_0x56673a[_0x7ebc('0x2a')],'resourceId':_0x56673a['id'],'type':_0x2f7088['name'],'sectionId':_0x2f7088['id']},{})[_0x7ebc('0x23')](function(){return _0x2f6cd4;});}else{return _0x2f6cd4;}})['catch'](function(_0x3fa1ff){logger[_0x7ebc('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fa1ff);throw _0x3fa1ff;});}return _0x2f6cd4;})[_0x7ebc('0x23')](respondWithResult(_0x49ed8d,0xc9))['catch'](handleError(_0x49ed8d,null));};exports['update']=function(_0x28e6c6,_0x197d33){if(_0x28e6c6[_0x7ebc('0x4b')]['id']){delete _0x28e6c6[_0x7ebc('0x4b')]['id'];}return db['Schedule'][_0x7ebc('0x49')]({'where':{'id':_0x28e6c6[_0x7ebc('0x47')]['id']}})['then'](handleEntityNotFound(_0x197d33,null))['then'](saveUpdates(_0x28e6c6[_0x7ebc('0x4b')],null))[_0x7ebc('0x23')](respondWithResult(_0x197d33,null))[_0x7ebc('0x46')](handleError(_0x197d33,null));};exports[_0x7ebc('0x24')]=function(_0x3508b6,_0x2ac0af){return db[_0x7ebc('0x2c')]['find']({'where':{'id':_0x3508b6[_0x7ebc('0x47')]['id']}})[_0x7ebc('0x23')](handleEntityNotFound(_0x2ac0af,null))[_0x7ebc('0x23')](removeEntity(_0x2ac0af,null))['catch'](handleError(_0x2ac0af,null));};exports['run']=function(_0x849339,_0x373496,_0x3d84a8){var _0x30880a=require(_0x7ebc('0x50'));return db[_0x7ebc('0x2c')][_0x7ebc('0x49')]({'where':{'id':_0x849339[_0x7ebc('0x47')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x373496,null))['then'](function(){_0x30880a[_0x7ebc('0x51')](_0x849339[_0x7ebc('0x47')]['id']);})['then'](respondWithStatusCode(_0x373496,null))[_0x7ebc('0x46')](handleError(_0x373496,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 2219fa5..9eea6c6 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 _0x917f=['./schedule.attributes','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x23dcfb,_0x3e6283){var _0x51459b=function(_0x2823f9){while(--_0x2823f9){_0x23dcfb['push'](_0x23dcfb['shift']());}};_0x51459b(++_0x3e6283);}(_0x917f,0x9e));var _0xf917=function(_0x428f98,_0x3e2485){_0x428f98=_0x428f98-0x0;var _0x2bcf39=_0x917f[_0x428f98];return _0x2bcf39;};'use strict';var _=require(_0xf917('0x0'));var util=require(_0xf917('0x1'));var logger=require(_0xf917('0x2'))(_0xf917('0x3'));var moment=require(_0xf917('0x4'));var BPromise=require(_0xf917('0x5'));var rp=require(_0xf917('0x6'));var fs=require('fs');var path=require(_0xf917('0x7'));var rimraf=require(_0xf917('0x8'));var config=require(_0xf917('0x9'));var attributes=require(_0xf917('0xa'));module['exports']=function(_0xdc2a9c,_0xff3fc9){return _0xdc2a9c[_0xf917('0xb')](_0xf917('0xc'),attributes,{'tableName':_0xf917('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b05=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Schedule','lodash','util'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x7b05,0x1ea));var _0x57b0=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x7b05[_0x3a8db5];return _0x2c03cd;};'use strict';var _=require(_0x57b0('0x0'));var util=require(_0x57b0('0x1'));var logger=require(_0x57b0('0x2'))(_0x57b0('0x3'));var moment=require(_0x57b0('0x4'));var BPromise=require(_0x57b0('0x5'));var rp=require(_0x57b0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x57b0('0x7'));var config=require(_0x57b0('0x8'));var attributes=require('./schedule.attributes');module[_0x57b0('0x9')]=function(_0x4a4add,_0x417786){return _0x4a4add[_0x57b0('0xa')](_0x57b0('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/schedule/schedule.rpc.js b/server/api/schedule/schedule.rpc.js index ff51cc1..c0cf708 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 _0xe522=['rpc','client','http','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x4aaea7,_0x2f4598){var _0x4bae83=function(_0x511513){while(--_0x511513){_0x4aaea7['push'](_0x4aaea7['shift']());}};_0x4bae83(++_0x2f4598);}(_0xe522,0xf5));var _0x2e52=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xe522[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x2e52('0x0'));var util=require(_0x2e52('0x1'));var moment=require(_0x2e52('0x2'));var BPromise=require(_0x2e52('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e52('0x4'));var db=require(_0x2e52('0x5'))['db'];var utils=require(_0x2e52('0x6'));var logger=require('../../config/logger')(_0x2e52('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e52('0x8')][_0x2e52('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x452821,_0x4f6829,_0x136db7){return new BPromise(function(_0x32086c,_0x2f7ca6){return client['request'](_0x452821,_0x136db7)[_0x2e52('0xa')](function(_0x28974e){logger[_0x2e52('0xb')](_0x2e52('0xc'),_0x4f6829,_0x2e52('0xd'));logger[_0x2e52('0xe')](_0x2e52('0xf'),_0x4f6829,'request\x20sent',JSON[_0x2e52('0x10')](_0x28974e));if(_0x28974e[_0x2e52('0x11')]){if(_0x28974e[_0x2e52('0x11')][_0x2e52('0x12')]===0x1f4){logger[_0x2e52('0x11')](_0x2e52('0xc'),_0x4f6829,_0x28974e[_0x2e52('0x11')][_0x2e52('0x13')]);return _0x2f7ca6(_0x28974e['error'][_0x2e52('0x13')]);}logger[_0x2e52('0x11')](_0x2e52('0xc'),_0x4f6829,_0x28974e[_0x2e52('0x11')]['message']);return _0x32086c(_0x28974e['error'][_0x2e52('0x13')]);}else{logger[_0x2e52('0xb')](_0x2e52('0xc'),_0x4f6829,_0x2e52('0xd'));_0x32086c(_0x28974e[_0x2e52('0x14')]['message']);}})['catch'](function(_0x44e9cd){logger[_0x2e52('0x11')](_0x2e52('0xc'),_0x4f6829,_0x44e9cd);_0x2f7ca6(_0x44e9cd);});});} \ No newline at end of file +var _0x9874=['then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2cb4c4,_0xd735e7){var _0x4026fb=function(_0x197d3b){while(--_0x197d3b){_0x2cb4c4['push'](_0x2cb4c4['shift']());}};_0x4026fb(++_0xd735e7);}(_0x9874,0x7e));var _0x4987=function(_0x29bdef,_0x2fee37){_0x29bdef=_0x29bdef-0x0;var _0x16c46e=_0x9874[_0x29bdef];return _0x16c46e;};'use strict';var _=require(_0x4987('0x0'));var util=require('util');var moment=require(_0x4987('0x1'));var BPromise=require(_0x4987('0x2'));var rs=require(_0x4987('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4987('0x4'));var logger=require(_0x4987('0x5'))(_0x4987('0x6'));var config=require(_0x4987('0x7'));var jayson=require(_0x4987('0x8'));var client=jayson[_0x4987('0x9')][_0x4987('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x979532,_0x410df2,_0xa184c8){return new BPromise(function(_0x52ff07,_0x462143){return client[_0x4987('0xb')](_0x979532,_0xa184c8)[_0x4987('0xc')](function(_0xc9b9a3){logger[_0x4987('0xd')](_0x4987('0xe'),_0x410df2,_0x4987('0xf'));logger[_0x4987('0x10')](_0x4987('0x11'),_0x410df2,'request\x20sent',JSON['stringify'](_0xc9b9a3));if(_0xc9b9a3['error']){if(_0xc9b9a3[_0x4987('0x12')][_0x4987('0x13')]===0x1f4){logger[_0x4987('0x12')](_0x4987('0xe'),_0x410df2,_0xc9b9a3[_0x4987('0x12')][_0x4987('0x14')]);return _0x462143(_0xc9b9a3[_0x4987('0x12')]['message']);}logger[_0x4987('0x12')](_0x4987('0xe'),_0x410df2,_0xc9b9a3['error'][_0x4987('0x14')]);return _0x52ff07(_0xc9b9a3[_0x4987('0x12')][_0x4987('0x14')]);}else{logger[_0x4987('0xd')](_0x4987('0xe'),_0x410df2,_0x4987('0xf'));_0x52ff07(_0xc9b9a3[_0x4987('0x15')][_0x4987('0x14')]);}})[_0x4987('0x16')](function(_0x122fcb){logger[_0x4987('0x12')]('Schedule,\x20%s,\x20%s',_0x410df2,_0x122fcb);_0x462143(_0x122fcb);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index e0905d3..96fc3d6 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 _0x0c5a=['index','/describe','show','/:id/download','download','post','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated'];(function(_0x4e82f3,_0x302c08){var _0x3a2f53=function(_0x4e8e16){while(--_0x4e8e16){_0x4e82f3['push'](_0x4e82f3['shift']());}};_0x3a2f53(++_0x302c08);}(_0x0c5a,0x1ab));var _0xa0c5=function(_0x2685a7,_0x450764){_0x2685a7=_0x2685a7-0x0;var _0x443d29=_0x0c5a[_0x2685a7];return _0x443d29;};'use strict';var multer=require('multer');var util=require(_0xa0c5('0x0'));var path=require(_0xa0c5('0x1'));var timeout=require(_0xa0c5('0x2'));var express=require(_0xa0c5('0x3'));var router=express[_0xa0c5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa0c5('0x5'));var config=require(_0xa0c5('0x6'));var controller=require(_0xa0c5('0x7'));router[_0xa0c5('0x8')]('/',auth[_0xa0c5('0x9')](),controller[_0xa0c5('0xa')]);router[_0xa0c5('0x8')](_0xa0c5('0xb'),auth[_0xa0c5('0x9')](),controller['describe']);router[_0xa0c5('0x8')]('/:id',auth[_0xa0c5('0x9')](),controller[_0xa0c5('0xc')]);router['get'](_0xa0c5('0xd'),auth[_0xa0c5('0x9')](),controller[_0xa0c5('0xe')]);router[_0xa0c5('0xf')]('/',auth[_0xa0c5('0x9')](),controller[_0xa0c5('0x10')]);router[_0xa0c5('0x11')]('/:id',auth[_0xa0c5('0x9')](),controller[_0xa0c5('0x12')]);router[_0xa0c5('0x13')](_0xa0c5('0x14'),auth[_0xa0c5('0x9')](),controller[_0xa0c5('0x15')]);module[_0xa0c5('0x16')]=router; \ No newline at end of file +var _0xe1e0=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','post','create','put','delete'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0xe1e0,0x119));var _0x0e1e=function(_0x4d8512,_0x3cf01a){_0x4d8512=_0x4d8512-0x0;var _0x70ba69=_0xe1e0[_0x4d8512];return _0x70ba69;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0e1e('0x0'));var timeout=require(_0x0e1e('0x1'));var express=require(_0x0e1e('0x2'));var router=express[_0x0e1e('0x3')]();var auth=require(_0x0e1e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0e1e('0x5'));var controller=require(_0x0e1e('0x6'));router[_0x0e1e('0x7')]('/',auth[_0x0e1e('0x8')](),controller[_0x0e1e('0x9')]);router[_0x0e1e('0x7')]('/describe',auth[_0x0e1e('0x8')](),controller[_0x0e1e('0xa')]);router['get'](_0x0e1e('0xb'),auth['isAuthenticated'](),controller[_0x0e1e('0xc')]);router[_0x0e1e('0x7')](_0x0e1e('0xd'),auth['isAuthenticated'](),controller[_0x0e1e('0xe')]);router[_0x0e1e('0xf')]('/',auth[_0x0e1e('0x8')](),controller[_0x0e1e('0x10')]);router[_0x0e1e('0x11')](_0x0e1e('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x0e1e('0x12')](_0x0e1e('0xb'),auth[_0x0e1e('0x8')](),controller['destroy']);module[_0x0e1e('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index bc54929..bebd1b4 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 _0x8958=['INTEGER','setDataValue','startedAt','subtract','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','moment','getDataValue','extname','value','STRING','replace'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x8958,0x93));var _0x8895=function(_0x5603f0,_0x47ba75){_0x5603f0=_0x5603f0-0x0;var _0x5a1f6a=_0x8958[_0x5603f0];return _0x5a1f6a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8895('0x0'));var path=require('path');var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8895('0x1')]('value')?path[_0x8895('0x2')](this[_0x8895('0x1')](_0x8895('0x3'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8895('0x4')]},'value':{'type':Sequelize[_0x8895('0x4')],'set':function(_0x124e1e){var _0x40cec6=_0x124e1e[_0x8895('0x5')](/\\/g,'/');this['setDataValue'](_0x8895('0x3'),_0x40cec6);}},'rating':{'type':Sequelize[_0x8895('0x6')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8895('0x6')],'set':function(_0x24fe49){this[_0x8895('0x7')](_0x8895('0x8'),moment()[_0x8895('0x9')](_0x24fe49,'ms'));this[_0x8895('0x7')](_0x8895('0xa'),moment());this[_0x8895('0x7')]('duration',_0x24fe49);}},'startedAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this[_0x8895('0x1')](_0x8895('0x8')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8895('0x1')](_0x8895('0xa')))[_0x8895('0xc')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this['getDataValue'](_0x8895('0xf')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}},'updatedAt':{'type':Sequelize[_0x8895('0xb')],'get':function(){return moment(this['getDataValue'](_0x8895('0x10')))[_0x8895('0xc')](_0x8895('0xd'))[_0x8895('0xe')]();}}}; \ No newline at end of file +var _0x2bd8=['sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','DATE','format','toString','MM-DD-YYYY\x20HH:mm','updatedAt'];(function(_0x519e22,_0x2ff411){var _0x106589=function(_0x28acd5){while(--_0x28acd5){_0x519e22['push'](_0x519e22['shift']());}};_0x106589(++_0x2ff411);}(_0x2bd8,0x130));var _0x82bd=function(_0x229df8,_0x36e2cf){_0x229df8=_0x229df8-0x0;var _0x543b1b=_0x2bd8[_0x229df8];return _0x543b1b;};'use strict';var Sequelize=require(_0x82bd('0x0'));var moment=require('moment');var path=require(_0x82bd('0x1'));var config=require(_0x82bd('0x2'));module[_0x82bd('0x3')]={'format':{'type':Sequelize[_0x82bd('0x4')],'get':function(){return this[_0x82bd('0x5')](_0x82bd('0x6'))?path[_0x82bd('0x7')](this['getDataValue'](_0x82bd('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x82bd('0x8')]},'channel':{'type':Sequelize[_0x82bd('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x19dbb1){var _0x77d7a9=_0x19dbb1[_0x82bd('0x9')](/\\/g,'/');this[_0x82bd('0xa')]('value',_0x77d7a9);}},'rating':{'type':Sequelize[_0x82bd('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x4a9b2c){this['setDataValue'](_0x82bd('0xc'),moment()['subtract'](_0x4a9b2c,'ms'));this['setDataValue'](_0x82bd('0xd'),moment());this['setDataValue']('duration',_0x4a9b2c);}},'startedAt':{'type':Sequelize[_0x82bd('0xe')],'get':function(){return moment(this[_0x82bd('0x5')]('startedAt'))[_0x82bd('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x82bd('0x10')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x82bd('0x5')](_0x82bd('0xd')))[_0x82bd('0xf')](_0x82bd('0x11'))['toString']();}},'createdAt':{'type':Sequelize[_0x82bd('0xe')],'get':function(){return moment(this[_0x82bd('0x5')]('createdAt'))[_0x82bd('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x82bd('0x10')]();}},'updatedAt':{'type':Sequelize[_0x82bd('0xe')],'get':function(){return moment(this[_0x82bd('0x5')](_0x82bd('0x12')))[_0x82bd('0xf')](_0x82bd('0x11'))[_0x82bd('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 5200873..7ed61f1 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 _0x979a=['../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','ScreenRecording','fieldName','key','differenceBy','format','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','rawAttributes','fields','includeAll','find','catch','create','body','duration','closedAt','value','params','describe','download','uniqueid','root','server/files/screen_recordings','existsSync','decryptFile','recording','join','filename','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','File:\x20\x22','html-pdf','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils'];(function(_0x5da27f,_0x504b76){var _0x54a3fb=function(_0x3b65a8){while(--_0x3b65a8){_0x5da27f['push'](_0x5da27f['shift']());}};_0x54a3fb(++_0x504b76);}(_0x979a,0x17c));var _0xa979=function(_0x3ae812,_0x57767f){_0x3ae812=_0x3ae812-0x0;var _0x3f6639=_0x979a[_0x3ae812];return _0x3f6639;};'use strict';var pdf=require(_0xa979('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa979('0x1'));var zipdir=require(_0xa979('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa979('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa979('0x4'));var util=require(_0xa979('0x5'));var path=require(_0xa979('0x6'));var sox=require(_0xa979('0x7'));var csv=require(_0xa979('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa979('0x9'));var squel=require(_0xa979('0xa'));var crypto=require(_0xa979('0xb'));var jsforce=require(_0xa979('0xc'));var deskjs=require(_0xa979('0xd'));var toCsv=require(_0xa979('0x8'));var querystring=require(_0xa979('0xe'));var Papa=require(_0xa979('0xf'));var Redis=require('ioredis');var authService=require(_0xa979('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa979('0x11'));var logger=require('../../config/logger')(_0xa979('0x12'));var utils=require(_0xa979('0x13'));var config=require(_0xa979('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6e7632,_0x7254fa){_0x7254fa=_0x7254fa||0xcc;return function(_0x399b64){if(_0x399b64){return _0x6e7632[_0xa979('0x15')](_0x7254fa);}return _0x6e7632[_0xa979('0x16')](_0x7254fa)[_0xa979('0x17')]();};}function respondWithResult(_0x32ae20,_0x1763a7){_0x1763a7=_0x1763a7||0xc8;return function(_0x2d2f0b){if(_0x2d2f0b){return _0x32ae20['status'](_0x1763a7)['json'](_0x2d2f0b);}};}function respondWithFilteredResult(_0x1ee766,_0x782082){return function(_0x2b2775){if(_0x2b2775){var _0x219fc4=_0x2b2775[_0xa979('0x18')],_0x8940a=_0x782082[_0xa979('0x19')],_0x3eedf0=_0x782082[_0xa979('0x19')]+_0x782082[_0xa979('0x1a')],_0x15e72d;if(_0x3eedf0>=_0x219fc4){_0x3eedf0=_0x219fc4;_0x15e72d=0xc8;}else{_0x15e72d=0xce;}_0x1ee766['status'](_0x15e72d);return _0x1ee766[_0xa979('0x1b')](_0xa979('0x1c'),_0x8940a+'-'+_0x3eedf0+'/'+_0x219fc4)[_0xa979('0x1d')](_0x2b2775);}return null;};}function patchUpdates(_0x4ca754){return function(_0x3e0c02){try{jsonpatch['apply'](_0x3e0c02,_0x4ca754,!![]);}catch(_0x22c558){return BPromise[_0xa979('0x1e')](_0x22c558);}return _0x3e0c02[_0xa979('0x1f')]();};}function saveUpdates(_0x2b9fd7,_0x250c8e){return function(_0x31027a){if(_0x31027a){return _0x31027a[_0xa979('0x20')](_0x2b9fd7)[_0xa979('0x21')](function(_0x311555){return _0x311555;});}return null;};}function removeEntity(_0x1c548c,_0x47b823){return function(_0x289ec7){if(_0x289ec7){return _0x289ec7[_0xa979('0x22')]()[_0xa979('0x21')](function(){_0x1c548c[_0xa979('0x16')](0xcc)[_0xa979('0x17')]();});}};}function handleEntityNotFound(_0x388ee4,_0x1c0f64){return function(_0x372614){if(!_0x372614){_0x388ee4[_0xa979('0x15')](0x194);}return _0x372614;};}function handleError(_0x251a49,_0x114d1d){_0x114d1d=_0x114d1d||0x1f4;return function(_0x30c2e3){logger[_0xa979('0x23')](_0x30c2e3[_0xa979('0x24')]);if(_0x30c2e3[_0xa979('0x25')]){delete _0x30c2e3[_0xa979('0x25')];}_0x251a49[_0xa979('0x16')](_0x114d1d)[_0xa979('0x26')](_0x30c2e3);};}exports[_0xa979('0x27')]=function(_0x1519f9,_0x59e61f){var _0x2d747c={},_0x1eaa3d={},_0x4ee825={'count':0x0,'rows':[]};var _0x546671=_[_0xa979('0x28')](db[_0xa979('0x29')]['rawAttributes'],function(_0x4b9342){return{'name':_0x4b9342[_0xa979('0x2a')],'type':_0x4b9342['type'][_0xa979('0x2b')]};});_0x1eaa3d['model']=_[_0xa979('0x2c')](_[_0xa979('0x28')](_0x546671,_0xa979('0x25')),[_0xa979('0x2d')]);_0x1eaa3d[_0xa979('0x2e')]=_[_0xa979('0x2f')](_0x1519f9[_0xa979('0x2e')]);_0x1eaa3d[_0xa979('0x30')]=_[_0xa979('0x31')](_0x1eaa3d[_0xa979('0x32')],_0x1eaa3d[_0xa979('0x2e')]);_0x2d747c[_0xa979('0x33')]=_[_0xa979('0x31')](_0x1eaa3d[_0xa979('0x32')],qs['fields'](_0x1519f9['query']['fields']));_0x2d747c[_0xa979('0x33')]=_0x2d747c[_0xa979('0x33')][_0xa979('0x34')]?_0x2d747c[_0xa979('0x33')]:_0x1eaa3d[_0xa979('0x32')];if(!_0x1519f9['query'][_0xa979('0x35')](_0xa979('0x36'))){_0x2d747c[_0xa979('0x1a')]=qs[_0xa979('0x1a')](_0x1519f9[_0xa979('0x2e')][_0xa979('0x1a')]);_0x2d747c[_0xa979('0x19')]=qs[_0xa979('0x19')](_0x1519f9[_0xa979('0x2e')]['offset']);}_0x2d747c[_0xa979('0x37')]=qs[_0xa979('0x38')](_0x1519f9[_0xa979('0x2e')][_0xa979('0x38')]);_0x2d747c[_0xa979('0x39')]=qs['filters'](_[_0xa979('0x3a')](_0x1519f9[_0xa979('0x2e')],_0x1eaa3d[_0xa979('0x30')]));if(_0x1519f9[_0xa979('0x2e')][_0xa979('0x3b')]){_0x2d747c[_0xa979('0x39')]=_['merge'](_0x2d747c[_0xa979('0x39')],{'$or':_[_0xa979('0x28')](_0x546671,function(_0x177ff4){if(_0x177ff4[_0xa979('0x3c')]!==_0xa979('0x3d')){var _0x352c08={};_0x352c08[_0x177ff4[_0xa979('0x25')]]={'$like':'%'+_0x1519f9[_0xa979('0x2e')]['filter']+'%'};return _0x352c08;}})});}_0x2d747c=_[_0xa979('0x3e')]({},_0x2d747c,_0x1519f9[_0xa979('0x3f')]);var _0x3b88de={'where':_0x2d747c[_0xa979('0x39')]};return db[_0xa979('0x29')][_0xa979('0x18')](_0x3b88de)[_0xa979('0x21')](function(_0x5e6bbf){_0x4ee825[_0xa979('0x18')]=_0x5e6bbf;if(_0x1519f9[_0xa979('0x2e')]['includeAll']){_0x2d747c[_0xa979('0x40')]=[{'all':!![]}];}return db[_0xa979('0x29')][_0xa979('0x41')](_0x2d747c);})[_0xa979('0x21')](function(_0x5ec28a){_0x4ee825[_0xa979('0x42')]=_0x5ec28a;return _0x4ee825;})['then'](respondWithFilteredResult(_0x59e61f,_0x2d747c))['catch'](handleError(_0x59e61f,null));};exports[_0xa979('0x43')]=function(_0x3a7527,_0x56ea63){var _0x194c13={'raw':![],'where':{'id':_0x3a7527['params']['id']}},_0xca0b62={};_0xca0b62[_0xa979('0x32')]=_[_0xa979('0x2f')](db[_0xa979('0x29')][_0xa979('0x44')]);_0xca0b62[_0xa979('0x2e')]=_[_0xa979('0x2f')](_0x3a7527[_0xa979('0x2e')]);_0xca0b62[_0xa979('0x30')]=_[_0xa979('0x31')](_0xca0b62['model'],_0xca0b62['query']);_0x194c13['attributes']=_[_0xa979('0x31')](_0xca0b62['model'],qs['fields'](_0x3a7527[_0xa979('0x2e')][_0xa979('0x45')]));_0x194c13[_0xa979('0x33')]=_0x194c13[_0xa979('0x33')][_0xa979('0x34')]?_0x194c13[_0xa979('0x33')]:_0xca0b62[_0xa979('0x32')];if(_0x3a7527['query'][_0xa979('0x46')]){_0x194c13[_0xa979('0x40')]=[{'all':!![]}];}_0x194c13=_['merge']({},_0x194c13,_0x3a7527[_0xa979('0x3f')]);return db['ScreenRecording'][_0xa979('0x47')](_0x194c13)['then'](handleEntityNotFound(_0x56ea63,null))['then'](respondWithResult(_0x56ea63,null))[_0xa979('0x48')](handleError(_0x56ea63,null));};exports[_0xa979('0x49')]=function(_0x1b8845,_0x448af8){return db[_0xa979('0x29')]['create'](_0x1b8845['body'],{})['then'](respondWithResult(_0x448af8,0xc9))[_0xa979('0x48')](handleError(_0x448af8,null));};exports[_0xa979('0x20')]=function(_0x4b536e,_0x77e56d){if(_0x4b536e['body']['id']){delete _0x4b536e['body']['id'];}delete _0x4b536e[_0xa979('0x4a')][_0xa979('0x4b')];delete _0x4b536e[_0xa979('0x4a')]['createdAt'];delete _0x4b536e['body'][_0xa979('0x4c')];delete _0x4b536e['body'][_0xa979('0x4d')];return db[_0xa979('0x29')][_0xa979('0x47')]({'where':{'id':_0x4b536e[_0xa979('0x4e')]['id']}})['then'](handleEntityNotFound(_0x77e56d,null))['then'](saveUpdates(_0x4b536e['body'],null))['then'](respondWithResult(_0x77e56d,null))[_0xa979('0x48')](handleError(_0x77e56d,null));};exports[_0xa979('0x4f')]=function(_0x16817d,_0x22e85a){return db['ScreenRecording'][_0xa979('0x4f')]()[_0xa979('0x21')](respondWithResult(_0x22e85a,null))[_0xa979('0x48')](handleError(_0x22e85a,null));};exports[_0xa979('0x50')]=function(_0x3c1a7e,_0x20cb8a,_0x32c8df){var _0x379e0b=require('../../components/encryptor');var _0x580edc=![];var _0x4c0823={};if(_0x3c1a7e[_0xa979('0x2e')][_0xa979('0x3c')]&&_0x3c1a7e[_0xa979('0x2e')][_0xa979('0x3c')]===_0xa979('0x51')){_0x4c0823[_0xa979('0x51')]=_0x3c1a7e[_0xa979('0x4e')]['id'];}else{_0x4c0823['id']=_0x3c1a7e[_0xa979('0x4e')]['id'];}return db[_0xa979('0x29')][_0xa979('0x47')]({'where':_0x4c0823,'attributes':['id','value'],'raw':!![]})[_0xa979('0x21')](handleEntityNotFound(_0x20cb8a,null))['then'](function(_0x28f6cb){if(_0x28f6cb){var _0x3f560d=path['join'](config[_0xa979('0x52')],_0xa979('0x53'),_0x28f6cb[_0xa979('0x4d')]);var _0x178de4=util[_0xa979('0x2d')]('%s.cypher',_0x3f560d);if(fs[_0xa979('0x54')](_0x178de4)){_0x580edc=!![];return _0x379e0b[_0xa979('0x55')](_0x178de4,_0x3f560d,config['secrets'][_0xa979('0x56')])[_0xa979('0x21')](function(){return _0x28f6cb;});}return _0x28f6cb;}})[_0xa979('0x21')](function(_0x21cf28){if(_0x21cf28){var _0x22f87c=path[_0xa979('0x57')](config[_0xa979('0x52')],_0xa979('0x53'),_0x21cf28[_0xa979('0x4d')]);if(!fs[_0xa979('0x54')](_0x22f87c)){throw new db['Sequelize']['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x21cf28[_0xa979('0x58')]){return _0x20cb8a[_0xa979('0x50')](_0x22f87c,_0x21cf28[_0xa979('0x58')]+path['extname'](_0x22f87c),function(){if(_0x580edc){fs[_0xa979('0x59')](_0x22f87c);}});}else{return _0x20cb8a[_0xa979('0x50')](_0x22f87c,function(_0x5984a1){if(_0x580edc){fs[_0xa979('0x59')](_0x22f87c);}});}}})[_0xa979('0x48')](function(_0x26f3a9){if(_0x26f3a9[_0xa979('0x5a')]==='ScreenRecording\x20not\x20found'){_0x20cb8a[_0xa979('0x16')](0x194)['send'](_0xa979('0x5b'));}else{return handleError(_0x20cb8a,null);}});};exports['destroy']=function(_0x84ca3c,_0x4c175e){return db[_0xa979('0x29')][_0xa979('0x47')]({'where':{'id':_0x84ca3c[_0xa979('0x4e')]['id']}})[_0xa979('0x21')](function(_0x5326ab){if(!_0x5326ab)throw new ReferenceError(_0xa979('0x5c'));return _0x5326ab;})[_0xa979('0x21')](function(_0x5a743a){var _0x548128=path[_0xa979('0x57')](config[_0xa979('0x52')],_0xa979('0x53'),_0x5a743a[_0xa979('0x4d')]);logger[_0xa979('0x5d')](_0xa979('0x5e'),_0x548128);if(!_['isNil'](_0x5a743a[_0xa979('0x4d')])&&fs[_0xa979('0x54')](_0x548128)){logger['info']('File:\x20\x22'+_0x548128+_0xa979('0x5f'));fs[_0xa979('0x60')](_0x548128);}_0x548128=_0x548128+_0xa979('0x61');if(!_[_0xa979('0x62')](_0x5a743a[_0xa979('0x4d')])&&fs[_0xa979('0x54')](_0x548128)){logger['info'](_0xa979('0x63')+_0x548128+_0xa979('0x5f'));fs[_0xa979('0x60')](_0x548128);}return _0x5a743a;})[_0xa979('0x21')](function(_0x3512e3){if(!_0x3512e3)throw new InternalError();return _0x3512e3[_0xa979('0x22')]();})['then'](function(){_0x4c175e[_0xa979('0x16')](0xcc)[_0xa979('0x17')]();})[_0xa979('0x48')](handleError(_0x4c175e,null));}; \ No newline at end of file +var _0x5cf7=['rows','catch','show','params','intersection','find','create','body','duration','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','%s.cypher','secrets','recording','server/files/screen_recordings','Sequelize','download','filename','unlink','ScreenRecording\x20not\x20found','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','existsSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','map','rawAttributes','type','key','model','format','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','ScreenRecording','findAll'];(function(_0x3c487b,_0x44c5e2){var _0x1d65f6=function(_0x135e6d){while(--_0x135e6d){_0x3c487b['push'](_0x3c487b['shift']());}};_0x1d65f6(++_0x44c5e2);}(_0x5cf7,0x87));var _0x75cf=function(_0x308c3a,_0xe692e5){_0x308c3a=_0x308c3a-0x0;var _0x44e011=_0x5cf7[_0x308c3a];return _0x44e011;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x75cf('0x0'));var rimraf=require(_0x75cf('0x1'));var zipdir=require(_0x75cf('0x2'));var jsonpatch=require(_0x75cf('0x3'));var rp=require(_0x75cf('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x75cf('0x5'));var util=require(_0x75cf('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x75cf('0x7'));var squel=require(_0x75cf('0x8'));var crypto=require(_0x75cf('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x75cf('0xa'));var toCsv=require(_0x75cf('0xb'));var querystring=require(_0x75cf('0xc'));var Papa=require(_0x75cf('0xd'));var Redis=require(_0x75cf('0xe'));var authService=require(_0x75cf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x75cf('0x10'));var hardwareService=require(_0x75cf('0x11'));var logger=require(_0x75cf('0x12'))(_0x75cf('0x13'));var utils=require('../../config/utils');var config=require(_0x75cf('0x14'));var db=require(_0x75cf('0x15'))['db'];function respondWithStatusCode(_0x4d01df,_0x5e8df0){_0x5e8df0=_0x5e8df0||0xcc;return function(_0x5bbc76){if(_0x5bbc76){return _0x4d01df[_0x75cf('0x16')](_0x5e8df0);}return _0x4d01df[_0x75cf('0x17')](_0x5e8df0)['end']();};}function respondWithResult(_0x329e14,_0x159cf9){_0x159cf9=_0x159cf9||0xc8;return function(_0x58a8bf){if(_0x58a8bf){return _0x329e14[_0x75cf('0x17')](_0x159cf9)[_0x75cf('0x18')](_0x58a8bf);}};}function respondWithFilteredResult(_0x3dd0d0,_0x15afad){return function(_0x3b6624){if(_0x3b6624){var _0x26a34c=_0x3b6624[_0x75cf('0x19')],_0x52d8eb=_0x15afad[_0x75cf('0x1a')],_0x470499=_0x15afad[_0x75cf('0x1a')]+_0x15afad[_0x75cf('0x1b')],_0x5788b7;if(_0x470499>=_0x26a34c){_0x470499=_0x26a34c;_0x5788b7=0xc8;}else{_0x5788b7=0xce;}_0x3dd0d0[_0x75cf('0x17')](_0x5788b7);return _0x3dd0d0['set'](_0x75cf('0x1c'),_0x52d8eb+'-'+_0x470499+'/'+_0x26a34c)['json'](_0x3b6624);}return null;};}function patchUpdates(_0x860307){return function(_0x47e6db){try{jsonpatch[_0x75cf('0x1d')](_0x47e6db,_0x860307,!![]);}catch(_0x20d5ed){return BPromise[_0x75cf('0x1e')](_0x20d5ed);}return _0x47e6db['save']();};}function saveUpdates(_0x3cf26c,_0x2d3238){return function(_0x147de7){if(_0x147de7){return _0x147de7[_0x75cf('0x1f')](_0x3cf26c)['then'](function(_0x138b26){return _0x138b26;});}return null;};}function removeEntity(_0x5121b5,_0x3b1f79){return function(_0x22fde6){if(_0x22fde6){return _0x22fde6['destroy']()[_0x75cf('0x20')](function(){_0x5121b5[_0x75cf('0x17')](0xcc)[_0x75cf('0x21')]();});}};}function handleEntityNotFound(_0x2a995e,_0x1a3d33){return function(_0xaad22f){if(!_0xaad22f){_0x2a995e[_0x75cf('0x16')](0x194);}return _0xaad22f;};}function handleError(_0x1919e3,_0x39a346){_0x39a346=_0x39a346||0x1f4;return function(_0x592174){logger[_0x75cf('0x22')](_0x592174[_0x75cf('0x23')]);if(_0x592174['name']){delete _0x592174[_0x75cf('0x24')];}_0x1919e3[_0x75cf('0x17')](_0x39a346)[_0x75cf('0x25')](_0x592174);};}exports[_0x75cf('0x26')]=function(_0x565ea2,_0x413e79){var _0x9cf48b={},_0x24ea87={},_0x2573ff={'count':0x0,'rows':[]};var _0xd0fd51=_[_0x75cf('0x27')](db['ScreenRecording'][_0x75cf('0x28')],function(_0x2ba8b2){return{'name':_0x2ba8b2['fieldName'],'type':_0x2ba8b2[_0x75cf('0x29')][_0x75cf('0x2a')]};});_0x24ea87[_0x75cf('0x2b')]=_['differenceBy'](_[_0x75cf('0x27')](_0xd0fd51,'name'),[_0x75cf('0x2c')]);_0x24ea87[_0x75cf('0x2d')]=_[_0x75cf('0x2e')](_0x565ea2[_0x75cf('0x2d')]);_0x24ea87[_0x75cf('0x2f')]=_['intersection'](_0x24ea87[_0x75cf('0x2b')],_0x24ea87[_0x75cf('0x2d')]);_0x9cf48b[_0x75cf('0x30')]=_['intersection'](_0x24ea87['model'],qs['fields'](_0x565ea2[_0x75cf('0x2d')][_0x75cf('0x31')]));_0x9cf48b[_0x75cf('0x30')]=_0x9cf48b[_0x75cf('0x30')][_0x75cf('0x32')]?_0x9cf48b[_0x75cf('0x30')]:_0x24ea87[_0x75cf('0x2b')];if(!_0x565ea2[_0x75cf('0x2d')][_0x75cf('0x33')]('nolimit')){_0x9cf48b[_0x75cf('0x1b')]=qs[_0x75cf('0x1b')](_0x565ea2['query'][_0x75cf('0x1b')]);_0x9cf48b[_0x75cf('0x1a')]=qs['offset'](_0x565ea2[_0x75cf('0x2d')][_0x75cf('0x1a')]);}_0x9cf48b['order']=qs['sort'](_0x565ea2[_0x75cf('0x2d')][_0x75cf('0x34')]);_0x9cf48b[_0x75cf('0x35')]=qs[_0x75cf('0x2f')](_[_0x75cf('0x36')](_0x565ea2[_0x75cf('0x2d')],_0x24ea87[_0x75cf('0x2f')]));if(_0x565ea2[_0x75cf('0x2d')]['filter']){_0x9cf48b[_0x75cf('0x35')]=_[_0x75cf('0x37')](_0x9cf48b['where'],{'$or':_['map'](_0xd0fd51,function(_0x6604f9){if(_0x6604f9[_0x75cf('0x29')]!==_0x75cf('0x38')){var _0x46a73d={};_0x46a73d[_0x6604f9[_0x75cf('0x24')]]={'$like':'%'+_0x565ea2[_0x75cf('0x2d')][_0x75cf('0x39')]+'%'};return _0x46a73d;}})});}_0x9cf48b=_[_0x75cf('0x37')]({},_0x9cf48b,_0x565ea2[_0x75cf('0x3a')]);var _0x50e1e8={'where':_0x9cf48b[_0x75cf('0x35')]};return db['ScreenRecording'][_0x75cf('0x19')](_0x50e1e8)[_0x75cf('0x20')](function(_0xea1f2b){_0x2573ff[_0x75cf('0x19')]=_0xea1f2b;if(_0x565ea2[_0x75cf('0x2d')][_0x75cf('0x3b')]){_0x9cf48b[_0x75cf('0x3c')]=[{'all':!![]}];}return db[_0x75cf('0x3d')][_0x75cf('0x3e')](_0x9cf48b);})['then'](function(_0x297324){_0x2573ff[_0x75cf('0x3f')]=_0x297324;return _0x2573ff;})[_0x75cf('0x20')](respondWithFilteredResult(_0x413e79,_0x9cf48b))[_0x75cf('0x40')](handleError(_0x413e79,null));};exports[_0x75cf('0x41')]=function(_0x2ff8c0,_0x2c4b77){var _0x34e529={'raw':![],'where':{'id':_0x2ff8c0[_0x75cf('0x42')]['id']}},_0x4ef086={};_0x4ef086[_0x75cf('0x2b')]=_[_0x75cf('0x2e')](db[_0x75cf('0x3d')]['rawAttributes']);_0x4ef086[_0x75cf('0x2d')]=_[_0x75cf('0x2e')](_0x2ff8c0[_0x75cf('0x2d')]);_0x4ef086['filters']=_[_0x75cf('0x43')](_0x4ef086[_0x75cf('0x2b')],_0x4ef086['query']);_0x34e529[_0x75cf('0x30')]=_[_0x75cf('0x43')](_0x4ef086[_0x75cf('0x2b')],qs[_0x75cf('0x31')](_0x2ff8c0['query'][_0x75cf('0x31')]));_0x34e529[_0x75cf('0x30')]=_0x34e529[_0x75cf('0x30')][_0x75cf('0x32')]?_0x34e529['attributes']:_0x4ef086['model'];if(_0x2ff8c0['query'][_0x75cf('0x3b')]){_0x34e529[_0x75cf('0x3c')]=[{'all':!![]}];}_0x34e529=_['merge']({},_0x34e529,_0x2ff8c0['options']);return db[_0x75cf('0x3d')][_0x75cf('0x44')](_0x34e529)[_0x75cf('0x20')](handleEntityNotFound(_0x2c4b77,null))[_0x75cf('0x20')](respondWithResult(_0x2c4b77,null))[_0x75cf('0x40')](handleError(_0x2c4b77,null));};exports[_0x75cf('0x45')]=function(_0x30db0c,_0x13ad32){return db[_0x75cf('0x3d')]['create'](_0x30db0c['body'],{})[_0x75cf('0x20')](respondWithResult(_0x13ad32,0xc9))[_0x75cf('0x40')](handleError(_0x13ad32,null));};exports[_0x75cf('0x1f')]=function(_0x4b0e83,_0x2fdaca){if(_0x4b0e83[_0x75cf('0x46')]['id']){delete _0x4b0e83[_0x75cf('0x46')]['id'];}delete _0x4b0e83['body'][_0x75cf('0x47')];delete _0x4b0e83[_0x75cf('0x46')]['createdAt'];delete _0x4b0e83['body'][_0x75cf('0x48')];delete _0x4b0e83[_0x75cf('0x46')][_0x75cf('0x49')];return db[_0x75cf('0x3d')][_0x75cf('0x44')]({'where':{'id':_0x4b0e83[_0x75cf('0x42')]['id']}})[_0x75cf('0x20')](handleEntityNotFound(_0x2fdaca,null))[_0x75cf('0x20')](saveUpdates(_0x4b0e83['body'],null))[_0x75cf('0x20')](respondWithResult(_0x2fdaca,null))['catch'](handleError(_0x2fdaca,null));};exports[_0x75cf('0x4a')]=function(_0x287e87,_0x4645ac){return db[_0x75cf('0x3d')][_0x75cf('0x4a')]()['then'](respondWithResult(_0x4645ac,null))[_0x75cf('0x40')](handleError(_0x4645ac,null));};exports['download']=function(_0x2b0bef,_0x2f61ce,_0x49b7ae){var _0x367748=require(_0x75cf('0x4b'));var _0x1ae1ce=![];var _0x36fa3c={};if(_0x2b0bef[_0x75cf('0x2d')][_0x75cf('0x29')]&&_0x2b0bef[_0x75cf('0x2d')]['type']===_0x75cf('0x4c')){_0x36fa3c[_0x75cf('0x4c')]=_0x2b0bef[_0x75cf('0x42')]['id'];}else{_0x36fa3c['id']=_0x2b0bef['params']['id'];}return db[_0x75cf('0x3d')][_0x75cf('0x44')]({'where':_0x36fa3c,'attributes':['id','value'],'raw':!![]})[_0x75cf('0x20')](handleEntityNotFound(_0x2f61ce,null))[_0x75cf('0x20')](function(_0x5f44fc){if(_0x5f44fc){var _0x377e18=path[_0x75cf('0x4d')](config[_0x75cf('0x4e')],'server/files/screen_recordings',_0x5f44fc['value']);var _0xa5b4db=util[_0x75cf('0x2c')](_0x75cf('0x4f'),_0x377e18);if(fs['existsSync'](_0xa5b4db)){_0x1ae1ce=!![];return _0x367748['decryptFile'](_0xa5b4db,_0x377e18,config[_0x75cf('0x50')][_0x75cf('0x51')])['then'](function(){return _0x5f44fc;});}return _0x5f44fc;}})['then'](function(_0x5c9c2f){if(_0x5c9c2f){var _0x2b4c17=path[_0x75cf('0x4d')](config['root'],_0x75cf('0x52'),_0x5c9c2f[_0x75cf('0x49')]);if(!fs['existsSync'](_0x2b4c17)){throw new db[(_0x75cf('0x53'))]['ValidationError']('ScreenRecording\x20not\x20found');}if(_0x5c9c2f['filename']){return _0x2f61ce[_0x75cf('0x54')](_0x2b4c17,_0x5c9c2f[_0x75cf('0x55')]+path['extname'](_0x2b4c17),function(){if(_0x1ae1ce){fs[_0x75cf('0x56')](_0x2b4c17);}});}else{return _0x2f61ce[_0x75cf('0x54')](_0x2b4c17,function(_0x947a3a){if(_0x1ae1ce){fs[_0x75cf('0x56')](_0x2b4c17);}});}}})[_0x75cf('0x40')](function(_0x419231){if(_0x419231['message']===_0x75cf('0x57')){_0x2f61ce[_0x75cf('0x17')](0x194)[_0x75cf('0x25')](_0x75cf('0x58'));}else{return handleError(_0x2f61ce,null);}});};exports[_0x75cf('0x59')]=function(_0x26ea69,_0x1eb9b9){return db[_0x75cf('0x3d')][_0x75cf('0x44')]({'where':{'id':_0x26ea69[_0x75cf('0x42')]['id']}})[_0x75cf('0x20')](function(_0x5331f4){if(!_0x5331f4)throw new ReferenceError(_0x75cf('0x5a'));return _0x5331f4;})['then'](function(_0x4b72f3){var _0x597ba5=path['join'](config[_0x75cf('0x4e')],_0x75cf('0x52'),_0x4b72f3[_0x75cf('0x49')]);logger[_0x75cf('0x5b')](_0x75cf('0x5c'),_0x597ba5);if(!_[_0x75cf('0x5d')](_0x4b72f3[_0x75cf('0x49')])&&fs[_0x75cf('0x5e')](_0x597ba5)){logger[_0x75cf('0x5b')]('File:\x20\x22'+_0x597ba5+_0x75cf('0x5f'));fs[_0x75cf('0x60')](_0x597ba5);}_0x597ba5=_0x597ba5+_0x75cf('0x61');if(!_['isNil'](_0x4b72f3['value'])&&fs['existsSync'](_0x597ba5)){logger[_0x75cf('0x5b')](_0x75cf('0x62')+_0x597ba5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x597ba5);}return _0x4b72f3;})[_0x75cf('0x20')](function(_0x564a74){if(!_0x564a74)throw new InternalError();return _0x564a74[_0x75cf('0x59')]();})[_0x75cf('0x20')](function(){_0x1eb9b9[_0x75cf('0x17')](0xcc)[_0x75cf('0x21')]();})['catch'](handleError(_0x1eb9b9,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 803698d..0131545 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 _0xddaf=['api','moment','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger'];(function(_0x22d606,_0x274cdd){var _0x2b03d0=function(_0x4aa4d7){while(--_0x4aa4d7){_0x22d606['push'](_0x22d606['shift']());}};_0x2b03d0(++_0x274cdd);}(_0xddaf,0x15b));var _0xfdda=function(_0x1f6c20,_0x12bd9e){_0x1f6c20=_0x1f6c20-0x0;var _0x1ab1e9=_0xddaf[_0x1f6c20];return _0x1ab1e9;};'use strict';var _=require(_0xfdda('0x0'));var util=require(_0xfdda('0x1'));var logger=require(_0xfdda('0x2'))(_0xfdda('0x3'));var moment=require(_0xfdda('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfdda('0x5'));var rimraf=require(_0xfdda('0x6'));var config=require(_0xfdda('0x7'));var attributes=require(_0xfdda('0x8'));module[_0xfdda('0x9')]=function(_0x455dba,_0x5ddbc1){return _0x455dba[_0xfdda('0xa')](_0xfdda('0xb'),attributes,{'tableName':_0xfdda('0xc'),'paranoid':![],'indexes':[{'name':_0xfdda('0xd'),'fields':[_0xfdda('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3641=['path','rimraf','../../config/environment','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e0144,_0x1528e3){var _0x172a14=function(_0x3ab22e){while(--_0x3ab22e){_0x1e0144['push'](_0x1e0144['shift']());}};_0x172a14(++_0x1528e3);}(_0x3641,0xc9));var _0x1364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3641[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1364('0x0'));var util=require(_0x1364('0x1'));var logger=require(_0x1364('0x2'))(_0x1364('0x3'));var moment=require(_0x1364('0x4'));var BPromise=require(_0x1364('0x5'));var rp=require(_0x1364('0x6'));var fs=require('fs');var path=require(_0x1364('0x7'));var rimraf=require(_0x1364('0x8'));var config=require(_0x1364('0x9'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x223e20,_0xf14d99){return _0x223e20['define'](_0x1364('0xa'),attributes,{'tableName':_0x1364('0xb'),'paranoid':![],'indexes':[{'name':_0x1364('0xc'),'fields':[_0x1364('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index eccbb64..0c0babb 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(_0x20c9ce,_0x428ee7){var _0xd158a1=function(_0x9db3c4){while(--_0x9db3c4){_0x20c9ce['push'](_0x20c9ce['shift']());}};_0xd158a1(++_0x428ee7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x297563,_0x5f2a2a){var _0x24e0c5=function(_0x220e16){while(--_0x220e16){_0x297563['push'](_0x297563['shift']());}};_0x24e0c5(++_0x5f2a2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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 828e557..b70b564 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 _0x2208=['/:id/gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','root','format','%s%s','logo','extname','originalname','post','addLogo','join','logologin','single','file','server/files/images/logos/','preferred','addFavicon','put','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/logo','/:id/logo_login','getLogoLogin'];(function(_0x4efb56,_0x1ef9b0){var _0x4daf4e=function(_0x34681f){while(--_0x34681f){_0x4efb56['push'](_0x4efb56['shift']());}};_0x4daf4e(++_0x1ef9b0);}(_0x2208,0x1c4));var _0x8220=function(_0x55aa3f,_0x3bf6bc){_0x55aa3f=_0x55aa3f-0x0;var _0x2c9fdc=_0x2208[_0x55aa3f];return _0x2c9fdc;};'use strict';var multer=require(_0x8220('0x0'));var util=require(_0x8220('0x1'));var path=require(_0x8220('0x2'));var timeout=require(_0x8220('0x3'));var express=require(_0x8220('0x4'));var router=express[_0x8220('0x5')]();var auth=require(_0x8220('0x6'));var interaction=require(_0x8220('0x7'));var config=require(_0x8220('0x8'));var controller=require('./setting.controller');router[_0x8220('0x9')]('/',auth[_0x8220('0xa')](),controller[_0x8220('0xb')]);router[_0x8220('0x9')](_0x8220('0xc'),controller['show']);router['get'](_0x8220('0xd'),controller['getLogo']);router[_0x8220('0x9')](_0x8220('0xe'),controller[_0x8220('0xf')]);router[_0x8220('0x9')](_0x8220('0x10'),controller['gdpr']);router[_0x8220('0x9')](_0x8220('0x11'),controller['getPreferred']);router[_0x8220('0x9')](_0x8220('0x12'),controller[_0x8220('0x13')]);var upload=multer({'storage':multer[_0x8220('0x14')]({'destination':function(_0x434137,_0x5495ec,_0x53c963){_0x53c963(null,path['join'](config[_0x8220('0x15')],'server/files/images/logos/'));},'filename':function(_0xc7f229,_0x5a106a,_0x426175){_0x426175(null,util[_0x8220('0x16')](_0x8220('0x17'),_0x8220('0x18'),path[_0x8220('0x19')](_0x5a106a[_0x8220('0x1a')])));}})});router[_0x8220('0x1b')](_0x8220('0xd'),upload['single']('file'),controller[_0x8220('0x1c')]);var upload=multer({'storage':multer[_0x8220('0x14')]({'destination':function(_0x3499f8,_0x14ef93,_0x23576b){_0x23576b(null,path[_0x8220('0x1d')](config[_0x8220('0x15')],'server/files/images/logos/'));},'filename':function(_0x4cbd20,_0x485b00,_0x1f444f){_0x1f444f(null,util[_0x8220('0x16')](_0x8220('0x17'),_0x8220('0x1e'),path[_0x8220('0x19')](_0x485b00[_0x8220('0x1a')])));}})});router[_0x8220('0x1b')](_0x8220('0xe'),upload[_0x8220('0x1f')](_0x8220('0x20')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x8220('0x14')]({'destination':function(_0x2a2c7c,_0x1debe0,_0x2f4943){_0x2f4943(null,path['join'](config[_0x8220('0x15')],_0x8220('0x21')));},'filename':function(_0x26dc21,_0x578d4f,_0xf5a2cf){_0xf5a2cf(null,util[_0x8220('0x16')](_0x8220('0x17'),_0x8220('0x22'),path[_0x8220('0x19')](_0x578d4f[_0x8220('0x1a')])));}})});router[_0x8220('0x1b')]('/:id/preferred',upload['single']('file'),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1e662c,_0x7389a0,_0x3c1582){_0x3c1582(null,path[_0x8220('0x1d')](config[_0x8220('0x15')],'server/files/images/logos/'));},'filename':function(_0x3e5958,_0x52f0f3,_0x55a50a){_0x55a50a(null,util[_0x8220('0x16')](_0x8220('0x17'),'favicon',path[_0x8220('0x19')](_0x52f0f3[_0x8220('0x1a')])));}})});router[_0x8220('0x1b')]('/:id/favicon',upload[_0x8220('0x1f')](_0x8220('0x20')),controller[_0x8220('0x23')]);router[_0x8220('0x24')](_0x8220('0xc'),auth[_0x8220('0xa')](),controller[_0x8220('0x25')]);module[_0x8220('0x26')]=router; \ No newline at end of file +var _0x366c=['getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','file','addLogo','diskStorage','logologin','single','addLogoLogin','preferred','favicon','addFavicon','put','update','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','show','/:id/logo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x366c,0xf4));var _0xc366=function(_0x416878,_0x5b41e7){_0x416878=_0x416878-0x0;var _0x50d256=_0x366c[_0x416878];return _0x50d256;};'use strict';var multer=require(_0xc366('0x0'));var util=require(_0xc366('0x1'));var path=require('path');var timeout=require(_0xc366('0x2'));var express=require(_0xc366('0x3'));var router=express[_0xc366('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc366('0x5'));var config=require(_0xc366('0x6'));var controller=require(_0xc366('0x7'));router[_0xc366('0x8')]('/',auth[_0xc366('0x9')](),controller[_0xc366('0xa')]);router[_0xc366('0x8')](_0xc366('0xb'),controller[_0xc366('0xc')]);router[_0xc366('0x8')](_0xc366('0xd'),controller[_0xc366('0xe')]);router['get'](_0xc366('0xf'),controller[_0xc366('0x10')]);router[_0xc366('0x8')](_0xc366('0x11'),controller[_0xc366('0x12')]);router[_0xc366('0x8')]('/:id/preferred',controller[_0xc366('0x13')]);router['get'](_0xc366('0x14'),controller[_0xc366('0x15')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x507211,_0x1ca43c,_0x5cafd3){_0x5cafd3(null,path[_0xc366('0x16')](config[_0xc366('0x17')],_0xc366('0x18')));},'filename':function(_0x336762,_0x3d6479,_0x36c550){_0x36c550(null,util[_0xc366('0x19')](_0xc366('0x1a'),_0xc366('0x1b'),path[_0xc366('0x1c')](_0x3d6479[_0xc366('0x1d')])));}})});router[_0xc366('0x1e')](_0xc366('0xd'),upload['single'](_0xc366('0x1f')),controller[_0xc366('0x20')]);var upload=multer({'storage':multer[_0xc366('0x21')]({'destination':function(_0x19951c,_0x226a74,_0x53a682){_0x53a682(null,path['join'](config[_0xc366('0x17')],_0xc366('0x18')));},'filename':function(_0xe18839,_0xede9b2,_0x5eeb5e){_0x5eeb5e(null,util[_0xc366('0x19')](_0xc366('0x1a'),_0xc366('0x22'),path[_0xc366('0x1c')](_0xede9b2[_0xc366('0x1d')])));}})});router['post']('/:id/logo_login',upload[_0xc366('0x23')](_0xc366('0x1f')),controller[_0xc366('0x24')]);var upload=multer({'storage':multer[_0xc366('0x21')]({'destination':function(_0x27d4ba,_0x4a3996,_0x3d85d9){_0x3d85d9(null,path['join'](config[_0xc366('0x17')],_0xc366('0x18')));},'filename':function(_0x58229a,_0x157681,_0x87c667){_0x87c667(null,util[_0xc366('0x19')](_0xc366('0x1a'),_0xc366('0x25'),path[_0xc366('0x1c')](_0x157681['originalname'])));}})});router[_0xc366('0x1e')]('/:id/preferred',upload[_0xc366('0x23')](_0xc366('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer[_0xc366('0x21')]({'destination':function(_0x4c5373,_0x5c351b,_0xd067e9){_0xd067e9(null,path['join'](config[_0xc366('0x17')],'server/files/images/logos/'));},'filename':function(_0x589ed1,_0x166ad6,_0x4c646f){_0x4c646f(null,util['format'](_0xc366('0x1a'),_0xc366('0x26'),path['extname'](_0x166ad6[_0xc366('0x1d')])));}})});router[_0xc366('0x1e')]('/:id/favicon',upload[_0xc366('0x23')](_0xc366('0x1f')),controller[_0xc366('0x27')]);router[_0xc366('0x28')](_0xc366('0xb'),auth[_0xc366('0x9')](),controller[_0xc366('0x29')]);module[_0xc366('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 24af9b0..76557f3 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 _0x3fbf=['alternate','sequelize','min_mailbox','INTEGER','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml'];(function(_0x3b3e86,_0x3b66f0){var _0x4683cb=function(_0x37cd0e){while(--_0x37cd0e){_0x3b3e86['push'](_0x3b3e86['shift']());}};_0x4683cb(++_0x3b66f0);}(_0x3fbf,0x1ac));var _0xf3fb=function(_0x2e65ee,_0x29dad9){_0x2e65ee=_0x2e65ee-0x0;var _0x4c712a=_0x3fbf[_0x2e65ee];return _0x4c712a;};'use strict';var Sequelize=require(_0xf3fb('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xf3fb('0x1'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xf3fb('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xf3fb('0x3')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xf3fb('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xf3fb('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xf3fb('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xf3fb('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xf3fb('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xf3fb('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xf3fb('0x3')]},'turnaddr':{'type':Sequelize[_0xf3fb('0x3')]},'turnusername':{'type':Sequelize[_0xf3fb('0x3')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xf3fb('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xf3fb('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xf3fb('0x3')],'defaultValue':_0xf3fb('0x5')},'enableEmailPreview':{'type':Sequelize[_0xf3fb('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0xf3fb('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xf3fb('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xf3fb('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xf3fb('0x3')],'defaultValue':_0xf3fb('0x6')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xf3fb('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xf3fb('0x3')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xf3fb('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xf3fb('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4ed9=['exports','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','alternate','sequelize'];(function(_0x3fb396,_0x3339cf){var _0xc9ea16=function(_0x1aa880){while(--_0x1aa880){_0x3fb396['push'](_0x3fb396['shift']());}};_0xc9ea16(++_0x3339cf);}(_0x4ed9,0xaf));var _0x94ed=function(_0x4818bc,_0xff2f95){_0x4818bc=_0x4818bc-0x0;var _0x505869=_0x4ed9[_0x4818bc];return _0x505869;};'use strict';var Sequelize=require(_0x94ed('0x0'));module[_0x94ed('0x1')]={'min_internal':{'type':Sequelize[_0x94ed('0x2')](0xb),'unique':_0x94ed('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x94ed('0x2')](0xb),'unique':_0x94ed('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x94ed('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x94ed('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x94ed('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x94ed('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x94ed('0x5')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x94ed('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x94ed('0x5')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x94ed('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x94ed('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x94ed('0x5')],'defaultValue':_0x94ed('0x7')},'chatTimeout':{'type':Sequelize[_0x94ed('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x94ed('0x5')]},'defaultPreferred':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x94ed('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x94ed('0x5')]},'defaultFavicon':{'type':Sequelize[_0x94ed('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x94ed('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize[_0x94ed('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 09bcb56..5632ba5 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 _0x1a80=['filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','include','find','update','body','params','addLogo','file','filename','../../config/license/util','getLogo','server/files/images/logos','getLicense','logo','loginLogo','preferred','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.png','default','upperFirst','custom','download','getLogoLogin','favicon','default_loginLogo.png','gdpr','addPreferred','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','stack','name','send','index','Setting','rawAttributes','type','key','model','map','query','keys'];(function(_0x20c567,_0x489cc8){var _0xdc7b7b=function(_0x4a58b0){while(--_0x4a58b0){_0x20c567['push'](_0x20c567['shift']());}};_0xdc7b7b(++_0x489cc8);}(_0x1a80,0x122));var _0x01a8=function(_0x2ecaea,_0x3731be){_0x2ecaea=_0x2ecaea-0x0;var _0x235ff4=_0x1a80[_0x2ecaea];return _0x235ff4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x01a8('0x0'));var rimraf=require(_0x01a8('0x1'));var zipdir=require(_0x01a8('0x2'));var jsonpatch=require(_0x01a8('0x3'));var rp=require(_0x01a8('0x4'));var moment=require('moment');var BPromise=require(_0x01a8('0x5'));var Mustache=require('mustache');var util=require(_0x01a8('0x6'));var path=require(_0x01a8('0x7'));var sox=require(_0x01a8('0x8'));var csv=require(_0x01a8('0x9'));var ejs=require(_0x01a8('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x01a8('0xb'));var crypto=require(_0x01a8('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x01a8('0x9'));var querystring=require(_0x01a8('0xd'));var Papa=require(_0x01a8('0xe'));var Redis=require(_0x01a8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x01a8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x01a8('0x11'));var utils=require('../../config/utils');var config=require(_0x01a8('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x01a8('0x13'));var client=jayson[_0x01a8('0x14')][_0x01a8('0x15')]({'port':0x232a});function checkPasswordPattern(_0x4a80db,_0x2d3587,_0x8235c3){if(_0x8235c3){var _0x56783b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x56783b[_0x01a8('0x16')](_0x2d3587)){return _0x4a80db;}else{throw new db[(_0x01a8('0x17'))][(_0x01a8('0x18'))](_0x01a8('0x19'));}}else{return _0x4a80db;}}function respondWithRpcPromise(_0x561808,_0xbb800b,_0x5aad34,_0x5551c4){return new BPromise(function(_0x2626ae,_0x597021){var _0x4b7a69=_0x5551c4||client;return _0x4b7a69['request'](_0x561808,_0x5aad34)[_0x01a8('0x1a')](function(_0x1fb450){logger[_0x01a8('0x1b')](_0x01a8('0x1c'),_0xbb800b,_0x01a8('0x1d'));logger[_0x01a8('0x1e')](_0x01a8('0x1f'),_0xbb800b,_0x01a8('0x1d'),JSON[_0x01a8('0x20')](_0x1fb450));if(_0x1fb450[_0x01a8('0x21')]){if(_0x1fb450[_0x01a8('0x21')][_0x01a8('0x22')]===0x1f4){logger['error'](_0x01a8('0x1c'),_0xbb800b,_0x1fb450[_0x01a8('0x21')][_0x01a8('0x23')]);return _0x597021(_0x1fb450[_0x01a8('0x21')]['message']);}logger[_0x01a8('0x21')](_0x01a8('0x1c'),_0xbb800b,_0x1fb450[_0x01a8('0x21')][_0x01a8('0x23')]);return _0x2626ae(_0x1fb450[_0x01a8('0x21')]['message']);}else{logger[_0x01a8('0x1b')](_0x01a8('0x1c'),_0xbb800b,_0x01a8('0x1d'));_0x2626ae(_0x1fb450[_0x01a8('0x24')][_0x01a8('0x23')]);}})[_0x01a8('0x25')](function(_0x388970){logger['error']('Setting,\x20%s,\x20%s',_0xbb800b,_0x388970);_0x597021(_0x388970);});});}function respondWithStatusCode(_0x29e3c7,_0x361027){_0x361027=_0x361027||0xcc;return function(_0x585b23){if(_0x585b23){return _0x29e3c7['sendStatus'](_0x361027);}return _0x29e3c7[_0x01a8('0x26')](_0x361027)[_0x01a8('0x27')]();};}function respondWithResult(_0x32b213,_0x408557){_0x408557=_0x408557||0xc8;return function(_0x10a342){if(_0x10a342){return _0x32b213[_0x01a8('0x26')](_0x408557)[_0x01a8('0x28')](_0x10a342);}};}function respondWithFilteredResult(_0x1dc316,_0x4edc78){return function(_0x303d8e){if(_0x303d8e){var _0xf431b=_0x303d8e[_0x01a8('0x29')],_0x496b83=_0x4edc78[_0x01a8('0x2a')],_0x33930a=_0x4edc78[_0x01a8('0x2a')]+_0x4edc78[_0x01a8('0x2b')],_0xf89d3f;if(_0x33930a>=_0xf431b){_0x33930a=_0xf431b;_0xf89d3f=0xc8;}else{_0xf89d3f=0xce;}_0x1dc316[_0x01a8('0x26')](_0xf89d3f);return _0x1dc316[_0x01a8('0x2c')](_0x01a8('0x2d'),_0x496b83+'-'+_0x33930a+'/'+_0xf431b)[_0x01a8('0x28')](_0x303d8e);}return null;};}function patchUpdates(_0x2ae695){return function(_0x2ebd91){try{jsonpatch[_0x01a8('0x2e')](_0x2ebd91,_0x2ae695,!![]);}catch(_0x5bab94){return BPromise[_0x01a8('0x2f')](_0x5bab94);}return _0x2ebd91['save']();};}function saveUpdates(_0x5198d9,_0x2380b2){return function(_0x180294){if(_0x180294){return _0x180294['update'](_0x5198d9)[_0x01a8('0x1a')](function(_0x4b3f7c){return _0x4b3f7c;});}return null;};}function removeEntity(_0xe5039d,_0x2f4239){return function(_0x14320e){if(_0x14320e){return _0x14320e[_0x01a8('0x30')]()['then'](function(){_0xe5039d[_0x01a8('0x26')](0xcc)[_0x01a8('0x27')]();});}};}function handleEntityNotFound(_0x32df6e,_0x1d275c){return function(_0x520a10){if(!_0x520a10){_0x32df6e['sendStatus'](0x194);}return _0x520a10;};}function handleError(_0xe992ef,_0x4a869a){_0x4a869a=_0x4a869a||0x1f4;return function(_0x155e8a){logger['error'](_0x155e8a[_0x01a8('0x31')]);if(_0x155e8a[_0x01a8('0x32')]){delete _0x155e8a['name'];}_0xe992ef[_0x01a8('0x26')](_0x4a869a)[_0x01a8('0x33')](_0x155e8a);};}exports[_0x01a8('0x34')]=function(_0x36cb05,_0x59665d){var _0x408a6f={},_0x4fe57a={},_0x354d63={'count':0x0,'rows':[]};var _0x281783=_['map'](db[_0x01a8('0x35')][_0x01a8('0x36')],function(_0x2a9b23){return{'name':_0x2a9b23['fieldName'],'type':_0x2a9b23[_0x01a8('0x37')][_0x01a8('0x38')]};});_0x4fe57a[_0x01a8('0x39')]=_[_0x01a8('0x3a')](_0x281783,_0x01a8('0x32'));_0x4fe57a[_0x01a8('0x3b')]=_[_0x01a8('0x3c')](_0x36cb05[_0x01a8('0x3b')]);_0x4fe57a[_0x01a8('0x3d')]=_['intersection'](_0x4fe57a[_0x01a8('0x39')],_0x4fe57a[_0x01a8('0x3b')]);_0x408a6f['attributes']=_[_0x01a8('0x3e')](_0x4fe57a['model'],qs[_0x01a8('0x3f')](_0x36cb05[_0x01a8('0x3b')][_0x01a8('0x3f')]));_0x408a6f[_0x01a8('0x40')]=_0x408a6f[_0x01a8('0x40')]['length']?_0x408a6f[_0x01a8('0x40')]:_0x4fe57a[_0x01a8('0x39')];if(!_0x36cb05['query'][_0x01a8('0x41')](_0x01a8('0x42'))){_0x408a6f[_0x01a8('0x2b')]=qs[_0x01a8('0x2b')](_0x36cb05[_0x01a8('0x3b')][_0x01a8('0x2b')]);_0x408a6f['offset']=qs[_0x01a8('0x2a')](_0x36cb05['query'][_0x01a8('0x2a')]);}_0x408a6f[_0x01a8('0x43')]=qs[_0x01a8('0x44')](_0x36cb05['query']['sort']);_0x408a6f['where']=qs[_0x01a8('0x3d')](_[_0x01a8('0x45')](_0x36cb05[_0x01a8('0x3b')],_0x4fe57a[_0x01a8('0x3d')]));if(_0x36cb05['query'][_0x01a8('0x46')]){_0x408a6f[_0x01a8('0x47')]=_['merge'](_0x408a6f[_0x01a8('0x47')],{'$or':_['map'](_0x281783,function(_0x531d3c){if(_0x531d3c['type']!==_0x01a8('0x48')){var _0x4b5490={};_0x4b5490[_0x531d3c[_0x01a8('0x32')]]={'$like':'%'+_0x36cb05['query'][_0x01a8('0x46')]+'%'};return _0x4b5490;}})});}_0x408a6f=_[_0x01a8('0x49')]({},_0x408a6f,_0x36cb05[_0x01a8('0x4a')]);var _0x23cb82={'where':_0x408a6f['where']};return db[_0x01a8('0x35')][_0x01a8('0x29')](_0x23cb82)['then'](function(_0xad55d){_0x354d63['count']=_0xad55d;if(_0x36cb05['query'][_0x01a8('0x4b')]){_0x408a6f['include']=[{'all':!![]}];}return db['Setting'][_0x01a8('0x4c')](_0x408a6f);})[_0x01a8('0x1a')](function(_0x51210d){_0x354d63[_0x01a8('0x4d')]=_0x51210d;return _0x354d63;})['then'](respondWithFilteredResult(_0x59665d,_0x408a6f))[_0x01a8('0x25')](handleError(_0x59665d,null));};exports['show']=function(_0x559da8,_0x9eec2a){var _0x22e31a={'raw':![],'where':{'id':_0x559da8['params']['id']}},_0x1cef79={};_0x1cef79['model']=_[_0x01a8('0x3c')](db[_0x01a8('0x35')][_0x01a8('0x36')]);_0x1cef79[_0x01a8('0x3b')]=_[_0x01a8('0x3c')](_0x559da8[_0x01a8('0x3b')]);_0x1cef79[_0x01a8('0x3d')]=_[_0x01a8('0x3e')](_0x1cef79[_0x01a8('0x39')],_0x1cef79[_0x01a8('0x3b')]);_0x22e31a[_0x01a8('0x40')]=_['intersection'](_0x1cef79[_0x01a8('0x39')],qs[_0x01a8('0x3f')](_0x559da8[_0x01a8('0x3b')][_0x01a8('0x3f')]));_0x22e31a[_0x01a8('0x40')]=_0x22e31a['attributes']['length']?_0x22e31a['attributes']:_0x1cef79[_0x01a8('0x39')];if(_0x559da8[_0x01a8('0x3b')][_0x01a8('0x4b')]){_0x22e31a[_0x01a8('0x4e')]=[{'all':!![]}];}_0x22e31a=_['merge']({},_0x22e31a,_0x559da8[_0x01a8('0x4a')]);return db[_0x01a8('0x35')][_0x01a8('0x4f')](_0x22e31a)[_0x01a8('0x1a')](handleEntityNotFound(_0x9eec2a,null))['then'](respondWithResult(_0x9eec2a,null))[_0x01a8('0x25')](handleError(_0x9eec2a,null));};exports[_0x01a8('0x50')]=function(_0x30d806,_0x471fe0){if(_0x30d806[_0x01a8('0x51')]['id']){delete _0x30d806[_0x01a8('0x51')]['id'];}return db[_0x01a8('0x35')]['find']({'where':{'id':_0x30d806[_0x01a8('0x52')]['id']}})['then'](handleEntityNotFound(_0x471fe0,null))[_0x01a8('0x1a')](saveUpdates(_0x30d806[_0x01a8('0x51')],null))[_0x01a8('0x1a')](respondWithResult(_0x471fe0,null))[_0x01a8('0x25')](handleError(_0x471fe0,null));};exports[_0x01a8('0x53')]=function(_0x19c433,_0x18c350,_0x6c6566){if(_0x19c433[_0x01a8('0x54')]&&_0x19c433['file'][_0x01a8('0x55')]){_0x19c433[_0x01a8('0x51')]['logo']=_0x19c433['file'][_0x01a8('0x55')];}return db[_0x01a8('0x35')]['find']({'where':{'id':_0x19c433[_0x01a8('0x52')]['id']}})[_0x01a8('0x1a')](handleEntityNotFound(_0x18c350,null))[_0x01a8('0x1a')](saveUpdates(_0x19c433[_0x01a8('0x51')],null))[_0x01a8('0x1a')](respondWithResult(_0x18c350,null))[_0x01a8('0x25')](handleError(_0x18c350,null));};exports['addLogoLogin']=function(_0x4abd81,_0x543b2c,_0x48387a){if(_0x4abd81[_0x01a8('0x54')]&&_0x4abd81[_0x01a8('0x54')][_0x01a8('0x55')]){_0x4abd81[_0x01a8('0x51')]['loginLogo']=_0x4abd81[_0x01a8('0x54')][_0x01a8('0x55')];}return db[_0x01a8('0x35')][_0x01a8('0x4f')]({'where':{'id':_0x4abd81[_0x01a8('0x52')]['id']}})[_0x01a8('0x1a')](handleEntityNotFound(_0x543b2c,null))[_0x01a8('0x1a')](saveUpdates(_0x4abd81[_0x01a8('0x51')],null))[_0x01a8('0x1a')](respondWithResult(_0x543b2c,null))['catch'](handleError(_0x543b2c,null));};var utilLicense=require(_0x01a8('0x56'));exports[_0x01a8('0x57')]=function(_0x1454c4,_0x285169,_0x33aac5){var _0x15c676=_0x01a8('0x58');var _0x34b037={'custom':![]};return utilLicense[_0x01a8('0x59')]()[_0x01a8('0x1a')](function(_0x155c57){if(_0x155c57){_0x34b037=_0x155c57;}return db[_0x01a8('0x35')][_0x01a8('0x4f')]({'where':{'id':_0x1454c4[_0x01a8('0x52')]['id']},'attributes':[_0x01a8('0x5a'),_0x01a8('0x5b'),_0x01a8('0x5c'),'favicon',_0x01a8('0x5d'),_0x01a8('0x5e'),_0x01a8('0x5f'),_0x01a8('0x60')],'raw':!![]});})[_0x01a8('0x1a')](handleEntityNotFound(_0x285169,null))[_0x01a8('0x1a')](function(_0x43c5a8){if(_0x43c5a8){var _0x52838e=_0x43c5a8[_0x01a8('0x5a')]&&fs[_0x01a8('0x61')](path['join'](config[_0x01a8('0x62')],_0x15c676,_[_0x01a8('0x63')](_0x43c5a8[_0x01a8('0x5a')])))?path['join'](config[_0x01a8('0x62')],_0x15c676,_[_0x01a8('0x63')](_0x43c5a8['logo'])):path[_0x01a8('0x64')](config[_0x01a8('0x62')],_0x15c676,_[_0x01a8('0x63')](_0x01a8('0x65')));var _0x35d169=_0x01a8('0x66')+_[_0x01a8('0x67')](_0x01a8('0x5a'));if(_0x43c5a8[_0x35d169]||!_0x34b037[_0x01a8('0x68')]){_0x52838e=path[_0x01a8('0x64')](config[_0x01a8('0x62')],_0x15c676,_[_0x01a8('0x63')](_0x01a8('0x65')));}if(!fs[_0x01a8('0x61')](_0x52838e)){throw new db[(_0x01a8('0x17'))][(_0x01a8('0x18'))](_[_0x01a8('0x67')]('logo')+'\x20not\x20found');}return _0x285169[_0x01a8('0x69')](_0x52838e);}})[_0x01a8('0x25')](handleError(_0x285169,null));};var utilLicense=require(_0x01a8('0x56'));exports[_0x01a8('0x6a')]=function(_0xc2846b,_0x3daa4f,_0xcac9e8){var _0x30535e=_0x01a8('0x58');var _0x264b5b={'custom':![]};return utilLicense[_0x01a8('0x59')]()['then'](function(_0x29e849){if(_0x29e849){_0x264b5b=_0x29e849;}return db[_0x01a8('0x35')][_0x01a8('0x4f')]({'where':{'id':_0xc2846b[_0x01a8('0x52')]['id']},'attributes':['logo',_0x01a8('0x5b'),_0x01a8('0x5c'),_0x01a8('0x6b'),'defaultLogo',_0x01a8('0x5e'),_0x01a8('0x5f'),_0x01a8('0x60')],'raw':!![]});})[_0x01a8('0x1a')](handleEntityNotFound(_0x3daa4f,null))['then'](function(_0x4918df){if(_0x4918df){var _0x2e7ac9=_0x4918df['loginLogo']&&fs[_0x01a8('0x61')](path[_0x01a8('0x64')](config[_0x01a8('0x62')],_0x30535e,_[_0x01a8('0x63')](_0x4918df['loginLogo'])))?path[_0x01a8('0x64')](config[_0x01a8('0x62')],_0x30535e,_['toLower'](_0x4918df[_0x01a8('0x5b')])):path[_0x01a8('0x64')](config[_0x01a8('0x62')],_0x30535e,_[_0x01a8('0x63')](_0x01a8('0x6c')));var _0x1eb7db='default'+_['upperFirst'](_0x01a8('0x5b'));if(_0x4918df[_0x1eb7db]||!_0x264b5b['custom']){_0x2e7ac9=path['join'](config[_0x01a8('0x62')],_0x30535e,_[_0x01a8('0x63')](_0x01a8('0x6c')));}if(!fs['existsSync'](_0x2e7ac9)){throw new db['Sequelize'][(_0x01a8('0x18'))](_[_0x01a8('0x67')]('loginLogo')+'\x20not\x20found');}return _0x3daa4f[_0x01a8('0x69')](_0x2e7ac9);}})['catch'](handleError(_0x3daa4f,null));};exports[_0x01a8('0x6d')]=function(_0x372889,_0x528e1f){return db['Setting']['find']({'where':{'id':_0x372889[_0x01a8('0x52')]['id']},'attributes':['securePassword']})[_0x01a8('0x1a')](respondWithResult(_0x528e1f,null))[_0x01a8('0x25')](handleError(_0x528e1f,null));};exports[_0x01a8('0x6e')]=function(_0x59d876,_0x3c286d,_0x20dc9b){if(_0x59d876[_0x01a8('0x54')]&&_0x59d876[_0x01a8('0x54')][_0x01a8('0x55')]){_0x59d876[_0x01a8('0x51')]['preferred']=_0x59d876['file']['filename'];}return db['Setting'][_0x01a8('0x4f')]({'where':{'id':_0x59d876[_0x01a8('0x52')]['id']}})[_0x01a8('0x1a')](handleEntityNotFound(_0x3c286d,null))[_0x01a8('0x1a')](saveUpdates(_0x59d876[_0x01a8('0x51')],null))[_0x01a8('0x1a')](respondWithResult(_0x3c286d,null))[_0x01a8('0x25')](handleError(_0x3c286d,null));};var utilLicense=require(_0x01a8('0x56'));exports[_0x01a8('0x6f')]=function(_0x583f38,_0x482c65,_0x3b9bae){var _0x5bdd23=_0x01a8('0x58');var _0x4fce37={'custom':![]};return utilLicense[_0x01a8('0x59')]()[_0x01a8('0x1a')](function(_0x1dbbb9){if(_0x1dbbb9){_0x4fce37=_0x1dbbb9;}return db['Setting']['find']({'where':{'id':_0x583f38['params']['id']},'attributes':['logo',_0x01a8('0x5b'),_0x01a8('0x5c'),_0x01a8('0x6b'),_0x01a8('0x5d'),_0x01a8('0x5e'),_0x01a8('0x5f'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x482c65,null))[_0x01a8('0x1a')](function(_0x1f539a){if(_0x1f539a){var _0x3c6fd1=_0x1f539a[_0x01a8('0x5c')]&&fs[_0x01a8('0x61')](path[_0x01a8('0x64')](config['root'],_0x5bdd23,_[_0x01a8('0x63')](_0x1f539a[_0x01a8('0x5c')])))?path[_0x01a8('0x64')](config[_0x01a8('0x62')],_0x5bdd23,_[_0x01a8('0x63')](_0x1f539a[_0x01a8('0x5c')])):path[_0x01a8('0x64')](config[_0x01a8('0x62')],_0x5bdd23,_[_0x01a8('0x63')](_0x01a8('0x70')));var _0x35c62f=_0x01a8('0x66')+_[_0x01a8('0x67')](_0x01a8('0x5c'));if(_0x1f539a[_0x35c62f]||!_0x4fce37[_0x01a8('0x68')]||!_0x4fce37[_0x01a8('0x5c')]){_0x3c6fd1=path[_0x01a8('0x64')](config[_0x01a8('0x62')],_0x5bdd23,_[_0x01a8('0x63')]('default_preferred.png'));}if(!fs[_0x01a8('0x61')](_0x3c6fd1)){throw new db[(_0x01a8('0x17'))][(_0x01a8('0x18'))](_['upperFirst']('preferred')+_0x01a8('0x71'));}return _0x482c65['download'](_0x3c6fd1);}})[_0x01a8('0x25')](handleError(_0x482c65,null));};exports[_0x01a8('0x72')]=function(_0x2abb6a,_0x2e1a53,_0x18b12f){if(_0x2abb6a[_0x01a8('0x54')]&&_0x2abb6a[_0x01a8('0x54')][_0x01a8('0x55')]){_0x2abb6a[_0x01a8('0x51')]['favicon']=_0x2abb6a['file'][_0x01a8('0x55')];}return db[_0x01a8('0x35')][_0x01a8('0x4f')]({'where':{'id':_0x2abb6a['params']['id']}})[_0x01a8('0x1a')](handleEntityNotFound(_0x2e1a53,null))[_0x01a8('0x1a')](saveUpdates(_0x2abb6a['body'],null))[_0x01a8('0x1a')](respondWithResult(_0x2e1a53,null))[_0x01a8('0x25')](handleError(_0x2e1a53,null));};var utilLicense=require('../../config/license/util');exports[_0x01a8('0x73')]=function(_0x17739e,_0x2a2ab9,_0x1df5df){var _0x55d99e=_0x01a8('0x58');var _0x3cdc97={'custom':![]};return utilLicense[_0x01a8('0x59')]()[_0x01a8('0x1a')](function(_0xbf9364){if(_0xbf9364){_0x3cdc97=_0xbf9364;}return db[_0x01a8('0x35')][_0x01a8('0x4f')]({'where':{'id':_0x17739e['params']['id']},'attributes':[_0x01a8('0x5a'),_0x01a8('0x5b'),'preferred',_0x01a8('0x6b'),_0x01a8('0x5d'),_0x01a8('0x5e'),_0x01a8('0x5f'),_0x01a8('0x60')],'raw':!![]});})[_0x01a8('0x1a')](handleEntityNotFound(_0x2a2ab9,null))[_0x01a8('0x1a')](function(_0xcfca9b){if(_0xcfca9b){var _0xc5d53a=_0xcfca9b[_0x01a8('0x6b')]&&fs[_0x01a8('0x61')](path['join'](config[_0x01a8('0x62')],_0x55d99e,_[_0x01a8('0x63')](_0xcfca9b['favicon'])))?path[_0x01a8('0x64')](config[_0x01a8('0x62')],_0x55d99e,_['toLower'](_0xcfca9b['favicon'])):path[_0x01a8('0x64')](config['root'],_0x55d99e,_[_0x01a8('0x63')](_0x01a8('0x74')));var _0x29f98d=_0x01a8('0x66')+_[_0x01a8('0x67')](_0x01a8('0x6b'));if(_0xcfca9b[_0x29f98d]||!_0x3cdc97[_0x01a8('0x68')]){_0xc5d53a=path[_0x01a8('0x64')](config[_0x01a8('0x62')],_0x55d99e,_['toLower'](_0x01a8('0x74')));}if(!fs['existsSync'](_0xc5d53a)){throw new db['Sequelize'][(_0x01a8('0x18'))](_[_0x01a8('0x67')]('favicon')+_0x01a8('0x71'));}return _0x2a2ab9[_0x01a8('0x69')](_0xc5d53a);}})[_0x01a8('0x25')](handleError(_0x2a2ab9,null));}; \ No newline at end of file +var _0xaba8=['body','addLogo','file','logo','addLogoLogin','filename','loginLogo','getLogo','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','root','default_logo.png','default','upperFirst','download','../../config/license/util','server/files/images/logos','preferred','custom','ValidationError','securePassword','getPreferred','default_preferred.png','\x20not\x20found','addFavicon','getFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','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~!@#$%^&-_=+[{]}.','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','Setting','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','options','include','rows','params','keys','length','includeAll','find'];(function(_0x40937b,_0x1c15fd){var _0xbbe422=function(_0x5c374b){while(--_0x5c374b){_0x40937b['push'](_0x40937b['shift']());}};_0xbbe422(++_0x1c15fd);}(_0xaba8,0x95));var _0x8aba=function(_0x12e682,_0x33f3a3){_0x12e682=_0x12e682-0x0;var _0x26e600=_0xaba8[_0x12e682];return _0x26e600;};'use strict';var pdf=require(_0x8aba('0x0'));var emlformat=require(_0x8aba('0x1'));var rimraf=require(_0x8aba('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8aba('0x3'));var rp=require(_0x8aba('0x4'));var moment=require(_0x8aba('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8aba('0x6'));var util=require(_0x8aba('0x7'));var path=require(_0x8aba('0x8'));var sox=require(_0x8aba('0x9'));var csv=require(_0x8aba('0xa'));var ejs=require(_0x8aba('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8aba('0xc'));var crypto=require(_0x8aba('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8aba('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aba('0xf'));var Papa=require(_0x8aba('0x10'));var Redis=require('ioredis');var authService=require(_0x8aba('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8aba('0x12'));var logger=require(_0x8aba('0x13'))(_0x8aba('0x14'));var utils=require('../../config/utils');var config=require(_0x8aba('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8aba('0x16'));var client=jayson[_0x8aba('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x25da4b,_0x2657dd,_0x531e16){if(_0x531e16){var _0x2c7a29=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2c7a29[_0x8aba('0x18')](_0x2657dd)){return _0x25da4b;}else{throw new db[(_0x8aba('0x19'))]['ValidationError'](_0x8aba('0x1a'));}}else{return _0x25da4b;}}function respondWithRpcPromise(_0x28681f,_0x28bf2c,_0x17eac8,_0x27bd95){return new BPromise(function(_0x333e2d,_0x301f60){var _0x22ed6a=_0x27bd95||client;return _0x22ed6a['request'](_0x28681f,_0x17eac8)['then'](function(_0x3eca89){logger['info'](_0x8aba('0x1b'),_0x28bf2c,_0x8aba('0x1c'));logger[_0x8aba('0x1d')](_0x8aba('0x1e'),_0x28bf2c,_0x8aba('0x1c'),JSON[_0x8aba('0x1f')](_0x3eca89));if(_0x3eca89[_0x8aba('0x20')]){if(_0x3eca89[_0x8aba('0x20')][_0x8aba('0x21')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x28bf2c,_0x3eca89[_0x8aba('0x20')][_0x8aba('0x22')]);return _0x301f60(_0x3eca89[_0x8aba('0x20')][_0x8aba('0x22')]);}logger['error'](_0x8aba('0x1b'),_0x28bf2c,_0x3eca89['error'][_0x8aba('0x22')]);return _0x333e2d(_0x3eca89[_0x8aba('0x20')]['message']);}else{logger['info'](_0x8aba('0x1b'),_0x28bf2c,_0x8aba('0x1c'));_0x333e2d(_0x3eca89[_0x8aba('0x23')]['message']);}})[_0x8aba('0x24')](function(_0x78a6ad){logger[_0x8aba('0x20')](_0x8aba('0x1b'),_0x28bf2c,_0x78a6ad);_0x301f60(_0x78a6ad);});});}function respondWithStatusCode(_0x38ae6a,_0x1724b0){_0x1724b0=_0x1724b0||0xcc;return function(_0x335cfb){if(_0x335cfb){return _0x38ae6a['sendStatus'](_0x1724b0);}return _0x38ae6a['status'](_0x1724b0)[_0x8aba('0x25')]();};}function respondWithResult(_0x2d0984,_0x2b2220){_0x2b2220=_0x2b2220||0xc8;return function(_0x3a7e27){if(_0x3a7e27){return _0x2d0984[_0x8aba('0x26')](_0x2b2220)[_0x8aba('0x27')](_0x3a7e27);}};}function respondWithFilteredResult(_0x5cabc5,_0x179f8e){return function(_0x2d4d37){if(_0x2d4d37){var _0x3ae75e=_0x2d4d37[_0x8aba('0x28')],_0x39016a=_0x179f8e[_0x8aba('0x29')],_0x440d76=_0x179f8e[_0x8aba('0x29')]+_0x179f8e[_0x8aba('0x2a')],_0x4fdf60;if(_0x440d76>=_0x3ae75e){_0x440d76=_0x3ae75e;_0x4fdf60=0xc8;}else{_0x4fdf60=0xce;}_0x5cabc5[_0x8aba('0x26')](_0x4fdf60);return _0x5cabc5[_0x8aba('0x2b')](_0x8aba('0x2c'),_0x39016a+'-'+_0x440d76+'/'+_0x3ae75e)['json'](_0x2d4d37);}return null;};}function patchUpdates(_0x365d21){return function(_0x508f96){try{jsonpatch[_0x8aba('0x2d')](_0x508f96,_0x365d21,!![]);}catch(_0x555e28){return BPromise[_0x8aba('0x2e')](_0x555e28);}return _0x508f96[_0x8aba('0x2f')]();};}function saveUpdates(_0x147b78,_0x18f0be){return function(_0x1b9afd){if(_0x1b9afd){return _0x1b9afd[_0x8aba('0x30')](_0x147b78)[_0x8aba('0x31')](function(_0x436f09){return _0x436f09;});}return null;};}function removeEntity(_0x291ba1,_0x44537a){return function(_0x3af3ee){if(_0x3af3ee){return _0x3af3ee['destroy']()[_0x8aba('0x31')](function(){_0x291ba1[_0x8aba('0x26')](0xcc)[_0x8aba('0x25')]();});}};}function handleEntityNotFound(_0x3e4826,_0x4b6e95){return function(_0x4bf5d3){if(!_0x4bf5d3){_0x3e4826['sendStatus'](0x194);}return _0x4bf5d3;};}function handleError(_0x211261,_0x5c1d7d){_0x5c1d7d=_0x5c1d7d||0x1f4;return function(_0x1c8994){logger[_0x8aba('0x20')](_0x1c8994[_0x8aba('0x32')]);if(_0x1c8994[_0x8aba('0x33')]){delete _0x1c8994[_0x8aba('0x33')];}_0x211261[_0x8aba('0x26')](_0x5c1d7d)[_0x8aba('0x34')](_0x1c8994);};}exports[_0x8aba('0x35')]=function(_0x50e554,_0x53680c){var _0x47f8aa={},_0x90c8f5={},_0x5b78eb={'count':0x0,'rows':[]};var _0x503d08=_[_0x8aba('0x36')](db[_0x8aba('0x37')][_0x8aba('0x38')],function(_0x23c2cf){return{'name':_0x23c2cf['fieldName'],'type':_0x23c2cf[_0x8aba('0x39')][_0x8aba('0x3a')]};});_0x90c8f5[_0x8aba('0x3b')]=_['map'](_0x503d08,_0x8aba('0x33'));_0x90c8f5[_0x8aba('0x3c')]=_['keys'](_0x50e554[_0x8aba('0x3c')]);_0x90c8f5[_0x8aba('0x3d')]=_[_0x8aba('0x3e')](_0x90c8f5[_0x8aba('0x3b')],_0x90c8f5[_0x8aba('0x3c')]);_0x47f8aa['attributes']=_[_0x8aba('0x3e')](_0x90c8f5['model'],qs[_0x8aba('0x3f')](_0x50e554[_0x8aba('0x3c')]['fields']));_0x47f8aa[_0x8aba('0x40')]=_0x47f8aa[_0x8aba('0x40')]['length']?_0x47f8aa[_0x8aba('0x40')]:_0x90c8f5['model'];if(!_0x50e554[_0x8aba('0x3c')][_0x8aba('0x41')]('nolimit')){_0x47f8aa[_0x8aba('0x2a')]=qs['limit'](_0x50e554[_0x8aba('0x3c')]['limit']);_0x47f8aa['offset']=qs[_0x8aba('0x29')](_0x50e554[_0x8aba('0x3c')]['offset']);}_0x47f8aa[_0x8aba('0x42')]=qs[_0x8aba('0x43')](_0x50e554['query'][_0x8aba('0x43')]);_0x47f8aa['where']=qs[_0x8aba('0x3d')](_[_0x8aba('0x44')](_0x50e554['query'],_0x90c8f5[_0x8aba('0x3d')]));if(_0x50e554[_0x8aba('0x3c')]['filter']){_0x47f8aa['where']=_[_0x8aba('0x45')](_0x47f8aa[_0x8aba('0x46')],{'$or':_[_0x8aba('0x36')](_0x503d08,function(_0x2b38f3){if(_0x2b38f3[_0x8aba('0x39')]!==_0x8aba('0x47')){var _0x3ed00f={};_0x3ed00f[_0x2b38f3['name']]={'$like':'%'+_0x50e554[_0x8aba('0x3c')][_0x8aba('0x48')]+'%'};return _0x3ed00f;}})});}_0x47f8aa=_['merge']({},_0x47f8aa,_0x50e554[_0x8aba('0x49')]);var _0x1d30e8={'where':_0x47f8aa[_0x8aba('0x46')]};return db[_0x8aba('0x37')]['count'](_0x1d30e8)[_0x8aba('0x31')](function(_0x52d757){_0x5b78eb[_0x8aba('0x28')]=_0x52d757;if(_0x50e554[_0x8aba('0x3c')]['includeAll']){_0x47f8aa[_0x8aba('0x4a')]=[{'all':!![]}];}return db[_0x8aba('0x37')]['findAll'](_0x47f8aa);})[_0x8aba('0x31')](function(_0x21c070){_0x5b78eb[_0x8aba('0x4b')]=_0x21c070;return _0x5b78eb;})['then'](respondWithFilteredResult(_0x53680c,_0x47f8aa))[_0x8aba('0x24')](handleError(_0x53680c,null));};exports['show']=function(_0x3b4da8,_0x58dbd0){var _0x14faf5={'raw':![],'where':{'id':_0x3b4da8[_0x8aba('0x4c')]['id']}},_0x5c6eff={};_0x5c6eff[_0x8aba('0x3b')]=_[_0x8aba('0x4d')](db[_0x8aba('0x37')][_0x8aba('0x38')]);_0x5c6eff[_0x8aba('0x3c')]=_['keys'](_0x3b4da8[_0x8aba('0x3c')]);_0x5c6eff[_0x8aba('0x3d')]=_[_0x8aba('0x3e')](_0x5c6eff[_0x8aba('0x3b')],_0x5c6eff[_0x8aba('0x3c')]);_0x14faf5['attributes']=_[_0x8aba('0x3e')](_0x5c6eff[_0x8aba('0x3b')],qs[_0x8aba('0x3f')](_0x3b4da8[_0x8aba('0x3c')]['fields']));_0x14faf5[_0x8aba('0x40')]=_0x14faf5[_0x8aba('0x40')][_0x8aba('0x4e')]?_0x14faf5[_0x8aba('0x40')]:_0x5c6eff[_0x8aba('0x3b')];if(_0x3b4da8[_0x8aba('0x3c')][_0x8aba('0x4f')]){_0x14faf5['include']=[{'all':!![]}];}_0x14faf5=_['merge']({},_0x14faf5,_0x3b4da8['options']);return db['Setting'][_0x8aba('0x50')](_0x14faf5)[_0x8aba('0x31')](handleEntityNotFound(_0x58dbd0,null))[_0x8aba('0x31')](respondWithResult(_0x58dbd0,null))[_0x8aba('0x24')](handleError(_0x58dbd0,null));};exports[_0x8aba('0x30')]=function(_0x1e661c,_0x51b9c2){if(_0x1e661c['body']['id']){delete _0x1e661c[_0x8aba('0x51')]['id'];}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x1e661c[_0x8aba('0x4c')]['id']}})['then'](handleEntityNotFound(_0x51b9c2,null))[_0x8aba('0x31')](saveUpdates(_0x1e661c[_0x8aba('0x51')],null))['then'](respondWithResult(_0x51b9c2,null))[_0x8aba('0x24')](handleError(_0x51b9c2,null));};exports[_0x8aba('0x52')]=function(_0x50ef71,_0x5cad62,_0x1369c3){if(_0x50ef71[_0x8aba('0x53')]&&_0x50ef71[_0x8aba('0x53')]['filename']){_0x50ef71[_0x8aba('0x51')][_0x8aba('0x54')]=_0x50ef71['file']['filename'];}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x50ef71[_0x8aba('0x4c')]['id']}})[_0x8aba('0x31')](handleEntityNotFound(_0x5cad62,null))[_0x8aba('0x31')](saveUpdates(_0x50ef71[_0x8aba('0x51')],null))[_0x8aba('0x31')](respondWithResult(_0x5cad62,null))[_0x8aba('0x24')](handleError(_0x5cad62,null));};exports[_0x8aba('0x55')]=function(_0x35c55c,_0x2a8737,_0x28a46f){if(_0x35c55c[_0x8aba('0x53')]&&_0x35c55c[_0x8aba('0x53')][_0x8aba('0x56')]){_0x35c55c[_0x8aba('0x51')][_0x8aba('0x57')]=_0x35c55c[_0x8aba('0x53')][_0x8aba('0x56')];}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x35c55c[_0x8aba('0x4c')]['id']}})[_0x8aba('0x31')](handleEntityNotFound(_0x2a8737,null))[_0x8aba('0x31')](saveUpdates(_0x35c55c[_0x8aba('0x51')],null))[_0x8aba('0x31')](respondWithResult(_0x2a8737,null))[_0x8aba('0x24')](handleError(_0x2a8737,null));};var utilLicense=require('../../config/license/util');exports[_0x8aba('0x58')]=function(_0x10db5d,_0x5b4b53,_0x2a601e){var _0x53e0ed='server/files/images/logos';var _0x1d3f3d={'custom':![]};return utilLicense[_0x8aba('0x59')]()['then'](function(_0x5be977){if(_0x5be977){_0x1d3f3d=_0x5be977;}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x10db5d[_0x8aba('0x4c')]['id']},'attributes':['logo',_0x8aba('0x57'),'preferred',_0x8aba('0x5a'),_0x8aba('0x5b'),_0x8aba('0x5c'),_0x8aba('0x5d'),_0x8aba('0x5e')],'raw':!![]});})[_0x8aba('0x31')](handleEntityNotFound(_0x5b4b53,null))['then'](function(_0x30af75){if(_0x30af75){var _0x5ce446=_0x30af75[_0x8aba('0x54')]&&fs[_0x8aba('0x5f')](path[_0x8aba('0x60')](config['root'],_0x53e0ed,_[_0x8aba('0x61')](_0x30af75[_0x8aba('0x54')])))?path[_0x8aba('0x60')](config[_0x8aba('0x62')],_0x53e0ed,_[_0x8aba('0x61')](_0x30af75['logo'])):path[_0x8aba('0x60')](config[_0x8aba('0x62')],_0x53e0ed,_['toLower'](_0x8aba('0x63')));var _0x5b1efa=_0x8aba('0x64')+_[_0x8aba('0x65')](_0x8aba('0x54'));if(_0x30af75[_0x5b1efa]||!_0x1d3f3d['custom']){_0x5ce446=path[_0x8aba('0x60')](config['root'],_0x53e0ed,_['toLower'](_0x8aba('0x63')));}if(!fs['existsSync'](_0x5ce446)){throw new db['Sequelize']['ValidationError'](_[_0x8aba('0x65')](_0x8aba('0x54'))+'\x20not\x20found');}return _0x5b4b53[_0x8aba('0x66')](_0x5ce446);}})[_0x8aba('0x24')](handleError(_0x5b4b53,null));};var utilLicense=require(_0x8aba('0x67'));exports['getLogoLogin']=function(_0x47f374,_0x448a6c,_0x5d1ccf){var _0x19d6ef=_0x8aba('0x68');var _0x3258ac={'custom':![]};return utilLicense[_0x8aba('0x59')]()[_0x8aba('0x31')](function(_0x533f2f){if(_0x533f2f){_0x3258ac=_0x533f2f;}return db[_0x8aba('0x37')]['find']({'where':{'id':_0x47f374['params']['id']},'attributes':[_0x8aba('0x54'),_0x8aba('0x57'),_0x8aba('0x69'),_0x8aba('0x5a'),_0x8aba('0x5b'),'defaultLoginLogo',_0x8aba('0x5d'),_0x8aba('0x5e')],'raw':!![]});})[_0x8aba('0x31')](handleEntityNotFound(_0x448a6c,null))[_0x8aba('0x31')](function(_0x468aa0){if(_0x468aa0){var _0x48a522=_0x468aa0[_0x8aba('0x57')]&&fs['existsSync'](path[_0x8aba('0x60')](config[_0x8aba('0x62')],_0x19d6ef,_['toLower'](_0x468aa0[_0x8aba('0x57')])))?path['join'](config[_0x8aba('0x62')],_0x19d6ef,_[_0x8aba('0x61')](_0x468aa0['loginLogo'])):path['join'](config[_0x8aba('0x62')],_0x19d6ef,_[_0x8aba('0x61')]('default_loginLogo.png'));var _0x3d5c8f=_0x8aba('0x64')+_[_0x8aba('0x65')](_0x8aba('0x57'));if(_0x468aa0[_0x3d5c8f]||!_0x3258ac[_0x8aba('0x6a')]){_0x48a522=path[_0x8aba('0x60')](config[_0x8aba('0x62')],_0x19d6ef,_['toLower']('default_loginLogo.png'));}if(!fs[_0x8aba('0x5f')](_0x48a522)){throw new db[(_0x8aba('0x19'))][(_0x8aba('0x6b'))](_['upperFirst'](_0x8aba('0x57'))+'\x20not\x20found');}return _0x448a6c['download'](_0x48a522);}})[_0x8aba('0x24')](handleError(_0x448a6c,null));};exports['gdpr']=function(_0x582977,_0x389bfd){return db['Setting']['find']({'where':{'id':_0x582977['params']['id']},'attributes':[_0x8aba('0x6c')]})['then'](respondWithResult(_0x389bfd,null))['catch'](handleError(_0x389bfd,null));};exports['addPreferred']=function(_0x22a73a,_0x69ac20,_0x59fa82){if(_0x22a73a[_0x8aba('0x53')]&&_0x22a73a['file'][_0x8aba('0x56')]){_0x22a73a[_0x8aba('0x51')][_0x8aba('0x69')]=_0x22a73a[_0x8aba('0x53')][_0x8aba('0x56')];}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x22a73a['params']['id']}})[_0x8aba('0x31')](handleEntityNotFound(_0x69ac20,null))[_0x8aba('0x31')](saveUpdates(_0x22a73a[_0x8aba('0x51')],null))[_0x8aba('0x31')](respondWithResult(_0x69ac20,null))[_0x8aba('0x24')](handleError(_0x69ac20,null));};var utilLicense=require('../../config/license/util');exports[_0x8aba('0x6d')]=function(_0x108ab5,_0xb22bc3,_0xf2dcdb){var _0x3e2d2d='server/files/images/logos';var _0x23b1a7={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x18d170){if(_0x18d170){_0x23b1a7=_0x18d170;}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x108ab5[_0x8aba('0x4c')]['id']},'attributes':[_0x8aba('0x54'),'loginLogo',_0x8aba('0x69'),_0x8aba('0x5a'),_0x8aba('0x5b'),_0x8aba('0x5c'),_0x8aba('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x8aba('0x31')](handleEntityNotFound(_0xb22bc3,null))[_0x8aba('0x31')](function(_0x455754){if(_0x455754){var _0x1d5f31=_0x455754[_0x8aba('0x69')]&&fs[_0x8aba('0x5f')](path[_0x8aba('0x60')](config[_0x8aba('0x62')],_0x3e2d2d,_[_0x8aba('0x61')](_0x455754[_0x8aba('0x69')])))?path[_0x8aba('0x60')](config['root'],_0x3e2d2d,_[_0x8aba('0x61')](_0x455754[_0x8aba('0x69')])):path[_0x8aba('0x60')](config['root'],_0x3e2d2d,_['toLower'](_0x8aba('0x6e')));var _0xcf1d3=_0x8aba('0x64')+_[_0x8aba('0x65')](_0x8aba('0x69'));if(_0x455754[_0xcf1d3]||!_0x23b1a7[_0x8aba('0x6a')]||!_0x23b1a7[_0x8aba('0x69')]){_0x1d5f31=path['join'](config['root'],_0x3e2d2d,_[_0x8aba('0x61')](_0x8aba('0x6e')));}if(!fs[_0x8aba('0x5f')](_0x1d5f31)){throw new db[(_0x8aba('0x19'))][(_0x8aba('0x6b'))](_[_0x8aba('0x65')](_0x8aba('0x69'))+_0x8aba('0x6f'));}return _0xb22bc3[_0x8aba('0x66')](_0x1d5f31);}})['catch'](handleError(_0xb22bc3,null));};exports[_0x8aba('0x70')]=function(_0x469184,_0x1242c2,_0x6660d0){if(_0x469184[_0x8aba('0x53')]&&_0x469184[_0x8aba('0x53')][_0x8aba('0x56')]){_0x469184['body'][_0x8aba('0x5a')]=_0x469184[_0x8aba('0x53')][_0x8aba('0x56')];}return db[_0x8aba('0x37')]['find']({'where':{'id':_0x469184['params']['id']}})['then'](handleEntityNotFound(_0x1242c2,null))[_0x8aba('0x31')](saveUpdates(_0x469184[_0x8aba('0x51')],null))['then'](respondWithResult(_0x1242c2,null))['catch'](handleError(_0x1242c2,null));};var utilLicense=require(_0x8aba('0x67'));exports[_0x8aba('0x71')]=function(_0x41af83,_0x24cb99,_0x9deaf8){var _0x26f131=_0x8aba('0x68');var _0x4341d2={'custom':![]};return utilLicense['getLicense']()[_0x8aba('0x31')](function(_0x58a9e0){if(_0x58a9e0){_0x4341d2=_0x58a9e0;}return db[_0x8aba('0x37')][_0x8aba('0x50')]({'where':{'id':_0x41af83[_0x8aba('0x4c')]['id']},'attributes':[_0x8aba('0x54'),'loginLogo',_0x8aba('0x69'),_0x8aba('0x5a'),_0x8aba('0x5b'),_0x8aba('0x5c'),_0x8aba('0x5d'),_0x8aba('0x5e')],'raw':!![]});})[_0x8aba('0x31')](handleEntityNotFound(_0x24cb99,null))[_0x8aba('0x31')](function(_0x4e2db8){if(_0x4e2db8){var _0x53ab4e=_0x4e2db8[_0x8aba('0x5a')]&&fs[_0x8aba('0x5f')](path[_0x8aba('0x60')](config[_0x8aba('0x62')],_0x26f131,_[_0x8aba('0x61')](_0x4e2db8[_0x8aba('0x5a')])))?path['join'](config[_0x8aba('0x62')],_0x26f131,_['toLower'](_0x4e2db8[_0x8aba('0x5a')])):path['join'](config[_0x8aba('0x62')],_0x26f131,_[_0x8aba('0x61')](_0x8aba('0x72')));var _0x1a031a=_0x8aba('0x64')+_[_0x8aba('0x65')](_0x8aba('0x5a'));if(_0x4e2db8[_0x1a031a]||!_0x4341d2[_0x8aba('0x6a')]){_0x53ab4e=path[_0x8aba('0x60')](config['root'],_0x26f131,_[_0x8aba('0x61')](_0x8aba('0x72')));}if(!fs[_0x8aba('0x5f')](_0x53ab4e)){throw new db[(_0x8aba('0x19'))][(_0x8aba('0x6b'))](_[_0x8aba('0x65')](_0x8aba('0x5a'))+'\x20not\x20found');}return _0x24cb99[_0x8aba('0x66')](_0x53ab4e);}})[_0x8aba('0x24')](handleError(_0x24cb99,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index c0a92dd..064c77c 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 _0x4311=['../../config/environment','exports','Setting','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x4311,0x161));var _0x1431=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4311[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x1431('0x0'));var util=require('util');var logger=require(_0x1431('0x1'))(_0x1431('0x2'));var moment=require(_0x1431('0x3'));var BPromise=require(_0x1431('0x4'));var rp=require(_0x1431('0x5'));var fs=require('fs');var path=require(_0x1431('0x6'));var rimraf=require('rimraf');var config=require(_0x1431('0x7'));var attributes=require('./setting.attributes');module[_0x1431('0x8')]=function(_0x4f0bcb,_0x350070){return _0x4f0bcb['define'](_0x1431('0x9'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x823d=['moment','bluebird','request-promise','path','rimraf','./setting.attributes','Setting','settings','util','../../config/logger'];(function(_0x146c3f,_0xf3ad48){var _0x316c56=function(_0x25809a){while(--_0x25809a){_0x146c3f['push'](_0x146c3f['shift']());}};_0x316c56(++_0xf3ad48);}(_0x823d,0x166));var _0xd823=function(_0x24c405,_0x56d6fb){_0x24c405=_0x24c405-0x0;var _0x383aef=_0x823d[_0x24c405];return _0x383aef;};'use strict';var _=require('lodash');var util=require(_0xd823('0x0'));var logger=require(_0xd823('0x1'))('api');var moment=require(_0xd823('0x2'));var BPromise=require(_0xd823('0x3'));var rp=require(_0xd823('0x4'));var fs=require('fs');var path=require(_0xd823('0x5'));var rimraf=require(_0xd823('0x6'));var config=require('../../config/environment');var attributes=require(_0xd823('0x7'));module['exports']=function(_0x5f2875,_0x5d5ad0){return _0x5f2875['define'](_0xd823('0x8'),attributes,{'tableName':_0xd823('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 63f676f..f6a895e 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 _0xb514=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','Setting,\x20%s,\x20%s','request\x20sent','result','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x36e92e,_0x17f709){var _0x95e2a8=function(_0x41a543){while(--_0x41a543){_0x36e92e['push'](_0x36e92e['shift']());}};_0x95e2a8(++_0x17f709);}(_0xb514,0x176));var _0x4b51=function(_0x3cb30b,_0x504b3e){_0x3cb30b=_0x3cb30b-0x0;var _0x2ca717=_0xb514[_0x3cb30b];return _0x2ca717;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4b51('0x0'));var rs=require(_0x4b51('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b51('0x2'))['db'];var utils=require(_0x4b51('0x3'));var logger=require(_0x4b51('0x4'))(_0x4b51('0x5'));var config=require(_0x4b51('0x6'));var jayson=require(_0x4b51('0x7'));var client=jayson[_0x4b51('0x8')][_0x4b51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x307627,_0x158c2d,_0x2e4062){return new BPromise(function(_0x122490,_0x3493d5){return client[_0x4b51('0xa')](_0x307627,_0x2e4062)[_0x4b51('0xb')](function(_0x37d18b){logger[_0x4b51('0xc')]('Setting,\x20%s,\x20%s',_0x158c2d,'request\x20sent');logger[_0x4b51('0xd')](_0x4b51('0xe'),_0x158c2d,'request\x20sent',JSON['stringify'](_0x37d18b));if(_0x37d18b[_0x4b51('0xf')]){if(_0x37d18b[_0x4b51('0xf')][_0x4b51('0x10')]===0x1f4){logger[_0x4b51('0xf')]('Setting,\x20%s,\x20%s',_0x158c2d,_0x37d18b[_0x4b51('0xf')][_0x4b51('0x11')]);return _0x3493d5(_0x37d18b[_0x4b51('0xf')][_0x4b51('0x11')]);}logger['error']('Setting,\x20%s,\x20%s',_0x158c2d,_0x37d18b[_0x4b51('0xf')][_0x4b51('0x11')]);return _0x122490(_0x37d18b[_0x4b51('0xf')]['message']);}else{logger[_0x4b51('0xc')](_0x4b51('0x12'),_0x158c2d,_0x4b51('0x13'));_0x122490(_0x37d18b[_0x4b51('0x14')][_0x4b51('0x11')]);}})['catch'](function(_0x58a4d7){logger[_0x4b51('0xf')](_0x4b51('0x12'),_0x158c2d,_0x58a4d7);_0x3493d5(_0x58a4d7);});});} \ No newline at end of file +var _0x4fef=['message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1d59e2,_0x567c01){var _0x4352be=function(_0x164dd4){while(--_0x164dd4){_0x1d59e2['push'](_0x1d59e2['shift']());}};_0x4352be(++_0x567c01);}(_0x4fef,0x1d1));var _0xf4fe=function(_0x3806f7,_0x329096){_0x3806f7=_0x3806f7-0x0;var _0x2c3d5a=_0x4fef[_0x3806f7];return _0x2c3d5a;};'use strict';var _=require(_0xf4fe('0x0'));var util=require(_0xf4fe('0x1'));var moment=require(_0xf4fe('0x2'));var BPromise=require('bluebird');var rs=require(_0xf4fe('0x3'));var fs=require('fs');var Redis=require(_0xf4fe('0x4'));var db=require(_0xf4fe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4fe('0x6'))(_0xf4fe('0x7'));var config=require(_0xf4fe('0x8'));var jayson=require(_0xf4fe('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x401997,_0x1708b1,_0xadb635){return new BPromise(function(_0x100494,_0x1d6eb2){return client[_0xf4fe('0xa')](_0x401997,_0xadb635)[_0xf4fe('0xb')](function(_0x417862){logger['info'](_0xf4fe('0xc'),_0x1708b1,_0xf4fe('0xd'));logger[_0xf4fe('0xe')](_0xf4fe('0xf'),_0x1708b1,_0xf4fe('0xd'),JSON[_0xf4fe('0x10')](_0x417862));if(_0x417862[_0xf4fe('0x11')]){if(_0x417862[_0xf4fe('0x11')][_0xf4fe('0x12')]===0x1f4){logger[_0xf4fe('0x11')](_0xf4fe('0xc'),_0x1708b1,_0x417862[_0xf4fe('0x11')][_0xf4fe('0x13')]);return _0x1d6eb2(_0x417862['error']['message']);}logger[_0xf4fe('0x11')](_0xf4fe('0xc'),_0x1708b1,_0x417862[_0xf4fe('0x11')][_0xf4fe('0x13')]);return _0x100494(_0x417862['error'][_0xf4fe('0x13')]);}else{logger[_0xf4fe('0x14')](_0xf4fe('0xc'),_0x1708b1,_0xf4fe('0xd'));_0x100494(_0x417862['result']['message']);}})[_0xf4fe('0x15')](function(_0x5d0dcb){logger[_0xf4fe('0x11')](_0xf4fe('0xc'),_0x1708b1,_0x5d0dcb);_0x1d6eb2(_0x5d0dcb);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d069c06..6b04bf5 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 _0x40d9=['getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','addApplications','/:id/send','send','/:id/status','status','addAgents','put','/:id','delete','destroy','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','isAuthenticated','index','get','describe','show','/:id/dispositions','/:id/canned_answers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40d9,0xa1));var _0x940d=function(_0xe4257e,_0x2003c2){_0xe4257e=_0xe4257e-0x0;var _0x54ddab=_0x40d9[_0xe4257e];return _0x54ddab;};'use strict';var multer=require('multer');var util=require(_0x940d('0x0'));var path=require(_0x940d('0x1'));var timeout=require('connect-timeout');var express=require(_0x940d('0x2'));var router=express['Router']();var auth=require(_0x940d('0x3'));var interaction=require(_0x940d('0x4'));var config=require(_0x940d('0x5'));var controller=require(_0x940d('0x6'));router['get']('/',auth[_0x940d('0x7')](),controller[_0x940d('0x8')]);router[_0x940d('0x9')]('/describe',auth[_0x940d('0x7')](),controller[_0x940d('0xa')]);router[_0x940d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x940d('0xb')]);router[_0x940d('0x9')](_0x940d('0xc'),auth[_0x940d('0x7')](),controller['getDispositions']);router[_0x940d('0x9')](_0x940d('0xd'),auth[_0x940d('0x7')](),controller[_0x940d('0xe')]);router['get'](_0x940d('0xf'),auth[_0x940d('0x7')](),controller['getApplications']);router[_0x940d('0x9')](_0x940d('0x10'),auth['isAuthenticated'](),controller[_0x940d('0x11')]);router[_0x940d('0x9')]('/:id/status',controller['statusGet']);router[_0x940d('0x9')](_0x940d('0x12'),auth[_0x940d('0x7')](),controller[_0x940d('0x13')]);router[_0x940d('0x14')]('/',auth[_0x940d('0x7')](),controller[_0x940d('0x15')]);router[_0x940d('0x14')]('/:id/dispositions',auth[_0x940d('0x7')](),controller[_0x940d('0x16')]);router[_0x940d('0x14')](_0x940d('0xd'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x940d('0x14')](_0x940d('0x17'),controller[_0x940d('0x18')]);router[_0x940d('0x14')]('/:id/applications',auth[_0x940d('0x7')](),controller[_0x940d('0x19')]);router[_0x940d('0x14')](_0x940d('0x1a'),auth[_0x940d('0x7')](),controller[_0x940d('0x1b')]);router[_0x940d('0x14')](_0x940d('0x1c'),controller[_0x940d('0x1d')]);router[_0x940d('0x14')](_0x940d('0x12'),auth['isAuthenticated'](),controller[_0x940d('0x1e')]);router[_0x940d('0x1f')](_0x940d('0x20'),auth['isAuthenticated'](),controller['update']);router[_0x940d('0x21')]('/:id',auth[_0x940d('0x7')](),controller[_0x940d('0x22')]);router['delete'](_0x940d('0xc'),auth[_0x940d('0x7')](),controller['removeDispositions']);router[_0x940d('0x21')](_0x940d('0xd'),auth[_0x940d('0x7')](),controller['removeAnswers']);router[_0x940d('0x21')](_0x940d('0x12'),auth[_0x940d('0x7')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x9a02=['multer','path','Router','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getApplications','/:id/interactions','/:id/status','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','/:id/applications','addApplications','/:id/send','send','status','addAgents','put','update','delete','removeAgents','exports'];(function(_0x2251a6,_0xe7f053){var _0x184a06=function(_0x57986f){while(--_0x57986f){_0x2251a6['push'](_0x2251a6['shift']());}};_0x184a06(++_0xe7f053);}(_0x9a02,0x1a4));var _0x29a0=function(_0x2476c0,_0x56122f){_0x2476c0=_0x2476c0-0x0;var _0x23b926=_0x9a02[_0x2476c0];return _0x23b926;};'use strict';var multer=require(_0x29a0('0x0'));var util=require('util');var path=require(_0x29a0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x29a0('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x29a0('0x3'));var config=require(_0x29a0('0x4'));var controller=require('./smsAccount.controller');router[_0x29a0('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x29a0('0x6'),auth[_0x29a0('0x7')](),controller[_0x29a0('0x8')]);router[_0x29a0('0x5')](_0x29a0('0x9'),auth[_0x29a0('0x7')](),controller[_0x29a0('0xa')]);router[_0x29a0('0x5')](_0x29a0('0xb'),auth[_0x29a0('0x7')](),controller[_0x29a0('0xc')]);router['get']('/:id/canned_answers',auth[_0x29a0('0x7')](),controller['getAnswers']);router[_0x29a0('0x5')]('/:id/applications',auth['isAuthenticated'](),controller[_0x29a0('0xd')]);router['get'](_0x29a0('0xe'),auth[_0x29a0('0x7')](),controller['getInteractions']);router['get'](_0x29a0('0xf'),controller['statusGet']);router[_0x29a0('0x5')](_0x29a0('0x10'),auth[_0x29a0('0x7')](),controller[_0x29a0('0x11')]);router[_0x29a0('0x12')]('/',auth[_0x29a0('0x7')](),controller[_0x29a0('0x13')]);router['post'](_0x29a0('0xb'),auth['isAuthenticated'](),controller[_0x29a0('0x14')]);router['post'](_0x29a0('0x15'),auth['isAuthenticated'](),controller[_0x29a0('0x16')]);router[_0x29a0('0x12')](_0x29a0('0x17'),controller['notify']);router['post'](_0x29a0('0x18'),auth[_0x29a0('0x7')](),controller[_0x29a0('0x19')]);router[_0x29a0('0x12')](_0x29a0('0x1a'),auth[_0x29a0('0x7')](),controller[_0x29a0('0x1b')]);router[_0x29a0('0x12')]('/:id/status',controller[_0x29a0('0x1c')]);router[_0x29a0('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x29a0('0x1d')]);router[_0x29a0('0x1e')](_0x29a0('0x9'),auth[_0x29a0('0x7')](),controller[_0x29a0('0x1f')]);router[_0x29a0('0x20')]('/:id',auth[_0x29a0('0x7')](),controller['destroy']);router['delete'](_0x29a0('0xb'),auth[_0x29a0('0x7')](),controller['removeDispositions']);router[_0x29a0('0x20')](_0x29a0('0x15'),auth[_0x29a0('0x7')](),controller['removeAnswers']);router[_0x29a0('0x20')]('/:id/users',auth[_0x29a0('0x7')](),controller[_0x29a0('0x21')]);module[_0x29a0('0x22')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 87db651..47d0ec8 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 _0xbc17=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','generate','ENUM','skebby','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN'];(function(_0x4882c9,_0x3c0b40){var _0x3fab3c=function(_0x4b13b5){while(--_0x4b13b5){_0x4882c9['push'](_0x4882c9['shift']());}};_0x3fab3c(++_0x3c0b40);}(_0xbc17,0xee));var _0x7bc1=function(_0x31cdff,_0x545438){_0x31cdff=_0x31cdff-0x0;var _0x14091f=_0xbc17[_0x31cdff];return _0x14091f;};'use strict';var Sequelize=require(_0x7bc1('0x0'));var rs=require(_0x7bc1('0x1'));module[_0x7bc1('0x2')]={'name':{'type':Sequelize[_0x7bc1('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x7bc1('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x7bc1('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7bc1('0x4')]();}},'phone':{'type':Sequelize[_0x7bc1('0x3')]},'type':{'type':Sequelize[_0x7bc1('0x5')]('twilio',_0x7bc1('0x6'),'connectel',_0x7bc1('0x7'),_0x7bc1('0x8'),_0x7bc1('0x9'),_0x7bc1('0xa'),_0x7bc1('0xb'),_0x7bc1('0xc'))},'accountSid':{'type':Sequelize[_0x7bc1('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x7bc1('0x3')]},'smsMethod':{'type':Sequelize[_0x7bc1('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x7bc1('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x7bc1('0x3')]},'senderString':{'type':Sequelize[_0x7bc1('0x3')]},'deliveryReport':{'type':Sequelize[_0x7bc1('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x7bc1('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7bc1('0xe')],'defaultValue':function(){return _0x7bc1('0xf');}},'notificationSound':{'type':Sequelize[_0x7bc1('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7bc1('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7bc1('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7bc1('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7bc1('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7bc1('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x7bc1('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7bc1('0x10')],'comment':_0x7bc1('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7bc1('0x12'),'set':function(_0x168d5b){if(!_0x168d5b)this[_0x7bc1('0x13')](_0x7bc1('0x14'),null);this[_0x7bc1('0x13')]('mandatoryDisposition',_0x168d5b);}}}; \ No newline at end of file +var _0x9170=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','clickatell','csc','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9170,0x9f));var _0x0917=function(_0x50233f,_0x463f10){_0x50233f=_0x50233f-0x0;var _0x2ff4d5=_0x9170[_0x50233f];return _0x2ff4d5;};'use strict';var Sequelize=require(_0x0917('0x0'));var rs=require(_0x0917('0x1'));module[_0x0917('0x2')]={'name':{'type':Sequelize[_0x0917('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x0917('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x0917('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0917('0x4')]();}},'phone':{'type':Sequelize[_0x0917('0x3')]},'type':{'type':Sequelize[_0x0917('0x5')](_0x0917('0x6'),_0x0917('0x7'),_0x0917('0x8'),_0x0917('0x9'),'plivo',_0x0917('0xa'),_0x0917('0xb'),'infobip',_0x0917('0xc'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x0917('0x3')]},'authToken':{'type':Sequelize[_0x0917('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x0917('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x0917('0x3')]},'senderString':{'type':Sequelize[_0x0917('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x0917('0x3')]},'notificationTemplate':{'type':Sequelize[_0x0917('0xd')],'defaultValue':function(){return _0x0917('0xe');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0917('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0917('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0917('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x0917('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0917('0x10')],'comment':_0x0917('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0917('0x12'),'set':function(_0x2fb127){if(!_0x2fb127)this[_0x0917('0x13')](_0x0917('0x14'),null);this[_0x0917('0x13')](_0x0917('0x15'),_0x2fb127);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index f4a5c0b..26fbefd 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 _0x6931=['../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','test','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','attributes','intersection','length','query','nolimit','limit','order','sort','filters','filter','where','VIRTUAL','merge','options','include','findAll','params','fields','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','body','describe','SmsAccountId','Disposition','getDispositions','hasOwnProperty','pick','rows','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','message_id','plivo','Text','results','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','updatedAt','DESC','list','Contacts','contact','SmsInteraction','spread','interaction','created','autoclose','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','set','Content-Type','\x0a','sequelize','findAndCountAll','getApplications','Contact','User','Owner','fullname','internal','Tags','color','tag','send','List','user','out','Messages','dataValues','push','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','redif','DELIVERED','error_code','clickatell','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','state','message-id','addAgents','omit','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4afcf1,_0x1f34e0){var _0x377f36=function(_0x2969ed){while(--_0x2969ed){_0x4afcf1['push'](_0x4afcf1['shift']());}};_0x377f36(++_0x1f34e0);}(_0x6931,0x1a9));var _0x1693=function(_0x23c297,_0x4a1467){_0x23c297=_0x23c297-0x0;var _0x542435=_0x6931[_0x23c297];return _0x542435;};'use strict';var pdf=require(_0x1693('0x0'));var emlformat=require(_0x1693('0x1'));var rimraf=require(_0x1693('0x2'));var zipdir=require(_0x1693('0x3'));var jsonpatch=require(_0x1693('0x4'));var rp=require(_0x1693('0x5'));var moment=require(_0x1693('0x6'));var BPromise=require(_0x1693('0x7'));var Mustache=require('mustache');var util=require(_0x1693('0x8'));var path=require(_0x1693('0x9'));var sox=require(_0x1693('0xa'));var csv=require(_0x1693('0xb'));var ejs=require(_0x1693('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1693('0xd'));var crypto=require(_0x1693('0xe'));var jsforce=require(_0x1693('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x1693('0xb'));var querystring=require(_0x1693('0x10'));var Papa=require(_0x1693('0x11'));var Redis=require(_0x1693('0x12'));var authService=require(_0x1693('0x13'));var qs=require(_0x1693('0x14'));var as=require(_0x1693('0x15'));var hardwareService=require(_0x1693('0x16'));var logger=require(_0x1693('0x17'))(_0x1693('0x18'));var utils=require(_0x1693('0x19'));var config=require('../../config/environment');var db=require(_0x1693('0x1a'))['db'];config[_0x1693('0x1b')]=_[_0x1693('0x1c')](config[_0x1693('0x1b')],{'host':_0x1693('0x1d'),'port':0x18eb});var socket=require(_0x1693('0x1e'))(new Redis(config[_0x1693('0x1b')]));require('./smsAccount.socket')[_0x1693('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1693('0x20')]['http']({'port':0x232c});function checkPasswordPattern(_0x6704d4,_0x380cf5,_0x4db220){if(_0x4db220){var _0x5a4fb3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a4fb3[_0x1693('0x21')](_0x380cf5)){return _0x6704d4;}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 _0x6704d4;}}function respondWithRpcPromise(_0x1eb3ef,_0x4b8bb2,_0x49e7fb,_0x2a3bc2){return new BPromise(function(_0x1a270b,_0x7ef2){var _0xdd00ed=_0x2a3bc2||client;return _0xdd00ed[_0x1693('0x22')](_0x1eb3ef,_0x49e7fb)[_0x1693('0x23')](function(_0x4c3977){logger['info'](_0x1693('0x24'),_0x4b8bb2,_0x1693('0x25'));logger['debug'](_0x1693('0x26'),_0x4b8bb2,_0x1693('0x25'),JSON[_0x1693('0x27')](_0x4c3977));if(_0x4c3977[_0x1693('0x28')]){if(_0x4c3977[_0x1693('0x28')]['code']===0x1f4){logger[_0x1693('0x28')](_0x1693('0x24'),_0x4b8bb2,_0x4c3977[_0x1693('0x28')][_0x1693('0x29')]);return _0x7ef2(_0x4c3977[_0x1693('0x28')][_0x1693('0x29')]);}logger['error'](_0x1693('0x24'),_0x4b8bb2,_0x4c3977['error'][_0x1693('0x29')]);return _0x1a270b(_0x4c3977[_0x1693('0x28')][_0x1693('0x29')]);}else{logger['info'](_0x1693('0x24'),_0x4b8bb2,_0x1693('0x25'));_0x1a270b(_0x4c3977[_0x1693('0x2a')][_0x1693('0x29')]);}})[_0x1693('0x2b')](function(_0x459c39){logger[_0x1693('0x28')]('SmsAccount,\x20%s,\x20%s',_0x4b8bb2,_0x459c39);_0x7ef2(_0x459c39);});});}function respondWithStatusCode(_0x2d0806,_0x4ef8eb){_0x4ef8eb=_0x4ef8eb||0xcc;return function(_0x3e7ccf){if(_0x3e7ccf){return _0x2d0806['sendStatus'](_0x4ef8eb);}return _0x2d0806[_0x1693('0x2c')](_0x4ef8eb)[_0x1693('0x2d')]();};}function respondWithResult(_0x437eb9,_0x148438){_0x148438=_0x148438||0xc8;return function(_0x5888d7){if(_0x5888d7){return _0x437eb9[_0x1693('0x2c')](_0x148438)[_0x1693('0x2e')](_0x5888d7);}};}function respondWithFilteredResult(_0x5484d4,_0x48f0c5){return function(_0x372585){if(_0x372585){var _0x48ea39=_0x372585[_0x1693('0x2f')],_0x4ea713=_0x48f0c5['offset'],_0x5ce409=_0x48f0c5[_0x1693('0x30')]+_0x48f0c5['limit'],_0x2e3bf8;if(_0x5ce409>=_0x48ea39){_0x5ce409=_0x48ea39;_0x2e3bf8=0xc8;}else{_0x2e3bf8=0xce;}_0x5484d4[_0x1693('0x2c')](_0x2e3bf8);return _0x5484d4['set'](_0x1693('0x31'),_0x4ea713+'-'+_0x5ce409+'/'+_0x48ea39)[_0x1693('0x2e')](_0x372585);}return null;};}function patchUpdates(_0x15a9a8){return function(_0x5b4c17){try{jsonpatch[_0x1693('0x32')](_0x5b4c17,_0x15a9a8,!![]);}catch(_0x43fd01){return BPromise[_0x1693('0x33')](_0x43fd01);}return _0x5b4c17[_0x1693('0x34')]();};}function saveUpdates(_0x459a86,_0x30ee2b){return function(_0x26c86f){if(_0x26c86f){return _0x26c86f[_0x1693('0x35')](_0x459a86)[_0x1693('0x23')](function(_0x3e9dd5){return _0x3e9dd5;});}return null;};}function removeEntity(_0x37b8ec,_0x21c346){return function(_0x4c4c65){if(_0x4c4c65){return _0x4c4c65[_0x1693('0x36')]()['then'](function(){var _0xfa23ff=_0x4c4c65[_0x1693('0x37')]({'plain':!![]});var _0xe94f0b=_0x1693('0x38');return db[_0x1693('0x39')][_0x1693('0x36')]({'where':{'type':_0xe94f0b,'resourceId':_0xfa23ff['id']}})[_0x1693('0x23')](function(){return _0x4c4c65;});})[_0x1693('0x23')](function(){_0x37b8ec[_0x1693('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x163731,_0x10bfbc){return function(_0x15cf6a){if(!_0x15cf6a){_0x163731[_0x1693('0x3a')](0x194);}return _0x15cf6a;};}function handleError(_0x355c70,_0x3b37a1){_0x3b37a1=_0x3b37a1||0x1f4;return function(_0x3a49cf){logger[_0x1693('0x28')](_0x3a49cf[_0x1693('0x3b')]);if(_0x3a49cf[_0x1693('0x3c')]){delete _0x3a49cf['name'];}_0x355c70['status'](_0x3b37a1)['send'](_0x3a49cf);};}exports[_0x1693('0x3d')]=function(_0x2f1f6e,_0x36ce16){var _0x2eb8da={'include':[{'model':db[_0x1693('0x3e')],'as':_0x1693('0x3f')}]},_0x361330={},_0x4a5462={'count':0x0,'rows':[]};var _0x1502a1=_[_0x1693('0x40')](db[_0x1693('0x41')][_0x1693('0x42')],function(_0x4a6455){return{'name':_0x4a6455[_0x1693('0x43')],'type':_0x4a6455[_0x1693('0x44')][_0x1693('0x45')]};});_0x361330[_0x1693('0x46')]=_[_0x1693('0x40')](_0x1502a1,_0x1693('0x3c'));_0x361330['query']=_[_0x1693('0x47')](_0x2f1f6e['query']);_0x361330['filters']=_['intersection'](_0x361330['model'],_0x361330['query']);_0x2eb8da[_0x1693('0x48')]=_[_0x1693('0x49')](_0x361330[_0x1693('0x46')],qs['fields'](_0x2f1f6e['query']['fields']));_0x2eb8da[_0x1693('0x48')]=_0x2eb8da[_0x1693('0x48')][_0x1693('0x4a')]?_0x2eb8da['attributes']:_0x361330[_0x1693('0x46')];if(!_0x2f1f6e[_0x1693('0x4b')]['hasOwnProperty'](_0x1693('0x4c'))){_0x2eb8da['limit']=qs[_0x1693('0x4d')](_0x2f1f6e[_0x1693('0x4b')][_0x1693('0x4d')]);_0x2eb8da['offset']=qs[_0x1693('0x30')](_0x2f1f6e['query'][_0x1693('0x30')]);}_0x2eb8da[_0x1693('0x4e')]=qs[_0x1693('0x4f')](_0x2f1f6e[_0x1693('0x4b')][_0x1693('0x4f')]);_0x2eb8da['where']=qs['filters'](_['pick'](_0x2f1f6e[_0x1693('0x4b')],_0x361330[_0x1693('0x50')]));if(_0x2f1f6e[_0x1693('0x4b')][_0x1693('0x51')]){_0x2eb8da[_0x1693('0x52')]=_['merge'](_0x2eb8da[_0x1693('0x52')],{'$or':_[_0x1693('0x40')](_0x1502a1,function(_0x4614e1){if(_0x4614e1[_0x1693('0x44')]!==_0x1693('0x53')){var _0x4ae5d8={};_0x4ae5d8[_0x4614e1['name']]={'$like':'%'+_0x2f1f6e[_0x1693('0x4b')][_0x1693('0x51')]+'%'};return _0x4ae5d8;}})});}_0x2eb8da=_[_0x1693('0x54')]({},_0x2eb8da,_0x2f1f6e[_0x1693('0x55')]);var _0x4743d0={'where':_0x2eb8da['where']};return db['SmsAccount'][_0x1693('0x2f')](_0x4743d0)[_0x1693('0x23')](function(_0x57d3ea){_0x4a5462[_0x1693('0x2f')]=_0x57d3ea;if(_0x2f1f6e[_0x1693('0x4b')]['includeAll']){_0x2eb8da[_0x1693('0x56')]=[{'all':!![]}];}return db[_0x1693('0x41')][_0x1693('0x57')](_0x2eb8da);})[_0x1693('0x23')](function(_0x1e3a52){_0x4a5462['rows']=_0x1e3a52;return _0x4a5462;})[_0x1693('0x23')](respondWithFilteredResult(_0x36ce16,_0x2eb8da))['catch'](handleError(_0x36ce16,null));};exports['show']=function(_0x48d822,_0x178434){var _0x58696b={'raw':![],'where':{'id':_0x48d822[_0x1693('0x58')]['id']},'include':[{'model':db[_0x1693('0x3e')],'as':_0x1693('0x3f')}]},_0x4d7f9c={};_0x4d7f9c[_0x1693('0x46')]=_[_0x1693('0x47')](db[_0x1693('0x41')][_0x1693('0x42')]);_0x4d7f9c['query']=_['keys'](_0x48d822['query']);_0x4d7f9c[_0x1693('0x50')]=_[_0x1693('0x49')](_0x4d7f9c[_0x1693('0x46')],_0x4d7f9c['query']);_0x58696b[_0x1693('0x48')]=_[_0x1693('0x49')](_0x4d7f9c['model'],qs[_0x1693('0x59')](_0x48d822[_0x1693('0x4b')][_0x1693('0x59')]));_0x58696b['attributes']=_0x58696b[_0x1693('0x48')][_0x1693('0x4a')]?_0x58696b[_0x1693('0x48')]:_0x4d7f9c[_0x1693('0x46')];if(_0x48d822[_0x1693('0x4b')][_0x1693('0x5a')]){_0x58696b[_0x1693('0x56')]=[{'all':!![]}];}_0x58696b=_[_0x1693('0x54')]({},_0x58696b,_0x48d822[_0x1693('0x55')]);return db[_0x1693('0x41')]['find'](_0x58696b)[_0x1693('0x23')](handleEntityNotFound(_0x178434,null))[_0x1693('0x23')](respondWithResult(_0x178434,null))[_0x1693('0x2b')](handleError(_0x178434,null));};exports[_0x1693('0x5b')]=function(_0x45a1d2,_0x51f25b){return db[_0x1693('0x41')]['create'](_0x45a1d2['body'],{})[_0x1693('0x23')](function(_0x4983ac){var _0x50cebf=_0x45a1d2['user'][_0x1693('0x37')]({'plain':!![]});if(!_0x50cebf)throw new Error(_0x1693('0x5c'));if(_0x50cebf[_0x1693('0x5d')]==='user'){var _0x434987=_0x4983ac[_0x1693('0x37')]({'plain':!![]});var _0x2c54b6=_0x1693('0x38');return db[_0x1693('0x5e')][_0x1693('0x5f')]({'where':{'name':_0x2c54b6,'userProfileId':_0x50cebf['userProfileId']},'raw':!![]})[_0x1693('0x23')](function(_0x28df3e){if(_0x28df3e&&_0x28df3e[_0x1693('0x60')]===0x0){return db[_0x1693('0x39')][_0x1693('0x5b')]({'name':_0x434987['name'],'resourceId':_0x434987['id'],'type':_0x28df3e['name'],'sectionId':_0x28df3e['id']},{})['then'](function(){return _0x4983ac;});}else{return _0x4983ac;}})['catch'](function(_0x10a19c){logger[_0x1693('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10a19c);throw _0x10a19c;});}return _0x4983ac;})[_0x1693('0x23')](respondWithResult(_0x51f25b,0xc9))[_0x1693('0x2b')](handleError(_0x51f25b,null));};exports[_0x1693('0x35')]=function(_0x1e29b6,_0xe4d730){if(_0x1e29b6[_0x1693('0x61')]['id']){delete _0x1e29b6['body']['id'];}return db[_0x1693('0x41')]['find']({'where':{'id':_0x1e29b6['params']['id']},'include':[{'model':db[_0x1693('0x3e')],'as':_0x1693('0x3f')}]})[_0x1693('0x23')](handleEntityNotFound(_0xe4d730,null))[_0x1693('0x23')](saveUpdates(_0x1e29b6[_0x1693('0x61')],null))['then'](respondWithResult(_0xe4d730,null))[_0x1693('0x2b')](handleError(_0xe4d730,null));};exports[_0x1693('0x36')]=function(_0x3e6469,_0x439c36){return db[_0x1693('0x41')]['find']({'where':{'id':_0x3e6469[_0x1693('0x58')]['id']}})[_0x1693('0x23')](handleEntityNotFound(_0x439c36,null))[_0x1693('0x23')](removeEntity(_0x439c36,null))[_0x1693('0x2b')](handleError(_0x439c36,null));};exports['describe']=function(_0x2a309c,_0x12f40d){return db[_0x1693('0x41')][_0x1693('0x62')]()[_0x1693('0x23')](respondWithResult(_0x12f40d,null))[_0x1693('0x2b')](handleError(_0x12f40d,null));};exports['addDisposition']=function(_0x5bd7c4,_0x52f1a1,_0x6909bf){if(_0x5bd7c4[_0x1693('0x61')]['id']){delete _0x5bd7c4['body']['id'];}return db[_0x1693('0x41')][_0x1693('0x5f')]({'where':{'id':_0x5bd7c4['params']['id']}})[_0x1693('0x23')](handleEntityNotFound(_0x52f1a1,null))['then'](function(_0xec49ff){if(_0xec49ff){_0x5bd7c4[_0x1693('0x61')][_0x1693('0x63')]=_0xec49ff['id'];return db[_0x1693('0x64')][_0x1693('0x5b')](_0x5bd7c4[_0x1693('0x61')]);}})[_0x1693('0x23')](respondWithResult(_0x52f1a1,null))[_0x1693('0x2b')](handleError(_0x52f1a1,null));};exports[_0x1693('0x65')]=function(_0x584a14,_0x3753c3,_0x4c651d){var _0x4f5bdf={'raw':![],'where':{}};var _0x1efe8a={};var _0x11c164={'count':0x0,'rows':[]};return db[_0x1693('0x41')]['findOne']({'where':{'id':_0x584a14[_0x1693('0x58')]['id']}})['then'](handleEntityNotFound(_0x3753c3,null))[_0x1693('0x23')](function(_0x2bc97c){if(_0x2bc97c){_0x1efe8a[_0x1693('0x46')]=_['keys'](db['Disposition'][_0x1693('0x42')]);_0x1efe8a[_0x1693('0x4b')]=_[_0x1693('0x47')](_0x584a14['query']);_0x1efe8a[_0x1693('0x50')]=_['intersection'](_0x1efe8a[_0x1693('0x46')],_0x1efe8a[_0x1693('0x4b')]);_0x4f5bdf[_0x1693('0x48')]=_[_0x1693('0x49')](_0x1efe8a['model'],qs[_0x1693('0x59')](_0x584a14[_0x1693('0x4b')][_0x1693('0x59')]));_0x4f5bdf[_0x1693('0x48')]=_0x4f5bdf[_0x1693('0x48')][_0x1693('0x4a')]?_0x4f5bdf[_0x1693('0x48')]:_0x1efe8a[_0x1693('0x46')];if(!_0x584a14[_0x1693('0x4b')][_0x1693('0x66')](_0x1693('0x4c'))){_0x4f5bdf[_0x1693('0x4d')]=qs[_0x1693('0x4d')](_0x584a14[_0x1693('0x4b')][_0x1693('0x4d')]);_0x4f5bdf[_0x1693('0x30')]=qs['offset'](_0x584a14['query'][_0x1693('0x30')]);}_0x4f5bdf[_0x1693('0x4e')]=qs['sort'](_0x584a14[_0x1693('0x4b')][_0x1693('0x4f')]);_0x4f5bdf[_0x1693('0x52')]=qs['filters'](_[_0x1693('0x67')](_0x584a14[_0x1693('0x4b')],_0x1efe8a[_0x1693('0x50')]));_0x4f5bdf[_0x1693('0x52')][_0x1693('0x63')]=_0x2bc97c['id'];if(_0x584a14[_0x1693('0x4b')][_0x1693('0x51')]){_0x4f5bdf[_0x1693('0x52')]=_['merge'](_0x4f5bdf[_0x1693('0x52')],{'$or':_['map'](_0x4f5bdf[_0x1693('0x48')],function(_0x442af0){var _0x1e7554={};_0x1e7554[_0x442af0]={'$like':'%'+_0x584a14[_0x1693('0x4b')]['filter']+'%'};return _0x1e7554;})});}_0x4f5bdf=_[_0x1693('0x54')]({},_0x4f5bdf,_0x584a14['options']);return db[_0x1693('0x64')][_0x1693('0x2f')]({'where':_0x4f5bdf[_0x1693('0x52')]})[_0x1693('0x23')](function(_0x282ed8){_0x11c164[_0x1693('0x2f')]=_0x282ed8;if(_0x584a14[_0x1693('0x4b')][_0x1693('0x5a')]){_0x4f5bdf['include']=[{'all':!![]}];}return db[_0x1693('0x64')]['findAll'](_0x4f5bdf);})['then'](function(_0x1c89e4){_0x11c164[_0x1693('0x68')]=_0x1c89e4;return _0x11c164;});}})[_0x1693('0x23')](respondWithFilteredResult(_0x3753c3,_0x4f5bdf))[_0x1693('0x2b')](handleError(_0x3753c3,null));};exports[_0x1693('0x69')]=function(_0x5c9a85,_0x58c1c6,_0x46ceba){return db[_0x1693('0x41')][_0x1693('0x5f')]({'where':{'id':_0x5c9a85[_0x1693('0x58')]['id']}})[_0x1693('0x23')](handleEntityNotFound(_0x58c1c6,null))['then'](function(_0x4492fb){if(_0x4492fb){return _0x4492fb[_0x1693('0x69')](_0x5c9a85[_0x1693('0x4b')][_0x1693('0x6a')]);}})[_0x1693('0x23')](respondWithStatusCode(_0x58c1c6,null))['catch'](handleError(_0x58c1c6,null));};exports[_0x1693('0x6b')]=function(_0x1ff6d5,_0x237fd8,_0xa2adc4){if(_0x1ff6d5[_0x1693('0x61')]['id']){delete _0x1ff6d5[_0x1693('0x61')]['id'];}return db[_0x1693('0x41')]['find']({'where':{'id':_0x1ff6d5[_0x1693('0x58')]['id']}})[_0x1693('0x23')](handleEntityNotFound(_0x237fd8,null))[_0x1693('0x23')](function(_0x535d7a){if(_0x535d7a){_0x1ff6d5[_0x1693('0x61')][_0x1693('0x63')]=_0x535d7a['id'];return db['CannedAnswer'][_0x1693('0x5b')](_0x1ff6d5[_0x1693('0x61')]);}})[_0x1693('0x23')](respondWithResult(_0x237fd8,null))['catch'](handleError(_0x237fd8,null));};exports[_0x1693('0x6c')]=function(_0x5a3922,_0x1f721d,_0x38fbc2){var _0x35b96d={'raw':![],'where':{}};var _0x20901a={};var _0x33e2e1={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1693('0x6d')]({'where':{'id':_0x5a3922[_0x1693('0x58')]['id']}})[_0x1693('0x23')](handleEntityNotFound(_0x1f721d,null))['then'](function(_0x533612){if(_0x533612){_0x20901a[_0x1693('0x46')]=_[_0x1693('0x47')](db['CannedAnswer'][_0x1693('0x42')]);_0x20901a['query']=_[_0x1693('0x47')](_0x5a3922[_0x1693('0x4b')]);_0x20901a['filters']=_[_0x1693('0x49')](_0x20901a['model'],_0x20901a['query']);_0x35b96d[_0x1693('0x48')]=_[_0x1693('0x49')](_0x20901a['model'],qs['fields'](_0x5a3922[_0x1693('0x4b')][_0x1693('0x59')]));_0x35b96d['attributes']=_0x35b96d[_0x1693('0x48')][_0x1693('0x4a')]?_0x35b96d[_0x1693('0x48')]:_0x20901a['model'];if(!_0x5a3922['query'][_0x1693('0x66')](_0x1693('0x4c'))){_0x35b96d[_0x1693('0x4d')]=qs[_0x1693('0x4d')](_0x5a3922[_0x1693('0x4b')][_0x1693('0x4d')]);_0x35b96d[_0x1693('0x30')]=qs['offset'](_0x5a3922['query'][_0x1693('0x30')]);}_0x35b96d[_0x1693('0x4e')]=qs[_0x1693('0x4f')](_0x5a3922[_0x1693('0x4b')][_0x1693('0x4f')]);_0x35b96d['where']=qs['filters'](_['pick'](_0x5a3922[_0x1693('0x4b')],_0x20901a[_0x1693('0x50')]));_0x35b96d[_0x1693('0x52')]['SmsAccountId']=_0x533612['id'];if(_0x5a3922['query'][_0x1693('0x51')]){_0x35b96d['where']=_[_0x1693('0x54')](_0x35b96d[_0x1693('0x52')],{'$or':_['map'](_0x35b96d[_0x1693('0x48')],function(_0x1807fa){var _0x447818={};_0x447818[_0x1807fa]={'$like':'%'+_0x5a3922[_0x1693('0x4b')][_0x1693('0x51')]+'%'};return _0x447818;})});}_0x35b96d=_[_0x1693('0x54')]({},_0x35b96d,_0x5a3922[_0x1693('0x55')]);return db[_0x1693('0x6e')][_0x1693('0x2f')]({'where':_0x35b96d[_0x1693('0x52')]})[_0x1693('0x23')](function(_0x545ab8){_0x33e2e1[_0x1693('0x2f')]=_0x545ab8;if(_0x5a3922[_0x1693('0x4b')]['includeAll']){_0x35b96d[_0x1693('0x56')]=[{'all':!![]}];}return db[_0x1693('0x6e')][_0x1693('0x57')](_0x35b96d);})[_0x1693('0x23')](function(_0x35bbea){_0x33e2e1[_0x1693('0x68')]=_0x35bbea;return _0x33e2e1;});}})[_0x1693('0x23')](respondWithFilteredResult(_0x1f721d,_0x35b96d))[_0x1693('0x2b')](handleError(_0x1f721d,null));};exports[_0x1693('0x6f')]=function(_0x166887,_0x2a10f9,_0x4de909){return db[_0x1693('0x41')][_0x1693('0x5f')]({'where':{'id':_0x166887[_0x1693('0x58')]['id']}})[_0x1693('0x23')](handleEntityNotFound(_0x2a10f9,null))[_0x1693('0x23')](function(_0x35681a){if(_0x35681a){return _0x35681a[_0x1693('0x6f')](_0x166887[_0x1693('0x4b')][_0x1693('0x6a')]);}})[_0x1693('0x23')](respondWithStatusCode(_0x2a10f9,null))['catch'](handleError(_0x2a10f9,null));};exports['notify']=function(_0x7dc835,_0x4936cb,_0x921c42){var _0x4d7d3f={'channel':_0x1693('0x70')};var _0x51c8c6=[];var _0x5b224a=[];var _0x19abe8={};return db[_0x1693('0x41')][_0x1693('0x5f')]({'where':{'id':_0x7dc835[_0x1693('0x58')]['id']},'include':[{'model':db[_0x1693('0x71')],'as':_0x1693('0x72')}]})[_0x1693('0x23')](handleEntityNotFound(_0x4936cb,null))[_0x1693('0x23')](function(_0x314ff6){_0x4d7d3f[_0x1693('0x73')]=_0x314ff6;_0x4d7d3f[_0x1693('0x74')]=_[_0x1693('0x75')](_0x314ff6['Applications'],[_0x1693('0x76')],[_0x1693('0x77')]);if(_0x4d7d3f[_0x1693('0x73')][_0x1693('0x72')]){delete _0x4d7d3f['account'][_0x1693('0x72')];}return db[_0x1693('0x78')][_0x1693('0x62')]();})[_0x1693('0x23')](function(_0x470b20){if(!_0x470b20){throw new db[(_0x1693('0x79'))][(_0x1693('0x7a'))](_0x1693('0x7b'));}_0x51c8c6=_[_0x1693('0x7c')](_['keys'](_0x470b20),[_0x1693('0x7d'),'updatedAt']);_0x5b224a=_[_0x1693('0x7c')](_[_0x1693('0x47')](_0x470b20),['createdAt','updatedAt',_0x1693('0x7e'),'ListId']);_0x4d7d3f['body']={'mapKey':'mobile'};if(_0x4d7d3f[_0x1693('0x73')][_0x1693('0x44')]){switch(_0x4d7d3f[_0x1693('0x73')][_0x1693('0x44')]){case'twilio':_0x4d7d3f[_0x1693('0x61')][_0x1693('0x7f')]=_0x7dc835[_0x1693('0x61')][_0x1693('0x80')];_0x4d7d3f[_0x1693('0x61')][_0x1693('0x61')]=_0x7dc835[_0x1693('0x61')][_0x1693('0x81')];_0x4d7d3f[_0x1693('0x61')][_0x1693('0x82')]=_0x7dc835[_0x1693('0x61')][_0x1693('0x83')];break;case _0x1693('0x84'):_0x4d7d3f['body'][_0x1693('0x7f')]='+'+_0x7dc835[_0x1693('0x61')][_0x1693('0x85')];_0x4d7d3f['body']['body']=_0x7dc835[_0x1693('0x61')][_0x1693('0x86')];break;case _0x1693('0x87'):_0x4d7d3f[_0x1693('0x61')][_0x1693('0x7f')]=_0x7dc835[_0x1693('0x61')][_0x1693('0x7f')];_0x4d7d3f[_0x1693('0x61')][_0x1693('0x61')]=_0x7dc835[_0x1693('0x61')][_0x1693('0x29')];break;case _0x1693('0x88'):_0x4d7d3f['body'][_0x1693('0x7f')]=_0x7dc835['body'][_0x1693('0x7f')];_0x4d7d3f['body']['body']=_0x7dc835['body'][_0x1693('0x61')];_0x4d7d3f[_0x1693('0x61')]['messageId']=_0x7dc835[_0x1693('0x61')][_0x1693('0x89')];break;case _0x1693('0x8a'):_0x4d7d3f[_0x1693('0x61')][_0x1693('0x7f')]=_0x7dc835[_0x1693('0x61')][_0x1693('0x80')];_0x4d7d3f[_0x1693('0x61')]['body']=_0x7dc835[_0x1693('0x61')][_0x1693('0x8b')];_0x4d7d3f[_0x1693('0x61')][_0x1693('0x82')]=_0x7dc835['body']['MessageUUID'];break;case'infobip':_0x4d7d3f[_0x1693('0x61')][_0x1693('0x7f')]='+'+_0x7dc835[_0x1693('0x61')][_0x1693('0x8c')][0x0][_0x1693('0x7f')];_0x4d7d3f[_0x1693('0x61')]['body']=_0x7dc835[_0x1693('0x61')]['results'][0x0]['text'];_0x4d7d3f[_0x1693('0x61')]['messageId']=_0x7dc835['body'][_0x1693('0x8c')][0x0][_0x1693('0x82')];break;case _0x1693('0x8d'):_0x4d7d3f[_0x1693('0x61')][_0x1693('0x7f')]=_0x7dc835[_0x1693('0x61')][_0x1693('0x8e')];_0x4d7d3f[_0x1693('0x61')][_0x1693('0x61')]=_0x7dc835[_0x1693('0x61')][_0x1693('0x8f')]['message'];break;case'clickatell':_0x4d7d3f[_0x1693('0x61')][_0x1693('0x7f')]=_0x7dc835[_0x1693('0x61')][_0x1693('0x90')];_0x4d7d3f[_0x1693('0x61')][_0x1693('0x61')]=_0x7dc835[_0x1693('0x61')]['text'];_0x4d7d3f[_0x1693('0x61')][_0x1693('0x82')]=_0x7dc835[_0x1693('0x61')][_0x1693('0x91')];break;case _0x1693('0x92'):_0x4d7d3f[_0x1693('0x61')][_0x1693('0x7f')]=_0x7dc835[_0x1693('0x61')]['from'];_0x4d7d3f[_0x1693('0x61')][_0x1693('0x61')]=_0x7dc835[_0x1693('0x61')][_0x1693('0x29')];_0x4d7d3f[_0x1693('0x61')][_0x1693('0x82')]=_0x7dc835[_0x1693('0x61')][_0x1693('0x93')];break;}}if(_0x4d7d3f[_0x1693('0x61')]['id']){delete _0x4d7d3f[_0x1693('0x61')]['id'];}if(_[_0x1693('0x94')](_0x4d7d3f[_0x1693('0x61')][_0x1693('0x7f')])){throw new db[(_0x1693('0x79'))][(_0x1693('0x7a'))](_0x1693('0x95'));}if(_['isNil'](_0x4d7d3f[_0x1693('0x61')][_0x1693('0x61')])||_0x4d7d3f[_0x1693('0x61')]['body']===''){throw new db['Sequelize'][(_0x1693('0x7a'))](_0x1693('0x96'));}if(_[_0x1693('0x94')](_0x4d7d3f[_0x1693('0x61')][_0x1693('0x97')])){throw new db['Sequelize'][(_0x1693('0x7a'))](_0x1693('0x98')+_0x5b224a);}if(!_[_0x1693('0x99')](_0x5b224a,_0x4d7d3f[_0x1693('0x61')][_0x1693('0x97')])){throw new db[(_0x1693('0x79'))][(_0x1693('0x7a'))](_0x1693('0x9a')+_0x5b224a);}_0x19abe8[_0x4d7d3f[_0x1693('0x61')][_0x1693('0x97')]]=_0x4d7d3f['body']['from'];return db[_0x1693('0x9b')][_0x1693('0x5f')]({'where':{'id':_0x4d7d3f['account']['ListId']},'include':[{'model':db[_0x1693('0x78')],'as':'Contacts','where':_0x19abe8,'limit':0x1,'order':[[_0x1693('0x9c'),_0x1693('0x9d')]]}]});})[_0x1693('0x23')](handleEntityNotFound(_0x4936cb,null))[_0x1693('0x23')](function(_0x335a46){if(_0x335a46){_0x4d7d3f[_0x1693('0x9e')]=_['omit'](_0x335a46,[_0x1693('0x9f')]);if(_0x335a46[_0x1693('0x9f')][_0x1693('0x4a')]){return _0x335a46[_0x1693('0x9f')][0x0];}var _0x519b5f=_[_0x1693('0x1c')](_0x4d7d3f[_0x1693('0x61')],{'firstName':_0x4d7d3f[_0x1693('0x61')][_0x1693('0x7f')],'ListId':_0x335a46['id']});_0x519b5f[_0x4d7d3f[_0x1693('0x61')][_0x1693('0x97')]]=_0x4d7d3f[_0x1693('0x61')][_0x1693('0x7f')];return db[_0x1693('0x78')][_0x1693('0x5b')](_0x519b5f,{'fields':_0x51c8c6,'raw':!![]});}})['then'](handleEntityNotFound(_0x4936cb,null))[_0x1693('0x23')](function(_0x3f8122){if(_0x3f8122){_0x4d7d3f[_0x1693('0xa0')]=_0x3f8122;var _0x594ba2={'ContactId':_0x3f8122['id'],'phone':_0x4d7d3f['body']['from'],'SmsAccountId':_0x7dc835[_0x1693('0x58')]['id']};var _0x4318fe={'ContactId':_0x3f8122['id'],'SmsAccountId':_0x7dc835[_0x1693('0x58')]['id'],'closed':![]};return db[_0x1693('0xa1')]['find']({'where':_0x4318fe})[_0x1693('0x23')](function(_0x38df20){if(_0x38df20){return[_0x38df20,![]];}return db[_0x1693('0xa1')]['create'](_0x594ba2)[_0x1693('0x23')](function(_0x57a9ac){return[_0x57a9ac,!![]];});});}})[_0x1693('0xa2')](function(_0x5b6900,_0x20a6aa){_0x4d7d3f[_0x1693('0xa3')]=_0x5b6900[_0x1693('0x37')]({'plain':!![]});_0x4d7d3f[_0x1693('0xa3')][_0x1693('0xa4')]=![];if(_0x20a6aa){if(_0x4d7d3f['account'][_0x1693('0xa5')]){_0x4d7d3f['applications']['push']({'id':0x0,'priority':_0x4d7d3f[_0x1693('0x74')][_0x1693('0x4a')]+0x1,'app':'close','appdata':_0x1693('0xa6'),'interval':_0x1693('0xa7')});}_0x4d7d3f['interaction'][_0x1693('0xa4')]=!![];}return db[_0x1693('0xa8')][_0x1693('0x5b')]({'phone':_0x4d7d3f[_0x1693('0x61')][_0x1693('0x7f')],'messageId':_0x4d7d3f[_0x1693('0x61')]['messageId'],'body':_0x4d7d3f['body'][_0x1693('0x61')],'SmsAccountId':_0x7dc835[_0x1693('0x58')]['id'],'SmsInteractionId':_0x5b6900['id'],'direction':'in','ContactId':_0x5b6900[_0x1693('0xa9')],'AttachmentId':_0x4d7d3f[_0x1693('0x61')][_0x1693('0xaa')]});})[_0x1693('0x23')](function(_0x50c463){_0x4d7d3f[_0x1693('0x29')]=_0x50c463;if(_0x4d7d3f[_0x1693('0xa3')][_0x1693('0xab')]){return db['User'][_0x1693('0x5f')]({'attributes':['id',_0x1693('0x3c')],'where':{'id':_0x4d7d3f[_0x1693('0xa3')]['UserId']}})[_0x1693('0x23')](function(_0x3f0397){if(_0x3f0397){_0x4d7d3f['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3f0397[_0x1693('0x3c')]+','+(_0x4d7d3f[_0x1693('0x73')]['waitForTheAssignedAgent']||0xa),'interval':_0x1693('0xa7')});}return respondWithRpcPromise(_0x1693('0xac'),_0x1693('0xad'),_0x4d7d3f);});}return respondWithRpcPromise(_0x1693('0xac'),_0x1693('0xad'),_0x4d7d3f);})[_0x1693('0x23')](function(_0x464e4a){if(_0x464e4a){var _0x3a529f=0xc8;var _0x86d658=_0x1693('0xae');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x86d658,_0x3a529f,_0x1693('0xaf'));logger[_0x1693('0xb0')](_0x1693('0xb1'),_0x86d658,_0x3a529f,_0x1693('0xaf'),JSON['stringify'](_0x464e4a));if(_0x4d7d3f[_0x1693('0x73')][_0x1693('0x44')]===_0x1693('0xb2')){return _0x4936cb[_0x1693('0x2c')](_0x3a529f)[_0x1693('0xb3')](_0x1693('0xb4'),'text/xml')['send'](_0x1693('0xb5'));}else{return _0x4936cb['status'](_0x3a529f)[_0x1693('0x2e')](_0x464e4a);}}})[_0x1693('0x2b')](handleError(_0x4936cb,null));};exports['addApplications']=function(_0x1667da,_0x4eb84a,_0x35021d){return db[_0x1693('0x41')][_0x1693('0x6d')]({'where':{'id':_0x1667da[_0x1693('0x58')]['id']}})['then'](handleEntityNotFound(_0x4eb84a,null))[_0x1693('0x23')](function(_0x4be771){if(_0x4be771){return db[_0x1693('0xb6')]['transaction'](function(_0x22deee){return db[_0x1693('0x71')][_0x1693('0x36')]({'where':{'SmsAccountId':_0x1667da[_0x1693('0x58')]['id']},'transaction':_0x22deee})[_0x1693('0x23')](function(_0x5e7a82){var _0x41178a=_['map'](_0x1667da[_0x1693('0x61')],function(_0x3c8eb4){_0x3c8eb4[_0x1693('0x63')]=_0x1667da[_0x1693('0x58')]['id'];return _0x3c8eb4;});return db[_0x1693('0x71')]['bulkCreate'](_0x41178a,{'transaction':_0x22deee});});})['then'](function(){return db['SmsApplication'][_0x1693('0xb7')]({'where':{'SmsAccountId':_0x1667da[_0x1693('0x58')]['id']},'order':_0x1693('0x76')});});}})[_0x1693('0x23')](respondWithResult(_0x4eb84a,null))[_0x1693('0x2b')](handleError(_0x4eb84a,null));};exports[_0x1693('0xb8')]=function(_0x532a19,_0x57f975,_0xb7da0d){var _0x21f99e={};var _0xefe190={};var _0x527d48;var _0x374c90;return db[_0x1693('0x41')][_0x1693('0x6d')]({'where':{'id':_0x532a19['params']['id']}})[_0x1693('0x23')](handleEntityNotFound(_0x57f975,null))[_0x1693('0x23')](function(_0x404789){if(_0x404789){_0x527d48=_0x404789;_0xefe190['model']=_[_0x1693('0x47')](db[_0x1693('0x71')][_0x1693('0x42')]);_0xefe190['query']=_[_0x1693('0x47')](_0x532a19['query']);_0xefe190[_0x1693('0x50')]=_['intersection'](_0xefe190[_0x1693('0x46')],_0xefe190[_0x1693('0x4b')]);_0x21f99e[_0x1693('0x48')]=_['intersection'](_0xefe190[_0x1693('0x46')],qs[_0x1693('0x59')](_0x532a19['query'][_0x1693('0x59')]));_0x21f99e[_0x1693('0x48')]=_0x21f99e[_0x1693('0x48')][_0x1693('0x4a')]?_0x21f99e[_0x1693('0x48')]:_0xefe190[_0x1693('0x46')];_0x21f99e[_0x1693('0x4e')]=qs[_0x1693('0x4f')](_0x532a19[_0x1693('0x4b')][_0x1693('0x4f')]);_0x21f99e[_0x1693('0x52')]=qs['filters'](_[_0x1693('0x67')](_0x532a19['query'],_0xefe190[_0x1693('0x50')]));if(_0x532a19['query']['filter']){_0x21f99e[_0x1693('0x52')]=_[_0x1693('0x54')](_0x21f99e[_0x1693('0x52')],{'$or':_[_0x1693('0x40')](_0x21f99e[_0x1693('0x48')],function(_0x7a77ca){var _0x436698={};_0x436698[_0x7a77ca]={'$like':'%'+_0x532a19[_0x1693('0x4b')][_0x1693('0x51')]+'%'};return _0x436698;})});}_0x21f99e=_['merge']({},_0x21f99e,_0x532a19[_0x1693('0x55')]);return _0x527d48['getApplications'](_0x21f99e);}})[_0x1693('0x23')](function(_0x6d494e){if(_0x6d494e){_0x374c90=_0x6d494e[_0x1693('0x4a')];if(!_0x532a19[_0x1693('0x4b')][_0x1693('0x66')](_0x1693('0x4c'))){_0x21f99e[_0x1693('0x4d')]=qs[_0x1693('0x4d')](_0x532a19['query'][_0x1693('0x4d')]);_0x21f99e[_0x1693('0x30')]=qs['offset'](_0x532a19[_0x1693('0x4b')][_0x1693('0x30')]);}return _0x527d48[_0x1693('0xb8')](_0x21f99e);}})[_0x1693('0x23')](function(_0x5c34b2){if(_0x5c34b2){return _0x5c34b2?{'count':_0x374c90,'rows':_0x5c34b2}:null;}})['then'](respondWithResult(_0x57f975,null))[_0x1693('0x2b')](handleError(_0x57f975,null));};exports['getInteractions']=function(_0x2d0258,_0x4a6ead,_0x15700d){var _0x5207cf={'raw':![],'where':{}};var _0x51432d={};var _0x4b6935={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1693('0x6d')]({'where':{'id':_0x2d0258[_0x1693('0x58')]['id']}})[_0x1693('0x23')](handleEntityNotFound(_0x4a6ead,null))[_0x1693('0x23')](function(_0x48e095){if(_0x48e095){_0x51432d[_0x1693('0x46')]=_[_0x1693('0x47')](db[_0x1693('0xa1')][_0x1693('0x42')]);_0x51432d['query']=_['keys'](_0x2d0258[_0x1693('0x4b')]);_0x51432d['filters']=_['intersection'](_0x51432d['model'],_0x51432d[_0x1693('0x4b')]);_0x5207cf[_0x1693('0x48')]=_[_0x1693('0x49')](_0x51432d[_0x1693('0x46')],qs[_0x1693('0x59')](_0x2d0258['query'][_0x1693('0x59')]));_0x5207cf['attributes']=_0x5207cf['attributes'][_0x1693('0x4a')]?_0x5207cf[_0x1693('0x48')]:_0x51432d[_0x1693('0x46')];if(!_0x2d0258[_0x1693('0x4b')]['hasOwnProperty'](_0x1693('0x4c'))){_0x5207cf['limit']=qs[_0x1693('0x4d')](_0x2d0258['query']['limit']);_0x5207cf[_0x1693('0x30')]=qs[_0x1693('0x30')](_0x2d0258['query']['offset']);}_0x5207cf[_0x1693('0x4e')]=qs[_0x1693('0x4f')](_0x2d0258[_0x1693('0x4b')]['sort']);_0x5207cf[_0x1693('0x52')]=qs[_0x1693('0x50')](_[_0x1693('0x67')](_0x2d0258[_0x1693('0x4b')],_0x51432d[_0x1693('0x50')]));_0x5207cf[_0x1693('0x52')][_0x1693('0x63')]=_0x48e095['id'];if(_0x2d0258[_0x1693('0x4b')][_0x1693('0x51')]){_0x5207cf[_0x1693('0x52')]=_[_0x1693('0x54')](_0x5207cf[_0x1693('0x52')],{'$or':_['map'](_0x5207cf[_0x1693('0x48')],function(_0x1edc95){var _0x7ebe6a={};_0x7ebe6a[_0x1edc95]={'$like':'%'+_0x2d0258['query'][_0x1693('0x51')]+'%'};return _0x7ebe6a;})});}_0x5207cf=_[_0x1693('0x54')]({},_0x5207cf,_0x2d0258['options']);return db[_0x1693('0xa1')][_0x1693('0x2f')]({'where':_0x5207cf['where']})[_0x1693('0x23')](function(_0x55d53d){_0x4b6935[_0x1693('0x2f')]=_0x55d53d;if(_0x2d0258['query'][_0x1693('0x5a')]){_0x5207cf[_0x1693('0x56')]=[{'model':db[_0x1693('0x78')],'as':_0x1693('0xb9'),'required':![]},{'model':db[_0x1693('0xba')],'as':_0x1693('0xbb'),'attributes':[_0x1693('0x3c'),_0x1693('0xbc'),_0x1693('0xbd')],'required':![]},{'model':db['Tag'],'as':_0x1693('0xbe'),'attributes':['id','name',_0x1693('0xbf')],'where':_0x2d0258['query'][_0x1693('0xc0')]?{'id':_0x2d0258['query'][_0x1693('0xc0')]}:undefined,'required':_0x2d0258['query'][_0x1693('0xc0')]?!![]:![]}];}return db[_0x1693('0xa1')][_0x1693('0x57')](_0x5207cf);})['then'](function(_0x509781){_0x4b6935['rows']=_0x509781;return _0x4b6935;});}})[_0x1693('0x23')](respondWithFilteredResult(_0x4a6ead,_0x5207cf))[_0x1693('0x2b')](handleError(_0x4a6ead,null));};exports[_0x1693('0xc1')]=function(_0x45aeca,_0x57a8d0,_0x2f951a){var _0x45a8c4,_0x529fac,_0x583a66;if(_[_0x1693('0x94')](_0x45aeca[_0x1693('0x61')][_0x1693('0x61')])||_0x45aeca[_0x1693('0x61')][_0x1693('0x61')]===''){throw new db[(_0x1693('0x79'))][(_0x1693('0x7a'))](_0x1693('0x96'));}if(_[_0x1693('0x94')](_0x45aeca['body']['to'])){throw new db[(_0x1693('0x79'))][(_0x1693('0x7a'))]('to\x20is\x20mandatory');}_0x45a8c4=_0x45aeca['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x45aeca[_0x1693('0x58')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x1693('0x78')],'as':'Contacts','where':{'mobile':_0x45a8c4},'limit':0x1,'order':[[_0x1693('0x9c'),'DESC']]}]}]})[_0x1693('0x23')](handleEntityNotFound(_0x57a8d0,null))['then'](function(_0x4538b2){if(_0x4538b2&&_0x4538b2['List']){_0x529fac=_0x4538b2['get']({'plain':!![]});if(_0x529fac[_0x1693('0xc2')]&&_0x529fac['List'][_0x1693('0x9f')][_0x1693('0x4a')]){return _0x529fac[_0x1693('0xc2')][_0x1693('0x9f')][0x0];}return db['CmContact'][_0x1693('0x5b')](_['defaults'](_0x45aeca[_0x1693('0x61')],{'firstName':_0x45a8c4,'mobile':_0x45a8c4,'phone':_0x45a8c4,'ListId':_0x529fac['ListId']}));}})[_0x1693('0x23')](handleEntityNotFound(_0x57a8d0,null))[_0x1693('0x23')](function(_0x547315){if(_0x547315){_0x583a66=_0x547315;return db[_0x1693('0xa1')][_0x1693('0x5f')]({'where':{'ContactId':_0x583a66['id'],'closed':![],'SmsAccountId':_0x529fac['id']}})[_0x1693('0x23')](function(_0x2975fa){if(_0x2975fa){return[_0x2975fa,![]];}return db[_0x1693('0xa1')][_0x1693('0x5b')]({'UserId':_0x45aeca[_0x1693('0xc3')]['id'],'ContactId':_0x583a66['id'],'SmsAccountId':_0x529fac['id'],'phone':_0x45a8c4,'firstMsgDirection':_0x1693('0xc4'),'Messages':[_[_0x1693('0x54')](_0x45aeca[_0x1693('0x61')],{'read':![],'body':_0x45aeca[_0x1693('0x61')][_0x1693('0x61')],'phone':_0x45a8c4,'SmsAccountId':_0x529fac['id'],'UserId':_0x45aeca['user']['id'],'ContactId':_0x583a66['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x1693('0xc5')}]})[_0x1693('0x23')](function(_0x47f112){return[_0x47f112,!![]];});});}})[_0x1693('0xa2')](function(_0x5de6db,_0xbdb07f){if(_0xbdb07f){return _0x5de6db;}return db[_0x1693('0xa8')]['create'](_[_0x1693('0x54')](_0x45aeca[_0x1693('0x61')],{'read':![],'body':_0x45aeca['body'][_0x1693('0x61')],'phone':_0x45a8c4,'SmsAccountId':_0x529fac['id'],'SmsInteractionId':_0x5de6db['id'],'UserId':_0x45aeca[_0x1693('0xc3')]['id'],'ContactId':_0x583a66['id']}))['then'](function(_0x11ad69){_0x5de6db[_0x1693('0xc6')][_0x1693('0xc5')]=[];_0x5de6db['dataValues'][_0x1693('0xc5')][_0x1693('0xc7')](_0x11ad69['dataValues']);return _0x5de6db;});})[_0x1693('0x23')](respondWithResult(_0x57a8d0,null))[_0x1693('0x2b')](handleError(_0x57a8d0,null));};exports[_0x1693('0x2c')]=function(_0x3a1eee,_0x4a1cfc,_0x2da426){if(_0x3a1eee['body']['id']){delete _0x3a1eee[_0x1693('0x61')]['id'];}console['log'](_0x1693('0xc8'),_0x3a1eee[_0x1693('0x61')]);var _0x2c9e92,_0x5725e5,_0x2c622e;return db[_0x1693('0x41')]['find']({'where':{'id':_0x3a1eee[_0x1693('0x58')]['id']}})[_0x1693('0x23')](handleEntityNotFound(_0x4a1cfc,null))['then'](function(_0x24a407){if(_0x24a407){_0x2c622e=_0x24a407;logger[_0x1693('0xb0')](_0x1693('0x26'),_0x1693('0x2c'),_0x1693('0xc9'),_0x24a407[_0x1693('0x44')],util[_0x1693('0xca')](_0x3a1eee[_0x1693('0x61')],{'showHidden':![],'depth':null}));switch(_0x24a407[_0x1693('0x44')]){case _0x1693('0x84'):if(_0x3a1eee[_0x1693('0x61')][_0x1693('0xcb')]&&_0x3a1eee['body'][_0x1693('0x2c')]){_0x5725e5=_0x3a1eee[_0x1693('0x61')][_0x1693('0x2c')];return db[_0x1693('0xa8')][_0x1693('0x5f')]({'where':{'messageId':_0x3a1eee[_0x1693('0x61')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x3a1eee[_0x1693('0x61')][_0x1693('0xcc')]&&_0x3a1eee[_0x1693('0x61')]['statusInt']){_0x5725e5=_0x3a1eee['body'][_0x1693('0xcd')];return db['SmsMessage'][_0x1693('0x5f')]({'where':{'messageId':_0x3a1eee[_0x1693('0x61')]['requestid']}});}break;case'clicksend':if(_0x3a1eee[_0x1693('0x61')][_0x1693('0x89')]&&_0x3a1eee[_0x1693('0x61')]['status_code']){_0x5725e5=_0x3a1eee['body'][_0x1693('0xce')];return db[_0x1693('0xa8')]['find']({'where':{'messageId':_0x3a1eee[_0x1693('0x61')][_0x1693('0x89')]}});}break;case _0x1693('0xcf'):var _0xf4b9d2=_0x3a1eee[_0x1693('0x61')][_0x1693('0x8c')][0x0];if(_0xf4b9d2[_0x1693('0x82')]&&_0xf4b9d2['status'][_0x1693('0xd0')]==='DELIVERED'){_0x5725e5=_0xf4b9d2['status']['groupName'];return db['SmsMessage'][_0x1693('0x5f')]({'where':{'messageId':_0xf4b9d2['messageId']}});}break;case'clickatell':if(_0x3a1eee[_0x1693('0x61')][_0x1693('0x82')]&&_0x3a1eee[_0x1693('0x61')][_0x1693('0x2c')]){_0x5725e5=_0x3a1eee[_0x1693('0x61')][_0x1693('0x2c')];return db[_0x1693('0xa8')]['find']({'where':{'messageId':_0x3a1eee[_0x1693('0x61')][_0x1693('0x82')]}});}break;case _0x1693('0x92'):if(_0x3a1eee['body']['redif']&&_0x3a1eee[_0x1693('0x61')][_0x1693('0x2c')]){_0x5725e5=_0x3a1eee[_0x1693('0x61')][_0x1693('0x2c')];return db['SmsMessage'][_0x1693('0x5f')]({'where':{'messageId':_0x3a1eee[_0x1693('0x61')][_0x1693('0xd1')]}});}break;}}})[_0x1693('0x23')](handleEntityNotFound(_0x4a1cfc,null))['then'](function(_0x55c0d6){if(_0x55c0d6){_0x2c9e92=_0x55c0d6;switch(_0x2c622e[_0x1693('0x44')]){case _0x1693('0x84'):if(_0x5725e5===_0x1693('0xd2')){return _0x2c9e92[_0x1693('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1693('0x84'),util[_0x1693('0xca')](_0x3a1eee[_0x1693('0x61')],{'showHidden':![],'depth':null}));}break;case _0x1693('0x87'):if(_0x5725e5==='1'){return _0x2c9e92['update']({'read':!![]});}else{logger[_0x1693('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1693('0x84'),util[_0x1693('0xca')](_0x3a1eee[_0x1693('0x61')],{'showHidden':![],'depth':null}));}break;case _0x1693('0x88'):if(!_0x3a1eee[_0x1693('0x61')][_0x1693('0xd3')]&&_0x5725e5>=0xc8&&_0x5725e5<=0xce){return _0x2c9e92['update']({'read':!![]});}else{logger[_0x1693('0x28')](_0x1693('0x26'),_0x1693('0x2c'),'clicksend',util[_0x1693('0xca')](_0x3a1eee[_0x1693('0x61')],{'showHidden':![],'depth':null}));}break;case _0x1693('0xcf'):var _0x3e8fdd=_0x3a1eee[_0x1693('0x61')][_0x1693('0x8c')][0x0];if(_0x3e8fdd[_0x1693('0x2c')][_0x1693('0xd0')]===_0x1693('0xd2')){return _0x2c9e92[_0x1693('0x35')]({'read':!![]});}else{logger[_0x1693('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1693('0x2c'),'infobip',util[_0x1693('0xca')](_0x3a1eee['body'],{'showHidden':![],'depth':null}));}break;case _0x1693('0xd4'):if(_0x5725e5=='DELIVERED_TO_GATEWAY'||_0x5725e5==_0x1693('0xd5')){return _0x2c9e92['update']({'read':!![]});}else{logger[_0x1693('0x28')](_0x1693('0x26'),_0x1693('0x2c'),_0x1693('0xd4'),util[_0x1693('0xca')](_0x3a1eee[_0x1693('0x61')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x5725e5===_0x1693('0xd6')||_0x5725e5===_0x1693('0xd7')){return _0x2c9e92[_0x1693('0x35')]({'read':!![]});}else{logger['error'](_0x1693('0x26'),_0x1693('0x2c'),_0x1693('0x92'),util[_0x1693('0xca')](_0x3a1eee[_0x1693('0x61')],{'showHidden':![],'depth':null}));}break;}return _0x2c9e92;}})[_0x1693('0x23')](respondWithResult(_0x4a1cfc,null))[_0x1693('0x2b')](handleError(_0x4a1cfc,null));};exports['statusGet']=function(_0xf62802,_0x510062,_0x40d2f8){var _0xec70fb,_0x24ee0f,_0x4830a8;return db['SmsAccount'][_0x1693('0x5f')]({'where':{'id':_0xf62802['params']['id']}})['then'](handleEntityNotFound(_0x510062,null))[_0x1693('0x23')](function(_0x4f55e6){if(_0x4f55e6){_0x4830a8=_0x4f55e6;logger[_0x1693('0xb0')](_0x1693('0x26'),_0x1693('0x2c'),_0x1693('0xc9'),_0x4f55e6[_0x1693('0x44')],util['inspect'](_0xf62802[_0x1693('0x4b')],{'showHidden':![],'depth':null}));switch(_0x4f55e6[_0x1693('0x44')]){case _0x1693('0x8d'):if(_0xf62802[_0x1693('0x4b')]['message-id']&&_0xf62802[_0x1693('0x4b')][_0x1693('0xd8')]){_0x24ee0f=_0xf62802[_0x1693('0x4b')][_0x1693('0xd8')];return db[_0x1693('0xa8')]['find']({'where':{'messageId':_0xf62802[_0x1693('0x4b')][_0x1693('0xd9')]}});}break;}}})['then'](handleEntityNotFound(_0x510062,null))[_0x1693('0x23')](function(_0x1a79e0){if(_0x1a79e0){_0xec70fb=_0x1a79e0;switch(_0x4830a8[_0x1693('0x44')]){case _0x1693('0x8d'):if(_0x24ee0f==='2'||_0x24ee0f==='6'){return _0xec70fb[_0x1693('0x35')]({'read':!![]});}else{logger[_0x1693('0x28')](_0x1693('0x26'),_0x1693('0x2c'),_0x1693('0x8d'),util[_0x1693('0xca')](_0xf62802[_0x1693('0x4b')],{'showHidden':![],'depth':null}));};break;}return _0xec70fb;}})['then'](respondWithResult(_0x510062,null))[_0x1693('0x2b')](handleError(_0x510062,null));};exports[_0x1693('0xda')]=function(_0x16b561,_0x5b6065,_0x5db6f5){return db[_0x1693('0x41')][_0x1693('0x5f')]({'where':{'id':_0x16b561[_0x1693('0x58')]['id']}})[_0x1693('0x23')](handleEntityNotFound(_0x5b6065,null))[_0x1693('0x23')](function(_0x19af50){if(_0x19af50){return _0x19af50[_0x1693('0xda')](_0x16b561[_0x1693('0x61')][_0x1693('0x6a')],_[_0x1693('0xdb')](_0x16b561['body'],['ids','id'])||{})[_0x1693('0xa2')](function(_0x5ee306){for(var _0x419afc=0x0;_0x419afc<_0x16b561['body'][_0x1693('0x6a')][_0x1693('0x4a')];_0x419afc+=0x1){socket[_0x1693('0xdc')](_0x1693('0xdd'),{'UserId':_0x16b561['body'][_0x1693('0x6a')][_0x419afc],'SmsAccountId':_0x16b561[_0x1693('0x58')]['id']});}return _0x5ee306;});}})[_0x1693('0x23')](respondWithResult(_0x5b6065,null))['catch'](handleError(_0x5b6065,null));};exports[_0x1693('0xde')]=function(_0x1bbc00,_0x5d737c,_0x328316){return db['SmsAccount'][_0x1693('0x5f')]({'where':{'id':_0x1bbc00[_0x1693('0x58')]['id']}})[_0x1693('0x23')](handleEntityNotFound(_0x5d737c,null))['then'](function(_0x262de9){if(_0x262de9){return _0x262de9[_0x1693('0xde')](_0x1bbc00[_0x1693('0x4b')][_0x1693('0x6a')])[_0x1693('0x23')](function(){if(_['isArray'](_0x1bbc00['query'][_0x1693('0x6a')])){for(var _0x5e49bd=0x0;_0x5e49bd<_0x1bbc00[_0x1693('0x4b')][_0x1693('0x6a')]['length'];_0x5e49bd+=0x1){socket[_0x1693('0xdc')](_0x1693('0xdf'),{'UserId':Number(_0x1bbc00[_0x1693('0x4b')]['ids'][_0x5e49bd]),'SmsAccountId':Number(_0x1bbc00[_0x1693('0x58')]['id'])});}}else{socket[_0x1693('0xdc')]('userSmsAccount:remove',{'UserId':Number(_0x1bbc00[_0x1693('0x4b')]['ids']),'SmsAccountId':Number(_0x1bbc00[_0x1693('0x58')]['id'])});}});}})[_0x1693('0x23')](respondWithStatusCode(_0x5d737c,null))[_0x1693('0x2b')](handleError(_0x5d737c,null));};exports['getAgents']=function(_0x2238c4,_0x9bf368,_0x5caca0){var _0x39212b={};var _0x335f87={};var _0x46f78c;var _0x2c92a4;return db[_0x1693('0x41')][_0x1693('0x6d')]({'where':{'id':_0x2238c4[_0x1693('0x58')]['id']}})[_0x1693('0x23')](handleEntityNotFound(_0x9bf368,null))['then'](function(_0x1859da){if(_0x1859da){_0x46f78c=_0x1859da;_0x335f87[_0x1693('0x46')]=_[_0x1693('0x47')](db[_0x1693('0xba')][_0x1693('0x42')]);_0x335f87['query']=_['keys'](_0x2238c4[_0x1693('0x4b')]);_0x335f87[_0x1693('0x50')]=_[_0x1693('0x49')](_0x335f87[_0x1693('0x46')],_0x335f87[_0x1693('0x4b')]);_0x39212b[_0x1693('0x48')]=_[_0x1693('0x49')](_0x335f87[_0x1693('0x46')],qs[_0x1693('0x59')](_0x2238c4[_0x1693('0x4b')][_0x1693('0x59')]));_0x39212b[_0x1693('0x48')]=_0x39212b[_0x1693('0x48')]['length']?_0x39212b[_0x1693('0x48')]:_0x335f87[_0x1693('0x46')];_0x39212b[_0x1693('0x4e')]=qs[_0x1693('0x4f')](_0x2238c4[_0x1693('0x4b')]['sort']);_0x39212b[_0x1693('0x52')]=qs['filters'](_[_0x1693('0x67')](_0x2238c4[_0x1693('0x4b')],_0x335f87['filters']));if(_0x2238c4[_0x1693('0x4b')][_0x1693('0x51')]){_0x39212b[_0x1693('0x52')]=_['merge'](_0x39212b[_0x1693('0x52')],{'$or':_[_0x1693('0x40')](_0x39212b['attributes'],function(_0x1275be){var _0x13404e={};_0x13404e[_0x1275be]={'$like':'%'+_0x2238c4[_0x1693('0x4b')]['filter']+'%'};return _0x13404e;})});}_0x39212b=_[_0x1693('0x54')]({},_0x39212b,_0x2238c4['options']);return _0x46f78c['getAgents'](_0x39212b);}})[_0x1693('0x23')](function(_0x22fbdd){if(_0x22fbdd){_0x2c92a4=_0x22fbdd[_0x1693('0x4a')];if(!_0x2238c4[_0x1693('0x4b')][_0x1693('0x66')](_0x1693('0x4c'))){_0x39212b['limit']=qs['limit'](_0x2238c4[_0x1693('0x4b')][_0x1693('0x4d')]);_0x39212b[_0x1693('0x30')]=qs[_0x1693('0x30')](_0x2238c4[_0x1693('0x4b')][_0x1693('0x30')]);}return _0x46f78c['getAgents'](_0x39212b);}})[_0x1693('0x23')](function(_0x59582d){if(_0x59582d){return _0x59582d?{'count':_0x2c92a4,'rows':_0x59582d}:null;}})['then'](respondWithResult(_0x9bf368,null))['catch'](handleError(_0x9bf368,null));}; \ No newline at end of file +var _0x02ce=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','client','Sequelize','ValidationError','request','then','info','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','UserProfileResource','name','send','index','Pause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsAccounts','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','mandatoryDispositionPause','describe','SmsAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','CmContact','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','connectel','clicksend','message_id','plivo','Text','infobip','results','text','csc','originatingAddress','segmentedMessage','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','list','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','text/xml','\x0a','addApplications','sequelize','bulkCreate','findAndCountAll','getApplications','Contact','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','CmList','DESC','List','out','user','Messages','spread','dataValues','log','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','clickatell','redif','skebby','SmsAccount,\x20%s,\x20%s,\x20%s','error_code','groupName','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x32f1c3,_0x3d75f7){var _0x12ab63=function(_0x3215f4){while(--_0x3215f4){_0x32f1c3['push'](_0x32f1c3['shift']());}};_0x12ab63(++_0x3d75f7);}(_0x02ce,0x1ac));var _0xe02c=function(_0x28ac42,_0x2ef917){_0x28ac42=_0x28ac42-0x0;var _0x1aebd6=_0x02ce[_0x28ac42];return _0x1aebd6;};'use strict';var pdf=require(_0xe02c('0x0'));var emlformat=require(_0xe02c('0x1'));var rimraf=require(_0xe02c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe02c('0x3'));var rp=require('request-promise');var moment=require(_0xe02c('0x4'));var BPromise=require(_0xe02c('0x5'));var Mustache=require(_0xe02c('0x6'));var util=require(_0xe02c('0x7'));var path=require(_0xe02c('0x8'));var sox=require(_0xe02c('0x9'));var csv=require(_0xe02c('0xa'));var ejs=require(_0xe02c('0xb'));var fs=require('fs');var _=require(_0xe02c('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe02c('0xd'));var deskjs=require(_0xe02c('0xe'));var toCsv=require(_0xe02c('0xa'));var querystring=require(_0xe02c('0xf'));var Papa=require(_0xe02c('0x10'));var Redis=require(_0xe02c('0x11'));var authService=require(_0xe02c('0x12'));var qs=require(_0xe02c('0x13'));var as=require(_0xe02c('0x14'));var hardwareService=require(_0xe02c('0x15'));var logger=require(_0xe02c('0x16'))(_0xe02c('0x17'));var utils=require(_0xe02c('0x18'));var config=require(_0xe02c('0x19'));var db=require(_0xe02c('0x1a'))['db'];config[_0xe02c('0x1b')]=_[_0xe02c('0x1c')](config[_0xe02c('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xe02c('0x1d'))(new Redis(config['redis']));require('./smsAccount.socket')[_0xe02c('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe02c('0x1f')]['http']({'port':0x232c});function checkPasswordPattern(_0x3a5a2c,_0x4e9c6d,_0x256311){if(_0x256311){var _0x366893=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x366893['test'](_0x4e9c6d)){return _0x3a5a2c;}else{throw new db[(_0xe02c('0x20'))][(_0xe02c('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 _0x3a5a2c;}}function respondWithRpcPromise(_0x12a564,_0x20f492,_0x5a4583,_0x52917f){return new BPromise(function(_0x3e37bf,_0x49604a){var _0x1f8f37=_0x52917f||client;return _0x1f8f37[_0xe02c('0x22')](_0x12a564,_0x5a4583)[_0xe02c('0x23')](function(_0x36fed0){logger[_0xe02c('0x24')]('SmsAccount,\x20%s,\x20%s',_0x20f492,_0xe02c('0x25'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x20f492,_0xe02c('0x25'),JSON[_0xe02c('0x26')](_0x36fed0));if(_0x36fed0['error']){if(_0x36fed0[_0xe02c('0x27')][_0xe02c('0x28')]===0x1f4){logger['error'](_0xe02c('0x29'),_0x20f492,_0x36fed0[_0xe02c('0x27')][_0xe02c('0x2a')]);return _0x49604a(_0x36fed0[_0xe02c('0x27')][_0xe02c('0x2a')]);}logger[_0xe02c('0x27')](_0xe02c('0x29'),_0x20f492,_0x36fed0[_0xe02c('0x27')][_0xe02c('0x2a')]);return _0x3e37bf(_0x36fed0[_0xe02c('0x27')][_0xe02c('0x2a')]);}else{logger['info'](_0xe02c('0x29'),_0x20f492,_0xe02c('0x25'));_0x3e37bf(_0x36fed0[_0xe02c('0x2b')][_0xe02c('0x2a')]);}})[_0xe02c('0x2c')](function(_0x303d24){logger[_0xe02c('0x27')](_0xe02c('0x29'),_0x20f492,_0x303d24);_0x49604a(_0x303d24);});});}function respondWithStatusCode(_0x55ef2a,_0x55e475){_0x55e475=_0x55e475||0xcc;return function(_0x3790eb){if(_0x3790eb){return _0x55ef2a[_0xe02c('0x2d')](_0x55e475);}return _0x55ef2a['status'](_0x55e475)[_0xe02c('0x2e')]();};}function respondWithResult(_0x2d1d98,_0x445421){_0x445421=_0x445421||0xc8;return function(_0x287f7e){if(_0x287f7e){return _0x2d1d98[_0xe02c('0x2f')](_0x445421)[_0xe02c('0x30')](_0x287f7e);}};}function respondWithFilteredResult(_0x22a285,_0x1b8f21){return function(_0x9ee479){if(_0x9ee479){var _0x288004=_0x9ee479[_0xe02c('0x31')],_0x17d5b3=_0x1b8f21[_0xe02c('0x32')],_0x5a2da0=_0x1b8f21[_0xe02c('0x32')]+_0x1b8f21[_0xe02c('0x33')],_0x3c3d2c;if(_0x5a2da0>=_0x288004){_0x5a2da0=_0x288004;_0x3c3d2c=0xc8;}else{_0x3c3d2c=0xce;}_0x22a285[_0xe02c('0x2f')](_0x3c3d2c);return _0x22a285['set'](_0xe02c('0x34'),_0x17d5b3+'-'+_0x5a2da0+'/'+_0x288004)[_0xe02c('0x30')](_0x9ee479);}return null;};}function patchUpdates(_0x4fc4fd){return function(_0x1ce34c){try{jsonpatch[_0xe02c('0x35')](_0x1ce34c,_0x4fc4fd,!![]);}catch(_0x43ac5d){return BPromise[_0xe02c('0x36')](_0x43ac5d);}return _0x1ce34c[_0xe02c('0x37')]();};}function saveUpdates(_0x538001,_0x4a0350){return function(_0x388063){if(_0x388063){return _0x388063[_0xe02c('0x38')](_0x538001)['then'](function(_0x1afae6){return _0x1afae6;});}return null;};}function removeEntity(_0x58c724,_0x42d617){return function(_0xaa8cc7){if(_0xaa8cc7){return _0xaa8cc7[_0xe02c('0x39')]()[_0xe02c('0x23')](function(){var _0x10ae8b=_0xaa8cc7['get']({'plain':!![]});var _0x3f888c='SmsAccounts';return db[_0xe02c('0x3a')][_0xe02c('0x39')]({'where':{'type':_0x3f888c,'resourceId':_0x10ae8b['id']}})[_0xe02c('0x23')](function(){return _0xaa8cc7;});})[_0xe02c('0x23')](function(){_0x58c724[_0xe02c('0x2f')](0xcc)[_0xe02c('0x2e')]();});}};}function handleEntityNotFound(_0x559bc1,_0x1c795a){return function(_0x38845a){if(!_0x38845a){_0x559bc1['sendStatus'](0x194);}return _0x38845a;};}function handleError(_0xcb664c,_0xa6028){_0xa6028=_0xa6028||0x1f4;return function(_0x4ea038){logger[_0xe02c('0x27')](_0x4ea038['stack']);if(_0x4ea038[_0xe02c('0x3b')]){delete _0x4ea038[_0xe02c('0x3b')];}_0xcb664c['status'](_0xa6028)[_0xe02c('0x3c')](_0x4ea038);};}exports[_0xe02c('0x3d')]=function(_0x2502c8,_0x441961){var _0x3c4a65={'include':[{'model':db[_0xe02c('0x3e')],'as':'mandatoryDispositionPause'}]},_0x28922a={},_0x59a2fd={'count':0x0,'rows':[]};var _0x5ae8cd=_[_0xe02c('0x3f')](db[_0xe02c('0x40')][_0xe02c('0x41')],function(_0x21a67a){return{'name':_0x21a67a['fieldName'],'type':_0x21a67a[_0xe02c('0x42')][_0xe02c('0x43')]};});_0x28922a[_0xe02c('0x44')]=_['map'](_0x5ae8cd,'name');_0x28922a[_0xe02c('0x45')]=_[_0xe02c('0x46')](_0x2502c8[_0xe02c('0x45')]);_0x28922a[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x28922a[_0xe02c('0x44')],_0x28922a[_0xe02c('0x45')]);_0x3c4a65[_0xe02c('0x49')]=_[_0xe02c('0x48')](_0x28922a['model'],qs[_0xe02c('0x4a')](_0x2502c8['query']['fields']));_0x3c4a65[_0xe02c('0x49')]=_0x3c4a65[_0xe02c('0x49')][_0xe02c('0x4b')]?_0x3c4a65[_0xe02c('0x49')]:_0x28922a[_0xe02c('0x44')];if(!_0x2502c8[_0xe02c('0x45')][_0xe02c('0x4c')](_0xe02c('0x4d'))){_0x3c4a65['limit']=qs['limit'](_0x2502c8[_0xe02c('0x45')][_0xe02c('0x33')]);_0x3c4a65[_0xe02c('0x32')]=qs['offset'](_0x2502c8[_0xe02c('0x45')][_0xe02c('0x32')]);}_0x3c4a65[_0xe02c('0x4e')]=qs[_0xe02c('0x4f')](_0x2502c8[_0xe02c('0x45')][_0xe02c('0x4f')]);_0x3c4a65[_0xe02c('0x50')]=qs[_0xe02c('0x47')](_[_0xe02c('0x51')](_0x2502c8[_0xe02c('0x45')],_0x28922a['filters']));if(_0x2502c8[_0xe02c('0x45')][_0xe02c('0x52')]){_0x3c4a65[_0xe02c('0x50')]=_[_0xe02c('0x53')](_0x3c4a65[_0xe02c('0x50')],{'$or':_[_0xe02c('0x3f')](_0x5ae8cd,function(_0x125c43){if(_0x125c43[_0xe02c('0x42')]!==_0xe02c('0x54')){var _0x1176c9={};_0x1176c9[_0x125c43[_0xe02c('0x3b')]]={'$like':'%'+_0x2502c8[_0xe02c('0x45')][_0xe02c('0x52')]+'%'};return _0x1176c9;}})});}_0x3c4a65=_['merge']({},_0x3c4a65,_0x2502c8[_0xe02c('0x55')]);var _0x4866e1={'where':_0x3c4a65[_0xe02c('0x50')]};return db[_0xe02c('0x40')][_0xe02c('0x31')](_0x4866e1)[_0xe02c('0x23')](function(_0x1e736f){_0x59a2fd[_0xe02c('0x31')]=_0x1e736f;if(_0x2502c8[_0xe02c('0x45')][_0xe02c('0x56')]){_0x3c4a65[_0xe02c('0x57')]=[{'all':!![]}];}return db[_0xe02c('0x40')]['findAll'](_0x3c4a65);})[_0xe02c('0x23')](function(_0x43beb){_0x59a2fd[_0xe02c('0x58')]=_0x43beb;return _0x59a2fd;})['then'](respondWithFilteredResult(_0x441961,_0x3c4a65))[_0xe02c('0x2c')](handleError(_0x441961,null));};exports['show']=function(_0x21a126,_0x56b9e2){var _0x5b41e4={'raw':![],'where':{'id':_0x21a126['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5b66f4={};_0x5b66f4[_0xe02c('0x44')]=_[_0xe02c('0x46')](db[_0xe02c('0x40')][_0xe02c('0x41')]);_0x5b66f4['query']=_[_0xe02c('0x46')](_0x21a126[_0xe02c('0x45')]);_0x5b66f4['filters']=_[_0xe02c('0x48')](_0x5b66f4[_0xe02c('0x44')],_0x5b66f4[_0xe02c('0x45')]);_0x5b41e4['attributes']=_['intersection'](_0x5b66f4[_0xe02c('0x44')],qs[_0xe02c('0x4a')](_0x21a126[_0xe02c('0x45')]['fields']));_0x5b41e4[_0xe02c('0x49')]=_0x5b41e4['attributes']['length']?_0x5b41e4[_0xe02c('0x49')]:_0x5b66f4[_0xe02c('0x44')];if(_0x21a126['query'][_0xe02c('0x56')]){_0x5b41e4[_0xe02c('0x57')]=[{'all':!![]}];}_0x5b41e4=_[_0xe02c('0x53')]({},_0x5b41e4,_0x21a126['options']);return db[_0xe02c('0x40')][_0xe02c('0x59')](_0x5b41e4)['then'](handleEntityNotFound(_0x56b9e2,null))[_0xe02c('0x23')](respondWithResult(_0x56b9e2,null))[_0xe02c('0x2c')](handleError(_0x56b9e2,null));};exports[_0xe02c('0x5a')]=function(_0x1c7206,_0x446c71){return db[_0xe02c('0x40')][_0xe02c('0x5a')](_0x1c7206[_0xe02c('0x5b')],{})[_0xe02c('0x23')](function(_0x49b1b4){var _0x56dd8b=_0x1c7206['user'][_0xe02c('0x5c')]({'plain':!![]});if(!_0x56dd8b)throw new Error(_0xe02c('0x5d'));if(_0x56dd8b[_0xe02c('0x5e')]==='user'){var _0x4eb35d=_0x49b1b4[_0xe02c('0x5c')]({'plain':!![]});var _0x383e5b=_0xe02c('0x5f');return db[_0xe02c('0x60')][_0xe02c('0x59')]({'where':{'name':_0x383e5b,'userProfileId':_0x56dd8b['userProfileId']},'raw':!![]})[_0xe02c('0x23')](function(_0x43e1d4){if(_0x43e1d4&&_0x43e1d4['autoAssociation']===0x0){return db['UserProfileResource'][_0xe02c('0x5a')]({'name':_0x4eb35d['name'],'resourceId':_0x4eb35d['id'],'type':_0x43e1d4['name'],'sectionId':_0x43e1d4['id']},{})['then'](function(){return _0x49b1b4;});}else{return _0x49b1b4;}})[_0xe02c('0x2c')](function(_0x28d7a2){logger[_0xe02c('0x27')](_0xe02c('0x61'),_0x28d7a2);throw _0x28d7a2;});}return _0x49b1b4;})[_0xe02c('0x23')](respondWithResult(_0x446c71,0xc9))[_0xe02c('0x2c')](handleError(_0x446c71,null));};exports['update']=function(_0x562e6a,_0x557f5a){if(_0x562e6a['body']['id']){delete _0x562e6a[_0xe02c('0x5b')]['id'];}return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x562e6a[_0xe02c('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0xe02c('0x63')}]})[_0xe02c('0x23')](handleEntityNotFound(_0x557f5a,null))['then'](saveUpdates(_0x562e6a[_0xe02c('0x5b')],null))[_0xe02c('0x23')](respondWithResult(_0x557f5a,null))['catch'](handleError(_0x557f5a,null));};exports[_0xe02c('0x39')]=function(_0x391dfb,_0x44f28f){return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x391dfb[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x44f28f,null))['then'](removeEntity(_0x44f28f,null))[_0xe02c('0x2c')](handleError(_0x44f28f,null));};exports['describe']=function(_0x558344,_0x489919){return db[_0xe02c('0x40')][_0xe02c('0x64')]()[_0xe02c('0x23')](respondWithResult(_0x489919,null))[_0xe02c('0x2c')](handleError(_0x489919,null));};exports['addDisposition']=function(_0x32e149,_0x327777,_0x503bb3){if(_0x32e149['body']['id']){delete _0x32e149['body']['id'];}return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x32e149['params']['id']}})['then'](handleEntityNotFound(_0x327777,null))[_0xe02c('0x23')](function(_0x30ad9f){if(_0x30ad9f){_0x32e149[_0xe02c('0x5b')][_0xe02c('0x65')]=_0x30ad9f['id'];return db[_0xe02c('0x66')]['create'](_0x32e149[_0xe02c('0x5b')]);}})[_0xe02c('0x23')](respondWithResult(_0x327777,null))[_0xe02c('0x2c')](handleError(_0x327777,null));};exports[_0xe02c('0x67')]=function(_0x11c506,_0x119119,_0x526276){var _0x1d9d2b={'raw':![],'where':{}};var _0x42219f={};var _0x489da1={'count':0x0,'rows':[]};return db[_0xe02c('0x40')][_0xe02c('0x68')]({'where':{'id':_0x11c506[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x119119,null))['then'](function(_0x19c253){if(_0x19c253){_0x42219f[_0xe02c('0x44')]=_['keys'](db['Disposition']['rawAttributes']);_0x42219f[_0xe02c('0x45')]=_[_0xe02c('0x46')](_0x11c506[_0xe02c('0x45')]);_0x42219f[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x42219f['model'],_0x42219f[_0xe02c('0x45')]);_0x1d9d2b[_0xe02c('0x49')]=_[_0xe02c('0x48')](_0x42219f['model'],qs['fields'](_0x11c506['query'][_0xe02c('0x4a')]));_0x1d9d2b[_0xe02c('0x49')]=_0x1d9d2b[_0xe02c('0x49')][_0xe02c('0x4b')]?_0x1d9d2b['attributes']:_0x42219f[_0xe02c('0x44')];if(!_0x11c506['query']['hasOwnProperty'](_0xe02c('0x4d'))){_0x1d9d2b[_0xe02c('0x33')]=qs[_0xe02c('0x33')](_0x11c506[_0xe02c('0x45')][_0xe02c('0x33')]);_0x1d9d2b[_0xe02c('0x32')]=qs[_0xe02c('0x32')](_0x11c506[_0xe02c('0x45')]['offset']);}_0x1d9d2b[_0xe02c('0x4e')]=qs[_0xe02c('0x4f')](_0x11c506[_0xe02c('0x45')][_0xe02c('0x4f')]);_0x1d9d2b[_0xe02c('0x50')]=qs[_0xe02c('0x47')](_[_0xe02c('0x51')](_0x11c506[_0xe02c('0x45')],_0x42219f[_0xe02c('0x47')]));_0x1d9d2b[_0xe02c('0x50')]['SmsAccountId']=_0x19c253['id'];if(_0x11c506['query'][_0xe02c('0x52')]){_0x1d9d2b[_0xe02c('0x50')]=_[_0xe02c('0x53')](_0x1d9d2b[_0xe02c('0x50')],{'$or':_[_0xe02c('0x3f')](_0x1d9d2b['attributes'],function(_0x405b16){var _0x1a6b76={};_0x1a6b76[_0x405b16]={'$like':'%'+_0x11c506[_0xe02c('0x45')][_0xe02c('0x52')]+'%'};return _0x1a6b76;})});}_0x1d9d2b=_[_0xe02c('0x53')]({},_0x1d9d2b,_0x11c506[_0xe02c('0x55')]);return db[_0xe02c('0x66')][_0xe02c('0x31')]({'where':_0x1d9d2b[_0xe02c('0x50')]})[_0xe02c('0x23')](function(_0x287eca){_0x489da1[_0xe02c('0x31')]=_0x287eca;if(_0x11c506['query']['includeAll']){_0x1d9d2b[_0xe02c('0x57')]=[{'all':!![]}];}return db[_0xe02c('0x66')]['findAll'](_0x1d9d2b);})[_0xe02c('0x23')](function(_0x488a54){_0x489da1[_0xe02c('0x58')]=_0x488a54;return _0x489da1;});}})['then'](respondWithFilteredResult(_0x119119,_0x1d9d2b))[_0xe02c('0x2c')](handleError(_0x119119,null));};exports[_0xe02c('0x69')]=function(_0x43c503,_0x18c946,_0x28755a){return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x43c503[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x18c946,null))[_0xe02c('0x23')](function(_0x567478){if(_0x567478){return _0x567478['removeDispositions'](_0x43c503['query'][_0xe02c('0x6a')]);}})[_0xe02c('0x23')](respondWithStatusCode(_0x18c946,null))[_0xe02c('0x2c')](handleError(_0x18c946,null));};exports[_0xe02c('0x6b')]=function(_0x3adbcd,_0x365c24,_0x31ddee){if(_0x3adbcd[_0xe02c('0x5b')]['id']){delete _0x3adbcd[_0xe02c('0x5b')]['id'];}return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x3adbcd[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x365c24,null))['then'](function(_0x504c81){if(_0x504c81){_0x3adbcd[_0xe02c('0x5b')][_0xe02c('0x65')]=_0x504c81['id'];return db[_0xe02c('0x6c')]['create'](_0x3adbcd[_0xe02c('0x5b')]);}})[_0xe02c('0x23')](respondWithResult(_0x365c24,null))[_0xe02c('0x2c')](handleError(_0x365c24,null));};exports[_0xe02c('0x6d')]=function(_0xf2ea75,_0x5c0506,_0x3a749d){var _0x3b2bac={'raw':![],'where':{}};var _0x80a459={};var _0x4e5ea9={'count':0x0,'rows':[]};return db[_0xe02c('0x40')][_0xe02c('0x68')]({'where':{'id':_0xf2ea75[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x5c0506,null))[_0xe02c('0x23')](function(_0x4e3f5f){if(_0x4e3f5f){_0x80a459[_0xe02c('0x44')]=_[_0xe02c('0x46')](db[_0xe02c('0x6c')]['rawAttributes']);_0x80a459[_0xe02c('0x45')]=_[_0xe02c('0x46')](_0xf2ea75[_0xe02c('0x45')]);_0x80a459[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x80a459['model'],_0x80a459[_0xe02c('0x45')]);_0x3b2bac[_0xe02c('0x49')]=_['intersection'](_0x80a459[_0xe02c('0x44')],qs['fields'](_0xf2ea75['query']['fields']));_0x3b2bac[_0xe02c('0x49')]=_0x3b2bac[_0xe02c('0x49')][_0xe02c('0x4b')]?_0x3b2bac[_0xe02c('0x49')]:_0x80a459[_0xe02c('0x44')];if(!_0xf2ea75[_0xe02c('0x45')][_0xe02c('0x4c')](_0xe02c('0x4d'))){_0x3b2bac[_0xe02c('0x33')]=qs[_0xe02c('0x33')](_0xf2ea75[_0xe02c('0x45')][_0xe02c('0x33')]);_0x3b2bac[_0xe02c('0x32')]=qs[_0xe02c('0x32')](_0xf2ea75[_0xe02c('0x45')][_0xe02c('0x32')]);}_0x3b2bac['order']=qs[_0xe02c('0x4f')](_0xf2ea75['query'][_0xe02c('0x4f')]);_0x3b2bac[_0xe02c('0x50')]=qs[_0xe02c('0x47')](_[_0xe02c('0x51')](_0xf2ea75[_0xe02c('0x45')],_0x80a459[_0xe02c('0x47')]));_0x3b2bac[_0xe02c('0x50')][_0xe02c('0x65')]=_0x4e3f5f['id'];if(_0xf2ea75[_0xe02c('0x45')][_0xe02c('0x52')]){_0x3b2bac[_0xe02c('0x50')]=_[_0xe02c('0x53')](_0x3b2bac['where'],{'$or':_[_0xe02c('0x3f')](_0x3b2bac[_0xe02c('0x49')],function(_0x51686d){var _0x3a83cf={};_0x3a83cf[_0x51686d]={'$like':'%'+_0xf2ea75['query']['filter']+'%'};return _0x3a83cf;})});}_0x3b2bac=_[_0xe02c('0x53')]({},_0x3b2bac,_0xf2ea75[_0xe02c('0x55')]);return db[_0xe02c('0x6c')][_0xe02c('0x31')]({'where':_0x3b2bac['where']})['then'](function(_0x20d63b){_0x4e5ea9[_0xe02c('0x31')]=_0x20d63b;if(_0xf2ea75['query'][_0xe02c('0x56')]){_0x3b2bac[_0xe02c('0x57')]=[{'all':!![]}];}return db[_0xe02c('0x6c')][_0xe02c('0x6e')](_0x3b2bac);})[_0xe02c('0x23')](function(_0x654feb){_0x4e5ea9['rows']=_0x654feb;return _0x4e5ea9;});}})[_0xe02c('0x23')](respondWithFilteredResult(_0x5c0506,_0x3b2bac))[_0xe02c('0x2c')](handleError(_0x5c0506,null));};exports[_0xe02c('0x6f')]=function(_0x24928e,_0x1a13dd,_0x21e8b1){return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x24928e[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x1a13dd,null))[_0xe02c('0x23')](function(_0xbe3ff6){if(_0xbe3ff6){return _0xbe3ff6[_0xe02c('0x6f')](_0x24928e[_0xe02c('0x45')]['ids']);}})[_0xe02c('0x23')](respondWithStatusCode(_0x1a13dd,null))[_0xe02c('0x2c')](handleError(_0x1a13dd,null));};exports[_0xe02c('0x70')]=function(_0x4a0334,_0x3bd125,_0x2d0c36){var _0x1832ad={'channel':_0xe02c('0x71')};var _0x3b73a5=[];var _0x2be264=[];var _0x2f3ecd={};return db['SmsAccount'][_0xe02c('0x59')]({'where':{'id':_0x4a0334[_0xe02c('0x62')]['id']},'include':[{'model':db[_0xe02c('0x72')],'as':_0xe02c('0x73')}]})[_0xe02c('0x23')](handleEntityNotFound(_0x3bd125,null))[_0xe02c('0x23')](function(_0x1c2222){_0x1832ad[_0xe02c('0x74')]=_0x1c2222;_0x1832ad[_0xe02c('0x75')]=_['orderBy'](_0x1c2222[_0xe02c('0x73')],[_0xe02c('0x76')],['asc']);if(_0x1832ad[_0xe02c('0x74')][_0xe02c('0x73')]){delete _0x1832ad[_0xe02c('0x74')][_0xe02c('0x73')];}return db[_0xe02c('0x77')][_0xe02c('0x64')]();})['then'](function(_0xc21958){if(!_0xc21958){throw new db[(_0xe02c('0x20'))][(_0xe02c('0x21'))]('no\x20available\x20attributes');}_0x3b73a5=_['difference'](_[_0xe02c('0x46')](_0xc21958),[_0xe02c('0x78'),_0xe02c('0x79')]);_0x2be264=_['difference'](_[_0xe02c('0x46')](_0xc21958),[_0xe02c('0x78'),_0xe02c('0x79'),_0xe02c('0x7a'),_0xe02c('0x7b')]);_0x1832ad['body']={'mapKey':_0xe02c('0x7c')};if(_0x1832ad[_0xe02c('0x74')][_0xe02c('0x42')]){switch(_0x1832ad[_0xe02c('0x74')][_0xe02c('0x42')]){case _0xe02c('0x7d'):_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x7f')];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x80')];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x81')]=_0x4a0334[_0xe02c('0x5b')]['MessageSid'];break;case'skebby':_0x1832ad[_0xe02c('0x5b')]['from']='+'+_0x4a0334['body']['sender'];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')]=_0x4a0334[_0xe02c('0x5b')]['text'];break;case _0xe02c('0x82'):_0x1832ad['body']['from']=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x7e')];_0x1832ad['body'][_0xe02c('0x5b')]=_0x4a0334['body']['message'];break;case _0xe02c('0x83'):_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')]=_0x4a0334[_0xe02c('0x5b')]['from'];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x5b')];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x81')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x84')];break;case _0xe02c('0x85'):_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x7f')];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x86')];_0x1832ad['body'][_0xe02c('0x81')]=_0x4a0334[_0xe02c('0x5b')]['MessageUUID'];break;case _0xe02c('0x87'):_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')]='+'+_0x4a0334['body'][_0xe02c('0x88')][0x0][_0xe02c('0x7e')];_0x1832ad[_0xe02c('0x5b')]['body']=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x88')][0x0][_0xe02c('0x89')];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x81')]=_0x4a0334['body'][_0xe02c('0x88')][0x0]['messageId'];break;case _0xe02c('0x8a'):_0x1832ad['body'][_0xe02c('0x7e')]=_0x4a0334['body'][_0xe02c('0x8b')];_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x8c')]['message'];break;case'clickatell':_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')]=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x8d')];_0x1832ad[_0xe02c('0x5b')]['body']=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x89')];_0x1832ad[_0xe02c('0x5b')]['messageId']=_0x4a0334[_0xe02c('0x5b')][_0xe02c('0x8e')];break;case _0xe02c('0x8f'):_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')]=_0x4a0334[_0xe02c('0x5b')]['from'];_0x1832ad['body'][_0xe02c('0x5b')]=_0x4a0334[_0xe02c('0x5b')]['message'];_0x1832ad['body']['messageId']=_0x4a0334['body'][_0xe02c('0x90')];break;}}if(_0x1832ad[_0xe02c('0x5b')]['id']){delete _0x1832ad[_0xe02c('0x5b')]['id'];}if(_[_0xe02c('0x91')](_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')])){throw new db[(_0xe02c('0x20'))][(_0xe02c('0x21'))](_0xe02c('0x92'));}if(_['isNil'](_0x1832ad['body'][_0xe02c('0x5b')])||_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')]===''){throw new db[(_0xe02c('0x20'))][(_0xe02c('0x21'))](_0xe02c('0x93'));}if(_[_0xe02c('0x91')](_0x1832ad['body'][_0xe02c('0x94')])){throw new db['Sequelize']['ValidationError'](_0xe02c('0x95')+_0x2be264);}if(!_['includes'](_0x2be264,_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x94')])){throw new db[(_0xe02c('0x20'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2be264);}_0x2f3ecd[_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x94')]]=_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')];return db['CmList']['find']({'where':{'id':_0x1832ad[_0xe02c('0x74')][_0xe02c('0x7b')]},'include':[{'model':db[_0xe02c('0x77')],'as':_0xe02c('0x96'),'where':_0x2f3ecd,'limit':0x1,'order':[[_0xe02c('0x79'),'DESC']]}]});})[_0xe02c('0x23')](handleEntityNotFound(_0x3bd125,null))[_0xe02c('0x23')](function(_0xcf8168){if(_0xcf8168){_0x1832ad[_0xe02c('0x97')]=_['omit'](_0xcf8168,[_0xe02c('0x96')]);if(_0xcf8168[_0xe02c('0x96')][_0xe02c('0x4b')]){return _0xcf8168['Contacts'][0x0];}var _0x4dc435=_[_0xe02c('0x1c')](_0x1832ad[_0xe02c('0x5b')],{'firstName':_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')],'ListId':_0xcf8168['id']});_0x4dc435[_0x1832ad[_0xe02c('0x5b')]['mapKey']]=_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')];return db[_0xe02c('0x77')][_0xe02c('0x5a')](_0x4dc435,{'fields':_0x3b73a5,'raw':!![]});}})[_0xe02c('0x23')](handleEntityNotFound(_0x3bd125,null))['then'](function(_0x5a973b){if(_0x5a973b){_0x1832ad[_0xe02c('0x98')]=_0x5a973b;var _0x1511e4={'ContactId':_0x5a973b['id'],'phone':_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')],'SmsAccountId':_0x4a0334[_0xe02c('0x62')]['id']};var _0x140876={'ContactId':_0x5a973b['id'],'SmsAccountId':_0x4a0334[_0xe02c('0x62')]['id'],'closed':![]};return db[_0xe02c('0x99')][_0xe02c('0x59')]({'where':_0x140876})[_0xe02c('0x23')](function(_0x3a1d3f){if(_0x3a1d3f){return[_0x3a1d3f,![]];}return db['SmsInteraction']['create'](_0x1511e4)['then'](function(_0x26aefe){return[_0x26aefe,!![]];});});}})['spread'](function(_0x3d2be5,_0x14f58b){_0x1832ad[_0xe02c('0x9a')]=_0x3d2be5['get']({'plain':!![]});_0x1832ad['interaction'][_0xe02c('0x9b')]=![];if(_0x14f58b){if(_0x1832ad['account'][_0xe02c('0x9c')]){_0x1832ad[_0xe02c('0x75')][_0xe02c('0x9d')]({'id':0x0,'priority':_0x1832ad[_0xe02c('0x75')][_0xe02c('0x4b')]+0x1,'app':_0xe02c('0x9e'),'appdata':_0xe02c('0x9f'),'interval':_0xe02c('0xa0')});}_0x1832ad[_0xe02c('0x9a')][_0xe02c('0x9b')]=!![];}return db[_0xe02c('0xa1')][_0xe02c('0x5a')]({'phone':_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x7e')],'messageId':_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x81')],'body':_0x1832ad[_0xe02c('0x5b')][_0xe02c('0x5b')],'SmsAccountId':_0x4a0334[_0xe02c('0x62')]['id'],'SmsInteractionId':_0x3d2be5['id'],'direction':'in','ContactId':_0x3d2be5[_0xe02c('0xa2')],'AttachmentId':_0x1832ad['body'][_0xe02c('0xa3')]});})[_0xe02c('0x23')](function(_0x1e6e2c){_0x1832ad[_0xe02c('0x2a')]=_0x1e6e2c;if(_0x1832ad[_0xe02c('0x9a')][_0xe02c('0xa4')]){return db[_0xe02c('0xa5')]['find']({'attributes':['id',_0xe02c('0x3b')],'where':{'id':_0x1832ad[_0xe02c('0x9a')][_0xe02c('0xa4')]}})[_0xe02c('0x23')](function(_0x54b70e){if(_0x54b70e){_0x1832ad[_0xe02c('0x75')][_0xe02c('0xa6')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x54b70e['name']+','+(_0x1832ad[_0xe02c('0x74')][_0xe02c('0xa7')]||0xa),'interval':_0xe02c('0xa0')});}return respondWithRpcPromise(_0xe02c('0xa8'),_0xe02c('0xa9'),_0x1832ad);});}return respondWithRpcPromise(_0xe02c('0xa8'),_0xe02c('0xa9'),_0x1832ad);})[_0xe02c('0x23')](function(_0x57e1a4){if(_0x57e1a4){var _0x19d766=0xc8;var _0x235d39='receiveMessage';logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x235d39,_0x19d766,_0xe02c('0xaa'));logger[_0xe02c('0xab')](_0xe02c('0xac'),_0x235d39,_0x19d766,_0xe02c('0xaa'),JSON[_0xe02c('0x26')](_0x57e1a4));if(_0x1832ad[_0xe02c('0x74')][_0xe02c('0x42')]===_0xe02c('0x7d')){return _0x3bd125[_0xe02c('0x2f')](_0x19d766)[_0xe02c('0xad')]('Content-Type',_0xe02c('0xae'))[_0xe02c('0x3c')](_0xe02c('0xaf'));}else{return _0x3bd125[_0xe02c('0x2f')](_0x19d766)[_0xe02c('0x30')](_0x57e1a4);}}})[_0xe02c('0x2c')](handleError(_0x3bd125,null));};exports[_0xe02c('0xb0')]=function(_0x50fa5a,_0x5bb23d,_0x538d32){return db['SmsAccount'][_0xe02c('0x68')]({'where':{'id':_0x50fa5a[_0xe02c('0x62')]['id']}})['then'](handleEntityNotFound(_0x5bb23d,null))[_0xe02c('0x23')](function(_0x28e509){if(_0x28e509){return db[_0xe02c('0xb1')]['transaction'](function(_0x3b20e9){return db[_0xe02c('0x72')][_0xe02c('0x39')]({'where':{'SmsAccountId':_0x50fa5a[_0xe02c('0x62')]['id']},'transaction':_0x3b20e9})[_0xe02c('0x23')](function(_0x5ebf58){var _0x473bc2=_[_0xe02c('0x3f')](_0x50fa5a[_0xe02c('0x5b')],function(_0x5cc515){_0x5cc515[_0xe02c('0x65')]=_0x50fa5a['params']['id'];return _0x5cc515;});return db[_0xe02c('0x72')][_0xe02c('0xb2')](_0x473bc2,{'transaction':_0x3b20e9});});})['then'](function(){return db[_0xe02c('0x72')][_0xe02c('0xb3')]({'where':{'SmsAccountId':_0x50fa5a[_0xe02c('0x62')]['id']},'order':_0xe02c('0x76')});});}})[_0xe02c('0x23')](respondWithResult(_0x5bb23d,null))[_0xe02c('0x2c')](handleError(_0x5bb23d,null));};exports[_0xe02c('0xb4')]=function(_0x3dd774,_0x37a2bc,_0x15f5d6){var _0x3e4ed4={};var _0x57ef2e={};var _0xa384c1;var _0x19d9a2;return db['SmsAccount']['findOne']({'where':{'id':_0x3dd774[_0xe02c('0x62')]['id']}})['then'](handleEntityNotFound(_0x37a2bc,null))['then'](function(_0x513998){if(_0x513998){_0xa384c1=_0x513998;_0x57ef2e[_0xe02c('0x44')]=_[_0xe02c('0x46')](db[_0xe02c('0x72')][_0xe02c('0x41')]);_0x57ef2e[_0xe02c('0x45')]=_[_0xe02c('0x46')](_0x3dd774['query']);_0x57ef2e[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x57ef2e['model'],_0x57ef2e['query']);_0x3e4ed4[_0xe02c('0x49')]=_[_0xe02c('0x48')](_0x57ef2e[_0xe02c('0x44')],qs[_0xe02c('0x4a')](_0x3dd774['query']['fields']));_0x3e4ed4[_0xe02c('0x49')]=_0x3e4ed4[_0xe02c('0x49')][_0xe02c('0x4b')]?_0x3e4ed4['attributes']:_0x57ef2e[_0xe02c('0x44')];_0x3e4ed4[_0xe02c('0x4e')]=qs[_0xe02c('0x4f')](_0x3dd774[_0xe02c('0x45')][_0xe02c('0x4f')]);_0x3e4ed4[_0xe02c('0x50')]=qs[_0xe02c('0x47')](_['pick'](_0x3dd774[_0xe02c('0x45')],_0x57ef2e[_0xe02c('0x47')]));if(_0x3dd774[_0xe02c('0x45')][_0xe02c('0x52')]){_0x3e4ed4[_0xe02c('0x50')]=_[_0xe02c('0x53')](_0x3e4ed4[_0xe02c('0x50')],{'$or':_['map'](_0x3e4ed4[_0xe02c('0x49')],function(_0x4d9c7c){var _0x12d26a={};_0x12d26a[_0x4d9c7c]={'$like':'%'+_0x3dd774['query'][_0xe02c('0x52')]+'%'};return _0x12d26a;})});}_0x3e4ed4=_[_0xe02c('0x53')]({},_0x3e4ed4,_0x3dd774[_0xe02c('0x55')]);return _0xa384c1[_0xe02c('0xb4')](_0x3e4ed4);}})['then'](function(_0x2a927e){if(_0x2a927e){_0x19d9a2=_0x2a927e[_0xe02c('0x4b')];if(!_0x3dd774[_0xe02c('0x45')][_0xe02c('0x4c')](_0xe02c('0x4d'))){_0x3e4ed4[_0xe02c('0x33')]=qs[_0xe02c('0x33')](_0x3dd774[_0xe02c('0x45')][_0xe02c('0x33')]);_0x3e4ed4[_0xe02c('0x32')]=qs[_0xe02c('0x32')](_0x3dd774[_0xe02c('0x45')][_0xe02c('0x32')]);}return _0xa384c1[_0xe02c('0xb4')](_0x3e4ed4);}})[_0xe02c('0x23')](function(_0x1c9887){if(_0x1c9887){return _0x1c9887?{'count':_0x19d9a2,'rows':_0x1c9887}:null;}})[_0xe02c('0x23')](respondWithResult(_0x37a2bc,null))[_0xe02c('0x2c')](handleError(_0x37a2bc,null));};exports['getInteractions']=function(_0x547e8c,_0x49c9fb,_0x493435){var _0x36398e={'raw':![],'where':{}};var _0x34b748={};var _0x282e79={'count':0x0,'rows':[]};return db[_0xe02c('0x40')]['findOne']({'where':{'id':_0x547e8c['params']['id']}})['then'](handleEntityNotFound(_0x49c9fb,null))[_0xe02c('0x23')](function(_0x2a1f02){if(_0x2a1f02){_0x34b748[_0xe02c('0x44')]=_[_0xe02c('0x46')](db['SmsInteraction'][_0xe02c('0x41')]);_0x34b748['query']=_['keys'](_0x547e8c[_0xe02c('0x45')]);_0x34b748[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x34b748['model'],_0x34b748[_0xe02c('0x45')]);_0x36398e[_0xe02c('0x49')]=_[_0xe02c('0x48')](_0x34b748[_0xe02c('0x44')],qs[_0xe02c('0x4a')](_0x547e8c[_0xe02c('0x45')][_0xe02c('0x4a')]));_0x36398e[_0xe02c('0x49')]=_0x36398e['attributes']['length']?_0x36398e[_0xe02c('0x49')]:_0x34b748[_0xe02c('0x44')];if(!_0x547e8c[_0xe02c('0x45')][_0xe02c('0x4c')]('nolimit')){_0x36398e['limit']=qs[_0xe02c('0x33')](_0x547e8c[_0xe02c('0x45')][_0xe02c('0x33')]);_0x36398e[_0xe02c('0x32')]=qs[_0xe02c('0x32')](_0x547e8c[_0xe02c('0x45')][_0xe02c('0x32')]);}_0x36398e[_0xe02c('0x4e')]=qs[_0xe02c('0x4f')](_0x547e8c[_0xe02c('0x45')][_0xe02c('0x4f')]);_0x36398e['where']=qs[_0xe02c('0x47')](_[_0xe02c('0x51')](_0x547e8c['query'],_0x34b748[_0xe02c('0x47')]));_0x36398e[_0xe02c('0x50')]['SmsAccountId']=_0x2a1f02['id'];if(_0x547e8c[_0xe02c('0x45')][_0xe02c('0x52')]){_0x36398e[_0xe02c('0x50')]=_[_0xe02c('0x53')](_0x36398e[_0xe02c('0x50')],{'$or':_[_0xe02c('0x3f')](_0x36398e[_0xe02c('0x49')],function(_0x41350b){var _0xadb5a0={};_0xadb5a0[_0x41350b]={'$like':'%'+_0x547e8c[_0xe02c('0x45')][_0xe02c('0x52')]+'%'};return _0xadb5a0;})});}_0x36398e=_[_0xe02c('0x53')]({},_0x36398e,_0x547e8c[_0xe02c('0x55')]);return db[_0xe02c('0x99')][_0xe02c('0x31')]({'where':_0x36398e[_0xe02c('0x50')]})[_0xe02c('0x23')](function(_0xb7a31e){_0x282e79[_0xe02c('0x31')]=_0xb7a31e;if(_0x547e8c[_0xe02c('0x45')][_0xe02c('0x56')]){_0x36398e[_0xe02c('0x57')]=[{'model':db['CmContact'],'as':_0xe02c('0xb5'),'required':![]},{'model':db[_0xe02c('0xa5')],'as':'Owner','attributes':[_0xe02c('0x3b'),_0xe02c('0xb6'),_0xe02c('0xb7')],'required':![]},{'model':db[_0xe02c('0xb8')],'as':'Tags','attributes':['id','name',_0xe02c('0xb9')],'where':_0x547e8c['query'][_0xe02c('0xba')]?{'id':_0x547e8c[_0xe02c('0x45')][_0xe02c('0xba')]}:undefined,'required':_0x547e8c[_0xe02c('0x45')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0xe02c('0x6e')](_0x36398e);})[_0xe02c('0x23')](function(_0x2adfd4){_0x282e79[_0xe02c('0x58')]=_0x2adfd4;return _0x282e79;});}})[_0xe02c('0x23')](respondWithFilteredResult(_0x49c9fb,_0x36398e))[_0xe02c('0x2c')](handleError(_0x49c9fb,null));};exports[_0xe02c('0x3c')]=function(_0x1617e0,_0x2d2921,_0x2a61e3){var _0x2b8b5d,_0x2fc0d6,_0x1bf71e;if(_['isNil'](_0x1617e0['body'][_0xe02c('0x5b')])||_0x1617e0[_0xe02c('0x5b')]['body']===''){throw new db[(_0xe02c('0x20'))][(_0xe02c('0x21'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe02c('0x91')](_0x1617e0[_0xe02c('0x5b')]['to'])){throw new db['Sequelize'][(_0xe02c('0x21'))](_0xe02c('0xbb'));}_0x2b8b5d=_0x1617e0['body']['to'];return db['SmsAccount'][_0xe02c('0x59')]({'where':{'id':_0x1617e0[_0xe02c('0x62')]['id']},'include':[{'model':db[_0xe02c('0xbc')],'as':'List','include':[{'model':db[_0xe02c('0x77')],'as':'Contacts','where':{'mobile':_0x2b8b5d},'limit':0x1,'order':[[_0xe02c('0x79'),_0xe02c('0xbd')]]}]}]})[_0xe02c('0x23')](handleEntityNotFound(_0x2d2921,null))[_0xe02c('0x23')](function(_0x1e191d){if(_0x1e191d&&_0x1e191d[_0xe02c('0xbe')]){_0x2fc0d6=_0x1e191d[_0xe02c('0x5c')]({'plain':!![]});if(_0x2fc0d6[_0xe02c('0xbe')]&&_0x2fc0d6[_0xe02c('0xbe')][_0xe02c('0x96')][_0xe02c('0x4b')]){return _0x2fc0d6[_0xe02c('0xbe')]['Contacts'][0x0];}return db['CmContact'][_0xe02c('0x5a')](_[_0xe02c('0x1c')](_0x1617e0[_0xe02c('0x5b')],{'firstName':_0x2b8b5d,'mobile':_0x2b8b5d,'phone':_0x2b8b5d,'ListId':_0x2fc0d6[_0xe02c('0x7b')]}));}})[_0xe02c('0x23')](handleEntityNotFound(_0x2d2921,null))[_0xe02c('0x23')](function(_0x308581){if(_0x308581){_0x1bf71e=_0x308581;return db[_0xe02c('0x99')][_0xe02c('0x59')]({'where':{'ContactId':_0x1bf71e['id'],'closed':![],'SmsAccountId':_0x2fc0d6['id']}})[_0xe02c('0x23')](function(_0x10a1ec){if(_0x10a1ec){return[_0x10a1ec,![]];}return db['SmsInteraction']['create']({'UserId':_0x1617e0['user']['id'],'ContactId':_0x1bf71e['id'],'SmsAccountId':_0x2fc0d6['id'],'phone':_0x2b8b5d,'firstMsgDirection':_0xe02c('0xbf'),'Messages':[_['merge'](_0x1617e0[_0xe02c('0x5b')],{'read':![],'body':_0x1617e0[_0xe02c('0x5b')]['body'],'phone':_0x2b8b5d,'SmsAccountId':_0x2fc0d6['id'],'UserId':_0x1617e0[_0xe02c('0xc0')]['id'],'ContactId':_0x1bf71e['id']})]},{'include':[{'model':db[_0xe02c('0xa1')],'as':_0xe02c('0xc1')}]})['then'](function(_0x1ea0e2){return[_0x1ea0e2,!![]];});});}})[_0xe02c('0xc2')](function(_0x5a9fca,_0x3e082c){if(_0x3e082c){return _0x5a9fca;}return db[_0xe02c('0xa1')][_0xe02c('0x5a')](_[_0xe02c('0x53')](_0x1617e0['body'],{'read':![],'body':_0x1617e0[_0xe02c('0x5b')][_0xe02c('0x5b')],'phone':_0x2b8b5d,'SmsAccountId':_0x2fc0d6['id'],'SmsInteractionId':_0x5a9fca['id'],'UserId':_0x1617e0[_0xe02c('0xc0')]['id'],'ContactId':_0x1bf71e['id']}))[_0xe02c('0x23')](function(_0x47ddd0){_0x5a9fca[_0xe02c('0xc3')]['Messages']=[];_0x5a9fca[_0xe02c('0xc3')][_0xe02c('0xc1')][_0xe02c('0x9d')](_0x47ddd0[_0xe02c('0xc3')]);return _0x5a9fca;});})[_0xe02c('0x23')](respondWithResult(_0x2d2921,null))[_0xe02c('0x2c')](handleError(_0x2d2921,null));};exports[_0xe02c('0x2f')]=function(_0x3576cf,_0x6fccba,_0x3eac9d){if(_0x3576cf[_0xe02c('0x5b')]['id']){delete _0x3576cf[_0xe02c('0x5b')]['id'];}console[_0xe02c('0xc4')]('endpoint\x20/status\x20POST\x20/',_0x3576cf['body']);var _0x59cdba,_0x4cbcf0,_0x2a4b69;return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x3576cf[_0xe02c('0x62')]['id']}})['then'](handleEntityNotFound(_0x6fccba,null))['then'](function(_0x1bbdff){if(_0x1bbdff){_0x2a4b69=_0x1bbdff;logger[_0xe02c('0xab')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe02c('0x2f'),_0xe02c('0xc5'),_0x1bbdff['type'],util[_0xe02c('0xc6')](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));switch(_0x1bbdff[_0xe02c('0x42')]){case'skebby':if(_0x3576cf[_0xe02c('0x5b')]['skebby_dispatch_id']&&_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x2f')]){_0x4cbcf0=_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x2f')];return db['SmsMessage']['find']({'where':{'messageId':_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xc7')]}});}break;case _0xe02c('0x82'):if(_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xc8')]&&_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xc9')]){_0x4cbcf0=_0x3576cf['body'][_0xe02c('0xc9')];return db['SmsMessage'][_0xe02c('0x59')]({'where':{'messageId':_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xc8')]}});}break;case _0xe02c('0x83'):if(_0x3576cf['body'][_0xe02c('0x84')]&&_0x3576cf['body']['status_code']){_0x4cbcf0=_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xca')];return db[_0xe02c('0xa1')][_0xe02c('0x59')]({'where':{'messageId':_0x3576cf['body'][_0xe02c('0x84')]}});}break;case'infobip':var _0x43f497=_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x88')][0x0];if(_0x43f497[_0xe02c('0x81')]&&_0x43f497[_0xe02c('0x2f')]['groupName']==='DELIVERED'){_0x4cbcf0=_0x43f497['status']['groupName'];return db[_0xe02c('0xa1')]['find']({'where':{'messageId':_0x43f497['messageId']}});}break;case _0xe02c('0xcb'):if(_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x81')]&&_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x2f')]){_0x4cbcf0=_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x2f')];return db[_0xe02c('0xa1')][_0xe02c('0x59')]({'where':{'messageId':_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x81')]}});}break;case _0xe02c('0x8f'):if(_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xcc')]&&_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x2f')]){_0x4cbcf0=_0x3576cf[_0xe02c('0x5b')][_0xe02c('0x2f')];return db[_0xe02c('0xa1')][_0xe02c('0x59')]({'where':{'messageId':_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xcc')]}});}break;}}})[_0xe02c('0x23')](handleEntityNotFound(_0x6fccba,null))['then'](function(_0x52688f){if(_0x52688f){_0x59cdba=_0x52688f;switch(_0x2a4b69['type']){case _0xe02c('0xcd'):if(_0x4cbcf0==='DELIVERED'){return _0x59cdba[_0xe02c('0x38')]({'read':!![]});}else{logger[_0xe02c('0x27')](_0xe02c('0xce'),_0xe02c('0x2f'),'skebby',util[_0xe02c('0xc6')](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe02c('0x82'):if(_0x4cbcf0==='1'){return _0x59cdba['update']({'read':!![]});}else{logger[_0xe02c('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe02c('0x2f'),'skebby',util['inspect'](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe02c('0x83'):if(!_0x3576cf[_0xe02c('0x5b')][_0xe02c('0xcf')]&&_0x4cbcf0>=0xc8&&_0x4cbcf0<=0xce){return _0x59cdba[_0xe02c('0x38')]({'read':!![]});}else{logger[_0xe02c('0x27')](_0xe02c('0xce'),_0xe02c('0x2f'),_0xe02c('0x83'),util[_0xe02c('0xc6')](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe02c('0x87'):var _0x5433a6=_0x3576cf[_0xe02c('0x5b')]['results'][0x0];if(_0x5433a6[_0xe02c('0x2f')][_0xe02c('0xd0')]==='DELIVERED'){return _0x59cdba[_0xe02c('0x38')]({'read':!![]});}else{logger['error'](_0xe02c('0xce'),_0xe02c('0x2f'),'infobip',util[_0xe02c('0xc6')](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xe02c('0xcb'):if(_0x4cbcf0==_0xe02c('0xd1')||_0x4cbcf0==_0xe02c('0xd2')){return _0x59cdba['update']({'read':!![]});}else{logger[_0xe02c('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe02c('0x2f'),'clickatell',util['inspect'](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x4cbcf0===_0xe02c('0xd3')||_0x4cbcf0===_0xe02c('0xd4')){return _0x59cdba['update']({'read':!![]});}else{logger[_0xe02c('0x27')](_0xe02c('0xce'),_0xe02c('0x2f'),_0xe02c('0x8f'),util['inspect'](_0x3576cf[_0xe02c('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x59cdba;}})['then'](respondWithResult(_0x6fccba,null))[_0xe02c('0x2c')](handleError(_0x6fccba,null));};exports[_0xe02c('0xd5')]=function(_0x14c95e,_0x47b7ff,_0x309bf4){var _0x4f367a,_0x443f17,_0x340b1f;return db['SmsAccount'][_0xe02c('0x59')]({'where':{'id':_0x14c95e[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x47b7ff,null))[_0xe02c('0x23')](function(_0x56706c){if(_0x56706c){_0x340b1f=_0x56706c;logger[_0xe02c('0xab')](_0xe02c('0xce'),'status','received\x20delivery\x20report\x20from',_0x56706c[_0xe02c('0x42')],util[_0xe02c('0xc6')](_0x14c95e['query'],{'showHidden':![],'depth':null}));switch(_0x56706c[_0xe02c('0x42')]){case _0xe02c('0x8a'):if(_0x14c95e[_0xe02c('0x45')][_0xe02c('0xd6')]&&_0x14c95e[_0xe02c('0x45')][_0xe02c('0xd7')]){_0x443f17=_0x14c95e[_0xe02c('0x45')]['state'];return db[_0xe02c('0xa1')][_0xe02c('0x59')]({'where':{'messageId':_0x14c95e[_0xe02c('0x45')]['message-id']}});}break;}}})[_0xe02c('0x23')](handleEntityNotFound(_0x47b7ff,null))['then'](function(_0x4d4b7c){if(_0x4d4b7c){_0x4f367a=_0x4d4b7c;switch(_0x340b1f['type']){case _0xe02c('0x8a'):if(_0x443f17==='2'||_0x443f17==='6'){return _0x4f367a[_0xe02c('0x38')]({'read':!![]});}else{logger[_0xe02c('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe02c('0x2f'),_0xe02c('0x8a'),util[_0xe02c('0xc6')](_0x14c95e['query'],{'showHidden':![],'depth':null}));};break;}return _0x4f367a;}})[_0xe02c('0x23')](respondWithResult(_0x47b7ff,null))[_0xe02c('0x2c')](handleError(_0x47b7ff,null));};exports[_0xe02c('0xd8')]=function(_0x321f85,_0x5d6a21,_0x5923ed){return db[_0xe02c('0x40')]['find']({'where':{'id':_0x321f85[_0xe02c('0x62')]['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x5d6a21,null))[_0xe02c('0x23')](function(_0x5a0b69){if(_0x5a0b69){return _0x5a0b69[_0xe02c('0xd8')](_0x321f85[_0xe02c('0x5b')][_0xe02c('0x6a')],_[_0xe02c('0xd9')](_0x321f85[_0xe02c('0x5b')],[_0xe02c('0x6a'),'id'])||{})['spread'](function(_0x2ce10e){for(var _0x5f01ed=0x0;_0x5f01ed<_0x321f85[_0xe02c('0x5b')][_0xe02c('0x6a')][_0xe02c('0x4b')];_0x5f01ed+=0x1){socket[_0xe02c('0xda')](_0xe02c('0xdb'),{'UserId':_0x321f85[_0xe02c('0x5b')][_0xe02c('0x6a')][_0x5f01ed],'SmsAccountId':_0x321f85['params']['id']});}return _0x2ce10e;});}})[_0xe02c('0x23')](respondWithResult(_0x5d6a21,null))[_0xe02c('0x2c')](handleError(_0x5d6a21,null));};exports[_0xe02c('0xdc')]=function(_0x3bc894,_0x1eba43,_0x9bf228){return db[_0xe02c('0x40')][_0xe02c('0x59')]({'where':{'id':_0x3bc894[_0xe02c('0x62')]['id']}})['then'](handleEntityNotFound(_0x1eba43,null))[_0xe02c('0x23')](function(_0x291c91){if(_0x291c91){return _0x291c91[_0xe02c('0xdc')](_0x3bc894[_0xe02c('0x45')][_0xe02c('0x6a')])[_0xe02c('0x23')](function(){if(_[_0xe02c('0xdd')](_0x3bc894[_0xe02c('0x45')]['ids'])){for(var _0x3cfbc8=0x0;_0x3cfbc8<_0x3bc894[_0xe02c('0x45')][_0xe02c('0x6a')][_0xe02c('0x4b')];_0x3cfbc8+=0x1){socket['emit'](_0xe02c('0xde'),{'UserId':Number(_0x3bc894[_0xe02c('0x45')][_0xe02c('0x6a')][_0x3cfbc8]),'SmsAccountId':Number(_0x3bc894[_0xe02c('0x62')]['id'])});}}else{socket[_0xe02c('0xda')]('userSmsAccount:remove',{'UserId':Number(_0x3bc894[_0xe02c('0x45')]['ids']),'SmsAccountId':Number(_0x3bc894[_0xe02c('0x62')]['id'])});}});}})[_0xe02c('0x23')](respondWithStatusCode(_0x1eba43,null))['catch'](handleError(_0x1eba43,null));};exports[_0xe02c('0xdf')]=function(_0x121eca,_0x440261,_0x32d1f2){var _0xfa8bd6={};var _0x256328={};var _0x4ae8db;var _0x1b53c8;return db[_0xe02c('0x40')][_0xe02c('0x68')]({'where':{'id':_0x121eca['params']['id']}})[_0xe02c('0x23')](handleEntityNotFound(_0x440261,null))[_0xe02c('0x23')](function(_0x54be90){if(_0x54be90){_0x4ae8db=_0x54be90;_0x256328[_0xe02c('0x44')]=_['keys'](db['User'][_0xe02c('0x41')]);_0x256328[_0xe02c('0x45')]=_[_0xe02c('0x46')](_0x121eca[_0xe02c('0x45')]);_0x256328[_0xe02c('0x47')]=_[_0xe02c('0x48')](_0x256328[_0xe02c('0x44')],_0x256328[_0xe02c('0x45')]);_0xfa8bd6[_0xe02c('0x49')]=_[_0xe02c('0x48')](_0x256328['model'],qs['fields'](_0x121eca[_0xe02c('0x45')][_0xe02c('0x4a')]));_0xfa8bd6['attributes']=_0xfa8bd6['attributes'][_0xe02c('0x4b')]?_0xfa8bd6[_0xe02c('0x49')]:_0x256328[_0xe02c('0x44')];_0xfa8bd6[_0xe02c('0x4e')]=qs[_0xe02c('0x4f')](_0x121eca['query'][_0xe02c('0x4f')]);_0xfa8bd6[_0xe02c('0x50')]=qs[_0xe02c('0x47')](_[_0xe02c('0x51')](_0x121eca[_0xe02c('0x45')],_0x256328[_0xe02c('0x47')]));if(_0x121eca[_0xe02c('0x45')][_0xe02c('0x52')]){_0xfa8bd6[_0xe02c('0x50')]=_[_0xe02c('0x53')](_0xfa8bd6[_0xe02c('0x50')],{'$or':_[_0xe02c('0x3f')](_0xfa8bd6[_0xe02c('0x49')],function(_0x34e8d5){var _0x30cc86={};_0x30cc86[_0x34e8d5]={'$like':'%'+_0x121eca[_0xe02c('0x45')]['filter']+'%'};return _0x30cc86;})});}_0xfa8bd6=_[_0xe02c('0x53')]({},_0xfa8bd6,_0x121eca['options']);return _0x4ae8db[_0xe02c('0xdf')](_0xfa8bd6);}})['then'](function(_0x3a8aa6){if(_0x3a8aa6){_0x1b53c8=_0x3a8aa6[_0xe02c('0x4b')];if(!_0x121eca[_0xe02c('0x45')][_0xe02c('0x4c')](_0xe02c('0x4d'))){_0xfa8bd6['limit']=qs[_0xe02c('0x33')](_0x121eca[_0xe02c('0x45')][_0xe02c('0x33')]);_0xfa8bd6[_0xe02c('0x32')]=qs[_0xe02c('0x32')](_0x121eca[_0xe02c('0x45')]['offset']);}return _0x4ae8db['getAgents'](_0xfa8bd6);}})[_0xe02c('0x23')](function(_0x393d2e){if(_0x393d2e){return _0x393d2e?{'count':_0x1b53c8,'rows':_0x393d2e}:null;}})[_0xe02c('0x23')](respondWithResult(_0x440261,null))[_0xe02c('0x2c')](handleError(_0x440261,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index ac11c96..17109b5 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 _0x2ea3=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x461996,_0xfc39b){var _0x2cd79f=function(_0x441130){while(--_0x441130){_0x461996['push'](_0x461996['shift']());}};_0x2cd79f(++_0xfc39b);}(_0x2ea3,0x196));var _0x32ea=function(_0xb65759,_0x1b1b9a){_0xb65759=_0xb65759-0x0;var _0x11a85e=_0x2ea3[_0xb65759];return _0x11a85e;};'use strict';var EventEmitter=require(_0x32ea('0x0'));var SmsAccount=require(_0x32ea('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x32ea('0x2')](0x0);var events={'afterCreate':_0x32ea('0x3'),'afterUpdate':_0x32ea('0x4'),'afterDestroy':_0x32ea('0x5')};function emitEvent(_0x5f470e){return function(_0x22cc18,_0x1f459b,_0x59b0d7){SmsAccountEvents[_0x32ea('0x6')](_0x5f470e+':'+_0x22cc18['id'],_0x22cc18);SmsAccountEvents[_0x32ea('0x6')](_0x5f470e,_0x22cc18);_0x59b0d7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x32ea('0x7')](e,emitEvent(event));}}module[_0x32ea('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x70a2=['emit','hasOwnProperty','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove'];(function(_0x4d8357,_0x3071fb){var _0x25df73=function(_0x48e36b){while(--_0x48e36b){_0x4d8357['push'](_0x4d8357['shift']());}};_0x25df73(++_0x3071fb);}(_0x70a2,0x1ea));var _0x270a=function(_0x381927,_0x684dab){_0x381927=_0x381927-0x0;var _0x5f2835=_0x70a2[_0x381927];return _0x5f2835;};'use strict';var EventEmitter=require(_0x270a('0x0'));var SmsAccount=require(_0x270a('0x1'))['db'][_0x270a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x270a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x270a('0x4'),'afterDestroy':_0x270a('0x5')};function emitEvent(_0x1fa725){return function(_0x484302,_0x5a9acf,_0x2f0f75){SmsAccountEvents[_0x270a('0x6')](_0x1fa725+':'+_0x484302['id'],_0x484302);SmsAccountEvents[_0x270a('0x6')](_0x1fa725,_0x484302);_0x2f0f75(null);};}for(var e in events){if(events[_0x270a('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index f5359f8..4900622 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 _0xb383=['../../config/environment','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','api','bluebird','request-promise'];(function(_0xa540b0,_0x3b1e9c){var _0x2b0bd=function(_0x384faf){while(--_0x384faf){_0xa540b0['push'](_0xa540b0['shift']());}};_0x2b0bd(++_0x3b1e9c);}(_0xb383,0x87));var _0x3b38=function(_0x933de6,_0x44951d){_0x933de6=_0x933de6-0x0;var _0x2bd659=_0xb383[_0x933de6];return _0x2bd659;};'use strict';var _=require(_0x3b38('0x0'));var util=require(_0x3b38('0x1'));var logger=require('../../config/logger')(_0x3b38('0x2'));var moment=require('moment');var BPromise=require(_0x3b38('0x3'));var rp=require(_0x3b38('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b38('0x5'));var attributes=require(_0x3b38('0x6'));module[_0x3b38('0x7')]=function(_0x523df7,_0x5c4802){return _0x523df7[_0x3b38('0x8')](_0x3b38('0x9'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd73=['define','SmsAccount','sms_accounts','lodash','util','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x217144,_0x2306f8){var _0x250bb3=function(_0x4e3275){while(--_0x4e3275){_0x217144['push'](_0x217144['shift']());}};_0x250bb3(++_0x2306f8);}(_0xcd73,0x184));var _0x3cd7=function(_0x5948e3,_0x2b900d){_0x5948e3=_0x5948e3-0x0;var _0x357237=_0xcd73[_0x5948e3];return _0x357237;};'use strict';var _=require(_0x3cd7('0x0'));var util=require(_0x3cd7('0x1'));var logger=require('../../config/logger')(_0x3cd7('0x2'));var moment=require('moment');var BPromise=require(_0x3cd7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3cd7('0x4'));var rimraf=require(_0x3cd7('0x5'));var config=require(_0x3cd7('0x6'));var attributes=require('./smsAccount.attributes');module[_0x3cd7('0x7')]=function(_0x490c5f,_0xca9fb){return _0x490c5f[_0x3cd7('0x8')](_0x3cd7('0x9'),attributes,{'tableName':_0x3cd7('0xa'),'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 6680e4d..c93ffd7 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 _0x6fec=['../../config/utils','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','SmsAccount','find','options','raw','where','attributes','include','map','model','ShowSmsAccount','util','moment','bluebird','../../mysqldb'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x6fec,0xa1));var _0xc6fe=function(_0x28b788,_0x1bf13a){_0x28b788=_0x28b788-0x0;var _0x24655b=_0x6fec[_0x28b788];return _0x24655b;};'use strict';var _=require('lodash');var util=require(_0xc6fe('0x0'));var moment=require(_0xc6fe('0x1'));var BPromise=require(_0xc6fe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc6fe('0x3'))['db'];var utils=require(_0xc6fe('0x4'));var logger=require('../../config/logger')(_0xc6fe('0x5'));var config=require(_0xc6fe('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc6fe('0x7')][_0xc6fe('0x8')]({'port':0x232a});config[_0xc6fe('0x9')]=_[_0xc6fe('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc6fe('0xb'))(new Redis(config['redis']));require(_0xc6fe('0xc'))['register'](socket);function respondWithRpcPromise(_0x2437b5,_0x45d4b8,_0x5e3d56){return new BPromise(function(_0x24d2a1,_0x491e88){return client['request'](_0x2437b5,_0x5e3d56)[_0xc6fe('0xd')](function(_0x487460){logger[_0xc6fe('0xe')](_0xc6fe('0xf'),_0x45d4b8,'request\x20sent');logger[_0xc6fe('0x10')](_0xc6fe('0x11'),_0x45d4b8,_0xc6fe('0x12'),JSON[_0xc6fe('0x13')](_0x487460));if(_0x487460[_0xc6fe('0x14')]){if(_0x487460[_0xc6fe('0x14')]['code']===0x1f4){logger[_0xc6fe('0x14')](_0xc6fe('0xf'),_0x45d4b8,_0x487460['error'][_0xc6fe('0x15')]);return _0x491e88(_0x487460[_0xc6fe('0x14')]['message']);}logger[_0xc6fe('0x14')](_0xc6fe('0xf'),_0x45d4b8,_0x487460[_0xc6fe('0x14')][_0xc6fe('0x15')]);return _0x24d2a1(_0x487460[_0xc6fe('0x14')]['message']);}else{logger['info'](_0xc6fe('0xf'),_0x45d4b8,_0xc6fe('0x12'));_0x24d2a1(_0x487460['result'][_0xc6fe('0x15')]);}})[_0xc6fe('0x16')](function(_0x45a269){logger[_0xc6fe('0x14')](_0xc6fe('0xf'),_0x45d4b8,_0x45a269);_0x491e88(_0x45a269);});});}exports['ShowSmsAccount']=function(_0x193984){var _0x1be5b5=this;return new Promise(function(_0x23d131,_0xe63f8d){return db[_0xc6fe('0x17')][_0xc6fe('0x18')]({'raw':_0x193984[_0xc6fe('0x19')]?_0x193984[_0xc6fe('0x19')][_0xc6fe('0x1a')]===undefined?!![]:![]:!![],'where':_0x193984[_0xc6fe('0x19')]?_0x193984[_0xc6fe('0x19')][_0xc6fe('0x1b')]||null:null,'attributes':_0x193984[_0xc6fe('0x19')]?_0x193984[_0xc6fe('0x19')][_0xc6fe('0x1c')]||null:null,'include':_0x193984[_0xc6fe('0x19')]?_0x193984[_0xc6fe('0x19')][_0xc6fe('0x1d')]?_[_0xc6fe('0x1e')](_0x193984['options'][_0xc6fe('0x1d')],function(_0x2165b){return{'model':db[_0x2165b['model']],'as':_0x2165b['as'],'attributes':_0x2165b[_0xc6fe('0x1c')],'include':_0x2165b[_0xc6fe('0x1d')]?_[_0xc6fe('0x1e')](_0x2165b[_0xc6fe('0x1d')],function(_0x144031){return{'model':db[_0x144031['model']],'as':_0x144031['as'],'attributes':_0x144031[_0xc6fe('0x1c')],'include':_0x144031[_0xc6fe('0x1d')]?_[_0xc6fe('0x1e')](_0x144031[_0xc6fe('0x1d')],function(_0x3f7b1b){return{'model':db[_0x3f7b1b[_0xc6fe('0x1f')]],'as':_0x3f7b1b['as'],'attributes':_0x3f7b1b[_0xc6fe('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xfa4d45){logger[_0xc6fe('0xe')](_0xc6fe('0x20'),_0x193984);logger[_0xc6fe('0x10')](_0xc6fe('0x20'),_0x193984,JSON[_0xc6fe('0x13')](_0xfa4d45));_0x23d131(_0xfa4d45);})[_0xc6fe('0x16')](function(_0x54fb96){logger[_0xc6fe('0x14')](_0xc6fe('0x20'),_0x54fb96[_0xc6fe('0x15')],_0x193984);_0xe63f8d(_0x1be5b5['error'](0x1f4,_0x54fb96['message']));});});}; \ No newline at end of file +var _0x5aaa=['map','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','model'];(function(_0x1ab724,_0x2e2566){var _0x2167ac=function(_0xb2e7fd){while(--_0xb2e7fd){_0x1ab724['push'](_0x1ab724['shift']());}};_0x2167ac(++_0x2e2566);}(_0x5aaa,0x18e));var _0xa5aa=function(_0xcea957,_0xb30371){_0xcea957=_0xcea957-0x0;var _0xea6f1b=_0x5aaa[_0xcea957];return _0xea6f1b;};'use strict';var _=require(_0xa5aa('0x0'));var util=require(_0xa5aa('0x1'));var moment=require(_0xa5aa('0x2'));var BPromise=require(_0xa5aa('0x3'));var rs=require(_0xa5aa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa5aa('0x5'))('rpc');var config=require(_0xa5aa('0x6'));var jayson=require(_0xa5aa('0x7'));var client=jayson[_0xa5aa('0x8')][_0xa5aa('0x9')]({'port':0x232a});config['redis']=_[_0xa5aa('0xa')](config[_0xa5aa('0xb')],{'host':_0xa5aa('0xc'),'port':0x18eb});var socket=require(_0xa5aa('0xd'))(new Redis(config[_0xa5aa('0xb')]));require(_0xa5aa('0xe'))[_0xa5aa('0xf')](socket);function respondWithRpcPromise(_0x8113b9,_0x2c7dda,_0x475df9){return new BPromise(function(_0x4b81f5,_0xa36b57){return client['request'](_0x8113b9,_0x475df9)[_0xa5aa('0x10')](function(_0x25eda5){logger[_0xa5aa('0x11')](_0xa5aa('0x12'),_0x2c7dda,_0xa5aa('0x13'));logger[_0xa5aa('0x14')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2c7dda,'request\x20sent',JSON[_0xa5aa('0x15')](_0x25eda5));if(_0x25eda5[_0xa5aa('0x16')]){if(_0x25eda5[_0xa5aa('0x16')][_0xa5aa('0x17')]===0x1f4){logger[_0xa5aa('0x16')](_0xa5aa('0x12'),_0x2c7dda,_0x25eda5[_0xa5aa('0x16')][_0xa5aa('0x18')]);return _0xa36b57(_0x25eda5[_0xa5aa('0x16')][_0xa5aa('0x18')]);}logger[_0xa5aa('0x16')](_0xa5aa('0x12'),_0x2c7dda,_0x25eda5[_0xa5aa('0x16')]['message']);return _0x4b81f5(_0x25eda5['error'][_0xa5aa('0x18')]);}else{logger[_0xa5aa('0x11')](_0xa5aa('0x12'),_0x2c7dda,_0xa5aa('0x13'));_0x4b81f5(_0x25eda5['result']['message']);}})['catch'](function(_0xde4b3b){logger[_0xa5aa('0x16')](_0xa5aa('0x12'),_0x2c7dda,_0xde4b3b);_0xa36b57(_0xde4b3b);});});}exports[_0xa5aa('0x19')]=function(_0x1a1ae8){var _0x8b06d8=this;return new Promise(function(_0x2007bb,_0x5f197b){return db[_0xa5aa('0x1a')][_0xa5aa('0x1b')]({'raw':_0x1a1ae8[_0xa5aa('0x1c')]?_0x1a1ae8[_0xa5aa('0x1c')][_0xa5aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a1ae8[_0xa5aa('0x1c')]?_0x1a1ae8[_0xa5aa('0x1c')][_0xa5aa('0x1e')]||null:null,'attributes':_0x1a1ae8[_0xa5aa('0x1c')]?_0x1a1ae8[_0xa5aa('0x1c')][_0xa5aa('0x1f')]||null:null,'include':_0x1a1ae8[_0xa5aa('0x1c')]?_0x1a1ae8[_0xa5aa('0x1c')][_0xa5aa('0x20')]?_['map'](_0x1a1ae8['options']['include'],function(_0x22e944){return{'model':db[_0x22e944[_0xa5aa('0x21')]],'as':_0x22e944['as'],'attributes':_0x22e944[_0xa5aa('0x1f')],'include':_0x22e944[_0xa5aa('0x20')]?_[_0xa5aa('0x22')](_0x22e944[_0xa5aa('0x20')],function(_0x2056aa){return{'model':db[_0x2056aa[_0xa5aa('0x21')]],'as':_0x2056aa['as'],'attributes':_0x2056aa[_0xa5aa('0x1f')],'include':_0x2056aa[_0xa5aa('0x20')]?_[_0xa5aa('0x22')](_0x2056aa['include'],function(_0x21699f){return{'model':db[_0x21699f['model']],'as':_0x21699f['as'],'attributes':_0x21699f['attributes']};}):[]};}):[]};}):[]:[]})[_0xa5aa('0x10')](function(_0x1b3530){logger[_0xa5aa('0x11')](_0xa5aa('0x19'),_0x1a1ae8);logger[_0xa5aa('0x14')]('ShowSmsAccount',_0x1a1ae8,JSON[_0xa5aa('0x15')](_0x1b3530));_0x2007bb(_0x1b3530);})[_0xa5aa('0x23')](function(_0x3ee78e){logger['error'](_0xa5aa('0x19'),_0x3ee78e[_0xa5aa('0x18')],_0x1a1ae8);_0x5f197b(_0x8b06d8[_0xa5aa('0x16')](0x1f4,_0x3ee78e[_0xa5aa('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 0532dcc..93d5abe 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 _0x29a1=['update','emit','removeListener','register','length','save','remove'];(function(_0x49f913,_0x12ccd8){var _0xf48ea5=function(_0xfd48b0){while(--_0xfd48b0){_0x49f913['push'](_0x49f913['shift']());}};_0xf48ea5(++_0x12ccd8);}(_0x29a1,0x98));var _0x129a=function(_0x3aee92,_0x27d8e4){_0x3aee92=_0x3aee92-0x0;var _0x3a59fb=_0x29a1[_0x3aee92];return _0x3a59fb;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x129a('0x0'),_0x129a('0x1'),_0x129a('0x2')];function createListener(_0xca2d1f,_0x1e3b06){return function(_0x32de03){_0x1e3b06[_0x129a('0x3')](_0xca2d1f,_0x32de03);};}function removeListener(_0x37ea8a,_0x5ee4c5){return function(){SmsAccountEvents[_0x129a('0x4')](_0x37ea8a,_0x5ee4c5);};}exports[_0x129a('0x5')]=function(_0x374cb2){for(var _0x4853a2=0x0,_0x1d39b4=events[_0x129a('0x6')];_0x4853a2<_0x1d39b4;_0x4853a2++){var _0x3cb4c5=events[_0x4853a2];var _0xa516aa=createListener('smsAccount:'+_0x3cb4c5,_0x374cb2);SmsAccountEvents['on'](_0x3cb4c5,_0xa516aa);}}; \ No newline at end of file +var _0x29d8=['register','length','save','remove','removeListener'];(function(_0x4cb408,_0x2054c9){var _0x28fc52=function(_0x5a2d57){while(--_0x5a2d57){_0x4cb408['push'](_0x4cb408['shift']());}};_0x28fc52(++_0x2054c9);}(_0x29d8,0xc5));var _0x829d=function(_0x5ed153,_0x5db670){_0x5ed153=_0x5ed153-0x0;var _0x2cde9f=_0x29d8[_0x5ed153];return _0x2cde9f;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x829d('0x0'),_0x829d('0x1'),'update'];function createListener(_0x1143ec,_0x448333){return function(_0x4b254a){_0x448333['emit'](_0x1143ec,_0x4b254a);};}function removeListener(_0x5f1bf3,_0x1d2838){return function(){SmsAccountEvents[_0x829d('0x2')](_0x5f1bf3,_0x1d2838);};}exports[_0x829d('0x3')]=function(_0x33b5fd){for(var _0x3d7fc7=0x0,_0x229b2b=events[_0x829d('0x4')];_0x3d7fc7<_0x229b2b;_0x3d7fc7++){var _0x5275ec=events[_0x3d7fc7];var _0x5cbede=createListener('smsAccount:'+_0x5275ec,_0x33b5fd);SmsAccountEvents['on'](_0x5275ec,_0x5cbede);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index 3994c55..3a306be 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 _0xc217=['destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x1c2051,_0x4cb6b9){var _0x2b58a0=function(_0x4308df){while(--_0x4308df){_0x1c2051['push'](_0x1c2051['shift']());}};_0x2b58a0(++_0x4cb6b9);}(_0xc217,0x7f));var _0x7c21=function(_0x3a60b8,_0x47caab){_0x3a60b8=_0x3a60b8-0x0;var _0x4eb583=_0xc217[_0x3a60b8];return _0x4eb583;};'use strict';var multer=require(_0x7c21('0x0'));var util=require(_0x7c21('0x1'));var path=require(_0x7c21('0x2'));var timeout=require('connect-timeout');var express=require(_0x7c21('0x3'));var router=express[_0x7c21('0x4')]();var auth=require(_0x7c21('0x5'));var interaction=require(_0x7c21('0x6'));var config=require(_0x7c21('0x7'));var controller=require(_0x7c21('0x8'));router[_0x7c21('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7c21('0x9')]('/:id',auth[_0x7c21('0xa')](),controller[_0x7c21('0xb')]);router[_0x7c21('0xc')]('/',auth[_0x7c21('0xa')](),controller[_0x7c21('0xd')]);router['put'](_0x7c21('0xe'),auth[_0x7c21('0xa')](),controller[_0x7c21('0xf')]);router[_0x7c21('0x10')](_0x7c21('0xe'),auth[_0x7c21('0xa')](),controller[_0x7c21('0x11')]);module['exports']=router; \ No newline at end of file +var _0xcbda=['connect-timeout','express','Router','../../config/environment','./smsApplication.controller','get','isAuthenticated','/:id','create','delete','destroy','exports','multer','util'];(function(_0x1f7102,_0x2201fb){var _0x3c01bd=function(_0x517f06){while(--_0x517f06){_0x1f7102['push'](_0x1f7102['shift']());}};_0x3c01bd(++_0x2201fb);}(_0xcbda,0xec));var _0xacbd=function(_0x354d7d,_0x755380){_0x354d7d=_0x354d7d-0x0;var _0x2979f6=_0xcbda[_0x354d7d];return _0x2979f6;};'use strict';var multer=require(_0xacbd('0x0'));var util=require(_0xacbd('0x1'));var path=require('path');var timeout=require(_0xacbd('0x2'));var express=require(_0xacbd('0x3'));var router=express[_0xacbd('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xacbd('0x5'));var controller=require(_0xacbd('0x6'));router[_0xacbd('0x7')]('/',auth[_0xacbd('0x8')](),controller['index']);router[_0xacbd('0x7')](_0xacbd('0x9'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xacbd('0x8')](),controller[_0xacbd('0xa')]);router['put']('/:id',auth[_0xacbd('0x8')](),controller['update']);router[_0xacbd('0xb')]('/:id',auth[_0xacbd('0x8')](),controller[_0xacbd('0xc')]);module[_0xacbd('0xd')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 7284873..5cbf057 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 _0xce74=['*,*,*,*','exports','STRING','TEXT'];(function(_0x3bc70c,_0x13e48f){var _0x377f1d=function(_0x3cd0b9){while(--_0x3cd0b9){_0x3bc70c['push'](_0x3bc70c['shift']());}};_0x377f1d(++_0x13e48f);}(_0xce74,0x171));var _0x4ce7=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xce74[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require('sequelize');module[_0x4ce7('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4ce7('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4ce7('0x2')]()},'description':{'type':Sequelize[_0x4ce7('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4ce7('0x3')}}; \ No newline at end of file +var _0xf8e9=['noop','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x42c8ce,_0xdc007f){var _0x348975=function(_0x7528ca){while(--_0x7528ca){_0x42c8ce['push'](_0x42c8ce['shift']());}};_0x348975(++_0xdc007f);}(_0xf8e9,0x1c5));var _0x9f8e=function(_0x46b7b1,_0x3d10e4){_0x46b7b1=_0x46b7b1-0x0;var _0x3c9bba=_0xf8e9[_0x46b7b1];return _0x3c9bba;};'use strict';var Sequelize=require(_0x9f8e('0x0'));module[_0x9f8e('0x1')]={'priority':{'type':Sequelize[_0x9f8e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9f8e('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9f8e('0x4')]},'interval':{'type':Sequelize[_0x9f8e('0x4')],'defaultValue':_0x9f8e('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index c27554a..896a34c 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 _0x69c5=['offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','SmsApplication','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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','../../mysqldb','status','end','json','count'];(function(_0x3f581f,_0x4ea03c){var _0x1e0d19=function(_0x2b9d8a){while(--_0x2b9d8a){_0x3f581f['push'](_0x3f581f['shift']());}};_0x1e0d19(++_0x4ea03c);}(_0x69c5,0x7a));var _0x569c=function(_0x163b23,_0x1fe80a){_0x163b23=_0x163b23-0x0;var _0x17c9a9=_0x69c5[_0x163b23];return _0x17c9a9;};'use strict';var pdf=require(_0x569c('0x0'));var emlformat=require(_0x569c('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x569c('0x2'));var jsonpatch=require(_0x569c('0x3'));var rp=require(_0x569c('0x4'));var moment=require('moment');var BPromise=require(_0x569c('0x5'));var Mustache=require(_0x569c('0x6'));var util=require(_0x569c('0x7'));var path=require(_0x569c('0x8'));var sox=require(_0x569c('0x9'));var csv=require(_0x569c('0xa'));var ejs=require(_0x569c('0xb'));var fs=require('fs');var _=require(_0x569c('0xc'));var squel=require(_0x569c('0xd'));var crypto=require(_0x569c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x569c('0xf'));var toCsv=require(_0x569c('0xa'));var querystring=require(_0x569c('0x10'));var Papa=require('papaparse');var Redis=require(_0x569c('0x11'));var authService=require(_0x569c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x569c('0x13'));var hardwareService=require(_0x569c('0x14'));var logger=require(_0x569c('0x15'))(_0x569c('0x16'));var utils=require(_0x569c('0x17'));var config=require(_0x569c('0x18'));var db=require(_0x569c('0x19'))['db'];function respondWithStatusCode(_0x56f648,_0x15b3ee){_0x15b3ee=_0x15b3ee||0xcc;return function(_0x564da4){if(_0x564da4){return _0x56f648['sendStatus'](_0x15b3ee);}return _0x56f648[_0x569c('0x1a')](_0x15b3ee)[_0x569c('0x1b')]();};}function respondWithResult(_0x52c7d1,_0x1e3204){_0x1e3204=_0x1e3204||0xc8;return function(_0x2edf37){if(_0x2edf37){return _0x52c7d1[_0x569c('0x1a')](_0x1e3204)[_0x569c('0x1c')](_0x2edf37);}};}function respondWithFilteredResult(_0xa098e8,_0x476065){return function(_0x1f29cc){if(_0x1f29cc){var _0x1fb40e=_0x1f29cc[_0x569c('0x1d')],_0xea04f9=_0x476065[_0x569c('0x1e')],_0x2ad1d2=_0x476065[_0x569c('0x1e')]+_0x476065['limit'],_0x2cd0cb;if(_0x2ad1d2>=_0x1fb40e){_0x2ad1d2=_0x1fb40e;_0x2cd0cb=0xc8;}else{_0x2cd0cb=0xce;}_0xa098e8[_0x569c('0x1a')](_0x2cd0cb);return _0xa098e8[_0x569c('0x1f')](_0x569c('0x20'),_0xea04f9+'-'+_0x2ad1d2+'/'+_0x1fb40e)['json'](_0x1f29cc);}return null;};}function patchUpdates(_0x2296c4){return function(_0x4e13fc){try{jsonpatch[_0x569c('0x21')](_0x4e13fc,_0x2296c4,!![]);}catch(_0xbabb12){return BPromise[_0x569c('0x22')](_0xbabb12);}return _0x4e13fc[_0x569c('0x23')]();};}function saveUpdates(_0x4ace07,_0x1fef93){return function(_0x2dcb41){if(_0x2dcb41){return _0x2dcb41[_0x569c('0x24')](_0x4ace07)[_0x569c('0x25')](function(_0x3a319f){return _0x3a319f;});}return null;};}function removeEntity(_0x2f75d6,_0x178a98){return function(_0x2a9938){if(_0x2a9938){return _0x2a9938[_0x569c('0x26')]()['then'](function(){_0x2f75d6['status'](0xcc)[_0x569c('0x1b')]();});}};}function handleEntityNotFound(_0x1cded8,_0x41f55e){return function(_0x4b3c38){if(!_0x4b3c38){_0x1cded8[_0x569c('0x27')](0x194);}return _0x4b3c38;};}function handleError(_0x21dae4,_0x477159){_0x477159=_0x477159||0x1f4;return function(_0x5d6b35){logger['error'](_0x5d6b35[_0x569c('0x28')]);if(_0x5d6b35[_0x569c('0x29')]){delete _0x5d6b35[_0x569c('0x29')];}_0x21dae4[_0x569c('0x1a')](_0x477159)[_0x569c('0x2a')](_0x5d6b35);};}exports[_0x569c('0x2b')]=function(_0x4730aa,_0x1aa140){var _0x74d829={},_0x2fe68d={},_0x406b3f={'count':0x0,'rows':[]};var _0x56e0f4=_[_0x569c('0x2c')](db[_0x569c('0x2d')][_0x569c('0x2e')],function(_0x126891){return{'name':_0x126891['fieldName'],'type':_0x126891[_0x569c('0x2f')][_0x569c('0x30')]};});_0x2fe68d['model']=_[_0x569c('0x2c')](_0x56e0f4,_0x569c('0x29'));_0x2fe68d[_0x569c('0x31')]=_[_0x569c('0x32')](_0x4730aa[_0x569c('0x31')]);_0x2fe68d[_0x569c('0x33')]=_[_0x569c('0x34')](_0x2fe68d[_0x569c('0x35')],_0x2fe68d[_0x569c('0x31')]);_0x74d829['attributes']=_[_0x569c('0x34')](_0x2fe68d[_0x569c('0x35')],qs[_0x569c('0x36')](_0x4730aa[_0x569c('0x31')]['fields']));_0x74d829[_0x569c('0x37')]=_0x74d829['attributes']['length']?_0x74d829[_0x569c('0x37')]:_0x2fe68d[_0x569c('0x35')];if(!_0x4730aa[_0x569c('0x31')][_0x569c('0x38')](_0x569c('0x39'))){_0x74d829[_0x569c('0x3a')]=qs[_0x569c('0x3a')](_0x4730aa[_0x569c('0x31')][_0x569c('0x3a')]);_0x74d829[_0x569c('0x1e')]=qs[_0x569c('0x1e')](_0x4730aa[_0x569c('0x31')][_0x569c('0x1e')]);}_0x74d829['order']=qs['sort'](_0x4730aa[_0x569c('0x31')][_0x569c('0x3b')]);_0x74d829[_0x569c('0x3c')]=qs[_0x569c('0x33')](_[_0x569c('0x3d')](_0x4730aa['query'],_0x2fe68d['filters']));if(_0x4730aa[_0x569c('0x31')][_0x569c('0x3e')]){_0x74d829[_0x569c('0x3c')]=_[_0x569c('0x3f')](_0x74d829[_0x569c('0x3c')],{'$or':_[_0x569c('0x2c')](_0x56e0f4,function(_0x3f31dc){if(_0x3f31dc[_0x569c('0x2f')]!==_0x569c('0x40')){var _0x59da1a={};_0x59da1a[_0x3f31dc['name']]={'$like':'%'+_0x4730aa[_0x569c('0x31')][_0x569c('0x3e')]+'%'};return _0x59da1a;}})});}_0x74d829=_[_0x569c('0x3f')]({},_0x74d829,_0x4730aa[_0x569c('0x41')]);var _0x358160={'where':_0x74d829[_0x569c('0x3c')]};return db[_0x569c('0x2d')][_0x569c('0x1d')](_0x358160)[_0x569c('0x25')](function(_0x53e7fd){_0x406b3f[_0x569c('0x1d')]=_0x53e7fd;if(_0x4730aa['query'][_0x569c('0x42')]){_0x74d829[_0x569c('0x43')]=[{'all':!![]}];}return db[_0x569c('0x2d')][_0x569c('0x44')](_0x74d829);})[_0x569c('0x25')](function(_0x304d28){_0x406b3f[_0x569c('0x45')]=_0x304d28;return _0x406b3f;})[_0x569c('0x25')](respondWithFilteredResult(_0x1aa140,_0x74d829))[_0x569c('0x46')](handleError(_0x1aa140,null));};exports['show']=function(_0x3d689b,_0x4bda10){var _0x10cb99={'raw':!![],'where':{'id':_0x3d689b[_0x569c('0x47')]['id']}},_0x30920e={};_0x30920e['model']=_[_0x569c('0x32')](db[_0x569c('0x2d')][_0x569c('0x2e')]);_0x30920e['query']=_[_0x569c('0x32')](_0x3d689b[_0x569c('0x31')]);_0x30920e[_0x569c('0x33')]=_[_0x569c('0x34')](_0x30920e[_0x569c('0x35')],_0x30920e['query']);_0x10cb99['attributes']=_['intersection'](_0x30920e[_0x569c('0x35')],qs[_0x569c('0x36')](_0x3d689b[_0x569c('0x31')][_0x569c('0x36')]));_0x10cb99['attributes']=_0x10cb99[_0x569c('0x37')][_0x569c('0x48')]?_0x10cb99[_0x569c('0x37')]:_0x30920e[_0x569c('0x35')];if(_0x3d689b[_0x569c('0x31')]['includeAll']){_0x10cb99[_0x569c('0x43')]=[{'all':!![]}];}_0x10cb99=_[_0x569c('0x3f')]({},_0x10cb99,_0x3d689b[_0x569c('0x41')]);return db[_0x569c('0x2d')][_0x569c('0x49')](_0x10cb99)[_0x569c('0x25')](handleEntityNotFound(_0x4bda10,null))[_0x569c('0x25')](respondWithResult(_0x4bda10,null))[_0x569c('0x46')](handleError(_0x4bda10,null));};exports[_0x569c('0x4a')]=function(_0x28ee36,_0x58812e){return db['SmsApplication'][_0x569c('0x4a')](_0x28ee36[_0x569c('0x4b')],{})[_0x569c('0x25')](respondWithResult(_0x58812e,0xc9))['catch'](handleError(_0x58812e,null));};exports[_0x569c('0x24')]=function(_0x2e4a4e,_0x1474a2){if(_0x2e4a4e[_0x569c('0x4b')]['id']){delete _0x2e4a4e[_0x569c('0x4b')]['id'];}return db['SmsApplication'][_0x569c('0x49')]({'where':{'id':_0x2e4a4e[_0x569c('0x47')]['id']}})[_0x569c('0x25')](handleEntityNotFound(_0x1474a2,null))[_0x569c('0x25')](saveUpdates(_0x2e4a4e[_0x569c('0x4b')],null))[_0x569c('0x25')](respondWithResult(_0x1474a2,null))[_0x569c('0x46')](handleError(_0x1474a2,null));};exports[_0x569c('0x26')]=function(_0x35d453,_0x24afcc){return db[_0x569c('0x2d')][_0x569c('0x49')]({'where':{'id':_0x35d453[_0x569c('0x47')]['id']}})[_0x569c('0x25')](handleEntityNotFound(_0x24afcc,null))[_0x569c('0x25')](removeEntity(_0x24afcc,null))[_0x569c('0x46')](handleError(_0x24afcc,null));}; \ No newline at end of file +var _0x6679=['ioredis','../../components/auth/service','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','catch','show','params','fields','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x42da27,_0x51f56a){var _0x52fbde=function(_0x57e636){while(--_0x57e636){_0x42da27['push'](_0x42da27['shift']());}};_0x52fbde(++_0x51f56a);}(_0x6679,0x142));var _0x9667=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x6679[_0x246148];return _0x453d94;};'use strict';var pdf=require(_0x9667('0x0'));var emlformat=require(_0x9667('0x1'));var rimraf=require(_0x9667('0x2'));var zipdir=require(_0x9667('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9667('0x4'));var moment=require('moment');var BPromise=require(_0x9667('0x5'));var Mustache=require(_0x9667('0x6'));var util=require(_0x9667('0x7'));var path=require(_0x9667('0x8'));var sox=require(_0x9667('0x9'));var csv=require(_0x9667('0xa'));var ejs=require(_0x9667('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9667('0xc'));var crypto=require(_0x9667('0xd'));var jsforce=require(_0x9667('0xe'));var deskjs=require(_0x9667('0xf'));var toCsv=require(_0x9667('0xa'));var querystring=require(_0x9667('0x10'));var Papa=require(_0x9667('0x11'));var Redis=require(_0x9667('0x12'));var authService=require(_0x9667('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9667('0x14'))['db'];function respondWithStatusCode(_0x3ada09,_0x30c16c){_0x30c16c=_0x30c16c||0xcc;return function(_0x3805dc){if(_0x3805dc){return _0x3ada09[_0x9667('0x15')](_0x30c16c);}return _0x3ada09[_0x9667('0x16')](_0x30c16c)[_0x9667('0x17')]();};}function respondWithResult(_0x220f0d,_0x3ea64b){_0x3ea64b=_0x3ea64b||0xc8;return function(_0x41b872){if(_0x41b872){return _0x220f0d[_0x9667('0x16')](_0x3ea64b)[_0x9667('0x18')](_0x41b872);}};}function respondWithFilteredResult(_0x510593,_0x29c84e){return function(_0x284926){if(_0x284926){var _0x37ca9f=_0x284926[_0x9667('0x19')],_0x506000=_0x29c84e[_0x9667('0x1a')],_0x13b834=_0x29c84e[_0x9667('0x1a')]+_0x29c84e['limit'],_0x35aa86;if(_0x13b834>=_0x37ca9f){_0x13b834=_0x37ca9f;_0x35aa86=0xc8;}else{_0x35aa86=0xce;}_0x510593[_0x9667('0x16')](_0x35aa86);return _0x510593['set'](_0x9667('0x1b'),_0x506000+'-'+_0x13b834+'/'+_0x37ca9f)[_0x9667('0x18')](_0x284926);}return null;};}function patchUpdates(_0x525eaa){return function(_0x489152){try{jsonpatch['apply'](_0x489152,_0x525eaa,!![]);}catch(_0x3525b3){return BPromise[_0x9667('0x1c')](_0x3525b3);}return _0x489152[_0x9667('0x1d')]();};}function saveUpdates(_0x124fe9,_0x5c3995){return function(_0x59c10d){if(_0x59c10d){return _0x59c10d[_0x9667('0x1e')](_0x124fe9)[_0x9667('0x1f')](function(_0x19f7f6){return _0x19f7f6;});}return null;};}function removeEntity(_0x1ae65f,_0x2f8ffc){return function(_0x3be32b){if(_0x3be32b){return _0x3be32b[_0x9667('0x20')]()[_0x9667('0x1f')](function(){_0x1ae65f[_0x9667('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xde9264,_0x29acb3){return function(_0x707abe){if(!_0x707abe){_0xde9264['sendStatus'](0x194);}return _0x707abe;};}function handleError(_0x1e7bc6,_0x5e14d5){_0x5e14d5=_0x5e14d5||0x1f4;return function(_0x35079c){logger[_0x9667('0x21')](_0x35079c[_0x9667('0x22')]);if(_0x35079c[_0x9667('0x23')]){delete _0x35079c[_0x9667('0x23')];}_0x1e7bc6['status'](_0x5e14d5)[_0x9667('0x24')](_0x35079c);};}exports['index']=function(_0x1c60e2,_0x274cd1){var _0x475540={},_0x18c31e={},_0x1606ba={'count':0x0,'rows':[]};var _0x2b3287=_[_0x9667('0x25')](db[_0x9667('0x26')][_0x9667('0x27')],function(_0xdda33){return{'name':_0xdda33[_0x9667('0x28')],'type':_0xdda33[_0x9667('0x29')][_0x9667('0x2a')]};});_0x18c31e[_0x9667('0x2b')]=_[_0x9667('0x25')](_0x2b3287,_0x9667('0x23'));_0x18c31e['query']=_['keys'](_0x1c60e2[_0x9667('0x2c')]);_0x18c31e['filters']=_[_0x9667('0x2d')](_0x18c31e[_0x9667('0x2b')],_0x18c31e[_0x9667('0x2c')]);_0x475540[_0x9667('0x2e')]=_[_0x9667('0x2d')](_0x18c31e[_0x9667('0x2b')],qs['fields'](_0x1c60e2[_0x9667('0x2c')]['fields']));_0x475540['attributes']=_0x475540[_0x9667('0x2e')][_0x9667('0x2f')]?_0x475540['attributes']:_0x18c31e[_0x9667('0x2b')];if(!_0x1c60e2[_0x9667('0x2c')][_0x9667('0x30')](_0x9667('0x31'))){_0x475540['limit']=qs[_0x9667('0x32')](_0x1c60e2['query'][_0x9667('0x32')]);_0x475540['offset']=qs['offset'](_0x1c60e2[_0x9667('0x2c')][_0x9667('0x1a')]);}_0x475540[_0x9667('0x33')]=qs['sort'](_0x1c60e2[_0x9667('0x2c')]['sort']);_0x475540[_0x9667('0x34')]=qs[_0x9667('0x35')](_[_0x9667('0x36')](_0x1c60e2[_0x9667('0x2c')],_0x18c31e[_0x9667('0x35')]));if(_0x1c60e2[_0x9667('0x2c')]['filter']){_0x475540[_0x9667('0x34')]=_[_0x9667('0x37')](_0x475540['where'],{'$or':_[_0x9667('0x25')](_0x2b3287,function(_0x3704df){if(_0x3704df[_0x9667('0x29')]!==_0x9667('0x38')){var _0x416a26={};_0x416a26[_0x3704df[_0x9667('0x23')]]={'$like':'%'+_0x1c60e2[_0x9667('0x2c')][_0x9667('0x39')]+'%'};return _0x416a26;}})});}_0x475540=_[_0x9667('0x37')]({},_0x475540,_0x1c60e2[_0x9667('0x3a')]);var _0x3ff529={'where':_0x475540['where']};return db[_0x9667('0x26')][_0x9667('0x19')](_0x3ff529)[_0x9667('0x1f')](function(_0x14a56f){_0x1606ba[_0x9667('0x19')]=_0x14a56f;if(_0x1c60e2[_0x9667('0x2c')][_0x9667('0x3b')]){_0x475540[_0x9667('0x3c')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x475540);})['then'](function(_0x31c763){_0x1606ba['rows']=_0x31c763;return _0x1606ba;})[_0x9667('0x1f')](respondWithFilteredResult(_0x274cd1,_0x475540))[_0x9667('0x3d')](handleError(_0x274cd1,null));};exports[_0x9667('0x3e')]=function(_0x298789,_0x2ce8c6){var _0x51459d={'raw':!![],'where':{'id':_0x298789[_0x9667('0x3f')]['id']}},_0x1b17e3={};_0x1b17e3[_0x9667('0x2b')]=_['keys'](db[_0x9667('0x26')][_0x9667('0x27')]);_0x1b17e3['query']=_['keys'](_0x298789[_0x9667('0x2c')]);_0x1b17e3[_0x9667('0x35')]=_['intersection'](_0x1b17e3[_0x9667('0x2b')],_0x1b17e3[_0x9667('0x2c')]);_0x51459d[_0x9667('0x2e')]=_[_0x9667('0x2d')](_0x1b17e3[_0x9667('0x2b')],qs['fields'](_0x298789[_0x9667('0x2c')][_0x9667('0x40')]));_0x51459d[_0x9667('0x2e')]=_0x51459d[_0x9667('0x2e')][_0x9667('0x2f')]?_0x51459d[_0x9667('0x2e')]:_0x1b17e3['model'];if(_0x298789[_0x9667('0x2c')][_0x9667('0x3b')]){_0x51459d['include']=[{'all':!![]}];}_0x51459d=_['merge']({},_0x51459d,_0x298789[_0x9667('0x3a')]);return db['SmsApplication'][_0x9667('0x41')](_0x51459d)[_0x9667('0x1f')](handleEntityNotFound(_0x2ce8c6,null))[_0x9667('0x1f')](respondWithResult(_0x2ce8c6,null))[_0x9667('0x3d')](handleError(_0x2ce8c6,null));};exports[_0x9667('0x42')]=function(_0x2a120a,_0x5a1932){return db['SmsApplication'][_0x9667('0x42')](_0x2a120a[_0x9667('0x43')],{})[_0x9667('0x1f')](respondWithResult(_0x5a1932,0xc9))['catch'](handleError(_0x5a1932,null));};exports[_0x9667('0x1e')]=function(_0x1cecf0,_0x4164cb){if(_0x1cecf0[_0x9667('0x43')]['id']){delete _0x1cecf0[_0x9667('0x43')]['id'];}return db[_0x9667('0x26')][_0x9667('0x41')]({'where':{'id':_0x1cecf0['params']['id']}})[_0x9667('0x1f')](handleEntityNotFound(_0x4164cb,null))[_0x9667('0x1f')](saveUpdates(_0x1cecf0[_0x9667('0x43')],null))[_0x9667('0x1f')](respondWithResult(_0x4164cb,null))[_0x9667('0x3d')](handleError(_0x4164cb,null));};exports[_0x9667('0x20')]=function(_0x1e0e15,_0x54e5cb){return db['SmsApplication'][_0x9667('0x41')]({'where':{'id':_0x1e0e15[_0x9667('0x3f')]['id']}})[_0x9667('0x1f')](handleEntityNotFound(_0x54e5cb,null))[_0x9667('0x1f')](removeEntity(_0x54e5cb,null))[_0x9667('0x3d')](handleError(_0x54e5cb,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index b8acade..d982b7b 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 _0x90fe=['sms_applications','utf8mb4','lodash','util','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','define'];(function(_0x411708,_0x3d6870){var _0x4497c3=function(_0x4589de){while(--_0x4589de){_0x411708['push'](_0x411708['shift']());}};_0x4497c3(++_0x3d6870);}(_0x90fe,0x1ba));var _0xe90f=function(_0x5b3e15,_0x378c94){_0x5b3e15=_0x5b3e15-0x0;var _0x45cf13=_0x90fe[_0x5b3e15];return _0x45cf13;};'use strict';var _=require(_0xe90f('0x0'));var util=require(_0xe90f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe90f('0x2'));var BPromise=require(_0xe90f('0x3'));var rp=require(_0xe90f('0x4'));var fs=require('fs');var path=require(_0xe90f('0x5'));var rimraf=require(_0xe90f('0x6'));var config=require('../../config/environment');var attributes=require(_0xe90f('0x7'));module['exports']=function(_0x20920f,_0x1e0757){return _0x20920f[_0xe90f('0x8')]('SmsApplication',attributes,{'tableName':_0xe90f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe90f('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbdb0=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','define','SmsApplication','utf8mb4_unicode_ci','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbdb0,0x14f));var _0x0bdb=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xbdb0[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0x0bdb('0x0'));var util=require('util');var logger=require(_0x0bdb('0x1'))(_0x0bdb('0x2'));var moment=require(_0x0bdb('0x3'));var BPromise=require(_0x0bdb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bdb('0x5'));var rimraf=require(_0x0bdb('0x6'));var config=require(_0x0bdb('0x7'));var attributes=require(_0x0bdb('0x8'));module['exports']=function(_0x3e0020,_0x137892){return _0x3e0020[_0x0bdb('0x9')](_0x0bdb('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0bdb('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 1a4d97f..4317efc 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 _0x1d25=['request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','SmsApplication,\x20%s,\x20%s'];(function(_0x3f11c4,_0x51b684){var _0x437c14=function(_0x54a079){while(--_0x54a079){_0x3f11c4['push'](_0x3f11c4['shift']());}};_0x437c14(++_0x51b684);}(_0x1d25,0xba));var _0x51d2=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0x1d25[_0xd4636c];return _0x5ee17d;};'use strict';var _=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var moment=require(_0x51d2('0x2'));var BPromise=require(_0x51d2('0x3'));var rs=require(_0x51d2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51d2('0x5'))['db'];var utils=require(_0x51d2('0x6'));var logger=require('../../config/logger')(_0x51d2('0x7'));var config=require(_0x51d2('0x8'));var jayson=require(_0x51d2('0x9'));var client=jayson[_0x51d2('0xa')][_0x51d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e6956,_0x56edda,_0x18e8a9){return new BPromise(function(_0x5a6b5f,_0x419156){return client['request'](_0x2e6956,_0x18e8a9)['then'](function(_0x30d7d0){logger[_0x51d2('0xc')](_0x51d2('0xd'),_0x56edda,_0x51d2('0xe'));logger['debug'](_0x51d2('0xf'),_0x56edda,_0x51d2('0xe'),JSON[_0x51d2('0x10')](_0x30d7d0));if(_0x30d7d0[_0x51d2('0x11')]){if(_0x30d7d0[_0x51d2('0x11')]['code']===0x1f4){logger[_0x51d2('0x11')](_0x51d2('0xd'),_0x56edda,_0x30d7d0['error']['message']);return _0x419156(_0x30d7d0[_0x51d2('0x11')][_0x51d2('0x12')]);}logger[_0x51d2('0x11')](_0x51d2('0xd'),_0x56edda,_0x30d7d0[_0x51d2('0x11')]['message']);return _0x5a6b5f(_0x30d7d0[_0x51d2('0x11')]['message']);}else{logger[_0x51d2('0xc')](_0x51d2('0xd'),_0x56edda,_0x51d2('0xe'));_0x5a6b5f(_0x30d7d0['result'][_0x51d2('0x12')]);}})[_0x51d2('0x13')](function(_0x14a682){logger[_0x51d2('0x11')](_0x51d2('0xd'),_0x56edda,_0x14a682);_0x419156(_0x14a682);});});} \ No newline at end of file +var _0x1db9=['../../config/utils','../../config/logger','jayson/promise','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x848500,_0x5409c4){var _0x3afd1a=function(_0x312f68){while(--_0x312f68){_0x848500['push'](_0x848500['shift']());}};_0x3afd1a(++_0x5409c4);}(_0x1db9,0x176));var _0x91db=function(_0x39f1a4,_0x26589a){_0x39f1a4=_0x39f1a4-0x0;var _0x5ce71e=_0x1db9[_0x39f1a4];return _0x5ce71e;};'use strict';var _=require(_0x91db('0x0'));var util=require(_0x91db('0x1'));var moment=require(_0x91db('0x2'));var BPromise=require(_0x91db('0x3'));var rs=require(_0x91db('0x4'));var fs=require('fs');var Redis=require(_0x91db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x91db('0x6'));var logger=require(_0x91db('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x91db('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x433c75,_0x3b0c53,_0x45fea0){return new BPromise(function(_0x2330c2,_0x2d89a1){return client['request'](_0x433c75,_0x45fea0)[_0x91db('0x9')](function(_0x58cda2){logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));logger['debug'](_0x91db('0xd'),_0x3b0c53,'request\x20sent',JSON['stringify'](_0x58cda2));if(_0x58cda2['error']){if(_0x58cda2[_0x91db('0xe')][_0x91db('0xf')]===0x1f4){logger['error']('SmsApplication,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2d89a1(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}logger[_0x91db('0xe')]('SmsApplication,\x20%s,\x20%s',_0x3b0c53,_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);return _0x2330c2(_0x58cda2[_0x91db('0xe')][_0x91db('0x10')]);}else{logger[_0x91db('0xa')](_0x91db('0xb'),_0x3b0c53,_0x91db('0xc'));_0x2330c2(_0x58cda2[_0x91db('0x11')][_0x91db('0x10')]);}})[_0x91db('0x12')](function(_0x1e9679){logger[_0x91db('0xe')]('SmsApplication,\x20%s,\x20%s',_0x3b0c53,_0x1e9679);_0x2d89a1(_0x1e9679);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index d59d399..c6bc6fb 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 _0xf567=['removeTags','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','put','delete','smsinteraction:destroy','destroy'];(function(_0x13d4b0,_0x4d56a1){var _0x43b6d8=function(_0x5c3e83){while(--_0x5c3e83){_0x13d4b0['push'](_0x13d4b0['shift']());}};_0x43b6d8(++_0x4d56a1);}(_0xf567,0x118));var _0x7f56=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xf567[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x7f56('0x0'));var util=require(_0x7f56('0x1'));var path=require(_0x7f56('0x2'));var timeout=require('connect-timeout');var express=require(_0x7f56('0x3'));var router=express[_0x7f56('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7f56('0x5'));var config=require(_0x7f56('0x6'));var controller=require(_0x7f56('0x7'));router[_0x7f56('0x8')]('/',auth['isAuthenticated'](),controller[_0x7f56('0x9')]);router[_0x7f56('0x8')](_0x7f56('0xa'),auth['isAuthenticated'](),controller[_0x7f56('0xb')]);router[_0x7f56('0x8')](_0x7f56('0xc'),auth[_0x7f56('0xd')](),controller[_0x7f56('0xe')]);router[_0x7f56('0x8')](_0x7f56('0xf'),auth[_0x7f56('0xd')](),controller[_0x7f56('0x10')]);router[_0x7f56('0x8')](_0x7f56('0x11'),auth[_0x7f56('0xd')](),controller[_0x7f56('0x12')]);router[_0x7f56('0x13')]('/',auth[_0x7f56('0xd')](),controller[_0x7f56('0x14')]);router[_0x7f56('0x13')](_0x7f56('0xf'),auth[_0x7f56('0xd')](),controller[_0x7f56('0x15')]);router[_0x7f56('0x13')](_0x7f56('0x16'),auth['isAuthenticated'](),interaction[_0x7f56('0x17')](_0x7f56('0x18'),_0x7f56('0x19')),controller['addTags']);router[_0x7f56('0x1a')](_0x7f56('0xc'),auth['isAuthenticated'](),interaction[_0x7f56('0x17')](_0x7f56('0x18'),'smsinteraction:update'),controller['update']);router[_0x7f56('0x1b')]('/:id',auth[_0x7f56('0xd')](),interaction[_0x7f56('0x17')]('sms',_0x7f56('0x1c')),controller[_0x7f56('0x1d')]);router[_0x7f56('0x1b')](_0x7f56('0x16'),auth[_0x7f56('0xd')](),controller[_0x7f56('0x1e')]);module['exports']=router; \ No newline at end of file +var _0xd5f9=['delete','smsinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','/describe','isAuthenticated','/:id','show','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','sms','smsinteraction:update','update'];(function(_0xdaab62,_0x2728ab){var _0x13d767=function(_0x14bf14){while(--_0x14bf14){_0xdaab62['push'](_0xdaab62['shift']());}};_0x13d767(++_0x2728ab);}(_0xd5f9,0x1f1));var _0x9d5f=function(_0x36087c,_0x34daad){_0x36087c=_0x36087c-0x0;var _0x24563e=_0xd5f9[_0x36087c];return _0x24563e;};'use strict';var multer=require(_0x9d5f('0x0'));var util=require(_0x9d5f('0x1'));var path=require(_0x9d5f('0x2'));var timeout=require(_0x9d5f('0x3'));var express=require('express');var router=express[_0x9d5f('0x4')]();var auth=require(_0x9d5f('0x5'));var interaction=require(_0x9d5f('0x6'));var config=require(_0x9d5f('0x7'));var controller=require(_0x9d5f('0x8'));router[_0x9d5f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9d5f('0xa'),auth[_0x9d5f('0xb')](),controller['describe']);router[_0x9d5f('0x9')](_0x9d5f('0xc'),auth['isAuthenticated'](),controller[_0x9d5f('0xd')]);router[_0x9d5f('0x9')]('/:id/messages',auth[_0x9d5f('0xb')](),controller['getMessages']);router[_0x9d5f('0x9')](_0x9d5f('0xe'),auth[_0x9d5f('0xb')](),controller[_0x9d5f('0xf')]);router[_0x9d5f('0x10')]('/',auth['isAuthenticated'](),controller[_0x9d5f('0x11')]);router[_0x9d5f('0x10')](_0x9d5f('0x12'),auth[_0x9d5f('0xb')](),controller[_0x9d5f('0x13')]);router[_0x9d5f('0x10')](_0x9d5f('0x14'),auth[_0x9d5f('0xb')](),interaction[_0x9d5f('0x15')]('sms','smsinteraction:addtags'),controller['addTags']);router['put'](_0x9d5f('0xc'),auth[_0x9d5f('0xb')](),interaction['tracked'](_0x9d5f('0x16'),_0x9d5f('0x17')),controller[_0x9d5f('0x18')]);router[_0x9d5f('0x19')](_0x9d5f('0xc'),auth['isAuthenticated'](),interaction[_0x9d5f('0x15')](_0x9d5f('0x16'),_0x9d5f('0x1a')),controller[_0x9d5f('0x1b')]);router[_0x9d5f('0x19')](_0x9d5f('0x14'),auth[_0x9d5f('0xb')](),controller['removeTags']);module[_0x9d5f('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 4208378..5a3878e 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(_0x401c88,_0x5c9ef9){var _0x3126a0=function(_0x56f75c){while(--_0x56f75c){_0x401c88['push'](_0x401c88['shift']());}};_0x3126a0(++_0x5c9ef9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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(_0x8af54b,_0x280be5){var _0x27d8f0=function(_0x559734){while(--_0x559734){_0x8af54b['push'](_0x8af54b['shift']());}};_0x27d8f0(++_0x280be5);}(_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 32be994..320748f 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 _0xb145=['keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','select','field','color','tools_tags','u.fullname','from','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','body','compact','i.SmsAccountId\x20IN\x20?','concat','parse','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','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?','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','resolve','SmsAccountId','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.phone','c.fax','Contact.fax','Owner.fullname','Owner.internal','SmsInteractionId','push','all','rows','show','params','includeAll','include','options','create','catch','describe','addMessage','ids','getMessages','findOne','hasOwnProperty','$gte','YYYY-MM-DD\x20HH:mm:ss','SmsMessage','addTags','spread','findAll','emit','removeTags','download','unix','join','server','files','root','attachments','format','CmContact','Messages','direction','Account','Owner','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','Sms','YYYY-MM-DD','N.A.','createdAt','closed','closedAt','out','firstName','lastName','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','apply','save','update','then','error','stack','name','send','Users','fullname','TagIds','Tags','forEach','index','SmsInteraction','rawAttributes','fieldName','key','model','map'];(function(_0x5db691,_0xcd30a9){var _0xfcf524=function(_0x487ad9){while(--_0x487ad9){_0x5db691['push'](_0x5db691['shift']());}};_0xfcf524(++_0xcd30a9);}(_0xb145,0xa3));var _0x5b14=function(_0x5b0279,_0x5d4fc0){_0x5b0279=_0x5b0279-0x0;var _0x4acac7=_0xb145[_0x5b0279];return _0x4acac7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5b14('0x0'));var rimraf=require(_0x5b14('0x1'));var zipdir=require(_0x5b14('0x2'));var jsonpatch=require(_0x5b14('0x3'));var rp=require(_0x5b14('0x4'));var moment=require(_0x5b14('0x5'));var BPromise=require(_0x5b14('0x6'));var Mustache=require(_0x5b14('0x7'));var util=require('util');var path=require(_0x5b14('0x8'));var sox=require(_0x5b14('0x9'));var csv=require(_0x5b14('0xa'));var ejs=require(_0x5b14('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5b14('0xc'));var crypto=require(_0x5b14('0xd'));var jsforce=require(_0x5b14('0xe'));var deskjs=require(_0x5b14('0xf'));var toCsv=require(_0x5b14('0xa'));var querystring=require('querystring');var Papa=require(_0x5b14('0x10'));var Redis=require(_0x5b14('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5b14('0x12'));var as=require(_0x5b14('0x13'));var hardwareService=require(_0x5b14('0x14'));var logger=require(_0x5b14('0x15'))(_0x5b14('0x16'));var utils=require('../../config/utils');var config=require(_0x5b14('0x17'));var db=require('../../mysqldb')['db'];config[_0x5b14('0x18')]=_[_0x5b14('0x19')](config[_0x5b14('0x18')],{'host':_0x5b14('0x1a'),'port':0x18eb});var socket=require(_0x5b14('0x1b'))(new Redis(config[_0x5b14('0x18')]));require('./smsInteraction.socket')[_0x5b14('0x1c')](socket);function respondWithStatusCode(_0x16f2a1,_0x35fb8b){_0x35fb8b=_0x35fb8b||0xcc;return function(_0x1dfa26){if(_0x1dfa26){return _0x16f2a1[_0x5b14('0x1d')](_0x35fb8b);}return _0x16f2a1[_0x5b14('0x1e')](_0x35fb8b)[_0x5b14('0x1f')]();};}function respondWithResult(_0xe5af75,_0x183b0a){_0x183b0a=_0x183b0a||0xc8;return function(_0x287bb7){if(_0x287bb7){return _0xe5af75[_0x5b14('0x1e')](_0x183b0a)[_0x5b14('0x20')](_0x287bb7);}};}function respondWithFilteredResult(_0x5cce9b,_0x24cfd0){return function(_0x50866a){if(_0x50866a){var _0x48d395=_0x50866a[_0x5b14('0x21')],_0x58bf3c=_0x24cfd0[_0x5b14('0x22')],_0x3f397d=_0x24cfd0[_0x5b14('0x22')]+_0x24cfd0[_0x5b14('0x23')],_0x3035b5;if(_0x3f397d>=_0x48d395){_0x3f397d=_0x48d395;_0x3035b5=0xc8;}else{_0x3035b5=0xce;}_0x5cce9b[_0x5b14('0x1e')](_0x3035b5);return _0x5cce9b['set']('Content-Range',_0x58bf3c+'-'+_0x3f397d+'/'+_0x48d395)['json'](_0x50866a);}return null;};}function patchUpdates(_0x4f4717){return function(_0x2afa17){try{jsonpatch[_0x5b14('0x24')](_0x2afa17,_0x4f4717,!![]);}catch(_0x1e22a5){return BPromise['reject'](_0x1e22a5);}return _0x2afa17[_0x5b14('0x25')]();};}function saveUpdates(_0x1577f7,_0x4857c7){return function(_0x2d7b38){if(_0x2d7b38){return _0x2d7b38[_0x5b14('0x26')](_0x1577f7)['then'](function(_0x33a293){return _0x33a293;});}return null;};}function removeEntity(_0x54073f,_0x59282c){return function(_0x5e0780){if(_0x5e0780){return _0x5e0780['destroy']()[_0x5b14('0x27')](function(){_0x54073f[_0x5b14('0x1e')](0xcc)[_0x5b14('0x1f')]();});}};}function handleEntityNotFound(_0x5da505,_0x46f86a){return function(_0x3bf8e5){if(!_0x3bf8e5){_0x5da505[_0x5b14('0x1d')](0x194);}return _0x3bf8e5;};}function handleError(_0x143648,_0xe6851b){_0xe6851b=_0xe6851b||0x1f4;return function(_0x1bbbd7){logger[_0x5b14('0x28')](_0x1bbbd7[_0x5b14('0x29')]);if(_0x1bbbd7[_0x5b14('0x2a')]){delete _0x1bbbd7[_0x5b14('0x2a')];}_0x143648[_0x5b14('0x1e')](_0xe6851b)[_0x5b14('0x2b')](_0x1bbbd7);};}function getInteractionUsers(_0x1c3c52,_0x266bbe){return new BPromise(function(_0x4cfd66,_0x370fcd){try{if(_0x266bbe[_0x1c3c52['id']]){_0x1c3c52[_0x5b14('0x2c')]=_['map'](_0x266bbe[_0x1c3c52['id']],function(_0x4ecf7c){return{'id':_0x4ecf7c['id'],'fullname':_0x4ecf7c[_0x5b14('0x2d')]};});}}catch(_0x3fb23b){_0x370fcd(_0x3fb23b);}_0x4cfd66(_0x1c3c52);});}function getInteractionTags(_0x5dca4f,_0x4c1f0e){return new BPromise(function(_0x21b43b,_0x4d3905){try{if(_0x5dca4f[_0x5b14('0x2e')]){_0x5dca4f[_0x5b14('0x2f')]=[];_0x5dca4f['TagIds']['split'](',')[_0x5b14('0x30')](function(_0x3bf143){_0x5dca4f[_0x5b14('0x2f')]['push'](_0x4c1f0e[_0x3bf143]);});}delete _0x5dca4f[_0x5b14('0x2e')];}catch(_0x5a5393){_0x4d3905(_0x5a5393);}_0x21b43b(_0x5dca4f);});}function updateSmsInteraction(_0x364658,_0x291c92,_0x3f3c5f){return new BPromise(function(_0x2e2a83,_0x5b85a8){return getInteractionUsers(_0x364658,_0x3f3c5f)[_0x5b14('0x27')](function(_0x13c8fd){return getInteractionTags(_0x13c8fd,_0x291c92);})[_0x5b14('0x27')](function(_0x37f62c){_0x2e2a83(_0x37f62c);})['catch'](function(_0x32be08){_0x5b85a8(_0x32be08);});});}exports[_0x5b14('0x31')]=function(_0x17bd9f,_0x5604d5){var _0x2fe74d={},_0x546550={},_0xa630a9={'count':0x0,'rows':[]};var _0x43e53=_['map'](db[_0x5b14('0x32')][_0x5b14('0x33')],function(_0x5643c1){return{'name':_0x5643c1[_0x5b14('0x34')],'type':_0x5643c1['type'][_0x5b14('0x35')]};});_0x546550[_0x5b14('0x36')]=_[_0x5b14('0x37')](_0x43e53,_0x5b14('0x2a'));_0x546550['query']=_[_0x5b14('0x38')](_0x17bd9f[_0x5b14('0x39')]);_0x546550[_0x5b14('0x3a')]=_[_0x5b14('0x3b')](_0x546550[_0x5b14('0x36')],_0x546550[_0x5b14('0x39')]);_0x2fe74d[_0x5b14('0x3c')]=_[_0x5b14('0x3b')](_0x546550[_0x5b14('0x36')],qs[_0x5b14('0x3d')](_0x17bd9f[_0x5b14('0x39')][_0x5b14('0x3d')]));_0x2fe74d[_0x5b14('0x3c')]=_0x2fe74d[_0x5b14('0x3c')][_0x5b14('0x3e')]?_0x2fe74d[_0x5b14('0x3c')]:_0x546550['model'];if(!_0x17bd9f[_0x5b14('0x39')]['hasOwnProperty'](_0x5b14('0x3f'))){_0x2fe74d[_0x5b14('0x23')]=qs['limit'](_0x17bd9f['query']['limit']);_0x2fe74d[_0x5b14('0x22')]=qs[_0x5b14('0x22')](_0x17bd9f['query'][_0x5b14('0x22')]);}_0x2fe74d[_0x5b14('0x40')]=qs[_0x5b14('0x41')](_0x17bd9f[_0x5b14('0x39')][_0x5b14('0x41')]);_0x2fe74d['where']=qs[_0x5b14('0x3a')](_[_0x5b14('0x42')](_0x17bd9f['query'],_0x546550[_0x5b14('0x3a')]));var _0x985e69=[];var _0x5cc257=squel[_0x5b14('0x43')]()['field']('id')[_0x5b14('0x44')](_0x5b14('0x2a'))[_0x5b14('0x44')](_0x5b14('0x45'))['from'](_0x5b14('0x46'));var _0x56f868=squel[_0x5b14('0x43')]()[_0x5b14('0x44')]('u.id')['field'](_0x5b14('0x47'))[_0x5b14('0x44')]('ui.SmsInteractionId')[_0x5b14('0x48')]('user_has_sms_interactions','ui')[_0x5b14('0x49')](_0x5b14('0x4a'),'u',_0x5b14('0x4b'));var _0x3bf048=squel[_0x5b14('0x43')]()['from'](_0x5b14('0x4c'),'i')[_0x5b14('0x49')](_0x5b14('0x4d'),'c',_0x5b14('0x4e'))[_0x5b14('0x49')]('users','o','o.id\x20=\x20i.UserId')[_0x5b14('0x49')]('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0x5b14('0x4f'),'me',_0x5b14('0x50'))[_0x5b14('0x49')](_0x5b14('0x51'),'it',_0x5b14('0x52'))[_0x5b14('0x49')](_0x5b14('0x46'),'t','t.id\x20=\x20it.TagId');var _0x548e1c=squel['expr']();var _0x5d3ce6=[];var _0x517372=squel[_0x5b14('0x53')]();var _0x42e7d8;if(_0x17bd9f[_0x5b14('0x39')][_0x5b14('0x54')]){_0x42e7d8=as[_0x5b14('0x55')](_0x17bd9f['query']['search']);var _0xa74d24=_0x42e7d8[_0x5b14('0x56')];for(var _0x58b18e=0x0;_0x58b18e<_0x42e7d8[_0x5b14('0x57')][_0x5b14('0x3e')];_0x58b18e++){var _0x508984=_0x42e7d8['conditions'][_0x58b18e];var _0x921a85='i';var _0x1d6fdc=_[_0x5b14('0x58')](_0x43e53,['name',_0x508984[_0x5b14('0x44')]]);if(!_0x1d6fdc){switch(_0x508984[_0x5b14('0x44')]){case _0x5b14('0x59'):if(_0x508984[_0x5b14('0x5a')]==0x1){_0x3bf048[_0x5b14('0x5b')]('`'+_0x508984[_0x5b14('0x44')]+_0x5b14('0x5c'));}else{_0x3bf048['having']('`'+_0x508984[_0x5b14('0x44')]+'`\x20>\x200');}break;case _0x5b14('0x5d'):if(_0x508984[_0x5b14('0x5e')]===_0x5b14('0x5f')){if(_0x508984[_0x5b14('0x5a')][_0x5b14('0x60')]('\x20')[_0x5b14('0x3e')]>0x1){_0x548e1c[_0xa74d24](_0x5b14('0x61'),qs[_0x5b14('0x62')](_0x508984[_0x5b14('0x5a')]),null);}else{var _0x27803d='%'+_0x508984[_0x5b14('0x5a')]+'%';_0x548e1c[_0xa74d24](_0x5b14('0x63'),_0x27803d,_0x27803d,_0x27803d);}}else{_0x1d6fdc=_['find'](_0x43e53,['name','ContactId']);_0x508984[_0x5b14('0x44')]=_0x5b14('0x64');_0x4a506a=as[_0x5b14('0x65')](_0x921a85,_0x1d6fdc[_0x5b14('0x66')],_0x508984);_0x548e1c[_0xa74d24](_0x4a506a[_0x5b14('0x67')],_0x4a506a[_0x5b14('0x5a')][_0x5b14('0x68')],_0x4a506a['value'][_0x5b14('0x1f')]);}break;case _0x5b14('0x69'):var _0x5e42df=_0x508984['value'][_0x5b14('0x60')](',')[_0x5b14('0x37')](function(_0x414f79){return Number(_0x414f79);});_0x5e42df[_0x5b14('0x30')](function(_0x32629d){_0x517372['or'](_0x5b14('0x6a'),'%,'+_0x32629d+',%');});_0x5d3ce6=_['union'](_0x5d3ce6,_0x5e42df);break;case _0x5b14('0x6b'):if(_0x508984['operator']===_0x5b14('0x5f')){_0x548e1c[_0xa74d24]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x508984[_0x5b14('0x5a')]+'%',null);}else{_0x1d6fdc=_[_0x5b14('0x58')](_0x43e53,[_0x5b14('0x2a'),'UserId']);_0x508984[_0x5b14('0x44')]='UserId';_0x4a506a=as[_0x5b14('0x65')](_0x921a85,_0x1d6fdc[_0x5b14('0x66')],_0x508984);_0x548e1c[_0xa74d24](_0x4a506a[_0x5b14('0x67')],_0x4a506a['value'][_0x5b14('0x68')],_0x4a506a[_0x5b14('0x5a')][_0x5b14('0x1f')]);}break;case _0x5b14('0x6c'):_0x4a506a=as['buildExpression']('me',null,_0x508984);_0x548e1c[_0xa74d24](_0x4a506a[_0x5b14('0x67')],_0x4a506a['value'][_0x5b14('0x68')],_0x4a506a[_0x5b14('0x5a')]['end']);break;}}else{var _0x4a506a=as[_0x5b14('0x65')](_0x921a85,_0x1d6fdc[_0x5b14('0x66')],_0x508984);_0x548e1c[_0xa74d24](_0x4a506a[_0x5b14('0x67')],_0x4a506a['value'][_0x5b14('0x68')],_0x4a506a[_0x5b14('0x5a')]['end']);}}}else{var _0x4b9720=_(_0x17bd9f[_0x5b14('0x39')])[_0x5b14('0x38')]()[_0x5b14('0x37')](function(_0x3cffe4){return _['some'](_0x43e53,[_0x5b14('0x2a'),_0x3cffe4])?_0x3cffe4:undefined;})[_0x5b14('0x6d')]()['value']();if(!_['isEmpty'](_0x4b9720)){_0x4b9720[_0x5b14('0x30')](function(_0x1b25e1){if(_0x1b25e1==='SmsAccountId'){_0x3bf048['where'](_0x5b14('0x6e'),[][_0x5b14('0x6f')](_0x17bd9f[_0x5b14('0x39')][_0x1b25e1]));}else if(_0x1b25e1==='createdAt'){var _0x1c7d03=JSON[_0x5b14('0x70')](_0x17bd9f[_0x5b14('0x39')][_0x1b25e1])['$gte'];var _0x453e4b=JSON[_0x5b14('0x70')](_0x17bd9f[_0x5b14('0x39')][_0x1b25e1])['$lte'];_0x3bf048[_0x5b14('0x71')](_0x5b14('0x72'),_0x1c7d03,_0x453e4b);}else{if(_0x17bd9f[_0x5b14('0x39')][_0x1b25e1]===_0x5b14('0x73')){_0x3bf048[_0x5b14('0x71')]('i.'+_0x1b25e1+_0x5b14('0x74'));}else{_0x3bf048[_0x5b14('0x71')]('i.'+_0x1b25e1+'\x20=\x20?',_0x17bd9f['query'][_0x1b25e1]);}}});}if(_0x17bd9f['query']['read']){if(_0x17bd9f[_0x5b14('0x39')][_0x5b14('0x75')]==0x1){_0x3bf048[_0x5b14('0x5b')](_0x5b14('0x76'));}else{_0x3bf048[_0x5b14('0x5b')]('`unreadMessages`\x20>\x200');}}if(_0x17bd9f['query'][_0x5b14('0x77')]){_0x5d3ce6=_[_0x5b14('0x78')](_0x17bd9f[_0x5b14('0x39')][_0x5b14('0x77')])?_0x17bd9f[_0x5b14('0x39')]['tag']:new Array(_0x17bd9f['query'][_0x5b14('0x77')]);_0x5d3ce6[_0x5b14('0x30')](function(_0x160a4f){_0x517372['or'](_0x5b14('0x6a'),'%,'+_0x160a4f+',%');});}if(_0x17bd9f[_0x5b14('0x39')][_0x5b14('0x79')]){var _0x221759=_0x17bd9f[_0x5b14('0x39')][_0x5b14('0x79')]['replace']('\x5c','\x5c\x5c')[_0x5b14('0x7a')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x5b14('0x7b')](_0x221759)){_0x548e1c['or'](_0x5b14('0x7c'),_0x221759+'%')['or'](_0x5b14('0x7d'),_0x221759+'%');}else{_0x548e1c['or'](_0x5b14('0x7e'),qs[_0x5b14('0x62')](_0x221759))['or'](_0x5b14('0x7f'),_0x221759+'%');}}}_0x3bf048[_0x5b14('0x71')](_0x548e1c);_0x3bf048['group']('i.id');var _0x65b380={'type':db[_0x5b14('0x80')][_0x5b14('0x81')][_0x5b14('0x82')],'raw':!![]};var _0x154b07=_0x3bf048['clone']();_0x154b07[_0x5b14('0x44')](_0x5b14('0x83'));_0x154b07[_0x5b14('0x44')](_0x5b14('0x84'),_0x5b14('0x59'));if(_0x2fe74d[_0x5b14('0x40')]){_0x2fe74d[_0x5b14('0x40')][_0x5b14('0x30')](function(_0x44c3a2){_0x3bf048[_0x5b14('0x40')]('i.'+_0x44c3a2[0x0],_0x44c3a2[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x5d3ce6)){_0x3bf048[_0x5b14('0x5b')](_0x517372);_0x154b07[_0x5b14('0x71')]('t.id\x20IN\x20?',_0x5d3ce6);}BPromise[_0x5b14('0x85')]()[_0x5b14('0x27')](function(){if(!_0x42e7d8){if(_0x17bd9f[_0x5b14('0x39')][_0x5b14('0x86')]||_0x17bd9f['query'][_0x5b14('0x87')])return;_0x154b07[_0x5b14('0x71')](_0x5b14('0x88'));_0x3bf048[_0x5b14('0x71')](_0x5b14('0x88'));return;}return _0x17bd9f[_0x5b14('0x89')][_0x5b14('0x8a')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4b0e12){if(_['isEmpty'](_0x4b0e12)){_0x154b07[_0x5b14('0x71')](_0x5b14('0x8b'));_0x3bf048[_0x5b14('0x71')](_0x5b14('0x8b'));}else{_0x154b07[_0x5b14('0x71')](_0x5b14('0x6e'),_[_0x5b14('0x37')](_0x4b0e12,'id'));_0x3bf048[_0x5b14('0x71')](_0x5b14('0x6e'),_[_0x5b14('0x37')](_0x4b0e12,'id'));}});})[_0x5b14('0x27')](function(){db['sequelize'][_0x5b14('0x39')](_0x154b07[_0x5b14('0x8c')](),_0x65b380)[_0x5b14('0x27')](function(_0x3cb761){_0xa630a9['count']=_0x3cb761[_0x5b14('0x3e')];if(_0xa630a9[_0x5b14('0x21')]===0x0)return[];return db[_0x5b14('0x8d')][_0x5b14('0x39')](_0x5cc257[_0x5b14('0x8c')](),_0x65b380)[_0x5b14('0x27')](function(_0x269a35){_0x985e69=_[_0x5b14('0x8e')](_0x269a35,'id');_0x65b380=_[_0x5b14('0x8f')](_0x65b380,{'model':db[_0x5b14('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17bd9f[_0x5b14('0x39')][_0x5b14('0x3d')]){_0x2fe74d[_0x5b14('0x3c')][_0x5b14('0x30')](function(_0xd583b2){_0x3bf048['field']('i.'+_0xd583b2);});}else{_0x3bf048[_0x5b14('0x44')](_0x5b14('0x84'),_0x5b14('0x59'));_0x3bf048[_0x5b14('0x44')](_0x5b14('0x90'),'Account.key');_0x3bf048['field'](_0x5b14('0x91'),'Account.mandatoryDisposition');_0x3bf048[_0x5b14('0x44')](_0x5b14('0x92'));_0x3bf048[_0x5b14('0x44')](_0x5b14('0x93'),_0x5b14('0x94'));_0x3bf048[_0x5b14('0x44')]('c.lastName',_0x5b14('0x95'));_0x3bf048['field']('c.email',_0x5b14('0x96'));_0x3bf048[_0x5b14('0x44')](_0x5b14('0x97'),'Contact.phone');_0x3bf048['field']('c.mobile','Contact.mobile');_0x3bf048[_0x5b14('0x44')](_0x5b14('0x98'),_0x5b14('0x99'));_0x3bf048['field']('o.fullname',_0x5b14('0x9a'));_0x3bf048[_0x5b14('0x44')]('o.internal',_0x5b14('0x9b'));_0x3bf048[_0x5b14('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}_0x3bf048['limit'](_0x2fe74d['limit']);_0x3bf048[_0x5b14('0x22')](_0x2fe74d['offset']);return db[_0x5b14('0x8d')][_0x5b14('0x39')](_0x3bf048['toString'](),_0x65b380);})[_0x5b14('0x27')](function(_0x5ce32a){_0x56f868[_0x5b14('0x71')]('ui.SmsInteractionId\x20IN\x20?',_[_0x5b14('0x37')](_0x5ce32a,'id'));return db[_0x5b14('0x8d')]['query'](_0x56f868[_0x5b14('0x8c')](),_0x65b380)[_0x5b14('0x27')](function(_0x21161b){var _0x2a3a92=_['groupBy'](_0x21161b,_0x5b14('0x9c'));var _0x2b6397=[];_0x5ce32a['forEach'](function(_0x3d4ea4){_0x2b6397[_0x5b14('0x9d')](updateSmsInteraction(_0x3d4ea4,_0x985e69,_0x2a3a92));});return BPromise[_0x5b14('0x9e')](_0x2b6397);});});})['then'](function(_0x22eef3){_0xa630a9[_0x5b14('0x9f')]=_0x22eef3;return _0xa630a9;})[_0x5b14('0x27')](respondWithFilteredResult(_0x5604d5,_0x2fe74d));})['catch'](handleError(_0x5604d5,null));};exports[_0x5b14('0xa0')]=function(_0x5c6014,_0xe35a2f){var _0x55c470={'raw':![],'where':{'id':_0x5c6014[_0x5b14('0xa1')]['id']}},_0x2a8597={};_0x2a8597['model']=_[_0x5b14('0x38')](db['SmsInteraction'][_0x5b14('0x33')]);_0x2a8597[_0x5b14('0x39')]=_[_0x5b14('0x38')](_0x5c6014[_0x5b14('0x39')]);_0x2a8597[_0x5b14('0x3a')]=_['intersection'](_0x2a8597['model'],_0x2a8597[_0x5b14('0x39')]);_0x55c470['attributes']=_[_0x5b14('0x3b')](_0x2a8597[_0x5b14('0x36')],qs[_0x5b14('0x3d')](_0x5c6014[_0x5b14('0x39')]['fields']));_0x55c470[_0x5b14('0x3c')]=_0x55c470[_0x5b14('0x3c')][_0x5b14('0x3e')]?_0x55c470[_0x5b14('0x3c')]:_0x2a8597[_0x5b14('0x36')];if(_0x5c6014[_0x5b14('0x39')][_0x5b14('0xa2')]){_0x55c470[_0x5b14('0xa3')]=[{'all':!![]}];}_0x55c470=_[_0x5b14('0x8f')]({},_0x55c470,_0x5c6014[_0x5b14('0xa4')]);return db['SmsInteraction']['find'](_0x55c470)['then'](handleEntityNotFound(_0xe35a2f,null))['then'](respondWithResult(_0xe35a2f,null))['catch'](handleError(_0xe35a2f,null));};exports[_0x5b14('0xa5')]=function(_0x215260,_0x41465a){return db[_0x5b14('0x32')]['create'](_0x215260[_0x5b14('0x6c')],{})[_0x5b14('0x27')](respondWithResult(_0x41465a,0xc9))[_0x5b14('0xa6')](handleError(_0x41465a,null));};exports['update']=function(_0x534104,_0x564a0b){if(_0x534104[_0x5b14('0x6c')]['id']){delete _0x534104[_0x5b14('0x6c')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x534104[_0x5b14('0xa1')]['id']}})[_0x5b14('0x27')](handleEntityNotFound(_0x564a0b,null))[_0x5b14('0x27')](saveUpdates(_0x534104[_0x5b14('0x6c')],null))[_0x5b14('0x27')](respondWithResult(_0x564a0b,null))[_0x5b14('0xa6')](handleError(_0x564a0b,null));};exports['destroy']=function(_0x2eb640,_0x419171){return db[_0x5b14('0x32')][_0x5b14('0x58')]({'where':{'id':_0x2eb640[_0x5b14('0xa1')]['id']}})[_0x5b14('0x27')](handleEntityNotFound(_0x419171,null))['then'](removeEntity(_0x419171,null))['catch'](handleError(_0x419171,null));};exports[_0x5b14('0xa7')]=function(_0x5bdbf9,_0x3ea50d){return db[_0x5b14('0x32')]['describe']()[_0x5b14('0x27')](respondWithResult(_0x3ea50d,null))[_0x5b14('0xa6')](handleError(_0x3ea50d,null));};exports['addMessage']=function(_0x52c781,_0x3d00c7,_0x4161ce){return db['SmsMessage'][_0x5b14('0x58')]({'where':{'id':_0x52c781[_0x5b14('0xa1')]['id']}})[_0x5b14('0x27')](handleEntityNotFound(_0x3d00c7,null))[_0x5b14('0x27')](function(_0x316c8e){if(_0x316c8e){return _0x316c8e[_0x5b14('0xa8')](_0x52c781['body']['ids'],_['omit'](_0x52c781[_0x5b14('0x6c')],[_0x5b14('0xa9'),'id'])||{});}})[_0x5b14('0x27')](respondWithResult(_0x3d00c7,null))['catch'](handleError(_0x3d00c7,null));};exports[_0x5b14('0xaa')]=function(_0x120d42,_0x92d6c6,_0x5eca44){var _0x3bccb2={'raw':![],'where':{}};var _0x58ad62={};var _0x43f96f={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x5b14('0xab')]({'where':{'id':_0x120d42['params']['id']}})[_0x5b14('0x27')](handleEntityNotFound(_0x92d6c6,null))['then'](function(_0x936890){if(_0x936890){_0x58ad62[_0x5b14('0x36')]=_['keys'](db['SmsMessage'][_0x5b14('0x33')]);_0x58ad62[_0x5b14('0x39')]=_[_0x5b14('0x38')](_0x120d42[_0x5b14('0x39')]);_0x58ad62['filters']=_[_0x5b14('0x3b')](_0x58ad62[_0x5b14('0x36')],_0x58ad62[_0x5b14('0x39')]);_0x3bccb2[_0x5b14('0x3c')]=_['intersection'](_0x58ad62[_0x5b14('0x36')],qs[_0x5b14('0x3d')](_0x120d42[_0x5b14('0x39')]['fields']));_0x3bccb2['attributes']=_0x3bccb2['attributes']['length']?_0x3bccb2[_0x5b14('0x3c')]:_0x58ad62[_0x5b14('0x36')];if(!_0x120d42['query'][_0x5b14('0xac')](_0x5b14('0x3f'))){_0x3bccb2[_0x5b14('0x23')]=qs[_0x5b14('0x23')](_0x120d42[_0x5b14('0x39')][_0x5b14('0x23')]);_0x3bccb2[_0x5b14('0x22')]=qs[_0x5b14('0x22')](_0x120d42[_0x5b14('0x39')][_0x5b14('0x22')]);}_0x3bccb2['order']=qs['sort'](_0x120d42[_0x5b14('0x39')]['sort']);_0x3bccb2['where']=qs[_0x5b14('0x3a')](_['pick'](_0x120d42[_0x5b14('0x39')],_0x58ad62[_0x5b14('0x3a')]));_0x3bccb2[_0x5b14('0x71')][_0x5b14('0x9c')]=_0x936890['id'];if(_0x120d42[_0x5b14('0x39')][_0x5b14('0x79')]){_0x3bccb2[_0x5b14('0x71')]=_['merge'](_0x3bccb2[_0x5b14('0x71')],{'$or':_[_0x5b14('0x37')](_0x3bccb2['attributes'],function(_0x8b2a1a){var _0x19a5cc={};_0x19a5cc[_0x8b2a1a]={'$like':'%'+_0x120d42[_0x5b14('0x39')]['filter']+'%'};return _0x19a5cc;})});}if(_0x120d42['query'][_0x5b14('0xad')]){var _0x12df71=_0x120d42['query'][_0x5b14('0xad')][_0x5b14('0x60')](',');var _0x29d756={};_0x29d756[_0x12df71[0x0]]={'$gte':moment(_0x12df71[0x1])['format'](_0x5b14('0xae'))};_0x3bccb2[_0x5b14('0x71')]=_['merge'](_0x3bccb2[_0x5b14('0x71')],_0x29d756);}_0x3bccb2=_[_0x5b14('0x8f')]({},_0x3bccb2,_0x120d42['options']);return db['SmsMessage'][_0x5b14('0x21')]({'where':_0x3bccb2[_0x5b14('0x71')]})[_0x5b14('0x27')](function(_0x453fab){_0x43f96f['count']=_0x453fab;if(_0x120d42[_0x5b14('0x39')][_0x5b14('0xa2')]){_0x3bccb2[_0x5b14('0xa3')]=[{'all':!![]}];}return db[_0x5b14('0xaf')]['findAll'](_0x3bccb2);})[_0x5b14('0x27')](function(_0x1a5f39){_0x43f96f[_0x5b14('0x9f')]=_0x1a5f39;return _0x43f96f;});}})[_0x5b14('0x27')](respondWithFilteredResult(_0x92d6c6,_0x3bccb2))[_0x5b14('0xa6')](handleError(_0x92d6c6,null));};exports[_0x5b14('0xb0')]=function(_0x35924b,_0x353333,_0x4c38f9){return db[_0x5b14('0x32')]['find']({'where':{'id':_0x35924b['params']['id']}})[_0x5b14('0x27')](handleEntityNotFound(_0x353333,null))[_0x5b14('0x27')](function(_0xf2480e){if(_0xf2480e){return _0xf2480e['setTags'](_0x35924b[_0x5b14('0x6c')]['ids'],_['omit'](_0x35924b[_0x5b14('0x6c')],[_0x5b14('0xa9'),'id'])||{})[_0x5b14('0xb1')](function(){return db['Tag'][_0x5b14('0xb2')]({'attributes':['id',_0x5b14('0x2a'),_0x5b14('0x45')],'where':{'id':_0x35924b[_0x5b14('0x6c')][_0x5b14('0xa9')]}});})['then'](function(_0x71080){socket[_0x5b14('0xb3')]('smsInteractionTags:save',{'id':Number(_0x35924b['params']['id']),'tags':_0x71080||[]});return{'id':Number(_0x35924b[_0x5b14('0xa1')]['id']),'tags':_0x71080||[]};});}})[_0x5b14('0x27')](respondWithResult(_0x353333,null))['catch'](handleError(_0x353333,null));};exports[_0x5b14('0xb4')]=function(_0x57b61d,_0x3adb3d,_0x58a304){return db[_0x5b14('0x32')][_0x5b14('0x58')]({'where':{'id':_0x57b61d[_0x5b14('0xa1')]['id']}})[_0x5b14('0x27')](handleEntityNotFound(_0x3adb3d,null))[_0x5b14('0x27')](function(_0x4e1e3f){if(_0x4e1e3f){return _0x4e1e3f[_0x5b14('0xb4')](_0x57b61d[_0x5b14('0x39')][_0x5b14('0xa9')]);}})['then'](respondWithStatusCode(_0x3adb3d,null))[_0x5b14('0xa6')](handleError(_0x3adb3d,null));};exports[_0x5b14('0xb5')]=function(_0x1084ab,_0x3a8d0b){var _0x57de21=moment()[_0x5b14('0xb6')]()[_0x5b14('0x8c')]();var _0x1e9217=path[_0x5b14('0xb7')](config['root'],_0x5b14('0xb8'),_0x5b14('0xb9'),'tmp');var _0x26ee93=path[_0x5b14('0xb7')](config[_0x5b14('0xba')],_0x5b14('0xb8'),_0x5b14('0xb9'),_0x5b14('0xbb'));var _0x477ed7=path['join'](_0x1e9217,_0x57de21);var _0x2d0db0=util[_0x5b14('0xbc')]('transcript-%d-%s.zip',_0x1084ab['params']['id'],_0x57de21);var _0x6e7a20=path['join'](_0x1e9217,_0x2d0db0);var _0x40e103=[];_0x40e103['push']({'model':db['User'],'as':_0x5b14('0x6b'),'attributes':['id',_0x5b14('0x2d')],'raw':!![]});_0x40e103[_0x5b14('0x9d')]({'model':db[_0x5b14('0xbd')],'as':_0x5b14('0x5d'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x53fc74=[{'model':db[_0x5b14('0xaf')],'as':_0x5b14('0xbe'),'attributes':['id',_0x5b14('0x6c'),'createdAt',_0x5b14('0xbf'),'secret',_0x5b14('0x75')],'include':_0x40e103}];_0x53fc74[_0x5b14('0x9d')]({'model':db['SmsAccount'],'as':_0x5b14('0xc0'),'attributes':['id','name']});_0x53fc74[_0x5b14('0x9d')]({'model':db[_0x5b14('0x6b')],'as':_0x5b14('0xc1'),'attributes':['id',_0x5b14('0x2d')]});return db[_0x5b14('0x32')]['find']({'where':{'id':_0x1084ab[_0x5b14('0xa1')]['id']},'include':_0x53fc74})['then'](handleEntityNotFound(_0x3a8d0b,null))[_0x5b14('0x27')](function(_0x239ac0){if(_0x239ac0){var _0x222d84=_0x239ac0['get']({'plain':!![]});fs[_0x5b14('0xc2')](_0x477ed7);var _0x3b9a2a={'format':'A4','border':_0x5b14('0xc3'),'header':{'height':_0x5b14('0xc4'),'contents':{'first':_0x5b14('0xc5')}},'footer':{'height':_0x5b14('0xc6'),'contents':{'default':util[_0x5b14('0xbc')](_0x5b14('0xc7'),util[_0x5b14('0xbc')]('%s\x20#%d',_0x5b14('0xc8'),_0x222d84['id']),moment()['format'](_0x5b14('0xc9'))[_0x5b14('0x8c')]())}}};var _0x4c5839={'channel':'Sms','account':_0x222d84['Account'][_0x5b14('0x2a')],'agent':_0x222d84[_0x5b14('0xc1')]?_0x222d84[_0x5b14('0xc1')]['fullname']:_0x5b14('0xca'),'createdAt':moment(_0x222d84[_0x5b14('0xcb')])[_0x5b14('0xbc')](_0x5b14('0xae'))[_0x5b14('0x8c')](),'closedAt':_0x222d84[_0x5b14('0xcc')]?moment(_0x222d84[_0x5b14('0xcd')])[_0x5b14('0xbc')](_0x5b14('0xae'))[_0x5b14('0x8c')]():'','disposition':_0x222d84['disposition'],'messages':_(_0x222d84['Messages'])[_0x5b14('0x79')]({'secret':![]})[_0x5b14('0x37')](function(_0x3020f8){return{'date':moment(_0x3020f8[_0x5b14('0xcb')])[_0x5b14('0xbc')](_0x5b14('0xae'))[_0x5b14('0x8c')](),'sender':_0x3020f8['direction']===_0x5b14('0xce')?_0x3020f8[_0x5b14('0x6b')]?_0x3020f8[_0x5b14('0x6b')][_0x5b14('0x2d')]:'System':_0x3020f8[_0x5b14('0x5d')][_0x5b14('0xcf')]+(_0x3020f8['Contact'][_0x5b14('0xd0')]?'\x20'+_0x3020f8[_0x5b14('0x5d')][_0x5b14('0xd0')]:''),'body':_0x3020f8[_0x5b14('0x6c')],'direction':_0x3020f8[_0x5b14('0xbf')]===_0x5b14('0xce')?'A':'C','secret':_0x3020f8[_0x5b14('0xd1')],'read':_0x3020f8[_0x5b14('0x75')]};})['value']()};return ejs[_0x5b14('0xd2')](path[_0x5b14('0xb7')](config[_0x5b14('0xba')],'server',_0x5b14('0xd3'),_0x5b14('0xd4')),{'interaction':_0x4c5839})[_0x5b14('0x27')](function(_0x5265ce){return new BPromise(function(_0x3785aa,_0x2aac41){pdf[_0x5b14('0xa5')](_0x5265ce,_0x3b9a2a)[_0x5b14('0xd5')](path[_0x5b14('0xb7')](_0x477ed7,_0x5b14('0xd6')+_0x222d84['id']+'-'+_0x57de21+_0x5b14('0xd7')),function(_0x49ffa6,_0xcb7a12){if(_0x49ffa6)return _0x2aac41(_0x49ffa6);_0x3785aa(_0xcb7a12);});});})[_0x5b14('0x27')](function(){return new BPromise(function(_0x491908,_0x1983ba){zipdir(_0x477ed7,{'saveTo':_0x6e7a20},function(_0x4111a9,_0x2bf4e4){if(_0x4111a9)return _0x1983ba(_0x4111a9);return _0x491908(_0x2bf4e4);});})[_0x5b14('0x27')](function(){return new BPromise(function(_0x2050ec,_0x274f37){rimraf(_0x477ed7,function(_0x2a1a2f){if(_0x2a1a2f)_0x274f37(_0x2a1a2f);return _0x2050ec();});});})[_0x5b14('0x27')](function(){return _0x3a8d0b[_0x5b14('0xb5')](_0x6e7a20,_0x2d0db0,function(_0x113017){if(_0x113017){console[_0x5b14('0xd8')](_0x5b14('0xd9'),_0x113017);}else{fs[_0x5b14('0xda')](_0x6e7a20);}});});});}else{return _0x3a8d0b[_0x5b14('0x1d')](0xc8);}})['catch'](handleError(_0x3a8d0b,null));}; \ No newline at end of file +var _0xe2fe=['having','`\x20=\x200','`\x20>\x200','Contact','operator','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','body','text','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','group','Sequelize','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','a.key','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','SmsInteractionId','all','catch','show','include','merge','options','SmsInteraction','create','params','describe','addMessage','ids','omit','getMessages','findOne','nolimit','format','YYYY-MM-DD\x20HH:mm:ss','SmsMessage','includeAll','findAll','addTags','setTags','emit','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','direction','secret','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','Sms','YYYY-MM-DD','Account','Owner','N.A.','closed','closedAt','out','System','views','downloadInteraction.html','transcript-','log','err','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','redis','defaults','localhost','socket.io-emitter','register','status','end','json','count','offset','set','Content-Range','reject','save','update','destroy','then','sendStatus','name','send','map','fullname','TagIds','forEach','push','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','sort','where','filters','pick','field','color','tools_tags','select','u.id','u.fullname','ui.SmsInteractionId','from','sms_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','it.SmsInteractionId\x20=\x20i.id','expr','sqlOperator','conditions','find','unreadMessages','value'];(function(_0x478b3d,_0x173852){var _0x3c402c=function(_0x3dd8c0){while(--_0x3dd8c0){_0x478b3d['push'](_0x478b3d['shift']());}};_0x3c402c(++_0x173852);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xee2f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xee2f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee2f('0x2'));var moment=require(_0xee2f('0x3'));var BPromise=require(_0xee2f('0x4'));var Mustache=require(_0xee2f('0x5'));var util=require(_0xee2f('0x6'));var path=require('path');var sox=require(_0xee2f('0x7'));var csv=require(_0xee2f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x8'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xee2f('0x10')]=_[_0xee2f('0x11')](config[_0xee2f('0x10')],{'host':_0xee2f('0x12'),'port':0x18eb});var socket=require(_0xee2f('0x13'))(new Redis(config[_0xee2f('0x10')]));require('./smsInteraction.socket')[_0xee2f('0x14')](socket);function respondWithStatusCode(_0x531c3a,_0x36db10){_0x36db10=_0x36db10||0xcc;return function(_0x271c1d){if(_0x271c1d){return _0x531c3a['sendStatus'](_0x36db10);}return _0x531c3a[_0xee2f('0x15')](_0x36db10)[_0xee2f('0x16')]();};}function respondWithResult(_0x28b614,_0x1bbf7d){_0x1bbf7d=_0x1bbf7d||0xc8;return function(_0x390c2c){if(_0x390c2c){return _0x28b614['status'](_0x1bbf7d)[_0xee2f('0x17')](_0x390c2c);}};}function respondWithFilteredResult(_0x4afcd1,_0x17d288){return function(_0x3359ff){if(_0x3359ff){var _0x502eb6=_0x3359ff[_0xee2f('0x18')],_0x550da7=_0x17d288[_0xee2f('0x19')],_0x40b5bc=_0x17d288[_0xee2f('0x19')]+_0x17d288['limit'],_0x5a5078;if(_0x40b5bc>=_0x502eb6){_0x40b5bc=_0x502eb6;_0x5a5078=0xc8;}else{_0x5a5078=0xce;}_0x4afcd1[_0xee2f('0x15')](_0x5a5078);return _0x4afcd1[_0xee2f('0x1a')](_0xee2f('0x1b'),_0x550da7+'-'+_0x40b5bc+'/'+_0x502eb6)[_0xee2f('0x17')](_0x3359ff);}return null;};}function patchUpdates(_0x3d892d){return function(_0x5d36d4){try{jsonpatch['apply'](_0x5d36d4,_0x3d892d,!![]);}catch(_0x40d1fd){return BPromise[_0xee2f('0x1c')](_0x40d1fd);}return _0x5d36d4[_0xee2f('0x1d')]();};}function saveUpdates(_0x203b2f,_0x472e3b){return function(_0xf278cc){if(_0xf278cc){return _0xf278cc[_0xee2f('0x1e')](_0x203b2f)['then'](function(_0x250399){return _0x250399;});}return null;};}function removeEntity(_0x2c47c5,_0x15ceda){return function(_0x70e308){if(_0x70e308){return _0x70e308[_0xee2f('0x1f')]()[_0xee2f('0x20')](function(){_0x2c47c5[_0xee2f('0x15')](0xcc)[_0xee2f('0x16')]();});}};}function handleEntityNotFound(_0x382174,_0x1e394f){return function(_0x11edc8){if(!_0x11edc8){_0x382174[_0xee2f('0x21')](0x194);}return _0x11edc8;};}function handleError(_0x1c8454,_0x45c4a0){_0x45c4a0=_0x45c4a0||0x1f4;return function(_0x53f6ed){logger['error'](_0x53f6ed['stack']);if(_0x53f6ed[_0xee2f('0x22')]){delete _0x53f6ed[_0xee2f('0x22')];}_0x1c8454[_0xee2f('0x15')](_0x45c4a0)[_0xee2f('0x23')](_0x53f6ed);};}function getInteractionUsers(_0x892a4e,_0x3737fd){return new BPromise(function(_0x4d8398,_0x3d3806){try{if(_0x3737fd[_0x892a4e['id']]){_0x892a4e['Users']=_[_0xee2f('0x24')](_0x3737fd[_0x892a4e['id']],function(_0x180429){return{'id':_0x180429['id'],'fullname':_0x180429[_0xee2f('0x25')]};});}}catch(_0x8a0bf7){_0x3d3806(_0x8a0bf7);}_0x4d8398(_0x892a4e);});}function getInteractionTags(_0x3ddbe3,_0x47d5a6){return new BPromise(function(_0x310c0b,_0xd16e35){try{if(_0x3ddbe3['TagIds']){_0x3ddbe3['Tags']=[];_0x3ddbe3[_0xee2f('0x26')]['split'](',')[_0xee2f('0x27')](function(_0xc447e){_0x3ddbe3['Tags'][_0xee2f('0x28')](_0x47d5a6[_0xc447e]);});}delete _0x3ddbe3['TagIds'];}catch(_0x5ec1b0){_0xd16e35(_0x5ec1b0);}_0x310c0b(_0x3ddbe3);});}function updateSmsInteraction(_0x5b3ef0,_0x3f1fe8,_0x433d64){return new BPromise(function(_0x5c15bb,_0x39f224){return getInteractionUsers(_0x5b3ef0,_0x433d64)[_0xee2f('0x20')](function(_0xd64b7){return getInteractionTags(_0xd64b7,_0x3f1fe8);})[_0xee2f('0x20')](function(_0x1c3a01){_0x5c15bb(_0x1c3a01);})['catch'](function(_0x2c789d){_0x39f224(_0x2c789d);});});}exports['index']=function(_0x6fe685,_0x86cad4){var _0x3dcb9e={},_0x4a5047={},_0x169c75={'count':0x0,'rows':[]};var _0x5ed71e=_[_0xee2f('0x24')](db['SmsInteraction'][_0xee2f('0x29')],function(_0x13a824){return{'name':_0x13a824[_0xee2f('0x2a')],'type':_0x13a824[_0xee2f('0x2b')][_0xee2f('0x2c')]};});_0x4a5047[_0xee2f('0x2d')]=_[_0xee2f('0x24')](_0x5ed71e,_0xee2f('0x22'));_0x4a5047[_0xee2f('0x2e')]=_[_0xee2f('0x2f')](_0x6fe685[_0xee2f('0x2e')]);_0x4a5047['filters']=_[_0xee2f('0x30')](_0x4a5047['model'],_0x4a5047[_0xee2f('0x2e')]);_0x3dcb9e[_0xee2f('0x31')]=_[_0xee2f('0x30')](_0x4a5047[_0xee2f('0x2d')],qs[_0xee2f('0x32')](_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x32')]));_0x3dcb9e[_0xee2f('0x31')]=_0x3dcb9e['attributes']['length']?_0x3dcb9e['attributes']:_0x4a5047[_0xee2f('0x2d')];if(!_0x6fe685['query'][_0xee2f('0x33')]('nolimit')){_0x3dcb9e['limit']=qs['limit'](_0x6fe685['query'][_0xee2f('0x34')]);_0x3dcb9e[_0xee2f('0x19')]=qs[_0xee2f('0x19')](_0x6fe685[_0xee2f('0x2e')]['offset']);}_0x3dcb9e['order']=qs[_0xee2f('0x35')](_0x6fe685['query']['sort']);_0x3dcb9e[_0xee2f('0x36')]=qs[_0xee2f('0x37')](_[_0xee2f('0x38')](_0x6fe685['query'],_0x4a5047[_0xee2f('0x37')]));var _0x27c447=[];var _0x19bd4d=squel['select']()['field']('id')[_0xee2f('0x39')](_0xee2f('0x22'))[_0xee2f('0x39')](_0xee2f('0x3a'))['from'](_0xee2f('0x3b'));var _0x1df63d=squel[_0xee2f('0x3c')]()[_0xee2f('0x39')](_0xee2f('0x3d'))[_0xee2f('0x39')](_0xee2f('0x3e'))[_0xee2f('0x39')](_0xee2f('0x3f'))[_0xee2f('0x40')]('user_has_sms_interactions','ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');var _0x11aecb=squel[_0xee2f('0x3c')]()[_0xee2f('0x40')](_0xee2f('0x41'),'i')[_0xee2f('0x42')]('cm_contacts','c',_0xee2f('0x43'))[_0xee2f('0x42')](_0xee2f('0x44'),'o',_0xee2f('0x45'))['left_join']('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0xee2f('0x42')]('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')['left_join']('sms_interaction_has_tags','it',_0xee2f('0x46'))[_0xee2f('0x42')](_0xee2f('0x3b'),'t','t.id\x20=\x20it.TagId');var _0x22506e=squel['expr']();var _0x3d95b8=[];var _0x35d738=squel[_0xee2f('0x47')]();var _0x2e804a;if(_0x6fe685[_0xee2f('0x2e')]['search']){_0x2e804a=as['parseSearch'](_0x6fe685[_0xee2f('0x2e')]['search']);var _0x2b6beb=_0x2e804a[_0xee2f('0x48')];for(var _0x1928f8=0x0;_0x1928f8<_0x2e804a[_0xee2f('0x49')]['length'];_0x1928f8++){var _0x5df503=_0x2e804a[_0xee2f('0x49')][_0x1928f8];var _0xf4aa97='i';var _0x1b00a8=_[_0xee2f('0x4a')](_0x5ed71e,[_0xee2f('0x22'),_0x5df503[_0xee2f('0x39')]]);if(!_0x1b00a8){switch(_0x5df503[_0xee2f('0x39')]){case _0xee2f('0x4b'):if(_0x5df503[_0xee2f('0x4c')]==0x1){_0x11aecb[_0xee2f('0x4d')]('`'+_0x5df503[_0xee2f('0x39')]+_0xee2f('0x4e'));}else{_0x11aecb['having']('`'+_0x5df503[_0xee2f('0x39')]+_0xee2f('0x4f'));}break;case _0xee2f('0x50'):if(_0x5df503[_0xee2f('0x51')]==='$substring'){if(_0x5df503[_0xee2f('0x4c')][_0xee2f('0x52')]('\x20')[_0xee2f('0x53')]>0x1){_0x22506e[_0x2b6beb](_0xee2f('0x54'),qs[_0xee2f('0x55')](_0x5df503['value']),null);}else{var _0x8b135b='%'+_0x5df503['value']+'%';_0x22506e[_0x2b6beb]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x8b135b,_0x8b135b,_0x8b135b);}}else{_0x1b00a8=_[_0xee2f('0x4a')](_0x5ed71e,[_0xee2f('0x22'),_0xee2f('0x56')]);_0x5df503[_0xee2f('0x39')]=_0xee2f('0x56');_0x58e464=as[_0xee2f('0x57')](_0xf4aa97,_0x1b00a8[_0xee2f('0x2b')],_0x5df503);_0x22506e[_0x2b6beb](_0x58e464['text'],_0x58e464[_0xee2f('0x4c')][_0xee2f('0x58')],_0x58e464[_0xee2f('0x4c')][_0xee2f('0x16')]);}break;case _0xee2f('0x59'):var _0x3e1184=_0x5df503[_0xee2f('0x4c')][_0xee2f('0x52')](',')[_0xee2f('0x24')](function(_0x5d6c40){return Number(_0x5d6c40);});_0x3e1184[_0xee2f('0x27')](function(_0x4b9d29){_0x35d738['or'](_0xee2f('0x5a'),'%,'+_0x4b9d29+',%');});_0x3d95b8=_[_0xee2f('0x5b')](_0x3d95b8,_0x3e1184);break;case _0xee2f('0x5c'):if(_0x5df503[_0xee2f('0x51')]===_0xee2f('0x5d')){_0x22506e[_0x2b6beb]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5df503[_0xee2f('0x4c')]+'%',null);}else{_0x1b00a8=_[_0xee2f('0x4a')](_0x5ed71e,[_0xee2f('0x22'),_0xee2f('0x5e')]);_0x5df503['field']='UserId';_0x58e464=as['buildExpression'](_0xf4aa97,_0x1b00a8['type'],_0x5df503);_0x22506e[_0x2b6beb](_0x58e464['text'],_0x58e464[_0xee2f('0x4c')]['start'],_0x58e464[_0xee2f('0x4c')][_0xee2f('0x16')]);}break;case _0xee2f('0x5f'):_0x58e464=as[_0xee2f('0x57')]('me',null,_0x5df503);_0x22506e[_0x2b6beb](_0x58e464[_0xee2f('0x60')],_0x58e464[_0xee2f('0x4c')]['start'],_0x58e464['value'][_0xee2f('0x16')]);break;}}else{var _0x58e464=as[_0xee2f('0x57')](_0xf4aa97,_0x1b00a8['type'],_0x5df503);_0x22506e[_0x2b6beb](_0x58e464[_0xee2f('0x60')],_0x58e464['value'][_0xee2f('0x58')],_0x58e464[_0xee2f('0x4c')][_0xee2f('0x16')]);}}}else{var _0x5655f4=_(_0x6fe685[_0xee2f('0x2e')])[_0xee2f('0x2f')]()[_0xee2f('0x24')](function(_0x90923f){return _[_0xee2f('0x61')](_0x5ed71e,[_0xee2f('0x22'),_0x90923f])?_0x90923f:undefined;})[_0xee2f('0x62')]()['value']();if(!_[_0xee2f('0x63')](_0x5655f4)){_0x5655f4[_0xee2f('0x27')](function(_0xcf14c7){if(_0xcf14c7===_0xee2f('0x64')){_0x11aecb[_0xee2f('0x36')](_0xee2f('0x65'),[][_0xee2f('0x66')](_0x6fe685[_0xee2f('0x2e')][_0xcf14c7]));}else if(_0xcf14c7===_0xee2f('0x67')){var _0x35200d=JSON[_0xee2f('0x68')](_0x6fe685['query'][_0xcf14c7])[_0xee2f('0x69')];var _0xf15bc1=JSON['parse'](_0x6fe685[_0xee2f('0x2e')][_0xcf14c7])['$lte'];_0x11aecb[_0xee2f('0x36')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x35200d,_0xf15bc1);}else{if(_0x6fe685['query'][_0xcf14c7]===_0xee2f('0x6a')){_0x11aecb[_0xee2f('0x36')]('i.'+_0xcf14c7+_0xee2f('0x6b'));}else{_0x11aecb[_0xee2f('0x36')]('i.'+_0xcf14c7+_0xee2f('0x6c'),_0x6fe685['query'][_0xcf14c7]);}}});}if(_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x6d')]){if(_0x6fe685[_0xee2f('0x2e')]['read']==0x1){_0x11aecb[_0xee2f('0x4d')](_0xee2f('0x6e'));}else{_0x11aecb['having'](_0xee2f('0x6f'));}}if(_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x70')]){_0x3d95b8=_[_0xee2f('0x71')](_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x70')])?_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x70')]:new Array(_0x6fe685[_0xee2f('0x2e')]['tag']);_0x3d95b8['forEach'](function(_0x58d16e){_0x35d738['or'](_0xee2f('0x5a'),'%,'+_0x58d16e+',%');});}if(_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x72')]){var _0x7ab1db=_0x6fe685[_0xee2f('0x2e')]['filter'][_0xee2f('0x73')]('\x5c','\x5c\x5c')[_0xee2f('0x73')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0xee2f('0x74')](_0x7ab1db)){_0x22506e['or'](_0xee2f('0x75'),_0x7ab1db+'%')['or'](_0xee2f('0x76'),_0x7ab1db+'%');}else{_0x22506e['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xee2f('0x55')](_0x7ab1db))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x7ab1db+'%');}}}_0x11aecb[_0xee2f('0x36')](_0x22506e);_0x11aecb[_0xee2f('0x77')]('i.id');var _0x179774={'type':db[_0xee2f('0x78')]['QueryTypes']['SELECT'],'raw':!![]};var _0x48f0ff=_0x11aecb[_0xee2f('0x79')]();_0x48f0ff['field']('i.id');_0x48f0ff[_0xee2f('0x39')](_0xee2f('0x7a'),'unreadMessages');if(_0x3dcb9e[_0xee2f('0x7b')]){_0x3dcb9e['order'][_0xee2f('0x27')](function(_0x10d5f2){_0x11aecb[_0xee2f('0x7b')]('i.'+_0x10d5f2[0x0],_0x10d5f2[0x1]===_0xee2f('0x7c')?![]:!![]);});}if(!_[_0xee2f('0x63')](_0x3d95b8)){_0x11aecb[_0xee2f('0x4d')](_0x35d738);_0x48f0ff[_0xee2f('0x36')]('t.id\x20IN\x20?',_0x3d95b8);}BPromise[_0xee2f('0x7d')]()[_0xee2f('0x20')](function(){if(!_0x2e804a){if(_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x64')]||_0x6fe685[_0xee2f('0x2e')]['journey'])return;_0x48f0ff[_0xee2f('0x36')](_0xee2f('0x7e'));_0x11aecb[_0xee2f('0x36')](_0xee2f('0x7e'));return;}return _0x6fe685[_0xee2f('0x7f')][_0xee2f('0x80')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4c2975){if(_[_0xee2f('0x63')](_0x4c2975)){_0x48f0ff[_0xee2f('0x36')](_0xee2f('0x81'));_0x11aecb[_0xee2f('0x36')](_0xee2f('0x81'));}else{_0x48f0ff[_0xee2f('0x36')](_0xee2f('0x65'),_['map'](_0x4c2975,'id'));_0x11aecb['where'](_0xee2f('0x65'),_[_0xee2f('0x24')](_0x4c2975,'id'));}});})[_0xee2f('0x20')](function(){db[_0xee2f('0x82')][_0xee2f('0x2e')](_0x48f0ff[_0xee2f('0x83')](),_0x179774)[_0xee2f('0x20')](function(_0x1908c1){_0x169c75[_0xee2f('0x18')]=_0x1908c1[_0xee2f('0x53')];if(_0x169c75[_0xee2f('0x18')]===0x0)return[];return db[_0xee2f('0x82')]['query'](_0x19bd4d['toString'](),_0x179774)[_0xee2f('0x20')](function(_0x5bd7c8){_0x27c447=_['keyBy'](_0x5bd7c8,'id');_0x179774=_['merge'](_0x179774,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6fe685[_0xee2f('0x2e')][_0xee2f('0x32')]){_0x3dcb9e['attributes']['forEach'](function(_0x9c89a3){_0x11aecb[_0xee2f('0x39')]('i.'+_0x9c89a3);});}else{_0x11aecb[_0xee2f('0x39')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x11aecb[_0xee2f('0x39')](_0xee2f('0x84'),_0xee2f('0x85'));_0x11aecb['field'](_0xee2f('0x86'),'Account.mandatoryDisposition');_0x11aecb[_0xee2f('0x39')]('i.*');_0x11aecb[_0xee2f('0x39')](_0xee2f('0x87'),_0xee2f('0x88'));_0x11aecb['field']('c.lastName',_0xee2f('0x89'));_0x11aecb[_0xee2f('0x39')](_0xee2f('0x8a'),'Contact.email');_0x11aecb[_0xee2f('0x39')](_0xee2f('0x8b'),_0xee2f('0x8c'));_0x11aecb[_0xee2f('0x39')](_0xee2f('0x8d'),_0xee2f('0x8e'));_0x11aecb[_0xee2f('0x39')](_0xee2f('0x8f'),_0xee2f('0x90'));_0x11aecb[_0xee2f('0x39')](_0xee2f('0x91'),_0xee2f('0x92'));_0x11aecb[_0xee2f('0x39')](_0xee2f('0x93'),'Owner.internal');_0x11aecb[_0xee2f('0x39')](_0xee2f('0x94'),_0xee2f('0x26'));}_0x11aecb[_0xee2f('0x34')](_0x3dcb9e[_0xee2f('0x34')]);_0x11aecb[_0xee2f('0x19')](_0x3dcb9e[_0xee2f('0x19')]);return db[_0xee2f('0x82')][_0xee2f('0x2e')](_0x11aecb[_0xee2f('0x83')](),_0x179774);})[_0xee2f('0x20')](function(_0x49c92f){_0x1df63d[_0xee2f('0x36')](_0xee2f('0x95'),_[_0xee2f('0x24')](_0x49c92f,'id'));return db[_0xee2f('0x82')]['query'](_0x1df63d[_0xee2f('0x83')](),_0x179774)[_0xee2f('0x20')](function(_0x1e67ea){var _0x5d0aae=_['groupBy'](_0x1e67ea,_0xee2f('0x96'));var _0x48fe47=[];_0x49c92f['forEach'](function(_0x4fe6f2){_0x48fe47[_0xee2f('0x28')](updateSmsInteraction(_0x4fe6f2,_0x27c447,_0x5d0aae));});return BPromise[_0xee2f('0x97')](_0x48fe47);});});})[_0xee2f('0x20')](function(_0x172cee){_0x169c75['rows']=_0x172cee;return _0x169c75;})[_0xee2f('0x20')](respondWithFilteredResult(_0x86cad4,_0x3dcb9e));})[_0xee2f('0x98')](handleError(_0x86cad4,null));};exports[_0xee2f('0x99')]=function(_0x4bc0d8,_0x20e5db){var _0x481e16={'raw':![],'where':{'id':_0x4bc0d8['params']['id']}},_0x150445={};_0x150445['model']=_[_0xee2f('0x2f')](db['SmsInteraction'][_0xee2f('0x29')]);_0x150445['query']=_['keys'](_0x4bc0d8[_0xee2f('0x2e')]);_0x150445[_0xee2f('0x37')]=_['intersection'](_0x150445[_0xee2f('0x2d')],_0x150445[_0xee2f('0x2e')]);_0x481e16['attributes']=_['intersection'](_0x150445[_0xee2f('0x2d')],qs[_0xee2f('0x32')](_0x4bc0d8['query'][_0xee2f('0x32')]));_0x481e16[_0xee2f('0x31')]=_0x481e16[_0xee2f('0x31')][_0xee2f('0x53')]?_0x481e16[_0xee2f('0x31')]:_0x150445['model'];if(_0x4bc0d8['query']['includeAll']){_0x481e16[_0xee2f('0x9a')]=[{'all':!![]}];}_0x481e16=_[_0xee2f('0x9b')]({},_0x481e16,_0x4bc0d8[_0xee2f('0x9c')]);return db[_0xee2f('0x9d')][_0xee2f('0x4a')](_0x481e16)[_0xee2f('0x20')](handleEntityNotFound(_0x20e5db,null))[_0xee2f('0x20')](respondWithResult(_0x20e5db,null))[_0xee2f('0x98')](handleError(_0x20e5db,null));};exports[_0xee2f('0x9e')]=function(_0x173f5f,_0x230ee7){return db[_0xee2f('0x9d')][_0xee2f('0x9e')](_0x173f5f[_0xee2f('0x5f')],{})[_0xee2f('0x20')](respondWithResult(_0x230ee7,0xc9))[_0xee2f('0x98')](handleError(_0x230ee7,null));};exports['update']=function(_0x59569c,_0x1c9bc4){if(_0x59569c[_0xee2f('0x5f')]['id']){delete _0x59569c['body']['id'];}return db[_0xee2f('0x9d')][_0xee2f('0x4a')]({'where':{'id':_0x59569c[_0xee2f('0x9f')]['id']}})['then'](handleEntityNotFound(_0x1c9bc4,null))[_0xee2f('0x20')](saveUpdates(_0x59569c[_0xee2f('0x5f')],null))[_0xee2f('0x20')](respondWithResult(_0x1c9bc4,null))[_0xee2f('0x98')](handleError(_0x1c9bc4,null));};exports[_0xee2f('0x1f')]=function(_0x34bd13,_0x25d36b){return db[_0xee2f('0x9d')][_0xee2f('0x4a')]({'where':{'id':_0x34bd13['params']['id']}})[_0xee2f('0x20')](handleEntityNotFound(_0x25d36b,null))[_0xee2f('0x20')](removeEntity(_0x25d36b,null))[_0xee2f('0x98')](handleError(_0x25d36b,null));};exports[_0xee2f('0xa0')]=function(_0xe7e196,_0x32469d){return db[_0xee2f('0x9d')][_0xee2f('0xa0')]()['then'](respondWithResult(_0x32469d,null))[_0xee2f('0x98')](handleError(_0x32469d,null));};exports[_0xee2f('0xa1')]=function(_0x5696fc,_0xf40a38,_0x51b50d){return db['SmsMessage'][_0xee2f('0x4a')]({'where':{'id':_0x5696fc[_0xee2f('0x9f')]['id']}})[_0xee2f('0x20')](handleEntityNotFound(_0xf40a38,null))[_0xee2f('0x20')](function(_0x374d4f){if(_0x374d4f){return _0x374d4f[_0xee2f('0xa1')](_0x5696fc['body'][_0xee2f('0xa2')],_[_0xee2f('0xa3')](_0x5696fc['body'],[_0xee2f('0xa2'),'id'])||{});}})[_0xee2f('0x20')](respondWithResult(_0xf40a38,null))['catch'](handleError(_0xf40a38,null));};exports[_0xee2f('0xa4')]=function(_0x26dd6c,_0x2578f1,_0x338974){var _0x1bc9d5={'raw':![],'where':{}};var _0x1fb82b={};var _0x426e1f={'count':0x0,'rows':[]};return db[_0xee2f('0x9d')][_0xee2f('0xa5')]({'where':{'id':_0x26dd6c[_0xee2f('0x9f')]['id']}})[_0xee2f('0x20')](handleEntityNotFound(_0x2578f1,null))[_0xee2f('0x20')](function(_0x59224f){if(_0x59224f){_0x1fb82b[_0xee2f('0x2d')]=_['keys'](db['SmsMessage']['rawAttributes']);_0x1fb82b[_0xee2f('0x2e')]=_['keys'](_0x26dd6c[_0xee2f('0x2e')]);_0x1fb82b[_0xee2f('0x37')]=_[_0xee2f('0x30')](_0x1fb82b['model'],_0x1fb82b[_0xee2f('0x2e')]);_0x1bc9d5[_0xee2f('0x31')]=_['intersection'](_0x1fb82b[_0xee2f('0x2d')],qs[_0xee2f('0x32')](_0x26dd6c[_0xee2f('0x2e')][_0xee2f('0x32')]));_0x1bc9d5[_0xee2f('0x31')]=_0x1bc9d5[_0xee2f('0x31')][_0xee2f('0x53')]?_0x1bc9d5['attributes']:_0x1fb82b[_0xee2f('0x2d')];if(!_0x26dd6c[_0xee2f('0x2e')]['hasOwnProperty'](_0xee2f('0xa6'))){_0x1bc9d5[_0xee2f('0x34')]=qs[_0xee2f('0x34')](_0x26dd6c['query'][_0xee2f('0x34')]);_0x1bc9d5[_0xee2f('0x19')]=qs[_0xee2f('0x19')](_0x26dd6c[_0xee2f('0x2e')][_0xee2f('0x19')]);}_0x1bc9d5[_0xee2f('0x7b')]=qs['sort'](_0x26dd6c[_0xee2f('0x2e')][_0xee2f('0x35')]);_0x1bc9d5[_0xee2f('0x36')]=qs['filters'](_['pick'](_0x26dd6c[_0xee2f('0x2e')],_0x1fb82b['filters']));_0x1bc9d5[_0xee2f('0x36')][_0xee2f('0x96')]=_0x59224f['id'];if(_0x26dd6c['query'][_0xee2f('0x72')]){_0x1bc9d5[_0xee2f('0x36')]=_['merge'](_0x1bc9d5['where'],{'$or':_[_0xee2f('0x24')](_0x1bc9d5[_0xee2f('0x31')],function(_0x551cc3){var _0x1c9f70={};_0x1c9f70[_0x551cc3]={'$like':'%'+_0x26dd6c[_0xee2f('0x2e')][_0xee2f('0x72')]+'%'};return _0x1c9f70;})});}if(_0x26dd6c[_0xee2f('0x2e')]['$gte']){var _0x27475a=_0x26dd6c[_0xee2f('0x2e')][_0xee2f('0x69')]['split'](',');var _0x2aa5a5={};_0x2aa5a5[_0x27475a[0x0]]={'$gte':moment(_0x27475a[0x1])[_0xee2f('0xa7')](_0xee2f('0xa8'))};_0x1bc9d5[_0xee2f('0x36')]=_['merge'](_0x1bc9d5['where'],_0x2aa5a5);}_0x1bc9d5=_[_0xee2f('0x9b')]({},_0x1bc9d5,_0x26dd6c[_0xee2f('0x9c')]);return db[_0xee2f('0xa9')]['count']({'where':_0x1bc9d5[_0xee2f('0x36')]})[_0xee2f('0x20')](function(_0x50e8a2){_0x426e1f[_0xee2f('0x18')]=_0x50e8a2;if(_0x26dd6c[_0xee2f('0x2e')][_0xee2f('0xaa')]){_0x1bc9d5[_0xee2f('0x9a')]=[{'all':!![]}];}return db[_0xee2f('0xa9')][_0xee2f('0xab')](_0x1bc9d5);})[_0xee2f('0x20')](function(_0x236b63){_0x426e1f['rows']=_0x236b63;return _0x426e1f;});}})[_0xee2f('0x20')](respondWithFilteredResult(_0x2578f1,_0x1bc9d5))[_0xee2f('0x98')](handleError(_0x2578f1,null));};exports[_0xee2f('0xac')]=function(_0x54708b,_0x423ab9,_0x3b95c4){return db[_0xee2f('0x9d')][_0xee2f('0x4a')]({'where':{'id':_0x54708b[_0xee2f('0x9f')]['id']}})[_0xee2f('0x20')](handleEntityNotFound(_0x423ab9,null))[_0xee2f('0x20')](function(_0x3a71fa){if(_0x3a71fa){return _0x3a71fa[_0xee2f('0xad')](_0x54708b[_0xee2f('0x5f')][_0xee2f('0xa2')],_[_0xee2f('0xa3')](_0x54708b['body'],[_0xee2f('0xa2'),'id'])||{})['spread'](function(){return db[_0xee2f('0x59')][_0xee2f('0xab')]({'attributes':['id','name',_0xee2f('0x3a')],'where':{'id':_0x54708b[_0xee2f('0x5f')][_0xee2f('0xa2')]}});})[_0xee2f('0x20')](function(_0x1813f2){socket[_0xee2f('0xae')]('smsInteractionTags:save',{'id':Number(_0x54708b[_0xee2f('0x9f')]['id']),'tags':_0x1813f2||[]});return{'id':Number(_0x54708b[_0xee2f('0x9f')]['id']),'tags':_0x1813f2||[]};});}})[_0xee2f('0x20')](respondWithResult(_0x423ab9,null))[_0xee2f('0x98')](handleError(_0x423ab9,null));};exports[_0xee2f('0xaf')]=function(_0x31b0f7,_0xe86d94,_0xf515ca){return db[_0xee2f('0x9d')][_0xee2f('0x4a')]({'where':{'id':_0x31b0f7['params']['id']}})[_0xee2f('0x20')](handleEntityNotFound(_0xe86d94,null))[_0xee2f('0x20')](function(_0x37ebf7){if(_0x37ebf7){return _0x37ebf7['removeTags'](_0x31b0f7['query'][_0xee2f('0xa2')]);}})[_0xee2f('0x20')](respondWithStatusCode(_0xe86d94,null))[_0xee2f('0x98')](handleError(_0xe86d94,null));};exports[_0xee2f('0xb0')]=function(_0x24a2f1,_0x4a91ca){var _0x1cee16=moment()[_0xee2f('0xb1')]()['toString']();var _0x15e686=path[_0xee2f('0xb2')](config[_0xee2f('0xb3')],_0xee2f('0xb4'),_0xee2f('0xb5'),_0xee2f('0xb6'));var _0x542435=path[_0xee2f('0xb2')](config[_0xee2f('0xb3')],_0xee2f('0xb4'),_0xee2f('0xb5'),_0xee2f('0xb7'));var _0x2b899a=path[_0xee2f('0xb2')](_0x15e686,_0x1cee16);var _0x2bd952=util[_0xee2f('0xa7')](_0xee2f('0xb8'),_0x24a2f1[_0xee2f('0x9f')]['id'],_0x1cee16);var _0x5010eb=path[_0xee2f('0xb2')](_0x15e686,_0x2bd952);var _0x467078=[];_0x467078[_0xee2f('0x28')]({'model':db[_0xee2f('0x5c')],'as':_0xee2f('0x5c'),'attributes':['id',_0xee2f('0x25')],'raw':!![]});_0x467078['push']({'model':db[_0xee2f('0xb9')],'as':_0xee2f('0x50'),'attributes':['id',_0xee2f('0xba'),_0xee2f('0xbb')],'raw':!![]});var _0x4f5554=[{'model':db[_0xee2f('0xa9')],'as':_0xee2f('0xbc'),'attributes':['id',_0xee2f('0x5f'),_0xee2f('0x67'),_0xee2f('0xbd'),_0xee2f('0xbe'),_0xee2f('0x6d')],'include':_0x467078}];_0x4f5554[_0xee2f('0x28')]({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0xee2f('0x22')]});_0x4f5554[_0xee2f('0x28')]({'model':db[_0xee2f('0x5c')],'as':'Owner','attributes':['id',_0xee2f('0x25')]});return db['SmsInteraction'][_0xee2f('0x4a')]({'where':{'id':_0x24a2f1['params']['id']},'include':_0x4f5554})[_0xee2f('0x20')](handleEntityNotFound(_0x4a91ca,null))[_0xee2f('0x20')](function(_0x48ce0c){if(_0x48ce0c){var _0x173a4a=_0x48ce0c['get']({'plain':!![]});fs[_0xee2f('0xbf')](_0x2b899a);var _0x5e1e96={'format':'A4','border':_0xee2f('0xc0'),'header':{'height':_0xee2f('0xc1'),'contents':{'first':_0xee2f('0xc2')}},'footer':{'height':_0xee2f('0xc3'),'contents':{'default':util[_0xee2f('0xa7')]('\x0a\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[_0xee2f('0xa7')](_0xee2f('0xc4'),_0xee2f('0xc5'),_0x173a4a['id']),moment()[_0xee2f('0xa7')](_0xee2f('0xc6'))[_0xee2f('0x83')]())}}};var _0x55f1bd={'channel':_0xee2f('0xc5'),'account':_0x173a4a[_0xee2f('0xc7')][_0xee2f('0x22')],'agent':_0x173a4a['Owner']?_0x173a4a[_0xee2f('0xc8')][_0xee2f('0x25')]:_0xee2f('0xc9'),'createdAt':moment(_0x173a4a[_0xee2f('0x67')])[_0xee2f('0xa7')](_0xee2f('0xa8'))[_0xee2f('0x83')](),'closedAt':_0x173a4a[_0xee2f('0xca')]?moment(_0x173a4a[_0xee2f('0xcb')])[_0xee2f('0xa7')](_0xee2f('0xa8'))[_0xee2f('0x83')]():'','disposition':_0x173a4a['disposition'],'messages':_(_0x173a4a[_0xee2f('0xbc')])['filter']({'secret':![]})[_0xee2f('0x24')](function(_0xb2b9c6){return{'date':moment(_0xb2b9c6['createdAt'])[_0xee2f('0xa7')]('YYYY-MM-DD\x20HH:mm:ss')[_0xee2f('0x83')](),'sender':_0xb2b9c6[_0xee2f('0xbd')]===_0xee2f('0xcc')?_0xb2b9c6[_0xee2f('0x5c')]?_0xb2b9c6['User'][_0xee2f('0x25')]:_0xee2f('0xcd'):_0xb2b9c6[_0xee2f('0x50')][_0xee2f('0xba')]+(_0xb2b9c6[_0xee2f('0x50')][_0xee2f('0xbb')]?'\x20'+_0xb2b9c6['Contact'][_0xee2f('0xbb')]:''),'body':_0xb2b9c6['body'],'direction':_0xb2b9c6[_0xee2f('0xbd')]===_0xee2f('0xcc')?'A':'C','secret':_0xb2b9c6['secret'],'read':_0xb2b9c6[_0xee2f('0x6d')]};})[_0xee2f('0x4c')]()};return ejs['renderFile'](path['join'](config[_0xee2f('0xb3')],_0xee2f('0xb4'),_0xee2f('0xce'),_0xee2f('0xcf')),{'interaction':_0x55f1bd})[_0xee2f('0x20')](function(_0x33182c){return new BPromise(function(_0x50b1a0,_0x2c09b6){pdf['create'](_0x33182c,_0x5e1e96)['toFile'](path['join'](_0x2b899a,_0xee2f('0xd0')+_0x173a4a['id']+'-'+_0x1cee16+'.pdf'),function(_0x1ec84b,_0xb2074f){if(_0x1ec84b)return _0x2c09b6(_0x1ec84b);_0x50b1a0(_0xb2074f);});});})['then'](function(){return new BPromise(function(_0x135a8d,_0x4971c0){zipdir(_0x2b899a,{'saveTo':_0x5010eb},function(_0x1c2faa,_0x3ad2a2){if(_0x1c2faa)return _0x4971c0(_0x1c2faa);return _0x135a8d(_0x3ad2a2);});})[_0xee2f('0x20')](function(){return new BPromise(function(_0x4d2448,_0x30e7bc){rimraf(_0x2b899a,function(_0xf5c9bd){if(_0xf5c9bd)_0x30e7bc(_0xf5c9bd);return _0x4d2448();});});})[_0xee2f('0x20')](function(){return _0x4a91ca[_0xee2f('0xb0')](_0x5010eb,_0x2bd952,function(_0x4753e2){if(_0x4753e2){console[_0xee2f('0xd1')](_0xee2f('0xd2'),_0x4753e2);}else{fs['unlinkSync'](_0x5010eb);}});});});}else{return _0x4a91ca[_0xee2f('0x21')](0xc8);}})[_0xee2f('0x98')](handleError(_0x4a91ca,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index e71adca..c0fe023 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 _0x6921=['exports','../../mysqldb','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x5278d3,_0x3a73e1){var _0x369ad1=function(_0x2caf9c){while(--_0x2caf9c){_0x5278d3['push'](_0x5278d3['shift']());}};_0x369ad1(++_0x3a73e1);}(_0x6921,0x1d1));var _0x1692=function(_0x39f74c,_0x3f3471){_0x39f74c=_0x39f74c-0x0;var _0x2df462=_0x6921[_0x39f74c];return _0x2df462;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x1692('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x1692('0x0'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1692('0x1')](0x0);var events={'afterCreate':_0x1692('0x2'),'afterUpdate':'update','afterDestroy':_0x1692('0x3')};function emitEvent(_0x577497){return function(_0x4581c4,_0x39cc05,_0x15f20e){_0x4581c4[_0x1692('0x4')]({'attributes':['id'],'raw':!![]})[_0x1692('0x5')](function(_0x36d159){_0x4581c4[_0x1692('0x6')](_0x1692('0x7'),_0x36d159[_0x1692('0x8')](function(_0x38159b){return{'id':_0x38159b['id']};}));return SmsMessage[_0x1692('0x9')]({'where':{'SmsInteractionId':_0x4581c4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3dd25c){_0x4581c4['setDataValue'](_0x1692('0xa'),_0x3dd25c[_0x1692('0xb')]);SmsInteractionEvents[_0x1692('0xc')](_0x577497+':'+_0x4581c4['id'],_0x4581c4);SmsInteractionEvents[_0x1692('0xc')](_0x577497,_0x4581c4);_0x15f20e(null);})[_0x1692('0xd')](_0x15f20e(null));};}for(var e in events){if(events[_0x1692('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x1692('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0xac95=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','save','update','getUsers','then','Users','map','findAll','unreadMessages','length'];(function(_0x415d4d,_0x53f5ab){var _0x2a831e=function(_0x2ac48e){while(--_0x2ac48e){_0x415d4d['push'](_0x415d4d['shift']());}};_0x2a831e(++_0x53f5ab);}(_0xac95,0xa8));var _0x5ac9=function(_0x11bcdd,_0x4c04df){_0x11bcdd=_0x11bcdd-0x0;var _0x3a6398=_0xac95[_0x11bcdd];return _0x3a6398;};'use strict';var EventEmitter=require(_0x5ac9('0x0'));var SmsInteraction=require(_0x5ac9('0x1'))['db'][_0x5ac9('0x2')];var SmsMessage=require(_0x5ac9('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ac9('0x3'),'afterUpdate':_0x5ac9('0x4'),'afterDestroy':'remove'};function emitEvent(_0xafa08d){return function(_0x3790d1,_0x5b445a,_0x1dc09a){_0x3790d1[_0x5ac9('0x5')]({'attributes':['id'],'raw':!![]})[_0x5ac9('0x6')](function(_0x4bddcf){_0x3790d1['setDataValue'](_0x5ac9('0x7'),_0x4bddcf[_0x5ac9('0x8')](function(_0x28bc1f){return{'id':_0x28bc1f['id']};}));return SmsMessage[_0x5ac9('0x9')]({'where':{'SmsInteractionId':_0x3790d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5ac9('0x6')](function(_0x5da6fb){_0x3790d1['setDataValue'](_0x5ac9('0xa'),_0x5da6fb[_0x5ac9('0xb')]);SmsInteractionEvents['emit'](_0xafa08d+':'+_0x3790d1['id'],_0x3790d1);SmsInteractionEvents[_0x5ac9('0xc')](_0xafa08d,_0x3790d1);_0x1dc09a(null);})['catch'](_0x1dc09a(null));};}for(var e in events){if(events[_0x5ac9('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5ac9('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 62c38ac..f86be9d 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 _0x788c=['changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction'];(function(_0x20b014,_0x41f545){var _0x312e25=function(_0x4e3498){while(--_0x4e3498){_0x20b014['push'](_0x20b014['shift']());}};_0x312e25(++_0x41f545);}(_0x788c,0x1c6));var _0xc788=function(_0x407a99,_0x2b07a2){_0x407a99=_0x407a99-0x0;var _0x16326e=_0x788c[_0x407a99];return _0x16326e;};'use strict';var _=require('lodash');var util=require(_0xc788('0x0'));var logger=require(_0xc788('0x1'))(_0xc788('0x2'));var moment=require(_0xc788('0x3'));var BPromise=require('bluebird');var rp=require(_0xc788('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc788('0x5'));var config=require(_0xc788('0x6'));var attributes=require(_0xc788('0x7'));module[_0xc788('0x8')]=function(_0x91313,_0x31ba05){return _0x91313[_0xc788('0x9')](_0xc788('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x58f72d,_0x3b821b,_0x26b93f){if(_0x58f72d[_0xc788('0xb')]('closed')){_0x58f72d[_0xc788('0xc')]=moment()[_0xc788('0xd')](_0xc788('0xe'));}_0x26b93f(null,_0x58f72d);}}});}; \ No newline at end of file +var _0x3fe2=['path','rimraf','../../config/environment','./smsInteraction.attributes','define','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','request-promise'];(function(_0x408626,_0x421fc6){var _0x36ef72=function(_0x495f53){while(--_0x495f53){_0x408626['push'](_0x408626['shift']());}};_0x36ef72(++_0x421fc6);}(_0x3fe2,0x109));var _0x23fe=function(_0x1a7fad,_0x265f12){_0x1a7fad=_0x1a7fad-0x0;var _0x377179=_0x3fe2[_0x1a7fad];return _0x377179;};'use strict';var _=require(_0x23fe('0x0'));var util=require(_0x23fe('0x1'));var logger=require(_0x23fe('0x2'))(_0x23fe('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x23fe('0x4'));var fs=require('fs');var path=require(_0x23fe('0x5'));var rimraf=require(_0x23fe('0x6'));var config=require(_0x23fe('0x7'));var attributes=require(_0x23fe('0x8'));module['exports']=function(_0x235573,_0x4fd6fc){return _0x235573[_0x23fe('0x9')]('SmsInteraction',attributes,{'tableName':_0x23fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x23fe96,_0x1994bb,_0x17e5f3){if(_0x23fe96[_0x23fe('0xb')]('closed')){_0x23fe96[_0x23fe('0xc')]=moment()[_0x23fe('0xd')](_0x23fe('0xe'));}_0x17e5f3(null,_0x23fe96);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 7567e2b..b05d579 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 _0xbe38=['error','code','message','result','catch','UpdateSmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','redis','defaults','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5b0375,_0x22a164){var _0x1c0209=function(_0x1d0406){while(--_0x1d0406){_0x5b0375['push'](_0x5b0375['shift']());}};_0x1c0209(++_0x22a164);}(_0xbe38,0xb4));var _0x8be3=function(_0x34b57c,_0x97c5c9){_0x34b57c=_0x34b57c-0x0;var _0x2ac76b=_0xbe38[_0x34b57c];return _0x2ac76b;};'use strict';var _=require(_0x8be3('0x0'));var util=require('util');var moment=require(_0x8be3('0x1'));var BPromise=require(_0x8be3('0x2'));var rs=require(_0x8be3('0x3'));var fs=require('fs');var Redis=require(_0x8be3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8be3('0x5'))(_0x8be3('0x6'));var config=require(_0x8be3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8be3('0x8')]['http']({'port':0x232a});config[_0x8be3('0x9')]=_[_0x8be3('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsInteraction.socket')[_0x8be3('0xb')](socket);function respondWithRpcPromise(_0x2697f1,_0x21aaa2,_0x5e587d){return new BPromise(function(_0x1ad9d1,_0x587c9e){return client[_0x8be3('0xc')](_0x2697f1,_0x5e587d)[_0x8be3('0xd')](function(_0x318c3e){logger[_0x8be3('0xe')](_0x8be3('0xf'),_0x21aaa2,_0x8be3('0x10'));logger[_0x8be3('0x11')](_0x8be3('0x12'),_0x21aaa2,'request\x20sent',JSON[_0x8be3('0x13')](_0x318c3e));if(_0x318c3e[_0x8be3('0x14')]){if(_0x318c3e['error'][_0x8be3('0x15')]===0x1f4){logger[_0x8be3('0x14')](_0x8be3('0xf'),_0x21aaa2,_0x318c3e[_0x8be3('0x14')][_0x8be3('0x16')]);return _0x587c9e(_0x318c3e[_0x8be3('0x14')][_0x8be3('0x16')]);}logger[_0x8be3('0x14')](_0x8be3('0xf'),_0x21aaa2,_0x318c3e[_0x8be3('0x14')][_0x8be3('0x16')]);return _0x1ad9d1(_0x318c3e[_0x8be3('0x14')][_0x8be3('0x16')]);}else{logger[_0x8be3('0xe')](_0x8be3('0xf'),_0x21aaa2,_0x8be3('0x10'));_0x1ad9d1(_0x318c3e[_0x8be3('0x17')][_0x8be3('0x16')]);}})[_0x8be3('0x18')](function(_0x4779f5){logger[_0x8be3('0x14')](_0x8be3('0xf'),_0x21aaa2,_0x4779f5);_0x587c9e(_0x4779f5);});});}exports[_0x8be3('0x19')]=function(_0x3222b1){var _0x5acae2=this;return new Promise(function(_0x3bfcbd,_0x3ef052){return db['SmsInteraction'][_0x8be3('0x1a')](_0x3222b1[_0x8be3('0x1b')],{'raw':_0x3222b1[_0x8be3('0x1c')]?_0x3222b1[_0x8be3('0x1c')][_0x8be3('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3222b1[_0x8be3('0x1c')]?_0x3222b1[_0x8be3('0x1c')][_0x8be3('0x1e')]||null:null,'attributes':_0x3222b1[_0x8be3('0x1c')]?_0x3222b1[_0x8be3('0x1c')][_0x8be3('0x1f')]||null:null,'limit':_0x3222b1[_0x8be3('0x1c')]?_0x3222b1[_0x8be3('0x1c')][_0x8be3('0x20')]||null:null})[_0x8be3('0xd')](function(_0x4c24f3){logger[_0x8be3('0xe')]('UpdateSmsInteraction',_0x3222b1);logger[_0x8be3('0x11')](_0x8be3('0x19'),_0x3222b1,JSON[_0x8be3('0x13')](_0x4c24f3));_0x3bfcbd(_0x4c24f3);})[_0x8be3('0x18')](function(_0x4a2e84){logger[_0x8be3('0x14')](_0x8be3('0x19'),_0x4a2e84['message'],_0x3222b1);_0x3ef052(_0x5acae2['error'](0x1f4,_0x4a2e84['message']));});});};exports[_0x8be3('0x21')]=function(_0x9f8ef1){return new Promise(function(_0x2227d4,_0x1db7b7){return db['SmsInteraction'][_0x8be3('0x22')]({'where':_0x9f8ef1[_0x8be3('0x1c')]?_0x9f8ef1[_0x8be3('0x1c')][_0x8be3('0x1e')]||null:null})[_0x8be3('0xd')](function(_0x114955){if(_0x114955){return _0x114955[_0x8be3('0x23')](_0x9f8ef1['body']['ids'],_[_0x8be3('0x24')](_0x9f8ef1[_0x8be3('0x1b')],[_0x8be3('0x25'),'id'])||{});}})[_0x8be3('0x26')](function(_0x53c678){logger[_0x8be3('0xe')](_0x8be3('0x27'),_0x9f8ef1);logger['debug'](_0x8be3('0x27'),_0x9f8ef1,JSON[_0x8be3('0x13')](_0x53c678));_0x2227d4(_0x53c678);})['catch'](function(_0x368ad5){logger[_0x8be3('0x14')](_0x8be3('0x27'),_0x368ad5['message'],_0x9f8ef1);_0x1db7b7(_this[_0x8be3('0x14')](0x1f4,_0x368ad5[_0x8be3('0x16')]));});});}; \ No newline at end of file +var _0xef46=['request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToSmsInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./smsInteraction.socket','request','then','info'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xef46,0x15c));var _0x6ef4=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xef46[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x6ef4('0x0'));var util=require(_0x6ef4('0x1'));var moment=require(_0x6ef4('0x2'));var BPromise=require(_0x6ef4('0x3'));var rs=require(_0x6ef4('0x4'));var fs=require('fs');var Redis=require(_0x6ef4('0x5'));var db=require(_0x6ef4('0x6'))['db'];var utils=require(_0x6ef4('0x7'));var logger=require(_0x6ef4('0x8'))(_0x6ef4('0x9'));var config=require(_0x6ef4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x6ef4('0xb')][_0x6ef4('0xc')]({'port':0x232a});config[_0x6ef4('0xd')]=_[_0x6ef4('0xe')](config[_0x6ef4('0xd')],{'host':_0x6ef4('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ef4('0xd')]));require(_0x6ef4('0x10'))['register'](socket);function respondWithRpcPromise(_0x99c358,_0x350bc4,_0x343624){return new BPromise(function(_0x4133d8,_0x48ae89){return client[_0x6ef4('0x11')](_0x99c358,_0x343624)[_0x6ef4('0x12')](function(_0x177acd){logger[_0x6ef4('0x13')]('SmsInteraction,\x20%s,\x20%s',_0x350bc4,_0x6ef4('0x14'));logger[_0x6ef4('0x15')](_0x6ef4('0x16'),_0x350bc4,'request\x20sent',JSON['stringify'](_0x177acd));if(_0x177acd[_0x6ef4('0x17')]){if(_0x177acd['error'][_0x6ef4('0x18')]===0x1f4){logger['error'](_0x6ef4('0x19'),_0x350bc4,_0x177acd[_0x6ef4('0x17')][_0x6ef4('0x1a')]);return _0x48ae89(_0x177acd[_0x6ef4('0x17')][_0x6ef4('0x1a')]);}logger[_0x6ef4('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x350bc4,_0x177acd[_0x6ef4('0x17')][_0x6ef4('0x1a')]);return _0x4133d8(_0x177acd[_0x6ef4('0x17')]['message']);}else{logger[_0x6ef4('0x13')](_0x6ef4('0x19'),_0x350bc4,_0x6ef4('0x14'));_0x4133d8(_0x177acd[_0x6ef4('0x1b')]['message']);}})[_0x6ef4('0x1c')](function(_0x20166c){logger[_0x6ef4('0x17')](_0x6ef4('0x19'),_0x350bc4,_0x20166c);_0x48ae89(_0x20166c);});});}exports[_0x6ef4('0x1d')]=function(_0x25842b){var _0x376ad6=this;return new Promise(function(_0x12d7c4,_0x7ef730){return db[_0x6ef4('0x1e')][_0x6ef4('0x1f')](_0x25842b[_0x6ef4('0x20')],{'raw':_0x25842b[_0x6ef4('0x21')]?_0x25842b['options'][_0x6ef4('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25842b[_0x6ef4('0x21')]?_0x25842b[_0x6ef4('0x21')][_0x6ef4('0x23')]||null:null,'attributes':_0x25842b['options']?_0x25842b[_0x6ef4('0x21')][_0x6ef4('0x24')]||null:null,'limit':_0x25842b[_0x6ef4('0x21')]?_0x25842b[_0x6ef4('0x21')][_0x6ef4('0x25')]||null:null})['then'](function(_0xb7d53c){logger[_0x6ef4('0x13')](_0x6ef4('0x1d'),_0x25842b);logger[_0x6ef4('0x15')]('UpdateSmsInteraction',_0x25842b,JSON[_0x6ef4('0x26')](_0xb7d53c));_0x12d7c4(_0xb7d53c);})[_0x6ef4('0x1c')](function(_0x3929ff){logger[_0x6ef4('0x17')]('UpdateSmsInteraction',_0x3929ff[_0x6ef4('0x1a')],_0x25842b);_0x7ef730(_0x376ad6['error'](0x1f4,_0x3929ff[_0x6ef4('0x1a')]));});});};exports[_0x6ef4('0x27')]=function(_0x599e54){return new Promise(function(_0x16ae4a,_0x5e1eba){return db[_0x6ef4('0x1e')][_0x6ef4('0x28')]({'where':_0x599e54[_0x6ef4('0x21')]?_0x599e54[_0x6ef4('0x21')]['where']||null:null})[_0x6ef4('0x12')](function(_0x7be808){if(_0x7be808){return _0x7be808[_0x6ef4('0x29')](_0x599e54[_0x6ef4('0x20')]['ids'],_[_0x6ef4('0x2a')](_0x599e54[_0x6ef4('0x20')],[_0x6ef4('0x2b'),'id'])||{});}})[_0x6ef4('0x2c')](function(_0x4782d3){logger[_0x6ef4('0x13')](_0x6ef4('0x2d'),_0x599e54);logger[_0x6ef4('0x15')](_0x6ef4('0x2d'),_0x599e54,JSON[_0x6ef4('0x26')](_0x4782d3));_0x16ae4a(_0x4782d3);})[_0x6ef4('0x1c')](function(_0x22430c){logger[_0x6ef4('0x17')](_0x6ef4('0x2d'),_0x22430c[_0x6ef4('0x1a')],_0x599e54);_0x5e1eba(_this['error'](0x1f4,_0x22430c[_0x6ef4('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index efb83c9..b568da5 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 _0xbaf0=['removeListener','register','length','smsInteraction:','save','remove','update'];(function(_0x5071b1,_0x1b8b7c){var _0x66cfde=function(_0x20c153){while(--_0x20c153){_0x5071b1['push'](_0x5071b1['shift']());}};_0x66cfde(++_0x1b8b7c);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){SmsInteractionEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);SmsInteractionEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file +var _0xb10b=['emit','removeListener','register','smsInteraction:','./smsInteraction.events','remove','update'];(function(_0x192b7d,_0x3db1eb){var _0x57e19a=function(_0x15287d){while(--_0x15287d){_0x192b7d['push'](_0x192b7d['shift']());}};_0x57e19a(++_0x3db1eb);}(_0xb10b,0x12a));var _0xbb10=function(_0x35b7ba,_0x155c7f){_0x35b7ba=_0x35b7ba-0x0;var _0x25ea5e=_0xb10b[_0x35b7ba];return _0x25ea5e;};'use strict';var SmsInteractionEvents=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(){SmsInteractionEvents[_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);SmsInteractionEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 15102d9..10a27f5 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 _0x459a=['post','tracked','sms','smsmessage:create','create','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/describe','/:id','show'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x459a,0x1cd));var _0xa459=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x459a[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xa459('0x0'));var path=require(_0xa459('0x1'));var timeout=require(_0xa459('0x2'));var express=require(_0xa459('0x3'));var router=express[_0xa459('0x4')]();var auth=require(_0xa459('0x5'));var interaction=require(_0xa459('0x6'));var config=require(_0xa459('0x7'));var controller=require(_0xa459('0x8'));router['get']('/',auth[_0xa459('0x9')](),controller[_0xa459('0xa')]);router[_0xa459('0xb')](_0xa459('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa459('0xd'),auth[_0xa459('0x9')](),controller[_0xa459('0xe')]);router[_0xa459('0xf')]('/',auth['isAuthenticated'](),interaction[_0xa459('0x10')](_0xa459('0x11'),_0xa459('0x12')),controller[_0xa459('0x13')]);router['post']('/:id/status',controller['status']);router[_0xa459('0x14')](_0xa459('0xd'),auth[_0xa459('0x9')](),controller['update']);router[_0xa459('0x14')](_0xa459('0x15'),auth[_0xa459('0x9')](),controller[_0xa459('0x16')]);router['put'](_0xa459('0x17'),auth[_0xa459('0x9')](),controller[_0xa459('0x18')]);router[_0xa459('0x19')](_0xa459('0xd'),auth[_0xa459('0x9')](),controller[_0xa459('0x1a')]);module[_0xa459('0x1b')]=router; \ No newline at end of file +var _0xa7a6=['exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./smsMessage.controller','isAuthenticated','/describe','describe','get','show','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x12ef42,_0x5db436){var _0x5a83d7=function(_0x1757a1){while(--_0x1757a1){_0x12ef42['push'](_0x12ef42['shift']());}};_0x5a83d7(++_0x5db436);}(_0xa7a6,0x196));var _0x6a7a=function(_0x30ad18,_0x5e57f2){_0x30ad18=_0x30ad18-0x0;var _0x5d09a7=_0xa7a6[_0x30ad18];return _0x5d09a7;};'use strict';var multer=require(_0x6a7a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6a7a('0x1'));var express=require('express');var router=express[_0x6a7a('0x2')]();var auth=require(_0x6a7a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6a7a('0x4'));var controller=require(_0x6a7a('0x5'));router['get']('/',auth[_0x6a7a('0x6')](),controller['index']);router['get'](_0x6a7a('0x7'),auth['isAuthenticated'](),controller[_0x6a7a('0x8')]);router[_0x6a7a('0x9')]('/:id',auth[_0x6a7a('0x6')](),controller[_0x6a7a('0xa')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x6a7a('0xb')](_0x6a7a('0xc'),_0x6a7a('0xd')),controller[_0x6a7a('0xe')]);router['post'](_0x6a7a('0xf'),controller[_0x6a7a('0x10')]);router[_0x6a7a('0x11')](_0x6a7a('0x12'),auth[_0x6a7a('0x6')](),controller[_0x6a7a('0x13')]);router[_0x6a7a('0x11')](_0x6a7a('0x14'),auth[_0x6a7a('0x6')](),controller[_0x6a7a('0x15')]);router['put'](_0x6a7a('0x16'),auth[_0x6a7a('0x6')](),controller[_0x6a7a('0x17')]);router[_0x6a7a('0x18')]('/:id',auth[_0x6a7a('0x6')](),controller[_0x6a7a('0x19')]);module[_0x6a7a('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 6159950..9b48985 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 _0xa4de=['BOOLEAN','ENUM','out','STRING','DATE','sequelize','TEXT','medium'];(function(_0x1dcaec,_0x2a4344){var _0x4e9e53=function(_0x3f4388){while(--_0x3f4388){_0x1dcaec['push'](_0x1dcaec['shift']());}};_0x4e9e53(++_0x2a4344);}(_0xa4de,0x17d));var _0xea4d=function(_0x5f3e2b,_0x269bc0){_0x5f3e2b=_0x5f3e2b-0x0;var _0x13b396=_0xa4de[_0x5f3e2b];return _0x13b396;};'use strict';var Sequelize=require(_0xea4d('0x0'));module['exports']={'body':{'type':Sequelize[_0xea4d('0x1')](_0xea4d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xea4d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xea4d('0x4')]('in',_0xea4d('0x5')),'defaultValue':_0xea4d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xea4d('0x6')](0xbe)},'phone':{'type':Sequelize[_0xea4d('0x6')]},'readAt':{'type':Sequelize[_0xea4d('0x7')]},'secret':{'type':Sequelize[_0xea4d('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5909=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x30780e,_0x537b34){var _0x5b9129=function(_0xcf4cd1){while(--_0xcf4cd1){_0x30780e['push'](_0x30780e['shift']());}};_0x5b9129(++_0x537b34);}(_0x5909,0x73));var _0x9590=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x5909[_0x1bb58c];return _0x277586;};'use strict';var Sequelize=require(_0x9590('0x0'));module[_0x9590('0x1')]={'body':{'type':Sequelize[_0x9590('0x2')](_0x9590('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9590('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9590('0x5')]('in',_0x9590('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x9590('0x7')](0xbe)},'phone':{'type':Sequelize[_0x9590('0x7')]},'readAt':{'type':Sequelize[_0x9590('0x8')]},'secret':{'type':Sequelize[_0x9590('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 d147453..7d43461 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 _0x522c=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','redis','defaults','socket.io-emitter','jayson/promise','client','test','Sequelize','ValidationError','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','SmsMessage','rawAttributes','fieldName','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','options','include','findAll','show','filters','includeAll','create','body','update','find','params','describe','sms-interactions','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','AcceptMessage','acceptMessage','interface','SIP/%s','channel','event','accept','EventManager','sms','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','type','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','results','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0xebe00a,_0x3a64c8){var _0x4461a1=function(_0x1ee923){while(--_0x1ee923){_0xebe00a['push'](_0xebe00a['shift']());}};_0x4461a1(++_0x3a64c8);}(_0x522c,0x7b));var _0xc522=function(_0x25e485,_0x52ce1e){_0x25e485=_0x25e485-0x0;var _0x1be5c4=_0x522c[_0x25e485];return _0x1be5c4;};'use strict';var pdf=require(_0xc522('0x0'));var emlformat=require(_0xc522('0x1'));var rimraf=require(_0xc522('0x2'));var zipdir=require(_0xc522('0x3'));var jsonpatch=require(_0xc522('0x4'));var rp=require(_0xc522('0x5'));var moment=require(_0xc522('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc522('0x7'));var util=require(_0xc522('0x8'));var path=require(_0xc522('0x9'));var sox=require(_0xc522('0xa'));var csv=require(_0xc522('0xb'));var ejs=require(_0xc522('0xc'));var fs=require('fs');var _=require(_0xc522('0xd'));var squel=require(_0xc522('0xe'));var crypto=require(_0xc522('0xf'));var jsforce=require(_0xc522('0x10'));var deskjs=require(_0xc522('0x11'));var toCsv=require('to-csv');var querystring=require(_0xc522('0x12'));var Papa=require(_0xc522('0x13'));var Redis=require(_0xc522('0x14'));var authService=require(_0xc522('0x15'));var qs=require(_0xc522('0x16'));var as=require(_0xc522('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc522('0x18'))(_0xc522('0x19'));var utils=require(_0xc522('0x1a'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xc522('0x1b')]=_[_0xc522('0x1c')](config[_0xc522('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xc522('0x1d'))(new Redis(config[_0xc522('0x1b')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0xc522('0x1e'));var client=jayson[_0xc522('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xc522('0x1f')]['http']({'port':0x232a});function checkPasswordPattern(_0x37d2ce,_0x476ac3,_0x5b46f1){if(_0x5b46f1){var _0x30e027=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x30e027[_0xc522('0x20')](_0x476ac3)){return _0x37d2ce;}else{throw new db[(_0xc522('0x21'))][(_0xc522('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 _0x37d2ce;}}function respondWithRpcPromise(_0xd14d79,_0x4cf4a9,_0x593b47,_0x1b4364){return new BPromise(function(_0x129cb1,_0x32e7ac){var _0x47c102=_0x1b4364||client;return _0x47c102[_0xc522('0x23')](_0xd14d79,_0x593b47)['then'](function(_0x5db758){logger[_0xc522('0x24')](_0xc522('0x25'),_0x4cf4a9,_0xc522('0x26'));logger['debug'](_0xc522('0x27'),_0x4cf4a9,_0xc522('0x26'),JSON[_0xc522('0x28')](_0x5db758));if(_0x5db758[_0xc522('0x29')]){if(_0x5db758[_0xc522('0x29')][_0xc522('0x2a')]===0x1f4){logger[_0xc522('0x29')](_0xc522('0x25'),_0x4cf4a9,_0x5db758[_0xc522('0x29')][_0xc522('0x2b')]);return _0x32e7ac(_0x5db758[_0xc522('0x29')][_0xc522('0x2b')]);}logger[_0xc522('0x29')](_0xc522('0x25'),_0x4cf4a9,_0x5db758[_0xc522('0x29')]['message']);return _0x129cb1(_0x5db758[_0xc522('0x29')][_0xc522('0x2b')]);}else{logger[_0xc522('0x24')](_0xc522('0x25'),_0x4cf4a9,_0xc522('0x26'));_0x129cb1(_0x5db758[_0xc522('0x2c')][_0xc522('0x2b')]);}})[_0xc522('0x2d')](function(_0x497e67){logger[_0xc522('0x29')](_0xc522('0x25'),_0x4cf4a9,_0x497e67);_0x32e7ac(_0x497e67);});});}function respondWithStatusCode(_0x3ec584,_0x59d4a4){_0x59d4a4=_0x59d4a4||0xcc;return function(_0x290655){if(_0x290655){return _0x3ec584[_0xc522('0x2e')](_0x59d4a4);}return _0x3ec584[_0xc522('0x2f')](_0x59d4a4)[_0xc522('0x30')]();};}function respondWithResult(_0x20ea6a,_0x43340a){_0x43340a=_0x43340a||0xc8;return function(_0x2ce3f5){if(_0x2ce3f5){return _0x20ea6a[_0xc522('0x2f')](_0x43340a)[_0xc522('0x31')](_0x2ce3f5);}};}function respondWithFilteredResult(_0x5012b2,_0x34a125){return function(_0x17fbd0){if(_0x17fbd0){var _0x505ae9=_0x17fbd0[_0xc522('0x32')],_0x28e942=_0x34a125['offset'],_0xa6cb89=_0x34a125['offset']+_0x34a125[_0xc522('0x33')],_0x2a8eaf;if(_0xa6cb89>=_0x505ae9){_0xa6cb89=_0x505ae9;_0x2a8eaf=0xc8;}else{_0x2a8eaf=0xce;}_0x5012b2[_0xc522('0x2f')](_0x2a8eaf);return _0x5012b2[_0xc522('0x34')](_0xc522('0x35'),_0x28e942+'-'+_0xa6cb89+'/'+_0x505ae9)[_0xc522('0x31')](_0x17fbd0);}return null;};}function patchUpdates(_0x1c999a){return function(_0x49e84d){try{jsonpatch[_0xc522('0x36')](_0x49e84d,_0x1c999a,!![]);}catch(_0x394371){return BPromise[_0xc522('0x37')](_0x394371);}return _0x49e84d[_0xc522('0x38')]();};}function saveUpdates(_0x4c8e11,_0x169859){return function(_0x8f53e0){if(_0x8f53e0){return _0x8f53e0['update'](_0x4c8e11)['then'](function(_0xa20f7b){return _0xa20f7b;});}return null;};}function removeEntity(_0x5b53f5,_0x4ebb80){return function(_0x32ab0d){if(_0x32ab0d){return _0x32ab0d[_0xc522('0x39')]()[_0xc522('0x3a')](function(){_0x5b53f5['status'](0xcc)[_0xc522('0x30')]();});}};}function handleEntityNotFound(_0x13204a,_0x5e649a){return function(_0x495b45){if(!_0x495b45){_0x13204a[_0xc522('0x2e')](0x194);}return _0x495b45;};}function handleError(_0x501da2,_0x345422){_0x345422=_0x345422||0x1f4;return function(_0x580eed){logger[_0xc522('0x29')](_0x580eed[_0xc522('0x3b')]);if(_0x580eed[_0xc522('0x3c')]){delete _0x580eed[_0xc522('0x3c')];}_0x501da2[_0xc522('0x2f')](_0x345422)[_0xc522('0x3d')](_0x580eed);};}exports[_0xc522('0x3e')]=function(_0x229ca7,_0x109bf0){var _0x245748={},_0x263ee0={},_0x172ddc={'count':0x0,'rows':[]};var _0x5f30f2=_['map'](db[_0xc522('0x3f')][_0xc522('0x40')],function(_0xbd46fc){return{'name':_0xbd46fc[_0xc522('0x41')],'type':_0xbd46fc['type'][_0xc522('0x42')]};});_0x263ee0['model']=_[_0xc522('0x43')](_0x5f30f2,_0xc522('0x3c'));_0x263ee0[_0xc522('0x44')]=_[_0xc522('0x45')](_0x229ca7['query']);_0x263ee0['filters']=_[_0xc522('0x46')](_0x263ee0[_0xc522('0x47')],_0x263ee0['query']);_0x245748[_0xc522('0x48')]=_[_0xc522('0x46')](_0x263ee0[_0xc522('0x47')],qs['fields'](_0x229ca7[_0xc522('0x44')][_0xc522('0x49')]));_0x245748[_0xc522('0x48')]=_0x245748[_0xc522('0x48')][_0xc522('0x4a')]?_0x245748['attributes']:_0x263ee0[_0xc522('0x47')];if(!_0x229ca7['query'][_0xc522('0x4b')]('nolimit')){_0x245748[_0xc522('0x33')]=qs[_0xc522('0x33')](_0x229ca7[_0xc522('0x44')][_0xc522('0x33')]);_0x245748[_0xc522('0x4c')]=qs[_0xc522('0x4c')](_0x229ca7[_0xc522('0x44')][_0xc522('0x4c')]);}_0x245748[_0xc522('0x4d')]=qs[_0xc522('0x4e')](_0x229ca7[_0xc522('0x44')][_0xc522('0x4e')]);_0x245748[_0xc522('0x4f')]=qs['filters'](_[_0xc522('0x50')](_0x229ca7['query'],_0x263ee0['filters']));if(_0x229ca7['query'][_0xc522('0x51')]){_0x245748[_0xc522('0x4f')]=_['merge'](_0x245748[_0xc522('0x4f')],{'$or':_[_0xc522('0x43')](_0x5f30f2,function(_0x108c72){if(_0x108c72['type']!=='VIRTUAL'){var _0x580719={};_0x580719[_0x108c72['name']]={'$like':'%'+_0x229ca7['query'][_0xc522('0x51')]+'%'};return _0x580719;}})});}_0x245748=_[_0xc522('0x52')]({},_0x245748,_0x229ca7[_0xc522('0x53')]);var _0x5d7077={'where':_0x245748[_0xc522('0x4f')]};return db['SmsMessage'][_0xc522('0x32')](_0x5d7077)['then'](function(_0x22b0b3){_0x172ddc['count']=_0x22b0b3;if(_0x229ca7[_0xc522('0x44')]['includeAll']){_0x245748[_0xc522('0x54')]=[{'all':!![]}];}return db[_0xc522('0x3f')][_0xc522('0x55')](_0x245748);})[_0xc522('0x3a')](function(_0x48d7bc){_0x172ddc['rows']=_0x48d7bc;return _0x172ddc;})['then'](respondWithFilteredResult(_0x109bf0,_0x245748))[_0xc522('0x2d')](handleError(_0x109bf0,null));};exports[_0xc522('0x56')]=function(_0x122c2a,_0x4616f0){var _0x4608ae={'raw':!![],'where':{'id':_0x122c2a['params']['id']}},_0x2a811c={};_0x2a811c[_0xc522('0x47')]=_[_0xc522('0x45')](db['SmsMessage'][_0xc522('0x40')]);_0x2a811c[_0xc522('0x44')]=_[_0xc522('0x45')](_0x122c2a[_0xc522('0x44')]);_0x2a811c[_0xc522('0x57')]=_[_0xc522('0x46')](_0x2a811c[_0xc522('0x47')],_0x2a811c[_0xc522('0x44')]);_0x4608ae[_0xc522('0x48')]=_['intersection'](_0x2a811c[_0xc522('0x47')],qs[_0xc522('0x49')](_0x122c2a[_0xc522('0x44')]['fields']));_0x4608ae[_0xc522('0x48')]=_0x4608ae[_0xc522('0x48')][_0xc522('0x4a')]?_0x4608ae['attributes']:_0x2a811c[_0xc522('0x47')];if(_0x122c2a[_0xc522('0x44')][_0xc522('0x58')]){_0x4608ae[_0xc522('0x54')]=[{'all':!![]}];}_0x4608ae=_[_0xc522('0x52')]({},_0x4608ae,_0x122c2a[_0xc522('0x53')]);return db[_0xc522('0x3f')]['find'](_0x4608ae)[_0xc522('0x3a')](handleEntityNotFound(_0x4616f0,null))['then'](respondWithResult(_0x4616f0,null))[_0xc522('0x2d')](handleError(_0x4616f0,null));};exports[_0xc522('0x59')]=function(_0x504688,_0x31f6cc){return db['SmsMessage']['create'](_0x504688[_0xc522('0x5a')],{})[_0xc522('0x3a')](respondWithResult(_0x31f6cc,0xc9))[_0xc522('0x2d')](handleError(_0x31f6cc,null));};exports[_0xc522('0x5b')]=function(_0x23b92b,_0x3f9847){if(_0x23b92b[_0xc522('0x5a')]['id']){delete _0x23b92b['body']['id'];}return db['SmsMessage'][_0xc522('0x5c')]({'where':{'id':_0x23b92b[_0xc522('0x5d')]['id']}})[_0xc522('0x3a')](handleEntityNotFound(_0x3f9847,null))[_0xc522('0x3a')](saveUpdates(_0x23b92b[_0xc522('0x5a')],null))[_0xc522('0x3a')](respondWithResult(_0x3f9847,null))[_0xc522('0x2d')](handleError(_0x3f9847,null));};exports[_0xc522('0x39')]=function(_0x299cf1,_0x2fbba5){return db[_0xc522('0x3f')][_0xc522('0x5c')]({'where':{'id':_0x299cf1[_0xc522('0x5d')]['id']}})[_0xc522('0x3a')](handleEntityNotFound(_0x2fbba5,null))[_0xc522('0x3a')](removeEntity(_0x2fbba5,null))[_0xc522('0x2d')](handleError(_0x2fbba5,null));};exports[_0xc522('0x5e')]=function(_0x283b5c,_0x3a7c57){return db['SmsMessage']['describe']()[_0xc522('0x3a')](respondWithResult(_0x3a7c57,null))['catch'](handleError(_0x3a7c57,null));};var interaction_log=require(_0xc522('0x18'))(_0xc522('0x5f'));exports['accept']=function(_0x40e661,_0x5a19f4,_0x3adb20){var _0x493264={'channel':'sms'};if(_0x40e661[_0xc522('0x5a')]['id']){delete _0x40e661[_0xc522('0x5a')]['id'];}_0x40e661[_0xc522('0x5a')][_0xc522('0x60')]=!![];_0x40e661['body'][_0xc522('0x61')]=moment()['format'](_0xc522('0x62'));_0x40e661[_0xc522('0x5a')][_0xc522('0x63')]=_0x40e661[_0xc522('0x5a')][_0xc522('0x63')]||_0x40e661[_0xc522('0x64')]['id'];return db[_0xc522('0x3f')]['find']({'where':{'id':_0x40e661[_0xc522('0x5d')]['id'],'UserId':null},'include':[{'model':db[_0xc522('0x65')],'as':_0xc522('0x66')}]})[_0xc522('0x3a')](handleEntityNotFound(_0x5a19f4,null))[_0xc522('0x3a')](saveUpdates(_0x40e661[_0xc522('0x5a')],null))['then'](function(_0xba0764){if(_0xba0764){_0x493264['message']=_0xba0764[_0xc522('0x67')]({'plain':!![]});return db[_0xc522('0x68')][_0xc522('0x5c')]({'where':{'id':_0xba0764[_0xc522('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x5a19f4,null))[_0xc522('0x3a')](function(_0x2ea07c){if(_0x2ea07c){return _0x2ea07c[_0xc522('0x5b')]({'UserId':_0x40e661[_0xc522('0x5a')][_0xc522('0x63')],'read1stAt':_[_0xc522('0x6a')](_0x2ea07c[_0xc522('0x6b')])?moment()[_0xc522('0x6c')](_0xc522('0x62')):undefined});}return null;})['then'](function(_0x50db7b){if(_0x50db7b){_0x493264['interaction']=_0x50db7b[_0xc522('0x67')]({'plain':!![]});interaction_log[_0xc522('0x24')](_0xc522('0x6d'),_0x40e661['user']['id'],_0x40e661[_0xc522('0x64')][_0xc522('0x3c')],_0x40e661[_0xc522('0x64')]['role'],_0x493264[_0xc522('0x6e')]['id'],_0x40e661[_0xc522('0x5a')]?JSON['stringify'](_0x40e661['body']):_0xc522('0x6f'));return respondWithRpcPromise(_0xc522('0x70'),_0xc522('0x71'),_0x493264);}return null;})['then'](function(_0xfafb3d){if(_0xfafb3d){if(_0x40e661[_0xc522('0x5a')]['manual']){_0x493264[_0xc522('0x2b')][_0xc522('0x72')]=util[_0xc522('0x6c')](_0xc522('0x73'),_0x40e661[_0xc522('0x64')]['name']);_0x493264[_0xc522('0x2b')][_0xc522('0x74')]=_0x493264[_0xc522('0x74')];_0x493264[_0xc522('0x2b')][_0xc522('0x75')]=_0xc522('0x76');return respondWithRpcPromise('EventManager',_0xc522('0x77'),{'event':'acceptmessage','message':_0x493264[_0xc522('0x2b')]},client9002)[_0xc522('0x3a')](function(){return _0x493264;});}return _0x493264;}return null;})[_0xc522('0x3a')](respondWithResult(_0x5a19f4,null))[_0xc522('0x2d')](handleError(_0x5a19f4,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xc522('0x37')]=function(_0x1b2097,_0xf18848,_0x3d5805){var _0x35d1a9={'agent':{},'channel':_0xc522('0x78')};if(_0x1b2097[_0xc522('0x5a')]['id']){delete _0x1b2097['body']['id'];}_0x1b2097[_0xc522('0x5a')][_0xc522('0x63')]=_0x1b2097['body'][_0xc522('0x63')]||_0x1b2097[_0xc522('0x64')]['id'];_0x35d1a9[_0xc522('0x79')]['id']=_0x1b2097[_0xc522('0x5a')]['UserId'];return db[_0xc522('0x3f')][_0xc522('0x5c')]({'where':{'id':_0x1b2097[_0xc522('0x5d')]['id'],'UserId':null}})[_0xc522('0x3a')](handleEntityNotFound(_0xf18848,null))[_0xc522('0x3a')](function(_0x3f2248){if(_0x3f2248){_0x35d1a9[_0xc522('0x2b')]=_0x3f2248[_0xc522('0x67')]({'plain':!![]});return db[_0xc522('0x68')][_0xc522('0x5c')]({'where':{'id':_0x3f2248[_0xc522('0x69')]}});}return null;})['then'](handleEntityNotFound(_0xf18848,null))[_0xc522('0x3a')](function(_0x4c803d){if(_0x4c803d){_0x35d1a9[_0xc522('0x6e')]=_0x4c803d['get']({'plain':!![]});interaction_log[_0xc522('0x24')](_0xc522('0x7a'),_0x1b2097[_0xc522('0x64')]['id'],_0x1b2097[_0xc522('0x64')][_0xc522('0x3c')],_0x1b2097['user']['role'],_0x35d1a9[_0xc522('0x6e')]['id'],_0x1b2097[_0xc522('0x5a')]?JSON[_0xc522('0x28')](_0x1b2097[_0xc522('0x5a')]):_0xc522('0x6f'));return respondWithRpcPromise(_0xc522('0x7b'),'rejectMessage',_0x35d1a9);}return null;})[_0xc522('0x3a')](function(_0x3a8d58){if(_0x3a8d58){_0x3a8d58[_0xc522('0x2b')][_0xc522('0x72')]=util[_0xc522('0x6c')](_0xc522('0x73'),_0x1b2097[_0xc522('0x64')][_0xc522('0x3c')]);_0x3a8d58[_0xc522('0x2b')][_0xc522('0x74')]=_0x35d1a9['channel'];_0x3a8d58[_0xc522('0x2b')][_0xc522('0x75')]=_0xc522('0x37');respondWithRpcPromise(_0xc522('0x77'),'EventManager',{'event':_0xc522('0x7c'),'message':_0x3a8d58['message']},client9002);return _0x35d1a9;}return null;})[_0xc522('0x3a')](respondWithResult(_0xf18848,null))[_0xc522('0x2d')](handleError(_0xf18848,null));};exports[_0xc522('0x2f')]=function(_0x590c17,_0x742e62,_0x2ca4f0){if(_0x590c17[_0xc522('0x5a')]['id']){delete _0x590c17[_0xc522('0x5a')]['id'];}var _0x26c177;return db['SmsMessage'][_0xc522('0x5c')]({'where':{'id':_0x590c17[_0xc522('0x5d')]['id']}})[_0xc522('0x3a')](handleEntityNotFound(_0x742e62,null))['then'](function(_0x3dcb04){if(_0x3dcb04){_0x26c177=_0x3dcb04;return db['SmsAccount']['find']({'where':{'id':_0x3dcb04[_0xc522('0x7d')]}});}})[_0xc522('0x3a')](handleEntityNotFound(_0x742e62,null))[_0xc522('0x3a')](function(_0x1a8340){if(_0x1a8340){logger['debug'](_0xc522('0x27'),_0xc522('0x2f'),_0xc522('0x7e'),_0x1a8340[_0xc522('0x7f')],util[_0xc522('0x80')](_0x590c17[_0xc522('0x5a')],{'showHidden':![],'depth':null}));switch(_0x1a8340[_0xc522('0x7f')]){case _0xc522('0x81'):if(_0x590c17[_0xc522('0x5a')][_0xc522('0x82')]&&_0x590c17[_0xc522('0x5a')][_0xc522('0x82')]===_0x26c177[_0xc522('0x83')]){return _0x26c177[_0xc522('0x5b')]({'read':!![]});}else{logger[_0xc522('0x29')](_0xc522('0x84'),_0xc522('0x2f'),_0xc522('0x81'),util[_0xc522('0x80')](_0x590c17['body'],{'showHidden':![],'depth':null}));}break;case _0xc522('0x85'):if(_0x590c17['body'][_0xc522('0x86')]&&_0x590c17['body']['MessageUUID']===_0x26c177[_0xc522('0x83')]&&_[_0xc522('0x87')]([_0xc522('0x88'),'delivered'],_0x590c17[_0xc522('0x5a')][_0xc522('0x89')])>=0x0){return _0x26c177[_0xc522('0x5b')]({'read':!![]});}else{logger[_0xc522('0x29')](_0xc522('0x84'),_0xc522('0x2f'),_0xc522('0x8a'),util[_0xc522('0x80')](_0x590c17[_0xc522('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xc522('0x8b'):var _0x34d34d=_0x590c17[_0xc522('0x5a')][_0xc522('0x8c')][0x0];if(_0x34d34d['status'][_0xc522('0x8d')]===_0xc522('0x8e')){return _0x26c177[_0xc522('0x5b')]({'read':!![]});}else{logger['error'](_0xc522('0x84'),'status',_0xc522('0x8b'),util['inspect'](_0x590c17[_0xc522('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x26c177;}})[_0xc522('0x3a')](respondWithResult(_0x742e62,null))[_0xc522('0x2d')](handleError(_0x742e62,null));}; \ No newline at end of file +var _0x9489=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','redis','./smsMessage.socket','register','jayson/promise','client','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','SmsMessage','count','include','rows','show','includeAll','find','create','body','params','describe','sms-interactions','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','acceptMessage','interface','channel','accept','EventManager','acceptmessage','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','event','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','groupName','eml-format'];(function(_0x5783ca,_0x5c2fbd){var _0x1fca68=function(_0x21aa00){while(--_0x21aa00){_0x5783ca['push'](_0x5783ca['shift']());}};_0x1fca68(++_0x5c2fbd);}(_0x9489,0x10b));var _0x9948=function(_0x48c733,_0x165f2b){_0x48c733=_0x48c733-0x0;var _0x3eacfb=_0x9489[_0x48c733];return _0x3eacfb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9948('0x0'));var rimraf=require(_0x9948('0x1'));var zipdir=require(_0x9948('0x2'));var jsonpatch=require(_0x9948('0x3'));var rp=require(_0x9948('0x4'));var moment=require(_0x9948('0x5'));var BPromise=require(_0x9948('0x6'));var Mustache=require(_0x9948('0x7'));var util=require(_0x9948('0x8'));var path=require(_0x9948('0x9'));var sox=require(_0x9948('0xa'));var csv=require(_0x9948('0xb'));var ejs=require(_0x9948('0xc'));var fs=require('fs');var _=require(_0x9948('0xd'));var squel=require(_0x9948('0xe'));var crypto=require('crypto');var jsforce=require(_0x9948('0xf'));var deskjs=require(_0x9948('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9948('0x11'));var authService=require(_0x9948('0x12'));var qs=require(_0x9948('0x13'));var as=require(_0x9948('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9948('0x15'))('api');var utils=require(_0x9948('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x9948('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9948('0x17')]));require(_0x9948('0x18'))[_0x9948('0x19')](socket);var jayson=require(_0x9948('0x1a'));var client=jayson[_0x9948('0x1b')]['http']({'port':0x232c});var client9002=jayson[_0x9948('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x2cb141,_0x5c5931,_0x5c854e){if(_0x5c854e){var _0x3ab431=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3ab431[_0x9948('0x1c')](_0x5c5931)){return _0x2cb141;}else{throw new db['Sequelize'][(_0x9948('0x1d'))](_0x9948('0x1e'));}}else{return _0x2cb141;}}function respondWithRpcPromise(_0x3c82b0,_0x1d2d4a,_0x56f2b2,_0x3b8ea0){return new BPromise(function(_0x54fc9a,_0x8cf4d7){var _0x4174a1=_0x3b8ea0||client;return _0x4174a1['request'](_0x3c82b0,_0x56f2b2)['then'](function(_0x3c62a0){logger[_0x9948('0x1f')](_0x9948('0x20'),_0x1d2d4a,_0x9948('0x21'));logger[_0x9948('0x22')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1d2d4a,_0x9948('0x21'),JSON['stringify'](_0x3c62a0));if(_0x3c62a0[_0x9948('0x23')]){if(_0x3c62a0[_0x9948('0x23')]['code']===0x1f4){logger[_0x9948('0x23')]('SmsMessage,\x20%s,\x20%s',_0x1d2d4a,_0x3c62a0[_0x9948('0x23')][_0x9948('0x24')]);return _0x8cf4d7(_0x3c62a0[_0x9948('0x23')][_0x9948('0x24')]);}logger[_0x9948('0x23')](_0x9948('0x20'),_0x1d2d4a,_0x3c62a0[_0x9948('0x23')]['message']);return _0x54fc9a(_0x3c62a0[_0x9948('0x23')][_0x9948('0x24')]);}else{logger[_0x9948('0x1f')](_0x9948('0x20'),_0x1d2d4a,'request\x20sent');_0x54fc9a(_0x3c62a0[_0x9948('0x25')]['message']);}})[_0x9948('0x26')](function(_0x1a30e6){logger[_0x9948('0x23')](_0x9948('0x20'),_0x1d2d4a,_0x1a30e6);_0x8cf4d7(_0x1a30e6);});});}function respondWithStatusCode(_0x50b6e1,_0x516452){_0x516452=_0x516452||0xcc;return function(_0x52c173){if(_0x52c173){return _0x50b6e1[_0x9948('0x27')](_0x516452);}return _0x50b6e1['status'](_0x516452)[_0x9948('0x28')]();};}function respondWithResult(_0x57723f,_0x407a3f){_0x407a3f=_0x407a3f||0xc8;return function(_0x59ca06){if(_0x59ca06){return _0x57723f[_0x9948('0x29')](_0x407a3f)[_0x9948('0x2a')](_0x59ca06);}};}function respondWithFilteredResult(_0x1f3147,_0x5e80a5){return function(_0x332470){if(_0x332470){var _0x11c84f=_0x332470['count'],_0x1f4a14=_0x5e80a5[_0x9948('0x2b')],_0x2efb4d=_0x5e80a5[_0x9948('0x2b')]+_0x5e80a5[_0x9948('0x2c')],_0x5c42e1;if(_0x2efb4d>=_0x11c84f){_0x2efb4d=_0x11c84f;_0x5c42e1=0xc8;}else{_0x5c42e1=0xce;}_0x1f3147['status'](_0x5c42e1);return _0x1f3147[_0x9948('0x2d')](_0x9948('0x2e'),_0x1f4a14+'-'+_0x2efb4d+'/'+_0x11c84f)['json'](_0x332470);}return null;};}function patchUpdates(_0x33e637){return function(_0x3896aa){try{jsonpatch[_0x9948('0x2f')](_0x3896aa,_0x33e637,!![]);}catch(_0x4e3083){return BPromise[_0x9948('0x30')](_0x4e3083);}return _0x3896aa[_0x9948('0x31')]();};}function saveUpdates(_0x6967e4,_0x57d068){return function(_0x5c1933){if(_0x5c1933){return _0x5c1933[_0x9948('0x32')](_0x6967e4)['then'](function(_0x124d16){return _0x124d16;});}return null;};}function removeEntity(_0x3734a5,_0x2613ce){return function(_0x35409a){if(_0x35409a){return _0x35409a[_0x9948('0x33')]()[_0x9948('0x34')](function(){_0x3734a5[_0x9948('0x29')](0xcc)[_0x9948('0x28')]();});}};}function handleEntityNotFound(_0x1ed87f,_0x353404){return function(_0x2d2450){if(!_0x2d2450){_0x1ed87f['sendStatus'](0x194);}return _0x2d2450;};}function handleError(_0x557819,_0x90d3b2){_0x90d3b2=_0x90d3b2||0x1f4;return function(_0x2bf725){logger['error'](_0x2bf725['stack']);if(_0x2bf725[_0x9948('0x35')]){delete _0x2bf725[_0x9948('0x35')];}_0x557819[_0x9948('0x29')](_0x90d3b2)[_0x9948('0x36')](_0x2bf725);};}exports[_0x9948('0x37')]=function(_0x315b84,_0x2c0b6a){var _0x260981={},_0x5a792a={},_0x29c740={'count':0x0,'rows':[]};var _0x29af91=_[_0x9948('0x38')](db['SmsMessage']['rawAttributes'],function(_0xc503f8){return{'name':_0xc503f8['fieldName'],'type':_0xc503f8[_0x9948('0x39')][_0x9948('0x3a')]};});_0x5a792a[_0x9948('0x3b')]=_['map'](_0x29af91,_0x9948('0x35'));_0x5a792a[_0x9948('0x3c')]=_[_0x9948('0x3d')](_0x315b84['query']);_0x5a792a[_0x9948('0x3e')]=_[_0x9948('0x3f')](_0x5a792a['model'],_0x5a792a[_0x9948('0x3c')]);_0x260981[_0x9948('0x40')]=_['intersection'](_0x5a792a[_0x9948('0x3b')],qs[_0x9948('0x41')](_0x315b84[_0x9948('0x3c')][_0x9948('0x41')]));_0x260981[_0x9948('0x40')]=_0x260981['attributes'][_0x9948('0x42')]?_0x260981[_0x9948('0x40')]:_0x5a792a[_0x9948('0x3b')];if(!_0x315b84[_0x9948('0x3c')]['hasOwnProperty'](_0x9948('0x43'))){_0x260981['limit']=qs[_0x9948('0x2c')](_0x315b84['query'][_0x9948('0x2c')]);_0x260981['offset']=qs[_0x9948('0x2b')](_0x315b84[_0x9948('0x3c')][_0x9948('0x2b')]);}_0x260981[_0x9948('0x44')]=qs[_0x9948('0x45')](_0x315b84[_0x9948('0x3c')]['sort']);_0x260981['where']=qs[_0x9948('0x3e')](_[_0x9948('0x46')](_0x315b84[_0x9948('0x3c')],_0x5a792a[_0x9948('0x3e')]));if(_0x315b84['query'][_0x9948('0x47')]){_0x260981[_0x9948('0x48')]=_['merge'](_0x260981['where'],{'$or':_[_0x9948('0x38')](_0x29af91,function(_0x4fe9d8){if(_0x4fe9d8[_0x9948('0x39')]!=='VIRTUAL'){var _0xa2fbcc={};_0xa2fbcc[_0x4fe9d8[_0x9948('0x35')]]={'$like':'%'+_0x315b84[_0x9948('0x3c')]['filter']+'%'};return _0xa2fbcc;}})});}_0x260981=_[_0x9948('0x49')]({},_0x260981,_0x315b84[_0x9948('0x4a')]);var _0x34fb66={'where':_0x260981[_0x9948('0x48')]};return db[_0x9948('0x4b')]['count'](_0x34fb66)[_0x9948('0x34')](function(_0x1e2a34){_0x29c740[_0x9948('0x4c')]=_0x1e2a34;if(_0x315b84[_0x9948('0x3c')]['includeAll']){_0x260981[_0x9948('0x4d')]=[{'all':!![]}];}return db[_0x9948('0x4b')]['findAll'](_0x260981);})[_0x9948('0x34')](function(_0x36edd8){_0x29c740[_0x9948('0x4e')]=_0x36edd8;return _0x29c740;})[_0x9948('0x34')](respondWithFilteredResult(_0x2c0b6a,_0x260981))[_0x9948('0x26')](handleError(_0x2c0b6a,null));};exports[_0x9948('0x4f')]=function(_0x4055cc,_0x46d702){var _0x49ef8c={'raw':!![],'where':{'id':_0x4055cc['params']['id']}},_0x3f0940={};_0x3f0940[_0x9948('0x3b')]=_[_0x9948('0x3d')](db[_0x9948('0x4b')]['rawAttributes']);_0x3f0940[_0x9948('0x3c')]=_[_0x9948('0x3d')](_0x4055cc[_0x9948('0x3c')]);_0x3f0940[_0x9948('0x3e')]=_[_0x9948('0x3f')](_0x3f0940[_0x9948('0x3b')],_0x3f0940['query']);_0x49ef8c[_0x9948('0x40')]=_['intersection'](_0x3f0940[_0x9948('0x3b')],qs[_0x9948('0x41')](_0x4055cc[_0x9948('0x3c')][_0x9948('0x41')]));_0x49ef8c[_0x9948('0x40')]=_0x49ef8c[_0x9948('0x40')]['length']?_0x49ef8c[_0x9948('0x40')]:_0x3f0940[_0x9948('0x3b')];if(_0x4055cc['query'][_0x9948('0x50')]){_0x49ef8c[_0x9948('0x4d')]=[{'all':!![]}];}_0x49ef8c=_[_0x9948('0x49')]({},_0x49ef8c,_0x4055cc[_0x9948('0x4a')]);return db[_0x9948('0x4b')][_0x9948('0x51')](_0x49ef8c)[_0x9948('0x34')](handleEntityNotFound(_0x46d702,null))[_0x9948('0x34')](respondWithResult(_0x46d702,null))[_0x9948('0x26')](handleError(_0x46d702,null));};exports[_0x9948('0x52')]=function(_0xc672fc,_0x32195c){return db[_0x9948('0x4b')][_0x9948('0x52')](_0xc672fc[_0x9948('0x53')],{})[_0x9948('0x34')](respondWithResult(_0x32195c,0xc9))[_0x9948('0x26')](handleError(_0x32195c,null));};exports[_0x9948('0x32')]=function(_0x44e90a,_0x570598){if(_0x44e90a[_0x9948('0x53')]['id']){delete _0x44e90a[_0x9948('0x53')]['id'];}return db[_0x9948('0x4b')]['find']({'where':{'id':_0x44e90a[_0x9948('0x54')]['id']}})[_0x9948('0x34')](handleEntityNotFound(_0x570598,null))[_0x9948('0x34')](saveUpdates(_0x44e90a[_0x9948('0x53')],null))[_0x9948('0x34')](respondWithResult(_0x570598,null))['catch'](handleError(_0x570598,null));};exports[_0x9948('0x33')]=function(_0x237501,_0x10711a){return db['SmsMessage']['find']({'where':{'id':_0x237501[_0x9948('0x54')]['id']}})[_0x9948('0x34')](handleEntityNotFound(_0x10711a,null))[_0x9948('0x34')](removeEntity(_0x10711a,null))[_0x9948('0x26')](handleError(_0x10711a,null));};exports[_0x9948('0x55')]=function(_0x5ac914,_0x493f14){return db['SmsMessage'][_0x9948('0x55')]()[_0x9948('0x34')](respondWithResult(_0x493f14,null))[_0x9948('0x26')](handleError(_0x493f14,null));};var interaction_log=require(_0x9948('0x15'))(_0x9948('0x56'));exports['accept']=function(_0x357c15,_0x4eb314,_0x39f5b4){var _0x5a488d={'channel':_0x9948('0x57')};if(_0x357c15[_0x9948('0x53')]['id']){delete _0x357c15[_0x9948('0x53')]['id'];}_0x357c15[_0x9948('0x53')][_0x9948('0x58')]=!![];_0x357c15[_0x9948('0x53')][_0x9948('0x59')]=moment()['format'](_0x9948('0x5a'));_0x357c15[_0x9948('0x53')][_0x9948('0x5b')]=_0x357c15[_0x9948('0x53')][_0x9948('0x5b')]||_0x357c15[_0x9948('0x5c')]['id'];return db[_0x9948('0x4b')][_0x9948('0x51')]({'where':{'id':_0x357c15[_0x9948('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x9948('0x5d')],'as':_0x9948('0x5e')}]})[_0x9948('0x34')](handleEntityNotFound(_0x4eb314,null))[_0x9948('0x34')](saveUpdates(_0x357c15[_0x9948('0x53')],null))['then'](function(_0x420313){if(_0x420313){_0x5a488d[_0x9948('0x24')]=_0x420313[_0x9948('0x5f')]({'plain':!![]});return db[_0x9948('0x60')][_0x9948('0x51')]({'where':{'id':_0x420313[_0x9948('0x61')]}});}return null;})[_0x9948('0x34')](handleEntityNotFound(_0x4eb314,null))['then'](function(_0x449e18){if(_0x449e18){return _0x449e18[_0x9948('0x32')]({'UserId':_0x357c15[_0x9948('0x53')][_0x9948('0x5b')],'read1stAt':_['isNil'](_0x449e18[_0x9948('0x62')])?moment()[_0x9948('0x63')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x138ce5){if(_0x138ce5){_0x5a488d[_0x9948('0x64')]=_0x138ce5[_0x9948('0x5f')]({'plain':!![]});interaction_log[_0x9948('0x1f')](_0x9948('0x65'),_0x357c15['user']['id'],_0x357c15[_0x9948('0x5c')]['name'],_0x357c15[_0x9948('0x5c')][_0x9948('0x66')],_0x5a488d[_0x9948('0x64')]['id'],_0x357c15[_0x9948('0x53')]?JSON[_0x9948('0x67')](_0x357c15[_0x9948('0x53')]):_0x9948('0x68'));return respondWithRpcPromise('AcceptMessage',_0x9948('0x69'),_0x5a488d);}return null;})[_0x9948('0x34')](function(_0x3d63ae){if(_0x3d63ae){if(_0x357c15[_0x9948('0x53')]['manual']){_0x5a488d['message'][_0x9948('0x6a')]=util[_0x9948('0x63')]('SIP/%s',_0x357c15['user'][_0x9948('0x35')]);_0x5a488d[_0x9948('0x24')][_0x9948('0x6b')]=_0x5a488d[_0x9948('0x6b')];_0x5a488d['message']['event']=_0x9948('0x6c');return respondWithRpcPromise('EventManager',_0x9948('0x6d'),{'event':_0x9948('0x6e'),'message':_0x5a488d[_0x9948('0x24')]},client9002)[_0x9948('0x34')](function(){return _0x5a488d;});}return _0x5a488d;}return null;})['then'](respondWithResult(_0x4eb314,null))[_0x9948('0x26')](handleError(_0x4eb314,null));};var interaction_log=require(_0x9948('0x15'))(_0x9948('0x56'));exports[_0x9948('0x30')]=function(_0x29c6d5,_0x389fd3,_0x4e04d2){var _0x4562d3={'agent':{},'channel':_0x9948('0x57')};if(_0x29c6d5[_0x9948('0x53')]['id']){delete _0x29c6d5[_0x9948('0x53')]['id'];}_0x29c6d5['body'][_0x9948('0x5b')]=_0x29c6d5[_0x9948('0x53')]['UserId']||_0x29c6d5['user']['id'];_0x4562d3[_0x9948('0x6f')]['id']=_0x29c6d5[_0x9948('0x53')][_0x9948('0x5b')];return db['SmsMessage'][_0x9948('0x51')]({'where':{'id':_0x29c6d5[_0x9948('0x54')]['id'],'UserId':null}})[_0x9948('0x34')](handleEntityNotFound(_0x389fd3,null))[_0x9948('0x34')](function(_0x567388){if(_0x567388){_0x4562d3[_0x9948('0x24')]=_0x567388[_0x9948('0x5f')]({'plain':!![]});return db[_0x9948('0x60')][_0x9948('0x51')]({'where':{'id':_0x567388[_0x9948('0x61')]}});}return null;})['then'](handleEntityNotFound(_0x389fd3,null))[_0x9948('0x34')](function(_0x3ec56e){if(_0x3ec56e){_0x4562d3[_0x9948('0x64')]=_0x3ec56e['get']({'plain':!![]});interaction_log[_0x9948('0x1f')](_0x9948('0x70'),_0x29c6d5[_0x9948('0x5c')]['id'],_0x29c6d5[_0x9948('0x5c')]['name'],_0x29c6d5['user'][_0x9948('0x66')],_0x4562d3['interaction']['id'],_0x29c6d5[_0x9948('0x53')]?JSON[_0x9948('0x67')](_0x29c6d5[_0x9948('0x53')]):_0x9948('0x68'));return respondWithRpcPromise('RejectMessage',_0x9948('0x71'),_0x4562d3);}return null;})[_0x9948('0x34')](function(_0x366599){if(_0x366599){_0x366599[_0x9948('0x24')][_0x9948('0x6a')]=util[_0x9948('0x63')](_0x9948('0x72'),_0x29c6d5['user'][_0x9948('0x35')]);_0x366599[_0x9948('0x24')]['channel']=_0x4562d3[_0x9948('0x6b')];_0x366599[_0x9948('0x24')][_0x9948('0x73')]='reject';respondWithRpcPromise('EventManager',_0x9948('0x6d'),{'event':_0x9948('0x74'),'message':_0x366599[_0x9948('0x24')]},client9002);return _0x4562d3;}return null;})[_0x9948('0x34')](respondWithResult(_0x389fd3,null))[_0x9948('0x26')](handleError(_0x389fd3,null));};exports[_0x9948('0x29')]=function(_0x4a3dbe,_0x1096b8,_0x5a23ac){if(_0x4a3dbe[_0x9948('0x53')]['id']){delete _0x4a3dbe['body']['id'];}var _0x3b09aa;return db[_0x9948('0x4b')][_0x9948('0x51')]({'where':{'id':_0x4a3dbe[_0x9948('0x54')]['id']}})[_0x9948('0x34')](handleEntityNotFound(_0x1096b8,null))[_0x9948('0x34')](function(_0x175de8){if(_0x175de8){_0x3b09aa=_0x175de8;return db[_0x9948('0x75')][_0x9948('0x51')]({'where':{'id':_0x175de8[_0x9948('0x76')]}});}})[_0x9948('0x34')](handleEntityNotFound(_0x1096b8,null))[_0x9948('0x34')](function(_0x2efd39){if(_0x2efd39){logger[_0x9948('0x22')](_0x9948('0x77'),_0x9948('0x29'),'received\x20delivery\x20report\x20from',_0x2efd39[_0x9948('0x39')],util[_0x9948('0x78')](_0x4a3dbe[_0x9948('0x53')],{'showHidden':![],'depth':null}));switch(_0x2efd39[_0x9948('0x39')]){case _0x9948('0x79'):if(_0x4a3dbe[_0x9948('0x53')][_0x9948('0x7a')]&&_0x4a3dbe[_0x9948('0x53')][_0x9948('0x7a')]===_0x3b09aa[_0x9948('0x7b')]){return _0x3b09aa[_0x9948('0x32')]({'read':!![]});}else{logger[_0x9948('0x23')](_0x9948('0x7c'),_0x9948('0x29'),_0x9948('0x79'),util[_0x9948('0x78')](_0x4a3dbe[_0x9948('0x53')],{'showHidden':![],'depth':null}));}break;case _0x9948('0x7d'):if(_0x4a3dbe['body'][_0x9948('0x7e')]&&_0x4a3dbe['body'][_0x9948('0x7e')]===_0x3b09aa[_0x9948('0x7b')]&&_[_0x9948('0x7f')]([_0x9948('0x80'),_0x9948('0x81')],_0x4a3dbe['body'][_0x9948('0x82')])>=0x0){return _0x3b09aa[_0x9948('0x32')]({'read':!![]});}else{logger[_0x9948('0x23')](_0x9948('0x7c'),'status',_0x9948('0x83'),util[_0x9948('0x78')](_0x4a3dbe[_0x9948('0x53')],{'showHidden':![],'depth':null}));}break;case _0x9948('0x84'):var _0x100b55=_0x4a3dbe[_0x9948('0x53')]['results'][0x0];if(_0x100b55[_0x9948('0x29')][_0x9948('0x85')]==='DELIVERED'){return _0x3b09aa[_0x9948('0x32')]({'read':!![]});}else{logger[_0x9948('0x23')](_0x9948('0x7c'),'status',_0x9948('0x84'),util[_0x9948('0x78')](_0x4a3dbe[_0x9948('0x53')],{'showHidden':![],'depth':null}));}break;}return _0x3b09aa;}})['then'](respondWithResult(_0x1096b8,null))['catch'](handleError(_0x1096b8,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index d09efdc..d1b95e4 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 _0x2a9b=['remove','emit','hasOwnProperty','hook','exports','events','SmsMessage','save','update'];(function(_0xa778b9,_0x1f42cd){var _0x26cc6f=function(_0x4ab5d2){while(--_0x4ab5d2){_0xa778b9['push'](_0xa778b9['shift']());}};_0x26cc6f(++_0x1f42cd);}(_0x2a9b,0x8c));var _0xb2a9=function(_0xbdbe62,_0xca0b27){_0xbdbe62=_0xbdbe62-0x0;var _0x4ae09a=_0x2a9b[_0xbdbe62];return _0x4ae09a;};'use strict';var EventEmitter=require(_0xb2a9('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xb2a9('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb2a9('0x2'),'afterUpdate':_0xb2a9('0x3'),'afterDestroy':_0xb2a9('0x4')};function emitEvent(_0x4ac73c){return function(_0x3c1246,_0x568709,_0x488bef){SmsMessageEvents['emit'](_0x4ac73c+':'+_0x3c1246['id'],_0x3c1246);SmsMessageEvents[_0xb2a9('0x5')](_0x4ac73c,_0x3c1246);_0x488bef(null);};}for(var e in events){if(events[_0xb2a9('0x6')](e)){var event=events[e];SmsMessage[_0xb2a9('0x7')](e,emitEvent(event));}}module[_0xb2a9('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x718d=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x299784,_0xb0918f){var _0x5ab008=function(_0x49c1f5){while(--_0x49c1f5){_0x299784['push'](_0x299784['shift']());}};_0x5ab008(++_0xb0918f);}(_0x718d,0x1f4));var _0xd718=function(_0x44d33f,_0x3a09c0){_0x44d33f=_0x44d33f-0x0;var _0x6ab40d=_0x718d[_0x44d33f];return _0x6ab40d;};'use strict';var EventEmitter=require(_0xd718('0x0'));var SmsMessage=require(_0xd718('0x1'))['db'][_0xd718('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xd718('0x3')](0x0);var events={'afterCreate':_0xd718('0x4'),'afterUpdate':_0xd718('0x5'),'afterDestroy':_0xd718('0x6')};function emitEvent(_0x31a09e){return function(_0x324329,_0x55ed62,_0x1fe1b0){SmsMessageEvents[_0xd718('0x7')](_0x31a09e+':'+_0x324329['id'],_0x324329);SmsMessageEvents[_0xd718('0x7')](_0x31a09e,_0x324329);_0x1fe1b0(null);};}for(var e in events){if(events[_0xd718('0x8')](e)){var event=events[e];SmsMessage[_0xd718('0x9')](e,emitEvent(event));}}module[_0xd718('0xa')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index d5d26e5..0b3e909 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 _0x2e43=['id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','intelepeer','Token\x20not\x20received','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','catch','find','type','twilio','accountSid','authToken','phone','remote','/api/sms/messages/','/status?token=','sid','error','afterCreate','skebby','password','smsMethod','sender','login?username=','username','&password=','GET','split','sms','POST','user_key','total_sent','internal_order_id','deliveryReport','read','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','connectel','senderString','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','token','plivo','baseUrl','/sms/2/text/advanced','application/json','messages','infobip','Missing\x20parameters:\x20base_url','crypto','apiKey','login','timestamp','sort','length','digest','hex','signature=','/external/get/send.php?'];(function(_0x2f8f6c,_0x3c19b3){var _0x26e2d7=function(_0xd331fa){while(--_0xd331fa){_0x2f8f6c['push'](_0x2f8f6c['shift']());}};_0x26e2d7(++_0x3c19b3);}(_0x2e43,0x15e));var _0x32e4=function(_0x4609ca,_0x53ccf9){_0x4609ca=_0x4609ca-0x0;var _0x541e6a=_0x2e43[_0x4609ca];return _0x541e6a;};'use strict';var _=require(_0x32e4('0x0'));var util=require(_0x32e4('0x1'));var logger=require(_0x32e4('0x2'))('api');var moment=require(_0x32e4('0x3'));var BPromise=require('bluebird');var rp=require(_0x32e4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x32e4('0x5'));var config=require(_0x32e4('0x6'));var attributes=require(_0x32e4('0x7'));module[_0x32e4('0x8')]=function(_0x21365c,_0x1e0bac){return _0x21365c[_0x32e4('0x9')]('SmsMessage',attributes,{'tableName':_0x32e4('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x32e4('0xb')]},{'name':'fti_sms_messages','fields':[_0x32e4('0xc')],'type':_0x32e4('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fc85a,_0x2b1c28,_0x4a16e7){var _0x50c261=_0x21365c[_0x32e4('0xe')];var _0x2a2586=_0x2fc85a[_0x32e4('0xf')]({'plain':!![]});if(_0x2a2586['direction']['toLowerCase']()==='in'||_0x2a2586[_0x32e4('0x10')][_0x32e4('0x11')]()===_0x32e4('0x12')&&!_0x2a2586[_0x32e4('0x13')]&&!_[_0x32e4('0x14')](_0x2a2586[_0x32e4('0x15')])){_0x50c261[_0x32e4('0x16')]['findOne']({'where':{'id':_0x2a2586[_0x32e4('0x17')]}})[_0x32e4('0x18')](function(_0x22dfe0){if(_0x22dfe0){_0x22dfe0[_0x32e4('0x19')]({'lastMsgAt':_0x2a2586[_0x32e4('0x1a')],'lastMsgDirection':_0x2a2586[_0x32e4('0x10')]['toLowerCase']()});}})[_0x32e4('0x1b')](function(_0x3158e2){console['error'](_0x3158e2);});}if(_0x2a2586['direction']==='out'&&!_0x2a2586[_0x32e4('0x13')]){var _0x43158f;_0x50c261['SmsAccount'][_0x32e4('0x1c')]({'where':{'id':_0x2a2586['SmsAccountId']},'raw':!![]})[_0x32e4('0x18')](function(_0x508404){_0x43158f=_0x508404;if(_0x43158f&&_0x43158f[_0x32e4('0x1d')]){switch(_0x43158f[_0x32e4('0x1d')]){case _0x32e4('0x1e'):var _0x2a2b27=require(_0x32e4('0x1e'));if(_0x43158f[_0x32e4('0x1f')]&&_0x43158f[_0x32e4('0x20')]&&_0x43158f[_0x32e4('0x21')]){var _0x19ad1b=new _0x2a2b27(_0x43158f['accountSid'],_0x43158f[_0x32e4('0x20')]);_0x19ad1b['messages']['create']({'body':_0x2a2586[_0x32e4('0xc')],'to':_0x2a2586[_0x32e4('0x21')],'from':_0x43158f[_0x32e4('0x21')],'statusCallback':_0x43158f[_0x32e4('0x22')]+_0x32e4('0x23')+_0x2a2586['id']+_0x32e4('0x24')+_0x43158f['token']})[_0x32e4('0x18')](function(_0x564021){if(_0x564021[_0x32e4('0x25')]){return _0x2fc85a['update']({'messageId':_0x564021[_0x32e4('0x25')]});}})[_0x32e4('0x1b')](function(_0x3c9ee6){logger[_0x32e4('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x32e4('0x27'),_0x32e4('0x1e'),util['inspect'](_0x3c9ee6,{'showHidden':![],'depth':null}));});}else{logger[_0x32e4('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x32e4('0x27'),_0x32e4('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x32e4('0x28'):var _0x3e7e8b='https://api.skebby.it/API/v1.0/REST/';if(_0x43158f['username']&&_0x43158f[_0x32e4('0x29')]){var _0xfda6da={'recipient':[_0x2a2586[_0x32e4('0x21')]],'message':_0x2a2586['body'],'message_type':_0x43158f[_0x32e4('0x2a')]};if(_0x43158f['smsMethod']&&_0x43158f[_0x32e4('0x2a')]!=='SI'){_0xfda6da[_0x32e4('0x2b')]=_0x43158f[_0x32e4('0x21')];}var _0x1460c5={'url':_0x3e7e8b+_0x32e4('0x2c')+_0x43158f[_0x32e4('0x2d')]+_0x32e4('0x2e')+_0x43158f['password'],'method':_0x32e4('0x2f')};rp(_0x1460c5)[_0x32e4('0x18')](function(_0x302fde){var _0x3b72a9=_0x302fde[_0x32e4('0x30')](';');var _0x459629={'user_key':_0x3b72a9[0x0],'session_key':_0x3b72a9[0x1]};_0x1460c5={'url':_0x3e7e8b+_0x32e4('0x31'),'method':_0x32e4('0x32'),'headers':{'user_key':_0x459629[_0x32e4('0x33')],'Session_key':_0x459629['session_key']},'json':!![],'body':_0xfda6da};return rp(_0x1460c5);})['then'](function(_0x3a2ce0){if(_0x3a2ce0[_0x32e4('0x34')]>=0x1){var _0x35bc5a={'messageId':_0x3a2ce0[_0x32e4('0x35')]};if(_0x43158f[_0x32e4('0x2a')]!=='GP'||!_0x43158f[_0x32e4('0x36')]){_0x35bc5a[_0x32e4('0x37')]=!![];}return _0x2fc85a[_0x32e4('0x19')](_0x35bc5a);}else{return logger['error'](_0x32e4('0x38'),'afterCreate',_0x32e4('0x28'),util[_0x32e4('0x39')](_0x3a2ce0,{'showHidden':![],'depth':null}));}})[_0x32e4('0x1b')](function(_0x5af36e){return logger[_0x32e4('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0x32e4('0x39')](_0x5af36e,{'showHidden':![],'depth':null}));});}else{logger[_0x32e4('0x26')](_0x32e4('0x38'),_0x32e4('0x27'),_0x32e4('0x28'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x32e4('0x3a'):if(_0x43158f['authToken']){var _0x205169={'recipient':_0x2a2586[_0x32e4('0x21')],'message':_0x2a2586[_0x32e4('0xc')],'sender':_0x43158f[_0x32e4('0x3b')]||_0x43158f[_0x32e4('0x21')],'authorization':_0x43158f[_0x32e4('0x20')]};var _0x2b1c28={'method':_0x32e4('0x32'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x205169,'json':!![]};rp(_0x2b1c28)['then'](function(_0x504b36){var _0x9a3610={'messageId':_0x504b36['requestid']};if(!_0x43158f['deliveryReport']){_0x9a3610[_0x32e4('0x37')]=!![];}return _0x2fc85a[_0x32e4('0x19')](_0x9a3610);})['catch'](function(_0xf0ecc7){logger[_0x32e4('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x32e4('0x27'),'connectel',util['inspect'](_0xf0ecc7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x32e4('0x38'),_0x32e4('0x27'),_0x32e4('0x3a'),_0x32e4('0x3c'));}break;case _0x32e4('0x3d'):if(_0x43158f[_0x32e4('0x2d')]&&_0x43158f[_0x32e4('0x29')]){var _0x205169={'messages':[{'source':'xCALLY\x20Motion','to':_0x2a2586['phone'],'body':_0x2a2586[_0x32e4('0xc')],'from':_0x43158f[_0x32e4('0x3b')]||_0x43158f[_0x32e4('0x21')]}]};var _0x4a8d15=util[_0x32e4('0x3e')](_0x32e4('0x3f'),_0x43158f[_0x32e4('0x2d')],_0x43158f['password']);var _0x2b1c28={'method':_0x32e4('0x32'),'uri':_0x32e4('0x40'),'body':_0x205169,'headers':{'Authorization':util[_0x32e4('0x3e')](_0x32e4('0x41'),new Buffer(_0x4a8d15)[_0x32e4('0x42')](_0x32e4('0x43')))},'json':!![]};rp(_0x2b1c28)['then'](function(_0x37b961){if(_0x37b961[_0x32e4('0x44')]>=0xc8&&_0x37b961[_0x32e4('0x44')]<=0xce){if(_0x37b961[_0x32e4('0x45')]&&_0x37b961[_0x32e4('0x45')][_0x32e4('0x46')]>0x0){var _0x2f227e=_[_0x32e4('0x47')](_0x37b961[_0x32e4('0x45')]['messages']);var _0x84ef88={'messageId':_0x2f227e[_0x32e4('0x48')]};if(!_0x43158f['deliveryReport']){_0x84ef88[_0x32e4('0x37')]=!![];}return _0x2fc85a[_0x32e4('0x19')](_0x84ef88);}else{logger['error'](_0x32e4('0x38'),_0x32e4('0x27'),'clickSend',util['inspect'](_0x37b961,{'showHidden':![],'depth':null}));}}else{logger[_0x32e4('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x32e4('0x27'),_0x32e4('0x49'),util['inspect'](_0x37b961,{'showHidden':![],'depth':null}));}})['catch'](function(_0x54d8de){logger['error'](_0x32e4('0x38'),_0x32e4('0x27'),'clickSend',util[_0x32e4('0x39')](_0x54d8de,{'showHidden':![],'depth':null}));});}else{logger[_0x32e4('0x26')](_0x32e4('0x38'),_0x32e4('0x27'),_0x32e4('0x49'),_0x32e4('0x4a'));}break;case'plivo':if(_0x43158f[_0x32e4('0x4b')]&&_0x43158f[_0x32e4('0x20')]){var _0x205169={'dst':_0x2a2586[_0x32e4('0x21')],'text':_0x2a2586[_0x32e4('0xc')],'src':_0x43158f['senderString']||_0x43158f[_0x32e4('0x21')],'url':_0x43158f[_0x32e4('0x22')]+'/api/sms/messages/'+_0x2a2586['id']+_0x32e4('0x24')+_0x43158f[_0x32e4('0x4c')]};var _0x4a8d15=util[_0x32e4('0x3e')](_0x32e4('0x3f'),_0x43158f[_0x32e4('0x4b')],_0x43158f[_0x32e4('0x20')]);var _0x2b1c28={'method':_0x32e4('0x32'),'uri':util[_0x32e4('0x3e')]('https://api.plivo.com/v1/Account/%s/Message/',_0x43158f[_0x32e4('0x4b')]),'body':_0x205169,'headers':{'Authorization':util[_0x32e4('0x3e')]('Basic\x20%s',new Buffer(_0x4a8d15)[_0x32e4('0x42')]('base64'))},'json':!![]};rp(_0x2b1c28)['then'](function(_0x33c42f){var _0x374a76={'messageId':_0x33c42f['message_uuid'][0x0]};return _0x2fc85a[_0x32e4('0x19')](_0x374a76);})[_0x32e4('0x1b')](function(_0x1e9878){logger[_0x32e4('0x26')](_0x32e4('0x38'),_0x32e4('0x27'),'plivo',util['inspect'](_0x1e9878,{'showHidden':![],'depth':null}));});}else{logger[_0x32e4('0x26')](_0x32e4('0x38'),'afterCreate',_0x32e4('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x43158f[_0x32e4('0x2d')]&&_0x43158f[_0x32e4('0x29')]){if(_0x43158f[_0x32e4('0x4e')]){var _0x462eb3={'method':_0x32e4('0x32'),'uri':_0x43158f[_0x32e4('0x4e')]+'/auth/1/session','body':{'username':_0x43158f[_0x32e4('0x2d')],'password':_0x43158f[_0x32e4('0x29')]},'json':!![]};return rp(_0x462eb3)[_0x32e4('0x18')](function(_0x2cefbc){var _0xd7ddc1={'method':_0x32e4('0x32'),'uri':_0x43158f[_0x32e4('0x4e')]+_0x32e4('0x4f'),'body':{'messages':[{'from':_0x43158f['phone'],'destinations':[{'to':_0x2a2586[_0x32e4('0x21')]}],'text':_0x2a2586[_0x32e4('0xc')],'notifyUrl':_0x43158f[_0x32e4('0x22')]+_0x32e4('0x23')+_0x2a2586['id']+_0x32e4('0x24')+_0x43158f[_0x32e4('0x4c')],'notifyContentType':_0x32e4('0x50'),'callbackData':_0x43158f['phone']+';'+_0x2a2586[_0x32e4('0xc')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x2cefbc[_0x32e4('0x4c')]},'json':!![]};return rp(_0xd7ddc1)['then'](function(_0x30c620){if(_0x30c620[_0x32e4('0x51')]){var _0x41e50e={'messageId':_0x30c620[_0x32e4('0x51')][0x0][_0x32e4('0xb')]};if(!_0x43158f[_0x32e4('0x36')]){_0x41e50e[_0x32e4('0x37')]=!![];}return _0x2fc85a[_0x32e4('0x19')](_0x41e50e);}else{return logger[_0x32e4('0x26')](_0x32e4('0x38'),_0x32e4('0x27'),_0x32e4('0x52'),util[_0x32e4('0x39')](_0x30c620,{'showHidden':![],'depth':null}));}});})[_0x32e4('0x1b')](function(_0x4dc37f){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x32e4('0x52'),util[_0x32e4('0x39')](_0x4dc37f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x32e4('0x38'),_0x32e4('0x27'),_0x32e4('0x52'),_0x32e4('0x53'));}}else{logger[_0x32e4('0x26')](_0x32e4('0x38'),'afterCreate',_0x32e4('0x52'),_0x32e4('0x4a'));}break;case'csc':var _0x37ebb5=require(_0x32e4('0x54'));if(_0x43158f[_0x32e4('0x55')]){var _0x19e88a={};_0x19e88a[_0x32e4('0x56')]=_0x43158f['username'];_0x19e88a['phone']=_0x2a2586[_0x32e4('0x21')];_0x19e88a['sender']=_0x43158f[_0x32e4('0x21')];_0x19e88a['text']=_0x2a2586[_0x32e4('0xc')];_0x19e88a[_0x32e4('0x57')]=+new Date();var _0x31480a='';var _0x2905f8='';var _0x59d8c3=Object['keys'](_0x19e88a);_0x59d8c3[_0x32e4('0x58')]();for(var _0x4debac=0x0;_0x4debac<_0x59d8c3[_0x32e4('0x59')];_0x4debac++){if(_0x31480a!=''){_0x31480a+='&';}_0x31480a+=_0x59d8c3[_0x4debac]+'='+encodeURIComponent(_0x19e88a[_0x59d8c3[_0x4debac]]);_0x2905f8+=_0x19e88a[_0x59d8c3[_0x4debac]];}_0x2905f8+=_0x43158f['apiKey'];_0x2905f8=_0x37ebb5['createHash']('md5')[_0x32e4('0x19')](_0x2905f8)[_0x32e4('0x5a')](_0x32e4('0x5b'));if(_0x31480a!==''){_0x31480a+='&';}_0x31480a+=_0x32e4('0x5c')+_0x2905f8;var _0x1460c5={'method':_0x32e4('0x2f'),'uri':_0x43158f[_0x32e4('0x4e')]+_0x32e4('0x5d')+_0x31480a,'json':!![]};return rp(_0x1460c5)[_0x32e4('0x18')](function(_0x12895b){var _0x282633=Object['keys'](_0x12895b);if(_0x12895b[_0x282633[0x0]][_0x32e4('0x26')]&&parseInt(_0x12895b[_0x282633[0x0]][_0x32e4('0x26')])===0x0){var _0x271a05={'messageId':_0x12895b[_0x282633[0x0]][_0x32e4('0x5e')]};if(!_0x43158f['deliveryReport']){_0x271a05[_0x32e4('0x37')]=!![];}return _0x2fc85a[_0x32e4('0x19')](_0x271a05);}else{return logger[_0x32e4('0x26')](_0x32e4('0x38'),_0x32e4('0x27'),'csc',util[_0x32e4('0x39')](_0x12895b['error'],{'showHidden':![],'depth':null}));}})[_0x32e4('0x1b')](function(_0x16d522){return logger[_0x32e4('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x32e4('0x27'),_0x32e4('0x5f'),util[_0x32e4('0x39')](_0x16d522,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x32e4('0x27'),'csc',_0x32e4('0x60'));}break;case _0x32e4('0x61'):if(_0x43158f[_0x32e4('0x55')]){var _0x51833a={'method':_0x32e4('0x32'),'uri':_0x32e4('0x62'),'headers':{'Authorization':_0x43158f[_0x32e4('0x55')]},'body':{'content':_0x2a2586[_0x32e4('0xc')],'to':[_0x2a2586[_0x32e4('0x21')]],'from':_0x43158f[_0x32e4('0x21')],'binary':![],'clientMessageId':_0x32e4('0x63'),'charset':_0x32e4('0x64')},'json':!![]};rp(_0x51833a)[_0x32e4('0x18')](function(_0x4a700b){if(!_0x4a700b[_0x32e4('0x26')]){var _0x557fb1={'messageId':_0x4a700b[_0x32e4('0x51')][0x0][_0x32e4('0x65')]};if(!_0x43158f[_0x32e4('0x36')]){_0x557fb1[_0x32e4('0x37')]=!![];}return _0x2fc85a['update'](_0x557fb1);}else{return logger[_0x32e4('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell',util[_0x32e4('0x39')](_0x4a700b[_0x32e4('0x26')],{'showHidden':![],'depth':null}));}})[_0x32e4('0x1b')](function(_0x20fa69){return logger[_0x32e4('0x26')](_0x32e4('0x38'),'afterCreate',_0x32e4('0x61'),util['inspect'](_0x20fa69,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x32e4('0x38'),_0x32e4('0x27'),_0x32e4('0x61'),_0x32e4('0x60'));}break;case'intelepeer':if(_0x43158f[_0x32e4('0x55')]){var _0x42472c={};var _0x1460c5={'method':'POST','uri':_0x32e4('0x66'),'headers':{'Authorization':_0x32e4('0x67')+_0x43158f['apiKey'],'Content-Type':_0x32e4('0x50')},'body':{'from':_0x43158f['phone'],'to':_0x2a2586['phone'],'text':_0x2a2586['body']},'json':!![]};return rp(_0x1460c5)[_0x32e4('0x18')](function(_0x215912){if(_0x215912['code']==0xca){_0x42472c['message']=_0x215912;var _0x4998ca={'method':_0x32e4('0x32'),'uri':_0x32e4('0x68'),'headers':{'Authorization':_0x32e4('0x67')+_0x43158f[_0x32e4('0x55')],'Content-Type':'application/json'},'body':{'refid':_0x42472c[_0x32e4('0x69')][_0x32e4('0x6a')]},'json':!![]};return rp(_0x4998ca)[_0x32e4('0x18')](function(_0x4d8481){_0x42472c[_0x32e4('0x6b')]=_0x4d8481;var _0x5de875={'messageId':_0x42472c[_0x32e4('0x69')][_0x32e4('0x6a')],'read':!![]};return _0x2fc85a[_0x32e4('0x19')](_0x5de875);});}else{return logger['error'](_0x32e4('0x38'),_0x32e4('0x27'),_0x32e4('0x6c'),util[_0x32e4('0x39')](_0x215912,{'showHidden':![],'depth':null}));}})[_0x32e4('0x1b')](function(_0x5aa9c9){return logger[_0x32e4('0x26')](_0x32e4('0x38'),_0x32e4('0x27'),_0x32e4('0x6c'),util[_0x32e4('0x39')](_0x5aa9c9,{'showHidden':![],'depth':null}));});}else{return logger[_0x32e4('0x26')](_0x32e4('0x38'),_0x32e4('0x27'),'intelepeer',_0x32e4('0x6d'));}break;}}})['finally'](function(){_0x4a16e7();});}else{_0x4a16e7();}}},'charset':'utf8mb4','collate':_0x32e4('0x6e')});}; \ No newline at end of file +var _0x426d=['SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','Missing\x20parameters:\x20username,\x20password','requestid','read','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','senderString','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','http_code','data','queued_count','head','message_id','deliveryReport','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','text','sort','length','apiKey','createHash','digest','/external/get/send.php?','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','message','refid','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','catch','error'];(function(_0xf66a25,_0x527689){var _0x231422=function(_0x164b05){while(--_0x164b05){_0xf66a25['push'](_0xf66a25['shift']());}};_0x231422(++_0x527689);}(_0x426d,0x1bd));var _0xd426=function(_0x32fa68,_0x551115){_0x32fa68=_0x32fa68-0x0;var _0x506365=_0x426d[_0x32fa68];return _0x506365;};'use strict';var _=require(_0xd426('0x0'));var util=require(_0xd426('0x1'));var logger=require('../../config/logger')(_0xd426('0x2'));var moment=require(_0xd426('0x3'));var BPromise=require('bluebird');var rp=require(_0xd426('0x4'));var fs=require('fs');var path=require(_0xd426('0x5'));var rimraf=require(_0xd426('0x6'));var config=require(_0xd426('0x7'));var attributes=require('./smsMessage.attributes');module[_0xd426('0x8')]=function(_0x479210,_0x4aadca){return _0x479210[_0xd426('0x9')](_0xd426('0xa'),attributes,{'tableName':_0xd426('0xb'),'paranoid':![],'indexes':[{'name':_0xd426('0xc'),'fields':[_0xd426('0xc')]},{'name':_0xd426('0xd'),'fields':[_0xd426('0xe')],'type':_0xd426('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5f4911,_0x2db418,_0x3cb6b2){var _0x5c7251=_0x479210[_0xd426('0x10')];var _0x4f1c03=_0x5f4911[_0xd426('0x11')]({'plain':!![]});if(_0x4f1c03[_0xd426('0x12')][_0xd426('0x13')]()==='in'||_0x4f1c03[_0xd426('0x12')][_0xd426('0x13')]()===_0xd426('0x14')&&!_0x4f1c03[_0xd426('0x15')]&&!_[_0xd426('0x16')](_0x4f1c03[_0xd426('0x17')])){_0x5c7251[_0xd426('0x18')]['findOne']({'where':{'id':_0x4f1c03[_0xd426('0x19')]}})[_0xd426('0x1a')](function(_0x152081){if(_0x152081){_0x152081[_0xd426('0x1b')]({'lastMsgAt':_0x4f1c03[_0xd426('0x1c')],'lastMsgDirection':_0x4f1c03['direction'][_0xd426('0x13')]()});}})[_0xd426('0x1d')](function(_0xa46356){console[_0xd426('0x1e')](_0xa46356);});}if(_0x4f1c03[_0xd426('0x12')]===_0xd426('0x14')&&!_0x4f1c03[_0xd426('0x15')]){var _0x22e246;_0x5c7251[_0xd426('0x1f')][_0xd426('0x20')]({'where':{'id':_0x4f1c03[_0xd426('0x21')]},'raw':!![]})[_0xd426('0x1a')](function(_0x7a7256){_0x22e246=_0x7a7256;if(_0x22e246&&_0x22e246['type']){switch(_0x22e246[_0xd426('0x22')]){case _0xd426('0x23'):var _0x3c9077=require(_0xd426('0x23'));if(_0x22e246['accountSid']&&_0x22e246[_0xd426('0x24')]&&_0x22e246[_0xd426('0x25')]){var _0x6705b2=new _0x3c9077(_0x22e246['accountSid'],_0x22e246['authToken']);_0x6705b2[_0xd426('0x26')]['create']({'body':_0x4f1c03[_0xd426('0xe')],'to':_0x4f1c03[_0xd426('0x25')],'from':_0x22e246[_0xd426('0x25')],'statusCallback':_0x22e246[_0xd426('0x27')]+_0xd426('0x28')+_0x4f1c03['id']+_0xd426('0x29')+_0x22e246[_0xd426('0x2a')]})[_0xd426('0x1a')](function(_0x2d0b14){if(_0x2d0b14['sid']){return _0x5f4911[_0xd426('0x1b')]({'messageId':_0x2d0b14[_0xd426('0x2b')]});}})[_0xd426('0x1d')](function(_0x474ce6){logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate',_0xd426('0x23'),util[_0xd426('0x2d')](_0x474ce6,{'showHidden':![],'depth':null}));});}else{logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x23'),_0xd426('0x2f'));}break;case _0xd426('0x30'):var _0x5078a0=_0xd426('0x31');if(_0x22e246[_0xd426('0x32')]&&_0x22e246[_0xd426('0x33')]){var _0x42652c={'recipient':[_0x4f1c03[_0xd426('0x25')]],'message':_0x4f1c03[_0xd426('0xe')],'message_type':_0x22e246[_0xd426('0x34')]};if(_0x22e246[_0xd426('0x34')]&&_0x22e246['smsMethod']!=='SI'){_0x42652c[_0xd426('0x35')]=_0x22e246['phone'];}var _0x617d8f={'url':_0x5078a0+'login?username='+_0x22e246['username']+_0xd426('0x36')+_0x22e246[_0xd426('0x33')],'method':_0xd426('0x37')};rp(_0x617d8f)[_0xd426('0x1a')](function(_0x57f760){var _0x267f83=_0x57f760['split'](';');var _0xfab709={'user_key':_0x267f83[0x0],'session_key':_0x267f83[0x1]};_0x617d8f={'url':_0x5078a0+_0xd426('0x38'),'method':_0xd426('0x39'),'headers':{'user_key':_0xfab709[_0xd426('0x3a')],'Session_key':_0xfab709[_0xd426('0x3b')]},'json':!![],'body':_0x42652c};return rp(_0x617d8f);})[_0xd426('0x1a')](function(_0x20caff){if(_0x20caff[_0xd426('0x3c')]>=0x1){var _0x46bcc5={'messageId':_0x20caff[_0xd426('0x3d')]};if(_0x22e246['smsMethod']!=='GP'||!_0x22e246['deliveryReport']){_0x46bcc5['read']=!![];}return _0x5f4911[_0xd426('0x1b')](_0x46bcc5);}else{return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x30'),util[_0xd426('0x2d')](_0x20caff,{'showHidden':![],'depth':null}));}})[_0xd426('0x1d')](function(_0x2c1d81){return logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate',_0xd426('0x30'),util[_0xd426('0x2d')](_0x2c1d81,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd426('0x2e'),_0xd426('0x30'),_0xd426('0x3e'));}break;case'connectel':if(_0x22e246[_0xd426('0x24')]){var _0x5a29a5={'recipient':_0x4f1c03[_0xd426('0x25')],'message':_0x4f1c03['body'],'sender':_0x22e246['senderString']||_0x22e246['phone'],'authorization':_0x22e246[_0xd426('0x24')]};var _0x2db418={'method':_0xd426('0x39'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x5a29a5,'json':!![]};rp(_0x2db418)[_0xd426('0x1a')](function(_0x250fec){var _0x41a25d={'messageId':_0x250fec[_0xd426('0x3f')]};if(!_0x22e246['deliveryReport']){_0x41a25d[_0xd426('0x40')]=!![];}return _0x5f4911['update'](_0x41a25d);})[_0xd426('0x1d')](function(_0x50bd69){logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),'connectel',util['inspect'](_0x50bd69,{'showHidden':![],'depth':null}));});}else{logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate',_0xd426('0x41'),_0xd426('0x42'));}break;case'clicksend':if(_0x22e246[_0xd426('0x32')]&&_0x22e246[_0xd426('0x33')]){var _0x5a29a5={'messages':[{'source':_0xd426('0x43'),'to':_0x4f1c03[_0xd426('0x25')],'body':_0x4f1c03['body'],'from':_0x22e246[_0xd426('0x44')]||_0x22e246[_0xd426('0x25')]}]};var _0xf54436=util[_0xd426('0x45')](_0xd426('0x46'),_0x22e246['username'],_0x22e246[_0xd426('0x33')]);var _0x2db418={'method':_0xd426('0x39'),'uri':_0xd426('0x47'),'body':_0x5a29a5,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0xf54436)[_0xd426('0x48')]('base64'))},'json':!![]};rp(_0x2db418)[_0xd426('0x1a')](function(_0x63be31){if(_0x63be31[_0xd426('0x49')]>=0xc8&&_0x63be31[_0xd426('0x49')]<=0xce){if(_0x63be31[_0xd426('0x4a')]&&_0x63be31['data'][_0xd426('0x4b')]>0x0){var _0x4e6388=_[_0xd426('0x4c')](_0x63be31[_0xd426('0x4a')][_0xd426('0x26')]);var _0x213506={'messageId':_0x4e6388[_0xd426('0x4d')]};if(!_0x22e246[_0xd426('0x4e')]){_0x213506[_0xd426('0x40')]=!![];}return _0x5f4911[_0xd426('0x1b')](_0x213506);}else{logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate','clickSend',util[_0xd426('0x2d')](_0x63be31,{'showHidden':![],'depth':null}));}}else{logger[_0xd426('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd426('0x2e'),_0xd426('0x4f'),util[_0xd426('0x2d')](_0x63be31,{'showHidden':![],'depth':null}));}})[_0xd426('0x1d')](function(_0x468db4){logger['error'](_0xd426('0x2c'),_0xd426('0x2e'),'clickSend',util[_0xd426('0x2d')](_0x468db4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xd426('0x50'):if(_0x22e246['authId']&&_0x22e246[_0xd426('0x24')]){var _0x5a29a5={'dst':_0x4f1c03[_0xd426('0x25')],'text':_0x4f1c03[_0xd426('0xe')],'src':_0x22e246[_0xd426('0x44')]||_0x22e246[_0xd426('0x25')],'url':_0x22e246[_0xd426('0x27')]+_0xd426('0x28')+_0x4f1c03['id']+_0xd426('0x29')+_0x22e246['token']};var _0xf54436=util['format']('%s:%s',_0x22e246[_0xd426('0x51')],_0x22e246[_0xd426('0x24')]);var _0x2db418={'method':_0xd426('0x39'),'uri':util[_0xd426('0x45')](_0xd426('0x52'),_0x22e246['authId']),'body':_0x5a29a5,'headers':{'Authorization':util[_0xd426('0x45')](_0xd426('0x53'),new Buffer(_0xf54436)[_0xd426('0x48')]('base64'))},'json':!![]};rp(_0x2db418)['then'](function(_0x3c0b83){var _0x4cf76b={'messageId':_0x3c0b83[_0xd426('0x54')][0x0]};return _0x5f4911[_0xd426('0x1b')](_0x4cf76b);})['catch'](function(_0x11503b){logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate',_0xd426('0x50'),util[_0xd426('0x2d')](_0x11503b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x50'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xd426('0x55'):if(_0x22e246['username']&&_0x22e246[_0xd426('0x33')]){if(_0x22e246[_0xd426('0x56')]){var _0x4dcf88={'method':_0xd426('0x39'),'uri':_0x22e246['baseUrl']+_0xd426('0x57'),'body':{'username':_0x22e246[_0xd426('0x32')],'password':_0x22e246[_0xd426('0x33')]},'json':!![]};return rp(_0x4dcf88)[_0xd426('0x1a')](function(_0x523987){var _0x4a153d={'method':'POST','uri':_0x22e246[_0xd426('0x56')]+_0xd426('0x58'),'body':{'messages':[{'from':_0x22e246[_0xd426('0x25')],'destinations':[{'to':_0x4f1c03[_0xd426('0x25')]}],'text':_0x4f1c03['body'],'notifyUrl':_0x22e246['remote']+'/api/sms/messages/'+_0x4f1c03['id']+_0xd426('0x29')+_0x22e246['token'],'notifyContentType':_0xd426('0x59'),'callbackData':_0x22e246[_0xd426('0x25')]+';'+_0x4f1c03['body']}]},'headers':{'Authorization':_0xd426('0x5a')+_0x523987[_0xd426('0x2a')]},'json':!![]};return rp(_0x4a153d)[_0xd426('0x1a')](function(_0x962883){if(_0x962883[_0xd426('0x26')]){var _0x425cdd={'messageId':_0x962883['messages'][0x0][_0xd426('0xc')]};if(!_0x22e246['deliveryReport']){_0x425cdd[_0xd426('0x40')]=!![];}return _0x5f4911[_0xd426('0x1b')](_0x425cdd);}else{return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),'infobip',util['inspect'](_0x962883,{'showHidden':![],'depth':null}));}});})[_0xd426('0x1d')](function(_0x335aa7){return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x55'),util['inspect'](_0x335aa7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x55'),_0xd426('0x5b'));}}else{logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate',_0xd426('0x55'),_0xd426('0x3e'));}break;case _0xd426('0x5c'):var _0x251970=require(_0xd426('0x5d'));if(_0x22e246['apiKey']){var _0x3e8f63={};_0x3e8f63['login']=_0x22e246[_0xd426('0x32')];_0x3e8f63['phone']=_0x4f1c03[_0xd426('0x25')];_0x3e8f63['sender']=_0x22e246[_0xd426('0x25')];_0x3e8f63[_0xd426('0x5e')]=_0x4f1c03[_0xd426('0xe')];_0x3e8f63['timestamp']=+new Date();var _0x1e4d6a='';var _0x2b167d='';var _0x94cfd3=Object['keys'](_0x3e8f63);_0x94cfd3[_0xd426('0x5f')]();for(var _0x3e1f4d=0x0;_0x3e1f4d<_0x94cfd3[_0xd426('0x60')];_0x3e1f4d++){if(_0x1e4d6a!=''){_0x1e4d6a+='&';}_0x1e4d6a+=_0x94cfd3[_0x3e1f4d]+'='+encodeURIComponent(_0x3e8f63[_0x94cfd3[_0x3e1f4d]]);_0x2b167d+=_0x3e8f63[_0x94cfd3[_0x3e1f4d]];}_0x2b167d+=_0x22e246[_0xd426('0x61')];_0x2b167d=_0x251970[_0xd426('0x62')]('md5')[_0xd426('0x1b')](_0x2b167d)[_0xd426('0x63')]('hex');if(_0x1e4d6a!==''){_0x1e4d6a+='&';}_0x1e4d6a+='signature='+_0x2b167d;var _0x617d8f={'method':'GET','uri':_0x22e246['baseUrl']+_0xd426('0x64')+_0x1e4d6a,'json':!![]};return rp(_0x617d8f)[_0xd426('0x1a')](function(_0xb8c70c){var _0x5c5861=Object[_0xd426('0x65')](_0xb8c70c);if(_0xb8c70c[_0x5c5861[0x0]][_0xd426('0x1e')]&&parseInt(_0xb8c70c[_0x5c5861[0x0]][_0xd426('0x1e')])===0x0){var _0x248dd1={'messageId':_0xb8c70c[_0x5c5861[0x0]][_0xd426('0x66')]};if(!_0x22e246['deliveryReport']){_0x248dd1[_0xd426('0x40')]=!![];}return _0x5f4911[_0xd426('0x1b')](_0x248dd1);}else{return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x5c'),util[_0xd426('0x2d')](_0xb8c70c[_0xd426('0x1e')],{'showHidden':![],'depth':null}));}})[_0xd426('0x1d')](function(_0x173262){return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),'csc',util[_0xd426('0x2d')](_0x173262,{'showHidden':![],'depth':null}));});}else{logger[_0xd426('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd426('0x5c'),_0xd426('0x67'));}break;case _0xd426('0x68'):if(_0x22e246['apiKey']){var _0x1fb269={'method':_0xd426('0x39'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x22e246['apiKey']},'body':{'content':_0x4f1c03[_0xd426('0xe')],'to':[_0x4f1c03['phone']],'from':_0x22e246['phone'],'binary':![],'clientMessageId':_0xd426('0x69'),'charset':_0xd426('0x6a')},'json':!![]};rp(_0x1fb269)[_0xd426('0x1a')](function(_0xe0e97a){if(!_0xe0e97a[_0xd426('0x1e')]){var _0x28173e={'messageId':_0xe0e97a['messages'][0x0][_0xd426('0x6b')]};if(!_0x22e246['deliveryReport']){_0x28173e[_0xd426('0x40')]=!![];}return _0x5f4911[_0xd426('0x1b')](_0x28173e);}else{return logger[_0xd426('0x1e')](_0xd426('0x2c'),'afterCreate',_0xd426('0x68'),util['inspect'](_0xe0e97a[_0xd426('0x1e')],{'showHidden':![],'depth':null}));}})[_0xd426('0x1d')](function(_0xa416ce){return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x68'),util[_0xd426('0x2d')](_0xa416ce,{'showHidden':![],'depth':null}));});}else{logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x68'),'Missing\x20parameters:\x20apiKey');}break;case _0xd426('0x6c'):if(_0x22e246[_0xd426('0x61')]){var _0x586f09={};var _0x617d8f={'method':_0xd426('0x39'),'uri':_0xd426('0x6d'),'headers':{'Authorization':_0xd426('0x6e')+_0x22e246[_0xd426('0x61')],'Content-Type':'application/json'},'body':{'from':_0x22e246['phone'],'to':_0x4f1c03[_0xd426('0x25')],'text':_0x4f1c03[_0xd426('0xe')]},'json':!![]};return rp(_0x617d8f)[_0xd426('0x1a')](function(_0x5f0754){if(_0x5f0754[_0xd426('0x6f')]==0xca){_0x586f09['message']=_0x5f0754;var _0x430d42={'method':_0xd426('0x39'),'uri':_0xd426('0x70'),'headers':{'Authorization':'Bearer\x20'+_0x22e246['apiKey'],'Content-Type':_0xd426('0x59')},'body':{'refid':_0x586f09['message']['refid']},'json':!![]};return rp(_0x430d42)[_0xd426('0x1a')](function(_0x3c7039){_0x586f09[_0xd426('0x71')]=_0x3c7039;var _0x38b6d3={'messageId':_0x586f09[_0xd426('0x72')][_0xd426('0x73')],'read':!![]};return _0x5f4911[_0xd426('0x1b')](_0x38b6d3);});}else{return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),'intelepeer',util[_0xd426('0x2d')](_0x5f0754,{'showHidden':![],'depth':null}));}})[_0xd426('0x1d')](function(_0xdbb78d){return logger[_0xd426('0x1e')](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x6c'),util[_0xd426('0x2d')](_0xdbb78d,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xd426('0x2c'),_0xd426('0x2e'),_0xd426('0x6c'),'Token\x20not\x20received');}break;}}})[_0xd426('0x74')](function(){_0x3cb6b2();});}else{_0x3cb6b2();}}},'charset':_0xd426('0x75'),'collate':_0xd426('0x76')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index f839f47..bf77908 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 _0x66fa=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','request','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','stringify'];(function(_0x329664,_0x130748){var _0x4e346e=function(_0x172b0d){while(--_0x172b0d){_0x329664['push'](_0x329664['shift']());}};_0x4e346e(++_0x130748);}(_0x66fa,0x117));var _0xa66f=function(_0x2c70c3,_0x4eb52f){_0x2c70c3=_0x2c70c3-0x0;var _0x287ca6=_0x66fa[_0x2c70c3];return _0x287ca6;};'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});config[_0xa66f('0xb')]=_[_0xa66f('0xc')](config[_0xa66f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa66f('0xd'))(new Redis(config['redis']));require(_0xa66f('0xe'))['register'](socket);function respondWithRpcPromise(_0x101e10,_0x53ca76,_0x52d802){return new BPromise(function(_0x55e6dc,_0x1e1997){return client[_0xa66f('0xf')](_0x101e10,_0x52d802)['then'](function(_0x14d31e){logger['info'](_0xa66f('0x10'),_0x53ca76,'request\x20sent');logger[_0xa66f('0x11')](_0xa66f('0x12'),_0x53ca76,_0xa66f('0x13'),JSON['stringify'](_0x14d31e));if(_0x14d31e['error']){if(_0x14d31e[_0xa66f('0x14')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);return _0x1e1997(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}logger[_0xa66f('0x14')]('SmsMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e['error'][_0xa66f('0x15')]);return _0x55e6dc(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}else{logger[_0xa66f('0x16')]('SmsMessage,\x20%s,\x20%s',_0x53ca76,_0xa66f('0x13'));_0x55e6dc(_0x14d31e['result']['message']);}})[_0xa66f('0x17')](function(_0x413e80){logger[_0xa66f('0x14')](_0xa66f('0x10'),_0x53ca76,_0x413e80);_0x1e1997(_0x413e80);});});}exports[_0xa66f('0x18')]=function(_0x408bc7){var _0x251f60=this;return new Promise(function(_0x150291,_0x2033a4){return db[_0xa66f('0x19')][_0xa66f('0x1a')](_0x408bc7[_0xa66f('0x1b')],{'raw':_0x408bc7[_0xa66f('0x1c')]?_0x408bc7[_0xa66f('0x1c')][_0xa66f('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x27f570){logger[_0xa66f('0x16')](_0xa66f('0x18'),_0x408bc7);logger[_0xa66f('0x11')]('CreateSmsMessage',_0x408bc7,JSON[_0xa66f('0x1e')](_0x27f570));_0x150291(_0x27f570);})[_0xa66f('0x17')](function(_0x209f4d){logger[_0xa66f('0x14')]('CreateSmsMessage',_0x209f4d['message'],_0x408bc7);_0x2033a4(_0x251f60[_0xa66f('0x14')](0x1f4,_0x209f4d['message']));});});}; \ No newline at end of file +var _0x5f2f=['SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsMessage','create','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x48d633,_0x450470){var _0x550af1=function(_0x4c5152){while(--_0x4c5152){_0x48d633['push'](_0x48d633['shift']());}};_0x550af1(++_0x450470);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5622c2,_0x1337b1){_0x5622c2=_0x5622c2-0x0;var _0x15f4b8=_0x5f2f[_0x5622c2];return _0x15f4b8;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./smsMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateSmsMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 8c2ad31..1425600 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 _0xf288=['length','smsMessage:','remove','update','emit','removeListener'];(function(_0x3800ef,_0x24925f){var _0x3bca22=function(_0x10a19f){while(--_0x10a19f){_0x3800ef['push'](_0x3800ef['shift']());}};_0x3bca22(++_0x24925f);}(_0xf288,0x1b2));var _0x8f28=function(_0x91384,_0x545eef){_0x91384=_0x91384-0x0;var _0x44daa0=_0xf288[_0x91384];return _0x44daa0;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0x8f28('0x0'),_0x8f28('0x1')];function createListener(_0x471f4c,_0x2db92d){return function(_0x4af326){_0x2db92d[_0x8f28('0x2')](_0x471f4c,_0x4af326);};}function removeListener(_0x288244,_0x592773){return function(){SmsMessageEvents[_0x8f28('0x3')](_0x288244,_0x592773);};}exports['register']=function(_0x565ba6){for(var _0x46d4b8=0x0,_0x3a68cf=events[_0x8f28('0x4')];_0x46d4b8<_0x3a68cf;_0x46d4b8++){var _0x1e79e5=events[_0x46d4b8];var _0x5c8716=createListener(_0x8f28('0x5')+_0x1e79e5,_0x565ba6);SmsMessageEvents['on'](_0x1e79e5,_0x5c8716);}}; \ No newline at end of file +var _0xefec=['emit','removeListener','register','length','smsMessage:','remove','update'];(function(_0xc2f5c2,_0x5c3145){var _0x21a2ec=function(_0x57bf8f){while(--_0x57bf8f){_0xc2f5c2['push'](_0xc2f5c2['shift']());}};_0x21a2ec(++_0x5c3145);}(_0xefec,0x1a2));var _0xcefe=function(_0x542a55,_0x44cf24){_0x542a55=_0x542a55-0x0;var _0x5598ad=_0xefec[_0x542a55];return _0x5598ad;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0xcefe('0x0'),_0xcefe('0x1')];function createListener(_0x412947,_0x1a20a3){return function(_0x587fcc){_0x1a20a3[_0xcefe('0x2')](_0x412947,_0x587fcc);};}function removeListener(_0x14a68e,_0x35323b){return function(){SmsMessageEvents[_0xcefe('0x3')](_0x14a68e,_0x35323b);};}exports[_0xcefe('0x4')]=function(_0x2e0791){for(var _0x2dde84=0x0,_0x142ad0=events[_0xcefe('0x5')];_0x2dde84<_0x142ad0;_0x2dde84++){var _0x6d3083=events[_0x2dde84];var _0x4705ee=createListener(_0xcefe('0x6')+_0x6d3083,_0x2e0791);SmsMessageEvents['on'](_0x6d3083,_0x4705ee);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a8bbcaf..da4b517 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 _0xdbf5=['../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getTeams','post','create','/:id/teams','/:id/users','addAgents','put','update','delete','removeTeams','util','express','Router','../../components/auth/service'];(function(_0x4cc768,_0x28df20){var _0x3b71f2=function(_0x36ad7f){while(--_0x36ad7f){_0x4cc768['push'](_0x4cc768['shift']());}};_0x3b71f2(++_0x28df20);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x31c1d7,_0x1dbbba){_0x31c1d7=_0x31c1d7-0x0;var _0x23c4f7=_0xdbf5[_0x31c1d7];return _0x23c4f7;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x9')]);router[_0x5dbf('0x7')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xb')]);router['get'](_0x5dbf('0xc'),auth['isAuthenticated'](),controller[_0x5dbf('0xd')]);router[_0x5dbf('0x7')](_0x5dbf('0xe'),auth[_0x5dbf('0x8')](),controller['getMembers']);router[_0x5dbf('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5dbf('0xf')]);router['get']('/:id/users',auth[_0x5dbf('0x8')](),controller['getAgents']);router[_0x5dbf('0x10')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x11')]);router[_0x5dbf('0x10')](_0x5dbf('0x12'),auth['isAuthenticated'](),controller['addTeams']);router[_0x5dbf('0x10')](_0x5dbf('0x13'),auth['isAuthenticated'](),controller[_0x5dbf('0x14')]);router[_0x5dbf('0x15')](_0x5dbf('0xc'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x16')]);router[_0x5dbf('0x17')](_0x5dbf('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x5dbf('0x17')](_0x5dbf('0x12'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x18')]);router[_0x5dbf('0x17')]('/:id/users',auth[_0x5dbf('0x8')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5f71=['get','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','express','../../config/environment','./smsQueue.controller','isAuthenticated','index'];(function(_0x4b2ed9,_0x5e49fb){var _0x2bb358=function(_0x568dce){while(--_0x568dce){_0x4b2ed9['push'](_0x4b2ed9['shift']());}};_0x2bb358(++_0x5e49fb);}(_0x5f71,0xc9));var _0x15f7=function(_0x5abd1a,_0x2610d0){_0x5abd1a=_0x5abd1a-0x0;var _0x86ab1b=_0x5f71[_0x5abd1a];return _0x86ab1b;};'use strict';var multer=require(_0x15f7('0x0'));var util=require('util');var path=require(_0x15f7('0x1'));var timeout=require('connect-timeout');var express=require(_0x15f7('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x15f7('0x3'));var controller=require(_0x15f7('0x4'));router['get']('/',auth[_0x15f7('0x5')](),controller[_0x15f7('0x6')]);router[_0x15f7('0x7')](_0x15f7('0x8'),auth[_0x15f7('0x5')](),controller[_0x15f7('0x9')]);router[_0x15f7('0x7')](_0x15f7('0xa'),auth[_0x15f7('0x5')](),controller[_0x15f7('0xb')]);router[_0x15f7('0x7')](_0x15f7('0xc'),auth['isAuthenticated'](),controller['getMembers']);router[_0x15f7('0x7')](_0x15f7('0xd'),auth['isAuthenticated'](),controller[_0x15f7('0xe')]);router[_0x15f7('0x7')](_0x15f7('0xf'),auth[_0x15f7('0x5')](),controller[_0x15f7('0x10')]);router[_0x15f7('0x11')]('/',auth[_0x15f7('0x5')](),controller['create']);router[_0x15f7('0x11')](_0x15f7('0xd'),auth[_0x15f7('0x5')](),controller['addTeams']);router[_0x15f7('0x11')](_0x15f7('0xf'),auth['isAuthenticated'](),controller[_0x15f7('0x12')]);router[_0x15f7('0x13')](_0x15f7('0xa'),auth[_0x15f7('0x5')](),controller[_0x15f7('0x14')]);router[_0x15f7('0x15')](_0x15f7('0xa'),auth['isAuthenticated'](),controller[_0x15f7('0x16')]);router[_0x15f7('0x15')]('/:id/teams',auth[_0x15f7('0x5')](),controller[_0x15f7('0x17')]);router[_0x15f7('0x15')](_0x15f7('0xf'),auth[_0x15f7('0x5')](),controller[_0x15f7('0x18')]);module[_0x15f7('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 43ebf76..592d8a7 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 _0xdb18=['roundrobin','sequelize','STRING','ENUM','rrmemory'];(function(_0x5c073e,_0x1373fe){var _0x1279dd=function(_0x37d507){while(--_0x37d507){_0x5c073e['push'](_0x5c073e['shift']());}};_0x1279dd(++_0x1373fe);}(_0xdb18,0x15f));var _0x8db1=function(_0x1b7e07,_0x48cc07){_0x1b7e07=_0x1b7e07-0x0;var _0x559eb3=_0xdb18[_0x1b7e07];return _0x559eb3;};'use strict';var Sequelize=require(_0x8db1('0x0'));module['exports']={'name':{'type':Sequelize[_0x8db1('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8db1('0x2')](_0x8db1('0x3'),'beepall',_0x8db1('0x4'))}}; \ No newline at end of file +var _0x4d7e=['roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2ed6e7,_0x3a0df6){var _0x2d7e84=function(_0x1669a6){while(--_0x1669a6){_0x2ed6e7['push'](_0x2ed6e7['shift']());}};_0x2d7e84(++_0x3a0df6);}(_0x4d7e,0xf9));var _0xe4d7=function(_0x52c408,_0x35f852){_0x52c408=_0x52c408-0x0;var _0x31ad08=_0x4d7e[_0x52c408];return _0x31ad08;};'use strict';var Sequelize=require(_0xe4d7('0x0'));module[_0xe4d7('0x1')]={'name':{'type':Sequelize[_0xe4d7('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe4d7('0x2')]},'timeout':{'type':Sequelize[_0xe4d7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe4d7('0x4')](_0xe4d7('0x5'),_0xe4d7('0x6'),_0xe4d7('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 336cd05..044d9a4 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 _0x1967=['localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','json','count','offset','reject','save','update','then','destroy','get','SmsQueues','error','name','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','filters','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','params','describe','getMembers','findOne','keys','UserSmsQueue','hasOwnProperty','SmsQueueId','User','agent','smsPause','updatedAt','rows','format','SIP','createdAt','getTeams','Team','addTeams','Agents','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','select','team_has_sms_queues','join','user_has_teams','clone','toString','QueryTypes','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x7f41cd,_0x2eabb6){var _0xad4818=function(_0x25224e){while(--_0x25224e){_0x7f41cd['push'](_0x7f41cd['shift']());}};_0xad4818(++_0x2eabb6);}(_0x1967,0x173));var _0x7196=function(_0x1187f1,_0xbe2b7f){_0x1187f1=_0x1187f1-0x0;var _0x4161d5=_0x1967[_0x1187f1];return _0x4161d5;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7196('0x0'));var rimraf=require(_0x7196('0x1'));var zipdir=require(_0x7196('0x2'));var jsonpatch=require(_0x7196('0x3'));var rp=require(_0x7196('0x4'));var moment=require(_0x7196('0x5'));var BPromise=require(_0x7196('0x6'));var Mustache=require(_0x7196('0x7'));var util=require(_0x7196('0x8'));var path=require(_0x7196('0x9'));var sox=require('sox');var csv=require(_0x7196('0xa'));var ejs=require(_0x7196('0xb'));var fs=require('fs');var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0xa'));var querystring=require(_0x7196('0x10'));var Papa=require(_0x7196('0x11'));var Redis=require(_0x7196('0x12'));var authService=require(_0x7196('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x14'));var logger=require(_0x7196('0x15'))(_0x7196('0x16'));var utils=require(_0x7196('0x17'));var config=require(_0x7196('0x18'));var db=require(_0x7196('0x19'))['db'];config[_0x7196('0x1a')]=_[_0x7196('0x1b')](config[_0x7196('0x1a')],{'host':_0x7196('0x1c'),'port':0x18eb});var socket=require(_0x7196('0x1d'))(new Redis(config['redis']));require(_0x7196('0x1e'))[_0x7196('0x1f')](socket);function respondWithStatusCode(_0x3545aa,_0xf098c1){_0xf098c1=_0xf098c1||0xcc;return function(_0x511aa1){if(_0x511aa1){return _0x3545aa[_0x7196('0x20')](_0xf098c1);}return _0x3545aa['status'](_0xf098c1)[_0x7196('0x21')]();};}function respondWithResult(_0x2590a6,_0xf7e97){_0xf7e97=_0xf7e97||0xc8;return function(_0x3ed1ad){if(_0x3ed1ad){return _0x2590a6[_0x7196('0x22')](_0xf7e97)[_0x7196('0x23')](_0x3ed1ad);}};}function respondWithFilteredResult(_0x22bd62,_0x1ed296){return function(_0x3e4e69){if(_0x3e4e69){var _0x32fe2b=_0x3e4e69[_0x7196('0x24')],_0x385f2d=_0x1ed296[_0x7196('0x25')],_0x5b716a=_0x1ed296[_0x7196('0x25')]+_0x1ed296['limit'],_0x4c4f91;if(_0x5b716a>=_0x32fe2b){_0x5b716a=_0x32fe2b;_0x4c4f91=0xc8;}else{_0x4c4f91=0xce;}_0x22bd62[_0x7196('0x22')](_0x4c4f91);return _0x22bd62['set']('Content-Range',_0x385f2d+'-'+_0x5b716a+'/'+_0x32fe2b)[_0x7196('0x23')](_0x3e4e69);}return null;};}function patchUpdates(_0x627223){return function(_0x8dee9d){try{jsonpatch['apply'](_0x8dee9d,_0x627223,!![]);}catch(_0x57c390){return BPromise[_0x7196('0x26')](_0x57c390);}return _0x8dee9d[_0x7196('0x27')]();};}function saveUpdates(_0x598a26,_0x18649b){return function(_0x27ff84){if(_0x27ff84){return _0x27ff84[_0x7196('0x28')](_0x598a26)[_0x7196('0x29')](function(_0x38b3d6){return _0x38b3d6;});}return null;};}function removeEntity(_0x549f34,_0x3f8178){return function(_0x520d01){if(_0x520d01){return _0x520d01[_0x7196('0x2a')]()[_0x7196('0x29')](function(){var _0x2e15c7=_0x520d01[_0x7196('0x2b')]({'plain':!![]});var _0x70aa65=_0x7196('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x70aa65,'resourceId':_0x2e15c7['id']}})[_0x7196('0x29')](function(){return _0x520d01;});})[_0x7196('0x29')](function(){_0x549f34[_0x7196('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aa538,_0x41cfd2){return function(_0x162cfc){if(!_0x162cfc){_0x5aa538[_0x7196('0x20')](0x194);}return _0x162cfc;};}function handleError(_0x4c6006,_0x35eef9){_0x35eef9=_0x35eef9||0x1f4;return function(_0x4ecea1){logger[_0x7196('0x2d')](_0x4ecea1['stack']);if(_0x4ecea1[_0x7196('0x2e')]){delete _0x4ecea1[_0x7196('0x2e')];}_0x4c6006[_0x7196('0x22')](_0x35eef9)['send'](_0x4ecea1);};}exports[_0x7196('0x2f')]=function(_0x45d567,_0x2f9583){var _0xf999e9={},_0x50c386={},_0x39710d={'count':0x0,'rows':[]};var _0x429160=_[_0x7196('0x30')](db[_0x7196('0x31')][_0x7196('0x32')],function(_0x2786f3){return{'name':_0x2786f3[_0x7196('0x33')],'type':_0x2786f3[_0x7196('0x34')][_0x7196('0x35')]};});_0x50c386[_0x7196('0x36')]=_[_0x7196('0x30')](_0x429160,'name');_0x50c386[_0x7196('0x37')]=_['keys'](_0x45d567[_0x7196('0x37')]);_0x50c386['filters']=_[_0x7196('0x38')](_0x50c386[_0x7196('0x36')],_0x50c386['query']);_0xf999e9[_0x7196('0x39')]=_[_0x7196('0x38')](_0x50c386[_0x7196('0x36')],qs[_0x7196('0x3a')](_0x45d567[_0x7196('0x37')]['fields']));_0xf999e9[_0x7196('0x39')]=_0xf999e9[_0x7196('0x39')][_0x7196('0x3b')]?_0xf999e9[_0x7196('0x39')]:_0x50c386[_0x7196('0x36')];if(!_0x45d567[_0x7196('0x37')]['hasOwnProperty'](_0x7196('0x3c'))){_0xf999e9[_0x7196('0x3d')]=qs[_0x7196('0x3d')](_0x45d567['query'][_0x7196('0x3d')]);_0xf999e9[_0x7196('0x25')]=qs[_0x7196('0x25')](_0x45d567[_0x7196('0x37')][_0x7196('0x25')]);}_0xf999e9[_0x7196('0x3e')]=qs[_0x7196('0x3f')](_0x45d567[_0x7196('0x37')][_0x7196('0x3f')]);_0xf999e9[_0x7196('0x40')]=qs['filters'](_[_0x7196('0x41')](_0x45d567[_0x7196('0x37')],_0x50c386['filters']));if(_0x45d567[_0x7196('0x37')]['filter']){_0xf999e9['where']=_[_0x7196('0x42')](_0xf999e9[_0x7196('0x40')],{'$or':_['map'](_0x429160,function(_0x587f6f){if(_0x587f6f[_0x7196('0x34')]!==_0x7196('0x43')){var _0xed32cd={};_0xed32cd[_0x587f6f['name']]={'$like':'%'+_0x45d567[_0x7196('0x37')][_0x7196('0x44')]+'%'};return _0xed32cd;}})});}_0xf999e9=_[_0x7196('0x42')]({},_0xf999e9,_0x45d567[_0x7196('0x45')]);var _0x16da09={'where':_0xf999e9[_0x7196('0x40')]};return db[_0x7196('0x31')][_0x7196('0x24')](_0x16da09)['then'](function(_0x89c8ea){_0x39710d[_0x7196('0x24')]=_0x89c8ea;if(_0x45d567['query'][_0x7196('0x46')]){_0xf999e9[_0x7196('0x47')]=[{'all':!![]}];}return db['SmsQueue'][_0x7196('0x48')](_0xf999e9);})[_0x7196('0x29')](function(_0x3b78c8){_0x39710d['rows']=_0x3b78c8;return _0x39710d;})[_0x7196('0x29')](respondWithFilteredResult(_0x2f9583,_0xf999e9))[_0x7196('0x49')](handleError(_0x2f9583,null));};exports['show']=function(_0xcd287c,_0x1a7052){var _0x4f0c6c={'raw':!![],'where':{'id':_0xcd287c['params']['id']}},_0x335e6f={};_0x335e6f['model']=_['keys'](db['SmsQueue']['rawAttributes']);_0x335e6f[_0x7196('0x37')]=_['keys'](_0xcd287c[_0x7196('0x37')]);_0x335e6f[_0x7196('0x4a')]=_[_0x7196('0x38')](_0x335e6f[_0x7196('0x36')],_0x335e6f['query']);_0x4f0c6c[_0x7196('0x39')]=_['intersection'](_0x335e6f[_0x7196('0x36')],qs[_0x7196('0x3a')](_0xcd287c[_0x7196('0x37')]['fields']));_0x4f0c6c[_0x7196('0x39')]=_0x4f0c6c[_0x7196('0x39')][_0x7196('0x3b')]?_0x4f0c6c['attributes']:_0x335e6f['model'];if(_0xcd287c[_0x7196('0x37')]['includeAll']){_0x4f0c6c[_0x7196('0x47')]=[{'all':!![]}];}_0x4f0c6c=_['merge']({},_0x4f0c6c,_0xcd287c['options']);return db[_0x7196('0x31')]['find'](_0x4f0c6c)['then'](handleEntityNotFound(_0x1a7052,null))['then'](respondWithResult(_0x1a7052,null))[_0x7196('0x49')](handleError(_0x1a7052,null));};exports['create']=function(_0x48e3b5,_0x28591e){return db[_0x7196('0x31')][_0x7196('0x4b')](_0x48e3b5[_0x7196('0x4c')],{})['then'](function(_0x50cc66){var _0x564688=_0x48e3b5[_0x7196('0x4d')][_0x7196('0x2b')]({'plain':!![]});if(!_0x564688)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x564688[_0x7196('0x4e')]===_0x7196('0x4d')){var _0x3fe092=_0x50cc66['get']({'plain':!![]});var _0x317ab6='SmsQueues';return db[_0x7196('0x4f')][_0x7196('0x50')]({'where':{'name':_0x317ab6,'userProfileId':_0x564688[_0x7196('0x51')]},'raw':!![]})[_0x7196('0x29')](function(_0x41a9aa){if(_0x41a9aa&&_0x41a9aa[_0x7196('0x52')]===0x0){return db[_0x7196('0x53')][_0x7196('0x4b')]({'name':_0x3fe092['name'],'resourceId':_0x3fe092['id'],'type':_0x41a9aa['name'],'sectionId':_0x41a9aa['id']},{})[_0x7196('0x29')](function(){return _0x50cc66;});}else{return _0x50cc66;}})[_0x7196('0x49')](function(_0x40f820){logger[_0x7196('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40f820);throw _0x40f820;});}return _0x50cc66;})[_0x7196('0x29')](respondWithResult(_0x28591e,0xc9))[_0x7196('0x49')](handleError(_0x28591e,null));};exports[_0x7196('0x28')]=function(_0x11dc10,_0x9fcfd4){if(_0x11dc10[_0x7196('0x4c')]['id']){delete _0x11dc10[_0x7196('0x4c')]['id'];}return db[_0x7196('0x31')][_0x7196('0x50')]({'where':{'id':_0x11dc10[_0x7196('0x54')]['id']}})[_0x7196('0x29')](handleEntityNotFound(_0x9fcfd4,null))['then'](saveUpdates(_0x11dc10[_0x7196('0x4c')],null))[_0x7196('0x29')](respondWithResult(_0x9fcfd4,null))[_0x7196('0x49')](handleError(_0x9fcfd4,null));};exports['destroy']=function(_0x1f098c,_0x5ca1ca){return db[_0x7196('0x31')][_0x7196('0x50')]({'where':{'id':_0x1f098c[_0x7196('0x54')]['id']}})[_0x7196('0x29')](handleEntityNotFound(_0x5ca1ca,null))[_0x7196('0x29')](removeEntity(_0x5ca1ca,null))['catch'](handleError(_0x5ca1ca,null));};exports[_0x7196('0x55')]=function(_0x5b77fc,_0x4be36d){return db['SmsQueue'][_0x7196('0x55')]()[_0x7196('0x29')](respondWithResult(_0x4be36d,null))[_0x7196('0x49')](handleError(_0x4be36d,null));};exports[_0x7196('0x56')]=function(_0x105a3f,_0x41fa94,_0x2d8b3d){var _0x560ddb={'raw':!![],'where':{}},_0x293467={},_0x14dc43;return db[_0x7196('0x31')][_0x7196('0x57')]({'where':{'id':_0x105a3f[_0x7196('0x54')]['id']}})['then'](handleEntityNotFound(_0x41fa94,null))['then'](function(_0xa7ecfb){if(_0xa7ecfb){_0x14dc43=_0xa7ecfb[_0x7196('0x2b')]({'plain':!![]});_0x293467[_0x7196('0x36')]=_[_0x7196('0x58')](db[_0x7196('0x59')][_0x7196('0x32')]);_0x293467[_0x7196('0x37')]=_[_0x7196('0x58')](_0x105a3f[_0x7196('0x37')]);_0x293467[_0x7196('0x4a')]=_[_0x7196('0x38')](_0x293467['model'],_0x293467[_0x7196('0x37')]);_0x560ddb[_0x7196('0x39')]=_[_0x7196('0x38')](_0x293467[_0x7196('0x36')],qs['fields'](_0x105a3f[_0x7196('0x37')][_0x7196('0x3a')]));_0x560ddb[_0x7196('0x39')]=_0x560ddb[_0x7196('0x39')][_0x7196('0x3b')]?_0x560ddb[_0x7196('0x39')]:_0x293467[_0x7196('0x36')];if(!_0x105a3f['query'][_0x7196('0x5a')](_0x7196('0x3c'))){_0x560ddb[_0x7196('0x3d')]=qs[_0x7196('0x3d')](_0x105a3f['query'][_0x7196('0x3d')]);_0x560ddb[_0x7196('0x25')]=qs[_0x7196('0x25')](_0x105a3f[_0x7196('0x37')][_0x7196('0x25')]);}_0x560ddb[_0x7196('0x3e')]=qs[_0x7196('0x3f')](_0x105a3f['query']['sort']);_0x560ddb['where']=qs[_0x7196('0x4a')](_['pick'](_0x105a3f[_0x7196('0x37')],_0x293467[_0x7196('0x4a')]));_0x560ddb[_0x7196('0x40')][_0x7196('0x5b')]=_0xa7ecfb['id'];if(_0x105a3f[_0x7196('0x37')][_0x7196('0x44')]){_0x560ddb[_0x7196('0x40')]=_[_0x7196('0x42')](_0x560ddb[_0x7196('0x40')],{'$or':_['map'](_0x560ddb['attributes'],function(_0x4542c1){var _0x3f939a={};_0x3f939a[_0x4542c1]={'$like':'%'+_0x105a3f[_0x7196('0x37')][_0x7196('0x44')]+'%'};return _0x3f939a;})});}_0x560ddb=_[_0x7196('0x42')]({},_0x560ddb,_0x105a3f[_0x7196('0x45')]);return db[_0x7196('0x59')][_0x7196('0x48')](_0x560ddb);}})['then'](function(_0x4cb99d){if(_0x4cb99d){return db[_0x7196('0x5c')]['findAndCountAll']({'where':{'id':_[_0x7196('0x30')](_0x4cb99d,'UserId'),'role':_0x7196('0x5d')},'attributes':['id',_0x7196('0x2e'),_0x7196('0x5e'),_0x7196('0x5f'),'createdAt']});}})['then'](function(_0x33d301){if(_0x33d301){return{'count':_0x33d301['count'],'rows':_[_0x7196('0x30')](_0x33d301[_0x7196('0x60')],function(_0x4526e8){return{'membername':_0x4526e8[_0x7196('0x2e')],'UserId':_0x4526e8['id'],'queue_name':_0x14dc43[_0x7196('0x2e')],'SmsQueueId':_0x14dc43['id'],'interface':util[_0x7196('0x61')]('%s/%s',_0x7196('0x62'),_0x4526e8[_0x7196('0x2e')]),'penalty':0x0,'paused':_0x4526e8[_0x7196('0x5e')],'createdAt':_0x4526e8[_0x7196('0x63')],'updatedAt':_0x4526e8[_0x7196('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7196('0x29')](respondWithFilteredResult(_0x41fa94,_0x560ddb))[_0x7196('0x49')](handleError(_0x41fa94,null));};exports[_0x7196('0x64')]=function(_0x13cbe2,_0xa20de8,_0x3d3768){var _0x2181f5={};var _0x53a6fa={};var _0x431415;var _0x13f802;return db['SmsQueue']['findOne']({'where':{'id':_0x13cbe2[_0x7196('0x54')]['id']}})[_0x7196('0x29')](handleEntityNotFound(_0xa20de8,null))[_0x7196('0x29')](function(_0x5b2c33){if(_0x5b2c33){_0x431415=_0x5b2c33;_0x53a6fa[_0x7196('0x36')]=_['keys'](db[_0x7196('0x65')][_0x7196('0x32')]);_0x53a6fa['query']=_[_0x7196('0x58')](_0x13cbe2['query']);_0x53a6fa['filters']=_[_0x7196('0x38')](_0x53a6fa[_0x7196('0x36')],_0x53a6fa[_0x7196('0x37')]);_0x2181f5['attributes']=_[_0x7196('0x38')](_0x53a6fa['model'],qs[_0x7196('0x3a')](_0x13cbe2[_0x7196('0x37')][_0x7196('0x3a')]));_0x2181f5[_0x7196('0x39')]=_0x2181f5[_0x7196('0x39')]['length']?_0x2181f5[_0x7196('0x39')]:_0x53a6fa[_0x7196('0x36')];_0x2181f5[_0x7196('0x3e')]=qs[_0x7196('0x3f')](_0x13cbe2[_0x7196('0x37')][_0x7196('0x3f')]);_0x2181f5[_0x7196('0x40')]=qs[_0x7196('0x4a')](_['pick'](_0x13cbe2[_0x7196('0x37')],_0x53a6fa[_0x7196('0x4a')]));if(_0x13cbe2[_0x7196('0x37')][_0x7196('0x44')]){_0x2181f5['where']=_[_0x7196('0x42')](_0x2181f5[_0x7196('0x40')],{'$or':_['map'](_0x2181f5[_0x7196('0x39')],function(_0x53d470){var _0xd6d8cf={};_0xd6d8cf[_0x53d470]={'$like':'%'+_0x13cbe2['query'][_0x7196('0x44')]+'%'};return _0xd6d8cf;})});}_0x2181f5=_[_0x7196('0x42')]({},_0x2181f5,_0x13cbe2['options']);return _0x431415[_0x7196('0x64')](_0x2181f5);}})[_0x7196('0x29')](function(_0x2c2c53){if(_0x2c2c53){_0x13f802=_0x2c2c53['length'];if(!_0x13cbe2['query'][_0x7196('0x5a')]('nolimit')){_0x2181f5['limit']=qs[_0x7196('0x3d')](_0x13cbe2[_0x7196('0x37')][_0x7196('0x3d')]);_0x2181f5['offset']=qs[_0x7196('0x25')](_0x13cbe2[_0x7196('0x37')][_0x7196('0x25')]);}return _0x431415[_0x7196('0x64')](_0x2181f5);}})[_0x7196('0x29')](function(_0x26048c){if(_0x26048c){return _0x26048c?{'count':_0x13f802,'rows':_0x26048c}:null;}})[_0x7196('0x29')](respondWithResult(_0xa20de8,null))[_0x7196('0x49')](handleError(_0xa20de8,null));};exports[_0x7196('0x66')]=function(_0x446f28,_0x173fe5,_0x5eb2b5){var _0x5acff1=_0x446f28[_0x7196('0x4c')]['ids'];return db['Team'][_0x7196('0x48')]({'where':{'id':_0x5acff1},'attributes':['id'],'include':[{'model':db[_0x7196('0x5c')],'as':_0x7196('0x67'),'attributes':['id',_0x7196('0x2e'),'online','voicePause',_0x7196('0x68')],'raw':!![]}]})[_0x7196('0x29')](function(_0x1eea71){if(_0x1eea71){var _0x247b15=_['flatMap'](_0x1eea71,function(_0x4d8b8e){var _0x4afbee=_0x4d8b8e['get']({'plain':!![]});return _0x4afbee[_0x7196('0x67')];});return db[_0x7196('0x31')][_0x7196('0x50')]({'where':{'id':_0x446f28['params']['id']}})[_0x7196('0x29')](function(_0x40d4c3){return db[_0x7196('0x69')][_0x7196('0x6a')](function(_0x10712f){return _0x40d4c3[_0x7196('0x66')](_0x5acff1,{'transaction':_0x10712f})[_0x7196('0x29')](function(){return BPromise[_0x7196('0x6b')](_0x247b15,function(_0x5de550){return db[_0x7196('0x59')][_0x7196('0x6c')]({'where':{'UserId':_0x5de550['id'],'SmsQueueId':_0x446f28[_0x7196('0x54')]['id']},'transaction':_0x10712f});});})[_0x7196('0x29')](function(){_0x247b15[_0x7196('0x6d')](function(_0x4faf7b){socket[_0x7196('0x6e')](_0x7196('0x6f'),{'UserId':_0x4faf7b['id'],'SmsQueueId':_0x40d4c3['id']});});});});});}})[_0x7196('0x29')](respondWithStatusCode(_0x173fe5,null))['catch'](handleError(_0x173fe5,null));};exports[_0x7196('0x70')]=function(_0x4b98de,_0x53ae84,_0x1dcf93){return db[_0x7196('0x65')]['findAll']({'where':{'id':_0x4b98de[_0x7196('0x37')][_0x7196('0x71')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7196('0x67'),'attributes':['id'],'raw':!![]}]})[_0x7196('0x29')](handleEntityNotFound(_0x53ae84,null))[_0x7196('0x29')](function(_0x28d665){var _0x441ca1=_[_0x7196('0x30')](_0x28d665,'id');var _0x5d5d1f=[];var _0x3639be=[];var _0x460e51=squel[_0x7196('0x72')]();_0x460e51['field']('tq.TeamId')['from'](_0x7196('0x73'),'tq')[_0x7196('0x74')](_0x7196('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x7196('0x40')]('SmsQueueId\x20=\x20?',_0x4b98de[_0x7196('0x54')]['id']);for(var _0x4e22df=0x0;_0x4e22df<_0x28d665[_0x7196('0x3b')];_0x4e22df+=0x1){let _0x18bafa=_0x28d665[_0x4e22df];for(var _0x33d5bf=0x0;_0x33d5bf<_0x18bafa[_0x7196('0x67')][_0x7196('0x3b')];_0x33d5bf+=0x1){let _0x10b628=_0x18bafa[_0x7196('0x67')][_0x33d5bf];var _0x48608b=_0x460e51[_0x7196('0x76')]();_0x48608b['where']('ut.UserId\x20=\x20?',_0x10b628['id']);_0x3639be['push'](db['sequelize']['query'](_0x48608b[_0x7196('0x77')](),{'type':db[_0x7196('0x69')][_0x7196('0x78')]['SELECT']})[_0x7196('0x29')](function(_0x49bf7e){if(_0x49bf7e['length']===0x1){return _0x10b628['id'];}else{var _0x4f7717=_[_0x7196('0x79')](_['map'](_0x49bf7e,_0x7196('0x7a')),function(_0x2fe382){return _[_0x7196('0x7b')](_0x441ca1,_0x2fe382);});if(_0x4f7717){return _0x10b628['id'];}}}));}}return BPromise[_0x7196('0x7c')](_0x3639be)[_0x7196('0x29')](function(_0x36893a){_0x5d5d1f=_(_0x5d5d1f)[_0x7196('0x7d')](_0x36893a)[_0x7196('0x7e')]()['value']();return db[_0x7196('0x31')][_0x7196('0x50')]({'where':{'id':_0x4b98de[_0x7196('0x54')]['id']}})['then'](function(_0x3a241a){return db[_0x7196('0x69')][_0x7196('0x6a')](function(_0x4fa1b5){return _0x3a241a[_0x7196('0x70')](_0x4b98de[_0x7196('0x37')][_0x7196('0x71')],{'transaction':_0x4fa1b5})['then'](function(){if(!_[_0x7196('0x7f')](_0x5d5d1f)){return _0x3a241a[_0x7196('0x80')](_0x5d5d1f,{'transaction':_0x4fa1b5});}})['then'](function(){_0x5d5d1f[_0x7196('0x6d')](function(_0x5db5f1){socket[_0x7196('0x6e')](_0x7196('0x81'),{'UserId':_0x5db5f1,'SmsQueueId':_0x3a241a['id']});});});});});});})['then'](respondWithStatusCode(_0x53ae84,null))[_0x7196('0x49')](handleError(_0x53ae84,null));};exports['addAgents']=function(_0x5d24ff,_0x2cae94,_0x4738c2){return db['SmsQueue'][_0x7196('0x50')]({'where':{'id':_0x5d24ff[_0x7196('0x54')]['id']}})[_0x7196('0x29')](handleEntityNotFound(_0x2cae94,null))[_0x7196('0x29')](function(_0x5b91e5){if(_0x5b91e5){return _0x5b91e5[_0x7196('0x82')](_0x5d24ff[_0x7196('0x4c')][_0x7196('0x71')],_['omit'](_0x5d24ff['body'],[_0x7196('0x71'),'id'])||{})[_0x7196('0x83')](function(_0x87184a){for(var _0x2af201=0x0;_0x2af201<_0x5d24ff['body'][_0x7196('0x71')]['length'];_0x2af201+=0x1){socket[_0x7196('0x6e')]('userSmsQueue:save',{'UserId':_0x5d24ff[_0x7196('0x4c')][_0x7196('0x71')][_0x2af201],'SmsQueueId':_0x5d24ff[_0x7196('0x54')]['id']});}return _0x87184a;});}})[_0x7196('0x29')](respondWithResult(_0x2cae94,null))[_0x7196('0x49')](handleError(_0x2cae94,null));};exports[_0x7196('0x80')]=function(_0x342fb1,_0x4c9c35,_0x1ae8bc){return db[_0x7196('0x31')][_0x7196('0x50')]({'where':{'id':_0x342fb1[_0x7196('0x54')]['id']}})[_0x7196('0x29')](handleEntityNotFound(_0x4c9c35,null))[_0x7196('0x29')](function(_0x186731){if(_0x186731){return _0x186731[_0x7196('0x80')](_0x342fb1['query'][_0x7196('0x71')])[_0x7196('0x29')](function(){if(_['isArray'](_0x342fb1[_0x7196('0x37')][_0x7196('0x71')])){for(var _0x4fa57e=0x0;_0x4fa57e<_0x342fb1[_0x7196('0x37')][_0x7196('0x71')][_0x7196('0x3b')];_0x4fa57e+=0x1){socket[_0x7196('0x6e')]('userSmsQueue:remove',{'UserId':Number(_0x342fb1['query'][_0x7196('0x71')][_0x4fa57e]),'SmsQueueId':Number(_0x342fb1['params']['id'])});}}else{socket[_0x7196('0x6e')](_0x7196('0x81'),{'UserId':Number(_0x342fb1[_0x7196('0x37')][_0x7196('0x71')]),'SmsQueueId':Number(_0x342fb1[_0x7196('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x4c9c35,null))[_0x7196('0x49')](handleError(_0x4c9c35,null));};exports[_0x7196('0x84')]=function(_0x163857,_0x1948b8,_0x1bd2dc){var _0x2b954c={};var _0x446a99={};var _0x149144;var _0x11fb5b;return db['SmsQueue']['findOne']({'where':{'id':_0x163857['params']['id']}})[_0x7196('0x29')](handleEntityNotFound(_0x1948b8,null))[_0x7196('0x29')](function(_0x92179b){if(_0x92179b){_0x149144=_0x92179b;_0x446a99[_0x7196('0x36')]=_[_0x7196('0x58')](db[_0x7196('0x5c')][_0x7196('0x32')]);_0x446a99[_0x7196('0x37')]=_['keys'](_0x163857['query']);_0x446a99['filters']=_['intersection'](_0x446a99[_0x7196('0x36')],_0x446a99[_0x7196('0x37')]);_0x2b954c[_0x7196('0x39')]=_[_0x7196('0x38')](_0x446a99[_0x7196('0x36')],qs[_0x7196('0x3a')](_0x163857['query'][_0x7196('0x3a')]));_0x2b954c['attributes']=_0x2b954c['attributes'][_0x7196('0x3b')]?_0x2b954c['attributes']:_0x446a99['model'];_0x2b954c[_0x7196('0x3e')]=qs['sort'](_0x163857[_0x7196('0x37')][_0x7196('0x3f')]);_0x2b954c[_0x7196('0x40')]=qs[_0x7196('0x4a')](_[_0x7196('0x41')](_0x163857[_0x7196('0x37')],_0x446a99['filters']));if(_0x163857[_0x7196('0x37')][_0x7196('0x44')]){_0x2b954c[_0x7196('0x40')]=_['merge'](_0x2b954c[_0x7196('0x40')],{'$or':_[_0x7196('0x30')](_0x2b954c[_0x7196('0x39')],function(_0x48262c){var _0x571fa5={};_0x571fa5[_0x48262c]={'$like':'%'+_0x163857[_0x7196('0x37')][_0x7196('0x44')]+'%'};return _0x571fa5;})});}_0x2b954c=_[_0x7196('0x42')]({},_0x2b954c,_0x163857[_0x7196('0x45')]);return _0x149144[_0x7196('0x84')](_0x2b954c);}})[_0x7196('0x29')](function(_0x1a8a5a){if(_0x1a8a5a){_0x11fb5b=_0x1a8a5a[_0x7196('0x3b')];if(!_0x163857[_0x7196('0x37')][_0x7196('0x5a')]('nolimit')){_0x2b954c[_0x7196('0x3d')]=qs[_0x7196('0x3d')](_0x163857['query'][_0x7196('0x3d')]);_0x2b954c[_0x7196('0x25')]=qs['offset'](_0x163857[_0x7196('0x37')][_0x7196('0x25')]);}return _0x149144[_0x7196('0x84')](_0x2b954c);}})[_0x7196('0x29')](function(_0x1e7a64){if(_0x1e7a64){return _0x1e7a64?{'count':_0x11fb5b,'rows':_0x1e7a64}:null;}})[_0x7196('0x29')](respondWithResult(_0x1948b8,null))['catch'](handleError(_0x1948b8,null));}; \ No newline at end of file +var _0x57ca=['userSmsQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','count','offset','json','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','filter','merge','VIRTUAL','options','SmsQueue','rows','params','keys','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','catch','describe','findOne','UserSmsQueue','sort','pick','SmsQueueId','findAll','findAndCountAll','UserId','smsPause','updatedAt','format','%s/%s','getTeams','Team','addTeams','ids','User','online','Agents','sequelize','each','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','compact','value','transaction','isEmpty','forEach','addAgents','omit','spread','removeAgents','isArray'];(function(_0x21d691,_0x114a69){var _0x5b6fe6=function(_0x141727){while(--_0x141727){_0x21d691['push'](_0x21d691['shift']());}};_0x5b6fe6(++_0x114a69);}(_0x57ca,0x108));var _0xa57c=function(_0x66dd96,_0xd86c27){_0x66dd96=_0x66dd96-0x0;var _0x2ddda2=_0x57ca[_0x66dd96];return _0x2ddda2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa57c('0x0'));var rimraf=require(_0xa57c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa57c('0x2'));var rp=require(_0xa57c('0x3'));var moment=require(_0xa57c('0x4'));var BPromise=require(_0xa57c('0x5'));var Mustache=require(_0xa57c('0x6'));var util=require('util');var path=require(_0xa57c('0x7'));var sox=require(_0xa57c('0x8'));var csv=require(_0xa57c('0x9'));var ejs=require(_0xa57c('0xa'));var fs=require('fs');var _=require(_0xa57c('0xb'));var squel=require(_0xa57c('0xc'));var crypto=require(_0xa57c('0xd'));var jsforce=require(_0xa57c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa57c('0x9'));var querystring=require('querystring');var Papa=require(_0xa57c('0xf'));var Redis=require(_0xa57c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa57c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa57c('0x12'));var logger=require(_0xa57c('0x13'))('api');var utils=require(_0xa57c('0x14'));var config=require('../../config/environment');var db=require(_0xa57c('0x15'))['db'];config[_0xa57c('0x16')]=_[_0xa57c('0x17')](config[_0xa57c('0x16')],{'host':_0xa57c('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa57c('0x16')]));require('./smsQueue.socket')[_0xa57c('0x19')](socket);function respondWithStatusCode(_0x3d5995,_0x30940d){_0x30940d=_0x30940d||0xcc;return function(_0x3821d2){if(_0x3821d2){return _0x3d5995[_0xa57c('0x1a')](_0x30940d);}return _0x3d5995[_0xa57c('0x1b')](_0x30940d)[_0xa57c('0x1c')]();};}function respondWithResult(_0x4b4bdb,_0x26607a){_0x26607a=_0x26607a||0xc8;return function(_0xdf7ff6){if(_0xdf7ff6){return _0x4b4bdb[_0xa57c('0x1b')](_0x26607a)['json'](_0xdf7ff6);}};}function respondWithFilteredResult(_0x2746a0,_0x5f33f1){return function(_0x3e7afa){if(_0x3e7afa){var _0x3d781d=_0x3e7afa[_0xa57c('0x1d')],_0x93462c=_0x5f33f1[_0xa57c('0x1e')],_0xe3d505=_0x5f33f1[_0xa57c('0x1e')]+_0x5f33f1['limit'],_0x1fd0d8;if(_0xe3d505>=_0x3d781d){_0xe3d505=_0x3d781d;_0x1fd0d8=0xc8;}else{_0x1fd0d8=0xce;}_0x2746a0[_0xa57c('0x1b')](_0x1fd0d8);return _0x2746a0['set']('Content-Range',_0x93462c+'-'+_0xe3d505+'/'+_0x3d781d)[_0xa57c('0x1f')](_0x3e7afa);}return null;};}function patchUpdates(_0xa5b314){return function(_0x3eee75){try{jsonpatch[_0xa57c('0x20')](_0x3eee75,_0xa5b314,!![]);}catch(_0x49242c){return BPromise[_0xa57c('0x21')](_0x49242c);}return _0x3eee75[_0xa57c('0x22')]();};}function saveUpdates(_0x34d1bc,_0x2213b2){return function(_0x3bb969){if(_0x3bb969){return _0x3bb969[_0xa57c('0x23')](_0x34d1bc)[_0xa57c('0x24')](function(_0x42038e){return _0x42038e;});}return null;};}function removeEntity(_0x2e99ed,_0xdf65dd){return function(_0x382a26){if(_0x382a26){return _0x382a26[_0xa57c('0x25')]()[_0xa57c('0x24')](function(){var _0x10a33d=_0x382a26[_0xa57c('0x26')]({'plain':!![]});var _0x511a26=_0xa57c('0x27');return db[_0xa57c('0x28')][_0xa57c('0x25')]({'where':{'type':_0x511a26,'resourceId':_0x10a33d['id']}})[_0xa57c('0x24')](function(){return _0x382a26;});})[_0xa57c('0x24')](function(){_0x2e99ed[_0xa57c('0x1b')](0xcc)[_0xa57c('0x1c')]();});}};}function handleEntityNotFound(_0xe50fb8,_0x337f97){return function(_0x1d59c2){if(!_0x1d59c2){_0xe50fb8['sendStatus'](0x194);}return _0x1d59c2;};}function handleError(_0x3b7364,_0x4c1478){_0x4c1478=_0x4c1478||0x1f4;return function(_0x54a18b){logger[_0xa57c('0x29')](_0x54a18b[_0xa57c('0x2a')]);if(_0x54a18b['name']){delete _0x54a18b[_0xa57c('0x2b')];}_0x3b7364[_0xa57c('0x1b')](_0x4c1478)[_0xa57c('0x2c')](_0x54a18b);};}exports['index']=function(_0xd779f1,_0x58d46f){var _0xf5f70c={},_0x5464f2={},_0x2a3bbe={'count':0x0,'rows':[]};var _0x51ad09=_[_0xa57c('0x2d')](db['SmsQueue'][_0xa57c('0x2e')],function(_0x1d82d9){return{'name':_0x1d82d9[_0xa57c('0x2f')],'type':_0x1d82d9[_0xa57c('0x30')][_0xa57c('0x31')]};});_0x5464f2[_0xa57c('0x32')]=_[_0xa57c('0x2d')](_0x51ad09,'name');_0x5464f2[_0xa57c('0x33')]=_['keys'](_0xd779f1[_0xa57c('0x33')]);_0x5464f2[_0xa57c('0x34')]=_[_0xa57c('0x35')](_0x5464f2['model'],_0x5464f2[_0xa57c('0x33')]);_0xf5f70c['attributes']=_[_0xa57c('0x35')](_0x5464f2['model'],qs[_0xa57c('0x36')](_0xd779f1['query'][_0xa57c('0x36')]));_0xf5f70c[_0xa57c('0x37')]=_0xf5f70c['attributes'][_0xa57c('0x38')]?_0xf5f70c['attributes']:_0x5464f2[_0xa57c('0x32')];if(!_0xd779f1['query'][_0xa57c('0x39')](_0xa57c('0x3a'))){_0xf5f70c[_0xa57c('0x3b')]=qs[_0xa57c('0x3b')](_0xd779f1[_0xa57c('0x33')][_0xa57c('0x3b')]);_0xf5f70c['offset']=qs['offset'](_0xd779f1[_0xa57c('0x33')][_0xa57c('0x1e')]);}_0xf5f70c[_0xa57c('0x3c')]=qs['sort'](_0xd779f1[_0xa57c('0x33')]['sort']);_0xf5f70c[_0xa57c('0x3d')]=qs[_0xa57c('0x34')](_['pick'](_0xd779f1['query'],_0x5464f2['filters']));if(_0xd779f1[_0xa57c('0x33')][_0xa57c('0x3e')]){_0xf5f70c[_0xa57c('0x3d')]=_[_0xa57c('0x3f')](_0xf5f70c[_0xa57c('0x3d')],{'$or':_[_0xa57c('0x2d')](_0x51ad09,function(_0x5a444a){if(_0x5a444a[_0xa57c('0x30')]!==_0xa57c('0x40')){var _0x5a5490={};_0x5a5490[_0x5a444a['name']]={'$like':'%'+_0xd779f1[_0xa57c('0x33')][_0xa57c('0x3e')]+'%'};return _0x5a5490;}})});}_0xf5f70c=_['merge']({},_0xf5f70c,_0xd779f1[_0xa57c('0x41')]);var _0x5603cf={'where':_0xf5f70c[_0xa57c('0x3d')]};return db[_0xa57c('0x42')][_0xa57c('0x1d')](_0x5603cf)[_0xa57c('0x24')](function(_0x5d210b){_0x2a3bbe[_0xa57c('0x1d')]=_0x5d210b;if(_0xd779f1['query']['includeAll']){_0xf5f70c['include']=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0xf5f70c);})[_0xa57c('0x24')](function(_0x32ed25){_0x2a3bbe[_0xa57c('0x43')]=_0x32ed25;return _0x2a3bbe;})['then'](respondWithFilteredResult(_0x58d46f,_0xf5f70c))['catch'](handleError(_0x58d46f,null));};exports['show']=function(_0x44f1e8,_0x2755bc){var _0x44e38f={'raw':!![],'where':{'id':_0x44f1e8[_0xa57c('0x44')]['id']}},_0x40715e={};_0x40715e[_0xa57c('0x32')]=_['keys'](db[_0xa57c('0x42')][_0xa57c('0x2e')]);_0x40715e[_0xa57c('0x33')]=_[_0xa57c('0x45')](_0x44f1e8[_0xa57c('0x33')]);_0x40715e[_0xa57c('0x34')]=_['intersection'](_0x40715e[_0xa57c('0x32')],_0x40715e[_0xa57c('0x33')]);_0x44e38f[_0xa57c('0x37')]=_[_0xa57c('0x35')](_0x40715e[_0xa57c('0x32')],qs['fields'](_0x44f1e8[_0xa57c('0x33')][_0xa57c('0x36')]));_0x44e38f[_0xa57c('0x37')]=_0x44e38f[_0xa57c('0x37')][_0xa57c('0x38')]?_0x44e38f[_0xa57c('0x37')]:_0x40715e['model'];if(_0x44f1e8[_0xa57c('0x33')][_0xa57c('0x46')]){_0x44e38f[_0xa57c('0x47')]=[{'all':!![]}];}_0x44e38f=_[_0xa57c('0x3f')]({},_0x44e38f,_0x44f1e8[_0xa57c('0x41')]);return db[_0xa57c('0x42')]['find'](_0x44e38f)['then'](handleEntityNotFound(_0x2755bc,null))['then'](respondWithResult(_0x2755bc,null))['catch'](handleError(_0x2755bc,null));};exports[_0xa57c('0x48')]=function(_0x49492f,_0x273a17){return db[_0xa57c('0x42')]['create'](_0x49492f[_0xa57c('0x49')],{})[_0xa57c('0x24')](function(_0x368e87){var _0x128ea2=_0x49492f[_0xa57c('0x4a')]['get']({'plain':!![]});if(!_0x128ea2)throw new Error(_0xa57c('0x4b'));if(_0x128ea2[_0xa57c('0x4c')]===_0xa57c('0x4a')){var _0xd57bac=_0x368e87[_0xa57c('0x26')]({'plain':!![]});var _0x5ace6d=_0xa57c('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x5ace6d,'userProfileId':_0x128ea2[_0xa57c('0x4d')]},'raw':!![]})[_0xa57c('0x24')](function(_0x5ded49){if(_0x5ded49&&_0x5ded49['autoAssociation']===0x0){return db['UserProfileResource'][_0xa57c('0x48')]({'name':_0xd57bac[_0xa57c('0x2b')],'resourceId':_0xd57bac['id'],'type':_0x5ded49[_0xa57c('0x2b')],'sectionId':_0x5ded49['id']},{})[_0xa57c('0x24')](function(){return _0x368e87;});}else{return _0x368e87;}})['catch'](function(_0x3c450f){logger[_0xa57c('0x29')](_0xa57c('0x4e'),_0x3c450f);throw _0x3c450f;});}return _0x368e87;})['then'](respondWithResult(_0x273a17,0xc9))['catch'](handleError(_0x273a17,null));};exports[_0xa57c('0x23')]=function(_0x25fc6b,_0x4d5d46){if(_0x25fc6b[_0xa57c('0x49')]['id']){delete _0x25fc6b[_0xa57c('0x49')]['id'];}return db[_0xa57c('0x42')][_0xa57c('0x4f')]({'where':{'id':_0x25fc6b[_0xa57c('0x44')]['id']}})[_0xa57c('0x24')](handleEntityNotFound(_0x4d5d46,null))[_0xa57c('0x24')](saveUpdates(_0x25fc6b['body'],null))['then'](respondWithResult(_0x4d5d46,null))[_0xa57c('0x50')](handleError(_0x4d5d46,null));};exports[_0xa57c('0x25')]=function(_0x2fd759,_0x2a6538){return db[_0xa57c('0x42')][_0xa57c('0x4f')]({'where':{'id':_0x2fd759[_0xa57c('0x44')]['id']}})[_0xa57c('0x24')](handleEntityNotFound(_0x2a6538,null))['then'](removeEntity(_0x2a6538,null))['catch'](handleError(_0x2a6538,null));};exports[_0xa57c('0x51')]=function(_0x4e18ad,_0x1880e6){return db[_0xa57c('0x42')][_0xa57c('0x51')]()['then'](respondWithResult(_0x1880e6,null))[_0xa57c('0x50')](handleError(_0x1880e6,null));};exports['getMembers']=function(_0x21b00a,_0x4b3416,_0x39484d){var _0x170187={'raw':!![],'where':{}},_0x398743={},_0x26a8e1;return db['SmsQueue'][_0xa57c('0x52')]({'where':{'id':_0x21b00a[_0xa57c('0x44')]['id']}})[_0xa57c('0x24')](handleEntityNotFound(_0x4b3416,null))[_0xa57c('0x24')](function(_0x3345d5){if(_0x3345d5){_0x26a8e1=_0x3345d5['get']({'plain':!![]});_0x398743[_0xa57c('0x32')]=_[_0xa57c('0x45')](db[_0xa57c('0x53')][_0xa57c('0x2e')]);_0x398743[_0xa57c('0x33')]=_[_0xa57c('0x45')](_0x21b00a[_0xa57c('0x33')]);_0x398743[_0xa57c('0x34')]=_[_0xa57c('0x35')](_0x398743[_0xa57c('0x32')],_0x398743['query']);_0x170187[_0xa57c('0x37')]=_[_0xa57c('0x35')](_0x398743[_0xa57c('0x32')],qs[_0xa57c('0x36')](_0x21b00a[_0xa57c('0x33')][_0xa57c('0x36')]));_0x170187['attributes']=_0x170187[_0xa57c('0x37')][_0xa57c('0x38')]?_0x170187['attributes']:_0x398743[_0xa57c('0x32')];if(!_0x21b00a[_0xa57c('0x33')][_0xa57c('0x39')](_0xa57c('0x3a'))){_0x170187[_0xa57c('0x3b')]=qs[_0xa57c('0x3b')](_0x21b00a[_0xa57c('0x33')]['limit']);_0x170187[_0xa57c('0x1e')]=qs['offset'](_0x21b00a[_0xa57c('0x33')]['offset']);}_0x170187[_0xa57c('0x3c')]=qs['sort'](_0x21b00a[_0xa57c('0x33')][_0xa57c('0x54')]);_0x170187['where']=qs[_0xa57c('0x34')](_[_0xa57c('0x55')](_0x21b00a[_0xa57c('0x33')],_0x398743[_0xa57c('0x34')]));_0x170187['where'][_0xa57c('0x56')]=_0x3345d5['id'];if(_0x21b00a[_0xa57c('0x33')][_0xa57c('0x3e')]){_0x170187[_0xa57c('0x3d')]=_[_0xa57c('0x3f')](_0x170187[_0xa57c('0x3d')],{'$or':_[_0xa57c('0x2d')](_0x170187[_0xa57c('0x37')],function(_0x11c13e){var _0x428ac0={};_0x428ac0[_0x11c13e]={'$like':'%'+_0x21b00a[_0xa57c('0x33')][_0xa57c('0x3e')]+'%'};return _0x428ac0;})});}_0x170187=_[_0xa57c('0x3f')]({},_0x170187,_0x21b00a[_0xa57c('0x41')]);return db[_0xa57c('0x53')][_0xa57c('0x57')](_0x170187);}})['then'](function(_0x393119){if(_0x393119){return db['User'][_0xa57c('0x58')]({'where':{'id':_[_0xa57c('0x2d')](_0x393119,_0xa57c('0x59')),'role':'agent'},'attributes':['id',_0xa57c('0x2b'),_0xa57c('0x5a'),_0xa57c('0x5b'),'createdAt']});}})['then'](function(_0x20ff5f){if(_0x20ff5f){return{'count':_0x20ff5f[_0xa57c('0x1d')],'rows':_[_0xa57c('0x2d')](_0x20ff5f[_0xa57c('0x43')],function(_0x3fd9aa){return{'membername':_0x3fd9aa[_0xa57c('0x2b')],'UserId':_0x3fd9aa['id'],'queue_name':_0x26a8e1[_0xa57c('0x2b')],'SmsQueueId':_0x26a8e1['id'],'interface':util[_0xa57c('0x5c')](_0xa57c('0x5d'),'SIP',_0x3fd9aa[_0xa57c('0x2b')]),'penalty':0x0,'paused':_0x3fd9aa[_0xa57c('0x5a')],'createdAt':_0x3fd9aa['createdAt'],'updatedAt':_0x3fd9aa[_0xa57c('0x5b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa57c('0x24')](respondWithFilteredResult(_0x4b3416,_0x170187))[_0xa57c('0x50')](handleError(_0x4b3416,null));};exports[_0xa57c('0x5e')]=function(_0x1bb561,_0x28ec46,_0x42763b){var _0x10616e={};var _0x5a457d={};var _0x2960fd;var _0x29bf7f;return db['SmsQueue'][_0xa57c('0x52')]({'where':{'id':_0x1bb561[_0xa57c('0x44')]['id']}})['then'](handleEntityNotFound(_0x28ec46,null))['then'](function(_0x30dac7){if(_0x30dac7){_0x2960fd=_0x30dac7;_0x5a457d[_0xa57c('0x32')]=_[_0xa57c('0x45')](db[_0xa57c('0x5f')][_0xa57c('0x2e')]);_0x5a457d['query']=_[_0xa57c('0x45')](_0x1bb561[_0xa57c('0x33')]);_0x5a457d[_0xa57c('0x34')]=_['intersection'](_0x5a457d[_0xa57c('0x32')],_0x5a457d['query']);_0x10616e[_0xa57c('0x37')]=_[_0xa57c('0x35')](_0x5a457d[_0xa57c('0x32')],qs[_0xa57c('0x36')](_0x1bb561['query'][_0xa57c('0x36')]));_0x10616e[_0xa57c('0x37')]=_0x10616e[_0xa57c('0x37')][_0xa57c('0x38')]?_0x10616e['attributes']:_0x5a457d[_0xa57c('0x32')];_0x10616e[_0xa57c('0x3c')]=qs[_0xa57c('0x54')](_0x1bb561['query'][_0xa57c('0x54')]);_0x10616e[_0xa57c('0x3d')]=qs[_0xa57c('0x34')](_['pick'](_0x1bb561[_0xa57c('0x33')],_0x5a457d[_0xa57c('0x34')]));if(_0x1bb561[_0xa57c('0x33')][_0xa57c('0x3e')]){_0x10616e['where']=_[_0xa57c('0x3f')](_0x10616e[_0xa57c('0x3d')],{'$or':_['map'](_0x10616e[_0xa57c('0x37')],function(_0x1157ea){var _0x59d2a2={};_0x59d2a2[_0x1157ea]={'$like':'%'+_0x1bb561[_0xa57c('0x33')]['filter']+'%'};return _0x59d2a2;})});}_0x10616e=_[_0xa57c('0x3f')]({},_0x10616e,_0x1bb561[_0xa57c('0x41')]);return _0x2960fd[_0xa57c('0x5e')](_0x10616e);}})[_0xa57c('0x24')](function(_0x599408){if(_0x599408){_0x29bf7f=_0x599408[_0xa57c('0x38')];if(!_0x1bb561[_0xa57c('0x33')][_0xa57c('0x39')](_0xa57c('0x3a'))){_0x10616e[_0xa57c('0x3b')]=qs[_0xa57c('0x3b')](_0x1bb561[_0xa57c('0x33')][_0xa57c('0x3b')]);_0x10616e[_0xa57c('0x1e')]=qs[_0xa57c('0x1e')](_0x1bb561[_0xa57c('0x33')]['offset']);}return _0x2960fd['getTeams'](_0x10616e);}})['then'](function(_0x29b491){if(_0x29b491){return _0x29b491?{'count':_0x29bf7f,'rows':_0x29b491}:null;}})['then'](respondWithResult(_0x28ec46,null))[_0xa57c('0x50')](handleError(_0x28ec46,null));};exports[_0xa57c('0x60')]=function(_0x193705,_0x4c543a,_0x21c428){var _0x3e7946=_0x193705[_0xa57c('0x49')][_0xa57c('0x61')];return db[_0xa57c('0x5f')][_0xa57c('0x57')]({'where':{'id':_0x3e7946},'attributes':['id'],'include':[{'model':db[_0xa57c('0x62')],'as':'Agents','attributes':['id',_0xa57c('0x2b'),_0xa57c('0x63'),'voicePause','interface'],'raw':!![]}]})[_0xa57c('0x24')](function(_0x201983){if(_0x201983){var _0x4fc97e=_['flatMap'](_0x201983,function(_0xc5f17e){var _0x4962ae=_0xc5f17e[_0xa57c('0x26')]({'plain':!![]});return _0x4962ae[_0xa57c('0x64')];});return db['SmsQueue'][_0xa57c('0x4f')]({'where':{'id':_0x193705[_0xa57c('0x44')]['id']}})[_0xa57c('0x24')](function(_0x3df8f5){return db[_0xa57c('0x65')]['transaction'](function(_0x17fc78){return _0x3df8f5['addTeams'](_0x3e7946,{'transaction':_0x17fc78})[_0xa57c('0x24')](function(){return BPromise[_0xa57c('0x66')](_0x4fc97e,function(_0x4a2b64){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4a2b64['id'],'SmsQueueId':_0x193705[_0xa57c('0x44')]['id']},'transaction':_0x17fc78});});})['then'](function(){_0x4fc97e['forEach'](function(_0x175253){socket[_0xa57c('0x67')](_0xa57c('0x68'),{'UserId':_0x175253['id'],'SmsQueueId':_0x3df8f5['id']});});});});});}})['then'](respondWithStatusCode(_0x4c543a,null))[_0xa57c('0x50')](handleError(_0x4c543a,null));};exports[_0xa57c('0x69')]=function(_0x11e592,_0x5bbb59,_0x4b8228){return db[_0xa57c('0x5f')]['findAll']({'where':{'id':_0x11e592[_0xa57c('0x33')][_0xa57c('0x61')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa57c('0x64'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5bbb59,null))['then'](function(_0x5db013){var _0x6825df=_['map'](_0x5db013,'id');var _0x5143c0=[];var _0x542194=[];var _0x3e12e5=squel[_0xa57c('0x6a')]();_0x3e12e5['field'](_0xa57c('0x6b'))[_0xa57c('0x6c')](_0xa57c('0x6d'),'tq')['join'](_0xa57c('0x6e'),'ut',_0xa57c('0x6f'))[_0xa57c('0x3d')](_0xa57c('0x70'),_0x11e592['params']['id']);for(var _0x5e0db8=0x0;_0x5e0db8<_0x5db013[_0xa57c('0x38')];_0x5e0db8+=0x1){let _0x512e3d=_0x5db013[_0x5e0db8];for(var _0x121343=0x0;_0x121343<_0x512e3d[_0xa57c('0x64')][_0xa57c('0x38')];_0x121343+=0x1){let _0x4dc6ac=_0x512e3d[_0xa57c('0x64')][_0x121343];var _0x513f24=_0x3e12e5['clone']();_0x513f24[_0xa57c('0x3d')]('ut.UserId\x20=\x20?',_0x4dc6ac['id']);_0x542194[_0xa57c('0x71')](db[_0xa57c('0x65')]['query'](_0x513f24['toString'](),{'type':db[_0xa57c('0x65')][_0xa57c('0x72')]['SELECT']})['then'](function(_0x2550bc){if(_0x2550bc[_0xa57c('0x38')]===0x1){return _0x4dc6ac['id'];}else{var _0xa09ff=_['every'](_[_0xa57c('0x2d')](_0x2550bc,_0xa57c('0x73')),function(_0xb51336){return _[_0xa57c('0x74')](_0x6825df,_0xb51336);});if(_0xa09ff){return _0x4dc6ac['id'];}}}));}}return BPromise[_0xa57c('0x75')](_0x542194)[_0xa57c('0x24')](function(_0x10f1b5){_0x5143c0=_(_0x5143c0)[_0xa57c('0x76')](_0x10f1b5)[_0xa57c('0x77')]()[_0xa57c('0x78')]();return db[_0xa57c('0x42')][_0xa57c('0x4f')]({'where':{'id':_0x11e592[_0xa57c('0x44')]['id']}})['then'](function(_0x89be65){return db[_0xa57c('0x65')][_0xa57c('0x79')](function(_0x107ebd){return _0x89be65[_0xa57c('0x69')](_0x11e592[_0xa57c('0x33')]['ids'],{'transaction':_0x107ebd})['then'](function(){if(!_[_0xa57c('0x7a')](_0x5143c0)){return _0x89be65['removeAgents'](_0x5143c0,{'transaction':_0x107ebd});}})['then'](function(){_0x5143c0[_0xa57c('0x7b')](function(_0x138edd){socket[_0xa57c('0x67')]('userSmsQueue:remove',{'UserId':_0x138edd,'SmsQueueId':_0x89be65['id']});});});});});});})[_0xa57c('0x24')](respondWithStatusCode(_0x5bbb59,null))[_0xa57c('0x50')](handleError(_0x5bbb59,null));};exports[_0xa57c('0x7c')]=function(_0x2c0db4,_0x3eb06d,_0x4cabef){return db['SmsQueue'][_0xa57c('0x4f')]({'where':{'id':_0x2c0db4[_0xa57c('0x44')]['id']}})[_0xa57c('0x24')](handleEntityNotFound(_0x3eb06d,null))['then'](function(_0x3f2152){if(_0x3f2152){return _0x3f2152['addAgents'](_0x2c0db4[_0xa57c('0x49')][_0xa57c('0x61')],_[_0xa57c('0x7d')](_0x2c0db4[_0xa57c('0x49')],[_0xa57c('0x61'),'id'])||{})[_0xa57c('0x7e')](function(_0xda3db4){for(var _0x5c76b0=0x0;_0x5c76b0<_0x2c0db4['body'][_0xa57c('0x61')][_0xa57c('0x38')];_0x5c76b0+=0x1){socket[_0xa57c('0x67')]('userSmsQueue:save',{'UserId':_0x2c0db4['body'][_0xa57c('0x61')][_0x5c76b0],'SmsQueueId':_0x2c0db4[_0xa57c('0x44')]['id']});}return _0xda3db4;});}})[_0xa57c('0x24')](respondWithResult(_0x3eb06d,null))[_0xa57c('0x50')](handleError(_0x3eb06d,null));};exports[_0xa57c('0x7f')]=function(_0x58a3c9,_0x41ffe3,_0x28dc85){return db[_0xa57c('0x42')]['find']({'where':{'id':_0x58a3c9[_0xa57c('0x44')]['id']}})[_0xa57c('0x24')](handleEntityNotFound(_0x41ffe3,null))['then'](function(_0x1883b8){if(_0x1883b8){return _0x1883b8[_0xa57c('0x7f')](_0x58a3c9[_0xa57c('0x33')][_0xa57c('0x61')])[_0xa57c('0x24')](function(){if(_[_0xa57c('0x80')](_0x58a3c9[_0xa57c('0x33')][_0xa57c('0x61')])){for(var _0x16e745=0x0;_0x16e745<_0x58a3c9['query'][_0xa57c('0x61')][_0xa57c('0x38')];_0x16e745+=0x1){socket[_0xa57c('0x67')](_0xa57c('0x81'),{'UserId':Number(_0x58a3c9['query']['ids'][_0x16e745]),'SmsQueueId':Number(_0x58a3c9[_0xa57c('0x44')]['id'])});}}else{socket['emit'](_0xa57c('0x81'),{'UserId':Number(_0x58a3c9['query'][_0xa57c('0x61')]),'SmsQueueId':Number(_0x58a3c9['params']['id'])});}});}})['then'](respondWithStatusCode(_0x41ffe3,null))[_0xa57c('0x50')](handleError(_0x41ffe3,null));};exports['getAgents']=function(_0x3facda,_0x5a4843,_0x1ecfa9){var _0x3698aa={};var _0x129a89={};var _0x422849;var _0x5abf60;return db['SmsQueue'][_0xa57c('0x52')]({'where':{'id':_0x3facda[_0xa57c('0x44')]['id']}})['then'](handleEntityNotFound(_0x5a4843,null))[_0xa57c('0x24')](function(_0xeb14ed){if(_0xeb14ed){_0x422849=_0xeb14ed;_0x129a89[_0xa57c('0x32')]=_[_0xa57c('0x45')](db[_0xa57c('0x62')][_0xa57c('0x2e')]);_0x129a89[_0xa57c('0x33')]=_[_0xa57c('0x45')](_0x3facda[_0xa57c('0x33')]);_0x129a89[_0xa57c('0x34')]=_['intersection'](_0x129a89['model'],_0x129a89[_0xa57c('0x33')]);_0x3698aa['attributes']=_[_0xa57c('0x35')](_0x129a89[_0xa57c('0x32')],qs[_0xa57c('0x36')](_0x3facda['query'][_0xa57c('0x36')]));_0x3698aa['attributes']=_0x3698aa['attributes'][_0xa57c('0x38')]?_0x3698aa[_0xa57c('0x37')]:_0x129a89[_0xa57c('0x32')];_0x3698aa[_0xa57c('0x3c')]=qs['sort'](_0x3facda[_0xa57c('0x33')]['sort']);_0x3698aa['where']=qs['filters'](_[_0xa57c('0x55')](_0x3facda[_0xa57c('0x33')],_0x129a89[_0xa57c('0x34')]));if(_0x3facda[_0xa57c('0x33')]['filter']){_0x3698aa[_0xa57c('0x3d')]=_['merge'](_0x3698aa[_0xa57c('0x3d')],{'$or':_[_0xa57c('0x2d')](_0x3698aa['attributes'],function(_0x2ca1af){var _0x287b5c={};_0x287b5c[_0x2ca1af]={'$like':'%'+_0x3facda[_0xa57c('0x33')][_0xa57c('0x3e')]+'%'};return _0x287b5c;})});}_0x3698aa=_[_0xa57c('0x3f')]({},_0x3698aa,_0x3facda['options']);return _0x422849[_0xa57c('0x82')](_0x3698aa);}})['then'](function(_0x185ee5){if(_0x185ee5){_0x5abf60=_0x185ee5[_0xa57c('0x38')];if(!_0x3facda[_0xa57c('0x33')][_0xa57c('0x39')](_0xa57c('0x3a'))){_0x3698aa[_0xa57c('0x3b')]=qs[_0xa57c('0x3b')](_0x3facda[_0xa57c('0x33')][_0xa57c('0x3b')]);_0x3698aa[_0xa57c('0x1e')]=qs['offset'](_0x3facda[_0xa57c('0x33')][_0xa57c('0x1e')]);}return _0x422849['getAgents'](_0x3698aa);}})['then'](function(_0x525865){if(_0x525865){return _0x525865?{'count':_0x5abf60,'rows':_0x525865}:null;}})[_0xa57c('0x24')](respondWithResult(_0x5a4843,null))[_0xa57c('0x50')](handleError(_0x5a4843,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 049a199..62c88b6 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 _0xff59=['SmsQueue','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x36a6db,_0x42e8c2){var _0x3b4640=function(_0x5efc01){while(--_0x5efc01){_0x36a6db['push'](_0x36a6db['shift']());}};_0x3b4640(++_0x42e8c2);}(_0xff59,0x196));var _0x9ff5=function(_0x4b6280,_0x4ce01a){_0x4b6280=_0x4b6280-0x0;var _0x292e5d=_0xff59[_0x4b6280];return _0x292e5d;};'use strict';var EventEmitter=require(_0x9ff5('0x0'));var SmsQueue=require(_0x9ff5('0x1'))['db'][_0x9ff5('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9ff5('0x3'),'afterUpdate':_0x9ff5('0x4'),'afterDestroy':_0x9ff5('0x5')};function emitEvent(_0xbac270){return function(_0x4988b7,_0x46386d,_0xd57940){SmsQueueEvents[_0x9ff5('0x6')](_0xbac270+':'+_0x4988b7['id'],_0x4988b7);SmsQueueEvents[_0x9ff5('0x6')](_0xbac270,_0x4988b7);_0xd57940(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x9ff5('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x92e2=['setMaxListeners','save','update','remove','emit','hook','exports','events','SmsQueue'];(function(_0x24f4fc,_0x2997b6){var _0x1b11d3=function(_0x8b8423){while(--_0x8b8423){_0x24f4fc['push'](_0x24f4fc['shift']());}};_0x1b11d3(++_0x2997b6);}(_0x92e2,0x19c));var _0x292e=function(_0x4800bf,_0x3f6aa0){_0x4800bf=_0x4800bf-0x0;var _0x4dc339=_0x92e2[_0x4800bf];return _0x4dc339;};'use strict';var EventEmitter=require(_0x292e('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x292e('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x292e('0x2')](0x0);var events={'afterCreate':_0x292e('0x3'),'afterUpdate':_0x292e('0x4'),'afterDestroy':_0x292e('0x5')};function emitEvent(_0x1aec0a){return function(_0x8a24f2,_0xa46039,_0x47d038){SmsQueueEvents['emit'](_0x1aec0a+':'+_0x8a24f2['id'],_0x8a24f2);SmsQueueEvents[_0x292e('0x6')](_0x1aec0a,_0x8a24f2);_0x47d038(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x292e('0x7')](e,emitEvent(event));}}module[_0x292e('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 035d22c..999fae4 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 _0x22cb=['request-promise','./smsQueue.attributes','sms_queues','lodash','util','api','bluebird'];(function(_0x332dff,_0x292200){var _0x4bff78=function(_0x32a7c3){while(--_0x32a7c3){_0x332dff['push'](_0x332dff['shift']());}};_0x4bff78(++_0x292200);}(_0x22cb,0x1ed));var _0xb22c=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x22cb[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xb22c('0x0'));var util=require(_0xb22c('0x1'));var logger=require('../../config/logger')(_0xb22c('0x2'));var moment=require('moment');var BPromise=require(_0xb22c('0x3'));var rp=require(_0xb22c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb22c('0x5'));module['exports']=function(_0x1981d4,_0x6bf5b3){return _0x1981d4['define']('SmsQueue',attributes,{'tableName':_0xb22c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc068=['api','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','../../config/logger'];(function(_0xd7bae9,_0x53ce66){var _0x3048fe=function(_0x4f49b6){while(--_0x4f49b6){_0xd7bae9['push'](_0xd7bae9['shift']());}};_0x3048fe(++_0x53ce66);}(_0xc068,0xf4));var _0x8c06=function(_0x1d5dde,_0x1c02cc){_0x1d5dde=_0x1d5dde-0x0;var _0x5f59e5=_0xc068[_0x1d5dde];return _0x5f59e5;};'use strict';var _=require(_0x8c06('0x0'));var util=require(_0x8c06('0x1'));var logger=require(_0x8c06('0x2'))(_0x8c06('0x3'));var moment=require('moment');var BPromise=require(_0x8c06('0x4'));var rp=require(_0x8c06('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c06('0x6'));var config=require(_0x8c06('0x7'));var attributes=require(_0x8c06('0x8'));module[_0x8c06('0x9')]=function(_0x2a0caa,_0x5ea6f6){return _0x2a0caa[_0x8c06('0xa')](_0x8c06('0xb'),attributes,{'tableName':_0x8c06('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 91abd66..763df76 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 _0xae0f=['where','attributes','include','map','model','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','options','raw'];(function(_0x4dc370,_0x495989){var _0x3b551d=function(_0xe2b00f){while(--_0xe2b00f){_0x4dc370['push'](_0x4dc370['shift']());}};_0x3b551d(++_0x495989);}(_0xae0f,0x73));var _0xfae0=function(_0x335fcb,_0x4c05ef){_0x335fcb=_0x335fcb-0x0;var _0x3c74e8=_0xae0f[_0x335fcb];return _0x3c74e8;};'use strict';var _=require(_0xfae0('0x0'));var util=require(_0xfae0('0x1'));var moment=require(_0xfae0('0x2'));var BPromise=require(_0xfae0('0x3'));var rs=require(_0xfae0('0x4'));var fs=require('fs');var Redis=require(_0xfae0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfae0('0x6'));var config=require(_0xfae0('0x7'));var jayson=require(_0xfae0('0x8'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xfae0('0x9')](config[_0xfae0('0xa')],{'host':_0xfae0('0xb'),'port':0x18eb});var socket=require(_0xfae0('0xc'))(new Redis(config[_0xfae0('0xa')]));require('./smsQueue.socket')[_0xfae0('0xd')](socket);function respondWithRpcPromise(_0x13e3b1,_0xebddac,_0x1d7662){return new BPromise(function(_0x3a6c95,_0x4145e8){return client['request'](_0x13e3b1,_0x1d7662)[_0xfae0('0xe')](function(_0x4c6b4a){logger[_0xfae0('0xf')](_0xfae0('0x10'),_0xebddac,_0xfae0('0x11'));logger[_0xfae0('0x12')](_0xfae0('0x13'),_0xebddac,_0xfae0('0x11'),JSON[_0xfae0('0x14')](_0x4c6b4a));if(_0x4c6b4a[_0xfae0('0x15')]){if(_0x4c6b4a['error'][_0xfae0('0x16')]===0x1f4){logger[_0xfae0('0x15')](_0xfae0('0x10'),_0xebddac,_0x4c6b4a['error'][_0xfae0('0x17')]);return _0x4145e8(_0x4c6b4a[_0xfae0('0x15')]['message']);}logger['error'](_0xfae0('0x10'),_0xebddac,_0x4c6b4a[_0xfae0('0x15')][_0xfae0('0x17')]);return _0x3a6c95(_0x4c6b4a[_0xfae0('0x15')][_0xfae0('0x17')]);}else{logger[_0xfae0('0xf')]('SmsQueue,\x20%s,\x20%s',_0xebddac,_0xfae0('0x11'));_0x3a6c95(_0x4c6b4a['result']['message']);}})[_0xfae0('0x18')](function(_0x2b6d06){logger[_0xfae0('0x15')](_0xfae0('0x10'),_0xebddac,_0x2b6d06);_0x4145e8(_0x2b6d06);});});}exports[_0xfae0('0x19')]=function(_0x340521){var _0x4422c7=this;return new Promise(function(_0x58b1cb,_0x4d9f23){return db[_0xfae0('0x1a')]['findAll']({'raw':_0x340521[_0xfae0('0x1b')]?_0x340521[_0xfae0('0x1b')][_0xfae0('0x1c')]===undefined?!![]:![]:!![],'where':_0x340521[_0xfae0('0x1b')]?_0x340521['options'][_0xfae0('0x1d')]||null:null,'attributes':_0x340521['options']?_0x340521[_0xfae0('0x1b')][_0xfae0('0x1e')]||null:null,'limit':_0x340521['options']?_0x340521[_0xfae0('0x1b')]['limit']||null:null,'include':_0x340521['options']?_0x340521[_0xfae0('0x1b')][_0xfae0('0x1f')]?_[_0xfae0('0x20')](_0x340521[_0xfae0('0x1b')][_0xfae0('0x1f')],function(_0x2d2120){return{'model':db[_0x2d2120[_0xfae0('0x21')]],'as':_0x2d2120['as'],'attributes':_0x2d2120['attributes'],'include':_0x2d2120[_0xfae0('0x1f')]?_['map'](_0x2d2120['include'],function(_0x160d04){return{'model':db[_0x160d04[_0xfae0('0x21')]],'as':_0x160d04['as'],'attributes':_0x160d04[_0xfae0('0x1e')],'include':_0x160d04['include']?_[_0xfae0('0x20')](_0x160d04[_0xfae0('0x1f')],function(_0x4948cc){return{'model':db[_0x4948cc['model']],'as':_0x4948cc['as'],'attributes':_0x4948cc[_0xfae0('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfae0('0xe')](function(_0x9030c2){logger[_0xfae0('0xf')](_0xfae0('0x19'),_0x340521);logger[_0xfae0('0x12')]('GetSmsQueue',_0x340521,JSON[_0xfae0('0x14')](_0x9030c2));_0x58b1cb(_0x9030c2);})[_0xfae0('0x18')](function(_0x28de92){logger[_0xfae0('0x15')]('GetSmsQueue',_0x28de92[_0xfae0('0x17')],_0x340521);_0x4d9f23(_0x4422c7['error'](0x1f4,_0x28de92[_0xfae0('0x17')]));});});};exports[_0xfae0('0x22')]=function(_0x1cdcec){var _0x1128fb=this;return new Promise(function(_0x4ebbd1,_0x485905){return db[_0xfae0('0x1a')][_0xfae0('0x23')]({'raw':_0x1cdcec[_0xfae0('0x1b')]?_0x1cdcec['options'][_0xfae0('0x1c')]===undefined?!![]:![]:!![],'where':_0x1cdcec[_0xfae0('0x1b')]?_0x1cdcec[_0xfae0('0x1b')][_0xfae0('0x1d')]||null:null,'attributes':_0x1cdcec['options']?_0x1cdcec['options'][_0xfae0('0x1e')]||null:null,'include':_0x1cdcec['options']?_0x1cdcec['options']['include']?_[_0xfae0('0x20')](_0x1cdcec[_0xfae0('0x1b')][_0xfae0('0x1f')],function(_0x14950c){return{'model':db[_0x14950c['model']],'as':_0x14950c['as'],'attributes':_0x14950c[_0xfae0('0x1e')],'include':_0x14950c[_0xfae0('0x1f')]?_[_0xfae0('0x20')](_0x14950c[_0xfae0('0x1f')],function(_0xbcadad){return{'model':db[_0xbcadad[_0xfae0('0x21')]],'as':_0xbcadad['as'],'attributes':_0xbcadad[_0xfae0('0x1e')],'include':_0xbcadad[_0xfae0('0x1f')]?_[_0xfae0('0x20')](_0xbcadad[_0xfae0('0x1f')],function(_0x204351){return{'model':db[_0x204351[_0xfae0('0x21')]],'as':_0x204351['as'],'attributes':_0x204351['attributes']};}):[]};}):[]};}):[]:[]})[_0xfae0('0xe')](function(_0x57a957){logger[_0xfae0('0xf')](_0xfae0('0x22'),_0x1cdcec);logger[_0xfae0('0x12')]('ShowSmsQueue',_0x1cdcec,JSON['stringify'](_0x57a957));_0x4ebbd1(_0x57a957);})[_0xfae0('0x18')](function(_0x48a32f){logger[_0xfae0('0x15')](_0xfae0('0x22'),_0x48a32f['message'],_0x1cdcec);_0x485905(_0x1128fb[_0xfae0('0x15')](0x1f4,_0x48a32f['message']));});});}; \ No newline at end of file +var _0xcc3a=['message','result','catch','GetSmsQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowSmsQueue','SmsQueue','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5a3e69,_0x346f71){var _0x27073b=function(_0x36283e){while(--_0x36283e){_0x5a3e69['push'](_0x5a3e69['shift']());}};_0x27073b(++_0x346f71);}(_0xcc3a,0x15c));var _0xacc3=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0xcc3a[_0x219d87];return _0x22823d;};'use strict';var _=require(_0xacc3('0x0'));var util=require(_0xacc3('0x1'));var moment=require(_0xacc3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xacc3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xacc3('0x4'))(_0xacc3('0x5'));var config=require(_0xacc3('0x6'));var jayson=require(_0xacc3('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xacc3('0x8')]=_[_0xacc3('0x9')](config[_0xacc3('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xacc3('0xa'))(new Redis(config[_0xacc3('0x8')]));require(_0xacc3('0xb'))['register'](socket);function respondWithRpcPromise(_0x1e8dfb,_0x3f24e1,_0xd97931){return new BPromise(function(_0x1cbce3,_0x3ffcd3){return client[_0xacc3('0xc')](_0x1e8dfb,_0xd97931)[_0xacc3('0xd')](function(_0x4a2495){logger[_0xacc3('0xe')](_0xacc3('0xf'),_0x3f24e1,_0xacc3('0x10'));logger[_0xacc3('0x11')](_0xacc3('0x12'),_0x3f24e1,'request\x20sent',JSON[_0xacc3('0x13')](_0x4a2495));if(_0x4a2495[_0xacc3('0x14')]){if(_0x4a2495[_0xacc3('0x14')][_0xacc3('0x15')]===0x1f4){logger['error'](_0xacc3('0xf'),_0x3f24e1,_0x4a2495[_0xacc3('0x14')]['message']);return _0x3ffcd3(_0x4a2495[_0xacc3('0x14')][_0xacc3('0x16')]);}logger[_0xacc3('0x14')](_0xacc3('0xf'),_0x3f24e1,_0x4a2495['error'][_0xacc3('0x16')]);return _0x1cbce3(_0x4a2495[_0xacc3('0x14')][_0xacc3('0x16')]);}else{logger['info'](_0xacc3('0xf'),_0x3f24e1,_0xacc3('0x10'));_0x1cbce3(_0x4a2495[_0xacc3('0x17')][_0xacc3('0x16')]);}})[_0xacc3('0x18')](function(_0x51372c){logger['error'](_0xacc3('0xf'),_0x3f24e1,_0x51372c);_0x3ffcd3(_0x51372c);});});}exports[_0xacc3('0x19')]=function(_0x5d24d3){var _0x412311=this;return new Promise(function(_0xc095dc,_0x3395ab){return db['SmsQueue'][_0xacc3('0x1a')]({'raw':_0x5d24d3[_0xacc3('0x1b')]?_0x5d24d3[_0xacc3('0x1b')][_0xacc3('0x1c')]===undefined?!![]:![]:!![],'where':_0x5d24d3[_0xacc3('0x1b')]?_0x5d24d3[_0xacc3('0x1b')][_0xacc3('0x1d')]||null:null,'attributes':_0x5d24d3[_0xacc3('0x1b')]?_0x5d24d3[_0xacc3('0x1b')]['attributes']||null:null,'limit':_0x5d24d3['options']?_0x5d24d3[_0xacc3('0x1b')][_0xacc3('0x1e')]||null:null,'include':_0x5d24d3[_0xacc3('0x1b')]?_0x5d24d3[_0xacc3('0x1b')][_0xacc3('0x1f')]?_[_0xacc3('0x20')](_0x5d24d3['options'][_0xacc3('0x1f')],function(_0x1c76a8){return{'model':db[_0x1c76a8[_0xacc3('0x21')]],'as':_0x1c76a8['as'],'attributes':_0x1c76a8[_0xacc3('0x22')],'include':_0x1c76a8[_0xacc3('0x1f')]?_[_0xacc3('0x20')](_0x1c76a8[_0xacc3('0x1f')],function(_0x21b6c5){return{'model':db[_0x21b6c5[_0xacc3('0x21')]],'as':_0x21b6c5['as'],'attributes':_0x21b6c5[_0xacc3('0x22')],'include':_0x21b6c5[_0xacc3('0x1f')]?_[_0xacc3('0x20')](_0x21b6c5[_0xacc3('0x1f')],function(_0x2f6c92){return{'model':db[_0x2f6c92['model']],'as':_0x2f6c92['as'],'attributes':_0x2f6c92[_0xacc3('0x22')]};}):[]};}):[]};}):[]:[]})[_0xacc3('0xd')](function(_0x2aff5f){logger[_0xacc3('0xe')](_0xacc3('0x19'),_0x5d24d3);logger[_0xacc3('0x11')]('GetSmsQueue',_0x5d24d3,JSON[_0xacc3('0x13')](_0x2aff5f));_0xc095dc(_0x2aff5f);})[_0xacc3('0x18')](function(_0x27e2c2){logger[_0xacc3('0x14')](_0xacc3('0x19'),_0x27e2c2[_0xacc3('0x16')],_0x5d24d3);_0x3395ab(_0x412311[_0xacc3('0x14')](0x1f4,_0x27e2c2[_0xacc3('0x16')]));});});};exports[_0xacc3('0x23')]=function(_0x2a44bd){var _0x5549ed=this;return new Promise(function(_0x2cdf78,_0x56f61e){return db[_0xacc3('0x24')]['find']({'raw':_0x2a44bd[_0xacc3('0x1b')]?_0x2a44bd[_0xacc3('0x1b')][_0xacc3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2a44bd['options']?_0x2a44bd[_0xacc3('0x1b')]['where']||null:null,'attributes':_0x2a44bd[_0xacc3('0x1b')]?_0x2a44bd[_0xacc3('0x1b')][_0xacc3('0x22')]||null:null,'include':_0x2a44bd[_0xacc3('0x1b')]?_0x2a44bd[_0xacc3('0x1b')][_0xacc3('0x1f')]?_[_0xacc3('0x20')](_0x2a44bd[_0xacc3('0x1b')][_0xacc3('0x1f')],function(_0x27d871){return{'model':db[_0x27d871[_0xacc3('0x21')]],'as':_0x27d871['as'],'attributes':_0x27d871[_0xacc3('0x22')],'include':_0x27d871[_0xacc3('0x1f')]?_[_0xacc3('0x20')](_0x27d871[_0xacc3('0x1f')],function(_0x5b7d64){return{'model':db[_0x5b7d64[_0xacc3('0x21')]],'as':_0x5b7d64['as'],'attributes':_0x5b7d64['attributes'],'include':_0x5b7d64[_0xacc3('0x1f')]?_[_0xacc3('0x20')](_0x5b7d64[_0xacc3('0x1f')],function(_0xaeca62){return{'model':db[_0xaeca62['model']],'as':_0xaeca62['as'],'attributes':_0xaeca62[_0xacc3('0x22')]};}):[]};}):[]};}):[]:[]})[_0xacc3('0xd')](function(_0x53e029){logger[_0xacc3('0xe')](_0xacc3('0x23'),_0x2a44bd);logger[_0xacc3('0x11')](_0xacc3('0x23'),_0x2a44bd,JSON[_0xacc3('0x13')](_0x53e029));_0x2cdf78(_0x53e029);})[_0xacc3('0x18')](function(_0x26f49a){logger[_0xacc3('0x14')](_0xacc3('0x23'),_0x26f49a['message'],_0x2a44bd);_0x56f61e(_0x5549ed['error'](0x1f4,_0x26f49a[_0xacc3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 9e77ae4..6ac0064 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 _0x14f8=['smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener','length'];(function(_0x264cdd,_0x2b698f){var _0x5e7b9e=function(_0xb3a781){while(--_0xb3a781){_0x264cdd['push'](_0x264cdd['shift']());}};_0x5e7b9e(++_0x2b698f);}(_0x14f8,0x189));var _0x814f=function(_0x2042b6,_0x511b0e){_0x2042b6=_0x2042b6-0x0;var _0x5519b7=_0x14f8[_0x2042b6];return _0x5519b7;};'use strict';var SmsQueueEvents=require(_0x814f('0x0'));var events=[_0x814f('0x1'),_0x814f('0x2'),_0x814f('0x3')];function createListener(_0x12f9fe,_0x1d0b42){return function(_0x3cdf73){_0x1d0b42[_0x814f('0x4')](_0x12f9fe,_0x3cdf73);};}function removeListener(_0x2dc95b,_0x60503b){return function(){SmsQueueEvents[_0x814f('0x5')](_0x2dc95b,_0x60503b);};}exports['register']=function(_0x2c99e9){for(var _0x50a399=0x0,_0x1c572d=events[_0x814f('0x6')];_0x50a399<_0x1c572d;_0x50a399++){var _0x2c0bd5=events[_0x50a399];var _0x21fbb5=createListener(_0x814f('0x7')+_0x2c0bd5,_0x2c99e9);SmsQueueEvents['on'](_0x2c0bd5,_0x21fbb5);}}; \ No newline at end of file +var _0xf3c3=['length','smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x3da559,_0x2fa59c){var _0xbf7fea=function(_0x598699){while(--_0x598699){_0x3da559['push'](_0x3da559['shift']());}};_0xbf7fea(++_0x2fa59c);}(_0xf3c3,0x14a));var _0x3f3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf3c3[_0x3dd15e];return _0x231fd0;};'use strict';var SmsQueueEvents=require(_0x3f3c('0x0'));var events=[_0x3f3c('0x1'),_0x3f3c('0x2'),_0x3f3c('0x3')];function createListener(_0x6fa918,_0x350e6b){return function(_0x488706){_0x350e6b[_0x3f3c('0x4')](_0x6fa918,_0x488706);};}function removeListener(_0x349876,_0x4686ee){return function(){SmsQueueEvents[_0x3f3c('0x5')](_0x349876,_0x4686ee);};}exports['register']=function(_0x39ead5){for(var _0x39a48d=0x0,_0x552219=events[_0x3f3c('0x6')];_0x39a48d<_0x552219;_0x39a48d++){var _0x49736b=events[_0x39a48d];var _0x3f8f4a=createListener(_0x3f3c('0x7')+_0x49736b,_0x39ead5);SmsQueueEvents['on'](_0x49736b,_0x3f8f4a);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6061c51..1a312d8 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 _0xcbf2=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','/describe','isAuthenticated','describe','post','create','put','/:id','update','delete','destroy'];(function(_0x3482a8,_0x1472e7){var _0x5c0db6=function(_0x1f05c5){while(--_0x1f05c5){_0x3482a8['push'](_0x3482a8['shift']());}};_0x5c0db6(++_0x1472e7);}(_0xcbf2,0x119));var _0x2cbf=function(_0x52ff45,_0xf649d2){_0x52ff45=_0x52ff45-0x0;var _0x24b5a1=_0xcbf2[_0x52ff45];return _0x24b5a1;};'use strict';var multer=require(_0x2cbf('0x0'));var util=require(_0x2cbf('0x1'));var path=require(_0x2cbf('0x2'));var timeout=require(_0x2cbf('0x3'));var express=require(_0x2cbf('0x4'));var router=express['Router']();var auth=require(_0x2cbf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2cbf('0x6'));var controller=require(_0x2cbf('0x7'));router[_0x2cbf('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x2cbf('0x9'),auth[_0x2cbf('0xa')](),controller[_0x2cbf('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2cbf('0xc')]('/',auth[_0x2cbf('0xa')](),controller[_0x2cbf('0xd')]);router[_0x2cbf('0xe')](_0x2cbf('0xf'),auth[_0x2cbf('0xa')](),controller[_0x2cbf('0x10')]);router[_0x2cbf('0x11')](_0x2cbf('0xf'),auth['isAuthenticated'](),controller[_0x2cbf('0x12')]);module[_0x2cbf('0x13')]=router; \ No newline at end of file +var _0x295e=['express','Router','../../components/auth/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','delete','destroy','multer','util','path'];(function(_0x2e914,_0x1c7566){var _0x936e45=function(_0x1b22e4){while(--_0x1b22e4){_0x2e914['push'](_0x2e914['shift']());}};_0x936e45(++_0x1c7566);}(_0x295e,0x18c));var _0xe295=function(_0x348467,_0x5ec66b){_0x348467=_0x348467-0x0;var _0x2d5789=_0x295e[_0x348467];return _0x2d5789;};'use strict';var multer=require(_0xe295('0x0'));var util=require(_0xe295('0x1'));var path=require(_0xe295('0x2'));var timeout=require('connect-timeout');var express=require(_0xe295('0x3'));var router=express[_0xe295('0x4')]();var auth=require(_0xe295('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe295('0x6'));var controller=require(_0xe295('0x7'));router['get']('/',auth[_0xe295('0x8')](),controller[_0xe295('0x9')]);router[_0xe295('0xa')](_0xe295('0xb'),auth[_0xe295('0x8')](),controller[_0xe295('0xc')]);router['get'](_0xe295('0xd'),auth['isAuthenticated'](),controller[_0xe295('0xe')]);router[_0xe295('0xf')]('/',auth[_0xe295('0x8')](),controller['create']);router[_0xe295('0x10')]('/:id',auth[_0xe295('0x8')](),controller['update']);router[_0xe295('0x11')]('/:id',auth[_0xe295('0x8')](),controller[_0xe295('0x12')]);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 19a1818..6b33a8c 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 _0x866c=['exports','STRING','DATE','moment'];(function(_0x52afb2,_0x108961){var _0x28f94c=function(_0x418276){while(--_0x418276){_0x52afb2['push'](_0x52afb2['shift']());}};_0x28f94c(++_0x108961);}(_0x866c,0x167));var _0xc866=function(_0x1fba5a,_0x6c359a){_0x1fba5a=_0x1fba5a-0x0;var _0x4889fd=_0x866c[_0x1fba5a];return _0x4889fd;};'use strict';var moment=require(_0xc866('0x0'));var Sequelize=require('sequelize');module[_0xc866('0x1')]={'uniqueid':{'type':Sequelize[_0xc866('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xc866('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc866('0x3')]},'reason':{'type':Sequelize[_0xc866('0x2')]}}; \ No newline at end of file +var _0x7a56=['STRING','DATE','sequelize','exports'];(function(_0x562279,_0x248089){var _0x585afb=function(_0x437980){while(--_0x437980){_0x562279['push'](_0x562279['shift']());}};_0x585afb(++_0x248089);}(_0x7a56,0x17e));var _0x67a5=function(_0x16f440,_0x499247){_0x16f440=_0x16f440-0x0;var _0x5ef5be=_0x7a56[_0x16f440];return _0x5ef5be;};'use strict';var moment=require('moment');var Sequelize=require(_0x67a5('0x0'));module[_0x67a5('0x1')]={'uniqueid':{'type':Sequelize[_0x67a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x67a5('0x3')]},'leaveAt':{'type':Sequelize[_0x67a5('0x3')]},'acceptAt':{'type':Sequelize[_0x67a5('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x67a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 32c6d78..866e32d 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 _0x03de=['api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','Content-Range','apply','reject','update','then','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','rows','catch','params','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x20f4af,_0x4163e6){var _0x20b7ed=function(_0x6defaa){while(--_0x6defaa){_0x20f4af['push'](_0x20f4af['shift']());}};_0x20b7ed(++_0x4163e6);}(_0x03de,0x7a));var _0xe03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03de[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe03d('0x0'));var emlformat=require(_0xe03d('0x1'));var rimraf=require(_0xe03d('0x2'));var zipdir=require(_0xe03d('0x3'));var jsonpatch=require(_0xe03d('0x4'));var rp=require(_0xe03d('0x5'));var moment=require(_0xe03d('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xe03d('0x7'));var util=require(_0xe03d('0x8'));var path=require(_0xe03d('0x9'));var sox=require(_0xe03d('0xa'));var csv=require('to-csv');var ejs=require(_0xe03d('0xb'));var fs=require('fs');var _=require(_0xe03d('0xc'));var squel=require(_0xe03d('0xd'));var crypto=require(_0xe03d('0xe'));var jsforce=require(_0xe03d('0xf'));var deskjs=require(_0xe03d('0x10'));var toCsv=require(_0xe03d('0x11'));var querystring=require('querystring');var Papa=require(_0xe03d('0x12'));var Redis=require('ioredis');var authService=require(_0xe03d('0x13'));var qs=require(_0xe03d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe03d('0x15'));var logger=require('../../config/logger')(_0xe03d('0x16'));var utils=require(_0xe03d('0x17'));var config=require(_0xe03d('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe27aa0,_0x13e818){_0x13e818=_0x13e818||0xcc;return function(_0x5dd2eb){if(_0x5dd2eb){return _0xe27aa0[_0xe03d('0x19')](_0x13e818);}return _0xe27aa0[_0xe03d('0x1a')](_0x13e818)[_0xe03d('0x1b')]();};}function respondWithResult(_0x1f0b54,_0x5a4f12){_0x5a4f12=_0x5a4f12||0xc8;return function(_0x5d5fa1){if(_0x5d5fa1){return _0x1f0b54[_0xe03d('0x1a')](_0x5a4f12)['json'](_0x5d5fa1);}};}function respondWithFilteredResult(_0x6afece,_0x2dfce3){return function(_0x16affe){if(_0x16affe){var _0x18d52b=_0x16affe[_0xe03d('0x1c')],_0x1b671a=_0x2dfce3[_0xe03d('0x1d')],_0x405a14=_0x2dfce3[_0xe03d('0x1d')]+_0x2dfce3['limit'],_0x677f9e;if(_0x405a14>=_0x18d52b){_0x405a14=_0x18d52b;_0x677f9e=0xc8;}else{_0x677f9e=0xce;}_0x6afece[_0xe03d('0x1a')](_0x677f9e);return _0x6afece['set'](_0xe03d('0x1e'),_0x1b671a+'-'+_0x405a14+'/'+_0x18d52b)['json'](_0x16affe);}return null;};}function patchUpdates(_0x122a4e){return function(_0x40f7c3){try{jsonpatch[_0xe03d('0x1f')](_0x40f7c3,_0x122a4e,!![]);}catch(_0x311d94){return BPromise[_0xe03d('0x20')](_0x311d94);}return _0x40f7c3['save']();};}function saveUpdates(_0x8f4cc6,_0x4e7156){return function(_0x4085ac){if(_0x4085ac){return _0x4085ac[_0xe03d('0x21')](_0x8f4cc6)['then'](function(_0x480282){return _0x480282;});}return null;};}function removeEntity(_0x28db58,_0x51cc72){return function(_0x2d3b1c){if(_0x2d3b1c){return _0x2d3b1c['destroy']()[_0xe03d('0x22')](function(){_0x28db58[_0xe03d('0x1a')](0xcc)[_0xe03d('0x1b')]();});}};}function handleEntityNotFound(_0x4640ae,_0x2a0490){return function(_0x5ef0f8){if(!_0x5ef0f8){_0x4640ae['sendStatus'](0x194);}return _0x5ef0f8;};}function handleError(_0xf1e777,_0x325f0e){_0x325f0e=_0x325f0e||0x1f4;return function(_0x75b16e){logger['error'](_0x75b16e[_0xe03d('0x23')]);if(_0x75b16e[_0xe03d('0x24')]){delete _0x75b16e[_0xe03d('0x24')];}_0xf1e777[_0xe03d('0x1a')](_0x325f0e)['send'](_0x75b16e);};}exports[_0xe03d('0x25')]=function(_0x1805ee,_0x424c5a){var _0x1acc16={},_0x2b3545={},_0x2e9d82={'count':0x0,'rows':[]};var _0x2a5606=_[_0xe03d('0x26')](db[_0xe03d('0x27')][_0xe03d('0x28')],function(_0x4fcea0){return{'name':_0x4fcea0[_0xe03d('0x29')],'type':_0x4fcea0[_0xe03d('0x2a')]['key']};});_0x2b3545[_0xe03d('0x2b')]=_[_0xe03d('0x26')](_0x2a5606,_0xe03d('0x24'));_0x2b3545[_0xe03d('0x2c')]=_[_0xe03d('0x2d')](_0x1805ee['query']);_0x2b3545[_0xe03d('0x2e')]=_[_0xe03d('0x2f')](_0x2b3545[_0xe03d('0x2b')],_0x2b3545[_0xe03d('0x2c')]);_0x1acc16[_0xe03d('0x30')]=_[_0xe03d('0x2f')](_0x2b3545[_0xe03d('0x2b')],qs['fields'](_0x1805ee[_0xe03d('0x2c')][_0xe03d('0x31')]));_0x1acc16['attributes']=_0x1acc16[_0xe03d('0x30')][_0xe03d('0x32')]?_0x1acc16[_0xe03d('0x30')]:_0x2b3545[_0xe03d('0x2b')];if(!_0x1805ee[_0xe03d('0x2c')][_0xe03d('0x33')](_0xe03d('0x34'))){_0x1acc16[_0xe03d('0x35')]=qs[_0xe03d('0x35')](_0x1805ee['query'][_0xe03d('0x35')]);_0x1acc16['offset']=qs[_0xe03d('0x1d')](_0x1805ee['query'][_0xe03d('0x1d')]);}_0x1acc16[_0xe03d('0x36')]=qs[_0xe03d('0x37')](_0x1805ee[_0xe03d('0x2c')][_0xe03d('0x37')]);_0x1acc16[_0xe03d('0x38')]=qs[_0xe03d('0x2e')](_[_0xe03d('0x39')](_0x1805ee[_0xe03d('0x2c')],_0x2b3545['filters']));if(_0x1805ee['query']['filter']){_0x1acc16[_0xe03d('0x38')]=_['merge'](_0x1acc16[_0xe03d('0x38')],{'$or':_['map'](_0x2a5606,function(_0x2c1df6){if(_0x2c1df6[_0xe03d('0x2a')]!==_0xe03d('0x3a')){var _0x37c305={};_0x37c305[_0x2c1df6[_0xe03d('0x24')]]={'$like':'%'+_0x1805ee['query'][_0xe03d('0x3b')]+'%'};return _0x37c305;}})});}_0x1acc16=_[_0xe03d('0x3c')]({},_0x1acc16,_0x1805ee['options']);var _0x3f4366={'where':_0x1acc16[_0xe03d('0x38')]};return db[_0xe03d('0x27')]['count'](_0x3f4366)[_0xe03d('0x22')](function(_0x22088e){_0x2e9d82['count']=_0x22088e;if(_0x1805ee[_0xe03d('0x2c')][_0xe03d('0x3d')]){_0x1acc16[_0xe03d('0x3e')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x1acc16);})[_0xe03d('0x22')](function(_0x444d83){_0x2e9d82[_0xe03d('0x3f')]=_0x444d83;return _0x2e9d82;})[_0xe03d('0x22')](respondWithFilteredResult(_0x424c5a,_0x1acc16))[_0xe03d('0x40')](handleError(_0x424c5a,null));};exports['show']=function(_0x2bd6ee,_0x6a6bc1){var _0x282405={'raw':!![],'where':{'id':_0x2bd6ee[_0xe03d('0x41')]['id']}},_0x5917bd={};_0x5917bd['model']=_[_0xe03d('0x2d')](db[_0xe03d('0x27')][_0xe03d('0x28')]);_0x5917bd[_0xe03d('0x2c')]=_['keys'](_0x2bd6ee['query']);_0x5917bd['filters']=_[_0xe03d('0x2f')](_0x5917bd[_0xe03d('0x2b')],_0x5917bd[_0xe03d('0x2c')]);_0x282405[_0xe03d('0x30')]=_['intersection'](_0x5917bd['model'],qs[_0xe03d('0x31')](_0x2bd6ee[_0xe03d('0x2c')][_0xe03d('0x31')]));_0x282405[_0xe03d('0x30')]=_0x282405['attributes'][_0xe03d('0x32')]?_0x282405[_0xe03d('0x30')]:_0x5917bd[_0xe03d('0x2b')];if(_0x2bd6ee[_0xe03d('0x2c')][_0xe03d('0x3d')]){_0x282405['include']=[{'all':!![]}];}_0x282405=_[_0xe03d('0x3c')]({},_0x282405,_0x2bd6ee[_0xe03d('0x42')]);return db[_0xe03d('0x27')][_0xe03d('0x43')](_0x282405)['then'](handleEntityNotFound(_0x6a6bc1,null))['then'](respondWithResult(_0x6a6bc1,null))[_0xe03d('0x40')](handleError(_0x6a6bc1,null));};exports[_0xe03d('0x44')]=function(_0x2ed80b,_0xeb9b48){return db[_0xe03d('0x27')]['create'](_0x2ed80b[_0xe03d('0x45')],{})[_0xe03d('0x22')](respondWithResult(_0xeb9b48,0xc9))['catch'](handleError(_0xeb9b48,null));};exports[_0xe03d('0x21')]=function(_0x58d946,_0x4c46df){if(_0x58d946[_0xe03d('0x45')]['id']){delete _0x58d946[_0xe03d('0x45')]['id'];}return db[_0xe03d('0x27')]['find']({'where':{'id':_0x58d946[_0xe03d('0x41')]['id']}})[_0xe03d('0x22')](handleEntityNotFound(_0x4c46df,null))[_0xe03d('0x22')](saveUpdates(_0x58d946[_0xe03d('0x45')],null))['then'](respondWithResult(_0x4c46df,null))[_0xe03d('0x40')](handleError(_0x4c46df,null));};exports[_0xe03d('0x46')]=function(_0x516171,_0x58592a){return db[_0xe03d('0x27')]['find']({'where':{'id':_0x516171['params']['id']}})[_0xe03d('0x22')](handleEntityNotFound(_0x58592a,null))[_0xe03d('0x22')](removeEntity(_0x58592a,null))[_0xe03d('0x40')](handleError(_0x58592a,null));};exports[_0xe03d('0x47')]=function(_0x541bba,_0x1b5ec1){return db['SmsQueueReport'][_0xe03d('0x47')]()[_0xe03d('0x22')](respondWithResult(_0x1b5ec1,null))[_0xe03d('0x40')](handleError(_0x1b5ec1,null));}; \ No newline at end of file +var _0x14c7=['sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','include','create','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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'];(function(_0x308897,_0x301609){var _0x15f49c=function(_0x3f3848){while(--_0x3f3848){_0x308897['push'](_0x308897['shift']());}};_0x15f49c(++_0x301609);}(_0x14c7,0x148));var _0x714c=function(_0x4cc25c,_0x14c186){_0x4cc25c=_0x4cc25c-0x0;var _0x5f5766=_0x14c7[_0x4cc25c];return _0x5f5766;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x714c('0x0'));var zipdir=require(_0x714c('0x1'));var jsonpatch=require(_0x714c('0x2'));var rp=require(_0x714c('0x3'));var moment=require(_0x714c('0x4'));var BPromise=require(_0x714c('0x5'));var Mustache=require(_0x714c('0x6'));var util=require(_0x714c('0x7'));var path=require('path');var sox=require(_0x714c('0x8'));var csv=require(_0x714c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x714c('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x714c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x714c('0xc'));var Redis=require('ioredis');var authService=require(_0x714c('0xd'));var qs=require(_0x714c('0xe'));var as=require(_0x714c('0xf'));var hardwareService=require(_0x714c('0x10'));var logger=require(_0x714c('0x11'))(_0x714c('0x12'));var utils=require(_0x714c('0x13'));var config=require(_0x714c('0x14'));var db=require(_0x714c('0x15'))['db'];function respondWithStatusCode(_0x4383d7,_0x1914fa){_0x1914fa=_0x1914fa||0xcc;return function(_0x206842){if(_0x206842){return _0x4383d7[_0x714c('0x16')](_0x1914fa);}return _0x4383d7[_0x714c('0x17')](_0x1914fa)[_0x714c('0x18')]();};}function respondWithResult(_0x4d15e4,_0x3b8b3c){_0x3b8b3c=_0x3b8b3c||0xc8;return function(_0x28f02b){if(_0x28f02b){return _0x4d15e4[_0x714c('0x17')](_0x3b8b3c)['json'](_0x28f02b);}};}function respondWithFilteredResult(_0x3403a5,_0x237dad){return function(_0x240ab2){if(_0x240ab2){var _0x5f0e8b=_0x240ab2[_0x714c('0x19')],_0x3e4426=_0x237dad[_0x714c('0x1a')],_0x365dd1=_0x237dad[_0x714c('0x1a')]+_0x237dad[_0x714c('0x1b')],_0x24507e;if(_0x365dd1>=_0x5f0e8b){_0x365dd1=_0x5f0e8b;_0x24507e=0xc8;}else{_0x24507e=0xce;}_0x3403a5[_0x714c('0x17')](_0x24507e);return _0x3403a5[_0x714c('0x1c')](_0x714c('0x1d'),_0x3e4426+'-'+_0x365dd1+'/'+_0x5f0e8b)[_0x714c('0x1e')](_0x240ab2);}return null;};}function patchUpdates(_0x545b22){return function(_0x557443){try{jsonpatch['apply'](_0x557443,_0x545b22,!![]);}catch(_0x3b26f1){return BPromise[_0x714c('0x1f')](_0x3b26f1);}return _0x557443[_0x714c('0x20')]();};}function saveUpdates(_0x35961a,_0x1d98d4){return function(_0x9fafab){if(_0x9fafab){return _0x9fafab[_0x714c('0x21')](_0x35961a)[_0x714c('0x22')](function(_0x14c68c){return _0x14c68c;});}return null;};}function removeEntity(_0x34cb7a,_0x3756af){return function(_0x1a96c1){if(_0x1a96c1){return _0x1a96c1[_0x714c('0x23')]()[_0x714c('0x22')](function(){_0x34cb7a['status'](0xcc)[_0x714c('0x18')]();});}};}function handleEntityNotFound(_0x48bb8c,_0x5f1c32){return function(_0x16d13c){if(!_0x16d13c){_0x48bb8c[_0x714c('0x16')](0x194);}return _0x16d13c;};}function handleError(_0x111c31,_0x21d984){_0x21d984=_0x21d984||0x1f4;return function(_0x534443){logger['error'](_0x534443[_0x714c('0x24')]);if(_0x534443[_0x714c('0x25')]){delete _0x534443['name'];}_0x111c31[_0x714c('0x17')](_0x21d984)[_0x714c('0x26')](_0x534443);};}exports[_0x714c('0x27')]=function(_0x40d928,_0x120743){var _0x52f3dd={},_0x3fd275={},_0x426d5c={'count':0x0,'rows':[]};var _0x919074=_['map'](db[_0x714c('0x28')][_0x714c('0x29')],function(_0x2dd290){return{'name':_0x2dd290[_0x714c('0x2a')],'type':_0x2dd290[_0x714c('0x2b')]['key']};});_0x3fd275[_0x714c('0x2c')]=_[_0x714c('0x2d')](_0x919074,_0x714c('0x25'));_0x3fd275['query']=_[_0x714c('0x2e')](_0x40d928[_0x714c('0x2f')]);_0x3fd275[_0x714c('0x30')]=_[_0x714c('0x31')](_0x3fd275[_0x714c('0x2c')],_0x3fd275['query']);_0x52f3dd['attributes']=_[_0x714c('0x31')](_0x3fd275[_0x714c('0x2c')],qs[_0x714c('0x32')](_0x40d928[_0x714c('0x2f')][_0x714c('0x32')]));_0x52f3dd[_0x714c('0x33')]=_0x52f3dd[_0x714c('0x33')][_0x714c('0x34')]?_0x52f3dd['attributes']:_0x3fd275['model'];if(!_0x40d928[_0x714c('0x2f')][_0x714c('0x35')](_0x714c('0x36'))){_0x52f3dd[_0x714c('0x1b')]=qs['limit'](_0x40d928[_0x714c('0x2f')][_0x714c('0x1b')]);_0x52f3dd[_0x714c('0x1a')]=qs[_0x714c('0x1a')](_0x40d928[_0x714c('0x2f')][_0x714c('0x1a')]);}_0x52f3dd['order']=qs['sort'](_0x40d928[_0x714c('0x2f')][_0x714c('0x37')]);_0x52f3dd[_0x714c('0x38')]=qs[_0x714c('0x30')](_[_0x714c('0x39')](_0x40d928[_0x714c('0x2f')],_0x3fd275['filters']));if(_0x40d928['query'][_0x714c('0x3a')]){_0x52f3dd[_0x714c('0x38')]=_[_0x714c('0x3b')](_0x52f3dd['where'],{'$or':_[_0x714c('0x2d')](_0x919074,function(_0x2ce84b){if(_0x2ce84b[_0x714c('0x2b')]!=='VIRTUAL'){var _0xab6977={};_0xab6977[_0x2ce84b[_0x714c('0x25')]]={'$like':'%'+_0x40d928[_0x714c('0x2f')]['filter']+'%'};return _0xab6977;}})});}_0x52f3dd=_['merge']({},_0x52f3dd,_0x40d928[_0x714c('0x3c')]);var _0x2ebb90={'where':_0x52f3dd[_0x714c('0x38')]};return db[_0x714c('0x28')][_0x714c('0x19')](_0x2ebb90)['then'](function(_0x198dfe){_0x426d5c[_0x714c('0x19')]=_0x198dfe;if(_0x40d928['query'][_0x714c('0x3d')]){_0x52f3dd['include']=[{'all':!![]}];}return db[_0x714c('0x28')]['findAll'](_0x52f3dd);})[_0x714c('0x22')](function(_0x366a9d){_0x426d5c[_0x714c('0x3e')]=_0x366a9d;return _0x426d5c;})[_0x714c('0x22')](respondWithFilteredResult(_0x120743,_0x52f3dd))[_0x714c('0x3f')](handleError(_0x120743,null));};exports[_0x714c('0x40')]=function(_0x202070,_0x5ad4f2){var _0x239449={'raw':!![],'where':{'id':_0x202070[_0x714c('0x41')]['id']}},_0x3314f1={};_0x3314f1[_0x714c('0x2c')]=_[_0x714c('0x2e')](db[_0x714c('0x28')][_0x714c('0x29')]);_0x3314f1['query']=_[_0x714c('0x2e')](_0x202070['query']);_0x3314f1['filters']=_[_0x714c('0x31')](_0x3314f1[_0x714c('0x2c')],_0x3314f1['query']);_0x239449[_0x714c('0x33')]=_['intersection'](_0x3314f1[_0x714c('0x2c')],qs['fields'](_0x202070[_0x714c('0x2f')][_0x714c('0x32')]));_0x239449[_0x714c('0x33')]=_0x239449['attributes'][_0x714c('0x34')]?_0x239449['attributes']:_0x3314f1[_0x714c('0x2c')];if(_0x202070[_0x714c('0x2f')][_0x714c('0x3d')]){_0x239449[_0x714c('0x42')]=[{'all':!![]}];}_0x239449=_[_0x714c('0x3b')]({},_0x239449,_0x202070[_0x714c('0x3c')]);return db['SmsQueueReport']['find'](_0x239449)[_0x714c('0x22')](handleEntityNotFound(_0x5ad4f2,null))[_0x714c('0x22')](respondWithResult(_0x5ad4f2,null))['catch'](handleError(_0x5ad4f2,null));};exports[_0x714c('0x43')]=function(_0x1b0e78,_0x3169db){return db[_0x714c('0x28')][_0x714c('0x43')](_0x1b0e78[_0x714c('0x44')],{})[_0x714c('0x22')](respondWithResult(_0x3169db,0xc9))[_0x714c('0x3f')](handleError(_0x3169db,null));};exports[_0x714c('0x21')]=function(_0x3010e7,_0x2f1220){if(_0x3010e7[_0x714c('0x44')]['id']){delete _0x3010e7[_0x714c('0x44')]['id'];}return db[_0x714c('0x28')]['find']({'where':{'id':_0x3010e7['params']['id']}})[_0x714c('0x22')](handleEntityNotFound(_0x2f1220,null))['then'](saveUpdates(_0x3010e7[_0x714c('0x44')],null))['then'](respondWithResult(_0x2f1220,null))[_0x714c('0x3f')](handleError(_0x2f1220,null));};exports[_0x714c('0x23')]=function(_0x2fd191,_0x58f09b){return db[_0x714c('0x28')][_0x714c('0x45')]({'where':{'id':_0x2fd191['params']['id']}})[_0x714c('0x22')](handleEntityNotFound(_0x58f09b,null))[_0x714c('0x22')](removeEntity(_0x58f09b,null))[_0x714c('0x3f')](handleError(_0x58f09b,null));};exports['describe']=function(_0x577945,_0x585e23){return db[_0x714c('0x28')]['describe']()[_0x714c('0x22')](respondWithResult(_0x585e23,null))[_0x714c('0x3f')](handleError(_0x585e23,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b185677..919cfdf 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 _0xc17c=['../../config/environment','./smsQueueReport.attributes','exports','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4947bf,_0x334f29){var _0x1f5f13=function(_0x28dea4){while(--_0x28dea4){_0x4947bf['push'](_0x4947bf['shift']());}};_0x1f5f13(++_0x334f29);}(_0xc17c,0x17f));var _0xcc17=function(_0x1ee361,_0x2d0b1b){_0x1ee361=_0x1ee361-0x0;var _0x591542=_0xc17c[_0x1ee361];return _0x591542;};'use strict';var _=require('lodash');var util=require(_0xcc17('0x0'));var logger=require(_0xcc17('0x1'))(_0xcc17('0x2'));var moment=require(_0xcc17('0x3'));var BPromise=require(_0xcc17('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc17('0x5'));var rimraf=require(_0xcc17('0x6'));var config=require(_0xcc17('0x7'));var attributes=require(_0xcc17('0x8'));module[_0xcc17('0x9')]=function(_0x256248,_0x291626){return _0x256248['define'](_0xcc17('0xa'),attributes,{'tableName':_0xcc17('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcc17('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0f61=['bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','util','moment'];(function(_0x552f57,_0xb5c93a){var _0x599df2=function(_0x49c29e){while(--_0x49c29e){_0x552f57['push'](_0x552f57['shift']());}};_0x599df2(++_0xb5c93a);}(_0x0f61,0xa6));var _0x10f6=function(_0x39a080,_0x5bdef4){_0x39a080=_0x39a080-0x0;var _0x58cb9e=_0x0f61[_0x39a080];return _0x58cb9e;};'use strict';var _=require('lodash');var util=require(_0x10f6('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x10f6('0x1'));var BPromise=require(_0x10f6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10f6('0x3'));var rimraf=require(_0x10f6('0x4'));var config=require(_0x10f6('0x5'));var attributes=require(_0x10f6('0x6'));module[_0x10f6('0x7')]=function(_0x3f7624,_0x14defc){return _0x3f7624[_0x10f6('0x8')](_0x10f6('0x9'),attributes,{'tableName':_0x10f6('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x10f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 93df46d..4a3d160 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 _0x6943=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','catch','update','where','attributes','limit','debug','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1aa89b,_0x2d5c5b){var _0x5f00c5=function(_0x525577){while(--_0x525577){_0x1aa89b['push'](_0x1aa89b['shift']());}};_0x5f00c5(++_0x2d5c5b);}(_0x6943,0xf6));var _0x3694=function(_0x19ef2b,_0x354f66){_0x19ef2b=_0x19ef2b-0x0;var _0x4df537=_0x6943[_0x19ef2b];return _0x4df537;};'use strict';var _=require(_0x3694('0x0'));var util=require(_0x3694('0x1'));var moment=require(_0x3694('0x2'));var BPromise=require(_0x3694('0x3'));var rs=require(_0x3694('0x4'));var fs=require('fs');var Redis=require(_0x3694('0x5'));var db=require(_0x3694('0x6'))['db'];var utils=require(_0x3694('0x7'));var logger=require(_0x3694('0x8'))(_0x3694('0x9'));var config=require(_0x3694('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3694('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51d870,_0xb5ee2f,_0x256204){return new BPromise(function(_0x3ec18a,_0x479c5a){return client[_0x3694('0xc')](_0x51d870,_0x256204)[_0x3694('0xd')](function(_0x597d2c){logger['info'](_0x3694('0xe'),_0xb5ee2f,_0x3694('0xf'));logger['debug'](_0x3694('0x10'),_0xb5ee2f,'request\x20sent',JSON[_0x3694('0x11')](_0x597d2c));if(_0x597d2c['error']){if(_0x597d2c[_0x3694('0x12')][_0x3694('0x13')]===0x1f4){logger[_0x3694('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0xb5ee2f,_0x597d2c[_0x3694('0x12')][_0x3694('0x14')]);return _0x479c5a(_0x597d2c['error'][_0x3694('0x14')]);}logger[_0x3694('0x12')](_0x3694('0xe'),_0xb5ee2f,_0x597d2c[_0x3694('0x12')][_0x3694('0x14')]);return _0x3ec18a(_0x597d2c[_0x3694('0x12')][_0x3694('0x14')]);}else{logger[_0x3694('0x15')](_0x3694('0xe'),_0xb5ee2f,_0x3694('0xf'));_0x3ec18a(_0x597d2c[_0x3694('0x16')][_0x3694('0x14')]);}})['catch'](function(_0x5523fd){logger[_0x3694('0x12')](_0x3694('0xe'),_0xb5ee2f,_0x5523fd);_0x479c5a(_0x5523fd);});});}exports[_0x3694('0x17')]=function(_0x50a0eb){var _0x1bb03d=this;return new Promise(function(_0x40ede4,_0xaf7c99){return db[_0x3694('0x18')][_0x3694('0x19')](_0x50a0eb[_0x3694('0x1a')],{'raw':_0x50a0eb[_0x3694('0x1b')]?_0x50a0eb[_0x3694('0x1b')][_0x3694('0x1c')]===undefined?!![]:![]:!![]})[_0x3694('0xd')](function(_0x27d64f){logger[_0x3694('0x15')]('CreateSmsQueueReport',_0x50a0eb);logger['debug'](_0x3694('0x17'),_0x50a0eb,JSON[_0x3694('0x11')](_0x27d64f));_0x40ede4(_0x27d64f);})[_0x3694('0x1d')](function(_0x53dc2c){logger[_0x3694('0x12')](_0x3694('0x17'),_0x53dc2c[_0x3694('0x14')],_0x50a0eb);_0xaf7c99(_0x1bb03d[_0x3694('0x12')](0x1f4,_0x53dc2c[_0x3694('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x5729fd){var _0x5bb4a9=this;return new Promise(function(_0x10f205,_0x5547a6){return db[_0x3694('0x18')][_0x3694('0x1e')](_0x5729fd[_0x3694('0x1a')],{'raw':_0x5729fd[_0x3694('0x1b')]?_0x5729fd[_0x3694('0x1b')][_0x3694('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5729fd[_0x3694('0x1b')]?_0x5729fd[_0x3694('0x1b')][_0x3694('0x1f')]||null:null,'attributes':_0x5729fd[_0x3694('0x1b')]?_0x5729fd[_0x3694('0x1b')][_0x3694('0x20')]||null:null,'limit':_0x5729fd[_0x3694('0x1b')]?_0x5729fd[_0x3694('0x1b')][_0x3694('0x21')]||null:null})[_0x3694('0xd')](function(_0x59364a){logger[_0x3694('0x15')]('UpdateSmsQueueReport',_0x5729fd);logger[_0x3694('0x22')](_0x3694('0x23'),_0x5729fd,JSON[_0x3694('0x11')](_0x59364a));_0x10f205(_0x59364a);})[_0x3694('0x1d')](function(_0x11edb0){logger[_0x3694('0x12')](_0x3694('0x23'),_0x11edb0[_0x3694('0x14')],_0x5729fd);_0x5547a6(_0x5bb4a9[_0x3694('0x12')](0x1f4,_0x11edb0[_0x3694('0x14')]));});});}; \ No newline at end of file +var _0xafac=['stringify','error','code','message','CreateSmsQueueReport','create','options','debug','UpdateSmsQueueReport','SmsQueueReport','update','body','attributes','limit','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x39cd3c,_0xa21102){var _0x47a0ae=function(_0x330b05){while(--_0x330b05){_0x39cd3c['push'](_0x39cd3c['shift']());}};_0x47a0ae(++_0xa21102);}(_0xafac,0x1cf));var _0xcafa=function(_0x1f3ca1,_0x35f925){_0x1f3ca1=_0x1f3ca1-0x0;var _0x243ec7=_0xafac[_0x1f3ca1];return _0x243ec7;};'use strict';var _=require(_0xcafa('0x0'));var util=require('util');var moment=require(_0xcafa('0x1'));var BPromise=require(_0xcafa('0x2'));var rs=require(_0xcafa('0x3'));var fs=require('fs');var Redis=require(_0xcafa('0x4'));var db=require(_0xcafa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcafa('0x6'))(_0xcafa('0x7'));var config=require(_0xcafa('0x8'));var jayson=require(_0xcafa('0x9'));var client=jayson['client'][_0xcafa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x260ed2,_0x21d70c,_0x11d26e){return new BPromise(function(_0x1e79a2,_0x43d586){return client[_0xcafa('0xb')](_0x260ed2,_0x11d26e)[_0xcafa('0xc')](function(_0x4007eb){logger[_0xcafa('0xd')](_0xcafa('0xe'),_0x21d70c,_0xcafa('0xf'));logger['debug'](_0xcafa('0x10'),_0x21d70c,'request\x20sent',JSON[_0xcafa('0x11')](_0x4007eb));if(_0x4007eb[_0xcafa('0x12')]){if(_0x4007eb[_0xcafa('0x12')][_0xcafa('0x13')]===0x1f4){logger[_0xcafa('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x21d70c,_0x4007eb['error']['message']);return _0x43d586(_0x4007eb[_0xcafa('0x12')]['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x21d70c,_0x4007eb[_0xcafa('0x12')][_0xcafa('0x14')]);return _0x1e79a2(_0x4007eb[_0xcafa('0x12')][_0xcafa('0x14')]);}else{logger[_0xcafa('0xd')](_0xcafa('0xe'),_0x21d70c,_0xcafa('0xf'));_0x1e79a2(_0x4007eb['result'][_0xcafa('0x14')]);}})['catch'](function(_0x5078f0){logger[_0xcafa('0x12')](_0xcafa('0xe'),_0x21d70c,_0x5078f0);_0x43d586(_0x5078f0);});});}exports[_0xcafa('0x15')]=function(_0x5027a7){var _0x425ae4=this;return new Promise(function(_0x11d1ee,_0x46d48e){return db['SmsQueueReport'][_0xcafa('0x16')](_0x5027a7['body'],{'raw':_0x5027a7[_0xcafa('0x17')]?_0x5027a7[_0xcafa('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xcafa('0xc')](function(_0x47cafd){logger[_0xcafa('0xd')](_0xcafa('0x15'),_0x5027a7);logger[_0xcafa('0x18')](_0xcafa('0x15'),_0x5027a7,JSON[_0xcafa('0x11')](_0x47cafd));_0x11d1ee(_0x47cafd);})['catch'](function(_0x44ab12){logger[_0xcafa('0x12')](_0xcafa('0x15'),_0x44ab12[_0xcafa('0x14')],_0x5027a7);_0x46d48e(_0x425ae4[_0xcafa('0x12')](0x1f4,_0x44ab12[_0xcafa('0x14')]));});});};exports[_0xcafa('0x19')]=function(_0x110534){var _0x232e5e=this;return new Promise(function(_0x4377be,_0x4df0e6){return db[_0xcafa('0x1a')][_0xcafa('0x1b')](_0x110534[_0xcafa('0x1c')],{'raw':_0x110534[_0xcafa('0x17')]?_0x110534[_0xcafa('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x110534[_0xcafa('0x17')]?_0x110534[_0xcafa('0x17')]['where']||null:null,'attributes':_0x110534[_0xcafa('0x17')]?_0x110534[_0xcafa('0x17')][_0xcafa('0x1d')]||null:null,'limit':_0x110534[_0xcafa('0x17')]?_0x110534[_0xcafa('0x17')][_0xcafa('0x1e')]||null:null})['then'](function(_0x4c0413){logger[_0xcafa('0xd')]('UpdateSmsQueueReport',_0x110534);logger[_0xcafa('0x18')](_0xcafa('0x19'),_0x110534,JSON[_0xcafa('0x11')](_0x4c0413));_0x4377be(_0x4c0413);})[_0xcafa('0x1f')](function(_0x53e6d5){logger['error'](_0xcafa('0x19'),_0x53e6d5[_0xcafa('0x14')],_0x110534);_0x4df0e6(_0x232e5e[_0xcafa('0x12')](0x1f4,_0x53e6d5[_0xcafa('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 2878d4d..9d30da3 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 _0xb03e=['describe','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x9296f6,_0x220382){var _0x43d0d2=function(_0x8ffbbc){while(--_0x8ffbbc){_0x9296f6['push'](_0x9296f6['shift']());}};_0x43d0d2(++_0x220382);}(_0xb03e,0x1eb));var _0xeb03=function(_0x3ecb83,_0x232272){_0x3ecb83=_0x3ecb83-0x0;var _0x49817e=_0xb03e[_0x3ecb83];return _0x49817e;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var auth=require(_0xeb03('0x5'));var interaction=require(_0xeb03('0x6'));var config=require(_0xeb03('0x7'));var controller=require(_0xeb03('0x8'));router[_0xeb03('0x9')]('/',auth[_0xeb03('0xa')](),controller[_0xeb03('0xb')]);router['get'](_0xeb03('0xc'),auth[_0xeb03('0xa')](),controller[_0xeb03('0xd')]);router[_0xeb03('0x9')](_0xeb03('0xe'),auth[_0xeb03('0xa')](),controller['show']);router[_0xeb03('0xf')]('/',auth[_0xeb03('0xa')](),controller[_0xeb03('0x10')]);router['put'](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router[_0xeb03('0x12')](_0xeb03('0xe'),auth[_0xeb03('0xa')](),controller[_0xeb03('0x13')]);module[_0xeb03('0x14')]=router; \ No newline at end of file +var _0x2547=['../../config/environment','get','isAuthenticated','index','describe','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x80bc3a,_0x139f7b){var _0x230e8d=function(_0x31f61a){while(--_0x31f61a){_0x80bc3a['push'](_0x80bc3a['shift']());}};_0x230e8d(++_0x139f7b);}(_0x2547,0x1cd));var _0x7254=function(_0x3cf966,_0x46604e){_0x3cf966=_0x3cf966-0x0;var _0x46e03a=_0x2547[_0x3cf966];return _0x46e03a;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var auth=require(_0x7254('0x5'));var interaction=require(_0x7254('0x6'));var config=require(_0x7254('0x7'));var controller=require('./smsTransferReport.controller');router[_0x7254('0x8')]('/',auth[_0x7254('0x9')](),controller[_0x7254('0xa')]);router[_0x7254('0x8')]('/describe',auth[_0x7254('0x9')](),controller[_0x7254('0xb')]);router[_0x7254('0x8')]('/:id',auth[_0x7254('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x7254('0xc')]);router[_0x7254('0xd')](_0x7254('0xe'),auth[_0x7254('0x9')](),controller[_0x7254('0xf')]);router[_0x7254('0x10')]('/:id',auth[_0x7254('0x9')](),controller['destroy']);module[_0x7254('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 724c543..ce4a274 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 _0xa0ff=['DATE','NOW','exports','STRING','ENUM','queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0ff,0x1dc));var _0xfa0f=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0xa0ff[_0x7148a3];return _0x52f31d;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xfa0f('0x0')]={'uniqueid':{'type':Sequelize[_0xfa0f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xfa0f('0x2')]('account','agent',_0xfa0f('0x3')),'allowNull':![],'defaultValue':_0xfa0f('0x3')},'transferredAt':{'type':Sequelize[_0xfa0f('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xfa0f('0x5')]}}; \ No newline at end of file +var _0x5de1=['agent','queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x5de1,0x130));var _0x15de=function(_0x566301,_0x4dd87b){_0x566301=_0x566301-0x0;var _0xc0994=_0x5de1[_0x566301];return _0xc0994;};'use strict';var moment=require(_0x15de('0x0'));var Sequelize=require(_0x15de('0x1'));module[_0x15de('0x2')]={'uniqueid':{'type':Sequelize[_0x15de('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x15de('0x4')](_0x15de('0x5'),_0x15de('0x6'),_0x15de('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x15de('0x8')],'allowNull':![],'defaultValue':Sequelize[_0x15de('0x9')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 4fc2dd4..d4c9dab 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 _0x22c3=['create','body','params','destroy','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','SmsTransferReport','count','includeAll','findAll','catch'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x22c3,0x132));var _0x322c=function(_0x444c52,_0x1fa6ee){_0x444c52=_0x444c52-0x0;var _0x4de998=_0x22c3[_0x444c52];return _0x4de998;};'use strict';var pdf=require(_0x322c('0x0'));var emlformat=require(_0x322c('0x1'));var rimraf=require(_0x322c('0x2'));var zipdir=require(_0x322c('0x3'));var jsonpatch=require(_0x322c('0x4'));var rp=require(_0x322c('0x5'));var moment=require(_0x322c('0x6'));var BPromise=require(_0x322c('0x7'));var Mustache=require('mustache');var util=require(_0x322c('0x8'));var path=require('path');var sox=require(_0x322c('0x9'));var csv=require(_0x322c('0xa'));var ejs=require(_0x322c('0xb'));var fs=require('fs');var _=require(_0x322c('0xc'));var squel=require(_0x322c('0xd'));var crypto=require(_0x322c('0xe'));var jsforce=require(_0x322c('0xf'));var deskjs=require(_0x322c('0x10'));var toCsv=require(_0x322c('0xa'));var querystring=require(_0x322c('0x11'));var Papa=require(_0x322c('0x12'));var Redis=require(_0x322c('0x13'));var authService=require(_0x322c('0x14'));var qs=require(_0x322c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x322c('0x16'));var logger=require(_0x322c('0x17'))(_0x322c('0x18'));var utils=require(_0x322c('0x19'));var config=require(_0x322c('0x1a'));var db=require(_0x322c('0x1b'))['db'];function respondWithStatusCode(_0x1912a1,_0x114318){_0x114318=_0x114318||0xcc;return function(_0x12206b){if(_0x12206b){return _0x1912a1[_0x322c('0x1c')](_0x114318);}return _0x1912a1[_0x322c('0x1d')](_0x114318)[_0x322c('0x1e')]();};}function respondWithResult(_0x3db564,_0x2bcaa1){_0x2bcaa1=_0x2bcaa1||0xc8;return function(_0x3d9209){if(_0x3d9209){return _0x3db564['status'](_0x2bcaa1)[_0x322c('0x1f')](_0x3d9209);}};}function respondWithFilteredResult(_0x518689,_0x2bee1f){return function(_0x5d21c6){if(_0x5d21c6){var _0x3311a8=_0x5d21c6['count'],_0x311499=_0x2bee1f[_0x322c('0x20')],_0x4c42be=_0x2bee1f[_0x322c('0x20')]+_0x2bee1f['limit'],_0x3a1ed1;if(_0x4c42be>=_0x3311a8){_0x4c42be=_0x3311a8;_0x3a1ed1=0xc8;}else{_0x3a1ed1=0xce;}_0x518689['status'](_0x3a1ed1);return _0x518689[_0x322c('0x21')](_0x322c('0x22'),_0x311499+'-'+_0x4c42be+'/'+_0x3311a8)['json'](_0x5d21c6);}return null;};}function patchUpdates(_0x51917d){return function(_0xc3e081){try{jsonpatch[_0x322c('0x23')](_0xc3e081,_0x51917d,!![]);}catch(_0x2fdc6c){return BPromise[_0x322c('0x24')](_0x2fdc6c);}return _0xc3e081[_0x322c('0x25')]();};}function saveUpdates(_0x50ec90,_0x4a7023){return function(_0x39a47e){if(_0x39a47e){return _0x39a47e[_0x322c('0x26')](_0x50ec90)['then'](function(_0x2605bc){return _0x2605bc;});}return null;};}function removeEntity(_0x29ce83,_0x23a9e3){return function(_0x55b1fa){if(_0x55b1fa){return _0x55b1fa['destroy']()[_0x322c('0x27')](function(){_0x29ce83[_0x322c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fae94,_0x46c51a){return function(_0xabe1d){if(!_0xabe1d){_0x2fae94[_0x322c('0x1c')](0x194);}return _0xabe1d;};}function handleError(_0x14f674,_0x159afa){_0x159afa=_0x159afa||0x1f4;return function(_0x1aa4c0){logger[_0x322c('0x28')](_0x1aa4c0[_0x322c('0x29')]);if(_0x1aa4c0[_0x322c('0x2a')]){delete _0x1aa4c0['name'];}_0x14f674['status'](_0x159afa)[_0x322c('0x2b')](_0x1aa4c0);};}exports['index']=function(_0x2eee24,_0x2e2f82){var _0x5b19a7={},_0x3300d4={},_0x3d3b03={'count':0x0,'rows':[]};var _0x20237a=_[_0x322c('0x2c')](db['SmsTransferReport'][_0x322c('0x2d')],function(_0x37f1c8){return{'name':_0x37f1c8['fieldName'],'type':_0x37f1c8[_0x322c('0x2e')]['key']};});_0x3300d4[_0x322c('0x2f')]=_[_0x322c('0x2c')](_0x20237a,_0x322c('0x2a'));_0x3300d4[_0x322c('0x30')]=_[_0x322c('0x31')](_0x2eee24[_0x322c('0x30')]);_0x3300d4[_0x322c('0x32')]=_[_0x322c('0x33')](_0x3300d4[_0x322c('0x2f')],_0x3300d4[_0x322c('0x30')]);_0x5b19a7[_0x322c('0x34')]=_['intersection'](_0x3300d4[_0x322c('0x2f')],qs[_0x322c('0x35')](_0x2eee24['query'][_0x322c('0x35')]));_0x5b19a7[_0x322c('0x34')]=_0x5b19a7['attributes'][_0x322c('0x36')]?_0x5b19a7['attributes']:_0x3300d4[_0x322c('0x2f')];if(!_0x2eee24[_0x322c('0x30')]['hasOwnProperty'](_0x322c('0x37'))){_0x5b19a7[_0x322c('0x38')]=qs[_0x322c('0x38')](_0x2eee24[_0x322c('0x30')][_0x322c('0x38')]);_0x5b19a7['offset']=qs[_0x322c('0x20')](_0x2eee24['query']['offset']);}_0x5b19a7[_0x322c('0x39')]=qs['sort'](_0x2eee24[_0x322c('0x30')][_0x322c('0x3a')]);_0x5b19a7[_0x322c('0x3b')]=qs['filters'](_['pick'](_0x2eee24[_0x322c('0x30')],_0x3300d4[_0x322c('0x32')]));if(_0x2eee24[_0x322c('0x30')][_0x322c('0x3c')]){_0x5b19a7[_0x322c('0x3b')]=_[_0x322c('0x3d')](_0x5b19a7[_0x322c('0x3b')],{'$or':_[_0x322c('0x2c')](_0x20237a,function(_0x46d1d3){if(_0x46d1d3['type']!==_0x322c('0x3e')){var _0x3a9cec={};_0x3a9cec[_0x46d1d3['name']]={'$like':'%'+_0x2eee24[_0x322c('0x30')][_0x322c('0x3c')]+'%'};return _0x3a9cec;}})});}_0x5b19a7=_[_0x322c('0x3d')]({},_0x5b19a7,_0x2eee24[_0x322c('0x3f')]);var _0x49cd02={'where':_0x5b19a7[_0x322c('0x3b')]};return db[_0x322c('0x40')][_0x322c('0x41')](_0x49cd02)['then'](function(_0x5c5169){_0x3d3b03[_0x322c('0x41')]=_0x5c5169;if(_0x2eee24[_0x322c('0x30')][_0x322c('0x42')]){_0x5b19a7['include']=[{'all':!![]}];}return db[_0x322c('0x40')][_0x322c('0x43')](_0x5b19a7);})[_0x322c('0x27')](function(_0x44e290){_0x3d3b03['rows']=_0x44e290;return _0x3d3b03;})['then'](respondWithFilteredResult(_0x2e2f82,_0x5b19a7))[_0x322c('0x44')](handleError(_0x2e2f82,null));};exports['show']=function(_0x4518aa,_0xe92162){var _0x315f80={'raw':!![],'where':{'id':_0x4518aa['params']['id']}},_0x515618={};_0x515618[_0x322c('0x2f')]=_['keys'](db[_0x322c('0x40')][_0x322c('0x2d')]);_0x515618[_0x322c('0x30')]=_[_0x322c('0x31')](_0x4518aa[_0x322c('0x30')]);_0x515618[_0x322c('0x32')]=_[_0x322c('0x33')](_0x515618[_0x322c('0x2f')],_0x515618[_0x322c('0x30')]);_0x315f80[_0x322c('0x34')]=_[_0x322c('0x33')](_0x515618['model'],qs[_0x322c('0x35')](_0x4518aa[_0x322c('0x30')][_0x322c('0x35')]));_0x315f80[_0x322c('0x34')]=_0x315f80[_0x322c('0x34')][_0x322c('0x36')]?_0x315f80['attributes']:_0x515618['model'];if(_0x4518aa[_0x322c('0x30')]['includeAll']){_0x315f80['include']=[{'all':!![]}];}_0x315f80=_[_0x322c('0x3d')]({},_0x315f80,_0x4518aa[_0x322c('0x3f')]);return db[_0x322c('0x40')]['find'](_0x315f80)[_0x322c('0x27')](handleEntityNotFound(_0xe92162,null))[_0x322c('0x27')](respondWithResult(_0xe92162,null))[_0x322c('0x44')](handleError(_0xe92162,null));};exports[_0x322c('0x45')]=function(_0x3d68ae,_0x10fe71){return db['SmsTransferReport'][_0x322c('0x45')](_0x3d68ae[_0x322c('0x46')],{})['then'](respondWithResult(_0x10fe71,0xc9))[_0x322c('0x44')](handleError(_0x10fe71,null));};exports[_0x322c('0x26')]=function(_0x4253e6,_0x36d797){if(_0x4253e6[_0x322c('0x46')]['id']){delete _0x4253e6['body']['id'];}return db[_0x322c('0x40')]['find']({'where':{'id':_0x4253e6[_0x322c('0x47')]['id']}})[_0x322c('0x27')](handleEntityNotFound(_0x36d797,null))[_0x322c('0x27')](saveUpdates(_0x4253e6[_0x322c('0x46')],null))[_0x322c('0x27')](respondWithResult(_0x36d797,null))[_0x322c('0x44')](handleError(_0x36d797,null));};exports[_0x322c('0x48')]=function(_0x53a0d7,_0x5e14eb){return db[_0x322c('0x40')][_0x322c('0x49')]({'where':{'id':_0x53a0d7[_0x322c('0x47')]['id']}})['then'](handleEntityNotFound(_0x5e14eb,null))[_0x322c('0x27')](removeEntity(_0x5e14eb,null))[_0x322c('0x44')](handleError(_0x5e14eb,null));};exports[_0x322c('0x4a')]=function(_0x487bfa,_0x2cef64){return db[_0x322c('0x40')][_0x322c('0x4a')]()[_0x322c('0x27')](respondWithResult(_0x2cef64,null))['catch'](handleError(_0x2cef64,null));}; \ No newline at end of file +var _0x49b4=['lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','name','index','map','SmsTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','rows','catch','params','includeAll','include','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x4394fa,_0x1364ff){var _0x3ec0ac=function(_0x3b0d96){while(--_0x3b0d96){_0x4394fa['push'](_0x4394fa['shift']());}};_0x3ec0ac(++_0x1364ff);}(_0x49b4,0x10d));var _0x449b=function(_0x48a828,_0x51ffaf){_0x48a828=_0x48a828-0x0;var _0x1d498c=_0x49b4[_0x48a828];return _0x1d498c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x449b('0x0'));var zipdir=require(_0x449b('0x1'));var jsonpatch=require(_0x449b('0x2'));var rp=require('request-promise');var moment=require(_0x449b('0x3'));var BPromise=require(_0x449b('0x4'));var Mustache=require(_0x449b('0x5'));var util=require(_0x449b('0x6'));var path=require(_0x449b('0x7'));var sox=require(_0x449b('0x8'));var csv=require(_0x449b('0x9'));var ejs=require(_0x449b('0xa'));var fs=require('fs');var _=require(_0x449b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x449b('0xc'));var deskjs=require(_0x449b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x449b('0xe'));var Papa=require(_0x449b('0xf'));var Redis=require(_0x449b('0x10'));var authService=require(_0x449b('0x11'));var qs=require(_0x449b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x449b('0x13'));var logger=require(_0x449b('0x14'))(_0x449b('0x15'));var utils=require(_0x449b('0x16'));var config=require(_0x449b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b85d8,_0x167faa){_0x167faa=_0x167faa||0xcc;return function(_0x344887){if(_0x344887){return _0x4b85d8[_0x449b('0x18')](_0x167faa);}return _0x4b85d8[_0x449b('0x19')](_0x167faa)[_0x449b('0x1a')]();};}function respondWithResult(_0x20b703,_0xcdb08f){_0xcdb08f=_0xcdb08f||0xc8;return function(_0x582f51){if(_0x582f51){return _0x20b703[_0x449b('0x19')](_0xcdb08f)[_0x449b('0x1b')](_0x582f51);}};}function respondWithFilteredResult(_0x31ee9c,_0x2a71e2){return function(_0x53d34b){if(_0x53d34b){var _0x28cfd1=_0x53d34b[_0x449b('0x1c')],_0x2fb33d=_0x2a71e2[_0x449b('0x1d')],_0xa8734f=_0x2a71e2[_0x449b('0x1d')]+_0x2a71e2['limit'],_0x2cbfe7;if(_0xa8734f>=_0x28cfd1){_0xa8734f=_0x28cfd1;_0x2cbfe7=0xc8;}else{_0x2cbfe7=0xce;}_0x31ee9c[_0x449b('0x19')](_0x2cbfe7);return _0x31ee9c[_0x449b('0x1e')](_0x449b('0x1f'),_0x2fb33d+'-'+_0xa8734f+'/'+_0x28cfd1)[_0x449b('0x1b')](_0x53d34b);}return null;};}function patchUpdates(_0x4546ef){return function(_0x583c77){try{jsonpatch[_0x449b('0x20')](_0x583c77,_0x4546ef,!![]);}catch(_0x9d0a67){return BPromise['reject'](_0x9d0a67);}return _0x583c77[_0x449b('0x21')]();};}function saveUpdates(_0x23c787,_0x1317c8){return function(_0x50f9cf){if(_0x50f9cf){return _0x50f9cf[_0x449b('0x22')](_0x23c787)[_0x449b('0x23')](function(_0x26641b){return _0x26641b;});}return null;};}function removeEntity(_0x655ae4,_0xa8986f){return function(_0x4aaf64){if(_0x4aaf64){return _0x4aaf64[_0x449b('0x24')]()[_0x449b('0x23')](function(){_0x655ae4[_0x449b('0x19')](0xcc)[_0x449b('0x1a')]();});}};}function handleEntityNotFound(_0x547cb5,_0x1a7ff6){return function(_0x1b3c1a){if(!_0x1b3c1a){_0x547cb5[_0x449b('0x18')](0x194);}return _0x1b3c1a;};}function handleError(_0x247783,_0x20a0dd){_0x20a0dd=_0x20a0dd||0x1f4;return function(_0x265cb1){logger[_0x449b('0x25')](_0x265cb1['stack']);if(_0x265cb1['name']){delete _0x265cb1[_0x449b('0x26')];}_0x247783[_0x449b('0x19')](_0x20a0dd)['send'](_0x265cb1);};}exports[_0x449b('0x27')]=function(_0x28bec0,_0x5d8a54){var _0x365589={},_0x4d9035={},_0x3c9c69={'count':0x0,'rows':[]};var _0x4f1b45=_[_0x449b('0x28')](db[_0x449b('0x29')][_0x449b('0x2a')],function(_0x4b7f70){return{'name':_0x4b7f70['fieldName'],'type':_0x4b7f70[_0x449b('0x2b')][_0x449b('0x2c')]};});_0x4d9035[_0x449b('0x2d')]=_[_0x449b('0x28')](_0x4f1b45,_0x449b('0x26'));_0x4d9035[_0x449b('0x2e')]=_[_0x449b('0x2f')](_0x28bec0['query']);_0x4d9035[_0x449b('0x30')]=_[_0x449b('0x31')](_0x4d9035[_0x449b('0x2d')],_0x4d9035['query']);_0x365589[_0x449b('0x32')]=_[_0x449b('0x31')](_0x4d9035['model'],qs['fields'](_0x28bec0[_0x449b('0x2e')][_0x449b('0x33')]));_0x365589[_0x449b('0x32')]=_0x365589[_0x449b('0x32')]['length']?_0x365589[_0x449b('0x32')]:_0x4d9035['model'];if(!_0x28bec0[_0x449b('0x2e')][_0x449b('0x34')](_0x449b('0x35'))){_0x365589['limit']=qs['limit'](_0x28bec0[_0x449b('0x2e')][_0x449b('0x36')]);_0x365589['offset']=qs[_0x449b('0x1d')](_0x28bec0[_0x449b('0x2e')][_0x449b('0x1d')]);}_0x365589['order']=qs[_0x449b('0x37')](_0x28bec0[_0x449b('0x2e')][_0x449b('0x37')]);_0x365589[_0x449b('0x38')]=qs[_0x449b('0x30')](_[_0x449b('0x39')](_0x28bec0['query'],_0x4d9035['filters']));if(_0x28bec0[_0x449b('0x2e')][_0x449b('0x3a')]){_0x365589['where']=_[_0x449b('0x3b')](_0x365589[_0x449b('0x38')],{'$or':_[_0x449b('0x28')](_0x4f1b45,function(_0x1ccb47){if(_0x1ccb47[_0x449b('0x2b')]!==_0x449b('0x3c')){var _0x48d947={};_0x48d947[_0x1ccb47[_0x449b('0x26')]]={'$like':'%'+_0x28bec0[_0x449b('0x2e')][_0x449b('0x3a')]+'%'};return _0x48d947;}})});}_0x365589=_[_0x449b('0x3b')]({},_0x365589,_0x28bec0[_0x449b('0x3d')]);var _0x387aef={'where':_0x365589[_0x449b('0x38')]};return db['SmsTransferReport'][_0x449b('0x1c')](_0x387aef)[_0x449b('0x23')](function(_0x45fb0d){_0x3c9c69['count']=_0x45fb0d;if(_0x28bec0[_0x449b('0x2e')]['includeAll']){_0x365589['include']=[{'all':!![]}];}return db[_0x449b('0x29')]['findAll'](_0x365589);})['then'](function(_0x374be0){_0x3c9c69[_0x449b('0x3e')]=_0x374be0;return _0x3c9c69;})[_0x449b('0x23')](respondWithFilteredResult(_0x5d8a54,_0x365589))[_0x449b('0x3f')](handleError(_0x5d8a54,null));};exports['show']=function(_0x49f186,_0x46bd5d){var _0x100161={'raw':!![],'where':{'id':_0x49f186[_0x449b('0x40')]['id']}},_0x5a6725={};_0x5a6725[_0x449b('0x2d')]=_[_0x449b('0x2f')](db['SmsTransferReport']['rawAttributes']);_0x5a6725[_0x449b('0x2e')]=_[_0x449b('0x2f')](_0x49f186['query']);_0x5a6725[_0x449b('0x30')]=_[_0x449b('0x31')](_0x5a6725[_0x449b('0x2d')],_0x5a6725[_0x449b('0x2e')]);_0x100161[_0x449b('0x32')]=_[_0x449b('0x31')](_0x5a6725[_0x449b('0x2d')],qs['fields'](_0x49f186[_0x449b('0x2e')][_0x449b('0x33')]));_0x100161[_0x449b('0x32')]=_0x100161[_0x449b('0x32')]['length']?_0x100161[_0x449b('0x32')]:_0x5a6725['model'];if(_0x49f186[_0x449b('0x2e')][_0x449b('0x41')]){_0x100161[_0x449b('0x42')]=[{'all':!![]}];}_0x100161=_[_0x449b('0x3b')]({},_0x100161,_0x49f186[_0x449b('0x3d')]);return db[_0x449b('0x29')][_0x449b('0x43')](_0x100161)[_0x449b('0x23')](handleEntityNotFound(_0x46bd5d,null))[_0x449b('0x23')](respondWithResult(_0x46bd5d,null))[_0x449b('0x3f')](handleError(_0x46bd5d,null));};exports[_0x449b('0x44')]=function(_0x10b500,_0x485ec1){return db[_0x449b('0x29')]['create'](_0x10b500[_0x449b('0x45')],{})['then'](respondWithResult(_0x485ec1,0xc9))['catch'](handleError(_0x485ec1,null));};exports['update']=function(_0x5cfe57,_0x25a22c){if(_0x5cfe57['body']['id']){delete _0x5cfe57[_0x449b('0x45')]['id'];}return db['SmsTransferReport'][_0x449b('0x43')]({'where':{'id':_0x5cfe57[_0x449b('0x40')]['id']}})['then'](handleEntityNotFound(_0x25a22c,null))[_0x449b('0x23')](saveUpdates(_0x5cfe57[_0x449b('0x45')],null))[_0x449b('0x23')](respondWithResult(_0x25a22c,null))[_0x449b('0x3f')](handleError(_0x25a22c,null));};exports[_0x449b('0x24')]=function(_0x44ad62,_0x841a49){return db['SmsTransferReport'][_0x449b('0x43')]({'where':{'id':_0x44ad62[_0x449b('0x40')]['id']}})[_0x449b('0x23')](handleEntityNotFound(_0x841a49,null))[_0x449b('0x23')](removeEntity(_0x841a49,null))[_0x449b('0x3f')](handleError(_0x841a49,null));};exports['describe']=function(_0x4bc46b,_0x28e922){return db[_0x449b('0x29')]['describe']()[_0x449b('0x23')](respondWithResult(_0x28e922,null))['catch'](handleError(_0x28e922,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 83bf7ff..4ee81e0 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 _0x9fd4=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','report_sms_transfer','uniqueid'];(function(_0x3e0191,_0x1d4b20){var _0xf2ae83=function(_0x277210){while(--_0x277210){_0x3e0191['push'](_0x3e0191['shift']());}};_0xf2ae83(++_0x1d4b20);}(_0x9fd4,0x16c));var _0x49fd=function(_0x46306c,_0x1cb39c){_0x46306c=_0x46306c-0x0;var _0x423037=_0x9fd4[_0x46306c];return _0x423037;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('SmsTransferReport',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[{'name':_0x49fd('0xc'),'fields':[_0x49fd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2542=['api','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x3f7e26,_0xd2561){var _0x4db8f2=function(_0x33ecf4){while(--_0x33ecf4){_0x3f7e26['push'](_0x3f7e26['shift']());}};_0x4db8f2(++_0xd2561);}(_0x2542,0x169));var _0x2254=function(_0x30691f,_0x3399df){_0x30691f=_0x30691f-0x0;var _0xa31f5a=_0x2542[_0x30691f];return _0xa31f5a;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var logger=require(_0x2254('0x2'))(_0x2254('0x3'));var moment=require('moment');var BPromise=require(_0x2254('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2254('0x5'));var rimraf=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var attributes=require(_0x2254('0x8'));module[_0x2254('0x9')]=function(_0x508183,_0x19ad3c){return _0x508183[_0x2254('0xa')](_0x2254('0xb'),attributes,{'tableName':_0x2254('0xc'),'paranoid':![],'indexes':[{'name':_0x2254('0xd'),'fields':[_0x2254('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index c43ccbf..9f77cdd 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 _0xa647=['code','SmsTransferReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x185d97,_0x27ae50){var _0x1b050a=function(_0x14c3a0){while(--_0x14c3a0){_0x185d97['push'](_0x185d97['shift']());}};_0x1b050a(++_0x27ae50);}(_0xa647,0x1e5));var _0x7a64=function(_0x47c347,_0xd36c85){_0x47c347=_0x47c347-0x0;var _0x4ac58f=_0xa647[_0x47c347];return _0x4ac58f;};'use strict';var _=require(_0x7a64('0x0'));var util=require(_0x7a64('0x1'));var moment=require(_0x7a64('0x2'));var BPromise=require('bluebird');var rs=require(_0x7a64('0x3'));var fs=require('fs');var Redis=require(_0x7a64('0x4'));var db=require(_0x7a64('0x5'))['db'];var utils=require(_0x7a64('0x6'));var logger=require(_0x7a64('0x7'))(_0x7a64('0x8'));var config=require(_0x7a64('0x9'));var jayson=require(_0x7a64('0xa'));var client=jayson[_0x7a64('0xb')][_0x7a64('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f13aa,_0x16cf89,_0x397dea){return new BPromise(function(_0x410f48,_0x537769){return client[_0x7a64('0xd')](_0x5f13aa,_0x397dea)[_0x7a64('0xe')](function(_0x34fe43){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x16cf89,'request\x20sent');logger['debug'](_0x7a64('0xf'),_0x16cf89,_0x7a64('0x10'),JSON[_0x7a64('0x11')](_0x34fe43));if(_0x34fe43[_0x7a64('0x12')]){if(_0x34fe43[_0x7a64('0x12')][_0x7a64('0x13')]===0x1f4){logger[_0x7a64('0x12')](_0x7a64('0x14'),_0x16cf89,_0x34fe43[_0x7a64('0x12')][_0x7a64('0x15')]);return _0x537769(_0x34fe43[_0x7a64('0x12')][_0x7a64('0x15')]);}logger['error'](_0x7a64('0x14'),_0x16cf89,_0x34fe43[_0x7a64('0x12')][_0x7a64('0x15')]);return _0x410f48(_0x34fe43[_0x7a64('0x12')][_0x7a64('0x15')]);}else{logger[_0x7a64('0x16')](_0x7a64('0x14'),_0x16cf89,'request\x20sent');_0x410f48(_0x34fe43['result'][_0x7a64('0x15')]);}})[_0x7a64('0x17')](function(_0x3bb881){logger[_0x7a64('0x12')](_0x7a64('0x14'),_0x16cf89,_0x3bb881);_0x537769(_0x3bb881);});});} \ No newline at end of file +var _0x9b58=['SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x23c0f0,_0x3ccaee){var _0x445687=function(_0x29aa05){while(--_0x29aa05){_0x23c0f0['push'](_0x23c0f0['shift']());}};_0x445687(++_0x3ccaee);}(_0x9b58,0x9c));var _0x89b5=function(_0x383869,_0x118d3d){_0x383869=_0x383869-0x0;var _0x4846d2=_0x9b58[_0x383869];return _0x4846d2;};'use strict';var _=require(_0x89b5('0x0'));var util=require(_0x89b5('0x1'));var moment=require(_0x89b5('0x2'));var BPromise=require(_0x89b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89b5('0x4'));var db=require(_0x89b5('0x5'))['db'];var utils=require(_0x89b5('0x6'));var logger=require(_0x89b5('0x7'))(_0x89b5('0x8'));var config=require(_0x89b5('0x9'));var jayson=require(_0x89b5('0xa'));var client=jayson[_0x89b5('0xb')][_0x89b5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3526ba,_0x33b219,_0x4d89c3){return new BPromise(function(_0x35bc27,_0x1e2a3c){return client[_0x89b5('0xd')](_0x3526ba,_0x4d89c3)[_0x89b5('0xe')](function(_0x4d6b84){logger[_0x89b5('0xf')](_0x89b5('0x10'),_0x33b219,_0x89b5('0x11'));logger[_0x89b5('0x12')](_0x89b5('0x13'),_0x33b219,_0x89b5('0x11'),JSON[_0x89b5('0x14')](_0x4d6b84));if(_0x4d6b84['error']){if(_0x4d6b84[_0x89b5('0x15')][_0x89b5('0x16')]===0x1f4){logger[_0x89b5('0x15')](_0x89b5('0x10'),_0x33b219,_0x4d6b84['error']['message']);return _0x1e2a3c(_0x4d6b84[_0x89b5('0x15')][_0x89b5('0x17')]);}logger[_0x89b5('0x15')]('SmsTransferReport,\x20%s,\x20%s',_0x33b219,_0x4d6b84[_0x89b5('0x15')][_0x89b5('0x17')]);return _0x35bc27(_0x4d6b84[_0x89b5('0x15')]['message']);}else{logger['info'](_0x89b5('0x10'),_0x33b219,_0x89b5('0x11'));_0x35bc27(_0x4d6b84['result'][_0x89b5('0x17')]);}})[_0x89b5('0x18')](function(_0x2890f9){logger['error'](_0x89b5('0x10'),_0x33b219,_0x2890f9);_0x1e2a3c(_0x2890f9);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index ac72a1d..e0e8050 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 _0x8d9f=['post','file','/:id','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','index','get','isAuthenticated','show','diskStorage','join','root','server/files/sounds/original/','originalname','%s-%s%s','basename','extname'];(function(_0x782e99,_0x3fdc27){var _0x187176=function(_0x82ee8d){while(--_0x82ee8d){_0x782e99['push'](_0x782e99['shift']());}};_0x187176(++_0x3fdc27);}(_0x8d9f,0xa1));var _0xf8d9=function(_0x5a109a,_0x1e71aa){_0x5a109a=_0x5a109a-0x0;var _0x3a5cfc=_0x8d9f[_0x5a109a];return _0x3a5cfc;};'use strict';var multer=require(_0xf8d9('0x0'));var util=require(_0xf8d9('0x1'));var path=require('path');var timeout=require(_0xf8d9('0x2'));var express=require(_0xf8d9('0x3'));var router=express[_0xf8d9('0x4')]();var auth=require(_0xf8d9('0x5'));var interaction=require(_0xf8d9('0x6'));var config=require(_0xf8d9('0x7'));var controller=require(_0xf8d9('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xf8d9('0x9')]);router[_0xf8d9('0xa')]('/:id',auth[_0xf8d9('0xb')](),controller[_0xf8d9('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xf8d9('0xd')]({'destination':function(_0x48268a,_0x4169ed,_0x274d2c){_0x274d2c(null,path[_0xf8d9('0xe')](config[_0xf8d9('0xf')],_0xf8d9('0x10')));},'filename':function(_0x50850d,_0xef0df2,_0x10615f){_0xef0df2[_0xf8d9('0x11')]=_0xef0df2['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x10615f(null,util['format'](_0xf8d9('0x12'),path[_0xf8d9('0x13')](_0xef0df2['originalname'],path['extname'](_0xef0df2[_0xf8d9('0x11')])),Date['now'](),path[_0xf8d9('0x14')](_0xef0df2['originalname'])));}})});router[_0xf8d9('0x15')]('/',upload['single'](_0xf8d9('0x16')),controller['create']);router['put'](_0xf8d9('0x17'),auth[_0xf8d9('0xb')](),controller[_0xf8d9('0x18')]);router['delete'](_0xf8d9('0x17'),auth[_0xf8d9('0xb')](),controller['delete']);module[_0xf8d9('0x19')]=router; \ No newline at end of file +var _0xd036=['replace','%s-%s%s','basename','extname','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','server/files/sounds/original/','originalname'];(function(_0x462a5b,_0x455475){var _0x2fb43e=function(_0x4c0cb2){while(--_0x4c0cb2){_0x462a5b['push'](_0x462a5b['shift']());}};_0x2fb43e(++_0x455475);}(_0xd036,0x148));var _0x6d03=function(_0x42ab91,_0x2a0179){_0x42ab91=_0x42ab91-0x0;var _0x259d35=_0xd036[_0x42ab91];return _0x259d35;};'use strict';var multer=require(_0x6d03('0x0'));var util=require(_0x6d03('0x1'));var path=require(_0x6d03('0x2'));var timeout=require(_0x6d03('0x3'));var express=require(_0x6d03('0x4'));var router=express[_0x6d03('0x5')]();var auth=require(_0x6d03('0x6'));var interaction=require(_0x6d03('0x7'));var config=require(_0x6d03('0x8'));var controller=require('./sound.controller');router[_0x6d03('0x9')]('/',auth[_0x6d03('0xa')](),controller[_0x6d03('0xb')]);router['get'](_0x6d03('0xc'),auth[_0x6d03('0xa')](),controller[_0x6d03('0xd')]);router[_0x6d03('0x9')](_0x6d03('0xe'),auth['isAuthenticated'](),controller[_0x6d03('0xf')]);var upload=multer({'storage':multer[_0x6d03('0x10')]({'destination':function(_0x488a7b,_0x3a129d,_0x489fee){_0x489fee(null,path[_0x6d03('0x11')](config['root'],_0x6d03('0x12')));},'filename':function(_0x41a724,_0x596e30,_0x38f6a3){_0x596e30[_0x6d03('0x13')]=_0x596e30[_0x6d03('0x13')][_0x6d03('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x38f6a3(null,util['format'](_0x6d03('0x15'),path[_0x6d03('0x16')](_0x596e30[_0x6d03('0x13')],path[_0x6d03('0x17')](_0x596e30[_0x6d03('0x13')])),Date['now'](),path[_0x6d03('0x17')](_0x596e30[_0x6d03('0x13')])));}})});router[_0x6d03('0x18')]('/',upload['single']('file'),controller[_0x6d03('0x19')]);router[_0x6d03('0x1a')](_0x6d03('0xc'),auth['isAuthenticated'](),controller[_0x6d03('0x1b')]);router[_0x6d03('0x1c')]('/:id',auth[_0x6d03('0xa')](),controller[_0x6d03('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index f79a5d7..039f264 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 _0x2529=['BIGINT','INTEGER','sequelize','exports','STRING','name','FLOAT'];(function(_0x9cbfe0,_0x56aada){var _0x1f1534=function(_0x422947){while(--_0x422947){_0x9cbfe0['push'](_0x9cbfe0['shift']());}};_0x1f1534(++_0x56aada);}(_0x2529,0x1d7));var _0x9252=function(_0x212939,_0x153e98){_0x212939=_0x212939-0x0;var _0x47b69d=_0x2529[_0x212939];return _0x47b69d;};'use strict';var Sequelize=require(_0x9252('0x0'));module[_0x9252('0x1')]={'name':{'type':Sequelize[_0x9252('0x2')],'unique':_0x9252('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x9252('0x2')]},'display_name':{'type':Sequelize[_0x9252('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x9252('0x2')]},'original_format':{'type':Sequelize[_0x9252('0x2')]},'original_duration':{'type':Sequelize[_0x9252('0x4')]},'original_sampleCount':{'type':Sequelize[_0x9252('0x5')]},'original_channelCount':{'type':Sequelize[_0x9252('0x6')]},'original_bitRate':{'type':Sequelize[_0x9252('0x5')]},'original_sampleRate':{'type':Sequelize[_0x9252('0x6')]},'converted_format':{'type':Sequelize[_0x9252('0x2')]},'converted_duration':{'type':Sequelize[_0x9252('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x9252('0x5')]},'converted_channelCount':{'type':Sequelize[_0x9252('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7bd9=['name','BIGINT','FLOAT','INTEGER','sequelize','exports','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x7bd9,0x146));var _0x97bd=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0x7bd9[_0x12d033];return _0x3b4e80;};'use strict';var Sequelize=require(_0x97bd('0x0'));module[_0x97bd('0x1')]={'name':{'type':Sequelize[_0x97bd('0x2')],'unique':_0x97bd('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x97bd('0x2')]},'display_name':{'type':Sequelize[_0x97bd('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x97bd('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x97bd('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x97bd('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x97bd('0x5')]},'converted_sampleCount':{'type':Sequelize[_0x97bd('0x4')]},'converted_channelCount':{'type':Sequelize[_0x97bd('0x6')]},'converted_bitRate':{'type':Sequelize[_0x97bd('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0d48a5a..2153db7 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 _0x4cc4=['end','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Sound','fieldName','type','key','model','map','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','include','find','params','save_name','converted_format','existsSync','join','root','Sequelize','ValidationError','download','server/files/sounds/converted','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','duration','original_sampleCount','sampleCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','channelCount','converted_bitRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Sounds','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','original_format','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x36740d,_0x35873b){var _0x3aaa43=function(_0x5703b2){while(--_0x5703b2){_0x36740d['push'](_0x36740d['shift']());}};_0x3aaa43(++_0x35873b);}(_0x4cc4,0x15c));var _0x44cc=function(_0x57cb56,_0x507a17){_0x57cb56=_0x57cb56-0x0;var _0x58764e=_0x4cc4[_0x57cb56];return _0x58764e;};'use strict';var pdf=require(_0x44cc('0x0'));var emlformat=require(_0x44cc('0x1'));var rimraf=require(_0x44cc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x44cc('0x3'));var rp=require(_0x44cc('0x4'));var moment=require(_0x44cc('0x5'));var BPromise=require(_0x44cc('0x6'));var Mustache=require('mustache');var util=require(_0x44cc('0x7'));var path=require(_0x44cc('0x8'));var sox=require(_0x44cc('0x9'));var csv=require('to-csv');var ejs=require(_0x44cc('0xa'));var fs=require('fs');var _=require(_0x44cc('0xb'));var squel=require(_0x44cc('0xc'));var crypto=require(_0x44cc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x44cc('0xe'));var querystring=require(_0x44cc('0xf'));var Papa=require(_0x44cc('0x10'));var Redis=require(_0x44cc('0x11'));var authService=require(_0x44cc('0x12'));var qs=require(_0x44cc('0x13'));var as=require(_0x44cc('0x14'));var hardwareService=require(_0x44cc('0x15'));var logger=require(_0x44cc('0x16'))('api');var utils=require(_0x44cc('0x17'));var config=require(_0x44cc('0x18'));var db=require(_0x44cc('0x19'))['db'];function respondWithStatusCode(_0x34b66b,_0x4f1fb9){_0x4f1fb9=_0x4f1fb9||0xcc;return function(_0x2862c1){if(_0x2862c1){return _0x34b66b[_0x44cc('0x1a')](_0x4f1fb9);}return _0x34b66b['status'](_0x4f1fb9)[_0x44cc('0x1b')]();};}function respondWithResult(_0x1e4837,_0x4b5ba1){_0x4b5ba1=_0x4b5ba1||0xc8;return function(_0x1afaca){if(_0x1afaca){return _0x1e4837[_0x44cc('0x1c')](_0x4b5ba1)[_0x44cc('0x1d')](_0x1afaca);}};}function respondWithFilteredResult(_0x3b974e,_0x40fd5b){return function(_0x412d01){if(_0x412d01){var _0x187527=_0x412d01['count'],_0xd5ccc8=_0x40fd5b['offset'],_0x4b4e8e=_0x40fd5b[_0x44cc('0x1e')]+_0x40fd5b[_0x44cc('0x1f')],_0x2df4ce;if(_0x4b4e8e>=_0x187527){_0x4b4e8e=_0x187527;_0x2df4ce=0xc8;}else{_0x2df4ce=0xce;}_0x3b974e[_0x44cc('0x1c')](_0x2df4ce);return _0x3b974e['set'](_0x44cc('0x20'),_0xd5ccc8+'-'+_0x4b4e8e+'/'+_0x187527)['json'](_0x412d01);}return null;};}function patchUpdates(_0x4f88b5){return function(_0x39c65d){try{jsonpatch[_0x44cc('0x21')](_0x39c65d,_0x4f88b5,!![]);}catch(_0x352dec){return BPromise[_0x44cc('0x22')](_0x352dec);}return _0x39c65d[_0x44cc('0x23')]();};}function saveUpdates(_0x2da828,_0x5063d5){return function(_0x26e3f8){if(_0x26e3f8){return _0x26e3f8[_0x44cc('0x24')](_0x2da828)[_0x44cc('0x25')](function(_0x17203c){return _0x17203c;});}return null;};}function removeEntity(_0x236e98,_0x4fa255){return function(_0x27947f){if(_0x27947f){return _0x27947f[_0x44cc('0x26')]()[_0x44cc('0x25')](function(){var _0x3c3186=_0x27947f[_0x44cc('0x27')]({'plain':!![]});var _0x1b3c54='Sounds';return db[_0x44cc('0x28')][_0x44cc('0x26')]({'where':{'type':_0x1b3c54,'resourceId':_0x3c3186['id']}})[_0x44cc('0x25')](function(){return _0x27947f;});})[_0x44cc('0x25')](function(){_0x236e98['status'](0xcc)[_0x44cc('0x1b')]();});}};}function handleEntityNotFound(_0x5bd140,_0x1ccb9f){return function(_0x2d5467){if(!_0x2d5467){_0x5bd140[_0x44cc('0x1a')](0x194);}return _0x2d5467;};}function handleError(_0x103e1f,_0x540d84){_0x540d84=_0x540d84||0x1f4;return function(_0x4ab135){logger[_0x44cc('0x29')](_0x4ab135[_0x44cc('0x2a')]);if(_0x4ab135[_0x44cc('0x2b')]){delete _0x4ab135['name'];}_0x103e1f[_0x44cc('0x1c')](_0x540d84)[_0x44cc('0x2c')](_0x4ab135);};}exports[_0x44cc('0x2d')]=function(_0xa2841e,_0x4ccb3e){var _0x2d2466={},_0x4c5a78={},_0xe94e84={'count':0x0,'rows':[]};var _0x5e6945=_['map'](db[_0x44cc('0x2e')]['rawAttributes'],function(_0x2986cc){return{'name':_0x2986cc[_0x44cc('0x2f')],'type':_0x2986cc[_0x44cc('0x30')][_0x44cc('0x31')]};});_0x4c5a78[_0x44cc('0x32')]=_[_0x44cc('0x33')](_0x5e6945,'name');_0x4c5a78['query']=_[_0x44cc('0x34')](_0xa2841e[_0x44cc('0x35')]);_0x4c5a78['filters']=_['intersection'](_0x4c5a78[_0x44cc('0x32')],_0x4c5a78[_0x44cc('0x35')]);_0x2d2466[_0x44cc('0x36')]=_[_0x44cc('0x37')](_0x4c5a78[_0x44cc('0x32')],qs[_0x44cc('0x38')](_0xa2841e['query'][_0x44cc('0x38')]));_0x2d2466[_0x44cc('0x36')]=_0x2d2466['attributes'][_0x44cc('0x39')]?_0x2d2466[_0x44cc('0x36')]:_0x4c5a78[_0x44cc('0x32')];if(!_0xa2841e['query'][_0x44cc('0x3a')](_0x44cc('0x3b'))){_0x2d2466[_0x44cc('0x1f')]=qs[_0x44cc('0x1f')](_0xa2841e[_0x44cc('0x35')]['limit']);_0x2d2466[_0x44cc('0x1e')]=qs['offset'](_0xa2841e[_0x44cc('0x35')][_0x44cc('0x1e')]);}_0x2d2466[_0x44cc('0x3c')]=qs['sort'](_0xa2841e[_0x44cc('0x35')][_0x44cc('0x3d')]);_0x2d2466[_0x44cc('0x3e')]=qs[_0x44cc('0x3f')](_[_0x44cc('0x40')](_0xa2841e[_0x44cc('0x35')],_0x4c5a78['filters']));if(_0xa2841e[_0x44cc('0x35')][_0x44cc('0x41')]){_0x2d2466[_0x44cc('0x3e')]=_[_0x44cc('0x42')](_0x2d2466['where'],{'$or':_[_0x44cc('0x33')](_0x5e6945,function(_0x12c284){if(_0x12c284[_0x44cc('0x30')]!==_0x44cc('0x43')){var _0x24b398={};_0x24b398[_0x12c284[_0x44cc('0x2b')]]={'$like':'%'+_0xa2841e[_0x44cc('0x35')][_0x44cc('0x41')]+'%'};return _0x24b398;}})});}_0x2d2466=_['merge']({},_0x2d2466,_0xa2841e[_0x44cc('0x44')]);var _0x48c467={'where':_0x2d2466['where']};return db[_0x44cc('0x2e')][_0x44cc('0x45')](_0x48c467)[_0x44cc('0x25')](function(_0x110232){_0xe94e84[_0x44cc('0x45')]=_0x110232;if(_0xa2841e[_0x44cc('0x35')][_0x44cc('0x46')]){_0x2d2466['include']=[{'all':!![]}];}return db['Sound'][_0x44cc('0x47')](_0x2d2466);})[_0x44cc('0x25')](function(_0x48469e){_0xe94e84[_0x44cc('0x48')]=_0x48469e;return _0xe94e84;})[_0x44cc('0x25')](respondWithFilteredResult(_0x4ccb3e,_0x2d2466))[_0x44cc('0x49')](handleError(_0x4ccb3e,null));};exports['show']=function(_0x41bc90,_0x2cd79b){var _0x3fac4a={'raw':!![],'where':{'id':_0x41bc90['params']['id']}},_0xb652ce={};_0xb652ce['model']=_[_0x44cc('0x34')](db['Sound']['rawAttributes']);_0xb652ce[_0x44cc('0x35')]=_[_0x44cc('0x34')](_0x41bc90['query']);_0xb652ce['filters']=_[_0x44cc('0x37')](_0xb652ce['model'],_0xb652ce['query']);_0x3fac4a['attributes']=_['intersection'](_0xb652ce[_0x44cc('0x32')],qs['fields'](_0x41bc90[_0x44cc('0x35')][_0x44cc('0x38')]));_0x3fac4a[_0x44cc('0x36')]=_0x3fac4a[_0x44cc('0x36')][_0x44cc('0x39')]?_0x3fac4a[_0x44cc('0x36')]:_0xb652ce[_0x44cc('0x32')];if(_0x41bc90['query'][_0x44cc('0x46')]){_0x3fac4a[_0x44cc('0x4a')]=[{'all':!![]}];}_0x3fac4a=_[_0x44cc('0x42')]({},_0x3fac4a,_0x41bc90[_0x44cc('0x44')]);return db[_0x44cc('0x2e')]['find'](_0x3fac4a)['then'](handleEntityNotFound(_0x2cd79b,null))[_0x44cc('0x25')](respondWithResult(_0x2cd79b,null))['catch'](handleError(_0x2cd79b,null));};exports['download']=function(_0x51ee14,_0x35d207,_0x5cc1d0){return db[_0x44cc('0x2e')][_0x44cc('0x4b')]({'where':{'id':_0x51ee14[_0x44cc('0x4c')]['id']},'attributes':[_0x44cc('0x2b'),_0x44cc('0x4d'),_0x44cc('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x35d207,null))['then'](function(_0x4bec6d){if(_0x4bec6d){if(!fs[_0x44cc('0x4f')](path[_0x44cc('0x50')](config[_0x44cc('0x51')],'server/files/sounds/converted',_0x4bec6d[_0x44cc('0x4d')]+'.'+_0x4bec6d['converted_format']))){throw new db[(_0x44cc('0x52'))][(_0x44cc('0x53'))]('Sound\x20not\x20found');}return _0x35d207[_0x44cc('0x54')](path[_0x44cc('0x50')](config['root'],_0x44cc('0x55'),util[_0x44cc('0x56')](_0x44cc('0x57'),_0x4bec6d[_0x44cc('0x4d')],_0x4bec6d[_0x44cc('0x4e')])),util[_0x44cc('0x56')](_0x44cc('0x57'),_0x4bec6d['name'],_0x4bec6d['converted_format']));}return null;})[_0x44cc('0x49')](handleError(_0x35d207,null));};exports['create']=function(_0x2465f7,_0x18749b,_0x4f218e){var _0x2a89b7={'name':path[_0x44cc('0x58')](_0x2465f7[_0x44cc('0x59')][_0x44cc('0x5a')],path[_0x44cc('0x5b')](_0x2465f7[_0x44cc('0x59')][_0x44cc('0x5a')])),'save_name':path[_0x44cc('0x58')](_0x2465f7['file'][_0x44cc('0x5c')],path[_0x44cc('0x5b')](_0x2465f7['file']['filename'])),'original_format':path[_0x44cc('0x5b')](_0x2465f7[_0x44cc('0x59')]['originalname'])[_0x44cc('0x5d')](0x1),'converted_format':_0x44cc('0x5e')};var _0x39a6ab=path[_0x44cc('0x50')](config['root'],_0x44cc('0x5f'),_0x2465f7[_0x44cc('0x59')][_0x44cc('0x5c')]);var _0x5d8605=path[_0x44cc('0x50')](config[_0x44cc('0x51')],'server/files/sounds/converted',util['format'](_0x44cc('0x57'),path['basename'](_0x2465f7[_0x44cc('0x59')]['filename'],path[_0x44cc('0x5b')](_0x2465f7['file'][_0x44cc('0x5c')])),_0x2a89b7[_0x44cc('0x4e')]));logger['info'](_0x44cc('0x60'),_0x39a6ab);logger[_0x44cc('0x61')](_0x44cc('0x62'),_0x5d8605);try{fs['chmodSync'](_0x39a6ab,parseInt(_0x44cc('0x63'),0x8));var _0x4ff221=sox[_0x44cc('0x64')](_0x39a6ab,_0x5d8605,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4ff221['on'](_0x44cc('0x29'),function(_0x36937e){fs[_0x44cc('0x65')](_0x39a6ab);_0x18749b[_0x44cc('0x1c')](0x1f4)['send'](_0x36937e);});_0x4ff221['on']('src',function(_0x5c815f){_0x2a89b7['original_duration']=isNaN(_0x5c815f[_0x44cc('0x66')])?null:_0x5c815f[_0x44cc('0x66')]*0x3e8;_0x2a89b7[_0x44cc('0x67')]=isNaN(_0x5c815f[_0x44cc('0x68')])?null:_0x5c815f[_0x44cc('0x68')];_0x2a89b7['original_channelCount']=isNaN(_0x5c815f['channelCount'])?null:_0x5c815f['channelCount'];_0x2a89b7[_0x44cc('0x69')]=isNaN(_0x5c815f[_0x44cc('0x6a')])?null:_0x5c815f['bitRate'];_0x2a89b7[_0x44cc('0x6b')]=isNaN(_0x5c815f[_0x44cc('0x6c')])?null:_0x5c815f[_0x44cc('0x6c')];});_0x4ff221['on'](_0x44cc('0x6d'),function(_0x160239){_0x2a89b7['converted_duration']=isNaN(_0x160239[_0x44cc('0x66')])?null:_0x160239[_0x44cc('0x66')]*0x3e8;_0x2a89b7[_0x44cc('0x6e')]=isNaN(_0x160239[_0x44cc('0x68')])?null:_0x160239[_0x44cc('0x68')];_0x2a89b7[_0x44cc('0x6f')]=isNaN(_0x160239[_0x44cc('0x70')])?null:_0x160239[_0x44cc('0x70')];_0x2a89b7[_0x44cc('0x71')]=isNaN(_0x160239[_0x44cc('0x6a')])?null:_0x160239[_0x44cc('0x6a')];_0x2a89b7['converted_sampleRate']=isNaN(_0x160239[_0x44cc('0x6c')])?null:_0x160239[_0x44cc('0x6c')];});_0x4ff221['on'](_0x44cc('0x1b'),function(){fs['chmodSync'](_0x5d8605,parseInt('0777',0x8));return db[_0x44cc('0x2e')]['create'](_0x2a89b7)[_0x44cc('0x25')](function(_0x4dfcd9){var _0x133dad={'role':_0x2465f7['body'][_0x44cc('0x72')],'userProfileId':_0x2465f7[_0x44cc('0x73')][_0x44cc('0x74')]};if(!_0x133dad)throw new Error(_0x44cc('0x75'));if(_0x133dad[_0x44cc('0x72')]===_0x44cc('0x76')){var _0x579289=_0x4dfcd9[_0x44cc('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x44cc('0x4b')]({'where':{'name':_0x44cc('0x77'),'userProfileId':_0x133dad[_0x44cc('0x74')]},'raw':!![]})[_0x44cc('0x25')](function(_0x2a686a){if(_0x2a686a&&_0x2a686a[_0x44cc('0x78')]===0x0){return db[_0x44cc('0x28')][_0x44cc('0x79')]({'name':_0x579289['name'],'resourceId':_0x579289['id'],'type':_0x2a686a['name'],'sectionId':_0x2a686a['id']},{})[_0x44cc('0x25')](function(){return _0x4dfcd9;});}else{return _0x4dfcd9;}})[_0x44cc('0x49')](function(_0x21ef54){logger[_0x44cc('0x29')](_0x44cc('0x7a'),_0x21ef54);throw _0x21ef54;});}return _0x4dfcd9;})[_0x44cc('0x25')](respondWithResult(_0x18749b,null))[_0x44cc('0x49')](handleError(_0x18749b,null));});_0x4ff221['start']();}catch(_0x404f3a){_0x18749b[_0x44cc('0x1c')](0x1f4)[_0x44cc('0x2c')](_0x404f3a);}};exports['update']=function(_0x34c950,_0x32751b,_0x33d1da){return db[_0x44cc('0x2e')][_0x44cc('0x4b')]({'where':{'id':_0x34c950[_0x44cc('0x4c')]['id']}})['then'](handleEntityNotFound(_0x32751b,null))[_0x44cc('0x25')](saveUpdates(_[_0x44cc('0x40')](_0x34c950[_0x44cc('0x73')],['name',_0x44cc('0x7b')]),null))[_0x44cc('0x25')](respondWithResult(_0x32751b,null))[_0x44cc('0x49')](handleError(_0x32751b,null));};exports['delete']=function(_0x2ee5f3,_0x2a5d4e,_0x21e062){return db[_0x44cc('0x2e')][_0x44cc('0x4b')]({'where':{'id':_0x2ee5f3[_0x44cc('0x4c')]['id']}})['then'](function(_0xc9ddc5){if(_0xc9ddc5){return _0xc9ddc5[_0x44cc('0x26')]();}})[_0x44cc('0x25')](function(_0x570d58){var _0x20fd6a=path[_0x44cc('0x50')](config[_0x44cc('0x51')],_0x44cc('0x5f'),util[_0x44cc('0x56')](_0x44cc('0x57'),_0x570d58[_0x44cc('0x4d')],_0x570d58[_0x44cc('0x7c')]));var _0x30b1cc=path[_0x44cc('0x50')](config[_0x44cc('0x51')],'server/files/sounds/converted',util['format'](_0x44cc('0x57'),_0x570d58[_0x44cc('0x4d')],_0x570d58[_0x44cc('0x4e')]));fs[_0x44cc('0x65')](_0x20fd6a);fs['unlinkSync'](_0x30b1cc);return _0x570d58;})[_0x44cc('0x25')](function(_0x3354a0){if(_0x3354a0){return _0x2a5d4e[_0x44cc('0x1c')](0xcc)[_0x44cc('0x1b')]();}})[_0x44cc('0x25')](handleEntityNotFound(_0x2a5d4e,null))['catch'](handleError(_0x2a5d4e,null));}; \ No newline at end of file +var _0xf7bd=['original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_sampleCount','converted_channelCount','converted_bitRate','end','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','delete','original_format','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','Sound','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','nolimit','limit','sort','where','filters','pick','filter','type','merge','includeAll','include','findAll','rows','catch','params','length','options','find','download','save_name','converted_format','existsSync','join','Sequelize','Sound\x20not\x20found','root','server/files/sounds/converted','format','%s.%s','basename','extname','file','originalname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','src'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xf7bd,0x184));var _0xdf7b=function(_0x78d8b7,_0x2cfc1d){_0x78d8b7=_0x78d8b7-0x0;var _0x5a979c=_0xf7bd[_0x78d8b7];return _0x5a979c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdf7b('0x0'));var rimraf=require(_0xdf7b('0x1'));var zipdir=require(_0xdf7b('0x2'));var jsonpatch=require(_0xdf7b('0x3'));var rp=require(_0xdf7b('0x4'));var moment=require('moment');var BPromise=require(_0xdf7b('0x5'));var Mustache=require(_0xdf7b('0x6'));var util=require(_0xdf7b('0x7'));var path=require('path');var sox=require(_0xdf7b('0x8'));var csv=require('to-csv');var ejs=require(_0xdf7b('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdf7b('0xa'));var crypto=require(_0xdf7b('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdf7b('0xc'));var querystring=require(_0xdf7b('0xd'));var Papa=require('papaparse');var Redis=require(_0xdf7b('0xe'));var authService=require(_0xdf7b('0xf'));var qs=require(_0xdf7b('0x10'));var as=require(_0xdf7b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf7b('0x12'))(_0xdf7b('0x13'));var utils=require(_0xdf7b('0x14'));var config=require('../../config/environment');var db=require(_0xdf7b('0x15'))['db'];function respondWithStatusCode(_0x1e20f2,_0x52606d){_0x52606d=_0x52606d||0xcc;return function(_0xeca2c3){if(_0xeca2c3){return _0x1e20f2[_0xdf7b('0x16')](_0x52606d);}return _0x1e20f2[_0xdf7b('0x17')](_0x52606d)['end']();};}function respondWithResult(_0x3b1778,_0x36d124){_0x36d124=_0x36d124||0xc8;return function(_0x5ef5cf){if(_0x5ef5cf){return _0x3b1778['status'](_0x36d124)['json'](_0x5ef5cf);}};}function respondWithFilteredResult(_0x1d250a,_0x20afd3){return function(_0x50087c){if(_0x50087c){var _0x183a74=_0x50087c[_0xdf7b('0x18')],_0x5e8581=_0x20afd3['offset'],_0x2dd49e=_0x20afd3[_0xdf7b('0x19')]+_0x20afd3['limit'],_0x6bf6fb;if(_0x2dd49e>=_0x183a74){_0x2dd49e=_0x183a74;_0x6bf6fb=0xc8;}else{_0x6bf6fb=0xce;}_0x1d250a['status'](_0x6bf6fb);return _0x1d250a[_0xdf7b('0x1a')](_0xdf7b('0x1b'),_0x5e8581+'-'+_0x2dd49e+'/'+_0x183a74)['json'](_0x50087c);}return null;};}function patchUpdates(_0x4b970b){return function(_0x5e4e33){try{jsonpatch['apply'](_0x5e4e33,_0x4b970b,!![]);}catch(_0x358c35){return BPromise[_0xdf7b('0x1c')](_0x358c35);}return _0x5e4e33[_0xdf7b('0x1d')]();};}function saveUpdates(_0x4d189e,_0x449b50){return function(_0x25d99d){if(_0x25d99d){return _0x25d99d[_0xdf7b('0x1e')](_0x4d189e)[_0xdf7b('0x1f')](function(_0x37c0e6){return _0x37c0e6;});}return null;};}function removeEntity(_0x362813,_0x3dd1d1){return function(_0x59bee9){if(_0x59bee9){return _0x59bee9[_0xdf7b('0x20')]()[_0xdf7b('0x1f')](function(){var _0x4b6c16=_0x59bee9[_0xdf7b('0x21')]({'plain':!![]});var _0x189029='Sounds';return db[_0xdf7b('0x22')]['destroy']({'where':{'type':_0x189029,'resourceId':_0x4b6c16['id']}})[_0xdf7b('0x1f')](function(){return _0x59bee9;});})[_0xdf7b('0x1f')](function(){_0x362813[_0xdf7b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x207d3e,_0x15c9ef){return function(_0x34ddf3){if(!_0x34ddf3){_0x207d3e[_0xdf7b('0x16')](0x194);}return _0x34ddf3;};}function handleError(_0x5ea0b1,_0xdfd25c){_0xdfd25c=_0xdfd25c||0x1f4;return function(_0x240791){logger[_0xdf7b('0x23')](_0x240791[_0xdf7b('0x24')]);if(_0x240791[_0xdf7b('0x25')]){delete _0x240791[_0xdf7b('0x25')];}_0x5ea0b1['status'](_0xdfd25c)['send'](_0x240791);};}exports['index']=function(_0x5ebe49,_0x3d0bf5){var _0x1ded5b={},_0xcb57bc={},_0x180cd0={'count':0x0,'rows':[]};var _0x2ad8dc=_[_0xdf7b('0x26')](db[_0xdf7b('0x27')][_0xdf7b('0x28')],function(_0x4d37af){return{'name':_0x4d37af[_0xdf7b('0x29')],'type':_0x4d37af['type'][_0xdf7b('0x2a')]};});_0xcb57bc['model']=_[_0xdf7b('0x26')](_0x2ad8dc,_0xdf7b('0x25'));_0xcb57bc[_0xdf7b('0x2b')]=_[_0xdf7b('0x2c')](_0x5ebe49[_0xdf7b('0x2b')]);_0xcb57bc['filters']=_[_0xdf7b('0x2d')](_0xcb57bc[_0xdf7b('0x2e')],_0xcb57bc['query']);_0x1ded5b['attributes']=_[_0xdf7b('0x2d')](_0xcb57bc[_0xdf7b('0x2e')],qs['fields'](_0x5ebe49[_0xdf7b('0x2b')][_0xdf7b('0x2f')]));_0x1ded5b[_0xdf7b('0x30')]=_0x1ded5b['attributes']['length']?_0x1ded5b['attributes']:_0xcb57bc[_0xdf7b('0x2e')];if(!_0x5ebe49['query']['hasOwnProperty'](_0xdf7b('0x31'))){_0x1ded5b[_0xdf7b('0x32')]=qs[_0xdf7b('0x32')](_0x5ebe49[_0xdf7b('0x2b')]['limit']);_0x1ded5b[_0xdf7b('0x19')]=qs['offset'](_0x5ebe49[_0xdf7b('0x2b')][_0xdf7b('0x19')]);}_0x1ded5b['order']=qs[_0xdf7b('0x33')](_0x5ebe49[_0xdf7b('0x2b')][_0xdf7b('0x33')]);_0x1ded5b[_0xdf7b('0x34')]=qs[_0xdf7b('0x35')](_[_0xdf7b('0x36')](_0x5ebe49[_0xdf7b('0x2b')],_0xcb57bc[_0xdf7b('0x35')]));if(_0x5ebe49[_0xdf7b('0x2b')][_0xdf7b('0x37')]){_0x1ded5b[_0xdf7b('0x34')]=_['merge'](_0x1ded5b['where'],{'$or':_[_0xdf7b('0x26')](_0x2ad8dc,function(_0x5f41a3){if(_0x5f41a3[_0xdf7b('0x38')]!=='VIRTUAL'){var _0x5547af={};_0x5547af[_0x5f41a3[_0xdf7b('0x25')]]={'$like':'%'+_0x5ebe49[_0xdf7b('0x2b')]['filter']+'%'};return _0x5547af;}})});}_0x1ded5b=_[_0xdf7b('0x39')]({},_0x1ded5b,_0x5ebe49['options']);var _0x2f6af3={'where':_0x1ded5b[_0xdf7b('0x34')]};return db[_0xdf7b('0x27')]['count'](_0x2f6af3)[_0xdf7b('0x1f')](function(_0x1b4f0a){_0x180cd0[_0xdf7b('0x18')]=_0x1b4f0a;if(_0x5ebe49[_0xdf7b('0x2b')][_0xdf7b('0x3a')]){_0x1ded5b[_0xdf7b('0x3b')]=[{'all':!![]}];}return db[_0xdf7b('0x27')][_0xdf7b('0x3c')](_0x1ded5b);})[_0xdf7b('0x1f')](function(_0x45608f){_0x180cd0[_0xdf7b('0x3d')]=_0x45608f;return _0x180cd0;})['then'](respondWithFilteredResult(_0x3d0bf5,_0x1ded5b))[_0xdf7b('0x3e')](handleError(_0x3d0bf5,null));};exports['show']=function(_0x3c78dd,_0x375144){var _0x4f6a2b={'raw':!![],'where':{'id':_0x3c78dd[_0xdf7b('0x3f')]['id']}},_0x3f5610={};_0x3f5610[_0xdf7b('0x2e')]=_[_0xdf7b('0x2c')](db['Sound'][_0xdf7b('0x28')]);_0x3f5610[_0xdf7b('0x2b')]=_['keys'](_0x3c78dd[_0xdf7b('0x2b')]);_0x3f5610[_0xdf7b('0x35')]=_[_0xdf7b('0x2d')](_0x3f5610['model'],_0x3f5610[_0xdf7b('0x2b')]);_0x4f6a2b['attributes']=_[_0xdf7b('0x2d')](_0x3f5610[_0xdf7b('0x2e')],qs[_0xdf7b('0x2f')](_0x3c78dd[_0xdf7b('0x2b')][_0xdf7b('0x2f')]));_0x4f6a2b[_0xdf7b('0x30')]=_0x4f6a2b[_0xdf7b('0x30')][_0xdf7b('0x40')]?_0x4f6a2b[_0xdf7b('0x30')]:_0x3f5610[_0xdf7b('0x2e')];if(_0x3c78dd[_0xdf7b('0x2b')][_0xdf7b('0x3a')]){_0x4f6a2b[_0xdf7b('0x3b')]=[{'all':!![]}];}_0x4f6a2b=_[_0xdf7b('0x39')]({},_0x4f6a2b,_0x3c78dd[_0xdf7b('0x41')]);return db[_0xdf7b('0x27')][_0xdf7b('0x42')](_0x4f6a2b)[_0xdf7b('0x1f')](handleEntityNotFound(_0x375144,null))['then'](respondWithResult(_0x375144,null))[_0xdf7b('0x3e')](handleError(_0x375144,null));};exports[_0xdf7b('0x43')]=function(_0x4e5d44,_0x4a87bf,_0x23cf0d){return db[_0xdf7b('0x27')]['find']({'where':{'id':_0x4e5d44[_0xdf7b('0x3f')]['id']},'attributes':['name',_0xdf7b('0x44'),_0xdf7b('0x45')],'raw':!![]})[_0xdf7b('0x1f')](handleEntityNotFound(_0x4a87bf,null))['then'](function(_0x2591cb){if(_0x2591cb){if(!fs[_0xdf7b('0x46')](path[_0xdf7b('0x47')](config['root'],'server/files/sounds/converted',_0x2591cb[_0xdf7b('0x44')]+'.'+_0x2591cb[_0xdf7b('0x45')]))){throw new db[(_0xdf7b('0x48'))]['ValidationError'](_0xdf7b('0x49'));}return _0x4a87bf['download'](path[_0xdf7b('0x47')](config[_0xdf7b('0x4a')],_0xdf7b('0x4b'),util[_0xdf7b('0x4c')](_0xdf7b('0x4d'),_0x2591cb[_0xdf7b('0x44')],_0x2591cb[_0xdf7b('0x45')])),util[_0xdf7b('0x4c')]('%s.%s',_0x2591cb['name'],_0x2591cb[_0xdf7b('0x45')]));}return null;})[_0xdf7b('0x3e')](handleError(_0x4a87bf,null));};exports['create']=function(_0x20b184,_0x591e9b,_0x29b447){var _0x22d3a4={'name':path[_0xdf7b('0x4e')](_0x20b184['file']['originalname'],path[_0xdf7b('0x4f')](_0x20b184[_0xdf7b('0x50')][_0xdf7b('0x51')])),'save_name':path[_0xdf7b('0x4e')](_0x20b184[_0xdf7b('0x50')][_0xdf7b('0x52')],path[_0xdf7b('0x4f')](_0x20b184['file'][_0xdf7b('0x52')])),'original_format':path[_0xdf7b('0x4f')](_0x20b184[_0xdf7b('0x50')]['originalname'])[_0xdf7b('0x53')](0x1),'converted_format':_0xdf7b('0x54')};var _0x1650a6=path[_0xdf7b('0x47')](config['root'],_0xdf7b('0x55'),_0x20b184[_0xdf7b('0x50')][_0xdf7b('0x52')]);var _0x4e8fcd=path[_0xdf7b('0x47')](config[_0xdf7b('0x4a')],_0xdf7b('0x4b'),util[_0xdf7b('0x4c')](_0xdf7b('0x4d'),path[_0xdf7b('0x4e')](_0x20b184[_0xdf7b('0x50')][_0xdf7b('0x52')],path['extname'](_0x20b184['file']['filename'])),_0x22d3a4['converted_format']));logger[_0xdf7b('0x56')](_0xdf7b('0x57'),_0x1650a6);logger[_0xdf7b('0x56')](_0xdf7b('0x58'),_0x4e8fcd);try{fs[_0xdf7b('0x59')](_0x1650a6,parseInt(_0xdf7b('0x5a'),0x8));var _0x3e56fc=sox['transcode'](_0x1650a6,_0x4e8fcd,{'sampleRate':0x1f40,'format':_0xdf7b('0x54'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3e56fc['on'](_0xdf7b('0x23'),function(_0x1b4c9f){fs['unlinkSync'](_0x1650a6);_0x591e9b['status'](0x1f4)['send'](_0x1b4c9f);});_0x3e56fc['on'](_0xdf7b('0x5b'),function(_0x3dfca3){_0x22d3a4[_0xdf7b('0x5c')]=isNaN(_0x3dfca3['duration'])?null:_0x3dfca3[_0xdf7b('0x5d')]*0x3e8;_0x22d3a4[_0xdf7b('0x5e')]=isNaN(_0x3dfca3[_0xdf7b('0x5f')])?null:_0x3dfca3[_0xdf7b('0x5f')];_0x22d3a4[_0xdf7b('0x60')]=isNaN(_0x3dfca3[_0xdf7b('0x61')])?null:_0x3dfca3[_0xdf7b('0x61')];_0x22d3a4[_0xdf7b('0x62')]=isNaN(_0x3dfca3[_0xdf7b('0x63')])?null:_0x3dfca3[_0xdf7b('0x63')];_0x22d3a4[_0xdf7b('0x64')]=isNaN(_0x3dfca3[_0xdf7b('0x65')])?null:_0x3dfca3[_0xdf7b('0x65')];});_0x3e56fc['on']('dest',function(_0x2d8fdf){_0x22d3a4['converted_duration']=isNaN(_0x2d8fdf['duration'])?null:_0x2d8fdf[_0xdf7b('0x5d')]*0x3e8;_0x22d3a4[_0xdf7b('0x66')]=isNaN(_0x2d8fdf['sampleCount'])?null:_0x2d8fdf['sampleCount'];_0x22d3a4[_0xdf7b('0x67')]=isNaN(_0x2d8fdf[_0xdf7b('0x61')])?null:_0x2d8fdf[_0xdf7b('0x61')];_0x22d3a4[_0xdf7b('0x68')]=isNaN(_0x2d8fdf[_0xdf7b('0x63')])?null:_0x2d8fdf['bitRate'];_0x22d3a4['converted_sampleRate']=isNaN(_0x2d8fdf[_0xdf7b('0x65')])?null:_0x2d8fdf[_0xdf7b('0x65')];});_0x3e56fc['on'](_0xdf7b('0x69'),function(){fs[_0xdf7b('0x59')](_0x4e8fcd,parseInt(_0xdf7b('0x5a'),0x8));return db[_0xdf7b('0x27')][_0xdf7b('0x6a')](_0x22d3a4)['then'](function(_0x1875f5){var _0x905913={'role':_0x20b184['body'][_0xdf7b('0x6b')],'userProfileId':_0x20b184[_0xdf7b('0x6c')][_0xdf7b('0x6d')]};if(!_0x905913)throw new Error(_0xdf7b('0x6e'));if(_0x905913['role']===_0xdf7b('0x6f')){var _0x206915=_0x1875f5[_0xdf7b('0x21')]({'plain':!![]});return db[_0xdf7b('0x70')][_0xdf7b('0x42')]({'where':{'name':_0xdf7b('0x71'),'userProfileId':_0x905913['userProfileId']},'raw':!![]})[_0xdf7b('0x1f')](function(_0x11f890){if(_0x11f890&&_0x11f890[_0xdf7b('0x72')]===0x0){return db[_0xdf7b('0x22')][_0xdf7b('0x6a')]({'name':_0x206915[_0xdf7b('0x25')],'resourceId':_0x206915['id'],'type':_0x11f890[_0xdf7b('0x25')],'sectionId':_0x11f890['id']},{})['then'](function(){return _0x1875f5;});}else{return _0x1875f5;}})[_0xdf7b('0x3e')](function(_0x82f60c){logger[_0xdf7b('0x23')](_0xdf7b('0x73'),_0x82f60c);throw _0x82f60c;});}return _0x1875f5;})[_0xdf7b('0x1f')](respondWithResult(_0x591e9b,null))[_0xdf7b('0x3e')](handleError(_0x591e9b,null));});_0x3e56fc['start']();}catch(_0x322819){_0x591e9b[_0xdf7b('0x17')](0x1f4)[_0xdf7b('0x74')](_0x322819);}};exports[_0xdf7b('0x1e')]=function(_0x2e2e15,_0x2ee71a,_0x5a8694){return db[_0xdf7b('0x27')][_0xdf7b('0x42')]({'where':{'id':_0x2e2e15[_0xdf7b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2ee71a,null))['then'](saveUpdates(_[_0xdf7b('0x36')](_0x2e2e15[_0xdf7b('0x6c')],['name','description']),null))[_0xdf7b('0x1f')](respondWithResult(_0x2ee71a,null))[_0xdf7b('0x3e')](handleError(_0x2ee71a,null));};exports[_0xdf7b('0x75')]=function(_0x6d6cba,_0x242f2f,_0x126c11){return db['Sound'][_0xdf7b('0x42')]({'where':{'id':_0x6d6cba[_0xdf7b('0x3f')]['id']}})['then'](function(_0x2a8c3c){if(_0x2a8c3c){return _0x2a8c3c['destroy']();}})['then'](function(_0x361033){var _0x3d19b5=path['join'](config[_0xdf7b('0x4a')],_0xdf7b('0x55'),util['format'](_0xdf7b('0x4d'),_0x361033[_0xdf7b('0x44')],_0x361033[_0xdf7b('0x76')]));var _0x16eb63=path[_0xdf7b('0x47')](config[_0xdf7b('0x4a')],'server/files/sounds/converted',util[_0xdf7b('0x4c')]('%s.%s',_0x361033[_0xdf7b('0x44')],_0x361033[_0xdf7b('0x45')]));fs[_0xdf7b('0x77')](_0x3d19b5);fs[_0xdf7b('0x77')](_0x16eb63);return _0x361033;})[_0xdf7b('0x1f')](function(_0x247f8d){if(_0x247f8d){return _0x242f2f['status'](0xcc)[_0xdf7b('0x69')]();}})[_0xdf7b('0x1f')](handleEntityNotFound(_0x242f2f,null))[_0xdf7b('0x3e')](handleError(_0x242f2f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index c4c6a71..f7f39a8 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 _0x6c34=['exports','define','tools_sounds','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xb5d6f6,_0x3eb466){var _0x3771fc=function(_0x471325){while(--_0x471325){_0xb5d6f6['push'](_0xb5d6f6['shift']());}};_0x3771fc(++_0x3eb466);}(_0x6c34,0x1dc));var _0x46c3=function(_0x22ac85,_0x4f397a){_0x22ac85=_0x22ac85-0x0;var _0x3b4566=_0x6c34[_0x22ac85];return _0x3b4566;};'use strict';var _=require('lodash');var util=require(_0x46c3('0x0'));var logger=require(_0x46c3('0x1'))('api');var moment=require(_0x46c3('0x2'));var BPromise=require(_0x46c3('0x3'));var rp=require(_0x46c3('0x4'));var fs=require('fs');var path=require(_0x46c3('0x5'));var rimraf=require(_0x46c3('0x6'));var config=require(_0x46c3('0x7'));var attributes=require('./sound.attributes');module[_0x46c3('0x8')]=function(_0x4fc3a9,_0x2f41b0){return _0x4fc3a9[_0x46c3('0x9')]('Sound',attributes,{'tableName':_0x46c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x420e=['exports','define','Sound','tools_sounds','lodash','util','api','moment','bluebird','rimraf','./sound.attributes'];(function(_0x202782,_0x42b300){var _0x2c8a7c=function(_0x26683e){while(--_0x26683e){_0x202782['push'](_0x202782['shift']());}};_0x2c8a7c(++_0x42b300);}(_0x420e,0x7d));var _0xe420=function(_0x102eda,_0x1c2975){_0x102eda=_0x102eda-0x0;var _0x1f3d99=_0x420e[_0x102eda];return _0x1f3d99;};'use strict';var _=require(_0xe420('0x0'));var util=require(_0xe420('0x1'));var logger=require('../../config/logger')(_0xe420('0x2'));var moment=require(_0xe420('0x3'));var BPromise=require(_0xe420('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe420('0x5'));var config=require('../../config/environment');var attributes=require(_0xe420('0x6'));module[_0xe420('0x7')]=function(_0x2b172b,_0x8b445b){return _0x2b172b[_0xe420('0x8')](_0xe420('0x9'),attributes,{'tableName':_0xe420('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 109b41f..dc3cc2c 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 _0x9e0d=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ShowSound','Sound','find','options','raw','where','attributes','include','map','model','lodash','util'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x9e0d,0x10c));var _0xd9e0=function(_0x415f0a,_0x5dc7e2){_0x415f0a=_0x415f0a-0x0;var _0x40aab4=_0x9e0d[_0x415f0a];return _0x40aab4;};'use strict';var _=require(_0xd9e0('0x0'));var util=require(_0xd9e0('0x1'));var moment=require(_0xd9e0('0x2'));var BPromise=require(_0xd9e0('0x3'));var rs=require(_0xd9e0('0x4'));var fs=require('fs');var Redis=require(_0xd9e0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd9e0('0x6'))(_0xd9e0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd9e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b09db,_0x23d73b,_0x4d3f3e){return new BPromise(function(_0x1d3a88,_0x267b30){return client['request'](_0x5b09db,_0x4d3f3e)[_0xd9e0('0x9')](function(_0x34d268){logger[_0xd9e0('0xa')](_0xd9e0('0xb'),_0x23d73b,'request\x20sent');logger[_0xd9e0('0xc')](_0xd9e0('0xd'),_0x23d73b,_0xd9e0('0xe'),JSON[_0xd9e0('0xf')](_0x34d268));if(_0x34d268[_0xd9e0('0x10')]){if(_0x34d268['error'][_0xd9e0('0x11')]===0x1f4){logger[_0xd9e0('0x10')](_0xd9e0('0xb'),_0x23d73b,_0x34d268[_0xd9e0('0x10')]['message']);return _0x267b30(_0x34d268['error']['message']);}logger[_0xd9e0('0x10')]('Sound,\x20%s,\x20%s',_0x23d73b,_0x34d268[_0xd9e0('0x10')][_0xd9e0('0x12')]);return _0x1d3a88(_0x34d268[_0xd9e0('0x10')][_0xd9e0('0x12')]);}else{logger['info']('Sound,\x20%s,\x20%s',_0x23d73b,_0xd9e0('0xe'));_0x1d3a88(_0x34d268['result'][_0xd9e0('0x12')]);}})[_0xd9e0('0x13')](function(_0x64e370){logger[_0xd9e0('0x10')](_0xd9e0('0xb'),_0x23d73b,_0x64e370);_0x267b30(_0x64e370);});});}exports[_0xd9e0('0x14')]=function(_0x57737f){var _0x3de548=this;return new Promise(function(_0x37c312,_0x2d2ad4){return db[_0xd9e0('0x15')][_0xd9e0('0x16')]({'raw':_0x57737f['options']?_0x57737f[_0xd9e0('0x17')][_0xd9e0('0x18')]===undefined?!![]:![]:!![],'where':_0x57737f['options']?_0x57737f['options'][_0xd9e0('0x19')]||null:null,'attributes':_0x57737f[_0xd9e0('0x17')]?_0x57737f[_0xd9e0('0x17')][_0xd9e0('0x1a')]||null:null,'include':_0x57737f[_0xd9e0('0x17')]?_0x57737f[_0xd9e0('0x17')][_0xd9e0('0x1b')]?_[_0xd9e0('0x1c')](_0x57737f[_0xd9e0('0x17')][_0xd9e0('0x1b')],function(_0xe3a3e1){return{'model':db[_0xe3a3e1[_0xd9e0('0x1d')]],'as':_0xe3a3e1['as'],'attributes':_0xe3a3e1[_0xd9e0('0x1a')],'include':_0xe3a3e1[_0xd9e0('0x1b')]?_['map'](_0xe3a3e1['include'],function(_0x491386){return{'model':db[_0x491386[_0xd9e0('0x1d')]],'as':_0x491386['as'],'attributes':_0x491386['attributes'],'include':_0x491386[_0xd9e0('0x1b')]?_[_0xd9e0('0x1c')](_0x491386[_0xd9e0('0x1b')],function(_0x7851dc){return{'model':db[_0x7851dc[_0xd9e0('0x1d')]],'as':_0x7851dc['as'],'attributes':_0x7851dc[_0xd9e0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xd9e0('0x9')](function(_0x20a03f){logger['info']('ShowSound',_0x57737f);logger['debug'](_0xd9e0('0x14'),_0x57737f,JSON[_0xd9e0('0xf')](_0x20a03f));_0x37c312(_0x20a03f);})[_0xd9e0('0x13')](function(_0x3b3d14){logger[_0xd9e0('0x10')](_0xd9e0('0x14'),_0x3b3d14[_0xd9e0('0x12')],_0x57737f);_0x2d2ad4(_0x3de548[_0xd9e0('0x10')](0x1f4,_0x3b3d14[_0xd9e0('0x12')]));});});}; \ No newline at end of file +var _0xb3d4=['error','code','Sound,\x20%s,\x20%s','message','result','catch','Sound','options','raw','attributes','include','model','map','ShowSound','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x76b9ae,_0xcb437b){var _0x39158f=function(_0x12afd2){while(--_0x12afd2){_0x76b9ae['push'](_0x76b9ae['shift']());}};_0x39158f(++_0xcb437b);}(_0xb3d4,0x137));var _0x4b3d=function(_0x41ceeb,_0x3ce326){_0x41ceeb=_0x41ceeb-0x0;var _0x411b2d=_0xb3d4[_0x41ceeb];return _0x411b2d;};'use strict';var _=require('lodash');var util=require(_0x4b3d('0x0'));var moment=require(_0x4b3d('0x1'));var BPromise=require(_0x4b3d('0x2'));var rs=require(_0x4b3d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b3d('0x4'))['db'];var utils=require(_0x4b3d('0x5'));var logger=require(_0x4b3d('0x6'))(_0x4b3d('0x7'));var config=require(_0x4b3d('0x8'));var jayson=require(_0x4b3d('0x9'));var client=jayson[_0x4b3d('0xa')][_0x4b3d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4355e1,_0x33f6a3,_0x2a8f30){return new BPromise(function(_0x1440d5,_0x383720){return client[_0x4b3d('0xc')](_0x4355e1,_0x2a8f30)[_0x4b3d('0xd')](function(_0xa6117){logger[_0x4b3d('0xe')]('Sound,\x20%s,\x20%s',_0x33f6a3,_0x4b3d('0xf'));logger[_0x4b3d('0x10')](_0x4b3d('0x11'),_0x33f6a3,_0x4b3d('0xf'),JSON[_0x4b3d('0x12')](_0xa6117));if(_0xa6117[_0x4b3d('0x13')]){if(_0xa6117['error'][_0x4b3d('0x14')]===0x1f4){logger[_0x4b3d('0x13')](_0x4b3d('0x15'),_0x33f6a3,_0xa6117[_0x4b3d('0x13')][_0x4b3d('0x16')]);return _0x383720(_0xa6117[_0x4b3d('0x13')]['message']);}logger[_0x4b3d('0x13')]('Sound,\x20%s,\x20%s',_0x33f6a3,_0xa6117[_0x4b3d('0x13')][_0x4b3d('0x16')]);return _0x1440d5(_0xa6117[_0x4b3d('0x13')][_0x4b3d('0x16')]);}else{logger[_0x4b3d('0xe')]('Sound,\x20%s,\x20%s',_0x33f6a3,_0x4b3d('0xf'));_0x1440d5(_0xa6117[_0x4b3d('0x17')][_0x4b3d('0x16')]);}})[_0x4b3d('0x18')](function(_0x757f4c){logger[_0x4b3d('0x13')](_0x4b3d('0x15'),_0x33f6a3,_0x757f4c);_0x383720(_0x757f4c);});});}exports['ShowSound']=function(_0x300901){var _0x5447fa=this;return new Promise(function(_0x33a539,_0x1cf040){return db[_0x4b3d('0x19')]['find']({'raw':_0x300901['options']?_0x300901[_0x4b3d('0x1a')][_0x4b3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x300901['options']?_0x300901[_0x4b3d('0x1a')]['where']||null:null,'attributes':_0x300901[_0x4b3d('0x1a')]?_0x300901[_0x4b3d('0x1a')][_0x4b3d('0x1c')]||null:null,'include':_0x300901[_0x4b3d('0x1a')]?_0x300901[_0x4b3d('0x1a')][_0x4b3d('0x1d')]?_['map'](_0x300901[_0x4b3d('0x1a')][_0x4b3d('0x1d')],function(_0xa48975){return{'model':db[_0xa48975[_0x4b3d('0x1e')]],'as':_0xa48975['as'],'attributes':_0xa48975[_0x4b3d('0x1c')],'include':_0xa48975[_0x4b3d('0x1d')]?_['map'](_0xa48975[_0x4b3d('0x1d')],function(_0x173ba1){return{'model':db[_0x173ba1['model']],'as':_0x173ba1['as'],'attributes':_0x173ba1[_0x4b3d('0x1c')],'include':_0x173ba1[_0x4b3d('0x1d')]?_[_0x4b3d('0x1f')](_0x173ba1[_0x4b3d('0x1d')],function(_0x146618){return{'model':db[_0x146618['model']],'as':_0x146618['as'],'attributes':_0x146618[_0x4b3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4b3d('0xd')](function(_0x45bbd8){logger[_0x4b3d('0xe')]('ShowSound',_0x300901);logger[_0x4b3d('0x10')](_0x4b3d('0x20'),_0x300901,JSON[_0x4b3d('0x12')](_0x45bbd8));_0x33a539(_0x45bbd8);})[_0x4b3d('0x18')](function(_0x4edf62){logger['error']('ShowSound',_0x4edf62[_0x4b3d('0x16')],_0x300901);_0x1cf040(_0x5447fa[_0x4b3d('0x13')](0x1f4,_0x4edf62[_0x4b3d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 8277965..fee4a8c 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 _0xa26d=['Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','path','connect-timeout','express'];(function(_0x1d61a5,_0x414995){var _0x3e23d8=function(_0x52c10d){while(--_0x52c10d){_0x1d61a5['push'](_0x1d61a5['shift']());}};_0x3e23d8(++_0x414995);}(_0xa26d,0x8d));var _0xda26=function(_0x228211,_0x16bc63){_0x228211=_0x228211-0x0;var _0x5c9e22=_0xa26d[_0x228211];return _0x5c9e22;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xda26('0x0'));var timeout=require(_0xda26('0x1'));var express=require(_0xda26('0x2'));var router=express[_0xda26('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xda26('0x4'));var config=require(_0xda26('0x5'));var controller=require('./squareMessage.controller');router['get']('/',auth[_0xda26('0x6')](),controller[_0xda26('0x7')]);router['get']('/:id',auth[_0xda26('0x6')](),controller[_0xda26('0x8')]);router[_0xda26('0x9')]('/',auth[_0xda26('0x6')](),controller[_0xda26('0xa')]);router[_0xda26('0xb')](_0xda26('0xc'),auth[_0xda26('0x6')](),controller[_0xda26('0xd')]);router[_0xda26('0xe')]('/:id',auth[_0xda26('0x6')](),controller['destroy']);module[_0xda26('0xf')]=router; \ No newline at end of file +var _0x755a=['../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','show','post','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x50e7ae,_0x1f9da9){var _0x18b841=function(_0x163a4c){while(--_0x163a4c){_0x50e7ae['push'](_0x50e7ae['shift']());}};_0x18b841(++_0x1f9da9);}(_0x755a,0x1e8));var _0xa755=function(_0x534fc4,_0x3efdb7){_0x534fc4=_0x534fc4-0x0;var _0x496bb7=_0x755a[_0x534fc4];return _0x496bb7;};'use strict';var multer=require(_0xa755('0x0'));var util=require(_0xa755('0x1'));var path=require(_0xa755('0x2'));var timeout=require(_0xa755('0x3'));var express=require(_0xa755('0x4'));var router=express[_0xa755('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xa755('0x6'));var config=require(_0xa755('0x7'));var controller=require(_0xa755('0x8'));router[_0xa755('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xa755('0xa')](),controller[_0xa755('0xb')]);router[_0xa755('0xc')]('/',auth[_0xa755('0xa')](),controller[_0xa755('0xd')]);router[_0xa755('0xe')]('/:id',auth[_0xa755('0xa')](),controller[_0xa755('0xf')]);router[_0xa755('0x10')](_0xa755('0x11'),auth[_0xa755('0xa')](),controller['destroy']);module[_0xa755('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 ba783d9..f682615 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 _0x2445=['out','sequelize','exports','STRING','medium'];(function(_0x2a558d,_0x2df0ff){var _0xa7bc9c=function(_0x12a30e){while(--_0x12a30e){_0x2a558d['push'](_0x2a558d['shift']());}};_0xa7bc9c(++_0x2df0ff);}(_0x2445,0x164));var _0x5244=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x2445[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x5244('0x0'));module[_0x5244('0x1')]={'uniqueid':{'type':Sequelize[_0x5244('0x2')]},'body':{'type':Sequelize['TEXT'](_0x5244('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5244('0x4')),'defaultValue':_0x5244('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0x1d7c=['medium','ENUM','out'];(function(_0x3da1c5,_0x53f43f){var _0x20d262=function(_0x5b914f){while(--_0x5b914f){_0x3da1c5['push'](_0x3da1c5['shift']());}};_0x20d262(++_0x53f43f);}(_0x1d7c,0x1e9));var _0xc1d7=function(_0x43762c,_0x48ff0f){_0x43762c=_0x43762c-0x0;var _0x4a85e0=_0x1d7c[_0x43762c];return _0x4a85e0;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize['TEXT'](_0xc1d7('0x0')),'allowNull':![]},'direction':{'type':Sequelize[_0xc1d7('0x1')]('in','out'),'defaultValue':_0xc1d7('0x2'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 77099be..53a9146 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 _0x0b79=['merge','filter','options','include','findAll','catch','show','keys','includeAll','create','update','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','json','count','offset','limit','set','apply','reject','destroy','then','error','name','send','index','map','SquareMessage','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters'];(function(_0x1d40e3,_0x2e2698){var _0x3d5192=function(_0x4e56d8){while(--_0x4e56d8){_0x1d40e3['push'](_0x1d40e3['shift']());}};_0x3d5192(++_0x2e2698);}(_0x0b79,0x9a));var _0x90b7=function(_0x5cf957,_0x16a052){_0x5cf957=_0x5cf957-0x0;var _0x3ab8f4=_0x0b79[_0x5cf957];return _0x3ab8f4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x90b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90b7('0x1'));var jsonpatch=require(_0x90b7('0x2'));var rp=require(_0x90b7('0x3'));var moment=require(_0x90b7('0x4'));var BPromise=require(_0x90b7('0x5'));var Mustache=require(_0x90b7('0x6'));var util=require(_0x90b7('0x7'));var path=require(_0x90b7('0x8'));var sox=require('sox');var csv=require(_0x90b7('0x9'));var ejs=require(_0x90b7('0xa'));var fs=require('fs');var _=require(_0x90b7('0xb'));var squel=require(_0x90b7('0xc'));var crypto=require(_0x90b7('0xd'));var jsforce=require(_0x90b7('0xe'));var deskjs=require(_0x90b7('0xf'));var toCsv=require(_0x90b7('0x9'));var querystring=require(_0x90b7('0x10'));var Papa=require('papaparse');var Redis=require(_0x90b7('0x11'));var authService=require(_0x90b7('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90b7('0x13'));var logger=require(_0x90b7('0x14'))(_0x90b7('0x15'));var utils=require('../../config/utils');var config=require(_0x90b7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9afd73,_0x5ef92d){_0x5ef92d=_0x5ef92d||0xcc;return function(_0x800382){if(_0x800382){return _0x9afd73[_0x90b7('0x17')](_0x5ef92d);}return _0x9afd73['status'](_0x5ef92d)[_0x90b7('0x18')]();};}function respondWithResult(_0x483884,_0x31afbb){_0x31afbb=_0x31afbb||0xc8;return function(_0x1a6768){if(_0x1a6768){return _0x483884[_0x90b7('0x19')](_0x31afbb)[_0x90b7('0x1a')](_0x1a6768);}};}function respondWithFilteredResult(_0x5b10a8,_0x2c59df){return function(_0x531cce){if(_0x531cce){var _0x467684=_0x531cce[_0x90b7('0x1b')],_0x5c3637=_0x2c59df[_0x90b7('0x1c')],_0xb77101=_0x2c59df['offset']+_0x2c59df[_0x90b7('0x1d')],_0x3d7dbb;if(_0xb77101>=_0x467684){_0xb77101=_0x467684;_0x3d7dbb=0xc8;}else{_0x3d7dbb=0xce;}_0x5b10a8[_0x90b7('0x19')](_0x3d7dbb);return _0x5b10a8[_0x90b7('0x1e')]('Content-Range',_0x5c3637+'-'+_0xb77101+'/'+_0x467684)[_0x90b7('0x1a')](_0x531cce);}return null;};}function patchUpdates(_0x550d73){return function(_0x48622b){try{jsonpatch[_0x90b7('0x1f')](_0x48622b,_0x550d73,!![]);}catch(_0x2c962c){return BPromise[_0x90b7('0x20')](_0x2c962c);}return _0x48622b['save']();};}function saveUpdates(_0x2f33d1,_0x7e2faa){return function(_0xcbd67a){if(_0xcbd67a){return _0xcbd67a['update'](_0x2f33d1)['then'](function(_0x1bafc1){return _0x1bafc1;});}return null;};}function removeEntity(_0x5f547a,_0x56017c){return function(_0x200eab){if(_0x200eab){return _0x200eab[_0x90b7('0x21')]()[_0x90b7('0x22')](function(){_0x5f547a[_0x90b7('0x19')](0xcc)[_0x90b7('0x18')]();});}};}function handleEntityNotFound(_0xed018a,_0x1ba6e5){return function(_0x50b5d9){if(!_0x50b5d9){_0xed018a[_0x90b7('0x17')](0x194);}return _0x50b5d9;};}function handleError(_0x4250b3,_0x1a34b8){_0x1a34b8=_0x1a34b8||0x1f4;return function(_0x332d5a){logger[_0x90b7('0x23')](_0x332d5a['stack']);if(_0x332d5a['name']){delete _0x332d5a[_0x90b7('0x24')];}_0x4250b3[_0x90b7('0x19')](_0x1a34b8)[_0x90b7('0x25')](_0x332d5a);};}exports[_0x90b7('0x26')]=function(_0x2b8d99,_0x4ba21e){var _0x4adc69={},_0x47f43d={},_0x5b7a5b={'count':0x0,'rows':[]};var _0x19f0ab=_[_0x90b7('0x27')](db[_0x90b7('0x28')][_0x90b7('0x29')],function(_0x4597bd){return{'name':_0x4597bd[_0x90b7('0x2a')],'type':_0x4597bd['type']['key']};});_0x47f43d[_0x90b7('0x2b')]=_[_0x90b7('0x27')](_0x19f0ab,_0x90b7('0x24'));_0x47f43d[_0x90b7('0x2c')]=_['keys'](_0x2b8d99[_0x90b7('0x2c')]);_0x47f43d['filters']=_[_0x90b7('0x2d')](_0x47f43d['model'],_0x47f43d['query']);_0x4adc69[_0x90b7('0x2e')]=_[_0x90b7('0x2d')](_0x47f43d['model'],qs[_0x90b7('0x2f')](_0x2b8d99[_0x90b7('0x2c')][_0x90b7('0x2f')]));_0x4adc69[_0x90b7('0x2e')]=_0x4adc69['attributes'][_0x90b7('0x30')]?_0x4adc69[_0x90b7('0x2e')]:_0x47f43d[_0x90b7('0x2b')];if(!_0x2b8d99[_0x90b7('0x2c')][_0x90b7('0x31')](_0x90b7('0x32'))){_0x4adc69[_0x90b7('0x1d')]=qs[_0x90b7('0x1d')](_0x2b8d99[_0x90b7('0x2c')]['limit']);_0x4adc69[_0x90b7('0x1c')]=qs[_0x90b7('0x1c')](_0x2b8d99[_0x90b7('0x2c')][_0x90b7('0x1c')]);}_0x4adc69[_0x90b7('0x33')]=qs[_0x90b7('0x34')](_0x2b8d99[_0x90b7('0x2c')][_0x90b7('0x34')]);_0x4adc69[_0x90b7('0x35')]=qs['filters'](_[_0x90b7('0x36')](_0x2b8d99['query'],_0x47f43d[_0x90b7('0x37')]));if(_0x2b8d99['query']['filter']){_0x4adc69[_0x90b7('0x35')]=_[_0x90b7('0x38')](_0x4adc69[_0x90b7('0x35')],{'$or':_['map'](_0x19f0ab,function(_0x132e80){if(_0x132e80['type']!=='VIRTUAL'){var _0x2f6564={};_0x2f6564[_0x132e80[_0x90b7('0x24')]]={'$like':'%'+_0x2b8d99[_0x90b7('0x2c')][_0x90b7('0x39')]+'%'};return _0x2f6564;}})});}_0x4adc69=_[_0x90b7('0x38')]({},_0x4adc69,_0x2b8d99[_0x90b7('0x3a')]);var _0xddb8e3={'where':_0x4adc69['where']};return db[_0x90b7('0x28')][_0x90b7('0x1b')](_0xddb8e3)[_0x90b7('0x22')](function(_0x26beb7){_0x5b7a5b['count']=_0x26beb7;if(_0x2b8d99[_0x90b7('0x2c')]['includeAll']){_0x4adc69[_0x90b7('0x3b')]=[{'all':!![]}];}return db[_0x90b7('0x28')][_0x90b7('0x3c')](_0x4adc69);})[_0x90b7('0x22')](function(_0x293231){_0x5b7a5b['rows']=_0x293231;return _0x5b7a5b;})[_0x90b7('0x22')](respondWithFilteredResult(_0x4ba21e,_0x4adc69))[_0x90b7('0x3d')](handleError(_0x4ba21e,null));};exports[_0x90b7('0x3e')]=function(_0x28839c,_0xf36381){var _0x33c6f7={'raw':!![],'where':{'id':_0x28839c['params']['id']}},_0x4ce6bf={};_0x4ce6bf[_0x90b7('0x2b')]=_[_0x90b7('0x3f')](db['SquareMessage'][_0x90b7('0x29')]);_0x4ce6bf[_0x90b7('0x2c')]=_[_0x90b7('0x3f')](_0x28839c[_0x90b7('0x2c')]);_0x4ce6bf[_0x90b7('0x37')]=_[_0x90b7('0x2d')](_0x4ce6bf[_0x90b7('0x2b')],_0x4ce6bf[_0x90b7('0x2c')]);_0x33c6f7['attributes']=_['intersection'](_0x4ce6bf['model'],qs['fields'](_0x28839c[_0x90b7('0x2c')]['fields']));_0x33c6f7[_0x90b7('0x2e')]=_0x33c6f7[_0x90b7('0x2e')][_0x90b7('0x30')]?_0x33c6f7['attributes']:_0x4ce6bf[_0x90b7('0x2b')];if(_0x28839c[_0x90b7('0x2c')][_0x90b7('0x40')]){_0x33c6f7[_0x90b7('0x3b')]=[{'all':!![]}];}_0x33c6f7=_['merge']({},_0x33c6f7,_0x28839c['options']);return db[_0x90b7('0x28')]['find'](_0x33c6f7)[_0x90b7('0x22')](handleEntityNotFound(_0xf36381,null))[_0x90b7('0x22')](respondWithResult(_0xf36381,null))[_0x90b7('0x3d')](handleError(_0xf36381,null));};exports['create']=function(_0x3fc9a8,_0x2b2eec){return db[_0x90b7('0x28')][_0x90b7('0x41')](_0x3fc9a8['body'],{})[_0x90b7('0x22')](respondWithResult(_0x2b2eec,0xc9))['catch'](handleError(_0x2b2eec,null));};exports[_0x90b7('0x42')]=function(_0xc9d1a0,_0x523830){if(_0xc9d1a0[_0x90b7('0x43')]['id']){delete _0xc9d1a0[_0x90b7('0x43')]['id'];}return db[_0x90b7('0x28')][_0x90b7('0x44')]({'where':{'id':_0xc9d1a0[_0x90b7('0x45')]['id']}})['then'](handleEntityNotFound(_0x523830,null))[_0x90b7('0x22')](saveUpdates(_0xc9d1a0[_0x90b7('0x43')],null))[_0x90b7('0x22')](respondWithResult(_0x523830,null))[_0x90b7('0x3d')](handleError(_0x523830,null));};exports['destroy']=function(_0x2fa39e,_0x1fd592){return db[_0x90b7('0x28')][_0x90b7('0x44')]({'where':{'id':_0x2fa39e[_0x90b7('0x45')]['id']}})[_0x90b7('0x22')](handleEntityNotFound(_0x1fd592,null))[_0x90b7('0x22')](removeEntity(_0x1fd592,null))[_0x90b7('0x3d')](handleError(_0x1fd592,null));}; \ No newline at end of file +var _0xc16a=['nolimit','order','sort','filters','where','VIRTUAL','filter','merge','includeAll','include','rows','catch','params','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','map','SquareMessage','rawAttributes','type','key','model','query','keys','intersection','fields','length','attributes'];(function(_0x55a6cc,_0x4b5c86){var _0x489147=function(_0x526f69){while(--_0x526f69){_0x55a6cc['push'](_0x55a6cc['shift']());}};_0x489147(++_0x4b5c86);}(_0xc16a,0x160));var _0xac16=function(_0x3477bc,_0xeb3045){_0x3477bc=_0x3477bc-0x0;var _0x35b974=_0xc16a[_0x3477bc];return _0x35b974;};'use strict';var pdf=require(_0xac16('0x0'));var emlformat=require(_0xac16('0x1'));var rimraf=require(_0xac16('0x2'));var zipdir=require(_0xac16('0x3'));var jsonpatch=require(_0xac16('0x4'));var rp=require('request-promise');var moment=require(_0xac16('0x5'));var BPromise=require(_0xac16('0x6'));var Mustache=require(_0xac16('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xac16('0x8'));var ejs=require(_0xac16('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xac16('0xa'));var crypto=require(_0xac16('0xb'));var jsforce=require(_0xac16('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xac16('0x8'));var querystring=require(_0xac16('0xd'));var Papa=require('papaparse');var Redis=require(_0xac16('0xe'));var authService=require(_0xac16('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xac16('0x10'));var hardwareService=require(_0xac16('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xac16('0x12'));var config=require(_0xac16('0x13'));var db=require(_0xac16('0x14'))['db'];function respondWithStatusCode(_0x2e0770,_0x49da34){_0x49da34=_0x49da34||0xcc;return function(_0x36e38c){if(_0x36e38c){return _0x2e0770[_0xac16('0x15')](_0x49da34);}return _0x2e0770[_0xac16('0x16')](_0x49da34)[_0xac16('0x17')]();};}function respondWithResult(_0x176b46,_0x48efdb){_0x48efdb=_0x48efdb||0xc8;return function(_0x1ed6dd){if(_0x1ed6dd){return _0x176b46[_0xac16('0x16')](_0x48efdb)[_0xac16('0x18')](_0x1ed6dd);}};}function respondWithFilteredResult(_0x53649c,_0x424db7){return function(_0x38627e){if(_0x38627e){var _0x1aefc0=_0x38627e[_0xac16('0x19')],_0x295e1f=_0x424db7[_0xac16('0x1a')],_0x194f69=_0x424db7[_0xac16('0x1a')]+_0x424db7[_0xac16('0x1b')],_0x4d3dcc;if(_0x194f69>=_0x1aefc0){_0x194f69=_0x1aefc0;_0x4d3dcc=0xc8;}else{_0x4d3dcc=0xce;}_0x53649c[_0xac16('0x16')](_0x4d3dcc);return _0x53649c[_0xac16('0x1c')]('Content-Range',_0x295e1f+'-'+_0x194f69+'/'+_0x1aefc0)[_0xac16('0x18')](_0x38627e);}return null;};}function patchUpdates(_0x91adca){return function(_0x36e71c){try{jsonpatch[_0xac16('0x1d')](_0x36e71c,_0x91adca,!![]);}catch(_0x2a0c19){return BPromise[_0xac16('0x1e')](_0x2a0c19);}return _0x36e71c[_0xac16('0x1f')]();};}function saveUpdates(_0x2cfc0b,_0x1070ba){return function(_0x48402f){if(_0x48402f){return _0x48402f[_0xac16('0x20')](_0x2cfc0b)[_0xac16('0x21')](function(_0x29f7f5){return _0x29f7f5;});}return null;};}function removeEntity(_0x548d05,_0x34e33d){return function(_0x14ece6){if(_0x14ece6){return _0x14ece6[_0xac16('0x22')]()[_0xac16('0x21')](function(){_0x548d05['status'](0xcc)[_0xac16('0x17')]();});}};}function handleEntityNotFound(_0xfec18f,_0x409871){return function(_0x13e195){if(!_0x13e195){_0xfec18f[_0xac16('0x15')](0x194);}return _0x13e195;};}function handleError(_0x4a6036,_0x3c3113){_0x3c3113=_0x3c3113||0x1f4;return function(_0x543848){logger[_0xac16('0x23')](_0x543848['stack']);if(_0x543848[_0xac16('0x24')]){delete _0x543848[_0xac16('0x24')];}_0x4a6036[_0xac16('0x16')](_0x3c3113)[_0xac16('0x25')](_0x543848);};}exports['index']=function(_0x477496,_0x16d0fe){var _0x52d880={},_0x1e587d={},_0x518f86={'count':0x0,'rows':[]};var _0x153fe7=_[_0xac16('0x26')](db[_0xac16('0x27')][_0xac16('0x28')],function(_0x197a63){return{'name':_0x197a63['fieldName'],'type':_0x197a63[_0xac16('0x29')][_0xac16('0x2a')]};});_0x1e587d[_0xac16('0x2b')]=_[_0xac16('0x26')](_0x153fe7,_0xac16('0x24'));_0x1e587d[_0xac16('0x2c')]=_[_0xac16('0x2d')](_0x477496[_0xac16('0x2c')]);_0x1e587d['filters']=_['intersection'](_0x1e587d[_0xac16('0x2b')],_0x1e587d['query']);_0x52d880['attributes']=_[_0xac16('0x2e')](_0x1e587d[_0xac16('0x2b')],qs[_0xac16('0x2f')](_0x477496[_0xac16('0x2c')][_0xac16('0x2f')]));_0x52d880['attributes']=_0x52d880['attributes'][_0xac16('0x30')]?_0x52d880[_0xac16('0x31')]:_0x1e587d[_0xac16('0x2b')];if(!_0x477496[_0xac16('0x2c')]['hasOwnProperty'](_0xac16('0x32'))){_0x52d880['limit']=qs['limit'](_0x477496[_0xac16('0x2c')][_0xac16('0x1b')]);_0x52d880[_0xac16('0x1a')]=qs[_0xac16('0x1a')](_0x477496[_0xac16('0x2c')][_0xac16('0x1a')]);}_0x52d880[_0xac16('0x33')]=qs[_0xac16('0x34')](_0x477496['query'][_0xac16('0x34')]);_0x52d880['where']=qs['filters'](_['pick'](_0x477496[_0xac16('0x2c')],_0x1e587d[_0xac16('0x35')]));if(_0x477496[_0xac16('0x2c')]['filter']){_0x52d880[_0xac16('0x36')]=_['merge'](_0x52d880['where'],{'$or':_[_0xac16('0x26')](_0x153fe7,function(_0x1f8691){if(_0x1f8691[_0xac16('0x29')]!==_0xac16('0x37')){var _0x5f220d={};_0x5f220d[_0x1f8691[_0xac16('0x24')]]={'$like':'%'+_0x477496[_0xac16('0x2c')][_0xac16('0x38')]+'%'};return _0x5f220d;}})});}_0x52d880=_[_0xac16('0x39')]({},_0x52d880,_0x477496['options']);var _0xf3f17b={'where':_0x52d880[_0xac16('0x36')]};return db['SquareMessage'][_0xac16('0x19')](_0xf3f17b)[_0xac16('0x21')](function(_0x34b9b7){_0x518f86['count']=_0x34b9b7;if(_0x477496['query'][_0xac16('0x3a')]){_0x52d880[_0xac16('0x3b')]=[{'all':!![]}];}return db[_0xac16('0x27')]['findAll'](_0x52d880);})[_0xac16('0x21')](function(_0x4e0680){_0x518f86[_0xac16('0x3c')]=_0x4e0680;return _0x518f86;})[_0xac16('0x21')](respondWithFilteredResult(_0x16d0fe,_0x52d880))[_0xac16('0x3d')](handleError(_0x16d0fe,null));};exports['show']=function(_0x1fe23a,_0xc1f2d7){var _0x3156eb={'raw':!![],'where':{'id':_0x1fe23a[_0xac16('0x3e')]['id']}},_0x357e5a={};_0x357e5a[_0xac16('0x2b')]=_[_0xac16('0x2d')](db[_0xac16('0x27')]['rawAttributes']);_0x357e5a[_0xac16('0x2c')]=_['keys'](_0x1fe23a[_0xac16('0x2c')]);_0x357e5a[_0xac16('0x35')]=_[_0xac16('0x2e')](_0x357e5a[_0xac16('0x2b')],_0x357e5a[_0xac16('0x2c')]);_0x3156eb[_0xac16('0x31')]=_['intersection'](_0x357e5a['model'],qs[_0xac16('0x2f')](_0x1fe23a[_0xac16('0x2c')][_0xac16('0x2f')]));_0x3156eb[_0xac16('0x31')]=_0x3156eb['attributes']['length']?_0x3156eb[_0xac16('0x31')]:_0x357e5a[_0xac16('0x2b')];if(_0x1fe23a[_0xac16('0x2c')][_0xac16('0x3a')]){_0x3156eb['include']=[{'all':!![]}];}_0x3156eb=_[_0xac16('0x39')]({},_0x3156eb,_0x1fe23a[_0xac16('0x3f')]);return db[_0xac16('0x27')][_0xac16('0x40')](_0x3156eb)[_0xac16('0x21')](handleEntityNotFound(_0xc1f2d7,null))[_0xac16('0x21')](respondWithResult(_0xc1f2d7,null))[_0xac16('0x3d')](handleError(_0xc1f2d7,null));};exports[_0xac16('0x41')]=function(_0x1b8fcb,_0x4d8a25){return db['SquareMessage'][_0xac16('0x41')](_0x1b8fcb[_0xac16('0x42')],{})[_0xac16('0x21')](respondWithResult(_0x4d8a25,0xc9))[_0xac16('0x3d')](handleError(_0x4d8a25,null));};exports[_0xac16('0x20')]=function(_0x4c0afe,_0x46f4c5){if(_0x4c0afe[_0xac16('0x42')]['id']){delete _0x4c0afe['body']['id'];}return db[_0xac16('0x27')]['find']({'where':{'id':_0x4c0afe[_0xac16('0x3e')]['id']}})[_0xac16('0x21')](handleEntityNotFound(_0x46f4c5,null))[_0xac16('0x21')](saveUpdates(_0x4c0afe[_0xac16('0x42')],null))['then'](respondWithResult(_0x46f4c5,null))[_0xac16('0x3d')](handleError(_0x46f4c5,null));};exports[_0xac16('0x22')]=function(_0x2ae36f,_0xeeb167){return db[_0xac16('0x27')][_0xac16('0x40')]({'where':{'id':_0x2ae36f[_0xac16('0x3e')]['id']}})[_0xac16('0x21')](handleEntityNotFound(_0xeeb167,null))['then'](removeEntity(_0xeeb167,null))['catch'](handleError(_0xeeb167,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 1c98906..a290094 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 _0xc6e3=['api','moment','request-promise','rimraf','../../config/environment','./squareMessage.attributes','exports','define','square_messages','lodash','util','../../config/logger'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0xc6e3,0x195));var _0x3c6e=function(_0x533733,_0x4a1b62){_0x533733=_0x533733-0x0;var _0x126b48=_0xc6e3[_0x533733];return _0x126b48;};'use strict';var _=require(_0x3c6e('0x0'));var util=require(_0x3c6e('0x1'));var logger=require(_0x3c6e('0x2'))(_0x3c6e('0x3'));var moment=require(_0x3c6e('0x4'));var BPromise=require('bluebird');var rp=require(_0x3c6e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c6e('0x6'));var config=require(_0x3c6e('0x7'));var attributes=require(_0x3c6e('0x8'));module[_0x3c6e('0x9')]=function(_0xa931de,_0x63df86){return _0xa931de[_0x3c6e('0xa')]('SquareMessage',attributes,{'tableName':_0x3c6e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d9b=['path','rimraf','../../config/environment','./squareMessage.attributes','exports','square_messages','moment','bluebird','request-promise'];(function(_0x4c852c,_0x3114a1){var _0x2e3b3f=function(_0x3ac9f7){while(--_0x3ac9f7){_0x4c852c['push'](_0x4c852c['shift']());}};_0x2e3b3f(++_0x3114a1);}(_0x0d9b,0xc3));var _0xb0d9=function(_0x19441d,_0x192336){_0x19441d=_0x19441d-0x0;var _0x74006b=_0x0d9b[_0x19441d];return _0x74006b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb0d9('0x0'));var BPromise=require(_0xb0d9('0x1'));var rp=require(_0xb0d9('0x2'));var fs=require('fs');var path=require(_0xb0d9('0x3'));var rimraf=require(_0xb0d9('0x4'));var config=require(_0xb0d9('0x5'));var attributes=require(_0xb0d9('0x6'));module[_0xb0d9('0x7')]=function(_0x3b9b7a,_0x428520){return _0x3b9b7a['define']('SquareMessage',attributes,{'tableName':_0xb0d9('0x8'),'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 b327a73..18d2a3b 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 _0xd2f5=['SquareMessage','create','body','options','stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSquareMessage'];(function(_0x2c0be1,_0x1e88f2){var _0x3d4bd2=function(_0x2b5497){while(--_0x2b5497){_0x2c0be1['push'](_0x2c0be1['shift']());}};_0x3d4bd2(++_0x1e88f2);}(_0xd2f5,0x144));var _0x5d2f=function(_0x18438f,_0x2f0472){_0x18438f=_0x18438f-0x0;var _0x167eb3=_0xd2f5[_0x18438f];return _0x167eb3;};'use strict';var _=require(_0x5d2f('0x0'));var util=require('util');var moment=require(_0x5d2f('0x1'));var BPromise=require('bluebird');var rs=require(_0x5d2f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d2f('0x3'))['db'];var utils=require(_0x5d2f('0x4'));var logger=require(_0x5d2f('0x5'))(_0x5d2f('0x6'));var config=require(_0x5d2f('0x7'));var jayson=require(_0x5d2f('0x8'));var client=jayson[_0x5d2f('0x9')][_0x5d2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b2540,_0x443779,_0x908c6){return new BPromise(function(_0x1c8c59,_0x1670ea){return client[_0x5d2f('0xb')](_0x4b2540,_0x908c6)[_0x5d2f('0xc')](function(_0x58e637){logger[_0x5d2f('0xd')](_0x5d2f('0xe'),_0x443779,'request\x20sent');logger[_0x5d2f('0xf')](_0x5d2f('0x10'),_0x443779,_0x5d2f('0x11'),JSON['stringify'](_0x58e637));if(_0x58e637[_0x5d2f('0x12')]){if(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x13')]===0x1f4){logger['error']('SquareMessage,\x20%s,\x20%s',_0x443779,_0x58e637[_0x5d2f('0x12')]['message']);return _0x1670ea(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}logger['error'](_0x5d2f('0xe'),_0x443779,_0x58e637['error'][_0x5d2f('0x14')]);return _0x1c8c59(_0x58e637[_0x5d2f('0x12')][_0x5d2f('0x14')]);}else{logger['info'](_0x5d2f('0xe'),_0x443779,_0x5d2f('0x11'));_0x1c8c59(_0x58e637[_0x5d2f('0x15')][_0x5d2f('0x14')]);}})[_0x5d2f('0x16')](function(_0x5796f6){logger[_0x5d2f('0x12')](_0x5d2f('0xe'),_0x443779,_0x5796f6);_0x1670ea(_0x5796f6);});});}exports[_0x5d2f('0x17')]=function(_0x454782){var _0x5a79f1=this;return new Promise(function(_0x27e16d,_0x38a958){return db[_0x5d2f('0x18')][_0x5d2f('0x19')](_0x454782[_0x5d2f('0x1a')],{'raw':_0x454782[_0x5d2f('0x1b')]?_0x454782[_0x5d2f('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4d3959){logger[_0x5d2f('0xd')](_0x5d2f('0x17'),_0x454782);logger[_0x5d2f('0xf')](_0x5d2f('0x17'),_0x454782,JSON[_0x5d2f('0x1c')](_0x4d3959));_0x27e16d(_0x4d3959);})['catch'](function(_0x5cc8d6){logger[_0x5d2f('0x12')]('CreateSquareMessage',_0x5cc8d6[_0x5d2f('0x14')],_0x454782);_0x38a958(_0x5a79f1[_0x5d2f('0x12')](0x1f4,_0x5cc8d6[_0x5d2f('0x14')]));});});}; \ No newline at end of file +var _0xd1f9=['message','result','catch','CreateSquareMessage','body','options','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x30c9ba,_0xdcedf1){var _0x220f85=function(_0xa5e35){while(--_0xa5e35){_0x30c9ba['push'](_0x30c9ba['shift']());}};_0x220f85(++_0xdcedf1);}(_0xd1f9,0x88));var _0x9d1f=function(_0x2c40bf,_0x5ce37a){_0x2c40bf=_0x2c40bf-0x0;var _0x31ab19=_0xd1f9[_0x2c40bf];return _0x31ab19;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9d1f('0x0'));var BPromise=require(_0x9d1f('0x1'));var rs=require(_0x9d1f('0x2'));var fs=require('fs');var Redis=require(_0x9d1f('0x3'));var db=require(_0x9d1f('0x4'))['db'];var utils=require(_0x9d1f('0x5'));var logger=require(_0x9d1f('0x6'))(_0x9d1f('0x7'));var config=require(_0x9d1f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9d1f('0x9')][_0x9d1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c146b,_0x432319,_0x10ce17){return new BPromise(function(_0x270b08,_0xb6b61c){return client[_0x9d1f('0xb')](_0x2c146b,_0x10ce17)[_0x9d1f('0xc')](function(_0x259a49){logger[_0x9d1f('0xd')](_0x9d1f('0xe'),_0x432319,_0x9d1f('0xf'));logger[_0x9d1f('0x10')](_0x9d1f('0x11'),_0x432319,_0x9d1f('0xf'),JSON[_0x9d1f('0x12')](_0x259a49));if(_0x259a49[_0x9d1f('0x13')]){if(_0x259a49[_0x9d1f('0x13')]['code']===0x1f4){logger[_0x9d1f('0x13')](_0x9d1f('0xe'),_0x432319,_0x259a49[_0x9d1f('0x13')]['message']);return _0xb6b61c(_0x259a49[_0x9d1f('0x13')]['message']);}logger['error'](_0x9d1f('0xe'),_0x432319,_0x259a49[_0x9d1f('0x13')][_0x9d1f('0x14')]);return _0x270b08(_0x259a49[_0x9d1f('0x13')][_0x9d1f('0x14')]);}else{logger[_0x9d1f('0xd')](_0x9d1f('0xe'),_0x432319,_0x9d1f('0xf'));_0x270b08(_0x259a49[_0x9d1f('0x15')][_0x9d1f('0x14')]);}})[_0x9d1f('0x16')](function(_0x1dd0bd){logger[_0x9d1f('0x13')]('SquareMessage,\x20%s,\x20%s',_0x432319,_0x1dd0bd);_0xb6b61c(_0x1dd0bd);});});}exports[_0x9d1f('0x17')]=function(_0x42a2b4){var _0x4e5328=this;return new Promise(function(_0x329b69,_0x4f7224){return db['SquareMessage']['create'](_0x42a2b4[_0x9d1f('0x18')],{'raw':_0x42a2b4[_0x9d1f('0x19')]?_0x42a2b4[_0x9d1f('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x9d1f('0xc')](function(_0x4cfcf5){logger[_0x9d1f('0xd')]('CreateSquareMessage',_0x42a2b4);logger['debug'](_0x9d1f('0x17'),_0x42a2b4,JSON[_0x9d1f('0x12')](_0x4cfcf5));_0x329b69(_0x4cfcf5);})[_0x9d1f('0x16')](function(_0x2d861b){logger[_0x9d1f('0x13')](_0x9d1f('0x17'),_0x2d861b[_0x9d1f('0x14')],_0x42a2b4);_0x4f7224(_0x4e5328[_0x9d1f('0x13')](0x1f4,_0x2d861b[_0x9d1f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 1bee783..3e87c49 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 _0xc8de=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','test','post','create','put','/:id','update','delete','destroy','exports','util'];(function(_0x5a6d7c,_0x5c1817){var _0x5260ce=function(_0x31ba4e){while(--_0x31ba4e){_0x5a6d7c['push'](_0x5a6d7c['shift']());}};_0x5260ce(++_0x5c1817);}(_0xc8de,0x167));var _0xec8d=function(_0x2f9482,_0xa0a254){_0x2f9482=_0x2f9482-0x0;var _0x584e47=_0xc8de[_0x2f9482];return _0x584e47;};'use strict';var multer=require('multer');var util=require(_0xec8d('0x0'));var path=require(_0xec8d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xec8d('0x2')]();var auth=require(_0xec8d('0x3'));var interaction=require(_0xec8d('0x4'));var config=require(_0xec8d('0x5'));var controller=require(_0xec8d('0x6'));router[_0xec8d('0x7')]('/',auth[_0xec8d('0x8')](),controller['index']);router[_0xec8d('0x7')]('/:id',auth[_0xec8d('0x8')](),controller['show']);router[_0xec8d('0x7')]('/:id/test',auth[_0xec8d('0x8')](),timeout('15s'),controller[_0xec8d('0x9')]);router[_0xec8d('0xa')]('/',auth[_0xec8d('0x8')](),controller[_0xec8d('0xb')]);router[_0xec8d('0xc')](_0xec8d('0xd'),auth[_0xec8d('0x8')](),controller[_0xec8d('0xe')]);router[_0xec8d('0xf')](_0xec8d('0xd'),auth['isAuthenticated'](),controller[_0xec8d('0x10')]);module[_0xec8d('0x11')]=router; \ No newline at end of file +var _0xfbf2=['test','post','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/test','15s'];(function(_0x49f950,_0x343ea9){var _0xa17bf6=function(_0x546bec){while(--_0x546bec){_0x49f950['push'](_0x49f950['shift']());}};_0xa17bf6(++_0x343ea9);}(_0xfbf2,0x102));var _0x2fbf=function(_0x392a06,_0x233e23){_0x392a06=_0x392a06-0x0;var _0x42fb44=_0xfbf2[_0x392a06];return _0x42fb44;};'use strict';var multer=require(_0x2fbf('0x0'));var util=require('util');var path=require(_0x2fbf('0x1'));var timeout=require(_0x2fbf('0x2'));var express=require(_0x2fbf('0x3'));var router=express[_0x2fbf('0x4')]();var auth=require(_0x2fbf('0x5'));var interaction=require(_0x2fbf('0x6'));var config=require(_0x2fbf('0x7'));var controller=require('./squareOdbc.controller');router[_0x2fbf('0x8')]('/',auth['isAuthenticated'](),controller[_0x2fbf('0x9')]);router[_0x2fbf('0x8')](_0x2fbf('0xa'),auth[_0x2fbf('0xb')](),controller[_0x2fbf('0xc')]);router[_0x2fbf('0x8')](_0x2fbf('0xd'),auth[_0x2fbf('0xb')](),timeout(_0x2fbf('0xe')),controller[_0x2fbf('0xf')]);router[_0x2fbf('0x10')]('/',auth[_0x2fbf('0xb')](),controller[_0x2fbf('0x11')]);router[_0x2fbf('0x12')](_0x2fbf('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2fbf('0x13')](_0x2fbf('0xa'),auth[_0x2fbf('0xb')](),controller['destroy']);module[_0x2fbf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 95856dd..0262ce2 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 _0x0d21=['exports','STRING','name','sequelize'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x0d21,0xc3));var _0x10d2=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x0d21[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require(_0x10d2('0x0'));module[_0x10d2('0x1')]={'name':{'type':Sequelize[_0x10d2('0x2')],'unique':_0x10d2('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x10d2('0x2')]},'description':{'type':Sequelize[_0x10d2('0x2')]}}; \ No newline at end of file +var _0xa223=['name','sequelize','exports','STRING'];(function(_0x428dbd,_0x30eeb5){var _0xc411d8=function(_0x12cab8){while(--_0x12cab8){_0x428dbd['push'](_0x428dbd['shift']());}};_0xc411d8(++_0x30eeb5);}(_0xa223,0x129));var _0x3a22=function(_0x296708,_0x11b4fc){_0x296708=_0x296708-0x0;var _0x35d80a=_0xa223[_0x296708];return _0x35d80a;};'use strict';var Sequelize=require(_0x3a22('0x0'));module[_0x3a22('0x1')]={'name':{'type':Sequelize[_0x3a22('0x2')],'unique':_0x3a22('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x3a22('0x2')]},'description':{'type':Sequelize[_0x3a22('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 4ec062a..66fe394 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 _0x8e6f=['SquareOdbc','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','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','test','dsn','odbc','closeSync','html-pdf','eml-format','rimraf','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','then','destroy','get','ODBC','UserProfileResource','error','name','send','index'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8e6f,0xcd));var _0xf8e6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e6f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xf8e6('0x0'));var emlformat=require(_0xf8e6('0x1'));var rimraf=require(_0xf8e6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf8e6('0x3'));var Mustache=require(_0xf8e6('0x4'));var util=require(_0xf8e6('0x5'));var path=require('path');var sox=require(_0xf8e6('0x6'));var csv=require(_0xf8e6('0x7'));var ejs=require(_0xf8e6('0x8'));var fs=require('fs');var _=require(_0xf8e6('0x9'));var squel=require('squel');var crypto=require(_0xf8e6('0xa'));var jsforce=require(_0xf8e6('0xb'));var deskjs=require(_0xf8e6('0xc'));var toCsv=require(_0xf8e6('0x7'));var querystring=require(_0xf8e6('0xd'));var Papa=require(_0xf8e6('0xe'));var Redis=require(_0xf8e6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf8e6('0x10'));var as=require(_0xf8e6('0x11'));var hardwareService=require(_0xf8e6('0x12'));var logger=require(_0xf8e6('0x13'))('api');var utils=require(_0xf8e6('0x14'));var config=require(_0xf8e6('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56593d,_0x22115b){_0x22115b=_0x22115b||0xcc;return function(_0x2f1262){if(_0x2f1262){return _0x56593d[_0xf8e6('0x16')](_0x22115b);}return _0x56593d[_0xf8e6('0x17')](_0x22115b)[_0xf8e6('0x18')]();};}function respondWithResult(_0x4fe6da,_0x2f2d19){_0x2f2d19=_0x2f2d19||0xc8;return function(_0x3e47de){if(_0x3e47de){return _0x4fe6da[_0xf8e6('0x17')](_0x2f2d19)[_0xf8e6('0x19')](_0x3e47de);}};}function respondWithFilteredResult(_0x4667c5,_0x5d33ae){return function(_0xc9cbb3){if(_0xc9cbb3){var _0x450b4e=_0xc9cbb3[_0xf8e6('0x1a')],_0x214266=_0x5d33ae['offset'],_0x14afb9=_0x5d33ae[_0xf8e6('0x1b')]+_0x5d33ae[_0xf8e6('0x1c')],_0x4648c2;if(_0x14afb9>=_0x450b4e){_0x14afb9=_0x450b4e;_0x4648c2=0xc8;}else{_0x4648c2=0xce;}_0x4667c5[_0xf8e6('0x17')](_0x4648c2);return _0x4667c5[_0xf8e6('0x1d')]('Content-Range',_0x214266+'-'+_0x14afb9+'/'+_0x450b4e)['json'](_0xc9cbb3);}return null;};}function patchUpdates(_0x1709b4){return function(_0x32d1c5){try{jsonpatch[_0xf8e6('0x1e')](_0x32d1c5,_0x1709b4,!![]);}catch(_0x131b6d){return BPromise[_0xf8e6('0x1f')](_0x131b6d);}return _0x32d1c5['save']();};}function saveUpdates(_0x5be989,_0x5907fd){return function(_0x406b6a){if(_0x406b6a){return _0x406b6a['update'](_0x5be989)[_0xf8e6('0x20')](function(_0x15a6fa){return _0x15a6fa;});}return null;};}function removeEntity(_0x3c675b,_0x4ee424){return function(_0x22664f){if(_0x22664f){return _0x22664f[_0xf8e6('0x21')]()['then'](function(){var _0x573ee7=_0x22664f[_0xf8e6('0x22')]({'plain':!![]});var _0x3408c3=_0xf8e6('0x23');return db[_0xf8e6('0x24')][_0xf8e6('0x21')]({'where':{'type':_0x3408c3,'resourceId':_0x573ee7['id']}})[_0xf8e6('0x20')](function(){return _0x22664f;});})[_0xf8e6('0x20')](function(){_0x3c675b[_0xf8e6('0x17')](0xcc)[_0xf8e6('0x18')]();});}};}function handleEntityNotFound(_0x4462bc,_0x15c726){return function(_0x56e666){if(!_0x56e666){_0x4462bc[_0xf8e6('0x16')](0x194);}return _0x56e666;};}function handleError(_0x777ca3,_0x22483c){_0x22483c=_0x22483c||0x1f4;return function(_0x3d76a3){logger[_0xf8e6('0x25')](_0x3d76a3['stack']);if(_0x3d76a3[_0xf8e6('0x26')]){delete _0x3d76a3[_0xf8e6('0x26')];}_0x777ca3[_0xf8e6('0x17')](_0x22483c)[_0xf8e6('0x27')](_0x3d76a3);};}exports[_0xf8e6('0x28')]=function(_0x3cf64d,_0x184df4){var _0x4ae2e0={},_0x2552ec={},_0xc57b7e={'count':0x0,'rows':[]};var _0x742777=_['map'](db[_0xf8e6('0x29')][_0xf8e6('0x2a')],function(_0x1d1524){return{'name':_0x1d1524[_0xf8e6('0x2b')],'type':_0x1d1524['type']['key']};});_0x2552ec[_0xf8e6('0x2c')]=_[_0xf8e6('0x2d')](_0x742777,'name');_0x2552ec[_0xf8e6('0x2e')]=_[_0xf8e6('0x2f')](_0x3cf64d[_0xf8e6('0x2e')]);_0x2552ec[_0xf8e6('0x30')]=_[_0xf8e6('0x31')](_0x2552ec[_0xf8e6('0x2c')],_0x2552ec['query']);_0x4ae2e0[_0xf8e6('0x32')]=_[_0xf8e6('0x31')](_0x2552ec[_0xf8e6('0x2c')],qs[_0xf8e6('0x33')](_0x3cf64d[_0xf8e6('0x2e')][_0xf8e6('0x33')]));_0x4ae2e0[_0xf8e6('0x32')]=_0x4ae2e0[_0xf8e6('0x32')][_0xf8e6('0x34')]?_0x4ae2e0['attributes']:_0x2552ec[_0xf8e6('0x2c')];if(!_0x3cf64d[_0xf8e6('0x2e')][_0xf8e6('0x35')](_0xf8e6('0x36'))){_0x4ae2e0['limit']=qs[_0xf8e6('0x1c')](_0x3cf64d[_0xf8e6('0x2e')][_0xf8e6('0x1c')]);_0x4ae2e0[_0xf8e6('0x1b')]=qs[_0xf8e6('0x1b')](_0x3cf64d['query'][_0xf8e6('0x1b')]);}_0x4ae2e0['order']=qs[_0xf8e6('0x37')](_0x3cf64d['query']['sort']);_0x4ae2e0[_0xf8e6('0x38')]=qs['filters'](_[_0xf8e6('0x39')](_0x3cf64d[_0xf8e6('0x2e')],_0x2552ec[_0xf8e6('0x30')]));if(_0x3cf64d[_0xf8e6('0x2e')][_0xf8e6('0x3a')]){_0x4ae2e0[_0xf8e6('0x38')]=_['merge'](_0x4ae2e0[_0xf8e6('0x38')],{'$or':_[_0xf8e6('0x2d')](_0x742777,function(_0x53566c){if(_0x53566c['type']!==_0xf8e6('0x3b')){var _0x29b906={};_0x29b906[_0x53566c[_0xf8e6('0x26')]]={'$like':'%'+_0x3cf64d[_0xf8e6('0x2e')][_0xf8e6('0x3a')]+'%'};return _0x29b906;}})});}_0x4ae2e0=_[_0xf8e6('0x3c')]({},_0x4ae2e0,_0x3cf64d[_0xf8e6('0x3d')]);var _0x48f058={'where':_0x4ae2e0[_0xf8e6('0x38')]};return db[_0xf8e6('0x29')][_0xf8e6('0x1a')](_0x48f058)[_0xf8e6('0x20')](function(_0x16c7c3){_0xc57b7e[_0xf8e6('0x1a')]=_0x16c7c3;if(_0x3cf64d['query'][_0xf8e6('0x3e')]){_0x4ae2e0[_0xf8e6('0x3f')]=[{'all':!![]}];}return db['SquareOdbc'][_0xf8e6('0x40')](_0x4ae2e0);})[_0xf8e6('0x20')](function(_0xf08a39){_0xc57b7e[_0xf8e6('0x41')]=_0xf08a39;return _0xc57b7e;})[_0xf8e6('0x20')](respondWithFilteredResult(_0x184df4,_0x4ae2e0))['catch'](handleError(_0x184df4,null));};exports[_0xf8e6('0x42')]=function(_0x1139fd,_0x5c824b){var _0x40c6ce={'raw':!![],'where':{'id':_0x1139fd[_0xf8e6('0x43')]['id']}},_0x26e40e={};_0x26e40e[_0xf8e6('0x2c')]=_[_0xf8e6('0x2f')](db[_0xf8e6('0x29')][_0xf8e6('0x2a')]);_0x26e40e[_0xf8e6('0x2e')]=_['keys'](_0x1139fd[_0xf8e6('0x2e')]);_0x26e40e[_0xf8e6('0x30')]=_['intersection'](_0x26e40e[_0xf8e6('0x2c')],_0x26e40e[_0xf8e6('0x2e')]);_0x40c6ce[_0xf8e6('0x32')]=_['intersection'](_0x26e40e['model'],qs[_0xf8e6('0x33')](_0x1139fd[_0xf8e6('0x2e')][_0xf8e6('0x33')]));_0x40c6ce[_0xf8e6('0x32')]=_0x40c6ce[_0xf8e6('0x32')]['length']?_0x40c6ce[_0xf8e6('0x32')]:_0x26e40e[_0xf8e6('0x2c')];if(_0x1139fd['query'][_0xf8e6('0x3e')]){_0x40c6ce[_0xf8e6('0x3f')]=[{'all':!![]}];}_0x40c6ce=_[_0xf8e6('0x3c')]({},_0x40c6ce,_0x1139fd['options']);return db[_0xf8e6('0x29')][_0xf8e6('0x44')](_0x40c6ce)[_0xf8e6('0x20')](handleEntityNotFound(_0x5c824b,null))[_0xf8e6('0x20')](respondWithResult(_0x5c824b,null))[_0xf8e6('0x45')](handleError(_0x5c824b,null));};exports[_0xf8e6('0x46')]=function(_0xd2884e,_0x44b484){return db[_0xf8e6('0x29')][_0xf8e6('0x46')](_0xd2884e[_0xf8e6('0x47')],{})[_0xf8e6('0x20')](function(_0x457293){var _0x30d2f0=_0xd2884e[_0xf8e6('0x48')]['get']({'plain':!![]});if(!_0x30d2f0)throw new Error(_0xf8e6('0x49'));if(_0x30d2f0['role']===_0xf8e6('0x48')){var _0x416cc9=_0x457293['get']({'plain':!![]});var _0x235cb8=_0xf8e6('0x23');return db[_0xf8e6('0x4a')][_0xf8e6('0x44')]({'where':{'name':_0x235cb8,'userProfileId':_0x30d2f0[_0xf8e6('0x4b')]},'raw':!![]})[_0xf8e6('0x20')](function(_0x428db1){if(_0x428db1&&_0x428db1['autoAssociation']===0x0){return db[_0xf8e6('0x24')][_0xf8e6('0x46')]({'name':_0x416cc9[_0xf8e6('0x26')],'resourceId':_0x416cc9['id'],'type':_0x428db1['name'],'sectionId':_0x428db1['id']},{})[_0xf8e6('0x20')](function(){return _0x457293;});}else{return _0x457293;}})[_0xf8e6('0x45')](function(_0x33ceac){logger['error'](_0xf8e6('0x4c'),_0x33ceac);throw _0x33ceac;});}return _0x457293;})[_0xf8e6('0x20')](respondWithResult(_0x44b484,0xc9))[_0xf8e6('0x45')](handleError(_0x44b484,null));};exports[_0xf8e6('0x4d')]=function(_0x5dff04,_0x34f143){if(_0x5dff04[_0xf8e6('0x47')]['id']){delete _0x5dff04[_0xf8e6('0x47')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x5dff04['params']['id']}})[_0xf8e6('0x20')](handleEntityNotFound(_0x34f143,null))[_0xf8e6('0x20')](saveUpdates(_0x5dff04[_0xf8e6('0x47')],null))[_0xf8e6('0x20')](respondWithResult(_0x34f143,null))['catch'](handleError(_0x34f143,null));};exports['destroy']=function(_0x253ba1,_0x2c51a0){return db['SquareOdbc']['find']({'where':{'id':_0x253ba1[_0xf8e6('0x43')]['id']}})[_0xf8e6('0x20')](handleEntityNotFound(_0x2c51a0,null))[_0xf8e6('0x20')](removeEntity(_0x2c51a0,null))[_0xf8e6('0x45')](handleError(_0x2c51a0,null));};exports[_0xf8e6('0x4e')]=function(_0x34fedf,_0x48469b,_0x54a3f6){var _0x4e6d9b;return db[_0xf8e6('0x29')][_0xf8e6('0x44')]({'where':{'id':_0x34fedf[_0xf8e6('0x43')]['id']},'attributes':['id',_0xf8e6('0x4f')]})['then'](handleEntityNotFound(_0x48469b,null))[_0xf8e6('0x20')](function(_0x57378a){if(_0x57378a){var _0x2bc1cb=require(_0xf8e6('0x50'))();_0x2bc1cb['openSync'](_0x57378a[_0xf8e6('0x4f')]);_0x2bc1cb[_0xf8e6('0x51')]();return _0x57378a;}})[_0xf8e6('0x20')](respondWithResult(_0x48469b,null))[_0xf8e6('0x45')](handleError(_0x48469b,null));}; \ No newline at end of file +var _0x2467=['request-promise','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','then','get','ODBC','UserProfileResource','destroy','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','type','VIRTUAL','filter','merge','count','includeAll','findAll','show','options','catch','create','body','user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','test','dsn','odbc','openSync','closeSync','html-pdf','rimraf','fast-json-patch'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x2467,0xfc));var _0x7246=function(_0x373acb,_0x462b69){_0x373acb=_0x373acb-0x0;var _0x4458a1=_0x2467[_0x373acb];return _0x4458a1;};'use strict';var pdf=require(_0x7246('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7246('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7246('0x2'));var rp=require(_0x7246('0x3'));var moment=require('moment');var BPromise=require(_0x7246('0x4'));var Mustache=require(_0x7246('0x5'));var util=require(_0x7246('0x6'));var path=require('path');var sox=require(_0x7246('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x7246('0x8'));var squel=require(_0x7246('0x9'));var crypto=require(_0x7246('0xa'));var jsforce=require(_0x7246('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x7246('0xc'));var querystring=require(_0x7246('0xd'));var Papa=require(_0x7246('0xe'));var Redis=require('ioredis');var authService=require(_0x7246('0xf'));var qs=require(_0x7246('0x10'));var as=require(_0x7246('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7246('0x12'))(_0x7246('0x13'));var utils=require(_0x7246('0x14'));var config=require(_0x7246('0x15'));var db=require(_0x7246('0x16'))['db'];function respondWithStatusCode(_0x4386bc,_0x574961){_0x574961=_0x574961||0xcc;return function(_0x4e2e0e){if(_0x4e2e0e){return _0x4386bc[_0x7246('0x17')](_0x574961);}return _0x4386bc[_0x7246('0x18')](_0x574961)[_0x7246('0x19')]();};}function respondWithResult(_0x279fbf,_0x80a702){_0x80a702=_0x80a702||0xc8;return function(_0x4a8559){if(_0x4a8559){return _0x279fbf[_0x7246('0x18')](_0x80a702)[_0x7246('0x1a')](_0x4a8559);}};}function respondWithFilteredResult(_0x287d92,_0x1e1a74){return function(_0x126c6b){if(_0x126c6b){var _0x51a91f=_0x126c6b['count'],_0x5ec529=_0x1e1a74[_0x7246('0x1b')],_0x2af12c=_0x1e1a74['offset']+_0x1e1a74[_0x7246('0x1c')],_0x4ba8ea;if(_0x2af12c>=_0x51a91f){_0x2af12c=_0x51a91f;_0x4ba8ea=0xc8;}else{_0x4ba8ea=0xce;}_0x287d92[_0x7246('0x18')](_0x4ba8ea);return _0x287d92[_0x7246('0x1d')](_0x7246('0x1e'),_0x5ec529+'-'+_0x2af12c+'/'+_0x51a91f)['json'](_0x126c6b);}return null;};}function patchUpdates(_0x1cbc6d){return function(_0x101a30){try{jsonpatch[_0x7246('0x1f')](_0x101a30,_0x1cbc6d,!![]);}catch(_0x32c7ed){return BPromise['reject'](_0x32c7ed);}return _0x101a30[_0x7246('0x20')]();};}function saveUpdates(_0x1dee2e,_0x190ac1){return function(_0x32a32c){if(_0x32a32c){return _0x32a32c['update'](_0x1dee2e)[_0x7246('0x21')](function(_0x1a5c9d){return _0x1a5c9d;});}return null;};}function removeEntity(_0x4b6795,_0x2e107a){return function(_0x41c023){if(_0x41c023){return _0x41c023['destroy']()[_0x7246('0x21')](function(){var _0x1ec877=_0x41c023[_0x7246('0x22')]({'plain':!![]});var _0x17427d=_0x7246('0x23');return db[_0x7246('0x24')][_0x7246('0x25')]({'where':{'type':_0x17427d,'resourceId':_0x1ec877['id']}})[_0x7246('0x21')](function(){return _0x41c023;});})['then'](function(){_0x4b6795[_0x7246('0x18')](0xcc)[_0x7246('0x19')]();});}};}function handleEntityNotFound(_0x286594,_0x16d858){return function(_0x3c150a){if(!_0x3c150a){_0x286594[_0x7246('0x17')](0x194);}return _0x3c150a;};}function handleError(_0x3ac525,_0x11c327){_0x11c327=_0x11c327||0x1f4;return function(_0x154dce){logger[_0x7246('0x26')](_0x154dce[_0x7246('0x27')]);if(_0x154dce[_0x7246('0x28')]){delete _0x154dce[_0x7246('0x28')];}_0x3ac525['status'](_0x11c327)[_0x7246('0x29')](_0x154dce);};}exports[_0x7246('0x2a')]=function(_0x27c12d,_0x34e917){var _0x12ed2f={},_0x5bf1c2={},_0x4820e3={'count':0x0,'rows':[]};var _0x269878=_[_0x7246('0x2b')](db[_0x7246('0x2c')][_0x7246('0x2d')],function(_0x369abc){return{'name':_0x369abc[_0x7246('0x2e')],'type':_0x369abc['type'][_0x7246('0x2f')]};});_0x5bf1c2[_0x7246('0x30')]=_[_0x7246('0x2b')](_0x269878,_0x7246('0x28'));_0x5bf1c2[_0x7246('0x31')]=_[_0x7246('0x32')](_0x27c12d['query']);_0x5bf1c2[_0x7246('0x33')]=_[_0x7246('0x34')](_0x5bf1c2[_0x7246('0x30')],_0x5bf1c2['query']);_0x12ed2f['attributes']=_[_0x7246('0x34')](_0x5bf1c2[_0x7246('0x30')],qs[_0x7246('0x35')](_0x27c12d['query'][_0x7246('0x35')]));_0x12ed2f[_0x7246('0x36')]=_0x12ed2f[_0x7246('0x36')][_0x7246('0x37')]?_0x12ed2f[_0x7246('0x36')]:_0x5bf1c2[_0x7246('0x30')];if(!_0x27c12d[_0x7246('0x31')][_0x7246('0x38')]('nolimit')){_0x12ed2f[_0x7246('0x1c')]=qs['limit'](_0x27c12d['query'][_0x7246('0x1c')]);_0x12ed2f[_0x7246('0x1b')]=qs[_0x7246('0x1b')](_0x27c12d[_0x7246('0x31')]['offset']);}_0x12ed2f[_0x7246('0x39')]=qs['sort'](_0x27c12d[_0x7246('0x31')]['sort']);_0x12ed2f[_0x7246('0x3a')]=qs['filters'](_[_0x7246('0x3b')](_0x27c12d[_0x7246('0x31')],_0x5bf1c2[_0x7246('0x33')]));if(_0x27c12d[_0x7246('0x31')]['filter']){_0x12ed2f[_0x7246('0x3a')]=_['merge'](_0x12ed2f[_0x7246('0x3a')],{'$or':_['map'](_0x269878,function(_0x23ce50){if(_0x23ce50[_0x7246('0x3c')]!==_0x7246('0x3d')){var _0x294e9f={};_0x294e9f[_0x23ce50[_0x7246('0x28')]]={'$like':'%'+_0x27c12d[_0x7246('0x31')][_0x7246('0x3e')]+'%'};return _0x294e9f;}})});}_0x12ed2f=_[_0x7246('0x3f')]({},_0x12ed2f,_0x27c12d['options']);var _0x92de3f={'where':_0x12ed2f['where']};return db[_0x7246('0x2c')][_0x7246('0x40')](_0x92de3f)[_0x7246('0x21')](function(_0xee3db9){_0x4820e3['count']=_0xee3db9;if(_0x27c12d[_0x7246('0x31')][_0x7246('0x41')]){_0x12ed2f['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x7246('0x42')](_0x12ed2f);})[_0x7246('0x21')](function(_0x12bda0){_0x4820e3['rows']=_0x12bda0;return _0x4820e3;})['then'](respondWithFilteredResult(_0x34e917,_0x12ed2f))['catch'](handleError(_0x34e917,null));};exports[_0x7246('0x43')]=function(_0x69db8a,_0x2c4785){var _0x818001={'raw':!![],'where':{'id':_0x69db8a['params']['id']}},_0x58f2c2={};_0x58f2c2['model']=_[_0x7246('0x32')](db['SquareOdbc'][_0x7246('0x2d')]);_0x58f2c2[_0x7246('0x31')]=_[_0x7246('0x32')](_0x69db8a[_0x7246('0x31')]);_0x58f2c2['filters']=_[_0x7246('0x34')](_0x58f2c2[_0x7246('0x30')],_0x58f2c2[_0x7246('0x31')]);_0x818001['attributes']=_[_0x7246('0x34')](_0x58f2c2['model'],qs['fields'](_0x69db8a[_0x7246('0x31')][_0x7246('0x35')]));_0x818001[_0x7246('0x36')]=_0x818001[_0x7246('0x36')][_0x7246('0x37')]?_0x818001[_0x7246('0x36')]:_0x58f2c2['model'];if(_0x69db8a[_0x7246('0x31')][_0x7246('0x41')]){_0x818001['include']=[{'all':!![]}];}_0x818001=_['merge']({},_0x818001,_0x69db8a[_0x7246('0x44')]);return db[_0x7246('0x2c')]['find'](_0x818001)[_0x7246('0x21')](handleEntityNotFound(_0x2c4785,null))['then'](respondWithResult(_0x2c4785,null))[_0x7246('0x45')](handleError(_0x2c4785,null));};exports[_0x7246('0x46')]=function(_0x181e52,_0x443742){return db[_0x7246('0x2c')][_0x7246('0x46')](_0x181e52[_0x7246('0x47')],{})[_0x7246('0x21')](function(_0x147279){var _0xc1fcac=_0x181e52[_0x7246('0x48')][_0x7246('0x22')]({'plain':!![]});if(!_0xc1fcac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc1fcac[_0x7246('0x49')]===_0x7246('0x48')){var _0x4bef49=_0x147279[_0x7246('0x22')]({'plain':!![]});var _0x59c400=_0x7246('0x23');return db['UserProfileSection'][_0x7246('0x4a')]({'where':{'name':_0x59c400,'userProfileId':_0xc1fcac[_0x7246('0x4b')]},'raw':!![]})['then'](function(_0x3f9995){if(_0x3f9995&&_0x3f9995[_0x7246('0x4c')]===0x0){return db[_0x7246('0x24')]['create']({'name':_0x4bef49['name'],'resourceId':_0x4bef49['id'],'type':_0x3f9995[_0x7246('0x28')],'sectionId':_0x3f9995['id']},{})[_0x7246('0x21')](function(){return _0x147279;});}else{return _0x147279;}})[_0x7246('0x45')](function(_0xcd1b5a){logger[_0x7246('0x26')](_0x7246('0x4d'),_0xcd1b5a);throw _0xcd1b5a;});}return _0x147279;})[_0x7246('0x21')](respondWithResult(_0x443742,0xc9))[_0x7246('0x45')](handleError(_0x443742,null));};exports[_0x7246('0x4e')]=function(_0x4e2732,_0x10aaa2){if(_0x4e2732[_0x7246('0x47')]['id']){delete _0x4e2732['body']['id'];}return db[_0x7246('0x2c')][_0x7246('0x4a')]({'where':{'id':_0x4e2732['params']['id']}})['then'](handleEntityNotFound(_0x10aaa2,null))[_0x7246('0x21')](saveUpdates(_0x4e2732[_0x7246('0x47')],null))['then'](respondWithResult(_0x10aaa2,null))['catch'](handleError(_0x10aaa2,null));};exports[_0x7246('0x25')]=function(_0x3b5597,_0x1344d2){return db['SquareOdbc'][_0x7246('0x4a')]({'where':{'id':_0x3b5597[_0x7246('0x4f')]['id']}})[_0x7246('0x21')](handleEntityNotFound(_0x1344d2,null))['then'](removeEntity(_0x1344d2,null))[_0x7246('0x45')](handleError(_0x1344d2,null));};exports[_0x7246('0x50')]=function(_0x9354f1,_0xac958a,_0x2a8dd2){var _0x2f7d21;return db[_0x7246('0x2c')]['find']({'where':{'id':_0x9354f1['params']['id']},'attributes':['id',_0x7246('0x51')]})[_0x7246('0x21')](handleEntityNotFound(_0xac958a,null))[_0x7246('0x21')](function(_0x85b013){if(_0x85b013){var _0x1852d9=require(_0x7246('0x52'))();_0x1852d9[_0x7246('0x53')](_0x85b013[_0x7246('0x51')]);_0x1852d9[_0x7246('0x54')]();return _0x85b013;}})['then'](respondWithResult(_0xac958a,null))[_0x7246('0x45')](handleError(_0xac958a,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 7f837c9..ba6d96e 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 _0x6af5=['define','SquareOdbc','square_odbc','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports'];(function(_0x38f5c6,_0x57cf85){var _0xa54f1d=function(_0x46e9f3){while(--_0x46e9f3){_0x38f5c6['push'](_0x38f5c6['shift']());}};_0xa54f1d(++_0x57cf85);}(_0x6af5,0x7b));var _0x56af=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x6af5[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x56af('0x0'));var logger=require(_0x56af('0x1'))('api');var moment=require('moment');var BPromise=require(_0x56af('0x2'));var rp=require(_0x56af('0x3'));var fs=require('fs');var path=require(_0x56af('0x4'));var rimraf=require(_0x56af('0x5'));var config=require(_0x56af('0x6'));var attributes=require(_0x56af('0x7'));module[_0x56af('0x8')]=function(_0x432f9d,_0x19528b){return _0x432f9d[_0x56af('0x9')](_0x56af('0xa'),attributes,{'tableName':_0x56af('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf57e=['path','exports','square_odbc','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x4ce2f4,_0x5e3d4a){var _0x13145e=function(_0x4bc990){while(--_0x4bc990){_0x4ce2f4['push'](_0x4ce2f4['shift']());}};_0x13145e(++_0x5e3d4a);}(_0xf57e,0x1e9));var _0xef57=function(_0x49c817,_0x49e108){_0x49c817=_0x49c817-0x0;var _0x6e3579=_0xf57e[_0x49c817];return _0x6e3579;};'use strict';var _=require(_0xef57('0x0'));var util=require(_0xef57('0x1'));var logger=require(_0xef57('0x2'))(_0xef57('0x3'));var moment=require(_0xef57('0x4'));var BPromise=require('bluebird');var rp=require(_0xef57('0x5'));var fs=require('fs');var path=require(_0xef57('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0xef57('0x7')]=function(_0x3da419,_0x5ee7e5){return _0x3da419['define']('SquareOdbc',attributes,{'tableName':_0xef57('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 175c2d8..6eb7e67 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 _0x9957=['stringify','error','code','message','result','catch','ShowSquareOdbc','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x1d8a3f,_0xba8ea1){var _0x481362=function(_0x4b39d1){while(--_0x4b39d1){_0x1d8a3f['push'](_0x1d8a3f['shift']());}};_0x481362(++_0xba8ea1);}(_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']('SquareOdbc,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['SquareOdbc'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowSquareOdbc',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0x008c=['stringify','ShowSquareOdbc','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','find','options','include','map','attributes','model','then'];(function(_0x179c89,_0x3a69b2){var _0x4b87e5=function(_0xbdf6f2){while(--_0xbdf6f2){_0x179c89['push'](_0x179c89['shift']());}};_0x4b87e5(++_0x3a69b2);}(_0x008c,0x188));var _0xc008=function(_0x37d5ff,_0x5ee83b){_0x37d5ff=_0x37d5ff-0x0;var _0x146b37=_0x008c[_0x37d5ff];return _0x146b37;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['ShowSquareOdbc']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareOdbc'][_0xc008('0x15')]({'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x540e45['options']?_0x540e45[_0xc008('0x16')]['where']||null:null,'attributes':_0x540e45['options']?_0x540e45['options']['attributes']||null:null,'include':_0x540e45['options']?_0x540e45[_0xc008('0x16')][_0xc008('0x17')]?_[_0xc008('0x18')](_0x540e45[_0xc008('0x16')][_0xc008('0x17')],function(_0x110128){return{'model':db[_0x110128['model']],'as':_0x110128['as'],'attributes':_0x110128[_0xc008('0x19')],'include':_0x110128['include']?_['map'](_0x110128[_0xc008('0x17')],function(_0x36f358){return{'model':db[_0x36f358[_0xc008('0x1a')]],'as':_0x36f358['as'],'attributes':_0x36f358[_0xc008('0x19')],'include':_0x36f358['include']?_['map'](_0x36f358['include'],function(_0x3f7b07){return{'model':db[_0x3f7b07[_0xc008('0x1a')]],'as':_0x3f7b07['as'],'attributes':_0x3f7b07[_0xc008('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc008('0x1b')](function(_0x5bebd9){logger['info']('ShowSquareOdbc',_0x540e45);logger['debug']('ShowSquareOdbc',_0x540e45,JSON[_0xc008('0x1c')](_0x5bebd9));_0x46042b(_0x5bebd9);})[_0xc008('0x14')](function(_0x25eae4){logger['error'](_0xc008('0x1d'),_0x25eae4[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668[_0xc008('0x10')](0x1f4,_0x25eae4[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 55f25f0..3605cd5 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 _0x8f59=['create','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id','/:id/users','isAuthenticated','post'];(function(_0x350876,_0xe2cd28){var _0x1134bd=function(_0x6fb71f){while(--_0x6fb71f){_0x350876['push'](_0x350876['shift']());}};_0x1134bd(++_0xe2cd28);}(_0x8f59,0x11d));var _0x98f5=function(_0x3daa8c,_0x388a87){_0x3daa8c=_0x3daa8c-0x0;var _0x2b1bd7=_0x8f59[_0x3daa8c];return _0x2b1bd7;};'use strict';var multer=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var path=require(_0x98f5('0x2'));var timeout=require(_0x98f5('0x3'));var express=require(_0x98f5('0x4'));var router=express[_0x98f5('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x98f5('0x6'));var config=require(_0x98f5('0x7'));var controller=require(_0x98f5('0x8'));router[_0x98f5('0x9')]('/',auth['isAuthenticated'](),controller[_0x98f5('0xa')]);router[_0x98f5('0x9')](_0x98f5('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x98f5('0x9')](_0x98f5('0xc'),auth[_0x98f5('0xd')](),controller['getUsers']);router[_0x98f5('0xe')]('/',auth[_0x98f5('0xd')](),controller[_0x98f5('0xf')]);router[_0x98f5('0xe')]('/:id/users',auth[_0x98f5('0xd')](),controller['addUsers']);router['put'](_0x98f5('0xb'),auth[_0x98f5('0xd')](),controller['update']);router[_0x98f5('0x10')](_0x98f5('0xb'),auth[_0x98f5('0xd')](),controller[_0x98f5('0x11')]);router[_0x98f5('0x10')](_0x98f5('0xc'),auth['isAuthenticated'](),controller[_0x98f5('0x12')]);module[_0x98f5('0x13')]=router; \ No newline at end of file +var _0xa5fa=['post','put','update','delete','removeUsers','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users'];(function(_0x4a324e,_0x14c504){var _0x5ede4f=function(_0x8ad7ff){while(--_0x8ad7ff){_0x4a324e['push'](_0x4a324e['shift']());}};_0x5ede4f(++_0x14c504);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x10296f,_0x4db559){_0x10296f=_0x10296f-0x0;var _0x404832=_0xa5fa[_0x10296f];return _0x404832;};'use strict';var multer=require('multer');var util=require(_0xaa5f('0x0'));var path=require(_0xaa5f('0x1'));var timeout=require(_0xaa5f('0x2'));var express=require(_0xaa5f('0x3'));var router=express['Router']();var auth=require(_0xaa5f('0x4'));var interaction=require(_0xaa5f('0x5'));var config=require('../../config/environment');var controller=require(_0xaa5f('0x6'));router[_0xaa5f('0x7')]('/',auth[_0xaa5f('0x8')](),controller[_0xaa5f('0x9')]);router[_0xaa5f('0x7')](_0xaa5f('0xa'),auth[_0xaa5f('0x8')](),controller[_0xaa5f('0xb')]);router[_0xaa5f('0x7')](_0xaa5f('0xc'),auth[_0xaa5f('0x8')](),controller['getUsers']);router[_0xaa5f('0xd')]('/',auth[_0xaa5f('0x8')](),controller['create']);router['post'](_0xaa5f('0xc'),auth['isAuthenticated'](),controller['addUsers']);router[_0xaa5f('0xe')]('/:id',auth[_0xaa5f('0x8')](),controller[_0xaa5f('0xf')]);router[_0xaa5f('0x10')](_0xaa5f('0xa'),auth[_0xaa5f('0x8')](),controller['destroy']);router[_0xaa5f('0x10')]('/:id/users',auth[_0xaa5f('0x8')](),controller[_0xaa5f('0x11')]);module[_0xaa5f('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index bdf74fc..1bd6835 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 _0xf6ed=['sequelize','exports','STRING','TEXT','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x199fe8,_0x2f737e){var _0x44e5dc=function(_0x12f124){while(--_0x12f124){_0x199fe8['push'](_0x199fe8['shift']());}};_0x44e5dc(++_0x2f737e);}(_0xf6ed,0x10e));var _0xdf6e=function(_0x56d189,_0x52f209){_0x56d189=_0x56d189-0x0;var _0x1e677d=_0xf6ed[_0x56d189];return _0x1e677d;};'use strict';var Sequelize=require(_0xdf6e('0x0'));module[_0xdf6e('0x1')]={'name':{'type':Sequelize[_0xdf6e('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xdf6e('0x2')]},'notes':{'type':Sequelize[_0xdf6e('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0xdf6e('0x4')),'get':function(){if(this[_0xdf6e('0x5')]('preproduction')){return this[_0xdf6e('0x5')](_0xdf6e('0x6'))[_0xdf6e('0x7')](_0xdf6e('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0xdf6e('0x4')),'get':function(){if(this[_0xdf6e('0x5')](_0xdf6e('0x9'))){return this[_0xdf6e('0x5')](_0xdf6e('0x9'))[_0xdf6e('0x7')](_0xdf6e('0x8'));}}}}; \ No newline at end of file +var _0x7839=['utf8','BLOB','production','sequelize','exports','name','STRING','TEXT','getDataValue','preproduction','toString'];(function(_0xdc5664,_0x4eef5a){var _0xd65a92=function(_0x73d50){while(--_0x73d50){_0xdc5664['push'](_0xdc5664['shift']());}};_0xd65a92(++_0x4eef5a);}(_0x7839,0x1dc));var _0x9783=function(_0x287665,_0x1202ee){_0x287665=_0x287665-0x0;var _0x1443d2=_0x7839[_0x287665];return _0x1443d2;};'use strict';var Sequelize=require(_0x9783('0x0'));module[_0x9783('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9783('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9783('0x3')]},'notes':{'type':Sequelize[_0x9783('0x4')]},'preproduction':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x9783('0x5')](_0x9783('0x6'))){return this[_0x9783('0x5')]('preproduction')[_0x9783('0x7')](_0x9783('0x8'));}}},'production':{'type':Sequelize[_0x9783('0x9')]('long'),'get':function(){if(this['getDataValue']('production')){return this[_0x9783('0x5')](_0x9783('0xa'))[_0x9783('0x7')]('utf8');}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 855abd7..939b771 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 _0xe205=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','sendStatus','status','end','json','count','offset','limit','set','reject','update','then','get','SquareProjects','UserProfileResource','destroy','error','name','send','index','map','SquareProject','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','userSquareProject:remove','emit','getUsers','User','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','querystring','ioredis','../../components/auth/service'];(function(_0x2287e8,_0x4e089a){var _0x4d7825=function(_0x237cba){while(--_0x237cba){_0x2287e8['push'](_0x2287e8['shift']());}};_0x4d7825(++_0x4e089a);}(_0xe205,0xa7));var _0x5e20=function(_0x44067c,_0x5a2285){_0x44067c=_0x44067c-0x0;var _0x423094=_0xe205[_0x44067c];return _0x423094;};'use strict';var pdf=require(_0x5e20('0x0'));var emlformat=require(_0x5e20('0x1'));var rimraf=require(_0x5e20('0x2'));var zipdir=require(_0x5e20('0x3'));var jsonpatch=require(_0x5e20('0x4'));var rp=require(_0x5e20('0x5'));var moment=require(_0x5e20('0x6'));var BPromise=require(_0x5e20('0x7'));var Mustache=require(_0x5e20('0x8'));var util=require('util');var path=require(_0x5e20('0x9'));var sox=require(_0x5e20('0xa'));var csv=require(_0x5e20('0xb'));var ejs=require(_0x5e20('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e20('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e20('0xb'));var querystring=require(_0x5e20('0xe'));var Papa=require('papaparse');var Redis=require(_0x5e20('0xf'));var authService=require(_0x5e20('0x10'));var qs=require(_0x5e20('0x11'));var as=require(_0x5e20('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e20('0x13'))(_0x5e20('0x14'));var utils=require(_0x5e20('0x15'));var config=require(_0x5e20('0x16'));var db=require(_0x5e20('0x17'))['db'];config[_0x5e20('0x18')]=_['defaults'](config[_0x5e20('0x18')],{'host':_0x5e20('0x19'),'port':0x18eb});var socket=require(_0x5e20('0x1a'))(new Redis(config['redis']));require(_0x5e20('0x1b'))['register'](socket);function respondWithStatusCode(_0x1f47f3,_0x5ba833){_0x5ba833=_0x5ba833||0xcc;return function(_0x15587b){if(_0x15587b){return _0x1f47f3[_0x5e20('0x1c')](_0x5ba833);}return _0x1f47f3[_0x5e20('0x1d')](_0x5ba833)[_0x5e20('0x1e')]();};}function respondWithResult(_0x294df8,_0x542b3c){_0x542b3c=_0x542b3c||0xc8;return function(_0xeaeb77){if(_0xeaeb77){return _0x294df8[_0x5e20('0x1d')](_0x542b3c)[_0x5e20('0x1f')](_0xeaeb77);}};}function respondWithFilteredResult(_0x22c8d6,_0x2f194b){return function(_0x3b353f){if(_0x3b353f){var _0x1cc706=_0x3b353f[_0x5e20('0x20')],_0xf3488f=_0x2f194b['offset'],_0x4d3e4a=_0x2f194b[_0x5e20('0x21')]+_0x2f194b[_0x5e20('0x22')],_0x434686;if(_0x4d3e4a>=_0x1cc706){_0x4d3e4a=_0x1cc706;_0x434686=0xc8;}else{_0x434686=0xce;}_0x22c8d6[_0x5e20('0x1d')](_0x434686);return _0x22c8d6[_0x5e20('0x23')]('Content-Range',_0xf3488f+'-'+_0x4d3e4a+'/'+_0x1cc706)[_0x5e20('0x1f')](_0x3b353f);}return null;};}function patchUpdates(_0x50f222){return function(_0x4a3587){try{jsonpatch['apply'](_0x4a3587,_0x50f222,!![]);}catch(_0x5d0d1a){return BPromise[_0x5e20('0x24')](_0x5d0d1a);}return _0x4a3587['save']();};}function saveUpdates(_0x3d89e4,_0x29b111){return function(_0x30d849){if(_0x30d849){return _0x30d849[_0x5e20('0x25')](_0x3d89e4)[_0x5e20('0x26')](function(_0x2d4614){return _0x2d4614;});}return null;};}function removeEntity(_0x4c5732,_0x15705f){return function(_0x5a755f){if(_0x5a755f){return _0x5a755f['destroy']()[_0x5e20('0x26')](function(){var _0x58d678=_0x5a755f[_0x5e20('0x27')]({'plain':!![]});var _0x1b01af=_0x5e20('0x28');return db[_0x5e20('0x29')][_0x5e20('0x2a')]({'where':{'type':_0x1b01af,'resourceId':_0x58d678['id']}})['then'](function(){return _0x5a755f;});})[_0x5e20('0x26')](function(){_0x4c5732[_0x5e20('0x1d')](0xcc)[_0x5e20('0x1e')]();});}};}function handleEntityNotFound(_0x3032ef,_0x4c799d){return function(_0x3a0f06){if(!_0x3a0f06){_0x3032ef[_0x5e20('0x1c')](0x194);}return _0x3a0f06;};}function handleError(_0x37f09a,_0x222e7a){_0x222e7a=_0x222e7a||0x1f4;return function(_0xbed73a){logger[_0x5e20('0x2b')](_0xbed73a['stack']);if(_0xbed73a[_0x5e20('0x2c')]){delete _0xbed73a[_0x5e20('0x2c')];}_0x37f09a['status'](_0x222e7a)[_0x5e20('0x2d')](_0xbed73a);};}exports[_0x5e20('0x2e')]=function(_0x335f1e,_0x4196a3){var _0x1548c8={},_0x395a27={},_0x4ff715={'count':0x0,'rows':[]};var _0x207a6b=_[_0x5e20('0x2f')](db[_0x5e20('0x30')][_0x5e20('0x31')],function(_0x272da4){return{'name':_0x272da4[_0x5e20('0x32')],'type':_0x272da4[_0x5e20('0x33')][_0x5e20('0x34')]};});_0x395a27[_0x5e20('0x35')]=_[_0x5e20('0x2f')](_0x207a6b,_0x5e20('0x2c'));_0x395a27['query']=_[_0x5e20('0x36')](_0x335f1e[_0x5e20('0x37')]);_0x395a27[_0x5e20('0x38')]=_['intersection'](_0x395a27[_0x5e20('0x35')],_0x395a27[_0x5e20('0x37')]);_0x1548c8[_0x5e20('0x39')]=_[_0x5e20('0x3a')](_0x395a27[_0x5e20('0x35')],qs[_0x5e20('0x3b')](_0x335f1e[_0x5e20('0x37')][_0x5e20('0x3b')]));_0x1548c8[_0x5e20('0x39')]=_0x1548c8[_0x5e20('0x39')][_0x5e20('0x3c')]?_0x1548c8[_0x5e20('0x39')]:_0x395a27[_0x5e20('0x35')];if(!_0x335f1e[_0x5e20('0x37')]['hasOwnProperty'](_0x5e20('0x3d'))){_0x1548c8['limit']=qs['limit'](_0x335f1e[_0x5e20('0x37')][_0x5e20('0x22')]);_0x1548c8['offset']=qs[_0x5e20('0x21')](_0x335f1e[_0x5e20('0x37')]['offset']);}_0x1548c8[_0x5e20('0x3e')]=qs[_0x5e20('0x3f')](_0x335f1e[_0x5e20('0x37')][_0x5e20('0x3f')]);_0x1548c8[_0x5e20('0x40')]=qs[_0x5e20('0x38')](_[_0x5e20('0x41')](_0x335f1e[_0x5e20('0x37')],_0x395a27[_0x5e20('0x38')]));if(_0x335f1e[_0x5e20('0x37')][_0x5e20('0x42')]){_0x1548c8[_0x5e20('0x40')]=_[_0x5e20('0x43')](_0x1548c8[_0x5e20('0x40')],{'$or':_[_0x5e20('0x2f')](_0x207a6b,function(_0x3d618c){if(_0x3d618c[_0x5e20('0x33')]!==_0x5e20('0x44')){var _0x5abe62={};_0x5abe62[_0x3d618c[_0x5e20('0x2c')]]={'$like':'%'+_0x335f1e[_0x5e20('0x37')][_0x5e20('0x42')]+'%'};return _0x5abe62;}})});}_0x1548c8=_[_0x5e20('0x43')]({},_0x1548c8,_0x335f1e[_0x5e20('0x45')]);var _0x4ef462={'where':_0x1548c8[_0x5e20('0x40')]};return db[_0x5e20('0x30')][_0x5e20('0x20')](_0x4ef462)[_0x5e20('0x26')](function(_0x4d973a){_0x4ff715[_0x5e20('0x20')]=_0x4d973a;if(_0x335f1e['query'][_0x5e20('0x46')]){_0x1548c8[_0x5e20('0x47')]=[{'all':!![]}];}return db[_0x5e20('0x30')]['findAll'](_0x1548c8);})[_0x5e20('0x26')](function(_0x33bd92){_0x4ff715[_0x5e20('0x48')]=_0x33bd92;return _0x4ff715;})[_0x5e20('0x26')](respondWithFilteredResult(_0x4196a3,_0x1548c8))[_0x5e20('0x49')](handleError(_0x4196a3,null));};exports[_0x5e20('0x4a')]=function(_0x113133,_0x3edea7){var _0x5c9504={'raw':![],'where':{'id':_0x113133[_0x5e20('0x4b')]['id']}},_0x2f11ca={};_0x2f11ca[_0x5e20('0x35')]=_['keys'](db[_0x5e20('0x30')]['rawAttributes']);_0x2f11ca[_0x5e20('0x37')]=_[_0x5e20('0x36')](_0x113133[_0x5e20('0x37')]);_0x2f11ca[_0x5e20('0x38')]=_[_0x5e20('0x3a')](_0x2f11ca['model'],_0x2f11ca[_0x5e20('0x37')]);_0x5c9504['attributes']=_['intersection'](_0x2f11ca[_0x5e20('0x35')],qs[_0x5e20('0x3b')](_0x113133[_0x5e20('0x37')][_0x5e20('0x3b')]));_0x5c9504[_0x5e20('0x39')]=_0x5c9504[_0x5e20('0x39')][_0x5e20('0x3c')]?_0x5c9504['attributes']:_0x2f11ca['model'];if(_0x113133[_0x5e20('0x37')][_0x5e20('0x46')]){_0x5c9504['include']=[{'all':!![]}];}_0x5c9504=_[_0x5e20('0x43')]({},_0x5c9504,_0x113133[_0x5e20('0x45')]);return db[_0x5e20('0x30')][_0x5e20('0x4c')](_0x5c9504)[_0x5e20('0x26')](handleEntityNotFound(_0x3edea7,null))['then'](respondWithResult(_0x3edea7,null))[_0x5e20('0x49')](handleError(_0x3edea7,null));};exports[_0x5e20('0x4d')]=function(_0x25491e,_0x2a705f){return db[_0x5e20('0x30')][_0x5e20('0x4d')](_0x25491e[_0x5e20('0x4e')],{})[_0x5e20('0x26')](function(_0x4fb004){var _0x5bbc8e=_0x25491e['user'][_0x5e20('0x27')]({'plain':!![]});if(!_0x5bbc8e)throw new Error(_0x5e20('0x4f'));if(_0x5bbc8e['role']===_0x5e20('0x50')){var _0x4bfea7=_0x4fb004[_0x5e20('0x27')]({'plain':!![]});var _0x4afb72=_0x5e20('0x28');return db['UserProfileSection'][_0x5e20('0x4c')]({'where':{'name':_0x4afb72,'userProfileId':_0x5bbc8e[_0x5e20('0x51')]},'raw':!![]})[_0x5e20('0x26')](function(_0x190e07){if(_0x190e07&&_0x190e07[_0x5e20('0x52')]===0x0){return db[_0x5e20('0x29')][_0x5e20('0x4d')]({'name':_0x4bfea7[_0x5e20('0x2c')],'resourceId':_0x4bfea7['id'],'type':_0x190e07[_0x5e20('0x2c')],'sectionId':_0x190e07['id']},{})[_0x5e20('0x26')](function(){return _0x4fb004;});}else{return _0x4fb004;}})[_0x5e20('0x49')](function(_0x448d52){logger[_0x5e20('0x2b')](_0x5e20('0x53'),_0x448d52);throw _0x448d52;});}return _0x4fb004;})[_0x5e20('0x26')](respondWithResult(_0x2a705f,0xc9))[_0x5e20('0x49')](handleError(_0x2a705f,null));};exports[_0x5e20('0x25')]=function(_0x1ace56,_0x589fe9){if(_0x1ace56['body']['id']){delete _0x1ace56[_0x5e20('0x4e')]['id'];}return db['SquareProject'][_0x5e20('0x4c')]({'where':{'id':_0x1ace56[_0x5e20('0x4b')]['id']}})[_0x5e20('0x26')](handleEntityNotFound(_0x589fe9,null))['then'](saveUpdates(_0x1ace56[_0x5e20('0x4e')],null))[_0x5e20('0x26')](respondWithResult(_0x589fe9,null))[_0x5e20('0x49')](handleError(_0x589fe9,null));};exports['destroy']=function(_0x5d2aa2,_0x5599c4){return db[_0x5e20('0x30')][_0x5e20('0x4c')]({'where':{'id':_0x5d2aa2[_0x5e20('0x4b')]['id']}})[_0x5e20('0x26')](handleEntityNotFound(_0x5599c4,null))[_0x5e20('0x26')](removeEntity(_0x5599c4,null))[_0x5e20('0x49')](handleError(_0x5599c4,null));};exports['addUsers']=function(_0x393724,_0x50e4c7,_0x2913e7){return db['SquareProject'][_0x5e20('0x4c')]({'where':{'id':_0x393724[_0x5e20('0x4b')]['id']}})[_0x5e20('0x26')](handleEntityNotFound(_0x50e4c7,null))['then'](function(_0x1f6a32){if(_0x1f6a32){return _0x1f6a32[_0x5e20('0x54')](_0x393724[_0x5e20('0x4e')][_0x5e20('0x55')],_[_0x5e20('0x56')](_0x393724[_0x5e20('0x4e')],[_0x5e20('0x55'),'id'])||{});}})['then'](respondWithResult(_0x50e4c7,null))[_0x5e20('0x49')](handleError(_0x50e4c7,null));};exports[_0x5e20('0x57')]=function(_0x1a03e4,_0x2f9089,_0x4a98a8){return db[_0x5e20('0x30')][_0x5e20('0x4c')]({'where':{'id':_0x1a03e4[_0x5e20('0x4b')]['id']}})[_0x5e20('0x26')](handleEntityNotFound(_0x2f9089,null))['then'](function(_0x3e6be0){if(_0x3e6be0){return _0x3e6be0[_0x5e20('0x57')](_0x1a03e4[_0x5e20('0x37')]['ids'])['then'](function(){if(_['isArray'](_0x1a03e4[_0x5e20('0x37')][_0x5e20('0x55')])){for(var _0x5e4ddc=0x0;_0x5e4ddc<_0x1a03e4[_0x5e20('0x37')][_0x5e20('0x55')][_0x5e20('0x3c')];_0x5e4ddc+=0x1){socket['emit'](_0x5e20('0x58'),{'UserId':Number(_0x1a03e4[_0x5e20('0x37')]['ids'][_0x5e4ddc]),'SquareProjectId':Number(_0x1a03e4[_0x5e20('0x4b')]['id'])});}}else{socket[_0x5e20('0x59')]('userSquareProject:remove',{'UserId':Number(_0x1a03e4[_0x5e20('0x37')][_0x5e20('0x55')]),'SquareProjectId':Number(_0x1a03e4[_0x5e20('0x4b')]['id'])});}});}})[_0x5e20('0x26')](respondWithStatusCode(_0x2f9089,null))['catch'](handleError(_0x2f9089,null));};exports[_0x5e20('0x5a')]=function(_0x59bff7,_0x4c82d0,_0x1dc6dc){var _0x4025e1={};var _0x359bc0={};var _0x2d4e0b;var _0x54cd1;return db[_0x5e20('0x30')]['findOne']({'where':{'id':_0x59bff7['params']['id']}})[_0x5e20('0x26')](handleEntityNotFound(_0x4c82d0,null))[_0x5e20('0x26')](function(_0x17f248){if(_0x17f248){_0x2d4e0b=_0x17f248;_0x359bc0['model']=_[_0x5e20('0x36')](db[_0x5e20('0x5b')]['rawAttributes']);_0x359bc0[_0x5e20('0x37')]=_['keys'](_0x59bff7['query']);_0x359bc0[_0x5e20('0x38')]=_['intersection'](_0x359bc0[_0x5e20('0x35')],_0x359bc0[_0x5e20('0x37')]);_0x4025e1[_0x5e20('0x39')]=_['intersection'](_0x359bc0[_0x5e20('0x35')],qs[_0x5e20('0x3b')](_0x59bff7[_0x5e20('0x37')][_0x5e20('0x3b')]));_0x4025e1[_0x5e20('0x39')]=_0x4025e1['attributes'][_0x5e20('0x3c')]?_0x4025e1[_0x5e20('0x39')]:_0x359bc0['model'];_0x4025e1[_0x5e20('0x3e')]=qs[_0x5e20('0x3f')](_0x59bff7[_0x5e20('0x37')]['sort']);_0x4025e1[_0x5e20('0x40')]=qs[_0x5e20('0x38')](_[_0x5e20('0x41')](_0x59bff7[_0x5e20('0x37')],_0x359bc0[_0x5e20('0x38')]));if(_0x59bff7['query'][_0x5e20('0x42')]){_0x4025e1[_0x5e20('0x40')]=_[_0x5e20('0x43')](_0x4025e1[_0x5e20('0x40')],{'$or':_[_0x5e20('0x2f')](_0x4025e1['attributes'],function(_0x3037bb){var _0x1dbcfd={};_0x1dbcfd[_0x3037bb]={'$like':'%'+_0x59bff7[_0x5e20('0x37')][_0x5e20('0x42')]+'%'};return _0x1dbcfd;})});}_0x4025e1=_[_0x5e20('0x43')]({},_0x4025e1,_0x59bff7[_0x5e20('0x45')]);return _0x2d4e0b[_0x5e20('0x5a')](_0x4025e1);}})[_0x5e20('0x26')](function(_0x55306e){if(_0x55306e){_0x54cd1=_0x55306e[_0x5e20('0x3c')];if(!_0x59bff7['query']['hasOwnProperty'](_0x5e20('0x3d'))){_0x4025e1[_0x5e20('0x22')]=qs['limit'](_0x59bff7[_0x5e20('0x37')][_0x5e20('0x22')]);_0x4025e1['offset']=qs[_0x5e20('0x21')](_0x59bff7['query'][_0x5e20('0x21')]);}return _0x2d4e0b['getUsers'](_0x4025e1);}})[_0x5e20('0x26')](function(_0xf1b2e){if(_0xf1b2e){return _0xf1b2e?{'count':_0x54cd1,'rows':_0xf1b2e}:null;}})[_0x5e20('0x26')](respondWithResult(_0x4c82d0,null))[_0x5e20('0x49')](handleError(_0x4c82d0,null));}; \ No newline at end of file +var _0x91a7=['keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SquareProjects','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','getUsers','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','offset','limit','set','json','apply','reject','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','key','model','query'];(function(_0x539bde,_0x14b7db){var _0x1718d4=function(_0x1d35e0){while(--_0x1d35e0){_0x539bde['push'](_0x539bde['shift']());}};_0x1718d4(++_0x14b7db);}(_0x91a7,0xe7));var _0x791a=function(_0x37d8f8,_0x4ffa43){_0x37d8f8=_0x37d8f8-0x0;var _0x1f5139=_0x91a7[_0x37d8f8];return _0x1f5139;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x791a('0x0'));var rimraf=require(_0x791a('0x1'));var zipdir=require(_0x791a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x791a('0x3'));var moment=require('moment');var BPromise=require(_0x791a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x791a('0x5'));var sox=require(_0x791a('0x6'));var csv=require('to-csv');var ejs=require(_0x791a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0xb'));var querystring=require(_0x791a('0xc'));var Papa=require(_0x791a('0xd'));var Redis=require(_0x791a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xf'));var as=require(_0x791a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x11'))(_0x791a('0x12'));var utils=require(_0x791a('0x13'));var config=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];config[_0x791a('0x16')]=_['defaults'](config['redis'],{'host':_0x791a('0x17'),'port':0x18eb});var socket=require(_0x791a('0x18'))(new Redis(config['redis']));require(_0x791a('0x19'))[_0x791a('0x1a')](socket);function respondWithStatusCode(_0x5d5b11,_0x2887f0){_0x2887f0=_0x2887f0||0xcc;return function(_0x31b86d){if(_0x31b86d){return _0x5d5b11[_0x791a('0x1b')](_0x2887f0);}return _0x5d5b11[_0x791a('0x1c')](_0x2887f0)['end']();};}function respondWithResult(_0x2ce2e0,_0x575d11){_0x575d11=_0x575d11||0xc8;return function(_0x43dea6){if(_0x43dea6){return _0x2ce2e0[_0x791a('0x1c')](_0x575d11)['json'](_0x43dea6);}};}function respondWithFilteredResult(_0x237adb,_0x5bea2e){return function(_0x35fe48){if(_0x35fe48){var _0x52941d=_0x35fe48['count'],_0x4a84ee=_0x5bea2e['offset'],_0x588d00=_0x5bea2e[_0x791a('0x1d')]+_0x5bea2e[_0x791a('0x1e')],_0x40f0d3;if(_0x588d00>=_0x52941d){_0x588d00=_0x52941d;_0x40f0d3=0xc8;}else{_0x40f0d3=0xce;}_0x237adb[_0x791a('0x1c')](_0x40f0d3);return _0x237adb[_0x791a('0x1f')]('Content-Range',_0x4a84ee+'-'+_0x588d00+'/'+_0x52941d)[_0x791a('0x20')](_0x35fe48);}return null;};}function patchUpdates(_0xcb5e66){return function(_0x234514){try{jsonpatch[_0x791a('0x21')](_0x234514,_0xcb5e66,!![]);}catch(_0x530e32){return BPromise[_0x791a('0x22')](_0x530e32);}return _0x234514[_0x791a('0x23')]();};}function saveUpdates(_0x25bae5,_0x9e17b5){return function(_0x3200dd){if(_0x3200dd){return _0x3200dd[_0x791a('0x24')](_0x25bae5)[_0x791a('0x25')](function(_0x45a67d){return _0x45a67d;});}return null;};}function removeEntity(_0x323c6a,_0xe8e452){return function(_0x137992){if(_0x137992){return _0x137992['destroy']()[_0x791a('0x25')](function(){var _0x2728a0=_0x137992[_0x791a('0x26')]({'plain':!![]});var _0x2966b8='SquareProjects';return db[_0x791a('0x27')][_0x791a('0x28')]({'where':{'type':_0x2966b8,'resourceId':_0x2728a0['id']}})['then'](function(){return _0x137992;});})[_0x791a('0x25')](function(){_0x323c6a[_0x791a('0x1c')](0xcc)[_0x791a('0x29')]();});}};}function handleEntityNotFound(_0x4c1626,_0x29194d){return function(_0x2b3327){if(!_0x2b3327){_0x4c1626[_0x791a('0x1b')](0x194);}return _0x2b3327;};}function handleError(_0x395376,_0x4f423){_0x4f423=_0x4f423||0x1f4;return function(_0x1a9c6b){logger[_0x791a('0x2a')](_0x1a9c6b[_0x791a('0x2b')]);if(_0x1a9c6b['name']){delete _0x1a9c6b[_0x791a('0x2c')];}_0x395376[_0x791a('0x1c')](_0x4f423)[_0x791a('0x2d')](_0x1a9c6b);};}exports['index']=function(_0x1cdda9,_0x5df656){var _0xc59f5e={},_0x2e4ec8={},_0xcde862={'count':0x0,'rows':[]};var _0xe72e0c=_[_0x791a('0x2e')](db[_0x791a('0x2f')][_0x791a('0x30')],function(_0x4f5506){return{'name':_0x4f5506[_0x791a('0x31')],'type':_0x4f5506[_0x791a('0x32')][_0x791a('0x33')]};});_0x2e4ec8[_0x791a('0x34')]=_[_0x791a('0x2e')](_0xe72e0c,'name');_0x2e4ec8[_0x791a('0x35')]=_[_0x791a('0x36')](_0x1cdda9[_0x791a('0x35')]);_0x2e4ec8[_0x791a('0x37')]=_[_0x791a('0x38')](_0x2e4ec8['model'],_0x2e4ec8[_0x791a('0x35')]);_0xc59f5e[_0x791a('0x39')]=_[_0x791a('0x38')](_0x2e4ec8[_0x791a('0x34')],qs[_0x791a('0x3a')](_0x1cdda9['query'][_0x791a('0x3a')]));_0xc59f5e['attributes']=_0xc59f5e[_0x791a('0x39')]['length']?_0xc59f5e['attributes']:_0x2e4ec8[_0x791a('0x34')];if(!_0x1cdda9[_0x791a('0x35')][_0x791a('0x3b')](_0x791a('0x3c'))){_0xc59f5e[_0x791a('0x1e')]=qs[_0x791a('0x1e')](_0x1cdda9[_0x791a('0x35')]['limit']);_0xc59f5e[_0x791a('0x1d')]=qs['offset'](_0x1cdda9[_0x791a('0x35')]['offset']);}_0xc59f5e[_0x791a('0x3d')]=qs[_0x791a('0x3e')](_0x1cdda9['query'][_0x791a('0x3e')]);_0xc59f5e[_0x791a('0x3f')]=qs['filters'](_[_0x791a('0x40')](_0x1cdda9[_0x791a('0x35')],_0x2e4ec8[_0x791a('0x37')]));if(_0x1cdda9[_0x791a('0x35')][_0x791a('0x41')]){_0xc59f5e[_0x791a('0x3f')]=_[_0x791a('0x42')](_0xc59f5e[_0x791a('0x3f')],{'$or':_[_0x791a('0x2e')](_0xe72e0c,function(_0xeafbb5){if(_0xeafbb5['type']!==_0x791a('0x43')){var _0x7ebf84={};_0x7ebf84[_0xeafbb5[_0x791a('0x2c')]]={'$like':'%'+_0x1cdda9['query'][_0x791a('0x41')]+'%'};return _0x7ebf84;}})});}_0xc59f5e=_['merge']({},_0xc59f5e,_0x1cdda9['options']);var _0x5ab82f={'where':_0xc59f5e[_0x791a('0x3f')]};return db[_0x791a('0x2f')]['count'](_0x5ab82f)[_0x791a('0x25')](function(_0x2d1692){_0xcde862[_0x791a('0x44')]=_0x2d1692;if(_0x1cdda9[_0x791a('0x35')]['includeAll']){_0xc59f5e['include']=[{'all':!![]}];}return db['SquareProject'][_0x791a('0x45')](_0xc59f5e);})[_0x791a('0x25')](function(_0x4e0191){_0xcde862[_0x791a('0x46')]=_0x4e0191;return _0xcde862;})[_0x791a('0x25')](respondWithFilteredResult(_0x5df656,_0xc59f5e))[_0x791a('0x47')](handleError(_0x5df656,null));};exports[_0x791a('0x48')]=function(_0x508727,_0x11263d){var _0x5911db={'raw':![],'where':{'id':_0x508727[_0x791a('0x49')]['id']}},_0x3682db={};_0x3682db[_0x791a('0x34')]=_[_0x791a('0x36')](db[_0x791a('0x2f')]['rawAttributes']);_0x3682db[_0x791a('0x35')]=_[_0x791a('0x36')](_0x508727[_0x791a('0x35')]);_0x3682db[_0x791a('0x37')]=_[_0x791a('0x38')](_0x3682db['model'],_0x3682db[_0x791a('0x35')]);_0x5911db[_0x791a('0x39')]=_['intersection'](_0x3682db['model'],qs[_0x791a('0x3a')](_0x508727[_0x791a('0x35')][_0x791a('0x3a')]));_0x5911db['attributes']=_0x5911db['attributes'][_0x791a('0x4a')]?_0x5911db[_0x791a('0x39')]:_0x3682db['model'];if(_0x508727[_0x791a('0x35')][_0x791a('0x4b')]){_0x5911db[_0x791a('0x4c')]=[{'all':!![]}];}_0x5911db=_['merge']({},_0x5911db,_0x508727['options']);return db[_0x791a('0x2f')][_0x791a('0x4d')](_0x5911db)[_0x791a('0x25')](handleEntityNotFound(_0x11263d,null))[_0x791a('0x25')](respondWithResult(_0x11263d,null))['catch'](handleError(_0x11263d,null));};exports[_0x791a('0x4e')]=function(_0x9f768a,_0x4e6d0d){return db[_0x791a('0x2f')]['create'](_0x9f768a[_0x791a('0x4f')],{})[_0x791a('0x25')](function(_0xe0696b){var _0x227199=_0x9f768a[_0x791a('0x50')][_0x791a('0x26')]({'plain':!![]});if(!_0x227199)throw new Error(_0x791a('0x51'));if(_0x227199['role']===_0x791a('0x50')){var _0x1fd826=_0xe0696b['get']({'plain':!![]});var _0x2cf7e=_0x791a('0x52');return db['UserProfileSection'][_0x791a('0x4d')]({'where':{'name':_0x2cf7e,'userProfileId':_0x227199[_0x791a('0x53')]},'raw':!![]})[_0x791a('0x25')](function(_0x2e357c){if(_0x2e357c&&_0x2e357c[_0x791a('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x1fd826['name'],'resourceId':_0x1fd826['id'],'type':_0x2e357c[_0x791a('0x2c')],'sectionId':_0x2e357c['id']},{})['then'](function(){return _0xe0696b;});}else{return _0xe0696b;}})['catch'](function(_0x2f764a){logger['error'](_0x791a('0x55'),_0x2f764a);throw _0x2f764a;});}return _0xe0696b;})[_0x791a('0x25')](respondWithResult(_0x4e6d0d,0xc9))['catch'](handleError(_0x4e6d0d,null));};exports['update']=function(_0x3599f6,_0x597df2){if(_0x3599f6[_0x791a('0x4f')]['id']){delete _0x3599f6[_0x791a('0x4f')]['id'];}return db[_0x791a('0x2f')]['find']({'where':{'id':_0x3599f6[_0x791a('0x49')]['id']}})[_0x791a('0x25')](handleEntityNotFound(_0x597df2,null))['then'](saveUpdates(_0x3599f6[_0x791a('0x4f')],null))[_0x791a('0x25')](respondWithResult(_0x597df2,null))[_0x791a('0x47')](handleError(_0x597df2,null));};exports[_0x791a('0x28')]=function(_0x450ad8,_0x38080b){return db['SquareProject']['find']({'where':{'id':_0x450ad8[_0x791a('0x49')]['id']}})['then'](handleEntityNotFound(_0x38080b,null))[_0x791a('0x25')](removeEntity(_0x38080b,null))[_0x791a('0x47')](handleError(_0x38080b,null));};exports[_0x791a('0x56')]=function(_0xf11dea,_0x3b760c,_0x2bd2cc){return db[_0x791a('0x2f')]['find']({'where':{'id':_0xf11dea[_0x791a('0x49')]['id']}})[_0x791a('0x25')](handleEntityNotFound(_0x3b760c,null))[_0x791a('0x25')](function(_0x1a4376){if(_0x1a4376){return _0x1a4376[_0x791a('0x56')](_0xf11dea[_0x791a('0x4f')][_0x791a('0x57')],_['omit'](_0xf11dea[_0x791a('0x4f')],['ids','id'])||{});}})['then'](respondWithResult(_0x3b760c,null))[_0x791a('0x47')](handleError(_0x3b760c,null));};exports[_0x791a('0x58')]=function(_0x216b69,_0x2e3432,_0x31255c){return db[_0x791a('0x2f')][_0x791a('0x4d')]({'where':{'id':_0x216b69[_0x791a('0x49')]['id']}})[_0x791a('0x25')](handleEntityNotFound(_0x2e3432,null))[_0x791a('0x25')](function(_0x35acf7){if(_0x35acf7){return _0x35acf7[_0x791a('0x58')](_0x216b69[_0x791a('0x35')][_0x791a('0x57')])[_0x791a('0x25')](function(){if(_[_0x791a('0x59')](_0x216b69[_0x791a('0x35')][_0x791a('0x57')])){for(var _0x2abfe3=0x0;_0x2abfe3<_0x216b69[_0x791a('0x35')]['ids'][_0x791a('0x4a')];_0x2abfe3+=0x1){socket[_0x791a('0x5a')](_0x791a('0x5b'),{'UserId':Number(_0x216b69[_0x791a('0x35')][_0x791a('0x57')][_0x2abfe3]),'SquareProjectId':Number(_0x216b69['params']['id'])});}}else{socket[_0x791a('0x5a')](_0x791a('0x5b'),{'UserId':Number(_0x216b69[_0x791a('0x35')][_0x791a('0x57')]),'SquareProjectId':Number(_0x216b69['params']['id'])});}});}})[_0x791a('0x25')](respondWithStatusCode(_0x2e3432,null))['catch'](handleError(_0x2e3432,null));};exports['getUsers']=function(_0x482fa6,_0x5278e8,_0x22aaf2){var _0x40207b={};var _0x11c11f={};var _0x181ac7;var _0x1bf9a3;return db[_0x791a('0x2f')][_0x791a('0x5c')]({'where':{'id':_0x482fa6['params']['id']}})['then'](handleEntityNotFound(_0x5278e8,null))[_0x791a('0x25')](function(_0x185620){if(_0x185620){_0x181ac7=_0x185620;_0x11c11f['model']=_['keys'](db[_0x791a('0x5d')][_0x791a('0x30')]);_0x11c11f['query']=_[_0x791a('0x36')](_0x482fa6[_0x791a('0x35')]);_0x11c11f[_0x791a('0x37')]=_[_0x791a('0x38')](_0x11c11f['model'],_0x11c11f['query']);_0x40207b[_0x791a('0x39')]=_[_0x791a('0x38')](_0x11c11f['model'],qs[_0x791a('0x3a')](_0x482fa6[_0x791a('0x35')][_0x791a('0x3a')]));_0x40207b[_0x791a('0x39')]=_0x40207b['attributes'][_0x791a('0x4a')]?_0x40207b[_0x791a('0x39')]:_0x11c11f[_0x791a('0x34')];_0x40207b[_0x791a('0x3d')]=qs[_0x791a('0x3e')](_0x482fa6[_0x791a('0x35')][_0x791a('0x3e')]);_0x40207b[_0x791a('0x3f')]=qs['filters'](_['pick'](_0x482fa6['query'],_0x11c11f[_0x791a('0x37')]));if(_0x482fa6[_0x791a('0x35')][_0x791a('0x41')]){_0x40207b[_0x791a('0x3f')]=_[_0x791a('0x42')](_0x40207b[_0x791a('0x3f')],{'$or':_[_0x791a('0x2e')](_0x40207b[_0x791a('0x39')],function(_0x360083){var _0x13523a={};_0x13523a[_0x360083]={'$like':'%'+_0x482fa6['query'][_0x791a('0x41')]+'%'};return _0x13523a;})});}_0x40207b=_[_0x791a('0x42')]({},_0x40207b,_0x482fa6['options']);return _0x181ac7[_0x791a('0x5e')](_0x40207b);}})[_0x791a('0x25')](function(_0x591328){if(_0x591328){_0x1bf9a3=_0x591328['length'];if(!_0x482fa6[_0x791a('0x35')][_0x791a('0x3b')]('nolimit')){_0x40207b['limit']=qs[_0x791a('0x1e')](_0x482fa6[_0x791a('0x35')][_0x791a('0x1e')]);_0x40207b['offset']=qs[_0x791a('0x1d')](_0x482fa6['query'][_0x791a('0x1d')]);}return _0x181ac7[_0x791a('0x5e')](_0x40207b);}})[_0x791a('0x25')](function(_0x4072d0){if(_0x4072d0){return _0x4072d0?{'count':_0x1bf9a3,'rows':_0x4072d0}:null;}})[_0x791a('0x25')](respondWithResult(_0x5278e8,null))[_0x791a('0x47')](handleError(_0x5278e8,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 60f154e..8c73c69 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 _0x7531=['exports','events','../../mysqldb','SquareProject','remove','emit','hasOwnProperty','hook'];(function(_0x19d279,_0x2a4647){var _0x5ec893=function(_0x44296b){while(--_0x44296b){_0x19d279['push'](_0x19d279['shift']());}};_0x5ec893(++_0x2a4647);}(_0x7531,0x69));var _0x1753=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7531[_0x2dafbe];return _0x58a45a;};'use strict';var EventEmitter=require(_0x1753('0x0'));var SquareProject=require(_0x1753('0x1'))['db'][_0x1753('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1753('0x3')};function emitEvent(_0x1ecba8){return function(_0x5595df,_0x22192f,_0x24b503){SquareProjectEvents['emit'](_0x1ecba8+':'+_0x5595df['id'],_0x5595df);SquareProjectEvents[_0x1753('0x4')](_0x1ecba8,_0x5595df);_0x24b503(null);};}for(var e in events){if(events[_0x1753('0x5')](e)){var event=events[e];SquareProject[_0x1753('0x6')](e,emitEvent(event));}}module[_0x1753('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x8cb5=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject'];(function(_0x37bcd8,_0x27bed9){var _0x422480=function(_0x510db3){while(--_0x510db3){_0x37bcd8['push'](_0x37bcd8['shift']());}};_0x422480(++_0x27bed9);}(_0x8cb5,0x19f));var _0x58cb=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x8cb5[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0x58cb('0x0'));var SquareProject=require(_0x58cb('0x1'))['db'][_0x58cb('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x58cb('0x3')](0x0);var events={'afterCreate':_0x58cb('0x4'),'afterUpdate':_0x58cb('0x5'),'afterDestroy':_0x58cb('0x6')};function emitEvent(_0x66b14f){return function(_0x585b7a,_0x17b402,_0x28f599){SquareProjectEvents[_0x58cb('0x7')](_0x66b14f+':'+_0x585b7a['id'],_0x585b7a);SquareProjectEvents[_0x58cb('0x7')](_0x66b14f,_0x585b7a);_0x28f599(null);};}for(var e in events){if(events[_0x58cb('0x8')](e)){var event=events[e];SquareProject[_0x58cb('0x9')](e,emitEvent(event));}}module[_0x58cb('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 0d99ab4..29a0349 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 _0xce42=['exports','define','SquareProject','square_projects','lodash','moment','request-promise','rimraf','../../config/environment','./squareProject.attributes'];(function(_0x3d3559,_0x108700){var _0x29bbab=function(_0x25f212){while(--_0x25f212){_0x3d3559['push'](_0x3d3559['shift']());}};_0x29bbab(++_0x108700);}(_0xce42,0xa4));var _0x2ce4=function(_0x3d90b4,_0x1e2fc6){_0x3d90b4=_0x3d90b4-0x0;var _0x4c65d3=_0xce42[_0x3d90b4];return _0x4c65d3;};'use strict';var _=require(_0x2ce4('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2ce4('0x1'));var BPromise=require('bluebird');var rp=require(_0x2ce4('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ce4('0x3'));var config=require(_0x2ce4('0x4'));var attributes=require(_0x2ce4('0x5'));module[_0x2ce4('0x6')]=function(_0x563416,_0x3eb7d3){return _0x563416[_0x2ce4('0x7')](_0x2ce4('0x8'),attributes,{'tableName':_0x2ce4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89cb=['define','SquareProject','square_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x261040,_0x72f9ef){var _0x469f09=function(_0x429f96){while(--_0x429f96){_0x261040['push'](_0x261040['shift']());}};_0x469f09(++_0x72f9ef);}(_0x89cb,0x16b));var _0xb89c=function(_0x334444,_0x20403c){_0x334444=_0x334444-0x0;var _0x303741=_0x89cb[_0x334444];return _0x303741;};'use strict';var _=require(_0xb89c('0x0'));var util=require(_0xb89c('0x1'));var logger=require(_0xb89c('0x2'))(_0xb89c('0x3'));var moment=require(_0xb89c('0x4'));var BPromise=require(_0xb89c('0x5'));var rp=require(_0xb89c('0x6'));var fs=require('fs');var path=require(_0xb89c('0x7'));var rimraf=require(_0xb89c('0x8'));var config=require(_0xb89c('0x9'));var attributes=require(_0xb89c('0xa'));module[_0xb89c('0xb')]=function(_0x148237,_0x5662d4){return _0x148237[_0xb89c('0xc')](_0xb89c('0xd'),attributes,{'tableName':_0xb89c('0xe'),'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 afb56a0..7afec7b 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 _0xbf96=['moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','request','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','ShowSquareProject','options','raw','attributes','model','include','map','then','debug','stringify','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbf96,0x64));var _0x6bf9=function(_0x78f07a,_0x543a54){_0x78f07a=_0x78f07a-0x0;var _0x348bab=_0xbf96[_0x78f07a];return _0x348bab;};'use strict';var _=require(_0x6bf9('0x0'));var util=require(_0x6bf9('0x1'));var moment=require(_0x6bf9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6bf9('0x3'))['db'];var utils=require(_0x6bf9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x6bf9('0x5'));var jayson=require(_0x6bf9('0x6'));var client=jayson[_0x6bf9('0x7')][_0x6bf9('0x8')]({'port':0x232a});config['redis']=_[_0x6bf9('0x9')](config[_0x6bf9('0xa')],{'host':_0x6bf9('0xb'),'port':0x18eb});var socket=require(_0x6bf9('0xc'))(new Redis(config[_0x6bf9('0xa')]));require(_0x6bf9('0xd'))['register'](socket);function respondWithRpcPromise(_0x2178e6,_0x46637d,_0x10c317){return new BPromise(function(_0x596a39,_0x47b715){return client[_0x6bf9('0xe')](_0x2178e6,_0x10c317)['then'](function(_0x4e62db){logger['info'](_0x6bf9('0xf'),_0x46637d,_0x6bf9('0x10'));logger['debug'](_0x6bf9('0x11'),_0x46637d,_0x6bf9('0x10'),JSON['stringify'](_0x4e62db));if(_0x4e62db[_0x6bf9('0x12')]){if(_0x4e62db[_0x6bf9('0x12')][_0x6bf9('0x13')]===0x1f4){logger[_0x6bf9('0x12')]('SquareProject,\x20%s,\x20%s',_0x46637d,_0x4e62db['error'][_0x6bf9('0x14')]);return _0x47b715(_0x4e62db[_0x6bf9('0x12')][_0x6bf9('0x14')]);}logger['error'](_0x6bf9('0xf'),_0x46637d,_0x4e62db[_0x6bf9('0x12')][_0x6bf9('0x14')]);return _0x596a39(_0x4e62db[_0x6bf9('0x12')][_0x6bf9('0x14')]);}else{logger[_0x6bf9('0x15')]('SquareProject,\x20%s,\x20%s',_0x46637d,_0x6bf9('0x10'));_0x596a39(_0x4e62db[_0x6bf9('0x16')][_0x6bf9('0x14')]);}})[_0x6bf9('0x17')](function(_0x754841){logger[_0x6bf9('0x12')](_0x6bf9('0xf'),_0x46637d,_0x754841);_0x47b715(_0x754841);});});}exports[_0x6bf9('0x18')]=function(_0x1e0f3a){var _0x1a9906=this;return new Promise(function(_0x271053,_0x3c17e1){return db['SquareProject']['find']({'raw':_0x1e0f3a[_0x6bf9('0x19')]?_0x1e0f3a[_0x6bf9('0x19')][_0x6bf9('0x1a')]===undefined?!![]:![]:!![],'where':_0x1e0f3a[_0x6bf9('0x19')]?_0x1e0f3a[_0x6bf9('0x19')]['where']||null:null,'attributes':_0x1e0f3a['options']?_0x1e0f3a[_0x6bf9('0x19')][_0x6bf9('0x1b')]||null:null,'include':_0x1e0f3a['options']?_0x1e0f3a['options']['include']?_['map'](_0x1e0f3a[_0x6bf9('0x19')]['include'],function(_0x54d8a7){return{'model':db[_0x54d8a7[_0x6bf9('0x1c')]],'as':_0x54d8a7['as'],'attributes':_0x54d8a7[_0x6bf9('0x1b')],'include':_0x54d8a7[_0x6bf9('0x1d')]?_[_0x6bf9('0x1e')](_0x54d8a7[_0x6bf9('0x1d')],function(_0x394047){return{'model':db[_0x394047[_0x6bf9('0x1c')]],'as':_0x394047['as'],'attributes':_0x394047[_0x6bf9('0x1b')],'include':_0x394047['include']?_[_0x6bf9('0x1e')](_0x394047[_0x6bf9('0x1d')],function(_0x21c763){return{'model':db[_0x21c763[_0x6bf9('0x1c')]],'as':_0x21c763['as'],'attributes':_0x21c763[_0x6bf9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6bf9('0x1f')](function(_0x215d63){logger['info']('ShowSquareProject',_0x1e0f3a);logger[_0x6bf9('0x20')](_0x6bf9('0x18'),_0x1e0f3a,JSON[_0x6bf9('0x21')](_0x215d63));_0x271053(_0x215d63);})[_0x6bf9('0x17')](function(_0x48c3fd){logger[_0x6bf9('0x12')](_0x6bf9('0x18'),_0x48c3fd[_0x6bf9('0x14')],_0x1e0f3a);_0x3c17e1(_0x1a9906[_0x6bf9('0x12')](0x1f4,_0x48c3fd[_0x6bf9('0x14')]));});});}; \ No newline at end of file +var _0x6a29=['../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','options','where','attributes','include','map','model','util','ioredis','../../mysqldb','../../config/utils'];(function(_0x4fd3dd,_0x2cb2ba){var _0x23447c=function(_0x10b29c){while(--_0x10b29c){_0x4fd3dd['push'](_0x4fd3dd['shift']());}};_0x23447c(++_0x2cb2ba);}(_0x6a29,0x1bc));var _0x96a2=function(_0xe64ac0,_0x5e09ee){_0xe64ac0=_0xe64ac0-0x0;var _0x3afbdd=_0x6a29[_0xe64ac0];return _0x3afbdd;};'use strict';var _=require('lodash');var util=require(_0x96a2('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96a2('0x1'));var db=require(_0x96a2('0x2'))['db'];var utils=require(_0x96a2('0x3'));var logger=require(_0x96a2('0x4'))('rpc');var config=require(_0x96a2('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x96a2('0x6')][_0x96a2('0x7')]({'port':0x232a});config[_0x96a2('0x8')]=_[_0x96a2('0x9')](config[_0x96a2('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x96a2('0xa'))(new Redis(config[_0x96a2('0x8')]));require('./squareProject.socket')[_0x96a2('0xb')](socket);function respondWithRpcPromise(_0x110e40,_0x21c7cd,_0xfe8cf5){return new BPromise(function(_0x4b4f6e,_0x470664){return client[_0x96a2('0xc')](_0x110e40,_0xfe8cf5)[_0x96a2('0xd')](function(_0x15a20b){logger[_0x96a2('0xe')](_0x96a2('0xf'),_0x21c7cd,_0x96a2('0x10'));logger[_0x96a2('0x11')](_0x96a2('0x12'),_0x21c7cd,_0x96a2('0x10'),JSON[_0x96a2('0x13')](_0x15a20b));if(_0x15a20b[_0x96a2('0x14')]){if(_0x15a20b[_0x96a2('0x14')][_0x96a2('0x15')]===0x1f4){logger[_0x96a2('0x14')](_0x96a2('0xf'),_0x21c7cd,_0x15a20b[_0x96a2('0x14')]['message']);return _0x470664(_0x15a20b['error']['message']);}logger['error'](_0x96a2('0xf'),_0x21c7cd,_0x15a20b['error'][_0x96a2('0x16')]);return _0x4b4f6e(_0x15a20b[_0x96a2('0x14')][_0x96a2('0x16')]);}else{logger[_0x96a2('0xe')](_0x96a2('0xf'),_0x21c7cd,_0x96a2('0x10'));_0x4b4f6e(_0x15a20b[_0x96a2('0x17')][_0x96a2('0x16')]);}})[_0x96a2('0x18')](function(_0x4af869){logger[_0x96a2('0x14')](_0x96a2('0xf'),_0x21c7cd,_0x4af869);_0x470664(_0x4af869);});});}exports[_0x96a2('0x19')]=function(_0x251e29){var _0x587eb6=this;return new Promise(function(_0x593955,_0x282987){return db['SquareProject']['find']({'raw':_0x251e29[_0x96a2('0x1a')]?_0x251e29[_0x96a2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x251e29[_0x96a2('0x1a')]?_0x251e29[_0x96a2('0x1a')][_0x96a2('0x1b')]||null:null,'attributes':_0x251e29['options']?_0x251e29[_0x96a2('0x1a')][_0x96a2('0x1c')]||null:null,'include':_0x251e29[_0x96a2('0x1a')]?_0x251e29[_0x96a2('0x1a')][_0x96a2('0x1d')]?_[_0x96a2('0x1e')](_0x251e29[_0x96a2('0x1a')][_0x96a2('0x1d')],function(_0x2aa6aa){return{'model':db[_0x2aa6aa['model']],'as':_0x2aa6aa['as'],'attributes':_0x2aa6aa[_0x96a2('0x1c')],'include':_0x2aa6aa[_0x96a2('0x1d')]?_[_0x96a2('0x1e')](_0x2aa6aa[_0x96a2('0x1d')],function(_0x3dc22b){return{'model':db[_0x3dc22b['model']],'as':_0x3dc22b['as'],'attributes':_0x3dc22b['attributes'],'include':_0x3dc22b[_0x96a2('0x1d')]?_[_0x96a2('0x1e')](_0x3dc22b[_0x96a2('0x1d')],function(_0x50719f){return{'model':db[_0x50719f[_0x96a2('0x1f')]],'as':_0x50719f['as'],'attributes':_0x50719f[_0x96a2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x96a2('0xd')](function(_0x3f523f){logger[_0x96a2('0xe')]('ShowSquareProject',_0x251e29);logger[_0x96a2('0x11')]('ShowSquareProject',_0x251e29,JSON['stringify'](_0x3f523f));_0x593955(_0x3f523f);})[_0x96a2('0x18')](function(_0x498ac6){logger[_0x96a2('0x14')](_0x96a2('0x19'),_0x498ac6[_0x96a2('0x16')],_0x251e29);_0x282987(_0x587eb6[_0x96a2('0x14')](0x1f4,_0x498ac6[_0x96a2('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index da23bd8..fd35482 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 _0x2675=['register','length','squareProject:','./squareProject.events','emit','removeListener'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x2675,0x75));var _0x5267=function(_0x2b58fc,_0x298d6d){_0x2b58fc=_0x2b58fc-0x0;var _0x1b71dc=_0x2675[_0x2b58fc];return _0x1b71dc;};'use strict';var SquareProjectEvents=require(_0x5267('0x0'));var events=['save','remove','update'];function createListener(_0x1da342,_0x2ae442){return function(_0x57c95a){_0x2ae442[_0x5267('0x1')](_0x1da342,_0x57c95a);};}function removeListener(_0x36bdf0,_0x4e2548){return function(){SquareProjectEvents[_0x5267('0x2')](_0x36bdf0,_0x4e2548);};}exports[_0x5267('0x3')]=function(_0x4bd042){for(var _0x10f92c=0x0,_0x20f065=events[_0x5267('0x4')];_0x10f92c<_0x20f065;_0x10f92c++){var _0x527c16=events[_0x10f92c];var _0x9e0a27=createListener(_0x5267('0x5')+_0x527c16,_0x4bd042);SquareProjectEvents['on'](_0x527c16,_0x9e0a27);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','squareProject:','./squareProject.events','update'];(function(_0x52f408,_0x271d1c){var _0x52d63a=function(_0x26aefe){while(--_0x26aefe){_0x52f408['push'](_0x52f408['shift']());}};_0x52d63a(++_0x271d1c);}(_0x0295,0x1f0));var _0x5029=function(_0x1e0d60,_0x503460){_0x1e0d60=_0x1e0d60-0x0;var _0x5b9564=_0x0295[_0x1e0d60];return _0x5b9564;};'use strict';var SquareProjectEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){SquareProjectEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);SquareProjectEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 8c70f89..4dc2e67 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 _0x096e=['isAuthenticated','index','/:id','show','/:id/download','download','post','create','update','/:id/delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x096e,0x187));var _0xe096=function(_0x952673,_0x334348){_0x952673=_0x952673-0x0;var _0x4650bb=_0x096e[_0x952673];return _0x4650bb;};'use strict';var multer=require('multer');var util=require(_0xe096('0x0'));var path=require(_0xe096('0x1'));var timeout=require(_0xe096('0x2'));var express=require('express');var router=express[_0xe096('0x3')]();var auth=require(_0xe096('0x4'));var interaction=require(_0xe096('0x5'));var config=require(_0xe096('0x6'));var controller=require(_0xe096('0x7'));router[_0xe096('0x8')]('/',auth[_0xe096('0x9')](),controller[_0xe096('0xa')]);router[_0xe096('0x8')](_0xe096('0xb'),auth[_0xe096('0x9')](),controller[_0xe096('0xc')]);router[_0xe096('0x8')](_0xe096('0xd'),auth[_0xe096('0x9')](),controller[_0xe096('0xe')]);router[_0xe096('0xf')]('/',auth['isAuthenticated'](),controller[_0xe096('0x10')]);router['put'](_0xe096('0xb'),auth[_0xe096('0x9')](),controller[_0xe096('0x11')]);router['delete'](_0xe096('0x12'),auth[_0xe096('0x9')](),controller['destroy']);module[_0xe096('0x13')]=router; \ No newline at end of file +var _0xe4d4=['isAuthenticated','index','show','/:id/download','download','post','put','/:id','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get'];(function(_0x471e16,_0x24cce8){var _0x38df5f=function(_0xd91da1){while(--_0xd91da1){_0x471e16['push'](_0x471e16['shift']());}};_0x38df5f(++_0x24cce8);}(_0xe4d4,0x106));var _0x4e4d=function(_0x2057a8,_0x30d448){_0x2057a8=_0x2057a8-0x0;var _0x5dd74d=_0xe4d4[_0x2057a8];return _0x5dd74d;};'use strict';var multer=require('multer');var util=require(_0x4e4d('0x0'));var path=require(_0x4e4d('0x1'));var timeout=require(_0x4e4d('0x2'));var express=require('express');var router=express[_0x4e4d('0x3')]();var auth=require(_0x4e4d('0x4'));var interaction=require(_0x4e4d('0x5'));var config=require('../../config/environment');var controller=require(_0x4e4d('0x6'));router[_0x4e4d('0x7')]('/',auth[_0x4e4d('0x8')](),controller[_0x4e4d('0x9')]);router['get']('/:id',auth[_0x4e4d('0x8')](),controller[_0x4e4d('0xa')]);router[_0x4e4d('0x7')](_0x4e4d('0xb'),auth[_0x4e4d('0x8')](),controller[_0x4e4d('0xc')]);router[_0x4e4d('0xd')]('/',auth[_0x4e4d('0x8')](),controller['create']);router[_0x4e4d('0xe')](_0x4e4d('0xf'),auth[_0x4e4d('0x8')](),controller['update']);router[_0x4e4d('0x10')]('/:id/delete',auth[_0x4e4d('0x8')](),controller[_0x4e4d('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index c39129c..52c7d63 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 _0xd117=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd117,0x182));var _0x7d11=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0xd117[_0x295a3d];return _0x23a732;};'use strict';var Sequelize=require(_0x7d11('0x0'));module[_0x7d11('0x1')]={'uniqueid':{'type':Sequelize[_0x7d11('0x2')]},'callerid':{'type':Sequelize[_0x7d11('0x2')]},'calleridname':{'type':Sequelize[_0x7d11('0x2')]},'context':{'type':Sequelize[_0x7d11('0x2')]},'extension':{'type':Sequelize[_0x7d11('0x2')]},'priority':{'type':Sequelize[_0x7d11('0x2')]},'accountcode':{'type':Sequelize[_0x7d11('0x2')]},'dnid':{'type':Sequelize[_0x7d11('0x2')]},'projectName':{'type':Sequelize[_0x7d11('0x2')]},'saveName':{'type':Sequelize[_0x7d11('0x2')]},'filename':{'type':Sequelize[_0x7d11('0x2')]},'savePath':{'type':Sequelize[_0x7d11('0x2')]},'format':{'type':Sequelize[_0x7d11('0x3')],'get':function(){var _0x3c8d66='';var _0x47b5e6=this[_0x7d11('0x4')](_0x7d11('0x5'));if(_0x47b5e6){_0x3c8d66=_0x47b5e6[_0x7d11('0x6')](_0x47b5e6['lastIndexOf']('.'));}return _0x3c8d66;}}}; \ No newline at end of file +var _0x0605=['getDataValue','substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0605,0x1d1));var _0x5060=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x0605[_0x47a7d0];return _0xb9bd08;};'use strict';var Sequelize=require(_0x5060('0x0'));module[_0x5060('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x5060('0x2')]},'calleridname':{'type':Sequelize[_0x5060('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x5060('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5060('0x2')]},'dnid':{'type':Sequelize[_0x5060('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x5060('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x5060('0x3')],'get':function(){var _0x1e4472='';var _0x25b718=this[_0x5060('0x4')]('savePath');if(_0x25b718){_0x1e4472=_0x25b718[_0x5060('0x5')](_0x25b718[_0x5060('0x6')]('.'));}return _0x1e4472;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index e53f483..fd4733a 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 _0x8101=['fields','length','nolimit','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','send','Not\x20found','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','zip-dir','fast-json-patch','request-promise','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/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','index','SquareRecording','fieldName','type','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x12803e,_0x1ea690){var _0x30c5ab=function(_0x1e8ee9){while(--_0x1e8ee9){_0x12803e['push'](_0x12803e['shift']());}};_0x30c5ab(++_0x1ea690);}(_0x8101,0x8b));var _0x1810=function(_0x131585,_0x1abd33){_0x131585=_0x131585-0x0;var _0x1fcca2=_0x8101[_0x131585];return _0x1fcca2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1810('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1810('0x1'));var jsonpatch=require(_0x1810('0x2'));var rp=require(_0x1810('0x3'));var moment=require(_0x1810('0x4'));var BPromise=require(_0x1810('0x5'));var Mustache=require(_0x1810('0x6'));var util=require(_0x1810('0x7'));var path=require(_0x1810('0x8'));var sox=require(_0x1810('0x9'));var csv=require('to-csv');var ejs=require(_0x1810('0xa'));var fs=require('fs');var _=require(_0x1810('0xb'));var squel=require(_0x1810('0xc'));var crypto=require(_0x1810('0xd'));var jsforce=require(_0x1810('0xe'));var deskjs=require(_0x1810('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1810('0x10'));var Papa=require('papaparse');var Redis=require(_0x1810('0x11'));var authService=require(_0x1810('0x12'));var qs=require(_0x1810('0x13'));var as=require(_0x1810('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1810('0x15'))(_0x1810('0x16'));var utils=require(_0x1810('0x17'));var config=require(_0x1810('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a4b23,_0x20d9ea){_0x20d9ea=_0x20d9ea||0xcc;return function(_0x2d42a7){if(_0x2d42a7){return _0x2a4b23[_0x1810('0x19')](_0x20d9ea);}return _0x2a4b23[_0x1810('0x1a')](_0x20d9ea)[_0x1810('0x1b')]();};}function respondWithResult(_0x2d5d7b,_0xff04e7){_0xff04e7=_0xff04e7||0xc8;return function(_0x49e72c){if(_0x49e72c){return _0x2d5d7b[_0x1810('0x1a')](_0xff04e7)[_0x1810('0x1c')](_0x49e72c);}};}function respondWithFilteredResult(_0x289254,_0x5ab568){return function(_0x433e1b){if(_0x433e1b){var _0x50739f=_0x433e1b[_0x1810('0x1d')],_0x1061d5=_0x5ab568['offset'],_0x32b317=_0x5ab568[_0x1810('0x1e')]+_0x5ab568[_0x1810('0x1f')],_0x28ff35;if(_0x32b317>=_0x50739f){_0x32b317=_0x50739f;_0x28ff35=0xc8;}else{_0x28ff35=0xce;}_0x289254[_0x1810('0x1a')](_0x28ff35);return _0x289254[_0x1810('0x20')](_0x1810('0x21'),_0x1061d5+'-'+_0x32b317+'/'+_0x50739f)[_0x1810('0x1c')](_0x433e1b);}return null;};}function patchUpdates(_0x93b901){return function(_0x1e95ec){try{jsonpatch[_0x1810('0x22')](_0x1e95ec,_0x93b901,!![]);}catch(_0x4c8146){return BPromise['reject'](_0x4c8146);}return _0x1e95ec[_0x1810('0x23')]();};}function saveUpdates(_0x145761,_0x30ecbc){return function(_0x4bea98){if(_0x4bea98){return _0x4bea98[_0x1810('0x24')](_0x145761)[_0x1810('0x25')](function(_0x6b7a70){return _0x6b7a70;});}return null;};}function removeEntity(_0x25c307,_0x17ec5b){return function(_0x274c48){if(_0x274c48){return _0x274c48[_0x1810('0x26')]()['then'](function(){_0x25c307[_0x1810('0x1a')](0xcc)[_0x1810('0x1b')]();});}};}function handleEntityNotFound(_0x427c6f,_0x412fbc){return function(_0x3ae6a5){if(!_0x3ae6a5){_0x427c6f[_0x1810('0x19')](0x194);}return _0x3ae6a5;};}function handleError(_0x541cd4,_0x4e1805){_0x4e1805=_0x4e1805||0x1f4;return function(_0x484a17){logger[_0x1810('0x27')](_0x484a17['stack']);if(_0x484a17[_0x1810('0x28')]){delete _0x484a17[_0x1810('0x28')];}_0x541cd4['status'](_0x4e1805)['send'](_0x484a17);};}exports[_0x1810('0x29')]=function(_0x377366,_0x5509ba){var _0x56b5d7={},_0x4324cf={},_0x145d95={'count':0x0,'rows':[]};var _0x4be8d2=_['map'](db[_0x1810('0x2a')]['rawAttributes'],function(_0x15b831){return{'name':_0x15b831[_0x1810('0x2b')],'type':_0x15b831[_0x1810('0x2c')][_0x1810('0x2d')]};});_0x4324cf[_0x1810('0x2e')]=_[_0x1810('0x2f')](_0x4be8d2,_0x1810('0x28'));_0x4324cf[_0x1810('0x30')]=_[_0x1810('0x31')](_0x377366['query']);_0x4324cf[_0x1810('0x32')]=_[_0x1810('0x33')](_0x4324cf[_0x1810('0x2e')],_0x4324cf[_0x1810('0x30')]);_0x56b5d7[_0x1810('0x34')]=_['intersection'](_0x4324cf[_0x1810('0x2e')],qs[_0x1810('0x35')](_0x377366[_0x1810('0x30')]['fields']));_0x56b5d7[_0x1810('0x34')]=_0x56b5d7[_0x1810('0x34')][_0x1810('0x36')]?_0x56b5d7[_0x1810('0x34')]:_0x4324cf[_0x1810('0x2e')];if(!_0x377366[_0x1810('0x30')]['hasOwnProperty'](_0x1810('0x37'))){_0x56b5d7['limit']=qs[_0x1810('0x1f')](_0x377366[_0x1810('0x30')][_0x1810('0x1f')]);_0x56b5d7[_0x1810('0x1e')]=qs['offset'](_0x377366['query'][_0x1810('0x1e')]);}_0x56b5d7[_0x1810('0x38')]=qs['sort'](_0x377366[_0x1810('0x30')][_0x1810('0x39')]);_0x56b5d7[_0x1810('0x3a')]=qs[_0x1810('0x32')](_[_0x1810('0x3b')](_0x377366[_0x1810('0x30')],_0x4324cf[_0x1810('0x32')]));if(_0x377366['query']['filter']){_0x56b5d7[_0x1810('0x3a')]=_[_0x1810('0x3c')](_0x56b5d7['where'],{'$or':_[_0x1810('0x2f')](_0x4be8d2,function(_0x3d9f8c){if(_0x3d9f8c[_0x1810('0x2c')]!=='VIRTUAL'){var _0x260274={};_0x260274[_0x3d9f8c[_0x1810('0x28')]]={'$like':'%'+_0x377366[_0x1810('0x30')]['filter']+'%'};return _0x260274;}})});}_0x56b5d7=_[_0x1810('0x3c')]({},_0x56b5d7,_0x377366['options']);var _0x5859fd={'where':_0x56b5d7[_0x1810('0x3a')]};return db['SquareRecording'][_0x1810('0x1d')](_0x5859fd)[_0x1810('0x25')](function(_0x3787a0){_0x145d95['count']=_0x3787a0;if(_0x377366['query'][_0x1810('0x3d')]){_0x56b5d7[_0x1810('0x3e')]=[{'all':!![]}];}return db[_0x1810('0x2a')][_0x1810('0x3f')](_0x56b5d7);})['then'](function(_0x4d122f){_0x145d95[_0x1810('0x40')]=_0x4d122f;return _0x145d95;})[_0x1810('0x25')](respondWithFilteredResult(_0x5509ba,_0x56b5d7))[_0x1810('0x41')](handleError(_0x5509ba,null));};exports[_0x1810('0x42')]=function(_0x3c3eae,_0xc8c8ce){var _0x3d3d9a={'raw':!![],'where':{'id':_0x3c3eae[_0x1810('0x43')]['id']}},_0x19f7d6={};_0x19f7d6[_0x1810('0x2e')]=_[_0x1810('0x31')](db[_0x1810('0x2a')][_0x1810('0x44')]);_0x19f7d6[_0x1810('0x30')]=_[_0x1810('0x31')](_0x3c3eae[_0x1810('0x30')]);_0x19f7d6['filters']=_[_0x1810('0x33')](_0x19f7d6[_0x1810('0x2e')],_0x19f7d6[_0x1810('0x30')]);_0x3d3d9a['attributes']=_[_0x1810('0x33')](_0x19f7d6[_0x1810('0x2e')],qs['fields'](_0x3c3eae[_0x1810('0x30')][_0x1810('0x35')]));_0x3d3d9a['attributes']=_0x3d3d9a['attributes']['length']?_0x3d3d9a[_0x1810('0x34')]:_0x19f7d6[_0x1810('0x2e')];if(_0x3c3eae[_0x1810('0x30')][_0x1810('0x3d')]){_0x3d3d9a[_0x1810('0x3e')]=[{'all':!![]}];}_0x3d3d9a=_['merge']({},_0x3d3d9a,_0x3c3eae[_0x1810('0x45')]);return db[_0x1810('0x2a')][_0x1810('0x46')](_0x3d3d9a)['then'](handleEntityNotFound(_0xc8c8ce,null))[_0x1810('0x25')](respondWithResult(_0xc8c8ce,null))[_0x1810('0x41')](handleError(_0xc8c8ce,null));};exports[_0x1810('0x47')]=function(_0x2fd9a5,_0x20b2fc){return db[_0x1810('0x2a')][_0x1810('0x47')](_0x2fd9a5[_0x1810('0x48')],{})[_0x1810('0x25')](respondWithResult(_0x20b2fc,0xc9))[_0x1810('0x41')](handleError(_0x20b2fc,null));};exports[_0x1810('0x24')]=function(_0x481eee,_0x232e62){if(_0x481eee[_0x1810('0x48')]['id']){delete _0x481eee['body']['id'];}return db[_0x1810('0x2a')][_0x1810('0x46')]({'where':{'id':_0x481eee[_0x1810('0x43')]['id']}})[_0x1810('0x25')](handleEntityNotFound(_0x232e62,null))['then'](saveUpdates(_0x481eee['body'],null))[_0x1810('0x25')](respondWithResult(_0x232e62,null))['catch'](handleError(_0x232e62,null));};exports[_0x1810('0x49')]=function(_0x43af82,_0xd76044,_0x247e95){var _0x1dbe92=require(_0x1810('0x4a'));var _0x47b43c=![];var _0x10f180={};if(_0x43af82[_0x1810('0x30')]['type']&&_0x43af82[_0x1810('0x30')][_0x1810('0x2c')]===_0x1810('0x4b')){_0x10f180[_0x1810('0x4b')]=_0x43af82['params']['id'];}else{_0x10f180['id']=_0x43af82[_0x1810('0x43')]['id'];}return db[_0x1810('0x2a')][_0x1810('0x46')]({'where':_0x10f180,'attributes':['id',_0x1810('0x4c'),_0x1810('0x4d')],'raw':!![]})[_0x1810('0x25')](handleEntityNotFound(_0xd76044,null))['then'](function(_0x3e53ca){if(_0x3e53ca){var _0x31f70b=_0x3e53ca[_0x1810('0x4c')];var _0x4dfd8b=util['format']('%s.cypher',_0x31f70b);if(fs[_0x1810('0x4e')](_0x4dfd8b)){_0x47b43c=!![];return _0x1dbe92[_0x1810('0x4f')](_0x4dfd8b,_0x31f70b,config[_0x1810('0x50')][_0x1810('0x51')])['then'](function(){return _0x3e53ca;});}return _0x3e53ca;}})['then'](function(_0x3cd78){if(_0x3cd78){var _0x53e412=_0x3cd78[_0x1810('0x4c')];if(!fs['existsSync'](_0x53e412)){throw new db[(_0x1810('0x52'))][(_0x1810('0x53'))](_0x1810('0x54'));}if(_0x3cd78['filename']){return _0xd76044['download'](_0x53e412,_0x3cd78[_0x1810('0x4d')]+path[_0x1810('0x55')](_0x53e412),function(){if(_0x47b43c){fs[_0x1810('0x56')](_0x53e412);}});}else{return _0xd76044[_0x1810('0x49')](_0x53e412,function(_0x10041a){if(_0x47b43c){fs['unlink'](_0x53e412);}});}}})['catch'](function(_0x2de242){if(_0x2de242[_0x1810('0x57')]===_0x1810('0x54')){_0xd76044[_0x1810('0x1a')](0x194)[_0x1810('0x58')](_0x1810('0x59'));}else{return handleError(_0xd76044,null);}});};exports[_0x1810('0x26')]=function(_0x6dfada,_0x3f8a45){return db[_0x1810('0x2a')]['find']({'where':{'id':_0x6dfada['params']['id']}})[_0x1810('0x25')](function(_0x2d0c10){if(!_0x2d0c10)throw new ReferenceError(_0x1810('0x5a'));return _0x2d0c10;})['then'](function(_0x1f9f06){var _0x2d9329=_0x1f9f06[_0x1810('0x4c')];logger[_0x1810('0x5b')]('cancellazione\x20fisica\x20documento\x20%s',_0x2d9329);if(!_[_0x1810('0x5c')](_0x1f9f06[_0x1810('0x4c')])&&fs[_0x1810('0x4e')](_0x2d9329)){logger[_0x1810('0x5b')]('File:\x20\x22'+_0x2d9329+_0x1810('0x5d'));fs[_0x1810('0x5e')](_0x2d9329);}_0x2d9329=_0x2d9329+_0x1810('0x5f');if(!_[_0x1810('0x5c')](_0x1f9f06[_0x1810('0x4c')])&&fs[_0x1810('0x4e')](_0x2d9329)){logger[_0x1810('0x5b')]('File:\x20\x22'+_0x2d9329+_0x1810('0x5d'));fs['unlinkSync'](_0x2d9329);}return _0x1f9f06;})[_0x1810('0x25')](function(_0x475b4f){if(!_0x475b4f)throw new InternalError();return _0x475b4f[_0x1810('0x26')]();})[_0x1810('0x25')](function(){_0x3f8a45[_0x1810('0x1a')](0xcc)[_0x1810('0x1b')]();})[_0x1810('0x41')](handleError(_0x3f8a45,null));}; \ No newline at end of file +var _0x4e55=['findAll','rows','catch','params','length','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','VIRTUAL','SquareRecording','includeAll'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0x4e55,0x14b));var _0x54e5=function(_0x1bf8f5,_0x28f62c){_0x1bf8f5=_0x1bf8f5-0x0;var _0x36a54e=_0x4e55[_0x1bf8f5];return _0x36a54e;};'use strict';var pdf=require(_0x54e5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x54e5('0x1'));var zipdir=require(_0x54e5('0x2'));var jsonpatch=require(_0x54e5('0x3'));var rp=require(_0x54e5('0x4'));var moment=require(_0x54e5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x54e5('0x6'));var util=require(_0x54e5('0x7'));var path=require('path');var sox=require(_0x54e5('0x8'));var csv=require(_0x54e5('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x54e5('0xa'));var squel=require(_0x54e5('0xb'));var crypto=require(_0x54e5('0xc'));var jsforce=require(_0x54e5('0xd'));var deskjs=require(_0x54e5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x54e5('0xf'));var Papa=require(_0x54e5('0x10'));var Redis=require(_0x54e5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x54e5('0x12'));var as=require(_0x54e5('0x13'));var hardwareService=require(_0x54e5('0x14'));var logger=require(_0x54e5('0x15'))(_0x54e5('0x16'));var utils=require(_0x54e5('0x17'));var config=require('../../config/environment');var db=require(_0x54e5('0x18'))['db'];function respondWithStatusCode(_0x306873,_0x114b99){_0x114b99=_0x114b99||0xcc;return function(_0x34d208){if(_0x34d208){return _0x306873[_0x54e5('0x19')](_0x114b99);}return _0x306873[_0x54e5('0x1a')](_0x114b99)['end']();};}function respondWithResult(_0x46e28e,_0x140a8f){_0x140a8f=_0x140a8f||0xc8;return function(_0x3e0b57){if(_0x3e0b57){return _0x46e28e[_0x54e5('0x1a')](_0x140a8f)[_0x54e5('0x1b')](_0x3e0b57);}};}function respondWithFilteredResult(_0xacc803,_0x2a840e){return function(_0x5ed583){if(_0x5ed583){var _0x576e96=_0x5ed583[_0x54e5('0x1c')],_0x1d77b2=_0x2a840e[_0x54e5('0x1d')],_0x152696=_0x2a840e[_0x54e5('0x1d')]+_0x2a840e[_0x54e5('0x1e')],_0xa2058b;if(_0x152696>=_0x576e96){_0x152696=_0x576e96;_0xa2058b=0xc8;}else{_0xa2058b=0xce;}_0xacc803[_0x54e5('0x1a')](_0xa2058b);return _0xacc803[_0x54e5('0x1f')]('Content-Range',_0x1d77b2+'-'+_0x152696+'/'+_0x576e96)[_0x54e5('0x1b')](_0x5ed583);}return null;};}function patchUpdates(_0x54072e){return function(_0x57ba80){try{jsonpatch[_0x54e5('0x20')](_0x57ba80,_0x54072e,!![]);}catch(_0x4819f8){return BPromise[_0x54e5('0x21')](_0x4819f8);}return _0x57ba80[_0x54e5('0x22')]();};}function saveUpdates(_0xbb0e10,_0x2902cc){return function(_0x4025fa){if(_0x4025fa){return _0x4025fa[_0x54e5('0x23')](_0xbb0e10)[_0x54e5('0x24')](function(_0x5bcfdd){return _0x5bcfdd;});}return null;};}function removeEntity(_0x2805b1,_0x5efef0){return function(_0x54a844){if(_0x54a844){return _0x54a844[_0x54e5('0x25')]()[_0x54e5('0x24')](function(){_0x2805b1[_0x54e5('0x1a')](0xcc)[_0x54e5('0x26')]();});}};}function handleEntityNotFound(_0x51aae8,_0x5bf5b1){return function(_0x8c814f){if(!_0x8c814f){_0x51aae8[_0x54e5('0x19')](0x194);}return _0x8c814f;};}function handleError(_0x278d6c,_0x55d068){_0x55d068=_0x55d068||0x1f4;return function(_0x713ca3){logger[_0x54e5('0x27')](_0x713ca3[_0x54e5('0x28')]);if(_0x713ca3[_0x54e5('0x29')]){delete _0x713ca3[_0x54e5('0x29')];}_0x278d6c[_0x54e5('0x1a')](_0x55d068)[_0x54e5('0x2a')](_0x713ca3);};}exports[_0x54e5('0x2b')]=function(_0x7977a2,_0x1bf166){var _0x2b4ab0={},_0x484870={},_0x3f5882={'count':0x0,'rows':[]};var _0x2fcfb3=_[_0x54e5('0x2c')](db['SquareRecording'][_0x54e5('0x2d')],function(_0x4b920c){return{'name':_0x4b920c[_0x54e5('0x2e')],'type':_0x4b920c['type'][_0x54e5('0x2f')]};});_0x484870[_0x54e5('0x30')]=_[_0x54e5('0x2c')](_0x2fcfb3,_0x54e5('0x29'));_0x484870[_0x54e5('0x31')]=_[_0x54e5('0x32')](_0x7977a2[_0x54e5('0x31')]);_0x484870[_0x54e5('0x33')]=_[_0x54e5('0x34')](_0x484870['model'],_0x484870['query']);_0x2b4ab0[_0x54e5('0x35')]=_['intersection'](_0x484870[_0x54e5('0x30')],qs['fields'](_0x7977a2[_0x54e5('0x31')][_0x54e5('0x36')]));_0x2b4ab0[_0x54e5('0x35')]=_0x2b4ab0[_0x54e5('0x35')]['length']?_0x2b4ab0[_0x54e5('0x35')]:_0x484870[_0x54e5('0x30')];if(!_0x7977a2[_0x54e5('0x31')]['hasOwnProperty'](_0x54e5('0x37'))){_0x2b4ab0['limit']=qs[_0x54e5('0x1e')](_0x7977a2[_0x54e5('0x31')][_0x54e5('0x1e')]);_0x2b4ab0[_0x54e5('0x1d')]=qs[_0x54e5('0x1d')](_0x7977a2[_0x54e5('0x31')][_0x54e5('0x1d')]);}_0x2b4ab0[_0x54e5('0x38')]=qs[_0x54e5('0x39')](_0x7977a2[_0x54e5('0x31')]['sort']);_0x2b4ab0[_0x54e5('0x3a')]=qs[_0x54e5('0x33')](_['pick'](_0x7977a2[_0x54e5('0x31')],_0x484870[_0x54e5('0x33')]));if(_0x7977a2['query'][_0x54e5('0x3b')]){_0x2b4ab0['where']=_[_0x54e5('0x3c')](_0x2b4ab0[_0x54e5('0x3a')],{'$or':_[_0x54e5('0x2c')](_0x2fcfb3,function(_0x5a6927){if(_0x5a6927[_0x54e5('0x3d')]!==_0x54e5('0x3e')){var _0x115c8b={};_0x115c8b[_0x5a6927[_0x54e5('0x29')]]={'$like':'%'+_0x7977a2[_0x54e5('0x31')]['filter']+'%'};return _0x115c8b;}})});}_0x2b4ab0=_[_0x54e5('0x3c')]({},_0x2b4ab0,_0x7977a2['options']);var _0x1a7ba9={'where':_0x2b4ab0[_0x54e5('0x3a')]};return db[_0x54e5('0x3f')][_0x54e5('0x1c')](_0x1a7ba9)[_0x54e5('0x24')](function(_0x4c9a18){_0x3f5882['count']=_0x4c9a18;if(_0x7977a2[_0x54e5('0x31')][_0x54e5('0x40')]){_0x2b4ab0['include']=[{'all':!![]}];}return db[_0x54e5('0x3f')][_0x54e5('0x41')](_0x2b4ab0);})[_0x54e5('0x24')](function(_0xbc4575){_0x3f5882[_0x54e5('0x42')]=_0xbc4575;return _0x3f5882;})[_0x54e5('0x24')](respondWithFilteredResult(_0x1bf166,_0x2b4ab0))[_0x54e5('0x43')](handleError(_0x1bf166,null));};exports['show']=function(_0x143a1a,_0x3cc23b){var _0x10767e={'raw':!![],'where':{'id':_0x143a1a[_0x54e5('0x44')]['id']}},_0x308635={};_0x308635[_0x54e5('0x30')]=_[_0x54e5('0x32')](db[_0x54e5('0x3f')]['rawAttributes']);_0x308635[_0x54e5('0x31')]=_[_0x54e5('0x32')](_0x143a1a['query']);_0x308635[_0x54e5('0x33')]=_[_0x54e5('0x34')](_0x308635[_0x54e5('0x30')],_0x308635[_0x54e5('0x31')]);_0x10767e[_0x54e5('0x35')]=_[_0x54e5('0x34')](_0x308635[_0x54e5('0x30')],qs['fields'](_0x143a1a['query'][_0x54e5('0x36')]));_0x10767e['attributes']=_0x10767e[_0x54e5('0x35')][_0x54e5('0x45')]?_0x10767e[_0x54e5('0x35')]:_0x308635[_0x54e5('0x30')];if(_0x143a1a[_0x54e5('0x31')][_0x54e5('0x40')]){_0x10767e['include']=[{'all':!![]}];}_0x10767e=_[_0x54e5('0x3c')]({},_0x10767e,_0x143a1a[_0x54e5('0x46')]);return db[_0x54e5('0x3f')][_0x54e5('0x47')](_0x10767e)[_0x54e5('0x24')](handleEntityNotFound(_0x3cc23b,null))[_0x54e5('0x24')](respondWithResult(_0x3cc23b,null))['catch'](handleError(_0x3cc23b,null));};exports[_0x54e5('0x48')]=function(_0x5130f2,_0x17bcda){return db[_0x54e5('0x3f')]['create'](_0x5130f2[_0x54e5('0x49')],{})['then'](respondWithResult(_0x17bcda,0xc9))['catch'](handleError(_0x17bcda,null));};exports[_0x54e5('0x23')]=function(_0x3ba9c3,_0x3954ac){if(_0x3ba9c3['body']['id']){delete _0x3ba9c3[_0x54e5('0x49')]['id'];}return db['SquareRecording'][_0x54e5('0x47')]({'where':{'id':_0x3ba9c3[_0x54e5('0x44')]['id']}})[_0x54e5('0x24')](handleEntityNotFound(_0x3954ac,null))[_0x54e5('0x24')](saveUpdates(_0x3ba9c3[_0x54e5('0x49')],null))[_0x54e5('0x24')](respondWithResult(_0x3954ac,null))[_0x54e5('0x43')](handleError(_0x3954ac,null));};exports[_0x54e5('0x4a')]=function(_0xa44f1b,_0x536bf9,_0x2a71d6){var _0x4ec484=require(_0x54e5('0x4b'));var _0x53cc2d=![];var _0x2e688e={};if(_0xa44f1b[_0x54e5('0x31')]['type']&&_0xa44f1b[_0x54e5('0x31')][_0x54e5('0x3d')]===_0x54e5('0x4c')){_0x2e688e[_0x54e5('0x4c')]=_0xa44f1b[_0x54e5('0x44')]['id'];}else{_0x2e688e['id']=_0xa44f1b['params']['id'];}return db['SquareRecording']['find']({'where':_0x2e688e,'attributes':['id','savePath','filename'],'raw':!![]})['then'](handleEntityNotFound(_0x536bf9,null))['then'](function(_0xf8265b){if(_0xf8265b){var _0x1d9e48=_0xf8265b[_0x54e5('0x4d')];var _0x53866e=util[_0x54e5('0x4e')](_0x54e5('0x4f'),_0x1d9e48);if(fs[_0x54e5('0x50')](_0x53866e)){_0x53cc2d=!![];return _0x4ec484[_0x54e5('0x51')](_0x53866e,_0x1d9e48,config[_0x54e5('0x52')][_0x54e5('0x53')])[_0x54e5('0x24')](function(){return _0xf8265b;});}return _0xf8265b;}})['then'](function(_0x844e05){if(_0x844e05){var _0x1792a8=_0x844e05[_0x54e5('0x4d')];if(!fs['existsSync'](_0x1792a8)){throw new db[(_0x54e5('0x54'))][(_0x54e5('0x55'))](_0x54e5('0x56'));}if(_0x844e05[_0x54e5('0x57')]){return _0x536bf9['download'](_0x1792a8,_0x844e05[_0x54e5('0x57')]+path[_0x54e5('0x58')](_0x1792a8),function(){if(_0x53cc2d){fs['unlink'](_0x1792a8);}});}else{return _0x536bf9[_0x54e5('0x4a')](_0x1792a8,function(_0x1dca00){if(_0x53cc2d){fs['unlink'](_0x1792a8);}});}}})[_0x54e5('0x43')](function(_0x484a67){if(_0x484a67[_0x54e5('0x59')]===_0x54e5('0x56')){_0x536bf9[_0x54e5('0x1a')](0x194)[_0x54e5('0x2a')](_0x54e5('0x5a'));}else{return handleError(_0x536bf9,null);}});};exports[_0x54e5('0x25')]=function(_0x31c77d,_0x528287){return db[_0x54e5('0x3f')][_0x54e5('0x47')]({'where':{'id':_0x31c77d[_0x54e5('0x44')]['id']}})[_0x54e5('0x24')](function(_0x6116c4){if(!_0x6116c4)throw new ReferenceError(_0x54e5('0x5b'));return _0x6116c4;})['then'](function(_0x4b7039){var _0x198bb0=_0x4b7039['savePath'];logger[_0x54e5('0x5c')](_0x54e5('0x5d'),_0x198bb0);if(!_[_0x54e5('0x5e')](_0x4b7039[_0x54e5('0x4d')])&&fs['existsSync'](_0x198bb0)){logger[_0x54e5('0x5c')](_0x54e5('0x5f')+_0x198bb0+_0x54e5('0x60'));fs[_0x54e5('0x61')](_0x198bb0);}_0x198bb0=_0x198bb0+_0x54e5('0x62');if(!_[_0x54e5('0x5e')](_0x4b7039[_0x54e5('0x4d')])&&fs['existsSync'](_0x198bb0)){logger[_0x54e5('0x5c')](_0x54e5('0x5f')+_0x198bb0+_0x54e5('0x60'));fs[_0x54e5('0x61')](_0x198bb0);}return _0x4b7039;})['then'](function(_0x5ba003){if(!_0x5ba003)throw new InternalError();return _0x5ba003[_0x54e5('0x25')]();})[_0x54e5('0x24')](function(){_0x528287[_0x54e5('0x1a')](0xcc)['end']();})[_0x54e5('0x43')](handleError(_0x528287,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index ebb4082..0675b8a 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 _0xbbdd=['square_recordings','util','api','moment','rimraf','exports','define'];(function(_0x35cf0b,_0x5d4b8e){var _0x19528a=function(_0x5ecffa){while(--_0x5ecffa){_0x35cf0b['push'](_0x35cf0b['shift']());}};_0x19528a(++_0x5d4b8e);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xbbdd[_0x556bb1];return _0x45455f;};'use strict';var _=require('lodash');var util=require(_0xdbbd('0x0'));var logger=require('../../config/logger')(_0xdbbd('0x1'));var moment=require(_0xdbbd('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdbbd('0x3'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0xdbbd('0x4')]=function(_0x103977,_0x3e81aa){return _0x103977[_0xdbbd('0x5')]('SquareRecording',attributes,{'tableName':_0xdbbd('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14a0=['../../config/logger','api','moment','bluebird','request-promise','path','./squareRecording.attributes','exports','SquareRecording','square_recordings','util'];(function(_0x7f3ffa,_0xaed5ee){var _0x593cc5=function(_0x58dcf5){while(--_0x58dcf5){_0x7f3ffa['push'](_0x7f3ffa['shift']());}};_0x593cc5(++_0xaed5ee);}(_0x14a0,0x8e));var _0x014a=function(_0xee5d2a,_0x534134){_0xee5d2a=_0xee5d2a-0x0;var _0x346948=_0x14a0[_0xee5d2a];return _0x346948;};'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/squareRecording/squareRecording.rpc.js b/server/api/squareRecording/squareRecording.rpc.js index 59ce1b2..0613263 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 _0xf112=['SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','body','options','raw','CreateSquareRecording','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x335ff7,_0x3853e4){var _0x38637c=function(_0x1628f9){while(--_0x1628f9){_0x335ff7['push'](_0x335ff7['shift']());}};_0x38637c(++_0x3853e4);}(_0xf112,0x18b));var _0x2f11=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0xf112[_0x4aa4e6];return _0x322588;};'use strict';var _=require(_0x2f11('0x0'));var util=require(_0x2f11('0x1'));var moment=require(_0x2f11('0x2'));var BPromise=require('bluebird');var rs=require(_0x2f11('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f11('0x4'))['db'];var utils=require(_0x2f11('0x5'));var logger=require(_0x2f11('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2f11('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1497ee,_0x5a7c7d,_0x2fd2c9){return new BPromise(function(_0x39a93e,_0x53053f){return client[_0x2f11('0x8')](_0x1497ee,_0x2fd2c9)[_0x2f11('0x9')](function(_0x45ef92){logger['info'](_0x2f11('0xa'),_0x5a7c7d,_0x2f11('0xb'));logger[_0x2f11('0xc')](_0x2f11('0xd'),_0x5a7c7d,_0x2f11('0xb'),JSON[_0x2f11('0xe')](_0x45ef92));if(_0x45ef92[_0x2f11('0xf')]){if(_0x45ef92[_0x2f11('0xf')]['code']===0x1f4){logger[_0x2f11('0xf')]('SquareRecording,\x20%s,\x20%s',_0x5a7c7d,_0x45ef92[_0x2f11('0xf')]['message']);return _0x53053f(_0x45ef92[_0x2f11('0xf')][_0x2f11('0x10')]);}logger[_0x2f11('0xf')](_0x2f11('0xa'),_0x5a7c7d,_0x45ef92[_0x2f11('0xf')][_0x2f11('0x10')]);return _0x39a93e(_0x45ef92[_0x2f11('0xf')][_0x2f11('0x10')]);}else{logger[_0x2f11('0x11')](_0x2f11('0xa'),_0x5a7c7d,_0x2f11('0xb'));_0x39a93e(_0x45ef92[_0x2f11('0x12')][_0x2f11('0x10')]);}})[_0x2f11('0x13')](function(_0xce7ed){logger['error']('SquareRecording,\x20%s,\x20%s',_0x5a7c7d,_0xce7ed);_0x53053f(_0xce7ed);});});}exports['CreateSquareRecording']=function(_0x2624d9){var _0x5afaf9=this;return new Promise(function(_0x29e0f8,_0x21475b){return db['SquareRecording']['create'](_0x2624d9[_0x2f11('0x14')],{'raw':_0x2624d9[_0x2f11('0x15')]?_0x2624d9['options'][_0x2f11('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xc3edac){logger[_0x2f11('0x11')](_0x2f11('0x17'),_0x2624d9);logger['debug'](_0x2f11('0x17'),_0x2624d9,JSON['stringify'](_0xc3edac));_0x29e0f8(_0xc3edac);})[_0x2f11('0x13')](function(_0x327583){logger[_0x2f11('0xf')](_0x2f11('0x17'),_0x327583['message'],_0x2624d9);_0x21475b(_0x5afaf9[_0x2f11('0xf')](0x1f4,_0x327583['message']));});});}; \ No newline at end of file +var _0x238a=['rpc','client','http','request','info','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SquareRecording,\x20%s,\x20%s','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','then','lodash','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x1f7367,_0x31fd7c){var _0x54349d=function(_0x28925f){while(--_0x28925f){_0x1f7367['push'](_0x1f7367['shift']());}};_0x54349d(++_0x31fd7c);}(_0x238a,0x81));var _0xa238=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x238a[_0xd09668];return _0x68726;};'use strict';var _=require(_0xa238('0x0'));var util=require(_0xa238('0x1'));var moment=require(_0xa238('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa238('0x3'));var db=require(_0xa238('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa238('0x5'))(_0xa238('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa238('0x7')][_0xa238('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33090f,_0x4d5b13,_0x302b80){return new BPromise(function(_0x856a31,_0x37b998){return client[_0xa238('0x9')](_0x33090f,_0x302b80)['then'](function(_0x1a3a94){logger[_0xa238('0xa')]('SquareRecording,\x20%s,\x20%s',_0x4d5b13,'request\x20sent');logger[_0xa238('0xb')](_0xa238('0xc'),_0x4d5b13,_0xa238('0xd'),JSON[_0xa238('0xe')](_0x1a3a94));if(_0x1a3a94[_0xa238('0xf')]){if(_0x1a3a94[_0xa238('0xf')][_0xa238('0x10')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x4d5b13,_0x1a3a94['error'][_0xa238('0x11')]);return _0x37b998(_0x1a3a94['error']['message']);}logger[_0xa238('0xf')](_0xa238('0x12'),_0x4d5b13,_0x1a3a94[_0xa238('0xf')]['message']);return _0x856a31(_0x1a3a94[_0xa238('0xf')][_0xa238('0x11')]);}else{logger['info'](_0xa238('0x12'),_0x4d5b13,_0xa238('0xd'));_0x856a31(_0x1a3a94[_0xa238('0x13')]['message']);}})[_0xa238('0x14')](function(_0x797731){logger[_0xa238('0xf')](_0xa238('0x12'),_0x4d5b13,_0x797731);_0x37b998(_0x797731);});});}exports[_0xa238('0x15')]=function(_0x4b078a){var _0x25385d=this;return new Promise(function(_0x2b3d58,_0x4530ac){return db[_0xa238('0x16')]['create'](_0x4b078a[_0xa238('0x17')],{'raw':_0x4b078a[_0xa238('0x18')]?_0x4b078a[_0xa238('0x18')][_0xa238('0x19')]===undefined?!![]:![]:!![]})[_0xa238('0x1a')](function(_0x413923){logger[_0xa238('0xa')](_0xa238('0x15'),_0x4b078a);logger[_0xa238('0xb')](_0xa238('0x15'),_0x4b078a,JSON['stringify'](_0x413923));_0x2b3d58(_0x413923);})[_0xa238('0x14')](function(_0x393683){logger[_0xa238('0xf')]('CreateSquareRecording',_0x393683[_0xa238('0x11')],_0x4b078a);_0x4530ac(_0x25385d['error'](0x1f4,_0x393683[_0xa238('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b33727e..b3e90ad 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 _0xdbca=['isAuthenticated','index','/describe','/:id','show','create','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get'];(function(_0xb415cd,_0x2ab863){var _0xf81f02=function(_0x10b35d){while(--_0x10b35d){_0xb415cd['push'](_0xb415cd['shift']());}};_0xf81f02(++_0x2ab863);}(_0xdbca,0xe0));var _0xadbc=function(_0x14bf63,_0xdbd373){_0x14bf63=_0x14bf63-0x0;var _0x410d22=_0xdbca[_0x14bf63];return _0x410d22;};'use strict';var multer=require(_0xadbc('0x0'));var util=require(_0xadbc('0x1'));var path=require('path');var timeout=require(_0xadbc('0x2'));var express=require(_0xadbc('0x3'));var router=express[_0xadbc('0x4')]();var auth=require(_0xadbc('0x5'));var interaction=require(_0xadbc('0x6'));var config=require(_0xadbc('0x7'));var controller=require(_0xadbc('0x8'));router[_0xadbc('0x9')]('/',auth[_0xadbc('0xa')](),controller[_0xadbc('0xb')]);router[_0xadbc('0x9')](_0xadbc('0xc'),auth[_0xadbc('0xa')](),controller['describe']);router[_0xadbc('0x9')](_0xadbc('0xd'),auth['isAuthenticated'](),controller[_0xadbc('0xe')]);router['post']('/',auth[_0xadbc('0xa')](),controller[_0xadbc('0xf')]);router['put'](_0xadbc('0xd'),auth[_0xadbc('0xa')](),controller['update']);router[_0xadbc('0x10')](_0xadbc('0xd'),auth[_0xadbc('0xa')](),controller[_0xadbc('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4188=['describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x4c6d81,_0x462b1d){var _0x1b6cad=function(_0x16dc1c){while(--_0x16dc1c){_0x4c6d81['push'](_0x4c6d81['shift']());}};_0x1b6cad(++_0x462b1d);}(_0x4188,0x81));var _0x8418=function(_0x19e17e,_0x2190a3){_0x19e17e=_0x19e17e-0x0;var _0x2d04da=_0x4188[_0x19e17e];return _0x2d04da;};'use strict';var multer=require(_0x8418('0x0'));var util=require(_0x8418('0x1'));var path=require(_0x8418('0x2'));var timeout=require(_0x8418('0x3'));var express=require('express');var router=express[_0x8418('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8418('0x5'));var config=require(_0x8418('0x6'));var controller=require(_0x8418('0x7'));router[_0x8418('0x8')]('/',auth[_0x8418('0x9')](),controller[_0x8418('0xa')]);router['get']('/describe',auth[_0x8418('0x9')](),controller[_0x8418('0xb')]);router['get'](_0x8418('0xc'),auth[_0x8418('0x9')](),controller[_0x8418('0xd')]);router[_0x8418('0xe')]('/',auth[_0x8418('0x9')](),controller[_0x8418('0xf')]);router[_0x8418('0x10')]('/:id',auth[_0x8418('0x9')](),controller[_0x8418('0x11')]);router[_0x8418('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x8418('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 1062cbb..bda20bd 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 _0x0425=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x4d5711,_0x36e2f3){var _0x57352e=function(_0x229d40){while(--_0x229d40){_0x4d5711['push'](_0x4d5711['shift']());}};_0x57352e(++_0x36e2f3);}(_0x0425,0xee));var _0x5042=function(_0x29148b,_0xff9fa8){_0x29148b=_0x29148b-0x0;var _0x2df13c=_0x0425[_0x29148b];return _0x2df13c;};'use strict';var Sequelize=require(_0x5042('0x0'));module[_0x5042('0x1')]={'network':{'type':Sequelize[_0x5042('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5042('0x2')]},'language':{'type':Sequelize[_0x5042('0x2')]},'type':{'type':Sequelize[_0x5042('0x2')]},'uniqueid':{'type':Sequelize[_0x5042('0x2')]},'version':{'type':Sequelize[_0x5042('0x2')]},'callerid':{'type':Sequelize[_0x5042('0x2')]},'calleridname':{'type':Sequelize[_0x5042('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x5042('0x2')]},'callington':{'type':Sequelize[_0x5042('0x2')]},'callingtns':{'type':Sequelize[_0x5042('0x2')]},'dnid':{'type':Sequelize[_0x5042('0x2')]},'rdnis':{'type':Sequelize[_0x5042('0x2')]},'context':{'type':Sequelize[_0x5042('0x2')]},'extension':{'type':Sequelize[_0x5042('0x2')]},'priority':{'type':Sequelize[_0x5042('0x2')]},'enhanced':{'type':Sequelize[_0x5042('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x5042('0x2')]},'project_name':{'type':Sequelize[_0x5042('0x2')]},'joinAt':{'type':Sequelize[_0x5042('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x5042('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x7380=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7380,0x10a));var _0x0738=function(_0x120376,_0x571898){_0x120376=_0x120376-0x0;var _0x28c529=_0x7380[_0x120376];return _0x28c529;};'use strict';var Sequelize=require(_0x0738('0x0'));module[_0x0738('0x1')]={'network':{'type':Sequelize[_0x0738('0x2')]},'network_script':{'type':Sequelize[_0x0738('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0738('0x2')]},'language':{'type':Sequelize[_0x0738('0x2')]},'type':{'type':Sequelize[_0x0738('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x0738('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0738('0x2')]},'callingpres':{'type':Sequelize[_0x0738('0x2')]},'callingani2':{'type':Sequelize[_0x0738('0x2')]},'callington':{'type':Sequelize[_0x0738('0x2')]},'callingtns':{'type':Sequelize[_0x0738('0x2')]},'dnid':{'type':Sequelize[_0x0738('0x2')]},'rdnis':{'type':Sequelize[_0x0738('0x2')]},'context':{'type':Sequelize[_0x0738('0x2')]},'extension':{'type':Sequelize[_0x0738('0x2')]},'priority':{'type':Sequelize[_0x0738('0x2')]},'enhanced':{'type':Sequelize[_0x0738('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x0738('0x2')]},'project_name':{'type':Sequelize[_0x0738('0x2')]},'joinAt':{'type':Sequelize[_0x0738('0x3')]},'leaveAt':{'type':Sequelize[_0x0738('0x3')]},'bot':{'type':Sequelize[_0x0738('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index a1c886b..92387f0 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 _0x1261=['model','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','type','merge','options','includeAll','findAll','rows','show','params','keys','length','include','catch','create','body','update','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','then','error','stack','name','index','SquareReport','rawAttributes','fieldName','key','map','query','intersection'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x1261,0x144));var _0x1126=function(_0xc83285,_0x3860f3){_0xc83285=_0xc83285-0x0;var _0x59ef36=_0x1261[_0xc83285];return _0x59ef36;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1126('0x0'));var rimraf=require(_0x1126('0x1'));var zipdir=require(_0x1126('0x2'));var jsonpatch=require(_0x1126('0x3'));var rp=require(_0x1126('0x4'));var moment=require(_0x1126('0x5'));var BPromise=require(_0x1126('0x6'));var Mustache=require(_0x1126('0x7'));var util=require(_0x1126('0x8'));var path=require(_0x1126('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1126('0xa'));var fs=require('fs');var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var db=require(_0x1126('0x16'))['db'];function respondWithStatusCode(_0x1b364a,_0xd26a32){_0xd26a32=_0xd26a32||0xcc;return function(_0x273896){if(_0x273896){return _0x1b364a[_0x1126('0x17')](_0xd26a32);}return _0x1b364a[_0x1126('0x18')](_0xd26a32)[_0x1126('0x19')]();};}function respondWithResult(_0x2048ad,_0x43850b){_0x43850b=_0x43850b||0xc8;return function(_0x53a8f0){if(_0x53a8f0){return _0x2048ad['status'](_0x43850b)[_0x1126('0x1a')](_0x53a8f0);}};}function respondWithFilteredResult(_0x154e20,_0x279455){return function(_0x4be0c6){if(_0x4be0c6){var _0x45149c=_0x4be0c6[_0x1126('0x1b')],_0x4794a7=_0x279455['offset'],_0x35fe9f=_0x279455[_0x1126('0x1c')]+_0x279455[_0x1126('0x1d')],_0x42f379;if(_0x35fe9f>=_0x45149c){_0x35fe9f=_0x45149c;_0x42f379=0xc8;}else{_0x42f379=0xce;}_0x154e20['status'](_0x42f379);return _0x154e20['set'](_0x1126('0x1e'),_0x4794a7+'-'+_0x35fe9f+'/'+_0x45149c)[_0x1126('0x1a')](_0x4be0c6);}return null;};}function patchUpdates(_0x58d11a){return function(_0x548359){try{jsonpatch[_0x1126('0x1f')](_0x548359,_0x58d11a,!![]);}catch(_0x58b109){return BPromise[_0x1126('0x20')](_0x58b109);}return _0x548359[_0x1126('0x21')]();};}function saveUpdates(_0x2f70ac,_0x54400a){return function(_0x2a08ba){if(_0x2a08ba){return _0x2a08ba['update'](_0x2f70ac)['then'](function(_0x30f6b3){return _0x30f6b3;});}return null;};}function removeEntity(_0x3a9bed,_0x25b24b){return function(_0x36d254){if(_0x36d254){return _0x36d254['destroy']()[_0x1126('0x22')](function(){_0x3a9bed[_0x1126('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(!_0x529dd9){_0x2175fa['sendStatus'](0x194);}return _0x529dd9;};}function handleError(_0x2199d9,_0x15bcc3){_0x15bcc3=_0x15bcc3||0x1f4;return function(_0x329914){logger[_0x1126('0x23')](_0x329914[_0x1126('0x24')]);if(_0x329914[_0x1126('0x25')]){delete _0x329914[_0x1126('0x25')];}_0x2199d9[_0x1126('0x18')](_0x15bcc3)['send'](_0x329914);};}exports[_0x1126('0x26')]=function(_0x375e59,_0xa293f4){var _0x5ddf63={},_0x541bc9={},_0xeb7d89={'count':0x0,'rows':[]};var _0x39bf0e=_['map'](db[_0x1126('0x27')][_0x1126('0x28')],function(_0x4a334a){return{'name':_0x4a334a[_0x1126('0x29')],'type':_0x4a334a['type'][_0x1126('0x2a')]};});_0x541bc9['model']=_[_0x1126('0x2b')](_0x39bf0e,'name');_0x541bc9[_0x1126('0x2c')]=_['keys'](_0x375e59['query']);_0x541bc9['filters']=_[_0x1126('0x2d')](_0x541bc9[_0x1126('0x2e')],_0x541bc9[_0x1126('0x2c')]);_0x5ddf63['attributes']=_[_0x1126('0x2d')](_0x541bc9[_0x1126('0x2e')],qs['fields'](_0x375e59[_0x1126('0x2c')][_0x1126('0x2f')]));_0x5ddf63[_0x1126('0x30')]=_0x5ddf63[_0x1126('0x30')]['length']?_0x5ddf63['attributes']:_0x541bc9[_0x1126('0x2e')];if(!_0x375e59[_0x1126('0x2c')][_0x1126('0x31')](_0x1126('0x32'))){_0x5ddf63['limit']=qs[_0x1126('0x1d')](_0x375e59[_0x1126('0x2c')][_0x1126('0x1d')]);_0x5ddf63[_0x1126('0x1c')]=qs[_0x1126('0x1c')](_0x375e59['query'][_0x1126('0x1c')]);}_0x5ddf63[_0x1126('0x33')]=qs[_0x1126('0x34')](_0x375e59[_0x1126('0x2c')]['sort']);_0x5ddf63['where']=qs[_0x1126('0x35')](_[_0x1126('0x36')](_0x375e59['query'],_0x541bc9[_0x1126('0x35')]));if(_0x375e59[_0x1126('0x2c')][_0x1126('0x37')]){_0x5ddf63['where']=_['merge'](_0x5ddf63[_0x1126('0x38')],{'$or':_[_0x1126('0x2b')](_0x39bf0e,function(_0x3aa08f){if(_0x3aa08f[_0x1126('0x39')]!=='VIRTUAL'){var _0x428d3d={};_0x428d3d[_0x3aa08f['name']]={'$like':'%'+_0x375e59[_0x1126('0x2c')][_0x1126('0x37')]+'%'};return _0x428d3d;}})});}_0x5ddf63=_[_0x1126('0x3a')]({},_0x5ddf63,_0x375e59[_0x1126('0x3b')]);var _0x57e5d2={'where':_0x5ddf63['where']};return db[_0x1126('0x27')][_0x1126('0x1b')](_0x57e5d2)[_0x1126('0x22')](function(_0x397e3b){_0xeb7d89[_0x1126('0x1b')]=_0x397e3b;if(_0x375e59[_0x1126('0x2c')][_0x1126('0x3c')]){_0x5ddf63['include']=[{'all':!![]}];}return db[_0x1126('0x27')][_0x1126('0x3d')](_0x5ddf63);})[_0x1126('0x22')](function(_0xf3a0bd){_0xeb7d89[_0x1126('0x3e')]=_0xf3a0bd;return _0xeb7d89;})['then'](respondWithFilteredResult(_0xa293f4,_0x5ddf63))['catch'](handleError(_0xa293f4,null));};exports[_0x1126('0x3f')]=function(_0x219bcc,_0xcee9de){var _0x21c38e={'raw':!![],'where':{'id':_0x219bcc[_0x1126('0x40')]['id']}},_0x18b496={};_0x18b496['model']=_['keys'](db['SquareReport'][_0x1126('0x28')]);_0x18b496['query']=_[_0x1126('0x41')](_0x219bcc[_0x1126('0x2c')]);_0x18b496[_0x1126('0x35')]=_[_0x1126('0x2d')](_0x18b496['model'],_0x18b496['query']);_0x21c38e[_0x1126('0x30')]=_[_0x1126('0x2d')](_0x18b496[_0x1126('0x2e')],qs['fields'](_0x219bcc[_0x1126('0x2c')]['fields']));_0x21c38e[_0x1126('0x30')]=_0x21c38e['attributes'][_0x1126('0x42')]?_0x21c38e[_0x1126('0x30')]:_0x18b496[_0x1126('0x2e')];if(_0x219bcc['query'][_0x1126('0x3c')]){_0x21c38e[_0x1126('0x43')]=[{'all':!![]}];}_0x21c38e=_[_0x1126('0x3a')]({},_0x21c38e,_0x219bcc['options']);return db['SquareReport']['find'](_0x21c38e)[_0x1126('0x22')](handleEntityNotFound(_0xcee9de,null))['then'](respondWithResult(_0xcee9de,null))[_0x1126('0x44')](handleError(_0xcee9de,null));};exports['create']=function(_0x2f45b9,_0x323499){return db[_0x1126('0x27')][_0x1126('0x45')](_0x2f45b9[_0x1126('0x46')],{})['then'](respondWithResult(_0x323499,0xc9))[_0x1126('0x44')](handleError(_0x323499,null));};exports[_0x1126('0x47')]=function(_0x5111d3,_0x1a15f8){if(_0x5111d3[_0x1126('0x46')]['id']){delete _0x5111d3['body']['id'];}return db[_0x1126('0x27')][_0x1126('0x48')]({'where':{'id':_0x5111d3['params']['id']}})[_0x1126('0x22')](handleEntityNotFound(_0x1a15f8,null))[_0x1126('0x22')](saveUpdates(_0x5111d3[_0x1126('0x46')],null))['then'](respondWithResult(_0x1a15f8,null))[_0x1126('0x44')](handleError(_0x1a15f8,null));};exports[_0x1126('0x49')]=function(_0x411c89,_0x5878bb){return db[_0x1126('0x27')][_0x1126('0x48')]({'where':{'id':_0x411c89[_0x1126('0x40')]['id']}})[_0x1126('0x22')](handleEntityNotFound(_0x5878bb,null))['then'](removeEntity(_0x5878bb,null))[_0x1126('0x44')](handleError(_0x5878bb,null));};exports['describe']=function(_0x40168e,_0x2ad118){return db['SquareReport']['describe']()[_0x1126('0x22')](respondWithResult(_0x2ad118,null))[_0x1126('0x44')](handleError(_0x2ad118,null));}; \ No newline at end of file +var _0x814b=['index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','SquareReport','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(_0x13b70c,_0x40be1c){var _0x2d0edd=function(_0x485ea4){while(--_0x485ea4){_0x13b70c['push'](_0x13b70c['shift']());}};_0x2d0edd(++_0x40be1c);}(_0x814b,0x1a2));var _0xb814=function(_0x4ca288,_0x254dd8){_0x4ca288=_0x4ca288-0x0;var _0x2362c1=_0x814b[_0x4ca288];return _0x2362c1;};'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['SquareReport'][_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')]));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['SquareReport'][_0xb814('0x1e')](_0x4d308a)[_0xb814('0x27')](function(_0x38cdc2){_0x5a6291[_0xb814('0x1e')]=_0x38cdc2;if(_0x32ed56['query']['includeAll']){_0x3f0150[_0xb814('0x41')]=[{'all':!![]}];}return db['SquareReport'][_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['SquareReport'][_0xb814('0x4c')]()['then'](respondWithResult(_0xf27a6e,null))[_0xb814('0x44')](handleError(_0xf27a6e,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 4810912..d907a36 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 _0xd7ca=['SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports'];(function(_0x4e4ee0,_0x66ce4f){var _0x2a413d=function(_0x713bbc){while(--_0x713bbc){_0x4e4ee0['push'](_0x4e4ee0['shift']());}};_0x2a413d(++_0x66ce4f);}(_0xd7ca,0x114));var _0xad7c=function(_0x1e82c3,_0x22c51e){_0x1e82c3=_0x1e82c3-0x0;var _0xaafd9f=_0xd7ca[_0x1e82c3];return _0xaafd9f;};'use strict';var _=require(_0xad7c('0x0'));var util=require(_0xad7c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xad7c('0x2'));var BPromise=require(_0xad7c('0x3'));var rp=require(_0xad7c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad7c('0x5'));var config=require(_0xad7c('0x6'));var attributes=require(_0xad7c('0x7'));module[_0xad7c('0x8')]=function(_0x4d00d6,_0x4a5db7){return _0x4d00d6['define'](_0xad7c('0x9'),attributes,{'tableName':_0xad7c('0xa'),'paranoid':![],'indexes':[{'name':_0xad7c('0xb'),'fields':[_0xad7c('0xc'),_0xad7c('0xd')]},{'name':_0xad7c('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0cd0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x0cd0,0x13f));var _0x00cd=function(_0x6c673d,_0x540597){_0x6c673d=_0x6c673d-0x0;var _0x544f99=_0x0cd0[_0x6c673d];return _0x544f99;};'use strict';var _=require('lodash');var util=require(_0x00cd('0x0'));var logger=require(_0x00cd('0x1'))(_0x00cd('0x2'));var moment=require(_0x00cd('0x3'));var BPromise=require(_0x00cd('0x4'));var rp=require(_0x00cd('0x5'));var fs=require('fs');var path=require(_0x00cd('0x6'));var rimraf=require(_0x00cd('0x7'));var config=require(_0x00cd('0x8'));var attributes=require(_0x00cd('0x9'));module['exports']=function(_0x4f558e,_0x5de534){return _0x4f558e['define'](_0x00cd('0xa'),attributes,{'tableName':_0x00cd('0xb'),'paranoid':![],'indexes':[{'name':_0x00cd('0xc'),'fields':[_0x00cd('0xd'),_0x00cd('0xe')]},{'name':_0x00cd('0xf'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index c4e83f7..423fd04 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 _0x7644=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','body','options','then','UpdateSquareReport','update','raw','attributes','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x2f87cd,_0xcaf299){var _0x5d7eda=function(_0x37ffb0){while(--_0x37ffb0){_0x2f87cd['push'](_0x2f87cd['shift']());}};_0x5d7eda(++_0xcaf299);}(_0x7644,0xe2));var _0x4764=function(_0x539742,_0xaf1b0f){_0x539742=_0x539742-0x0;var _0x4b21fd=_0x7644[_0x539742];return _0x4b21fd;};'use strict';var _=require(_0x4764('0x0'));var util=require(_0x4764('0x1'));var moment=require(_0x4764('0x2'));var BPromise=require(_0x4764('0x3'));var rs=require(_0x4764('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4764('0x5'))['db'];var utils=require(_0x4764('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x4764('0x7'));var jayson=require(_0x4764('0x8'));var client=jayson[_0x4764('0x9')][_0x4764('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x506eab,_0xf21076,_0x5bf99f){return new BPromise(function(_0x3d1cfb,_0x4e41e0){return client[_0x4764('0xb')](_0x506eab,_0x5bf99f)['then'](function(_0x2a7a7a){logger[_0x4764('0xc')](_0x4764('0xd'),_0xf21076,_0x4764('0xe'));logger[_0x4764('0xf')](_0x4764('0x10'),_0xf21076,_0x4764('0xe'),JSON[_0x4764('0x11')](_0x2a7a7a));if(_0x2a7a7a['error']){if(_0x2a7a7a[_0x4764('0x12')][_0x4764('0x13')]===0x1f4){logger[_0x4764('0x12')](_0x4764('0xd'),_0xf21076,_0x2a7a7a[_0x4764('0x12')][_0x4764('0x14')]);return _0x4e41e0(_0x2a7a7a[_0x4764('0x12')][_0x4764('0x14')]);}logger['error'](_0x4764('0xd'),_0xf21076,_0x2a7a7a[_0x4764('0x12')][_0x4764('0x14')]);return _0x3d1cfb(_0x2a7a7a[_0x4764('0x12')][_0x4764('0x14')]);}else{logger[_0x4764('0xc')]('SquareReport,\x20%s,\x20%s',_0xf21076,_0x4764('0xe'));_0x3d1cfb(_0x2a7a7a[_0x4764('0x15')]['message']);}})[_0x4764('0x16')](function(_0x3e7c8a){logger['error'](_0x4764('0xd'),_0xf21076,_0x3e7c8a);_0x4e41e0(_0x3e7c8a);});});}exports[_0x4764('0x17')]=function(_0x543055){var _0x1b28b2=this;return new Promise(function(_0x28d67a,_0x48d9af){return db[_0x4764('0x18')]['create'](_0x543055[_0x4764('0x19')],{'raw':_0x543055[_0x4764('0x1a')]?_0x543055[_0x4764('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x4764('0x1b')](function(_0x4e159d){logger[_0x4764('0xc')](_0x4764('0x17'),_0x543055);logger[_0x4764('0xf')](_0x4764('0x17'),_0x543055,JSON[_0x4764('0x11')](_0x4e159d));_0x28d67a(_0x4e159d);})['catch'](function(_0x591909){logger[_0x4764('0x12')](_0x4764('0x17'),_0x591909['message'],_0x543055);_0x48d9af(_0x1b28b2[_0x4764('0x12')](0x1f4,_0x591909['message']));});});};exports[_0x4764('0x1c')]=function(_0x45cee3){var _0x2a43f4=this;return new Promise(function(_0x574cb8,_0xbcb2d6){return db[_0x4764('0x18')][_0x4764('0x1d')](_0x45cee3[_0x4764('0x19')],{'raw':_0x45cee3['options']?_0x45cee3[_0x4764('0x1a')][_0x4764('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45cee3[_0x4764('0x1a')]?_0x45cee3['options']['where']||null:null,'attributes':_0x45cee3['options']?_0x45cee3['options'][_0x4764('0x1f')]||null:null,'limit':_0x45cee3[_0x4764('0x1a')]?_0x45cee3[_0x4764('0x1a')][_0x4764('0x20')]||null:null})['then'](function(_0x360a29){logger[_0x4764('0xc')](_0x4764('0x1c'),_0x45cee3);logger[_0x4764('0xf')]('UpdateSquareReport',_0x45cee3,JSON['stringify'](_0x360a29));_0x574cb8(_0x360a29);})[_0x4764('0x16')](function(_0x5c3b93){logger['error'](_0x4764('0x1c'),_0x5c3b93['message'],_0x45cee3);_0xbcb2d6(_0x2a43f4['error'](0x1f4,_0x5c3b93[_0x4764('0x14')]));});});}; \ No newline at end of file +var _0xd9cc=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareReport','create','body','options','raw','then','SquareReport','update','where','attributes','UpdateSquareReport','lodash','moment','bluebird'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0xd9cc,0x7d));var _0xcd9c=function(_0x28ef22,_0x4b43d8){_0x28ef22=_0x28ef22-0x0;var _0x4cf375=_0xd9cc[_0x28ef22];return _0x4cf375;};'use strict';var _=require(_0xcd9c('0x0'));var util=require('util');var moment=require(_0xcd9c('0x1'));var BPromise=require(_0xcd9c('0x2'));var rs=require(_0xcd9c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd9c('0x4'))['db'];var utils=require(_0xcd9c('0x5'));var logger=require('../../config/logger')(_0xcd9c('0x6'));var config=require(_0xcd9c('0x7'));var jayson=require(_0xcd9c('0x8'));var client=jayson[_0xcd9c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a82b9,_0x4e9c8c,_0x505b10){return new BPromise(function(_0x3b2071,_0x5a629a){return client[_0xcd9c('0xa')](_0x2a82b9,_0x505b10)['then'](function(_0x971a9a){logger[_0xcd9c('0xb')](_0xcd9c('0xc'),_0x4e9c8c,'request\x20sent');logger[_0xcd9c('0xd')](_0xcd9c('0xe'),_0x4e9c8c,_0xcd9c('0xf'),JSON[_0xcd9c('0x10')](_0x971a9a));if(_0x971a9a[_0xcd9c('0x11')]){if(_0x971a9a[_0xcd9c('0x11')][_0xcd9c('0x12')]===0x1f4){logger[_0xcd9c('0x11')]('SquareReport,\x20%s,\x20%s',_0x4e9c8c,_0x971a9a[_0xcd9c('0x11')][_0xcd9c('0x13')]);return _0x5a629a(_0x971a9a[_0xcd9c('0x11')][_0xcd9c('0x13')]);}logger[_0xcd9c('0x11')]('SquareReport,\x20%s,\x20%s',_0x4e9c8c,_0x971a9a[_0xcd9c('0x11')]['message']);return _0x3b2071(_0x971a9a['error'][_0xcd9c('0x13')]);}else{logger[_0xcd9c('0xb')](_0xcd9c('0xc'),_0x4e9c8c,_0xcd9c('0xf'));_0x3b2071(_0x971a9a['result'][_0xcd9c('0x13')]);}})[_0xcd9c('0x14')](function(_0xdccbb6){logger[_0xcd9c('0x11')](_0xcd9c('0xc'),_0x4e9c8c,_0xdccbb6);_0x5a629a(_0xdccbb6);});});}exports[_0xcd9c('0x15')]=function(_0x4811b1){var _0x28cec5=this;return new Promise(function(_0x564f4c,_0xd101aa){return db['SquareReport'][_0xcd9c('0x16')](_0x4811b1[_0xcd9c('0x17')],{'raw':_0x4811b1['options']?_0x4811b1[_0xcd9c('0x18')][_0xcd9c('0x19')]===undefined?!![]:![]:!![]})[_0xcd9c('0x1a')](function(_0x4f8578){logger[_0xcd9c('0xb')](_0xcd9c('0x15'),_0x4811b1);logger[_0xcd9c('0xd')](_0xcd9c('0x15'),_0x4811b1,JSON[_0xcd9c('0x10')](_0x4f8578));_0x564f4c(_0x4f8578);})[_0xcd9c('0x14')](function(_0x41eebd){logger[_0xcd9c('0x11')](_0xcd9c('0x15'),_0x41eebd[_0xcd9c('0x13')],_0x4811b1);_0xd101aa(_0x28cec5['error'](0x1f4,_0x41eebd[_0xcd9c('0x13')]));});});};exports['UpdateSquareReport']=function(_0x5e4dc3){var _0x223435=this;return new Promise(function(_0x43fed9,_0x4cae80){return db[_0xcd9c('0x1b')][_0xcd9c('0x1c')](_0x5e4dc3['body'],{'raw':_0x5e4dc3[_0xcd9c('0x18')]?_0x5e4dc3['options'][_0xcd9c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e4dc3['options']?_0x5e4dc3[_0xcd9c('0x18')][_0xcd9c('0x1d')]||null:null,'attributes':_0x5e4dc3[_0xcd9c('0x18')]?_0x5e4dc3[_0xcd9c('0x18')][_0xcd9c('0x1e')]||null:null,'limit':_0x5e4dc3[_0xcd9c('0x18')]?_0x5e4dc3['options']['limit']||null:null})['then'](function(_0x5d8d37){logger['info'](_0xcd9c('0x1f'),_0x5e4dc3);logger[_0xcd9c('0xd')](_0xcd9c('0x1f'),_0x5e4dc3,JSON[_0xcd9c('0x10')](_0x5d8d37));_0x43fed9(_0x5d8d37);})[_0xcd9c('0x14')](function(_0x84e783){logger[_0xcd9c('0x11')](_0xcd9c('0x1f'),_0x84e783[_0xcd9c('0x13')],_0x5e4dc3);_0x4cae80(_0x223435[_0xcd9c('0x11')](0x1f4,_0x84e783[_0xcd9c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index f0527bb..b3c0d12 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 _0x814b=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x814b,0x1a2));var _0xb814=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0x814b[_0x2ab76b];return _0x201126;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['describe']);router[_0xb814('0x9')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xf')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0x11')](_0xb814('0xd'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['delete'](_0xb814('0xd'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module[_0xb814('0x14')]=router; \ No newline at end of file +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(_0x32e831,_0x1f37f8){var _0x460410=function(_0x326700){while(--_0x326700){_0x32e831['push'](_0x32e831['shift']());}};_0x460410(++_0x1f37f8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x144001,_0x5b35f2){_0x144001=_0x144001-0x0;var _0x2ff439=_0x5f2f[_0x144001];return _0x2ff439;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 4e92fdb..16c2fcd 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 _0x170e=['STRING','TEXT','sequelize','exports'];(function(_0x3cbe3e,_0x157554){var _0x132e27=function(_0x5465d5){while(--_0x5465d5){_0x3cbe3e['push'](_0x3cbe3e['shift']());}};_0x132e27(++_0x157554);}(_0x170e,0x11e));var _0xe170=function(_0x43747e,_0x13b832){_0x43747e=_0x43747e-0x0;var _0x7fb853=_0x170e[_0x43747e];return _0x7fb853;};'use strict';var Sequelize=require(_0xe170('0x0'));module[_0xe170('0x1')]={'uniqueid':{'type':Sequelize[_0xe170('0x2')]},'node':{'type':Sequelize[_0xe170('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xe170('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe170('0x2')]}}; \ No newline at end of file +var _0x5f1e=['exports','STRING','TEXT','sequelize'];(function(_0x20e7e3,_0x1529be){var _0x14b9de=function(_0xa82925){while(--_0xa82925){_0x20e7e3['push'](_0x20e7e3['shift']());}};_0x14b9de(++_0x1529be);}(_0x5f1e,0xd7));var _0xe5f1=function(_0x9e9c23,_0x207501){_0x9e9c23=_0x9e9c23-0x0;var _0x54617c=_0x5f1e[_0x9e9c23];return _0x54617c;};'use strict';var Sequelize=require(_0xe5f1('0x0'));module[_0xe5f1('0x1')]={'uniqueid':{'type':Sequelize[_0xe5f1('0x2')]},'node':{'type':Sequelize[_0xe5f1('0x2')]},'application':{'type':Sequelize[_0xe5f1('0x2')]},'data':{'type':Sequelize[_0xe5f1('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe5f1('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index c159979..2d85701 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 _0xbcbf=['query','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','SquareDetailsReport','include','catch','show','keys','includeAll','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x4c440b,_0x3ea627){var _0x2d48cf=function(_0x56bac7){while(--_0x56bac7){_0x4c440b['push'](_0x4c440b['shift']());}};_0x2d48cf(++_0x3ea627);}(_0xbcbf,0x13d));var _0xfbcb=function(_0x3c2ecb,_0x4ac652){_0x3c2ecb=_0x3c2ecb-0x0;var _0x261364=_0xbcbf[_0x3c2ecb];return _0x261364;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfbcb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbcb('0x1'));var jsonpatch=require(_0xfbcb('0x2'));var rp=require(_0xfbcb('0x3'));var moment=require(_0xfbcb('0x4'));var BPromise=require(_0xfbcb('0x5'));var Mustache=require(_0xfbcb('0x6'));var util=require(_0xfbcb('0x7'));var path=require(_0xfbcb('0x8'));var sox=require(_0xfbcb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xfbcb('0xa'));var squel=require('squel');var crypto=require(_0xfbcb('0xb'));var jsforce=require(_0xfbcb('0xc'));var deskjs=require(_0xfbcb('0xd'));var toCsv=require(_0xfbcb('0xe'));var querystring=require(_0xfbcb('0xf'));var Papa=require(_0xfbcb('0x10'));var Redis=require(_0xfbcb('0x11'));var authService=require(_0xfbcb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfbcb('0x13'));var hardwareService=require(_0xfbcb('0x14'));var logger=require(_0xfbcb('0x15'))(_0xfbcb('0x16'));var utils=require(_0xfbcb('0x17'));var config=require('../../config/environment');var db=require(_0xfbcb('0x18'))['db'];function respondWithStatusCode(_0x1b6013,_0xbdd560){_0xbdd560=_0xbdd560||0xcc;return function(_0x5224d0){if(_0x5224d0){return _0x1b6013[_0xfbcb('0x19')](_0xbdd560);}return _0x1b6013[_0xfbcb('0x1a')](_0xbdd560)[_0xfbcb('0x1b')]();};}function respondWithResult(_0x26d0bd,_0x1d08db){_0x1d08db=_0x1d08db||0xc8;return function(_0x2da605){if(_0x2da605){return _0x26d0bd[_0xfbcb('0x1a')](_0x1d08db)[_0xfbcb('0x1c')](_0x2da605);}};}function respondWithFilteredResult(_0x33a847,_0x579c91){return function(_0x3655b9){if(_0x3655b9){var _0xb17d45=_0x3655b9[_0xfbcb('0x1d')],_0x2d2888=_0x579c91['offset'],_0x276311=_0x579c91[_0xfbcb('0x1e')]+_0x579c91[_0xfbcb('0x1f')],_0x14d980;if(_0x276311>=_0xb17d45){_0x276311=_0xb17d45;_0x14d980=0xc8;}else{_0x14d980=0xce;}_0x33a847[_0xfbcb('0x1a')](_0x14d980);return _0x33a847[_0xfbcb('0x20')]('Content-Range',_0x2d2888+'-'+_0x276311+'/'+_0xb17d45)[_0xfbcb('0x1c')](_0x3655b9);}return null;};}function patchUpdates(_0x12bb24){return function(_0x57f518){try{jsonpatch[_0xfbcb('0x21')](_0x57f518,_0x12bb24,!![]);}catch(_0x375756){return BPromise[_0xfbcb('0x22')](_0x375756);}return _0x57f518['save']();};}function saveUpdates(_0x379cd8,_0x203f33){return function(_0x21098d){if(_0x21098d){return _0x21098d[_0xfbcb('0x23')](_0x379cd8)[_0xfbcb('0x24')](function(_0x3f650e){return _0x3f650e;});}return null;};}function removeEntity(_0x5b37e7,_0x589492){return function(_0x56e1b2){if(_0x56e1b2){return _0x56e1b2['destroy']()[_0xfbcb('0x24')](function(){_0x5b37e7['status'](0xcc)[_0xfbcb('0x1b')]();});}};}function handleEntityNotFound(_0x4f35c,_0x5736e6){return function(_0x5e6c2c){if(!_0x5e6c2c){_0x4f35c[_0xfbcb('0x19')](0x194);}return _0x5e6c2c;};}function handleError(_0x36f945,_0x15eb91){_0x15eb91=_0x15eb91||0x1f4;return function(_0x27cdb2){logger[_0xfbcb('0x25')](_0x27cdb2[_0xfbcb('0x26')]);if(_0x27cdb2['name']){delete _0x27cdb2[_0xfbcb('0x27')];}_0x36f945['status'](_0x15eb91)[_0xfbcb('0x28')](_0x27cdb2);};}exports[_0xfbcb('0x29')]=function(_0x7154d6,_0x514a2b){var _0x3a13fd={},_0x115afa={},_0x26f637={'count':0x0,'rows':[]};var _0x317eb5=_[_0xfbcb('0x2a')](db['SquareDetailsReport'][_0xfbcb('0x2b')],function(_0x1ea1f6){return{'name':_0x1ea1f6[_0xfbcb('0x2c')],'type':_0x1ea1f6[_0xfbcb('0x2d')][_0xfbcb('0x2e')]};});_0x115afa[_0xfbcb('0x2f')]=_[_0xfbcb('0x2a')](_0x317eb5,_0xfbcb('0x27'));_0x115afa[_0xfbcb('0x30')]=_['keys'](_0x7154d6['query']);_0x115afa['filters']=_[_0xfbcb('0x31')](_0x115afa['model'],_0x115afa[_0xfbcb('0x30')]);_0x3a13fd['attributes']=_[_0xfbcb('0x31')](_0x115afa[_0xfbcb('0x2f')],qs[_0xfbcb('0x32')](_0x7154d6[_0xfbcb('0x30')]['fields']));_0x3a13fd[_0xfbcb('0x33')]=_0x3a13fd[_0xfbcb('0x33')][_0xfbcb('0x34')]?_0x3a13fd[_0xfbcb('0x33')]:_0x115afa[_0xfbcb('0x2f')];if(!_0x7154d6[_0xfbcb('0x30')][_0xfbcb('0x35')]('nolimit')){_0x3a13fd['limit']=qs[_0xfbcb('0x1f')](_0x7154d6[_0xfbcb('0x30')][_0xfbcb('0x1f')]);_0x3a13fd['offset']=qs[_0xfbcb('0x1e')](_0x7154d6[_0xfbcb('0x30')]['offset']);}_0x3a13fd['order']=qs[_0xfbcb('0x36')](_0x7154d6[_0xfbcb('0x30')][_0xfbcb('0x36')]);_0x3a13fd[_0xfbcb('0x37')]=qs[_0xfbcb('0x38')](_[_0xfbcb('0x39')](_0x7154d6[_0xfbcb('0x30')],_0x115afa['filters']));if(_0x7154d6[_0xfbcb('0x30')][_0xfbcb('0x3a')]){_0x3a13fd[_0xfbcb('0x37')]=_[_0xfbcb('0x3b')](_0x3a13fd[_0xfbcb('0x37')],{'$or':_[_0xfbcb('0x2a')](_0x317eb5,function(_0x4cf5fe){if(_0x4cf5fe[_0xfbcb('0x2d')]!==_0xfbcb('0x3c')){var _0x7ac19c={};_0x7ac19c[_0x4cf5fe[_0xfbcb('0x27')]]={'$like':'%'+_0x7154d6['query'][_0xfbcb('0x3a')]+'%'};return _0x7ac19c;}})});}_0x3a13fd=_[_0xfbcb('0x3b')]({},_0x3a13fd,_0x7154d6[_0xfbcb('0x3d')]);var _0x2792af={'where':_0x3a13fd['where']};return db[_0xfbcb('0x3e')]['count'](_0x2792af)[_0xfbcb('0x24')](function(_0x415573){_0x26f637[_0xfbcb('0x1d')]=_0x415573;if(_0x7154d6[_0xfbcb('0x30')]['includeAll']){_0x3a13fd[_0xfbcb('0x3f')]=[{'all':!![]}];}return db[_0xfbcb('0x3e')]['findAll'](_0x3a13fd);})[_0xfbcb('0x24')](function(_0xa8dee5){_0x26f637['rows']=_0xa8dee5;return _0x26f637;})['then'](respondWithFilteredResult(_0x514a2b,_0x3a13fd))[_0xfbcb('0x40')](handleError(_0x514a2b,null));};exports[_0xfbcb('0x41')]=function(_0x23732b,_0x23ad48){var _0x5fe3dc={'raw':!![],'where':{'id':_0x23732b['params']['id']}},_0x29e690={};_0x29e690['model']=_[_0xfbcb('0x42')](db['SquareDetailsReport']['rawAttributes']);_0x29e690[_0xfbcb('0x30')]=_[_0xfbcb('0x42')](_0x23732b[_0xfbcb('0x30')]);_0x29e690['filters']=_['intersection'](_0x29e690['model'],_0x29e690['query']);_0x5fe3dc[_0xfbcb('0x33')]=_[_0xfbcb('0x31')](_0x29e690[_0xfbcb('0x2f')],qs['fields'](_0x23732b[_0xfbcb('0x30')][_0xfbcb('0x32')]));_0x5fe3dc[_0xfbcb('0x33')]=_0x5fe3dc['attributes'][_0xfbcb('0x34')]?_0x5fe3dc[_0xfbcb('0x33')]:_0x29e690['model'];if(_0x23732b[_0xfbcb('0x30')][_0xfbcb('0x43')]){_0x5fe3dc[_0xfbcb('0x3f')]=[{'all':!![]}];}_0x5fe3dc=_['merge']({},_0x5fe3dc,_0x23732b[_0xfbcb('0x3d')]);return db[_0xfbcb('0x3e')][_0xfbcb('0x44')](_0x5fe3dc)[_0xfbcb('0x24')](handleEntityNotFound(_0x23ad48,null))[_0xfbcb('0x24')](respondWithResult(_0x23ad48,null))[_0xfbcb('0x40')](handleError(_0x23ad48,null));};exports[_0xfbcb('0x45')]=function(_0x135c98,_0x140fb8){return db[_0xfbcb('0x3e')][_0xfbcb('0x45')](_0x135c98[_0xfbcb('0x46')],{})[_0xfbcb('0x24')](respondWithResult(_0x140fb8,0xc9))[_0xfbcb('0x40')](handleError(_0x140fb8,null));};exports[_0xfbcb('0x23')]=function(_0x59761c,_0x3a2700){if(_0x59761c['body']['id']){delete _0x59761c[_0xfbcb('0x46')]['id'];}return db[_0xfbcb('0x3e')]['find']({'where':{'id':_0x59761c[_0xfbcb('0x47')]['id']}})[_0xfbcb('0x24')](handleEntityNotFound(_0x3a2700,null))['then'](saveUpdates(_0x59761c[_0xfbcb('0x46')],null))[_0xfbcb('0x24')](respondWithResult(_0x3a2700,null))[_0xfbcb('0x40')](handleError(_0x3a2700,null));};exports['destroy']=function(_0xb39302,_0x4f70b4){return db[_0xfbcb('0x3e')][_0xfbcb('0x44')]({'where':{'id':_0xb39302[_0xfbcb('0x47')]['id']}})['then'](handleEntityNotFound(_0x4f70b4,null))[_0xfbcb('0x24')](removeEntity(_0x4f70b4,null))['catch'](handleError(_0x4f70b4,null));};exports[_0xfbcb('0x48')]=function(_0x4e5b8e,_0x3c345c){return db[_0xfbcb('0x3e')][_0xfbcb('0x48')]()['then'](respondWithResult(_0x3c345c,null))[_0xfbcb('0x40')](handleError(_0x3c345c,null));}; \ No newline at end of file +var _0xdea7=['type','key','map','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','apply','then','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName'];(function(_0xe92e06,_0x394ae7){var _0x387ae3=function(_0x5cd616){while(--_0x5cd616){_0xe92e06['push'](_0xe92e06['shift']());}};_0x387ae3(++_0x394ae7);}(_0xdea7,0x1d6));var _0x7dea=function(_0x3f483a,_0x276424){_0x3f483a=_0x3f483a-0x0;var _0x5caa01=_0xdea7[_0x3f483a];return _0x5caa01;};'use strict';var pdf=require(_0x7dea('0x0'));var emlformat=require(_0x7dea('0x1'));var rimraf=require(_0x7dea('0x2'));var zipdir=require(_0x7dea('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7dea('0x4'));var BPromise=require(_0x7dea('0x5'));var Mustache=require(_0x7dea('0x6'));var util=require(_0x7dea('0x7'));var path=require('path');var sox=require(_0x7dea('0x8'));var csv=require(_0x7dea('0x9'));var ejs=require(_0x7dea('0xa'));var fs=require('fs');var _=require(_0x7dea('0xb'));var squel=require(_0x7dea('0xc'));var crypto=require(_0x7dea('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7dea('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7dea('0xf'));var Papa=require(_0x7dea('0x10'));var Redis=require(_0x7dea('0x11'));var authService=require(_0x7dea('0x12'));var qs=require(_0x7dea('0x13'));var as=require(_0x7dea('0x14'));var hardwareService=require(_0x7dea('0x15'));var logger=require(_0x7dea('0x16'))(_0x7dea('0x17'));var utils=require(_0x7dea('0x18'));var config=require(_0x7dea('0x19'));var db=require(_0x7dea('0x1a'))['db'];function respondWithStatusCode(_0x4f575b,_0x379a7a){_0x379a7a=_0x379a7a||0xcc;return function(_0x1efd2a){if(_0x1efd2a){return _0x4f575b[_0x7dea('0x1b')](_0x379a7a);}return _0x4f575b[_0x7dea('0x1c')](_0x379a7a)['end']();};}function respondWithResult(_0x49d014,_0x3b8e00){_0x3b8e00=_0x3b8e00||0xc8;return function(_0x4b1267){if(_0x4b1267){return _0x49d014[_0x7dea('0x1c')](_0x3b8e00)[_0x7dea('0x1d')](_0x4b1267);}};}function respondWithFilteredResult(_0x545cb6,_0x5f4d63){return function(_0x53ec0e){if(_0x53ec0e){var _0x5abb3e=_0x53ec0e[_0x7dea('0x1e')],_0x2f021e=_0x5f4d63[_0x7dea('0x1f')],_0x522f6e=_0x5f4d63[_0x7dea('0x1f')]+_0x5f4d63['limit'],_0x32b02e;if(_0x522f6e>=_0x5abb3e){_0x522f6e=_0x5abb3e;_0x32b02e=0xc8;}else{_0x32b02e=0xce;}_0x545cb6[_0x7dea('0x1c')](_0x32b02e);return _0x545cb6['set']('Content-Range',_0x2f021e+'-'+_0x522f6e+'/'+_0x5abb3e)['json'](_0x53ec0e);}return null;};}function patchUpdates(_0x4a3679){return function(_0x168984){try{jsonpatch[_0x7dea('0x20')](_0x168984,_0x4a3679,!![]);}catch(_0x385c5e){return BPromise['reject'](_0x385c5e);}return _0x168984['save']();};}function saveUpdates(_0x7231ff,_0x51784f){return function(_0x56b961){if(_0x56b961){return _0x56b961['update'](_0x7231ff)[_0x7dea('0x21')](function(_0x4a8766){return _0x4a8766;});}return null;};}function removeEntity(_0x320b8c,_0x22f55f){return function(_0x5762ea){if(_0x5762ea){return _0x5762ea['destroy']()[_0x7dea('0x21')](function(){_0x320b8c[_0x7dea('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaed92,_0x2f2f95){return function(_0x570375){if(!_0x570375){_0xaed92[_0x7dea('0x1b')](0x194);}return _0x570375;};}function handleError(_0x34b88b,_0xaba68a){_0xaba68a=_0xaba68a||0x1f4;return function(_0x4fd961){logger['error'](_0x4fd961[_0x7dea('0x22')]);if(_0x4fd961[_0x7dea('0x23')]){delete _0x4fd961[_0x7dea('0x23')];}_0x34b88b[_0x7dea('0x1c')](_0xaba68a)[_0x7dea('0x24')](_0x4fd961);};}exports[_0x7dea('0x25')]=function(_0x15fb4b,_0x6b3014){var _0x33d994={},_0xfbeee9={},_0x26b0fd={'count':0x0,'rows':[]};var _0x4caaa9=_['map'](db[_0x7dea('0x26')][_0x7dea('0x27')],function(_0x510cb6){return{'name':_0x510cb6[_0x7dea('0x28')],'type':_0x510cb6[_0x7dea('0x29')][_0x7dea('0x2a')]};});_0xfbeee9['model']=_[_0x7dea('0x2b')](_0x4caaa9,_0x7dea('0x23'));_0xfbeee9[_0x7dea('0x2c')]=_[_0x7dea('0x2d')](_0x15fb4b[_0x7dea('0x2c')]);_0xfbeee9[_0x7dea('0x2e')]=_[_0x7dea('0x2f')](_0xfbeee9[_0x7dea('0x30')],_0xfbeee9[_0x7dea('0x2c')]);_0x33d994['attributes']=_[_0x7dea('0x2f')](_0xfbeee9[_0x7dea('0x30')],qs[_0x7dea('0x31')](_0x15fb4b[_0x7dea('0x2c')]['fields']));_0x33d994['attributes']=_0x33d994[_0x7dea('0x32')]['length']?_0x33d994[_0x7dea('0x32')]:_0xfbeee9[_0x7dea('0x30')];if(!_0x15fb4b[_0x7dea('0x2c')][_0x7dea('0x33')]('nolimit')){_0x33d994[_0x7dea('0x34')]=qs[_0x7dea('0x34')](_0x15fb4b[_0x7dea('0x2c')][_0x7dea('0x34')]);_0x33d994[_0x7dea('0x1f')]=qs[_0x7dea('0x1f')](_0x15fb4b['query'][_0x7dea('0x1f')]);}_0x33d994[_0x7dea('0x35')]=qs[_0x7dea('0x36')](_0x15fb4b[_0x7dea('0x2c')]['sort']);_0x33d994['where']=qs[_0x7dea('0x2e')](_[_0x7dea('0x37')](_0x15fb4b[_0x7dea('0x2c')],_0xfbeee9[_0x7dea('0x2e')]));if(_0x15fb4b[_0x7dea('0x2c')][_0x7dea('0x38')]){_0x33d994[_0x7dea('0x39')]=_['merge'](_0x33d994[_0x7dea('0x39')],{'$or':_['map'](_0x4caaa9,function(_0x1d0760){if(_0x1d0760[_0x7dea('0x29')]!==_0x7dea('0x3a')){var _0x11aa94={};_0x11aa94[_0x1d0760[_0x7dea('0x23')]]={'$like':'%'+_0x15fb4b['query'][_0x7dea('0x38')]+'%'};return _0x11aa94;}})});}_0x33d994=_[_0x7dea('0x3b')]({},_0x33d994,_0x15fb4b[_0x7dea('0x3c')]);var _0x292567={'where':_0x33d994[_0x7dea('0x39')]};return db[_0x7dea('0x26')][_0x7dea('0x1e')](_0x292567)[_0x7dea('0x21')](function(_0x2497db){_0x26b0fd['count']=_0x2497db;if(_0x15fb4b['query'][_0x7dea('0x3d')]){_0x33d994[_0x7dea('0x3e')]=[{'all':!![]}];}return db[_0x7dea('0x26')]['findAll'](_0x33d994);})[_0x7dea('0x21')](function(_0xf9c9d7){_0x26b0fd[_0x7dea('0x3f')]=_0xf9c9d7;return _0x26b0fd;})['then'](respondWithFilteredResult(_0x6b3014,_0x33d994))[_0x7dea('0x40')](handleError(_0x6b3014,null));};exports[_0x7dea('0x41')]=function(_0x3b31c8,_0x391183){var _0x31c77f={'raw':!![],'where':{'id':_0x3b31c8[_0x7dea('0x42')]['id']}},_0x324b9f={};_0x324b9f['model']=_['keys'](db[_0x7dea('0x26')][_0x7dea('0x27')]);_0x324b9f[_0x7dea('0x2c')]=_[_0x7dea('0x2d')](_0x3b31c8[_0x7dea('0x2c')]);_0x324b9f[_0x7dea('0x2e')]=_[_0x7dea('0x2f')](_0x324b9f[_0x7dea('0x30')],_0x324b9f['query']);_0x31c77f[_0x7dea('0x32')]=_[_0x7dea('0x2f')](_0x324b9f[_0x7dea('0x30')],qs['fields'](_0x3b31c8[_0x7dea('0x2c')][_0x7dea('0x31')]));_0x31c77f[_0x7dea('0x32')]=_0x31c77f[_0x7dea('0x32')][_0x7dea('0x43')]?_0x31c77f['attributes']:_0x324b9f[_0x7dea('0x30')];if(_0x3b31c8['query']['includeAll']){_0x31c77f[_0x7dea('0x3e')]=[{'all':!![]}];}_0x31c77f=_['merge']({},_0x31c77f,_0x3b31c8[_0x7dea('0x3c')]);return db['SquareDetailsReport'][_0x7dea('0x44')](_0x31c77f)[_0x7dea('0x21')](handleEntityNotFound(_0x391183,null))[_0x7dea('0x21')](respondWithResult(_0x391183,null))['catch'](handleError(_0x391183,null));};exports[_0x7dea('0x45')]=function(_0x1d4e96,_0x381d0e){return db[_0x7dea('0x26')][_0x7dea('0x45')](_0x1d4e96[_0x7dea('0x46')],{})[_0x7dea('0x21')](respondWithResult(_0x381d0e,0xc9))[_0x7dea('0x40')](handleError(_0x381d0e,null));};exports[_0x7dea('0x47')]=function(_0x34fd0c,_0x549a13){if(_0x34fd0c[_0x7dea('0x46')]['id']){delete _0x34fd0c['body']['id'];}return db['SquareDetailsReport'][_0x7dea('0x44')]({'where':{'id':_0x34fd0c[_0x7dea('0x42')]['id']}})['then'](handleEntityNotFound(_0x549a13,null))[_0x7dea('0x21')](saveUpdates(_0x34fd0c[_0x7dea('0x46')],null))[_0x7dea('0x21')](respondWithResult(_0x549a13,null))[_0x7dea('0x40')](handleError(_0x549a13,null));};exports['destroy']=function(_0x3dd5d7,_0xba29ff){return db['SquareDetailsReport'][_0x7dea('0x44')]({'where':{'id':_0x3dd5d7[_0x7dea('0x42')]['id']}})[_0x7dea('0x21')](handleEntityNotFound(_0xba29ff,null))[_0x7dea('0x21')](removeEntity(_0xba29ff,null))[_0x7dea('0x40')](handleError(_0xba29ff,null));};exports[_0x7dea('0x48')]=function(_0x4b08e9,_0x3e8e9b){return db[_0x7dea('0x26')][_0x7dea('0x48')]()[_0x7dea('0x21')](respondWithResult(_0x3e8e9b,null))[_0x7dea('0x40')](handleError(_0x3e8e9b,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 11967a6..ee4709d 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 _0x39c8=['../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x53c148,_0x5b5327){var _0x59377d=function(_0xda2130){while(--_0xda2130){_0x53c148['push'](_0x53c148['shift']());}};_0x59377d(++_0x5b5327);}(_0x39c8,0xe9));var _0x839c=function(_0x108d5f,_0x33f82d){_0x108d5f=_0x108d5f-0x0;var _0x456ea3=_0x39c8[_0x108d5f];return _0x456ea3;};'use strict';var _=require(_0x839c('0x0'));var util=require('util');var logger=require(_0x839c('0x1'))(_0x839c('0x2'));var moment=require(_0x839c('0x3'));var BPromise=require('bluebird');var rp=require(_0x839c('0x4'));var fs=require('fs');var path=require(_0x839c('0x5'));var rimraf=require(_0x839c('0x6'));var config=require(_0x839c('0x7'));var attributes=require(_0x839c('0x8'));module[_0x839c('0x9')]=function(_0x17c0c0,_0xdc71e2){return _0x17c0c0[_0x839c('0xa')](_0x839c('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4be7=['./squareReportDetail.attributes','exports','define','SquareDetailsReport','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x11c644,_0x3f9572){var _0x4b856e=function(_0x34a1e7){while(--_0x34a1e7){_0x11c644['push'](_0x11c644['shift']());}};_0x4b856e(++_0x3f9572);}(_0x4be7,0x93));var _0x74be=function(_0x18b931,_0x2cad1d){_0x18b931=_0x18b931-0x0;var _0x114958=_0x4be7[_0x18b931];return _0x114958;};'use strict';var _=require('lodash');var util=require(_0x74be('0x0'));var logger=require('../../config/logger')(_0x74be('0x1'));var moment=require('moment');var BPromise=require(_0x74be('0x2'));var rp=require(_0x74be('0x3'));var fs=require('fs');var path=require(_0x74be('0x4'));var rimraf=require(_0x74be('0x5'));var config=require(_0x74be('0x6'));var attributes=require(_0x74be('0x7'));module[_0x74be('0x8')]=function(_0x178f9e,_0x47555e){return _0x178f9e[_0x74be('0x9')](_0x74be('0xa'),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 aa6a32a..29ddbb6 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 _0xc925=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','SquareDetailsReport','create','body','options','raw','then','CreateSquareDetailsReport','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xcf935c,_0x26b1ab){var _0x37aeea=function(_0x40eaa5){while(--_0x40eaa5){_0xcf935c['push'](_0xcf935c['shift']());}};_0x37aeea(++_0x26b1ab);}(_0xc925,0x8f));var _0x5c92=function(_0x1732d2,_0x21a1cd){_0x1732d2=_0x1732d2-0x0;var _0x127a9e=_0xc925[_0x1732d2];return _0x127a9e;};'use strict';var _=require(_0x5c92('0x0'));var util=require(_0x5c92('0x1'));var moment=require(_0x5c92('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c92('0x3'));var fs=require('fs');var Redis=require(_0x5c92('0x4'));var db=require(_0x5c92('0x5'))['db'];var utils=require(_0x5c92('0x6'));var logger=require(_0x5c92('0x7'))(_0x5c92('0x8'));var config=require(_0x5c92('0x9'));var jayson=require(_0x5c92('0xa'));var client=jayson[_0x5c92('0xb')][_0x5c92('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x530310,_0x4bb72b,_0x55f9de){return new BPromise(function(_0x1ba2f4,_0x40f45b){return client['request'](_0x530310,_0x55f9de)['then'](function(_0x72a672){logger[_0x5c92('0xd')](_0x5c92('0xe'),_0x4bb72b,'request\x20sent');logger['debug'](_0x5c92('0xf'),_0x4bb72b,'request\x20sent',JSON[_0x5c92('0x10')](_0x72a672));if(_0x72a672[_0x5c92('0x11')]){if(_0x72a672['error'][_0x5c92('0x12')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4bb72b,_0x72a672[_0x5c92('0x11')]['message']);return _0x40f45b(_0x72a672[_0x5c92('0x11')]['message']);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x4bb72b,_0x72a672['error'][_0x5c92('0x13')]);return _0x1ba2f4(_0x72a672[_0x5c92('0x11')]['message']);}else{logger[_0x5c92('0xd')](_0x5c92('0xe'),_0x4bb72b,_0x5c92('0x14'));_0x1ba2f4(_0x72a672[_0x5c92('0x15')]['message']);}})['catch'](function(_0x8cf976){logger[_0x5c92('0x11')](_0x5c92('0xe'),_0x4bb72b,_0x8cf976);_0x40f45b(_0x8cf976);});});}exports['CreateSquareDetailsReport']=function(_0x4b2fcf){var _0x54dc6d=this;return new Promise(function(_0x504c5f,_0x509239){return db[_0x5c92('0x16')][_0x5c92('0x17')](_0x4b2fcf[_0x5c92('0x18')],{'raw':_0x4b2fcf[_0x5c92('0x19')]?_0x4b2fcf['options'][_0x5c92('0x1a')]===undefined?!![]:![]:!![]})[_0x5c92('0x1b')](function(_0x2bf04e){logger[_0x5c92('0xd')]('CreateSquareDetailsReport',_0x4b2fcf);logger['debug'](_0x5c92('0x1c'),_0x4b2fcf,JSON[_0x5c92('0x10')](_0x2bf04e));_0x504c5f(_0x2bf04e);})[_0x5c92('0x1d')](function(_0x5105d0){logger[_0x5c92('0x11')](_0x5c92('0x1c'),_0x5105d0[_0x5c92('0x13')],_0x4b2fcf);_0x509239(_0x54dc6d[_0x5c92('0x11')](0x1f4,_0x5105d0[_0x5c92('0x13')]));});});}; \ No newline at end of file +var _0x563d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','SquareDetailsReport,\x20%s,\x20%s','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','body','options','raw','then','stringify','catch','lodash','moment'];(function(_0xf29840,_0x5071a6){var _0x1c5935=function(_0xe902b7){while(--_0xe902b7){_0xf29840['push'](_0xf29840['shift']());}};_0x1c5935(++_0x5071a6);}(_0x563d,0x178));var _0xd563=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x563d[_0x30033a];return _0x5e3518;};'use strict';var _=require(_0xd563('0x0'));var util=require('util');var moment=require(_0xd563('0x1'));var BPromise=require('bluebird');var rs=require(_0xd563('0x2'));var fs=require('fs');var Redis=require(_0xd563('0x3'));var db=require(_0xd563('0x4'))['db'];var utils=require(_0xd563('0x5'));var logger=require(_0xd563('0x6'))('rpc');var config=require(_0xd563('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd563('0x8')][_0xd563('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x568947,_0x29c4d9,_0x4c78d4){return new BPromise(function(_0x514c39,_0x444e7b){return client['request'](_0x568947,_0x4c78d4)['then'](function(_0x492316){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x29c4d9,_0xd563('0xa'));logger[_0xd563('0xb')](_0xd563('0xc'),_0x29c4d9,_0xd563('0xa'),JSON['stringify'](_0x492316));if(_0x492316[_0xd563('0xd')]){if(_0x492316[_0xd563('0xd')][_0xd563('0xe')]===0x1f4){logger['error'](_0xd563('0xf'),_0x29c4d9,_0x492316['error'][_0xd563('0x10')]);return _0x444e7b(_0x492316[_0xd563('0xd')][_0xd563('0x10')]);}logger[_0xd563('0xd')](_0xd563('0xf'),_0x29c4d9,_0x492316[_0xd563('0xd')]['message']);return _0x514c39(_0x492316['error'][_0xd563('0x10')]);}else{logger[_0xd563('0x11')](_0xd563('0xf'),_0x29c4d9,_0xd563('0xa'));_0x514c39(_0x492316[_0xd563('0x12')][_0xd563('0x10')]);}})['catch'](function(_0x5e4318){logger[_0xd563('0xd')](_0xd563('0xf'),_0x29c4d9,_0x5e4318);_0x444e7b(_0x5e4318);});});}exports[_0xd563('0x13')]=function(_0x35adf5){var _0x10b8b=this;return new Promise(function(_0x144439,_0x438396){return db[_0xd563('0x14')]['create'](_0x35adf5[_0xd563('0x15')],{'raw':_0x35adf5[_0xd563('0x16')]?_0x35adf5[_0xd563('0x16')][_0xd563('0x17')]===undefined?!![]:![]:!![]})[_0xd563('0x18')](function(_0x44bea8){logger[_0xd563('0x11')](_0xd563('0x13'),_0x35adf5);logger['debug'](_0xd563('0x13'),_0x35adf5,JSON[_0xd563('0x19')](_0x44bea8));_0x144439(_0x44bea8);})[_0xd563('0x1a')](function(_0x4115dc){logger[_0xd563('0xd')](_0xd563('0x13'),_0x4115dc['message'],_0x35adf5);_0x438396(_0x10b8b['error'](0x1f4,_0x4115dc[_0xd563('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 7a5be35..ea24831 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 _0xec81=['/process/:pid/kill','killProcess','exports','express','Router','../../components/auth/service','./system.controller','isAuthenticated','index'];(function(_0x3314d1,_0xe55a96){var _0x3d0acb=function(_0x2aa5b9){while(--_0x2aa5b9){_0x3314d1['push'](_0x3314d1['shift']());}};_0x3d0acb(++_0xe55a96);}(_0xec81,0xf6));var _0x1ec8=function(_0x537fff,_0x1a3cdc){_0x537fff=_0x537fff-0x0;var _0x34889b=_0xec81[_0x537fff];return _0x34889b;};'use strict';var express=require(_0x1ec8('0x0'));var router=express[_0x1ec8('0x1')]();var auth=require(_0x1ec8('0x2'));var controller=require(_0x1ec8('0x3'));router['get']('/',auth[_0x1ec8('0x4')](),controller[_0x1ec8('0x5')]);router['get'](_0x1ec8('0x6'),auth['isAuthenticated'](),controller[_0x1ec8('0x7')]);module[_0x1ec8('0x8')]=router; \ No newline at end of file +var _0xe426=['isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','../../components/auth/service','./system.controller','get'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0xe426,0xf8));var _0x6e42=function(_0x312efb,_0x1b5af2){_0x312efb=_0x312efb-0x0;var _0x491c34=_0xe426[_0x312efb];return _0x491c34;};'use strict';var express=require(_0x6e42('0x0'));var router=express['Router']();var auth=require(_0x6e42('0x1'));var controller=require(_0x6e42('0x2'));router[_0x6e42('0x3')]('/',auth[_0x6e42('0x4')](),controller[_0x6e42('0x5')]);router['get'](_0x6e42('0x6'),auth[_0x6e42('0x4')](),controller[_0x6e42('0x7')]);module[_0x6e42('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 1e2e68a..c27a9e3 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 _0xeb33=['systeminformation','child_process','exec','api','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status','send','index','then','json','catch','components/import/cm','format','Process\x20with\x20pid\x20%s\x20not\x20found!','params','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess'];(function(_0x3c1501,_0x463ab9){var _0x505ef2=function(_0x54dd37){while(--_0x54dd37){_0x3c1501['push'](_0x3c1501['shift']());}};_0x505ef2(++_0x463ab9);}(_0xeb33,0xf0));var _0x3eb3=function(_0x5ab1f7,_0x2af4e7){_0x5ab1f7=_0x5ab1f7-0x0;var _0x5b3d88=_0xeb33[_0x5ab1f7];return _0x5b3d88;};'use strict';var info=require(_0x3eb3('0x0'));var exec=require(_0x3eb3('0x1'))[_0x3eb3('0x2')];var logger=require('../../config/logger')(_0x3eb3('0x3'));var util=require('util');var BPromise=require('bluebird');var _=require('lodash');function handleError(_0x308b10,_0x176657,_0x39f1f8){_0x176657=_0x176657||0x1f4;return function(_0x2c4337){logger['error'](_0x3eb3('0x4'),_0x39f1f8,_0x176657,util[_0x3eb3('0x5')](_0x2c4337,{'showHidden':![],'depth':null}));delete _0x2c4337['name'];_0x308b10[_0x3eb3('0x6')](_0x176657)[_0x3eb3('0x7')](_0x2c4337);};}exports[_0x3eb3('0x8')]=function(_0x34bbe1,_0x4757cd){return info['getAllData']()[_0x3eb3('0x9')](function(_0x50d9cc){return _0x4757cd['status'](0xc8)[_0x3eb3('0xa')](_0x50d9cc);})[_0x3eb3('0xb')](function(_0x46e17a){return _0x4757cd[_0x3eb3('0x6')](0x1f4)[_0x3eb3('0xa')](_0x46e17a);});};exports['killProcess']=function(_0x26c487,_0x378c47){var _0x595d7d=[_0x3eb3('0xc')];return new BPromise(function(_0x4a9cd0,_0x9a2183){return exec(util['format']('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x26c487['params']['pid']),function(_0x58a865,_0x4f0a5f,_0x3ae484){if(_0x58a865){return _0x9a2183(_0x58a865);}return _0x4a9cd0(_0x4f0a5f);});})['then'](function(_0x1e7375){var _0xca4ed5=![];var _0x12aeab=_0x1e7375['split'](/\n/);for(var _0xa96ea5=0x0,_0x44362f=_0x595d7d['length'];_0xa96ea5<_0x44362f,_0xca4ed5===![];_0xa96ea5+=0x1){if(_0x1e7375['indexOf'](_0x595d7d[_0xa96ea5])>=0x0){_0xca4ed5=!![];}}if(!_0xca4ed5){throw new Error(util[_0x3eb3('0xd')](_0x3eb3('0xe'),_0x26c487[_0x3eb3('0xf')][_0x3eb3('0x10')]));}process['kill'](_0x26c487['params'][_0x3eb3('0x10')],_0x3eb3('0x11'));return _0x378c47[_0x3eb3('0x6')](0xc8)[_0x3eb3('0xa')]({'message':util['format'](_0x3eb3('0x12'),_0x26c487[_0x3eb3('0xf')]['pid'])});})[_0x3eb3('0xb')](handleError(_0x378c47,null,_0x3eb3('0x13')));}; \ No newline at end of file +var _0x187d=['SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill'];(function(_0x1001c6,_0x5dcba0){var _0x197ae0=function(_0x193a17){while(--_0x193a17){_0x1001c6['push'](_0x1001c6['shift']());}};_0x197ae0(++_0x5dcba0);}(_0x187d,0x93));var _0xd187=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x187d[_0x42245d];return _0x4b211a;};'use strict';var info=require(_0xd187('0x0'));var exec=require('child_process')[_0xd187('0x1')];var logger=require(_0xd187('0x2'))(_0xd187('0x3'));var util=require(_0xd187('0x4'));var BPromise=require(_0xd187('0x5'));var _=require(_0xd187('0x6'));function handleError(_0x58622a,_0x28fa0b,_0x163807){_0x28fa0b=_0x28fa0b||0x1f4;return function(_0x4ebc8d){logger[_0xd187('0x7')](_0xd187('0x8'),_0x163807,_0x28fa0b,util[_0xd187('0x9')](_0x4ebc8d,{'showHidden':![],'depth':null}));delete _0x4ebc8d[_0xd187('0xa')];_0x58622a[_0xd187('0xb')](_0x28fa0b)[_0xd187('0xc')](_0x4ebc8d);};}exports[_0xd187('0xd')]=function(_0x461a44,_0x5b480f){return info[_0xd187('0xe')]()[_0xd187('0xf')](function(_0x4039f6){return _0x5b480f[_0xd187('0xb')](0xc8)[_0xd187('0x10')](_0x4039f6);})[_0xd187('0x11')](function(_0x59c194){return _0x5b480f[_0xd187('0xb')](0x1f4)[_0xd187('0x10')](_0x59c194);});};exports[_0xd187('0x12')]=function(_0x5e6180,_0x37e80c){var _0x4545cf=[_0xd187('0x13')];return new BPromise(function(_0x59ee4a,_0x33e3d5){return exec(util[_0xd187('0x14')](_0xd187('0x15'),_0x5e6180[_0xd187('0x16')]['pid']),function(_0x39a927,_0x2050d5,_0x45ab10){if(_0x39a927){return _0x33e3d5(_0x39a927);}return _0x59ee4a(_0x2050d5);});})[_0xd187('0xf')](function(_0x4c8f68){var _0x245d3e=![];var _0x52a208=_0x4c8f68['split'](/\n/);for(var _0x40ed84=0x0,_0x5a4986=_0x4545cf['length'];_0x40ed84<_0x5a4986,_0x245d3e===![];_0x40ed84+=0x1){if(_0x4c8f68[_0xd187('0x17')](_0x4545cf[_0x40ed84])>=0x0){_0x245d3e=!![];}}if(!_0x245d3e){throw new Error(util[_0xd187('0x14')](_0xd187('0x18'),_0x5e6180[_0xd187('0x16')][_0xd187('0x19')]));}process[_0xd187('0x1a')](_0x5e6180[_0xd187('0x16')][_0xd187('0x19')],_0xd187('0x1b'));return _0x37e80c[_0xd187('0xb')](0xc8)[_0xd187('0x10')]({'message':util[_0xd187('0x14')](_0xd187('0x1c'),_0x5e6180['params'][_0xd187('0x19')])});})[_0xd187('0x11')](handleError(_0x37e80c,null,_0xd187('0x12')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index c6f0091..6444276 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 _0xbec5=['isAuthenticated','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./tag.controller','get'];(function(_0x356d91,_0x44a09e){var _0x415722=function(_0x329d47){while(--_0x329d47){_0x356d91['push'](_0x356d91['shift']());}};_0x415722(++_0x44a09e);}(_0xbec5,0xe5));var _0x5bec=function(_0x54edc9,_0x345f01){_0x54edc9=_0x54edc9-0x0;var _0x2ae7a9=_0xbec5[_0x54edc9];return _0x2ae7a9;};'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('0xc')]('/',auth[_0x5bec('0x9')](),controller[_0x5bec('0xd')]);router[_0x5bec('0xe')]('/:id',auth[_0x5bec('0x9')](),controller['update']);router[_0x5bec('0xf')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller['destroy']);module[_0x5bec('0x10')]=router; \ No newline at end of file +var _0xbdb7=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','post','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x586956,_0x3265a6){var _0x1f53a8=function(_0x425b4f){while(--_0x425b4f){_0x586956['push'](_0x586956['shift']());}};_0x1f53a8(++_0x3265a6);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5acb94,_0x389dbc){_0x5acb94=_0x5acb94-0x0;var _0x11800a=_0xbdb7[_0x5acb94];return _0x11800a;};'use strict';var multer=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var path=require(_0x7bdb('0x2'));var timeout=require(_0x7bdb('0x3'));var express=require(_0x7bdb('0x4'));var router=express[_0x7bdb('0x5')]();var auth=require(_0x7bdb('0x6'));var interaction=require(_0x7bdb('0x7'));var config=require(_0x7bdb('0x8'));var controller=require('./tag.controller');router[_0x7bdb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bdb('0x9')](_0x7bdb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7bdb('0xb')]('/',auth[_0x7bdb('0xc')](),controller['create']);router['put'](_0x7bdb('0xa'),auth[_0x7bdb('0xc')](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xe')](_0x7bdb('0xa'),auth[_0x7bdb('0xc')](),controller[_0x7bdb('0xf')]);module[_0x7bdb('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 03d41d8..659c5e7 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 _0xbdb7=['name','#0091EA','sequelize','exports','STRING'];(function(_0x45b7e1,_0xa481cb){var _0x328dd2=function(_0x117824){while(--_0x117824){_0x45b7e1['push'](_0x45b7e1['shift']());}};_0x328dd2(++_0xa481cb);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4ca89a,_0x33ffb8){_0x4ca89a=_0x4ca89a-0x0;var _0xfeb04d=_0xbdb7[_0x4ca89a];return _0xfeb04d;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'name':{'type':Sequelize[_0x7bdb('0x2')],'unique':_0x7bdb('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7bdb('0x2')],'defaultValue':_0x7bdb('0x4')},'description':{'type':Sequelize[_0x7bdb('0x2')]}}; \ No newline at end of file +var _0x5c00=['STRING','sequelize','exports'];(function(_0x14c2d3,_0x156730){var _0x29c8d7=function(_0x43e5e0){while(--_0x43e5e0){_0x14c2d3['push'](_0x14c2d3['shift']());}};_0x29c8d7(++_0x156730);}(_0x5c00,0x17e));var _0x05c0=function(_0x15214b,_0x3a7ebd){_0x15214b=_0x15214b-0x0;var _0xe42e19=_0x5c00[_0x15214b];return _0xe42e19;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'name':{'type':Sequelize[_0x05c0('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x05c0('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x05c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index eccab8b..8b0e81d 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 _0xb924=['key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','intersection','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','error','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','count','offset','limit','status','set','Content-Range','apply','save','destroy','then','get','Tags','UserProfileResource','stack','name','send','map','Tag','rawAttributes','fieldName','type'];(function(_0x2d66fd,_0x3c9415){var _0x322f24=function(_0x3aa4cc){while(--_0x3aa4cc){_0x2d66fd['push'](_0x2d66fd['shift']());}};_0x322f24(++_0x3c9415);}(_0xb924,0xbd));var _0x4b92=function(_0x403c65,_0x5d56ac){_0x403c65=_0x403c65-0x0;var _0x5f579e=_0xb924[_0x403c65];return _0x5f579e;};'use strict';var pdf=require(_0x4b92('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4b92('0x1'));var zipdir=require(_0x4b92('0x2'));var jsonpatch=require(_0x4b92('0x3'));var rp=require(_0x4b92('0x4'));var moment=require(_0x4b92('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4b92('0x6'));var util=require(_0x4b92('0x7'));var path=require('path');var sox=require(_0x4b92('0x8'));var csv=require(_0x4b92('0x9'));var ejs=require(_0x4b92('0xa'));var fs=require('fs');var _=require(_0x4b92('0xb'));var squel=require(_0x4b92('0xc'));var crypto=require(_0x4b92('0xd'));var jsforce=require(_0x4b92('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4b92('0xf'));var Papa=require(_0x4b92('0x10'));var Redis=require(_0x4b92('0x11'));var authService=require(_0x4b92('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b92('0x13'));var logger=require(_0x4b92('0x14'))(_0x4b92('0x15'));var utils=require(_0x4b92('0x16'));var config=require(_0x4b92('0x17'));var db=require(_0x4b92('0x18'))['db'];function respondWithStatusCode(_0x390f12,_0xb55955){_0xb55955=_0xb55955||0xcc;return function(_0xd0e4ba){if(_0xd0e4ba){return _0x390f12[_0x4b92('0x19')](_0xb55955);}return _0x390f12['status'](_0xb55955)[_0x4b92('0x1a')]();};}function respondWithResult(_0x2bba8c,_0x4078a0){_0x4078a0=_0x4078a0||0xc8;return function(_0x42d0b1){if(_0x42d0b1){return _0x2bba8c['status'](_0x4078a0)['json'](_0x42d0b1);}};}function respondWithFilteredResult(_0x5a7daa,_0x12aef1){return function(_0x514aa4){if(_0x514aa4){var _0x27af5f=_0x514aa4[_0x4b92('0x1b')],_0x1531ce=_0x12aef1[_0x4b92('0x1c')],_0x18ab32=_0x12aef1['offset']+_0x12aef1[_0x4b92('0x1d')],_0x1309e0;if(_0x18ab32>=_0x27af5f){_0x18ab32=_0x27af5f;_0x1309e0=0xc8;}else{_0x1309e0=0xce;}_0x5a7daa[_0x4b92('0x1e')](_0x1309e0);return _0x5a7daa[_0x4b92('0x1f')](_0x4b92('0x20'),_0x1531ce+'-'+_0x18ab32+'/'+_0x27af5f)['json'](_0x514aa4);}return null;};}function patchUpdates(_0x527b87){return function(_0x201c23){try{jsonpatch[_0x4b92('0x21')](_0x201c23,_0x527b87,!![]);}catch(_0xa56bdb){return BPromise['reject'](_0xa56bdb);}return _0x201c23[_0x4b92('0x22')]();};}function saveUpdates(_0x1faf9b,_0x4ede81){return function(_0x16059a){if(_0x16059a){return _0x16059a['update'](_0x1faf9b)['then'](function(_0x3ef9ac){return _0x3ef9ac;});}return null;};}function removeEntity(_0x5ce859,_0x3060a7){return function(_0x1ce4a2){if(_0x1ce4a2){return _0x1ce4a2[_0x4b92('0x23')]()[_0x4b92('0x24')](function(){var _0x5507af=_0x1ce4a2[_0x4b92('0x25')]({'plain':!![]});var _0x508b13=_0x4b92('0x26');return db[_0x4b92('0x27')][_0x4b92('0x23')]({'where':{'type':_0x508b13,'resourceId':_0x5507af['id']}})['then'](function(){return _0x1ce4a2;});})[_0x4b92('0x24')](function(){_0x5ce859[_0x4b92('0x1e')](0xcc)[_0x4b92('0x1a')]();});}};}function handleEntityNotFound(_0x33c7cb,_0x15f488){return function(_0x25add7){if(!_0x25add7){_0x33c7cb[_0x4b92('0x19')](0x194);}return _0x25add7;};}function handleError(_0x528464,_0x19c56e){_0x19c56e=_0x19c56e||0x1f4;return function(_0x5bf926){logger['error'](_0x5bf926[_0x4b92('0x28')]);if(_0x5bf926[_0x4b92('0x29')]){delete _0x5bf926[_0x4b92('0x29')];}_0x528464[_0x4b92('0x1e')](_0x19c56e)[_0x4b92('0x2a')](_0x5bf926);};}exports['index']=function(_0x43bed3,_0x25b1c2){var _0x49bb60={},_0x809e9e={},_0x3dbf8f={'count':0x0,'rows':[]};var _0x19a01c=_[_0x4b92('0x2b')](db[_0x4b92('0x2c')][_0x4b92('0x2d')],function(_0xe558){return{'name':_0xe558[_0x4b92('0x2e')],'type':_0xe558[_0x4b92('0x2f')][_0x4b92('0x30')]};});_0x809e9e[_0x4b92('0x31')]=_['map'](_0x19a01c,_0x4b92('0x29'));_0x809e9e[_0x4b92('0x32')]=_[_0x4b92('0x33')](_0x43bed3[_0x4b92('0x32')]);_0x809e9e[_0x4b92('0x34')]=_['intersection'](_0x809e9e['model'],_0x809e9e[_0x4b92('0x32')]);_0x49bb60[_0x4b92('0x35')]=_['intersection'](_0x809e9e[_0x4b92('0x31')],qs[_0x4b92('0x36')](_0x43bed3[_0x4b92('0x32')]['fields']));_0x49bb60[_0x4b92('0x35')]=_0x49bb60['attributes'][_0x4b92('0x37')]?_0x49bb60[_0x4b92('0x35')]:_0x809e9e['model'];if(!_0x43bed3[_0x4b92('0x32')][_0x4b92('0x38')]('nolimit')){_0x49bb60[_0x4b92('0x1d')]=qs[_0x4b92('0x1d')](_0x43bed3[_0x4b92('0x32')][_0x4b92('0x1d')]);_0x49bb60[_0x4b92('0x1c')]=qs[_0x4b92('0x1c')](_0x43bed3[_0x4b92('0x32')][_0x4b92('0x1c')]);}_0x49bb60['order']=qs['sort'](_0x43bed3[_0x4b92('0x32')][_0x4b92('0x39')]);_0x49bb60[_0x4b92('0x3a')]=qs[_0x4b92('0x34')](_[_0x4b92('0x3b')](_0x43bed3[_0x4b92('0x32')],_0x809e9e[_0x4b92('0x34')]));if(_0x43bed3[_0x4b92('0x32')][_0x4b92('0x3c')]){_0x49bb60[_0x4b92('0x3a')]=_['merge'](_0x49bb60[_0x4b92('0x3a')],{'$or':_[_0x4b92('0x2b')](_0x19a01c,function(_0xa6427d){if(_0xa6427d[_0x4b92('0x2f')]!=='VIRTUAL'){var _0x3b8c64={};_0x3b8c64[_0xa6427d[_0x4b92('0x29')]]={'$like':'%'+_0x43bed3[_0x4b92('0x32')][_0x4b92('0x3c')]+'%'};return _0x3b8c64;}})});}_0x49bb60=_[_0x4b92('0x3d')]({},_0x49bb60,_0x43bed3[_0x4b92('0x3e')]);var _0x528a63={'where':_0x49bb60[_0x4b92('0x3a')]};return db[_0x4b92('0x2c')][_0x4b92('0x1b')](_0x528a63)[_0x4b92('0x24')](function(_0x199f7f){_0x3dbf8f[_0x4b92('0x1b')]=_0x199f7f;if(_0x43bed3[_0x4b92('0x32')][_0x4b92('0x3f')]){_0x49bb60[_0x4b92('0x40')]=[{'all':!![]}];}return db[_0x4b92('0x2c')][_0x4b92('0x41')](_0x49bb60);})['then'](function(_0x1413b1){_0x3dbf8f['rows']=_0x1413b1;return _0x3dbf8f;})[_0x4b92('0x24')](respondWithFilteredResult(_0x25b1c2,_0x49bb60))[_0x4b92('0x42')](handleError(_0x25b1c2,null));};exports[_0x4b92('0x43')]=function(_0x46b879,_0x80776b){var _0x3895db={'raw':!![],'where':{'id':_0x46b879[_0x4b92('0x44')]['id']}},_0xb848e={};_0xb848e[_0x4b92('0x31')]=_[_0x4b92('0x33')](db[_0x4b92('0x2c')][_0x4b92('0x2d')]);_0xb848e[_0x4b92('0x32')]=_[_0x4b92('0x33')](_0x46b879['query']);_0xb848e['filters']=_[_0x4b92('0x45')](_0xb848e['model'],_0xb848e[_0x4b92('0x32')]);_0x3895db[_0x4b92('0x35')]=_[_0x4b92('0x45')](_0xb848e[_0x4b92('0x31')],qs[_0x4b92('0x36')](_0x46b879[_0x4b92('0x32')]['fields']));_0x3895db[_0x4b92('0x35')]=_0x3895db[_0x4b92('0x35')][_0x4b92('0x37')]?_0x3895db[_0x4b92('0x35')]:_0xb848e[_0x4b92('0x31')];if(_0x46b879['query'][_0x4b92('0x3f')]){_0x3895db[_0x4b92('0x40')]=[{'all':!![]}];}_0x3895db=_[_0x4b92('0x3d')]({},_0x3895db,_0x46b879['options']);return db[_0x4b92('0x2c')]['find'](_0x3895db)[_0x4b92('0x24')](handleEntityNotFound(_0x80776b,null))[_0x4b92('0x24')](respondWithResult(_0x80776b,null))[_0x4b92('0x42')](handleError(_0x80776b,null));};exports['create']=function(_0x58dcb3,_0xe0381b){return db[_0x4b92('0x2c')][_0x4b92('0x46')](_0x58dcb3[_0x4b92('0x47')],{})['then'](function(_0x423fae){var _0x14e60e=_0x58dcb3[_0x4b92('0x48')][_0x4b92('0x25')]({'plain':!![]});if(!_0x14e60e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x14e60e[_0x4b92('0x49')]===_0x4b92('0x48')){var _0x5d891d=_0x423fae[_0x4b92('0x25')]({'plain':!![]});var _0x384a14=_0x4b92('0x26');return db[_0x4b92('0x4a')]['find']({'where':{'name':_0x384a14,'userProfileId':_0x14e60e[_0x4b92('0x4b')]},'raw':!![]})['then'](function(_0x4b743a){if(_0x4b743a&&_0x4b743a[_0x4b92('0x4c')]===0x0){return db[_0x4b92('0x27')][_0x4b92('0x46')]({'name':_0x5d891d[_0x4b92('0x29')],'resourceId':_0x5d891d['id'],'type':_0x4b743a[_0x4b92('0x29')],'sectionId':_0x4b743a['id']},{})[_0x4b92('0x24')](function(){return _0x423fae;});}else{return _0x423fae;}})[_0x4b92('0x42')](function(_0xdf05d8){logger[_0x4b92('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdf05d8);throw _0xdf05d8;});}return _0x423fae;})[_0x4b92('0x24')](respondWithResult(_0xe0381b,0xc9))['catch'](handleError(_0xe0381b,null));};exports['update']=function(_0x3d539a,_0x58c8ff){if(_0x3d539a['body']['id']){delete _0x3d539a['body']['id'];}return db[_0x4b92('0x2c')][_0x4b92('0x4e')]({'where':{'id':_0x3d539a[_0x4b92('0x44')]['id']}})[_0x4b92('0x24')](handleEntityNotFound(_0x58c8ff,null))[_0x4b92('0x24')](saveUpdates(_0x3d539a['body'],null))[_0x4b92('0x24')](respondWithResult(_0x58c8ff,null))['catch'](handleError(_0x58c8ff,null));};exports[_0x4b92('0x23')]=function(_0x662367,_0x28a9fe){return db[_0x4b92('0x2c')]['find']({'where':{'id':_0x662367[_0x4b92('0x44')]['id']}})[_0x4b92('0x24')](handleEntityNotFound(_0x28a9fe,null))['then'](removeEntity(_0x28a9fe,null))[_0x4b92('0x42')](handleError(_0x28a9fe,null));}; \ No newline at end of file +var _0x160c=['autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','apply','reject','save','update','destroy','then','Tags','sendStatus','error','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Tag','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection'];(function(_0x8fd7be,_0xcd1d8d){var _0xd527d7=function(_0x34a173){while(--_0x34a173){_0x8fd7be['push'](_0x8fd7be['shift']());}};_0xd527d7(++_0xcd1d8d);}(_0x160c,0xa7));var _0xc160=function(_0x4b994b,_0x2cbbbd){_0x4b994b=_0x4b994b-0x0;var _0x5960da=_0x160c[_0x4b994b];return _0x5960da;};'use strict';var pdf=require(_0xc160('0x0'));var emlformat=require(_0xc160('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc160('0x2'));var rp=require(_0xc160('0x3'));var moment=require(_0xc160('0x4'));var BPromise=require(_0xc160('0x5'));var Mustache=require(_0xc160('0x6'));var util=require('util');var path=require(_0xc160('0x7'));var sox=require(_0xc160('0x8'));var csv=require(_0xc160('0x9'));var ejs=require(_0xc160('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc160('0xb'));var crypto=require('crypto');var jsforce=require(_0xc160('0xc'));var deskjs=require(_0xc160('0xd'));var toCsv=require(_0xc160('0x9'));var querystring=require(_0xc160('0xe'));var Papa=require(_0xc160('0xf'));var Redis=require(_0xc160('0x10'));var authService=require(_0xc160('0x11'));var qs=require(_0xc160('0x12'));var as=require(_0xc160('0x13'));var hardwareService=require(_0xc160('0x14'));var logger=require(_0xc160('0x15'))(_0xc160('0x16'));var utils=require(_0xc160('0x17'));var config=require(_0xc160('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x141b73,_0x10f16a){_0x10f16a=_0x10f16a||0xcc;return function(_0x1e6894){if(_0x1e6894){return _0x141b73['sendStatus'](_0x10f16a);}return _0x141b73[_0xc160('0x19')](_0x10f16a)[_0xc160('0x1a')]();};}function respondWithResult(_0x3bb650,_0x1a14e4){_0x1a14e4=_0x1a14e4||0xc8;return function(_0xd56473){if(_0xd56473){return _0x3bb650['status'](_0x1a14e4)[_0xc160('0x1b')](_0xd56473);}};}function respondWithFilteredResult(_0x4a5e16,_0x5c8327){return function(_0x1481af){if(_0x1481af){var _0xae6b66=_0x1481af[_0xc160('0x1c')],_0x272d0d=_0x5c8327['offset'],_0x38884a=_0x5c8327[_0xc160('0x1d')]+_0x5c8327[_0xc160('0x1e')],_0x177085;if(_0x38884a>=_0xae6b66){_0x38884a=_0xae6b66;_0x177085=0xc8;}else{_0x177085=0xce;}_0x4a5e16['status'](_0x177085);return _0x4a5e16['set']('Content-Range',_0x272d0d+'-'+_0x38884a+'/'+_0xae6b66)[_0xc160('0x1b')](_0x1481af);}return null;};}function patchUpdates(_0x60db49){return function(_0x3be33f){try{jsonpatch[_0xc160('0x1f')](_0x3be33f,_0x60db49,!![]);}catch(_0x219a8f){return BPromise[_0xc160('0x20')](_0x219a8f);}return _0x3be33f[_0xc160('0x21')]();};}function saveUpdates(_0x4f45a1,_0x27e9fc){return function(_0x56c631){if(_0x56c631){return _0x56c631[_0xc160('0x22')](_0x4f45a1)['then'](function(_0x56c958){return _0x56c958;});}return null;};}function removeEntity(_0x1f8b56,_0x134124){return function(_0x12d329){if(_0x12d329){return _0x12d329[_0xc160('0x23')]()[_0xc160('0x24')](function(){var _0x57330e=_0x12d329['get']({'plain':!![]});var _0x4f3323=_0xc160('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x4f3323,'resourceId':_0x57330e['id']}})['then'](function(){return _0x12d329;});})[_0xc160('0x24')](function(){_0x1f8b56[_0xc160('0x19')](0xcc)[_0xc160('0x1a')]();});}};}function handleEntityNotFound(_0x8fe442,_0x1162c0){return function(_0x484a20){if(!_0x484a20){_0x8fe442[_0xc160('0x26')](0x194);}return _0x484a20;};}function handleError(_0x150a1a,_0x5a6acb){_0x5a6acb=_0x5a6acb||0x1f4;return function(_0xf9e4bc){logger[_0xc160('0x27')](_0xf9e4bc['stack']);if(_0xf9e4bc[_0xc160('0x28')]){delete _0xf9e4bc[_0xc160('0x28')];}_0x150a1a[_0xc160('0x19')](_0x5a6acb)[_0xc160('0x29')](_0xf9e4bc);};}exports['index']=function(_0x362c8b,_0x2b414f){var _0x29c507={},_0x57d418={},_0x5252e5={'count':0x0,'rows':[]};var _0x49b4fc=_['map'](db['Tag'][_0xc160('0x2a')],function(_0x33bcc7){return{'name':_0x33bcc7[_0xc160('0x2b')],'type':_0x33bcc7['type'][_0xc160('0x2c')]};});_0x57d418[_0xc160('0x2d')]=_[_0xc160('0x2e')](_0x49b4fc,_0xc160('0x28'));_0x57d418[_0xc160('0x2f')]=_['keys'](_0x362c8b[_0xc160('0x2f')]);_0x57d418[_0xc160('0x30')]=_[_0xc160('0x31')](_0x57d418['model'],_0x57d418['query']);_0x29c507[_0xc160('0x32')]=_[_0xc160('0x31')](_0x57d418[_0xc160('0x2d')],qs[_0xc160('0x33')](_0x362c8b[_0xc160('0x2f')][_0xc160('0x33')]));_0x29c507[_0xc160('0x32')]=_0x29c507[_0xc160('0x32')][_0xc160('0x34')]?_0x29c507[_0xc160('0x32')]:_0x57d418[_0xc160('0x2d')];if(!_0x362c8b[_0xc160('0x2f')][_0xc160('0x35')](_0xc160('0x36'))){_0x29c507[_0xc160('0x1e')]=qs['limit'](_0x362c8b['query']['limit']);_0x29c507[_0xc160('0x1d')]=qs['offset'](_0x362c8b[_0xc160('0x2f')][_0xc160('0x1d')]);}_0x29c507[_0xc160('0x37')]=qs['sort'](_0x362c8b[_0xc160('0x2f')][_0xc160('0x38')]);_0x29c507[_0xc160('0x39')]=qs[_0xc160('0x30')](_[_0xc160('0x3a')](_0x362c8b['query'],_0x57d418[_0xc160('0x30')]));if(_0x362c8b[_0xc160('0x2f')][_0xc160('0x3b')]){_0x29c507[_0xc160('0x39')]=_[_0xc160('0x3c')](_0x29c507[_0xc160('0x39')],{'$or':_[_0xc160('0x2e')](_0x49b4fc,function(_0x4757a2){if(_0x4757a2['type']!==_0xc160('0x3d')){var _0x356bc8={};_0x356bc8[_0x4757a2[_0xc160('0x28')]]={'$like':'%'+_0x362c8b[_0xc160('0x2f')][_0xc160('0x3b')]+'%'};return _0x356bc8;}})});}_0x29c507=_[_0xc160('0x3c')]({},_0x29c507,_0x362c8b[_0xc160('0x3e')]);var _0x416a3f={'where':_0x29c507[_0xc160('0x39')]};return db[_0xc160('0x3f')][_0xc160('0x1c')](_0x416a3f)['then'](function(_0x355f46){_0x5252e5[_0xc160('0x1c')]=_0x355f46;if(_0x362c8b[_0xc160('0x2f')][_0xc160('0x40')]){_0x29c507[_0xc160('0x41')]=[{'all':!![]}];}return db['Tag'][_0xc160('0x42')](_0x29c507);})[_0xc160('0x24')](function(_0x5081c6){_0x5252e5[_0xc160('0x43')]=_0x5081c6;return _0x5252e5;})[_0xc160('0x24')](respondWithFilteredResult(_0x2b414f,_0x29c507))[_0xc160('0x44')](handleError(_0x2b414f,null));};exports[_0xc160('0x45')]=function(_0x3f487e,_0xb72e3b){var _0x349a0d={'raw':!![],'where':{'id':_0x3f487e[_0xc160('0x46')]['id']}},_0x892eba={};_0x892eba['model']=_['keys'](db['Tag'][_0xc160('0x2a')]);_0x892eba[_0xc160('0x2f')]=_[_0xc160('0x47')](_0x3f487e[_0xc160('0x2f')]);_0x892eba[_0xc160('0x30')]=_[_0xc160('0x31')](_0x892eba[_0xc160('0x2d')],_0x892eba['query']);_0x349a0d[_0xc160('0x32')]=_[_0xc160('0x31')](_0x892eba[_0xc160('0x2d')],qs[_0xc160('0x33')](_0x3f487e[_0xc160('0x2f')][_0xc160('0x33')]));_0x349a0d[_0xc160('0x32')]=_0x349a0d[_0xc160('0x32')][_0xc160('0x34')]?_0x349a0d['attributes']:_0x892eba[_0xc160('0x2d')];if(_0x3f487e['query']['includeAll']){_0x349a0d[_0xc160('0x41')]=[{'all':!![]}];}_0x349a0d=_['merge']({},_0x349a0d,_0x3f487e[_0xc160('0x3e')]);return db[_0xc160('0x3f')][_0xc160('0x48')](_0x349a0d)[_0xc160('0x24')](handleEntityNotFound(_0xb72e3b,null))[_0xc160('0x24')](respondWithResult(_0xb72e3b,null))[_0xc160('0x44')](handleError(_0xb72e3b,null));};exports['create']=function(_0x9f7650,_0x5b7e7a){return db[_0xc160('0x3f')][_0xc160('0x49')](_0x9f7650[_0xc160('0x4a')],{})['then'](function(_0x417c5c){var _0x3aac04=_0x9f7650[_0xc160('0x4b')]['get']({'plain':!![]});if(!_0x3aac04)throw new Error(_0xc160('0x4c'));if(_0x3aac04['role']===_0xc160('0x4b')){var _0x38186a=_0x417c5c[_0xc160('0x4d')]({'plain':!![]});var _0x3512cb='Tags';return db[_0xc160('0x4e')]['find']({'where':{'name':_0x3512cb,'userProfileId':_0x3aac04['userProfileId']},'raw':!![]})[_0xc160('0x24')](function(_0x290f33){if(_0x290f33&&_0x290f33[_0xc160('0x4f')]===0x0){return db[_0xc160('0x50')][_0xc160('0x49')]({'name':_0x38186a[_0xc160('0x28')],'resourceId':_0x38186a['id'],'type':_0x290f33[_0xc160('0x28')],'sectionId':_0x290f33['id']},{})['then'](function(){return _0x417c5c;});}else{return _0x417c5c;}})[_0xc160('0x44')](function(_0x279c2b){logger[_0xc160('0x27')](_0xc160('0x51'),_0x279c2b);throw _0x279c2b;});}return _0x417c5c;})[_0xc160('0x24')](respondWithResult(_0x5b7e7a,0xc9))['catch'](handleError(_0x5b7e7a,null));};exports[_0xc160('0x22')]=function(_0x278fe0,_0x12bfe8){if(_0x278fe0[_0xc160('0x4a')]['id']){delete _0x278fe0['body']['id'];}return db[_0xc160('0x3f')][_0xc160('0x48')]({'where':{'id':_0x278fe0['params']['id']}})[_0xc160('0x24')](handleEntityNotFound(_0x12bfe8,null))[_0xc160('0x24')](saveUpdates(_0x278fe0[_0xc160('0x4a')],null))['then'](respondWithResult(_0x12bfe8,null))[_0xc160('0x44')](handleError(_0x12bfe8,null));};exports[_0xc160('0x23')]=function(_0x36e6dd,_0x2642a2){return db['Tag'][_0xc160('0x48')]({'where':{'id':_0x36e6dd[_0xc160('0x46')]['id']}})[_0xc160('0x24')](handleEntityNotFound(_0x2642a2,null))[_0xc160('0x24')](removeEntity(_0x2642a2,null))[_0xc160('0x44')](handleError(_0x2642a2,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index f216060..820375a 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 _0xc06d=['bluebird','request-promise','../../config/environment','exports','Tag','tools_tags','lodash','util','../../config/logger','api'];(function(_0x5472cd,_0x3235d5){var _0x3b2457=function(_0x5326d9){while(--_0x5326d9){_0x5472cd['push'](_0x5472cd['shift']());}};_0x3b2457(++_0x3235d5);}(_0xc06d,0x15a));var _0xdc06=function(_0x11c4c6,_0x302f36){_0x11c4c6=_0x11c4c6-0x0;var _0x4ee987=_0xc06d[_0x11c4c6];return _0x4ee987;};'use strict';var _=require(_0xdc06('0x0'));var util=require(_0xdc06('0x1'));var logger=require(_0xdc06('0x2'))(_0xdc06('0x3'));var moment=require('moment');var BPromise=require(_0xdc06('0x4'));var rp=require(_0xdc06('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdc06('0x6'));var attributes=require('./tag.attributes');module[_0xdc06('0x7')]=function(_0x2f7692,_0x5ce60c){return _0x2f7692['define'](_0xdc06('0x8'),attributes,{'tableName':_0xdc06('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdfb=['Tag','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1b2473,_0x1996e5){var _0x3defa2=function(_0x2603a7){while(--_0x2603a7){_0x1b2473['push'](_0x1b2473['shift']());}};_0x3defa2(++_0x1996e5);}(_0xbdfb,0x1ef));var _0xbbdf=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0xbdfb[_0x352d28];return _0x387d7e;};'use strict';var _=require(_0xbbdf('0x0'));var util=require(_0xbbdf('0x1'));var logger=require(_0xbbdf('0x2'))(_0xbbdf('0x3'));var moment=require(_0xbbdf('0x4'));var BPromise=require(_0xbbdf('0x5'));var rp=require(_0xbbdf('0x6'));var fs=require('fs');var path=require(_0xbbdf('0x7'));var rimraf=require(_0xbbdf('0x8'));var config=require(_0xbbdf('0x9'));var attributes=require('./tag.attributes');module[_0xbbdf('0xa')]=function(_0x3184ff,_0x54d048){return _0x3184ff[_0xbbdf('0xb')](_0xbbdf('0xc'),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 436660d..8b9ce23 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 _0xfe57=['error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xfe57,0x195));var _0x7fe5=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0xfe57[_0x272638];return _0x19d027;};'use strict';var _=require(_0x7fe5('0x0'));var util=require(_0x7fe5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7fe5('0x2'));var fs=require('fs');var Redis=require(_0x7fe5('0x3'));var db=require(_0x7fe5('0x4'))['db'];var utils=require(_0x7fe5('0x5'));var logger=require(_0x7fe5('0x6'))(_0x7fe5('0x7'));var config=require(_0x7fe5('0x8'));var jayson=require(_0x7fe5('0x9'));var client=jayson[_0x7fe5('0xa')][_0x7fe5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd6146b,_0x2632de,_0x36ff81){return new BPromise(function(_0x4ab081,_0x13b391){return client['request'](_0xd6146b,_0x36ff81)[_0x7fe5('0xc')](function(_0x2ae7f3){logger['info']('Tag,\x20%s,\x20%s',_0x2632de,_0x7fe5('0xd'));logger[_0x7fe5('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x2632de,_0x7fe5('0xd'),JSON['stringify'](_0x2ae7f3));if(_0x2ae7f3['error']){if(_0x2ae7f3[_0x7fe5('0xf')][_0x7fe5('0x10')]===0x1f4){logger[_0x7fe5('0xf')](_0x7fe5('0x11'),_0x2632de,_0x2ae7f3['error'][_0x7fe5('0x12')]);return _0x13b391(_0x2ae7f3[_0x7fe5('0xf')]['message']);}logger[_0x7fe5('0xf')]('Tag,\x20%s,\x20%s',_0x2632de,_0x2ae7f3[_0x7fe5('0xf')][_0x7fe5('0x12')]);return _0x4ab081(_0x2ae7f3['error'][_0x7fe5('0x12')]);}else{logger['info'](_0x7fe5('0x11'),_0x2632de,_0x7fe5('0xd'));_0x4ab081(_0x2ae7f3[_0x7fe5('0x13')][_0x7fe5('0x12')]);}})[_0x7fe5('0x14')](function(_0x104bc8){logger['error'](_0x7fe5('0x11'),_0x2632de,_0x104bc8);_0x13b391(_0x104bc8);});});} \ No newline at end of file +var _0x579c=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3d67c6,_0x481f96){var _0xcaf28b=function(_0x8d34e1){while(--_0x8d34e1){_0x3d67c6['push'](_0x3d67c6['shift']());}};_0xcaf28b(++_0x481f96);}(_0x579c,0xda));var _0xc579=function(_0x1d0567,_0x1af6c7){_0x1d0567=_0x1d0567-0x0;var _0x50774b=_0x579c[_0x1d0567];return _0x50774b;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var moment=require(_0xc579('0x2'));var BPromise=require(_0xc579('0x3'));var rs=require(_0xc579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x6'))(_0xc579('0x7'));var config=require(_0xc579('0x8'));var jayson=require(_0xc579('0x9'));var client=jayson[_0xc579('0xa')][_0xc579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e451b,_0x585167,_0x1c6d9c){return new BPromise(function(_0x293c4a,_0x2ce949){return client[_0xc579('0xc')](_0x2e451b,_0x1c6d9c)[_0xc579('0xd')](function(_0x44b151){logger[_0xc579('0xe')](_0xc579('0xf'),_0x585167,'request\x20sent');logger[_0xc579('0x10')](_0xc579('0x11'),_0x585167,_0xc579('0x12'),JSON[_0xc579('0x13')](_0x44b151));if(_0x44b151[_0xc579('0x14')]){if(_0x44b151[_0xc579('0x14')][_0xc579('0x15')]===0x1f4){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x44b151[_0xc579('0x14')][_0xc579('0x16')]);return _0x2ce949(_0x44b151['error'][_0xc579('0x16')]);}logger['error'](_0xc579('0xf'),_0x585167,_0x44b151['error'][_0xc579('0x16')]);return _0x293c4a(_0x44b151['error'][_0xc579('0x16')]);}else{logger['info'](_0xc579('0xf'),_0x585167,_0xc579('0x12'));_0x293c4a(_0x44b151['result']['message']);}})[_0xc579('0x17')](function(_0x2abc55){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x2abc55);_0x2ce949(_0x2abc55);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index a5966e8..75c69ea 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 _0x1ae8=['path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get','show','/:id/queues','/:id/users','post','create','addQueues','addAgents','put','delete','/:id','destroy','removeQueues','removeAgents','exports','multer','util'];(function(_0x38b436,_0x4b1d0b){var _0x3a92c1=function(_0xb7d73a){while(--_0xb7d73a){_0x38b436['push'](_0x38b436['shift']());}};_0x3a92c1(++_0x4b1d0b);}(_0x1ae8,0x17e));var _0x81ae=function(_0x4ff648,_0x221096){_0x4ff648=_0x4ff648-0x0;var _0x259292=_0x1ae8[_0x4ff648];return _0x259292;};'use strict';var multer=require(_0x81ae('0x0'));var util=require(_0x81ae('0x1'));var path=require(_0x81ae('0x2'));var timeout=require('connect-timeout');var express=require(_0x81ae('0x3'));var router=express[_0x81ae('0x4')]();var auth=require(_0x81ae('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x81ae('0x6'));var controller=require('./team.controller');router['get']('/',auth[_0x81ae('0x7')](),controller[_0x81ae('0x8')]);router[_0x81ae('0x9')]('/:id',auth[_0x81ae('0x7')](),controller[_0x81ae('0xa')]);router['get'](_0x81ae('0xb'),auth[_0x81ae('0x7')](),controller['getQueues']);router[_0x81ae('0x9')](_0x81ae('0xc'),auth['isAuthenticated'](),controller['getAgents']);router[_0x81ae('0xd')]('/',auth['isAuthenticated'](),controller[_0x81ae('0xe')]);router['post'](_0x81ae('0xb'),auth[_0x81ae('0x7')](),controller[_0x81ae('0xf')]);router[_0x81ae('0xd')](_0x81ae('0xc'),auth['isAuthenticated'](),controller[_0x81ae('0x10')]);router[_0x81ae('0x11')]('/:id',auth[_0x81ae('0x7')](),controller['update']);router[_0x81ae('0x12')](_0x81ae('0x13'),auth[_0x81ae('0x7')](),controller[_0x81ae('0x14')]);router[_0x81ae('0x12')](_0x81ae('0xb'),auth[_0x81ae('0x7')](),controller[_0x81ae('0x15')]);router[_0x81ae('0x12')](_0x81ae('0xc'),auth[_0x81ae('0x7')](),controller[_0x81ae('0x16')]);module[_0x81ae('0x17')]=router; \ No newline at end of file +var _0xda0f=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./team.controller','isAuthenticated','index','get','/:id','show','getQueues','/:id/users','getAgents','post','create','/:id/queues','addQueues','addAgents','put','delete','destroy','removeQueues','removeAgents','exports','multer','util'];(function(_0x270061,_0x4e41e1){var _0x329604=function(_0x719737){while(--_0x719737){_0x270061['push'](_0x270061['shift']());}};_0x329604(++_0x4e41e1);}(_0xda0f,0xde));var _0xfda0=function(_0x199973,_0x5b279f){_0x199973=_0x199973-0x0;var _0x1b1646=_0xda0f[_0x199973];return _0x1b1646;};'use strict';var multer=require(_0xfda0('0x0'));var util=require(_0xfda0('0x1'));var path=require(_0xfda0('0x2'));var timeout=require(_0xfda0('0x3'));var express=require(_0xfda0('0x4'));var router=express[_0xfda0('0x5')]();var auth=require(_0xfda0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfda0('0x7'));var controller=require(_0xfda0('0x8'));router['get']('/',auth[_0xfda0('0x9')](),controller[_0xfda0('0xa')]);router[_0xfda0('0xb')](_0xfda0('0xc'),auth[_0xfda0('0x9')](),controller[_0xfda0('0xd')]);router[_0xfda0('0xb')]('/:id/queues',auth[_0xfda0('0x9')](),controller[_0xfda0('0xe')]);router[_0xfda0('0xb')](_0xfda0('0xf'),auth['isAuthenticated'](),controller[_0xfda0('0x10')]);router[_0xfda0('0x11')]('/',auth[_0xfda0('0x9')](),controller[_0xfda0('0x12')]);router['post'](_0xfda0('0x13'),auth[_0xfda0('0x9')](),controller[_0xfda0('0x14')]);router[_0xfda0('0x11')](_0xfda0('0xf'),auth[_0xfda0('0x9')](),controller[_0xfda0('0x15')]);router[_0xfda0('0x16')](_0xfda0('0xc'),auth[_0xfda0('0x9')](),controller['update']);router[_0xfda0('0x17')](_0xfda0('0xc'),auth[_0xfda0('0x9')](),controller[_0xfda0('0x18')]);router[_0xfda0('0x17')]('/:id/queues',auth[_0xfda0('0x9')](),controller[_0xfda0('0x19')]);router['delete'](_0xfda0('0xf'),auth[_0xfda0('0x9')](),controller[_0xfda0('0x1a')]);module[_0xfda0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index b418f4f..95aa0dc 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 _0x0958=['exports','STRING','name','sequelize'];(function(_0xd030f7,_0x416410){var _0x574acd=function(_0x22d4f3){while(--_0x22d4f3){_0xd030f7['push'](_0xd030f7['shift']());}};_0x574acd(++_0x416410);}(_0x0958,0xe3));var _0x8095=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0958[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x8095('0x0'));module[_0x8095('0x1')]={'name':{'type':Sequelize[_0x8095('0x2')],'allowNull':![],'unique':_0x8095('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x301a=['exports','name','STRING','sequelize'];(function(_0xb9726c,_0x4fdbdd){var _0x58a29c=function(_0x220d0d){while(--_0x220d0d){_0xb9726c['push'](_0xb9726c['shift']());}};_0x58a29c(++_0x4fdbdd);}(_0x301a,0x1c3));var _0xa301=function(_0x442c29,_0x46a973){_0x442c29=_0x442c29-0x0;var _0x1f9524=_0x301a[_0x442c29];return _0x1f9524;};'use strict';var Sequelize=require(_0xa301('0x0'));module[_0xa301('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa301('0x2')},'description':{'type':Sequelize[_0xa301('0x3')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index f81f959..b3cc174 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 _0x7af9=['interface','UserVoiceQueueRt','upsert','format','SIP/%s','spread','removeAgents','voice','chat','mail','sms','fax','openchannel','isArray','userTeam:remove','emit','getAgents','order','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Teams','UserProfileResource','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getQueues','findOne','channel','isValidChannel','Sequelize','ValidationError','capitalize','toLowerCase','Queue','Queues','addQueues','Unknown\x20channel','add','ids','removeQueues','remove','addAgents','Chat','Mail','Openchannel','each','Voice','User','online','voicePause'];(function(_0x3be8e8,_0x246a8f){var _0x5f7c64=function(_0x14b674){while(--_0x14b674){_0x3be8e8['push'](_0x3be8e8['shift']());}};_0x5f7c64(++_0x246a8f);}(_0x7af9,0x95));var _0x97af=function(_0x4ea6c1,_0x4f1761){_0x4ea6c1=_0x4ea6c1-0x0;var _0x4e3082=_0x7af9[_0x4ea6c1];return _0x4e3082;};'use strict';var pdf=require(_0x97af('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x97af('0x1'));var zipdir=require(_0x97af('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97af('0x3'));var moment=require(_0x97af('0x4'));var BPromise=require(_0x97af('0x5'));var Mustache=require(_0x97af('0x6'));var util=require(_0x97af('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x97af('0x8'));var fs=require('fs');var _=require(_0x97af('0x9'));var squel=require(_0x97af('0xa'));var crypto=require(_0x97af('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x97af('0xc'));var toCsv=require(_0x97af('0xd'));var querystring=require(_0x97af('0xe'));var Papa=require('papaparse');var Redis=require(_0x97af('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x97af('0x10'));var as=require(_0x97af('0x11'));var hardwareService=require(_0x97af('0x12'));var logger=require(_0x97af('0x13'))(_0x97af('0x14'));var utils=require(_0x97af('0x15'));var config=require(_0x97af('0x16'));var db=require(_0x97af('0x17'))['db'];config[_0x97af('0x18')]=_[_0x97af('0x19')](config[_0x97af('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x97af('0x1a'))(new Redis(config['redis']));require('./team.socket')[_0x97af('0x1b')](socket);function respondWithStatusCode(_0x1264c8,_0x458751){_0x458751=_0x458751||0xcc;return function(_0xbf7de1){if(_0xbf7de1){return _0x1264c8[_0x97af('0x1c')](_0x458751);}return _0x1264c8[_0x97af('0x1d')](_0x458751)[_0x97af('0x1e')]();};}function respondWithResult(_0x4bd6dd,_0x281f8a){_0x281f8a=_0x281f8a||0xc8;return function(_0x4e679e){if(_0x4e679e){return _0x4bd6dd[_0x97af('0x1d')](_0x281f8a)['json'](_0x4e679e);}};}function respondWithFilteredResult(_0x41cabb,_0x47c57b){return function(_0x1aa3f9){if(_0x1aa3f9){var _0x2ae4ce=_0x1aa3f9['count'],_0x3815da=_0x47c57b[_0x97af('0x1f')],_0x1481d4=_0x47c57b[_0x97af('0x1f')]+_0x47c57b['limit'],_0xc5c15f;if(_0x1481d4>=_0x2ae4ce){_0x1481d4=_0x2ae4ce;_0xc5c15f=0xc8;}else{_0xc5c15f=0xce;}_0x41cabb['status'](_0xc5c15f);return _0x41cabb[_0x97af('0x20')](_0x97af('0x21'),_0x3815da+'-'+_0x1481d4+'/'+_0x2ae4ce)['json'](_0x1aa3f9);}return null;};}function patchUpdates(_0x275675){return function(_0x5a4c34){try{jsonpatch[_0x97af('0x22')](_0x5a4c34,_0x275675,!![]);}catch(_0x5af909){return BPromise[_0x97af('0x23')](_0x5af909);}return _0x5a4c34[_0x97af('0x24')]();};}function saveUpdates(_0x36c378,_0x53323a){return function(_0x1a0cde){if(_0x1a0cde){return _0x1a0cde[_0x97af('0x25')](_0x36c378)[_0x97af('0x26')](function(_0x4c916c){return _0x4c916c;});}return null;};}function removeEntity(_0x1a08b0,_0x2a7740){return function(_0x275e8c){if(_0x275e8c){return _0x275e8c[_0x97af('0x27')]()['then'](function(){var _0x6d6296=_0x275e8c[_0x97af('0x28')]({'plain':!![]});var _0x545b3d=_0x97af('0x29');return db[_0x97af('0x2a')][_0x97af('0x27')]({'where':{'type':_0x545b3d,'resourceId':_0x6d6296['id']}})['then'](function(){return _0x275e8c;});})[_0x97af('0x26')](function(){_0x1a08b0[_0x97af('0x1d')](0xcc)[_0x97af('0x1e')]();});}};}function handleEntityNotFound(_0x444926,_0x465708){return function(_0x4ced71){if(!_0x4ced71){_0x444926[_0x97af('0x1c')](0x194);}return _0x4ced71;};}function handleError(_0x46f503,_0x51b9e7){_0x51b9e7=_0x51b9e7||0x1f4;return function(_0x258193){logger[_0x97af('0x2b')](_0x258193[_0x97af('0x2c')]);if(_0x258193[_0x97af('0x2d')]){delete _0x258193[_0x97af('0x2d')];}_0x46f503[_0x97af('0x1d')](_0x51b9e7)[_0x97af('0x2e')](_0x258193);};}exports[_0x97af('0x2f')]=function(_0x63fe87,_0x431f41){var _0x4e4127={},_0x32b3c0={},_0x564e58={'count':0x0,'rows':[]};var _0x7c4f87=_[_0x97af('0x30')](db[_0x97af('0x31')][_0x97af('0x32')],function(_0x13a509){return{'name':_0x13a509[_0x97af('0x33')],'type':_0x13a509[_0x97af('0x34')][_0x97af('0x35')]};});_0x32b3c0[_0x97af('0x36')]=_[_0x97af('0x30')](_0x7c4f87,'name');_0x32b3c0[_0x97af('0x37')]=_[_0x97af('0x38')](_0x63fe87['query']);_0x32b3c0[_0x97af('0x39')]=_['intersection'](_0x32b3c0[_0x97af('0x36')],_0x32b3c0['query']);_0x4e4127['attributes']=_[_0x97af('0x3a')](_0x32b3c0[_0x97af('0x36')],qs[_0x97af('0x3b')](_0x63fe87['query'][_0x97af('0x3b')]));_0x4e4127[_0x97af('0x3c')]=_0x4e4127[_0x97af('0x3c')][_0x97af('0x3d')]?_0x4e4127[_0x97af('0x3c')]:_0x32b3c0['model'];if(!_0x63fe87[_0x97af('0x37')][_0x97af('0x3e')](_0x97af('0x3f'))){_0x4e4127[_0x97af('0x40')]=qs['limit'](_0x63fe87['query']['limit']);_0x4e4127[_0x97af('0x1f')]=qs[_0x97af('0x1f')](_0x63fe87[_0x97af('0x37')][_0x97af('0x1f')]);}_0x4e4127['order']=qs['sort'](_0x63fe87['query'][_0x97af('0x41')]);_0x4e4127[_0x97af('0x42')]=qs[_0x97af('0x39')](_[_0x97af('0x43')](_0x63fe87[_0x97af('0x37')],_0x32b3c0[_0x97af('0x39')]));if(_0x63fe87['query'][_0x97af('0x44')]){_0x4e4127['where']=_['merge'](_0x4e4127[_0x97af('0x42')],{'$or':_[_0x97af('0x30')](_0x7c4f87,function(_0x31796d){if(_0x31796d[_0x97af('0x34')]!=='VIRTUAL'){var _0x21eff0={};_0x21eff0[_0x31796d[_0x97af('0x2d')]]={'$like':'%'+_0x63fe87[_0x97af('0x37')][_0x97af('0x44')]+'%'};return _0x21eff0;}})});}_0x4e4127=_[_0x97af('0x45')]({},_0x4e4127,_0x63fe87[_0x97af('0x46')]);var _0x261dbe={'where':_0x4e4127[_0x97af('0x42')]};return db['Team'][_0x97af('0x47')](_0x261dbe)[_0x97af('0x26')](function(_0x567f7a){_0x564e58['count']=_0x567f7a;if(_0x63fe87[_0x97af('0x37')][_0x97af('0x48')]){_0x4e4127[_0x97af('0x49')]=[{'all':!![]}];}return db[_0x97af('0x31')][_0x97af('0x4a')](_0x4e4127);})[_0x97af('0x26')](function(_0x22e224){_0x564e58[_0x97af('0x4b')]=_0x22e224;return _0x564e58;})[_0x97af('0x26')](respondWithFilteredResult(_0x431f41,_0x4e4127))[_0x97af('0x4c')](handleError(_0x431f41,null));};exports[_0x97af('0x4d')]=function(_0x26d05c,_0x126c5b){var _0x6ff6b={'raw':![],'where':{'id':_0x26d05c[_0x97af('0x4e')]['id']}},_0x16c8b4={};_0x16c8b4[_0x97af('0x36')]=_[_0x97af('0x38')](db[_0x97af('0x31')][_0x97af('0x32')]);_0x16c8b4['query']=_[_0x97af('0x38')](_0x26d05c[_0x97af('0x37')]);_0x16c8b4[_0x97af('0x39')]=_[_0x97af('0x3a')](_0x16c8b4[_0x97af('0x36')],_0x16c8b4[_0x97af('0x37')]);_0x6ff6b[_0x97af('0x3c')]=_[_0x97af('0x3a')](_0x16c8b4[_0x97af('0x36')],qs[_0x97af('0x3b')](_0x26d05c[_0x97af('0x37')][_0x97af('0x3b')]));_0x6ff6b[_0x97af('0x3c')]=_0x6ff6b[_0x97af('0x3c')][_0x97af('0x3d')]?_0x6ff6b[_0x97af('0x3c')]:_0x16c8b4[_0x97af('0x36')];if(_0x26d05c[_0x97af('0x37')][_0x97af('0x48')]){_0x6ff6b['include']=[{'all':!![]}];}_0x6ff6b=_[_0x97af('0x45')]({},_0x6ff6b,_0x26d05c[_0x97af('0x46')]);return db['Team'][_0x97af('0x4f')](_0x6ff6b)[_0x97af('0x26')](handleEntityNotFound(_0x126c5b,null))['then'](respondWithResult(_0x126c5b,null))[_0x97af('0x4c')](handleError(_0x126c5b,null));};exports[_0x97af('0x50')]=function(_0x5bbbe3,_0x7f53e){return db[_0x97af('0x31')]['create'](_0x5bbbe3['body'],{})[_0x97af('0x26')](function(_0x4a8257){var _0x33c052=_0x5bbbe3['user']['get']({'plain':!![]});if(!_0x33c052)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x33c052[_0x97af('0x51')]===_0x97af('0x52')){var _0x5077c8=_0x4a8257['get']({'plain':!![]});var _0x1f65c8='Teams';return db[_0x97af('0x53')]['find']({'where':{'name':_0x1f65c8,'userProfileId':_0x33c052[_0x97af('0x54')]},'raw':!![]})[_0x97af('0x26')](function(_0x465f66){if(_0x465f66&&_0x465f66[_0x97af('0x55')]===0x0){return db[_0x97af('0x2a')][_0x97af('0x50')]({'name':_0x5077c8['name'],'resourceId':_0x5077c8['id'],'type':_0x465f66[_0x97af('0x2d')],'sectionId':_0x465f66['id']},{})[_0x97af('0x26')](function(){return _0x4a8257;});}else{return _0x4a8257;}})[_0x97af('0x4c')](function(_0x575d32){logger['error'](_0x97af('0x56'),_0x575d32);throw _0x575d32;});}return _0x4a8257;})['then'](respondWithResult(_0x7f53e,0xc9))[_0x97af('0x4c')](handleError(_0x7f53e,null));};exports[_0x97af('0x25')]=function(_0x1f7531,_0x5457cc){if(_0x1f7531[_0x97af('0x57')]['id']){delete _0x1f7531[_0x97af('0x57')]['id'];}return db[_0x97af('0x31')][_0x97af('0x4f')]({'where':{'id':_0x1f7531['params']['id']}})['then'](handleEntityNotFound(_0x5457cc,null))['then'](saveUpdates(_0x1f7531[_0x97af('0x57')],null))[_0x97af('0x26')](respondWithResult(_0x5457cc,null))['catch'](handleError(_0x5457cc,null));};exports[_0x97af('0x27')]=function(_0x469b62,_0x2bb21f){return db[_0x97af('0x31')][_0x97af('0x4f')]({'where':{'id':_0x469b62['params']['id']}})['then'](handleEntityNotFound(_0x2bb21f,null))[_0x97af('0x26')](removeEntity(_0x2bb21f,null))[_0x97af('0x4c')](handleError(_0x2bb21f,null));};exports[_0x97af('0x58')]=function(_0x27a8d7,_0xe35f28,_0x1aad11){return db[_0x97af('0x31')][_0x97af('0x59')]({'where':{'id':_0x27a8d7[_0x97af('0x4e')]['id']}})[_0x97af('0x26')](handleEntityNotFound(_0xe35f28,null))[_0x97af('0x26')](function(_0x1b13c8){if(!_0x27a8d7[_0x97af('0x37')][_0x97af('0x5a')]||!utils[_0x97af('0x5b')](_0x27a8d7[_0x97af('0x37')][_0x97af('0x5a')])){throw new db[(_0x97af('0x5c'))][(_0x97af('0x5d'))]('Unknown\x20channel');}var _0x3d06f2={};var _0x50e5c8={};_0x50e5c8[_0x97af('0x36')]=_[_0x97af('0x38')](db[_[_0x97af('0x5e')](_0x27a8d7['query']['channel'][_0x97af('0x5f')]())+_0x97af('0x60')][_0x97af('0x32')]);_0x50e5c8['query']=_[_0x97af('0x38')](_0x27a8d7[_0x97af('0x37')]);_0x50e5c8['filters']=_[_0x97af('0x3a')](_0x50e5c8['model'],_0x50e5c8[_0x97af('0x37')]);_0x3d06f2[_0x97af('0x3c')]=_[_0x97af('0x3a')](_0x50e5c8[_0x97af('0x36')],qs[_0x97af('0x3b')](_0x27a8d7['query'][_0x97af('0x3b')]));_0x3d06f2[_0x97af('0x3c')]=_0x3d06f2[_0x97af('0x3c')]['length']?_0x3d06f2['attributes']:_0x50e5c8[_0x97af('0x36')];_0x3d06f2['limit']=qs['limit'](_0x27a8d7['query']['limit']);_0x3d06f2[_0x97af('0x1f')]=qs['offset'](_0x27a8d7['query'][_0x97af('0x1f')]);_0x3d06f2['order']=qs[_0x97af('0x41')](_0x27a8d7[_0x97af('0x37')][_0x97af('0x41')]);_0x3d06f2[_0x97af('0x42')]=qs[_0x97af('0x39')](_[_0x97af('0x43')](_0x27a8d7[_0x97af('0x37')],_0x50e5c8[_0x97af('0x39')]));_0x3d06f2=_[_0x97af('0x45')]({},_0x3d06f2,_0x27a8d7[_0x97af('0x46')]);return _0x1b13c8[_0x97af('0x28')+_[_0x97af('0x5e')](_0x27a8d7[_0x97af('0x37')][_0x97af('0x5a')][_0x97af('0x5f')]())+_0x97af('0x61')](_0x3d06f2);})[_0x97af('0x26')](respondWithResult(_0xe35f28,null))[_0x97af('0x4c')](handleError(_0xe35f28,null));};exports[_0x97af('0x62')]=function(_0x3c4264,_0x2dccfc,_0x3b6462){return db['Team'][_0x97af('0x59')]({'where':{'id':_0x3c4264[_0x97af('0x4e')]['id']}})[_0x97af('0x26')](function(_0x5db619){if(_0x5db619){if(!_0x3c4264[_0x97af('0x57')][_0x97af('0x5a')]||!utils['isValidChannel'](_0x3c4264[_0x97af('0x57')][_0x97af('0x5a')])){throw new db[(_0x97af('0x5c'))][(_0x97af('0x5d'))](_0x97af('0x63'));}return _0x5db619[_0x97af('0x64')+_['capitalize'](_0x3c4264[_0x97af('0x57')][_0x97af('0x5a')][_0x97af('0x5f')]())+_0x97af('0x61')](_0x3c4264[_0x97af('0x57')][_0x97af('0x65')]);}return null;})[_0x97af('0x26')](handleEntityNotFound(_0x2dccfc,null))['then'](respondWithStatusCode(_0x2dccfc,null))[_0x97af('0x4c')](handleError(_0x2dccfc,null));};exports[_0x97af('0x66')]=function(_0x3fbef6,_0x483c2b,_0x23def9){return db[_0x97af('0x31')][_0x97af('0x59')]({'where':{'id':_0x3fbef6['params']['id']}})[_0x97af('0x26')](function(_0x5eeaa1){if(_0x5eeaa1){if(!_0x3fbef6[_0x97af('0x37')]['channel']||!utils[_0x97af('0x5b')](_0x3fbef6[_0x97af('0x37')][_0x97af('0x5a')])){throw new db[(_0x97af('0x5c'))][(_0x97af('0x5d'))](_0x97af('0x63'));}return _0x5eeaa1[_0x97af('0x67')+_[_0x97af('0x5e')](_0x3fbef6[_0x97af('0x37')][_0x97af('0x5a')][_0x97af('0x5f')]())+'Queues'](_0x3fbef6[_0x97af('0x37')][_0x97af('0x65')]);}return null;})['then'](handleEntityNotFound(_0x483c2b,null))[_0x97af('0x26')](respondWithStatusCode(_0x483c2b,null))[_0x97af('0x4c')](handleError(_0x483c2b,null));};exports[_0x97af('0x68')]=function(_0x91189b,_0xdc1c8d,_0x31ff14){return db[_0x97af('0x31')][_0x97af('0x4f')]({'where':{'id':_0x91189b[_0x97af('0x4e')]['id']}})[_0x97af('0x26')](handleEntityNotFound(_0xdc1c8d,null))['then'](function(_0x2f1719){if(_0x2f1719){var _0x54569a=['Voice',_0x97af('0x69'),_0x97af('0x6a'),'Sms','Fax',_0x97af('0x6b')];return BPromise[_0x97af('0x6c')](_0x54569a,function(_0x20e800){return _0x2f1719['get'+_0x20e800+_0x97af('0x61')]({'attributes':['id',_0x97af('0x2d')]})[_0x97af('0x26')](function(_0x5c38cf){return BPromise[_0x97af('0x6c')](_0x5c38cf,function(_0x9f5e75){return _0x9f5e75['addAgents'](_0x91189b['body'][_0x97af('0x65')])[_0x97af('0x26')](function(){if(_0x20e800===_0x97af('0x6d')){return db[_0x97af('0x6e')]['findAll']({'where':{'id':_0x91189b[_0x97af('0x57')][_0x97af('0x65')]},'attributes':['id','name',_0x97af('0x6f'),_0x97af('0x70'),_0x97af('0x71')],'raw':!![]})[_0x97af('0x26')](function(_0x2eab04){return BPromise[_0x97af('0x6c')](_[_0x97af('0x44')](_0x2eab04,{'online':0x1}),function(_0x31b54b){return db[_0x97af('0x72')][_0x97af('0x73')]({'membername':_0x31b54b[_0x97af('0x2d')],'UserId':_0x31b54b['id'],'queue_name':_0x9f5e75[_0x97af('0x2d')],'VoiceQueueId':_0x9f5e75['id'],'interface':_['isNil'](_0x31b54b[_0x97af('0x71')])?util[_0x97af('0x74')](_0x97af('0x75'),_0x31b54b[_0x97af('0x2d')]):_0x31b54b['interface'],'paused':_0x31b54b['voicePause']||![],'penalty':0x0});});});}});});})[_0x97af('0x26')](function(){return _0x2f1719;});})[_0x97af('0x26')](function(){return _0x2f1719;});}})[_0x97af('0x26')](function(_0x396e40){if(_0x396e40){return _0x396e40[_0x97af('0x68')](_0x91189b[_0x97af('0x57')][_0x97af('0x65')],_['omit'](_0x91189b[_0x97af('0x57')],[_0x97af('0x65'),'id'])||{})[_0x97af('0x76')](function(_0x3193be){for(var _0x89b4d9=0x0;_0x89b4d9<_0x91189b[_0x97af('0x57')][_0x97af('0x65')]['length'];_0x89b4d9+=0x1){socket['emit']('userTeam:save',{'UserId':_0x91189b[_0x97af('0x57')]['ids'][_0x89b4d9],'TeamId':_0x91189b[_0x97af('0x4e')]['id']});}return _0x3193be;});}})[_0x97af('0x26')](respondWithResult(_0xdc1c8d,null))[_0x97af('0x4c')](handleError(_0xdc1c8d,null));};exports[_0x97af('0x77')]=function(_0xed118b,_0x50b6a6,_0x57912c){return db[_0x97af('0x31')][_0x97af('0x4f')]({'where':{'id':_0xed118b['params']['id']}})['then'](handleEntityNotFound(_0x50b6a6,null))[_0x97af('0x26')](function(_0x1fd2a7){if(_0x1fd2a7){return BPromise['each']([_0x97af('0x78'),_0x97af('0x79'),_0x97af('0x7a'),_0x97af('0x7b'),_0x97af('0x7c'),_0x97af('0x7d')],function(_0x512442){return _0x1fd2a7[_0x97af('0x28')+_[_0x97af('0x5e')](_0x512442)+_0x97af('0x61')]({'attributes':['id',_0x97af('0x2d')]})[_0x97af('0x26')](function(_0x21bf65){return BPromise[_0x97af('0x6c')](_0x21bf65,function(_0x2cbb97){return _0x2cbb97[_0x97af('0x77')](_0xed118b[_0x97af('0x37')][_0x97af('0x65')])[_0x97af('0x26')](function(){if(_0x512442===_0x97af('0x78')){return db[_0x97af('0x72')][_0x97af('0x27')]({'where':{'VoiceQueueId':_0x2cbb97['id'],'UserId':_0xed118b[_0x97af('0x37')][_0x97af('0x65')]}});}});});})['then'](function(){return _0x1fd2a7;});})[_0x97af('0x26')](function(){return _0x1fd2a7;});}})[_0x97af('0x26')](function(_0x5c4d25){if(_0x5c4d25){return _0x5c4d25[_0x97af('0x77')](_0xed118b[_0x97af('0x37')][_0x97af('0x65')])[_0x97af('0x26')](function(){if(_[_0x97af('0x7e')](_0xed118b[_0x97af('0x37')][_0x97af('0x65')])){for(var _0x5109a8=0x0;_0x5109a8<_0xed118b[_0x97af('0x37')]['ids'][_0x97af('0x3d')];_0x5109a8+=0x1){socket['emit'](_0x97af('0x7f'),{'UserId':Number(_0xed118b[_0x97af('0x37')][_0x97af('0x65')][_0x5109a8]),'TeamId':Number(_0xed118b['params']['id'])});}}else{socket[_0x97af('0x80')]('userTeam:remove',{'UserId':Number(_0xed118b['query']['ids']),'TeamId':Number(_0xed118b['params']['id'])});}});}})[_0x97af('0x26')](respondWithStatusCode(_0x50b6a6,null))[_0x97af('0x4c')](handleError(_0x50b6a6,null));};exports[_0x97af('0x81')]=function(_0x6a4b59,_0x3598fc,_0x450b3c){var _0x2bf9a7={};var _0x2ea829={};var _0x2e540f;var _0x2d7b32;return db[_0x97af('0x31')]['findOne']({'where':{'id':_0x6a4b59[_0x97af('0x4e')]['id']}})[_0x97af('0x26')](handleEntityNotFound(_0x3598fc,null))[_0x97af('0x26')](function(_0x4b90ff){if(_0x4b90ff){_0x2e540f=_0x4b90ff;_0x2ea829[_0x97af('0x36')]=_['keys'](db[_0x97af('0x6e')][_0x97af('0x32')]);_0x2ea829[_0x97af('0x37')]=_[_0x97af('0x38')](_0x6a4b59['query']);_0x2ea829[_0x97af('0x39')]=_[_0x97af('0x3a')](_0x2ea829['model'],_0x2ea829[_0x97af('0x37')]);_0x2bf9a7[_0x97af('0x3c')]=_[_0x97af('0x3a')](_0x2ea829[_0x97af('0x36')],qs['fields'](_0x6a4b59[_0x97af('0x37')][_0x97af('0x3b')]));_0x2bf9a7['attributes']=_0x2bf9a7[_0x97af('0x3c')][_0x97af('0x3d')]?_0x2bf9a7[_0x97af('0x3c')]:_0x2ea829[_0x97af('0x36')];_0x2bf9a7[_0x97af('0x82')]=qs[_0x97af('0x41')](_0x6a4b59['query'][_0x97af('0x41')]);_0x2bf9a7[_0x97af('0x42')]=qs[_0x97af('0x39')](_[_0x97af('0x43')](_0x6a4b59[_0x97af('0x37')],_0x2ea829[_0x97af('0x39')]));if(_0x6a4b59['query'][_0x97af('0x44')]){_0x2bf9a7[_0x97af('0x42')]=_[_0x97af('0x45')](_0x2bf9a7['where'],{'$or':_['map'](_0x2bf9a7[_0x97af('0x3c')],function(_0x477989){var _0x5c154c={};_0x5c154c[_0x477989]={'$like':'%'+_0x6a4b59[_0x97af('0x37')][_0x97af('0x44')]+'%'};return _0x5c154c;})});}_0x2bf9a7=_[_0x97af('0x45')]({},_0x2bf9a7,_0x6a4b59[_0x97af('0x46')]);return _0x2e540f[_0x97af('0x81')](_0x2bf9a7);}})[_0x97af('0x26')](function(_0x5c140b){if(_0x5c140b){_0x2d7b32=_0x5c140b[_0x97af('0x3d')];if(!_0x6a4b59['query'][_0x97af('0x3e')](_0x97af('0x3f'))){_0x2bf9a7[_0x97af('0x40')]=qs['limit'](_0x6a4b59['query'][_0x97af('0x40')]);_0x2bf9a7[_0x97af('0x1f')]=qs[_0x97af('0x1f')](_0x6a4b59[_0x97af('0x37')][_0x97af('0x1f')]);}return _0x2e540f[_0x97af('0x81')](_0x2bf9a7);}})[_0x97af('0x26')](function(_0x3a33eb){if(_0x3a33eb){return _0x3a33eb?{'count':_0x2d7b32,'rows':_0x3a33eb}:null;}})['then'](respondWithResult(_0x3598fc,null))['catch'](handleError(_0x3598fc,null));}; \ No newline at end of file +var _0x3c32=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','set','reject','save','then','destroy','get','Teams','UserProfileResource','error','stack','name','send','index','Team','type','key','model','map','query','keys','filters','fields','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','rawAttributes','intersection','find','create','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','getQueues','isValidChannel','Sequelize','Unknown\x20channel','toLowerCase','Queue','order','channel','Queues','addQueues','ValidationError','capitalize','ids','removeQueues','findOne','remove','addAgents','Voice','Chat','Mail','each','findAll','voicePause','interface','UserVoiceQueueRt','isNil','SIP/%s','omit','spread','userTeam:save','voice','mail','sms','fax','openchannel','removeAgents','isArray','userTeam:remove','emit','getAgents','User','hasOwnProperty','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x150af0,_0x20f67f){var _0x194f25=function(_0x18c81a){while(--_0x18c81a){_0x150af0['push'](_0x150af0['shift']());}};_0x194f25(++_0x20f67f);}(_0x3c32,0x161));var _0x23c3=function(_0x2634e9,_0x4b701c){_0x2634e9=_0x2634e9-0x0;var _0x46d5ee=_0x3c32[_0x2634e9];return _0x46d5ee;};'use strict';var pdf=require(_0x23c3('0x0'));var emlformat=require(_0x23c3('0x1'));var rimraf=require(_0x23c3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x23c3('0x3'));var rp=require(_0x23c3('0x4'));var moment=require(_0x23c3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x23c3('0x6'));var util=require('util');var path=require(_0x23c3('0x7'));var sox=require(_0x23c3('0x8'));var csv=require(_0x23c3('0x9'));var ejs=require(_0x23c3('0xa'));var fs=require('fs');var _=require(_0x23c3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x23c3('0xc'));var toCsv=require(_0x23c3('0x9'));var querystring=require(_0x23c3('0xd'));var Papa=require(_0x23c3('0xe'));var Redis=require(_0x23c3('0xf'));var authService=require(_0x23c3('0x10'));var qs=require(_0x23c3('0x11'));var as=require(_0x23c3('0x12'));var hardwareService=require(_0x23c3('0x13'));var logger=require(_0x23c3('0x14'))(_0x23c3('0x15'));var utils=require(_0x23c3('0x16'));var config=require(_0x23c3('0x17'));var db=require(_0x23c3('0x18'))['db'];config[_0x23c3('0x19')]=_[_0x23c3('0x1a')](config[_0x23c3('0x19')],{'host':_0x23c3('0x1b'),'port':0x18eb});var socket=require(_0x23c3('0x1c'))(new Redis(config[_0x23c3('0x19')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x22a034,_0x38a11a){_0x38a11a=_0x38a11a||0xcc;return function(_0x4192bf){if(_0x4192bf){return _0x22a034[_0x23c3('0x1d')](_0x38a11a);}return _0x22a034[_0x23c3('0x1e')](_0x38a11a)[_0x23c3('0x1f')]();};}function respondWithResult(_0x16b80c,_0x51e880){_0x51e880=_0x51e880||0xc8;return function(_0x4f65f8){if(_0x4f65f8){return _0x16b80c[_0x23c3('0x1e')](_0x51e880)[_0x23c3('0x20')](_0x4f65f8);}};}function respondWithFilteredResult(_0x5a0eba,_0x4737e4){return function(_0x2d63e2){if(_0x2d63e2){var _0x20a8b7=_0x2d63e2['count'],_0x1456a3=_0x4737e4[_0x23c3('0x21')],_0x25880d=_0x4737e4[_0x23c3('0x21')]+_0x4737e4[_0x23c3('0x22')],_0x18990f;if(_0x25880d>=_0x20a8b7){_0x25880d=_0x20a8b7;_0x18990f=0xc8;}else{_0x18990f=0xce;}_0x5a0eba['status'](_0x18990f);return _0x5a0eba[_0x23c3('0x23')]('Content-Range',_0x1456a3+'-'+_0x25880d+'/'+_0x20a8b7)['json'](_0x2d63e2);}return null;};}function patchUpdates(_0x338d5a){return function(_0x584f90){try{jsonpatch['apply'](_0x584f90,_0x338d5a,!![]);}catch(_0x21c133){return BPromise[_0x23c3('0x24')](_0x21c133);}return _0x584f90[_0x23c3('0x25')]();};}function saveUpdates(_0x381aee,_0x5c5993){return function(_0x47067e){if(_0x47067e){return _0x47067e['update'](_0x381aee)[_0x23c3('0x26')](function(_0x238d27){return _0x238d27;});}return null;};}function removeEntity(_0x30fe87,_0x1210a4){return function(_0x576c20){if(_0x576c20){return _0x576c20[_0x23c3('0x27')]()[_0x23c3('0x26')](function(){var _0x4968d5=_0x576c20[_0x23c3('0x28')]({'plain':!![]});var _0x27cd14=_0x23c3('0x29');return db[_0x23c3('0x2a')][_0x23c3('0x27')]({'where':{'type':_0x27cd14,'resourceId':_0x4968d5['id']}})['then'](function(){return _0x576c20;});})[_0x23c3('0x26')](function(){_0x30fe87[_0x23c3('0x1e')](0xcc)[_0x23c3('0x1f')]();});}};}function handleEntityNotFound(_0x1c958a,_0xa520fc){return function(_0x32b6f1){if(!_0x32b6f1){_0x1c958a[_0x23c3('0x1d')](0x194);}return _0x32b6f1;};}function handleError(_0x2a1b2c,_0x856e72){_0x856e72=_0x856e72||0x1f4;return function(_0x347ef8){logger[_0x23c3('0x2b')](_0x347ef8[_0x23c3('0x2c')]);if(_0x347ef8[_0x23c3('0x2d')]){delete _0x347ef8[_0x23c3('0x2d')];}_0x2a1b2c[_0x23c3('0x1e')](_0x856e72)[_0x23c3('0x2e')](_0x347ef8);};}exports[_0x23c3('0x2f')]=function(_0x28af56,_0x12b8be){var _0xd732d7={},_0x1bc3ce={},_0x47abc5={'count':0x0,'rows':[]};var _0x5411dc=_['map'](db[_0x23c3('0x30')]['rawAttributes'],function(_0x218b84){return{'name':_0x218b84['fieldName'],'type':_0x218b84[_0x23c3('0x31')][_0x23c3('0x32')]};});_0x1bc3ce[_0x23c3('0x33')]=_[_0x23c3('0x34')](_0x5411dc,_0x23c3('0x2d'));_0x1bc3ce[_0x23c3('0x35')]=_[_0x23c3('0x36')](_0x28af56['query']);_0x1bc3ce[_0x23c3('0x37')]=_['intersection'](_0x1bc3ce[_0x23c3('0x33')],_0x1bc3ce[_0x23c3('0x35')]);_0xd732d7['attributes']=_['intersection'](_0x1bc3ce['model'],qs[_0x23c3('0x38')](_0x28af56[_0x23c3('0x35')][_0x23c3('0x38')]));_0xd732d7['attributes']=_0xd732d7[_0x23c3('0x39')][_0x23c3('0x3a')]?_0xd732d7[_0x23c3('0x39')]:_0x1bc3ce[_0x23c3('0x33')];if(!_0x28af56[_0x23c3('0x35')]['hasOwnProperty'](_0x23c3('0x3b'))){_0xd732d7[_0x23c3('0x22')]=qs[_0x23c3('0x22')](_0x28af56['query']['limit']);_0xd732d7[_0x23c3('0x21')]=qs[_0x23c3('0x21')](_0x28af56[_0x23c3('0x35')][_0x23c3('0x21')]);}_0xd732d7['order']=qs[_0x23c3('0x3c')](_0x28af56[_0x23c3('0x35')][_0x23c3('0x3c')]);_0xd732d7[_0x23c3('0x3d')]=qs[_0x23c3('0x37')](_[_0x23c3('0x3e')](_0x28af56['query'],_0x1bc3ce['filters']));if(_0x28af56[_0x23c3('0x35')]['filter']){_0xd732d7[_0x23c3('0x3d')]=_[_0x23c3('0x3f')](_0xd732d7[_0x23c3('0x3d')],{'$or':_[_0x23c3('0x34')](_0x5411dc,function(_0x16e40f){if(_0x16e40f[_0x23c3('0x31')]!==_0x23c3('0x40')){var _0x373036={};_0x373036[_0x16e40f[_0x23c3('0x2d')]]={'$like':'%'+_0x28af56[_0x23c3('0x35')][_0x23c3('0x41')]+'%'};return _0x373036;}})});}_0xd732d7=_[_0x23c3('0x3f')]({},_0xd732d7,_0x28af56[_0x23c3('0x42')]);var _0x155245={'where':_0xd732d7[_0x23c3('0x3d')]};return db['Team']['count'](_0x155245)[_0x23c3('0x26')](function(_0x43388e){_0x47abc5['count']=_0x43388e;if(_0x28af56[_0x23c3('0x35')][_0x23c3('0x43')]){_0xd732d7[_0x23c3('0x44')]=[{'all':!![]}];}return db['Team']['findAll'](_0xd732d7);})[_0x23c3('0x26')](function(_0x25f42d){_0x47abc5[_0x23c3('0x45')]=_0x25f42d;return _0x47abc5;})[_0x23c3('0x26')](respondWithFilteredResult(_0x12b8be,_0xd732d7))[_0x23c3('0x46')](handleError(_0x12b8be,null));};exports[_0x23c3('0x47')]=function(_0x3bcaad,_0x33b393){var _0xef696c={'raw':![],'where':{'id':_0x3bcaad['params']['id']}},_0x5dfb33={};_0x5dfb33[_0x23c3('0x33')]=_['keys'](db[_0x23c3('0x30')][_0x23c3('0x48')]);_0x5dfb33['query']=_[_0x23c3('0x36')](_0x3bcaad[_0x23c3('0x35')]);_0x5dfb33[_0x23c3('0x37')]=_[_0x23c3('0x49')](_0x5dfb33[_0x23c3('0x33')],_0x5dfb33['query']);_0xef696c[_0x23c3('0x39')]=_[_0x23c3('0x49')](_0x5dfb33['model'],qs['fields'](_0x3bcaad['query']['fields']));_0xef696c[_0x23c3('0x39')]=_0xef696c[_0x23c3('0x39')][_0x23c3('0x3a')]?_0xef696c[_0x23c3('0x39')]:_0x5dfb33[_0x23c3('0x33')];if(_0x3bcaad[_0x23c3('0x35')][_0x23c3('0x43')]){_0xef696c[_0x23c3('0x44')]=[{'all':!![]}];}_0xef696c=_['merge']({},_0xef696c,_0x3bcaad[_0x23c3('0x42')]);return db['Team'][_0x23c3('0x4a')](_0xef696c)[_0x23c3('0x26')](handleEntityNotFound(_0x33b393,null))['then'](respondWithResult(_0x33b393,null))[_0x23c3('0x46')](handleError(_0x33b393,null));};exports[_0x23c3('0x4b')]=function(_0x13d2e1,_0x20a08b){return db[_0x23c3('0x30')][_0x23c3('0x4b')](_0x13d2e1['body'],{})['then'](function(_0xcb8172){var _0x2550e8=_0x13d2e1['user'][_0x23c3('0x28')]({'plain':!![]});if(!_0x2550e8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2550e8[_0x23c3('0x4c')]==='user'){var _0x5a7701=_0xcb8172[_0x23c3('0x28')]({'plain':!![]});var _0x18f28d=_0x23c3('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x18f28d,'userProfileId':_0x2550e8[_0x23c3('0x4d')]},'raw':!![]})[_0x23c3('0x26')](function(_0x4ae18e){if(_0x4ae18e&&_0x4ae18e['autoAssociation']===0x0){return db['UserProfileResource'][_0x23c3('0x4b')]({'name':_0x5a7701['name'],'resourceId':_0x5a7701['id'],'type':_0x4ae18e[_0x23c3('0x2d')],'sectionId':_0x4ae18e['id']},{})[_0x23c3('0x26')](function(){return _0xcb8172;});}else{return _0xcb8172;}})[_0x23c3('0x46')](function(_0x40f444){logger[_0x23c3('0x2b')](_0x23c3('0x4e'),_0x40f444);throw _0x40f444;});}return _0xcb8172;})['then'](respondWithResult(_0x20a08b,0xc9))['catch'](handleError(_0x20a08b,null));};exports[_0x23c3('0x4f')]=function(_0x479d90,_0x5f31ca){if(_0x479d90[_0x23c3('0x50')]['id']){delete _0x479d90[_0x23c3('0x50')]['id'];}return db['Team'][_0x23c3('0x4a')]({'where':{'id':_0x479d90[_0x23c3('0x51')]['id']}})[_0x23c3('0x26')](handleEntityNotFound(_0x5f31ca,null))['then'](saveUpdates(_0x479d90['body'],null))[_0x23c3('0x26')](respondWithResult(_0x5f31ca,null))['catch'](handleError(_0x5f31ca,null));};exports[_0x23c3('0x27')]=function(_0x1c17d6,_0x41aadd){return db[_0x23c3('0x30')][_0x23c3('0x4a')]({'where':{'id':_0x1c17d6[_0x23c3('0x51')]['id']}})[_0x23c3('0x26')](handleEntityNotFound(_0x41aadd,null))[_0x23c3('0x26')](removeEntity(_0x41aadd,null))[_0x23c3('0x46')](handleError(_0x41aadd,null));};exports[_0x23c3('0x52')]=function(_0xafde77,_0x5df662,_0xb6734){return db[_0x23c3('0x30')]['findOne']({'where':{'id':_0xafde77[_0x23c3('0x51')]['id']}})[_0x23c3('0x26')](handleEntityNotFound(_0x5df662,null))[_0x23c3('0x26')](function(_0x5eeefb){if(!_0xafde77[_0x23c3('0x35')]['channel']||!utils[_0x23c3('0x53')](_0xafde77[_0x23c3('0x35')]['channel'])){throw new db[(_0x23c3('0x54'))]['ValidationError'](_0x23c3('0x55'));}var _0x11c837={};var _0x154619={};_0x154619[_0x23c3('0x33')]=_['keys'](db[_['capitalize'](_0xafde77['query']['channel'][_0x23c3('0x56')]())+_0x23c3('0x57')][_0x23c3('0x48')]);_0x154619[_0x23c3('0x35')]=_[_0x23c3('0x36')](_0xafde77[_0x23c3('0x35')]);_0x154619[_0x23c3('0x37')]=_[_0x23c3('0x49')](_0x154619[_0x23c3('0x33')],_0x154619[_0x23c3('0x35')]);_0x11c837[_0x23c3('0x39')]=_[_0x23c3('0x49')](_0x154619[_0x23c3('0x33')],qs[_0x23c3('0x38')](_0xafde77[_0x23c3('0x35')]['fields']));_0x11c837[_0x23c3('0x39')]=_0x11c837[_0x23c3('0x39')]['length']?_0x11c837['attributes']:_0x154619['model'];_0x11c837[_0x23c3('0x22')]=qs[_0x23c3('0x22')](_0xafde77['query']['limit']);_0x11c837[_0x23c3('0x21')]=qs[_0x23c3('0x21')](_0xafde77['query']['offset']);_0x11c837[_0x23c3('0x58')]=qs[_0x23c3('0x3c')](_0xafde77[_0x23c3('0x35')][_0x23c3('0x3c')]);_0x11c837[_0x23c3('0x3d')]=qs[_0x23c3('0x37')](_[_0x23c3('0x3e')](_0xafde77[_0x23c3('0x35')],_0x154619[_0x23c3('0x37')]));_0x11c837=_[_0x23c3('0x3f')]({},_0x11c837,_0xafde77['options']);return _0x5eeefb['get'+_['capitalize'](_0xafde77['query'][_0x23c3('0x59')][_0x23c3('0x56')]())+_0x23c3('0x5a')](_0x11c837);})[_0x23c3('0x26')](respondWithResult(_0x5df662,null))[_0x23c3('0x46')](handleError(_0x5df662,null));};exports[_0x23c3('0x5b')]=function(_0xa850e3,_0x5016ae,_0x1fc2e1){return db[_0x23c3('0x30')]['findOne']({'where':{'id':_0xa850e3[_0x23c3('0x51')]['id']}})['then'](function(_0x3abcbc){if(_0x3abcbc){if(!_0xa850e3[_0x23c3('0x50')]['channel']||!utils[_0x23c3('0x53')](_0xa850e3['body'][_0x23c3('0x59')])){throw new db['Sequelize'][(_0x23c3('0x5c'))](_0x23c3('0x55'));}return _0x3abcbc['add'+_[_0x23c3('0x5d')](_0xa850e3['body'][_0x23c3('0x59')][_0x23c3('0x56')]())+_0x23c3('0x5a')](_0xa850e3[_0x23c3('0x50')][_0x23c3('0x5e')]);}return null;})[_0x23c3('0x26')](handleEntityNotFound(_0x5016ae,null))[_0x23c3('0x26')](respondWithStatusCode(_0x5016ae,null))[_0x23c3('0x46')](handleError(_0x5016ae,null));};exports[_0x23c3('0x5f')]=function(_0x193b8f,_0x209369,_0x181c40){return db['Team'][_0x23c3('0x60')]({'where':{'id':_0x193b8f[_0x23c3('0x51')]['id']}})[_0x23c3('0x26')](function(_0x42225f){if(_0x42225f){if(!_0x193b8f[_0x23c3('0x35')]['channel']||!utils[_0x23c3('0x53')](_0x193b8f[_0x23c3('0x35')][_0x23c3('0x59')])){throw new db[(_0x23c3('0x54'))][(_0x23c3('0x5c'))](_0x23c3('0x55'));}return _0x42225f[_0x23c3('0x61')+_[_0x23c3('0x5d')](_0x193b8f[_0x23c3('0x35')][_0x23c3('0x59')][_0x23c3('0x56')]())+'Queues'](_0x193b8f['query'][_0x23c3('0x5e')]);}return null;})[_0x23c3('0x26')](handleEntityNotFound(_0x209369,null))[_0x23c3('0x26')](respondWithStatusCode(_0x209369,null))['catch'](handleError(_0x209369,null));};exports[_0x23c3('0x62')]=function(_0x2472b4,_0x5027e1,_0x1c8f9b){return db[_0x23c3('0x30')][_0x23c3('0x4a')]({'where':{'id':_0x2472b4[_0x23c3('0x51')]['id']}})[_0x23c3('0x26')](handleEntityNotFound(_0x5027e1,null))['then'](function(_0x48d1dc){if(_0x48d1dc){var _0x3da3db=[_0x23c3('0x63'),_0x23c3('0x64'),_0x23c3('0x65'),'Sms','Fax','Openchannel'];return BPromise[_0x23c3('0x66')](_0x3da3db,function(_0x1dc0ef){return _0x48d1dc[_0x23c3('0x28')+_0x1dc0ef+'Queues']({'attributes':['id',_0x23c3('0x2d')]})[_0x23c3('0x26')](function(_0x153c3c){return BPromise[_0x23c3('0x66')](_0x153c3c,function(_0x542e48){return _0x542e48['addAgents'](_0x2472b4[_0x23c3('0x50')]['ids'])[_0x23c3('0x26')](function(){if(_0x1dc0ef===_0x23c3('0x63')){return db['User'][_0x23c3('0x67')]({'where':{'id':_0x2472b4[_0x23c3('0x50')][_0x23c3('0x5e')]},'attributes':['id','name','online',_0x23c3('0x68'),_0x23c3('0x69')],'raw':!![]})['then'](function(_0x3c74e0){return BPromise['each'](_['filter'](_0x3c74e0,{'online':0x1}),function(_0x5132f7){return db[_0x23c3('0x6a')]['upsert']({'membername':_0x5132f7[_0x23c3('0x2d')],'UserId':_0x5132f7['id'],'queue_name':_0x542e48[_0x23c3('0x2d')],'VoiceQueueId':_0x542e48['id'],'interface':_[_0x23c3('0x6b')](_0x5132f7[_0x23c3('0x69')])?util['format'](_0x23c3('0x6c'),_0x5132f7[_0x23c3('0x2d')]):_0x5132f7['interface'],'paused':_0x5132f7[_0x23c3('0x68')]||![],'penalty':0x0});});});}});});})[_0x23c3('0x26')](function(){return _0x48d1dc;});})[_0x23c3('0x26')](function(){return _0x48d1dc;});}})[_0x23c3('0x26')](function(_0x1d252c){if(_0x1d252c){return _0x1d252c[_0x23c3('0x62')](_0x2472b4[_0x23c3('0x50')][_0x23c3('0x5e')],_[_0x23c3('0x6d')](_0x2472b4[_0x23c3('0x50')],['ids','id'])||{})[_0x23c3('0x6e')](function(_0x3ef0fb){for(var _0x514db2=0x0;_0x514db2<_0x2472b4['body'][_0x23c3('0x5e')][_0x23c3('0x3a')];_0x514db2+=0x1){socket['emit'](_0x23c3('0x6f'),{'UserId':_0x2472b4[_0x23c3('0x50')][_0x23c3('0x5e')][_0x514db2],'TeamId':_0x2472b4[_0x23c3('0x51')]['id']});}return _0x3ef0fb;});}})[_0x23c3('0x26')](respondWithResult(_0x5027e1,null))['catch'](handleError(_0x5027e1,null));};exports['removeAgents']=function(_0x10364f,_0x10305b,_0x3ec4af){return db[_0x23c3('0x30')][_0x23c3('0x4a')]({'where':{'id':_0x10364f['params']['id']}})[_0x23c3('0x26')](handleEntityNotFound(_0x10305b,null))[_0x23c3('0x26')](function(_0x14f9b5){if(_0x14f9b5){return BPromise[_0x23c3('0x66')]([_0x23c3('0x70'),'chat',_0x23c3('0x71'),_0x23c3('0x72'),_0x23c3('0x73'),_0x23c3('0x74')],function(_0x589ed2){return _0x14f9b5[_0x23c3('0x28')+_[_0x23c3('0x5d')](_0x589ed2)+'Queues']({'attributes':['id',_0x23c3('0x2d')]})[_0x23c3('0x26')](function(_0x5344ef){return BPromise[_0x23c3('0x66')](_0x5344ef,function(_0xf34f22){return _0xf34f22[_0x23c3('0x75')](_0x10364f['query'][_0x23c3('0x5e')])['then'](function(){if(_0x589ed2==='voice'){return db[_0x23c3('0x6a')][_0x23c3('0x27')]({'where':{'VoiceQueueId':_0xf34f22['id'],'UserId':_0x10364f[_0x23c3('0x35')][_0x23c3('0x5e')]}});}});});})[_0x23c3('0x26')](function(){return _0x14f9b5;});})[_0x23c3('0x26')](function(){return _0x14f9b5;});}})[_0x23c3('0x26')](function(_0x379ea4){if(_0x379ea4){return _0x379ea4[_0x23c3('0x75')](_0x10364f[_0x23c3('0x35')][_0x23c3('0x5e')])['then'](function(){if(_[_0x23c3('0x76')](_0x10364f['query'][_0x23c3('0x5e')])){for(var _0x2e4ebf=0x0;_0x2e4ebf<_0x10364f[_0x23c3('0x35')][_0x23c3('0x5e')][_0x23c3('0x3a')];_0x2e4ebf+=0x1){socket['emit'](_0x23c3('0x77'),{'UserId':Number(_0x10364f[_0x23c3('0x35')][_0x23c3('0x5e')][_0x2e4ebf]),'TeamId':Number(_0x10364f['params']['id'])});}}else{socket[_0x23c3('0x78')]('userTeam:remove',{'UserId':Number(_0x10364f['query']['ids']),'TeamId':Number(_0x10364f[_0x23c3('0x51')]['id'])});}});}})[_0x23c3('0x26')](respondWithStatusCode(_0x10305b,null))[_0x23c3('0x46')](handleError(_0x10305b,null));};exports[_0x23c3('0x79')]=function(_0x1677ec,_0x52c519,_0x179b69){var _0xb0e9ad={};var _0x1f3e9c={};var _0x5e9c53;var _0x384f13;return db[_0x23c3('0x30')][_0x23c3('0x60')]({'where':{'id':_0x1677ec[_0x23c3('0x51')]['id']}})['then'](handleEntityNotFound(_0x52c519,null))[_0x23c3('0x26')](function(_0x456ffc){if(_0x456ffc){_0x5e9c53=_0x456ffc;_0x1f3e9c[_0x23c3('0x33')]=_[_0x23c3('0x36')](db[_0x23c3('0x7a')][_0x23c3('0x48')]);_0x1f3e9c[_0x23c3('0x35')]=_['keys'](_0x1677ec[_0x23c3('0x35')]);_0x1f3e9c[_0x23c3('0x37')]=_[_0x23c3('0x49')](_0x1f3e9c[_0x23c3('0x33')],_0x1f3e9c['query']);_0xb0e9ad[_0x23c3('0x39')]=_[_0x23c3('0x49')](_0x1f3e9c['model'],qs[_0x23c3('0x38')](_0x1677ec['query'][_0x23c3('0x38')]));_0xb0e9ad['attributes']=_0xb0e9ad[_0x23c3('0x39')]['length']?_0xb0e9ad[_0x23c3('0x39')]:_0x1f3e9c[_0x23c3('0x33')];_0xb0e9ad['order']=qs[_0x23c3('0x3c')](_0x1677ec[_0x23c3('0x35')][_0x23c3('0x3c')]);_0xb0e9ad[_0x23c3('0x3d')]=qs['filters'](_['pick'](_0x1677ec[_0x23c3('0x35')],_0x1f3e9c['filters']));if(_0x1677ec['query']['filter']){_0xb0e9ad[_0x23c3('0x3d')]=_[_0x23c3('0x3f')](_0xb0e9ad[_0x23c3('0x3d')],{'$or':_[_0x23c3('0x34')](_0xb0e9ad[_0x23c3('0x39')],function(_0x525fa6){var _0x1f47fe={};_0x1f47fe[_0x525fa6]={'$like':'%'+_0x1677ec[_0x23c3('0x35')][_0x23c3('0x41')]+'%'};return _0x1f47fe;})});}_0xb0e9ad=_['merge']({},_0xb0e9ad,_0x1677ec['options']);return _0x5e9c53[_0x23c3('0x79')](_0xb0e9ad);}})[_0x23c3('0x26')](function(_0x30227f){if(_0x30227f){_0x384f13=_0x30227f[_0x23c3('0x3a')];if(!_0x1677ec[_0x23c3('0x35')][_0x23c3('0x7b')](_0x23c3('0x3b'))){_0xb0e9ad['limit']=qs['limit'](_0x1677ec['query']['limit']);_0xb0e9ad[_0x23c3('0x21')]=qs[_0x23c3('0x21')](_0x1677ec[_0x23c3('0x35')][_0x23c3('0x21')]);}return _0x5e9c53['getAgents'](_0xb0e9ad);}})[_0x23c3('0x26')](function(_0x54d59d){if(_0x54d59d){return _0x54d59d?{'count':_0x384f13,'rows':_0x54d59d}:null;}})[_0x23c3('0x26')](respondWithResult(_0x52c519,null))[_0x23c3('0x46')](handleError(_0x52c519,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 1cac7ec..405b291 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 _0xd920=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Team','save'];(function(_0x5d33fb,_0x5bf99e){var _0x11733a=function(_0x10b543){while(--_0x10b543){_0x5d33fb['push'](_0x5d33fb['shift']());}};_0x11733a(++_0x5bf99e);}(_0xd920,0x176));var _0x0d92=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xd920[_0xd1d19a];return _0x52a79d;};'use strict';var EventEmitter=require(_0x0d92('0x0'));var Team=require(_0x0d92('0x1'))['db'][_0x0d92('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0d92('0x3'),'afterUpdate':_0x0d92('0x4'),'afterDestroy':_0x0d92('0x5')};function emitEvent(_0x5c51a3){return function(_0x50521e,_0x4d81b1,_0x55896b){TeamEvents[_0x0d92('0x6')](_0x5c51a3+':'+_0x50521e['id'],_0x50521e);TeamEvents[_0x0d92('0x6')](_0x5c51a3,_0x50521e);_0x55896b(null);};}for(var e in events){if(events[_0x0d92('0x7')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x0d92('0x8')]=TeamEvents; \ No newline at end of file +var _0x906e=['remove','emit','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x906e,0x90));var _0xe906=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0x906e[_0x3b56c0];return _0x377efe;};'use strict';var EventEmitter=require(_0xe906('0x0'));var Team=require(_0xe906('0x1'))['db'][_0xe906('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xe906('0x3')](0x0);var events={'afterCreate':_0xe906('0x4'),'afterUpdate':_0xe906('0x5'),'afterDestroy':_0xe906('0x6')};function emitEvent(_0x5a8bda){return function(_0x4958a7,_0x17c189,_0x5b4913){TeamEvents['emit'](_0x5a8bda+':'+_0x4958a7['id'],_0x4958a7);TeamEvents[_0xe906('0x7')](_0x5a8bda,_0x4958a7);_0x5b4913(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xe906('0x8')](e,emitEvent(event));}}module[_0xe906('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 7e6651c..7bd4476 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 _0x77ff=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','./team.attributes','exports','define','Team','teams','lodash'];(function(_0x59f33b,_0x364766){var _0x17822e=function(_0x4580ae){while(--_0x4580ae){_0x59f33b['push'](_0x59f33b['shift']());}};_0x17822e(++_0x364766);}(_0x77ff,0x67));var _0xf77f=function(_0x122e03,_0x4d1dca){_0x122e03=_0x122e03-0x0;var _0x22d881=_0x77ff[_0x122e03];return _0x22d881;};'use strict';var _=require(_0xf77f('0x0'));var util=require(_0xf77f('0x1'));var logger=require(_0xf77f('0x2'))(_0xf77f('0x3'));var moment=require('moment');var BPromise=require(_0xf77f('0x4'));var rp=require(_0xf77f('0x5'));var fs=require('fs');var path=require(_0xf77f('0x6'));var rimraf=require(_0xf77f('0x7'));var config=require('../../config/environment');var attributes=require(_0xf77f('0x8'));module[_0xf77f('0x9')]=function(_0xa178bc,_0x4ac732){return _0xa178bc[_0xf77f('0xa')](_0xf77f('0xb'),attributes,{'tableName':_0xf77f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafa6=['bluebird','request-promise','path','./team.attributes','define','Team','lodash','util','api'];(function(_0x5c0295,_0x585046){var _0x202650=function(_0x20b2dc){while(--_0x20b2dc){_0x5c0295['push'](_0x5c0295['shift']());}};_0x202650(++_0x585046);}(_0xafa6,0x1a4));var _0x6afa=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xafa6[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x6afa('0x0'));var util=require(_0x6afa('0x1'));var logger=require('../../config/logger')(_0x6afa('0x2'));var moment=require('moment');var BPromise=require(_0x6afa('0x3'));var rp=require(_0x6afa('0x4'));var fs=require('fs');var path=require(_0x6afa('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6afa('0x6'));module['exports']=function(_0x5e3434,_0x2b9b23){return _0x5e3434[_0x6afa('0x7')](_0x6afa('0x8'),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 3ce4129..44cea62 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 _0x6f1f=['../../mysqldb','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./team.socket','register','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6f1f,0x199));var _0xf6f1=function(_0x5a2756,_0x15725e){_0x5a2756=_0x5a2756-0x0;var _0x32b200=_0x6f1f[_0x5a2756];return _0x32b200;};'use strict';var _=require('lodash');var util=require(_0xf6f1('0x0'));var moment=require(_0xf6f1('0x1'));var BPromise=require(_0xf6f1('0x2'));var rs=require(_0xf6f1('0x3'));var fs=require('fs');var Redis=require(_0xf6f1('0x4'));var db=require(_0xf6f1('0x5'))['db'];var utils=require(_0xf6f1('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xf6f1('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xf6f1('0x8')]=_['defaults'](config[_0xf6f1('0x8')],{'host':_0xf6f1('0x9'),'port':0x18eb});var socket=require(_0xf6f1('0xa'))(new Redis(config['redis']));require(_0xf6f1('0xb'))[_0xf6f1('0xc')](socket);function respondWithRpcPromise(_0x5cb9a3,_0x32f7ab,_0x26d418){return new BPromise(function(_0x45b43a,_0x404114){return client['request'](_0x5cb9a3,_0x26d418)['then'](function(_0x2284e3){logger[_0xf6f1('0xd')](_0xf6f1('0xe'),_0x32f7ab,_0xf6f1('0xf'));logger[_0xf6f1('0x10')](_0xf6f1('0x11'),_0x32f7ab,_0xf6f1('0xf'),JSON[_0xf6f1('0x12')](_0x2284e3));if(_0x2284e3[_0xf6f1('0x13')]){if(_0x2284e3['error']['code']===0x1f4){logger['error'](_0xf6f1('0xe'),_0x32f7ab,_0x2284e3[_0xf6f1('0x13')][_0xf6f1('0x14')]);return _0x404114(_0x2284e3['error'][_0xf6f1('0x14')]);}logger[_0xf6f1('0x13')](_0xf6f1('0xe'),_0x32f7ab,_0x2284e3[_0xf6f1('0x13')][_0xf6f1('0x14')]);return _0x45b43a(_0x2284e3[_0xf6f1('0x13')][_0xf6f1('0x14')]);}else{logger[_0xf6f1('0xd')](_0xf6f1('0xe'),_0x32f7ab,'request\x20sent');_0x45b43a(_0x2284e3[_0xf6f1('0x15')]['message']);}})[_0xf6f1('0x16')](function(_0x57ee13){logger[_0xf6f1('0x13')]('Team,\x20%s,\x20%s',_0x32f7ab,_0x57ee13);_0x404114(_0x57ee13);});});} \ No newline at end of file +var _0xc3c3=['http','redis','localhost','./team.socket','register','request','info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc3c3,0x74));var _0x3c3c=function(_0x176866,_0x391252){_0x176866=_0x176866-0x0;var _0x1b2a54=_0xc3c3[_0x176866];return _0x1b2a54;};'use strict';var _=require(_0x3c3c('0x0'));var util=require(_0x3c3c('0x1'));var moment=require(_0x3c3c('0x2'));var BPromise=require(_0x3c3c('0x3'));var rs=require(_0x3c3c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3c3c('0x5'));var logger=require(_0x3c3c('0x6'))('rpc');var config=require(_0x3c3c('0x7'));var jayson=require(_0x3c3c('0x8'));var client=jayson['client'][_0x3c3c('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3c3c('0xa')],{'host':_0x3c3c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3c3c('0xc'))[_0x3c3c('0xd')](socket);function respondWithRpcPromise(_0xb09dc2,_0x15404d,_0x31afab){return new BPromise(function(_0x49f531,_0x5dbe7c){return client[_0x3c3c('0xe')](_0xb09dc2,_0x31afab)['then'](function(_0x1a8bb6){logger[_0x3c3c('0xf')](_0x3c3c('0x10'),_0x15404d,'request\x20sent');logger['debug'](_0x3c3c('0x11'),_0x15404d,_0x3c3c('0x12'),JSON[_0x3c3c('0x13')](_0x1a8bb6));if(_0x1a8bb6[_0x3c3c('0x14')]){if(_0x1a8bb6[_0x3c3c('0x14')][_0x3c3c('0x15')]===0x1f4){logger['error'](_0x3c3c('0x10'),_0x15404d,_0x1a8bb6[_0x3c3c('0x14')]['message']);return _0x5dbe7c(_0x1a8bb6[_0x3c3c('0x14')]['message']);}logger['error'](_0x3c3c('0x10'),_0x15404d,_0x1a8bb6['error'][_0x3c3c('0x16')]);return _0x49f531(_0x1a8bb6[_0x3c3c('0x14')]['message']);}else{logger[_0x3c3c('0xf')]('Team,\x20%s,\x20%s',_0x15404d,_0x3c3c('0x12'));_0x49f531(_0x1a8bb6[_0x3c3c('0x17')]['message']);}})[_0x3c3c('0x18')](function(_0xd6a5e5){logger[_0x3c3c('0x14')](_0x3c3c('0x10'),_0x15404d,_0xd6a5e5);_0x5dbe7c(_0xd6a5e5);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index a7a355e..28bedbe 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 _0x5f6f=['save','remove','update','emit','removeListener','register','team:','./team.events'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0xd51d4b,_0x48bc70){_0xd51d4b=_0xd51d4b-0x0;var _0x2afbba=_0x5f6f[_0xd51d4b];return _0x2afbba;};'use strict';var TeamEvents=require(_0xf5f6('0x0'));var events=[_0xf5f6('0x1'),_0xf5f6('0x2'),_0xf5f6('0x3')];function createListener(_0x6ef7d5,_0x524d6f){return function(_0x503723){_0x524d6f[_0xf5f6('0x4')](_0x6ef7d5,_0x503723);};}function removeListener(_0x2f2e00,_0x58028b){return function(){TeamEvents[_0xf5f6('0x5')](_0x2f2e00,_0x58028b);};}exports[_0xf5f6('0x6')]=function(_0x390b1a){for(var _0xfda1c7=0x0,_0x508c02=events['length'];_0xfda1c7<_0x508c02;_0xfda1c7++){var _0xa635ff=events[_0xfda1c7];var _0x2fa090=createListener(_0xf5f6('0x7')+_0xa635ff,_0x390b1a);TeamEvents['on'](_0xa635ff,_0x2fa090);}}; \ No newline at end of file +var _0x524e=['remove','update','emit','removeListener','register','length','team:'];(function(_0x43a7fd,_0xb2af6a){var _0x8547b0=function(_0x51441e){while(--_0x51441e){_0x43a7fd['push'](_0x43a7fd['shift']());}};_0x8547b0(++_0xb2af6a);}(_0x524e,0x15e));var _0xe524=function(_0x2d1b89,_0x5b9055){_0x2d1b89=_0x2d1b89-0x0;var _0x1c830c=_0x524e[_0x2d1b89];return _0x1c830c;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0xe524('0x0'),_0xe524('0x1')];function createListener(_0xc5f6b5,_0x29e619){return function(_0x699159){_0x29e619[_0xe524('0x2')](_0xc5f6b5,_0x699159);};}function removeListener(_0xabd694,_0x32c90b){return function(){TeamEvents[_0xe524('0x3')](_0xabd694,_0x32c90b);};}exports[_0xe524('0x4')]=function(_0x4f75d6){for(var _0xaaeaa9=0x0,_0x41e1a3=events[_0xe524('0x5')];_0xaaeaa9<_0x41e1a3;_0xaaeaa9++){var _0x533c14=events[_0xaaeaa9];var _0x384935=createListener(_0xe524('0x6')+_0x533c14,_0x4f75d6);TeamEvents['on'](_0x533c14,_0x384935);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 5e160a7..d954c33 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 _0xbf5f=['post','create','put','update','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id'];(function(_0x3d726b,_0xd40077){var _0x27a5d0=function(_0x4b5a98){while(--_0x4b5a98){_0x3d726b['push'](_0x3d726b['shift']());}};_0x27a5d0(++_0xd40077);}(_0xbf5f,0x7c));var _0xfbf5=function(_0x34ae9b,_0x5d21b7){_0x34ae9b=_0x34ae9b-0x0;var _0x1bcff9=_0xbf5f[_0x34ae9b];return _0x1bcff9;};'use strict';var multer=require(_0xfbf5('0x0'));var util=require(_0xfbf5('0x1'));var path=require(_0xfbf5('0x2'));var timeout=require('connect-timeout');var express=require(_0xfbf5('0x3'));var router=express[_0xfbf5('0x4')]();var auth=require(_0xfbf5('0x5'));var interaction=require(_0xfbf5('0x6'));var config=require('../../config/environment');var controller=require(_0xfbf5('0x7'));router[_0xfbf5('0x8')]('/',auth[_0xfbf5('0x9')](),controller[_0xfbf5('0xa')]);router[_0xfbf5('0x8')](_0xfbf5('0xb'),auth[_0xfbf5('0x9')](),controller['show']);router[_0xfbf5('0xc')]('/',auth[_0xfbf5('0x9')](),controller[_0xfbf5('0xd')]);router[_0xfbf5('0xe')](_0xfbf5('0xb'),auth[_0xfbf5('0x9')](),controller[_0xfbf5('0xf')]);router['delete'](_0xfbf5('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xfbf5('0x10')]=router; \ No newline at end of file +var _0x303e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','post','update','delete','destroy','exports','util','path'];(function(_0xfa9b97,_0x24a570){var _0x48cc61=function(_0x49a365){while(--_0x49a365){_0xfa9b97['push'](_0xfa9b97['shift']());}};_0x48cc61(++_0x24a570);}(_0x303e,0x185));var _0xe303=function(_0x45085a,_0x4f12c4){_0x45085a=_0x45085a-0x0;var _0x249b7b=_0x303e[_0x45085a];return _0x249b7b;};'use strict';var multer=require('multer');var util=require(_0xe303('0x0'));var path=require(_0xe303('0x1'));var timeout=require(_0xe303('0x2'));var express=require(_0xe303('0x3'));var router=express[_0xe303('0x4')]();var auth=require(_0xe303('0x5'));var interaction=require(_0xe303('0x6'));var config=require(_0xe303('0x7'));var controller=require(_0xe303('0x8'));router[_0xe303('0x9')]('/',auth[_0xe303('0xa')](),controller['index']);router[_0xe303('0x9')](_0xe303('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe303('0xc')]('/',auth[_0xe303('0xa')](),controller['create']);router['put'](_0xe303('0xb'),auth[_0xe303('0xa')](),controller[_0xe303('0xd')]);router[_0xe303('0xe')](_0xe303('0xb'),auth['isAuthenticated'](),controller[_0xe303('0xf')]);module[_0xe303('0x10')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 226fa71..d5e0236 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 _0x127a=['sequelize','STRING','TEXT'];(function(_0x45b9f4,_0x31ebdc){var _0x55d30e=function(_0x338c85){while(--_0x338c85){_0x45b9f4['push'](_0x45b9f4['shift']());}};_0x55d30e(++_0x31ebdc);}(_0x127a,0x12f));var _0xa127=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x127a[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require(_0xa127('0x0'));module['exports']={'name':{'type':Sequelize[_0xa127('0x1')]},'description':{'type':Sequelize[_0xa127('0x1')]},'html':{'type':Sequelize[_0xa127('0x2')]}}; \ No newline at end of file +var _0x9f49=['sequelize','exports','STRING','TEXT'];(function(_0x29c33d,_0x4bc7d1){var _0x4fe384=function(_0x25f63f){while(--_0x25f63f){_0x29c33d['push'](_0x29c33d['shift']());}};_0x4fe384(++_0x4bc7d1);}(_0x9f49,0x1b0));var _0x99f4=function(_0xc7b94e,_0x1112b6){_0xc7b94e=_0xc7b94e-0x0;var _0x489b82=_0x9f49[_0xc7b94e];return _0x489b82;};'use strict';var Sequelize=require(_0x99f4('0x0'));module[_0x99f4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x99f4('0x2')]},'html':{'type':Sequelize[_0x99f4('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 07a7116..c6613b7 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 _0xdb67=['save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','Template','fieldName','type','query','keys','filters','intersection','model','attributes','nolimit','limit','sort','filter','where','merge','options','includeAll','findAll','catch','show','params','fields','length','include','find','create','role','user','Templates','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply'];(function(_0x24e951,_0x544ac7){var _0x554280=function(_0x1c38af){while(--_0x1c38af){_0x24e951['push'](_0x24e951['shift']());}};_0x554280(++_0x544ac7);}(_0xdb67,0x1be));var _0x7db6=function(_0x2aceb1,_0x58297c){_0x2aceb1=_0x2aceb1-0x0;var _0x27ac91=_0xdb67[_0x2aceb1];return _0x27ac91;};'use strict';var pdf=require(_0x7db6('0x0'));var emlformat=require(_0x7db6('0x1'));var rimraf=require(_0x7db6('0x2'));var zipdir=require(_0x7db6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7db6('0x4'));var moment=require(_0x7db6('0x5'));var BPromise=require(_0x7db6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7db6('0x7'));var sox=require('sox');var csv=require(_0x7db6('0x8'));var ejs=require(_0x7db6('0x9'));var fs=require('fs');var _=require(_0x7db6('0xa'));var squel=require(_0x7db6('0xb'));var crypto=require(_0x7db6('0xc'));var jsforce=require(_0x7db6('0xd'));var deskjs=require(_0x7db6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7db6('0xf'));var Papa=require(_0x7db6('0x10'));var Redis=require(_0x7db6('0x11'));var authService=require(_0x7db6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7db6('0x13'));var hardwareService=require(_0x7db6('0x14'));var logger=require(_0x7db6('0x15'))(_0x7db6('0x16'));var utils=require(_0x7db6('0x17'));var config=require(_0x7db6('0x18'));var db=require(_0x7db6('0x19'))['db'];function respondWithStatusCode(_0x38aa35,_0x514b05){_0x514b05=_0x514b05||0xcc;return function(_0x41fe78){if(_0x41fe78){return _0x38aa35[_0x7db6('0x1a')](_0x514b05);}return _0x38aa35['status'](_0x514b05)['end']();};}function respondWithResult(_0x28f169,_0x4886b3){_0x4886b3=_0x4886b3||0xc8;return function(_0x2cf8e3){if(_0x2cf8e3){return _0x28f169[_0x7db6('0x1b')](_0x4886b3)[_0x7db6('0x1c')](_0x2cf8e3);}};}function respondWithFilteredResult(_0x586dc4,_0x60860){return function(_0x8a90f8){if(_0x8a90f8){var _0x2f3fa2=_0x8a90f8[_0x7db6('0x1d')],_0x2b8c03=_0x60860[_0x7db6('0x1e')],_0x1497bc=_0x60860[_0x7db6('0x1e')]+_0x60860['limit'],_0x347df7;if(_0x1497bc>=_0x2f3fa2){_0x1497bc=_0x2f3fa2;_0x347df7=0xc8;}else{_0x347df7=0xce;}_0x586dc4[_0x7db6('0x1b')](_0x347df7);return _0x586dc4[_0x7db6('0x1f')](_0x7db6('0x20'),_0x2b8c03+'-'+_0x1497bc+'/'+_0x2f3fa2)[_0x7db6('0x1c')](_0x8a90f8);}return null;};}function patchUpdates(_0x235514){return function(_0x48ef2e){try{jsonpatch[_0x7db6('0x21')](_0x48ef2e,_0x235514,!![]);}catch(_0x4cd738){return BPromise['reject'](_0x4cd738);}return _0x48ef2e[_0x7db6('0x22')]();};}function saveUpdates(_0x1cd597,_0x46ac28){return function(_0x2ca2ba){if(_0x2ca2ba){return _0x2ca2ba[_0x7db6('0x23')](_0x1cd597)[_0x7db6('0x24')](function(_0x14d707){return _0x14d707;});}return null;};}function removeEntity(_0xaf6193,_0x17d4e3){return function(_0x2e5124){if(_0x2e5124){return _0x2e5124[_0x7db6('0x25')]()[_0x7db6('0x24')](function(){var _0x2434a1=_0x2e5124[_0x7db6('0x26')]({'plain':!![]});var _0x14cc54='Templates';return db[_0x7db6('0x27')]['destroy']({'where':{'type':_0x14cc54,'resourceId':_0x2434a1['id']}})[_0x7db6('0x24')](function(){return _0x2e5124;});})[_0x7db6('0x24')](function(){_0xaf6193[_0x7db6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2da26d,_0x38d28e){return function(_0x1e77ae){if(!_0x1e77ae){_0x2da26d[_0x7db6('0x1a')](0x194);}return _0x1e77ae;};}function handleError(_0x530869,_0xd757e3){_0xd757e3=_0xd757e3||0x1f4;return function(_0x48a399){logger[_0x7db6('0x28')](_0x48a399[_0x7db6('0x29')]);if(_0x48a399['name']){delete _0x48a399[_0x7db6('0x2a')];}_0x530869[_0x7db6('0x1b')](_0xd757e3)[_0x7db6('0x2b')](_0x48a399);};}exports[_0x7db6('0x2c')]=function(_0x2ac71a,_0x56faa0){var _0x2dbbb7={},_0x42fea2={},_0x2399ca={'count':0x0,'rows':[]};var _0x146cca=_[_0x7db6('0x2d')](db[_0x7db6('0x2e')]['rawAttributes'],function(_0x349952){return{'name':_0x349952[_0x7db6('0x2f')],'type':_0x349952[_0x7db6('0x30')]['key']};});_0x42fea2['model']=_[_0x7db6('0x2d')](_0x146cca,_0x7db6('0x2a'));_0x42fea2[_0x7db6('0x31')]=_[_0x7db6('0x32')](_0x2ac71a[_0x7db6('0x31')]);_0x42fea2[_0x7db6('0x33')]=_[_0x7db6('0x34')](_0x42fea2[_0x7db6('0x35')],_0x42fea2[_0x7db6('0x31')]);_0x2dbbb7[_0x7db6('0x36')]=_[_0x7db6('0x34')](_0x42fea2[_0x7db6('0x35')],qs['fields'](_0x2ac71a['query']['fields']));_0x2dbbb7['attributes']=_0x2dbbb7[_0x7db6('0x36')]['length']?_0x2dbbb7[_0x7db6('0x36')]:_0x42fea2[_0x7db6('0x35')];if(!_0x2ac71a[_0x7db6('0x31')]['hasOwnProperty'](_0x7db6('0x37'))){_0x2dbbb7[_0x7db6('0x38')]=qs[_0x7db6('0x38')](_0x2ac71a[_0x7db6('0x31')]['limit']);_0x2dbbb7[_0x7db6('0x1e')]=qs[_0x7db6('0x1e')](_0x2ac71a[_0x7db6('0x31')][_0x7db6('0x1e')]);}_0x2dbbb7['order']=qs[_0x7db6('0x39')](_0x2ac71a[_0x7db6('0x31')][_0x7db6('0x39')]);_0x2dbbb7['where']=qs[_0x7db6('0x33')](_['pick'](_0x2ac71a[_0x7db6('0x31')],_0x42fea2['filters']));if(_0x2ac71a[_0x7db6('0x31')][_0x7db6('0x3a')]){_0x2dbbb7[_0x7db6('0x3b')]=_[_0x7db6('0x3c')](_0x2dbbb7[_0x7db6('0x3b')],{'$or':_[_0x7db6('0x2d')](_0x146cca,function(_0x120dc0){if(_0x120dc0[_0x7db6('0x30')]!=='VIRTUAL'){var _0x529352={};_0x529352[_0x120dc0[_0x7db6('0x2a')]]={'$like':'%'+_0x2ac71a[_0x7db6('0x31')][_0x7db6('0x3a')]+'%'};return _0x529352;}})});}_0x2dbbb7=_[_0x7db6('0x3c')]({},_0x2dbbb7,_0x2ac71a[_0x7db6('0x3d')]);var _0x5ac999={'where':_0x2dbbb7[_0x7db6('0x3b')]};return db[_0x7db6('0x2e')]['count'](_0x5ac999)[_0x7db6('0x24')](function(_0x43480b){_0x2399ca['count']=_0x43480b;if(_0x2ac71a['query'][_0x7db6('0x3e')]){_0x2dbbb7['include']=[{'all':!![]}];}return db[_0x7db6('0x2e')][_0x7db6('0x3f')](_0x2dbbb7);})[_0x7db6('0x24')](function(_0x5d41cd){_0x2399ca['rows']=_0x5d41cd;return _0x2399ca;})[_0x7db6('0x24')](respondWithFilteredResult(_0x56faa0,_0x2dbbb7))[_0x7db6('0x40')](handleError(_0x56faa0,null));};exports[_0x7db6('0x41')]=function(_0x3f411e,_0x375567){var _0x4fb522={'raw':!![],'where':{'id':_0x3f411e[_0x7db6('0x42')]['id']}},_0x159141={};_0x159141[_0x7db6('0x35')]=_[_0x7db6('0x32')](db['Template']['rawAttributes']);_0x159141['query']=_[_0x7db6('0x32')](_0x3f411e['query']);_0x159141['filters']=_[_0x7db6('0x34')](_0x159141['model'],_0x159141[_0x7db6('0x31')]);_0x4fb522[_0x7db6('0x36')]=_[_0x7db6('0x34')](_0x159141[_0x7db6('0x35')],qs[_0x7db6('0x43')](_0x3f411e[_0x7db6('0x31')]['fields']));_0x4fb522[_0x7db6('0x36')]=_0x4fb522[_0x7db6('0x36')][_0x7db6('0x44')]?_0x4fb522['attributes']:_0x159141['model'];if(_0x3f411e[_0x7db6('0x31')]['includeAll']){_0x4fb522[_0x7db6('0x45')]=[{'all':!![]}];}_0x4fb522=_['merge']({},_0x4fb522,_0x3f411e['options']);return db[_0x7db6('0x2e')][_0x7db6('0x46')](_0x4fb522)[_0x7db6('0x24')](handleEntityNotFound(_0x375567,null))[_0x7db6('0x24')](respondWithResult(_0x375567,null))[_0x7db6('0x40')](handleError(_0x375567,null));};exports[_0x7db6('0x47')]=function(_0x4704e1,_0x3a6897){return db[_0x7db6('0x2e')][_0x7db6('0x47')](_0x4704e1['body'],{})['then'](function(_0xa630a3){var _0x4fcff0=_0x4704e1['user'][_0x7db6('0x26')]({'plain':!![]});if(!_0x4fcff0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4fcff0[_0x7db6('0x48')]===_0x7db6('0x49')){var _0x121f5f=_0xa630a3[_0x7db6('0x26')]({'plain':!![]});var _0x4c5156=_0x7db6('0x4a');return db[_0x7db6('0x4b')]['find']({'where':{'name':_0x4c5156,'userProfileId':_0x4fcff0[_0x7db6('0x4c')]},'raw':!![]})[_0x7db6('0x24')](function(_0x464ee6){if(_0x464ee6&&_0x464ee6[_0x7db6('0x4d')]===0x0){return db[_0x7db6('0x27')][_0x7db6('0x47')]({'name':_0x121f5f['name'],'resourceId':_0x121f5f['id'],'type':_0x464ee6[_0x7db6('0x2a')],'sectionId':_0x464ee6['id']},{})[_0x7db6('0x24')](function(){return _0xa630a3;});}else{return _0xa630a3;}})[_0x7db6('0x40')](function(_0x94995b){logger[_0x7db6('0x28')](_0x7db6('0x4e'),_0x94995b);throw _0x94995b;});}return _0xa630a3;})[_0x7db6('0x24')](respondWithResult(_0x3a6897,0xc9))[_0x7db6('0x40')](handleError(_0x3a6897,null));};exports[_0x7db6('0x23')]=function(_0x2087dd,_0x551ae9){if(_0x2087dd[_0x7db6('0x4f')]['id']){delete _0x2087dd['body']['id'];}return db[_0x7db6('0x2e')][_0x7db6('0x46')]({'where':{'id':_0x2087dd['params']['id']}})[_0x7db6('0x24')](handleEntityNotFound(_0x551ae9,null))[_0x7db6('0x24')](saveUpdates(_0x2087dd[_0x7db6('0x4f')],null))[_0x7db6('0x24')](respondWithResult(_0x551ae9,null))[_0x7db6('0x40')](handleError(_0x551ae9,null));};exports[_0x7db6('0x25')]=function(_0x41f441,_0x359139){return db[_0x7db6('0x2e')][_0x7db6('0x46')]({'where':{'id':_0x41f441[_0x7db6('0x42')]['id']}})[_0x7db6('0x24')](handleEntityNotFound(_0x359139,null))[_0x7db6('0x24')](removeEntity(_0x359139,null))[_0x7db6('0x40')](handleError(_0x359139,null));}; \ No newline at end of file +var _0x9f48=['../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Template','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9f48,0x1de));var _0x89f4=function(_0x1581f3,_0x26f75a){_0x1581f3=_0x1581f3-0x0;var _0x519f3b=_0x9f48[_0x1581f3];return _0x519f3b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x89f4('0x0'));var rimraf=require(_0x89f4('0x1'));var zipdir=require(_0x89f4('0x2'));var jsonpatch=require(_0x89f4('0x3'));var rp=require(_0x89f4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x89f4('0x5'));var path=require('path');var sox=require(_0x89f4('0x6'));var csv=require(_0x89f4('0x7'));var ejs=require(_0x89f4('0x8'));var fs=require('fs');var _=require(_0x89f4('0x9'));var squel=require('squel');var crypto=require(_0x89f4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x89f4('0xb'));var toCsv=require(_0x89f4('0x7'));var querystring=require(_0x89f4('0xc'));var Papa=require(_0x89f4('0xd'));var Redis=require(_0x89f4('0xe'));var authService=require(_0x89f4('0xf'));var qs=require(_0x89f4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89f4('0x11'));var logger=require(_0x89f4('0x12'))('api');var utils=require(_0x89f4('0x13'));var config=require(_0x89f4('0x14'));var db=require(_0x89f4('0x15'))['db'];function respondWithStatusCode(_0x2663db,_0x27f0ca){_0x27f0ca=_0x27f0ca||0xcc;return function(_0x31f3ee){if(_0x31f3ee){return _0x2663db['sendStatus'](_0x27f0ca);}return _0x2663db[_0x89f4('0x16')](_0x27f0ca)[_0x89f4('0x17')]();};}function respondWithResult(_0x592103,_0x25480f){_0x25480f=_0x25480f||0xc8;return function(_0x2b01c7){if(_0x2b01c7){return _0x592103[_0x89f4('0x16')](_0x25480f)['json'](_0x2b01c7);}};}function respondWithFilteredResult(_0x519648,_0x295933){return function(_0x4834e0){if(_0x4834e0){var _0x597fde=_0x4834e0[_0x89f4('0x18')],_0x159219=_0x295933[_0x89f4('0x19')],_0x1194f8=_0x295933[_0x89f4('0x19')]+_0x295933[_0x89f4('0x1a')],_0x4633af;if(_0x1194f8>=_0x597fde){_0x1194f8=_0x597fde;_0x4633af=0xc8;}else{_0x4633af=0xce;}_0x519648['status'](_0x4633af);return _0x519648[_0x89f4('0x1b')](_0x89f4('0x1c'),_0x159219+'-'+_0x1194f8+'/'+_0x597fde)[_0x89f4('0x1d')](_0x4834e0);}return null;};}function patchUpdates(_0x231153){return function(_0x32d083){try{jsonpatch[_0x89f4('0x1e')](_0x32d083,_0x231153,!![]);}catch(_0x18536f){return BPromise['reject'](_0x18536f);}return _0x32d083[_0x89f4('0x1f')]();};}function saveUpdates(_0x53bafc,_0x3f551f){return function(_0xd39561){if(_0xd39561){return _0xd39561[_0x89f4('0x20')](_0x53bafc)[_0x89f4('0x21')](function(_0x3964c0){return _0x3964c0;});}return null;};}function removeEntity(_0x1b6b31,_0x3806a8){return function(_0x3ca8c2){if(_0x3ca8c2){return _0x3ca8c2[_0x89f4('0x22')]()[_0x89f4('0x21')](function(){var _0x539d4f=_0x3ca8c2[_0x89f4('0x23')]({'plain':!![]});var _0x1a333f='Templates';return db[_0x89f4('0x24')][_0x89f4('0x22')]({'where':{'type':_0x1a333f,'resourceId':_0x539d4f['id']}})[_0x89f4('0x21')](function(){return _0x3ca8c2;});})['then'](function(){_0x1b6b31[_0x89f4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bfe65,_0xbd1ca9){return function(_0x11ead2){if(!_0x11ead2){_0x4bfe65[_0x89f4('0x25')](0x194);}return _0x11ead2;};}function handleError(_0xecf92f,_0x21549a){_0x21549a=_0x21549a||0x1f4;return function(_0x20b945){logger[_0x89f4('0x26')](_0x20b945[_0x89f4('0x27')]);if(_0x20b945[_0x89f4('0x28')]){delete _0x20b945[_0x89f4('0x28')];}_0xecf92f[_0x89f4('0x16')](_0x21549a)[_0x89f4('0x29')](_0x20b945);};}exports[_0x89f4('0x2a')]=function(_0x1c2763,_0x22f0ba){var _0x35cec7={},_0x2a2617={},_0x38aee3={'count':0x0,'rows':[]};var _0x31a46e=_[_0x89f4('0x2b')](db[_0x89f4('0x2c')][_0x89f4('0x2d')],function(_0x367c65){return{'name':_0x367c65[_0x89f4('0x2e')],'type':_0x367c65[_0x89f4('0x2f')][_0x89f4('0x30')]};});_0x2a2617[_0x89f4('0x31')]=_[_0x89f4('0x2b')](_0x31a46e,_0x89f4('0x28'));_0x2a2617[_0x89f4('0x32')]=_[_0x89f4('0x33')](_0x1c2763[_0x89f4('0x32')]);_0x2a2617[_0x89f4('0x34')]=_[_0x89f4('0x35')](_0x2a2617[_0x89f4('0x31')],_0x2a2617['query']);_0x35cec7['attributes']=_[_0x89f4('0x35')](_0x2a2617['model'],qs[_0x89f4('0x36')](_0x1c2763['query'][_0x89f4('0x36')]));_0x35cec7[_0x89f4('0x37')]=_0x35cec7[_0x89f4('0x37')][_0x89f4('0x38')]?_0x35cec7['attributes']:_0x2a2617[_0x89f4('0x31')];if(!_0x1c2763['query'][_0x89f4('0x39')](_0x89f4('0x3a'))){_0x35cec7[_0x89f4('0x1a')]=qs[_0x89f4('0x1a')](_0x1c2763[_0x89f4('0x32')][_0x89f4('0x1a')]);_0x35cec7[_0x89f4('0x19')]=qs['offset'](_0x1c2763[_0x89f4('0x32')]['offset']);}_0x35cec7[_0x89f4('0x3b')]=qs['sort'](_0x1c2763[_0x89f4('0x32')][_0x89f4('0x3c')]);_0x35cec7[_0x89f4('0x3d')]=qs[_0x89f4('0x34')](_[_0x89f4('0x3e')](_0x1c2763[_0x89f4('0x32')],_0x2a2617[_0x89f4('0x34')]));if(_0x1c2763[_0x89f4('0x32')]['filter']){_0x35cec7[_0x89f4('0x3d')]=_['merge'](_0x35cec7['where'],{'$or':_[_0x89f4('0x2b')](_0x31a46e,function(_0x13d52d){if(_0x13d52d[_0x89f4('0x2f')]!==_0x89f4('0x3f')){var _0x257ef5={};_0x257ef5[_0x13d52d[_0x89f4('0x28')]]={'$like':'%'+_0x1c2763['query'][_0x89f4('0x40')]+'%'};return _0x257ef5;}})});}_0x35cec7=_[_0x89f4('0x41')]({},_0x35cec7,_0x1c2763[_0x89f4('0x42')]);var _0xa972b4={'where':_0x35cec7['where']};return db[_0x89f4('0x2c')][_0x89f4('0x18')](_0xa972b4)[_0x89f4('0x21')](function(_0x482952){_0x38aee3['count']=_0x482952;if(_0x1c2763[_0x89f4('0x32')][_0x89f4('0x43')]){_0x35cec7[_0x89f4('0x44')]=[{'all':!![]}];}return db[_0x89f4('0x2c')][_0x89f4('0x45')](_0x35cec7);})[_0x89f4('0x21')](function(_0x386357){_0x38aee3[_0x89f4('0x46')]=_0x386357;return _0x38aee3;})[_0x89f4('0x21')](respondWithFilteredResult(_0x22f0ba,_0x35cec7))[_0x89f4('0x47')](handleError(_0x22f0ba,null));};exports[_0x89f4('0x48')]=function(_0x9f7d8a,_0x5a9357){var _0x53675d={'raw':!![],'where':{'id':_0x9f7d8a[_0x89f4('0x49')]['id']}},_0x4d01d0={};_0x4d01d0['model']=_[_0x89f4('0x33')](db['Template']['rawAttributes']);_0x4d01d0[_0x89f4('0x32')]=_[_0x89f4('0x33')](_0x9f7d8a[_0x89f4('0x32')]);_0x4d01d0[_0x89f4('0x34')]=_[_0x89f4('0x35')](_0x4d01d0[_0x89f4('0x31')],_0x4d01d0['query']);_0x53675d['attributes']=_[_0x89f4('0x35')](_0x4d01d0[_0x89f4('0x31')],qs[_0x89f4('0x36')](_0x9f7d8a[_0x89f4('0x32')][_0x89f4('0x36')]));_0x53675d[_0x89f4('0x37')]=_0x53675d[_0x89f4('0x37')]['length']?_0x53675d[_0x89f4('0x37')]:_0x4d01d0[_0x89f4('0x31')];if(_0x9f7d8a[_0x89f4('0x32')][_0x89f4('0x43')]){_0x53675d['include']=[{'all':!![]}];}_0x53675d=_['merge']({},_0x53675d,_0x9f7d8a[_0x89f4('0x42')]);return db[_0x89f4('0x2c')]['find'](_0x53675d)[_0x89f4('0x21')](handleEntityNotFound(_0x5a9357,null))[_0x89f4('0x21')](respondWithResult(_0x5a9357,null))[_0x89f4('0x47')](handleError(_0x5a9357,null));};exports[_0x89f4('0x4a')]=function(_0x97cf9a,_0x4b40c1){return db[_0x89f4('0x2c')][_0x89f4('0x4a')](_0x97cf9a['body'],{})[_0x89f4('0x21')](function(_0x143640){var _0x2dadfc=_0x97cf9a[_0x89f4('0x4b')]['get']({'plain':!![]});if(!_0x2dadfc)throw new Error(_0x89f4('0x4c'));if(_0x2dadfc[_0x89f4('0x4d')]===_0x89f4('0x4b')){var _0x5938f3=_0x143640['get']({'plain':!![]});var _0x3c843d='Templates';return db['UserProfileSection'][_0x89f4('0x4e')]({'where':{'name':_0x3c843d,'userProfileId':_0x2dadfc[_0x89f4('0x4f')]},'raw':!![]})[_0x89f4('0x21')](function(_0x73fdd){if(_0x73fdd&&_0x73fdd[_0x89f4('0x50')]===0x0){return db[_0x89f4('0x24')][_0x89f4('0x4a')]({'name':_0x5938f3[_0x89f4('0x28')],'resourceId':_0x5938f3['id'],'type':_0x73fdd[_0x89f4('0x28')],'sectionId':_0x73fdd['id']},{})[_0x89f4('0x21')](function(){return _0x143640;});}else{return _0x143640;}})['catch'](function(_0x59492d){logger[_0x89f4('0x26')](_0x89f4('0x51'),_0x59492d);throw _0x59492d;});}return _0x143640;})[_0x89f4('0x21')](respondWithResult(_0x4b40c1,0xc9))['catch'](handleError(_0x4b40c1,null));};exports['update']=function(_0x540f44,_0x110b2a){if(_0x540f44[_0x89f4('0x52')]['id']){delete _0x540f44[_0x89f4('0x52')]['id'];}return db[_0x89f4('0x2c')][_0x89f4('0x4e')]({'where':{'id':_0x540f44[_0x89f4('0x49')]['id']}})[_0x89f4('0x21')](handleEntityNotFound(_0x110b2a,null))[_0x89f4('0x21')](saveUpdates(_0x540f44['body'],null))['then'](respondWithResult(_0x110b2a,null))[_0x89f4('0x47')](handleError(_0x110b2a,null));};exports[_0x89f4('0x22')]=function(_0x2119e9,_0x13f5e8){return db[_0x89f4('0x2c')][_0x89f4('0x4e')]({'where':{'id':_0x2119e9['params']['id']}})[_0x89f4('0x21')](handleEntityNotFound(_0x13f5e8,null))[_0x89f4('0x21')](removeEntity(_0x13f5e8,null))[_0x89f4('0x47')](handleError(_0x13f5e8,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index be1c7a6..ccc1e4c 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 _0x4641=['util','api','moment','request-promise','path','rimraf','../../config/environment','exports','Template','tools_templates','lodash'];(function(_0x209e12,_0x2ce907){var _0x3f5b89=function(_0x39cc7f){while(--_0x39cc7f){_0x209e12['push'](_0x209e12['shift']());}};_0x3f5b89(++_0x2ce907);}(_0x4641,0x16a));var _0x1464=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x4641[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x1464('0x0'));var util=require(_0x1464('0x1'));var logger=require('../../config/logger')(_0x1464('0x2'));var moment=require(_0x1464('0x3'));var BPromise=require('bluebird');var rp=require(_0x1464('0x4'));var fs=require('fs');var path=require(_0x1464('0x5'));var rimraf=require(_0x1464('0x6'));var config=require(_0x1464('0x7'));var attributes=require('./template.attributes');module[_0x1464('0x8')]=function(_0x2608bf,_0x4a711e){return _0x2608bf['define'](_0x1464('0x9'),attributes,{'tableName':_0x1464('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x23c9=['Template','tools_templates','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x18e0bf,_0x2b3088){var _0x13c438=function(_0x377a84){while(--_0x377a84){_0x18e0bf['push'](_0x18e0bf['shift']());}};_0x13c438(++_0x2b3088);}(_0x23c9,0xce));var _0x923c=function(_0x37f5b9,_0x30b602){_0x37f5b9=_0x37f5b9-0x0;var _0x2e1467=_0x23c9[_0x37f5b9];return _0x2e1467;};'use strict';var _=require(_0x923c('0x0'));var util=require(_0x923c('0x1'));var logger=require(_0x923c('0x2'))('api');var moment=require(_0x923c('0x3'));var BPromise=require(_0x923c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x923c('0x5'));var rimraf=require(_0x923c('0x6'));var config=require(_0x923c('0x7'));var attributes=require('./template.attributes');module[_0x923c('0x8')]=function(_0x23da0b,_0x2f500c){return _0x23da0b[_0x923c('0x9')](_0x923c('0xa'),attributes,{'tableName':_0x923c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index c7de1a6..1775585 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 _0xfb26=['ioredis','../../config/logger','rpc','client','request','then','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','GetTemplate','Template','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x561098,_0xdd1933){var _0x42701a=function(_0x2ab50f){while(--_0x2ab50f){_0x561098['push'](_0x561098['shift']());}};_0x42701a(++_0xdd1933);}(_0xfb26,0xf3));var _0x6fb2=function(_0x10ac8f,_0x3f579f){_0x10ac8f=_0x10ac8f-0x0;var _0x563d72=_0xfb26[_0x10ac8f];return _0x563d72;};'use strict';var _=require(_0x6fb2('0x0'));var util=require(_0x6fb2('0x1'));var moment=require(_0x6fb2('0x2'));var BPromise=require(_0x6fb2('0x3'));var rs=require(_0x6fb2('0x4'));var fs=require('fs');var Redis=require(_0x6fb2('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6fb2('0x6'))(_0x6fb2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6fb2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xab6ab5,_0xa58519,_0x5ab8dd){return new BPromise(function(_0x254be0,_0x1bb06e){return client[_0x6fb2('0x9')](_0xab6ab5,_0x5ab8dd)[_0x6fb2('0xa')](function(_0x81d2d1){logger['info'](_0x6fb2('0xb'),_0xa58519,'request\x20sent');logger['debug'](_0x6fb2('0xc'),_0xa58519,_0x6fb2('0xd'),JSON['stringify'](_0x81d2d1));if(_0x81d2d1[_0x6fb2('0xe')]){if(_0x81d2d1[_0x6fb2('0xe')]['code']===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0xa58519,_0x81d2d1['error']['message']);return _0x1bb06e(_0x81d2d1[_0x6fb2('0xe')][_0x6fb2('0xf')]);}logger[_0x6fb2('0xe')](_0x6fb2('0xb'),_0xa58519,_0x81d2d1[_0x6fb2('0xe')][_0x6fb2('0xf')]);return _0x254be0(_0x81d2d1['error'][_0x6fb2('0xf')]);}else{logger['info'](_0x6fb2('0xb'),_0xa58519,_0x6fb2('0xd'));_0x254be0(_0x81d2d1[_0x6fb2('0x10')][_0x6fb2('0xf')]);}})['catch'](function(_0x51ab1a){logger[_0x6fb2('0xe')]('Template,\x20%s,\x20%s',_0xa58519,_0x51ab1a);_0x1bb06e(_0x51ab1a);});});}exports[_0x6fb2('0x11')]=function(_0x45d98d){var _0x1ad636=this;return new Promise(function(_0x351013,_0x556828){return db[_0x6fb2('0x12')][_0x6fb2('0x13')]({'raw':_0x45d98d['options']?_0x45d98d[_0x6fb2('0x14')][_0x6fb2('0x15')]===undefined?!![]:![]:!![],'where':_0x45d98d[_0x6fb2('0x14')]?_0x45d98d[_0x6fb2('0x14')][_0x6fb2('0x16')]||null:null,'attributes':_0x45d98d[_0x6fb2('0x14')]?_0x45d98d[_0x6fb2('0x14')][_0x6fb2('0x17')]||null:null,'limit':_0x45d98d[_0x6fb2('0x14')]?_0x45d98d['options'][_0x6fb2('0x18')]||null:null,'include':_0x45d98d[_0x6fb2('0x14')]?_0x45d98d[_0x6fb2('0x14')][_0x6fb2('0x19')]?_[_0x6fb2('0x1a')](_0x45d98d[_0x6fb2('0x14')][_0x6fb2('0x19')],function(_0x1d2d16){return{'model':db[_0x1d2d16['model']],'as':_0x1d2d16['as'],'attributes':_0x1d2d16[_0x6fb2('0x17')],'include':_0x1d2d16['include']?_[_0x6fb2('0x1a')](_0x1d2d16[_0x6fb2('0x19')],function(_0x3690d2){return{'model':db[_0x3690d2['model']],'as':_0x3690d2['as'],'attributes':_0x3690d2[_0x6fb2('0x17')],'include':_0x3690d2[_0x6fb2('0x19')]?_[_0x6fb2('0x1a')](_0x3690d2['include'],function(_0x2f406f){return{'model':db[_0x2f406f[_0x6fb2('0x1b')]],'as':_0x2f406f['as'],'attributes':_0x2f406f[_0x6fb2('0x17')]};}):[]};}):[]};}):[]:[]})[_0x6fb2('0xa')](function(_0x1b15c8){logger['info'](_0x6fb2('0x11'),_0x45d98d);logger[_0x6fb2('0x1c')]('GetTemplate',_0x45d98d,JSON[_0x6fb2('0x1d')](_0x1b15c8));_0x351013(_0x1b15c8);})[_0x6fb2('0x1e')](function(_0x3ff6a7){logger[_0x6fb2('0xe')](_0x6fb2('0x11'),_0x3ff6a7[_0x6fb2('0xf')],_0x45d98d);_0x556828(_0x1ad636[_0x6fb2('0xe')](0x1f4,_0x3ff6a7[_0x6fb2('0xf')]));});});}; \ No newline at end of file +var _0xca9d=['include','map','model','GetTemplate','debug','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','findAll','options','raw','attributes','limit'];(function(_0x248df1,_0x2840d0){var _0x276d5d=function(_0x1afc5b){while(--_0x1afc5b){_0x248df1['push'](_0x248df1['shift']());}};_0x276d5d(++_0x2840d0);}(_0xca9d,0x1c8));var _0xdca9=function(_0x22fa0b,_0x1cd7f8){_0x22fa0b=_0x22fa0b-0x0;var _0x4a9ced=_0xca9d[_0x22fa0b];return _0x4a9ced;};'use strict';var _=require('lodash');var util=require(_0xdca9('0x0'));var moment=require(_0xdca9('0x1'));var BPromise=require('bluebird');var rs=require(_0xdca9('0x2'));var fs=require('fs');var Redis=require(_0xdca9('0x3'));var db=require(_0xdca9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdca9('0x5'))(_0xdca9('0x6'));var config=require(_0xdca9('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x181dbf,_0x4a6606,_0x51caa5){return new BPromise(function(_0x230e50,_0x21248e){return client[_0xdca9('0x8')](_0x181dbf,_0x51caa5)[_0xdca9('0x9')](function(_0x5b16d3){logger['info'](_0xdca9('0xa'),_0x4a6606,_0xdca9('0xb'));logger['debug'](_0xdca9('0xc'),_0x4a6606,_0xdca9('0xb'),JSON['stringify'](_0x5b16d3));if(_0x5b16d3['error']){if(_0x5b16d3[_0xdca9('0xd')][_0xdca9('0xe')]===0x1f4){logger[_0xdca9('0xd')](_0xdca9('0xa'),_0x4a6606,_0x5b16d3['error'][_0xdca9('0xf')]);return _0x21248e(_0x5b16d3[_0xdca9('0xd')][_0xdca9('0xf')]);}logger['error'](_0xdca9('0xa'),_0x4a6606,_0x5b16d3[_0xdca9('0xd')][_0xdca9('0xf')]);return _0x230e50(_0x5b16d3['error']['message']);}else{logger[_0xdca9('0x10')](_0xdca9('0xa'),_0x4a6606,'request\x20sent');_0x230e50(_0x5b16d3[_0xdca9('0x11')][_0xdca9('0xf')]);}})[_0xdca9('0x12')](function(_0x526ae3){logger[_0xdca9('0xd')](_0xdca9('0xa'),_0x4a6606,_0x526ae3);_0x21248e(_0x526ae3);});});}exports['GetTemplate']=function(_0x466dce){var _0x454bba=this;return new Promise(function(_0x3294f5,_0x2e6763){return db['Template'][_0xdca9('0x13')]({'raw':_0x466dce['options']?_0x466dce[_0xdca9('0x14')][_0xdca9('0x15')]===undefined?!![]:![]:!![],'where':_0x466dce[_0xdca9('0x14')]?_0x466dce[_0xdca9('0x14')]['where']||null:null,'attributes':_0x466dce['options']?_0x466dce[_0xdca9('0x14')][_0xdca9('0x16')]||null:null,'limit':_0x466dce['options']?_0x466dce[_0xdca9('0x14')][_0xdca9('0x17')]||null:null,'include':_0x466dce[_0xdca9('0x14')]?_0x466dce['options'][_0xdca9('0x18')]?_[_0xdca9('0x19')](_0x466dce[_0xdca9('0x14')][_0xdca9('0x18')],function(_0x58a7f5){return{'model':db[_0x58a7f5[_0xdca9('0x1a')]],'as':_0x58a7f5['as'],'attributes':_0x58a7f5['attributes'],'include':_0x58a7f5[_0xdca9('0x18')]?_[_0xdca9('0x19')](_0x58a7f5['include'],function(_0x5d617f){return{'model':db[_0x5d617f[_0xdca9('0x1a')]],'as':_0x5d617f['as'],'attributes':_0x5d617f[_0xdca9('0x16')],'include':_0x5d617f[_0xdca9('0x18')]?_[_0xdca9('0x19')](_0x5d617f['include'],function(_0x1340b7){return{'model':db[_0x1340b7[_0xdca9('0x1a')]],'as':_0x1340b7['as'],'attributes':_0x1340b7[_0xdca9('0x16')]};}):[]};}):[]};}):[]:[]})[_0xdca9('0x9')](function(_0xb5ab1e){logger[_0xdca9('0x10')](_0xdca9('0x1b'),_0x466dce);logger[_0xdca9('0x1c')]('GetTemplate',_0x466dce,JSON[_0xdca9('0x1d')](_0xb5ab1e));_0x3294f5(_0xb5ab1e);})['catch'](function(_0x67632b){logger['error']('GetTemplate',_0x67632b['message'],_0x466dce);_0x2e6763(_0x454bba[_0xdca9('0xd')](0x1f4,_0x67632b[_0xdca9('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 3043fe0..52d5eee 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 _0x50ec=['../../config/environment','./trigger.controller','isAuthenticated','index','get','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post','/:id/all_conditions','addAction','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x45a2b4,_0x4e11ec){var _0x3f7601=function(_0x6be54){while(--_0x6be54){_0x45a2b4['push'](_0x45a2b4['shift']());}};_0x3f7601(++_0x4e11ec);}(_0x50ec,0x12c));var _0xc50e=function(_0x54f811,_0x55224e){_0x54f811=_0x54f811-0x0;var _0x341355=_0x50ec[_0x54f811];return _0x341355;};'use strict';var multer=require(_0xc50e('0x0'));var util=require(_0xc50e('0x1'));var path=require(_0xc50e('0x2'));var timeout=require(_0xc50e('0x3'));var express=require(_0xc50e('0x4'));var router=express[_0xc50e('0x5')]();var auth=require(_0xc50e('0x6'));var interaction=require(_0xc50e('0x7'));var config=require(_0xc50e('0x8'));var controller=require(_0xc50e('0x9'));router['get']('/',auth[_0xc50e('0xa')](),controller[_0xc50e('0xb')]);router[_0xc50e('0xc')](_0xc50e('0xd'),auth[_0xc50e('0xa')](),controller[_0xc50e('0xe')]);router[_0xc50e('0xc')]('/:id/all_conditions',auth[_0xc50e('0xa')](),controller[_0xc50e('0xf')]);router[_0xc50e('0xc')](_0xc50e('0x10'),auth[_0xc50e('0xa')](),controller[_0xc50e('0x11')]);router[_0xc50e('0xc')](_0xc50e('0x12'),auth[_0xc50e('0xa')](),controller[_0xc50e('0x13')]);router['post']('/',auth[_0xc50e('0xa')](),controller[_0xc50e('0x14')]);router[_0xc50e('0x15')](_0xc50e('0x16'),auth['isAuthenticated'](),controller['addAllCondition']);router[_0xc50e('0x15')](_0xc50e('0x10'),auth[_0xc50e('0xa')](),controller['addAnyCondition']);router[_0xc50e('0x15')](_0xc50e('0x12'),auth[_0xc50e('0xa')](),controller[_0xc50e('0x17')]);router[_0xc50e('0x18')](_0xc50e('0xd'),auth[_0xc50e('0xa')](),controller['update']);router[_0xc50e('0x19')]('/:id',auth[_0xc50e('0xa')](),controller[_0xc50e('0x1a')]);module[_0xc50e('0x1b')]=router; \ No newline at end of file +var _0x8819=['addAllCondition','addAnyCondition','/:id/actions','update','/:id','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','show','getAllConditions','/:id/any_conditions','getAnyConditions','post','create','/:id/all_conditions'];(function(_0x11c73f,_0x3bbd19){var _0x503a57=function(_0x5bbbbb){while(--_0x5bbbbb){_0x11c73f['push'](_0x11c73f['shift']());}};_0x503a57(++_0x3bbd19);}(_0x8819,0x1bb));var _0x9881=function(_0x1827f7,_0x22c525){_0x1827f7=_0x1827f7-0x0;var _0x1b3847=_0x8819[_0x1827f7];return _0x1b3847;};'use strict';var multer=require(_0x9881('0x0'));var util=require(_0x9881('0x1'));var path=require('path');var timeout=require(_0x9881('0x2'));var express=require(_0x9881('0x3'));var router=express['Router']();var auth=require(_0x9881('0x4'));var interaction=require(_0x9881('0x5'));var config=require(_0x9881('0x6'));var controller=require(_0x9881('0x7'));router[_0x9881('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9881('0x8')]('/:id',auth[_0x9881('0x9')](),controller[_0x9881('0xa')]);router[_0x9881('0x8')]('/:id/all_conditions',auth[_0x9881('0x9')](),controller[_0x9881('0xb')]);router['get'](_0x9881('0xc'),auth[_0x9881('0x9')](),controller[_0x9881('0xd')]);router[_0x9881('0x8')]('/:id/actions',auth[_0x9881('0x9')](),controller['getActions']);router[_0x9881('0xe')]('/',auth[_0x9881('0x9')](),controller[_0x9881('0xf')]);router[_0x9881('0xe')](_0x9881('0x10'),auth['isAuthenticated'](),controller[_0x9881('0x11')]);router[_0x9881('0xe')](_0x9881('0xc'),auth[_0x9881('0x9')](),controller[_0x9881('0x12')]);router['post'](_0x9881('0x13'),auth['isAuthenticated'](),controller['addAction']);router['put']('/:id',auth[_0x9881('0x9')](),controller[_0x9881('0x14')]);router['delete'](_0x9881('0x15'),auth[_0x9881('0x9')](),controller[_0x9881('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 2c94f79..ded64d6 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 _0x8b96=['STRING','BOOLEAN','exports'];(function(_0x577286,_0xf856a3){var _0x3e5b9c=function(_0x326d2d){while(--_0x326d2d){_0x577286['push'](_0x577286['shift']());}};_0x3e5b9c(++_0xf856a3);}(_0x8b96,0x128));var _0x68b9=function(_0x306152,_0x5de087){_0x306152=_0x306152-0x0;var _0x58da64=_0x8b96[_0x306152];return _0x58da64;};'use strict';var Sequelize=require('sequelize');module[_0x68b9('0x0')]={'name':{'type':Sequelize[_0x68b9('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x68b9('0x1')]},'status':{'type':Sequelize[_0x68b9('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xdf74=['STRING','BOOLEAN','sequelize','exports'];(function(_0x8f3866,_0x269978){var _0x58ea7b=function(_0x277ab7){while(--_0x277ab7){_0x8f3866['push'](_0x8f3866['shift']());}};_0x58ea7b(++_0x269978);}(_0xdf74,0x192));var _0x4df7=function(_0x3bdf06,_0x31bd37){_0x3bdf06=_0x3bdf06-0x0;var _0x95d5e5=_0xdf74[_0x3bdf06];return _0x95d5e5;};'use strict';var Sequelize=require(_0x4df7('0x0'));module[_0x4df7('0x1')]={'name':{'type':Sequelize[_0x4df7('0x2')]},'channel':{'type':Sequelize[_0x4df7('0x2')]},'description':{'type':Sequelize[_0x4df7('0x2')]},'status':{'type':Sequelize[_0x4df7('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 e50fb04..7c6be03 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 _0x368b=['options','includeAll','include','findAll','rows','catch','params','find','create','user','UserProfileSection','error','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','filter','limit','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','stack','name','send','map','Trigger','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0x368b,0x76));var _0xb368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368b[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb368('0x0'));var emlformat=require(_0xb368('0x1'));var rimraf=require(_0xb368('0x2'));var zipdir=require(_0xb368('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb368('0x4'));var moment=require('moment');var BPromise=require(_0xb368('0x5'));var Mustache=require(_0xb368('0x6'));var util=require(_0xb368('0x7'));var path=require(_0xb368('0x8'));var sox=require(_0xb368('0x9'));var csv=require(_0xb368('0xa'));var ejs=require(_0xb368('0xb'));var fs=require('fs');var _=require(_0xb368('0xc'));var squel=require(_0xb368('0xd'));var crypto=require('crypto');var jsforce=require(_0xb368('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb368('0xa'));var querystring=require(_0xb368('0xf'));var Papa=require(_0xb368('0x10'));var Redis=require(_0xb368('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb368('0x12'));var as=require(_0xb368('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb368('0x14'))(_0xb368('0x15'));var utils=require(_0xb368('0x16'));var config=require(_0xb368('0x17'));var db=require(_0xb368('0x18'))['db'];function respondWithStatusCode(_0x26e49a,_0x3146b4){_0x3146b4=_0x3146b4||0xcc;return function(_0x2a9eb2){if(_0x2a9eb2){return _0x26e49a[_0xb368('0x19')](_0x3146b4);}return _0x26e49a['status'](_0x3146b4)[_0xb368('0x1a')]();};}function respondWithResult(_0x59093d,_0xe04090){_0xe04090=_0xe04090||0xc8;return function(_0x3c4a5e){if(_0x3c4a5e){return _0x59093d[_0xb368('0x1b')](_0xe04090)['json'](_0x3c4a5e);}};}function respondWithFilteredResult(_0x325400,_0x2f74ad){return function(_0x4d451c){if(_0x4d451c){var _0x566e7a=_0x4d451c[_0xb368('0x1c')],_0x4311cf=_0x2f74ad[_0xb368('0x1d')],_0x1aeb80=_0x2f74ad[_0xb368('0x1d')]+_0x2f74ad['limit'],_0x21c7f1;if(_0x1aeb80>=_0x566e7a){_0x1aeb80=_0x566e7a;_0x21c7f1=0xc8;}else{_0x21c7f1=0xce;}_0x325400[_0xb368('0x1b')](_0x21c7f1);return _0x325400[_0xb368('0x1e')](_0xb368('0x1f'),_0x4311cf+'-'+_0x1aeb80+'/'+_0x566e7a)[_0xb368('0x20')](_0x4d451c);}return null;};}function patchUpdates(_0x122bb4){return function(_0x4302d1){try{jsonpatch[_0xb368('0x21')](_0x4302d1,_0x122bb4,!![]);}catch(_0x4554f5){return BPromise[_0xb368('0x22')](_0x4554f5);}return _0x4302d1[_0xb368('0x23')]();};}function saveUpdates(_0x284e68,_0x14ddc2){return function(_0x107a67){if(_0x107a67){return _0x107a67[_0xb368('0x24')](_0x284e68)[_0xb368('0x25')](function(_0x135ca5){return _0x135ca5;});}return null;};}function removeEntity(_0x1d1bdc,_0x27f774){return function(_0x5786b9){if(_0x5786b9){return _0x5786b9[_0xb368('0x26')]()[_0xb368('0x25')](function(){var _0x3a45ca=_0x5786b9[_0xb368('0x27')]({'plain':!![]});var _0x2ee5fe=_0xb368('0x28');return db[_0xb368('0x29')][_0xb368('0x26')]({'where':{'type':_0x2ee5fe,'resourceId':_0x3a45ca['id']}})['then'](function(){return _0x5786b9;});})[_0xb368('0x25')](function(){_0x1d1bdc['status'](0xcc)[_0xb368('0x1a')]();});}};}function handleEntityNotFound(_0x129f06,_0x4df205){return function(_0x422484){if(!_0x422484){_0x129f06[_0xb368('0x19')](0x194);}return _0x422484;};}function handleError(_0x28a839,_0x2612f7){_0x2612f7=_0x2612f7||0x1f4;return function(_0x4ccd69){logger['error'](_0x4ccd69[_0xb368('0x2a')]);if(_0x4ccd69[_0xb368('0x2b')]){delete _0x4ccd69[_0xb368('0x2b')];}_0x28a839['status'](_0x2612f7)[_0xb368('0x2c')](_0x4ccd69);};}exports['index']=function(_0x5a7692,_0x507969){var _0x5ece04={},_0x1fd79e={},_0x14f875={'count':0x0,'rows':[]};var _0x24409e=_[_0xb368('0x2d')](db[_0xb368('0x2e')][_0xb368('0x2f')],function(_0x463f21){return{'name':_0x463f21['fieldName'],'type':_0x463f21['type'][_0xb368('0x30')]};});_0x1fd79e[_0xb368('0x31')]=_[_0xb368('0x2d')](_0x24409e,_0xb368('0x2b'));_0x1fd79e[_0xb368('0x32')]=_[_0xb368('0x33')](_0x5a7692[_0xb368('0x32')]);_0x1fd79e[_0xb368('0x34')]=_[_0xb368('0x35')](_0x1fd79e[_0xb368('0x31')],_0x1fd79e[_0xb368('0x32')]);_0x5ece04[_0xb368('0x36')]=_[_0xb368('0x35')](_0x1fd79e[_0xb368('0x31')],qs[_0xb368('0x37')](_0x5a7692[_0xb368('0x32')]['fields']));_0x5ece04[_0xb368('0x36')]=_0x5ece04[_0xb368('0x36')][_0xb368('0x38')]?_0x5ece04[_0xb368('0x36')]:_0x1fd79e[_0xb368('0x31')];if(!_0x5a7692[_0xb368('0x32')][_0xb368('0x39')](_0xb368('0x3a'))){_0x5ece04['limit']=qs['limit'](_0x5a7692['query']['limit']);_0x5ece04['offset']=qs['offset'](_0x5a7692[_0xb368('0x32')][_0xb368('0x1d')]);}_0x5ece04[_0xb368('0x3b')]=qs[_0xb368('0x3c')](_0x5a7692[_0xb368('0x32')][_0xb368('0x3c')]);_0x5ece04[_0xb368('0x3d')]=qs[_0xb368('0x34')](_[_0xb368('0x3e')](_0x5a7692['query'],_0x1fd79e[_0xb368('0x34')]));if(_0x5a7692[_0xb368('0x32')]['filter']){_0x5ece04[_0xb368('0x3d')]=_[_0xb368('0x3f')](_0x5ece04[_0xb368('0x3d')],{'$or':_[_0xb368('0x2d')](_0x24409e,function(_0x2eb3e5){if(_0x2eb3e5[_0xb368('0x40')]!==_0xb368('0x41')){var _0xde603e={};_0xde603e[_0x2eb3e5[_0xb368('0x2b')]]={'$like':'%'+_0x5a7692[_0xb368('0x32')]['filter']+'%'};return _0xde603e;}})});}_0x5ece04=_[_0xb368('0x3f')]({},_0x5ece04,_0x5a7692[_0xb368('0x42')]);var _0x5f41b9={'where':_0x5ece04['where']};return db['Trigger'][_0xb368('0x1c')](_0x5f41b9)[_0xb368('0x25')](function(_0x4ef814){_0x14f875[_0xb368('0x1c')]=_0x4ef814;if(_0x5a7692[_0xb368('0x32')][_0xb368('0x43')]){_0x5ece04[_0xb368('0x44')]=[{'all':!![]}];}return db['Trigger'][_0xb368('0x45')](_0x5ece04);})[_0xb368('0x25')](function(_0x146b86){_0x14f875[_0xb368('0x46')]=_0x146b86;return _0x14f875;})[_0xb368('0x25')](respondWithFilteredResult(_0x507969,_0x5ece04))[_0xb368('0x47')](handleError(_0x507969,null));};exports['show']=function(_0x472d04,_0x2af557){var _0x29b2a5={'raw':![],'where':{'id':_0x472d04[_0xb368('0x48')]['id']}},_0x148764={};_0x148764['model']=_[_0xb368('0x33')](db[_0xb368('0x2e')][_0xb368('0x2f')]);_0x148764['query']=_['keys'](_0x472d04[_0xb368('0x32')]);_0x148764[_0xb368('0x34')]=_['intersection'](_0x148764['model'],_0x148764[_0xb368('0x32')]);_0x29b2a5[_0xb368('0x36')]=_[_0xb368('0x35')](_0x148764[_0xb368('0x31')],qs[_0xb368('0x37')](_0x472d04['query'][_0xb368('0x37')]));_0x29b2a5['attributes']=_0x29b2a5[_0xb368('0x36')][_0xb368('0x38')]?_0x29b2a5[_0xb368('0x36')]:_0x148764[_0xb368('0x31')];if(_0x472d04[_0xb368('0x32')][_0xb368('0x43')]){_0x29b2a5[_0xb368('0x44')]=[{'all':!![]}];}_0x29b2a5=_[_0xb368('0x3f')]({},_0x29b2a5,_0x472d04['options']);return db[_0xb368('0x2e')][_0xb368('0x49')](_0x29b2a5)[_0xb368('0x25')](handleEntityNotFound(_0x2af557,null))[_0xb368('0x25')](respondWithResult(_0x2af557,null))[_0xb368('0x47')](handleError(_0x2af557,null));};exports['create']=function(_0x2c6fb5,_0x3ce427){return db[_0xb368('0x2e')][_0xb368('0x4a')](_0x2c6fb5['body'],{})[_0xb368('0x25')](function(_0x181b0b){var _0x128420=_0x2c6fb5[_0xb368('0x4b')][_0xb368('0x27')]({'plain':!![]});if(!_0x128420)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x128420['role']===_0xb368('0x4b')){var _0x1b0e4a=_0x181b0b[_0xb368('0x27')]({'plain':!![]});var _0x384b70=_0xb368('0x28');return db[_0xb368('0x4c')][_0xb368('0x49')]({'where':{'name':_0x384b70,'userProfileId':_0x128420['userProfileId']},'raw':!![]})['then'](function(_0x359022){if(_0x359022&&_0x359022['autoAssociation']===0x0){return db[_0xb368('0x29')]['create']({'name':_0x1b0e4a['name'],'resourceId':_0x1b0e4a['id'],'type':_0x359022[_0xb368('0x2b')],'sectionId':_0x359022['id']},{})[_0xb368('0x25')](function(){return _0x181b0b;});}else{return _0x181b0b;}})['catch'](function(_0x44ec8e){logger[_0xb368('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44ec8e);throw _0x44ec8e;});}return _0x181b0b;})['then'](respondWithResult(_0x3ce427,0xc9))['catch'](handleError(_0x3ce427,null));};exports[_0xb368('0x24')]=function(_0x742f77,_0x59c4f5){if(_0x742f77[_0xb368('0x4e')]['id']){delete _0x742f77['body']['id'];}return db['Trigger'][_0xb368('0x49')]({'where':{'id':_0x742f77['params']['id']}})[_0xb368('0x25')](handleEntityNotFound(_0x59c4f5,null))['then'](saveUpdates(_0x742f77[_0xb368('0x4e')],null))[_0xb368('0x25')](respondWithResult(_0x59c4f5,null))[_0xb368('0x47')](handleError(_0x59c4f5,null));};exports[_0xb368('0x26')]=function(_0x248162,_0xb0fb18){return db[_0xb368('0x2e')]['find']({'where':{'id':_0x248162['params']['id']}})[_0xb368('0x25')](handleEntityNotFound(_0xb0fb18,null))[_0xb368('0x25')](removeEntity(_0xb0fb18,null))['catch'](handleError(_0xb0fb18,null));};exports[_0xb368('0x4f')]=function(_0x373652,_0x226cb7,_0x39883d){if(_0x373652['body']['id']){delete _0x373652[_0xb368('0x4e')]['id'];}return db['Trigger'][_0xb368('0x49')]({'where':{'id':_0x373652[_0xb368('0x48')]['id']}})[_0xb368('0x25')](handleEntityNotFound(_0x226cb7,null))[_0xb368('0x25')](function(_0x98b356){if(_0x98b356){_0x373652[_0xb368('0x4e')][_0xb368('0x50')]=_0x98b356['id'];return db[_0xb368('0x51')][_0xb368('0x4a')](_0x373652['body']);}})[_0xb368('0x25')](respondWithResult(_0x226cb7,null))[_0xb368('0x47')](handleError(_0x226cb7,null));};exports[_0xb368('0x52')]=function(_0x380a33,_0x412024,_0x4f4cff){if(_0x380a33['body']['id']){delete _0x380a33[_0xb368('0x4e')]['id'];}return db[_0xb368('0x2e')][_0xb368('0x49')]({'where':{'id':_0x380a33['params']['id']}})['then'](handleEntityNotFound(_0x412024,null))[_0xb368('0x25')](function(_0x2a202f){if(_0x2a202f){_0x380a33[_0xb368('0x4e')]['TriggerAnyId']=_0x2a202f['id'];return db[_0xb368('0x51')][_0xb368('0x4a')](_0x380a33['body']);}})[_0xb368('0x25')](respondWithResult(_0x412024,null))[_0xb368('0x47')](handleError(_0x412024,null));};exports[_0xb368('0x53')]=function(_0xfcdef1,_0x456941,_0xfeb9d8){var _0x9bb74e={};var _0xc03c5c={};var _0x5e8c3d;var _0x3e4aff;return db[_0xb368('0x2e')][_0xb368('0x54')]({'where':{'id':_0xfcdef1[_0xb368('0x48')]['id']}})[_0xb368('0x25')](handleEntityNotFound(_0x456941,null))[_0xb368('0x25')](function(_0x494bdd){if(_0x494bdd){_0x5e8c3d=_0x494bdd;_0xc03c5c[_0xb368('0x31')]=_[_0xb368('0x33')](db[_0xb368('0x51')]['rawAttributes']);_0xc03c5c[_0xb368('0x32')]=_[_0xb368('0x33')](_0xfcdef1[_0xb368('0x32')]);_0xc03c5c[_0xb368('0x34')]=_[_0xb368('0x35')](_0xc03c5c[_0xb368('0x31')],_0xc03c5c[_0xb368('0x32')]);_0x9bb74e['attributes']=_[_0xb368('0x35')](_0xc03c5c[_0xb368('0x31')],qs[_0xb368('0x37')](_0xfcdef1[_0xb368('0x32')][_0xb368('0x37')]));_0x9bb74e[_0xb368('0x36')]=_0x9bb74e['attributes']['length']?_0x9bb74e['attributes']:_0xc03c5c[_0xb368('0x31')];_0x9bb74e[_0xb368('0x3b')]=qs[_0xb368('0x3c')](_0xfcdef1[_0xb368('0x32')]['sort']);_0x9bb74e[_0xb368('0x3d')]=qs[_0xb368('0x34')](_['pick'](_0xfcdef1[_0xb368('0x32')],_0xc03c5c['filters']));if(_0xfcdef1[_0xb368('0x32')][_0xb368('0x55')]){_0x9bb74e[_0xb368('0x3d')]=_[_0xb368('0x3f')](_0x9bb74e[_0xb368('0x3d')],{'$or':_[_0xb368('0x2d')](_0x9bb74e[_0xb368('0x36')],function(_0x31eb28){var _0x55d3cb={};_0x55d3cb[_0x31eb28]={'$like':'%'+_0xfcdef1[_0xb368('0x32')][_0xb368('0x55')]+'%'};return _0x55d3cb;})});}_0x9bb74e=_[_0xb368('0x3f')]({},_0x9bb74e,_0xfcdef1['options']);return _0x5e8c3d['getAllConditions'](_0x9bb74e);}})[_0xb368('0x25')](function(_0x38770c){if(_0x38770c){_0x3e4aff=_0x38770c[_0xb368('0x38')];if(!_0xfcdef1[_0xb368('0x32')][_0xb368('0x39')](_0xb368('0x3a'))){_0x9bb74e['limit']=qs[_0xb368('0x56')](_0xfcdef1[_0xb368('0x32')][_0xb368('0x56')]);_0x9bb74e['offset']=qs[_0xb368('0x1d')](_0xfcdef1[_0xb368('0x32')][_0xb368('0x1d')]);}return _0x5e8c3d['getAllConditions'](_0x9bb74e);}})[_0xb368('0x25')](function(_0x34e78f){if(_0x34e78f){return _0x34e78f?{'count':_0x3e4aff,'rows':_0x34e78f}:null;}})[_0xb368('0x25')](respondWithResult(_0x456941,null))['catch'](handleError(_0x456941,null));};exports['getAnyConditions']=function(_0x55b4bc,_0x300025,_0x57b07a){var _0x6db9e7={};var _0x12a9b8={};var _0x1752fb;var _0x71bada;return db[_0xb368('0x2e')]['findOne']({'where':{'id':_0x55b4bc[_0xb368('0x48')]['id']}})[_0xb368('0x25')](handleEntityNotFound(_0x300025,null))[_0xb368('0x25')](function(_0x9e2cb4){if(_0x9e2cb4){_0x1752fb=_0x9e2cb4;_0x12a9b8[_0xb368('0x31')]=_[_0xb368('0x33')](db[_0xb368('0x51')]['rawAttributes']);_0x12a9b8[_0xb368('0x32')]=_[_0xb368('0x33')](_0x55b4bc[_0xb368('0x32')]);_0x12a9b8[_0xb368('0x34')]=_['intersection'](_0x12a9b8['model'],_0x12a9b8['query']);_0x6db9e7['attributes']=_[_0xb368('0x35')](_0x12a9b8[_0xb368('0x31')],qs[_0xb368('0x37')](_0x55b4bc[_0xb368('0x32')][_0xb368('0x37')]));_0x6db9e7[_0xb368('0x36')]=_0x6db9e7[_0xb368('0x36')][_0xb368('0x38')]?_0x6db9e7['attributes']:_0x12a9b8[_0xb368('0x31')];_0x6db9e7[_0xb368('0x3b')]=qs[_0xb368('0x3c')](_0x55b4bc['query'][_0xb368('0x3c')]);_0x6db9e7[_0xb368('0x3d')]=qs[_0xb368('0x34')](_['pick'](_0x55b4bc['query'],_0x12a9b8[_0xb368('0x34')]));if(_0x55b4bc[_0xb368('0x32')][_0xb368('0x55')]){_0x6db9e7['where']=_[_0xb368('0x3f')](_0x6db9e7[_0xb368('0x3d')],{'$or':_[_0xb368('0x2d')](_0x6db9e7[_0xb368('0x36')],function(_0x289899){var _0x5f0e2a={};_0x5f0e2a[_0x289899]={'$like':'%'+_0x55b4bc[_0xb368('0x32')][_0xb368('0x55')]+'%'};return _0x5f0e2a;})});}_0x6db9e7=_[_0xb368('0x3f')]({},_0x6db9e7,_0x55b4bc[_0xb368('0x42')]);return _0x1752fb[_0xb368('0x57')](_0x6db9e7);}})['then'](function(_0x2f2cc7){if(_0x2f2cc7){_0x71bada=_0x2f2cc7[_0xb368('0x38')];if(!_0x55b4bc[_0xb368('0x32')][_0xb368('0x39')](_0xb368('0x3a'))){_0x6db9e7['limit']=qs[_0xb368('0x56')](_0x55b4bc[_0xb368('0x32')][_0xb368('0x56')]);_0x6db9e7['offset']=qs[_0xb368('0x1d')](_0x55b4bc['query']['offset']);}return _0x1752fb[_0xb368('0x57')](_0x6db9e7);}})[_0xb368('0x25')](function(_0x1dd6e8){if(_0x1dd6e8){return _0x1dd6e8?{'count':_0x71bada,'rows':_0x1dd6e8}:null;}})[_0xb368('0x25')](respondWithResult(_0x300025,null))[_0xb368('0x47')](handleError(_0x300025,null));};exports[_0xb368('0x58')]=function(_0x139c48,_0x5a325e,_0x4c2b95){if(_0x139c48[_0xb368('0x4e')]['id']){delete _0x139c48[_0xb368('0x4e')]['id'];}return db['Trigger'][_0xb368('0x49')]({'where':{'id':_0x139c48[_0xb368('0x48')]['id']}})[_0xb368('0x25')](handleEntityNotFound(_0x5a325e,null))[_0xb368('0x25')](function(_0x6a8469){if(_0x6a8469){_0x139c48['body'][_0xb368('0x59')]=_0x6a8469['id'];return db[_0xb368('0x5a')]['create'](_0x139c48[_0xb368('0x4e')]);}})['then'](respondWithResult(_0x5a325e,null))[_0xb368('0x47')](handleError(_0x5a325e,null));};exports[_0xb368('0x5b')]=function(_0x56a7c3,_0x4cc446,_0x261fe4){var _0x109942={};var _0x40c6b8={};var _0x57bc5c;var _0x1e5f8f;return db['Trigger'][_0xb368('0x54')]({'where':{'id':_0x56a7c3['params']['id']}})[_0xb368('0x25')](handleEntityNotFound(_0x4cc446,null))[_0xb368('0x25')](function(_0x4bcc84){if(_0x4bcc84){_0x57bc5c=_0x4bcc84;_0x40c6b8['model']=_[_0xb368('0x33')](db[_0xb368('0x5a')]['rawAttributes']);_0x40c6b8['query']=_[_0xb368('0x33')](_0x56a7c3[_0xb368('0x32')]);_0x40c6b8[_0xb368('0x34')]=_[_0xb368('0x35')](_0x40c6b8[_0xb368('0x31')],_0x40c6b8[_0xb368('0x32')]);_0x109942[_0xb368('0x36')]=_[_0xb368('0x35')](_0x40c6b8[_0xb368('0x31')],qs['fields'](_0x56a7c3[_0xb368('0x32')][_0xb368('0x37')]));_0x109942[_0xb368('0x36')]=_0x109942['attributes'][_0xb368('0x38')]?_0x109942[_0xb368('0x36')]:_0x40c6b8['model'];_0x109942[_0xb368('0x3b')]=qs['sort'](_0x56a7c3['query'][_0xb368('0x3c')]);_0x109942[_0xb368('0x3d')]=qs[_0xb368('0x34')](_[_0xb368('0x3e')](_0x56a7c3[_0xb368('0x32')],_0x40c6b8[_0xb368('0x34')]));if(_0x56a7c3['query']['filter']){_0x109942[_0xb368('0x3d')]=_[_0xb368('0x3f')](_0x109942[_0xb368('0x3d')],{'$or':_['map'](_0x109942[_0xb368('0x36')],function(_0x586305){var _0x351126={};_0x351126[_0x586305]={'$like':'%'+_0x56a7c3[_0xb368('0x32')][_0xb368('0x55')]+'%'};return _0x351126;})});}_0x109942=_['merge']({},_0x109942,_0x56a7c3['options']);return _0x57bc5c[_0xb368('0x5b')](_0x109942);}})[_0xb368('0x25')](function(_0x11436e){if(_0x11436e){_0x1e5f8f=_0x11436e[_0xb368('0x38')];if(!_0x56a7c3[_0xb368('0x32')][_0xb368('0x39')](_0xb368('0x3a'))){_0x109942[_0xb368('0x56')]=qs[_0xb368('0x56')](_0x56a7c3['query'][_0xb368('0x56')]);_0x109942['offset']=qs['offset'](_0x56a7c3[_0xb368('0x32')][_0xb368('0x1d')]);}return _0x57bc5c[_0xb368('0x5b')](_0x109942);}})['then'](function(_0x12d3d){if(_0x12d3d){return _0x12d3d?{'count':_0x1e5f8f,'rows':_0x12d3d}:null;}})[_0xb368('0x25')](respondWithResult(_0x4cc446,null))[_0xb368('0x47')](handleError(_0x4cc446,null));}; \ No newline at end of file +var _0x81d4=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','then','destroy','get','Triggers','error','stack','name','send','index','map','Trigger','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0x81d4,0x1ca));var _0x481d=function(_0x369bae,_0xaed164){_0x369bae=_0x369bae-0x0;var _0x585cb8=_0x81d4[_0x369bae];return _0x585cb8;};'use strict';var pdf=require(_0x481d('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x481d('0x1'));var zipdir=require(_0x481d('0x2'));var jsonpatch=require(_0x481d('0x3'));var rp=require(_0x481d('0x4'));var moment=require('moment');var BPromise=require(_0x481d('0x5'));var Mustache=require(_0x481d('0x6'));var util=require(_0x481d('0x7'));var path=require(_0x481d('0x8'));var sox=require('sox');var csv=require(_0x481d('0x9'));var ejs=require(_0x481d('0xa'));var fs=require('fs');var _=require(_0x481d('0xb'));var squel=require(_0x481d('0xc'));var crypto=require(_0x481d('0xd'));var jsforce=require(_0x481d('0xe'));var deskjs=require(_0x481d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x481d('0x10'));var Redis=require(_0x481d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x481d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x481d('0x13'));var logger=require(_0x481d('0x14'))(_0x481d('0x15'));var utils=require(_0x481d('0x16'));var config=require(_0x481d('0x17'));var db=require(_0x481d('0x18'))['db'];function respondWithStatusCode(_0x3d9cb6,_0x253324){_0x253324=_0x253324||0xcc;return function(_0x348f18){if(_0x348f18){return _0x3d9cb6[_0x481d('0x19')](_0x253324);}return _0x3d9cb6[_0x481d('0x1a')](_0x253324)[_0x481d('0x1b')]();};}function respondWithResult(_0x16e0ec,_0x101eb0){_0x101eb0=_0x101eb0||0xc8;return function(_0x137193){if(_0x137193){return _0x16e0ec['status'](_0x101eb0)[_0x481d('0x1c')](_0x137193);}};}function respondWithFilteredResult(_0x477b2e,_0x2aa561){return function(_0xe25d67){if(_0xe25d67){var _0x4e25af=_0xe25d67[_0x481d('0x1d')],_0x4e9e98=_0x2aa561[_0x481d('0x1e')],_0x3c8674=_0x2aa561[_0x481d('0x1e')]+_0x2aa561['limit'],_0x31487b;if(_0x3c8674>=_0x4e25af){_0x3c8674=_0x4e25af;_0x31487b=0xc8;}else{_0x31487b=0xce;}_0x477b2e['status'](_0x31487b);return _0x477b2e[_0x481d('0x1f')]('Content-Range',_0x4e9e98+'-'+_0x3c8674+'/'+_0x4e25af)[_0x481d('0x1c')](_0xe25d67);}return null;};}function patchUpdates(_0xbe8f46){return function(_0x79adff){try{jsonpatch[_0x481d('0x20')](_0x79adff,_0xbe8f46,!![]);}catch(_0x1320d1){return BPromise[_0x481d('0x21')](_0x1320d1);}return _0x79adff[_0x481d('0x22')]();};}function saveUpdates(_0x2d0ca8,_0x59f24f){return function(_0x378fd0){if(_0x378fd0){return _0x378fd0['update'](_0x2d0ca8)[_0x481d('0x23')](function(_0x2d0933){return _0x2d0933;});}return null;};}function removeEntity(_0x4bc31b,_0x1dff91){return function(_0x11ab9d){if(_0x11ab9d){return _0x11ab9d[_0x481d('0x24')]()[_0x481d('0x23')](function(){var _0x2fe442=_0x11ab9d[_0x481d('0x25')]({'plain':!![]});var _0x3c184f=_0x481d('0x26');return db['UserProfileResource'][_0x481d('0x24')]({'where':{'type':_0x3c184f,'resourceId':_0x2fe442['id']}})[_0x481d('0x23')](function(){return _0x11ab9d;});})[_0x481d('0x23')](function(){_0x4bc31b[_0x481d('0x1a')](0xcc)[_0x481d('0x1b')]();});}};}function handleEntityNotFound(_0x69507f,_0x3dd2ce){return function(_0x55defd){if(!_0x55defd){_0x69507f['sendStatus'](0x194);}return _0x55defd;};}function handleError(_0x4db983,_0xc81350){_0xc81350=_0xc81350||0x1f4;return function(_0x287698){logger[_0x481d('0x27')](_0x287698[_0x481d('0x28')]);if(_0x287698[_0x481d('0x29')]){delete _0x287698[_0x481d('0x29')];}_0x4db983['status'](_0xc81350)[_0x481d('0x2a')](_0x287698);};}exports[_0x481d('0x2b')]=function(_0x786969,_0x1e8682){var _0x2ec7dd={},_0x379a0d={},_0x2218b7={'count':0x0,'rows':[]};var _0x5a891b=_[_0x481d('0x2c')](db[_0x481d('0x2d')][_0x481d('0x2e')],function(_0x2192a7){return{'name':_0x2192a7['fieldName'],'type':_0x2192a7[_0x481d('0x2f')][_0x481d('0x30')]};});_0x379a0d['model']=_[_0x481d('0x2c')](_0x5a891b,_0x481d('0x29'));_0x379a0d[_0x481d('0x31')]=_[_0x481d('0x32')](_0x786969['query']);_0x379a0d[_0x481d('0x33')]=_[_0x481d('0x34')](_0x379a0d[_0x481d('0x35')],_0x379a0d[_0x481d('0x31')]);_0x2ec7dd['attributes']=_[_0x481d('0x34')](_0x379a0d[_0x481d('0x35')],qs[_0x481d('0x36')](_0x786969[_0x481d('0x31')][_0x481d('0x36')]));_0x2ec7dd['attributes']=_0x2ec7dd[_0x481d('0x37')][_0x481d('0x38')]?_0x2ec7dd[_0x481d('0x37')]:_0x379a0d['model'];if(!_0x786969[_0x481d('0x31')]['hasOwnProperty'](_0x481d('0x39'))){_0x2ec7dd['limit']=qs[_0x481d('0x3a')](_0x786969['query'][_0x481d('0x3a')]);_0x2ec7dd[_0x481d('0x1e')]=qs[_0x481d('0x1e')](_0x786969[_0x481d('0x31')][_0x481d('0x1e')]);}_0x2ec7dd[_0x481d('0x3b')]=qs[_0x481d('0x3c')](_0x786969[_0x481d('0x31')][_0x481d('0x3c')]);_0x2ec7dd[_0x481d('0x3d')]=qs[_0x481d('0x33')](_[_0x481d('0x3e')](_0x786969['query'],_0x379a0d[_0x481d('0x33')]));if(_0x786969[_0x481d('0x31')][_0x481d('0x3f')]){_0x2ec7dd[_0x481d('0x3d')]=_[_0x481d('0x40')](_0x2ec7dd['where'],{'$or':_[_0x481d('0x2c')](_0x5a891b,function(_0x3c7641){if(_0x3c7641[_0x481d('0x2f')]!==_0x481d('0x41')){var _0x345d95={};_0x345d95[_0x3c7641[_0x481d('0x29')]]={'$like':'%'+_0x786969[_0x481d('0x31')][_0x481d('0x3f')]+'%'};return _0x345d95;}})});}_0x2ec7dd=_[_0x481d('0x40')]({},_0x2ec7dd,_0x786969[_0x481d('0x42')]);var _0x31b3f9={'where':_0x2ec7dd[_0x481d('0x3d')]};return db[_0x481d('0x2d')][_0x481d('0x1d')](_0x31b3f9)[_0x481d('0x23')](function(_0x3e6c4a){_0x2218b7['count']=_0x3e6c4a;if(_0x786969[_0x481d('0x31')][_0x481d('0x43')]){_0x2ec7dd[_0x481d('0x44')]=[{'all':!![]}];}return db['Trigger'][_0x481d('0x45')](_0x2ec7dd);})['then'](function(_0x2a4f2d){_0x2218b7[_0x481d('0x46')]=_0x2a4f2d;return _0x2218b7;})[_0x481d('0x23')](respondWithFilteredResult(_0x1e8682,_0x2ec7dd))[_0x481d('0x47')](handleError(_0x1e8682,null));};exports[_0x481d('0x48')]=function(_0x646ef3,_0x1cc5e3){var _0x4ab98b={'raw':![],'where':{'id':_0x646ef3[_0x481d('0x49')]['id']}},_0x998c52={};_0x998c52[_0x481d('0x35')]=_[_0x481d('0x32')](db[_0x481d('0x2d')][_0x481d('0x2e')]);_0x998c52[_0x481d('0x31')]=_[_0x481d('0x32')](_0x646ef3['query']);_0x998c52[_0x481d('0x33')]=_[_0x481d('0x34')](_0x998c52[_0x481d('0x35')],_0x998c52[_0x481d('0x31')]);_0x4ab98b['attributes']=_[_0x481d('0x34')](_0x998c52['model'],qs[_0x481d('0x36')](_0x646ef3[_0x481d('0x31')]['fields']));_0x4ab98b[_0x481d('0x37')]=_0x4ab98b[_0x481d('0x37')]['length']?_0x4ab98b['attributes']:_0x998c52[_0x481d('0x35')];if(_0x646ef3['query'][_0x481d('0x43')]){_0x4ab98b['include']=[{'all':!![]}];}_0x4ab98b=_[_0x481d('0x40')]({},_0x4ab98b,_0x646ef3[_0x481d('0x42')]);return db[_0x481d('0x2d')][_0x481d('0x4a')](_0x4ab98b)['then'](handleEntityNotFound(_0x1cc5e3,null))[_0x481d('0x23')](respondWithResult(_0x1cc5e3,null))['catch'](handleError(_0x1cc5e3,null));};exports[_0x481d('0x4b')]=function(_0x50789d,_0x2eb631){return db[_0x481d('0x2d')][_0x481d('0x4b')](_0x50789d['body'],{})[_0x481d('0x23')](function(_0x194225){var _0x26823b=_0x50789d['user'][_0x481d('0x25')]({'plain':!![]});if(!_0x26823b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26823b[_0x481d('0x4c')]==='user'){var _0x5f5c92=_0x194225['get']({'plain':!![]});var _0x4f1d7c=_0x481d('0x26');return db[_0x481d('0x4d')][_0x481d('0x4a')]({'where':{'name':_0x4f1d7c,'userProfileId':_0x26823b['userProfileId']},'raw':!![]})[_0x481d('0x23')](function(_0x32adf2){if(_0x32adf2&&_0x32adf2['autoAssociation']===0x0){return db[_0x481d('0x4e')][_0x481d('0x4b')]({'name':_0x5f5c92[_0x481d('0x29')],'resourceId':_0x5f5c92['id'],'type':_0x32adf2[_0x481d('0x29')],'sectionId':_0x32adf2['id']},{})[_0x481d('0x23')](function(){return _0x194225;});}else{return _0x194225;}})['catch'](function(_0x35da2b){logger[_0x481d('0x27')](_0x481d('0x4f'),_0x35da2b);throw _0x35da2b;});}return _0x194225;})[_0x481d('0x23')](respondWithResult(_0x2eb631,0xc9))[_0x481d('0x47')](handleError(_0x2eb631,null));};exports[_0x481d('0x50')]=function(_0xfd0207,_0xad79de){if(_0xfd0207[_0x481d('0x51')]['id']){delete _0xfd0207[_0x481d('0x51')]['id'];}return db[_0x481d('0x2d')][_0x481d('0x4a')]({'where':{'id':_0xfd0207[_0x481d('0x49')]['id']}})[_0x481d('0x23')](handleEntityNotFound(_0xad79de,null))['then'](saveUpdates(_0xfd0207['body'],null))[_0x481d('0x23')](respondWithResult(_0xad79de,null))[_0x481d('0x47')](handleError(_0xad79de,null));};exports[_0x481d('0x24')]=function(_0x1958c0,_0x536267){return db['Trigger'][_0x481d('0x4a')]({'where':{'id':_0x1958c0[_0x481d('0x49')]['id']}})[_0x481d('0x23')](handleEntityNotFound(_0x536267,null))[_0x481d('0x23')](removeEntity(_0x536267,null))[_0x481d('0x47')](handleError(_0x536267,null));};exports[_0x481d('0x52')]=function(_0x2df0b6,_0x47b03a,_0x4025c7){if(_0x2df0b6[_0x481d('0x51')]['id']){delete _0x2df0b6[_0x481d('0x51')]['id'];}return db[_0x481d('0x2d')][_0x481d('0x4a')]({'where':{'id':_0x2df0b6[_0x481d('0x49')]['id']}})['then'](handleEntityNotFound(_0x47b03a,null))[_0x481d('0x23')](function(_0x7e4754){if(_0x7e4754){_0x2df0b6[_0x481d('0x51')][_0x481d('0x53')]=_0x7e4754['id'];return db[_0x481d('0x54')][_0x481d('0x4b')](_0x2df0b6[_0x481d('0x51')]);}})[_0x481d('0x23')](respondWithResult(_0x47b03a,null))[_0x481d('0x47')](handleError(_0x47b03a,null));};exports[_0x481d('0x55')]=function(_0x2a8b16,_0x526080,_0x376d7f){if(_0x2a8b16[_0x481d('0x51')]['id']){delete _0x2a8b16[_0x481d('0x51')]['id'];}return db[_0x481d('0x2d')][_0x481d('0x4a')]({'where':{'id':_0x2a8b16[_0x481d('0x49')]['id']}})['then'](handleEntityNotFound(_0x526080,null))[_0x481d('0x23')](function(_0x51c0a2){if(_0x51c0a2){_0x2a8b16[_0x481d('0x51')][_0x481d('0x56')]=_0x51c0a2['id'];return db[_0x481d('0x54')]['create'](_0x2a8b16[_0x481d('0x51')]);}})[_0x481d('0x23')](respondWithResult(_0x526080,null))[_0x481d('0x47')](handleError(_0x526080,null));};exports['getAllConditions']=function(_0x37c222,_0x39be6f,_0x384787){var _0x4a2fbe={};var _0x1658df={};var _0x4e1579;var _0x49919a;return db[_0x481d('0x2d')][_0x481d('0x57')]({'where':{'id':_0x37c222[_0x481d('0x49')]['id']}})[_0x481d('0x23')](handleEntityNotFound(_0x39be6f,null))[_0x481d('0x23')](function(_0x376cec){if(_0x376cec){_0x4e1579=_0x376cec;_0x1658df[_0x481d('0x35')]=_[_0x481d('0x32')](db[_0x481d('0x54')]['rawAttributes']);_0x1658df[_0x481d('0x31')]=_[_0x481d('0x32')](_0x37c222['query']);_0x1658df[_0x481d('0x33')]=_[_0x481d('0x34')](_0x1658df[_0x481d('0x35')],_0x1658df[_0x481d('0x31')]);_0x4a2fbe[_0x481d('0x37')]=_['intersection'](_0x1658df['model'],qs[_0x481d('0x36')](_0x37c222[_0x481d('0x31')]['fields']));_0x4a2fbe[_0x481d('0x37')]=_0x4a2fbe[_0x481d('0x37')][_0x481d('0x38')]?_0x4a2fbe[_0x481d('0x37')]:_0x1658df[_0x481d('0x35')];_0x4a2fbe['order']=qs[_0x481d('0x3c')](_0x37c222[_0x481d('0x31')][_0x481d('0x3c')]);_0x4a2fbe[_0x481d('0x3d')]=qs['filters'](_[_0x481d('0x3e')](_0x37c222[_0x481d('0x31')],_0x1658df[_0x481d('0x33')]));if(_0x37c222['query']['filter']){_0x4a2fbe[_0x481d('0x3d')]=_[_0x481d('0x40')](_0x4a2fbe[_0x481d('0x3d')],{'$or':_[_0x481d('0x2c')](_0x4a2fbe['attributes'],function(_0xadbcd5){var _0x3a741c={};_0x3a741c[_0xadbcd5]={'$like':'%'+_0x37c222[_0x481d('0x31')]['filter']+'%'};return _0x3a741c;})});}_0x4a2fbe=_[_0x481d('0x40')]({},_0x4a2fbe,_0x37c222[_0x481d('0x42')]);return _0x4e1579[_0x481d('0x58')](_0x4a2fbe);}})[_0x481d('0x23')](function(_0x51b9a9){if(_0x51b9a9){_0x49919a=_0x51b9a9[_0x481d('0x38')];if(!_0x37c222['query'][_0x481d('0x59')](_0x481d('0x39'))){_0x4a2fbe['limit']=qs[_0x481d('0x3a')](_0x37c222[_0x481d('0x31')]['limit']);_0x4a2fbe['offset']=qs[_0x481d('0x1e')](_0x37c222[_0x481d('0x31')][_0x481d('0x1e')]);}return _0x4e1579['getAllConditions'](_0x4a2fbe);}})[_0x481d('0x23')](function(_0x1118ce){if(_0x1118ce){return _0x1118ce?{'count':_0x49919a,'rows':_0x1118ce}:null;}})[_0x481d('0x23')](respondWithResult(_0x39be6f,null))[_0x481d('0x47')](handleError(_0x39be6f,null));};exports[_0x481d('0x5a')]=function(_0x11f0f0,_0x1083a8,_0x4f28d1){var _0x315087={};var _0x4a2e10={};var _0x3971a3;var _0x108ba9;return db[_0x481d('0x2d')][_0x481d('0x57')]({'where':{'id':_0x11f0f0['params']['id']}})[_0x481d('0x23')](handleEntityNotFound(_0x1083a8,null))[_0x481d('0x23')](function(_0x112fb0){if(_0x112fb0){_0x3971a3=_0x112fb0;_0x4a2e10[_0x481d('0x35')]=_[_0x481d('0x32')](db[_0x481d('0x54')][_0x481d('0x2e')]);_0x4a2e10[_0x481d('0x31')]=_[_0x481d('0x32')](_0x11f0f0['query']);_0x4a2e10[_0x481d('0x33')]=_['intersection'](_0x4a2e10[_0x481d('0x35')],_0x4a2e10[_0x481d('0x31')]);_0x315087[_0x481d('0x37')]=_[_0x481d('0x34')](_0x4a2e10[_0x481d('0x35')],qs[_0x481d('0x36')](_0x11f0f0[_0x481d('0x31')][_0x481d('0x36')]));_0x315087[_0x481d('0x37')]=_0x315087['attributes']['length']?_0x315087[_0x481d('0x37')]:_0x4a2e10[_0x481d('0x35')];_0x315087[_0x481d('0x3b')]=qs[_0x481d('0x3c')](_0x11f0f0[_0x481d('0x31')]['sort']);_0x315087[_0x481d('0x3d')]=qs[_0x481d('0x33')](_[_0x481d('0x3e')](_0x11f0f0[_0x481d('0x31')],_0x4a2e10[_0x481d('0x33')]));if(_0x11f0f0['query'][_0x481d('0x3f')]){_0x315087[_0x481d('0x3d')]=_[_0x481d('0x40')](_0x315087[_0x481d('0x3d')],{'$or':_['map'](_0x315087[_0x481d('0x37')],function(_0x3e98e8){var _0x3a580c={};_0x3a580c[_0x3e98e8]={'$like':'%'+_0x11f0f0[_0x481d('0x31')][_0x481d('0x3f')]+'%'};return _0x3a580c;})});}_0x315087=_[_0x481d('0x40')]({},_0x315087,_0x11f0f0[_0x481d('0x42')]);return _0x3971a3[_0x481d('0x5a')](_0x315087);}})[_0x481d('0x23')](function(_0x3ed985){if(_0x3ed985){_0x108ba9=_0x3ed985['length'];if(!_0x11f0f0[_0x481d('0x31')][_0x481d('0x59')]('nolimit')){_0x315087[_0x481d('0x3a')]=qs[_0x481d('0x3a')](_0x11f0f0[_0x481d('0x31')][_0x481d('0x3a')]);_0x315087[_0x481d('0x1e')]=qs['offset'](_0x11f0f0[_0x481d('0x31')][_0x481d('0x1e')]);}return _0x3971a3[_0x481d('0x5a')](_0x315087);}})[_0x481d('0x23')](function(_0x456896){if(_0x456896){return _0x456896?{'count':_0x108ba9,'rows':_0x456896}:null;}})[_0x481d('0x23')](respondWithResult(_0x1083a8,null))[_0x481d('0x47')](handleError(_0x1083a8,null));};exports[_0x481d('0x5b')]=function(_0x3bb95e,_0x483313,_0x3305d4){if(_0x3bb95e[_0x481d('0x51')]['id']){delete _0x3bb95e['body']['id'];}return db[_0x481d('0x2d')]['find']({'where':{'id':_0x3bb95e['params']['id']}})[_0x481d('0x23')](handleEntityNotFound(_0x483313,null))[_0x481d('0x23')](function(_0x21d471){if(_0x21d471){_0x3bb95e[_0x481d('0x51')][_0x481d('0x5c')]=_0x21d471['id'];return db[_0x481d('0x5d')][_0x481d('0x4b')](_0x3bb95e[_0x481d('0x51')]);}})['then'](respondWithResult(_0x483313,null))[_0x481d('0x47')](handleError(_0x483313,null));};exports[_0x481d('0x5e')]=function(_0x26c09b,_0x2bf210,_0x1540c5){var _0x27a8a9={};var _0x14beb6={};var _0x1b363e;var _0x2ab2ad;return db[_0x481d('0x2d')][_0x481d('0x57')]({'where':{'id':_0x26c09b[_0x481d('0x49')]['id']}})['then'](handleEntityNotFound(_0x2bf210,null))['then'](function(_0x3857ae){if(_0x3857ae){_0x1b363e=_0x3857ae;_0x14beb6[_0x481d('0x35')]=_[_0x481d('0x32')](db['Action'][_0x481d('0x2e')]);_0x14beb6[_0x481d('0x31')]=_[_0x481d('0x32')](_0x26c09b[_0x481d('0x31')]);_0x14beb6['filters']=_[_0x481d('0x34')](_0x14beb6[_0x481d('0x35')],_0x14beb6['query']);_0x27a8a9[_0x481d('0x37')]=_['intersection'](_0x14beb6[_0x481d('0x35')],qs[_0x481d('0x36')](_0x26c09b[_0x481d('0x31')][_0x481d('0x36')]));_0x27a8a9[_0x481d('0x37')]=_0x27a8a9['attributes']['length']?_0x27a8a9['attributes']:_0x14beb6[_0x481d('0x35')];_0x27a8a9[_0x481d('0x3b')]=qs['sort'](_0x26c09b[_0x481d('0x31')][_0x481d('0x3c')]);_0x27a8a9['where']=qs['filters'](_[_0x481d('0x3e')](_0x26c09b[_0x481d('0x31')],_0x14beb6['filters']));if(_0x26c09b[_0x481d('0x31')][_0x481d('0x3f')]){_0x27a8a9[_0x481d('0x3d')]=_[_0x481d('0x40')](_0x27a8a9[_0x481d('0x3d')],{'$or':_['map'](_0x27a8a9[_0x481d('0x37')],function(_0x55ccdb){var _0xf95303={};_0xf95303[_0x55ccdb]={'$like':'%'+_0x26c09b[_0x481d('0x31')][_0x481d('0x3f')]+'%'};return _0xf95303;})});}_0x27a8a9=_[_0x481d('0x40')]({},_0x27a8a9,_0x26c09b['options']);return _0x1b363e[_0x481d('0x5e')](_0x27a8a9);}})[_0x481d('0x23')](function(_0x253565){if(_0x253565){_0x2ab2ad=_0x253565['length'];if(!_0x26c09b[_0x481d('0x31')][_0x481d('0x59')](_0x481d('0x39'))){_0x27a8a9[_0x481d('0x3a')]=qs[_0x481d('0x3a')](_0x26c09b[_0x481d('0x31')][_0x481d('0x3a')]);_0x27a8a9[_0x481d('0x1e')]=qs['offset'](_0x26c09b['query']['offset']);}return _0x1b363e['getActions'](_0x27a8a9);}})['then'](function(_0x3cb17e){if(_0x3cb17e){return _0x3cb17e?{'count':_0x2ab2ad,'rows':_0x3cb17e}:null;}})['then'](respondWithResult(_0x2bf210,null))[_0x481d('0x47')](handleError(_0x2bf210,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 91f09a1..1e2081c 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 _0x4bd1=['define','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./trigger.attributes','exports'];(function(_0xe825ff,_0x1bb4c2){var _0x34b40a=function(_0x4ae4f1){while(--_0x4ae4f1){_0xe825ff['push'](_0xe825ff['shift']());}};_0x34b40a(++_0x1bb4c2);}(_0x4bd1,0xfe));var _0x14bd=function(_0xf89c3,_0x351bf1){_0xf89c3=_0xf89c3-0x0;var _0x274fc8=_0x4bd1[_0xf89c3];return _0x274fc8;};'use strict';var _=require(_0x14bd('0x0'));var util=require(_0x14bd('0x1'));var logger=require(_0x14bd('0x2'))(_0x14bd('0x3'));var moment=require(_0x14bd('0x4'));var BPromise=require(_0x14bd('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x14bd('0x6'));var config=require(_0x14bd('0x7'));var attributes=require(_0x14bd('0x8'));module[_0x14bd('0x9')]=function(_0x5ec891,_0x2a0060){return _0x5ec891[_0x14bd('0xa')]('Trigger',attributes,{'tableName':_0x14bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ca5=['Trigger','tools_triggers','lodash','api','moment','bluebird','rimraf','../../config/environment','./trigger.attributes','exports'];(function(_0x29fdbb,_0x3555ca){var _0x1e1462=function(_0x29c89c){while(--_0x29c89c){_0x29fdbb['push'](_0x29fdbb['shift']());}};_0x1e1462(++_0x3555ca);}(_0x7ca5,0x160));var _0x57ca=function(_0x1258f3,_0x18ebb1){_0x1258f3=_0x1258f3-0x0;var _0x6a639b=_0x7ca5[_0x1258f3];return _0x6a639b;};'use strict';var _=require(_0x57ca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x57ca('0x1'));var moment=require(_0x57ca('0x2'));var BPromise=require(_0x57ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x57ca('0x4'));var config=require(_0x57ca('0x5'));var attributes=require(_0x57ca('0x6'));module[_0x57ca('0x7')]=function(_0x5efda2,_0x40ebf5){return _0x5efda2['define'](_0x57ca('0x8'),attributes,{'tableName':_0x57ca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 5ead0bd..6776968 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 _0x84a0=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','model','map','GetTrigger','ShowTrigger','find','lodash','util','moment'];(function(_0x428e33,_0x384bda){var _0x19cca4=function(_0x4ebd49){while(--_0x4ebd49){_0x428e33['push'](_0x428e33['shift']());}};_0x19cca4(++_0x384bda);}(_0x84a0,0x66));var _0x084a=function(_0x153cfc,_0x2acad7){_0x153cfc=_0x153cfc-0x0;var _0x4b34b7=_0x84a0[_0x153cfc];return _0x4b34b7;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e6810,_0x373d2,_0x2b30bc){return new BPromise(function(_0x58d419,_0x1051a9){return client[_0x084a('0xa')](_0x2e6810,_0x2b30bc)[_0x084a('0xb')](function(_0x2888e3){logger[_0x084a('0xc')]('Trigger,\x20%s,\x20%s',_0x373d2,'request\x20sent');logger[_0x084a('0xd')](_0x084a('0xe'),_0x373d2,_0x084a('0xf'),JSON[_0x084a('0x10')](_0x2888e3));if(_0x2888e3[_0x084a('0x11')]){if(_0x2888e3['error']['code']===0x1f4){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);return _0x1051a9(_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);}logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3['error'][_0x084a('0x13')]);return _0x58d419(_0x2888e3['error'][_0x084a('0x13')]);}else{logger[_0x084a('0xc')](_0x084a('0x12'),_0x373d2,_0x084a('0xf'));_0x58d419(_0x2888e3[_0x084a('0x14')]['message']);}})[_0x084a('0x15')](function(_0x4abd81){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x4abd81);_0x1051a9(_0x4abd81);});});}exports['GetTrigger']=function(_0xf2c333){var _0x32c729=this;return new Promise(function(_0x4134b9,_0x14bb19){return db[_0x084a('0x16')][_0x084a('0x17')]({'raw':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x19')]===undefined?!![]:![]:!![],'where':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1a')]||null:null,'attributes':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1b')]||null:null,'limit':_0xf2c333['options']?_0xf2c333[_0x084a('0x18')][_0x084a('0x1c')]||null:null,'include':_0xf2c333[_0x084a('0x18')]?_0xf2c333[_0x084a('0x18')][_0x084a('0x1d')]?_['map'](_0xf2c333[_0x084a('0x18')][_0x084a('0x1d')],function(_0x6346a5){return{'model':db[_0x6346a5[_0x084a('0x1e')]],'as':_0x6346a5['as'],'attributes':_0x6346a5[_0x084a('0x1b')],'include':_0x6346a5[_0x084a('0x1d')]?_['map'](_0x6346a5[_0x084a('0x1d')],function(_0x2af138){return{'model':db[_0x2af138[_0x084a('0x1e')]],'as':_0x2af138['as'],'attributes':_0x2af138['attributes'],'include':_0x2af138[_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x2af138[_0x084a('0x1d')],function(_0x4c5658){return{'model':db[_0x4c5658['model']],'as':_0x4c5658['as'],'attributes':_0x4c5658['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33b88f){logger['info']('GetTrigger',_0xf2c333);logger['debug'](_0x084a('0x20'),_0xf2c333,JSON[_0x084a('0x10')](_0x33b88f));_0x4134b9(_0x33b88f);})[_0x084a('0x15')](function(_0x2c4149){logger[_0x084a('0x11')](_0x084a('0x20'),_0x2c4149[_0x084a('0x13')],_0xf2c333);_0x14bb19(_0x32c729[_0x084a('0x11')](0x1f4,_0x2c4149['message']));});});};exports[_0x084a('0x21')]=function(_0x3b2b38){var _0x501a16=this;return new Promise(function(_0xe1980b,_0x24bcf5){return db[_0x084a('0x16')][_0x084a('0x22')]({'raw':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x19')]===undefined?!![]:![]:!![],'where':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x1a')]||null:null,'attributes':_0x3b2b38[_0x084a('0x18')]?_0x3b2b38[_0x084a('0x18')][_0x084a('0x1b')]||null:null,'include':_0x3b2b38['options']?_0x3b2b38['options'][_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x3b2b38[_0x084a('0x18')][_0x084a('0x1d')],function(_0x83f94f){return{'model':db[_0x83f94f['model']],'as':_0x83f94f['as'],'attributes':_0x83f94f[_0x084a('0x1b')],'include':_0x83f94f[_0x084a('0x1d')]?_[_0x084a('0x1f')](_0x83f94f['include'],function(_0x109593){return{'model':db[_0x109593[_0x084a('0x1e')]],'as':_0x109593['as'],'attributes':_0x109593[_0x084a('0x1b')],'include':_0x109593['include']?_['map'](_0x109593['include'],function(_0xf97d1b){return{'model':db[_0xf97d1b[_0x084a('0x1e')]],'as':_0xf97d1b['as'],'attributes':_0xf97d1b[_0x084a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c09c3){logger[_0x084a('0xc')](_0x084a('0x21'),_0x3b2b38);logger[_0x084a('0xd')](_0x084a('0x21'),_0x3b2b38,JSON[_0x084a('0x10')](_0x3c09c3));_0xe1980b(_0x3c09c3);})[_0x084a('0x15')](function(_0x19354f){logger[_0x084a('0x11')](_0x084a('0x21'),_0x19354f[_0x084a('0x13')],_0x3b2b38);_0x24bcf5(_0x501a16[_0x084a('0x11')](0x1f4,_0x19354f[_0x084a('0x13')]));});});}; \ No newline at end of file +var _0x1eba=['find','where','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include','map','model','catch','ShowTrigger'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1eba[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var moment=require(_0xa1eb('0x2'));var BPromise=require(_0xa1eb('0x3'));var rs=require(_0xa1eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1eb('0x5'));var logger=require(_0xa1eb('0x6'))(_0xa1eb('0x7'));var config=require(_0xa1eb('0x8'));var jayson=require(_0xa1eb('0x9'));var client=jayson[_0xa1eb('0xa')][_0xa1eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bfbb0,_0x39a5a3,_0x7d2982){return new BPromise(function(_0x2aebb6,_0x9d7113){return client['request'](_0x2bfbb0,_0x7d2982)[_0xa1eb('0xc')](function(_0x4d4aaf){logger[_0xa1eb('0xd')]('Trigger,\x20%s,\x20%s',_0x39a5a3,_0xa1eb('0xe'));logger['debug'](_0xa1eb('0xf'),_0x39a5a3,'request\x20sent',JSON[_0xa1eb('0x10')](_0x4d4aaf));if(_0x4d4aaf[_0xa1eb('0x11')]){if(_0x4d4aaf[_0xa1eb('0x11')]['code']===0x1f4){logger[_0xa1eb('0x11')](_0xa1eb('0x12'),_0x39a5a3,_0x4d4aaf['error'][_0xa1eb('0x13')]);return _0x9d7113(_0x4d4aaf['error']['message']);}logger[_0xa1eb('0x11')]('Trigger,\x20%s,\x20%s',_0x39a5a3,_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);return _0x2aebb6(_0x4d4aaf[_0xa1eb('0x11')][_0xa1eb('0x13')]);}else{logger[_0xa1eb('0xd')](_0xa1eb('0x12'),_0x39a5a3,_0xa1eb('0xe'));_0x2aebb6(_0x4d4aaf[_0xa1eb('0x14')][_0xa1eb('0x13')]);}})['catch'](function(_0xbd6a6b){logger['error'](_0xa1eb('0x12'),_0x39a5a3,_0xbd6a6b);_0x9d7113(_0xbd6a6b);});});}exports[_0xa1eb('0x15')]=function(_0x33c4e3){var _0x1a5d2c=this;return new Promise(function(_0x49bfaa,_0x1dd621){return db[_0xa1eb('0x16')][_0xa1eb('0x17')]({'raw':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3[_0xa1eb('0x18')][_0xa1eb('0x19')]===undefined?!![]:![]:!![],'where':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3[_0xa1eb('0x18')]['where']||null:null,'attributes':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3['options'][_0xa1eb('0x1a')]||null:null,'limit':_0x33c4e3[_0xa1eb('0x18')]?_0x33c4e3[_0xa1eb('0x18')][_0xa1eb('0x1b')]||null:null,'include':_0x33c4e3['options']?_0x33c4e3['options'][_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x33c4e3['options'][_0xa1eb('0x1c')],function(_0x250728){return{'model':db[_0x250728[_0xa1eb('0x1e')]],'as':_0x250728['as'],'attributes':_0x250728[_0xa1eb('0x1a')],'include':_0x250728[_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x250728[_0xa1eb('0x1c')],function(_0x364b1c){return{'model':db[_0x364b1c[_0xa1eb('0x1e')]],'as':_0x364b1c['as'],'attributes':_0x364b1c[_0xa1eb('0x1a')],'include':_0x364b1c[_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x364b1c['include'],function(_0x7c617e){return{'model':db[_0x7c617e[_0xa1eb('0x1e')]],'as':_0x7c617e['as'],'attributes':_0x7c617e['attributes']};}):[]};}):[]};}):[]:[]})[_0xa1eb('0xc')](function(_0x4e2aa7){logger[_0xa1eb('0xd')](_0xa1eb('0x15'),_0x33c4e3);logger['debug'](_0xa1eb('0x15'),_0x33c4e3,JSON[_0xa1eb('0x10')](_0x4e2aa7));_0x49bfaa(_0x4e2aa7);})[_0xa1eb('0x1f')](function(_0x4f64bb){logger[_0xa1eb('0x11')](_0xa1eb('0x15'),_0x4f64bb['message'],_0x33c4e3);_0x1dd621(_0x1a5d2c[_0xa1eb('0x11')](0x1f4,_0x4f64bb[_0xa1eb('0x13')]));});});};exports[_0xa1eb('0x20')]=function(_0x2e281a){var _0x5a6544=this;return new Promise(function(_0x52f9c7,_0x9d49d8){return db[_0xa1eb('0x16')][_0xa1eb('0x21')]({'raw':_0x2e281a[_0xa1eb('0x18')]?_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x19')]===undefined?!![]:![]:!![],'where':_0x2e281a[_0xa1eb('0x18')]?_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x22')]||null:null,'attributes':_0x2e281a[_0xa1eb('0x18')]?_0x2e281a[_0xa1eb('0x18')]['attributes']||null:null,'include':_0x2e281a['options']?_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x1c')]?_[_0xa1eb('0x1d')](_0x2e281a[_0xa1eb('0x18')][_0xa1eb('0x1c')],function(_0x58d336){return{'model':db[_0x58d336['model']],'as':_0x58d336['as'],'attributes':_0x58d336[_0xa1eb('0x1a')],'include':_0x58d336[_0xa1eb('0x1c')]?_['map'](_0x58d336['include'],function(_0x3761bf){return{'model':db[_0x3761bf['model']],'as':_0x3761bf['as'],'attributes':_0x3761bf[_0xa1eb('0x1a')],'include':_0x3761bf['include']?_[_0xa1eb('0x1d')](_0x3761bf[_0xa1eb('0x1c')],function(_0x229931){return{'model':db[_0x229931['model']],'as':_0x229931['as'],'attributes':_0x229931[_0xa1eb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa1eb('0xc')](function(_0x35ed30){logger['info'](_0xa1eb('0x20'),_0x2e281a);logger[_0xa1eb('0x23')](_0xa1eb('0x20'),_0x2e281a,JSON[_0xa1eb('0x10')](_0x35ed30));_0x52f9c7(_0x35ed30);})[_0xa1eb('0x1f')](function(_0x5912d5){logger[_0xa1eb('0x11')](_0xa1eb('0x20'),_0x5912d5[_0xa1eb('0x13')],_0x2e281a);_0x9d49d8(_0x5a6544[_0xa1eb('0x11')](0x1f4,_0x5912d5[_0xa1eb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index d48a817..569c7e4 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 _0xbd50=['show','clone','post','create','put','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x5e7514,_0x30c2e1){var _0x12f472=function(_0x33ddb6){while(--_0x33ddb6){_0x5e7514['push'](_0x5e7514['shift']());}};_0x12f472(++_0x30c2e1);}(_0xbd50,0x196));var _0x0bd5=function(_0xd806b6,_0x3a605c){_0xd806b6=_0xd806b6-0x0;var _0x48224d=_0xbd50[_0xd806b6];return _0x48224d;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var auth=require(_0x0bd5('0x5'));var interaction=require(_0x0bd5('0x6'));var config=require(_0x0bd5('0x7'));var controller=require('./trunk.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0bd5('0x8')]);router[_0x0bd5('0x9')](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xc')]);router['post']('/:id/clone',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0xe')]('/',auth['isAuthenticated'](),controller[_0x0bd5('0xf')]);router[_0x0bd5('0x10')]('/:id',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x11')]);router['delete'](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x12')]);module['exports']=router; \ No newline at end of file +var _0xed1f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','post','clone','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0xed1f,0x6a));var _0xfed1=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0xed1f[_0x1a7846];return _0x48049;};'use strict';var multer=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var path=require(_0xfed1('0x2'));var timeout=require(_0xfed1('0x3'));var express=require(_0xfed1('0x4'));var router=express[_0xfed1('0x5')]();var auth=require(_0xfed1('0x6'));var interaction=require(_0xfed1('0x7'));var config=require(_0xfed1('0x8'));var controller=require(_0xfed1('0x9'));router[_0xfed1('0xa')]('/',auth[_0xfed1('0xb')](),controller[_0xfed1('0xc')]);router[_0xfed1('0xa')](_0xfed1('0xd'),auth[_0xfed1('0xb')](),controller[_0xfed1('0xe')]);router[_0xfed1('0xf')]('/:id/clone',auth[_0xfed1('0xb')](),controller[_0xfed1('0x10')]);router['post']('/',auth[_0xfed1('0xb')](),controller[_0xfed1('0x11')]);router['put'](_0xfed1('0xd'),auth['isAuthenticated'](),controller[_0xfed1('0x12')]);router[_0xfed1('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xfed1('0x14')]);module[_0xfed1('0x15')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index b095f56..7bf7af2 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 _0x3b84=['actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','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]','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3b84,0xa6));var _0x43b8=function(_0xa64d7a,_0x215036){_0xa64d7a=_0xa64d7a-0x0;var _0x27ef5a=_0x3b84[_0xa64d7a];return _0x27ef5a;};'use strict';var Sequelize=require(_0x43b8('0x0'));module[_0x43b8('0x1')]={'name':{'type':Sequelize[_0x43b8('0x2')],'allowNull':![],'unique':_0x43b8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x43b8('0x4')]('friend',_0x43b8('0x5'),_0x43b8('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x43b8('0x2')],'allowNull':![],'defaultValue':_0x43b8('0x7')},'callingpres':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x8'),'ALLOWED_PASSED_SCREEN',_0x43b8('0x9'),'ALLOWED',_0x43b8('0xa'),_0x43b8('0xb'),_0x43b8('0xc'),_0x43b8('0xd'))},'deny':{'type':Sequelize[_0x43b8('0x2')]},'permit':{'type':Sequelize[_0x43b8('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x43b8('0xe'),'set':function(_0x3320e2){this[_0x43b8('0xf')](_0x43b8('0x10'),_0x3320e2?_0x3320e2[_0x43b8('0x11')](','):null);},'get':function(){return this[_0x43b8('0x12')](_0x43b8('0x10'))?this[_0x43b8('0x12')]('transport')[_0x43b8('0x13')](','):null;},'comment':_0x43b8('0x14')},'dtmfmode':{'type':Sequelize[_0x43b8('0x4')]('rfc2833',_0x43b8('0x15'),_0x43b8('0x16'),_0x43b8('0x17'),_0x43b8('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no',_0x43b8('0x1a'),'update',_0x43b8('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x43b8('0x2')]},'directmediadeny':{'type':Sequelize[_0x43b8('0x2')]},'nat':{'type':Sequelize[_0x43b8('0x2')],'defaultValue':_0x43b8('0x1c'),'set':function(_0x5a2f34){this[_0x43b8('0xf')](_0x43b8('0x1d'),_0x5a2f34?_0x5a2f34[_0x43b8('0x11')](','):null);},'get':function(){return this[_0x43b8('0x12')](_0x43b8('0x1d'))?this[_0x43b8('0x12')](_0x43b8('0x1d'))[_0x43b8('0x13')](','):null;},'comment':_0x43b8('0x1e')},'callgroup':{'type':Sequelize[_0x43b8('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x43b8('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x43b8('0x2')]},'language':{'type':Sequelize[_0x43b8('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x43b8('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x43b8('0x2')],'defaultValue':_0x43b8('0x1f')},'allow':{'type':Sequelize[_0x43b8('0x2')],'allowNull':![],'defaultValue':_0x43b8('0x20'),'set':function(_0x8167fb){this[_0x43b8('0xf')]('allow',_0x8167fb?_0x8167fb[_0x43b8('0x11')](';'):_0x43b8('0x20'));},'get':function(){return this[_0x43b8('0x12')](_0x43b8('0x21'))?this['getDataValue'](_0x43b8('0x21'))[_0x43b8('0x13')](';'):null;},'comment':_0x43b8('0x22')},'autoframing':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x43b8('0x23'),'set':function(_0x5beb36){this[_0x43b8('0xf')]('insecure',_0x5beb36?_0x5beb36['join'](','):null);},'get':function(){return this[_0x43b8('0x12')]('insecure')?this[_0x43b8('0x12')](_0x43b8('0x24'))[_0x43b8('0x13')](','):null;},'comment':_0x43b8('0x25')},'trustrpid':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x43b8('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no',_0x43b8('0x26'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0x43b8('0x4')]('yes','no')},'accountcode':{'type':Sequelize[_0x43b8('0x27')](0xb)},'setvar':{'type':Sequelize[_0x43b8('0x2')]},'callerid':{'type':Sequelize[_0x43b8('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x43b8('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0x43b8('0x19'),'no'),'defaultValue':_0x43b8('0x19')},'busylevel':{'type':Sequelize[_0x43b8('0x27')](0xb)},'allowoverlap':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x43b8('0x4')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x43b8('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x43b8('0x2')]},'template':{'type':Sequelize[_0x43b8('0x2')]},'videosupport':{'type':Sequelize[_0x43b8('0x4')]('yes','no',_0x43b8('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no')},'mailbox':{'type':Sequelize[_0x43b8('0x2')]},'session_timers':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x29'),_0x43b8('0x2a'),_0x43b8('0x2b'))},'session_expires':{'type':Sequelize[_0x43b8('0x27')](0xb)},'session_minse':{'type':Sequelize[_0x43b8('0x27')](0xb)},'session_refresher':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x2c'),_0x43b8('0x2d')),'defaultValue':_0x43b8('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0x43b8('0x2')]},'regexten':{'type':Sequelize[_0x43b8('0x2')]},'fromdomain':{'type':Sequelize[_0x43b8('0x2')]},'fromuser':{'type':Sequelize[_0x43b8('0x2')]},'port':{'type':Sequelize[_0x43b8('0x27')](0x5)},'qualify':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no'),'defaultValue':_0x43b8('0x19')},'keepalive':{'type':Sequelize[_0x43b8('0x27')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x43b8('0x2')]},'rtptimeout':{'type':Sequelize[_0x43b8('0x27')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x43b8('0x27')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x43b8('0x27')](0xb)},'sendrpid':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no',_0x43b8('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x43b8('0x2')]},'callbackextension':{'type':Sequelize[_0x43b8('0x2')]},'timert1':{'type':Sequelize[_0x43b8('0x27')](0xb)},'timerb':{'type':Sequelize[_0x43b8('0x27')](0xb)},'qualifyfreq':{'type':Sequelize[_0x43b8('0x27')](0xb)},'contactpermit':{'type':Sequelize[_0x43b8('0x2')]},'contactdeny':{'type':Sequelize[_0x43b8('0x2')]},'contactacl':{'type':Sequelize[_0x43b8('0x2')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x43b8('0x2')]},'maxforwards':{'type':Sequelize[_0x43b8('0x27')](0xb)},'encryption':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no')},'force_avp':{'type':Sequelize[_0x43b8('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x43b8('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no')},'dtlsverify':{'type':Sequelize['ENUM'](_0x43b8('0x19'),'no',_0x43b8('0x2f'),_0x43b8('0x30'))},'dtlsrekey':{'type':Sequelize[_0x43b8('0x27')](0xb)},'dtlscertfile':{'type':Sequelize[_0x43b8('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x43b8('0x2')]},'dtlscipher':{'type':Sequelize[_0x43b8('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x43b8('0x2')]},'dtlssetup':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x31'),'passive',_0x43b8('0x32')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x43b8('0x2')]},'usereqphone':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x43b8('0x2')]},'call_limit':{'type':Sequelize[_0x43b8('0x27')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no')},'vmexten':{'type':Sequelize[_0x43b8('0x2')]},'mohinterpret':{'type':Sequelize[_0x43b8('0x2')]},'mohsuggest':{'type':Sequelize[_0x43b8('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x43b8('0x2')]},'host':{'type':Sequelize[_0x43b8('0x2')],'defaultValue':_0x43b8('0x33')},'canreinvite':{'type':Sequelize[_0x43b8('0x4')](_0x43b8('0x19'),'no',_0x43b8('0x1a'),'update',_0x43b8('0x34')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x43b8('0x2')]},'otherFields':{'type':Sequelize[_0x43b8('0x2')]},'active':{'type':Sequelize[_0x43b8('0x35')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x4a11=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uac','uas','pai','fingerprint','active','actpass','dynamic','BOOLEAN','sequelize','exports','ENUM','friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','outgoing','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure'];(function(_0x2ed1ad,_0x1fb8a1){var _0x1deb5e=function(_0x4a5d76){while(--_0x4a5d76){_0x2ed1ad['push'](_0x2ed1ad['shift']());}};_0x1deb5e(++_0x1fb8a1);}(_0x4a11,0xcb));var _0x14a1=function(_0x22aabe,_0x1667d4){_0x22aabe=_0x22aabe-0x0;var _0x7ae05=_0x4a11[_0x22aabe];return _0x7ae05;};'use strict';var Sequelize=require(_0x14a1('0x0'));module[_0x14a1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x3'),_0x14a1('0x4'),_0x14a1('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x14a1('0x6')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x7'),_0x14a1('0x8'),'ALLOWED_FAILED_SCREEN',_0x14a1('0x9'),_0x14a1('0xa'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0x14a1('0x6')]},'permit':{'type':Sequelize[_0x14a1('0x6')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x14a1('0x6')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':_0x14a1('0xb'),'set':function(_0x5edb83){this[_0x14a1('0xc')](_0x14a1('0xd'),_0x5edb83?_0x5edb83[_0x14a1('0xe')](','):null);},'get':function(){return this[_0x14a1('0xf')](_0x14a1('0xd'))?this['getDataValue'](_0x14a1('0xd'))[_0x14a1('0x10')](','):null;},'comment':_0x14a1('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0x14a1('0x12'),'info',_0x14a1('0x13'),_0x14a1('0x14'),_0x14a1('0x15')),'defaultValue':_0x14a1('0x12')},'directmedia':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no',_0x14a1('0x17'),_0x14a1('0x18'),_0x14a1('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x14a1('0x2')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x14a1('0x6')]},'nat':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':'force_rport,comedia','set':function(_0x356acc){this[_0x14a1('0xc')](_0x14a1('0x1a'),_0x356acc?_0x356acc[_0x14a1('0xe')](','):null);},'get':function(){return this[_0x14a1('0xf')](_0x14a1('0x1a'))?this[_0x14a1('0xf')](_0x14a1('0x1a'))[_0x14a1('0x10')](','):null;},'comment':_0x14a1('0x1b')},'callgroup':{'type':Sequelize[_0x14a1('0x6')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x14a1('0x6')]},'language':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':_0x14a1('0x1c')},'allow':{'type':Sequelize[_0x14a1('0x6')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x25a600){this['setDataValue'](_0x14a1('0x1d'),_0x25a600?_0x25a600[_0x14a1('0xe')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x14a1('0x1d'))?this[_0x14a1('0xf')](_0x14a1('0x1d'))['split'](';'):null;},'comment':_0x14a1('0x1e')},'autoframing':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'insecure':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':'port,invite','set':function(_0x523306){this[_0x14a1('0xc')](_0x14a1('0x1f'),_0x523306?_0x523306[_0x14a1('0xe')](','):null);},'get':function(){return this[_0x14a1('0xf')](_0x14a1('0x1f'))?this['getDataValue'](_0x14a1('0x1f'))[_0x14a1('0x10')](','):null;},'comment':_0x14a1('0x20')},'trustrpid':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x14a1('0x16'),'no',_0x14a1('0x21'))},'promiscredir':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'accountcode':{'type':Sequelize[_0x14a1('0x22')](0xb)},'setvar':{'type':Sequelize[_0x14a1('0x6')]},'callerid':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':_0x14a1('0x23')},'amaflags':{'type':Sequelize[_0x14a1('0x6')]},'callcounter':{'type':Sequelize['ENUM'](_0x14a1('0x16'),'no'),'defaultValue':_0x14a1('0x16')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x14a1('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x14a1('0x16'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x14a1('0x6')]},'videosupport':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no',_0x14a1('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x14a1('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x25'),_0x14a1('0x26'),'originate')},'session_expires':{'type':Sequelize[_0x14a1('0x22')](0xb)},'session_minse':{'type':Sequelize[_0x14a1('0x22')](0xb)},'session_refresher':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x27'),_0x14a1('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x14a1('0x6')]},'regexten':{'type':Sequelize[_0x14a1('0x6')]},'fromdomain':{'type':Sequelize[_0x14a1('0x6')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x14a1('0x22')](0x5)},'qualify':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no'),'defaultValue':_0x14a1('0x16')},'keepalive':{'type':Sequelize[_0x14a1('0x22')](0xb)},'defaultip':{'type':Sequelize[_0x14a1('0x6')]},'defaultuser':{'type':Sequelize[_0x14a1('0x6')]},'rtptimeout':{'type':Sequelize[_0x14a1('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x14a1('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no',_0x14a1('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x14a1('0x6')]},'callbackextension':{'type':Sequelize[_0x14a1('0x6')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x14a1('0x22')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x14a1('0x6')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x14a1('0x6')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x14a1('0x22')](0xb)},'encryption':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'force_avp':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x14a1('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no',_0x14a1('0x2a'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x14a1('0x22')](0xb)},'dtlscertfile':{'type':Sequelize[_0x14a1('0x6')]},'dtlsprivatekey':{'type':Sequelize[_0x14a1('0x6')]},'dtlscipher':{'type':Sequelize[_0x14a1('0x6')]},'dtlscafile':{'type':Sequelize[_0x14a1('0x6')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x2b'),'passive',_0x14a1('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x14a1('0x6')]},'usereqphone':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x14a1('0x6')]},'recordofffeature':{'type':Sequelize[_0x14a1('0x6')]},'call_limit':{'type':Sequelize[_0x14a1('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x14a1('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no')},'vmexten':{'type':Sequelize[_0x14a1('0x6')]},'mohinterpret':{'type':Sequelize[_0x14a1('0x6')]},'mohsuggest':{'type':Sequelize[_0x14a1('0x6')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x14a1('0x6')]},'host':{'type':Sequelize[_0x14a1('0x6')],'defaultValue':_0x14a1('0x2d')},'canreinvite':{'type':Sequelize[_0x14a1('0x2')](_0x14a1('0x16'),'no','nonat','update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x14a1('0x6')]},'otherFields':{'type':Sequelize[_0x14a1('0x6')]},'active':{'type':Sequelize[_0x14a1('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x14a1('0x6')],'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 b2f6490..df6f0f9 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 _0x4592=['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','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','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','json','offset','limit','set','apply','reject','save','destroy','get','Trunks','UserProfileResource','sendStatus','name','send','index','map','Trunk','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','show','include','clone','find','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','update','readFileSync','join','Reload','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel'];(function(_0x5b6990,_0x26309e){var _0x14db4a=function(_0x4ccc82){while(--_0x4ccc82){_0x5b6990['push'](_0x5b6990['shift']());}};_0x14db4a(++_0x26309e);}(_0x4592,0x69));var _0x2459=function(_0x57e9b2,_0x2813cf){_0x57e9b2=_0x57e9b2-0x0;var _0x5503d7=_0x4592[_0x57e9b2];return _0x5503d7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2459('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2459('0x1'));var jsonpatch=require(_0x2459('0x2'));var rp=require('request-promise');var moment=require(_0x2459('0x3'));var BPromise=require(_0x2459('0x4'));var Mustache=require(_0x2459('0x5'));var util=require(_0x2459('0x6'));var path=require('path');var sox=require(_0x2459('0x7'));var csv=require(_0x2459('0x8'));var ejs=require(_0x2459('0x9'));var fs=require('fs');var _=require(_0x2459('0xa'));var squel=require(_0x2459('0xb'));var crypto=require(_0x2459('0xc'));var jsforce=require(_0x2459('0xd'));var deskjs=require(_0x2459('0xe'));var toCsv=require(_0x2459('0x8'));var querystring=require(_0x2459('0xf'));var Papa=require(_0x2459('0x10'));var Redis=require(_0x2459('0x11'));var authService=require(_0x2459('0x12'));var qs=require(_0x2459('0x13'));var as=require(_0x2459('0x14'));var hardwareService=require(_0x2459('0x15'));var logger=require(_0x2459('0x16'))(_0x2459('0x17'));var utils=require('../../config/utils');var config=require(_0x2459('0x18'));var db=require(_0x2459('0x19'))['db'];var jayson=require(_0x2459('0x1a'));var client=jayson[_0x2459('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x2121b3,_0x2b090f,_0x591eea){if(_0x591eea){var _0x5db421=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5db421[_0x2459('0x1c')](_0x2b090f)){return _0x2121b3;}else{throw new db[(_0x2459('0x1d'))][(_0x2459('0x1e'))](_0x2459('0x1f'));}}else{return _0x2121b3;}}function respondWithRpcPromise(_0x22ac36,_0x198740,_0x27c721,_0x299196){return new BPromise(function(_0x26f163,_0x399203){var _0x207fad=_0x299196||client;return _0x207fad[_0x2459('0x20')](_0x22ac36,_0x27c721)[_0x2459('0x21')](function(_0x5ed6e6){logger[_0x2459('0x22')](_0x2459('0x23'),_0x198740,'request\x20sent');logger[_0x2459('0x24')](_0x2459('0x25'),_0x198740,_0x2459('0x26'),JSON[_0x2459('0x27')](_0x5ed6e6));if(_0x5ed6e6['error']){if(_0x5ed6e6[_0x2459('0x28')][_0x2459('0x29')]===0x1f4){logger['error'](_0x2459('0x23'),_0x198740,_0x5ed6e6[_0x2459('0x28')][_0x2459('0x2a')]);return _0x399203(_0x5ed6e6[_0x2459('0x28')][_0x2459('0x2a')]);}logger['error'](_0x2459('0x23'),_0x198740,_0x5ed6e6['error'][_0x2459('0x2a')]);return _0x26f163(_0x5ed6e6[_0x2459('0x28')][_0x2459('0x2a')]);}else{logger['info'](_0x2459('0x23'),_0x198740,_0x2459('0x26'));_0x26f163(_0x5ed6e6['result'][_0x2459('0x2a')]);}})[_0x2459('0x2b')](function(_0x125846){logger[_0x2459('0x28')](_0x2459('0x23'),_0x198740,_0x125846);_0x399203(_0x125846);});});}function respondWithStatusCode(_0x323884,_0x1ab3af){_0x1ab3af=_0x1ab3af||0xcc;return function(_0x4fe70c){if(_0x4fe70c){return _0x323884['sendStatus'](_0x1ab3af);}return _0x323884[_0x2459('0x2c')](_0x1ab3af)[_0x2459('0x2d')]();};}function respondWithResult(_0x1e5c97,_0x3e01cd){_0x3e01cd=_0x3e01cd||0xc8;return function(_0x536e87){if(_0x536e87){return _0x1e5c97['status'](_0x3e01cd)[_0x2459('0x2e')](_0x536e87);}};}function respondWithFilteredResult(_0x86370d,_0x239c01){return function(_0x13f16b){if(_0x13f16b){var _0x290451=_0x13f16b['count'],_0x157a53=_0x239c01['offset'],_0x14e4fc=_0x239c01[_0x2459('0x2f')]+_0x239c01[_0x2459('0x30')],_0x47e17d;if(_0x14e4fc>=_0x290451){_0x14e4fc=_0x290451;_0x47e17d=0xc8;}else{_0x47e17d=0xce;}_0x86370d[_0x2459('0x2c')](_0x47e17d);return _0x86370d[_0x2459('0x31')]('Content-Range',_0x157a53+'-'+_0x14e4fc+'/'+_0x290451)[_0x2459('0x2e')](_0x13f16b);}return null;};}function patchUpdates(_0x26ecde){return function(_0x1d70c0){try{jsonpatch[_0x2459('0x32')](_0x1d70c0,_0x26ecde,!![]);}catch(_0x49b70f){return BPromise[_0x2459('0x33')](_0x49b70f);}return _0x1d70c0[_0x2459('0x34')]();};}function saveUpdates(_0x5303d4,_0x5a622e){return function(_0x58c34f){if(_0x58c34f){return _0x58c34f['update'](_0x5303d4)[_0x2459('0x21')](function(_0x402525){return _0x402525;});}return null;};}function removeEntity(_0x1d8eaa,_0x37b6bc){return function(_0xf602e0){if(_0xf602e0){return _0xf602e0[_0x2459('0x35')]()[_0x2459('0x21')](function(){var _0x42ba18=_0xf602e0[_0x2459('0x36')]({'plain':!![]});var _0x21e3c0=_0x2459('0x37');return db[_0x2459('0x38')][_0x2459('0x35')]({'where':{'type':_0x21e3c0,'resourceId':_0x42ba18['id']}})[_0x2459('0x21')](function(){return _0xf602e0;});})[_0x2459('0x21')](function(){_0x1d8eaa[_0x2459('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2976f7,_0x5444e6){return function(_0x184d68){if(!_0x184d68){_0x2976f7[_0x2459('0x39')](0x194);}return _0x184d68;};}function handleError(_0x31c005,_0x542d57){_0x542d57=_0x542d57||0x1f4;return function(_0x2c02b1){logger[_0x2459('0x28')](_0x2c02b1['stack']);if(_0x2c02b1[_0x2459('0x3a')]){delete _0x2c02b1[_0x2459('0x3a')];}_0x31c005[_0x2459('0x2c')](_0x542d57)[_0x2459('0x3b')](_0x2c02b1);};}exports[_0x2459('0x3c')]=function(_0x2e1d65,_0x4da189){var _0x179cd0={},_0x1fc295={},_0x3b384c={'count':0x0,'rows':[]};var _0x32fc31=_[_0x2459('0x3d')](db[_0x2459('0x3e')][_0x2459('0x3f')],function(_0x17d55f){return{'name':_0x17d55f[_0x2459('0x40')],'type':_0x17d55f['type'][_0x2459('0x41')]};});_0x1fc295[_0x2459('0x42')]=_[_0x2459('0x3d')](_0x32fc31,_0x2459('0x3a'));_0x1fc295[_0x2459('0x43')]=_[_0x2459('0x44')](_0x2e1d65[_0x2459('0x43')]);_0x1fc295['filters']=_[_0x2459('0x45')](_0x1fc295[_0x2459('0x42')],_0x1fc295[_0x2459('0x43')]);_0x179cd0[_0x2459('0x46')]=_[_0x2459('0x45')](_0x1fc295['model'],qs[_0x2459('0x47')](_0x2e1d65[_0x2459('0x43')][_0x2459('0x47')]));_0x179cd0[_0x2459('0x46')]=_0x179cd0[_0x2459('0x46')][_0x2459('0x48')]?_0x179cd0[_0x2459('0x46')]:_0x1fc295[_0x2459('0x42')];if(!_0x2e1d65[_0x2459('0x43')][_0x2459('0x49')]('nolimit')){_0x179cd0[_0x2459('0x30')]=qs[_0x2459('0x30')](_0x2e1d65[_0x2459('0x43')][_0x2459('0x30')]);_0x179cd0['offset']=qs[_0x2459('0x2f')](_0x2e1d65[_0x2459('0x43')][_0x2459('0x2f')]);}_0x179cd0[_0x2459('0x4a')]=qs['sort'](_0x2e1d65[_0x2459('0x43')][_0x2459('0x4b')]);_0x179cd0[_0x2459('0x4c')]=qs[_0x2459('0x4d')](_[_0x2459('0x4e')](_0x2e1d65[_0x2459('0x43')],_0x1fc295[_0x2459('0x4d')]));if(_0x2e1d65[_0x2459('0x43')][_0x2459('0x4f')]){_0x179cd0[_0x2459('0x4c')]=_[_0x2459('0x50')](_0x179cd0[_0x2459('0x4c')],{'$or':_['map'](_0x32fc31,function(_0x195736){if(_0x195736[_0x2459('0x51')]!==_0x2459('0x52')){var _0x35de30={};_0x35de30[_0x195736['name']]={'$like':'%'+_0x2e1d65['query'][_0x2459('0x4f')]+'%'};return _0x35de30;}})});}_0x179cd0=_[_0x2459('0x50')]({},_0x179cd0,_0x2e1d65[_0x2459('0x53')]);var _0x3a60f6={'where':_0x179cd0[_0x2459('0x4c')]};return db['Trunk'][_0x2459('0x54')](_0x3a60f6)[_0x2459('0x21')](function(_0x44fbc5){_0x3b384c[_0x2459('0x54')]=_0x44fbc5;if(_0x2e1d65[_0x2459('0x43')][_0x2459('0x55')]){_0x179cd0['include']=[{'all':!![]}];}return db['Trunk'][_0x2459('0x56')](_0x179cd0);})[_0x2459('0x21')](function(_0x1a4922){_0x3b384c['rows']=_0x1a4922;return _0x3b384c;})['then'](respondWithFilteredResult(_0x4da189,_0x179cd0))[_0x2459('0x2b')](handleError(_0x4da189,null));};exports[_0x2459('0x57')]=function(_0x48db63,_0x485149){var _0x39623e={'raw':![],'where':{'id':_0x48db63['params']['id']}},_0x4499c7={};_0x4499c7[_0x2459('0x42')]=_['keys'](db[_0x2459('0x3e')][_0x2459('0x3f')]);_0x4499c7[_0x2459('0x43')]=_[_0x2459('0x44')](_0x48db63[_0x2459('0x43')]);_0x4499c7[_0x2459('0x4d')]=_[_0x2459('0x45')](_0x4499c7[_0x2459('0x42')],_0x4499c7[_0x2459('0x43')]);_0x39623e['attributes']=_[_0x2459('0x45')](_0x4499c7[_0x2459('0x42')],qs[_0x2459('0x47')](_0x48db63['query'][_0x2459('0x47')]));_0x39623e[_0x2459('0x46')]=_0x39623e[_0x2459('0x46')][_0x2459('0x48')]?_0x39623e[_0x2459('0x46')]:_0x4499c7['model'];if(_0x48db63[_0x2459('0x43')]['includeAll']){_0x39623e[_0x2459('0x58')]=[{'all':!![]}];}_0x39623e=_[_0x2459('0x50')]({},_0x39623e,_0x48db63['options']);return db[_0x2459('0x3e')]['find'](_0x39623e)[_0x2459('0x21')](handleEntityNotFound(_0x485149,null))['then'](respondWithResult(_0x485149,null))['catch'](handleError(_0x485149,null));};exports[_0x2459('0x59')]=function(_0x789167,_0x51c1a6){var _0x5da1ba={'where':{'id':_0x789167['params']['id']}},_0x4c171f={};_0x4c171f['model']=_['keys'](db[_0x2459('0x3e')]['rawAttributes']);_0x5da1ba[_0x2459('0x46')]=_[_0x2459('0x45')](_0x4c171f['model'],qs[_0x2459('0x47')](_0x789167[_0x2459('0x43')][_0x2459('0x47')]));_0x5da1ba['attributes']=_0x5da1ba[_0x2459('0x46')][_0x2459('0x48')]?_0x5da1ba['attributes']:_0x4c171f[_0x2459('0x42')];if(_0x789167[_0x2459('0x43')][_0x2459('0x55')]){_0x5da1ba[_0x2459('0x58')]=[{'all':!![]}];}_0x5da1ba=_[_0x2459('0x50')]({},_0x5da1ba,_0x789167[_0x2459('0x53')]);return db['Trunk'][_0x2459('0x5a')](_0x5da1ba)[_0x2459('0x21')](handleEntityNotFound(_0x51c1a6,null))[_0x2459('0x21')](function(_0x680e3){if(_0x680e3){var _0x52f541=_0x680e3[_0x2459('0x36')]({'plain':!![]});_0x52f541=qs[_0x2459('0x5b')](_0x52f541,['id',_0x2459('0x5c'),_0x2459('0x5d')]);_0x789167[_0x2459('0x5e')]=_[_0x2459('0x5b')](_0x789167[_0x2459('0x5e')],['id','createdAt',_0x2459('0x5d')]);return db[_0x2459('0x3e')][_0x2459('0x5f')](_[_0x2459('0x50')](_0x52f541,_0x789167['body']),{'include':_0x789167[_0x2459('0x43')][_0x2459('0x55')]?[{'all':!![]}]:undefined})[_0x2459('0x21')](function(_0x2ffe80){var _0x6debde=_0x789167[_0x2459('0x60')][_0x2459('0x36')]({'plain':!![]});if(!_0x6debde)throw new Error(_0x2459('0x61'));if(_0x6debde[_0x2459('0x62')]===_0x2459('0x60')){var _0x306ce3=_0x2ffe80[_0x2459('0x36')]({'plain':!![]});var _0x4db3a1='Trunks';return db[_0x2459('0x63')][_0x2459('0x5a')]({'where':{'name':_0x4db3a1,'userProfileId':_0x6debde[_0x2459('0x64')]},'raw':!![]})['then'](function(_0x21f535){if(_0x21f535&&_0x21f535[_0x2459('0x65')]===0x0){return db[_0x2459('0x38')][_0x2459('0x5f')]({'name':_0x306ce3[_0x2459('0x3a')],'resourceId':_0x306ce3['id'],'type':_0x21f535[_0x2459('0x3a')],'sectionId':_0x21f535['id']},{})[_0x2459('0x21')](function(){return _0x2ffe80;});}else{return _0x2ffe80;}})['catch'](function(_0x5ac731){logger['error'](_0x2459('0x66'),_0x5ac731);throw _0x5ac731;});}return _0x2ffe80;});}})[_0x2459('0x21')](respondWithResult(_0x51c1a6,0xc9))[_0x2459('0x2b')](handleError(_0x51c1a6,null));};exports['create']=function(_0x20bc67,_0x5646df,_0x4caede){var _0x18a20a;return db[_0x2459('0x3e')]['create'](_0x20bc67[_0x2459('0x5e')],{'raw':!![]})[_0x2459('0x21')](function(_0x35084b){_0x18a20a=_0x35084b;return db[_0x2459('0x3e')]['findAll']({'raw':!![]});})['then'](function(_0x5ae35d){var _0x5c0a92=fs['readFileSync'](path['join'](config['root'],_0x2459('0x67')),_0x2459('0x68'));var _0x4ea064=fs['readFileSync'](path['join'](config[_0x2459('0x69')],_0x2459('0x6a')),_0x2459('0x68'));var _0x27f9f0=ejs[_0x2459('0x6b')](_0x5c0a92,{'trunks':_0x5ae35d||[]});fs['writeFileSync'](_0x2459('0x6c'),_0x27f9f0);if(_0x18a20a[_0x2459('0x6d')]){var _0x4fe85b=ejs[_0x2459('0x6b')](_0x4ea064,{'trunks':_0x5ae35d||[]});fs[_0x2459('0x6e')](_0x2459('0x6f'),_0x4fe85b);}})['then'](function(){return respondWithRpcPromise('Reload',_0x2459('0x5f'),{'module':'chan_sip.so'});})[_0x2459('0x21')](function(){var _0x1978ba=_0x20bc67['user'][_0x2459('0x36')]({'plain':!![]});if(!_0x1978ba)throw new Error(_0x2459('0x61'));if(_0x1978ba['role']===_0x2459('0x60')){var _0x10c563=_0x18a20a[_0x2459('0x36')]({'plain':!![]});return db['UserProfileSection'][_0x2459('0x5a')]({'where':{'name':_0x2459('0x37'),'userProfileId':_0x1978ba[_0x2459('0x64')]},'raw':!![]})[_0x2459('0x21')](function(_0x556e0e){if(_0x556e0e&&_0x556e0e[_0x2459('0x65')]===0x0){return db[_0x2459('0x38')][_0x2459('0x5f')]({'name':_0x10c563[_0x2459('0x3a')],'resourceId':_0x10c563['id'],'type':_0x556e0e[_0x2459('0x3a')],'sectionId':_0x556e0e['id']},{})[_0x2459('0x21')](function(){return _0x18a20a;});}else{return _0x18a20a;}})[_0x2459('0x2b')](function(_0x43a997){logger[_0x2459('0x28')](_0x2459('0x66'),_0x43a997);throw _0x43a997;});}return _0x18a20a;})['then'](respondWithResult(_0x5646df,0xc9))[_0x2459('0x2b')](handleError(_0x5646df,null));};exports[_0x2459('0x70')]=function(_0x21c218,_0x5a0a4d,_0x3f0243){var _0x40e213;return db[_0x2459('0x3e')]['find']({'where':{'id':_0x21c218['params']['id']}})[_0x2459('0x21')](handleEntityNotFound(_0x5a0a4d,null))[_0x2459('0x21')](saveUpdates(_0x21c218['body'],null))[_0x2459('0x21')](function(_0x5d469c){if(_0x5d469c){_0x40e213=_0x5d469c;return db[_0x2459('0x3e')][_0x2459('0x56')]({'raw':!![]});}})['then'](function(_0x483700){if(_0x483700){var _0x464691=fs[_0x2459('0x71')](path[_0x2459('0x72')](config['root'],_0x2459('0x67')),_0x2459('0x68'));var _0x5c1d05=fs[_0x2459('0x71')](path[_0x2459('0x72')](config[_0x2459('0x69')],_0x2459('0x6a')),'utf8');var _0x1c92db=ejs[_0x2459('0x6b')](_0x464691,{'trunks':_0x483700||[]});fs[_0x2459('0x6e')](_0x2459('0x6c'),_0x1c92db);var _0x4bc5e4=ejs['render'](_0x5c1d05,{'trunks':_0x483700||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x4bc5e4);return respondWithRpcPromise(_0x2459('0x73'),_0x2459('0x70'),{'module':'chan_sip.so'});}return null;})[_0x2459('0x21')](function(_0x26aadb){if(_0x26aadb){return _0x40e213;}})['then'](respondWithResult(_0x5a0a4d,null))['catch'](handleError(_0x5a0a4d,null));};exports[_0x2459('0x35')]=function(_0x3213bc,_0x12b140,_0x23cbb7){var _0x106e30;return db[_0x2459('0x3e')][_0x2459('0x5a')]({'where':{'id':_0x3213bc[_0x2459('0x74')]['id']}})[_0x2459('0x21')](handleEntityNotFound(_0x12b140,null))[_0x2459('0x21')](removeEntity(_0x12b140,null))['then'](function(){return db['Trunk'][_0x2459('0x56')]({'raw':!![]});})[_0x2459('0x21')](function(_0x2f1ec6){var _0x4a2a73=fs['readFileSync'](path[_0x2459('0x72')](config[_0x2459('0x69')],_0x2459('0x67')),_0x2459('0x68'));var _0x2f3111=fs[_0x2459('0x71')](path[_0x2459('0x72')](config[_0x2459('0x69')],_0x2459('0x6a')),_0x2459('0x68'));var _0x35517c=ejs['render'](_0x4a2a73,{'trunks':_0x2f1ec6});var _0x4deab8=ejs[_0x2459('0x6b')](_0x2f3111,{'trunks':_0x2f1ec6});fs[_0x2459('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x35517c);fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x4deab8);return respondWithRpcPromise(_0x2459('0x73'),_0x2459('0x35'),{'module':'chan_sip.so'});})[_0x2459('0x2b')](handleError(_0x12b140,null));}; \ No newline at end of file +var _0x9ccf=['find','clone','omit','createdAt','updatedAt','body','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','root','server/files/templates/trunk.ejs','utf8','readFileSync','join','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','name','send','index','Trunk','rawAttributes','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','length'];(function(_0x2a36e6,_0x250137){var _0x438728=function(_0x3598c6){while(--_0x3598c6){_0x2a36e6['push'](_0x2a36e6['shift']());}};_0x438728(++_0x250137);}(_0x9ccf,0x1e9));var _0xf9cc=function(_0x478184,_0x456249){_0x478184=_0x478184-0x0;var _0x230af3=_0x9ccf[_0x478184];return _0x230af3;};'use strict';var pdf=require(_0xf9cc('0x0'));var emlformat=require(_0xf9cc('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf9cc('0x2'));var rp=require(_0xf9cc('0x3'));var moment=require(_0xf9cc('0x4'));var BPromise=require(_0xf9cc('0x5'));var Mustache=require('mustache');var util=require(_0xf9cc('0x6'));var path=require(_0xf9cc('0x7'));var sox=require(_0xf9cc('0x8'));var csv=require(_0xf9cc('0x9'));var ejs=require(_0xf9cc('0xa'));var fs=require('fs');var _=require(_0xf9cc('0xb'));var squel=require(_0xf9cc('0xc'));var crypto=require(_0xf9cc('0xd'));var jsforce=require(_0xf9cc('0xe'));var deskjs=require(_0xf9cc('0xf'));var toCsv=require(_0xf9cc('0x9'));var querystring=require('querystring');var Papa=require(_0xf9cc('0x10'));var Redis=require('ioredis');var authService=require(_0xf9cc('0x11'));var qs=require(_0xf9cc('0x12'));var as=require(_0xf9cc('0x13'));var hardwareService=require(_0xf9cc('0x14'));var logger=require('../../config/logger')(_0xf9cc('0x15'));var utils=require(_0xf9cc('0x16'));var config=require('../../config/environment');var db=require(_0xf9cc('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xf9cc('0x18')][_0xf9cc('0x19')]({'port':0x232a});function checkPasswordPattern(_0x3b00f6,_0x149ef3,_0x21138a){if(_0x21138a){var _0x537884=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x537884['test'](_0x149ef3)){return _0x3b00f6;}else{throw new db[(_0xf9cc('0x1a'))][(_0xf9cc('0x1b'))](_0xf9cc('0x1c'));}}else{return _0x3b00f6;}}function respondWithRpcPromise(_0xc425e5,_0x293d59,_0x1169d6,_0x327ecf){return new BPromise(function(_0x46fc13,_0x18a50b){var _0xdd2175=_0x327ecf||client;return _0xdd2175[_0xf9cc('0x1d')](_0xc425e5,_0x1169d6)[_0xf9cc('0x1e')](function(_0x1bc115){logger['info'](_0xf9cc('0x1f'),_0x293d59,_0xf9cc('0x20'));logger[_0xf9cc('0x21')](_0xf9cc('0x22'),_0x293d59,_0xf9cc('0x20'),JSON[_0xf9cc('0x23')](_0x1bc115));if(_0x1bc115['error']){if(_0x1bc115[_0xf9cc('0x24')][_0xf9cc('0x25')]===0x1f4){logger['error'](_0xf9cc('0x1f'),_0x293d59,_0x1bc115[_0xf9cc('0x24')][_0xf9cc('0x26')]);return _0x18a50b(_0x1bc115[_0xf9cc('0x24')][_0xf9cc('0x26')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x293d59,_0x1bc115['error'][_0xf9cc('0x26')]);return _0x46fc13(_0x1bc115['error'][_0xf9cc('0x26')]);}else{logger[_0xf9cc('0x27')]('Trunk,\x20%s,\x20%s',_0x293d59,_0xf9cc('0x20'));_0x46fc13(_0x1bc115['result'][_0xf9cc('0x26')]);}})[_0xf9cc('0x28')](function(_0x1abb8c){logger[_0xf9cc('0x24')](_0xf9cc('0x1f'),_0x293d59,_0x1abb8c);_0x18a50b(_0x1abb8c);});});}function respondWithStatusCode(_0x2b9dc2,_0x54b43c){_0x54b43c=_0x54b43c||0xcc;return function(_0x433a57){if(_0x433a57){return _0x2b9dc2[_0xf9cc('0x29')](_0x54b43c);}return _0x2b9dc2[_0xf9cc('0x2a')](_0x54b43c)[_0xf9cc('0x2b')]();};}function respondWithResult(_0x5b64e1,_0x3f79cf){_0x3f79cf=_0x3f79cf||0xc8;return function(_0x221c6e){if(_0x221c6e){return _0x5b64e1['status'](_0x3f79cf)[_0xf9cc('0x2c')](_0x221c6e);}};}function respondWithFilteredResult(_0xd0afd9,_0x5dc6fb){return function(_0xd72e6b){if(_0xd72e6b){var _0x119300=_0xd72e6b[_0xf9cc('0x2d')],_0x7242ae=_0x5dc6fb['offset'],_0x332323=_0x5dc6fb['offset']+_0x5dc6fb[_0xf9cc('0x2e')],_0x35e195;if(_0x332323>=_0x119300){_0x332323=_0x119300;_0x35e195=0xc8;}else{_0x35e195=0xce;}_0xd0afd9['status'](_0x35e195);return _0xd0afd9[_0xf9cc('0x2f')](_0xf9cc('0x30'),_0x7242ae+'-'+_0x332323+'/'+_0x119300)[_0xf9cc('0x2c')](_0xd72e6b);}return null;};}function patchUpdates(_0x3b8f38){return function(_0x2a4610){try{jsonpatch[_0xf9cc('0x31')](_0x2a4610,_0x3b8f38,!![]);}catch(_0x32cb52){return BPromise[_0xf9cc('0x32')](_0x32cb52);}return _0x2a4610[_0xf9cc('0x33')]();};}function saveUpdates(_0x2dc096,_0x34c2fe){return function(_0x3c6a78){if(_0x3c6a78){return _0x3c6a78['update'](_0x2dc096)['then'](function(_0x4a41e5){return _0x4a41e5;});}return null;};}function removeEntity(_0x496c16,_0x3c2e58){return function(_0xe0c468){if(_0xe0c468){return _0xe0c468[_0xf9cc('0x34')]()[_0xf9cc('0x1e')](function(){var _0x58bde5=_0xe0c468[_0xf9cc('0x35')]({'plain':!![]});var _0x59c27f=_0xf9cc('0x36');return db['UserProfileResource'][_0xf9cc('0x34')]({'where':{'type':_0x59c27f,'resourceId':_0x58bde5['id']}})['then'](function(){return _0xe0c468;});})[_0xf9cc('0x1e')](function(){_0x496c16['status'](0xcc)[_0xf9cc('0x2b')]();});}};}function handleEntityNotFound(_0xb911c2,_0x29ffd8){return function(_0x3a7c0f){if(!_0x3a7c0f){_0xb911c2[_0xf9cc('0x29')](0x194);}return _0x3a7c0f;};}function handleError(_0x5ca0c1,_0xa23174){_0xa23174=_0xa23174||0x1f4;return function(_0x42908e){logger['error'](_0x42908e['stack']);if(_0x42908e['name']){delete _0x42908e[_0xf9cc('0x37')];}_0x5ca0c1['status'](_0xa23174)[_0xf9cc('0x38')](_0x42908e);};}exports[_0xf9cc('0x39')]=function(_0x302498,_0x677b62){var _0x4bff52={},_0x1de867={},_0x1a87cd={'count':0x0,'rows':[]};var _0x26aedd=_['map'](db[_0xf9cc('0x3a')][_0xf9cc('0x3b')],function(_0x5e3a7e){return{'name':_0x5e3a7e['fieldName'],'type':_0x5e3a7e[_0xf9cc('0x3c')]['key']};});_0x1de867[_0xf9cc('0x3d')]=_[_0xf9cc('0x3e')](_0x26aedd,'name');_0x1de867[_0xf9cc('0x3f')]=_['keys'](_0x302498[_0xf9cc('0x3f')]);_0x1de867[_0xf9cc('0x40')]=_[_0xf9cc('0x41')](_0x1de867[_0xf9cc('0x3d')],_0x1de867[_0xf9cc('0x3f')]);_0x4bff52[_0xf9cc('0x42')]=_[_0xf9cc('0x41')](_0x1de867[_0xf9cc('0x3d')],qs[_0xf9cc('0x43')](_0x302498['query']['fields']));_0x4bff52[_0xf9cc('0x42')]=_0x4bff52[_0xf9cc('0x42')]['length']?_0x4bff52['attributes']:_0x1de867[_0xf9cc('0x3d')];if(!_0x302498['query'][_0xf9cc('0x44')](_0xf9cc('0x45'))){_0x4bff52['limit']=qs['limit'](_0x302498[_0xf9cc('0x3f')][_0xf9cc('0x2e')]);_0x4bff52[_0xf9cc('0x46')]=qs[_0xf9cc('0x46')](_0x302498['query']['offset']);}_0x4bff52[_0xf9cc('0x47')]=qs[_0xf9cc('0x48')](_0x302498['query'][_0xf9cc('0x48')]);_0x4bff52['where']=qs[_0xf9cc('0x40')](_[_0xf9cc('0x49')](_0x302498[_0xf9cc('0x3f')],_0x1de867[_0xf9cc('0x40')]));if(_0x302498[_0xf9cc('0x3f')][_0xf9cc('0x4a')]){_0x4bff52[_0xf9cc('0x4b')]=_[_0xf9cc('0x4c')](_0x4bff52[_0xf9cc('0x4b')],{'$or':_[_0xf9cc('0x3e')](_0x26aedd,function(_0x19a1f2){if(_0x19a1f2[_0xf9cc('0x3c')]!==_0xf9cc('0x4d')){var _0x102570={};_0x102570[_0x19a1f2[_0xf9cc('0x37')]]={'$like':'%'+_0x302498[_0xf9cc('0x3f')]['filter']+'%'};return _0x102570;}})});}_0x4bff52=_[_0xf9cc('0x4c')]({},_0x4bff52,_0x302498[_0xf9cc('0x4e')]);var _0xab8d0b={'where':_0x4bff52['where']};return db[_0xf9cc('0x3a')][_0xf9cc('0x2d')](_0xab8d0b)['then'](function(_0x3614e0){_0x1a87cd['count']=_0x3614e0;if(_0x302498[_0xf9cc('0x3f')][_0xf9cc('0x4f')]){_0x4bff52[_0xf9cc('0x50')]=[{'all':!![]}];}return db[_0xf9cc('0x3a')]['findAll'](_0x4bff52);})[_0xf9cc('0x1e')](function(_0x378623){_0x1a87cd[_0xf9cc('0x51')]=_0x378623;return _0x1a87cd;})[_0xf9cc('0x1e')](respondWithFilteredResult(_0x677b62,_0x4bff52))[_0xf9cc('0x28')](handleError(_0x677b62,null));};exports[_0xf9cc('0x52')]=function(_0x6b23c3,_0xe49e7){var _0x35cc0f={'raw':![],'where':{'id':_0x6b23c3[_0xf9cc('0x53')]['id']}},_0x294a74={};_0x294a74[_0xf9cc('0x3d')]=_[_0xf9cc('0x54')](db[_0xf9cc('0x3a')][_0xf9cc('0x3b')]);_0x294a74[_0xf9cc('0x3f')]=_[_0xf9cc('0x54')](_0x6b23c3['query']);_0x294a74['filters']=_['intersection'](_0x294a74[_0xf9cc('0x3d')],_0x294a74[_0xf9cc('0x3f')]);_0x35cc0f[_0xf9cc('0x42')]=_[_0xf9cc('0x41')](_0x294a74[_0xf9cc('0x3d')],qs['fields'](_0x6b23c3[_0xf9cc('0x3f')][_0xf9cc('0x43')]));_0x35cc0f[_0xf9cc('0x42')]=_0x35cc0f['attributes'][_0xf9cc('0x55')]?_0x35cc0f['attributes']:_0x294a74[_0xf9cc('0x3d')];if(_0x6b23c3['query'][_0xf9cc('0x4f')]){_0x35cc0f[_0xf9cc('0x50')]=[{'all':!![]}];}_0x35cc0f=_[_0xf9cc('0x4c')]({},_0x35cc0f,_0x6b23c3[_0xf9cc('0x4e')]);return db[_0xf9cc('0x3a')][_0xf9cc('0x56')](_0x35cc0f)[_0xf9cc('0x1e')](handleEntityNotFound(_0xe49e7,null))[_0xf9cc('0x1e')](respondWithResult(_0xe49e7,null))[_0xf9cc('0x28')](handleError(_0xe49e7,null));};exports[_0xf9cc('0x57')]=function(_0x182404,_0x165822){var _0x37438b={'where':{'id':_0x182404['params']['id']}},_0x2c1d34={};_0x2c1d34[_0xf9cc('0x3d')]=_['keys'](db[_0xf9cc('0x3a')][_0xf9cc('0x3b')]);_0x37438b[_0xf9cc('0x42')]=_['intersection'](_0x2c1d34[_0xf9cc('0x3d')],qs[_0xf9cc('0x43')](_0x182404[_0xf9cc('0x3f')][_0xf9cc('0x43')]));_0x37438b[_0xf9cc('0x42')]=_0x37438b[_0xf9cc('0x42')][_0xf9cc('0x55')]?_0x37438b[_0xf9cc('0x42')]:_0x2c1d34[_0xf9cc('0x3d')];if(_0x182404[_0xf9cc('0x3f')][_0xf9cc('0x4f')]){_0x37438b[_0xf9cc('0x50')]=[{'all':!![]}];}_0x37438b=_[_0xf9cc('0x4c')]({},_0x37438b,_0x182404[_0xf9cc('0x4e')]);return db[_0xf9cc('0x3a')][_0xf9cc('0x56')](_0x37438b)['then'](handleEntityNotFound(_0x165822,null))[_0xf9cc('0x1e')](function(_0x1af281){if(_0x1af281){var _0x4d397c=_0x1af281[_0xf9cc('0x35')]({'plain':!![]});_0x4d397c=qs[_0xf9cc('0x58')](_0x4d397c,['id',_0xf9cc('0x59'),_0xf9cc('0x5a')]);_0x182404[_0xf9cc('0x5b')]=_[_0xf9cc('0x58')](_0x182404[_0xf9cc('0x5b')],['id','createdAt',_0xf9cc('0x5a')]);return db[_0xf9cc('0x3a')][_0xf9cc('0x5c')](_['merge'](_0x4d397c,_0x182404[_0xf9cc('0x5b')]),{'include':_0x182404[_0xf9cc('0x3f')][_0xf9cc('0x4f')]?[{'all':!![]}]:undefined})[_0xf9cc('0x1e')](function(_0xa3fed7){var _0x42f390=_0x182404[_0xf9cc('0x5d')]['get']({'plain':!![]});if(!_0x42f390)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42f390[_0xf9cc('0x5e')]===_0xf9cc('0x5d')){var _0x36e409=_0xa3fed7[_0xf9cc('0x35')]({'plain':!![]});var _0x4b934b=_0xf9cc('0x36');return db[_0xf9cc('0x5f')][_0xf9cc('0x56')]({'where':{'name':_0x4b934b,'userProfileId':_0x42f390[_0xf9cc('0x60')]},'raw':!![]})[_0xf9cc('0x1e')](function(_0x5a15a2){if(_0x5a15a2&&_0x5a15a2[_0xf9cc('0x61')]===0x0){return db[_0xf9cc('0x62')]['create']({'name':_0x36e409[_0xf9cc('0x37')],'resourceId':_0x36e409['id'],'type':_0x5a15a2['name'],'sectionId':_0x5a15a2['id']},{})[_0xf9cc('0x1e')](function(){return _0xa3fed7;});}else{return _0xa3fed7;}})['catch'](function(_0x108cd6){logger[_0xf9cc('0x24')](_0xf9cc('0x63'),_0x108cd6);throw _0x108cd6;});}return _0xa3fed7;});}})['then'](respondWithResult(_0x165822,0xc9))[_0xf9cc('0x28')](handleError(_0x165822,null));};exports[_0xf9cc('0x5c')]=function(_0x38a10a,_0x133e16,_0x341e2e){var _0x3a04ad;return db[_0xf9cc('0x3a')][_0xf9cc('0x5c')](_0x38a10a[_0xf9cc('0x5b')],{'raw':!![]})[_0xf9cc('0x1e')](function(_0x10e2d2){_0x3a04ad=_0x10e2d2;return db['Trunk'][_0xf9cc('0x64')]({'raw':!![]});})[_0xf9cc('0x1e')](function(_0x104ea2){var _0x5b4ec2=fs['readFileSync'](path['join'](config[_0xf9cc('0x65')],_0xf9cc('0x66')),_0xf9cc('0x67'));var _0x23ab98=fs[_0xf9cc('0x68')](path[_0xf9cc('0x69')](config[_0xf9cc('0x65')],_0xf9cc('0x6a')),'utf8');var _0x12169f=ejs[_0xf9cc('0x6b')](_0x5b4ec2,{'trunks':_0x104ea2||[]});fs[_0xf9cc('0x6c')](_0xf9cc('0x6d'),_0x12169f);if(_0x3a04ad['registry']){var _0x48771a=ejs[_0xf9cc('0x6b')](_0x23ab98,{'trunks':_0x104ea2||[]});fs['writeFileSync'](_0xf9cc('0x6e'),_0x48771a);}})[_0xf9cc('0x1e')](function(){return respondWithRpcPromise(_0xf9cc('0x6f'),_0xf9cc('0x5c'),{'module':_0xf9cc('0x70')});})[_0xf9cc('0x1e')](function(){var _0x370826=_0x38a10a[_0xf9cc('0x5d')][_0xf9cc('0x35')]({'plain':!![]});if(!_0x370826)throw new Error(_0xf9cc('0x71'));if(_0x370826['role']===_0xf9cc('0x5d')){var _0x3f30ac=_0x3a04ad['get']({'plain':!![]});return db[_0xf9cc('0x5f')][_0xf9cc('0x56')]({'where':{'name':_0xf9cc('0x36'),'userProfileId':_0x370826[_0xf9cc('0x60')]},'raw':!![]})[_0xf9cc('0x1e')](function(_0x3a65f9){if(_0x3a65f9&&_0x3a65f9[_0xf9cc('0x61')]===0x0){return db[_0xf9cc('0x62')][_0xf9cc('0x5c')]({'name':_0x3f30ac[_0xf9cc('0x37')],'resourceId':_0x3f30ac['id'],'type':_0x3a65f9[_0xf9cc('0x37')],'sectionId':_0x3a65f9['id']},{})[_0xf9cc('0x1e')](function(){return _0x3a04ad;});}else{return _0x3a04ad;}})[_0xf9cc('0x28')](function(_0x28bdce){logger[_0xf9cc('0x24')](_0xf9cc('0x63'),_0x28bdce);throw _0x28bdce;});}return _0x3a04ad;})['then'](respondWithResult(_0x133e16,0xc9))[_0xf9cc('0x28')](handleError(_0x133e16,null));};exports[_0xf9cc('0x72')]=function(_0x10ce5f,_0x13dc9f,_0x4b00ef){var _0x568c17;return db[_0xf9cc('0x3a')][_0xf9cc('0x56')]({'where':{'id':_0x10ce5f[_0xf9cc('0x53')]['id']}})[_0xf9cc('0x1e')](handleEntityNotFound(_0x13dc9f,null))[_0xf9cc('0x1e')](saveUpdates(_0x10ce5f['body'],null))[_0xf9cc('0x1e')](function(_0x52feb9){if(_0x52feb9){_0x568c17=_0x52feb9;return db[_0xf9cc('0x3a')][_0xf9cc('0x64')]({'raw':!![]});}})[_0xf9cc('0x1e')](function(_0x48f713){if(_0x48f713){var _0x16f75f=fs[_0xf9cc('0x68')](path[_0xf9cc('0x69')](config['root'],_0xf9cc('0x66')),_0xf9cc('0x67'));var _0xbb99a0=fs[_0xf9cc('0x68')](path['join'](config[_0xf9cc('0x65')],_0xf9cc('0x6a')),_0xf9cc('0x67'));var _0x169089=ejs['render'](_0x16f75f,{'trunks':_0x48f713||[]});fs[_0xf9cc('0x6c')](_0xf9cc('0x6d'),_0x169089);var _0x3a09f8=ejs[_0xf9cc('0x6b')](_0xbb99a0,{'trunks':_0x48f713||[]});fs[_0xf9cc('0x6c')](_0xf9cc('0x6e'),_0x3a09f8);return respondWithRpcPromise('Reload',_0xf9cc('0x72'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x6f2693){if(_0x6f2693){return _0x568c17;}})[_0xf9cc('0x1e')](respondWithResult(_0x13dc9f,null))['catch'](handleError(_0x13dc9f,null));};exports[_0xf9cc('0x34')]=function(_0x46d788,_0x118c62,_0x1ceac6){var _0x384923;return db[_0xf9cc('0x3a')][_0xf9cc('0x56')]({'where':{'id':_0x46d788[_0xf9cc('0x53')]['id']}})[_0xf9cc('0x1e')](handleEntityNotFound(_0x118c62,null))[_0xf9cc('0x1e')](removeEntity(_0x118c62,null))[_0xf9cc('0x1e')](function(){return db[_0xf9cc('0x3a')]['findAll']({'raw':!![]});})[_0xf9cc('0x1e')](function(_0x1931cb){var _0x399e23=fs[_0xf9cc('0x68')](path[_0xf9cc('0x69')](config[_0xf9cc('0x65')],_0xf9cc('0x66')),_0xf9cc('0x67'));var _0x20818b=fs[_0xf9cc('0x68')](path[_0xf9cc('0x69')](config[_0xf9cc('0x65')],_0xf9cc('0x6a')),'utf8');var _0x5441b8=ejs[_0xf9cc('0x6b')](_0x399e23,{'trunks':_0x1931cb});var _0x5c372f=ejs[_0xf9cc('0x6b')](_0x20818b,{'trunks':_0x1931cb});fs[_0xf9cc('0x6c')](_0xf9cc('0x6d'),_0x5441b8);fs[_0xf9cc('0x6c')]('/etc/asterisk/sip_xcally_registers.conf',_0x5c372f);return respondWithRpcPromise(_0xf9cc('0x6f'),_0xf9cc('0x34'),{'module':_0xf9cc('0x70')});})[_0xf9cc('0x28')](handleError(_0x118c62,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 852966f..1bf92ae 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 _0x7b4b=['rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2e7079,_0x3ef2a5){var _0x226df1=function(_0x542fac){while(--_0x542fac){_0x2e7079['push'](_0x2e7079['shift']());}};_0x226df1(++_0x3ef2a5);}(_0x7b4b,0x7f));var _0xb7b4=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x7b4b[_0x33bc64];return _0x3fdd34;};'use strict';var _=require(_0xb7b4('0x0'));var util=require(_0xb7b4('0x1'));var logger=require(_0xb7b4('0x2'))(_0xb7b4('0x3'));var moment=require(_0xb7b4('0x4'));var BPromise=require(_0xb7b4('0x5'));var rp=require(_0xb7b4('0x6'));var fs=require('fs');var path=require(_0xb7b4('0x7'));var rimraf=require(_0xb7b4('0x8'));var config=require(_0xb7b4('0x9'));var attributes=require(_0xb7b4('0xa'));module[_0xb7b4('0xb')]=function(_0x45e105,_0x55fe66){return _0x45e105[_0xb7b4('0xc')](_0xb7b4('0xd'),attributes,{'tableName':_0xb7b4('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f76=['moment','bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api'];(function(_0x28577d,_0x58f108){var _0x303bff=function(_0x20ff98){while(--_0x20ff98){_0x28577d['push'](_0x28577d['shift']());}};_0x303bff(++_0x58f108);}(_0x9f76,0x6c));var _0x69f7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9f76[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x69f7('0x0'));var util=require(_0x69f7('0x1'));var logger=require(_0x69f7('0x2'))(_0x69f7('0x3'));var moment=require(_0x69f7('0x4'));var BPromise=require(_0x69f7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x69f7('0x6'));var rimraf=require(_0x69f7('0x7'));var config=require(_0x69f7('0x8'));var attributes=require(_0x69f7('0x9'));module[_0x69f7('0xa')]=function(_0x2407f2,_0x26dc8c){return _0x2407f2[_0x69f7('0xb')](_0x69f7('0xc'),attributes,{'tableName':_0x69f7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index e1cb39e..c8f47f1 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 _0x0b0e=['model','GetTrunk','Trunk','find','where','include','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','findAll','raw','options','attributes','map'];(function(_0x33bced,_0x557204){var _0x1d40be=function(_0x852972){while(--_0x852972){_0x33bced['push'](_0x33bced['shift']());}};_0x1d40be(++_0x557204);}(_0x0b0e,0x187));var _0xe0b0=function(_0x110d59,_0x50c4fb){_0x110d59=_0x110d59-0x0;var _0x2fce64=_0x0b0e[_0x110d59];return _0x2fce64;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('Trunk,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});}exports['GetTrunk']=function(_0x54a3eb){var _0x46bb44=this;return new Promise(function(_0x50a441,_0x4df8da){return db['Trunk'][_0xe0b0('0x18')]({'raw':_0x54a3eb['options']?_0x54a3eb['options'][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['where']||null:null,'attributes':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'limit':_0x54a3eb[_0xe0b0('0x1a')]?_0x54a3eb[_0xe0b0('0x1a')]['limit']||null:null,'include':_0x54a3eb['options']?_0x54a3eb[_0xe0b0('0x1a')]['include']?_[_0xe0b0('0x1c')](_0x54a3eb[_0xe0b0('0x1a')]['include'],function(_0x170ad8){return{'model':db[_0x170ad8['model']],'as':_0x170ad8['as'],'attributes':_0x170ad8[_0xe0b0('0x1b')],'include':_0x170ad8['include']?_[_0xe0b0('0x1c')](_0x170ad8['include'],function(_0x3e5c88){return{'model':db[_0x3e5c88['model']],'as':_0x3e5c88['as'],'attributes':_0x3e5c88[_0xe0b0('0x1b')],'include':_0x3e5c88['include']?_[_0xe0b0('0x1c')](_0x3e5c88['include'],function(_0x362aba){return{'model':db[_0x362aba[_0xe0b0('0x1d')]],'as':_0x362aba['as'],'attributes':_0x362aba[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x3ec2){logger[_0xe0b0('0xe')]('GetTrunk',_0x54a3eb);logger[_0xe0b0('0x10')](_0xe0b0('0x1e'),_0x54a3eb,JSON['stringify'](_0x3ec2));_0x50a441(_0x3ec2);})[_0xe0b0('0x17')](function(_0x419b1f){logger[_0xe0b0('0x13')](_0xe0b0('0x1e'),_0x419b1f[_0xe0b0('0x14')],_0x54a3eb);_0x4df8da(_0x46bb44[_0xe0b0('0x13')](0x1f4,_0x419b1f[_0xe0b0('0x14')]));});});};exports['ShowTrunk']=function(_0x1854b8){var _0x3c0109=this;return new Promise(function(_0x48a9b5,_0x4fe400){return db[_0xe0b0('0x1f')][_0xe0b0('0x20')]({'raw':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x19')]===undefined?!![]:![]:!![],'where':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x21')]||null:null,'attributes':_0x1854b8[_0xe0b0('0x1a')]?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x1b')]||null:null,'include':_0x1854b8['options']?_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x1854b8[_0xe0b0('0x1a')][_0xe0b0('0x22')],function(_0x12eeb8){return{'model':db[_0x12eeb8[_0xe0b0('0x1d')]],'as':_0x12eeb8['as'],'attributes':_0x12eeb8[_0xe0b0('0x1b')],'include':_0x12eeb8[_0xe0b0('0x22')]?_[_0xe0b0('0x1c')](_0x12eeb8[_0xe0b0('0x22')],function(_0x1a0c90){return{'model':db[_0x1a0c90[_0xe0b0('0x1d')]],'as':_0x1a0c90['as'],'attributes':_0x1a0c90[_0xe0b0('0x1b')],'include':_0x1a0c90[_0xe0b0('0x22')]?_['map'](_0x1a0c90[_0xe0b0('0x22')],function(_0x135be5){return{'model':db[_0x135be5[_0xe0b0('0x1d')]],'as':_0x135be5['as'],'attributes':_0x135be5[_0xe0b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe0b0('0xd')](function(_0x2c6e60){logger[_0xe0b0('0xe')]('ShowTrunk',_0x1854b8);logger['debug']('ShowTrunk',_0x1854b8,JSON['stringify'](_0x2c6e60));_0x48a9b5(_0x2c6e60);})[_0xe0b0('0x17')](function(_0xc3d967){logger[_0xe0b0('0x13')]('ShowTrunk',_0xc3d967[_0xe0b0('0x14')],_0x1854b8);_0x4fe400(_0x3c0109[_0xe0b0('0x13')](0x1f4,_0xc3d967[_0xe0b0('0x14')]));});});}; \ 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(_0x277fda,_0x57df6e){var _0x34475a=function(_0x164c2d){while(--_0x164c2d){_0x277fda['push'](_0x277fda['shift']());}};_0x34475a(++_0x57df6e);}(_0x2032,0xd9));var _0x2203=function(_0x4be594,_0xece053){_0x4be594=_0x4be594-0x0;var _0x4aaabe=_0x2032[_0x4be594];return _0x4aaabe;};'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 0e3f348..edd81ee 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 _0xadb5=['/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','/create_many','bulkCreate','addContacts','addQueues','diskStorage','join','root','server/files/images/','format','now','single','addAvatar','/:id/logout','/:id/pause','pause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addSquareProjects','/:id/api_key','createApiKey','put','update','removeQueues','delete','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/openchannel_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeApiKey','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/:id','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions'];(function(_0x6c0000,_0x58c148){var _0x529c86=function(_0x693ea5){while(--_0x693ea5){_0x6c0000['push'](_0x6c0000['shift']());}};_0x529c86(++_0x58c148);}(_0xadb5,0xad));var _0x5adb=function(_0x2310ba,_0x4e795f){_0x2310ba=_0x2310ba-0x0;var _0x18379c=_0xadb5[_0x2310ba];return _0x18379c;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var controller=require(_0x5adb('0x6'));router['get']('/',auth[_0x5adb('0x7')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0xa'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x9')](_0x5adb('0xc'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x9')](_0x5adb('0xe'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xf')]);router['get']('/:id/avatar',controller[_0x5adb('0x10')]);router[_0x5adb('0x9')](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router['get'](_0x5adb('0x13'),auth['isAuthenticated'](),controller[_0x5adb('0x14')]);router[_0x5adb('0x9')](_0x5adb('0x15'),auth['isAuthenticated'](),controller[_0x5adb('0x16')]);router[_0x5adb('0x9')](_0x5adb('0x17'),auth['isAuthenticated'](),controller[_0x5adb('0x18')]);router['get'](_0x5adb('0x19'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x1a')]);router[_0x5adb('0x9')](_0x5adb('0x1b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x1c')]);router[_0x5adb('0x9')](_0x5adb('0x1d'),auth['isAuthenticated'](),controller[_0x5adb('0x1e')]);router['get'](_0x5adb('0x1f'),auth['isAuthenticated'](),controller[_0x5adb('0x20')]);router['get']('/:id/mail/interactions',auth[_0x5adb('0x7')](),controller[_0x5adb('0x21')]);router[_0x5adb('0x9')](_0x5adb('0x22'),auth[_0x5adb('0x7')](),controller['getSmsInteractions']);router[_0x5adb('0x9')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x5adb('0x23')]);router[_0x5adb('0x9')](_0x5adb('0x24'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x25')]);router[_0x5adb('0x9')](_0x5adb('0x26'),auth['isAuthenticated'](),controller[_0x5adb('0x27')]);router[_0x5adb('0x9')](_0x5adb('0x28'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x29')]);router['get'](_0x5adb('0x2a'),auth[_0x5adb('0x7')](),controller['getVoicePrefixes']);router[_0x5adb('0x9')](_0x5adb('0x2b'),auth[_0x5adb('0x7')](),controller['getFaxAccounts']);router[_0x5adb('0x9')](_0x5adb('0x2c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x2d')]);router[_0x5adb('0x9')](_0x5adb('0x2e'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0x5adb('0x2f'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x30')]);router[_0x5adb('0x9')](_0x5adb('0x31'),auth['isAuthenticated'](),controller[_0x5adb('0x32')]);router[_0x5adb('0x9')](_0x5adb('0x33'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x34')]);router[_0x5adb('0x9')](_0x5adb('0x35'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x36')]);router[_0x5adb('0x9')]('/:id/api_key',auth[_0x5adb('0x7')](),controller['getApiKey']);router[_0x5adb('0x37')](_0x5adb('0x38'),auth['isAuthenticated'](),controller[_0x5adb('0x39')]);router[_0x5adb('0x37')](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x3a')]);router[_0x5adb('0x37')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5adb('0x37')]('/:id/queues',auth[_0x5adb('0x7')](),controller[_0x5adb('0x3b')]);var upload=multer({'storage':multer[_0x5adb('0x3c')]({'destination':function(_0x2da912,_0x9bdece,_0x5ece39){_0x5ece39(null,path[_0x5adb('0x3d')](config[_0x5adb('0x3e')],_0x5adb('0x3f')));},'filename':function(_0x54851b,_0x4c8870,_0x32eb69){_0x32eb69(null,util[_0x5adb('0x40')]('%s-%s',Date[_0x5adb('0x41')](),_0x4c8870['originalname']));}})});router[_0x5adb('0x37')]('/:id/avatar',upload[_0x5adb('0x42')]('file'),controller[_0x5adb('0x43')]);router[_0x5adb('0x37')]('/:id/login',auth[_0x5adb('0x7')](),controller['login']);router[_0x5adb('0x37')](_0x5adb('0x44'),auth[_0x5adb('0x7')](),controller['logout']);router[_0x5adb('0x37')](_0x5adb('0x45'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x46')]);router[_0x5adb('0x37')]('/:id/unpause',auth['isAuthenticated'](),controller['unpause']);router['post'](_0x5adb('0x24'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x47')]);router[_0x5adb('0x37')](_0x5adb('0x48'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x49')]);router[_0x5adb('0x37')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x5adb('0x4a')]);router['post'](_0x5adb('0x4b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x4c')]);router[_0x5adb('0x37')](_0x5adb('0x4d'),auth['isAuthenticated'](),controller[_0x5adb('0x4e')]);router[_0x5adb('0x37')]('/:id/openchannel_interactions',auth[_0x5adb('0x7')](),controller[_0x5adb('0x4f')]);router['post'](_0x5adb('0x2b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x50')]);router[_0x5adb('0x37')](_0x5adb('0x2c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x51')]);router['post']('/:id/openchannel_accounts',auth[_0x5adb('0x7')](),controller[_0x5adb('0x52')]);router[_0x5adb('0x37')](_0x5adb('0x2f'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x5adb('0x37')](_0x5adb('0x31'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x53')]);router[_0x5adb('0x37')]('/:id/square_projects',auth[_0x5adb('0x7')](),controller[_0x5adb('0x54')]);router['post'](_0x5adb('0x55'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x56')]);router[_0x5adb('0x57')](_0x5adb('0xe'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x58')]);router[_0x5adb('0x57')]('/:id/password',auth[_0x5adb('0x7')](),controller['changePassword']);router['delete']('/:id/queues',auth[_0x5adb('0x7')](),controller[_0x5adb('0x59')]);router[_0x5adb('0x5a')]('/:id/teams',auth[_0x5adb('0x7')](),controller['removeTeams']);router[_0x5adb('0x5a')](_0x5adb('0xe'),auth[_0x5adb('0x7')](),controller['destroy']);router[_0x5adb('0x5a')]('/:id/chat_interactions',auth[_0x5adb('0x7')](),controller[_0x5adb('0x5b')]);router['delete'](_0x5adb('0x5c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x5d')]);router[_0x5adb('0x5a')](_0x5adb('0x4b'),auth['isAuthenticated'](),controller[_0x5adb('0x5e')]);router[_0x5adb('0x5a')](_0x5adb('0x4d'),auth[_0x5adb('0x7')](),controller['removeSmsInteractions']);router[_0x5adb('0x5a')](_0x5adb('0x5f'),auth[_0x5adb('0x7')](),controller['removeOpenchannelInteractions']);router[_0x5adb('0x5a')](_0x5adb('0x2b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x60')]);router['delete'](_0x5adb('0x2c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x61')]);router[_0x5adb('0x5a')](_0x5adb('0x2e'),auth['isAuthenticated'](),controller[_0x5adb('0x62')]);router['delete'](_0x5adb('0x2f'),auth['isAuthenticated'](),controller[_0x5adb('0x63')]);router[_0x5adb('0x5a')](_0x5adb('0x31'),auth[_0x5adb('0x7')](),controller['removeChatWebsites']);router[_0x5adb('0x5a')](_0x5adb('0x33'),auth[_0x5adb('0x7')](),controller['removeSquareProjects']);router['delete']('/:id/api_key',auth[_0x5adb('0x7')](),controller[_0x5adb('0x64')]);module[_0x5adb('0x65')]=router; \ No newline at end of file +var _0xadb5=['/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','/create_many','bulkCreate','addContacts','addQueues','diskStorage','join','root','server/files/images/','format','now','single','addAvatar','/:id/logout','/:id/pause','pause','addTeams','/:id/chat_interactions','addChatInteractions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addSquareProjects','/:id/api_key','createApiKey','put','update','removeQueues','delete','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','/:id/openchannel_interactions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeApiKey','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./user.controller','isAuthenticated','index','get','/describe','describe','/whoami','whoami','/:id','show','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions'];(function(_0x53da67,_0x50f467){var _0x5cf8f7=function(_0x5b4ee1){while(--_0x5b4ee1){_0x53da67['push'](_0x53da67['shift']());}};_0x5cf8f7(++_0x50f467);}(_0xadb5,0xad));var _0x5adb=function(_0x1c61f9,_0x41fb61){_0x1c61f9=_0x1c61f9-0x0;var _0x7e5395=_0xadb5[_0x1c61f9];return _0x7e5395;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var controller=require(_0x5adb('0x6'));router['get']('/',auth[_0x5adb('0x7')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0xa'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x9')](_0x5adb('0xc'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x9')](_0x5adb('0xe'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xf')]);router['get']('/:id/avatar',controller[_0x5adb('0x10')]);router[_0x5adb('0x9')](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router['get'](_0x5adb('0x13'),auth['isAuthenticated'](),controller[_0x5adb('0x14')]);router[_0x5adb('0x9')](_0x5adb('0x15'),auth['isAuthenticated'](),controller[_0x5adb('0x16')]);router[_0x5adb('0x9')](_0x5adb('0x17'),auth['isAuthenticated'](),controller[_0x5adb('0x18')]);router['get'](_0x5adb('0x19'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x1a')]);router[_0x5adb('0x9')](_0x5adb('0x1b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x1c')]);router[_0x5adb('0x9')](_0x5adb('0x1d'),auth['isAuthenticated'](),controller[_0x5adb('0x1e')]);router['get'](_0x5adb('0x1f'),auth['isAuthenticated'](),controller[_0x5adb('0x20')]);router['get']('/:id/mail/interactions',auth[_0x5adb('0x7')](),controller[_0x5adb('0x21')]);router[_0x5adb('0x9')](_0x5adb('0x22'),auth[_0x5adb('0x7')](),controller['getSmsInteractions']);router[_0x5adb('0x9')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x5adb('0x23')]);router[_0x5adb('0x9')](_0x5adb('0x24'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x25')]);router[_0x5adb('0x9')](_0x5adb('0x26'),auth['isAuthenticated'](),controller[_0x5adb('0x27')]);router[_0x5adb('0x9')](_0x5adb('0x28'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x29')]);router['get'](_0x5adb('0x2a'),auth[_0x5adb('0x7')](),controller['getVoicePrefixes']);router[_0x5adb('0x9')](_0x5adb('0x2b'),auth[_0x5adb('0x7')](),controller['getFaxAccounts']);router[_0x5adb('0x9')](_0x5adb('0x2c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x2d')]);router[_0x5adb('0x9')](_0x5adb('0x2e'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0x5adb('0x2f'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x30')]);router[_0x5adb('0x9')](_0x5adb('0x31'),auth['isAuthenticated'](),controller[_0x5adb('0x32')]);router[_0x5adb('0x9')](_0x5adb('0x33'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x34')]);router[_0x5adb('0x9')](_0x5adb('0x35'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x36')]);router[_0x5adb('0x9')]('/:id/api_key',auth[_0x5adb('0x7')](),controller['getApiKey']);router[_0x5adb('0x37')](_0x5adb('0x38'),auth['isAuthenticated'](),controller[_0x5adb('0x39')]);router[_0x5adb('0x37')](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x3a')]);router[_0x5adb('0x37')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5adb('0x37')]('/:id/queues',auth[_0x5adb('0x7')](),controller[_0x5adb('0x3b')]);var upload=multer({'storage':multer[_0x5adb('0x3c')]({'destination':function(_0x2da912,_0x9bdece,_0x5ece39){_0x5ece39(null,path[_0x5adb('0x3d')](config[_0x5adb('0x3e')],_0x5adb('0x3f')));},'filename':function(_0x54851b,_0x4c8870,_0x32eb69){_0x32eb69(null,util[_0x5adb('0x40')]('%s-%s',Date[_0x5adb('0x41')](),_0x4c8870['originalname']));}})});router[_0x5adb('0x37')]('/:id/avatar',upload[_0x5adb('0x42')]('file'),controller[_0x5adb('0x43')]);router[_0x5adb('0x37')]('/:id/login',auth[_0x5adb('0x7')](),controller['login']);router[_0x5adb('0x37')](_0x5adb('0x44'),auth[_0x5adb('0x7')](),controller['logout']);router[_0x5adb('0x37')](_0x5adb('0x45'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x46')]);router[_0x5adb('0x37')]('/:id/unpause',auth['isAuthenticated'](),controller['unpause']);router['post'](_0x5adb('0x24'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x47')]);router[_0x5adb('0x37')](_0x5adb('0x48'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x49')]);router[_0x5adb('0x37')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x5adb('0x4a')]);router['post'](_0x5adb('0x4b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x4c')]);router[_0x5adb('0x37')](_0x5adb('0x4d'),auth['isAuthenticated'](),controller[_0x5adb('0x4e')]);router[_0x5adb('0x37')]('/:id/openchannel_interactions',auth[_0x5adb('0x7')](),controller[_0x5adb('0x4f')]);router['post'](_0x5adb('0x2b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x50')]);router[_0x5adb('0x37')](_0x5adb('0x2c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x51')]);router['post']('/:id/openchannel_accounts',auth[_0x5adb('0x7')](),controller[_0x5adb('0x52')]);router[_0x5adb('0x37')](_0x5adb('0x2f'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x5adb('0x37')](_0x5adb('0x31'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x53')]);router[_0x5adb('0x37')]('/:id/square_projects',auth[_0x5adb('0x7')](),controller[_0x5adb('0x54')]);router['post'](_0x5adb('0x55'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x56')]);router[_0x5adb('0x57')](_0x5adb('0xe'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x58')]);router[_0x5adb('0x57')]('/:id/password',auth[_0x5adb('0x7')](),controller['changePassword']);router['delete']('/:id/queues',auth[_0x5adb('0x7')](),controller[_0x5adb('0x59')]);router[_0x5adb('0x5a')]('/:id/teams',auth[_0x5adb('0x7')](),controller['removeTeams']);router[_0x5adb('0x5a')](_0x5adb('0xe'),auth[_0x5adb('0x7')](),controller['destroy']);router[_0x5adb('0x5a')]('/:id/chat_interactions',auth[_0x5adb('0x7')](),controller[_0x5adb('0x5b')]);router['delete'](_0x5adb('0x5c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x5d')]);router[_0x5adb('0x5a')](_0x5adb('0x4b'),auth['isAuthenticated'](),controller[_0x5adb('0x5e')]);router[_0x5adb('0x5a')](_0x5adb('0x4d'),auth[_0x5adb('0x7')](),controller['removeSmsInteractions']);router[_0x5adb('0x5a')](_0x5adb('0x5f'),auth[_0x5adb('0x7')](),controller['removeOpenchannelInteractions']);router[_0x5adb('0x5a')](_0x5adb('0x2b'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x60')]);router['delete'](_0x5adb('0x2c'),auth[_0x5adb('0x7')](),controller[_0x5adb('0x61')]);router[_0x5adb('0x5a')](_0x5adb('0x2e'),auth['isAuthenticated'](),controller[_0x5adb('0x62')]);router['delete'](_0x5adb('0x2f'),auth['isAuthenticated'](),controller[_0x5adb('0x63')]);router[_0x5adb('0x5a')](_0x5adb('0x31'),auth[_0x5adb('0x7')](),controller['removeChatWebsites']);router[_0x5adb('0x5a')](_0x5adb('0x33'),auth[_0x5adb('0x7')](),controller['removeSquareProjects']);router['delete']('/:id/api_key',auth[_0x5adb('0x7')](),controller[_0x5adb('0x64')]);module[_0x5adb('0x65')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 227d542..68db3a3 100644 --- a/server/api/user/user.attributes.js +++ b/server/api/user/user.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x3eb7ca,_0x233821){var _0xe5e379=function(_0x5a2fbc){while(--_0x5a2fbc){_0x3eb7ca['push'](_0x3eb7ca['shift']());}};_0xe5e379(++_0x233821);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0xb3dbe0,_0x41779b){var _0x46ab96=function(_0x46d340){while(--_0x46d340){_0xb3dbe0['push'](_0xb3dbe0['shift']());}};_0x46ab96(++_0x41779b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index c9344e5..fd790c2 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 _0xd2f5=['catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','get','Users','user','Agents','agent','filter','ignore','map','role','value','name','UserProfileResource','destroy','stack','index','User','rawAttributes','model','differenceBy','password','salt','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','sequelize','lower','options','rows','show','params','includeAll','include','bulkCreate','body','find','describe','addContacts','ids','omit','agent\x20role','telephone','admin','../../config/license/util','getLicense','telephones','users','isNil','License\x20limit\x20reached','count\x20%s:\x20%s','create','internal','Setting','findById','securePassword','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','length','from','voicemail','mailbox','VoiceMail','fullname','email','101','103','104','105','100','111','Unable\x20to\x20retrieve\x20the\x20current\x20user','Telephones','UserProfileSection','userProfileId','autoAssociation','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','Sequelize','Wrong\x20credentials','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','penalty','toLowerCase','QueueId','Queue:save','VoiceQueue','findAll','voice','online','push','SIP/%s','each','UserVoiceQueueRt','removeQueues','Queues','emit','Queue:remove','addAvatar','file','filename','getAvatar','join','userpic','download','existsSync','root','server/files/images/','getContacts','findOne','CmContact','CmList','tag','getQueues','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','login','mobile','format','intrf','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','upsert','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','all','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','pause','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','pauseType','lastPauseAt','QueuePause','fax','sms','openchannel','manual','Pause','getTeams','addTeams','Team','setDataValue','Voice','Chat','Sms','Fax','getOpenchannelQueues','Openchannel','transaction','addAgent','getDataValue','removeTeams','getFaxQueues','flatten','removeAgent','getLists','getAgents','values','send','addChatInteractions','spread','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','ChatWebsite','getChatWebsites','addChatWebsites','removeChatWebsites','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$or','$gt','$gte','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contained','$any','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','html-pdf','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','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','User,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x10e741,_0x2aa3a0){var _0x12c381=function(_0x42af1c){while(--_0x42af1c){_0x10e741['push'](_0x10e741['shift']());}};_0x12c381(++_0x2aa3a0);}(_0xd2f5,0x12e));var _0x5d2f=function(_0x1168b7,_0x5774e5){_0x1168b7=_0x1168b7-0x0;var _0x1939c3=_0xd2f5[_0x1168b7];return _0x1939c3;};'use strict';var pdf=require(_0x5d2f('0x0'));var emlformat=require(_0x5d2f('0x1'));var rimraf=require(_0x5d2f('0x2'));var zipdir=require(_0x5d2f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5d2f('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5d2f('0x5'));var util=require(_0x5d2f('0x6'));var path=require(_0x5d2f('0x7'));var sox=require('sox');var csv=require(_0x5d2f('0x8'));var ejs=require(_0x5d2f('0x9'));var fs=require('fs');var _=require(_0x5d2f('0xa'));var squel=require('squel');var crypto=require(_0x5d2f('0xb'));var jsforce=require(_0x5d2f('0xc'));var deskjs=require(_0x5d2f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5d2f('0xe'));var Redis=require(_0x5d2f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5d2f('0x10'));var as=require(_0x5d2f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5d2f('0x12'));var utils=require(_0x5d2f('0x13'));var config=require('../../config/environment');var db=require(_0x5d2f('0x14'))['db'];config[_0x5d2f('0x15')]=_[_0x5d2f('0x16')](config[_0x5d2f('0x15')],{'host':_0x5d2f('0x17'),'port':0x18eb});var socket=require(_0x5d2f('0x18'))(new Redis(config[_0x5d2f('0x15')]));require('./user.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5d2f('0x19')]({'port':0x232a});function checkPasswordPattern(_0x4ca0d6,_0x3bd6a1,_0x405455){if(_0x405455){var _0x25b409=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25b409[_0x5d2f('0x1a')](_0x3bd6a1)){return _0x4ca0d6;}else{throw new db['Sequelize'][(_0x5d2f('0x1b'))](_0x5d2f('0x1c'));}}else{return _0x4ca0d6;}}function respondWithRpcPromise(_0x4ae2dc,_0x32f5d9,_0x1e2145,_0x275e8a){return new BPromise(function(_0x19983c,_0x283544){var _0x18431d=_0x275e8a||client;return _0x18431d[_0x5d2f('0x1d')](_0x4ae2dc,_0x1e2145)[_0x5d2f('0x1e')](function(_0x539ec8){logger[_0x5d2f('0x1f')](_0x5d2f('0x20'),_0x32f5d9,_0x5d2f('0x21'));logger[_0x5d2f('0x22')]('User,\x20%s,\x20%s,\x20%s',_0x32f5d9,_0x5d2f('0x21'),JSON[_0x5d2f('0x23')](_0x539ec8));if(_0x539ec8['error']){if(_0x539ec8[_0x5d2f('0x24')][_0x5d2f('0x25')]===0x1f4){logger[_0x5d2f('0x24')](_0x5d2f('0x20'),_0x32f5d9,_0x539ec8[_0x5d2f('0x24')][_0x5d2f('0x26')]);return _0x283544(_0x539ec8[_0x5d2f('0x24')][_0x5d2f('0x26')]);}logger[_0x5d2f('0x24')](_0x5d2f('0x20'),_0x32f5d9,_0x539ec8[_0x5d2f('0x24')]['message']);return _0x19983c(_0x539ec8[_0x5d2f('0x24')][_0x5d2f('0x26')]);}else{logger[_0x5d2f('0x1f')](_0x5d2f('0x20'),_0x32f5d9,_0x5d2f('0x21'));_0x19983c(_0x539ec8[_0x5d2f('0x27')][_0x5d2f('0x26')]);}})[_0x5d2f('0x28')](function(_0x363e7a){logger['error'](_0x5d2f('0x20'),_0x32f5d9,_0x363e7a);_0x283544(_0x363e7a);});});}function respondWithStatusCode(_0x208fc4,_0x493344){_0x493344=_0x493344||0xcc;return function(_0x119610){if(_0x119610){return _0x208fc4[_0x5d2f('0x29')](_0x493344);}return _0x208fc4[_0x5d2f('0x2a')](_0x493344)[_0x5d2f('0x2b')]();};}function respondWithResult(_0x40ff3a,_0x75f970){_0x75f970=_0x75f970||0xc8;return function(_0x4d368f){if(_0x4d368f){return _0x40ff3a[_0x5d2f('0x2a')](_0x75f970)[_0x5d2f('0x2c')](_0x4d368f);}};}function respondWithFilteredResult(_0x5ad4cc,_0x4c51c1){return function(_0x55a2e9){if(_0x55a2e9){var _0x55df19=_0x55a2e9[_0x5d2f('0x2d')],_0x4586e4=_0x4c51c1['offset'],_0x3a52d7=_0x4c51c1[_0x5d2f('0x2e')]+_0x4c51c1[_0x5d2f('0x2f')],_0x1f64b3;if(_0x3a52d7>=_0x55df19){_0x3a52d7=_0x55df19;_0x1f64b3=0xc8;}else{_0x1f64b3=0xce;}_0x5ad4cc[_0x5d2f('0x2a')](_0x1f64b3);return _0x5ad4cc[_0x5d2f('0x30')]('Content-Range',_0x4586e4+'-'+_0x3a52d7+'/'+_0x55df19)[_0x5d2f('0x2c')](_0x55a2e9);}return null;};}function patchUpdates(_0x4da14a){return function(_0x2bc214){try{jsonpatch[_0x5d2f('0x31')](_0x2bc214,_0x4da14a,!![]);}catch(_0x3f4f22){return BPromise[_0x5d2f('0x32')](_0x3f4f22);}return _0x2bc214['save']();};}function saveUpdates(_0x2746b8,_0x556886){return function(_0x13db12){if(_0x13db12){return _0x13db12[_0x5d2f('0x33')](_0x2746b8)[_0x5d2f('0x1e')](function(_0x5839a0){return _0x5839a0;});}return null;};}function removeEntity(_0xf639a9,_0x380009){return function(_0x7c72ed){if(_0x7c72ed){return _0x7c72ed['destroy']()['then'](function(){var _0x239910=_0x7c72ed[_0x5d2f('0x34')]({'plain':!![]});var _0x261d06=[{'name':_0x5d2f('0x35'),'value':_0x5d2f('0x36'),'ignore':!![]},{'name':_0x5d2f('0x37'),'value':_0x5d2f('0x38'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x26818e=_(_0x261d06)[_0x5d2f('0x39')](_0x5d2f('0x3a'))[_0x5d2f('0x3b')]('value')['value']();if(_['includes'](_0x26818e,_0x239910[_0x5d2f('0x3c')])){return;}var _0x588b4c=_['find'](_0x261d06,[_0x5d2f('0x3d'),_0x239910[_0x5d2f('0x3c')]])[_0x5d2f('0x3e')];return db[_0x5d2f('0x3f')][_0x5d2f('0x40')]({'where':{'type':_0x588b4c,'resourceId':_0x239910['id']}})[_0x5d2f('0x1e')](function(){return _0x7c72ed;});})[_0x5d2f('0x1e')](function(){_0xf639a9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x481bd5,_0x15e67a){return function(_0x1eb43b){if(!_0x1eb43b){_0x481bd5[_0x5d2f('0x29')](0x194);}return _0x1eb43b;};}function handleError(_0xacee1c,_0x3a71fb){_0x3a71fb=_0x3a71fb||0x1f4;return function(_0x2389ff){logger[_0x5d2f('0x24')](_0x2389ff[_0x5d2f('0x41')]);if(_0x2389ff[_0x5d2f('0x3e')]){delete _0x2389ff[_0x5d2f('0x3e')];}_0xacee1c[_0x5d2f('0x2a')](_0x3a71fb)['send'](_0x2389ff);};}exports[_0x5d2f('0x42')]=function(_0xa7552b,_0x55f0aa){var _0x13c893={},_0x1cf020={},_0x159ba1={'count':0x0,'rows':[]};var _0x888d63=_['map'](db[_0x5d2f('0x43')][_0x5d2f('0x44')],function(_0x22762f){return{'name':_0x22762f['fieldName'],'type':_0x22762f['type']['key']};});_0x1cf020[_0x5d2f('0x45')]=_[_0x5d2f('0x46')](_[_0x5d2f('0x3b')](_0x888d63,_0x5d2f('0x3e')),[_0x5d2f('0x47'),_0x5d2f('0x48')]);_0x1cf020[_0x5d2f('0x49')]=_[_0x5d2f('0x4a')](_0xa7552b[_0x5d2f('0x49')]);_0x1cf020[_0x5d2f('0x4b')]=_['intersection'](_0x1cf020[_0x5d2f('0x45')],_0x1cf020['query']);_0x13c893[_0x5d2f('0x4c')]=_[_0x5d2f('0x4d')](_0x1cf020['model'],qs['fields'](_0xa7552b[_0x5d2f('0x49')][_0x5d2f('0x4e')]));_0x13c893[_0x5d2f('0x4c')]=_0x13c893[_0x5d2f('0x4c')]['length']?_0x13c893['attributes']:_0x1cf020[_0x5d2f('0x45')];if(!_0xa7552b[_0x5d2f('0x49')][_0x5d2f('0x4f')](_0x5d2f('0x50'))){_0x13c893[_0x5d2f('0x2f')]=qs[_0x5d2f('0x2f')](_0xa7552b['query'][_0x5d2f('0x2f')]);_0x13c893['offset']=qs[_0x5d2f('0x2e')](_0xa7552b[_0x5d2f('0x49')][_0x5d2f('0x2e')]);}_0x13c893[_0x5d2f('0x51')]=qs['sort'](_0xa7552b[_0x5d2f('0x49')][_0x5d2f('0x52')]);_0x13c893[_0x5d2f('0x53')]=qs['filters'](_[_0x5d2f('0x54')](_0xa7552b[_0x5d2f('0x49')],_0x1cf020['filters']));if(_0xa7552b['query'][_0x5d2f('0x39')]){_0x13c893['where']=_[_0x5d2f('0x55')](_0x13c893['where'],{'$or':_['map'](_0x888d63,function(_0x27b470){if(_0x27b470[_0x5d2f('0x56')]!==_0x5d2f('0x57')){return db[_0x5d2f('0x58')]['where'](db[_0x5d2f('0x58')]['fn']('lower',db[_0x5d2f('0x58')]['col'](_0x27b470[_0x5d2f('0x3e')])),{'$like':db[_0x5d2f('0x58')]['fn'](_0x5d2f('0x59'),'%'+_0xa7552b[_0x5d2f('0x49')][_0x5d2f('0x39')]+'%')});}})});}_0x13c893=_[_0x5d2f('0x55')]({},_0x13c893,_0xa7552b[_0x5d2f('0x5a')]);var _0x3860f9={'where':_0x13c893[_0x5d2f('0x53')]};return db[_0x5d2f('0x43')][_0x5d2f('0x2d')](_0x3860f9)[_0x5d2f('0x1e')](function(_0x40ce0b){_0x159ba1[_0x5d2f('0x2d')]=_0x40ce0b;if(_0xa7552b[_0x5d2f('0x49')]['includeAll']){_0x13c893['include']=[{'all':!![]}];}return db['User']['findAll'](_0x13c893);})[_0x5d2f('0x1e')](function(_0x30cb86){_0x159ba1[_0x5d2f('0x5b')]=_0x30cb86;return _0x159ba1;})['then'](respondWithFilteredResult(_0x55f0aa,_0x13c893))[_0x5d2f('0x28')](handleError(_0x55f0aa,null));};exports[_0x5d2f('0x5c')]=function(_0x57aa19,_0x41044a){var _0x10f83b={'raw':![],'where':{'id':_0x57aa19[_0x5d2f('0x5d')]['id']}},_0x43166c={};_0x43166c[_0x5d2f('0x45')]=_[_0x5d2f('0x46')](_['keys'](db[_0x5d2f('0x43')]['rawAttributes']),['password',_0x5d2f('0x48')]);_0x43166c['query']=_[_0x5d2f('0x4a')](_0x57aa19[_0x5d2f('0x49')]);_0x43166c[_0x5d2f('0x4b')]=_['intersection'](_0x43166c['model'],_0x43166c[_0x5d2f('0x49')]);_0x10f83b[_0x5d2f('0x4c')]=_[_0x5d2f('0x4d')](_0x43166c[_0x5d2f('0x45')],qs[_0x5d2f('0x4e')](_0x57aa19[_0x5d2f('0x49')][_0x5d2f('0x4e')]));_0x10f83b[_0x5d2f('0x4c')]=_0x10f83b[_0x5d2f('0x4c')]['length']?_0x10f83b[_0x5d2f('0x4c')]:_0x43166c['model'];if(_0x57aa19['query'][_0x5d2f('0x5e')]){_0x10f83b[_0x5d2f('0x5f')]=[{'all':!![]}];}_0x10f83b=_[_0x5d2f('0x55')]({},_0x10f83b,_0x57aa19[_0x5d2f('0x5a')]);return db['User']['find'](_0x10f83b)[_0x5d2f('0x1e')](handleEntityNotFound(_0x41044a,null))[_0x5d2f('0x1e')](respondWithResult(_0x41044a,null))[_0x5d2f('0x28')](handleError(_0x41044a,null));};exports[_0x5d2f('0x60')]=function(_0x530ff3,_0x4beced){return db['User']['bulkCreate'](_0x530ff3['body'],{'raw':![],'individualHooks':!![]})[_0x5d2f('0x1e')](respondWithResult(_0x4beced,0xc9))[_0x5d2f('0x28')](handleError(_0x4beced,null));};exports[_0x5d2f('0x33')]=function(_0xd87527,_0x1d1778){if(_0xd87527[_0x5d2f('0x61')]['id']){delete _0xd87527[_0x5d2f('0x61')]['id'];}delete _0xd87527['body'][_0x5d2f('0x3c')];return db[_0x5d2f('0x43')][_0x5d2f('0x62')]({'where':{'id':_0xd87527[_0x5d2f('0x5d')]['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x1d1778,null))[_0x5d2f('0x1e')](saveUpdates(_0xd87527['body'],null))['then'](respondWithResult(_0x1d1778,null))['catch'](handleError(_0x1d1778,null));};exports[_0x5d2f('0x63')]=function(_0x13987f,_0x4b318e){return db['User']['describe']()[_0x5d2f('0x1e')](respondWithResult(_0x4b318e,null))[_0x5d2f('0x28')](handleError(_0x4b318e,null));};exports[_0x5d2f('0x64')]=function(_0x5c4dbd,_0x60058d,_0x534b68){return db[_0x5d2f('0x43')][_0x5d2f('0x62')]({'where':{'id':_0x5c4dbd[_0x5d2f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x60058d,null))[_0x5d2f('0x1e')](function(_0x23e429){if(_0x23e429){return _0x23e429['addContacts'](_0x5c4dbd[_0x5d2f('0x61')][_0x5d2f('0x65')],_[_0x5d2f('0x66')](_0x5c4dbd[_0x5d2f('0x61')],[_0x5d2f('0x65'),'id'])||{});}})[_0x5d2f('0x1e')](respondWithResult(_0x60058d,null))['catch'](handleError(_0x60058d,null));};var getLicense=function(_0xec88bc){return new BPromise(function(_0x356118,_0x5eab3e){var _0x385c37=0x0;_0xec88bc['body'][_0x5d2f('0x3c')]===_0x5d2f('0x38')&&_0x356118(_0x5d2f('0x67'));return db[_0x5d2f('0x43')][_0x5d2f('0x2d')]({'where':{'$or':[{'role':_0xec88bc[_0x5d2f('0x61')]['role']===_0x5d2f('0x68')?_0x5d2f('0x68'):[_0x5d2f('0x69'),'user']}]}})['then'](function(_0x24acf){_0x385c37=_0x24acf;return require(_0x5d2f('0x6a'))[_0x5d2f('0x6b')]();})[_0x5d2f('0x1e')](function(_0x89714d){var _0x291584=_0xec88bc[_0x5d2f('0x61')][_0x5d2f('0x3c')]===_0x5d2f('0x68')?_0x5d2f('0x6c'):_0x5d2f('0x6d');if(!_[_0x5d2f('0x6e')](_0x89714d[_0x291584])&&_0x385c37>=_0x89714d[_0x291584]){return _0x5eab3e({'message':_0x5d2f('0x6f')});}return _0x356118(util['format'](_0x5d2f('0x70'),_0x291584,_0x385c37));})[_0x5d2f('0x28')](function(_0x8a3c36){return _0x5eab3e(_0x8a3c36);});});};exports[_0x5d2f('0x71')]=function(_0x3d3de1,_0x42c08c){return getLicense(_0x3d3de1)[_0x5d2f('0x1e')](function(_0x24de85){if(!_0x3d3de1[_0x5d2f('0x61')][_0x5d2f('0x72')]){var _0x5185d2;return db[_0x5d2f('0x73')][_0x5d2f('0x74')](0x1)[_0x5d2f('0x1e')](function(_0x4e599c){return checkPasswordPattern(_0x4e599c,_0x3d3de1['body'][_0x5d2f('0x47')],_0x4e599c[_0x5d2f('0x75')]);})[_0x5d2f('0x1e')](function(_0x4054e2){_0x5185d2=_0x4054e2['min_internal'];return db[_0x5d2f('0x43')]['max'](_0x5d2f('0x72'));})['then'](function(_0x715681){if(_['isNil'](_0x715681)){if(_0x5185d2){_0x3d3de1[_0x5d2f('0x61')][_0x5d2f('0x72')]=_0x5185d2;}else{_0x3d3de1[_0x5d2f('0x61')][_0x5d2f('0x72')]=0x1;}}else{if(_[_0x5d2f('0x6e')](_0x5185d2)||_0x5185d2==_0x715681){_0x3d3de1['body'][_0x5d2f('0x72')]=_0x715681+0x1;}else if(_0x5185d2>_0x715681){_0x3d3de1[_0x5d2f('0x61')][_0x5d2f('0x72')]=_0x5185d2;}else{return db[_0x5d2f('0x58')]['query'](_0x5d2f('0x76'),{'type':db['sequelize'][_0x5d2f('0x77')]['SELECT']})['then'](function(_0x2259b5){if(_0x2259b5&&_0x2259b5['length']){for(var _0x2ff775=0x0,_0xc940d1=_0x2259b5[_0x5d2f('0x78')];_0x2ff775<_0xc940d1&&_[_0x5d2f('0x6e')](_0x3d3de1['body'][_0x5d2f('0x72')]);_0x2ff775++){if(_0x5185d2<=_0x2259b5[_0x2ff775][_0x5d2f('0x79')]){_0x3d3de1[_0x5d2f('0x61')]['internal']=_0x2259b5[_0x2ff775]['from'];}else if(_0x5185d2>_0x2259b5[_0x2ff775]['from']&&_0x5185d2<=_0x2259b5[_0x2ff775]['to']){_0x3d3de1[_0x5d2f('0x61')][_0x5d2f('0x72')]=_0x5185d2;}}}if(_['isNil'](_0x3d3de1[_0x5d2f('0x61')]['internal'])){_0x3d3de1[_0x5d2f('0x61')][_0x5d2f('0x72')]=_0x715681+0x1;}});}}});}})['then'](function(){if(_0x3d3de1[_0x5d2f('0x61')][_0x5d2f('0x7a')]){_0x3d3de1[_0x5d2f('0x61')][_0x5d2f('0x7b')]=_0x3d3de1[_0x5d2f('0x61')][_0x5d2f('0x72')];_0x3d3de1['body'][_0x5d2f('0x7c')]={'mailbox':_0x3d3de1[_0x5d2f('0x61')][_0x5d2f('0x72')],'password':_0x3d3de1[_0x5d2f('0x61')]['password'],'fullname':_0x3d3de1['body'][_0x5d2f('0x7d')],'email':_0x3d3de1[_0x5d2f('0x61')][_0x5d2f('0x7e')]};}if(_0x3d3de1[_0x5d2f('0x61')]&&_0x3d3de1[_0x5d2f('0x61')]['role']==='agent'){_0x3d3de1['body']['permissions']=[_0x5d2f('0x7f'),'102',_0x5d2f('0x80'),'110',_0x5d2f('0x81'),_0x5d2f('0x82'),'106','107','108','109',_0x5d2f('0x83'),_0x5d2f('0x84')];}return db['User']['create'](_0x3d3de1[_0x5d2f('0x61')],{'include':[{'model':db[_0x5d2f('0x7c')],'as':_0x5d2f('0x7c')}]});})['then'](function(_0x5c4088){if(_0x3d3de1['body'][_0x5d2f('0x3c')]===_0x5d2f('0x36'))return _0x5c4088;var _0x106bf2=_0x3d3de1[_0x5d2f('0x36')][_0x5d2f('0x34')]({'plain':!![]});if(!_0x106bf2)throw new Error(_0x5d2f('0x85'));if(_0x106bf2['role']==='user'){var _0x148e59=_0x5c4088[_0x5d2f('0x34')]({'plain':!![]});var _0x17c5f6=[{'name':'Agents','value':_0x5d2f('0x38')},{'name':_0x5d2f('0x86'),'value':_0x5d2f('0x68')}];var _0x4a9f33=_[_0x5d2f('0x62')](_0x17c5f6,[_0x5d2f('0x3d'),_0x148e59['role']])[_0x5d2f('0x3e')];return db[_0x5d2f('0x87')]['find']({'where':{'name':_0x4a9f33,'userProfileId':_0x106bf2[_0x5d2f('0x88')]},'raw':!![]})[_0x5d2f('0x1e')](function(_0xbf3424){if(_0xbf3424&&_0xbf3424[_0x5d2f('0x89')]===0x0){return db[_0x5d2f('0x3f')][_0x5d2f('0x71')]({'name':_0x148e59[_0x5d2f('0x3e')],'resourceId':_0x148e59['id'],'type':_0xbf3424[_0x5d2f('0x3e')],'sectionId':_0xbf3424['id']},{})[_0x5d2f('0x1e')](function(){return _0x5c4088;});}else{return _0x5c4088;}})[_0x5d2f('0x28')](function(_0x2a337d){logger[_0x5d2f('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2a337d);throw _0x2a337d;});}return _0x5c4088;})[_0x5d2f('0x1e')](respondWithResult(_0x42c08c,0xc9))['catch'](handleError(_0x42c08c,null));};exports['changePassword']=function(_0x8a130c,_0x5844cc,_0x3eb691){var _0x48fa3f=![];if(_0x8a130c[_0x5d2f('0x61')]['id']){delete _0x8a130c['body']['id'];}return db[_0x5d2f('0x73')]['findOne']({'attributes':['id',_0x5d2f('0x75')]})[_0x5d2f('0x1e')](function(_0x5de3b7){_0x48fa3f=_0x5de3b7[_0x5d2f('0x75')];return db[_0x5d2f('0x43')]['find']({'where':{'id':_0x8a130c['params']['id']}});})[_0x5d2f('0x1e')](function(_0xb89918){if(_0xb89918){if(_0xb89918['id']==_0x8a130c['user']['id']){if(!_0x8a130c[_0x5d2f('0x61')]['oldPassword']||!_0x8a130c[_0x5d2f('0x61')][_0x5d2f('0x8a')]){throw new db['Sequelize'][(_0x5d2f('0x1b'))](_0x5d2f('0x8b'));}if(!_0xb89918['authenticate'](_0x8a130c[_0x5d2f('0x61')]['oldPassword'])){throw new db[(_0x5d2f('0x8c'))]['ValidationError'](_0x5d2f('0x8d'));}if(_0x8a130c[_0x5d2f('0x61')][_0x5d2f('0x8e')]==_0x8a130c[_0x5d2f('0x61')][_0x5d2f('0x8a')]){throw new db[(_0x5d2f('0x8c'))][(_0x5d2f('0x1b'))](_0x5d2f('0x8f'));}return _0xb89918;}else if(_0x8a130c[_0x5d2f('0x36')][_0x5d2f('0x3c')]=='admin'){if(!_0x8a130c['body'][_0x5d2f('0x8a')]){throw new db[(_0x5d2f('0x8c'))][(_0x5d2f('0x1b'))](_0x5d2f('0x90'));}return _0xb89918;}else if(_0x8a130c[_0x5d2f('0x36')]['role']==_0x5d2f('0x36')){if(!_0x8a130c['body']['newPassword']){throw new db['Sequelize'][(_0x5d2f('0x1b'))](_0x5d2f('0x90'));}if(_0xb89918[_0x5d2f('0x3c')]!='agent'){throw new db[(_0x5d2f('0x8c'))]['ValidationError'](_0x5d2f('0x91'));}return _0xb89918;}else{throw new db['Sequelize']['ValidationError'](_0x5d2f('0x91'));}}return null;})[_0x5d2f('0x1e')](handleEntityNotFound(_0x5844cc,null))['then'](function(_0x5b06b8){return checkPasswordPattern(_0x5b06b8,_0x8a130c[_0x5d2f('0x61')][_0x5d2f('0x8a')],_0x48fa3f);})[_0x5d2f('0x1e')](saveUpdates({'password':_0x8a130c[_0x5d2f('0x61')][_0x5d2f('0x8a')],'passwordResetAt':_0x8a130c[_0x5d2f('0x36')]['id']==_0x8a130c[_0x5d2f('0x5d')]['id']?moment():null},null))[_0x5d2f('0x1e')](respondWithResult(_0x5844cc,null))['catch'](handleError(_0x5844cc,null));};exports[_0x5d2f('0x92')]=function(_0x55d23e,_0x29e1d1,_0x25fadf){var _0x3c03c2=_0x55d23e[_0x5d2f('0x61')][_0x5d2f('0x93')];return db['User'][_0x5d2f('0x62')]({'where':{'id':_0x55d23e[_0x5d2f('0x5d')]['id']},'attributes':['id',_0x5d2f('0x3e'),_0x5d2f('0x3c'),'online',_0x5d2f('0x94'),_0x5d2f('0x95'),_0x5d2f('0x96')]})[_0x5d2f('0x1e')](handleEntityNotFound(_0x29e1d1,null))['then'](function(_0x3ced78){if(_0x3ced78){if(!utils[_0x5d2f('0x97')](_0x3c03c2)){throw new db[(_0x5d2f('0x8c'))][(_0x5d2f('0x1b'))](_0x5d2f('0x98'));}return _0x3ced78[_0x5d2f('0x99')+_[_0x5d2f('0x9a')](_0x3c03c2['toLowerCase']())+'Queues'](_0x55d23e[_0x5d2f('0x61')][_0x5d2f('0x65')],{'penalty':_0x55d23e[_0x5d2f('0x61')][_0x5d2f('0x9b')]||0x0})['spread'](function(_0x2ad4e7){for(var _0x48a0c6=0x0;_0x48a0c6<_0x55d23e['body'][_0x5d2f('0x65')][_0x5d2f('0x78')];_0x48a0c6+=0x1){var _0xbdb73f={'UserId':_0x55d23e[_0x5d2f('0x5d')]['id']};_0xbdb73f[_['capitalize'](_0x3c03c2[_0x5d2f('0x9c')]())+_0x5d2f('0x9d')]=_0x55d23e['body'][_0x5d2f('0x65')][_0x48a0c6];socket['emit'](_0x5d2f('0x36')+_[_0x5d2f('0x9a')](_0x3c03c2[_0x5d2f('0x9c')]())+_0x5d2f('0x9e'),_0xbdb73f);}return _0x2ad4e7;})[_0x5d2f('0x1e')](function(){if(_0x3c03c2==='voice'){return db[_0x5d2f('0x9f')][_0x5d2f('0xa0')]({'where':{'id':_0x55d23e[_0x5d2f('0x61')][_0x5d2f('0x65')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x5d2f('0x1e')](function(_0x139f05){var _0x4afef2=_0x3ced78[_0x5d2f('0x34')]({'plain':!![]});var _0x374e2a=[];if(_0x3c03c2===_0x5d2f('0xa1')&&_0x4afef2[_0x5d2f('0x3c')]===_0x5d2f('0x38')&&_0x4afef2[_0x5d2f('0xa2')]){for(var _0x268646=0x0;_0x268646<_0x139f05[_0x5d2f('0x78')];_0x268646+=0x1){_0x374e2a[_0x5d2f('0xa3')]({'membername':_0x4afef2[_0x5d2f('0x3e')],'UserId':_0x4afef2['id'],'queue_name':_0x139f05[_0x268646][_0x5d2f('0x3e')],'VoiceQueueId':_0x139f05[_0x268646]['id'],'interface':_[_0x5d2f('0x6e')](_0x4afef2[_0x5d2f('0x96')])?util['format'](_0x5d2f('0xa4'),_0x4afef2[_0x5d2f('0x3e')]):_0x4afef2[_0x5d2f('0x96')],'paused':_0x4afef2[_0x5d2f('0x95')]||![],'penalty':_0x55d23e[_0x5d2f('0x61')][_0x5d2f('0x9b')]||0x0});}return BPromise[_0x5d2f('0xa5')](_0x374e2a,function(_0x5029a7){return db[_0x5d2f('0xa6')]['upsert'](_0x5029a7);});}return _0x3ced78;});}})[_0x5d2f('0x1e')](respondWithStatusCode(_0x29e1d1,null))[_0x5d2f('0x28')](handleError(_0x29e1d1,null));};exports[_0x5d2f('0xa7')]=function(_0x29cb82,_0x265ac5,_0x16969a){var _0x4087f6;return db[_0x5d2f('0x43')]['find']({'where':{'id':_0x29cb82[_0x5d2f('0x5d')]['id']},'attributes':['id',_0x5d2f('0x3e'),'role']})['then'](handleEntityNotFound(_0x265ac5,null))[_0x5d2f('0x1e')](function(_0x6af131){if(_0x6af131){_0x4087f6=_0x6af131;if(!_0x29cb82[_0x5d2f('0x49')][_0x5d2f('0x93')]||!utils['isValidChannel'](_0x29cb82[_0x5d2f('0x49')][_0x5d2f('0x93')])){throw new db['Sequelize'][(_0x5d2f('0x1b'))](_0x5d2f('0x98'));}return _0x6af131['remove'+_['capitalize'](_0x29cb82[_0x5d2f('0x49')]['channel'][_0x5d2f('0x9c')]())+_0x5d2f('0xa8')](_0x29cb82[_0x5d2f('0x49')][_0x5d2f('0x65')]);}})[_0x5d2f('0x1e')](function(_0x5a8452){for(var _0x4c181a=0x0;_0x4c181a<_0x29cb82[_0x5d2f('0x49')][_0x5d2f('0x65')][_0x5d2f('0x78')];_0x4c181a+=0x1){var _0x2f9b47={'UserId':_0x29cb82[_0x5d2f('0x5d')]['id']};_0x2f9b47[_[_0x5d2f('0x9a')](_0x29cb82[_0x5d2f('0x49')][_0x5d2f('0x93')]['toLowerCase']())+_0x5d2f('0x9d')]=_0x29cb82[_0x5d2f('0x49')]['ids'][_0x4c181a];socket[_0x5d2f('0xa9')](_0x5d2f('0x36')+_[_0x5d2f('0x9a')](_0x29cb82['query'][_0x5d2f('0x93')][_0x5d2f('0x9c')]())+_0x5d2f('0xaa'),_0x2f9b47);}return _0x5a8452;})[_0x5d2f('0x1e')](function(){if(_0x29cb82[_0x5d2f('0x49')][_0x5d2f('0x93')]==='voice'){return db['UserVoiceQueueRt'][_0x5d2f('0x40')]({'where':{'UserId':_0x29cb82[_0x5d2f('0x5d')]['id'],'VoiceQueueId':_0x29cb82[_0x5d2f('0x49')]['ids']},'individualHooks':!![]})['then'](function(){return _0x4087f6;});}return _0x4087f6;})['then'](respondWithStatusCode(_0x265ac5,null))[_0x5d2f('0x28')](handleError(_0x265ac5,null));};exports[_0x5d2f('0xab')]=function(_0x553586,_0x57f777,_0x39e8ca){_0x553586[_0x5d2f('0x61')]['userpic']=_0x553586[_0x5d2f('0xac')][_0x5d2f('0xad')];return db[_0x5d2f('0x43')][_0x5d2f('0x62')]({'where':{'id':_0x553586[_0x5d2f('0x5d')]['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x57f777,null))['then'](saveUpdates(_0x553586[_0x5d2f('0x61')],null))[_0x5d2f('0x1e')](respondWithResult(_0x57f777,null))['catch'](handleError(_0x57f777,null));};exports[_0x5d2f('0xae')]=function(_0x483862,_0x2486e5,_0x230fbd){var _0x6b0695=path[_0x5d2f('0xaf')](config['root'],'server/files/images/logos/default_profile.png');return db[_0x5d2f('0x43')][_0x5d2f('0x62')]({'where':{'id':_0x483862[_0x5d2f('0x5d')]['id']},'attributes':['id',_0x5d2f('0xb0')],'raw':!![]})[_0x5d2f('0x1e')](handleEntityNotFound(_0x2486e5,null))[_0x5d2f('0x1e')](function(_0x1e900c){if(_0x1e900c){if(_[_0x5d2f('0x6e')](_0x1e900c[_0x5d2f('0xb0')])){return _0x2486e5[_0x5d2f('0xb1')](_0x6b0695);}else{if(!fs[_0x5d2f('0xb2')](path['join'](config[_0x5d2f('0xb3')],_0x5d2f('0xb4'),_0x1e900c[_0x5d2f('0xb0')]))){return _0x2486e5['download'](_0x6b0695);}return _0x2486e5['download'](path[_0x5d2f('0xaf')](config['root'],_0x5d2f('0xb4'),_0x1e900c[_0x5d2f('0xb0')]));}}})[_0x5d2f('0x28')](handleError(_0x2486e5,null));};exports[_0x5d2f('0xb5')]=function(_0x5eb2e6,_0x5cd6b5,_0xef8839){var _0x28992e={};var _0x14c4d1={};var _0x5cacd8;var _0x24871e;return db[_0x5d2f('0x43')][_0x5d2f('0xb6')]({'where':{'id':_0x5eb2e6['params']['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x5cd6b5,null))['then'](function(_0x15efbb){if(_0x15efbb){_0x5cacd8=_0x15efbb;_0x14c4d1[_0x5d2f('0x45')]=_[_0x5d2f('0x4a')](db[_0x5d2f('0xb7')][_0x5d2f('0x44')]);_0x14c4d1['query']=_['keys'](_0x5eb2e6[_0x5d2f('0x49')]);_0x14c4d1[_0x5d2f('0x4b')]=_[_0x5d2f('0x4d')](_0x14c4d1[_0x5d2f('0x45')],_0x14c4d1[_0x5d2f('0x49')]);_0x28992e['attributes']=_[_0x5d2f('0x4d')](_0x14c4d1['model'],qs[_0x5d2f('0x4e')](_0x5eb2e6[_0x5d2f('0x49')][_0x5d2f('0x4e')]));_0x28992e[_0x5d2f('0x4c')]=_0x28992e[_0x5d2f('0x4c')][_0x5d2f('0x78')]?_0x28992e[_0x5d2f('0x4c')]:_0x14c4d1['model'];_0x28992e[_0x5d2f('0x51')]=qs[_0x5d2f('0x52')](_0x5eb2e6[_0x5d2f('0x49')][_0x5d2f('0x52')]);_0x28992e[_0x5d2f('0x53')]=qs[_0x5d2f('0x4b')](_[_0x5d2f('0x54')](_0x5eb2e6[_0x5d2f('0x49')],_0x14c4d1['filters']));if(_0x5eb2e6['query'][_0x5d2f('0x39')]){_0x28992e[_0x5d2f('0x53')]=_[_0x5d2f('0x55')](_0x28992e[_0x5d2f('0x53')],{'$or':_[_0x5d2f('0x3b')](_0x28992e[_0x5d2f('0x4c')],function(_0x453af6){var _0x5edfcb={};_0x5edfcb[_0x453af6]={'$like':'%'+_0x5eb2e6[_0x5d2f('0x49')][_0x5d2f('0x39')]+'%'};return _0x5edfcb;})});}_0x28992e=_[_0x5d2f('0x55')]({},_0x28992e,_0x5eb2e6[_0x5d2f('0x5a')]);return _0x5cacd8[_0x5d2f('0xb5')](_0x28992e);}})[_0x5d2f('0x1e')](function(_0x10db02){if(_0x10db02){_0x24871e=_0x10db02['length'];if(_0x5eb2e6[_0x5d2f('0x49')][_0x5d2f('0x4f')](_0x5d2f('0x5e'))){_0x28992e['include']=[{'model':db[_0x5d2f('0xb8')],'as':'List','required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x5d2f('0x3e'),'color'],'where':_0x5eb2e6[_0x5d2f('0x49')][_0x5d2f('0xb9')]?{'id':_0x5eb2e6[_0x5d2f('0x49')][_0x5d2f('0xb9')]}:undefined,'required':_0x5eb2e6[_0x5d2f('0x49')][_0x5d2f('0xb9')]?!![]:![]}];}if(!_0x5eb2e6[_0x5d2f('0x49')][_0x5d2f('0x4f')]('nolimit')){_0x28992e['limit']=qs[_0x5d2f('0x2f')](_0x5eb2e6[_0x5d2f('0x49')][_0x5d2f('0x2f')]);_0x28992e['offset']=qs[_0x5d2f('0x2e')](_0x5eb2e6['query'][_0x5d2f('0x2e')]);}return _0x5cacd8[_0x5d2f('0xb5')](_0x28992e);}})[_0x5d2f('0x1e')](function(_0x4c1a4c){if(_0x4c1a4c){return _0x4c1a4c?{'count':_0x24871e,'rows':_0x4c1a4c}:null;}})[_0x5d2f('0x1e')](respondWithResult(_0x5cd6b5,null))[_0x5d2f('0x28')](handleError(_0x5cd6b5,null));};exports[_0x5d2f('0xba')]=function(_0x48addc,_0x7cdd8b,_0x18e5da){var _0x2ff1a1;var _0x1b47d0;var _0x30f3fb={};var _0x5127be;return db[_0x5d2f('0x43')]['findOne']({'where':{'id':_0x48addc[_0x5d2f('0x5d')]['id']},'attributes':['id',_0x5d2f('0x3e'),_0x5d2f('0x3c')]})['then'](handleEntityNotFound(_0x7cdd8b,null))[_0x5d2f('0x1e')](function(_0x5556a4){if(!utils[_0x5d2f('0x97')](_0x48addc[_0x5d2f('0x49')][_0x5d2f('0x93')])){throw new db[(_0x5d2f('0x8c'))][(_0x5d2f('0x1b'))]('Unknown\x20channel');}_0x2ff1a1=_0x5556a4;var _0x522b61={};_0x522b61[_0x5d2f('0x45')]=_[_0x5d2f('0x4a')](db[_[_0x5d2f('0x9a')](_0x48addc['query'][_0x5d2f('0x93')])+_0x5d2f('0xbb')][_0x5d2f('0x44')]);_0x522b61[_0x5d2f('0x49')]=_[_0x5d2f('0x4a')](_0x48addc['query']);_0x522b61[_0x5d2f('0x4b')]=_[_0x5d2f('0x4d')](_0x522b61[_0x5d2f('0x45')],_0x522b61[_0x5d2f('0x49')]);_0x30f3fb[_0x5d2f('0x4c')]=_[_0x5d2f('0x4d')](_0x522b61[_0x5d2f('0x45')],qs['fields'](_0x48addc[_0x5d2f('0x49')][_0x5d2f('0x4e')]));_0x30f3fb[_0x5d2f('0x4c')]=_0x30f3fb[_0x5d2f('0x4c')][_0x5d2f('0x78')]?_0x30f3fb[_0x5d2f('0x4c')]:_0x522b61[_0x5d2f('0x45')];_0x30f3fb[_0x5d2f('0x51')]=qs[_0x5d2f('0x52')](_0x48addc[_0x5d2f('0x49')][_0x5d2f('0x52')]);_0x30f3fb['where']=qs[_0x5d2f('0x4b')](_['pick'](_0x48addc[_0x5d2f('0x49')],_0x522b61['filters']));if(_0x48addc[_0x5d2f('0x49')]['filter']){_0x30f3fb['where']=_[_0x5d2f('0x55')](_0x30f3fb[_0x5d2f('0x53')],{'$or':_[_0x5d2f('0x3b')](_0x30f3fb[_0x5d2f('0x4c')],function(_0x8d79d3){var _0x2186a8={};_0x2186a8[_0x8d79d3]={'$like':'%'+_0x48addc['query'][_0x5d2f('0x39')]+'%'};return _0x2186a8;})});}_0x30f3fb=_[_0x5d2f('0x55')]({},_0x30f3fb,_0x48addc[_0x5d2f('0x5a')]);switch(_0x2ff1a1[_0x5d2f('0x3c')]){case _0x5d2f('0x69'):return db[_[_0x5d2f('0x9a')](_0x48addc['query'][_0x5d2f('0x93')])+_0x5d2f('0xbb')][_0x5d2f('0xa0')](_0x30f3fb);case _0x5d2f('0x36'):case _0x5d2f('0x38'):return _0x2ff1a1[_0x5d2f('0x34')+_[_0x5d2f('0x9a')](_0x48addc['query'][_0x5d2f('0x93')])+_0x5d2f('0xa8')](_0x30f3fb);default:throw new db['Sequelize']['ValidationError'](_0x5d2f('0xbc'));}})[_0x5d2f('0x1e')](function(_0x434d64){_0x5127be=_0x434d64[_0x5d2f('0x78')];if(!_0x48addc['query'][_0x5d2f('0x4f')](_0x5d2f('0x50'))){_0x30f3fb[_0x5d2f('0x2f')]=qs[_0x5d2f('0x2f')](_0x48addc[_0x5d2f('0x49')][_0x5d2f('0x2f')]);_0x30f3fb[_0x5d2f('0x2e')]=qs['offset'](_0x48addc['query']['offset']);}switch(_0x2ff1a1[_0x5d2f('0x3c')]){case _0x5d2f('0x69'):return db[_[_0x5d2f('0x9a')](_0x48addc[_0x5d2f('0x49')][_0x5d2f('0x93')])+_0x5d2f('0xbb')]['findAll'](_0x30f3fb);case'user':case _0x5d2f('0x38'):return _0x2ff1a1[_0x5d2f('0x34')+_['capitalize'](_0x48addc[_0x5d2f('0x49')][_0x5d2f('0x93')])+'Queues'](_0x30f3fb);}})[_0x5d2f('0x1e')](function(_0xd9a062){return{'count':_0x5127be,'rows':_0xd9a062};})['then'](respondWithResult(_0x7cdd8b,null))['catch'](handleError(_0x7cdd8b,null));};exports[_0x5d2f('0xbd')]=function(_0x18edc1,_0x391d5a,_0x228873){var _0x586fc7={};var _0x1ff7d7={};var _0x18165f;var _0x2de508;return db[_0x5d2f('0x43')][_0x5d2f('0xb6')]({'where':{'id':_0x18edc1[_0x5d2f('0x5d')]['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x391d5a,null))[_0x5d2f('0x1e')](function(_0x1bf343){if(_0x1bf343){_0x18165f=_0x1bf343;_0x1ff7d7[_0x5d2f('0x45')]=_[_0x5d2f('0x4a')](db['UserVoiceQueueRt'][_0x5d2f('0x44')]);_0x1ff7d7['query']=_[_0x5d2f('0x4a')](_0x18edc1[_0x5d2f('0x49')]);_0x1ff7d7['filters']=_[_0x5d2f('0x4d')](_0x1ff7d7[_0x5d2f('0x45')],_0x1ff7d7[_0x5d2f('0x49')]);_0x586fc7[_0x5d2f('0x4c')]=_['intersection'](_0x1ff7d7[_0x5d2f('0x45')],qs['fields'](_0x18edc1[_0x5d2f('0x49')][_0x5d2f('0x4e')]));_0x586fc7[_0x5d2f('0x4c')]=_0x586fc7[_0x5d2f('0x4c')]['length']?_0x586fc7[_0x5d2f('0x4c')]:_0x1ff7d7[_0x5d2f('0x45')];_0x586fc7[_0x5d2f('0x51')]=qs[_0x5d2f('0x52')](_0x18edc1['query'][_0x5d2f('0x52')]);_0x586fc7[_0x5d2f('0x53')]=qs[_0x5d2f('0x4b')](_['pick'](_0x18edc1[_0x5d2f('0x49')],_0x1ff7d7[_0x5d2f('0x4b')]));if(_0x18edc1[_0x5d2f('0x49')]['filter']){_0x586fc7[_0x5d2f('0x53')]=_['merge'](_0x586fc7[_0x5d2f('0x53')],{'$or':_['map'](_0x586fc7[_0x5d2f('0x4c')],function(_0x46b71a){var _0x6ba85d={};_0x6ba85d[_0x46b71a]={'$like':'%'+_0x18edc1[_0x5d2f('0x49')][_0x5d2f('0x39')]+'%'};return _0x6ba85d;})});}_0x586fc7=_[_0x5d2f('0x55')]({},_0x586fc7,_0x18edc1[_0x5d2f('0x5a')]);return _0x18165f[_0x5d2f('0xbd')](_0x586fc7);}})['then'](function(_0x1e2a42){if(_0x1e2a42){_0x2de508=_0x1e2a42[_0x5d2f('0x78')];if(!_0x18edc1['query'][_0x5d2f('0x4f')](_0x5d2f('0x50'))){_0x586fc7['limit']=qs[_0x5d2f('0x2f')](_0x18edc1[_0x5d2f('0x49')][_0x5d2f('0x2f')]);_0x586fc7[_0x5d2f('0x2e')]=qs[_0x5d2f('0x2e')](_0x18edc1[_0x5d2f('0x49')][_0x5d2f('0x2e')]);}return _0x18165f[_0x5d2f('0xbd')](_0x586fc7);}})[_0x5d2f('0x1e')](function(_0x4d465c){if(_0x4d465c){return _0x4d465c?{'count':_0x2de508,'rows':_0x4d465c}:null;}})[_0x5d2f('0x1e')](respondWithResult(_0x391d5a,null))[_0x5d2f('0x28')](handleError(_0x391d5a,null));};exports['getGroups']=function(_0x3c601d,_0xc5ffe0,_0x3b796b){var _0x398900={};var _0xbd1369={};var _0x561b08;var _0x58f149;return db['User'][_0x5d2f('0xb6')]({'where':{'id':_0x3c601d['params']['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0xc5ffe0,null))['then'](function(_0x337592){if(_0x337592){_0x561b08=_0x337592;_0xbd1369[_0x5d2f('0x45')]=_[_0x5d2f('0x4a')](db['ChatGroup']['rawAttributes']);_0xbd1369[_0x5d2f('0x49')]=_[_0x5d2f('0x4a')](_0x3c601d[_0x5d2f('0x49')]);_0xbd1369[_0x5d2f('0x4b')]=_[_0x5d2f('0x4d')](_0xbd1369[_0x5d2f('0x45')],_0xbd1369['query']);_0x398900[_0x5d2f('0x4c')]=_[_0x5d2f('0x4d')](_0xbd1369[_0x5d2f('0x45')],qs[_0x5d2f('0x4e')](_0x3c601d[_0x5d2f('0x49')][_0x5d2f('0x4e')]));_0x398900['attributes']=_0x398900[_0x5d2f('0x4c')][_0x5d2f('0x78')]?_0x398900[_0x5d2f('0x4c')]:_0xbd1369[_0x5d2f('0x45')];_0x398900[_0x5d2f('0x51')]=qs['sort'](_0x3c601d['query'][_0x5d2f('0x52')]);_0x398900[_0x5d2f('0x53')]=qs[_0x5d2f('0x4b')](_[_0x5d2f('0x54')](_0x3c601d['query'],_0xbd1369['filters']));if(_0x3c601d[_0x5d2f('0x49')][_0x5d2f('0x39')]){_0x398900['where']=_[_0x5d2f('0x55')](_0x398900[_0x5d2f('0x53')],{'$or':_['map'](_0x398900[_0x5d2f('0x4c')],function(_0x389ec0){var _0x4744ec={};_0x4744ec[_0x389ec0]={'$like':'%'+_0x3c601d['query']['filter']+'%'};return _0x4744ec;})});}_0x398900=_['merge']({},_0x398900,_0x3c601d[_0x5d2f('0x5a')]);return _0x561b08['getGroups'](_0x398900);}})[_0x5d2f('0x1e')](function(_0x28892a){if(_0x28892a){_0x58f149=_0x28892a[_0x5d2f('0x78')];if(!_0x3c601d[_0x5d2f('0x49')][_0x5d2f('0x4f')](_0x5d2f('0x50'))){_0x398900[_0x5d2f('0x2f')]=qs['limit'](_0x3c601d[_0x5d2f('0x49')][_0x5d2f('0x2f')]);_0x398900[_0x5d2f('0x2e')]=qs[_0x5d2f('0x2e')](_0x3c601d[_0x5d2f('0x49')][_0x5d2f('0x2e')]);}return _0x561b08[_0x5d2f('0xbe')](_0x398900);}})[_0x5d2f('0x1e')](function(_0x171ee2){if(_0x171ee2){return _0x171ee2?{'count':_0x58f149,'rows':_0x171ee2}:null;}})[_0x5d2f('0x1e')](respondWithResult(_0xc5ffe0,null))[_0x5d2f('0x28')](handleError(_0xc5ffe0,null));};exports['getRecordings']=function(_0x1f48f8,_0x40283c,_0x58d0f5){var _0x800b0={'raw':!![],'where':{}};var _0x3fea85={};var _0x5b477a={'count':0x0,'rows':[]};return db[_0x5d2f('0x43')][_0x5d2f('0xb6')]({'where':{'id':_0x1f48f8['params']['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x40283c,null))[_0x5d2f('0x1e')](function(_0x31d4ea){if(_0x31d4ea){_0x3fea85[_0x5d2f('0x45')]=_[_0x5d2f('0x4a')](db[_0x5d2f('0xbf')][_0x5d2f('0x44')]);_0x3fea85[_0x5d2f('0x49')]=_[_0x5d2f('0x4a')](_0x1f48f8[_0x5d2f('0x49')]);_0x3fea85['filters']=_['intersection'](_0x3fea85[_0x5d2f('0x45')],_0x3fea85[_0x5d2f('0x49')]);_0x800b0[_0x5d2f('0x4c')]=_[_0x5d2f('0x4d')](_0x3fea85['model'],qs[_0x5d2f('0x4e')](_0x1f48f8[_0x5d2f('0x49')][_0x5d2f('0x4e')]));_0x800b0['attributes']=_0x800b0[_0x5d2f('0x4c')][_0x5d2f('0x78')]?_0x800b0['attributes']:_0x3fea85[_0x5d2f('0x45')];if(!_0x1f48f8[_0x5d2f('0x49')]['hasOwnProperty'](_0x5d2f('0x50'))){_0x800b0[_0x5d2f('0x2f')]=qs[_0x5d2f('0x2f')](_0x1f48f8['query'][_0x5d2f('0x2f')]);_0x800b0['offset']=qs[_0x5d2f('0x2e')](_0x1f48f8[_0x5d2f('0x49')][_0x5d2f('0x2e')]);}_0x800b0[_0x5d2f('0x51')]=qs[_0x5d2f('0x52')](_0x1f48f8[_0x5d2f('0x49')][_0x5d2f('0x52')]);_0x800b0[_0x5d2f('0x53')]=qs[_0x5d2f('0x4b')](_[_0x5d2f('0x54')](_0x1f48f8[_0x5d2f('0x49')],_0x3fea85[_0x5d2f('0x4b')]));_0x800b0[_0x5d2f('0x53')][_0x5d2f('0xc0')]=_0x31d4ea['id'];if(_0x1f48f8[_0x5d2f('0x49')]['filter']){_0x800b0[_0x5d2f('0x53')]=_[_0x5d2f('0x55')](_0x800b0[_0x5d2f('0x53')],{'$or':_[_0x5d2f('0x3b')](_0x800b0[_0x5d2f('0x4c')],function(_0x37ff87){var _0x118415={};_0x118415[_0x37ff87]={'$like':'%'+_0x1f48f8[_0x5d2f('0x49')][_0x5d2f('0x39')]+'%'};return _0x118415;})});}_0x800b0=_['merge']({},_0x800b0,_0x1f48f8[_0x5d2f('0x5a')]);return db[_0x5d2f('0xbf')][_0x5d2f('0x2d')]({'where':_0x800b0['where']})[_0x5d2f('0x1e')](function(_0x5de9fb){_0x5b477a['count']=_0x5de9fb;if(_0x1f48f8[_0x5d2f('0x49')]['includeAll']){_0x800b0[_0x5d2f('0x5f')]=[{'all':!![]}];}return db['VoiceRecording'][_0x5d2f('0xa0')](_0x800b0);})['then'](function(_0x34793a){_0x5b477a[_0x5d2f('0x5b')]=_0x34793a;return _0x5b477a;});}})[_0x5d2f('0x1e')](respondWithFilteredResult(_0x40283c,_0x800b0))['catch'](handleError(_0x40283c,null));};exports[_0x5d2f('0xc1')]=function(_0x2c3e22,_0x5f489b,_0x180a66){var _0x3c7921={'raw':!![],'where':{}};var _0x4f0296={};var _0x45c567={'count':0x0,'rows':[]};return db['User'][_0x5d2f('0xb6')]({'where':{'id':_0x2c3e22[_0x5d2f('0x5d')]['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x5f489b,null))[_0x5d2f('0x1e')](function(_0x278d67){if(_0x278d67){_0x4f0296[_0x5d2f('0x45')]=_[_0x5d2f('0x4a')](db[_0x5d2f('0xc2')][_0x5d2f('0x44')]);_0x4f0296['query']=_[_0x5d2f('0x4a')](_0x2c3e22[_0x5d2f('0x49')]);_0x4f0296[_0x5d2f('0x4b')]=_[_0x5d2f('0x4d')](_0x4f0296[_0x5d2f('0x45')],_0x4f0296[_0x5d2f('0x49')]);_0x3c7921[_0x5d2f('0x4c')]=_[_0x5d2f('0x4d')](_0x4f0296[_0x5d2f('0x45')],qs['fields'](_0x2c3e22['query'][_0x5d2f('0x4e')]));_0x3c7921[_0x5d2f('0x4c')]=_0x3c7921[_0x5d2f('0x4c')][_0x5d2f('0x78')]?_0x3c7921[_0x5d2f('0x4c')]:_0x4f0296[_0x5d2f('0x45')];if(!_0x2c3e22[_0x5d2f('0x49')]['hasOwnProperty'](_0x5d2f('0x50'))){_0x3c7921['limit']=qs[_0x5d2f('0x2f')](_0x2c3e22[_0x5d2f('0x49')][_0x5d2f('0x2f')]);_0x3c7921[_0x5d2f('0x2e')]=qs[_0x5d2f('0x2e')](_0x2c3e22[_0x5d2f('0x49')][_0x5d2f('0x2e')]);}_0x3c7921[_0x5d2f('0x51')]=qs['sort'](_0x2c3e22[_0x5d2f('0x49')]['sort']);_0x3c7921[_0x5d2f('0x53')]=qs[_0x5d2f('0x4b')](_['pick'](_0x2c3e22[_0x5d2f('0x49')],_0x4f0296[_0x5d2f('0x4b')]));_0x3c7921['where'][_0x5d2f('0xc0')]=_0x278d67['id'];if(_0x2c3e22[_0x5d2f('0x49')][_0x5d2f('0x39')]){_0x3c7921['where']=_[_0x5d2f('0x55')](_0x3c7921[_0x5d2f('0x53')],{'$or':_[_0x5d2f('0x3b')](_0x3c7921[_0x5d2f('0x4c')],function(_0x23f858){var _0x2d7506={};_0x2d7506[_0x23f858]={'$like':'%'+_0x2c3e22[_0x5d2f('0x49')][_0x5d2f('0x39')]+'%'};return _0x2d7506;})});}_0x3c7921=_[_0x5d2f('0x55')]({},_0x3c7921,_0x2c3e22['options']);return db[_0x5d2f('0xc2')][_0x5d2f('0x2d')]({'where':_0x3c7921[_0x5d2f('0x53')]})[_0x5d2f('0x1e')](function(_0x3f4d03){_0x45c567[_0x5d2f('0x2d')]=_0x3f4d03;if(_0x2c3e22['query'][_0x5d2f('0x5e')]){_0x3c7921[_0x5d2f('0x5f')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x3c7921);})[_0x5d2f('0x1e')](function(_0x453cd9){_0x45c567[_0x5d2f('0x5b')]=_0x453cd9;return _0x45c567;});}})[_0x5d2f('0x1e')](respondWithFilteredResult(_0x5f489b,_0x3c7921))[_0x5d2f('0x28')](handleError(_0x5f489b,null));};exports[_0x5d2f('0xc3')]=function(_0x40ed92,_0x1f819e,_0x493913){var _0x58f3b5={};var _0x56cfbe={};var _0x18655d;var _0x66b0e5;return db[_0x5d2f('0x43')][_0x5d2f('0xb6')]({'where':{'id':_0x40ed92['params']['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x1f819e,null))[_0x5d2f('0x1e')](function(_0x1091d8){if(_0x1091d8){_0x18655d=_0x1091d8;_0x56cfbe[_0x5d2f('0x45')]=_[_0x5d2f('0x4a')](db[_0x5d2f('0xc4')][_0x5d2f('0x44')]);_0x56cfbe[_0x5d2f('0x49')]=_[_0x5d2f('0x4a')](_0x40ed92[_0x5d2f('0x49')]);_0x56cfbe[_0x5d2f('0x4b')]=_[_0x5d2f('0x4d')](_0x56cfbe[_0x5d2f('0x45')],_0x56cfbe[_0x5d2f('0x49')]);_0x58f3b5[_0x5d2f('0x4c')]=_[_0x5d2f('0x4d')](_0x56cfbe[_0x5d2f('0x45')],qs['fields'](_0x40ed92[_0x5d2f('0x49')]['fields']));_0x58f3b5[_0x5d2f('0x4c')]=_0x58f3b5[_0x5d2f('0x4c')][_0x5d2f('0x78')]?_0x58f3b5[_0x5d2f('0x4c')]:_0x56cfbe[_0x5d2f('0x45')];_0x58f3b5['order']=qs[_0x5d2f('0x52')](_0x40ed92[_0x5d2f('0x49')]['sort']);_0x58f3b5[_0x5d2f('0x53')]=qs[_0x5d2f('0x4b')](_[_0x5d2f('0x54')](_0x40ed92[_0x5d2f('0x49')],_0x56cfbe[_0x5d2f('0x4b')]));if(_0x40ed92[_0x5d2f('0x49')][_0x5d2f('0x39')]){_0x58f3b5[_0x5d2f('0x53')]=_[_0x5d2f('0x55')](_0x58f3b5[_0x5d2f('0x53')],{'$or':_['map'](_0x58f3b5[_0x5d2f('0x4c')],function(_0x22db75){var _0x1dd4f0={};_0x1dd4f0[_0x22db75]={'$like':'%'+_0x40ed92[_0x5d2f('0x49')][_0x5d2f('0x39')]+'%'};return _0x1dd4f0;})});}_0x58f3b5=_[_0x5d2f('0x55')]({},_0x58f3b5,_0x40ed92[_0x5d2f('0x5a')]);return _0x18655d[_0x5d2f('0xc3')](_0x58f3b5);}})[_0x5d2f('0x1e')](function(_0x39a2a9){if(_0x39a2a9){_0x66b0e5=_0x39a2a9[_0x5d2f('0x78')];if(!_0x40ed92[_0x5d2f('0x49')][_0x5d2f('0x4f')]('nolimit')){_0x58f3b5[_0x5d2f('0x2f')]=qs[_0x5d2f('0x2f')](_0x40ed92['query'][_0x5d2f('0x2f')]);_0x58f3b5[_0x5d2f('0x2e')]=qs[_0x5d2f('0x2e')](_0x40ed92[_0x5d2f('0x49')][_0x5d2f('0x2e')]);}return _0x18655d[_0x5d2f('0xc3')](_0x58f3b5);}})[_0x5d2f('0x1e')](function(_0x3866a2){if(_0x3866a2){return _0x3866a2?{'count':_0x66b0e5,'rows':_0x3866a2}:null;}})[_0x5d2f('0x1e')](respondWithResult(_0x1f819e,null))[_0x5d2f('0x28')](handleError(_0x1f819e,null));};exports[_0x5d2f('0xc5')]=function(_0x16e914,_0x1ac31d,_0x1437df){var _0x1350ed={};var _0x5ae2d6={};var _0x56dd21;var _0x1bbcd2;return db[_0x5d2f('0x43')][_0x5d2f('0xb6')]({'where':{'id':_0x16e914[_0x5d2f('0x5d')]['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x1ac31d,null))[_0x5d2f('0x1e')](function(_0x338f5f){if(_0x338f5f){_0x56dd21=_0x338f5f;_0x5ae2d6[_0x5d2f('0x45')]=_[_0x5d2f('0x4a')](db['OpenchannelInteraction']['rawAttributes']);_0x5ae2d6['query']=_[_0x5d2f('0x4a')](_0x16e914['query']);_0x5ae2d6[_0x5d2f('0x4b')]=_['intersection'](_0x5ae2d6['model'],_0x5ae2d6[_0x5d2f('0x49')]);_0x1350ed[_0x5d2f('0x4c')]=_[_0x5d2f('0x4d')](_0x5ae2d6[_0x5d2f('0x45')],qs['fields'](_0x16e914[_0x5d2f('0x49')][_0x5d2f('0x4e')]));_0x1350ed[_0x5d2f('0x4c')]=_0x1350ed[_0x5d2f('0x4c')][_0x5d2f('0x78')]?_0x1350ed['attributes']:_0x5ae2d6[_0x5d2f('0x45')];_0x1350ed[_0x5d2f('0x51')]=qs['sort'](_0x16e914['query']['sort']);_0x1350ed[_0x5d2f('0x53')]=qs['filters'](_['pick'](_0x16e914[_0x5d2f('0x49')],_0x5ae2d6['filters']));if(_0x16e914[_0x5d2f('0x49')][_0x5d2f('0x39')]){_0x1350ed[_0x5d2f('0x53')]=_[_0x5d2f('0x55')](_0x1350ed[_0x5d2f('0x53')],{'$or':_[_0x5d2f('0x3b')](_0x1350ed[_0x5d2f('0x4c')],function(_0x312e69){var _0x24108a={};_0x24108a[_0x312e69]={'$like':'%'+_0x16e914['query'][_0x5d2f('0x39')]+'%'};return _0x24108a;})});}_0x1350ed=_[_0x5d2f('0x55')]({},_0x1350ed,_0x16e914[_0x5d2f('0x5a')]);return _0x56dd21[_0x5d2f('0xc5')](_0x1350ed);}})[_0x5d2f('0x1e')](function(_0x25f930){if(_0x25f930){_0x1bbcd2=_0x25f930['length'];if(!_0x16e914[_0x5d2f('0x49')][_0x5d2f('0x4f')](_0x5d2f('0x50'))){_0x1350ed['limit']=qs['limit'](_0x16e914['query'][_0x5d2f('0x2f')]);_0x1350ed[_0x5d2f('0x2e')]=qs['offset'](_0x16e914[_0x5d2f('0x49')][_0x5d2f('0x2e')]);}return _0x56dd21[_0x5d2f('0xc5')](_0x1350ed);}})['then'](function(_0x19c187){if(_0x19c187){return _0x19c187?{'count':_0x1bbcd2,'rows':_0x19c187}:null;}})[_0x5d2f('0x1e')](respondWithResult(_0x1ac31d,null))[_0x5d2f('0x28')](handleError(_0x1ac31d,null));};exports[_0x5d2f('0xc6')]=function(_0x284564,_0x5f41de,_0x81fec3){var _0x3e299a={'raw':!![],'where':{}};var _0x41d935={};var _0x538399={'count':0x0,'rows':[]};return db[_0x5d2f('0x43')][_0x5d2f('0xb6')]({'where':{'id':_0x284564[_0x5d2f('0x5d')]['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x5f41de,null))[_0x5d2f('0x1e')](function(_0x53745c){if(_0x53745c){_0x41d935[_0x5d2f('0x45')]=_[_0x5d2f('0x4a')](db[_0x5d2f('0xc7')][_0x5d2f('0x44')]);_0x41d935[_0x5d2f('0x49')]=_[_0x5d2f('0x4a')](_0x284564[_0x5d2f('0x49')]);_0x41d935['filters']=_[_0x5d2f('0x4d')](_0x41d935['model'],_0x41d935[_0x5d2f('0x49')]);_0x3e299a[_0x5d2f('0x4c')]=_[_0x5d2f('0x4d')](_0x41d935[_0x5d2f('0x45')],qs['fields'](_0x284564[_0x5d2f('0x49')][_0x5d2f('0x4e')]));_0x3e299a[_0x5d2f('0x4c')]=_0x3e299a[_0x5d2f('0x4c')][_0x5d2f('0x78')]?_0x3e299a[_0x5d2f('0x4c')]:_0x41d935[_0x5d2f('0x45')];if(!_0x284564[_0x5d2f('0x49')][_0x5d2f('0x4f')](_0x5d2f('0x50'))){_0x3e299a[_0x5d2f('0x2f')]=qs[_0x5d2f('0x2f')](_0x284564['query'][_0x5d2f('0x2f')]);_0x3e299a[_0x5d2f('0x2e')]=qs[_0x5d2f('0x2e')](_0x284564[_0x5d2f('0x49')][_0x5d2f('0x2e')]);}_0x3e299a[_0x5d2f('0x51')]=qs[_0x5d2f('0x52')](_0x284564[_0x5d2f('0x49')]['sort']);_0x3e299a[_0x5d2f('0x53')]=qs[_0x5d2f('0x4b')](_['pick'](_0x284564[_0x5d2f('0x49')],_0x41d935['filters']));_0x3e299a[_0x5d2f('0x53')]['UserId']=_0x53745c['id'];if(_0x284564[_0x5d2f('0x49')]['filter']){_0x3e299a['where']=_[_0x5d2f('0x55')](_0x3e299a[_0x5d2f('0x53')],{'$or':_['map'](_0x3e299a[_0x5d2f('0x4c')],function(_0x426c2b){var _0x5deb6f={};_0x5deb6f[_0x426c2b]={'$like':'%'+_0x284564[_0x5d2f('0x49')][_0x5d2f('0x39')]+'%'};return _0x5deb6f;})});}_0x3e299a=_[_0x5d2f('0x55')]({},_0x3e299a,_0x284564['options']);return db[_0x5d2f('0xc7')][_0x5d2f('0x2d')]({'where':_0x3e299a[_0x5d2f('0x53')]})['then'](function(_0x4ace50){_0x538399[_0x5d2f('0x2d')]=_0x4ace50;if(_0x284564['query'][_0x5d2f('0x5e')]){_0x3e299a[_0x5d2f('0x5f')]=[{'all':!![]}];}return db[_0x5d2f('0xc7')]['findAll'](_0x3e299a);})[_0x5d2f('0x1e')](function(_0xc92da5){_0x538399[_0x5d2f('0x5b')]=_0xc92da5;return _0x538399;});}})['then'](respondWithFilteredResult(_0x5f41de,_0x3e299a))['catch'](handleError(_0x5f41de,null));};exports[_0x5d2f('0xc8')]=function(_0x86bb9c,_0x178cce,_0x3fd92f){var _0x1db196={};var _0x1d55cc={};var _0x181040;var _0x3117f9;return db[_0x5d2f('0x43')][_0x5d2f('0xb6')]({'where':{'id':_0x86bb9c[_0x5d2f('0x5d')]['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x178cce,null))[_0x5d2f('0x1e')](function(_0x215bef){if(_0x215bef){_0x181040=_0x215bef;_0x1d55cc[_0x5d2f('0x45')]=_['keys'](db[_0x5d2f('0xc9')][_0x5d2f('0x44')]);_0x1d55cc[_0x5d2f('0x49')]=_[_0x5d2f('0x4a')](_0x86bb9c['query']);_0x1d55cc[_0x5d2f('0x4b')]=_['intersection'](_0x1d55cc[_0x5d2f('0x45')],_0x1d55cc[_0x5d2f('0x49')]);_0x1db196[_0x5d2f('0x4c')]=_[_0x5d2f('0x4d')](_0x1d55cc[_0x5d2f('0x45')],qs[_0x5d2f('0x4e')](_0x86bb9c[_0x5d2f('0x49')][_0x5d2f('0x4e')]));_0x1db196[_0x5d2f('0x4c')]=_0x1db196[_0x5d2f('0x4c')][_0x5d2f('0x78')]?_0x1db196[_0x5d2f('0x4c')]:_0x1d55cc[_0x5d2f('0x45')];_0x1db196[_0x5d2f('0x51')]=qs['sort'](_0x86bb9c[_0x5d2f('0x49')]['sort']);_0x1db196[_0x5d2f('0x53')]=qs[_0x5d2f('0x4b')](_[_0x5d2f('0x54')](_0x86bb9c[_0x5d2f('0x49')],_0x1d55cc[_0x5d2f('0x4b')]));if(_0x86bb9c['query']['filter']){_0x1db196[_0x5d2f('0x53')]=_[_0x5d2f('0x55')](_0x1db196[_0x5d2f('0x53')],{'$or':_[_0x5d2f('0x3b')](_0x1db196[_0x5d2f('0x4c')],function(_0x185324){var _0x316c0c={};_0x316c0c[_0x185324]={'$like':'%'+_0x86bb9c[_0x5d2f('0x49')][_0x5d2f('0x39')]+'%'};return _0x316c0c;})});}_0x1db196=_['merge']({},_0x1db196,_0x86bb9c['options']);return _0x181040[_0x5d2f('0xc8')](_0x1db196);}})[_0x5d2f('0x1e')](function(_0x5529a1){if(_0x5529a1){_0x3117f9=_0x5529a1['length'];if(!_0x86bb9c[_0x5d2f('0x49')][_0x5d2f('0x4f')]('nolimit')){_0x1db196[_0x5d2f('0x2f')]=qs[_0x5d2f('0x2f')](_0x86bb9c['query'][_0x5d2f('0x2f')]);_0x1db196[_0x5d2f('0x2e')]=qs['offset'](_0x86bb9c['query'][_0x5d2f('0x2e')]);}return _0x181040[_0x5d2f('0xc8')](_0x1db196);}})['then'](function(_0x17001c){if(_0x17001c){return _0x17001c?{'count':_0x3117f9,'rows':_0x17001c}:null;}})[_0x5d2f('0x1e')](respondWithResult(_0x178cce,null))['catch'](handleError(_0x178cce,null));};exports[_0x5d2f('0xca')]=function(_0x24f9a6,_0x4c3a69,_0x300a57){var _0x2a6f7b={};var _0x362708={};var _0x430f06;var _0x2da8b1;return db[_0x5d2f('0x43')][_0x5d2f('0xb6')]({'where':{'id':_0x24f9a6[_0x5d2f('0x5d')]['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x4c3a69,null))['then'](function(_0x81b2c4){if(_0x81b2c4){_0x430f06=_0x81b2c4;_0x362708[_0x5d2f('0x45')]=_[_0x5d2f('0x4a')](db['FaxInteraction'][_0x5d2f('0x44')]);_0x362708[_0x5d2f('0x49')]=_[_0x5d2f('0x4a')](_0x24f9a6[_0x5d2f('0x49')]);_0x362708[_0x5d2f('0x4b')]=_['intersection'](_0x362708[_0x5d2f('0x45')],_0x362708[_0x5d2f('0x49')]);_0x2a6f7b[_0x5d2f('0x4c')]=_[_0x5d2f('0x4d')](_0x362708['model'],qs[_0x5d2f('0x4e')](_0x24f9a6['query'][_0x5d2f('0x4e')]));_0x2a6f7b[_0x5d2f('0x4c')]=_0x2a6f7b[_0x5d2f('0x4c')][_0x5d2f('0x78')]?_0x2a6f7b[_0x5d2f('0x4c')]:_0x362708['model'];_0x2a6f7b[_0x5d2f('0x51')]=qs[_0x5d2f('0x52')](_0x24f9a6['query'][_0x5d2f('0x52')]);_0x2a6f7b['where']=qs['filters'](_[_0x5d2f('0x54')](_0x24f9a6[_0x5d2f('0x49')],_0x362708[_0x5d2f('0x4b')]));if(_0x24f9a6['query'][_0x5d2f('0x39')]){_0x2a6f7b[_0x5d2f('0x53')]=_[_0x5d2f('0x55')](_0x2a6f7b[_0x5d2f('0x53')],{'$or':_[_0x5d2f('0x3b')](_0x2a6f7b[_0x5d2f('0x4c')],function(_0x5d3994){var _0x46978e={};_0x46978e[_0x5d3994]={'$like':'%'+_0x24f9a6[_0x5d2f('0x49')][_0x5d2f('0x39')]+'%'};return _0x46978e;})});}_0x2a6f7b=_[_0x5d2f('0x55')]({},_0x2a6f7b,_0x24f9a6[_0x5d2f('0x5a')]);return _0x430f06['getFaxInteractions'](_0x2a6f7b);}})[_0x5d2f('0x1e')](function(_0x20ee06){if(_0x20ee06){_0x2da8b1=_0x20ee06['length'];if(!_0x24f9a6[_0x5d2f('0x49')][_0x5d2f('0x4f')]('nolimit')){_0x2a6f7b[_0x5d2f('0x2f')]=qs['limit'](_0x24f9a6[_0x5d2f('0x49')][_0x5d2f('0x2f')]);_0x2a6f7b[_0x5d2f('0x2e')]=qs[_0x5d2f('0x2e')](_0x24f9a6[_0x5d2f('0x49')][_0x5d2f('0x2e')]);}return _0x430f06['getFaxInteractions'](_0x2a6f7b);}})[_0x5d2f('0x1e')](function(_0x3cd5f4){if(_0x3cd5f4){return _0x3cd5f4?{'count':_0x2da8b1,'rows':_0x3cd5f4}:null;}})['then'](respondWithResult(_0x4c3a69,null))[_0x5d2f('0x28')](handleError(_0x4c3a69,null));};exports[_0x5d2f('0xcb')]=function(_0x5587cb,_0xcda2a1,_0x324116){var _0x3a0a22;var _0x34dc73;var _0x495d87;var _0x53d20d=!_['isNil'](_0x5587cb[_0x5d2f('0x5d')]['id'])?_0x5587cb[_0x5d2f('0x5d')]['id']:!_[_0x5d2f('0x6e')](_0x5587cb[_0x5d2f('0x36')]['id'])?_0x5587cb[_0x5d2f('0x36')]['id']:null;return db[_0x5d2f('0x43')][_0x5d2f('0x62')]({'where':{'id':_0x53d20d,'role':{'$or':['admin','user',_0x5d2f('0x38')]}},'attributes':['id','name','phone',_0x5d2f('0xcc'),_0x5d2f('0x3c'),_0x5d2f('0x72'),_0x5d2f('0x94')]})[_0x5d2f('0x1e')](function(_0x431605){if(_0x431605){if(_0x431605[_0x5d2f('0x3c')]===_0x5d2f('0x38')){_0x3a0a22=_0x431605;if(_0x5587cb[_0x5d2f('0x61')][_0x5d2f('0x96')]){_0x495d87=util[_0x5d2f('0xcd')]('LOCAL/%s@from-sip/n',_0x3a0a22[_0x5587cb['body'][_0x5d2f('0x96')]]);}else if(_0x5587cb[_0x5d2f('0x61')][_0x5d2f('0xce')]){_0x495d87=util[_0x5d2f('0xcd')](_0x5d2f('0xa4'),_0x5587cb[_0x5d2f('0x61')][_0x5d2f('0xce')]);}else{_0x495d87=util[_0x5d2f('0xcd')](_0x5d2f('0xa4'),_0x3a0a22[_0x5d2f('0x3e')]);}socket['to'](util[_0x5d2f('0xcd')](_0x5d2f('0xcf'),_0x3a0a22['name']))[_0x5d2f('0xa9')](_0x5d2f('0xd0'),{'ip':_0x5587cb['headers'][_0x5d2f('0xd1')]||_0x5587cb[_0x5d2f('0xd2')][_0x5d2f('0xd3')]||_0x5587cb[_0x5d2f('0xd4')][_0x5d2f('0xd3')]||_0x5587cb[_0x5d2f('0xd2')]['socket'][_0x5d2f('0xd3')]});return db[_0x5d2f('0xa6')]['destroy']({'where':{'membername':_0x3a0a22['name']},'individualHooks':!![]});}}else{throw new db[(_0x5d2f('0x8c'))][(_0x5d2f('0x1b'))](_0x5d2f('0xd5'));}})['then'](function(){if(_0x3a0a22){return _0x3a0a22[_0x5d2f('0xd6')]({'raw':!![]});}})[_0x5d2f('0x1e')](function(_0x606e46){if(_0x3a0a22){var _0x3871cd=[];if(_0x606e46){_0x34dc73=_0x606e46;if(_0x34dc73[_0x5d2f('0x78')]){for(var _0x1f4ed3=0x0;_0x1f4ed3<_0x34dc73[_0x5d2f('0x78')];_0x1f4ed3++){_0x3871cd[_0x5d2f('0xa3')]({'membername':_0x3a0a22['name'],'UserId':_0x3a0a22['id'],'queue_name':_0x34dc73[_0x1f4ed3][_0x5d2f('0x3e')],'VoiceQueueId':_0x34dc73[_0x1f4ed3]['id'],'interface':_0x495d87,'paused':_0x3a0a22[_0x5d2f('0x94')]||![],'penalty':_0x34dc73[_0x1f4ed3][_0x5d2f('0xd7')]||0x0});}return BPromise[_0x5d2f('0xa5')](_0x3871cd,function(_0x1c5a54){return db[_0x5d2f('0xa6')][_0x5d2f('0xd8')](_0x1c5a54);});}}}})[_0x5d2f('0x1e')](function(){if(_0x3a0a22){return db[_0x5d2f('0xd9')][_0x5d2f('0xa0')]({'where':{'membername':_0x3a0a22['name'],'exitAt':null}});}})[_0x5d2f('0x1e')](function(_0x2fdfe2){if(_0x3a0a22){var _0x70a9ae=[];_0x2fdfe2[_0x5d2f('0xda')](function(_0x1d0899){_0x70a9ae[_0x5d2f('0xa3')](_0x1d0899[_0x5d2f('0x33')]({'exitAt':moment()[_0x5d2f('0xcd')](_0x5d2f('0xdb'))}));});return BPromise[_0x5d2f('0xdc')](_0x70a9ae);}})[_0x5d2f('0x1e')](function(){if(_0x3a0a22){var _0x4b2751=[];var _0x2cd20b=[];var _0x537884=utils[_0x5d2f('0xdd')]();var _0x3b7be8={'membername':_0x3a0a22['name'],'interface':_0x495d87,'enterAt':moment()['format'](_0x5d2f('0xdb')),'role':_0x3a0a22['role'],'internal':_0x3a0a22['internal']};_0x537884[_0x5d2f('0xda')](function(_0x39a07c){_0x4b2751[_0x5d2f('0xa3')](_['merge']({'channel':_0x39a07c,'type':_0x5d2f('0xde'),'data1':_0x5587cb['body'][_0x5d2f('0xdf')],'data2':_0x495d87},_0x3b7be8));if(_0x3a0a22[_0x5d2f('0x94')]){_0x2cd20b[_0x5d2f('0xa3')](_[_0x5d2f('0x55')]({'channel':_0x39a07c,'type':_0x5d2f('0xe0'),'data1':_0x5d2f('0xe1')},_0x3b7be8));}});return db['MemberReport'][_0x5d2f('0x60')](_0x4b2751[_0x5d2f('0xe2')](_0x2cd20b),{'individualHooks':!![]});}})[_0x5d2f('0x1e')](function(){if(_0x3a0a22){return _0x3a0a22[_0x5d2f('0x33')]({'online':!![],'lastLoginAt':moment()['format'](_0x5d2f('0xdb')),'voicePause':_0x3a0a22[_0x5d2f('0x94')]||![],'mailPause':_0x3a0a22['loginInPause']||![],'chatPause':_0x3a0a22[_0x5d2f('0x94')]||![],'faxPause':_0x3a0a22['loginInPause']||![],'smsPause':_0x3a0a22[_0x5d2f('0x94')]||![],'openchannelPause':_0x3a0a22['loginInPause']||![],'pauseType':_0x3a0a22[_0x5d2f('0x94')]?_0x5d2f('0xe1'):null,'interface':_0x495d87,'lastPauseAt':moment()[_0x5d2f('0xcd')](_0x5d2f('0xdb'))});}})[_0x5d2f('0x1e')](function(_0x15da0d){if(_0x5587cb[_0x5d2f('0xe3')]){return _0x324116();}else{return BPromise[_0x5d2f('0xe4')](_0x15da0d)[_0x5d2f('0x1e')](respondWithResult(_0xcda2a1,null));}})[_0x5d2f('0x28')](handleError(_0xcda2a1,null));};exports[_0x5d2f('0xe5')]=function(_0x59d03e,_0x231bba,_0x30b328){var _0x29153b;return db[_0x5d2f('0x43')][_0x5d2f('0x62')]({'where':{'id':_0x59d03e[_0x5d2f('0x5d')]['id'],'role':'agent'},'attributes':['id',_0x5d2f('0x3e'),_0x5d2f('0x3c')]})['then'](handleEntityNotFound(_0x231bba,null))[_0x5d2f('0x1e')](function(_0xd18379){if(_0xd18379){_0x29153b=_0xd18379;return db[_0x5d2f('0xa6')]['destroy']({'where':{'membername':_0x29153b[_0x5d2f('0x3e')]},'individualHooks':!![]});}})[_0x5d2f('0x1e')](function(){return db[_0x5d2f('0xd9')][_0x5d2f('0xa0')]({'where':{'membername':_0x29153b[_0x5d2f('0x3e')],'exitAt':null}});})['then'](function(_0x4af406){var _0x524d52=[];_0x4af406[_0x5d2f('0xda')](function(_0x2a343e){_0x524d52[_0x5d2f('0xa3')](_0x2a343e['update']({'exitAt':moment()[_0x5d2f('0xcd')](_0x5d2f('0xdb'))}));});return BPromise[_0x5d2f('0xdc')](_0x524d52);})['then'](function(){return _0x29153b['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0x5d2f('0x1e')](respondWithResult(_0x231bba,null))[_0x5d2f('0x28')](handleError(_0x231bba,null));};exports[_0x5d2f('0xe6')]=function(_0x216a1d,_0x4e8313,_0x234e87){var _0x22d4b1;return db[_0x5d2f('0xa6')][_0x5d2f('0x33')]({'paused':0x1},{'where':{'UserId':_0x216a1d[_0x5d2f('0x5d')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x5d2f('0x43')][_0x5d2f('0x62')]({'where':{'id':_0x216a1d[_0x5d2f('0x5d')]['id'],'role':_0x5d2f('0x38')},'attributes':['id',_0x5d2f('0x3e'),_0x5d2f('0x3c'),_0x5d2f('0x72'),_0x5d2f('0x96')]});})[_0x5d2f('0x1e')](handleEntityNotFound(_0x4e8313,null))['then'](function(_0x3bae57){if(_0x3bae57){_0x22d4b1=_0x3bae57;return respondWithRpcPromise('QueuePause',_0x5d2f('0xe6'),{'id':_0x22d4b1['id'],'name':_0x22d4b1['name'],'pause':!![]});}})[_0x5d2f('0x1e')](function(){if(_0x22d4b1){return db[_0x5d2f('0xd9')][_0x5d2f('0xa0')]({'where':{'membername':_0x22d4b1[_0x5d2f('0x3e')],'type':_0x5d2f('0xe0'),'exitAt':null}});}})[_0x5d2f('0x1e')](function(_0x22fdcb){if(_0x22fdcb[_0x5d2f('0x78')]){var _0x482763=moment()[_0x5d2f('0xcd')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x36df45=0x0,_0x1d90f7=_0x22fdcb[_0x5d2f('0x78')];_0x36df45<_0x1d90f7;_0x36df45++){_0x22fdcb[_0x36df45]['updateAttributes']({'exitAt':_0x482763});}}})['then'](function(){var _0x5e8f45=[];var _0x9a3be0=utils['getChannels']();_0x9a3be0['forEach'](function(_0x55669a){_0x5e8f45[_0x5d2f('0xa3')]({'channel':_0x55669a,'membername':_0x22d4b1[_0x5d2f('0x3e')],'interface':_[_0x5d2f('0x6e')](_0x22d4b1['interface'])?util[_0x5d2f('0xcd')]('SIP/%s',_0x22d4b1[_0x5d2f('0x3e')]):_0x22d4b1['interface'],'type':'PAUSE','enterAt':moment()[_0x5d2f('0xcd')](_0x5d2f('0xdb')),'data1':_0x216a1d['body'][_0x5d2f('0x56')]||_0x5d2f('0xe7'),'role':_0x22d4b1[_0x5d2f('0x3c')],'internal':_0x22d4b1[_0x5d2f('0x72')]});});return db['MemberReport'][_0x5d2f('0x60')](_0x5e8f45,{'individualHooks':!![]});})[_0x5d2f('0x1e')](function(){return _0x22d4b1[_0x5d2f('0x33')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x216a1d[_0x5d2f('0x61')]['type']||_0x5d2f('0xe7'),'lastPauseAt':moment()['format'](_0x5d2f('0xdb'))});})[_0x5d2f('0x1e')](respondWithResult(_0x4e8313,null))['catch'](handleError(_0x4e8313,null));};exports[_0x5d2f('0xe8')]=function(_0x453789,_0x197278,_0x8fffb3){var _0x83463d;return db['User'][_0x5d2f('0x62')]({'where':{'id':_0x453789[_0x5d2f('0x5d')]['id']},'attributes':['id','name',_0x5d2f('0x3c'),'voicePause',_0x5d2f('0xe9'),_0x5d2f('0xea'),_0x5d2f('0xeb'),_0x5d2f('0xec'),'smsPause',_0x5d2f('0xed'),_0x5d2f('0xee')]})[_0x5d2f('0x1e')](handleEntityNotFound(_0x197278,null))[_0x5d2f('0x1e')](function(_0x4d1cf3){if(_0x4d1cf3){_0x83463d=_0x4d1cf3;if(_0x453789['body']['channel']&&!utils[_0x5d2f('0x97')](_0x453789['body'][_0x5d2f('0x93')])){throw new db[(_0x5d2f('0x8c'))][(_0x5d2f('0x1b'))](_0x5d2f('0x98'));}switch(_0x453789[_0x5d2f('0x61')]['channel']){case _0x5d2f('0xa1'):return respondWithRpcPromise(_0x5d2f('0xef'),_0x5d2f('0xe8'),{'id':_0x83463d['id'],'name':_0x83463d[_0x5d2f('0x3e')],'pause':![]})[_0x5d2f('0x1e')](function(){return db[_0x5d2f('0xa6')]['update']({'paused':0x0},{'where':{'UserId':_0x83463d['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport']['find']({'where':{'channel':_0x453789[_0x5d2f('0x61')]['channel'],'membername':_0x83463d[_0x5d2f('0x3e')],'type':_0x5d2f('0xe0'),'exitAt':null}});})[_0x5d2f('0x1e')](function(_0x1d3594){if(_0x1d3594){return _0x1d3594[_0x5d2f('0x33')]({'exitAt':moment()[_0x5d2f('0xcd')](_0x5d2f('0xdb')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0x5d2f('0x1e')](function(){return _0x83463d[_0x5d2f('0x33')]({'voicePause':![]});});case'mail':case'chat':case _0x5d2f('0xf0'):case _0x5d2f('0xf1'):case _0x5d2f('0xf2'):return db['MemberReport'][_0x5d2f('0x62')]({'where':{'channel':_0x453789[_0x5d2f('0x61')][_0x5d2f('0x93')],'membername':_0x83463d[_0x5d2f('0x3e')],'type':_0x5d2f('0xe0'),'exitAt':null}})[_0x5d2f('0x1e')](function(_0x5f0856){if(_0x5f0856){return _0x5f0856[_0x5d2f('0x33')]({'exitAt':moment()[_0x5d2f('0xcd')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x5d2f('0xf3')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x5cbb24={};_[_0x5d2f('0x30')](_0x5cbb24,util[_0x5d2f('0xcd')]('%s%s',_0x453789['body'][_0x5d2f('0x93')],_0x5d2f('0xf4')),![]);return _0x83463d[_0x5d2f('0x33')](_0x5cbb24);});default:return respondWithRpcPromise(_0x5d2f('0xef'),'unpause',{'id':_0x83463d['id'],'name':_0x83463d[_0x5d2f('0x3e')],'pause':![]})[_0x5d2f('0x1e')](function(){return db[_0x5d2f('0xa6')][_0x5d2f('0x33')]({'paused':0x0},{'where':{'UserId':_0x83463d['id']}});})[_0x5d2f('0x1e')](function(){return db[_0x5d2f('0xd9')]['findAll']({'where':{'membername':_0x83463d[_0x5d2f('0x3e')],'type':_0x5d2f('0xe0'),'exitAt':null}});})['then'](function(_0x484242){var _0x3bf45f=[];_0x484242[_0x5d2f('0xda')](function(_0x592fc1){_0x3bf45f['push'](_0x592fc1[_0x5d2f('0x33')]({'exitAt':moment()[_0x5d2f('0xcd')](_0x5d2f('0xdb')),'data2':_0x5d2f('0xf3')}));});return BPromise[_0x5d2f('0xdc')](_0x3bf45f);})[_0x5d2f('0x1e')](function(){return _0x83463d['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x5d2f('0x1e')](respondWithResult(_0x197278,null))[_0x5d2f('0x28')](handleError(_0x197278,null));};exports[_0x5d2f('0xf5')]=function(_0x18adf8,_0x3bf07e,_0x23b00e){var _0x545bbe={};var _0x56740d={};var _0x1d760d;var _0x485b06;return db['User']['findOne']({'where':{'id':_0x18adf8[_0x5d2f('0x5d')]['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x3bf07e,null))[_0x5d2f('0x1e')](function(_0x328f01){if(_0x328f01){_0x1d760d=_0x328f01;_0x56740d[_0x5d2f('0x45')]=_['keys'](db['Team'][_0x5d2f('0x44')]);_0x56740d[_0x5d2f('0x49')]=_[_0x5d2f('0x4a')](_0x18adf8['query']);_0x56740d['filters']=_[_0x5d2f('0x4d')](_0x56740d[_0x5d2f('0x45')],_0x56740d[_0x5d2f('0x49')]);_0x545bbe['attributes']=_[_0x5d2f('0x4d')](_0x56740d[_0x5d2f('0x45')],qs[_0x5d2f('0x4e')](_0x18adf8[_0x5d2f('0x49')][_0x5d2f('0x4e')]));_0x545bbe[_0x5d2f('0x4c')]=_0x545bbe[_0x5d2f('0x4c')][_0x5d2f('0x78')]?_0x545bbe[_0x5d2f('0x4c')]:_0x56740d[_0x5d2f('0x45')];_0x545bbe[_0x5d2f('0x51')]=qs['sort'](_0x18adf8[_0x5d2f('0x49')][_0x5d2f('0x52')]);_0x545bbe[_0x5d2f('0x53')]=qs[_0x5d2f('0x4b')](_['pick'](_0x18adf8['query'],_0x56740d['filters']));if(_0x18adf8[_0x5d2f('0x49')][_0x5d2f('0x39')]){_0x545bbe[_0x5d2f('0x53')]=_['merge'](_0x545bbe[_0x5d2f('0x53')],{'$or':_['map'](_0x545bbe['attributes'],function(_0x89f9ea){var _0x8527f3={};_0x8527f3[_0x89f9ea]={'$like':'%'+_0x18adf8[_0x5d2f('0x49')][_0x5d2f('0x39')]+'%'};return _0x8527f3;})});}_0x545bbe=_['merge']({},_0x545bbe,_0x18adf8[_0x5d2f('0x5a')]);return _0x1d760d[_0x5d2f('0xf5')](_0x545bbe);}})[_0x5d2f('0x1e')](function(_0x17adcd){if(_0x17adcd){_0x485b06=_0x17adcd[_0x5d2f('0x78')];if(!_0x18adf8['query'][_0x5d2f('0x4f')](_0x5d2f('0x50'))){_0x545bbe[_0x5d2f('0x2f')]=qs[_0x5d2f('0x2f')](_0x18adf8[_0x5d2f('0x49')]['limit']);_0x545bbe[_0x5d2f('0x2e')]=qs[_0x5d2f('0x2e')](_0x18adf8[_0x5d2f('0x49')]['offset']);}return _0x1d760d[_0x5d2f('0xf5')](_0x545bbe);}})[_0x5d2f('0x1e')](function(_0x2473a4){if(_0x2473a4){return _0x2473a4?{'count':_0x485b06,'rows':_0x2473a4}:null;}})[_0x5d2f('0x1e')](respondWithResult(_0x3bf07e,null))['catch'](handleError(_0x3bf07e,null));};exports['addTeams']=function(_0x244df9,_0x51023d){return db[_0x5d2f('0x43')][_0x5d2f('0x62')]({'where':{'id':_0x244df9[_0x5d2f('0x5d')]['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x51023d,null))[_0x5d2f('0x1e')](function(_0x4d583b){if(_0x4d583b){var _0x5125af=_0x4d583b['get']({'plain':!![]});return _0x4d583b[_0x5d2f('0xf6')](_0x244df9[_0x5d2f('0x61')][_0x5d2f('0x65')],_[_0x5d2f('0x66')](_0x244df9[_0x5d2f('0x61')],[_0x5d2f('0x65'),'id'])||{})[_0x5d2f('0x1e')](function(){for(var _0x180003=0x0;_0x180003<_0x244df9[_0x5d2f('0x61')][_0x5d2f('0x65')][_0x5d2f('0x78')];_0x180003++){var _0x4dfc05=[];db[_0x5d2f('0xf7')]['findOne']({'where':{'id':_0x244df9['body']['ids'][_0x180003]}})['then'](function(_0x1e8d8e){_0x4dfc05[_0x5d2f('0xa3')](_0x1e8d8e[_0x5d2f('0xd6')]()[_0x5d2f('0x1e')](function(_0x1fecc1){for(var _0x49ada0=0x0;_0x49ada0<_0x1fecc1[_0x5d2f('0x78')];_0x49ada0++){_0x1fecc1[_0x49ada0][_0x5d2f('0xf8')](_0x5d2f('0x93'),_0x5d2f('0xf9'));}return _0x1fecc1;}));_0x4dfc05['push'](_0x1e8d8e['getChatQueues']()['then'](function(_0x3196c4){for(var _0x546a3a=0x0;_0x546a3a<_0x3196c4[_0x5d2f('0x78')];_0x546a3a++){_0x3196c4[_0x546a3a]['setDataValue'](_0x5d2f('0x93'),_0x5d2f('0xfa'));}return _0x3196c4;}));_0x4dfc05[_0x5d2f('0xa3')](_0x1e8d8e['getMailQueues']()[_0x5d2f('0x1e')](function(_0x40a3a3){for(var _0x34abe4=0x0;_0x34abe4<_0x40a3a3[_0x5d2f('0x78')];_0x34abe4++){_0x40a3a3[_0x34abe4][_0x5d2f('0xf8')](_0x5d2f('0x93'),'Mail');}return _0x40a3a3;}));_0x4dfc05[_0x5d2f('0xa3')](_0x1e8d8e['getSmsQueues']()[_0x5d2f('0x1e')](function(_0xaf60fe){for(var _0x23aca7=0x0;_0x23aca7<_0xaf60fe['length'];_0x23aca7++){_0xaf60fe[_0x23aca7][_0x5d2f('0xf8')]('channel',_0x5d2f('0xfb'));}return _0xaf60fe;}));_0x4dfc05[_0x5d2f('0xa3')](_0x1e8d8e['getFaxQueues']()['then'](function(_0x1c1792){for(var _0x1a63e8=0x0;_0x1a63e8<_0x1c1792['length'];_0x1a63e8++){_0x1c1792[_0x1a63e8][_0x5d2f('0xf8')]('channel',_0x5d2f('0xfc'));}return _0x1c1792;}));_0x4dfc05['push'](_0x1e8d8e[_0x5d2f('0xfd')]()[_0x5d2f('0x1e')](function(_0x30405f){for(var _0x3d45fa=0x0;_0x3d45fa<_0x30405f['length'];_0x3d45fa++){_0x30405f[_0x3d45fa]['setDataValue'](_0x5d2f('0x93'),_0x5d2f('0xfe'));}return _0x30405f;}));return BPromise[_0x5d2f('0xdc')](_0x4dfc05);})[_0x5d2f('0x1e')](function(_0x4dc369){var _0x18eb35=_['flatten'](_0x4dc369);_0x4dfc05=[];return db[_0x5d2f('0x58')][_0x5d2f('0xff')](function(_0x430a0a){for(var _0xfb95b1=0x0;_0xfb95b1<_0x18eb35['length'];_0xfb95b1++){_0x4dfc05[_0x5d2f('0xa3')](_0x18eb35[_0xfb95b1][_0x5d2f('0x100')](_0x5125af['id']),{'transaction':_0x430a0a});}return BPromise[_0x5d2f('0xdc')](_0x4dfc05)[_0x5d2f('0x1e')](function(){if(_0x5125af[_0x5d2f('0xa2')]){return BPromise[_0x5d2f('0xa5')](_[_0x5d2f('0x39')](_0x18eb35,function(_0x56cef2){return _0x56cef2[_0x5d2f('0x101')]('channel')===_0x5d2f('0xf9');}),function(_0x2cbefb){return db[_0x5d2f('0xa6')]['upsert']({'membername':_0x5125af[_0x5d2f('0x3e')],'UserId':_0x5125af['id'],'queue_name':_0x2cbefb[_0x5d2f('0x3e')],'VoiceQueueId':_0x2cbefb['id'],'interface':_['isNil'](_0x5125af[_0x5d2f('0x96')])?util[_0x5d2f('0xcd')]('SIP/%s',_0x5125af[_0x5d2f('0x3e')]):_0x5125af['interface'],'paused':_0x5125af['voicePause']||![],'penalty':_0x5125af[_0x5d2f('0x9b')]},{'transaction':_0x430a0a});});}else{return;}})[_0x5d2f('0x1e')](function(){for(var _0x3db9d5=0x0;_0x3db9d5<_0x18eb35['length'];_0x3db9d5++){var _0x5c2602=_0x18eb35[_0x3db9d5]['getDataValue'](_0x5d2f('0x93'));var _0x755630=_0x5c2602+_0x5d2f('0x9d');socket[_0x5d2f('0xa9')](_0x5d2f('0x36')+_0x5c2602+_0x5d2f('0x9e'),{'UserId':_0x5125af['id'],['queueField']:_0x18eb35[_0x3db9d5]['id']});}});});});}});}})[_0x5d2f('0x1e')](respondWithStatusCode(_0x51023d,null))[_0x5d2f('0x28')](handleError(_0x51023d,null));};exports['removeTeams']=function(_0x31d1f7,_0x40bffc){return db['User']['findOne']({'where':{'id':_0x31d1f7['params']['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x40bffc,null))[_0x5d2f('0x1e')](function(_0x4054ba){if(_0x4054ba){var _0x4ee22c=_0x4054ba['get']({'plain':!![]});var _0x31c575=_0x31d1f7[_0x5d2f('0x49')][_0x5d2f('0x65')];return _0x4054ba[_0x5d2f('0x102')](_0x31c575)[_0x5d2f('0x1e')](function(){for(var _0xd59477=0x0;_0xd59477<_0x31c575[_0x5d2f('0x78')];_0xd59477++){var _0x169d18=[];db[_0x5d2f('0xf7')]['findOne']({'where':{'id':_0x31c575[_0xd59477]}})[_0x5d2f('0x1e')](function(_0x4757c4){_0x169d18[_0x5d2f('0xa3')](_0x4757c4['getVoiceQueues']()[_0x5d2f('0x1e')](function(_0x23c56b){for(var _0x2fbf6f=0x0;_0x2fbf6f<_0x23c56b[_0x5d2f('0x78')];_0x2fbf6f++){_0x23c56b[_0x2fbf6f][_0x5d2f('0xf8')](_0x5d2f('0x93'),'Voice');}return _0x23c56b;}));_0x169d18[_0x5d2f('0xa3')](_0x4757c4['getChatQueues']()[_0x5d2f('0x1e')](function(_0x3eda9a){for(var _0x57fa94=0x0;_0x57fa94<_0x3eda9a[_0x5d2f('0x78')];_0x57fa94++){_0x3eda9a[_0x57fa94]['setDataValue'](_0x5d2f('0x93'),_0x5d2f('0xfa'));}return _0x3eda9a;}));_0x169d18['push'](_0x4757c4['getMailQueues']()[_0x5d2f('0x1e')](function(_0x72f0b4){for(var _0x7ea6b2=0x0;_0x7ea6b2<_0x72f0b4[_0x5d2f('0x78')];_0x7ea6b2++){_0x72f0b4[_0x7ea6b2]['setDataValue']('channel','Mail');}return _0x72f0b4;}));_0x169d18[_0x5d2f('0xa3')](_0x4757c4['getSmsQueues']()[_0x5d2f('0x1e')](function(_0x569430){for(var _0x253b61=0x0;_0x253b61<_0x569430['length'];_0x253b61++){_0x569430[_0x253b61]['setDataValue']('channel',_0x5d2f('0xfb'));}return _0x569430;}));_0x169d18[_0x5d2f('0xa3')](_0x4757c4[_0x5d2f('0x103')]()[_0x5d2f('0x1e')](function(_0x2c0457){for(var _0x46e4d3=0x0;_0x46e4d3<_0x2c0457[_0x5d2f('0x78')];_0x46e4d3++){_0x2c0457[_0x46e4d3][_0x5d2f('0xf8')](_0x5d2f('0x93'),'Fax');}return _0x2c0457;}));_0x169d18[_0x5d2f('0xa3')](_0x4757c4[_0x5d2f('0xfd')]()[_0x5d2f('0x1e')](function(_0x18a3c9){for(var _0x4ee86a=0x0;_0x4ee86a<_0x18a3c9[_0x5d2f('0x78')];_0x4ee86a++){_0x18a3c9[_0x4ee86a][_0x5d2f('0xf8')](_0x5d2f('0x93'),_0x5d2f('0xfe'));}return _0x18a3c9;}));return BPromise['all'](_0x169d18);})[_0x5d2f('0x1e')](function(_0x24454d){var _0x474e6a=_[_0x5d2f('0x104')](_0x24454d);_0x169d18=[];return db['sequelize']['transaction'](function(_0x59ada9){for(var _0x401238=0x0;_0x401238<_0x474e6a[_0x5d2f('0x78')];_0x401238++){_0x169d18[_0x5d2f('0xa3')](_0x474e6a[_0x401238][_0x5d2f('0x105')](_0x4ee22c['id']),{'transaction':_0x59ada9});}return BPromise[_0x5d2f('0xdc')](_0x169d18)[_0x5d2f('0x1e')](function(){if(_0x4ee22c['online']){return BPromise[_0x5d2f('0xa5')](_[_0x5d2f('0x39')](_0x474e6a,function(_0x39c196){return _0x39c196[_0x5d2f('0x101')](_0x5d2f('0x93'))==='Voice';}),function(_0x1f8ddd){return db[_0x5d2f('0xa6')][_0x5d2f('0x40')]({'where':{'VoiceQueueId':_0x1f8ddd['id'],'UserId':_0x4ee22c['id']},'transaction':_0x59ada9});});}else{return;}})[_0x5d2f('0x1e')](function(){for(var _0x370b62=0x0;_0x370b62<_0x474e6a[_0x5d2f('0x78')];_0x370b62++){var _0x5ce63d=_0x474e6a[_0x370b62][_0x5d2f('0x101')](_0x5d2f('0x93'));var _0x5b5efa=_0x5ce63d+_0x5d2f('0x9d');socket[_0x5d2f('0xa9')](_0x5d2f('0x36')+_0x5ce63d+_0x5d2f('0xaa'),{'UserId':_0x4ee22c['id'],['queueField']:_0x474e6a[_0x370b62]['id']});}});});});}});}})[_0x5d2f('0x1e')](respondWithStatusCode(_0x40bffc,null))[_0x5d2f('0x28')](handleError(_0x40bffc,null));};exports[_0x5d2f('0x106')]=function(_0x576066,_0x30f6f7,_0x548ca3){var _0x873996={};var _0x139642={};var _0x4f369b;var _0x34f19f;return db[_0x5d2f('0x43')][_0x5d2f('0xb6')]({'where':{'id':_0x576066[_0x5d2f('0x5d')]['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x30f6f7,null))[_0x5d2f('0x1e')](function(_0x5aa43d){if(_0x5aa43d){_0x4f369b=_0x5aa43d;_0x139642[_0x5d2f('0x45')]=_[_0x5d2f('0x4a')](db[_0x5d2f('0xb8')][_0x5d2f('0x44')]);_0x139642['query']=_[_0x5d2f('0x4a')](_0x576066[_0x5d2f('0x49')]);_0x139642[_0x5d2f('0x4b')]=_['intersection'](_0x139642[_0x5d2f('0x45')],_0x139642[_0x5d2f('0x49')]);_0x873996[_0x5d2f('0x4c')]=_[_0x5d2f('0x4d')](_0x139642[_0x5d2f('0x45')],qs[_0x5d2f('0x4e')](_0x576066[_0x5d2f('0x49')][_0x5d2f('0x4e')]));_0x873996[_0x5d2f('0x4c')]=_0x873996[_0x5d2f('0x4c')][_0x5d2f('0x78')]?_0x873996[_0x5d2f('0x4c')]:_0x139642[_0x5d2f('0x45')];_0x873996[_0x5d2f('0x51')]=qs['sort'](_0x576066[_0x5d2f('0x49')][_0x5d2f('0x52')]);_0x873996['where']=qs[_0x5d2f('0x4b')](_[_0x5d2f('0x54')](_0x576066[_0x5d2f('0x49')],_0x139642[_0x5d2f('0x4b')]));if(_0x576066[_0x5d2f('0x49')][_0x5d2f('0x39')]){_0x873996[_0x5d2f('0x53')]=_['merge'](_0x873996[_0x5d2f('0x53')],{'$or':_[_0x5d2f('0x3b')](_0x873996[_0x5d2f('0x4c')],function(_0x5ea163){var _0x5f420b={};_0x5f420b[_0x5ea163]={'$like':'%'+_0x576066[_0x5d2f('0x49')]['filter']+'%'};return _0x5f420b;})});}_0x873996=_['merge']({},_0x873996,_0x576066['options']);return _0x4f369b[_0x5d2f('0x106')](_0x873996);}})['then'](function(_0x4e5e19){if(_0x4e5e19){_0x34f19f=_0x4e5e19['length'];if(!_0x576066['query']['hasOwnProperty'](_0x5d2f('0x50'))){_0x873996[_0x5d2f('0x2f')]=qs['limit'](_0x576066[_0x5d2f('0x49')][_0x5d2f('0x2f')]);_0x873996['offset']=qs[_0x5d2f('0x2e')](_0x576066[_0x5d2f('0x49')][_0x5d2f('0x2e')]);}return _0x4f369b[_0x5d2f('0x106')](_0x873996);}})['then'](function(_0x457317){if(_0x457317){return _0x457317?{'count':_0x34f19f,'rows':_0x457317}:null;}})[_0x5d2f('0x1e')](respondWithResult(_0x30f6f7,null))[_0x5d2f('0x28')](handleError(_0x30f6f7,null));};exports[_0x5d2f('0x107')]=function(_0x100bcd,_0x1f45ef,_0x2f24dc){var _0x41b9f3={};var _0xe1ad54={};var _0x1f88b3;var _0x3e9ff9;return db[_0x5d2f('0x43')]['findOne']({'where':{'id':_0x100bcd[_0x5d2f('0x5d')]['id']}})[_0x5d2f('0x1e')](handleEntityNotFound(_0x1f45ef,null))['then'](function(_0xf15dcd){if(_0xf15dcd){_0x1f88b3=_0xf15dcd;_0xe1ad54[_0x5d2f('0x45')]=_[_0x5d2f('0x4a')](db[_0x5d2f('0x43')]['rawAttributes']);_0xe1ad54['query']=_['keys'](_0x100bcd[_0x5d2f('0x49')]);_0xe1ad54[_0x5d2f('0x4b')]=_[_0x5d2f('0x4d')](_0xe1ad54[_0x5d2f('0x45')],_0xe1ad54[_0x5d2f('0x49')]);_0x41b9f3['attributes']=_[_0x5d2f('0x4d')](_0xe1ad54[_0x5d2f('0x45')],qs[_0x5d2f('0x4e')](_0x100bcd[_0x5d2f('0x49')][_0x5d2f('0x4e')]));_0x41b9f3[_0x5d2f('0x4c')]=_0x41b9f3[_0x5d2f('0x4c')][_0x5d2f('0x78')]?_0x41b9f3[_0x5d2f('0x4c')]:_0xe1ad54[_0x5d2f('0x45')];_0x41b9f3[_0x5d2f('0x51')]=qs[_0x5d2f('0x52')](_0x100bcd[_0x5d2f('0x49')][_0x5d2f('0x52')]);_0x41b9f3[_0x5d2f('0x53')]=qs[_0x5d2f('0x4b')](_[_0x5d2f('0x54')](_0x100bcd['query'],_0xe1ad54['filters']));if(_0x100bcd[_0x5d2f('0x49')][_0x5d2f('0x39')]){_0x41b9f3[_0x5d2f('0x53')]=_[_0x5d2f('0x55')](_0x41b9f3[_0x5d2f('0x53')],{'$or':_[_0x5d2f('0x3b')](_0x41b9f3[_0x5d2f('0x4c')],function(_0x319b87){var _0x418ac5={};_0x418ac5[_0x319b87]={'$like':'%'+_0x100bcd[_0x5d2f('0x49')]['filter']+'%'};return _0x418ac5;})});}_0x41b9f3['model']=db[_0x5d2f('0x43')];_0x41b9f3['as']=_0x5d2f('0x37');_0x41b9f3=_[_0x5d2f('0x55')]({},_0x41b9f3,_0x100bcd[_0x5d2f('0x5a')]);return _0x1f88b3['getVoiceQueues']({'include':[_0x41b9f3]});}})[_0x5d2f('0x1e')](function(_0x4f2d6c){if(_0x4f2d6c){var _0x512605={},_0x3b90f1=[],_0x45549b=0x0;for(var _0x549856=0x0;_0x549856<_0x4f2d6c[_0x5d2f('0x78')];_0x549856+=0x1){for(var _0x16ccd8=0x0,_0xaefed4;_0x16ccd8<_0x4f2d6c[_0x549856][_0x5d2f('0x37')][_0x5d2f('0x78')];_0x16ccd8+=0x1){_0xaefed4=_0x4f2d6c[_0x549856][_0x5d2f('0x37')][_0x16ccd8][_0x5d2f('0x34')]({'plain':!![]});_0x512605[_0xaefed4['id']]=_0xaefed4;}}_0x512605=_[_0x5d2f('0x108')](_0x512605);for(var _0x118deb=qs[_0x5d2f('0x2e')](_0x100bcd[_0x5d2f('0x49')][_0x5d2f('0x2e')]);_0x118deb<_0x512605[_0x5d2f('0x78')]&&_0x3b90f1[_0x5d2f('0x78')]=_0x2eec36){_0x59ed30=_0x2eec36;_0x5671c2=0xc8;}else{_0x5671c2=0xce;}_0x44a7a0[_0xab90('0x2d')](_0x5671c2);return _0x44a7a0[_0xab90('0x32')]('Content-Range',_0x581cc6+'-'+_0x59ed30+'/'+_0x2eec36)[_0xab90('0x2e')](_0xe23096);}return null;};}function patchUpdates(_0x2b0073){return function(_0x3436db){try{jsonpatch['apply'](_0x3436db,_0x2b0073,!![]);}catch(_0x4ef77a){return BPromise[_0xab90('0x33')](_0x4ef77a);}return _0x3436db[_0xab90('0x34')]();};}function saveUpdates(_0x28c108,_0x3355f1){return function(_0x36098d){if(_0x36098d){return _0x36098d[_0xab90('0x35')](_0x28c108)[_0xab90('0x36')](function(_0x1523bf){return _0x1523bf;});}return null;};}function removeEntity(_0x359090,_0xc8f66){return function(_0x12f540){if(_0x12f540){return _0x12f540['destroy']()[_0xab90('0x36')](function(){var _0x1eb4d0=_0x12f540[_0xab90('0x37')]({'plain':!![]});var _0x39d841=[{'name':_0xab90('0x38'),'value':'user','ignore':!![]},{'name':_0xab90('0x39'),'value':_0xab90('0x3a'),'ignore':![]},{'name':_0xab90('0x3b'),'value':'telephone','ignore':![]}];var _0x24031c=_(_0x39d841)[_0xab90('0x3c')](_0xab90('0x3d'))[_0xab90('0x3e')](_0xab90('0x3f'))[_0xab90('0x3f')]();if(_['includes'](_0x24031c,_0x1eb4d0[_0xab90('0x40')])){return;}var _0x47e71b=_[_0xab90('0x41')](_0x39d841,[_0xab90('0x3f'),_0x1eb4d0['role']])[_0xab90('0x42')];return db['UserProfileResource'][_0xab90('0x43')]({'where':{'type':_0x47e71b,'resourceId':_0x1eb4d0['id']}})[_0xab90('0x36')](function(){return _0x12f540;});})[_0xab90('0x36')](function(){_0x359090[_0xab90('0x2d')](0xcc)[_0xab90('0x2c')]();});}};}function handleEntityNotFound(_0x5d0d26,_0x2aca74){return function(_0x4ddc10){if(!_0x4ddc10){_0x5d0d26[_0xab90('0x2b')](0x194);}return _0x4ddc10;};}function handleError(_0x1fadc9,_0x533f4c){_0x533f4c=_0x533f4c||0x1f4;return function(_0x14165e){logger[_0xab90('0x26')](_0x14165e[_0xab90('0x44')]);if(_0x14165e['name']){delete _0x14165e[_0xab90('0x42')];}_0x1fadc9[_0xab90('0x2d')](_0x533f4c)['send'](_0x14165e);};}exports['index']=function(_0xe573ca,_0x3ee976){var _0x61aeb={},_0x1c3328={},_0x3204ea={'count':0x0,'rows':[]};var _0x31972a=_[_0xab90('0x3e')](db['User'][_0xab90('0x45')],function(_0x5563eb){return{'name':_0x5563eb[_0xab90('0x46')],'type':_0x5563eb['type'][_0xab90('0x47')]};});_0x1c3328[_0xab90('0x48')]=_[_0xab90('0x49')](_[_0xab90('0x3e')](_0x31972a,_0xab90('0x42')),[_0xab90('0x4a'),_0xab90('0x4b')]);_0x1c3328[_0xab90('0x4c')]=_['keys'](_0xe573ca['query']);_0x1c3328['filters']=_['intersection'](_0x1c3328[_0xab90('0x48')],_0x1c3328['query']);_0x61aeb[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x1c3328[_0xab90('0x48')],qs[_0xab90('0x4f')](_0xe573ca[_0xab90('0x4c')]['fields']));_0x61aeb[_0xab90('0x4d')]=_0x61aeb['attributes'][_0xab90('0x50')]?_0x61aeb[_0xab90('0x4d')]:_0x1c3328['model'];if(!_0xe573ca[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x61aeb[_0xab90('0x31')]=qs[_0xab90('0x31')](_0xe573ca[_0xab90('0x4c')]['limit']);_0x61aeb[_0xab90('0x30')]=qs['offset'](_0xe573ca[_0xab90('0x4c')]['offset']);}_0x61aeb[_0xab90('0x53')]=qs['sort'](_0xe573ca[_0xab90('0x4c')]['sort']);_0x61aeb['where']=qs['filters'](_[_0xab90('0x54')](_0xe573ca[_0xab90('0x4c')],_0x1c3328[_0xab90('0x55')]));if(_0xe573ca[_0xab90('0x4c')][_0xab90('0x3c')]){_0x61aeb[_0xab90('0x56')]=_[_0xab90('0x57')](_0x61aeb[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x31972a,function(_0x4c416d){if(_0x4c416d[_0xab90('0x58')]!==_0xab90('0x59')){return db[_0xab90('0x5a')]['where'](db['sequelize']['fn'](_0xab90('0x5b'),db[_0xab90('0x5a')][_0xab90('0x5c')](_0x4c416d['name'])),{'$like':db[_0xab90('0x5a')]['fn'](_0xab90('0x5b'),'%'+_0xe573ca[_0xab90('0x4c')][_0xab90('0x3c')]+'%')});}})});}_0x61aeb=_[_0xab90('0x57')]({},_0x61aeb,_0xe573ca[_0xab90('0x5d')]);var _0x2b8858={'where':_0x61aeb['where']};return db[_0xab90('0x5e')][_0xab90('0x2f')](_0x2b8858)[_0xab90('0x36')](function(_0x39aca2){_0x3204ea[_0xab90('0x2f')]=_0x39aca2;if(_0xe573ca['query'][_0xab90('0x5f')]){_0x61aeb[_0xab90('0x60')]=[{'all':!![]}];}return db[_0xab90('0x5e')][_0xab90('0x61')](_0x61aeb);})[_0xab90('0x36')](function(_0x1cb7c7){_0x3204ea[_0xab90('0x62')]=_0x1cb7c7;return _0x3204ea;})[_0xab90('0x36')](respondWithFilteredResult(_0x3ee976,_0x61aeb))[_0xab90('0x2a')](handleError(_0x3ee976,null));};exports[_0xab90('0x63')]=function(_0x489c71,_0x206833){var _0x92afda={'raw':![],'where':{'id':_0x489c71['params']['id']}},_0x2b50e0={};_0x2b50e0[_0xab90('0x48')]=_[_0xab90('0x49')](_[_0xab90('0x64')](db[_0xab90('0x5e')][_0xab90('0x45')]),[_0xab90('0x4a'),'salt']);_0x2b50e0[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x489c71[_0xab90('0x4c')]);_0x2b50e0[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x2b50e0[_0xab90('0x48')],_0x2b50e0[_0xab90('0x4c')]);_0x92afda[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x2b50e0[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x489c71[_0xab90('0x4c')][_0xab90('0x4f')]));_0x92afda[_0xab90('0x4d')]=_0x92afda[_0xab90('0x4d')][_0xab90('0x50')]?_0x92afda[_0xab90('0x4d')]:_0x2b50e0[_0xab90('0x48')];if(_0x489c71[_0xab90('0x4c')][_0xab90('0x5f')]){_0x92afda[_0xab90('0x60')]=[{'all':!![]}];}_0x92afda=_[_0xab90('0x57')]({},_0x92afda,_0x489c71['options']);return db[_0xab90('0x5e')]['find'](_0x92afda)[_0xab90('0x36')](handleEntityNotFound(_0x206833,null))[_0xab90('0x36')](respondWithResult(_0x206833,null))['catch'](handleError(_0x206833,null));};exports[_0xab90('0x65')]=function(_0x490e1f,_0x3ce4b2){return db[_0xab90('0x5e')][_0xab90('0x65')](_0x490e1f['body'],{'raw':![],'individualHooks':!![]})[_0xab90('0x36')](respondWithResult(_0x3ce4b2,0xc9))[_0xab90('0x2a')](handleError(_0x3ce4b2,null));};exports[_0xab90('0x35')]=function(_0x2f1296,_0x5a6004){if(_0x2f1296[_0xab90('0x66')]['id']){delete _0x2f1296[_0xab90('0x66')]['id'];}delete _0x2f1296[_0xab90('0x66')][_0xab90('0x40')];return db[_0xab90('0x5e')]['find']({'where':{'id':_0x2f1296[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x5a6004,null))[_0xab90('0x36')](saveUpdates(_0x2f1296['body'],null))[_0xab90('0x36')](respondWithResult(_0x5a6004,null))['catch'](handleError(_0x5a6004,null));};exports[_0xab90('0x68')]=function(_0x332ea2,_0x3e698e){return db[_0xab90('0x5e')][_0xab90('0x68')]()[_0xab90('0x36')](respondWithResult(_0x3e698e,null))[_0xab90('0x2a')](handleError(_0x3e698e,null));};exports[_0xab90('0x69')]=function(_0xc7c44c,_0x4670d5,_0x1cad79){return db[_0xab90('0x5e')]['find']({'where':{'id':_0xc7c44c[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x4670d5,null))[_0xab90('0x36')](function(_0x17a454){if(_0x17a454){return _0x17a454['addContacts'](_0xc7c44c[_0xab90('0x66')]['ids'],_[_0xab90('0x6a')](_0xc7c44c[_0xab90('0x66')],[_0xab90('0x6b'),'id'])||{});}})[_0xab90('0x36')](respondWithResult(_0x4670d5,null))[_0xab90('0x2a')](handleError(_0x4670d5,null));};var getLicense=function(_0x41bb4a){return new BPromise(function(_0x2c8ab9,_0x3c121d){var _0x27fa8=0x0;_0x41bb4a['body'][_0xab90('0x40')]===_0xab90('0x3a')&&_0x2c8ab9(_0xab90('0x6c'));return db['User'][_0xab90('0x2f')]({'where':{'$or':[{'role':_0x41bb4a[_0xab90('0x66')][_0xab90('0x40')]==='telephone'?_0xab90('0x6d'):[_0xab90('0x6e'),'user']}]}})[_0xab90('0x36')](function(_0x4fd9e0){_0x27fa8=_0x4fd9e0;return require(_0xab90('0x6f'))[_0xab90('0x70')]();})[_0xab90('0x36')](function(_0x15517e){var _0x5b28e6=_0x41bb4a['body'][_0xab90('0x40')]===_0xab90('0x6d')?'telephones':_0xab90('0x71');if(!_[_0xab90('0x72')](_0x15517e[_0x5b28e6])&&_0x27fa8>=_0x15517e[_0x5b28e6]){return _0x3c121d({'message':_0xab90('0x73')});}return _0x2c8ab9(util['format'](_0xab90('0x74'),_0x5b28e6,_0x27fa8));})[_0xab90('0x2a')](function(_0x2c93a9){return _0x3c121d(_0x2c93a9);});});};exports['create']=function(_0x576302,_0x5dc558){return getLicense(_0x576302)[_0xab90('0x36')](function(_0x4da0b0){if(!_0x576302[_0xab90('0x66')][_0xab90('0x75')]){var _0xf69b2c;return db[_0xab90('0x76')][_0xab90('0x77')](0x1)['then'](function(_0x2a07ab){return checkPasswordPattern(_0x2a07ab,_0x576302['body'][_0xab90('0x4a')],_0x2a07ab[_0xab90('0x78')]);})['then'](function(_0x598928){_0xf69b2c=_0x598928[_0xab90('0x79')];return db[_0xab90('0x5e')][_0xab90('0x7a')](_0xab90('0x75'));})[_0xab90('0x36')](function(_0x4d9810){if(_[_0xab90('0x72')](_0x4d9810)){if(_0xf69b2c){_0x576302['body']['internal']=_0xf69b2c;}else{_0x576302[_0xab90('0x66')][_0xab90('0x75')]=0x1;}}else{if(_['isNil'](_0xf69b2c)||_0xf69b2c==_0x4d9810){_0x576302[_0xab90('0x66')][_0xab90('0x75')]=_0x4d9810+0x1;}else if(_0xf69b2c>_0x4d9810){_0x576302['body']['internal']=_0xf69b2c;}else{return db[_0xab90('0x5a')][_0xab90('0x4c')](_0xab90('0x7b'),{'type':db['sequelize'][_0xab90('0x7c')]['SELECT']})[_0xab90('0x36')](function(_0x83c8bc){if(_0x83c8bc&&_0x83c8bc[_0xab90('0x50')]){for(var _0x282ca7=0x0,_0x2f9bbb=_0x83c8bc[_0xab90('0x50')];_0x282ca7<_0x2f9bbb&&_['isNil'](_0x576302[_0xab90('0x66')][_0xab90('0x75')]);_0x282ca7++){if(_0xf69b2c<=_0x83c8bc[_0x282ca7][_0xab90('0x7d')]){_0x576302['body'][_0xab90('0x75')]=_0x83c8bc[_0x282ca7][_0xab90('0x7d')];}else if(_0xf69b2c>_0x83c8bc[_0x282ca7][_0xab90('0x7d')]&&_0xf69b2c<=_0x83c8bc[_0x282ca7]['to']){_0x576302[_0xab90('0x66')][_0xab90('0x75')]=_0xf69b2c;}}}if(_[_0xab90('0x72')](_0x576302[_0xab90('0x66')][_0xab90('0x75')])){_0x576302['body'][_0xab90('0x75')]=_0x4d9810+0x1;}});}}});}})['then'](function(){if(_0x576302['body'][_0xab90('0x7e')]){_0x576302[_0xab90('0x66')]['mailbox']=_0x576302[_0xab90('0x66')][_0xab90('0x75')];_0x576302[_0xab90('0x66')]['VoiceMail']={'mailbox':_0x576302['body'][_0xab90('0x75')],'password':_0x576302[_0xab90('0x66')][_0xab90('0x4a')],'fullname':_0x576302[_0xab90('0x66')][_0xab90('0x7f')],'email':_0x576302[_0xab90('0x66')][_0xab90('0x80')]};}if(_0x576302[_0xab90('0x66')]&&_0x576302[_0xab90('0x66')][_0xab90('0x40')]===_0xab90('0x3a')){_0x576302[_0xab90('0x66')][_0xab90('0x81')]=[_0xab90('0x82'),'102',_0xab90('0x83'),_0xab90('0x84'),'104','105',_0xab90('0x85'),_0xab90('0x86'),_0xab90('0x87'),_0xab90('0x88'),_0xab90('0x89'),'111'];}return db[_0xab90('0x5e')]['create'](_0x576302['body'],{'include':[{'model':db[_0xab90('0x8a')],'as':_0xab90('0x8a')}]});})[_0xab90('0x36')](function(_0x974f04){if(_0x576302['body'][_0xab90('0x40')]===_0xab90('0x8b'))return _0x974f04;var _0x7ebc2c=_0x576302[_0xab90('0x8b')]['get']({'plain':!![]});if(!_0x7ebc2c)throw new Error(_0xab90('0x8c'));if(_0x7ebc2c[_0xab90('0x40')]===_0xab90('0x8b')){var _0x1c9c28=_0x974f04[_0xab90('0x37')]({'plain':!![]});var _0x5ce3d4=[{'name':_0xab90('0x39'),'value':_0xab90('0x3a')},{'name':_0xab90('0x3b'),'value':'telephone'}];var _0x855f51=_['find'](_0x5ce3d4,[_0xab90('0x3f'),_0x1c9c28[_0xab90('0x40')]])[_0xab90('0x42')];return db[_0xab90('0x8d')][_0xab90('0x41')]({'where':{'name':_0x855f51,'userProfileId':_0x7ebc2c[_0xab90('0x8e')]},'raw':!![]})[_0xab90('0x36')](function(_0x4e664c){if(_0x4e664c&&_0x4e664c[_0xab90('0x8f')]===0x0){return db['UserProfileResource']['create']({'name':_0x1c9c28[_0xab90('0x42')],'resourceId':_0x1c9c28['id'],'type':_0x4e664c[_0xab90('0x42')],'sectionId':_0x4e664c['id']},{})[_0xab90('0x36')](function(){return _0x974f04;});}else{return _0x974f04;}})[_0xab90('0x2a')](function(_0xe79335){logger[_0xab90('0x26')](_0xab90('0x90'),_0xe79335);throw _0xe79335;});}return _0x974f04;})[_0xab90('0x36')](respondWithResult(_0x5dc558,0xc9))['catch'](handleError(_0x5dc558,null));};exports[_0xab90('0x91')]=function(_0x191b57,_0x22c06f,_0x58feb1){var _0x3820be=![];if(_0x191b57[_0xab90('0x66')]['id']){delete _0x191b57['body']['id'];}return db[_0xab90('0x76')][_0xab90('0x92')]({'attributes':['id',_0xab90('0x78')]})[_0xab90('0x36')](function(_0x576de0){_0x3820be=_0x576de0['securePassword'];return db['User'][_0xab90('0x41')]({'where':{'id':_0x191b57['params']['id']}});})[_0xab90('0x36')](function(_0x364df5){if(_0x364df5){if(_0x364df5['id']==_0x191b57[_0xab90('0x8b')]['id']){if(!_0x191b57[_0xab90('0x66')][_0xab90('0x93')]||!_0x191b57['body'][_0xab90('0x94')]){throw new db[(_0xab90('0x1e'))]['ValidationError'](_0xab90('0x95'));}if(!_0x364df5[_0xab90('0x96')](_0x191b57['body'][_0xab90('0x93')])){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))](_0xab90('0x97'));}if(_0x191b57[_0xab90('0x66')][_0xab90('0x93')]==_0x191b57[_0xab90('0x66')]['newPassword']){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x364df5;}else if(_0x191b57[_0xab90('0x8b')][_0xab90('0x40')]==_0xab90('0x6e')){if(!_0x191b57['body'][_0xab90('0x94')]){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))](_0xab90('0x98'));}return _0x364df5;}else if(_0x191b57['user']['role']=='user'){if(!_0x191b57[_0xab90('0x66')]['newPassword']){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))](_0xab90('0x98'));}if(_0x364df5[_0xab90('0x40')]!='agent'){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))](_0xab90('0x99'));}return _0x364df5;}else{throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))]('Unauthorized');}}return null;})[_0xab90('0x36')](handleEntityNotFound(_0x22c06f,null))[_0xab90('0x36')](function(_0x58d33d){return checkPasswordPattern(_0x58d33d,_0x191b57['body'][_0xab90('0x94')],_0x3820be);})[_0xab90('0x36')](saveUpdates({'password':_0x191b57[_0xab90('0x66')][_0xab90('0x94')],'passwordResetAt':_0x191b57[_0xab90('0x8b')]['id']==_0x191b57['params']['id']?moment():null},null))[_0xab90('0x36')](respondWithResult(_0x22c06f,null))['catch'](handleError(_0x22c06f,null));};exports[_0xab90('0x9a')]=function(_0x474efc,_0x53534f,_0xd02da0){var _0x4d6c9=_0x474efc[_0xab90('0x66')][_0xab90('0x9b')];return db['User'][_0xab90('0x41')]({'where':{'id':_0x474efc[_0xab90('0x67')]['id']},'attributes':['id',_0xab90('0x42'),_0xab90('0x40'),_0xab90('0x9c'),'loginInPause',_0xab90('0x9d'),_0xab90('0x9e')]})[_0xab90('0x36')](handleEntityNotFound(_0x53534f,null))[_0xab90('0x36')](function(_0x18628c){if(_0x18628c){if(!utils[_0xab90('0x9f')](_0x4d6c9)){throw new db[(_0xab90('0x1e'))]['ValidationError']('Unknown\x20channel');}return _0x18628c[_0xab90('0xa0')+_[_0xab90('0xa1')](_0x4d6c9['toLowerCase']())+_0xab90('0xa2')](_0x474efc['body']['ids'],{'penalty':_0x474efc[_0xab90('0x66')]['penalty']||0x0})[_0xab90('0xa3')](function(_0x3197b2){for(var _0x5a1cc5=0x0;_0x5a1cc5<_0x474efc['body'][_0xab90('0x6b')][_0xab90('0x50')];_0x5a1cc5+=0x1){var _0x2d88ef={'UserId':_0x474efc[_0xab90('0x67')]['id']};_0x2d88ef[_[_0xab90('0xa1')](_0x4d6c9[_0xab90('0xa4')]())+'QueueId']=_0x474efc[_0xab90('0x66')]['ids'][_0x5a1cc5];socket[_0xab90('0xa5')]('user'+_['capitalize'](_0x4d6c9[_0xab90('0xa4')]())+_0xab90('0xa6'),_0x2d88ef);}return _0x3197b2;})[_0xab90('0x36')](function(){if(_0x4d6c9===_0xab90('0xa7')){return db[_0xab90('0xa8')][_0xab90('0x61')]({'where':{'id':_0x474efc['body'][_0xab90('0x6b')]||[]},'raw':!![],'attributes':['id',_0xab90('0x42')]});}})['then'](function(_0x153cce){var _0x1f7e7d=_0x18628c[_0xab90('0x37')]({'plain':!![]});var _0x4241bd=[];if(_0x4d6c9===_0xab90('0xa7')&&_0x1f7e7d['role']===_0xab90('0x3a')&&_0x1f7e7d[_0xab90('0x9c')]){for(var _0x4c8746=0x0;_0x4c8746<_0x153cce[_0xab90('0x50')];_0x4c8746+=0x1){_0x4241bd[_0xab90('0xa9')]({'membername':_0x1f7e7d[_0xab90('0x42')],'UserId':_0x1f7e7d['id'],'queue_name':_0x153cce[_0x4c8746][_0xab90('0x42')],'VoiceQueueId':_0x153cce[_0x4c8746]['id'],'interface':_[_0xab90('0x72')](_0x1f7e7d[_0xab90('0x9e')])?util['format']('SIP/%s',_0x1f7e7d['name']):_0x1f7e7d[_0xab90('0x9e')],'paused':_0x1f7e7d[_0xab90('0x9d')]||![],'penalty':_0x474efc[_0xab90('0x66')][_0xab90('0xaa')]||0x0});}return BPromise[_0xab90('0xab')](_0x4241bd,function(_0x48aaa0){return db[_0xab90('0xac')]['upsert'](_0x48aaa0);});}return _0x18628c;});}})[_0xab90('0x36')](respondWithStatusCode(_0x53534f,null))[_0xab90('0x2a')](handleError(_0x53534f,null));};exports[_0xab90('0xad')]=function(_0x325b09,_0x327793,_0x3e4312){var _0x5afb8e;return db[_0xab90('0x5e')][_0xab90('0x41')]({'where':{'id':_0x325b09['params']['id']},'attributes':['id',_0xab90('0x42'),_0xab90('0x40')]})[_0xab90('0x36')](handleEntityNotFound(_0x327793,null))[_0xab90('0x36')](function(_0x494424){if(_0x494424){_0x5afb8e=_0x494424;if(!_0x325b09[_0xab90('0x4c')]['channel']||!utils['isValidChannel'](_0x325b09[_0xab90('0x4c')][_0xab90('0x9b')])){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))](_0xab90('0xae'));}return _0x494424[_0xab90('0xaf')+_[_0xab90('0xa1')](_0x325b09[_0xab90('0x4c')]['channel'][_0xab90('0xa4')]())+_0xab90('0xa2')](_0x325b09[_0xab90('0x4c')][_0xab90('0x6b')]);}})[_0xab90('0x36')](function(_0x138b6c){for(var _0x18f8c2=0x0;_0x18f8c2<_0x325b09[_0xab90('0x4c')][_0xab90('0x6b')][_0xab90('0x50')];_0x18f8c2+=0x1){var _0x2788e6={'UserId':_0x325b09[_0xab90('0x67')]['id']};_0x2788e6[_[_0xab90('0xa1')](_0x325b09[_0xab90('0x4c')][_0xab90('0x9b')]['toLowerCase']())+_0xab90('0xb0')]=_0x325b09['query'][_0xab90('0x6b')][_0x18f8c2];socket['emit'](_0xab90('0x8b')+_[_0xab90('0xa1')](_0x325b09[_0xab90('0x4c')][_0xab90('0x9b')][_0xab90('0xa4')]())+'Queue:remove',_0x2788e6);}return _0x138b6c;})[_0xab90('0x36')](function(){if(_0x325b09[_0xab90('0x4c')][_0xab90('0x9b')]===_0xab90('0xa7')){return db[_0xab90('0xac')][_0xab90('0x43')]({'where':{'UserId':_0x325b09[_0xab90('0x67')]['id'],'VoiceQueueId':_0x325b09[_0xab90('0x4c')][_0xab90('0x6b')]},'individualHooks':!![]})[_0xab90('0x36')](function(){return _0x5afb8e;});}return _0x5afb8e;})[_0xab90('0x36')](respondWithStatusCode(_0x327793,null))[_0xab90('0x2a')](handleError(_0x327793,null));};exports[_0xab90('0xb1')]=function(_0x1e43fa,_0x1c5249,_0x464200){_0x1e43fa[_0xab90('0x66')][_0xab90('0xb2')]=_0x1e43fa['file'][_0xab90('0xb3')];return db[_0xab90('0x5e')][_0xab90('0x41')]({'where':{'id':_0x1e43fa[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x1c5249,null))[_0xab90('0x36')](saveUpdates(_0x1e43fa['body'],null))[_0xab90('0x36')](respondWithResult(_0x1c5249,null))['catch'](handleError(_0x1c5249,null));};exports[_0xab90('0xb4')]=function(_0x107a07,_0x595227,_0x3aa94b){var _0xce71c=path[_0xab90('0xb5')](config[_0xab90('0xb6')],_0xab90('0xb7'));return db[_0xab90('0x5e')][_0xab90('0x41')]({'where':{'id':_0x107a07[_0xab90('0x67')]['id']},'attributes':['id',_0xab90('0xb2')],'raw':!![]})[_0xab90('0x36')](handleEntityNotFound(_0x595227,null))['then'](function(_0x6d93a){if(_0x6d93a){if(_['isNil'](_0x6d93a[_0xab90('0xb2')])){return _0x595227[_0xab90('0xb8')](_0xce71c);}else{if(!fs[_0xab90('0xb9')](path[_0xab90('0xb5')](config[_0xab90('0xb6')],_0xab90('0xba'),_0x6d93a[_0xab90('0xb2')]))){return _0x595227[_0xab90('0xb8')](_0xce71c);}return _0x595227[_0xab90('0xb8')](path[_0xab90('0xb5')](config[_0xab90('0xb6')],_0xab90('0xba'),_0x6d93a[_0xab90('0xb2')]));}}})['catch'](handleError(_0x595227,null));};exports['getContacts']=function(_0x66ef14,_0x400245,_0x21a74f){var _0x1120a3={};var _0x1c487f={};var _0xa30b0c;var _0x233c29;return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x66ef14[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x400245,null))[_0xab90('0x36')](function(_0x1319c4){if(_0x1319c4){_0xa30b0c=_0x1319c4;_0x1c487f[_0xab90('0x48')]=_[_0xab90('0x64')](db[_0xab90('0xbb')][_0xab90('0x45')]);_0x1c487f[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x66ef14[_0xab90('0x4c')]);_0x1c487f[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x1c487f[_0xab90('0x48')],_0x1c487f['query']);_0x1120a3[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x1c487f[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x66ef14['query'][_0xab90('0x4f')]));_0x1120a3[_0xab90('0x4d')]=_0x1120a3[_0xab90('0x4d')][_0xab90('0x50')]?_0x1120a3['attributes']:_0x1c487f['model'];_0x1120a3[_0xab90('0x53')]=qs['sort'](_0x66ef14[_0xab90('0x4c')][_0xab90('0xbc')]);_0x1120a3[_0xab90('0x56')]=qs[_0xab90('0x55')](_['pick'](_0x66ef14[_0xab90('0x4c')],_0x1c487f[_0xab90('0x55')]));if(_0x66ef14[_0xab90('0x4c')]['filter']){_0x1120a3[_0xab90('0x56')]=_[_0xab90('0x57')](_0x1120a3[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x1120a3['attributes'],function(_0x4f5dcc){var _0x59a57f={};_0x59a57f[_0x4f5dcc]={'$like':'%'+_0x66ef14['query'][_0xab90('0x3c')]+'%'};return _0x59a57f;})});}_0x1120a3=_[_0xab90('0x57')]({},_0x1120a3,_0x66ef14[_0xab90('0x5d')]);return _0xa30b0c[_0xab90('0xbd')](_0x1120a3);}})[_0xab90('0x36')](function(_0x2290fb){if(_0x2290fb){_0x233c29=_0x2290fb[_0xab90('0x50')];if(_0x66ef14['query'][_0xab90('0x51')](_0xab90('0x5f'))){_0x1120a3[_0xab90('0x60')]=[{'model':db[_0xab90('0xbe')],'as':'List','required':![]},{'model':db[_0xab90('0xbf')],'as':_0xab90('0xc0'),'attributes':['id',_0xab90('0x42'),_0xab90('0xc1')],'where':_0x66ef14['query'][_0xab90('0xc2')]?{'id':_0x66ef14['query']['tag']}:undefined,'required':_0x66ef14[_0xab90('0x4c')]['tag']?!![]:![]}];}if(!_0x66ef14[_0xab90('0x4c')][_0xab90('0x51')]('nolimit')){_0x1120a3[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x66ef14[_0xab90('0x4c')][_0xab90('0x31')]);_0x1120a3[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x66ef14[_0xab90('0x4c')]['offset']);}return _0xa30b0c[_0xab90('0xbd')](_0x1120a3);}})[_0xab90('0x36')](function(_0x3d083b){if(_0x3d083b){return _0x3d083b?{'count':_0x233c29,'rows':_0x3d083b}:null;}})[_0xab90('0x36')](respondWithResult(_0x400245,null))[_0xab90('0x2a')](handleError(_0x400245,null));};exports[_0xab90('0xc3')]=function(_0x5e8666,_0x36ecb5,_0x14f534){var _0x3054d5;var _0x231440;var _0x157c1f={};var _0x2d3af3;return db['User'][_0xab90('0x92')]({'where':{'id':_0x5e8666[_0xab90('0x67')]['id']},'attributes':['id',_0xab90('0x42'),_0xab90('0x40')]})[_0xab90('0x36')](handleEntityNotFound(_0x36ecb5,null))[_0xab90('0x36')](function(_0x7a642e){if(!utils['isValidChannel'](_0x5e8666['query'][_0xab90('0x9b')])){throw new db['Sequelize'][(_0xab90('0x1f'))](_0xab90('0xae'));}_0x3054d5=_0x7a642e;var _0x2ed1ac={};_0x2ed1ac[_0xab90('0x48')]=_[_0xab90('0x64')](db[_[_0xab90('0xa1')](_0x5e8666[_0xab90('0x4c')][_0xab90('0x9b')])+_0xab90('0xc4')][_0xab90('0x45')]);_0x2ed1ac[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x5e8666[_0xab90('0x4c')]);_0x2ed1ac['filters']=_[_0xab90('0x4e')](_0x2ed1ac[_0xab90('0x48')],_0x2ed1ac[_0xab90('0x4c')]);_0x157c1f[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x2ed1ac[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x5e8666['query'][_0xab90('0x4f')]));_0x157c1f[_0xab90('0x4d')]=_0x157c1f['attributes'][_0xab90('0x50')]?_0x157c1f['attributes']:_0x2ed1ac[_0xab90('0x48')];_0x157c1f[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x5e8666['query'][_0xab90('0xbc')]);_0x157c1f[_0xab90('0x56')]=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x5e8666[_0xab90('0x4c')],_0x2ed1ac[_0xab90('0x55')]));if(_0x5e8666[_0xab90('0x4c')]['filter']){_0x157c1f[_0xab90('0x56')]=_[_0xab90('0x57')](_0x157c1f[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x157c1f['attributes'],function(_0x465beb){var _0x205a94={};_0x205a94[_0x465beb]={'$like':'%'+_0x5e8666[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x205a94;})});}_0x157c1f=_[_0xab90('0x57')]({},_0x157c1f,_0x5e8666[_0xab90('0x5d')]);switch(_0x3054d5[_0xab90('0x40')]){case _0xab90('0x6e'):return db[_['capitalize'](_0x5e8666[_0xab90('0x4c')][_0xab90('0x9b')])+'Queue'][_0xab90('0x61')](_0x157c1f);case _0xab90('0x8b'):case _0xab90('0x3a'):return _0x3054d5[_0xab90('0x37')+_[_0xab90('0xa1')](_0x5e8666[_0xab90('0x4c')][_0xab90('0x9b')])+_0xab90('0xa2')](_0x157c1f);default:throw new db[(_0xab90('0x1e'))]['ValidationError'](_0xab90('0xc5'));}})[_0xab90('0x36')](function(_0x54e5c6){_0x2d3af3=_0x54e5c6[_0xab90('0x50')];if(!_0x5e8666['query'][_0xab90('0x51')](_0xab90('0x52'))){_0x157c1f[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x5e8666[_0xab90('0x4c')][_0xab90('0x31')]);_0x157c1f[_0xab90('0x30')]=qs['offset'](_0x5e8666['query'][_0xab90('0x30')]);}switch(_0x3054d5[_0xab90('0x40')]){case'admin':return db[_[_0xab90('0xa1')](_0x5e8666[_0xab90('0x4c')]['channel'])+'Queue'][_0xab90('0x61')](_0x157c1f);case _0xab90('0x8b'):case _0xab90('0x3a'):return _0x3054d5['get'+_[_0xab90('0xa1')](_0x5e8666['query'][_0xab90('0x9b')])+'Queues'](_0x157c1f);}})['then'](function(_0x49ffbe){return{'count':_0x2d3af3,'rows':_0x49ffbe};})[_0xab90('0x36')](respondWithResult(_0x36ecb5,null))['catch'](handleError(_0x36ecb5,null));};exports[_0xab90('0xc6')]=function(_0x4acec0,_0x264d55,_0x447793){var _0x4db3a7={};var _0x10ab69={};var _0x414db7;var _0x15a8f3;return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x4acec0[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x264d55,null))[_0xab90('0x36')](function(_0x951bce){if(_0x951bce){_0x414db7=_0x951bce;_0x10ab69[_0xab90('0x48')]=_['keys'](db[_0xab90('0xac')]['rawAttributes']);_0x10ab69[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x4acec0[_0xab90('0x4c')]);_0x10ab69[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x10ab69[_0xab90('0x48')],_0x10ab69['query']);_0x4db3a7[_0xab90('0x4d')]=_['intersection'](_0x10ab69[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x4acec0[_0xab90('0x4c')]['fields']));_0x4db3a7['attributes']=_0x4db3a7['attributes'][_0xab90('0x50')]?_0x4db3a7[_0xab90('0x4d')]:_0x10ab69[_0xab90('0x48')];_0x4db3a7[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x4acec0[_0xab90('0x4c')][_0xab90('0xbc')]);_0x4db3a7[_0xab90('0x56')]=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x4acec0['query'],_0x10ab69[_0xab90('0x55')]));if(_0x4acec0[_0xab90('0x4c')][_0xab90('0x3c')]){_0x4db3a7['where']=_['merge'](_0x4db3a7['where'],{'$or':_['map'](_0x4db3a7[_0xab90('0x4d')],function(_0x4b3b25){var _0x34454e={};_0x34454e[_0x4b3b25]={'$like':'%'+_0x4acec0[_0xab90('0x4c')]['filter']+'%'};return _0x34454e;})});}_0x4db3a7=_['merge']({},_0x4db3a7,_0x4acec0[_0xab90('0x5d')]);return _0x414db7[_0xab90('0xc6')](_0x4db3a7);}})[_0xab90('0x36')](function(_0x173a5d){if(_0x173a5d){_0x15a8f3=_0x173a5d['length'];if(!_0x4acec0[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x4db3a7['limit']=qs[_0xab90('0x31')](_0x4acec0['query'][_0xab90('0x31')]);_0x4db3a7[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x4acec0[_0xab90('0x4c')]['offset']);}return _0x414db7[_0xab90('0xc6')](_0x4db3a7);}})[_0xab90('0x36')](function(_0x5b7066){if(_0x5b7066){return _0x5b7066?{'count':_0x15a8f3,'rows':_0x5b7066}:null;}})['then'](respondWithResult(_0x264d55,null))[_0xab90('0x2a')](handleError(_0x264d55,null));};exports['getGroups']=function(_0x8bd8cc,_0x290031,_0x3ab5a7){var _0x278fe9={};var _0x428589={};var _0x1fecce;var _0x3034bf;return db['User']['findOne']({'where':{'id':_0x8bd8cc[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x290031,null))['then'](function(_0x3d9852){if(_0x3d9852){_0x1fecce=_0x3d9852;_0x428589[_0xab90('0x48')]=_[_0xab90('0x64')](db['ChatGroup'][_0xab90('0x45')]);_0x428589[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x8bd8cc[_0xab90('0x4c')]);_0x428589[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x428589[_0xab90('0x48')],_0x428589[_0xab90('0x4c')]);_0x278fe9[_0xab90('0x4d')]=_['intersection'](_0x428589[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x8bd8cc['query'][_0xab90('0x4f')]));_0x278fe9[_0xab90('0x4d')]=_0x278fe9[_0xab90('0x4d')][_0xab90('0x50')]?_0x278fe9[_0xab90('0x4d')]:_0x428589[_0xab90('0x48')];_0x278fe9[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x8bd8cc['query'][_0xab90('0xbc')]);_0x278fe9['where']=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x8bd8cc[_0xab90('0x4c')],_0x428589[_0xab90('0x55')]));if(_0x8bd8cc['query'][_0xab90('0x3c')]){_0x278fe9['where']=_[_0xab90('0x57')](_0x278fe9[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x278fe9[_0xab90('0x4d')],function(_0x22b632){var _0x247a22={};_0x247a22[_0x22b632]={'$like':'%'+_0x8bd8cc[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x247a22;})});}_0x278fe9=_[_0xab90('0x57')]({},_0x278fe9,_0x8bd8cc['options']);return _0x1fecce['getGroups'](_0x278fe9);}})[_0xab90('0x36')](function(_0x1e71c5){if(_0x1e71c5){_0x3034bf=_0x1e71c5[_0xab90('0x50')];if(!_0x8bd8cc['query'][_0xab90('0x51')]('nolimit')){_0x278fe9[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x8bd8cc[_0xab90('0x4c')]['limit']);_0x278fe9[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x8bd8cc[_0xab90('0x4c')][_0xab90('0x30')]);}return _0x1fecce['getGroups'](_0x278fe9);}})['then'](function(_0x26db77){if(_0x26db77){return _0x26db77?{'count':_0x3034bf,'rows':_0x26db77}:null;}})['then'](respondWithResult(_0x290031,null))[_0xab90('0x2a')](handleError(_0x290031,null));};exports[_0xab90('0xc7')]=function(_0x43b503,_0x5805c5,_0x31f746){var _0x2856ac={'raw':!![],'where':{}};var _0x47a003={};var _0x39538a={'count':0x0,'rows':[]};return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x43b503['params']['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x5805c5,null))[_0xab90('0x36')](function(_0x25618a){if(_0x25618a){_0x47a003[_0xab90('0x48')]=_[_0xab90('0x64')](db[_0xab90('0xc8')][_0xab90('0x45')]);_0x47a003[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x43b503[_0xab90('0x4c')]);_0x47a003[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x47a003[_0xab90('0x48')],_0x47a003['query']);_0x2856ac[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x47a003['model'],qs[_0xab90('0x4f')](_0x43b503[_0xab90('0x4c')][_0xab90('0x4f')]));_0x2856ac[_0xab90('0x4d')]=_0x2856ac['attributes'][_0xab90('0x50')]?_0x2856ac['attributes']:_0x47a003[_0xab90('0x48')];if(!_0x43b503[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x2856ac[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x43b503[_0xab90('0x4c')][_0xab90('0x31')]);_0x2856ac[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x43b503[_0xab90('0x4c')]['offset']);}_0x2856ac[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x43b503['query']['sort']);_0x2856ac[_0xab90('0x56')]=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x43b503[_0xab90('0x4c')],_0x47a003[_0xab90('0x55')]));_0x2856ac[_0xab90('0x56')]['UserId']=_0x25618a['id'];if(_0x43b503[_0xab90('0x4c')][_0xab90('0x3c')]){_0x2856ac['where']=_[_0xab90('0x57')](_0x2856ac[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x2856ac[_0xab90('0x4d')],function(_0x16d18e){var _0x4b5ab5={};_0x4b5ab5[_0x16d18e]={'$like':'%'+_0x43b503['query'][_0xab90('0x3c')]+'%'};return _0x4b5ab5;})});}_0x2856ac=_[_0xab90('0x57')]({},_0x2856ac,_0x43b503[_0xab90('0x5d')]);return db['VoiceRecording'][_0xab90('0x2f')]({'where':_0x2856ac[_0xab90('0x56')]})[_0xab90('0x36')](function(_0x3c59ad){_0x39538a[_0xab90('0x2f')]=_0x3c59ad;if(_0x43b503[_0xab90('0x4c')][_0xab90('0x5f')]){_0x2856ac['include']=[{'all':!![]}];}return db[_0xab90('0xc8')][_0xab90('0x61')](_0x2856ac);})['then'](function(_0x148058){_0x39538a[_0xab90('0x62')]=_0x148058;return _0x39538a;});}})[_0xab90('0x36')](respondWithFilteredResult(_0x5805c5,_0x2856ac))[_0xab90('0x2a')](handleError(_0x5805c5,null));};exports[_0xab90('0xc9')]=function(_0x53a165,_0x5c84ec,_0x42d08b){var _0x464409={'raw':!![],'where':{}};var _0x506dbf={};var _0x347889={'count':0x0,'rows':[]};return db[_0xab90('0x5e')]['findOne']({'where':{'id':_0x53a165['params']['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x5c84ec,null))[_0xab90('0x36')](function(_0x388097){if(_0x388097){_0x506dbf[_0xab90('0x48')]=_['keys'](db['ScreenRecording'][_0xab90('0x45')]);_0x506dbf[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x53a165[_0xab90('0x4c')]);_0x506dbf['filters']=_[_0xab90('0x4e')](_0x506dbf[_0xab90('0x48')],_0x506dbf[_0xab90('0x4c')]);_0x464409[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x506dbf['model'],qs[_0xab90('0x4f')](_0x53a165[_0xab90('0x4c')][_0xab90('0x4f')]));_0x464409['attributes']=_0x464409[_0xab90('0x4d')][_0xab90('0x50')]?_0x464409[_0xab90('0x4d')]:_0x506dbf[_0xab90('0x48')];if(!_0x53a165[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x464409['limit']=qs[_0xab90('0x31')](_0x53a165[_0xab90('0x4c')][_0xab90('0x31')]);_0x464409[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x53a165['query'][_0xab90('0x30')]);}_0x464409[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x53a165['query'][_0xab90('0xbc')]);_0x464409[_0xab90('0x56')]=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x53a165[_0xab90('0x4c')],_0x506dbf['filters']));_0x464409[_0xab90('0x56')][_0xab90('0xca')]=_0x388097['id'];if(_0x53a165['query'][_0xab90('0x3c')]){_0x464409[_0xab90('0x56')]=_[_0xab90('0x57')](_0x464409[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x464409[_0xab90('0x4d')],function(_0x3ae9f4){var _0x4fe9a5={};_0x4fe9a5[_0x3ae9f4]={'$like':'%'+_0x53a165['query'][_0xab90('0x3c')]+'%'};return _0x4fe9a5;})});}_0x464409=_[_0xab90('0x57')]({},_0x464409,_0x53a165['options']);return db[_0xab90('0xcb')][_0xab90('0x2f')]({'where':_0x464409['where']})['then'](function(_0x3627bc){_0x347889[_0xab90('0x2f')]=_0x3627bc;if(_0x53a165[_0xab90('0x4c')]['includeAll']){_0x464409[_0xab90('0x60')]=[{'all':!![]}];}return db[_0xab90('0xcb')]['findAll'](_0x464409);})['then'](function(_0x5e3d24){_0x347889['rows']=_0x5e3d24;return _0x347889;});}})[_0xab90('0x36')](respondWithFilteredResult(_0x5c84ec,_0x464409))[_0xab90('0x2a')](handleError(_0x5c84ec,null));};exports[_0xab90('0xcc')]=function(_0x456ef0,_0x3fdf2f,_0x47f963){var _0x49411f={};var _0x182fc1={};var _0x31bf5e;var _0x5d8b1c;return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x456ef0[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x3fdf2f,null))[_0xab90('0x36')](function(_0x1b18b5){if(_0x1b18b5){_0x31bf5e=_0x1b18b5;_0x182fc1[_0xab90('0x48')]=_['keys'](db[_0xab90('0xcd')][_0xab90('0x45')]);_0x182fc1['query']=_[_0xab90('0x64')](_0x456ef0[_0xab90('0x4c')]);_0x182fc1[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x182fc1[_0xab90('0x48')],_0x182fc1['query']);_0x49411f['attributes']=_[_0xab90('0x4e')](_0x182fc1[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x456ef0['query'][_0xab90('0x4f')]));_0x49411f[_0xab90('0x4d')]=_0x49411f[_0xab90('0x4d')][_0xab90('0x50')]?_0x49411f[_0xab90('0x4d')]:_0x182fc1[_0xab90('0x48')];_0x49411f['order']=qs[_0xab90('0xbc')](_0x456ef0[_0xab90('0x4c')]['sort']);_0x49411f[_0xab90('0x56')]=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x456ef0[_0xab90('0x4c')],_0x182fc1[_0xab90('0x55')]));if(_0x456ef0[_0xab90('0x4c')][_0xab90('0x3c')]){_0x49411f[_0xab90('0x56')]=_['merge'](_0x49411f[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x49411f[_0xab90('0x4d')],function(_0x5944fd){var _0x4c2a58={};_0x4c2a58[_0x5944fd]={'$like':'%'+_0x456ef0[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x4c2a58;})});}_0x49411f=_[_0xab90('0x57')]({},_0x49411f,_0x456ef0[_0xab90('0x5d')]);return _0x31bf5e[_0xab90('0xcc')](_0x49411f);}})['then'](function(_0x299e5b){if(_0x299e5b){_0x5d8b1c=_0x299e5b[_0xab90('0x50')];if(!_0x456ef0[_0xab90('0x4c')]['hasOwnProperty'](_0xab90('0x52'))){_0x49411f[_0xab90('0x31')]=qs['limit'](_0x456ef0['query'][_0xab90('0x31')]);_0x49411f['offset']=qs[_0xab90('0x30')](_0x456ef0['query'][_0xab90('0x30')]);}return _0x31bf5e[_0xab90('0xcc')](_0x49411f);}})['then'](function(_0x218545){if(_0x218545){return _0x218545?{'count':_0x5d8b1c,'rows':_0x218545}:null;}})[_0xab90('0x36')](respondWithResult(_0x3fdf2f,null))['catch'](handleError(_0x3fdf2f,null));};exports['getOpenchannelInteractions']=function(_0x17b45b,_0x188848,_0xb769d0){var _0x5eb91b={};var _0x449d45={};var _0x35f1b9;var _0x30ce55;return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x17b45b[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x188848,null))[_0xab90('0x36')](function(_0x528df9){if(_0x528df9){_0x35f1b9=_0x528df9;_0x449d45['model']=_[_0xab90('0x64')](db['OpenchannelInteraction'][_0xab90('0x45')]);_0x449d45[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x17b45b[_0xab90('0x4c')]);_0x449d45['filters']=_[_0xab90('0x4e')](_0x449d45[_0xab90('0x48')],_0x449d45[_0xab90('0x4c')]);_0x5eb91b[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x449d45[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x17b45b[_0xab90('0x4c')][_0xab90('0x4f')]));_0x5eb91b['attributes']=_0x5eb91b[_0xab90('0x4d')]['length']?_0x5eb91b[_0xab90('0x4d')]:_0x449d45['model'];_0x5eb91b[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x17b45b[_0xab90('0x4c')][_0xab90('0xbc')]);_0x5eb91b['where']=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x17b45b[_0xab90('0x4c')],_0x449d45[_0xab90('0x55')]));if(_0x17b45b[_0xab90('0x4c')][_0xab90('0x3c')]){_0x5eb91b['where']=_[_0xab90('0x57')](_0x5eb91b[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x5eb91b[_0xab90('0x4d')],function(_0x8d15ef){var _0x3dfbd4={};_0x3dfbd4[_0x8d15ef]={'$like':'%'+_0x17b45b[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x3dfbd4;})});}_0x5eb91b=_[_0xab90('0x57')]({},_0x5eb91b,_0x17b45b[_0xab90('0x5d')]);return _0x35f1b9[_0xab90('0xce')](_0x5eb91b);}})[_0xab90('0x36')](function(_0x448995){if(_0x448995){_0x30ce55=_0x448995[_0xab90('0x50')];if(!_0x17b45b[_0xab90('0x4c')]['hasOwnProperty'](_0xab90('0x52'))){_0x5eb91b['limit']=qs[_0xab90('0x31')](_0x17b45b[_0xab90('0x4c')][_0xab90('0x31')]);_0x5eb91b[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x17b45b[_0xab90('0x4c')][_0xab90('0x30')]);}return _0x35f1b9[_0xab90('0xce')](_0x5eb91b);}})[_0xab90('0x36')](function(_0x2dcb76){if(_0x2dcb76){return _0x2dcb76?{'count':_0x30ce55,'rows':_0x2dcb76}:null;}})[_0xab90('0x36')](respondWithResult(_0x188848,null))[_0xab90('0x2a')](handleError(_0x188848,null));};exports[_0xab90('0xcf')]=function(_0x149317,_0x2008b0,_0x2d474d){var _0x2a1faa={'raw':!![],'where':{}};var _0x2e5e1d={};var _0x388c7a={'count':0x0,'rows':[]};return db[_0xab90('0x5e')]['findOne']({'where':{'id':_0x149317[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x2008b0,null))[_0xab90('0x36')](function(_0x96a625){if(_0x96a625){_0x2e5e1d[_0xab90('0x48')]=_[_0xab90('0x64')](db['MailInteraction'][_0xab90('0x45')]);_0x2e5e1d[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x149317[_0xab90('0x4c')]);_0x2e5e1d['filters']=_['intersection'](_0x2e5e1d[_0xab90('0x48')],_0x2e5e1d[_0xab90('0x4c')]);_0x2a1faa[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x2e5e1d[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x149317['query']['fields']));_0x2a1faa['attributes']=_0x2a1faa['attributes'][_0xab90('0x50')]?_0x2a1faa[_0xab90('0x4d')]:_0x2e5e1d[_0xab90('0x48')];if(!_0x149317[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x2a1faa[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x149317[_0xab90('0x4c')][_0xab90('0x31')]);_0x2a1faa[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x149317[_0xab90('0x4c')][_0xab90('0x30')]);}_0x2a1faa[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x149317[_0xab90('0x4c')][_0xab90('0xbc')]);_0x2a1faa[_0xab90('0x56')]=qs['filters'](_[_0xab90('0x54')](_0x149317[_0xab90('0x4c')],_0x2e5e1d[_0xab90('0x55')]));_0x2a1faa['where'][_0xab90('0xca')]=_0x96a625['id'];if(_0x149317['query'][_0xab90('0x3c')]){_0x2a1faa[_0xab90('0x56')]=_[_0xab90('0x57')](_0x2a1faa[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x2a1faa['attributes'],function(_0x121f7b){var _0x15b12e={};_0x15b12e[_0x121f7b]={'$like':'%'+_0x149317[_0xab90('0x4c')]['filter']+'%'};return _0x15b12e;})});}_0x2a1faa=_[_0xab90('0x57')]({},_0x2a1faa,_0x149317[_0xab90('0x5d')]);return db[_0xab90('0xd0')][_0xab90('0x2f')]({'where':_0x2a1faa[_0xab90('0x56')]})['then'](function(_0x137ccc){_0x388c7a['count']=_0x137ccc;if(_0x149317[_0xab90('0x4c')][_0xab90('0x5f')]){_0x2a1faa[_0xab90('0x60')]=[{'all':!![]}];}return db[_0xab90('0xd0')]['findAll'](_0x2a1faa);})['then'](function(_0x501e56){_0x388c7a['rows']=_0x501e56;return _0x388c7a;});}})[_0xab90('0x36')](respondWithFilteredResult(_0x2008b0,_0x2a1faa))[_0xab90('0x2a')](handleError(_0x2008b0,null));};exports['getSmsInteractions']=function(_0x2f3017,_0xa311c3,_0x55d721){var _0x347bd2={};var _0x3b1336={};var _0x1d010b;var _0x4e475c;return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x2f3017[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0xa311c3,null))[_0xab90('0x36')](function(_0x561d4e){if(_0x561d4e){_0x1d010b=_0x561d4e;_0x3b1336[_0xab90('0x48')]=_['keys'](db[_0xab90('0xd1')][_0xab90('0x45')]);_0x3b1336[_0xab90('0x4c')]=_['keys'](_0x2f3017[_0xab90('0x4c')]);_0x3b1336[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x3b1336[_0xab90('0x48')],_0x3b1336['query']);_0x347bd2[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x3b1336[_0xab90('0x48')],qs['fields'](_0x2f3017['query'][_0xab90('0x4f')]));_0x347bd2[_0xab90('0x4d')]=_0x347bd2[_0xab90('0x4d')][_0xab90('0x50')]?_0x347bd2[_0xab90('0x4d')]:_0x3b1336[_0xab90('0x48')];_0x347bd2[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x2f3017[_0xab90('0x4c')][_0xab90('0xbc')]);_0x347bd2['where']=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x2f3017['query'],_0x3b1336['filters']));if(_0x2f3017[_0xab90('0x4c')][_0xab90('0x3c')]){_0x347bd2[_0xab90('0x56')]=_[_0xab90('0x57')](_0x347bd2[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x347bd2[_0xab90('0x4d')],function(_0x180203){var _0x2bb960={};_0x2bb960[_0x180203]={'$like':'%'+_0x2f3017[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x2bb960;})});}_0x347bd2=_[_0xab90('0x57')]({},_0x347bd2,_0x2f3017['options']);return _0x1d010b[_0xab90('0xd2')](_0x347bd2);}})[_0xab90('0x36')](function(_0xb5acee){if(_0xb5acee){_0x4e475c=_0xb5acee[_0xab90('0x50')];if(!_0x2f3017[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x347bd2['limit']=qs[_0xab90('0x31')](_0x2f3017['query'][_0xab90('0x31')]);_0x347bd2['offset']=qs[_0xab90('0x30')](_0x2f3017[_0xab90('0x4c')][_0xab90('0x30')]);}return _0x1d010b['getSmsInteractions'](_0x347bd2);}})[_0xab90('0x36')](function(_0x3cde16){if(_0x3cde16){return _0x3cde16?{'count':_0x4e475c,'rows':_0x3cde16}:null;}})['then'](respondWithResult(_0xa311c3,null))[_0xab90('0x2a')](handleError(_0xa311c3,null));};exports[_0xab90('0xd3')]=function(_0x1e5a22,_0x263046,_0x4d883a){var _0x583cfb={};var _0x32f5e5={};var _0x534b9d;var _0x1d86a6;return db['User']['findOne']({'where':{'id':_0x1e5a22['params']['id']}})['then'](handleEntityNotFound(_0x263046,null))[_0xab90('0x36')](function(_0x4733e9){if(_0x4733e9){_0x534b9d=_0x4733e9;_0x32f5e5[_0xab90('0x48')]=_[_0xab90('0x64')](db['FaxInteraction']['rawAttributes']);_0x32f5e5[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x1e5a22[_0xab90('0x4c')]);_0x32f5e5['filters']=_[_0xab90('0x4e')](_0x32f5e5[_0xab90('0x48')],_0x32f5e5[_0xab90('0x4c')]);_0x583cfb[_0xab90('0x4d')]=_['intersection'](_0x32f5e5['model'],qs['fields'](_0x1e5a22[_0xab90('0x4c')][_0xab90('0x4f')]));_0x583cfb[_0xab90('0x4d')]=_0x583cfb[_0xab90('0x4d')][_0xab90('0x50')]?_0x583cfb[_0xab90('0x4d')]:_0x32f5e5['model'];_0x583cfb['order']=qs[_0xab90('0xbc')](_0x1e5a22[_0xab90('0x4c')][_0xab90('0xbc')]);_0x583cfb[_0xab90('0x56')]=qs[_0xab90('0x55')](_['pick'](_0x1e5a22[_0xab90('0x4c')],_0x32f5e5[_0xab90('0x55')]));if(_0x1e5a22[_0xab90('0x4c')][_0xab90('0x3c')]){_0x583cfb[_0xab90('0x56')]=_[_0xab90('0x57')](_0x583cfb[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x583cfb['attributes'],function(_0x7cefc3){var _0x4c88fd={};_0x4c88fd[_0x7cefc3]={'$like':'%'+_0x1e5a22['query'][_0xab90('0x3c')]+'%'};return _0x4c88fd;})});}_0x583cfb=_[_0xab90('0x57')]({},_0x583cfb,_0x1e5a22[_0xab90('0x5d')]);return _0x534b9d[_0xab90('0xd3')](_0x583cfb);}})[_0xab90('0x36')](function(_0x51afec){if(_0x51afec){_0x1d86a6=_0x51afec[_0xab90('0x50')];if(!_0x1e5a22['query'][_0xab90('0x51')](_0xab90('0x52'))){_0x583cfb[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x1e5a22[_0xab90('0x4c')][_0xab90('0x31')]);_0x583cfb[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x1e5a22[_0xab90('0x4c')][_0xab90('0x30')]);}return _0x534b9d[_0xab90('0xd3')](_0x583cfb);}})[_0xab90('0x36')](function(_0x19bc89){if(_0x19bc89){return _0x19bc89?{'count':_0x1d86a6,'rows':_0x19bc89}:null;}})[_0xab90('0x36')](respondWithResult(_0x263046,null))['catch'](handleError(_0x263046,null));};exports[_0xab90('0xd4')]=function(_0x47d0c1,_0x52839b,_0x2a7f2d){var _0x471faf;var _0x595378;var _0x4e9d54;var _0x54cda9=!_[_0xab90('0x72')](_0x47d0c1[_0xab90('0x67')]['id'])?_0x47d0c1[_0xab90('0x67')]['id']:!_[_0xab90('0x72')](_0x47d0c1[_0xab90('0x8b')]['id'])?_0x47d0c1[_0xab90('0x8b')]['id']:null;return db['User'][_0xab90('0x41')]({'where':{'id':_0x54cda9,'role':{'$or':[_0xab90('0x6e'),_0xab90('0x8b'),_0xab90('0x3a')]}},'attributes':['id',_0xab90('0x42'),_0xab90('0xd5'),_0xab90('0xd6'),'role',_0xab90('0x75'),_0xab90('0xd7')]})[_0xab90('0x36')](function(_0x25900a){if(_0x25900a){if(_0x25900a[_0xab90('0x40')]===_0xab90('0x3a')){_0x471faf=_0x25900a;if(_0x47d0c1[_0xab90('0x66')]['interface']){_0x4e9d54=util[_0xab90('0xd8')](_0xab90('0xd9'),_0x471faf[_0x47d0c1[_0xab90('0x66')][_0xab90('0x9e')]]);}else if(_0x47d0c1[_0xab90('0x66')]['intrf']){_0x4e9d54=util[_0xab90('0xd8')](_0xab90('0xda'),_0x47d0c1['body'][_0xab90('0xdb')]);}else{_0x4e9d54=util['format'](_0xab90('0xda'),_0x471faf[_0xab90('0x42')]);}socket['to'](util[_0xab90('0xd8')]('user:%s',_0x471faf[_0xab90('0x42')]))[_0xab90('0xa5')](_0xab90('0xdc'),{'ip':_0x47d0c1[_0xab90('0xdd')][_0xab90('0xde')]||_0x47d0c1[_0xab90('0xdf')][_0xab90('0xe0')]||_0x47d0c1[_0xab90('0xe1')][_0xab90('0xe0')]||_0x47d0c1[_0xab90('0xdf')][_0xab90('0xe1')][_0xab90('0xe0')]});return db[_0xab90('0xac')][_0xab90('0x43')]({'where':{'membername':_0x471faf[_0xab90('0x42')]},'individualHooks':!![]});}}else{throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0xab90('0x36')](function(){if(_0x471faf){return _0x471faf[_0xab90('0xe2')]({'raw':!![]});}})[_0xab90('0x36')](function(_0x19986b){if(_0x471faf){var _0x5ee9d3=[];if(_0x19986b){_0x595378=_0x19986b;if(_0x595378[_0xab90('0x50')]){for(var _0x4db1c4=0x0;_0x4db1c4<_0x595378[_0xab90('0x50')];_0x4db1c4++){_0x5ee9d3[_0xab90('0xa9')]({'membername':_0x471faf[_0xab90('0x42')],'UserId':_0x471faf['id'],'queue_name':_0x595378[_0x4db1c4][_0xab90('0x42')],'VoiceQueueId':_0x595378[_0x4db1c4]['id'],'interface':_0x4e9d54,'paused':_0x471faf['loginInPause']||![],'penalty':_0x595378[_0x4db1c4][_0xab90('0xe3')]||0x0});}return BPromise[_0xab90('0xab')](_0x5ee9d3,function(_0x5e6f57){return db['UserVoiceQueueRt']['upsert'](_0x5e6f57);});}}}})['then'](function(){if(_0x471faf){return db[_0xab90('0xe4')][_0xab90('0x61')]({'where':{'membername':_0x471faf[_0xab90('0x42')],'exitAt':null}});}})[_0xab90('0x36')](function(_0x5409ae){if(_0x471faf){var _0xa1b98e=[];_0x5409ae[_0xab90('0xe5')](function(_0x1b1b27){_0xa1b98e[_0xab90('0xa9')](_0x1b1b27[_0xab90('0x35')]({'exitAt':moment()[_0xab90('0xd8')](_0xab90('0xe6'))}));});return BPromise[_0xab90('0xe7')](_0xa1b98e);}})['then'](function(){if(_0x471faf){var _0xc5cb3f=[];var _0x5428ca=[];var _0x18dcbf=utils[_0xab90('0xe8')]();var _0x5c8bdb={'membername':_0x471faf[_0xab90('0x42')],'interface':_0x4e9d54,'enterAt':moment()[_0xab90('0xd8')](_0xab90('0xe6')),'role':_0x471faf[_0xab90('0x40')],'internal':_0x471faf[_0xab90('0x75')]};_0x18dcbf[_0xab90('0xe5')](function(_0x2b016b){_0xc5cb3f[_0xab90('0xa9')](_['merge']({'channel':_0x2b016b,'type':_0xab90('0xe9'),'data1':_0x47d0c1[_0xab90('0x66')]['device'],'data2':_0x4e9d54},_0x5c8bdb));if(_0x471faf[_0xab90('0xd7')]){_0x5428ca[_0xab90('0xa9')](_['merge']({'channel':_0x2b016b,'type':'PAUSE','data1':'LOGININPAUSE'},_0x5c8bdb));}});return db['MemberReport'][_0xab90('0x65')](_0xc5cb3f['concat'](_0x5428ca),{'individualHooks':!![]});}})[_0xab90('0x36')](function(){if(_0x471faf){return _0x471faf[_0xab90('0x35')]({'online':!![],'lastLoginAt':moment()[_0xab90('0xd8')](_0xab90('0xe6')),'voicePause':_0x471faf[_0xab90('0xd7')]||![],'mailPause':_0x471faf[_0xab90('0xd7')]||![],'chatPause':_0x471faf['loginInPause']||![],'faxPause':_0x471faf['loginInPause']||![],'smsPause':_0x471faf[_0xab90('0xd7')]||![],'openchannelPause':_0x471faf['loginInPause']||![],'pauseType':_0x471faf[_0xab90('0xd7')]?_0xab90('0xea'):null,'interface':_0x4e9d54,'lastPauseAt':moment()[_0xab90('0xd8')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xab90('0x36')](function(_0xe07e30){if(_0x47d0c1[_0xab90('0xeb')]){return _0x2a7f2d();}else{return BPromise[_0xab90('0xec')](_0xe07e30)[_0xab90('0x36')](respondWithResult(_0x52839b,null));}})[_0xab90('0x2a')](handleError(_0x52839b,null));};exports[_0xab90('0xed')]=function(_0x35e6c7,_0x578f99,_0x2dfbc6){var _0x854f4d;return db['User']['find']({'where':{'id':_0x35e6c7[_0xab90('0x67')]['id'],'role':_0xab90('0x3a')},'attributes':['id',_0xab90('0x42'),_0xab90('0x40')]})[_0xab90('0x36')](handleEntityNotFound(_0x578f99,null))[_0xab90('0x36')](function(_0x4e6e03){if(_0x4e6e03){_0x854f4d=_0x4e6e03;return db[_0xab90('0xac')][_0xab90('0x43')]({'where':{'membername':_0x854f4d[_0xab90('0x42')]},'individualHooks':!![]});}})['then'](function(){return db[_0xab90('0xe4')][_0xab90('0x61')]({'where':{'membername':_0x854f4d['name'],'exitAt':null}});})[_0xab90('0x36')](function(_0x481236){var _0x13d714=[];_0x481236[_0xab90('0xe5')](function(_0x15a28c){_0x13d714[_0xab90('0xa9')](_0x15a28c[_0xab90('0x35')]({'exitAt':moment()[_0xab90('0xd8')](_0xab90('0xe6'))}));});return BPromise['all'](_0x13d714);})[_0xab90('0x36')](function(){return _0x854f4d[_0xab90('0x35')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0xab90('0x36')](respondWithResult(_0x578f99,null))[_0xab90('0x2a')](handleError(_0x578f99,null));};exports[_0xab90('0xee')]=function(_0x67a985,_0x125bf6,_0x487e56){var _0x1e19bc;return db['UserVoiceQueueRt']['update']({'paused':0x1},{'where':{'UserId':_0x67a985['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0xab90('0x5e')][_0xab90('0x41')]({'where':{'id':_0x67a985[_0xab90('0x67')]['id'],'role':'agent'},'attributes':['id',_0xab90('0x42'),_0xab90('0x40'),_0xab90('0x75'),_0xab90('0x9e')]});})[_0xab90('0x36')](handleEntityNotFound(_0x125bf6,null))[_0xab90('0x36')](function(_0x3519ff){if(_0x3519ff){_0x1e19bc=_0x3519ff;return respondWithRpcPromise(_0xab90('0xef'),_0xab90('0xee'),{'id':_0x1e19bc['id'],'name':_0x1e19bc[_0xab90('0x42')],'pause':!![]});}})[_0xab90('0x36')](function(){if(_0x1e19bc){return db['MemberReport'][_0xab90('0x61')]({'where':{'membername':_0x1e19bc[_0xab90('0x42')],'type':_0xab90('0xf0'),'exitAt':null}});}})[_0xab90('0x36')](function(_0x2235c4){if(_0x2235c4[_0xab90('0x50')]){var _0xbfc981=moment()[_0xab90('0xd8')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x1d9e0d=0x0,_0x1e14c5=_0x2235c4['length'];_0x1d9e0d<_0x1e14c5;_0x1d9e0d++){_0x2235c4[_0x1d9e0d][_0xab90('0xf1')]({'exitAt':_0xbfc981});}}})['then'](function(){var _0x563ce4=[];var _0x1b00a8=utils['getChannels']();_0x1b00a8[_0xab90('0xe5')](function(_0x11cf16){_0x563ce4['push']({'channel':_0x11cf16,'membername':_0x1e19bc['name'],'interface':_['isNil'](_0x1e19bc[_0xab90('0x9e')])?util[_0xab90('0xd8')](_0xab90('0xda'),_0x1e19bc['name']):_0x1e19bc[_0xab90('0x9e')],'type':_0xab90('0xf0'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x67a985[_0xab90('0x66')][_0xab90('0x58')]||'DEFAULT\x20PAUSE','role':_0x1e19bc['role'],'internal':_0x1e19bc[_0xab90('0x75')]});});return db[_0xab90('0xe4')][_0xab90('0x65')](_0x563ce4,{'individualHooks':!![]});})[_0xab90('0x36')](function(){return _0x1e19bc[_0xab90('0x35')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x67a985[_0xab90('0x66')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xab90('0x36')](respondWithResult(_0x125bf6,null))[_0xab90('0x2a')](handleError(_0x125bf6,null));};exports[_0xab90('0xf2')]=function(_0x3857eb,_0x4365d2,_0x1fde70){var _0x11e4d5;return db[_0xab90('0x5e')]['find']({'where':{'id':_0x3857eb[_0xab90('0x67')]['id']},'attributes':['id','name','role','voicePause',_0xab90('0xf3'),_0xab90('0xf4'),_0xab90('0xf5'),_0xab90('0xf6'),_0xab90('0xf7'),_0xab90('0xf8'),_0xab90('0xf9')]})['then'](handleEntityNotFound(_0x4365d2,null))['then'](function(_0x51293b){if(_0x51293b){_0x11e4d5=_0x51293b;if(_0x3857eb[_0xab90('0x66')]['channel']&&!utils[_0xab90('0x9f')](_0x3857eb['body']['channel'])){throw new db[(_0xab90('0x1e'))][(_0xab90('0x1f'))](_0xab90('0xae'));}switch(_0x3857eb[_0xab90('0x66')][_0xab90('0x9b')]){case _0xab90('0xa7'):return respondWithRpcPromise(_0xab90('0xef'),_0xab90('0xf2'),{'id':_0x11e4d5['id'],'name':_0x11e4d5[_0xab90('0x42')],'pause':![]})['then'](function(){return db[_0xab90('0xac')][_0xab90('0x35')]({'paused':0x0},{'where':{'UserId':_0x11e4d5['id']},'individualHooks':!![]});})[_0xab90('0x36')](function(){return db[_0xab90('0xe4')][_0xab90('0x41')]({'where':{'channel':_0x3857eb[_0xab90('0x66')][_0xab90('0x9b')],'membername':_0x11e4d5['name'],'type':_0xab90('0xf0'),'exitAt':null}});})[_0xab90('0x36')](function(_0x4d32c3){if(_0x4d32c3){return _0x4d32c3[_0xab90('0x35')]({'exitAt':moment()[_0xab90('0xd8')](_0xab90('0xe6')),'data2':_0xab90('0xfa')},{'individualHooks':!![]});}return null;})[_0xab90('0x36')](function(){return _0x11e4d5[_0xab90('0x35')]({'voicePause':![]});});case _0xab90('0xfb'):case _0xab90('0xfc'):case _0xab90('0xfd'):case _0xab90('0xfe'):case'openchannel':return db[_0xab90('0xe4')][_0xab90('0x41')]({'where':{'channel':_0x3857eb[_0xab90('0x66')]['channel'],'membername':_0x11e4d5[_0xab90('0x42')],'type':_0xab90('0xf0'),'exitAt':null}})[_0xab90('0x36')](function(_0x4a829d){if(_0x4a829d){return _0x4a829d['update']({'exitAt':moment()[_0xab90('0xd8')](_0xab90('0xe6')),'data2':_0xab90('0xfa')},{'individualHooks':!![]});}return null;})[_0xab90('0x36')](function(){var _0x2ff207={};_[_0xab90('0x32')](_0x2ff207,util[_0xab90('0xd8')]('%s%s',_0x3857eb[_0xab90('0x66')]['channel'],_0xab90('0xff')),![]);return _0x11e4d5['update'](_0x2ff207);});default:return respondWithRpcPromise('QueuePause',_0xab90('0xf2'),{'id':_0x11e4d5['id'],'name':_0x11e4d5[_0xab90('0x42')],'pause':![]})[_0xab90('0x36')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x11e4d5['id']}});})[_0xab90('0x36')](function(){return db[_0xab90('0xe4')][_0xab90('0x61')]({'where':{'membername':_0x11e4d5['name'],'type':'PAUSE','exitAt':null}});})[_0xab90('0x36')](function(_0x28e5f4){var _0x9ad82e=[];_0x28e5f4[_0xab90('0xe5')](function(_0x28cca8){_0x9ad82e[_0xab90('0xa9')](_0x28cca8[_0xab90('0x35')]({'exitAt':moment()[_0xab90('0xd8')](_0xab90('0xe6')),'data2':'manual'}));});return BPromise[_0xab90('0xe7')](_0x9ad82e);})[_0xab90('0x36')](function(){return _0x11e4d5['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x4365d2,null))['catch'](handleError(_0x4365d2,null));};exports[_0xab90('0x100')]=function(_0x1cc744,_0x5e641f,_0x295e61){var _0x380085={};var _0x277bfa={};var _0x5f1d4a;var _0x2cebfc;return db[_0xab90('0x5e')][_0xab90('0x92')]({'where':{'id':_0x1cc744['params']['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x5e641f,null))[_0xab90('0x36')](function(_0x7933f8){if(_0x7933f8){_0x5f1d4a=_0x7933f8;_0x277bfa['model']=_[_0xab90('0x64')](db[_0xab90('0x101')][_0xab90('0x45')]);_0x277bfa[_0xab90('0x4c')]=_['keys'](_0x1cc744['query']);_0x277bfa[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x277bfa[_0xab90('0x48')],_0x277bfa[_0xab90('0x4c')]);_0x380085[_0xab90('0x4d')]=_[_0xab90('0x4e')](_0x277bfa[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x1cc744[_0xab90('0x4c')][_0xab90('0x4f')]));_0x380085['attributes']=_0x380085['attributes'][_0xab90('0x50')]?_0x380085[_0xab90('0x4d')]:_0x277bfa['model'];_0x380085[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x1cc744['query'][_0xab90('0xbc')]);_0x380085[_0xab90('0x56')]=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x1cc744['query'],_0x277bfa[_0xab90('0x55')]));if(_0x1cc744[_0xab90('0x4c')][_0xab90('0x3c')]){_0x380085['where']=_['merge'](_0x380085['where'],{'$or':_[_0xab90('0x3e')](_0x380085[_0xab90('0x4d')],function(_0x55bcc5){var _0x497046={};_0x497046[_0x55bcc5]={'$like':'%'+_0x1cc744[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x497046;})});}_0x380085=_[_0xab90('0x57')]({},_0x380085,_0x1cc744[_0xab90('0x5d')]);return _0x5f1d4a[_0xab90('0x100')](_0x380085);}})[_0xab90('0x36')](function(_0x3f407f){if(_0x3f407f){_0x2cebfc=_0x3f407f[_0xab90('0x50')];if(!_0x1cc744[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x380085[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x1cc744['query'][_0xab90('0x31')]);_0x380085[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x1cc744['query'][_0xab90('0x30')]);}return _0x5f1d4a['getTeams'](_0x380085);}})[_0xab90('0x36')](function(_0xf735af){if(_0xf735af){return _0xf735af?{'count':_0x2cebfc,'rows':_0xf735af}:null;}})[_0xab90('0x36')](respondWithResult(_0x5e641f,null))[_0xab90('0x2a')](handleError(_0x5e641f,null));};exports[_0xab90('0x102')]=function(_0x4b634c,_0x3ec8ba){return db[_0xab90('0x5e')][_0xab90('0x41')]({'where':{'id':_0x4b634c['params']['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x3ec8ba,null))[_0xab90('0x36')](function(_0x3b6207){if(_0x3b6207){var _0x225a28=_0x3b6207['get']({'plain':!![]});return _0x3b6207[_0xab90('0x102')](_0x4b634c[_0xab90('0x66')][_0xab90('0x6b')],_[_0xab90('0x6a')](_0x4b634c['body'],[_0xab90('0x6b'),'id'])||{})['then'](function(){for(var _0x59e9be=0x0;_0x59e9be<_0x4b634c['body'][_0xab90('0x6b')][_0xab90('0x50')];_0x59e9be++){var _0x21d65d=[];db[_0xab90('0x101')]['findOne']({'where':{'id':_0x4b634c[_0xab90('0x66')][_0xab90('0x6b')][_0x59e9be]}})[_0xab90('0x36')](function(_0x20ad39){_0x21d65d[_0xab90('0xa9')](_0x20ad39['getVoiceQueues']()[_0xab90('0x36')](function(_0x4d5d47){for(var _0x3fecc2=0x0;_0x3fecc2<_0x4d5d47['length'];_0x3fecc2++){_0x4d5d47[_0x3fecc2]['setDataValue'](_0xab90('0x9b'),_0xab90('0x103'));}return _0x4d5d47;}));_0x21d65d[_0xab90('0xa9')](_0x20ad39['getChatQueues']()[_0xab90('0x36')](function(_0x443411){for(var _0x440c8f=0x0;_0x440c8f<_0x443411['length'];_0x440c8f++){_0x443411[_0x440c8f][_0xab90('0x104')]('channel','Chat');}return _0x443411;}));_0x21d65d[_0xab90('0xa9')](_0x20ad39[_0xab90('0x105')]()['then'](function(_0x1b94b2){for(var _0x10110e=0x0;_0x10110e<_0x1b94b2['length'];_0x10110e++){_0x1b94b2[_0x10110e][_0xab90('0x104')]('channel',_0xab90('0x106'));}return _0x1b94b2;}));_0x21d65d[_0xab90('0xa9')](_0x20ad39[_0xab90('0x107')]()[_0xab90('0x36')](function(_0x453d21){for(var _0x4fecf5=0x0;_0x4fecf5<_0x453d21['length'];_0x4fecf5++){_0x453d21[_0x4fecf5]['setDataValue'](_0xab90('0x9b'),_0xab90('0x108'));}return _0x453d21;}));_0x21d65d['push'](_0x20ad39['getFaxQueues']()[_0xab90('0x36')](function(_0x35fc21){for(var _0x3179e8=0x0;_0x3179e8<_0x35fc21['length'];_0x3179e8++){_0x35fc21[_0x3179e8][_0xab90('0x104')](_0xab90('0x9b'),_0xab90('0x109'));}return _0x35fc21;}));_0x21d65d['push'](_0x20ad39[_0xab90('0x10a')]()[_0xab90('0x36')](function(_0x390692){for(var _0x1331d4=0x0;_0x1331d4<_0x390692[_0xab90('0x50')];_0x1331d4++){_0x390692[_0x1331d4][_0xab90('0x104')]('channel',_0xab90('0x10b'));}return _0x390692;}));return BPromise[_0xab90('0xe7')](_0x21d65d);})[_0xab90('0x36')](function(_0x34b0c2){var _0x48891c=_[_0xab90('0x10c')](_0x34b0c2);_0x21d65d=[];return db[_0xab90('0x5a')][_0xab90('0x10d')](function(_0x42eb20){for(var _0x2668df=0x0;_0x2668df<_0x48891c['length'];_0x2668df++){_0x21d65d[_0xab90('0xa9')](_0x48891c[_0x2668df]['addAgent'](_0x225a28['id']),{'transaction':_0x42eb20});}return BPromise[_0xab90('0xe7')](_0x21d65d)[_0xab90('0x36')](function(){if(_0x225a28[_0xab90('0x9c')]){return BPromise[_0xab90('0xab')](_[_0xab90('0x3c')](_0x48891c,function(_0x4c1c9c){return _0x4c1c9c[_0xab90('0x10e')]('channel')===_0xab90('0x103');}),function(_0xeb434f){return db[_0xab90('0xac')]['upsert']({'membername':_0x225a28[_0xab90('0x42')],'UserId':_0x225a28['id'],'queue_name':_0xeb434f[_0xab90('0x42')],'VoiceQueueId':_0xeb434f['id'],'interface':_[_0xab90('0x72')](_0x225a28['interface'])?util[_0xab90('0xd8')](_0xab90('0xda'),_0x225a28[_0xab90('0x42')]):_0x225a28[_0xab90('0x9e')],'paused':_0x225a28[_0xab90('0x9d')]||![],'penalty':_0x225a28[_0xab90('0xaa')]},{'transaction':_0x42eb20});});}else{return;}})[_0xab90('0x36')](function(){for(var _0x346b41=0x0;_0x346b41<_0x48891c[_0xab90('0x50')];_0x346b41++){var _0x1b5ba7=_0x48891c[_0x346b41][_0xab90('0x10e')]('channel');var _0x222e43=_0x1b5ba7+_0xab90('0xb0');socket[_0xab90('0xa5')](_0xab90('0x8b')+_0x1b5ba7+'Queue:save',{'UserId':_0x225a28['id'],['queueField']:_0x48891c[_0x346b41]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x3ec8ba,null))[_0xab90('0x2a')](handleError(_0x3ec8ba,null));};exports[_0xab90('0x10f')]=function(_0x42ee0d,_0x59f777){return db['User'][_0xab90('0x92')]({'where':{'id':_0x42ee0d['params']['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x59f777,null))[_0xab90('0x36')](function(_0x8f17df){if(_0x8f17df){var _0xe09c0=_0x8f17df[_0xab90('0x37')]({'plain':!![]});var _0x205a21=_0x42ee0d[_0xab90('0x4c')][_0xab90('0x6b')];return _0x8f17df[_0xab90('0x10f')](_0x205a21)[_0xab90('0x36')](function(){for(var _0xeee18a=0x0;_0xeee18a<_0x205a21[_0xab90('0x50')];_0xeee18a++){var _0x165c34=[];db[_0xab90('0x101')][_0xab90('0x92')]({'where':{'id':_0x205a21[_0xeee18a]}})[_0xab90('0x36')](function(_0x3261d3){_0x165c34[_0xab90('0xa9')](_0x3261d3['getVoiceQueues']()[_0xab90('0x36')](function(_0x10cd1d){for(var _0x5dbf2c=0x0;_0x5dbf2c<_0x10cd1d[_0xab90('0x50')];_0x5dbf2c++){_0x10cd1d[_0x5dbf2c][_0xab90('0x104')](_0xab90('0x9b'),_0xab90('0x103'));}return _0x10cd1d;}));_0x165c34[_0xab90('0xa9')](_0x3261d3[_0xab90('0x110')]()[_0xab90('0x36')](function(_0x3da947){for(var _0x49a838=0x0;_0x49a838<_0x3da947[_0xab90('0x50')];_0x49a838++){_0x3da947[_0x49a838][_0xab90('0x104')](_0xab90('0x9b'),'Chat');}return _0x3da947;}));_0x165c34[_0xab90('0xa9')](_0x3261d3['getMailQueues']()[_0xab90('0x36')](function(_0xc72998){for(var _0x5ed98a=0x0;_0x5ed98a<_0xc72998[_0xab90('0x50')];_0x5ed98a++){_0xc72998[_0x5ed98a]['setDataValue'](_0xab90('0x9b'),_0xab90('0x106'));}return _0xc72998;}));_0x165c34[_0xab90('0xa9')](_0x3261d3[_0xab90('0x107')]()['then'](function(_0x1de64e){for(var _0xfabad6=0x0;_0xfabad6<_0x1de64e[_0xab90('0x50')];_0xfabad6++){_0x1de64e[_0xfabad6][_0xab90('0x104')](_0xab90('0x9b'),_0xab90('0x108'));}return _0x1de64e;}));_0x165c34['push'](_0x3261d3[_0xab90('0x111')]()[_0xab90('0x36')](function(_0x33ffe9){for(var _0x3e03b6=0x0;_0x3e03b6<_0x33ffe9[_0xab90('0x50')];_0x3e03b6++){_0x33ffe9[_0x3e03b6][_0xab90('0x104')](_0xab90('0x9b'),_0xab90('0x109'));}return _0x33ffe9;}));_0x165c34[_0xab90('0xa9')](_0x3261d3[_0xab90('0x10a')]()[_0xab90('0x36')](function(_0x220744){for(var _0x260896=0x0;_0x260896<_0x220744[_0xab90('0x50')];_0x260896++){_0x220744[_0x260896][_0xab90('0x104')](_0xab90('0x9b'),'Openchannel');}return _0x220744;}));return BPromise[_0xab90('0xe7')](_0x165c34);})[_0xab90('0x36')](function(_0xcc4ec5){var _0x899768=_[_0xab90('0x10c')](_0xcc4ec5);_0x165c34=[];return db[_0xab90('0x5a')][_0xab90('0x10d')](function(_0x334f7c){for(var _0xf32b01=0x0;_0xf32b01<_0x899768[_0xab90('0x50')];_0xf32b01++){_0x165c34[_0xab90('0xa9')](_0x899768[_0xf32b01][_0xab90('0x112')](_0xe09c0['id']),{'transaction':_0x334f7c});}return BPromise[_0xab90('0xe7')](_0x165c34)[_0xab90('0x36')](function(){if(_0xe09c0[_0xab90('0x9c')]){return BPromise['each'](_[_0xab90('0x3c')](_0x899768,function(_0x59b2ec){return _0x59b2ec[_0xab90('0x10e')](_0xab90('0x9b'))===_0xab90('0x103');}),function(_0x2f4f5c){return db[_0xab90('0xac')][_0xab90('0x43')]({'where':{'VoiceQueueId':_0x2f4f5c['id'],'UserId':_0xe09c0['id']},'transaction':_0x334f7c});});}else{return;}})['then'](function(){for(var _0x5773bf=0x0;_0x5773bf<_0x899768['length'];_0x5773bf++){var _0x3e5886=_0x899768[_0x5773bf][_0xab90('0x10e')]('channel');var _0x59fe8c=_0x3e5886+_0xab90('0xb0');socket['emit'](_0xab90('0x8b')+_0x3e5886+_0xab90('0x113'),{'UserId':_0xe09c0['id'],['queueField']:_0x899768[_0x5773bf]['id']});}});});});}});}})[_0xab90('0x36')](respondWithStatusCode(_0x59f777,null))['catch'](handleError(_0x59f777,null));};exports[_0xab90('0x114')]=function(_0x3df852,_0x334cf8,_0x56beee){var _0x123f80={};var _0x412623={};var _0x1aedb7;var _0x166ae2;return db[_0xab90('0x5e')]['findOne']({'where':{'id':_0x3df852[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x334cf8,null))[_0xab90('0x36')](function(_0x39385e){if(_0x39385e){_0x1aedb7=_0x39385e;_0x412623[_0xab90('0x48')]=_[_0xab90('0x64')](db[_0xab90('0xbe')][_0xab90('0x45')]);_0x412623[_0xab90('0x4c')]=_[_0xab90('0x64')](_0x3df852[_0xab90('0x4c')]);_0x412623['filters']=_['intersection'](_0x412623[_0xab90('0x48')],_0x412623[_0xab90('0x4c')]);_0x123f80['attributes']=_['intersection'](_0x412623[_0xab90('0x48')],qs[_0xab90('0x4f')](_0x3df852[_0xab90('0x4c')]['fields']));_0x123f80['attributes']=_0x123f80[_0xab90('0x4d')][_0xab90('0x50')]?_0x123f80[_0xab90('0x4d')]:_0x412623[_0xab90('0x48')];_0x123f80[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x3df852[_0xab90('0x4c')]['sort']);_0x123f80[_0xab90('0x56')]=qs['filters'](_[_0xab90('0x54')](_0x3df852['query'],_0x412623['filters']));if(_0x3df852[_0xab90('0x4c')][_0xab90('0x3c')]){_0x123f80[_0xab90('0x56')]=_['merge'](_0x123f80['where'],{'$or':_['map'](_0x123f80['attributes'],function(_0x185995){var _0x5c9d2d={};_0x5c9d2d[_0x185995]={'$like':'%'+_0x3df852[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x5c9d2d;})});}_0x123f80=_[_0xab90('0x57')]({},_0x123f80,_0x3df852[_0xab90('0x5d')]);return _0x1aedb7[_0xab90('0x114')](_0x123f80);}})[_0xab90('0x36')](function(_0x537eb5){if(_0x537eb5){_0x166ae2=_0x537eb5[_0xab90('0x50')];if(!_0x3df852[_0xab90('0x4c')][_0xab90('0x51')](_0xab90('0x52'))){_0x123f80[_0xab90('0x31')]=qs[_0xab90('0x31')](_0x3df852['query'][_0xab90('0x31')]);_0x123f80[_0xab90('0x30')]=qs[_0xab90('0x30')](_0x3df852[_0xab90('0x4c')][_0xab90('0x30')]);}return _0x1aedb7[_0xab90('0x114')](_0x123f80);}})[_0xab90('0x36')](function(_0x3b5faf){if(_0x3b5faf){return _0x3b5faf?{'count':_0x166ae2,'rows':_0x3b5faf}:null;}})['then'](respondWithResult(_0x334cf8,null))[_0xab90('0x2a')](handleError(_0x334cf8,null));};exports['getAgents']=function(_0x52a100,_0x372383,_0x436884){var _0x2963aa={};var _0x4770a0={};var _0x345759;var _0x1fb07a;return db['User'][_0xab90('0x92')]({'where':{'id':_0x52a100[_0xab90('0x67')]['id']}})[_0xab90('0x36')](handleEntityNotFound(_0x372383,null))[_0xab90('0x36')](function(_0x3a88a9){if(_0x3a88a9){_0x345759=_0x3a88a9;_0x4770a0[_0xab90('0x48')]=_['keys'](db[_0xab90('0x5e')][_0xab90('0x45')]);_0x4770a0['query']=_['keys'](_0x52a100[_0xab90('0x4c')]);_0x4770a0[_0xab90('0x55')]=_[_0xab90('0x4e')](_0x4770a0[_0xab90('0x48')],_0x4770a0['query']);_0x2963aa['attributes']=_[_0xab90('0x4e')](_0x4770a0[_0xab90('0x48')],qs['fields'](_0x52a100[_0xab90('0x4c')][_0xab90('0x4f')]));_0x2963aa['attributes']=_0x2963aa[_0xab90('0x4d')][_0xab90('0x50')]?_0x2963aa[_0xab90('0x4d')]:_0x4770a0[_0xab90('0x48')];_0x2963aa[_0xab90('0x53')]=qs[_0xab90('0xbc')](_0x52a100[_0xab90('0x4c')][_0xab90('0xbc')]);_0x2963aa['where']=qs[_0xab90('0x55')](_[_0xab90('0x54')](_0x52a100[_0xab90('0x4c')],_0x4770a0[_0xab90('0x55')]));if(_0x52a100[_0xab90('0x4c')][_0xab90('0x3c')]){_0x2963aa[_0xab90('0x56')]=_[_0xab90('0x57')](_0x2963aa[_0xab90('0x56')],{'$or':_[_0xab90('0x3e')](_0x2963aa[_0xab90('0x4d')],function(_0x5735bf){var _0x2988be={};_0x2988be[_0x5735bf]={'$like':'%'+_0x52a100[_0xab90('0x4c')][_0xab90('0x3c')]+'%'};return _0x2988be;})});}_0x2963aa[_0xab90('0x48')]=db[_0xab90('0x5e')];_0x2963aa['as']=_0xab90('0x39');_0x2963aa=_[_0xab90('0x57')]({},_0x2963aa,_0x52a100[_0xab90('0x5d')]);return _0x345759[_0xab90('0xe2')]({'include':[_0x2963aa]});}})[_0xab90('0x36')](function(_0x5c01f4){if(_0x5c01f4){var _0x2eee96={},_0x5c7c6a=[],_0x58a987=0x0;for(var _0x30b526=0x0;_0x30b526<_0x5c01f4['length'];_0x30b526+=0x1){for(var _0x327a11=0x0,_0x254820;_0x327a11<_0x5c01f4[_0x30b526][_0xab90('0x39')][_0xab90('0x50')];_0x327a11+=0x1){_0x254820=_0x5c01f4[_0x30b526][_0xab90('0x39')][_0x327a11][_0xab90('0x37')]({'plain':!![]});_0x2eee96[_0x254820['id']]=_0x254820;}}_0x2eee96=_[_0xab90('0x115')](_0x2eee96);for(var _0x48c4f1=qs[_0xab90('0x30')](_0x52a100[_0xab90('0x4c')][_0xab90('0x30')]);_0x48c4f1<_0x2eee96[_0xab90('0x50')]&&_0x5c7c6a[_0xab90('0x50')]=_0x1cef52[_0x84c6('0x54')]){throw new Error(_0x84c6('0x55'));}})[_0x84c6('0x25')](function(){if(_0x280c8a){return db[_0x84c6('0x2f')][_0x84c6('0x4c')]({'where':{'membername':_0x280c8a[_0x84c6('0x2b')]},'individualHooks':!![]});}})[_0x84c6('0x25')](function(){if(_0x280c8a){return _0x280c8a[_0x84c6('0x56')]({'raw':!![]});}})[_0x84c6('0x25')](function(_0x3fcfad){if(_0x280c8a){if(_0x3fcfad){var _0x524352=[];_0x5e4a37=_0x3fcfad;if(_0x5e4a37[_0x84c6('0x32')]){for(var _0x31c620=0x0;_0x31c620<_0x5e4a37['length'];_0x31c620++){_0x524352[_0x84c6('0x37')](db[_0x84c6('0x2f')]['upsert']({'membername':_0x280c8a[_0x84c6('0x2b')],'UserId':_0x280c8a['id'],'queue_name':_0x5e4a37[_0x31c620][_0x84c6('0x2b')],'VoiceQueueId':_0x5e4a37[_0x31c620]['id'],'interface':_0x1c650f,'paused':_0x280c8a[_0x84c6('0x50')]||![],'penalty':_0x5e4a37[_0x31c620]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x524352);}}}})['then'](function(){if(_0x280c8a){return db['MemberReport'][_0x84c6('0x1e')]({'where':{'membername':_0x280c8a[_0x84c6('0x2b')],'exitAt':null}});}})[_0x84c6('0x25')](function(_0x4c8ac1){if(_0x280c8a){if(_0x4c8ac1&&_0x4c8ac1[_0x84c6('0x32')]){var _0x2e0d54=[];_0x4c8ac1[_0x84c6('0x36')](function(_0x6332f8){_0x2e0d54[_0x84c6('0x37')](_0x6332f8[_0x84c6('0x30')]({'exitAt':moment()[_0x84c6('0x33')](_0x84c6('0x34'))}));});return BPromise[_0x84c6('0x4a')](_0x2e0d54);}}})['then'](function(_0xa07239){if(_0x280c8a){var _0x5a4cf0=[];var _0x2d7db8=[];var _0x512f95=utils['getChannels']();var _0x5df61d={'membername':_0x280c8a[_0x84c6('0x2b')],'interface':_0x1c650f,'enterAt':moment()[_0x84c6('0x33')](_0x84c6('0x34')),'role':_0x280c8a[_0x84c6('0x2c')],'internal':_0x280c8a[_0x84c6('0x2d')]};_0x512f95[_0x84c6('0x36')](function(_0x44f672){_0x5a4cf0[_0x84c6('0x37')](_[_0x84c6('0x57')]({'channel':_0x44f672,'type':'LOGIN','data1':'callysquare','data2':_0x1c650f},_0x5df61d));if(_0x280c8a['loginInPause']){_0x2d7db8['push'](_[_0x84c6('0x57')]({'channel':_0x44f672,'type':_0x84c6('0x31'),'data1':_0x84c6('0x58')},_0x5df61d));}});return db[_0x84c6('0x3d')][_0x84c6('0x3e')](_0x5a4cf0[_0x84c6('0x59')](_0x2d7db8),{'individualHooks':!![]});}})['then'](function(){if(_0x280c8a){return _0x280c8a['update']({'online':!![],'lastLoginAt':moment()[_0x84c6('0x33')](_0x84c6('0x34')),'voicePause':_0x280c8a[_0x84c6('0x50')]||![],'mailPause':_0x280c8a[_0x84c6('0x50')]||![],'chatPause':_0x280c8a[_0x84c6('0x50')]||![],'faxPause':_0x280c8a[_0x84c6('0x50')]||![],'smsPause':_0x280c8a[_0x84c6('0x50')]||![],'openchannelPause':_0x280c8a['loginInPause']||![],'pauseType':_0x280c8a['loginInPause']?_0x84c6('0x58'):null,'lastPauseAt':moment()[_0x84c6('0x33')](_0x84c6('0x34')),'interface':_0x1c650f});}})['then'](function(_0xb352f2){_0x58e284(_0xb352f2);})['catch'](function(_0x1149e0){_0x194d84(_0x170b16[_0x84c6('0x17')](0x1f4,_0x1149e0[_0x84c6('0x19')]));});});}; \ No newline at end of file +var _0xfa4d=['upsert','loginInPause','UserVoiceQueue.penalty','merge','LOGININPAUSE','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','localhost','socket.io-emitter','redis','./user.socket','register','request','then','User,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','ShowUser','find','PauseUser','name','role','internal','interface','UserVoiceQueueRt','update','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','SIP/%s','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','body','UnpauseUser','channel','isValidChannel','Unknown\x20channel','PAUSE','system','fax','openchannel','set','forEach','all','destroy','LoginUser','findOne','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x9a9433,_0x12bd61){var _0x32eb8c=function(_0x523e22){while(--_0x523e22){_0x9a9433['push'](_0x9a9433['shift']());}};_0x32eb8c(++_0x12bd61);}(_0xfa4d,0x1a9));var _0xdfa4=function(_0x2423d2,_0x3e91e9){_0x2423d2=_0x2423d2-0x0;var _0x333c55=_0xfa4d[_0x2423d2];return _0x333c55;};'use strict';var _=require(_0xdfa4('0x0'));var util=require(_0xdfa4('0x1'));var moment=require('moment');var BPromise=require(_0xdfa4('0x2'));var rs=require(_0xdfa4('0x3'));var fs=require('fs');var Redis=require(_0xdfa4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdfa4('0x5'));var logger=require('../../config/logger')(_0xdfa4('0x6'));var config=require(_0xdfa4('0x7'));var jayson=require(_0xdfa4('0x8'));var client=jayson['client'][_0xdfa4('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xdfa4('0xa'),'port':0x18eb});var socket=require(_0xdfa4('0xb'))(new Redis(config[_0xdfa4('0xc')]));require(_0xdfa4('0xd'))[_0xdfa4('0xe')](socket);function respondWithRpcPromise(_0x216331,_0x67e987,_0x1dbb55){return new BPromise(function(_0x247c2b,_0xa7e46e){return client[_0xdfa4('0xf')](_0x216331,_0x1dbb55)[_0xdfa4('0x10')](function(_0x1603b2){logger['info'](_0xdfa4('0x11'),_0x67e987,_0xdfa4('0x12'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x67e987,_0xdfa4('0x12'),JSON[_0xdfa4('0x13')](_0x1603b2));if(_0x1603b2[_0xdfa4('0x14')]){if(_0x1603b2['error'][_0xdfa4('0x15')]===0x1f4){logger[_0xdfa4('0x14')](_0xdfa4('0x11'),_0x67e987,_0x1603b2[_0xdfa4('0x14')]['message']);return _0xa7e46e(_0x1603b2[_0xdfa4('0x14')][_0xdfa4('0x16')]);}logger[_0xdfa4('0x14')](_0xdfa4('0x11'),_0x67e987,_0x1603b2[_0xdfa4('0x14')][_0xdfa4('0x16')]);return _0x247c2b(_0x1603b2[_0xdfa4('0x14')]['message']);}else{logger[_0xdfa4('0x17')]('User,\x20%s,\x20%s',_0x67e987,_0xdfa4('0x12'));_0x247c2b(_0x1603b2['result'][_0xdfa4('0x16')]);}})[_0xdfa4('0x18')](function(_0x5d7c16){logger[_0xdfa4('0x14')](_0xdfa4('0x11'),_0x67e987,_0x5d7c16);_0xa7e46e(_0x5d7c16);});});}exports[_0xdfa4('0x19')]=function(_0x4fef99){var _0x2430bc=this;return new Promise(function(_0x4477fc,_0x3b5de2){return db[_0xdfa4('0x1a')][_0xdfa4('0x1b')]({'raw':_0x4fef99[_0xdfa4('0x1c')]?_0x4fef99[_0xdfa4('0x1c')][_0xdfa4('0x1d')]===undefined?!![]:![]:!![],'where':_0x4fef99[_0xdfa4('0x1c')]?_0x4fef99[_0xdfa4('0x1c')][_0xdfa4('0x1e')]||null:null,'attributes':_0x4fef99[_0xdfa4('0x1c')]?_0x4fef99[_0xdfa4('0x1c')][_0xdfa4('0x1f')]||null:null,'limit':_0x4fef99[_0xdfa4('0x1c')]?_0x4fef99[_0xdfa4('0x1c')][_0xdfa4('0x20')]||null:null,'include':_0x4fef99['options']?_0x4fef99[_0xdfa4('0x1c')][_0xdfa4('0x21')]?_['map'](_0x4fef99[_0xdfa4('0x1c')][_0xdfa4('0x21')],function(_0x3f940a){return{'model':db[_0x3f940a['model']],'as':_0x3f940a['as'],'attributes':_0x3f940a[_0xdfa4('0x1f')],'include':_0x3f940a['include']?_[_0xdfa4('0x22')](_0x3f940a[_0xdfa4('0x21')],function(_0xfe2836){return{'model':db[_0xfe2836[_0xdfa4('0x23')]],'as':_0xfe2836['as'],'attributes':_0xfe2836['attributes'],'include':_0xfe2836[_0xdfa4('0x21')]?_[_0xdfa4('0x22')](_0xfe2836[_0xdfa4('0x21')],function(_0x4f5ce2){return{'model':db[_0x4f5ce2[_0xdfa4('0x23')]],'as':_0x4f5ce2['as'],'attributes':_0x4f5ce2[_0xdfa4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdfa4('0x10')](function(_0x247028){logger[_0xdfa4('0x17')]('GetUser',_0x4fef99);logger['debug'](_0xdfa4('0x19'),_0x4fef99,JSON[_0xdfa4('0x13')](_0x247028));_0x4477fc(_0x247028);})[_0xdfa4('0x18')](function(_0x2e48de){logger[_0xdfa4('0x14')](_0xdfa4('0x19'),_0x2e48de['message'],_0x4fef99);_0x3b5de2(_0x2430bc[_0xdfa4('0x14')](0x1f4,_0x2e48de['message']));});});};exports[_0xdfa4('0x24')]=function(_0x2098a2){var _0xfeedb6=this;return new Promise(function(_0x15bd10,_0xf6375){return db[_0xdfa4('0x1a')][_0xdfa4('0x25')]({'raw':_0x2098a2[_0xdfa4('0x1c')]?_0x2098a2[_0xdfa4('0x1c')][_0xdfa4('0x1d')]===undefined?!![]:![]:!![],'where':_0x2098a2[_0xdfa4('0x1c')]?_0x2098a2[_0xdfa4('0x1c')][_0xdfa4('0x1e')]||null:null,'attributes':_0x2098a2[_0xdfa4('0x1c')]?_0x2098a2['options']['attributes']||null:null,'include':_0x2098a2[_0xdfa4('0x1c')]?_0x2098a2[_0xdfa4('0x1c')]['include']?_[_0xdfa4('0x22')](_0x2098a2[_0xdfa4('0x1c')][_0xdfa4('0x21')],function(_0x162421){return{'model':db[_0x162421[_0xdfa4('0x23')]],'as':_0x162421['as'],'attributes':_0x162421['attributes'],'include':_0x162421['include']?_['map'](_0x162421['include'],function(_0x33984b){return{'model':db[_0x33984b[_0xdfa4('0x23')]],'as':_0x33984b['as'],'attributes':_0x33984b[_0xdfa4('0x1f')],'include':_0x33984b[_0xdfa4('0x21')]?_['map'](_0x33984b[_0xdfa4('0x21')],function(_0x36bbdd){return{'model':db[_0x36bbdd['model']],'as':_0x36bbdd['as'],'attributes':_0x36bbdd[_0xdfa4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdfa4('0x10')](function(_0x30370f){logger[_0xdfa4('0x17')]('ShowUser',_0x2098a2);logger['debug']('ShowUser',_0x2098a2,JSON[_0xdfa4('0x13')](_0x30370f));_0x15bd10(_0x30370f);})[_0xdfa4('0x18')](function(_0x2c09fa){logger[_0xdfa4('0x14')](_0xdfa4('0x24'),_0x2c09fa[_0xdfa4('0x16')],_0x2098a2);_0xf6375(_0xfeedb6[_0xdfa4('0x14')](0x1f4,_0x2c09fa['message']));});});};exports[_0xdfa4('0x26')]=function(_0x4efaaf){var _0xf4a05=this;return new Promise(function(_0x37207d,_0x4390a9){var _0xb0e808;return db['User'][_0xdfa4('0x25')]({'where':_0x4efaaf[_0xdfa4('0x1c')]['where']||{},'attributes':['id',_0xdfa4('0x27'),_0xdfa4('0x28'),_0xdfa4('0x29'),_0xdfa4('0x2a')]})[_0xdfa4('0x10')](function(_0x2d57e0){if(_0x2d57e0){_0xb0e808=_0x2d57e0;return db[_0xdfa4('0x2b')][_0xdfa4('0x2c')]({'paused':0x1},{'where':{'UserId':_0xb0e808['id']},'individualHooks':!![]});}})[_0xdfa4('0x10')](function(){if(_0xb0e808){return db[_0xdfa4('0x2d')][_0xdfa4('0x1b')]({'where':{'membername':_0xb0e808[_0xdfa4('0x27')],'type':'PAUSE','exitAt':null}});}})[_0xdfa4('0x10')](function(_0x49d52c){if(_0xb0e808){if(_0x49d52c&&_0x49d52c[_0xdfa4('0x2e')]){var _0x359410=moment()[_0xdfa4('0x2f')](_0xdfa4('0x30'));for(var _0x4310b5=0x0,_0x1033e2=_0x49d52c[_0xdfa4('0x2e')];_0x4310b5<_0x1033e2;_0x4310b5++){_0x49d52c[_0x4310b5][_0xdfa4('0x31')]({'exitAt':_0x359410});}}}})[_0xdfa4('0x10')](function(){if(_0xb0e808){var _0x1cf62a=[];var _0x2fabb6=utils[_0xdfa4('0x32')]();_0x2fabb6['forEach'](function(_0x263c79){_0x1cf62a[_0xdfa4('0x33')]({'channel':_0x263c79,'membername':_0xb0e808['name'],'interface':_[_0xdfa4('0x34')](_0xb0e808[_0xdfa4('0x2a')])?util[_0xdfa4('0x2f')](_0xdfa4('0x35'),_0xb0e808[_0xdfa4('0x27')]):_0xb0e808['interface'],'type':'PAUSE','enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4efaaf['body'][_0xdfa4('0x36')]||_0xdfa4('0x37'),'role':_0xb0e808['role'],'internal':_0xb0e808['internal'],'uniqueid':_0x4efaaf['body'][_0xdfa4('0x38')]||null});});return db[_0xdfa4('0x2d')][_0xdfa4('0x39')](_0x1cf62a,{'individualHooks':!![]});}})[_0xdfa4('0x10')](function(){if(_0xb0e808){return _0xb0e808[_0xdfa4('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4efaaf[_0xdfa4('0x3a')][_0xdfa4('0x36')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xdfa4('0x2f')](_0xdfa4('0x30'))});}})[_0xdfa4('0x10')](function(_0x3638e0){_0x37207d(_0x3638e0);})['catch'](function(_0x518117){_0x4390a9(_0xf4a05[_0xdfa4('0x14')](0x1f4,_0x518117[_0xdfa4('0x16')]));});});};exports[_0xdfa4('0x3b')]=function(_0x2e26a4){var _0x563036=this;return new Promise(function(_0x339223,_0x12fa0b){var _0x1e77f7;return db[_0xdfa4('0x1a')]['findOne']({'where':_0x2e26a4['options'][_0xdfa4('0x1e')]||{},'attributes':['id',_0xdfa4('0x27')]})['then'](function(_0x1cc33b){if(_0x1cc33b){_0x1e77f7=_0x1cc33b;if(_0x2e26a4[_0xdfa4('0x3a')][_0xdfa4('0x3c')]&&!utils[_0xdfa4('0x3d')](_0x2e26a4[_0xdfa4('0x3a')]['channel'])){throw new Error(_0xdfa4('0x3e'));}switch(_0x2e26a4[_0xdfa4('0x3a')]['channel']){case'voice':return db['UserVoiceQueueRt'][_0xdfa4('0x2c')]({'paused':0x0},{'where':{'UserId':_0x1e77f7['id']}})[_0xdfa4('0x10')](function(){return db[_0xdfa4('0x2d')]['find']({'where':{'channel':_0x2e26a4['body'][_0xdfa4('0x3c')],'membername':_0x1e77f7['name'],'type':_0xdfa4('0x3f'),'exitAt':null}});})[_0xdfa4('0x10')](function(_0x3bebe5){if(_0x3bebe5){return _0x3bebe5['update']({'exitAt':moment()[_0xdfa4('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xdfa4('0x40')},{'individualHooks':!![]});}return null;})[_0xdfa4('0x10')](function(){return _0x1e77f7[_0xdfa4('0x2c')]({'voicePause':![]});});case'mail':case'chat':case _0xdfa4('0x41'):case'sms':case _0xdfa4('0x42'):return db['MemberReport'][_0xdfa4('0x25')]({'where':{'channel':_0x2e26a4[_0xdfa4('0x3a')][_0xdfa4('0x3c')],'membername':_0x1e77f7[_0xdfa4('0x27')],'type':_0xdfa4('0x3f'),'exitAt':null}})[_0xdfa4('0x10')](function(_0x5fa0e){return _0x5fa0e['update']({'exitAt':moment()[_0xdfa4('0x2f')](_0xdfa4('0x30')),'data2':_0xdfa4('0x40')},{'individualHooks':!![]});})['then'](function(){var _0x36ef83={};_[_0xdfa4('0x43')](_0x36ef83,util[_0xdfa4('0x2f')]('%s%s',_0x2e26a4[_0xdfa4('0x3a')][_0xdfa4('0x3c')],'Pause'),![]);return _0x1e77f7[_0xdfa4('0x2c')](_0x36ef83);});default:return db[_0xdfa4('0x2b')][_0xdfa4('0x2c')]({'paused':0x0},{'where':{'UserId':_0x1e77f7['id']}})['then'](function(){return db[_0xdfa4('0x2d')][_0xdfa4('0x1b')]({'where':{'membername':_0x1e77f7[_0xdfa4('0x27')],'type':_0xdfa4('0x3f'),'exitAt':null}});})[_0xdfa4('0x10')](function(_0x42b410){var _0x3caa43=[];_0x42b410[_0xdfa4('0x44')](function(_0x514f6d){_0x3caa43['push'](_0x514f6d[_0xdfa4('0x2c')]({'exitAt':moment()[_0xdfa4('0x2f')](_0xdfa4('0x30')),'data2':_0xdfa4('0x40')}));});return BPromise[_0xdfa4('0x45')](_0x3caa43);})[_0xdfa4('0x10')](function(){return _0x1e77f7[_0xdfa4('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xdfa4('0x10')](function(_0x3e7cd9){_0x339223(_0x3e7cd9);})[_0xdfa4('0x18')](function(_0x27cc5e){_0x12fa0b(_0x563036[_0xdfa4('0x14')](0x1f4,_0x27cc5e[_0xdfa4('0x16')]));});});};exports['LogoutUser']=function(_0x5e5fe2){var _0x4ba18e=this;return new Promise(function(_0x511784,_0x2d2d93){var _0x278845;return db[_0xdfa4('0x1a')]['findOne']({'where':_0x5e5fe2[_0xdfa4('0x1c')]['where']||{},'attributes':['id',_0xdfa4('0x27')]})[_0xdfa4('0x10')](function(_0x1eb770){if(_0x1eb770){_0x278845=_0x1eb770;return db[_0xdfa4('0x2b')][_0xdfa4('0x46')]({'where':{'membername':_0x278845[_0xdfa4('0x27')]},'individualHooks':!![]});}})[_0xdfa4('0x10')](function(){if(_0x278845){return db[_0xdfa4('0x2d')][_0xdfa4('0x1b')]({'where':{'membername':_0x278845[_0xdfa4('0x27')],'exitAt':null}});}})[_0xdfa4('0x10')](function(_0x18033c){if(_0x278845){if(_0x18033c&&_0x18033c['length']){var _0x782033=[];_0x18033c[_0xdfa4('0x44')](function(_0x40e41a){_0x782033[_0xdfa4('0x33')](_0x40e41a[_0xdfa4('0x2c')]({'exitAt':moment()[_0xdfa4('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x782033);}}})[_0xdfa4('0x10')](function(){if(_0x278845){return _0x278845['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xdfa4('0x10')](function(_0x56bbf0){_0x511784(_0x56bbf0);})[_0xdfa4('0x18')](function(_0x2083de){_0x2d2d93(_0x4ba18e[_0xdfa4('0x14')](0x1f4,_0x2083de[_0xdfa4('0x16')]));});});};exports[_0xdfa4('0x47')]=function(_0x41f864){var _0x264733=this;return new Promise(function(_0x55bb0b,_0x178a72){var _0x40cf1a;var _0x5caabe;var _0x4c17ec;var _0x42f509;return db['User'][_0xdfa4('0x48')]({'where':_0x41f864[_0xdfa4('0x1c')][_0xdfa4('0x1e')]||{},'attributes':['id','name',_0xdfa4('0x28'),'mobile','phone','internal','loginInPause',_0xdfa4('0x2a')]})[_0xdfa4('0x10')](function(_0x38b824){if(_0x38b824){_0x40cf1a=_0x38b824;_0x42f509=_0x41f864['body'][_0xdfa4('0x2a')]?_0x41f864[_0xdfa4('0x3a')][_0xdfa4('0x2a')]:util[_0xdfa4('0x2f')](_0xdfa4('0x35'),_0x40cf1a['name']);return db['User'][_0xdfa4('0x49')]({'where':{'role':_0xdfa4('0x4a'),'online':!![],'id':{'$ne':_0x40cf1a['id']}}});}})['then'](function(_0x5b155e){if(_0x5b155e){_0x4c17ec=_0x5b155e;return require(_0xdfa4('0x4b'))[_0xdfa4('0x4c')]();}})['then'](function(_0x16a965){if(_0x16a965&&_0x16a965['agents']&&_0x4c17ec>=_0x16a965[_0xdfa4('0x4d')]){throw new Error(_0xdfa4('0x4e'));}})[_0xdfa4('0x10')](function(){if(_0x40cf1a){return db[_0xdfa4('0x2b')][_0xdfa4('0x46')]({'where':{'membername':_0x40cf1a[_0xdfa4('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x40cf1a){return _0x40cf1a['getVoiceQueues']({'raw':!![]});}})[_0xdfa4('0x10')](function(_0x3e6f06){if(_0x40cf1a){if(_0x3e6f06){var _0x4a6f8e=[];_0x5caabe=_0x3e6f06;if(_0x5caabe[_0xdfa4('0x2e')]){for(var _0x4a675a=0x0;_0x4a675a<_0x5caabe[_0xdfa4('0x2e')];_0x4a675a++){_0x4a6f8e[_0xdfa4('0x33')](db[_0xdfa4('0x2b')][_0xdfa4('0x4f')]({'membername':_0x40cf1a[_0xdfa4('0x27')],'UserId':_0x40cf1a['id'],'queue_name':_0x5caabe[_0x4a675a][_0xdfa4('0x27')],'VoiceQueueId':_0x5caabe[_0x4a675a]['id'],'interface':_0x42f509,'paused':_0x40cf1a[_0xdfa4('0x50')]||![],'penalty':_0x5caabe[_0x4a675a][_0xdfa4('0x51')]||0x0}));}return BPromise['all'](_0x4a6f8e);}}}})[_0xdfa4('0x10')](function(){if(_0x40cf1a){return db[_0xdfa4('0x2d')][_0xdfa4('0x1b')]({'where':{'membername':_0x40cf1a[_0xdfa4('0x27')],'exitAt':null}});}})[_0xdfa4('0x10')](function(_0x2e284b){if(_0x40cf1a){if(_0x2e284b&&_0x2e284b['length']){var _0x46d401=[];_0x2e284b[_0xdfa4('0x44')](function(_0x294956){_0x46d401['push'](_0x294956[_0xdfa4('0x2c')]({'exitAt':moment()[_0xdfa4('0x2f')](_0xdfa4('0x30'))}));});return BPromise[_0xdfa4('0x45')](_0x46d401);}}})[_0xdfa4('0x10')](function(_0x393c5a){if(_0x40cf1a){var _0x40c87c=[];var _0x25fde0=[];var _0xa068aa=utils[_0xdfa4('0x32')]();var _0x38046c={'membername':_0x40cf1a[_0xdfa4('0x27')],'interface':_0x42f509,'enterAt':moment()['format'](_0xdfa4('0x30')),'role':_0x40cf1a[_0xdfa4('0x28')],'internal':_0x40cf1a[_0xdfa4('0x29')]};_0xa068aa['forEach'](function(_0x2dd718){_0x40c87c[_0xdfa4('0x33')](_['merge']({'channel':_0x2dd718,'type':'LOGIN','data1':'callysquare','data2':_0x42f509},_0x38046c));if(_0x40cf1a[_0xdfa4('0x50')]){_0x25fde0[_0xdfa4('0x33')](_[_0xdfa4('0x52')]({'channel':_0x2dd718,'type':_0xdfa4('0x3f'),'data1':_0xdfa4('0x53')},_0x38046c));}});return db[_0xdfa4('0x2d')][_0xdfa4('0x39')](_0x40c87c['concat'](_0x25fde0),{'individualHooks':!![]});}})[_0xdfa4('0x10')](function(){if(_0x40cf1a){return _0x40cf1a[_0xdfa4('0x2c')]({'online':!![],'lastLoginAt':moment()[_0xdfa4('0x2f')](_0xdfa4('0x30')),'voicePause':_0x40cf1a[_0xdfa4('0x50')]||![],'mailPause':_0x40cf1a[_0xdfa4('0x50')]||![],'chatPause':_0x40cf1a[_0xdfa4('0x50')]||![],'faxPause':_0x40cf1a[_0xdfa4('0x50')]||![],'smsPause':_0x40cf1a[_0xdfa4('0x50')]||![],'openchannelPause':_0x40cf1a[_0xdfa4('0x50')]||![],'pauseType':_0x40cf1a[_0xdfa4('0x50')]?_0xdfa4('0x53'):null,'lastPauseAt':moment()[_0xdfa4('0x2f')](_0xdfa4('0x30')),'interface':_0x42f509});}})[_0xdfa4('0x10')](function(_0x132210){_0x55bb0b(_0x132210);})[_0xdfa4('0x18')](function(_0x5c01d2){_0x178a72(_0x264733['error'](0x1f4,_0x5c01d2[_0xdfa4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 8e9771c..778eb5b 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 _0xc806=['remove','update','emit','removeListener','register','length','user:','./user.events','save'];(function(_0x425003,_0x1eee3b){var _0x3f2f77=function(_0x56ddd2){while(--_0x56ddd2){_0x425003['push'](_0x425003['shift']());}};_0x3f2f77(++_0x1eee3b);}(_0xc806,0xcd));var _0x6c80=function(_0x3cbf49,_0x53f013){_0x3cbf49=_0x3cbf49-0x0;var _0x57e3fd=_0xc806[_0x3cbf49];return _0x57e3fd;};'use strict';var UserEvents=require(_0x6c80('0x0'));var events=[_0x6c80('0x1'),_0x6c80('0x2'),_0x6c80('0x3')];function createListener(_0x4a251c,_0x1e37e8){return function(_0x51e820){_0x1e37e8[_0x6c80('0x4')](_0x4a251c,_0x51e820);};}function removeListener(_0x2398ed,_0x4a884f){return function(){UserEvents[_0x6c80('0x5')](_0x2398ed,_0x4a884f);};}exports[_0x6c80('0x6')]=function(_0x4be155){for(var _0x1a1e47=0x0,_0x1bb9f5=events[_0x6c80('0x7')];_0x1a1e47<_0x1bb9f5;_0x1a1e47++){var _0x3e9bbf=events[_0x1a1e47];var _0x46c757=createListener(_0x6c80('0x8')+_0x3e9bbf,_0x4be155);UserEvents['on'](_0x3e9bbf,_0x46c757);}}; \ No newline at end of file +var _0x187e=['removeListener','register','length','user:','./user.events','save','remove','update','emit'];(function(_0x39d38e,_0x3da1f7){var _0x18e737=function(_0x373eef){while(--_0x373eef){_0x39d38e['push'](_0x39d38e['shift']());}};_0x18e737(++_0x3da1f7);}(_0x187e,0x15a));var _0xe187=function(_0x44f718,_0xceccdd){_0x44f718=_0x44f718-0x0;var _0x518542=_0x187e[_0x44f718];return _0x518542;};'use strict';var UserEvents=require(_0xe187('0x0'));var events=[_0xe187('0x1'),_0xe187('0x2'),_0xe187('0x3')];function createListener(_0x475af6,_0x3178e8){return function(_0x360b98){_0x3178e8[_0xe187('0x4')](_0x475af6,_0x360b98);};}function removeListener(_0x12493a,_0x3110a3){return function(){UserEvents[_0xe187('0x5')](_0x12493a,_0x3110a3);};}exports[_0xe187('0x6')]=function(_0x1dbfc2){for(var _0x22acc5=0x0,_0x5e901c=events[_0xe187('0x7')];_0x22acc5<_0x5e901c;_0x22acc5++){var _0x2974c6=events[_0x22acc5];var _0x35ed08=createListener(_0xe187('0x8')+_0x2974c6,_0x1dbfc2);UserEvents['on'](_0x2974c6,_0x35ed08);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 3bb044b..053bba1 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 _0x8959=['multer','path','express','../../components/auth/service'];(function(_0x47a528,_0x59567c){var _0x627777=function(_0x59fcc5){while(--_0x59fcc5){_0x47a528['push'](_0x47a528['shift']());}};_0x627777(++_0x59567c);}(_0x8959,0x8c));var _0x9895=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x8959[_0x12a2a6];return _0x1754ae;};'use strict';var multer=require(_0x9895('0x0'));var util=require('util');var path=require(_0x9895('0x1'));var timeout=require('connect-timeout');var express=require(_0x9895('0x2'));var router=express['Router']();var auth=require(_0x9895('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xfeb3=['exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment'];(function(_0x3f9491,_0x308bba){var _0x48e50f=function(_0xfe7a4c){while(--_0xfe7a4c){_0x3f9491['push'](_0x3f9491['shift']());}};_0x48e50f(++_0x308bba);}(_0xfeb3,0x16f));var _0x3feb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xfeb3[_0x122ef9];return _0x42fba0;};'use strict';var multer=require('multer');var util=require(_0x3feb('0x0'));var path=require(_0x3feb('0x1'));var timeout=require(_0x3feb('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3feb('0x3'));var config=require(_0x3feb('0x4'));module[_0x3feb('0x5')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 648bda1..e8c5df9 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x918a7a,_0x86b1fd){var _0x2a7fdc=function(_0x34c20c){while(--_0x34c20c){_0x918a7a['push'](_0x918a7a['shift']());}};_0x2a7fdc(++_0x86b1fd);}(_0xe706,0xa3));var _0x6e70=function(_0x47ee00,_0x256539){_0x47ee00=_0x47ee00-0x0;var _0x3d35f9=_0xe706[_0x47ee00];return _0x3d35f9;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x27d10a,_0x35ff44){var _0x63302e=function(_0x302156){while(--_0x302156){_0x27d10a['push'](_0x27d10a['shift']());}};_0x63302e(++_0x35ff44);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'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 189677e..abf30ba 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 _0x4fd6=['define','UserChatQueue','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x4fd6,0x84));var _0x64fd=function(_0x1e399a,_0x351c59){_0x1e399a=_0x1e399a-0x0;var _0x539897=_0x4fd6[_0x1e399a];return _0x539897;};'use strict';var _=require(_0x64fd('0x0'));var util=require(_0x64fd('0x1'));var logger=require(_0x64fd('0x2'))('api');var moment=require(_0x64fd('0x3'));var BPromise=require(_0x64fd('0x4'));var rp=require(_0x64fd('0x5'));var fs=require('fs');var path=require(_0x64fd('0x6'));var rimraf=require(_0x64fd('0x7'));var config=require(_0x64fd('0x8'));var attributes=require(_0x64fd('0x9'));module[_0x64fd('0xa')]=function(_0x251af3,_0x308637){return _0x251af3[_0x64fd('0xb')](_0x64fd('0xc'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff6f=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','UserChatQueue','user_has_chat_queues'];(function(_0x4a2953,_0x1e2481){var _0x37f3a2=function(_0x2619d8){while(--_0x2619d8){_0x4a2953['push'](_0x4a2953['shift']());}};_0x37f3a2(++_0x1e2481);}(_0xff6f,0x11e));var _0xfff6=function(_0x1ca69d,_0x39d8bf){_0x1ca69d=_0x1ca69d-0x0;var _0x3f8b7b=_0xff6f[_0x1ca69d];return _0x3f8b7b;};'use strict';var _=require(_0xfff6('0x0'));var util=require(_0xfff6('0x1'));var logger=require(_0xfff6('0x2'))(_0xfff6('0x3'));var moment=require(_0xfff6('0x4'));var BPromise=require(_0xfff6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfff6('0x6'));var rimraf=require(_0xfff6('0x7'));var config=require(_0xfff6('0x8'));var attributes=require('./userChatQueue.attributes');module[_0xfff6('0x9')]=function(_0x57e2b3,_0x25382c){return _0x57e2b3[_0xfff6('0xa')](_0xfff6('0xb'),attributes,{'tableName':_0xfff6('0xc'),'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 a28d90e..ce8e620 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 _0x82d6=['message','result','catch','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x2683a4,_0x25049e){var _0x2eebcb=function(_0x4262d6){while(--_0x4262d6){_0x2683a4['push'](_0x2683a4['shift']());}};_0x2eebcb(++_0x25049e);}(_0x82d6,0x157));var _0x682d=function(_0x56a824,_0x2af2af){_0x56a824=_0x56a824-0x0;var _0x366399=_0x82d6[_0x56a824];return _0x366399;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x682d('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x682d('0x1'));var db=require(_0x682d('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x682d('0x3'));var config=require(_0x682d('0x4'));var jayson=require(_0x682d('0x5'));var client=jayson[_0x682d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11e466,_0xb6759,_0x1402c0){return new BPromise(function(_0x4fe570,_0x227caa){return client[_0x682d('0x7')](_0x11e466,_0x1402c0)[_0x682d('0x8')](function(_0x2c6b05){logger[_0x682d('0x9')](_0x682d('0xa'),_0xb6759,'request\x20sent');logger[_0x682d('0xb')](_0x682d('0xc'),_0xb6759,_0x682d('0xd'),JSON[_0x682d('0xe')](_0x2c6b05));if(_0x2c6b05[_0x682d('0xf')]){if(_0x2c6b05[_0x682d('0xf')][_0x682d('0x10')]===0x1f4){logger['error'](_0x682d('0xa'),_0xb6759,_0x2c6b05[_0x682d('0xf')][_0x682d('0x11')]);return _0x227caa(_0x2c6b05[_0x682d('0xf')][_0x682d('0x11')]);}logger[_0x682d('0xf')]('UserChatQueue,\x20%s,\x20%s',_0xb6759,_0x2c6b05['error']['message']);return _0x4fe570(_0x2c6b05[_0x682d('0xf')][_0x682d('0x11')]);}else{logger[_0x682d('0x9')](_0x682d('0xa'),_0xb6759,_0x682d('0xd'));_0x4fe570(_0x2c6b05[_0x682d('0x12')]['message']);}})[_0x682d('0x13')](function(_0x388df1){logger['error'](_0x682d('0xa'),_0xb6759,_0x388df1);_0x227caa(_0x388df1);});});} \ No newline at end of file +var _0x3c5a=['request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x111acd,_0x46e493){var _0x294496=function(_0x2583b7){while(--_0x2583b7){_0x111acd['push'](_0x111acd['shift']());}};_0x294496(++_0x46e493);}(_0x3c5a,0x1a8));var _0xa3c5=function(_0x33c1b1,_0x2355fb){_0x33c1b1=_0x33c1b1-0x0;var _0x2c2037=_0x3c5a[_0x33c1b1];return _0x2c2037;};'use strict';var _=require('lodash');var util=require(_0xa3c5('0x0'));var moment=require(_0xa3c5('0x1'));var BPromise=require(_0xa3c5('0x2'));var rs=require(_0xa3c5('0x3'));var fs=require('fs');var Redis=require(_0xa3c5('0x4'));var db=require(_0xa3c5('0x5'))['db'];var utils=require(_0xa3c5('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa3c5('0x7'));var client=jayson[_0xa3c5('0x8')][_0xa3c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48d852,_0x1bfbc5,_0x1a1e11){return new BPromise(function(_0x18a32a,_0x272a2a){return client[_0xa3c5('0xa')](_0x48d852,_0x1a1e11)['then'](function(_0x46335e){logger[_0xa3c5('0xb')](_0xa3c5('0xc'),_0x1bfbc5,_0xa3c5('0xd'));logger['debug'](_0xa3c5('0xe'),_0x1bfbc5,_0xa3c5('0xd'),JSON[_0xa3c5('0xf')](_0x46335e));if(_0x46335e[_0xa3c5('0x10')]){if(_0x46335e[_0xa3c5('0x10')][_0xa3c5('0x11')]===0x1f4){logger[_0xa3c5('0x10')](_0xa3c5('0xc'),_0x1bfbc5,_0x46335e[_0xa3c5('0x10')]['message']);return _0x272a2a(_0x46335e[_0xa3c5('0x10')]['message']);}logger['error'](_0xa3c5('0xc'),_0x1bfbc5,_0x46335e[_0xa3c5('0x10')]['message']);return _0x18a32a(_0x46335e[_0xa3c5('0x10')]['message']);}else{logger[_0xa3c5('0xb')](_0xa3c5('0xc'),_0x1bfbc5,_0xa3c5('0xd'));_0x18a32a(_0x46335e['result']['message']);}})[_0xa3c5('0x12')](function(_0x4175c4){logger[_0xa3c5('0x10')](_0xa3c5('0xc'),_0x1bfbc5,_0x4175c4);_0x272a2a(_0x4175c4);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 7460cdc..2c24dd2 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 _0x7953=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','connect-timeout'];(function(_0x7bd1f3,_0x478a3f){var _0x1a0d34=function(_0x403bd9){while(--_0x403bd9){_0x7bd1f3['push'](_0x7bd1f3['shift']());}};_0x1a0d34(++_0x478a3f);}(_0x7953,0x1a5));var _0x3795=function(_0xcf7d1e,_0x1b00ad){_0xcf7d1e=_0xcf7d1e-0x0;var _0x42b2cb=_0x7953[_0xcf7d1e];return _0x42b2cb;};'use strict';var multer=require(_0x3795('0x0'));var util=require('util');var path=require(_0x3795('0x1'));var timeout=require(_0x3795('0x2'));var express=require('express');var router=express[_0x3795('0x3')]();var auth=require(_0x3795('0x4'));var interaction=require(_0x3795('0x5'));var config=require(_0x3795('0x6'));module[_0x3795('0x7')]=router; \ No newline at end of file +var _0xa87f=['connect-timeout','express','../../components/interaction/service','exports','util'];(function(_0x1c653d,_0x39bc19){var _0x2c7be9=function(_0x12a0d5){while(--_0x12a0d5){_0x1c653d['push'](_0x1c653d['shift']());}};_0x2c7be9(++_0x39bc19);}(_0xa87f,0xae));var _0xfa87=function(_0x2b5f37,_0x5c1838){_0x2b5f37=_0x2b5f37-0x0;var _0x54165e=_0xa87f[_0x2b5f37];return _0x54165e;};'use strict';var multer=require('multer');var util=require(_0xfa87('0x0'));var path=require('path');var timeout=require(_0xfa87('0x1'));var express=require(_0xfa87('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfa87('0x3'));var config=require('../../config/environment');module[_0xfa87('0x4')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index bc7ae2a..6681f9b 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 _0x0598=['exports','INTEGER','sequelize'];(function(_0x454018,_0x46e33a){var _0x24697d=function(_0x3ec647){while(--_0x3ec647){_0x454018['push'](_0x454018['shift']());}};_0x24697d(++_0x46e33a);}(_0x0598,0x92));var _0x8059=function(_0x5232ba,_0x5adb17){_0x5232ba=_0x5232ba-0x0;var _0x296532=_0x0598[_0x5232ba];return _0x296532;};'use strict';var Sequelize=require(_0x8059('0x0'));module[_0x8059('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8059('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdd4f=['sequelize','STRING'];(function(_0x58aa22,_0x88644){var _0x140034=function(_0x3d58aa){while(--_0x3d58aa){_0x58aa22['push'](_0x58aa22['shift']());}};_0x140034(++_0x88644);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x4eba60,_0x46be16){_0x4eba60=_0x4eba60-0x0;var _0x3ec621=_0xdd4f[_0x4eba60];return _0x3ec621;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xfdd4('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index ff05fd6..6284679 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 _0xbe1e=['api','moment','bluebird','request-promise','path','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbe1e,0xb2));var _0xebe1=function(_0x2bded4,_0x5aa045){_0x2bded4=_0x2bded4-0x0;var _0x302c84=_0xbe1e[_0x2bded4];return _0x302c84;};'use strict';var _=require(_0xebe1('0x0'));var util=require(_0xebe1('0x1'));var logger=require('../../config/logger')(_0xebe1('0x2'));var moment=require(_0xebe1('0x3'));var BPromise=require(_0xebe1('0x4'));var rp=require(_0xebe1('0x5'));var fs=require('fs');var path=require(_0xebe1('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module['exports']=function(_0x54b42d,_0x33cd8a){return _0x54b42d['define'](_0xebe1('0x7'),attributes,{'tableName':_0xebe1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87e1=['request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x289f94,_0x1b53d9){var _0x1d7aba=function(_0x4afae7){while(--_0x4afae7){_0x289f94['push'](_0x289f94['shift']());}};_0x1d7aba(++_0x1b53d9);}(_0x87e1,0xb1));var _0x187e=function(_0x3546eb,_0x440f3f){_0x3546eb=_0x3546eb-0x0;var _0xe660bf=_0x87e1[_0x3546eb];return _0xe660bf;};'use strict';var _=require(_0x187e('0x0'));var util=require(_0x187e('0x1'));var logger=require(_0x187e('0x2'))(_0x187e('0x3'));var moment=require('moment');var BPromise=require(_0x187e('0x4'));var rp=require(_0x187e('0x5'));var fs=require('fs');var path=require(_0x187e('0x6'));var rimraf=require(_0x187e('0x7'));var config=require(_0x187e('0x8'));var attributes=require(_0x187e('0x9'));module[_0x187e('0xa')]=function(_0x22f398,_0x4e17ad){return _0x22f398[_0x187e('0xb')](_0x187e('0xc'),attributes,{'tableName':_0x187e('0xd'),'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 0f2e81c..ad8ec97 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 _0xb758=['UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug'];(function(_0x4172f0,_0x1a9bc8){var _0x4a56e4=function(_0x228c67){while(--_0x228c67){_0x4172f0['push'](_0x4172f0['shift']());}};_0x4a56e4(++_0x1a9bc8);}(_0xb758,0x14a));var _0x8b75=function(_0x403cff,_0x1cf463){_0x403cff=_0x403cff-0x0;var _0x5a7c56=_0xb758[_0x403cff];return _0x5a7c56;};'use strict';var _=require(_0x8b75('0x0'));var util=require(_0x8b75('0x1'));var moment=require(_0x8b75('0x2'));var BPromise=require(_0x8b75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b75('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b75('0x5'));var logger=require('../../config/logger')(_0x8b75('0x6'));var config=require(_0x8b75('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8b75('0x8')][_0x8b75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c9e1a,_0xaa3b53,_0x2a613b){return new BPromise(function(_0x46badf,_0xe55857){return client[_0x8b75('0xa')](_0x2c9e1a,_0x2a613b)[_0x8b75('0xb')](function(_0x137eb5){logger[_0x8b75('0xc')](_0x8b75('0xd'),_0xaa3b53,'request\x20sent');logger[_0x8b75('0xe')](_0x8b75('0xf'),_0xaa3b53,_0x8b75('0x10'),JSON[_0x8b75('0x11')](_0x137eb5));if(_0x137eb5[_0x8b75('0x12')]){if(_0x137eb5[_0x8b75('0x12')][_0x8b75('0x13')]===0x1f4){logger['error'](_0x8b75('0xd'),_0xaa3b53,_0x137eb5[_0x8b75('0x12')]['message']);return _0xe55857(_0x137eb5[_0x8b75('0x12')]['message']);}logger[_0x8b75('0x12')](_0x8b75('0xd'),_0xaa3b53,_0x137eb5[_0x8b75('0x12')][_0x8b75('0x14')]);return _0x46badf(_0x137eb5[_0x8b75('0x12')][_0x8b75('0x14')]);}else{logger[_0x8b75('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0xaa3b53,_0x8b75('0x10'));_0x46badf(_0x137eb5[_0x8b75('0x15')][_0x8b75('0x14')]);}})[_0x8b75('0x16')](function(_0x1aed0a){logger[_0x8b75('0x12')](_0x8b75('0xd'),_0xaa3b53,_0x1aed0a);_0xe55857(_0x1aed0a);});});} \ No newline at end of file +var _0x7dbc=['error','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xc3a6e5,_0xd127d7){var _0x3cc63c=function(_0x10280d){while(--_0x10280d){_0xc3a6e5['push'](_0xc3a6e5['shift']());}};_0x3cc63c(++_0xd127d7);}(_0x7dbc,0xe0));var _0xc7db=function(_0x4b25f4,_0x50ecc2){_0x4b25f4=_0x4b25f4-0x0;var _0xe7740d=_0x7dbc[_0x4b25f4];return _0xe7740d;};'use strict';var _=require(_0xc7db('0x0'));var util=require(_0xc7db('0x1'));var moment=require(_0xc7db('0x2'));var BPromise=require('bluebird');var rs=require(_0xc7db('0x3'));var fs=require('fs');var Redis=require(_0xc7db('0x4'));var db=require(_0xc7db('0x5'))['db'];var utils=require(_0xc7db('0x6'));var logger=require('../../config/logger')(_0xc7db('0x7'));var config=require(_0xc7db('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc7db('0x9')][_0xc7db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x385922,_0x25c524,_0xab22e){return new BPromise(function(_0xd44058,_0x192457){return client['request'](_0x385922,_0xab22e)['then'](function(_0x268160){logger['info'](_0xc7db('0xb'),_0x25c524,_0xc7db('0xc'));logger[_0xc7db('0xd')](_0xc7db('0xe'),_0x25c524,_0xc7db('0xc'),JSON[_0xc7db('0xf')](_0x268160));if(_0x268160[_0xc7db('0x10')]){if(_0x268160['error']['code']===0x1f4){logger[_0xc7db('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x25c524,_0x268160[_0xc7db('0x10')][_0xc7db('0x11')]);return _0x192457(_0x268160[_0xc7db('0x10')]['message']);}logger[_0xc7db('0x10')](_0xc7db('0xb'),_0x25c524,_0x268160[_0xc7db('0x10')]['message']);return _0xd44058(_0x268160[_0xc7db('0x10')][_0xc7db('0x11')]);}else{logger[_0xc7db('0x12')](_0xc7db('0xb'),_0x25c524,_0xc7db('0xc'));_0xd44058(_0x268160['result'][_0xc7db('0x11')]);}})[_0xc7db('0x13')](function(_0x4f95f3){logger[_0xc7db('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x25c524,_0x4f95f3);_0x192457(_0x4f95f3);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 0357227..7385f5e 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 _0x65fd=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65fd,0x116));var _0xd65f=function(_0x2b9bd6,_0x1d4770){_0x2b9bd6=_0x2b9bd6-0x0;var _0x51d506=_0x65fd[_0x2b9bd6];return _0x51d506;};'use strict';var multer=require(_0xd65f('0x0'));var util=require(_0xd65f('0x1'));var path=require(_0xd65f('0x2'));var timeout=require(_0xd65f('0x3'));var express=require(_0xd65f('0x4'));var router=express[_0xd65f('0x5')]();var auth=require(_0xd65f('0x6'));var interaction=require(_0xd65f('0x7'));var config=require('../../config/environment');module[_0xd65f('0x8')]=router; \ No newline at end of file +var _0xd477=['../../components/interaction/service','../../config/environment','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x4efb70,_0x53b9e1){var _0x529d05=function(_0xa44c8b){while(--_0xa44c8b){_0x4efb70['push'](_0x4efb70['shift']());}};_0x529d05(++_0x53b9e1);}(_0xd477,0x1bb));var _0x7d47=function(_0x34bbd5,_0x3c810a){_0x34bbd5=_0x34bbd5-0x0;var _0x46244f=_0xd477[_0x34bbd5];return _0x46244f;};'use strict';var multer=require(_0x7d47('0x0'));var util=require('util');var path=require(_0x7d47('0x1'));var timeout=require('connect-timeout');var express=require(_0x7d47('0x2'));var router=express[_0x7d47('0x3')]();var auth=require(_0x7d47('0x4'));var interaction=require(_0x7d47('0x5'));var config=require(_0x7d47('0x6'));module[_0x7d47('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index f9915cd..7a40326 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 _0xb10b=['sequelize','INTEGER'];(function(_0x20bddf,_0x2f8c4e){var _0x178f0a=function(_0x234fe7){while(--_0x234fe7){_0x20bddf['push'](_0x20bddf['shift']());}};_0x178f0a(++_0x2f8c4e);}(_0xb10b,0x12a));var _0xbb10=function(_0x56fbb6,_0x570f05){_0x56fbb6=_0x56fbb6-0x0;var _0x4e9a77=_0xb10b[_0x56fbb6];return _0x4e9a77;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x51e070,_0x4d157b){var _0x16772c=function(_0x4f4e1a){while(--_0x4f4e1a){_0x51e070['push'](_0x51e070['shift']());}};_0x16772c(++_0x4d157b);}(_0xe706,0xa3));var _0x6e70=function(_0x11bb60,_0x3dc734){_0x11bb60=_0x11bb60-0x0;var _0x37357e=_0xe706[_0x11bb60];return _0x37357e;};'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 f5af499..36aed68 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 _0x757a=['define','user_has_mail_queues','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x757a,0xde));var _0xa757=function(_0x5060fa,_0x3fe9bb){_0x5060fa=_0x5060fa-0x0;var _0x5c8a00=_0x757a[_0x5060fa];return _0x5c8a00;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('UserMailQueue',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','user_has_mail_queues','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x254f29,_0x4c3a72){var _0x12783f=function(_0x371dbb){while(--_0x371dbb){_0x254f29['push'](_0x254f29['shift']());}};_0x12783f(++_0x4c3a72);}(_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('./userMailQueue.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('UserMailQueue',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index ab93af9..73b48f7 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 _0x8f05=['info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request'];(function(_0x31dbed,_0x303979){var _0x5ed9bd=function(_0x401ca2){while(--_0x401ca2){_0x31dbed['push'](_0x31dbed['shift']());}};_0x5ed9bd(++_0x303979);}(_0x8f05,0x1cb));var _0x58f0=function(_0x318a20,_0x365c1d){_0x318a20=_0x318a20-0x0;var _0x38b849=_0x8f05[_0x318a20];return _0x38b849;};'use strict';var _=require(_0x58f0('0x0'));var util=require(_0x58f0('0x1'));var moment=require(_0x58f0('0x2'));var BPromise=require('bluebird');var rs=require(_0x58f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58f0('0x4'))['db'];var utils=require(_0x58f0('0x5'));var logger=require('../../config/logger')(_0x58f0('0x6'));var config=require(_0x58f0('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x430b86,_0x114ec6,_0x264693){return new BPromise(function(_0x4a95e2,_0x148bf1){return client[_0x58f0('0x8')](_0x430b86,_0x264693)['then'](function(_0x5bea04){logger[_0x58f0('0x9')](_0x58f0('0xa'),_0x114ec6,_0x58f0('0xb'));logger[_0x58f0('0xc')](_0x58f0('0xd'),_0x114ec6,_0x58f0('0xb'),JSON['stringify'](_0x5bea04));if(_0x5bea04[_0x58f0('0xe')]){if(_0x5bea04[_0x58f0('0xe')][_0x58f0('0xf')]===0x1f4){logger[_0x58f0('0xe')](_0x58f0('0xa'),_0x114ec6,_0x5bea04['error'][_0x58f0('0x10')]);return _0x148bf1(_0x5bea04['error'][_0x58f0('0x10')]);}logger[_0x58f0('0xe')](_0x58f0('0xa'),_0x114ec6,_0x5bea04[_0x58f0('0xe')][_0x58f0('0x10')]);return _0x4a95e2(_0x5bea04[_0x58f0('0xe')]['message']);}else{logger[_0x58f0('0x9')](_0x58f0('0xa'),_0x114ec6,_0x58f0('0xb'));_0x4a95e2(_0x5bea04[_0x58f0('0x11')][_0x58f0('0x10')]);}})['catch'](function(_0x3b40a8){logger['error'](_0x58f0('0xa'),_0x114ec6,_0x3b40a8);_0x148bf1(_0x3b40a8);});});} \ No newline at end of file +var _0xe984=['UserMailQueue,\x20%s,\x20%s','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x438dc5,_0x41922c){var _0x27a0a1=function(_0x1d49ba){while(--_0x1d49ba){_0x438dc5['push'](_0x438dc5['shift']());}};_0x27a0a1(++_0x41922c);}(_0xe984,0xe2));var _0x4e98=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xe984[_0x2642cb];return _0xe6e41;};'use strict';var _=require('lodash');var util=require(_0x4e98('0x0'));var moment=require(_0x4e98('0x1'));var BPromise=require(_0x4e98('0x2'));var rs=require(_0x4e98('0x3'));var fs=require('fs');var Redis=require(_0x4e98('0x4'));var db=require(_0x4e98('0x5'))['db'];var utils=require(_0x4e98('0x6'));var logger=require(_0x4e98('0x7'))(_0x4e98('0x8'));var config=require(_0x4e98('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4e98('0xa')][_0x4e98('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29d7a7,_0xf7f079,_0x54e926){return new BPromise(function(_0x45998,_0x402bdf){return client[_0x4e98('0xc')](_0x29d7a7,_0x54e926)[_0x4e98('0xd')](function(_0x156056){logger['info'](_0x4e98('0xe'),_0xf7f079,'request\x20sent');logger[_0x4e98('0xf')](_0x4e98('0x10'),_0xf7f079,_0x4e98('0x11'),JSON[_0x4e98('0x12')](_0x156056));if(_0x156056[_0x4e98('0x13')]){if(_0x156056['error'][_0x4e98('0x14')]===0x1f4){logger[_0x4e98('0x13')](_0x4e98('0xe'),_0xf7f079,_0x156056['error'][_0x4e98('0x15')]);return _0x402bdf(_0x156056['error'][_0x4e98('0x15')]);}logger[_0x4e98('0x13')](_0x4e98('0xe'),_0xf7f079,_0x156056[_0x4e98('0x13')]['message']);return _0x45998(_0x156056[_0x4e98('0x13')][_0x4e98('0x15')]);}else{logger[_0x4e98('0x16')](_0x4e98('0xe'),_0xf7f079,_0x4e98('0x11'));_0x45998(_0x156056['result'][_0x4e98('0x15')]);}})[_0x4e98('0x17')](function(_0x26b60a){logger[_0x4e98('0x13')](_0x4e98('0xe'),_0xf7f079,_0x26b60a);_0x402bdf(_0x26b60a);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 4a8c3fe..fc73ad3 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 _0x3782=['util','path','../../components/auth/service','../../config/environment'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0x3782,0x1f0));var _0x2378=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3782[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x2378('0x0'));var path=require(_0x2378('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x2378('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x2378('0x3'));module['exports']=router; \ No newline at end of file +var _0xf91a=['express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x15472b,_0x2f0c29){var _0x34194c=function(_0x3a80f6){while(--_0x3a80f6){_0x15472b['push'](_0x15472b['shift']());}};_0x34194c(++_0x2f0c29);}(_0xf91a,0x1b5));var _0xaf91=function(_0x427ed8,_0x2cf5b4){_0x427ed8=_0x427ed8-0x0;var _0x556b1b=_0xf91a[_0x427ed8];return _0x556b1b;};'use strict';var multer=require(_0xaf91('0x0'));var util=require(_0xaf91('0x1'));var path=require(_0xaf91('0x2'));var timeout=require(_0xaf91('0x3'));var express=require(_0xaf91('0x4'));var router=express[_0xaf91('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xaf91('0x6'));var config=require(_0xaf91('0x7'));module[_0xaf91('0x8')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 1b65eaa..4dd06de 100644 --- a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js +++ b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x51a67e,_0x16525f){var _0x461dee=function(_0x3cc3c4){while(--_0x3cc3c4){_0x51a67e['push'](_0x51a67e['shift']());}};_0x461dee(++_0x16525f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x3b53b0,_0x23dc58){var _0x4eddc6=function(_0x46254f){while(--_0x46254f){_0x3b53b0['push'](_0x3b53b0['shift']());}};_0x4eddc6(++_0x23dc58);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index f5dc40e..5277f4f 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 _0x0681=['path','rimraf','../../config/environment','exports','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','moment','bluebird'];(function(_0x1afab8,_0x1b06a8){var _0x20e0d3=function(_0x46db9b){while(--_0x46db9b){_0x1afab8['push'](_0x1afab8['shift']());}};_0x20e0d3(++_0x1b06a8);}(_0x0681,0x1e6));var _0x1068=function(_0x410adb,_0x268880){_0x410adb=_0x410adb-0x0;var _0x358887=_0x0681[_0x410adb];return _0x358887;};'use strict';var _=require('lodash');var util=require(_0x1068('0x0'));var logger=require(_0x1068('0x1'))('api');var moment=require(_0x1068('0x2'));var BPromise=require(_0x1068('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1068('0x4'));var rimraf=require(_0x1068('0x5'));var config=require(_0x1068('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x1068('0x7')]=function(_0x96961a,_0x31d173){return _0x96961a['define'](_0x1068('0x8'),attributes,{'tableName':_0x1068('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb8a1=['moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0xb8a1,0x1d2));var _0x1b8a=function(_0x5dc28e,_0x2d1c95){_0x5dc28e=_0x5dc28e-0x0;var _0x1b262d=_0xb8a1[_0x5dc28e];return _0x1b262d;};'use strict';var _=require(_0x1b8a('0x0'));var util=require('util');var logger=require(_0x1b8a('0x1'))('api');var moment=require(_0x1b8a('0x2'));var BPromise=require(_0x1b8a('0x3'));var rp=require(_0x1b8a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b8a('0x5'));var config=require(_0x1b8a('0x6'));var attributes=require(_0x1b8a('0x7'));module[_0x1b8a('0x8')]=function(_0x216fc2,_0x44be62){return _0x216fc2[_0x1b8a('0x9')](_0x1b8a('0xa'),attributes,{'tableName':_0x1b8a('0xb'),'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 c1fe65f..ef6b5ab 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 _0xf41b=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis'];(function(_0x3a0ba6,_0x1b7b02){var _0x13b2cf=function(_0x5bd286){while(--_0x5bd286){_0x3a0ba6['push'](_0x3a0ba6['shift']());}};_0x13b2cf(++_0x1b7b02);}(_0xf41b,0x130));var _0xbf41=function(_0x5ebf44,_0x4e543e){_0x5ebf44=_0x5ebf44-0x0;var _0x2fef12=_0xf41b[_0x5ebf44];return _0x2fef12;};'use strict';var _=require(_0xbf41('0x0'));var util=require(_0xbf41('0x1'));var moment=require(_0xbf41('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf41('0x3'));var db=require(_0xbf41('0x4'))['db'];var utils=require(_0xbf41('0x5'));var logger=require(_0xbf41('0x6'))(_0xbf41('0x7'));var config=require(_0xbf41('0x8'));var jayson=require(_0xbf41('0x9'));var client=jayson[_0xbf41('0xa')][_0xbf41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x429de7,_0x5dae95,_0x1bc0f6){return new BPromise(function(_0x1d45d6,_0x5e430d){return client[_0xbf41('0xc')](_0x429de7,_0x1bc0f6)[_0xbf41('0xd')](function(_0x2ab0da){logger[_0xbf41('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5dae95,_0xbf41('0xf'));logger['debug'](_0xbf41('0x10'),_0x5dae95,'request\x20sent',JSON['stringify'](_0x2ab0da));if(_0x2ab0da[_0xbf41('0x11')]){if(_0x2ab0da['error']['code']===0x1f4){logger['error'](_0xbf41('0x12'),_0x5dae95,_0x2ab0da[_0xbf41('0x11')]['message']);return _0x5e430d(_0x2ab0da[_0xbf41('0x11')][_0xbf41('0x13')]);}logger['error'](_0xbf41('0x12'),_0x5dae95,_0x2ab0da[_0xbf41('0x11')][_0xbf41('0x13')]);return _0x1d45d6(_0x2ab0da[_0xbf41('0x11')][_0xbf41('0x13')]);}else{logger[_0xbf41('0xe')](_0xbf41('0x12'),_0x5dae95,_0xbf41('0xf'));_0x1d45d6(_0x2ab0da[_0xbf41('0x14')]['message']);}})[_0xbf41('0x15')](function(_0x22157e){logger[_0xbf41('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5dae95,_0x22157e);_0x5e430d(_0x22157e);});});} \ No newline at end of file +var _0xabe4=['stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x23bcd4,_0xd3deb0){var _0x4cb792=function(_0x48d4c8){while(--_0x48d4c8){_0x23bcd4['push'](_0x23bcd4['shift']());}};_0x4cb792(++_0xd3deb0);}(_0xabe4,0xb6));var _0x4abe=function(_0x538a20,_0x5c14d6){_0x538a20=_0x538a20-0x0;var _0xec72f5=_0xabe4[_0x538a20];return _0xec72f5;};'use strict';var _=require(_0x4abe('0x0'));var util=require('util');var moment=require(_0x4abe('0x1'));var BPromise=require(_0x4abe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4abe('0x3'));var db=require(_0x4abe('0x4'))['db'];var utils=require(_0x4abe('0x5'));var logger=require(_0x4abe('0x6'))('rpc');var config=require(_0x4abe('0x7'));var jayson=require(_0x4abe('0x8'));var client=jayson[_0x4abe('0x9')][_0x4abe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19ac36,_0x4e37ff,_0x2bb39a){return new BPromise(function(_0x5981b1,_0x4d85e1){return client[_0x4abe('0xb')](_0x19ac36,_0x2bb39a)[_0x4abe('0xc')](function(_0x529a8b){logger['info'](_0x4abe('0xd'),_0x4e37ff,_0x4abe('0xe'));logger[_0x4abe('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x4e37ff,_0x4abe('0xe'),JSON[_0x4abe('0x10')](_0x529a8b));if(_0x529a8b[_0x4abe('0x11')]){if(_0x529a8b['error'][_0x4abe('0x12')]===0x1f4){logger[_0x4abe('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4e37ff,_0x529a8b[_0x4abe('0x11')][_0x4abe('0x13')]);return _0x4d85e1(_0x529a8b[_0x4abe('0x11')][_0x4abe('0x13')]);}logger[_0x4abe('0x11')](_0x4abe('0xd'),_0x4e37ff,_0x529a8b[_0x4abe('0x11')]['message']);return _0x5981b1(_0x529a8b[_0x4abe('0x11')]['message']);}else{logger['info'](_0x4abe('0xd'),_0x4e37ff,'request\x20sent');_0x5981b1(_0x529a8b[_0x4abe('0x14')][_0x4abe('0x13')]);}})[_0x4abe('0x15')](function(_0x3b729c){logger[_0x4abe('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4e37ff,_0x3b729c);_0x4d85e1(_0x3b729c);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 3a411a5..0edded1 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 _0x2f90=['/:id','show','/:id/sections','getSections','getResources','post','create','clone','addSections','/:id/resources','addResources','put','delete','destroy','removeSections','removeResources','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated'];(function(_0x37a3ad,_0x17b136){var _0x3615a6=function(_0x2e3837){while(--_0x2e3837){_0x37a3ad['push'](_0x37a3ad['shift']());}};_0x3615a6(++_0x17b136);}(_0x2f90,0xce));var _0x02f9=function(_0x18dd23,_0x1ca58d){_0x18dd23=_0x18dd23-0x0;var _0x22eb36=_0x2f90[_0x18dd23];return _0x22eb36;};'use strict';var multer=require(_0x02f9('0x0'));var util=require(_0x02f9('0x1'));var path=require('path');var timeout=require(_0x02f9('0x2'));var express=require(_0x02f9('0x3'));var router=express[_0x02f9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x02f9('0x5'));var config=require(_0x02f9('0x6'));var controller=require(_0x02f9('0x7'));router[_0x02f9('0x8')]('/',auth[_0x02f9('0x9')](),controller['index']);router[_0x02f9('0x8')]('/describe',auth[_0x02f9('0x9')](),controller['describe']);router[_0x02f9('0x8')](_0x02f9('0xa'),auth[_0x02f9('0x9')](),controller[_0x02f9('0xb')]);router['get'](_0x02f9('0xc'),auth['isAuthenticated'](),controller[_0x02f9('0xd')]);router[_0x02f9('0x8')]('/:id/resources',auth['isAuthenticated'](),controller[_0x02f9('0xe')]);router[_0x02f9('0xf')]('/',auth[_0x02f9('0x9')](),controller[_0x02f9('0x10')]);router[_0x02f9('0xf')]('/:id/clone',auth['isAuthenticated'](),controller[_0x02f9('0x11')]);router[_0x02f9('0xf')]('/:id/sections',auth['isAuthenticated'](),controller[_0x02f9('0x12')]);router['post'](_0x02f9('0x13'),auth['isAuthenticated'](),controller[_0x02f9('0x14')]);router[_0x02f9('0x15')](_0x02f9('0xa'),auth[_0x02f9('0x9')](),controller['update']);router[_0x02f9('0x16')]('/:id',auth[_0x02f9('0x9')](),controller[_0x02f9('0x17')]);router['delete'](_0x02f9('0xc'),auth['isAuthenticated'](),controller[_0x02f9('0x18')]);router['delete'](_0x02f9('0x13'),auth[_0x02f9('0x9')](),controller[_0x02f9('0x19')]);module[_0x02f9('0x1a')]=router; \ No newline at end of file +var _0x107a=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show','/:id/sections','/:id/resources','getResources','create','/:id/clone','post','addResources','put','update','delete','destroy','removeSections','exports','multer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x107a,0x19f));var _0xa107=function(_0x32e455,_0x424d87){_0x32e455=_0x32e455-0x0;var _0x4c65cc=_0x107a[_0x32e455];return _0x4c65cc;};'use strict';var multer=require(_0xa107('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa107('0x1'));var express=require(_0xa107('0x2'));var router=express[_0xa107('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xa107('0x4'));var config=require(_0xa107('0x5'));var controller=require(_0xa107('0x6'));router[_0xa107('0x7')]('/',auth[_0xa107('0x8')](),controller[_0xa107('0x9')]);router[_0xa107('0x7')]('/describe',auth[_0xa107('0x8')](),controller[_0xa107('0xa')]);router[_0xa107('0x7')](_0xa107('0xb'),auth[_0xa107('0x8')](),controller[_0xa107('0xc')]);router[_0xa107('0x7')](_0xa107('0xd'),auth[_0xa107('0x8')](),controller['getSections']);router['get'](_0xa107('0xe'),auth['isAuthenticated'](),controller[_0xa107('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa107('0x10')]);router['post'](_0xa107('0x11'),auth['isAuthenticated'](),controller['clone']);router[_0xa107('0x12')]('/:id/sections',auth[_0xa107('0x8')](),controller['addSections']);router['post']('/:id/resources',auth[_0xa107('0x8')](),controller[_0xa107('0x13')]);router[_0xa107('0x14')](_0xa107('0xb'),auth[_0xa107('0x8')](),controller[_0xa107('0x15')]);router[_0xa107('0x16')](_0xa107('0xb'),auth[_0xa107('0x8')](),controller[_0xa107('0x17')]);router['delete'](_0xa107('0xd'),auth['isAuthenticated'](),controller[_0xa107('0x18')]);router['delete']('/:id/resources',auth[_0xa107('0x8')](),controller['removeResources']);module[_0xa107('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 fefe680..635085b 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 _0x2b39=['setDataValue','crudPermissions','getDataValue','split','sequelize','exports','STRING','name'];(function(_0x290f93,_0x215410){var _0x37de3c=function(_0x1ab5e5){while(--_0x1ab5e5){_0x290f93['push'](_0x290f93['shift']());}};_0x37de3c(++_0x215410);}(_0x2b39,0x11c));var _0x92b3=function(_0x234869,_0x25ce29){_0x234869=_0x234869-0x0;var _0xdc5c37=_0x2b39[_0x234869];return _0xdc5c37;};'use strict';var Sequelize=require(_0x92b3('0x0'));module[_0x92b3('0x1')]={'name':{'type':Sequelize[_0x92b3('0x2')],'allowNull':![],'unique':_0x92b3('0x3')},'crudPermissions':{'type':Sequelize[_0x92b3('0x2')],'set':function(_0x4bbacd){this[_0x92b3('0x4')](_0x92b3('0x5'),_0x4bbacd?_0x4bbacd['join'](''):[]);},'get':function(){return this[_0x92b3('0x6')](_0x92b3('0x5'))?this[_0x92b3('0x6')](_0x92b3('0x5'))[_0x92b3('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x92b3('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xeec0=['setDataValue','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x3b5dcf,_0x1a6d96){var _0xb3ed7b=function(_0x1206fe){while(--_0x1206fe){_0x3b5dcf['push'](_0x3b5dcf['shift']());}};_0xb3ed7b(++_0x1a6d96);}(_0xeec0,0x98));var _0x0eec=function(_0x37e714,_0x117142){_0x37e714=_0x37e714-0x0;var _0x16c12e=_0xeec0[_0x37e714];return _0x16c12e;};'use strict';var Sequelize=require('sequelize');module[_0x0eec('0x0')]={'name':{'type':Sequelize[_0x0eec('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1e4bcb){this[_0x0eec('0x2')](_0x0eec('0x3'),_0x1e4bcb?_0x1e4bcb[_0x0eec('0x4')](''):[]);},'get':function(){return this[_0x0eec('0x5')]('crudPermissions')?this[_0x0eec('0x5')]('crudPermissions')[_0x0eec('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0eec('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index e6ec6ef..f22bd57 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 _0xab9f=['then','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','clone','get','omit','updatedAt','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','createdAt','userProfileId','Resources','describe','addSections','sequelize','removeSections','ids','getSections','includes','isEmpty','sectionId','subsections','enabled','findOne','Dashboard','forEach','push','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','undefined','ValidationError','Unknown\x20section','Invalid\x20section\x20\x27','parentSections','all','ignore','union','childModel','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','custom','CustomReports','CmContact','Tag','color','tag','ThroughTags','value','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projects','contacts','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','VoiceRecording','Agents','membername','User','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','musiconholds','VoiceMusicOnHold','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailAccount','mailsubstatuses','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsAccount','teams','Team','voicequeues','queuecampaigns','agents','telephones','Users','admin','user','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','Pause','Schedule','sounds','Sound','tags','templates','Template','triggers','Trigger','trunks','variables','plugins','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','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','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','error','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x5a85e9,_0x2f405e){var _0x4e925a=function(_0x5e9e9){while(--_0x5e9e9){_0x5a85e9['push'](_0x5a85e9['shift']());}};_0x4e925a(++_0x2f405e);}(_0xab9f,0x193));var _0xfab9=function(_0x39e8f5,_0xb151a6){_0x39e8f5=_0x39e8f5-0x0;var _0x346526=_0xab9f[_0x39e8f5];return _0x346526;};'use strict';var pdf=require(_0xfab9('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfab9('0x1'));var jsonpatch=require(_0xfab9('0x2'));var rp=require(_0xfab9('0x3'));var moment=require(_0xfab9('0x4'));var BPromise=require(_0xfab9('0x5'));var Mustache=require(_0xfab9('0x6'));var util=require(_0xfab9('0x7'));var path=require(_0xfab9('0x8'));var sox=require(_0xfab9('0x9'));var csv=require('to-csv');var ejs=require(_0xfab9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfab9('0xb'));var crypto=require('crypto');var jsforce=require(_0xfab9('0xc'));var deskjs=require(_0xfab9('0xd'));var toCsv=require(_0xfab9('0xe'));var querystring=require(_0xfab9('0xf'));var Papa=require(_0xfab9('0x10'));var Redis=require(_0xfab9('0x11'));var authService=require(_0xfab9('0x12'));var qs=require(_0xfab9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfab9('0x14'));var logger=require(_0xfab9('0x15'))(_0xfab9('0x16'));var utils=require(_0xfab9('0x17'));var config=require(_0xfab9('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xfab9('0x19')](config[_0xfab9('0x1a')],{'host':_0xfab9('0x1b'),'port':0x18eb});var socket=require(_0xfab9('0x1c'))(new Redis(config[_0xfab9('0x1a')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0xf4be12,_0x2a41dd){_0x2a41dd=_0x2a41dd||0xcc;return function(_0xaf9818){if(_0xaf9818){return _0xf4be12[_0xfab9('0x1d')](_0x2a41dd);}return _0xf4be12[_0xfab9('0x1e')](_0x2a41dd)[_0xfab9('0x1f')]();};}function respondWithResult(_0x2d41fa,_0x5e99d0){_0x5e99d0=_0x5e99d0||0xc8;return function(_0x2671ed){if(_0x2671ed){return _0x2d41fa[_0xfab9('0x1e')](_0x5e99d0)[_0xfab9('0x20')](_0x2671ed);}};}function respondWithFilteredResult(_0x384acb,_0x374fd9){return function(_0x430044){if(_0x430044){var _0x403789=_0x430044[_0xfab9('0x21')],_0x4f6118=_0x374fd9[_0xfab9('0x22')],_0x3a5c26=_0x374fd9[_0xfab9('0x22')]+_0x374fd9['limit'],_0x875ee6;if(_0x3a5c26>=_0x403789){_0x3a5c26=_0x403789;_0x875ee6=0xc8;}else{_0x875ee6=0xce;}_0x384acb[_0xfab9('0x1e')](_0x875ee6);return _0x384acb[_0xfab9('0x23')](_0xfab9('0x24'),_0x4f6118+'-'+_0x3a5c26+'/'+_0x403789)[_0xfab9('0x20')](_0x430044);}return null;};}function patchUpdates(_0x546820){return function(_0x5d7e75){try{jsonpatch[_0xfab9('0x25')](_0x5d7e75,_0x546820,!![]);}catch(_0x18de2e){return BPromise[_0xfab9('0x26')](_0x18de2e);}return _0x5d7e75['save']();};}function saveUpdates(_0x1298d6,_0x484e0b){return function(_0x17a0ce){if(_0x17a0ce){return _0x17a0ce[_0xfab9('0x27')](_0x1298d6)['then'](function(_0x3e7d20){return _0x3e7d20;});}return null;};}function removeEntity(_0x3070a6,_0x365ac0){return function(_0x28c7c2){if(_0x28c7c2){return _0x28c7c2[_0xfab9('0x28')]()['then'](function(){_0x3070a6[_0xfab9('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18c571,_0x2b94e5){return function(_0x52a5b0){if(!_0x52a5b0){_0x18c571['sendStatus'](0x194);}return _0x52a5b0;};}function handleError(_0x287863,_0x15097f){_0x15097f=_0x15097f||0x1f4;return function(_0x3a84cc){logger[_0xfab9('0x29')](_0x3a84cc['stack']);if(_0x3a84cc[_0xfab9('0x2a')]){delete _0x3a84cc[_0xfab9('0x2a')];}_0x287863['status'](_0x15097f)[_0xfab9('0x2b')](_0x3a84cc);};}exports[_0xfab9('0x2c')]=function(_0x4f5042,_0x1cd66b){var _0x50d248={},_0x4479f1={},_0x2f663d={'count':0x0,'rows':[]};var _0x11f11d=_[_0xfab9('0x2d')](db[_0xfab9('0x2e')][_0xfab9('0x2f')],function(_0x68065b){return{'name':_0x68065b[_0xfab9('0x30')],'type':_0x68065b[_0xfab9('0x31')][_0xfab9('0x32')]};});_0x4479f1[_0xfab9('0x33')]=_[_0xfab9('0x2d')](_0x11f11d,_0xfab9('0x2a'));_0x4479f1[_0xfab9('0x34')]=_[_0xfab9('0x35')](_0x4f5042[_0xfab9('0x34')]);_0x4479f1['filters']=_[_0xfab9('0x36')](_0x4479f1[_0xfab9('0x33')],_0x4479f1[_0xfab9('0x34')]);_0x50d248[_0xfab9('0x37')]=_['intersection'](_0x4479f1[_0xfab9('0x33')],qs[_0xfab9('0x38')](_0x4f5042[_0xfab9('0x34')][_0xfab9('0x38')]));_0x50d248[_0xfab9('0x37')]=_0x50d248[_0xfab9('0x37')][_0xfab9('0x39')]?_0x50d248['attributes']:_0x4479f1[_0xfab9('0x33')];if(!_0x4f5042[_0xfab9('0x34')][_0xfab9('0x3a')](_0xfab9('0x3b'))){_0x50d248['limit']=qs[_0xfab9('0x3c')](_0x4f5042['query'][_0xfab9('0x3c')]);_0x50d248[_0xfab9('0x22')]=qs[_0xfab9('0x22')](_0x4f5042['query']['offset']);}_0x50d248[_0xfab9('0x3d')]=qs[_0xfab9('0x3e')](_0x4f5042['query']['sort']);_0x50d248[_0xfab9('0x3f')]=qs[_0xfab9('0x40')](_[_0xfab9('0x41')](_0x4f5042[_0xfab9('0x34')],_0x4479f1[_0xfab9('0x40')]));if(_0x4f5042[_0xfab9('0x34')][_0xfab9('0x42')]){_0x50d248[_0xfab9('0x3f')]=_[_0xfab9('0x43')](_0x50d248[_0xfab9('0x3f')],{'$or':_[_0xfab9('0x2d')](_0x11f11d,function(_0x6d81c){if(_0x6d81c[_0xfab9('0x31')]!==_0xfab9('0x44')){var _0x296ff1={};_0x296ff1[_0x6d81c[_0xfab9('0x2a')]]={'$like':'%'+_0x4f5042[_0xfab9('0x34')][_0xfab9('0x42')]+'%'};return _0x296ff1;}})});}_0x50d248=_['merge']({},_0x50d248,_0x4f5042['options']);var _0x1c1cb8={'where':_0x50d248['where']};return db[_0xfab9('0x2e')]['count'](_0x1c1cb8)[_0xfab9('0x45')](function(_0x39deea){_0x2f663d[_0xfab9('0x21')]=_0x39deea;if(_0x4f5042['query'][_0xfab9('0x46')]){_0x50d248['include']=[{'all':!![]}];}return db[_0xfab9('0x2e')][_0xfab9('0x47')](_0x50d248);})[_0xfab9('0x45')](function(_0x4c17a0){_0x2f663d[_0xfab9('0x48')]=_0x4c17a0;return _0x2f663d;})['then'](respondWithFilteredResult(_0x1cd66b,_0x50d248))[_0xfab9('0x49')](handleError(_0x1cd66b,null));};exports[_0xfab9('0x4a')]=function(_0x4f3e4c,_0x10c96b){var _0x41322f={'raw':![],'where':{'id':_0x4f3e4c[_0xfab9('0x4b')]['id']}},_0x50ee47={};_0x50ee47[_0xfab9('0x33')]=_[_0xfab9('0x35')](db['UserProfile'][_0xfab9('0x2f')]);_0x50ee47['query']=_['keys'](_0x4f3e4c[_0xfab9('0x34')]);_0x50ee47[_0xfab9('0x40')]=_[_0xfab9('0x36')](_0x50ee47[_0xfab9('0x33')],_0x50ee47[_0xfab9('0x34')]);_0x41322f[_0xfab9('0x37')]=_[_0xfab9('0x36')](_0x50ee47['model'],qs[_0xfab9('0x38')](_0x4f3e4c[_0xfab9('0x34')]['fields']));_0x41322f[_0xfab9('0x37')]=_0x41322f['attributes'][_0xfab9('0x39')]?_0x41322f[_0xfab9('0x37')]:_0x50ee47[_0xfab9('0x33')];if(_0x4f3e4c[_0xfab9('0x34')][_0xfab9('0x46')]){_0x41322f[_0xfab9('0x4c')]=[{'all':!![]}];}_0x41322f=_[_0xfab9('0x43')]({},_0x41322f,_0x4f3e4c[_0xfab9('0x4d')]);return db[_0xfab9('0x2e')][_0xfab9('0x4e')](_0x41322f)[_0xfab9('0x45')](handleEntityNotFound(_0x10c96b,null))[_0xfab9('0x45')](respondWithResult(_0x10c96b,null))[_0xfab9('0x49')](handleError(_0x10c96b,null));};exports['create']=function(_0x346927,_0x10ef78){return db[_0xfab9('0x2e')][_0xfab9('0x4f')](_0x346927[_0xfab9('0x50')],{})[_0xfab9('0x45')](respondWithResult(_0x10ef78,0xc9))[_0xfab9('0x49')](handleError(_0x10ef78,null));};exports[_0xfab9('0x51')]=function(_0x36089b,_0x44066e){var _0x4fa5a9={'where':{'id':_0x36089b[_0xfab9('0x4b')]['id']}},_0x5d04aa={};_0x5d04aa['model']=_[_0xfab9('0x35')](db[_0xfab9('0x2e')]['rawAttributes']);_0x4fa5a9['attributes']=_[_0xfab9('0x36')](_0x5d04aa[_0xfab9('0x33')],qs['fields'](_0x36089b[_0xfab9('0x34')]['fields']));_0x4fa5a9[_0xfab9('0x37')]=_0x4fa5a9[_0xfab9('0x37')][_0xfab9('0x39')]?_0x4fa5a9['attributes']:_0x5d04aa[_0xfab9('0x33')];if(_0x36089b[_0xfab9('0x34')][_0xfab9('0x46')]){_0x4fa5a9[_0xfab9('0x4c')]=[{'all':!![]}];}_0x4fa5a9=_[_0xfab9('0x43')]({},_0x4fa5a9,_0x36089b[_0xfab9('0x4d')]);return db['UserProfile'][_0xfab9('0x4e')](_0x4fa5a9)[_0xfab9('0x45')](handleEntityNotFound(_0x44066e,null))[_0xfab9('0x45')](function(_0x248afd){if(_0x248afd){var _0x4dcc3f=_0x248afd[_0xfab9('0x52')]({'plain':!![]});_0x4dcc3f=qs['omit'](_0x4dcc3f,['id','createdAt','updatedAt','crudPermissions']);_0x36089b[_0xfab9('0x50')]=_[_0xfab9('0x53')](_0x36089b[_0xfab9('0x50')],['id','createdAt',_0xfab9('0x54')]);return db['sequelize'][_0xfab9('0x55')](function(_0x4bf0cf){return db[_0xfab9('0x2e')]['create'](_[_0xfab9('0x43')](_0x4dcc3f,_0x36089b[_0xfab9('0x50')]),{'include':_0x36089b[_0xfab9('0x34')][_0xfab9('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x4bf0cf})[_0xfab9('0x45')](function(_0x87ef25){var _0x3efe43=_0x87ef25[_0xfab9('0x52')]({'plain':!![]});return db[_0xfab9('0x56')][_0xfab9('0x47')]({'where':{'userProfileId':_0x36089b[_0xfab9('0x4b')]['id']},'raw':!![]})['then'](function(_0x45e9c7){if(_0x45e9c7){return BPromise[_0xfab9('0x57')](_0x45e9c7,function(_0x2d42e1){return new BPromise(function(_0x133370,_0x33e4c1){if(_0x2d42e1[_0xfab9('0x58')]===null||_0x2d42e1['autoAssociation']===0x1)_0x133370(null);return db[_0xfab9('0x59')][_0xfab9('0x47')]({'where':{'sectionId':_0x2d42e1['id']},'raw':!![]})[_0xfab9('0x45')](function(_0x545ef2){var _0x42b21c=_['map'](_0x545ef2,function(_0x302572){return qs[_0xfab9('0x53')](_0x302572,['id',_0xfab9('0x5a'),'updatedAt','sectionId']);});_0x133370(_0x42b21c);})[_0xfab9('0x49')](function(_0x2739b3){_0x33e4c1(_0x2739b3);});})[_0xfab9('0x45')](function(_0x5d5f8c){var _0x425216=qs[_0xfab9('0x53')](_0x2d42e1,['id',_0xfab9('0x5a'),_0xfab9('0x54')]);_0x425216[_0xfab9('0x5b')]=_0x3efe43['id'];if(_0x5d5f8c)_0x425216[_0xfab9('0x5c')]=_0x5d5f8c;return _0x425216;})['then'](function(_0x556886){return db[_0xfab9('0x56')][_0xfab9('0x4f')](_0x556886,{'include':[{'model':db[_0xfab9('0x59')],'as':_0xfab9('0x5c')}],'raw':!![],'transaction':_0x4bf0cf});});})[_0xfab9('0x45')](function(){return _0x3efe43;});}});});});}})[_0xfab9('0x45')](respondWithResult(_0x44066e,0xc9))[_0xfab9('0x49')](handleError(_0x44066e,null));};exports[_0xfab9('0x27')]=function(_0x40c47d,_0x4d5c96){if(_0x40c47d[_0xfab9('0x50')]['id']){delete _0x40c47d['body']['id'];}return db[_0xfab9('0x2e')][_0xfab9('0x4e')]({'where':{'id':_0x40c47d[_0xfab9('0x4b')]['id']}})[_0xfab9('0x45')](handleEntityNotFound(_0x4d5c96,null))[_0xfab9('0x45')](saveUpdates(_0x40c47d[_0xfab9('0x50')],null))[_0xfab9('0x45')](respondWithResult(_0x4d5c96,null))[_0xfab9('0x49')](handleError(_0x4d5c96,null));};exports['destroy']=function(_0x4542e2,_0x24dee9){return db[_0xfab9('0x2e')]['find']({'where':{'id':_0x4542e2[_0xfab9('0x4b')]['id']}})[_0xfab9('0x45')](handleEntityNotFound(_0x24dee9,null))[_0xfab9('0x45')](removeEntity(_0x24dee9,null))['catch'](handleError(_0x24dee9,null));};exports[_0xfab9('0x5d')]=function(_0x2ccab6,_0xcbf35e){return db[_0xfab9('0x2e')]['describe']()['then'](respondWithResult(_0xcbf35e,null))[_0xfab9('0x49')](handleError(_0xcbf35e,null));};exports[_0xfab9('0x5e')]=function(_0x167349,_0x14c92e){var _0x2df89a=_0x167349[_0xfab9('0x50')];return db[_0xfab9('0x2e')]['find']({'where':{'id':_0x167349['params']['id']}})['then'](handleEntityNotFound(_0x14c92e,null))[_0xfab9('0x45')](function(_0x4a582e){if(_0x4a582e){return db[_0xfab9('0x5f')]['transaction'](function(_0x13d5ac){return db[_0xfab9('0x56')][_0xfab9('0x28')]({'where':{'userProfileId':_0x167349['params']['id'],'sectionId':_['map'](_0x2df89a,function(_0x40596e){return _0x40596e['sectionId'];})},'transaction':_0x13d5ac})[_0xfab9('0x45')](function(){var _0x1858b5=_[_0xfab9('0x2d')](_0x2df89a,function(_0x18a985){_0x18a985[_0xfab9('0x5b')]=_0x167349[_0xfab9('0x4b')]['id'];return _0x18a985;});var _0x59bd13=[];return BPromise[_0xfab9('0x57')](_0x1858b5,function(_0x17b50e){return db[_0xfab9('0x56')][_0xfab9('0x4f')](_0x17b50e,{'include':[{'model':db[_0xfab9('0x59')],'as':_0xfab9('0x5c')}],'raw':!![],'transaction':_0x13d5ac})[_0xfab9('0x45')](function(_0x21a91c){_0x59bd13['push'](_0x21a91c['get']({'plain':!![]}));});})['then'](function(){return _0x59bd13;});});});}})['then'](function(_0x4325bb){return _0x4325bb;})[_0xfab9('0x45')](respondWithResult(_0x14c92e,null))['catch'](handleError(_0x14c92e,null));};exports[_0xfab9('0x60')]=function(_0x19b26c,_0x2a4c43){var _0x5bdfd2;return db['UserProfile']['find']({'where':{'id':_0x19b26c[_0xfab9('0x4b')]['id']},'attributes':['id',_0xfab9('0x2a')]})['then'](handleEntityNotFound(_0x2a4c43,null))[_0xfab9('0x45')](function(_0x457e47){if(_0x457e47){_0x5bdfd2=_0x457e47;return db[_0xfab9('0x56')][_0xfab9('0x28')]({'where':{'userProfileId':_0x19b26c['params']['id'],'sectionId':_0x19b26c[_0xfab9('0x34')][_0xfab9('0x61')]}});}})['then'](function(){return _0x5bdfd2;})[_0xfab9('0x45')](respondWithStatusCode(_0x2a4c43,null))[_0xfab9('0x49')](handleError(_0x2a4c43,null));};exports[_0xfab9('0x62')]=function(_0x183c02,_0x5ccbdf){var _0x4dcfe6=[];var _0x4e643e=[];return db[_0xfab9('0x56')][_0xfab9('0x47')]({'where':{'userProfileId':_0x183c02[_0xfab9('0x4b')]['id']},'raw':!![]})[_0xfab9('0x45')](function(_0x4a3ea7){_0x4dcfe6=_['filter'](_0x4a3ea7,function(_0x51c957){return _0x51c957['enabled']===0x1||_[_0xfab9('0x63')]([0x3eb,0x709],_0x51c957['sectionId']);});if(!_[_0xfab9('0x64')](_0x4dcfe6)){return _[_0xfab9('0x2d')](_0x4dcfe6,function(_0xa1b357){return _0xa1b357[_0xfab9('0x65')];});}else{return;}})[_0xfab9('0x45')](function(_0xb66233){if(_0xb66233)_0x4e643e=_0xb66233;if(_['includes'](_0x4e643e,0x64)){var _0x395dd8=_[_0xfab9('0x4e')](_0x4dcfe6,{'sectionId':0x64});return hasDefaultDashboard(_0x395dd8)[_0xfab9('0x45')](function(_0x20a7a7){return _[_0xfab9('0x2d')](_0x4dcfe6,function(_0x5a2e1c){if(_0x5a2e1c['sectionId']===0x64){_0x5a2e1c['subsections']=_0x20a7a7;}return _0x5a2e1c;});});}else{return;}})[_0xfab9('0x45')](function(_0x4c587a){if(_0x4c587a)_0x4dcfe6=_0x4c587a;if(_[_0xfab9('0x63')](_0x4e643e,0x3eb)){var _0x3dfc95=_[_0xfab9('0x4e')](_0x4dcfe6,{'sectionId':0x3eb});return getCustomDashboards(_0x3dfc95)[_0xfab9('0x45')](function(_0x101dc4){return _[_0xfab9('0x2d')](_0x4dcfe6,function(_0x5cf6d3){if(_0x3dfc95['enabled']){if(_0x5cf6d3[_0xfab9('0x65')]===0x3eb){_0x5cf6d3[_0xfab9('0x66')]=_0x101dc4;}}else{if(_0x5cf6d3[_0xfab9('0x65')]===0x64){_0x5cf6d3[_0xfab9('0x66')]=_0x101dc4;}}return _0x5cf6d3;});});}else{return;}})[_0xfab9('0x45')](function(_0x18b604){if(_0x18b604)_0x4dcfe6=_0x18b604;if(_['includes'](_0x4e643e,0x709)){var _0x3c9e9d=_[_0xfab9('0x4e')](_0x4dcfe6,{'sectionId':0x709});return getPlugins(_0x3c9e9d)[_0xfab9('0x45')](function(_0x10b2fd){if(_0x3c9e9d[_0xfab9('0x67')]){return _['map'](_0x4dcfe6,function(_0x63cf71){if(_0x63cf71[_0xfab9('0x65')]===0x709){_0x63cf71['subsections']=_0x10b2fd;}return _0x63cf71;});}else{var _0x4161d4={'sectionId':0x76c,'enabled':0x1,'subsections':_0x10b2fd};var _0x46bf5f=_['map'](_0x4dcfe6);_0x46bf5f['push'](_0x4161d4);return _0x46bf5f;}});}else{return;}})[_0xfab9('0x45')](function(_0x1f0cc4){if(_0x1f0cc4)_0x4dcfe6=_0x1f0cc4;return _[_0xfab9('0x42')](_0x4dcfe6,[_0xfab9('0x67'),0x1]);})[_0xfab9('0x45')](respondWithResult(_0x5ccbdf,null))[_0xfab9('0x49')](handleError(_0x5ccbdf,null));};function hasDefaultDashboard(_0x4555c4){var _0x17dee0=[0x65];return new BPromise(function(_0x482df5,_0x5436ab){try{if(_0x4555c4[_0xfab9('0x58')]){_0x482df5(_0x17dee0);}else{return db[_0xfab9('0x59')][_0xfab9('0x68')]({'where':{'sectionId':_0x4555c4['id']},'raw':!![]})[_0xfab9('0x45')](function(_0x4f9ef0){_0x4f9ef0?_0x482df5(_0x17dee0):_0x482df5();});}}catch(_0x5a593c){_0x5436ab(_0x5a593c);}});}function getCustomDashboards(_0x4b9faf){var _0x2cdfbd=[];return new BPromise(function(_0x3f4eda,_0x174c9b){try{if(_0x4b9faf[_0xfab9('0x58')]){return db[_0xfab9('0x69')][_0xfab9('0x47')]({'raw':!![]})[_0xfab9('0x45')](function(_0x2e5601){_0x2e5601[_0xfab9('0x6a')](function(_0x3ce3da){_0x2cdfbd[_0xfab9('0x6b')](_0x3ce3da['id']+0x1869f);});_0x3f4eda(_0x2cdfbd);});}else{return db[_0xfab9('0x59')]['findAll']({'where':{'sectionId':_0x4b9faf['id']},'raw':!![]})[_0xfab9('0x45')](function(_0x2f94a1){_0x2f94a1[_0xfab9('0x6a')](function(_0x2c4a94){_0x2cdfbd[_0xfab9('0x6b')](_0x2c4a94['resourceId']+0x1869f);});_0x3f4eda(_0x2cdfbd);});}}catch(_0x237a57){_0x174c9b(_0x237a57);}});}function getPlugins(_0x3fcb9a){var _0x3f6079=[];return new BPromise(function(_0x415033,_0xbeb940){try{if(_0x3fcb9a[_0xfab9('0x58')]){return db[_0xfab9('0x6c')][_0xfab9('0x47')]({'raw':!![]})[_0xfab9('0x45')](function(_0x31e817){_0x31e817[_0xfab9('0x6a')](function(_0x1a71f0){_0x3f6079[_0xfab9('0x6b')](_0x1a71f0['id']+0x15b38);});_0x415033(_0x3f6079);});}else{return db[_0xfab9('0x59')]['findAll']({'where':{'sectionId':_0x3fcb9a['id']},'raw':!![]})[_0xfab9('0x45')](function(_0x1f3aff){_0x1f3aff[_0xfab9('0x6a')](function(_0x2ba124){_0x3f6079[_0xfab9('0x6b')](_0x2ba124[_0xfab9('0x6d')]+0x15b38);});_0x415033(_0x3f6079);});}}catch(_0x1f55f3){_0xbeb940(_0x1f55f3);}});}exports[_0xfab9('0x6e')]=function(_0x5be4f6,_0x50983f){return db[_0xfab9('0x2e')][_0xfab9('0x4e')]({'where':{'id':_0x5be4f6[_0xfab9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x50983f,null))[_0xfab9('0x45')](function(_0x1adba2){if(_0x1adba2){return db['sequelize'][_0xfab9('0x55')](function(_0x3f6242){return db['UserProfileSection'][_0xfab9('0x47')]({'where':{'userProfileId':_0x5be4f6[_0xfab9('0x4b')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xf09f4d){if(_0xf09f4d){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x5be4f6['params']['id'],'id':_[_0xfab9('0x2d')](_0xf09f4d,function(_0x5d4c3b){return _0x5d4c3b['id'];})},'transaction':_0x3f6242});}})[_0xfab9('0x45')](function(_0xa118b6){var _0x2264d6=_[_0xfab9('0x2d')](_0x5be4f6[_0xfab9('0x50')],function(_0x2762bd){_0x2762bd[_0xfab9('0x5b')]=_0x5be4f6['params']['id'];return _0x2762bd;});return db['UserProfileSection'][_0xfab9('0x6f')](_0x2264d6,{'raw':!![],'transaction':_0x3f6242});})[_0xfab9('0x45')](function(_0x8cba5c){var _0x33a43a=_[_0xfab9('0x42')](_[_0xfab9('0x2d')](_0x8cba5c,function(_0x16bff5){return _0x16bff5[_0xfab9('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x33a43a){return db[_0xfab9('0x56')][_0xfab9('0x47')]({'where':{'userProfileId':_0x5be4f6[_0xfab9('0x4b')]['id'],'sectionId':_[_0xfab9('0x2d')](_0x33a43a,function(_0x5b46db){return _0x5b46db[_0xfab9('0x65')];})},'attributes':['id',_0xfab9('0x65')],'raw':!![]})['then'](function(_0xd3da79){var _0x26e3fa=_['map'](_0x5be4f6[_0xfab9('0x50')],function(_0x5dff59){_0x5dff59[_0xfab9('0x5b')]=_0x5be4f6['params']['id'];return _0x5dff59;});return db[_0xfab9('0x59')][_0xfab9('0x6f')](_0x26e3fa,{'raw':!![],'transaction':_0x3f6242});});}})[_0xfab9('0x49')](handleError(_0x50983f,null));});}})[_0xfab9('0x45')](function(_0x4f5f2c){var _0x594310=_['map'](_0x4f5f2c,function(_0x5d666a){return _0x5d666a[_0xfab9('0x52')]({'plain':!![]});});})[_0xfab9('0x45')](respondWithResult(_0x50983f,null))['catch'](handleError(_0x50983f,null));};exports[_0xfab9('0x70')]=function(_0xd26882,_0x3ef900,_0x5e9c04){return db[_0xfab9('0x2e')][_0xfab9('0x4e')]({'where':{'id':_0xd26882[_0xfab9('0x4b')]['id']}})[_0xfab9('0x45')](handleEntityNotFound(_0x3ef900,null))[_0xfab9('0x45')](function(_0x4339ab){if(_0x4339ab){return _0x4339ab['removeResources'](_0xd26882[_0xfab9('0x34')]['ids']);}})[_0xfab9('0x45')](respondWithStatusCode(_0x3ef900,null))[_0xfab9('0x49')](handleError(_0x3ef900,null));};exports[_0xfab9('0x71')]=function(_0x319ab8,_0x4e9551){var _0x17dbe4={'raw':![],'where':{}};var _0xe8f7d8={};var _0x47f481={'count':0x0,'rows':[]};var _0x45f85c=_0x319ab8[_0xfab9('0x34')][_0xfab9('0x72')];if(typeof _0x45f85c===_0xfab9('0x73')){throw new db['Sequelize'][(_0xfab9('0x74'))](_0xfab9('0x75'));}var _0x13d68f=_0x319ab8[_0xfab9('0x34')]['mergeResources']||![];var _0x42b0d7=getQueryModels(_0x45f85c,_0x13d68f);if(typeof _0x42b0d7['childModel']===_0xfab9('0x73')){throw new db['Sequelize'][(_0xfab9('0x74'))](_0xfab9('0x76')+_0x45f85c+'\x27');}var _0x53e0a4=[];if(!_[_0xfab9('0x64')](_0x42b0d7[_0xfab9('0x77')])){_0x53e0a4=_0x42b0d7['parentSections'];}else{_0x53e0a4=[{'name':_0x45f85c}];}return db[_0xfab9('0x2e')][_0xfab9('0x68')]({'where':{'id':_0x319ab8[_0xfab9('0x4b')]['id']}})[_0xfab9('0x45')](handleEntityNotFound(_0x4e9551,null))['then'](function(_0x4410ac){if(_0x4410ac){var _0x418ada=[];for(var _0x31f747=0x0;_0x31f747<_0x53e0a4['length'];_0x31f747++){_0x418ada['push'](db[_0xfab9('0x56')][_0xfab9('0x68')]({'where':{'userProfileId':_0x4410ac['id'],'name':_0x53e0a4[_0x31f747]['name']},'raw':!![]}));}return BPromise[_0xfab9('0x78')](_0x418ada);}})[_0xfab9('0x45')](function(_0x224338){var _0x317dfc=_[_0xfab9('0x42')](_0x224338,function(_0x2856a6){return _0x2856a6?_0x2856a6:undefined;});var _0x2d4a1f=_[_0xfab9('0x42')](_0x53e0a4,[_0xfab9('0x79'),!![]]);var _0x4c7b37=_['isEmpty'](_0x317dfc)&&_[_0xfab9('0x64')](_0x2d4a1f)?null:_[_0xfab9('0x7a')](_0x2d4a1f,_0x317dfc);if(_0x4c7b37){var _0x27d38d=[];for(var _0x5ca859=0x0;_0x5ca859<_0x4c7b37['length'];_0x5ca859++){var _0x1cc80b=_[_0xfab9('0x4e')](_0x53e0a4,function(_0x19cf35){return _0x4c7b37[_0x5ca859]?_0x19cf35[_0xfab9('0x2a')]===_0x4c7b37[_0x5ca859][_0xfab9('0x2a')]:null;});if(_0x1cc80b){if(_0x4c7b37[_0x5ca859]['ignore']){_0x27d38d[_0xfab9('0x6b')](getAllResources(_0x42b0d7[_0xfab9('0x7b')],_0x4c7b37[_0x5ca859]));}else{if(!_0x4c7b37[_0x5ca859][_0xfab9('0x58')]){_0x27d38d[_0xfab9('0x6b')](getAllowedResources(_0x1cc80b,_0x4c7b37[_0x5ca859],_0x42b0d7[_0xfab9('0x7b')]));}else{if(_0x1cc80b[_0xfab9('0x33')]){_0x27d38d[_0xfab9('0x6b')](getAllFilteredResources(_0x1cc80b,_0x4c7b37[_0x5ca859]));}}}}}return BPromise['all'](_0x27d38d);}else{return null;}})['then'](function(_0x2486d5){var _0x5a1901=_0x2486d5;var _0x4ec02f=null;if(_0x5a1901){_0x4ec02f=_0x5a1901['length']===0x1?_0x5a1901[0x0]:null;}if(_0x4ec02f||_0x5a1901){var _0x50c8cc=db[_0x42b0d7['childModel']]['rawAttributes'];_0xe8f7d8[_0xfab9('0x33')]=_[_0xfab9('0x35')](_0x50c8cc);_0xe8f7d8[_0xfab9('0x34')]=_['keys'](_0x319ab8[_0xfab9('0x34')]);_0xe8f7d8['filters']=_[_0xfab9('0x36')](_0xe8f7d8[_0xfab9('0x33')],_0xe8f7d8[_0xfab9('0x34')]);_0x17dbe4[_0xfab9('0x37')]=_[_0xfab9('0x36')](_0xe8f7d8[_0xfab9('0x33')],qs['fields'](_0x319ab8[_0xfab9('0x34')][_0xfab9('0x38')]));_0x17dbe4[_0xfab9('0x37')]=_0x17dbe4[_0xfab9('0x37')]['length']?_0x17dbe4[_0xfab9('0x37')]:_0xe8f7d8[_0xfab9('0x33')];if(!_0x319ab8['query'][_0xfab9('0x3a')]('nolimit')){_0x17dbe4[_0xfab9('0x3c')]=qs[_0xfab9('0x3c')](_0x319ab8['query']['limit']);_0x17dbe4[_0xfab9('0x22')]=qs['offset'](_0x319ab8['query'][_0xfab9('0x22')]);}_0x17dbe4[_0xfab9('0x3d')]=qs[_0xfab9('0x3e')](_0x319ab8[_0xfab9('0x34')]['sort']);_0x17dbe4[_0xfab9('0x3f')]=qs[_0xfab9('0x40')](_[_0xfab9('0x41')](_0x319ab8[_0xfab9('0x34')],_0xe8f7d8[_0xfab9('0x40')]));if(_0x319ab8['query'][_0xfab9('0x42')]){_0x17dbe4[_0xfab9('0x3f')]=_[_0xfab9('0x43')](_0x17dbe4[_0xfab9('0x3f')],{'$or':_[_0xfab9('0x2d')](_0x50c8cc,function(_0x4e3e68){if(_0x4e3e68[_0xfab9('0x31')]['key']!==_0xfab9('0x44')){var _0x845288={};_0x845288[_0x4e3e68[_0xfab9('0x7c')]]={'$like':'%'+_0x319ab8[_0xfab9('0x34')][_0xfab9('0x42')]+'%'};return _0x845288;}})});}var _0x3cfc42=[];if(_0x4ec02f){var _0x1bddfa=_[_0xfab9('0x4e')](_0x53e0a4,[_0xfab9('0x2a'),_0x4ec02f['name']]);if(_0x1bddfa[_0xfab9('0x7c')]){var _0x397c6d={};if(_0x42b0d7[_0xfab9('0x7b')]===_0xfab9('0x7d')){_0x397c6d[_0x1bddfa[_0xfab9('0x7e')]]=_[_0xfab9('0x2d')](_0x4ec02f[_0xfab9('0x7f')],'id');}else{_0x397c6d[_0x1bddfa[_0xfab9('0x7e')]]=_0x4ec02f[_0xfab9('0x7f')];}_0x3cfc42[_0xfab9('0x6b')](_0x397c6d);}else{_0x17dbe4[_0xfab9('0x3f')]['id']=_0x4ec02f[_0xfab9('0x7f')];}}else{for(var _0x25d149=0x0;_0x25d149<_0x5a1901[_0xfab9('0x39')];_0x25d149++){var _0x1bddfa=_[_0xfab9('0x4e')](_0x53e0a4,['name',_0x5a1901[_0x25d149][_0xfab9('0x2a')]]);if(_0x1bddfa[_0xfab9('0x7c')]){var _0x397c6d={};_0x397c6d[_0x1bddfa[_0xfab9('0x7e')]]=_0x5a1901[_0x25d149]['associatedResources'];_0x3cfc42[_0xfab9('0x6b')](_0x397c6d);}else{if(!_0x17dbe4[_0xfab9('0x3f')]['id'])_0x17dbe4[_0xfab9('0x3f')]['id']=[];_0x5a1901[_0x25d149][_0xfab9('0x7f')][_0xfab9('0x6a')](function(_0x18dda7){_0x17dbe4['where']['id']['push'](_0x18dda7);});}}}if(!_['isEmpty'](_0x3cfc42)){_0x17dbe4[_0xfab9('0x3f')]=_[_0xfab9('0x43')](_0x17dbe4[_0xfab9('0x3f')],{'$and':{'$or':_0x3cfc42}});}_0x17dbe4=_[_0xfab9('0x43')]({},_0x17dbe4,_0x319ab8[_0xfab9('0x4d')]);if(_0x4ec02f&&!_0x4ec02f[_0xfab9('0x58')]&&_0x42b0d7['childModel']===_0xfab9('0x7d')){if(_0x319ab8[_0xfab9('0x34')][_0xfab9('0x46')]){_0x17dbe4[_0xfab9('0x4c')]=[{'all':!![]}];}return db[_0x42b0d7[_0xfab9('0x7b')]][_0xfab9('0x47')](_0x17dbe4)[_0xfab9('0x45')](function(_0x2ede21){var _0xfc2c24=[];_0x2ede21[_0xfab9('0x6a')](function(_0x4f132c){var _0x2c9844;switch(_0x4f132c[_0xfab9('0x80')]){case _0xfab9('0x81'):_0x2c9844=_['find'](_0x4ec02f[_0xfab9('0x7f')],function(_0x1edf88){return _0x1edf88['id']===_0x4f132c[_0xfab9('0x82')]&&_0x1edf88[_0xfab9('0x31')]==='DefaultReports';});break;case _0xfab9('0x83'):_0x2c9844=_['find'](_0x4ec02f[_0xfab9('0x7f')],function(_0x17a550){return _0x17a550['id']===_0x4f132c['reportId']&&_0x17a550[_0xfab9('0x31')]===_0xfab9('0x84');});break;}if(_0x2c9844)_0xfc2c24['push'](_0x4f132c);});_0x47f481[_0xfab9('0x21')]=_0xfc2c24[_0xfab9('0x39')];_0x47f481[_0xfab9('0x48')]=_0xfc2c24;return _0x47f481;});}else{return db[_0x42b0d7[_0xfab9('0x7b')]][_0xfab9('0x21')]({'where':_0x17dbe4[_0xfab9('0x3f')]})[_0xfab9('0x45')](function(_0x5c4dd6){_0x47f481['count']=_0x5c4dd6;if(_0x319ab8['query']['includeAll']){if(_0x42b0d7[_0xfab9('0x7b')]===_0xfab9('0x85')){_0x17dbe4[_0xfab9('0x4c')]=[{'model':db[_0xfab9('0x86')],'as':'Tags','attributes':['id',_0xfab9('0x2a'),_0xfab9('0x87')],'required':_0x319ab8['query'][_0xfab9('0x88')]?!![]:![]},{'model':db[_0xfab9('0x86')],'as':_0xfab9('0x89'),'attributes':['id',_0xfab9('0x2a'),_0xfab9('0x87')],'through':_0x319ab8[_0xfab9('0x34')][_0xfab9('0x88')]?{'attributes':[],'where':{'TagId':_0x319ab8['query'][_0xfab9('0x88')]||undefined}}:{},'required':_0x319ab8[_0xfab9('0x34')][_0xfab9('0x88')]?!![]:![]}];}else{_0x17dbe4[_0xfab9('0x4c')]=[{'all':!![]}];}}return db[_0x42b0d7['childModel']][_0xfab9('0x47')](_0x17dbe4);})[_0xfab9('0x45')](function(_0xc1d457){_0x47f481[_0xfab9('0x48')]=_0xc1d457;return _0x47f481;});}}else{return _0x47f481;}})['then'](respondWithFilteredResult(_0x4e9551,_0x17dbe4))[_0xfab9('0x49')](handleError(_0x4e9551,null));};function getAllResources(_0x1f520a,_0x45aeef){return new BPromise(function(_0x3cbc1f,_0x254472){if(_0x45aeef){var _0x326a2d=_0x45aeef[_0xfab9('0x42')]?{[_0x45aeef[_0xfab9('0x42')]['field']]:_0x45aeef[_0xfab9('0x42')][_0xfab9('0x8a')]}:undefined;return db[_0x1f520a][_0xfab9('0x47')]({'where':_0x326a2d,'raw':!![]})[_0xfab9('0x45')](function(_0x186184){_0x45aeef[_0xfab9('0x7f')]=_['map'](_0x186184,'id');_0x3cbc1f(_0x45aeef);})['catch'](function(_0x67536e){_0x254472(_0x67536e);});}else{_0x3cbc1f(null);}});}function getAllFilteredResources(_0x4b31cd,_0x365c3b){return new BPromise(function(_0x4ae360,_0xeee832){var _0x15316d=_0x4b31cd[_0xfab9('0x42')]?{[_0x4b31cd[_0xfab9('0x42')][_0xfab9('0x7c')]]:_0x4b31cd['filter'][_0xfab9('0x8a')]}:undefined;return db[_0x4b31cd[_0xfab9('0x33')]][_0xfab9('0x47')]({'where':_0x15316d,'raw':!![]})[_0xfab9('0x45')](function(_0x12e0e5){_0x365c3b[_0xfab9('0x7f')]=_[_0xfab9('0x2d')](_0x12e0e5,function(_0x2710dd){return _0x2710dd[_0xfab9('0x2a')];});_0x4ae360(_0x365c3b);})[_0xfab9('0x49')](function(_0x1aaa9e){_0xeee832(_0x1aaa9e);});});}function getAllowedResources(_0x3b17cc,_0x5852a2,_0x47b4a6){return new BPromise(function(_0x2de49f,_0x40d318){if(_0x5852a2){return db['UserProfileResource'][_0xfab9('0x47')]({'where':{'sectionId':_0x5852a2['id']},'raw':!![]})['then'](function(_0x36400e){if(_0x3b17cc[_0xfab9('0x7c')]&&_0x3b17cc[_0xfab9('0x7c')]!=='id'){_0x5852a2['associatedResources']=_[_0xfab9('0x2d')](_0x36400e,function(_0x575083){return _0x575083[_0x3b17cc[_0xfab9('0x7c')]];});}else{if(_0x47b4a6===_0xfab9('0x7d')){_0x5852a2[_0xfab9('0x7f')]=_['map'](_0x36400e,function(_0x4b1137){return{'id':_0x4b1137[_0xfab9('0x6d')],'type':_0x4b1137[_0xfab9('0x31')]};});}else{_0x5852a2['associatedResources']=_[_0xfab9('0x2d')](_0x36400e,function(_0x435b59){return _0x435b59[_0xfab9('0x6d')];});}}_0x2de49f(_0x5852a2);})[_0xfab9('0x49')](function(_0x4e2513){_0x40d318(_0x4e2513);});}else{_0x2de49f(null);}});}function getQueryModels(_0x468b97,_0xa4aeb3){var _0x2267ca=_0x468b97[_0xfab9('0x8b')]();var _0x4af0f6={'childModel':undefined,'parentSections':[]};switch(_0x2267ca){case _0xfab9('0x8c'):_0x4af0f6['childModel']=_0xfab9('0x8d');break;case _0xfab9('0x8e'):_0x4af0f6['childModel']=_0xfab9('0x8f');break;case _0xfab9('0x90'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0x91');_0x4af0f6[_0xfab9('0x77')]=[{'name':_0xfab9('0x92'),'field':'name','foreignKey':'projectName'}];break;case _0xfab9('0x93'):_0x4af0f6[_0xfab9('0x7b')]='JscriptyProject';break;case _0xfab9('0x94'):_0x4af0f6[_0xfab9('0x7b')]='CmContact';_0x4af0f6[_0xfab9('0x77')]=[{'name':'Lists','field':'id','foreignKey':_0xfab9('0x95')}];break;case _0xfab9('0x96'):_0x4af0f6['childModel']=_0xfab9('0x97');break;case _0xfab9('0x98'):_0x4af0f6['childModel']=_0xfab9('0x99');break;case _0xfab9('0x9a'):_0x4af0f6['childModel']='CmCustomField';break;case _0xfab9('0x9b'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0x9c');break;case'chatwebsites':_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0x9d');break;case _0xfab9('0x9e'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0x9f');break;case _0xfab9('0xa0'):_0x4af0f6['childModel']=_0xfab9('0xa1');break;case _0xfab9('0xa2'):case _0xfab9('0xa3'):case'outboundroutes':_0x4af0f6['childModel']=_0xfab9('0xa4');break;case _0xfab9('0xa5'):_0x4af0f6['childModel']=_0xfab9('0xa6');break;case'voicemails':_0x4af0f6[_0xfab9('0x7b')]='VoiceMail';break;case _0xfab9('0xa7'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xa8');_0x4af0f6['parentSections']=[{'name':_0xfab9('0xa9'),'field':_0xfab9('0x2a'),'foreignKey':_0xfab9('0xaa'),'model':_0xfab9('0xab'),'filter':{'field':'role','value':['agent']}},{'name':_0xfab9('0xac'),'field':_0xfab9('0x2a'),'foreignKey':'membername','model':_0xfab9('0xab'),'filter':{'field':_0xfab9('0xad'),'value':[_0xfab9('0xae')]}},{'name':_0xfab9('0xaf'),'field':_0xfab9('0x2a'),'foreignKey':_0xfab9('0xb0'),'model':_0xfab9('0xb1'),'filter':{'field':'type','value':[_0xfab9('0xb2')]}},{'name':'QueueCampaigns','field':_0xfab9('0x2a'),'foreignKey':_0xfab9('0xb0'),'model':'VoiceQueue','filter':{'field':_0xfab9('0x31'),'value':['outbound']}}];break;case _0xfab9('0xb3'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xb4');break;case'chanspies':_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xb5');break;case _0xfab9('0xb6'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xb7');break;case _0xfab9('0xb8'):_0x4af0f6['childModel']=_0xfab9('0xb9');break;case _0xfab9('0xba'):_0x4af0f6[_0xfab9('0x7b')]='MailQueue';break;case'mailaccounts':_0x4af0f6['childModel']=_0xfab9('0xbb');break;case _0xfab9('0xbc'):_0x4af0f6[_0xfab9('0x7b')]='MailSubstatus';break;case'openchannelqueues':_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xbd');break;case _0xfab9('0xbe'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xbf');break;case'smsqueues':_0x4af0f6[_0xfab9('0x7b')]='SmsQueue';break;case'smsaccounts':_0x4af0f6['childModel']=_0xfab9('0xc0');break;case _0xfab9('0xc1'):_0x4af0f6['childModel']=_0xfab9('0xc2');break;case _0xfab9('0xc3'):case _0xfab9('0xc4'):_0x4af0f6['childModel']=_0xfab9('0xb1');if(_0xa4aeb3){_0x4af0f6['parentSections']=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case'users':case _0xfab9('0xc5'):case _0xfab9('0xc6'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xab');if(_0xa4aeb3){_0x4af0f6['parentSections']=[{'name':_0xfab9('0xc7'),'filter':{'field':_0xfab9('0xad'),'value':[_0xfab9('0xc8'),_0xfab9('0xc9')]},'ignore':!![]},{'name':_0xfab9('0xa9')},{'name':'Telephones'}];}break;case _0xfab9('0xca'):_0x4af0f6[_0xfab9('0x7b')]='ZendeskAccount';break;case _0xfab9('0xcb'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xcc');break;case _0xfab9('0xcd'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xce');break;case _0xfab9('0xcf'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xd0');break;case _0xfab9('0xd1'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xd2');break;case _0xfab9('0xd3'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xd4');break;case'vtigeraccounts':_0x4af0f6['childModel']=_0xfab9('0xab');break;case _0xfab9('0xd5'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xd6');break;case _0xfab9('0xd7'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xd8');break;case _0xfab9('0xd9'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0x69');break;case _0xfab9('0xda'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xdb');break;case'pauses':_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xdc');break;case'scheduler':_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xdd');break;case _0xfab9('0xde'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xdf');break;case _0xfab9('0xe0'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0x86');break;case _0xfab9('0xe1'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xe2');break;case _0xfab9('0xe3'):_0x4af0f6['childModel']=_0xfab9('0xe4');break;case _0xfab9('0xe5'):_0x4af0f6[_0xfab9('0x7b')]='Trunk';break;case _0xfab9('0xe6'):_0x4af0f6[_0xfab9('0x7b')]='Variable';break;case _0xfab9('0xe7'):_0x4af0f6['childModel']='Plugin';break;case _0xfab9('0xe8'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0x7d');_0x4af0f6[_0xfab9('0x77')]=[{'name':_0xfab9('0xe9'),'field':'id','foreignKey':_0xfab9('0x82')}];break;case _0xfab9('0xea'):_0x4af0f6[_0xfab9('0x7b')]=_0xfab9('0xeb');break;default:return _0x4af0f6;}return _0x4af0f6;} \ No newline at end of file +var _0x19d1=['omit','updatedAt','crudPermissions','createdAt','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','describe','addSections','ids','getSections','enabled','isEmpty','subsections','includes','push','findOne','Dashboard','forEach','resourceId','sequelize','bulkCreate','removeResources','getResources','section','undefined','Sequelize','Unknown\x20section','mergeResources','childModel','all','ignore','union','hasOwnProperty','order','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','reportId','rows','CmContact','Tag','Tags','color','ThroughTags','tag','value','squareprojects','SquareProject','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','Lists','lists','companies','CmCompany','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','teams','queuecampaigns','users','agents','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','tags','templates','triggers','Variable','plugins','Plugin','extractedreports','Reports','AnalyticMetric','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','update','destroy','then','name','send','index','map','UserProfile','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','catch','show','params','find','create','body','clone','get'];(function(_0x5adad8,_0x22944c){var _0x4e3988=function(_0x50bc70){while(--_0x50bc70){_0x5adad8['push'](_0x5adad8['shift']());}};_0x4e3988(++_0x22944c);}(_0x19d1,0x99));var _0x119d=function(_0x3b765c,_0x3f4296){_0x3b765c=_0x3b765c-0x0;var _0x2c862e=_0x19d1[_0x3b765c];return _0x2c862e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x119d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x119d('0x1'));var rp=require(_0x119d('0x2'));var moment=require(_0x119d('0x3'));var BPromise=require(_0x119d('0x4'));var Mustache=require(_0x119d('0x5'));var util=require('util');var path=require('path');var sox=require(_0x119d('0x6'));var csv=require(_0x119d('0x7'));var ejs=require(_0x119d('0x8'));var fs=require('fs');var _=require(_0x119d('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x119d('0xa'));var deskjs=require(_0x119d('0xb'));var toCsv=require('to-csv');var querystring=require(_0x119d('0xc'));var Papa=require(_0x119d('0xd'));var Redis=require(_0x119d('0xe'));var authService=require(_0x119d('0xf'));var qs=require(_0x119d('0x10'));var as=require(_0x119d('0x11'));var hardwareService=require(_0x119d('0x12'));var logger=require(_0x119d('0x13'))('api');var utils=require(_0x119d('0x14'));var config=require(_0x119d('0x15'));var db=require(_0x119d('0x16'))['db'];config[_0x119d('0x17')]=_[_0x119d('0x18')](config[_0x119d('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x119d('0x19'))(new Redis(config[_0x119d('0x17')]));require('./userProfile.socket')[_0x119d('0x1a')](socket);function respondWithStatusCode(_0x37dfd8,_0x338d88){_0x338d88=_0x338d88||0xcc;return function(_0x271229){if(_0x271229){return _0x37dfd8[_0x119d('0x1b')](_0x338d88);}return _0x37dfd8['status'](_0x338d88)[_0x119d('0x1c')]();};}function respondWithResult(_0x3878ac,_0x4eb73e){_0x4eb73e=_0x4eb73e||0xc8;return function(_0x21fd54){if(_0x21fd54){return _0x3878ac[_0x119d('0x1d')](_0x4eb73e)[_0x119d('0x1e')](_0x21fd54);}};}function respondWithFilteredResult(_0xffbde7,_0x200620){return function(_0x22a607){if(_0x22a607){var _0x597ad6=_0x22a607[_0x119d('0x1f')],_0x257341=_0x200620['offset'],_0x15d710=_0x200620[_0x119d('0x20')]+_0x200620[_0x119d('0x21')],_0x1fcebd;if(_0x15d710>=_0x597ad6){_0x15d710=_0x597ad6;_0x1fcebd=0xc8;}else{_0x1fcebd=0xce;}_0xffbde7['status'](_0x1fcebd);return _0xffbde7['set'](_0x119d('0x22'),_0x257341+'-'+_0x15d710+'/'+_0x597ad6)[_0x119d('0x1e')](_0x22a607);}return null;};}function patchUpdates(_0x200dc0){return function(_0x1e9e79){try{jsonpatch[_0x119d('0x23')](_0x1e9e79,_0x200dc0,!![]);}catch(_0x4206e5){return BPromise['reject'](_0x4206e5);}return _0x1e9e79['save']();};}function saveUpdates(_0x30c8dc,_0x4ef9ca){return function(_0x2d6d18){if(_0x2d6d18){return _0x2d6d18[_0x119d('0x24')](_0x30c8dc)['then'](function(_0x2dcd6e){return _0x2dcd6e;});}return null;};}function removeEntity(_0x60351b,_0x40a7f6){return function(_0x9f0135){if(_0x9f0135){return _0x9f0135[_0x119d('0x25')]()[_0x119d('0x26')](function(){_0x60351b[_0x119d('0x1d')](0xcc)[_0x119d('0x1c')]();});}};}function handleEntityNotFound(_0x317140,_0x14dc2c){return function(_0x532e3f){if(!_0x532e3f){_0x317140[_0x119d('0x1b')](0x194);}return _0x532e3f;};}function handleError(_0x371376,_0x106066){_0x106066=_0x106066||0x1f4;return function(_0x416d98){logger['error'](_0x416d98['stack']);if(_0x416d98[_0x119d('0x27')]){delete _0x416d98[_0x119d('0x27')];}_0x371376[_0x119d('0x1d')](_0x106066)[_0x119d('0x28')](_0x416d98);};}exports[_0x119d('0x29')]=function(_0x547c6b,_0x219c6a){var _0x1670e5={},_0x49330b={},_0x50e3c8={'count':0x0,'rows':[]};var _0x2bc25f=_[_0x119d('0x2a')](db[_0x119d('0x2b')][_0x119d('0x2c')],function(_0x755f55){return{'name':_0x755f55[_0x119d('0x2d')],'type':_0x755f55['type'][_0x119d('0x2e')]};});_0x49330b[_0x119d('0x2f')]=_['map'](_0x2bc25f,'name');_0x49330b[_0x119d('0x30')]=_[_0x119d('0x31')](_0x547c6b['query']);_0x49330b[_0x119d('0x32')]=_[_0x119d('0x33')](_0x49330b[_0x119d('0x2f')],_0x49330b[_0x119d('0x30')]);_0x1670e5['attributes']=_[_0x119d('0x33')](_0x49330b[_0x119d('0x2f')],qs[_0x119d('0x34')](_0x547c6b[_0x119d('0x30')][_0x119d('0x34')]));_0x1670e5[_0x119d('0x35')]=_0x1670e5['attributes'][_0x119d('0x36')]?_0x1670e5[_0x119d('0x35')]:_0x49330b['model'];if(!_0x547c6b[_0x119d('0x30')]['hasOwnProperty'](_0x119d('0x37'))){_0x1670e5[_0x119d('0x21')]=qs[_0x119d('0x21')](_0x547c6b[_0x119d('0x30')]['limit']);_0x1670e5['offset']=qs[_0x119d('0x20')](_0x547c6b['query'][_0x119d('0x20')]);}_0x1670e5['order']=qs[_0x119d('0x38')](_0x547c6b[_0x119d('0x30')][_0x119d('0x38')]);_0x1670e5[_0x119d('0x39')]=qs[_0x119d('0x32')](_[_0x119d('0x3a')](_0x547c6b[_0x119d('0x30')],_0x49330b[_0x119d('0x32')]));if(_0x547c6b['query'][_0x119d('0x3b')]){_0x1670e5[_0x119d('0x39')]=_[_0x119d('0x3c')](_0x1670e5[_0x119d('0x39')],{'$or':_[_0x119d('0x2a')](_0x2bc25f,function(_0x395e2d){if(_0x395e2d[_0x119d('0x3d')]!=='VIRTUAL'){var _0x4e262f={};_0x4e262f[_0x395e2d[_0x119d('0x27')]]={'$like':'%'+_0x547c6b[_0x119d('0x30')][_0x119d('0x3b')]+'%'};return _0x4e262f;}})});}_0x1670e5=_[_0x119d('0x3c')]({},_0x1670e5,_0x547c6b[_0x119d('0x3e')]);var _0x3ab7be={'where':_0x1670e5[_0x119d('0x39')]};return db[_0x119d('0x2b')]['count'](_0x3ab7be)[_0x119d('0x26')](function(_0x3753e5){_0x50e3c8['count']=_0x3753e5;if(_0x547c6b[_0x119d('0x30')][_0x119d('0x3f')]){_0x1670e5[_0x119d('0x40')]=[{'all':!![]}];}return db[_0x119d('0x2b')]['findAll'](_0x1670e5);})['then'](function(_0x3235c7){_0x50e3c8['rows']=_0x3235c7;return _0x50e3c8;})[_0x119d('0x26')](respondWithFilteredResult(_0x219c6a,_0x1670e5))[_0x119d('0x41')](handleError(_0x219c6a,null));};exports[_0x119d('0x42')]=function(_0x49bc3e,_0x3e613d){var _0x2b75dc={'raw':![],'where':{'id':_0x49bc3e[_0x119d('0x43')]['id']}},_0x53d7e5={};_0x53d7e5[_0x119d('0x2f')]=_['keys'](db['UserProfile'][_0x119d('0x2c')]);_0x53d7e5[_0x119d('0x30')]=_['keys'](_0x49bc3e[_0x119d('0x30')]);_0x53d7e5[_0x119d('0x32')]=_['intersection'](_0x53d7e5['model'],_0x53d7e5[_0x119d('0x30')]);_0x2b75dc[_0x119d('0x35')]=_['intersection'](_0x53d7e5[_0x119d('0x2f')],qs[_0x119d('0x34')](_0x49bc3e[_0x119d('0x30')]['fields']));_0x2b75dc[_0x119d('0x35')]=_0x2b75dc[_0x119d('0x35')][_0x119d('0x36')]?_0x2b75dc[_0x119d('0x35')]:_0x53d7e5[_0x119d('0x2f')];if(_0x49bc3e[_0x119d('0x30')][_0x119d('0x3f')]){_0x2b75dc['include']=[{'all':!![]}];}_0x2b75dc=_['merge']({},_0x2b75dc,_0x49bc3e[_0x119d('0x3e')]);return db[_0x119d('0x2b')][_0x119d('0x44')](_0x2b75dc)[_0x119d('0x26')](handleEntityNotFound(_0x3e613d,null))[_0x119d('0x26')](respondWithResult(_0x3e613d,null))['catch'](handleError(_0x3e613d,null));};exports[_0x119d('0x45')]=function(_0x1043a1,_0x3ac617){return db['UserProfile'][_0x119d('0x45')](_0x1043a1[_0x119d('0x46')],{})[_0x119d('0x26')](respondWithResult(_0x3ac617,0xc9))['catch'](handleError(_0x3ac617,null));};exports[_0x119d('0x47')]=function(_0xac2749,_0x3c2450){var _0x3a9a10={'where':{'id':_0xac2749[_0x119d('0x43')]['id']}},_0x5a6217={};_0x5a6217[_0x119d('0x2f')]=_['keys'](db[_0x119d('0x2b')][_0x119d('0x2c')]);_0x3a9a10[_0x119d('0x35')]=_[_0x119d('0x33')](_0x5a6217[_0x119d('0x2f')],qs[_0x119d('0x34')](_0xac2749[_0x119d('0x30')][_0x119d('0x34')]));_0x3a9a10[_0x119d('0x35')]=_0x3a9a10['attributes'][_0x119d('0x36')]?_0x3a9a10[_0x119d('0x35')]:_0x5a6217[_0x119d('0x2f')];if(_0xac2749[_0x119d('0x30')]['includeAll']){_0x3a9a10[_0x119d('0x40')]=[{'all':!![]}];}_0x3a9a10=_[_0x119d('0x3c')]({},_0x3a9a10,_0xac2749[_0x119d('0x3e')]);return db[_0x119d('0x2b')][_0x119d('0x44')](_0x3a9a10)['then'](handleEntityNotFound(_0x3c2450,null))[_0x119d('0x26')](function(_0x198cb1){if(_0x198cb1){var _0x11b252=_0x198cb1[_0x119d('0x48')]({'plain':!![]});_0x11b252=qs[_0x119d('0x49')](_0x11b252,['id','createdAt',_0x119d('0x4a'),_0x119d('0x4b')]);_0xac2749[_0x119d('0x46')]=_[_0x119d('0x49')](_0xac2749[_0x119d('0x46')],['id',_0x119d('0x4c'),_0x119d('0x4a')]);return db['sequelize']['transaction'](function(_0x5db58a){return db['UserProfile'][_0x119d('0x45')](_['merge'](_0x11b252,_0xac2749[_0x119d('0x46')]),{'include':_0xac2749[_0x119d('0x30')][_0x119d('0x3f')]?[{'all':!![]}]:undefined,'transaction':_0x5db58a})[_0x119d('0x26')](function(_0x1ba9d3){var _0x552360=_0x1ba9d3[_0x119d('0x48')]({'plain':!![]});return db['UserProfileSection'][_0x119d('0x4d')]({'where':{'userProfileId':_0xac2749[_0x119d('0x43')]['id']},'raw':!![]})[_0x119d('0x26')](function(_0x5bcfe5){if(_0x5bcfe5){return BPromise[_0x119d('0x4e')](_0x5bcfe5,function(_0x9b20e3){return new BPromise(function(_0xcbecd8,_0xa4bc7){if(_0x9b20e3[_0x119d('0x4f')]===null||_0x9b20e3[_0x119d('0x4f')]===0x1)_0xcbecd8(null);return db[_0x119d('0x50')][_0x119d('0x4d')]({'where':{'sectionId':_0x9b20e3['id']},'raw':!![]})[_0x119d('0x26')](function(_0x27cab1){var _0x4bbcbf=_[_0x119d('0x2a')](_0x27cab1,function(_0xd78346){return qs[_0x119d('0x49')](_0xd78346,['id',_0x119d('0x4c'),_0x119d('0x4a'),_0x119d('0x51')]);});_0xcbecd8(_0x4bbcbf);})[_0x119d('0x41')](function(_0x105ad2){_0xa4bc7(_0x105ad2);});})[_0x119d('0x26')](function(_0x41b721){var _0x3498d9=qs[_0x119d('0x49')](_0x9b20e3,['id',_0x119d('0x4c'),_0x119d('0x4a')]);_0x3498d9[_0x119d('0x52')]=_0x552360['id'];if(_0x41b721)_0x3498d9[_0x119d('0x53')]=_0x41b721;return _0x3498d9;})['then'](function(_0x3e5fc4){return db[_0x119d('0x54')][_0x119d('0x45')](_0x3e5fc4,{'include':[{'model':db[_0x119d('0x50')],'as':_0x119d('0x53')}],'raw':!![],'transaction':_0x5db58a});});})[_0x119d('0x26')](function(){return _0x552360;});}});});});}})[_0x119d('0x26')](respondWithResult(_0x3c2450,0xc9))[_0x119d('0x41')](handleError(_0x3c2450,null));};exports[_0x119d('0x24')]=function(_0x562398,_0x304b86){if(_0x562398[_0x119d('0x46')]['id']){delete _0x562398[_0x119d('0x46')]['id'];}return db[_0x119d('0x2b')][_0x119d('0x44')]({'where':{'id':_0x562398['params']['id']}})[_0x119d('0x26')](handleEntityNotFound(_0x304b86,null))[_0x119d('0x26')](saveUpdates(_0x562398[_0x119d('0x46')],null))[_0x119d('0x26')](respondWithResult(_0x304b86,null))[_0x119d('0x41')](handleError(_0x304b86,null));};exports[_0x119d('0x25')]=function(_0x3260b0,_0x94285f){return db[_0x119d('0x2b')]['find']({'where':{'id':_0x3260b0[_0x119d('0x43')]['id']}})[_0x119d('0x26')](handleEntityNotFound(_0x94285f,null))[_0x119d('0x26')](removeEntity(_0x94285f,null))[_0x119d('0x41')](handleError(_0x94285f,null));};exports[_0x119d('0x55')]=function(_0x4510e4,_0x434bb2){return db[_0x119d('0x2b')][_0x119d('0x55')]()[_0x119d('0x26')](respondWithResult(_0x434bb2,null))[_0x119d('0x41')](handleError(_0x434bb2,null));};exports[_0x119d('0x56')]=function(_0x149b3d,_0x14ad23){var _0x1cfe26=_0x149b3d[_0x119d('0x46')];return db[_0x119d('0x2b')]['find']({'where':{'id':_0x149b3d[_0x119d('0x43')]['id']}})[_0x119d('0x26')](handleEntityNotFound(_0x14ad23,null))[_0x119d('0x26')](function(_0xa6498a){if(_0xa6498a){return db['sequelize']['transaction'](function(_0x3d1779){return db[_0x119d('0x54')][_0x119d('0x25')]({'where':{'userProfileId':_0x149b3d['params']['id'],'sectionId':_['map'](_0x1cfe26,function(_0x359b48){return _0x359b48[_0x119d('0x51')];})},'transaction':_0x3d1779})['then'](function(){var _0x315f9d=_[_0x119d('0x2a')](_0x1cfe26,function(_0x37bbbc){_0x37bbbc['userProfileId']=_0x149b3d['params']['id'];return _0x37bbbc;});var _0x283d29=[];return BPromise[_0x119d('0x4e')](_0x315f9d,function(_0x24fd66){return db['UserProfileSection'][_0x119d('0x45')](_0x24fd66,{'include':[{'model':db[_0x119d('0x50')],'as':_0x119d('0x53')}],'raw':!![],'transaction':_0x3d1779})['then'](function(_0x59cc5f){_0x283d29['push'](_0x59cc5f['get']({'plain':!![]}));});})['then'](function(){return _0x283d29;});});});}})[_0x119d('0x26')](function(_0x5832c9){return _0x5832c9;})[_0x119d('0x26')](respondWithResult(_0x14ad23,null))[_0x119d('0x41')](handleError(_0x14ad23,null));};exports['removeSections']=function(_0x209181,_0x549124){var _0x1f575f;return db[_0x119d('0x2b')]['find']({'where':{'id':_0x209181[_0x119d('0x43')]['id']},'attributes':['id','name']})[_0x119d('0x26')](handleEntityNotFound(_0x549124,null))['then'](function(_0x4a5a16){if(_0x4a5a16){_0x1f575f=_0x4a5a16;return db[_0x119d('0x54')][_0x119d('0x25')]({'where':{'userProfileId':_0x209181['params']['id'],'sectionId':_0x209181['query'][_0x119d('0x57')]}});}})[_0x119d('0x26')](function(){return _0x1f575f;})['then'](respondWithStatusCode(_0x549124,null))['catch'](handleError(_0x549124,null));};exports[_0x119d('0x58')]=function(_0x4def5f,_0x31e5b1){var _0x3fe917=[];var _0xb78443=[];return db[_0x119d('0x54')][_0x119d('0x4d')]({'where':{'userProfileId':_0x4def5f[_0x119d('0x43')]['id']},'raw':!![]})[_0x119d('0x26')](function(_0x48094a){_0x3fe917=_[_0x119d('0x3b')](_0x48094a,function(_0x99e7d2){return _0x99e7d2[_0x119d('0x59')]===0x1||_['includes']([0x3eb,0x709],_0x99e7d2[_0x119d('0x51')]);});if(!_[_0x119d('0x5a')](_0x3fe917)){return _[_0x119d('0x2a')](_0x3fe917,function(_0x4031e6){return _0x4031e6[_0x119d('0x51')];});}else{return;}})[_0x119d('0x26')](function(_0x8313f4){if(_0x8313f4)_0xb78443=_0x8313f4;if(_['includes'](_0xb78443,0x64)){var _0x3089a0=_[_0x119d('0x44')](_0x3fe917,{'sectionId':0x64});return hasDefaultDashboard(_0x3089a0)['then'](function(_0x8dab69){return _[_0x119d('0x2a')](_0x3fe917,function(_0x1f5ad4){if(_0x1f5ad4[_0x119d('0x51')]===0x64){_0x1f5ad4[_0x119d('0x5b')]=_0x8dab69;}return _0x1f5ad4;});});}else{return;}})['then'](function(_0x58df77){if(_0x58df77)_0x3fe917=_0x58df77;if(_[_0x119d('0x5c')](_0xb78443,0x3eb)){var _0x5ca44d=_[_0x119d('0x44')](_0x3fe917,{'sectionId':0x3eb});return getCustomDashboards(_0x5ca44d)[_0x119d('0x26')](function(_0x582780){return _[_0x119d('0x2a')](_0x3fe917,function(_0x445b03){if(_0x5ca44d[_0x119d('0x59')]){if(_0x445b03[_0x119d('0x51')]===0x3eb){_0x445b03[_0x119d('0x5b')]=_0x582780;}}else{if(_0x445b03[_0x119d('0x51')]===0x64){_0x445b03['subsections']=_0x582780;}}return _0x445b03;});});}else{return;}})[_0x119d('0x26')](function(_0x2e757b){if(_0x2e757b)_0x3fe917=_0x2e757b;if(_[_0x119d('0x5c')](_0xb78443,0x709)){var _0x5a8286=_[_0x119d('0x44')](_0x3fe917,{'sectionId':0x709});return getPlugins(_0x5a8286)['then'](function(_0x5a8fc4){if(_0x5a8286[_0x119d('0x59')]){return _['map'](_0x3fe917,function(_0x237319){if(_0x237319['sectionId']===0x709){_0x237319[_0x119d('0x5b')]=_0x5a8fc4;}return _0x237319;});}else{var _0x3e2990={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5a8fc4};var _0x476298=_[_0x119d('0x2a')](_0x3fe917);_0x476298[_0x119d('0x5d')](_0x3e2990);return _0x476298;}});}else{return;}})['then'](function(_0x45626c){if(_0x45626c)_0x3fe917=_0x45626c;return _[_0x119d('0x3b')](_0x3fe917,[_0x119d('0x59'),0x1]);})[_0x119d('0x26')](respondWithResult(_0x31e5b1,null))['catch'](handleError(_0x31e5b1,null));};function hasDefaultDashboard(_0x434fa6){var _0x436428=[0x65];return new BPromise(function(_0x1703bb,_0x4307e5){try{if(_0x434fa6[_0x119d('0x4f')]){_0x1703bb(_0x436428);}else{return db[_0x119d('0x50')][_0x119d('0x5e')]({'where':{'sectionId':_0x434fa6['id']},'raw':!![]})[_0x119d('0x26')](function(_0x5f5734){_0x5f5734?_0x1703bb(_0x436428):_0x1703bb();});}}catch(_0x1ee4f6){_0x4307e5(_0x1ee4f6);}});}function getCustomDashboards(_0x3479a3){var _0x3ca29d=[];return new BPromise(function(_0x456998,_0x1df199){try{if(_0x3479a3['autoAssociation']){return db[_0x119d('0x5f')][_0x119d('0x4d')]({'raw':!![]})[_0x119d('0x26')](function(_0x5398af){_0x5398af[_0x119d('0x60')](function(_0x48f63a){_0x3ca29d[_0x119d('0x5d')](_0x48f63a['id']+0x1869f);});_0x456998(_0x3ca29d);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x3479a3['id']},'raw':!![]})['then'](function(_0xca49fb){_0xca49fb['forEach'](function(_0x3b4277){_0x3ca29d[_0x119d('0x5d')](_0x3b4277[_0x119d('0x61')]+0x1869f);});_0x456998(_0x3ca29d);});}}catch(_0x33c25f){_0x1df199(_0x33c25f);}});}function getPlugins(_0x497824){var _0x3c5bd3=[];return new BPromise(function(_0x35de1a,_0x24ec96){try{if(_0x497824[_0x119d('0x4f')]){return db['Plugin'][_0x119d('0x4d')]({'raw':!![]})[_0x119d('0x26')](function(_0x7d74e6){_0x7d74e6[_0x119d('0x60')](function(_0x2c15e7){_0x3c5bd3[_0x119d('0x5d')](_0x2c15e7['id']+0x15b38);});_0x35de1a(_0x3c5bd3);});}else{return db['UserProfileResource'][_0x119d('0x4d')]({'where':{'sectionId':_0x497824['id']},'raw':!![]})['then'](function(_0x8d260b){_0x8d260b['forEach'](function(_0x270a9d){_0x3c5bd3['push'](_0x270a9d[_0x119d('0x61')]+0x15b38);});_0x35de1a(_0x3c5bd3);});}}catch(_0xa1277c){_0x24ec96(_0xa1277c);}});}exports['addResources']=function(_0x29d5dc,_0x5ecad8){return db[_0x119d('0x2b')][_0x119d('0x44')]({'where':{'id':_0x29d5dc['params']['id']}})[_0x119d('0x26')](handleEntityNotFound(_0x5ecad8,null))['then'](function(_0x18fe3e){if(_0x18fe3e){return db[_0x119d('0x62')]['transaction'](function(_0x4a79aa){return db[_0x119d('0x54')]['findAll']({'where':{'userProfileId':_0x29d5dc[_0x119d('0x43')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x2bcb9e){if(_0x2bcb9e){return db[_0x119d('0x54')]['destroy']({'where':{'userProfileId':_0x29d5dc[_0x119d('0x43')]['id'],'id':_[_0x119d('0x2a')](_0x2bcb9e,function(_0x1dd0fc){return _0x1dd0fc['id'];})},'transaction':_0x4a79aa});}})[_0x119d('0x26')](function(_0x4e7502){var _0x5cc785=_[_0x119d('0x2a')](_0x29d5dc[_0x119d('0x46')],function(_0x395f3f){_0x395f3f[_0x119d('0x52')]=_0x29d5dc[_0x119d('0x43')]['id'];return _0x395f3f;});return db[_0x119d('0x54')][_0x119d('0x63')](_0x5cc785,{'raw':!![],'transaction':_0x4a79aa});})['then'](function(_0x2efaa3){var _0x503700=_[_0x119d('0x3b')](_[_0x119d('0x2a')](_0x2efaa3,function(_0x317be6){return _0x317be6[_0x119d('0x48')]({'plain':!![]});}),{'includeAll':![]});if(_0x503700){return db[_0x119d('0x54')][_0x119d('0x4d')]({'where':{'userProfileId':_0x29d5dc[_0x119d('0x43')]['id'],'sectionId':_[_0x119d('0x2a')](_0x503700,function(_0x40abc3){return _0x40abc3[_0x119d('0x51')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x119d('0x26')](function(_0xc247a4){var _0x2bea10=_[_0x119d('0x2a')](_0x29d5dc['body'],function(_0x395687){_0x395687[_0x119d('0x52')]=_0x29d5dc[_0x119d('0x43')]['id'];return _0x395687;});return db[_0x119d('0x50')][_0x119d('0x63')](_0x2bea10,{'raw':!![],'transaction':_0x4a79aa});});}})[_0x119d('0x41')](handleError(_0x5ecad8,null));});}})[_0x119d('0x26')](function(_0x2639ee){var _0xcc784b=_['map'](_0x2639ee,function(_0x3876b2){return _0x3876b2[_0x119d('0x48')]({'plain':!![]});});})[_0x119d('0x26')](respondWithResult(_0x5ecad8,null))[_0x119d('0x41')](handleError(_0x5ecad8,null));};exports[_0x119d('0x64')]=function(_0x1480fc,_0x147b71,_0x4cf5ae){return db['UserProfile'][_0x119d('0x44')]({'where':{'id':_0x1480fc[_0x119d('0x43')]['id']}})[_0x119d('0x26')](handleEntityNotFound(_0x147b71,null))['then'](function(_0x12a222){if(_0x12a222){return _0x12a222['removeResources'](_0x1480fc[_0x119d('0x30')][_0x119d('0x57')]);}})[_0x119d('0x26')](respondWithStatusCode(_0x147b71,null))[_0x119d('0x41')](handleError(_0x147b71,null));};exports[_0x119d('0x65')]=function(_0x11d35c,_0x35b14c){var _0x1302cb={'raw':![],'where':{}};var _0x372aed={};var _0x32c591={'count':0x0,'rows':[]};var _0x4ad9f8=_0x11d35c[_0x119d('0x30')][_0x119d('0x66')];if(typeof _0x4ad9f8===_0x119d('0x67')){throw new db[(_0x119d('0x68'))]['ValidationError'](_0x119d('0x69'));}var _0x2d9fcd=_0x11d35c[_0x119d('0x30')][_0x119d('0x6a')]||![];var _0x3265df=getQueryModels(_0x4ad9f8,_0x2d9fcd);if(typeof _0x3265df[_0x119d('0x6b')]==='undefined'){throw new db['Sequelize']['ValidationError']('Invalid\x20section\x20\x27'+_0x4ad9f8+'\x27');}var _0x32b430=[];if(!_[_0x119d('0x5a')](_0x3265df['parentSections'])){_0x32b430=_0x3265df['parentSections'];}else{_0x32b430=[{'name':_0x4ad9f8}];}return db[_0x119d('0x2b')][_0x119d('0x5e')]({'where':{'id':_0x11d35c[_0x119d('0x43')]['id']}})[_0x119d('0x26')](handleEntityNotFound(_0x35b14c,null))[_0x119d('0x26')](function(_0x1fbb01){if(_0x1fbb01){var _0x175102=[];for(var _0x38019e=0x0;_0x38019e<_0x32b430['length'];_0x38019e++){_0x175102[_0x119d('0x5d')](db[_0x119d('0x54')][_0x119d('0x5e')]({'where':{'userProfileId':_0x1fbb01['id'],'name':_0x32b430[_0x38019e]['name']},'raw':!![]}));}return BPromise[_0x119d('0x6c')](_0x175102);}})[_0x119d('0x26')](function(_0x5c2e01){var _0x205d93=_[_0x119d('0x3b')](_0x5c2e01,function(_0x1aed48){return _0x1aed48?_0x1aed48:undefined;});var _0x750e5e=_['filter'](_0x32b430,[_0x119d('0x6d'),!![]]);var _0x2222a1=_[_0x119d('0x5a')](_0x205d93)&&_['isEmpty'](_0x750e5e)?null:_[_0x119d('0x6e')](_0x750e5e,_0x205d93);if(_0x2222a1){var _0x5287c6=[];for(var _0x1759bb=0x0;_0x1759bb<_0x2222a1['length'];_0x1759bb++){var _0x440c84=_[_0x119d('0x44')](_0x32b430,function(_0x1f2cc3){return _0x2222a1[_0x1759bb]?_0x1f2cc3[_0x119d('0x27')]===_0x2222a1[_0x1759bb][_0x119d('0x27')]:null;});if(_0x440c84){if(_0x2222a1[_0x1759bb][_0x119d('0x6d')]){_0x5287c6[_0x119d('0x5d')](getAllResources(_0x3265df['childModel'],_0x2222a1[_0x1759bb]));}else{if(!_0x2222a1[_0x1759bb][_0x119d('0x4f')]){_0x5287c6[_0x119d('0x5d')](getAllowedResources(_0x440c84,_0x2222a1[_0x1759bb],_0x3265df[_0x119d('0x6b')]));}else{if(_0x440c84[_0x119d('0x2f')]){_0x5287c6[_0x119d('0x5d')](getAllFilteredResources(_0x440c84,_0x2222a1[_0x1759bb]));}}}}}return BPromise[_0x119d('0x6c')](_0x5287c6);}else{return null;}})[_0x119d('0x26')](function(_0x4c20e5){var _0x1a7406=_0x4c20e5;var _0x4d721b=null;if(_0x1a7406){_0x4d721b=_0x1a7406[_0x119d('0x36')]===0x1?_0x1a7406[0x0]:null;}if(_0x4d721b||_0x1a7406){var _0xba72e9=db[_0x3265df[_0x119d('0x6b')]][_0x119d('0x2c')];_0x372aed[_0x119d('0x2f')]=_[_0x119d('0x31')](_0xba72e9);_0x372aed[_0x119d('0x30')]=_[_0x119d('0x31')](_0x11d35c[_0x119d('0x30')]);_0x372aed['filters']=_[_0x119d('0x33')](_0x372aed[_0x119d('0x2f')],_0x372aed[_0x119d('0x30')]);_0x1302cb[_0x119d('0x35')]=_[_0x119d('0x33')](_0x372aed[_0x119d('0x2f')],qs[_0x119d('0x34')](_0x11d35c['query']['fields']));_0x1302cb[_0x119d('0x35')]=_0x1302cb[_0x119d('0x35')]['length']?_0x1302cb[_0x119d('0x35')]:_0x372aed['model'];if(!_0x11d35c[_0x119d('0x30')][_0x119d('0x6f')]('nolimit')){_0x1302cb[_0x119d('0x21')]=qs[_0x119d('0x21')](_0x11d35c['query'][_0x119d('0x21')]);_0x1302cb[_0x119d('0x20')]=qs[_0x119d('0x20')](_0x11d35c['query'][_0x119d('0x20')]);}_0x1302cb[_0x119d('0x70')]=qs[_0x119d('0x38')](_0x11d35c[_0x119d('0x30')]['sort']);_0x1302cb['where']=qs[_0x119d('0x32')](_['pick'](_0x11d35c[_0x119d('0x30')],_0x372aed['filters']));if(_0x11d35c['query'][_0x119d('0x3b')]){_0x1302cb[_0x119d('0x39')]=_['merge'](_0x1302cb['where'],{'$or':_[_0x119d('0x2a')](_0xba72e9,function(_0x546346){if(_0x546346['type'][_0x119d('0x2e')]!==_0x119d('0x71')){var _0x1566d3={};_0x1566d3[_0x546346[_0x119d('0x72')]]={'$like':'%'+_0x11d35c['query'][_0x119d('0x3b')]+'%'};return _0x1566d3;}})});}var _0x180982=[];if(_0x4d721b){var _0x1ded00=_[_0x119d('0x44')](_0x32b430,['name',_0x4d721b[_0x119d('0x27')]]);if(_0x1ded00['field']){var _0x5b8142={};if(_0x3265df[_0x119d('0x6b')]===_0x119d('0x73')){_0x5b8142[_0x1ded00[_0x119d('0x74')]]=_['map'](_0x4d721b[_0x119d('0x75')],'id');}else{_0x5b8142[_0x1ded00[_0x119d('0x74')]]=_0x4d721b[_0x119d('0x75')];}_0x180982[_0x119d('0x5d')](_0x5b8142);}else{_0x1302cb[_0x119d('0x39')]['id']=_0x4d721b[_0x119d('0x75')];}}else{for(var _0xe9ab4c=0x0;_0xe9ab4c<_0x1a7406['length'];_0xe9ab4c++){var _0x1ded00=_[_0x119d('0x44')](_0x32b430,['name',_0x1a7406[_0xe9ab4c][_0x119d('0x27')]]);if(_0x1ded00[_0x119d('0x72')]){var _0x5b8142={};_0x5b8142[_0x1ded00['foreignKey']]=_0x1a7406[_0xe9ab4c][_0x119d('0x75')];_0x180982[_0x119d('0x5d')](_0x5b8142);}else{if(!_0x1302cb[_0x119d('0x39')]['id'])_0x1302cb['where']['id']=[];_0x1a7406[_0xe9ab4c]['associatedResources'][_0x119d('0x60')](function(_0x3ac986){_0x1302cb[_0x119d('0x39')]['id'][_0x119d('0x5d')](_0x3ac986);});}}}if(!_['isEmpty'](_0x180982)){_0x1302cb['where']=_[_0x119d('0x3c')](_0x1302cb['where'],{'$and':{'$or':_0x180982}});}_0x1302cb=_[_0x119d('0x3c')]({},_0x1302cb,_0x11d35c[_0x119d('0x3e')]);if(_0x4d721b&&!_0x4d721b[_0x119d('0x4f')]&&_0x3265df[_0x119d('0x6b')]===_0x119d('0x73')){if(_0x11d35c[_0x119d('0x30')]['includeAll']){_0x1302cb[_0x119d('0x40')]=[{'all':!![]}];}return db[_0x3265df[_0x119d('0x6b')]]['findAll'](_0x1302cb)[_0x119d('0x26')](function(_0x3dd762){var _0x4d227e=[];_0x3dd762['forEach'](function(_0x597434){var _0x3d2532;switch(_0x597434[_0x119d('0x76')]){case'default':_0x3d2532=_[_0x119d('0x44')](_0x4d721b[_0x119d('0x75')],function(_0x4e8a03){return _0x4e8a03['id']===_0x597434['reportId']&&_0x4e8a03[_0x119d('0x3d')]==='DefaultReports';});break;case'custom':_0x3d2532=_[_0x119d('0x44')](_0x4d721b[_0x119d('0x75')],function(_0xb4a4ac){return _0xb4a4ac['id']===_0x597434[_0x119d('0x77')]&&_0xb4a4ac[_0x119d('0x3d')]==='CustomReports';});break;}if(_0x3d2532)_0x4d227e[_0x119d('0x5d')](_0x597434);});_0x32c591['count']=_0x4d227e['length'];_0x32c591[_0x119d('0x78')]=_0x4d227e;return _0x32c591;});}else{return db[_0x3265df['childModel']][_0x119d('0x1f')]({'where':_0x1302cb[_0x119d('0x39')]})[_0x119d('0x26')](function(_0x9858f0){_0x32c591[_0x119d('0x1f')]=_0x9858f0;if(_0x11d35c['query']['includeAll']){if(_0x3265df['childModel']===_0x119d('0x79')){_0x1302cb['include']=[{'model':db[_0x119d('0x7a')],'as':_0x119d('0x7b'),'attributes':['id',_0x119d('0x27'),_0x119d('0x7c')],'required':_0x11d35c[_0x119d('0x30')]['tag']?!![]:![]},{'model':db[_0x119d('0x7a')],'as':_0x119d('0x7d'),'attributes':['id',_0x119d('0x27'),'color'],'through':_0x11d35c[_0x119d('0x30')]['tag']?{'attributes':[],'where':{'TagId':_0x11d35c[_0x119d('0x30')][_0x119d('0x7e')]||undefined}}:{},'required':_0x11d35c[_0x119d('0x30')][_0x119d('0x7e')]?!![]:![]}];}else{_0x1302cb[_0x119d('0x40')]=[{'all':!![]}];}}return db[_0x3265df[_0x119d('0x6b')]][_0x119d('0x4d')](_0x1302cb);})[_0x119d('0x26')](function(_0x48fee1){_0x32c591[_0x119d('0x78')]=_0x48fee1;return _0x32c591;});}}else{return _0x32c591;}})[_0x119d('0x26')](respondWithFilteredResult(_0x35b14c,_0x1302cb))[_0x119d('0x41')](handleError(_0x35b14c,null));};function getAllResources(_0x7a82d1,_0x566fed){return new BPromise(function(_0x122666,_0x776df2){if(_0x566fed){var _0x24f606=_0x566fed['filter']?{[_0x566fed[_0x119d('0x3b')][_0x119d('0x72')]]:_0x566fed[_0x119d('0x3b')]['value']}:undefined;return db[_0x7a82d1][_0x119d('0x4d')]({'where':_0x24f606,'raw':!![]})[_0x119d('0x26')](function(_0x2a4639){_0x566fed[_0x119d('0x75')]=_[_0x119d('0x2a')](_0x2a4639,'id');_0x122666(_0x566fed);})[_0x119d('0x41')](function(_0x19504a){_0x776df2(_0x19504a);});}else{_0x122666(null);}});}function getAllFilteredResources(_0x2ec58f,_0x36be04){return new BPromise(function(_0x152b2a,_0x5b2211){var _0x46b016=_0x2ec58f[_0x119d('0x3b')]?{[_0x2ec58f[_0x119d('0x3b')]['field']]:_0x2ec58f[_0x119d('0x3b')][_0x119d('0x7f')]}:undefined;return db[_0x2ec58f['model']][_0x119d('0x4d')]({'where':_0x46b016,'raw':!![]})[_0x119d('0x26')](function(_0x47ea11){_0x36be04[_0x119d('0x75')]=_[_0x119d('0x2a')](_0x47ea11,function(_0x4c7faa){return _0x4c7faa['name'];});_0x152b2a(_0x36be04);})[_0x119d('0x41')](function(_0x931e40){_0x5b2211(_0x931e40);});});}function getAllowedResources(_0x38f40d,_0x3879fd,_0x2d8491){return new BPromise(function(_0x364fdb,_0x58bde1){if(_0x3879fd){return db[_0x119d('0x50')][_0x119d('0x4d')]({'where':{'sectionId':_0x3879fd['id']},'raw':!![]})[_0x119d('0x26')](function(_0x5b5a6d){if(_0x38f40d[_0x119d('0x72')]&&_0x38f40d[_0x119d('0x72')]!=='id'){_0x3879fd['associatedResources']=_[_0x119d('0x2a')](_0x5b5a6d,function(_0x45a171){return _0x45a171[_0x38f40d[_0x119d('0x72')]];});}else{if(_0x2d8491===_0x119d('0x73')){_0x3879fd[_0x119d('0x75')]=_[_0x119d('0x2a')](_0x5b5a6d,function(_0x20b5aa){return{'id':_0x20b5aa[_0x119d('0x61')],'type':_0x20b5aa['type']};});}else{_0x3879fd[_0x119d('0x75')]=_[_0x119d('0x2a')](_0x5b5a6d,function(_0xa0e772){return _0xa0e772[_0x119d('0x61')];});}}_0x364fdb(_0x3879fd);})[_0x119d('0x41')](function(_0x36cee0){_0x58bde1(_0x36cee0);});}else{_0x364fdb(null);}});}function getQueryModels(_0x189747,_0x465220){var _0xa7e7d3=_0x189747['toLowerCase']();var _0x5bfd53={'childModel':undefined,'parentSections':[]};switch(_0xa7e7d3){case _0x119d('0x80'):_0x5bfd53['childModel']=_0x119d('0x81');break;case'odbc':_0x5bfd53[_0x119d('0x6b')]='SquareOdbc';break;case _0x119d('0x82'):_0x5bfd53['childModel']=_0x119d('0x83');_0x5bfd53[_0x119d('0x84')]=[{'name':_0x119d('0x85'),'field':_0x119d('0x27'),'foreignKey':_0x119d('0x86')}];break;case _0x119d('0x87'):_0x5bfd53['childModel']=_0x119d('0x88');break;case _0x119d('0x89'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x79');_0x5bfd53['parentSections']=[{'name':_0x119d('0x8a'),'field':'id','foreignKey':'ListId'}];break;case _0x119d('0x8b'):_0x5bfd53['childModel']='CmList';break;case _0x119d('0x8c'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x8d');break;case'globalcustomfields':_0x5bfd53[_0x119d('0x6b')]='CmCustomField';break;case _0x119d('0x8e'):_0x5bfd53[_0x119d('0x6b')]='ChatQueue';break;case _0x119d('0x8f'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x90');break;case _0x119d('0x91'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x92');break;case _0x119d('0x93'):_0x5bfd53[_0x119d('0x6b')]='FaxAccount';break;case'inboundroutes':case _0x119d('0x94'):case _0x119d('0x95'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x96');break;case _0x119d('0x97'):_0x5bfd53[_0x119d('0x6b')]='VoiceContext';break;case _0x119d('0x98'):_0x5bfd53['childModel']=_0x119d('0x99');break;case _0x119d('0x9a'):_0x5bfd53[_0x119d('0x6b')]='VoiceRecording';_0x5bfd53[_0x119d('0x84')]=[{'name':'Agents','field':_0x119d('0x27'),'foreignKey':_0x119d('0x9b'),'model':_0x119d('0x9c'),'filter':{'field':_0x119d('0x9d'),'value':[_0x119d('0x9e')]}},{'name':_0x119d('0x9f'),'field':_0x119d('0x27'),'foreignKey':_0x119d('0x9b'),'model':_0x119d('0x9c'),'filter':{'field':_0x119d('0x9d'),'value':[_0x119d('0xa0')]}},{'name':_0x119d('0xa1'),'field':_0x119d('0x27'),'foreignKey':_0x119d('0xa2'),'model':_0x119d('0xa3'),'filter':{'field':_0x119d('0x3d'),'value':[_0x119d('0xa4')]}},{'name':_0x119d('0xa5'),'field':_0x119d('0x27'),'foreignKey':_0x119d('0xa2'),'model':'VoiceQueue','filter':{'field':_0x119d('0x3d'),'value':[_0x119d('0xa6')]}}];break;case _0x119d('0xa7'):_0x5bfd53['childModel']=_0x119d('0xa8');break;case _0x119d('0xa9'):_0x5bfd53['childModel']=_0x119d('0xaa');break;case _0x119d('0xab'):_0x5bfd53['childModel']=_0x119d('0xac');break;case _0x119d('0xad'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xae');break;case _0x119d('0xaf'):_0x5bfd53['childModel']='MailQueue';break;case _0x119d('0xb0'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xb1');break;case _0x119d('0xb2'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xb3');break;case _0x119d('0xb4'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xb5');break;case _0x119d('0xb6'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xb7');break;case'smsqueues':_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xb8');break;case _0x119d('0xb9'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xba');break;case _0x119d('0xbb'):_0x5bfd53['childModel']='Team';break;case'voicequeues':case _0x119d('0xbc'):_0x5bfd53[_0x119d('0x6b')]='VoiceQueue';if(_0x465220){_0x5bfd53[_0x119d('0x84')]=[{'name':'VoiceQueues'},{'name':_0x119d('0xa5')}];}break;case _0x119d('0xbd'):case _0x119d('0xbe'):case _0x119d('0xbf'):_0x5bfd53[_0x119d('0x6b')]='User';if(_0x465220){_0x5bfd53[_0x119d('0x84')]=[{'name':_0x119d('0xc0'),'filter':{'field':_0x119d('0x9d'),'value':[_0x119d('0xc1'),_0x119d('0xc2')]},'ignore':!![]},{'name':_0x119d('0xc3')},{'name':_0x119d('0x9f')}];}break;case _0x119d('0xc4'):_0x5bfd53['childModel']=_0x119d('0xc5');break;case _0x119d('0xc6'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xc7');break;case _0x119d('0xc8'):_0x5bfd53[_0x119d('0x6b')]='FreshdeskAccount';break;case _0x119d('0xc9'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xca');break;case _0x119d('0xcb'):_0x5bfd53['childModel']=_0x119d('0xcc');break;case _0x119d('0xcd'):_0x5bfd53['childModel']=_0x119d('0xce');break;case _0x119d('0xcf'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x9c');break;case _0x119d('0xd0'):_0x5bfd53[_0x119d('0x6b')]='CannedAnswer';break;case'dispositions':_0x5bfd53['childModel']=_0x119d('0xd1');break;case _0x119d('0xd2'):_0x5bfd53[_0x119d('0x6b')]='Dashboard';break;case _0x119d('0xd3'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xd4');break;case _0x119d('0xd5'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xd6');break;case _0x119d('0xd7'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xd8');break;case'sounds':_0x5bfd53[_0x119d('0x6b')]='Sound';break;case _0x119d('0xd9'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x7a');break;case _0x119d('0xda'):_0x5bfd53['childModel']='Template';break;case _0x119d('0xdb'):_0x5bfd53[_0x119d('0x6b')]='Trigger';break;case'trunks':_0x5bfd53[_0x119d('0x6b')]='Trunk';break;case'variables':_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xdc');break;case _0x119d('0xdd'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xde');break;case _0x119d('0xdf'):_0x5bfd53[_0x119d('0x6b')]=_0x119d('0x73');_0x5bfd53[_0x119d('0x84')]=[{'name':_0x119d('0xe0'),'field':'id','foreignKey':_0x119d('0x77')}];break;case'metrics':_0x5bfd53[_0x119d('0x6b')]=_0x119d('0xe1');break;default:return _0x5bfd53;}return _0x5bfd53;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 067939a..9822970 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 _0xe493=['hasOwnProperty','hook','exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit'];(function(_0x296d34,_0x425387){var _0x1494a7=function(_0x1e7b0d){while(--_0x1e7b0d){_0x296d34['push'](_0x296d34['shift']());}};_0x1494a7(++_0x425387);}(_0xe493,0x71));var _0x3e49=function(_0x59359e,_0x342a9f){_0x59359e=_0x59359e-0x0;var _0x51052c=_0xe493[_0x59359e];return _0x51052c;};'use strict';var EventEmitter=require(_0x3e49('0x0'));var UserProfile=require(_0x3e49('0x1'))['db'][_0x3e49('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3e49('0x3')](0x0);var events={'afterCreate':_0x3e49('0x4'),'afterUpdate':_0x3e49('0x5'),'afterDestroy':_0x3e49('0x6')};function emitEvent(_0x3f2c66){return function(_0x5a4cc9,_0x3e5df7,_0x5b4255){UserProfileEvents[_0x3e49('0x7')](_0x3f2c66+':'+_0x5a4cc9['id'],_0x5a4cc9);UserProfileEvents[_0x3e49('0x7')](_0x3f2c66,_0x5a4cc9);_0x5b4255(null);};}for(var e in events){if(events[_0x3e49('0x8')](e)){var event=events[e];UserProfile[_0x3e49('0x9')](e,emitEvent(event));}}module[_0x3e49('0xa')]=UserProfileEvents; \ No newline at end of file +var _0x2344=['exports','events','UserProfile','save','update','remove','emit','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2344,0x1c9));var _0x4234=function(_0x36824b,_0x14ffb8){_0x36824b=_0x36824b-0x0;var _0x30789c=_0x2344[_0x36824b];return _0x30789c;};'use strict';var EventEmitter=require(_0x4234('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x4234('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4234('0x2'),'afterUpdate':_0x4234('0x3'),'afterDestroy':_0x4234('0x4')};function emitEvent(_0x3b4dcf){return function(_0x3b114a,_0x42e00f,_0x5ac7ef){UserProfileEvents[_0x4234('0x5')](_0x3b4dcf+':'+_0x3b114a['id'],_0x3b114a);UserProfileEvents['emit'](_0x3b4dcf,_0x3b114a);_0x5ac7ef(null);};}for(var e in events){if(events[_0x4234('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x4234('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 0a6997e..627e64e 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 _0x712d=['../../config/logger','api','bluebird','rimraf','../../config/environment','./userProfile.attributes','exports','define','user_profiles','lodash','util'];(function(_0x5d3011,_0x4bb985){var _0x2df2f4=function(_0x4d73db){while(--_0x4d73db){_0x5d3011['push'](_0x5d3011['shift']());}};_0x2df2f4(++_0x4bb985);}(_0x712d,0xa3));var _0xd712=function(_0x2e7e02,_0x56b9b5){_0x2e7e02=_0x2e7e02-0x0;var _0x148e4c=_0x712d[_0x2e7e02];return _0x148e4c;};'use strict';var _=require(_0xd712('0x0'));var util=require(_0xd712('0x1'));var logger=require(_0xd712('0x2'))(_0xd712('0x3'));var moment=require('moment');var BPromise=require(_0xd712('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd712('0x5'));var config=require(_0xd712('0x6'));var attributes=require(_0xd712('0x7'));module[_0xd712('0x8')]=function(_0x45ef69,_0x1870ca){return _0x45ef69[_0xd712('0x9')]('UserProfile',attributes,{'tableName':_0xd712('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac7f=['lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','./userProfile.attributes','exports','define','user_profiles'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xac7f,0xa0));var _0xfac7=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xac7f[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0xfac7('0x0'));var util=require(_0xfac7('0x1'));var logger=require(_0xfac7('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfac7('0x3'));var rp=require(_0xfac7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfac7('0x5'));var attributes=require(_0xfac7('0x6'));module[_0xfac7('0x7')]=function(_0x4b5722,_0x593b7d){return _0x4b5722[_0xfac7('0x8')]('UserProfile',attributes,{'tableName':_0xfac7('0x9'),'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 4b52878..13ff76a 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 _0xa630=['debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent'];(function(_0x30d158,_0x45a430){var _0x43fa6d=function(_0xc7d36a){while(--_0xc7d36a){_0x30d158['push'](_0x30d158['shift']());}};_0x43fa6d(++_0x45a430);}(_0xa630,0xbe));var _0x0a63=function(_0x45d51f,_0x1b60e5){_0x45d51f=_0x45d51f-0x0;var _0x9afa32=_0xa630[_0x45d51f];return _0x9afa32;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a63('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a63('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a63('0x4'))(_0x0a63('0x5'));var config=require(_0x0a63('0x6'));var jayson=require(_0x0a63('0x7'));var client=jayson[_0x0a63('0x8')]['http']({'port':0x232a});config[_0x0a63('0x9')]=_[_0x0a63('0xa')](config[_0x0a63('0x9')],{'host':_0x0a63('0xb'),'port':0x18eb});var socket=require(_0x0a63('0xc'))(new Redis(config[_0x0a63('0x9')]));require('./userProfile.socket')[_0x0a63('0xd')](socket);function respondWithRpcPromise(_0xb714c7,_0x2dcbda,_0x218142){return new BPromise(function(_0x327bb0,_0x1cccac){return client[_0x0a63('0xe')](_0xb714c7,_0x218142)[_0x0a63('0xf')](function(_0x258511){logger[_0x0a63('0x10')]('UserProfile,\x20%s,\x20%s',_0x2dcbda,_0x0a63('0x11'));logger[_0x0a63('0x12')](_0x0a63('0x13'),_0x2dcbda,_0x0a63('0x11'),JSON['stringify'](_0x258511));if(_0x258511[_0x0a63('0x14')]){if(_0x258511['error'][_0x0a63('0x15')]===0x1f4){logger[_0x0a63('0x14')](_0x0a63('0x16'),_0x2dcbda,_0x258511[_0x0a63('0x14')][_0x0a63('0x17')]);return _0x1cccac(_0x258511[_0x0a63('0x14')][_0x0a63('0x17')]);}logger[_0x0a63('0x14')]('UserProfile,\x20%s,\x20%s',_0x2dcbda,_0x258511[_0x0a63('0x14')]['message']);return _0x327bb0(_0x258511[_0x0a63('0x14')][_0x0a63('0x17')]);}else{logger[_0x0a63('0x10')](_0x0a63('0x16'),_0x2dcbda,_0x0a63('0x11'));_0x327bb0(_0x258511[_0x0a63('0x18')][_0x0a63('0x17')]);}})[_0x0a63('0x19')](function(_0x2fd06c){logger[_0x0a63('0x14')](_0x0a63('0x16'),_0x2dcbda,_0x2fd06c);_0x1cccac(_0x2fd06c);});});} \ No newline at end of file +var _0x8958=['UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','register','request','info'];(function(_0x2674a2,_0x19491d){var _0x455e64=function(_0x528e41){while(--_0x528e41){_0x2674a2['push'](_0x2674a2['shift']());}};_0x455e64(++_0x19491d);}(_0x8958,0x93));var _0x8895=function(_0x337607,_0x4dc6d8){_0x337607=_0x337607-0x0;var _0x5a5816=_0x8958[_0x337607];return _0x5a5816;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8895('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x8895('0x2'))(_0x8895('0x3'));var config=require(_0x8895('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x8895('0x5')][_0x8895('0x6')]({'port':0x232a});config[_0x8895('0x7')]=_[_0x8895('0x8')](config[_0x8895('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x8895('0x9'))(new Redis(config[_0x8895('0x7')]));require(_0x8895('0xa'))[_0x8895('0xb')](socket);function respondWithRpcPromise(_0x6eab1e,_0x29c126,_0x22a12b){return new BPromise(function(_0xdb3d59,_0x46c467){return client[_0x8895('0xc')](_0x6eab1e,_0x22a12b)['then'](function(_0x1cf600){logger[_0x8895('0xd')](_0x8895('0xe'),_0x29c126,_0x8895('0xf'));logger[_0x8895('0x10')](_0x8895('0x11'),_0x29c126,'request\x20sent',JSON[_0x8895('0x12')](_0x1cf600));if(_0x1cf600[_0x8895('0x13')]){if(_0x1cf600[_0x8895('0x13')]['code']===0x1f4){logger['error'](_0x8895('0xe'),_0x29c126,_0x1cf600['error'][_0x8895('0x14')]);return _0x46c467(_0x1cf600[_0x8895('0x13')][_0x8895('0x14')]);}logger[_0x8895('0x13')](_0x8895('0xe'),_0x29c126,_0x1cf600['error'][_0x8895('0x14')]);return _0xdb3d59(_0x1cf600[_0x8895('0x13')][_0x8895('0x14')]);}else{logger[_0x8895('0xd')](_0x8895('0xe'),_0x29c126,_0x8895('0xf'));_0xdb3d59(_0x1cf600[_0x8895('0x15')][_0x8895('0x14')]);}})[_0x8895('0x16')](function(_0x2da618){logger[_0x8895('0x13')](_0x8895('0xe'),_0x29c126,_0x2da618);_0x46c467(_0x2da618);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index f6ffb43..97f5d8f 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 _0xf321=['length','userProfile:','./userProfile.events','remove','removeListener','register'];(function(_0x41c31e,_0x4b0236){var _0xee094=function(_0x2cce17){while(--_0x2cce17){_0x41c31e['push'](_0x41c31e['shift']());}};_0xee094(++_0x4b0236);}(_0xf321,0x86));var _0x1f32=function(_0x52bcca,_0x3da0fd){_0x52bcca=_0x52bcca-0x0;var _0x5cdc08=_0xf321[_0x52bcca];return _0x5cdc08;};'use strict';var UserProfileEvents=require(_0x1f32('0x0'));var events=['save',_0x1f32('0x1'),'update'];function createListener(_0x57cfe5,_0x15ee4c){return function(_0x40bd1a){_0x15ee4c['emit'](_0x57cfe5,_0x40bd1a);};}function removeListener(_0x44fa12,_0x139cf4){return function(){UserProfileEvents[_0x1f32('0x2')](_0x44fa12,_0x139cf4);};}exports[_0x1f32('0x3')]=function(_0x1d58ec){for(var _0x26acaf=0x0,_0x3a66cd=events[_0x1f32('0x4')];_0x26acaf<_0x3a66cd;_0x26acaf++){var _0x284af2=events[_0x26acaf];var _0x325d96=createListener(_0x1f32('0x5')+_0x284af2,_0x1d58ec);UserProfileEvents['on'](_0x284af2,_0x325d96);}}; \ No newline at end of file +var _0xa713=['remove','update','emit','removeListener','length','userProfile:','./userProfile.events','save'];(function(_0x3ba801,_0x1461f7){var _0xf4999a=function(_0x1ebd06){while(--_0x1ebd06){_0x3ba801['push'](_0x3ba801['shift']());}};_0xf4999a(++_0x1461f7);}(_0xa713,0x1ce));var _0x3a71=function(_0x4f350b,_0xd6d913){_0x4f350b=_0x4f350b-0x0;var _0x4dcf9d=_0xa713[_0x4f350b];return _0x4dcf9d;};'use strict';var UserProfileEvents=require(_0x3a71('0x0'));var events=[_0x3a71('0x1'),_0x3a71('0x2'),_0x3a71('0x3')];function createListener(_0x20d83b,_0x95d61f){return function(_0x1d0007){_0x95d61f[_0x3a71('0x4')](_0x20d83b,_0x1d0007);};}function removeListener(_0x603cfe,_0x547743){return function(){UserProfileEvents[_0x3a71('0x5')](_0x603cfe,_0x547743);};}exports['register']=function(_0x5cebc9){for(var _0xc9d067=0x0,_0x5dfe60=events[_0x3a71('0x6')];_0xc9d067<_0x5dfe60;_0xc9d067++){var _0x213a32=events[_0xc9d067];var _0x3722b5=createListener(_0x3a71('0x7')+_0x213a32,_0x5cebc9);UserProfileEvents['on'](_0x213a32,_0x3722b5);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index a5c38a1..690a067 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 _0x7b3d=['destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','./userProfileResource.controller','get','index','/describe','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7b3d,0x1ca));var _0xd7b3=function(_0x34b6af,_0x1a9700){_0x34b6af=_0x34b6af-0x0;var _0x6aedf8=_0x7b3d[_0x34b6af];return _0x6aedf8;};'use strict';var multer=require(_0xd7b3('0x0'));var util=require(_0xd7b3('0x1'));var path=require(_0xd7b3('0x2'));var timeout=require(_0xd7b3('0x3'));var express=require('express');var router=express[_0xd7b3('0x4')]();var auth=require(_0xd7b3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd7b3('0x6'));router[_0xd7b3('0x7')]('/',auth['isAuthenticated'](),controller[_0xd7b3('0x8')]);router[_0xd7b3('0x7')](_0xd7b3('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xd7b3('0x7')]('/:id',auth[_0xd7b3('0xa')](),controller[_0xd7b3('0xb')]);router[_0xd7b3('0xc')]('/',auth[_0xd7b3('0xa')](),controller[_0xd7b3('0xd')]);router['put'](_0xd7b3('0xe'),auth[_0xd7b3('0xa')](),controller[_0xd7b3('0xf')]);router[_0xd7b3('0x10')](_0xd7b3('0xe'),auth[_0xd7b3('0xa')](),controller[_0xd7b3('0x11')]);module[_0xd7b3('0x12')]=router; \ No newline at end of file +var _0xa0df=['create','put','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa0df,0x11d));var _0xfa0d=function(_0x153488,_0x46257d){_0x153488=_0x153488-0x0;var _0x4e3004=_0xa0df[_0x153488];return _0x4e3004;};'use strict';var multer=require(_0xfa0d('0x0'));var util=require(_0xfa0d('0x1'));var path=require('path');var timeout=require(_0xfa0d('0x2'));var express=require(_0xfa0d('0x3'));var router=express['Router']();var auth=require(_0xfa0d('0x4'));var interaction=require(_0xfa0d('0x5'));var config=require(_0xfa0d('0x6'));var controller=require(_0xfa0d('0x7'));router[_0xfa0d('0x8')]('/',auth[_0xfa0d('0x9')](),controller['index']);router[_0xfa0d('0x8')](_0xfa0d('0xa'),auth['isAuthenticated'](),controller[_0xfa0d('0xb')]);router[_0xfa0d('0x8')](_0xfa0d('0xc'),auth['isAuthenticated'](),controller[_0xfa0d('0xd')]);router[_0xfa0d('0xe')]('/',auth['isAuthenticated'](),controller[_0xfa0d('0xf')]);router[_0xfa0d('0x10')]('/:id',auth[_0xfa0d('0x9')](),controller[_0xfa0d('0x11')]);router[_0xfa0d('0x12')](_0xfa0d('0xc'),auth['isAuthenticated'](),controller[_0xfa0d('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 6462670..2418ba6 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 _0x65dc=['exports','sequelize'];(function(_0x11ce03,_0x3fd0a0){var _0xb12a03=function(_0x22d869){while(--_0x22d869){_0x11ce03['push'](_0x11ce03['shift']());}};_0xb12a03(++_0x3fd0a0);}(_0x65dc,0x141));var _0xc65d=function(_0x49f509,_0x5c7395){_0x49f509=_0x49f509-0x0;var _0x1250d2=_0x65dc[_0x49f509];return _0x1250d2;};'use strict';var Sequelize=require(_0xc65d('0x0'));module[_0xc65d('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x524c=['exports','STRING','INTEGER','sequelize'];(function(_0x40f758,_0x3cf9ff){var _0x143c90=function(_0x54cad6){while(--_0x54cad6){_0x40f758['push'](_0x40f758['shift']());}};_0x143c90(++_0x3cf9ff);}(_0x524c,0x177));var _0xc524=function(_0x48f401,_0x83c260){_0x48f401=_0x48f401-0x0;var _0x14636f=_0x524c[_0x48f401];return _0x14636f;};'use strict';var Sequelize=require(_0xc524('0x0'));module[_0xc524('0x1')]={'name':{'type':Sequelize[_0xc524('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc524('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc524('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index eadbd3a..3985535 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 _0x6c9b=['destroy','stack','send','index','map','UserProfileResource','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','name','options','includeAll','findAll','rows','show','params','keys','rawAttributes','include','find','create','body','catch','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','squel','crypto','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then'];(function(_0xfec4f2,_0x27b2aa){var _0x4ee052=function(_0x195ba5){while(--_0x195ba5){_0xfec4f2['push'](_0xfec4f2['shift']());}};_0x4ee052(++_0x27b2aa);}(_0x6c9b,0x108));var _0xb6c9=function(_0x57e9b0,_0x1dfbdf){_0x57e9b0=_0x57e9b0-0x0;var _0xbd00=_0x6c9b[_0x57e9b0];return _0xbd00;};'use strict';var pdf=require(_0xb6c9('0x0'));var emlformat=require(_0xb6c9('0x1'));var rimraf=require(_0xb6c9('0x2'));var zipdir=require(_0xb6c9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb6c9('0x4'));var moment=require(_0xb6c9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb6c9('0x6'));var util=require(_0xb6c9('0x7'));var path=require(_0xb6c9('0x8'));var sox=require(_0xb6c9('0x9'));var csv=require('to-csv');var ejs=require(_0xb6c9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb6c9('0xb'));var crypto=require(_0xb6c9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb6c9('0xd'));var querystring=require('querystring');var Papa=require(_0xb6c9('0xe'));var Redis=require(_0xb6c9('0xf'));var authService=require(_0xb6c9('0x10'));var qs=require(_0xb6c9('0x11'));var as=require(_0xb6c9('0x12'));var hardwareService=require(_0xb6c9('0x13'));var logger=require('../../config/logger')(_0xb6c9('0x14'));var utils=require(_0xb6c9('0x15'));var config=require('../../config/environment');var db=require(_0xb6c9('0x16'))['db'];function respondWithStatusCode(_0x116c95,_0x490ad5){_0x490ad5=_0x490ad5||0xcc;return function(_0x481308){if(_0x481308){return _0x116c95[_0xb6c9('0x17')](_0x490ad5);}return _0x116c95[_0xb6c9('0x18')](_0x490ad5)[_0xb6c9('0x19')]();};}function respondWithResult(_0xf49df6,_0x17c8af){_0x17c8af=_0x17c8af||0xc8;return function(_0x1916f8){if(_0x1916f8){return _0xf49df6[_0xb6c9('0x18')](_0x17c8af)[_0xb6c9('0x1a')](_0x1916f8);}};}function respondWithFilteredResult(_0x30d0bc,_0x4806df){return function(_0x4c5a53){if(_0x4c5a53){var _0x2b84e8=_0x4c5a53[_0xb6c9('0x1b')],_0x511c5b=_0x4806df['offset'],_0x54c2df=_0x4806df[_0xb6c9('0x1c')]+_0x4806df[_0xb6c9('0x1d')],_0x3dd6f5;if(_0x54c2df>=_0x2b84e8){_0x54c2df=_0x2b84e8;_0x3dd6f5=0xc8;}else{_0x3dd6f5=0xce;}_0x30d0bc[_0xb6c9('0x18')](_0x3dd6f5);return _0x30d0bc['set'](_0xb6c9('0x1e'),_0x511c5b+'-'+_0x54c2df+'/'+_0x2b84e8)['json'](_0x4c5a53);}return null;};}function patchUpdates(_0x35ceaa){return function(_0x463118){try{jsonpatch[_0xb6c9('0x1f')](_0x463118,_0x35ceaa,!![]);}catch(_0x14657a){return BPromise[_0xb6c9('0x20')](_0x14657a);}return _0x463118[_0xb6c9('0x21')]();};}function saveUpdates(_0x1bcd05,_0x27ff7f){return function(_0x481f47){if(_0x481f47){return _0x481f47[_0xb6c9('0x22')](_0x1bcd05)[_0xb6c9('0x23')](function(_0x1e872d){return _0x1e872d;});}return null;};}function removeEntity(_0x536c51,_0x26554d){return function(_0x5422e1){if(_0x5422e1){return _0x5422e1[_0xb6c9('0x24')]()[_0xb6c9('0x23')](function(){_0x536c51[_0xb6c9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a12a8,_0x4954f7){return function(_0x2c31f7){if(!_0x2c31f7){_0x2a12a8[_0xb6c9('0x17')](0x194);}return _0x2c31f7;};}function handleError(_0x40d6d3,_0xf4c477){_0xf4c477=_0xf4c477||0x1f4;return function(_0x1aae02){logger['error'](_0x1aae02[_0xb6c9('0x25')]);if(_0x1aae02['name']){delete _0x1aae02['name'];}_0x40d6d3['status'](_0xf4c477)[_0xb6c9('0x26')](_0x1aae02);};}exports[_0xb6c9('0x27')]=function(_0x380c98,_0x4b8fd2){var _0x3efb1d={},_0x29f2b7={},_0x1ac47b={'count':0x0,'rows':[]};var _0x7783d3=_[_0xb6c9('0x28')](db[_0xb6c9('0x29')]['rawAttributes'],function(_0x1e54c2){return{'name':_0x1e54c2[_0xb6c9('0x2a')],'type':_0x1e54c2[_0xb6c9('0x2b')][_0xb6c9('0x2c')]};});_0x29f2b7[_0xb6c9('0x2d')]=_['map'](_0x7783d3,'name');_0x29f2b7[_0xb6c9('0x2e')]=_['keys'](_0x380c98[_0xb6c9('0x2e')]);_0x29f2b7[_0xb6c9('0x2f')]=_[_0xb6c9('0x30')](_0x29f2b7[_0xb6c9('0x2d')],_0x29f2b7[_0xb6c9('0x2e')]);_0x3efb1d[_0xb6c9('0x31')]=_[_0xb6c9('0x30')](_0x29f2b7[_0xb6c9('0x2d')],qs['fields'](_0x380c98['query'][_0xb6c9('0x32')]));_0x3efb1d[_0xb6c9('0x31')]=_0x3efb1d[_0xb6c9('0x31')][_0xb6c9('0x33')]?_0x3efb1d['attributes']:_0x29f2b7[_0xb6c9('0x2d')];if(!_0x380c98[_0xb6c9('0x2e')][_0xb6c9('0x34')](_0xb6c9('0x35'))){_0x3efb1d[_0xb6c9('0x1d')]=qs[_0xb6c9('0x1d')](_0x380c98[_0xb6c9('0x2e')][_0xb6c9('0x1d')]);_0x3efb1d['offset']=qs[_0xb6c9('0x1c')](_0x380c98[_0xb6c9('0x2e')][_0xb6c9('0x1c')]);}_0x3efb1d[_0xb6c9('0x36')]=qs[_0xb6c9('0x37')](_0x380c98[_0xb6c9('0x2e')][_0xb6c9('0x37')]);_0x3efb1d[_0xb6c9('0x38')]=qs[_0xb6c9('0x2f')](_[_0xb6c9('0x39')](_0x380c98['query'],_0x29f2b7['filters']));if(_0x380c98[_0xb6c9('0x2e')][_0xb6c9('0x3a')]){_0x3efb1d[_0xb6c9('0x38')]=_[_0xb6c9('0x3b')](_0x3efb1d[_0xb6c9('0x38')],{'$or':_['map'](_0x7783d3,function(_0x27120d){if(_0x27120d[_0xb6c9('0x2b')]!=='VIRTUAL'){var _0x408850={};_0x408850[_0x27120d[_0xb6c9('0x3c')]]={'$like':'%'+_0x380c98[_0xb6c9('0x2e')][_0xb6c9('0x3a')]+'%'};return _0x408850;}})});}_0x3efb1d=_[_0xb6c9('0x3b')]({},_0x3efb1d,_0x380c98[_0xb6c9('0x3d')]);var _0x3a0dee={'where':_0x3efb1d[_0xb6c9('0x38')]};return db['UserProfileResource']['count'](_0x3a0dee)[_0xb6c9('0x23')](function(_0x342d8c){_0x1ac47b[_0xb6c9('0x1b')]=_0x342d8c;if(_0x380c98[_0xb6c9('0x2e')][_0xb6c9('0x3e')]){_0x3efb1d['include']=[{'all':!![]}];}return db[_0xb6c9('0x29')][_0xb6c9('0x3f')](_0x3efb1d);})[_0xb6c9('0x23')](function(_0x237d32){_0x1ac47b[_0xb6c9('0x40')]=_0x237d32;return _0x1ac47b;})[_0xb6c9('0x23')](respondWithFilteredResult(_0x4b8fd2,_0x3efb1d))['catch'](handleError(_0x4b8fd2,null));};exports[_0xb6c9('0x41')]=function(_0x3e8eb7,_0x6c7de3){var _0x2dcaa7={'raw':![],'where':{'id':_0x3e8eb7[_0xb6c9('0x42')]['id']}},_0x35cf72={};_0x35cf72['model']=_[_0xb6c9('0x43')](db[_0xb6c9('0x29')][_0xb6c9('0x44')]);_0x35cf72[_0xb6c9('0x2e')]=_['keys'](_0x3e8eb7[_0xb6c9('0x2e')]);_0x35cf72[_0xb6c9('0x2f')]=_['intersection'](_0x35cf72['model'],_0x35cf72['query']);_0x2dcaa7[_0xb6c9('0x31')]=_[_0xb6c9('0x30')](_0x35cf72[_0xb6c9('0x2d')],qs[_0xb6c9('0x32')](_0x3e8eb7[_0xb6c9('0x2e')][_0xb6c9('0x32')]));_0x2dcaa7['attributes']=_0x2dcaa7[_0xb6c9('0x31')][_0xb6c9('0x33')]?_0x2dcaa7[_0xb6c9('0x31')]:_0x35cf72['model'];if(_0x3e8eb7['query'][_0xb6c9('0x3e')]){_0x2dcaa7[_0xb6c9('0x45')]=[{'all':!![]}];}_0x2dcaa7=_[_0xb6c9('0x3b')]({},_0x2dcaa7,_0x3e8eb7[_0xb6c9('0x3d')]);return db[_0xb6c9('0x29')][_0xb6c9('0x46')](_0x2dcaa7)[_0xb6c9('0x23')](handleEntityNotFound(_0x6c7de3,null))['then'](respondWithResult(_0x6c7de3,null))['catch'](handleError(_0x6c7de3,null));};exports[_0xb6c9('0x47')]=function(_0x2d666b,_0x28f951){return db[_0xb6c9('0x29')]['create'](_0x2d666b[_0xb6c9('0x48')],{})[_0xb6c9('0x23')](respondWithResult(_0x28f951,0xc9))['catch'](handleError(_0x28f951,null));};exports[_0xb6c9('0x22')]=function(_0x56f931,_0x5b5737){if(_0x56f931[_0xb6c9('0x48')]['id']){delete _0x56f931[_0xb6c9('0x48')]['id'];}return db[_0xb6c9('0x29')][_0xb6c9('0x46')]({'where':{'id':_0x56f931[_0xb6c9('0x42')]['id']}})[_0xb6c9('0x23')](handleEntityNotFound(_0x5b5737,null))[_0xb6c9('0x23')](saveUpdates(_0x56f931['body'],null))[_0xb6c9('0x23')](respondWithResult(_0x5b5737,null))[_0xb6c9('0x49')](handleError(_0x5b5737,null));};exports['destroy']=function(_0x88109,_0x45864a){return db[_0xb6c9('0x29')][_0xb6c9('0x46')]({'where':{'id':_0x88109['params']['id']}})['then'](handleEntityNotFound(_0x45864a,null))[_0xb6c9('0x23')](removeEntity(_0x45864a,null))[_0xb6c9('0x49')](handleError(_0x45864a,null));};exports['describe']=function(_0x42d8c3,_0x4e1594){return db[_0xb6c9('0x29')][_0xb6c9('0x4a')]()[_0xb6c9('0x23')](respondWithResult(_0x4e1594,null))['catch'](handleError(_0x4e1594,null));}; \ No newline at end of file +var _0x2a40=['describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','end','json','count','offset','limit','status','Content-Range','apply','reject','update','destroy','sendStatus','error','stack','name','send','index','map','UserProfileResource','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','then','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a40,0x139));var _0x02a4=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0x2a40[_0xc40b9f];return _0x535b9c;};'use strict';var pdf=require(_0x02a4('0x0'));var emlformat=require(_0x02a4('0x1'));var rimraf=require(_0x02a4('0x2'));var zipdir=require(_0x02a4('0x3'));var jsonpatch=require(_0x02a4('0x4'));var rp=require(_0x02a4('0x5'));var moment=require('moment');var BPromise=require(_0x02a4('0x6'));var Mustache=require(_0x02a4('0x7'));var util=require(_0x02a4('0x8'));var path=require(_0x02a4('0x9'));var sox=require('sox');var csv=require(_0x02a4('0xa'));var ejs=require(_0x02a4('0xb'));var fs=require('fs');var _=require(_0x02a4('0xc'));var squel=require(_0x02a4('0xd'));var crypto=require(_0x02a4('0xe'));var jsforce=require(_0x02a4('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x02a4('0xa'));var querystring=require(_0x02a4('0x10'));var Papa=require(_0x02a4('0x11'));var Redis=require('ioredis');var authService=require(_0x02a4('0x12'));var qs=require(_0x02a4('0x13'));var as=require(_0x02a4('0x14'));var hardwareService=require(_0x02a4('0x15'));var logger=require('../../config/logger')(_0x02a4('0x16'));var utils=require(_0x02a4('0x17'));var config=require(_0x02a4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a6985,_0x22e258){_0x22e258=_0x22e258||0xcc;return function(_0x47800d){if(_0x47800d){return _0x3a6985['sendStatus'](_0x22e258);}return _0x3a6985['status'](_0x22e258)[_0x02a4('0x19')]();};}function respondWithResult(_0x580d95,_0x10e582){_0x10e582=_0x10e582||0xc8;return function(_0x33e71a){if(_0x33e71a){return _0x580d95['status'](_0x10e582)[_0x02a4('0x1a')](_0x33e71a);}};}function respondWithFilteredResult(_0x992628,_0x263619){return function(_0x1de338){if(_0x1de338){var _0x49c749=_0x1de338[_0x02a4('0x1b')],_0x5d9400=_0x263619['offset'],_0x2d4b3f=_0x263619[_0x02a4('0x1c')]+_0x263619[_0x02a4('0x1d')],_0x3c2470;if(_0x2d4b3f>=_0x49c749){_0x2d4b3f=_0x49c749;_0x3c2470=0xc8;}else{_0x3c2470=0xce;}_0x992628[_0x02a4('0x1e')](_0x3c2470);return _0x992628['set'](_0x02a4('0x1f'),_0x5d9400+'-'+_0x2d4b3f+'/'+_0x49c749)[_0x02a4('0x1a')](_0x1de338);}return null;};}function patchUpdates(_0x361a20){return function(_0x3fe0bf){try{jsonpatch[_0x02a4('0x20')](_0x3fe0bf,_0x361a20,!![]);}catch(_0x97bea0){return BPromise[_0x02a4('0x21')](_0x97bea0);}return _0x3fe0bf['save']();};}function saveUpdates(_0x6bcc74,_0x244e9a){return function(_0x1fc8b7){if(_0x1fc8b7){return _0x1fc8b7[_0x02a4('0x22')](_0x6bcc74)['then'](function(_0x5a0098){return _0x5a0098;});}return null;};}function removeEntity(_0x7168b7,_0x292fd1){return function(_0x434063){if(_0x434063){return _0x434063[_0x02a4('0x23')]()['then'](function(){_0x7168b7[_0x02a4('0x1e')](0xcc)[_0x02a4('0x19')]();});}};}function handleEntityNotFound(_0x15db03,_0x5543ca){return function(_0xb58af0){if(!_0xb58af0){_0x15db03[_0x02a4('0x24')](0x194);}return _0xb58af0;};}function handleError(_0x9012c9,_0x1f3bc7){_0x1f3bc7=_0x1f3bc7||0x1f4;return function(_0x24c007){logger[_0x02a4('0x25')](_0x24c007[_0x02a4('0x26')]);if(_0x24c007[_0x02a4('0x27')]){delete _0x24c007[_0x02a4('0x27')];}_0x9012c9[_0x02a4('0x1e')](_0x1f3bc7)[_0x02a4('0x28')](_0x24c007);};}exports[_0x02a4('0x29')]=function(_0x2e3b95,_0x241f13){var _0x5829b4={},_0x41f953={},_0x1c5f20={'count':0x0,'rows':[]};var _0x144bff=_[_0x02a4('0x2a')](db[_0x02a4('0x2b')]['rawAttributes'],function(_0x42b219){return{'name':_0x42b219[_0x02a4('0x2c')],'type':_0x42b219[_0x02a4('0x2d')][_0x02a4('0x2e')]};});_0x41f953[_0x02a4('0x2f')]=_[_0x02a4('0x2a')](_0x144bff,_0x02a4('0x27'));_0x41f953['query']=_[_0x02a4('0x30')](_0x2e3b95['query']);_0x41f953[_0x02a4('0x31')]=_[_0x02a4('0x32')](_0x41f953[_0x02a4('0x2f')],_0x41f953[_0x02a4('0x33')]);_0x5829b4[_0x02a4('0x34')]=_['intersection'](_0x41f953[_0x02a4('0x2f')],qs[_0x02a4('0x35')](_0x2e3b95[_0x02a4('0x33')][_0x02a4('0x35')]));_0x5829b4[_0x02a4('0x34')]=_0x5829b4[_0x02a4('0x34')][_0x02a4('0x36')]?_0x5829b4['attributes']:_0x41f953[_0x02a4('0x2f')];if(!_0x2e3b95[_0x02a4('0x33')][_0x02a4('0x37')](_0x02a4('0x38'))){_0x5829b4[_0x02a4('0x1d')]=qs[_0x02a4('0x1d')](_0x2e3b95[_0x02a4('0x33')][_0x02a4('0x1d')]);_0x5829b4['offset']=qs[_0x02a4('0x1c')](_0x2e3b95['query'][_0x02a4('0x1c')]);}_0x5829b4[_0x02a4('0x39')]=qs[_0x02a4('0x3a')](_0x2e3b95[_0x02a4('0x33')][_0x02a4('0x3a')]);_0x5829b4[_0x02a4('0x3b')]=qs[_0x02a4('0x31')](_[_0x02a4('0x3c')](_0x2e3b95['query'],_0x41f953['filters']));if(_0x2e3b95[_0x02a4('0x33')]['filter']){_0x5829b4[_0x02a4('0x3b')]=_['merge'](_0x5829b4[_0x02a4('0x3b')],{'$or':_[_0x02a4('0x2a')](_0x144bff,function(_0x42bc6a){if(_0x42bc6a[_0x02a4('0x2d')]!==_0x02a4('0x3d')){var _0x304f14={};_0x304f14[_0x42bc6a[_0x02a4('0x27')]]={'$like':'%'+_0x2e3b95[_0x02a4('0x33')][_0x02a4('0x3e')]+'%'};return _0x304f14;}})});}_0x5829b4=_[_0x02a4('0x3f')]({},_0x5829b4,_0x2e3b95[_0x02a4('0x40')]);var _0x2cbb3d={'where':_0x5829b4['where']};return db[_0x02a4('0x2b')][_0x02a4('0x1b')](_0x2cbb3d)[_0x02a4('0x41')](function(_0x42fd25){_0x1c5f20[_0x02a4('0x1b')]=_0x42fd25;if(_0x2e3b95[_0x02a4('0x33')][_0x02a4('0x42')]){_0x5829b4['include']=[{'all':!![]}];}return db[_0x02a4('0x2b')][_0x02a4('0x43')](_0x5829b4);})[_0x02a4('0x41')](function(_0x5a070b){_0x1c5f20[_0x02a4('0x44')]=_0x5a070b;return _0x1c5f20;})[_0x02a4('0x41')](respondWithFilteredResult(_0x241f13,_0x5829b4))[_0x02a4('0x45')](handleError(_0x241f13,null));};exports[_0x02a4('0x46')]=function(_0x5bc6c1,_0x4d0f0f){var _0x5164f6={'raw':![],'where':{'id':_0x5bc6c1[_0x02a4('0x47')]['id']}},_0x55ad35={};_0x55ad35['model']=_[_0x02a4('0x30')](db[_0x02a4('0x2b')][_0x02a4('0x48')]);_0x55ad35['query']=_['keys'](_0x5bc6c1[_0x02a4('0x33')]);_0x55ad35[_0x02a4('0x31')]=_['intersection'](_0x55ad35[_0x02a4('0x2f')],_0x55ad35[_0x02a4('0x33')]);_0x5164f6[_0x02a4('0x34')]=_[_0x02a4('0x32')](_0x55ad35[_0x02a4('0x2f')],qs['fields'](_0x5bc6c1[_0x02a4('0x33')][_0x02a4('0x35')]));_0x5164f6[_0x02a4('0x34')]=_0x5164f6[_0x02a4('0x34')][_0x02a4('0x36')]?_0x5164f6['attributes']:_0x55ad35[_0x02a4('0x2f')];if(_0x5bc6c1[_0x02a4('0x33')][_0x02a4('0x42')]){_0x5164f6[_0x02a4('0x49')]=[{'all':!![]}];}_0x5164f6=_[_0x02a4('0x3f')]({},_0x5164f6,_0x5bc6c1[_0x02a4('0x40')]);return db[_0x02a4('0x2b')][_0x02a4('0x4a')](_0x5164f6)[_0x02a4('0x41')](handleEntityNotFound(_0x4d0f0f,null))['then'](respondWithResult(_0x4d0f0f,null))[_0x02a4('0x45')](handleError(_0x4d0f0f,null));};exports['create']=function(_0x1e7603,_0xbd749b){return db['UserProfileResource'][_0x02a4('0x4b')](_0x1e7603[_0x02a4('0x4c')],{})[_0x02a4('0x41')](respondWithResult(_0xbd749b,0xc9))[_0x02a4('0x45')](handleError(_0xbd749b,null));};exports['update']=function(_0x4196b3,_0x467557){if(_0x4196b3[_0x02a4('0x4c')]['id']){delete _0x4196b3[_0x02a4('0x4c')]['id'];}return db[_0x02a4('0x2b')][_0x02a4('0x4a')]({'where':{'id':_0x4196b3[_0x02a4('0x47')]['id']}})[_0x02a4('0x41')](handleEntityNotFound(_0x467557,null))[_0x02a4('0x41')](saveUpdates(_0x4196b3[_0x02a4('0x4c')],null))['then'](respondWithResult(_0x467557,null))[_0x02a4('0x45')](handleError(_0x467557,null));};exports[_0x02a4('0x23')]=function(_0x542ca0,_0x28e07f){return db['UserProfileResource'][_0x02a4('0x4a')]({'where':{'id':_0x542ca0[_0x02a4('0x47')]['id']}})['then'](handleEntityNotFound(_0x28e07f,null))[_0x02a4('0x41')](removeEntity(_0x28e07f,null))[_0x02a4('0x45')](handleError(_0x28e07f,null));};exports['describe']=function(_0x5d89bd,_0x60376b){return db[_0x02a4('0x2b')][_0x02a4('0x4d')]()[_0x02a4('0x41')](respondWithResult(_0x60376b,null))['catch'](handleError(_0x60376b,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index c6e3e63..12193d2 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 _0x1193=['sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0x1193,0x79));var _0x3119=function(_0x522e74,_0x3e5d2b){_0x522e74=_0x522e74-0x0;var _0x6e402c=_0x1193[_0x522e74];return _0x6e402c;};'use strict';var _=require(_0x3119('0x0'));var util=require(_0x3119('0x1'));var logger=require(_0x3119('0x2'))(_0x3119('0x3'));var moment=require(_0x3119('0x4'));var BPromise=require(_0x3119('0x5'));var rp=require(_0x3119('0x6'));var fs=require('fs');var path=require(_0x3119('0x7'));var rimraf=require('rimraf');var config=require(_0x3119('0x8'));var attributes=require(_0x3119('0x9'));module['exports']=function(_0xcb5e37,_0x35e8b0){return _0xcb5e37['define'](_0x3119('0xa'),attributes,{'tableName':_0x3119('0xb'),'paranoid':![],'indexes':[{'name':_0x3119('0xc'),'fields':[_0x3119('0xd'),_0x3119('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcae1=['compositeIndex','resourceId','sectionId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources'];(function(_0x3a4c02,_0x120520){var _0x14b161=function(_0x283b86){while(--_0x283b86){_0x3a4c02['push'](_0x3a4c02['shift']());}};_0x14b161(++_0x120520);}(_0xcae1,0x1d3));var _0x1cae=function(_0x299ecf,_0x5e642b){_0x299ecf=_0x299ecf-0x0;var _0x4813c9=_0xcae1[_0x299ecf];return _0x4813c9;};'use strict';var _=require(_0x1cae('0x0'));var util=require(_0x1cae('0x1'));var logger=require('../../config/logger')(_0x1cae('0x2'));var moment=require(_0x1cae('0x3'));var BPromise=require(_0x1cae('0x4'));var rp=require(_0x1cae('0x5'));var fs=require('fs');var path=require(_0x1cae('0x6'));var rimraf=require(_0x1cae('0x7'));var config=require(_0x1cae('0x8'));var attributes=require(_0x1cae('0x9'));module['exports']=function(_0x49bde4,_0xa43dc7){return _0x49bde4[_0x1cae('0xa')](_0x1cae('0xb'),attributes,{'tableName':_0x1cae('0xc'),'paranoid':![],'indexes':[{'name':_0x1cae('0xd'),'fields':[_0x1cae('0xe'),_0x1cae('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index ddbdaab..a2573d6 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 _0x2b1f=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UserProfileResource,\x20%s,\x20%s','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x4f7bb4,_0xa5bd0c){var _0x15c45c=function(_0x2e87a0){while(--_0x2e87a0){_0x4f7bb4['push'](_0x4f7bb4['shift']());}};_0x15c45c(++_0xa5bd0c);}(_0x2b1f,0x149));var _0xf2b1=function(_0x3cb300,_0x4d7a99){_0x3cb300=_0x3cb300-0x0;var _0x3e0cd9=_0x2b1f[_0x3cb300];return _0x3e0cd9;};'use strict';var _=require(_0xf2b1('0x0'));var util=require(_0xf2b1('0x1'));var moment=require(_0xf2b1('0x2'));var BPromise=require(_0xf2b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2b1('0x4'));var db=require(_0xf2b1('0x5'))['db'];var utils=require(_0xf2b1('0x6'));var logger=require(_0xf2b1('0x7'))('rpc');var config=require(_0xf2b1('0x8'));var jayson=require(_0xf2b1('0x9'));var client=jayson[_0xf2b1('0xa')][_0xf2b1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e3603,_0x5e1d13,_0x4867a8){return new BPromise(function(_0x2d18d5,_0x52ee16){return client[_0xf2b1('0xc')](_0x3e3603,_0x4867a8)[_0xf2b1('0xd')](function(_0x133fdc){logger[_0xf2b1('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x5e1d13,_0xf2b1('0xf'));logger['debug'](_0xf2b1('0x10'),_0x5e1d13,'request\x20sent',JSON[_0xf2b1('0x11')](_0x133fdc));if(_0x133fdc['error']){if(_0x133fdc[_0xf2b1('0x12')][_0xf2b1('0x13')]===0x1f4){logger[_0xf2b1('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x5e1d13,_0x133fdc['error'][_0xf2b1('0x14')]);return _0x52ee16(_0x133fdc['error'][_0xf2b1('0x14')]);}logger[_0xf2b1('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x5e1d13,_0x133fdc['error'][_0xf2b1('0x14')]);return _0x2d18d5(_0x133fdc['error'][_0xf2b1('0x14')]);}else{logger[_0xf2b1('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x5e1d13,_0xf2b1('0xf'));_0x2d18d5(_0x133fdc[_0xf2b1('0x15')][_0xf2b1('0x14')]);}})['catch'](function(_0x52adf7){logger[_0xf2b1('0x12')](_0xf2b1('0x16'),_0x5e1d13,_0x52adf7);_0x52ee16(_0x52adf7);});});} \ No newline at end of file +var _0x886f=['message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3a0a5f,_0x8d340b){var _0xf18104=function(_0x5ead79){while(--_0x5ead79){_0x3a0a5f['push'](_0x3a0a5f['shift']());}};_0xf18104(++_0x8d340b);}(_0x886f,0x152));var _0xf886=function(_0x281860,_0x93e585){_0x281860=_0x281860-0x0;var _0x1884bb=_0x886f[_0x281860];return _0x1884bb;};'use strict';var _=require(_0xf886('0x0'));var util=require(_0xf886('0x1'));var moment=require(_0xf886('0x2'));var BPromise=require('bluebird');var rs=require(_0xf886('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf886('0x4'));var logger=require(_0xf886('0x5'))(_0xf886('0x6'));var config=require(_0xf886('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf886('0x8')][_0xf886('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x432357,_0x59f2dd,_0x887e2e){return new BPromise(function(_0x4e5057,_0x3c4601){return client[_0xf886('0xa')](_0x432357,_0x887e2e)[_0xf886('0xb')](function(_0x3ee287){logger[_0xf886('0xc')](_0xf886('0xd'),_0x59f2dd,_0xf886('0xe'));logger[_0xf886('0xf')](_0xf886('0x10'),_0x59f2dd,'request\x20sent',JSON[_0xf886('0x11')](_0x3ee287));if(_0x3ee287[_0xf886('0x12')]){if(_0x3ee287[_0xf886('0x12')]['code']===0x1f4){logger['error'](_0xf886('0xd'),_0x59f2dd,_0x3ee287[_0xf886('0x12')][_0xf886('0x13')]);return _0x3c4601(_0x3ee287[_0xf886('0x12')]['message']);}logger[_0xf886('0x12')](_0xf886('0xd'),_0x59f2dd,_0x3ee287['error'][_0xf886('0x13')]);return _0x4e5057(_0x3ee287[_0xf886('0x12')][_0xf886('0x13')]);}else{logger[_0xf886('0xc')](_0xf886('0xd'),_0x59f2dd,'request\x20sent');_0x4e5057(_0x3ee287[_0xf886('0x14')][_0xf886('0x13')]);}})['catch'](function(_0x4198ec){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x59f2dd,_0x4198ec);_0x3c4601(_0x4198ec);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 6bc452f..40b1ca8 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 _0xd2c4=['create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0xd2c4,0x110));var _0x4d2c=function(_0x56188d,_0x514566){_0x56188d=_0x56188d-0x0;var _0x6004b1=_0xd2c4[_0x56188d];return _0x6004b1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4d2c('0x0'));var timeout=require(_0x4d2c('0x1'));var express=require(_0x4d2c('0x2'));var router=express[_0x4d2c('0x3')]();var auth=require(_0x4d2c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4d2c('0x5'));var controller=require('./userProfileSection.controller');router[_0x4d2c('0x6')]('/',auth[_0x4d2c('0x7')](),controller[_0x4d2c('0x8')]);router[_0x4d2c('0x6')](_0x4d2c('0x9'),auth[_0x4d2c('0x7')](),controller['describe']);router[_0x4d2c('0x6')](_0x4d2c('0xa'),auth[_0x4d2c('0x7')](),controller[_0x4d2c('0xb')]);router[_0x4d2c('0xc')]('/',auth['isAuthenticated'](),controller[_0x4d2c('0xd')]);router[_0x4d2c('0xe')](_0x4d2c('0xa'),auth[_0x4d2c('0x7')](),controller[_0x4d2c('0xf')]);router[_0x4d2c('0x10')](_0x4d2c('0xa'),auth[_0x4d2c('0x7')](),controller[_0x4d2c('0x11')]);module[_0x4d2c('0x12')]=router; \ No newline at end of file +var _0xdfee=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','post'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xdfee,0xa8));var _0xedfe=function(_0x36a8eb,_0xd1888c){_0x36a8eb=_0x36a8eb-0x0;var _0xd38480=_0xdfee[_0x36a8eb];return _0xd38480;};'use strict';var multer=require(_0xedfe('0x0'));var util=require(_0xedfe('0x1'));var path=require(_0xedfe('0x2'));var timeout=require(_0xedfe('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xedfe('0x4'));var interaction=require(_0xedfe('0x5'));var config=require(_0xedfe('0x6'));var controller=require('./userProfileSection.controller');router[_0xedfe('0x7')]('/',auth[_0xedfe('0x8')](),controller[_0xedfe('0x9')]);router[_0xedfe('0x7')](_0xedfe('0xa'),auth[_0xedfe('0x8')](),controller['describe']);router[_0xedfe('0x7')]('/:id',auth[_0xedfe('0x8')](),controller['show']);router[_0xedfe('0xb')]('/',auth[_0xedfe('0x8')](),controller['create']);router[_0xedfe('0xc')](_0xedfe('0xd'),auth[_0xedfe('0x8')](),controller[_0xedfe('0xe')]);router[_0xedfe('0xf')]('/:id',auth[_0xedfe('0x8')](),controller[_0xedfe('0x10')]);module[_0xedfe('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 75e9efd..0c20dae 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 _0x8b4f=['exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','sequelize'];(function(_0x2b4216,_0x257828){var _0x2075f9=function(_0x2b3b5c){while(--_0x2b3b5c){_0x2b4216['push'](_0x2b4216['shift']());}};_0x2075f9(++_0x257828);}(_0x8b4f,0x19d));var _0xf8b4=function(_0x2d9e27,_0x5965b2){_0x2d9e27=_0x2d9e27-0x0;var _0xd35381=_0x8b4f[_0x2d9e27];return _0xd35381;};'use strict';var Sequelize=require(_0xf8b4('0x0'));module[_0xf8b4('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xf8b4('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xf8b4('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xf8b4('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xf8b4('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xf8b4('0x2')],'set':function(_0x24b736){this[_0xf8b4('0x5')](_0xf8b4('0x6'),_0x24b736?_0x24b736[_0xf8b4('0x7')](''):[]);},'get':function(){return this['getDataValue'](_0xf8b4('0x6'))?this[_0xf8b4('0x8')](_0xf8b4('0x6'))['split'](''):[];}}}; \ No newline at end of file +var _0xfd7b=['STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue','exports'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0xfd7b[_0x50f392];return _0x5926f2;};'use strict';var Sequelize=require('sequelize');module[_0xbfd7('0x0')]={'name':{'type':Sequelize[_0xbfd7('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xbfd7('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbfd7('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xbfd7('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xbfd7('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbfd7('0x1')],'set':function(_0x221ad1){this[_0xbfd7('0x4')](_0xbfd7('0x5'),_0x221ad1?_0x221ad1[_0xbfd7('0x6')](''):[]);},'get':function(){return this[_0xbfd7('0x7')](_0xbfd7('0x5'))?this['getDataValue'](_0xbfd7('0x5'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 25f7391..1d1fae4 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 _0x3a40=['query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','then','rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','map','UserProfileSection','rawAttributes','fieldName','key','model'];(function(_0xb704e2,_0x4b74e1){var _0xe4e380=function(_0xba4179){while(--_0xba4179){_0xb704e2['push'](_0xb704e2['shift']());}};_0xe4e380(++_0x4b74e1);}(_0x3a40,0x1dd));var _0x03a4=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x3a40[_0x126558];return _0x1f6d14;};'use strict';var pdf=require(_0x03a4('0x0'));var emlformat=require(_0x03a4('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x03a4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03a4('0x3'));var moment=require(_0x03a4('0x4'));var BPromise=require(_0x03a4('0x5'));var Mustache=require(_0x03a4('0x6'));var util=require(_0x03a4('0x7'));var path=require(_0x03a4('0x8'));var sox=require(_0x03a4('0x9'));var csv=require(_0x03a4('0xa'));var ejs=require(_0x03a4('0xb'));var fs=require('fs');var _=require(_0x03a4('0xc'));var squel=require(_0x03a4('0xd'));var crypto=require(_0x03a4('0xe'));var jsforce=require(_0x03a4('0xf'));var deskjs=require(_0x03a4('0x10'));var toCsv=require(_0x03a4('0xa'));var querystring=require(_0x03a4('0x11'));var Papa=require(_0x03a4('0x12'));var Redis=require('ioredis');var authService=require(_0x03a4('0x13'));var qs=require(_0x03a4('0x14'));var as=require(_0x03a4('0x15'));var hardwareService=require(_0x03a4('0x16'));var logger=require('../../config/logger')(_0x03a4('0x17'));var utils=require('../../config/utils');var config=require(_0x03a4('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x280f38,_0x395e76){_0x395e76=_0x395e76||0xcc;return function(_0x56ce39){if(_0x56ce39){return _0x280f38['sendStatus'](_0x395e76);}return _0x280f38[_0x03a4('0x19')](_0x395e76)[_0x03a4('0x1a')]();};}function respondWithResult(_0x19b782,_0x42c9e2){_0x42c9e2=_0x42c9e2||0xc8;return function(_0x55fc8b){if(_0x55fc8b){return _0x19b782['status'](_0x42c9e2)[_0x03a4('0x1b')](_0x55fc8b);}};}function respondWithFilteredResult(_0x1dbf45,_0x43d060){return function(_0x50b0c1){if(_0x50b0c1){var _0x461af1=_0x50b0c1[_0x03a4('0x1c')],_0x1c4bbc=_0x43d060[_0x03a4('0x1d')],_0x1a1d5f=_0x43d060['offset']+_0x43d060[_0x03a4('0x1e')],_0x3ab05b;if(_0x1a1d5f>=_0x461af1){_0x1a1d5f=_0x461af1;_0x3ab05b=0xc8;}else{_0x3ab05b=0xce;}_0x1dbf45[_0x03a4('0x19')](_0x3ab05b);return _0x1dbf45[_0x03a4('0x1f')]('Content-Range',_0x1c4bbc+'-'+_0x1a1d5f+'/'+_0x461af1)['json'](_0x50b0c1);}return null;};}function patchUpdates(_0x5bf62a){return function(_0x558b5d){try{jsonpatch[_0x03a4('0x20')](_0x558b5d,_0x5bf62a,!![]);}catch(_0x5ac741){return BPromise[_0x03a4('0x21')](_0x5ac741);}return _0x558b5d[_0x03a4('0x22')]();};}function saveUpdates(_0x5d92b2,_0x12dc82){return function(_0x30a715){if(_0x30a715){return _0x30a715[_0x03a4('0x23')](_0x5d92b2)['then'](function(_0x5b5465){return _0x5b5465;});}return null;};}function removeEntity(_0x79759,_0x1b63f2){return function(_0x2ea520){if(_0x2ea520){return _0x2ea520[_0x03a4('0x24')]()['then'](function(){_0x79759[_0x03a4('0x19')](0xcc)[_0x03a4('0x1a')]();});}};}function handleEntityNotFound(_0x3d36c9,_0xc04fb8){return function(_0x51c05b){if(!_0x51c05b){_0x3d36c9[_0x03a4('0x25')](0x194);}return _0x51c05b;};}function handleError(_0x1454cf,_0x45c3b1){_0x45c3b1=_0x45c3b1||0x1f4;return function(_0x3e8362){logger[_0x03a4('0x26')](_0x3e8362[_0x03a4('0x27')]);if(_0x3e8362[_0x03a4('0x28')]){delete _0x3e8362[_0x03a4('0x28')];}_0x1454cf[_0x03a4('0x19')](_0x45c3b1)[_0x03a4('0x29')](_0x3e8362);};}exports['index']=function(_0x2dd9e7,_0x145aa6){var _0x53d109={},_0x5e22a1={},_0x1318cf={'count':0x0,'rows':[]};var _0x448598=_[_0x03a4('0x2a')](db[_0x03a4('0x2b')][_0x03a4('0x2c')],function(_0x5c897b){return{'name':_0x5c897b[_0x03a4('0x2d')],'type':_0x5c897b['type'][_0x03a4('0x2e')]};});_0x5e22a1[_0x03a4('0x2f')]=_[_0x03a4('0x2a')](_0x448598,'name');_0x5e22a1[_0x03a4('0x30')]=_['keys'](_0x2dd9e7[_0x03a4('0x30')]);_0x5e22a1[_0x03a4('0x31')]=_[_0x03a4('0x32')](_0x5e22a1['model'],_0x5e22a1['query']);_0x53d109['attributes']=_[_0x03a4('0x32')](_0x5e22a1['model'],qs[_0x03a4('0x33')](_0x2dd9e7[_0x03a4('0x30')]['fields']));_0x53d109[_0x03a4('0x34')]=_0x53d109[_0x03a4('0x34')][_0x03a4('0x35')]?_0x53d109[_0x03a4('0x34')]:_0x5e22a1[_0x03a4('0x2f')];if(!_0x2dd9e7[_0x03a4('0x30')][_0x03a4('0x36')](_0x03a4('0x37'))){_0x53d109[_0x03a4('0x1e')]=qs[_0x03a4('0x1e')](_0x2dd9e7[_0x03a4('0x30')][_0x03a4('0x1e')]);_0x53d109[_0x03a4('0x1d')]=qs[_0x03a4('0x1d')](_0x2dd9e7['query'][_0x03a4('0x1d')]);}_0x53d109['order']=qs[_0x03a4('0x38')](_0x2dd9e7['query'][_0x03a4('0x38')]);_0x53d109['where']=qs[_0x03a4('0x31')](_['pick'](_0x2dd9e7[_0x03a4('0x30')],_0x5e22a1[_0x03a4('0x31')]));if(_0x2dd9e7[_0x03a4('0x30')]['filter']){_0x53d109[_0x03a4('0x39')]=_[_0x03a4('0x3a')](_0x53d109[_0x03a4('0x39')],{'$or':_['map'](_0x448598,function(_0x50bfa2){if(_0x50bfa2[_0x03a4('0x3b')]!==_0x03a4('0x3c')){var _0x5798c2={};_0x5798c2[_0x50bfa2[_0x03a4('0x28')]]={'$like':'%'+_0x2dd9e7[_0x03a4('0x30')][_0x03a4('0x3d')]+'%'};return _0x5798c2;}})});}_0x53d109=_[_0x03a4('0x3a')]({},_0x53d109,_0x2dd9e7[_0x03a4('0x3e')]);var _0x4098f1={'where':_0x53d109[_0x03a4('0x39')]};return db[_0x03a4('0x2b')][_0x03a4('0x1c')](_0x4098f1)['then'](function(_0xdc5b4c){_0x1318cf[_0x03a4('0x1c')]=_0xdc5b4c;if(_0x2dd9e7[_0x03a4('0x30')][_0x03a4('0x3f')]){_0x53d109[_0x03a4('0x40')]=[{'all':!![]}];}return db[_0x03a4('0x2b')][_0x03a4('0x41')](_0x53d109);})[_0x03a4('0x42')](function(_0x800ea0){_0x1318cf[_0x03a4('0x43')]=_0x800ea0;return _0x1318cf;})[_0x03a4('0x42')](respondWithFilteredResult(_0x145aa6,_0x53d109))[_0x03a4('0x44')](handleError(_0x145aa6,null));};exports[_0x03a4('0x45')]=function(_0x23d3ae,_0x5034b9){var _0x15b1c3={'raw':![],'where':{'id':_0x23d3ae[_0x03a4('0x46')]['id']}},_0x501871={};_0x501871[_0x03a4('0x2f')]=_['keys'](db[_0x03a4('0x2b')][_0x03a4('0x2c')]);_0x501871[_0x03a4('0x30')]=_['keys'](_0x23d3ae['query']);_0x501871[_0x03a4('0x31')]=_[_0x03a4('0x32')](_0x501871['model'],_0x501871[_0x03a4('0x30')]);_0x15b1c3[_0x03a4('0x34')]=_[_0x03a4('0x32')](_0x501871[_0x03a4('0x2f')],qs[_0x03a4('0x33')](_0x23d3ae[_0x03a4('0x30')][_0x03a4('0x33')]));_0x15b1c3['attributes']=_0x15b1c3[_0x03a4('0x34')]['length']?_0x15b1c3[_0x03a4('0x34')]:_0x501871['model'];if(_0x23d3ae[_0x03a4('0x30')]['includeAll']){_0x15b1c3['include']=[{'all':!![]}];}_0x15b1c3=_[_0x03a4('0x3a')]({},_0x15b1c3,_0x23d3ae['options']);return db['UserProfileSection'][_0x03a4('0x47')](_0x15b1c3)[_0x03a4('0x42')](handleEntityNotFound(_0x5034b9,null))[_0x03a4('0x42')](respondWithResult(_0x5034b9,null))[_0x03a4('0x44')](handleError(_0x5034b9,null));};exports[_0x03a4('0x48')]=function(_0x35db5e,_0x303b4f){return db[_0x03a4('0x2b')]['create'](_0x35db5e[_0x03a4('0x49')],{})[_0x03a4('0x42')](respondWithResult(_0x303b4f,0xc9))['catch'](handleError(_0x303b4f,null));};exports[_0x03a4('0x23')]=function(_0x36b66d,_0x150930){if(_0x36b66d[_0x03a4('0x49')]['id']){delete _0x36b66d[_0x03a4('0x49')]['id'];}return db[_0x03a4('0x2b')][_0x03a4('0x47')]({'where':{'id':_0x36b66d['params']['id']}})[_0x03a4('0x42')](handleEntityNotFound(_0x150930,null))[_0x03a4('0x42')](saveUpdates(_0x36b66d['body'],null))[_0x03a4('0x42')](respondWithResult(_0x150930,null))['catch'](handleError(_0x150930,null));};exports['destroy']=function(_0x37283d,_0x2d120e){return db['UserProfileSection'][_0x03a4('0x47')]({'where':{'id':_0x37283d[_0x03a4('0x46')]['id']}})[_0x03a4('0x42')](handleEntityNotFound(_0x2d120e,null))[_0x03a4('0x42')](removeEntity(_0x2d120e,null))[_0x03a4('0x44')](handleError(_0x2d120e,null));};exports[_0x03a4('0x4a')]=function(_0x38cb8d,_0x5f43bd){return db['UserProfileSection'][_0x03a4('0x4a')]()[_0x03a4('0x42')](respondWithResult(_0x5f43bd,null))[_0x03a4('0x44')](handleError(_0x5f43bd,null));}; \ No newline at end of file +var _0xc674=['Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','UserProfileSection','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','findAll','rows','params','rawAttributes','include','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','limit','set'];(function(_0x1ac3f9,_0x5f2f2f){var _0x28a739=function(_0x2ff3d0){while(--_0x2ff3d0){_0x1ac3f9['push'](_0x1ac3f9['shift']());}};_0x28a739(++_0x5f2f2f);}(_0xc674,0xc6));var _0x4c67=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0xc674[_0x556927];return _0x5f1235;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4c67('0x0'));var zipdir=require(_0x4c67('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c67('0x2'));var moment=require(_0x4c67('0x3'));var BPromise=require(_0x4c67('0x4'));var Mustache=require(_0x4c67('0x5'));var util=require(_0x4c67('0x6'));var path=require(_0x4c67('0x7'));var sox=require(_0x4c67('0x8'));var csv=require('to-csv');var ejs=require(_0x4c67('0x9'));var fs=require('fs');var _=require(_0x4c67('0xa'));var squel=require(_0x4c67('0xb'));var crypto=require('crypto');var jsforce=require(_0x4c67('0xc'));var deskjs=require(_0x4c67('0xd'));var toCsv=require(_0x4c67('0xe'));var querystring=require(_0x4c67('0xf'));var Papa=require(_0x4c67('0x10'));var Redis=require(_0x4c67('0x11'));var authService=require(_0x4c67('0x12'));var qs=require(_0x4c67('0x13'));var as=require(_0x4c67('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c67('0x15'))(_0x4c67('0x16'));var utils=require(_0x4c67('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3042b8,_0x4ffccf){_0x4ffccf=_0x4ffccf||0xcc;return function(_0x496c30){if(_0x496c30){return _0x3042b8[_0x4c67('0x18')](_0x4ffccf);}return _0x3042b8[_0x4c67('0x19')](_0x4ffccf)['end']();};}function respondWithResult(_0x4cd3f6,_0x4290b9){_0x4290b9=_0x4290b9||0xc8;return function(_0x1675e7){if(_0x1675e7){return _0x4cd3f6[_0x4c67('0x19')](_0x4290b9)[_0x4c67('0x1a')](_0x1675e7);}};}function respondWithFilteredResult(_0xb09801,_0x18fe14){return function(_0x38fc59){if(_0x38fc59){var _0x2fc6d2=_0x38fc59['count'],_0x3d4edd=_0x18fe14[_0x4c67('0x1b')],_0x24857d=_0x18fe14['offset']+_0x18fe14[_0x4c67('0x1c')],_0x120141;if(_0x24857d>=_0x2fc6d2){_0x24857d=_0x2fc6d2;_0x120141=0xc8;}else{_0x120141=0xce;}_0xb09801[_0x4c67('0x19')](_0x120141);return _0xb09801[_0x4c67('0x1d')](_0x4c67('0x1e'),_0x3d4edd+'-'+_0x24857d+'/'+_0x2fc6d2)[_0x4c67('0x1a')](_0x38fc59);}return null;};}function patchUpdates(_0x3df371){return function(_0x1b77eb){try{jsonpatch['apply'](_0x1b77eb,_0x3df371,!![]);}catch(_0x4cad92){return BPromise[_0x4c67('0x1f')](_0x4cad92);}return _0x1b77eb['save']();};}function saveUpdates(_0x3fb180,_0x393634){return function(_0x448127){if(_0x448127){return _0x448127[_0x4c67('0x20')](_0x3fb180)[_0x4c67('0x21')](function(_0x87b65d){return _0x87b65d;});}return null;};}function removeEntity(_0x9f735c,_0x29a123){return function(_0x385aea){if(_0x385aea){return _0x385aea[_0x4c67('0x22')]()[_0x4c67('0x21')](function(){_0x9f735c[_0x4c67('0x19')](0xcc)[_0x4c67('0x23')]();});}};}function handleEntityNotFound(_0x1bd434,_0x81dfbe){return function(_0x205109){if(!_0x205109){_0x1bd434[_0x4c67('0x18')](0x194);}return _0x205109;};}function handleError(_0x526ebf,_0x4f51f2){_0x4f51f2=_0x4f51f2||0x1f4;return function(_0x11153d){logger[_0x4c67('0x24')](_0x11153d[_0x4c67('0x25')]);if(_0x11153d[_0x4c67('0x26')]){delete _0x11153d[_0x4c67('0x26')];}_0x526ebf['status'](_0x4f51f2)[_0x4c67('0x27')](_0x11153d);};}exports[_0x4c67('0x28')]=function(_0x208618,_0x7f6948){var _0x3e9a71={},_0x55c92a={},_0x13e586={'count':0x0,'rows':[]};var _0x2fbc5e=_['map'](db[_0x4c67('0x29')]['rawAttributes'],function(_0x17fbac){return{'name':_0x17fbac[_0x4c67('0x2a')],'type':_0x17fbac[_0x4c67('0x2b')][_0x4c67('0x2c')]};});_0x55c92a[_0x4c67('0x2d')]=_[_0x4c67('0x2e')](_0x2fbc5e,_0x4c67('0x26'));_0x55c92a['query']=_[_0x4c67('0x2f')](_0x208618[_0x4c67('0x30')]);_0x55c92a[_0x4c67('0x31')]=_['intersection'](_0x55c92a['model'],_0x55c92a[_0x4c67('0x30')]);_0x3e9a71[_0x4c67('0x32')]=_[_0x4c67('0x33')](_0x55c92a[_0x4c67('0x2d')],qs[_0x4c67('0x34')](_0x208618[_0x4c67('0x30')][_0x4c67('0x34')]));_0x3e9a71[_0x4c67('0x32')]=_0x3e9a71[_0x4c67('0x32')][_0x4c67('0x35')]?_0x3e9a71[_0x4c67('0x32')]:_0x55c92a[_0x4c67('0x2d')];if(!_0x208618[_0x4c67('0x30')][_0x4c67('0x36')](_0x4c67('0x37'))){_0x3e9a71[_0x4c67('0x1c')]=qs[_0x4c67('0x1c')](_0x208618['query'][_0x4c67('0x1c')]);_0x3e9a71[_0x4c67('0x1b')]=qs[_0x4c67('0x1b')](_0x208618[_0x4c67('0x30')][_0x4c67('0x1b')]);}_0x3e9a71[_0x4c67('0x38')]=qs[_0x4c67('0x39')](_0x208618[_0x4c67('0x30')][_0x4c67('0x39')]);_0x3e9a71[_0x4c67('0x3a')]=qs[_0x4c67('0x31')](_[_0x4c67('0x3b')](_0x208618[_0x4c67('0x30')],_0x55c92a[_0x4c67('0x31')]));if(_0x208618['query'][_0x4c67('0x3c')]){_0x3e9a71[_0x4c67('0x3a')]=_['merge'](_0x3e9a71[_0x4c67('0x3a')],{'$or':_[_0x4c67('0x2e')](_0x2fbc5e,function(_0x3cf97c){if(_0x3cf97c[_0x4c67('0x2b')]!==_0x4c67('0x3d')){var _0x91928f={};_0x91928f[_0x3cf97c[_0x4c67('0x26')]]={'$like':'%'+_0x208618[_0x4c67('0x30')][_0x4c67('0x3c')]+'%'};return _0x91928f;}})});}_0x3e9a71=_[_0x4c67('0x3e')]({},_0x3e9a71,_0x208618[_0x4c67('0x3f')]);var _0x44f6b2={'where':_0x3e9a71[_0x4c67('0x3a')]};return db[_0x4c67('0x29')][_0x4c67('0x40')](_0x44f6b2)[_0x4c67('0x21')](function(_0x3c3e3e){_0x13e586[_0x4c67('0x40')]=_0x3c3e3e;if(_0x208618[_0x4c67('0x30')][_0x4c67('0x41')]){_0x3e9a71['include']=[{'all':!![]}];}return db[_0x4c67('0x29')][_0x4c67('0x42')](_0x3e9a71);})['then'](function(_0x1abfd8){_0x13e586[_0x4c67('0x43')]=_0x1abfd8;return _0x13e586;})['then'](respondWithFilteredResult(_0x7f6948,_0x3e9a71))['catch'](handleError(_0x7f6948,null));};exports['show']=function(_0x35b9e1,_0x14a778){var _0x43d57e={'raw':![],'where':{'id':_0x35b9e1[_0x4c67('0x44')]['id']}},_0x1495d2={};_0x1495d2[_0x4c67('0x2d')]=_[_0x4c67('0x2f')](db[_0x4c67('0x29')][_0x4c67('0x45')]);_0x1495d2[_0x4c67('0x30')]=_[_0x4c67('0x2f')](_0x35b9e1[_0x4c67('0x30')]);_0x1495d2['filters']=_[_0x4c67('0x33')](_0x1495d2[_0x4c67('0x2d')],_0x1495d2['query']);_0x43d57e['attributes']=_[_0x4c67('0x33')](_0x1495d2[_0x4c67('0x2d')],qs[_0x4c67('0x34')](_0x35b9e1['query']['fields']));_0x43d57e[_0x4c67('0x32')]=_0x43d57e[_0x4c67('0x32')]['length']?_0x43d57e[_0x4c67('0x32')]:_0x1495d2['model'];if(_0x35b9e1[_0x4c67('0x30')][_0x4c67('0x41')]){_0x43d57e[_0x4c67('0x46')]=[{'all':!![]}];}_0x43d57e=_['merge']({},_0x43d57e,_0x35b9e1[_0x4c67('0x3f')]);return db['UserProfileSection'][_0x4c67('0x47')](_0x43d57e)[_0x4c67('0x21')](handleEntityNotFound(_0x14a778,null))['then'](respondWithResult(_0x14a778,null))[_0x4c67('0x48')](handleError(_0x14a778,null));};exports[_0x4c67('0x49')]=function(_0x11fd5f,_0x11727b){return db['UserProfileSection'][_0x4c67('0x49')](_0x11fd5f[_0x4c67('0x4a')],{})['then'](respondWithResult(_0x11727b,0xc9))[_0x4c67('0x48')](handleError(_0x11727b,null));};exports[_0x4c67('0x20')]=function(_0xc5c17f,_0x1211c3){if(_0xc5c17f[_0x4c67('0x4a')]['id']){delete _0xc5c17f[_0x4c67('0x4a')]['id'];}return db[_0x4c67('0x29')][_0x4c67('0x47')]({'where':{'id':_0xc5c17f[_0x4c67('0x44')]['id']}})['then'](handleEntityNotFound(_0x1211c3,null))[_0x4c67('0x21')](saveUpdates(_0xc5c17f[_0x4c67('0x4a')],null))[_0x4c67('0x21')](respondWithResult(_0x1211c3,null))['catch'](handleError(_0x1211c3,null));};exports[_0x4c67('0x22')]=function(_0x251da7,_0x5bb021){return db[_0x4c67('0x29')][_0x4c67('0x47')]({'where':{'id':_0x251da7[_0x4c67('0x44')]['id']}})['then'](handleEntityNotFound(_0x5bb021,null))[_0x4c67('0x21')](removeEntity(_0x5bb021,null))[_0x4c67('0x48')](handleError(_0x5bb021,null));};exports['describe']=function(_0x4db185,_0x4ff66c){return db['UserProfileSection'][_0x4c67('0x4b')]()['then'](respondWithResult(_0x4ff66c,null))['catch'](handleError(_0x4ff66c,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 05a903d..b1aa2dc 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 _0x4c6b=['UserProfileSection','compositeIndex','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define'];(function(_0x3f993e,_0x2d5757){var _0x39c135=function(_0x39e00b){while(--_0x39e00b){_0x3f993e['push'](_0x3f993e['shift']());}};_0x39c135(++_0x2d5757);}(_0x4c6b,0xe4));var _0xb4c6=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4c6b[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xb4c6('0x0'));var util=require(_0xb4c6('0x1'));var logger=require(_0xb4c6('0x2'))(_0xb4c6('0x3'));var moment=require(_0xb4c6('0x4'));var BPromise=require(_0xb4c6('0x5'));var rp=require(_0xb4c6('0x6'));var fs=require('fs');var path=require(_0xb4c6('0x7'));var rimraf=require(_0xb4c6('0x8'));var config=require('../../config/environment');var attributes=require(_0xb4c6('0x9'));module[_0xb4c6('0xa')]=function(_0x10eb3a,_0x64f89d){return _0x10eb3a[_0xb4c6('0xb')](_0xb4c6('0xc'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xb4c6('0xd'),'fields':['sectionId',_0xb4c6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x101a=['rimraf','exports','UserProfileSection','compositeIndex','sectionId','userProfileId','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1ede6d,_0x382a0e){var _0x569d20=function(_0x3188a9){while(--_0x3188a9){_0x1ede6d['push'](_0x1ede6d['shift']());}};_0x569d20(++_0x382a0e);}(_0x101a,0x11a));var _0xa101=function(_0x4c5b0e,_0x513ecc){_0x4c5b0e=_0x4c5b0e-0x0;var _0x1c8d55=_0x101a[_0x4c5b0e];return _0x1c8d55;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa101('0x0'))(_0xa101('0x1'));var moment=require(_0xa101('0x2'));var BPromise=require(_0xa101('0x3'));var rp=require(_0xa101('0x4'));var fs=require('fs');var path=require(_0xa101('0x5'));var rimraf=require(_0xa101('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0xa101('0x7')]=function(_0x298894,_0x3e791c){return _0x298894['define'](_0xa101('0x8'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xa101('0x9'),'fields':[_0xa101('0xa'),_0xa101('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index c427812..cc4e1ff 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 _0x1a9d=['info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x28bcb6,_0x42077a){var _0x3ca4c8=function(_0x452baf){while(--_0x452baf){_0x28bcb6['push'](_0x28bcb6['shift']());}};_0x3ca4c8(++_0x42077a);}(_0x1a9d,0x116));var _0xd1a9=function(_0x24548a,_0x367203){_0x24548a=_0x24548a-0x0;var _0x4be4b8=_0x1a9d[_0x24548a];return _0x4be4b8;};'use strict';var _=require(_0xd1a9('0x0'));var util=require('util');var moment=require(_0xd1a9('0x1'));var BPromise=require(_0xd1a9('0x2'));var rs=require(_0xd1a9('0x3'));var fs=require('fs');var Redis=require(_0xd1a9('0x4'));var db=require(_0xd1a9('0x5'))['db'];var utils=require(_0xd1a9('0x6'));var logger=require(_0xd1a9('0x7'))(_0xd1a9('0x8'));var config=require(_0xd1a9('0x9'));var jayson=require(_0xd1a9('0xa'));var client=jayson[_0xd1a9('0xb')][_0xd1a9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xe6e042,_0x5674bc,_0xee5ea1){return new BPromise(function(_0x2a8ed7,_0x4c14f1){return client['request'](_0xe6e042,_0xee5ea1)[_0xd1a9('0xd')](function(_0x50b0eb){logger['info'](_0xd1a9('0xe'),_0x5674bc,_0xd1a9('0xf'));logger[_0xd1a9('0x10')](_0xd1a9('0x11'),_0x5674bc,_0xd1a9('0xf'),JSON['stringify'](_0x50b0eb));if(_0x50b0eb[_0xd1a9('0x12')]){if(_0x50b0eb[_0xd1a9('0x12')][_0xd1a9('0x13')]===0x1f4){logger[_0xd1a9('0x12')](_0xd1a9('0xe'),_0x5674bc,_0x50b0eb[_0xd1a9('0x12')][_0xd1a9('0x14')]);return _0x4c14f1(_0x50b0eb['error'][_0xd1a9('0x14')]);}logger['error'](_0xd1a9('0xe'),_0x5674bc,_0x50b0eb[_0xd1a9('0x12')]['message']);return _0x2a8ed7(_0x50b0eb[_0xd1a9('0x12')][_0xd1a9('0x14')]);}else{logger[_0xd1a9('0x15')](_0xd1a9('0xe'),_0x5674bc,_0xd1a9('0xf'));_0x2a8ed7(_0x50b0eb['result'][_0xd1a9('0x14')]);}})[_0xd1a9('0x16')](function(_0x3bf730){logger[_0xd1a9('0x12')](_0xd1a9('0xe'),_0x5674bc,_0x3bf730);_0x4c14f1(_0x3bf730);});});} \ No newline at end of file +var _0x82d8=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','util','moment'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x82d8,0x16e));var _0x882d=function(_0x255554,_0x1183fc){_0x255554=_0x255554-0x0;var _0x13165a=_0x82d8[_0x255554];return _0x13165a;};'use strict';var _=require('lodash');var util=require(_0x882d('0x0'));var moment=require(_0x882d('0x1'));var BPromise=require(_0x882d('0x2'));var rs=require(_0x882d('0x3'));var fs=require('fs');var Redis=require(_0x882d('0x4'));var db=require(_0x882d('0x5'))['db'];var utils=require(_0x882d('0x6'));var logger=require('../../config/logger')(_0x882d('0x7'));var config=require(_0x882d('0x8'));var jayson=require(_0x882d('0x9'));var client=jayson[_0x882d('0xa')][_0x882d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3de68e,_0x2a7df8,_0x1f62a9){return new BPromise(function(_0x144208,_0x230613){return client[_0x882d('0xc')](_0x3de68e,_0x1f62a9)[_0x882d('0xd')](function(_0x19ee22){logger[_0x882d('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x2a7df8,_0x882d('0xf'));logger[_0x882d('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2a7df8,_0x882d('0xf'),JSON['stringify'](_0x19ee22));if(_0x19ee22['error']){if(_0x19ee22[_0x882d('0x11')][_0x882d('0x12')]===0x1f4){logger[_0x882d('0x11')](_0x882d('0x13'),_0x2a7df8,_0x19ee22['error'][_0x882d('0x14')]);return _0x230613(_0x19ee22['error'][_0x882d('0x14')]);}logger[_0x882d('0x11')](_0x882d('0x13'),_0x2a7df8,_0x19ee22['error'][_0x882d('0x14')]);return _0x144208(_0x19ee22['error'][_0x882d('0x14')]);}else{logger['info'](_0x882d('0x13'),_0x2a7df8,'request\x20sent');_0x144208(_0x19ee22[_0x882d('0x15')]['message']);}})[_0x882d('0x16')](function(_0xa91595){logger[_0x882d('0x11')](_0x882d('0x13'),_0x2a7df8,_0xa91595);_0x230613(_0xa91595);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 581c4f5..f6b7854 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 _0x84bb=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x1dd1fa,_0x13bf59){var _0x4d785e=function(_0x4434cc){while(--_0x4434cc){_0x1dd1fa['push'](_0x1dd1fa['shift']());}};_0x4d785e(++_0x13bf59);}(_0x84bb,0x9b));var _0xb84b=function(_0x38dbd6,_0x15a82d){_0x38dbd6=_0x38dbd6-0x0;var _0x2e9afd=_0x84bb[_0x38dbd6];return _0x2e9afd;};'use strict';var multer=require(_0xb84b('0x0'));var util=require(_0xb84b('0x1'));var path=require(_0xb84b('0x2'));var timeout=require(_0xb84b('0x3'));var express=require(_0xb84b('0x4'));var router=express[_0xb84b('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb84b('0x6'));var config=require(_0xb84b('0x7'));module[_0xb84b('0x8')]=router; \ No newline at end of file +var _0x1e46=['connect-timeout','Router','../../components/interaction/service','../../config/environment','exports','util','path'];(function(_0x519a04,_0x38408e){var _0x210a84=function(_0x2158f3){while(--_0x2158f3){_0x519a04['push'](_0x519a04['shift']());}};_0x210a84(++_0x38408e);}(_0x1e46,0x75));var _0x61e4=function(_0x211f9a,_0x67a371){_0x211f9a=_0x211f9a-0x0;var _0x4e2fb8=_0x1e46[_0x211f9a];return _0x4e2fb8;};'use strict';var multer=require('multer');var util=require(_0x61e4('0x0'));var path=require(_0x61e4('0x1'));var timeout=require(_0x61e4('0x2'));var express=require('express');var router=express[_0x61e4('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x61e4('0x4'));var config=require(_0x61e4('0x5'));module[_0x61e4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 40ef6cd..de55800 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x263d32,_0x1d6c1c){var _0x324dca=function(_0x57493a){while(--_0x57493a){_0x263d32['push'](_0x263d32['shift']());}};_0x324dca(++_0x1d6c1c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x1af746,_0x23d173){var _0x13c883=function(_0x2246fb){while(--_0x2246fb){_0x1af746['push'](_0x1af746['shift']());}};_0x13c883(++_0x23d173);}(_0xe706,0xa3));var _0x6e70=function(_0x508abe,_0x37d20c){_0x508abe=_0x508abe-0x0;var _0x23d357=_0xe706[_0x508abe];return _0x23d357;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 0900be7..93974b8 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 _0xdf2d=['../../config/environment','./userSmsQueue.attributes','UserSmsQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x40d643,_0x3c07ed){var _0x1caa2b=function(_0x33b422){while(--_0x33b422){_0x40d643['push'](_0x40d643['shift']());}};_0x1caa2b(++_0x3c07ed);}(_0xdf2d,0x12f));var _0xddf2=function(_0x52424e,_0xe7a075){_0x52424e=_0x52424e-0x0;var _0x3a34e2=_0xdf2d[_0x52424e];return _0x3a34e2;};'use strict';var _=require(_0xddf2('0x0'));var util=require(_0xddf2('0x1'));var logger=require(_0xddf2('0x2'))(_0xddf2('0x3'));var moment=require(_0xddf2('0x4'));var BPromise=require(_0xddf2('0x5'));var rp=require(_0xddf2('0x6'));var fs=require('fs');var path=require(_0xddf2('0x7'));var rimraf=require(_0xddf2('0x8'));var config=require(_0xddf2('0x9'));var attributes=require(_0xddf2('0xa'));module['exports']=function(_0x7ca09f,_0x283fa7){return _0x7ca09f['define'](_0xddf2('0xb'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca68=['lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca68,0x1b8));var _0x8ca6=function(_0x43a5ac,_0x4b70ec){_0x43a5ac=_0x43a5ac-0x0;var _0x3707b6=_0xca68[_0x43a5ac];return _0x3707b6;};'use strict';var _=require(_0x8ca6('0x0'));var util=require('util');var logger=require(_0x8ca6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8ca6('0x2'));var rp=require(_0x8ca6('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ca6('0x4'));var config=require(_0x8ca6('0x5'));var attributes=require(_0x8ca6('0x6'));module['exports']=function(_0x188111,_0x4949d1){return _0x188111[_0x8ca6('0x7')](_0x8ca6('0x8'),attributes,{'tableName':_0x8ca6('0x9'),'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 1ee96bb..12cc9de 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 _0x9530=['message','info','result','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','code','UserSmsQueue,\x20%s,\x20%s','error'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x9530,0x13f));var _0x0953=function(_0x5f28ac,_0x114397){_0x5f28ac=_0x5f28ac-0x0;var _0x3ddbb9=_0x9530[_0x5f28ac];return _0x3ddbb9;};'use strict';var _=require(_0x0953('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0953('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0953('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0953('0x3'));var logger=require(_0x0953('0x4'))(_0x0953('0x5'));var config=require('../../config/environment');var jayson=require(_0x0953('0x6'));var client=jayson[_0x0953('0x7')][_0x0953('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x26ff60,_0x42072f,_0x1c0717){return new BPromise(function(_0x56a23f,_0x535cb9){return client[_0x0953('0x9')](_0x26ff60,_0x1c0717)[_0x0953('0xa')](function(_0x3f84eb){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x42072f,_0x0953('0xb'));logger['debug'](_0x0953('0xc'),_0x42072f,_0x0953('0xb'),JSON[_0x0953('0xd')](_0x3f84eb));if(_0x3f84eb['error']){if(_0x3f84eb['error'][_0x0953('0xe')]===0x1f4){logger['error'](_0x0953('0xf'),_0x42072f,_0x3f84eb[_0x0953('0x10')][_0x0953('0x11')]);return _0x535cb9(_0x3f84eb[_0x0953('0x10')][_0x0953('0x11')]);}logger[_0x0953('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x42072f,_0x3f84eb[_0x0953('0x10')][_0x0953('0x11')]);return _0x56a23f(_0x3f84eb[_0x0953('0x10')][_0x0953('0x11')]);}else{logger[_0x0953('0x12')](_0x0953('0xf'),_0x42072f,_0x0953('0xb'));_0x56a23f(_0x3f84eb[_0x0953('0x13')][_0x0953('0x11')]);}})[_0x0953('0x14')](function(_0x407aae){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x42072f,_0x407aae);_0x535cb9(_0x407aae);});});} \ No newline at end of file +var _0x5c9c=['error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s'];(function(_0x429a0f,_0x19b709){var _0x3b4d45=function(_0x5ef991){while(--_0x5ef991){_0x429a0f['push'](_0x429a0f['shift']());}};_0x3b4d45(++_0x19b709);}(_0x5c9c,0xf6));var _0xc5c9=function(_0x427410,_0x56756d){_0x427410=_0x427410-0x0;var _0x411b9b=_0x5c9c[_0x427410];return _0x411b9b;};'use strict';var _=require(_0xc5c9('0x0'));var util=require(_0xc5c9('0x1'));var moment=require(_0xc5c9('0x2'));var BPromise=require(_0xc5c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5c9('0x4'))['db'];var utils=require(_0xc5c9('0x5'));var logger=require('../../config/logger')(_0xc5c9('0x6'));var config=require(_0xc5c9('0x7'));var jayson=require(_0xc5c9('0x8'));var client=jayson[_0xc5c9('0x9')][_0xc5c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x205b10,_0xa0d357,_0x9c0352){return new BPromise(function(_0x3ad5bf,_0x113e94){return client[_0xc5c9('0xb')](_0x205b10,_0x9c0352)[_0xc5c9('0xc')](function(_0xbdfdb2){logger[_0xc5c9('0xd')](_0xc5c9('0xe'),_0xa0d357,_0xc5c9('0xf'));logger[_0xc5c9('0x10')](_0xc5c9('0x11'),_0xa0d357,_0xc5c9('0xf'),JSON['stringify'](_0xbdfdb2));if(_0xbdfdb2[_0xc5c9('0x12')]){if(_0xbdfdb2['error']['code']===0x1f4){logger[_0xc5c9('0x12')](_0xc5c9('0xe'),_0xa0d357,_0xbdfdb2['error'][_0xc5c9('0x13')]);return _0x113e94(_0xbdfdb2[_0xc5c9('0x12')][_0xc5c9('0x13')]);}logger['error'](_0xc5c9('0xe'),_0xa0d357,_0xbdfdb2['error'][_0xc5c9('0x13')]);return _0x3ad5bf(_0xbdfdb2[_0xc5c9('0x12')][_0xc5c9('0x13')]);}else{logger[_0xc5c9('0xd')](_0xc5c9('0xe'),_0xa0d357,_0xc5c9('0xf'));_0x3ad5bf(_0xbdfdb2[_0xc5c9('0x14')]['message']);}})[_0xc5c9('0x15')](function(_0xdaad28){logger[_0xc5c9('0x12')](_0xc5c9('0xe'),_0xa0d357,_0xdaad28);_0x113e94(_0xdaad28);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 07f700f..6dd8e35 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 _0xc65f=['express','path'];(function(_0x375ce7,_0x24243e){var _0x11df30=function(_0x2713f0){while(--_0x2713f0){_0x375ce7['push'](_0x375ce7['shift']());}};_0x11df30(++_0x24243e);}(_0xc65f,0x14d));var _0xfc65=function(_0x518cfe,_0x2a9bb8){_0x518cfe=_0x518cfe-0x0;var _0x42af3a=_0xc65f[_0x518cfe];return _0x42af3a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfc65('0x0'));var timeout=require('connect-timeout');var express=require(_0xfc65('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x4293=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','express'];(function(_0x5a2927,_0x58e4f0){var _0x5be216=function(_0x243228){while(--_0x243228){_0x5a2927['push'](_0x5a2927['shift']());}};_0x5be216(++_0x58e4f0);}(_0x4293,0x140));var _0x3429=function(_0x4f39ca,_0x59101c){_0x4f39ca=_0x4f39ca-0x0;var _0x5475ab=_0x4293[_0x4f39ca];return _0x5475ab;};'use strict';var multer=require(_0x3429('0x0'));var util=require(_0x3429('0x1'));var path=require(_0x3429('0x2'));var timeout=require('connect-timeout');var express=require(_0x3429('0x3'));var router=express[_0x3429('0x4')]();var auth=require(_0x3429('0x5'));var interaction=require(_0x3429('0x6'));var config=require(_0x3429('0x7'));module[_0x3429('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index b7401bd..f0001b0 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 _0xb10b=['sequelize','INTEGER'];(function(_0x319a96,_0x2a5c2c){var _0x4dd386=function(_0x4876fc){while(--_0x4876fc){_0x319a96['push'](_0x319a96['shift']());}};_0x4dd386(++_0x2a5c2c);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0xb10b[_0x5a60ce];return _0x393e5e;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x507c81,_0x3e1b56){var _0x368a25=function(_0x1e7519){while(--_0x1e7519){_0x507c81['push'](_0x507c81['shift']());}};_0x368a25(++_0x3e1b56);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index abeaa4d..2cd943b 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 _0xc874=['../../config/logger','api','request-promise','path','rimraf','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0x41bb98,_0x29a606){var _0x3fb34e=function(_0x4d6b12){while(--_0x4d6b12){_0x41bb98['push'](_0x41bb98['shift']());}};_0x3fb34e(++_0x29a606);}(_0xc874,0x154));var _0x4c87=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0xc874[_0x5c2e5e];return _0x46a5da;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var logger=require(_0x4c87('0x1'))(_0x4c87('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4c87('0x3'));var fs=require('fs');var path=require(_0x4c87('0x4'));var rimraf=require(_0x4c87('0x5'));var config=require('../../config/environment');var attributes=require(_0x4c87('0x6'));module[_0x4c87('0x7')]=function(_0x5d63ae,_0x46e0f5){return _0x5d63ae[_0x4c87('0x8')](_0x4c87('0x9'),attributes,{'tableName':_0x4c87('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb821=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','bluebird'];(function(_0x12af5b,_0x5b29d0){var _0x19eaf1=function(_0x285c88){while(--_0x285c88){_0x12af5b['push'](_0x12af5b['shift']());}};_0x19eaf1(++_0x5b29d0);}(_0xb821,0xa7));var _0x1b82=function(_0x401167,_0x388bfa){_0x401167=_0x401167-0x0;var _0x2a8dd6=_0xb821[_0x401167];return _0x2a8dd6;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'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 5a855ba..5e05614 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 _0x53a8=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x21c504,_0x3e00c6){var _0x51b5c3=function(_0x5b3f42){while(--_0x5b3f42){_0x21c504['push'](_0x21c504['shift']());}};_0x51b5c3(++_0x3e00c6);}(_0x53a8,0x11c));var _0x853a=function(_0x40df4e,_0x40fe83){_0x40df4e=_0x40df4e-0x0;var _0x550e25=_0x53a8[_0x40df4e];return _0x550e25;};'use strict';var _=require(_0x853a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x853a('0x1'));var rs=require(_0x853a('0x2'));var fs=require('fs');var Redis=require(_0x853a('0x3'));var db=require(_0x853a('0x4'))['db'];var utils=require(_0x853a('0x5'));var logger=require(_0x853a('0x6'))(_0x853a('0x7'));var config=require(_0x853a('0x8'));var jayson=require(_0x853a('0x9'));var client=jayson[_0x853a('0xa')][_0x853a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f6100,_0x54a9cb,_0x57cbb3){return new BPromise(function(_0x543b38,_0x2ca88b){return client[_0x853a('0xc')](_0x4f6100,_0x57cbb3)[_0x853a('0xd')](function(_0x54e650){logger['info'](_0x853a('0xe'),_0x54a9cb,_0x853a('0xf'));logger[_0x853a('0x10')](_0x853a('0x11'),_0x54a9cb,_0x853a('0xf'),JSON[_0x853a('0x12')](_0x54e650));if(_0x54e650[_0x853a('0x13')]){if(_0x54e650[_0x853a('0x13')]['code']===0x1f4){logger[_0x853a('0x13')](_0x853a('0xe'),_0x54a9cb,_0x54e650['error']['message']);return _0x2ca88b(_0x54e650['error']['message']);}logger['error'](_0x853a('0xe'),_0x54a9cb,_0x54e650[_0x853a('0x13')][_0x853a('0x14')]);return _0x543b38(_0x54e650[_0x853a('0x13')][_0x853a('0x14')]);}else{logger[_0x853a('0x15')]('UserVoiceQueue,\x20%s,\x20%s',_0x54a9cb,_0x853a('0xf'));_0x543b38(_0x54e650[_0x853a('0x16')][_0x853a('0x14')]);}})[_0x853a('0x17')](function(_0x48a265){logger[_0x853a('0x13')]('UserVoiceQueue,\x20%s,\x20%s',_0x54a9cb,_0x48a265);_0x2ca88b(_0x48a265);});});} \ No newline at end of file +var _0xb3c2=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueue,\x20%s,\x20%s','result','catch'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xb3c2,0x78));var _0x2b3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3c2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2b3c('0x0'));var util=require('util');var moment=require(_0x2b3c('0x1'));var BPromise=require(_0x2b3c('0x2'));var rs=require(_0x2b3c('0x3'));var fs=require('fs');var Redis=require(_0x2b3c('0x4'));var db=require(_0x2b3c('0x5'))['db'];var utils=require(_0x2b3c('0x6'));var logger=require(_0x2b3c('0x7'))(_0x2b3c('0x8'));var config=require('../../config/environment');var jayson=require(_0x2b3c('0x9'));var client=jayson[_0x2b3c('0xa')][_0x2b3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cfe89,_0x40be27,_0x4e71cd){return new BPromise(function(_0x2e7d7f,_0x5568cd){return client['request'](_0x4cfe89,_0x4e71cd)[_0x2b3c('0xc')](function(_0x340f03){logger[_0x2b3c('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x40be27,_0x2b3c('0xe'));logger[_0x2b3c('0xf')](_0x2b3c('0x10'),_0x40be27,_0x2b3c('0xe'),JSON[_0x2b3c('0x11')](_0x340f03));if(_0x340f03['error']){if(_0x340f03[_0x2b3c('0x12')][_0x2b3c('0x13')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x40be27,_0x340f03[_0x2b3c('0x12')][_0x2b3c('0x14')]);return _0x5568cd(_0x340f03[_0x2b3c('0x12')][_0x2b3c('0x14')]);}logger[_0x2b3c('0x12')](_0x2b3c('0x15'),_0x40be27,_0x340f03[_0x2b3c('0x12')][_0x2b3c('0x14')]);return _0x2e7d7f(_0x340f03[_0x2b3c('0x12')]['message']);}else{logger['info'](_0x2b3c('0x15'),_0x40be27,_0x2b3c('0xe'));_0x2e7d7f(_0x340f03[_0x2b3c('0x16')][_0x2b3c('0x14')]);}})[_0x2b3c('0x17')](function(_0x2a3308){logger['error'](_0x2b3c('0x15'),_0x40be27,_0x2a3308);_0x5568cd(_0x2a3308);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 4a5df75..8ee6b10 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 _0x088f=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3e8e88,_0x2b1002){var _0x17141c=function(_0x5d04c8){while(--_0x5d04c8){_0x3e8e88['push'](_0x3e8e88['shift']());}};_0x17141c(++_0x2b1002);}(_0x088f,0x149));var _0xf088=function(_0x2ac6cd,_0x2c4761){_0x2ac6cd=_0x2ac6cd-0x0;var _0x2b7f6c=_0x088f[_0x2ac6cd];return _0x2b7f6c;};'use strict';var multer=require(_0xf088('0x0'));var util=require(_0xf088('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf088('0x2'));var router=express[_0xf088('0x3')]();var auth=require(_0xf088('0x4'));var interaction=require(_0xf088('0x5'));var config=require(_0xf088('0x6'));module[_0xf088('0x7')]=router; \ No newline at end of file +var _0x875c=['../../config/environment','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4046c3,_0x23ec82){var _0x5a4e0b=function(_0x440742){while(--_0x440742){_0x4046c3['push'](_0x4046c3['shift']());}};_0x5a4e0b(++_0x23ec82);}(_0x875c,0x1e4));var _0xc875=function(_0x1866b1,_0x45bb4b){_0x1866b1=_0x1866b1-0x0;var _0x398d33=_0x875c[_0x1866b1];return _0x398d33;};'use strict';var multer=require('multer');var util=require(_0xc875('0x0'));var path=require(_0xc875('0x1'));var timeout=require(_0xc875('0x2'));var express=require(_0xc875('0x3'));var router=express[_0xc875('0x4')]();var auth=require(_0xc875('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc875('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index bc162b2..ab22fd3 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 _0xe0f4=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','exports'];(function(_0x159f91,_0xe8a30f){var _0x26bd65=function(_0x5680d1){while(--_0x5680d1){_0x159f91['push'](_0x159f91['shift']());}};_0x26bd65(++_0xe8a30f);}(_0xe0f4,0xb8));var _0x4e0f=function(_0x1891b4,_0xf0690e){_0x1891b4=_0x1891b4-0x0;var _0x2db6a3=_0xe0f4[_0x1891b4];return _0x2db6a3;};'use strict';var Sequelize=require('sequelize');module[_0x4e0f('0x0')]={'uniqueid':{'type':Sequelize[_0x4e0f('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4e0f('0x2')},'membername':{'type':Sequelize[_0x4e0f('0x3')],'allowNull':![],'comment':_0x4e0f('0x2')},'UserId':{'type':Sequelize[_0x4e0f('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4e0f('0x3')],'allowNull':![],'unique':_0x4e0f('0x4'),'comment':_0x4e0f('0x2')},'VoiceQueueId':{'type':Sequelize[_0x4e0f('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4e0f('0x4'),'comment':_0x4e0f('0x2')},'penalty':{'type':Sequelize[_0x4e0f('0x1')](0xb),'defaultValue':0x0,'comment':_0x4e0f('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0xc615=['STRING','INTEGER','queue_interface','sequelize','Required\x20by\x20Asterisk'];(function(_0x30fdb2,_0x55f880){var _0x8627d3=function(_0x497c87){while(--_0x497c87){_0x30fdb2['push'](_0x30fdb2['shift']());}};_0x8627d3(++_0x55f880);}(_0xc615,0x7b));var _0x5c61=function(_0x56f6c0,_0x37c097){_0x56f6c0=_0x56f6c0-0x0;var _0x249342=_0xc615[_0x56f6c0];return _0x249342;};'use strict';var Sequelize=require(_0x5c61('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x5c61('0x1')},'membername':{'type':Sequelize[_0x5c61('0x2')],'allowNull':![],'comment':_0x5c61('0x1')},'UserId':{'type':Sequelize[_0x5c61('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x5c61('0x2')],'allowNull':![],'unique':_0x5c61('0x4'),'comment':_0x5c61('0x1')},'VoiceQueueId':{'type':Sequelize[_0x5c61('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x5c61('0x2')],'allowNull':![],'unique':_0x5c61('0x4'),'comment':_0x5c61('0x1')},'penalty':{'type':Sequelize[_0x5c61('0x3')](0xb),'defaultValue':0x0,'comment':_0x5c61('0x1')},'paused':{'type':Sequelize[_0x5c61('0x3')](0xb),'defaultValue':0x0,'comment':_0x5c61('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index ec6322f..72c682e 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 _0x3a38=['UserVoiceQueueRt','setMaxListeners','save','remove','emit','hook','events','../../mysqldb'];(function(_0x557028,_0x10e241){var _0x4f7c67=function(_0x1250ae){while(--_0x1250ae){_0x557028['push'](_0x557028['shift']());}};_0x4f7c67(++_0x10e241);}(_0x3a38,0xfe));var _0x83a3=function(_0x24250e,_0x250e09){_0x24250e=_0x24250e-0x0;var _0x4fcc2d=_0x3a38[_0x24250e];return _0x4fcc2d;};'use strict';var EventEmitter=require(_0x83a3('0x0'));var UserVoiceQueueRt=require(_0x83a3('0x1'))['db'][_0x83a3('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x83a3('0x3')](0x0);var events={'afterCreate':_0x83a3('0x4'),'afterUpdate':'update','afterDestroy':_0x83a3('0x5')};function emitEvent(_0x2c6fc8){return function(_0x524d49,_0x259b61,_0x33948d){UserVoiceQueueRtEvents[_0x83a3('0x6')](_0x2c6fc8+':'+_0x524d49['id'],_0x524d49);UserVoiceQueueRtEvents[_0x83a3('0x6')](_0x2c6fc8,_0x524d49);_0x33948d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x83a3('0x7')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x7050=['hook','events','../../mysqldb','setMaxListeners','update','emit'];(function(_0x2b7e28,_0x29310e){var _0x4b1a34=function(_0x44acda){while(--_0x44acda){_0x2b7e28['push'](_0x2b7e28['shift']());}};_0x4b1a34(++_0x29310e);}(_0x7050,0x7f));var _0x0705=function(_0x1e06f1,_0x59d7e1){_0x1e06f1=_0x1e06f1-0x0;var _0x34f77e=_0x7050[_0x1e06f1];return _0x34f77e;};'use strict';var EventEmitter=require(_0x0705('0x0'));var UserVoiceQueueRt=require(_0x0705('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x0705('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0705('0x3'),'afterDestroy':'remove'};function emitEvent(_0x30227b){return function(_0x49dc55,_0x5c14b8,_0x261a45){UserVoiceQueueRtEvents['emit'](_0x30227b+':'+_0x49dc55['id'],_0x49dc55);UserVoiceQueueRtEvents[_0x0705('0x4')](_0x30227b,_0x49dc55);_0x261a45(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x0705('0x5')](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 c878eb8..08f892a 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 _0x05a4=['request-promise','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment'];(function(_0x2b7e9c,_0x236531){var _0x39ac82=function(_0x351563){while(--_0x351563){_0x2b7e9c['push'](_0x2b7e9c['shift']());}};_0x39ac82(++_0x236531);}(_0x05a4,0x1df));var _0x405a=function(_0x3cf3be,_0xea77b5){_0x3cf3be=_0x3cf3be-0x0;var _0x15323b=_0x05a4[_0x3cf3be];return _0x15323b;};'use strict';var _=require(_0x405a('0x0'));var util=require(_0x405a('0x1'));var logger=require(_0x405a('0x2'))(_0x405a('0x3'));var moment=require(_0x405a('0x4'));var BPromise=require('bluebird');var rp=require(_0x405a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x405a('0x6'));module[_0x405a('0x7')]=function(_0x13af05,_0xa2ec77){return _0x13af05[_0x405a('0x8')](_0x405a('0x9'),attributes,{'tableName':_0x405a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c3f=['../../config/environment','./userVoiceQueueRt.attributes','UserVoiceQueueRt','user_has_voice_queues_rt','util','../../config/logger','api','path'];(function(_0x2b5445,_0x1daa9){var _0x466a85=function(_0x223ce9){while(--_0x223ce9){_0x2b5445['push'](_0x2b5445['shift']());}};_0x466a85(++_0x1daa9);}(_0x7c3f,0xec));var _0xf7c3=function(_0x31766c,_0x1cd917){_0x31766c=_0x31766c-0x0;var _0x4a19c5=_0x7c3f[_0x31766c];return _0x4a19c5;};'use strict';var _=require('lodash');var util=require(_0xf7c3('0x0'));var logger=require(_0xf7c3('0x1'))(_0xf7c3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf7c3('0x3'));var rimraf=require('rimraf');var config=require(_0xf7c3('0x4'));var attributes=require(_0xf7c3('0x5'));module['exports']=function(_0x152fd1,_0x14ea92){return _0x152fd1['define'](_0xf7c3('0x6'),attributes,{'tableName':_0xf7c3('0x7'),'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 c864bf0..369139b 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 _0xfc43=['message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2009cd,_0x549a5d){var _0x509e8a=function(_0x3b4e02){while(--_0x3b4e02){_0x2009cd['push'](_0x2009cd['shift']());}};_0x509e8a(++_0x549a5d);}(_0xfc43,0xf5));var _0x3fc4=function(_0x224d30,_0x5172dd){_0x224d30=_0x224d30-0x0;var _0x32a813=_0xfc43[_0x224d30];return _0x32a813;};'use strict';var _=require(_0x3fc4('0x0'));var util=require(_0x3fc4('0x1'));var moment=require(_0x3fc4('0x2'));var BPromise=require(_0x3fc4('0x3'));var rs=require(_0x3fc4('0x4'));var fs=require('fs');var Redis=require(_0x3fc4('0x5'));var db=require(_0x3fc4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3fc4('0x7'))('rpc');var config=require(_0x3fc4('0x8'));var jayson=require(_0x3fc4('0x9'));var client=jayson[_0x3fc4('0xa')][_0x3fc4('0xb')]({'port':0x232a});config[_0x3fc4('0xc')]=_[_0x3fc4('0xd')](config[_0x3fc4('0xc')],{'host':_0x3fc4('0xe'),'port':0x18eb});var socket=require(_0x3fc4('0xf'))(new Redis(config[_0x3fc4('0xc')]));require(_0x3fc4('0x10'))[_0x3fc4('0x11')](socket);function respondWithRpcPromise(_0x418700,_0x24b17f,_0x5323dc){return new BPromise(function(_0x345535,_0x5c75f5){return client[_0x3fc4('0x12')](_0x418700,_0x5323dc)[_0x3fc4('0x13')](function(_0x6f0e7b){logger[_0x3fc4('0x14')](_0x3fc4('0x15'),_0x24b17f,_0x3fc4('0x16'));logger[_0x3fc4('0x17')](_0x3fc4('0x18'),_0x24b17f,'request\x20sent',JSON[_0x3fc4('0x19')](_0x6f0e7b));if(_0x6f0e7b[_0x3fc4('0x1a')]){if(_0x6f0e7b[_0x3fc4('0x1a')][_0x3fc4('0x1b')]===0x1f4){logger[_0x3fc4('0x1a')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x24b17f,_0x6f0e7b[_0x3fc4('0x1a')][_0x3fc4('0x1c')]);return _0x5c75f5(_0x6f0e7b[_0x3fc4('0x1a')][_0x3fc4('0x1c')]);}logger['error'](_0x3fc4('0x15'),_0x24b17f,_0x6f0e7b[_0x3fc4('0x1a')]['message']);return _0x345535(_0x6f0e7b['error'][_0x3fc4('0x1c')]);}else{logger[_0x3fc4('0x14')](_0x3fc4('0x15'),_0x24b17f,_0x3fc4('0x16'));_0x345535(_0x6f0e7b[_0x3fc4('0x1d')]['message']);}})[_0x3fc4('0x1e')](function(_0x4c32f6){logger[_0x3fc4('0x1a')](_0x3fc4('0x15'),_0x24b17f,_0x4c32f6);_0x5c75f5(_0x4c32f6);});});}exports[_0x3fc4('0x1f')]=function(_0x56569a){var _0x422a53=this;return new Promise(function(_0x2b0df4,_0x28d49e){return db[_0x3fc4('0x20')]['findAll']({'raw':_0x56569a[_0x3fc4('0x21')]?_0x56569a['options'][_0x3fc4('0x22')]===undefined?!![]:![]:!![],'where':_0x56569a[_0x3fc4('0x21')]?_0x56569a['options']['where']||null:null,'attributes':[[db[_0x3fc4('0x23')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3fc4('0x23')][_0x3fc4('0x24')](_0x3fc4('0x25')))),_0x3fc4('0x26')]]})[_0x3fc4('0x13')](function(_0x2f85a6){logger[_0x3fc4('0x14')](_0x3fc4('0x1f'),_0x56569a);logger[_0x3fc4('0x17')](_0x3fc4('0x1f'),_0x56569a,JSON['stringify'](_0x2f85a6));_0x2b0df4(_0x2f85a6);})[_0x3fc4('0x1e')](function(_0x1699bd){logger[_0x3fc4('0x1a')](_0x3fc4('0x1f'),_0x1699bd[_0x3fc4('0x1c')],_0x56569a);_0x28d49e(_0x422a53['error'](0x1f4,_0x1699bd['message']));});});}; \ No newline at end of file +var _0xf670=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceQueueRtPauses','options','where','sequelize','COUNT','literal','outboundQueuePauses','debug','stringify','util','moment'];(function(_0x24a84a,_0x20f756){var _0xeddd46=function(_0x12e155){while(--_0x12e155){_0x24a84a['push'](_0x24a84a['shift']());}};_0xeddd46(++_0x20f756);}(_0xf670,0xec));var _0x0f67=function(_0x364471,_0x302e8a){_0x364471=_0x364471-0x0;var _0x59236f=_0xf670[_0x364471];return _0x59236f;};'use strict';var _=require('lodash');var util=require(_0x0f67('0x0'));var moment=require(_0x0f67('0x1'));var BPromise=require(_0x0f67('0x2'));var rs=require(_0x0f67('0x3'));var fs=require('fs');var Redis=require(_0x0f67('0x4'));var db=require(_0x0f67('0x5'))['db'];var utils=require(_0x0f67('0x6'));var logger=require(_0x0f67('0x7'))('rpc');var config=require(_0x0f67('0x8'));var jayson=require(_0x0f67('0x9'));var client=jayson[_0x0f67('0xa')]['http']({'port':0x232a});config[_0x0f67('0xb')]=_[_0x0f67('0xc')](config[_0x0f67('0xb')],{'host':_0x0f67('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0f67('0xb')]));require(_0x0f67('0xe'))[_0x0f67('0xf')](socket);function respondWithRpcPromise(_0x3a5ecb,_0x309f02,_0x215414){return new BPromise(function(_0x297c28,_0x2f9ae8){return client[_0x0f67('0x10')](_0x3a5ecb,_0x215414)['then'](function(_0x324b52){logger[_0x0f67('0x11')](_0x0f67('0x12'),_0x309f02,'request\x20sent');logger['debug'](_0x0f67('0x13'),_0x309f02,'request\x20sent',JSON['stringify'](_0x324b52));if(_0x324b52[_0x0f67('0x14')]){if(_0x324b52[_0x0f67('0x14')][_0x0f67('0x15')]===0x1f4){logger[_0x0f67('0x14')](_0x0f67('0x12'),_0x309f02,_0x324b52[_0x0f67('0x14')][_0x0f67('0x16')]);return _0x2f9ae8(_0x324b52[_0x0f67('0x14')][_0x0f67('0x16')]);}logger[_0x0f67('0x14')](_0x0f67('0x12'),_0x309f02,_0x324b52['error']['message']);return _0x297c28(_0x324b52['error'][_0x0f67('0x16')]);}else{logger['info'](_0x0f67('0x12'),_0x309f02,'request\x20sent');_0x297c28(_0x324b52[_0x0f67('0x17')][_0x0f67('0x16')]);}})[_0x0f67('0x18')](function(_0x17f461){logger[_0x0f67('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x309f02,_0x17f461);_0x2f9ae8(_0x17f461);});});}exports[_0x0f67('0x19')]=function(_0x16d365){var _0x57ff75=this;return new Promise(function(_0x3f18a3,_0x21b86c){return db['UserVoiceQueueRt']['findAll']({'raw':_0x16d365[_0x0f67('0x1a')]?_0x16d365[_0x0f67('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x16d365[_0x0f67('0x1a')]?_0x16d365[_0x0f67('0x1a')][_0x0f67('0x1b')]||null:null,'attributes':[[db[_0x0f67('0x1c')]['fn'](_0x0f67('0x1d'),db[_0x0f67('0x1c')]['fn']('IF',db['sequelize'][_0x0f67('0x1e')]('`paused`\x20=\x201,\x201,\x20null'))),_0x0f67('0x1f')]]})['then'](function(_0x432400){logger['info']('GetVoiceQueueRtPauses',_0x16d365);logger[_0x0f67('0x20')](_0x0f67('0x19'),_0x16d365,JSON[_0x0f67('0x21')](_0x432400));_0x3f18a3(_0x432400);})[_0x0f67('0x18')](function(_0x4d7ea8){logger[_0x0f67('0x14')](_0x0f67('0x19'),_0x4d7ea8[_0x0f67('0x16')],_0x16d365);_0x21b86c(_0x57ff75[_0x0f67('0x14')](0x1f4,_0x4d7ea8['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index a0d53ee..6a5b04a 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 _0x347c=['emit','removeListener','register','save','remove','update'];(function(_0x5773fd,_0x3b21fa){var _0x2c6ea3=function(_0x439fae){while(--_0x439fae){_0x5773fd['push'](_0x5773fd['shift']());}};_0x2c6ea3(++_0x3b21fa);}(_0x347c,0x19b));var _0xc347=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x347c[_0x2064e5];return _0x21a233;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0xc347('0x0'),_0xc347('0x1'),_0xc347('0x2')];function createListener(_0x7c6b6f,_0x1fb99a){return function(_0xa75138){_0x1fb99a[_0xc347('0x3')](_0x7c6b6f,_0xa75138);};}function removeListener(_0x58fd58,_0x1a6ece){return function(){UserVoiceQueueRtEvents[_0xc347('0x4')](_0x58fd58,_0x1a6ece);};}exports[_0xc347('0x5')]=function(_0x30789e){for(var _0x28d94c=0x0,_0x1a30ea=events['length'];_0x28d94c<_0x1a30ea;_0x28d94c++){var _0x54376c=events[_0x28d94c];var _0x581ce2=createListener('userVoiceQueueRt:'+_0x54376c,_0x30789e);UserVoiceQueueRtEvents['on'](_0x54376c,_0x581ce2);}}; \ No newline at end of file +var _0x2a70=['emit','register','length','./userVoiceQueueRt.events','remove','update'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x2a70,0x12f));var _0x02a7=function(_0x436642,_0x59d3b7){_0x436642=_0x436642-0x0;var _0x8be476=_0x2a70[_0x436642];return _0x8be476;};'use strict';var UserVoiceQueueRtEvents=require(_0x02a7('0x0'));var events=['save',_0x02a7('0x1'),_0x02a7('0x2')];function createListener(_0x1f0966,_0x317227){return function(_0x4f6c19){_0x317227[_0x02a7('0x3')](_0x1f0966,_0x4f6c19);};}function removeListener(_0x50b949,_0x45abe1){return function(){UserVoiceQueueRtEvents['removeListener'](_0x50b949,_0x45abe1);};}exports[_0x02a7('0x4')]=function(_0x5bcf39){for(var _0x513257=0x0,_0x45b279=events[_0x02a7('0x5')];_0x513257<_0x45b279;_0x513257++){var _0x283c93=events[_0x513257];var _0x5cbbd4=createListener('userVoiceQueueRt:'+_0x283c93,_0x5bcf39);UserVoiceQueueRtEvents['on'](_0x283c93,_0x5cbbd4);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 58ff175..68cb21d 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 _0xdeb8=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout'];(function(_0x3255ec,_0xcbfc90){var _0x2bc931=function(_0x3882e8){while(--_0x3882e8){_0x3255ec['push'](_0x3255ec['shift']());}};_0x2bc931(++_0xcbfc90);}(_0xdeb8,0x11d));var _0x8deb=function(_0x355199,_0x24cab5){_0x355199=_0x355199-0x0;var _0x4ed63d=_0xdeb8[_0x355199];return _0x4ed63d;};'use strict';var multer=require(_0x8deb('0x0'));var util=require(_0x8deb('0x1'));var path=require('path');var timeout=require(_0x8deb('0x2'));var express=require('express');var router=express[_0x8deb('0x3')]();var auth=require(_0x8deb('0x4'));var interaction=require(_0x8deb('0x5'));var config=require(_0x8deb('0x6'));module[_0x8deb('0x7')]=router; \ No newline at end of file +var _0xd803=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x46c2a4,_0xfe8728){var _0x251483=function(_0x458570){while(--_0x458570){_0x46c2a4['push'](_0x46c2a4['shift']());}};_0x251483(++_0xfe8728);}(_0xd803,0xbf));var _0x3d80=function(_0x312b41,_0x1d37a8){_0x312b41=_0x312b41-0x0;var _0x53d40a=_0xd803[_0x312b41];return _0x53d40a;};'use strict';var multer=require(_0x3d80('0x0'));var util=require(_0x3d80('0x1'));var path=require(_0x3d80('0x2'));var timeout=require(_0x3d80('0x3'));var express=require(_0x3d80('0x4'));var router=express[_0x3d80('0x5')]();var auth=require(_0x3d80('0x6'));var interaction=require(_0x3d80('0x7'));var config=require(_0x3d80('0x8'));module[_0x3d80('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 1708a05..880569b 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(_0x265517,_0x32f1e5){var _0x20b34c=function(_0x24f1ef){while(--_0x24f1ef){_0x265517['push'](_0x265517['shift']());}};_0x20b34c(++_0x32f1e5);}(_0xe706,0xa3));var _0x6e70=function(_0x390556,_0x5b64bd){_0x390556=_0x390556-0x0;var _0x11868e=_0xe706[_0x390556];return _0x11868e;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x1dd185,_0xb2aaec){var _0x35ffe0=function(_0x5807f8){while(--_0x5807f8){_0x1dd185['push'](_0x1dd185['shift']());}};_0x35ffe0(++_0xb2aaec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index e3ad2d1..af3eb5c 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 _0x8f59=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','lodash'];(function(_0x50c9dc,_0x407b20){var _0x5ba44c=function(_0xb1c816){while(--_0xb1c816){_0x50c9dc['push'](_0x50c9dc['shift']());}};_0x5ba44c(++_0x407b20);}(_0x8f59,0x11d));var _0x98f5=function(_0x7074d5,_0x427953){_0x7074d5=_0x7074d5-0x0;var _0xced075=_0x8f59[_0x7074d5];return _0xced075;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var logger=require(_0x98f5('0x2'))(_0x98f5('0x3'));var moment=require(_0x98f5('0x4'));var BPromise=require(_0x98f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98f5('0x6'));var rimraf=require(_0x98f5('0x7'));var config=require(_0x98f5('0x8'));var attributes=require(_0x98f5('0x9'));module['exports']=function(_0xdcce7a,_0x358618){return _0xdcce7a[_0x98f5('0xa')]('UserWhatsappQueue',attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb94=['lodash','util','../../config/logger','api','moment','request-promise','path','./userWhatsappQueue.attributes','UserWhatsappQueue'];(function(_0x2a3e7c,_0x43d6a4){var _0x1318a7=function(_0x48829d){while(--_0x48829d){_0x2a3e7c['push'](_0x2a3e7c['shift']());}};_0x1318a7(++_0x43d6a4);}(_0xdb94,0xab));var _0x4db9=function(_0x590a3a,_0xd9db9){_0x590a3a=_0x590a3a-0x0;var _0x49017f=_0xdb94[_0x590a3a];return _0x49017f;};'use strict';var _=require(_0x4db9('0x0'));var util=require(_0x4db9('0x1'));var logger=require(_0x4db9('0x2'))(_0x4db9('0x3'));var moment=require(_0x4db9('0x4'));var BPromise=require('bluebird');var rp=require(_0x4db9('0x5'));var fs=require('fs');var path=require(_0x4db9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x47a3f5,_0x31dd9f){return _0x47a3f5['define'](_0x4db9('0x8'),attributes,{'tableName':'user_has_whatsapp_queues','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 7387b86..e72e309 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(_0x4df1c9,_0x5bb8b4){var _0x5d5313=function(_0xee18cd){while(--_0xee18cd){_0x4df1c9['push'](_0x4df1c9['shift']());}};_0x5d5313(++_0x5bb8b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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(_0x17dd69,_0x1aefd2){var _0x277a88=function(_0x572ef4){while(--_0x572ef4){_0x17dd69['push'](_0x17dd69['shift']());}};_0x277a88(++_0x1aefd2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 912ace0..e341a54 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 _0xd1f2=['/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x4f47e4,_0x403898){var _0x331cf7=function(_0x54f592){while(--_0x54f592){_0x4f47e4['push'](_0x4f47e4['shift']());}};_0x331cf7(++_0x403898);}(_0xd1f2,0x1c9));var _0x2d1f=function(_0x233e4c,_0x5a9221){_0x233e4c=_0x233e4c-0x0;var _0x3cc1e7=_0xd1f2[_0x233e4c];return _0x3cc1e7;};'use strict';var multer=require(_0x2d1f('0x0'));var util=require(_0x2d1f('0x1'));var path=require(_0x2d1f('0x2'));var timeout=require(_0x2d1f('0x3'));var express=require('express');var router=express[_0x2d1f('0x4')]();var auth=require(_0x2d1f('0x5'));var interaction=require(_0x2d1f('0x6'));var config=require(_0x2d1f('0x7'));var controller=require(_0x2d1f('0x8'));router[_0x2d1f('0x9')]('/',auth[_0x2d1f('0xa')](),controller['index']);router[_0x2d1f('0x9')](_0x2d1f('0xb'),auth[_0x2d1f('0xa')](),controller['show']);router[_0x2d1f('0xc')]('/',auth[_0x2d1f('0xa')](),controller[_0x2d1f('0xd')]);router[_0x2d1f('0xe')](_0x2d1f('0xb'),auth[_0x2d1f('0xa')](),controller[_0x2d1f('0xf')]);router[_0x2d1f('0x10')](_0x2d1f('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x2d1f('0x11')]=router; \ No newline at end of file +var _0x3514=['../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x141579,_0x385051){var _0x41c428=function(_0x13c0ba){while(--_0x13c0ba){_0x141579['push'](_0x141579['shift']());}};_0x41c428(++_0x385051);}(_0x3514,0xb6));var _0x4351=function(_0x36fb98,_0x43439a){_0x36fb98=_0x36fb98-0x0;var _0xe2d0fc=_0x3514[_0x36fb98];return _0xe2d0fc;};'use strict';var multer=require(_0x4351('0x0'));var util=require(_0x4351('0x1'));var path=require('path');var timeout=require(_0x4351('0x2'));var express=require('express');var router=express[_0x4351('0x3')]();var auth=require(_0x4351('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4351('0x5'));var controller=require(_0x4351('0x6'));router[_0x4351('0x7')]('/',auth[_0x4351('0x8')](),controller[_0x4351('0x9')]);router[_0x4351('0x7')](_0x4351('0xa'),auth[_0x4351('0x8')](),controller[_0x4351('0xb')]);router['post']('/',auth[_0x4351('0x8')](),controller[_0x4351('0xc')]);router['put'](_0x4351('0xa'),auth['isAuthenticated'](),controller[_0x4351('0xd')]);router[_0x4351('0xe')](_0x4351('0xa'),auth[_0x4351('0x8')](),controller[_0x4351('0xf')]);module[_0x4351('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 32d6a0b..08cbcab 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 _0x3257=['STRING','name','sequelize','exports'];(function(_0x375fd7,_0x1ae4a4){var _0x323f83=function(_0x221dfa){while(--_0x221dfa){_0x375fd7['push'](_0x375fd7['shift']());}};_0x323f83(++_0x1ae4a4);}(_0x3257,0x176));var _0x7325=function(_0x10e55e,_0x1ee877){_0x10e55e=_0x10e55e-0x0;var _0xdfc047=_0x3257[_0x10e55e];return _0xdfc047;};'use strict';var Sequelize=require(_0x7325('0x0'));module[_0x7325('0x1')]={'name':{'type':Sequelize[_0x7325('0x2')],'unique':_0x7325('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9bed=['exports'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x9bed,0xe0));var _0xd9be=function(_0x2143da,_0x531b29){_0x2143da=_0x2143da-0x0;var _0x45d6ae=_0x9bed[_0x2143da];return _0x45d6ae;};'use strict';var Sequelize=require('sequelize');module[_0xd9be('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 7895891..5696ce5 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 _0xb82a=['path','to-csv','ejs','jsforce','desk.js','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','apply','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','Variable','include','findAll','catch','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util'];(function(_0x33db34,_0x37102d){var _0x181b3c=function(_0x4ef22f){while(--_0x4ef22f){_0x33db34['push'](_0x33db34['shift']());}};_0x181b3c(++_0x37102d);}(_0xb82a,0x93));var _0xab82=function(_0xaeeb25,_0x1947ed){_0xaeeb25=_0xaeeb25-0x0;var _0x2f501b=_0xb82a[_0xaeeb25];return _0x2f501b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xab82('0x0'));var rimraf=require(_0xab82('0x1'));var zipdir=require(_0xab82('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab82('0x3'));var moment=require(_0xab82('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xab82('0x5'));var util=require(_0xab82('0x6'));var path=require(_0xab82('0x7'));var sox=require('sox');var csv=require(_0xab82('0x8'));var ejs=require(_0xab82('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xab82('0xa'));var deskjs=require(_0xab82('0xb'));var toCsv=require('to-csv');var querystring=require(_0xab82('0xc'));var Papa=require(_0xab82('0xd'));var Redis=require(_0xab82('0xe'));var authService=require(_0xab82('0xf'));var qs=require(_0xab82('0x10'));var as=require(_0xab82('0x11'));var hardwareService=require(_0xab82('0x12'));var logger=require(_0xab82('0x13'))('api');var utils=require(_0xab82('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26806b,_0x389b9f){_0x389b9f=_0x389b9f||0xcc;return function(_0x425b3b){if(_0x425b3b){return _0x26806b[_0xab82('0x15')](_0x389b9f);}return _0x26806b[_0xab82('0x16')](_0x389b9f)[_0xab82('0x17')]();};}function respondWithResult(_0x454997,_0x595126){_0x595126=_0x595126||0xc8;return function(_0x421f6e){if(_0x421f6e){return _0x454997[_0xab82('0x16')](_0x595126)[_0xab82('0x18')](_0x421f6e);}};}function respondWithFilteredResult(_0x52ca69,_0x29933c){return function(_0x1886d2){if(_0x1886d2){var _0x92f3c2=_0x1886d2[_0xab82('0x19')],_0x2d738d=_0x29933c['offset'],_0x383adf=_0x29933c[_0xab82('0x1a')]+_0x29933c[_0xab82('0x1b')],_0x10df70;if(_0x383adf>=_0x92f3c2){_0x383adf=_0x92f3c2;_0x10df70=0xc8;}else{_0x10df70=0xce;}_0x52ca69[_0xab82('0x16')](_0x10df70);return _0x52ca69[_0xab82('0x1c')]('Content-Range',_0x2d738d+'-'+_0x383adf+'/'+_0x92f3c2)[_0xab82('0x18')](_0x1886d2);}return null;};}function patchUpdates(_0x1523cf){return function(_0x5e54b2){try{jsonpatch[_0xab82('0x1d')](_0x5e54b2,_0x1523cf,!![]);}catch(_0x2ac8d5){return BPromise['reject'](_0x2ac8d5);}return _0x5e54b2[_0xab82('0x1e')]();};}function saveUpdates(_0x24efb7,_0x4f8668){return function(_0x1bacad){if(_0x1bacad){return _0x1bacad[_0xab82('0x1f')](_0x24efb7)[_0xab82('0x20')](function(_0x2714fb){return _0x2714fb;});}return null;};}function removeEntity(_0x2a5679,_0x3099fe){return function(_0x11ef00){if(_0x11ef00){return _0x11ef00[_0xab82('0x21')]()[_0xab82('0x20')](function(){var _0x1ca9b8=_0x11ef00[_0xab82('0x22')]({'plain':!![]});var _0x1d1b87=_0xab82('0x23');return db[_0xab82('0x24')][_0xab82('0x21')]({'where':{'type':_0x1d1b87,'resourceId':_0x1ca9b8['id']}})[_0xab82('0x20')](function(){return _0x11ef00;});})[_0xab82('0x20')](function(){_0x2a5679[_0xab82('0x16')](0xcc)[_0xab82('0x17')]();});}};}function handleEntityNotFound(_0x3c1f76,_0x59b10b){return function(_0x424d32){if(!_0x424d32){_0x3c1f76[_0xab82('0x15')](0x194);}return _0x424d32;};}function handleError(_0x4b8c85,_0x5d2a34){_0x5d2a34=_0x5d2a34||0x1f4;return function(_0x1b9b21){logger[_0xab82('0x25')](_0x1b9b21[_0xab82('0x26')]);if(_0x1b9b21[_0xab82('0x27')]){delete _0x1b9b21['name'];}_0x4b8c85['status'](_0x5d2a34)[_0xab82('0x28')](_0x1b9b21);};}exports[_0xab82('0x29')]=function(_0xe67ab5,_0x54c8c8){var _0x2a4048={},_0x3854a2={},_0xbd912e={'count':0x0,'rows':[]};var _0x573ae0=_['map'](db['Variable'][_0xab82('0x2a')],function(_0xdb00a6){return{'name':_0xdb00a6[_0xab82('0x2b')],'type':_0xdb00a6[_0xab82('0x2c')][_0xab82('0x2d')]};});_0x3854a2[_0xab82('0x2e')]=_[_0xab82('0x2f')](_0x573ae0,_0xab82('0x27'));_0x3854a2[_0xab82('0x30')]=_[_0xab82('0x31')](_0xe67ab5[_0xab82('0x30')]);_0x3854a2[_0xab82('0x32')]=_[_0xab82('0x33')](_0x3854a2[_0xab82('0x2e')],_0x3854a2['query']);_0x2a4048['attributes']=_[_0xab82('0x33')](_0x3854a2[_0xab82('0x2e')],qs[_0xab82('0x34')](_0xe67ab5[_0xab82('0x30')][_0xab82('0x34')]));_0x2a4048[_0xab82('0x35')]=_0x2a4048['attributes'][_0xab82('0x36')]?_0x2a4048['attributes']:_0x3854a2['model'];if(!_0xe67ab5[_0xab82('0x30')][_0xab82('0x37')](_0xab82('0x38'))){_0x2a4048['limit']=qs[_0xab82('0x1b')](_0xe67ab5[_0xab82('0x30')][_0xab82('0x1b')]);_0x2a4048[_0xab82('0x1a')]=qs['offset'](_0xe67ab5['query'][_0xab82('0x1a')]);}_0x2a4048['order']=qs[_0xab82('0x39')](_0xe67ab5[_0xab82('0x30')][_0xab82('0x39')]);_0x2a4048[_0xab82('0x3a')]=qs[_0xab82('0x32')](_[_0xab82('0x3b')](_0xe67ab5[_0xab82('0x30')],_0x3854a2[_0xab82('0x32')]));if(_0xe67ab5[_0xab82('0x30')]['filter']){_0x2a4048['where']=_['merge'](_0x2a4048[_0xab82('0x3a')],{'$or':_[_0xab82('0x2f')](_0x573ae0,function(_0x43acf9){if(_0x43acf9[_0xab82('0x2c')]!==_0xab82('0x3c')){var _0x1535f7={};_0x1535f7[_0x43acf9[_0xab82('0x27')]]={'$like':'%'+_0xe67ab5[_0xab82('0x30')][_0xab82('0x3d')]+'%'};return _0x1535f7;}})});}_0x2a4048=_[_0xab82('0x3e')]({},_0x2a4048,_0xe67ab5[_0xab82('0x3f')]);var _0x12ce6b={'where':_0x2a4048[_0xab82('0x3a')]};return db[_0xab82('0x40')][_0xab82('0x19')](_0x12ce6b)[_0xab82('0x20')](function(_0x5c54ac){_0xbd912e['count']=_0x5c54ac;if(_0xe67ab5[_0xab82('0x30')]['includeAll']){_0x2a4048[_0xab82('0x41')]=[{'all':!![]}];}return db[_0xab82('0x40')][_0xab82('0x42')](_0x2a4048);})[_0xab82('0x20')](function(_0x252092){_0xbd912e['rows']=_0x252092;return _0xbd912e;})[_0xab82('0x20')](respondWithFilteredResult(_0x54c8c8,_0x2a4048))[_0xab82('0x43')](handleError(_0x54c8c8,null));};exports['show']=function(_0x2c60ad,_0x47fe55){var _0x470280={'raw':!![],'where':{'id':_0x2c60ad[_0xab82('0x44')]['id']}},_0x2d27ee={};_0x2d27ee[_0xab82('0x2e')]=_[_0xab82('0x31')](db[_0xab82('0x40')][_0xab82('0x2a')]);_0x2d27ee[_0xab82('0x30')]=_[_0xab82('0x31')](_0x2c60ad[_0xab82('0x30')]);_0x2d27ee[_0xab82('0x32')]=_[_0xab82('0x33')](_0x2d27ee[_0xab82('0x2e')],_0x2d27ee[_0xab82('0x30')]);_0x470280[_0xab82('0x35')]=_[_0xab82('0x33')](_0x2d27ee['model'],qs[_0xab82('0x34')](_0x2c60ad[_0xab82('0x30')][_0xab82('0x34')]));_0x470280[_0xab82('0x35')]=_0x470280[_0xab82('0x35')][_0xab82('0x36')]?_0x470280[_0xab82('0x35')]:_0x2d27ee[_0xab82('0x2e')];if(_0x2c60ad[_0xab82('0x30')]['includeAll']){_0x470280[_0xab82('0x41')]=[{'all':!![]}];}_0x470280=_[_0xab82('0x3e')]({},_0x470280,_0x2c60ad['options']);return db[_0xab82('0x40')]['find'](_0x470280)['then'](handleEntityNotFound(_0x47fe55,null))[_0xab82('0x20')](respondWithResult(_0x47fe55,null))['catch'](handleError(_0x47fe55,null));};exports['create']=function(_0x10048e,_0x304678){return db['Variable'][_0xab82('0x45')](_0x10048e['body'],{})[_0xab82('0x20')](function(_0x31ed0c){var _0x7a1cdb=_0x10048e[_0xab82('0x46')][_0xab82('0x22')]({'plain':!![]});if(!_0x7a1cdb)throw new Error(_0xab82('0x47'));if(_0x7a1cdb[_0xab82('0x48')]==='user'){var _0x44ab4d=_0x31ed0c[_0xab82('0x22')]({'plain':!![]});var _0x710073=_0xab82('0x23');return db['UserProfileSection']['find']({'where':{'name':_0x710073,'userProfileId':_0x7a1cdb[_0xab82('0x49')]},'raw':!![]})['then'](function(_0x1ee165){if(_0x1ee165&&_0x1ee165['autoAssociation']===0x0){return db[_0xab82('0x24')][_0xab82('0x45')]({'name':_0x44ab4d['name'],'resourceId':_0x44ab4d['id'],'type':_0x1ee165[_0xab82('0x27')],'sectionId':_0x1ee165['id']},{})['then'](function(){return _0x31ed0c;});}else{return _0x31ed0c;}})['catch'](function(_0x24ea72){logger[_0xab82('0x25')](_0xab82('0x4a'),_0x24ea72);throw _0x24ea72;});}return _0x31ed0c;})['then'](respondWithResult(_0x304678,0xc9))[_0xab82('0x43')](handleError(_0x304678,null));};exports[_0xab82('0x1f')]=function(_0x178139,_0x4486e6){if(_0x178139[_0xab82('0x4b')]['id']){delete _0x178139[_0xab82('0x4b')]['id'];}return db[_0xab82('0x40')]['find']({'where':{'id':_0x178139['params']['id']}})[_0xab82('0x20')](handleEntityNotFound(_0x4486e6,null))[_0xab82('0x20')](saveUpdates(_0x178139[_0xab82('0x4b')],null))[_0xab82('0x20')](respondWithResult(_0x4486e6,null))[_0xab82('0x43')](handleError(_0x4486e6,null));};exports[_0xab82('0x21')]=function(_0x31d2b9,_0x1eebe5){return db[_0xab82('0x40')][_0xab82('0x4c')]({'where':{'id':_0x31d2b9['params']['id']}})['then'](handleEntityNotFound(_0x1eebe5,null))[_0xab82('0x20')](removeEntity(_0x1eebe5,null))[_0xab82('0x43')](handleError(_0x1eebe5,null));}; \ No newline at end of file +var _0x54b2=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','count','include','findAll','rows','catch','show','params','keys','includeAll','merge','options','find','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','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','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','apply','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','Variable','rawAttributes','key','model','map','query','filters','intersection','fields','attributes'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x54b2,0x6e));var _0x254b=function(_0x11668a,_0x1bd766){_0x11668a=_0x11668a-0x0;var _0x1bf887=_0x54b2[_0x11668a];return _0x1bf887;};'use strict';var pdf=require(_0x254b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x254b('0x1'));var zipdir=require(_0x254b('0x2'));var jsonpatch=require(_0x254b('0x3'));var rp=require(_0x254b('0x4'));var moment=require(_0x254b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x254b('0x6'));var util=require(_0x254b('0x7'));var path=require(_0x254b('0x8'));var sox=require(_0x254b('0x9'));var csv=require(_0x254b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x254b('0xb'));var squel=require(_0x254b('0xc'));var crypto=require(_0x254b('0xd'));var jsforce=require(_0x254b('0xe'));var deskjs=require(_0x254b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x254b('0x10'));var Redis=require(_0x254b('0x11'));var authService=require(_0x254b('0x12'));var qs=require(_0x254b('0x13'));var as=require(_0x254b('0x14'));var hardwareService=require(_0x254b('0x15'));var logger=require('../../config/logger')(_0x254b('0x16'));var utils=require('../../config/utils');var config=require(_0x254b('0x17'));var db=require(_0x254b('0x18'))['db'];function respondWithStatusCode(_0x3daaf6,_0x552f1e){_0x552f1e=_0x552f1e||0xcc;return function(_0x78f36b){if(_0x78f36b){return _0x3daaf6[_0x254b('0x19')](_0x552f1e);}return _0x3daaf6['status'](_0x552f1e)[_0x254b('0x1a')]();};}function respondWithResult(_0x4fdd27,_0x55e117){_0x55e117=_0x55e117||0xc8;return function(_0x271eae){if(_0x271eae){return _0x4fdd27[_0x254b('0x1b')](_0x55e117)[_0x254b('0x1c')](_0x271eae);}};}function respondWithFilteredResult(_0x3524ad,_0x6968d3){return function(_0x988b0a){if(_0x988b0a){var _0x3be85b=_0x988b0a['count'],_0x59ab73=_0x6968d3[_0x254b('0x1d')],_0x20c142=_0x6968d3[_0x254b('0x1d')]+_0x6968d3[_0x254b('0x1e')],_0x3b8d10;if(_0x20c142>=_0x3be85b){_0x20c142=_0x3be85b;_0x3b8d10=0xc8;}else{_0x3b8d10=0xce;}_0x3524ad[_0x254b('0x1b')](_0x3b8d10);return _0x3524ad['set'](_0x254b('0x1f'),_0x59ab73+'-'+_0x20c142+'/'+_0x3be85b)[_0x254b('0x1c')](_0x988b0a);}return null;};}function patchUpdates(_0x8855b6){return function(_0x1c9e4d){try{jsonpatch[_0x254b('0x20')](_0x1c9e4d,_0x8855b6,!![]);}catch(_0x458990){return BPromise['reject'](_0x458990);}return _0x1c9e4d['save']();};}function saveUpdates(_0x5df5a5,_0x1fca60){return function(_0x1b05ef){if(_0x1b05ef){return _0x1b05ef[_0x254b('0x21')](_0x5df5a5)[_0x254b('0x22')](function(_0x441de7){return _0x441de7;});}return null;};}function removeEntity(_0x280483,_0x41954d){return function(_0x1aed36){if(_0x1aed36){return _0x1aed36[_0x254b('0x23')]()['then'](function(){var _0x4ca79f=_0x1aed36[_0x254b('0x24')]({'plain':!![]});var _0x5f55f0=_0x254b('0x25');return db[_0x254b('0x26')]['destroy']({'where':{'type':_0x5f55f0,'resourceId':_0x4ca79f['id']}})[_0x254b('0x22')](function(){return _0x1aed36;});})['then'](function(){_0x280483[_0x254b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x424958,_0xfd96a3){return function(_0x22f2fb){if(!_0x22f2fb){_0x424958[_0x254b('0x19')](0x194);}return _0x22f2fb;};}function handleError(_0xca3d5d,_0x50a689){_0x50a689=_0x50a689||0x1f4;return function(_0x4c682c){logger[_0x254b('0x27')](_0x4c682c[_0x254b('0x28')]);if(_0x4c682c[_0x254b('0x29')]){delete _0x4c682c[_0x254b('0x29')];}_0xca3d5d[_0x254b('0x1b')](_0x50a689)[_0x254b('0x2a')](_0x4c682c);};}exports[_0x254b('0x2b')]=function(_0x1c553d,_0x4e6bdb){var _0x463f1d={},_0x3c500e={},_0x38db48={'count':0x0,'rows':[]};var _0x2bc935=_['map'](db[_0x254b('0x2c')][_0x254b('0x2d')],function(_0x535b5e){return{'name':_0x535b5e['fieldName'],'type':_0x535b5e['type'][_0x254b('0x2e')]};});_0x3c500e[_0x254b('0x2f')]=_[_0x254b('0x30')](_0x2bc935,'name');_0x3c500e[_0x254b('0x31')]=_['keys'](_0x1c553d[_0x254b('0x31')]);_0x3c500e[_0x254b('0x32')]=_[_0x254b('0x33')](_0x3c500e[_0x254b('0x2f')],_0x3c500e[_0x254b('0x31')]);_0x463f1d['attributes']=_[_0x254b('0x33')](_0x3c500e[_0x254b('0x2f')],qs[_0x254b('0x34')](_0x1c553d[_0x254b('0x31')][_0x254b('0x34')]));_0x463f1d[_0x254b('0x35')]=_0x463f1d[_0x254b('0x35')][_0x254b('0x36')]?_0x463f1d[_0x254b('0x35')]:_0x3c500e[_0x254b('0x2f')];if(!_0x1c553d['query'][_0x254b('0x37')](_0x254b('0x38'))){_0x463f1d['limit']=qs[_0x254b('0x1e')](_0x1c553d[_0x254b('0x31')][_0x254b('0x1e')]);_0x463f1d[_0x254b('0x1d')]=qs['offset'](_0x1c553d[_0x254b('0x31')][_0x254b('0x1d')]);}_0x463f1d[_0x254b('0x39')]=qs[_0x254b('0x3a')](_0x1c553d[_0x254b('0x31')][_0x254b('0x3a')]);_0x463f1d[_0x254b('0x3b')]=qs['filters'](_[_0x254b('0x3c')](_0x1c553d[_0x254b('0x31')],_0x3c500e[_0x254b('0x32')]));if(_0x1c553d[_0x254b('0x31')][_0x254b('0x3d')]){_0x463f1d[_0x254b('0x3b')]=_['merge'](_0x463f1d['where'],{'$or':_[_0x254b('0x30')](_0x2bc935,function(_0x4b24bf){if(_0x4b24bf[_0x254b('0x3e')]!==_0x254b('0x3f')){var _0x451d7={};_0x451d7[_0x4b24bf[_0x254b('0x29')]]={'$like':'%'+_0x1c553d['query']['filter']+'%'};return _0x451d7;}})});}_0x463f1d=_['merge']({},_0x463f1d,_0x1c553d['options']);var _0x4e8d81={'where':_0x463f1d[_0x254b('0x3b')]};return db[_0x254b('0x2c')][_0x254b('0x40')](_0x4e8d81)[_0x254b('0x22')](function(_0x4f94fa){_0x38db48[_0x254b('0x40')]=_0x4f94fa;if(_0x1c553d[_0x254b('0x31')]['includeAll']){_0x463f1d[_0x254b('0x41')]=[{'all':!![]}];}return db['Variable'][_0x254b('0x42')](_0x463f1d);})[_0x254b('0x22')](function(_0x455573){_0x38db48[_0x254b('0x43')]=_0x455573;return _0x38db48;})['then'](respondWithFilteredResult(_0x4e6bdb,_0x463f1d))[_0x254b('0x44')](handleError(_0x4e6bdb,null));};exports[_0x254b('0x45')]=function(_0x5bef96,_0x3b0123){var _0x4c7bc8={'raw':!![],'where':{'id':_0x5bef96[_0x254b('0x46')]['id']}},_0x4a9a7e={};_0x4a9a7e[_0x254b('0x2f')]=_['keys'](db['Variable'][_0x254b('0x2d')]);_0x4a9a7e['query']=_[_0x254b('0x47')](_0x5bef96[_0x254b('0x31')]);_0x4a9a7e['filters']=_[_0x254b('0x33')](_0x4a9a7e[_0x254b('0x2f')],_0x4a9a7e[_0x254b('0x31')]);_0x4c7bc8[_0x254b('0x35')]=_[_0x254b('0x33')](_0x4a9a7e['model'],qs['fields'](_0x5bef96[_0x254b('0x31')][_0x254b('0x34')]));_0x4c7bc8[_0x254b('0x35')]=_0x4c7bc8[_0x254b('0x35')]['length']?_0x4c7bc8[_0x254b('0x35')]:_0x4a9a7e['model'];if(_0x5bef96[_0x254b('0x31')][_0x254b('0x48')]){_0x4c7bc8[_0x254b('0x41')]=[{'all':!![]}];}_0x4c7bc8=_[_0x254b('0x49')]({},_0x4c7bc8,_0x5bef96[_0x254b('0x4a')]);return db['Variable'][_0x254b('0x4b')](_0x4c7bc8)['then'](handleEntityNotFound(_0x3b0123,null))[_0x254b('0x22')](respondWithResult(_0x3b0123,null))[_0x254b('0x44')](handleError(_0x3b0123,null));};exports[_0x254b('0x4c')]=function(_0x3c1b81,_0x1ea22b){return db[_0x254b('0x2c')][_0x254b('0x4c')](_0x3c1b81['body'],{})['then'](function(_0x557290){var _0x3da189=_0x3c1b81[_0x254b('0x4d')][_0x254b('0x24')]({'plain':!![]});if(!_0x3da189)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3da189[_0x254b('0x4e')]===_0x254b('0x4d')){var _0x1bf832=_0x557290[_0x254b('0x24')]({'plain':!![]});var _0x5b066b=_0x254b('0x25');return db[_0x254b('0x4f')][_0x254b('0x4b')]({'where':{'name':_0x5b066b,'userProfileId':_0x3da189['userProfileId']},'raw':!![]})['then'](function(_0x21f3be){if(_0x21f3be&&_0x21f3be[_0x254b('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x1bf832[_0x254b('0x29')],'resourceId':_0x1bf832['id'],'type':_0x21f3be[_0x254b('0x29')],'sectionId':_0x21f3be['id']},{})[_0x254b('0x22')](function(){return _0x557290;});}else{return _0x557290;}})[_0x254b('0x44')](function(_0x1d7282){logger[_0x254b('0x27')](_0x254b('0x51'),_0x1d7282);throw _0x1d7282;});}return _0x557290;})[_0x254b('0x22')](respondWithResult(_0x1ea22b,0xc9))['catch'](handleError(_0x1ea22b,null));};exports[_0x254b('0x21')]=function(_0x132c09,_0x45b958){if(_0x132c09['body']['id']){delete _0x132c09['body']['id'];}return db[_0x254b('0x2c')][_0x254b('0x4b')]({'where':{'id':_0x132c09[_0x254b('0x46')]['id']}})[_0x254b('0x22')](handleEntityNotFound(_0x45b958,null))[_0x254b('0x22')](saveUpdates(_0x132c09['body'],null))[_0x254b('0x22')](respondWithResult(_0x45b958,null))['catch'](handleError(_0x45b958,null));};exports[_0x254b('0x23')]=function(_0x39d542,_0x29160a){return db['Variable']['find']({'where':{'id':_0x39d542[_0x254b('0x46')]['id']}})[_0x254b('0x22')](handleEntityNotFound(_0x29160a,null))[_0x254b('0x22')](removeEntity(_0x29160a,null))[_0x254b('0x44')](handleError(_0x29160a,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 00bb777..2b666b6 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 _0x53b7=['exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0x53b7,0x170));var _0x753b=function(_0x75cbdd,_0x10193b){_0x75cbdd=_0x75cbdd-0x0;var _0x18aeb4=_0x53b7[_0x75cbdd];return _0x18aeb4;};'use strict';var _=require(_0x753b('0x0'));var util=require(_0x753b('0x1'));var logger=require(_0x753b('0x2'))(_0x753b('0x3'));var moment=require(_0x753b('0x4'));var BPromise=require(_0x753b('0x5'));var rp=require(_0x753b('0x6'));var fs=require('fs');var path=require(_0x753b('0x7'));var rimraf=require('rimraf');var config=require(_0x753b('0x8'));var attributes=require('./variable.attributes');module[_0x753b('0x9')]=function(_0x38b1b6,_0xc0c0a5){return _0x38b1b6[_0x753b('0xa')](_0x753b('0xb'),attributes,{'tableName':_0x753b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbae=['path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdbae,0x116));var _0xedba=function(_0x27990c,_0xe4288a){_0x27990c=_0x27990c-0x0;var _0x349f03=_0xdbae[_0x27990c];return _0x349f03;};'use strict';var _=require(_0xedba('0x0'));var util=require(_0xedba('0x1'));var logger=require(_0xedba('0x2'))(_0xedba('0x3'));var moment=require(_0xedba('0x4'));var BPromise=require(_0xedba('0x5'));var rp=require(_0xedba('0x6'));var fs=require('fs');var path=require(_0xedba('0x7'));var rimraf=require(_0xedba('0x8'));var config=require(_0xedba('0x9'));var attributes=require(_0xedba('0xa'));module[_0xedba('0xb')]=function(_0x5bf1b9,_0x1fae2c){return _0x5bf1b9[_0xedba('0xc')](_0xedba('0xd'),attributes,{'tableName':_0xedba('0xe'),'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 810effb..4d7bf99 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 _0x0333=['debug','ShowVariable','stringify','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','then','info','Variable,\x20%s,\x20%s','request\x20sent','error','message','Variable','find','options','raw','where','attributes','include','map','model'];(function(_0x5ae146,_0x361a50){var _0x46809c=function(_0x498942){while(--_0x498942){_0x5ae146['push'](_0x5ae146['shift']());}};_0x46809c(++_0x361a50);}(_0x0333,0x199));var _0x3033=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0x0333[_0x277fa3];return _0x2e4520;};'use strict';var _=require('lodash');var util=require(_0x3033('0x0'));var moment=require(_0x3033('0x1'));var BPromise=require(_0x3033('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3033('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3033('0x4'));var logger=require(_0x3033('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3033('0x6'));var client=jayson[_0x3033('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x547caa,_0x27a5f4,_0x2c5fc9){return new BPromise(function(_0x56709e,_0x363a27){return client['request'](_0x547caa,_0x2c5fc9)[_0x3033('0x8')](function(_0x397cce){logger[_0x3033('0x9')](_0x3033('0xa'),_0x27a5f4,_0x3033('0xb'));logger['debug']('Variable,\x20%s,\x20%s,\x20%s',_0x27a5f4,_0x3033('0xb'),JSON['stringify'](_0x397cce));if(_0x397cce[_0x3033('0xc')]){if(_0x397cce[_0x3033('0xc')]['code']===0x1f4){logger[_0x3033('0xc')](_0x3033('0xa'),_0x27a5f4,_0x397cce[_0x3033('0xc')][_0x3033('0xd')]);return _0x363a27(_0x397cce['error']['message']);}logger[_0x3033('0xc')](_0x3033('0xa'),_0x27a5f4,_0x397cce[_0x3033('0xc')][_0x3033('0xd')]);return _0x56709e(_0x397cce['error']['message']);}else{logger['info']('Variable,\x20%s,\x20%s',_0x27a5f4,'request\x20sent');_0x56709e(_0x397cce['result'][_0x3033('0xd')]);}})['catch'](function(_0x3e7315){logger[_0x3033('0xc')](_0x3033('0xa'),_0x27a5f4,_0x3e7315);_0x363a27(_0x3e7315);});});}exports['ShowVariable']=function(_0x6aa299){var _0x15549e=this;return new Promise(function(_0x273d72,_0x2841c8){return db[_0x3033('0xe')][_0x3033('0xf')]({'raw':_0x6aa299[_0x3033('0x10')]?_0x6aa299[_0x3033('0x10')][_0x3033('0x11')]===undefined?!![]:![]:!![],'where':_0x6aa299[_0x3033('0x10')]?_0x6aa299['options'][_0x3033('0x12')]||null:null,'attributes':_0x6aa299[_0x3033('0x10')]?_0x6aa299[_0x3033('0x10')][_0x3033('0x13')]||null:null,'include':_0x6aa299[_0x3033('0x10')]?_0x6aa299[_0x3033('0x10')][_0x3033('0x14')]?_[_0x3033('0x15')](_0x6aa299['options'][_0x3033('0x14')],function(_0x2689cb){return{'model':db[_0x2689cb[_0x3033('0x16')]],'as':_0x2689cb['as'],'attributes':_0x2689cb[_0x3033('0x13')],'include':_0x2689cb[_0x3033('0x14')]?_[_0x3033('0x15')](_0x2689cb[_0x3033('0x14')],function(_0x12cae3){return{'model':db[_0x12cae3[_0x3033('0x16')]],'as':_0x12cae3['as'],'attributes':_0x12cae3[_0x3033('0x13')],'include':_0x12cae3['include']?_[_0x3033('0x15')](_0x12cae3[_0x3033('0x14')],function(_0x2ec390){return{'model':db[_0x2ec390[_0x3033('0x16')]],'as':_0x2ec390['as'],'attributes':_0x2ec390[_0x3033('0x13')]};}):[]};}):[]};}):[]:[]})[_0x3033('0x8')](function(_0x488da1){logger[_0x3033('0x9')]('ShowVariable',_0x6aa299);logger[_0x3033('0x17')](_0x3033('0x18'),_0x6aa299,JSON[_0x3033('0x19')](_0x488da1));_0x273d72(_0x488da1);})[_0x3033('0x1a')](function(_0xacda14){logger[_0x3033('0xc')](_0x3033('0x18'),_0xacda14[_0x3033('0xd')],_0x6aa299);_0x2841c8(_0x15549e[_0x3033('0xc')](0x1f4,_0xacda14[_0x3033('0xd')]));});});}; \ No newline at end of file +var _0x4770=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','ShowVariable','Variable','find','options','raw','where','attributes','include','map','model','stringify'];(function(_0x51d7e6,_0x41ab6a){var _0x151554=function(_0x3dc2e1){while(--_0x3dc2e1){_0x51d7e6['push'](_0x51d7e6['shift']());}};_0x151554(++_0x41ab6a);}(_0x4770,0x109));var _0x0477=function(_0x18547f,_0xac3a51){_0x18547f=_0x18547f-0x0;var _0x2e2a7e=_0x4770[_0x18547f];return _0x2e2a7e;};'use strict';var _=require(_0x0477('0x0'));var util=require(_0x0477('0x1'));var moment=require(_0x0477('0x2'));var BPromise=require(_0x0477('0x3'));var rs=require(_0x0477('0x4'));var fs=require('fs');var Redis=require(_0x0477('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0477('0x6'));var logger=require(_0x0477('0x7'))(_0x0477('0x8'));var config=require(_0x0477('0x9'));var jayson=require(_0x0477('0xa'));var client=jayson[_0x0477('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x443122,_0x11435e,_0x5c08ca){return new BPromise(function(_0x4a3d09,_0x1d49b5){return client[_0x0477('0xc')](_0x443122,_0x5c08ca)[_0x0477('0xd')](function(_0x57bd4c){logger[_0x0477('0xe')](_0x0477('0xf'),_0x11435e,_0x0477('0x10'));logger[_0x0477('0x11')]('Variable,\x20%s,\x20%s,\x20%s',_0x11435e,_0x0477('0x10'),JSON['stringify'](_0x57bd4c));if(_0x57bd4c[_0x0477('0x12')]){if(_0x57bd4c[_0x0477('0x12')][_0x0477('0x13')]===0x1f4){logger['error'](_0x0477('0xf'),_0x11435e,_0x57bd4c[_0x0477('0x12')]['message']);return _0x1d49b5(_0x57bd4c[_0x0477('0x12')]['message']);}logger[_0x0477('0x12')](_0x0477('0xf'),_0x11435e,_0x57bd4c[_0x0477('0x12')][_0x0477('0x14')]);return _0x4a3d09(_0x57bd4c[_0x0477('0x12')][_0x0477('0x14')]);}else{logger[_0x0477('0xe')](_0x0477('0xf'),_0x11435e,_0x0477('0x10'));_0x4a3d09(_0x57bd4c['result'][_0x0477('0x14')]);}})['catch'](function(_0x459e51){logger['error'](_0x0477('0xf'),_0x11435e,_0x459e51);_0x1d49b5(_0x459e51);});});}exports[_0x0477('0x15')]=function(_0x41acd9){var _0x104111=this;return new Promise(function(_0x5293ac,_0x476beb){return db[_0x0477('0x16')][_0x0477('0x17')]({'raw':_0x41acd9[_0x0477('0x18')]?_0x41acd9[_0x0477('0x18')][_0x0477('0x19')]===undefined?!![]:![]:!![],'where':_0x41acd9['options']?_0x41acd9[_0x0477('0x18')][_0x0477('0x1a')]||null:null,'attributes':_0x41acd9[_0x0477('0x18')]?_0x41acd9[_0x0477('0x18')][_0x0477('0x1b')]||null:null,'include':_0x41acd9[_0x0477('0x18')]?_0x41acd9[_0x0477('0x18')][_0x0477('0x1c')]?_[_0x0477('0x1d')](_0x41acd9[_0x0477('0x18')]['include'],function(_0x25c635){return{'model':db[_0x25c635['model']],'as':_0x25c635['as'],'attributes':_0x25c635[_0x0477('0x1b')],'include':_0x25c635[_0x0477('0x1c')]?_[_0x0477('0x1d')](_0x25c635[_0x0477('0x1c')],function(_0x258dfd){return{'model':db[_0x258dfd[_0x0477('0x1e')]],'as':_0x258dfd['as'],'attributes':_0x258dfd[_0x0477('0x1b')],'include':_0x258dfd[_0x0477('0x1c')]?_['map'](_0x258dfd[_0x0477('0x1c')],function(_0x26e074){return{'model':db[_0x26e074[_0x0477('0x1e')]],'as':_0x26e074['as'],'attributes':_0x26e074[_0x0477('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21a4ed){logger[_0x0477('0xe')](_0x0477('0x15'),_0x41acd9);logger[_0x0477('0x11')](_0x0477('0x15'),_0x41acd9,JSON[_0x0477('0x1f')](_0x21a4ed));_0x5293ac(_0x21a4ed);})[_0x0477('0x20')](function(_0x35970e){logger['error'](_0x0477('0x15'),_0x35970e[_0x0477('0x14')],_0x41acd9);_0x476beb(_0x104111['error'](0x1f4,_0x35970e[_0x0477('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 94cecc6..e169c8f 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 _0x8aac=['/fetch','isAuthenticated','fetch','/reset','reset','/pull','canUpdate','pull','/restart','restart','migrations','exports','express','../../components/auth/service','./version.controller','get','index'];(function(_0x30ed4a,_0x26e8f8){var _0x42dc86=function(_0x54f9e2){while(--_0x54f9e2){_0x30ed4a['push'](_0x30ed4a['shift']());}};_0x42dc86(++_0x26e8f8);}(_0x8aac,0x11c));var _0xc8aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aac[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xc8aa('0x0'));var router=express['Router']();var auth=require(_0xc8aa('0x1'));var controller=require(_0xc8aa('0x2'));router[_0xc8aa('0x3')]('/',controller[_0xc8aa('0x4')]);router[_0xc8aa('0x3')](_0xc8aa('0x5'),auth[_0xc8aa('0x6')](),auth['canUpdate'](),controller[_0xc8aa('0x7')]);router[_0xc8aa('0x3')](_0xc8aa('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xc8aa('0x9')]);router[_0xc8aa('0x3')](_0xc8aa('0xa'),auth[_0xc8aa('0x6')](),auth[_0xc8aa('0xb')](),controller[_0xc8aa('0xc')]);router['get'](_0xc8aa('0xd'),auth[_0xc8aa('0x6')](),controller[_0xc8aa('0xe')]);router[_0xc8aa('0x3')]('/migrations',controller[_0xc8aa('0xf')]);module[_0xc8aa('0x10')]=router; \ No newline at end of file +var _0x2a23=['/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','restart','migrations','exports','express','Router','get','index'];(function(_0x1a12c8,_0x2df4dc){var _0x305109=function(_0x438bfb){while(--_0x438bfb){_0x1a12c8['push'](_0x1a12c8['shift']());}};_0x305109(++_0x2df4dc);}(_0x2a23,0x65));var _0x32a2=function(_0x5f58f4,_0x3bea9a){_0x5f58f4=_0x5f58f4-0x0;var _0x4165a3=_0x2a23[_0x5f58f4];return _0x4165a3;};'use strict';var express=require(_0x32a2('0x0'));var router=express[_0x32a2('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0x32a2('0x2')]('/',controller[_0x32a2('0x3')]);router[_0x32a2('0x2')](_0x32a2('0x4'),auth[_0x32a2('0x5')](),auth[_0x32a2('0x6')](),controller[_0x32a2('0x7')]);router['get'](_0x32a2('0x8'),auth[_0x32a2('0x5')](),auth[_0x32a2('0x6')](),controller[_0x32a2('0x9')]);router[_0x32a2('0x2')](_0x32a2('0xa'),auth[_0x32a2('0x5')](),auth['canUpdate'](),controller[_0x32a2('0xb')]);router[_0x32a2('0x2')]('/restart',auth['isAuthenticated'](),controller[_0x32a2('0xc')]);router[_0x32a2('0x2')]('/migrations',controller[_0x32a2('0xd')]);module[_0x32a2('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 d51b81c..7cc1abf 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(_0x363319,_0x4fa1a1){var _0x182a62=function(_0x78f65b){while(--_0x78f65b){_0x363319['push'](_0x363319['shift']());}};_0x182a62(++_0x4fa1a1);}(_0x5324,0x154));var _0x4532=function(_0x2c0071,_0x409f62){_0x2c0071=_0x2c0071-0x0;var _0x634830=_0x5324[_0x2c0071];return _0x634830;};'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 _0x404d=['exports','sort','Migration','sequelize','getQueryInterface','constructor','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','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','simple-git','root','query','latest','fetch','2.0.0','status','json','origin','master','error','info','git\x20fetch','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','.js'];(function(_0x2b75b4,_0x85c44f){var _0x2cf83e=function(_0x512bba){while(--_0x512bba){_0x2b75b4['push'](_0x2b75b4['shift']());}};_0x2cf83e(++_0x85c44f);}(_0x404d,0x1e9));var _0xd404=function(_0x4799bc,_0x494ffd){_0x4799bc=_0x4799bc-0x0;var _0x8f91fc=_0x404d[_0x4799bc];return _0x8f91fc;};'use strict';var Umzug=require(_0xd404('0x0'));var path=require(_0xd404('0x1'));var fs=require('fs');var _=require(_0xd404('0x2'));var pkginfo=require(_0xd404('0x3'))(module,_0xd404('0x4'));var compareVersions=require(_0xd404('0x5'));var exec=require(_0xd404('0x6'))[_0xd404('0x7')];var db=require(_0xd404('0x8'))['db'];var config=require('../../config/environment');var pm2=require(_0xd404('0x9'));var logger=require(_0xd404('0xa'))('update');var git=require(_0xd404('0xb'))(config[_0xd404('0xc')]);exports['index']=function(_0x5c335f,_0x10021a){var _0x3d7e8a={'current':module['exports']['version'],'phonebar':0x2};if(_0x5c335f[_0xd404('0xd')]&&_0x5c335f[_0xd404('0xd')][_0xd404('0xe')]){return git[_0xd404('0xf')]()['tags'](function(_0x4b60f2,_0x3b0ee1){_0x3d7e8a[_0xd404('0xe')]=(_0x4b60f2?module['exports'][_0xd404('0x4')]:_0x3b0ee1[_0xd404('0xe')])||_0xd404('0x10');return _0x10021a[_0xd404('0x11')](0xc8)[_0xd404('0x12')](_0x3d7e8a);});}else{return _0x10021a[_0xd404('0x11')](0xc8)[_0xd404('0x12')](_0x3d7e8a);}};exports[_0xd404('0xf')]=function(_0x1b0dcd,_0x31c8f8){return git[_0xd404('0xf')]([_0xd404('0x13'),_0xd404('0x14')],function(_0x6d79a4){if(_0x6d79a4){logger[_0xd404('0x15')](_0x6d79a4);return _0x31c8f8[_0xd404('0x11')](0x1f4)[_0xd404('0x12')](_0x6d79a4);}logger[_0xd404('0x16')](_0xd404('0x17'));return _0x31c8f8[_0xd404('0x11')](0xc8)[_0xd404('0x12')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0xd404('0x18')]=function(_0x8bdcd1,_0x5e19e4){return git[_0xd404('0x18')]([_0xd404('0x19'),'FETCH_HEAD'],function(_0x209a6b){if(_0x209a6b){logger[_0xd404('0x15')](_0x209a6b);return _0x5e19e4[_0xd404('0x11')](0x1f4)['json'](_0x209a6b);}logger[_0xd404('0x16')](_0xd404('0x1a'));return _0x5e19e4[_0xd404('0x11')](0xc8)[_0xd404('0x12')]({'output':_0xd404('0x1b')});});};exports[_0xd404('0x1c')]=function(_0x458f6e,_0x5c0264){exec(_0xd404('0x1d'),function(_0xcc7bf1,_0x50c0e2,_0x17d0e6){logger['info'](_0x50c0e2);logger['info'](_0x17d0e6);if(_0xcc7bf1){logger[_0xd404('0x15')](_0xcc7bf1);return _0x5c0264[_0xd404('0x11')](0x1f4)[_0xd404('0x12')](_0xcc7bf1);}return _0x5c0264[_0xd404('0x11')](0xc8)['json']({'output':_0x50c0e2});});};exports[_0xd404('0x1e')]=function(_0x2a5d84,_0x13af69){return pm2['restart']('motion2')[_0xd404('0x1f')](function(_0xaccaa8){logger[_0xd404('0x16')](_0xd404('0x20'),_0xaccaa8);return _0x13af69[_0xd404('0x11')](0xc8)[_0xd404('0x12')]({'output':_0xd404('0x21')});})[_0xd404('0x22')](function(_0x586b97){logger['error'](_0x586b97);return _0x13af69[_0xd404('0x11')](0x1f4)['json'](_0x586b97);});};exports[_0xd404('0x23')]=function(_0x4f210c,_0x23525b){var _0x1e6341=fs[_0xd404('0x24')](path[_0xd404('0x25')](config[_0xd404('0xc')],_0xd404('0x26'),_0xd404('0x23')));var _0x4ece21=[];for(var _0x585b67=0x0;_0x585b67<_0x1e6341[_0xd404('0x27')];_0x585b67++){var _0x541c78=_0x1e6341[_0x585b67]['replace'](_0xd404('0x28'),'');if(compareVersions(module[_0xd404('0x29')][_0xd404('0x4')],_0x541c78)===-0x1){_0x4ece21['push'](_0x541c78);}}if(_0x4ece21[_0xd404('0x27')]){var _0x54f0c5=_0x4ece21[_0xd404('0x2a')](compareVersions);var _0x1de7b9=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xd404('0x2b')],'modelName':_0xd404('0x2b'),'columnName':_0xd404('0x4')},'migrations':{'params':[db[_0xd404('0x2c')][_0xd404('0x2d')](),db['sequelize'][_0xd404('0x2e')],function(){throw new Error(_0xd404('0x2f'));}],'path':path[_0xd404('0x25')](config['root'],_0xd404('0x26'),_0xd404('0x23')),'pattern':/\.js$/}});_0x1de7b9['up']({'migrations':_[_0xd404('0x30')](_0x54f0c5,function(_0x296331){return _0x296331+'.js';})})['then'](function(){return _0x23525b[_0xd404('0x11')](0xc8)[_0xd404('0x12')]({'output':_0xd404('0x31')+module[_0xd404('0x29')][_0xd404('0x4')]+_0xd404('0x32')+_['last'](_0x54f0c5),'migrations':_[_0xd404('0x25')](_0x54f0c5)});})[_0xd404('0x22')](function(_0x1f5675){if(_0x1f5675 instanceof db['sequelize'][_0xd404('0x33')]){return _0x23525b[_0xd404('0x11')](0xc8)[_0xd404('0x12')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x23525b[_0xd404('0x11')](0x1f4)[_0xd404('0x12')](_0x1f5675);}});}else{return _0x23525b[_0xd404('0x11')](0xc8)['json']({'output':_0xd404('0x34')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index a8961a3..2b12b85 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 _0x3380=['/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x3380,0x1ac));var _0x0338=function(_0x1758b7,_0xfa5a99){_0x1758b7=_0x1758b7-0x0;var _0x5554a1=_0x3380[_0x1758b7];return _0x5554a1;};'use strict';var multer=require(_0x0338('0x0'));var util=require(_0x0338('0x1'));var path=require(_0x0338('0x2'));var timeout=require(_0x0338('0x3'));var express=require(_0x0338('0x4'));var router=express[_0x0338('0x5')]();var auth=require(_0x0338('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0338('0x7'));var controller=require('./voiceAgentReport.controller');router[_0x0338('0x8')]('/',auth[_0x0338('0x9')](),controller['index']);router[_0x0338('0x8')](_0x0338('0xa'),auth['isAuthenticated'](),controller[_0x0338('0xb')]);router[_0x0338('0x8')](_0x0338('0xc'),auth[_0x0338('0x9')](),controller[_0x0338('0xd')]);router[_0x0338('0xe')]('/',auth[_0x0338('0x9')](),controller['create']);router[_0x0338('0xf')](_0x0338('0xc'),auth[_0x0338('0x9')](),controller[_0x0338('0x10')]);router[_0x0338('0x11')](_0x0338('0xc'),auth[_0x0338('0x9')](),controller[_0x0338('0x12')]);module[_0x0338('0x13')]=router; \ No newline at end of file +var _0x8897=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x8897,0x74));var _0x7889=function(_0x4b458f,_0x1c9b9d){_0x4b458f=_0x4b458f-0x0;var _0x854ebf=_0x8897[_0x4b458f];return _0x854ebf;};'use strict';var multer=require(_0x7889('0x0'));var util=require(_0x7889('0x1'));var path=require(_0x7889('0x2'));var timeout=require('connect-timeout');var express=require(_0x7889('0x3'));var router=express[_0x7889('0x4')]();var auth=require(_0x7889('0x5'));var interaction=require(_0x7889('0x6'));var config=require(_0x7889('0x7'));var controller=require('./voiceAgentReport.controller');router[_0x7889('0x8')]('/',auth[_0x7889('0x9')](),controller[_0x7889('0xa')]);router[_0x7889('0x8')](_0x7889('0xb'),auth[_0x7889('0x9')](),controller[_0x7889('0xc')]);router[_0x7889('0x8')]('/:id',auth[_0x7889('0x9')](),controller[_0x7889('0xd')]);router[_0x7889('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7889('0xf'),auth[_0x7889('0x9')](),controller[_0x7889('0x10')]);router[_0x7889('0x11')](_0x7889('0xf'),auth[_0x7889('0x9')](),controller[_0x7889('0x12')]);module[_0x7889('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 8989cc4..7240ffa 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 _0x3f8a=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x53afe9,_0x2c9f40){var _0x396396=function(_0x1f574d){while(--_0x1f574d){_0x53afe9['push'](_0x53afe9['shift']());}};_0x396396(++_0x2c9f40);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x412525,_0x42d035){_0x412525=_0x412525-0x0;var _0x26461a=_0x3f8a[_0x412525];return _0x26461a;};'use strict';var Sequelize=require(_0xa3f8('0x0'));module[_0xa3f8('0x1')]={'type':{'type':Sequelize[_0xa3f8('0x2')]},'uniqueid':{'type':Sequelize[_0xa3f8('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xa3f8('0x2')]},'queue':{'type':Sequelize[_0xa3f8('0x2')]},'interface':{'type':Sequelize[_0xa3f8('0x2')]},'membername':{'type':Sequelize[_0xa3f8('0x2')]},'agentcalledAt':{'type':Sequelize[_0xa3f8('0x3')]},'agentconnectAt':{'type':Sequelize[_0xa3f8('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xa3f8('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xa3f8('0x3')]},'agentdumpAt':{'type':Sequelize[_0xa3f8('0x3')]},'holdtime':{'type':Sequelize[_0xa3f8('0x4')]},'agentcomplete':{'type':Sequelize[_0xa3f8('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xa3f8('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xa3f8('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xa3f8('0x4')]},'agentacw':{'type':Sequelize[_0xa3f8('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xa3f8('0x4')]},'reason':{'type':Sequelize[_0xa3f8('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa3f8('0x2')]},'channelstate':{'type':Sequelize[_0xa3f8('0x4')]},'channelstatedesc':{'type':Sequelize[_0xa3f8('0x2')]},'connectedlinenum':{'type':Sequelize[_0xa3f8('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa3f8('0x2')]},'accountcode':{'type':Sequelize[_0xa3f8('0x2')]},'context':{'type':Sequelize[_0xa3f8('0x2')]},'exten':{'type':Sequelize[_0xa3f8('0x2')]},'priority':{'type':Sequelize[_0xa3f8('0x2')]},'destchannel':{'type':Sequelize[_0xa3f8('0x2')]},'destchannelstate':{'type':Sequelize[_0xa3f8('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xa3f8('0x2')]},'destcalleridnum':{'type':Sequelize[_0xa3f8('0x2')]},'destcalleridname':{'type':Sequelize[_0xa3f8('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xa3f8('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xa3f8('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xa3f8('0x2')]},'destcontext':{'type':Sequelize[_0xa3f8('0x2')]},'destexten':{'type':Sequelize[_0xa3f8('0x2')]},'destpriority':{'type':Sequelize[_0xa3f8('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xa3f8('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xa3f8('0x2')]},'transfer':{'type':Sequelize[_0xa3f8('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa3f8('0x2')],'comment':_0xa3f8('0x6')},'transferexten':{'type':Sequelize[_0xa3f8('0x2')]},'transferuniqueid':{'type':Sequelize[_0xa3f8('0x2')]},'agententerreason':{'type':Sequelize[_0xa3f8('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6f47=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x5ce5a5,_0x260eca){var _0x22f043=function(_0x5563a0){while(--_0x5563a0){_0x5ce5a5['push'](_0x5ce5a5['shift']());}};_0x22f043(++_0x260eca);}(_0x6f47,0xc7));var _0x76f4=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6f47[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'type':{'type':Sequelize[_0x76f4('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x76f4('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x76f4('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x76f4('0x1')]},'agentcalledAt':{'type':Sequelize[_0x76f4('0x2')]},'agentconnectAt':{'type':Sequelize[_0x76f4('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x76f4('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x76f4('0x2')]},'holdtime':{'type':Sequelize[_0x76f4('0x3')]},'agentcomplete':{'type':Sequelize[_0x76f4('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x76f4('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x76f4('0x3')]},'agentacw':{'type':Sequelize[_0x76f4('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x76f4('0x3')]},'reason':{'type':Sequelize[_0x76f4('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x76f4('0x3')]},'channelstatedesc':{'type':Sequelize[_0x76f4('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x76f4('0x1')]},'accountcode':{'type':Sequelize[_0x76f4('0x1')]},'context':{'type':Sequelize[_0x76f4('0x1')]},'exten':{'type':Sequelize[_0x76f4('0x1')]},'priority':{'type':Sequelize[_0x76f4('0x1')]},'destchannel':{'type':Sequelize[_0x76f4('0x1')]},'destchannelstate':{'type':Sequelize[_0x76f4('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x76f4('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76f4('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76f4('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76f4('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x76f4('0x1')]},'destpriority':{'type':Sequelize[_0x76f4('0x1')]},'destuniqueid':{'type':Sequelize[_0x76f4('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x76f4('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x76f4('0x1')]},'transfer':{'type':Sequelize[_0x76f4('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x76f4('0x1')],'comment':_0x76f4('0x5')},'transferexten':{'type':Sequelize[_0x76f4('0x1')]},'transferuniqueid':{'type':Sequelize[_0x76f4('0x1')]},'agententerreason':{'type':Sequelize[_0x76f4('0x3')],'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 0005d4d..55edbcc 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 _0x55f8=['../../config/environment','../../mysqldb','sendStatus','status','json','limit','set','apply','reject','save','destroy','then','end','error','name','send','index','map','type','key','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','VoiceAgentReport','findAll','catch','params','keys','rawAttributes','length','includeAll','find','body','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5cbdd8,_0x4f6a8a){var _0x44dd84=function(_0x2db557){while(--_0x2db557){_0x5cbdd8['push'](_0x5cbdd8['shift']());}};_0x44dd84(++_0x4f6a8a);}(_0x55f8,0x1ed));var _0x855f=function(_0x29c327,_0x48227c){_0x29c327=_0x29c327-0x0;var _0x436b3e=_0x55f8[_0x29c327];return _0x436b3e;};'use strict';var pdf=require(_0x855f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x855f('0x1'));var zipdir=require(_0x855f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x855f('0x3'));var moment=require(_0x855f('0x4'));var BPromise=require(_0x855f('0x5'));var Mustache=require(_0x855f('0x6'));var util=require(_0x855f('0x7'));var path=require(_0x855f('0x8'));var sox=require(_0x855f('0x9'));var csv=require(_0x855f('0xa'));var ejs=require(_0x855f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x855f('0xc'));var jsforce=require(_0x855f('0xd'));var deskjs=require(_0x855f('0xe'));var toCsv=require(_0x855f('0xa'));var querystring=require(_0x855f('0xf'));var Papa=require(_0x855f('0x10'));var Redis=require(_0x855f('0x11'));var authService=require(_0x855f('0x12'));var qs=require(_0x855f('0x13'));var as=require(_0x855f('0x14'));var hardwareService=require(_0x855f('0x15'));var logger=require(_0x855f('0x16'))(_0x855f('0x17'));var utils=require(_0x855f('0x18'));var config=require(_0x855f('0x19'));var db=require(_0x855f('0x1a'))['db'];function respondWithStatusCode(_0x4c4586,_0x3dc7d3){_0x3dc7d3=_0x3dc7d3||0xcc;return function(_0x2d52e6){if(_0x2d52e6){return _0x4c4586[_0x855f('0x1b')](_0x3dc7d3);}return _0x4c4586[_0x855f('0x1c')](_0x3dc7d3)['end']();};}function respondWithResult(_0x2757dd,_0x2edaaf){_0x2edaaf=_0x2edaaf||0xc8;return function(_0x2b669c){if(_0x2b669c){return _0x2757dd[_0x855f('0x1c')](_0x2edaaf)[_0x855f('0x1d')](_0x2b669c);}};}function respondWithFilteredResult(_0x6d6ce9,_0x1a6877){return function(_0x20cfa9){if(_0x20cfa9){var _0x185102=_0x20cfa9['count'],_0x4869d6=_0x1a6877['offset'],_0x1940cc=_0x1a6877['offset']+_0x1a6877[_0x855f('0x1e')],_0xecbec8;if(_0x1940cc>=_0x185102){_0x1940cc=_0x185102;_0xecbec8=0xc8;}else{_0xecbec8=0xce;}_0x6d6ce9[_0x855f('0x1c')](_0xecbec8);return _0x6d6ce9[_0x855f('0x1f')]('Content-Range',_0x4869d6+'-'+_0x1940cc+'/'+_0x185102)[_0x855f('0x1d')](_0x20cfa9);}return null;};}function patchUpdates(_0x1d70b4){return function(_0x30d18c){try{jsonpatch[_0x855f('0x20')](_0x30d18c,_0x1d70b4,!![]);}catch(_0x5b3193){return BPromise[_0x855f('0x21')](_0x5b3193);}return _0x30d18c[_0x855f('0x22')]();};}function saveUpdates(_0x184e70,_0x4a606c){return function(_0x55af05){if(_0x55af05){return _0x55af05['update'](_0x184e70)['then'](function(_0x53ead4){return _0x53ead4;});}return null;};}function removeEntity(_0x5df491,_0x2aa9e5){return function(_0x4f6d30){if(_0x4f6d30){return _0x4f6d30[_0x855f('0x23')]()[_0x855f('0x24')](function(){_0x5df491[_0x855f('0x1c')](0xcc)[_0x855f('0x25')]();});}};}function handleEntityNotFound(_0x3a7acb,_0x201ea5){return function(_0x3c3231){if(!_0x3c3231){_0x3a7acb[_0x855f('0x1b')](0x194);}return _0x3c3231;};}function handleError(_0x16b55d,_0x3f67b8){_0x3f67b8=_0x3f67b8||0x1f4;return function(_0x4a0a39){logger[_0x855f('0x26')](_0x4a0a39['stack']);if(_0x4a0a39[_0x855f('0x27')]){delete _0x4a0a39[_0x855f('0x27')];}_0x16b55d[_0x855f('0x1c')](_0x3f67b8)[_0x855f('0x28')](_0x4a0a39);};}exports[_0x855f('0x29')]=function(_0xd7eda5,_0x54d800){var _0x596cb2={},_0x5aa213={},_0x568ba1={'count':0x0,'rows':[]};var _0x1919de=_[_0x855f('0x2a')](db['VoiceAgentReport']['rawAttributes'],function(_0xac1e4b){return{'name':_0xac1e4b['fieldName'],'type':_0xac1e4b[_0x855f('0x2b')][_0x855f('0x2c')]};});_0x5aa213['model']=_[_0x855f('0x2a')](_0x1919de,'name');_0x5aa213[_0x855f('0x2d')]=_['keys'](_0xd7eda5[_0x855f('0x2d')]);_0x5aa213['filters']=_[_0x855f('0x2e')](_0x5aa213[_0x855f('0x2f')],_0x5aa213[_0x855f('0x2d')]);_0x596cb2[_0x855f('0x30')]=_[_0x855f('0x2e')](_0x5aa213['model'],qs[_0x855f('0x31')](_0xd7eda5[_0x855f('0x2d')][_0x855f('0x31')]));_0x596cb2['attributes']=_0x596cb2[_0x855f('0x30')]['length']?_0x596cb2[_0x855f('0x30')]:_0x5aa213[_0x855f('0x2f')];if(!_0xd7eda5[_0x855f('0x2d')][_0x855f('0x32')](_0x855f('0x33'))){_0x596cb2[_0x855f('0x1e')]=qs[_0x855f('0x1e')](_0xd7eda5['query']['limit']);_0x596cb2[_0x855f('0x34')]=qs[_0x855f('0x34')](_0xd7eda5[_0x855f('0x2d')][_0x855f('0x34')]);}_0x596cb2[_0x855f('0x35')]=qs['sort'](_0xd7eda5[_0x855f('0x2d')][_0x855f('0x36')]);_0x596cb2[_0x855f('0x37')]=qs[_0x855f('0x38')](_[_0x855f('0x39')](_0xd7eda5['query'],_0x5aa213[_0x855f('0x38')]));if(_0xd7eda5[_0x855f('0x2d')]['filter']){_0x596cb2['where']=_[_0x855f('0x3a')](_0x596cb2[_0x855f('0x37')],{'$or':_[_0x855f('0x2a')](_0x1919de,function(_0x3b92b9){if(_0x3b92b9[_0x855f('0x2b')]!==_0x855f('0x3b')){var _0x521a69={};_0x521a69[_0x3b92b9[_0x855f('0x27')]]={'$like':'%'+_0xd7eda5['query'][_0x855f('0x3c')]+'%'};return _0x521a69;}})});}_0x596cb2=_['merge']({},_0x596cb2,_0xd7eda5[_0x855f('0x3d')]);var _0x48b3af={'where':_0x596cb2[_0x855f('0x37')]};return db['VoiceAgentReport']['count'](_0x48b3af)[_0x855f('0x24')](function(_0x2e5310){_0x568ba1['count']=_0x2e5310;if(_0xd7eda5[_0x855f('0x2d')]['includeAll']){_0x596cb2[_0x855f('0x3e')]=[{'all':!![]}];}return db[_0x855f('0x3f')][_0x855f('0x40')](_0x596cb2);})[_0x855f('0x24')](function(_0x189b6f){_0x568ba1['rows']=_0x189b6f;return _0x568ba1;})['then'](respondWithFilteredResult(_0x54d800,_0x596cb2))[_0x855f('0x41')](handleError(_0x54d800,null));};exports['show']=function(_0xddc404,_0x4d3ab0){var _0x2bef38={'raw':![],'where':{'id':_0xddc404[_0x855f('0x42')]['id']}},_0x1928cf={};_0x1928cf[_0x855f('0x2f')]=_[_0x855f('0x43')](db[_0x855f('0x3f')][_0x855f('0x44')]);_0x1928cf[_0x855f('0x2d')]=_[_0x855f('0x43')](_0xddc404[_0x855f('0x2d')]);_0x1928cf['filters']=_['intersection'](_0x1928cf[_0x855f('0x2f')],_0x1928cf[_0x855f('0x2d')]);_0x2bef38[_0x855f('0x30')]=_[_0x855f('0x2e')](_0x1928cf['model'],qs[_0x855f('0x31')](_0xddc404[_0x855f('0x2d')]['fields']));_0x2bef38[_0x855f('0x30')]=_0x2bef38['attributes'][_0x855f('0x45')]?_0x2bef38[_0x855f('0x30')]:_0x1928cf[_0x855f('0x2f')];if(_0xddc404['query'][_0x855f('0x46')]){_0x2bef38['include']=[{'all':!![]}];}_0x2bef38=_[_0x855f('0x3a')]({},_0x2bef38,_0xddc404[_0x855f('0x3d')]);return db[_0x855f('0x3f')][_0x855f('0x47')](_0x2bef38)[_0x855f('0x24')](handleEntityNotFound(_0x4d3ab0,null))[_0x855f('0x24')](respondWithResult(_0x4d3ab0,null))[_0x855f('0x41')](handleError(_0x4d3ab0,null));};exports['create']=function(_0xb8828c,_0x2586a2){return db[_0x855f('0x3f')]['create'](_0xb8828c[_0x855f('0x48')],{})[_0x855f('0x24')](respondWithResult(_0x2586a2,0xc9))[_0x855f('0x41')](handleError(_0x2586a2,null));};exports['update']=function(_0x4006b2,_0xe34844){if(_0x4006b2['body']['id']){delete _0x4006b2[_0x855f('0x48')]['id'];}return db[_0x855f('0x3f')][_0x855f('0x47')]({'where':{'id':_0x4006b2[_0x855f('0x42')]['id']}})['then'](handleEntityNotFound(_0xe34844,null))[_0x855f('0x24')](saveUpdates(_0x4006b2[_0x855f('0x48')],null))[_0x855f('0x24')](respondWithResult(_0xe34844,null))[_0x855f('0x41')](handleError(_0xe34844,null));};exports[_0x855f('0x23')]=function(_0x39ee83,_0x9a3f24){return db[_0x855f('0x3f')][_0x855f('0x47')]({'where':{'id':_0x39ee83[_0x855f('0x42')]['id']}})[_0x855f('0x24')](handleEntityNotFound(_0x9a3f24,null))['then'](removeEntity(_0x9a3f24,null))[_0x855f('0x41')](handleError(_0x9a3f24,null));};exports[_0x855f('0x49')]=function(_0x34b4ac,_0x7fc3d3){return db[_0x855f('0x3f')]['describe']()[_0x855f('0x24')](respondWithResult(_0x7fc3d3,null))[_0x855f('0x41')](handleError(_0x7fc3d3,null));}; \ No newline at end of file +var _0x9b70=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','VoiceAgentReport','fieldName','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','rawAttributes','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x5b9e59,_0x56a31b){var _0x300560=function(_0x1b5b43){while(--_0x1b5b43){_0x5b9e59['push'](_0x5b9e59['shift']());}};_0x300560(++_0x56a31b);}(_0x9b70,0xc8));var _0x09b7=function(_0x18b344,_0x271f68){_0x18b344=_0x18b344-0x0;var _0x5ef6bb=_0x9b70[_0x18b344];return _0x5ef6bb;};'use strict';var pdf=require(_0x09b7('0x0'));var emlformat=require(_0x09b7('0x1'));var rimraf=require(_0x09b7('0x2'));var zipdir=require(_0x09b7('0x3'));var jsonpatch=require(_0x09b7('0x4'));var rp=require(_0x09b7('0x5'));var moment=require(_0x09b7('0x6'));var BPromise=require(_0x09b7('0x7'));var Mustache=require('mustache');var util=require(_0x09b7('0x8'));var path=require(_0x09b7('0x9'));var sox=require(_0x09b7('0xa'));var csv=require(_0x09b7('0xb'));var ejs=require(_0x09b7('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x09b7('0xd'));var jsforce=require(_0x09b7('0xe'));var deskjs=require(_0x09b7('0xf'));var toCsv=require(_0x09b7('0xb'));var querystring=require(_0x09b7('0x10'));var Papa=require(_0x09b7('0x11'));var Redis=require(_0x09b7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x09b7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09b7('0x14'));var logger=require(_0x09b7('0x15'))(_0x09b7('0x16'));var utils=require(_0x09b7('0x17'));var config=require(_0x09b7('0x18'));var db=require(_0x09b7('0x19'))['db'];function respondWithStatusCode(_0x4b5e0e,_0x472d3d){_0x472d3d=_0x472d3d||0xcc;return function(_0x508d18){if(_0x508d18){return _0x4b5e0e[_0x09b7('0x1a')](_0x472d3d);}return _0x4b5e0e[_0x09b7('0x1b')](_0x472d3d)[_0x09b7('0x1c')]();};}function respondWithResult(_0x193fb5,_0x2e962e){_0x2e962e=_0x2e962e||0xc8;return function(_0x4785c4){if(_0x4785c4){return _0x193fb5['status'](_0x2e962e)['json'](_0x4785c4);}};}function respondWithFilteredResult(_0x362f9e,_0x2cd81c){return function(_0x3d64a6){if(_0x3d64a6){var _0x305e57=_0x3d64a6[_0x09b7('0x1d')],_0xa0a930=_0x2cd81c[_0x09b7('0x1e')],_0x3850a9=_0x2cd81c[_0x09b7('0x1e')]+_0x2cd81c[_0x09b7('0x1f')],_0x2959db;if(_0x3850a9>=_0x305e57){_0x3850a9=_0x305e57;_0x2959db=0xc8;}else{_0x2959db=0xce;}_0x362f9e[_0x09b7('0x1b')](_0x2959db);return _0x362f9e[_0x09b7('0x20')](_0x09b7('0x21'),_0xa0a930+'-'+_0x3850a9+'/'+_0x305e57)[_0x09b7('0x22')](_0x3d64a6);}return null;};}function patchUpdates(_0x4597f7){return function(_0x5da7db){try{jsonpatch[_0x09b7('0x23')](_0x5da7db,_0x4597f7,!![]);}catch(_0x56aae5){return BPromise[_0x09b7('0x24')](_0x56aae5);}return _0x5da7db['save']();};}function saveUpdates(_0xa39d83,_0x48841b){return function(_0x51f39f){if(_0x51f39f){return _0x51f39f[_0x09b7('0x25')](_0xa39d83)[_0x09b7('0x26')](function(_0x9add1f){return _0x9add1f;});}return null;};}function removeEntity(_0x21305a,_0x5348dc){return function(_0x2f084e){if(_0x2f084e){return _0x2f084e[_0x09b7('0x27')]()[_0x09b7('0x26')](function(){_0x21305a['status'](0xcc)[_0x09b7('0x1c')]();});}};}function handleEntityNotFound(_0x298adb,_0x29212a){return function(_0x181cc2){if(!_0x181cc2){_0x298adb[_0x09b7('0x1a')](0x194);}return _0x181cc2;};}function handleError(_0x1d8ab9,_0x5ca602){_0x5ca602=_0x5ca602||0x1f4;return function(_0x1ac825){logger[_0x09b7('0x28')](_0x1ac825[_0x09b7('0x29')]);if(_0x1ac825[_0x09b7('0x2a')]){delete _0x1ac825[_0x09b7('0x2a')];}_0x1d8ab9['status'](_0x5ca602)['send'](_0x1ac825);};}exports[_0x09b7('0x2b')]=function(_0x6041a3,_0x1c3b93){var _0x580101={},_0x2ff96b={},_0x182bd4={'count':0x0,'rows':[]};var _0x1dc2ff=_[_0x09b7('0x2c')](db[_0x09b7('0x2d')]['rawAttributes'],function(_0x17449c){return{'name':_0x17449c[_0x09b7('0x2e')],'type':_0x17449c[_0x09b7('0x2f')][_0x09b7('0x30')]};});_0x2ff96b['model']=_['map'](_0x1dc2ff,'name');_0x2ff96b[_0x09b7('0x31')]=_[_0x09b7('0x32')](_0x6041a3[_0x09b7('0x31')]);_0x2ff96b[_0x09b7('0x33')]=_[_0x09b7('0x34')](_0x2ff96b['model'],_0x2ff96b[_0x09b7('0x31')]);_0x580101[_0x09b7('0x35')]=_[_0x09b7('0x34')](_0x2ff96b['model'],qs[_0x09b7('0x36')](_0x6041a3[_0x09b7('0x31')]['fields']));_0x580101[_0x09b7('0x35')]=_0x580101[_0x09b7('0x35')][_0x09b7('0x37')]?_0x580101[_0x09b7('0x35')]:_0x2ff96b[_0x09b7('0x38')];if(!_0x6041a3[_0x09b7('0x31')][_0x09b7('0x39')]('nolimit')){_0x580101['limit']=qs['limit'](_0x6041a3['query'][_0x09b7('0x1f')]);_0x580101[_0x09b7('0x1e')]=qs[_0x09b7('0x1e')](_0x6041a3[_0x09b7('0x31')][_0x09b7('0x1e')]);}_0x580101['order']=qs[_0x09b7('0x3a')](_0x6041a3['query'][_0x09b7('0x3a')]);_0x580101[_0x09b7('0x3b')]=qs[_0x09b7('0x33')](_[_0x09b7('0x3c')](_0x6041a3[_0x09b7('0x31')],_0x2ff96b[_0x09b7('0x33')]));if(_0x6041a3[_0x09b7('0x31')][_0x09b7('0x3d')]){_0x580101['where']=_[_0x09b7('0x3e')](_0x580101[_0x09b7('0x3b')],{'$or':_[_0x09b7('0x2c')](_0x1dc2ff,function(_0x304a2d){if(_0x304a2d[_0x09b7('0x2f')]!==_0x09b7('0x3f')){var _0x477d2d={};_0x477d2d[_0x304a2d['name']]={'$like':'%'+_0x6041a3['query'][_0x09b7('0x3d')]+'%'};return _0x477d2d;}})});}_0x580101=_[_0x09b7('0x3e')]({},_0x580101,_0x6041a3[_0x09b7('0x40')]);var _0x41ccfd={'where':_0x580101[_0x09b7('0x3b')]};return db[_0x09b7('0x2d')][_0x09b7('0x1d')](_0x41ccfd)[_0x09b7('0x26')](function(_0x3c4bc0){_0x182bd4[_0x09b7('0x1d')]=_0x3c4bc0;if(_0x6041a3['query'][_0x09b7('0x41')]){_0x580101[_0x09b7('0x42')]=[{'all':!![]}];}return db[_0x09b7('0x2d')][_0x09b7('0x43')](_0x580101);})[_0x09b7('0x26')](function(_0x33f549){_0x182bd4['rows']=_0x33f549;return _0x182bd4;})[_0x09b7('0x26')](respondWithFilteredResult(_0x1c3b93,_0x580101))['catch'](handleError(_0x1c3b93,null));};exports['show']=function(_0x3136e3,_0x36b76f){var _0x40ecd7={'raw':![],'where':{'id':_0x3136e3[_0x09b7('0x44')]['id']}},_0x5882ab={};_0x5882ab[_0x09b7('0x38')]=_[_0x09b7('0x32')](db[_0x09b7('0x2d')][_0x09b7('0x45')]);_0x5882ab[_0x09b7('0x31')]=_[_0x09b7('0x32')](_0x3136e3['query']);_0x5882ab[_0x09b7('0x33')]=_[_0x09b7('0x34')](_0x5882ab[_0x09b7('0x38')],_0x5882ab[_0x09b7('0x31')]);_0x40ecd7[_0x09b7('0x35')]=_[_0x09b7('0x34')](_0x5882ab[_0x09b7('0x38')],qs['fields'](_0x3136e3[_0x09b7('0x31')][_0x09b7('0x36')]));_0x40ecd7[_0x09b7('0x35')]=_0x40ecd7['attributes'][_0x09b7('0x37')]?_0x40ecd7['attributes']:_0x5882ab[_0x09b7('0x38')];if(_0x3136e3[_0x09b7('0x31')][_0x09b7('0x41')]){_0x40ecd7[_0x09b7('0x42')]=[{'all':!![]}];}_0x40ecd7=_[_0x09b7('0x3e')]({},_0x40ecd7,_0x3136e3[_0x09b7('0x40')]);return db['VoiceAgentReport'][_0x09b7('0x46')](_0x40ecd7)[_0x09b7('0x26')](handleEntityNotFound(_0x36b76f,null))[_0x09b7('0x26')](respondWithResult(_0x36b76f,null))[_0x09b7('0x47')](handleError(_0x36b76f,null));};exports[_0x09b7('0x48')]=function(_0x11613d,_0x13dd20){return db[_0x09b7('0x2d')]['create'](_0x11613d[_0x09b7('0x49')],{})[_0x09b7('0x26')](respondWithResult(_0x13dd20,0xc9))[_0x09b7('0x47')](handleError(_0x13dd20,null));};exports['update']=function(_0x590aa2,_0x252e42){if(_0x590aa2[_0x09b7('0x49')]['id']){delete _0x590aa2[_0x09b7('0x49')]['id'];}return db[_0x09b7('0x2d')][_0x09b7('0x46')]({'where':{'id':_0x590aa2[_0x09b7('0x44')]['id']}})[_0x09b7('0x26')](handleEntityNotFound(_0x252e42,null))['then'](saveUpdates(_0x590aa2[_0x09b7('0x49')],null))[_0x09b7('0x26')](respondWithResult(_0x252e42,null))[_0x09b7('0x47')](handleError(_0x252e42,null));};exports['destroy']=function(_0x3e3688,_0xf0a577){return db[_0x09b7('0x2d')][_0x09b7('0x46')]({'where':{'id':_0x3e3688[_0x09b7('0x44')]['id']}})[_0x09b7('0x26')](handleEntityNotFound(_0xf0a577,null))[_0x09b7('0x26')](removeEntity(_0xf0a577,null))[_0x09b7('0x47')](handleError(_0xf0a577,null));};exports['describe']=function(_0x6f1061,_0x16fbe6){return db[_0x09b7('0x2d')]['describe']()[_0x09b7('0x26')](respondWithResult(_0x16fbe6,null))['catch'](handleError(_0x16fbe6,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index be37b9f..b8570c3 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 _0x79f1=['bluebird','request-promise','path','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api'];(function(_0x398ee9,_0x24938e){var _0x52178c=function(_0x45e741){while(--_0x45e741){_0x398ee9['push'](_0x398ee9['shift']());}};_0x52178c(++_0x24938e);}(_0x79f1,0xea));var _0x179f=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x79f1[_0x12a2a6];return _0x1754ae;};'use strict';var _=require(_0x179f('0x0'));var util=require(_0x179f('0x1'));var logger=require(_0x179f('0x2'))(_0x179f('0x3'));var moment=require('moment');var BPromise=require(_0x179f('0x4'));var rp=require(_0x179f('0x5'));var fs=require('fs');var path=require(_0x179f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x179f('0x7'));module[_0x179f('0x8')]=function(_0x265d64,_0x13d49d){return _0x265d64[_0x179f('0x9')](_0x179f('0xa'),attributes,{'tableName':_0x179f('0xb'),'paranoid':![],'indexes':[{'fields':[_0x179f('0xc'),_0x179f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf576=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','VoiceAgentReport','report_agent','uniqueid','lodash'];(function(_0x420cf1,_0x592d5c){var _0x35ae3d=function(_0x256b02){while(--_0x256b02){_0x420cf1['push'](_0x420cf1['shift']());}};_0x35ae3d(++_0x592d5c);}(_0xf576,0xef));var _0x6f57=function(_0x2d956e,_0x37b857){_0x2d956e=_0x2d956e-0x0;var _0x5da717=_0xf576[_0x2d956e];return _0x5da717;};'use strict';var _=require(_0x6f57('0x0'));var util=require(_0x6f57('0x1'));var logger=require(_0x6f57('0x2'))(_0x6f57('0x3'));var moment=require(_0x6f57('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f57('0x5'));var rimraf=require(_0x6f57('0x6'));var config=require(_0x6f57('0x7'));var attributes=require('./voiceAgentReport.attributes');module[_0x6f57('0x8')]=function(_0x455a27,_0x50edc1){return _0x455a27['define'](_0x6f57('0x9'),attributes,{'tableName':_0x6f57('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6f57('0xb'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 7b53be4..3fb5a42 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 _0xe0ab=['UpdateVoiceAgentReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceAgentReport,\x20%s,\x20%s','message','request\x20sent','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw'];(function(_0x2ee7cc,_0x4f0ef1){var _0x3488b7=function(_0x20fb82){while(--_0x20fb82){_0x2ee7cc['push'](_0x2ee7cc['shift']());}};_0x3488b7(++_0x4f0ef1);}(_0xe0ab,0x1d3));var _0xbe0a=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xe0ab[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0xbe0a('0x0'));var util=require(_0xbe0a('0x1'));var moment=require(_0xbe0a('0x2'));var BPromise=require(_0xbe0a('0x3'));var rs=require(_0xbe0a('0x4'));var fs=require('fs');var Redis=require(_0xbe0a('0x5'));var db=require(_0xbe0a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe0a('0x7'))(_0xbe0a('0x8'));var config=require(_0xbe0a('0x9'));var jayson=require(_0xbe0a('0xa'));var client=jayson[_0xbe0a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20f9c7,_0x4b9857,_0x356fad){return new BPromise(function(_0x3a5a6b,_0x2023c5){return client[_0xbe0a('0xc')](_0x20f9c7,_0x356fad)[_0xbe0a('0xd')](function(_0x16f99e){logger[_0xbe0a('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x4b9857,'request\x20sent');logger[_0xbe0a('0xf')](_0xbe0a('0x10'),_0x4b9857,'request\x20sent',JSON[_0xbe0a('0x11')](_0x16f99e));if(_0x16f99e['error']){if(_0x16f99e['error']['code']===0x1f4){logger[_0xbe0a('0x12')](_0xbe0a('0x13'),_0x4b9857,_0x16f99e[_0xbe0a('0x12')][_0xbe0a('0x14')]);return _0x2023c5(_0x16f99e[_0xbe0a('0x12')][_0xbe0a('0x14')]);}logger[_0xbe0a('0x12')](_0xbe0a('0x13'),_0x4b9857,_0x16f99e[_0xbe0a('0x12')][_0xbe0a('0x14')]);return _0x3a5a6b(_0x16f99e[_0xbe0a('0x12')][_0xbe0a('0x14')]);}else{logger[_0xbe0a('0xe')](_0xbe0a('0x13'),_0x4b9857,_0xbe0a('0x15'));_0x3a5a6b(_0x16f99e['result'][_0xbe0a('0x14')]);}})[_0xbe0a('0x16')](function(_0x120c74){logger[_0xbe0a('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x4b9857,_0x120c74);_0x2023c5(_0x120c74);});});}exports[_0xbe0a('0x17')]=function(_0x20e6d7){var _0x4eea3c=this;return new Promise(function(_0xd61061,_0x5a36bd){return db[_0xbe0a('0x18')][_0xbe0a('0x19')](_0x20e6d7['body'],{'raw':_0x20e6d7[_0xbe0a('0x1a')]?_0x20e6d7[_0xbe0a('0x1a')][_0xbe0a('0x1b')]===undefined?!![]:![]:!![]})[_0xbe0a('0xd')](function(_0x2ef0c0){logger[_0xbe0a('0xe')](_0xbe0a('0x17'),_0x20e6d7);logger[_0xbe0a('0xf')]('CreateVoiceAgentReport',_0x20e6d7,JSON[_0xbe0a('0x11')](_0x2ef0c0));_0xd61061(_0x2ef0c0);})[_0xbe0a('0x16')](function(_0x2b69a0){logger[_0xbe0a('0x12')](_0xbe0a('0x17'),_0x2b69a0['message'],_0x20e6d7);_0x5a36bd(_0x4eea3c[_0xbe0a('0x12')](0x1f4,_0x2b69a0[_0xbe0a('0x14')]));});});};exports[_0xbe0a('0x1c')]=function(_0x37c6ee){var _0x27909d=this;return new Promise(function(_0x58b23d,_0x2f1116){return db[_0xbe0a('0x18')][_0xbe0a('0x1d')](_0x37c6ee['body'],{'raw':_0x37c6ee['options']?_0x37c6ee[_0xbe0a('0x1a')][_0xbe0a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x37c6ee[_0xbe0a('0x1a')]?_0x37c6ee['options'][_0xbe0a('0x1e')]||null:null,'attributes':_0x37c6ee[_0xbe0a('0x1a')]?_0x37c6ee[_0xbe0a('0x1a')][_0xbe0a('0x1f')]||null:null,'limit':_0x37c6ee[_0xbe0a('0x1a')]?_0x37c6ee[_0xbe0a('0x1a')][_0xbe0a('0x20')]||null:null})['then'](function(_0x3b2fca){logger['info'](_0xbe0a('0x1c'),_0x37c6ee);logger[_0xbe0a('0xf')](_0xbe0a('0x1c'),_0x37c6ee,JSON[_0xbe0a('0x11')](_0x3b2fca));_0x58b23d(_0x3b2fca);})[_0xbe0a('0x16')](function(_0x1ecd12){logger['error']('UpdateVoiceAgentReport',_0x1ecd12[_0xbe0a('0x14')],_0x37c6ee);_0x2f1116(_0x27909d[_0xbe0a('0x12')](0x1f4,_0x1ecd12[_0xbe0a('0x14')]));});});}; \ No newline at end of file +var _0xa091=['result','CreateVoiceAgentReport','body','options','raw','stringify','UpdateVoiceAgentReport','VoiceAgentReport','update','where','limit','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x36b0f8,_0x4adf3f){var _0x215735=function(_0x23a69c){while(--_0x23a69c){_0x36b0f8['push'](_0x36b0f8['shift']());}};_0x215735(++_0x4adf3f);}(_0xa091,0x11a));var _0x1a09=function(_0x1e644b,_0x2c32f0){_0x1e644b=_0x1e644b-0x0;var _0x23207b=_0xa091[_0x1e644b];return _0x23207b;};'use strict';var _=require(_0x1a09('0x0'));var util=require(_0x1a09('0x1'));var moment=require(_0x1a09('0x2'));var BPromise=require(_0x1a09('0x3'));var rs=require(_0x1a09('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a09('0x5'))['db'];var utils=require(_0x1a09('0x6'));var logger=require('../../config/logger')(_0x1a09('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1a09('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26ab34,_0x24749f,_0x185054){return new BPromise(function(_0xe8fa68,_0x3b8ac9){return client[_0x1a09('0x9')](_0x26ab34,_0x185054)[_0x1a09('0xa')](function(_0x35fc20){logger[_0x1a09('0xb')](_0x1a09('0xc'),_0x24749f,_0x1a09('0xd'));logger[_0x1a09('0xe')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x24749f,_0x1a09('0xd'),JSON['stringify'](_0x35fc20));if(_0x35fc20[_0x1a09('0xf')]){if(_0x35fc20[_0x1a09('0xf')][_0x1a09('0x10')]===0x1f4){logger['error'](_0x1a09('0xc'),_0x24749f,_0x35fc20[_0x1a09('0xf')][_0x1a09('0x11')]);return _0x3b8ac9(_0x35fc20[_0x1a09('0xf')]['message']);}logger[_0x1a09('0xf')](_0x1a09('0xc'),_0x24749f,_0x35fc20[_0x1a09('0xf')]['message']);return _0xe8fa68(_0x35fc20[_0x1a09('0xf')][_0x1a09('0x11')]);}else{logger[_0x1a09('0xb')](_0x1a09('0xc'),_0x24749f,_0x1a09('0xd'));_0xe8fa68(_0x35fc20[_0x1a09('0x12')]['message']);}})['catch'](function(_0x28f748){logger[_0x1a09('0xf')](_0x1a09('0xc'),_0x24749f,_0x28f748);_0x3b8ac9(_0x28f748);});});}exports[_0x1a09('0x13')]=function(_0x424c21){var _0x3e93a8=this;return new Promise(function(_0x27b09e,_0x23f1a8){return db['VoiceAgentReport']['create'](_0x424c21[_0x1a09('0x14')],{'raw':_0x424c21[_0x1a09('0x15')]?_0x424c21['options'][_0x1a09('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x12c8be){logger['info'](_0x1a09('0x13'),_0x424c21);logger['debug']('CreateVoiceAgentReport',_0x424c21,JSON[_0x1a09('0x17')](_0x12c8be));_0x27b09e(_0x12c8be);})['catch'](function(_0x530c72){logger[_0x1a09('0xf')](_0x1a09('0x13'),_0x530c72[_0x1a09('0x11')],_0x424c21);_0x23f1a8(_0x3e93a8[_0x1a09('0xf')](0x1f4,_0x530c72[_0x1a09('0x11')]));});});};exports[_0x1a09('0x18')]=function(_0x14779a){var _0x35c1f8=this;return new Promise(function(_0x5d4fb9,_0x174a2d){return db[_0x1a09('0x19')][_0x1a09('0x1a')](_0x14779a[_0x1a09('0x14')],{'raw':_0x14779a['options']?_0x14779a[_0x1a09('0x15')][_0x1a09('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14779a[_0x1a09('0x15')]?_0x14779a[_0x1a09('0x15')][_0x1a09('0x1b')]||null:null,'attributes':_0x14779a[_0x1a09('0x15')]?_0x14779a['options']['attributes']||null:null,'limit':_0x14779a[_0x1a09('0x15')]?_0x14779a[_0x1a09('0x15')][_0x1a09('0x1c')]||null:null})[_0x1a09('0xa')](function(_0x1c40fd){logger[_0x1a09('0xb')]('UpdateVoiceAgentReport',_0x14779a);logger['debug']('UpdateVoiceAgentReport',_0x14779a,JSON[_0x1a09('0x17')](_0x1c40fd));_0x5d4fb9(_0x1c40fd);})[_0x1a09('0x1d')](function(_0x2663ea){logger[_0x1a09('0xf')]('UpdateVoiceAgentReport',_0x2663ea[_0x1a09('0x11')],_0x14779a);_0x174a2d(_0x35c1f8[_0x1a09('0xf')](0x1f4,_0x2663ea[_0x1a09('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 33b4837..8ac4d8d 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 _0x0a6a=['update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x22635f,_0x5bdaed){var _0x3769a9=function(_0x270d48){while(--_0x270d48){_0x22635f['push'](_0x22635f['shift']());}};_0x3769a9(++_0x5bdaed);}(_0x0a6a,0x96));var _0xa0a6=function(_0x58fbb0,_0xe497b5){_0x58fbb0=_0x58fbb0-0x0;var _0x1783d2=_0x0a6a[_0x58fbb0];return _0x1783d2;};'use strict';var multer=require(_0xa0a6('0x0'));var util=require(_0xa0a6('0x1'));var path=require(_0xa0a6('0x2'));var timeout=require(_0xa0a6('0x3'));var express=require('express');var router=express[_0xa0a6('0x4')]();var auth=require(_0xa0a6('0x5'));var interaction=require(_0xa0a6('0x6'));var config=require(_0xa0a6('0x7'));var controller=require(_0xa0a6('0x8'));router[_0xa0a6('0x9')]('/',auth[_0xa0a6('0xa')](),controller[_0xa0a6('0xb')]);router['get'](_0xa0a6('0xc'),auth['isAuthenticated'](),controller[_0xa0a6('0xd')]);router[_0xa0a6('0x9')](_0xa0a6('0xe'),auth['isAuthenticated'](),controller[_0xa0a6('0xf')]);router[_0xa0a6('0x10')]('/',auth[_0xa0a6('0xa')](),controller[_0xa0a6('0x11')]);router['put'](_0xa0a6('0xe'),auth[_0xa0a6('0xa')](),controller[_0xa0a6('0x12')]);router[_0xa0a6('0x13')](_0xa0a6('0xe'),auth['isAuthenticated'](),controller[_0xa0a6('0x14')]);module['exports']=router; \ No newline at end of file +var _0xb2b7=['Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x5ad803,_0x2017f2){var _0x5daa5c=function(_0x59c986){while(--_0x59c986){_0x5ad803['push'](_0x5ad803['shift']());}};_0x5daa5c(++_0x2017f2);}(_0xb2b7,0x14e));var _0x7b2b=function(_0x417a1c,_0x3288f4){_0x417a1c=_0x417a1c-0x0;var _0x492052=_0xb2b7[_0x417a1c];return _0x492052;};'use strict';var multer=require('multer');var util=require(_0x7b2b('0x0'));var path=require('path');var timeout=require(_0x7b2b('0x1'));var express=require('express');var router=express[_0x7b2b('0x2')]();var auth=require(_0x7b2b('0x3'));var interaction=require(_0x7b2b('0x4'));var config=require('../../config/environment');var controller=require(_0x7b2b('0x5'));router[_0x7b2b('0x6')]('/',auth[_0x7b2b('0x7')](),controller['index']);router[_0x7b2b('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7b2b('0x6')](_0x7b2b('0x8'),auth[_0x7b2b('0x7')](),controller[_0x7b2b('0x9')]);router['post']('/',auth[_0x7b2b('0x7')](),controller[_0x7b2b('0xa')]);router[_0x7b2b('0xb')]('/:id',auth[_0x7b2b('0x7')](),controller[_0x7b2b('0xc')]);router[_0x7b2b('0xd')]('/:id',auth[_0x7b2b('0x7')](),controller[_0x7b2b('0xe')]);module[_0x7b2b('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 7a8780a..56bede4 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(_0x3e2c62,_0x1ed9f9){var _0x443c70=function(_0x982bf4){while(--_0x982bf4){_0x3e2c62['push'](_0x3e2c62['shift']());}};_0x443c70(++_0x1ed9f9);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'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 _0x9957=['ENUM','internal','outbound','inbound-fax','outbound-fax','DATE','INTEGER','sequelize','exports','STRING'];(function(_0x3b0661,_0x5ee1ca){var _0x52ea55=function(_0x49ce00){while(--_0x49ce00){_0x3b0661['push'](_0x3b0661['shift']());}};_0x52ea55(++_0x5ee1ca);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'type':{'type':Sequelize[_0x7995('0x3')]('inbound',_0x7995('0x4'),_0x7995('0x5'),_0x7995('0x6'),_0x7995('0x7'),'dialer')},'tag':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'source':{'type':Sequelize[_0x7995('0x2')]},'destination':{'type':Sequelize[_0x7995('0x2')]},'destinationcontext':{'type':Sequelize[_0x7995('0x2')]},'callerid':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x7995('0x2')]},'lastapplication':{'type':Sequelize[_0x7995('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x7995('0x8')]},'systemanswertime':{'type':Sequelize[_0x7995('0x8')]},'answertime':{'type':Sequelize[_0x7995('0x8')]},'endtime':{'type':Sequelize[_0x7995('0x8')]},'duration':{'type':Sequelize[_0x7995('0x9')]},'billableseconds':{'type':Sequelize[_0x7995('0x9')]},'mohtime':{'type':Sequelize[_0x7995('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7995('0x2')]},'userfield':{'type':Sequelize[_0x7995('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7995('0x2')]},'prefix':{'type':Sequelize[_0x7995('0x2')]},'routeid':{'type':Sequelize[_0x7995('0x9')]},'sipcallid':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 7626d4a..8818e60 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 _0x3c67=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then','error','stack','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','include','fullname','User','findAll','rows','catch','find','create','body','destroy','params','describe','uniqueid','user','rimraf','moment','mustache','util','path','to-csv','lodash','squel','crypto'];(function(_0x57f921,_0x4fc8bb){var _0x2660ef=function(_0x45ba84){while(--_0x45ba84){_0x57f921['push'](_0x57f921['shift']());}};_0x2660ef(++_0x4fc8bb);}(_0x3c67,0x87));var _0x73c6=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x3c67[_0x5a776b];return _0xbbef59;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x73c6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x73c6('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x73c6('0x2'));var util=require(_0x73c6('0x3'));var path=require(_0x73c6('0x4'));var sox=require('sox');var csv=require(_0x73c6('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x73c6('0x6'));var squel=require(_0x73c6('0x7'));var crypto=require(_0x73c6('0x8'));var jsforce=require(_0x73c6('0x9'));var deskjs=require(_0x73c6('0xa'));var toCsv=require(_0x73c6('0x5'));var querystring=require('querystring');var Papa=require(_0x73c6('0xb'));var Redis=require(_0x73c6('0xc'));var authService=require(_0x73c6('0xd'));var qs=require(_0x73c6('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x73c6('0xf'));var logger=require(_0x73c6('0x10'))(_0x73c6('0x11'));var utils=require('../../config/utils');var config=require(_0x73c6('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4006d3,_0x614126){_0x614126=_0x614126||0xcc;return function(_0x3b6cff){if(_0x3b6cff){return _0x4006d3[_0x73c6('0x13')](_0x614126);}return _0x4006d3[_0x73c6('0x14')](_0x614126)[_0x73c6('0x15')]();};}function respondWithResult(_0x4e5b73,_0x48f775){_0x48f775=_0x48f775||0xc8;return function(_0x136bcd){if(_0x136bcd){return _0x4e5b73[_0x73c6('0x14')](_0x48f775)[_0x73c6('0x16')](_0x136bcd);}};}function respondWithFilteredResult(_0x58d9e7,_0x475a11){return function(_0x3501a5){if(_0x3501a5){var _0x533ccf=_0x3501a5['count'],_0x40a5b1=_0x475a11[_0x73c6('0x17')],_0x33b6b1=_0x475a11[_0x73c6('0x17')]+_0x475a11[_0x73c6('0x18')],_0x7cbeb1;if(_0x33b6b1>=_0x533ccf){_0x33b6b1=_0x533ccf;_0x7cbeb1=0xc8;}else{_0x7cbeb1=0xce;}_0x58d9e7['status'](_0x7cbeb1);return _0x58d9e7[_0x73c6('0x19')](_0x73c6('0x1a'),_0x40a5b1+'-'+_0x33b6b1+'/'+_0x533ccf)['json'](_0x3501a5);}return null;};}function patchUpdates(_0x50cc87){return function(_0x19401b){try{jsonpatch['apply'](_0x19401b,_0x50cc87,!![]);}catch(_0x15d154){return BPromise[_0x73c6('0x1b')](_0x15d154);}return _0x19401b[_0x73c6('0x1c')]();};}function saveUpdates(_0x263099,_0x5d8862){return function(_0xbf0cec){if(_0xbf0cec){return _0xbf0cec['update'](_0x263099)[_0x73c6('0x1d')](function(_0x40f7ad){return _0x40f7ad;});}return null;};}function removeEntity(_0x7f3938,_0x4207e7){return function(_0x49b68c){if(_0x49b68c){return _0x49b68c['destroy']()[_0x73c6('0x1d')](function(){_0x7f3938['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x260a3a,_0x456e17){return function(_0xd671c2){if(!_0xd671c2){_0x260a3a['sendStatus'](0x194);}return _0xd671c2;};}function handleError(_0x46b77e,_0x2256c2){_0x2256c2=_0x2256c2||0x1f4;return function(_0x47b3eb){logger[_0x73c6('0x1e')](_0x47b3eb[_0x73c6('0x1f')]);if(_0x47b3eb['name']){delete _0x47b3eb['name'];}_0x46b77e[_0x73c6('0x14')](_0x2256c2)['send'](_0x47b3eb);};}exports[_0x73c6('0x20')]=function(_0x326aa8,_0x272a3c){var _0x40d9a6={},_0x12de4b={},_0x299879={'count':0x0,'rows':[]};var _0x1e3de2=_[_0x73c6('0x21')](db[_0x73c6('0x22')][_0x73c6('0x23')],function(_0x24ce87){return{'name':_0x24ce87[_0x73c6('0x24')],'type':_0x24ce87[_0x73c6('0x25')][_0x73c6('0x26')]};});_0x12de4b['model']=_['map'](_0x1e3de2,_0x73c6('0x27'));_0x12de4b[_0x73c6('0x28')]=_[_0x73c6('0x29')](_0x326aa8[_0x73c6('0x28')]);_0x12de4b['filters']=_[_0x73c6('0x2a')](_0x12de4b[_0x73c6('0x2b')],_0x12de4b[_0x73c6('0x28')]);_0x40d9a6[_0x73c6('0x2c')]=_[_0x73c6('0x2a')](_0x12de4b[_0x73c6('0x2b')],qs[_0x73c6('0x2d')](_0x326aa8[_0x73c6('0x28')][_0x73c6('0x2d')]));_0x40d9a6[_0x73c6('0x2c')]=_0x40d9a6['attributes'][_0x73c6('0x2e')]?_0x40d9a6['attributes']:_0x12de4b[_0x73c6('0x2b')];if(!_0x326aa8['query'][_0x73c6('0x2f')]('nolimit')){_0x40d9a6[_0x73c6('0x18')]=qs[_0x73c6('0x18')](_0x326aa8[_0x73c6('0x28')][_0x73c6('0x18')]);_0x40d9a6[_0x73c6('0x17')]=qs[_0x73c6('0x17')](_0x326aa8[_0x73c6('0x28')][_0x73c6('0x17')]);}_0x40d9a6['order']=qs[_0x73c6('0x30')](_0x326aa8[_0x73c6('0x28')]['sort']);_0x40d9a6[_0x73c6('0x31')]=qs['filters'](_[_0x73c6('0x32')](_0x326aa8[_0x73c6('0x28')],_0x12de4b[_0x73c6('0x33')]));if(_0x326aa8[_0x73c6('0x28')][_0x73c6('0x34')]){_0x40d9a6[_0x73c6('0x31')]=_[_0x73c6('0x35')](_0x40d9a6[_0x73c6('0x31')],{'$or':_[_0x73c6('0x21')](_0x1e3de2,function(_0x21015a){if(_0x21015a['type']!==_0x73c6('0x36')){var _0x53de15={};_0x53de15[_0x21015a['name']]={'$like':'%'+_0x326aa8[_0x73c6('0x28')][_0x73c6('0x34')]+'%'};return _0x53de15;}})});}_0x40d9a6=_['merge']({},_0x40d9a6,_0x326aa8[_0x73c6('0x37')]);var _0x20d2f5={'where':_0x40d9a6[_0x73c6('0x31')]};return db['VoiceCallReport'][_0x73c6('0x38')](_0x20d2f5)[_0x73c6('0x1d')](function(_0x2e8df3){_0x299879[_0x73c6('0x38')]=_0x2e8df3;if(_0x326aa8[_0x73c6('0x28')][_0x73c6('0x39')]){_0x40d9a6[_0x73c6('0x3a')]=[{'attributes':['id','name',_0x73c6('0x3b'),'alias'],'model':db[_0x73c6('0x3c')],'as':'User'}];}return db[_0x73c6('0x22')][_0x73c6('0x3d')](_0x40d9a6);})[_0x73c6('0x1d')](function(_0x5c3e0a){_0x299879[_0x73c6('0x3e')]=_0x5c3e0a;return _0x299879;})[_0x73c6('0x1d')](respondWithFilteredResult(_0x272a3c,_0x40d9a6))[_0x73c6('0x3f')](handleError(_0x272a3c,null));};exports['show']=function(_0x1135ec,_0x2715c7){var _0x4314cc={'raw':!![],'where':{'id':_0x1135ec['params']['id']}},_0x122fb9={};_0x122fb9[_0x73c6('0x2b')]=_[_0x73c6('0x29')](db[_0x73c6('0x22')]['rawAttributes']);_0x122fb9[_0x73c6('0x28')]=_['keys'](_0x1135ec['query']);_0x122fb9['filters']=_[_0x73c6('0x2a')](_0x122fb9['model'],_0x122fb9[_0x73c6('0x28')]);_0x4314cc[_0x73c6('0x2c')]=_[_0x73c6('0x2a')](_0x122fb9[_0x73c6('0x2b')],qs['fields'](_0x1135ec[_0x73c6('0x28')][_0x73c6('0x2d')]));_0x4314cc[_0x73c6('0x2c')]=_0x4314cc[_0x73c6('0x2c')][_0x73c6('0x2e')]?_0x4314cc[_0x73c6('0x2c')]:_0x122fb9['model'];if(_0x1135ec[_0x73c6('0x28')][_0x73c6('0x39')]){_0x4314cc['include']=[{'all':!![]}];}_0x4314cc=_[_0x73c6('0x35')]({},_0x4314cc,_0x1135ec['options']);return db[_0x73c6('0x22')][_0x73c6('0x40')](_0x4314cc)[_0x73c6('0x1d')](handleEntityNotFound(_0x2715c7,null))[_0x73c6('0x1d')](respondWithResult(_0x2715c7,null))[_0x73c6('0x3f')](handleError(_0x2715c7,null));};exports[_0x73c6('0x41')]=function(_0x4c71ea,_0x361f83){return db[_0x73c6('0x22')][_0x73c6('0x41')](_0x4c71ea[_0x73c6('0x42')],{})[_0x73c6('0x1d')](respondWithResult(_0x361f83,0xc9))[_0x73c6('0x3f')](handleError(_0x361f83,null));};exports[_0x73c6('0x43')]=function(_0x1dc6db,_0xcff311){return db[_0x73c6('0x22')][_0x73c6('0x40')]({'where':{'id':_0x1dc6db[_0x73c6('0x44')]['id']}})['then'](handleEntityNotFound(_0xcff311,null))[_0x73c6('0x1d')](removeEntity(_0xcff311,null))[_0x73c6('0x3f')](handleError(_0xcff311,null));};exports['describe']=function(_0x24640f,_0x62b32a){return db[_0x73c6('0x22')][_0x73c6('0x45')]()['then'](respondWithResult(_0x62b32a,null))[_0x73c6('0x3f')](handleError(_0x62b32a,null));};exports['update']=function(_0x1a2eb0,_0x42a7ec){if(_0x1a2eb0['body'][_0x73c6('0x46')]){delete _0x1a2eb0[_0x73c6('0x42')][_0x73c6('0x46')];}return db[_0x73c6('0x22')]['find']({'where':{'uniqueid':_0x1a2eb0[_0x73c6('0x44')]['id'],'UserId':{'$or':[null,_0x1a2eb0[_0x73c6('0x47')]['id']]}}})[_0x73c6('0x1d')](handleEntityNotFound(_0x42a7ec,null))['then'](saveUpdates(_0x1a2eb0[_0x73c6('0x42')],null))['then'](respondWithResult(_0x42a7ec,null))['catch'](handleError(_0x42a7ec,null));}; \ No newline at end of file +var _0x5e18=['then','destroy','error','stack','name','send','index','fieldName','key','model','map','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceCallReport','includeAll','fullname','alias','User','rows','show','params','keys','rawAttributes','find','catch','create','body','describe','update','uniqueid','user','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save'];(function(_0x490b7b,_0x599c24){var _0x385399=function(_0xdfc744){while(--_0xdfc744){_0x490b7b['push'](_0x490b7b['shift']());}};_0x385399(++_0x599c24);}(_0x5e18,0x80));var _0x85e1=function(_0x2aaa00,_0x45ccd8){_0x2aaa00=_0x2aaa00-0x0;var _0x1dcea8=_0x5e18[_0x2aaa00];return _0x1dcea8;};'use strict';var pdf=require(_0x85e1('0x0'));var emlformat=require(_0x85e1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x85e1('0x2'));var jsonpatch=require(_0x85e1('0x3'));var rp=require(_0x85e1('0x4'));var moment=require('moment');var BPromise=require(_0x85e1('0x5'));var Mustache=require(_0x85e1('0x6'));var util=require(_0x85e1('0x7'));var path=require(_0x85e1('0x8'));var sox=require(_0x85e1('0x9'));var csv=require(_0x85e1('0xa'));var ejs=require(_0x85e1('0xb'));var fs=require('fs');var _=require(_0x85e1('0xc'));var squel=require(_0x85e1('0xd'));var crypto=require('crypto');var jsforce=require(_0x85e1('0xe'));var deskjs=require(_0x85e1('0xf'));var toCsv=require(_0x85e1('0xa'));var querystring=require(_0x85e1('0x10'));var Papa=require(_0x85e1('0x11'));var Redis=require(_0x85e1('0x12'));var authService=require(_0x85e1('0x13'));var qs=require(_0x85e1('0x14'));var as=require(_0x85e1('0x15'));var hardwareService=require(_0x85e1('0x16'));var logger=require('../../config/logger')(_0x85e1('0x17'));var utils=require(_0x85e1('0x18'));var config=require(_0x85e1('0x19'));var db=require(_0x85e1('0x1a'))['db'];function respondWithStatusCode(_0x1063de,_0x432069){_0x432069=_0x432069||0xcc;return function(_0x333531){if(_0x333531){return _0x1063de[_0x85e1('0x1b')](_0x432069);}return _0x1063de[_0x85e1('0x1c')](_0x432069)[_0x85e1('0x1d')]();};}function respondWithResult(_0x587edb,_0x4d315a){_0x4d315a=_0x4d315a||0xc8;return function(_0xcea0ce){if(_0xcea0ce){return _0x587edb[_0x85e1('0x1c')](_0x4d315a)[_0x85e1('0x1e')](_0xcea0ce);}};}function respondWithFilteredResult(_0x1b36a3,_0x24eb93){return function(_0x11c956){if(_0x11c956){var _0x38f586=_0x11c956[_0x85e1('0x1f')],_0x26b156=_0x24eb93[_0x85e1('0x20')],_0x193045=_0x24eb93[_0x85e1('0x20')]+_0x24eb93[_0x85e1('0x21')],_0x43a385;if(_0x193045>=_0x38f586){_0x193045=_0x38f586;_0x43a385=0xc8;}else{_0x43a385=0xce;}_0x1b36a3['status'](_0x43a385);return _0x1b36a3['set'](_0x85e1('0x22'),_0x26b156+'-'+_0x193045+'/'+_0x38f586)[_0x85e1('0x1e')](_0x11c956);}return null;};}function patchUpdates(_0x13e45f){return function(_0x46a093){try{jsonpatch[_0x85e1('0x23')](_0x46a093,_0x13e45f,!![]);}catch(_0x3051df){return BPromise[_0x85e1('0x24')](_0x3051df);}return _0x46a093[_0x85e1('0x25')]();};}function saveUpdates(_0x418d3f,_0x2933e0){return function(_0x1435d5){if(_0x1435d5){return _0x1435d5['update'](_0x418d3f)[_0x85e1('0x26')](function(_0x4c0c76){return _0x4c0c76;});}return null;};}function removeEntity(_0x288e24,_0x2aea60){return function(_0x1f351c){if(_0x1f351c){return _0x1f351c[_0x85e1('0x27')]()['then'](function(){_0x288e24['status'](0xcc)[_0x85e1('0x1d')]();});}};}function handleEntityNotFound(_0x5c54d3,_0x36bf89){return function(_0x4a3b59){if(!_0x4a3b59){_0x5c54d3[_0x85e1('0x1b')](0x194);}return _0x4a3b59;};}function handleError(_0x5a828e,_0x333c98){_0x333c98=_0x333c98||0x1f4;return function(_0x27e3b2){logger[_0x85e1('0x28')](_0x27e3b2[_0x85e1('0x29')]);if(_0x27e3b2[_0x85e1('0x2a')]){delete _0x27e3b2[_0x85e1('0x2a')];}_0x5a828e[_0x85e1('0x1c')](_0x333c98)[_0x85e1('0x2b')](_0x27e3b2);};}exports[_0x85e1('0x2c')]=function(_0x371cc9,_0x59a354){var _0x270f9d={},_0x1116b0={},_0x2f1b82={'count':0x0,'rows':[]};var _0x5421c0=_['map'](db['VoiceCallReport']['rawAttributes'],function(_0x37c16e){return{'name':_0x37c16e[_0x85e1('0x2d')],'type':_0x37c16e['type'][_0x85e1('0x2e')]};});_0x1116b0[_0x85e1('0x2f')]=_[_0x85e1('0x30')](_0x5421c0,_0x85e1('0x2a'));_0x1116b0['query']=_['keys'](_0x371cc9['query']);_0x1116b0[_0x85e1('0x31')]=_[_0x85e1('0x32')](_0x1116b0[_0x85e1('0x2f')],_0x1116b0[_0x85e1('0x33')]);_0x270f9d[_0x85e1('0x34')]=_[_0x85e1('0x32')](_0x1116b0[_0x85e1('0x2f')],qs['fields'](_0x371cc9[_0x85e1('0x33')][_0x85e1('0x35')]));_0x270f9d['attributes']=_0x270f9d[_0x85e1('0x34')][_0x85e1('0x36')]?_0x270f9d[_0x85e1('0x34')]:_0x1116b0[_0x85e1('0x2f')];if(!_0x371cc9[_0x85e1('0x33')][_0x85e1('0x37')](_0x85e1('0x38'))){_0x270f9d[_0x85e1('0x21')]=qs[_0x85e1('0x21')](_0x371cc9['query']['limit']);_0x270f9d['offset']=qs['offset'](_0x371cc9[_0x85e1('0x33')][_0x85e1('0x20')]);}_0x270f9d['order']=qs[_0x85e1('0x39')](_0x371cc9['query'][_0x85e1('0x39')]);_0x270f9d[_0x85e1('0x3a')]=qs['filters'](_[_0x85e1('0x3b')](_0x371cc9[_0x85e1('0x33')],_0x1116b0[_0x85e1('0x31')]));if(_0x371cc9[_0x85e1('0x33')][_0x85e1('0x3c')]){_0x270f9d[_0x85e1('0x3a')]=_[_0x85e1('0x3d')](_0x270f9d[_0x85e1('0x3a')],{'$or':_[_0x85e1('0x30')](_0x5421c0,function(_0x16e7c8){if(_0x16e7c8[_0x85e1('0x3e')]!==_0x85e1('0x3f')){var _0x3a509a={};_0x3a509a[_0x16e7c8['name']]={'$like':'%'+_0x371cc9[_0x85e1('0x33')][_0x85e1('0x3c')]+'%'};return _0x3a509a;}})});}_0x270f9d=_[_0x85e1('0x3d')]({},_0x270f9d,_0x371cc9[_0x85e1('0x40')]);var _0x51c574={'where':_0x270f9d[_0x85e1('0x3a')]};return db[_0x85e1('0x41')][_0x85e1('0x1f')](_0x51c574)[_0x85e1('0x26')](function(_0x385be4){_0x2f1b82[_0x85e1('0x1f')]=_0x385be4;if(_0x371cc9[_0x85e1('0x33')][_0x85e1('0x42')]){_0x270f9d['include']=[{'attributes':['id',_0x85e1('0x2a'),_0x85e1('0x43'),_0x85e1('0x44')],'model':db[_0x85e1('0x45')],'as':_0x85e1('0x45')}];}return db[_0x85e1('0x41')]['findAll'](_0x270f9d);})[_0x85e1('0x26')](function(_0x20f850){_0x2f1b82[_0x85e1('0x46')]=_0x20f850;return _0x2f1b82;})[_0x85e1('0x26')](respondWithFilteredResult(_0x59a354,_0x270f9d))['catch'](handleError(_0x59a354,null));};exports[_0x85e1('0x47')]=function(_0x3a5b0b,_0x3c4a9c){var _0x361354={'raw':!![],'where':{'id':_0x3a5b0b[_0x85e1('0x48')]['id']}},_0x1edd4d={};_0x1edd4d['model']=_[_0x85e1('0x49')](db[_0x85e1('0x41')][_0x85e1('0x4a')]);_0x1edd4d[_0x85e1('0x33')]=_[_0x85e1('0x49')](_0x3a5b0b[_0x85e1('0x33')]);_0x1edd4d[_0x85e1('0x31')]=_['intersection'](_0x1edd4d[_0x85e1('0x2f')],_0x1edd4d[_0x85e1('0x33')]);_0x361354[_0x85e1('0x34')]=_[_0x85e1('0x32')](_0x1edd4d[_0x85e1('0x2f')],qs['fields'](_0x3a5b0b[_0x85e1('0x33')][_0x85e1('0x35')]));_0x361354['attributes']=_0x361354['attributes']['length']?_0x361354[_0x85e1('0x34')]:_0x1edd4d[_0x85e1('0x2f')];if(_0x3a5b0b['query'][_0x85e1('0x42')]){_0x361354['include']=[{'all':!![]}];}_0x361354=_['merge']({},_0x361354,_0x3a5b0b[_0x85e1('0x40')]);return db[_0x85e1('0x41')][_0x85e1('0x4b')](_0x361354)[_0x85e1('0x26')](handleEntityNotFound(_0x3c4a9c,null))['then'](respondWithResult(_0x3c4a9c,null))[_0x85e1('0x4c')](handleError(_0x3c4a9c,null));};exports[_0x85e1('0x4d')]=function(_0x25885c,_0x6f4b1c){return db[_0x85e1('0x41')][_0x85e1('0x4d')](_0x25885c[_0x85e1('0x4e')],{})[_0x85e1('0x26')](respondWithResult(_0x6f4b1c,0xc9))[_0x85e1('0x4c')](handleError(_0x6f4b1c,null));};exports[_0x85e1('0x27')]=function(_0x1a0b2c,_0x53de79){return db['VoiceCallReport']['find']({'where':{'id':_0x1a0b2c['params']['id']}})[_0x85e1('0x26')](handleEntityNotFound(_0x53de79,null))['then'](removeEntity(_0x53de79,null))['catch'](handleError(_0x53de79,null));};exports[_0x85e1('0x4f')]=function(_0x5009c2,_0x389f1f){return db[_0x85e1('0x41')][_0x85e1('0x4f')]()[_0x85e1('0x26')](respondWithResult(_0x389f1f,null))[_0x85e1('0x4c')](handleError(_0x389f1f,null));};exports[_0x85e1('0x50')]=function(_0x7481bb,_0x4db668){if(_0x7481bb[_0x85e1('0x4e')][_0x85e1('0x51')]){delete _0x7481bb['body'][_0x85e1('0x51')];}return db[_0x85e1('0x41')][_0x85e1('0x4b')]({'where':{'uniqueid':_0x7481bb[_0x85e1('0x48')]['id'],'UserId':{'$or':[null,_0x7481bb[_0x85e1('0x52')]['id']]}}})[_0x85e1('0x26')](handleEntityNotFound(_0x4db668,null))[_0x85e1('0x26')](saveUpdates(_0x7481bb[_0x85e1('0x4e')],null))['then'](respondWithResult(_0x4db668,null))[_0x85e1('0x4c')](handleError(_0x4db668,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 6115e89..eb02730 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 _0x40cd=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','./voiceCallReport.attributes','define','report_call','uniqueid','lodash'];(function(_0x4fedd4,_0x1dbf05){var _0x5dce0d=function(_0x28f99e){while(--_0x28f99e){_0x4fedd4['push'](_0x4fedd4['shift']());}};_0x5dce0d(++_0x1dbf05);}(_0x40cd,0x112));var _0xd40c=function(_0x4f1dc2,_0x385037){_0x4f1dc2=_0x4f1dc2-0x0;var _0xc5c495=_0x40cd[_0x4f1dc2];return _0xc5c495;};'use strict';var _=require(_0xd40c('0x0'));var util=require(_0xd40c('0x1'));var logger=require(_0xd40c('0x2'))(_0xd40c('0x3'));var moment=require('moment');var BPromise=require(_0xd40c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd40c('0x5'));var config=require(_0xd40c('0x6'));var attributes=require(_0xd40c('0x7'));module['exports']=function(_0x36d3d8,_0x2f62c7){return _0x36d3d8[_0xd40c('0x8')]('VoiceCallReport',attributes,{'tableName':_0xd40c('0x9'),'paranoid':![],'indexes':[{'fields':[_0xd40c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0862=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','lodash'];(function(_0x1e8f79,_0x1760cd){var _0x5c0802=function(_0x5488c5){while(--_0x5488c5){_0x1e8f79['push'](_0x1e8f79['shift']());}};_0x5c0802(++_0x1760cd);}(_0x0862,0x8b));var _0x2086=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x0862[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x2086('0x0'));var util=require(_0x2086('0x1'));var logger=require(_0x2086('0x2'))(_0x2086('0x3'));var moment=require(_0x2086('0x4'));var BPromise=require('bluebird');var rp=require(_0x2086('0x5'));var fs=require('fs');var path=require(_0x2086('0x6'));var rimraf=require(_0x2086('0x7'));var config=require(_0x2086('0x8'));var attributes=require(_0x2086('0x9'));module[_0x2086('0xa')]=function(_0x1e4aac,_0x5284b4){return _0x1e4aac[_0x2086('0xb')](_0x2086('0xc'),attributes,{'tableName':_0x2086('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 5696a0c..ae7e88e 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 _0x660c=['where','attributes','limit','map','include','model','info','stringify','catch','CreateVoiceCallReport','VoiceCallReport','body','UpdateVoiceCallReport','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceCallReport','findAll','options'];(function(_0xa599e2,_0x3046be){var _0x122f49=function(_0x4f3d6d){while(--_0x4f3d6d){_0xa599e2['push'](_0xa599e2['shift']());}};_0x122f49(++_0x3046be);}(_0x660c,0xc2));var _0xc660=function(_0x5d0ddc,_0x392c95){_0x5d0ddc=_0x5d0ddc-0x0;var _0x4726c0=_0x660c[_0x5d0ddc];return _0x4726c0;};'use strict';var _=require(_0xc660('0x0'));var util=require(_0xc660('0x1'));var moment=require(_0xc660('0x2'));var BPromise=require('bluebird');var rs=require(_0xc660('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc660('0x4'))['db'];var utils=require(_0xc660('0x5'));var logger=require(_0xc660('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc660('0x7')][_0xc660('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7fc3a4,_0x1ef97b,_0x421db3){return new BPromise(function(_0x58d9f8,_0x585dcc){return client[_0xc660('0x9')](_0x7fc3a4,_0x421db3)[_0xc660('0xa')](function(_0x273697){logger['info'](_0xc660('0xb'),_0x1ef97b,_0xc660('0xc'));logger[_0xc660('0xd')](_0xc660('0xe'),_0x1ef97b,'request\x20sent',JSON['stringify'](_0x273697));if(_0x273697[_0xc660('0xf')]){if(_0x273697['error'][_0xc660('0x10')]===0x1f4){logger[_0xc660('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x1ef97b,_0x273697[_0xc660('0xf')]['message']);return _0x585dcc(_0x273697[_0xc660('0xf')]['message']);}logger[_0xc660('0xf')](_0xc660('0xb'),_0x1ef97b,_0x273697[_0xc660('0xf')][_0xc660('0x11')]);return _0x58d9f8(_0x273697[_0xc660('0xf')]['message']);}else{logger['info'](_0xc660('0xb'),_0x1ef97b,'request\x20sent');_0x58d9f8(_0x273697[_0xc660('0x12')][_0xc660('0x11')]);}})['catch'](function(_0x5a7a87){logger['error'](_0xc660('0xb'),_0x1ef97b,_0x5a7a87);_0x585dcc(_0x5a7a87);});});}exports[_0xc660('0x13')]=function(_0x227d18){var _0x472bf4=this;return new Promise(function(_0x49dd14,_0x5d37e8){return db['VoiceCallReport'][_0xc660('0x14')]({'raw':_0x227d18[_0xc660('0x15')]?_0x227d18[_0xc660('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x227d18['options']?_0x227d18[_0xc660('0x15')][_0xc660('0x16')]||null:null,'attributes':_0x227d18[_0xc660('0x15')]?_0x227d18[_0xc660('0x15')][_0xc660('0x17')]||null:null,'limit':_0x227d18[_0xc660('0x15')]?_0x227d18[_0xc660('0x15')][_0xc660('0x18')]||null:null,'include':_0x227d18['options']?_0x227d18[_0xc660('0x15')]['include']?_[_0xc660('0x19')](_0x227d18[_0xc660('0x15')][_0xc660('0x1a')],function(_0x131f81){return{'model':db[_0x131f81[_0xc660('0x1b')]],'as':_0x131f81['as'],'attributes':_0x131f81[_0xc660('0x17')],'include':_0x131f81['include']?_[_0xc660('0x19')](_0x131f81[_0xc660('0x1a')],function(_0x439811){return{'model':db[_0x439811[_0xc660('0x1b')]],'as':_0x439811['as'],'attributes':_0x439811[_0xc660('0x17')],'include':_0x439811[_0xc660('0x1a')]?_['map'](_0x439811['include'],function(_0x4e594e){return{'model':db[_0x4e594e[_0xc660('0x1b')]],'as':_0x4e594e['as'],'attributes':_0x4e594e[_0xc660('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc6adf5){logger[_0xc660('0x1c')](_0xc660('0x13'),_0x227d18);logger[_0xc660('0xd')]('GetVoiceCallReport',_0x227d18,JSON[_0xc660('0x1d')](_0xc6adf5));_0x49dd14(_0xc6adf5);})[_0xc660('0x1e')](function(_0x552d41){logger['error'](_0xc660('0x13'),_0x552d41['message'],_0x227d18);_0x5d37e8(_0x472bf4['error'](0x1f4,_0x552d41[_0xc660('0x11')]));});});};exports[_0xc660('0x1f')]=function(_0x445ee4){var _0x2e9338=this;return new Promise(function(_0x3e7908,_0x550f7a){return db[_0xc660('0x20')]['create'](_0x445ee4[_0xc660('0x21')],{'raw':_0x445ee4[_0xc660('0x15')]?_0x445ee4[_0xc660('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xc660('0xa')](function(_0x30eeb0){logger[_0xc660('0x1c')]('CreateVoiceCallReport',_0x445ee4);logger[_0xc660('0xd')](_0xc660('0x1f'),_0x445ee4,JSON[_0xc660('0x1d')](_0x30eeb0));_0x3e7908(_0x30eeb0);})['catch'](function(_0xabd81){logger[_0xc660('0xf')](_0xc660('0x1f'),_0xabd81[_0xc660('0x11')],_0x445ee4);_0x550f7a(_0x2e9338[_0xc660('0xf')](0x1f4,_0xabd81[_0xc660('0x11')]));});});};exports[_0xc660('0x22')]=function(_0x1f8d1a){var _0x32fce0=this;return new Promise(function(_0x18cbc6,_0x4d2197){return db[_0xc660('0x20')]['update'](_0x1f8d1a[_0xc660('0x21')],{'raw':_0x1f8d1a[_0xc660('0x15')]?_0x1f8d1a[_0xc660('0x15')][_0xc660('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f8d1a[_0xc660('0x15')]?_0x1f8d1a[_0xc660('0x15')]['where']||null:null,'attributes':_0x1f8d1a['options']?_0x1f8d1a[_0xc660('0x15')][_0xc660('0x17')]||null:null,'limit':_0x1f8d1a[_0xc660('0x15')]?_0x1f8d1a[_0xc660('0x15')][_0xc660('0x18')]||null:null})['then'](function(_0x56a18f){logger[_0xc660('0x1c')](_0xc660('0x22'),_0x1f8d1a);logger[_0xc660('0xd')](_0xc660('0x22'),_0x1f8d1a,JSON[_0xc660('0x1d')](_0x56a18f));_0x18cbc6(_0x56a18f);})[_0xc660('0x1e')](function(_0x9dcb4){logger[_0xc660('0xf')](_0xc660('0x22'),_0x9dcb4[_0xc660('0x11')],_0x1f8d1a);_0x4d2197(_0x32fce0['error'](0x1f4,_0x9dcb4[_0xc660('0x11')]));});});}; \ No newline at end of file +var _0x8f2c=['attributes','limit','map','include','model','GetVoiceCallReport','stringify','CreateVoiceCallReport','create','UpdateVoiceCallReport','update','body','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceCallReport','findAll','options','raw','where'];(function(_0x5ce432,_0xaa12b5){var _0x3e7e77=function(_0x74c2a2){while(--_0x74c2a2){_0x5ce432['push'](_0x5ce432['shift']());}};_0x3e7e77(++_0xaa12b5);}(_0x8f2c,0x16b));var _0xc8f2=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x8f2c[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xc8f2('0x0'));var util=require(_0xc8f2('0x1'));var moment=require('moment');var BPromise=require(_0xc8f2('0x2'));var rs=require(_0xc8f2('0x3'));var fs=require('fs');var Redis=require(_0xc8f2('0x4'));var db=require(_0xc8f2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc8f2('0x6'))('rpc');var config=require(_0xc8f2('0x7'));var jayson=require(_0xc8f2('0x8'));var client=jayson[_0xc8f2('0x9')][_0xc8f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35c6bf,_0x567cce,_0x2229b6){return new BPromise(function(_0x559f7b,_0x113c57){return client['request'](_0x35c6bf,_0x2229b6)[_0xc8f2('0xb')](function(_0x496c03){logger[_0xc8f2('0xc')](_0xc8f2('0xd'),_0x567cce,_0xc8f2('0xe'));logger[_0xc8f2('0xf')](_0xc8f2('0x10'),_0x567cce,_0xc8f2('0xe'),JSON['stringify'](_0x496c03));if(_0x496c03[_0xc8f2('0x11')]){if(_0x496c03[_0xc8f2('0x11')][_0xc8f2('0x12')]===0x1f4){logger[_0xc8f2('0x11')](_0xc8f2('0xd'),_0x567cce,_0x496c03[_0xc8f2('0x11')][_0xc8f2('0x13')]);return _0x113c57(_0x496c03['error'][_0xc8f2('0x13')]);}logger[_0xc8f2('0x11')](_0xc8f2('0xd'),_0x567cce,_0x496c03[_0xc8f2('0x11')][_0xc8f2('0x13')]);return _0x559f7b(_0x496c03[_0xc8f2('0x11')][_0xc8f2('0x13')]);}else{logger['info'](_0xc8f2('0xd'),_0x567cce,_0xc8f2('0xe'));_0x559f7b(_0x496c03[_0xc8f2('0x14')][_0xc8f2('0x13')]);}})[_0xc8f2('0x15')](function(_0x3e2e2a){logger[_0xc8f2('0x11')](_0xc8f2('0xd'),_0x567cce,_0x3e2e2a);_0x113c57(_0x3e2e2a);});});}exports['GetVoiceCallReport']=function(_0x1d91cd){var _0x43e6bd=this;return new Promise(function(_0x55ad03,_0xebe733){return db[_0xc8f2('0x16')][_0xc8f2('0x17')]({'raw':_0x1d91cd['options']?_0x1d91cd[_0xc8f2('0x18')][_0xc8f2('0x19')]===undefined?!![]:![]:!![],'where':_0x1d91cd['options']?_0x1d91cd[_0xc8f2('0x18')][_0xc8f2('0x1a')]||null:null,'attributes':_0x1d91cd[_0xc8f2('0x18')]?_0x1d91cd[_0xc8f2('0x18')][_0xc8f2('0x1b')]||null:null,'limit':_0x1d91cd[_0xc8f2('0x18')]?_0x1d91cd[_0xc8f2('0x18')][_0xc8f2('0x1c')]||null:null,'include':_0x1d91cd[_0xc8f2('0x18')]?_0x1d91cd[_0xc8f2('0x18')]['include']?_[_0xc8f2('0x1d')](_0x1d91cd[_0xc8f2('0x18')][_0xc8f2('0x1e')],function(_0x441c40){return{'model':db[_0x441c40['model']],'as':_0x441c40['as'],'attributes':_0x441c40[_0xc8f2('0x1b')],'include':_0x441c40['include']?_[_0xc8f2('0x1d')](_0x441c40[_0xc8f2('0x1e')],function(_0x2bbc15){return{'model':db[_0x2bbc15[_0xc8f2('0x1f')]],'as':_0x2bbc15['as'],'attributes':_0x2bbc15[_0xc8f2('0x1b')],'include':_0x2bbc15['include']?_['map'](_0x2bbc15[_0xc8f2('0x1e')],function(_0x4b8bbe){return{'model':db[_0x4b8bbe[_0xc8f2('0x1f')]],'as':_0x4b8bbe['as'],'attributes':_0x4b8bbe[_0xc8f2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc8f2('0xb')](function(_0x274aa0){logger[_0xc8f2('0xc')](_0xc8f2('0x20'),_0x1d91cd);logger['debug'](_0xc8f2('0x20'),_0x1d91cd,JSON[_0xc8f2('0x21')](_0x274aa0));_0x55ad03(_0x274aa0);})[_0xc8f2('0x15')](function(_0x3b912d){logger[_0xc8f2('0x11')]('GetVoiceCallReport',_0x3b912d[_0xc8f2('0x13')],_0x1d91cd);_0xebe733(_0x43e6bd[_0xc8f2('0x11')](0x1f4,_0x3b912d[_0xc8f2('0x13')]));});});};exports[_0xc8f2('0x22')]=function(_0x11d7d2){var _0x252b63=this;return new Promise(function(_0x49d533,_0x2e8ec6){return db['VoiceCallReport'][_0xc8f2('0x23')](_0x11d7d2['body'],{'raw':_0x11d7d2['options']?_0x11d7d2['options'][_0xc8f2('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x46c823){logger['info'](_0xc8f2('0x22'),_0x11d7d2);logger['debug']('CreateVoiceCallReport',_0x11d7d2,JSON[_0xc8f2('0x21')](_0x46c823));_0x49d533(_0x46c823);})[_0xc8f2('0x15')](function(_0x381c8f){logger[_0xc8f2('0x11')]('CreateVoiceCallReport',_0x381c8f[_0xc8f2('0x13')],_0x11d7d2);_0x2e8ec6(_0x252b63[_0xc8f2('0x11')](0x1f4,_0x381c8f[_0xc8f2('0x13')]));});});};exports[_0xc8f2('0x24')]=function(_0x4cdcb4){var _0x3ae922=this;return new Promise(function(_0x47ff3a,_0x257a90){return db[_0xc8f2('0x16')][_0xc8f2('0x25')](_0x4cdcb4[_0xc8f2('0x26')],{'raw':_0x4cdcb4[_0xc8f2('0x18')]?_0x4cdcb4[_0xc8f2('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cdcb4[_0xc8f2('0x18')]?_0x4cdcb4[_0xc8f2('0x18')][_0xc8f2('0x1a')]||null:null,'attributes':_0x4cdcb4[_0xc8f2('0x18')]?_0x4cdcb4['options']['attributes']||null:null,'limit':_0x4cdcb4[_0xc8f2('0x18')]?_0x4cdcb4[_0xc8f2('0x18')][_0xc8f2('0x1c')]||null:null})['then'](function(_0x4fa8aa){logger[_0xc8f2('0xc')](_0xc8f2('0x24'),_0x4cdcb4);logger[_0xc8f2('0xf')]('UpdateVoiceCallReport',_0x4cdcb4,JSON[_0xc8f2('0x21')](_0x4fa8aa));_0x47ff3a(_0x4fa8aa);})[_0xc8f2('0x15')](function(_0xc396e7){logger[_0xc8f2('0x11')]('UpdateVoiceCallReport',_0xc396e7[_0xc8f2('0x13')],_0x4cdcb4);_0x257a90(_0x3ae922['error'](0x1f4,_0xc396e7[_0xc8f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 6881f03..5201f79 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 _0x9388=['Router','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x229094,_0x5ddee6){var _0x556ff3=function(_0x28841f){while(--_0x28841f){_0x229094['push'](_0x229094['shift']());}};_0x556ff3(++_0x5ddee6);}(_0x9388,0x13f));var _0x8938=function(_0x57ffa,_0x5aba91){_0x57ffa=_0x57ffa-0x0;var _0x3eac88=_0x9388[_0x57ffa];return _0x3eac88;};'use strict';var multer=require(_0x8938('0x0'));var util=require(_0x8938('0x1'));var path=require(_0x8938('0x2'));var timeout=require(_0x8938('0x3'));var express=require(_0x8938('0x4'));var router=express[_0x8938('0x5')]();var auth=require(_0x8938('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8938('0x7'));var controller=require(_0x8938('0x8'));router[_0x8938('0x9')]('/',auth[_0x8938('0xa')](),controller['index']);router[_0x8938('0x9')](_0x8938('0xb'),auth[_0x8938('0xa')](),controller[_0x8938('0xc')]);router[_0x8938('0xd')]('/',auth['isAuthenticated'](),controller[_0x8938('0xe')]);router[_0x8938('0xf')](_0x8938('0xb'),auth[_0x8938('0xa')](),controller[_0x8938('0x10')]);router['delete'](_0x8938('0xb'),auth[_0x8938('0xa')](),controller[_0x8938('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd68d=['index','post','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./voiceChanSpy.controller','get','isAuthenticated'];(function(_0xb25124,_0x593b91){var _0x53cf6d=function(_0x3f62de){while(--_0x3f62de){_0xb25124['push'](_0xb25124['shift']());}};_0x53cf6d(++_0x593b91);}(_0xd68d,0x7f));var _0xdd68=function(_0x5efebc,_0x3fd4ae){_0x5efebc=_0x5efebc-0x0;var _0x370f59=_0xd68d[_0x5efebc];return _0x370f59;};'use strict';var multer=require(_0xdd68('0x0'));var util=require(_0xdd68('0x1'));var path=require('path');var timeout=require(_0xdd68('0x2'));var express=require(_0xdd68('0x3'));var router=express[_0xdd68('0x4')]();var auth=require(_0xdd68('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdd68('0x6'));router[_0xdd68('0x7')]('/',auth[_0xdd68('0x8')](),controller[_0xdd68('0x9')]);router[_0xdd68('0x7')]('/:id',auth[_0xdd68('0x8')](),controller['show']);router[_0xdd68('0xa')]('/',auth[_0xdd68('0x8')](),controller[_0xdd68('0xb')]);router[_0xdd68('0xc')](_0xdd68('0xd'),auth[_0xdd68('0x8')](),controller[_0xdd68('0xe')]);router[_0xdd68('0xf')](_0xdd68('0xd'),auth[_0xdd68('0x8')](),controller['destroy']);module[_0xdd68('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 a192262..52f3bb1 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 _0xa378=['name','options','join','getDataValue','split','BOOLEAN','exports','STRING'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa378,0x8e));var _0x8a37=function(_0x1e70bd,_0x16bcbd){_0x1e70bd=_0x1e70bd-0x0;var _0x182e59=_0xa378[_0x1e70bd];return _0x182e59;};'use strict';var Sequelize=require('sequelize');module[_0x8a37('0x0')]={'name':{'type':Sequelize[_0x8a37('0x1')]},'prefix':{'type':Sequelize[_0x8a37('0x1')],'unique':_0x8a37('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x8a37('0x1')],'set':function(_0x1ac881){this['setDataValue'](_0x8a37('0x3'),_0x1ac881?_0x1ac881[_0x8a37('0x4')](''):[]);},'get':function(){return this[_0x8a37('0x5')]('options')?this[_0x8a37('0x5')](_0x8a37('0x3'))[_0x8a37('0x6')](''):[];}},'auth':{'type':Sequelize[_0x8a37('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8a37('0x1')]},'description':{'type':Sequelize[_0x8a37('0x1')]}}; \ No newline at end of file +var _0x5ddb=['join','getDataValue','split','BOOLEAN','STRING','name','setDataValue','options'];(function(_0x32cd88,_0x43c826){var _0x47cfde=function(_0x542b73){while(--_0x542b73){_0x32cd88['push'](_0x32cd88['shift']());}};_0x47cfde(++_0x43c826);}(_0x5ddb,0xec));var _0xb5dd=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5ddb[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb5dd('0x0')]},'prefix':{'type':Sequelize[_0xb5dd('0x0')],'unique':_0xb5dd('0x1'),'allowNull':![]},'options':{'type':Sequelize[_0xb5dd('0x0')],'set':function(_0x59f766){this[_0xb5dd('0x2')](_0xb5dd('0x3'),_0x59f766?_0x59f766[_0xb5dd('0x4')](''):[]);},'get':function(){return this[_0xb5dd('0x5')]('options')?this[_0xb5dd('0x5')]('options')[_0xb5dd('0x6')](''):[];}},'auth':{'type':Sequelize[_0xb5dd('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xb5dd('0x0')]},'record':{'type':Sequelize[_0xb5dd('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb5dd('0x0')]},'description':{'type':Sequelize[_0xb5dd('0x0')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 7811ead..15e4059 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 _0x7d79=['catch','show','params','intersection','create','body','user','role','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','path','to-csv','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','Content-Range','apply','reject','update','then','destroy','get','ChanSpies','error','stack','name','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','count','include','findAll','rows'];(function(_0xe11966,_0x455d9d){var _0x2fa7e1=function(_0x5194b8){while(--_0x5194b8){_0xe11966['push'](_0xe11966['shift']());}};_0x2fa7e1(++_0x455d9d);}(_0x7d79,0xa6));var _0x97d7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7d79[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0x97d7('0x0'));var emlformat=require(_0x97d7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x97d7('0x2'));var jsonpatch=require(_0x97d7('0x3'));var rp=require(_0x97d7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x97d7('0x5'));var sox=require('sox');var csv=require(_0x97d7('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x97d7('0x7'));var squel=require('squel');var crypto=require(_0x97d7('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x97d7('0x6'));var querystring=require(_0x97d7('0x9'));var Papa=require(_0x97d7('0xa'));var Redis=require(_0x97d7('0xb'));var authService=require(_0x97d7('0xc'));var qs=require(_0x97d7('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97d7('0xe'));var logger=require(_0x97d7('0xf'))(_0x97d7('0x10'));var utils=require(_0x97d7('0x11'));var config=require(_0x97d7('0x12'));var db=require(_0x97d7('0x13'))['db'];function respondWithStatusCode(_0xcb158d,_0x11d986){_0x11d986=_0x11d986||0xcc;return function(_0x198aa7){if(_0x198aa7){return _0xcb158d[_0x97d7('0x14')](_0x11d986);}return _0xcb158d[_0x97d7('0x15')](_0x11d986)[_0x97d7('0x16')]();};}function respondWithResult(_0x1c3c95,_0x5dcf50){_0x5dcf50=_0x5dcf50||0xc8;return function(_0xa4014){if(_0xa4014){return _0x1c3c95[_0x97d7('0x15')](_0x5dcf50)[_0x97d7('0x17')](_0xa4014);}};}function respondWithFilteredResult(_0x1b673a,_0x45276f){return function(_0xa62ed9){if(_0xa62ed9){var _0x56ece3=_0xa62ed9['count'],_0x4cff14=_0x45276f['offset'],_0x1dbcd6=_0x45276f['offset']+_0x45276f[_0x97d7('0x18')],_0x5e23ba;if(_0x1dbcd6>=_0x56ece3){_0x1dbcd6=_0x56ece3;_0x5e23ba=0xc8;}else{_0x5e23ba=0xce;}_0x1b673a[_0x97d7('0x15')](_0x5e23ba);return _0x1b673a[_0x97d7('0x19')](_0x97d7('0x1a'),_0x4cff14+'-'+_0x1dbcd6+'/'+_0x56ece3)[_0x97d7('0x17')](_0xa62ed9);}return null;};}function patchUpdates(_0x51819f){return function(_0xd4a4b3){try{jsonpatch[_0x97d7('0x1b')](_0xd4a4b3,_0x51819f,!![]);}catch(_0x4b3d4c){return BPromise[_0x97d7('0x1c')](_0x4b3d4c);}return _0xd4a4b3['save']();};}function saveUpdates(_0x14d085,_0x9f6df7){return function(_0x253b1b){if(_0x253b1b){return _0x253b1b[_0x97d7('0x1d')](_0x14d085)[_0x97d7('0x1e')](function(_0x1a0134){return _0x1a0134;});}return null;};}function removeEntity(_0x492250,_0x558988){return function(_0x4a346b){if(_0x4a346b){return _0x4a346b[_0x97d7('0x1f')]()[_0x97d7('0x1e')](function(){var _0x3d5c5d=_0x4a346b[_0x97d7('0x20')]({'plain':!![]});var _0x16278f=_0x97d7('0x21');return db['UserProfileResource'][_0x97d7('0x1f')]({'where':{'type':_0x16278f,'resourceId':_0x3d5c5d['id']}})[_0x97d7('0x1e')](function(){return _0x4a346b;});})['then'](function(){_0x492250['status'](0xcc)[_0x97d7('0x16')]();});}};}function handleEntityNotFound(_0x250f0c,_0xc65389){return function(_0x39461d){if(!_0x39461d){_0x250f0c['sendStatus'](0x194);}return _0x39461d;};}function handleError(_0x183413,_0x5658c3){_0x5658c3=_0x5658c3||0x1f4;return function(_0x50292e){logger[_0x97d7('0x22')](_0x50292e[_0x97d7('0x23')]);if(_0x50292e['name']){delete _0x50292e[_0x97d7('0x24')];}_0x183413['status'](_0x5658c3)['send'](_0x50292e);};}exports[_0x97d7('0x25')]=function(_0x449899,_0x248a6b){var _0x156877={},_0x14fc4a={},_0x365883={'count':0x0,'rows':[]};var _0x371d91=_['map'](db[_0x97d7('0x26')][_0x97d7('0x27')],function(_0x5ae4d6){return{'name':_0x5ae4d6[_0x97d7('0x28')],'type':_0x5ae4d6[_0x97d7('0x29')][_0x97d7('0x2a')]};});_0x14fc4a[_0x97d7('0x2b')]=_[_0x97d7('0x2c')](_0x371d91,'name');_0x14fc4a['query']=_[_0x97d7('0x2d')](_0x449899[_0x97d7('0x2e')]);_0x14fc4a[_0x97d7('0x2f')]=_['intersection'](_0x14fc4a[_0x97d7('0x2b')],_0x14fc4a[_0x97d7('0x2e')]);_0x156877['attributes']=_['intersection'](_0x14fc4a[_0x97d7('0x2b')],qs[_0x97d7('0x30')](_0x449899['query'][_0x97d7('0x30')]));_0x156877[_0x97d7('0x31')]=_0x156877[_0x97d7('0x31')][_0x97d7('0x32')]?_0x156877[_0x97d7('0x31')]:_0x14fc4a['model'];if(!_0x449899['query'][_0x97d7('0x33')](_0x97d7('0x34'))){_0x156877[_0x97d7('0x18')]=qs[_0x97d7('0x18')](_0x449899['query'][_0x97d7('0x18')]);_0x156877['offset']=qs['offset'](_0x449899[_0x97d7('0x2e')][_0x97d7('0x35')]);}_0x156877[_0x97d7('0x36')]=qs[_0x97d7('0x37')](_0x449899[_0x97d7('0x2e')][_0x97d7('0x37')]);_0x156877[_0x97d7('0x38')]=qs[_0x97d7('0x2f')](_['pick'](_0x449899[_0x97d7('0x2e')],_0x14fc4a[_0x97d7('0x2f')]));if(_0x449899[_0x97d7('0x2e')][_0x97d7('0x39')]){_0x156877[_0x97d7('0x38')]=_[_0x97d7('0x3a')](_0x156877['where'],{'$or':_[_0x97d7('0x2c')](_0x371d91,function(_0x42163f){if(_0x42163f[_0x97d7('0x29')]!==_0x97d7('0x3b')){var _0x15e1b2={};_0x15e1b2[_0x42163f[_0x97d7('0x24')]]={'$like':'%'+_0x449899['query'][_0x97d7('0x39')]+'%'};return _0x15e1b2;}})});}_0x156877=_[_0x97d7('0x3a')]({},_0x156877,_0x449899[_0x97d7('0x3c')]);var _0x166b76={'where':_0x156877[_0x97d7('0x38')]};return db[_0x97d7('0x26')][_0x97d7('0x3d')](_0x166b76)[_0x97d7('0x1e')](function(_0x955f07){_0x365883[_0x97d7('0x3d')]=_0x955f07;if(_0x449899[_0x97d7('0x2e')]['includeAll']){_0x156877[_0x97d7('0x3e')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x97d7('0x3f')](_0x156877);})['then'](function(_0x26d45b){_0x365883[_0x97d7('0x40')]=_0x26d45b;return _0x365883;})['then'](respondWithFilteredResult(_0x248a6b,_0x156877))[_0x97d7('0x41')](handleError(_0x248a6b,null));};exports[_0x97d7('0x42')]=function(_0x2c112c,_0x37b2e5){var _0x3cc5f6={'raw':![],'where':{'id':_0x2c112c[_0x97d7('0x43')]['id']}},_0xfcd44f={};_0xfcd44f[_0x97d7('0x2b')]=_[_0x97d7('0x2d')](db[_0x97d7('0x26')][_0x97d7('0x27')]);_0xfcd44f['query']=_[_0x97d7('0x2d')](_0x2c112c[_0x97d7('0x2e')]);_0xfcd44f[_0x97d7('0x2f')]=_[_0x97d7('0x44')](_0xfcd44f[_0x97d7('0x2b')],_0xfcd44f[_0x97d7('0x2e')]);_0x3cc5f6[_0x97d7('0x31')]=_['intersection'](_0xfcd44f[_0x97d7('0x2b')],qs[_0x97d7('0x30')](_0x2c112c[_0x97d7('0x2e')]['fields']));_0x3cc5f6['attributes']=_0x3cc5f6[_0x97d7('0x31')][_0x97d7('0x32')]?_0x3cc5f6['attributes']:_0xfcd44f[_0x97d7('0x2b')];if(_0x2c112c['query']['includeAll']){_0x3cc5f6[_0x97d7('0x3e')]=[{'all':!![]}];}_0x3cc5f6=_[_0x97d7('0x3a')]({},_0x3cc5f6,_0x2c112c[_0x97d7('0x3c')]);return db[_0x97d7('0x26')]['find'](_0x3cc5f6)['then'](handleEntityNotFound(_0x37b2e5,null))[_0x97d7('0x1e')](respondWithResult(_0x37b2e5,null))['catch'](handleError(_0x37b2e5,null));};exports[_0x97d7('0x45')]=function(_0x4cd2c2,_0x2d94eb){return db[_0x97d7('0x26')][_0x97d7('0x45')](_0x4cd2c2[_0x97d7('0x46')],{})[_0x97d7('0x1e')](function(_0x207d26){var _0x38d2b5=_0x4cd2c2[_0x97d7('0x47')][_0x97d7('0x20')]({'plain':!![]});if(!_0x38d2b5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38d2b5[_0x97d7('0x48')]===_0x97d7('0x47')){var _0x3c588b=_0x207d26[_0x97d7('0x20')]({'plain':!![]});var _0xf40ef8='ChanSpies';return db['UserProfileSection']['find']({'where':{'name':_0xf40ef8,'userProfileId':_0x38d2b5[_0x97d7('0x49')]},'raw':!![]})[_0x97d7('0x1e')](function(_0x41202a){if(_0x41202a&&_0x41202a['autoAssociation']===0x0){return db[_0x97d7('0x4a')]['create']({'name':_0x3c588b[_0x97d7('0x24')],'resourceId':_0x3c588b['id'],'type':_0x41202a[_0x97d7('0x24')],'sectionId':_0x41202a['id']},{})[_0x97d7('0x1e')](function(){return _0x207d26;});}else{return _0x207d26;}})['catch'](function(_0xcffe0a){logger['error'](_0x97d7('0x4b'),_0xcffe0a);throw _0xcffe0a;});}return _0x207d26;})[_0x97d7('0x1e')](respondWithResult(_0x2d94eb,0xc9))['catch'](handleError(_0x2d94eb,null));};exports[_0x97d7('0x1d')]=function(_0x609199,_0x2fe10d){if(_0x609199[_0x97d7('0x46')]['id']){delete _0x609199[_0x97d7('0x46')]['id'];}return db[_0x97d7('0x26')][_0x97d7('0x4c')]({'where':{'id':_0x609199[_0x97d7('0x43')]['id']}})[_0x97d7('0x1e')](handleEntityNotFound(_0x2fe10d,null))[_0x97d7('0x1e')](saveUpdates(_0x609199[_0x97d7('0x46')],null))[_0x97d7('0x1e')](respondWithResult(_0x2fe10d,null))['catch'](handleError(_0x2fe10d,null));};exports[_0x97d7('0x1f')]=function(_0x32b12,_0x407892){return db[_0x97d7('0x26')]['find']({'where':{'id':_0x32b12['params']['id']}})[_0x97d7('0x1e')](handleEntityNotFound(_0x407892,null))['then'](removeEntity(_0x407892,null))[_0x97d7('0x41')](handleError(_0x407892,null));}; \ No newline at end of file +var _0x4e24=['limit','set','Content-Range','apply','update','destroy','then','UserProfileResource','error','stack','name','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','catch','params','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0xa2029c,_0x590021){var _0x49b2f6=function(_0x1c34d8){while(--_0x1c34d8){_0xa2029c['push'](_0xa2029c['shift']());}};_0x49b2f6(++_0x590021);}(_0x4e24,0x119));var _0x44e2=function(_0x2d06d9,_0x404966){_0x2d06d9=_0x2d06d9-0x0;var _0xc349f9=_0x4e24[_0x2d06d9];return _0xc349f9;};'use strict';var pdf=require(_0x44e2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x44e2('0x1'));var zipdir=require(_0x44e2('0x2'));var jsonpatch=require(_0x44e2('0x3'));var rp=require(_0x44e2('0x4'));var moment=require(_0x44e2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x44e2('0x6'));var util=require(_0x44e2('0x7'));var path=require(_0x44e2('0x8'));var sox=require(_0x44e2('0x9'));var csv=require(_0x44e2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x44e2('0xb'));var squel=require(_0x44e2('0xc'));var crypto=require(_0x44e2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x44e2('0xe'));var toCsv=require(_0x44e2('0xa'));var querystring=require(_0x44e2('0xf'));var Papa=require(_0x44e2('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x44e2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x44e2('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x44e2('0x13'));var config=require(_0x44e2('0x14'));var db=require(_0x44e2('0x15'))['db'];function respondWithStatusCode(_0x335302,_0x399633){_0x399633=_0x399633||0xcc;return function(_0xc60d73){if(_0xc60d73){return _0x335302[_0x44e2('0x16')](_0x399633);}return _0x335302['status'](_0x399633)[_0x44e2('0x17')]();};}function respondWithResult(_0x23d4d3,_0x2e77c4){_0x2e77c4=_0x2e77c4||0xc8;return function(_0x39261e){if(_0x39261e){return _0x23d4d3[_0x44e2('0x18')](_0x2e77c4)[_0x44e2('0x19')](_0x39261e);}};}function respondWithFilteredResult(_0x3cfedc,_0x24bca8){return function(_0x38adf3){if(_0x38adf3){var _0x212d68=_0x38adf3['count'],_0x404d57=_0x24bca8[_0x44e2('0x1a')],_0x38588b=_0x24bca8[_0x44e2('0x1a')]+_0x24bca8[_0x44e2('0x1b')],_0x1d63ef;if(_0x38588b>=_0x212d68){_0x38588b=_0x212d68;_0x1d63ef=0xc8;}else{_0x1d63ef=0xce;}_0x3cfedc[_0x44e2('0x18')](_0x1d63ef);return _0x3cfedc[_0x44e2('0x1c')](_0x44e2('0x1d'),_0x404d57+'-'+_0x38588b+'/'+_0x212d68)[_0x44e2('0x19')](_0x38adf3);}return null;};}function patchUpdates(_0x4693ec){return function(_0x26d9b1){try{jsonpatch[_0x44e2('0x1e')](_0x26d9b1,_0x4693ec,!![]);}catch(_0x5c98f2){return BPromise['reject'](_0x5c98f2);}return _0x26d9b1['save']();};}function saveUpdates(_0x3fe862,_0x52b791){return function(_0x432f51){if(_0x432f51){return _0x432f51[_0x44e2('0x1f')](_0x3fe862)['then'](function(_0x26fef6){return _0x26fef6;});}return null;};}function removeEntity(_0x112fa3,_0x4d9762){return function(_0x3f2810){if(_0x3f2810){return _0x3f2810[_0x44e2('0x20')]()[_0x44e2('0x21')](function(){var _0x32a8c2=_0x3f2810['get']({'plain':!![]});var _0x178c59='ChanSpies';return db[_0x44e2('0x22')][_0x44e2('0x20')]({'where':{'type':_0x178c59,'resourceId':_0x32a8c2['id']}})[_0x44e2('0x21')](function(){return _0x3f2810;});})[_0x44e2('0x21')](function(){_0x112fa3[_0x44e2('0x18')](0xcc)[_0x44e2('0x17')]();});}};}function handleEntityNotFound(_0x4328a6,_0x1ffd9d){return function(_0x946477){if(!_0x946477){_0x4328a6['sendStatus'](0x194);}return _0x946477;};}function handleError(_0x253fd9,_0x577f4f){_0x577f4f=_0x577f4f||0x1f4;return function(_0x4189e3){logger[_0x44e2('0x23')](_0x4189e3[_0x44e2('0x24')]);if(_0x4189e3[_0x44e2('0x25')]){delete _0x4189e3[_0x44e2('0x25')];}_0x253fd9['status'](_0x577f4f)['send'](_0x4189e3);};}exports['index']=function(_0xaed27,_0x3cae09){var _0x771b62={},_0x41e53a={},_0x51e258={'count':0x0,'rows':[]};var _0x315284=_[_0x44e2('0x26')](db[_0x44e2('0x27')][_0x44e2('0x28')],function(_0x27bbd2){return{'name':_0x27bbd2[_0x44e2('0x29')],'type':_0x27bbd2[_0x44e2('0x2a')]['key']};});_0x41e53a[_0x44e2('0x2b')]=_[_0x44e2('0x26')](_0x315284,_0x44e2('0x25'));_0x41e53a[_0x44e2('0x2c')]=_[_0x44e2('0x2d')](_0xaed27['query']);_0x41e53a[_0x44e2('0x2e')]=_[_0x44e2('0x2f')](_0x41e53a[_0x44e2('0x2b')],_0x41e53a[_0x44e2('0x2c')]);_0x771b62[_0x44e2('0x30')]=_[_0x44e2('0x2f')](_0x41e53a[_0x44e2('0x2b')],qs[_0x44e2('0x31')](_0xaed27[_0x44e2('0x2c')]['fields']));_0x771b62['attributes']=_0x771b62[_0x44e2('0x30')]['length']?_0x771b62[_0x44e2('0x30')]:_0x41e53a[_0x44e2('0x2b')];if(!_0xaed27[_0x44e2('0x2c')]['hasOwnProperty'](_0x44e2('0x32'))){_0x771b62[_0x44e2('0x1b')]=qs[_0x44e2('0x1b')](_0xaed27[_0x44e2('0x2c')]['limit']);_0x771b62[_0x44e2('0x1a')]=qs[_0x44e2('0x1a')](_0xaed27[_0x44e2('0x2c')][_0x44e2('0x1a')]);}_0x771b62['order']=qs['sort'](_0xaed27['query'][_0x44e2('0x33')]);_0x771b62[_0x44e2('0x34')]=qs[_0x44e2('0x2e')](_[_0x44e2('0x35')](_0xaed27[_0x44e2('0x2c')],_0x41e53a[_0x44e2('0x2e')]));if(_0xaed27['query'][_0x44e2('0x36')]){_0x771b62['where']=_['merge'](_0x771b62[_0x44e2('0x34')],{'$or':_['map'](_0x315284,function(_0x2b425b){if(_0x2b425b[_0x44e2('0x2a')]!==_0x44e2('0x37')){var _0xfae73e={};_0xfae73e[_0x2b425b[_0x44e2('0x25')]]={'$like':'%'+_0xaed27[_0x44e2('0x2c')][_0x44e2('0x36')]+'%'};return _0xfae73e;}})});}_0x771b62=_[_0x44e2('0x38')]({},_0x771b62,_0xaed27[_0x44e2('0x39')]);var _0x1a6313={'where':_0x771b62[_0x44e2('0x34')]};return db[_0x44e2('0x27')][_0x44e2('0x3a')](_0x1a6313)[_0x44e2('0x21')](function(_0x651f7b){_0x51e258[_0x44e2('0x3a')]=_0x651f7b;if(_0xaed27[_0x44e2('0x2c')]['includeAll']){_0x771b62[_0x44e2('0x3b')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x44e2('0x3c')](_0x771b62);})[_0x44e2('0x21')](function(_0x4e99bf){_0x51e258[_0x44e2('0x3d')]=_0x4e99bf;return _0x51e258;})[_0x44e2('0x21')](respondWithFilteredResult(_0x3cae09,_0x771b62))[_0x44e2('0x3e')](handleError(_0x3cae09,null));};exports['show']=function(_0x211215,_0x46ab92){var _0x52cccb={'raw':![],'where':{'id':_0x211215[_0x44e2('0x3f')]['id']}},_0x2147a4={};_0x2147a4['model']=_[_0x44e2('0x2d')](db[_0x44e2('0x27')][_0x44e2('0x28')]);_0x2147a4[_0x44e2('0x2c')]=_[_0x44e2('0x2d')](_0x211215[_0x44e2('0x2c')]);_0x2147a4['filters']=_['intersection'](_0x2147a4['model'],_0x2147a4[_0x44e2('0x2c')]);_0x52cccb[_0x44e2('0x30')]=_[_0x44e2('0x2f')](_0x2147a4[_0x44e2('0x2b')],qs[_0x44e2('0x31')](_0x211215[_0x44e2('0x2c')]['fields']));_0x52cccb[_0x44e2('0x30')]=_0x52cccb[_0x44e2('0x30')]['length']?_0x52cccb[_0x44e2('0x30')]:_0x2147a4[_0x44e2('0x2b')];if(_0x211215[_0x44e2('0x2c')][_0x44e2('0x40')]){_0x52cccb[_0x44e2('0x3b')]=[{'all':!![]}];}_0x52cccb=_[_0x44e2('0x38')]({},_0x52cccb,_0x211215[_0x44e2('0x39')]);return db['VoiceChanSpy'][_0x44e2('0x41')](_0x52cccb)['then'](handleEntityNotFound(_0x46ab92,null))[_0x44e2('0x21')](respondWithResult(_0x46ab92,null))['catch'](handleError(_0x46ab92,null));};exports['create']=function(_0x5ade58,_0xf6f9f){return db[_0x44e2('0x27')][_0x44e2('0x42')](_0x5ade58['body'],{})[_0x44e2('0x21')](function(_0x10d224){var _0x593553=_0x5ade58[_0x44e2('0x43')][_0x44e2('0x44')]({'plain':!![]});if(!_0x593553)throw new Error(_0x44e2('0x45'));if(_0x593553[_0x44e2('0x46')]===_0x44e2('0x43')){var _0x1813a1=_0x10d224['get']({'plain':!![]});var _0x25b2ae=_0x44e2('0x47');return db[_0x44e2('0x48')][_0x44e2('0x41')]({'where':{'name':_0x25b2ae,'userProfileId':_0x593553[_0x44e2('0x49')]},'raw':!![]})['then'](function(_0xb858ec){if(_0xb858ec&&_0xb858ec[_0x44e2('0x4a')]===0x0){return db[_0x44e2('0x22')][_0x44e2('0x42')]({'name':_0x1813a1[_0x44e2('0x25')],'resourceId':_0x1813a1['id'],'type':_0xb858ec[_0x44e2('0x25')],'sectionId':_0xb858ec['id']},{})['then'](function(){return _0x10d224;});}else{return _0x10d224;}})[_0x44e2('0x3e')](function(_0x40dc57){logger[_0x44e2('0x23')](_0x44e2('0x4b'),_0x40dc57);throw _0x40dc57;});}return _0x10d224;})[_0x44e2('0x21')](respondWithResult(_0xf6f9f,0xc9))[_0x44e2('0x3e')](handleError(_0xf6f9f,null));};exports['update']=function(_0x52b724,_0x3d0914){if(_0x52b724[_0x44e2('0x4c')]['id']){delete _0x52b724[_0x44e2('0x4c')]['id'];}return db[_0x44e2('0x27')][_0x44e2('0x41')]({'where':{'id':_0x52b724[_0x44e2('0x3f')]['id']}})[_0x44e2('0x21')](handleEntityNotFound(_0x3d0914,null))[_0x44e2('0x21')](saveUpdates(_0x52b724['body'],null))[_0x44e2('0x21')](respondWithResult(_0x3d0914,null))[_0x44e2('0x3e')](handleError(_0x3d0914,null));};exports['destroy']=function(_0x426384,_0x3d63df){return db[_0x44e2('0x27')][_0x44e2('0x41')]({'where':{'id':_0x426384['params']['id']}})[_0x44e2('0x21')](handleEntityNotFound(_0x3d63df,null))[_0x44e2('0x21')](removeEntity(_0x3d63df,null))['catch'](handleError(_0x3d63df,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 158340e..599492b 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 _0x28bf=['lodash','./voiceChanSpy.attributes','context','from-sip','format','%s%s','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','internal','concat','findAll','then','exports','models','VoiceChanSpy','voice_chanspy','bulkCreate','catch','VoiceExtension','destroy','length'];(function(_0x5c7865,_0x58af82){var _0x197f0e=function(_0x1594d7){while(--_0x1594d7){_0x5c7865['push'](_0x5c7865['shift']());}};_0x197f0e(++_0x58af82);}(_0x28bf,0xfc));var _0xf28b=function(_0x572288,_0x582c20){_0x572288=_0x572288-0x0;var _0x5bd358=_0x28bf[_0x572288];return _0x5bd358;};'use strict';var _=require(_0xf28b('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xf28b('0x1'));var getUserApplications=function(_0x30d965,_0x4845ce,_0x3ed733){var _0x2e479c=0x1;var _0xb3bb4d=[];var _0x2b3a91={'context':_0x4845ce[_0xf28b('0x2')]||_0xf28b('0x3'),'exten':util[_0xf28b('0x4')](_0xf28b('0x5'),_0x30d965['prefix'],_0x3ed733),'type':_0xf28b('0x6'),'isApp':![],'ChanSpyId':_0x30d965['id'],'UserId':_0x4845ce['id']};_0xb3bb4d[_0xf28b('0x7')](_[_0xf28b('0x8')]({'app':_0xf28b('0x9'),'appdata':util[_0xf28b('0x4')](_0xf28b('0xa'),_0xf28b('0xb')),'priority':_0x2e479c++},_0x2b3a91));if(_0x30d965[_0xf28b('0xc')]){_0xb3bb4d[_0xf28b('0x7')](_['merge']({'app':_0xf28b('0xd'),'appdata':util[_0xf28b('0x4')]('${UNIQUEID}.%s,ab',_0x30d965['recordingFormat']),'priority':_0x2e479c++},_0x2b3a91));}if(_0x30d965[_0xf28b('0xe')]){_0xb3bb4d[_0xf28b('0x7')](_[_0xf28b('0x8')]({'app':_0xf28b('0xf'),'appdata':_0x30d965[_0xf28b('0x10')],'priority':_0x2e479c++},_0x2b3a91));}_0xb3bb4d['push'](_[_0xf28b('0x8')]({'app':_0xf28b('0x11'),'appdata':util[_0xf28b('0x4')](_0xf28b('0x12'),_0x4845ce[_0xf28b('0x13')],_0x30d965[_0xf28b('0x14')]?_0x30d965[_0xf28b('0x14')][_0xf28b('0x15')](''):''),'priority':_0x2e479c++},_0x2b3a91));if(_0x30d965[_0xf28b('0xc')]){_0xb3bb4d[_0xf28b('0x7')](_['merge']({'app':_0xf28b('0x16'),'priority':_0x2e479c++},_0x2b3a91));}return _0xb3bb4d;};var getChanSpyApplications=function(_0x592b57,_0x270018){var _0x1c8908=[];for(var _0x43141b=0x0,_0x101f3e=0x1;_0x43141b<_0x270018['length'];_0x43141b++,_0x101f3e=0x1){_0x1c8908=_0x1c8908['concat'](getUserApplications(_0x592b57,_0x270018[_0x43141b],_0x270018[_0x43141b]['internal']));if(_0x270018[_0x43141b][_0xf28b('0x17')]!=_0x270018[_0x43141b][_0xf28b('0x13')]){_0x1c8908=_0x1c8908[_0xf28b('0x18')](getUserApplications(_0x592b57,_0x270018[_0x43141b],_0x270018[_0x43141b][_0xf28b('0x13')]));}}return _0x1c8908;};var getChanSpyPromise=function(_0x33d2d0,_0x502d0e){return new BPromise(function(_0x276787,_0x54ab7b){return _0x33d2d0['User'][_0xf28b('0x19')]({'attributes':['id',_0xf28b('0x13'),_0xf28b('0x17')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0xf28b('0x1a')](function(_0x5663fa){if(_0x5663fa){return _0x276787(getChanSpyApplications(_0x502d0e,_0x5663fa));}return _0x276787([]);})['catch'](function(_0x21c38b){_0x54ab7b(_0x21c38b);});});};module[_0xf28b('0x1b')]=function(_0xc326d3,_0x5a9453){var _0x354362=_0xc326d3[_0xf28b('0x1c')];return _0xc326d3['define'](_0xf28b('0x1d'),attributes,{'tableName':_0xf28b('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x34b5ad,_0x3dd50f,_0x4a3027){return getChanSpyPromise(_0x354362,_0x34b5ad)[_0xf28b('0x1a')](function(_0x54facd){if(_0x54facd&&_0x54facd['length']){return _0x354362['VoiceExtension'][_0xf28b('0x1f')](_0x54facd);}})[_0xf28b('0x1a')](function(){_0x4a3027();})[_0xf28b('0x20')](function(_0x7919f8){_0x4a3027(_0x7919f8);});},'afterUpdate':function(_0x3f4924,_0x2bdef2,_0x343671){return _0x354362[_0xf28b('0x21')][_0xf28b('0x22')]({'where':{'ChanSpyId':_0x3f4924['id']}})[_0xf28b('0x1a')](function(){return getChanSpyPromise(_0x354362,_0x3f4924);})[_0xf28b('0x1a')](function(_0x238a53){if(_0x238a53&&_0x238a53[_0xf28b('0x23')]){return _0x354362[_0xf28b('0x21')][_0xf28b('0x1f')](_0x238a53);}})[_0xf28b('0x1a')](function(){_0x343671();})[_0xf28b('0x20')](function(_0x535662){_0x343671(_0x535662);});},'afterDestroy':function(_0x442d1a,_0x3263e9,_0x415994){return _0x354362['VoiceExtension'][_0xf28b('0x22')]({'where':{'ChanSpyId':_0x442d1a['id']}})[_0xf28b('0x1a')](function(){_0x415994();})[_0xf28b('0x20')](function(_0x41fdbe){_0x415994(_0x41fdbe);});}}});}; \ No newline at end of file +var _0xa67b=['define','VoiceChanSpy','destroy','VoiceExtension','bulkCreate','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','%s%s','prefix','push','merge','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll','agent','then','catch','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa67b,0xc3));var _0xba67=function(_0xefa124,_0x30d71a){_0xefa124=_0xefa124-0x0;var _0x1517f9=_0xa67b[_0xefa124];return _0x1517f9;};'use strict';var _=require(_0xba67('0x0'));var util=require(_0xba67('0x1'));var BPromise=require(_0xba67('0x2'));var attributes=require(_0xba67('0x3'));var getUserApplications=function(_0x4ecd1c,_0xc0abe4,_0x33ba3a){var _0x529dcd=0x1;var _0xda05e3=[];var _0x348d54={'context':_0xc0abe4['context']||_0xba67('0x4'),'exten':util['format'](_0xba67('0x5'),_0x4ecd1c[_0xba67('0x6')],_0x33ba3a),'type':'system','isApp':![],'ChanSpyId':_0x4ecd1c['id'],'UserId':_0xc0abe4['id']};_0xda05e3[_0xba67('0x7')](_[_0xba67('0x8')]({'app':'Set','appdata':util[_0xba67('0x9')](_0xba67('0xa'),_0xba67('0xb')),'priority':_0x529dcd++},_0x348d54));if(_0x4ecd1c[_0xba67('0xc')]){_0xda05e3[_0xba67('0x7')](_[_0xba67('0x8')]({'app':_0xba67('0xd'),'appdata':util['format'](_0xba67('0xe'),_0x4ecd1c[_0xba67('0xf')]),'priority':_0x529dcd++},_0x348d54));}if(_0x4ecd1c[_0xba67('0x10')]){_0xda05e3[_0xba67('0x7')](_[_0xba67('0x8')]({'app':_0xba67('0x11'),'appdata':_0x4ecd1c[_0xba67('0x12')],'priority':_0x529dcd++},_0x348d54));}_0xda05e3[_0xba67('0x7')](_[_0xba67('0x8')]({'app':'ChanSpy','appdata':util['format'](_0xba67('0x13'),_0xc0abe4[_0xba67('0x14')],_0x4ecd1c[_0xba67('0x15')]?_0x4ecd1c[_0xba67('0x15')][_0xba67('0x16')](''):''),'priority':_0x529dcd++},_0x348d54));if(_0x4ecd1c['record']){_0xda05e3[_0xba67('0x7')](_[_0xba67('0x8')]({'app':_0xba67('0x17'),'priority':_0x529dcd++},_0x348d54));}return _0xda05e3;};var getChanSpyApplications=function(_0x209442,_0x55f40a){var _0x22e847=[];for(var _0x53e4ef=0x0,_0x3d9767=0x1;_0x53e4ef<_0x55f40a[_0xba67('0x18')];_0x53e4ef++,_0x3d9767=0x1){_0x22e847=_0x22e847['concat'](getUserApplications(_0x209442,_0x55f40a[_0x53e4ef],_0x55f40a[_0x53e4ef][_0xba67('0x19')]));if(_0x55f40a[_0x53e4ef]['internal']!=_0x55f40a[_0x53e4ef][_0xba67('0x14')]){_0x22e847=_0x22e847[_0xba67('0x1a')](getUserApplications(_0x209442,_0x55f40a[_0x53e4ef],_0x55f40a[_0x53e4ef][_0xba67('0x14')]));}}return _0x22e847;};var getChanSpyPromise=function(_0x3c44a7,_0x3e275a){return new BPromise(function(_0x27e15d,_0x232916){return _0x3c44a7[_0xba67('0x1b')][_0xba67('0x1c')]({'attributes':['id',_0xba67('0x14'),_0xba67('0x19')],'where':{'role':_0xba67('0x1d'),'chanspy':!![]},'raw':!![]})[_0xba67('0x1e')](function(_0x480b82){if(_0x480b82){return _0x27e15d(getChanSpyApplications(_0x3e275a,_0x480b82));}return _0x27e15d([]);})[_0xba67('0x1f')](function(_0x40b57f){_0x232916(_0x40b57f);});});};module[_0xba67('0x20')]=function(_0xcb82b7,_0xa58a0a){var _0x4ca116=_0xcb82b7['models'];return _0xcb82b7[_0xba67('0x21')](_0xba67('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x333b6d,_0x117a49,_0x125c00){return getChanSpyPromise(_0x4ca116,_0x333b6d)[_0xba67('0x1e')](function(_0x1f4cdf){if(_0x1f4cdf&&_0x1f4cdf[_0xba67('0x18')]){return _0x4ca116['VoiceExtension']['bulkCreate'](_0x1f4cdf);}})[_0xba67('0x1e')](function(){_0x125c00();})[_0xba67('0x1f')](function(_0x208f07){_0x125c00(_0x208f07);});},'afterUpdate':function(_0x65275c,_0x4e2cdd,_0x5842e3){return _0x4ca116['VoiceExtension'][_0xba67('0x23')]({'where':{'ChanSpyId':_0x65275c['id']}})[_0xba67('0x1e')](function(){return getChanSpyPromise(_0x4ca116,_0x65275c);})[_0xba67('0x1e')](function(_0x4c6241){if(_0x4c6241&&_0x4c6241[_0xba67('0x18')]){return _0x4ca116[_0xba67('0x24')][_0xba67('0x25')](_0x4c6241);}})[_0xba67('0x1e')](function(){_0x5842e3();})['catch'](function(_0x121dd4){_0x5842e3(_0x121dd4);});},'afterDestroy':function(_0x16a04f,_0x53afce,_0x11907a){return _0x4ca116[_0xba67('0x24')][_0xba67('0x23')]({'where':{'ChanSpyId':_0x16a04f['id']}})[_0xba67('0x1e')](function(){_0x11907a();})[_0xba67('0x1f')](function(_0x74d8){_0x11907a(_0x74d8);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 1d90403..eea6188 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 _0x6809=['result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info'];(function(_0x775ff4,_0x14d00f){var _0x2e6abe=function(_0x5ad039){while(--_0x5ad039){_0x775ff4['push'](_0x775ff4['shift']());}};_0x2e6abe(++_0x14d00f);}(_0x6809,0xe8));var _0x9680=function(_0x2906e6,_0x5ccd59){_0x2906e6=_0x2906e6-0x0;var _0x12517a=_0x6809[_0x2906e6];return _0x12517a;};'use strict';var _=require(_0x9680('0x0'));var util=require('util');var moment=require(_0x9680('0x1'));var BPromise=require(_0x9680('0x2'));var rs=require(_0x9680('0x3'));var fs=require('fs');var Redis=require(_0x9680('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9680('0x5'));var logger=require(_0x9680('0x6'))(_0x9680('0x7'));var config=require(_0x9680('0x8'));var jayson=require(_0x9680('0x9'));var client=jayson[_0x9680('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x160449,_0xf270ec,_0x55ba2c){return new BPromise(function(_0x123137,_0x244a43){return client[_0x9680('0xb')](_0x160449,_0x55ba2c)[_0x9680('0xc')](function(_0x127e77){logger['info'](_0x9680('0xd'),_0xf270ec,_0x9680('0xe'));logger[_0x9680('0xf')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0xf270ec,_0x9680('0xe'),JSON['stringify'](_0x127e77));if(_0x127e77['error']){if(_0x127e77[_0x9680('0x10')][_0x9680('0x11')]===0x1f4){logger[_0x9680('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0xf270ec,_0x127e77['error'][_0x9680('0x12')]);return _0x244a43(_0x127e77[_0x9680('0x10')]['message']);}logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0xf270ec,_0x127e77[_0x9680('0x10')]['message']);return _0x123137(_0x127e77[_0x9680('0x10')][_0x9680('0x12')]);}else{logger[_0x9680('0x13')](_0x9680('0xd'),_0xf270ec,_0x9680('0xe'));_0x123137(_0x127e77[_0x9680('0x14')]['message']);}})['catch'](function(_0xb86821){logger['error'](_0x9680('0xd'),_0xf270ec,_0xb86821);_0x244a43(_0xb86821);});});} \ No newline at end of file +var _0x01de=['../../config/utils','rpc','../../config/environment','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x503019,_0x5e5987){var _0x430190=function(_0x4cfac2){while(--_0x4cfac2){_0x503019['push'](_0x503019['shift']());}};_0x430190(++_0x5e5987);}(_0x01de,0x19f));var _0xe01d=function(_0x1a80db,_0x39be26){_0x1a80db=_0x1a80db-0x0;var _0x143503=_0x01de[_0x1a80db];return _0x143503;};'use strict';var _=require('lodash');var util=require(_0xe01d('0x0'));var moment=require(_0xe01d('0x1'));var BPromise=require(_0xe01d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe01d('0x3'));var db=require(_0xe01d('0x4'))['db'];var utils=require(_0xe01d('0x5'));var logger=require('../../config/logger')(_0xe01d('0x6'));var config=require(_0xe01d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe01d('0x8')][_0xe01d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x532f94,_0x3e7df8,_0x55f87a){return new BPromise(function(_0x5699bf,_0x2334f1){return client[_0xe01d('0xa')](_0x532f94,_0x55f87a)[_0xe01d('0xb')](function(_0x1c85f1){logger['info'](_0xe01d('0xc'),_0x3e7df8,_0xe01d('0xd'));logger['debug'](_0xe01d('0xe'),_0x3e7df8,_0xe01d('0xd'),JSON[_0xe01d('0xf')](_0x1c85f1));if(_0x1c85f1['error']){if(_0x1c85f1[_0xe01d('0x10')][_0xe01d('0x11')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x3e7df8,_0x1c85f1[_0xe01d('0x10')][_0xe01d('0x12')]);return _0x2334f1(_0x1c85f1[_0xe01d('0x10')][_0xe01d('0x12')]);}logger['error'](_0xe01d('0xc'),_0x3e7df8,_0x1c85f1['error']['message']);return _0x5699bf(_0x1c85f1[_0xe01d('0x10')][_0xe01d('0x12')]);}else{logger[_0xe01d('0x13')](_0xe01d('0xc'),_0x3e7df8,_0xe01d('0xd'));_0x5699bf(_0x1c85f1['result'][_0xe01d('0x12')]);}})[_0xe01d('0x14')](function(_0x4b9a2f){logger[_0xe01d('0x10')](_0xe01d('0xc'),_0x3e7df8,_0x4b9a2f);_0x2334f1(_0x4b9a2f);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 039a90d..ffa4828 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 _0x79f8=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index'];(function(_0x2b3131,_0x43eb1c){var _0x2018f7=function(_0x2dbac1){while(--_0x2dbac1){_0x2b3131['push'](_0x2b3131['shift']());}};_0x2018f7(++_0x43eb1c);}(_0x79f8,0x85));var _0x879f=function(_0x2497f7,_0x5c3643){_0x2497f7=_0x2497f7-0x0;var _0x264b98=_0x79f8[_0x2497f7];return _0x264b98;};'use strict';var multer=require(_0x879f('0x0'));var util=require('util');var path=require(_0x879f('0x1'));var timeout=require(_0x879f('0x2'));var express=require(_0x879f('0x3'));var router=express['Router']();var auth=require(_0x879f('0x4'));var interaction=require(_0x879f('0x5'));var config=require(_0x879f('0x6'));var controller=require(_0x879f('0x7'));router[_0x879f('0x8')]('/',auth[_0x879f('0x9')](),controller[_0x879f('0xa')]);router[_0x879f('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x879f('0xb')]('/',auth[_0x879f('0x9')](),controller[_0x879f('0xc')]);router[_0x879f('0xd')]('/:id',auth[_0x879f('0x9')](),controller[_0x879f('0xe')]);router[_0x879f('0xf')]('/:id',auth[_0x879f('0x9')](),controller[_0x879f('0x10')]);module[_0x879f('0x11')]=router; \ No newline at end of file +var _0x7e0a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e0a,0xc3));var _0xa7e0=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x7e0a[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0xa7e0('0x0'));var util=require(_0xa7e0('0x1'));var path=require('path');var timeout=require(_0xa7e0('0x2'));var express=require(_0xa7e0('0x3'));var router=express[_0xa7e0('0x4')]();var auth=require(_0xa7e0('0x5'));var interaction=require(_0xa7e0('0x6'));var config=require(_0xa7e0('0x7'));var controller=require('./voiceContext.controller');router[_0xa7e0('0x8')]('/',auth[_0xa7e0('0x9')](),controller[_0xa7e0('0xa')]);router[_0xa7e0('0x8')](_0xa7e0('0xb'),auth[_0xa7e0('0x9')](),controller[_0xa7e0('0xc')]);router['post']('/',auth[_0xa7e0('0x9')](),controller[_0xa7e0('0xd')]);router[_0xa7e0('0xe')](_0xa7e0('0xb'),auth[_0xa7e0('0x9')](),controller[_0xa7e0('0xf')]);router[_0xa7e0('0x10')]('/:id',auth[_0xa7e0('0x9')](),controller['destroy']);module[_0xa7e0('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 5188fda..c688e68 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 _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x35ca69,_0x3bd299){var _0x5018ec=function(_0x457ced){while(--_0x457ced){_0x35ca69['push'](_0x35ca69['shift']());}};_0x5018ec(++_0x3bd299);}(_0xe14b,0x93));var _0xbe14=function(_0xf31a7,_0x23ddbc){_0xf31a7=_0xf31a7-0x0;var _0x457483=_0xe14b[_0xf31a7];return _0x457483;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xbe14('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbe14('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x33668a,_0x42fe58){var _0x412ae1=function(_0x1f0c7c){while(--_0x1f0c7c){_0x33668a['push'](_0x33668a['shift']());}};_0x412ae1(++_0x42fe58);}(_0x34e8,0x12c));var _0x834e=function(_0x15c882,_0x381ae5){_0x15c882=_0x15c882-0x0;var _0x2de3e5=_0x34e8[_0x15c882];return _0x2de3e5;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')],'unique':_0x834e('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x834e('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 972353f..87f243b 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 _0x2ec9=['api','../../config/utils','../../config/environment','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','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','Contexts','UserProfileResource','name','send','map','VoiceContext','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','order','filters','filter','where','merge','options','findAll','rows','catch','show','params','rawAttributes','length','find','create','readFileSync','join','root','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','UserProfileSection','userProfileId','update','body','server/files/templates/context.ejs','utf8','render','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2ec9,0xb5));var _0x92ec=function(_0x5bab26,_0x437a03){_0x5bab26=_0x5bab26-0x0;var _0x34e3f2=_0x2ec9[_0x5bab26];return _0x34e3f2;};'use strict';var pdf=require(_0x92ec('0x0'));var emlformat=require(_0x92ec('0x1'));var rimraf=require(_0x92ec('0x2'));var zipdir=require(_0x92ec('0x3'));var jsonpatch=require(_0x92ec('0x4'));var rp=require(_0x92ec('0x5'));var moment=require(_0x92ec('0x6'));var BPromise=require(_0x92ec('0x7'));var Mustache=require(_0x92ec('0x8'));var util=require(_0x92ec('0x9'));var path=require(_0x92ec('0xa'));var sox=require(_0x92ec('0xb'));var csv=require(_0x92ec('0xc'));var ejs=require(_0x92ec('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x92ec('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x92ec('0xf'));var toCsv=require(_0x92ec('0xc'));var querystring=require('querystring');var Papa=require(_0x92ec('0x10'));var Redis=require(_0x92ec('0x11'));var authService=require(_0x92ec('0x12'));var qs=require(_0x92ec('0x13'));var as=require(_0x92ec('0x14'));var hardwareService=require(_0x92ec('0x15'));var logger=require(_0x92ec('0x16'))(_0x92ec('0x17'));var utils=require(_0x92ec('0x18'));var config=require(_0x92ec('0x19'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x92ec('0x1a')][_0x92ec('0x1b')]({'port':0x232a});function checkPasswordPattern(_0xd94e2b,_0x95b7f3,_0x12ba01){if(_0x12ba01){var _0x47e9de=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x47e9de[_0x92ec('0x1c')](_0x95b7f3)){return _0xd94e2b;}else{throw new db[(_0x92ec('0x1d'))][(_0x92ec('0x1e'))](_0x92ec('0x1f'));}}else{return _0xd94e2b;}}function respondWithRpcPromise(_0x4d58c3,_0x3b7ac9,_0x467f3e,_0x54705b){return new BPromise(function(_0x57c326,_0x332c36){var _0x287b1f=_0x54705b||client;return _0x287b1f[_0x92ec('0x20')](_0x4d58c3,_0x467f3e)['then'](function(_0x1be0bf){logger['info'](_0x92ec('0x21'),_0x3b7ac9,'request\x20sent');logger[_0x92ec('0x22')](_0x92ec('0x23'),_0x3b7ac9,_0x92ec('0x24'),JSON[_0x92ec('0x25')](_0x1be0bf));if(_0x1be0bf[_0x92ec('0x26')]){if(_0x1be0bf[_0x92ec('0x26')][_0x92ec('0x27')]===0x1f4){logger[_0x92ec('0x26')](_0x92ec('0x21'),_0x3b7ac9,_0x1be0bf['error'][_0x92ec('0x28')]);return _0x332c36(_0x1be0bf[_0x92ec('0x26')][_0x92ec('0x28')]);}logger[_0x92ec('0x26')](_0x92ec('0x21'),_0x3b7ac9,_0x1be0bf[_0x92ec('0x26')]['message']);return _0x57c326(_0x1be0bf[_0x92ec('0x26')][_0x92ec('0x28')]);}else{logger[_0x92ec('0x29')](_0x92ec('0x21'),_0x3b7ac9,_0x92ec('0x24'));_0x57c326(_0x1be0bf['result'][_0x92ec('0x28')]);}})['catch'](function(_0x5285b5){logger[_0x92ec('0x26')](_0x92ec('0x21'),_0x3b7ac9,_0x5285b5);_0x332c36(_0x5285b5);});});}function respondWithStatusCode(_0x1755f0,_0x2d561e){_0x2d561e=_0x2d561e||0xcc;return function(_0x89a151){if(_0x89a151){return _0x1755f0[_0x92ec('0x2a')](_0x2d561e);}return _0x1755f0[_0x92ec('0x2b')](_0x2d561e)[_0x92ec('0x2c')]();};}function respondWithResult(_0x152636,_0x30b1e6){_0x30b1e6=_0x30b1e6||0xc8;return function(_0x1f2bc8){if(_0x1f2bc8){return _0x152636[_0x92ec('0x2b')](_0x30b1e6)[_0x92ec('0x2d')](_0x1f2bc8);}};}function respondWithFilteredResult(_0x3aa05a,_0x81ce43){return function(_0x58a82f){if(_0x58a82f){var _0x3fcf31=_0x58a82f[_0x92ec('0x2e')],_0x52c9d0=_0x81ce43['offset'],_0x43e052=_0x81ce43[_0x92ec('0x2f')]+_0x81ce43[_0x92ec('0x30')],_0x29212b;if(_0x43e052>=_0x3fcf31){_0x43e052=_0x3fcf31;_0x29212b=0xc8;}else{_0x29212b=0xce;}_0x3aa05a['status'](_0x29212b);return _0x3aa05a[_0x92ec('0x31')](_0x92ec('0x32'),_0x52c9d0+'-'+_0x43e052+'/'+_0x3fcf31)[_0x92ec('0x2d')](_0x58a82f);}return null;};}function patchUpdates(_0x48b1d6){return function(_0x381f45){try{jsonpatch[_0x92ec('0x33')](_0x381f45,_0x48b1d6,!![]);}catch(_0x31cfcd){return BPromise['reject'](_0x31cfcd);}return _0x381f45[_0x92ec('0x34')]();};}function saveUpdates(_0xa41c2f,_0x56a4a8){return function(_0xabbc14){if(_0xabbc14){return _0xabbc14['update'](_0xa41c2f)[_0x92ec('0x35')](function(_0x287ed8){return _0x287ed8;});}return null;};}function removeEntity(_0x5b065a,_0x4078f1){return function(_0x1d97cb){if(_0x1d97cb){return _0x1d97cb[_0x92ec('0x36')]()[_0x92ec('0x35')](function(){var _0x4cb1c7=_0x1d97cb[_0x92ec('0x37')]({'plain':!![]});var _0x70cadb=_0x92ec('0x38');return db[_0x92ec('0x39')][_0x92ec('0x36')]({'where':{'type':_0x70cadb,'resourceId':_0x4cb1c7['id']}})[_0x92ec('0x35')](function(){return _0x1d97cb;});})[_0x92ec('0x35')](function(){_0x5b065a[_0x92ec('0x2b')](0xcc)[_0x92ec('0x2c')]();});}};}function handleEntityNotFound(_0x5eb0eb,_0x2f500b){return function(_0x435af2){if(!_0x435af2){_0x5eb0eb[_0x92ec('0x2a')](0x194);}return _0x435af2;};}function handleError(_0x450dbc,_0x2dba57){_0x2dba57=_0x2dba57||0x1f4;return function(_0xd53e4){logger[_0x92ec('0x26')](_0xd53e4['stack']);if(_0xd53e4[_0x92ec('0x3a')]){delete _0xd53e4[_0x92ec('0x3a')];}_0x450dbc[_0x92ec('0x2b')](_0x2dba57)[_0x92ec('0x3b')](_0xd53e4);};}exports['index']=function(_0x2073e0,_0x501524){var _0x298452={},_0x10e429={},_0x20331c={'count':0x0,'rows':[]};var _0x35e327=_[_0x92ec('0x3c')](db[_0x92ec('0x3d')]['rawAttributes'],function(_0x292146){return{'name':_0x292146['fieldName'],'type':_0x292146[_0x92ec('0x3e')][_0x92ec('0x3f')]};});_0x10e429['model']=_[_0x92ec('0x3c')](_0x35e327,'name');_0x10e429[_0x92ec('0x40')]=_[_0x92ec('0x41')](_0x2073e0[_0x92ec('0x40')]);_0x10e429['filters']=_[_0x92ec('0x42')](_0x10e429[_0x92ec('0x43')],_0x10e429[_0x92ec('0x40')]);_0x298452['attributes']=_[_0x92ec('0x42')](_0x10e429[_0x92ec('0x43')],qs['fields'](_0x2073e0['query'][_0x92ec('0x44')]));_0x298452[_0x92ec('0x45')]=_0x298452[_0x92ec('0x45')]['length']?_0x298452['attributes']:_0x10e429[_0x92ec('0x43')];if(!_0x2073e0[_0x92ec('0x40')][_0x92ec('0x46')]('nolimit')){_0x298452[_0x92ec('0x30')]=qs[_0x92ec('0x30')](_0x2073e0[_0x92ec('0x40')][_0x92ec('0x30')]);_0x298452[_0x92ec('0x2f')]=qs['offset'](_0x2073e0['query']['offset']);}_0x298452[_0x92ec('0x47')]=qs['sort'](_0x2073e0[_0x92ec('0x40')]['sort']);_0x298452['where']=qs[_0x92ec('0x48')](_['pick'](_0x2073e0[_0x92ec('0x40')],_0x10e429[_0x92ec('0x48')]));if(_0x2073e0['query'][_0x92ec('0x49')]){_0x298452[_0x92ec('0x4a')]=_[_0x92ec('0x4b')](_0x298452['where'],{'$or':_[_0x92ec('0x3c')](_0x35e327,function(_0x3c9cbe){if(_0x3c9cbe[_0x92ec('0x3e')]!=='VIRTUAL'){var _0x1548b2={};_0x1548b2[_0x3c9cbe[_0x92ec('0x3a')]]={'$like':'%'+_0x2073e0[_0x92ec('0x40')][_0x92ec('0x49')]+'%'};return _0x1548b2;}})});}_0x298452=_['merge']({},_0x298452,_0x2073e0[_0x92ec('0x4c')]);var _0x552fbd={'where':_0x298452[_0x92ec('0x4a')]};return db[_0x92ec('0x3d')]['count'](_0x552fbd)['then'](function(_0x43e1e6){_0x20331c['count']=_0x43e1e6;if(_0x2073e0['query']['includeAll']){_0x298452['include']=[{'all':!![]}];}return db['VoiceContext'][_0x92ec('0x4d')](_0x298452);})['then'](function(_0xa72fb3){_0x20331c[_0x92ec('0x4e')]=_0xa72fb3;return _0x20331c;})[_0x92ec('0x35')](respondWithFilteredResult(_0x501524,_0x298452))[_0x92ec('0x4f')](handleError(_0x501524,null));};exports[_0x92ec('0x50')]=function(_0x1105bf,_0x56a99d){var _0x24f8e9={'raw':![],'where':{'id':_0x1105bf[_0x92ec('0x51')]['id']}},_0x29648f={};_0x29648f[_0x92ec('0x43')]=_[_0x92ec('0x41')](db['VoiceContext'][_0x92ec('0x52')]);_0x29648f[_0x92ec('0x40')]=_['keys'](_0x1105bf['query']);_0x29648f[_0x92ec('0x48')]=_[_0x92ec('0x42')](_0x29648f['model'],_0x29648f[_0x92ec('0x40')]);_0x24f8e9['attributes']=_['intersection'](_0x29648f[_0x92ec('0x43')],qs[_0x92ec('0x44')](_0x1105bf[_0x92ec('0x40')][_0x92ec('0x44')]));_0x24f8e9['attributes']=_0x24f8e9['attributes'][_0x92ec('0x53')]?_0x24f8e9['attributes']:_0x29648f[_0x92ec('0x43')];if(_0x1105bf[_0x92ec('0x40')]['includeAll']){_0x24f8e9['include']=[{'all':!![]}];}_0x24f8e9=_['merge']({},_0x24f8e9,_0x1105bf['options']);return db[_0x92ec('0x3d')][_0x92ec('0x54')](_0x24f8e9)[_0x92ec('0x35')](handleEntityNotFound(_0x56a99d,null))[_0x92ec('0x35')](respondWithResult(_0x56a99d,null))[_0x92ec('0x4f')](handleError(_0x56a99d,null));};exports[_0x92ec('0x55')]=function(_0x36407b,_0x597302,_0x510808){var _0x51f67d;return db[_0x92ec('0x3d')][_0x92ec('0x55')](_0x36407b['body'],{'raw':!![]})[_0x92ec('0x35')](function(_0x21365f){_0x51f67d=_0x21365f;return db[_0x92ec('0x3d')]['findAll']({'raw':!![]});})[_0x92ec('0x35')](function(_0x21fb37){var _0x447504=fs[_0x92ec('0x56')](path[_0x92ec('0x57')](config[_0x92ec('0x58')],'server/files/templates/context.ejs'),'utf8');var _0x2608ec=ejs['render'](_0x447504,{'contexts':_0x21fb37||[]});fs[_0x92ec('0x59')](_0x92ec('0x5a'),_0x2608ec);})[_0x92ec('0x35')](function(){return respondWithRpcPromise(_0x92ec('0x5b'),_0x92ec('0x55'),{'module':_0x92ec('0x5c')});})[_0x92ec('0x35')](function(){var _0x45239b=_0x36407b[_0x92ec('0x5d')][_0x92ec('0x37')]({'plain':!![]});if(!_0x45239b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45239b[_0x92ec('0x5e')]===_0x92ec('0x5d')){var _0x34d2a4=_0x51f67d[_0x92ec('0x37')]({'plain':!![]});return db[_0x92ec('0x5f')]['find']({'where':{'name':_0x92ec('0x38'),'userProfileId':_0x45239b[_0x92ec('0x60')]},'raw':!![]})[_0x92ec('0x35')](function(_0x11c0a1){if(_0x11c0a1&&_0x11c0a1['autoAssociation']===0x0){return db['UserProfileResource'][_0x92ec('0x55')]({'name':_0x34d2a4['name'],'resourceId':_0x34d2a4['id'],'type':_0x11c0a1[_0x92ec('0x3a')],'sectionId':_0x11c0a1['id']},{})[_0x92ec('0x35')](function(){return _0x51f67d;});}else{return _0x51f67d;}})['catch'](function(_0x1edc0a){logger[_0x92ec('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1edc0a);throw _0x1edc0a;});}return _0x51f67d;})['then'](respondWithResult(_0x597302,0xc9))[_0x92ec('0x4f')](handleError(_0x597302,null));};exports[_0x92ec('0x61')]=function(_0x2d8450,_0x131b44,_0xb0bf43){var _0x396489;return db[_0x92ec('0x3d')][_0x92ec('0x54')]({'where':{'id':_0x2d8450[_0x92ec('0x51')]['id']}})[_0x92ec('0x35')](handleEntityNotFound(_0x131b44,null))['then'](saveUpdates(_0x2d8450[_0x92ec('0x62')],null))[_0x92ec('0x35')](function(_0x15a51d){if(_0x15a51d){_0x396489=_0x15a51d;return db['VoiceContext'][_0x92ec('0x4d')]({'raw':!![]});}})[_0x92ec('0x35')](function(_0x306301){var _0x4f031b=fs[_0x92ec('0x56')](path['join'](config[_0x92ec('0x58')],_0x92ec('0x63')),'utf8');var _0x530a45=ejs['render'](_0x4f031b,{'contexts':_0x306301||[]});fs['writeFileSync'](_0x92ec('0x5a'),_0x530a45);})[_0x92ec('0x35')](function(){return respondWithRpcPromise(_0x92ec('0x5b'),_0x92ec('0x61'),{'module':_0x92ec('0x5c')});})[_0x92ec('0x35')](function(){return _0x396489;})[_0x92ec('0x35')](respondWithResult(_0x131b44,null))['catch'](handleError(_0x131b44,null));};exports['destroy']=function(_0x117434,_0x449eb3,_0x437ab3){var _0x3fc5e1;return db[_0x92ec('0x3d')][_0x92ec('0x54')]({'where':{'id':_0x117434['params']['id']}})['then'](handleEntityNotFound(_0x449eb3,null))['then'](removeEntity(_0x449eb3,null))[_0x92ec('0x35')](function(){return db[_0x92ec('0x3d')][_0x92ec('0x4d')]({'raw':!![]});})['then'](function(_0x5d51f3){var _0x17247d=fs[_0x92ec('0x56')](path[_0x92ec('0x57')](config[_0x92ec('0x58')],_0x92ec('0x63')),_0x92ec('0x64'));var _0xdae9ba=ejs[_0x92ec('0x65')](_0x17247d,{'contexts':_0x5d51f3});fs[_0x92ec('0x59')](_0x92ec('0x5a'),_0xdae9ba);return respondWithRpcPromise('Reload','destroy',{'module':_0x92ec('0x5c')});})[_0x92ec('0x4f')](handleError(_0x449eb3,null));}; \ No newline at end of file +var _0x0df6=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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','request\x20sent','debug','error','code','VoiceContext,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','update','destroy','get','Contexts','UserProfileResource','end','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','role','user','UserProfileSection','userProfileId','chan_sip.so','html-pdf','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse'];(function(_0x31be63,_0x4430c7){var _0x3834fd=function(_0x44b0cd){while(--_0x44b0cd){_0x31be63['push'](_0x31be63['shift']());}};_0x3834fd(++_0x4430c7);}(_0x0df6,0x197));var _0x60df=function(_0x1f5a54,_0x1ad4ee){_0x1f5a54=_0x1f5a54-0x0;var _0x546903=_0x0df6[_0x1f5a54];return _0x546903;};'use strict';var pdf=require(_0x60df('0x0'));var emlformat=require(_0x60df('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x60df('0x2'));var rp=require(_0x60df('0x3'));var moment=require(_0x60df('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x60df('0x5'));var util=require(_0x60df('0x6'));var path=require(_0x60df('0x7'));var sox=require(_0x60df('0x8'));var csv=require('to-csv');var ejs=require(_0x60df('0x9'));var fs=require('fs');var _=require(_0x60df('0xa'));var squel=require(_0x60df('0xb'));var crypto=require(_0x60df('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x60df('0xd'));var toCsv=require(_0x60df('0xe'));var querystring=require(_0x60df('0xf'));var Papa=require(_0x60df('0x10'));var Redis=require(_0x60df('0x11'));var authService=require(_0x60df('0x12'));var qs=require(_0x60df('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x60df('0x14'));var logger=require(_0x60df('0x15'))(_0x60df('0x16'));var utils=require(_0x60df('0x17'));var config=require(_0x60df('0x18'));var db=require(_0x60df('0x19'))['db'];var jayson=require(_0x60df('0x1a'));var client=jayson[_0x60df('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x233b74,_0xbd4a9c,_0x4a0c32){if(_0x4a0c32){var _0x39ada8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x39ada8[_0x60df('0x1c')](_0xbd4a9c)){return _0x233b74;}else{throw new db[(_0x60df('0x1d'))]['ValidationError'](_0x60df('0x1e'));}}else{return _0x233b74;}}function respondWithRpcPromise(_0x31c1eb,_0xddc049,_0x451e7a,_0x2882a9){return new BPromise(function(_0x40075f,_0xa8b1dc){var _0x591579=_0x2882a9||client;return _0x591579[_0x60df('0x1f')](_0x31c1eb,_0x451e7a)[_0x60df('0x20')](function(_0x1b2853){logger[_0x60df('0x21')]('VoiceContext,\x20%s,\x20%s',_0xddc049,_0x60df('0x22'));logger[_0x60df('0x23')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0xddc049,'request\x20sent',JSON['stringify'](_0x1b2853));if(_0x1b2853[_0x60df('0x24')]){if(_0x1b2853['error'][_0x60df('0x25')]===0x1f4){logger[_0x60df('0x24')](_0x60df('0x26'),_0xddc049,_0x1b2853[_0x60df('0x24')][_0x60df('0x27')]);return _0xa8b1dc(_0x1b2853['error'][_0x60df('0x27')]);}logger[_0x60df('0x24')](_0x60df('0x26'),_0xddc049,_0x1b2853['error'][_0x60df('0x27')]);return _0x40075f(_0x1b2853[_0x60df('0x24')][_0x60df('0x27')]);}else{logger[_0x60df('0x21')]('VoiceContext,\x20%s,\x20%s',_0xddc049,_0x60df('0x22'));_0x40075f(_0x1b2853['result'][_0x60df('0x27')]);}})[_0x60df('0x28')](function(_0x4c5b59){logger[_0x60df('0x24')](_0x60df('0x26'),_0xddc049,_0x4c5b59);_0xa8b1dc(_0x4c5b59);});});}function respondWithStatusCode(_0x3c48ba,_0x141d4b){_0x141d4b=_0x141d4b||0xcc;return function(_0x335257){if(_0x335257){return _0x3c48ba[_0x60df('0x29')](_0x141d4b);}return _0x3c48ba[_0x60df('0x2a')](_0x141d4b)['end']();};}function respondWithResult(_0x33850c,_0x32d3d6){_0x32d3d6=_0x32d3d6||0xc8;return function(_0x25a5f5){if(_0x25a5f5){return _0x33850c['status'](_0x32d3d6)[_0x60df('0x2b')](_0x25a5f5);}};}function respondWithFilteredResult(_0x455337,_0x4fc76e){return function(_0x29abf2){if(_0x29abf2){var _0x4adc43=_0x29abf2['count'],_0x88368e=_0x4fc76e[_0x60df('0x2c')],_0x53ddbe=_0x4fc76e[_0x60df('0x2c')]+_0x4fc76e[_0x60df('0x2d')],_0x38e441;if(_0x53ddbe>=_0x4adc43){_0x53ddbe=_0x4adc43;_0x38e441=0xc8;}else{_0x38e441=0xce;}_0x455337[_0x60df('0x2a')](_0x38e441);return _0x455337[_0x60df('0x2e')](_0x60df('0x2f'),_0x88368e+'-'+_0x53ddbe+'/'+_0x4adc43)[_0x60df('0x2b')](_0x29abf2);}return null;};}function patchUpdates(_0xfcd698){return function(_0x25de85){try{jsonpatch[_0x60df('0x30')](_0x25de85,_0xfcd698,!![]);}catch(_0x297c52){return BPromise['reject'](_0x297c52);}return _0x25de85['save']();};}function saveUpdates(_0x3a40e7,_0x5335a7){return function(_0x180ffd){if(_0x180ffd){return _0x180ffd[_0x60df('0x31')](_0x3a40e7)[_0x60df('0x20')](function(_0x2280a7){return _0x2280a7;});}return null;};}function removeEntity(_0x3d2def,_0x31eb67){return function(_0x9f3626){if(_0x9f3626){return _0x9f3626[_0x60df('0x32')]()[_0x60df('0x20')](function(){var _0xf29584=_0x9f3626[_0x60df('0x33')]({'plain':!![]});var _0x58d8a7=_0x60df('0x34');return db[_0x60df('0x35')][_0x60df('0x32')]({'where':{'type':_0x58d8a7,'resourceId':_0xf29584['id']}})[_0x60df('0x20')](function(){return _0x9f3626;});})[_0x60df('0x20')](function(){_0x3d2def[_0x60df('0x2a')](0xcc)[_0x60df('0x36')]();});}};}function handleEntityNotFound(_0xff8aef,_0xed86cf){return function(_0x23642d){if(!_0x23642d){_0xff8aef['sendStatus'](0x194);}return _0x23642d;};}function handleError(_0x479f5e,_0x3c2265){_0x3c2265=_0x3c2265||0x1f4;return function(_0xf483c5){logger[_0x60df('0x24')](_0xf483c5[_0x60df('0x37')]);if(_0xf483c5['name']){delete _0xf483c5[_0x60df('0x38')];}_0x479f5e[_0x60df('0x2a')](_0x3c2265)[_0x60df('0x39')](_0xf483c5);};}exports[_0x60df('0x3a')]=function(_0x29b02c,_0x1d1309){var _0x30e199={},_0x2d0240={},_0x5b7f0a={'count':0x0,'rows':[]};var _0x39f6f5=_[_0x60df('0x3b')](db[_0x60df('0x3c')][_0x60df('0x3d')],function(_0x141dd9){return{'name':_0x141dd9[_0x60df('0x3e')],'type':_0x141dd9[_0x60df('0x3f')][_0x60df('0x40')]};});_0x2d0240[_0x60df('0x41')]=_['map'](_0x39f6f5,'name');_0x2d0240[_0x60df('0x42')]=_['keys'](_0x29b02c[_0x60df('0x42')]);_0x2d0240['filters']=_[_0x60df('0x43')](_0x2d0240['model'],_0x2d0240[_0x60df('0x42')]);_0x30e199['attributes']=_[_0x60df('0x43')](_0x2d0240[_0x60df('0x41')],qs['fields'](_0x29b02c[_0x60df('0x42')][_0x60df('0x44')]));_0x30e199[_0x60df('0x45')]=_0x30e199[_0x60df('0x45')][_0x60df('0x46')]?_0x30e199[_0x60df('0x45')]:_0x2d0240[_0x60df('0x41')];if(!_0x29b02c[_0x60df('0x42')][_0x60df('0x47')](_0x60df('0x48'))){_0x30e199[_0x60df('0x2d')]=qs[_0x60df('0x2d')](_0x29b02c['query'][_0x60df('0x2d')]);_0x30e199[_0x60df('0x2c')]=qs[_0x60df('0x2c')](_0x29b02c[_0x60df('0x42')]['offset']);}_0x30e199[_0x60df('0x49')]=qs[_0x60df('0x4a')](_0x29b02c[_0x60df('0x42')][_0x60df('0x4a')]);_0x30e199[_0x60df('0x4b')]=qs[_0x60df('0x4c')](_[_0x60df('0x4d')](_0x29b02c[_0x60df('0x42')],_0x2d0240[_0x60df('0x4c')]));if(_0x29b02c['query'][_0x60df('0x4e')]){_0x30e199[_0x60df('0x4b')]=_['merge'](_0x30e199[_0x60df('0x4b')],{'$or':_['map'](_0x39f6f5,function(_0x125cf2){if(_0x125cf2[_0x60df('0x3f')]!=='VIRTUAL'){var _0x19cd9e={};_0x19cd9e[_0x125cf2[_0x60df('0x38')]]={'$like':'%'+_0x29b02c[_0x60df('0x42')][_0x60df('0x4e')]+'%'};return _0x19cd9e;}})});}_0x30e199=_[_0x60df('0x4f')]({},_0x30e199,_0x29b02c['options']);var _0xbda0d8={'where':_0x30e199[_0x60df('0x4b')]};return db[_0x60df('0x3c')][_0x60df('0x50')](_0xbda0d8)[_0x60df('0x20')](function(_0x35583a){_0x5b7f0a[_0x60df('0x50')]=_0x35583a;if(_0x29b02c[_0x60df('0x42')][_0x60df('0x51')]){_0x30e199[_0x60df('0x52')]=[{'all':!![]}];}return db[_0x60df('0x3c')][_0x60df('0x53')](_0x30e199);})[_0x60df('0x20')](function(_0x391d0c){_0x5b7f0a[_0x60df('0x54')]=_0x391d0c;return _0x5b7f0a;})[_0x60df('0x20')](respondWithFilteredResult(_0x1d1309,_0x30e199))[_0x60df('0x28')](handleError(_0x1d1309,null));};exports[_0x60df('0x55')]=function(_0x308628,_0x1997b9){var _0x52888a={'raw':![],'where':{'id':_0x308628[_0x60df('0x56')]['id']}},_0x457abc={};_0x457abc[_0x60df('0x41')]=_[_0x60df('0x57')](db['VoiceContext'][_0x60df('0x3d')]);_0x457abc[_0x60df('0x42')]=_['keys'](_0x308628['query']);_0x457abc[_0x60df('0x4c')]=_[_0x60df('0x43')](_0x457abc[_0x60df('0x41')],_0x457abc[_0x60df('0x42')]);_0x52888a[_0x60df('0x45')]=_['intersection'](_0x457abc[_0x60df('0x41')],qs['fields'](_0x308628[_0x60df('0x42')][_0x60df('0x44')]));_0x52888a[_0x60df('0x45')]=_0x52888a[_0x60df('0x45')][_0x60df('0x46')]?_0x52888a[_0x60df('0x45')]:_0x457abc[_0x60df('0x41')];if(_0x308628['query'][_0x60df('0x51')]){_0x52888a['include']=[{'all':!![]}];}_0x52888a=_['merge']({},_0x52888a,_0x308628[_0x60df('0x58')]);return db[_0x60df('0x3c')][_0x60df('0x59')](_0x52888a)[_0x60df('0x20')](handleEntityNotFound(_0x1997b9,null))[_0x60df('0x20')](respondWithResult(_0x1997b9,null))[_0x60df('0x28')](handleError(_0x1997b9,null));};exports['create']=function(_0x1f1bf8,_0x4015a1,_0x1573d0){var _0x3c3d6c;return db[_0x60df('0x3c')][_0x60df('0x5a')](_0x1f1bf8[_0x60df('0x5b')],{'raw':!![]})['then'](function(_0x80ba64){_0x3c3d6c=_0x80ba64;return db[_0x60df('0x3c')][_0x60df('0x53')]({'raw':!![]});})[_0x60df('0x20')](function(_0x1dbbd7){var _0x3bc7bb=fs[_0x60df('0x5c')](path[_0x60df('0x5d')](config[_0x60df('0x5e')],_0x60df('0x5f')),_0x60df('0x60'));var _0x57ddc3=ejs[_0x60df('0x61')](_0x3bc7bb,{'contexts':_0x1dbbd7||[]});fs[_0x60df('0x62')](_0x60df('0x63'),_0x57ddc3);})[_0x60df('0x20')](function(){return respondWithRpcPromise(_0x60df('0x64'),_0x60df('0x5a'),{'module':'chan_sip.so'});})['then'](function(){var _0x1620d1=_0x1f1bf8['user'][_0x60df('0x33')]({'plain':!![]});if(!_0x1620d1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1620d1[_0x60df('0x65')]===_0x60df('0x66')){var _0x281f9c=_0x3c3d6c[_0x60df('0x33')]({'plain':!![]});return db[_0x60df('0x67')][_0x60df('0x59')]({'where':{'name':_0x60df('0x34'),'userProfileId':_0x1620d1[_0x60df('0x68')]},'raw':!![]})[_0x60df('0x20')](function(_0x28431f){if(_0x28431f&&_0x28431f['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x281f9c[_0x60df('0x38')],'resourceId':_0x281f9c['id'],'type':_0x28431f[_0x60df('0x38')],'sectionId':_0x28431f['id']},{})[_0x60df('0x20')](function(){return _0x3c3d6c;});}else{return _0x3c3d6c;}})[_0x60df('0x28')](function(_0x26992c){logger[_0x60df('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x26992c);throw _0x26992c;});}return _0x3c3d6c;})[_0x60df('0x20')](respondWithResult(_0x4015a1,0xc9))[_0x60df('0x28')](handleError(_0x4015a1,null));};exports[_0x60df('0x31')]=function(_0x13d670,_0x395eeb,_0x263f46){var _0x36e79a;return db[_0x60df('0x3c')]['find']({'where':{'id':_0x13d670[_0x60df('0x56')]['id']}})[_0x60df('0x20')](handleEntityNotFound(_0x395eeb,null))[_0x60df('0x20')](saveUpdates(_0x13d670['body'],null))[_0x60df('0x20')](function(_0x419df7){if(_0x419df7){_0x36e79a=_0x419df7;return db[_0x60df('0x3c')]['findAll']({'raw':!![]});}})[_0x60df('0x20')](function(_0x217910){var _0x2dcda8=fs['readFileSync'](path[_0x60df('0x5d')](config[_0x60df('0x5e')],'server/files/templates/context.ejs'),_0x60df('0x60'));var _0x3f4ab0=ejs[_0x60df('0x61')](_0x2dcda8,{'contexts':_0x217910||[]});fs[_0x60df('0x62')](_0x60df('0x63'),_0x3f4ab0);})[_0x60df('0x20')](function(){return respondWithRpcPromise(_0x60df('0x64'),_0x60df('0x31'),{'module':_0x60df('0x69')});})[_0x60df('0x20')](function(){return _0x36e79a;})[_0x60df('0x20')](respondWithResult(_0x395eeb,null))[_0x60df('0x28')](handleError(_0x395eeb,null));};exports[_0x60df('0x32')]=function(_0x5b5cfd,_0x39856b,_0x46caec){var _0x364131;return db[_0x60df('0x3c')][_0x60df('0x59')]({'where':{'id':_0x5b5cfd['params']['id']}})['then'](handleEntityNotFound(_0x39856b,null))['then'](removeEntity(_0x39856b,null))['then'](function(){return db['VoiceContext'][_0x60df('0x53')]({'raw':!![]});})[_0x60df('0x20')](function(_0x2b8410){var _0x456790=fs[_0x60df('0x5c')](path[_0x60df('0x5d')](config[_0x60df('0x5e')],'server/files/templates/context.ejs'),_0x60df('0x60'));var _0x34d54f=ejs[_0x60df('0x61')](_0x456790,{'contexts':_0x2b8410});fs[_0x60df('0x62')](_0x60df('0x63'),_0x34d54f);return respondWithRpcPromise(_0x60df('0x64'),_0x60df('0x32'),{'module':'chan_sip.so'});})[_0x60df('0x28')](handleError(_0x39856b,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c1261db..98cb87e 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 _0x6eba=['moment','rimraf','exports','define','VoiceContext','voice_contexts','lodash','util','api'];(function(_0x23ab37,_0xa87ac7){var _0x1ecc49=function(_0x601a89){while(--_0x601a89){_0x23ab37['push'](_0x23ab37['shift']());}};_0x1ecc49(++_0xa87ac7);}(_0x6eba,0x180));var _0xa6eb=function(_0x455871,_0x17fa9e){_0x455871=_0x455871-0x0;var _0x3cce32=_0x6eba[_0x455871];return _0x3cce32;};'use strict';var _=require(_0xa6eb('0x0'));var util=require(_0xa6eb('0x1'));var logger=require('../../config/logger')(_0xa6eb('0x2'));var moment=require(_0xa6eb('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa6eb('0x4'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module[_0xa6eb('0x5')]=function(_0x30c36c,_0x3c8101){return _0x30c36c[_0xa6eb('0x6')](_0xa6eb('0x7'),attributes,{'tableName':_0xa6eb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf462=['voice_contexts','util','api','moment','bluebird','request-promise','../../config/environment','./voiceContext.attributes','exports','define'];(function(_0x5eab44,_0x1e2e1e){var _0x5bb117=function(_0x30a75a){while(--_0x30a75a){_0x5eab44['push'](_0x5eab44['shift']());}};_0x5bb117(++_0x1e2e1e);}(_0xf462,0x97));var _0x2f46=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xf462[_0xd816e2];return _0x1f5924;};'use strict';var _=require('lodash');var util=require(_0x2f46('0x0'));var logger=require('../../config/logger')(_0x2f46('0x1'));var moment=require(_0x2f46('0x2'));var BPromise=require(_0x2f46('0x3'));var rp=require(_0x2f46('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2f46('0x5'));var attributes=require(_0x2f46('0x6'));module[_0x2f46('0x7')]=function(_0xb4abbc,_0x1c90c8){return _0xb4abbc[_0x2f46('0x8')]('VoiceContext',attributes,{'tableName':_0x2f46('0x9'),'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 690332f..ecdb554 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 _0x37ca=['then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x3e3e1f,_0x576859){var _0x2d357c=function(_0x2b4479){while(--_0x2b4479){_0x3e3e1f['push'](_0x3e3e1f['shift']());}};_0x2d357c(++_0x576859);}(_0x37ca,0x112));var _0xa37c=function(_0x30a3bb,_0x4c6979){_0x30a3bb=_0x30a3bb-0x0;var _0x4ffb15=_0x37ca[_0x30a3bb];return _0x4ffb15;};'use strict';var _=require(_0xa37c('0x0'));var util=require(_0xa37c('0x1'));var moment=require(_0xa37c('0x2'));var BPromise=require('bluebird');var rs=require(_0xa37c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa37c('0x4'))['db'];var utils=require(_0xa37c('0x5'));var logger=require(_0xa37c('0x6'))(_0xa37c('0x7'));var config=require(_0xa37c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa37c('0x9')][_0xa37c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c628f,_0xb756e9,_0xd08583){return new BPromise(function(_0x352793,_0x2dde95){return client[_0xa37c('0xb')](_0x2c628f,_0xd08583)[_0xa37c('0xc')](function(_0x933e21){logger[_0xa37c('0xd')](_0xa37c('0xe'),_0xb756e9,_0xa37c('0xf'));logger[_0xa37c('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0xb756e9,_0xa37c('0xf'),JSON[_0xa37c('0x11')](_0x933e21));if(_0x933e21['error']){if(_0x933e21[_0xa37c('0x12')]['code']===0x1f4){logger[_0xa37c('0x12')](_0xa37c('0xe'),_0xb756e9,_0x933e21['error'][_0xa37c('0x13')]);return _0x2dde95(_0x933e21['error'][_0xa37c('0x13')]);}logger['error'](_0xa37c('0xe'),_0xb756e9,_0x933e21[_0xa37c('0x12')][_0xa37c('0x13')]);return _0x352793(_0x933e21[_0xa37c('0x12')][_0xa37c('0x13')]);}else{logger[_0xa37c('0xd')]('VoiceContext,\x20%s,\x20%s',_0xb756e9,_0xa37c('0xf'));_0x352793(_0x933e21[_0xa37c('0x14')][_0xa37c('0x13')]);}})[_0xa37c('0x15')](function(_0x4e0c1a){logger[_0xa37c('0x12')]('VoiceContext,\x20%s,\x20%s',_0xb756e9,_0x4e0c1a);_0x2dde95(_0x4e0c1a);});});} \ No newline at end of file +var _0x33bc=['request','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x33bc,0x1e5));var _0xc33b=function(_0x5ca5cb,_0x35c5b0){_0x5ca5cb=_0x5ca5cb-0x0;var _0x2ae967=_0x33bc[_0x5ca5cb];return _0x2ae967;};'use strict';var _=require(_0xc33b('0x0'));var util=require(_0xc33b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc33b('0x2'));var fs=require('fs');var Redis=require(_0xc33b('0x3'));var db=require(_0xc33b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc33b('0x5'));var config=require(_0xc33b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc33b('0x7')][_0xc33b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38483c,_0x10bbaa,_0x30a5e6){return new BPromise(function(_0x26542e,_0x2f1f06){return client[_0xc33b('0x9')](_0x38483c,_0x30a5e6)['then'](function(_0xfd9b0f){logger['info'](_0xc33b('0xa'),_0x10bbaa,_0xc33b('0xb'));logger[_0xc33b('0xc')](_0xc33b('0xd'),_0x10bbaa,_0xc33b('0xb'),JSON[_0xc33b('0xe')](_0xfd9b0f));if(_0xfd9b0f[_0xc33b('0xf')]){if(_0xfd9b0f[_0xc33b('0xf')][_0xc33b('0x10')]===0x1f4){logger[_0xc33b('0xf')](_0xc33b('0xa'),_0x10bbaa,_0xfd9b0f[_0xc33b('0xf')][_0xc33b('0x11')]);return _0x2f1f06(_0xfd9b0f[_0xc33b('0xf')][_0xc33b('0x11')]);}logger[_0xc33b('0xf')](_0xc33b('0xa'),_0x10bbaa,_0xfd9b0f[_0xc33b('0xf')]['message']);return _0x26542e(_0xfd9b0f['error'][_0xc33b('0x11')]);}else{logger['info'](_0xc33b('0xa'),_0x10bbaa,'request\x20sent');_0x26542e(_0xfd9b0f['result']['message']);}})[_0xc33b('0x12')](function(_0x2ec8ef){logger[_0xc33b('0xf')]('VoiceContext,\x20%s,\x20%s',_0x10bbaa,_0x2ec8ef);_0x2f1f06(_0x2ec8ef);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index b36a7dd..e140adb 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 _0xeca2=['post','create','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x46ab1a,_0x1b5cb2){var _0x4a0afd=function(_0xc7746f){while(--_0xc7746f){_0x46ab1a['push'](_0x46ab1a['shift']());}};_0x4a0afd(++_0x1b5cb2);}(_0xeca2,0x83));var _0x2eca=function(_0xab36f5,_0x8eb92a){_0xab36f5=_0xab36f5-0x0;var _0x20c769=_0xeca2[_0xab36f5];return _0x20c769;};'use strict';var multer=require('multer');var util=require(_0x2eca('0x0'));var path=require('path');var timeout=require(_0x2eca('0x1'));var express=require(_0x2eca('0x2'));var router=express[_0x2eca('0x3')]();var auth=require(_0x2eca('0x4'));var interaction=require(_0x2eca('0x5'));var config=require('../../config/environment');var controller=require(_0x2eca('0x6'));router[_0x2eca('0x7')]('/',auth[_0x2eca('0x8')](),controller[_0x2eca('0x9')]);router[_0x2eca('0x7')](_0x2eca('0xa'),auth[_0x2eca('0x8')](),controller[_0x2eca('0xb')]);router['get'](_0x2eca('0xc'),auth[_0x2eca('0x8')](),controller['show']);router[_0x2eca('0xd')]('/',auth['isAuthenticated'](),controller[_0x2eca('0xe')]);router['put'](_0x2eca('0xc'),auth[_0x2eca('0x8')](),controller['update']);router[_0x2eca('0xf')](_0x2eca('0xc'),auth[_0x2eca('0x8')](),controller[_0x2eca('0x10')]);module[_0x2eca('0x11')]=router; \ No newline at end of file +var _0xd970=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xd970,0x82));var _0x0d97=function(_0x2ae662,_0x31931e){_0x2ae662=_0x2ae662-0x0;var _0x1181b7=_0xd970[_0x2ae662];return _0x1181b7;};'use strict';var multer=require(_0x0d97('0x0'));var util=require('util');var path=require(_0x0d97('0x1'));var timeout=require(_0x0d97('0x2'));var express=require(_0x0d97('0x3'));var router=express['Router']();var auth=require(_0x0d97('0x4'));var interaction=require(_0x0d97('0x5'));var config=require('../../config/environment');var controller=require(_0x0d97('0x6'));router[_0x0d97('0x7')]('/',auth[_0x0d97('0x8')](),controller[_0x0d97('0x9')]);router[_0x0d97('0x7')]('/describe',auth[_0x0d97('0x8')](),controller[_0x0d97('0xa')]);router[_0x0d97('0x7')](_0x0d97('0xb'),auth[_0x0d97('0x8')](),controller[_0x0d97('0xc')]);router[_0x0d97('0xd')]('/',auth[_0x0d97('0x8')](),controller[_0x0d97('0xe')]);router[_0x0d97('0xf')](_0x0d97('0xb'),auth[_0x0d97('0x8')](),controller[_0x0d97('0x10')]);router[_0x0d97('0x11')]('/:id',auth[_0x0d97('0x8')](),controller[_0x0d97('0x12')]);module[_0x0d97('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 3eb5f15..6c1bb34 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 _0x5f30=['INTEGER','DATE','called,connect,complete','sequelize','STRING'];(function(_0x46686a,_0x3790f8){var _0x5d267a=function(_0x36dbeb){while(--_0x36dbeb){_0x46686a['push'](_0x46686a['shift']());}};_0x5d267a(++_0x3790f8);}(_0x5f30,0x12a));var _0x05f3=function(_0x561c8c,_0x22bc00){_0x561c8c=_0x561c8c-0x0;var _0x277e5d=_0x5f30[_0x561c8c];return _0x277e5d;};'use strict';var Sequelize=require(_0x05f3('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x05f3('0x1')]},'channel':{'type':Sequelize[_0x05f3('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x05f3('0x1')]},'calleridname':{'type':Sequelize[_0x05f3('0x1')]},'connectedlinenum':{'type':Sequelize[_0x05f3('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x05f3('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x05f3('0x1')]},'destchannelstate':{'type':Sequelize[_0x05f3('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x05f3('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x05f3('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x05f3('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x05f3('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x05f3('0x1')]},'destcontext':{'type':Sequelize[_0x05f3('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x05f3('0x2')]},'destuniqueid':{'type':Sequelize[_0x05f3('0x1')]},'destlinkedid':{'type':Sequelize[_0x05f3('0x1')]},'dialstring':{'type':Sequelize[_0x05f3('0x1')]},'dialstatus':{'type':Sequelize[_0x05f3('0x1')]},'starttime':{'type':Sequelize[_0x05f3('0x3')]},'answertime':{'type':Sequelize[_0x05f3('0x3')]},'endtime':{'type':Sequelize[_0x05f3('0x3')]},'lastevent':{'type':Sequelize[_0x05f3('0x1')],'comment':_0x05f3('0x4')},'routeId':{'type':Sequelize[_0x05f3('0x2')]},'duration':{'type':Sequelize[_0x05f3('0x2')]},'holdtime':{'type':Sequelize[_0x05f3('0x2')]},'billableseconds':{'type':Sequelize[_0x05f3('0x2')]}}; \ No newline at end of file +var _0x4454=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x280fa0,_0x16af25){var _0x4fbb48=function(_0x4fb494){while(--_0x4fb494){_0x280fa0['push'](_0x280fa0['shift']());}};_0x4fbb48(++_0x16af25);}(_0x4454,0x1ab));var _0x4445=function(_0x326736,_0x56952d){_0x326736=_0x326736-0x0;var _0x147679=_0x4454[_0x326736];return _0x147679;};'use strict';var Sequelize=require(_0x4445('0x0'));module[_0x4445('0x1')]={'privilege':{'type':Sequelize[_0x4445('0x2')]},'channel':{'type':Sequelize[_0x4445('0x2')]},'channelstate':{'type':Sequelize[_0x4445('0x3')]},'channelstatedesc':{'type':Sequelize[_0x4445('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4445('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x4445('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4445('0x2')]},'context':{'type':Sequelize[_0x4445('0x2')]},'exten':{'type':Sequelize[_0x4445('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x4445('0x2')]},'linkedid':{'type':Sequelize[_0x4445('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x4445('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x4445('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4445('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x4445('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4445('0x2')]},'destlanguage':{'type':Sequelize[_0x4445('0x2')]},'destaccountcode':{'type':Sequelize[_0x4445('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x4445('0x2')]},'destlinkedid':{'type':Sequelize[_0x4445('0x2')]},'dialstring':{'type':Sequelize[_0x4445('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4445('0x4')]},'answertime':{'type':Sequelize[_0x4445('0x4')]},'endtime':{'type':Sequelize[_0x4445('0x4')]},'lastevent':{'type':Sequelize[_0x4445('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x4445('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x4445('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 2f94d48..99edd85 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 _0x667f=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','desk.js','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','html-pdf','eml-format','rimraf'];(function(_0x1f76ff,_0xd47cbe){var _0x8f87a0=function(_0x54838f){while(--_0x54838f){_0x1f76ff['push'](_0x1f76ff['shift']());}};_0x8f87a0(++_0xd47cbe);}(_0x667f,0x8d));var _0xf667=function(_0x4476f2,_0x3f5c4b){_0x4476f2=_0x4476f2-0x0;var _0x2b7018=_0x667f[_0x4476f2];return _0x2b7018;};'use strict';var pdf=require(_0xf667('0x0'));var emlformat=require(_0xf667('0x1'));var rimraf=require(_0xf667('0x2'));var zipdir=require(_0xf667('0x3'));var jsonpatch=require(_0xf667('0x4'));var rp=require('request-promise');var moment=require(_0xf667('0x5'));var BPromise=require(_0xf667('0x6'));var Mustache=require(_0xf667('0x7'));var util=require(_0xf667('0x8'));var path=require('path');var sox=require(_0xf667('0x9'));var csv=require(_0xf667('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf667('0xb'));var crypto=require(_0xf667('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf667('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf667('0xe'));var authService=require(_0xf667('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf667('0x10'));var utils=require(_0xf667('0x11'));var config=require(_0xf667('0x12'));var db=require(_0xf667('0x13'))['db'];function respondWithStatusCode(_0x212fea,_0x5415c3){_0x5415c3=_0x5415c3||0xcc;return function(_0x21e78b){if(_0x21e78b){return _0x212fea[_0xf667('0x14')](_0x5415c3);}return _0x212fea['status'](_0x5415c3)[_0xf667('0x15')]();};}function respondWithResult(_0x2fe06f,_0x2440f3){_0x2440f3=_0x2440f3||0xc8;return function(_0x3d2f31){if(_0x3d2f31){return _0x2fe06f[_0xf667('0x16')](_0x2440f3)[_0xf667('0x17')](_0x3d2f31);}};}function respondWithFilteredResult(_0x4fe106,_0x1e741a){return function(_0x7f7511){if(_0x7f7511){var _0x422cfc=_0x7f7511[_0xf667('0x18')],_0x46595c=_0x1e741a[_0xf667('0x19')],_0x11391a=_0x1e741a[_0xf667('0x19')]+_0x1e741a[_0xf667('0x1a')],_0x328140;if(_0x11391a>=_0x422cfc){_0x11391a=_0x422cfc;_0x328140=0xc8;}else{_0x328140=0xce;}_0x4fe106[_0xf667('0x16')](_0x328140);return _0x4fe106['set'](_0xf667('0x1b'),_0x46595c+'-'+_0x11391a+'/'+_0x422cfc)['json'](_0x7f7511);}return null;};}function patchUpdates(_0x3f107b){return function(_0x3b8175){try{jsonpatch['apply'](_0x3b8175,_0x3f107b,!![]);}catch(_0x44d17b){return BPromise[_0xf667('0x1c')](_0x44d17b);}return _0x3b8175[_0xf667('0x1d')]();};}function saveUpdates(_0x309c64,_0x1dab6d){return function(_0x5b3c0b){if(_0x5b3c0b){return _0x5b3c0b['update'](_0x309c64)['then'](function(_0x2d4078){return _0x2d4078;});}return null;};}function removeEntity(_0x3f12e3,_0x4ca424){return function(_0x4fd7fc){if(_0x4fd7fc){return _0x4fd7fc[_0xf667('0x1e')]()['then'](function(){_0x3f12e3['status'](0xcc)[_0xf667('0x15')]();});}};}function handleEntityNotFound(_0x226c1e,_0x41b352){return function(_0x4455f0){if(!_0x4455f0){_0x226c1e[_0xf667('0x14')](0x194);}return _0x4455f0;};}function handleError(_0x155a27,_0x230d7a){_0x230d7a=_0x230d7a||0x1f4;return function(_0x26fc5d){logger[_0xf667('0x1f')](_0x26fc5d[_0xf667('0x20')]);if(_0x26fc5d[_0xf667('0x21')]){delete _0x26fc5d[_0xf667('0x21')];}_0x155a27['status'](_0x230d7a)[_0xf667('0x22')](_0x26fc5d);};}exports[_0xf667('0x23')]=function(_0x40b475,_0x575dbc){var _0x2a865d={},_0x13b8cd={},_0x18a416={'count':0x0,'rows':[]};var _0x146526=_[_0xf667('0x24')](db[_0xf667('0x25')][_0xf667('0x26')],function(_0x49223b){return{'name':_0x49223b[_0xf667('0x27')],'type':_0x49223b[_0xf667('0x28')]['key']};});_0x13b8cd['model']=_[_0xf667('0x24')](_0x146526,'name');_0x13b8cd[_0xf667('0x29')]=_[_0xf667('0x2a')](_0x40b475['query']);_0x13b8cd[_0xf667('0x2b')]=_[_0xf667('0x2c')](_0x13b8cd[_0xf667('0x2d')],_0x13b8cd[_0xf667('0x29')]);_0x2a865d[_0xf667('0x2e')]=_[_0xf667('0x2c')](_0x13b8cd['model'],qs['fields'](_0x40b475['query'][_0xf667('0x2f')]));_0x2a865d[_0xf667('0x2e')]=_0x2a865d[_0xf667('0x2e')][_0xf667('0x30')]?_0x2a865d[_0xf667('0x2e')]:_0x13b8cd[_0xf667('0x2d')];if(!_0x40b475[_0xf667('0x29')][_0xf667('0x31')](_0xf667('0x32'))){_0x2a865d['limit']=qs['limit'](_0x40b475[_0xf667('0x29')]['limit']);_0x2a865d[_0xf667('0x19')]=qs[_0xf667('0x19')](_0x40b475[_0xf667('0x29')][_0xf667('0x19')]);}_0x2a865d[_0xf667('0x33')]=qs['sort'](_0x40b475[_0xf667('0x29')][_0xf667('0x34')]);_0x2a865d[_0xf667('0x35')]=qs[_0xf667('0x2b')](_[_0xf667('0x36')](_0x40b475[_0xf667('0x29')],_0x13b8cd[_0xf667('0x2b')]));if(_0x40b475[_0xf667('0x29')][_0xf667('0x37')]){_0x2a865d[_0xf667('0x35')]=_[_0xf667('0x38')](_0x2a865d[_0xf667('0x35')],{'$or':_[_0xf667('0x24')](_0x146526,function(_0x44a11f){if(_0x44a11f[_0xf667('0x28')]!==_0xf667('0x39')){var _0x41dfbb={};_0x41dfbb[_0x44a11f['name']]={'$like':'%'+_0x40b475[_0xf667('0x29')][_0xf667('0x37')]+'%'};return _0x41dfbb;}})});}_0x2a865d=_[_0xf667('0x38')]({},_0x2a865d,_0x40b475[_0xf667('0x3a')]);var _0x1e9896={'where':_0x2a865d[_0xf667('0x35')]};return db[_0xf667('0x25')]['count'](_0x1e9896)[_0xf667('0x3b')](function(_0x2b71f7){_0x18a416['count']=_0x2b71f7;if(_0x40b475[_0xf667('0x29')][_0xf667('0x3c')]){_0x2a865d[_0xf667('0x3d')]=[{'all':!![]}];}return db[_0xf667('0x25')][_0xf667('0x3e')](_0x2a865d);})[_0xf667('0x3b')](function(_0x6cbe02){_0x18a416[_0xf667('0x3f')]=_0x6cbe02;return _0x18a416;})[_0xf667('0x3b')](respondWithFilteredResult(_0x575dbc,_0x2a865d))[_0xf667('0x40')](handleError(_0x575dbc,null));};exports[_0xf667('0x41')]=function(_0x3f1ca9,_0xeec665){var _0x3c6433={'raw':!![],'where':{'id':_0x3f1ca9[_0xf667('0x42')]['id']}},_0x113c1e={};_0x113c1e[_0xf667('0x2d')]=_['keys'](db[_0xf667('0x25')]['rawAttributes']);_0x113c1e[_0xf667('0x29')]=_[_0xf667('0x2a')](_0x3f1ca9[_0xf667('0x29')]);_0x113c1e[_0xf667('0x2b')]=_[_0xf667('0x2c')](_0x113c1e[_0xf667('0x2d')],_0x113c1e[_0xf667('0x29')]);_0x3c6433[_0xf667('0x2e')]=_['intersection'](_0x113c1e[_0xf667('0x2d')],qs[_0xf667('0x2f')](_0x3f1ca9['query'][_0xf667('0x2f')]));_0x3c6433['attributes']=_0x3c6433['attributes'][_0xf667('0x30')]?_0x3c6433[_0xf667('0x2e')]:_0x113c1e[_0xf667('0x2d')];if(_0x3f1ca9[_0xf667('0x29')][_0xf667('0x3c')]){_0x3c6433['include']=[{'all':!![]}];}_0x3c6433=_[_0xf667('0x38')]({},_0x3c6433,_0x3f1ca9[_0xf667('0x3a')]);return db[_0xf667('0x25')]['find'](_0x3c6433)[_0xf667('0x3b')](handleEntityNotFound(_0xeec665,null))[_0xf667('0x3b')](respondWithResult(_0xeec665,null))[_0xf667('0x40')](handleError(_0xeec665,null));};exports['create']=function(_0x47bb39,_0x1a5ec2){return db['VoiceDialReport'][_0xf667('0x43')](_0x47bb39[_0xf667('0x44')],{})[_0xf667('0x3b')](respondWithResult(_0x1a5ec2,0xc9))[_0xf667('0x40')](handleError(_0x1a5ec2,null));};exports[_0xf667('0x45')]=function(_0x1c3707,_0x4174f9){if(_0x1c3707[_0xf667('0x44')]['id']){delete _0x1c3707[_0xf667('0x44')]['id'];}return db['VoiceDialReport'][_0xf667('0x46')]({'where':{'id':_0x1c3707[_0xf667('0x42')]['id']}})[_0xf667('0x3b')](handleEntityNotFound(_0x4174f9,null))[_0xf667('0x3b')](saveUpdates(_0x1c3707['body'],null))[_0xf667('0x3b')](respondWithResult(_0x4174f9,null))[_0xf667('0x40')](handleError(_0x4174f9,null));};exports[_0xf667('0x1e')]=function(_0x958dc3,_0x2e428a){return db[_0xf667('0x25')][_0xf667('0x46')]({'where':{'id':_0x958dc3[_0xf667('0x42')]['id']}})[_0xf667('0x3b')](handleEntityNotFound(_0x2e428a,null))[_0xf667('0x3b')](removeEntity(_0x2e428a,null))[_0xf667('0x40')](handleError(_0x2e428a,null));};exports[_0xf667('0x47')]=function(_0x19f580,_0x39d50a){return db[_0xf667('0x25')]['describe']()[_0xf667('0x3b')](respondWithResult(_0x39d50a,null))[_0xf667('0x40')](handleError(_0x39d50a,null));}; \ No newline at end of file +var _0xd168=['fields','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','end','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','intersection'];(function(_0x5d8b05,_0x3fe969){var _0x24b9b5=function(_0x1b5d9f){while(--_0x1b5d9f){_0x5d8b05['push'](_0x5d8b05['shift']());}};_0x24b9b5(++_0x3fe969);}(_0xd168,0xf1));var _0x8d16=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xd168[_0x24061a];return _0x82054e;};'use strict';var pdf=require(_0x8d16('0x0'));var emlformat=require(_0x8d16('0x1'));var rimraf=require(_0x8d16('0x2'));var zipdir=require(_0x8d16('0x3'));var jsonpatch=require(_0x8d16('0x4'));var rp=require(_0x8d16('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8d16('0x6'));var path=require('path');var sox=require(_0x8d16('0x7'));var csv=require(_0x8d16('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8d16('0x9'));var squel=require(_0x8d16('0xa'));var crypto=require(_0x8d16('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8d16('0xc'));var toCsv=require(_0x8d16('0x8'));var querystring=require(_0x8d16('0xd'));var Papa=require(_0x8d16('0xe'));var Redis=require(_0x8d16('0xf'));var authService=require(_0x8d16('0x10'));var qs=require(_0x8d16('0x11'));var as=require(_0x8d16('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8d16('0x13'));var utils=require(_0x8d16('0x14'));var config=require(_0x8d16('0x15'));var db=require(_0x8d16('0x16'))['db'];function respondWithStatusCode(_0x50df69,_0x1657fe){_0x1657fe=_0x1657fe||0xcc;return function(_0x2e0797){if(_0x2e0797){return _0x50df69['sendStatus'](_0x1657fe);}return _0x50df69[_0x8d16('0x17')](_0x1657fe)['end']();};}function respondWithResult(_0x52b6f2,_0x1cebd7){_0x1cebd7=_0x1cebd7||0xc8;return function(_0x1b2b67){if(_0x1b2b67){return _0x52b6f2[_0x8d16('0x17')](_0x1cebd7)[_0x8d16('0x18')](_0x1b2b67);}};}function respondWithFilteredResult(_0x2f0a8a,_0x42e001){return function(_0x41b6d5){if(_0x41b6d5){var _0x60293d=_0x41b6d5[_0x8d16('0x19')],_0x124d83=_0x42e001[_0x8d16('0x1a')],_0x3057bf=_0x42e001[_0x8d16('0x1a')]+_0x42e001[_0x8d16('0x1b')],_0x2c5dc2;if(_0x3057bf>=_0x60293d){_0x3057bf=_0x60293d;_0x2c5dc2=0xc8;}else{_0x2c5dc2=0xce;}_0x2f0a8a['status'](_0x2c5dc2);return _0x2f0a8a[_0x8d16('0x1c')]('Content-Range',_0x124d83+'-'+_0x3057bf+'/'+_0x60293d)[_0x8d16('0x18')](_0x41b6d5);}return null;};}function patchUpdates(_0x2bd7cd){return function(_0x1a1d5f){try{jsonpatch[_0x8d16('0x1d')](_0x1a1d5f,_0x2bd7cd,!![]);}catch(_0x4b72f7){return BPromise[_0x8d16('0x1e')](_0x4b72f7);}return _0x1a1d5f[_0x8d16('0x1f')]();};}function saveUpdates(_0x5229db,_0x4029ac){return function(_0x59fbf3){if(_0x59fbf3){return _0x59fbf3[_0x8d16('0x20')](_0x5229db)['then'](function(_0x2088b4){return _0x2088b4;});}return null;};}function removeEntity(_0xc8fd4f,_0x4312d4){return function(_0x492272){if(_0x492272){return _0x492272[_0x8d16('0x21')]()[_0x8d16('0x22')](function(){_0xc8fd4f['status'](0xcc)[_0x8d16('0x23')]();});}};}function handleEntityNotFound(_0x527faf,_0x47c610){return function(_0x306dd7){if(!_0x306dd7){_0x527faf['sendStatus'](0x194);}return _0x306dd7;};}function handleError(_0x49ef1c,_0x59fb59){_0x59fb59=_0x59fb59||0x1f4;return function(_0x7d5237){logger['error'](_0x7d5237[_0x8d16('0x24')]);if(_0x7d5237[_0x8d16('0x25')]){delete _0x7d5237['name'];}_0x49ef1c['status'](_0x59fb59)['send'](_0x7d5237);};}exports[_0x8d16('0x26')]=function(_0xa43ce8,_0x12358f){var _0x3f570d={},_0x2ff5fd={},_0x256798={'count':0x0,'rows':[]};var _0x2fc692=_[_0x8d16('0x27')](db[_0x8d16('0x28')][_0x8d16('0x29')],function(_0x2d4c82){return{'name':_0x2d4c82[_0x8d16('0x2a')],'type':_0x2d4c82[_0x8d16('0x2b')]['key']};});_0x2ff5fd[_0x8d16('0x2c')]=_[_0x8d16('0x27')](_0x2fc692,'name');_0x2ff5fd[_0x8d16('0x2d')]=_['keys'](_0xa43ce8[_0x8d16('0x2d')]);_0x2ff5fd['filters']=_[_0x8d16('0x2e')](_0x2ff5fd[_0x8d16('0x2c')],_0x2ff5fd['query']);_0x3f570d['attributes']=_[_0x8d16('0x2e')](_0x2ff5fd[_0x8d16('0x2c')],qs[_0x8d16('0x2f')](_0xa43ce8[_0x8d16('0x2d')][_0x8d16('0x2f')]));_0x3f570d[_0x8d16('0x30')]=_0x3f570d['attributes']['length']?_0x3f570d[_0x8d16('0x30')]:_0x2ff5fd[_0x8d16('0x2c')];if(!_0xa43ce8[_0x8d16('0x2d')][_0x8d16('0x31')](_0x8d16('0x32'))){_0x3f570d[_0x8d16('0x1b')]=qs['limit'](_0xa43ce8[_0x8d16('0x2d')]['limit']);_0x3f570d['offset']=qs['offset'](_0xa43ce8[_0x8d16('0x2d')][_0x8d16('0x1a')]);}_0x3f570d[_0x8d16('0x33')]=qs[_0x8d16('0x34')](_0xa43ce8['query']['sort']);_0x3f570d['where']=qs[_0x8d16('0x35')](_[_0x8d16('0x36')](_0xa43ce8['query'],_0x2ff5fd[_0x8d16('0x35')]));if(_0xa43ce8[_0x8d16('0x2d')][_0x8d16('0x37')]){_0x3f570d[_0x8d16('0x38')]=_['merge'](_0x3f570d[_0x8d16('0x38')],{'$or':_['map'](_0x2fc692,function(_0x2512de){if(_0x2512de[_0x8d16('0x2b')]!==_0x8d16('0x39')){var _0xceb463={};_0xceb463[_0x2512de[_0x8d16('0x25')]]={'$like':'%'+_0xa43ce8['query'][_0x8d16('0x37')]+'%'};return _0xceb463;}})});}_0x3f570d=_[_0x8d16('0x3a')]({},_0x3f570d,_0xa43ce8[_0x8d16('0x3b')]);var _0x49b90a={'where':_0x3f570d['where']};return db['VoiceDialReport'][_0x8d16('0x19')](_0x49b90a)[_0x8d16('0x22')](function(_0x5bd698){_0x256798[_0x8d16('0x19')]=_0x5bd698;if(_0xa43ce8[_0x8d16('0x2d')][_0x8d16('0x3c')]){_0x3f570d[_0x8d16('0x3d')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x3f570d);})[_0x8d16('0x22')](function(_0x5181c5){_0x256798[_0x8d16('0x3e')]=_0x5181c5;return _0x256798;})['then'](respondWithFilteredResult(_0x12358f,_0x3f570d))[_0x8d16('0x3f')](handleError(_0x12358f,null));};exports[_0x8d16('0x40')]=function(_0x5e83fc,_0x4d7ccb){var _0x41007b={'raw':!![],'where':{'id':_0x5e83fc[_0x8d16('0x41')]['id']}},_0x3d6036={};_0x3d6036[_0x8d16('0x2c')]=_[_0x8d16('0x42')](db[_0x8d16('0x28')][_0x8d16('0x29')]);_0x3d6036[_0x8d16('0x2d')]=_[_0x8d16('0x42')](_0x5e83fc[_0x8d16('0x2d')]);_0x3d6036['filters']=_['intersection'](_0x3d6036['model'],_0x3d6036['query']);_0x41007b[_0x8d16('0x30')]=_[_0x8d16('0x2e')](_0x3d6036[_0x8d16('0x2c')],qs[_0x8d16('0x2f')](_0x5e83fc[_0x8d16('0x2d')][_0x8d16('0x2f')]));_0x41007b[_0x8d16('0x30')]=_0x41007b['attributes'][_0x8d16('0x43')]?_0x41007b[_0x8d16('0x30')]:_0x3d6036['model'];if(_0x5e83fc[_0x8d16('0x2d')][_0x8d16('0x3c')]){_0x41007b['include']=[{'all':!![]}];}_0x41007b=_[_0x8d16('0x3a')]({},_0x41007b,_0x5e83fc[_0x8d16('0x3b')]);return db[_0x8d16('0x28')][_0x8d16('0x44')](_0x41007b)[_0x8d16('0x22')](handleEntityNotFound(_0x4d7ccb,null))['then'](respondWithResult(_0x4d7ccb,null))[_0x8d16('0x3f')](handleError(_0x4d7ccb,null));};exports[_0x8d16('0x45')]=function(_0x2d343f,_0xb4a118){return db['VoiceDialReport'][_0x8d16('0x45')](_0x2d343f[_0x8d16('0x46')],{})[_0x8d16('0x22')](respondWithResult(_0xb4a118,0xc9))['catch'](handleError(_0xb4a118,null));};exports[_0x8d16('0x20')]=function(_0x55c0fc,_0x2a2351){if(_0x55c0fc[_0x8d16('0x46')]['id']){delete _0x55c0fc['body']['id'];}return db['VoiceDialReport'][_0x8d16('0x44')]({'where':{'id':_0x55c0fc['params']['id']}})[_0x8d16('0x22')](handleEntityNotFound(_0x2a2351,null))[_0x8d16('0x22')](saveUpdates(_0x55c0fc['body'],null))['then'](respondWithResult(_0x2a2351,null))[_0x8d16('0x3f')](handleError(_0x2a2351,null));};exports['destroy']=function(_0x498540,_0x4b65bd){return db['VoiceDialReport'][_0x8d16('0x44')]({'where':{'id':_0x498540[_0x8d16('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b65bd,null))[_0x8d16('0x22')](removeEntity(_0x4b65bd,null))[_0x8d16('0x3f')](handleError(_0x4b65bd,null));};exports[_0x8d16('0x47')]=function(_0x122eb6,_0x38b6ac){return db[_0x8d16('0x28')][_0x8d16('0x47')]()[_0x8d16('0x22')](respondWithResult(_0x38b6ac,null))['catch'](handleError(_0x38b6ac,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 2d0c481..f211ab2 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 _0x052e=['./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x114e52,_0x36b5fc){var _0x3d036a=function(_0x58db8d){while(--_0x58db8d){_0x114e52['push'](_0x114e52['shift']());}};_0x3d036a(++_0x36b5fc);}(_0x052e,0xa2));var _0xe052=function(_0x47ae44,_0x1ecf33){_0x47ae44=_0x47ae44-0x0;var _0x37c675=_0x052e[_0x47ae44];return _0x37c675;};'use strict';var _=require('lodash');var util=require(_0xe052('0x0'));var logger=require(_0xe052('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe052('0x2'));var rp=require(_0xe052('0x3'));var fs=require('fs');var path=require(_0xe052('0x4'));var rimraf=require(_0xe052('0x5'));var config=require('../../config/environment');var attributes=require(_0xe052('0x6'));module[_0xe052('0x7')]=function(_0x339248,_0x5d5fb4){return _0x339248[_0xe052('0x8')](_0xe052('0x9'),attributes,{'tableName':_0xe052('0xa'),'paranoid':![],'indexes':[{'fields':[_0xe052('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x41ea=['VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1ce3c0,_0x32b456){var _0x2b37e4=function(_0x29eced){while(--_0x29eced){_0x1ce3c0['push'](_0x1ce3c0['shift']());}};_0x2b37e4(++_0x32b456);}(_0x41ea,0x17c));var _0xa41e=function(_0x848500,_0x5409c4){_0x848500=_0x848500-0x0;var _0x3afd1a=_0x41ea[_0x848500];return _0x3afd1a;};'use strict';var _=require(_0xa41e('0x0'));var util=require('util');var logger=require(_0xa41e('0x1'))(_0xa41e('0x2'));var moment=require(_0xa41e('0x3'));var BPromise=require('bluebird');var rp=require(_0xa41e('0x4'));var fs=require('fs');var path=require(_0xa41e('0x5'));var rimraf=require(_0xa41e('0x6'));var config=require(_0xa41e('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0xa41e('0x8')]=function(_0x4b83a3,_0x42d01a){return _0x4b83a3[_0xa41e('0x9')](_0xa41e('0xa'),attributes,{'tableName':_0xa41e('0xb'),'paranoid':![],'indexes':[{'fields':[_0xa41e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 8cdc375..c3875cf 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 _0x0434=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','UpdateVoiceDialReport','update','raw','where','limit'];(function(_0x1fe3e1,_0x463df1){var _0x9aac4b=function(_0x481c44){while(--_0x481c44){_0x1fe3e1['push'](_0x1fe3e1['shift']());}};_0x9aac4b(++_0x463df1);}(_0x0434,0x1ad));var _0x4043=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x0434[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x4043('0x0'));var util=require(_0x4043('0x1'));var moment=require(_0x4043('0x2'));var BPromise=require(_0x4043('0x3'));var rs=require(_0x4043('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4043('0x5'));var logger=require(_0x4043('0x6'))(_0x4043('0x7'));var config=require(_0x4043('0x8'));var jayson=require(_0x4043('0x9'));var client=jayson[_0x4043('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41d0a9,_0x1ed6c4,_0x5080e5){return new BPromise(function(_0x56355c,_0x14694d){return client[_0x4043('0xb')](_0x41d0a9,_0x5080e5)[_0x4043('0xc')](function(_0x31cb1f){logger[_0x4043('0xd')](_0x4043('0xe'),_0x1ed6c4,_0x4043('0xf'));logger[_0x4043('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x1ed6c4,_0x4043('0xf'),JSON[_0x4043('0x11')](_0x31cb1f));if(_0x31cb1f[_0x4043('0x12')]){if(_0x31cb1f[_0x4043('0x12')][_0x4043('0x13')]===0x1f4){logger['error'](_0x4043('0xe'),_0x1ed6c4,_0x31cb1f[_0x4043('0x12')][_0x4043('0x14')]);return _0x14694d(_0x31cb1f[_0x4043('0x12')][_0x4043('0x14')]);}logger['error'](_0x4043('0xe'),_0x1ed6c4,_0x31cb1f[_0x4043('0x12')][_0x4043('0x14')]);return _0x56355c(_0x31cb1f[_0x4043('0x12')][_0x4043('0x14')]);}else{logger[_0x4043('0xd')](_0x4043('0xe'),_0x1ed6c4,_0x4043('0xf'));_0x56355c(_0x31cb1f[_0x4043('0x15')][_0x4043('0x14')]);}})[_0x4043('0x16')](function(_0x38aefa){logger['error'](_0x4043('0xe'),_0x1ed6c4,_0x38aefa);_0x14694d(_0x38aefa);});});}exports[_0x4043('0x17')]=function(_0x7c7b2e){var _0x5ccdcd=this;return new Promise(function(_0x3767ed,_0x451058){return db[_0x4043('0x18')][_0x4043('0x19')](_0x7c7b2e[_0x4043('0x1a')],{'raw':_0x7c7b2e['options']?_0x7c7b2e[_0x4043('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x4043('0xc')](function(_0x2bc032){logger[_0x4043('0xd')](_0x4043('0x17'),_0x7c7b2e);logger[_0x4043('0x10')](_0x4043('0x17'),_0x7c7b2e,JSON['stringify'](_0x2bc032));_0x3767ed(_0x2bc032);})[_0x4043('0x16')](function(_0x3339dd){logger['error']('CreateVoiceDialReport',_0x3339dd[_0x4043('0x14')],_0x7c7b2e);_0x451058(_0x5ccdcd['error'](0x1f4,_0x3339dd['message']));});});};exports[_0x4043('0x1c')]=function(_0x42a207){var _0x5068c3=this;return new Promise(function(_0x121096,_0x1d7f85){return db[_0x4043('0x18')][_0x4043('0x1d')](_0x42a207[_0x4043('0x1a')],{'raw':_0x42a207[_0x4043('0x1b')]?_0x42a207[_0x4043('0x1b')][_0x4043('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42a207['options']?_0x42a207['options'][_0x4043('0x1f')]||null:null,'attributes':_0x42a207[_0x4043('0x1b')]?_0x42a207[_0x4043('0x1b')]['attributes']||null:null,'limit':_0x42a207['options']?_0x42a207[_0x4043('0x1b')][_0x4043('0x20')]||null:null})['then'](function(_0x3cbbf1){logger[_0x4043('0xd')]('UpdateVoiceDialReport',_0x42a207);logger[_0x4043('0x10')]('UpdateVoiceDialReport',_0x42a207,JSON[_0x4043('0x11')](_0x3cbbf1));_0x121096(_0x3cbbf1);})[_0x4043('0x16')](function(_0x21509){logger[_0x4043('0x12')](_0x4043('0x1c'),_0x21509[_0x4043('0x14')],_0x42a207);_0x1d7f85(_0x5068c3['error'](0x1f4,_0x21509[_0x4043('0x14')]));});});}; \ No newline at end of file +var _0x495e=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceDialReport','VoiceDialReport','create','options','raw','debug','catch','update','body','attributes','UpdateVoiceDialReport','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x495e,0xfb));var _0xe495=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0x495e[_0x460150];return _0x340677;};'use strict';var _=require(_0xe495('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe495('0x1'));var rs=require(_0xe495('0x2'));var fs=require('fs');var Redis=require(_0xe495('0x3'));var db=require(_0xe495('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe495('0x5'))(_0xe495('0x6'));var config=require(_0xe495('0x7'));var jayson=require(_0xe495('0x8'));var client=jayson[_0xe495('0x9')][_0xe495('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x101a7e,_0x5745e3,_0x599ab4){return new BPromise(function(_0x5c17d0,_0x16f146){return client['request'](_0x101a7e,_0x599ab4)[_0xe495('0xb')](function(_0x3a9a00){logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));logger['debug'](_0xe495('0xf'),_0x5745e3,_0xe495('0xe'),JSON[_0xe495('0x10')](_0x3a9a00));if(_0x3a9a00['error']){if(_0x3a9a00[_0xe495('0x11')][_0xe495('0x12')]===0x1f4){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x16f146(_0x3a9a00['error'][_0xe495('0x13')]);}logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x3a9a00[_0xe495('0x11')][_0xe495('0x13')]);return _0x5c17d0(_0x3a9a00['error'][_0xe495('0x13')]);}else{logger[_0xe495('0xc')](_0xe495('0xd'),_0x5745e3,_0xe495('0xe'));_0x5c17d0(_0x3a9a00[_0xe495('0x14')]['message']);}})['catch'](function(_0x4de730){logger[_0xe495('0x11')](_0xe495('0xd'),_0x5745e3,_0x4de730);_0x16f146(_0x4de730);});});}exports[_0xe495('0x15')]=function(_0x577fb7){var _0x1e602c=this;return new Promise(function(_0x302ca0,_0x3ba8cc){return db[_0xe495('0x16')][_0xe495('0x17')](_0x577fb7['body'],{'raw':_0x577fb7['options']?_0x577fb7[_0xe495('0x18')][_0xe495('0x19')]===undefined?!![]:![]:!![]})[_0xe495('0xb')](function(_0x169bd2){logger['info'](_0xe495('0x15'),_0x577fb7);logger[_0xe495('0x1a')](_0xe495('0x15'),_0x577fb7,JSON['stringify'](_0x169bd2));_0x302ca0(_0x169bd2);})[_0xe495('0x1b')](function(_0x17d13f){logger[_0xe495('0x11')](_0xe495('0x15'),_0x17d13f[_0xe495('0x13')],_0x577fb7);_0x3ba8cc(_0x1e602c['error'](0x1f4,_0x17d13f[_0xe495('0x13')]));});});};exports['UpdateVoiceDialReport']=function(_0x181ead){var _0x39cff4=this;return new Promise(function(_0x3a3f89,_0x5d095f){return db[_0xe495('0x16')][_0xe495('0x1c')](_0x181ead[_0xe495('0x1d')],{'raw':_0x181ead[_0xe495('0x18')]?_0x181ead[_0xe495('0x18')][_0xe495('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x181ead[_0xe495('0x18')]?_0x181ead['options']['where']||null:null,'attributes':_0x181ead[_0xe495('0x18')]?_0x181ead['options'][_0xe495('0x1e')]||null:null,'limit':_0x181ead[_0xe495('0x18')]?_0x181ead['options']['limit']||null:null})[_0xe495('0xb')](function(_0x620f00){logger[_0xe495('0xc')](_0xe495('0x1f'),_0x181ead);logger[_0xe495('0x1a')](_0xe495('0x1f'),_0x181ead,JSON[_0xe495('0x10')](_0x620f00));_0x3a3f89(_0x620f00);})[_0xe495('0x1b')](function(_0x535d23){logger['error'](_0xe495('0x1f'),_0x535d23[_0xe495('0x13')],_0x181ead);_0x5d095f(_0x39cff4[_0xe495('0x11')](0x1f4,_0x535d23[_0xe495('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 2c3eb9e..8115e37 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 _0x9cf9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','create','/:id/applications','addApplications','delete','destroy','multer','path','connect-timeout','express','Router'];(function(_0x541987,_0x1c646c){var _0x29e7ae=function(_0x595a6e){while(--_0x595a6e){_0x541987['push'](_0x541987['shift']());}};_0x29e7ae(++_0x1c646c);}(_0x9cf9,0x6d));var _0x99cf=function(_0xec3825,_0x134394){_0xec3825=_0xec3825-0x0;var _0x296d10=_0x9cf9[_0xec3825];return _0x296d10;};'use strict';var multer=require(_0x99cf('0x0'));var util=require('util');var path=require(_0x99cf('0x1'));var timeout=require(_0x99cf('0x2'));var express=require(_0x99cf('0x3'));var router=express[_0x99cf('0x4')]();var auth=require(_0x99cf('0x5'));var interaction=require(_0x99cf('0x6'));var config=require(_0x99cf('0x7'));var controller=require(_0x99cf('0x8'));router[_0x99cf('0x9')]('/',auth[_0x99cf('0xa')](),controller[_0x99cf('0xb')]);router[_0x99cf('0x9')](_0x99cf('0xc'),auth[_0x99cf('0xa')](),controller[_0x99cf('0xd')]);router['post']('/',auth[_0x99cf('0xa')](),controller[_0x99cf('0xe')]);router['post'](_0x99cf('0xf'),auth[_0x99cf('0xa')](),controller[_0x99cf('0x10')]);router['put'](_0x99cf('0xc'),auth[_0x99cf('0xa')](),controller['update']);router[_0x99cf('0x11')]('/:id',auth[_0x99cf('0xa')](),controller[_0x99cf('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9a4f=['index','/:id','post','create','addApplications','put','update','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9a4f,0x8f));var _0xf9a4=function(_0x4c6840,_0x97fe36){_0x4c6840=_0x4c6840-0x0;var _0x23e354=_0x9a4f[_0x4c6840];return _0x23e354;};'use strict';var multer=require(_0xf9a4('0x0'));var util=require(_0xf9a4('0x1'));var path=require(_0xf9a4('0x2'));var timeout=require(_0xf9a4('0x3'));var express=require('express');var router=express[_0xf9a4('0x4')]();var auth=require(_0xf9a4('0x5'));var interaction=require(_0xf9a4('0x6'));var config=require('../../config/environment');var controller=require(_0xf9a4('0x7'));router[_0xf9a4('0x8')]('/',auth[_0xf9a4('0x9')](),controller[_0xf9a4('0xa')]);router['get'](_0xf9a4('0xb'),auth[_0xf9a4('0x9')](),controller['show']);router[_0xf9a4('0xc')]('/',auth['isAuthenticated'](),controller[_0xf9a4('0xd')]);router[_0xf9a4('0xc')]('/:id/applications',auth[_0xf9a4('0x9')](),controller[_0xf9a4('0xe')]);router[_0xf9a4('0xf')]('/:id',auth[_0xf9a4('0x9')](),controller[_0xf9a4('0x10')]);router['delete'](_0xf9a4('0xb'),auth[_0xf9a4('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 80d3d9e..d22054b 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(_0xb2be36,_0xd38128){var _0x4c5a8a=function(_0x10e72d){while(--_0x10e72d){_0xb2be36['push'](_0xb2be36['shift']());}};_0x4c5a8a(++_0xd38128);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x4b80eb,_0x392b29){var _0x42ec95=function(_0x36d2ea){while(--_0x36d2ea){_0x4b80eb['push'](_0x4b80eb['shift']());}};_0x42ec95(++_0x392b29);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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 49c0737..3893764 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 _0xe1de=['update','context','recordingFormat','cutdigits','mandatoryDisposition','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','get','InboundRoutes','outbound','internal','filter','ignore','map','value','includes','find','name','UserProfileResource','destroy','error','index','VoiceExtension','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','catch','create','body','startsWith','exten','concat','user','role','inbound','InternalRoutes','UserProfileSection','autoAssociation'];(function(_0x233365,_0x4b23c0){var _0x4f3975=function(_0x3478fb){while(--_0x3478fb){_0x233365['push'](_0x233365['shift']());}};_0x4f3975(++_0x4b23c0);}(_0xe1de,0x14a));var _0xee1d=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0xe1de[_0x52f1e6];return _0x21f104;};'use strict';var pdf=require(_0xee1d('0x0'));var emlformat=require(_0xee1d('0x1'));var rimraf=require(_0xee1d('0x2'));var zipdir=require(_0xee1d('0x3'));var jsonpatch=require(_0xee1d('0x4'));var rp=require(_0xee1d('0x5'));var moment=require(_0xee1d('0x6'));var BPromise=require(_0xee1d('0x7'));var Mustache=require(_0xee1d('0x8'));var util=require('util');var path=require('path');var sox=require(_0xee1d('0x9'));var csv=require(_0xee1d('0xa'));var ejs=require(_0xee1d('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xee1d('0xc'));var crypto=require(_0xee1d('0xd'));var jsforce=require(_0xee1d('0xe'));var deskjs=require(_0xee1d('0xf'));var toCsv=require(_0xee1d('0xa'));var querystring=require(_0xee1d('0x10'));var Papa=require('papaparse');var Redis=require(_0xee1d('0x11'));var authService=require(_0xee1d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xee1d('0x13'));var hardwareService=require(_0xee1d('0x14'));var logger=require(_0xee1d('0x15'))(_0xee1d('0x16'));var utils=require(_0xee1d('0x17'));var config=require(_0xee1d('0x18'));var db=require(_0xee1d('0x19'))['db'];config[_0xee1d('0x1a')]=_['defaults'](config[_0xee1d('0x1a')],{'host':_0xee1d('0x1b'),'port':0x18eb});var socket=require(_0xee1d('0x1c'))(new Redis(config[_0xee1d('0x1a')]));require('./voiceExtension.socket')[_0xee1d('0x1d')](socket);function respondWithStatusCode(_0x2cb96c,_0x1a387c){_0x1a387c=_0x1a387c||0xcc;return function(_0xa6f149){if(_0xa6f149){return _0x2cb96c[_0xee1d('0x1e')](_0x1a387c);}return _0x2cb96c[_0xee1d('0x1f')](_0x1a387c)[_0xee1d('0x20')]();};}function respondWithResult(_0x386856,_0x58ac78){_0x58ac78=_0x58ac78||0xc8;return function(_0xafc935){if(_0xafc935){return _0x386856[_0xee1d('0x1f')](_0x58ac78)[_0xee1d('0x21')](_0xafc935);}};}function respondWithFilteredResult(_0x4b9c69,_0x4a32c7){return function(_0x4fb41e){if(_0x4fb41e){var _0x4f9a59=_0x4fb41e[_0xee1d('0x22')],_0x5b11d3=_0x4a32c7[_0xee1d('0x23')],_0x416793=_0x4a32c7[_0xee1d('0x23')]+_0x4a32c7[_0xee1d('0x24')],_0x366a96;if(_0x416793>=_0x4f9a59){_0x416793=_0x4f9a59;_0x366a96=0xc8;}else{_0x366a96=0xce;}_0x4b9c69[_0xee1d('0x1f')](_0x366a96);return _0x4b9c69[_0xee1d('0x25')](_0xee1d('0x26'),_0x5b11d3+'-'+_0x416793+'/'+_0x4f9a59)[_0xee1d('0x21')](_0x4fb41e);}return null;};}function patchUpdates(_0x215a9b){return function(_0x211ea7){try{jsonpatch['apply'](_0x211ea7,_0x215a9b,!![]);}catch(_0x18a955){return BPromise[_0xee1d('0x27')](_0x18a955);}return _0x211ea7[_0xee1d('0x28')]();};}function saveUpdates(_0x5a0474,_0x287927){return function(_0x15d568){if(_0x15d568){return _0x15d568['update'](_0x5a0474)[_0xee1d('0x29')](function(_0xa899f7){return _0xa899f7;});}return null;};}function removeEntity(_0x5e9a84,_0x26c15b){return function(_0x3c8f68){if(_0x3c8f68){return _0x3c8f68['destroy']()[_0xee1d('0x29')](function(){var _0xf831ce=_0x3c8f68[_0xee1d('0x2a')]({'plain':!![]});var _0x138544=[{'name':_0xee1d('0x2b'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0xee1d('0x2c'),'ignore':![]},{'name':'InternalRoutes','value':_0xee1d('0x2d'),'ignore':![]}];var _0x523996=_(_0x138544)[_0xee1d('0x2e')](_0xee1d('0x2f'))[_0xee1d('0x30')](_0xee1d('0x31'))[_0xee1d('0x31')]();if(_[_0xee1d('0x32')](_0x523996,_0xf831ce['type'])){return;}var _0x21d28b=_[_0xee1d('0x33')](_0x138544,[_0xee1d('0x31'),_0xf831ce['type']])[_0xee1d('0x34')];return db[_0xee1d('0x35')][_0xee1d('0x36')]({'where':{'type':_0x21d28b,'resourceId':_0xf831ce['id']}})['then'](function(){return _0x3c8f68;});})[_0xee1d('0x29')](function(){_0x5e9a84[_0xee1d('0x1f')](0xcc)[_0xee1d('0x20')]();});}};}function handleEntityNotFound(_0x125a31,_0x21eda4){return function(_0x5b7522){if(!_0x5b7522){_0x125a31['sendStatus'](0x194);}return _0x5b7522;};}function handleError(_0x418240,_0x5efe45){_0x5efe45=_0x5efe45||0x1f4;return function(_0x5a0372){logger[_0xee1d('0x37')](_0x5a0372['stack']);if(_0x5a0372[_0xee1d('0x34')]){delete _0x5a0372[_0xee1d('0x34')];}_0x418240[_0xee1d('0x1f')](_0x5efe45)['send'](_0x5a0372);};}exports[_0xee1d('0x38')]=function(_0x15b2ed,_0x2e6fa6){var _0x345d1e={},_0x5d0099={},_0x1d167d={'count':0x0,'rows':[]};var _0x1d848c=_[_0xee1d('0x30')](db[_0xee1d('0x39')][_0xee1d('0x3a')],function(_0x24586d){return{'name':_0x24586d[_0xee1d('0x3b')],'type':_0x24586d[_0xee1d('0x3c')]['key']};});_0x5d0099[_0xee1d('0x3d')]=_[_0xee1d('0x30')](_0x1d848c,_0xee1d('0x34'));_0x5d0099[_0xee1d('0x3e')]=_[_0xee1d('0x3f')](_0x15b2ed[_0xee1d('0x3e')]);_0x5d0099['filters']=_[_0xee1d('0x40')](_0x5d0099[_0xee1d('0x3d')],_0x5d0099[_0xee1d('0x3e')]);_0x345d1e['attributes']=_[_0xee1d('0x40')](_0x5d0099['model'],qs[_0xee1d('0x41')](_0x15b2ed[_0xee1d('0x3e')][_0xee1d('0x41')]));_0x345d1e[_0xee1d('0x42')]=_0x345d1e[_0xee1d('0x42')][_0xee1d('0x43')]?_0x345d1e[_0xee1d('0x42')]:_0x5d0099[_0xee1d('0x3d')];if(!_0x15b2ed['query'][_0xee1d('0x44')](_0xee1d('0x45'))){_0x345d1e['limit']=qs['limit'](_0x15b2ed[_0xee1d('0x3e')][_0xee1d('0x24')]);_0x345d1e[_0xee1d('0x23')]=qs[_0xee1d('0x23')](_0x15b2ed[_0xee1d('0x3e')]['offset']);}_0x345d1e['order']=qs[_0xee1d('0x46')](_0x15b2ed[_0xee1d('0x3e')][_0xee1d('0x46')]);_0x345d1e[_0xee1d('0x47')]=qs['filters'](_[_0xee1d('0x48')](_0x15b2ed['query'],_0x5d0099[_0xee1d('0x49')]));if(_0x15b2ed[_0xee1d('0x3e')]['filter']){_0x345d1e[_0xee1d('0x47')]=_['merge'](_0x345d1e[_0xee1d('0x47')],{'$or':_[_0xee1d('0x30')](_0x1d848c,function(_0x2b13ed){if(_0x2b13ed['type']!==_0xee1d('0x4a')){var _0x37e770={};_0x37e770[_0x2b13ed[_0xee1d('0x34')]]={'$like':'%'+_0x15b2ed[_0xee1d('0x3e')]['filter']+'%'};return _0x37e770;}})});}_0x345d1e=_[_0xee1d('0x4b')]({},_0x345d1e,_0x15b2ed[_0xee1d('0x4c')]);var _0x4a4832={'where':_0x345d1e[_0xee1d('0x47')]};return db[_0xee1d('0x39')]['count'](_0x4a4832)[_0xee1d('0x29')](function(_0x15f342){_0x1d167d['count']=_0x15f342;if(_0x15b2ed[_0xee1d('0x3e')][_0xee1d('0x4d')]){_0x345d1e['include']=[{'all':!![]}];}return db[_0xee1d('0x39')][_0xee1d('0x4e')](_0x345d1e);})[_0xee1d('0x29')](function(_0x2cbaf1){_0x1d167d[_0xee1d('0x4f')]=_0x2cbaf1;return _0x1d167d;})['then'](respondWithFilteredResult(_0x2e6fa6,_0x345d1e))['catch'](handleError(_0x2e6fa6,null));};exports[_0xee1d('0x50')]=function(_0x4a5910,_0x488df4){var _0x4b8de6={'raw':![],'where':{'id':_0x4a5910[_0xee1d('0x51')]['id']}},_0x4a4179={};_0x4a4179[_0xee1d('0x3d')]=_[_0xee1d('0x3f')](db[_0xee1d('0x39')][_0xee1d('0x3a')]);_0x4a4179[_0xee1d('0x3e')]=_[_0xee1d('0x3f')](_0x4a5910[_0xee1d('0x3e')]);_0x4a4179['filters']=_[_0xee1d('0x40')](_0x4a4179['model'],_0x4a4179['query']);_0x4b8de6['attributes']=_[_0xee1d('0x40')](_0x4a4179['model'],qs[_0xee1d('0x41')](_0x4a5910[_0xee1d('0x3e')]['fields']));_0x4b8de6[_0xee1d('0x42')]=_0x4b8de6[_0xee1d('0x42')][_0xee1d('0x43')]?_0x4b8de6[_0xee1d('0x42')]:_0x4a4179[_0xee1d('0x3d')];if(_0x4a5910[_0xee1d('0x3e')][_0xee1d('0x4d')]){_0x4b8de6['include']=[{'all':!![]}];}_0x4b8de6=_[_0xee1d('0x4b')]({},_0x4b8de6,_0x4a5910['options']);return db[_0xee1d('0x39')][_0xee1d('0x33')](_0x4b8de6)[_0xee1d('0x29')](handleEntityNotFound(_0x488df4,null))[_0xee1d('0x29')](respondWithResult(_0x488df4,null))[_0xee1d('0x52')](handleError(_0x488df4,null));};exports[_0xee1d('0x36')]=function(_0x1ba17a,_0x483cf6){return db[_0xee1d('0x39')][_0xee1d('0x33')]({'where':{'id':_0x1ba17a[_0xee1d('0x51')]['id']}})[_0xee1d('0x29')](handleEntityNotFound(_0x483cf6,null))[_0xee1d('0x29')](removeEntity(_0x483cf6,null))['catch'](handleError(_0x483cf6,null));};exports[_0xee1d('0x53')]=function(_0x19a85d,_0x4866ea){if(_0x19a85d[_0xee1d('0x54')][_0xee1d('0x3c')]===_0xee1d('0x2c')&&!_[_0xee1d('0x55')](_0x19a85d[_0xee1d('0x54')][_0xee1d('0x56')],'_')){_0x19a85d['body']['exten']='_'[_0xee1d('0x57')](_0x19a85d[_0xee1d('0x54')]['exten']);}return db[_0xee1d('0x39')][_0xee1d('0x53')](_0x19a85d[_0xee1d('0x54')],{'raw':![]})[_0xee1d('0x29')](function(_0x3f5086){var _0x2728b0=_0x19a85d[_0xee1d('0x58')][_0xee1d('0x2a')]({'plain':!![]});if(!_0x2728b0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2728b0[_0xee1d('0x59')]===_0xee1d('0x58')){var _0x33963a=_0x3f5086['get']({'plain':!![]});var _0x4cc4d2=[{'name':_0xee1d('0x2b'),'value':_0xee1d('0x5a')},{'name':'OutboundRoutes','value':_0xee1d('0x2c')},{'name':_0xee1d('0x5b'),'value':_0xee1d('0x2d')}];var _0x4582fa=_['find'](_0x4cc4d2,[_0xee1d('0x31'),_0x33963a['type']])[_0xee1d('0x34')];return db[_0xee1d('0x5c')]['find']({'where':{'name':_0x4582fa,'userProfileId':_0x2728b0['userProfileId']},'raw':!![]})[_0xee1d('0x29')](function(_0x219d3f){if(_0x219d3f&&_0x219d3f[_0xee1d('0x5d')]===0x0){return db[_0xee1d('0x35')][_0xee1d('0x53')]({'name':_0x33963a[_0xee1d('0x34')],'resourceId':_0x33963a['id'],'type':_0x219d3f[_0xee1d('0x34')],'sectionId':_0x219d3f['id']},{})['then'](function(){return _0x3f5086;});}else{return _0x3f5086;}})['catch'](function(_0x25cbc7){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25cbc7);throw _0x25cbc7;});}return _0x3f5086;})[_0xee1d('0x29')](respondWithResult(_0x4866ea,0xc9))[_0xee1d('0x52')](handleError(_0x4866ea,null));};exports[_0xee1d('0x5e')]=function(_0x5f2ce2,_0x2c5a9a){if(_0x5f2ce2['body']['id']){delete _0x5f2ce2['body']['id'];}return db[_0xee1d('0x39')]['find']({'where':{'id':_0x5f2ce2['params']['id']}})[_0xee1d('0x29')](handleEntityNotFound(_0x2c5a9a,null))['then'](function(_0x3366a0){if(_0x3366a0){return db[_0xee1d('0x39')][_0xee1d('0x5e')](_[_0xee1d('0x48')](_0x5f2ce2[_0xee1d('0x54')],['exten',_0xee1d('0x5f'),'description',_0xee1d('0x60'),_0xee1d('0x61'),_0xee1d('0x62')]),{'where':{'context':_0x3366a0[_0xee1d('0x5f')],'exten':_0x3366a0[_0xee1d('0x56')]},'individualHooks':!![]})[_0xee1d('0x29')](function(_0x20d32e){return _0x20d32e;});}return null;})[_0xee1d('0x29')](respondWithStatusCode(_0x2c5a9a,null))[_0xee1d('0x52')](handleError(_0x2c5a9a,null));};exports['addApplications']=function(_0x2b099d,_0x3cc3fc,_0x2b10b4){return db[_0xee1d('0x39')][_0xee1d('0x63')]({'where':{'id':_0x2b099d['params']['id']}})[_0xee1d('0x29')](handleEntityNotFound(_0x3cc3fc,null))[_0xee1d('0x29')](function(_0x28c3c6){if(_0x28c3c6){return db[_0xee1d('0x64')][_0xee1d('0x65')](function(_0x5b4b64){return db[_0xee1d('0x39')][_0xee1d('0x36')]({'where':{'VoiceExtensionId':_0x2b099d[_0xee1d('0x51')]['id']},'transaction':_0x5b4b64})[_0xee1d('0x29')](function(_0x27974c){var _0x162468=_[_0xee1d('0x30')](_0x2b099d[_0xee1d('0x54')],function(_0x5e3e86){_0x5e3e86[_0xee1d('0x66')]=_0x2b099d[_0xee1d('0x51')]['id'];return _0x5e3e86;});return db['VoiceExtension'][_0xee1d('0x67')](_0x162468,{'transaction':_0x5b4b64});});})[_0xee1d('0x29')](function(){return db['VoiceExtension'][_0xee1d('0x68')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2b099d[_0xee1d('0x51')]['id']},'order':_0xee1d('0x69')});});}})[_0xee1d('0x29')](respondWithResult(_0x3cc3fc,null))[_0xee1d('0x52')](handleError(_0x3cc3fc,null));}; \ No newline at end of file +var _0x557c=['fields','length','hasOwnProperty','limit','order','filters','pick','where','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','catch','show','params','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','InternalRoutes','UserProfileSection','update','context','recordingFormat','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','offset','apply','save','destroy','get','InboundRoutes','inbound','outbound','internal','filter','ignore','map','value','includes','type','find','name','then','error','send','index','rawAttributes','key','query','keys','intersection','model','attributes'];(function(_0x21d295,_0x45ad2f){var _0x224dce=function(_0x201eb2){while(--_0x201eb2){_0x21d295['push'](_0x21d295['shift']());}};_0x224dce(++_0x45ad2f);}(_0x557c,0x8e));var _0xc557=function(_0x3fac6f,_0x47130e){_0x3fac6f=_0x3fac6f-0x0;var _0x6ad8e0=_0x557c[_0x3fac6f];return _0x6ad8e0;};'use strict';var pdf=require(_0xc557('0x0'));var emlformat=require(_0xc557('0x1'));var rimraf=require(_0xc557('0x2'));var zipdir=require(_0xc557('0x3'));var jsonpatch=require(_0xc557('0x4'));var rp=require('request-promise');var moment=require(_0xc557('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc557('0x6'));var util=require(_0xc557('0x7'));var path=require('path');var sox=require(_0xc557('0x8'));var csv=require(_0xc557('0x9'));var ejs=require(_0xc557('0xa'));var fs=require('fs');var _=require(_0xc557('0xb'));var squel=require(_0xc557('0xc'));var crypto=require(_0xc557('0xd'));var jsforce=require(_0xc557('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc557('0x9'));var querystring=require(_0xc557('0xf'));var Papa=require(_0xc557('0x10'));var Redis=require(_0xc557('0x11'));var authService=require(_0xc557('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc557('0x13'));var hardwareService=require(_0xc557('0x14'));var logger=require(_0xc557('0x15'))(_0xc557('0x16'));var utils=require(_0xc557('0x17'));var config=require('../../config/environment');var db=require(_0xc557('0x18'))['db'];config[_0xc557('0x19')]=_['defaults'](config[_0xc557('0x19')],{'host':_0xc557('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc557('0x19')]));require('./voiceExtension.socket')[_0xc557('0x1b')](socket);function respondWithStatusCode(_0x4474cc,_0x2feddb){_0x2feddb=_0x2feddb||0xcc;return function(_0x476fe1){if(_0x476fe1){return _0x4474cc[_0xc557('0x1c')](_0x2feddb);}return _0x4474cc[_0xc557('0x1d')](_0x2feddb)[_0xc557('0x1e')]();};}function respondWithResult(_0x5d4387,_0x381547){_0x381547=_0x381547||0xc8;return function(_0x475400){if(_0x475400){return _0x5d4387[_0xc557('0x1d')](_0x381547)[_0xc557('0x1f')](_0x475400);}};}function respondWithFilteredResult(_0x2b28f0,_0x48cd8a){return function(_0xa4ace1){if(_0xa4ace1){var _0x574b3f=_0xa4ace1['count'],_0x1f449e=_0x48cd8a[_0xc557('0x20')],_0x3f4e9e=_0x48cd8a[_0xc557('0x20')]+_0x48cd8a['limit'],_0x29207e;if(_0x3f4e9e>=_0x574b3f){_0x3f4e9e=_0x574b3f;_0x29207e=0xc8;}else{_0x29207e=0xce;}_0x2b28f0[_0xc557('0x1d')](_0x29207e);return _0x2b28f0['set']('Content-Range',_0x1f449e+'-'+_0x3f4e9e+'/'+_0x574b3f)[_0xc557('0x1f')](_0xa4ace1);}return null;};}function patchUpdates(_0x2b6eec){return function(_0x1f2718){try{jsonpatch[_0xc557('0x21')](_0x1f2718,_0x2b6eec,!![]);}catch(_0x1508de){return BPromise['reject'](_0x1508de);}return _0x1f2718[_0xc557('0x22')]();};}function saveUpdates(_0x504703,_0x5d04a3){return function(_0x4bf359){if(_0x4bf359){return _0x4bf359['update'](_0x504703)['then'](function(_0x1387df){return _0x1387df;});}return null;};}function removeEntity(_0xc3beb0,_0x2b4954){return function(_0x1c83fb){if(_0x1c83fb){return _0x1c83fb[_0xc557('0x23')]()['then'](function(){var _0x21e5c9=_0x1c83fb[_0xc557('0x24')]({'plain':!![]});var _0x18c3d1=[{'name':_0xc557('0x25'),'value':_0xc557('0x26'),'ignore':![]},{'name':'OutboundRoutes','value':_0xc557('0x27'),'ignore':![]},{'name':'InternalRoutes','value':_0xc557('0x28'),'ignore':![]}];var _0x213785=_(_0x18c3d1)[_0xc557('0x29')](_0xc557('0x2a'))[_0xc557('0x2b')]('value')[_0xc557('0x2c')]();if(_[_0xc557('0x2d')](_0x213785,_0x21e5c9[_0xc557('0x2e')])){return;}var _0xfbcfe2=_[_0xc557('0x2f')](_0x18c3d1,[_0xc557('0x2c'),_0x21e5c9['type']])[_0xc557('0x30')];return db['UserProfileResource'][_0xc557('0x23')]({'where':{'type':_0xfbcfe2,'resourceId':_0x21e5c9['id']}})[_0xc557('0x31')](function(){return _0x1c83fb;});})[_0xc557('0x31')](function(){_0xc3beb0[_0xc557('0x1d')](0xcc)[_0xc557('0x1e')]();});}};}function handleEntityNotFound(_0x2fc069,_0x247d64){return function(_0x359ad9){if(!_0x359ad9){_0x2fc069[_0xc557('0x1c')](0x194);}return _0x359ad9;};}function handleError(_0xdf639,_0x131a1a){_0x131a1a=_0x131a1a||0x1f4;return function(_0x58686c){logger[_0xc557('0x32')](_0x58686c['stack']);if(_0x58686c['name']){delete _0x58686c[_0xc557('0x30')];}_0xdf639['status'](_0x131a1a)[_0xc557('0x33')](_0x58686c);};}exports[_0xc557('0x34')]=function(_0x251e4d,_0x464f59){var _0x536a9e={},_0xbf02c6={},_0x19c33f={'count':0x0,'rows':[]};var _0x39d9c7=_[_0xc557('0x2b')](db['VoiceExtension'][_0xc557('0x35')],function(_0x2d3ed4){return{'name':_0x2d3ed4['fieldName'],'type':_0x2d3ed4[_0xc557('0x2e')][_0xc557('0x36')]};});_0xbf02c6['model']=_[_0xc557('0x2b')](_0x39d9c7,_0xc557('0x30'));_0xbf02c6[_0xc557('0x37')]=_[_0xc557('0x38')](_0x251e4d[_0xc557('0x37')]);_0xbf02c6['filters']=_[_0xc557('0x39')](_0xbf02c6[_0xc557('0x3a')],_0xbf02c6[_0xc557('0x37')]);_0x536a9e[_0xc557('0x3b')]=_[_0xc557('0x39')](_0xbf02c6['model'],qs[_0xc557('0x3c')](_0x251e4d['query']['fields']));_0x536a9e[_0xc557('0x3b')]=_0x536a9e[_0xc557('0x3b')][_0xc557('0x3d')]?_0x536a9e[_0xc557('0x3b')]:_0xbf02c6[_0xc557('0x3a')];if(!_0x251e4d['query'][_0xc557('0x3e')]('nolimit')){_0x536a9e[_0xc557('0x3f')]=qs['limit'](_0x251e4d[_0xc557('0x37')][_0xc557('0x3f')]);_0x536a9e[_0xc557('0x20')]=qs[_0xc557('0x20')](_0x251e4d[_0xc557('0x37')][_0xc557('0x20')]);}_0x536a9e[_0xc557('0x40')]=qs['sort'](_0x251e4d[_0xc557('0x37')]['sort']);_0x536a9e['where']=qs[_0xc557('0x41')](_[_0xc557('0x42')](_0x251e4d[_0xc557('0x37')],_0xbf02c6[_0xc557('0x41')]));if(_0x251e4d[_0xc557('0x37')][_0xc557('0x29')]){_0x536a9e[_0xc557('0x43')]=_[_0xc557('0x44')](_0x536a9e[_0xc557('0x43')],{'$or':_[_0xc557('0x2b')](_0x39d9c7,function(_0x34a25e){if(_0x34a25e[_0xc557('0x2e')]!==_0xc557('0x45')){var _0x32a791={};_0x32a791[_0x34a25e[_0xc557('0x30')]]={'$like':'%'+_0x251e4d['query'][_0xc557('0x29')]+'%'};return _0x32a791;}})});}_0x536a9e=_['merge']({},_0x536a9e,_0x251e4d[_0xc557('0x46')]);var _0x40cb5c={'where':_0x536a9e[_0xc557('0x43')]};return db[_0xc557('0x47')]['count'](_0x40cb5c)[_0xc557('0x31')](function(_0x4eb4d6){_0x19c33f['count']=_0x4eb4d6;if(_0x251e4d['query'][_0xc557('0x48')]){_0x536a9e[_0xc557('0x49')]=[{'all':!![]}];}return db[_0xc557('0x47')][_0xc557('0x4a')](_0x536a9e);})[_0xc557('0x31')](function(_0xacac40){_0x19c33f[_0xc557('0x4b')]=_0xacac40;return _0x19c33f;})[_0xc557('0x31')](respondWithFilteredResult(_0x464f59,_0x536a9e))[_0xc557('0x4c')](handleError(_0x464f59,null));};exports[_0xc557('0x4d')]=function(_0x415f00,_0x793312){var _0x585701={'raw':![],'where':{'id':_0x415f00[_0xc557('0x4e')]['id']}},_0x1a812={};_0x1a812[_0xc557('0x3a')]=_[_0xc557('0x38')](db[_0xc557('0x47')][_0xc557('0x35')]);_0x1a812[_0xc557('0x37')]=_['keys'](_0x415f00[_0xc557('0x37')]);_0x1a812[_0xc557('0x41')]=_[_0xc557('0x39')](_0x1a812[_0xc557('0x3a')],_0x1a812[_0xc557('0x37')]);_0x585701[_0xc557('0x3b')]=_[_0xc557('0x39')](_0x1a812[_0xc557('0x3a')],qs[_0xc557('0x3c')](_0x415f00[_0xc557('0x37')][_0xc557('0x3c')]));_0x585701[_0xc557('0x3b')]=_0x585701[_0xc557('0x3b')][_0xc557('0x3d')]?_0x585701[_0xc557('0x3b')]:_0x1a812[_0xc557('0x3a')];if(_0x415f00[_0xc557('0x37')][_0xc557('0x48')]){_0x585701['include']=[{'all':!![]}];}_0x585701=_[_0xc557('0x44')]({},_0x585701,_0x415f00[_0xc557('0x46')]);return db[_0xc557('0x47')]['find'](_0x585701)['then'](handleEntityNotFound(_0x793312,null))[_0xc557('0x31')](respondWithResult(_0x793312,null))[_0xc557('0x4c')](handleError(_0x793312,null));};exports[_0xc557('0x23')]=function(_0x21f39a,_0x32e3b7){return db[_0xc557('0x47')][_0xc557('0x2f')]({'where':{'id':_0x21f39a[_0xc557('0x4e')]['id']}})[_0xc557('0x31')](handleEntityNotFound(_0x32e3b7,null))[_0xc557('0x31')](removeEntity(_0x32e3b7,null))[_0xc557('0x4c')](handleError(_0x32e3b7,null));};exports[_0xc557('0x4f')]=function(_0x5c9f3a,_0x47a822){if(_0x5c9f3a[_0xc557('0x50')][_0xc557('0x2e')]===_0xc557('0x27')&&!_[_0xc557('0x51')](_0x5c9f3a[_0xc557('0x50')]['exten'],'_')){_0x5c9f3a['body'][_0xc557('0x52')]='_'['concat'](_0x5c9f3a[_0xc557('0x50')][_0xc557('0x52')]);}return db[_0xc557('0x47')][_0xc557('0x4f')](_0x5c9f3a[_0xc557('0x50')],{'raw':![]})['then'](function(_0x436f9e){var _0x583281=_0x5c9f3a[_0xc557('0x53')][_0xc557('0x24')]({'plain':!![]});if(!_0x583281)throw new Error(_0xc557('0x54'));if(_0x583281[_0xc557('0x55')]===_0xc557('0x53')){var _0x33c842=_0x436f9e[_0xc557('0x24')]({'plain':!![]});var _0x3c5d0c=[{'name':'InboundRoutes','value':_0xc557('0x26')},{'name':_0xc557('0x56'),'value':_0xc557('0x27')},{'name':_0xc557('0x57'),'value':_0xc557('0x28')}];var _0xa733f2=_[_0xc557('0x2f')](_0x3c5d0c,['value',_0x33c842[_0xc557('0x2e')]])['name'];return db[_0xc557('0x58')][_0xc557('0x2f')]({'where':{'name':_0xa733f2,'userProfileId':_0x583281['userProfileId']},'raw':!![]})[_0xc557('0x31')](function(_0x340a4a){if(_0x340a4a&&_0x340a4a['autoAssociation']===0x0){return db['UserProfileResource'][_0xc557('0x4f')]({'name':_0x33c842['name'],'resourceId':_0x33c842['id'],'type':_0x340a4a['name'],'sectionId':_0x340a4a['id']},{})['then'](function(){return _0x436f9e;});}else{return _0x436f9e;}})[_0xc557('0x4c')](function(_0x2ac43b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ac43b);throw _0x2ac43b;});}return _0x436f9e;})[_0xc557('0x31')](respondWithResult(_0x47a822,0xc9))['catch'](handleError(_0x47a822,null));};exports[_0xc557('0x59')]=function(_0x4dc9cf,_0x31a2cc){if(_0x4dc9cf[_0xc557('0x50')]['id']){delete _0x4dc9cf[_0xc557('0x50')]['id'];}return db[_0xc557('0x47')][_0xc557('0x2f')]({'where':{'id':_0x4dc9cf[_0xc557('0x4e')]['id']}})['then'](handleEntityNotFound(_0x31a2cc,null))[_0xc557('0x31')](function(_0x4cedb1){if(_0x4cedb1){return db[_0xc557('0x47')][_0xc557('0x59')](_[_0xc557('0x42')](_0x4dc9cf[_0xc557('0x50')],['exten',_0xc557('0x5a'),'description',_0xc557('0x5b'),_0xc557('0x5c'),_0xc557('0x5d')]),{'where':{'context':_0x4cedb1[_0xc557('0x5a')],'exten':_0x4cedb1[_0xc557('0x52')]},'individualHooks':!![]})[_0xc557('0x31')](function(_0x5c0aa8){return _0x5c0aa8;});}return null;})[_0xc557('0x31')](respondWithStatusCode(_0x31a2cc,null))['catch'](handleError(_0x31a2cc,null));};exports[_0xc557('0x5e')]=function(_0x593300,_0x2108af,_0x26b641){return db[_0xc557('0x47')]['findOne']({'where':{'id':_0x593300[_0xc557('0x4e')]['id']}})[_0xc557('0x31')](handleEntityNotFound(_0x2108af,null))[_0xc557('0x31')](function(_0x1736b0){if(_0x1736b0){return db[_0xc557('0x5f')][_0xc557('0x60')](function(_0x258b7d){return db[_0xc557('0x47')][_0xc557('0x23')]({'where':{'VoiceExtensionId':_0x593300['params']['id']},'transaction':_0x258b7d})[_0xc557('0x31')](function(_0x576084){var _0x3d3557=_[_0xc557('0x2b')](_0x593300['body'],function(_0x289883){_0x289883[_0xc557('0x61')]=_0x593300[_0xc557('0x4e')]['id'];return _0x289883;});return db[_0xc557('0x47')][_0xc557('0x62')](_0x3d3557,{'transaction':_0x258b7d});});})[_0xc557('0x31')](function(){return db['VoiceExtension'][_0xc557('0x63')]({'where':{'isApp':!![],'VoiceExtensionId':_0x593300[_0xc557('0x4e')]['id']},'order':_0xc557('0x64')});});}})['then'](respondWithResult(_0x2108af,null))[_0xc557('0x4c')](handleError(_0x2108af,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index f1e04b7..9b21c43 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 _0x97e4=['VoiceExtension','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x208e4d,_0xdd5997){var _0x2d48f2=function(_0x376243){while(--_0x376243){_0x208e4d['push'](_0x208e4d['shift']());}};_0x2d48f2(++_0xdd5997);}(_0x97e4,0x13f));var _0x497e=function(_0x1a5a53,_0x598a8c){_0x1a5a53=_0x1a5a53-0x0;var _0xf75355=_0x97e4[_0x1a5a53];return _0xf75355;};'use strict';var EventEmitter=require(_0x497e('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x497e('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x497e('0x2')](0x0);var events={'afterCreate':_0x497e('0x3'),'afterUpdate':'update','afterDestroy':_0x497e('0x4')};function emitEvent(_0x4d07c8){return function(_0x3d6b07,_0x3d7319,_0x4c2b1c){VoiceExtensionEvents['emit'](_0x4d07c8+':'+_0x3d6b07['id'],_0x3d6b07);VoiceExtensionEvents[_0x497e('0x5')](_0x4d07c8,_0x3d6b07);_0x4c2b1c(null);};}for(var e in events){if(events[_0x497e('0x6')](e)){var event=events[e];VoiceExtension[_0x497e('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x18b3=['setMaxListeners','save','update','remove','emit','events','../../mysqldb'];(function(_0x3350bc,_0x1a78d5){var _0x4f2776=function(_0x95cca6){while(--_0x95cca6){_0x3350bc['push'](_0x3350bc['shift']());}};_0x4f2776(++_0x1a78d5);}(_0x18b3,0x140));var _0x318b=function(_0x101d63,_0x59e672){_0x101d63=_0x101d63-0x0;var _0x137bd8=_0x18b3[_0x101d63];return _0x137bd8;};'use strict';var EventEmitter=require(_0x318b('0x0'));var VoiceExtension=require(_0x318b('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x318b('0x2')](0x0);var events={'afterCreate':_0x318b('0x3'),'afterUpdate':_0x318b('0x4'),'afterDestroy':_0x318b('0x5')};function emitEvent(_0x1324cc){return function(_0x7344d5,_0x276242,_0x587c1d){VoiceExtensionEvents[_0x318b('0x6')](_0x1324cc+':'+_0x7344d5['id'],_0x7344d5);VoiceExtensionEvents[_0x318b('0x6')](_0x1324cc,_0x7344d5);_0x587c1d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](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 0c8766e..6bd84e4 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 _0x103b=['bluebird','request-promise','path','rimraf','./voiceExtension.attributes','exports','define','VoiceExtension','voice_extensions','lodash','util','../../config/logger'];(function(_0x1d14a4,_0x3d0375){var _0x5cae92=function(_0x332f16){while(--_0x332f16){_0x1d14a4['push'](_0x1d14a4['shift']());}};_0x5cae92(++_0x3d0375);}(_0x103b,0x1b9));var _0xb103=function(_0x34f91d,_0x1045c2){_0x34f91d=_0x34f91d-0x0;var _0x57e1fd=_0x103b[_0x34f91d];return _0x57e1fd;};'use strict';var _=require(_0xb103('0x0'));var util=require(_0xb103('0x1'));var logger=require(_0xb103('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb103('0x3'));var rp=require(_0xb103('0x4'));var fs=require('fs');var path=require(_0xb103('0x5'));var rimraf=require(_0xb103('0x6'));var config=require('../../config/environment');var attributes=require(_0xb103('0x7'));module[_0xb103('0x8')]=function(_0x30bc90,_0x51902f){return _0x30bc90[_0xb103('0x9')](_0xb103('0xa'),attributes,{'tableName':_0xb103('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc219=['bluebird','request-promise','rimraf','../../config/environment','./voiceExtension.attributes','exports','VoiceExtension','lodash','util','api','moment'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xc219,0x1d5));var _0x9c21=function(_0x3dfeb9,_0x1cc6e4){_0x3dfeb9=_0x3dfeb9-0x0;var _0x412314=_0xc219[_0x3dfeb9];return _0x412314;};'use strict';var _=require(_0x9c21('0x0'));var util=require(_0x9c21('0x1'));var logger=require('../../config/logger')(_0x9c21('0x2'));var moment=require(_0x9c21('0x3'));var BPromise=require(_0x9c21('0x4'));var rp=require(_0x9c21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c21('0x6'));var config=require(_0x9c21('0x7'));var attributes=require(_0x9c21('0x8'));module[_0x9c21('0x9')]=function(_0x2bceda,_0x4f3c11){return _0x2bceda['define'](_0x9c21('0xa'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2607bd3..4437768 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 _0x9682=['catch','VoiceExtension','findAll','options','raw','attributes','limit','include','map','model','GetVoiceExtension','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis','socket.io-emitter','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','error','code','VoiceExtension,\x20%s,\x20%s','message','result'];(function(_0x1b6563,_0x3bf0f1){var _0xdea7b8=function(_0x49e6c6){while(--_0x49e6c6){_0x1b6563['push'](_0x1b6563['shift']());}};_0xdea7b8(++_0x3bf0f1);}(_0x9682,0x116));var _0x2968=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9682[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2968('0x0'));var moment=require(_0x2968('0x1'));var BPromise=require(_0x2968('0x2'));var rs=require(_0x2968('0x3'));var fs=require('fs');var Redis=require(_0x2968('0x4'));var db=require(_0x2968('0x5'))['db'];var utils=require(_0x2968('0x6'));var logger=require(_0x2968('0x7'))(_0x2968('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2968('0x9')][_0x2968('0xa')]({'port':0x232a});config['redis']=_[_0x2968('0xb')](config[_0x2968('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x2968('0xd'))(new Redis(config[_0x2968('0xc')]));require(_0x2968('0xe'))[_0x2968('0xf')](socket);function respondWithRpcPromise(_0x544dda,_0x5cc808,_0x277f35){return new BPromise(function(_0x1b334c,_0x3246a8){return client[_0x2968('0x10')](_0x544dda,_0x277f35)[_0x2968('0x11')](function(_0x1a7509){logger[_0x2968('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x5cc808,_0x2968('0x13'));logger[_0x2968('0x14')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x5cc808,_0x2968('0x13'),JSON['stringify'](_0x1a7509));if(_0x1a7509[_0x2968('0x15')]){if(_0x1a7509[_0x2968('0x15')][_0x2968('0x16')]===0x1f4){logger[_0x2968('0x15')](_0x2968('0x17'),_0x5cc808,_0x1a7509['error'][_0x2968('0x18')]);return _0x3246a8(_0x1a7509['error']['message']);}logger['error'](_0x2968('0x17'),_0x5cc808,_0x1a7509[_0x2968('0x15')][_0x2968('0x18')]);return _0x1b334c(_0x1a7509[_0x2968('0x15')]['message']);}else{logger[_0x2968('0x12')](_0x2968('0x17'),_0x5cc808,_0x2968('0x13'));_0x1b334c(_0x1a7509[_0x2968('0x19')][_0x2968('0x18')]);}})[_0x2968('0x1a')](function(_0xf8874f){logger[_0x2968('0x15')](_0x2968('0x17'),_0x5cc808,_0xf8874f);_0x3246a8(_0xf8874f);});});}exports['GetVoiceExtension']=function(_0x3ef98a){var _0x10b9fa=this;return new Promise(function(_0x5a222f,_0x16eb2b){return db[_0x2968('0x1b')][_0x2968('0x1c')]({'raw':_0x3ef98a[_0x2968('0x1d')]?_0x3ef98a['options'][_0x2968('0x1e')]===undefined?!![]:![]:!![],'where':_0x3ef98a[_0x2968('0x1d')]?_0x3ef98a[_0x2968('0x1d')]['where']||null:null,'attributes':_0x3ef98a[_0x2968('0x1d')]?_0x3ef98a[_0x2968('0x1d')][_0x2968('0x1f')]||null:null,'limit':_0x3ef98a[_0x2968('0x1d')]?_0x3ef98a[_0x2968('0x1d')][_0x2968('0x20')]||null:null,'include':_0x3ef98a[_0x2968('0x1d')]?_0x3ef98a['options'][_0x2968('0x21')]?_[_0x2968('0x22')](_0x3ef98a[_0x2968('0x1d')][_0x2968('0x21')],function(_0x55fd16){return{'model':db[_0x55fd16[_0x2968('0x23')]],'as':_0x55fd16['as'],'attributes':_0x55fd16['attributes'],'include':_0x55fd16[_0x2968('0x21')]?_[_0x2968('0x22')](_0x55fd16['include'],function(_0x4d0756){return{'model':db[_0x4d0756[_0x2968('0x23')]],'as':_0x4d0756['as'],'attributes':_0x4d0756['attributes'],'include':_0x4d0756[_0x2968('0x21')]?_[_0x2968('0x22')](_0x4d0756[_0x2968('0x21')],function(_0x5c43b2){return{'model':db[_0x5c43b2[_0x2968('0x23')]],'as':_0x5c43b2['as'],'attributes':_0x5c43b2[_0x2968('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2968('0x11')](function(_0xe68710){logger['info'](_0x2968('0x24'),_0x3ef98a);logger[_0x2968('0x14')]('GetVoiceExtension',_0x3ef98a,JSON[_0x2968('0x25')](_0xe68710));_0x5a222f(_0xe68710);})[_0x2968('0x1a')](function(_0x2dd2a7){logger[_0x2968('0x15')](_0x2968('0x24'),_0x2dd2a7['message'],_0x3ef98a);_0x16eb2b(_0x10b9fa['error'](0x1f4,_0x2dd2a7[_0x2968('0x18')]));});});}; \ No newline at end of file +var _0x5141=['GetVoiceExtension','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceExtension','findAll','options','attributes','limit','include','map','model'];(function(_0x19534c,_0x34d3b2){var _0x4726ed=function(_0x1b47d0){while(--_0x1b47d0){_0x19534c['push'](_0x19534c['shift']());}};_0x4726ed(++_0x34d3b2);}(_0x5141,0xec));var _0x1514=function(_0x181fb6,_0x5e2e11){_0x181fb6=_0x181fb6-0x0;var _0x3441c1=_0x5141[_0x181fb6];return _0x3441c1;};'use strict';var _=require(_0x1514('0x0'));var util=require('util');var moment=require(_0x1514('0x1'));var BPromise=require(_0x1514('0x2'));var rs=require(_0x1514('0x3'));var fs=require('fs');var Redis=require(_0x1514('0x4'));var db=require(_0x1514('0x5'))['db'];var utils=require(_0x1514('0x6'));var logger=require(_0x1514('0x7'))(_0x1514('0x8'));var config=require(_0x1514('0x9'));var jayson=require(_0x1514('0xa'));var client=jayson[_0x1514('0xb')]['http']({'port':0x232a});config['redis']=_[_0x1514('0xc')](config[_0x1514('0xd')],{'host':_0x1514('0xe'),'port':0x18eb});var socket=require(_0x1514('0xf'))(new Redis(config[_0x1514('0xd')]));require('./voiceExtension.socket')[_0x1514('0x10')](socket);function respondWithRpcPromise(_0x1c63eb,_0x7a96a0,_0x39da4d){return new BPromise(function(_0x1387a5,_0x9f1d47){return client[_0x1514('0x11')](_0x1c63eb,_0x39da4d)[_0x1514('0x12')](function(_0x1936f5){logger[_0x1514('0x13')](_0x1514('0x14'),_0x7a96a0,_0x1514('0x15'));logger[_0x1514('0x16')](_0x1514('0x17'),_0x7a96a0,_0x1514('0x15'),JSON['stringify'](_0x1936f5));if(_0x1936f5[_0x1514('0x18')]){if(_0x1936f5[_0x1514('0x18')][_0x1514('0x19')]===0x1f4){logger[_0x1514('0x18')](_0x1514('0x14'),_0x7a96a0,_0x1936f5[_0x1514('0x18')]['message']);return _0x9f1d47(_0x1936f5['error'][_0x1514('0x1a')]);}logger[_0x1514('0x18')](_0x1514('0x14'),_0x7a96a0,_0x1936f5[_0x1514('0x18')][_0x1514('0x1a')]);return _0x1387a5(_0x1936f5[_0x1514('0x18')][_0x1514('0x1a')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x7a96a0,_0x1514('0x15'));_0x1387a5(_0x1936f5[_0x1514('0x1b')][_0x1514('0x1a')]);}})[_0x1514('0x1c')](function(_0x2ec05a){logger[_0x1514('0x18')](_0x1514('0x14'),_0x7a96a0,_0x2ec05a);_0x9f1d47(_0x2ec05a);});});}exports['GetVoiceExtension']=function(_0x2fab49){var _0x1414ef=this;return new Promise(function(_0xcee6c4,_0x24301d){return db[_0x1514('0x1d')][_0x1514('0x1e')]({'raw':_0x2fab49[_0x1514('0x1f')]?_0x2fab49[_0x1514('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2fab49[_0x1514('0x1f')]?_0x2fab49[_0x1514('0x1f')]['where']||null:null,'attributes':_0x2fab49[_0x1514('0x1f')]?_0x2fab49[_0x1514('0x1f')][_0x1514('0x20')]||null:null,'limit':_0x2fab49[_0x1514('0x1f')]?_0x2fab49[_0x1514('0x1f')][_0x1514('0x21')]||null:null,'include':_0x2fab49[_0x1514('0x1f')]?_0x2fab49[_0x1514('0x1f')][_0x1514('0x22')]?_[_0x1514('0x23')](_0x2fab49[_0x1514('0x1f')][_0x1514('0x22')],function(_0x41c543){return{'model':db[_0x41c543[_0x1514('0x24')]],'as':_0x41c543['as'],'attributes':_0x41c543[_0x1514('0x20')],'include':_0x41c543[_0x1514('0x22')]?_[_0x1514('0x23')](_0x41c543[_0x1514('0x22')],function(_0x1ba213){return{'model':db[_0x1ba213['model']],'as':_0x1ba213['as'],'attributes':_0x1ba213['attributes'],'include':_0x1ba213[_0x1514('0x22')]?_[_0x1514('0x23')](_0x1ba213['include'],function(_0x117c33){return{'model':db[_0x117c33['model']],'as':_0x117c33['as'],'attributes':_0x117c33[_0x1514('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1514('0x12')](function(_0x281d22){logger['info']('GetVoiceExtension',_0x2fab49);logger[_0x1514('0x16')](_0x1514('0x25'),_0x2fab49,JSON[_0x1514('0x26')](_0x281d22));_0xcee6c4(_0x281d22);})[_0x1514('0x1c')](function(_0x5552be){logger[_0x1514('0x18')]('GetVoiceExtension',_0x5552be[_0x1514('0x1a')],_0x2fab49);_0x24301d(_0x1414ef[_0x1514('0x18')](0x1f4,_0x5552be['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index e85bce8..be7d21a 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 _0x6661=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x4aa4f6,_0x17d692){var _0x2d0114=function(_0x4731c2){while(--_0x4731c2){_0x4aa4f6['push'](_0x4aa4f6['shift']());}};_0x2d0114(++_0x17d692);}(_0x6661,0x186));var _0x1666=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x6661[_0x47aa64];return _0x549c7a;};'use strict';var VoiceExtensionEvents=require(_0x1666('0x0'));var events=[_0x1666('0x1'),'remove',_0x1666('0x2')];function createListener(_0x567958,_0x11a99e){return function(_0x5e30c1){_0x11a99e[_0x1666('0x3')](_0x567958,_0x5e30c1);};}function removeListener(_0x58b4f7,_0x3ebbcc){return function(){VoiceExtensionEvents[_0x1666('0x4')](_0x58b4f7,_0x3ebbcc);};}exports[_0x1666('0x5')]=function(_0x4dfea1){for(var _0x1c5000=0x0,_0x51a4a5=events[_0x1666('0x6')];_0x1c5000<_0x51a4a5;_0x1c5000++){var _0x14f200=events[_0x1c5000];var _0x43fc81=createListener(_0x1666('0x7')+_0x14f200,_0x4dfea1);VoiceExtensionEvents['on'](_0x14f200,_0x43fc81);}}; \ No newline at end of file +var _0x686e=['remove','update','emit','removeListener','register','./voiceExtension.events','save'];(function(_0x36d462,_0x143bdd){var _0x25a313=function(_0x34f576){while(--_0x34f576){_0x36d462['push'](_0x36d462['shift']());}};_0x25a313(++_0x143bdd);}(_0x686e,0x1cc));var _0xe686=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x686e[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceExtensionEvents=require(_0xe686('0x0'));var events=[_0xe686('0x1'),_0xe686('0x2'),_0xe686('0x3')];function createListener(_0x2c888f,_0x5dde52){return function(_0xc74796){_0x5dde52[_0xe686('0x4')](_0x2c888f,_0xc74796);};}function removeListener(_0x4b09bb,_0x1e60e4){return function(){VoiceExtensionEvents[_0xe686('0x5')](_0x4b09bb,_0x1e60e4);};}exports[_0xe686('0x6')]=function(_0xbc160a){for(var _0x54df8a=0x0,_0x2119fa=events['length'];_0x54df8a<_0x2119fa;_0x54df8a++){var _0x46f010=events[_0x54df8a];var _0x158f85=createListener('voiceExtension:'+_0x46f010,_0xbc160a);VoiceExtensionEvents['on'](_0x46f010,_0x158f85);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index bf9b29e..5b2dfba 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 _0x68a2=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','show','/:id/messages','post','/:id','update','delete','destroy','exports'];(function(_0x4440b2,_0x10863e){var _0x528d77=function(_0x23b583){while(--_0x23b583){_0x4440b2['push'](_0x4440b2['shift']());}};_0x528d77(++_0x10863e);}(_0x68a2,0x78));var _0x268a=function(_0x2d6ef2,_0x2f8091){_0x2d6ef2=_0x2d6ef2-0x0;var _0x33af33=_0x68a2[_0x2d6ef2];return _0x33af33;};'use strict';var multer=require(_0x268a('0x0'));var util=require(_0x268a('0x1'));var path=require(_0x268a('0x2'));var timeout=require(_0x268a('0x3'));var express=require('express');var router=express[_0x268a('0x4')]();var auth=require(_0x268a('0x5'));var interaction=require(_0x268a('0x6'));var config=require(_0x268a('0x7'));var controller=require(_0x268a('0x8'));router[_0x268a('0x9')]('/',auth[_0x268a('0xa')](),controller[_0x268a('0xb')]);router[_0x268a('0x9')]('/:id',auth[_0x268a('0xa')](),controller[_0x268a('0xc')]);router[_0x268a('0x9')](_0x268a('0xd'),auth['isAuthenticated'](),controller['getMessages']);router[_0x268a('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x268a('0xf'),auth['isAuthenticated'](),controller[_0x268a('0x10')]);router[_0x268a('0x11')](_0x268a('0xf'),auth[_0x268a('0xa')](),controller[_0x268a('0x12')]);module[_0x268a('0x13')]=router; \ No newline at end of file +var _0xd235=['../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','isAuthenticated','/:id/messages','getMessages','post','create','put','/:id','update','delete','destroy','exports','path','Router','../../components/auth/service'];(function(_0x123a99,_0x5f0db9){var _0x3ba390=function(_0x148f3f){while(--_0x148f3f){_0x123a99['push'](_0x123a99['shift']());}};_0x3ba390(++_0x5f0db9);}(_0xd235,0x179));var _0x5d23=function(_0xcf8b0c,_0xeedcc5){_0xcf8b0c=_0xcf8b0c-0x0;var _0x8dad63=_0xd235[_0xcf8b0c];return _0x8dad63;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5d23('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5d23('0x1')]();var auth=require(_0x5d23('0x2'));var interaction=require(_0x5d23('0x3'));var config=require(_0x5d23('0x4'));var controller=require(_0x5d23('0x5'));router[_0x5d23('0x6')]('/',auth['isAuthenticated'](),controller[_0x5d23('0x7')]);router[_0x5d23('0x6')]('/:id',auth[_0x5d23('0x8')](),controller['show']);router['get'](_0x5d23('0x9'),auth['isAuthenticated'](),controller[_0x5d23('0xa')]);router[_0x5d23('0xb')]('/',auth[_0x5d23('0x8')](),controller[_0x5d23('0xc')]);router[_0x5d23('0xd')](_0x5d23('0xe'),auth[_0x5d23('0x8')](),controller[_0x5d23('0xf')]);router[_0x5d23('0x10')](_0x5d23('0xe'),auth[_0x5d23('0x8')](),controller[_0x5d23('0x11')]);module[_0x5d23('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 30bd8a2..0fa1296 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 _0x8f4c=['fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue'];(function(_0x45a4a3,_0x259b4c){var _0xaeec48=function(_0x2057d3){while(--_0x2057d3){_0x45a4a3['push'](_0x45a4a3['shift']());}};_0xaeec48(++_0x259b4c);}(_0x8f4c,0x113));var _0xc8f4=function(_0x15f38c,_0x5cba33){_0x15f38c=_0x15f38c-0x0;var _0x3b94dd=_0x8f4c[_0x15f38c];return _0x3b94dd;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'customer_id':{'type':Sequelize[_0xc8f4('0x2')]},'context':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':_0xc8f4('0x3'),'unique':_0xc8f4('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xc8f4('0x4')},'password':{'type':Sequelize[_0xc8f4('0x2')]},'fullname':{'type':Sequelize[_0xc8f4('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x32cd80){this['setDataValue']('email',typeof _0x32cd80==='string'&&_0x32cd80[_0xc8f4('0x5')]()?_0x32cd80['trim']():null);}},'pager':{'type':Sequelize[_0xc8f4('0x2')]},'tz':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':_0xc8f4('0x6')},'attach':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':_0xc8f4('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc8f4('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc8f4('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc8f4('0x7')]('yes','no'),'defaultValue':_0xc8f4('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc8f4('0x7')](_0xc8f4('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xc8f4('0x8'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xc8f4('0x2')]},'emailbody':{'type':Sequelize[_0xc8f4('0x2')]},'maxsecs':{'type':Sequelize[_0xc8f4('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc8f4('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc8f4('0xb')],'get':function(){return this[_0xc8f4('0xc')](_0xc8f4('0xd'))+_0xc8f4('0xe')+this[_0xc8f4('0xc')](_0xc8f4('0xf'));}}}; \ No newline at end of file +var _0xda3f=['fullname','\x20-\x20','exports','STRING','setDataValue','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue'];(function(_0x49dfcc,_0x5da5e6){var _0x37a3d4=function(_0x4bf80f){while(--_0x4bf80f){_0x49dfcc['push'](_0x49dfcc['shift']());}};_0x37a3d4(++_0x5da5e6);}(_0xda3f,0xec));var _0xfda3=function(_0x34f41c,_0x1ebe12){_0x34f41c=_0x34f41c-0x0;var _0x58561b=_0xda3f[_0x34f41c];return _0x58561b;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'customer_id':{'type':Sequelize[_0xfda3('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xfda3('0x1')]},'fullname':{'type':Sequelize[_0xfda3('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x42bd74){this[_0xfda3('0x2')]('email',typeof _0x42bd74==='string'&&_0x42bd74[_0xfda3('0x3')]()?_0x42bd74[_0xfda3('0x3')]():null);}},'pager':{'type':Sequelize[_0xfda3('0x1')]},'tz':{'type':Sequelize[_0xfda3('0x1')],'defaultValue':_0xfda3('0x4')},'attach':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfda3('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfda3('0x7'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfda3('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfda3('0x5')](_0xfda3('0x6'),'no'),'defaultValue':_0xfda3('0x6'),'allowNull':![]},'stamp':{'type':_0xfda3('0x8')},'emailsubject':{'type':Sequelize[_0xfda3('0x1')]},'emailbody':{'type':Sequelize[_0xfda3('0x1')]},'maxsecs':{'type':Sequelize[_0xfda3('0x9')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfda3('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xfda3('0xa')](_0xfda3('0xb'))+_0xfda3('0xc')+this[_0xfda3('0xa')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index aea7ea1..e13b95c 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 _0xf911=['index','map','VoiceMail','rawAttributes','fieldName','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','status','set','Content-Range','apply','reject','save','update','destroy','get','Voicemails','UserProfileResource','then','error','stack','name'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf911,0xe2));var _0x1f91=function(_0x58fa9f,_0x5a4566){_0x58fa9f=_0x58fa9f-0x0;var _0x239fc5=_0xf911[_0x58fa9f];return _0x239fc5;};'use strict';var pdf=require(_0x1f91('0x0'));var emlformat=require(_0x1f91('0x1'));var rimraf=require(_0x1f91('0x2'));var zipdir=require(_0x1f91('0x3'));var jsonpatch=require(_0x1f91('0x4'));var rp=require(_0x1f91('0x5'));var moment=require(_0x1f91('0x6'));var BPromise=require(_0x1f91('0x7'));var Mustache=require('mustache');var util=require(_0x1f91('0x8'));var path=require(_0x1f91('0x9'));var sox=require(_0x1f91('0xa'));var csv=require(_0x1f91('0xb'));var ejs=require(_0x1f91('0xc'));var fs=require('fs');var _=require(_0x1f91('0xd'));var squel=require(_0x1f91('0xe'));var crypto=require('crypto');var jsforce=require(_0x1f91('0xf'));var deskjs=require(_0x1f91('0x10'));var toCsv=require(_0x1f91('0xb'));var querystring=require(_0x1f91('0x11'));var Papa=require(_0x1f91('0x12'));var Redis=require(_0x1f91('0x13'));var authService=require(_0x1f91('0x14'));var qs=require(_0x1f91('0x15'));var as=require(_0x1f91('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f91('0x17'))(_0x1f91('0x18'));var utils=require(_0x1f91('0x19'));var config=require(_0x1f91('0x1a'));var db=require(_0x1f91('0x1b'))['db'];function respondWithStatusCode(_0x4e688e,_0xb538a7){_0xb538a7=_0xb538a7||0xcc;return function(_0xf38020){if(_0xf38020){return _0x4e688e[_0x1f91('0x1c')](_0xb538a7);}return _0x4e688e['status'](_0xb538a7)['end']();};}function respondWithResult(_0x16dc0a,_0x58100c){_0x58100c=_0x58100c||0xc8;return function(_0x4a93f1){if(_0x4a93f1){return _0x16dc0a['status'](_0x58100c)[_0x1f91('0x1d')](_0x4a93f1);}};}function respondWithFilteredResult(_0x3ef5d5,_0x48b387){return function(_0x39b34e){if(_0x39b34e){var _0x4e575e=_0x39b34e[_0x1f91('0x1e')],_0x26bbe0=_0x48b387[_0x1f91('0x1f')],_0x248882=_0x48b387['offset']+_0x48b387['limit'],_0x1e495a;if(_0x248882>=_0x4e575e){_0x248882=_0x4e575e;_0x1e495a=0xc8;}else{_0x1e495a=0xce;}_0x3ef5d5[_0x1f91('0x20')](_0x1e495a);return _0x3ef5d5[_0x1f91('0x21')](_0x1f91('0x22'),_0x26bbe0+'-'+_0x248882+'/'+_0x4e575e)[_0x1f91('0x1d')](_0x39b34e);}return null;};}function patchUpdates(_0x25cc1a){return function(_0x1f69ac){try{jsonpatch[_0x1f91('0x23')](_0x1f69ac,_0x25cc1a,!![]);}catch(_0x181319){return BPromise[_0x1f91('0x24')](_0x181319);}return _0x1f69ac[_0x1f91('0x25')]();};}function saveUpdates(_0x50d2cd,_0x512c00){return function(_0x43353f){if(_0x43353f){return _0x43353f[_0x1f91('0x26')](_0x50d2cd)['then'](function(_0x24c1c6){return _0x24c1c6;});}return null;};}function removeEntity(_0x29b8ec,_0x10ec47){return function(_0x49f246){if(_0x49f246){return _0x49f246[_0x1f91('0x27')]()['then'](function(){var _0x3ba743=_0x49f246[_0x1f91('0x28')]({'plain':!![]});var _0x12edd5=_0x1f91('0x29');return db[_0x1f91('0x2a')][_0x1f91('0x27')]({'where':{'type':_0x12edd5,'resourceId':_0x3ba743['id']}})[_0x1f91('0x2b')](function(){return _0x49f246;});})[_0x1f91('0x2b')](function(){_0x29b8ec[_0x1f91('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49e4e9,_0x3dcddc){return function(_0x26730b){if(!_0x26730b){_0x49e4e9[_0x1f91('0x1c')](0x194);}return _0x26730b;};}function handleError(_0x3b80c1,_0x229c8c){_0x229c8c=_0x229c8c||0x1f4;return function(_0x5749c2){logger[_0x1f91('0x2c')](_0x5749c2[_0x1f91('0x2d')]);if(_0x5749c2[_0x1f91('0x2e')]){delete _0x5749c2['name'];}_0x3b80c1[_0x1f91('0x20')](_0x229c8c)['send'](_0x5749c2);};}exports[_0x1f91('0x2f')]=function(_0x4e4552,_0x483b3f){var _0x838277={},_0xcb72af={},_0x28eb04={'count':0x0,'rows':[]};var _0x14c3d3=_[_0x1f91('0x30')](db[_0x1f91('0x31')][_0x1f91('0x32')],function(_0x173abe){return{'name':_0x173abe[_0x1f91('0x33')],'type':_0x173abe[_0x1f91('0x34')]['key']};});_0xcb72af[_0x1f91('0x35')]=_[_0x1f91('0x30')](_0x14c3d3,_0x1f91('0x2e'));_0xcb72af['query']=_[_0x1f91('0x36')](_0x4e4552[_0x1f91('0x37')]);_0xcb72af['filters']=_['intersection'](_0xcb72af[_0x1f91('0x35')],_0xcb72af[_0x1f91('0x37')]);_0x838277[_0x1f91('0x38')]=_[_0x1f91('0x39')](_0xcb72af[_0x1f91('0x35')],qs[_0x1f91('0x3a')](_0x4e4552[_0x1f91('0x37')]['fields']));_0x838277[_0x1f91('0x38')]=_0x838277[_0x1f91('0x38')][_0x1f91('0x3b')]?_0x838277[_0x1f91('0x38')]:_0xcb72af[_0x1f91('0x35')];if(!_0x4e4552[_0x1f91('0x37')][_0x1f91('0x3c')](_0x1f91('0x3d'))){_0x838277[_0x1f91('0x3e')]=qs[_0x1f91('0x3e')](_0x4e4552['query'][_0x1f91('0x3e')]);_0x838277['offset']=qs[_0x1f91('0x1f')](_0x4e4552['query'][_0x1f91('0x1f')]);}_0x838277[_0x1f91('0x3f')]=qs[_0x1f91('0x40')](_0x4e4552[_0x1f91('0x37')][_0x1f91('0x40')]);_0x838277[_0x1f91('0x41')]=qs['filters'](_[_0x1f91('0x42')](_0x4e4552[_0x1f91('0x37')],_0xcb72af[_0x1f91('0x43')]));if(_0x4e4552[_0x1f91('0x37')][_0x1f91('0x44')]){_0x838277[_0x1f91('0x41')]=_['merge'](_0x838277['where'],{'$or':_[_0x1f91('0x30')](_0x14c3d3,function(_0x33e701){if(_0x33e701[_0x1f91('0x34')]!==_0x1f91('0x45')){var _0x11e171={};_0x11e171[_0x33e701[_0x1f91('0x2e')]]={'$like':'%'+_0x4e4552[_0x1f91('0x37')][_0x1f91('0x44')]+'%'};return _0x11e171;}})});}_0x838277=_[_0x1f91('0x46')]({},_0x838277,_0x4e4552[_0x1f91('0x47')]);var _0x4b9b7e={'where':_0x838277[_0x1f91('0x41')]};return db['VoiceMail'][_0x1f91('0x1e')](_0x4b9b7e)[_0x1f91('0x2b')](function(_0x1852e2){_0x28eb04[_0x1f91('0x1e')]=_0x1852e2;if(_0x4e4552[_0x1f91('0x37')][_0x1f91('0x48')]){_0x838277[_0x1f91('0x49')]=[{'all':!![]}];}return db[_0x1f91('0x31')][_0x1f91('0x4a')](_0x838277);})[_0x1f91('0x2b')](function(_0x2c04db){_0x28eb04[_0x1f91('0x4b')]=_0x2c04db;return _0x28eb04;})[_0x1f91('0x2b')](respondWithFilteredResult(_0x483b3f,_0x838277))[_0x1f91('0x4c')](handleError(_0x483b3f,null));};exports[_0x1f91('0x4d')]=function(_0x480bf9,_0x4c8c16){var _0x15400c={'raw':!![],'where':{'id':_0x480bf9['params']['id']}},_0x316937={};_0x316937[_0x1f91('0x35')]=_[_0x1f91('0x36')](db[_0x1f91('0x31')]['rawAttributes']);_0x316937[_0x1f91('0x37')]=_[_0x1f91('0x36')](_0x480bf9['query']);_0x316937['filters']=_[_0x1f91('0x39')](_0x316937[_0x1f91('0x35')],_0x316937['query']);_0x15400c[_0x1f91('0x38')]=_[_0x1f91('0x39')](_0x316937[_0x1f91('0x35')],qs[_0x1f91('0x3a')](_0x480bf9[_0x1f91('0x37')][_0x1f91('0x3a')]));_0x15400c[_0x1f91('0x38')]=_0x15400c[_0x1f91('0x38')][_0x1f91('0x3b')]?_0x15400c['attributes']:_0x316937['model'];if(_0x480bf9[_0x1f91('0x37')]['includeAll']){_0x15400c[_0x1f91('0x49')]=[{'all':!![]}];}_0x15400c=_['merge']({},_0x15400c,_0x480bf9['options']);return db[_0x1f91('0x31')][_0x1f91('0x4e')](_0x15400c)[_0x1f91('0x2b')](handleEntityNotFound(_0x4c8c16,null))[_0x1f91('0x2b')](respondWithResult(_0x4c8c16,null))['catch'](handleError(_0x4c8c16,null));};exports[_0x1f91('0x4f')]=function(_0x291525,_0x4e32bf){return db['VoiceMail']['create'](_0x291525[_0x1f91('0x50')],{})[_0x1f91('0x2b')](function(_0x4566f4){var _0x105cd2=_0x291525[_0x1f91('0x51')][_0x1f91('0x28')]({'plain':!![]});if(!_0x105cd2)throw new Error(_0x1f91('0x52'));if(_0x105cd2[_0x1f91('0x53')]==='user'){var _0x7bee0c=_0x4566f4[_0x1f91('0x28')]({'plain':!![]});var _0x3bd24f=_0x1f91('0x29');return db['UserProfileSection'][_0x1f91('0x4e')]({'where':{'name':_0x3bd24f,'userProfileId':_0x105cd2[_0x1f91('0x54')]},'raw':!![]})[_0x1f91('0x2b')](function(_0x2bac17){if(_0x2bac17&&_0x2bac17['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x7bee0c['name'],'resourceId':_0x7bee0c['id'],'type':_0x2bac17['name'],'sectionId':_0x2bac17['id']},{})[_0x1f91('0x2b')](function(){return _0x4566f4;});}else{return _0x4566f4;}})[_0x1f91('0x4c')](function(_0x17cf0e){logger[_0x1f91('0x2c')](_0x1f91('0x55'),_0x17cf0e);throw _0x17cf0e;});}return _0x4566f4;})['then'](respondWithResult(_0x4e32bf,0xc9))[_0x1f91('0x4c')](handleError(_0x4e32bf,null));};exports[_0x1f91('0x26')]=function(_0xb78521,_0x5f3391){if(_0xb78521['body']['id']){delete _0xb78521['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0xb78521['params']['id']}})['then'](handleEntityNotFound(_0x5f3391,null))[_0x1f91('0x2b')](saveUpdates(_0xb78521[_0x1f91('0x50')],null))[_0x1f91('0x2b')](respondWithResult(_0x5f3391,null))['catch'](handleError(_0x5f3391,null));};exports[_0x1f91('0x27')]=function(_0x55cdde,_0x8ef81){return db[_0x1f91('0x31')][_0x1f91('0x4e')]({'where':{'id':_0x55cdde[_0x1f91('0x56')]['id']}})[_0x1f91('0x2b')](handleEntityNotFound(_0x8ef81,null))[_0x1f91('0x2b')](removeEntity(_0x8ef81,null))[_0x1f91('0x4c')](handleError(_0x8ef81,null));};exports[_0x1f91('0x57')]=function(_0x2c7654,_0x2d8ef3,_0x5b06dc){return db[_0x1f91('0x31')][_0x1f91('0x58')]({'where':{'id':_0x2c7654[_0x1f91('0x56')]['id']}})[_0x1f91('0x2b')](handleEntityNotFound(_0x2d8ef3,null))[_0x1f91('0x2b')](function(_0x383eec){var _0x2d4260;var _0x325eeb={},_0x55f8d7={};_0x55f8d7[_0x1f91('0x35')]=_[_0x1f91('0x36')](db[_0x1f91('0x59')][_0x1f91('0x32')]);_0x55f8d7[_0x1f91('0x37')]=_[_0x1f91('0x36')](_0x2c7654[_0x1f91('0x37')]);_0x55f8d7['filters']=_['intersection'](_0x55f8d7[_0x1f91('0x35')],_0x55f8d7[_0x1f91('0x37')]);_0x325eeb['attributes']=_[_0x1f91('0x39')](_0x55f8d7[_0x1f91('0x35')],qs[_0x1f91('0x3a')](_0x2c7654[_0x1f91('0x37')][_0x1f91('0x3a')]));_0x325eeb[_0x1f91('0x38')]=_0x325eeb[_0x1f91('0x38')][_0x1f91('0x3b')]?_0x325eeb[_0x1f91('0x38')]:_0x55f8d7[_0x1f91('0x35')];if(!_0x2c7654[_0x1f91('0x37')][_0x1f91('0x3c')](_0x1f91('0x3d'))){_0x325eeb[_0x1f91('0x3e')]=qs[_0x1f91('0x3e')](_0x2c7654['query'][_0x1f91('0x3e')]);_0x325eeb[_0x1f91('0x1f')]=qs[_0x1f91('0x1f')](_0x2c7654[_0x1f91('0x37')]['offset']);}_0x325eeb['order']=qs[_0x1f91('0x40')](_0x2c7654[_0x1f91('0x37')][_0x1f91('0x40')]);_0x325eeb[_0x1f91('0x41')]=qs[_0x1f91('0x43')](_['pick'](_0x2c7654[_0x1f91('0x37')],_0x55f8d7[_0x1f91('0x43')]));if(_0x2c7654[_0x1f91('0x37')]['filter']){_0x325eeb[_0x1f91('0x41')]=_[_0x1f91('0x46')](_0x325eeb[_0x1f91('0x41')],{'$or':_[_0x1f91('0x30')](_0x325eeb[_0x1f91('0x38')],function(_0x163c5f){var _0x460b14={};_0x460b14[_0x163c5f]={'$like':'%'+_0x2c7654[_0x1f91('0x37')][_0x1f91('0x44')]+'%'};return _0x460b14;})});}_0x325eeb[_0x1f91('0x41')]=_[_0x1f91('0x46')](_0x325eeb['where'],{'mailboxuser':_0x383eec['mailbox']});_0x325eeb=_['merge']({},_0x325eeb,_0x2c7654[_0x1f91('0x47')]);return db[_0x1f91('0x59')][_0x1f91('0x5a')](_0x325eeb)[_0x1f91('0x2b')](respondWithFilteredResult(_0x2d8ef3,_0x325eeb));})[_0x1f91('0x4c')](handleError(_0x2d8ef3,null));}; \ No newline at end of file +var _0x6ae1=['userProfileId','autoAssociation','create','update','getMessages','findOne','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','count','offset','limit','apply','reject','save','destroy','then','Voicemails','UserProfileResource','sendStatus','error','name','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','includeAll','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection'];(function(_0x20cf03,_0x1dc823){var _0x32c818=function(_0x4005b5){while(--_0x4005b5){_0x20cf03['push'](_0x20cf03['shift']());}};_0x32c818(++_0x1dc823);}(_0x6ae1,0x15f));var _0x16ae=function(_0x2400fd,_0xaf87c){_0x2400fd=_0x2400fd-0x0;var _0xb28b3f=_0x6ae1[_0x2400fd];return _0xb28b3f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x16ae('0x0'));var rimraf=require(_0x16ae('0x1'));var zipdir=require(_0x16ae('0x2'));var jsonpatch=require(_0x16ae('0x3'));var rp=require(_0x16ae('0x4'));var moment=require(_0x16ae('0x5'));var BPromise=require(_0x16ae('0x6'));var Mustache=require(_0x16ae('0x7'));var util=require(_0x16ae('0x8'));var path=require(_0x16ae('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x16ae('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x16ae('0xb'));var crypto=require(_0x16ae('0xc'));var jsforce=require(_0x16ae('0xd'));var deskjs=require(_0x16ae('0xe'));var toCsv=require(_0x16ae('0xf'));var querystring=require(_0x16ae('0x10'));var Papa=require(_0x16ae('0x11'));var Redis=require(_0x16ae('0x12'));var authService=require(_0x16ae('0x13'));var qs=require(_0x16ae('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x16ae('0x15'));var logger=require(_0x16ae('0x16'))(_0x16ae('0x17'));var utils=require('../../config/utils');var config=require(_0x16ae('0x18'));var db=require(_0x16ae('0x19'))['db'];function respondWithStatusCode(_0x545000,_0x38c19a){_0x38c19a=_0x38c19a||0xcc;return function(_0x419cfb){if(_0x419cfb){return _0x545000['sendStatus'](_0x38c19a);}return _0x545000['status'](_0x38c19a)[_0x16ae('0x1a')]();};}function respondWithResult(_0xa218ed,_0x3e897d){_0x3e897d=_0x3e897d||0xc8;return function(_0xd42159){if(_0xd42159){return _0xa218ed[_0x16ae('0x1b')](_0x3e897d)['json'](_0xd42159);}};}function respondWithFilteredResult(_0x3685ad,_0x4bae92){return function(_0x4a547f){if(_0x4a547f){var _0x4a9f19=_0x4a547f[_0x16ae('0x1c')],_0x2fb040=_0x4bae92['offset'],_0x3d3404=_0x4bae92[_0x16ae('0x1d')]+_0x4bae92[_0x16ae('0x1e')],_0x3d59e4;if(_0x3d3404>=_0x4a9f19){_0x3d3404=_0x4a9f19;_0x3d59e4=0xc8;}else{_0x3d59e4=0xce;}_0x3685ad[_0x16ae('0x1b')](_0x3d59e4);return _0x3685ad['set']('Content-Range',_0x2fb040+'-'+_0x3d3404+'/'+_0x4a9f19)['json'](_0x4a547f);}return null;};}function patchUpdates(_0x2dbf69){return function(_0x57752e){try{jsonpatch[_0x16ae('0x1f')](_0x57752e,_0x2dbf69,!![]);}catch(_0xb129d2){return BPromise[_0x16ae('0x20')](_0xb129d2);}return _0x57752e[_0x16ae('0x21')]();};}function saveUpdates(_0x49608f,_0x56b3ae){return function(_0x642258){if(_0x642258){return _0x642258['update'](_0x49608f)['then'](function(_0x37e761){return _0x37e761;});}return null;};}function removeEntity(_0x4d3397,_0x3c19da){return function(_0x5df98c){if(_0x5df98c){return _0x5df98c[_0x16ae('0x22')]()[_0x16ae('0x23')](function(){var _0x5b19db=_0x5df98c['get']({'plain':!![]});var _0x1f3942=_0x16ae('0x24');return db[_0x16ae('0x25')][_0x16ae('0x22')]({'where':{'type':_0x1f3942,'resourceId':_0x5b19db['id']}})[_0x16ae('0x23')](function(){return _0x5df98c;});})[_0x16ae('0x23')](function(){_0x4d3397['status'](0xcc)[_0x16ae('0x1a')]();});}};}function handleEntityNotFound(_0x4ded60,_0x504a67){return function(_0x547371){if(!_0x547371){_0x4ded60[_0x16ae('0x26')](0x194);}return _0x547371;};}function handleError(_0x1e35dd,_0x2e06c2){_0x2e06c2=_0x2e06c2||0x1f4;return function(_0x28fa5f){logger[_0x16ae('0x27')](_0x28fa5f['stack']);if(_0x28fa5f[_0x16ae('0x28')]){delete _0x28fa5f[_0x16ae('0x28')];}_0x1e35dd['status'](_0x2e06c2)['send'](_0x28fa5f);};}exports[_0x16ae('0x29')]=function(_0x3d0ac3,_0x549c22){var _0x577c80={},_0x34aa72={},_0x33ea4b={'count':0x0,'rows':[]};var _0x3680ea=_[_0x16ae('0x2a')](db[_0x16ae('0x2b')][_0x16ae('0x2c')],function(_0x335dba){return{'name':_0x335dba[_0x16ae('0x2d')],'type':_0x335dba[_0x16ae('0x2e')][_0x16ae('0x2f')]};});_0x34aa72['model']=_[_0x16ae('0x2a')](_0x3680ea,'name');_0x34aa72[_0x16ae('0x30')]=_[_0x16ae('0x31')](_0x3d0ac3['query']);_0x34aa72[_0x16ae('0x32')]=_[_0x16ae('0x33')](_0x34aa72[_0x16ae('0x34')],_0x34aa72[_0x16ae('0x30')]);_0x577c80[_0x16ae('0x35')]=_['intersection'](_0x34aa72[_0x16ae('0x34')],qs[_0x16ae('0x36')](_0x3d0ac3[_0x16ae('0x30')][_0x16ae('0x36')]));_0x577c80['attributes']=_0x577c80['attributes'][_0x16ae('0x37')]?_0x577c80[_0x16ae('0x35')]:_0x34aa72[_0x16ae('0x34')];if(!_0x3d0ac3[_0x16ae('0x30')][_0x16ae('0x38')](_0x16ae('0x39'))){_0x577c80[_0x16ae('0x1e')]=qs[_0x16ae('0x1e')](_0x3d0ac3[_0x16ae('0x30')][_0x16ae('0x1e')]);_0x577c80[_0x16ae('0x1d')]=qs[_0x16ae('0x1d')](_0x3d0ac3['query'][_0x16ae('0x1d')]);}_0x577c80[_0x16ae('0x3a')]=qs[_0x16ae('0x3b')](_0x3d0ac3['query']['sort']);_0x577c80[_0x16ae('0x3c')]=qs[_0x16ae('0x32')](_[_0x16ae('0x3d')](_0x3d0ac3['query'],_0x34aa72[_0x16ae('0x32')]));if(_0x3d0ac3[_0x16ae('0x30')][_0x16ae('0x3e')]){_0x577c80[_0x16ae('0x3c')]=_[_0x16ae('0x3f')](_0x577c80[_0x16ae('0x3c')],{'$or':_[_0x16ae('0x2a')](_0x3680ea,function(_0x77af5b){if(_0x77af5b[_0x16ae('0x2e')]!==_0x16ae('0x40')){var _0x2be4fc={};_0x2be4fc[_0x77af5b[_0x16ae('0x28')]]={'$like':'%'+_0x3d0ac3['query'][_0x16ae('0x3e')]+'%'};return _0x2be4fc;}})});}_0x577c80=_[_0x16ae('0x3f')]({},_0x577c80,_0x3d0ac3[_0x16ae('0x41')]);var _0x477378={'where':_0x577c80[_0x16ae('0x3c')]};return db[_0x16ae('0x2b')][_0x16ae('0x1c')](_0x477378)[_0x16ae('0x23')](function(_0x2db005){_0x33ea4b[_0x16ae('0x1c')]=_0x2db005;if(_0x3d0ac3[_0x16ae('0x30')]['includeAll']){_0x577c80[_0x16ae('0x42')]=[{'all':!![]}];}return db[_0x16ae('0x2b')]['findAll'](_0x577c80);})[_0x16ae('0x23')](function(_0x1bb1d5){_0x33ea4b[_0x16ae('0x43')]=_0x1bb1d5;return _0x33ea4b;})[_0x16ae('0x23')](respondWithFilteredResult(_0x549c22,_0x577c80))['catch'](handleError(_0x549c22,null));};exports[_0x16ae('0x44')]=function(_0x1e2fcd,_0x30a88e){var _0x254616={'raw':!![],'where':{'id':_0x1e2fcd[_0x16ae('0x45')]['id']}},_0x44bcab={};_0x44bcab[_0x16ae('0x34')]=_[_0x16ae('0x31')](db[_0x16ae('0x2b')][_0x16ae('0x2c')]);_0x44bcab[_0x16ae('0x30')]=_[_0x16ae('0x31')](_0x1e2fcd['query']);_0x44bcab[_0x16ae('0x32')]=_['intersection'](_0x44bcab[_0x16ae('0x34')],_0x44bcab[_0x16ae('0x30')]);_0x254616['attributes']=_[_0x16ae('0x33')](_0x44bcab[_0x16ae('0x34')],qs['fields'](_0x1e2fcd[_0x16ae('0x30')]['fields']));_0x254616[_0x16ae('0x35')]=_0x254616[_0x16ae('0x35')][_0x16ae('0x37')]?_0x254616[_0x16ae('0x35')]:_0x44bcab['model'];if(_0x1e2fcd['query'][_0x16ae('0x46')]){_0x254616['include']=[{'all':!![]}];}_0x254616=_['merge']({},_0x254616,_0x1e2fcd[_0x16ae('0x41')]);return db[_0x16ae('0x2b')][_0x16ae('0x47')](_0x254616)[_0x16ae('0x23')](handleEntityNotFound(_0x30a88e,null))[_0x16ae('0x23')](respondWithResult(_0x30a88e,null))[_0x16ae('0x48')](handleError(_0x30a88e,null));};exports['create']=function(_0x3967a3,_0x156d25){return db[_0x16ae('0x2b')]['create'](_0x3967a3[_0x16ae('0x49')],{})['then'](function(_0x540313){var _0x57fb23=_0x3967a3[_0x16ae('0x4a')]['get']({'plain':!![]});if(!_0x57fb23)throw new Error(_0x16ae('0x4b'));if(_0x57fb23[_0x16ae('0x4c')]===_0x16ae('0x4a')){var _0x4bd355=_0x540313[_0x16ae('0x4d')]({'plain':!![]});var _0x85ac6f=_0x16ae('0x24');return db[_0x16ae('0x4e')][_0x16ae('0x47')]({'where':{'name':_0x85ac6f,'userProfileId':_0x57fb23[_0x16ae('0x4f')]},'raw':!![]})[_0x16ae('0x23')](function(_0x4990da){if(_0x4990da&&_0x4990da[_0x16ae('0x50')]===0x0){return db[_0x16ae('0x25')][_0x16ae('0x51')]({'name':_0x4bd355[_0x16ae('0x28')],'resourceId':_0x4bd355['id'],'type':_0x4990da[_0x16ae('0x28')],'sectionId':_0x4990da['id']},{})[_0x16ae('0x23')](function(){return _0x540313;});}else{return _0x540313;}})[_0x16ae('0x48')](function(_0x31f712){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31f712);throw _0x31f712;});}return _0x540313;})[_0x16ae('0x23')](respondWithResult(_0x156d25,0xc9))[_0x16ae('0x48')](handleError(_0x156d25,null));};exports[_0x16ae('0x52')]=function(_0x1f1be7,_0x48bf76){if(_0x1f1be7[_0x16ae('0x49')]['id']){delete _0x1f1be7[_0x16ae('0x49')]['id'];}return db[_0x16ae('0x2b')][_0x16ae('0x47')]({'where':{'id':_0x1f1be7[_0x16ae('0x45')]['id']}})[_0x16ae('0x23')](handleEntityNotFound(_0x48bf76,null))['then'](saveUpdates(_0x1f1be7[_0x16ae('0x49')],null))[_0x16ae('0x23')](respondWithResult(_0x48bf76,null))['catch'](handleError(_0x48bf76,null));};exports[_0x16ae('0x22')]=function(_0x13233e,_0x4cf3ba){return db[_0x16ae('0x2b')][_0x16ae('0x47')]({'where':{'id':_0x13233e[_0x16ae('0x45')]['id']}})[_0x16ae('0x23')](handleEntityNotFound(_0x4cf3ba,null))[_0x16ae('0x23')](removeEntity(_0x4cf3ba,null))[_0x16ae('0x48')](handleError(_0x4cf3ba,null));};exports[_0x16ae('0x53')]=function(_0x2d2e3a,_0x4c2275,_0x4d1bcf){return db['VoiceMail'][_0x16ae('0x54')]({'where':{'id':_0x2d2e3a[_0x16ae('0x45')]['id']}})[_0x16ae('0x23')](handleEntityNotFound(_0x4c2275,null))[_0x16ae('0x23')](function(_0x16e4e2){var _0x31e585;var _0x399618={},_0x559151={};_0x559151[_0x16ae('0x34')]=_[_0x16ae('0x31')](db['VoiceMailMessage'][_0x16ae('0x2c')]);_0x559151[_0x16ae('0x30')]=_[_0x16ae('0x31')](_0x2d2e3a['query']);_0x559151[_0x16ae('0x32')]=_[_0x16ae('0x33')](_0x559151[_0x16ae('0x34')],_0x559151[_0x16ae('0x30')]);_0x399618['attributes']=_[_0x16ae('0x33')](_0x559151[_0x16ae('0x34')],qs[_0x16ae('0x36')](_0x2d2e3a[_0x16ae('0x30')][_0x16ae('0x36')]));_0x399618[_0x16ae('0x35')]=_0x399618['attributes']['length']?_0x399618[_0x16ae('0x35')]:_0x559151['model'];if(!_0x2d2e3a[_0x16ae('0x30')][_0x16ae('0x38')](_0x16ae('0x39'))){_0x399618['limit']=qs[_0x16ae('0x1e')](_0x2d2e3a[_0x16ae('0x30')][_0x16ae('0x1e')]);_0x399618[_0x16ae('0x1d')]=qs[_0x16ae('0x1d')](_0x2d2e3a[_0x16ae('0x30')][_0x16ae('0x1d')]);}_0x399618['order']=qs[_0x16ae('0x3b')](_0x2d2e3a[_0x16ae('0x30')]['sort']);_0x399618[_0x16ae('0x3c')]=qs[_0x16ae('0x32')](_[_0x16ae('0x3d')](_0x2d2e3a['query'],_0x559151['filters']));if(_0x2d2e3a[_0x16ae('0x30')][_0x16ae('0x3e')]){_0x399618[_0x16ae('0x3c')]=_[_0x16ae('0x3f')](_0x399618[_0x16ae('0x3c')],{'$or':_[_0x16ae('0x2a')](_0x399618[_0x16ae('0x35')],function(_0x171662){var _0x3f269b={};_0x3f269b[_0x171662]={'$like':'%'+_0x2d2e3a[_0x16ae('0x30')][_0x16ae('0x3e')]+'%'};return _0x3f269b;})});}_0x399618[_0x16ae('0x3c')]=_['merge'](_0x399618[_0x16ae('0x3c')],{'mailboxuser':_0x16e4e2[_0x16ae('0x55')]});_0x399618=_['merge']({},_0x399618,_0x2d2e3a[_0x16ae('0x41')]);return db['VoiceMailMessage']['findAndCountAll'](_0x399618)[_0x16ae('0x23')](respondWithFilteredResult(_0x4c2275,_0x399618));})['catch'](handleError(_0x4c2275,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index dc6f2b1..0e5903e 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 _0x1179=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context'];(function(_0xd57d0a,_0x1fafcf){var _0x144321=function(_0x370e88){while(--_0x370e88){_0xd57d0a['push'](_0xd57d0a['shift']());}};_0x144321(++_0x1fafcf);}(_0x1179,0x7e));var _0x9117=function(_0x2f4819,_0x3b4b03){_0x2f4819=_0x2f4819-0x0;var _0x2363e0=_0x1179[_0x2f4819];return _0x2363e0;};'use strict';var _=require(_0x9117('0x0'));var util=require(_0x9117('0x1'));var logger=require(_0x9117('0x2'))('api');var moment=require(_0x9117('0x3'));var BPromise=require(_0x9117('0x4'));var rp=require(_0x9117('0x5'));var fs=require('fs');var path=require(_0x9117('0x6'));var rimraf=require(_0x9117('0x7'));var config=require(_0x9117('0x8'));var attributes=require(_0x9117('0x9'));module[_0x9117('0xa')]=function(_0xa7c429,_0x4d5751){return _0xa7c429[_0x9117('0xb')]('VoiceMail',attributes,{'tableName':_0x9117('0xc'),'paranoid':![],'indexes':[{'name':_0x9117('0xd'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e56=['define','VoiceMail','voice_voicemail','mailbox_context','context','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports'];(function(_0x561fdb,_0x4e443a){var _0x12638a=function(_0x5d3061){while(--_0x5d3061){_0x561fdb['push'](_0x561fdb['shift']());}};_0x12638a(++_0x4e443a);}(_0x0e56,0xf5));var _0x60e5=function(_0x2d719c,_0x59b346){_0x2d719c=_0x2d719c-0x0;var _0x16c7e8=_0x0e56[_0x2d719c];return _0x16c7e8;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var logger=require('../../config/logger')(_0x60e5('0x2'));var moment=require(_0x60e5('0x3'));var BPromise=require('bluebird');var rp=require(_0x60e5('0x4'));var fs=require('fs');var path=require(_0x60e5('0x5'));var rimraf=require(_0x60e5('0x6'));var config=require(_0x60e5('0x7'));var attributes=require(_0x60e5('0x8'));module[_0x60e5('0x9')]=function(_0x25b3a4,_0x54422a){return _0x25b3a4[_0x60e5('0xa')](_0x60e5('0xb'),attributes,{'tableName':_0x60e5('0xc'),'paranoid':![],'indexes':[{'name':_0x60e5('0xd'),'fields':['mailbox',_0x60e5('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 6836f26..37c324f 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 _0xe4b2=['info','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1387ef,_0x419a50){var _0x497e99=function(_0x7b6b5d){while(--_0x7b6b5d){_0x1387ef['push'](_0x1387ef['shift']());}};_0x497e99(++_0x419a50);}(_0xe4b2,0x16b));var _0x2e4b=function(_0x40645b,_0x13225a){_0x40645b=_0x40645b-0x0;var _0x56c8cc=_0xe4b2[_0x40645b];return _0x56c8cc;};'use strict';var _=require(_0x2e4b('0x0'));var util=require(_0x2e4b('0x1'));var moment=require('moment');var BPromise=require(_0x2e4b('0x2'));var rs=require(_0x2e4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2e4b('0x4'))['db'];var utils=require(_0x2e4b('0x5'));var logger=require(_0x2e4b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e4b('0x7')][_0x2e4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f73c,_0x377cc7,_0xa98dd){return new BPromise(function(_0x48f662,_0x79f3ef){return client['request'](_0x20f73c,_0xa98dd)[_0x2e4b('0x9')](function(_0x20a971){logger['info'](_0x2e4b('0xa'),_0x377cc7,_0x2e4b('0xb'));logger['debug'](_0x2e4b('0xc'),_0x377cc7,_0x2e4b('0xb'),JSON[_0x2e4b('0xd')](_0x20a971));if(_0x20a971[_0x2e4b('0xe')]){if(_0x20a971[_0x2e4b('0xe')][_0x2e4b('0xf')]===0x1f4){logger[_0x2e4b('0xe')](_0x2e4b('0xa'),_0x377cc7,_0x20a971[_0x2e4b('0xe')]['message']);return _0x79f3ef(_0x20a971[_0x2e4b('0xe')][_0x2e4b('0x10')]);}logger[_0x2e4b('0xe')](_0x2e4b('0xa'),_0x377cc7,_0x20a971[_0x2e4b('0xe')][_0x2e4b('0x10')]);return _0x48f662(_0x20a971[_0x2e4b('0xe')]['message']);}else{logger[_0x2e4b('0x11')](_0x2e4b('0xa'),_0x377cc7,'request\x20sent');_0x48f662(_0x20a971['result'][_0x2e4b('0x10')]);}})[_0x2e4b('0x12')](function(_0x56bbbe){logger[_0x2e4b('0xe')](_0x2e4b('0xa'),_0x377cc7,_0x56bbbe);_0x79f3ef(_0x56bbbe);});});} \ No newline at end of file +var _0x98ae=['client','request','then','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x493fc9,_0x597cf9){var _0x3a90c3=function(_0x4f9ca2){while(--_0x4f9ca2){_0x493fc9['push'](_0x493fc9['shift']());}};_0x3a90c3(++_0x597cf9);}(_0x98ae,0x1be));var _0xe98a=function(_0x2cf46c,_0x238b3a){_0x2cf46c=_0x2cf46c-0x0;var _0x15079d=_0x98ae[_0x2cf46c];return _0x15079d;};'use strict';var _=require('lodash');var util=require(_0xe98a('0x0'));var moment=require(_0xe98a('0x1'));var BPromise=require(_0xe98a('0x2'));var rs=require(_0xe98a('0x3'));var fs=require('fs');var Redis=require(_0xe98a('0x4'));var db=require(_0xe98a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe98a('0x6'))(_0xe98a('0x7'));var config=require(_0xe98a('0x8'));var jayson=require(_0xe98a('0x9'));var client=jayson[_0xe98a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x459e9e,_0x57d555,_0x5ec76b){return new BPromise(function(_0x4c61c1,_0x4480e9){return client[_0xe98a('0xb')](_0x459e9e,_0x5ec76b)[_0xe98a('0xc')](function(_0x4a545a){logger['info']('VoiceMail,\x20%s,\x20%s',_0x57d555,_0xe98a('0xd'));logger[_0xe98a('0xe')](_0xe98a('0xf'),_0x57d555,_0xe98a('0xd'),JSON[_0xe98a('0x10')](_0x4a545a));if(_0x4a545a[_0xe98a('0x11')]){if(_0x4a545a[_0xe98a('0x11')][_0xe98a('0x12')]===0x1f4){logger[_0xe98a('0x11')](_0xe98a('0x13'),_0x57d555,_0x4a545a[_0xe98a('0x11')][_0xe98a('0x14')]);return _0x4480e9(_0x4a545a[_0xe98a('0x11')]['message']);}logger['error'](_0xe98a('0x13'),_0x57d555,_0x4a545a[_0xe98a('0x11')][_0xe98a('0x14')]);return _0x4c61c1(_0x4a545a[_0xe98a('0x11')][_0xe98a('0x14')]);}else{logger[_0xe98a('0x15')](_0xe98a('0x13'),_0x57d555,_0xe98a('0xd'));_0x4c61c1(_0x4a545a[_0xe98a('0x16')][_0xe98a('0x14')]);}})[_0xe98a('0x17')](function(_0x2f54e8){logger['error'](_0xe98a('0x13'),_0x57d555,_0x2f54e8);_0x4480e9(_0x2f54e8);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index bcdef51..563509a 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 _0x1cb9=['../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x26a0d4,_0x4e402e){var _0x2302e6=function(_0x4828fb){while(--_0x4828fb){_0x26a0d4['push'](_0x26a0d4['shift']());}};_0x2302e6(++_0x4e402e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5da492,_0x1f03ed){_0x5da492=_0x5da492-0x0;var _0xba701a=_0x1cb9[_0x5da492];return _0xba701a;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x91cb('0x5'));var config=require(_0x91cb('0x6'));var controller=require('./voiceMailMessage.controller');router[_0x91cb('0x7')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0x9')]);router[_0x91cb('0x7')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller['show']);router[_0x91cb('0x7')]('/:id/download',auth[_0x91cb('0x8')](),controller['download']);router[_0x91cb('0xb')]('/',auth[_0x91cb('0x8')](),controller[_0x91cb('0xc')]);router[_0x91cb('0xd')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')](_0x91cb('0xa'),auth[_0x91cb('0x8')](),controller['destroy']);module[_0x91cb('0x10')]=router; \ No newline at end of file +var _0xdbf5=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','delete','destroy'];(function(_0x5150c4,_0x52b08f){var _0x526f3a=function(_0xc719ba){while(--_0xc719ba){_0x5150c4['push'](_0x5150c4['shift']());}};_0x526f3a(++_0x52b08f);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x55249b,_0x3edcbd){_0x55249b=_0x55249b-0x0;var _0x3340f=_0xdbf5[_0x55249b];return _0x3340f;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var auth=require(_0x5dbf('0x3'));var interaction=require(_0x5dbf('0x4'));var config=require(_0x5dbf('0x5'));var controller=require(_0x5dbf('0x6'));router[_0x5dbf('0x7')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0x9')]);router[_0x5dbf('0x7')](_0x5dbf('0xa'),auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xb')]);router['get'](_0x5dbf('0xc'),auth['isAuthenticated'](),controller[_0x5dbf('0xd')]);router[_0x5dbf('0xe')]('/',auth[_0x5dbf('0x8')](),controller[_0x5dbf('0xf')]);router['put'](_0x5dbf('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5dbf('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5dbf('0x11')]);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 1de2049..7f21f15 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 _0xa6e0=['getDataValue','INTEGER','STRING','long','TIMESTAMP','exports','VIRTUAL'];(function(_0x17266e,_0x5d273d){var _0x8eeaf4=function(_0xda6721){while(--_0xda6721){_0x17266e['push'](_0x17266e['shift']());}};_0x8eeaf4(++_0x5d273d);}(_0xa6e0,0x16a));var _0x0a6e=function(_0x125264,_0xfc8a9){_0x125264=_0x125264-0x0;var _0x16a028=_0xa6e0[_0x125264];return _0x16a028;};'use strict';var Sequelize=require('sequelize');module[_0x0a6e('0x0')]={'name':{'type':Sequelize[_0x0a6e('0x1')],'get':function(_0x3425b0){return this[_0x0a6e('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x0a6e('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x0a6e('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x0a6e('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x0a6e('0x4')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x0a6e('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x0a6e('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x0a6e('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x0a6e('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x0a6e('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x0a6e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x0a6e('0x4')],'defaultValue':''},'stamp':{'type':_0x0a6e('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0x54e1=['VIRTUAL','getDataValue','INTEGER','STRING','long','exports'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x54e1,0xb3));var _0x154e=function(_0x4b7858,_0x592cd6){_0x4b7858=_0x4b7858-0x0;var _0x46b3ff=_0x54e1[_0x4b7858];return _0x46b3ff;};'use strict';var Sequelize=require('sequelize');module[_0x154e('0x0')]={'name':{'type':Sequelize[_0x154e('0x1')],'get':function(_0x25a98c){return this[_0x154e('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x154e('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x154e('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x154e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index d0cdfe3..c4c8d53 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 _0x5ad3=['desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','model','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','options','count','includeAll','findAll','rows','catch','show','params','keys','intersection','fields','include','find','create','update','body','download','recording','msg_id','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce'];(function(_0x334fe9,_0x397830){var _0x235d04=function(_0x4dffe4){while(--_0x4dffe4){_0x334fe9['push'](_0x334fe9['shift']());}};_0x235d04(++_0x397830);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x46759d,_0x13e994){_0x46759d=_0x46759d-0x0;var _0x3e7fe0=_0x5ad3[_0x46759d];return _0x3e7fe0;};'use strict';var pdf=require(_0x35ad('0x0'));var emlformat=require(_0x35ad('0x1'));var rimraf=require(_0x35ad('0x2'));var zipdir=require(_0x35ad('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35ad('0x4'));var moment=require(_0x35ad('0x5'));var BPromise=require(_0x35ad('0x6'));var Mustache=require(_0x35ad('0x7'));var util=require(_0x35ad('0x8'));var path=require(_0x35ad('0x9'));var sox=require(_0x35ad('0xa'));var csv=require(_0x35ad('0xb'));var ejs=require(_0x35ad('0xc'));var fs=require('fs');var _=require(_0x35ad('0xd'));var squel=require('squel');var crypto=require(_0x35ad('0xe'));var jsforce=require(_0x35ad('0xf'));var deskjs=require(_0x35ad('0x10'));var toCsv=require('to-csv');var querystring=require(_0x35ad('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35ad('0x12'));var qs=require(_0x35ad('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35ad('0x14'));var logger=require(_0x35ad('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x35ad('0x16'));var db=require(_0x35ad('0x17'))['db'];function respondWithStatusCode(_0x4cf6bd,_0x3c4dd5){_0x3c4dd5=_0x3c4dd5||0xcc;return function(_0x33e2ec){if(_0x33e2ec){return _0x4cf6bd['sendStatus'](_0x3c4dd5);}return _0x4cf6bd['status'](_0x3c4dd5)[_0x35ad('0x18')]();};}function respondWithResult(_0x2e81c8,_0x3cda5e){_0x3cda5e=_0x3cda5e||0xc8;return function(_0x4b7ad9){if(_0x4b7ad9){return _0x2e81c8[_0x35ad('0x19')](_0x3cda5e)[_0x35ad('0x1a')](_0x4b7ad9);}};}function respondWithFilteredResult(_0x591917,_0x1494be){return function(_0x4d5185){if(_0x4d5185){var _0x4e3cd8=_0x4d5185['count'],_0x3a981a=_0x1494be[_0x35ad('0x1b')],_0x3ff2f0=_0x1494be[_0x35ad('0x1b')]+_0x1494be[_0x35ad('0x1c')],_0x27efeb;if(_0x3ff2f0>=_0x4e3cd8){_0x3ff2f0=_0x4e3cd8;_0x27efeb=0xc8;}else{_0x27efeb=0xce;}_0x591917[_0x35ad('0x19')](_0x27efeb);return _0x591917[_0x35ad('0x1d')](_0x35ad('0x1e'),_0x3a981a+'-'+_0x3ff2f0+'/'+_0x4e3cd8)['json'](_0x4d5185);}return null;};}function patchUpdates(_0xd32a43){return function(_0x2876ad){try{jsonpatch['apply'](_0x2876ad,_0xd32a43,!![]);}catch(_0x53b8e3){return BPromise[_0x35ad('0x1f')](_0x53b8e3);}return _0x2876ad[_0x35ad('0x20')]();};}function saveUpdates(_0x578b1b,_0x21f611){return function(_0x32735e){if(_0x32735e){return _0x32735e['update'](_0x578b1b)[_0x35ad('0x21')](function(_0x40e5e8){return _0x40e5e8;});}return null;};}function removeEntity(_0x504cbc,_0x30542c){return function(_0x1be6d2){if(_0x1be6d2){return _0x1be6d2[_0x35ad('0x22')]()[_0x35ad('0x21')](function(){_0x504cbc[_0x35ad('0x19')](0xcc)[_0x35ad('0x18')]();});}};}function handleEntityNotFound(_0xebc6c5,_0x4c5740){return function(_0x1cb9da){if(!_0x1cb9da){_0xebc6c5[_0x35ad('0x23')](0x194);}return _0x1cb9da;};}function handleError(_0x47e818,_0x43059e){_0x43059e=_0x43059e||0x1f4;return function(_0x6288a2){logger[_0x35ad('0x24')](_0x6288a2[_0x35ad('0x25')]);if(_0x6288a2[_0x35ad('0x26')]){delete _0x6288a2['name'];}_0x47e818[_0x35ad('0x19')](_0x43059e)[_0x35ad('0x27')](_0x6288a2);};}exports[_0x35ad('0x28')]=function(_0x1ca61d,_0x2ddb59){var _0x20a682={},_0x2e601a={},_0xaf7237={'count':0x0,'rows':[]};var _0x5418c2=_[_0x35ad('0x29')](db[_0x35ad('0x2a')][_0x35ad('0x2b')],function(_0x34b8b9){return{'name':_0x34b8b9[_0x35ad('0x2c')],'type':_0x34b8b9['type']['key']};});_0x2e601a[_0x35ad('0x2d')]=_['differenceBy'](_[_0x35ad('0x29')](_0x5418c2,'name'),['name']);_0x2e601a['query']=_['keys'](_0x1ca61d[_0x35ad('0x2e')]);_0x2e601a['filters']=_['intersection'](_0x2e601a[_0x35ad('0x2d')],_0x2e601a['query']);_0x20a682[_0x35ad('0x2f')]=_['intersection'](_0x2e601a[_0x35ad('0x2d')],qs['fields'](_0x1ca61d[_0x35ad('0x2e')]['fields']));_0x20a682[_0x35ad('0x2f')]=_0x20a682[_0x35ad('0x2f')][_0x35ad('0x30')]?_0x20a682['attributes']:_0x2e601a[_0x35ad('0x2d')];if(!_0x1ca61d[_0x35ad('0x2e')][_0x35ad('0x31')](_0x35ad('0x32'))){_0x20a682[_0x35ad('0x1c')]=qs['limit'](_0x1ca61d['query'][_0x35ad('0x1c')]);_0x20a682[_0x35ad('0x1b')]=qs[_0x35ad('0x1b')](_0x1ca61d[_0x35ad('0x2e')]['offset']);}_0x20a682[_0x35ad('0x33')]=qs[_0x35ad('0x34')](_0x1ca61d[_0x35ad('0x2e')][_0x35ad('0x34')]);_0x20a682[_0x35ad('0x35')]=qs[_0x35ad('0x36')](_['pick'](_0x1ca61d['query'],_0x2e601a[_0x35ad('0x36')]));if(_0x1ca61d[_0x35ad('0x2e')][_0x35ad('0x37')]){_0x20a682[_0x35ad('0x35')]=_[_0x35ad('0x38')](_0x20a682[_0x35ad('0x35')],{'$or':_[_0x35ad('0x29')](_0x5418c2,function(_0x2288f3){if(_0x2288f3[_0x35ad('0x39')]!=='VIRTUAL'){var _0x459d2f={};_0x459d2f[_0x2288f3['name']]={'$like':'%'+_0x1ca61d[_0x35ad('0x2e')][_0x35ad('0x37')]+'%'};return _0x459d2f;}})});}_0x20a682=_[_0x35ad('0x38')]({},_0x20a682,_0x1ca61d[_0x35ad('0x3a')]);var _0x1ad7e6={'where':_0x20a682[_0x35ad('0x35')]};return db[_0x35ad('0x2a')][_0x35ad('0x3b')](_0x1ad7e6)[_0x35ad('0x21')](function(_0x5dd327){_0xaf7237[_0x35ad('0x3b')]=_0x5dd327;if(_0x1ca61d[_0x35ad('0x2e')][_0x35ad('0x3c')]){_0x20a682['include']=[{'all':!![]}];}return db[_0x35ad('0x2a')][_0x35ad('0x3d')](_0x20a682);})[_0x35ad('0x21')](function(_0x5e137e){_0xaf7237[_0x35ad('0x3e')]=_0x5e137e;return _0xaf7237;})[_0x35ad('0x21')](respondWithFilteredResult(_0x2ddb59,_0x20a682))[_0x35ad('0x3f')](handleError(_0x2ddb59,null));};exports[_0x35ad('0x40')]=function(_0x11de09,_0x429470){var _0x21d730={'raw':!![],'where':{'id':_0x11de09[_0x35ad('0x41')]['id']}},_0x557bf4={};_0x557bf4['model']=_[_0x35ad('0x42')](db[_0x35ad('0x2a')][_0x35ad('0x2b')]);_0x557bf4[_0x35ad('0x2e')]=_[_0x35ad('0x42')](_0x11de09[_0x35ad('0x2e')]);_0x557bf4[_0x35ad('0x36')]=_[_0x35ad('0x43')](_0x557bf4[_0x35ad('0x2d')],_0x557bf4['query']);_0x21d730[_0x35ad('0x2f')]=_[_0x35ad('0x43')](_0x557bf4[_0x35ad('0x2d')],qs[_0x35ad('0x44')](_0x11de09[_0x35ad('0x2e')]['fields']));_0x21d730[_0x35ad('0x2f')]=_0x21d730[_0x35ad('0x2f')]['length']?_0x21d730['attributes']:_0x557bf4[_0x35ad('0x2d')];if(_0x11de09[_0x35ad('0x2e')][_0x35ad('0x3c')]){_0x21d730[_0x35ad('0x45')]=[{'all':!![]}];}_0x21d730=_['merge']({},_0x21d730,_0x11de09[_0x35ad('0x3a')]);return db[_0x35ad('0x2a')][_0x35ad('0x46')](_0x21d730)[_0x35ad('0x21')](handleEntityNotFound(_0x429470,null))[_0x35ad('0x21')](respondWithResult(_0x429470,null))[_0x35ad('0x3f')](handleError(_0x429470,null));};exports[_0x35ad('0x47')]=function(_0x599414,_0x3972fe){return db[_0x35ad('0x2a')][_0x35ad('0x47')](_0x599414['body'],{})['then'](respondWithResult(_0x3972fe,0xc9))['catch'](handleError(_0x3972fe,null));};exports[_0x35ad('0x48')]=function(_0x43899a,_0x34d531){if(_0x43899a[_0x35ad('0x49')]['id']){delete _0x43899a['body']['id'];}return db[_0x35ad('0x2a')][_0x35ad('0x46')]({'where':{'id':_0x43899a[_0x35ad('0x41')]['id']}})[_0x35ad('0x21')](handleEntityNotFound(_0x34d531,null))[_0x35ad('0x21')](saveUpdates(_0x43899a[_0x35ad('0x49')],null))['then'](respondWithResult(_0x34d531,null))['catch'](handleError(_0x34d531,null));};exports[_0x35ad('0x22')]=function(_0x3e5d31,_0x5acc34){return db['VoiceMailMessage'][_0x35ad('0x46')]({'where':{'id':_0x3e5d31[_0x35ad('0x41')]['id']}})[_0x35ad('0x21')](handleEntityNotFound(_0x5acc34,null))['then'](removeEntity(_0x5acc34,null))['catch'](handleError(_0x5acc34,null));};exports[_0x35ad('0x4a')]=function(_0x19bc07,_0x18e4f9,_0x5a8155){return db[_0x35ad('0x2a')][_0x35ad('0x46')]({'where':{'id':_0x19bc07[_0x35ad('0x41')]['id']},'attributes':['id',_0x35ad('0x4b'),_0x35ad('0x4c')]})[_0x35ad('0x21')](handleEntityNotFound(_0x18e4f9,null))['then'](function(_0x119b99){if(_0x119b99){if(!_0x119b99[_0x35ad('0x4b')]){throw new db[(_0x35ad('0x4d'))]['ValidationError'](_0x35ad('0x4e'));}var _0x2e0f1f={'Content-Type':_0x35ad('0x4f'),'Content-Disposition':_0x35ad('0x50')};if(_0x119b99['msg_id']){_0x2e0f1f['Content-Disposition']=_0x35ad('0x51')+_0x119b99[_0x35ad('0x4c')]+_0x35ad('0x52');}_0x18e4f9[_0x35ad('0x1d')](_0x2e0f1f);return _0x18e4f9[_0x35ad('0x27')](new Buffer(_0x119b99['recording']));}})[_0x35ad('0x3f')](handleError(_0x18e4f9,null));}; \ No newline at end of file +var _0xcca7=['merge','options','includeAll','include','catch','params','rawAttributes','intersection','length','find','create','body','destroy','download','recording','msg_id','Sequelize','ValidationError','audio/wav','attachment;\x20filename=\x22','set','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','VoiceMailMessage','fieldName','type','differenceBy','query','keys','model','attributes','fields','order','sort','where','filters','pick','filter','VIRTUAL'];(function(_0x2410e9,_0x6028ce){var _0x560eba=function(_0x2fac3e){while(--_0x2fac3e){_0x2410e9['push'](_0x2410e9['shift']());}};_0x560eba(++_0x6028ce);}(_0xcca7,0x1aa));var _0x7cca=function(_0x23430f,_0x413d86){_0x23430f=_0x23430f-0x0;var _0x130459=_0xcca7[_0x23430f];return _0x130459;};'use strict';var pdf=require(_0x7cca('0x0'));var emlformat=require(_0x7cca('0x1'));var rimraf=require(_0x7cca('0x2'));var zipdir=require(_0x7cca('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7cca('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7cca('0x5'));var util=require(_0x7cca('0x6'));var path=require(_0x7cca('0x7'));var sox=require(_0x7cca('0x8'));var csv=require(_0x7cca('0x9'));var ejs=require(_0x7cca('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x7cca('0xb'));var jsforce=require(_0x7cca('0xc'));var deskjs=require(_0x7cca('0xd'));var toCsv=require(_0x7cca('0x9'));var querystring=require(_0x7cca('0xe'));var Papa=require(_0x7cca('0xf'));var Redis=require(_0x7cca('0x10'));var authService=require(_0x7cca('0x11'));var qs=require(_0x7cca('0x12'));var as=require(_0x7cca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cca('0x14'))(_0x7cca('0x15'));var utils=require(_0x7cca('0x16'));var config=require(_0x7cca('0x17'));var db=require(_0x7cca('0x18'))['db'];function respondWithStatusCode(_0x4b7b66,_0x2a14cc){_0x2a14cc=_0x2a14cc||0xcc;return function(_0x41e0a2){if(_0x41e0a2){return _0x4b7b66[_0x7cca('0x19')](_0x2a14cc);}return _0x4b7b66['status'](_0x2a14cc)['end']();};}function respondWithResult(_0x8ea157,_0x20c1b2){_0x20c1b2=_0x20c1b2||0xc8;return function(_0x27d671){if(_0x27d671){return _0x8ea157[_0x7cca('0x1a')](_0x20c1b2)[_0x7cca('0x1b')](_0x27d671);}};}function respondWithFilteredResult(_0x3d3141,_0x45143d){return function(_0x5a357d){if(_0x5a357d){var _0x216d4b=_0x5a357d[_0x7cca('0x1c')],_0x533608=_0x45143d[_0x7cca('0x1d')],_0x5cd551=_0x45143d[_0x7cca('0x1d')]+_0x45143d[_0x7cca('0x1e')],_0x4eb7fa;if(_0x5cd551>=_0x216d4b){_0x5cd551=_0x216d4b;_0x4eb7fa=0xc8;}else{_0x4eb7fa=0xce;}_0x3d3141[_0x7cca('0x1a')](_0x4eb7fa);return _0x3d3141['set'](_0x7cca('0x1f'),_0x533608+'-'+_0x5cd551+'/'+_0x216d4b)['json'](_0x5a357d);}return null;};}function patchUpdates(_0x5d47f8){return function(_0x5d7ac6){try{jsonpatch[_0x7cca('0x20')](_0x5d7ac6,_0x5d47f8,!![]);}catch(_0x25297b){return BPromise[_0x7cca('0x21')](_0x25297b);}return _0x5d7ac6[_0x7cca('0x22')]();};}function saveUpdates(_0x36ba41,_0x45db2f){return function(_0x2e023c){if(_0x2e023c){return _0x2e023c[_0x7cca('0x23')](_0x36ba41)['then'](function(_0x31baf4){return _0x31baf4;});}return null;};}function removeEntity(_0x3154b0,_0x165d13){return function(_0x4343a3){if(_0x4343a3){return _0x4343a3['destroy']()[_0x7cca('0x24')](function(){_0x3154b0[_0x7cca('0x1a')](0xcc)[_0x7cca('0x25')]();});}};}function handleEntityNotFound(_0x119d76,_0x823d7d){return function(_0x3fc157){if(!_0x3fc157){_0x119d76[_0x7cca('0x19')](0x194);}return _0x3fc157;};}function handleError(_0xaf9264,_0x4b99b6){_0x4b99b6=_0x4b99b6||0x1f4;return function(_0xfe121c){logger[_0x7cca('0x26')](_0xfe121c[_0x7cca('0x27')]);if(_0xfe121c[_0x7cca('0x28')]){delete _0xfe121c[_0x7cca('0x28')];}_0xaf9264[_0x7cca('0x1a')](_0x4b99b6)[_0x7cca('0x29')](_0xfe121c);};}exports[_0x7cca('0x2a')]=function(_0x583846,_0x2cafe1){var _0x5c8410={},_0xc86c1b={},_0x201fbb={'count':0x0,'rows':[]};var _0x5a87d6=_[_0x7cca('0x2b')](db[_0x7cca('0x2c')]['rawAttributes'],function(_0x249442){return{'name':_0x249442[_0x7cca('0x2d')],'type':_0x249442[_0x7cca('0x2e')]['key']};});_0xc86c1b['model']=_[_0x7cca('0x2f')](_[_0x7cca('0x2b')](_0x5a87d6,_0x7cca('0x28')),[_0x7cca('0x28')]);_0xc86c1b[_0x7cca('0x30')]=_[_0x7cca('0x31')](_0x583846[_0x7cca('0x30')]);_0xc86c1b['filters']=_['intersection'](_0xc86c1b[_0x7cca('0x32')],_0xc86c1b[_0x7cca('0x30')]);_0x5c8410[_0x7cca('0x33')]=_['intersection'](_0xc86c1b[_0x7cca('0x32')],qs['fields'](_0x583846[_0x7cca('0x30')][_0x7cca('0x34')]));_0x5c8410[_0x7cca('0x33')]=_0x5c8410[_0x7cca('0x33')]['length']?_0x5c8410[_0x7cca('0x33')]:_0xc86c1b[_0x7cca('0x32')];if(!_0x583846[_0x7cca('0x30')]['hasOwnProperty']('nolimit')){_0x5c8410['limit']=qs[_0x7cca('0x1e')](_0x583846[_0x7cca('0x30')]['limit']);_0x5c8410[_0x7cca('0x1d')]=qs[_0x7cca('0x1d')](_0x583846[_0x7cca('0x30')][_0x7cca('0x1d')]);}_0x5c8410[_0x7cca('0x35')]=qs[_0x7cca('0x36')](_0x583846[_0x7cca('0x30')]['sort']);_0x5c8410[_0x7cca('0x37')]=qs[_0x7cca('0x38')](_[_0x7cca('0x39')](_0x583846[_0x7cca('0x30')],_0xc86c1b['filters']));if(_0x583846[_0x7cca('0x30')][_0x7cca('0x3a')]){_0x5c8410[_0x7cca('0x37')]=_['merge'](_0x5c8410[_0x7cca('0x37')],{'$or':_['map'](_0x5a87d6,function(_0x36ad6a){if(_0x36ad6a[_0x7cca('0x2e')]!==_0x7cca('0x3b')){var _0x333c82={};_0x333c82[_0x36ad6a[_0x7cca('0x28')]]={'$like':'%'+_0x583846[_0x7cca('0x30')][_0x7cca('0x3a')]+'%'};return _0x333c82;}})});}_0x5c8410=_[_0x7cca('0x3c')]({},_0x5c8410,_0x583846[_0x7cca('0x3d')]);var _0x4f1f11={'where':_0x5c8410['where']};return db[_0x7cca('0x2c')][_0x7cca('0x1c')](_0x4f1f11)['then'](function(_0x48d87f){_0x201fbb[_0x7cca('0x1c')]=_0x48d87f;if(_0x583846[_0x7cca('0x30')][_0x7cca('0x3e')]){_0x5c8410[_0x7cca('0x3f')]=[{'all':!![]}];}return db[_0x7cca('0x2c')]['findAll'](_0x5c8410);})[_0x7cca('0x24')](function(_0x5ee9e7){_0x201fbb['rows']=_0x5ee9e7;return _0x201fbb;})[_0x7cca('0x24')](respondWithFilteredResult(_0x2cafe1,_0x5c8410))[_0x7cca('0x40')](handleError(_0x2cafe1,null));};exports['show']=function(_0x3b120b,_0x5d1a4a){var _0x1303e0={'raw':!![],'where':{'id':_0x3b120b[_0x7cca('0x41')]['id']}},_0x3edb26={};_0x3edb26['model']=_[_0x7cca('0x31')](db[_0x7cca('0x2c')][_0x7cca('0x42')]);_0x3edb26[_0x7cca('0x30')]=_['keys'](_0x3b120b[_0x7cca('0x30')]);_0x3edb26[_0x7cca('0x38')]=_[_0x7cca('0x43')](_0x3edb26[_0x7cca('0x32')],_0x3edb26[_0x7cca('0x30')]);_0x1303e0[_0x7cca('0x33')]=_['intersection'](_0x3edb26['model'],qs['fields'](_0x3b120b['query'][_0x7cca('0x34')]));_0x1303e0['attributes']=_0x1303e0['attributes'][_0x7cca('0x44')]?_0x1303e0[_0x7cca('0x33')]:_0x3edb26[_0x7cca('0x32')];if(_0x3b120b[_0x7cca('0x30')][_0x7cca('0x3e')]){_0x1303e0['include']=[{'all':!![]}];}_0x1303e0=_[_0x7cca('0x3c')]({},_0x1303e0,_0x3b120b[_0x7cca('0x3d')]);return db[_0x7cca('0x2c')][_0x7cca('0x45')](_0x1303e0)[_0x7cca('0x24')](handleEntityNotFound(_0x5d1a4a,null))[_0x7cca('0x24')](respondWithResult(_0x5d1a4a,null))[_0x7cca('0x40')](handleError(_0x5d1a4a,null));};exports[_0x7cca('0x46')]=function(_0x20458d,_0x1e9a9a){return db[_0x7cca('0x2c')]['create'](_0x20458d['body'],{})[_0x7cca('0x24')](respondWithResult(_0x1e9a9a,0xc9))[_0x7cca('0x40')](handleError(_0x1e9a9a,null));};exports[_0x7cca('0x23')]=function(_0x41296d,_0x3cd0c4){if(_0x41296d[_0x7cca('0x47')]['id']){delete _0x41296d[_0x7cca('0x47')]['id'];}return db[_0x7cca('0x2c')][_0x7cca('0x45')]({'where':{'id':_0x41296d[_0x7cca('0x41')]['id']}})[_0x7cca('0x24')](handleEntityNotFound(_0x3cd0c4,null))[_0x7cca('0x24')](saveUpdates(_0x41296d['body'],null))[_0x7cca('0x24')](respondWithResult(_0x3cd0c4,null))[_0x7cca('0x40')](handleError(_0x3cd0c4,null));};exports[_0x7cca('0x48')]=function(_0x74d4b3,_0x182ee5){return db[_0x7cca('0x2c')][_0x7cca('0x45')]({'where':{'id':_0x74d4b3[_0x7cca('0x41')]['id']}})[_0x7cca('0x24')](handleEntityNotFound(_0x182ee5,null))[_0x7cca('0x24')](removeEntity(_0x182ee5,null))[_0x7cca('0x40')](handleError(_0x182ee5,null));};exports[_0x7cca('0x49')]=function(_0x1253d8,_0xa043c0,_0x5edb41){return db[_0x7cca('0x2c')][_0x7cca('0x45')]({'where':{'id':_0x1253d8[_0x7cca('0x41')]['id']},'attributes':['id',_0x7cca('0x4a'),_0x7cca('0x4b')]})[_0x7cca('0x24')](handleEntityNotFound(_0xa043c0,null))[_0x7cca('0x24')](function(_0xc72da3){if(_0xc72da3){if(!_0xc72da3[_0x7cca('0x4a')]){throw new db[(_0x7cca('0x4c'))][(_0x7cca('0x4d'))]('VoiceMailMessage\x20not\x20found');}var _0x17c142={'Content-Type':_0x7cca('0x4e'),'Content-Disposition':'attachment'};if(_0xc72da3['msg_id']){_0x17c142['Content-Disposition']=_0x7cca('0x4f')+_0xc72da3[_0x7cca('0x4b')]+'.wav\x22';}_0xa043c0[_0x7cca('0x50')](_0x17c142);return _0xa043c0[_0x7cca('0x29')](new Buffer(_0xc72da3['recording']));}})[_0x7cca('0x40')](handleError(_0xa043c0,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 0a3c0ab..e20264f 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 _0xd620=['dir','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','VoiceMailMessage'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0xd620,0x1c4));var _0x0d62=function(_0xfa5058,_0x33cf1e){_0xfa5058=_0xfa5058-0x0;var _0x4e28b1=_0xd620[_0xfa5058];return _0x4e28b1;};'use strict';var _=require(_0x0d62('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0d62('0x1'));var moment=require(_0x0d62('0x2'));var BPromise=require(_0x0d62('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d62('0x4'));var rimraf=require(_0x0d62('0x5'));var config=require(_0x0d62('0x6'));var attributes=require(_0x0d62('0x7'));module['exports']=function(_0x573c58,_0x5876a3){return _0x573c58[_0x0d62('0x8')](_0x0d62('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x0d62('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xfa37=['lodash','../../config/logger','api','path','rimraf','exports'];(function(_0x39d711,_0xe11eb7){var _0xee1d0c=function(_0x457e08){while(--_0x457e08){_0x39d711['push'](_0x39d711['shift']());}};_0xee1d0c(++_0xe11eb7);}(_0xfa37,0x78));var _0x7fa3=function(_0x526a90,_0x3b3fd6){_0x526a90=_0x526a90-0x0;var _0x91cd91=_0xfa37[_0x526a90];return _0x91cd91;};'use strict';var _=require(_0x7fa3('0x0'));var util=require('util');var logger=require(_0x7fa3('0x1'))(_0x7fa3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7fa3('0x3'));var rimraf=require(_0x7fa3('0x4'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x7fa3('0x5')]=function(_0x373035,_0x11c994){return _0x373035['define']('VoiceMailMessage',attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','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 59e66ec..8c8202b 100644 --- a/server/api/voiceMailMessage/voiceMailMessage.rpc.js +++ b/server/api/voiceMailMessage/voiceMailMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5c7111,_0x52d230){var _0x9e50f3=function(_0x3ccbe5){while(--_0x3ccbe5){_0x5c7111['push'](_0x5c7111['shift']());}};_0x9e50f3(++_0x52d230);}(_0x57ca,0x108));var _0xa57c=function(_0x15f968,_0xc17341){_0x15f968=_0x15f968-0x0;var _0x290861=_0x57ca[_0x15f968];return _0x290861;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file +var _0x1967=['then','info','VoiceMailMessage,\x20%s,\x20%s','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x1967,0x173));var _0x7196=function(_0x170a36,_0x2041b4){_0x170a36=_0x170a36-0x0;var _0x396261=_0x1967[_0x170a36];return _0x396261;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index d69ab1c..e6e58dc 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 _0x4cb6=['../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','removeSound','exports','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cb6,0x1df));var _0x64cb=function(_0xb489d4,_0x4a6d21){_0xb489d4=_0xb489d4-0x0;var _0x4b9034=_0x4cb6[_0xb489d4];return _0x4b9034;};'use strict';var multer=require(_0x64cb('0x0'));var util=require('util');var path=require(_0x64cb('0x1'));var timeout=require(_0x64cb('0x2'));var express=require('express');var router=express[_0x64cb('0x3')]();var auth=require(_0x64cb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x64cb('0x5'));var controller=require(_0x64cb('0x6'));router[_0x64cb('0x7')]('/',auth[_0x64cb('0x8')](),controller[_0x64cb('0x9')]);router[_0x64cb('0x7')](_0x64cb('0xa'),auth[_0x64cb('0x8')](),controller[_0x64cb('0xb')]);router[_0x64cb('0x7')](_0x64cb('0xc'),auth['isAuthenticated'](),controller[_0x64cb('0xd')]);router['post']('/',auth[_0x64cb('0x8')](),controller['create']);router[_0x64cb('0xe')](_0x64cb('0xc'),auth[_0x64cb('0x8')](),controller[_0x64cb('0xf')]);router[_0x64cb('0x10')](_0x64cb('0xa'),auth[_0x64cb('0x8')](),controller[_0x64cb('0x11')]);router[_0x64cb('0x12')](_0x64cb('0xa'),auth[_0x64cb('0x8')](),controller[_0x64cb('0x13')]);router[_0x64cb('0x12')]('/:id/sounds/:id2',auth[_0x64cb('0x8')](),controller[_0x64cb('0x14')]);module[_0x64cb('0x15')]=router; \ No newline at end of file +var _0x7012=['/:id/sounds/:id2','removeSound','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id/sounds','isAuthenticated','getSounds','post','addSound','update','delete','/:id','destroy'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x7012,0x179));var _0x2701=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x7012[_0x2064e5];return _0x21a233;};'use strict';var multer=require('multer');var util=require(_0x2701('0x0'));var path=require('path');var timeout=require(_0x2701('0x1'));var express=require(_0x2701('0x2'));var router=express[_0x2701('0x3')]();var auth=require(_0x2701('0x4'));var interaction=require(_0x2701('0x5'));var config=require(_0x2701('0x6'));var controller=require(_0x2701('0x7'));router[_0x2701('0x8')]('/',auth['isAuthenticated'](),controller[_0x2701('0x9')]);router[_0x2701('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2701('0x8')](_0x2701('0xa'),auth[_0x2701('0xb')](),controller[_0x2701('0xc')]);router[_0x2701('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2701('0xd')](_0x2701('0xa'),auth['isAuthenticated'](),controller[_0x2701('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2701('0xf')]);router[_0x2701('0x10')](_0x2701('0x11'),auth[_0x2701('0xb')](),controller[_0x2701('0x12')]);router[_0x2701('0x10')](_0x2701('0x13'),auth[_0x2701('0xb')](),controller[_0x2701('0x14')]);module[_0x2701('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index ed7351c..01c205d 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 _0x9d11=['quietmp3','mp3','STRING','alpha','TIMESTAMP','sequelize','exports','name','ENUM','files','mp3nb','quietmp3nb'];(function(_0x32b7d6,_0x588581){var _0x50bf0f=function(_0x56d204){while(--_0x56d204){_0x32b7d6['push'](_0x32b7d6['shift']());}};_0x50bf0f(++_0x588581);}(_0x9d11,0xd1));var _0x19d1=function(_0x5cab28,_0x307622){_0x5cab28=_0x5cab28-0x0;var _0xa3554d=_0x9d11[_0x5cab28];return _0xa3554d;};'use strict';var Sequelize=require(_0x19d1('0x0'));module[_0x19d1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x19d1('0x2')},'mode':{'type':Sequelize[_0x19d1('0x3')]('custom',_0x19d1('0x4'),_0x19d1('0x5'),_0x19d1('0x6'),_0x19d1('0x7'),_0x19d1('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x19d1('0x9')],'allowNull':!![]},'application':{'type':Sequelize[_0x19d1('0x9')],'allowNull':!![]},'digit':{'type':Sequelize[_0x19d1('0x9')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x19d1('0xa')},'format':{'type':Sequelize[_0x19d1('0x9')],'allowNull':!![]},'stamp':{'type':_0x19d1('0xb')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x82ce=['mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','name','custom','files'];(function(_0x4a0801,_0x55b298){var _0x47306d=function(_0x415a91){while(--_0x415a91){_0x4a0801['push'](_0x4a0801['shift']());}};_0x47306d(++_0x55b298);}(_0x82ce,0x11b));var _0xe82c=function(_0x2cc65c,_0x42906a){_0x2cc65c=_0x2cc65c-0x0;var _0x265c22=_0x82ce[_0x2cc65c];return _0x265c22;};'use strict';var Sequelize=require('sequelize');module[_0xe82c('0x0')]={'name':{'type':Sequelize[_0xe82c('0x1')],'allowNull':![],'unique':_0xe82c('0x2')},'mode':{'type':Sequelize['ENUM'](_0xe82c('0x3'),_0xe82c('0x4'),_0xe82c('0x5'),_0xe82c('0x6'),_0xe82c('0x7'),_0xe82c('0x8')),'allowNull':!![],'defaultValue':_0xe82c('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xe82c('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xe82c('0x1')],'allowNull':!![],'defaultValue':_0xe82c('0x9')},'format':{'type':Sequelize[_0xe82c('0x1')],'allowNull':!![]},'stamp':{'type':_0xe82c('0xa')},'defaultEntry':{'type':Sequelize[_0xe82c('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 9501e24..b4305ec 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 _0x5450=['server/files/sounds/converted','format','%s.%s','basename','converted_format','removeSound','id2','Sound','getSounds','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','apply','reject','save','update','then','get','MusicOnHolds','destroy','stack','name','send','map','VoiceMusicOnHold','rawAttributes','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','intersection','includeAll','find','catch','body','sequelize','transaction','mode','files','directory','join','server/files/moh','create','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','createdAt','root'];(function(_0x2abab4,_0x3671f9){var _0x21ab3d=function(_0x3d761d){while(--_0x3d761d){_0x2abab4['push'](_0x2abab4['shift']());}};_0x21ab3d(++_0x3671f9);}(_0x5450,0x7a));var _0x0545=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x5450[_0xb0f7c3];return _0x28ea68;};'use strict';var pdf=require(_0x0545('0x0'));var emlformat=require(_0x0545('0x1'));var rimraf=require(_0x0545('0x2'));var zipdir=require(_0x0545('0x3'));var jsonpatch=require(_0x0545('0x4'));var rp=require(_0x0545('0x5'));var moment=require(_0x0545('0x6'));var BPromise=require(_0x0545('0x7'));var Mustache=require(_0x0545('0x8'));var util=require(_0x0545('0x9'));var path=require(_0x0545('0xa'));var sox=require(_0x0545('0xb'));var csv=require(_0x0545('0xc'));var ejs=require(_0x0545('0xd'));var fs=require('fs');var _=require(_0x0545('0xe'));var squel=require(_0x0545('0xf'));var crypto=require(_0x0545('0x10'));var jsforce=require(_0x0545('0x11'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0545('0x12'));var Papa=require(_0x0545('0x13'));var Redis=require(_0x0545('0x14'));var authService=require(_0x0545('0x15'));var qs=require(_0x0545('0x16'));var as=require(_0x0545('0x17'));var hardwareService=require(_0x0545('0x18'));var logger=require(_0x0545('0x19'))(_0x0545('0x1a'));var utils=require(_0x0545('0x1b'));var config=require(_0x0545('0x1c'));var db=require(_0x0545('0x1d'))['db'];function respondWithStatusCode(_0x69a880,_0x4a1a64){_0x4a1a64=_0x4a1a64||0xcc;return function(_0x41fcdf){if(_0x41fcdf){return _0x69a880[_0x0545('0x1e')](_0x4a1a64);}return _0x69a880['status'](_0x4a1a64)['end']();};}function respondWithResult(_0x2c5588,_0x3de407){_0x3de407=_0x3de407||0xc8;return function(_0xecefca){if(_0xecefca){return _0x2c5588[_0x0545('0x1f')](_0x3de407)['json'](_0xecefca);}};}function respondWithFilteredResult(_0x5556d8,_0x15f431){return function(_0x335f72){if(_0x335f72){var _0xe99e3a=_0x335f72[_0x0545('0x20')],_0x1ca6b9=_0x15f431[_0x0545('0x21')],_0x4ae133=_0x15f431[_0x0545('0x21')]+_0x15f431[_0x0545('0x22')],_0x33ba6d;if(_0x4ae133>=_0xe99e3a){_0x4ae133=_0xe99e3a;_0x33ba6d=0xc8;}else{_0x33ba6d=0xce;}_0x5556d8[_0x0545('0x1f')](_0x33ba6d);return _0x5556d8[_0x0545('0x23')]('Content-Range',_0x1ca6b9+'-'+_0x4ae133+'/'+_0xe99e3a)['json'](_0x335f72);}return null;};}function patchUpdates(_0x3edb70){return function(_0x32f28b){try{jsonpatch[_0x0545('0x24')](_0x32f28b,_0x3edb70,!![]);}catch(_0x45c7f1){return BPromise[_0x0545('0x25')](_0x45c7f1);}return _0x32f28b[_0x0545('0x26')]();};}function saveUpdates(_0x2a3524,_0x17e706){return function(_0x378d27){if(_0x378d27){return _0x378d27[_0x0545('0x27')](_0x2a3524)[_0x0545('0x28')](function(_0x439366){return _0x439366;});}return null;};}function removeEntity(_0x26e29f,_0x210d88){return function(_0x413e30){if(_0x413e30){return _0x413e30['destroy']()['then'](function(){var _0x4c1ec7=_0x413e30[_0x0545('0x29')]({'plain':!![]});var _0x217f64=_0x0545('0x2a');return db['UserProfileResource'][_0x0545('0x2b')]({'where':{'type':_0x217f64,'resourceId':_0x4c1ec7['id']}})[_0x0545('0x28')](function(){return _0x413e30;});})[_0x0545('0x28')](function(){_0x26e29f[_0x0545('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39f77e,_0x59aaaf){return function(_0x454b0b){if(!_0x454b0b){_0x39f77e[_0x0545('0x1e')](0x194);}return _0x454b0b;};}function handleError(_0x4d3d11,_0x36ad04){_0x36ad04=_0x36ad04||0x1f4;return function(_0x34d107){logger['error'](_0x34d107[_0x0545('0x2c')]);if(_0x34d107['name']){delete _0x34d107[_0x0545('0x2d')];}_0x4d3d11[_0x0545('0x1f')](_0x36ad04)[_0x0545('0x2e')](_0x34d107);};}exports['index']=function(_0x30baa6,_0x2a060d){var _0x8925f={},_0x43b561={},_0x425962={'count':0x0,'rows':[]};var _0x34e58f=_[_0x0545('0x2f')](db[_0x0545('0x30')][_0x0545('0x31')],function(_0x4aa48a){return{'name':_0x4aa48a['fieldName'],'type':_0x4aa48a[_0x0545('0x32')][_0x0545('0x33')]};});_0x43b561[_0x0545('0x34')]=_[_0x0545('0x2f')](_0x34e58f,_0x0545('0x2d'));_0x43b561['query']=_[_0x0545('0x35')](_0x30baa6[_0x0545('0x36')]);_0x43b561[_0x0545('0x37')]=_['intersection'](_0x43b561[_0x0545('0x34')],_0x43b561['query']);_0x8925f[_0x0545('0x38')]=_['intersection'](_0x43b561[_0x0545('0x34')],qs[_0x0545('0x39')](_0x30baa6[_0x0545('0x36')]['fields']));_0x8925f[_0x0545('0x38')]=_0x8925f['attributes'][_0x0545('0x3a')]?_0x8925f['attributes']:_0x43b561['model'];if(!_0x30baa6['query'][_0x0545('0x3b')](_0x0545('0x3c'))){_0x8925f[_0x0545('0x22')]=qs['limit'](_0x30baa6[_0x0545('0x36')]['limit']);_0x8925f[_0x0545('0x21')]=qs[_0x0545('0x21')](_0x30baa6['query'][_0x0545('0x21')]);}_0x8925f[_0x0545('0x3d')]=qs[_0x0545('0x3e')](_0x30baa6[_0x0545('0x36')][_0x0545('0x3e')]);_0x8925f['where']=qs['filters'](_[_0x0545('0x3f')](_0x30baa6[_0x0545('0x36')],_0x43b561[_0x0545('0x37')]));if(_0x30baa6[_0x0545('0x36')][_0x0545('0x40')]){_0x8925f[_0x0545('0x41')]=_[_0x0545('0x42')](_0x8925f[_0x0545('0x41')],{'$or':_[_0x0545('0x2f')](_0x34e58f,function(_0x9d3d03){if(_0x9d3d03[_0x0545('0x32')]!==_0x0545('0x43')){var _0x1ef847={};_0x1ef847[_0x9d3d03[_0x0545('0x2d')]]={'$like':'%'+_0x30baa6['query']['filter']+'%'};return _0x1ef847;}})});}_0x8925f=_[_0x0545('0x42')]({},_0x8925f,_0x30baa6[_0x0545('0x44')]);var _0x5e90ef={'where':_0x8925f[_0x0545('0x41')]};return db['VoiceMusicOnHold'][_0x0545('0x20')](_0x5e90ef)[_0x0545('0x28')](function(_0x3c564f){_0x425962[_0x0545('0x20')]=_0x3c564f;if(_0x30baa6['query']['includeAll']){_0x8925f[_0x0545('0x45')]=[{'all':!![]}];}return db[_0x0545('0x30')][_0x0545('0x46')](_0x8925f);})[_0x0545('0x28')](function(_0xcbe346){_0x425962[_0x0545('0x47')]=_0xcbe346;return _0x425962;})['then'](respondWithFilteredResult(_0x2a060d,_0x8925f))['catch'](handleError(_0x2a060d,null));};exports[_0x0545('0x48')]=function(_0x4abaa0,_0x2cbf4d){var _0x42d839={'raw':![],'where':{'id':_0x4abaa0[_0x0545('0x49')]['id']}},_0x1da6f1={};_0x1da6f1['model']=_[_0x0545('0x35')](db[_0x0545('0x30')]['rawAttributes']);_0x1da6f1[_0x0545('0x36')]=_[_0x0545('0x35')](_0x4abaa0['query']);_0x1da6f1[_0x0545('0x37')]=_[_0x0545('0x4a')](_0x1da6f1[_0x0545('0x34')],_0x1da6f1[_0x0545('0x36')]);_0x42d839['attributes']=_[_0x0545('0x4a')](_0x1da6f1[_0x0545('0x34')],qs[_0x0545('0x39')](_0x4abaa0[_0x0545('0x36')][_0x0545('0x39')]));_0x42d839['attributes']=_0x42d839[_0x0545('0x38')][_0x0545('0x3a')]?_0x42d839[_0x0545('0x38')]:_0x1da6f1[_0x0545('0x34')];if(_0x4abaa0[_0x0545('0x36')][_0x0545('0x4b')]){_0x42d839[_0x0545('0x45')]=[{'all':!![]}];}_0x42d839=_[_0x0545('0x42')]({},_0x42d839,_0x4abaa0['options']);return db[_0x0545('0x30')][_0x0545('0x4c')](_0x42d839)[_0x0545('0x28')](handleEntityNotFound(_0x2cbf4d,null))['then'](respondWithResult(_0x2cbf4d,null))[_0x0545('0x4d')](handleError(_0x2cbf4d,null));};exports[_0x0545('0x27')]=function(_0x4ae152,_0x2ccb4c){if(_0x4ae152[_0x0545('0x4e')]['id']){delete _0x4ae152[_0x0545('0x4e')]['id'];}return db[_0x0545('0x30')][_0x0545('0x4c')]({'where':{'id':_0x4ae152[_0x0545('0x49')]['id']}})[_0x0545('0x28')](handleEntityNotFound(_0x2ccb4c,null))[_0x0545('0x28')](saveUpdates(_0x4ae152[_0x0545('0x4e')],null))[_0x0545('0x28')](respondWithResult(_0x2ccb4c,null))[_0x0545('0x4d')](handleError(_0x2ccb4c,null));};exports['create']=function(_0x274e8b,_0x118965,_0x2b3b98){return db[_0x0545('0x4f')][_0x0545('0x50')](function(_0x1e6208){if(_0x274e8b[_0x0545('0x4e')][_0x0545('0x51')]===_0x0545('0x52')){_0x274e8b[_0x0545('0x4e')][_0x0545('0x53')]=path[_0x0545('0x54')](config['root'],_0x0545('0x55'),_0x274e8b[_0x0545('0x4e')]['name']);}return db[_0x0545('0x30')][_0x0545('0x56')](_0x274e8b[_0x0545('0x4e')],{'transaction':_0x1e6208})[_0x0545('0x28')](function(_0x2b013c){if(_0x274e8b['body'][_0x0545('0x51')]===_0x0545('0x52')){fs[_0x0545('0x57')](_0x2b013c[_0x0545('0x53')],parseInt('0777',0x8));}var _0x45a2f2=_0x274e8b[_0x0545('0x58')][_0x0545('0x29')]({'plain':!![]});if(!_0x45a2f2)throw new Error(_0x0545('0x59'));if(_0x45a2f2['role']==='user'){var _0x368b65=_0x2b013c['get']({'plain':!![]});return db[_0x0545('0x5a')]['find']({'where':{'name':_0x0545('0x2a'),'userProfileId':_0x45a2f2[_0x0545('0x5b')]},'raw':!![]})[_0x0545('0x28')](function(_0x298ccc){if(_0x298ccc&&_0x298ccc[_0x0545('0x5c')]===0x0){return db['UserProfileResource'][_0x0545('0x56')]({'name':_0x368b65[_0x0545('0x2d')],'resourceId':_0x368b65['id'],'type':_0x298ccc[_0x0545('0x2d')],'sectionId':_0x298ccc['id']},{})[_0x0545('0x28')](function(){return _0x2b013c;});}else{return _0x2b013c;}})[_0x0545('0x4d')](function(_0x4f7f49){logger['error'](_0x0545('0x5d'),_0x4f7f49);});}return _0x2b013c;});})[_0x0545('0x28')](respondWithResult(_0x118965,0xc9))[_0x0545('0x4d')](handleError(_0x118965,null));};exports[_0x0545('0x2b')]=function(_0x244084,_0x11e499,_0x2400fe){var _0x536d95;return db[_0x0545('0x30')][_0x0545('0x4c')]({'where':{'id':_0x244084[_0x0545('0x49')]['id']}})[_0x0545('0x28')](function(_0x5a6a34){if(_0x5a6a34){return db[_0x0545('0x4f')][_0x0545('0x50')](function(_0x150c1c){return _0x5a6a34['destroy']({'transaction':_0x150c1c,'raw':!![]})[_0x0545('0x28')](function(_0x1b6c7){if(_0x1b6c7[_0x0545('0x53')]){fs[_0x0545('0x5e')](_0x1b6c7[_0x0545('0x53')])['forEach'](function(_0xf33d4e){fs['unlinkSync'](path[_0x0545('0x54')](_0x1b6c7[_0x0545('0x53')],_0xf33d4e));});fs[_0x0545('0x5f')](_0x1b6c7[_0x0545('0x53')]);}return _0x1b6c7;});})[_0x0545('0x4d')](function(_0x57a23d){throw new db[(_0x0545('0x60'))][(_0x0545('0x61'))](_0x57a23d[_0x0545('0x62')]);});}})[_0x0545('0x28')](handleEntityNotFound(_0x11e499,null))[_0x0545('0x28')](removeEntity(_0x11e499,null))[_0x0545('0x4d')](handleError(_0x11e499,null));};exports[_0x0545('0x63')]=function(_0x10cc87,_0x28fc27,_0x1fa188){return db['sequelize'][_0x0545('0x50')](function(_0x1ef7dd){var _0x19048f;return db[_0x0545('0x30')][_0x0545('0x4c')]({'where':{'id':_0x10cc87['params']['id']}})[_0x0545('0x28')](function(_0x5aa115){if(_0x5aa115){_0x19048f=_0x5aa115;return _0x5aa115[_0x0545('0x63')](_0x10cc87[_0x0545('0x4e')]['id'],{'transaction':_0x1ef7dd});}})[_0x0545('0x28')](function(_0x426307){if(_0x426307){return db['Sound'][_0x0545('0x64')]({'where':{'id':_0x10cc87[_0x0545('0x4e')]['id']},'attributes':['id',_0x0545('0x2d'),_0x0545('0x65'),'converted_format',_0x0545('0x66')],'raw':!![]});}})['then'](function(_0xa6bcf5){if(_0xa6bcf5){var _0x5be82d=path[_0x0545('0x54')](config[_0x0545('0x67')],_0x0545('0x68'),util[_0x0545('0x69')](_0x0545('0x6a'),path[_0x0545('0x6b')](_0xa6bcf5[_0x0545('0x65')],path['extname'](_0xa6bcf5[_0x0545('0x65')])),_0xa6bcf5[_0x0545('0x6c')]));var _0x382445=path[_0x0545('0x54')](config[_0x0545('0x67')],'server/files/moh',_0x19048f['name'],util['format']('%s.%s',_0xa6bcf5['name'],_0xa6bcf5[_0x0545('0x6c')]));fs['symlinkSync'](_0x5be82d,_0x382445);return _0xa6bcf5;}})[_0x0545('0x4d')](function(_0x37cc8f){throw new db[(_0x0545('0x60'))][(_0x0545('0x61'))](_0x37cc8f[_0x0545('0x62')]);});})[_0x0545('0x28')](handleEntityNotFound(_0x28fc27,null))['then'](respondWithResult(_0x28fc27,0xc9))[_0x0545('0x4d')](handleError(_0x28fc27,null));};exports[_0x0545('0x6d')]=function(_0x5560c0,_0x70cf1c,_0x2758c5){return db['sequelize'][_0x0545('0x50')](function(_0x359880){var _0x102466;return db[_0x0545('0x30')]['findOne']({'where':{'id':_0x5560c0[_0x0545('0x49')]['id']}})[_0x0545('0x28')](handleEntityNotFound(_0x70cf1c,null))[_0x0545('0x28')](function(_0x20a5ca){if(_0x20a5ca){_0x102466=_0x20a5ca;return _0x20a5ca[_0x0545('0x6d')](_0x5560c0[_0x0545('0x49')][_0x0545('0x6e')]);}})[_0x0545('0x28')](function(_0x4442f9){if(_0x4442f9){return db[_0x0545('0x6f')][_0x0545('0x64')]({'where':{'id':_0x5560c0[_0x0545('0x49')]['id2']},'attributes':['id',_0x0545('0x2d'),_0x0545('0x65'),_0x0545('0x6c'),_0x0545('0x66')],'raw':!![]});}})['then'](function(_0xd88505){if(_0xd88505){fs['unlinkSync'](path['join'](_0x102466[_0x0545('0x53')],util['format'](_0x0545('0x6a'),_0xd88505[_0x0545('0x2d')],_0xd88505['converted_format'])));return _0xd88505;}})[_0x0545('0x4d')](function(_0x4e6591){throw new db[(_0x0545('0x60'))][(_0x0545('0x61'))](_0x4e6591[_0x0545('0x62')]);});})['then'](handleEntityNotFound(_0x70cf1c,null))['then'](respondWithStatusCode(_0x70cf1c,0xcc))['catch'](handleError(_0x70cf1c,null));};exports[_0x0545('0x70')]=function(_0x4539cd,_0x70b4f1,_0x305cc5){var _0x12c289={};var _0x16412c={};var _0x45311d;var _0x280223;return db[_0x0545('0x30')][_0x0545('0x64')]({'where':{'id':_0x4539cd[_0x0545('0x49')]['id']}})['then'](handleEntityNotFound(_0x70b4f1,null))[_0x0545('0x28')](function(_0x5b773e){if(_0x5b773e){_0x45311d=_0x5b773e;_0x16412c[_0x0545('0x34')]=_['keys'](db['Sound'][_0x0545('0x31')]);_0x16412c[_0x0545('0x36')]=_['keys'](_0x4539cd[_0x0545('0x36')]);_0x16412c['filters']=_[_0x0545('0x4a')](_0x16412c[_0x0545('0x34')],_0x16412c[_0x0545('0x36')]);_0x12c289[_0x0545('0x38')]=_[_0x0545('0x4a')](_0x16412c['model'],qs[_0x0545('0x39')](_0x4539cd['query'][_0x0545('0x39')]));_0x12c289[_0x0545('0x38')]=_0x12c289[_0x0545('0x38')][_0x0545('0x3a')]?_0x12c289['attributes']:_0x16412c['model'];_0x12c289[_0x0545('0x3d')]=qs[_0x0545('0x3e')](_0x4539cd['query'][_0x0545('0x3e')]);_0x12c289[_0x0545('0x41')]=qs[_0x0545('0x37')](_[_0x0545('0x3f')](_0x4539cd[_0x0545('0x36')],_0x16412c[_0x0545('0x37')]));if(_0x4539cd[_0x0545('0x36')][_0x0545('0x40')]){_0x12c289[_0x0545('0x41')]=_[_0x0545('0x42')](_0x12c289[_0x0545('0x41')],{'$or':_[_0x0545('0x2f')](_0x12c289[_0x0545('0x38')],function(_0x5d94b0){var _0xfa2bfb={};_0xfa2bfb[_0x5d94b0]={'$like':'%'+_0x4539cd[_0x0545('0x36')][_0x0545('0x40')]+'%'};return _0xfa2bfb;})});}_0x12c289=_[_0x0545('0x42')]({},_0x12c289,_0x4539cd[_0x0545('0x44')]);return _0x45311d[_0x0545('0x70')](_0x12c289);}})[_0x0545('0x28')](function(_0x201710){if(_0x201710){_0x280223=_0x201710[_0x0545('0x3a')];if(!_0x4539cd[_0x0545('0x36')]['hasOwnProperty'](_0x0545('0x3c'))){_0x12c289[_0x0545('0x22')]=qs[_0x0545('0x22')](_0x4539cd[_0x0545('0x36')][_0x0545('0x22')]);_0x12c289[_0x0545('0x21')]=qs[_0x0545('0x21')](_0x4539cd['query']['offset']);}return _0x45311d[_0x0545('0x70')](_0x12c289);}})[_0x0545('0x28')](function(_0x4d6dc9){if(_0x4d6dc9){return _0x4d6dc9?{'count':_0x280223,'rows':_0x4d6dc9}:null;}})[_0x0545('0x28')](respondWithResult(_0x70b4f1,null))[_0x0545('0x4d')](handleError(_0x70b4f1,null));}; \ No newline at end of file +var _0x955a=['userProfileId','autoAssociation','forEach','unlinkSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','converted_format','removeSound','id2','getSounds','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','get','MusicOnHolds','UserProfileResource','then','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','body','catch','create','sequelize','transaction','mode','files','directory','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0xd627c,_0x6e6129){var _0x54378f=function(_0x49cb14){while(--_0x49cb14){_0xd627c['push'](_0xd627c['shift']());}};_0x54378f(++_0x6e6129);}(_0x955a,0x16a));var _0xa955=function(_0x4d87bc,_0x39932f){_0x4d87bc=_0x4d87bc-0x0;var _0x564a90=_0x955a[_0x4d87bc];return _0x564a90;};'use strict';var pdf=require(_0xa955('0x0'));var emlformat=require(_0xa955('0x1'));var rimraf=require(_0xa955('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa955('0x3'));var moment=require(_0xa955('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa955('0x5'));var util=require(_0xa955('0x6'));var path=require(_0xa955('0x7'));var sox=require(_0xa955('0x8'));var csv=require('to-csv');var ejs=require(_0xa955('0x9'));var fs=require('fs');var _=require(_0xa955('0xa'));var squel=require(_0xa955('0xb'));var crypto=require('crypto');var jsforce=require(_0xa955('0xc'));var deskjs=require(_0xa955('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa955('0xe'));var Papa=require(_0xa955('0xf'));var Redis=require('ioredis');var authService=require(_0xa955('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa955('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa955('0x12'))(_0xa955('0x13'));var utils=require(_0xa955('0x14'));var config=require(_0xa955('0x15'));var db=require(_0xa955('0x16'))['db'];function respondWithStatusCode(_0xdfa8a2,_0xd6ba9a){_0xd6ba9a=_0xd6ba9a||0xcc;return function(_0x516c66){if(_0x516c66){return _0xdfa8a2[_0xa955('0x17')](_0xd6ba9a);}return _0xdfa8a2[_0xa955('0x18')](_0xd6ba9a)[_0xa955('0x19')]();};}function respondWithResult(_0x3e41e3,_0x34f749){_0x34f749=_0x34f749||0xc8;return function(_0x1b7800){if(_0x1b7800){return _0x3e41e3[_0xa955('0x18')](_0x34f749)[_0xa955('0x1a')](_0x1b7800);}};}function respondWithFilteredResult(_0x3994e5,_0x524771){return function(_0x2ce44e){if(_0x2ce44e){var _0x3f6c44=_0x2ce44e[_0xa955('0x1b')],_0xcaa0ee=_0x524771[_0xa955('0x1c')],_0x3e4db4=_0x524771[_0xa955('0x1c')]+_0x524771[_0xa955('0x1d')],_0x49276d;if(_0x3e4db4>=_0x3f6c44){_0x3e4db4=_0x3f6c44;_0x49276d=0xc8;}else{_0x49276d=0xce;}_0x3994e5[_0xa955('0x18')](_0x49276d);return _0x3994e5[_0xa955('0x1e')](_0xa955('0x1f'),_0xcaa0ee+'-'+_0x3e4db4+'/'+_0x3f6c44)[_0xa955('0x1a')](_0x2ce44e);}return null;};}function patchUpdates(_0xdd3080){return function(_0xc2b479){try{jsonpatch[_0xa955('0x20')](_0xc2b479,_0xdd3080,!![]);}catch(_0x3aa20f){return BPromise['reject'](_0x3aa20f);}return _0xc2b479[_0xa955('0x21')]();};}function saveUpdates(_0x196122,_0x556c59){return function(_0x27df9e){if(_0x27df9e){return _0x27df9e[_0xa955('0x22')](_0x196122)['then'](function(_0x334854){return _0x334854;});}return null;};}function removeEntity(_0x48ced8,_0x25fd3f){return function(_0x160021){if(_0x160021){return _0x160021[_0xa955('0x23')]()['then'](function(){var _0x18b8af=_0x160021[_0xa955('0x24')]({'plain':!![]});var _0x98c809=_0xa955('0x25');return db[_0xa955('0x26')][_0xa955('0x23')]({'where':{'type':_0x98c809,'resourceId':_0x18b8af['id']}})['then'](function(){return _0x160021;});})[_0xa955('0x27')](function(){_0x48ced8[_0xa955('0x18')](0xcc)[_0xa955('0x19')]();});}};}function handleEntityNotFound(_0x536fa7,_0x5dabba){return function(_0x2e1e44){if(!_0x2e1e44){_0x536fa7[_0xa955('0x17')](0x194);}return _0x2e1e44;};}function handleError(_0x59eec0,_0x5613eb){_0x5613eb=_0x5613eb||0x1f4;return function(_0x184df7){logger[_0xa955('0x28')](_0x184df7[_0xa955('0x29')]);if(_0x184df7['name']){delete _0x184df7[_0xa955('0x2a')];}_0x59eec0['status'](_0x5613eb)[_0xa955('0x2b')](_0x184df7);};}exports[_0xa955('0x2c')]=function(_0x14885b,_0x568fe7){var _0x395372={},_0x4e5e9e={},_0x22f6aa={'count':0x0,'rows':[]};var _0x495b7d=_[_0xa955('0x2d')](db[_0xa955('0x2e')][_0xa955('0x2f')],function(_0x374da0){return{'name':_0x374da0[_0xa955('0x30')],'type':_0x374da0[_0xa955('0x31')][_0xa955('0x32')]};});_0x4e5e9e['model']=_[_0xa955('0x2d')](_0x495b7d,'name');_0x4e5e9e[_0xa955('0x33')]=_[_0xa955('0x34')](_0x14885b['query']);_0x4e5e9e[_0xa955('0x35')]=_[_0xa955('0x36')](_0x4e5e9e[_0xa955('0x37')],_0x4e5e9e[_0xa955('0x33')]);_0x395372[_0xa955('0x38')]=_[_0xa955('0x36')](_0x4e5e9e[_0xa955('0x37')],qs[_0xa955('0x39')](_0x14885b[_0xa955('0x33')][_0xa955('0x39')]));_0x395372[_0xa955('0x38')]=_0x395372[_0xa955('0x38')][_0xa955('0x3a')]?_0x395372[_0xa955('0x38')]:_0x4e5e9e[_0xa955('0x37')];if(!_0x14885b[_0xa955('0x33')]['hasOwnProperty'](_0xa955('0x3b'))){_0x395372[_0xa955('0x1d')]=qs[_0xa955('0x1d')](_0x14885b[_0xa955('0x33')][_0xa955('0x1d')]);_0x395372['offset']=qs[_0xa955('0x1c')](_0x14885b[_0xa955('0x33')]['offset']);}_0x395372['order']=qs[_0xa955('0x3c')](_0x14885b['query'][_0xa955('0x3c')]);_0x395372[_0xa955('0x3d')]=qs[_0xa955('0x35')](_[_0xa955('0x3e')](_0x14885b['query'],_0x4e5e9e[_0xa955('0x35')]));if(_0x14885b[_0xa955('0x33')][_0xa955('0x3f')]){_0x395372['where']=_['merge'](_0x395372['where'],{'$or':_['map'](_0x495b7d,function(_0x5e3dcb){if(_0x5e3dcb['type']!==_0xa955('0x40')){var _0x1be2ea={};_0x1be2ea[_0x5e3dcb['name']]={'$like':'%'+_0x14885b['query']['filter']+'%'};return _0x1be2ea;}})});}_0x395372=_['merge']({},_0x395372,_0x14885b[_0xa955('0x41')]);var _0x31f1f4={'where':_0x395372[_0xa955('0x3d')]};return db[_0xa955('0x2e')][_0xa955('0x1b')](_0x31f1f4)[_0xa955('0x27')](function(_0x1adcc7){_0x22f6aa['count']=_0x1adcc7;if(_0x14885b[_0xa955('0x33')][_0xa955('0x42')]){_0x395372[_0xa955('0x43')]=[{'all':!![]}];}return db[_0xa955('0x2e')][_0xa955('0x44')](_0x395372);})[_0xa955('0x27')](function(_0x346c8c){_0x22f6aa[_0xa955('0x45')]=_0x346c8c;return _0x22f6aa;})['then'](respondWithFilteredResult(_0x568fe7,_0x395372))['catch'](handleError(_0x568fe7,null));};exports[_0xa955('0x46')]=function(_0x211678,_0x4a5693){var _0xf8bc69={'raw':![],'where':{'id':_0x211678[_0xa955('0x47')]['id']}},_0x16c221={};_0x16c221[_0xa955('0x37')]=_[_0xa955('0x34')](db[_0xa955('0x2e')][_0xa955('0x2f')]);_0x16c221[_0xa955('0x33')]=_[_0xa955('0x34')](_0x211678['query']);_0x16c221[_0xa955('0x35')]=_[_0xa955('0x36')](_0x16c221[_0xa955('0x37')],_0x16c221[_0xa955('0x33')]);_0xf8bc69[_0xa955('0x38')]=_[_0xa955('0x36')](_0x16c221[_0xa955('0x37')],qs['fields'](_0x211678[_0xa955('0x33')]['fields']));_0xf8bc69[_0xa955('0x38')]=_0xf8bc69[_0xa955('0x38')]['length']?_0xf8bc69[_0xa955('0x38')]:_0x16c221['model'];if(_0x211678[_0xa955('0x33')][_0xa955('0x42')]){_0xf8bc69[_0xa955('0x43')]=[{'all':!![]}];}_0xf8bc69=_[_0xa955('0x48')]({},_0xf8bc69,_0x211678[_0xa955('0x41')]);return db[_0xa955('0x2e')][_0xa955('0x49')](_0xf8bc69)[_0xa955('0x27')](handleEntityNotFound(_0x4a5693,null))[_0xa955('0x27')](respondWithResult(_0x4a5693,null))['catch'](handleError(_0x4a5693,null));};exports[_0xa955('0x22')]=function(_0x57f854,_0x4d599b){if(_0x57f854[_0xa955('0x4a')]['id']){delete _0x57f854['body']['id'];}return db[_0xa955('0x2e')][_0xa955('0x49')]({'where':{'id':_0x57f854['params']['id']}})[_0xa955('0x27')](handleEntityNotFound(_0x4d599b,null))[_0xa955('0x27')](saveUpdates(_0x57f854[_0xa955('0x4a')],null))[_0xa955('0x27')](respondWithResult(_0x4d599b,null))[_0xa955('0x4b')](handleError(_0x4d599b,null));};exports[_0xa955('0x4c')]=function(_0x2f5be8,_0x17d118,_0x5bd994){return db[_0xa955('0x4d')][_0xa955('0x4e')](function(_0x58509d){if(_0x2f5be8[_0xa955('0x4a')][_0xa955('0x4f')]===_0xa955('0x50')){_0x2f5be8['body'][_0xa955('0x51')]=path['join'](config['root'],'server/files/moh',_0x2f5be8[_0xa955('0x4a')][_0xa955('0x2a')]);}return db['VoiceMusicOnHold']['create'](_0x2f5be8[_0xa955('0x4a')],{'transaction':_0x58509d})['then'](function(_0x28c065){if(_0x2f5be8[_0xa955('0x4a')]['mode']===_0xa955('0x50')){fs[_0xa955('0x52')](_0x28c065['directory'],parseInt(_0xa955('0x53'),0x8));}var _0x1f1dbc=_0x2f5be8[_0xa955('0x54')][_0xa955('0x24')]({'plain':!![]});if(!_0x1f1dbc)throw new Error(_0xa955('0x55'));if(_0x1f1dbc['role']==='user'){var _0x30d590=_0x28c065[_0xa955('0x24')]({'plain':!![]});return db['UserProfileSection'][_0xa955('0x49')]({'where':{'name':_0xa955('0x25'),'userProfileId':_0x1f1dbc[_0xa955('0x56')]},'raw':!![]})['then'](function(_0x54382f){if(_0x54382f&&_0x54382f[_0xa955('0x57')]===0x0){return db[_0xa955('0x26')][_0xa955('0x4c')]({'name':_0x30d590[_0xa955('0x2a')],'resourceId':_0x30d590['id'],'type':_0x54382f['name'],'sectionId':_0x54382f['id']},{})[_0xa955('0x27')](function(){return _0x28c065;});}else{return _0x28c065;}})[_0xa955('0x4b')](function(_0x2922c6){logger[_0xa955('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2922c6);});}return _0x28c065;});})[_0xa955('0x27')](respondWithResult(_0x17d118,0xc9))[_0xa955('0x4b')](handleError(_0x17d118,null));};exports[_0xa955('0x23')]=function(_0x5c3290,_0x7eb7df,_0x21394b){var _0x19af00;return db[_0xa955('0x2e')][_0xa955('0x49')]({'where':{'id':_0x5c3290[_0xa955('0x47')]['id']}})[_0xa955('0x27')](function(_0x41e6ef){if(_0x41e6ef){return db['sequelize']['transaction'](function(_0x5ea4da){return _0x41e6ef[_0xa955('0x23')]({'transaction':_0x5ea4da,'raw':!![]})['then'](function(_0x200a75){if(_0x200a75[_0xa955('0x51')]){fs['readdirSync'](_0x200a75[_0xa955('0x51')])[_0xa955('0x58')](function(_0x580185){fs[_0xa955('0x59')](path[_0xa955('0x5a')](_0x200a75[_0xa955('0x51')],_0x580185));});fs[_0xa955('0x5b')](_0x200a75[_0xa955('0x51')]);}return _0x200a75;});})[_0xa955('0x4b')](function(_0x339e9c){throw new db[(_0xa955('0x5c'))][(_0xa955('0x5d'))](_0x339e9c[_0xa955('0x5e')]);});}})[_0xa955('0x27')](handleEntityNotFound(_0x7eb7df,null))['then'](removeEntity(_0x7eb7df,null))['catch'](handleError(_0x7eb7df,null));};exports[_0xa955('0x5f')]=function(_0x4bf543,_0x52a57a,_0x3f84e2){return db['sequelize'][_0xa955('0x4e')](function(_0x5cee04){var _0x2e32f8;return db[_0xa955('0x2e')][_0xa955('0x49')]({'where':{'id':_0x4bf543[_0xa955('0x47')]['id']}})[_0xa955('0x27')](function(_0x2052c0){if(_0x2052c0){_0x2e32f8=_0x2052c0;return _0x2052c0['addSound'](_0x4bf543[_0xa955('0x4a')]['id'],{'transaction':_0x5cee04});}})[_0xa955('0x27')](function(_0x530609){if(_0x530609){return db[_0xa955('0x60')][_0xa955('0x61')]({'where':{'id':_0x4bf543[_0xa955('0x4a')]['id']},'attributes':['id',_0xa955('0x2a'),_0xa955('0x62'),'converted_format',_0xa955('0x63')],'raw':!![]});}})['then'](function(_0x19f5b7){if(_0x19f5b7){var _0x3916e0=path['join'](config[_0xa955('0x64')],_0xa955('0x65'),util[_0xa955('0x66')](_0xa955('0x67'),path[_0xa955('0x68')](_0x19f5b7[_0xa955('0x62')],path[_0xa955('0x69')](_0x19f5b7[_0xa955('0x62')])),_0x19f5b7['converted_format']));var _0xa0e04d=path['join'](config[_0xa955('0x64')],_0xa955('0x6a'),_0x2e32f8[_0xa955('0x2a')],util['format'](_0xa955('0x67'),_0x19f5b7[_0xa955('0x2a')],_0x19f5b7[_0xa955('0x6b')]));fs['symlinkSync'](_0x3916e0,_0xa0e04d);return _0x19f5b7;}})[_0xa955('0x4b')](function(_0x1dffa7){throw new db[(_0xa955('0x5c'))][(_0xa955('0x5d'))](_0x1dffa7[_0xa955('0x5e')]);});})['then'](handleEntityNotFound(_0x52a57a,null))[_0xa955('0x27')](respondWithResult(_0x52a57a,0xc9))[_0xa955('0x4b')](handleError(_0x52a57a,null));};exports['removeSound']=function(_0xdd3a72,_0x39f534,_0x5c3492){return db[_0xa955('0x4d')][_0xa955('0x4e')](function(_0x44d032){var _0x30728f;return db[_0xa955('0x2e')][_0xa955('0x61')]({'where':{'id':_0xdd3a72['params']['id']}})[_0xa955('0x27')](handleEntityNotFound(_0x39f534,null))[_0xa955('0x27')](function(_0x2f19c3){if(_0x2f19c3){_0x30728f=_0x2f19c3;return _0x2f19c3[_0xa955('0x6c')](_0xdd3a72[_0xa955('0x47')][_0xa955('0x6d')]);}})[_0xa955('0x27')](function(_0x1adf5c){if(_0x1adf5c){return db['Sound']['findOne']({'where':{'id':_0xdd3a72[_0xa955('0x47')]['id2']},'attributes':['id',_0xa955('0x2a'),'save_name',_0xa955('0x6b'),'createdAt'],'raw':!![]});}})[_0xa955('0x27')](function(_0x5ae34f){if(_0x5ae34f){fs[_0xa955('0x59')](path[_0xa955('0x5a')](_0x30728f[_0xa955('0x51')],util[_0xa955('0x66')]('%s.%s',_0x5ae34f[_0xa955('0x2a')],_0x5ae34f[_0xa955('0x6b')])));return _0x5ae34f;}})[_0xa955('0x4b')](function(_0x412a7a){throw new db['Sequelize'][(_0xa955('0x5d'))](_0x412a7a['message']);});})[_0xa955('0x27')](handleEntityNotFound(_0x39f534,null))[_0xa955('0x27')](respondWithStatusCode(_0x39f534,0xcc))['catch'](handleError(_0x39f534,null));};exports[_0xa955('0x6e')]=function(_0x1cb4ce,_0x1408d3,_0xa31e1f){var _0x25e3eb={};var _0xfe396c={};var _0x440dc1;var _0x3a53ce;return db[_0xa955('0x2e')][_0xa955('0x61')]({'where':{'id':_0x1cb4ce[_0xa955('0x47')]['id']}})['then'](handleEntityNotFound(_0x1408d3,null))['then'](function(_0x7a16ef){if(_0x7a16ef){_0x440dc1=_0x7a16ef;_0xfe396c[_0xa955('0x37')]=_[_0xa955('0x34')](db[_0xa955('0x60')][_0xa955('0x2f')]);_0xfe396c['query']=_['keys'](_0x1cb4ce['query']);_0xfe396c[_0xa955('0x35')]=_[_0xa955('0x36')](_0xfe396c['model'],_0xfe396c[_0xa955('0x33')]);_0x25e3eb[_0xa955('0x38')]=_['intersection'](_0xfe396c['model'],qs[_0xa955('0x39')](_0x1cb4ce[_0xa955('0x33')][_0xa955('0x39')]));_0x25e3eb[_0xa955('0x38')]=_0x25e3eb[_0xa955('0x38')][_0xa955('0x3a')]?_0x25e3eb[_0xa955('0x38')]:_0xfe396c['model'];_0x25e3eb['order']=qs[_0xa955('0x3c')](_0x1cb4ce[_0xa955('0x33')][_0xa955('0x3c')]);_0x25e3eb[_0xa955('0x3d')]=qs[_0xa955('0x35')](_['pick'](_0x1cb4ce['query'],_0xfe396c[_0xa955('0x35')]));if(_0x1cb4ce[_0xa955('0x33')]['filter']){_0x25e3eb['where']=_[_0xa955('0x48')](_0x25e3eb[_0xa955('0x3d')],{'$or':_[_0xa955('0x2d')](_0x25e3eb[_0xa955('0x38')],function(_0x45a318){var _0x46d7e5={};_0x46d7e5[_0x45a318]={'$like':'%'+_0x1cb4ce[_0xa955('0x33')][_0xa955('0x3f')]+'%'};return _0x46d7e5;})});}_0x25e3eb=_['merge']({},_0x25e3eb,_0x1cb4ce['options']);return _0x440dc1['getSounds'](_0x25e3eb);}})[_0xa955('0x27')](function(_0x783050){if(_0x783050){_0x3a53ce=_0x783050[_0xa955('0x3a')];if(!_0x1cb4ce[_0xa955('0x33')][_0xa955('0x6f')](_0xa955('0x3b'))){_0x25e3eb[_0xa955('0x1d')]=qs[_0xa955('0x1d')](_0x1cb4ce[_0xa955('0x33')]['limit']);_0x25e3eb[_0xa955('0x1c')]=qs[_0xa955('0x1c')](_0x1cb4ce[_0xa955('0x33')]['offset']);}return _0x440dc1[_0xa955('0x6e')](_0x25e3eb);}})[_0xa955('0x27')](function(_0x3f8e87){if(_0x3f8e87){return _0x3f8e87?{'count':_0x3a53ce,'rows':_0x3f8e87}:null;}})[_0xa955('0x27')](respondWithResult(_0x1408d3,null))[_0xa955('0x4b')](handleError(_0x1408d3,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 22fd1a4..ad8ae94 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 _0xa5c1=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','voice_musiconhold','lodash','util'];(function(_0x3b4a5f,_0x5a63e0){var _0x586cfb=function(_0x367fdb){while(--_0x367fdb){_0x3b4a5f['push'](_0x3b4a5f['shift']());}};_0x586cfb(++_0x5a63e0);}(_0xa5c1,0x174));var _0x1a5c=function(_0x7e1db7,_0x1da70f){_0x7e1db7=_0x7e1db7-0x0;var _0xc82fa0=_0xa5c1[_0x7e1db7];return _0xc82fa0;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var logger=require('../../config/logger')(_0x1a5c('0x2'));var moment=require(_0x1a5c('0x3'));var BPromise=require('bluebird');var rp=require(_0x1a5c('0x4'));var fs=require('fs');var path=require(_0x1a5c('0x5'));var rimraf=require(_0x1a5c('0x6'));var config=require(_0x1a5c('0x7'));var attributes=require(_0x1a5c('0x8'));module[_0x1a5c('0x9')]=function(_0x550388,_0x41f95c){return _0x550388['define']('VoiceMusicOnHold',attributes,{'tableName':_0x1a5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e60=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0xf6df82,_0xcbfd66){var _0x1dd75d=function(_0x182995){while(--_0x182995){_0xf6df82['push'](_0xf6df82['shift']());}};_0x1dd75d(++_0xcbfd66);}(_0x1e60,0x172));var _0x01e6=function(_0x5cfa35,_0x5eb7f0){_0x5cfa35=_0x5cfa35-0x0;var _0xf7dffb=_0x1e60[_0x5cfa35];return _0xf7dffb;};'use strict';var _=require(_0x01e6('0x0'));var util=require(_0x01e6('0x1'));var logger=require(_0x01e6('0x2'))(_0x01e6('0x3'));var moment=require(_0x01e6('0x4'));var BPromise=require(_0x01e6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x01e6('0x6'));var rimraf=require('rimraf');var config=require(_0x01e6('0x7'));var attributes=require(_0x01e6('0x8'));module[_0x01e6('0x9')]=function(_0x1f5363,_0xa5a375){return _0x1f5363[_0x01e6('0xa')](_0x01e6('0xb'),attributes,{'tableName':_0x01e6('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 a1d2df1..27cd763 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 _0xe9b7=['catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x1ecb37,_0x334181){var _0x1062a1=function(_0xefe217){while(--_0xefe217){_0x1ecb37['push'](_0x1ecb37['shift']());}};_0x1062a1(++_0x334181);}(_0xe9b7,0x157));var _0x7e9b=function(_0x136533,_0x41cef9){_0x136533=_0x136533-0x0;var _0x2cc80c=_0xe9b7[_0x136533];return _0x2cc80c;};'use strict';var _=require('lodash');var util=require(_0x7e9b('0x0'));var moment=require(_0x7e9b('0x1'));var BPromise=require(_0x7e9b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e9b('0x3'))['db'];var utils=require(_0x7e9b('0x4'));var logger=require(_0x7e9b('0x5'))(_0x7e9b('0x6'));var config=require(_0x7e9b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x291b60,_0x17cbc9,_0x44647e){return new BPromise(function(_0x223c70,_0x580c9d){return client[_0x7e9b('0x8')](_0x291b60,_0x44647e)[_0x7e9b('0x9')](function(_0x1fb162){logger[_0x7e9b('0xa')](_0x7e9b('0xb'),_0x17cbc9,_0x7e9b('0xc'));logger[_0x7e9b('0xd')](_0x7e9b('0xe'),_0x17cbc9,'request\x20sent',JSON['stringify'](_0x1fb162));if(_0x1fb162[_0x7e9b('0xf')]){if(_0x1fb162[_0x7e9b('0xf')]['code']===0x1f4){logger[_0x7e9b('0xf')](_0x7e9b('0xb'),_0x17cbc9,_0x1fb162['error']['message']);return _0x580c9d(_0x1fb162[_0x7e9b('0xf')][_0x7e9b('0x10')]);}logger[_0x7e9b('0xf')](_0x7e9b('0xb'),_0x17cbc9,_0x1fb162[_0x7e9b('0xf')][_0x7e9b('0x10')]);return _0x223c70(_0x1fb162[_0x7e9b('0xf')][_0x7e9b('0x10')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x17cbc9,_0x7e9b('0xc'));_0x223c70(_0x1fb162[_0x7e9b('0x11')]['message']);}})[_0x7e9b('0x12')](function(_0x36ca2e){logger[_0x7e9b('0xf')](_0x7e9b('0xb'),_0x17cbc9,_0x36ca2e);_0x580c9d(_0x36ca2e);});});} \ No newline at end of file +var _0x44ff=['request','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x43c8e3,_0x4ca925){var _0x4dba22=function(_0x5a0d45){while(--_0x5a0d45){_0x43c8e3['push'](_0x43c8e3['shift']());}};_0x4dba22(++_0x4ca925);}(_0x44ff,0x1d6));var _0xf44f=function(_0x23014e,_0x27cb16){_0x23014e=_0x23014e-0x0;var _0x41fe28=_0x44ff[_0x23014e];return _0x41fe28;};'use strict';var _=require(_0xf44f('0x0'));var util=require(_0xf44f('0x1'));var moment=require(_0xf44f('0x2'));var BPromise=require(_0xf44f('0x3'));var rs=require(_0xf44f('0x4'));var fs=require('fs');var Redis=require(_0xf44f('0x5'));var db=require(_0xf44f('0x6'))['db'];var utils=require(_0xf44f('0x7'));var logger=require(_0xf44f('0x8'))('rpc');var config=require(_0xf44f('0x9'));var jayson=require(_0xf44f('0xa'));var client=jayson[_0xf44f('0xb')][_0xf44f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ae97e,_0x10329d,_0x19bdd1){return new BPromise(function(_0x599f27,_0x19c21f){return client[_0xf44f('0xd')](_0x4ae97e,_0x19bdd1)[_0xf44f('0xe')](function(_0x3c1a82){logger['info'](_0xf44f('0xf'),_0x10329d,_0xf44f('0x10'));logger[_0xf44f('0x11')](_0xf44f('0x12'),_0x10329d,_0xf44f('0x10'),JSON[_0xf44f('0x13')](_0x3c1a82));if(_0x3c1a82[_0xf44f('0x14')]){if(_0x3c1a82[_0xf44f('0x14')][_0xf44f('0x15')]===0x1f4){logger[_0xf44f('0x14')](_0xf44f('0xf'),_0x10329d,_0x3c1a82[_0xf44f('0x14')][_0xf44f('0x16')]);return _0x19c21f(_0x3c1a82[_0xf44f('0x14')][_0xf44f('0x16')]);}logger[_0xf44f('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x10329d,_0x3c1a82['error'][_0xf44f('0x16')]);return _0x599f27(_0x3c1a82[_0xf44f('0x14')][_0xf44f('0x16')]);}else{logger['info'](_0xf44f('0xf'),_0x10329d,'request\x20sent');_0x599f27(_0x3c1a82['result'][_0xf44f('0x16')]);}})['catch'](function(_0x57033a){logger[_0xf44f('0x14')](_0xf44f('0xf'),_0x10329d,_0x57033a);_0x19c21f(_0x57033a);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 7465c9d..aa7a27c 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 _0x1b13=['update','delete','exports','util','path','connect-timeout','Router','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','show','/:id/users','getAgents','post','create','addAgents','put'];(function(_0x33b685,_0x43e6f4){var _0x1d11ee=function(_0x1b26d2){while(--_0x1b26d2){_0x33b685['push'](_0x33b685['shift']());}};_0x1d11ee(++_0x43e6f4);}(_0x1b13,0x1a7));var _0x31b1=function(_0x164c2b,_0x180db3){_0x164c2b=_0x164c2b-0x0;var _0x3b11f4=_0x1b13[_0x164c2b];return _0x3b11f4;};'use strict';var multer=require('multer');var util=require(_0x31b1('0x0'));var path=require(_0x31b1('0x1'));var timeout=require(_0x31b1('0x2'));var express=require('express');var router=express[_0x31b1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x31b1('0x4'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x31b1('0x5')]('/',auth[_0x31b1('0x6')](),controller['index']);router['get'](_0x31b1('0x7'),auth[_0x31b1('0x6')](),controller[_0x31b1('0x8')]);router[_0x31b1('0x5')](_0x31b1('0x9'),auth['isAuthenticated'](),controller[_0x31b1('0xa')]);router[_0x31b1('0x5')](_0x31b1('0xb'),auth[_0x31b1('0x6')](),controller[_0x31b1('0xc')]);router[_0x31b1('0xd')]('/',auth[_0x31b1('0x6')](),controller[_0x31b1('0xe')]);router[_0x31b1('0xd')]('/:id/users',auth[_0x31b1('0x6')](),controller[_0x31b1('0xf')]);router[_0x31b1('0x10')](_0x31b1('0x9'),auth[_0x31b1('0x6')](),controller[_0x31b1('0x11')]);router[_0x31b1('0x12')](_0x31b1('0x9'),auth[_0x31b1('0x6')](),controller['destroy']);router[_0x31b1('0x12')](_0x31b1('0xb'),auth[_0x31b1('0x6')](),controller['removeAgents']);module[_0x31b1('0x13')]=router; \ No newline at end of file +var _0xce58=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','post','create','put','update','delete','destroy','removeAgents','util','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller'];(function(_0x4d01f6,_0x20b3a4){var _0x41ffe3=function(_0x2737be){while(--_0x2737be){_0x4d01f6['push'](_0x4d01f6['shift']());}};_0x41ffe3(++_0x20b3a4);}(_0xce58,0x1b4));var _0x8ce5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce58[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x8ce5('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8ce5('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x8ce5('0x2'));var config=require(_0x8ce5('0x3'));var controller=require(_0x8ce5('0x4'));router[_0x8ce5('0x5')]('/',auth[_0x8ce5('0x6')](),controller[_0x8ce5('0x7')]);router[_0x8ce5('0x5')](_0x8ce5('0x8'),auth[_0x8ce5('0x6')](),controller[_0x8ce5('0x9')]);router[_0x8ce5('0x5')](_0x8ce5('0xa'),auth[_0x8ce5('0x6')](),controller[_0x8ce5('0xb')]);router[_0x8ce5('0x5')](_0x8ce5('0xc'),auth[_0x8ce5('0x6')](),controller[_0x8ce5('0xd')]);router[_0x8ce5('0xe')]('/',auth[_0x8ce5('0x6')](),controller[_0x8ce5('0xf')]);router['post'](_0x8ce5('0xc'),auth[_0x8ce5('0x6')](),controller['addAgents']);router[_0x8ce5('0x10')](_0x8ce5('0xa'),auth['isAuthenticated'](),controller[_0x8ce5('0x11')]);router[_0x8ce5('0x12')](_0x8ce5('0xa'),auth[_0x8ce5('0x6')](),controller[_0x8ce5('0x13')]);router[_0x8ce5('0x12')](_0x8ce5('0xc'),auth['isAuthenticated'](),controller[_0x8ce5('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 150c809..a6365eb 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 _0x2cc0=['sequelize','exports','STRING','name','VIRTUAL'];(function(_0x3bb83a,_0x575118){var _0x53f8a2=function(_0x2edfd2){while(--_0x2edfd2){_0x3bb83a['push'](_0x3bb83a['shift']());}};_0x53f8a2(++_0x575118);}(_0x2cc0,0xc3));var _0x02cc=function(_0x4170a3,_0x55e28e){_0x4170a3=_0x4170a3-0x0;var _0x575a80=_0x2cc0[_0x4170a3];return _0x575a80;};'use strict';var Sequelize=require(_0x02cc('0x0'));module[_0x02cc('0x1')]={'name':{'type':Sequelize[_0x02cc('0x2')],'allowNull':![],'unique':_0x02cc('0x3')},'prefix':{'type':Sequelize[_0x02cc('0x4')],'get':function(_0x228f32){return'system-'+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0x02cc('0x2')]},'callerIdAll':{'type':Sequelize[_0x02cc('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xbc7c=['exports','name','VIRTUAL','system-','getDataValue','STRING','INTEGER'];(function(_0x1b58a3,_0x3229b0){var _0x200366=function(_0x454099){while(--_0x454099){_0x1b58a3['push'](_0x1b58a3['shift']());}};_0x200366(++_0x3229b0);}(_0xbc7c,0x1a4));var _0xcbc7=function(_0x413032,_0x4f1a47){_0x413032=_0x413032-0x0;var _0x548b60=_0xbc7c[_0x413032];return _0x548b60;};'use strict';var Sequelize=require('sequelize');module[_0xcbc7('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcbc7('0x1')},'prefix':{'type':Sequelize[_0xcbc7('0x2')],'get':function(_0x2f2c9e){return _0xcbc7('0x3')+this[_0xcbc7('0x4')](_0xcbc7('0x1'))+'-';}},'description':{'type':Sequelize[_0xcbc7('0x5')]},'callerIdAll':{'type':Sequelize[_0xcbc7('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0xcbc7('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 29044f3..8eb78fc 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 _0x5b83=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','system','description','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','NoOp','No\x20callerid\x20available','goto','${EXTEN:','length','charAt','system-','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','filter','nolimit','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','get','VoicePrefixes','destroy','error','stack','name','send','index','map','VoicePrefix','type','key','model','query','intersection','fields','attributes','hasOwnProperty','sort','where','filters','pick','merge','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','describe','create','sequelize','transaction','body','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x5b83,0x12c));var _0x35b8=function(_0x4135b3,_0x238796){_0x4135b3=_0x4135b3-0x0;var _0x412b9b=_0x5b83[_0x4135b3];return _0x412b9b;};'use strict';var pdf=require(_0x35b8('0x0'));var emlformat=require(_0x35b8('0x1'));var rimraf=require(_0x35b8('0x2'));var zipdir=require(_0x35b8('0x3'));var jsonpatch=require(_0x35b8('0x4'));var rp=require(_0x35b8('0x5'));var moment=require(_0x35b8('0x6'));var BPromise=require(_0x35b8('0x7'));var Mustache=require(_0x35b8('0x8'));var util=require(_0x35b8('0x9'));var path=require(_0x35b8('0xa'));var sox=require('sox');var csv=require(_0x35b8('0xb'));var ejs=require(_0x35b8('0xc'));var fs=require('fs');var _=require(_0x35b8('0xd'));var squel=require('squel');var crypto=require(_0x35b8('0xe'));var jsforce=require(_0x35b8('0xf'));var deskjs=require(_0x35b8('0x10'));var toCsv=require(_0x35b8('0xb'));var querystring=require(_0x35b8('0x11'));var Papa=require(_0x35b8('0x12'));var Redis=require(_0x35b8('0x13'));var authService=require(_0x35b8('0x14'));var qs=require(_0x35b8('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x35b8('0x16'));var logger=require(_0x35b8('0x17'))(_0x35b8('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x35b8('0x19'))['db'];config['redis']=_[_0x35b8('0x1a')](config[_0x35b8('0x1b')],{'host':_0x35b8('0x1c'),'port':0x18eb});var socket=require(_0x35b8('0x1d'))(new Redis(config[_0x35b8('0x1b')]));require('./voicePrefix.socket')[_0x35b8('0x1e')](socket);function respondWithStatusCode(_0x59f367,_0x144c76){_0x144c76=_0x144c76||0xcc;return function(_0x1e2190){if(_0x1e2190){return _0x59f367[_0x35b8('0x1f')](_0x144c76);}return _0x59f367[_0x35b8('0x20')](_0x144c76)[_0x35b8('0x21')]();};}function respondWithResult(_0x482b24,_0x34653c){_0x34653c=_0x34653c||0xc8;return function(_0x4b13e3){if(_0x4b13e3){return _0x482b24[_0x35b8('0x20')](_0x34653c)['json'](_0x4b13e3);}};}function respondWithFilteredResult(_0x353bea,_0x43dbcb){return function(_0x1afecb){if(_0x1afecb){var _0x37dd99=_0x1afecb[_0x35b8('0x22')],_0x463fa9=_0x43dbcb[_0x35b8('0x23')],_0x5b7f10=_0x43dbcb[_0x35b8('0x23')]+_0x43dbcb[_0x35b8('0x24')],_0x338c1e;if(_0x5b7f10>=_0x37dd99){_0x5b7f10=_0x37dd99;_0x338c1e=0xc8;}else{_0x338c1e=0xce;}_0x353bea[_0x35b8('0x20')](_0x338c1e);return _0x353bea[_0x35b8('0x25')]('Content-Range',_0x463fa9+'-'+_0x5b7f10+'/'+_0x37dd99)[_0x35b8('0x26')](_0x1afecb);}return null;};}function patchUpdates(_0x2757a3){return function(_0xc873cb){try{jsonpatch[_0x35b8('0x27')](_0xc873cb,_0x2757a3,!![]);}catch(_0x2393e8){return BPromise[_0x35b8('0x28')](_0x2393e8);}return _0xc873cb[_0x35b8('0x29')]();};}function saveUpdates(_0x239007,_0x4784a1){return function(_0x449acb){if(_0x449acb){return _0x449acb[_0x35b8('0x2a')](_0x239007)[_0x35b8('0x2b')](function(_0x266df0){return _0x266df0;});}return null;};}function removeEntity(_0x2fba7c,_0x1bddbf){return function(_0x9a29a8){if(_0x9a29a8){return _0x9a29a8['destroy']()[_0x35b8('0x2b')](function(){var _0x57063b=_0x9a29a8[_0x35b8('0x2c')]({'plain':!![]});var _0x4c20c0=_0x35b8('0x2d');return db['UserProfileResource'][_0x35b8('0x2e')]({'where':{'type':_0x4c20c0,'resourceId':_0x57063b['id']}})[_0x35b8('0x2b')](function(){return _0x9a29a8;});})['then'](function(){_0x2fba7c[_0x35b8('0x20')](0xcc)[_0x35b8('0x21')]();});}};}function handleEntityNotFound(_0x154a32,_0x7e022f){return function(_0x3322b3){if(!_0x3322b3){_0x154a32[_0x35b8('0x1f')](0x194);}return _0x3322b3;};}function handleError(_0xf8db0,_0x37e0bd){_0x37e0bd=_0x37e0bd||0x1f4;return function(_0x21011b){logger[_0x35b8('0x2f')](_0x21011b[_0x35b8('0x30')]);if(_0x21011b[_0x35b8('0x31')]){delete _0x21011b[_0x35b8('0x31')];}_0xf8db0[_0x35b8('0x20')](_0x37e0bd)[_0x35b8('0x32')](_0x21011b);};}exports[_0x35b8('0x33')]=function(_0x44fd0a,_0x59db98){var _0x1a3767={},_0xc5c811={},_0x415226={'count':0x0,'rows':[]};var _0x1da053=_[_0x35b8('0x34')](db[_0x35b8('0x35')]['rawAttributes'],function(_0x4cc5f4){return{'name':_0x4cc5f4['fieldName'],'type':_0x4cc5f4[_0x35b8('0x36')][_0x35b8('0x37')]};});_0xc5c811[_0x35b8('0x38')]=_[_0x35b8('0x34')](_0x1da053,_0x35b8('0x31'));_0xc5c811[_0x35b8('0x39')]=_['keys'](_0x44fd0a[_0x35b8('0x39')]);_0xc5c811['filters']=_[_0x35b8('0x3a')](_0xc5c811[_0x35b8('0x38')],_0xc5c811[_0x35b8('0x39')]);_0x1a3767['attributes']=_['intersection'](_0xc5c811['model'],qs[_0x35b8('0x3b')](_0x44fd0a[_0x35b8('0x39')][_0x35b8('0x3b')]));_0x1a3767[_0x35b8('0x3c')]=_0x1a3767[_0x35b8('0x3c')]['length']?_0x1a3767[_0x35b8('0x3c')]:_0xc5c811[_0x35b8('0x38')];if(!_0x44fd0a['query'][_0x35b8('0x3d')]('nolimit')){_0x1a3767[_0x35b8('0x24')]=qs['limit'](_0x44fd0a[_0x35b8('0x39')][_0x35b8('0x24')]);_0x1a3767[_0x35b8('0x23')]=qs[_0x35b8('0x23')](_0x44fd0a[_0x35b8('0x39')][_0x35b8('0x23')]);}_0x1a3767['order']=qs[_0x35b8('0x3e')](_0x44fd0a[_0x35b8('0x39')][_0x35b8('0x3e')]);_0x1a3767[_0x35b8('0x3f')]=qs[_0x35b8('0x40')](_[_0x35b8('0x41')](_0x44fd0a[_0x35b8('0x39')],_0xc5c811['filters']));if(_0x44fd0a[_0x35b8('0x39')]['filter']){_0x1a3767[_0x35b8('0x3f')]=_[_0x35b8('0x42')](_0x1a3767['where'],{'$or':_[_0x35b8('0x34')](_0x1da053,function(_0x1fd931){if(_0x1fd931[_0x35b8('0x36')]!=='VIRTUAL'){var _0x4ab006={};_0x4ab006[_0x1fd931[_0x35b8('0x31')]]={'$like':'%'+_0x44fd0a['query']['filter']+'%'};return _0x4ab006;}})});}_0x1a3767=_[_0x35b8('0x42')]({},_0x1a3767,_0x44fd0a[_0x35b8('0x43')]);var _0x4baa77={'where':_0x1a3767[_0x35b8('0x3f')]};return db[_0x35b8('0x35')][_0x35b8('0x22')](_0x4baa77)[_0x35b8('0x2b')](function(_0x5cffe2){_0x415226[_0x35b8('0x22')]=_0x5cffe2;if(_0x44fd0a[_0x35b8('0x39')][_0x35b8('0x44')]){_0x1a3767[_0x35b8('0x45')]=[{'all':!![]}];}return db['VoicePrefix'][_0x35b8('0x46')](_0x1a3767);})['then'](function(_0xa1f01e){_0x415226['rows']=_0xa1f01e;return _0x415226;})[_0x35b8('0x2b')](respondWithFilteredResult(_0x59db98,_0x1a3767))[_0x35b8('0x47')](handleError(_0x59db98,null));};exports[_0x35b8('0x48')]=function(_0x4a5e31,_0x3a206a){var _0x22673d={'raw':![],'where':{'id':_0x4a5e31[_0x35b8('0x49')]['id']}},_0x3d9a15={};_0x3d9a15['model']=_[_0x35b8('0x4a')](db[_0x35b8('0x35')][_0x35b8('0x4b')]);_0x3d9a15[_0x35b8('0x39')]=_[_0x35b8('0x4a')](_0x4a5e31[_0x35b8('0x39')]);_0x3d9a15[_0x35b8('0x40')]=_[_0x35b8('0x3a')](_0x3d9a15[_0x35b8('0x38')],_0x3d9a15[_0x35b8('0x39')]);_0x22673d[_0x35b8('0x3c')]=_[_0x35b8('0x3a')](_0x3d9a15[_0x35b8('0x38')],qs['fields'](_0x4a5e31[_0x35b8('0x39')][_0x35b8('0x3b')]));_0x22673d[_0x35b8('0x3c')]=_0x22673d[_0x35b8('0x3c')]['length']?_0x22673d[_0x35b8('0x3c')]:_0x3d9a15[_0x35b8('0x38')];if(_0x4a5e31[_0x35b8('0x39')][_0x35b8('0x44')]){_0x22673d[_0x35b8('0x45')]=[{'all':!![]}];}_0x22673d=_[_0x35b8('0x42')]({},_0x22673d,_0x4a5e31[_0x35b8('0x43')]);return db[_0x35b8('0x35')][_0x35b8('0x4c')](_0x22673d)[_0x35b8('0x2b')](handleEntityNotFound(_0x3a206a,null))[_0x35b8('0x2b')](respondWithResult(_0x3a206a,null))['catch'](handleError(_0x3a206a,null));};exports[_0x35b8('0x2e')]=function(_0x5da898,_0x1208db){return db['VoicePrefix'][_0x35b8('0x4c')]({'where':{'id':_0x5da898[_0x35b8('0x49')]['id']}})[_0x35b8('0x2b')](handleEntityNotFound(_0x1208db,null))['then'](removeEntity(_0x1208db,null))['catch'](handleError(_0x1208db,null));};exports[_0x35b8('0x4d')]=function(_0x15a84b,_0x264c53){return db[_0x35b8('0x35')]['describe']()[_0x35b8('0x2b')](respondWithResult(_0x264c53,null))[_0x35b8('0x47')](handleError(_0x264c53,null));};exports[_0x35b8('0x4e')]=function(_0x52c217,_0x1a044){var _0x183994;return db[_0x35b8('0x4f')][_0x35b8('0x50')](function(_0x4ffb6d){return db[_0x35b8('0x35')][_0x35b8('0x4e')](_0x52c217[_0x35b8('0x51')],{'transaction':_0x4ffb6d})['then'](function(_0x59debd){_0x183994=_0x59debd[_0x35b8('0x2c')]({'plain':!![]});return db[_0x35b8('0x52')]['find']({'where':{'id':_0x183994[_0x35b8('0x53')]},'raw':!![]})[_0x35b8('0x2b')](function(_0x3a5af0){return createVoicePrefixExtensions(_0x183994,_0x3a5af0,_0x4ffb6d);});});})[_0x35b8('0x2b')](function(){var _0xc13ab=_0x52c217[_0x35b8('0x54')]['get']({'plain':!![]});if(!_0xc13ab)throw new Error(_0x35b8('0x55'));if(_0xc13ab[_0x35b8('0x56')]===_0x35b8('0x54')){var _0x1c6d60=_0x183994;return db['UserProfileSection']['find']({'where':{'name':_0x35b8('0x2d'),'userProfileId':_0xc13ab[_0x35b8('0x57')]},'raw':!![]})[_0x35b8('0x2b')](function(_0x28ace6){if(_0x28ace6&&_0x28ace6[_0x35b8('0x58')]===0x0){return db[_0x35b8('0x59')][_0x35b8('0x4e')]({'name':_0x1c6d60['name'],'resourceId':_0x1c6d60['id'],'type':_0x28ace6['name'],'sectionId':_0x28ace6['id']},{})['then'](function(){return _0x183994;});}else{return _0x183994;}})[_0x35b8('0x47')](function(_0x49cc23){logger[_0x35b8('0x2f')](_0x35b8('0x5a'),_0x49cc23);throw _0x49cc23;});}return _0x183994;})[_0x35b8('0x2b')](respondWithResult(_0x1a044,null))['catch'](handleError(_0x1a044,null));};function Extension(_0x3b7eec,_0x1361a3,_0x21b87f,_0x3c96e8){this[_0x35b8('0x5b')]=_0x35b8('0x5c');this[_0x35b8('0x5d')]=_0x3b7eec;this['app']=_0x21b87f;this[_0x35b8('0x36')]=_0x35b8('0x5e');this[_0x35b8('0x5f')]='Voice\x20Prefix\x20Extension';this[_0x35b8('0x60')]=_0x1361a3;this[_0x35b8('0x61')]=_0x3c96e8;}function createVoicePrefixExtensions(_0x21989d,_0x559c46,_0x517ffe){return new BPromise(function(_0x4289fc,_0x46510f){var _0x2b89ac=new Extension(formatPrefixName(_0x21989d[_0x35b8('0x62')]),0x1,'NoOp',_0x35b8('0x63'));_0x2b89ac[_0x35b8('0x64')]=_0x21989d['id'];return db[_0x35b8('0x52')][_0x35b8('0x4e')](_0x2b89ac,{'transaction':_0x517ffe})[_0x35b8('0x2b')](function(_0xc07338){var _0x8d9c=_0xc07338[_0x35b8('0x2c')]({'plain':!![]});var _0x28ae15=_[_0x35b8('0x34')](addVoicePrefixExtensions(_0x21989d,_0x559c46),function(_0x5e9986){_0x5e9986[_0x35b8('0x53')]=_0x8d9c['id'];_0x5e9986[_0x35b8('0x64')]=_0x21989d['id'];return _0x5e9986;});return db[_0x35b8('0x52')][_0x35b8('0x65')](_0x28ae15,{'transaction':_0x517ffe})['then'](function(_0x1bbecb){if(!_0x1bbecb){return _0x46510f(_0x35b8('0x66'));}else{return _0x4289fc(_0x1bbecb);}})[_0x35b8('0x47')](function(_0x124e0e){return _0x46510f(_0x124e0e);});});;});};function addVoicePrefixExtensions(_0x5275c6,_0x385811){var _0x3322e8=[];var _0x399510=formatPrefixName(_0x5275c6['prefix']);_0x3322e8['push'](new Extension(_0x399510,0x2,_0x35b8('0x67'),_0x35b8('0x68')+_0x5275c6['name']));if(_0x5275c6[_0x35b8('0x69')]){_0x3322e8[_0x35b8('0x6a')](new Extension(_0x399510,0x3,_0x35b8('0x67'),_0x35b8('0x6b')+_0x5275c6[_0x35b8('0x69')]));}else{_0x3322e8[_0x35b8('0x6a')](new Extension(_0x399510,0x3,_0x35b8('0x6c'),_0x35b8('0x6d')));}_0x3322e8['push'](new Extension(_0x399510,0x4,_0x35b8('0x6e'),_0x385811['context']+','+_0x35b8('0x6f')+(0x8+_0x5275c6[_0x35b8('0x31')][_0x35b8('0x70')])+'}'+','+0x1));return _0x3322e8;}function formatPrefixName(_0x1eb47c){var _0x7cbfa3='_';for(var _0x59b1a1=0x0;_0x59b1a1<_0x1eb47c[_0x35b8('0x70')];_0x59b1a1++){if(_0x1eb47c['charAt'](_0x59b1a1)=='-'){_0x7cbfa3+=_0x1eb47c[_0x35b8('0x71')](_0x59b1a1);}else{_0x7cbfa3+='['+_0x1eb47c['charAt'](_0x59b1a1)+']';}}_0x7cbfa3+='.';return _0x7cbfa3;}exports[_0x35b8('0x2a')]=function(_0x82b45f,_0x4289ea,_0x169eb6){var _0x21ab96=_0x82b45f['body'];_0x21ab96[_0x35b8('0x62')]=_0x35b8('0x72')+_0x21ab96[_0x35b8('0x31')]+'-';return db[_0x35b8('0x4f')]['transaction'](function(_0x59f886){return db[_0x35b8('0x35')][_0x35b8('0x2a')](_0x21ab96,{'where':{'id':_0x21ab96['id']},'transaction':_0x59f886})[_0x35b8('0x2b')](function(){return db[_0x35b8('0x52')]['destroy']({'where':{'VoicePrefixId':_0x21ab96['id']},'transaction':_0x59f886})[_0x35b8('0x2b')](function(){return db[_0x35b8('0x52')][_0x35b8('0x4c')]({'where':{'id':_0x21ab96['VoiceExtensionId']},'raw':!![]})[_0x35b8('0x2b')](function(_0x24c7a8){return createVoicePrefixExtensions(_0x21ab96,_0x24c7a8,_0x59f886);});});});})[_0x35b8('0x2b')](function(){return db['VoicePrefix']['findById'](_0x21ab96['id']);})[_0x35b8('0x2b')](respondWithResult(_0x4289ea,null))[_0x35b8('0x47')](handleError(_0x4289ea,null));};exports['addAgents']=function(_0xab66c7,_0x6b56be,_0x3cd116){return db['VoicePrefix'][_0x35b8('0x4c')]({'where':{'id':_0xab66c7[_0x35b8('0x49')]['id']}})[_0x35b8('0x2b')](handleEntityNotFound(_0x6b56be,null))[_0x35b8('0x2b')](function(_0x2a6ff0){if(_0x2a6ff0){return _0x2a6ff0[_0x35b8('0x73')](_0xab66c7['body']['ids'],_[_0x35b8('0x74')](_0xab66c7[_0x35b8('0x51')],[_0x35b8('0x75'),'id'])||{})[_0x35b8('0x76')](function(_0x35cfcf){for(var _0x3facdf=0x0;_0x3facdf<_0xab66c7[_0x35b8('0x51')][_0x35b8('0x75')][_0x35b8('0x70')];_0x3facdf+=0x1){socket[_0x35b8('0x77')](_0x35b8('0x78'),{'UserId':_0xab66c7[_0x35b8('0x51')]['ids'][_0x3facdf],'VoicePrefixId':_0xab66c7['params']['id']});}return _0x35cfcf;});}})[_0x35b8('0x2b')](respondWithResult(_0x6b56be,null))['catch'](handleError(_0x6b56be,null));};exports[_0x35b8('0x79')]=function(_0x47c2ad,_0x1d0b33,_0x22e3cb){return db[_0x35b8('0x35')][_0x35b8('0x4c')]({'where':{'id':_0x47c2ad[_0x35b8('0x49')]['id']}})[_0x35b8('0x2b')](handleEntityNotFound(_0x1d0b33,null))['then'](function(_0x505418){if(_0x505418){return _0x505418[_0x35b8('0x79')](_0x47c2ad[_0x35b8('0x39')]['ids'])[_0x35b8('0x2b')](function(){if(_[_0x35b8('0x7a')](_0x47c2ad[_0x35b8('0x39')][_0x35b8('0x75')])){for(var _0xa1281d=0x0;_0xa1281d<_0x47c2ad[_0x35b8('0x39')][_0x35b8('0x75')][_0x35b8('0x70')];_0xa1281d+=0x1){socket[_0x35b8('0x77')](_0x35b8('0x7b'),{'UserId':Number(_0x47c2ad[_0x35b8('0x39')]['ids'][_0xa1281d]),'VoicePrefixId':Number(_0x47c2ad[_0x35b8('0x49')]['id'])});}}else{socket[_0x35b8('0x77')]('userVoicePrefix:remove',{'UserId':Number(_0x47c2ad[_0x35b8('0x39')]['ids']),'VoicePrefixId':Number(_0x47c2ad[_0x35b8('0x49')]['id'])});}});}})[_0x35b8('0x2b')](respondWithStatusCode(_0x1d0b33,null))[_0x35b8('0x47')](handleError(_0x1d0b33,null));};exports[_0x35b8('0x7c')]=function(_0x5d4463,_0x5909b3,_0x270722){var _0x9ae31c={};var _0x5b8e0b={};var _0x204b6b;var _0x2b76e1;return db[_0x35b8('0x35')][_0x35b8('0x7d')]({'where':{'id':_0x5d4463[_0x35b8('0x49')]['id']}})[_0x35b8('0x2b')](handleEntityNotFound(_0x5909b3,null))['then'](function(_0x178786){if(_0x178786){_0x204b6b=_0x178786;_0x5b8e0b['model']=_['keys'](db[_0x35b8('0x7e')][_0x35b8('0x4b')]);_0x5b8e0b[_0x35b8('0x39')]=_['keys'](_0x5d4463[_0x35b8('0x39')]);_0x5b8e0b[_0x35b8('0x40')]=_['intersection'](_0x5b8e0b['model'],_0x5b8e0b['query']);_0x9ae31c[_0x35b8('0x3c')]=_['intersection'](_0x5b8e0b[_0x35b8('0x38')],qs[_0x35b8('0x3b')](_0x5d4463[_0x35b8('0x39')][_0x35b8('0x3b')]));_0x9ae31c[_0x35b8('0x3c')]=_0x9ae31c[_0x35b8('0x3c')][_0x35b8('0x70')]?_0x9ae31c[_0x35b8('0x3c')]:_0x5b8e0b[_0x35b8('0x38')];_0x9ae31c[_0x35b8('0x7f')]=qs['sort'](_0x5d4463[_0x35b8('0x39')][_0x35b8('0x3e')]);_0x9ae31c['where']=qs['filters'](_[_0x35b8('0x41')](_0x5d4463[_0x35b8('0x39')],_0x5b8e0b[_0x35b8('0x40')]));if(_0x5d4463['query'][_0x35b8('0x80')]){_0x9ae31c['where']=_[_0x35b8('0x42')](_0x9ae31c[_0x35b8('0x3f')],{'$or':_[_0x35b8('0x34')](_0x9ae31c['attributes'],function(_0x16638e){var _0xcf65f8={};_0xcf65f8[_0x16638e]={'$like':'%'+_0x5d4463['query']['filter']+'%'};return _0xcf65f8;})});}_0x9ae31c=_[_0x35b8('0x42')]({},_0x9ae31c,_0x5d4463[_0x35b8('0x43')]);return _0x204b6b[_0x35b8('0x7c')](_0x9ae31c);}})[_0x35b8('0x2b')](function(_0x401a43){if(_0x401a43){_0x2b76e1=_0x401a43['length'];if(!_0x5d4463[_0x35b8('0x39')]['hasOwnProperty'](_0x35b8('0x81'))){_0x9ae31c['limit']=qs['limit'](_0x5d4463['query'][_0x35b8('0x24')]);_0x9ae31c[_0x35b8('0x23')]=qs[_0x35b8('0x23')](_0x5d4463[_0x35b8('0x39')][_0x35b8('0x23')]);}return _0x204b6b[_0x35b8('0x7c')](_0x9ae31c);}})[_0x35b8('0x2b')](function(_0x1f2f64){if(_0x1f2f64){return _0x1f2f64?{'count':_0x2b76e1,'rows':_0x1f2f64}:null;}})[_0x35b8('0x2b')](respondWithResult(_0x5909b3,null))[_0x35b8('0x47')](handleError(_0x5909b3,null));}; \ No newline at end of file +var _0x105c=['to-csv','ejs','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','defaults','redis','localhost','register','sendStatus','end','status','json','count','offset','Content-Range','apply','reject','save','update','then','get','VoicePrefixes','UserProfileResource','name','send','map','rawAttributes','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','filter','merge','type','VIRTUAL','options','VoicePrefix','includeAll','include','findAll','rows','catch','show','params','keys','length','find','destroy','create','sequelize','transaction','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','emit','userVoicePrefix:save','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x5e4134,_0x1a1c27){var _0x529994=function(_0x40956b){while(--_0x40956b){_0x5e4134['push'](_0x5e4134['shift']());}};_0x529994(++_0x1a1c27);}(_0x105c,0x6d));var _0xc105=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0x105c[_0x56daff];return _0x132c82;};'use strict';var pdf=require(_0xc105('0x0'));var emlformat=require(_0xc105('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc105('0x2'));var jsonpatch=require(_0xc105('0x3'));var rp=require(_0xc105('0x4'));var moment=require(_0xc105('0x5'));var BPromise=require(_0xc105('0x6'));var Mustache=require(_0xc105('0x7'));var util=require('util');var path=require(_0xc105('0x8'));var sox=require('sox');var csv=require(_0xc105('0x9'));var ejs=require(_0xc105('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc105('0xb'));var crypto=require(_0xc105('0xc'));var jsforce=require(_0xc105('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc105('0x9'));var querystring=require('querystring');var Papa=require(_0xc105('0xe'));var Redis=require('ioredis');var authService=require(_0xc105('0xf'));var qs=require(_0xc105('0x10'));var as=require(_0xc105('0x11'));var hardwareService=require(_0xc105('0x12'));var logger=require(_0xc105('0x13'))(_0xc105('0x14'));var utils=require('../../config/utils');var config=require(_0xc105('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc105('0x16')](config[_0xc105('0x17')],{'host':_0xc105('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc105('0x17')]));require('./voicePrefix.socket')[_0xc105('0x19')](socket);function respondWithStatusCode(_0x105306,_0x4da158){_0x4da158=_0x4da158||0xcc;return function(_0xf74af8){if(_0xf74af8){return _0x105306[_0xc105('0x1a')](_0x4da158);}return _0x105306['status'](_0x4da158)[_0xc105('0x1b')]();};}function respondWithResult(_0x1c6b97,_0x3ec46b){_0x3ec46b=_0x3ec46b||0xc8;return function(_0x2f81e5){if(_0x2f81e5){return _0x1c6b97[_0xc105('0x1c')](_0x3ec46b)[_0xc105('0x1d')](_0x2f81e5);}};}function respondWithFilteredResult(_0x4e7394,_0x348e2a){return function(_0x1315e2){if(_0x1315e2){var _0x679087=_0x1315e2[_0xc105('0x1e')],_0x306181=_0x348e2a['offset'],_0x377b64=_0x348e2a[_0xc105('0x1f')]+_0x348e2a['limit'],_0x2d3bc3;if(_0x377b64>=_0x679087){_0x377b64=_0x679087;_0x2d3bc3=0xc8;}else{_0x2d3bc3=0xce;}_0x4e7394['status'](_0x2d3bc3);return _0x4e7394['set'](_0xc105('0x20'),_0x306181+'-'+_0x377b64+'/'+_0x679087)[_0xc105('0x1d')](_0x1315e2);}return null;};}function patchUpdates(_0x1cb9f6){return function(_0x34d1af){try{jsonpatch[_0xc105('0x21')](_0x34d1af,_0x1cb9f6,!![]);}catch(_0x3dd3bd){return BPromise[_0xc105('0x22')](_0x3dd3bd);}return _0x34d1af[_0xc105('0x23')]();};}function saveUpdates(_0x2f8fd7,_0x12d788){return function(_0x7b3285){if(_0x7b3285){return _0x7b3285[_0xc105('0x24')](_0x2f8fd7)[_0xc105('0x25')](function(_0x25fd0d){return _0x25fd0d;});}return null;};}function removeEntity(_0x434f6a,_0x211bd5){return function(_0x24abf3){if(_0x24abf3){return _0x24abf3['destroy']()[_0xc105('0x25')](function(){var _0x209e1f=_0x24abf3[_0xc105('0x26')]({'plain':!![]});var _0x59c85e=_0xc105('0x27');return db[_0xc105('0x28')]['destroy']({'where':{'type':_0x59c85e,'resourceId':_0x209e1f['id']}})[_0xc105('0x25')](function(){return _0x24abf3;});})[_0xc105('0x25')](function(){_0x434f6a[_0xc105('0x1c')](0xcc)[_0xc105('0x1b')]();});}};}function handleEntityNotFound(_0x1704c1,_0x30a9d2){return function(_0x5cff69){if(!_0x5cff69){_0x1704c1[_0xc105('0x1a')](0x194);}return _0x5cff69;};}function handleError(_0x1987b4,_0x430af9){_0x430af9=_0x430af9||0x1f4;return function(_0x193db5){logger['error'](_0x193db5['stack']);if(_0x193db5['name']){delete _0x193db5[_0xc105('0x29')];}_0x1987b4[_0xc105('0x1c')](_0x430af9)[_0xc105('0x2a')](_0x193db5);};}exports['index']=function(_0x57beb1,_0x1649f8){var _0xa7390b={},_0x2c1185={},_0x454017={'count':0x0,'rows':[]};var _0x803ba0=_[_0xc105('0x2b')](db['VoicePrefix'][_0xc105('0x2c')],function(_0x176a02){return{'name':_0x176a02['fieldName'],'type':_0x176a02['type'][_0xc105('0x2d')]};});_0x2c1185[_0xc105('0x2e')]=_[_0xc105('0x2b')](_0x803ba0,_0xc105('0x29'));_0x2c1185[_0xc105('0x2f')]=_['keys'](_0x57beb1['query']);_0x2c1185[_0xc105('0x30')]=_[_0xc105('0x31')](_0x2c1185[_0xc105('0x2e')],_0x2c1185[_0xc105('0x2f')]);_0xa7390b['attributes']=_[_0xc105('0x31')](_0x2c1185[_0xc105('0x2e')],qs['fields'](_0x57beb1[_0xc105('0x2f')][_0xc105('0x32')]));_0xa7390b['attributes']=_0xa7390b[_0xc105('0x33')]['length']?_0xa7390b[_0xc105('0x33')]:_0x2c1185[_0xc105('0x2e')];if(!_0x57beb1[_0xc105('0x2f')][_0xc105('0x34')]('nolimit')){_0xa7390b['limit']=qs[_0xc105('0x35')](_0x57beb1[_0xc105('0x2f')][_0xc105('0x35')]);_0xa7390b[_0xc105('0x1f')]=qs['offset'](_0x57beb1[_0xc105('0x2f')][_0xc105('0x1f')]);}_0xa7390b[_0xc105('0x36')]=qs[_0xc105('0x37')](_0x57beb1[_0xc105('0x2f')][_0xc105('0x37')]);_0xa7390b[_0xc105('0x38')]=qs['filters'](_['pick'](_0x57beb1[_0xc105('0x2f')],_0x2c1185[_0xc105('0x30')]));if(_0x57beb1['query'][_0xc105('0x39')]){_0xa7390b[_0xc105('0x38')]=_[_0xc105('0x3a')](_0xa7390b[_0xc105('0x38')],{'$or':_[_0xc105('0x2b')](_0x803ba0,function(_0x471c4e){if(_0x471c4e[_0xc105('0x3b')]!==_0xc105('0x3c')){var _0x20dd41={};_0x20dd41[_0x471c4e[_0xc105('0x29')]]={'$like':'%'+_0x57beb1[_0xc105('0x2f')][_0xc105('0x39')]+'%'};return _0x20dd41;}})});}_0xa7390b=_['merge']({},_0xa7390b,_0x57beb1[_0xc105('0x3d')]);var _0x2c6ed3={'where':_0xa7390b[_0xc105('0x38')]};return db[_0xc105('0x3e')]['count'](_0x2c6ed3)['then'](function(_0x4a5bd6){_0x454017['count']=_0x4a5bd6;if(_0x57beb1[_0xc105('0x2f')][_0xc105('0x3f')]){_0xa7390b[_0xc105('0x40')]=[{'all':!![]}];}return db[_0xc105('0x3e')][_0xc105('0x41')](_0xa7390b);})[_0xc105('0x25')](function(_0x34547a){_0x454017[_0xc105('0x42')]=_0x34547a;return _0x454017;})['then'](respondWithFilteredResult(_0x1649f8,_0xa7390b))[_0xc105('0x43')](handleError(_0x1649f8,null));};exports[_0xc105('0x44')]=function(_0x1e5302,_0x256b1c){var _0x3eb099={'raw':![],'where':{'id':_0x1e5302[_0xc105('0x45')]['id']}},_0x1c08c5={};_0x1c08c5[_0xc105('0x2e')]=_[_0xc105('0x46')](db['VoicePrefix'][_0xc105('0x2c')]);_0x1c08c5['query']=_[_0xc105('0x46')](_0x1e5302['query']);_0x1c08c5[_0xc105('0x30')]=_[_0xc105('0x31')](_0x1c08c5['model'],_0x1c08c5['query']);_0x3eb099[_0xc105('0x33')]=_[_0xc105('0x31')](_0x1c08c5[_0xc105('0x2e')],qs[_0xc105('0x32')](_0x1e5302[_0xc105('0x2f')]['fields']));_0x3eb099['attributes']=_0x3eb099[_0xc105('0x33')][_0xc105('0x47')]?_0x3eb099[_0xc105('0x33')]:_0x1c08c5[_0xc105('0x2e')];if(_0x1e5302['query'][_0xc105('0x3f')]){_0x3eb099[_0xc105('0x40')]=[{'all':!![]}];}_0x3eb099=_[_0xc105('0x3a')]({},_0x3eb099,_0x1e5302[_0xc105('0x3d')]);return db['VoicePrefix'][_0xc105('0x48')](_0x3eb099)[_0xc105('0x25')](handleEntityNotFound(_0x256b1c,null))[_0xc105('0x25')](respondWithResult(_0x256b1c,null))[_0xc105('0x43')](handleError(_0x256b1c,null));};exports[_0xc105('0x49')]=function(_0x4f4706,_0x14f2da){return db['VoicePrefix'][_0xc105('0x48')]({'where':{'id':_0x4f4706[_0xc105('0x45')]['id']}})[_0xc105('0x25')](handleEntityNotFound(_0x14f2da,null))['then'](removeEntity(_0x14f2da,null))[_0xc105('0x43')](handleError(_0x14f2da,null));};exports['describe']=function(_0x36bfd6,_0x8ee6f5){return db[_0xc105('0x3e')]['describe']()[_0xc105('0x25')](respondWithResult(_0x8ee6f5,null))[_0xc105('0x43')](handleError(_0x8ee6f5,null));};exports[_0xc105('0x4a')]=function(_0x922c74,_0x2142f9){var _0x28d286;return db[_0xc105('0x4b')][_0xc105('0x4c')](function(_0x1cafe7){return db[_0xc105('0x3e')]['create'](_0x922c74[_0xc105('0x4d')],{'transaction':_0x1cafe7})[_0xc105('0x25')](function(_0x2a9a08){_0x28d286=_0x2a9a08[_0xc105('0x26')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x28d286[_0xc105('0x4e')]},'raw':!![]})[_0xc105('0x25')](function(_0x6d6f5){return createVoicePrefixExtensions(_0x28d286,_0x6d6f5,_0x1cafe7);});});})[_0xc105('0x25')](function(){var _0x5b69c7=_0x922c74['user']['get']({'plain':!![]});if(!_0x5b69c7)throw new Error(_0xc105('0x4f'));if(_0x5b69c7[_0xc105('0x50')]==='user'){var _0x35dbf9=_0x28d286;return db['UserProfileSection']['find']({'where':{'name':_0xc105('0x27'),'userProfileId':_0x5b69c7[_0xc105('0x51')]},'raw':!![]})[_0xc105('0x25')](function(_0x388d4d){if(_0x388d4d&&_0x388d4d[_0xc105('0x52')]===0x0){return db[_0xc105('0x28')][_0xc105('0x4a')]({'name':_0x35dbf9[_0xc105('0x29')],'resourceId':_0x35dbf9['id'],'type':_0x388d4d[_0xc105('0x29')],'sectionId':_0x388d4d['id']},{})[_0xc105('0x25')](function(){return _0x28d286;});}else{return _0x28d286;}})[_0xc105('0x43')](function(_0x57ae9f){logger['error'](_0xc105('0x53'),_0x57ae9f);throw _0x57ae9f;});}return _0x28d286;})['then'](respondWithResult(_0x2142f9,null))['catch'](handleError(_0x2142f9,null));};function Extension(_0x82123f,_0x5d5ef5,_0x5823a5,_0x3a7810){this[_0xc105('0x54')]=_0xc105('0x55');this[_0xc105('0x56')]=_0x82123f;this[_0xc105('0x57')]=_0x5823a5;this['type']=_0xc105('0x58');this['description']='Voice\x20Prefix\x20Extension';this['priority']=_0x5d5ef5;this[_0xc105('0x59')]=_0x3a7810;}function createVoicePrefixExtensions(_0x5a06b5,_0x56d3b7,_0x468cda){return new BPromise(function(_0x42847f,_0x38183a){var _0x2558af=new Extension(formatPrefixName(_0x5a06b5[_0xc105('0x5a')]),0x1,_0xc105('0x5b'),_0xc105('0x5c'));_0x2558af['VoicePrefixId']=_0x5a06b5['id'];return db[_0xc105('0x5d')][_0xc105('0x4a')](_0x2558af,{'transaction':_0x468cda})[_0xc105('0x25')](function(_0x24ca2f){var _0x23e819=_0x24ca2f[_0xc105('0x26')]({'plain':!![]});var _0x3447fe=_[_0xc105('0x2b')](addVoicePrefixExtensions(_0x5a06b5,_0x56d3b7),function(_0x437851){_0x437851['VoiceExtensionId']=_0x23e819['id'];_0x437851[_0xc105('0x5e')]=_0x5a06b5['id'];return _0x437851;});return db[_0xc105('0x5d')][_0xc105('0x5f')](_0x3447fe,{'transaction':_0x468cda})[_0xc105('0x25')](function(_0x94ef5c){if(!_0x94ef5c){return _0x38183a(_0xc105('0x60'));}else{return _0x42847f(_0x94ef5c);}})[_0xc105('0x43')](function(_0x403e3a){return _0x38183a(_0x403e3a);});});;});};function addVoicePrefixExtensions(_0x2df3f1,_0x103440){var _0xd09814=[];var _0x2232fb=formatPrefixName(_0x2df3f1[_0xc105('0x5a')]);_0xd09814[_0xc105('0x61')](new Extension(_0x2232fb,0x2,_0xc105('0x62'),_0xc105('0x63')+_0x2df3f1[_0xc105('0x29')]));if(_0x2df3f1[_0xc105('0x64')]){_0xd09814[_0xc105('0x61')](new Extension(_0x2232fb,0x3,_0xc105('0x62'),_0xc105('0x65')+_0x2df3f1['callerIdAll']));}else{_0xd09814[_0xc105('0x61')](new Extension(_0x2232fb,0x3,_0xc105('0x5b'),_0xc105('0x66')));}_0xd09814[_0xc105('0x61')](new Extension(_0x2232fb,0x4,_0xc105('0x67'),_0x103440['context']+','+_0xc105('0x68')+(0x8+_0x2df3f1[_0xc105('0x29')][_0xc105('0x47')])+'}'+','+0x1));return _0xd09814;}function formatPrefixName(_0xf5eb52){var _0x4cb127='_';for(var _0x4377ff=0x0;_0x4377ff<_0xf5eb52[_0xc105('0x47')];_0x4377ff++){if(_0xf5eb52[_0xc105('0x69')](_0x4377ff)=='-'){_0x4cb127+=_0xf5eb52['charAt'](_0x4377ff);}else{_0x4cb127+='['+_0xf5eb52[_0xc105('0x69')](_0x4377ff)+']';}}_0x4cb127+='.';return _0x4cb127;}exports['update']=function(_0x101b22,_0x4f6d1d,_0x4393e9){var _0x3389df=_0x101b22[_0xc105('0x4d')];_0x3389df['prefix']=_0xc105('0x6a')+_0x3389df['name']+'-';return db[_0xc105('0x4b')]['transaction'](function(_0x3d8b8f){return db['VoicePrefix'][_0xc105('0x24')](_0x3389df,{'where':{'id':_0x3389df['id']},'transaction':_0x3d8b8f})[_0xc105('0x25')](function(){return db[_0xc105('0x5d')][_0xc105('0x49')]({'where':{'VoicePrefixId':_0x3389df['id']},'transaction':_0x3d8b8f})[_0xc105('0x25')](function(){return db['VoiceExtension']['find']({'where':{'id':_0x3389df[_0xc105('0x4e')]},'raw':!![]})[_0xc105('0x25')](function(_0x32bd47){return createVoicePrefixExtensions(_0x3389df,_0x32bd47,_0x3d8b8f);});});});})[_0xc105('0x25')](function(){return db[_0xc105('0x3e')][_0xc105('0x6b')](_0x3389df['id']);})[_0xc105('0x25')](respondWithResult(_0x4f6d1d,null))['catch'](handleError(_0x4f6d1d,null));};exports[_0xc105('0x6c')]=function(_0xd96c39,_0x540531,_0x116023){return db[_0xc105('0x3e')][_0xc105('0x48')]({'where':{'id':_0xd96c39[_0xc105('0x45')]['id']}})['then'](handleEntityNotFound(_0x540531,null))['then'](function(_0x339ac0){if(_0x339ac0){return _0x339ac0[_0xc105('0x6c')](_0xd96c39[_0xc105('0x4d')][_0xc105('0x6d')],_['omit'](_0xd96c39[_0xc105('0x4d')],['ids','id'])||{})['spread'](function(_0x1d48b3){for(var _0x123028=0x0;_0x123028<_0xd96c39['body'][_0xc105('0x6d')]['length'];_0x123028+=0x1){socket[_0xc105('0x6e')](_0xc105('0x6f'),{'UserId':_0xd96c39[_0xc105('0x4d')][_0xc105('0x6d')][_0x123028],'VoicePrefixId':_0xd96c39[_0xc105('0x45')]['id']});}return _0x1d48b3;});}})[_0xc105('0x25')](respondWithResult(_0x540531,null))[_0xc105('0x43')](handleError(_0x540531,null));};exports['removeAgents']=function(_0x2039e3,_0x2d20f4,_0x3ece72){return db[_0xc105('0x3e')]['find']({'where':{'id':_0x2039e3[_0xc105('0x45')]['id']}})[_0xc105('0x25')](handleEntityNotFound(_0x2d20f4,null))[_0xc105('0x25')](function(_0x14dba1){if(_0x14dba1){return _0x14dba1['removeAgents'](_0x2039e3[_0xc105('0x2f')][_0xc105('0x6d')])[_0xc105('0x25')](function(){if(_[_0xc105('0x70')](_0x2039e3['query']['ids'])){for(var _0x169ccd=0x0;_0x169ccd<_0x2039e3[_0xc105('0x2f')][_0xc105('0x6d')][_0xc105('0x47')];_0x169ccd+=0x1){socket[_0xc105('0x6e')](_0xc105('0x71'),{'UserId':Number(_0x2039e3['query'][_0xc105('0x6d')][_0x169ccd]),'VoicePrefixId':Number(_0x2039e3[_0xc105('0x45')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x2039e3[_0xc105('0x2f')][_0xc105('0x6d')]),'VoicePrefixId':Number(_0x2039e3[_0xc105('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x2d20f4,null))[_0xc105('0x43')](handleError(_0x2d20f4,null));};exports[_0xc105('0x72')]=function(_0x5e9aad,_0x324840,_0x41cccb){var _0x7e0167={};var _0x2d717f={};var _0x19ccb6;var _0x4d3a73;return db[_0xc105('0x3e')][_0xc105('0x73')]({'where':{'id':_0x5e9aad[_0xc105('0x45')]['id']}})['then'](handleEntityNotFound(_0x324840,null))[_0xc105('0x25')](function(_0xa19a6d){if(_0xa19a6d){_0x19ccb6=_0xa19a6d;_0x2d717f[_0xc105('0x2e')]=_[_0xc105('0x46')](db[_0xc105('0x74')][_0xc105('0x2c')]);_0x2d717f[_0xc105('0x2f')]=_[_0xc105('0x46')](_0x5e9aad[_0xc105('0x2f')]);_0x2d717f['filters']=_['intersection'](_0x2d717f[_0xc105('0x2e')],_0x2d717f[_0xc105('0x2f')]);_0x7e0167[_0xc105('0x33')]=_[_0xc105('0x31')](_0x2d717f[_0xc105('0x2e')],qs[_0xc105('0x32')](_0x5e9aad[_0xc105('0x2f')][_0xc105('0x32')]));_0x7e0167[_0xc105('0x33')]=_0x7e0167[_0xc105('0x33')][_0xc105('0x47')]?_0x7e0167[_0xc105('0x33')]:_0x2d717f[_0xc105('0x2e')];_0x7e0167[_0xc105('0x36')]=qs[_0xc105('0x37')](_0x5e9aad[_0xc105('0x2f')][_0xc105('0x37')]);_0x7e0167[_0xc105('0x38')]=qs[_0xc105('0x30')](_[_0xc105('0x75')](_0x5e9aad[_0xc105('0x2f')],_0x2d717f['filters']));if(_0x5e9aad[_0xc105('0x2f')][_0xc105('0x39')]){_0x7e0167[_0xc105('0x38')]=_['merge'](_0x7e0167[_0xc105('0x38')],{'$or':_[_0xc105('0x2b')](_0x7e0167[_0xc105('0x33')],function(_0x187e48){var _0x5cbbd8={};_0x5cbbd8[_0x187e48]={'$like':'%'+_0x5e9aad[_0xc105('0x2f')][_0xc105('0x39')]+'%'};return _0x5cbbd8;})});}_0x7e0167=_[_0xc105('0x3a')]({},_0x7e0167,_0x5e9aad[_0xc105('0x3d')]);return _0x19ccb6[_0xc105('0x72')](_0x7e0167);}})['then'](function(_0x22908c){if(_0x22908c){_0x4d3a73=_0x22908c[_0xc105('0x47')];if(!_0x5e9aad[_0xc105('0x2f')][_0xc105('0x34')]('nolimit')){_0x7e0167[_0xc105('0x35')]=qs[_0xc105('0x35')](_0x5e9aad[_0xc105('0x2f')]['limit']);_0x7e0167['offset']=qs[_0xc105('0x1f')](_0x5e9aad[_0xc105('0x2f')][_0xc105('0x1f')]);}return _0x19ccb6[_0xc105('0x72')](_0x7e0167);}})[_0xc105('0x25')](function(_0x40a668){if(_0x40a668){return _0x40a668?{'count':_0x4d3a73,'rows':_0x40a668}:null;}})[_0xc105('0x25')](respondWithResult(_0x324840,null))[_0xc105('0x43')](handleError(_0x324840,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 666d49a..2e5ef2c 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 _0xedd9=['../../mysqldb','VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xedd9,0xfc));var _0x9edd=function(_0x51945b,_0x24898a){_0x51945b=_0x51945b-0x0;var _0x4e7e2e=_0xedd9[_0x51945b];return _0x4e7e2e;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9edd('0x0'))['db'][_0x9edd('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9edd('0x2')](0x0);var events={'afterCreate':_0x9edd('0x3'),'afterUpdate':_0x9edd('0x4'),'afterDestroy':_0x9edd('0x5')};function emitEvent(_0x3e6d3a){return function(_0x36b53f,_0x5943b3,_0x33679f){VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a+':'+_0x36b53f['id'],_0x36b53f);VoicePrefixEvents[_0x9edd('0x6')](_0x3e6d3a,_0x36b53f);_0x33679f(null);};}for(var e in events){if(events[_0x9edd('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x9edd('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x34e8,0x12c));var _0x834e=function(_0x1378f6,_0x194b34){_0x1378f6=_0x1378f6-0x0;var _0x2523ea=_0x34e8[_0x1378f6];return _0x2523ea;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index aba90ca..9d2934c 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 _0xb90f=['bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes','lodash','util','../../config/logger','api'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xb90f,0x71));var _0xfb90=function(_0x504ed5,_0x4b68c2){_0x504ed5=_0x504ed5-0x0;var _0xb29964=_0xb90f[_0x504ed5];return _0xb29964;};'use strict';var _=require(_0xfb90('0x0'));var util=require(_0xfb90('0x1'));var logger=require(_0xfb90('0x2'))(_0xfb90('0x3'));var moment=require('moment');var BPromise=require(_0xfb90('0x4'));var rp=require(_0xfb90('0x5'));var fs=require('fs');var path=require(_0xfb90('0x6'));var rimraf=require(_0xfb90('0x7'));var config=require(_0xfb90('0x8'));var attributes=require(_0xfb90('0x9'));module[_0xfb90('0xa')]=function(_0x3535cf,_0xd04888){return _0x3535cf[_0xfb90('0xb')]('VoicePrefix',attributes,{'tableName':_0xfb90('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69ed=['request-promise','path','../../config/environment','exports','define','VoicePrefix','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x121709,_0xf73b35){var _0x36bec9=function(_0xb4f100){while(--_0xb4f100){_0x121709['push'](_0x121709['shift']());}};_0x36bec9(++_0xf73b35);}(_0x69ed,0x192));var _0xd69e=function(_0x487824,_0x1799d9){_0x487824=_0x487824-0x0;var _0xfefae4=_0x69ed[_0x487824];return _0xfefae4;};'use strict';var _=require(_0xd69e('0x0'));var util=require(_0xd69e('0x1'));var logger=require(_0xd69e('0x2'))(_0xd69e('0x3'));var moment=require(_0xd69e('0x4'));var BPromise=require(_0xd69e('0x5'));var rp=require(_0xd69e('0x6'));var fs=require('fs');var path=require(_0xd69e('0x7'));var rimraf=require('rimraf');var config=require(_0xd69e('0x8'));var attributes=require('./voicePrefix.attributes');module[_0xd69e('0x9')]=function(_0x4be984,_0x5847ce){return _0x4be984[_0xd69e('0xa')](_0xd69e('0xb'),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 f1d4bb2..4cd0daf 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 _0xa699=['../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./voicePrefix.socket','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3a1972,_0x194511){var _0xc7e0b5=function(_0x465312){while(--_0x465312){_0x3a1972['push'](_0x3a1972['shift']());}};_0xc7e0b5(++_0x194511);}(_0xa699,0x132));var _0x9a69=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa699[_0x45e98e];return _0x374dba;};'use strict';var _=require('lodash');var util=require(_0x9a69('0x0'));var moment=require(_0x9a69('0x1'));var BPromise=require(_0x9a69('0x2'));var rs=require(_0x9a69('0x3'));var fs=require('fs');var Redis=require(_0x9a69('0x4'));var db=require(_0x9a69('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a69('0x6'))(_0x9a69('0x7'));var config=require(_0x9a69('0x8'));var jayson=require(_0x9a69('0x9'));var client=jayson[_0x9a69('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x9a69('0xb')],{'host':_0x9a69('0xc'),'port':0x18eb});var socket=require(_0x9a69('0xd'))(new Redis(config[_0x9a69('0xb')]));require(_0x9a69('0xe'))['register'](socket);function respondWithRpcPromise(_0x20d3be,_0x31a2f2,_0x3bf42b){return new BPromise(function(_0x22eb7b,_0x2e739f){return client['request'](_0x20d3be,_0x3bf42b)[_0x9a69('0xf')](function(_0x34493f){logger['info'](_0x9a69('0x10'),_0x31a2f2,_0x9a69('0x11'));logger['debug'](_0x9a69('0x12'),_0x31a2f2,_0x9a69('0x11'),JSON[_0x9a69('0x13')](_0x34493f));if(_0x34493f[_0x9a69('0x14')]){if(_0x34493f[_0x9a69('0x14')]['code']===0x1f4){logger[_0x9a69('0x14')](_0x9a69('0x10'),_0x31a2f2,_0x34493f[_0x9a69('0x14')][_0x9a69('0x15')]);return _0x2e739f(_0x34493f[_0x9a69('0x14')][_0x9a69('0x15')]);}logger[_0x9a69('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x31a2f2,_0x34493f[_0x9a69('0x14')][_0x9a69('0x15')]);return _0x22eb7b(_0x34493f[_0x9a69('0x14')][_0x9a69('0x15')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x31a2f2,_0x9a69('0x11'));_0x22eb7b(_0x34493f[_0x9a69('0x16')][_0x9a69('0x15')]);}})[_0x9a69('0x17')](function(_0x1a8ff2){logger['error'](_0x9a69('0x10'),_0x31a2f2,_0x1a8ff2);_0x2e739f(_0x1a8ff2);});});} \ No newline at end of file +var _0xb6cd=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message'];(function(_0x3363d1,_0x5e1e95){var _0x19e864=function(_0x474557){while(--_0x474557){_0x3363d1['push'](_0x3363d1['shift']());}};_0x19e864(++_0x5e1e95);}(_0xb6cd,0x144));var _0xdb6c=function(_0x1f6f10,_0xf954ea){_0x1f6f10=_0x1f6f10-0x0;var _0x138327=_0xb6cd[_0x1f6f10];return _0x138327;};'use strict';var _=require(_0xdb6c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdb6c('0x1'));var rs=require(_0xdb6c('0x2'));var fs=require('fs');var Redis=require(_0xdb6c('0x3'));var db=require(_0xdb6c('0x4'))['db'];var utils=require(_0xdb6c('0x5'));var logger=require(_0xdb6c('0x6'))(_0xdb6c('0x7'));var config=require(_0xdb6c('0x8'));var jayson=require(_0xdb6c('0x9'));var client=jayson[_0xdb6c('0xa')]['http']({'port':0x232a});config[_0xdb6c('0xb')]=_[_0xdb6c('0xc')](config[_0xdb6c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb6c('0xd'))(new Redis(config['redis']));require(_0xdb6c('0xe'))[_0xdb6c('0xf')](socket);function respondWithRpcPromise(_0x661511,_0x4d1e6a,_0x1663fa){return new BPromise(function(_0x2f505d,_0x60ca7f){return client[_0xdb6c('0x10')](_0x661511,_0x1663fa)[_0xdb6c('0x11')](function(_0xbe63b6){logger[_0xdb6c('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x4d1e6a,_0xdb6c('0x13'));logger[_0xdb6c('0x14')](_0xdb6c('0x15'),_0x4d1e6a,_0xdb6c('0x13'),JSON[_0xdb6c('0x16')](_0xbe63b6));if(_0xbe63b6[_0xdb6c('0x17')]){if(_0xbe63b6[_0xdb6c('0x17')][_0xdb6c('0x18')]===0x1f4){logger[_0xdb6c('0x17')](_0xdb6c('0x19'),_0x4d1e6a,_0xbe63b6['error'][_0xdb6c('0x1a')]);return _0x60ca7f(_0xbe63b6[_0xdb6c('0x17')][_0xdb6c('0x1a')]);}logger[_0xdb6c('0x17')]('VoicePrefix,\x20%s,\x20%s',_0x4d1e6a,_0xbe63b6['error'][_0xdb6c('0x1a')]);return _0x2f505d(_0xbe63b6[_0xdb6c('0x17')]['message']);}else{logger[_0xdb6c('0x12')](_0xdb6c('0x19'),_0x4d1e6a,'request\x20sent');_0x2f505d(_0xbe63b6['result'][_0xdb6c('0x1a')]);}})['catch'](function(_0x2e9a8b){logger['error'](_0xdb6c('0x19'),_0x4d1e6a,_0x2e9a8b);_0x60ca7f(_0x2e9a8b);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 7e7b217..6ea89f1 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 _0x45e7=['voicePrefix:','save','remove','update','emit','removeListener','register','length'];(function(_0xf833e5,_0x5efcf6){var _0x1be74f=function(_0x1be51a){while(--_0x1be51a){_0xf833e5['push'](_0xf833e5['shift']());}};_0x1be74f(++_0x5efcf6);}(_0x45e7,0x169));var _0x745e=function(_0x69188b,_0x550923){_0x69188b=_0x69188b-0x0;var _0x3320f4=_0x45e7[_0x69188b];return _0x3320f4;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x745e('0x0'),_0x745e('0x1'),_0x745e('0x2')];function createListener(_0xdd8af1,_0x53ed7d){return function(_0x1a04b8){_0x53ed7d[_0x745e('0x3')](_0xdd8af1,_0x1a04b8);};}function removeListener(_0x3db135,_0x3438bb){return function(){VoicePrefixEvents[_0x745e('0x4')](_0x3db135,_0x3438bb);};}exports[_0x745e('0x5')]=function(_0x4e03cc){for(var _0x128619=0x0,_0x5ad7f2=events[_0x745e('0x6')];_0x128619<_0x5ad7f2;_0x128619++){var _0x21a272=events[_0x128619];var _0x284899=createListener(_0x745e('0x7')+_0x21a272,_0x4e03cc);VoicePrefixEvents['on'](_0x21a272,_0x284899);}}; \ No newline at end of file +var _0x26de=['emit','removeListener','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x516ffb,_0x5b5b42){var _0x319667=function(_0x250098){while(--_0x250098){_0x516ffb['push'](_0x516ffb['shift']());}};_0x319667(++_0x5b5b42);}(_0x26de,0x1d1));var _0xe26d=function(_0x36bec1,_0x715b9e){_0x36bec1=_0x36bec1-0x0;var _0x39640a=_0x26de[_0x36bec1];return _0x39640a;};'use strict';var VoicePrefixEvents=require(_0xe26d('0x0'));var events=[_0xe26d('0x1'),_0xe26d('0x2'),_0xe26d('0x3')];function createListener(_0x205fde,_0x593b2b){return function(_0xaa9948){_0x593b2b[_0xe26d('0x4')](_0x205fde,_0xaa9948);};}function removeListener(_0x35b5dc,_0x58cb67){return function(){VoicePrefixEvents[_0xe26d('0x5')](_0x35b5dc,_0x58cb67);};}exports['register']=function(_0x1c9ffe){for(var _0x1c1388=0x0,_0xe762c8=events['length'];_0x1c1388<_0xe762c8;_0x1c1388++){var _0x55b2de=events[_0x1c1388];var _0x48d8a8=createListener(_0xe26d('0x6')+_0x55b2de,_0x1c9ffe);VoicePrefixEvents['on'](_0x55b2de,_0x48d8a8);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index f0bb408..799fddb 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 _0xb46a=['multer','util','path','express','Router','isAuthenticated','index','get','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/teams','addTeams','addAgents','addLists','put','update','delete','/:id','destroy','removeTeams','removeAgents','removeBlackLists','exports'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0xb46a,0x130));var _0xab46=function(_0x742081,_0x73ca6e){_0x742081=_0x742081-0x0;var _0x53e59a=_0xb46a[_0x742081];return _0x53e59a;};'use strict';var multer=require(_0xab46('0x0'));var util=require(_0xab46('0x1'));var path=require(_0xab46('0x2'));var timeout=require('connect-timeout');var express=require(_0xab46('0x3'));var router=express[_0xab46('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router['get']('/',auth[_0xab46('0x5')](),controller[_0xab46('0x6')]);router[_0xab46('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xab46('0x8')]);router[_0xab46('0x7')](_0xab46('0x9'),auth[_0xab46('0x5')](),controller[_0xab46('0xa')]);router[_0xab46('0x7')](_0xab46('0xb'),auth['isAuthenticated'](),controller['getHopperHistories']);router['get']('/:id/hopper_finals',auth[_0xab46('0x5')](),controller['getHopperFinals']);router['get'](_0xab46('0xc'),auth[_0xab46('0x5')](),controller[_0xab46('0xd')]);router[_0xab46('0x7')]('/:id/teams',auth[_0xab46('0x5')](),controller[_0xab46('0xe')]);router[_0xab46('0x7')](_0xab46('0xf'),auth[_0xab46('0x5')](),controller[_0xab46('0x10')]);router[_0xab46('0x7')](_0xab46('0x11'),auth[_0xab46('0x5')](),controller[_0xab46('0x12')]);router['get'](_0xab46('0x13'),auth['isAuthenticated'](),controller[_0xab46('0x14')]);router[_0xab46('0x7')](_0xab46('0x15'),auth[_0xab46('0x5')](),controller[_0xab46('0x16')]);router[_0xab46('0x17')]('/',auth[_0xab46('0x5')](),controller[_0xab46('0x18')]);router[_0xab46('0x17')]('/:id/clone',auth[_0xab46('0x5')](),controller['clone']);router[_0xab46('0x17')](_0xab46('0x19'),auth[_0xab46('0x5')](),controller[_0xab46('0x1a')]);router['post'](_0xab46('0xf'),auth[_0xab46('0x5')](),controller[_0xab46('0x1b')]);router['post'](_0xab46('0x13'),auth[_0xab46('0x5')](),controller[_0xab46('0x1c')]);router[_0xab46('0x17')](_0xab46('0x15'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0xab46('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xab46('0x1e')]);router[_0xab46('0x1f')](_0xab46('0x20'),auth['isAuthenticated'](),controller[_0xab46('0x21')]);router[_0xab46('0x1f')](_0xab46('0x19'),auth[_0xab46('0x5')](),controller[_0xab46('0x22')]);router[_0xab46('0x1f')](_0xab46('0xf'),auth['isAuthenticated'](),controller[_0xab46('0x23')]);router['delete'](_0xab46('0x13'),auth[_0xab46('0x5')](),controller['removeLists']);router[_0xab46('0x1f')]('/:id/blacklists',auth[_0xab46('0x5')](),controller[_0xab46('0x24')]);module[_0xab46('0x25')]=router; \ No newline at end of file +var _0xd4a5=['util','path','express','Router','../../components/interaction/service','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','getAgents','/:id/members','getMembers','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/teams','addTeams','/:id/users','addAgents','/:id/lists','addLists','addBlackLists','put','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0xd4a5,0xa4));var _0x5d4a=function(_0x3c9f7b,_0x5296b7){_0x3c9f7b=_0x3c9f7b-0x0;var _0x59ea58=_0xd4a5[_0x3c9f7b];return _0x59ea58;};'use strict';var multer=require('multer');var util=require(_0x5d4a('0x0'));var path=require(_0x5d4a('0x1'));var timeout=require('connect-timeout');var express=require(_0x5d4a('0x2'));var router=express[_0x5d4a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5d4a('0x4'));var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router[_0x5d4a('0x5')]('/',auth['isAuthenticated'](),controller[_0x5d4a('0x6')]);router[_0x5d4a('0x5')](_0x5d4a('0x7'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x9')]);router['get'](_0x5d4a('0xa'),auth['isAuthenticated'](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0x5d4a('0x8')](),controller[_0x5d4a('0xb')]);router[_0x5d4a('0x5')](_0x5d4a('0xc'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0xd')]);router[_0x5d4a('0x5')](_0x5d4a('0xe'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0xf')]);router[_0x5d4a('0x5')]('/:id/teams',auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x10')]);router[_0x5d4a('0x5')]('/:id/users',auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x11')]);router[_0x5d4a('0x5')](_0x5d4a('0x12'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x13')]);router[_0x5d4a('0x5')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x5d4a('0x5')](_0x5d4a('0x14'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x15')]);router[_0x5d4a('0x16')]('/',auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x17')]);router['post'](_0x5d4a('0x18'),auth['isAuthenticated'](),controller[_0x5d4a('0x19')]);router[_0x5d4a('0x16')](_0x5d4a('0x1a'),auth['isAuthenticated'](),controller[_0x5d4a('0x1b')]);router[_0x5d4a('0x16')](_0x5d4a('0x1c'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x1d')]);router[_0x5d4a('0x16')](_0x5d4a('0x1e'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x1f')]);router['post'](_0x5d4a('0x14'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x20')]);router[_0x5d4a('0x21')]('/:id',auth['isAuthenticated'](),controller[_0x5d4a('0x22')]);router[_0x5d4a('0x23')](_0x5d4a('0x7'),auth[_0x5d4a('0x8')](),controller['destroy']);router['delete'](_0x5d4a('0x1a'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x24')]);router['delete'](_0x5d4a('0x1c'),auth['isAuthenticated'](),controller[_0x5d4a('0x25')]);router['delete'](_0x5d4a('0x1e'),auth['isAuthenticated'](),controller[_0x5d4a('0x26')]);router['delete'](_0x5d4a('0x14'),auth[_0x5d4a('0x8')](),controller[_0x5d4a('0x27')]);module[_0x5d4a('0x28')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 851470e..a8b65fb 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(_0x4504a7,_0x563a15){var _0x1b3b76=function(_0xb0f30d){while(--_0xb0f30d){_0x4504a7['push'](_0x4504a7['shift']());}};_0x1b3b76(++_0x563a15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x4a281d,_0x27cde8){var _0x3033e7=function(_0x25ba1f){while(--_0x25ba1f){_0x4a281d['push'](_0x4a281d['shift']());}};_0x3033e7(++_0x27cde8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 f4539be..6afec88 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 _0xd4f4=['outbound','filter','map','value','includes','type','UserProfileResource','destroy','end','error','name','index','VoiceQueue','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','merge','where','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','role','VoiceQueues','update','getHoppers','findOne','CmHopper','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','voicePause','interface','flatMap','Agents','forEach','penalty','each','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','User','select','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','SELECT','TeamId','union','compact','transaction','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','upsert','all','isArray','getAgents','getMembers','getLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper','onlyIfOpen','COALESCE(phone,\x27\x27)','createdAt','removeLists','CmList','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','offset','limit','apply','reject','save','then','get','QueueCampaigns'];(function(_0x2c6456,_0x2d218e){var _0x3691d2=function(_0x4050e5){while(--_0x4050e5){_0x2c6456['push'](_0x2c6456['shift']());}};_0x3691d2(++_0x2d218e);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x38e545,_0x36c8ec){_0x38e545=_0x38e545-0x0;var _0x5727f8=_0xd4f4[_0x38e545];return _0x5727f8;};'use strict';var pdf=require(_0x4d4f('0x0'));var emlformat=require(_0x4d4f('0x1'));var rimraf=require(_0x4d4f('0x2'));var zipdir=require(_0x4d4f('0x3'));var jsonpatch=require(_0x4d4f('0x4'));var rp=require(_0x4d4f('0x5'));var moment=require(_0x4d4f('0x6'));var BPromise=require(_0x4d4f('0x7'));var Mustache=require(_0x4d4f('0x8'));var util=require(_0x4d4f('0x9'));var path=require(_0x4d4f('0xa'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var db=require(_0x4d4f('0x1c'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x4d4f('0x1d'),'port':0x18eb});var socket=require(_0x4d4f('0x1e'))(new Redis(config['redis']));require(_0x4d4f('0x1f'))[_0x4d4f('0x20')](socket);function respondWithStatusCode(_0x1878b6,_0x59252c){_0x59252c=_0x59252c||0xcc;return function(_0x145804){if(_0x145804){return _0x1878b6[_0x4d4f('0x21')](_0x59252c);}return _0x1878b6[_0x4d4f('0x22')](_0x59252c)['end']();};}function respondWithResult(_0x59bfb5,_0x5e4ff5){_0x5e4ff5=_0x5e4ff5||0xc8;return function(_0x18a528){if(_0x18a528){return _0x59bfb5[_0x4d4f('0x22')](_0x5e4ff5)[_0x4d4f('0x23')](_0x18a528);}};}function respondWithFilteredResult(_0x5aec1b,_0x30b6b1){return function(_0x17a437){if(_0x17a437){var _0x51dcf1=_0x17a437['count'],_0x5dbbeb=_0x30b6b1[_0x4d4f('0x24')],_0x519501=_0x30b6b1[_0x4d4f('0x24')]+_0x30b6b1[_0x4d4f('0x25')],_0x5a58af;if(_0x519501>=_0x51dcf1){_0x519501=_0x51dcf1;_0x5a58af=0xc8;}else{_0x5a58af=0xce;}_0x5aec1b[_0x4d4f('0x22')](_0x5a58af);return _0x5aec1b['set']('Content-Range',_0x5dbbeb+'-'+_0x519501+'/'+_0x51dcf1)[_0x4d4f('0x23')](_0x17a437);}return null;};}function patchUpdates(_0x4dd360){return function(_0x34a232){try{jsonpatch[_0x4d4f('0x26')](_0x34a232,_0x4dd360,!![]);}catch(_0x3d1e38){return BPromise[_0x4d4f('0x27')](_0x3d1e38);}return _0x34a232[_0x4d4f('0x28')]();};}function saveUpdates(_0x5beab4,_0x570520){return function(_0x4043f2){if(_0x4043f2){return _0x4043f2['update'](_0x5beab4)[_0x4d4f('0x29')](function(_0x3d5d93){return _0x3d5d93;});}return null;};}function removeEntity(_0x2d2fb3,_0x3f4a55){return function(_0xf3f7a4){if(_0xf3f7a4){return _0xf3f7a4['destroy']()[_0x4d4f('0x29')](function(){var _0x312728=_0xf3f7a4[_0x4d4f('0x2a')]({'plain':!![]});var _0x28443b=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0x4d4f('0x2b'),'value':_0x4d4f('0x2c'),'ignore':![]}];var _0xa2492c=_(_0x28443b)[_0x4d4f('0x2d')]('ignore')[_0x4d4f('0x2e')](_0x4d4f('0x2f'))[_0x4d4f('0x2f')]();if(_[_0x4d4f('0x30')](_0xa2492c,_0x312728['type'])){return;}var _0x338ba2=_['find'](_0x28443b,[_0x4d4f('0x2f'),_0x312728[_0x4d4f('0x31')]])['name'];return db[_0x4d4f('0x32')][_0x4d4f('0x33')]({'where':{'type':_0x338ba2,'resourceId':_0x312728['id']}})[_0x4d4f('0x29')](function(){return _0xf3f7a4;});})[_0x4d4f('0x29')](function(){_0x2d2fb3[_0x4d4f('0x22')](0xcc)[_0x4d4f('0x34')]();});}};}function handleEntityNotFound(_0x4c69cb,_0x36eede){return function(_0x4578b6){if(!_0x4578b6){_0x4c69cb[_0x4d4f('0x21')](0x194);}return _0x4578b6;};}function handleError(_0x43c37b,_0x104104){_0x104104=_0x104104||0x1f4;return function(_0x4e47e5){logger[_0x4d4f('0x35')](_0x4e47e5['stack']);if(_0x4e47e5[_0x4d4f('0x36')]){delete _0x4e47e5['name'];}_0x43c37b['status'](_0x104104)['send'](_0x4e47e5);};}exports[_0x4d4f('0x37')]=function(_0x57fc2b,_0x16ccd2){var _0x151132={},_0x3202a5={},_0x4f79f9={'count':0x0,'rows':[]};var _0x8d18dc=_[_0x4d4f('0x2e')](db[_0x4d4f('0x38')]['rawAttributes'],function(_0x6a30c4){return{'name':_0x6a30c4['fieldName'],'type':_0x6a30c4[_0x4d4f('0x31')][_0x4d4f('0x39')]};});_0x3202a5[_0x4d4f('0x3a')]=_[_0x4d4f('0x2e')](_0x8d18dc,_0x4d4f('0x36'));_0x3202a5[_0x4d4f('0x3b')]=_[_0x4d4f('0x3c')](_0x57fc2b[_0x4d4f('0x3b')]);_0x3202a5['filters']=_['intersection'](_0x3202a5[_0x4d4f('0x3a')],_0x3202a5['query']);_0x151132['attributes']=_[_0x4d4f('0x3d')](_0x3202a5[_0x4d4f('0x3a')],qs[_0x4d4f('0x3e')](_0x57fc2b[_0x4d4f('0x3b')][_0x4d4f('0x3e')]));_0x151132['attributes']=_0x151132[_0x4d4f('0x3f')][_0x4d4f('0x40')]?_0x151132['attributes']:_0x3202a5[_0x4d4f('0x3a')];if(!_0x57fc2b[_0x4d4f('0x3b')][_0x4d4f('0x41')](_0x4d4f('0x42'))){_0x151132[_0x4d4f('0x25')]=qs[_0x4d4f('0x25')](_0x57fc2b[_0x4d4f('0x3b')][_0x4d4f('0x25')]);_0x151132[_0x4d4f('0x24')]=qs['offset'](_0x57fc2b['query'][_0x4d4f('0x24')]);}_0x151132[_0x4d4f('0x43')]=qs[_0x4d4f('0x44')](_0x57fc2b[_0x4d4f('0x3b')]['sort']);_0x151132['where']=qs[_0x4d4f('0x45')](_[_0x4d4f('0x46')](_0x57fc2b['query'],_0x3202a5['filters']));if(_0x57fc2b[_0x4d4f('0x3b')][_0x4d4f('0x2d')]){_0x151132['where']=_[_0x4d4f('0x47')](_0x151132[_0x4d4f('0x48')],{'$or':_[_0x4d4f('0x2e')](_0x8d18dc,function(_0x32c6ff){if(_0x32c6ff[_0x4d4f('0x31')]!=='VIRTUAL'){var _0x2b274e={};_0x2b274e[_0x32c6ff['name']]={'$like':'%'+_0x57fc2b[_0x4d4f('0x3b')][_0x4d4f('0x2d')]+'%'};return _0x2b274e;}})});}_0x151132=_['merge']({},_0x151132,_0x57fc2b[_0x4d4f('0x49')]);var _0x132c07={'where':_0x151132[_0x4d4f('0x48')]};return db['VoiceQueue'][_0x4d4f('0x4a')](_0x132c07)['then'](function(_0x5e083){_0x4f79f9['count']=_0x5e083;if(_0x57fc2b[_0x4d4f('0x3b')][_0x4d4f('0x4b')]){_0x151132[_0x4d4f('0x4c')]=[{'all':!![]}];}return db[_0x4d4f('0x38')][_0x4d4f('0x4d')](_0x151132);})['then'](function(_0x5f0d35){_0x4f79f9[_0x4d4f('0x4e')]=_0x5f0d35;return _0x4f79f9;})[_0x4d4f('0x29')](respondWithFilteredResult(_0x16ccd2,_0x151132))[_0x4d4f('0x4f')](handleError(_0x16ccd2,null));};exports[_0x4d4f('0x50')]=function(_0x5c0442,_0x54d0d5){var _0x59b4a2={'raw':![],'where':{'id':_0x5c0442[_0x4d4f('0x51')]['id']}},_0xc9da58={};_0xc9da58[_0x4d4f('0x3a')]=_[_0x4d4f('0x3c')](db[_0x4d4f('0x38')][_0x4d4f('0x52')]);_0xc9da58[_0x4d4f('0x3b')]=_[_0x4d4f('0x3c')](_0x5c0442[_0x4d4f('0x3b')]);_0xc9da58[_0x4d4f('0x45')]=_[_0x4d4f('0x3d')](_0xc9da58[_0x4d4f('0x3a')],_0xc9da58['query']);_0x59b4a2[_0x4d4f('0x3f')]=_[_0x4d4f('0x3d')](_0xc9da58['model'],qs[_0x4d4f('0x3e')](_0x5c0442['query'][_0x4d4f('0x3e')]));_0x59b4a2[_0x4d4f('0x3f')]=_0x59b4a2['attributes'][_0x4d4f('0x40')]?_0x59b4a2[_0x4d4f('0x3f')]:_0xc9da58[_0x4d4f('0x3a')];if(_0x5c0442[_0x4d4f('0x3b')][_0x4d4f('0x4b')]){_0x59b4a2[_0x4d4f('0x4c')]=[{'all':!![]}];}_0x59b4a2=_[_0x4d4f('0x47')]({},_0x59b4a2,_0x5c0442[_0x4d4f('0x49')]);return db[_0x4d4f('0x38')][_0x4d4f('0x53')](_0x59b4a2)[_0x4d4f('0x29')](handleEntityNotFound(_0x54d0d5,null))[_0x4d4f('0x29')](respondWithResult(_0x54d0d5,null))['catch'](handleError(_0x54d0d5,null));};exports[_0x4d4f('0x54')]=function(_0x539088,_0x59d245){return db['VoiceQueue'][_0x4d4f('0x54')](_0x539088[_0x4d4f('0x55')],{})['then'](function(_0x5f3252){var _0x2a3bc4=_0x539088[_0x4d4f('0x56')]['get']({'plain':!![]});if(!_0x2a3bc4)throw new Error(_0x4d4f('0x57'));if(_0x2a3bc4['role']===_0x4d4f('0x56')){var _0x3626e6=_0x5f3252[_0x4d4f('0x2a')]({'plain':!![]});var _0x2c29e0=[{'name':'VoiceQueues','value':_0x4d4f('0x58')},{'name':_0x4d4f('0x2b'),'value':_0x4d4f('0x2c')}];var _0xf430b0=_[_0x4d4f('0x53')](_0x2c29e0,['value',_0x3626e6[_0x4d4f('0x31')]])['name'];return db[_0x4d4f('0x59')]['find']({'where':{'name':_0xf430b0,'userProfileId':_0x2a3bc4[_0x4d4f('0x5a')]},'raw':!![]})[_0x4d4f('0x29')](function(_0x57f4b3){if(_0x57f4b3&&_0x57f4b3[_0x4d4f('0x5b')]===0x0){return db[_0x4d4f('0x32')]['create']({'name':_0x3626e6[_0x4d4f('0x36')],'resourceId':_0x3626e6['id'],'type':_0x57f4b3['name'],'sectionId':_0x57f4b3['id']},{})[_0x4d4f('0x29')](function(){return _0x5f3252;});}else{return _0x5f3252;}})['catch'](function(_0x48ad06){logger[_0x4d4f('0x35')](_0x4d4f('0x5c'),_0x48ad06);throw _0x48ad06;});}return _0x5f3252;})[_0x4d4f('0x29')](respondWithResult(_0x59d245,0xc9))[_0x4d4f('0x4f')](handleError(_0x59d245,null));};exports[_0x4d4f('0x5d')]=function(_0x57c928,_0x4aff5e){var _0xeaccdd={'where':{'id':_0x57c928[_0x4d4f('0x51')]['id']}},_0x52641a={};_0x52641a[_0x4d4f('0x3a')]=_[_0x4d4f('0x3c')](db[_0x4d4f('0x38')][_0x4d4f('0x52')]);_0xeaccdd[_0x4d4f('0x3f')]=_['intersection'](_0x52641a[_0x4d4f('0x3a')],qs[_0x4d4f('0x3e')](_0x57c928[_0x4d4f('0x3b')]['fields']));_0xeaccdd[_0x4d4f('0x3f')]=_0xeaccdd[_0x4d4f('0x3f')][_0x4d4f('0x40')]?_0xeaccdd['attributes']:_0x52641a[_0x4d4f('0x3a')];if(_0x57c928['query'][_0x4d4f('0x4b')]){_0xeaccdd[_0x4d4f('0x4c')]=[{'all':!![]}];}_0xeaccdd=_[_0x4d4f('0x47')]({},_0xeaccdd,_0x57c928[_0x4d4f('0x49')]);return db[_0x4d4f('0x38')][_0x4d4f('0x53')](_0xeaccdd)[_0x4d4f('0x29')](handleEntityNotFound(_0x4aff5e,null))[_0x4d4f('0x29')](function(_0xa64ebd){if(_0xa64ebd){var _0x537ab7=_0xa64ebd[_0x4d4f('0x2a')]({'plain':!![]});_0x537ab7=qs[_0x4d4f('0x5e')](_0x537ab7,['id','createdAt',_0x4d4f('0x5f')]);_0x57c928[_0x4d4f('0x55')]=_[_0x4d4f('0x5e')](_0x57c928[_0x4d4f('0x55')],['id','createdAt',_0x4d4f('0x5f')]);return db[_0x4d4f('0x38')]['create'](_['merge'](_0x537ab7,_0x57c928[_0x4d4f('0x55')]),{'include':_0x57c928[_0x4d4f('0x3b')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x4d34fc){var _0x4752bd=_0x57c928[_0x4d4f('0x56')]['get']({'plain':!![]});if(!_0x4752bd)throw new Error(_0x4d4f('0x57'));if(_0x4752bd[_0x4d4f('0x60')]===_0x4d4f('0x56')){var _0x46f2fb=_0x4d34fc[_0x4d4f('0x2a')]({'plain':!![]});var _0x3a0394=[{'name':_0x4d4f('0x61'),'value':_0x4d4f('0x58')},{'name':'QueueCampaigns','value':_0x4d4f('0x2c')}];var _0x4e4196=_[_0x4d4f('0x53')](_0x3a0394,[_0x4d4f('0x2f'),_0x46f2fb[_0x4d4f('0x31')]])['name'];return db[_0x4d4f('0x59')][_0x4d4f('0x53')]({'where':{'name':_0x4e4196,'userProfileId':_0x4752bd[_0x4d4f('0x5a')]},'raw':!![]})[_0x4d4f('0x29')](function(_0x4a18bc){if(_0x4a18bc&&_0x4a18bc[_0x4d4f('0x5b')]===0x0){return db['UserProfileResource'][_0x4d4f('0x54')]({'name':_0x46f2fb['name'],'resourceId':_0x46f2fb['id'],'type':_0x4a18bc['name'],'sectionId':_0x4a18bc['id']},{})[_0x4d4f('0x29')](function(){return _0x4d34fc;});}else{return _0x4d34fc;}})[_0x4d4f('0x4f')](function(_0x5dd9ff){logger[_0x4d4f('0x35')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dd9ff);throw _0x5dd9ff;});}return _0x4d34fc;});}})[_0x4d4f('0x29')](respondWithResult(_0x4aff5e,0xc9))[_0x4d4f('0x4f')](handleError(_0x4aff5e,null));};exports[_0x4d4f('0x62')]=function(_0x3ce5d8,_0x575ad6){if(_0x3ce5d8[_0x4d4f('0x55')]['id']){delete _0x3ce5d8[_0x4d4f('0x55')]['id'];}return db[_0x4d4f('0x38')]['find']({'where':{'id':_0x3ce5d8[_0x4d4f('0x51')]['id']}})[_0x4d4f('0x29')](handleEntityNotFound(_0x575ad6,null))[_0x4d4f('0x29')](saveUpdates(_0x3ce5d8[_0x4d4f('0x55')],null))[_0x4d4f('0x29')](respondWithResult(_0x575ad6,null))[_0x4d4f('0x4f')](handleError(_0x575ad6,null));};exports['destroy']=function(_0x4acf9f,_0x2ce3ce){return db[_0x4d4f('0x38')]['find']({'where':{'id':_0x4acf9f[_0x4d4f('0x51')]['id']}})[_0x4d4f('0x29')](handleEntityNotFound(_0x2ce3ce,null))[_0x4d4f('0x29')](removeEntity(_0x2ce3ce,null))[_0x4d4f('0x4f')](handleError(_0x2ce3ce,null));};exports[_0x4d4f('0x63')]=function(_0x45000f,_0x431b5e,_0x1c764b){var _0x302cde={'raw':![],'where':{}};var _0x44f0c2={};var _0x4453c7={'count':0x0,'rows':[]};return db[_0x4d4f('0x38')][_0x4d4f('0x64')]({'where':{'id':_0x45000f[_0x4d4f('0x51')]['id']}})[_0x4d4f('0x29')](handleEntityNotFound(_0x431b5e,null))['then'](function(_0x6d2191){if(_0x6d2191){_0x44f0c2[_0x4d4f('0x3a')]=_[_0x4d4f('0x3c')](db[_0x4d4f('0x65')]['rawAttributes']);_0x44f0c2['query']=_[_0x4d4f('0x3c')](_0x45000f[_0x4d4f('0x3b')]);_0x44f0c2[_0x4d4f('0x45')]=_[_0x4d4f('0x3d')](_0x44f0c2[_0x4d4f('0x3a')],_0x44f0c2[_0x4d4f('0x3b')]);_0x302cde[_0x4d4f('0x3f')]=_[_0x4d4f('0x3d')](_0x44f0c2[_0x4d4f('0x3a')],qs[_0x4d4f('0x3e')](_0x45000f['query'][_0x4d4f('0x3e')]));_0x302cde[_0x4d4f('0x3f')]=_0x302cde[_0x4d4f('0x3f')][_0x4d4f('0x40')]?_0x302cde['attributes']:_0x44f0c2['model'];if(!_0x45000f['query'][_0x4d4f('0x41')]('nolimit')){_0x302cde[_0x4d4f('0x25')]=qs[_0x4d4f('0x25')](_0x45000f[_0x4d4f('0x3b')][_0x4d4f('0x25')]);_0x302cde[_0x4d4f('0x24')]=qs[_0x4d4f('0x24')](_0x45000f[_0x4d4f('0x3b')][_0x4d4f('0x24')]);}_0x302cde['order']=qs['sort'](_0x45000f[_0x4d4f('0x3b')]['sort']);_0x302cde[_0x4d4f('0x48')]=qs[_0x4d4f('0x45')](_[_0x4d4f('0x46')](_0x45000f['query'],_0x44f0c2['filters']));_0x302cde['where'][_0x4d4f('0x66')]=_0x6d2191['id'];if(_0x45000f['query'][_0x4d4f('0x2d')]){_0x302cde['where']=_[_0x4d4f('0x47')](_0x302cde[_0x4d4f('0x48')],{'$or':_[_0x4d4f('0x2e')](_0x302cde[_0x4d4f('0x3f')],function(_0x348438){var _0x1670fd={};_0x1670fd[_0x348438]={'$like':'%'+_0x45000f['query'][_0x4d4f('0x2d')]+'%'};return _0x1670fd;})});}_0x302cde=_[_0x4d4f('0x47')]({},_0x302cde,_0x45000f[_0x4d4f('0x49')]);return db[_0x4d4f('0x65')][_0x4d4f('0x4a')]({'where':_0x302cde['where']})[_0x4d4f('0x29')](function(_0x493f00){_0x4453c7[_0x4d4f('0x4a')]=_0x493f00;if(_0x45000f[_0x4d4f('0x3b')][_0x4d4f('0x4b')]){_0x302cde[_0x4d4f('0x4c')]=[{'all':!![]}];}return db[_0x4d4f('0x65')][_0x4d4f('0x4d')](_0x302cde);})[_0x4d4f('0x29')](function(_0x5a0e5d){_0x4453c7[_0x4d4f('0x4e')]=_0x5a0e5d;return _0x4453c7;});}})[_0x4d4f('0x29')](respondWithFilteredResult(_0x431b5e,_0x302cde))[_0x4d4f('0x4f')](handleError(_0x431b5e,null));};exports['getHopperHistories']=function(_0x16ad7a,_0x48d400,_0x460ae1){var _0x529cb8={'raw':!![],'where':{}};var _0x9a2d62={};var _0x20e632={'count':0x0,'rows':[]};return db[_0x4d4f('0x38')]['findOne']({'where':{'id':_0x16ad7a[_0x4d4f('0x51')]['id']}})[_0x4d4f('0x29')](handleEntityNotFound(_0x48d400,null))[_0x4d4f('0x29')](function(_0x521d24){if(_0x521d24){_0x9a2d62['model']=_[_0x4d4f('0x3c')](db[_0x4d4f('0x67')]['rawAttributes']);_0x9a2d62[_0x4d4f('0x3b')]=_[_0x4d4f('0x3c')](_0x16ad7a[_0x4d4f('0x3b')]);_0x9a2d62[_0x4d4f('0x45')]=_[_0x4d4f('0x3d')](_0x9a2d62[_0x4d4f('0x3a')],_0x9a2d62['query']);_0x529cb8[_0x4d4f('0x3f')]=_[_0x4d4f('0x3d')](_0x9a2d62['model'],qs[_0x4d4f('0x3e')](_0x16ad7a[_0x4d4f('0x3b')][_0x4d4f('0x3e')]));_0x529cb8[_0x4d4f('0x3f')]=_0x529cb8[_0x4d4f('0x3f')][_0x4d4f('0x40')]?_0x529cb8[_0x4d4f('0x3f')]:_0x9a2d62[_0x4d4f('0x3a')];if(!_0x16ad7a['query'][_0x4d4f('0x41')](_0x4d4f('0x42'))){_0x529cb8['limit']=qs[_0x4d4f('0x25')](_0x16ad7a['query'][_0x4d4f('0x25')]);_0x529cb8['offset']=qs[_0x4d4f('0x24')](_0x16ad7a[_0x4d4f('0x3b')][_0x4d4f('0x24')]);}_0x529cb8[_0x4d4f('0x43')]=qs[_0x4d4f('0x44')](_0x16ad7a[_0x4d4f('0x3b')][_0x4d4f('0x44')]);_0x529cb8[_0x4d4f('0x48')]=qs[_0x4d4f('0x45')](_[_0x4d4f('0x46')](_0x16ad7a[_0x4d4f('0x3b')],_0x9a2d62[_0x4d4f('0x45')]));_0x529cb8['where']['VoiceQueueId']=_0x521d24['id'];if(_0x16ad7a[_0x4d4f('0x3b')]['filter']){_0x529cb8[_0x4d4f('0x48')]=_[_0x4d4f('0x47')](_0x529cb8['where'],{'$or':_['map'](_0x529cb8[_0x4d4f('0x3f')],function(_0x300cc5){var _0x3c898a={};_0x3c898a[_0x300cc5]={'$like':'%'+_0x16ad7a['query']['filter']+'%'};return _0x3c898a;})});}_0x529cb8=_[_0x4d4f('0x47')]({},_0x529cb8,_0x16ad7a[_0x4d4f('0x49')]);return db[_0x4d4f('0x67')][_0x4d4f('0x4a')]({'where':_0x529cb8['where']})[_0x4d4f('0x29')](function(_0x35fb03){_0x20e632[_0x4d4f('0x4a')]=_0x35fb03;if(_0x16ad7a['query']['includeAll']){_0x529cb8[_0x4d4f('0x4c')]=[{'all':!![]}];}return db[_0x4d4f('0x67')][_0x4d4f('0x4d')](_0x529cb8);})[_0x4d4f('0x29')](function(_0x20e29a){_0x20e632['rows']=_0x20e29a;return _0x20e632;});}})[_0x4d4f('0x29')](respondWithFilteredResult(_0x48d400,_0x529cb8))[_0x4d4f('0x4f')](handleError(_0x48d400,null));};exports[_0x4d4f('0x68')]=function(_0x4ad1a3,_0x39cdc4,_0x5ec3eb){var _0x236c08={'raw':!![],'where':{}};var _0x2e4015={};var _0x1ffc34={'count':0x0,'rows':[]};return db[_0x4d4f('0x38')][_0x4d4f('0x64')]({'where':{'id':_0x4ad1a3['params']['id']}})[_0x4d4f('0x29')](handleEntityNotFound(_0x39cdc4,null))[_0x4d4f('0x29')](function(_0x3f0fc4){if(_0x3f0fc4){_0x2e4015[_0x4d4f('0x3a')]=_['keys'](db[_0x4d4f('0x69')]['rawAttributes']);_0x2e4015['query']=_[_0x4d4f('0x3c')](_0x4ad1a3[_0x4d4f('0x3b')]);_0x2e4015['filters']=_[_0x4d4f('0x3d')](_0x2e4015['model'],_0x2e4015[_0x4d4f('0x3b')]);_0x236c08[_0x4d4f('0x3f')]=_[_0x4d4f('0x3d')](_0x2e4015[_0x4d4f('0x3a')],qs[_0x4d4f('0x3e')](_0x4ad1a3[_0x4d4f('0x3b')][_0x4d4f('0x3e')]));_0x236c08[_0x4d4f('0x3f')]=_0x236c08['attributes'][_0x4d4f('0x40')]?_0x236c08[_0x4d4f('0x3f')]:_0x2e4015['model'];if(!_0x4ad1a3[_0x4d4f('0x3b')]['hasOwnProperty'](_0x4d4f('0x42'))){_0x236c08[_0x4d4f('0x25')]=qs[_0x4d4f('0x25')](_0x4ad1a3['query']['limit']);_0x236c08['offset']=qs[_0x4d4f('0x24')](_0x4ad1a3['query'][_0x4d4f('0x24')]);}_0x236c08[_0x4d4f('0x43')]=qs[_0x4d4f('0x44')](_0x4ad1a3['query']['sort']);_0x236c08[_0x4d4f('0x48')]=qs[_0x4d4f('0x45')](_[_0x4d4f('0x46')](_0x4ad1a3[_0x4d4f('0x3b')],_0x2e4015[_0x4d4f('0x45')]));_0x236c08[_0x4d4f('0x48')]['VoiceQueueId']=_0x3f0fc4['id'];if(_0x4ad1a3[_0x4d4f('0x3b')][_0x4d4f('0x2d')]){_0x236c08[_0x4d4f('0x48')]=_[_0x4d4f('0x47')](_0x236c08[_0x4d4f('0x48')],{'$or':_[_0x4d4f('0x2e')](_0x236c08[_0x4d4f('0x3f')],function(_0x85b007){var _0x1a1e6f={};_0x1a1e6f[_0x85b007]={'$like':'%'+_0x4ad1a3[_0x4d4f('0x3b')][_0x4d4f('0x2d')]+'%'};return _0x1a1e6f;})});}_0x236c08=_[_0x4d4f('0x47')]({},_0x236c08,_0x4ad1a3[_0x4d4f('0x49')]);return db[_0x4d4f('0x69')]['count']({'where':_0x236c08[_0x4d4f('0x48')]})[_0x4d4f('0x29')](function(_0x42ec0b){_0x1ffc34[_0x4d4f('0x4a')]=_0x42ec0b;if(_0x4ad1a3[_0x4d4f('0x3b')][_0x4d4f('0x4b')]){_0x236c08[_0x4d4f('0x4c')]=[{'all':!![]}];}return db[_0x4d4f('0x69')][_0x4d4f('0x4d')](_0x236c08);})['then'](function(_0xcadde2){_0x1ffc34[_0x4d4f('0x4e')]=_0xcadde2;return _0x1ffc34;});}})[_0x4d4f('0x29')](respondWithFilteredResult(_0x39cdc4,_0x236c08))[_0x4d4f('0x4f')](handleError(_0x39cdc4,null));};exports[_0x4d4f('0x6a')]=function(_0xd22d78,_0x28c128,_0x28fd35){var _0x18206d={'raw':!![],'where':{}};var _0x2536e0={};var _0x5c3e11={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x4d4f('0x64')]({'where':{'id':_0xd22d78[_0x4d4f('0x51')]['id']}})['then'](handleEntityNotFound(_0x28c128,null))[_0x4d4f('0x29')](function(_0x3c0804){if(_0x3c0804){_0x2536e0[_0x4d4f('0x3a')]=_[_0x4d4f('0x3c')](db[_0x4d4f('0x6b')][_0x4d4f('0x52')]);_0x2536e0[_0x4d4f('0x3b')]=_[_0x4d4f('0x3c')](_0xd22d78[_0x4d4f('0x3b')]);_0x2536e0[_0x4d4f('0x45')]=_[_0x4d4f('0x3d')](_0x2536e0[_0x4d4f('0x3a')],_0x2536e0[_0x4d4f('0x3b')]);_0x18206d[_0x4d4f('0x3f')]=_['intersection'](_0x2536e0[_0x4d4f('0x3a')],qs['fields'](_0xd22d78[_0x4d4f('0x3b')][_0x4d4f('0x3e')]));_0x18206d[_0x4d4f('0x3f')]=_0x18206d[_0x4d4f('0x3f')]['length']?_0x18206d[_0x4d4f('0x3f')]:_0x2536e0[_0x4d4f('0x3a')];if(!_0xd22d78[_0x4d4f('0x3b')][_0x4d4f('0x41')](_0x4d4f('0x42'))){_0x18206d[_0x4d4f('0x25')]=qs[_0x4d4f('0x25')](_0xd22d78['query'][_0x4d4f('0x25')]);_0x18206d[_0x4d4f('0x24')]=qs[_0x4d4f('0x24')](_0xd22d78[_0x4d4f('0x3b')][_0x4d4f('0x24')]);}_0x18206d[_0x4d4f('0x43')]=qs['sort'](_0xd22d78['query'][_0x4d4f('0x44')]);_0x18206d['where']=qs[_0x4d4f('0x45')](_[_0x4d4f('0x46')](_0xd22d78['query'],_0x2536e0[_0x4d4f('0x45')]));_0x18206d[_0x4d4f('0x48')][_0x4d4f('0x66')]=_0x3c0804['id'];if(_0xd22d78[_0x4d4f('0x3b')][_0x4d4f('0x2d')]){_0x18206d[_0x4d4f('0x48')]=_[_0x4d4f('0x47')](_0x18206d['where'],{'$or':_[_0x4d4f('0x2e')](_0x18206d['attributes'],function(_0x2758bf){var _0x2d1337={};_0x2d1337[_0x2758bf]={'$like':'%'+_0xd22d78['query']['filter']+'%'};return _0x2d1337;})});}_0x18206d=_[_0x4d4f('0x47')]({},_0x18206d,_0xd22d78[_0x4d4f('0x49')]);return db[_0x4d4f('0x6b')]['count']({'where':_0x18206d[_0x4d4f('0x48')]})[_0x4d4f('0x29')](function(_0x7c1b06){_0x5c3e11[_0x4d4f('0x4a')]=_0x7c1b06;if(_0xd22d78[_0x4d4f('0x3b')][_0x4d4f('0x4b')]){_0x18206d[_0x4d4f('0x4c')]=[{'all':!![]}];}return db[_0x4d4f('0x6b')][_0x4d4f('0x4d')](_0x18206d);})['then'](function(_0x305272){_0x5c3e11[_0x4d4f('0x4e')]=_0x305272;return _0x5c3e11;});}})[_0x4d4f('0x29')](respondWithFilteredResult(_0x28c128,_0x18206d))[_0x4d4f('0x4f')](handleError(_0x28c128,null));};exports['getTeams']=function(_0x14d9d0,_0x5da3cc,_0x4e6485){var _0x432847={};var _0x2c6f09={};var _0x31984b;var _0x3de9b3;return db[_0x4d4f('0x38')][_0x4d4f('0x64')]({'where':{'id':_0x14d9d0[_0x4d4f('0x51')]['id']}})[_0x4d4f('0x29')](handleEntityNotFound(_0x5da3cc,null))[_0x4d4f('0x29')](function(_0x5b5bcc){if(_0x5b5bcc){_0x31984b=_0x5b5bcc;_0x2c6f09[_0x4d4f('0x3a')]=_['keys'](db[_0x4d4f('0x6c')][_0x4d4f('0x52')]);_0x2c6f09[_0x4d4f('0x3b')]=_[_0x4d4f('0x3c')](_0x14d9d0[_0x4d4f('0x3b')]);_0x2c6f09[_0x4d4f('0x45')]=_[_0x4d4f('0x3d')](_0x2c6f09[_0x4d4f('0x3a')],_0x2c6f09[_0x4d4f('0x3b')]);_0x432847[_0x4d4f('0x3f')]=_[_0x4d4f('0x3d')](_0x2c6f09['model'],qs[_0x4d4f('0x3e')](_0x14d9d0[_0x4d4f('0x3b')]['fields']));_0x432847[_0x4d4f('0x3f')]=_0x432847[_0x4d4f('0x3f')][_0x4d4f('0x40')]?_0x432847[_0x4d4f('0x3f')]:_0x2c6f09[_0x4d4f('0x3a')];_0x432847[_0x4d4f('0x43')]=qs['sort'](_0x14d9d0[_0x4d4f('0x3b')][_0x4d4f('0x44')]);_0x432847[_0x4d4f('0x48')]=qs['filters'](_[_0x4d4f('0x46')](_0x14d9d0[_0x4d4f('0x3b')],_0x2c6f09['filters']));if(_0x14d9d0['query'][_0x4d4f('0x2d')]){_0x432847['where']=_[_0x4d4f('0x47')](_0x432847[_0x4d4f('0x48')],{'$or':_[_0x4d4f('0x2e')](_0x432847[_0x4d4f('0x3f')],function(_0x361da6){var _0x1c5605={};_0x1c5605[_0x361da6]={'$like':'%'+_0x14d9d0[_0x4d4f('0x3b')]['filter']+'%'};return _0x1c5605;})});}_0x432847=_[_0x4d4f('0x47')]({},_0x432847,_0x14d9d0['options']);return _0x31984b[_0x4d4f('0x6d')](_0x432847);}})[_0x4d4f('0x29')](function(_0x53c98c){if(_0x53c98c){_0x3de9b3=_0x53c98c['length'];if(!_0x14d9d0[_0x4d4f('0x3b')]['hasOwnProperty']('nolimit')){_0x432847['limit']=qs[_0x4d4f('0x25')](_0x14d9d0[_0x4d4f('0x3b')]['limit']);_0x432847['offset']=qs[_0x4d4f('0x24')](_0x14d9d0[_0x4d4f('0x3b')][_0x4d4f('0x24')]);}return _0x31984b[_0x4d4f('0x6d')](_0x432847);}})[_0x4d4f('0x29')](function(_0x259120){if(_0x259120){return _0x259120?{'count':_0x3de9b3,'rows':_0x259120}:null;}})[_0x4d4f('0x29')](respondWithResult(_0x5da3cc,null))[_0x4d4f('0x4f')](handleError(_0x5da3cc,null));};exports[_0x4d4f('0x6e')]=function(_0x151939,_0x3957ce,_0x106854){var _0x5cd60a=_0x151939[_0x4d4f('0x55')][_0x4d4f('0x6f')];var _0x3831d7=_[_0x4d4f('0x2e')](_0x5cd60a,'id');return db[_0x4d4f('0x6c')]['findAll']({'where':{'id':_0x3831d7},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x4d4f('0x36'),'online',_0x4d4f('0x70'),_0x4d4f('0x71')],'raw':!![]}]})[_0x4d4f('0x29')](function(_0x2f9bda){if(_0x2f9bda){var _0x39f03c=_[_0x4d4f('0x72')](_0x2f9bda,function(_0x53f116){var _0x399a82=_0x53f116[_0x4d4f('0x2a')]({'plain':!![]});_0x399a82[_0x4d4f('0x73')][_0x4d4f('0x74')](function(_0x321949){_0x321949[_0x4d4f('0x75')]=_['find'](_0x5cd60a,{'id':_0x399a82['id']})['penalty'];});return _0x399a82[_0x4d4f('0x73')];});return db['VoiceQueue'][_0x4d4f('0x53')]({'where':{'id':_0x151939[_0x4d4f('0x51')]['id']}})[_0x4d4f('0x29')](function(_0x6a31bd){return db['sequelize']['transaction'](function(_0x59a27e){return _0x6a31bd[_0x4d4f('0x6e')](_0x3831d7,{'transaction':_0x59a27e})['then'](function(){return BPromise[_0x4d4f('0x76')](_0x39f03c,function(_0x42e132){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x42e132['id'],'VoiceQueueId':_0x151939[_0x4d4f('0x51')]['id']},'defaults':{'penalty':_0x42e132[_0x4d4f('0x75')]},'transaction':_0x59a27e});});})[_0x4d4f('0x29')](function(){return BPromise[_0x4d4f('0x76')](_['filter'](_0x39f03c,{'online':!![]}),function(_0x43f540){return db[_0x4d4f('0x77')]['upsert']({'membername':_0x43f540[_0x4d4f('0x36')],'UserId':_0x43f540['id'],'queue_name':_0x6a31bd[_0x4d4f('0x36')],'VoiceQueueId':_0x6a31bd['id'],'interface':_[_0x4d4f('0x78')](_0x43f540[_0x4d4f('0x71')])?util[_0x4d4f('0x79')](_0x4d4f('0x7a'),_0x43f540[_0x4d4f('0x36')]):_0x43f540[_0x4d4f('0x71')],'paused':_0x43f540['voicePause']||![],'penalty':_0x43f540['penalty']},{'transaction':_0x59a27e});});})[_0x4d4f('0x29')](function(){_0x39f03c[_0x4d4f('0x74')](function(_0x22aac0){socket[_0x4d4f('0x7b')](_0x4d4f('0x7c'),{'UserId':_0x22aac0['id'],'VoiceQueueId':_0x6a31bd['id']});});});});});}})[_0x4d4f('0x29')](respondWithStatusCode(_0x3957ce,null))[_0x4d4f('0x4f')](handleError(_0x3957ce,null));};exports[_0x4d4f('0x7d')]=function(_0x340b4a,_0x1690da,_0x7e2521){return db[_0x4d4f('0x6c')]['findAll']({'where':{'id':_0x340b4a[_0x4d4f('0x3b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4d4f('0x7e')],'as':_0x4d4f('0x73'),'attributes':['id'],'raw':!![]}]})[_0x4d4f('0x29')](handleEntityNotFound(_0x1690da,null))[_0x4d4f('0x29')](function(_0x4c8d20){var _0x3b5394=_[_0x4d4f('0x2e')](_0x4c8d20,'id');var _0x490129=[];var _0x4784e9=[];var _0x4bcf19=squel[_0x4d4f('0x7f')]();_0x4bcf19[_0x4d4f('0x80')]('tq.TeamId')[_0x4d4f('0x81')](_0x4d4f('0x82'),'tq')[_0x4d4f('0x83')](_0x4d4f('0x84'),'ut',_0x4d4f('0x85'))['where'](_0x4d4f('0x86'),_0x340b4a['params']['id']);for(var _0x3ece9f=0x0;_0x3ece9f<_0x4c8d20[_0x4d4f('0x40')];_0x3ece9f+=0x1){let _0xfdf741=_0x4c8d20[_0x3ece9f];for(var _0xb79d8b=0x0;_0xb79d8b<_0xfdf741[_0x4d4f('0x73')][_0x4d4f('0x40')];_0xb79d8b+=0x1){let _0x5b3117=_0xfdf741[_0x4d4f('0x73')][_0xb79d8b];var _0x597719=_0x4bcf19['clone']();_0x597719['where'](_0x4d4f('0x87'),_0x5b3117['id']);_0x4784e9[_0x4d4f('0x88')](db[_0x4d4f('0x89')][_0x4d4f('0x3b')](_0x597719['toString'](),{'type':db['sequelize']['QueryTypes'][_0x4d4f('0x8a')]})['then'](function(_0x417fc3){if(_0x417fc3[_0x4d4f('0x40')]===0x1){return _0x5b3117['id'];}else{var _0x2bb8ac=_['every'](_['map'](_0x417fc3,_0x4d4f('0x8b')),function(_0x32451e){return _[_0x4d4f('0x30')](_0x3b5394,_0x32451e);});if(_0x2bb8ac){return _0x5b3117['id'];}}}));}}return BPromise['all'](_0x4784e9)[_0x4d4f('0x29')](function(_0x26b95d){_0x490129=_(_0x490129)[_0x4d4f('0x8c')](_0x26b95d)[_0x4d4f('0x8d')]()[_0x4d4f('0x2f')]();return db[_0x4d4f('0x38')]['find']({'where':{'id':_0x340b4a[_0x4d4f('0x51')]['id']}})['then'](function(_0x5f040b){return db['sequelize'][_0x4d4f('0x8e')](function(_0x31a3ff){return _0x5f040b['removeTeams'](_0x340b4a[_0x4d4f('0x3b')][_0x4d4f('0x8f')],{'transaction':_0x31a3ff})[_0x4d4f('0x29')](function(){if(!_[_0x4d4f('0x90')](_0x490129)){return _0x5f040b[_0x4d4f('0x91')](_0x490129,{'transaction':_0x31a3ff})[_0x4d4f('0x29')](function(){return db[_0x4d4f('0x77')]['destroy']({'where':{'VoiceQueueId':_0x340b4a[_0x4d4f('0x51')]['id'],'UserId':_0x490129},'transaction':_0x31a3ff});});}})[_0x4d4f('0x29')](function(){_0x490129['forEach'](function(_0x65b557){socket[_0x4d4f('0x7b')](_0x4d4f('0x92'),{'UserId':_0x65b557,'VoiceQueueId':_0x5f040b['id']});});});});});});})[_0x4d4f('0x29')](respondWithStatusCode(_0x1690da,null))[_0x4d4f('0x4f')](handleError(_0x1690da,null));};exports[_0x4d4f('0x93')]=function(_0x10c8f1,_0x30c5f3,_0x5d90f5){var _0x8aeb1b,_0x285ea7;return db[_0x4d4f('0x38')][_0x4d4f('0x53')]({'where':{'id':_0x10c8f1['params']['id']}})[_0x4d4f('0x29')](handleEntityNotFound(_0x30c5f3,null))[_0x4d4f('0x29')](function(_0x1c3638){if(_0x1c3638){_0x285ea7=_0x1c3638;return _0x1c3638[_0x4d4f('0x93')](_0x10c8f1[_0x4d4f('0x55')][_0x4d4f('0x8f')],_[_0x4d4f('0x5e')](_0x10c8f1[_0x4d4f('0x55')],[_0x4d4f('0x8f'),'id'])||{})[_0x4d4f('0x94')](function(_0x36b731){for(var _0x58a6e4=0x0;_0x58a6e4<_0x10c8f1[_0x4d4f('0x55')][_0x4d4f('0x8f')][_0x4d4f('0x40')];_0x58a6e4+=0x1){socket[_0x4d4f('0x7b')](_0x4d4f('0x7c'),{'UserId':_0x10c8f1[_0x4d4f('0x55')][_0x4d4f('0x8f')][_0x58a6e4],'VoiceQueueId':_0x10c8f1[_0x4d4f('0x51')]['id']});}return _0x36b731;});}})[_0x4d4f('0x29')](function(_0x218c68){_0x8aeb1b=_0x218c68||[];if(_0x285ea7){return db[_0x4d4f('0x7e')]['findAll']({'where':{'id':_0x10c8f1[_0x4d4f('0x55')][_0x4d4f('0x8f')]},'attributes':['id',_0x4d4f('0x36'),_0x4d4f('0x95'),_0x4d4f('0x70'),_0x4d4f('0x71')],'raw':!![]});}})[_0x4d4f('0x29')](function(_0x1cca46){if(!_[_0x4d4f('0x90')](_0x1cca46)){var _0xfa58f3=[];for(var _0x589f37=0x0;_0x589f37<_0x1cca46[_0x4d4f('0x40')];_0x589f37++){if(_0x1cca46[_0x589f37][_0x4d4f('0x95')]){_0xfa58f3[_0x4d4f('0x88')](db[_0x4d4f('0x77')][_0x4d4f('0x96')]({'membername':_0x1cca46[_0x589f37][_0x4d4f('0x36')],'UserId':_0x1cca46[_0x589f37]['id'],'queue_name':_0x285ea7['name'],'VoiceQueueId':_0x285ea7['id'],'interface':_[_0x4d4f('0x78')](_0x1cca46[_0x589f37][_0x4d4f('0x71')])?util[_0x4d4f('0x79')](_0x4d4f('0x7a'),_0x1cca46[_0x589f37][_0x4d4f('0x36')]):_0x1cca46[_0x589f37]['interface'],'paused':_0x1cca46[_0x589f37][_0x4d4f('0x70')]||![],'penalty':_0x10c8f1[_0x4d4f('0x55')][_0x4d4f('0x75')]||0x0}));}}return BPromise[_0x4d4f('0x97')](_0xfa58f3);}})[_0x4d4f('0x29')](function(){return _0x8aeb1b;})[_0x4d4f('0x29')](respondWithResult(_0x30c5f3,null))[_0x4d4f('0x4f')](handleError(_0x30c5f3,null));};exports['removeAgents']=function(_0x2c9dd3,_0x161276,_0x1e7cca){return db[_0x4d4f('0x38')][_0x4d4f('0x53')]({'where':{'id':_0x2c9dd3[_0x4d4f('0x51')]['id']}})[_0x4d4f('0x29')](handleEntityNotFound(_0x161276,null))['then'](function(_0x16d328){if(_0x16d328){return _0x16d328['removeAgents'](_0x2c9dd3[_0x4d4f('0x3b')]['ids'])[_0x4d4f('0x29')](function(){if(_[_0x4d4f('0x98')](_0x2c9dd3[_0x4d4f('0x3b')][_0x4d4f('0x8f')])){for(var _0x167680=0x0;_0x167680<_0x2c9dd3['query']['ids'][_0x4d4f('0x40')];_0x167680+=0x1){socket[_0x4d4f('0x7b')](_0x4d4f('0x92'),{'UserId':Number(_0x2c9dd3[_0x4d4f('0x3b')][_0x4d4f('0x8f')][_0x167680]),'VoiceQueueId':Number(_0x2c9dd3[_0x4d4f('0x51')]['id'])});}}else{socket[_0x4d4f('0x7b')](_0x4d4f('0x92'),{'UserId':Number(_0x2c9dd3[_0x4d4f('0x3b')][_0x4d4f('0x8f')]),'VoiceQueueId':Number(_0x2c9dd3[_0x4d4f('0x51')]['id'])});}});}})[_0x4d4f('0x29')](function(_0x1bc15e){return db[_0x4d4f('0x77')]['destroy']({'where':{'VoiceQueueId':_0x2c9dd3[_0x4d4f('0x51')]['id'],'UserId':_0x2c9dd3[_0x4d4f('0x3b')][_0x4d4f('0x8f')]}})[_0x4d4f('0x29')](function(){return _0x1bc15e;});})[_0x4d4f('0x29')](respondWithStatusCode(_0x161276,null))['catch'](handleError(_0x161276,null));};exports[_0x4d4f('0x99')]=function(_0x4c24f5,_0x55dfc1,_0x10a8e2){var _0x16f456={};var _0x342b34={};var _0x55690b;var _0x5a4cad;return db[_0x4d4f('0x38')][_0x4d4f('0x64')]({'where':{'id':_0x4c24f5[_0x4d4f('0x51')]['id']}})[_0x4d4f('0x29')](handleEntityNotFound(_0x55dfc1,null))[_0x4d4f('0x29')](function(_0x18080b){if(_0x18080b){_0x55690b=_0x18080b;_0x342b34[_0x4d4f('0x3a')]=_[_0x4d4f('0x3c')](db[_0x4d4f('0x7e')][_0x4d4f('0x52')]);_0x342b34[_0x4d4f('0x3b')]=_['keys'](_0x4c24f5[_0x4d4f('0x3b')]);_0x342b34[_0x4d4f('0x45')]=_[_0x4d4f('0x3d')](_0x342b34[_0x4d4f('0x3a')],_0x342b34[_0x4d4f('0x3b')]);_0x16f456[_0x4d4f('0x3f')]=_[_0x4d4f('0x3d')](_0x342b34[_0x4d4f('0x3a')],qs[_0x4d4f('0x3e')](_0x4c24f5[_0x4d4f('0x3b')][_0x4d4f('0x3e')]));_0x16f456[_0x4d4f('0x3f')]=_0x16f456[_0x4d4f('0x3f')]['length']?_0x16f456['attributes']:_0x342b34[_0x4d4f('0x3a')];_0x16f456[_0x4d4f('0x43')]=qs[_0x4d4f('0x44')](_0x4c24f5['query'][_0x4d4f('0x44')]);_0x16f456[_0x4d4f('0x48')]=qs[_0x4d4f('0x45')](_[_0x4d4f('0x46')](_0x4c24f5[_0x4d4f('0x3b')],_0x342b34[_0x4d4f('0x45')]));if(_0x4c24f5['query'][_0x4d4f('0x2d')]){_0x16f456[_0x4d4f('0x48')]=_[_0x4d4f('0x47')](_0x16f456['where'],{'$or':_['map'](_0x16f456[_0x4d4f('0x3f')],function(_0xc55b35){var _0x5d1609={};_0x5d1609[_0xc55b35]={'$like':'%'+_0x4c24f5['query'][_0x4d4f('0x2d')]+'%'};return _0x5d1609;})});}_0x16f456=_[_0x4d4f('0x47')]({},_0x16f456,_0x4c24f5[_0x4d4f('0x49')]);return _0x55690b[_0x4d4f('0x99')](_0x16f456);}})[_0x4d4f('0x29')](function(_0x59d897){if(_0x59d897){_0x5a4cad=_0x59d897[_0x4d4f('0x40')];if(!_0x4c24f5['query'][_0x4d4f('0x41')]('nolimit')){_0x16f456['limit']=qs[_0x4d4f('0x25')](_0x4c24f5['query'][_0x4d4f('0x25')]);_0x16f456[_0x4d4f('0x24')]=qs[_0x4d4f('0x24')](_0x4c24f5[_0x4d4f('0x3b')][_0x4d4f('0x24')]);}return _0x55690b[_0x4d4f('0x99')](_0x16f456);}})[_0x4d4f('0x29')](function(_0xb57dcb){if(_0xb57dcb){return _0xb57dcb?{'count':_0x5a4cad,'rows':_0xb57dcb}:null;}})['then'](respondWithResult(_0x55dfc1,null))[_0x4d4f('0x4f')](handleError(_0x55dfc1,null));};exports['getMembers']=function(_0x1dad8e,_0x2f0996,_0x315eac){var _0x276f4f={};var _0x24298a={};var _0xfcb8b3;var _0x5004b1;return db['VoiceQueue'][_0x4d4f('0x64')]({'where':{'id':_0x1dad8e[_0x4d4f('0x51')]['id']}})[_0x4d4f('0x29')](handleEntityNotFound(_0x2f0996,null))[_0x4d4f('0x29')](function(_0x5890eb){if(_0x5890eb){_0xfcb8b3=_0x5890eb;_0x24298a[_0x4d4f('0x3a')]=_[_0x4d4f('0x3c')](db[_0x4d4f('0x77')]['rawAttributes']);_0x24298a['query']=_[_0x4d4f('0x3c')](_0x1dad8e[_0x4d4f('0x3b')]);_0x24298a[_0x4d4f('0x45')]=_[_0x4d4f('0x3d')](_0x24298a['model'],_0x24298a['query']);_0x276f4f[_0x4d4f('0x3f')]=_['intersection'](_0x24298a[_0x4d4f('0x3a')],qs[_0x4d4f('0x3e')](_0x1dad8e[_0x4d4f('0x3b')][_0x4d4f('0x3e')]));_0x276f4f[_0x4d4f('0x3f')]=_0x276f4f[_0x4d4f('0x3f')]['length']?_0x276f4f[_0x4d4f('0x3f')]:_0x24298a[_0x4d4f('0x3a')];_0x276f4f['order']=qs[_0x4d4f('0x44')](_0x1dad8e[_0x4d4f('0x3b')]['sort']);_0x276f4f[_0x4d4f('0x48')]=qs['filters'](_[_0x4d4f('0x46')](_0x1dad8e[_0x4d4f('0x3b')],_0x24298a['filters']));if(_0x1dad8e[_0x4d4f('0x3b')]['filter']){_0x276f4f[_0x4d4f('0x48')]=_[_0x4d4f('0x47')](_0x276f4f['where'],{'$or':_[_0x4d4f('0x2e')](_0x276f4f[_0x4d4f('0x3f')],function(_0x5b9176){var _0x5ea5f9={};_0x5ea5f9[_0x5b9176]={'$like':'%'+_0x1dad8e[_0x4d4f('0x3b')][_0x4d4f('0x2d')]+'%'};return _0x5ea5f9;})});}_0x276f4f=_[_0x4d4f('0x47')]({},_0x276f4f,_0x1dad8e['options']);return _0xfcb8b3[_0x4d4f('0x9a')](_0x276f4f);}})[_0x4d4f('0x29')](function(_0x42d912){if(_0x42d912){_0x5004b1=_0x42d912[_0x4d4f('0x40')];if(!_0x1dad8e['query'][_0x4d4f('0x41')](_0x4d4f('0x42'))){_0x276f4f[_0x4d4f('0x25')]=qs[_0x4d4f('0x25')](_0x1dad8e[_0x4d4f('0x3b')][_0x4d4f('0x25')]);_0x276f4f[_0x4d4f('0x24')]=qs[_0x4d4f('0x24')](_0x1dad8e['query'][_0x4d4f('0x24')]);}return _0xfcb8b3['getMembers'](_0x276f4f);}})['then'](function(_0x5afd09){return _0x5afd09?{'count':_0x5004b1,'rows':_0x5afd09}:null;})[_0x4d4f('0x29')](respondWithResult(_0x2f0996,null))[_0x4d4f('0x4f')](handleError(_0x2f0996,null));};exports[_0x4d4f('0x9b')]=function(_0x5a30f3,_0x54177d,_0x411e90){var _0x36f3e5={};var _0x1028ec={};var _0x56db21;var _0x519d9a;return db['VoiceQueue'][_0x4d4f('0x64')]({'where':{'id':_0x5a30f3['params']['id']}})[_0x4d4f('0x29')](handleEntityNotFound(_0x54177d,null))[_0x4d4f('0x29')](function(_0x344b1e){if(_0x344b1e){_0x56db21=_0x344b1e;_0x1028ec[_0x4d4f('0x3a')]=_[_0x4d4f('0x3c')](db['CmList'][_0x4d4f('0x52')]);_0x1028ec['query']=_[_0x4d4f('0x3c')](_0x5a30f3[_0x4d4f('0x3b')]);_0x1028ec[_0x4d4f('0x45')]=_[_0x4d4f('0x3d')](_0x1028ec[_0x4d4f('0x3a')],_0x1028ec[_0x4d4f('0x3b')]);_0x36f3e5['attributes']=_[_0x4d4f('0x3d')](_0x1028ec[_0x4d4f('0x3a')],qs[_0x4d4f('0x3e')](_0x5a30f3[_0x4d4f('0x3b')][_0x4d4f('0x3e')]));_0x36f3e5[_0x4d4f('0x3f')]=_0x36f3e5[_0x4d4f('0x3f')][_0x4d4f('0x40')]?_0x36f3e5['attributes']:_0x1028ec[_0x4d4f('0x3a')];_0x36f3e5[_0x4d4f('0x43')]=qs[_0x4d4f('0x44')](_0x5a30f3['query']['sort']);_0x36f3e5[_0x4d4f('0x48')]=qs[_0x4d4f('0x45')](_['pick'](_0x5a30f3[_0x4d4f('0x3b')],_0x1028ec[_0x4d4f('0x45')]));if(_0x5a30f3['query'][_0x4d4f('0x2d')]){_0x36f3e5[_0x4d4f('0x48')]=_[_0x4d4f('0x47')](_0x36f3e5[_0x4d4f('0x48')],{'$or':_[_0x4d4f('0x2e')](_0x36f3e5[_0x4d4f('0x3f')],function(_0x30369c){var _0x1e5b88={};_0x1e5b88[_0x30369c]={'$like':'%'+_0x5a30f3[_0x4d4f('0x3b')][_0x4d4f('0x2d')]+'%'};return _0x1e5b88;})});}_0x36f3e5=_[_0x4d4f('0x47')]({},_0x36f3e5,_0x5a30f3[_0x4d4f('0x49')]);return _0x56db21['getLists'](_0x36f3e5);}})['then'](function(_0x1e89b7){if(_0x1e89b7){_0x519d9a=_0x1e89b7[_0x4d4f('0x40')];if(!_0x5a30f3[_0x4d4f('0x3b')]['hasOwnProperty']('nolimit')){_0x36f3e5[_0x4d4f('0x25')]=qs[_0x4d4f('0x25')](_0x5a30f3['query'][_0x4d4f('0x25')]);_0x36f3e5['offset']=qs[_0x4d4f('0x24')](_0x5a30f3['query']['offset']);}return _0x56db21[_0x4d4f('0x9b')](_0x36f3e5);}})[_0x4d4f('0x29')](function(_0x4afaae){if(_0x4afaae){return _0x4afaae?{'count':_0x519d9a,'rows':_0x4afaae}:null;}})[_0x4d4f('0x29')](respondWithResult(_0x54177d,null))['catch'](handleError(_0x54177d,null));};exports['addLists']=function(_0x37bfeb,_0x5025ec,_0xb00206){var _0x28b085,_0x20b4d0;return db[_0x4d4f('0x38')][_0x4d4f('0x53')]({'where':{'id':_0x37bfeb[_0x4d4f('0x51')]['id']}})['then'](handleEntityNotFound(_0x5025ec,null))['then'](function(_0x45c419){if(_0x45c419){_0x20b4d0=_0x45c419;return _0x45c419['addLists'](_0x37bfeb['body'][_0x4d4f('0x8f')],_[_0x4d4f('0x5e')](_0x37bfeb[_0x4d4f('0x55')],[_0x4d4f('0x8f'),'id'])||{});}return null;})['spread'](function(_0x4974f2){var _0x257f34;_0x28b085=_0x4974f2||[];var _0x1b08ce=[];if(_0x4974f2){for(var _0x3d27e6=0x0;_0x3d27e6<_0x4974f2['length'];_0x3d27e6+=0x1){var _0x1e606a=_0x4974f2[_0x3d27e6]['get']({'plain':!![]});_0x20b4d0['dialCheckDuplicateType']=_0x37bfeb[_0x4d4f('0x55')][_0x4d4f('0x9c')]?_0x37bfeb[_0x4d4f('0x55')][_0x4d4f('0x9c')]:_0x20b4d0['dialCheckDuplicateType'];switch(_0x20b4d0[_0x4d4f('0x9c')]){case _0x4d4f('0x9d'):_0x257f34=squel[_0x4d4f('0x9e')]()[_0x4d4f('0x9f')]('cm_hopper')[_0x4d4f('0xa0')]([_0x4d4f('0xa1'),_0x4d4f('0xa2'),_0x4d4f('0xa3'),_0x4d4f('0xa4'),'VoiceQueueId','createdAt',_0x4d4f('0x5f')],squel[_0x4d4f('0x7f')]()[_0x4d4f('0x80')](_0x4d4f('0xa1'),'phone')[_0x4d4f('0x80')](_0x4d4f('0xa5'),'scheduledAt')[_0x4d4f('0x80')]('id','ContactId')[_0x4d4f('0x80')](_0x1e606a[_0x4d4f('0xa6')][_0x4d4f('0xa7')](),_0x4d4f('0xa4'))['field'](_0x37bfeb['params']['id']['toString'](),_0x4d4f('0x66'))['field'](_0x4d4f('0xa5'),'createdAt')[_0x4d4f('0x80')](_0x4d4f('0xa5'),_0x4d4f('0x5f'))[_0x4d4f('0x81')](_0x4d4f('0xa8'))['where'](_0x4d4f('0xa9'))[_0x4d4f('0x48')](_0x4d4f('0xaa'),_0x1e606a['CmListId'][_0x4d4f('0xa7')]())[_0x4d4f('0x48')](_0x4d4f('0xab'))[_0x4d4f('0x48')](_0x4d4f('0xac'),squel[_0x4d4f('0x7f')]()[_0x4d4f('0x80')](_0x4d4f('0xad'))[_0x4d4f('0x81')]('cm_hopper_final')[_0x4d4f('0x48')](_0x4d4f('0x86'),_0x37bfeb[_0x4d4f('0x51')]['id']['toString']()))['where'](_0x4d4f('0xac'),squel[_0x4d4f('0x7f')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x4d4f('0xae'))[_0x4d4f('0x48')](_0x4d4f('0x86'),_0x37bfeb[_0x4d4f('0x51')]['id'][_0x4d4f('0xa7')]())))[_0x4d4f('0xa7')]();break;case _0x4d4f('0xaf'):_0x257f34=squel[_0x4d4f('0x9e')]()['into'](_0x4d4f('0xae'))[_0x4d4f('0xa0')]([_0x4d4f('0xa1'),_0x4d4f('0xa2'),_0x4d4f('0xa3'),_0x4d4f('0xa4'),_0x4d4f('0x66'),'createdAt',_0x4d4f('0x5f')],squel['select']()[_0x4d4f('0x80')]('phone',_0x4d4f('0xa1'))[_0x4d4f('0x80')](_0x4d4f('0xa5'),'scheduledAt')[_0x4d4f('0x80')]('id',_0x4d4f('0xa3'))['field'](_0x1e606a[_0x4d4f('0xa6')][_0x4d4f('0xa7')](),_0x4d4f('0xa4'))[_0x4d4f('0x80')](_0x37bfeb['params']['id']['toString'](),'VoiceQueueId')['field'](_0x4d4f('0xa5'),'createdAt')[_0x4d4f('0x80')](_0x4d4f('0xa5'),_0x4d4f('0x5f'))[_0x4d4f('0x81')](_0x4d4f('0xa8'))[_0x4d4f('0x48')]('deletedAt\x20IS\x20NULL')[_0x4d4f('0x48')](_0x4d4f('0xaa'),_0x1e606a[_0x4d4f('0xa6')][_0x4d4f('0xa7')]())['where'](_0x4d4f('0xab'))[_0x4d4f('0x48')](_0x4d4f('0xac'),squel[_0x4d4f('0x7f')]()[_0x4d4f('0x80')](_0x4d4f('0xb0'))['from'](_0x4d4f('0xae'))[_0x4d4f('0x48')](_0x4d4f('0x86'),_0x37bfeb[_0x4d4f('0x51')]['id'][_0x4d4f('0xa7')]())))[_0x4d4f('0xa7')]();break;default:_0x257f34=squel[_0x4d4f('0x9e')]()[_0x4d4f('0x9f')](_0x4d4f('0xae'))[_0x4d4f('0xa0')]([_0x4d4f('0xa1'),_0x4d4f('0xa2'),_0x4d4f('0xa3'),_0x4d4f('0xa4'),'VoiceQueueId',_0x4d4f('0xb1'),_0x4d4f('0x5f')],squel[_0x4d4f('0x7f')]()[_0x4d4f('0x80')](_0x4d4f('0xa1'),_0x4d4f('0xa1'))[_0x4d4f('0x80')](_0x4d4f('0xa5'),_0x4d4f('0xa2'))['field']('id',_0x4d4f('0xa3'))['field'](_0x1e606a[_0x4d4f('0xa6')]['toString'](),_0x4d4f('0xa4'))['field'](_0x37bfeb[_0x4d4f('0x51')]['id'][_0x4d4f('0xa7')](),_0x4d4f('0x66'))[_0x4d4f('0x80')](_0x4d4f('0xa5'),_0x4d4f('0xb1'))['field'](_0x4d4f('0xa5'),'updatedAt')[_0x4d4f('0x81')]('cm_contacts')['where'](_0x4d4f('0xa9'))[_0x4d4f('0x48')]('ListId\x20=\x20?',_0x1e606a[_0x4d4f('0xa6')][_0x4d4f('0xa7')]())[_0x4d4f('0x48')](_0x4d4f('0xab')))[_0x4d4f('0xa7')]();}_0x1b08ce['push'](db['sequelize'][_0x4d4f('0x3b')](_0x257f34));}return BPromise[_0x4d4f('0x97')](_0x1b08ce);}})[_0x4d4f('0x29')](function(){return _0x28b085;})['then'](respondWithResult(_0x5025ec,null))[_0x4d4f('0x4f')](handleError(_0x5025ec,null));};exports[_0x4d4f('0xb2')]=function(_0x22a595,_0x2e099c,_0x9f77d7){return db[_0x4d4f('0x38')][_0x4d4f('0x53')]({'where':{'id':_0x22a595[_0x4d4f('0x51')]['id']}})[_0x4d4f('0x29')](handleEntityNotFound(_0x2e099c,null))['then'](function(_0x3c34c0){if(_0x3c34c0){return _0x3c34c0[_0x4d4f('0xb2')](_0x22a595['query']['ids']);}})[_0x4d4f('0x29')](function(_0x1a2044){if(_0x1a2044){return db[_0x4d4f('0x65')][_0x4d4f('0x33')]({'where':{'ListId':_0x22a595[_0x4d4f('0x3b')][_0x4d4f('0x8f')],'VoiceQueueId':_0x22a595['params']['id']}})[_0x4d4f('0x29')](function(){return _0x1a2044;});}})[_0x4d4f('0x29')](respondWithStatusCode(_0x2e099c,null))[_0x4d4f('0x4f')](handleError(_0x2e099c,null));};exports['getBlackLists']=function(_0x330053,_0x1a846e,_0x4ee3ea){var _0x25573a={};var _0x5255c2={};var _0x55a374;var _0x5c9980;return db['VoiceQueue'][_0x4d4f('0x64')]({'where':{'id':_0x330053['params']['id']}})['then'](handleEntityNotFound(_0x1a846e,null))[_0x4d4f('0x29')](function(_0x43b57d){if(_0x43b57d){_0x55a374=_0x43b57d;_0x5255c2['model']=_['keys'](db[_0x4d4f('0xb3')][_0x4d4f('0x52')]);_0x5255c2[_0x4d4f('0x3b')]=_[_0x4d4f('0x3c')](_0x330053[_0x4d4f('0x3b')]);_0x5255c2[_0x4d4f('0x45')]=_['intersection'](_0x5255c2[_0x4d4f('0x3a')],_0x5255c2[_0x4d4f('0x3b')]);_0x25573a[_0x4d4f('0x3f')]=_['intersection'](_0x5255c2['model'],qs['fields'](_0x330053[_0x4d4f('0x3b')][_0x4d4f('0x3e')]));_0x25573a['attributes']=_0x25573a['attributes']['length']?_0x25573a[_0x4d4f('0x3f')]:_0x5255c2['model'];_0x25573a['order']=qs[_0x4d4f('0x44')](_0x330053[_0x4d4f('0x3b')]['sort']);_0x25573a['where']=qs[_0x4d4f('0x45')](_['pick'](_0x330053['query'],_0x5255c2[_0x4d4f('0x45')]));if(_0x330053['query'][_0x4d4f('0x2d')]){_0x25573a['where']=_[_0x4d4f('0x47')](_0x25573a['where'],{'$or':_[_0x4d4f('0x2e')](_0x25573a[_0x4d4f('0x3f')],function(_0x20303d){var _0x9b39d0={};_0x9b39d0[_0x20303d]={'$like':'%'+_0x330053['query']['filter']+'%'};return _0x9b39d0;})});}_0x25573a=_[_0x4d4f('0x47')]({},_0x25573a,_0x330053[_0x4d4f('0x49')]);return _0x55a374[_0x4d4f('0xb4')](_0x25573a);}})[_0x4d4f('0x29')](function(_0x286a3f){if(_0x286a3f){_0x5c9980=_0x286a3f[_0x4d4f('0x40')];if(!_0x330053[_0x4d4f('0x3b')]['hasOwnProperty'](_0x4d4f('0x42'))){_0x25573a[_0x4d4f('0x25')]=qs[_0x4d4f('0x25')](_0x330053[_0x4d4f('0x3b')][_0x4d4f('0x25')]);_0x25573a[_0x4d4f('0x24')]=qs[_0x4d4f('0x24')](_0x330053[_0x4d4f('0x3b')][_0x4d4f('0x24')]);}return _0x55a374[_0x4d4f('0xb4')](_0x25573a);}})[_0x4d4f('0x29')](function(_0x123dc6){if(_0x123dc6){return _0x123dc6?{'count':_0x5c9980,'rows':_0x123dc6}:null;}})[_0x4d4f('0x29')](respondWithResult(_0x1a846e,null))[_0x4d4f('0x4f')](handleError(_0x1a846e,null));};exports[_0x4d4f('0xb5')]=function(_0x4d50c0,_0x5069d1,_0x41d174){var _0x2d7626,_0x1b5e0d;return db[_0x4d4f('0x38')][_0x4d4f('0x53')]({'where':{'id':_0x4d50c0[_0x4d4f('0x51')]['id']}})['then'](handleEntityNotFound(_0x5069d1,null))[_0x4d4f('0x29')](function(_0x50460f){if(_0x50460f){_0x1b5e0d=_0x50460f;return _0x50460f[_0x4d4f('0xb5')](_0x4d50c0[_0x4d4f('0x55')][_0x4d4f('0x8f')],_['omit'](_0x4d50c0[_0x4d4f('0x55')],[_0x4d4f('0x8f'),'id'])||{});}return null;})['spread'](function(_0x333b3e){var _0x31dfff;_0x2d7626=_0x333b3e||[];var _0x7231c0=[];if(_0x333b3e){for(var _0x1f7fd4=0x0;_0x1f7fd4<_0x333b3e[_0x4d4f('0x40')];_0x1f7fd4+=0x1){var _0x47e90a=_0x333b3e[_0x1f7fd4][_0x4d4f('0x2a')]({'plain':!![]});_0x31dfff=squel[_0x4d4f('0x9e')]()[_0x4d4f('0x9f')]('cm_hopper_black')[_0x4d4f('0xa0')]([_0x4d4f('0xa1'),_0x4d4f('0xa3'),_0x4d4f('0xa4'),_0x4d4f('0x66'),_0x4d4f('0xb1'),_0x4d4f('0x5f')],squel[_0x4d4f('0x7f')]()['field'](_0x4d4f('0xa1'),_0x4d4f('0xa1'))[_0x4d4f('0x80')]('id','ContactId')[_0x4d4f('0x80')](_0x47e90a[_0x4d4f('0xa6')][_0x4d4f('0xa7')](),_0x4d4f('0xa4'))[_0x4d4f('0x80')](_0x4d50c0[_0x4d4f('0x51')]['id'][_0x4d4f('0xa7')](),_0x4d4f('0x66'))[_0x4d4f('0x80')]('NOW()',_0x4d4f('0xb1'))[_0x4d4f('0x80')](_0x4d4f('0xa5'),'updatedAt')[_0x4d4f('0x81')](_0x4d4f('0xa8'))[_0x4d4f('0x48')](_0x4d4f('0xa9'))[_0x4d4f('0x48')](_0x4d4f('0xaa'),_0x47e90a[_0x4d4f('0xa6')][_0x4d4f('0xa7')]())[_0x4d4f('0x48')](_0x4d4f('0xab')))['toString']();_0x7231c0[_0x4d4f('0x88')](db[_0x4d4f('0x89')][_0x4d4f('0x3b')](_0x31dfff));}return BPromise['all'](_0x7231c0);}})[_0x4d4f('0x29')](function(){return _0x2d7626;})[_0x4d4f('0x29')](respondWithResult(_0x5069d1,null))['catch'](handleError(_0x5069d1,null));};exports['removeBlackLists']=function(_0xd1b2cb,_0x499ff8,_0x3099a0){return db[_0x4d4f('0x38')][_0x4d4f('0x53')]({'where':{'id':_0xd1b2cb['params']['id']}})[_0x4d4f('0x29')](handleEntityNotFound(_0x499ff8,null))[_0x4d4f('0x29')](function(_0xa54bd1){if(_0xa54bd1){return _0xa54bd1[_0x4d4f('0xb6')](_0xd1b2cb[_0x4d4f('0x3b')][_0x4d4f('0x8f')]);}})[_0x4d4f('0x29')](function(_0x49ac86){if(_0x49ac86){return db['CmHopperBlack'][_0x4d4f('0x33')]({'where':{'ListId':_0xd1b2cb[_0x4d4f('0x3b')][_0x4d4f('0x8f')],'VoiceQueueId':_0xd1b2cb['params']['id']}})[_0x4d4f('0x29')](function(){return _0x49ac86;});}})[_0x4d4f('0x29')](respondWithStatusCode(_0x499ff8,null))[_0x4d4f('0x4f')](handleError(_0x499ff8,null));}; \ No newline at end of file +var _0x50c1=['transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','forEach','emit','removeTeams','ids','User','field','tq.TeamId','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','select','CmListId','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','VoiceQueueId\x20=\x20?','onlyIfOpen','cm_hopper','ListId','NOW()','ListId\x20=\x20?','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','limit','apply','reject','save','destroy','then','VoiceQueues','QueueCampaigns','outbound','filter','ignore','value','includes','type','error','stack','send','index','map','VoiceQueue','key','model','name','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','find','UserProfileSection','autoAssociation','clone','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','pick','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','Agents','online','interface','flatMap','penalty','sequelize'];(function(_0x350fe1,_0x53971c){var _0x8b53d6=function(_0x5c05df){while(--_0x5c05df){_0x350fe1['push'](_0x350fe1['shift']());}};_0x8b53d6(++_0x53971c);}(_0x50c1,0x1b6));var _0x150c=function(_0x3bf533,_0x298026){_0x3bf533=_0x3bf533-0x0;var _0x527209=_0x50c1[_0x3bf533];return _0x527209;};'use strict';var pdf=require(_0x150c('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x150c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x150c('0x2'));var rp=require(_0x150c('0x3'));var moment=require('moment');var BPromise=require(_0x150c('0x4'));var Mustache=require(_0x150c('0x5'));var util=require(_0x150c('0x6'));var path=require(_0x150c('0x7'));var sox=require('sox');var csv=require(_0x150c('0x8'));var ejs=require(_0x150c('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x150c('0xa'));var crypto=require(_0x150c('0xb'));var jsforce=require(_0x150c('0xc'));var deskjs=require(_0x150c('0xd'));var toCsv=require('to-csv');var querystring=require(_0x150c('0xe'));var Papa=require(_0x150c('0xf'));var Redis=require(_0x150c('0x10'));var authService=require(_0x150c('0x11'));var qs=require(_0x150c('0x12'));var as=require(_0x150c('0x13'));var hardwareService=require(_0x150c('0x14'));var logger=require('../../config/logger')(_0x150c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x150c('0x16'))['db'];config[_0x150c('0x17')]=_[_0x150c('0x18')](config[_0x150c('0x17')],{'host':_0x150c('0x19'),'port':0x18eb});var socket=require(_0x150c('0x1a'))(new Redis(config[_0x150c('0x17')]));require(_0x150c('0x1b'))[_0x150c('0x1c')](socket);function respondWithStatusCode(_0x50c0a7,_0x5d6950){_0x5d6950=_0x5d6950||0xcc;return function(_0x5412ca){if(_0x5412ca){return _0x50c0a7[_0x150c('0x1d')](_0x5d6950);}return _0x50c0a7[_0x150c('0x1e')](_0x5d6950)[_0x150c('0x1f')]();};}function respondWithResult(_0x168e47,_0x2add86){_0x2add86=_0x2add86||0xc8;return function(_0x11ff13){if(_0x11ff13){return _0x168e47['status'](_0x2add86)[_0x150c('0x20')](_0x11ff13);}};}function respondWithFilteredResult(_0x2de72f,_0x4daf79){return function(_0x46c10e){if(_0x46c10e){var _0x1b629e=_0x46c10e['count'],_0x5bc046=_0x4daf79[_0x150c('0x21')],_0x11ca58=_0x4daf79['offset']+_0x4daf79[_0x150c('0x22')],_0x460221;if(_0x11ca58>=_0x1b629e){_0x11ca58=_0x1b629e;_0x460221=0xc8;}else{_0x460221=0xce;}_0x2de72f['status'](_0x460221);return _0x2de72f['set']('Content-Range',_0x5bc046+'-'+_0x11ca58+'/'+_0x1b629e)[_0x150c('0x20')](_0x46c10e);}return null;};}function patchUpdates(_0x2d4e47){return function(_0x256f7c){try{jsonpatch[_0x150c('0x23')](_0x256f7c,_0x2d4e47,!![]);}catch(_0x1fd1e7){return BPromise[_0x150c('0x24')](_0x1fd1e7);}return _0x256f7c[_0x150c('0x25')]();};}function saveUpdates(_0x3eff82,_0x8b1177){return function(_0xce2eca){if(_0xce2eca){return _0xce2eca['update'](_0x3eff82)['then'](function(_0x1b0c6c){return _0x1b0c6c;});}return null;};}function removeEntity(_0x3afccf,_0x4061c5){return function(_0x25e31c){if(_0x25e31c){return _0x25e31c[_0x150c('0x26')]()[_0x150c('0x27')](function(){var _0x2749ff=_0x25e31c['get']({'plain':!![]});var _0x92d995=[{'name':_0x150c('0x28'),'value':'inbound','ignore':![]},{'name':_0x150c('0x29'),'value':_0x150c('0x2a'),'ignore':![]}];var _0x42ecb1=_(_0x92d995)[_0x150c('0x2b')](_0x150c('0x2c'))['map'](_0x150c('0x2d'))[_0x150c('0x2d')]();if(_[_0x150c('0x2e')](_0x42ecb1,_0x2749ff['type'])){return;}var _0x12363e=_['find'](_0x92d995,['value',_0x2749ff[_0x150c('0x2f')]])['name'];return db['UserProfileResource'][_0x150c('0x26')]({'where':{'type':_0x12363e,'resourceId':_0x2749ff['id']}})[_0x150c('0x27')](function(){return _0x25e31c;});})[_0x150c('0x27')](function(){_0x3afccf[_0x150c('0x1e')](0xcc)[_0x150c('0x1f')]();});}};}function handleEntityNotFound(_0x2e3cc4,_0x2c894d){return function(_0x145a98){if(!_0x145a98){_0x2e3cc4['sendStatus'](0x194);}return _0x145a98;};}function handleError(_0x3d23df,_0x1daea7){_0x1daea7=_0x1daea7||0x1f4;return function(_0x5d53ab){logger[_0x150c('0x30')](_0x5d53ab[_0x150c('0x31')]);if(_0x5d53ab['name']){delete _0x5d53ab['name'];}_0x3d23df[_0x150c('0x1e')](_0x1daea7)[_0x150c('0x32')](_0x5d53ab);};}exports[_0x150c('0x33')]=function(_0x9a4e96,_0x1dc2f0){var _0x14db67={},_0x58d4fb={},_0x21a0cf={'count':0x0,'rows':[]};var _0x387fde=_[_0x150c('0x34')](db[_0x150c('0x35')]['rawAttributes'],function(_0x2258ca){return{'name':_0x2258ca['fieldName'],'type':_0x2258ca[_0x150c('0x2f')][_0x150c('0x36')]};});_0x58d4fb[_0x150c('0x37')]=_['map'](_0x387fde,_0x150c('0x38'));_0x58d4fb[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x9a4e96[_0x150c('0x39')]);_0x58d4fb[_0x150c('0x3b')]=_[_0x150c('0x3c')](_0x58d4fb[_0x150c('0x37')],_0x58d4fb['query']);_0x14db67[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x58d4fb[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x9a4e96['query'][_0x150c('0x3e')]));_0x14db67[_0x150c('0x3d')]=_0x14db67[_0x150c('0x3d')][_0x150c('0x3f')]?_0x14db67[_0x150c('0x3d')]:_0x58d4fb['model'];if(!_0x9a4e96[_0x150c('0x39')]['hasOwnProperty']('nolimit')){_0x14db67[_0x150c('0x22')]=qs[_0x150c('0x22')](_0x9a4e96[_0x150c('0x39')]['limit']);_0x14db67[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x9a4e96[_0x150c('0x39')][_0x150c('0x21')]);}_0x14db67[_0x150c('0x40')]=qs[_0x150c('0x41')](_0x9a4e96[_0x150c('0x39')][_0x150c('0x41')]);_0x14db67[_0x150c('0x42')]=qs['filters'](_['pick'](_0x9a4e96[_0x150c('0x39')],_0x58d4fb[_0x150c('0x3b')]));if(_0x9a4e96[_0x150c('0x39')]['filter']){_0x14db67[_0x150c('0x42')]=_[_0x150c('0x43')](_0x14db67[_0x150c('0x42')],{'$or':_[_0x150c('0x34')](_0x387fde,function(_0x4d38f4){if(_0x4d38f4[_0x150c('0x2f')]!=='VIRTUAL'){var _0x4b5d21={};_0x4b5d21[_0x4d38f4[_0x150c('0x38')]]={'$like':'%'+_0x9a4e96[_0x150c('0x39')]['filter']+'%'};return _0x4b5d21;}})});}_0x14db67=_[_0x150c('0x43')]({},_0x14db67,_0x9a4e96[_0x150c('0x44')]);var _0x31c3ed={'where':_0x14db67[_0x150c('0x42')]};return db['VoiceQueue'][_0x150c('0x45')](_0x31c3ed)[_0x150c('0x27')](function(_0x418e35){_0x21a0cf[_0x150c('0x45')]=_0x418e35;if(_0x9a4e96[_0x150c('0x39')][_0x150c('0x46')]){_0x14db67[_0x150c('0x47')]=[{'all':!![]}];}return db['VoiceQueue'][_0x150c('0x48')](_0x14db67);})[_0x150c('0x27')](function(_0x47d8fd){_0x21a0cf[_0x150c('0x49')]=_0x47d8fd;return _0x21a0cf;})['then'](respondWithFilteredResult(_0x1dc2f0,_0x14db67))[_0x150c('0x4a')](handleError(_0x1dc2f0,null));};exports[_0x150c('0x4b')]=function(_0x1b7ff7,_0x1a4423){var _0x26b5a1={'raw':![],'where':{'id':_0x1b7ff7[_0x150c('0x4c')]['id']}},_0x5512ac={};_0x5512ac[_0x150c('0x37')]=_[_0x150c('0x3a')](db[_0x150c('0x35')][_0x150c('0x4d')]);_0x5512ac[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x1b7ff7[_0x150c('0x39')]);_0x5512ac['filters']=_['intersection'](_0x5512ac[_0x150c('0x37')],_0x5512ac[_0x150c('0x39')]);_0x26b5a1[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x5512ac[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x1b7ff7[_0x150c('0x39')]['fields']));_0x26b5a1[_0x150c('0x3d')]=_0x26b5a1[_0x150c('0x3d')][_0x150c('0x3f')]?_0x26b5a1[_0x150c('0x3d')]:_0x5512ac[_0x150c('0x37')];if(_0x1b7ff7['query'][_0x150c('0x46')]){_0x26b5a1['include']=[{'all':!![]}];}_0x26b5a1=_['merge']({},_0x26b5a1,_0x1b7ff7[_0x150c('0x44')]);return db[_0x150c('0x35')]['find'](_0x26b5a1)[_0x150c('0x27')](handleEntityNotFound(_0x1a4423,null))[_0x150c('0x27')](respondWithResult(_0x1a4423,null))[_0x150c('0x4a')](handleError(_0x1a4423,null));};exports['create']=function(_0x295157,_0x4b8b14){return db[_0x150c('0x35')][_0x150c('0x4e')](_0x295157[_0x150c('0x4f')],{})['then'](function(_0x344e81){var _0x46146d=_0x295157['user'][_0x150c('0x50')]({'plain':!![]});if(!_0x46146d)throw new Error(_0x150c('0x51'));if(_0x46146d[_0x150c('0x52')]===_0x150c('0x53')){var _0x5277fc=_0x344e81[_0x150c('0x50')]({'plain':!![]});var _0x338718=[{'name':_0x150c('0x28'),'value':_0x150c('0x54')},{'name':_0x150c('0x29'),'value':_0x150c('0x2a')}];var _0x3ab371=_[_0x150c('0x55')](_0x338718,['value',_0x5277fc[_0x150c('0x2f')]])[_0x150c('0x38')];return db[_0x150c('0x56')]['find']({'where':{'name':_0x3ab371,'userProfileId':_0x46146d['userProfileId']},'raw':!![]})[_0x150c('0x27')](function(_0x3499f6){if(_0x3499f6&&_0x3499f6[_0x150c('0x57')]===0x0){return db['UserProfileResource'][_0x150c('0x4e')]({'name':_0x5277fc[_0x150c('0x38')],'resourceId':_0x5277fc['id'],'type':_0x3499f6['name'],'sectionId':_0x3499f6['id']},{})[_0x150c('0x27')](function(){return _0x344e81;});}else{return _0x344e81;}})[_0x150c('0x4a')](function(_0x2c706a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c706a);throw _0x2c706a;});}return _0x344e81;})[_0x150c('0x27')](respondWithResult(_0x4b8b14,0xc9))[_0x150c('0x4a')](handleError(_0x4b8b14,null));};exports[_0x150c('0x58')]=function(_0x3b327d,_0x2ecfb1){var _0x2b7d36={'where':{'id':_0x3b327d['params']['id']}},_0x2997dd={};_0x2997dd[_0x150c('0x37')]=_[_0x150c('0x3a')](db[_0x150c('0x35')]['rawAttributes']);_0x2b7d36[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x2997dd[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x3b327d[_0x150c('0x39')]['fields']));_0x2b7d36[_0x150c('0x3d')]=_0x2b7d36['attributes'][_0x150c('0x3f')]?_0x2b7d36['attributes']:_0x2997dd[_0x150c('0x37')];if(_0x3b327d[_0x150c('0x39')][_0x150c('0x46')]){_0x2b7d36[_0x150c('0x47')]=[{'all':!![]}];}_0x2b7d36=_[_0x150c('0x43')]({},_0x2b7d36,_0x3b327d['options']);return db[_0x150c('0x35')][_0x150c('0x55')](_0x2b7d36)['then'](handleEntityNotFound(_0x2ecfb1,null))[_0x150c('0x27')](function(_0x255223){if(_0x255223){var _0x555797=_0x255223[_0x150c('0x50')]({'plain':!![]});_0x555797=qs[_0x150c('0x59')](_0x555797,['id',_0x150c('0x5a'),_0x150c('0x5b')]);_0x3b327d[_0x150c('0x4f')]=_[_0x150c('0x59')](_0x3b327d[_0x150c('0x4f')],['id','createdAt',_0x150c('0x5b')]);return db[_0x150c('0x35')]['create'](_[_0x150c('0x43')](_0x555797,_0x3b327d[_0x150c('0x4f')]),{'include':_0x3b327d['query'][_0x150c('0x46')]?[{'all':!![]}]:undefined})[_0x150c('0x27')](function(_0x4c16f3){var _0x29f779=_0x3b327d[_0x150c('0x53')][_0x150c('0x50')]({'plain':!![]});if(!_0x29f779)throw new Error(_0x150c('0x51'));if(_0x29f779[_0x150c('0x52')]===_0x150c('0x53')){var _0x469525=_0x4c16f3[_0x150c('0x50')]({'plain':!![]});var _0x42db0f=[{'name':_0x150c('0x28'),'value':_0x150c('0x54')},{'name':_0x150c('0x29'),'value':_0x150c('0x2a')}];var _0x1a2f97=_[_0x150c('0x55')](_0x42db0f,[_0x150c('0x2d'),_0x469525[_0x150c('0x2f')]])[_0x150c('0x38')];return db[_0x150c('0x56')][_0x150c('0x55')]({'where':{'name':_0x1a2f97,'userProfileId':_0x29f779[_0x150c('0x5c')]},'raw':!![]})[_0x150c('0x27')](function(_0x18587a){if(_0x18587a&&_0x18587a['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x469525['name'],'resourceId':_0x469525['id'],'type':_0x18587a[_0x150c('0x38')],'sectionId':_0x18587a['id']},{})[_0x150c('0x27')](function(){return _0x4c16f3;});}else{return _0x4c16f3;}})[_0x150c('0x4a')](function(_0x3ccdaa){logger[_0x150c('0x30')](_0x150c('0x5d'),_0x3ccdaa);throw _0x3ccdaa;});}return _0x4c16f3;});}})['then'](respondWithResult(_0x2ecfb1,0xc9))[_0x150c('0x4a')](handleError(_0x2ecfb1,null));};exports[_0x150c('0x5e')]=function(_0x1bcc60,_0x204227){if(_0x1bcc60['body']['id']){delete _0x1bcc60[_0x150c('0x4f')]['id'];}return db[_0x150c('0x35')][_0x150c('0x55')]({'where':{'id':_0x1bcc60[_0x150c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x204227,null))[_0x150c('0x27')](saveUpdates(_0x1bcc60[_0x150c('0x4f')],null))[_0x150c('0x27')](respondWithResult(_0x204227,null))[_0x150c('0x4a')](handleError(_0x204227,null));};exports['destroy']=function(_0x278f7d,_0x231002){return db[_0x150c('0x35')][_0x150c('0x55')]({'where':{'id':_0x278f7d['params']['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x231002,null))['then'](removeEntity(_0x231002,null))[_0x150c('0x4a')](handleError(_0x231002,null));};exports[_0x150c('0x5f')]=function(_0x5870d9,_0x1f23c7,_0xb85648){var _0x2c2648={'raw':![],'where':{}};var _0x190473={};var _0x137384={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x150c('0x60')]({'where':{'id':_0x5870d9[_0x150c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1f23c7,null))[_0x150c('0x27')](function(_0x1191ac){if(_0x1191ac){_0x190473[_0x150c('0x37')]=_['keys'](db[_0x150c('0x61')][_0x150c('0x4d')]);_0x190473['query']=_[_0x150c('0x3a')](_0x5870d9[_0x150c('0x39')]);_0x190473[_0x150c('0x3b')]=_[_0x150c('0x3c')](_0x190473[_0x150c('0x37')],_0x190473[_0x150c('0x39')]);_0x2c2648[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x190473[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x5870d9['query'][_0x150c('0x3e')]));_0x2c2648[_0x150c('0x3d')]=_0x2c2648[_0x150c('0x3d')][_0x150c('0x3f')]?_0x2c2648['attributes']:_0x190473[_0x150c('0x37')];if(!_0x5870d9['query'][_0x150c('0x62')](_0x150c('0x63'))){_0x2c2648['limit']=qs[_0x150c('0x22')](_0x5870d9[_0x150c('0x39')][_0x150c('0x22')]);_0x2c2648['offset']=qs['offset'](_0x5870d9[_0x150c('0x39')][_0x150c('0x21')]);}_0x2c2648[_0x150c('0x40')]=qs[_0x150c('0x41')](_0x5870d9[_0x150c('0x39')][_0x150c('0x41')]);_0x2c2648[_0x150c('0x42')]=qs[_0x150c('0x3b')](_[_0x150c('0x64')](_0x5870d9[_0x150c('0x39')],_0x190473['filters']));_0x2c2648[_0x150c('0x42')][_0x150c('0x65')]=_0x1191ac['id'];if(_0x5870d9['query']['filter']){_0x2c2648['where']=_[_0x150c('0x43')](_0x2c2648[_0x150c('0x42')],{'$or':_[_0x150c('0x34')](_0x2c2648[_0x150c('0x3d')],function(_0x361526){var _0x1eee21={};_0x1eee21[_0x361526]={'$like':'%'+_0x5870d9[_0x150c('0x39')][_0x150c('0x2b')]+'%'};return _0x1eee21;})});}_0x2c2648=_[_0x150c('0x43')]({},_0x2c2648,_0x5870d9[_0x150c('0x44')]);return db[_0x150c('0x61')][_0x150c('0x45')]({'where':_0x2c2648['where']})[_0x150c('0x27')](function(_0x21c319){_0x137384[_0x150c('0x45')]=_0x21c319;if(_0x5870d9[_0x150c('0x39')][_0x150c('0x46')]){_0x2c2648[_0x150c('0x47')]=[{'all':!![]}];}return db[_0x150c('0x61')][_0x150c('0x48')](_0x2c2648);})['then'](function(_0x455594){_0x137384[_0x150c('0x49')]=_0x455594;return _0x137384;});}})['then'](respondWithFilteredResult(_0x1f23c7,_0x2c2648))[_0x150c('0x4a')](handleError(_0x1f23c7,null));};exports[_0x150c('0x66')]=function(_0x1dc488,_0x2b096e,_0xfe5848){var _0x4ac962={'raw':!![],'where':{}};var _0x30d236={};var _0x1d5cb3={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1dc488[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x2b096e,null))[_0x150c('0x27')](function(_0x411d37){if(_0x411d37){_0x30d236['model']=_[_0x150c('0x3a')](db[_0x150c('0x67')][_0x150c('0x4d')]);_0x30d236[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x1dc488['query']);_0x30d236[_0x150c('0x3b')]=_['intersection'](_0x30d236['model'],_0x30d236['query']);_0x4ac962[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x30d236[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x1dc488[_0x150c('0x39')][_0x150c('0x3e')]));_0x4ac962[_0x150c('0x3d')]=_0x4ac962[_0x150c('0x3d')][_0x150c('0x3f')]?_0x4ac962[_0x150c('0x3d')]:_0x30d236[_0x150c('0x37')];if(!_0x1dc488[_0x150c('0x39')][_0x150c('0x62')](_0x150c('0x63'))){_0x4ac962[_0x150c('0x22')]=qs[_0x150c('0x22')](_0x1dc488[_0x150c('0x39')][_0x150c('0x22')]);_0x4ac962[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x1dc488['query']['offset']);}_0x4ac962[_0x150c('0x40')]=qs[_0x150c('0x41')](_0x1dc488[_0x150c('0x39')][_0x150c('0x41')]);_0x4ac962[_0x150c('0x42')]=qs[_0x150c('0x3b')](_['pick'](_0x1dc488[_0x150c('0x39')],_0x30d236['filters']));_0x4ac962['where'][_0x150c('0x65')]=_0x411d37['id'];if(_0x1dc488[_0x150c('0x39')]['filter']){_0x4ac962[_0x150c('0x42')]=_[_0x150c('0x43')](_0x4ac962[_0x150c('0x42')],{'$or':_['map'](_0x4ac962[_0x150c('0x3d')],function(_0x32c586){var _0x345f5d={};_0x345f5d[_0x32c586]={'$like':'%'+_0x1dc488['query']['filter']+'%'};return _0x345f5d;})});}_0x4ac962=_[_0x150c('0x43')]({},_0x4ac962,_0x1dc488['options']);return db[_0x150c('0x67')][_0x150c('0x45')]({'where':_0x4ac962['where']})[_0x150c('0x27')](function(_0x51f05c){_0x1d5cb3[_0x150c('0x45')]=_0x51f05c;if(_0x1dc488[_0x150c('0x39')][_0x150c('0x46')]){_0x4ac962[_0x150c('0x47')]=[{'all':!![]}];}return db[_0x150c('0x67')][_0x150c('0x48')](_0x4ac962);})[_0x150c('0x27')](function(_0x26d21a){_0x1d5cb3[_0x150c('0x49')]=_0x26d21a;return _0x1d5cb3;});}})[_0x150c('0x27')](respondWithFilteredResult(_0x2b096e,_0x4ac962))[_0x150c('0x4a')](handleError(_0x2b096e,null));};exports['getHopperFinals']=function(_0x3b4c12,_0x424cb2,_0x444f7e){var _0x3461ec={'raw':!![],'where':{}};var _0x1df31d={};var _0x3ef5af={'count':0x0,'rows':[]};return db[_0x150c('0x35')][_0x150c('0x60')]({'where':{'id':_0x3b4c12[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x424cb2,null))[_0x150c('0x27')](function(_0x11aa53){if(_0x11aa53){_0x1df31d['model']=_[_0x150c('0x3a')](db[_0x150c('0x68')][_0x150c('0x4d')]);_0x1df31d[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x3b4c12[_0x150c('0x39')]);_0x1df31d['filters']=_['intersection'](_0x1df31d['model'],_0x1df31d[_0x150c('0x39')]);_0x3461ec[_0x150c('0x3d')]=_['intersection'](_0x1df31d['model'],qs[_0x150c('0x3e')](_0x3b4c12[_0x150c('0x39')][_0x150c('0x3e')]));_0x3461ec[_0x150c('0x3d')]=_0x3461ec[_0x150c('0x3d')][_0x150c('0x3f')]?_0x3461ec[_0x150c('0x3d')]:_0x1df31d[_0x150c('0x37')];if(!_0x3b4c12[_0x150c('0x39')][_0x150c('0x62')]('nolimit')){_0x3461ec[_0x150c('0x22')]=qs[_0x150c('0x22')](_0x3b4c12[_0x150c('0x39')][_0x150c('0x22')]);_0x3461ec[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x3b4c12[_0x150c('0x39')][_0x150c('0x21')]);}_0x3461ec[_0x150c('0x40')]=qs['sort'](_0x3b4c12['query'][_0x150c('0x41')]);_0x3461ec['where']=qs[_0x150c('0x3b')](_[_0x150c('0x64')](_0x3b4c12['query'],_0x1df31d[_0x150c('0x3b')]));_0x3461ec[_0x150c('0x42')]['VoiceQueueId']=_0x11aa53['id'];if(_0x3b4c12[_0x150c('0x39')]['filter']){_0x3461ec[_0x150c('0x42')]=_['merge'](_0x3461ec[_0x150c('0x42')],{'$or':_[_0x150c('0x34')](_0x3461ec[_0x150c('0x3d')],function(_0x4e2719){var _0x3b63b0={};_0x3b63b0[_0x4e2719]={'$like':'%'+_0x3b4c12['query'][_0x150c('0x2b')]+'%'};return _0x3b63b0;})});}_0x3461ec=_[_0x150c('0x43')]({},_0x3461ec,_0x3b4c12[_0x150c('0x44')]);return db[_0x150c('0x68')]['count']({'where':_0x3461ec['where']})[_0x150c('0x27')](function(_0xb2b981){_0x3ef5af[_0x150c('0x45')]=_0xb2b981;if(_0x3b4c12['query']['includeAll']){_0x3461ec[_0x150c('0x47')]=[{'all':!![]}];}return db[_0x150c('0x68')][_0x150c('0x48')](_0x3461ec);})[_0x150c('0x27')](function(_0x4a8b7c){_0x3ef5af[_0x150c('0x49')]=_0x4a8b7c;return _0x3ef5af;});}})['then'](respondWithFilteredResult(_0x424cb2,_0x3461ec))[_0x150c('0x4a')](handleError(_0x424cb2,null));};exports[_0x150c('0x69')]=function(_0x40184e,_0x1ae031,_0x378e82){var _0x36a5b4={'raw':!![],'where':{}};var _0x470657={};var _0x28843c={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x150c('0x60')]({'where':{'id':_0x40184e[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x1ae031,null))[_0x150c('0x27')](function(_0x24230a){if(_0x24230a){_0x470657[_0x150c('0x37')]=_[_0x150c('0x3a')](db['CmHopperBlack'][_0x150c('0x4d')]);_0x470657[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x40184e[_0x150c('0x39')]);_0x470657['filters']=_[_0x150c('0x3c')](_0x470657[_0x150c('0x37')],_0x470657['query']);_0x36a5b4[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x470657[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x40184e[_0x150c('0x39')][_0x150c('0x3e')]));_0x36a5b4[_0x150c('0x3d')]=_0x36a5b4[_0x150c('0x3d')]['length']?_0x36a5b4['attributes']:_0x470657[_0x150c('0x37')];if(!_0x40184e['query'][_0x150c('0x62')](_0x150c('0x63'))){_0x36a5b4[_0x150c('0x22')]=qs['limit'](_0x40184e[_0x150c('0x39')][_0x150c('0x22')]);_0x36a5b4[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x40184e['query'][_0x150c('0x21')]);}_0x36a5b4['order']=qs['sort'](_0x40184e['query'][_0x150c('0x41')]);_0x36a5b4['where']=qs[_0x150c('0x3b')](_[_0x150c('0x64')](_0x40184e[_0x150c('0x39')],_0x470657[_0x150c('0x3b')]));_0x36a5b4['where']['VoiceQueueId']=_0x24230a['id'];if(_0x40184e[_0x150c('0x39')][_0x150c('0x2b')]){_0x36a5b4[_0x150c('0x42')]=_[_0x150c('0x43')](_0x36a5b4[_0x150c('0x42')],{'$or':_[_0x150c('0x34')](_0x36a5b4[_0x150c('0x3d')],function(_0xec8f21){var _0x26e7c3={};_0x26e7c3[_0xec8f21]={'$like':'%'+_0x40184e[_0x150c('0x39')][_0x150c('0x2b')]+'%'};return _0x26e7c3;})});}_0x36a5b4=_[_0x150c('0x43')]({},_0x36a5b4,_0x40184e['options']);return db[_0x150c('0x6a')]['count']({'where':_0x36a5b4[_0x150c('0x42')]})[_0x150c('0x27')](function(_0x1f4c2f){_0x28843c['count']=_0x1f4c2f;if(_0x40184e['query']['includeAll']){_0x36a5b4[_0x150c('0x47')]=[{'all':!![]}];}return db[_0x150c('0x6a')]['findAll'](_0x36a5b4);})[_0x150c('0x27')](function(_0x420f6e){_0x28843c[_0x150c('0x49')]=_0x420f6e;return _0x28843c;});}})[_0x150c('0x27')](respondWithFilteredResult(_0x1ae031,_0x36a5b4))[_0x150c('0x4a')](handleError(_0x1ae031,null));};exports[_0x150c('0x6b')]=function(_0x5e8b92,_0x530350,_0x1e3b2a){var _0x42d94d={};var _0x6358b3={};var _0x25ad49;var _0x3fdfe4;return db[_0x150c('0x35')][_0x150c('0x60')]({'where':{'id':_0x5e8b92['params']['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x530350,null))['then'](function(_0x14a8b2){if(_0x14a8b2){_0x25ad49=_0x14a8b2;_0x6358b3[_0x150c('0x37')]=_[_0x150c('0x3a')](db[_0x150c('0x6c')][_0x150c('0x4d')]);_0x6358b3['query']=_[_0x150c('0x3a')](_0x5e8b92[_0x150c('0x39')]);_0x6358b3['filters']=_[_0x150c('0x3c')](_0x6358b3[_0x150c('0x37')],_0x6358b3[_0x150c('0x39')]);_0x42d94d['attributes']=_[_0x150c('0x3c')](_0x6358b3[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x5e8b92[_0x150c('0x39')][_0x150c('0x3e')]));_0x42d94d[_0x150c('0x3d')]=_0x42d94d['attributes']['length']?_0x42d94d[_0x150c('0x3d')]:_0x6358b3[_0x150c('0x37')];_0x42d94d[_0x150c('0x40')]=qs[_0x150c('0x41')](_0x5e8b92[_0x150c('0x39')][_0x150c('0x41')]);_0x42d94d[_0x150c('0x42')]=qs[_0x150c('0x3b')](_['pick'](_0x5e8b92['query'],_0x6358b3[_0x150c('0x3b')]));if(_0x5e8b92[_0x150c('0x39')][_0x150c('0x2b')]){_0x42d94d[_0x150c('0x42')]=_[_0x150c('0x43')](_0x42d94d[_0x150c('0x42')],{'$or':_[_0x150c('0x34')](_0x42d94d[_0x150c('0x3d')],function(_0xa9278e){var _0x594cf0={};_0x594cf0[_0xa9278e]={'$like':'%'+_0x5e8b92[_0x150c('0x39')][_0x150c('0x2b')]+'%'};return _0x594cf0;})});}_0x42d94d=_['merge']({},_0x42d94d,_0x5e8b92[_0x150c('0x44')]);return _0x25ad49['getTeams'](_0x42d94d);}})[_0x150c('0x27')](function(_0x176c02){if(_0x176c02){_0x3fdfe4=_0x176c02[_0x150c('0x3f')];if(!_0x5e8b92['query'][_0x150c('0x62')](_0x150c('0x63'))){_0x42d94d['limit']=qs[_0x150c('0x22')](_0x5e8b92['query'][_0x150c('0x22')]);_0x42d94d[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x5e8b92[_0x150c('0x39')]['offset']);}return _0x25ad49[_0x150c('0x6b')](_0x42d94d);}})['then'](function(_0x3947e9){if(_0x3947e9){return _0x3947e9?{'count':_0x3fdfe4,'rows':_0x3947e9}:null;}})['then'](respondWithResult(_0x530350,null))[_0x150c('0x4a')](handleError(_0x530350,null));};exports[_0x150c('0x6d')]=function(_0x199110,_0xf0a68c,_0x4879a4){var _0x538dfb=_0x199110[_0x150c('0x4f')][_0x150c('0x6e')];var _0x3beb94=_[_0x150c('0x34')](_0x538dfb,'id');return db[_0x150c('0x6c')][_0x150c('0x48')]({'where':{'id':_0x3beb94},'attributes':['id'],'include':[{'model':db['User'],'as':_0x150c('0x6f'),'attributes':['id','name',_0x150c('0x70'),'voicePause',_0x150c('0x71')],'raw':!![]}]})['then'](function(_0x37eef6){if(_0x37eef6){var _0x237074=_[_0x150c('0x72')](_0x37eef6,function(_0x25ded7){var _0x4e086d=_0x25ded7[_0x150c('0x50')]({'plain':!![]});_0x4e086d[_0x150c('0x6f')]['forEach'](function(_0x254398){_0x254398[_0x150c('0x73')]=_[_0x150c('0x55')](_0x538dfb,{'id':_0x4e086d['id']})[_0x150c('0x73')];});return _0x4e086d[_0x150c('0x6f')];});return db[_0x150c('0x35')]['find']({'where':{'id':_0x199110[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](function(_0x268c4f){return db[_0x150c('0x74')][_0x150c('0x75')](function(_0x508988){return _0x268c4f[_0x150c('0x6d')](_0x3beb94,{'transaction':_0x508988})[_0x150c('0x27')](function(){return BPromise[_0x150c('0x76')](_0x237074,function(_0x1b4ef4){return db[_0x150c('0x77')][_0x150c('0x78')]({'where':{'UserId':_0x1b4ef4['id'],'VoiceQueueId':_0x199110[_0x150c('0x4c')]['id']},'defaults':{'penalty':_0x1b4ef4[_0x150c('0x73')]},'transaction':_0x508988});});})[_0x150c('0x27')](function(){return BPromise['each'](_[_0x150c('0x2b')](_0x237074,{'online':!![]}),function(_0x496aa5){return db[_0x150c('0x79')][_0x150c('0x7a')]({'membername':_0x496aa5[_0x150c('0x38')],'UserId':_0x496aa5['id'],'queue_name':_0x268c4f['name'],'VoiceQueueId':_0x268c4f['id'],'interface':_[_0x150c('0x7b')](_0x496aa5[_0x150c('0x71')])?util[_0x150c('0x7c')](_0x150c('0x7d'),_0x496aa5[_0x150c('0x38')]):_0x496aa5[_0x150c('0x71')],'paused':_0x496aa5[_0x150c('0x7e')]||![],'penalty':_0x496aa5[_0x150c('0x73')]},{'transaction':_0x508988});});})[_0x150c('0x27')](function(){_0x237074[_0x150c('0x7f')](function(_0x443e92){socket[_0x150c('0x80')]('userVoiceQueue:save',{'UserId':_0x443e92['id'],'VoiceQueueId':_0x268c4f['id']});});});});});}})[_0x150c('0x27')](respondWithStatusCode(_0xf0a68c,null))[_0x150c('0x4a')](handleError(_0xf0a68c,null));};exports[_0x150c('0x81')]=function(_0x41a736,_0x22f326,_0x1b1790){return db[_0x150c('0x6c')][_0x150c('0x48')]({'where':{'id':_0x41a736['query'][_0x150c('0x82')]},'attributes':['id'],'include':[{'model':db[_0x150c('0x83')],'as':_0x150c('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x22f326,null))[_0x150c('0x27')](function(_0x39854c){var _0x13b152=_[_0x150c('0x34')](_0x39854c,'id');var _0x168f82=[];var _0x6f2c0a=[];var _0x38d4bb=squel['select']();_0x38d4bb[_0x150c('0x84')](_0x150c('0x85'))['from'](_0x150c('0x86'),'tq')[_0x150c('0x87')]('user_has_teams','ut',_0x150c('0x88'))[_0x150c('0x42')]('VoiceQueueId\x20=\x20?',_0x41a736[_0x150c('0x4c')]['id']);for(var _0x192a5b=0x0;_0x192a5b<_0x39854c[_0x150c('0x3f')];_0x192a5b+=0x1){let _0x2d7d5c=_0x39854c[_0x192a5b];for(var _0x5d8568=0x0;_0x5d8568<_0x2d7d5c[_0x150c('0x6f')][_0x150c('0x3f')];_0x5d8568+=0x1){let _0x41b3ad=_0x2d7d5c[_0x150c('0x6f')][_0x5d8568];var _0x196c1c=_0x38d4bb[_0x150c('0x58')]();_0x196c1c[_0x150c('0x42')](_0x150c('0x89'),_0x41b3ad['id']);_0x6f2c0a[_0x150c('0x8a')](db[_0x150c('0x74')][_0x150c('0x39')](_0x196c1c[_0x150c('0x8b')](),{'type':db[_0x150c('0x74')]['QueryTypes'][_0x150c('0x8c')]})[_0x150c('0x27')](function(_0x2d6d6e){if(_0x2d6d6e[_0x150c('0x3f')]===0x1){return _0x41b3ad['id'];}else{var _0x187984=_[_0x150c('0x8d')](_[_0x150c('0x34')](_0x2d6d6e,_0x150c('0x8e')),function(_0x17b2bc){return _[_0x150c('0x2e')](_0x13b152,_0x17b2bc);});if(_0x187984){return _0x41b3ad['id'];}}}));}}return BPromise[_0x150c('0x8f')](_0x6f2c0a)['then'](function(_0xc25ac9){_0x168f82=_(_0x168f82)[_0x150c('0x90')](_0xc25ac9)[_0x150c('0x91')]()['value']();return db[_0x150c('0x35')][_0x150c('0x55')]({'where':{'id':_0x41a736[_0x150c('0x4c')]['id']}})['then'](function(_0x54a7c){return db[_0x150c('0x74')][_0x150c('0x75')](function(_0x24f88e){return _0x54a7c[_0x150c('0x81')](_0x41a736[_0x150c('0x39')][_0x150c('0x82')],{'transaction':_0x24f88e})[_0x150c('0x27')](function(){if(!_[_0x150c('0x92')](_0x168f82)){return _0x54a7c[_0x150c('0x93')](_0x168f82,{'transaction':_0x24f88e})[_0x150c('0x27')](function(){return db[_0x150c('0x79')][_0x150c('0x26')]({'where':{'VoiceQueueId':_0x41a736[_0x150c('0x4c')]['id'],'UserId':_0x168f82},'transaction':_0x24f88e});});}})[_0x150c('0x27')](function(){_0x168f82['forEach'](function(_0x3b1d60){socket[_0x150c('0x80')](_0x150c('0x94'),{'UserId':_0x3b1d60,'VoiceQueueId':_0x54a7c['id']});});});});});});})[_0x150c('0x27')](respondWithStatusCode(_0x22f326,null))[_0x150c('0x4a')](handleError(_0x22f326,null));};exports['addAgents']=function(_0x54afaf,_0x1c3350,_0x483384){var _0x4e50b1,_0x1db29d;return db['VoiceQueue'][_0x150c('0x55')]({'where':{'id':_0x54afaf[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x1c3350,null))[_0x150c('0x27')](function(_0x510a40){if(_0x510a40){_0x1db29d=_0x510a40;return _0x510a40['addAgents'](_0x54afaf['body'][_0x150c('0x82')],_['omit'](_0x54afaf[_0x150c('0x4f')],[_0x150c('0x82'),'id'])||{})[_0x150c('0x95')](function(_0x2252af){for(var _0x4ab8c1=0x0;_0x4ab8c1<_0x54afaf[_0x150c('0x4f')][_0x150c('0x82')]['length'];_0x4ab8c1+=0x1){socket[_0x150c('0x80')]('userVoiceQueue:save',{'UserId':_0x54afaf[_0x150c('0x4f')][_0x150c('0x82')][_0x4ab8c1],'VoiceQueueId':_0x54afaf[_0x150c('0x4c')]['id']});}return _0x2252af;});}})[_0x150c('0x27')](function(_0x1e15da){_0x4e50b1=_0x1e15da||[];if(_0x1db29d){return db['User'][_0x150c('0x48')]({'where':{'id':_0x54afaf[_0x150c('0x4f')][_0x150c('0x82')]},'attributes':['id',_0x150c('0x38'),'online',_0x150c('0x7e'),'interface'],'raw':!![]});}})[_0x150c('0x27')](function(_0x3c0b4a){if(!_[_0x150c('0x92')](_0x3c0b4a)){var _0x52b728=[];for(var _0x975401=0x0;_0x975401<_0x3c0b4a[_0x150c('0x3f')];_0x975401++){if(_0x3c0b4a[_0x975401][_0x150c('0x70')]){_0x52b728[_0x150c('0x8a')](db[_0x150c('0x79')][_0x150c('0x7a')]({'membername':_0x3c0b4a[_0x975401][_0x150c('0x38')],'UserId':_0x3c0b4a[_0x975401]['id'],'queue_name':_0x1db29d['name'],'VoiceQueueId':_0x1db29d['id'],'interface':_[_0x150c('0x7b')](_0x3c0b4a[_0x975401]['interface'])?util[_0x150c('0x7c')]('SIP/%s',_0x3c0b4a[_0x975401][_0x150c('0x38')]):_0x3c0b4a[_0x975401]['interface'],'paused':_0x3c0b4a[_0x975401][_0x150c('0x7e')]||![],'penalty':_0x54afaf[_0x150c('0x4f')][_0x150c('0x73')]||0x0}));}}return BPromise[_0x150c('0x8f')](_0x52b728);}})[_0x150c('0x27')](function(){return _0x4e50b1;})[_0x150c('0x27')](respondWithResult(_0x1c3350,null))['catch'](handleError(_0x1c3350,null));};exports[_0x150c('0x93')]=function(_0x552d50,_0x40ba4b,_0x468aaa){return db['VoiceQueue'][_0x150c('0x55')]({'where':{'id':_0x552d50['params']['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x40ba4b,null))[_0x150c('0x27')](function(_0x431e74){if(_0x431e74){return _0x431e74[_0x150c('0x93')](_0x552d50['query'][_0x150c('0x82')])[_0x150c('0x27')](function(){if(_[_0x150c('0x96')](_0x552d50['query'][_0x150c('0x82')])){for(var _0x1206fc=0x0;_0x1206fc<_0x552d50[_0x150c('0x39')][_0x150c('0x82')][_0x150c('0x3f')];_0x1206fc+=0x1){socket['emit'](_0x150c('0x94'),{'UserId':Number(_0x552d50['query']['ids'][_0x1206fc]),'VoiceQueueId':Number(_0x552d50[_0x150c('0x4c')]['id'])});}}else{socket['emit'](_0x150c('0x94'),{'UserId':Number(_0x552d50[_0x150c('0x39')][_0x150c('0x82')]),'VoiceQueueId':Number(_0x552d50[_0x150c('0x4c')]['id'])});}});}})['then'](function(_0x85097e){return db[_0x150c('0x79')]['destroy']({'where':{'VoiceQueueId':_0x552d50[_0x150c('0x4c')]['id'],'UserId':_0x552d50[_0x150c('0x39')][_0x150c('0x82')]}})[_0x150c('0x27')](function(){return _0x85097e;});})[_0x150c('0x27')](respondWithStatusCode(_0x40ba4b,null))[_0x150c('0x4a')](handleError(_0x40ba4b,null));};exports[_0x150c('0x97')]=function(_0x5ecc54,_0x3d9da3,_0x10ae6a){var _0x1eff87={};var _0x498f40={};var _0x4f4227;var _0xef4f7a;return db['VoiceQueue']['findOne']({'where':{'id':_0x5ecc54[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x3d9da3,null))[_0x150c('0x27')](function(_0x43c73c){if(_0x43c73c){_0x4f4227=_0x43c73c;_0x498f40[_0x150c('0x37')]=_[_0x150c('0x3a')](db[_0x150c('0x83')][_0x150c('0x4d')]);_0x498f40['query']=_['keys'](_0x5ecc54[_0x150c('0x39')]);_0x498f40[_0x150c('0x3b')]=_[_0x150c('0x3c')](_0x498f40[_0x150c('0x37')],_0x498f40[_0x150c('0x39')]);_0x1eff87['attributes']=_[_0x150c('0x3c')](_0x498f40[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x5ecc54[_0x150c('0x39')][_0x150c('0x3e')]));_0x1eff87[_0x150c('0x3d')]=_0x1eff87[_0x150c('0x3d')][_0x150c('0x3f')]?_0x1eff87[_0x150c('0x3d')]:_0x498f40[_0x150c('0x37')];_0x1eff87[_0x150c('0x40')]=qs['sort'](_0x5ecc54[_0x150c('0x39')]['sort']);_0x1eff87[_0x150c('0x42')]=qs[_0x150c('0x3b')](_[_0x150c('0x64')](_0x5ecc54[_0x150c('0x39')],_0x498f40[_0x150c('0x3b')]));if(_0x5ecc54[_0x150c('0x39')][_0x150c('0x2b')]){_0x1eff87[_0x150c('0x42')]=_['merge'](_0x1eff87['where'],{'$or':_['map'](_0x1eff87['attributes'],function(_0x255bbd){var _0x51ccd2={};_0x51ccd2[_0x255bbd]={'$like':'%'+_0x5ecc54[_0x150c('0x39')][_0x150c('0x2b')]+'%'};return _0x51ccd2;})});}_0x1eff87=_[_0x150c('0x43')]({},_0x1eff87,_0x5ecc54[_0x150c('0x44')]);return _0x4f4227['getAgents'](_0x1eff87);}})[_0x150c('0x27')](function(_0x473028){if(_0x473028){_0xef4f7a=_0x473028[_0x150c('0x3f')];if(!_0x5ecc54[_0x150c('0x39')][_0x150c('0x62')](_0x150c('0x63'))){_0x1eff87['limit']=qs[_0x150c('0x22')](_0x5ecc54[_0x150c('0x39')][_0x150c('0x22')]);_0x1eff87[_0x150c('0x21')]=qs['offset'](_0x5ecc54['query']['offset']);}return _0x4f4227[_0x150c('0x97')](_0x1eff87);}})[_0x150c('0x27')](function(_0x3158ff){if(_0x3158ff){return _0x3158ff?{'count':_0xef4f7a,'rows':_0x3158ff}:null;}})['then'](respondWithResult(_0x3d9da3,null))[_0x150c('0x4a')](handleError(_0x3d9da3,null));};exports[_0x150c('0x98')]=function(_0x298c97,_0xa25214,_0x258f95){var _0x184159={};var _0xeca351={};var _0x42eaf1;var _0x2d5377;return db[_0x150c('0x35')][_0x150c('0x60')]({'where':{'id':_0x298c97[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0xa25214,null))['then'](function(_0x53b489){if(_0x53b489){_0x42eaf1=_0x53b489;_0xeca351[_0x150c('0x37')]=_[_0x150c('0x3a')](db['UserVoiceQueueRt']['rawAttributes']);_0xeca351[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x298c97[_0x150c('0x39')]);_0xeca351[_0x150c('0x3b')]=_['intersection'](_0xeca351['model'],_0xeca351[_0x150c('0x39')]);_0x184159[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0xeca351[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x298c97[_0x150c('0x39')][_0x150c('0x3e')]));_0x184159[_0x150c('0x3d')]=_0x184159[_0x150c('0x3d')][_0x150c('0x3f')]?_0x184159['attributes']:_0xeca351[_0x150c('0x37')];_0x184159['order']=qs['sort'](_0x298c97[_0x150c('0x39')][_0x150c('0x41')]);_0x184159[_0x150c('0x42')]=qs[_0x150c('0x3b')](_['pick'](_0x298c97['query'],_0xeca351[_0x150c('0x3b')]));if(_0x298c97[_0x150c('0x39')][_0x150c('0x2b')]){_0x184159[_0x150c('0x42')]=_[_0x150c('0x43')](_0x184159['where'],{'$or':_[_0x150c('0x34')](_0x184159[_0x150c('0x3d')],function(_0x590cf8){var _0x40e39f={};_0x40e39f[_0x590cf8]={'$like':'%'+_0x298c97[_0x150c('0x39')][_0x150c('0x2b')]+'%'};return _0x40e39f;})});}_0x184159=_['merge']({},_0x184159,_0x298c97[_0x150c('0x44')]);return _0x42eaf1[_0x150c('0x98')](_0x184159);}})[_0x150c('0x27')](function(_0x5599ed){if(_0x5599ed){_0x2d5377=_0x5599ed[_0x150c('0x3f')];if(!_0x298c97[_0x150c('0x39')][_0x150c('0x62')]('nolimit')){_0x184159['limit']=qs[_0x150c('0x22')](_0x298c97[_0x150c('0x39')][_0x150c('0x22')]);_0x184159['offset']=qs[_0x150c('0x21')](_0x298c97[_0x150c('0x39')][_0x150c('0x21')]);}return _0x42eaf1[_0x150c('0x98')](_0x184159);}})[_0x150c('0x27')](function(_0x3d3961){return _0x3d3961?{'count':_0x2d5377,'rows':_0x3d3961}:null;})[_0x150c('0x27')](respondWithResult(_0xa25214,null))['catch'](handleError(_0xa25214,null));};exports[_0x150c('0x99')]=function(_0x4c14de,_0x18d8d2,_0x5bfc1e){var _0x2514de={};var _0x1dcb5d={};var _0x38c08b;var _0x15d981;return db[_0x150c('0x35')][_0x150c('0x60')]({'where':{'id':_0x4c14de[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x18d8d2,null))[_0x150c('0x27')](function(_0x253e68){if(_0x253e68){_0x38c08b=_0x253e68;_0x1dcb5d[_0x150c('0x37')]=_[_0x150c('0x3a')](db[_0x150c('0x9a')][_0x150c('0x4d')]);_0x1dcb5d['query']=_[_0x150c('0x3a')](_0x4c14de[_0x150c('0x39')]);_0x1dcb5d['filters']=_['intersection'](_0x1dcb5d[_0x150c('0x37')],_0x1dcb5d[_0x150c('0x39')]);_0x2514de[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x1dcb5d['model'],qs[_0x150c('0x3e')](_0x4c14de[_0x150c('0x39')][_0x150c('0x3e')]));_0x2514de[_0x150c('0x3d')]=_0x2514de[_0x150c('0x3d')][_0x150c('0x3f')]?_0x2514de[_0x150c('0x3d')]:_0x1dcb5d[_0x150c('0x37')];_0x2514de[_0x150c('0x40')]=qs[_0x150c('0x41')](_0x4c14de[_0x150c('0x39')][_0x150c('0x41')]);_0x2514de[_0x150c('0x42')]=qs[_0x150c('0x3b')](_[_0x150c('0x64')](_0x4c14de['query'],_0x1dcb5d[_0x150c('0x3b')]));if(_0x4c14de['query'][_0x150c('0x2b')]){_0x2514de[_0x150c('0x42')]=_[_0x150c('0x43')](_0x2514de[_0x150c('0x42')],{'$or':_['map'](_0x2514de[_0x150c('0x3d')],function(_0x10b739){var _0x4eed22={};_0x4eed22[_0x10b739]={'$like':'%'+_0x4c14de[_0x150c('0x39')]['filter']+'%'};return _0x4eed22;})});}_0x2514de=_[_0x150c('0x43')]({},_0x2514de,_0x4c14de[_0x150c('0x44')]);return _0x38c08b['getLists'](_0x2514de);}})[_0x150c('0x27')](function(_0x3d6dcb){if(_0x3d6dcb){_0x15d981=_0x3d6dcb[_0x150c('0x3f')];if(!_0x4c14de[_0x150c('0x39')][_0x150c('0x62')]('nolimit')){_0x2514de['limit']=qs['limit'](_0x4c14de[_0x150c('0x39')]['limit']);_0x2514de[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x4c14de[_0x150c('0x39')]['offset']);}return _0x38c08b[_0x150c('0x99')](_0x2514de);}})[_0x150c('0x27')](function(_0x540ed6){if(_0x540ed6){return _0x540ed6?{'count':_0x15d981,'rows':_0x540ed6}:null;}})[_0x150c('0x27')](respondWithResult(_0x18d8d2,null))[_0x150c('0x4a')](handleError(_0x18d8d2,null));};exports[_0x150c('0x9b')]=function(_0x52cf7e,_0x2cbf95,_0x5749a6){var _0x4045da,_0x5bc7fe;return db['VoiceQueue'][_0x150c('0x55')]({'where':{'id':_0x52cf7e[_0x150c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2cbf95,null))[_0x150c('0x27')](function(_0xd1abbb){if(_0xd1abbb){_0x5bc7fe=_0xd1abbb;return _0xd1abbb[_0x150c('0x9b')](_0x52cf7e[_0x150c('0x4f')][_0x150c('0x82')],_[_0x150c('0x59')](_0x52cf7e[_0x150c('0x4f')],[_0x150c('0x82'),'id'])||{});}return null;})[_0x150c('0x95')](function(_0x17f9d8){var _0x228c72;_0x4045da=_0x17f9d8||[];var _0x139b17=[];if(_0x17f9d8){for(var _0x124668=0x0;_0x124668<_0x17f9d8[_0x150c('0x3f')];_0x124668+=0x1){var _0x4c88b7=_0x17f9d8[_0x124668][_0x150c('0x50')]({'plain':!![]});_0x5bc7fe[_0x150c('0x9c')]=_0x52cf7e[_0x150c('0x4f')][_0x150c('0x9c')]?_0x52cf7e['body'][_0x150c('0x9c')]:_0x5bc7fe[_0x150c('0x9c')];switch(_0x5bc7fe[_0x150c('0x9c')]){case _0x150c('0x9d'):_0x228c72=squel[_0x150c('0x9e')]()[_0x150c('0x9f')]('cm_hopper')[_0x150c('0xa0')]([_0x150c('0xa1'),_0x150c('0xa2'),_0x150c('0xa3'),'ListId',_0x150c('0x65'),_0x150c('0x5a'),_0x150c('0x5b')],squel[_0x150c('0xa4')]()[_0x150c('0x84')](_0x150c('0xa1'),_0x150c('0xa1'))['field']('NOW()',_0x150c('0xa2'))[_0x150c('0x84')]('id','ContactId')[_0x150c('0x84')](_0x4c88b7[_0x150c('0xa5')][_0x150c('0x8b')](),'ListId')[_0x150c('0x84')](_0x52cf7e[_0x150c('0x4c')]['id'][_0x150c('0x8b')](),_0x150c('0x65'))[_0x150c('0x84')]('NOW()',_0x150c('0x5a'))[_0x150c('0x84')]('NOW()',_0x150c('0x5b'))['from'](_0x150c('0xa6'))[_0x150c('0x42')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',_0x4c88b7[_0x150c('0xa5')][_0x150c('0x8b')]())[_0x150c('0x42')](_0x150c('0xa7'))[_0x150c('0x42')](_0x150c('0xa8'),squel['select']()[_0x150c('0x84')](_0x150c('0xa9'))[_0x150c('0xaa')](_0x150c('0xab'))['where']('VoiceQueueId\x20=\x20?',_0x52cf7e[_0x150c('0x4c')]['id'][_0x150c('0x8b')]()))[_0x150c('0x42')](_0x150c('0xa8'),squel[_0x150c('0xa4')]()['field'](_0x150c('0xac'))['from']('cm_hopper')['where'](_0x150c('0xad'),_0x52cf7e['params']['id'][_0x150c('0x8b')]())))[_0x150c('0x8b')]();break;case _0x150c('0xae'):_0x228c72=squel[_0x150c('0x9e')]()['into'](_0x150c('0xaf'))['fromQuery']([_0x150c('0xa1'),_0x150c('0xa2'),'ContactId','ListId',_0x150c('0x65'),_0x150c('0x5a'),_0x150c('0x5b')],squel['select']()[_0x150c('0x84')](_0x150c('0xa1'),'phone')[_0x150c('0x84')]('NOW()',_0x150c('0xa2'))[_0x150c('0x84')]('id',_0x150c('0xa3'))[_0x150c('0x84')](_0x4c88b7[_0x150c('0xa5')][_0x150c('0x8b')](),_0x150c('0xb0'))[_0x150c('0x84')](_0x52cf7e[_0x150c('0x4c')]['id'][_0x150c('0x8b')](),_0x150c('0x65'))[_0x150c('0x84')](_0x150c('0xb1'),_0x150c('0x5a'))[_0x150c('0x84')](_0x150c('0xb1'),_0x150c('0x5b'))[_0x150c('0xaa')]('cm_contacts')[_0x150c('0x42')]('deletedAt\x20IS\x20NULL')[_0x150c('0x42')](_0x150c('0xb2'),_0x4c88b7[_0x150c('0xa5')][_0x150c('0x8b')]())[_0x150c('0x42')](_0x150c('0xa7'))[_0x150c('0x42')](_0x150c('0xa8'),squel[_0x150c('0xa4')]()['field']('COALESCE(phone,\x27\x27)')[_0x150c('0xaa')]('cm_hopper')[_0x150c('0x42')]('VoiceQueueId\x20=\x20?',_0x52cf7e['params']['id']['toString']())))['toString']();break;default:_0x228c72=squel[_0x150c('0x9e')]()[_0x150c('0x9f')](_0x150c('0xaf'))[_0x150c('0xa0')](['phone',_0x150c('0xa2'),_0x150c('0xa3'),_0x150c('0xb0'),_0x150c('0x65'),_0x150c('0x5a'),'updatedAt'],squel[_0x150c('0xa4')]()[_0x150c('0x84')](_0x150c('0xa1'),_0x150c('0xa1'))[_0x150c('0x84')](_0x150c('0xb1'),_0x150c('0xa2'))[_0x150c('0x84')]('id',_0x150c('0xa3'))[_0x150c('0x84')](_0x4c88b7[_0x150c('0xa5')]['toString'](),_0x150c('0xb0'))[_0x150c('0x84')](_0x52cf7e['params']['id'][_0x150c('0x8b')](),_0x150c('0x65'))[_0x150c('0x84')]('NOW()',_0x150c('0x5a'))[_0x150c('0x84')](_0x150c('0xb1'),_0x150c('0x5b'))[_0x150c('0xaa')](_0x150c('0xa6'))['where'](_0x150c('0xb3'))[_0x150c('0x42')](_0x150c('0xb2'),_0x4c88b7[_0x150c('0xa5')]['toString']())['where'](_0x150c('0xa7')))['toString']();}_0x139b17[_0x150c('0x8a')](db[_0x150c('0x74')][_0x150c('0x39')](_0x228c72));}return BPromise[_0x150c('0x8f')](_0x139b17);}})[_0x150c('0x27')](function(){return _0x4045da;})['then'](respondWithResult(_0x2cbf95,null))[_0x150c('0x4a')](handleError(_0x2cbf95,null));};exports['removeLists']=function(_0x575060,_0x1a4a0e,_0x52c2c4){return db[_0x150c('0x35')][_0x150c('0x55')]({'where':{'id':_0x575060[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x1a4a0e,null))[_0x150c('0x27')](function(_0x3a57ac){if(_0x3a57ac){return _0x3a57ac[_0x150c('0xb4')](_0x575060['query']['ids']);}})['then'](function(_0x49ad2d){if(_0x49ad2d){return db[_0x150c('0x61')][_0x150c('0x26')]({'where':{'ListId':_0x575060['query'][_0x150c('0x82')],'VoiceQueueId':_0x575060[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](function(){return _0x49ad2d;});}})[_0x150c('0x27')](respondWithStatusCode(_0x1a4a0e,null))[_0x150c('0x4a')](handleError(_0x1a4a0e,null));};exports[_0x150c('0xb5')]=function(_0x11dd71,_0x541f8d,_0x2e8ffb){var _0x2312e3={};var _0x466460={};var _0x109d06;var _0xb89f8b;return db['VoiceQueue'][_0x150c('0x60')]({'where':{'id':_0x11dd71[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x541f8d,null))['then'](function(_0x47fc24){if(_0x47fc24){_0x109d06=_0x47fc24;_0x466460['model']=_[_0x150c('0x3a')](db[_0x150c('0x9a')][_0x150c('0x4d')]);_0x466460[_0x150c('0x39')]=_[_0x150c('0x3a')](_0x11dd71['query']);_0x466460[_0x150c('0x3b')]=_[_0x150c('0x3c')](_0x466460[_0x150c('0x37')],_0x466460['query']);_0x2312e3[_0x150c('0x3d')]=_[_0x150c('0x3c')](_0x466460[_0x150c('0x37')],qs[_0x150c('0x3e')](_0x11dd71[_0x150c('0x39')][_0x150c('0x3e')]));_0x2312e3[_0x150c('0x3d')]=_0x2312e3[_0x150c('0x3d')][_0x150c('0x3f')]?_0x2312e3[_0x150c('0x3d')]:_0x466460[_0x150c('0x37')];_0x2312e3[_0x150c('0x40')]=qs['sort'](_0x11dd71[_0x150c('0x39')][_0x150c('0x41')]);_0x2312e3['where']=qs[_0x150c('0x3b')](_[_0x150c('0x64')](_0x11dd71['query'],_0x466460[_0x150c('0x3b')]));if(_0x11dd71['query'][_0x150c('0x2b')]){_0x2312e3[_0x150c('0x42')]=_[_0x150c('0x43')](_0x2312e3[_0x150c('0x42')],{'$or':_['map'](_0x2312e3[_0x150c('0x3d')],function(_0x269d67){var _0x2d08c8={};_0x2d08c8[_0x269d67]={'$like':'%'+_0x11dd71['query'][_0x150c('0x2b')]+'%'};return _0x2d08c8;})});}_0x2312e3=_[_0x150c('0x43')]({},_0x2312e3,_0x11dd71['options']);return _0x109d06[_0x150c('0xb5')](_0x2312e3);}})['then'](function(_0x4fc3de){if(_0x4fc3de){_0xb89f8b=_0x4fc3de['length'];if(!_0x11dd71['query'][_0x150c('0x62')](_0x150c('0x63'))){_0x2312e3[_0x150c('0x22')]=qs['limit'](_0x11dd71['query']['limit']);_0x2312e3[_0x150c('0x21')]=qs[_0x150c('0x21')](_0x11dd71[_0x150c('0x39')][_0x150c('0x21')]);}return _0x109d06[_0x150c('0xb5')](_0x2312e3);}})[_0x150c('0x27')](function(_0x2bb104){if(_0x2bb104){return _0x2bb104?{'count':_0xb89f8b,'rows':_0x2bb104}:null;}})[_0x150c('0x27')](respondWithResult(_0x541f8d,null))['catch'](handleError(_0x541f8d,null));};exports['addBlackLists']=function(_0x5397b9,_0xb9e224,_0x2c0c00){var _0xcd3f01,_0x587873;return db[_0x150c('0x35')]['find']({'where':{'id':_0x5397b9[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0xb9e224,null))['then'](function(_0x21d10a){if(_0x21d10a){_0x587873=_0x21d10a;return _0x21d10a[_0x150c('0xb6')](_0x5397b9[_0x150c('0x4f')][_0x150c('0x82')],_[_0x150c('0x59')](_0x5397b9[_0x150c('0x4f')],[_0x150c('0x82'),'id'])||{});}return null;})[_0x150c('0x95')](function(_0x344635){var _0x29e0e2;_0xcd3f01=_0x344635||[];var _0x56d3b8=[];if(_0x344635){for(var _0x41af9e=0x0;_0x41af9e<_0x344635[_0x150c('0x3f')];_0x41af9e+=0x1){var _0x115c5d=_0x344635[_0x41af9e][_0x150c('0x50')]({'plain':!![]});_0x29e0e2=squel[_0x150c('0x9e')]()[_0x150c('0x9f')](_0x150c('0xb7'))['fromQuery']([_0x150c('0xa1'),'ContactId','ListId',_0x150c('0x65'),_0x150c('0x5a'),_0x150c('0x5b')],squel[_0x150c('0xa4')]()[_0x150c('0x84')]('phone',_0x150c('0xa1'))[_0x150c('0x84')]('id',_0x150c('0xa3'))[_0x150c('0x84')](_0x115c5d[_0x150c('0xa5')][_0x150c('0x8b')](),_0x150c('0xb0'))[_0x150c('0x84')](_0x5397b9[_0x150c('0x4c')]['id'][_0x150c('0x8b')](),'VoiceQueueId')['field'](_0x150c('0xb1'),_0x150c('0x5a'))[_0x150c('0x84')](_0x150c('0xb1'),_0x150c('0x5b'))['from'](_0x150c('0xa6'))[_0x150c('0x42')](_0x150c('0xb3'))[_0x150c('0x42')](_0x150c('0xb2'),_0x115c5d[_0x150c('0xa5')]['toString']())[_0x150c('0x42')](_0x150c('0xa7')))[_0x150c('0x8b')]();_0x56d3b8[_0x150c('0x8a')](db[_0x150c('0x74')][_0x150c('0x39')](_0x29e0e2));}return BPromise[_0x150c('0x8f')](_0x56d3b8);}})[_0x150c('0x27')](function(){return _0xcd3f01;})[_0x150c('0x27')](respondWithResult(_0xb9e224,null))[_0x150c('0x4a')](handleError(_0xb9e224,null));};exports[_0x150c('0xb8')]=function(_0x4fb51d,_0x15ef42,_0x32ff46){return db['VoiceQueue'][_0x150c('0x55')]({'where':{'id':_0x4fb51d[_0x150c('0x4c')]['id']}})[_0x150c('0x27')](handleEntityNotFound(_0x15ef42,null))[_0x150c('0x27')](function(_0x13eee8){if(_0x13eee8){return _0x13eee8[_0x150c('0xb8')](_0x4fb51d['query'][_0x150c('0x82')]);}})[_0x150c('0x27')](function(_0xb4b944){if(_0xb4b944){return db[_0x150c('0x6a')][_0x150c('0x26')]({'where':{'ListId':_0x4fb51d['query']['ids'],'VoiceQueueId':_0x4fb51d['params']['id']}})[_0x150c('0x27')](function(){return _0xb4b944;});}})[_0x150c('0x27')](respondWithStatusCode(_0x15ef42,null))[_0x150c('0x4a')](handleError(_0x15ef42,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index c9a47ef..48c31b8 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 _0xa877=['update','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','save'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa877,0xd4));var _0x7a87=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa877[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x7a87('0x0'));var VoiceQueue=require(_0x7a87('0x1'))['db'][_0x7a87('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7a87('0x3'),'afterUpdate':_0x7a87('0x4'),'afterDestroy':'remove'};function emitEvent(_0x502943){return function(_0x2a6c45,_0x157670,_0x2b4b93){VoiceQueueEvents[_0x7a87('0x5')](_0x502943+':'+_0x2a6c45['id'],_0x2a6c45);VoiceQueueEvents['emit'](_0x502943,_0x2a6c45);_0x2b4b93(null);};}for(var e in events){if(events[_0x7a87('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x7a87('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x30e6=['emit','hasOwnProperty','hook','exports','events','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0xdfbf6e,_0x4edfb5){var _0x2e6c37=function(_0xd49d33){while(--_0xd49d33){_0xdfbf6e['push'](_0xdfbf6e['shift']());}};_0x2e6c37(++_0x4edfb5);}(_0x30e6,0x1d0));var _0x630e=function(_0x557d29,_0x488d94){_0x557d29=_0x557d29-0x0;var _0x19d714=_0x30e6[_0x557d29];return _0x19d714;};'use strict';var EventEmitter=require(_0x630e('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x630e('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x630e('0x2')](0x0);var events={'afterCreate':_0x630e('0x3'),'afterUpdate':_0x630e('0x4'),'afterDestroy':_0x630e('0x5')};function emitEvent(_0x32e08c){return function(_0x5558a1,_0x44511c,_0x14a341){VoiceQueueEvents[_0x630e('0x6')](_0x32e08c+':'+_0x5558a1['id'],_0x5558a1);VoiceQueueEvents['emit'](_0x32e08c,_0x5558a1);_0x14a341(null);};}for(var e in events){if(events[_0x630e('0x7')](e)){var event=events[e];VoiceQueue[_0x630e('0x8')](e,emitEvent(event));}}module[_0x630e('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index f58c8ea..bf58bf3 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 _0xa036=['../../config/logger','moment','rimraf','../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util'];(function(_0x47fb51,_0x295b92){var _0x20f734=function(_0xd1b5f){while(--_0xd1b5f){_0x47fb51['push'](_0x47fb51['shift']());}};_0x20f734(++_0x295b92);}(_0xa036,0x1c0));var _0x6a03=function(_0x148634,_0xb2a21c){_0x148634=_0x148634-0x0;var _0x4bf6ae=_0xa036[_0x148634];return _0x4bf6ae;};'use strict';var _=require(_0x6a03('0x0'));var util=require(_0x6a03('0x1'));var logger=require(_0x6a03('0x2'))('api');var moment=require(_0x6a03('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6a03('0x4'));var config=require(_0x6a03('0x5'));var attributes=require(_0x6a03('0x6'));module[_0x6a03('0x7')]=function(_0xb2e790,_0x32412d){return _0xb2e790[_0x6a03('0x8')](_0x6a03('0x9'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0886=['VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceQueue.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0886,0xaa));var _0x6088=function(_0x1918e9,_0x811533){_0x1918e9=_0x1918e9-0x0;var _0x176e45=_0x0886[_0x1918e9];return _0x176e45;};'use strict';var _=require(_0x6088('0x0'));var util=require(_0x6088('0x1'));var logger=require(_0x6088('0x2'))(_0x6088('0x3'));var moment=require(_0x6088('0x4'));var BPromise=require(_0x6088('0x5'));var rp=require(_0x6088('0x6'));var fs=require('fs');var path=require(_0x6088('0x7'));var rimraf=require('rimraf');var config=require(_0x6088('0x8'));var attributes=require(_0x6088('0x9'));module[_0x6088('0xa')]=function(_0x23803b,_0x98cdbd){return _0x23803b[_0x6088('0xb')](_0x6088('0xc'),attributes,{'tableName':_0x6088('0xd'),'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 f1fc5c5..a56320e 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 _0x25b4=['debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','VoiceQueue,\x20%s,\x20%s','result','catch','VoiceQueue','findAll','options','where','attributes','include','map','model','stringify','GetVoiceQueue','ShowVoiceQueue','find','raw','then','lodash','util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','./voiceQueue.socket','register','request','info','request\x20sent'];(function(_0x1aa9c3,_0x53483d){var _0x29403a=function(_0x24d40c){while(--_0x24d40c){_0x1aa9c3['push'](_0x1aa9c3['shift']());}};_0x29403a(++_0x53483d);}(_0x25b4,0xd4));var _0x425b=function(_0x35b7d4,_0x5a5c43){_0x35b7d4=_0x35b7d4-0x0;var _0x4e8cee=_0x25b4[_0x35b7d4];return _0x4e8cee;};'use strict';var _=require(_0x425b('0x0'));var util=require(_0x425b('0x1'));var moment=require('moment');var BPromise=require(_0x425b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x425b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x425b('0x4'))(_0x425b('0x5'));var config=require(_0x425b('0x6'));var jayson=require(_0x425b('0x7'));var client=jayson[_0x425b('0x8')]['http']({'port':0x232a});config[_0x425b('0x9')]=_[_0x425b('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x425b('0x9')]));require(_0x425b('0xb'))[_0x425b('0xc')](socket);function respondWithRpcPromise(_0x5e00d5,_0x3c4ed6,_0x396bb1){return new BPromise(function(_0x55e08c,_0x1d79dd){return client[_0x425b('0xd')](_0x5e00d5,_0x396bb1)['then'](function(_0x188c03){logger[_0x425b('0xe')]('VoiceQueue,\x20%s,\x20%s',_0x3c4ed6,_0x425b('0xf'));logger[_0x425b('0x10')](_0x425b('0x11'),_0x3c4ed6,_0x425b('0xf'),JSON['stringify'](_0x188c03));if(_0x188c03[_0x425b('0x12')]){if(_0x188c03['error'][_0x425b('0x13')]===0x1f4){logger[_0x425b('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x3c4ed6,_0x188c03[_0x425b('0x12')][_0x425b('0x14')]);return _0x1d79dd(_0x188c03['error'][_0x425b('0x14')]);}logger[_0x425b('0x12')](_0x425b('0x15'),_0x3c4ed6,_0x188c03[_0x425b('0x12')][_0x425b('0x14')]);return _0x55e08c(_0x188c03[_0x425b('0x12')]['message']);}else{logger[_0x425b('0xe')](_0x425b('0x15'),_0x3c4ed6,'request\x20sent');_0x55e08c(_0x188c03[_0x425b('0x16')][_0x425b('0x14')]);}})[_0x425b('0x17')](function(_0x3f0953){logger[_0x425b('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x3c4ed6,_0x3f0953);_0x1d79dd(_0x3f0953);});});}exports['GetVoiceQueue']=function(_0x124626){var _0xcb1dcb=this;return new Promise(function(_0x833cad,_0x16065d){return db[_0x425b('0x18')][_0x425b('0x19')]({'raw':_0x124626[_0x425b('0x1a')]?_0x124626[_0x425b('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x124626['options']?_0x124626[_0x425b('0x1a')][_0x425b('0x1b')]||null:null,'attributes':_0x124626[_0x425b('0x1a')]?_0x124626['options'][_0x425b('0x1c')]||null:null,'limit':_0x124626[_0x425b('0x1a')]?_0x124626[_0x425b('0x1a')]['limit']||null:null,'include':_0x124626[_0x425b('0x1a')]?_0x124626[_0x425b('0x1a')][_0x425b('0x1d')]?_[_0x425b('0x1e')](_0x124626[_0x425b('0x1a')][_0x425b('0x1d')],function(_0x4276e8){return{'model':db[_0x4276e8['model']],'as':_0x4276e8['as'],'attributes':_0x4276e8['attributes'],'include':_0x4276e8['include']?_[_0x425b('0x1e')](_0x4276e8[_0x425b('0x1d')],function(_0x37ec10){return{'model':db[_0x37ec10[_0x425b('0x1f')]],'as':_0x37ec10['as'],'attributes':_0x37ec10['attributes'],'include':_0x37ec10[_0x425b('0x1d')]?_[_0x425b('0x1e')](_0x37ec10['include'],function(_0x100762){return{'model':db[_0x100762[_0x425b('0x1f')]],'as':_0x100762['as'],'attributes':_0x100762[_0x425b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x60fdcb){logger['info']('GetVoiceQueue',_0x124626);logger[_0x425b('0x10')]('GetVoiceQueue',_0x124626,JSON[_0x425b('0x20')](_0x60fdcb));_0x833cad(_0x60fdcb);})[_0x425b('0x17')](function(_0xdd5849){logger['error'](_0x425b('0x21'),_0xdd5849[_0x425b('0x14')],_0x124626);_0x16065d(_0xcb1dcb[_0x425b('0x12')](0x1f4,_0xdd5849[_0x425b('0x14')]));});});};exports[_0x425b('0x22')]=function(_0x561773){var _0x369b67=this;return new Promise(function(_0x4f081e,_0x19dcf0){return db[_0x425b('0x18')][_0x425b('0x23')]({'raw':_0x561773[_0x425b('0x1a')]?_0x561773[_0x425b('0x1a')][_0x425b('0x24')]===undefined?!![]:![]:!![],'where':_0x561773['options']?_0x561773[_0x425b('0x1a')][_0x425b('0x1b')]||null:null,'attributes':_0x561773['options']?_0x561773['options'][_0x425b('0x1c')]||null:null,'include':_0x561773['options']?_0x561773[_0x425b('0x1a')][_0x425b('0x1d')]?_[_0x425b('0x1e')](_0x561773[_0x425b('0x1a')][_0x425b('0x1d')],function(_0x4cf85a){return{'model':db[_0x4cf85a[_0x425b('0x1f')]],'as':_0x4cf85a['as'],'attributes':_0x4cf85a[_0x425b('0x1c')],'include':_0x4cf85a[_0x425b('0x1d')]?_[_0x425b('0x1e')](_0x4cf85a[_0x425b('0x1d')],function(_0x29dee5){return{'model':db[_0x29dee5[_0x425b('0x1f')]],'as':_0x29dee5['as'],'attributes':_0x29dee5['attributes'],'include':_0x29dee5[_0x425b('0x1d')]?_['map'](_0x29dee5['include'],function(_0x5847c1){return{'model':db[_0x5847c1['model']],'as':_0x5847c1['as'],'attributes':_0x5847c1[_0x425b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x425b('0x25')](function(_0x559f25){logger['info'](_0x425b('0x22'),_0x561773);logger['debug']('ShowVoiceQueue',_0x561773,JSON[_0x425b('0x20')](_0x559f25));_0x4f081e(_0x559f25);})['catch'](function(_0x26ec19){logger[_0x425b('0x12')](_0x425b('0x22'),_0x26ec19[_0x425b('0x14')],_0x561773);_0x19dcf0(_0x369b67[_0x425b('0x12')](0x1f4,_0x26ec19[_0x425b('0x14')]));});});}; \ No newline at end of file +var _0x934e=['./voiceQueue.socket','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','attributes','map','include','model','then','info','GetVoiceQueue','stringify','ShowVoiceQueue','find','where','moment','bluebird','../../mysqldb','../../config/logger','rpc','http','redis','defaults','localhost'];(function(_0x20342d,_0x250d97){var _0x562fdc=function(_0x3d9f4c){while(--_0x3d9f4c){_0x20342d['push'](_0x20342d['shift']());}};_0x562fdc(++_0x250d97);}(_0x934e,0x7f));var _0xe934=function(_0x194933,_0x3177ae){_0x194933=_0x194933-0x0;var _0x367462=_0x934e[_0x194933];return _0x367462;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe934('0x0'));var BPromise=require(_0xe934('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe934('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xe934('0x3'))(_0xe934('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe934('0x5')]({'port':0x232a});config[_0xe934('0x6')]=_[_0xe934('0x7')](config[_0xe934('0x6')],{'host':_0xe934('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe934('0x6')]));require(_0xe934('0x9'))['register'](socket);function respondWithRpcPromise(_0x267fe4,_0xef774a,_0x4a4e93){return new BPromise(function(_0x1a70c7,_0x4efcdd){return client[_0xe934('0xa')](_0x267fe4,_0x4a4e93)['then'](function(_0x29412e){logger['info'](_0xe934('0xb'),_0xef774a,_0xe934('0xc'));logger[_0xe934('0xd')](_0xe934('0xe'),_0xef774a,_0xe934('0xc'),JSON['stringify'](_0x29412e));if(_0x29412e['error']){if(_0x29412e[_0xe934('0xf')][_0xe934('0x10')]===0x1f4){logger[_0xe934('0xf')]('VoiceQueue,\x20%s,\x20%s',_0xef774a,_0x29412e[_0xe934('0xf')]['message']);return _0x4efcdd(_0x29412e[_0xe934('0xf')][_0xe934('0x11')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0xef774a,_0x29412e[_0xe934('0xf')][_0xe934('0x11')]);return _0x1a70c7(_0x29412e[_0xe934('0xf')][_0xe934('0x11')]);}else{logger['info']('VoiceQueue,\x20%s,\x20%s',_0xef774a,_0xe934('0xc'));_0x1a70c7(_0x29412e[_0xe934('0x12')][_0xe934('0x11')]);}})[_0xe934('0x13')](function(_0x2671c8){logger[_0xe934('0xf')](_0xe934('0xb'),_0xef774a,_0x2671c8);_0x4efcdd(_0x2671c8);});});}exports['GetVoiceQueue']=function(_0x2dfa9c){var _0x50b797=this;return new Promise(function(_0x4da631,_0x58a804){return db['VoiceQueue'][_0xe934('0x14')]({'raw':_0x2dfa9c[_0xe934('0x15')]?_0x2dfa9c[_0xe934('0x15')][_0xe934('0x16')]===undefined?!![]:![]:!![],'where':_0x2dfa9c[_0xe934('0x15')]?_0x2dfa9c[_0xe934('0x15')]['where']||null:null,'attributes':_0x2dfa9c[_0xe934('0x15')]?_0x2dfa9c[_0xe934('0x15')][_0xe934('0x17')]||null:null,'limit':_0x2dfa9c[_0xe934('0x15')]?_0x2dfa9c[_0xe934('0x15')]['limit']||null:null,'include':_0x2dfa9c[_0xe934('0x15')]?_0x2dfa9c[_0xe934('0x15')]['include']?_[_0xe934('0x18')](_0x2dfa9c[_0xe934('0x15')]['include'],function(_0x2745b4){return{'model':db[_0x2745b4['model']],'as':_0x2745b4['as'],'attributes':_0x2745b4[_0xe934('0x17')],'include':_0x2745b4['include']?_[_0xe934('0x18')](_0x2745b4[_0xe934('0x19')],function(_0x43222b){return{'model':db[_0x43222b[_0xe934('0x1a')]],'as':_0x43222b['as'],'attributes':_0x43222b[_0xe934('0x17')],'include':_0x43222b[_0xe934('0x19')]?_[_0xe934('0x18')](_0x43222b['include'],function(_0x577b57){return{'model':db[_0x577b57['model']],'as':_0x577b57['as'],'attributes':_0x577b57[_0xe934('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe934('0x1b')](function(_0x52fd58){logger[_0xe934('0x1c')](_0xe934('0x1d'),_0x2dfa9c);logger['debug'](_0xe934('0x1d'),_0x2dfa9c,JSON[_0xe934('0x1e')](_0x52fd58));_0x4da631(_0x52fd58);})['catch'](function(_0x279543){logger['error'](_0xe934('0x1d'),_0x279543[_0xe934('0x11')],_0x2dfa9c);_0x58a804(_0x50b797[_0xe934('0xf')](0x1f4,_0x279543['message']));});});};exports[_0xe934('0x1f')]=function(_0x18edcc){var _0x403bdf=this;return new Promise(function(_0x17b7be,_0x1e9eb7){return db['VoiceQueue'][_0xe934('0x20')]({'raw':_0x18edcc['options']?_0x18edcc[_0xe934('0x15')][_0xe934('0x16')]===undefined?!![]:![]:!![],'where':_0x18edcc['options']?_0x18edcc[_0xe934('0x15')][_0xe934('0x21')]||null:null,'attributes':_0x18edcc[_0xe934('0x15')]?_0x18edcc[_0xe934('0x15')]['attributes']||null:null,'include':_0x18edcc[_0xe934('0x15')]?_0x18edcc[_0xe934('0x15')][_0xe934('0x19')]?_['map'](_0x18edcc[_0xe934('0x15')]['include'],function(_0x2b07c4){return{'model':db[_0x2b07c4[_0xe934('0x1a')]],'as':_0x2b07c4['as'],'attributes':_0x2b07c4[_0xe934('0x17')],'include':_0x2b07c4['include']?_[_0xe934('0x18')](_0x2b07c4[_0xe934('0x19')],function(_0x4c1758){return{'model':db[_0x4c1758['model']],'as':_0x4c1758['as'],'attributes':_0x4c1758[_0xe934('0x17')],'include':_0x4c1758[_0xe934('0x19')]?_[_0xe934('0x18')](_0x4c1758[_0xe934('0x19')],function(_0x1447b5){return{'model':db[_0x1447b5[_0xe934('0x1a')]],'as':_0x1447b5['as'],'attributes':_0x1447b5[_0xe934('0x17')]};}):[]};}):[]};}):[]:[]})[_0xe934('0x1b')](function(_0x2a707e){logger['info'](_0xe934('0x1f'),_0x18edcc);logger[_0xe934('0xd')]('ShowVoiceQueue',_0x18edcc,JSON[_0xe934('0x1e')](_0x2a707e));_0x17b7be(_0x2a707e);})[_0xe934('0x13')](function(_0x26da5a){logger[_0xe934('0xf')](_0xe934('0x1f'),_0x26da5a['message'],_0x18edcc);_0x1e9eb7(_0x403bdf['error'](0x1f4,_0x26da5a['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index d3db535..0d3288e 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 _0x8547=['remove','update','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x5e8e31,_0x483f07){var _0x461580=function(_0x444b31){while(--_0x444b31){_0x5e8e31['push'](_0x5e8e31['shift']());}};_0x461580(++_0x483f07);}(_0x8547,0x1ae));var _0x7854=function(_0x215311,_0x53df31){_0x215311=_0x215311-0x0;var _0x3b0147=_0x8547[_0x215311];return _0x3b0147;};'use strict';var VoiceQueueEvents=require(_0x7854('0x0'));var events=[_0x7854('0x1'),_0x7854('0x2'),_0x7854('0x3')];function createListener(_0x24bed3,_0x44c25f){return function(_0x37c96d){_0x44c25f['emit'](_0x24bed3,_0x37c96d);};}function removeListener(_0x2b165b,_0x2965a2){return function(){VoiceQueueEvents[_0x7854('0x4')](_0x2b165b,_0x2965a2);};}exports[_0x7854('0x5')]=function(_0x55da51){for(var _0x3a9948=0x0,_0xe88928=events[_0x7854('0x6')];_0x3a9948<_0xe88928;_0x3a9948++){var _0xde5ac=events[_0x3a9948];var _0x19eea5=createListener(_0x7854('0x7')+_0xde5ac,_0x55da51);VoiceQueueEvents['on'](_0xde5ac,_0x19eea5);}}; \ No newline at end of file +var _0x21c1=['voiceQueue:','remove','update','emit','removeListener','register','length'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x21c1,0xef));var _0x121c=function(_0x22447c,_0x3a9a46){_0x22447c=_0x22447c-0x0;var _0x537dc4=_0x21c1[_0x22447c];return _0x537dc4;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x121c('0x0'),_0x121c('0x1')];function createListener(_0x454647,_0x193241){return function(_0x46b3c4){_0x193241[_0x121c('0x2')](_0x454647,_0x46b3c4);};}function removeListener(_0x56bcff,_0x261a9d){return function(){VoiceQueueEvents[_0x121c('0x3')](_0x56bcff,_0x261a9d);};}exports[_0x121c('0x4')]=function(_0x11e1dd){for(var _0x45e905=0x0,_0x4d0928=events[_0x121c('0x5')];_0x45e905<_0x4d0928;_0x45e905++){var _0x492a00=events[_0x45e905];var _0x2ad84a=createListener(_0x121c('0x6')+_0x492a00,_0x11e1dd);VoiceQueueEvents['on'](_0x492a00,_0x2ad84a);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index c7ee5f9..4db9279 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 _0x32f4=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','/:id','show','put','update','exports','multer','util'];(function(_0x92c289,_0x53cec8){var _0x518f5b=function(_0xdf101c){while(--_0xdf101c){_0x92c289['push'](_0x92c289['shift']());}};_0x518f5b(++_0x53cec8);}(_0x32f4,0x154));var _0x432f=function(_0x5a70df,_0x15ea76){_0x5a70df=_0x5a70df-0x0;var _0x18d29f=_0x32f4[_0x5a70df];return _0x18d29f;};'use strict';var multer=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var path=require(_0x432f('0x2'));var timeout=require(_0x432f('0x3'));var express=require('express');var router=express[_0x432f('0x4')]();var auth=require(_0x432f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x432f('0x6'));var controller=require(_0x432f('0x7'));router[_0x432f('0x8')]('/',auth[_0x432f('0x9')](),controller[_0x432f('0xa')]);router['get']('/describe',auth[_0x432f('0x9')](),controller[_0x432f('0xb')]);router['get'](_0x432f('0xc'),auth['isAuthenticated'](),controller[_0x432f('0xd')]);router[_0x432f('0x8')](_0x432f('0xe'),auth[_0x432f('0x9')](),controller[_0x432f('0xf')]);router['post']('/',auth[_0x432f('0x9')](),controller['create']);router[_0x432f('0x10')]('/:id',auth[_0x432f('0x9')](),controller[_0x432f('0x11')]);router['delete'](_0x432f('0xe'),auth[_0x432f('0x9')](),controller['destroy']);module[_0x432f('0x12')]=router; \ No newline at end of file +var _0xdfa0=['show','create','put','update','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','isAuthenticated','index','/describe','describe','get','/index','getVoiceQueuesReport','/:id'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xdfa0,0x69));var _0x0dfa=function(_0x4bdef5,_0x5f48a8){_0x4bdef5=_0x4bdef5-0x0;var _0x13d12b=_0xdfa0[_0x4bdef5];return _0x13d12b;};'use strict';var multer=require(_0x0dfa('0x0'));var util=require('util');var path=require(_0x0dfa('0x1'));var timeout=require(_0x0dfa('0x2'));var express=require('express');var router=express[_0x0dfa('0x3')]();var auth=require(_0x0dfa('0x4'));var interaction=require(_0x0dfa('0x5'));var config=require('../../config/environment');var controller=require(_0x0dfa('0x6'));router['get']('/',auth[_0x0dfa('0x7')](),controller[_0x0dfa('0x8')]);router['get'](_0x0dfa('0x9'),auth[_0x0dfa('0x7')](),controller[_0x0dfa('0xa')]);router[_0x0dfa('0xb')](_0x0dfa('0xc'),auth['isAuthenticated'](),controller[_0x0dfa('0xd')]);router[_0x0dfa('0xb')](_0x0dfa('0xe'),auth['isAuthenticated'](),controller[_0x0dfa('0xf')]);router['post']('/',auth[_0x0dfa('0x7')](),controller[_0x0dfa('0x10')]);router[_0x0dfa('0x11')]('/:id',auth[_0x0dfa('0x7')](),controller[_0x0dfa('0x12')]);router['delete'](_0x0dfa('0xe'),auth[_0x0dfa('0x7')](),controller['destroy']);module[_0x0dfa('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 50e40be..5d3dc98 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 _0x9541=['seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x55f543,_0x116fe8){var _0x15643b=function(_0x4d364a){while(--_0x4d364a){_0x55f543['push'](_0x55f543['shift']());}};_0x15643b(++_0x116fe8);}(_0x9541,0x97));var _0x1954=function(_0x1de7e9,_0x3023fe){_0x1de7e9=_0x1de7e9-0x0;var _0x9e192e=_0x9541[_0x1de7e9];return _0x9e192e;};'use strict';var Sequelize=require(_0x1954('0x0'));var moment=require(_0x1954('0x1'));module[_0x1954('0x2')]={'type':{'type':Sequelize[_0x1954('0x3')]},'uniqueid':{'type':Sequelize[_0x1954('0x3')]},'calleridnum':{'type':Sequelize[_0x1954('0x3')]},'calleridname':{'type':Sequelize[_0x1954('0x3')]},'queue':{'type':Sequelize[_0x1954('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x1954('0x4')],'set':function(_0x372b20){var _0x450a8e=moment(_0x372b20);var _0x56c991=moment(this[_0x1954('0x5')](_0x1954('0x6')))['format'](_0x1954('0x7'));var _0x5ebacb=_0x450a8e[_0x1954('0x8')](_0x56c991,_0x1954('0x9'));this[_0x1954('0xa')](_0x1954('0xb'),_0x372b20);this['setDataValue']('holdtime',_0x5ebacb||null);}},'position':{'type':Sequelize[_0x1954('0xc')]},'count':{'type':Sequelize[_0x1954('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x1954('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x1954('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x1954('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x1954('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x1954('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x1954('0x3')]},'connectedlinenum':{'type':Sequelize[_0x1954('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1954('0x3')]},'exten':{'type':Sequelize[_0x1954('0x3')]},'priority':{'type':Sequelize[_0x1954('0x3')]},'holdtime':{'type':Sequelize[_0x1954('0xc')]},'mohtime':{'type':Sequelize[_0x1954('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1954('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x1954('0x3')]},'transfer':{'type':Sequelize[_0x1954('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1954('0x3')],'comment':_0x1954('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x1954('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0442=['sequelize','moment','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x164eb1,_0x198a7d){var _0x73311=function(_0xde4d4a){while(--_0xde4d4a){_0x164eb1['push'](_0x164eb1['shift']());}};_0x73311(++_0x198a7d);}(_0x0442,0x1a0));var _0x2044=function(_0x47e7dd,_0x51b041){_0x47e7dd=_0x47e7dd-0x0;var _0x38501f=_0x0442[_0x47e7dd];return _0x38501f;};'use strict';var Sequelize=require(_0x2044('0x0'));var moment=require(_0x2044('0x1'));module['exports']={'type':{'type':Sequelize[_0x2044('0x2')]},'uniqueid':{'type':Sequelize[_0x2044('0x2')]},'calleridnum':{'type':Sequelize[_0x2044('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x2044('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x3b31fc){var _0x4d3861=moment(_0x3b31fc);var _0x2a4ed8=moment(this['getDataValue'](_0x2044('0x4')))[_0x2044('0x5')](_0x2044('0x6'));var _0x32d0b8=_0x4d3861['diff'](_0x2a4ed8,_0x2044('0x7'));this[_0x2044('0x8')]('queuecallerleaveAt',_0x3b31fc);this[_0x2044('0x8')]('holdtime',_0x32d0b8||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x2044('0x9')]},'queuecallerabandon':{'type':Sequelize[_0x2044('0xa')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2044('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x2044('0xa')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2044('0x3')]},'queuecallerexit':{'type':Sequelize[_0x2044('0xa')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x2044('0x2')],'comment':_0x2044('0xb')},'originalposition':{'type':Sequelize[_0x2044('0x9')]},'channel':{'type':Sequelize[_0x2044('0x2')]},'connectedlinenum':{'type':Sequelize[_0x2044('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2044('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x2044('0x2')]},'priority':{'type':Sequelize[_0x2044('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2044('0x9')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2044('0x2')],'comment':_0x2044('0xc')},'transferexten':{'type':Sequelize[_0x2044('0x2')]},'transferuniqueid':{'type':Sequelize[_0x2044('0x2')]},'disposition':{'type':Sequelize[_0x2044('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x2044('0x9')],'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 4032cd2..c321637 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 _0x4975=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','index','rawAttributes','fieldName','map','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','filters','pick','filter','merge','where','type','VIRTUAL','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register'];(function(_0x3e2040,_0x660381){var _0x38e3ec=function(_0x2e61bd){while(--_0x2e61bd){_0x3e2040['push'](_0x3e2040['shift']());}};_0x38e3ec(++_0x660381);}(_0x4975,0x86));var _0x5497=function(_0x727516,_0x21c399){_0x727516=_0x727516-0x0;var _0x596a72=_0x4975[_0x727516];return _0x596a72;};'use strict';var pdf=require(_0x5497('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5497('0x1'));var zipdir=require(_0x5497('0x2'));var jsonpatch=require(_0x5497('0x3'));var rp=require(_0x5497('0x4'));var moment=require(_0x5497('0x5'));var BPromise=require(_0x5497('0x6'));var Mustache=require(_0x5497('0x7'));var util=require(_0x5497('0x8'));var path=require(_0x5497('0x9'));var sox=require(_0x5497('0xa'));var csv=require('to-csv');var ejs=require(_0x5497('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xf'));var querystring=require('querystring');var Papa=require(_0x5497('0x10'));var Redis=require(_0x5497('0x11'));var authService=require(_0x5497('0x12'));var qs=require(_0x5497('0x13'));var as=require(_0x5497('0x14'));var hardwareService=require(_0x5497('0x15'));var logger=require(_0x5497('0x16'))(_0x5497('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x5497('0x18')]=_[_0x5497('0x19')](config[_0x5497('0x18')],{'host':_0x5497('0x1a'),'port':0x18eb});var socket=require(_0x5497('0x1b'))(new Redis(config[_0x5497('0x18')]));require(_0x5497('0x1c'))[_0x5497('0x1d')](socket);function respondWithStatusCode(_0x363a5b,_0x1a4c74){_0x1a4c74=_0x1a4c74||0xcc;return function(_0x55f590){if(_0x55f590){return _0x363a5b[_0x5497('0x1e')](_0x1a4c74);}return _0x363a5b['status'](_0x1a4c74)[_0x5497('0x1f')]();};}function respondWithResult(_0x2bfd8a,_0x19e5f3){_0x19e5f3=_0x19e5f3||0xc8;return function(_0x3ce50b){if(_0x3ce50b){return _0x2bfd8a[_0x5497('0x20')](_0x19e5f3)[_0x5497('0x21')](_0x3ce50b);}};}function respondWithFilteredResult(_0x2f2997,_0x575f6b){return function(_0x56a788){if(_0x56a788){var _0x3f4d20=_0x56a788[_0x5497('0x22')],_0x1bf442=_0x575f6b[_0x5497('0x23')],_0x3a47fd=_0x575f6b[_0x5497('0x23')]+_0x575f6b[_0x5497('0x24')],_0x5d9e24;if(_0x3a47fd>=_0x3f4d20){_0x3a47fd=_0x3f4d20;_0x5d9e24=0xc8;}else{_0x5d9e24=0xce;}_0x2f2997[_0x5497('0x20')](_0x5d9e24);return _0x2f2997[_0x5497('0x25')](_0x5497('0x26'),_0x1bf442+'-'+_0x3a47fd+'/'+_0x3f4d20)[_0x5497('0x21')](_0x56a788);}return null;};}function patchUpdates(_0x2e3960){return function(_0x3f54ef){try{jsonpatch[_0x5497('0x27')](_0x3f54ef,_0x2e3960,!![]);}catch(_0x52c049){return BPromise[_0x5497('0x28')](_0x52c049);}return _0x3f54ef['save']();};}function saveUpdates(_0x19200a,_0xd0868d){return function(_0x44265c){if(_0x44265c){return _0x44265c[_0x5497('0x29')](_0x19200a)[_0x5497('0x2a')](function(_0x3b2fbc){return _0x3b2fbc;});}return null;};}function removeEntity(_0x5018fa,_0x54043a){return function(_0x1eefce){if(_0x1eefce){return _0x1eefce[_0x5497('0x2b')]()[_0x5497('0x2a')](function(){_0x5018fa[_0x5497('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13b7a4,_0x57268c){return function(_0x1f3198){if(!_0x1f3198){_0x13b7a4[_0x5497('0x1e')](0x194);}return _0x1f3198;};}function handleError(_0x429d36,_0x34a1a5){_0x34a1a5=_0x34a1a5||0x1f4;return function(_0x163a30){logger[_0x5497('0x2c')](_0x163a30['stack']);if(_0x163a30[_0x5497('0x2d')]){delete _0x163a30['name'];}_0x429d36['status'](_0x34a1a5)['send'](_0x163a30);};}exports[_0x5497('0x2e')]=function(_0x48d146,_0x5e9356){var _0xc3465={},_0xb14593={},_0x1cf908={'count':0x0,'rows':[]};var _0x4c442a=_['map'](db['VoiceQueueReport'][_0x5497('0x2f')],function(_0x471e0b){return{'name':_0x471e0b[_0x5497('0x30')],'type':_0x471e0b['type']['key']};});_0xb14593['model']=_[_0x5497('0x31')](_0x4c442a,'name');_0xb14593[_0x5497('0x32')]=_[_0x5497('0x33')](_0x48d146[_0x5497('0x32')]);_0xb14593['filters']=_[_0x5497('0x34')](_0xb14593[_0x5497('0x35')],_0xb14593['query']);_0xc3465[_0x5497('0x36')]=_[_0x5497('0x34')](_0xb14593[_0x5497('0x35')],qs['fields'](_0x48d146[_0x5497('0x32')][_0x5497('0x37')]));_0xc3465[_0x5497('0x36')]=_0xc3465[_0x5497('0x36')][_0x5497('0x38')]?_0xc3465['attributes']:_0xb14593[_0x5497('0x35')];if(!_0x48d146[_0x5497('0x32')]['hasOwnProperty'](_0x5497('0x39'))){_0xc3465[_0x5497('0x24')]=qs[_0x5497('0x24')](_0x48d146[_0x5497('0x32')][_0x5497('0x24')]);_0xc3465[_0x5497('0x23')]=qs['offset'](_0x48d146[_0x5497('0x32')]['offset']);}_0xc3465[_0x5497('0x3a')]=qs[_0x5497('0x3b')](_0x48d146[_0x5497('0x32')]['sort']);_0xc3465['where']=qs[_0x5497('0x3c')](_[_0x5497('0x3d')](_0x48d146[_0x5497('0x32')],_0xb14593[_0x5497('0x3c')]));if(_0x48d146[_0x5497('0x32')][_0x5497('0x3e')]){_0xc3465['where']=_[_0x5497('0x3f')](_0xc3465[_0x5497('0x40')],{'$or':_[_0x5497('0x31')](_0x4c442a,function(_0x2bd07a){if(_0x2bd07a[_0x5497('0x41')]!==_0x5497('0x42')){var _0x1e3b6a={};_0x1e3b6a[_0x2bd07a[_0x5497('0x2d')]]={'$like':'%'+_0x48d146[_0x5497('0x32')]['filter']+'%'};return _0x1e3b6a;}})});}_0xc3465=_[_0x5497('0x3f')]({},_0xc3465,_0x48d146[_0x5497('0x43')]);var _0x1e9616={'where':_0xc3465[_0x5497('0x40')]};return db[_0x5497('0x44')][_0x5497('0x22')](_0x1e9616)[_0x5497('0x2a')](function(_0x59ed13){_0x1cf908[_0x5497('0x22')]=_0x59ed13;if(_0x48d146[_0x5497('0x32')][_0x5497('0x45')]){_0xc3465[_0x5497('0x46')]=[{'all':!![]}];}return db[_0x5497('0x44')][_0x5497('0x47')](_0xc3465);})[_0x5497('0x2a')](function(_0x547437){_0x1cf908[_0x5497('0x48')]=_0x547437;return _0x1cf908;})[_0x5497('0x2a')](respondWithFilteredResult(_0x5e9356,_0xc3465))[_0x5497('0x49')](handleError(_0x5e9356,null));};exports[_0x5497('0x4a')]=function(_0x20e947,_0xd90608){var _0xc1a999={'raw':![],'where':{'id':_0x20e947[_0x5497('0x4b')]['id']}},_0x3eda22={};_0x3eda22[_0x5497('0x35')]=_['keys'](db[_0x5497('0x44')]['rawAttributes']);_0x3eda22[_0x5497('0x32')]=_[_0x5497('0x33')](_0x20e947[_0x5497('0x32')]);_0x3eda22[_0x5497('0x3c')]=_[_0x5497('0x34')](_0x3eda22['model'],_0x3eda22[_0x5497('0x32')]);_0xc1a999[_0x5497('0x36')]=_['intersection'](_0x3eda22[_0x5497('0x35')],qs['fields'](_0x20e947[_0x5497('0x32')]['fields']));_0xc1a999[_0x5497('0x36')]=_0xc1a999[_0x5497('0x36')][_0x5497('0x38')]?_0xc1a999[_0x5497('0x36')]:_0x3eda22[_0x5497('0x35')];if(_0x20e947['query']['includeAll']){_0xc1a999['include']=[{'all':!![]}];}_0xc1a999=_['merge']({},_0xc1a999,_0x20e947[_0x5497('0x43')]);return db[_0x5497('0x44')][_0x5497('0x4c')](_0xc1a999)[_0x5497('0x2a')](handleEntityNotFound(_0xd90608,null))[_0x5497('0x2a')](respondWithResult(_0xd90608,null))[_0x5497('0x49')](handleError(_0xd90608,null));};exports[_0x5497('0x4d')]=function(_0x466287,_0x2626bf){return db['VoiceQueueReport'][_0x5497('0x4d')](_0x466287[_0x5497('0x4e')],{})[_0x5497('0x2a')](respondWithResult(_0x2626bf,0xc9))['catch'](handleError(_0x2626bf,null));};exports[_0x5497('0x29')]=function(_0x530475,_0x12ffbc){if(_0x530475[_0x5497('0x4e')]['id']){delete _0x530475[_0x5497('0x4e')]['id'];}return db['VoiceQueueReport'][_0x5497('0x4c')]({'where':{'id':_0x530475[_0x5497('0x4b')]['id']}})['then'](handleEntityNotFound(_0x12ffbc,null))[_0x5497('0x2a')](saveUpdates(_0x530475['body'],null))[_0x5497('0x2a')](respondWithResult(_0x12ffbc,null))['catch'](handleError(_0x12ffbc,null));};exports[_0x5497('0x2b')]=function(_0x400860,_0x26fd9f){return db[_0x5497('0x44')][_0x5497('0x4c')]({'where':{'id':_0x400860[_0x5497('0x4b')]['id']}})[_0x5497('0x2a')](handleEntityNotFound(_0x26fd9f,null))[_0x5497('0x2a')](removeEntity(_0x26fd9f,null))['catch'](handleError(_0x26fd9f,null));};exports[_0x5497('0x4f')]=function(_0x5b2c22,_0x4c516b){return db[_0x5497('0x44')][_0x5497('0x4f')]()['then'](respondWithResult(_0x4c516b,null))[_0x5497('0x49')](handleError(_0x4c516b,null));};exports[_0x5497('0x50')]=function(_0x436a83,_0x3094c7){var _0x4ccf0e={},_0x1b9f3d={},_0x538d18={'count':0x0,'rows':[]};_0x1b9f3d['model']=_[_0x5497('0x33')](db[_0x5497('0x44')][_0x5497('0x2f')]);_0x1b9f3d['query']=_['keys'](_0x436a83[_0x5497('0x32')]);_0x1b9f3d['filters']=_[_0x5497('0x34')](_0x1b9f3d['model'],_0x1b9f3d[_0x5497('0x32')]);_0x4ccf0e['attributes']=_[_0x5497('0x34')](_0x1b9f3d[_0x5497('0x35')],qs['fields'](_0x436a83[_0x5497('0x32')]['fields']));_0x4ccf0e['attributes']=_0x4ccf0e[_0x5497('0x36')][_0x5497('0x38')]?_0x4ccf0e['attributes']:_0x1b9f3d[_0x5497('0x35')];if(!_0x436a83[_0x5497('0x32')][_0x5497('0x51')](_0x5497('0x39'))){_0x4ccf0e[_0x5497('0x24')]=qs[_0x5497('0x24')](_0x436a83['query'][_0x5497('0x24')]);_0x4ccf0e['offset']=qs['offset'](_0x436a83['query'][_0x5497('0x23')]);}_0x4ccf0e[_0x5497('0x3a')]=qs[_0x5497('0x3b')](_0x436a83['query'][_0x5497('0x3b')]);_0x4ccf0e['where']=qs['filters'](_[_0x5497('0x3d')](_0x436a83[_0x5497('0x32')],_0x1b9f3d[_0x5497('0x3c')]));if(_0x436a83[_0x5497('0x32')][_0x5497('0x3e')]){_0x4ccf0e[_0x5497('0x40')]=_['merge'](_0x4ccf0e[_0x5497('0x40')],{'$or':_[_0x5497('0x31')](_0x4ccf0e[_0x5497('0x36')],function(_0xc783ce){var _0x4b86a8={};_0x4b86a8[_0xc783ce]={'$like':'%'+_0x436a83[_0x5497('0x32')][_0x5497('0x3e')]+'%'};return _0x4b86a8;})});}_0x4ccf0e=_[_0x5497('0x3f')]({},_0x4ccf0e,_0x436a83[_0x5497('0x43')]);var _0x5823f6={'where':_0x4ccf0e[_0x5497('0x40')]};return db[_0x5497('0x44')][_0x5497('0x22')](_0x5823f6)['then'](function(_0x1ab48f){_0x538d18['count']=_0x1ab48f;if(_0x436a83['query']['includeAll']){_0x4ccf0e[_0x5497('0x46')]=[{'all':!![]}];}return db[_0x5497('0x44')][_0x5497('0x47')](_0x4ccf0e);})['then'](function(_0x23b8f0){_0x538d18[_0x5497('0x48')]=_0x23b8f0;return _0x538d18;})[_0x5497('0x2a')](respondWithFilteredResult(_0x3094c7,_0x4ccf0e,_0x5497('0x50')))['catch'](handleError(_0x3094c7,null,_0x5497('0x50')));}; \ No newline at end of file +var _0x66fa=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','includeAll','include','findAll','rows','show','params','intersection','options','find','catch','create','body','getVoiceQueuesReport','pick','filter','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','./voiceQueueReport.socket','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x66fa,0x117));var _0xa66f=function(_0xbef738,_0x1156e6){_0xbef738=_0xbef738-0x0;var _0x512fc9=_0x66fa[_0xbef738];return _0x512fc9;};'use strict';var pdf=require(_0xa66f('0x0'));var emlformat=require(_0xa66f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa66f('0x2'));var jsonpatch=require(_0xa66f('0x3'));var rp=require(_0xa66f('0x4'));var moment=require(_0xa66f('0x5'));var BPromise=require(_0xa66f('0x6'));var Mustache=require(_0xa66f('0x7'));var util=require(_0xa66f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa66f('0x9'));var ejs=require(_0xa66f('0xa'));var fs=require('fs');var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var db=require(_0xa66f('0x14'))['db'];config['redis']=_[_0xa66f('0x15')](config[_0xa66f('0x16')],{'host':_0xa66f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa66f('0x18'))['register'](socket);function respondWithStatusCode(_0x528427,_0x5a7b16){_0x5a7b16=_0x5a7b16||0xcc;return function(_0x3ac0ac){if(_0x3ac0ac){return _0x528427[_0xa66f('0x19')](_0x5a7b16);}return _0x528427[_0xa66f('0x1a')](_0x5a7b16)[_0xa66f('0x1b')]();};}function respondWithResult(_0xd348f9,_0x567d4f){_0x567d4f=_0x567d4f||0xc8;return function(_0x5510dc){if(_0x5510dc){return _0xd348f9[_0xa66f('0x1a')](_0x567d4f)[_0xa66f('0x1c')](_0x5510dc);}};}function respondWithFilteredResult(_0x295acf,_0x403f4d){return function(_0x5c67f5){if(_0x5c67f5){var _0x1cbe64=_0x5c67f5[_0xa66f('0x1d')],_0x55b59d=_0x403f4d[_0xa66f('0x1e')],_0x4a28d4=_0x403f4d[_0xa66f('0x1e')]+_0x403f4d[_0xa66f('0x1f')],_0x2f9da2;if(_0x4a28d4>=_0x1cbe64){_0x4a28d4=_0x1cbe64;_0x2f9da2=0xc8;}else{_0x2f9da2=0xce;}_0x295acf[_0xa66f('0x1a')](_0x2f9da2);return _0x295acf[_0xa66f('0x20')](_0xa66f('0x21'),_0x55b59d+'-'+_0x4a28d4+'/'+_0x1cbe64)[_0xa66f('0x1c')](_0x5c67f5);}return null;};}function patchUpdates(_0x2d9602){return function(_0x235b61){try{jsonpatch[_0xa66f('0x22')](_0x235b61,_0x2d9602,!![]);}catch(_0x3c4eb1){return BPromise[_0xa66f('0x23')](_0x3c4eb1);}return _0x235b61[_0xa66f('0x24')]();};}function saveUpdates(_0x5cd613,_0x27f570){return function(_0xc5c82e){if(_0xc5c82e){return _0xc5c82e[_0xa66f('0x25')](_0x5cd613)[_0xa66f('0x26')](function(_0x5cbd82){return _0x5cbd82;});}return null;};}function removeEntity(_0x337602,_0x473822){return function(_0x209f4d){if(_0x209f4d){return _0x209f4d[_0xa66f('0x27')]()['then'](function(){_0x337602['status'](0xcc)[_0xa66f('0x1b')]();});}};}function handleEntityNotFound(_0x598942,_0x3a3e4f){return function(_0xc661f2){if(!_0xc661f2){_0x598942[_0xa66f('0x19')](0x194);}return _0xc661f2;};}function handleError(_0x57da7f,_0x4683c7){_0x4683c7=_0x4683c7||0x1f4;return function(_0x1c2903){logger[_0xa66f('0x28')](_0x1c2903[_0xa66f('0x29')]);if(_0x1c2903[_0xa66f('0x2a')]){delete _0x1c2903[_0xa66f('0x2a')];}_0x57da7f[_0xa66f('0x1a')](_0x4683c7)[_0xa66f('0x2b')](_0x1c2903);};}exports[_0xa66f('0x2c')]=function(_0x117d03,_0x45f71c){var _0x63650b={},_0x42b966={},_0xeeb22e={'count':0x0,'rows':[]};var _0x49f615=_['map'](db[_0xa66f('0x2d')][_0xa66f('0x2e')],function(_0x55f309){return{'name':_0x55f309[_0xa66f('0x2f')],'type':_0x55f309[_0xa66f('0x30')]['key']};});_0x42b966[_0xa66f('0x31')]=_[_0xa66f('0x32')](_0x49f615,_0xa66f('0x2a'));_0x42b966[_0xa66f('0x33')]=_[_0xa66f('0x34')](_0x117d03['query']);_0x42b966[_0xa66f('0x35')]=_['intersection'](_0x42b966[_0xa66f('0x31')],_0x42b966[_0xa66f('0x33')]);_0x63650b[_0xa66f('0x36')]=_['intersection'](_0x42b966[_0xa66f('0x31')],qs[_0xa66f('0x37')](_0x117d03['query'][_0xa66f('0x37')]));_0x63650b[_0xa66f('0x36')]=_0x63650b[_0xa66f('0x36')][_0xa66f('0x38')]?_0x63650b[_0xa66f('0x36')]:_0x42b966[_0xa66f('0x31')];if(!_0x117d03[_0xa66f('0x33')][_0xa66f('0x39')](_0xa66f('0x3a'))){_0x63650b[_0xa66f('0x1f')]=qs['limit'](_0x117d03[_0xa66f('0x33')]['limit']);_0x63650b[_0xa66f('0x1e')]=qs[_0xa66f('0x1e')](_0x117d03[_0xa66f('0x33')][_0xa66f('0x1e')]);}_0x63650b[_0xa66f('0x3b')]=qs[_0xa66f('0x3c')](_0x117d03[_0xa66f('0x33')][_0xa66f('0x3c')]);_0x63650b['where']=qs[_0xa66f('0x35')](_['pick'](_0x117d03[_0xa66f('0x33')],_0x42b966[_0xa66f('0x35')]));if(_0x117d03[_0xa66f('0x33')]['filter']){_0x63650b['where']=_[_0xa66f('0x3d')](_0x63650b[_0xa66f('0x3e')],{'$or':_[_0xa66f('0x32')](_0x49f615,function(_0x1f5a5f){if(_0x1f5a5f[_0xa66f('0x30')]!=='VIRTUAL'){var _0x5cb0a9={};_0x5cb0a9[_0x1f5a5f['name']]={'$like':'%'+_0x117d03[_0xa66f('0x33')]['filter']+'%'};return _0x5cb0a9;}})});}_0x63650b=_['merge']({},_0x63650b,_0x117d03['options']);var _0x5fdc3e={'where':_0x63650b['where']};return db[_0xa66f('0x2d')][_0xa66f('0x1d')](_0x5fdc3e)[_0xa66f('0x26')](function(_0x1647a0){_0xeeb22e[_0xa66f('0x1d')]=_0x1647a0;if(_0x117d03[_0xa66f('0x33')][_0xa66f('0x3f')]){_0x63650b[_0xa66f('0x40')]=[{'all':!![]}];}return db[_0xa66f('0x2d')][_0xa66f('0x41')](_0x63650b);})[_0xa66f('0x26')](function(_0x93f6ff){_0xeeb22e[_0xa66f('0x42')]=_0x93f6ff;return _0xeeb22e;})[_0xa66f('0x26')](respondWithFilteredResult(_0x45f71c,_0x63650b))['catch'](handleError(_0x45f71c,null));};exports[_0xa66f('0x43')]=function(_0x25c2cb,_0x58c1f2){var _0x248587={'raw':![],'where':{'id':_0x25c2cb[_0xa66f('0x44')]['id']}},_0x4b6e6b={};_0x4b6e6b[_0xa66f('0x31')]=_['keys'](db[_0xa66f('0x2d')][_0xa66f('0x2e')]);_0x4b6e6b[_0xa66f('0x33')]=_['keys'](_0x25c2cb[_0xa66f('0x33')]);_0x4b6e6b['filters']=_[_0xa66f('0x45')](_0x4b6e6b[_0xa66f('0x31')],_0x4b6e6b[_0xa66f('0x33')]);_0x248587[_0xa66f('0x36')]=_[_0xa66f('0x45')](_0x4b6e6b[_0xa66f('0x31')],qs[_0xa66f('0x37')](_0x25c2cb['query'][_0xa66f('0x37')]));_0x248587[_0xa66f('0x36')]=_0x248587[_0xa66f('0x36')][_0xa66f('0x38')]?_0x248587[_0xa66f('0x36')]:_0x4b6e6b['model'];if(_0x25c2cb['query'][_0xa66f('0x3f')]){_0x248587[_0xa66f('0x40')]=[{'all':!![]}];}_0x248587=_[_0xa66f('0x3d')]({},_0x248587,_0x25c2cb[_0xa66f('0x46')]);return db[_0xa66f('0x2d')][_0xa66f('0x47')](_0x248587)['then'](handleEntityNotFound(_0x58c1f2,null))[_0xa66f('0x26')](respondWithResult(_0x58c1f2,null))[_0xa66f('0x48')](handleError(_0x58c1f2,null));};exports[_0xa66f('0x49')]=function(_0x5651e9,_0x57c8a0){return db[_0xa66f('0x2d')][_0xa66f('0x49')](_0x5651e9[_0xa66f('0x4a')],{})['then'](respondWithResult(_0x57c8a0,0xc9))['catch'](handleError(_0x57c8a0,null));};exports['update']=function(_0x19e7ce,_0x35e477){if(_0x19e7ce[_0xa66f('0x4a')]['id']){delete _0x19e7ce[_0xa66f('0x4a')]['id'];}return db[_0xa66f('0x2d')][_0xa66f('0x47')]({'where':{'id':_0x19e7ce[_0xa66f('0x44')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x35e477,null))['then'](saveUpdates(_0x19e7ce[_0xa66f('0x4a')],null))[_0xa66f('0x26')](respondWithResult(_0x35e477,null))[_0xa66f('0x48')](handleError(_0x35e477,null));};exports[_0xa66f('0x27')]=function(_0x11597b,_0x33cdc7){return db['VoiceQueueReport'][_0xa66f('0x47')]({'where':{'id':_0x11597b[_0xa66f('0x44')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x33cdc7,null))[_0xa66f('0x26')](removeEntity(_0x33cdc7,null))[_0xa66f('0x48')](handleError(_0x33cdc7,null));};exports['describe']=function(_0x389b9a,_0x50e0cd){return db[_0xa66f('0x2d')]['describe']()['then'](respondWithResult(_0x50e0cd,null))[_0xa66f('0x48')](handleError(_0x50e0cd,null));};exports[_0xa66f('0x4b')]=function(_0x12271d,_0x2c79df){var _0x35ed5b={},_0xe97cf4={},_0x53a62f={'count':0x0,'rows':[]};_0xe97cf4[_0xa66f('0x31')]=_[_0xa66f('0x34')](db[_0xa66f('0x2d')][_0xa66f('0x2e')]);_0xe97cf4['query']=_[_0xa66f('0x34')](_0x12271d['query']);_0xe97cf4[_0xa66f('0x35')]=_[_0xa66f('0x45')](_0xe97cf4[_0xa66f('0x31')],_0xe97cf4[_0xa66f('0x33')]);_0x35ed5b[_0xa66f('0x36')]=_[_0xa66f('0x45')](_0xe97cf4[_0xa66f('0x31')],qs['fields'](_0x12271d[_0xa66f('0x33')][_0xa66f('0x37')]));_0x35ed5b[_0xa66f('0x36')]=_0x35ed5b[_0xa66f('0x36')][_0xa66f('0x38')]?_0x35ed5b[_0xa66f('0x36')]:_0xe97cf4[_0xa66f('0x31')];if(!_0x12271d[_0xa66f('0x33')][_0xa66f('0x39')]('nolimit')){_0x35ed5b['limit']=qs[_0xa66f('0x1f')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x1f')]);_0x35ed5b[_0xa66f('0x1e')]=qs[_0xa66f('0x1e')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x1e')]);}_0x35ed5b['order']=qs[_0xa66f('0x3c')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x3c')]);_0x35ed5b[_0xa66f('0x3e')]=qs['filters'](_[_0xa66f('0x4c')](_0x12271d[_0xa66f('0x33')],_0xe97cf4[_0xa66f('0x35')]));if(_0x12271d[_0xa66f('0x33')][_0xa66f('0x4d')]){_0x35ed5b[_0xa66f('0x3e')]=_['merge'](_0x35ed5b['where'],{'$or':_[_0xa66f('0x32')](_0x35ed5b[_0xa66f('0x36')],function(_0x174aad){var _0x52edb3={};_0x52edb3[_0x174aad]={'$like':'%'+_0x12271d[_0xa66f('0x33')][_0xa66f('0x4d')]+'%'};return _0x52edb3;})});}_0x35ed5b=_[_0xa66f('0x3d')]({},_0x35ed5b,_0x12271d[_0xa66f('0x46')]);var _0x17b2cf={'where':_0x35ed5b[_0xa66f('0x3e')]};return db[_0xa66f('0x2d')][_0xa66f('0x1d')](_0x17b2cf)[_0xa66f('0x26')](function(_0x5d4299){_0x53a62f[_0xa66f('0x1d')]=_0x5d4299;if(_0x12271d[_0xa66f('0x33')][_0xa66f('0x3f')]){_0x35ed5b[_0xa66f('0x40')]=[{'all':!![]}];}return db[_0xa66f('0x2d')][_0xa66f('0x41')](_0x35ed5b);})[_0xa66f('0x26')](function(_0x3b38ad){_0x53a62f['rows']=_0x3b38ad;return _0x53a62f;})['then'](respondWithFilteredResult(_0x2c79df,_0x35ed5b,_0xa66f('0x4b')))[_0xa66f('0x48')](handleError(_0x2c79df,null,_0xa66f('0x4b')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 843d097..ee58866 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 _0x08a9=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x1f448a,_0x477d9d){var _0x24c6ac=function(_0x114123){while(--_0x114123){_0x1f448a['push'](_0x1f448a['shift']());}};_0x24c6ac(++_0x477d9d);}(_0x08a9,0xf6));var _0x908a=function(_0xeeea5,_0x92458a){_0xeeea5=_0xeeea5-0x0;var _0x5b7b6a=_0x08a9[_0xeeea5];return _0x5b7b6a;};'use strict';var EventEmitter=require(_0x908a('0x0'));var VoiceQueueReport=require(_0x908a('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x908a('0x2')](0x0);var events={'afterCreate':_0x908a('0x3'),'afterUpdate':_0x908a('0x4'),'afterDestroy':_0x908a('0x5')};function emitEvent(_0x96cdff){return function(_0x5a56cb,_0x500ab6,_0x132b5a){VoiceQueueReportEvents['emit'](_0x96cdff+':'+_0x5a56cb['id'],_0x5a56cb);VoiceQueueReportEvents[_0x908a('0x6')](_0x96cdff,_0x5a56cb);_0x132b5a(null);};}for(var e in events){if(events[_0x908a('0x7')](e)){var event=events[e];VoiceQueueReport[_0x908a('0x8')](e,emitEvent(event));}}module[_0x908a('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x2d88=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport'];(function(_0x36dada,_0x2f9e98){var _0x19ce12=function(_0x5b9711){while(--_0x5b9711){_0x36dada['push'](_0x36dada['shift']());}};_0x19ce12(++_0x2f9e98);}(_0x2d88,0x110));var _0x82d8=function(_0x574294,_0x28b054){_0x574294=_0x574294-0x0;var _0x272995=_0x2d88[_0x574294];return _0x272995;};'use strict';var EventEmitter=require(_0x82d8('0x0'));var VoiceQueueReport=require(_0x82d8('0x1'))['db'][_0x82d8('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x82d8('0x3')](0x0);var events={'afterCreate':_0x82d8('0x4'),'afterUpdate':_0x82d8('0x5'),'afterDestroy':_0x82d8('0x6')};function emitEvent(_0x2923d2){return function(_0x21346c,_0x4f610f,_0x38ef91){VoiceQueueReportEvents[_0x82d8('0x7')](_0x2923d2+':'+_0x21346c['id'],_0x21346c);VoiceQueueReportEvents['emit'](_0x2923d2,_0x21346c);_0x38ef91(null);};}for(var e in events){if(events[_0x82d8('0x8')](e)){var event=events[e];VoiceQueueReport[_0x82d8('0x9')](e,emitEvent(event));}}module[_0x82d8('0xa')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index b6abbe8..d4d55e9 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 _0x0b0e=['calleridnum','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid'];(function(_0x1215ec,_0x3786c9){var _0x16f2bc=function(_0x39902c){while(--_0x39902c){_0x1215ec['push'](_0x1215ec['shift']());}};_0x16f2bc(++_0x3786c9);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x0b0e[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe0b0('0xb')]},{'fields':[_0xe0b0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0xca0daa,_0x56dbe4){var _0x472553=function(_0x3ff875){while(--_0x3ff875){_0xca0daa['push'](_0xca0daa['shift']());}};_0x472553(++_0x56dbe4);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 3188d8b..e80b82b 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 _0x4c00=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','map','include','model','stringify','create','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body'];(function(_0x9138c0,_0x4002e1){var _0x2a8abb=function(_0x71c717){while(--_0x71c717){_0x9138c0['push'](_0x9138c0['shift']());}};_0x2a8abb(++_0x4002e1);}(_0x4c00,0x1a4));var _0x04c0=function(_0x1089fb,_0x2a412d){_0x1089fb=_0x1089fb-0x0;var _0x5deb2a=_0x4c00[_0x1089fb];return _0x5deb2a;};'use strict';var _=require('lodash');var util=require(_0x04c0('0x0'));var moment=require('moment');var BPromise=require(_0x04c0('0x1'));var rs=require(_0x04c0('0x2'));var fs=require('fs');var Redis=require(_0x04c0('0x3'));var db=require(_0x04c0('0x4'))['db'];var utils=require(_0x04c0('0x5'));var logger=require(_0x04c0('0x6'))(_0x04c0('0x7'));var config=require(_0x04c0('0x8'));var jayson=require(_0x04c0('0x9'));var client=jayson['client'][_0x04c0('0xa')]({'port':0x232a});config[_0x04c0('0xb')]=_[_0x04c0('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x04c0('0xd'))(new Redis(config[_0x04c0('0xb')]));require(_0x04c0('0xe'))['register'](socket);function respondWithRpcPromise(_0x4a59f6,_0x286afc,_0x11a877){return new BPromise(function(_0x2bdc6e,_0x400f5a){return client['request'](_0x4a59f6,_0x11a877)[_0x04c0('0xf')](function(_0x25222f){logger[_0x04c0('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x286afc,_0x04c0('0x11'));logger[_0x04c0('0x12')](_0x04c0('0x13'),_0x286afc,'request\x20sent',JSON['stringify'](_0x25222f));if(_0x25222f[_0x04c0('0x14')]){if(_0x25222f[_0x04c0('0x14')][_0x04c0('0x15')]===0x1f4){logger[_0x04c0('0x14')](_0x04c0('0x16'),_0x286afc,_0x25222f[_0x04c0('0x14')][_0x04c0('0x17')]);return _0x400f5a(_0x25222f['error'][_0x04c0('0x17')]);}logger[_0x04c0('0x14')](_0x04c0('0x16'),_0x286afc,_0x25222f[_0x04c0('0x14')][_0x04c0('0x17')]);return _0x2bdc6e(_0x25222f['error']['message']);}else{logger[_0x04c0('0x10')](_0x04c0('0x16'),_0x286afc,_0x04c0('0x11'));_0x2bdc6e(_0x25222f[_0x04c0('0x18')][_0x04c0('0x17')]);}})[_0x04c0('0x19')](function(_0x36e550){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x286afc,_0x36e550);_0x400f5a(_0x36e550);});});}exports[_0x04c0('0x1a')]=function(_0xf7cfcb){var _0x1a1ab6=this;return new Promise(function(_0xf9ca38,_0x192f40){return db[_0x04c0('0x1b')][_0x04c0('0x1c')]({'raw':_0xf7cfcb['options']?_0xf7cfcb[_0x04c0('0x1d')][_0x04c0('0x1e')]===undefined?!![]:![]:!![],'where':_0xf7cfcb[_0x04c0('0x1d')]?_0xf7cfcb[_0x04c0('0x1d')][_0x04c0('0x1f')]||null:null,'attributes':_0xf7cfcb[_0x04c0('0x1d')]?_0xf7cfcb[_0x04c0('0x1d')][_0x04c0('0x20')]||null:null,'limit':_0xf7cfcb[_0x04c0('0x1d')]?_0xf7cfcb[_0x04c0('0x1d')]['limit']||null:null,'include':_0xf7cfcb[_0x04c0('0x1d')]?_0xf7cfcb[_0x04c0('0x1d')]['include']?_[_0x04c0('0x21')](_0xf7cfcb[_0x04c0('0x1d')][_0x04c0('0x22')],function(_0x14b04b){return{'model':db[_0x14b04b[_0x04c0('0x23')]],'as':_0x14b04b['as'],'attributes':_0x14b04b['attributes'],'include':_0x14b04b[_0x04c0('0x22')]?_['map'](_0x14b04b[_0x04c0('0x22')],function(_0x553ab5){return{'model':db[_0x553ab5[_0x04c0('0x23')]],'as':_0x553ab5['as'],'attributes':_0x553ab5[_0x04c0('0x20')],'include':_0x553ab5['include']?_[_0x04c0('0x21')](_0x553ab5['include'],function(_0x12abc9){return{'model':db[_0x12abc9[_0x04c0('0x23')]],'as':_0x12abc9['as'],'attributes':_0x12abc9[_0x04c0('0x20')]};}):[]};}):[]};}):[]:[]})[_0x04c0('0xf')](function(_0x62e121){logger[_0x04c0('0x10')](_0x04c0('0x1a'),_0xf7cfcb);logger['debug'](_0x04c0('0x1a'),_0xf7cfcb,JSON[_0x04c0('0x24')](_0x62e121));_0xf9ca38(_0x62e121);})[_0x04c0('0x19')](function(_0x277e50){logger[_0x04c0('0x14')](_0x04c0('0x1a'),_0x277e50[_0x04c0('0x17')],_0xf7cfcb);_0x192f40(_0x1a1ab6[_0x04c0('0x14')](0x1f4,_0x277e50[_0x04c0('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0x3062a4){var _0x55852b=this;return new Promise(function(_0x1487db,_0xcd2337){return db[_0x04c0('0x1b')][_0x04c0('0x25')](_0x3062a4['body'],{'raw':_0x3062a4[_0x04c0('0x1d')]?_0x3062a4[_0x04c0('0x1d')][_0x04c0('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x36b433){logger['info'](_0x04c0('0x26'),_0x3062a4);logger[_0x04c0('0x12')](_0x04c0('0x26'),_0x3062a4,JSON['stringify'](_0x36b433));_0x1487db(_0x36b433);})['catch'](function(_0x4cadda){logger['error'](_0x04c0('0x26'),_0x4cadda['message'],_0x3062a4);_0xcd2337(_0x55852b[_0x04c0('0x14')](0x1f4,_0x4cadda[_0x04c0('0x17')]));});});};exports[_0x04c0('0x27')]=function(_0x55a7bd){var _0x3cefaa=this;return new Promise(function(_0x4087b6,_0x287a30){return db[_0x04c0('0x1b')][_0x04c0('0x28')](_0x55a7bd[_0x04c0('0x29')],{'raw':_0x55a7bd[_0x04c0('0x1d')]?_0x55a7bd['options'][_0x04c0('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55a7bd['options']?_0x55a7bd[_0x04c0('0x1d')][_0x04c0('0x1f')]||null:null,'attributes':_0x55a7bd[_0x04c0('0x1d')]?_0x55a7bd['options'][_0x04c0('0x20')]||null:null,'limit':_0x55a7bd['options']?_0x55a7bd['options']['limit']||null:null})['then'](function(_0x626105){logger[_0x04c0('0x10')]('UpdateVoiceQueueReport',_0x55a7bd);logger[_0x04c0('0x12')](_0x04c0('0x27'),_0x55a7bd,JSON['stringify'](_0x626105));_0x4087b6(_0x626105);})[_0x04c0('0x19')](function(_0x251493){logger[_0x04c0('0x14')](_0x04c0('0x27'),_0x251493[_0x04c0('0x17')],_0x55a7bd);_0x287a30(_0x3cefaa['error'](0x1f4,_0x251493[_0x04c0('0x17')]));});});}; \ No newline at end of file +var _0xea2f=['GetVoiceQueueReport','VoiceQueueReport','findAll','options','where','attributes','include','map','model','then','CreateVoiceQueueReport','create','body','raw','UpdateVoiceQueueReport','update','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueueReport.socket','register','request','info','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch'];(function(_0x580d2f,_0x156235){var _0xf1ecdb=function(_0x3a5275){while(--_0x3a5275){_0x580d2f['push'](_0x580d2f['shift']());}};_0xf1ecdb(++_0x156235);}(_0xea2f,0x6d));var _0xfea2=function(_0x480fe3,_0x453d29){_0x480fe3=_0x480fe3-0x0;var _0x5e3142=_0xea2f[_0x480fe3];return _0x5e3142;};'use strict';var _=require(_0xfea2('0x0'));var util=require('util');var moment=require(_0xfea2('0x1'));var BPromise=require(_0xfea2('0x2'));var rs=require(_0xfea2('0x3'));var fs=require('fs');var Redis=require(_0xfea2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfea2('0x5'));var logger=require(_0xfea2('0x6'))('rpc');var config=require(_0xfea2('0x7'));var jayson=require(_0xfea2('0x8'));var client=jayson[_0xfea2('0x9')][_0xfea2('0xa')]({'port':0x232a});config['redis']=_[_0xfea2('0xb')](config['redis'],{'host':_0xfea2('0xc'),'port':0x18eb});var socket=require(_0xfea2('0xd'))(new Redis(config[_0xfea2('0xe')]));require(_0xfea2('0xf'))[_0xfea2('0x10')](socket);function respondWithRpcPromise(_0x307cb9,_0x341a78,_0x286ba4){return new BPromise(function(_0x231bf3,_0x531220){return client[_0xfea2('0x11')](_0x307cb9,_0x286ba4)['then'](function(_0x22fde8){logger[_0xfea2('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x341a78,'request\x20sent');logger[_0xfea2('0x13')](_0xfea2('0x14'),_0x341a78,_0xfea2('0x15'),JSON[_0xfea2('0x16')](_0x22fde8));if(_0x22fde8['error']){if(_0x22fde8[_0xfea2('0x17')][_0xfea2('0x18')]===0x1f4){logger[_0xfea2('0x17')](_0xfea2('0x19'),_0x341a78,_0x22fde8[_0xfea2('0x17')][_0xfea2('0x1a')]);return _0x531220(_0x22fde8[_0xfea2('0x17')]['message']);}logger['error'](_0xfea2('0x19'),_0x341a78,_0x22fde8['error'][_0xfea2('0x1a')]);return _0x231bf3(_0x22fde8['error'][_0xfea2('0x1a')]);}else{logger[_0xfea2('0x12')](_0xfea2('0x19'),_0x341a78,_0xfea2('0x15'));_0x231bf3(_0x22fde8[_0xfea2('0x1b')][_0xfea2('0x1a')]);}})[_0xfea2('0x1c')](function(_0x459e16){logger[_0xfea2('0x17')](_0xfea2('0x19'),_0x341a78,_0x459e16);_0x531220(_0x459e16);});});}exports[_0xfea2('0x1d')]=function(_0x17bc7e){var _0x280dee=this;return new Promise(function(_0x40672f,_0x1feb6b){return db[_0xfea2('0x1e')][_0xfea2('0x1f')]({'raw':_0x17bc7e['options']?_0x17bc7e[_0xfea2('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x17bc7e['options']?_0x17bc7e[_0xfea2('0x20')][_0xfea2('0x21')]||null:null,'attributes':_0x17bc7e['options']?_0x17bc7e[_0xfea2('0x20')][_0xfea2('0x22')]||null:null,'limit':_0x17bc7e[_0xfea2('0x20')]?_0x17bc7e['options']['limit']||null:null,'include':_0x17bc7e[_0xfea2('0x20')]?_0x17bc7e['options'][_0xfea2('0x23')]?_[_0xfea2('0x24')](_0x17bc7e['options'][_0xfea2('0x23')],function(_0x521bc9){return{'model':db[_0x521bc9[_0xfea2('0x25')]],'as':_0x521bc9['as'],'attributes':_0x521bc9[_0xfea2('0x22')],'include':_0x521bc9[_0xfea2('0x23')]?_['map'](_0x521bc9['include'],function(_0x29ffaa){return{'model':db[_0x29ffaa[_0xfea2('0x25')]],'as':_0x29ffaa['as'],'attributes':_0x29ffaa[_0xfea2('0x22')],'include':_0x29ffaa[_0xfea2('0x23')]?_['map'](_0x29ffaa[_0xfea2('0x23')],function(_0x3b61e3){return{'model':db[_0x3b61e3['model']],'as':_0x3b61e3['as'],'attributes':_0x3b61e3[_0xfea2('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfea2('0x26')](function(_0x53de83){logger[_0xfea2('0x12')](_0xfea2('0x1d'),_0x17bc7e);logger[_0xfea2('0x13')](_0xfea2('0x1d'),_0x17bc7e,JSON['stringify'](_0x53de83));_0x40672f(_0x53de83);})[_0xfea2('0x1c')](function(_0x407085){logger[_0xfea2('0x17')](_0xfea2('0x1d'),_0x407085[_0xfea2('0x1a')],_0x17bc7e);_0x1feb6b(_0x280dee[_0xfea2('0x17')](0x1f4,_0x407085[_0xfea2('0x1a')]));});});};exports[_0xfea2('0x27')]=function(_0x3fffab){var _0x3d6011=this;return new Promise(function(_0x96be5f,_0x127b08){return db[_0xfea2('0x1e')][_0xfea2('0x28')](_0x3fffab[_0xfea2('0x29')],{'raw':_0x3fffab[_0xfea2('0x20')]?_0x3fffab[_0xfea2('0x20')][_0xfea2('0x2a')]===undefined?!![]:![]:!![]})[_0xfea2('0x26')](function(_0x124f72){logger[_0xfea2('0x12')]('CreateVoiceQueueReport',_0x3fffab);logger[_0xfea2('0x13')]('CreateVoiceQueueReport',_0x3fffab,JSON['stringify'](_0x124f72));_0x96be5f(_0x124f72);})[_0xfea2('0x1c')](function(_0x3061e0){logger['error'](_0xfea2('0x27'),_0x3061e0[_0xfea2('0x1a')],_0x3fffab);_0x127b08(_0x3d6011[_0xfea2('0x17')](0x1f4,_0x3061e0[_0xfea2('0x1a')]));});});};exports[_0xfea2('0x2b')]=function(_0x15305d){var _0x38b49f=this;return new Promise(function(_0x46a9d4,_0x37e9ad){return db[_0xfea2('0x1e')][_0xfea2('0x2c')](_0x15305d[_0xfea2('0x29')],{'raw':_0x15305d[_0xfea2('0x20')]?_0x15305d[_0xfea2('0x20')][_0xfea2('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15305d[_0xfea2('0x20')]?_0x15305d[_0xfea2('0x20')][_0xfea2('0x21')]||null:null,'attributes':_0x15305d[_0xfea2('0x20')]?_0x15305d[_0xfea2('0x20')][_0xfea2('0x22')]||null:null,'limit':_0x15305d[_0xfea2('0x20')]?_0x15305d[_0xfea2('0x20')][_0xfea2('0x2d')]||null:null})[_0xfea2('0x26')](function(_0x44304a){logger[_0xfea2('0x12')]('UpdateVoiceQueueReport',_0x15305d);logger[_0xfea2('0x13')](_0xfea2('0x2b'),_0x15305d,JSON[_0xfea2('0x16')](_0x44304a));_0x46a9d4(_0x44304a);})[_0xfea2('0x1c')](function(_0x40e5b2){logger[_0xfea2('0x17')]('UpdateVoiceQueueReport',_0x40e5b2[_0xfea2('0x1a')],_0x15305d);_0x37e9ad(_0x38b49f['error'](0x1f4,_0x40e5b2[_0xfea2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 82d9e21..150d8d5 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 _0x924d=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x7e3fc2,_0x51db17){var _0x3eed82=function(_0xdc9839){while(--_0xdc9839){_0x7e3fc2['push'](_0x7e3fc2['shift']());}};_0x3eed82(++_0x51db17);}(_0x924d,0x11a));var _0xd924=function(_0x2d0854,_0x4c5b12){_0x2d0854=_0x2d0854-0x0;var _0x287c91=_0x924d[_0x2d0854];return _0x287c91;};'use strict';var VoiceQueueReportEvents=require(_0xd924('0x0'));var events=[_0xd924('0x1'),_0xd924('0x2'),_0xd924('0x3')];function createListener(_0x128a6e,_0x687e8a){return function(_0x3cfe1b){_0x687e8a[_0xd924('0x4')](_0x128a6e,_0x3cfe1b);};}function removeListener(_0x30c08d,_0x1d07ef){return function(){VoiceQueueReportEvents[_0xd924('0x5')](_0x30c08d,_0x1d07ef);};}exports[_0xd924('0x6')]=function(_0x329e04){for(var _0x3d71bd=0x0,_0x3cd1af=events[_0xd924('0x7')];_0x3d71bd<_0x3cd1af;_0x3d71bd++){var _0x3eb3f5=events[_0x3d71bd];var _0x15a6cc=createListener(_0xd924('0x8')+_0x3eb3f5,_0x329e04);VoiceQueueReportEvents['on'](_0x3eb3f5,_0x15a6cc);}}; \ No newline at end of file +var _0x799d=['register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','emit'];(function(_0x405aed,_0x44cc54){var _0x1e9703=function(_0x266032){while(--_0x266032){_0x405aed['push'](_0x405aed['shift']());}};_0x1e9703(++_0x44cc54);}(_0x799d,0x7a));var _0xd799=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x799d[_0x2be8c2];return _0x97f531;};'use strict';var VoiceQueueReportEvents=require(_0xd799('0x0'));var events=[_0xd799('0x1'),_0xd799('0x2'),'update'];function createListener(_0x69f406,_0x4b72be){return function(_0x58c237){_0x4b72be[_0xd799('0x3')](_0x69f406,_0x58c237);};}function removeListener(_0x5b58c0,_0x3e16b1){return function(){VoiceQueueReportEvents['removeListener'](_0x5b58c0,_0x3e16b1);};}exports[_0xd799('0x4')]=function(_0x478f06){for(var _0x376ab5=0x0,_0x3c4e7d=events[_0xd799('0x5')];_0x376ab5<_0x3c4e7d;_0x376ab5++){var _0xe32b5d=events[_0x376ab5];var _0xd05b5e=createListener(_0xd799('0x6')+_0xe32b5d,_0x478f06);VoiceQueueReportEvents['on'](_0xe32b5d,_0xd05b5e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index fa26c75..b654a4e 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 _0xf185=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create','put','update','multer','path'];(function(_0x266b7e,_0x508736){var _0x541984=function(_0x3cdc2f){while(--_0x3cdc2f){_0x266b7e['push'](_0x266b7e['shift']());}};_0x541984(++_0x508736);}(_0xf185,0x1be));var _0x5f18=function(_0x4094f7,_0x35ce70){_0x4094f7=_0x4094f7-0x0;var _0x4a3475=_0xf185[_0x4094f7];return _0x4a3475;};'use strict';var multer=require(_0x5f18('0x0'));var util=require('util');var path=require(_0x5f18('0x1'));var timeout=require(_0x5f18('0x2'));var express=require(_0x5f18('0x3'));var router=express[_0x5f18('0x4')]();var auth=require(_0x5f18('0x5'));var interaction=require(_0x5f18('0x6'));var config=require('../../config/environment');var controller=require(_0x5f18('0x7'));router[_0x5f18('0x8')]('/',auth[_0x5f18('0x9')](),controller[_0x5f18('0xa')]);router['get'](_0x5f18('0xb'),auth[_0x5f18('0x9')](),controller['show']);router[_0x5f18('0xc')]('/',auth['isAuthenticated'](),controller[_0x5f18('0xd')]);router[_0x5f18('0xe')]('/:id',auth[_0x5f18('0x9')](),controller[_0x5f18('0xf')]);router['delete'](_0x5f18('0xb'),auth[_0x5f18('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb422=['update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','post','create'];(function(_0x4f431d,_0xd51a3b){var _0x4f31e1=function(_0x1c688d){while(--_0x1c688d){_0x4f431d['push'](_0x4f431d['shift']());}};_0x4f31e1(++_0xd51a3b);}(_0xb422,0x179));var _0x2b42=function(_0x4d77b8,_0x208e64){_0x4d77b8=_0x4d77b8-0x0;var _0x82da62=_0xb422[_0x4d77b8];return _0x82da62;};'use strict';var multer=require(_0x2b42('0x0'));var util=require(_0x2b42('0x1'));var path=require(_0x2b42('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2b42('0x3')]();var auth=require(_0x2b42('0x4'));var interaction=require(_0x2b42('0x5'));var config=require(_0x2b42('0x6'));var controller=require(_0x2b42('0x7'));router[_0x2b42('0x8')]('/',auth['isAuthenticated'](),controller[_0x2b42('0x9')]);router[_0x2b42('0x8')](_0x2b42('0xa'),auth[_0x2b42('0xb')](),controller['show']);router[_0x2b42('0xc')]('/',auth[_0x2b42('0xb')](),controller[_0x2b42('0xd')]);router['put'](_0x2b42('0xa'),auth[_0x2b42('0xb')](),controller[_0x2b42('0xe')]);router[_0x2b42('0xf')](_0x2b42('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2b42('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index da78cf2..73f2a9b 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 _0x1500=['exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x533401,_0x2cf8fb){var _0x8c090b=function(_0x39ecf2){while(--_0x39ecf2){_0x533401['push'](_0x533401['shift']());}};_0x8c090b(++_0x2cf8fb);}(_0x1500,0x64));var _0x0150=function(_0x4f1d89,_0x3c6c5a){_0x4f1d89=_0x4f1d89-0x0;var _0xfe2e22=_0x1500[_0x4f1d89];return _0xfe2e22;};'use strict';var Sequelize=require(_0x0150('0x0'));var moment=require(_0x0150('0x1'));module[_0x0150('0x2')]={'time':{'type':Sequelize[_0x0150('0x3')]},'callid':{'type':Sequelize[_0x0150('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x0150('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x0150('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x0150('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x0150('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x0150('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x0150('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x0150('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x0150('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0x0150('0x5'))}}; \ No newline at end of file +var _0x34e9=['format','sequelize','moment','exports','STRING','DATE'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x34e9,0xcd));var _0x934e=function(_0x1c99fa,_0x346c4d){_0x1c99fa=_0x1c99fa-0x0;var _0x14c9a4=_0x34e9[_0x1c99fa];return _0x14c9a4;};'use strict';var Sequelize=require(_0x934e('0x0'));var moment=require(_0x934e('0x1'));module[_0x934e('0x2')]={'time':{'type':Sequelize[_0x934e('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x934e('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x934e('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x934e('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x934e('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x934e('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x934e('0x4')],'allowNull':![],'defaultValue':moment()[_0x934e('0x5')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index a1cbad8..61f3209 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 _0xc49b=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','rows','catch','show','fields','include','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir'];(function(_0x224bcd,_0x1026dd){var _0xb33789=function(_0x3352a9){while(--_0x3352a9){_0x224bcd['push'](_0x224bcd['shift']());}};_0xb33789(++_0x1026dd);}(_0xc49b,0xdd));var _0xbc49=function(_0x13b37c,_0x4f616b){_0x13b37c=_0x13b37c-0x0;var _0x2d13fa=_0xc49b[_0x13b37c];return _0x2d13fa;};'use strict';var pdf=require(_0xbc49('0x0'));var emlformat=require(_0xbc49('0x1'));var rimraf=require(_0xbc49('0x2'));var zipdir=require(_0xbc49('0x3'));var jsonpatch=require(_0xbc49('0x4'));var rp=require(_0xbc49('0x5'));var moment=require(_0xbc49('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xbc49('0x7'));var util=require(_0xbc49('0x8'));var path=require(_0xbc49('0x9'));var sox=require(_0xbc49('0xa'));var csv=require(_0xbc49('0xb'));var ejs=require(_0xbc49('0xc'));var fs=require('fs');var _=require(_0xbc49('0xd'));var squel=require(_0xbc49('0xe'));var crypto=require(_0xbc49('0xf'));var jsforce=require(_0xbc49('0x10'));var deskjs=require(_0xbc49('0x11'));var toCsv=require(_0xbc49('0xb'));var querystring=require(_0xbc49('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbc49('0x13'));var qs=require(_0xbc49('0x14'));var as=require(_0xbc49('0x15'));var hardwareService=require(_0xbc49('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xbc49('0x17'));var db=require(_0xbc49('0x18'))['db'];function respondWithStatusCode(_0x5933cf,_0x105272){_0x105272=_0x105272||0xcc;return function(_0x96dee7){if(_0x96dee7){return _0x5933cf['sendStatus'](_0x105272);}return _0x5933cf[_0xbc49('0x19')](_0x105272)[_0xbc49('0x1a')]();};}function respondWithResult(_0x44c56c,_0x1e4661){_0x1e4661=_0x1e4661||0xc8;return function(_0x28bc6b){if(_0x28bc6b){return _0x44c56c[_0xbc49('0x19')](_0x1e4661)[_0xbc49('0x1b')](_0x28bc6b);}};}function respondWithFilteredResult(_0x4d4f47,_0x4b2df1){return function(_0x532b3a){if(_0x532b3a){var _0x124d5c=_0x532b3a['count'],_0x150905=_0x4b2df1[_0xbc49('0x1c')],_0x3a5348=_0x4b2df1['offset']+_0x4b2df1[_0xbc49('0x1d')],_0x352e21;if(_0x3a5348>=_0x124d5c){_0x3a5348=_0x124d5c;_0x352e21=0xc8;}else{_0x352e21=0xce;}_0x4d4f47[_0xbc49('0x19')](_0x352e21);return _0x4d4f47[_0xbc49('0x1e')]('Content-Range',_0x150905+'-'+_0x3a5348+'/'+_0x124d5c)['json'](_0x532b3a);}return null;};}function patchUpdates(_0x2893e3){return function(_0xd5ab10){try{jsonpatch[_0xbc49('0x1f')](_0xd5ab10,_0x2893e3,!![]);}catch(_0x3540b9){return BPromise['reject'](_0x3540b9);}return _0xd5ab10[_0xbc49('0x20')]();};}function saveUpdates(_0x2b0fdc,_0x5e69e5){return function(_0x538476){if(_0x538476){return _0x538476[_0xbc49('0x21')](_0x2b0fdc)[_0xbc49('0x22')](function(_0x461d93){return _0x461d93;});}return null;};}function removeEntity(_0x2d52d6,_0x1c4659){return function(_0x42e801){if(_0x42e801){return _0x42e801['destroy']()[_0xbc49('0x22')](function(){_0x2d52d6[_0xbc49('0x19')](0xcc)[_0xbc49('0x1a')]();});}};}function handleEntityNotFound(_0xc28c92,_0x459e58){return function(_0x4a5fdd){if(!_0x4a5fdd){_0xc28c92[_0xbc49('0x23')](0x194);}return _0x4a5fdd;};}function handleError(_0x41aa0b,_0x25e5ac){_0x25e5ac=_0x25e5ac||0x1f4;return function(_0x1ba525){logger[_0xbc49('0x24')](_0x1ba525[_0xbc49('0x25')]);if(_0x1ba525[_0xbc49('0x26')]){delete _0x1ba525[_0xbc49('0x26')];}_0x41aa0b['status'](_0x25e5ac)[_0xbc49('0x27')](_0x1ba525);};}exports[_0xbc49('0x28')]=function(_0x483142,_0x39e588){var _0x556d5c={},_0x47d06f={},_0x2f242f={'count':0x0,'rows':[]};var _0x304cbb=_[_0xbc49('0x29')](db[_0xbc49('0x2a')][_0xbc49('0x2b')],function(_0x3fa334){return{'name':_0x3fa334[_0xbc49('0x2c')],'type':_0x3fa334[_0xbc49('0x2d')][_0xbc49('0x2e')]};});_0x47d06f[_0xbc49('0x2f')]=_['map'](_0x304cbb,'name');_0x47d06f[_0xbc49('0x30')]=_[_0xbc49('0x31')](_0x483142['query']);_0x47d06f[_0xbc49('0x32')]=_[_0xbc49('0x33')](_0x47d06f[_0xbc49('0x2f')],_0x47d06f[_0xbc49('0x30')]);_0x556d5c[_0xbc49('0x34')]=_[_0xbc49('0x33')](_0x47d06f[_0xbc49('0x2f')],qs['fields'](_0x483142['query']['fields']));_0x556d5c[_0xbc49('0x34')]=_0x556d5c[_0xbc49('0x34')][_0xbc49('0x35')]?_0x556d5c['attributes']:_0x47d06f[_0xbc49('0x2f')];if(!_0x483142[_0xbc49('0x30')][_0xbc49('0x36')](_0xbc49('0x37'))){_0x556d5c[_0xbc49('0x1d')]=qs[_0xbc49('0x1d')](_0x483142[_0xbc49('0x30')][_0xbc49('0x1d')]);_0x556d5c[_0xbc49('0x1c')]=qs[_0xbc49('0x1c')](_0x483142[_0xbc49('0x30')][_0xbc49('0x1c')]);}_0x556d5c[_0xbc49('0x38')]=qs['sort'](_0x483142[_0xbc49('0x30')][_0xbc49('0x39')]);_0x556d5c[_0xbc49('0x3a')]=qs[_0xbc49('0x32')](_[_0xbc49('0x3b')](_0x483142[_0xbc49('0x30')],_0x47d06f[_0xbc49('0x32')]));if(_0x483142[_0xbc49('0x30')][_0xbc49('0x3c')]){_0x556d5c[_0xbc49('0x3a')]=_[_0xbc49('0x3d')](_0x556d5c[_0xbc49('0x3a')],{'$or':_[_0xbc49('0x29')](_0x304cbb,function(_0x224ef3){if(_0x224ef3[_0xbc49('0x2d')]!=='VIRTUAL'){var _0x4d7fdf={};_0x4d7fdf[_0x224ef3[_0xbc49('0x26')]]={'$like':'%'+_0x483142[_0xbc49('0x30')][_0xbc49('0x3c')]+'%'};return _0x4d7fdf;}})});}_0x556d5c=_['merge']({},_0x556d5c,_0x483142[_0xbc49('0x3e')]);var _0x298b5e={'where':_0x556d5c[_0xbc49('0x3a')]};return db[_0xbc49('0x2a')][_0xbc49('0x3f')](_0x298b5e)[_0xbc49('0x22')](function(_0x3e5247){_0x2f242f[_0xbc49('0x3f')]=_0x3e5247;if(_0x483142[_0xbc49('0x30')][_0xbc49('0x40')]){_0x556d5c['include']=[{'all':!![]}];}return db[_0xbc49('0x2a')][_0xbc49('0x41')](_0x556d5c);})[_0xbc49('0x22')](function(_0x266f06){_0x2f242f[_0xbc49('0x42')]=_0x266f06;return _0x2f242f;})[_0xbc49('0x22')](respondWithFilteredResult(_0x39e588,_0x556d5c))[_0xbc49('0x43')](handleError(_0x39e588,null));};exports[_0xbc49('0x44')]=function(_0x24fe43,_0x590936){var _0x2f66f1={'raw':!![],'where':{'id':_0x24fe43['params']['id']}},_0x21375e={};_0x21375e[_0xbc49('0x2f')]=_['keys'](db[_0xbc49('0x2a')][_0xbc49('0x2b')]);_0x21375e[_0xbc49('0x30')]=_[_0xbc49('0x31')](_0x24fe43['query']);_0x21375e['filters']=_['intersection'](_0x21375e['model'],_0x21375e[_0xbc49('0x30')]);_0x2f66f1['attributes']=_[_0xbc49('0x33')](_0x21375e[_0xbc49('0x2f')],qs[_0xbc49('0x45')](_0x24fe43['query'][_0xbc49('0x45')]));_0x2f66f1[_0xbc49('0x34')]=_0x2f66f1[_0xbc49('0x34')]['length']?_0x2f66f1[_0xbc49('0x34')]:_0x21375e[_0xbc49('0x2f')];if(_0x24fe43['query'][_0xbc49('0x40')]){_0x2f66f1[_0xbc49('0x46')]=[{'all':!![]}];}_0x2f66f1=_[_0xbc49('0x3d')]({},_0x2f66f1,_0x24fe43[_0xbc49('0x3e')]);return db[_0xbc49('0x2a')][_0xbc49('0x47')](_0x2f66f1)[_0xbc49('0x22')](handleEntityNotFound(_0x590936,null))[_0xbc49('0x22')](respondWithResult(_0x590936,null))[_0xbc49('0x43')](handleError(_0x590936,null));};exports[_0xbc49('0x48')]=function(_0x3bf674,_0x4fd2ea){return db[_0xbc49('0x2a')][_0xbc49('0x48')](_0x3bf674[_0xbc49('0x49')],{})[_0xbc49('0x22')](respondWithResult(_0x4fd2ea,0xc9))[_0xbc49('0x43')](handleError(_0x4fd2ea,null));};exports[_0xbc49('0x21')]=function(_0x71772,_0x51ca94){if(_0x71772[_0xbc49('0x49')]['id']){delete _0x71772['body']['id'];}return db[_0xbc49('0x2a')]['find']({'where':{'id':_0x71772[_0xbc49('0x4a')]['id']}})['then'](handleEntityNotFound(_0x51ca94,null))[_0xbc49('0x22')](saveUpdates(_0x71772[_0xbc49('0x49')],null))[_0xbc49('0x22')](respondWithResult(_0x51ca94,null))[_0xbc49('0x43')](handleError(_0x51ca94,null));};exports['destroy']=function(_0x442898,_0x1d90dc){return db[_0xbc49('0x2a')]['find']({'where':{'id':_0x442898[_0xbc49('0x4a')]['id']}})[_0xbc49('0x22')](handleEntityNotFound(_0x1d90dc,null))[_0xbc49('0x22')](removeEntity(_0x1d90dc,null))['catch'](handleError(_0x1d90dc,null));}; \ No newline at end of file +var _0xb18b=['../../config/utils','../../config/environment','sendStatus','status','end','json','count','set','Content-Range','apply','reject','save','update','then','error','stack','send','index','map','VoiceQueuesLog','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rawAttributes','intersection','find','catch','create','body','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5db891,_0x388e4b){var _0x45ce84=function(_0x26b4ff){while(--_0x26b4ff){_0x5db891['push'](_0x5db891['shift']());}};_0x45ce84(++_0x388e4b);}(_0xb18b,0x1dd));var _0xbb18=function(_0x25cb8a,_0x20a64a){_0x25cb8a=_0x25cb8a-0x0;var _0x30c640=_0xb18b[_0x25cb8a];return _0x30c640;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbb18('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbb18('0x1'));var rp=require(_0xbb18('0x2'));var moment=require(_0xbb18('0x3'));var BPromise=require(_0xbb18('0x4'));var Mustache=require(_0xbb18('0x5'));var util=require('util');var path=require('path');var sox=require(_0xbb18('0x6'));var csv=require(_0xbb18('0x7'));var ejs=require(_0xbb18('0x8'));var fs=require('fs');var _=require(_0xbb18('0x9'));var squel=require(_0xbb18('0xa'));var crypto=require(_0xbb18('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xbb18('0xc'));var toCsv=require(_0xbb18('0x7'));var querystring=require(_0xbb18('0xd'));var Papa=require(_0xbb18('0xe'));var Redis=require(_0xbb18('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbb18('0x10'));var hardwareService=require(_0xbb18('0x11'));var logger=require(_0xbb18('0x12'))(_0xbb18('0x13'));var utils=require(_0xbb18('0x14'));var config=require(_0xbb18('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c77b7,_0xcfee48){_0xcfee48=_0xcfee48||0xcc;return function(_0x4ecd88){if(_0x4ecd88){return _0x3c77b7[_0xbb18('0x16')](_0xcfee48);}return _0x3c77b7[_0xbb18('0x17')](_0xcfee48)[_0xbb18('0x18')]();};}function respondWithResult(_0x2bd473,_0x39d5bb){_0x39d5bb=_0x39d5bb||0xc8;return function(_0x384bf7){if(_0x384bf7){return _0x2bd473[_0xbb18('0x17')](_0x39d5bb)[_0xbb18('0x19')](_0x384bf7);}};}function respondWithFilteredResult(_0x4a07de,_0x3d113b){return function(_0x4473fe){if(_0x4473fe){var _0x330e04=_0x4473fe[_0xbb18('0x1a')],_0x5c3f5d=_0x3d113b['offset'],_0x1be62=_0x3d113b['offset']+_0x3d113b['limit'],_0x202f4b;if(_0x1be62>=_0x330e04){_0x1be62=_0x330e04;_0x202f4b=0xc8;}else{_0x202f4b=0xce;}_0x4a07de[_0xbb18('0x17')](_0x202f4b);return _0x4a07de[_0xbb18('0x1b')](_0xbb18('0x1c'),_0x5c3f5d+'-'+_0x1be62+'/'+_0x330e04)[_0xbb18('0x19')](_0x4473fe);}return null;};}function patchUpdates(_0x80144a){return function(_0x33e25d){try{jsonpatch[_0xbb18('0x1d')](_0x33e25d,_0x80144a,!![]);}catch(_0x18cf63){return BPromise[_0xbb18('0x1e')](_0x18cf63);}return _0x33e25d[_0xbb18('0x1f')]();};}function saveUpdates(_0x39013f,_0xc28f8e){return function(_0x2b8781){if(_0x2b8781){return _0x2b8781[_0xbb18('0x20')](_0x39013f)[_0xbb18('0x21')](function(_0x3eff50){return _0x3eff50;});}return null;};}function removeEntity(_0x16f763,_0xcae70c){return function(_0x22726f){if(_0x22726f){return _0x22726f['destroy']()[_0xbb18('0x21')](function(){_0x16f763[_0xbb18('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15b2e7,_0x44c96e){return function(_0x58f129){if(!_0x58f129){_0x15b2e7[_0xbb18('0x16')](0x194);}return _0x58f129;};}function handleError(_0x2320ea,_0x3ba61b){_0x3ba61b=_0x3ba61b||0x1f4;return function(_0x3debd7){logger[_0xbb18('0x22')](_0x3debd7[_0xbb18('0x23')]);if(_0x3debd7['name']){delete _0x3debd7['name'];}_0x2320ea['status'](_0x3ba61b)[_0xbb18('0x24')](_0x3debd7);};}exports[_0xbb18('0x25')]=function(_0x31b65a,_0x9f44d4){var _0x2b165b={},_0x2d6b73={},_0x1e1aa4={'count':0x0,'rows':[]};var _0x447b01=_[_0xbb18('0x26')](db[_0xbb18('0x27')]['rawAttributes'],function(_0x4eef25){return{'name':_0x4eef25['fieldName'],'type':_0x4eef25[_0xbb18('0x28')][_0xbb18('0x29')]};});_0x2d6b73[_0xbb18('0x2a')]=_[_0xbb18('0x26')](_0x447b01,'name');_0x2d6b73['query']=_[_0xbb18('0x2b')](_0x31b65a[_0xbb18('0x2c')]);_0x2d6b73[_0xbb18('0x2d')]=_['intersection'](_0x2d6b73[_0xbb18('0x2a')],_0x2d6b73[_0xbb18('0x2c')]);_0x2b165b[_0xbb18('0x2e')]=_['intersection'](_0x2d6b73[_0xbb18('0x2a')],qs[_0xbb18('0x2f')](_0x31b65a[_0xbb18('0x2c')][_0xbb18('0x2f')]));_0x2b165b[_0xbb18('0x2e')]=_0x2b165b[_0xbb18('0x2e')][_0xbb18('0x30')]?_0x2b165b['attributes']:_0x2d6b73[_0xbb18('0x2a')];if(!_0x31b65a[_0xbb18('0x2c')][_0xbb18('0x31')]('nolimit')){_0x2b165b[_0xbb18('0x32')]=qs[_0xbb18('0x32')](_0x31b65a[_0xbb18('0x2c')]['limit']);_0x2b165b['offset']=qs['offset'](_0x31b65a[_0xbb18('0x2c')][_0xbb18('0x33')]);}_0x2b165b[_0xbb18('0x34')]=qs[_0xbb18('0x35')](_0x31b65a[_0xbb18('0x2c')][_0xbb18('0x35')]);_0x2b165b[_0xbb18('0x36')]=qs['filters'](_[_0xbb18('0x37')](_0x31b65a[_0xbb18('0x2c')],_0x2d6b73['filters']));if(_0x31b65a[_0xbb18('0x2c')][_0xbb18('0x38')]){_0x2b165b[_0xbb18('0x36')]=_[_0xbb18('0x39')](_0x2b165b[_0xbb18('0x36')],{'$or':_['map'](_0x447b01,function(_0x41809e){if(_0x41809e['type']!==_0xbb18('0x3a')){var _0x4b474e={};_0x4b474e[_0x41809e[_0xbb18('0x3b')]]={'$like':'%'+_0x31b65a[_0xbb18('0x2c')][_0xbb18('0x38')]+'%'};return _0x4b474e;}})});}_0x2b165b=_[_0xbb18('0x39')]({},_0x2b165b,_0x31b65a[_0xbb18('0x3c')]);var _0x1384d8={'where':_0x2b165b['where']};return db[_0xbb18('0x27')]['count'](_0x1384d8)[_0xbb18('0x21')](function(_0x373b20){_0x1e1aa4[_0xbb18('0x1a')]=_0x373b20;if(_0x31b65a['query'][_0xbb18('0x3d')]){_0x2b165b[_0xbb18('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xbb18('0x3f')](_0x2b165b);})['then'](function(_0x2bfa3e){_0x1e1aa4['rows']=_0x2bfa3e;return _0x1e1aa4;})[_0xbb18('0x21')](respondWithFilteredResult(_0x9f44d4,_0x2b165b))['catch'](handleError(_0x9f44d4,null));};exports['show']=function(_0x5279dc,_0x4559bf){var _0x50829b={'raw':!![],'where':{'id':_0x5279dc['params']['id']}},_0x1236f7={};_0x1236f7['model']=_['keys'](db['VoiceQueuesLog'][_0xbb18('0x40')]);_0x1236f7[_0xbb18('0x2c')]=_['keys'](_0x5279dc[_0xbb18('0x2c')]);_0x1236f7[_0xbb18('0x2d')]=_[_0xbb18('0x41')](_0x1236f7[_0xbb18('0x2a')],_0x1236f7['query']);_0x50829b[_0xbb18('0x2e')]=_['intersection'](_0x1236f7['model'],qs[_0xbb18('0x2f')](_0x5279dc[_0xbb18('0x2c')][_0xbb18('0x2f')]));_0x50829b['attributes']=_0x50829b['attributes'][_0xbb18('0x30')]?_0x50829b[_0xbb18('0x2e')]:_0x1236f7['model'];if(_0x5279dc[_0xbb18('0x2c')][_0xbb18('0x3d')]){_0x50829b['include']=[{'all':!![]}];}_0x50829b=_[_0xbb18('0x39')]({},_0x50829b,_0x5279dc[_0xbb18('0x3c')]);return db[_0xbb18('0x27')][_0xbb18('0x42')](_0x50829b)['then'](handleEntityNotFound(_0x4559bf,null))['then'](respondWithResult(_0x4559bf,null))[_0xbb18('0x43')](handleError(_0x4559bf,null));};exports[_0xbb18('0x44')]=function(_0x2f6610,_0x324d40){return db['VoiceQueuesLog'][_0xbb18('0x44')](_0x2f6610[_0xbb18('0x45')],{})['then'](respondWithResult(_0x324d40,0xc9))[_0xbb18('0x43')](handleError(_0x324d40,null));};exports['update']=function(_0x4e5933,_0x53ad01){if(_0x4e5933[_0xbb18('0x45')]['id']){delete _0x4e5933['body']['id'];}return db[_0xbb18('0x27')][_0xbb18('0x42')]({'where':{'id':_0x4e5933[_0xbb18('0x46')]['id']}})['then'](handleEntityNotFound(_0x53ad01,null))[_0xbb18('0x21')](saveUpdates(_0x4e5933[_0xbb18('0x45')],null))[_0xbb18('0x21')](respondWithResult(_0x53ad01,null))[_0xbb18('0x43')](handleError(_0x53ad01,null));};exports['destroy']=function(_0x1fa459,_0x2e529e){return db['VoiceQueuesLog'][_0xbb18('0x42')]({'where':{'id':_0x1fa459[_0xbb18('0x46')]['id']}})[_0xbb18('0x21')](handleEntityNotFound(_0x2e529e,null))[_0xbb18('0x21')](removeEntity(_0x2e529e,null))['catch'](handleError(_0x2e529e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 9a4c3ae..bc78a7e 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 _0xad74=['path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','voice_queues_log','event_dtm','util','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xad74,0xc2));var _0x4ad7=function(_0xa3b00b,_0x2b24d1){_0xa3b00b=_0xa3b00b-0x0;var _0x5b4963=_0xad74[_0xa3b00b];return _0x5b4963;};'use strict';var _=require('lodash');var util=require(_0x4ad7('0x0'));var logger=require('../../config/logger')(_0x4ad7('0x1'));var moment=require('moment');var BPromise=require(_0x4ad7('0x2'));var rp=require(_0x4ad7('0x3'));var fs=require('fs');var path=require(_0x4ad7('0x4'));var rimraf=require(_0x4ad7('0x5'));var config=require(_0x4ad7('0x6'));var attributes=require(_0x4ad7('0x7'));module[_0x4ad7('0x8')]=function(_0x35de73,_0x57abc7){return _0x35de73['define']('VoiceQueuesLog',attributes,{'tableName':_0x4ad7('0x9'),'paranoid':![],'indexes':[{'name':_0x4ad7('0xa'),'fields':['event','dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x3c5e=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','dtm','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x18cac4,_0x57a4d5){var _0x2227c6=function(_0x72934d){while(--_0x72934d){_0x18cac4['push'](_0x18cac4['shift']());}};_0x2227c6(++_0x57a4d5);}(_0x3c5e,0x171));var _0xe3c5=function(_0x3faad2,_0x361b2a){_0x3faad2=_0x3faad2-0x0;var _0x40a37c=_0x3c5e[_0x3faad2];return _0x40a37c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe3c5('0x0'))(_0xe3c5('0x1'));var moment=require(_0xe3c5('0x2'));var BPromise=require('bluebird');var rp=require(_0xe3c5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe3c5('0x4'));var attributes=require(_0xe3c5('0x5'));module[_0xe3c5('0x6')]=function(_0x2dae7c,_0x392f72){return _0x2dae7c[_0xe3c5('0x7')](_0xe3c5('0x8'),attributes,{'tableName':_0xe3c5('0x9'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':['event',_0xe3c5('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 4319485..746fc23 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 _0x9ffd=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x3c39f7,_0x3834a7){var _0x528afe=function(_0x20db7e){while(--_0x20db7e){_0x3c39f7['push'](_0x3c39f7['shift']());}};_0x528afe(++_0x3834a7);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1aa0e2,_0x45fa9f){_0x1aa0e2=_0x1aa0e2-0x0;var _0x11f410=_0x9ffd[_0x1aa0e2];return _0x11f410;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('VoiceQueuesLog,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});} \ No newline at end of file +var _0xa45c=['code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x52121e,_0x4e7ac8){var _0x2d7778=function(_0x41775c){while(--_0x41775c){_0x52121e['push'](_0x52121e['shift']());}};_0x2d7778(++_0x4e7ac8);}(_0xa45c,0x6d));var _0xca45=function(_0x466185,_0x24eaeb){_0x466185=_0x466185-0x0;var _0x4fa358=_0xa45c[_0x466185];return _0x4fa358;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca45('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca45('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xca45('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xca45('0x5'));var client=jayson[_0xca45('0x6')][_0xca45('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15628b,_0x578a7b,_0x1a8b9c){return new BPromise(function(_0x276897,_0x7ceab1){return client[_0xca45('0x8')](_0x15628b,_0x1a8b9c)[_0xca45('0x9')](function(_0x5c18b9){logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));logger[_0xca45('0xd')](_0xca45('0xe'),_0x578a7b,_0xca45('0xc'),JSON[_0xca45('0xf')](_0x5c18b9));if(_0x5c18b9['error']){if(_0x5c18b9[_0xca45('0x10')][_0xca45('0x11')]===0x1f4){logger[_0xca45('0x10')](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x7ceab1(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}logger['error'](_0xca45('0xb'),_0x578a7b,_0x5c18b9['error'][_0xca45('0x12')]);return _0x276897(_0x5c18b9[_0xca45('0x10')][_0xca45('0x12')]);}else{logger[_0xca45('0xa')](_0xca45('0xb'),_0x578a7b,_0xca45('0xc'));_0x276897(_0x5c18b9[_0xca45('0x13')]['message']);}})[_0xca45('0x14')](function(_0x5b4e29){logger['error'](_0xca45('0xb'),_0x578a7b,_0x5b4e29);_0x7ceab1(_0x5b4e29);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7fe096a..5d0b0b8 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 _0x73ce=['describe','/:id','show','/:id/download','/:id/downloads','downloads','post','create','put','update','delete','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe'];(function(_0x357ebc,_0x26f1d9){var _0x503547=function(_0x2d7d45){while(--_0x2d7d45){_0x357ebc['push'](_0x357ebc['shift']());}};_0x503547(++_0x26f1d9);}(_0x73ce,0x1d9));var _0xe73c=function(_0xcc93b7,_0x16a25d){_0xcc93b7=_0xcc93b7-0x0;var _0xb75303=_0x73ce[_0xcc93b7];return _0xb75303;};'use strict';var multer=require('multer');var util=require(_0xe73c('0x0'));var path=require(_0xe73c('0x1'));var timeout=require(_0xe73c('0x2'));var express=require(_0xe73c('0x3'));var router=express[_0xe73c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe73c('0x5'));var config=require('../../config/environment');var controller=require(_0xe73c('0x6'));router[_0xe73c('0x7')]('/',auth[_0xe73c('0x8')](),controller[_0xe73c('0x9')]);router[_0xe73c('0x7')](_0xe73c('0xa'),auth[_0xe73c('0x8')](),controller[_0xe73c('0xb')]);router['get'](_0xe73c('0xc'),auth[_0xe73c('0x8')](),controller[_0xe73c('0xd')]);router['get'](_0xe73c('0xe'),auth[_0xe73c('0x8')](),controller['download']);router[_0xe73c('0x7')](_0xe73c('0xf'),controller[_0xe73c('0x10')]);router[_0xe73c('0x11')]('/',auth[_0xe73c('0x8')](),controller[_0xe73c('0x12')]);router[_0xe73c('0x13')]('/:id',auth[_0xe73c('0x8')](),controller[_0xe73c('0x14')]);router[_0xe73c('0x15')]('/:id',auth[_0xe73c('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9acb=['downloads','post','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads'];(function(_0x6fc0ad,_0x428839){var _0x3f894c=function(_0x12516c){while(--_0x12516c){_0x6fc0ad['push'](_0x6fc0ad['shift']());}};_0x3f894c(++_0x428839);}(_0x9acb,0xd5));var _0xb9ac=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9acb[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xb9ac('0x0'));var util=require('util');var path=require(_0xb9ac('0x1'));var timeout=require(_0xb9ac('0x2'));var express=require(_0xb9ac('0x3'));var router=express['Router']();var auth=require(_0xb9ac('0x4'));var interaction=require(_0xb9ac('0x5'));var config=require('../../config/environment');var controller=require(_0xb9ac('0x6'));router[_0xb9ac('0x7')]('/',auth[_0xb9ac('0x8')](),controller[_0xb9ac('0x9')]);router['get'](_0xb9ac('0xa'),auth[_0xb9ac('0x8')](),controller[_0xb9ac('0xb')]);router[_0xb9ac('0x7')](_0xb9ac('0xc'),auth[_0xb9ac('0x8')](),controller[_0xb9ac('0xd')]);router[_0xb9ac('0x7')](_0xb9ac('0xe'),auth[_0xb9ac('0x8')](),controller[_0xb9ac('0xf')]);router['get'](_0xb9ac('0x10'),controller[_0xb9ac('0x11')]);router[_0xb9ac('0x12')]('/',auth[_0xb9ac('0x8')](),controller['create']);router['put'](_0xb9ac('0xc'),auth[_0xb9ac('0x8')](),controller[_0xb9ac('0x13')]);router[_0xb9ac('0x14')](_0xb9ac('0xc'),auth['isAuthenticated'](),controller[_0xb9ac('0x15')]);module[_0xb9ac('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 d5e06ce..3c03d7f 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 _0x245c=['STRING','setDataValue','membername','split','INTEGER','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','moment','exports','VIRTUAL','getDataValue','value','extname'];(function(_0x5ce34a,_0x57887e){var _0x309350=function(_0x52a947){while(--_0x52a947){_0x5ce34a['push'](_0x5ce34a['shift']());}};_0x309350(++_0x57887e);}(_0x245c,0x10a));var _0xc245=function(_0xacd0ab,_0xfc52a2){_0xacd0ab=_0xacd0ab-0x0;var _0x121a0a=_0x245c[_0xacd0ab];return _0x121a0a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc245('0x0'));var path=require('path');module[_0xc245('0x1')]={'format':{'type':Sequelize[_0xc245('0x2')],'get':function(){return this[_0xc245('0x3')](_0xc245('0x4'))?path[_0xc245('0x5')](this[_0xc245('0x3')](_0xc245('0x4'))):undefined;}},'uniqueid':{'type':Sequelize[_0xc245('0x6')]},'channel':{'type':Sequelize[_0xc245('0x6')],'set':function(_0x5bcd47){if(_0x5bcd47){this['setDataValue']('channel',_0x5bcd47);this[_0xc245('0x7')](_0xc245('0x8'),_0x5bcd47[_0xc245('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc245('0x6')]},'calleridname':{'type':Sequelize[_0xc245('0x6')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xc245('0x6')]},'accountcode':{'type':Sequelize[_0xc245('0x6')]},'context':{'type':Sequelize[_0xc245('0x6')]},'exten':{'type':Sequelize[_0xc245('0x6')]},'value':{'type':Sequelize[_0xc245('0x6')]},'type':{'type':Sequelize[_0xc245('0x6')]},'rating':{'type':Sequelize[_0xc245('0xa')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xc245('0x6')]},'userDisposition':{'type':Sequelize[_0xc245('0x6')]},'createdAt':{'type':Sequelize[_0xc245('0xb')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0xc245('0xc')](_0xc245('0xd'))[_0xc245('0xe')]();}},'updatedAt':{'type':Sequelize[_0xc245('0xb')],'get':function(){return moment(this['getDataValue'](_0xc245('0xf')))[_0xc245('0xc')](_0xc245('0xd'))[_0xc245('0xe')]();}}}; \ No newline at end of file +var _0x108b=['STRING','setDataValue','channel','membername','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','moment','VIRTUAL','getDataValue','value','extname'];(function(_0x178b4a,_0x26620f){var _0xd63d65=function(_0x590bf6){while(--_0x590bf6){_0x178b4a['push'](_0x178b4a['shift']());}};_0xd63d65(++_0x26620f);}(_0x108b,0x190));var _0xb108=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x108b[_0x5f09c5];return _0x426ad9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb108('0x0'));var path=require('path');module['exports']={'format':{'type':Sequelize[_0xb108('0x1')],'get':function(){return this[_0xb108('0x2')](_0xb108('0x3'))?path[_0xb108('0x4')](this[_0xb108('0x2')](_0xb108('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0xb108('0x5')]},'channel':{'type':Sequelize[_0xb108('0x5')],'set':function(_0x166630){if(_0x166630){this[_0xb108('0x6')](_0xb108('0x7'),_0x166630);this[_0xb108('0x6')](_0xb108('0x8'),_0x166630['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xb108('0x5')]},'calleridnum':{'type':Sequelize[_0xb108('0x5')]},'calleridname':{'type':Sequelize[_0xb108('0x5')]},'connectedlinenum':{'type':Sequelize[_0xb108('0x5')]},'connectedlinename':{'type':Sequelize[_0xb108('0x5')]},'accountcode':{'type':Sequelize[_0xb108('0x5')]},'context':{'type':Sequelize[_0xb108('0x5')]},'exten':{'type':Sequelize[_0xb108('0x5')]},'value':{'type':Sequelize[_0xb108('0x5')]},'type':{'type':Sequelize[_0xb108('0x5')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb108('0x2')](_0xb108('0x9')))[_0xb108('0xa')](_0xb108('0xb'))[_0xb108('0xc')]();}},'updatedAt':{'type':Sequelize[_0xb108('0xd')],'get':function(){return moment(this[_0xb108('0x2')](_0xb108('0xe')))[_0xb108('0xa')](_0xb108('0xb'))[_0xb108('0xc')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 613d685..d57d628 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 _0xfff4=['VoiceRecording\x20not\x20found','filename','extname','unlink','message','downloads','sequelize','col','token','$and','push','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name','send','index','map','VoiceRecording','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','keys','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError'];(function(_0x4eaf7e,_0x2afb74){var _0x31cb6a=function(_0x1c4708){while(--_0x1c4708){_0x4eaf7e['push'](_0x4eaf7e['shift']());}};_0x31cb6a(++_0x2afb74);}(_0xfff4,0x14a));var _0x4fff=function(_0x54ac7a,_0x313ae3){_0x54ac7a=_0x54ac7a-0x0;var _0x5a438e=_0xfff4[_0x54ac7a];return _0x5a438e;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4fff('0x0'));var BPromise=require(_0x4fff('0x1'));var Mustache=require(_0x4fff('0x2'));var util=require(_0x4fff('0x3'));var path=require(_0x4fff('0x4'));var sox=require(_0x4fff('0x5'));var csv=require(_0x4fff('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4fff('0x7'));var squel=require(_0x4fff('0x8'));var crypto=require(_0x4fff('0x9'));var jsforce=require(_0x4fff('0xa'));var deskjs=require(_0x4fff('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4fff('0xc'));var Papa=require(_0x4fff('0xd'));var Redis=require(_0x4fff('0xe'));var authService=require(_0x4fff('0xf'));var qs=require(_0x4fff('0x10'));var as=require(_0x4fff('0x11'));var hardwareService=require(_0x4fff('0x12'));var logger=require('../../config/logger')(_0x4fff('0x13'));var utils=require('../../config/utils');var config=require(_0x4fff('0x14'));var db=require(_0x4fff('0x15'))['db'];function respondWithStatusCode(_0x5661e1,_0x595e09){_0x595e09=_0x595e09||0xcc;return function(_0xdc463f){if(_0xdc463f){return _0x5661e1[_0x4fff('0x16')](_0x595e09);}return _0x5661e1[_0x4fff('0x17')](_0x595e09)[_0x4fff('0x18')]();};}function respondWithResult(_0x5ed4e7,_0x3812ad){_0x3812ad=_0x3812ad||0xc8;return function(_0x33bb06){if(_0x33bb06){return _0x5ed4e7[_0x4fff('0x17')](_0x3812ad)['json'](_0x33bb06);}};}function respondWithFilteredResult(_0x2852bb,_0xa790f4){return function(_0x248cd5){if(_0x248cd5){var _0x91b6cd=_0x248cd5['count'],_0x30d405=_0xa790f4[_0x4fff('0x19')],_0x3f1856=_0xa790f4[_0x4fff('0x19')]+_0xa790f4['limit'],_0x7f395b;if(_0x3f1856>=_0x91b6cd){_0x3f1856=_0x91b6cd;_0x7f395b=0xc8;}else{_0x7f395b=0xce;}_0x2852bb[_0x4fff('0x17')](_0x7f395b);return _0x2852bb[_0x4fff('0x1a')](_0x4fff('0x1b'),_0x30d405+'-'+_0x3f1856+'/'+_0x91b6cd)[_0x4fff('0x1c')](_0x248cd5);}return null;};}function patchUpdates(_0x2a9a3f){return function(_0x2bf35f){try{jsonpatch[_0x4fff('0x1d')](_0x2bf35f,_0x2a9a3f,!![]);}catch(_0x2687f7){return BPromise[_0x4fff('0x1e')](_0x2687f7);}return _0x2bf35f['save']();};}function saveUpdates(_0x461e6f,_0x3a83af){return function(_0x2ff72c){if(_0x2ff72c){return _0x2ff72c[_0x4fff('0x1f')](_0x461e6f)['then'](function(_0x5556ba){return _0x5556ba;});}return null;};}function removeEntity(_0xa0936,_0x9ea4c){return function(_0x2206cf){if(_0x2206cf){return _0x2206cf[_0x4fff('0x20')]()[_0x4fff('0x21')](function(){_0xa0936[_0x4fff('0x17')](0xcc)[_0x4fff('0x18')]();});}};}function handleEntityNotFound(_0x5701a4,_0x4ab72a){return function(_0x8a051e){if(!_0x8a051e){_0x5701a4[_0x4fff('0x16')](0x194);}return _0x8a051e;};}function handleError(_0x548df0,_0x56eb2e){_0x56eb2e=_0x56eb2e||0x1f4;return function(_0x50c3c7){logger[_0x4fff('0x22')](_0x50c3c7[_0x4fff('0x23')]);if(_0x50c3c7['name']){delete _0x50c3c7[_0x4fff('0x24')];}_0x548df0[_0x4fff('0x17')](_0x56eb2e)[_0x4fff('0x25')](_0x50c3c7);};}exports[_0x4fff('0x26')]=function(_0x193512,_0x383d64){var _0x2feda3={},_0x4558c3={},_0x2d3865={'count':0x0,'rows':[]};var _0x40deef=_[_0x4fff('0x27')](db[_0x4fff('0x28')][_0x4fff('0x29')],function(_0x2df60b){return{'name':_0x2df60b['fieldName'],'type':_0x2df60b[_0x4fff('0x2a')][_0x4fff('0x2b')]};});_0x4558c3['model']=_['differenceBy'](_[_0x4fff('0x27')](_0x40deef,_0x4fff('0x24')),['format']);_0x4558c3[_0x4fff('0x2c')]=_['keys'](_0x193512[_0x4fff('0x2c')]);_0x4558c3[_0x4fff('0x2d')]=_[_0x4fff('0x2e')](_0x4558c3[_0x4fff('0x2f')],_0x4558c3[_0x4fff('0x2c')]);_0x2feda3['attributes']=_['intersection'](_0x4558c3[_0x4fff('0x2f')],qs[_0x4fff('0x30')](_0x193512['query'][_0x4fff('0x30')]));_0x2feda3[_0x4fff('0x31')]=_0x2feda3['attributes'][_0x4fff('0x32')]?_0x2feda3[_0x4fff('0x31')]:_0x4558c3[_0x4fff('0x2f')];if(!_0x193512['query'][_0x4fff('0x33')](_0x4fff('0x34'))){_0x2feda3[_0x4fff('0x35')]=qs[_0x4fff('0x35')](_0x193512['query']['limit']);_0x2feda3[_0x4fff('0x19')]=qs[_0x4fff('0x19')](_0x193512['query'][_0x4fff('0x19')]);}_0x2feda3[_0x4fff('0x36')]=qs[_0x4fff('0x37')](_0x193512[_0x4fff('0x2c')]['sort']);_0x2feda3[_0x4fff('0x38')]=qs['filters'](_[_0x4fff('0x39')](_0x193512[_0x4fff('0x2c')],_0x4558c3['filters']));if(_0x193512[_0x4fff('0x2c')][_0x4fff('0x3a')]){_0x2feda3['where']=_[_0x4fff('0x3b')](_0x2feda3[_0x4fff('0x38')],{'$or':_['map'](_0x40deef,function(_0x4799f9){if(_0x4799f9[_0x4fff('0x2a')]!==_0x4fff('0x3c')){var _0x310b49={};_0x310b49[_0x4799f9[_0x4fff('0x24')]]={'$like':'%'+_0x193512[_0x4fff('0x2c')]['filter']+'%'};return _0x310b49;}})});}_0x2feda3=_['merge']({},_0x2feda3,_0x193512[_0x4fff('0x3d')]);var _0xc86a63={'where':_0x2feda3[_0x4fff('0x38')]};return db[_0x4fff('0x28')][_0x4fff('0x3e')](_0xc86a63)[_0x4fff('0x21')](function(_0x448e75){_0x2d3865[_0x4fff('0x3e')]=_0x448e75;if(_0x193512['query'][_0x4fff('0x3f')]){_0x2feda3[_0x4fff('0x40')]=[{'all':!![]}];}return db[_0x4fff('0x28')]['findAll'](_0x2feda3);})[_0x4fff('0x21')](function(_0x43f30f){_0x2d3865[_0x4fff('0x41')]=_0x43f30f;return _0x2d3865;})[_0x4fff('0x21')](respondWithFilteredResult(_0x383d64,_0x2feda3))['catch'](handleError(_0x383d64,null));};exports[_0x4fff('0x42')]=function(_0x2503f2,_0x1cadfe){var _0x4d9418={'raw':![],'where':{'id':_0x2503f2[_0x4fff('0x43')]['id']}},_0x7a78={};_0x7a78[_0x4fff('0x2f')]=_[_0x4fff('0x44')](db[_0x4fff('0x28')]['rawAttributes']);_0x7a78['query']=_[_0x4fff('0x44')](_0x2503f2[_0x4fff('0x2c')]);_0x7a78[_0x4fff('0x2d')]=_['intersection'](_0x7a78[_0x4fff('0x2f')],_0x7a78['query']);_0x4d9418['attributes']=_[_0x4fff('0x2e')](_0x7a78[_0x4fff('0x2f')],qs[_0x4fff('0x30')](_0x2503f2[_0x4fff('0x2c')][_0x4fff('0x30')]));_0x4d9418[_0x4fff('0x31')]=_0x4d9418[_0x4fff('0x31')][_0x4fff('0x32')]?_0x4d9418[_0x4fff('0x31')]:_0x7a78[_0x4fff('0x2f')];if(_0x2503f2[_0x4fff('0x2c')][_0x4fff('0x3f')]){_0x4d9418['include']=[{'all':!![]}];}_0x4d9418=_['merge']({},_0x4d9418,_0x2503f2[_0x4fff('0x3d')]);return db[_0x4fff('0x28')][_0x4fff('0x45')](_0x4d9418)[_0x4fff('0x21')](handleEntityNotFound(_0x1cadfe,null))[_0x4fff('0x21')](respondWithResult(_0x1cadfe,null))[_0x4fff('0x46')](handleError(_0x1cadfe,null));};exports[_0x4fff('0x47')]=function(_0x2a191d,_0x49cb24){return db[_0x4fff('0x28')][_0x4fff('0x47')](_0x2a191d[_0x4fff('0x48')],{})[_0x4fff('0x21')](respondWithResult(_0x49cb24,0xc9))[_0x4fff('0x46')](handleError(_0x49cb24,null));};exports[_0x4fff('0x1f')]=function(_0x35168a,_0x377752){if(_0x35168a[_0x4fff('0x48')]['id']){delete _0x35168a[_0x4fff('0x48')]['id'];}return db[_0x4fff('0x28')]['find']({'where':{'id':_0x35168a[_0x4fff('0x43')]['id']}})[_0x4fff('0x21')](handleEntityNotFound(_0x377752,null))[_0x4fff('0x21')](saveUpdates(_0x35168a[_0x4fff('0x48')],null))['then'](respondWithResult(_0x377752,null))[_0x4fff('0x46')](handleError(_0x377752,null));};exports[_0x4fff('0x49')]=function(_0x40c119,_0x2ed5b2){return db['VoiceRecording']['describe']()[_0x4fff('0x21')](respondWithResult(_0x2ed5b2,null))[_0x4fff('0x46')](handleError(_0x2ed5b2,null));};exports[_0x4fff('0x4a')]=function(_0x536ff9,_0x7b753c,_0x371c8e){var _0x2ee021=require(_0x4fff('0x4b'));var _0x565cca=![];var _0x416c81={};if(_0x536ff9[_0x4fff('0x2c')][_0x4fff('0x2a')]&&_0x536ff9['query'][_0x4fff('0x2a')]==='uniqueid'){_0x416c81[_0x4fff('0x4c')]=_0x536ff9[_0x4fff('0x43')]['id'];}else{_0x416c81['id']=_0x536ff9[_0x4fff('0x43')]['id'];}return db['VoiceRecording'][_0x4fff('0x45')]({'where':_0x416c81,'attributes':['id',_0x4fff('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x7b753c,null))[_0x4fff('0x21')](function(_0x413cc1){if(_0x413cc1){var _0x3e38ef=_0x413cc1[_0x4fff('0x4d')];var _0x4cc688=util[_0x4fff('0x4e')](_0x4fff('0x4f'),_0x3e38ef);if(fs[_0x4fff('0x50')](_0x4cc688)){_0x565cca=!![];return _0x2ee021[_0x4fff('0x51')](_0x4cc688,_0x3e38ef,config[_0x4fff('0x52')][_0x4fff('0x53')])['then'](function(){return _0x413cc1;});}return _0x413cc1;}})[_0x4fff('0x21')](function(_0x3a948a){if(_0x3a948a){var _0x1c5256=_0x3a948a[_0x4fff('0x4d')];if(!fs['existsSync'](_0x1c5256)){throw new db[(_0x4fff('0x54'))][(_0x4fff('0x55'))](_0x4fff('0x56'));}if(_0x3a948a[_0x4fff('0x57')]){return _0x7b753c[_0x4fff('0x4a')](_0x1c5256,_0x3a948a[_0x4fff('0x57')]+path[_0x4fff('0x58')](_0x1c5256),function(){if(_0x565cca){fs[_0x4fff('0x59')](_0x1c5256);}});}else{return _0x7b753c[_0x4fff('0x4a')](_0x1c5256,function(_0x355528){if(_0x565cca){fs[_0x4fff('0x59')](_0x1c5256);}});}}})['catch'](function(_0x59d910){if(_0x59d910[_0x4fff('0x5a')]===_0x4fff('0x56')){_0x7b753c['status'](0x194)[_0x4fff('0x25')]('Not\x20found');}else{return handleError(_0x7b753c,null);}});};exports[_0x4fff('0x5b')]=function(_0x5086e7,_0x4abae1,_0x529b5a){var _0x467be2=require(_0x4fff('0x4b'));var _0x4c27b3=![];var _0x25bf70={'$and':[db['sequelize'][_0x4fff('0x38')](db[_0x4fff('0x5c')]['fn']('MD5',db[_0x4fff('0x5c')][_0x4fff('0x5d')](_0x4fff('0x4c'))),_0x5086e7['query'][_0x4fff('0x5e')])]};if(_0x5086e7[_0x4fff('0x2c')][_0x4fff('0x2a')]&&_0x5086e7[_0x4fff('0x2c')][_0x4fff('0x2a')]===_0x4fff('0x4c')){_0x25bf70[_0x4fff('0x5f')][_0x4fff('0x60')]({'uniqueid':_0x5086e7[_0x4fff('0x43')]['id']});}else{_0x25bf70[_0x4fff('0x5f')]['push']({'id':_0x5086e7[_0x4fff('0x43')]['id']});}return db[_0x4fff('0x28')][_0x4fff('0x45')]({'where':_0x25bf70,'attributes':['id',_0x4fff('0x4d')],'raw':!![]})[_0x4fff('0x21')](handleEntityNotFound(_0x4abae1,null))[_0x4fff('0x21')](function(_0x384e6d){if(_0x384e6d){var _0x13b37=util[_0x4fff('0x4e')]('%s.cypher',_0x384e6d[_0x4fff('0x4d')]);if(fs[_0x4fff('0x50')](_0x13b37)){_0x4c27b3=!![];return _0x467be2[_0x4fff('0x51')](_0x13b37,_0x384e6d['value'],config[_0x4fff('0x52')][_0x4fff('0x53')])[_0x4fff('0x21')](function(){return _0x384e6d;});}return _0x384e6d;}})['then'](function(_0x3061d7){if(_0x3061d7){if(!fs[_0x4fff('0x50')](_0x3061d7['value'])){throw new db[(_0x4fff('0x54'))][(_0x4fff('0x55'))](_0x4fff('0x56'));}if(_0x3061d7[_0x4fff('0x57')]){return _0x4abae1['download'](_0x3061d7['value'],_0x3061d7['filename']+path[_0x4fff('0x58')](_0x3061d7['value']),function(){if(_0x4c27b3){fs[_0x4fff('0x59')](_0x3061d7[_0x4fff('0x4d')]);}});}else{return _0x4abae1[_0x4fff('0x4a')](_0x3061d7[_0x4fff('0x4d')],function(_0xb4e3de){if(_0x4c27b3){fs[_0x4fff('0x59')](_0x3061d7['value']);}});}}})[_0x4fff('0x46')](handleError(_0x4abae1,null));};exports[_0x4fff('0x20')]=function(_0x3df35f,_0x1713e1){return db[_0x4fff('0x28')][_0x4fff('0x45')]({'where':{'id':_0x3df35f[_0x4fff('0x43')]['id']}})[_0x4fff('0x21')](function(_0x5725ac){if(!_0x5725ac)throw new ReferenceError(_0x4fff('0x61'));return _0x5725ac;})['then'](function(_0x39b1ad){var _0x2e5a4a=_0x39b1ad[_0x4fff('0x4d')];logger['info'](_0x4fff('0x62'),_0x2e5a4a);if(!_[_0x4fff('0x63')](_0x39b1ad['value'])&&fs[_0x4fff('0x50')](_0x2e5a4a)){logger[_0x4fff('0x64')](_0x4fff('0x65')+_0x2e5a4a+_0x4fff('0x66'));fs['unlinkSync'](_0x2e5a4a);}_0x2e5a4a=_0x2e5a4a+'.cypher';if(!_[_0x4fff('0x63')](_0x39b1ad['value'])&&fs[_0x4fff('0x50')](_0x2e5a4a)){logger[_0x4fff('0x64')](_0x4fff('0x65')+_0x2e5a4a+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x4fff('0x67')](_0x2e5a4a);}return _0x39b1ad;})[_0x4fff('0x21')](function(_0x1296c6){if(!_0x1296c6)throw new InternalError();return _0x1296c6[_0x4fff('0x20')]();})['then'](function(){_0x1713e1[_0x4fff('0x17')](0xcc)[_0x4fff('0x18')]();})[_0x4fff('0x46')](handleError(_0x1713e1,null));}; \ No newline at end of file +var _0xe88d=['format','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','create','body','catch','find','describe','download','../../components/encryptor','uniqueid','params','value','%s.cypher','existsSync','decryptFile','secrets','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','Not\x20found','sequelize','MD5','col','push','$and','recording','Sequelize','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','rimraf','fast-json-patch','moment','bluebird','mustache','path','lodash','jsforce','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','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','map','VoiceRecording','rawAttributes','fieldName','type','model','differenceBy'];(function(_0x192d61,_0x31eb7e){var _0x363975=function(_0x2c8048){while(--_0x2c8048){_0x192d61['push'](_0x192d61['shift']());}};_0x363975(++_0x31eb7e);}(_0xe88d,0xa1));var _0xde88=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0xe88d[_0x11dc39];return _0x457277;};'use strict';var pdf=require(_0xde88('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xde88('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde88('0x2'));var rp=require('request-promise');var moment=require(_0xde88('0x3'));var BPromise=require(_0xde88('0x4'));var Mustache=require(_0xde88('0x5'));var util=require('util');var path=require(_0xde88('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xde88('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xde88('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xde88('0x9'));var querystring=require(_0xde88('0xa'));var Papa=require(_0xde88('0xb'));var Redis=require(_0xde88('0xc'));var authService=require(_0xde88('0xd'));var qs=require(_0xde88('0xe'));var as=require(_0xde88('0xf'));var hardwareService=require(_0xde88('0x10'));var logger=require(_0xde88('0x11'))(_0xde88('0x12'));var utils=require('../../config/utils');var config=require(_0xde88('0x13'));var db=require(_0xde88('0x14'))['db'];function respondWithStatusCode(_0x4b46f0,_0x321368){_0x321368=_0x321368||0xcc;return function(_0x2a8bcf){if(_0x2a8bcf){return _0x4b46f0[_0xde88('0x15')](_0x321368);}return _0x4b46f0[_0xde88('0x16')](_0x321368)[_0xde88('0x17')]();};}function respondWithResult(_0xbeda63,_0x48f364){_0x48f364=_0x48f364||0xc8;return function(_0x227124){if(_0x227124){return _0xbeda63[_0xde88('0x16')](_0x48f364)[_0xde88('0x18')](_0x227124);}};}function respondWithFilteredResult(_0x317cc9,_0x12dbec){return function(_0x184478){if(_0x184478){var _0x226021=_0x184478[_0xde88('0x19')],_0xd9ca4b=_0x12dbec['offset'],_0x36bf54=_0x12dbec['offset']+_0x12dbec[_0xde88('0x1a')],_0x38443b;if(_0x36bf54>=_0x226021){_0x36bf54=_0x226021;_0x38443b=0xc8;}else{_0x38443b=0xce;}_0x317cc9[_0xde88('0x16')](_0x38443b);return _0x317cc9[_0xde88('0x1b')](_0xde88('0x1c'),_0xd9ca4b+'-'+_0x36bf54+'/'+_0x226021)[_0xde88('0x18')](_0x184478);}return null;};}function patchUpdates(_0x40002e){return function(_0x10a618){try{jsonpatch[_0xde88('0x1d')](_0x10a618,_0x40002e,!![]);}catch(_0x5a36b0){return BPromise[_0xde88('0x1e')](_0x5a36b0);}return _0x10a618['save']();};}function saveUpdates(_0x24728a,_0x301ba0){return function(_0x58e335){if(_0x58e335){return _0x58e335[_0xde88('0x1f')](_0x24728a)[_0xde88('0x20')](function(_0x20bf18){return _0x20bf18;});}return null;};}function removeEntity(_0x84c193,_0x407e62){return function(_0x3928b1){if(_0x3928b1){return _0x3928b1[_0xde88('0x21')]()['then'](function(){_0x84c193['status'](0xcc)[_0xde88('0x17')]();});}};}function handleEntityNotFound(_0x1f4e69,_0x31048f){return function(_0x2d232e){if(!_0x2d232e){_0x1f4e69[_0xde88('0x15')](0x194);}return _0x2d232e;};}function handleError(_0x25b3d7,_0x4711ef){_0x4711ef=_0x4711ef||0x1f4;return function(_0x30f6e2){logger[_0xde88('0x22')](_0x30f6e2[_0xde88('0x23')]);if(_0x30f6e2[_0xde88('0x24')]){delete _0x30f6e2['name'];}_0x25b3d7[_0xde88('0x16')](_0x4711ef)[_0xde88('0x25')](_0x30f6e2);};}exports['index']=function(_0x41a888,_0x2b0e6c){var _0x17aec2={},_0x5a7f4d={},_0xcc1d91={'count':0x0,'rows':[]};var _0x591d2d=_[_0xde88('0x26')](db[_0xde88('0x27')][_0xde88('0x28')],function(_0x3d03cc){return{'name':_0x3d03cc[_0xde88('0x29')],'type':_0x3d03cc[_0xde88('0x2a')]['key']};});_0x5a7f4d[_0xde88('0x2b')]=_[_0xde88('0x2c')](_[_0xde88('0x26')](_0x591d2d,_0xde88('0x24')),[_0xde88('0x2d')]);_0x5a7f4d['query']=_[_0xde88('0x2e')](_0x41a888[_0xde88('0x2f')]);_0x5a7f4d[_0xde88('0x30')]=_['intersection'](_0x5a7f4d[_0xde88('0x2b')],_0x5a7f4d['query']);_0x17aec2[_0xde88('0x31')]=_[_0xde88('0x32')](_0x5a7f4d['model'],qs[_0xde88('0x33')](_0x41a888['query'][_0xde88('0x33')]));_0x17aec2[_0xde88('0x31')]=_0x17aec2[_0xde88('0x31')][_0xde88('0x34')]?_0x17aec2[_0xde88('0x31')]:_0x5a7f4d[_0xde88('0x2b')];if(!_0x41a888[_0xde88('0x2f')][_0xde88('0x35')](_0xde88('0x36'))){_0x17aec2['limit']=qs['limit'](_0x41a888[_0xde88('0x2f')][_0xde88('0x1a')]);_0x17aec2[_0xde88('0x37')]=qs['offset'](_0x41a888[_0xde88('0x2f')][_0xde88('0x37')]);}_0x17aec2[_0xde88('0x38')]=qs['sort'](_0x41a888[_0xde88('0x2f')][_0xde88('0x39')]);_0x17aec2[_0xde88('0x3a')]=qs[_0xde88('0x30')](_[_0xde88('0x3b')](_0x41a888[_0xde88('0x2f')],_0x5a7f4d[_0xde88('0x30')]));if(_0x41a888[_0xde88('0x2f')][_0xde88('0x3c')]){_0x17aec2[_0xde88('0x3a')]=_[_0xde88('0x3d')](_0x17aec2[_0xde88('0x3a')],{'$or':_[_0xde88('0x26')](_0x591d2d,function(_0x4e9714){if(_0x4e9714[_0xde88('0x2a')]!==_0xde88('0x3e')){var _0x115ef0={};_0x115ef0[_0x4e9714[_0xde88('0x24')]]={'$like':'%'+_0x41a888[_0xde88('0x2f')][_0xde88('0x3c')]+'%'};return _0x115ef0;}})});}_0x17aec2=_[_0xde88('0x3d')]({},_0x17aec2,_0x41a888[_0xde88('0x3f')]);var _0xf6b368={'where':_0x17aec2['where']};return db[_0xde88('0x27')]['count'](_0xf6b368)[_0xde88('0x20')](function(_0x529866){_0xcc1d91[_0xde88('0x19')]=_0x529866;if(_0x41a888['query'][_0xde88('0x40')]){_0x17aec2[_0xde88('0x41')]=[{'all':!![]}];}return db[_0xde88('0x27')][_0xde88('0x42')](_0x17aec2);})[_0xde88('0x20')](function(_0x3efaf7){_0xcc1d91[_0xde88('0x43')]=_0x3efaf7;return _0xcc1d91;})[_0xde88('0x20')](respondWithFilteredResult(_0x2b0e6c,_0x17aec2))['catch'](handleError(_0x2b0e6c,null));};exports[_0xde88('0x44')]=function(_0x590f56,_0x4eae50){var _0x3d4130={'raw':![],'where':{'id':_0x590f56['params']['id']}},_0x4d069d={};_0x4d069d[_0xde88('0x2b')]=_[_0xde88('0x2e')](db[_0xde88('0x27')][_0xde88('0x28')]);_0x4d069d[_0xde88('0x2f')]=_['keys'](_0x590f56[_0xde88('0x2f')]);_0x4d069d[_0xde88('0x30')]=_['intersection'](_0x4d069d[_0xde88('0x2b')],_0x4d069d[_0xde88('0x2f')]);_0x3d4130[_0xde88('0x31')]=_[_0xde88('0x32')](_0x4d069d[_0xde88('0x2b')],qs[_0xde88('0x33')](_0x590f56[_0xde88('0x2f')][_0xde88('0x33')]));_0x3d4130[_0xde88('0x31')]=_0x3d4130[_0xde88('0x31')][_0xde88('0x34')]?_0x3d4130[_0xde88('0x31')]:_0x4d069d[_0xde88('0x2b')];if(_0x590f56[_0xde88('0x2f')][_0xde88('0x40')]){_0x3d4130[_0xde88('0x41')]=[{'all':!![]}];}_0x3d4130=_[_0xde88('0x3d')]({},_0x3d4130,_0x590f56[_0xde88('0x3f')]);return db[_0xde88('0x27')]['find'](_0x3d4130)[_0xde88('0x20')](handleEntityNotFound(_0x4eae50,null))[_0xde88('0x20')](respondWithResult(_0x4eae50,null))['catch'](handleError(_0x4eae50,null));};exports['create']=function(_0x2bd47c,_0x38d101){return db[_0xde88('0x27')][_0xde88('0x45')](_0x2bd47c[_0xde88('0x46')],{})['then'](respondWithResult(_0x38d101,0xc9))[_0xde88('0x47')](handleError(_0x38d101,null));};exports[_0xde88('0x1f')]=function(_0x10e036,_0x5cc74b){if(_0x10e036[_0xde88('0x46')]['id']){delete _0x10e036[_0xde88('0x46')]['id'];}return db[_0xde88('0x27')][_0xde88('0x48')]({'where':{'id':_0x10e036['params']['id']}})[_0xde88('0x20')](handleEntityNotFound(_0x5cc74b,null))[_0xde88('0x20')](saveUpdates(_0x10e036[_0xde88('0x46')],null))[_0xde88('0x20')](respondWithResult(_0x5cc74b,null))[_0xde88('0x47')](handleError(_0x5cc74b,null));};exports[_0xde88('0x49')]=function(_0x34d6cb,_0x1953f4){return db[_0xde88('0x27')][_0xde88('0x49')]()[_0xde88('0x20')](respondWithResult(_0x1953f4,null))['catch'](handleError(_0x1953f4,null));};exports[_0xde88('0x4a')]=function(_0x2ef3c6,_0x119753,_0x543acc){var _0x33aa8c=require(_0xde88('0x4b'));var _0x10709f=![];var _0x414466={};if(_0x2ef3c6[_0xde88('0x2f')][_0xde88('0x2a')]&&_0x2ef3c6[_0xde88('0x2f')][_0xde88('0x2a')]===_0xde88('0x4c')){_0x414466[_0xde88('0x4c')]=_0x2ef3c6[_0xde88('0x4d')]['id'];}else{_0x414466['id']=_0x2ef3c6[_0xde88('0x4d')]['id'];}return db[_0xde88('0x27')][_0xde88('0x48')]({'where':_0x414466,'attributes':['id','value'],'raw':!![]})[_0xde88('0x20')](handleEntityNotFound(_0x119753,null))[_0xde88('0x20')](function(_0x130db5){if(_0x130db5){var _0x3e05bb=_0x130db5[_0xde88('0x4e')];var _0xe6323c=util[_0xde88('0x2d')](_0xde88('0x4f'),_0x3e05bb);if(fs[_0xde88('0x50')](_0xe6323c)){_0x10709f=!![];return _0x33aa8c[_0xde88('0x51')](_0xe6323c,_0x3e05bb,config[_0xde88('0x52')]['recording'])[_0xde88('0x20')](function(){return _0x130db5;});}return _0x130db5;}})[_0xde88('0x20')](function(_0x56b9d9){if(_0x56b9d9){var _0x279946=_0x56b9d9[_0xde88('0x4e')];if(!fs[_0xde88('0x50')](_0x279946)){throw new db['Sequelize'][(_0xde88('0x53'))](_0xde88('0x54'));}if(_0x56b9d9[_0xde88('0x55')]){return _0x119753[_0xde88('0x4a')](_0x279946,_0x56b9d9['filename']+path[_0xde88('0x56')](_0x279946),function(){if(_0x10709f){fs[_0xde88('0x57')](_0x279946);}});}else{return _0x119753[_0xde88('0x4a')](_0x279946,function(_0x2229cb){if(_0x10709f){fs[_0xde88('0x57')](_0x279946);}});}}})[_0xde88('0x47')](function(_0x1c7178){if(_0x1c7178['message']===_0xde88('0x54')){_0x119753[_0xde88('0x16')](0x194)[_0xde88('0x25')](_0xde88('0x58'));}else{return handleError(_0x119753,null);}});};exports['downloads']=function(_0x3fe6e9,_0x3d959c,_0x5df8ce){var _0xc9047d=require('../../components/encryptor');var _0x3f0f3d=![];var _0x387d94={'$and':[db[_0xde88('0x59')][_0xde88('0x3a')](db[_0xde88('0x59')]['fn'](_0xde88('0x5a'),db[_0xde88('0x59')][_0xde88('0x5b')](_0xde88('0x4c'))),_0x3fe6e9['query']['token'])]};if(_0x3fe6e9[_0xde88('0x2f')][_0xde88('0x2a')]&&_0x3fe6e9[_0xde88('0x2f')][_0xde88('0x2a')]==='uniqueid'){_0x387d94['$and'][_0xde88('0x5c')]({'uniqueid':_0x3fe6e9['params']['id']});}else{_0x387d94[_0xde88('0x5d')]['push']({'id':_0x3fe6e9['params']['id']});}return db[_0xde88('0x27')][_0xde88('0x48')]({'where':_0x387d94,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x3d959c,null))[_0xde88('0x20')](function(_0x2215e1){if(_0x2215e1){var _0x5869ff=util['format'](_0xde88('0x4f'),_0x2215e1[_0xde88('0x4e')]);if(fs[_0xde88('0x50')](_0x5869ff)){_0x3f0f3d=!![];return _0xc9047d[_0xde88('0x51')](_0x5869ff,_0x2215e1[_0xde88('0x4e')],config['secrets'][_0xde88('0x5e')])[_0xde88('0x20')](function(){return _0x2215e1;});}return _0x2215e1;}})[_0xde88('0x20')](function(_0x5e7137){if(_0x5e7137){if(!fs[_0xde88('0x50')](_0x5e7137[_0xde88('0x4e')])){throw new db[(_0xde88('0x5f'))][(_0xde88('0x53'))](_0xde88('0x54'));}if(_0x5e7137[_0xde88('0x55')]){return _0x3d959c[_0xde88('0x4a')](_0x5e7137[_0xde88('0x4e')],_0x5e7137[_0xde88('0x55')]+path['extname'](_0x5e7137['value']),function(){if(_0x3f0f3d){fs[_0xde88('0x57')](_0x5e7137['value']);}});}else{return _0x3d959c[_0xde88('0x4a')](_0x5e7137[_0xde88('0x4e')],function(_0x2c6fdc){if(_0x3f0f3d){fs['unlink'](_0x5e7137[_0xde88('0x4e')]);}});}}})[_0xde88('0x47')](handleError(_0x3d959c,null));};exports[_0xde88('0x21')]=function(_0x2dd4e3,_0x44865e){return db['VoiceRecording'][_0xde88('0x48')]({'where':{'id':_0x2dd4e3[_0xde88('0x4d')]['id']}})['then'](function(_0x34b2b3){if(!_0x34b2b3)throw new ReferenceError(_0xde88('0x60'));return _0x34b2b3;})[_0xde88('0x20')](function(_0x48b905){var _0x537fa9=_0x48b905[_0xde88('0x4e')];logger[_0xde88('0x61')](_0xde88('0x62'),_0x537fa9);if(!_[_0xde88('0x63')](_0x48b905['value'])&&fs['existsSync'](_0x537fa9)){logger[_0xde88('0x61')](_0xde88('0x64')+_0x537fa9+_0xde88('0x65'));fs[_0xde88('0x66')](_0x537fa9);}_0x537fa9=_0x537fa9+'.cypher';if(!_[_0xde88('0x63')](_0x48b905['value'])&&fs['existsSync'](_0x537fa9)){logger[_0xde88('0x61')](_0xde88('0x64')+_0x537fa9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xde88('0x66')](_0x537fa9);}return _0x48b905;})[_0xde88('0x20')](function(_0x197432){if(!_0x197432)throw new InternalError();return _0x197432[_0xde88('0x21')]();})['then'](function(){_0x44865e['status'](0xcc)[_0xde88('0x17')]();})['catch'](handleError(_0x44865e,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index eb9e7cb..edc4191 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 _0xa994=['./voiceRecording.attributes','exports','VoiceRecording','voice_recordings','uniqueid','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x39a53b,_0x3bbd10){var _0x296bd7=function(_0x3e4089){while(--_0x3e4089){_0x39a53b['push'](_0x39a53b['shift']());}};_0x296bd7(++_0x3bbd10);}(_0xa994,0x7d));var _0x4a99=function(_0x439e52,_0x172f0a){_0x439e52=_0x439e52-0x0;var _0x4f1715=_0xa994[_0x439e52];return _0x4f1715;};'use strict';var _=require(_0x4a99('0x0'));var util=require('util');var logger=require(_0x4a99('0x1'))(_0x4a99('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4a99('0x3'));var fs=require('fs');var path=require(_0x4a99('0x4'));var rimraf=require(_0x4a99('0x5'));var config=require(_0x4a99('0x6'));var attributes=require(_0x4a99('0x7'));module[_0x4a99('0x8')]=function(_0x2eb483,_0x57cb26){return _0x2eb483['define'](_0x4a99('0x9'),attributes,{'tableName':_0x4a99('0xa'),'paranoid':![],'indexes':[{'name':_0x4a99('0xb'),'fields':[_0x4a99('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x05f3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoiceRecording','uniqueid','lodash','util','../../config/logger'];(function(_0x47ede9,_0x267314){var _0x37a0de=function(_0x1b5d98){while(--_0x1b5d98){_0x47ede9['push'](_0x47ede9['shift']());}};_0x37a0de(++_0x267314);}(_0x05f3,0x1c4));var _0x305f=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x05f3[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0x305f('0x0'));var util=require(_0x305f('0x1'));var logger=require(_0x305f('0x2'))('api');var moment=require(_0x305f('0x3'));var BPromise=require(_0x305f('0x4'));var rp=require(_0x305f('0x5'));var fs=require('fs');var path=require(_0x305f('0x6'));var rimraf=require(_0x305f('0x7'));var config=require(_0x305f('0x8'));var attributes=require('./voiceRecording.attributes');module[_0x305f('0x9')]=function(_0x444199,_0x5cddce){return _0x444199[_0x305f('0xa')](_0x305f('0xb'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x305f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index c070b93..d75956d 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(_0x27f146,_0x5515bf){var _0xd45e2a=function(_0x51dce2){while(--_0x51dce2){_0x27f146['push'](_0x27f146['shift']());}};_0xd45e2a(++_0x5515bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0xbae21b,_0x449cfb){var _0x10f16f=function(_0x4ae469){while(--_0x4ae469){_0xbae21b['push'](_0xbae21b['shift']());}};_0x10f16f(++_0x449cfb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 488f890..5366b52 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 _0x4c60=['connect-timeout','Router','get','isAuthenticated','index','/:id','show','create','put','destroy','exports','multer','util','path'];(function(_0x48bcee,_0x2730fc){var _0x180407=function(_0x27c0a0){while(--_0x27c0a0){_0x48bcee['push'](_0x48bcee['shift']());}};_0x180407(++_0x2730fc);}(_0x4c60,0xc1));var _0x04c6=function(_0x5aeae6,_0x28ca94){_0x5aeae6=_0x5aeae6-0x0;var _0x170119=_0x4c60[_0x5aeae6];return _0x170119;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x04c6('0x5')]('/',auth[_0x04c6('0x6')](),controller[_0x04c6('0x7')]);router[_0x04c6('0x5')](_0x04c6('0x8'),auth[_0x04c6('0x6')](),controller[_0x04c6('0x9')]);router['post']('/',auth[_0x04c6('0x6')](),controller[_0x04c6('0xa')]);router[_0x04c6('0xb')](_0x04c6('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x04c6('0x8'),auth['isAuthenticated'](),controller[_0x04c6('0xc')]);module[_0x04c6('0xd')]=router; \ No newline at end of file +var _0x3f8a=['index','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated'];(function(_0x2bc09e,_0x1ae747){var _0x3f7c75=function(_0x49bed4){while(--_0x49bed4){_0x2bc09e['push'](_0x2bc09e['shift']());}};_0x3f7c75(++_0x1ae747);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x20344b,_0x41d19f){_0x20344b=_0x20344b-0x0;var _0x1a47ec=_0x3f8a[_0x20344b];return _0x1a47ec;};'use strict';var multer=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var path=require(_0xa3f8('0x2'));var timeout=require(_0xa3f8('0x3'));var express=require('express');var router=express[_0xa3f8('0x4')]();var auth=require(_0xa3f8('0x5'));var interaction=require(_0xa3f8('0x6'));var config=require(_0xa3f8('0x7'));var controller=require(_0xa3f8('0x8'));router[_0xa3f8('0x9')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xb')]);router[_0xa3f8('0x9')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xd')]);router[_0xa3f8('0xe')]('/',auth[_0xa3f8('0xa')](),controller[_0xa3f8('0xf')]);router[_0xa3f8('0x10')](_0xa3f8('0xc'),auth['isAuthenticated'](),controller[_0xa3f8('0x11')]);router[_0xa3f8('0x12')](_0xa3f8('0xc'),auth[_0xa3f8('0xa')](),controller['destroy']);module[_0xa3f8('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 4f40a33..600e67c 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 _0x251f=['STRING','Yes','moment','exports','attended'];(function(_0x17aba8,_0x349cf6){var _0x3d8095=function(_0x4cd87b){while(--_0x4cd87b){_0x17aba8['push'](_0x17aba8['shift']());}};_0x3d8095(++_0x349cf6);}(_0x251f,0x1ce));var _0xf251=function(_0xd158dc,_0x128608){_0xd158dc=_0xd158dc-0x0;var _0x12d25f=_0x251f[_0xd158dc];return _0x12d25f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf251('0x0'));module[_0xf251('0x1')]={'type':{'type':Sequelize['ENUM']('blind',_0xf251('0x2'))},'result':{'type':Sequelize[_0xf251('0x3')]},'transfererchannel':{'type':Sequelize[_0xf251('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xf251('0x3')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xf251('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xf251('0x3')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xf251('0x3')]},'transfererlinkedid':{'type':Sequelize[_0xf251('0x3')]},'transfereechannel':{'type':Sequelize[_0xf251('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0xf251('0x3')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xf251('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xf251('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xf251('0x3')]},'transfereeexten':{'type':Sequelize[_0xf251('0x3')]},'transfereelinkedid':{'type':Sequelize[_0xf251('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0xf251('0x4'),'No')},'context':{'type':Sequelize[_0xf251('0x3')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x832e=['STRING','Yes','sequelize','ENUM','blind','attended'];(function(_0x4ecea4,_0xc431a6){var _0x528e8a=function(_0x2baa56){while(--_0x2baa56){_0x4ecea4['push'](_0x4ecea4['shift']());}};_0x528e8a(++_0xc431a6);}(_0x832e,0x1e2));var _0xe832=function(_0x375d45,_0x188671){_0x375d45=_0x375d45-0x0;var _0x44d098=_0x832e[_0x375d45];return _0x44d098;};'use strict';var Sequelize=require(_0xe832('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0xe832('0x1')](_0xe832('0x2'),_0xe832('0x3'))},'result':{'type':Sequelize[_0xe832('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xe832('0x4')]},'transferercalleridname':{'type':Sequelize[_0xe832('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0xe832('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xe832('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xe832('0x4')]},'transferercontext':{'type':Sequelize[_0xe832('0x4')]},'transfererexten':{'type':Sequelize[_0xe832('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xe832('0x4')]},'transfereechannel':{'type':Sequelize[_0xe832('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xe832('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xe832('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe832('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xe832('0x4')]},'transfereecontext':{'type':Sequelize[_0xe832('0x4')]},'transfereeexten':{'type':Sequelize[_0xe832('0x4')]},'transfereelinkedid':{'type':Sequelize[_0xe832('0x4')]},'isexternal':{'type':Sequelize[_0xe832('0x1')](_0xe832('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 1758866..eeef07d 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 _0xe706=['includeAll','options','find','catch','create','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','VoiceTransferReport','include','findAll','rows','params'];(function(_0x81f0b5,_0xae7b5b){var _0x3edf25=function(_0x23dfea){while(--_0x23dfea){_0x81f0b5['push'](_0x81f0b5['shift']());}};_0x3edf25(++_0xae7b5b);}(_0xe706,0xa3));var _0x6e70=function(_0x151317,_0x3e6c29){_0x151317=_0x151317-0x0;var _0x50b025=_0xe706[_0x151317];return _0x50b025;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var db=require(_0x6e70('0x1b'))['db'];function respondWithStatusCode(_0x18cf27,_0x27dd9b){_0x27dd9b=_0x27dd9b||0xcc;return function(_0x3b38f3){if(_0x3b38f3){return _0x18cf27[_0x6e70('0x1c')](_0x27dd9b);}return _0x18cf27[_0x6e70('0x1d')](_0x27dd9b)[_0x6e70('0x1e')]();};}function respondWithResult(_0x5dfbaa,_0x52737e){_0x52737e=_0x52737e||0xc8;return function(_0x48bc72){if(_0x48bc72){return _0x5dfbaa[_0x6e70('0x1d')](_0x52737e)['json'](_0x48bc72);}};}function respondWithFilteredResult(_0x53aed0,_0x304716){return function(_0x22c50c){if(_0x22c50c){var _0x5d9263=_0x22c50c[_0x6e70('0x1f')],_0x24f3ac=_0x304716['offset'],_0x5c3fe7=_0x304716['offset']+_0x304716[_0x6e70('0x20')],_0x2efc0f;if(_0x5c3fe7>=_0x5d9263){_0x5c3fe7=_0x5d9263;_0x2efc0f=0xc8;}else{_0x2efc0f=0xce;}_0x53aed0['status'](_0x2efc0f);return _0x53aed0[_0x6e70('0x21')](_0x6e70('0x22'),_0x24f3ac+'-'+_0x5c3fe7+'/'+_0x5d9263)['json'](_0x22c50c);}return null;};}function patchUpdates(_0x497d61){return function(_0xc238ba){try{jsonpatch[_0x6e70('0x23')](_0xc238ba,_0x497d61,!![]);}catch(_0x2368eb){return BPromise[_0x6e70('0x24')](_0x2368eb);}return _0xc238ba[_0x6e70('0x25')]();};}function saveUpdates(_0xcdf9f2,_0x1b2453){return function(_0x44a49f){if(_0x44a49f){return _0x44a49f[_0x6e70('0x26')](_0xcdf9f2)[_0x6e70('0x27')](function(_0x4a0cfe){return _0x4a0cfe;});}return null;};}function removeEntity(_0x228350,_0x344b65){return function(_0x27b294){if(_0x27b294){return _0x27b294['destroy']()[_0x6e70('0x27')](function(){_0x228350[_0x6e70('0x1d')](0xcc)[_0x6e70('0x1e')]();});}};}function handleEntityNotFound(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(!_0x538b9c){_0x50da2c['sendStatus'](0x194);}return _0x538b9c;};}function handleError(_0x4e97c7,_0x41e352){_0x41e352=_0x41e352||0x1f4;return function(_0x19c5ae){logger['error'](_0x19c5ae[_0x6e70('0x28')]);if(_0x19c5ae[_0x6e70('0x29')]){delete _0x19c5ae['name'];}_0x4e97c7[_0x6e70('0x1d')](_0x41e352)[_0x6e70('0x2a')](_0x19c5ae);};}exports[_0x6e70('0x2b')]=function(_0x4a67ac,_0x54a5fe){var _0x2c4d37={},_0x3af17f={},_0x83c836={'count':0x0,'rows':[]};var _0x114344=_[_0x6e70('0x2c')](db['VoiceTransferReport'][_0x6e70('0x2d')],function(_0x406f29){return{'name':_0x406f29[_0x6e70('0x2e')],'type':_0x406f29[_0x6e70('0x2f')][_0x6e70('0x30')]};});_0x3af17f[_0x6e70('0x31')]=_[_0x6e70('0x2c')](_0x114344,_0x6e70('0x29'));_0x3af17f[_0x6e70('0x32')]=_[_0x6e70('0x33')](_0x4a67ac['query']);_0x3af17f[_0x6e70('0x34')]=_['intersection'](_0x3af17f[_0x6e70('0x31')],_0x3af17f['query']);_0x2c4d37[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x3af17f[_0x6e70('0x31')],qs['fields'](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x37')]));_0x2c4d37['attributes']=_0x2c4d37[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2c4d37['attributes']:_0x3af17f[_0x6e70('0x31')];if(!_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x39')](_0x6e70('0x3a'))){_0x2c4d37[_0x6e70('0x20')]=qs[_0x6e70('0x20')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x20')]);_0x2c4d37[_0x6e70('0x3b')]=qs[_0x6e70('0x3b')](_0x4a67ac['query'][_0x6e70('0x3b')]);}_0x2c4d37['order']=qs[_0x6e70('0x3c')](_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3c')]);_0x2c4d37[_0x6e70('0x3d')]=qs[_0x6e70('0x34')](_[_0x6e70('0x3e')](_0x4a67ac[_0x6e70('0x32')],_0x3af17f[_0x6e70('0x34')]));if(_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]){_0x2c4d37[_0x6e70('0x3d')]=_[_0x6e70('0x40')](_0x2c4d37[_0x6e70('0x3d')],{'$or':_['map'](_0x114344,function(_0x5446a2){if(_0x5446a2['type']!==_0x6e70('0x41')){var _0x3841a0={};_0x3841a0[_0x5446a2[_0x6e70('0x29')]]={'$like':'%'+_0x4a67ac[_0x6e70('0x32')][_0x6e70('0x3f')]+'%'};return _0x3841a0;}})});}_0x2c4d37=_[_0x6e70('0x40')]({},_0x2c4d37,_0x4a67ac['options']);var _0x3b508c={'where':_0x2c4d37[_0x6e70('0x3d')]};return db[_0x6e70('0x42')][_0x6e70('0x1f')](_0x3b508c)[_0x6e70('0x27')](function(_0x37bf46){_0x83c836[_0x6e70('0x1f')]=_0x37bf46;if(_0x4a67ac[_0x6e70('0x32')]['includeAll']){_0x2c4d37[_0x6e70('0x43')]=[{'all':!![]}];}return db[_0x6e70('0x42')][_0x6e70('0x44')](_0x2c4d37);})[_0x6e70('0x27')](function(_0x201da9){_0x83c836[_0x6e70('0x45')]=_0x201da9;return _0x83c836;})[_0x6e70('0x27')](respondWithFilteredResult(_0x54a5fe,_0x2c4d37))['catch'](handleError(_0x54a5fe,null));};exports['show']=function(_0x5ae898,_0x154e0c){var _0x2b63cc={'raw':!![],'where':{'id':_0x5ae898[_0x6e70('0x46')]['id']}},_0x83847b={};_0x83847b[_0x6e70('0x31')]=_['keys'](db[_0x6e70('0x42')][_0x6e70('0x2d')]);_0x83847b[_0x6e70('0x32')]=_['keys'](_0x5ae898['query']);_0x83847b['filters']=_[_0x6e70('0x36')](_0x83847b['model'],_0x83847b[_0x6e70('0x32')]);_0x2b63cc[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0x83847b[_0x6e70('0x31')],qs['fields'](_0x5ae898[_0x6e70('0x32')]['fields']));_0x2b63cc[_0x6e70('0x35')]=_0x2b63cc[_0x6e70('0x35')][_0x6e70('0x38')]?_0x2b63cc[_0x6e70('0x35')]:_0x83847b['model'];if(_0x5ae898[_0x6e70('0x32')][_0x6e70('0x47')]){_0x2b63cc[_0x6e70('0x43')]=[{'all':!![]}];}_0x2b63cc=_[_0x6e70('0x40')]({},_0x2b63cc,_0x5ae898[_0x6e70('0x48')]);return db[_0x6e70('0x42')][_0x6e70('0x49')](_0x2b63cc)['then'](handleEntityNotFound(_0x154e0c,null))[_0x6e70('0x27')](respondWithResult(_0x154e0c,null))[_0x6e70('0x4a')](handleError(_0x154e0c,null));};exports[_0x6e70('0x4b')]=function(_0x2f99cb,_0x3f86cf){return db[_0x6e70('0x42')][_0x6e70('0x4b')](_0x2f99cb['body'],{})[_0x6e70('0x27')](respondWithResult(_0x3f86cf,0xc9))['catch'](handleError(_0x3f86cf,null));};exports[_0x6e70('0x26')]=function(_0x3836e4,_0x4b351e){if(_0x3836e4['body']['id']){delete _0x3836e4[_0x6e70('0x4c')]['id'];}return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x3836e4['params']['id']}})['then'](handleEntityNotFound(_0x4b351e,null))[_0x6e70('0x27')](saveUpdates(_0x3836e4[_0x6e70('0x4c')],null))[_0x6e70('0x27')](respondWithResult(_0x4b351e,null))[_0x6e70('0x4a')](handleError(_0x4b351e,null));};exports[_0x6e70('0x4d')]=function(_0x340674,_0x4ad5a9){return db[_0x6e70('0x42')][_0x6e70('0x49')]({'where':{'id':_0x340674[_0x6e70('0x46')]['id']}})[_0x6e70('0x27')](handleEntityNotFound(_0x4ad5a9,null))[_0x6e70('0x27')](removeEntity(_0x4ad5a9,null))['catch'](handleError(_0x4ad5a9,null));}; \ No newline at end of file +var _0x5c00=['catch','show','params','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','VoiceTransferReport','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'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5c00,0x17e));var _0x05c0=function(_0x2388be,_0x43ebae){_0x2388be=_0x2388be-0x0;var _0x13ac52=_0x5c00[_0x2388be];return _0x13ac52;};'use strict';var pdf=require(_0x05c0('0x0'));var emlformat=require(_0x05c0('0x1'));var rimraf=require(_0x05c0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05c0('0x3'));var rp=require('request-promise');var moment=require(_0x05c0('0x4'));var BPromise=require(_0x05c0('0x5'));var Mustache=require(_0x05c0('0x6'));var util=require(_0x05c0('0x7'));var path=require('path');var sox=require(_0x05c0('0x8'));var csv=require(_0x05c0('0x9'));var ejs=require(_0x05c0('0xa'));var fs=require('fs');var _=require(_0x05c0('0xb'));var squel=require('squel');var crypto=require(_0x05c0('0xc'));var jsforce=require(_0x05c0('0xd'));var deskjs=require(_0x05c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05c0('0xf'));var Papa=require(_0x05c0('0x10'));var Redis=require(_0x05c0('0x11'));var authService=require(_0x05c0('0x12'));var qs=require(_0x05c0('0x13'));var as=require(_0x05c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05c0('0x15'));var utils=require('../../config/utils');var config=require(_0x05c0('0x16'));var db=require(_0x05c0('0x17'))['db'];function respondWithStatusCode(_0xa50678,_0x5a3e65){_0x5a3e65=_0x5a3e65||0xcc;return function(_0x4e39d4){if(_0x4e39d4){return _0xa50678['sendStatus'](_0x5a3e65);}return _0xa50678[_0x05c0('0x18')](_0x5a3e65)[_0x05c0('0x19')]();};}function respondWithResult(_0x20ff48,_0x12deeb){_0x12deeb=_0x12deeb||0xc8;return function(_0x25764b){if(_0x25764b){return _0x20ff48[_0x05c0('0x18')](_0x12deeb)[_0x05c0('0x1a')](_0x25764b);}};}function respondWithFilteredResult(_0xd7b487,_0x4c3e54){return function(_0x238e25){if(_0x238e25){var _0x161a5f=_0x238e25[_0x05c0('0x1b')],_0x4bb164=_0x4c3e54[_0x05c0('0x1c')],_0x29e6b0=_0x4c3e54[_0x05c0('0x1c')]+_0x4c3e54[_0x05c0('0x1d')],_0x27c7bd;if(_0x29e6b0>=_0x161a5f){_0x29e6b0=_0x161a5f;_0x27c7bd=0xc8;}else{_0x27c7bd=0xce;}_0xd7b487['status'](_0x27c7bd);return _0xd7b487[_0x05c0('0x1e')](_0x05c0('0x1f'),_0x4bb164+'-'+_0x29e6b0+'/'+_0x161a5f)[_0x05c0('0x1a')](_0x238e25);}return null;};}function patchUpdates(_0x54fef0){return function(_0x40d905){try{jsonpatch[_0x05c0('0x20')](_0x40d905,_0x54fef0,!![]);}catch(_0x10685b){return BPromise[_0x05c0('0x21')](_0x10685b);}return _0x40d905[_0x05c0('0x22')]();};}function saveUpdates(_0x5e4742,_0x407c1f){return function(_0x1014ef){if(_0x1014ef){return _0x1014ef['update'](_0x5e4742)['then'](function(_0x5e4b80){return _0x5e4b80;});}return null;};}function removeEntity(_0x1c448b,_0x2055a3){return function(_0x83f29){if(_0x83f29){return _0x83f29[_0x05c0('0x23')]()[_0x05c0('0x24')](function(){_0x1c448b[_0x05c0('0x18')](0xcc)[_0x05c0('0x19')]();});}};}function handleEntityNotFound(_0x5b4eef,_0x9b4930){return function(_0x1abbf3){if(!_0x1abbf3){_0x5b4eef['sendStatus'](0x194);}return _0x1abbf3;};}function handleError(_0x530966,_0x4da6d6){_0x4da6d6=_0x4da6d6||0x1f4;return function(_0x5dc2b7){logger['error'](_0x5dc2b7[_0x05c0('0x25')]);if(_0x5dc2b7[_0x05c0('0x26')]){delete _0x5dc2b7['name'];}_0x530966[_0x05c0('0x18')](_0x4da6d6)[_0x05c0('0x27')](_0x5dc2b7);};}exports[_0x05c0('0x28')]=function(_0x889c75,_0x58769a){var _0x7d5ccd={},_0x1c14b1={},_0x2ceaed={'count':0x0,'rows':[]};var _0x200e80=_[_0x05c0('0x29')](db[_0x05c0('0x2a')]['rawAttributes'],function(_0x56ba64){return{'name':_0x56ba64[_0x05c0('0x2b')],'type':_0x56ba64[_0x05c0('0x2c')][_0x05c0('0x2d')]};});_0x1c14b1[_0x05c0('0x2e')]=_[_0x05c0('0x29')](_0x200e80,_0x05c0('0x26'));_0x1c14b1[_0x05c0('0x2f')]=_[_0x05c0('0x30')](_0x889c75[_0x05c0('0x2f')]);_0x1c14b1[_0x05c0('0x31')]=_[_0x05c0('0x32')](_0x1c14b1[_0x05c0('0x2e')],_0x1c14b1['query']);_0x7d5ccd['attributes']=_[_0x05c0('0x32')](_0x1c14b1[_0x05c0('0x2e')],qs[_0x05c0('0x33')](_0x889c75['query'][_0x05c0('0x33')]));_0x7d5ccd[_0x05c0('0x34')]=_0x7d5ccd['attributes'][_0x05c0('0x35')]?_0x7d5ccd['attributes']:_0x1c14b1[_0x05c0('0x2e')];if(!_0x889c75[_0x05c0('0x2f')][_0x05c0('0x36')](_0x05c0('0x37'))){_0x7d5ccd[_0x05c0('0x1d')]=qs[_0x05c0('0x1d')](_0x889c75[_0x05c0('0x2f')][_0x05c0('0x1d')]);_0x7d5ccd[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x889c75[_0x05c0('0x2f')][_0x05c0('0x1c')]);}_0x7d5ccd[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x889c75[_0x05c0('0x2f')][_0x05c0('0x39')]);_0x7d5ccd[_0x05c0('0x3a')]=qs[_0x05c0('0x31')](_[_0x05c0('0x3b')](_0x889c75[_0x05c0('0x2f')],_0x1c14b1[_0x05c0('0x31')]));if(_0x889c75[_0x05c0('0x2f')][_0x05c0('0x3c')]){_0x7d5ccd[_0x05c0('0x3a')]=_[_0x05c0('0x3d')](_0x7d5ccd[_0x05c0('0x3a')],{'$or':_[_0x05c0('0x29')](_0x200e80,function(_0x3bc6cc){if(_0x3bc6cc[_0x05c0('0x2c')]!==_0x05c0('0x3e')){var _0x1f493c={};_0x1f493c[_0x3bc6cc[_0x05c0('0x26')]]={'$like':'%'+_0x889c75[_0x05c0('0x2f')]['filter']+'%'};return _0x1f493c;}})});}_0x7d5ccd=_[_0x05c0('0x3d')]({},_0x7d5ccd,_0x889c75[_0x05c0('0x3f')]);var _0x41fa50={'where':_0x7d5ccd[_0x05c0('0x3a')]};return db['VoiceTransferReport']['count'](_0x41fa50)[_0x05c0('0x24')](function(_0x2540db){_0x2ceaed[_0x05c0('0x1b')]=_0x2540db;if(_0x889c75['query'][_0x05c0('0x40')]){_0x7d5ccd[_0x05c0('0x41')]=[{'all':!![]}];}return db[_0x05c0('0x2a')][_0x05c0('0x42')](_0x7d5ccd);})['then'](function(_0x152c6a){_0x2ceaed[_0x05c0('0x43')]=_0x152c6a;return _0x2ceaed;})['then'](respondWithFilteredResult(_0x58769a,_0x7d5ccd))[_0x05c0('0x44')](handleError(_0x58769a,null));};exports[_0x05c0('0x45')]=function(_0x4557db,_0xcbd98){var _0x164e3a={'raw':!![],'where':{'id':_0x4557db[_0x05c0('0x46')]['id']}},_0x398a6e={};_0x398a6e['model']=_['keys'](db[_0x05c0('0x2a')][_0x05c0('0x47')]);_0x398a6e[_0x05c0('0x2f')]=_[_0x05c0('0x30')](_0x4557db[_0x05c0('0x2f')]);_0x398a6e['filters']=_[_0x05c0('0x32')](_0x398a6e[_0x05c0('0x2e')],_0x398a6e[_0x05c0('0x2f')]);_0x164e3a[_0x05c0('0x34')]=_[_0x05c0('0x32')](_0x398a6e[_0x05c0('0x2e')],qs[_0x05c0('0x33')](_0x4557db['query'][_0x05c0('0x33')]));_0x164e3a[_0x05c0('0x34')]=_0x164e3a[_0x05c0('0x34')][_0x05c0('0x35')]?_0x164e3a[_0x05c0('0x34')]:_0x398a6e[_0x05c0('0x2e')];if(_0x4557db[_0x05c0('0x2f')][_0x05c0('0x40')]){_0x164e3a[_0x05c0('0x41')]=[{'all':!![]}];}_0x164e3a=_[_0x05c0('0x3d')]({},_0x164e3a,_0x4557db[_0x05c0('0x3f')]);return db['VoiceTransferReport']['find'](_0x164e3a)[_0x05c0('0x24')](handleEntityNotFound(_0xcbd98,null))[_0x05c0('0x24')](respondWithResult(_0xcbd98,null))[_0x05c0('0x44')](handleError(_0xcbd98,null));};exports[_0x05c0('0x48')]=function(_0x2a1339,_0x856372){return db['VoiceTransferReport'][_0x05c0('0x48')](_0x2a1339[_0x05c0('0x49')],{})[_0x05c0('0x24')](respondWithResult(_0x856372,0xc9))[_0x05c0('0x44')](handleError(_0x856372,null));};exports['update']=function(_0x34e94e,_0x2440e8){if(_0x34e94e[_0x05c0('0x49')]['id']){delete _0x34e94e[_0x05c0('0x49')]['id'];}return db['VoiceTransferReport'][_0x05c0('0x4a')]({'where':{'id':_0x34e94e[_0x05c0('0x46')]['id']}})[_0x05c0('0x24')](handleEntityNotFound(_0x2440e8,null))[_0x05c0('0x24')](saveUpdates(_0x34e94e['body'],null))[_0x05c0('0x24')](respondWithResult(_0x2440e8,null))[_0x05c0('0x44')](handleError(_0x2440e8,null));};exports['destroy']=function(_0x27f69e,_0x57f979){return db['VoiceTransferReport'][_0x05c0('0x4a')]({'where':{'id':_0x27f69e['params']['id']}})[_0x05c0('0x24')](handleEntityNotFound(_0x57f979,null))[_0x05c0('0x24')](removeEntity(_0x57f979,null))[_0x05c0('0x44')](handleError(_0x57f979,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 21800c8..d38c441 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 _0xcc81=['exports','define','VoiceTransferReport','report_call_transfer','lodash','api','moment','bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes'];(function(_0x41f15f,_0x1a39ef){var _0x269a71=function(_0x52c50e){while(--_0x52c50e){_0x41f15f['push'](_0x41f15f['shift']());}};_0x269a71(++_0x1a39ef);}(_0xcc81,0x19c));var _0x1cc8=function(_0x1892f9,_0x2cb4ab){_0x1892f9=_0x1892f9-0x0;var _0x5a765f=_0xcc81[_0x1892f9];return _0x5a765f;};'use strict';var _=require(_0x1cc8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1cc8('0x1'));var moment=require(_0x1cc8('0x2'));var BPromise=require(_0x1cc8('0x3'));var rp=require(_0x1cc8('0x4'));var fs=require('fs');var path=require(_0x1cc8('0x5'));var rimraf=require(_0x1cc8('0x6'));var config=require('../../config/environment');var attributes=require(_0x1cc8('0x7'));module[_0x1cc8('0x8')]=function(_0x577f88,_0x434432){return _0x577f88[_0x1cc8('0x9')](_0x1cc8('0xa'),attributes,{'tableName':_0x1cc8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9195=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceTransferReport','report_call_transfer'];(function(_0x27d941,_0x3eb7cb){var _0x15c52d=function(_0x4e7537){while(--_0x4e7537){_0x27d941['push'](_0x27d941['shift']());}};_0x15c52d(++_0x3eb7cb);}(_0x9195,0x129));var _0x5919=function(_0x2b7795,_0x37340c){_0x2b7795=_0x2b7795-0x0;var _0x23e929=_0x9195[_0x2b7795];return _0x23e929;};'use strict';var _=require(_0x5919('0x0'));var util=require(_0x5919('0x1'));var logger=require(_0x5919('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5919('0x3'));var rp=require(_0x5919('0x4'));var fs=require('fs');var path=require(_0x5919('0x5'));var rimraf=require(_0x5919('0x6'));var config=require(_0x5919('0x7'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x191b9,_0x540103){return _0x191b9[_0x5919('0x8')](_0x5919('0x9'),attributes,{'tableName':_0x5919('0xa'),'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 67b3de8..a9dba90 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 _0x5de0=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateVoiceTransferReport','VoiceTransferReport','body','options','catch'];(function(_0x41cfd4,_0x1ed2cc){var _0x190f48=function(_0x4b5b1a){while(--_0x4b5b1a){_0x41cfd4['push'](_0x41cfd4['shift']());}};_0x190f48(++_0x1ed2cc);}(_0x5de0,0x14a));var _0x05de=function(_0x211b93,_0x3754f0){_0x211b93=_0x211b93-0x0;var _0x2e9d7a=_0x5de0[_0x211b93];return _0x2e9d7a;};'use strict';var _=require(_0x05de('0x0'));var util=require(_0x05de('0x1'));var moment=require(_0x05de('0x2'));var BPromise=require(_0x05de('0x3'));var rs=require(_0x05de('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05de('0x5'))['db'];var utils=require(_0x05de('0x6'));var logger=require(_0x05de('0x7'))(_0x05de('0x8'));var config=require(_0x05de('0x9'));var jayson=require(_0x05de('0xa'));var client=jayson[_0x05de('0xb')][_0x05de('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27a573,_0x4b37fe,_0xdebfc5){return new BPromise(function(_0x17198a,_0x1a52df){return client[_0x05de('0xd')](_0x27a573,_0xdebfc5)[_0x05de('0xe')](function(_0x48c061){logger['info'](_0x05de('0xf'),_0x4b37fe,_0x05de('0x10'));logger[_0x05de('0x11')](_0x05de('0x12'),_0x4b37fe,_0x05de('0x10'),JSON[_0x05de('0x13')](_0x48c061));if(_0x48c061[_0x05de('0x14')]){if(_0x48c061[_0x05de('0x14')][_0x05de('0x15')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x4b37fe,_0x48c061[_0x05de('0x14')][_0x05de('0x16')]);return _0x1a52df(_0x48c061['error'][_0x05de('0x16')]);}logger[_0x05de('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x4b37fe,_0x48c061[_0x05de('0x14')][_0x05de('0x16')]);return _0x17198a(_0x48c061['error'][_0x05de('0x16')]);}else{logger[_0x05de('0x17')](_0x05de('0xf'),_0x4b37fe,_0x05de('0x10'));_0x17198a(_0x48c061[_0x05de('0x18')][_0x05de('0x16')]);}})['catch'](function(_0x144db6){logger[_0x05de('0x14')]('VoiceTransferReport,\x20%s,\x20%s',_0x4b37fe,_0x144db6);_0x1a52df(_0x144db6);});});}exports[_0x05de('0x19')]=function(_0x20164c){var _0x59d011=this;return new Promise(function(_0x14cd00,_0x481a45){return db[_0x05de('0x1a')]['create'](_0x20164c[_0x05de('0x1b')],{'raw':_0x20164c[_0x05de('0x1c')]?_0x20164c[_0x05de('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x05de('0xe')](function(_0x4633cc){logger[_0x05de('0x17')](_0x05de('0x19'),_0x20164c);logger[_0x05de('0x11')](_0x05de('0x19'),_0x20164c,JSON[_0x05de('0x13')](_0x4633cc));_0x14cd00(_0x4633cc);})[_0x05de('0x1d')](function(_0x4398ed){logger[_0x05de('0x14')](_0x05de('0x19'),_0x4398ed[_0x05de('0x16')],_0x20164c);_0x481a45(_0x59d011[_0x05de('0x14')](0x1f4,_0x4398ed[_0x05de('0x16')]));});});}; \ No newline at end of file +var _0x7240=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceTransferReport,\x20%s,\x20%s','message','CreateVoiceTransferReport','create','options','raw','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x7bfc45,_0x2640ff){var _0x5cce89=function(_0x5561c9){while(--_0x5561c9){_0x7bfc45['push'](_0x7bfc45['shift']());}};_0x5cce89(++_0x2640ff);}(_0x7240,0xe4));var _0x0724=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x7240[_0x173441];return _0x2423a8;};'use strict';var _=require('lodash');var util=require(_0x0724('0x0'));var moment=require(_0x0724('0x1'));var BPromise=require(_0x0724('0x2'));var rs=require(_0x0724('0x3'));var fs=require('fs');var Redis=require(_0x0724('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0724('0x5'));var logger=require(_0x0724('0x6'))(_0x0724('0x7'));var config=require(_0x0724('0x8'));var jayson=require(_0x0724('0x9'));var client=jayson[_0x0724('0xa')][_0x0724('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c039f,_0x4d1194,_0x53a157){return new BPromise(function(_0x4146b6,_0x5c237e){return client[_0x0724('0xc')](_0x2c039f,_0x53a157)['then'](function(_0xd9c289){logger[_0x0724('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x4d1194,_0x0724('0xe'));logger[_0x0724('0xf')](_0x0724('0x10'),_0x4d1194,_0x0724('0xe'),JSON[_0x0724('0x11')](_0xd9c289));if(_0xd9c289[_0x0724('0x12')]){if(_0xd9c289[_0x0724('0x12')]['code']===0x1f4){logger['error'](_0x0724('0x13'),_0x4d1194,_0xd9c289[_0x0724('0x12')][_0x0724('0x14')]);return _0x5c237e(_0xd9c289['error'][_0x0724('0x14')]);}logger[_0x0724('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4d1194,_0xd9c289[_0x0724('0x12')][_0x0724('0x14')]);return _0x4146b6(_0xd9c289[_0x0724('0x12')]['message']);}else{logger[_0x0724('0xd')](_0x0724('0x13'),_0x4d1194,_0x0724('0xe'));_0x4146b6(_0xd9c289['result']['message']);}})['catch'](function(_0xab0435){logger['error'](_0x0724('0x13'),_0x4d1194,_0xab0435);_0x5c237e(_0xab0435);});});}exports[_0x0724('0x15')]=function(_0x15ea18){var _0x178f34=this;return new Promise(function(_0x5dad92,_0x3c55ef){return db['VoiceTransferReport'][_0x0724('0x16')](_0x15ea18['body'],{'raw':_0x15ea18[_0x0724('0x17')]?_0x15ea18[_0x0724('0x17')][_0x0724('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5d3981){logger[_0x0724('0xd')]('CreateVoiceTransferReport',_0x15ea18);logger[_0x0724('0xf')](_0x0724('0x15'),_0x15ea18,JSON[_0x0724('0x11')](_0x5d3981));_0x5dad92(_0x5d3981);})[_0x0724('0x19')](function(_0x488f5c){logger[_0x0724('0x12')](_0x0724('0x15'),_0x488f5c[_0x0724('0x14')],_0x15ea18);_0x3c55ef(_0x178f34['error'](0x1f4,_0x488f5c[_0x0724('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 47f064b..7c33475 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 _0x12c9=['hold','/unhold','unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer'];(function(_0x398f94,_0x51c708){var _0x1ab4a5=function(_0x3dd4ad){while(--_0x3dd4ad){_0x398f94['push'](_0x398f94['shift']());}};_0x1ab4a5(++_0x51c708);}(_0x12c9,0x1c9));var _0x912c=function(_0x54a8db,_0x10a6ad){_0x54a8db=_0x54a8db-0x0;var _0x36ceca=_0x12c9[_0x54a8db];return _0x36ceca;};'use strict';var express=require(_0x912c('0x0'));var router=express[_0x912c('0x1')]();var auth=require(_0x912c('0x2'));var controller=require(_0x912c('0x3'));router[_0x912c('0x4')]('/originate',auth[_0x912c('0x5')](),auth[_0x912c('0x6')](),controller[_0x912c('0x7')]);router[_0x912c('0x4')](_0x912c('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x912c('0x9')]);router[_0x912c('0x4')](_0x912c('0xa'),auth[_0x912c('0x5')](),auth[_0x912c('0x6')](),controller['answer']);router[_0x912c('0x4')]('/hold',auth[_0x912c('0x5')](),auth['canUpdate'](),controller[_0x912c('0xb')]);router['post'](_0x912c('0xc'),auth['isAuthenticated'](),auth[_0x912c('0x6')](),controller[_0x912c('0xd')]);router['post'](_0x912c('0xe'),auth['isAuthenticated'](),auth[_0x912c('0x6')](),controller[_0x912c('0xf')]);router[_0x912c('0x4')](_0x912c('0x10'),auth[_0x912c('0x5')](),auth['canUpdate'](),controller[_0x912c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0434=['isAuthenticated','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','canUpdate','originate','/hangup'];(function(_0xd3c565,_0x4110a6){var _0x3a06c2=function(_0xd16839){while(--_0xd16839){_0xd3c565['push'](_0xd3c565['shift']());}};_0x3a06c2(++_0x4110a6);}(_0x0434,0x1ad));var _0x4043=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x0434[_0x4164f2];return _0x2575c7;};'use strict';var express=require(_0x4043('0x0'));var router=express[_0x4043('0x1')]();var auth=require(_0x4043('0x2'));var controller=require(_0x4043('0x3'));router[_0x4043('0x4')]('/originate',auth['isAuthenticated'](),auth[_0x4043('0x5')](),controller[_0x4043('0x6')]);router[_0x4043('0x4')](_0x4043('0x7'),auth[_0x4043('0x8')](),auth[_0x4043('0x5')](),controller['hangup']);router[_0x4043('0x4')](_0x4043('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x4043('0xa')]);router[_0x4043('0x4')](_0x4043('0xb'),auth[_0x4043('0x8')](),auth[_0x4043('0x5')](),controller[_0x4043('0xc')]);router[_0x4043('0x4')](_0x4043('0xd'),auth['isAuthenticated'](),auth[_0x4043('0x5')](),controller[_0x4043('0xe')]);router[_0x4043('0x4')](_0x4043('0xf'),auth[_0x4043('0x8')](),auth['canUpdate'](),controller[_0x4043('0x10')]);router[_0x4043('0x4')](_0x4043('0x11'),auth[_0x4043('0x8')](),auth[_0x4043('0x5')](),controller['transfer']);module[_0x4043('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 4242ff9..bd2f528 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 _0x6208=['number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','catch','findOne','agent','VoiceChannels','all','filter','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate\x20fired:','body','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','json','originate\x20executed!','hangup','hangup\x20fired:','userId','answer','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','rows','conference','conference\x20fired:','format','webbar:conference','conference\x20executed!','transfer','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','bluebird','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate'];(function(_0xdac62f,_0x437a7e){var _0x53b732=function(_0x4fc310){while(--_0x4fc310){_0xdac62f['push'](_0xdac62f['shift']());}};_0x53b732(++_0x437a7e);}(_0x6208,0x17d));var _0x8620=function(_0x25bca6,_0xe415ea){_0x25bca6=_0x25bca6-0x0;var _0x3f8d02=_0x6208[_0x25bca6];return _0x3f8d02;};'use strict';var path=require(_0x8620('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x8620('0x1'))['db'];var config=require(_0x8620('0x2'));var util=require('util');var BPromise=require(_0x8620('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x8620('0x4')][_0x8620('0x5')]({'port':0x232a});var logger=require(_0x8620('0x6'))(_0x8620('0x7'));var Redis=require(_0x8620('0x8'));config[_0x8620('0x9')]=_[_0x8620('0xa')](config['redis'],{'host':_0x8620('0xb'),'port':0x18eb});var io=require(_0x8620('0xc'))(new Redis(config[_0x8620('0x9')]));var Schema=require(_0x8620('0xd'));var originateValidation=new Schema({'userId':{'type':_0x8620('0xe'),'required':[!![],_0x8620('0xf')]},'callNumber':{'type':_0x8620('0x10'),'required':[!![],_0x8620('0x11')]},'callerId':{'type':_0x8620('0x10')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x8620('0xe'),'required':[!![],_0x8620('0xf')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8620('0xf')]},'sessionId':{'type':_0x8620('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x8620('0xe'),'required':[!![],_0x8620('0xf')]},'sessionId':{'type':_0x8620('0x10'),'required':[!![],_0x8620('0x12')]},'transferNumber':{'type':'string','required':[!![],_0x8620('0x13')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x8620('0xf')]},'sessionId':{'type':_0x8620('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x8620('0xe'),'required':[!![],_0x8620('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x8620('0xe'),'required':[!![],_0x8620('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x213668,_0x12fe8d,_0x597e21){logger[_0x8620('0x14')](_0x213668,_0x12fe8d,JSON['stringify'](_0x597e21));io['to'](_0x213668)[_0x8620('0x15')](_0x12fe8d,_0x597e21);}function handleError(_0x10b053){return function(_0x114e25){console[_0x8620('0x16')](_0x8620('0x17'),_0x114e25,_0x114e25 instanceof RangeError);logger[_0x8620('0x18')](_0x114e25[_0x8620('0x19')]);if(_0x114e25 instanceof RangeError){if(_0x114e25[_0x8620('0x1a')]){delete _0x114e25[_0x8620('0x1a')];}_0x10b053[_0x8620('0x1b')](0x194)[_0x8620('0x1c')](_0x114e25);}else{if(_0x114e25[_0x8620('0x1a')]){delete _0x114e25[_0x8620('0x1a')];}_0x10b053[_0x8620('0x1b')](0x1f4)[_0x8620('0x1c')](_0x114e25);}};}function checkError(){return function(_0x186878){if(!_0x186878){throw new RangeError(_0x8620('0x1d'));}return _0x186878;};}function respondWithRpcPromise(_0x1c1780,_0x2cc7d0){return new BPromise(function(_0x88ef0f,_0x49334a){var _0xa63ba9=amiClient;return _0xa63ba9[_0x8620('0x1e')](_0x1c1780,_0x2cc7d0)[_0x8620('0x1f')](function(_0x3fb864){if(_0x3fb864[_0x8620('0x18')]){if(_0x3fb864[_0x8620('0x18')][_0x8620('0x20')]===0x1f4){return _0x49334a(_0x3fb864[_0x8620('0x18')][_0x8620('0x21')]);}return _0x88ef0f(_0x3fb864['error']['message']);}else{_0x88ef0f(_0x3fb864['result']);}})[_0x8620('0x22')](function(_0x35ebda){_0x49334a(_0x35ebda);});});}function getAgent(_0x451a9b){return db['User'][_0x8620('0x23')]({'where':{'id':_0x451a9b,'role':_0x8620('0x24')}})[_0x8620('0x1f')](checkError());}function getAgentCheckSession(_0x18ef1d,_0xe0e33){return new BPromise(function(_0x33819f,_0x520d9d){var _0x5e515c=respondWithRpcPromise(_0x8620('0x25'));var _0x524fc5=getAgent(_0x18ef1d);Promise[_0x8620('0x26')]([_0x5e515c,_0x524fc5])[_0x8620('0x1f')](function(_0x25e3c1){var _0x5c836b=_0x25e3c1[0x0];var _0x1c4169=_0x25e3c1[0x1];var _0x4c48c0=_[_0x8620('0x27')](_0x5c836b['rows'],function(_0x45bf71){return _0x45bf71[_0x8620('0x28')]==_0x1c4169['id']&&_0x45bf71[_0x8620('0x29')]==_0xe0e33;});if(_0x4c48c0[_0x8620('0x2a')]==0x1){_0x33819f(_0x1c4169);}else{_0x520d9d(new RangeError(_0x8620('0x2b')+_0xe0e33+_0x8620('0x2c')));}});});}exports['originate']=function(_0x4dd19d,_0x5d6693){logger['info'](_0x8620('0x2d'),_0x4dd19d[_0x8620('0x2e')]);var _0xb440cf=originateValidation['validate'](_0x4dd19d['body']);if(_0xb440cf['length']>0x0){return _0x5d6693[_0x8620('0x1b')](0x190)['json'](_0xb440cf);}var _0x4cf4da=_0x4dd19d['body']['userId'];var _0x132b39=_0x4dd19d[_0x8620('0x2e')][_0x8620('0x2f')];var _0x373071=_0x4dd19d[_0x8620('0x2e')][_0x8620('0x30')];var _0x202b91=_0x4dd19d[_0x8620('0x2e')][_0x8620('0x31')];return getAgent(_0x4cf4da)['then'](function(_0x21bf55){logger[_0x8620('0x14')](_0x8620('0x32'),_0x21bf55[_0x8620('0x1a')]);emit(util['format'](_0x8620('0x33'),_0x21bf55[_0x8620('0x1a')]),_0x8620('0x34'),{'callNumber':_0x132b39,'callerId':_0x373071,'callbackUrl':_0x202b91});return _0x5d6693[_0x8620('0x1b')](0xc8)[_0x8620('0x35')]({'error':![],'message':_0x8620('0x36')});})[_0x8620('0x22')](handleError(_0x5d6693));};exports[_0x8620('0x37')]=function(_0x3aee4a,_0x27f7f3){logger[_0x8620('0x14')](_0x8620('0x38'),_0x3aee4a[_0x8620('0x2e')]);var _0x362976=hangupValidation[_0x8620('0xd')](_0x3aee4a[_0x8620('0x2e')]);if(_0x362976['length']>0x0){return _0x27f7f3[_0x8620('0x1b')](0x190)[_0x8620('0x35')](_0x362976);}var _0x54fb16=_0x3aee4a['body'][_0x8620('0x39')];var _0x1dd5ec=_0x3aee4a[_0x8620('0x2e')][_0x8620('0x29')];return getAgent(_0x54fb16)[_0x8620('0x1f')](function(_0x4cc173){logger[_0x8620('0x14')](_0x8620('0x32'),_0x4cc173[_0x8620('0x1a')]);emit(util['format'](_0x8620('0x33'),_0x4cc173[_0x8620('0x1a')]),'webbar:hangup',{'sessionId':_0x1dd5ec});return _0x27f7f3[_0x8620('0x1b')](0xc8)[_0x8620('0x35')]({'error':![],'message':'hangup\x20executed!'});})[_0x8620('0x22')](handleError(_0x27f7f3));};exports[_0x8620('0x3a')]=function(_0x58fe38,_0x710867){logger[_0x8620('0x14')]('answer\x20fired:',_0x58fe38[_0x8620('0x2e')]);var _0x4b5430=answerValidation[_0x8620('0xd')](_0x58fe38[_0x8620('0x2e')]);if(_0x4b5430['length']>0x0){return _0x710867[_0x8620('0x1b')](0x190)['json'](_0x4b5430);}var _0x36e027=_0x58fe38[_0x8620('0x2e')][_0x8620('0x39')];var _0x4961da=_0x58fe38[_0x8620('0x2e')]['sessionId'];return getAgent(_0x36e027)[_0x8620('0x1f')](function(_0x35fe58){logger[_0x8620('0x14')](_0x8620('0x32'),_0x35fe58[_0x8620('0x1a')]);emit(util['format'](_0x8620('0x33'),_0x35fe58[_0x8620('0x1a')]),_0x8620('0x3b'),{'sessionId':_0x4961da});return _0x710867['status'](0xc8)[_0x8620('0x35')]({'error':![],'message':_0x8620('0x3c')});})[_0x8620('0x22')](handleError(_0x710867));};exports['hold']=function(_0x1661b3,_0x46126f){logger[_0x8620('0x14')](_0x8620('0x3d'),_0x1661b3['body']);var _0x210e26=holdValidation['validate'](_0x1661b3[_0x8620('0x2e')]);if(_0x210e26[_0x8620('0x2a')]>0x0){return _0x46126f['status'](0x190)[_0x8620('0x35')](_0x210e26);}var _0x1091fe=_0x1661b3[_0x8620('0x2e')][_0x8620('0x39')];var _0x23f565=_0x1661b3[_0x8620('0x2e')][_0x8620('0x29')];return getAgent(_0x1091fe)['then'](function(_0x2d8ea9){logger[_0x8620('0x14')](_0x8620('0x32'),_0x2d8ea9[_0x8620('0x1a')]);emit(util['format']('user:%s',_0x2d8ea9[_0x8620('0x1a')]),_0x8620('0x3e'),{'sessionId':_0x23f565});return _0x46126f[_0x8620('0x1b')](0xc8)[_0x8620('0x35')]({'error':![],'message':_0x8620('0x3f')});})[_0x8620('0x22')](handleError(_0x46126f));};exports[_0x8620('0x40')]=function(_0x541d45,_0x3800b9){logger[_0x8620('0x14')](_0x8620('0x41'),_0x541d45[_0x8620('0x2e')]);var _0x5ec0c5=unholdValidation[_0x8620('0xd')](_0x541d45[_0x8620('0x2e')]);if(_0x5ec0c5[_0x8620('0x2a')]>0x0){return _0x3800b9['status'](0x190)[_0x8620('0x35')](_0x5ec0c5);}var _0x54e0b5=_0x541d45['body'][_0x8620('0x39')];var _0x32d7cc=_0x541d45[_0x8620('0x2e')][_0x8620('0x29')];return getAgent(_0x54e0b5)[_0x8620('0x1f')](function(_0xce895){logger[_0x8620('0x14')]('entityFound:',_0xce895[_0x8620('0x1a')]);emit(util['format']('user:%s',_0xce895[_0x8620('0x1a')]),_0x8620('0x42'),{'sessionId':_0x32d7cc});return _0x3800b9[_0x8620('0x1b')](0xc8)[_0x8620('0x35')]({'error':![],'message':_0x8620('0x43')});})[_0x8620('0x22')](handleError(_0x3800b9));};exports[_0x8620('0x44')]=function(_0x14ef8d,_0x40fbe1){logger[_0x8620('0x14')](_0x8620('0x45'),_0x40fbe1[_0x8620('0x2e')]);var _0x5828f0=callsValidation[_0x8620('0xd')](_0x14ef8d['body']);if(_0x5828f0[_0x8620('0x2a')]>0x0){return _0x40fbe1[_0x8620('0x1b')](0x190)['json'](_0x5828f0);}var _0x3d1a8e=_0x14ef8d[_0x8620('0x2e')][_0x8620('0x39')];var _0x8e6711=respondWithRpcPromise('VoiceChannels');var _0x3329d4=getAgent(_0x3d1a8e);return Promise[_0x8620('0x26')]([_0x8e6711,_0x3329d4])[_0x8620('0x1f')](function(_0x2ef201){var _0x1a1de3=_0x2ef201[0x0];var _0x19023d=_0x2ef201[0x1];var _0x3c3c2c=_[_0x8620('0x27')](_0x1a1de3[_0x8620('0x46')],function(_0x1d5a1c){return _0x1d5a1c['UserId']==_0x19023d['id'];});return _0x40fbe1['status'](0xc8)[_0x8620('0x35')]({'count':_0x3c3c2c[_0x8620('0x2a')],'rows':_0x3c3c2c});})[_0x8620('0x22')](handleError(_0x40fbe1));};exports[_0x8620('0x47')]=function(_0x51ee32,_0x226d66){logger['info'](_0x8620('0x48'),_0x51ee32[_0x8620('0x2e')]);var _0x1b33e2=conferenceValidation[_0x8620('0xd')](_0x51ee32[_0x8620('0x2e')]);if(_0x1b33e2[_0x8620('0x2a')]>0x0){return _0x226d66[_0x8620('0x1b')](0x190)[_0x8620('0x35')](_0x1b33e2);}var _0x2ea79b=_0x51ee32[_0x8620('0x2e')][_0x8620('0x39')];return getAgent(_0x2ea79b)[_0x8620('0x1f')](function(_0x3f7dc7){logger[_0x8620('0x14')](_0x8620('0x32'),_0x3f7dc7[_0x8620('0x1a')]);emit(util[_0x8620('0x49')]('user:%s',_0x3f7dc7[_0x8620('0x1a')]),_0x8620('0x4a'));return _0x226d66['status'](0xc8)[_0x8620('0x35')]({'error':![],'message':_0x8620('0x4b')});})[_0x8620('0x22')](handleError(_0x226d66));};exports[_0x8620('0x4c')]=function(_0x4617cc,_0x7aa271){logger[_0x8620('0x14')]('transfer\x20fired:',_0x4617cc['body']);var _0x580560=transferValidation[_0x8620('0xd')](_0x4617cc['body']);if(_0x580560[_0x8620('0x2a')]>0x0){return _0x7aa271[_0x8620('0x1b')](0x190)['json'](_0x580560);}var _0x3115dd=_0x4617cc[_0x8620('0x2e')][_0x8620('0x39')];var _0x5c6bb8=_0x4617cc[_0x8620('0x2e')]['sessionId'];var _0x53cf47=_0x4617cc[_0x8620('0x2e')]['transferNumber'];return getAgent(_0x3115dd)[_0x8620('0x1f')](function(_0x2b6e4c){logger[_0x8620('0x14')](_0x8620('0x32'),_0x2b6e4c[_0x8620('0x1a')]);emit(util[_0x8620('0x49')]('user:%s',_0x2b6e4c[_0x8620('0x1a')]),_0x8620('0x4d'),{'sessionId':_0x5c6bb8,'transferNumber':_0x53cf47});return _0x7aa271[_0x8620('0x1b')](0xc8)[_0x8620('0x35')]({'error':![],'message':_0x8620('0x4e')});})[_0x8620('0x22')](handleError(_0x7aa271));}; \ No newline at end of file +var _0xa9e0=['name','status','send','NotFound','request','then','code','message','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','callNumber','callerId','entityFound:','format','webbar:originate','hangup','hangup\x20fired:','sessionId','webbar:hangup','hangup\x20executed!','catch','answer\x20fired:','userId','user:%s','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','bluebird','client','http','../../config/logger','webbarapi','ioredis','defaults','redis','localhost','validate','string','callNumber\x20is\x20required','number','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack'];(function(_0x568cb0,_0x1cbc08){var _0x2ae280=function(_0x4e3800){while(--_0x4e3800){_0x568cb0['push'](_0x568cb0['shift']());}};_0x2ae280(++_0x1cbc08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var path=require(_0x0a9e('0x0'));var fs=require('fs');var _=require(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x0a9e('0x3'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0a9e('0x4')][_0x0a9e('0x5')]({'port':0x232a});var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var Redis=require(_0x0a9e('0x8'));config['redis']=_[_0x0a9e('0x9')](config[_0x0a9e('0xa')],{'host':_0x0a9e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x0a9e('0xc'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0x0a9e('0xd'),'required':[!![],_0x0a9e('0xe')]},'callerId':{'type':_0x0a9e('0xd')},'callbackUrl':{'type':_0x0a9e('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x0a9e('0xf'),'required':[!![],_0x0a9e('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0a9e('0xf'),'required':[!![],_0x0a9e('0x10')]},'sessionId':{'type':_0x0a9e('0xd'),'required':[!![],_0x0a9e('0x11')]},'transferNumber':{'type':_0x0a9e('0xd'),'required':[!![],_0x0a9e('0x12')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x0a9e('0x10')]},'sessionId':{'type':_0x0a9e('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0a9e('0xf'),'required':[!![],_0x0a9e('0x10')]},'sessionId':{'type':_0x0a9e('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0a9e('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x0a9e('0xf'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x1985b6,_0x519dfd,_0x16033c){logger[_0x0a9e('0x13')](_0x1985b6,_0x519dfd,JSON['stringify'](_0x16033c));io['to'](_0x1985b6)[_0x0a9e('0x14')](_0x519dfd,_0x16033c);}function handleError(_0x5a0a06){return function(_0x459eb1){console[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x459eb1,_0x459eb1 instanceof RangeError);logger[_0x0a9e('0x17')](_0x459eb1[_0x0a9e('0x18')]);if(_0x459eb1 instanceof RangeError){if(_0x459eb1[_0x0a9e('0x19')]){delete _0x459eb1[_0x0a9e('0x19')];}_0x5a0a06[_0x0a9e('0x1a')](0x194)[_0x0a9e('0x1b')](_0x459eb1);}else{if(_0x459eb1[_0x0a9e('0x19')]){delete _0x459eb1[_0x0a9e('0x19')];}_0x5a0a06[_0x0a9e('0x1a')](0x1f4)['send'](_0x459eb1);}};}function checkError(){return function(_0x2c3407){if(!_0x2c3407){throw new RangeError(_0x0a9e('0x1c'));}return _0x2c3407;};}function respondWithRpcPromise(_0x53682f,_0x20f109){return new BPromise(function(_0x5a09ef,_0x588269){var _0x3a02e1=amiClient;return _0x3a02e1[_0x0a9e('0x1d')](_0x53682f,_0x20f109)[_0x0a9e('0x1e')](function(_0x30bae6){if(_0x30bae6['error']){if(_0x30bae6[_0x0a9e('0x17')][_0x0a9e('0x1f')]===0x1f4){return _0x588269(_0x30bae6[_0x0a9e('0x17')][_0x0a9e('0x20')]);}return _0x5a09ef(_0x30bae6[_0x0a9e('0x17')][_0x0a9e('0x20')]);}else{_0x5a09ef(_0x30bae6[_0x0a9e('0x21')]);}})['catch'](function(_0x59181e){_0x588269(_0x59181e);});});}function getAgent(_0x197ec0){return db[_0x0a9e('0x22')][_0x0a9e('0x23')]({'where':{'id':_0x197ec0,'role':_0x0a9e('0x24')}})['then'](checkError());}function getAgentCheckSession(_0x384319,_0x479bc4){return new BPromise(function(_0x45a1e7,_0x5bfb33){var _0x1dc186=respondWithRpcPromise(_0x0a9e('0x25'));var _0x25fba9=getAgent(_0x384319);Promise[_0x0a9e('0x26')]([_0x1dc186,_0x25fba9])[_0x0a9e('0x1e')](function(_0x1538a4){var _0x11c3b6=_0x1538a4[0x0];var _0x14de77=_0x1538a4[0x1];var _0x5a101a=_[_0x0a9e('0x27')](_0x11c3b6[_0x0a9e('0x28')],function(_0x2b1f27){return _0x2b1f27[_0x0a9e('0x29')]==_0x14de77['id']&&_0x2b1f27['sessionId']==_0x479bc4;});if(_0x5a101a[_0x0a9e('0x2a')]==0x1){_0x45a1e7(_0x14de77);}else{_0x5bfb33(new RangeError(_0x0a9e('0x2b')+_0x479bc4+_0x0a9e('0x2c')));}});});}exports[_0x0a9e('0x2d')]=function(_0x58b06f,_0x563b45){logger[_0x0a9e('0x13')](_0x0a9e('0x2e'),_0x58b06f[_0x0a9e('0x2f')]);var _0x540530=originateValidation[_0x0a9e('0xc')](_0x58b06f['body']);if(_0x540530[_0x0a9e('0x2a')]>0x0){return _0x563b45[_0x0a9e('0x1a')](0x190)[_0x0a9e('0x30')](_0x540530);}var _0x33bdb7=_0x58b06f[_0x0a9e('0x2f')]['userId'];var _0x66c1d2=_0x58b06f[_0x0a9e('0x2f')][_0x0a9e('0x31')];var _0x2da5c0=_0x58b06f[_0x0a9e('0x2f')][_0x0a9e('0x32')];var _0x332d35=_0x58b06f[_0x0a9e('0x2f')]['callbackUrl'];return getAgent(_0x33bdb7)[_0x0a9e('0x1e')](function(_0x5e7238){logger[_0x0a9e('0x13')](_0x0a9e('0x33'),_0x5e7238[_0x0a9e('0x19')]);emit(util[_0x0a9e('0x34')]('user:%s',_0x5e7238[_0x0a9e('0x19')]),_0x0a9e('0x35'),{'callNumber':_0x66c1d2,'callerId':_0x2da5c0,'callbackUrl':_0x332d35});return _0x563b45[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0x30')]({'error':![],'message':'originate\x20executed!'});})['catch'](handleError(_0x563b45));};exports[_0x0a9e('0x36')]=function(_0x5640eb,_0x24936a){logger[_0x0a9e('0x13')](_0x0a9e('0x37'),_0x5640eb[_0x0a9e('0x2f')]);var _0x4f41ae=hangupValidation[_0x0a9e('0xc')](_0x5640eb[_0x0a9e('0x2f')]);if(_0x4f41ae[_0x0a9e('0x2a')]>0x0){return _0x24936a['status'](0x190)[_0x0a9e('0x30')](_0x4f41ae);}var _0x1a180b=_0x5640eb[_0x0a9e('0x2f')]['userId'];var _0x546ef8=_0x5640eb[_0x0a9e('0x2f')][_0x0a9e('0x38')];return getAgent(_0x1a180b)['then'](function(_0x2b814e){logger[_0x0a9e('0x13')](_0x0a9e('0x33'),_0x2b814e[_0x0a9e('0x19')]);emit(util['format']('user:%s',_0x2b814e[_0x0a9e('0x19')]),_0x0a9e('0x39'),{'sessionId':_0x546ef8});return _0x24936a['status'](0xc8)[_0x0a9e('0x30')]({'error':![],'message':_0x0a9e('0x3a')});})[_0x0a9e('0x3b')](handleError(_0x24936a));};exports['answer']=function(_0x316c8f,_0x2cfea9){logger[_0x0a9e('0x13')](_0x0a9e('0x3c'),_0x316c8f[_0x0a9e('0x2f')]);var _0xeaa5e5=answerValidation[_0x0a9e('0xc')](_0x316c8f[_0x0a9e('0x2f')]);if(_0xeaa5e5[_0x0a9e('0x2a')]>0x0){return _0x2cfea9[_0x0a9e('0x1a')](0x190)[_0x0a9e('0x30')](_0xeaa5e5);}var _0x148007=_0x316c8f[_0x0a9e('0x2f')][_0x0a9e('0x3d')];var _0x37f6cc=_0x316c8f['body']['sessionId'];return getAgent(_0x148007)[_0x0a9e('0x1e')](function(_0xb3795a){logger[_0x0a9e('0x13')](_0x0a9e('0x33'),_0xb3795a[_0x0a9e('0x19')]);emit(util[_0x0a9e('0x34')](_0x0a9e('0x3e'),_0xb3795a[_0x0a9e('0x19')]),_0x0a9e('0x3f'),{'sessionId':_0x37f6cc});return _0x2cfea9[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0x30')]({'error':![],'message':_0x0a9e('0x40')});})['catch'](handleError(_0x2cfea9));};exports[_0x0a9e('0x41')]=function(_0x138b8b,_0xdd268f){logger[_0x0a9e('0x13')](_0x0a9e('0x42'),_0x138b8b[_0x0a9e('0x2f')]);var _0x21eb86=holdValidation[_0x0a9e('0xc')](_0x138b8b['body']);if(_0x21eb86[_0x0a9e('0x2a')]>0x0){return _0xdd268f['status'](0x190)[_0x0a9e('0x30')](_0x21eb86);}var _0x476688=_0x138b8b[_0x0a9e('0x2f')]['userId'];var _0x14bec2=_0x138b8b[_0x0a9e('0x2f')][_0x0a9e('0x38')];return getAgent(_0x476688)[_0x0a9e('0x1e')](function(_0x45c845){logger[_0x0a9e('0x13')](_0x0a9e('0x33'),_0x45c845['name']);emit(util[_0x0a9e('0x34')](_0x0a9e('0x3e'),_0x45c845[_0x0a9e('0x19')]),_0x0a9e('0x43'),{'sessionId':_0x14bec2});return _0xdd268f[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0x30')]({'error':![],'message':_0x0a9e('0x44')});})[_0x0a9e('0x3b')](handleError(_0xdd268f));};exports[_0x0a9e('0x45')]=function(_0x58a5c2,_0xe401a){logger[_0x0a9e('0x13')]('unhold\x20fired:',_0x58a5c2['body']);var _0x5ddf84=unholdValidation[_0x0a9e('0xc')](_0x58a5c2[_0x0a9e('0x2f')]);if(_0x5ddf84[_0x0a9e('0x2a')]>0x0){return _0xe401a[_0x0a9e('0x1a')](0x190)[_0x0a9e('0x30')](_0x5ddf84);}var _0x30decb=_0x58a5c2[_0x0a9e('0x2f')][_0x0a9e('0x3d')];var _0x5d38ae=_0x58a5c2['body']['sessionId'];return getAgent(_0x30decb)[_0x0a9e('0x1e')](function(_0x204173){logger[_0x0a9e('0x13')]('entityFound:',_0x204173[_0x0a9e('0x19')]);emit(util[_0x0a9e('0x34')]('user:%s',_0x204173['name']),_0x0a9e('0x46'),{'sessionId':_0x5d38ae});return _0xe401a['status'](0xc8)[_0x0a9e('0x30')]({'error':![],'message':'unhold\x20executed!'});})[_0x0a9e('0x3b')](handleError(_0xe401a));};exports[_0x0a9e('0x47')]=function(_0x439340,_0x53613a){logger[_0x0a9e('0x13')](_0x0a9e('0x48'),_0x53613a['body']);var _0x50f687=callsValidation[_0x0a9e('0xc')](_0x439340[_0x0a9e('0x2f')]);if(_0x50f687['length']>0x0){return _0x53613a[_0x0a9e('0x1a')](0x190)['json'](_0x50f687);}var _0x211ef9=_0x439340['body'][_0x0a9e('0x3d')];var _0x4a6deb=respondWithRpcPromise('VoiceChannels');var _0x5df0ad=getAgent(_0x211ef9);return Promise[_0x0a9e('0x26')]([_0x4a6deb,_0x5df0ad])['then'](function(_0x2f7092){var _0x65432=_0x2f7092[0x0];var _0x3cfd00=_0x2f7092[0x1];var _0x19b4df=_[_0x0a9e('0x27')](_0x65432[_0x0a9e('0x28')],function(_0xd10662){return _0xd10662[_0x0a9e('0x29')]==_0x3cfd00['id'];});return _0x53613a['status'](0xc8)[_0x0a9e('0x30')]({'count':_0x19b4df[_0x0a9e('0x2a')],'rows':_0x19b4df});})[_0x0a9e('0x3b')](handleError(_0x53613a));};exports[_0x0a9e('0x49')]=function(_0xb83dfd,_0x156662){logger['info'](_0x0a9e('0x4a'),_0xb83dfd[_0x0a9e('0x2f')]);var _0x5239ef=conferenceValidation[_0x0a9e('0xc')](_0xb83dfd['body']);if(_0x5239ef[_0x0a9e('0x2a')]>0x0){return _0x156662['status'](0x190)['json'](_0x5239ef);}var _0x5674ee=_0xb83dfd[_0x0a9e('0x2f')]['userId'];return getAgent(_0x5674ee)[_0x0a9e('0x1e')](function(_0x1fc70e){logger[_0x0a9e('0x13')](_0x0a9e('0x33'),_0x1fc70e[_0x0a9e('0x19')]);emit(util[_0x0a9e('0x34')]('user:%s',_0x1fc70e[_0x0a9e('0x19')]),'webbar:conference');return _0x156662[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0x30')]({'error':![],'message':_0x0a9e('0x4b')});})['catch'](handleError(_0x156662));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){logger[_0x0a9e('0x13')]('transfer\x20fired:',_0x156f1c[_0x0a9e('0x2f')]);var _0xe05a5a=transferValidation['validate'](_0x156f1c[_0x0a9e('0x2f')]);if(_0xe05a5a[_0x0a9e('0x2a')]>0x0){return _0x119677[_0x0a9e('0x1a')](0x190)[_0x0a9e('0x30')](_0xe05a5a);}var _0x401837=_0x156f1c['body'][_0x0a9e('0x3d')];var _0x2937e0=_0x156f1c[_0x0a9e('0x2f')]['sessionId'];var _0x3528b7=_0x156f1c['body']['transferNumber'];return getAgent(_0x401837)[_0x0a9e('0x1e')](function(_0x4556c5){logger[_0x0a9e('0x13')](_0x0a9e('0x33'),_0x4556c5[_0x0a9e('0x19')]);emit(util[_0x0a9e('0x34')](_0x0a9e('0x3e'),_0x4556c5[_0x0a9e('0x19')]),_0x0a9e('0x4d'),{'sessionId':_0x2937e0,'transferNumber':_0x3528b7});return _0x119677[_0x0a9e('0x1a')](0xc8)[_0x0a9e('0x30')]({'error':![],'message':_0x0a9e('0x4e')});})[_0x0a9e('0x3b')](handleError(_0x119677));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 4cbca9c..567c64a 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 _0x5bcb=['getApplications','post','create','addDisposition','addAnswer','/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/applications'];(function(_0x462414,_0x5a265a){var _0xbf0a2b=function(_0x2387f7){while(--_0x2387f7){_0x462414['push'](_0x462414['shift']());}};_0xbf0a2b(++_0x5a265a);}(_0x5bcb,0x7a));var _0xb5bc=function(_0x2b39eb,_0x531ed7){_0x2b39eb=_0x2b39eb-0x0;var _0x1987db=_0x5bcb[_0x2b39eb];return _0x1987db;};'use strict';var multer=require(_0xb5bc('0x0'));var util=require(_0xb5bc('0x1'));var path=require(_0xb5bc('0x2'));var timeout=require(_0xb5bc('0x3'));var express=require(_0xb5bc('0x4'));var router=express[_0xb5bc('0x5')]();var auth=require(_0xb5bc('0x6'));var interaction=require(_0xb5bc('0x7'));var config=require(_0xb5bc('0x8'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0xb5bc('0x9')](),controller[_0xb5bc('0xa')]);router[_0xb5bc('0xb')]('/describe',auth['isAuthenticated'](),controller[_0xb5bc('0xc')]);router[_0xb5bc('0xb')](_0xb5bc('0xd'),auth['isAuthenticated'](),controller[_0xb5bc('0xe')]);router['get'](_0xb5bc('0xf'),auth[_0xb5bc('0x9')](),controller['getDispositions']);router[_0xb5bc('0xb')](_0xb5bc('0x10'),auth[_0xb5bc('0x9')](),controller['getAnswers']);router[_0xb5bc('0xb')]('/:id/users',auth[_0xb5bc('0x9')](),controller['getAgents']);router[_0xb5bc('0xb')](_0xb5bc('0x11'),auth[_0xb5bc('0x9')](),controller[_0xb5bc('0x12')]);router[_0xb5bc('0x13')]('/',auth[_0xb5bc('0x9')](),controller[_0xb5bc('0x14')]);router[_0xb5bc('0x13')]('/:id/dispositions',auth[_0xb5bc('0x9')](),controller[_0xb5bc('0x15')]);router[_0xb5bc('0x13')](_0xb5bc('0x10'),auth['isAuthenticated'](),controller[_0xb5bc('0x16')]);router[_0xb5bc('0x13')](_0xb5bc('0x17'),auth[_0xb5bc('0x9')](),controller[_0xb5bc('0x18')]);router[_0xb5bc('0x13')]('/:id/applications',auth[_0xb5bc('0x9')](),controller[_0xb5bc('0x19')]);router[_0xb5bc('0x13')](_0xb5bc('0x1a'),controller[_0xb5bc('0x1b')]);router[_0xb5bc('0x13')](_0xb5bc('0x1c'),auth[_0xb5bc('0x9')](),controller[_0xb5bc('0x1d')]);router[_0xb5bc('0x1e')](_0xb5bc('0xd'),auth[_0xb5bc('0x9')](),controller[_0xb5bc('0x1f')]);router[_0xb5bc('0x20')](_0xb5bc('0xd'),auth[_0xb5bc('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0xb5bc('0x10'),auth['isAuthenticated'](),controller[_0xb5bc('0x21')]);router[_0xb5bc('0x20')]('/:id/users',auth['isAuthenticated'](),controller[_0xb5bc('0x22')]);module['exports']=router; \ No newline at end of file +var _0x85fc=['getAgents','post','addAnswer','addAgents','addApplications','/:id/notify','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','/describe','/:id','/:id/dispositions','isAuthenticated','/:id/canned_answers','getAnswers','/:id/users'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x85fc,0xfd));var _0xc85f=function(_0x1e6a2c,_0x3c3e90){_0x1e6a2c=_0x1e6a2c-0x0;var _0xdab7f3=_0x85fc[_0x1e6a2c];return _0xdab7f3;};'use strict';var multer=require('multer');var util=require(_0xc85f('0x0'));var path=require('path');var timeout=require(_0xc85f('0x1'));var express=require(_0xc85f('0x2'));var router=express[_0xc85f('0x3')]();var auth=require(_0xc85f('0x4'));var interaction=require(_0xc85f('0x5'));var config=require(_0xc85f('0x6'));var controller=require(_0xc85f('0x7'));router[_0xc85f('0x8')]('/',auth['isAuthenticated'](),controller[_0xc85f('0x9')]);router['get'](_0xc85f('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xc85f('0x8')](_0xc85f('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xc85f('0x8')](_0xc85f('0xc'),auth[_0xc85f('0xd')](),controller['getDispositions']);router[_0xc85f('0x8')](_0xc85f('0xe'),auth['isAuthenticated'](),controller[_0xc85f('0xf')]);router[_0xc85f('0x8')](_0xc85f('0x10'),auth[_0xc85f('0xd')](),controller[_0xc85f('0x11')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router['post']('/',auth[_0xc85f('0xd')](),controller['create']);router[_0xc85f('0x12')](_0xc85f('0xc'),auth[_0xc85f('0xd')](),controller['addDisposition']);router['post'](_0xc85f('0xe'),auth[_0xc85f('0xd')](),controller[_0xc85f('0x13')]);router['post'](_0xc85f('0x10'),auth['isAuthenticated'](),controller[_0xc85f('0x14')]);router['post']('/:id/applications',auth[_0xc85f('0xd')](),controller[_0xc85f('0x15')]);router['post'](_0xc85f('0x16'),controller['notify']);router[_0xc85f('0x12')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0xc85f('0x17')](_0xc85f('0xb'),auth[_0xc85f('0xd')](),controller['update']);router[_0xc85f('0x18')](_0xc85f('0xb'),auth[_0xc85f('0xd')](),controller[_0xc85f('0x19')]);router[_0xc85f('0x18')](_0xc85f('0xc'),auth[_0xc85f('0xd')](),controller[_0xc85f('0x1a')]);router[_0xc85f('0x18')](_0xc85f('0xe'),auth[_0xc85f('0xd')](),controller[_0xc85f('0x1b')]);router[_0xc85f('0x18')](_0xc85f('0x10'),auth[_0xc85f('0xd')](),controller[_0xc85f('0x1c')]);module[_0xc85f('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 3f2592b..5e9a693 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 _0xa927=['exports','STRING','name','generate','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0xa927,0x7e));var _0x7a92=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa927[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x7a92('0x0'));var rs=require(_0x7a92('0x1'));module[_0x7a92('0x2')]={'name':{'type':Sequelize[_0x7a92('0x3')],'unique':_0x7a92('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x7a92('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x7a92('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x7a92('0x3')],'defaultValue':function(){return rs[_0x7a92('0x5')]();}},'phone':{'type':Sequelize[_0x7a92('0x3')]},'type':{'type':Sequelize['ENUM'](_0x7a92('0x6'))},'accountSid':{'type':Sequelize[_0x7a92('0x3')]},'authToken':{'type':Sequelize[_0x7a92('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7a92('0x7')],'defaultValue':function(){return _0x7a92('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x7a92('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7a92('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7a92('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7a92('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7a92('0xa')],'comment':_0x7a92('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7a92('0xc'),'set':function(_0x1d97e8){if(!_0x1d97e8){this['setDataValue'](_0x7a92('0xd'),null);}this[_0x7a92('0xe')](_0x7a92('0xf'),_0x1d97e8);}},'description':{'type':Sequelize[_0x7a92('0x3')]}}; \ No newline at end of file +var _0xb7c7=['randomstring','exports','STRING','name','generate','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb7c7,0xb5));var _0x7b7c=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0xb7c7[_0xd050c6];return _0x7278a;};'use strict';var Sequelize=require(_0x7b7c('0x0'));var rs=require(_0x7b7c('0x1'));module[_0x7b7c('0x2')]={'name':{'type':Sequelize[_0x7b7c('0x3')],'unique':_0x7b7c('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x7b7c('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x7b7c('0x3')],'defaultValue':function(){return rs[_0x7b7c('0x5')]();}},'phone':{'type':Sequelize[_0x7b7c('0x3')]},'type':{'type':Sequelize['ENUM'](_0x7b7c('0x6'))},'accountSid':{'type':Sequelize[_0x7b7c('0x3')]},'authToken':{'type':Sequelize[_0x7b7c('0x3')]},'notificationTemplate':{'type':Sequelize[_0x7b7c('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7b7c('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x7b7c('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7b7c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7b7c('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7b7c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7b7c('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7b7c('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7b7c('0x9')],'comment':_0x7b7c('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7b7c('0xb'),'set':function(_0xc44ae8){if(!_0xc44ae8){this[_0x7b7c('0xc')]('mandatoryDispositionPauseId',null);}this['setDataValue'](_0x7b7c('0xd'),_0xc44ae8);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 2b473d3..6447a2c 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 _0x58a4=['out','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','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~!@#$%^&-_=+[{]}.','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','params','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','length','sort','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','applications','orderBy','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','type','twilio','from','From','replace','whatsapp:','Body','messageId','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','CmContact','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','WhatsappMessage','ContactId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','Start','debug','entity\x20found','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List'];(function(_0x2420e2,_0x589381){var _0x4635a0=function(_0x4694d9){while(--_0x4694d9){_0x2420e2['push'](_0x2420e2['shift']());}};_0x4635a0(++_0x589381);}(_0x58a4,0xbf));var _0x458a=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x58a4[_0x5c2e3e];return _0x53f64a;};'use strict';var pdf=require(_0x458a('0x0'));var emlformat=require(_0x458a('0x1'));var rimraf=require(_0x458a('0x2'));var zipdir=require(_0x458a('0x3'));var jsonpatch=require(_0x458a('0x4'));var rp=require(_0x458a('0x5'));var moment=require(_0x458a('0x6'));var BPromise=require(_0x458a('0x7'));var Mustache=require(_0x458a('0x8'));var util=require(_0x458a('0x9'));var path=require(_0x458a('0xa'));var sox=require(_0x458a('0xb'));var csv=require(_0x458a('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var db=require(_0x458a('0x18'))['db'];config[_0x458a('0x19')]=_[_0x458a('0x1a')](config[_0x458a('0x19')],{'host':_0x458a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x458a('0x1c'))['register'](socket);var jayson=require(_0x458a('0x1d'));var client=jayson[_0x458a('0x1e')][_0x458a('0x1f')]({'port':0x232c});function checkPasswordPattern(_0x3b74f9,_0xad80f9,_0x29acee){if(_0x29acee){var _0x507b0f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x507b0f['test'](_0xad80f9)){return _0x3b74f9;}else{throw new db['Sequelize'][(_0x458a('0x20'))](_0x458a('0x21'));}}else{return _0x3b74f9;}}function respondWithRpcPromise(_0x3558b9,_0x5c5b41,_0x310569,_0x260c87){return new BPromise(function(_0x18504d,_0x392986){var _0xa91473=_0x260c87||client;return _0xa91473['request'](_0x3558b9,_0x310569)['then'](function(_0x178db9){logger['info'](_0x458a('0x22'),_0x5c5b41,_0x458a('0x23'));logger['debug'](_0x458a('0x24'),_0x5c5b41,'request\x20sent',JSON[_0x458a('0x25')](_0x178db9));if(_0x178db9[_0x458a('0x26')]){if(_0x178db9['error'][_0x458a('0x27')]===0x1f4){logger[_0x458a('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x5c5b41,_0x178db9[_0x458a('0x26')]['message']);return _0x392986(_0x178db9[_0x458a('0x26')]['message']);}logger[_0x458a('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x5c5b41,_0x178db9[_0x458a('0x26')][_0x458a('0x28')]);return _0x18504d(_0x178db9[_0x458a('0x26')][_0x458a('0x28')]);}else{logger[_0x458a('0x29')](_0x458a('0x22'),_0x5c5b41,_0x458a('0x23'));_0x18504d(_0x178db9[_0x458a('0x2a')][_0x458a('0x28')]);}})[_0x458a('0x2b')](function(_0x52efed){logger[_0x458a('0x26')](_0x458a('0x22'),_0x5c5b41,_0x52efed);_0x392986(_0x52efed);});});}function respondWithStatusCode(_0x5a55b7,_0xb94bd9){_0xb94bd9=_0xb94bd9||0xcc;return function(_0x112fa6){if(_0x112fa6){return _0x5a55b7['sendStatus'](_0xb94bd9);}return _0x5a55b7['status'](_0xb94bd9)[_0x458a('0x2c')]();};}function respondWithResult(_0x596fe2,_0x33c5d8){_0x33c5d8=_0x33c5d8||0xc8;return function(_0x29f9b5){if(_0x29f9b5){return _0x596fe2[_0x458a('0x2d')](_0x33c5d8)['json'](_0x29f9b5);}};}function respondWithFilteredResult(_0xa6fdf,_0x2531f7){return function(_0x1426a8){if(_0x1426a8){var _0x562c36=_0x1426a8[_0x458a('0x2e')],_0x47e20d=_0x2531f7['offset'],_0x18c890=_0x2531f7[_0x458a('0x2f')]+_0x2531f7[_0x458a('0x30')],_0x4cf059;if(_0x18c890>=_0x562c36){_0x18c890=_0x562c36;_0x4cf059=0xc8;}else{_0x4cf059=0xce;}_0xa6fdf['status'](_0x4cf059);return _0xa6fdf[_0x458a('0x31')](_0x458a('0x32'),_0x47e20d+'-'+_0x18c890+'/'+_0x562c36)[_0x458a('0x33')](_0x1426a8);}return null;};}function patchUpdates(_0x525caf){return function(_0x3371c3){try{jsonpatch[_0x458a('0x34')](_0x3371c3,_0x525caf,!![]);}catch(_0xaf233b){return BPromise[_0x458a('0x35')](_0xaf233b);}return _0x3371c3[_0x458a('0x36')]();};}function saveUpdates(_0x4fd30f,_0x244ae0){return function(_0x40c80c){if(_0x40c80c){return _0x40c80c[_0x458a('0x37')](_0x4fd30f)[_0x458a('0x38')](function(_0x35ec8f){return _0x35ec8f;});}return null;};}function removeEntity(_0xb1ed1e,_0x4a4808){return function(_0x2a6b9c){if(_0x2a6b9c){return _0x2a6b9c[_0x458a('0x39')]()[_0x458a('0x38')](function(){var _0x2f9b7b=_0x2a6b9c[_0x458a('0x3a')]({'plain':!![]});var _0x19d73a=_0x458a('0x3b');return db[_0x458a('0x3c')][_0x458a('0x39')]({'where':{'type':_0x19d73a,'resourceId':_0x2f9b7b['id']}})['then'](function(){return _0x2a6b9c;});})[_0x458a('0x38')](function(){_0xb1ed1e[_0x458a('0x2d')](0xcc)[_0x458a('0x2c')]();});}};}function handleEntityNotFound(_0x101ece,_0x42e092){return function(_0x2ba6ca){if(!_0x2ba6ca){_0x101ece[_0x458a('0x3d')](0x194);}return _0x2ba6ca;};}function handleError(_0x240cf8,_0x44cf62){_0x44cf62=_0x44cf62||0x1f4;return function(_0x1ecf2f){logger[_0x458a('0x26')](_0x1ecf2f[_0x458a('0x3e')]);if(_0x1ecf2f[_0x458a('0x3f')]){delete _0x1ecf2f[_0x458a('0x3f')];}_0x240cf8[_0x458a('0x2d')](_0x44cf62)['send'](_0x1ecf2f);};}exports[_0x458a('0x40')]=function(_0x397a41,_0x12849d){var _0x12dad4={'include':[{'model':db[_0x458a('0x41')],'as':_0x458a('0x42')}]},_0x3c5840={},_0x46c1de={'count':0x0,'rows':[]};var _0x41d125=_[_0x458a('0x43')](db[_0x458a('0x44')]['rawAttributes'],function(_0x95c42c){return{'name':_0x95c42c[_0x458a('0x45')],'type':_0x95c42c['type'][_0x458a('0x46')]};});_0x3c5840[_0x458a('0x47')]=_[_0x458a('0x43')](_0x41d125,'name');_0x3c5840[_0x458a('0x48')]=_[_0x458a('0x49')](_0x397a41[_0x458a('0x48')]);_0x3c5840[_0x458a('0x4a')]=_[_0x458a('0x4b')](_0x3c5840[_0x458a('0x47')],_0x3c5840[_0x458a('0x48')]);_0x12dad4[_0x458a('0x4c')]=_['intersection'](_0x3c5840[_0x458a('0x47')],qs[_0x458a('0x4d')](_0x397a41[_0x458a('0x48')]['fields']));_0x12dad4[_0x458a('0x4c')]=_0x12dad4[_0x458a('0x4c')]['length']?_0x12dad4[_0x458a('0x4c')]:_0x3c5840[_0x458a('0x47')];if(!_0x397a41[_0x458a('0x48')][_0x458a('0x4e')](_0x458a('0x4f'))){_0x12dad4['limit']=qs['limit'](_0x397a41[_0x458a('0x48')][_0x458a('0x30')]);_0x12dad4[_0x458a('0x2f')]=qs[_0x458a('0x2f')](_0x397a41['query'][_0x458a('0x2f')]);}_0x12dad4[_0x458a('0x50')]=qs['sort'](_0x397a41[_0x458a('0x48')]['sort']);_0x12dad4[_0x458a('0x51')]=qs[_0x458a('0x4a')](_[_0x458a('0x52')](_0x397a41['query'],_0x3c5840[_0x458a('0x4a')]),_0x41d125);if(_0x397a41[_0x458a('0x48')][_0x458a('0x53')]){_0x12dad4['where']=_['merge'](_0x12dad4[_0x458a('0x51')],{'$or':_[_0x458a('0x43')](_0x41d125,function(_0x319863){if(_0x319863['type']!=='VIRTUAL'){var _0x3a7005={};_0x3a7005[_0x319863[_0x458a('0x3f')]]={'$like':'%'+_0x397a41[_0x458a('0x48')][_0x458a('0x53')]+'%'};return _0x3a7005;}})});}_0x12dad4=_[_0x458a('0x54')]({},_0x12dad4,_0x397a41[_0x458a('0x55')]);var _0x41ed70={'where':_0x12dad4[_0x458a('0x51')]};return db[_0x458a('0x44')][_0x458a('0x2e')](_0x41ed70)[_0x458a('0x38')](function(_0x39c41c){_0x46c1de[_0x458a('0x2e')]=_0x39c41c;if(_0x397a41[_0x458a('0x48')][_0x458a('0x56')]){_0x12dad4[_0x458a('0x57')]=[{'all':!![]}];}return db['WhatsappAccount'][_0x458a('0x58')](_0x12dad4);})[_0x458a('0x38')](function(_0x422f6b){_0x46c1de[_0x458a('0x59')]=_0x422f6b;return _0x46c1de;})[_0x458a('0x38')](respondWithFilteredResult(_0x12849d,_0x12dad4))['catch'](handleError(_0x12849d,null));};exports['show']=function(_0x514d82,_0x2abf75){var _0x5b47e0={'raw':![],'where':{'id':_0x514d82[_0x458a('0x5a')]['id']},'include':[{'model':db[_0x458a('0x41')],'as':_0x458a('0x42')}]},_0x236d2f={};_0x236d2f[_0x458a('0x47')]=_['keys'](db['WhatsappAccount'][_0x458a('0x5b')]);_0x236d2f[_0x458a('0x48')]=_[_0x458a('0x49')](_0x514d82[_0x458a('0x48')]);_0x236d2f[_0x458a('0x4a')]=_['intersection'](_0x236d2f[_0x458a('0x47')],_0x236d2f['query']);_0x5b47e0[_0x458a('0x4c')]=_['intersection'](_0x236d2f[_0x458a('0x47')],qs['fields'](_0x514d82['query']['fields']));_0x5b47e0[_0x458a('0x4c')]=_0x5b47e0[_0x458a('0x4c')]['length']?_0x5b47e0[_0x458a('0x4c')]:_0x236d2f[_0x458a('0x47')];if(_0x514d82[_0x458a('0x48')]['includeAll']){_0x5b47e0[_0x458a('0x57')]=[{'all':!![]}];}_0x5b47e0=_[_0x458a('0x54')]({},_0x5b47e0,_0x514d82[_0x458a('0x55')]);return db[_0x458a('0x44')][_0x458a('0x5c')](_0x5b47e0)[_0x458a('0x38')](handleEntityNotFound(_0x2abf75,null))['then'](respondWithResult(_0x2abf75,null))[_0x458a('0x2b')](handleError(_0x2abf75,null));};exports[_0x458a('0x5d')]=function(_0x45325f,_0x39e5b5){return db[_0x458a('0x44')][_0x458a('0x5d')](_0x45325f[_0x458a('0x5e')],{})[_0x458a('0x38')](function(_0x50fdf4){var _0xb365f5=_0x45325f['user'][_0x458a('0x3a')]({'plain':!![]});if(!_0xb365f5)throw new Error(_0x458a('0x5f'));if(_0xb365f5[_0x458a('0x60')]===_0x458a('0x61')){var _0x4da240=_0x50fdf4['get']({'plain':!![]});var _0xe7dc86=_0x458a('0x3b');return db[_0x458a('0x62')][_0x458a('0x5c')]({'where':{'name':_0xe7dc86,'userProfileId':_0xb365f5[_0x458a('0x63')]},'raw':!![]})[_0x458a('0x38')](function(_0x549cc2){if(_0x549cc2&&_0x549cc2[_0x458a('0x64')]===0x0){return db[_0x458a('0x3c')]['create']({'name':_0x4da240[_0x458a('0x3f')],'resourceId':_0x4da240['id'],'type':_0x549cc2['name'],'sectionId':_0x549cc2['id']},{})[_0x458a('0x38')](function(){return _0x50fdf4;});}else{return _0x50fdf4;}})[_0x458a('0x2b')](function(_0xa37d44){logger[_0x458a('0x26')](_0x458a('0x65'),_0xa37d44);throw _0xa37d44;});}return _0x50fdf4;})[_0x458a('0x38')](respondWithResult(_0x39e5b5,0xc9))[_0x458a('0x2b')](handleError(_0x39e5b5,null));};exports[_0x458a('0x37')]=function(_0x4c97b4,_0x3fd126){if(_0x4c97b4[_0x458a('0x5e')]['id']){delete _0x4c97b4['body']['id'];}return db[_0x458a('0x44')][_0x458a('0x5c')]({'where':{'id':_0x4c97b4['params']['id']},'include':[{'model':db[_0x458a('0x41')],'as':_0x458a('0x42')}]})['then'](handleEntityNotFound(_0x3fd126,null))[_0x458a('0x38')](saveUpdates(_0x4c97b4[_0x458a('0x5e')],null))['then'](respondWithResult(_0x3fd126,null))[_0x458a('0x2b')](handleError(_0x3fd126,null));};exports[_0x458a('0x39')]=function(_0xce9756,_0x404d93){return db[_0x458a('0x44')][_0x458a('0x5c')]({'where':{'id':_0xce9756[_0x458a('0x5a')]['id']}})[_0x458a('0x38')](handleEntityNotFound(_0x404d93,null))['then'](removeEntity(_0x404d93,null))[_0x458a('0x2b')](handleError(_0x404d93,null));};exports[_0x458a('0x66')]=function(_0x29b11e,_0x31d520){return db[_0x458a('0x44')][_0x458a('0x66')]()[_0x458a('0x38')](respondWithResult(_0x31d520,null))[_0x458a('0x2b')](handleError(_0x31d520,null));};exports[_0x458a('0x67')]=function(_0xfe46ae,_0x546519,_0x3837b7){if(_0xfe46ae['body']['id']){delete _0xfe46ae[_0x458a('0x5e')]['id'];}return db[_0x458a('0x44')][_0x458a('0x5c')]({'where':{'id':_0xfe46ae[_0x458a('0x5a')]['id']}})[_0x458a('0x38')](handleEntityNotFound(_0x546519,null))[_0x458a('0x38')](function(_0x2c6a00){if(_0x2c6a00){_0xfe46ae[_0x458a('0x5e')][_0x458a('0x68')]=_0x2c6a00['id'];return db[_0x458a('0x69')][_0x458a('0x5d')](_0xfe46ae[_0x458a('0x5e')]);}})[_0x458a('0x38')](respondWithResult(_0x546519,null))[_0x458a('0x2b')](handleError(_0x546519,null));};exports[_0x458a('0x6a')]=function(_0x2c131b,_0x4c426a,_0x120b8e){var _0x573089={'raw':![],'where':{}};var _0x10dde3={};var _0x2ea9ce={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x458a('0x6b')]({'where':{'id':_0x2c131b[_0x458a('0x5a')]['id']}})[_0x458a('0x38')](handleEntityNotFound(_0x4c426a,null))['then'](function(_0x3cf58c){if(_0x3cf58c){_0x10dde3[_0x458a('0x47')]=_[_0x458a('0x49')](db[_0x458a('0x69')][_0x458a('0x5b')]);_0x10dde3[_0x458a('0x48')]=_['keys'](_0x2c131b[_0x458a('0x48')]);_0x10dde3['filters']=_['intersection'](_0x10dde3[_0x458a('0x47')],_0x10dde3[_0x458a('0x48')]);_0x573089[_0x458a('0x4c')]=_[_0x458a('0x4b')](_0x10dde3[_0x458a('0x47')],qs[_0x458a('0x4d')](_0x2c131b[_0x458a('0x48')][_0x458a('0x4d')]));_0x573089[_0x458a('0x4c')]=_0x573089[_0x458a('0x4c')][_0x458a('0x6c')]?_0x573089[_0x458a('0x4c')]:_0x10dde3[_0x458a('0x47')];if(!_0x2c131b[_0x458a('0x48')]['hasOwnProperty']('nolimit')){_0x573089['limit']=qs[_0x458a('0x30')](_0x2c131b['query'][_0x458a('0x30')]);_0x573089[_0x458a('0x2f')]=qs[_0x458a('0x2f')](_0x2c131b[_0x458a('0x48')][_0x458a('0x2f')]);}_0x573089[_0x458a('0x50')]=qs[_0x458a('0x6d')](_0x2c131b['query'][_0x458a('0x6d')]);_0x573089[_0x458a('0x51')]=qs['filters'](_[_0x458a('0x52')](_0x2c131b['query'],_0x10dde3[_0x458a('0x4a')]));_0x573089['where'][_0x458a('0x68')]=_0x3cf58c['id'];if(_0x2c131b[_0x458a('0x48')][_0x458a('0x53')]){_0x573089[_0x458a('0x51')]=_['merge'](_0x573089[_0x458a('0x51')],{'$or':_[_0x458a('0x43')](_0x573089[_0x458a('0x4c')],function(_0x239e2f){var _0x18fb71={};_0x18fb71[_0x239e2f]={'$like':'%'+_0x2c131b[_0x458a('0x48')][_0x458a('0x53')]+'%'};return _0x18fb71;})});}_0x573089=_[_0x458a('0x54')]({},_0x573089,_0x2c131b['options']);return db[_0x458a('0x69')][_0x458a('0x2e')]({'where':_0x573089[_0x458a('0x51')]})[_0x458a('0x38')](function(_0x591dbb){_0x2ea9ce[_0x458a('0x2e')]=_0x591dbb;if(_0x2c131b[_0x458a('0x48')]['includeAll']){_0x573089[_0x458a('0x57')]=[{'all':!![]}];}return db[_0x458a('0x69')][_0x458a('0x58')](_0x573089);})[_0x458a('0x38')](function(_0x3b0888){_0x2ea9ce['rows']=_0x3b0888;return _0x2ea9ce;});}})[_0x458a('0x38')](respondWithFilteredResult(_0x4c426a,_0x573089))[_0x458a('0x2b')](handleError(_0x4c426a,null));};exports[_0x458a('0x6e')]=function(_0x1dbaa7,_0x2006d7,_0x46ac5c){return db[_0x458a('0x44')]['find']({'where':{'id':_0x1dbaa7[_0x458a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2006d7,null))[_0x458a('0x38')](function(_0x36e650){if(_0x36e650){return _0x36e650[_0x458a('0x6e')](_0x1dbaa7['query'][_0x458a('0x6f')]);}})['then'](respondWithStatusCode(_0x2006d7,null))['catch'](handleError(_0x2006d7,null));};exports[_0x458a('0x70')]=function(_0x400601,_0x5464a5,_0x480e71){if(_0x400601[_0x458a('0x5e')]['id']){delete _0x400601[_0x458a('0x5e')]['id'];}return db[_0x458a('0x44')][_0x458a('0x5c')]({'where':{'id':_0x400601[_0x458a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5464a5,null))[_0x458a('0x38')](function(_0x579fa4){if(_0x579fa4){_0x400601[_0x458a('0x5e')][_0x458a('0x68')]=_0x579fa4['id'];return db[_0x458a('0x71')]['create'](_0x400601[_0x458a('0x5e')]);}})[_0x458a('0x38')](respondWithResult(_0x5464a5,null))['catch'](handleError(_0x5464a5,null));};exports[_0x458a('0x72')]=function(_0x5bf72f,_0x2c11c8,_0x3fc263){var _0x470a3f={'raw':![],'where':{}};var _0xcd3781={};var _0x55a431={'count':0x0,'rows':[]};return db[_0x458a('0x44')]['findOne']({'where':{'id':_0x5bf72f['params']['id']}})[_0x458a('0x38')](handleEntityNotFound(_0x2c11c8,null))[_0x458a('0x38')](function(_0x28c3e5){if(_0x28c3e5){_0xcd3781[_0x458a('0x47')]=_[_0x458a('0x49')](db[_0x458a('0x71')]['rawAttributes']);_0xcd3781[_0x458a('0x48')]=_[_0x458a('0x49')](_0x5bf72f[_0x458a('0x48')]);_0xcd3781[_0x458a('0x4a')]=_[_0x458a('0x4b')](_0xcd3781[_0x458a('0x47')],_0xcd3781['query']);_0x470a3f[_0x458a('0x4c')]=_[_0x458a('0x4b')](_0xcd3781[_0x458a('0x47')],qs['fields'](_0x5bf72f[_0x458a('0x48')][_0x458a('0x4d')]));_0x470a3f[_0x458a('0x4c')]=_0x470a3f['attributes']['length']?_0x470a3f[_0x458a('0x4c')]:_0xcd3781['model'];if(!_0x5bf72f['query']['hasOwnProperty']('nolimit')){_0x470a3f['limit']=qs[_0x458a('0x30')](_0x5bf72f['query'][_0x458a('0x30')]);_0x470a3f[_0x458a('0x2f')]=qs[_0x458a('0x2f')](_0x5bf72f[_0x458a('0x48')][_0x458a('0x2f')]);}_0x470a3f[_0x458a('0x50')]=qs['sort'](_0x5bf72f[_0x458a('0x48')]['sort']);_0x470a3f[_0x458a('0x51')]=qs['filters'](_[_0x458a('0x52')](_0x5bf72f[_0x458a('0x48')],_0xcd3781['filters']));_0x470a3f['where']['WhatsappAccountId']=_0x28c3e5['id'];if(_0x5bf72f[_0x458a('0x48')][_0x458a('0x53')]){_0x470a3f[_0x458a('0x51')]=_[_0x458a('0x54')](_0x470a3f[_0x458a('0x51')],{'$or':_['map'](_0x470a3f[_0x458a('0x4c')],function(_0x41e32f){var _0x137c4d={};_0x137c4d[_0x41e32f]={'$like':'%'+_0x5bf72f[_0x458a('0x48')][_0x458a('0x53')]+'%'};return _0x137c4d;})});}_0x470a3f=_[_0x458a('0x54')]({},_0x470a3f,_0x5bf72f[_0x458a('0x55')]);return db[_0x458a('0x71')]['count']({'where':_0x470a3f[_0x458a('0x51')]})[_0x458a('0x38')](function(_0x3dec45){_0x55a431[_0x458a('0x2e')]=_0x3dec45;if(_0x5bf72f[_0x458a('0x48')][_0x458a('0x56')]){_0x470a3f[_0x458a('0x57')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x470a3f);})['then'](function(_0x53a93e){_0x55a431[_0x458a('0x59')]=_0x53a93e;return _0x55a431;});}})[_0x458a('0x38')](respondWithFilteredResult(_0x2c11c8,_0x470a3f))[_0x458a('0x2b')](handleError(_0x2c11c8,null));};exports[_0x458a('0x73')]=function(_0x4d2115,_0x7db038,_0x4514df){return db[_0x458a('0x44')][_0x458a('0x5c')]({'where':{'id':_0x4d2115['params']['id']}})['then'](handleEntityNotFound(_0x7db038,null))[_0x458a('0x38')](function(_0x2a5b20){if(_0x2a5b20){return _0x2a5b20[_0x458a('0x73')](_0x4d2115[_0x458a('0x48')]['ids']);}})[_0x458a('0x38')](respondWithStatusCode(_0x7db038,null))[_0x458a('0x2b')](handleError(_0x7db038,null));};exports[_0x458a('0x74')]=function(_0x2e730c,_0x42a0dd,_0x1a658e){return db[_0x458a('0x44')][_0x458a('0x5c')]({'where':{'id':_0x2e730c[_0x458a('0x5a')]['id']}})[_0x458a('0x38')](handleEntityNotFound(_0x42a0dd,null))['then'](function(_0x5d334b){if(_0x5d334b){return _0x5d334b[_0x458a('0x74')](_0x2e730c[_0x458a('0x5e')][_0x458a('0x6f')],_[_0x458a('0x75')](_0x2e730c[_0x458a('0x5e')],[_0x458a('0x6f'),'id'])||{})[_0x458a('0x76')](function(_0x583d8a){for(var _0x36e854=0x0;_0x36e854<_0x2e730c['body'][_0x458a('0x6f')][_0x458a('0x6c')];_0x36e854+=0x1){socket[_0x458a('0x77')]('userWhatsappAccount:save',{'UserId':_0x2e730c['body'][_0x458a('0x6f')][_0x36e854],'WhatsappAccountId':_0x2e730c[_0x458a('0x5a')]['id']});}return _0x583d8a;});}})[_0x458a('0x38')](respondWithResult(_0x42a0dd,null))[_0x458a('0x2b')](handleError(_0x42a0dd,null));};exports[_0x458a('0x78')]=function(_0x53d065,_0x391854,_0x35d811){return db[_0x458a('0x44')][_0x458a('0x5c')]({'where':{'id':_0x53d065[_0x458a('0x5a')]['id']}})[_0x458a('0x38')](handleEntityNotFound(_0x391854,null))[_0x458a('0x38')](function(_0x3dc1fe){if(_0x3dc1fe){return _0x3dc1fe[_0x458a('0x78')](_0x53d065['query'][_0x458a('0x6f')])['then'](function(){if(_[_0x458a('0x79')](_0x53d065[_0x458a('0x48')][_0x458a('0x6f')])){for(var _0x58b920=0x0;_0x58b920<_0x53d065['query'][_0x458a('0x6f')]['length'];_0x58b920+=0x1){socket[_0x458a('0x77')]('userWhatsappAccount:remove',{'UserId':Number(_0x53d065[_0x458a('0x48')][_0x458a('0x6f')][_0x58b920]),'WhatsappAccountId':Number(_0x53d065[_0x458a('0x5a')]['id'])});}}else{socket['emit'](_0x458a('0x7a'),{'UserId':Number(_0x53d065[_0x458a('0x48')]['ids']),'WhatsappAccountId':Number(_0x53d065[_0x458a('0x5a')]['id'])});}});}})['then'](respondWithStatusCode(_0x391854,null))[_0x458a('0x2b')](handleError(_0x391854,null));};exports[_0x458a('0x7b')]=function(_0xe55a17,_0x49bdfc,_0x2c51f6){var _0x198306={};var _0x9f7d4={};var _0x3c09e2;var _0x395456;return db[_0x458a('0x44')]['findOne']({'where':{'id':_0xe55a17[_0x458a('0x5a')]['id']}})[_0x458a('0x38')](handleEntityNotFound(_0x49bdfc,null))['then'](function(_0x13db18){if(_0x13db18){_0x3c09e2=_0x13db18;_0x9f7d4[_0x458a('0x47')]=_[_0x458a('0x49')](db['User'][_0x458a('0x5b')]);_0x9f7d4[_0x458a('0x48')]=_[_0x458a('0x49')](_0xe55a17['query']);_0x9f7d4[_0x458a('0x4a')]=_[_0x458a('0x4b')](_0x9f7d4[_0x458a('0x47')],_0x9f7d4[_0x458a('0x48')]);_0x198306[_0x458a('0x4c')]=_[_0x458a('0x4b')](_0x9f7d4[_0x458a('0x47')],qs[_0x458a('0x4d')](_0xe55a17['query'][_0x458a('0x4d')]));_0x198306['attributes']=_0x198306['attributes'][_0x458a('0x6c')]?_0x198306[_0x458a('0x4c')]:_0x9f7d4['model'];_0x198306[_0x458a('0x50')]=qs['sort'](_0xe55a17[_0x458a('0x48')]['sort']);_0x198306[_0x458a('0x51')]=qs[_0x458a('0x4a')](_[_0x458a('0x52')](_0xe55a17[_0x458a('0x48')],_0x9f7d4['filters']));if(_0xe55a17[_0x458a('0x48')][_0x458a('0x53')]){_0x198306[_0x458a('0x51')]=_['merge'](_0x198306[_0x458a('0x51')],{'$or':_[_0x458a('0x43')](_0x198306[_0x458a('0x4c')],function(_0x274ac2){var _0x4ca16b={};_0x4ca16b[_0x274ac2]={'$like':'%'+_0xe55a17[_0x458a('0x48')]['filter']+'%'};return _0x4ca16b;})});}_0x198306=_['merge']({},_0x198306,_0xe55a17['options']);return _0x3c09e2[_0x458a('0x7b')](_0x198306);}})[_0x458a('0x38')](function(_0x4a1acc){if(_0x4a1acc){_0x395456=_0x4a1acc[_0x458a('0x6c')];if(!_0xe55a17['query'][_0x458a('0x4e')]('nolimit')){_0x198306[_0x458a('0x30')]=qs['limit'](_0xe55a17[_0x458a('0x48')][_0x458a('0x30')]);_0x198306[_0x458a('0x2f')]=qs[_0x458a('0x2f')](_0xe55a17[_0x458a('0x48')][_0x458a('0x2f')]);}return _0x3c09e2[_0x458a('0x7b')](_0x198306);}})['then'](function(_0x45ae1f){if(_0x45ae1f){return _0x45ae1f?{'count':_0x395456,'rows':_0x45ae1f}:null;}})[_0x458a('0x38')](respondWithResult(_0x49bdfc,null))[_0x458a('0x2b')](handleError(_0x49bdfc,null));};exports['addApplications']=function(_0x5c5a07,_0x334129,_0x39e9c2){return db[_0x458a('0x44')][_0x458a('0x6b')]({'where':{'id':_0x5c5a07[_0x458a('0x5a')]['id']}})['then'](handleEntityNotFound(_0x334129,null))[_0x458a('0x38')](function(_0x2416e1){if(_0x2416e1){return db[_0x458a('0x7c')][_0x458a('0x7d')](function(_0x250165){return db['WhatsappApplication'][_0x458a('0x39')]({'where':{'WhatsappAccountId':_0x5c5a07[_0x458a('0x5a')]['id']},'transaction':_0x250165})[_0x458a('0x38')](function(_0x2c2fbf){var _0x3cdc9f=_[_0x458a('0x43')](_0x5c5a07[_0x458a('0x5e')],function(_0x50c20c){_0x50c20c[_0x458a('0x68')]=_0x5c5a07['params']['id'];return _0x50c20c;});return db[_0x458a('0x7e')][_0x458a('0x7f')](_0x3cdc9f,{'transaction':_0x250165});});})[_0x458a('0x38')](function(){return db[_0x458a('0x7e')][_0x458a('0x80')]({'where':{'WhatsappAccountId':_0x5c5a07['params']['id']},'order':_0x458a('0x81')});});}})[_0x458a('0x38')](respondWithResult(_0x334129,null))[_0x458a('0x2b')](handleError(_0x334129,null));};exports[_0x458a('0x82')]=function(_0x1eca8e,_0x59bb86,_0x1f8d7f){var _0x381116={};var _0x3e3c19={};var _0x3d9af8;var _0x33e755;return db['WhatsappAccount']['findOne']({'where':{'id':_0x1eca8e['params']['id']}})[_0x458a('0x38')](handleEntityNotFound(_0x59bb86,null))[_0x458a('0x38')](function(_0xe951c6){if(_0xe951c6){_0x3d9af8=_0xe951c6;_0x3e3c19[_0x458a('0x47')]=_[_0x458a('0x49')](db['WhatsappApplication'][_0x458a('0x5b')]);_0x3e3c19[_0x458a('0x48')]=_['keys'](_0x1eca8e[_0x458a('0x48')]);_0x3e3c19[_0x458a('0x4a')]=_['intersection'](_0x3e3c19[_0x458a('0x47')],_0x3e3c19[_0x458a('0x48')]);_0x381116[_0x458a('0x4c')]=_['intersection'](_0x3e3c19['model'],qs[_0x458a('0x4d')](_0x1eca8e[_0x458a('0x48')]['fields']));_0x381116[_0x458a('0x4c')]=_0x381116['attributes'][_0x458a('0x6c')]?_0x381116[_0x458a('0x4c')]:_0x3e3c19['model'];_0x381116[_0x458a('0x50')]=qs[_0x458a('0x6d')](_0x1eca8e[_0x458a('0x48')]['sort']);_0x381116[_0x458a('0x51')]=qs[_0x458a('0x4a')](_[_0x458a('0x52')](_0x1eca8e[_0x458a('0x48')],_0x3e3c19['filters']));if(_0x1eca8e[_0x458a('0x48')][_0x458a('0x53')]){_0x381116[_0x458a('0x51')]=_[_0x458a('0x54')](_0x381116[_0x458a('0x51')],{'$or':_[_0x458a('0x43')](_0x381116['attributes'],function(_0x41920e){var _0x1968c6={};_0x1968c6[_0x41920e]={'$like':'%'+_0x1eca8e[_0x458a('0x48')]['filter']+'%'};return _0x1968c6;})});}_0x381116=_[_0x458a('0x54')]({},_0x381116,_0x1eca8e[_0x458a('0x55')]);return _0x3d9af8[_0x458a('0x82')](_0x381116);}})[_0x458a('0x38')](function(_0x4a1d9d){if(_0x4a1d9d){_0x33e755=_0x4a1d9d[_0x458a('0x6c')];if(!_0x1eca8e[_0x458a('0x48')][_0x458a('0x4e')](_0x458a('0x4f'))){_0x381116[_0x458a('0x30')]=qs[_0x458a('0x30')](_0x1eca8e['query'][_0x458a('0x30')]);_0x381116[_0x458a('0x2f')]=qs[_0x458a('0x2f')](_0x1eca8e[_0x458a('0x48')]['offset']);}return _0x3d9af8[_0x458a('0x82')](_0x381116);}})['then'](function(_0x208aa9){if(_0x208aa9){return _0x208aa9?{'count':_0x33e755,'rows':_0x208aa9}:null;}})[_0x458a('0x38')](respondWithResult(_0x59bb86,null))[_0x458a('0x2b')](handleError(_0x59bb86,null));};exports[_0x458a('0x83')]=function(_0x3c991a,_0x2f305a,_0x4bdead){var _0x3132f0={'channel':'whatsapp'};var _0x1675ac=[];var _0x4b61bf=[];var _0x3245fc={};return db[_0x458a('0x44')][_0x458a('0x5c')]({'where':{'id':_0x3c991a[_0x458a('0x5a')]['id']},'include':[{'model':db[_0x458a('0x7e')],'as':_0x458a('0x84')}]})[_0x458a('0x38')](handleEntityNotFound(_0x2f305a,null))[_0x458a('0x38')](function(_0x1201f9){_0x3132f0[_0x458a('0x85')]=_0x1201f9;_0x3132f0[_0x458a('0x86')]=_[_0x458a('0x87')](_0x1201f9['Applications'],[_0x458a('0x81')],['asc']);if(_0x3132f0[_0x458a('0x85')][_0x458a('0x84')]){delete _0x3132f0[_0x458a('0x85')]['Applications'];}return db['CmContact']['describe']();})[_0x458a('0x38')](function(_0x1ebd4a){if(!_0x1ebd4a){throw new db[(_0x458a('0x88'))]['ValidationError'](_0x458a('0x89'));}_0x1675ac=_[_0x458a('0x8a')](_[_0x458a('0x49')](_0x1ebd4a),['createdAt',_0x458a('0x8b')]);_0x4b61bf=_[_0x458a('0x8a')](_['keys'](_0x1ebd4a),[_0x458a('0x8c'),_0x458a('0x8b'),_0x458a('0x8d'),_0x458a('0x8e')]);_0x3132f0['body']={'mapKey':_0x458a('0x8f')};if(_0x3132f0[_0x458a('0x85')][_0x458a('0x90')]&&_0x3132f0[_0x458a('0x85')][_0x458a('0x90')]===_0x458a('0x91')){_0x3132f0[_0x458a('0x5e')][_0x458a('0x92')]=_0x3c991a[_0x458a('0x5e')][_0x458a('0x93')][_0x458a('0x94')](_0x458a('0x95'),'');_0x3132f0['body']['body']=_0x3c991a[_0x458a('0x5e')][_0x458a('0x96')];_0x3132f0[_0x458a('0x5e')][_0x458a('0x97')]=_0x3c991a[_0x458a('0x5e')]['MessageSid'];}if(_0x3132f0[_0x458a('0x5e')]['id']){delete _0x3132f0[_0x458a('0x5e')]['id'];}if(_[_0x458a('0x98')](_0x3132f0[_0x458a('0x5e')][_0x458a('0x92')])){throw new db[(_0x458a('0x88'))][(_0x458a('0x20'))]('from\x20is\x20mandatory');}if(_[_0x458a('0x98')](_0x3132f0[_0x458a('0x5e')]['body'])||_0x3132f0[_0x458a('0x5e')][_0x458a('0x5e')]===''){throw new db[(_0x458a('0x88'))][(_0x458a('0x20'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x458a('0x98')](_0x3132f0[_0x458a('0x5e')][_0x458a('0x99')])){throw new db[(_0x458a('0x88'))][(_0x458a('0x20'))](_0x458a('0x9a')+_0x4b61bf);}if(!_[_0x458a('0x9b')](_0x4b61bf,_0x3132f0[_0x458a('0x5e')]['mapKey'])){throw new db[(_0x458a('0x88'))][(_0x458a('0x20'))](_0x458a('0x9c')+_0x4b61bf);}_0x3245fc[_0x3132f0['body'][_0x458a('0x99')]]=_0x3132f0[_0x458a('0x5e')]['from'];return db[_0x458a('0x9d')][_0x458a('0x5c')]({'where':{'id':_0x3132f0[_0x458a('0x85')][_0x458a('0x8e')]},'include':[{'model':db['CmContact'],'as':_0x458a('0x9e'),'where':_0x3245fc,'limit':0x1,'order':[['updatedAt',_0x458a('0x9f')]]}]});})[_0x458a('0x38')](handleEntityNotFound(_0x2f305a,null))[_0x458a('0x38')](function(_0x2255e6){if(_0x2255e6){_0x3132f0[_0x458a('0xa0')]=_[_0x458a('0x75')](_0x2255e6,[_0x458a('0x9e')]);if(_0x2255e6['Contacts'][_0x458a('0x6c')]){return _0x2255e6[_0x458a('0x9e')][0x0];}var _0x48e560=_[_0x458a('0x1a')](_0x3132f0[_0x458a('0x5e')],{'firstName':_0x3132f0['body']['from'],'ListId':_0x2255e6['id']});_0x48e560[_0x3132f0[_0x458a('0x5e')][_0x458a('0x99')]]=_0x3132f0[_0x458a('0x5e')][_0x458a('0x92')];return db[_0x458a('0xa1')]['create'](_0x48e560,{'fields':_0x1675ac,'raw':!![]});}})[_0x458a('0x38')](handleEntityNotFound(_0x2f305a,null))[_0x458a('0x38')](function(_0x388d7c){if(_0x388d7c){_0x3132f0[_0x458a('0xa2')]=_0x388d7c;var _0x582783={'ContactId':_0x388d7c['id'],'phone':_0x3132f0[_0x458a('0x5e')][_0x458a('0x92')],'WhatsappAccountId':_0x3c991a[_0x458a('0x5a')]['id']};var _0x1017f2={'ContactId':_0x388d7c['id'],'WhatsappAccountId':_0x3c991a[_0x458a('0x5a')]['id'],'closed':![]};return db[_0x458a('0xa3')][_0x458a('0x5c')]({'where':_0x1017f2})['then'](function(_0x3f82aa){if(_0x3f82aa){return[_0x3f82aa,![]];}return db[_0x458a('0xa3')][_0x458a('0x5d')](_0x582783)[_0x458a('0x38')](function(_0x161287){return[_0x161287,!![]];});});}})[_0x458a('0x76')](function(_0x416a29,_0x6dd18d){_0x3132f0['interaction']=_0x416a29[_0x458a('0x3a')]({'plain':!![]});_0x3132f0[_0x458a('0xa4')][_0x458a('0xa5')]=![];if(_0x6dd18d){if(_0x3132f0[_0x458a('0x85')]['autoclose']){_0x3132f0[_0x458a('0x86')][_0x458a('0xa6')]({'id':0x0,'priority':_0x3132f0['applications']['length']+0x1,'app':_0x458a('0xa7'),'appdata':_0x458a('0xa8'),'interval':'*,*,*,*'});}_0x3132f0[_0x458a('0xa4')]['created']=!![];}return db[_0x458a('0xa9')]['create']({'phone':_0x3132f0[_0x458a('0x5e')][_0x458a('0x92')],'messageId':_0x3132f0['body'][_0x458a('0x97')],'body':_0x3132f0[_0x458a('0x5e')][_0x458a('0x5e')],'WhatsappAccountId':_0x3c991a[_0x458a('0x5a')]['id'],'WhatsappInteractionId':_0x416a29['id'],'direction':'in','ContactId':_0x416a29[_0x458a('0xaa')],'AttachmentId':_0x3132f0[_0x458a('0x5e')]['AttachmentId']});})['then'](function(_0x7327fd){_0x3132f0[_0x458a('0x28')]=_0x7327fd;if(_0x3132f0['interaction'][_0x458a('0xab')]){return db['User'][_0x458a('0x5c')]({'attributes':['id',_0x458a('0x3f')],'where':{'id':_0x3132f0[_0x458a('0xa4')][_0x458a('0xab')]}})['then'](function(_0x5b06b6){if(_0x5b06b6){_0x3132f0[_0x458a('0x86')]['unshift']({'id':0x0,'priority':0x0,'app':_0x458a('0xac'),'appdata':_0x5b06b6['name']+','+(_0x3132f0[_0x458a('0x85')][_0x458a('0xad')]||0xa),'interval':_0x458a('0xae')});}return respondWithRpcPromise('Start',_0x458a('0xaf'),_0x3132f0);});}return respondWithRpcPromise(_0x458a('0xb0'),'startRouting',_0x3132f0);})[_0x458a('0x38')](function(_0x4401d9){if(_0x4401d9){var _0x2f7643=0xc8;var _0x246cad='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x246cad,_0x2f7643,'entity\x20found');logger[_0x458a('0xb1')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x246cad,_0x2f7643,_0x458a('0xb2'),JSON[_0x458a('0x25')](_0x4401d9));if(_0x3132f0[_0x458a('0x85')][_0x458a('0x90')]===_0x458a('0x91')){return _0x2f305a['status'](_0x2f7643)[_0x458a('0x31')](_0x458a('0xb3'),_0x458a('0xb4'))['send'](_0x458a('0xb5'));}else{return _0x2f305a['status'](_0x2f7643)[_0x458a('0x33')](_0x4401d9);}}})[_0x458a('0x2b')](handleError(_0x2f305a,null));};exports['send']=function(_0x4788e1,_0x292c1e,_0x4b275f){var _0x1897bb,_0x564bdb,_0x183db9;if(_[_0x458a('0x98')](_0x4788e1[_0x458a('0x5e')][_0x458a('0x5e')])||_0x4788e1['body'][_0x458a('0x5e')]===''){throw new db['Sequelize'][(_0x458a('0x20'))](_0x458a('0xb6'));}if(_[_0x458a('0x98')](_0x4788e1[_0x458a('0x5e')]['to'])){throw new db[(_0x458a('0x88'))][(_0x458a('0x20'))](_0x458a('0xb7'));}_0x1897bb=_0x4788e1['body']['to'];return db[_0x458a('0x44')][_0x458a('0x5c')]({'where':{'id':_0x4788e1[_0x458a('0x5a')]['id']},'include':[{'model':db[_0x458a('0x9d')],'as':'List','include':[{'model':db[_0x458a('0xa1')],'as':'Contacts','where':{'mobile':_0x1897bb},'limit':0x1,'order':[['updatedAt',_0x458a('0x9f')]]}]}]})[_0x458a('0x38')](handleEntityNotFound(_0x292c1e,null))[_0x458a('0x38')](function(_0x3f9375){if(_0x3f9375&&_0x3f9375[_0x458a('0xb8')]){_0x564bdb=_0x3f9375[_0x458a('0x3a')]({'plain':!![]});if(_0x564bdb[_0x458a('0xb8')]&&_0x564bdb[_0x458a('0xb8')][_0x458a('0x9e')][_0x458a('0x6c')]){return _0x564bdb[_0x458a('0xb8')][_0x458a('0x9e')][0x0];}return db['CmContact'][_0x458a('0x5d')](_[_0x458a('0x1a')](_0x4788e1[_0x458a('0x5e')],{'firstName':_0x1897bb,'mobile':_0x1897bb,'phone':_0x1897bb,'ListId':_0x564bdb['ListId']}));}})[_0x458a('0x38')](handleEntityNotFound(_0x292c1e,null))['then'](function(_0x53c6bc){if(_0x53c6bc){_0x183db9=_0x53c6bc;return db[_0x458a('0xa3')][_0x458a('0x5c')]({'where':{'ContactId':_0x183db9['id'],'closed':![],'WhatsappAccountId':_0x564bdb['id']}})[_0x458a('0x38')](function(_0xa608fb){if(_0xa608fb){return[_0xa608fb,![]];}return db[_0x458a('0xa3')][_0x458a('0x5d')]({'UserId':_0x4788e1[_0x458a('0x61')]['id'],'ContactId':_0x183db9['id'],'WhatsappAccountId':_0x564bdb['id'],'phone':_0x1897bb,'firstMsgDirection':_0x458a('0xb9'),'Messages':[_[_0x458a('0x54')](_0x4788e1['body'],{'read':![],'body':_0x4788e1['body']['body'],'phone':_0x1897bb,'WhatsappAccountId':_0x564bdb['id'],'UserId':_0x4788e1[_0x458a('0x61')]['id'],'ContactId':_0x183db9['id']})]},{'include':[{'model':db[_0x458a('0xa9')],'as':_0x458a('0xba')}]})[_0x458a('0x38')](function(_0xc5ce00){return[_0xc5ce00,!![]];});});}})[_0x458a('0x76')](function(_0x513721,_0x3e8093){if(_0x3e8093){return _0x513721;}return db[_0x458a('0xa9')][_0x458a('0x5d')](_[_0x458a('0x54')](_0x4788e1[_0x458a('0x5e')],{'read':![],'body':_0x4788e1['body'][_0x458a('0x5e')],'phone':_0x1897bb,'WhatsappAccountId':_0x564bdb['id'],'WhatsappInteractionId':_0x513721['id'],'UserId':_0x4788e1[_0x458a('0x61')]['id'],'ContactId':_0x183db9['id']}))[_0x458a('0x38')](function(_0x5f4244){_0x513721[_0x458a('0xbb')][_0x458a('0xba')]=[];_0x513721[_0x458a('0xbb')][_0x458a('0xba')][_0x458a('0xa6')](_0x5f4244[_0x458a('0xbb')]);return _0x513721;});})['then'](respondWithResult(_0x292c1e,null))['catch'](handleError(_0x292c1e,null));}; \ No newline at end of file +var _0xc368=['mandatoryDispositionPause','WhatsappAccount','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','include','findAll','show','params','length','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','WhatsappAccountId','Disposition','findOne','map','options','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','applications','orderBy','describe','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','DESC','list','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','close','unmanaged','ContactId','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','get','WhatsappAccounts','UserProfileResource','destroy','end','stack','name','send','index','Pause'];(function(_0x313dcd,_0x3aae8d){var _0x144dcb=function(_0x359eaf){while(--_0x359eaf){_0x313dcd['push'](_0x313dcd['shift']());}};_0x144dcb(++_0x3aae8d);}(_0xc368,0x7b));var _0x8c36=function(_0x37204a,_0x25a67e){_0x37204a=_0x37204a-0x0;var _0x296e2c=_0xc368[_0x37204a];return _0x296e2c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8c36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c36('0x1'));var jsonpatch=require(_0x8c36('0x2'));var rp=require(_0x8c36('0x3'));var moment=require(_0x8c36('0x4'));var BPromise=require(_0x8c36('0x5'));var Mustache=require('mustache');var util=require(_0x8c36('0x6'));var path=require(_0x8c36('0x7'));var sox=require(_0x8c36('0x8'));var csv=require(_0x8c36('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8c36('0xa'));var crypto=require(_0x8c36('0xb'));var jsforce=require(_0x8c36('0xc'));var deskjs=require(_0x8c36('0xd'));var toCsv=require(_0x8c36('0x9'));var querystring=require(_0x8c36('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8c36('0xf'));var as=require(_0x8c36('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c36('0x11'))(_0x8c36('0x12'));var utils=require(_0x8c36('0x13'));var config=require(_0x8c36('0x14'));var db=require(_0x8c36('0x15'))['db'];config[_0x8c36('0x16')]=_[_0x8c36('0x17')](config[_0x8c36('0x16')],{'host':_0x8c36('0x18'),'port':0x18eb});var socket=require(_0x8c36('0x19'))(new Redis(config[_0x8c36('0x16')]));require(_0x8c36('0x1a'))[_0x8c36('0x1b')](socket);var jayson=require(_0x8c36('0x1c'));var client=jayson['client'][_0x8c36('0x1d')]({'port':0x232c});function checkPasswordPattern(_0x5e32ad,_0xea7509,_0x3f83aa){if(_0x3f83aa){var _0x29e791=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x29e791[_0x8c36('0x1e')](_0xea7509)){return _0x5e32ad;}else{throw new db[(_0x8c36('0x1f'))][(_0x8c36('0x20'))](_0x8c36('0x21'));}}else{return _0x5e32ad;}}function respondWithRpcPromise(_0x40cecf,_0x30229e,_0x49cafe,_0x2be9b0){return new BPromise(function(_0x46ae6e,_0x47832a){var _0x2d5e5b=_0x2be9b0||client;return _0x2d5e5b[_0x8c36('0x22')](_0x40cecf,_0x49cafe)['then'](function(_0x15100f){logger[_0x8c36('0x23')](_0x8c36('0x24'),_0x30229e,_0x8c36('0x25'));logger[_0x8c36('0x26')](_0x8c36('0x27'),_0x30229e,_0x8c36('0x25'),JSON[_0x8c36('0x28')](_0x15100f));if(_0x15100f[_0x8c36('0x29')]){if(_0x15100f[_0x8c36('0x29')][_0x8c36('0x2a')]===0x1f4){logger[_0x8c36('0x29')](_0x8c36('0x24'),_0x30229e,_0x15100f['error']['message']);return _0x47832a(_0x15100f['error']['message']);}logger[_0x8c36('0x29')](_0x8c36('0x24'),_0x30229e,_0x15100f[_0x8c36('0x29')][_0x8c36('0x2b')]);return _0x46ae6e(_0x15100f[_0x8c36('0x29')][_0x8c36('0x2b')]);}else{logger['info'](_0x8c36('0x24'),_0x30229e,'request\x20sent');_0x46ae6e(_0x15100f[_0x8c36('0x2c')]['message']);}})[_0x8c36('0x2d')](function(_0x1afee4){logger[_0x8c36('0x29')](_0x8c36('0x24'),_0x30229e,_0x1afee4);_0x47832a(_0x1afee4);});});}function respondWithStatusCode(_0x50aa48,_0x55cbfb){_0x55cbfb=_0x55cbfb||0xcc;return function(_0x7e7e56){if(_0x7e7e56){return _0x50aa48[_0x8c36('0x2e')](_0x55cbfb);}return _0x50aa48['status'](_0x55cbfb)['end']();};}function respondWithResult(_0x418663,_0x2b5a8c){_0x2b5a8c=_0x2b5a8c||0xc8;return function(_0x502fa3){if(_0x502fa3){return _0x418663[_0x8c36('0x2f')](_0x2b5a8c)[_0x8c36('0x30')](_0x502fa3);}};}function respondWithFilteredResult(_0x3ca98e,_0x4bc057){return function(_0x49b737){if(_0x49b737){var _0x46b72f=_0x49b737[_0x8c36('0x31')],_0x1531fc=_0x4bc057[_0x8c36('0x32')],_0x3d7056=_0x4bc057[_0x8c36('0x32')]+_0x4bc057[_0x8c36('0x33')],_0x192ce3;if(_0x3d7056>=_0x46b72f){_0x3d7056=_0x46b72f;_0x192ce3=0xc8;}else{_0x192ce3=0xce;}_0x3ca98e[_0x8c36('0x2f')](_0x192ce3);return _0x3ca98e[_0x8c36('0x34')](_0x8c36('0x35'),_0x1531fc+'-'+_0x3d7056+'/'+_0x46b72f)[_0x8c36('0x30')](_0x49b737);}return null;};}function patchUpdates(_0x3d6b69){return function(_0x178fe5){try{jsonpatch[_0x8c36('0x36')](_0x178fe5,_0x3d6b69,!![]);}catch(_0x239fa3){return BPromise[_0x8c36('0x37')](_0x239fa3);}return _0x178fe5['save']();};}function saveUpdates(_0x4e8d12,_0x5c110d){return function(_0x5fe665){if(_0x5fe665){return _0x5fe665[_0x8c36('0x38')](_0x4e8d12)[_0x8c36('0x39')](function(_0x2fedd6){return _0x2fedd6;});}return null;};}function removeEntity(_0x11a328,_0x2de1e8){return function(_0xc3f5b4){if(_0xc3f5b4){return _0xc3f5b4['destroy']()[_0x8c36('0x39')](function(){var _0x59a4e6=_0xc3f5b4[_0x8c36('0x3a')]({'plain':!![]});var _0x5c743b=_0x8c36('0x3b');return db[_0x8c36('0x3c')][_0x8c36('0x3d')]({'where':{'type':_0x5c743b,'resourceId':_0x59a4e6['id']}})['then'](function(){return _0xc3f5b4;});})[_0x8c36('0x39')](function(){_0x11a328[_0x8c36('0x2f')](0xcc)[_0x8c36('0x3e')]();});}};}function handleEntityNotFound(_0xabdc0f,_0x3d548f){return function(_0x12421b){if(!_0x12421b){_0xabdc0f[_0x8c36('0x2e')](0x194);}return _0x12421b;};}function handleError(_0x334b02,_0x75b797){_0x75b797=_0x75b797||0x1f4;return function(_0x3fc603){logger[_0x8c36('0x29')](_0x3fc603[_0x8c36('0x3f')]);if(_0x3fc603[_0x8c36('0x40')]){delete _0x3fc603[_0x8c36('0x40')];}_0x334b02[_0x8c36('0x2f')](_0x75b797)[_0x8c36('0x41')](_0x3fc603);};}exports[_0x8c36('0x42')]=function(_0x5109c2,_0x318d7f){var _0x5ee15b={'include':[{'model':db[_0x8c36('0x43')],'as':_0x8c36('0x44')}]},_0x51960e={},_0x3c34a4={'count':0x0,'rows':[]};var _0x4da574=_['map'](db[_0x8c36('0x45')][_0x8c36('0x46')],function(_0x3bb18d){return{'name':_0x3bb18d['fieldName'],'type':_0x3bb18d['type'][_0x8c36('0x47')]};});_0x51960e['model']=_['map'](_0x4da574,_0x8c36('0x40'));_0x51960e[_0x8c36('0x48')]=_[_0x8c36('0x49')](_0x5109c2[_0x8c36('0x48')]);_0x51960e[_0x8c36('0x4a')]=_[_0x8c36('0x4b')](_0x51960e[_0x8c36('0x4c')],_0x51960e[_0x8c36('0x48')]);_0x5ee15b[_0x8c36('0x4d')]=_[_0x8c36('0x4b')](_0x51960e['model'],qs[_0x8c36('0x4e')](_0x5109c2[_0x8c36('0x48')][_0x8c36('0x4e')]));_0x5ee15b[_0x8c36('0x4d')]=_0x5ee15b[_0x8c36('0x4d')]['length']?_0x5ee15b[_0x8c36('0x4d')]:_0x51960e[_0x8c36('0x4c')];if(!_0x5109c2[_0x8c36('0x48')][_0x8c36('0x4f')](_0x8c36('0x50'))){_0x5ee15b[_0x8c36('0x33')]=qs['limit'](_0x5109c2[_0x8c36('0x48')][_0x8c36('0x33')]);_0x5ee15b[_0x8c36('0x32')]=qs[_0x8c36('0x32')](_0x5109c2[_0x8c36('0x48')][_0x8c36('0x32')]);}_0x5ee15b[_0x8c36('0x51')]=qs['sort'](_0x5109c2[_0x8c36('0x48')][_0x8c36('0x52')]);_0x5ee15b[_0x8c36('0x53')]=qs[_0x8c36('0x4a')](_[_0x8c36('0x54')](_0x5109c2[_0x8c36('0x48')],_0x51960e[_0x8c36('0x4a')]),_0x4da574);if(_0x5109c2[_0x8c36('0x48')][_0x8c36('0x55')]){_0x5ee15b[_0x8c36('0x53')]=_[_0x8c36('0x56')](_0x5ee15b[_0x8c36('0x53')],{'$or':_['map'](_0x4da574,function(_0x497e80){if(_0x497e80[_0x8c36('0x57')]!==_0x8c36('0x58')){var _0xd46608={};_0xd46608[_0x497e80[_0x8c36('0x40')]]={'$like':'%'+_0x5109c2['query'][_0x8c36('0x55')]+'%'};return _0xd46608;}})});}_0x5ee15b=_[_0x8c36('0x56')]({},_0x5ee15b,_0x5109c2['options']);var _0x5e2b4f={'where':_0x5ee15b['where']};return db[_0x8c36('0x45')][_0x8c36('0x31')](_0x5e2b4f)[_0x8c36('0x39')](function(_0x197d11){_0x3c34a4[_0x8c36('0x31')]=_0x197d11;if(_0x5109c2[_0x8c36('0x48')]['includeAll']){_0x5ee15b[_0x8c36('0x59')]=[{'all':!![]}];}return db[_0x8c36('0x45')][_0x8c36('0x5a')](_0x5ee15b);})[_0x8c36('0x39')](function(_0x579bef){_0x3c34a4['rows']=_0x579bef;return _0x3c34a4;})['then'](respondWithFilteredResult(_0x318d7f,_0x5ee15b))[_0x8c36('0x2d')](handleError(_0x318d7f,null));};exports[_0x8c36('0x5b')]=function(_0x2fc48b,_0x19b11c){var _0x24f3f9={'raw':![],'where':{'id':_0x2fc48b[_0x8c36('0x5c')]['id']},'include':[{'model':db[_0x8c36('0x43')],'as':_0x8c36('0x44')}]},_0x3d5e0d={};_0x3d5e0d['model']=_['keys'](db[_0x8c36('0x45')]['rawAttributes']);_0x3d5e0d['query']=_[_0x8c36('0x49')](_0x2fc48b['query']);_0x3d5e0d[_0x8c36('0x4a')]=_[_0x8c36('0x4b')](_0x3d5e0d['model'],_0x3d5e0d[_0x8c36('0x48')]);_0x24f3f9['attributes']=_[_0x8c36('0x4b')](_0x3d5e0d[_0x8c36('0x4c')],qs[_0x8c36('0x4e')](_0x2fc48b['query'][_0x8c36('0x4e')]));_0x24f3f9[_0x8c36('0x4d')]=_0x24f3f9[_0x8c36('0x4d')][_0x8c36('0x5d')]?_0x24f3f9[_0x8c36('0x4d')]:_0x3d5e0d[_0x8c36('0x4c')];if(_0x2fc48b[_0x8c36('0x48')][_0x8c36('0x5e')]){_0x24f3f9[_0x8c36('0x59')]=[{'all':!![]}];}_0x24f3f9=_['merge']({},_0x24f3f9,_0x2fc48b['options']);return db['WhatsappAccount'][_0x8c36('0x5f')](_0x24f3f9)['then'](handleEntityNotFound(_0x19b11c,null))['then'](respondWithResult(_0x19b11c,null))[_0x8c36('0x2d')](handleError(_0x19b11c,null));};exports[_0x8c36('0x60')]=function(_0x366f0c,_0x444c36){return db[_0x8c36('0x45')]['create'](_0x366f0c['body'],{})['then'](function(_0x1edc3b){var _0x243c1a=_0x366f0c['user'][_0x8c36('0x3a')]({'plain':!![]});if(!_0x243c1a)throw new Error(_0x8c36('0x61'));if(_0x243c1a[_0x8c36('0x62')]===_0x8c36('0x63')){var _0x32871e=_0x1edc3b[_0x8c36('0x3a')]({'plain':!![]});var _0x1c0669=_0x8c36('0x3b');return db[_0x8c36('0x64')]['find']({'where':{'name':_0x1c0669,'userProfileId':_0x243c1a['userProfileId']},'raw':!![]})['then'](function(_0x2c82c0){if(_0x2c82c0&&_0x2c82c0[_0x8c36('0x65')]===0x0){return db[_0x8c36('0x3c')][_0x8c36('0x60')]({'name':_0x32871e[_0x8c36('0x40')],'resourceId':_0x32871e['id'],'type':_0x2c82c0[_0x8c36('0x40')],'sectionId':_0x2c82c0['id']},{})['then'](function(){return _0x1edc3b;});}else{return _0x1edc3b;}})[_0x8c36('0x2d')](function(_0x5b2406){logger[_0x8c36('0x29')](_0x8c36('0x66'),_0x5b2406);throw _0x5b2406;});}return _0x1edc3b;})[_0x8c36('0x39')](respondWithResult(_0x444c36,0xc9))['catch'](handleError(_0x444c36,null));};exports[_0x8c36('0x38')]=function(_0x51c797,_0x11acb3){if(_0x51c797[_0x8c36('0x67')]['id']){delete _0x51c797[_0x8c36('0x67')]['id'];}return db[_0x8c36('0x45')][_0x8c36('0x5f')]({'where':{'id':_0x51c797['params']['id']},'include':[{'model':db[_0x8c36('0x43')],'as':'mandatoryDispositionPause'}]})[_0x8c36('0x39')](handleEntityNotFound(_0x11acb3,null))[_0x8c36('0x39')](saveUpdates(_0x51c797['body'],null))[_0x8c36('0x39')](respondWithResult(_0x11acb3,null))[_0x8c36('0x2d')](handleError(_0x11acb3,null));};exports[_0x8c36('0x3d')]=function(_0x4eabc6,_0x244634){return db[_0x8c36('0x45')][_0x8c36('0x5f')]({'where':{'id':_0x4eabc6[_0x8c36('0x5c')]['id']}})['then'](handleEntityNotFound(_0x244634,null))[_0x8c36('0x39')](removeEntity(_0x244634,null))[_0x8c36('0x2d')](handleError(_0x244634,null));};exports['describe']=function(_0xff22f0,_0x1bfe8c){return db[_0x8c36('0x45')]['describe']()[_0x8c36('0x39')](respondWithResult(_0x1bfe8c,null))[_0x8c36('0x2d')](handleError(_0x1bfe8c,null));};exports['addDisposition']=function(_0x2f851f,_0x251a43,_0x120520){if(_0x2f851f[_0x8c36('0x67')]['id']){delete _0x2f851f['body']['id'];}return db[_0x8c36('0x45')]['find']({'where':{'id':_0x2f851f[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x251a43,null))['then'](function(_0x27b88d){if(_0x27b88d){_0x2f851f[_0x8c36('0x67')][_0x8c36('0x68')]=_0x27b88d['id'];return db[_0x8c36('0x69')][_0x8c36('0x60')](_0x2f851f[_0x8c36('0x67')]);}})[_0x8c36('0x39')](respondWithResult(_0x251a43,null))[_0x8c36('0x2d')](handleError(_0x251a43,null));};exports['getDispositions']=function(_0x274216,_0x1d9cca,_0x223c3b){var _0x5d623b={'raw':![],'where':{}};var _0x481920={};var _0x3bbb1c={'count':0x0,'rows':[]};return db[_0x8c36('0x45')][_0x8c36('0x6a')]({'where':{'id':_0x274216[_0x8c36('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1d9cca,null))[_0x8c36('0x39')](function(_0x25c124){if(_0x25c124){_0x481920[_0x8c36('0x4c')]=_['keys'](db[_0x8c36('0x69')][_0x8c36('0x46')]);_0x481920[_0x8c36('0x48')]=_[_0x8c36('0x49')](_0x274216[_0x8c36('0x48')]);_0x481920['filters']=_[_0x8c36('0x4b')](_0x481920[_0x8c36('0x4c')],_0x481920[_0x8c36('0x48')]);_0x5d623b['attributes']=_[_0x8c36('0x4b')](_0x481920[_0x8c36('0x4c')],qs[_0x8c36('0x4e')](_0x274216[_0x8c36('0x48')][_0x8c36('0x4e')]));_0x5d623b[_0x8c36('0x4d')]=_0x5d623b[_0x8c36('0x4d')]['length']?_0x5d623b['attributes']:_0x481920['model'];if(!_0x274216[_0x8c36('0x48')][_0x8c36('0x4f')](_0x8c36('0x50'))){_0x5d623b[_0x8c36('0x33')]=qs[_0x8c36('0x33')](_0x274216[_0x8c36('0x48')][_0x8c36('0x33')]);_0x5d623b[_0x8c36('0x32')]=qs[_0x8c36('0x32')](_0x274216[_0x8c36('0x48')][_0x8c36('0x32')]);}_0x5d623b[_0x8c36('0x51')]=qs[_0x8c36('0x52')](_0x274216[_0x8c36('0x48')][_0x8c36('0x52')]);_0x5d623b[_0x8c36('0x53')]=qs[_0x8c36('0x4a')](_[_0x8c36('0x54')](_0x274216['query'],_0x481920[_0x8c36('0x4a')]));_0x5d623b['where']['WhatsappAccountId']=_0x25c124['id'];if(_0x274216[_0x8c36('0x48')]['filter']){_0x5d623b[_0x8c36('0x53')]=_[_0x8c36('0x56')](_0x5d623b[_0x8c36('0x53')],{'$or':_[_0x8c36('0x6b')](_0x5d623b[_0x8c36('0x4d')],function(_0x438224){var _0xf6760b={};_0xf6760b[_0x438224]={'$like':'%'+_0x274216['query']['filter']+'%'};return _0xf6760b;})});}_0x5d623b=_[_0x8c36('0x56')]({},_0x5d623b,_0x274216[_0x8c36('0x6c')]);return db['Disposition'][_0x8c36('0x31')]({'where':_0x5d623b[_0x8c36('0x53')]})[_0x8c36('0x39')](function(_0x1fb78e){_0x3bbb1c['count']=_0x1fb78e;if(_0x274216[_0x8c36('0x48')][_0x8c36('0x5e')]){_0x5d623b[_0x8c36('0x59')]=[{'all':!![]}];}return db[_0x8c36('0x69')][_0x8c36('0x5a')](_0x5d623b);})[_0x8c36('0x39')](function(_0x57141f){_0x3bbb1c[_0x8c36('0x6d')]=_0x57141f;return _0x3bbb1c;});}})[_0x8c36('0x39')](respondWithFilteredResult(_0x1d9cca,_0x5d623b))[_0x8c36('0x2d')](handleError(_0x1d9cca,null));};exports[_0x8c36('0x6e')]=function(_0x744bdb,_0x279e37,_0x257c2a){return db[_0x8c36('0x45')][_0x8c36('0x5f')]({'where':{'id':_0x744bdb[_0x8c36('0x5c')]['id']}})['then'](handleEntityNotFound(_0x279e37,null))['then'](function(_0x24bfcb){if(_0x24bfcb){return _0x24bfcb['removeDispositions'](_0x744bdb['query'][_0x8c36('0x6f')]);}})[_0x8c36('0x39')](respondWithStatusCode(_0x279e37,null))['catch'](handleError(_0x279e37,null));};exports[_0x8c36('0x70')]=function(_0x276be8,_0x2ea797,_0x3a16b4){if(_0x276be8[_0x8c36('0x67')]['id']){delete _0x276be8[_0x8c36('0x67')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x276be8[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x2ea797,null))['then'](function(_0x1164f8){if(_0x1164f8){_0x276be8[_0x8c36('0x67')][_0x8c36('0x68')]=_0x1164f8['id'];return db[_0x8c36('0x71')][_0x8c36('0x60')](_0x276be8[_0x8c36('0x67')]);}})['then'](respondWithResult(_0x2ea797,null))[_0x8c36('0x2d')](handleError(_0x2ea797,null));};exports[_0x8c36('0x72')]=function(_0x3c3f51,_0x290bc9,_0x1deca3){var _0x375155={'raw':![],'where':{}};var _0x5f17c4={};var _0x4822cb={'count':0x0,'rows':[]};return db[_0x8c36('0x45')][_0x8c36('0x6a')]({'where':{'id':_0x3c3f51[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x290bc9,null))[_0x8c36('0x39')](function(_0x523dbb){if(_0x523dbb){_0x5f17c4['model']=_[_0x8c36('0x49')](db[_0x8c36('0x71')][_0x8c36('0x46')]);_0x5f17c4['query']=_[_0x8c36('0x49')](_0x3c3f51[_0x8c36('0x48')]);_0x5f17c4[_0x8c36('0x4a')]=_[_0x8c36('0x4b')](_0x5f17c4[_0x8c36('0x4c')],_0x5f17c4[_0x8c36('0x48')]);_0x375155[_0x8c36('0x4d')]=_[_0x8c36('0x4b')](_0x5f17c4[_0x8c36('0x4c')],qs[_0x8c36('0x4e')](_0x3c3f51[_0x8c36('0x48')][_0x8c36('0x4e')]));_0x375155['attributes']=_0x375155[_0x8c36('0x4d')][_0x8c36('0x5d')]?_0x375155['attributes']:_0x5f17c4['model'];if(!_0x3c3f51[_0x8c36('0x48')][_0x8c36('0x4f')](_0x8c36('0x50'))){_0x375155['limit']=qs[_0x8c36('0x33')](_0x3c3f51[_0x8c36('0x48')][_0x8c36('0x33')]);_0x375155[_0x8c36('0x32')]=qs['offset'](_0x3c3f51[_0x8c36('0x48')][_0x8c36('0x32')]);}_0x375155['order']=qs[_0x8c36('0x52')](_0x3c3f51[_0x8c36('0x48')]['sort']);_0x375155[_0x8c36('0x53')]=qs[_0x8c36('0x4a')](_[_0x8c36('0x54')](_0x3c3f51[_0x8c36('0x48')],_0x5f17c4[_0x8c36('0x4a')]));_0x375155[_0x8c36('0x53')][_0x8c36('0x68')]=_0x523dbb['id'];if(_0x3c3f51['query']['filter']){_0x375155['where']=_[_0x8c36('0x56')](_0x375155[_0x8c36('0x53')],{'$or':_[_0x8c36('0x6b')](_0x375155[_0x8c36('0x4d')],function(_0x1cfbc3){var _0x35196a={};_0x35196a[_0x1cfbc3]={'$like':'%'+_0x3c3f51['query'][_0x8c36('0x55')]+'%'};return _0x35196a;})});}_0x375155=_[_0x8c36('0x56')]({},_0x375155,_0x3c3f51[_0x8c36('0x6c')]);return db[_0x8c36('0x71')]['count']({'where':_0x375155['where']})[_0x8c36('0x39')](function(_0x2a737e){_0x4822cb[_0x8c36('0x31')]=_0x2a737e;if(_0x3c3f51['query'][_0x8c36('0x5e')]){_0x375155[_0x8c36('0x59')]=[{'all':!![]}];}return db[_0x8c36('0x71')]['findAll'](_0x375155);})[_0x8c36('0x39')](function(_0x59d969){_0x4822cb[_0x8c36('0x6d')]=_0x59d969;return _0x4822cb;});}})[_0x8c36('0x39')](respondWithFilteredResult(_0x290bc9,_0x375155))['catch'](handleError(_0x290bc9,null));};exports[_0x8c36('0x73')]=function(_0xbd0d83,_0x363065,_0x312b13){return db[_0x8c36('0x45')][_0x8c36('0x5f')]({'where':{'id':_0xbd0d83[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x363065,null))['then'](function(_0x5d9aa9){if(_0x5d9aa9){return _0x5d9aa9[_0x8c36('0x73')](_0xbd0d83[_0x8c36('0x48')][_0x8c36('0x6f')]);}})['then'](respondWithStatusCode(_0x363065,null))[_0x8c36('0x2d')](handleError(_0x363065,null));};exports[_0x8c36('0x74')]=function(_0x50c9d7,_0x5a2f2a,_0x38410b){return db[_0x8c36('0x45')]['find']({'where':{'id':_0x50c9d7[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x5a2f2a,null))[_0x8c36('0x39')](function(_0x2e800a){if(_0x2e800a){return _0x2e800a['addAgents'](_0x50c9d7[_0x8c36('0x67')][_0x8c36('0x6f')],_[_0x8c36('0x75')](_0x50c9d7[_0x8c36('0x67')],['ids','id'])||{})[_0x8c36('0x76')](function(_0x14e96b){for(var _0x40a276=0x0;_0x40a276<_0x50c9d7[_0x8c36('0x67')][_0x8c36('0x6f')]['length'];_0x40a276+=0x1){socket[_0x8c36('0x77')](_0x8c36('0x78'),{'UserId':_0x50c9d7[_0x8c36('0x67')]['ids'][_0x40a276],'WhatsappAccountId':_0x50c9d7[_0x8c36('0x5c')]['id']});}return _0x14e96b;});}})[_0x8c36('0x39')](respondWithResult(_0x5a2f2a,null))[_0x8c36('0x2d')](handleError(_0x5a2f2a,null));};exports['removeAgents']=function(_0x4be6a3,_0x52ae44,_0x5ba123){return db[_0x8c36('0x45')]['find']({'where':{'id':_0x4be6a3['params']['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x52ae44,null))['then'](function(_0x691af){if(_0x691af){return _0x691af[_0x8c36('0x79')](_0x4be6a3[_0x8c36('0x48')][_0x8c36('0x6f')])['then'](function(){if(_[_0x8c36('0x7a')](_0x4be6a3[_0x8c36('0x48')][_0x8c36('0x6f')])){for(var _0x4a308f=0x0;_0x4a308f<_0x4be6a3[_0x8c36('0x48')][_0x8c36('0x6f')][_0x8c36('0x5d')];_0x4a308f+=0x1){socket[_0x8c36('0x77')](_0x8c36('0x7b'),{'UserId':Number(_0x4be6a3[_0x8c36('0x48')][_0x8c36('0x6f')][_0x4a308f]),'WhatsappAccountId':Number(_0x4be6a3['params']['id'])});}}else{socket[_0x8c36('0x77')](_0x8c36('0x7b'),{'UserId':Number(_0x4be6a3[_0x8c36('0x48')][_0x8c36('0x6f')]),'WhatsappAccountId':Number(_0x4be6a3[_0x8c36('0x5c')]['id'])});}});}})[_0x8c36('0x39')](respondWithStatusCode(_0x52ae44,null))[_0x8c36('0x2d')](handleError(_0x52ae44,null));};exports[_0x8c36('0x7c')]=function(_0x198105,_0x6dbf6,_0x1fccee){var _0x434847={};var _0x5ab835={};var _0x486579;var _0x13a1b5;return db[_0x8c36('0x45')][_0x8c36('0x6a')]({'where':{'id':_0x198105[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x6dbf6,null))[_0x8c36('0x39')](function(_0x1c0ed4){if(_0x1c0ed4){_0x486579=_0x1c0ed4;_0x5ab835['model']=_['keys'](db['User'][_0x8c36('0x46')]);_0x5ab835[_0x8c36('0x48')]=_[_0x8c36('0x49')](_0x198105[_0x8c36('0x48')]);_0x5ab835['filters']=_[_0x8c36('0x4b')](_0x5ab835[_0x8c36('0x4c')],_0x5ab835[_0x8c36('0x48')]);_0x434847[_0x8c36('0x4d')]=_[_0x8c36('0x4b')](_0x5ab835[_0x8c36('0x4c')],qs[_0x8c36('0x4e')](_0x198105['query'][_0x8c36('0x4e')]));_0x434847[_0x8c36('0x4d')]=_0x434847[_0x8c36('0x4d')][_0x8c36('0x5d')]?_0x434847[_0x8c36('0x4d')]:_0x5ab835[_0x8c36('0x4c')];_0x434847[_0x8c36('0x51')]=qs[_0x8c36('0x52')](_0x198105['query'][_0x8c36('0x52')]);_0x434847[_0x8c36('0x53')]=qs[_0x8c36('0x4a')](_[_0x8c36('0x54')](_0x198105[_0x8c36('0x48')],_0x5ab835['filters']));if(_0x198105[_0x8c36('0x48')][_0x8c36('0x55')]){_0x434847[_0x8c36('0x53')]=_[_0x8c36('0x56')](_0x434847[_0x8c36('0x53')],{'$or':_[_0x8c36('0x6b')](_0x434847[_0x8c36('0x4d')],function(_0xded0f){var _0x56c11f={};_0x56c11f[_0xded0f]={'$like':'%'+_0x198105[_0x8c36('0x48')]['filter']+'%'};return _0x56c11f;})});}_0x434847=_['merge']({},_0x434847,_0x198105['options']);return _0x486579[_0x8c36('0x7c')](_0x434847);}})[_0x8c36('0x39')](function(_0x36e76b){if(_0x36e76b){_0x13a1b5=_0x36e76b['length'];if(!_0x198105[_0x8c36('0x48')][_0x8c36('0x4f')](_0x8c36('0x50'))){_0x434847['limit']=qs['limit'](_0x198105[_0x8c36('0x48')]['limit']);_0x434847[_0x8c36('0x32')]=qs[_0x8c36('0x32')](_0x198105[_0x8c36('0x48')]['offset']);}return _0x486579[_0x8c36('0x7c')](_0x434847);}})[_0x8c36('0x39')](function(_0x24ac58){if(_0x24ac58){return _0x24ac58?{'count':_0x13a1b5,'rows':_0x24ac58}:null;}})['then'](respondWithResult(_0x6dbf6,null))[_0x8c36('0x2d')](handleError(_0x6dbf6,null));};exports[_0x8c36('0x7d')]=function(_0xb38f74,_0x2da99c,_0x445894){return db[_0x8c36('0x45')]['findOne']({'where':{'id':_0xb38f74[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x2da99c,null))[_0x8c36('0x39')](function(_0x4204bd){if(_0x4204bd){return db[_0x8c36('0x7e')]['transaction'](function(_0x47ca24){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0xb38f74[_0x8c36('0x5c')]['id']},'transaction':_0x47ca24})['then'](function(_0x3249b6){var _0x43e8b9=_[_0x8c36('0x6b')](_0xb38f74['body'],function(_0x10ed2c){_0x10ed2c['WhatsappAccountId']=_0xb38f74[_0x8c36('0x5c')]['id'];return _0x10ed2c;});return db[_0x8c36('0x7f')][_0x8c36('0x80')](_0x43e8b9,{'transaction':_0x47ca24});});})[_0x8c36('0x39')](function(){return db[_0x8c36('0x7f')][_0x8c36('0x81')]({'where':{'WhatsappAccountId':_0xb38f74[_0x8c36('0x5c')]['id']},'order':_0x8c36('0x82')});});}})['then'](respondWithResult(_0x2da99c,null))[_0x8c36('0x2d')](handleError(_0x2da99c,null));};exports['getApplications']=function(_0x386e3e,_0x4c287d,_0x47f57c){var _0x4c0052={};var _0x1e280a={};var _0x4d322c;var _0x226f4b;return db['WhatsappAccount'][_0x8c36('0x6a')]({'where':{'id':_0x386e3e[_0x8c36('0x5c')]['id']}})[_0x8c36('0x39')](handleEntityNotFound(_0x4c287d,null))[_0x8c36('0x39')](function(_0x2cc362){if(_0x2cc362){_0x4d322c=_0x2cc362;_0x1e280a[_0x8c36('0x4c')]=_[_0x8c36('0x49')](db['WhatsappApplication']['rawAttributes']);_0x1e280a[_0x8c36('0x48')]=_[_0x8c36('0x49')](_0x386e3e[_0x8c36('0x48')]);_0x1e280a[_0x8c36('0x4a')]=_[_0x8c36('0x4b')](_0x1e280a['model'],_0x1e280a['query']);_0x4c0052[_0x8c36('0x4d')]=_['intersection'](_0x1e280a[_0x8c36('0x4c')],qs[_0x8c36('0x4e')](_0x386e3e[_0x8c36('0x48')][_0x8c36('0x4e')]));_0x4c0052['attributes']=_0x4c0052[_0x8c36('0x4d')][_0x8c36('0x5d')]?_0x4c0052[_0x8c36('0x4d')]:_0x1e280a[_0x8c36('0x4c')];_0x4c0052[_0x8c36('0x51')]=qs['sort'](_0x386e3e[_0x8c36('0x48')][_0x8c36('0x52')]);_0x4c0052['where']=qs[_0x8c36('0x4a')](_[_0x8c36('0x54')](_0x386e3e[_0x8c36('0x48')],_0x1e280a[_0x8c36('0x4a')]));if(_0x386e3e[_0x8c36('0x48')][_0x8c36('0x55')]){_0x4c0052[_0x8c36('0x53')]=_[_0x8c36('0x56')](_0x4c0052[_0x8c36('0x53')],{'$or':_[_0x8c36('0x6b')](_0x4c0052[_0x8c36('0x4d')],function(_0x2adead){var _0x388b34={};_0x388b34[_0x2adead]={'$like':'%'+_0x386e3e['query']['filter']+'%'};return _0x388b34;})});}_0x4c0052=_['merge']({},_0x4c0052,_0x386e3e['options']);return _0x4d322c[_0x8c36('0x83')](_0x4c0052);}})[_0x8c36('0x39')](function(_0x211bdc){if(_0x211bdc){_0x226f4b=_0x211bdc['length'];if(!_0x386e3e[_0x8c36('0x48')][_0x8c36('0x4f')](_0x8c36('0x50'))){_0x4c0052['limit']=qs[_0x8c36('0x33')](_0x386e3e[_0x8c36('0x48')][_0x8c36('0x33')]);_0x4c0052[_0x8c36('0x32')]=qs[_0x8c36('0x32')](_0x386e3e[_0x8c36('0x48')]['offset']);}return _0x4d322c[_0x8c36('0x83')](_0x4c0052);}})[_0x8c36('0x39')](function(_0x4d56d1){if(_0x4d56d1){return _0x4d56d1?{'count':_0x226f4b,'rows':_0x4d56d1}:null;}})[_0x8c36('0x39')](respondWithResult(_0x4c287d,null))[_0x8c36('0x2d')](handleError(_0x4c287d,null));};exports[_0x8c36('0x84')]=function(_0x180b8b,_0x30b834,_0xb358f9){var _0x38ecc8={'channel':'whatsapp'};var _0x3d746e=[];var _0x345e2a=[];var _0x4b4060={};return db[_0x8c36('0x45')]['find']({'where':{'id':_0x180b8b[_0x8c36('0x5c')]['id']},'include':[{'model':db[_0x8c36('0x7f')],'as':_0x8c36('0x85')}]})[_0x8c36('0x39')](handleEntityNotFound(_0x30b834,null))[_0x8c36('0x39')](function(_0x266601){_0x38ecc8[_0x8c36('0x86')]=_0x266601;_0x38ecc8[_0x8c36('0x87')]=_[_0x8c36('0x88')](_0x266601[_0x8c36('0x85')],[_0x8c36('0x82')],['asc']);if(_0x38ecc8['account'][_0x8c36('0x85')]){delete _0x38ecc8[_0x8c36('0x86')][_0x8c36('0x85')];}return db['CmContact'][_0x8c36('0x89')]();})[_0x8c36('0x39')](function(_0x4eb530){if(!_0x4eb530){throw new db[(_0x8c36('0x1f'))]['ValidationError'](_0x8c36('0x8a'));}_0x3d746e=_['difference'](_[_0x8c36('0x49')](_0x4eb530),[_0x8c36('0x8b'),'updatedAt']);_0x345e2a=_[_0x8c36('0x8c')](_[_0x8c36('0x49')](_0x4eb530),[_0x8c36('0x8b'),_0x8c36('0x8d'),_0x8c36('0x8e'),_0x8c36('0x8f')]);_0x38ecc8['body']={'mapKey':_0x8c36('0x90')};if(_0x38ecc8['account'][_0x8c36('0x57')]&&_0x38ecc8['account'][_0x8c36('0x57')]===_0x8c36('0x91')){_0x38ecc8['body'][_0x8c36('0x92')]=_0x180b8b['body'][_0x8c36('0x93')][_0x8c36('0x94')]('whatsapp:','');_0x38ecc8[_0x8c36('0x67')][_0x8c36('0x67')]=_0x180b8b[_0x8c36('0x67')][_0x8c36('0x95')];_0x38ecc8[_0x8c36('0x67')][_0x8c36('0x96')]=_0x180b8b[_0x8c36('0x67')][_0x8c36('0x97')];}if(_0x38ecc8[_0x8c36('0x67')]['id']){delete _0x38ecc8[_0x8c36('0x67')]['id'];}if(_[_0x8c36('0x98')](_0x38ecc8['body']['from'])){throw new db[(_0x8c36('0x1f'))][(_0x8c36('0x20'))](_0x8c36('0x99'));}if(_[_0x8c36('0x98')](_0x38ecc8['body'][_0x8c36('0x67')])||_0x38ecc8[_0x8c36('0x67')]['body']===''){throw new db[(_0x8c36('0x1f'))]['ValidationError'](_0x8c36('0x9a'));}if(_[_0x8c36('0x98')](_0x38ecc8[_0x8c36('0x67')][_0x8c36('0x9b')])){throw new db['Sequelize'][(_0x8c36('0x20'))](_0x8c36('0x9c')+_0x345e2a);}if(!_[_0x8c36('0x9d')](_0x345e2a,_0x38ecc8[_0x8c36('0x67')][_0x8c36('0x9b')])){throw new db[(_0x8c36('0x1f'))]['ValidationError'](_0x8c36('0x9e')+_0x345e2a);}_0x4b4060[_0x38ecc8[_0x8c36('0x67')][_0x8c36('0x9b')]]=_0x38ecc8['body'][_0x8c36('0x92')];return db[_0x8c36('0x9f')]['find']({'where':{'id':_0x38ecc8[_0x8c36('0x86')][_0x8c36('0x8f')]},'include':[{'model':db[_0x8c36('0xa0')],'as':'Contacts','where':_0x4b4060,'limit':0x1,'order':[['updatedAt',_0x8c36('0xa1')]]}]});})[_0x8c36('0x39')](handleEntityNotFound(_0x30b834,null))[_0x8c36('0x39')](function(_0x28b34c){if(_0x28b34c){_0x38ecc8[_0x8c36('0xa2')]=_['omit'](_0x28b34c,[_0x8c36('0xa3')]);if(_0x28b34c[_0x8c36('0xa3')][_0x8c36('0x5d')]){return _0x28b34c['Contacts'][0x0];}var _0x3dd44a=_[_0x8c36('0x17')](_0x38ecc8['body'],{'firstName':_0x38ecc8['body']['from'],'ListId':_0x28b34c['id']});_0x3dd44a[_0x38ecc8['body'][_0x8c36('0x9b')]]=_0x38ecc8['body'][_0x8c36('0x92')];return db[_0x8c36('0xa0')]['create'](_0x3dd44a,{'fields':_0x3d746e,'raw':!![]});}})[_0x8c36('0x39')](handleEntityNotFound(_0x30b834,null))[_0x8c36('0x39')](function(_0xbac0c0){if(_0xbac0c0){_0x38ecc8[_0x8c36('0xa4')]=_0xbac0c0;var _0x3004e3={'ContactId':_0xbac0c0['id'],'phone':_0x38ecc8[_0x8c36('0x67')]['from'],'WhatsappAccountId':_0x180b8b[_0x8c36('0x5c')]['id']};var _0x553f9c={'ContactId':_0xbac0c0['id'],'WhatsappAccountId':_0x180b8b['params']['id'],'closed':![]};return db[_0x8c36('0xa5')][_0x8c36('0x5f')]({'where':_0x553f9c})[_0x8c36('0x39')](function(_0x568b2e){if(_0x568b2e){return[_0x568b2e,![]];}return db[_0x8c36('0xa5')][_0x8c36('0x60')](_0x3004e3)['then'](function(_0x4b07f9){return[_0x4b07f9,!![]];});});}})['spread'](function(_0x2a8ef5,_0x1689a8){_0x38ecc8[_0x8c36('0xa6')]=_0x2a8ef5['get']({'plain':!![]});_0x38ecc8[_0x8c36('0xa6')][_0x8c36('0xa7')]=![];if(_0x1689a8){if(_0x38ecc8['account'][_0x8c36('0xa8')]){_0x38ecc8[_0x8c36('0x87')][_0x8c36('0xa9')]({'id':0x0,'priority':_0x38ecc8['applications'][_0x8c36('0x5d')]+0x1,'app':_0x8c36('0xaa'),'appdata':_0x8c36('0xab'),'interval':'*,*,*,*'});}_0x38ecc8[_0x8c36('0xa6')]['created']=!![];}return db['WhatsappMessage'][_0x8c36('0x60')]({'phone':_0x38ecc8['body']['from'],'messageId':_0x38ecc8[_0x8c36('0x67')]['messageId'],'body':_0x38ecc8['body'][_0x8c36('0x67')],'WhatsappAccountId':_0x180b8b[_0x8c36('0x5c')]['id'],'WhatsappInteractionId':_0x2a8ef5['id'],'direction':'in','ContactId':_0x2a8ef5[_0x8c36('0xac')],'AttachmentId':_0x38ecc8[_0x8c36('0x67')]['AttachmentId']});})[_0x8c36('0x39')](function(_0x3bf055){_0x38ecc8[_0x8c36('0x2b')]=_0x3bf055;if(_0x38ecc8['interaction'][_0x8c36('0xad')]){return db[_0x8c36('0xae')][_0x8c36('0x5f')]({'attributes':['id',_0x8c36('0x40')],'where':{'id':_0x38ecc8['interaction']['UserId']}})[_0x8c36('0x39')](function(_0x17bead){if(_0x17bead){_0x38ecc8['applications'][_0x8c36('0xaf')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x17bead[_0x8c36('0x40')]+','+(_0x38ecc8[_0x8c36('0x86')][_0x8c36('0xb0')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x8c36('0xb1'),_0x8c36('0xb2'),_0x38ecc8);});}return respondWithRpcPromise(_0x8c36('0xb1'),_0x8c36('0xb2'),_0x38ecc8);})['then'](function(_0x47d89e){if(_0x47d89e){var _0x471f12=0xc8;var _0x12ed64=_0x8c36('0xb3');logger[_0x8c36('0x23')](_0x8c36('0x27'),_0x12ed64,_0x471f12,'entity\x20found');logger[_0x8c36('0x26')](_0x8c36('0xb4'),_0x12ed64,_0x471f12,_0x8c36('0xb5'),JSON[_0x8c36('0x28')](_0x47d89e));if(_0x38ecc8[_0x8c36('0x86')][_0x8c36('0x57')]===_0x8c36('0x91')){return _0x30b834[_0x8c36('0x2f')](_0x471f12)['set'](_0x8c36('0xb6'),_0x8c36('0xb7'))[_0x8c36('0x41')](_0x8c36('0xb8'));}else{return _0x30b834[_0x8c36('0x2f')](_0x471f12)[_0x8c36('0x30')](_0x47d89e);}}})[_0x8c36('0x2d')](handleError(_0x30b834,null));};exports[_0x8c36('0x41')]=function(_0x248269,_0x4c6789,_0x3fce62){var _0x2bb286,_0xfaf9be,_0x331fb5;if(_[_0x8c36('0x98')](_0x248269[_0x8c36('0x67')][_0x8c36('0x67')])||_0x248269['body'][_0x8c36('0x67')]===''){throw new db['Sequelize']['ValidationError'](_0x8c36('0x9a'));}if(_[_0x8c36('0x98')](_0x248269[_0x8c36('0x67')]['to'])){throw new db[(_0x8c36('0x1f'))]['ValidationError'](_0x8c36('0xb9'));}_0x2bb286=_0x248269[_0x8c36('0x67')]['to'];return db[_0x8c36('0x45')][_0x8c36('0x5f')]({'where':{'id':_0x248269[_0x8c36('0x5c')]['id']},'include':[{'model':db['CmList'],'as':_0x8c36('0xba'),'include':[{'model':db[_0x8c36('0xa0')],'as':_0x8c36('0xa3'),'where':{'mobile':_0x2bb286},'limit':0x1,'order':[[_0x8c36('0x8d'),_0x8c36('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x4c6789,null))[_0x8c36('0x39')](function(_0x5b5b24){if(_0x5b5b24&&_0x5b5b24[_0x8c36('0xba')]){_0xfaf9be=_0x5b5b24[_0x8c36('0x3a')]({'plain':!![]});if(_0xfaf9be[_0x8c36('0xba')]&&_0xfaf9be[_0x8c36('0xba')][_0x8c36('0xa3')][_0x8c36('0x5d')]){return _0xfaf9be['List']['Contacts'][0x0];}return db['CmContact']['create'](_['defaults'](_0x248269[_0x8c36('0x67')],{'firstName':_0x2bb286,'mobile':_0x2bb286,'phone':_0x2bb286,'ListId':_0xfaf9be['ListId']}));}})[_0x8c36('0x39')](handleEntityNotFound(_0x4c6789,null))[_0x8c36('0x39')](function(_0x127e4e){if(_0x127e4e){_0x331fb5=_0x127e4e;return db[_0x8c36('0xa5')][_0x8c36('0x5f')]({'where':{'ContactId':_0x331fb5['id'],'closed':![],'WhatsappAccountId':_0xfaf9be['id']}})['then'](function(_0x4f52f3){if(_0x4f52f3){return[_0x4f52f3,![]];}return db[_0x8c36('0xa5')][_0x8c36('0x60')]({'UserId':_0x248269[_0x8c36('0x63')]['id'],'ContactId':_0x331fb5['id'],'WhatsappAccountId':_0xfaf9be['id'],'phone':_0x2bb286,'firstMsgDirection':_0x8c36('0xbb'),'Messages':[_[_0x8c36('0x56')](_0x248269[_0x8c36('0x67')],{'read':![],'body':_0x248269[_0x8c36('0x67')][_0x8c36('0x67')],'phone':_0x2bb286,'WhatsappAccountId':_0xfaf9be['id'],'UserId':_0x248269[_0x8c36('0x63')]['id'],'ContactId':_0x331fb5['id']})]},{'include':[{'model':db[_0x8c36('0xbc')],'as':_0x8c36('0xbd')}]})[_0x8c36('0x39')](function(_0x32a2a4){return[_0x32a2a4,!![]];});});}})[_0x8c36('0x76')](function(_0xac1e8f,_0x1b8bcd){if(_0x1b8bcd){return _0xac1e8f;}return db['WhatsappMessage'][_0x8c36('0x60')](_[_0x8c36('0x56')](_0x248269[_0x8c36('0x67')],{'read':![],'body':_0x248269['body'][_0x8c36('0x67')],'phone':_0x2bb286,'WhatsappAccountId':_0xfaf9be['id'],'WhatsappInteractionId':_0xac1e8f['id'],'UserId':_0x248269[_0x8c36('0x63')]['id'],'ContactId':_0x331fb5['id']}))['then'](function(_0xba9cfa){_0xac1e8f['dataValues'][_0x8c36('0xbd')]=[];_0xac1e8f[_0x8c36('0xbe')][_0x8c36('0xbd')]['push'](_0xba9cfa['dataValues']);return _0xac1e8f;});})[_0x8c36('0x39')](respondWithResult(_0x4c6789,null))[_0x8c36('0x2d')](handleError(_0x4c6789,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 04d9da5..aa0d2ca 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 _0xf072=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','save','remove'];(function(_0x1abfff,_0x6b509){var _0x2414c0=function(_0x517df7){while(--_0x517df7){_0x1abfff['push'](_0x1abfff['shift']());}};_0x2414c0(++_0x6b509);}(_0xf072,0x1cf));var _0x2f07=function(_0x2523db,_0x5935c7){_0x2523db=_0x2523db-0x0;var _0x6fa64b=_0xf072[_0x2523db];return _0x6fa64b;};'use strict';var EventEmitter=require(_0x2f07('0x0'));var WhatsappAccount=require(_0x2f07('0x1'))['db'][_0x2f07('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2f07('0x3'),'afterUpdate':'update','afterDestroy':_0x2f07('0x4')};function emitEvent(_0x432696){return function(_0x1536c3,_0x48d7b6,_0x1d5a33){WhatsappAccountEvents[_0x2f07('0x5')](_0x432696+':'+_0x1536c3['id'],_0x1536c3);WhatsappAccountEvents[_0x2f07('0x5')](_0x432696,_0x1536c3);_0x1d5a33(null);};}for(var e in events){if(events[_0x2f07('0x6')](e)){var event=events[e];WhatsappAccount[_0x2f07('0x7')](e,emitEvent(event));}}module[_0x2f07('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0x4bd3=['events','WhatsappAccount','setMaxListeners','emit','hook','exports'];(function(_0x5591f2,_0x34e7ef){var _0x2a21e8=function(_0x35bda5){while(--_0x35bda5){_0x5591f2['push'](_0x5591f2['shift']());}};_0x2a21e8(++_0x34e7ef);}(_0x4bd3,0x174));var _0x34bd=function(_0x5ac162,_0x58e97e){_0x5ac162=_0x5ac162-0x0;var _0x3b93e7=_0x4bd3[_0x5ac162];return _0x3b93e7;};'use strict';var EventEmitter=require(_0x34bd('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0x34bd('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b921){return function(_0x44854a,_0x1fc8eb,_0x5846f3){WhatsappAccountEvents[_0x34bd('0x3')](_0x22b921+':'+_0x44854a['id'],_0x44854a);WhatsappAccountEvents[_0x34bd('0x3')](_0x22b921,_0x44854a);_0x5846f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x34bd('0x4')](e,emitEvent(event));}}module[_0x34bd('0x5')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 32d4186..3704b0b 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 _0x51d6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','util','../../config/logger'];(function(_0x45da6f,_0x3d85d3){var _0x1c7d63=function(_0x36d10c){while(--_0x36d10c){_0x45da6f['push'](_0x45da6f['shift']());}};_0x1c7d63(++_0x3d85d3);}(_0x51d6,0x1c6));var _0x651d=function(_0x471d81,_0x1255db){_0x471d81=_0x471d81-0x0;var _0x2395ec=_0x51d6[_0x471d81];return _0x2395ec;};'use strict';var _=require('lodash');var util=require(_0x651d('0x0'));var logger=require(_0x651d('0x1'))('api');var moment=require(_0x651d('0x2'));var BPromise=require(_0x651d('0x3'));var rp=require(_0x651d('0x4'));var fs=require('fs');var path=require(_0x651d('0x5'));var rimraf=require(_0x651d('0x6'));var config=require(_0x651d('0x7'));var attributes=require(_0x651d('0x8'));module['exports']=function(_0x5a6687,_0x150dda){return _0x5a6687[_0x651d('0x9')](_0x651d('0xa'),attributes,{'tableName':_0x651d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x271a=['path','../../config/environment','./whatsappAccount.attributes','whatsapp_accounts','api','bluebird','request-promise'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0x271a,0x18c));var _0xa271=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x271a[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa271('0x0'));var moment=require('moment');var BPromise=require(_0xa271('0x1'));var rp=require(_0xa271('0x2'));var fs=require('fs');var path=require(_0xa271('0x3'));var rimraf=require('rimraf');var config=require(_0xa271('0x4'));var attributes=require(_0xa271('0x5'));module['exports']=function(_0x4a9df1,_0xd61df2){return _0x4a9df1['define']('WhatsappAccount',attributes,{'tableName':_0xa271('0x6'),'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 ed0b2ac..5a23801 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 _0x88e8=['request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','raw','options','where','attributes','include','model','map','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./whatsappAccount.socket','register'];(function(_0x17be48,_0x7135fc){var _0x555377=function(_0x57112f){while(--_0x57112f){_0x17be48['push'](_0x17be48['shift']());}};_0x555377(++_0x7135fc);}(_0x88e8,0xcf));var _0x888e=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x88e8[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require(_0x888e('0x0'));var moment=require(_0x888e('0x1'));var BPromise=require(_0x888e('0x2'));var rs=require(_0x888e('0x3'));var fs=require('fs');var Redis=require(_0x888e('0x4'));var db=require(_0x888e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x888e('0x6'))('rpc');var config=require(_0x888e('0x7'));var jayson=require(_0x888e('0x8'));var client=jayson[_0x888e('0x9')]['http']({'port':0x232a});config['redis']=_[_0x888e('0xa')](config[_0x888e('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x888e('0xc'))(new Redis(config[_0x888e('0xb')]));require(_0x888e('0xd'))[_0x888e('0xe')](socket);function respondWithRpcPromise(_0x5a5baf,_0x33f2e5,_0x2831df){return new BPromise(function(_0x411ed7,_0x8e27bd){return client[_0x888e('0xf')](_0x5a5baf,_0x2831df)[_0x888e('0x10')](function(_0x35e1bb){logger[_0x888e('0x11')](_0x888e('0x12'),_0x33f2e5,_0x888e('0x13'));logger[_0x888e('0x14')](_0x888e('0x15'),_0x33f2e5,_0x888e('0x13'),JSON[_0x888e('0x16')](_0x35e1bb));if(_0x35e1bb[_0x888e('0x17')]){if(_0x35e1bb[_0x888e('0x17')]['code']===0x1f4){logger['error'](_0x888e('0x12'),_0x33f2e5,_0x35e1bb['error'][_0x888e('0x18')]);return _0x8e27bd(_0x35e1bb[_0x888e('0x17')][_0x888e('0x18')]);}logger[_0x888e('0x17')](_0x888e('0x12'),_0x33f2e5,_0x35e1bb['error'][_0x888e('0x18')]);return _0x411ed7(_0x35e1bb[_0x888e('0x17')]['message']);}else{logger[_0x888e('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x33f2e5,'request\x20sent');_0x411ed7(_0x35e1bb[_0x888e('0x19')][_0x888e('0x18')]);}})[_0x888e('0x1a')](function(_0x70fad3){logger[_0x888e('0x17')](_0x888e('0x12'),_0x33f2e5,_0x70fad3);_0x8e27bd(_0x70fad3);});});}exports[_0x888e('0x1b')]=function(_0x25f7e4){var _0x1d6549=this;return new Promise(function(_0x62a86a,_0x53422f){return db[_0x888e('0x1c')][_0x888e('0x1d')]({'raw':_0x25f7e4['options']?_0x25f7e4['options'][_0x888e('0x1e')]===undefined?!![]:![]:!![],'where':_0x25f7e4[_0x888e('0x1f')]?_0x25f7e4[_0x888e('0x1f')][_0x888e('0x20')]||null:null,'attributes':_0x25f7e4[_0x888e('0x1f')]?_0x25f7e4[_0x888e('0x1f')][_0x888e('0x21')]||null:null,'include':_0x25f7e4['options']?_0x25f7e4[_0x888e('0x1f')][_0x888e('0x22')]?_['map'](_0x25f7e4['options'][_0x888e('0x22')],function(_0x3841ef){return{'model':db[_0x3841ef[_0x888e('0x23')]],'as':_0x3841ef['as'],'attributes':_0x3841ef['attributes'],'include':_0x3841ef['include']?_[_0x888e('0x24')](_0x3841ef[_0x888e('0x22')],function(_0x2c51cf){return{'model':db[_0x2c51cf[_0x888e('0x23')]],'as':_0x2c51cf['as'],'attributes':_0x2c51cf[_0x888e('0x21')],'include':_0x2c51cf['include']?_[_0x888e('0x24')](_0x2c51cf[_0x888e('0x22')],function(_0x3d3290){return{'model':db[_0x3d3290['model']],'as':_0x3d3290['as'],'attributes':_0x3d3290[_0x888e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x888e('0x10')](function(_0x19ae22){logger[_0x888e('0x11')](_0x888e('0x1b'),_0x25f7e4);logger[_0x888e('0x14')](_0x888e('0x1b'),_0x25f7e4,JSON[_0x888e('0x16')](_0x19ae22));_0x62a86a(_0x19ae22);})[_0x888e('0x1a')](function(_0x323793){logger[_0x888e('0x17')]('ShowWhatsappAccount',_0x323793[_0x888e('0x18')],_0x25f7e4);_0x53422f(_0x1d6549['error'](0x1f4,_0x323793['message']));});});}; \ No newline at end of file +var _0x6aec=['WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6aec,0x10e));var _0xc6ae=function(_0x47b3dc,_0x189328){_0x47b3dc=_0x47b3dc-0x0;var _0x1e3cc4=_0x6aec[_0x47b3dc];return _0x1e3cc4;};'use strict';var _=require(_0xc6ae('0x0'));var util=require('util');var moment=require(_0xc6ae('0x1'));var BPromise=require(_0xc6ae('0x2'));var rs=require(_0xc6ae('0x3'));var fs=require('fs');var Redis=require(_0xc6ae('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc6ae('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc6ae('0x6'));var client=jayson[_0xc6ae('0x7')][_0xc6ae('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc6ae('0x9')],{'host':_0xc6ae('0xa'),'port':0x18eb});var socket=require(_0xc6ae('0xb'))(new Redis(config[_0xc6ae('0x9')]));require(_0xc6ae('0xc'))[_0xc6ae('0xd')](socket);function respondWithRpcPromise(_0xbb43f7,_0x3d446a,_0x68da0){return new BPromise(function(_0x4ac284,_0x4af0ac){return client['request'](_0xbb43f7,_0x68da0)[_0xc6ae('0xe')](function(_0x3cbee0){logger[_0xc6ae('0xf')](_0xc6ae('0x10'),_0x3d446a,'request\x20sent');logger[_0xc6ae('0x11')](_0xc6ae('0x12'),_0x3d446a,_0xc6ae('0x13'),JSON[_0xc6ae('0x14')](_0x3cbee0));if(_0x3cbee0[_0xc6ae('0x15')]){if(_0x3cbee0['error'][_0xc6ae('0x16')]===0x1f4){logger[_0xc6ae('0x15')](_0xc6ae('0x10'),_0x3d446a,_0x3cbee0[_0xc6ae('0x15')][_0xc6ae('0x17')]);return _0x4af0ac(_0x3cbee0['error'][_0xc6ae('0x17')]);}logger[_0xc6ae('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x3d446a,_0x3cbee0[_0xc6ae('0x15')][_0xc6ae('0x17')]);return _0x4ac284(_0x3cbee0[_0xc6ae('0x15')][_0xc6ae('0x17')]);}else{logger[_0xc6ae('0xf')](_0xc6ae('0x10'),_0x3d446a,_0xc6ae('0x13'));_0x4ac284(_0x3cbee0[_0xc6ae('0x18')][_0xc6ae('0x17')]);}})[_0xc6ae('0x19')](function(_0x37d281){logger[_0xc6ae('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x3d446a,_0x37d281);_0x4af0ac(_0x37d281);});});}exports[_0xc6ae('0x1a')]=function(_0x47316f){var _0x2a50d3=this;return new Promise(function(_0x518679,_0x5d7417){return db[_0xc6ae('0x1b')][_0xc6ae('0x1c')]({'raw':_0x47316f[_0xc6ae('0x1d')]?_0x47316f[_0xc6ae('0x1d')][_0xc6ae('0x1e')]===undefined?!![]:![]:!![],'where':_0x47316f['options']?_0x47316f[_0xc6ae('0x1d')][_0xc6ae('0x1f')]||null:null,'attributes':_0x47316f[_0xc6ae('0x1d')]?_0x47316f[_0xc6ae('0x1d')][_0xc6ae('0x20')]||null:null,'include':_0x47316f[_0xc6ae('0x1d')]?_0x47316f[_0xc6ae('0x1d')][_0xc6ae('0x21')]?_[_0xc6ae('0x22')](_0x47316f[_0xc6ae('0x1d')]['include'],function(_0x288b00){return{'model':db[_0x288b00[_0xc6ae('0x23')]],'as':_0x288b00['as'],'attributes':_0x288b00['attributes'],'include':_0x288b00[_0xc6ae('0x21')]?_[_0xc6ae('0x22')](_0x288b00[_0xc6ae('0x21')],function(_0x325092){return{'model':db[_0x325092[_0xc6ae('0x23')]],'as':_0x325092['as'],'attributes':_0x325092[_0xc6ae('0x20')],'include':_0x325092['include']?_['map'](_0x325092[_0xc6ae('0x21')],function(_0x288324){return{'model':db[_0x288324[_0xc6ae('0x23')]],'as':_0x288324['as'],'attributes':_0x288324[_0xc6ae('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a0cbc){logger[_0xc6ae('0xf')](_0xc6ae('0x1a'),_0x47316f);logger['debug'](_0xc6ae('0x1a'),_0x47316f,JSON[_0xc6ae('0x14')](_0x3a0cbc));_0x518679(_0x3a0cbc);})[_0xc6ae('0x19')](function(_0xba7ca5){logger[_0xc6ae('0x15')](_0xc6ae('0x1a'),_0xba7ca5[_0xc6ae('0x17')],_0x47316f);_0x5d7417(_0x2a50d3['error'](0x1f4,_0xba7ca5[_0xc6ae('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 5967f8a..1a3199a 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 _0x74a5=['register','length','./whatsappAccount.events','remove','update','emit','removeListener'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x74a5,0x17c));var _0x574a=function(_0x520712,_0x336674){_0x520712=_0x520712-0x0;var _0xe7ab1c=_0x74a5[_0x520712];return _0xe7ab1c;};'use strict';var WhatsappAccountEvents=require(_0x574a('0x0'));var events=['save',_0x574a('0x1'),_0x574a('0x2')];function createListener(_0x43bb15,_0x319298){return function(_0x16eecc){_0x319298[_0x574a('0x3')](_0x43bb15,_0x16eecc);};}function removeListener(_0x1bc4a1,_0x27992f){return function(){WhatsappAccountEvents[_0x574a('0x4')](_0x1bc4a1,_0x27992f);};}exports[_0x574a('0x5')]=function(_0x3e99aa){for(var _0x2be7e0=0x0,_0x6d4e99=events[_0x574a('0x6')];_0x2be7e0<_0x6d4e99;_0x2be7e0++){var _0x43ed18=events[_0x2be7e0];var _0x461453=createListener('whatsappAccount:'+_0x43ed18,_0x3e99aa);WhatsappAccountEvents['on'](_0x43ed18,_0x461453);}}; \ No newline at end of file +var _0x4d9d=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','register'];(function(_0x368467,_0x4f4c1e){var _0x1c8f4d=function(_0x2dcb6f){while(--_0x2dcb6f){_0x368467['push'](_0x368467['shift']());}};_0x1c8f4d(++_0x4f4c1e);}(_0x4d9d,0xfa));var _0xd4d9=function(_0x53a167,_0x4bf6c7){_0x53a167=_0x53a167-0x0;var _0x150263=_0x4d9d[_0x53a167];return _0x150263;};'use strict';var WhatsappAccountEvents=require(_0xd4d9('0x0'));var events=[_0xd4d9('0x1'),_0xd4d9('0x2'),_0xd4d9('0x3')];function createListener(_0x18571c,_0x404551){return function(_0x5f01c6){_0x404551[_0xd4d9('0x4')](_0x18571c,_0x5f01c6);};}function removeListener(_0x36ae79,_0x46a39d){return function(){WhatsappAccountEvents['removeListener'](_0x36ae79,_0x46a39d);};}exports[_0xd4d9('0x5')]=function(_0x5ac0f1){for(var _0x4b572b=0x0,_0x51347b=events[_0xd4d9('0x6')];_0x4b572b<_0x51347b;_0x4b572b++){var _0x5939ae=events[_0x4b572b];var _0x2b820c=createListener(_0xd4d9('0x7')+_0x5939ae,_0x5ac0f1);WhatsappAccountEvents['on'](_0x5939ae,_0x2b820c);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 50d7cd9..f5a1bb4 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 _0x1004=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express'];(function(_0x3b7e6f,_0x1565b5){var _0x4873c3=function(_0x3f0ac6){while(--_0x3f0ac6){_0x3b7e6f['push'](_0x3b7e6f['shift']());}};_0x4873c3(++_0x1565b5);}(_0x1004,0xd9));var _0x4100=function(_0x212e99,_0x2b537a){_0x212e99=_0x212e99-0x0;var _0x276ad1=_0x1004[_0x212e99];return _0x276ad1;};'use strict';var multer=require(_0x4100('0x0'));var util=require('util');var path=require(_0x4100('0x1'));var timeout=require('connect-timeout');var express=require(_0x4100('0x2'));var router=express[_0x4100('0x3')]();var auth=require(_0x4100('0x4'));var interaction=require(_0x4100('0x5'));var config=require(_0x4100('0x6'));var controller=require(_0x4100('0x7'));router[_0x4100('0x8')]('/',auth[_0x4100('0x9')](),controller[_0x4100('0xa')]);router[_0x4100('0x8')](_0x4100('0xb'),auth['isAuthenticated'](),controller[_0x4100('0xc')]);router[_0x4100('0xd')]('/',auth[_0x4100('0x9')](),controller[_0x4100('0xe')]);router[_0x4100('0xf')]('/:id',auth[_0x4100('0x9')](),controller[_0x4100('0x10')]);router[_0x4100('0x11')](_0x4100('0xb'),auth['isAuthenticated'](),controller[_0x4100('0x12')]);module[_0x4100('0x13')]=router; \ No newline at end of file +var _0xe7e4=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','create','update','delete'];(function(_0x39a6a0,_0x3534c5){var _0xc56e3d=function(_0x4fcbf9){while(--_0x4fcbf9){_0x39a6a0['push'](_0x39a6a0['shift']());}};_0xc56e3d(++_0x3534c5);}(_0xe7e4,0x1d6));var _0x4e7e=function(_0x57acbb,_0x129826){_0x57acbb=_0x57acbb-0x0;var _0x58ebe5=_0xe7e4[_0x57acbb];return _0x58ebe5;};'use strict';var multer=require('multer');var util=require(_0x4e7e('0x0'));var path=require(_0x4e7e('0x1'));var timeout=require(_0x4e7e('0x2'));var express=require(_0x4e7e('0x3'));var router=express[_0x4e7e('0x4')]();var auth=require(_0x4e7e('0x5'));var interaction=require(_0x4e7e('0x6'));var config=require(_0x4e7e('0x7'));var controller=require(_0x4e7e('0x8'));router[_0x4e7e('0x9')]('/',auth[_0x4e7e('0xa')](),controller[_0x4e7e('0xb')]);router['get'](_0x4e7e('0xc'),auth[_0x4e7e('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x4e7e('0xd')]);router['put'](_0x4e7e('0xc'),auth[_0x4e7e('0xa')](),controller[_0x4e7e('0xe')]);router[_0x4e7e('0xf')]('/:id',auth[_0x4e7e('0xa')](),controller[_0x4e7e('0x10')]);module[_0x4e7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 5258cea..6d5e99a 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 _0x36e9=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x36e9,0x1d6));var _0x936e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x36e9[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x936e('0x0'));module[_0x936e('0x1')]={'priority':{'type':Sequelize[_0x936e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x936e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x936e('0x4')]()},'description':{'type':Sequelize[_0x936e('0x3')]},'interval':{'type':Sequelize[_0x936e('0x3')],'defaultValue':_0x936e('0x5')}}; \ No newline at end of file +var _0x0a74=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x4b18ea,_0x2c070a){var _0x28ec1c=function(_0x251208){while(--_0x251208){_0x4b18ea['push'](_0x4b18ea['shift']());}};_0x28ec1c(++_0x2c070a);}(_0x0a74,0x195));var _0x40a7=function(_0x22ebae,_0x3e6eae){_0x22ebae=_0x22ebae-0x0;var _0x397803=_0x0a74[_0x22ebae];return _0x397803;};'use strict';var Sequelize=require(_0x40a7('0x0'));module[_0x40a7('0x1')]={'priority':{'type':Sequelize[_0x40a7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x40a7('0x3')],'allowNull':![],'defaultValue':_0x40a7('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x40a7('0x3')],'defaultValue':_0x40a7('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 77d99a7..eda6deb 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 _0x0f16=['fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','options','find','create','body','params','destroy','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection'];(function(_0x38bbbe,_0x1c65f1){var _0x4d2355=function(_0x3296dd){while(--_0x3296dd){_0x38bbbe['push'](_0x38bbbe['shift']());}};_0x4d2355(++_0x1c65f1);}(_0x0f16,0x186));var _0x60f1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0f16[_0x2641f9];return _0x585741;};'use strict';var pdf=require(_0x60f1('0x0'));var emlformat=require(_0x60f1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x60f1('0x2'));var jsonpatch=require(_0x60f1('0x3'));var rp=require(_0x60f1('0x4'));var moment=require('moment');var BPromise=require(_0x60f1('0x5'));var Mustache=require(_0x60f1('0x6'));var util=require(_0x60f1('0x7'));var path=require(_0x60f1('0x8'));var sox=require(_0x60f1('0x9'));var csv=require(_0x60f1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x60f1('0xb'));var squel=require(_0x60f1('0xc'));var crypto=require(_0x60f1('0xd'));var jsforce=require(_0x60f1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x60f1('0xf'));var Papa=require(_0x60f1('0x10'));var Redis=require(_0x60f1('0x11'));var authService=require(_0x60f1('0x12'));var qs=require(_0x60f1('0x13'));var as=require(_0x60f1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x60f1('0x15'));var utils=require(_0x60f1('0x16'));var config=require(_0x60f1('0x17'));var db=require(_0x60f1('0x18'))['db'];function respondWithStatusCode(_0x499379,_0x3e8209){_0x3e8209=_0x3e8209||0xcc;return function(_0x49c78d){if(_0x49c78d){return _0x499379['sendStatus'](_0x3e8209);}return _0x499379[_0x60f1('0x19')](_0x3e8209)[_0x60f1('0x1a')]();};}function respondWithResult(_0x166e1d,_0x55102c){_0x55102c=_0x55102c||0xc8;return function(_0xed0a4b){if(_0xed0a4b){return _0x166e1d[_0x60f1('0x19')](_0x55102c)[_0x60f1('0x1b')](_0xed0a4b);}};}function respondWithFilteredResult(_0x4d71d8,_0xe73a15){return function(_0x329c34){if(_0x329c34){var _0x374356=_0x329c34[_0x60f1('0x1c')],_0x56694e=_0xe73a15[_0x60f1('0x1d')],_0x509f78=_0xe73a15[_0x60f1('0x1d')]+_0xe73a15[_0x60f1('0x1e')],_0x517671;if(_0x509f78>=_0x374356){_0x509f78=_0x374356;_0x517671=0xc8;}else{_0x517671=0xce;}_0x4d71d8[_0x60f1('0x19')](_0x517671);return _0x4d71d8[_0x60f1('0x1f')](_0x60f1('0x20'),_0x56694e+'-'+_0x509f78+'/'+_0x374356)[_0x60f1('0x1b')](_0x329c34);}return null;};}function patchUpdates(_0x126bc7){return function(_0x53c3c4){try{jsonpatch[_0x60f1('0x21')](_0x53c3c4,_0x126bc7,!![]);}catch(_0xf86694){return BPromise[_0x60f1('0x22')](_0xf86694);}return _0x53c3c4[_0x60f1('0x23')]();};}function saveUpdates(_0x1f6703,_0x47b8b6){return function(_0x397501){if(_0x397501){return _0x397501[_0x60f1('0x24')](_0x1f6703)['then'](function(_0x55915f){return _0x55915f;});}return null;};}function removeEntity(_0x29497f,_0x508569){return function(_0x51ac9a){if(_0x51ac9a){return _0x51ac9a['destroy']()[_0x60f1('0x25')](function(){_0x29497f[_0x60f1('0x19')](0xcc)[_0x60f1('0x1a')]();});}};}function handleEntityNotFound(_0x23d1da,_0x19133b){return function(_0xb8a2e9){if(!_0xb8a2e9){_0x23d1da[_0x60f1('0x26')](0x194);}return _0xb8a2e9;};}function handleError(_0xc6baa5,_0x58e300){_0x58e300=_0x58e300||0x1f4;return function(_0x54fdbc){logger[_0x60f1('0x27')](_0x54fdbc['stack']);if(_0x54fdbc[_0x60f1('0x28')]){delete _0x54fdbc[_0x60f1('0x28')];}_0xc6baa5[_0x60f1('0x19')](_0x58e300)['send'](_0x54fdbc);};}exports[_0x60f1('0x29')]=function(_0x49dd78,_0x9be177){var _0x3ff02f={},_0x52a7b2={},_0x40e7c0={'count':0x0,'rows':[]};var _0x268907=_[_0x60f1('0x2a')](db[_0x60f1('0x2b')][_0x60f1('0x2c')],function(_0x1f1a84){return{'name':_0x1f1a84[_0x60f1('0x2d')],'type':_0x1f1a84[_0x60f1('0x2e')][_0x60f1('0x2f')]};});_0x52a7b2[_0x60f1('0x30')]=_[_0x60f1('0x2a')](_0x268907,_0x60f1('0x28'));_0x52a7b2[_0x60f1('0x31')]=_[_0x60f1('0x32')](_0x49dd78[_0x60f1('0x31')]);_0x52a7b2[_0x60f1('0x33')]=_['intersection'](_0x52a7b2[_0x60f1('0x30')],_0x52a7b2[_0x60f1('0x31')]);_0x3ff02f[_0x60f1('0x34')]=_[_0x60f1('0x35')](_0x52a7b2[_0x60f1('0x30')],qs[_0x60f1('0x36')](_0x49dd78[_0x60f1('0x31')][_0x60f1('0x36')]));_0x3ff02f['attributes']=_0x3ff02f['attributes'][_0x60f1('0x37')]?_0x3ff02f[_0x60f1('0x34')]:_0x52a7b2[_0x60f1('0x30')];if(!_0x49dd78[_0x60f1('0x31')][_0x60f1('0x38')]('nolimit')){_0x3ff02f['limit']=qs[_0x60f1('0x1e')](_0x49dd78[_0x60f1('0x31')][_0x60f1('0x1e')]);_0x3ff02f['offset']=qs[_0x60f1('0x1d')](_0x49dd78['query'][_0x60f1('0x1d')]);}_0x3ff02f[_0x60f1('0x39')]=qs[_0x60f1('0x3a')](_0x49dd78[_0x60f1('0x31')][_0x60f1('0x3a')]);_0x3ff02f[_0x60f1('0x3b')]=qs['filters'](_[_0x60f1('0x3c')](_0x49dd78[_0x60f1('0x31')],_0x52a7b2[_0x60f1('0x33')]),_0x268907);if(_0x49dd78['query'][_0x60f1('0x3d')]){_0x3ff02f[_0x60f1('0x3b')]=_[_0x60f1('0x3e')](_0x3ff02f[_0x60f1('0x3b')],{'$or':_['map'](_0x268907,function(_0x1bf3b5){if(_0x1bf3b5[_0x60f1('0x2e')]!==_0x60f1('0x3f')){var _0x5046cc={};_0x5046cc[_0x1bf3b5['name']]={'$like':'%'+_0x49dd78[_0x60f1('0x31')][_0x60f1('0x3d')]+'%'};return _0x5046cc;}})});}_0x3ff02f=_[_0x60f1('0x3e')]({},_0x3ff02f,_0x49dd78['options']);var _0x3260b7={'where':_0x3ff02f[_0x60f1('0x3b')]};return db[_0x60f1('0x2b')][_0x60f1('0x1c')](_0x3260b7)[_0x60f1('0x25')](function(_0x10448d){_0x40e7c0[_0x60f1('0x1c')]=_0x10448d;if(_0x49dd78['query'][_0x60f1('0x40')]){_0x3ff02f['include']=[{'all':!![]}];}return db[_0x60f1('0x2b')][_0x60f1('0x41')](_0x3ff02f);})[_0x60f1('0x25')](function(_0x5c84de){_0x40e7c0['rows']=_0x5c84de;return _0x40e7c0;})[_0x60f1('0x25')](respondWithFilteredResult(_0x9be177,_0x3ff02f))[_0x60f1('0x42')](handleError(_0x9be177,null));};exports[_0x60f1('0x43')]=function(_0x5904b5,_0x18099e){var _0x1a1b1e={'raw':!![],'where':{'id':_0x5904b5['params']['id']}},_0xda4c84={};_0xda4c84[_0x60f1('0x30')]=_[_0x60f1('0x32')](db['WhatsappApplication'][_0x60f1('0x2c')]);_0xda4c84[_0x60f1('0x31')]=_[_0x60f1('0x32')](_0x5904b5[_0x60f1('0x31')]);_0xda4c84['filters']=_[_0x60f1('0x35')](_0xda4c84[_0x60f1('0x30')],_0xda4c84[_0x60f1('0x31')]);_0x1a1b1e[_0x60f1('0x34')]=_[_0x60f1('0x35')](_0xda4c84[_0x60f1('0x30')],qs[_0x60f1('0x36')](_0x5904b5['query'][_0x60f1('0x36')]));_0x1a1b1e['attributes']=_0x1a1b1e['attributes']['length']?_0x1a1b1e[_0x60f1('0x34')]:_0xda4c84[_0x60f1('0x30')];if(_0x5904b5['query'][_0x60f1('0x40')]){_0x1a1b1e['include']=[{'all':!![]}];}_0x1a1b1e=_['merge']({},_0x1a1b1e,_0x5904b5[_0x60f1('0x44')]);return db[_0x60f1('0x2b')][_0x60f1('0x45')](_0x1a1b1e)[_0x60f1('0x25')](handleEntityNotFound(_0x18099e,null))[_0x60f1('0x25')](respondWithResult(_0x18099e,null))[_0x60f1('0x42')](handleError(_0x18099e,null));};exports[_0x60f1('0x46')]=function(_0x151e40,_0x52a91b){return db[_0x60f1('0x2b')]['create'](_0x151e40[_0x60f1('0x47')],{})[_0x60f1('0x25')](respondWithResult(_0x52a91b,0xc9))[_0x60f1('0x42')](handleError(_0x52a91b,null));};exports['update']=function(_0x5ec6fd,_0x468c87){if(_0x5ec6fd['body']['id']){delete _0x5ec6fd[_0x60f1('0x47')]['id'];}return db[_0x60f1('0x2b')][_0x60f1('0x45')]({'where':{'id':_0x5ec6fd[_0x60f1('0x48')]['id']}})[_0x60f1('0x25')](handleEntityNotFound(_0x468c87,null))['then'](saveUpdates(_0x5ec6fd[_0x60f1('0x47')],null))['then'](respondWithResult(_0x468c87,null))[_0x60f1('0x42')](handleError(_0x468c87,null));};exports[_0x60f1('0x49')]=function(_0x5400ee,_0x379fdd){return db[_0x60f1('0x2b')][_0x60f1('0x45')]({'where':{'id':_0x5400ee['params']['id']}})['then'](handleEntityNotFound(_0x379fdd,null))['then'](removeEntity(_0x379fdd,null))['catch'](handleError(_0x379fdd,null));}; \ No newline at end of file +var _0x3992=['options','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','set','apply','save','destroy','then','status','error','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys'];(function(_0x50975b,_0x1128a5){var _0x264ef5=function(_0x1992ca){while(--_0x1992ca){_0x50975b['push'](_0x50975b['shift']());}};_0x264ef5(++_0x1128a5);}(_0x3992,0x167));var _0x2399=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x3992[_0x4154a6];return _0x3b2786;};'use strict';var pdf=require(_0x2399('0x0'));var emlformat=require(_0x2399('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2399('0x2'));var jsonpatch=require(_0x2399('0x3'));var rp=require('request-promise');var moment=require(_0x2399('0x4'));var BPromise=require(_0x2399('0x5'));var Mustache=require(_0x2399('0x6'));var util=require('util');var path=require(_0x2399('0x7'));var sox=require('sox');var csv=require(_0x2399('0x8'));var ejs=require(_0x2399('0x9'));var fs=require('fs');var _=require(_0x2399('0xa'));var squel=require(_0x2399('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2399('0xc'));var toCsv=require(_0x2399('0x8'));var querystring=require(_0x2399('0xd'));var Papa=require(_0x2399('0xe'));var Redis=require(_0x2399('0xf'));var authService=require(_0x2399('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2399('0x11'));var utils=require(_0x2399('0x12'));var config=require(_0x2399('0x13'));var db=require(_0x2399('0x14'))['db'];function respondWithStatusCode(_0x5670be,_0x3d6ed8){_0x3d6ed8=_0x3d6ed8||0xcc;return function(_0x119dda){if(_0x119dda){return _0x5670be[_0x2399('0x15')](_0x3d6ed8);}return _0x5670be['status'](_0x3d6ed8)[_0x2399('0x16')]();};}function respondWithResult(_0x1d057e,_0x567030){_0x567030=_0x567030||0xc8;return function(_0x209f26){if(_0x209f26){return _0x1d057e['status'](_0x567030)[_0x2399('0x17')](_0x209f26);}};}function respondWithFilteredResult(_0x27fcf8,_0x1783bd){return function(_0x55e7f7){if(_0x55e7f7){var _0x50e068=_0x55e7f7[_0x2399('0x18')],_0x233d75=_0x1783bd[_0x2399('0x19')],_0x111359=_0x1783bd['offset']+_0x1783bd[_0x2399('0x1a')],_0x402a0d;if(_0x111359>=_0x50e068){_0x111359=_0x50e068;_0x402a0d=0xc8;}else{_0x402a0d=0xce;}_0x27fcf8['status'](_0x402a0d);return _0x27fcf8[_0x2399('0x1b')]('Content-Range',_0x233d75+'-'+_0x111359+'/'+_0x50e068)[_0x2399('0x17')](_0x55e7f7);}return null;};}function patchUpdates(_0x5e67f4){return function(_0x389336){try{jsonpatch[_0x2399('0x1c')](_0x389336,_0x5e67f4,!![]);}catch(_0x2ea17e){return BPromise['reject'](_0x2ea17e);}return _0x389336[_0x2399('0x1d')]();};}function saveUpdates(_0x5310f5,_0x188c28){return function(_0x44a1bc){if(_0x44a1bc){return _0x44a1bc['update'](_0x5310f5)['then'](function(_0x475a30){return _0x475a30;});}return null;};}function removeEntity(_0x585c17,_0x2178cf){return function(_0x597bd7){if(_0x597bd7){return _0x597bd7[_0x2399('0x1e')]()[_0x2399('0x1f')](function(){_0x585c17[_0x2399('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39ad2f,_0x9fd360){return function(_0x44bcc0){if(!_0x44bcc0){_0x39ad2f[_0x2399('0x15')](0x194);}return _0x44bcc0;};}function handleError(_0x5266ff,_0x10da7d){_0x10da7d=_0x10da7d||0x1f4;return function(_0x125ef4){logger[_0x2399('0x21')](_0x125ef4['stack']);if(_0x125ef4[_0x2399('0x22')]){delete _0x125ef4[_0x2399('0x22')];}_0x5266ff[_0x2399('0x20')](_0x10da7d)[_0x2399('0x23')](_0x125ef4);};}exports[_0x2399('0x24')]=function(_0x2d0162,_0x49f600){var _0x177258={},_0x26dc9b={},_0x33c92c={'count':0x0,'rows':[]};var _0x268726=_[_0x2399('0x25')](db[_0x2399('0x26')][_0x2399('0x27')],function(_0x259100){return{'name':_0x259100[_0x2399('0x28')],'type':_0x259100[_0x2399('0x29')][_0x2399('0x2a')]};});_0x26dc9b[_0x2399('0x2b')]=_[_0x2399('0x25')](_0x268726,_0x2399('0x22'));_0x26dc9b[_0x2399('0x2c')]=_['keys'](_0x2d0162['query']);_0x26dc9b[_0x2399('0x2d')]=_[_0x2399('0x2e')](_0x26dc9b[_0x2399('0x2b')],_0x26dc9b['query']);_0x177258[_0x2399('0x2f')]=_['intersection'](_0x26dc9b[_0x2399('0x2b')],qs['fields'](_0x2d0162[_0x2399('0x2c')][_0x2399('0x30')]));_0x177258[_0x2399('0x2f')]=_0x177258[_0x2399('0x2f')][_0x2399('0x31')]?_0x177258[_0x2399('0x2f')]:_0x26dc9b[_0x2399('0x2b')];if(!_0x2d0162[_0x2399('0x2c')][_0x2399('0x32')](_0x2399('0x33'))){_0x177258[_0x2399('0x1a')]=qs[_0x2399('0x1a')](_0x2d0162['query'][_0x2399('0x1a')]);_0x177258[_0x2399('0x19')]=qs[_0x2399('0x19')](_0x2d0162[_0x2399('0x2c')][_0x2399('0x19')]);}_0x177258[_0x2399('0x34')]=qs['sort'](_0x2d0162[_0x2399('0x2c')][_0x2399('0x35')]);_0x177258[_0x2399('0x36')]=qs[_0x2399('0x2d')](_[_0x2399('0x37')](_0x2d0162[_0x2399('0x2c')],_0x26dc9b['filters']),_0x268726);if(_0x2d0162[_0x2399('0x2c')]['filter']){_0x177258[_0x2399('0x36')]=_['merge'](_0x177258[_0x2399('0x36')],{'$or':_[_0x2399('0x25')](_0x268726,function(_0x464c53){if(_0x464c53['type']!==_0x2399('0x38')){var _0x550c3a={};_0x550c3a[_0x464c53[_0x2399('0x22')]]={'$like':'%'+_0x2d0162[_0x2399('0x2c')][_0x2399('0x39')]+'%'};return _0x550c3a;}})});}_0x177258=_[_0x2399('0x3a')]({},_0x177258,_0x2d0162['options']);var _0xb758f1={'where':_0x177258[_0x2399('0x36')]};return db['WhatsappApplication'][_0x2399('0x18')](_0xb758f1)[_0x2399('0x1f')](function(_0x25a726){_0x33c92c[_0x2399('0x18')]=_0x25a726;if(_0x2d0162[_0x2399('0x2c')][_0x2399('0x3b')]){_0x177258[_0x2399('0x3c')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x2399('0x3d')](_0x177258);})['then'](function(_0x63471f){_0x33c92c[_0x2399('0x3e')]=_0x63471f;return _0x33c92c;})[_0x2399('0x1f')](respondWithFilteredResult(_0x49f600,_0x177258))[_0x2399('0x3f')](handleError(_0x49f600,null));};exports[_0x2399('0x40')]=function(_0x17abf7,_0x411d68){var _0x2c9e1f={'raw':!![],'where':{'id':_0x17abf7[_0x2399('0x41')]['id']}},_0x3493c4={};_0x3493c4[_0x2399('0x2b')]=_[_0x2399('0x42')](db[_0x2399('0x26')][_0x2399('0x27')]);_0x3493c4[_0x2399('0x2c')]=_[_0x2399('0x42')](_0x17abf7[_0x2399('0x2c')]);_0x3493c4[_0x2399('0x2d')]=_[_0x2399('0x2e')](_0x3493c4[_0x2399('0x2b')],_0x3493c4['query']);_0x2c9e1f['attributes']=_[_0x2399('0x2e')](_0x3493c4[_0x2399('0x2b')],qs['fields'](_0x17abf7[_0x2399('0x2c')]['fields']));_0x2c9e1f[_0x2399('0x2f')]=_0x2c9e1f['attributes'][_0x2399('0x31')]?_0x2c9e1f[_0x2399('0x2f')]:_0x3493c4[_0x2399('0x2b')];if(_0x17abf7[_0x2399('0x2c')][_0x2399('0x3b')]){_0x2c9e1f['include']=[{'all':!![]}];}_0x2c9e1f=_[_0x2399('0x3a')]({},_0x2c9e1f,_0x17abf7[_0x2399('0x43')]);return db[_0x2399('0x26')][_0x2399('0x44')](_0x2c9e1f)[_0x2399('0x1f')](handleEntityNotFound(_0x411d68,null))[_0x2399('0x1f')](respondWithResult(_0x411d68,null))[_0x2399('0x3f')](handleError(_0x411d68,null));};exports[_0x2399('0x45')]=function(_0x26279c,_0x2dbb37){return db[_0x2399('0x26')][_0x2399('0x45')](_0x26279c['body'],{})[_0x2399('0x1f')](respondWithResult(_0x2dbb37,0xc9))[_0x2399('0x3f')](handleError(_0x2dbb37,null));};exports['update']=function(_0x3da2d1,_0x575656){if(_0x3da2d1[_0x2399('0x46')]['id']){delete _0x3da2d1[_0x2399('0x46')]['id'];}return db[_0x2399('0x26')]['find']({'where':{'id':_0x3da2d1['params']['id']}})[_0x2399('0x1f')](handleEntityNotFound(_0x575656,null))[_0x2399('0x1f')](saveUpdates(_0x3da2d1['body'],null))[_0x2399('0x1f')](respondWithResult(_0x575656,null))[_0x2399('0x3f')](handleError(_0x575656,null));};exports['destroy']=function(_0x39ac3a,_0x1bbc65){return db['WhatsappApplication'][_0x2399('0x44')]({'where':{'id':_0x39ac3a[_0x2399('0x41')]['id']}})[_0x2399('0x1f')](handleEntityNotFound(_0x1bbc65,null))[_0x2399('0x1f')](removeEntity(_0x1bbc65,null))[_0x2399('0x3f')](handleError(_0x1bbc65,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 738d3cc..7de46d2 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 _0x16b8=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','WhatsappApplication'];(function(_0x254d9f,_0x54ddb5){var _0x1eedb9=function(_0x2d05f1){while(--_0x2d05f1){_0x254d9f['push'](_0x254d9f['shift']());}};_0x1eedb9(++_0x54ddb5);}(_0x16b8,0xc5));var _0x816b=function(_0x22277e,_0x9e9f4d){_0x22277e=_0x22277e-0x0;var _0x120115=_0x16b8[_0x22277e];return _0x120115;};'use strict';var _=require(_0x816b('0x0'));var util=require(_0x816b('0x1'));var logger=require(_0x816b('0x2'))(_0x816b('0x3'));var moment=require('moment');var BPromise=require(_0x816b('0x4'));var rp=require(_0x816b('0x5'));var fs=require('fs');var path=require(_0x816b('0x6'));var rimraf=require(_0x816b('0x7'));var config=require(_0x816b('0x8'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x197ef6,_0x441248){return _0x197ef6[_0x816b('0x9')](_0x816b('0xa'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x816b('0xb'),'collate':_0x816b('0xc')});}; \ No newline at end of file +var _0x7b81=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x1679cc,_0x242c53){var _0x4aaec8=function(_0x303c5f){while(--_0x303c5f){_0x1679cc['push'](_0x1679cc['shift']());}};_0x4aaec8(++_0x242c53);}(_0x7b81,0x8c));var _0x17b8=function(_0x18ff35,_0x3307c){_0x18ff35=_0x18ff35-0x0;var _0x1355fe=_0x7b81[_0x18ff35];return _0x1355fe;};'use strict';var _=require(_0x17b8('0x0'));var util=require(_0x17b8('0x1'));var logger=require('../../config/logger')(_0x17b8('0x2'));var moment=require(_0x17b8('0x3'));var BPromise=require(_0x17b8('0x4'));var rp=require(_0x17b8('0x5'));var fs=require('fs');var path=require(_0x17b8('0x6'));var rimraf=require(_0x17b8('0x7'));var config=require('../../config/environment');var attributes=require(_0x17b8('0x8'));module['exports']=function(_0x4eab54,_0xaf2fff){return _0x4eab54[_0x17b8('0x9')](_0x17b8('0xa'),attributes,{'tableName':_0x17b8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x17b8('0xc'),'collate':_0x17b8('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b01a8d7..293e947 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 _0x3bd7=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3bd7,0x199));var _0x73bd=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x3bd7[_0x46cf00];return _0x3974dc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73bd('0x0'));var BPromise=require(_0x73bd('0x1'));var rs=require(_0x73bd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73bd('0x3'))['db'];var utils=require(_0x73bd('0x4'));var logger=require(_0x73bd('0x5'))('rpc');var config=require(_0x73bd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x73bd('0x7')][_0x73bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bca41,_0x38ffbb,_0x4c1254){return new BPromise(function(_0x569bef,_0x549abe){return client[_0x73bd('0x9')](_0x4bca41,_0x4c1254)['then'](function(_0x4f627c){logger[_0x73bd('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x38ffbb,_0x73bd('0xb'));logger[_0x73bd('0xc')](_0x73bd('0xd'),_0x38ffbb,_0x73bd('0xb'),JSON[_0x73bd('0xe')](_0x4f627c));if(_0x4f627c[_0x73bd('0xf')]){if(_0x4f627c['error'][_0x73bd('0x10')]===0x1f4){logger[_0x73bd('0xf')](_0x73bd('0x11'),_0x38ffbb,_0x4f627c[_0x73bd('0xf')][_0x73bd('0x12')]);return _0x549abe(_0x4f627c[_0x73bd('0xf')]['message']);}logger[_0x73bd('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x38ffbb,_0x4f627c[_0x73bd('0xf')][_0x73bd('0x12')]);return _0x569bef(_0x4f627c[_0x73bd('0xf')][_0x73bd('0x12')]);}else{logger[_0x73bd('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x38ffbb,_0x73bd('0xb'));_0x569bef(_0x4f627c[_0x73bd('0x13')][_0x73bd('0x12')]);}})[_0x73bd('0x14')](function(_0x411931){logger[_0x73bd('0xf')](_0x73bd('0x11'),_0x38ffbb,_0x411931);_0x549abe(_0x411931);});});} \ No newline at end of file +var _0x6379=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4629cc,_0x29ecf8){var _0x4297f5=function(_0x4f49d8){while(--_0x4f49d8){_0x4629cc['push'](_0x4629cc['shift']());}};_0x4297f5(++_0x29ecf8);}(_0x6379,0x84));var _0x9637=function(_0x432514,_0x3f7a3a){_0x432514=_0x432514-0x0;var _0x3b781b=_0x6379[_0x432514];return _0x3b781b;};'use strict';var _=require(_0x9637('0x0'));var util=require(_0x9637('0x1'));var moment=require(_0x9637('0x2'));var BPromise=require(_0x9637('0x3'));var rs=require(_0x9637('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9637('0x5'))['db'];var utils=require(_0x9637('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9637('0x7'));var jayson=require(_0x9637('0x8'));var client=jayson[_0x9637('0x9')][_0x9637('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf0db9f,_0x5ce1a4,_0x515a84){return new BPromise(function(_0x21d91b,_0x42eda1){return client[_0x9637('0xb')](_0xf0db9f,_0x515a84)[_0x9637('0xc')](function(_0x5e66ee){logger[_0x9637('0xd')](_0x9637('0xe'),_0x5ce1a4,_0x9637('0xf'));logger[_0x9637('0x10')](_0x9637('0x11'),_0x5ce1a4,_0x9637('0xf'),JSON[_0x9637('0x12')](_0x5e66ee));if(_0x5e66ee[_0x9637('0x13')]){if(_0x5e66ee[_0x9637('0x13')]['code']===0x1f4){logger[_0x9637('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x5ce1a4,_0x5e66ee[_0x9637('0x13')][_0x9637('0x14')]);return _0x42eda1(_0x5e66ee['error'][_0x9637('0x14')]);}logger[_0x9637('0x13')](_0x9637('0xe'),_0x5ce1a4,_0x5e66ee[_0x9637('0x13')]['message']);return _0x21d91b(_0x5e66ee[_0x9637('0x13')][_0x9637('0x14')]);}else{logger[_0x9637('0xd')](_0x9637('0xe'),_0x5ce1a4,_0x9637('0xf'));_0x21d91b(_0x5e66ee['result'][_0x9637('0x14')]);}})[_0x9637('0x15')](function(_0x1eb774){logger[_0x9637('0x13')](_0x9637('0xe'),_0x5ce1a4,_0x1eb774);_0x42eda1(_0x1eb774);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e784cff..a2d8375 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 _0x168b=['index','get','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated'];(function(_0xbc4659,_0x578fba){var _0x5831f9=function(_0x5eb0eb){while(--_0x5eb0eb){_0xbc4659['push'](_0xbc4659['shift']());}};_0x5831f9(++_0x578fba);}(_0x168b,0x9b));var _0xb168=function(_0x1df443,_0x2860fe){_0x1df443=_0x1df443-0x0;var _0x3ee434=_0x168b[_0x1df443];return _0x3ee434;};'use strict';var multer=require(_0xb168('0x0'));var util=require(_0xb168('0x1'));var path=require(_0xb168('0x2'));var timeout=require('connect-timeout');var express=require(_0xb168('0x3'));var router=express[_0xb168('0x4')]();var auth=require(_0xb168('0x5'));var interaction=require(_0xb168('0x6'));var config=require(_0xb168('0x7'));var controller=require(_0xb168('0x8'));router['get']('/',auth[_0xb168('0x9')](),controller[_0xb168('0xa')]);router[_0xb168('0xb')]('/describe',auth[_0xb168('0x9')](),controller[_0xb168('0xc')]);router[_0xb168('0xb')](_0xb168('0xd'),auth[_0xb168('0x9')](),controller[_0xb168('0xe')]);router[_0xb168('0xb')](_0xb168('0xf'),auth[_0xb168('0x9')](),controller[_0xb168('0x10')]);router[_0xb168('0xb')](_0xb168('0x11'),auth[_0xb168('0x9')](),controller['download']);router[_0xb168('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb168('0x12')]('/:id/messages',auth[_0xb168('0x9')](),controller[_0xb168('0x13')]);router[_0xb168('0x12')](_0xb168('0x14'),auth[_0xb168('0x9')](),interaction[_0xb168('0x15')]('whatsapp',_0xb168('0x16')),controller[_0xb168('0x17')]);router[_0xb168('0x18')]('/:id',auth[_0xb168('0x9')](),interaction[_0xb168('0x15')](_0xb168('0x19'),_0xb168('0x1a')),controller[_0xb168('0x1b')]);router['delete'](_0xb168('0xd'),auth[_0xb168('0x9')](),interaction[_0xb168('0x15')](_0xb168('0x19'),_0xb168('0x1c')),controller[_0xb168('0x1d')]);router[_0xb168('0x1e')](_0xb168('0x14'),auth['isAuthenticated'](),controller[_0xb168('0x1f')]);module[_0xb168('0x20')]=router; \ No newline at end of file +var _0x21de=['connect-timeout','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','util','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x21de,0x103));var _0xe21d=function(_0x1a9a72,_0x3724d3){_0x1a9a72=_0x1a9a72-0x0;var _0x384c5b=_0x21de[_0x1a9a72];return _0x384c5b;};'use strict';var multer=require('multer');var util=require(_0xe21d('0x0'));var path=require(_0xe21d('0x1'));var timeout=require(_0xe21d('0x2'));var express=require(_0xe21d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe21d('0x4'));var config=require(_0xe21d('0x5'));var controller=require('./whatsappInteraction.controller');router[_0xe21d('0x6')]('/',auth[_0xe21d('0x7')](),controller[_0xe21d('0x8')]);router[_0xe21d('0x6')]('/describe',auth[_0xe21d('0x7')](),controller[_0xe21d('0x9')]);router[_0xe21d('0x6')](_0xe21d('0xa'),auth[_0xe21d('0x7')](),controller[_0xe21d('0xb')]);router[_0xe21d('0x6')](_0xe21d('0xc'),auth[_0xe21d('0x7')](),controller[_0xe21d('0xd')]);router[_0xe21d('0x6')]('/:id/download',auth[_0xe21d('0x7')](),controller[_0xe21d('0xe')]);router[_0xe21d('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe21d('0xf')]('/:id/messages',auth['isAuthenticated'](),controller[_0xe21d('0x10')]);router[_0xe21d('0xf')](_0xe21d('0x11'),auth[_0xe21d('0x7')](),interaction[_0xe21d('0x12')](_0xe21d('0x13'),'whatsappinteraction:addtags'),controller[_0xe21d('0x14')]);router[_0xe21d('0x15')](_0xe21d('0xa'),auth[_0xe21d('0x7')](),interaction[_0xe21d('0x12')](_0xe21d('0x13'),_0xe21d('0x16')),controller[_0xe21d('0x17')]);router[_0xe21d('0x18')](_0xe21d('0xa'),auth[_0xe21d('0x7')](),interaction['tracked'](_0xe21d('0x13'),_0xe21d('0x19')),controller[_0xe21d('0x1a')]);router['delete']('/:id/tags',auth[_0xe21d('0x7')](),controller[_0xe21d('0x1b')]);module[_0xe21d('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 9856576..e98fc3e 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 _0x129d=['DATE','STRING','ENUM','out','moment','BOOLEAN'];(function(_0x2b0180,_0x27ae1a){var _0x346a84=function(_0x8c2e27){while(--_0x8c2e27){_0x2b0180['push'](_0x2b0180['shift']());}};_0x346a84(++_0x27ae1a);}(_0x129d,0x1ea));var _0xd129=function(_0x24ec07,_0x3f2b8f){_0x24ec07=_0x24ec07-0x0;var _0x1dfafb=_0x129d[_0x24ec07];return _0x1dfafb;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xd129('0x0'));module['exports']={'closed':{'type':Sequelize[_0xd129('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd129('0x2')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd129('0x3')]},'phone':{'type':Sequelize[_0xd129('0x3')]},'read1stAt':{'type':Sequelize[_0xd129('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd129('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd129('0x4')]('in',_0xd129('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x2bf8=['DATE','ENUM','out','moment','BOOLEAN','STRING'];(function(_0x491468,_0x42f169){var _0x5b8c22=function(_0x407a9b){while(--_0x407a9b){_0x491468['push'](_0x491468['shift']());}};_0x5b8c22(++_0x42f169);}(_0x2bf8,0xbd));var _0x82bf=function(_0x165f14,_0x37c6c1){_0x165f14=_0x165f14-0x0;var _0x217195=_0x2bf8[_0x165f14];return _0x217195;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x82bf('0x0'));module['exports']={'closed':{'type':Sequelize[_0x82bf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x82bf('0x2')]},'note':{'type':Sequelize[_0x82bf('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x82bf('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x82bf('0x4')]('in',_0x82bf('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x82bf('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x82bf('0x4')]('in',_0x82bf('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 98a0750..b29b8d9 100644 --- a/server/api/whatsappInteraction/whatsappInteraction.controller.js +++ b/server/api/whatsappInteraction/whatsappInteraction.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0x199baa,_0x1556c7){var _0x1dbf7e=function(_0x3424ae){while(--_0x3424ae){_0x199baa['push'](_0x199baa['shift']());}};_0x1dbf7e(++_0x1556c7);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc4aa[_0x11005e];return _0x29338f;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file +var _0xc4aa=['status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','fullname','TagIds','Tags','split','push','catch','WhatsappInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','length','getFullTextValue','ContactId','buildExpression','type','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','group','QueryTypes','SELECT','clone','order','journey','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','sequelize','toString','keyBy','fields','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','show','params','include','merge','create','describe','addMessage','WhatsappMessage','ids','getMessages','findOne','YYYY-MM-DD\x20HH:mm:ss','options','findAll','setTags','omit','emit','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','createdAt','secret','WhatsappAccount','Account','get','mkdirSync','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','format','%s\x20#%d','Whatsapp','YYYY-MM-DD','Owner','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','downloadInteraction.html','transcript-','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus'];(function(_0x23e2cb,_0x4ef4fc){var _0x8db1ae=function(_0x5a512c){while(--_0x5a512c){_0x23e2cb['push'](_0x23e2cb['shift']());}};_0x8db1ae(++_0x4ef4fc);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];config[_0xac4a('0x16')]=_[_0xac4a('0x17')](config['redis'],{'host':_0xac4a('0x18'),'port':0x18eb});var socket=require(_0xac4a('0x19'))(new Redis(config[_0xac4a('0x16')]));require(_0xac4a('0x1a'))[_0xac4a('0x1b')](socket);function respondWithStatusCode(_0x3b71c0,_0x34bc01){_0x34bc01=_0x34bc01||0xcc;return function(_0x33c287){if(_0x33c287){return _0x3b71c0[_0xac4a('0x1c')](_0x34bc01);}return _0x3b71c0[_0xac4a('0x1d')](_0x34bc01)[_0xac4a('0x1e')]();};}function respondWithResult(_0x26dbb8,_0x4a2119){_0x4a2119=_0x4a2119||0xc8;return function(_0x402fff){if(_0x402fff){return _0x26dbb8[_0xac4a('0x1d')](_0x4a2119)[_0xac4a('0x1f')](_0x402fff);}};}function respondWithFilteredResult(_0x144553,_0x3e88e3){return function(_0x387a54){if(_0x387a54){var _0x28e304=_0x387a54[_0xac4a('0x20')],_0x44ec59=_0x3e88e3[_0xac4a('0x21')],_0x546c5d=_0x3e88e3[_0xac4a('0x21')]+_0x3e88e3['limit'],_0x5ac21e;if(_0x546c5d>=_0x28e304){_0x546c5d=_0x28e304;_0x5ac21e=0xc8;}else{_0x5ac21e=0xce;}_0x144553[_0xac4a('0x1d')](_0x5ac21e);return _0x144553[_0xac4a('0x22')](_0xac4a('0x23'),_0x44ec59+'-'+_0x546c5d+'/'+_0x28e304)[_0xac4a('0x1f')](_0x387a54);}return null;};}function patchUpdates(_0x123694){return function(_0x3e829c){try{jsonpatch[_0xac4a('0x24')](_0x3e829c,_0x123694,!![]);}catch(_0x3ca790){return BPromise['reject'](_0x3ca790);}return _0x3e829c[_0xac4a('0x25')]();};}function saveUpdates(_0x3204ad,_0x599787){return function(_0x3d7ce0){if(_0x3d7ce0){return _0x3d7ce0[_0xac4a('0x26')](_0x3204ad)[_0xac4a('0x27')](function(_0x947d8e){return _0x947d8e;});}return null;};}function removeEntity(_0x4d2d6c,_0x1b7998){return function(_0x2503d8){if(_0x2503d8){return _0x2503d8[_0xac4a('0x28')]()[_0xac4a('0x27')](function(){_0x4d2d6c[_0xac4a('0x1d')](0xcc)[_0xac4a('0x1e')]();});}};}function handleEntityNotFound(_0x222507,_0x36054a){return function(_0x3e2c69){if(!_0x3e2c69){_0x222507[_0xac4a('0x1c')](0x194);}return _0x3e2c69;};}function handleError(_0x1d0539,_0x215a31){_0x215a31=_0x215a31||0x1f4;return function(_0x14832b){logger[_0xac4a('0x29')](_0x14832b[_0xac4a('0x2a')]);if(_0x14832b[_0xac4a('0x2b')]){delete _0x14832b['name'];}_0x1d0539[_0xac4a('0x1d')](_0x215a31)[_0xac4a('0x2c')](_0x14832b);};}function getInteractionUsers(_0x42a33c,_0x2772fe){return new BPromise(function(_0x116700,_0x4a5a9e){try{if(_0x2772fe[_0x42a33c['id']]){_0x42a33c['Users']=_[_0xac4a('0x2d')](_0x2772fe[_0x42a33c['id']],function(_0x7a948b){return{'id':_0x7a948b['id'],'fullname':_0x7a948b[_0xac4a('0x2e')]};});}}catch(_0x546b65){_0x4a5a9e(_0x546b65);}_0x116700(_0x42a33c);});}function getInteractionTags(_0x4bda1f,_0x355755){return new BPromise(function(_0x2896bc,_0x228629){try{if(_0x4bda1f[_0xac4a('0x2f')]){_0x4bda1f[_0xac4a('0x30')]=[];_0x4bda1f['TagIds'][_0xac4a('0x31')](',')['forEach'](function(_0x30364b){_0x4bda1f['Tags'][_0xac4a('0x32')](_0x355755[_0x30364b]);});}delete _0x4bda1f[_0xac4a('0x2f')];}catch(_0x31501b){_0x228629(_0x31501b);}_0x2896bc(_0x4bda1f);});}function updateWhatsappInteraction(_0x228aa7,_0x34577f,_0x61e552){return new BPromise(function(_0xbd4591,_0x1f13f3){return getInteractionUsers(_0x228aa7,_0x61e552)[_0xac4a('0x27')](function(_0xfd7c16){return getInteractionTags(_0xfd7c16,_0x34577f);})[_0xac4a('0x27')](function(_0x1634df){_0xbd4591(_0x1634df);})[_0xac4a('0x33')](function(_0x1a9d4e){_0x1f13f3(_0x1a9d4e);});});}exports['index']=function(_0x30442d,_0x1c41fb){var _0x5a4e2b={},_0x2a5419={},_0x1af1c1={'count':0x0,'rows':[]};var _0x565164=_['map'](db[_0xac4a('0x34')][_0xac4a('0x35')],function(_0x1b42b6){return{'name':_0x1b42b6[_0xac4a('0x36')],'type':_0x1b42b6['type'][_0xac4a('0x37')]};});_0x2a5419[_0xac4a('0x38')]=_['map'](_0x565164,_0xac4a('0x2b'));_0x2a5419[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x30442d['query']);_0x2a5419[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2a5419[_0xac4a('0x38')],_0x2a5419['query']);_0x5a4e2b[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x2a5419['model'],qs['fields'](_0x30442d[_0xac4a('0x39')]['fields']));_0x5a4e2b['attributes']=_0x5a4e2b['attributes']['length']?_0x5a4e2b[_0xac4a('0x3d')]:_0x2a5419[_0xac4a('0x38')];if(!_0x30442d[_0xac4a('0x39')][_0xac4a('0x3e')](_0xac4a('0x3f'))){_0x5a4e2b[_0xac4a('0x40')]=qs[_0xac4a('0x40')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x40')]);_0x5a4e2b[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x30442d[_0xac4a('0x39')]['offset']);}_0x5a4e2b['order']=qs['sort'](_0x30442d[_0xac4a('0x39')][_0xac4a('0x41')]);_0x5a4e2b[_0xac4a('0x42')]=qs[_0xac4a('0x3b')](_[_0xac4a('0x43')](_0x30442d[_0xac4a('0x39')],_0x2a5419[_0xac4a('0x3b')]),_0x565164);var _0x3441f2=[];var _0x3e9973=squel[_0xac4a('0x44')]()['field']('id')[_0xac4a('0x45')](_0xac4a('0x2b'))[_0xac4a('0x45')](_0xac4a('0x46'))[_0xac4a('0x47')]('tools_tags');var _0x8700b4=squel[_0xac4a('0x44')]()['field'](_0xac4a('0x48'))['field'](_0xac4a('0x49'))[_0xac4a('0x45')](_0xac4a('0x4a'))[_0xac4a('0x47')](_0xac4a('0x4b'),'ui')[_0xac4a('0x4c')](_0xac4a('0x4d'),'u',_0xac4a('0x4e'));var _0x98e0c4=squel[_0xac4a('0x44')]()[_0xac4a('0x47')](_0xac4a('0x4f'),'i')['left_join'](_0xac4a('0x50'),'c',_0xac4a('0x51'))[_0xac4a('0x4c')]('users','o',_0xac4a('0x52'))[_0xac4a('0x4c')]('whatsapp_accounts','a',_0xac4a('0x53'))['left_join'](_0xac4a('0x54'),'me',_0xac4a('0x55'))[_0xac4a('0x4c')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xac4a('0x4c')]('tools_tags','t',_0xac4a('0x56'));var _0x566258=squel[_0xac4a('0x57')]();var _0x530bbb=[];var _0x3be103=squel[_0xac4a('0x57')]();var _0x424f9b;if(_0x30442d[_0xac4a('0x39')]['search']){_0x424f9b=as[_0xac4a('0x58')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x59')]);var _0x1ee454=_0x424f9b[_0xac4a('0x5a')];for(var _0x138876=0x0;_0x138876<_0x424f9b[_0xac4a('0x5b')]['length'];_0x138876++){var _0x35dee5=_0x424f9b[_0xac4a('0x5b')][_0x138876];var _0x4828e3='i';var _0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0x35dee5[_0xac4a('0x45')]]);if(!_0x16afbe){switch(_0x35dee5['field']){case _0xac4a('0x5d'):if(_0x35dee5[_0xac4a('0x5e')]==0x1){_0x98e0c4[_0xac4a('0x5f')]('`'+_0x35dee5[_0xac4a('0x45')]+_0xac4a('0x60'));}else{_0x98e0c4['having']('`'+_0x35dee5[_0xac4a('0x45')]+'`\x20>\x200');}break;case _0xac4a('0x61'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){if(_0x35dee5['value'][_0xac4a('0x31')]('\x20')[_0xac4a('0x63')]>0x1){_0x566258[_0x1ee454]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x35dee5[_0xac4a('0x5e')]),null);}else{var _0x26b582='%'+_0x35dee5[_0xac4a('0x5e')]+'%';_0x566258[_0x1ee454]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x26b582,_0x26b582,_0x26b582);}}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,[_0xac4a('0x2b'),_0xac4a('0x65')]);_0x35dee5[_0xac4a('0x45')]=_0xac4a('0x65');_0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c['text'],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x69'):var _0x2ac1e9=_0x35dee5[_0xac4a('0x5e')][_0xac4a('0x31')](',')[_0xac4a('0x2d')](function(_0x786d9){return Number(_0x786d9);});_0x2ac1e9[_0xac4a('0x6a')](function(_0x38dd4f){_0x3be103['or'](_0xac4a('0x6b'),'%,'+_0x38dd4f+',%');});_0x530bbb=_[_0xac4a('0x6c')](_0x530bbb,_0x2ac1e9);break;case _0xac4a('0x6d'):if(_0x35dee5[_0xac4a('0x62')]==='$substring'){_0x566258[_0x1ee454](_0xac4a('0x6e'),'%'+_0x35dee5['value']+'%',null);}else{_0x16afbe=_[_0xac4a('0x5c')](_0x565164,['name',_0xac4a('0x6f')]);_0x35dee5['field']=_0xac4a('0x6f');_0x19ce2c=as['buildExpression'](_0x4828e3,_0x16afbe['type'],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}break;case _0xac4a('0x71'):_0x19ce2c=as['buildExpression']('me',null,_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c['value'][_0xac4a('0x68')],_0x19ce2c['value'][_0xac4a('0x1e')]);break;}}else{var _0x19ce2c=as[_0xac4a('0x66')](_0x4828e3,_0x16afbe[_0xac4a('0x67')],_0x35dee5);_0x566258[_0x1ee454](_0x19ce2c[_0xac4a('0x70')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x68')],_0x19ce2c[_0xac4a('0x5e')][_0xac4a('0x1e')]);}}}else{var _0x430dd0=_(_0x30442d[_0xac4a('0x39')])[_0xac4a('0x3a')]()[_0xac4a('0x2d')](function(_0x2cc410){return _[_0xac4a('0x72')](_0x565164,[_0xac4a('0x2b'),_0x2cc410])?_0x2cc410:undefined;})[_0xac4a('0x73')]()['value']();if(!_[_0xac4a('0x74')](_0x430dd0)){_0x430dd0[_0xac4a('0x6a')](function(_0x4fb812){if(_0x4fb812===_0xac4a('0x75')){_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),[][_0xac4a('0x77')](_0x30442d[_0xac4a('0x39')][_0x4fb812]));}else if(_0x4fb812==='createdAt'){var _0x47c6d8=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x79')];var _0x148288=JSON[_0xac4a('0x78')](_0x30442d[_0xac4a('0x39')][_0x4fb812])[_0xac4a('0x7a')];_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x7b'),_0x47c6d8,_0x148288);}else{if(_0x30442d[_0xac4a('0x39')][_0x4fb812]===_0xac4a('0x7c')){_0x98e0c4['where']('i.'+_0x4fb812+'\x20IS\x20NULL');}else{_0x98e0c4[_0xac4a('0x42')]('i.'+_0x4fb812+_0xac4a('0x7d'),_0x30442d[_0xac4a('0x39')][_0x4fb812]);}}});}if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x7e')]==0x1){_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x7f'));}else{_0x98e0c4[_0xac4a('0x5f')](_0xac4a('0x80'));}}if(_0x30442d[_0xac4a('0x39')]['tag']){_0x530bbb=_[_0xac4a('0x81')](_0x30442d[_0xac4a('0x39')][_0xac4a('0x82')])?_0x30442d[_0xac4a('0x39')]['tag']:new Array(_0x30442d[_0xac4a('0x39')]['tag']);_0x530bbb[_0xac4a('0x6a')](function(_0x3af39a){_0x3be103['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3af39a+',%');});}if(_0x30442d['query'][_0xac4a('0x83')]){var _0x3b8974=_0x30442d[_0xac4a('0x39')]['filter'][_0xac4a('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0xac4a('0x85'));if(qs['isNumeric'](_0x3b8974)){_0x566258['or']('i.id\x20LIKE\x20?',_0x3b8974+'%')['or'](_0xac4a('0x86'),_0x3b8974+'%');}else{_0x566258['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xac4a('0x64')](_0x3b8974))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3b8974+'%');}}}_0x98e0c4[_0xac4a('0x42')](_0x566258);_0x98e0c4[_0xac4a('0x87')]('i.id');var _0x3980ae={'type':db['Sequelize'][_0xac4a('0x88')][_0xac4a('0x89')],'raw':!![]};var _0x522949=_0x98e0c4[_0xac4a('0x8a')]();_0x522949['field']('i.id');_0x522949[_0xac4a('0x45')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xac4a('0x5d'));if(_0x5a4e2b['order']){_0x5a4e2b['order'][_0xac4a('0x6a')](function(_0x4065c0){_0x98e0c4[_0xac4a('0x8b')]('i.'+_0x4065c0[0x0],_0x4065c0[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x530bbb)){_0x98e0c4[_0xac4a('0x5f')](_0x3be103);_0x522949[_0xac4a('0x42')]('t.id\x20IN\x20?',_0x530bbb);}BPromise['resolve']()[_0xac4a('0x27')](function(){if(!_0x424f9b){if(_0x30442d[_0xac4a('0x39')][_0xac4a('0x75')]||_0x30442d[_0xac4a('0x39')][_0xac4a('0x8c')])return;_0x522949[_0xac4a('0x42')](_0xac4a('0x8d'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8d'));return;}return _0x30442d['user'][_0xac4a('0x8e')]({'attributes':['id'],'raw':!![]})[_0xac4a('0x27')](function(_0x3ba61e){if(_['isEmpty'](_0x3ba61e)){_0x522949[_0xac4a('0x42')](_0xac4a('0x8f'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x8f'));}else{_0x522949[_0xac4a('0x42')]('i.WhatsappAccountId\x20IN\x20?',_[_0xac4a('0x2d')](_0x3ba61e,'id'));_0x98e0c4[_0xac4a('0x42')](_0xac4a('0x76'),_[_0xac4a('0x2d')](_0x3ba61e,'id'));}});})[_0xac4a('0x27')](function(){db[_0xac4a('0x90')][_0xac4a('0x39')](_0x522949['toString'](),_0x3980ae)[_0xac4a('0x27')](function(_0x2be178){_0x1af1c1[_0xac4a('0x20')]=_0x2be178[_0xac4a('0x63')];if(_0x1af1c1[_0xac4a('0x20')]===0x0)return[];return db[_0xac4a('0x90')]['query'](_0x3e9973[_0xac4a('0x91')](),_0x3980ae)[_0xac4a('0x27')](function(_0x1b9a33){_0x3441f2=_[_0xac4a('0x92')](_0x1b9a33,'id');_0x3980ae=_['merge'](_0x3980ae,{'model':db[_0xac4a('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x30442d['query'][_0xac4a('0x93')]){_0x5a4e2b[_0xac4a('0x3d')]['forEach'](function(_0x5b95ab){_0x98e0c4[_0xac4a('0x45')]('i.'+_0x5b95ab);});}else{_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x94'),'unreadMessages');_0x98e0c4[_0xac4a('0x45')]('a.key',_0xac4a('0x95'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x96'),_0xac4a('0x97'));_0x98e0c4[_0xac4a('0x45')]('i.*');_0x98e0c4['field'](_0xac4a('0x98'),_0xac4a('0x99'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9a'),_0xac4a('0x9b'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9c'),_0xac4a('0x9d'));_0x98e0c4['field']('c.phone',_0xac4a('0x9e'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0x9f'),_0xac4a('0xa0'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa1'),_0xac4a('0xa2'));_0x98e0c4[_0xac4a('0x45')]('o.fullname','Owner.fullname');_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa3'),_0xac4a('0xa4'));_0x98e0c4[_0xac4a('0x45')](_0xac4a('0xa5'),_0xac4a('0x2f'));}if(_0x5a4e2b[_0xac4a('0x40')])_0x98e0c4['limit'](_0x5a4e2b[_0xac4a('0x40')]);if(_0x5a4e2b[_0xac4a('0x21')])_0x98e0c4[_0xac4a('0x21')](_0x5a4e2b['offset']);return db[_0xac4a('0x90')][_0xac4a('0x39')](_0x98e0c4[_0xac4a('0x91')](),_0x3980ae);})[_0xac4a('0x27')](function(_0x1a7448){_0x8700b4[_0xac4a('0x42')](_0xac4a('0xa6'),_[_0xac4a('0x2d')](_0x1a7448,'id'));return db[_0xac4a('0x90')]['query'](_0x8700b4[_0xac4a('0x91')](),_0x3980ae)['then'](function(_0x203321){var _0x1199f6=_[_0xac4a('0xa7')](_0x203321,_0xac4a('0xa8'));var _0x840fec=[];_0x1a7448[_0xac4a('0x6a')](function(_0x19766a){_0x840fec['push'](updateWhatsappInteraction(_0x19766a,_0x3441f2,_0x1199f6));});return BPromise[_0xac4a('0xa9')](_0x840fec);});});})[_0xac4a('0x27')](function(_0x279f9b){_0x1af1c1[_0xac4a('0xaa')]=_0x279f9b;return _0x1af1c1;})[_0xac4a('0x27')](respondWithFilteredResult(_0x1c41fb,_0x5a4e2b));})['catch'](handleError(_0x1c41fb,null));};exports[_0xac4a('0xab')]=function(_0x360d4f,_0x4f2b19){var _0x55af32={'raw':![],'where':{'id':_0x360d4f[_0xac4a('0xac')]['id']}},_0x386d6d={};_0x386d6d['model']=_[_0xac4a('0x3a')](db[_0xac4a('0x34')][_0xac4a('0x35')]);_0x386d6d[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x360d4f[_0xac4a('0x39')]);_0x386d6d['filters']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],_0x386d6d[_0xac4a('0x39')]);_0x55af32['attributes']=_[_0xac4a('0x3c')](_0x386d6d[_0xac4a('0x38')],qs[_0xac4a('0x93')](_0x360d4f[_0xac4a('0x39')][_0xac4a('0x93')]));_0x55af32[_0xac4a('0x3d')]=_0x55af32['attributes'][_0xac4a('0x63')]?_0x55af32[_0xac4a('0x3d')]:_0x386d6d['model'];if(_0x360d4f[_0xac4a('0x39')]['includeAll']){_0x55af32[_0xac4a('0xad')]=[{'all':!![]}];}_0x55af32=_[_0xac4a('0xae')]({},_0x55af32,_0x360d4f['options']);return db[_0xac4a('0x34')]['find'](_0x55af32)[_0xac4a('0x27')](handleEntityNotFound(_0x4f2b19,null))['then'](respondWithResult(_0x4f2b19,null))[_0xac4a('0x33')](handleError(_0x4f2b19,null));};exports[_0xac4a('0xaf')]=function(_0x24f464,_0xfe8977){return db[_0xac4a('0x34')][_0xac4a('0xaf')](_0x24f464[_0xac4a('0x71')],{})[_0xac4a('0x27')](respondWithResult(_0xfe8977,0xc9))[_0xac4a('0x33')](handleError(_0xfe8977,null));};exports[_0xac4a('0x26')]=function(_0x3a0163,_0x455eb7){if(_0x3a0163[_0xac4a('0x71')]['id']){delete _0x3a0163[_0xac4a('0x71')]['id'];}return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x3a0163[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x455eb7,null))[_0xac4a('0x27')](saveUpdates(_0x3a0163[_0xac4a('0x71')],null))[_0xac4a('0x27')](respondWithResult(_0x455eb7,null))[_0xac4a('0x33')](handleError(_0x455eb7,null));};exports[_0xac4a('0x28')]=function(_0x5d5bb3,_0x101137){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x5d5bb3[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x101137,null))[_0xac4a('0x27')](removeEntity(_0x101137,null))['catch'](handleError(_0x101137,null));};exports[_0xac4a('0xb0')]=function(_0x55866d,_0x277fd1){return db[_0xac4a('0x34')][_0xac4a('0xb0')]()['then'](respondWithResult(_0x277fd1,null))[_0xac4a('0x33')](handleError(_0x277fd1,null));};exports[_0xac4a('0xb1')]=function(_0x127ede,_0x52f3f2,_0x2da95f){return db[_0xac4a('0xb2')][_0xac4a('0x5c')]({'where':{'id':_0x127ede[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x52f3f2,null))[_0xac4a('0x27')](function(_0x3b4183){if(_0x3b4183){return _0x3b4183[_0xac4a('0xb1')](_0x127ede['body'][_0xac4a('0xb3')],_['omit'](_0x127ede['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x52f3f2,null))['catch'](handleError(_0x52f3f2,null));};exports[_0xac4a('0xb4')]=function(_0x58fcb0,_0xc014a6,_0x377444){var _0x2132b2={'raw':![],'where':{}};var _0x525d50={};var _0x9ea4d1={'count':0x0,'rows':[]};return db[_0xac4a('0x34')][_0xac4a('0xb5')]({'where':{'id':_0x58fcb0[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0xc014a6,null))[_0xac4a('0x27')](function(_0x7a1b25){if(_0x7a1b25){_0x525d50[_0xac4a('0x38')]=_['keys'](db[_0xac4a('0xb2')][_0xac4a('0x35')]);_0x525d50[_0xac4a('0x39')]=_[_0xac4a('0x3a')](_0x58fcb0[_0xac4a('0x39')]);_0x525d50[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x525d50['model'],_0x525d50['query']);_0x2132b2[_0xac4a('0x3d')]=_[_0xac4a('0x3c')](_0x525d50['model'],qs[_0xac4a('0x93')](_0x58fcb0[_0xac4a('0x39')]['fields']));_0x2132b2['attributes']=_0x2132b2[_0xac4a('0x3d')][_0xac4a('0x63')]?_0x2132b2[_0xac4a('0x3d')]:_0x525d50[_0xac4a('0x38')];if(!_0x58fcb0[_0xac4a('0x39')]['hasOwnProperty'](_0xac4a('0x3f'))){_0x2132b2['limit']=qs['limit'](_0x58fcb0['query'][_0xac4a('0x40')]);_0x2132b2[_0xac4a('0x21')]=qs[_0xac4a('0x21')](_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x21')]);}_0x2132b2[_0xac4a('0x8b')]=qs[_0xac4a('0x41')](_0x58fcb0[_0xac4a('0x39')]['sort']);_0x2132b2['where']=qs['filters'](_[_0xac4a('0x43')](_0x58fcb0[_0xac4a('0x39')],_0x525d50[_0xac4a('0x3b')]));_0x2132b2[_0xac4a('0x42')][_0xac4a('0xa8')]=_0x7a1b25['id'];if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]){_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],{'$or':_[_0xac4a('0x2d')](_0x2132b2[_0xac4a('0x3d')],function(_0xe0fd57){var _0x32b013={};_0x32b013[_0xe0fd57]={'$like':'%'+_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x83')]+'%'};return _0x32b013;})});}if(_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')]){var _0x41cdb5=_0x58fcb0[_0xac4a('0x39')][_0xac4a('0x79')][_0xac4a('0x31')](',');var _0x3e2575={};_0x3e2575[_0x41cdb5[0x0]]={'$gte':moment(_0x41cdb5[0x1])['format'](_0xac4a('0xb6'))};_0x2132b2[_0xac4a('0x42')]=_[_0xac4a('0xae')](_0x2132b2[_0xac4a('0x42')],_0x3e2575);}_0x2132b2=_[_0xac4a('0xae')]({},_0x2132b2,_0x58fcb0[_0xac4a('0xb7')]);return db[_0xac4a('0xb2')][_0xac4a('0x20')]({'where':_0x2132b2['where']})['then'](function(_0x113f80){_0x9ea4d1[_0xac4a('0x20')]=_0x113f80;if(_0x58fcb0[_0xac4a('0x39')]['includeAll']){_0x2132b2['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xac4a('0xb8')](_0x2132b2);})['then'](function(_0x59e82c){_0x9ea4d1[_0xac4a('0xaa')]=_0x59e82c;return _0x9ea4d1;});}})['then'](respondWithFilteredResult(_0xc014a6,_0x2132b2))[_0xac4a('0x33')](handleError(_0xc014a6,null));};exports['addTags']=function(_0x3f95a4,_0x2b4f28,_0x413f5f){return db[_0xac4a('0x34')][_0xac4a('0x5c')]({'where':{'id':_0x3f95a4[_0xac4a('0xac')]['id']}})['then'](handleEntityNotFound(_0x2b4f28,null))[_0xac4a('0x27')](function(_0x34b6d7){if(_0x34b6d7){return _0x34b6d7[_0xac4a('0xb9')](_0x3f95a4['body'][_0xac4a('0xb3')],_[_0xac4a('0xba')](_0x3f95a4[_0xac4a('0x71')],[_0xac4a('0xb3'),'id'])||{})['spread'](function(){return db[_0xac4a('0x69')][_0xac4a('0xb8')]({'attributes':['id',_0xac4a('0x2b'),_0xac4a('0x46')],'where':{'id':_0x3f95a4[_0xac4a('0x71')][_0xac4a('0xb3')]}});})['then'](function(_0x57d3cd){socket[_0xac4a('0xbb')](_0xac4a('0xbc'),{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]});return{'id':Number(_0x3f95a4[_0xac4a('0xac')]['id']),'tags':_0x57d3cd||[]};});}})[_0xac4a('0x27')](respondWithResult(_0x2b4f28,null))[_0xac4a('0x33')](handleError(_0x2b4f28,null));};exports['removeTags']=function(_0x21a6f6,_0x580c9b,_0xe4165d){return db['WhatsappInteraction'][_0xac4a('0x5c')]({'where':{'id':_0x21a6f6[_0xac4a('0xac')]['id']}})[_0xac4a('0x27')](handleEntityNotFound(_0x580c9b,null))[_0xac4a('0x27')](function(_0x5650ce){if(_0x5650ce){return _0x5650ce[_0xac4a('0xbd')](_0x21a6f6[_0xac4a('0x39')][_0xac4a('0xb3')]);}})[_0xac4a('0x27')](respondWithStatusCode(_0x580c9b,null))[_0xac4a('0x33')](handleError(_0x580c9b,null));};exports['download']=function(_0x3dd60a,_0xbe1958){var _0x462964=moment()[_0xac4a('0xbe')]()[_0xac4a('0x91')]();var _0x5e5eb1=path[_0xac4a('0xbf')](config[_0xac4a('0xc0')],_0xac4a('0xc1'),_0xac4a('0xc2'),_0xac4a('0xc3'));var _0x55ccc3=path['join'](config['root'],'server',_0xac4a('0xc2'),_0xac4a('0xc4'));var _0x17f815=path[_0xac4a('0xbf')](_0x5e5eb1,_0x462964);var _0xa8b5bb=util['format'](_0xac4a('0xc5'),_0x3dd60a[_0xac4a('0xac')]['id'],_0x462964);var _0x5aad90=path[_0xac4a('0xbf')](_0x5e5eb1,_0xa8b5bb);var _0x14b425=[];_0x14b425[_0xac4a('0x32')]({'model':db['User'],'as':_0xac4a('0x6d'),'attributes':['id',_0xac4a('0x2e')],'raw':!![]});_0x14b425[_0xac4a('0x32')]({'model':db[_0xac4a('0xc6')],'as':_0xac4a('0x61'),'attributes':['id',_0xac4a('0xc7'),_0xac4a('0xc8')],'raw':!![]});if(_0x3dd60a[_0xac4a('0x39')][_0xac4a('0xc4')]){_0x14b425['push']({'model':db[_0xac4a('0xc9')],'as':_0xac4a('0xc9'),'raw':!![]});}var _0x579181=[{'model':db[_0xac4a('0xb2')],'as':'Messages','attributes':['id',_0xac4a('0x71'),_0xac4a('0xca'),'direction',_0xac4a('0xcb'),_0xac4a('0x7e')],'include':_0x14b425}];_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0xcc')],'as':_0xac4a('0xcd'),'attributes':['id',_0xac4a('0x2b')]});_0x579181[_0xac4a('0x32')]({'model':db[_0xac4a('0x6d')],'as':'Owner','attributes':['id','fullname']});return db[_0xac4a('0x34')]['find']({'where':{'id':_0x3dd60a['params']['id']},'include':_0x579181})[_0xac4a('0x27')](handleEntityNotFound(_0xbe1958,null))[_0xac4a('0x27')](function(_0x3254c3){if(_0x3254c3){var _0x516225=_0x3254c3[_0xac4a('0xce')]({'plain':!![]});fs[_0xac4a('0xcf')](_0x17f815);var _0x5a2abf={'format':'A4','border':'10px','header':{'height':_0xac4a('0xd0'),'contents':{'first':_0xac4a('0xd1')}},'footer':{'height':_0xac4a('0xd2'),'contents':{'default':util[_0xac4a('0xd3')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0xac4a('0xd3')](_0xac4a('0xd4'),_0xac4a('0xd5'),_0x516225['id']),moment()['format'](_0xac4a('0xd6'))[_0xac4a('0x91')]())}}};var _0x15b97a={'channel':_0xac4a('0xd5'),'account':_0x516225[_0xac4a('0xcd')]['name'],'agent':_0x516225['Owner']?_0x516225[_0xac4a('0xd7')][_0xac4a('0x2e')]:_0xac4a('0xd8'),'createdAt':moment(_0x516225[_0xac4a('0xca')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')](),'closedAt':_0x516225[_0xac4a('0xd9')]?moment(_0x516225[_0xac4a('0xda')])[_0xac4a('0xd3')](_0xac4a('0xb6'))[_0xac4a('0x91')]():'','disposition':_0x516225[_0xac4a('0xdb')],'messages':_(_0x516225['Messages'])[_0xac4a('0x83')]({'secret':![]})['map'](function(_0x4ec2c3){if(_0x4ec2c3[_0xac4a('0xc9')]){var _0x27833a=path[_0xac4a('0xbf')](_0x55ccc3,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]);if(fs[_0xac4a('0xdd')](_0x27833a)){fs[_0xac4a('0xde')](_0x27833a)[_0xac4a('0xdf')](fs[_0xac4a('0xe0')](path['join'](_0x17f815,_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')])));}}return{'date':moment(_0x4ec2c3[_0xac4a('0xca')])[_0xac4a('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x4ec2c3[_0xac4a('0xe1')]===_0xac4a('0xe2')?_0x4ec2c3[_0xac4a('0x6d')]?_0x4ec2c3[_0xac4a('0x6d')][_0xac4a('0x2e')]:_0xac4a('0xe3'):_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc7')]+(_0x4ec2c3[_0xac4a('0x61')]['lastName']?'\x20'+_0x4ec2c3[_0xac4a('0x61')][_0xac4a('0xc8')]:''),'body':_0x4ec2c3[_0xac4a('0xc9')]?_0x4ec2c3[_0xac4a('0xc9')][_0xac4a('0xdc')]:_0x4ec2c3[_0xac4a('0x71')],'direction':_0x4ec2c3['direction']==='out'?'A':'C','secret':_0x4ec2c3['secret'],'read':_0x4ec2c3[_0xac4a('0x7e')],'attachment':_0x4ec2c3[_0xac4a('0xc9')]};})['value']()};return ejs['renderFile'](path[_0xac4a('0xbf')](config['root'],_0xac4a('0xc1'),'views',_0xac4a('0xe4')),{'interaction':_0x15b97a})[_0xac4a('0x27')](function(_0x1888c3){return new BPromise(function(_0x4a04c3,_0x14435d){pdf[_0xac4a('0xaf')](_0x1888c3,_0x5a2abf)['toFile'](path[_0xac4a('0xbf')](_0x17f815,_0xac4a('0xe5')+_0x516225['id']+'-'+_0x462964+'.pdf'),function(_0x48a75c,_0x4514a5){if(_0x48a75c)return _0x14435d(_0x48a75c);_0x4a04c3(_0x4514a5);});});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x43df37,_0x45e45b){zipdir(_0x17f815,{'saveTo':_0x5aad90},function(_0x367254,_0x22cc71){if(_0x367254)return _0x45e45b(_0x367254);return _0x43df37(_0x22cc71);});})[_0xac4a('0x27')](function(){return new BPromise(function(_0x1ea4ef,_0x156b67){rimraf(_0x17f815,function(_0x330070){if(_0x330070)_0x156b67(_0x330070);return _0x1ea4ef();});});})[_0xac4a('0x27')](function(){return _0xbe1958[_0xac4a('0xe6')](_0x5aad90,_0xa8b5bb,function(_0x2d755c){if(_0x2d755c){console[_0xac4a('0xe7')](_0xac4a('0xe8'),_0x2d755c);}else{fs[_0xac4a('0xe9')](_0x5aad90);}});});});}else{return _0xbe1958[_0xac4a('0x1c')](0xc8);}})['catch'](handleError(_0xbe1958,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index b1d86b1..66157ed 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 _0xf441=['emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','remove','then','setDataValue','Users','findAll','unreadMessages'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xf441,0xf4));var _0x1f44=function(_0x1b8524,_0x1bb669){_0x1b8524=_0x1b8524-0x0;var _0x81418d=_0xf441[_0x1b8524];return _0x81418d;};'use strict';var EventEmitter=require(_0x1f44('0x0'));var WhatsappInteraction=require(_0x1f44('0x1'))['db'][_0x1f44('0x2')];var WhatsappMessage=require(_0x1f44('0x1'))['db'][_0x1f44('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1f44('0x4'),'afterUpdate':'update','afterDestroy':_0x1f44('0x5')};function emitEvent(_0x34f249){return function(_0x4e5b8a,_0x392228,_0x21155c){_0x4e5b8a['getUsers']({'attributes':['id'],'raw':!![]})[_0x1f44('0x6')](function(_0x3f63fe){_0x4e5b8a[_0x1f44('0x7')](_0x1f44('0x8'),_0x3f63fe['map'](function(_0x35436c){return{'id':_0x35436c['id']};}));return WhatsappMessage[_0x1f44('0x9')]({'where':{'WhatsappInteractionId':_0x4e5b8a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1f44('0x6')](function(_0x1a4654){_0x4e5b8a[_0x1f44('0x7')](_0x1f44('0xa'),_0x1a4654['length']);WhatsappInteractionEvents[_0x1f44('0xb')](_0x34f249+':'+_0x4e5b8a['id'],_0x4e5b8a);WhatsappInteractionEvents['emit'](_0x34f249,_0x4e5b8a);_0x21155c(null);})[_0x1f44('0xc')](_0x21155c(null));};}for(var e in events){if(events[_0x1f44('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x1f44('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x6d25=['getUsers','setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','save','update'];(function(_0x21ca0d,_0x4528dc){var _0x1ec200=function(_0x549018){while(--_0x549018){_0x21ca0d['push'](_0x21ca0d['shift']());}};_0x1ec200(++_0x4528dc);}(_0x6d25,0x15a));var _0x56d2=function(_0x27a023,_0x51a0cd){_0x27a023=_0x27a023-0x0;var _0x321313=_0x6d25[_0x27a023];return _0x321313;};'use strict';var EventEmitter=require(_0x56d2('0x0'));var WhatsappInteraction=require(_0x56d2('0x1'))['db'][_0x56d2('0x2')];var WhatsappMessage=require(_0x56d2('0x1'))['db'][_0x56d2('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x56d2('0x4'),'afterUpdate':_0x56d2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x332f35){return function(_0x3e8f47,_0x435186,_0x44e7ee){_0x3e8f47[_0x56d2('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x330e7e){_0x3e8f47[_0x56d2('0x7')](_0x56d2('0x8'),_0x330e7e[_0x56d2('0x9')](function(_0x4a4bcd){return{'id':_0x4a4bcd['id']};}));return WhatsappMessage[_0x56d2('0xa')]({'where':{'WhatsappInteractionId':_0x3e8f47['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3c6163){_0x3e8f47[_0x56d2('0x7')]('unreadMessages',_0x3c6163[_0x56d2('0xb')]);WhatsappInteractionEvents[_0x56d2('0xc')](_0x332f35+':'+_0x3e8f47['id'],_0x3e8f47);WhatsappInteractionEvents[_0x56d2('0xc')](_0x332f35,_0x3e8f47);_0x44e7ee(null);})[_0x56d2('0xd')](_0x44e7ee(null));};}for(var e in events){if(events[_0x56d2('0xe')](e)){var event=events[e];WhatsappInteraction[_0x56d2('0xf')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 3fc9e04..7b4095c 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 _0xf481=['exports','define','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x41878d,_0x26905e){var _0x52306e=function(_0x53138d){while(--_0x53138d){_0x41878d['push'](_0x41878d['shift']());}};_0x52306e(++_0x26905e);}(_0xf481,0x107));var _0x1f48=function(_0xb17208,_0x16f568){_0xb17208=_0xb17208-0x0;var _0x160444=_0xf481[_0xb17208];return _0x160444;};'use strict';var _=require('lodash');var util=require(_0x1f48('0x0'));var logger=require(_0x1f48('0x1'))(_0x1f48('0x2'));var moment=require(_0x1f48('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f48('0x4'));var fs=require('fs');var path=require(_0x1f48('0x5'));var rimraf=require(_0x1f48('0x6'));var config=require(_0x1f48('0x7'));var attributes=require(_0x1f48('0x8'));module[_0x1f48('0x9')]=function(_0x5029f7,_0xa8a9f0){return _0x5029f7[_0x1f48('0xa')]('WhatsappInteraction',attributes,{'tableName':_0x1f48('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40f12f,_0x20641a,_0xaec99c){if(_0x40f12f[_0x1f48('0xc')](_0x1f48('0xd'))){_0x40f12f['closedAt']=moment()[_0x1f48('0xe')](_0x1f48('0xf'));}_0xaec99c(null,_0x40f12f);}}});}; \ No newline at end of file +var _0x8eec=['lodash','util','api','moment','request-promise','path','rimraf','exports','define','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x55e58c,_0x5278e9){var _0x32ce31=function(_0x4098d2){while(--_0x4098d2){_0x55e58c['push'](_0x55e58c['shift']());}};_0x32ce31(++_0x5278e9);}(_0x8eec,0x12b));var _0xc8ee=function(_0x581f94,_0x51913c){_0x581f94=_0x581f94-0x0;var _0x1f7f3c=_0x8eec[_0x581f94];return _0x1f7f3c;};'use strict';var _=require(_0xc8ee('0x0'));var util=require(_0xc8ee('0x1'));var logger=require('../../config/logger')(_0xc8ee('0x2'));var moment=require(_0xc8ee('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8ee('0x4'));var fs=require('fs');var path=require(_0xc8ee('0x5'));var rimraf=require(_0xc8ee('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0xc8ee('0x7')]=function(_0x2a0ebd,_0x19a4f7){return _0x2a0ebd[_0xc8ee('0x8')]('WhatsappInteraction',attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1fe68f,_0xc679fa,_0x438cfa){if(_0x1fe68f[_0xc8ee('0x9')](_0xc8ee('0xa'))){_0x1fe68f['closedAt']=moment()[_0xc8ee('0xb')](_0xc8ee('0xc'));}_0x438cfa(null,_0x1fe68f);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 34b101e..5384d87 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 _0x8cbc=['addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToWhatsappInteraction'];(function(_0x5f313e,_0x4a7c0c){var _0x1f353a=function(_0x34ad24){while(--_0x34ad24){_0x5f313e['push'](_0x5f313e['shift']());}};_0x1f353a(++_0x4a7c0c);}(_0x8cbc,0x132));var _0xc8cb=function(_0x58235e,_0xbfe9ff){_0x58235e=_0x58235e-0x0;var _0x167446=_0x8cbc[_0x58235e];return _0x167446;};'use strict';var _=require(_0xc8cb('0x0'));var util=require('util');var moment=require(_0xc8cb('0x1'));var BPromise=require(_0xc8cb('0x2'));var rs=require(_0xc8cb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8cb('0x4'))['db'];var utils=require(_0xc8cb('0x5'));var logger=require(_0xc8cb('0x6'))(_0xc8cb('0x7'));var config=require('../../config/environment');var jayson=require(_0xc8cb('0x8'));var client=jayson[_0xc8cb('0x9')][_0xc8cb('0xa')]({'port':0x232a});config[_0xc8cb('0xb')]=_[_0xc8cb('0xc')](config['redis'],{'host':_0xc8cb('0xd'),'port':0x18eb});var socket=require(_0xc8cb('0xe'))(new Redis(config[_0xc8cb('0xb')]));require('./whatsappInteraction.socket')[_0xc8cb('0xf')](socket);function respondWithRpcPromise(_0x3fc994,_0x444c14,_0x270f81){return new BPromise(function(_0x425e5a,_0x4e56c){return client[_0xc8cb('0x10')](_0x3fc994,_0x270f81)[_0xc8cb('0x11')](function(_0x2b2ca1){logger[_0xc8cb('0x12')](_0xc8cb('0x13'),_0x444c14,_0xc8cb('0x14'));logger[_0xc8cb('0x15')](_0xc8cb('0x16'),_0x444c14,_0xc8cb('0x14'),JSON['stringify'](_0x2b2ca1));if(_0x2b2ca1[_0xc8cb('0x17')]){if(_0x2b2ca1[_0xc8cb('0x17')][_0xc8cb('0x18')]===0x1f4){logger[_0xc8cb('0x17')](_0xc8cb('0x13'),_0x444c14,_0x2b2ca1[_0xc8cb('0x17')][_0xc8cb('0x19')]);return _0x4e56c(_0x2b2ca1[_0xc8cb('0x17')][_0xc8cb('0x19')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x444c14,_0x2b2ca1[_0xc8cb('0x17')][_0xc8cb('0x19')]);return _0x425e5a(_0x2b2ca1[_0xc8cb('0x17')][_0xc8cb('0x19')]);}else{logger[_0xc8cb('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x444c14,'request\x20sent');_0x425e5a(_0x2b2ca1['result'][_0xc8cb('0x19')]);}})[_0xc8cb('0x1a')](function(_0x1ba979){logger['error'](_0xc8cb('0x13'),_0x444c14,_0x1ba979);_0x4e56c(_0x1ba979);});});}exports[_0xc8cb('0x1b')]=function(_0x54e3d7){var _0x29e391=this;return new Promise(function(_0x97a599,_0x5843a7){return db[_0xc8cb('0x1c')][_0xc8cb('0x1d')](_0x54e3d7[_0xc8cb('0x1e')],{'raw':_0x54e3d7[_0xc8cb('0x1f')]?_0x54e3d7['options'][_0xc8cb('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54e3d7[_0xc8cb('0x1f')]?_0x54e3d7[_0xc8cb('0x1f')][_0xc8cb('0x21')]||null:null,'attributes':_0x54e3d7[_0xc8cb('0x1f')]?_0x54e3d7[_0xc8cb('0x1f')][_0xc8cb('0x22')]||null:null,'limit':_0x54e3d7[_0xc8cb('0x1f')]?_0x54e3d7[_0xc8cb('0x1f')][_0xc8cb('0x23')]||null:null})[_0xc8cb('0x11')](function(_0x2ffbe0){logger[_0xc8cb('0x12')](_0xc8cb('0x1b'),_0x54e3d7);logger['debug'](_0xc8cb('0x1b'),_0x54e3d7,JSON[_0xc8cb('0x24')](_0x2ffbe0));_0x97a599(_0x2ffbe0);})[_0xc8cb('0x1a')](function(_0x16c844){logger['error'](_0xc8cb('0x1b'),_0x16c844[_0xc8cb('0x19')],_0x54e3d7);_0x5843a7(_0x29e391['error'](0x1f4,_0x16c844['message']));});});};exports[_0xc8cb('0x25')]=function(_0xba6718){return new Promise(function(_0x6c01e3,_0x3ef3a3){return db[_0xc8cb('0x1c')]['find']({'where':_0xba6718[_0xc8cb('0x1f')]?_0xba6718[_0xc8cb('0x1f')][_0xc8cb('0x21')]||null:null})[_0xc8cb('0x11')](function(_0x18cde5){if(_0x18cde5){return _0x18cde5[_0xc8cb('0x26')](_0xba6718[_0xc8cb('0x1e')][_0xc8cb('0x27')],_[_0xc8cb('0x28')](_0xba6718['body'],[_0xc8cb('0x27'),'id'])||{});}})[_0xc8cb('0x29')](function(_0x200971){logger[_0xc8cb('0x12')]('AddTags',_0xba6718);logger[_0xc8cb('0x15')](_0xc8cb('0x2a'),_0xba6718,JSON[_0xc8cb('0x24')](_0x200971));_0x6c01e3(_0x200971);})[_0xc8cb('0x1a')](function(_0x52aff5){logger[_0xc8cb('0x17')](_0xc8cb('0x2a'),_0x52aff5[_0xc8cb('0x19')],_0xba6718);_0x3ef3a3(_this[_0xc8cb('0x17')](0x1f4,_0x52aff5[_0xc8cb('0x19')]));});});}; \ No newline at end of file +var _0xed76=['then','info','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','limit','debug','AddTagsToWhatsappInteraction','where','ids','omit','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register'];(function(_0x37d767,_0x1a6590){var _0x2bd99d=function(_0x1933e9){while(--_0x1933e9){_0x37d767['push'](_0x37d767['shift']());}};_0x2bd99d(++_0x1a6590);}(_0xed76,0x16d));var _0x6ed7=function(_0x1ab96f,_0x2120f1){_0x1ab96f=_0x1ab96f-0x0;var _0x5efbe2=_0xed76[_0x1ab96f];return _0x5efbe2;};'use strict';var _=require(_0x6ed7('0x0'));var util=require('util');var moment=require(_0x6ed7('0x1'));var BPromise=require(_0x6ed7('0x2'));var rs=require(_0x6ed7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ed7('0x4'))['db'];var utils=require(_0x6ed7('0x5'));var logger=require(_0x6ed7('0x6'))('rpc');var config=require(_0x6ed7('0x7'));var jayson=require(_0x6ed7('0x8'));var client=jayson['client'][_0x6ed7('0x9')]({'port':0x232a});config[_0x6ed7('0xa')]=_['defaults'](config[_0x6ed7('0xa')],{'host':_0x6ed7('0xb'),'port':0x18eb});var socket=require(_0x6ed7('0xc'))(new Redis(config['redis']));require(_0x6ed7('0xd'))[_0x6ed7('0xe')](socket);function respondWithRpcPromise(_0x4318e5,_0x4566f1,_0x2c248c){return new BPromise(function(_0x59632b,_0x151a0b){return client['request'](_0x4318e5,_0x2c248c)[_0x6ed7('0xf')](function(_0x4c7631){logger[_0x6ed7('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x4566f1,'request\x20sent');logger['debug'](_0x6ed7('0x11'),_0x4566f1,_0x6ed7('0x12'),JSON[_0x6ed7('0x13')](_0x4c7631));if(_0x4c7631[_0x6ed7('0x14')]){if(_0x4c7631[_0x6ed7('0x14')]['code']===0x1f4){logger[_0x6ed7('0x14')](_0x6ed7('0x15'),_0x4566f1,_0x4c7631[_0x6ed7('0x14')]['message']);return _0x151a0b(_0x4c7631['error'][_0x6ed7('0x16')]);}logger[_0x6ed7('0x14')](_0x6ed7('0x15'),_0x4566f1,_0x4c7631[_0x6ed7('0x14')][_0x6ed7('0x16')]);return _0x59632b(_0x4c7631[_0x6ed7('0x14')][_0x6ed7('0x16')]);}else{logger[_0x6ed7('0x10')](_0x6ed7('0x15'),_0x4566f1,'request\x20sent');_0x59632b(_0x4c7631[_0x6ed7('0x17')][_0x6ed7('0x16')]);}})[_0x6ed7('0x18')](function(_0x49eaed){logger[_0x6ed7('0x14')](_0x6ed7('0x15'),_0x4566f1,_0x49eaed);_0x151a0b(_0x49eaed);});});}exports[_0x6ed7('0x19')]=function(_0x529a9f){var _0x3c1df4=this;return new Promise(function(_0x156bbf,_0x34cc4c){return db[_0x6ed7('0x1a')][_0x6ed7('0x1b')](_0x529a9f[_0x6ed7('0x1c')],{'raw':_0x529a9f[_0x6ed7('0x1d')]?_0x529a9f[_0x6ed7('0x1d')][_0x6ed7('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529a9f['options']?_0x529a9f[_0x6ed7('0x1d')]['where']||null:null,'attributes':_0x529a9f[_0x6ed7('0x1d')]?_0x529a9f['options']['attributes']||null:null,'limit':_0x529a9f['options']?_0x529a9f[_0x6ed7('0x1d')][_0x6ed7('0x1f')]||null:null})[_0x6ed7('0xf')](function(_0x2211cc){logger[_0x6ed7('0x10')](_0x6ed7('0x19'),_0x529a9f);logger[_0x6ed7('0x20')](_0x6ed7('0x19'),_0x529a9f,JSON[_0x6ed7('0x13')](_0x2211cc));_0x156bbf(_0x2211cc);})[_0x6ed7('0x18')](function(_0x5bfc2a){logger[_0x6ed7('0x14')]('UpdateWhatsappInteraction',_0x5bfc2a[_0x6ed7('0x16')],_0x529a9f);_0x34cc4c(_0x3c1df4['error'](0x1f4,_0x5bfc2a[_0x6ed7('0x16')]));});});};exports[_0x6ed7('0x21')]=function(_0x180b16){return new Promise(function(_0xf08ae4,_0x2146a1){return db[_0x6ed7('0x1a')]['find']({'where':_0x180b16[_0x6ed7('0x1d')]?_0x180b16[_0x6ed7('0x1d')][_0x6ed7('0x22')]||null:null})[_0x6ed7('0xf')](function(_0x3efac8){if(_0x3efac8){return _0x3efac8['addTags'](_0x180b16['body'][_0x6ed7('0x23')],_[_0x6ed7('0x24')](_0x180b16[_0x6ed7('0x1c')],[_0x6ed7('0x23'),'id'])||{});}})['spread'](function(_0x6cc1a0){logger[_0x6ed7('0x10')](_0x6ed7('0x25'),_0x180b16);logger['debug']('AddTags',_0x180b16,JSON[_0x6ed7('0x13')](_0x6cc1a0));_0xf08ae4(_0x6cc1a0);})['catch'](function(_0x591f43){logger[_0x6ed7('0x14')](_0x6ed7('0x25'),_0x591f43['message'],_0x180b16);_0x2146a1(_this[_0x6ed7('0x14')](0x1f4,_0x591f43[_0x6ed7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index f7e9967..702bbcd 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 _0x3a76=['save','update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x5d30b4,_0x199248){var _0x1acfb8=function(_0x3544b2){while(--_0x3544b2){_0x5d30b4['push'](_0x5d30b4['shift']());}};_0x1acfb8(++_0x199248);}(_0x3a76,0x87));var _0x63a7=function(_0x422302,_0x25a4e4){_0x422302=_0x422302-0x0;var _0x46cee9=_0x3a76[_0x422302];return _0x46cee9;};'use strict';var WhatsappInteractionEvents=require(_0x63a7('0x0'));var events=[_0x63a7('0x1'),'remove',_0x63a7('0x2')];function createListener(_0x4f8d61,_0x5c8e47){return function(_0x1dc4c8){_0x5c8e47[_0x63a7('0x3')](_0x4f8d61,_0x1dc4c8);};}function removeListener(_0x1d85f6,_0x106f2b){return function(){WhatsappInteractionEvents[_0x63a7('0x4')](_0x1d85f6,_0x106f2b);};}exports[_0x63a7('0x5')]=function(_0x5dfc3d){for(var _0x2b3b6a=0x0,_0x41b1dc=events[_0x63a7('0x6')];_0x2b3b6a<_0x41b1dc;_0x2b3b6a++){var _0x2bc363=events[_0x2b3b6a];var _0x2ef04f=createListener(_0x63a7('0x7')+_0x2bc363,_0x5dfc3d);WhatsappInteractionEvents['on'](_0x2bc363,_0x2ef04f);}}; \ No newline at end of file +var _0xfbac=['./whatsappInteraction.events','save','emit','removeListener','register','length','whatsappInteraction:'];(function(_0x512978,_0xf18ee){var _0x28b88b=function(_0x342b9f){while(--_0x342b9f){_0x512978['push'](_0x512978['shift']());}};_0x28b88b(++_0xf18ee);}(_0xfbac,0xa1));var _0xcfba=function(_0x27d700,_0x36c6a9){_0x27d700=_0x27d700-0x0;var _0xd72d05=_0xfbac[_0x27d700];return _0xd72d05;};'use strict';var WhatsappInteractionEvents=require(_0xcfba('0x0'));var events=[_0xcfba('0x1'),'remove','update'];function createListener(_0x17af4d,_0x4e0d52){return function(_0x562a91){_0x4e0d52[_0xcfba('0x2')](_0x17af4d,_0x562a91);};}function removeListener(_0x13c556,_0x5a8bb7){return function(){WhatsappInteractionEvents[_0xcfba('0x3')](_0x13c556,_0x5a8bb7);};}exports[_0xcfba('0x4')]=function(_0x460cd3){for(var _0x431e1a=0x0,_0x386c45=events[_0xcfba('0x5')];_0x431e1a<_0x386c45;_0x431e1a++){var _0x291721=events[_0x431e1a];var _0x16cb5f=createListener(_0xcfba('0x6')+_0x291721,_0x460cd3);WhatsappInteractionEvents['on'](_0x291721,_0x16cb5f);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 13dc0fa..8588013 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 _0xfdd7=['reject','delete','util','path','connect-timeout','express','Router','../../components/auth/service','./whatsappMessage.controller','isAuthenticated','get','/describe','describe','show','tracked','whatsappmessage:create','post','/:id/status','status','put','/:id','update','/:id/accept','accept'];(function(_0x915a15,_0x31b9d2){var _0x24f642=function(_0x575d4c){while(--_0x575d4c){_0x915a15['push'](_0x915a15['shift']());}};_0x24f642(++_0x31b9d2);}(_0xfdd7,0x182));var _0x7fdd=function(_0x547bad,_0x12a493){_0x547bad=_0x547bad-0x0;var _0x166969=_0xfdd7[_0x547bad];return _0x166969;};'use strict';var multer=require('multer');var util=require(_0x7fdd('0x0'));var path=require(_0x7fdd('0x1'));var timeout=require(_0x7fdd('0x2'));var express=require(_0x7fdd('0x3'));var router=express[_0x7fdd('0x4')]();var auth=require(_0x7fdd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7fdd('0x6'));router['get']('/',auth[_0x7fdd('0x7')](),controller['index']);router[_0x7fdd('0x8')](_0x7fdd('0x9'),auth['isAuthenticated'](),controller[_0x7fdd('0xa')]);router[_0x7fdd('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7fdd('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x7fdd('0xc')]('whatsapp',_0x7fdd('0xd')),controller['create']);router[_0x7fdd('0xe')](_0x7fdd('0xf'),controller[_0x7fdd('0x10')]);router[_0x7fdd('0x11')](_0x7fdd('0x12'),auth[_0x7fdd('0x7')](),controller[_0x7fdd('0x13')]);router[_0x7fdd('0x11')](_0x7fdd('0x14'),auth['isAuthenticated'](),controller[_0x7fdd('0x15')]);router[_0x7fdd('0x11')]('/:id/reject',auth[_0x7fdd('0x7')](),controller[_0x7fdd('0x16')]);router[_0x7fdd('0x17')]('/:id',auth[_0x7fdd('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf55b=['tracked','whatsappmessage:create','create','/:id/status','update','put','/:id/accept','/:id/reject','reject','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x33543c,_0x39744e){var _0x50e5cd=function(_0x49a167){while(--_0x49a167){_0x33543c['push'](_0x33543c['shift']());}};_0x50e5cd(++_0x39744e);}(_0xf55b,0x150));var _0xbf55=function(_0x25b30b,_0x3ab46d){_0x25b30b=_0x25b30b-0x0;var _0x1ef6cf=_0xf55b[_0x25b30b];return _0x1ef6cf;};'use strict';var multer=require(_0xbf55('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbf55('0x1'));var express=require(_0xbf55('0x2'));var router=express['Router']();var auth=require(_0xbf55('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbf55('0x4'));var controller=require(_0xbf55('0x5'));router[_0xbf55('0x6')]('/',auth[_0xbf55('0x7')](),controller[_0xbf55('0x8')]);router['get'](_0xbf55('0x9'),auth[_0xbf55('0x7')](),controller[_0xbf55('0xa')]);router[_0xbf55('0x6')](_0xbf55('0xb'),auth['isAuthenticated'](),controller[_0xbf55('0xc')]);router[_0xbf55('0xd')]('/',auth[_0xbf55('0x7')](),interaction[_0xbf55('0xe')]('whatsapp',_0xbf55('0xf')),controller[_0xbf55('0x10')]);router[_0xbf55('0xd')](_0xbf55('0x11'),controller['status']);router['put'](_0xbf55('0xb'),auth[_0xbf55('0x7')](),controller[_0xbf55('0x12')]);router[_0xbf55('0x13')](_0xbf55('0x14'),auth[_0xbf55('0x7')](),controller['accept']);router[_0xbf55('0x13')](_0xbf55('0x15'),auth['isAuthenticated'](),controller[_0xbf55('0x16')]);router[_0xbf55('0x17')](_0xbf55('0xb'),auth[_0xbf55('0x7')](),controller[_0xbf55('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index fa9dbd9..975c8b8 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 _0xad22=['ENUM','out','STRING','sequelize','TEXT','medium','BOOLEAN'];(function(_0x2e8548,_0x50ca5d){var _0x1afacc=function(_0x4bf222){while(--_0x4bf222){_0x2e8548['push'](_0x2e8548['shift']());}};_0x1afacc(++_0x50ca5d);}(_0xad22,0x1ed));var _0x2ad2=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0xad22[_0x367a3d];return _0x460539;};'use strict';var Sequelize=require(_0x2ad2('0x0'));module['exports']={'body':{'type':Sequelize[_0x2ad2('0x1')](_0x2ad2('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x2ad2('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2ad2('0x4')]('in',_0x2ad2('0x5')),'defaultValue':_0x2ad2('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x2ad2('0x6')](0xbe)},'phone':{'type':Sequelize[_0x2ad2('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x2ad2('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x23d2=['STRING','DATE','sequelize','exports','medium','BOOLEAN','out'];(function(_0x269bfc,_0x3ba834){var _0x5d4676=function(_0x552ec2){while(--_0x552ec2){_0x269bfc['push'](_0x269bfc['shift']());}};_0x5d4676(++_0x3ba834);}(_0x23d2,0x18a));var _0x223d=function(_0x255c65,_0x3444b8){_0x255c65=_0x255c65-0x0;var _0x23e230=_0x23d2[_0x255c65];return _0x23e230;};'use strict';var Sequelize=require(_0x223d('0x0'));module[_0x223d('0x1')]={'body':{'type':Sequelize['TEXT'](_0x223d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x223d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x223d('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x223d('0x5')](0xbe)},'phone':{'type':Sequelize[_0x223d('0x5')]},'readAt':{'type':Sequelize[_0x223d('0x6')]},'secret':{'type':Sequelize[_0x223d('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 01429f7..ebb38da 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 _0x07a1=['intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','find','create','body','params','destroy','describe','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteraction','isNil','read1stAt','format','interaction','role','null','AcceptMessage','acceptMessage','channel','event','EventManager','acceptmessage','whatsapp','agent','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','count','offset','limit','apply','reject','save','update','stack','name','send','map','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x07a1,0xc2));var _0x107a=function(_0x1fb705,_0x3e3fbc){_0x1fb705=_0x1fb705-0x0;var _0x5ba967=_0x07a1[_0x1fb705];return _0x5ba967;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x107a('0x0'));var zipdir=require(_0x107a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x107a('0x2'));var BPromise=require(_0x107a('0x3'));var Mustache=require(_0x107a('0x4'));var util=require(_0x107a('0x5'));var path=require(_0x107a('0x6'));var sox=require(_0x107a('0x7'));var csv=require('to-csv');var ejs=require(_0x107a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x107a('0x9'));var crypto=require('crypto');var jsforce=require(_0x107a('0xa'));var deskjs=require(_0x107a('0xb'));var toCsv=require(_0x107a('0xc'));var querystring=require(_0x107a('0xd'));var Papa=require(_0x107a('0xe'));var Redis=require(_0x107a('0xf'));var authService=require(_0x107a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x107a('0x11'));var hardwareService=require(_0x107a('0x12'));var logger=require(_0x107a('0x13'))('api');var utils=require(_0x107a('0x14'));var config=require(_0x107a('0x15'));var db=require(_0x107a('0x16'))['db'];config[_0x107a('0x17')]=_[_0x107a('0x18')](config[_0x107a('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x107a('0x19'))(new Redis(config['redis']));require(_0x107a('0x1a'))[_0x107a('0x1b')](socket);var jayson=require(_0x107a('0x1c'));var client=jayson[_0x107a('0x1d')][_0x107a('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0x107a('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x520537,_0x3bff6d,_0x1a4e0d){if(_0x1a4e0d){var _0x111389=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x111389[_0x107a('0x1f')](_0x3bff6d)){return _0x520537;}else{throw new db[(_0x107a('0x20'))][(_0x107a('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 _0x520537;}}function respondWithRpcPromise(_0x31c0a3,_0x43e3c1,_0xb06006,_0xb337bd){return new BPromise(function(_0x2a287b,_0x2920a2){var _0x1cea4d=_0xb337bd||client;return _0x1cea4d['request'](_0x31c0a3,_0xb06006)[_0x107a('0x22')](function(_0x49813b){logger[_0x107a('0x23')](_0x107a('0x24'),_0x43e3c1,'request\x20sent');logger[_0x107a('0x25')](_0x107a('0x26'),_0x43e3c1,_0x107a('0x27'),JSON[_0x107a('0x28')](_0x49813b));if(_0x49813b[_0x107a('0x29')]){if(_0x49813b['error'][_0x107a('0x2a')]===0x1f4){logger['error'](_0x107a('0x24'),_0x43e3c1,_0x49813b[_0x107a('0x29')][_0x107a('0x2b')]);return _0x2920a2(_0x49813b[_0x107a('0x29')][_0x107a('0x2b')]);}logger[_0x107a('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x43e3c1,_0x49813b[_0x107a('0x29')]['message']);return _0x2a287b(_0x49813b['error']['message']);}else{logger[_0x107a('0x23')]('WhatsappMessage,\x20%s,\x20%s',_0x43e3c1,'request\x20sent');_0x2a287b(_0x49813b['result'][_0x107a('0x2b')]);}})[_0x107a('0x2c')](function(_0x3ecddc){logger[_0x107a('0x29')](_0x107a('0x24'),_0x43e3c1,_0x3ecddc);_0x2920a2(_0x3ecddc);});});}function respondWithStatusCode(_0x497937,_0x2eb678){_0x2eb678=_0x2eb678||0xcc;return function(_0x3693c9){if(_0x3693c9){return _0x497937[_0x107a('0x2d')](_0x2eb678);}return _0x497937[_0x107a('0x2e')](_0x2eb678)['end']();};}function respondWithResult(_0x3230f2,_0xe848f3){_0xe848f3=_0xe848f3||0xc8;return function(_0xf9dc53){if(_0xf9dc53){return _0x3230f2['status'](_0xe848f3)[_0x107a('0x2f')](_0xf9dc53);}};}function respondWithFilteredResult(_0xdf9fcc,_0x38c5b6){return function(_0x325df2){if(_0x325df2){var _0x26eaff=_0x325df2[_0x107a('0x30')],_0x320196=_0x38c5b6[_0x107a('0x31')],_0x40cc30=_0x38c5b6[_0x107a('0x31')]+_0x38c5b6[_0x107a('0x32')],_0x8755de;if(_0x40cc30>=_0x26eaff){_0x40cc30=_0x26eaff;_0x8755de=0xc8;}else{_0x8755de=0xce;}_0xdf9fcc[_0x107a('0x2e')](_0x8755de);return _0xdf9fcc['set']('Content-Range',_0x320196+'-'+_0x40cc30+'/'+_0x26eaff)[_0x107a('0x2f')](_0x325df2);}return null;};}function patchUpdates(_0x5a8999){return function(_0x4f0a31){try{jsonpatch[_0x107a('0x33')](_0x4f0a31,_0x5a8999,!![]);}catch(_0x488440){return BPromise[_0x107a('0x34')](_0x488440);}return _0x4f0a31[_0x107a('0x35')]();};}function saveUpdates(_0x1c41f6,_0x47617d){return function(_0x3d89f2){if(_0x3d89f2){return _0x3d89f2[_0x107a('0x36')](_0x1c41f6)[_0x107a('0x22')](function(_0x347620){return _0x347620;});}return null;};}function removeEntity(_0x14f70d,_0x21376d){return function(_0x414afb){if(_0x414afb){return _0x414afb['destroy']()['then'](function(){_0x14f70d[_0x107a('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x472d33,_0x57e07a){return function(_0x59eff7){if(!_0x59eff7){_0x472d33[_0x107a('0x2d')](0x194);}return _0x59eff7;};}function handleError(_0x95f4c9,_0x5a6c58){_0x5a6c58=_0x5a6c58||0x1f4;return function(_0xeb2bd3){logger[_0x107a('0x29')](_0xeb2bd3[_0x107a('0x37')]);if(_0xeb2bd3[_0x107a('0x38')]){delete _0xeb2bd3[_0x107a('0x38')];}_0x95f4c9['status'](_0x5a6c58)[_0x107a('0x39')](_0xeb2bd3);};}exports['index']=function(_0xc4e216,_0x115eee){var _0x9a6aa7={},_0x422c30={},_0x566560={'count':0x0,'rows':[]};var _0x300136=_[_0x107a('0x3a')](db[_0x107a('0x3b')][_0x107a('0x3c')],function(_0x570594){return{'name':_0x570594[_0x107a('0x3d')],'type':_0x570594[_0x107a('0x3e')][_0x107a('0x3f')]};});_0x422c30[_0x107a('0x40')]=_['map'](_0x300136,_0x107a('0x38'));_0x422c30[_0x107a('0x41')]=_[_0x107a('0x42')](_0xc4e216[_0x107a('0x41')]);_0x422c30[_0x107a('0x43')]=_[_0x107a('0x44')](_0x422c30[_0x107a('0x40')],_0x422c30[_0x107a('0x41')]);_0x9a6aa7[_0x107a('0x45')]=_[_0x107a('0x44')](_0x422c30[_0x107a('0x40')],qs[_0x107a('0x46')](_0xc4e216['query'][_0x107a('0x46')]));_0x9a6aa7[_0x107a('0x45')]=_0x9a6aa7[_0x107a('0x45')][_0x107a('0x47')]?_0x9a6aa7[_0x107a('0x45')]:_0x422c30[_0x107a('0x40')];if(!_0xc4e216[_0x107a('0x41')]['hasOwnProperty']('nolimit')){_0x9a6aa7[_0x107a('0x32')]=qs['limit'](_0xc4e216['query']['limit']);_0x9a6aa7[_0x107a('0x31')]=qs[_0x107a('0x31')](_0xc4e216[_0x107a('0x41')][_0x107a('0x31')]);}_0x9a6aa7[_0x107a('0x48')]=qs['sort'](_0xc4e216['query'][_0x107a('0x49')]);_0x9a6aa7[_0x107a('0x4a')]=qs['filters'](_[_0x107a('0x4b')](_0xc4e216['query'],_0x422c30['filters']),_0x300136);if(_0xc4e216[_0x107a('0x41')][_0x107a('0x4c')]){_0x9a6aa7[_0x107a('0x4a')]=_[_0x107a('0x4d')](_0x9a6aa7[_0x107a('0x4a')],{'$or':_['map'](_0x300136,function(_0x2488a9){if(_0x2488a9[_0x107a('0x3e')]!==_0x107a('0x4e')){var _0x3e200d={};_0x3e200d[_0x2488a9[_0x107a('0x38')]]={'$like':'%'+_0xc4e216[_0x107a('0x41')][_0x107a('0x4c')]+'%'};return _0x3e200d;}})});}_0x9a6aa7=_['merge']({},_0x9a6aa7,_0xc4e216[_0x107a('0x4f')]);var _0x839384={'where':_0x9a6aa7['where']};return db[_0x107a('0x3b')][_0x107a('0x30')](_0x839384)[_0x107a('0x22')](function(_0x5a73a6){_0x566560[_0x107a('0x30')]=_0x5a73a6;if(_0xc4e216[_0x107a('0x41')]['includeAll']){_0x9a6aa7[_0x107a('0x50')]=[{'all':!![]}];}return db[_0x107a('0x3b')][_0x107a('0x51')](_0x9a6aa7);})['then'](function(_0x3ae2cb){_0x566560[_0x107a('0x52')]=_0x3ae2cb;return _0x566560;})['then'](respondWithFilteredResult(_0x115eee,_0x9a6aa7))[_0x107a('0x2c')](handleError(_0x115eee,null));};exports[_0x107a('0x53')]=function(_0x3f400f,_0x4ef888){var _0x39bdef={'raw':!![],'where':{'id':_0x3f400f['params']['id']}},_0x413901={};_0x413901['model']=_['keys'](db[_0x107a('0x3b')]['rawAttributes']);_0x413901['query']=_['keys'](_0x3f400f[_0x107a('0x41')]);_0x413901[_0x107a('0x43')]=_[_0x107a('0x44')](_0x413901[_0x107a('0x40')],_0x413901[_0x107a('0x41')]);_0x39bdef[_0x107a('0x45')]=_[_0x107a('0x44')](_0x413901[_0x107a('0x40')],qs[_0x107a('0x46')](_0x3f400f[_0x107a('0x41')][_0x107a('0x46')]));_0x39bdef['attributes']=_0x39bdef[_0x107a('0x45')]['length']?_0x39bdef[_0x107a('0x45')]:_0x413901['model'];if(_0x3f400f[_0x107a('0x41')]['includeAll']){_0x39bdef['include']=[{'all':!![]}];}_0x39bdef=_[_0x107a('0x4d')]({},_0x39bdef,_0x3f400f[_0x107a('0x4f')]);return db[_0x107a('0x3b')][_0x107a('0x54')](_0x39bdef)['then'](handleEntityNotFound(_0x4ef888,null))['then'](respondWithResult(_0x4ef888,null))[_0x107a('0x2c')](handleError(_0x4ef888,null));};exports[_0x107a('0x55')]=function(_0x15fd89,_0x144650){return db[_0x107a('0x3b')][_0x107a('0x55')](_0x15fd89['body'],{})[_0x107a('0x22')](respondWithResult(_0x144650,0xc9))[_0x107a('0x2c')](handleError(_0x144650,null));};exports[_0x107a('0x36')]=function(_0x3dc486,_0x4b4720){if(_0x3dc486['body']['id']){delete _0x3dc486[_0x107a('0x56')]['id'];}return db[_0x107a('0x3b')][_0x107a('0x54')]({'where':{'id':_0x3dc486[_0x107a('0x57')]['id']}})[_0x107a('0x22')](handleEntityNotFound(_0x4b4720,null))['then'](saveUpdates(_0x3dc486[_0x107a('0x56')],null))[_0x107a('0x22')](respondWithResult(_0x4b4720,null))[_0x107a('0x2c')](handleError(_0x4b4720,null));};exports[_0x107a('0x58')]=function(_0x478e15,_0x21220a){return db[_0x107a('0x3b')][_0x107a('0x54')]({'where':{'id':_0x478e15[_0x107a('0x57')]['id']}})[_0x107a('0x22')](handleEntityNotFound(_0x21220a,null))[_0x107a('0x22')](removeEntity(_0x21220a,null))[_0x107a('0x2c')](handleError(_0x21220a,null));};exports[_0x107a('0x59')]=function(_0x58dcf2,_0x3a151d){return db['WhatsappMessage']['describe']()[_0x107a('0x22')](respondWithResult(_0x3a151d,null))[_0x107a('0x2c')](handleError(_0x3a151d,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x107a('0x5a')]=function(_0x337b4a,_0x189f57,_0x4a6746){var _0x22c871={'channel':'whatsapp'};if(_0x337b4a['body']['id']){delete _0x337b4a[_0x107a('0x56')]['id'];}_0x337b4a['body'][_0x107a('0x5b')]=!![];_0x337b4a[_0x107a('0x56')][_0x107a('0x5c')]=moment()['format'](_0x107a('0x5d'));_0x337b4a[_0x107a('0x56')][_0x107a('0x5e')]=_0x337b4a['body']['UserId']||_0x337b4a[_0x107a('0x5f')]['id'];return db[_0x107a('0x3b')]['find']({'where':{'id':_0x337b4a[_0x107a('0x57')]['id'],'UserId':null},'include':[{'model':db[_0x107a('0x60')],'as':_0x107a('0x61')}]})['then'](handleEntityNotFound(_0x189f57,null))[_0x107a('0x22')](saveUpdates(_0x337b4a[_0x107a('0x56')],null))[_0x107a('0x22')](function(_0x5e4ee9){if(_0x5e4ee9){_0x22c871[_0x107a('0x2b')]=_0x5e4ee9[_0x107a('0x62')]({'plain':!![]});return db[_0x107a('0x63')][_0x107a('0x54')]({'where':{'id':_0x5e4ee9['WhatsappInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x189f57,null))[_0x107a('0x22')](function(_0x21931d){if(_0x21931d){return _0x21931d[_0x107a('0x36')]({'UserId':_0x337b4a['body'][_0x107a('0x5e')],'read1stAt':_[_0x107a('0x64')](_0x21931d[_0x107a('0x65')])?moment()[_0x107a('0x66')](_0x107a('0x5d')):undefined});}return null;})[_0x107a('0x22')](function(_0x387e17){if(_0x387e17){_0x22c871[_0x107a('0x67')]=_0x387e17['get']({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x337b4a[_0x107a('0x5f')]['id'],_0x337b4a[_0x107a('0x5f')]['name'],_0x337b4a['user'][_0x107a('0x68')],_0x22c871[_0x107a('0x67')]['id'],_0x337b4a['body']?JSON['stringify'](_0x337b4a[_0x107a('0x56')]):_0x107a('0x69'));return respondWithRpcPromise(_0x107a('0x6a'),_0x107a('0x6b'),_0x22c871);}return null;})['then'](function(_0x1221c7){if(_0x1221c7){if(_0x337b4a[_0x107a('0x56')]['manual']){_0x22c871['message']['interface']=util[_0x107a('0x66')]('SIP/%s',_0x337b4a['user'][_0x107a('0x38')]);_0x22c871[_0x107a('0x2b')][_0x107a('0x6c')]=_0x22c871[_0x107a('0x6c')];_0x22c871['message'][_0x107a('0x6d')]=_0x107a('0x5a');return respondWithRpcPromise(_0x107a('0x6e'),_0x107a('0x6e'),{'event':_0x107a('0x6f'),'message':_0x22c871[_0x107a('0x2b')]},client9002)[_0x107a('0x22')](function(){return _0x22c871;});}return _0x22c871;}return null;})[_0x107a('0x22')](respondWithResult(_0x189f57,null))['catch'](handleError(_0x189f57,null));};var interaction_log=require(_0x107a('0x13'))('whatsapp-interactions');exports[_0x107a('0x34')]=function(_0x33f9e7,_0x1e6572,_0x27cdc6){var _0xb43dd4={'agent':{},'channel':_0x107a('0x70')};if(_0x33f9e7[_0x107a('0x56')]['id']){delete _0x33f9e7[_0x107a('0x56')]['id'];}_0x33f9e7[_0x107a('0x56')][_0x107a('0x5e')]=_0x33f9e7[_0x107a('0x56')]['UserId']||_0x33f9e7['user']['id'];_0xb43dd4[_0x107a('0x71')]['id']=_0x33f9e7['body'][_0x107a('0x5e')];return db['WhatsappMessage'][_0x107a('0x54')]({'where':{'id':_0x33f9e7[_0x107a('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1e6572,null))['then'](function(_0x15b54c){if(_0x15b54c){_0xb43dd4['message']=_0x15b54c[_0x107a('0x62')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x15b54c[_0x107a('0x72')]}});}return null;})[_0x107a('0x22')](handleEntityNotFound(_0x1e6572,null))[_0x107a('0x22')](function(_0x5f01d4){if(_0x5f01d4){_0xb43dd4[_0x107a('0x67')]=_0x5f01d4[_0x107a('0x62')]({'plain':!![]});interaction_log[_0x107a('0x23')](_0x107a('0x73'),_0x33f9e7[_0x107a('0x5f')]['id'],_0x33f9e7[_0x107a('0x5f')][_0x107a('0x38')],_0x33f9e7[_0x107a('0x5f')][_0x107a('0x68')],_0xb43dd4[_0x107a('0x67')]['id'],_0x33f9e7[_0x107a('0x56')]?JSON[_0x107a('0x28')](_0x33f9e7[_0x107a('0x56')]):_0x107a('0x69'));return respondWithRpcPromise(_0x107a('0x74'),_0x107a('0x75'),_0xb43dd4);}return null;})['then'](function(_0xe9fd8){if(_0xe9fd8){_0xe9fd8['message'][_0x107a('0x76')]=util[_0x107a('0x66')](_0x107a('0x77'),_0x33f9e7[_0x107a('0x5f')][_0x107a('0x38')]);_0xe9fd8[_0x107a('0x2b')][_0x107a('0x6c')]=_0xb43dd4[_0x107a('0x6c')];_0xe9fd8[_0x107a('0x2b')][_0x107a('0x6d')]=_0x107a('0x34');respondWithRpcPromise(_0x107a('0x6e'),_0x107a('0x6e'),{'event':_0x107a('0x78'),'message':_0xe9fd8[_0x107a('0x2b')]},client9002);return _0xb43dd4;}return null;})[_0x107a('0x22')](respondWithResult(_0x1e6572,null))[_0x107a('0x2c')](handleError(_0x1e6572,null));};exports[_0x107a('0x2e')]=function(_0x14a210,_0x198a6a,_0x124e24){if(_0x14a210[_0x107a('0x56')]['id']){delete _0x14a210['body']['id'];}var _0x54f959;return db[_0x107a('0x3b')][_0x107a('0x54')]({'where':{'id':_0x14a210['params']['id']}})[_0x107a('0x22')](handleEntityNotFound(_0x198a6a,null))[_0x107a('0x22')](function(_0x43e737){if(_0x43e737){_0x54f959=_0x43e737;return db[_0x107a('0x79')]['find']({'where':{'id':_0x43e737[_0x107a('0x7a')]}});}})[_0x107a('0x22')](handleEntityNotFound(_0x198a6a,null))[_0x107a('0x22')](function(_0x5bdb4f){if(_0x5bdb4f){logger['debug'](_0x107a('0x7b'),_0x107a('0x2e'),_0x107a('0x7c'),_0x5bdb4f['type'],util[_0x107a('0x7d')](_0x14a210['body'],{'showHidden':![],'depth':null}));switch(_0x5bdb4f['type']){case _0x107a('0x7e'):if(_0x14a210['body'][_0x107a('0x7f')]&&_0x14a210['body'][_0x107a('0x7f')]===_0x54f959[_0x107a('0x80')]&&_0x14a210[_0x107a('0x56')][_0x107a('0x81')]&&_0x14a210['body'][_0x107a('0x81')]===_0x107a('0x5b')){return _0x54f959['update']({'read':!![]});}else{logger[_0x107a('0x29')](_0x107a('0x82'),_0x107a('0x2e'),_0x107a('0x7e'),util[_0x107a('0x7d')](_0x14a210[_0x107a('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x54f959;}})[_0x107a('0x22')](respondWithResult(_0x198a6a,null))[_0x107a('0x2c')](handleError(_0x198a6a,null));}; \ No newline at end of file +var _0x19d9=['include','findAll','show','params','includeAll','options','find','create','body','destroy','describe','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','WhatsappInteractionId','update','isNil','read1stAt','format','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','twilio','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','ValidationError','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','code','WhatsappMessage,\x20%s,\x20%s','error','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','map','WhatsappMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','type','VIRTUAL','merge'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0x19d9,0x1bd));var _0x919d=function(_0x50225f,_0x1148fa){_0x50225f=_0x50225f-0x0;var _0x2a5625=_0x19d9[_0x50225f];return _0x2a5625;};'use strict';var pdf=require(_0x919d('0x0'));var emlformat=require(_0x919d('0x1'));var rimraf=require(_0x919d('0x2'));var zipdir=require(_0x919d('0x3'));var jsonpatch=require(_0x919d('0x4'));var rp=require(_0x919d('0x5'));var moment=require(_0x919d('0x6'));var BPromise=require(_0x919d('0x7'));var Mustache=require(_0x919d('0x8'));var util=require(_0x919d('0x9'));var path=require(_0x919d('0xa'));var sox=require(_0x919d('0xb'));var csv=require(_0x919d('0xc'));var ejs=require(_0x919d('0xd'));var fs=require('fs');var _=require(_0x919d('0xe'));var squel=require(_0x919d('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x919d('0x10'));var toCsv=require(_0x919d('0xc'));var querystring=require(_0x919d('0x11'));var Papa=require(_0x919d('0x12'));var Redis=require(_0x919d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x919d('0x14'));var as=require(_0x919d('0x15'));var hardwareService=require(_0x919d('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x919d('0x17'));var config=require('../../config/environment');var db=require(_0x919d('0x18'))['db'];config[_0x919d('0x19')]=_[_0x919d('0x1a')](config[_0x919d('0x19')],{'host':_0x919d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x919d('0x1c'))[_0x919d('0x1d')](socket);var jayson=require(_0x919d('0x1e'));var client=jayson[_0x919d('0x1f')][_0x919d('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x919d('0x20')]({'port':0x232a});function checkPasswordPattern(_0x5403ce,_0x58a35f,_0x3b4816){if(_0x3b4816){var _0x3173af=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3173af['test'](_0x58a35f)){return _0x5403ce;}else{throw new db['Sequelize'][(_0x919d('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 _0x5403ce;}}function respondWithRpcPromise(_0x14e100,_0x18ad6d,_0x23a0f1,_0x4df0cc){return new BPromise(function(_0xd1f53e,_0x268227){var _0x4536bc=_0x4df0cc||client;return _0x4536bc[_0x919d('0x22')](_0x14e100,_0x23a0f1)[_0x919d('0x23')](function(_0x2fcc6b){logger[_0x919d('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x18ad6d,_0x919d('0x25'));logger[_0x919d('0x26')](_0x919d('0x27'),_0x18ad6d,_0x919d('0x25'),JSON[_0x919d('0x28')](_0x2fcc6b));if(_0x2fcc6b['error']){if(_0x2fcc6b['error'][_0x919d('0x29')]===0x1f4){logger['error'](_0x919d('0x2a'),_0x18ad6d,_0x2fcc6b[_0x919d('0x2b')][_0x919d('0x2c')]);return _0x268227(_0x2fcc6b['error'][_0x919d('0x2c')]);}logger['error'](_0x919d('0x2a'),_0x18ad6d,_0x2fcc6b[_0x919d('0x2b')][_0x919d('0x2c')]);return _0xd1f53e(_0x2fcc6b[_0x919d('0x2b')]['message']);}else{logger[_0x919d('0x24')](_0x919d('0x2a'),_0x18ad6d,_0x919d('0x25'));_0xd1f53e(_0x2fcc6b[_0x919d('0x2d')][_0x919d('0x2c')]);}})[_0x919d('0x2e')](function(_0xc2bd37){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x18ad6d,_0xc2bd37);_0x268227(_0xc2bd37);});});}function respondWithStatusCode(_0x1ca487,_0x10870d){_0x10870d=_0x10870d||0xcc;return function(_0x3e1c5a){if(_0x3e1c5a){return _0x1ca487['sendStatus'](_0x10870d);}return _0x1ca487['status'](_0x10870d)[_0x919d('0x2f')]();};}function respondWithResult(_0x4ddf39,_0x5b20d6){_0x5b20d6=_0x5b20d6||0xc8;return function(_0x403da6){if(_0x403da6){return _0x4ddf39[_0x919d('0x30')](_0x5b20d6)[_0x919d('0x31')](_0x403da6);}};}function respondWithFilteredResult(_0x126ba6,_0x18e56b){return function(_0xd517ad){if(_0xd517ad){var _0x322216=_0xd517ad[_0x919d('0x32')],_0x41c6af=_0x18e56b[_0x919d('0x33')],_0x438770=_0x18e56b[_0x919d('0x33')]+_0x18e56b[_0x919d('0x34')],_0x5b3b0d;if(_0x438770>=_0x322216){_0x438770=_0x322216;_0x5b3b0d=0xc8;}else{_0x5b3b0d=0xce;}_0x126ba6['status'](_0x5b3b0d);return _0x126ba6[_0x919d('0x35')](_0x919d('0x36'),_0x41c6af+'-'+_0x438770+'/'+_0x322216)['json'](_0xd517ad);}return null;};}function patchUpdates(_0x2c29a1){return function(_0x2ed1bf){try{jsonpatch[_0x919d('0x37')](_0x2ed1bf,_0x2c29a1,!![]);}catch(_0x49f41d){return BPromise[_0x919d('0x38')](_0x49f41d);}return _0x2ed1bf[_0x919d('0x39')]();};}function saveUpdates(_0x212b9c,_0x2f9053){return function(_0x20ecf5){if(_0x20ecf5){return _0x20ecf5['update'](_0x212b9c)['then'](function(_0x10dd29){return _0x10dd29;});}return null;};}function removeEntity(_0x1d9aea,_0x12feb7){return function(_0x4ea4ac){if(_0x4ea4ac){return _0x4ea4ac['destroy']()[_0x919d('0x23')](function(){_0x1d9aea[_0x919d('0x30')](0xcc)[_0x919d('0x2f')]();});}};}function handleEntityNotFound(_0x10753e,_0x28b68d){return function(_0x4f9204){if(!_0x4f9204){_0x10753e['sendStatus'](0x194);}return _0x4f9204;};}function handleError(_0x39a008,_0xe3fbd5){_0xe3fbd5=_0xe3fbd5||0x1f4;return function(_0x2eb497){logger[_0x919d('0x2b')](_0x2eb497[_0x919d('0x3a')]);if(_0x2eb497[_0x919d('0x3b')]){delete _0x2eb497['name'];}_0x39a008['status'](_0xe3fbd5)['send'](_0x2eb497);};}exports['index']=function(_0x349f70,_0x4934ee){var _0x17e90f={},_0x68e84e={},_0x1e4efe={'count':0x0,'rows':[]};var _0xd4bc95=_[_0x919d('0x3c')](db[_0x919d('0x3d')][_0x919d('0x3e')],function(_0xecc464){return{'name':_0xecc464[_0x919d('0x3f')],'type':_0xecc464['type']['key']};});_0x68e84e[_0x919d('0x40')]=_[_0x919d('0x3c')](_0xd4bc95,_0x919d('0x3b'));_0x68e84e[_0x919d('0x41')]=_[_0x919d('0x42')](_0x349f70['query']);_0x68e84e[_0x919d('0x43')]=_[_0x919d('0x44')](_0x68e84e[_0x919d('0x40')],_0x68e84e[_0x919d('0x41')]);_0x17e90f[_0x919d('0x45')]=_[_0x919d('0x44')](_0x68e84e['model'],qs[_0x919d('0x46')](_0x349f70[_0x919d('0x41')]['fields']));_0x17e90f[_0x919d('0x45')]=_0x17e90f[_0x919d('0x45')][_0x919d('0x47')]?_0x17e90f['attributes']:_0x68e84e[_0x919d('0x40')];if(!_0x349f70['query'][_0x919d('0x48')]('nolimit')){_0x17e90f[_0x919d('0x34')]=qs[_0x919d('0x34')](_0x349f70[_0x919d('0x41')][_0x919d('0x34')]);_0x17e90f[_0x919d('0x33')]=qs[_0x919d('0x33')](_0x349f70[_0x919d('0x41')][_0x919d('0x33')]);}_0x17e90f['order']=qs[_0x919d('0x49')](_0x349f70[_0x919d('0x41')]['sort']);_0x17e90f[_0x919d('0x4a')]=qs[_0x919d('0x43')](_[_0x919d('0x4b')](_0x349f70[_0x919d('0x41')],_0x68e84e[_0x919d('0x43')]),_0xd4bc95);if(_0x349f70[_0x919d('0x41')]['filter']){_0x17e90f[_0x919d('0x4a')]=_['merge'](_0x17e90f[_0x919d('0x4a')],{'$or':_['map'](_0xd4bc95,function(_0x4c21db){if(_0x4c21db[_0x919d('0x4c')]!==_0x919d('0x4d')){var _0x5c1765={};_0x5c1765[_0x4c21db[_0x919d('0x3b')]]={'$like':'%'+_0x349f70[_0x919d('0x41')]['filter']+'%'};return _0x5c1765;}})});}_0x17e90f=_[_0x919d('0x4e')]({},_0x17e90f,_0x349f70['options']);var _0xa53430={'where':_0x17e90f[_0x919d('0x4a')]};return db[_0x919d('0x3d')][_0x919d('0x32')](_0xa53430)[_0x919d('0x23')](function(_0x5e6b34){_0x1e4efe[_0x919d('0x32')]=_0x5e6b34;if(_0x349f70[_0x919d('0x41')]['includeAll']){_0x17e90f[_0x919d('0x4f')]=[{'all':!![]}];}return db[_0x919d('0x3d')][_0x919d('0x50')](_0x17e90f);})[_0x919d('0x23')](function(_0x3513bd){_0x1e4efe['rows']=_0x3513bd;return _0x1e4efe;})[_0x919d('0x23')](respondWithFilteredResult(_0x4934ee,_0x17e90f))[_0x919d('0x2e')](handleError(_0x4934ee,null));};exports[_0x919d('0x51')]=function(_0x4a2b61,_0x1cbf38){var _0x57a695={'raw':!![],'where':{'id':_0x4a2b61[_0x919d('0x52')]['id']}},_0x514979={};_0x514979[_0x919d('0x40')]=_[_0x919d('0x42')](db[_0x919d('0x3d')][_0x919d('0x3e')]);_0x514979['query']=_['keys'](_0x4a2b61[_0x919d('0x41')]);_0x514979[_0x919d('0x43')]=_[_0x919d('0x44')](_0x514979[_0x919d('0x40')],_0x514979[_0x919d('0x41')]);_0x57a695[_0x919d('0x45')]=_[_0x919d('0x44')](_0x514979[_0x919d('0x40')],qs['fields'](_0x4a2b61[_0x919d('0x41')][_0x919d('0x46')]));_0x57a695[_0x919d('0x45')]=_0x57a695['attributes']['length']?_0x57a695[_0x919d('0x45')]:_0x514979['model'];if(_0x4a2b61[_0x919d('0x41')][_0x919d('0x53')]){_0x57a695[_0x919d('0x4f')]=[{'all':!![]}];}_0x57a695=_['merge']({},_0x57a695,_0x4a2b61[_0x919d('0x54')]);return db[_0x919d('0x3d')][_0x919d('0x55')](_0x57a695)[_0x919d('0x23')](handleEntityNotFound(_0x1cbf38,null))[_0x919d('0x23')](respondWithResult(_0x1cbf38,null))[_0x919d('0x2e')](handleError(_0x1cbf38,null));};exports[_0x919d('0x56')]=function(_0x334eb0,_0x146cc6){return db[_0x919d('0x3d')][_0x919d('0x56')](_0x334eb0[_0x919d('0x57')],{})['then'](respondWithResult(_0x146cc6,0xc9))[_0x919d('0x2e')](handleError(_0x146cc6,null));};exports['update']=function(_0x456671,_0x564d2c){if(_0x456671[_0x919d('0x57')]['id']){delete _0x456671[_0x919d('0x57')]['id'];}return db[_0x919d('0x3d')]['find']({'where':{'id':_0x456671[_0x919d('0x52')]['id']}})[_0x919d('0x23')](handleEntityNotFound(_0x564d2c,null))[_0x919d('0x23')](saveUpdates(_0x456671[_0x919d('0x57')],null))[_0x919d('0x23')](respondWithResult(_0x564d2c,null))[_0x919d('0x2e')](handleError(_0x564d2c,null));};exports[_0x919d('0x58')]=function(_0x175c2e,_0x40b984){return db[_0x919d('0x3d')]['find']({'where':{'id':_0x175c2e[_0x919d('0x52')]['id']}})[_0x919d('0x23')](handleEntityNotFound(_0x40b984,null))[_0x919d('0x23')](removeEntity(_0x40b984,null))[_0x919d('0x2e')](handleError(_0x40b984,null));};exports[_0x919d('0x59')]=function(_0x1b1732,_0x15fe92){return db[_0x919d('0x3d')][_0x919d('0x59')]()[_0x919d('0x23')](respondWithResult(_0x15fe92,null))['catch'](handleError(_0x15fe92,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x919d('0x5a')]=function(_0x231041,_0x3f899e,_0x6d8e84){var _0x1109dc={'channel':_0x919d('0x5b')};if(_0x231041[_0x919d('0x57')]['id']){delete _0x231041['body']['id'];}_0x231041[_0x919d('0x57')][_0x919d('0x5c')]=!![];_0x231041[_0x919d('0x57')][_0x919d('0x5d')]=moment()['format'](_0x919d('0x5e'));_0x231041['body'][_0x919d('0x5f')]=_0x231041['body'][_0x919d('0x5f')]||_0x231041[_0x919d('0x60')]['id'];return db['WhatsappMessage']['find']({'where':{'id':_0x231041['params']['id'],'UserId':null},'include':[{'model':db[_0x919d('0x61')],'as':_0x919d('0x62')}]})[_0x919d('0x23')](handleEntityNotFound(_0x3f899e,null))[_0x919d('0x23')](saveUpdates(_0x231041[_0x919d('0x57')],null))[_0x919d('0x23')](function(_0x403a00){if(_0x403a00){_0x1109dc[_0x919d('0x2c')]=_0x403a00[_0x919d('0x63')]({'plain':!![]});return db['WhatsappInteraction'][_0x919d('0x55')]({'where':{'id':_0x403a00[_0x919d('0x64')]}});}return null;})[_0x919d('0x23')](handleEntityNotFound(_0x3f899e,null))['then'](function(_0x1bf103){if(_0x1bf103){return _0x1bf103[_0x919d('0x65')]({'UserId':_0x231041[_0x919d('0x57')][_0x919d('0x5f')],'read1stAt':_[_0x919d('0x66')](_0x1bf103[_0x919d('0x67')])?moment()[_0x919d('0x68')](_0x919d('0x5e')):undefined});}return null;})[_0x919d('0x23')](function(_0x4e8b16){if(_0x4e8b16){_0x1109dc[_0x919d('0x69')]=_0x4e8b16[_0x919d('0x63')]({'plain':!![]});interaction_log[_0x919d('0x24')](_0x919d('0x6a'),_0x231041[_0x919d('0x60')]['id'],_0x231041[_0x919d('0x60')][_0x919d('0x3b')],_0x231041[_0x919d('0x60')]['role'],_0x1109dc[_0x919d('0x69')]['id'],_0x231041['body']?JSON['stringify'](_0x231041['body']):_0x919d('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x919d('0x6c'),_0x1109dc);}return null;})[_0x919d('0x23')](function(_0x10a97a){if(_0x10a97a){if(_0x231041['body'][_0x919d('0x6d')]){_0x1109dc['message'][_0x919d('0x6e')]=util[_0x919d('0x68')](_0x919d('0x6f'),_0x231041[_0x919d('0x60')][_0x919d('0x3b')]);_0x1109dc[_0x919d('0x2c')][_0x919d('0x70')]=_0x1109dc[_0x919d('0x70')];_0x1109dc['message'][_0x919d('0x71')]=_0x919d('0x5a');return respondWithRpcPromise(_0x919d('0x72'),_0x919d('0x72'),{'event':_0x919d('0x73'),'message':_0x1109dc[_0x919d('0x2c')]},client9002)['then'](function(){return _0x1109dc;});}return _0x1109dc;}return null;})[_0x919d('0x23')](respondWithResult(_0x3f899e,null))['catch'](handleError(_0x3f899e,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x919d('0x38')]=function(_0x12d9f2,_0x1a0140,_0x5950db){var _0x2a2042={'agent':{},'channel':_0x919d('0x5b')};if(_0x12d9f2['body']['id']){delete _0x12d9f2[_0x919d('0x57')]['id'];}_0x12d9f2['body'][_0x919d('0x5f')]=_0x12d9f2[_0x919d('0x57')][_0x919d('0x5f')]||_0x12d9f2[_0x919d('0x60')]['id'];_0x2a2042['agent']['id']=_0x12d9f2['body'][_0x919d('0x5f')];return db['WhatsappMessage']['find']({'where':{'id':_0x12d9f2['params']['id'],'UserId':null}})[_0x919d('0x23')](handleEntityNotFound(_0x1a0140,null))[_0x919d('0x23')](function(_0x2c15bb){if(_0x2c15bb){_0x2a2042[_0x919d('0x2c')]=_0x2c15bb['get']({'plain':!![]});return db[_0x919d('0x74')][_0x919d('0x55')]({'where':{'id':_0x2c15bb[_0x919d('0x64')]}});}return null;})[_0x919d('0x23')](handleEntityNotFound(_0x1a0140,null))['then'](function(_0x288f05){if(_0x288f05){_0x2a2042[_0x919d('0x69')]=_0x288f05['get']({'plain':!![]});interaction_log['info'](_0x919d('0x75'),_0x12d9f2[_0x919d('0x60')]['id'],_0x12d9f2[_0x919d('0x60')]['name'],_0x12d9f2[_0x919d('0x60')][_0x919d('0x76')],_0x2a2042[_0x919d('0x69')]['id'],_0x12d9f2[_0x919d('0x57')]?JSON[_0x919d('0x28')](_0x12d9f2[_0x919d('0x57')]):_0x919d('0x6b'));return respondWithRpcPromise(_0x919d('0x77'),_0x919d('0x78'),_0x2a2042);}return null;})[_0x919d('0x23')](function(_0x191753){if(_0x191753){_0x191753[_0x919d('0x2c')]['interface']=util[_0x919d('0x68')](_0x919d('0x6f'),_0x12d9f2['user'][_0x919d('0x3b')]);_0x191753[_0x919d('0x2c')][_0x919d('0x70')]=_0x2a2042['channel'];_0x191753[_0x919d('0x2c')][_0x919d('0x71')]='reject';respondWithRpcPromise(_0x919d('0x72'),_0x919d('0x72'),{'event':_0x919d('0x79'),'message':_0x191753[_0x919d('0x2c')]},client9002);return _0x2a2042;}return null;})[_0x919d('0x23')](respondWithResult(_0x1a0140,null))[_0x919d('0x2e')](handleError(_0x1a0140,null));};exports[_0x919d('0x30')]=function(_0x4e2ee0,_0x479cb1,_0x1da91f){if(_0x4e2ee0[_0x919d('0x57')]['id']){delete _0x4e2ee0['body']['id'];}var _0x4ed54d;return db[_0x919d('0x3d')][_0x919d('0x55')]({'where':{'id':_0x4e2ee0[_0x919d('0x52')]['id']}})[_0x919d('0x23')](handleEntityNotFound(_0x479cb1,null))['then'](function(_0x588f00){if(_0x588f00){_0x4ed54d=_0x588f00;return db[_0x919d('0x7a')]['find']({'where':{'id':_0x588f00[_0x919d('0x7b')]}});}})[_0x919d('0x23')](handleEntityNotFound(_0x479cb1,null))[_0x919d('0x23')](function(_0x307d43){if(_0x307d43){logger['debug'](_0x919d('0x7c'),_0x919d('0x30'),_0x919d('0x7d'),_0x307d43['type'],util[_0x919d('0x7e')](_0x4e2ee0['body'],{'showHidden':![],'depth':null}));switch(_0x307d43[_0x919d('0x4c')]){case'twilio':if(_0x4e2ee0[_0x919d('0x57')][_0x919d('0x7f')]&&_0x4e2ee0[_0x919d('0x57')]['MessageSid']===_0x4ed54d[_0x919d('0x80')]&&_0x4e2ee0[_0x919d('0x57')]['MessageStatus']&&_0x4e2ee0[_0x919d('0x57')][_0x919d('0x81')]===_0x919d('0x5c')){return _0x4ed54d['update']({'read':!![]});}else{logger[_0x919d('0x2b')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x919d('0x82'),util[_0x919d('0x7e')](_0x4e2ee0[_0x919d('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4ed54d;}})['then'](respondWithResult(_0x479cb1,null))[_0x919d('0x2e')](handleError(_0x479cb1,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 80689fb..001ef99 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(_0xae8143,_0x21eb52){var _0x4d65f4=function(_0x3b5c1d){while(--_0x3b5c1d){_0xae8143['push'](_0xae8143['shift']());}};_0x4d65f4(++_0x21eb52);}(_0x5f2f,0x73));var _0xf5f2=function(_0x58f678,_0x18b3cc){_0x58f678=_0x58f678-0x0;var _0x238aef=_0x5f2f[_0x58f678];return _0x238aef;};'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(_0x37aace,_0x1eb5a7){var _0x49f09f=function(_0x425e71){while(--_0x425e71){_0x37aace['push'](_0x37aace['shift']());}};_0x49f09f(++_0x1eb5a7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2ef5e6,_0x437ce9){_0x2ef5e6=_0x2ef5e6-0x0;var _0x5283ff=_0x5f2f[_0x2ef5e6];return _0x5283ff;};'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 8fc3cde..8f7b922 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 _0xcae6=['twilio','accountSid','authToken','create','whatsapp:','phone','remote','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','then','createdAt','catch','error','out','find','type'];(function(_0x2a0183,_0x3fc93c){var _0x158c3a=function(_0x57a903){while(--_0x57a903){_0x2a0183['push'](_0x2a0183['shift']());}};_0x158c3a(++_0x3fc93c);}(_0xcae6,0x124));var _0x6cae=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0xcae6[_0x65c50e];return _0x4573e7;};'use strict';var _=require(_0x6cae('0x0'));var util=require(_0x6cae('0x1'));var logger=require('../../config/logger')(_0x6cae('0x2'));var moment=require(_0x6cae('0x3'));var BPromise=require(_0x6cae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6cae('0x5'));var rimraf=require(_0x6cae('0x6'));var config=require(_0x6cae('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0x6cae('0x8')]=function(_0x57ecca,_0x56d395){return _0x57ecca[_0x6cae('0x9')](_0x6cae('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x6cae('0xb')]},{'name':_0x6cae('0xc'),'fields':[_0x6cae('0xd')],'type':_0x6cae('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23912a,_0x190e8b,_0x42a9c2){var _0x6c7454=_0x57ecca['models'];var _0x2b9ca2=_0x23912a[_0x6cae('0xf')]({'plain':!![]});if(_0x2b9ca2[_0x6cae('0x10')][_0x6cae('0x11')]()==='in'||_0x2b9ca2['direction']['toLowerCase']()==='out'&&!_0x2b9ca2[_0x6cae('0x12')]&&!_[_0x6cae('0x13')](_0x2b9ca2[_0x6cae('0x14')])){_0x6c7454[_0x6cae('0x15')][_0x6cae('0x16')]({'where':{'id':_0x2b9ca2['WhatsappInteractionId']}})[_0x6cae('0x17')](function(_0x2996e8){if(_0x2996e8){_0x2996e8['update']({'lastMsgAt':_0x2b9ca2[_0x6cae('0x18')],'lastMsgDirection':_0x2b9ca2[_0x6cae('0x10')]['toLowerCase']()});}})[_0x6cae('0x19')](function(_0x439db7){console[_0x6cae('0x1a')](_0x439db7);});}if(_0x2b9ca2[_0x6cae('0x10')]===_0x6cae('0x1b')&&!_0x2b9ca2['secret']){var _0x141cbe;_0x6c7454['WhatsappAccount'][_0x6cae('0x1c')]({'where':{'id':_0x2b9ca2['WhatsappAccountId']},'raw':!![]})[_0x6cae('0x17')](function(_0x481c51){_0x141cbe=_0x481c51;if(_0x141cbe&&_0x141cbe[_0x6cae('0x1d')]){switch(_0x141cbe[_0x6cae('0x1d')]){case'twilio':var _0x57c5dd=require(_0x6cae('0x1e'));if(_0x141cbe[_0x6cae('0x1f')]&&_0x141cbe[_0x6cae('0x20')]&&_0x141cbe['phone']){var _0x1251bd=new _0x57c5dd(_0x141cbe[_0x6cae('0x1f')],_0x141cbe['authToken']);_0x1251bd['messages'][_0x6cae('0x21')]({'body':_0x2b9ca2[_0x6cae('0xd')],'to':_0x6cae('0x22')+_0x2b9ca2[_0x6cae('0x23')],'from':'whatsapp:'+_0x141cbe['phone'],'statusCallback':_0x141cbe[_0x6cae('0x24')]+'/api/whatsapp/messages/'+_0x2b9ca2['id']+_0x6cae('0x25')+_0x141cbe[_0x6cae('0x26')]})[_0x6cae('0x17')](function(_0x40afce){if(_0x40afce[_0x6cae('0x27')]){return _0x23912a[_0x6cae('0x28')]({'messageId':_0x40afce[_0x6cae('0x27')]});}})[_0x6cae('0x19')](function(_0x26d83a){logger['error'](_0x6cae('0x29'),'afterCreate',_0x6cae('0x1e'),util['inspect'](_0x26d83a,{'showHidden':![],'depth':null}));});}else{logger[_0x6cae('0x1a')](_0x6cae('0x29'),_0x6cae('0x2a'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x6cae('0x2b')](function(){_0x42a9c2();});}else{_0x42a9c2();}}},'charset':_0x6cae('0x2c'),'collate':_0x6cae('0x2d')});}; \ No newline at end of file +var _0x7451=['afterCreate','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','body','FULLTEXT','models','get','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','error','direction','WhatsappAccount','find','type','accountSid','authToken','phone','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','twilio','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s'];(function(_0x518de3,_0x57bc8d){var _0x465401=function(_0x2811e5){while(--_0x2811e5){_0x518de3['push'](_0x518de3['shift']());}};_0x465401(++_0x57bc8d);}(_0x7451,0x9c));var _0x1745=function(_0x1ccd9d,_0x24d8a4){_0x1ccd9d=_0x1ccd9d-0x0;var _0x331046=_0x7451[_0x1ccd9d];return _0x331046;};'use strict';var _=require(_0x1745('0x0'));var util=require(_0x1745('0x1'));var logger=require(_0x1745('0x2'))(_0x1745('0x3'));var moment=require(_0x1745('0x4'));var BPromise=require(_0x1745('0x5'));var rp=require(_0x1745('0x6'));var fs=require('fs');var path=require(_0x1745('0x7'));var rimraf=require('rimraf');var config=require(_0x1745('0x8'));var attributes=require(_0x1745('0x9'));module[_0x1745('0xa')]=function(_0xc52668,_0x48888f){return _0xc52668[_0x1745('0xb')](_0x1745('0xc'),attributes,{'tableName':_0x1745('0xd'),'paranoid':![],'indexes':[{'name':_0x1745('0xe'),'fields':['messageId']},{'name':'fti_whatsapp_messages','fields':[_0x1745('0xf')],'type':_0x1745('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x484155,_0x4f6a66,_0x23a49e){var _0x27f49b=_0xc52668[_0x1745('0x11')];var _0x304a90=_0x484155[_0x1745('0x12')]({'plain':!![]});if(_0x304a90['direction'][_0x1745('0x13')]()==='in'||_0x304a90['direction'][_0x1745('0x13')]()===_0x1745('0x14')&&!_0x304a90[_0x1745('0x15')]&&!_['isNil'](_0x304a90[_0x1745('0x16')])){_0x27f49b[_0x1745('0x17')][_0x1745('0x18')]({'where':{'id':_0x304a90['WhatsappInteractionId']}})[_0x1745('0x19')](function(_0x4863dd){if(_0x4863dd){_0x4863dd[_0x1745('0x1a')]({'lastMsgAt':_0x304a90[_0x1745('0x1b')],'lastMsgDirection':_0x304a90['direction'][_0x1745('0x13')]()});}})[_0x1745('0x1c')](function(_0x2fc3ea){console[_0x1745('0x1d')](_0x2fc3ea);});}if(_0x304a90[_0x1745('0x1e')]===_0x1745('0x14')&&!_0x304a90['secret']){var _0x27975a;_0x27f49b[_0x1745('0x1f')][_0x1745('0x20')]({'where':{'id':_0x304a90['WhatsappAccountId']},'raw':!![]})[_0x1745('0x19')](function(_0x2e9a7f){_0x27975a=_0x2e9a7f;if(_0x27975a&&_0x27975a['type']){switch(_0x27975a[_0x1745('0x21')]){case'twilio':var _0x10ac07=require('twilio');if(_0x27975a[_0x1745('0x22')]&&_0x27975a[_0x1745('0x23')]&&_0x27975a[_0x1745('0x24')]){var _0x5825ec=new _0x10ac07(_0x27975a[_0x1745('0x22')],_0x27975a['authToken']);_0x5825ec[_0x1745('0x25')][_0x1745('0x26')]({'body':_0x304a90[_0x1745('0xf')],'to':'whatsapp:'+_0x304a90[_0x1745('0x24')],'from':_0x1745('0x27')+_0x27975a[_0x1745('0x24')],'statusCallback':_0x27975a[_0x1745('0x28')]+_0x1745('0x29')+_0x304a90['id']+_0x1745('0x2a')+_0x27975a[_0x1745('0x2b')]})[_0x1745('0x19')](function(_0x5248f3){if(_0x5248f3['sid']){return _0x484155[_0x1745('0x1a')]({'messageId':_0x5248f3[_0x1745('0x2c')]});}})[_0x1745('0x1c')](function(_0x97d329){logger[_0x1745('0x1d')]('WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1745('0x2d'),util[_0x1745('0x2e')](_0x97d329,{'showHidden':![],'depth':null}));});}else{logger[_0x1745('0x1d')](_0x1745('0x2f'),_0x1745('0x30'),_0x1745('0x2d'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})['finally'](function(){_0x23a49e();});}else{_0x23a49e();}}},'charset':_0x1745('0x31'),'collate':_0x1745('0x32')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index a1a4648..3310263 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 _0xe2d0=['options','stringify','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','CreateWhatsappMessage','create','body'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe2d0,0x1a3));var _0x0e2d=function(_0x2e27c5,_0x34b2ed){_0x2e27c5=_0x2e27c5-0x0;var _0x3cf88a=_0xe2d0[_0x2e27c5];return _0x3cf88a;};'use strict';var _=require(_0x0e2d('0x0'));var util=require(_0x0e2d('0x1'));var moment=require(_0x0e2d('0x2'));var BPromise=require(_0x0e2d('0x3'));var rs=require(_0x0e2d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e2d('0x5'))['db'];var utils=require(_0x0e2d('0x6'));var logger=require(_0x0e2d('0x7'))(_0x0e2d('0x8'));var config=require(_0x0e2d('0x9'));var jayson=require(_0x0e2d('0xa'));var client=jayson[_0x0e2d('0xb')][_0x0e2d('0xc')]({'port':0x232a});config[_0x0e2d('0xd')]=_['defaults'](config[_0x0e2d('0xd')],{'host':_0x0e2d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0e2d('0xd')]));require(_0x0e2d('0xf'))[_0x0e2d('0x10')](socket);function respondWithRpcPromise(_0x1ea79a,_0x135574,_0x324d85){return new BPromise(function(_0x57ae71,_0x320810){return client['request'](_0x1ea79a,_0x324d85)[_0x0e2d('0x11')](function(_0x244b38){logger[_0x0e2d('0x12')](_0x0e2d('0x13'),_0x135574,_0x0e2d('0x14'));logger[_0x0e2d('0x15')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x135574,_0x0e2d('0x14'),JSON['stringify'](_0x244b38));if(_0x244b38[_0x0e2d('0x16')]){if(_0x244b38['error'][_0x0e2d('0x17')]===0x1f4){logger[_0x0e2d('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x135574,_0x244b38[_0x0e2d('0x16')][_0x0e2d('0x18')]);return _0x320810(_0x244b38['error'][_0x0e2d('0x18')]);}logger[_0x0e2d('0x16')](_0x0e2d('0x13'),_0x135574,_0x244b38[_0x0e2d('0x16')]['message']);return _0x57ae71(_0x244b38['error'][_0x0e2d('0x18')]);}else{logger[_0x0e2d('0x12')](_0x0e2d('0x13'),_0x135574,_0x0e2d('0x14'));_0x57ae71(_0x244b38[_0x0e2d('0x19')][_0x0e2d('0x18')]);}})['catch'](function(_0x506450){logger[_0x0e2d('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x135574,_0x506450);_0x320810(_0x506450);});});}exports[_0x0e2d('0x1a')]=function(_0x35100e){var _0x3e0a02=this;return new Promise(function(_0x27a027,_0x40c13e){return db['WhatsappMessage'][_0x0e2d('0x1b')](_0x35100e[_0x0e2d('0x1c')],{'raw':_0x35100e[_0x0e2d('0x1d')]?_0x35100e[_0x0e2d('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x0e2d('0x11')](function(_0x44f98e){logger['info'](_0x0e2d('0x1a'),_0x35100e);logger[_0x0e2d('0x15')](_0x0e2d('0x1a'),_0x35100e,JSON[_0x0e2d('0x1e')](_0x44f98e));_0x27a027(_0x44f98e);})[_0x0e2d('0x1f')](function(_0x33546d){logger[_0x0e2d('0x16')]('CreateWhatsappMessage',_0x33546d[_0x0e2d('0x18')],_0x35100e);_0x40c13e(_0x3e0a02['error'](0x1f4,_0x33546d[_0x0e2d('0x18')]));});});}; \ No newline at end of file +var _0x4fd3=['create','body','options','raw','then','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage'];(function(_0x129c38,_0x2c0475){var _0x906b27=function(_0x19b550){while(--_0x19b550){_0x129c38['push'](_0x129c38['shift']());}};_0x906b27(++_0x2c0475);}(_0x4fd3,0xe5));var _0x34fd=function(_0x4bb149,_0x398231){_0x4bb149=_0x4bb149-0x0;var _0x552b31=_0x4fd3[_0x4bb149];return _0x552b31;};'use strict';var _=require(_0x34fd('0x0'));var util=require(_0x34fd('0x1'));var moment=require('moment');var BPromise=require(_0x34fd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34fd('0x3'))['db'];var utils=require(_0x34fd('0x4'));var logger=require(_0x34fd('0x5'))(_0x34fd('0x6'));var config=require('../../config/environment');var jayson=require(_0x34fd('0x7'));var client=jayson[_0x34fd('0x8')][_0x34fd('0x9')]({'port':0x232a});config['redis']=_[_0x34fd('0xa')](config[_0x34fd('0xb')],{'host':_0x34fd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x34fd('0xb')]));require('./whatsappMessage.socket')[_0x34fd('0xd')](socket);function respondWithRpcPromise(_0x418336,_0x57e141,_0xda84d9){return new BPromise(function(_0x4ee269,_0x3b376c){return client[_0x34fd('0xe')](_0x418336,_0xda84d9)['then'](function(_0x16b5f9){logger[_0x34fd('0xf')](_0x34fd('0x10'),_0x57e141,_0x34fd('0x11'));logger[_0x34fd('0x12')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x57e141,_0x34fd('0x11'),JSON[_0x34fd('0x13')](_0x16b5f9));if(_0x16b5f9[_0x34fd('0x14')]){if(_0x16b5f9[_0x34fd('0x14')][_0x34fd('0x15')]===0x1f4){logger[_0x34fd('0x14')](_0x34fd('0x10'),_0x57e141,_0x16b5f9[_0x34fd('0x14')]['message']);return _0x3b376c(_0x16b5f9[_0x34fd('0x14')][_0x34fd('0x16')]);}logger[_0x34fd('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x57e141,_0x16b5f9[_0x34fd('0x14')][_0x34fd('0x16')]);return _0x4ee269(_0x16b5f9[_0x34fd('0x14')][_0x34fd('0x16')]);}else{logger[_0x34fd('0xf')](_0x34fd('0x10'),_0x57e141,'request\x20sent');_0x4ee269(_0x16b5f9[_0x34fd('0x17')][_0x34fd('0x16')]);}})[_0x34fd('0x18')](function(_0x1e40c2){logger[_0x34fd('0x14')](_0x34fd('0x10'),_0x57e141,_0x1e40c2);_0x3b376c(_0x1e40c2);});});}exports[_0x34fd('0x19')]=function(_0x229510){var _0x11422d=this;return new Promise(function(_0x511b25,_0x344513){return db[_0x34fd('0x1a')][_0x34fd('0x1b')](_0x229510[_0x34fd('0x1c')],{'raw':_0x229510[_0x34fd('0x1d')]?_0x229510[_0x34fd('0x1d')][_0x34fd('0x1e')]===undefined?!![]:![]:!![]})[_0x34fd('0x1f')](function(_0x2fffaf){logger[_0x34fd('0xf')](_0x34fd('0x19'),_0x229510);logger[_0x34fd('0x12')](_0x34fd('0x19'),_0x229510,JSON[_0x34fd('0x13')](_0x2fffaf));_0x511b25(_0x2fffaf);})['catch'](function(_0x4968ec){logger['error'](_0x34fd('0x19'),_0x4968ec['message'],_0x229510);_0x344513(_0x11422d[_0x34fd('0x14')](0x1f4,_0x4968ec['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 7e410d5..8645aff 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 _0xab98=['remove','update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x1cc9c9,_0x9c9690){var _0x2eefba=function(_0x4ba4b4){while(--_0x4ba4b4){_0x1cc9c9['push'](_0x1cc9c9['shift']());}};_0x2eefba(++_0x9c9690);}(_0xab98,0x1c0));var _0x8ab9=function(_0x145ac7,_0x34f629){_0x145ac7=_0x145ac7-0x0;var _0xdd8ab3=_0xab98[_0x145ac7];return _0xdd8ab3;};'use strict';var WhatsappMessageEvents=require(_0x8ab9('0x0'));var events=[_0x8ab9('0x1'),_0x8ab9('0x2'),_0x8ab9('0x3')];function createListener(_0x1196a9,_0x1c0bf1){return function(_0x8692ac){_0x1c0bf1[_0x8ab9('0x4')](_0x1196a9,_0x8692ac);};}function removeListener(_0x516ebe,_0x4b6071){return function(){WhatsappMessageEvents[_0x8ab9('0x5')](_0x516ebe,_0x4b6071);};}exports[_0x8ab9('0x6')]=function(_0x47942e){for(var _0x3b321a=0x0,_0x1c9db7=events[_0x8ab9('0x7')];_0x3b321a<_0x1c9db7;_0x3b321a++){var _0x4e99ac=events[_0x3b321a];var _0x6dd0fd=createListener(_0x8ab9('0x8')+_0x4e99ac,_0x47942e);WhatsappMessageEvents['on'](_0x4e99ac,_0x6dd0fd);}}; \ No newline at end of file +var _0xc479=['whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x46a003,_0x12d65e){var _0x11c836=function(_0x18c2b7){while(--_0x18c2b7){_0x46a003['push'](_0x46a003['shift']());}};_0x11c836(++_0x12d65e);}(_0xc479,0xc7));var _0x9c47=function(_0x1dc812,_0x3918ea){_0x1dc812=_0x1dc812-0x0;var _0x413a1c=_0xc479[_0x1dc812];return _0x413a1c;};'use strict';var WhatsappMessageEvents=require(_0x9c47('0x0'));var events=[_0x9c47('0x1'),_0x9c47('0x2'),_0x9c47('0x3')];function createListener(_0x4aba99,_0x75e810){return function(_0x28464b){_0x75e810[_0x9c47('0x4')](_0x4aba99,_0x28464b);};}function removeListener(_0x265fdd,_0x4cffc1){return function(){WhatsappMessageEvents[_0x9c47('0x5')](_0x265fdd,_0x4cffc1);};}exports[_0x9c47('0x6')]=function(_0x2b63f8){for(var _0x27fe81=0x0,_0x4afc60=events[_0x9c47('0x7')];_0x27fe81<_0x4afc60;_0x27fe81++){var _0x3edddb=events[_0x27fe81];var _0xef238e=createListener(_0x9c47('0x8')+_0x3edddb,_0x2b63f8);WhatsappMessageEvents['on'](_0x3edddb,_0xef238e);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index c35704a..8261531 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 _0x6d70=['show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x2afacc,_0x3f7f54){var _0x5df7f=function(_0x46f775){while(--_0x46f775){_0x2afacc['push'](_0x2afacc['shift']());}};_0x5df7f(++_0x3f7f54);}(_0x6d70,0xe7));var _0x06d7=function(_0xda6c79,_0x33d237){_0xda6c79=_0xda6c79-0x0;var _0x37d374=_0x6d70[_0xda6c79];return _0x37d374;};'use strict';var multer=require(_0x06d7('0x0'));var util=require(_0x06d7('0x1'));var path=require(_0x06d7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x06d7('0x3')]();var auth=require(_0x06d7('0x4'));var interaction=require(_0x06d7('0x5'));var config=require('../../config/environment');var controller=require(_0x06d7('0x6'));router[_0x06d7('0x7')]('/',auth[_0x06d7('0x8')](),controller['index']);router[_0x06d7('0x7')](_0x06d7('0x9'),auth[_0x06d7('0x8')](),controller[_0x06d7('0xa')]);router[_0x06d7('0x7')](_0x06d7('0xb'),auth['isAuthenticated'](),controller[_0x06d7('0xc')]);router[_0x06d7('0x7')]('/:id/members',auth[_0x06d7('0x8')](),controller[_0x06d7('0xd')]);router[_0x06d7('0x7')](_0x06d7('0xe'),auth[_0x06d7('0x8')](),controller[_0x06d7('0xf')]);router[_0x06d7('0x7')](_0x06d7('0x10'),auth[_0x06d7('0x8')](),controller[_0x06d7('0x11')]);router[_0x06d7('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x06d7('0x13')]);router[_0x06d7('0x12')](_0x06d7('0x10'),auth[_0x06d7('0x8')](),controller[_0x06d7('0x14')]);router['put'](_0x06d7('0xb'),auth['isAuthenticated'](),controller[_0x06d7('0x15')]);router[_0x06d7('0x16')](_0x06d7('0xb'),auth[_0x06d7('0x8')](),controller[_0x06d7('0x17')]);router[_0x06d7('0x16')](_0x06d7('0xe'),auth[_0x06d7('0x8')](),controller[_0x06d7('0x18')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x06d7('0x19')]);module[_0x06d7('0x1a')]=router; \ No newline at end of file +var _0xa91e=['removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./whatsappQueue.controller','index','get','/describe','describe','/:id','isAuthenticated','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0xa91e,0x1c2));var _0xea91=function(_0x3c30d9,_0x2662cf){_0x3c30d9=_0x3c30d9-0x0;var _0x2ac0b9=_0xa91e[_0x3c30d9];return _0x2ac0b9;};'use strict';var multer=require(_0xea91('0x0'));var util=require(_0xea91('0x1'));var path=require(_0xea91('0x2'));var timeout=require(_0xea91('0x3'));var express=require(_0xea91('0x4'));var router=express[_0xea91('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xea91('0x6'));var controller=require(_0xea91('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xea91('0x8')]);router[_0xea91('0x9')](_0xea91('0xa'),auth['isAuthenticated'](),controller[_0xea91('0xb')]);router[_0xea91('0x9')](_0xea91('0xc'),auth[_0xea91('0xd')](),controller[_0xea91('0xe')]);router[_0xea91('0x9')](_0xea91('0xf'),auth[_0xea91('0xd')](),controller['getMembers']);router[_0xea91('0x9')](_0xea91('0x10'),auth[_0xea91('0xd')](),controller[_0xea91('0x11')]);router[_0xea91('0x9')](_0xea91('0x12'),auth[_0xea91('0xd')](),controller[_0xea91('0x13')]);router[_0xea91('0x14')]('/',auth[_0xea91('0xd')](),controller[_0xea91('0x15')]);router[_0xea91('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0xea91('0x16')]);router['post'](_0xea91('0x12'),auth[_0xea91('0xd')](),controller[_0xea91('0x17')]);router[_0xea91('0x18')](_0xea91('0xc'),auth[_0xea91('0xd')](),controller['update']);router[_0xea91('0x19')]('/:id',auth[_0xea91('0xd')](),controller['destroy']);router[_0xea91('0x19')](_0xea91('0x10'),auth[_0xea91('0xd')](),controller[_0xea91('0x1a')]);router[_0xea91('0x19')]('/:id/users',auth[_0xea91('0xd')](),controller['removeAgents']);module[_0xea91('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 7ee31c2..fab5812 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 _0x323c=['beepall','STRING','sequelize','exports','name','INTEGER','rrmemory'];(function(_0x9b884b,_0x42a726){var _0x22593c=function(_0x58dcd1){while(--_0x58dcd1){_0x9b884b['push'](_0x9b884b['shift']());}};_0x22593c(++_0x42a726);}(_0x323c,0x1de));var _0xc323=function(_0x2c753c,_0x3378e7){_0x2c753c=_0x2c753c-0x0;var _0x23ba20=_0x323c[_0x2c753c];return _0x23ba20;};'use strict';var Sequelize=require(_0xc323('0x0'));module[_0xc323('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc323('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc323('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xc323('0x4'),_0xc323('0x5'),'roundrobin')},'description':{'type':Sequelize[_0xc323('0x6')]}}; \ No newline at end of file +var _0x34f8=['ENUM','beepall','roundrobin','STRING','sequelize','exports','name','INTEGER'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x34f8,0xbc));var _0x834f=function(_0x235108,_0x4f6816){_0x235108=_0x235108-0x0;var _0x188b27=_0x34f8[_0x235108];return _0x188b27;};'use strict';var Sequelize=require(_0x834f('0x0'));module[_0x834f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x834f('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x834f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x834f('0x4')]('rrmemory',_0x834f('0x5'),_0x834f('0x6'))},'description':{'type':Sequelize[_0x834f('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 1738b56..07adc8e 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 _0x6b4a=['getTeams','Team','addTeams','ids','User','online','flatMap','sequelize','transaction','each','findOrCreate','removeTeams','Agents','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','emit','userWhatsappQueue:save','isArray','userWhatsappQueue:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','whatsappPause'];(function(_0x5053ff,_0x3fb835){var _0x2d4f6c=function(_0x5a6323){while(--_0x5a6323){_0x5053ff['push'](_0x5053ff['shift']());}};_0x2d4f6c(++_0x3fb835);}(_0x6b4a,0x147));var _0xa6b4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b4a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa6b4('0x0'));var emlformat=require(_0xa6b4('0x1'));var rimraf=require(_0xa6b4('0x2'));var zipdir=require(_0xa6b4('0x3'));var jsonpatch=require(_0xa6b4('0x4'));var rp=require('request-promise');var moment=require(_0xa6b4('0x5'));var BPromise=require(_0xa6b4('0x6'));var Mustache=require('mustache');var util=require(_0xa6b4('0x7'));var path=require(_0xa6b4('0x8'));var sox=require('sox');var csv=require(_0xa6b4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa6b4('0xa'));var squel=require(_0xa6b4('0xb'));var crypto=require(_0xa6b4('0xc'));var jsforce=require(_0xa6b4('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa6b4('0xe'));var Papa=require(_0xa6b4('0xf'));var Redis=require(_0xa6b4('0x10'));var authService=require(_0xa6b4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa6b4('0x12'));var hardwareService=require(_0xa6b4('0x13'));var logger=require(_0xa6b4('0x14'))(_0xa6b4('0x15'));var utils=require(_0xa6b4('0x16'));var config=require(_0xa6b4('0x17'));var db=require(_0xa6b4('0x18'))['db'];config['redis']=_['defaults'](config[_0xa6b4('0x19')],{'host':_0xa6b4('0x1a'),'port':0x18eb});var socket=require(_0xa6b4('0x1b'))(new Redis(config[_0xa6b4('0x19')]));require(_0xa6b4('0x1c'))[_0xa6b4('0x1d')](socket);function respondWithStatusCode(_0x55b6ec,_0x4c9944){_0x4c9944=_0x4c9944||0xcc;return function(_0x5bdb6d){if(_0x5bdb6d){return _0x55b6ec[_0xa6b4('0x1e')](_0x4c9944);}return _0x55b6ec[_0xa6b4('0x1f')](_0x4c9944)[_0xa6b4('0x20')]();};}function respondWithResult(_0x101068,_0x3d666c){_0x3d666c=_0x3d666c||0xc8;return function(_0x4a24fe){if(_0x4a24fe){return _0x101068[_0xa6b4('0x1f')](_0x3d666c)[_0xa6b4('0x21')](_0x4a24fe);}};}function respondWithFilteredResult(_0x3dfd7b,_0x16f53c){return function(_0x1e9a2f){if(_0x1e9a2f){var _0x290db6=_0x1e9a2f[_0xa6b4('0x22')],_0x5157e6=_0x16f53c[_0xa6b4('0x23')],_0x5438b6=_0x16f53c[_0xa6b4('0x23')]+_0x16f53c[_0xa6b4('0x24')],_0x1d0d9b;if(_0x5438b6>=_0x290db6){_0x5438b6=_0x290db6;_0x1d0d9b=0xc8;}else{_0x1d0d9b=0xce;}_0x3dfd7b[_0xa6b4('0x1f')](_0x1d0d9b);return _0x3dfd7b[_0xa6b4('0x25')](_0xa6b4('0x26'),_0x5157e6+'-'+_0x5438b6+'/'+_0x290db6)[_0xa6b4('0x21')](_0x1e9a2f);}return null;};}function patchUpdates(_0x170f10){return function(_0x21685a){try{jsonpatch[_0xa6b4('0x27')](_0x21685a,_0x170f10,!![]);}catch(_0x3f9dd3){return BPromise[_0xa6b4('0x28')](_0x3f9dd3);}return _0x21685a['save']();};}function saveUpdates(_0x5cfdcb,_0x1acaae){return function(_0x100124){if(_0x100124){return _0x100124[_0xa6b4('0x29')](_0x5cfdcb)[_0xa6b4('0x2a')](function(_0x5a76fb){return _0x5a76fb;});}return null;};}function removeEntity(_0x4277ce,_0x272996){return function(_0x2026a2){if(_0x2026a2){return _0x2026a2[_0xa6b4('0x2b')]()[_0xa6b4('0x2a')](function(){var _0x211f0a=_0x2026a2[_0xa6b4('0x2c')]({'plain':!![]});var _0x10ddf0=_0xa6b4('0x2d');return db[_0xa6b4('0x2e')][_0xa6b4('0x2b')]({'where':{'type':_0x10ddf0,'resourceId':_0x211f0a['id']}})[_0xa6b4('0x2a')](function(){return _0x2026a2;});})[_0xa6b4('0x2a')](function(){_0x4277ce[_0xa6b4('0x1f')](0xcc)[_0xa6b4('0x20')]();});}};}function handleEntityNotFound(_0x3781de,_0x150e54){return function(_0x3b7565){if(!_0x3b7565){_0x3781de[_0xa6b4('0x1e')](0x194);}return _0x3b7565;};}function handleError(_0x404f64,_0x3fe0dd){_0x3fe0dd=_0x3fe0dd||0x1f4;return function(_0x341cde){logger[_0xa6b4('0x2f')](_0x341cde[_0xa6b4('0x30')]);if(_0x341cde[_0xa6b4('0x31')]){delete _0x341cde[_0xa6b4('0x31')];}_0x404f64[_0xa6b4('0x1f')](_0x3fe0dd)[_0xa6b4('0x32')](_0x341cde);};}exports[_0xa6b4('0x33')]=function(_0x5df8a4,_0x423a2c){var _0x33ecac={},_0x2d7a65={},_0x5e9a8a={'count':0x0,'rows':[]};var _0x47ca5b=_[_0xa6b4('0x34')](db[_0xa6b4('0x35')]['rawAttributes'],function(_0x1fc27a){return{'name':_0x1fc27a[_0xa6b4('0x36')],'type':_0x1fc27a[_0xa6b4('0x37')][_0xa6b4('0x38')]};});_0x2d7a65[_0xa6b4('0x39')]=_['map'](_0x47ca5b,'name');_0x2d7a65['query']=_['keys'](_0x5df8a4[_0xa6b4('0x3a')]);_0x2d7a65[_0xa6b4('0x3b')]=_[_0xa6b4('0x3c')](_0x2d7a65['model'],_0x2d7a65['query']);_0x33ecac[_0xa6b4('0x3d')]=_[_0xa6b4('0x3c')](_0x2d7a65['model'],qs['fields'](_0x5df8a4['query'][_0xa6b4('0x3e')]));_0x33ecac['attributes']=_0x33ecac[_0xa6b4('0x3d')]['length']?_0x33ecac[_0xa6b4('0x3d')]:_0x2d7a65[_0xa6b4('0x39')];if(!_0x5df8a4['query'][_0xa6b4('0x3f')](_0xa6b4('0x40'))){_0x33ecac['limit']=qs[_0xa6b4('0x24')](_0x5df8a4[_0xa6b4('0x3a')][_0xa6b4('0x24')]);_0x33ecac[_0xa6b4('0x23')]=qs[_0xa6b4('0x23')](_0x5df8a4[_0xa6b4('0x3a')]['offset']);}_0x33ecac[_0xa6b4('0x41')]=qs[_0xa6b4('0x42')](_0x5df8a4[_0xa6b4('0x3a')][_0xa6b4('0x42')]);_0x33ecac[_0xa6b4('0x43')]=qs[_0xa6b4('0x3b')](_[_0xa6b4('0x44')](_0x5df8a4['query'],_0x2d7a65[_0xa6b4('0x3b')]),_0x47ca5b);if(_0x5df8a4[_0xa6b4('0x3a')][_0xa6b4('0x45')]){_0x33ecac[_0xa6b4('0x43')]=_[_0xa6b4('0x46')](_0x33ecac[_0xa6b4('0x43')],{'$or':_['map'](_0x47ca5b,function(_0x2924a0){if(_0x2924a0[_0xa6b4('0x37')]!==_0xa6b4('0x47')){var _0x4f2321={};_0x4f2321[_0x2924a0[_0xa6b4('0x31')]]={'$like':'%'+_0x5df8a4['query']['filter']+'%'};return _0x4f2321;}})});}_0x33ecac=_[_0xa6b4('0x46')]({},_0x33ecac,_0x5df8a4[_0xa6b4('0x48')]);var _0x1d8c33={'where':_0x33ecac[_0xa6b4('0x43')]};return db[_0xa6b4('0x35')]['count'](_0x1d8c33)[_0xa6b4('0x2a')](function(_0x46b80b){_0x5e9a8a[_0xa6b4('0x22')]=_0x46b80b;if(_0x5df8a4['query'][_0xa6b4('0x49')]){_0x33ecac[_0xa6b4('0x4a')]=[{'all':!![]}];}return db[_0xa6b4('0x35')][_0xa6b4('0x4b')](_0x33ecac);})[_0xa6b4('0x2a')](function(_0x41d55a){_0x5e9a8a[_0xa6b4('0x4c')]=_0x41d55a;return _0x5e9a8a;})['then'](respondWithFilteredResult(_0x423a2c,_0x33ecac))[_0xa6b4('0x4d')](handleError(_0x423a2c,null));};exports[_0xa6b4('0x4e')]=function(_0x12a8fa,_0x2527a9){var _0xfb7aa5={'raw':!![],'where':{'id':_0x12a8fa[_0xa6b4('0x4f')]['id']}},_0x4f7c0e={};_0x4f7c0e[_0xa6b4('0x39')]=_[_0xa6b4('0x50')](db[_0xa6b4('0x35')][_0xa6b4('0x51')]);_0x4f7c0e[_0xa6b4('0x3a')]=_[_0xa6b4('0x50')](_0x12a8fa['query']);_0x4f7c0e[_0xa6b4('0x3b')]=_[_0xa6b4('0x3c')](_0x4f7c0e[_0xa6b4('0x39')],_0x4f7c0e[_0xa6b4('0x3a')]);_0xfb7aa5[_0xa6b4('0x3d')]=_[_0xa6b4('0x3c')](_0x4f7c0e['model'],qs[_0xa6b4('0x3e')](_0x12a8fa[_0xa6b4('0x3a')][_0xa6b4('0x3e')]));_0xfb7aa5[_0xa6b4('0x3d')]=_0xfb7aa5[_0xa6b4('0x3d')][_0xa6b4('0x52')]?_0xfb7aa5['attributes']:_0x4f7c0e['model'];if(_0x12a8fa['query'][_0xa6b4('0x49')]){_0xfb7aa5[_0xa6b4('0x4a')]=[{'all':!![]}];}_0xfb7aa5=_[_0xa6b4('0x46')]({},_0xfb7aa5,_0x12a8fa['options']);return db['WhatsappQueue'][_0xa6b4('0x53')](_0xfb7aa5)['then'](handleEntityNotFound(_0x2527a9,null))[_0xa6b4('0x2a')](respondWithResult(_0x2527a9,null))[_0xa6b4('0x4d')](handleError(_0x2527a9,null));};exports['create']=function(_0x353f1a,_0x1a9442){return db[_0xa6b4('0x35')]['create'](_0x353f1a[_0xa6b4('0x54')],{})[_0xa6b4('0x2a')](function(_0x3cef91){var _0x2cb265=_0x353f1a[_0xa6b4('0x55')][_0xa6b4('0x2c')]({'plain':!![]});if(!_0x2cb265)throw new Error(_0xa6b4('0x56'));if(_0x2cb265[_0xa6b4('0x57')]===_0xa6b4('0x55')){var _0x3b3e39=_0x3cef91[_0xa6b4('0x2c')]({'plain':!![]});var _0x1c2d5d=_0xa6b4('0x2d');return db['UserProfileSection'][_0xa6b4('0x53')]({'where':{'name':_0x1c2d5d,'userProfileId':_0x2cb265[_0xa6b4('0x58')]},'raw':!![]})[_0xa6b4('0x2a')](function(_0x45a2f4){if(_0x45a2f4&&_0x45a2f4['autoAssociation']===0x0){return db[_0xa6b4('0x2e')]['create']({'name':_0x3b3e39['name'],'resourceId':_0x3b3e39['id'],'type':_0x45a2f4[_0xa6b4('0x31')],'sectionId':_0x45a2f4['id']},{})[_0xa6b4('0x2a')](function(){return _0x3cef91;});}else{return _0x3cef91;}})[_0xa6b4('0x4d')](function(_0xc2eae7){logger[_0xa6b4('0x2f')](_0xa6b4('0x59'),_0xc2eae7);throw _0xc2eae7;});}return _0x3cef91;})[_0xa6b4('0x2a')](respondWithResult(_0x1a9442,0xc9))[_0xa6b4('0x4d')](handleError(_0x1a9442,null));};exports['update']=function(_0x36e202,_0x2bc7c7){if(_0x36e202['body']['id']){delete _0x36e202[_0xa6b4('0x54')]['id'];}return db[_0xa6b4('0x35')][_0xa6b4('0x53')]({'where':{'id':_0x36e202['params']['id']}})[_0xa6b4('0x2a')](handleEntityNotFound(_0x2bc7c7,null))[_0xa6b4('0x2a')](saveUpdates(_0x36e202[_0xa6b4('0x54')],null))[_0xa6b4('0x2a')](respondWithResult(_0x2bc7c7,null))[_0xa6b4('0x4d')](handleError(_0x2bc7c7,null));};exports['destroy']=function(_0x43786d,_0x2cff8f){return db[_0xa6b4('0x35')][_0xa6b4('0x53')]({'where':{'id':_0x43786d[_0xa6b4('0x4f')]['id']}})[_0xa6b4('0x2a')](handleEntityNotFound(_0x2cff8f,null))['then'](removeEntity(_0x2cff8f,null))['catch'](handleError(_0x2cff8f,null));};exports['describe']=function(_0x1808fb,_0x10a608){return db[_0xa6b4('0x35')][_0xa6b4('0x5a')]()['then'](respondWithResult(_0x10a608,null))[_0xa6b4('0x4d')](handleError(_0x10a608,null));};exports[_0xa6b4('0x5b')]=function(_0x347d64,_0x48f465,_0x48ad81){var _0x4a576e={'raw':!![],'where':{}},_0x2c9d41={},_0x3152ea;return db['WhatsappQueue'][_0xa6b4('0x5c')]({'where':{'id':_0x347d64[_0xa6b4('0x4f')]['id']}})[_0xa6b4('0x2a')](handleEntityNotFound(_0x48f465,null))['then'](function(_0x56b0e1){if(_0x56b0e1){_0x3152ea=_0x56b0e1[_0xa6b4('0x2c')]({'plain':!![]});_0x2c9d41['model']=_[_0xa6b4('0x50')](db[_0xa6b4('0x5d')][_0xa6b4('0x51')]);_0x2c9d41[_0xa6b4('0x3a')]=_[_0xa6b4('0x50')](_0x347d64[_0xa6b4('0x3a')]);_0x2c9d41[_0xa6b4('0x3b')]=_[_0xa6b4('0x3c')](_0x2c9d41['model'],_0x2c9d41[_0xa6b4('0x3a')]);_0x4a576e[_0xa6b4('0x3d')]=_[_0xa6b4('0x3c')](_0x2c9d41['model'],qs[_0xa6b4('0x3e')](_0x347d64[_0xa6b4('0x3a')]['fields']));_0x4a576e[_0xa6b4('0x3d')]=_0x4a576e[_0xa6b4('0x3d')][_0xa6b4('0x52')]?_0x4a576e['attributes']:_0x2c9d41[_0xa6b4('0x39')];if(!_0x347d64[_0xa6b4('0x3a')][_0xa6b4('0x3f')](_0xa6b4('0x40'))){_0x4a576e[_0xa6b4('0x24')]=qs[_0xa6b4('0x24')](_0x347d64['query'][_0xa6b4('0x24')]);_0x4a576e[_0xa6b4('0x23')]=qs[_0xa6b4('0x23')](_0x347d64['query']['offset']);}_0x4a576e['order']=qs['sort'](_0x347d64['query']['sort']);_0x4a576e['where']=qs[_0xa6b4('0x3b')](_[_0xa6b4('0x44')](_0x347d64[_0xa6b4('0x3a')],_0x2c9d41[_0xa6b4('0x3b')]));_0x4a576e[_0xa6b4('0x43')]['WhatsappQueueId']=_0x56b0e1['id'];if(_0x347d64[_0xa6b4('0x3a')][_0xa6b4('0x45')]){_0x4a576e[_0xa6b4('0x43')]=_['merge'](_0x4a576e['where'],{'$or':_[_0xa6b4('0x34')](_0x4a576e[_0xa6b4('0x3d')],function(_0x4a2c25){var _0x15bb3b={};_0x15bb3b[_0x4a2c25]={'$like':'%'+_0x347d64[_0xa6b4('0x3a')][_0xa6b4('0x45')]+'%'};return _0x15bb3b;})});}_0x4a576e=_[_0xa6b4('0x46')]({},_0x4a576e,_0x347d64['options']);return db[_0xa6b4('0x5d')][_0xa6b4('0x4b')](_0x4a576e);}})[_0xa6b4('0x2a')](function(_0x4874c5){if(_0x4874c5){return db['User'][_0xa6b4('0x5e')]({'where':{'id':_[_0xa6b4('0x34')](_0x4874c5,_0xa6b4('0x5f')),'role':'agent'},'attributes':['id','name','whatsappPause',_0xa6b4('0x60'),_0xa6b4('0x61')]});}})[_0xa6b4('0x2a')](function(_0x417a68){if(_0x417a68){return{'count':_0x417a68['count'],'rows':_['map'](_0x417a68['rows'],function(_0x302191){return{'membername':_0x302191['name'],'UserId':_0x302191['id'],'queue_name':_0x3152ea[_0xa6b4('0x31')],'WhatsappQueueId':_0x3152ea['id'],'interface':util[_0xa6b4('0x62')](_0xa6b4('0x63'),_0xa6b4('0x64'),_0x302191[_0xa6b4('0x31')]),'penalty':0x0,'paused':_0x302191[_0xa6b4('0x65')],'createdAt':_0x302191[_0xa6b4('0x61')],'updatedAt':_0x302191[_0xa6b4('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa6b4('0x2a')](respondWithFilteredResult(_0x48f465,_0x4a576e))[_0xa6b4('0x4d')](handleError(_0x48f465,null));};exports[_0xa6b4('0x66')]=function(_0xb80652,_0x13e697,_0x3a78bb){var _0x4c0aef={};var _0x3d55d8={};var _0x52aa35;var _0x511f57;return db[_0xa6b4('0x35')][_0xa6b4('0x5c')]({'where':{'id':_0xb80652[_0xa6b4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x13e697,null))[_0xa6b4('0x2a')](function(_0x7c5f2a){if(_0x7c5f2a){_0x52aa35=_0x7c5f2a;_0x3d55d8['model']=_[_0xa6b4('0x50')](db[_0xa6b4('0x67')][_0xa6b4('0x51')]);_0x3d55d8[_0xa6b4('0x3a')]=_[_0xa6b4('0x50')](_0xb80652[_0xa6b4('0x3a')]);_0x3d55d8[_0xa6b4('0x3b')]=_[_0xa6b4('0x3c')](_0x3d55d8[_0xa6b4('0x39')],_0x3d55d8['query']);_0x4c0aef[_0xa6b4('0x3d')]=_[_0xa6b4('0x3c')](_0x3d55d8['model'],qs[_0xa6b4('0x3e')](_0xb80652['query'][_0xa6b4('0x3e')]));_0x4c0aef[_0xa6b4('0x3d')]=_0x4c0aef[_0xa6b4('0x3d')][_0xa6b4('0x52')]?_0x4c0aef[_0xa6b4('0x3d')]:_0x3d55d8[_0xa6b4('0x39')];_0x4c0aef['order']=qs[_0xa6b4('0x42')](_0xb80652[_0xa6b4('0x3a')][_0xa6b4('0x42')]);_0x4c0aef[_0xa6b4('0x43')]=qs[_0xa6b4('0x3b')](_['pick'](_0xb80652[_0xa6b4('0x3a')],_0x3d55d8[_0xa6b4('0x3b')]));if(_0xb80652[_0xa6b4('0x3a')][_0xa6b4('0x45')]){_0x4c0aef[_0xa6b4('0x43')]=_[_0xa6b4('0x46')](_0x4c0aef[_0xa6b4('0x43')],{'$or':_[_0xa6b4('0x34')](_0x4c0aef[_0xa6b4('0x3d')],function(_0x2a2f72){var _0x3af6a6={};_0x3af6a6[_0x2a2f72]={'$like':'%'+_0xb80652['query'][_0xa6b4('0x45')]+'%'};return _0x3af6a6;})});}_0x4c0aef=_[_0xa6b4('0x46')]({},_0x4c0aef,_0xb80652[_0xa6b4('0x48')]);return _0x52aa35['getTeams'](_0x4c0aef);}})[_0xa6b4('0x2a')](function(_0x3c8e58){if(_0x3c8e58){_0x511f57=_0x3c8e58[_0xa6b4('0x52')];if(!_0xb80652[_0xa6b4('0x3a')][_0xa6b4('0x3f')](_0xa6b4('0x40'))){_0x4c0aef['limit']=qs[_0xa6b4('0x24')](_0xb80652[_0xa6b4('0x3a')][_0xa6b4('0x24')]);_0x4c0aef[_0xa6b4('0x23')]=qs['offset'](_0xb80652[_0xa6b4('0x3a')][_0xa6b4('0x23')]);}return _0x52aa35[_0xa6b4('0x66')](_0x4c0aef);}})[_0xa6b4('0x2a')](function(_0x39a8de){if(_0x39a8de){return _0x39a8de?{'count':_0x511f57,'rows':_0x39a8de}:null;}})[_0xa6b4('0x2a')](respondWithResult(_0x13e697,null))[_0xa6b4('0x4d')](handleError(_0x13e697,null));};exports[_0xa6b4('0x68')]=function(_0x52203a,_0x395df7,_0x6ee1fa){var _0x13327a=_0x52203a[_0xa6b4('0x54')][_0xa6b4('0x69')];return db[_0xa6b4('0x67')][_0xa6b4('0x4b')]({'where':{'id':_0x13327a},'attributes':['id'],'include':[{'model':db[_0xa6b4('0x6a')],'as':'Agents','attributes':['id',_0xa6b4('0x31'),_0xa6b4('0x6b'),'voicePause','interface'],'raw':!![]}]})[_0xa6b4('0x2a')](function(_0x5291d8){if(_0x5291d8){var _0x553984=_[_0xa6b4('0x6c')](_0x5291d8,function(_0xa06813){var _0x6e09ba=_0xa06813[_0xa6b4('0x2c')]({'plain':!![]});return _0x6e09ba['Agents'];});return db[_0xa6b4('0x35')]['find']({'where':{'id':_0x52203a[_0xa6b4('0x4f')]['id']}})[_0xa6b4('0x2a')](function(_0x9ed271){return db[_0xa6b4('0x6d')][_0xa6b4('0x6e')](function(_0x717ed0){return _0x9ed271[_0xa6b4('0x68')](_0x13327a,{'transaction':_0x717ed0})[_0xa6b4('0x2a')](function(){return BPromise[_0xa6b4('0x6f')](_0x553984,function(_0xb8c926){return db['UserWhatsappQueue'][_0xa6b4('0x70')]({'where':{'UserId':_0xb8c926['id'],'WhatsappQueueId':_0x52203a['params']['id']},'transaction':_0x717ed0});});})[_0xa6b4('0x2a')](function(){_0x553984['forEach'](function(_0x2185dc){socket['emit']('userWhatsappQueue:save',{'UserId':_0x2185dc['id'],'WhatsappQueueId':_0x9ed271['id']});});});});});}})[_0xa6b4('0x2a')](respondWithStatusCode(_0x395df7,null))[_0xa6b4('0x4d')](handleError(_0x395df7,null));};exports[_0xa6b4('0x71')]=function(_0x48955f,_0x56c9c1,_0x26e6c4){return db[_0xa6b4('0x67')]['findAll']({'where':{'id':_0x48955f[_0xa6b4('0x3a')][_0xa6b4('0x69')]},'attributes':['id'],'include':[{'model':db[_0xa6b4('0x6a')],'as':_0xa6b4('0x72'),'attributes':['id'],'raw':!![]}]})[_0xa6b4('0x2a')](handleEntityNotFound(_0x56c9c1,null))[_0xa6b4('0x2a')](function(_0x359a28){var _0x417fa7=_[_0xa6b4('0x34')](_0x359a28,'id');var _0x1de1f1=[];var _0x58bc46=[];var _0x1338e0=squel[_0xa6b4('0x73')]();_0x1338e0['field'](_0xa6b4('0x74'))[_0xa6b4('0x75')]('team_has_whatsapp_queues','tq')[_0xa6b4('0x76')](_0xa6b4('0x77'),'ut',_0xa6b4('0x78'))[_0xa6b4('0x43')](_0xa6b4('0x79'),_0x48955f[_0xa6b4('0x4f')]['id']);for(var _0x31d8d9=0x0;_0x31d8d9<_0x359a28['length'];_0x31d8d9+=0x1){let _0x5b6d91=_0x359a28[_0x31d8d9];for(var _0x3ff6d9=0x0;_0x3ff6d9<_0x5b6d91['Agents'][_0xa6b4('0x52')];_0x3ff6d9+=0x1){let _0x49a29b=_0x5b6d91[_0xa6b4('0x72')][_0x3ff6d9];var _0x135646=_0x1338e0[_0xa6b4('0x7a')]();_0x135646[_0xa6b4('0x43')](_0xa6b4('0x7b'),_0x49a29b['id']);_0x58bc46[_0xa6b4('0x7c')](db[_0xa6b4('0x6d')][_0xa6b4('0x3a')](_0x135646[_0xa6b4('0x7d')](),{'type':db[_0xa6b4('0x6d')][_0xa6b4('0x7e')][_0xa6b4('0x7f')]})[_0xa6b4('0x2a')](function(_0x393e71){if(_0x393e71[_0xa6b4('0x52')]===0x1){return _0x49a29b['id'];}else{var _0x30b2be=_[_0xa6b4('0x80')](_[_0xa6b4('0x34')](_0x393e71,_0xa6b4('0x81')),function(_0x532d0c){return _['includes'](_0x417fa7,_0x532d0c);});if(_0x30b2be){return _0x49a29b['id'];}}}));}}return BPromise[_0xa6b4('0x82')](_0x58bc46)[_0xa6b4('0x2a')](function(_0x10ddbe){_0x1de1f1=_(_0x1de1f1)[_0xa6b4('0x83')](_0x10ddbe)[_0xa6b4('0x84')]()[_0xa6b4('0x85')]();return db[_0xa6b4('0x35')][_0xa6b4('0x53')]({'where':{'id':_0x48955f['params']['id']}})['then'](function(_0x4b519b){return db[_0xa6b4('0x6d')]['transaction'](function(_0x87b333){return _0x4b519b[_0xa6b4('0x71')](_0x48955f[_0xa6b4('0x3a')][_0xa6b4('0x69')],{'transaction':_0x87b333})[_0xa6b4('0x2a')](function(){if(!_[_0xa6b4('0x86')](_0x1de1f1)){return _0x4b519b[_0xa6b4('0x87')](_0x1de1f1,{'transaction':_0x87b333});}})['then'](function(){_0x1de1f1['forEach'](function(_0x52c8a8){socket['emit']('userWhatsappQueue:remove',{'UserId':_0x52c8a8,'WhatsappQueueId':_0x4b519b['id']});});});});});});})[_0xa6b4('0x2a')](respondWithStatusCode(_0x56c9c1,null))[_0xa6b4('0x4d')](handleError(_0x56c9c1,null));};exports[_0xa6b4('0x88')]=function(_0x4446da,_0x1af549,_0x51c805){return db[_0xa6b4('0x35')][_0xa6b4('0x53')]({'where':{'id':_0x4446da[_0xa6b4('0x4f')]['id']}})[_0xa6b4('0x2a')](handleEntityNotFound(_0x1af549,null))['then'](function(_0x2d5807){if(_0x2d5807){return _0x2d5807[_0xa6b4('0x88')](_0x4446da[_0xa6b4('0x54')][_0xa6b4('0x69')],_[_0xa6b4('0x89')](_0x4446da[_0xa6b4('0x54')],[_0xa6b4('0x69'),'id'])||{})['spread'](function(_0x3734da){for(var _0x4245d6=0x0;_0x4245d6<_0x4446da[_0xa6b4('0x54')][_0xa6b4('0x69')][_0xa6b4('0x52')];_0x4245d6+=0x1){socket[_0xa6b4('0x8a')](_0xa6b4('0x8b'),{'UserId':_0x4446da[_0xa6b4('0x54')]['ids'][_0x4245d6],'WhatsappQueueId':_0x4446da[_0xa6b4('0x4f')]['id']});}return _0x3734da;});}})[_0xa6b4('0x2a')](respondWithResult(_0x1af549,null))['catch'](handleError(_0x1af549,null));};exports[_0xa6b4('0x87')]=function(_0x4f0590,_0x226920,_0x5c5e9b){return db[_0xa6b4('0x35')]['find']({'where':{'id':_0x4f0590[_0xa6b4('0x4f')]['id']}})['then'](handleEntityNotFound(_0x226920,null))['then'](function(_0x576266){if(_0x576266){return _0x576266[_0xa6b4('0x87')](_0x4f0590[_0xa6b4('0x3a')]['ids'])[_0xa6b4('0x2a')](function(){if(_[_0xa6b4('0x8c')](_0x4f0590[_0xa6b4('0x3a')][_0xa6b4('0x69')])){for(var _0x438bc4=0x0;_0x438bc4<_0x4f0590['query'][_0xa6b4('0x69')][_0xa6b4('0x52')];_0x438bc4+=0x1){socket[_0xa6b4('0x8a')](_0xa6b4('0x8d'),{'UserId':Number(_0x4f0590[_0xa6b4('0x3a')]['ids'][_0x438bc4]),'WhatsappQueueId':Number(_0x4f0590[_0xa6b4('0x4f')]['id'])});}}else{socket[_0xa6b4('0x8a')](_0xa6b4('0x8d'),{'UserId':Number(_0x4f0590['query'][_0xa6b4('0x69')]),'WhatsappQueueId':Number(_0x4f0590[_0xa6b4('0x4f')]['id'])});}});}})[_0xa6b4('0x2a')](respondWithStatusCode(_0x226920,null))['catch'](handleError(_0x226920,null));};exports[_0xa6b4('0x8e')]=function(_0x588b5b,_0x41c277,_0x591c2c){var _0x5da003={};var _0x4001ad={};var _0x2083ea;var _0x58d039;return db['WhatsappQueue'][_0xa6b4('0x5c')]({'where':{'id':_0x588b5b[_0xa6b4('0x4f')]['id']}})[_0xa6b4('0x2a')](handleEntityNotFound(_0x41c277,null))[_0xa6b4('0x2a')](function(_0x4f0e91){if(_0x4f0e91){_0x2083ea=_0x4f0e91;_0x4001ad['model']=_['keys'](db[_0xa6b4('0x6a')][_0xa6b4('0x51')]);_0x4001ad['query']=_[_0xa6b4('0x50')](_0x588b5b['query']);_0x4001ad[_0xa6b4('0x3b')]=_[_0xa6b4('0x3c')](_0x4001ad[_0xa6b4('0x39')],_0x4001ad[_0xa6b4('0x3a')]);_0x5da003['attributes']=_[_0xa6b4('0x3c')](_0x4001ad[_0xa6b4('0x39')],qs[_0xa6b4('0x3e')](_0x588b5b['query'][_0xa6b4('0x3e')]));_0x5da003[_0xa6b4('0x3d')]=_0x5da003['attributes'][_0xa6b4('0x52')]?_0x5da003[_0xa6b4('0x3d')]:_0x4001ad['model'];_0x5da003[_0xa6b4('0x41')]=qs[_0xa6b4('0x42')](_0x588b5b[_0xa6b4('0x3a')][_0xa6b4('0x42')]);_0x5da003['where']=qs['filters'](_[_0xa6b4('0x44')](_0x588b5b[_0xa6b4('0x3a')],_0x4001ad['filters']));if(_0x588b5b[_0xa6b4('0x3a')][_0xa6b4('0x45')]){_0x5da003[_0xa6b4('0x43')]=_[_0xa6b4('0x46')](_0x5da003[_0xa6b4('0x43')],{'$or':_['map'](_0x5da003[_0xa6b4('0x3d')],function(_0x52f24c){var _0x267bdc={};_0x267bdc[_0x52f24c]={'$like':'%'+_0x588b5b['query'][_0xa6b4('0x45')]+'%'};return _0x267bdc;})});}_0x5da003=_[_0xa6b4('0x46')]({},_0x5da003,_0x588b5b[_0xa6b4('0x48')]);return _0x2083ea[_0xa6b4('0x8e')](_0x5da003);}})[_0xa6b4('0x2a')](function(_0x499d56){if(_0x499d56){_0x58d039=_0x499d56[_0xa6b4('0x52')];if(!_0x588b5b[_0xa6b4('0x3a')][_0xa6b4('0x3f')]('nolimit')){_0x5da003[_0xa6b4('0x24')]=qs[_0xa6b4('0x24')](_0x588b5b['query'][_0xa6b4('0x24')]);_0x5da003[_0xa6b4('0x23')]=qs[_0xa6b4('0x23')](_0x588b5b[_0xa6b4('0x3a')][_0xa6b4('0x23')]);}return _0x2083ea[_0xa6b4('0x8e')](_0x5da003);}})[_0xa6b4('0x2a')](function(_0x9ef8a5){if(_0x9ef8a5){return _0x9ef8a5?{'count':_0x58d039,'rows':_0x9ef8a5}:null;}})[_0xa6b4('0x2a')](respondWithResult(_0x41c277,null))[_0xa6b4('0x4d')](handleError(_0x41c277,null));}; \ No newline at end of file +var _0xc3f0=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','get','WhatsappQueues','UserProfileResource','destroy','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','keys','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','find','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','nolimit','pick','WhatsappQueueId','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','voicePause','interface','findOrCreate','emit','userWhatsappQueue:save','removeTeams','Agents','select','tq.TeamId','from','join','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','includes','all','union','transaction','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x56437f,_0x4737e3){var _0xdf3f8c=function(_0x4a0c43){while(--_0x4a0c43){_0x56437f['push'](_0x56437f['shift']());}};_0xdf3f8c(++_0x4737e3);}(_0xc3f0,0x18c));var _0x0c3f=function(_0x7ff6f8,_0x1bf423){_0x7ff6f8=_0x7ff6f8-0x0;var _0x40be34=_0xc3f0[_0x7ff6f8];return _0x40be34;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0c3f('0x0'));var rimraf=require(_0x0c3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0c3f('0x2'));var rp=require(_0x0c3f('0x3'));var moment=require('moment');var BPromise=require(_0x0c3f('0x4'));var Mustache=require(_0x0c3f('0x5'));var util=require(_0x0c3f('0x6'));var path=require(_0x0c3f('0x7'));var sox=require('sox');var csv=require(_0x0c3f('0x8'));var ejs=require(_0x0c3f('0x9'));var fs=require('fs');var _=require(_0x0c3f('0xa'));var squel=require(_0x0c3f('0xb'));var crypto=require(_0x0c3f('0xc'));var jsforce=require(_0x0c3f('0xd'));var deskjs=require(_0x0c3f('0xe'));var toCsv=require(_0x0c3f('0x8'));var querystring=require(_0x0c3f('0xf'));var Papa=require(_0x0c3f('0x10'));var Redis=require('ioredis');var authService=require(_0x0c3f('0x11'));var qs=require(_0x0c3f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c3f('0x13'));var logger=require(_0x0c3f('0x14'))('api');var utils=require(_0x0c3f('0x15'));var config=require(_0x0c3f('0x16'));var db=require('../../mysqldb')['db'];config[_0x0c3f('0x17')]=_[_0x0c3f('0x18')](config[_0x0c3f('0x17')],{'host':_0x0c3f('0x19'),'port':0x18eb});var socket=require(_0x0c3f('0x1a'))(new Redis(config[_0x0c3f('0x17')]));require(_0x0c3f('0x1b'))[_0x0c3f('0x1c')](socket);function respondWithStatusCode(_0xce398a,_0x3d5b7a){_0x3d5b7a=_0x3d5b7a||0xcc;return function(_0x476b03){if(_0x476b03){return _0xce398a[_0x0c3f('0x1d')](_0x3d5b7a);}return _0xce398a[_0x0c3f('0x1e')](_0x3d5b7a)[_0x0c3f('0x1f')]();};}function respondWithResult(_0x31f713,_0x4ee645){_0x4ee645=_0x4ee645||0xc8;return function(_0x1d1630){if(_0x1d1630){return _0x31f713['status'](_0x4ee645)[_0x0c3f('0x20')](_0x1d1630);}};}function respondWithFilteredResult(_0x3ff1ba,_0x34849a){return function(_0x4723ae){if(_0x4723ae){var _0x399606=_0x4723ae[_0x0c3f('0x21')],_0x10aa81=_0x34849a[_0x0c3f('0x22')],_0x4cc8df=_0x34849a[_0x0c3f('0x22')]+_0x34849a[_0x0c3f('0x23')],_0x26c46e;if(_0x4cc8df>=_0x399606){_0x4cc8df=_0x399606;_0x26c46e=0xc8;}else{_0x26c46e=0xce;}_0x3ff1ba[_0x0c3f('0x1e')](_0x26c46e);return _0x3ff1ba[_0x0c3f('0x24')](_0x0c3f('0x25'),_0x10aa81+'-'+_0x4cc8df+'/'+_0x399606)[_0x0c3f('0x20')](_0x4723ae);}return null;};}function patchUpdates(_0x5f6676){return function(_0x54d4d8){try{jsonpatch[_0x0c3f('0x26')](_0x54d4d8,_0x5f6676,!![]);}catch(_0x204b7f){return BPromise['reject'](_0x204b7f);}return _0x54d4d8[_0x0c3f('0x27')]();};}function saveUpdates(_0xefa8de,_0x35e166){return function(_0x434b08){if(_0x434b08){return _0x434b08['update'](_0xefa8de)['then'](function(_0x2977d1){return _0x2977d1;});}return null;};}function removeEntity(_0x36ca1f,_0x58dd84){return function(_0x4c7f13){if(_0x4c7f13){return _0x4c7f13['destroy']()[_0x0c3f('0x28')](function(){var _0x198ac6=_0x4c7f13[_0x0c3f('0x29')]({'plain':!![]});var _0x4ca8bb=_0x0c3f('0x2a');return db[_0x0c3f('0x2b')][_0x0c3f('0x2c')]({'where':{'type':_0x4ca8bb,'resourceId':_0x198ac6['id']}})[_0x0c3f('0x28')](function(){return _0x4c7f13;});})[_0x0c3f('0x28')](function(){_0x36ca1f[_0x0c3f('0x1e')](0xcc)[_0x0c3f('0x1f')]();});}};}function handleEntityNotFound(_0x4a711c,_0x5e1b9f){return function(_0x35c7eb){if(!_0x35c7eb){_0x4a711c[_0x0c3f('0x1d')](0x194);}return _0x35c7eb;};}function handleError(_0x26b3a6,_0x4a9a1a){_0x4a9a1a=_0x4a9a1a||0x1f4;return function(_0x3c746c){logger['error'](_0x3c746c['stack']);if(_0x3c746c['name']){delete _0x3c746c[_0x0c3f('0x2d')];}_0x26b3a6[_0x0c3f('0x1e')](_0x4a9a1a)[_0x0c3f('0x2e')](_0x3c746c);};}exports[_0x0c3f('0x2f')]=function(_0x2ba99f,_0x2c7e7f){var _0x432090={},_0x5e9ffe={},_0x49b592={'count':0x0,'rows':[]};var _0x4f2ab5=_[_0x0c3f('0x30')](db[_0x0c3f('0x31')][_0x0c3f('0x32')],function(_0x36aab2){return{'name':_0x36aab2[_0x0c3f('0x33')],'type':_0x36aab2[_0x0c3f('0x34')]['key']};});_0x5e9ffe[_0x0c3f('0x35')]=_[_0x0c3f('0x30')](_0x4f2ab5,_0x0c3f('0x2d'));_0x5e9ffe['query']=_['keys'](_0x2ba99f['query']);_0x5e9ffe[_0x0c3f('0x36')]=_[_0x0c3f('0x37')](_0x5e9ffe['model'],_0x5e9ffe[_0x0c3f('0x38')]);_0x432090[_0x0c3f('0x39')]=_[_0x0c3f('0x37')](_0x5e9ffe['model'],qs['fields'](_0x2ba99f[_0x0c3f('0x38')][_0x0c3f('0x3a')]));_0x432090[_0x0c3f('0x39')]=_0x432090[_0x0c3f('0x39')][_0x0c3f('0x3b')]?_0x432090['attributes']:_0x5e9ffe[_0x0c3f('0x35')];if(!_0x2ba99f[_0x0c3f('0x38')]['hasOwnProperty']('nolimit')){_0x432090[_0x0c3f('0x23')]=qs[_0x0c3f('0x23')](_0x2ba99f[_0x0c3f('0x38')][_0x0c3f('0x23')]);_0x432090[_0x0c3f('0x22')]=qs[_0x0c3f('0x22')](_0x2ba99f[_0x0c3f('0x38')][_0x0c3f('0x22')]);}_0x432090[_0x0c3f('0x3c')]=qs[_0x0c3f('0x3d')](_0x2ba99f[_0x0c3f('0x38')]['sort']);_0x432090[_0x0c3f('0x3e')]=qs[_0x0c3f('0x36')](_['pick'](_0x2ba99f[_0x0c3f('0x38')],_0x5e9ffe['filters']),_0x4f2ab5);if(_0x2ba99f[_0x0c3f('0x38')][_0x0c3f('0x3f')]){_0x432090[_0x0c3f('0x3e')]=_[_0x0c3f('0x40')](_0x432090[_0x0c3f('0x3e')],{'$or':_[_0x0c3f('0x30')](_0x4f2ab5,function(_0x494ff3){if(_0x494ff3[_0x0c3f('0x34')]!==_0x0c3f('0x41')){var _0x16f002={};_0x16f002[_0x494ff3[_0x0c3f('0x2d')]]={'$like':'%'+_0x2ba99f[_0x0c3f('0x38')][_0x0c3f('0x3f')]+'%'};return _0x16f002;}})});}_0x432090=_[_0x0c3f('0x40')]({},_0x432090,_0x2ba99f['options']);var _0x16b214={'where':_0x432090[_0x0c3f('0x3e')]};return db['WhatsappQueue'][_0x0c3f('0x21')](_0x16b214)[_0x0c3f('0x28')](function(_0x3a4393){_0x49b592[_0x0c3f('0x21')]=_0x3a4393;if(_0x2ba99f[_0x0c3f('0x38')][_0x0c3f('0x42')]){_0x432090[_0x0c3f('0x43')]=[{'all':!![]}];}return db['WhatsappQueue']['findAll'](_0x432090);})[_0x0c3f('0x28')](function(_0x5dc1ca){_0x49b592[_0x0c3f('0x44')]=_0x5dc1ca;return _0x49b592;})[_0x0c3f('0x28')](respondWithFilteredResult(_0x2c7e7f,_0x432090))[_0x0c3f('0x45')](handleError(_0x2c7e7f,null));};exports[_0x0c3f('0x46')]=function(_0xf27552,_0x2b0071){var _0x1d5ade={'raw':!![],'where':{'id':_0xf27552['params']['id']}},_0x5c5b32={};_0x5c5b32[_0x0c3f('0x35')]=_[_0x0c3f('0x47')](db[_0x0c3f('0x31')][_0x0c3f('0x32')]);_0x5c5b32[_0x0c3f('0x38')]=_[_0x0c3f('0x47')](_0xf27552[_0x0c3f('0x38')]);_0x5c5b32[_0x0c3f('0x36')]=_[_0x0c3f('0x37')](_0x5c5b32[_0x0c3f('0x35')],_0x5c5b32['query']);_0x1d5ade['attributes']=_[_0x0c3f('0x37')](_0x5c5b32[_0x0c3f('0x35')],qs['fields'](_0xf27552['query'][_0x0c3f('0x3a')]));_0x1d5ade[_0x0c3f('0x39')]=_0x1d5ade[_0x0c3f('0x39')]['length']?_0x1d5ade[_0x0c3f('0x39')]:_0x5c5b32['model'];if(_0xf27552[_0x0c3f('0x38')][_0x0c3f('0x42')]){_0x1d5ade[_0x0c3f('0x43')]=[{'all':!![]}];}_0x1d5ade=_[_0x0c3f('0x40')]({},_0x1d5ade,_0xf27552[_0x0c3f('0x48')]);return db[_0x0c3f('0x31')]['find'](_0x1d5ade)['then'](handleEntityNotFound(_0x2b0071,null))[_0x0c3f('0x28')](respondWithResult(_0x2b0071,null))['catch'](handleError(_0x2b0071,null));};exports[_0x0c3f('0x49')]=function(_0x581f3d,_0x291dbc){return db[_0x0c3f('0x31')]['create'](_0x581f3d['body'],{})[_0x0c3f('0x28')](function(_0x45d8bf){var _0x22b4e5=_0x581f3d[_0x0c3f('0x4a')][_0x0c3f('0x29')]({'plain':!![]});if(!_0x22b4e5)throw new Error(_0x0c3f('0x4b'));if(_0x22b4e5[_0x0c3f('0x4c')]===_0x0c3f('0x4a')){var _0x3b9d9b=_0x45d8bf[_0x0c3f('0x29')]({'plain':!![]});var _0x5eed47=_0x0c3f('0x2a');return db[_0x0c3f('0x4d')]['find']({'where':{'name':_0x5eed47,'userProfileId':_0x22b4e5['userProfileId']},'raw':!![]})['then'](function(_0x2352c7){if(_0x2352c7&&_0x2352c7[_0x0c3f('0x4e')]===0x0){return db[_0x0c3f('0x2b')][_0x0c3f('0x49')]({'name':_0x3b9d9b['name'],'resourceId':_0x3b9d9b['id'],'type':_0x2352c7[_0x0c3f('0x2d')],'sectionId':_0x2352c7['id']},{})[_0x0c3f('0x28')](function(){return _0x45d8bf;});}else{return _0x45d8bf;}})['catch'](function(_0x56dd59){logger[_0x0c3f('0x4f')](_0x0c3f('0x50'),_0x56dd59);throw _0x56dd59;});}return _0x45d8bf;})['then'](respondWithResult(_0x291dbc,0xc9))['catch'](handleError(_0x291dbc,null));};exports['update']=function(_0x3f0120,_0x4ae5e6){if(_0x3f0120[_0x0c3f('0x51')]['id']){delete _0x3f0120[_0x0c3f('0x51')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x3f0120[_0x0c3f('0x52')]['id']}})[_0x0c3f('0x28')](handleEntityNotFound(_0x4ae5e6,null))[_0x0c3f('0x28')](saveUpdates(_0x3f0120[_0x0c3f('0x51')],null))[_0x0c3f('0x28')](respondWithResult(_0x4ae5e6,null))[_0x0c3f('0x45')](handleError(_0x4ae5e6,null));};exports[_0x0c3f('0x2c')]=function(_0x541e05,_0x4c06b1){return db[_0x0c3f('0x31')][_0x0c3f('0x53')]({'where':{'id':_0x541e05[_0x0c3f('0x52')]['id']}})[_0x0c3f('0x28')](handleEntityNotFound(_0x4c06b1,null))[_0x0c3f('0x28')](removeEntity(_0x4c06b1,null))[_0x0c3f('0x45')](handleError(_0x4c06b1,null));};exports[_0x0c3f('0x54')]=function(_0x34d33e,_0xa5f729){return db['WhatsappQueue'][_0x0c3f('0x54')]()[_0x0c3f('0x28')](respondWithResult(_0xa5f729,null))['catch'](handleError(_0xa5f729,null));};exports[_0x0c3f('0x55')]=function(_0x6859d1,_0x4bd0a3,_0x407216){var _0x3f9faa={'raw':!![],'where':{}},_0x2e4f99={},_0x262640;return db[_0x0c3f('0x31')][_0x0c3f('0x56')]({'where':{'id':_0x6859d1[_0x0c3f('0x52')]['id']}})[_0x0c3f('0x28')](handleEntityNotFound(_0x4bd0a3,null))['then'](function(_0xe5e294){if(_0xe5e294){_0x262640=_0xe5e294[_0x0c3f('0x29')]({'plain':!![]});_0x2e4f99[_0x0c3f('0x35')]=_[_0x0c3f('0x47')](db[_0x0c3f('0x57')][_0x0c3f('0x32')]);_0x2e4f99[_0x0c3f('0x38')]=_[_0x0c3f('0x47')](_0x6859d1['query']);_0x2e4f99[_0x0c3f('0x36')]=_['intersection'](_0x2e4f99[_0x0c3f('0x35')],_0x2e4f99[_0x0c3f('0x38')]);_0x3f9faa[_0x0c3f('0x39')]=_[_0x0c3f('0x37')](_0x2e4f99[_0x0c3f('0x35')],qs[_0x0c3f('0x3a')](_0x6859d1['query']['fields']));_0x3f9faa[_0x0c3f('0x39')]=_0x3f9faa[_0x0c3f('0x39')][_0x0c3f('0x3b')]?_0x3f9faa[_0x0c3f('0x39')]:_0x2e4f99[_0x0c3f('0x35')];if(!_0x6859d1['query'][_0x0c3f('0x58')](_0x0c3f('0x59'))){_0x3f9faa[_0x0c3f('0x23')]=qs[_0x0c3f('0x23')](_0x6859d1[_0x0c3f('0x38')]['limit']);_0x3f9faa[_0x0c3f('0x22')]=qs[_0x0c3f('0x22')](_0x6859d1[_0x0c3f('0x38')]['offset']);}_0x3f9faa[_0x0c3f('0x3c')]=qs[_0x0c3f('0x3d')](_0x6859d1[_0x0c3f('0x38')][_0x0c3f('0x3d')]);_0x3f9faa[_0x0c3f('0x3e')]=qs[_0x0c3f('0x36')](_[_0x0c3f('0x5a')](_0x6859d1['query'],_0x2e4f99[_0x0c3f('0x36')]));_0x3f9faa[_0x0c3f('0x3e')][_0x0c3f('0x5b')]=_0xe5e294['id'];if(_0x6859d1[_0x0c3f('0x38')]['filter']){_0x3f9faa['where']=_[_0x0c3f('0x40')](_0x3f9faa[_0x0c3f('0x3e')],{'$or':_['map'](_0x3f9faa[_0x0c3f('0x39')],function(_0x11139e){var _0x59f589={};_0x59f589[_0x11139e]={'$like':'%'+_0x6859d1[_0x0c3f('0x38')][_0x0c3f('0x3f')]+'%'};return _0x59f589;})});}_0x3f9faa=_[_0x0c3f('0x40')]({},_0x3f9faa,_0x6859d1[_0x0c3f('0x48')]);return db['UserWhatsappQueue'][_0x0c3f('0x5c')](_0x3f9faa);}})[_0x0c3f('0x28')](function(_0x56d3e4){if(_0x56d3e4){return db[_0x0c3f('0x5d')][_0x0c3f('0x5e')]({'where':{'id':_[_0x0c3f('0x30')](_0x56d3e4,_0x0c3f('0x5f')),'role':_0x0c3f('0x60')},'attributes':['id',_0x0c3f('0x2d'),_0x0c3f('0x61'),_0x0c3f('0x62'),_0x0c3f('0x63')]});}})[_0x0c3f('0x28')](function(_0x25207c){if(_0x25207c){return{'count':_0x25207c[_0x0c3f('0x21')],'rows':_[_0x0c3f('0x30')](_0x25207c[_0x0c3f('0x44')],function(_0x588e64){return{'membername':_0x588e64[_0x0c3f('0x2d')],'UserId':_0x588e64['id'],'queue_name':_0x262640['name'],'WhatsappQueueId':_0x262640['id'],'interface':util[_0x0c3f('0x64')](_0x0c3f('0x65'),_0x0c3f('0x66'),_0x588e64[_0x0c3f('0x2d')]),'penalty':0x0,'paused':_0x588e64[_0x0c3f('0x61')],'createdAt':_0x588e64[_0x0c3f('0x63')],'updatedAt':_0x588e64[_0x0c3f('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0c3f('0x28')](respondWithFilteredResult(_0x4bd0a3,_0x3f9faa))[_0x0c3f('0x45')](handleError(_0x4bd0a3,null));};exports[_0x0c3f('0x67')]=function(_0x5db989,_0x2a7469,_0x4fc137){var _0x6a1928={};var _0x14462f={};var _0x29f811;var _0x503f4a;return db['WhatsappQueue'][_0x0c3f('0x56')]({'where':{'id':_0x5db989['params']['id']}})[_0x0c3f('0x28')](handleEntityNotFound(_0x2a7469,null))[_0x0c3f('0x28')](function(_0x357650){if(_0x357650){_0x29f811=_0x357650;_0x14462f[_0x0c3f('0x35')]=_['keys'](db[_0x0c3f('0x68')][_0x0c3f('0x32')]);_0x14462f['query']=_[_0x0c3f('0x47')](_0x5db989['query']);_0x14462f[_0x0c3f('0x36')]=_['intersection'](_0x14462f[_0x0c3f('0x35')],_0x14462f['query']);_0x6a1928['attributes']=_[_0x0c3f('0x37')](_0x14462f['model'],qs[_0x0c3f('0x3a')](_0x5db989[_0x0c3f('0x38')][_0x0c3f('0x3a')]));_0x6a1928[_0x0c3f('0x39')]=_0x6a1928['attributes'][_0x0c3f('0x3b')]?_0x6a1928['attributes']:_0x14462f[_0x0c3f('0x35')];_0x6a1928[_0x0c3f('0x3c')]=qs[_0x0c3f('0x3d')](_0x5db989['query']['sort']);_0x6a1928[_0x0c3f('0x3e')]=qs['filters'](_['pick'](_0x5db989[_0x0c3f('0x38')],_0x14462f['filters']));if(_0x5db989[_0x0c3f('0x38')]['filter']){_0x6a1928[_0x0c3f('0x3e')]=_[_0x0c3f('0x40')](_0x6a1928[_0x0c3f('0x3e')],{'$or':_[_0x0c3f('0x30')](_0x6a1928['attributes'],function(_0x1c72ee){var _0x2449c4={};_0x2449c4[_0x1c72ee]={'$like':'%'+_0x5db989['query'][_0x0c3f('0x3f')]+'%'};return _0x2449c4;})});}_0x6a1928=_[_0x0c3f('0x40')]({},_0x6a1928,_0x5db989[_0x0c3f('0x48')]);return _0x29f811[_0x0c3f('0x67')](_0x6a1928);}})['then'](function(_0x3d2b4c){if(_0x3d2b4c){_0x503f4a=_0x3d2b4c[_0x0c3f('0x3b')];if(!_0x5db989[_0x0c3f('0x38')][_0x0c3f('0x58')](_0x0c3f('0x59'))){_0x6a1928[_0x0c3f('0x23')]=qs[_0x0c3f('0x23')](_0x5db989[_0x0c3f('0x38')][_0x0c3f('0x23')]);_0x6a1928[_0x0c3f('0x22')]=qs['offset'](_0x5db989[_0x0c3f('0x38')]['offset']);}return _0x29f811[_0x0c3f('0x67')](_0x6a1928);}})[_0x0c3f('0x28')](function(_0x23e61b){if(_0x23e61b){return _0x23e61b?{'count':_0x503f4a,'rows':_0x23e61b}:null;}})[_0x0c3f('0x28')](respondWithResult(_0x2a7469,null))[_0x0c3f('0x45')](handleError(_0x2a7469,null));};exports[_0x0c3f('0x69')]=function(_0x40c2e1,_0xdfe3ec,_0x5751e1){var _0xfede2c=_0x40c2e1[_0x0c3f('0x51')][_0x0c3f('0x6a')];return db[_0x0c3f('0x68')][_0x0c3f('0x5c')]({'where':{'id':_0xfede2c},'attributes':['id'],'include':[{'model':db[_0x0c3f('0x5d')],'as':'Agents','attributes':['id',_0x0c3f('0x2d'),'online',_0x0c3f('0x6b'),_0x0c3f('0x6c')],'raw':!![]}]})[_0x0c3f('0x28')](function(_0x50b561){if(_0x50b561){var _0x3d4046=_['flatMap'](_0x50b561,function(_0x5527ba){var _0x466e8e=_0x5527ba[_0x0c3f('0x29')]({'plain':!![]});return _0x466e8e['Agents'];});return db[_0x0c3f('0x31')][_0x0c3f('0x53')]({'where':{'id':_0x40c2e1[_0x0c3f('0x52')]['id']}})['then'](function(_0x36e75c){return db['sequelize']['transaction'](function(_0x555691){return _0x36e75c[_0x0c3f('0x69')](_0xfede2c,{'transaction':_0x555691})[_0x0c3f('0x28')](function(){return BPromise['each'](_0x3d4046,function(_0x36b2f3){return db[_0x0c3f('0x57')][_0x0c3f('0x6d')]({'where':{'UserId':_0x36b2f3['id'],'WhatsappQueueId':_0x40c2e1['params']['id']},'transaction':_0x555691});});})[_0x0c3f('0x28')](function(){_0x3d4046['forEach'](function(_0x2fa672){socket[_0x0c3f('0x6e')](_0x0c3f('0x6f'),{'UserId':_0x2fa672['id'],'WhatsappQueueId':_0x36e75c['id']});});});});});}})[_0x0c3f('0x28')](respondWithStatusCode(_0xdfe3ec,null))[_0x0c3f('0x45')](handleError(_0xdfe3ec,null));};exports[_0x0c3f('0x70')]=function(_0x19f84d,_0x151de5,_0x2cd398){return db[_0x0c3f('0x68')][_0x0c3f('0x5c')]({'where':{'id':_0x19f84d['query'][_0x0c3f('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x0c3f('0x5d')],'as':_0x0c3f('0x71'),'attributes':['id'],'raw':!![]}]})[_0x0c3f('0x28')](handleEntityNotFound(_0x151de5,null))[_0x0c3f('0x28')](function(_0x254a74){var _0x48e2d7=_['map'](_0x254a74,'id');var _0xf3c093=[];var _0x15b1c8=[];var _0x2069e0=squel[_0x0c3f('0x72')]();_0x2069e0['field'](_0x0c3f('0x73'))[_0x0c3f('0x74')]('team_has_whatsapp_queues','tq')[_0x0c3f('0x75')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0c3f('0x3e')]('WhatsappQueueId\x20=\x20?',_0x19f84d['params']['id']);for(var _0x5c25b0=0x0;_0x5c25b0<_0x254a74[_0x0c3f('0x3b')];_0x5c25b0+=0x1){let _0x21ad8a=_0x254a74[_0x5c25b0];for(var _0x28e0a8=0x0;_0x28e0a8<_0x21ad8a[_0x0c3f('0x71')][_0x0c3f('0x3b')];_0x28e0a8+=0x1){let _0x3efdf1=_0x21ad8a['Agents'][_0x28e0a8];var _0x2a74d9=_0x2069e0[_0x0c3f('0x76')]();_0x2a74d9['where'](_0x0c3f('0x77'),_0x3efdf1['id']);_0x15b1c8[_0x0c3f('0x78')](db[_0x0c3f('0x79')][_0x0c3f('0x38')](_0x2a74d9['toString'](),{'type':db['sequelize'][_0x0c3f('0x7a')][_0x0c3f('0x7b')]})[_0x0c3f('0x28')](function(_0x3416b2){if(_0x3416b2[_0x0c3f('0x3b')]===0x1){return _0x3efdf1['id'];}else{var _0x12d66e=_['every'](_['map'](_0x3416b2,'TeamId'),function(_0x1fc9e1){return _[_0x0c3f('0x7c')](_0x48e2d7,_0x1fc9e1);});if(_0x12d66e){return _0x3efdf1['id'];}}}));}}return BPromise[_0x0c3f('0x7d')](_0x15b1c8)[_0x0c3f('0x28')](function(_0x503f2e){_0xf3c093=_(_0xf3c093)[_0x0c3f('0x7e')](_0x503f2e)['compact']()['value']();return db[_0x0c3f('0x31')][_0x0c3f('0x53')]({'where':{'id':_0x19f84d[_0x0c3f('0x52')]['id']}})['then'](function(_0x5c8308){return db['sequelize'][_0x0c3f('0x7f')](function(_0x51e44b){return _0x5c8308[_0x0c3f('0x70')](_0x19f84d['query'][_0x0c3f('0x6a')],{'transaction':_0x51e44b})['then'](function(){if(!_[_0x0c3f('0x80')](_0xf3c093)){return _0x5c8308[_0x0c3f('0x81')](_0xf3c093,{'transaction':_0x51e44b});}})[_0x0c3f('0x28')](function(){_0xf3c093[_0x0c3f('0x82')](function(_0x100638){socket[_0x0c3f('0x6e')](_0x0c3f('0x83'),{'UserId':_0x100638,'WhatsappQueueId':_0x5c8308['id']});});});});});});})['then'](respondWithStatusCode(_0x151de5,null))[_0x0c3f('0x45')](handleError(_0x151de5,null));};exports['addAgents']=function(_0x1070c4,_0x40bbcc,_0x5ac69a){return db[_0x0c3f('0x31')][_0x0c3f('0x53')]({'where':{'id':_0x1070c4['params']['id']}})[_0x0c3f('0x28')](handleEntityNotFound(_0x40bbcc,null))['then'](function(_0x2ea651){if(_0x2ea651){return _0x2ea651[_0x0c3f('0x84')](_0x1070c4[_0x0c3f('0x51')][_0x0c3f('0x6a')],_[_0x0c3f('0x85')](_0x1070c4[_0x0c3f('0x51')],[_0x0c3f('0x6a'),'id'])||{})[_0x0c3f('0x86')](function(_0x5d9992){for(var _0x46b185=0x0;_0x46b185<_0x1070c4[_0x0c3f('0x51')][_0x0c3f('0x6a')][_0x0c3f('0x3b')];_0x46b185+=0x1){socket[_0x0c3f('0x6e')](_0x0c3f('0x6f'),{'UserId':_0x1070c4[_0x0c3f('0x51')][_0x0c3f('0x6a')][_0x46b185],'WhatsappQueueId':_0x1070c4['params']['id']});}return _0x5d9992;});}})['then'](respondWithResult(_0x40bbcc,null))[_0x0c3f('0x45')](handleError(_0x40bbcc,null));};exports['removeAgents']=function(_0x268a5d,_0x24bbcf,_0x20bd09){return db[_0x0c3f('0x31')]['find']({'where':{'id':_0x268a5d['params']['id']}})[_0x0c3f('0x28')](handleEntityNotFound(_0x24bbcf,null))['then'](function(_0x2dcb56){if(_0x2dcb56){return _0x2dcb56[_0x0c3f('0x81')](_0x268a5d['query'][_0x0c3f('0x6a')])[_0x0c3f('0x28')](function(){if(_[_0x0c3f('0x87')](_0x268a5d[_0x0c3f('0x38')][_0x0c3f('0x6a')])){for(var _0x6763=0x0;_0x6763<_0x268a5d[_0x0c3f('0x38')][_0x0c3f('0x6a')]['length'];_0x6763+=0x1){socket['emit'](_0x0c3f('0x83'),{'UserId':Number(_0x268a5d[_0x0c3f('0x38')][_0x0c3f('0x6a')][_0x6763]),'WhatsappQueueId':Number(_0x268a5d[_0x0c3f('0x52')]['id'])});}}else{socket[_0x0c3f('0x6e')](_0x0c3f('0x83'),{'UserId':Number(_0x268a5d[_0x0c3f('0x38')]['ids']),'WhatsappQueueId':Number(_0x268a5d[_0x0c3f('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x24bbcf,null))[_0x0c3f('0x45')](handleError(_0x24bbcf,null));};exports['getAgents']=function(_0x46fba5,_0x3468a6,_0x2b607e){var _0x5497df={};var _0x5bed31={};var _0x29a5d5;var _0x322a66;return db[_0x0c3f('0x31')][_0x0c3f('0x56')]({'where':{'id':_0x46fba5[_0x0c3f('0x52')]['id']}})['then'](handleEntityNotFound(_0x3468a6,null))['then'](function(_0x4875c4){if(_0x4875c4){_0x29a5d5=_0x4875c4;_0x5bed31[_0x0c3f('0x35')]=_[_0x0c3f('0x47')](db[_0x0c3f('0x5d')][_0x0c3f('0x32')]);_0x5bed31[_0x0c3f('0x38')]=_[_0x0c3f('0x47')](_0x46fba5[_0x0c3f('0x38')]);_0x5bed31[_0x0c3f('0x36')]=_['intersection'](_0x5bed31['model'],_0x5bed31[_0x0c3f('0x38')]);_0x5497df[_0x0c3f('0x39')]=_[_0x0c3f('0x37')](_0x5bed31['model'],qs[_0x0c3f('0x3a')](_0x46fba5[_0x0c3f('0x38')][_0x0c3f('0x3a')]));_0x5497df[_0x0c3f('0x39')]=_0x5497df[_0x0c3f('0x39')]['length']?_0x5497df[_0x0c3f('0x39')]:_0x5bed31['model'];_0x5497df[_0x0c3f('0x3c')]=qs[_0x0c3f('0x3d')](_0x46fba5['query']['sort']);_0x5497df[_0x0c3f('0x3e')]=qs['filters'](_[_0x0c3f('0x5a')](_0x46fba5[_0x0c3f('0x38')],_0x5bed31['filters']));if(_0x46fba5[_0x0c3f('0x38')][_0x0c3f('0x3f')]){_0x5497df[_0x0c3f('0x3e')]=_[_0x0c3f('0x40')](_0x5497df['where'],{'$or':_[_0x0c3f('0x30')](_0x5497df[_0x0c3f('0x39')],function(_0x44b8bd){var _0x3e771b={};_0x3e771b[_0x44b8bd]={'$like':'%'+_0x46fba5['query']['filter']+'%'};return _0x3e771b;})});}_0x5497df=_[_0x0c3f('0x40')]({},_0x5497df,_0x46fba5['options']);return _0x29a5d5[_0x0c3f('0x88')](_0x5497df);}})[_0x0c3f('0x28')](function(_0x717fc0){if(_0x717fc0){_0x322a66=_0x717fc0[_0x0c3f('0x3b')];if(!_0x46fba5[_0x0c3f('0x38')][_0x0c3f('0x58')](_0x0c3f('0x59'))){_0x5497df[_0x0c3f('0x23')]=qs[_0x0c3f('0x23')](_0x46fba5[_0x0c3f('0x38')][_0x0c3f('0x23')]);_0x5497df[_0x0c3f('0x22')]=qs['offset'](_0x46fba5[_0x0c3f('0x38')]['offset']);}return _0x29a5d5[_0x0c3f('0x88')](_0x5497df);}})[_0x0c3f('0x28')](function(_0x42432b){if(_0x42432b){return _0x42432b?{'count':_0x322a66,'rows':_0x42432b}:null;}})[_0x0c3f('0x28')](respondWithResult(_0x3468a6,null))[_0x0c3f('0x45')](handleError(_0x3468a6,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 676185b..9adadd1 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 _0x7f5f=['hook','exports','events','WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1dec6d,_0x434790){var _0x2c3f50=function(_0x44a10d){while(--_0x44a10d){_0x1dec6d['push'](_0x1dec6d['shift']());}};_0x2c3f50(++_0x434790);}(_0x7f5f,0x1a9));var _0xf7f5=function(_0x696b76,_0x261852){_0x696b76=_0x696b76-0x0;var _0x3a4649=_0x7f5f[_0x696b76];return _0x3a4649;};'use strict';var EventEmitter=require(_0xf7f5('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xf7f5('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xf7f5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf7f5('0x3'),'afterDestroy':_0xf7f5('0x4')};function emitEvent(_0x52d4fe){return function(_0x1de027,_0x4d65d9,_0x3e416a){WhatsappQueueEvents[_0xf7f5('0x5')](_0x52d4fe+':'+_0x1de027['id'],_0x1de027);WhatsappQueueEvents[_0xf7f5('0x5')](_0x52d4fe,_0x1de027);_0x3e416a(null);};}for(var e in events){if(events[_0xf7f5('0x6')](e)){var event=events[e];WhatsappQueue[_0xf7f5('0x7')](e,emitEvent(event));}}module[_0xf7f5('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x1276=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x107113,_0x1587ff){var _0x5996aa=function(_0x530644){while(--_0x530644){_0x107113['push'](_0x107113['shift']());}};_0x5996aa(++_0x1587ff);}(_0x1276,0x195));var _0x6127=function(_0x1870dd,_0x186efa){_0x1870dd=_0x1870dd-0x0;var _0x1d5b86=_0x1276[_0x1870dd];return _0x1d5b86;};'use strict';var EventEmitter=require(_0x6127('0x0'));var WhatsappQueue=require(_0x6127('0x1'))['db'][_0x6127('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6127('0x3')](0x0);var events={'afterCreate':_0x6127('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xe94cd6){return function(_0x2e96c6,_0x4b3c0d,_0x41dde8){WhatsappQueueEvents[_0x6127('0x5')](_0xe94cd6+':'+_0x2e96c6['id'],_0x2e96c6);WhatsappQueueEvents[_0x6127('0x5')](_0xe94cd6,_0x2e96c6);_0x41dde8(null);};}for(var e in events){if(events[_0x6127('0x6')](e)){var event=events[e];WhatsappQueue[_0x6127('0x7')](e,emitEvent(event));}}module[_0x6127('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 5cfd0d8..c89801c 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 _0xcd89=['whatsapp_queues','util','../../config/logger','api','moment','bluebird','rimraf','exports','WhatsappQueue'];(function(_0x1fee9d,_0x268602){var _0x2d5ff5=function(_0x2c428f){while(--_0x2c428f){_0x1fee9d['push'](_0x1fee9d['shift']());}};_0x2d5ff5(++_0x268602);}(_0xcd89,0x157));var _0x9cd8=function(_0x279f10,_0x57e812){_0x279f10=_0x279f10-0x0;var _0x59cd5c=_0xcd89[_0x279f10];return _0x59cd5c;};'use strict';var _=require('lodash');var util=require(_0x9cd8('0x0'));var logger=require(_0x9cd8('0x1'))(_0x9cd8('0x2'));var moment=require(_0x9cd8('0x3'));var BPromise=require(_0x9cd8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9cd8('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x9cd8('0x6')]=function(_0x255503,_0xfdc230){return _0x255503['define'](_0x9cd8('0x7'),attributes,{'tableName':_0x9cd8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c1f=['WhatsappQueue','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x1bed20,_0x5a3d6b){var _0x74a149=function(_0x4a4e66){while(--_0x4a4e66){_0x1bed20['push'](_0x1bed20['shift']());}};_0x74a149(++_0x5a3d6b);}(_0x9c1f,0x85));var _0xf9c1=function(_0x53aec3,_0x2b8af8){_0x53aec3=_0x53aec3-0x0;var _0x503f42=_0x9c1f[_0x53aec3];return _0x503f42;};'use strict';var _=require(_0xf9c1('0x0'));var util=require(_0xf9c1('0x1'));var logger=require(_0xf9c1('0x2'))(_0xf9c1('0x3'));var moment=require(_0xf9c1('0x4'));var BPromise=require(_0xf9c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf9c1('0x6'));var rimraf=require(_0xf9c1('0x7'));var config=require(_0xf9c1('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0xf9c1('0x9')]=function(_0x848575,_0x4870fd){return _0x848575[_0xf9c1('0xa')](_0xf9c1('0xb'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 722ab75..43120a4 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 _0x92bd=['error','code','message','WhatsappQueue','findAll','options','raw','where','attributes','limit','map','include','model','debug','GetWhatsappQueue','catch','find','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x18237a,_0x3a2b11){var _0x5eab0e=function(_0x4aad3e){while(--_0x4aad3e){_0x18237a['push'](_0x18237a['shift']());}};_0x5eab0e(++_0x3a2b11);}(_0x92bd,0x108));var _0xd92b=function(_0x505756,_0x4f41dc){_0x505756=_0x505756-0x0;var _0x52ca07=_0x92bd[_0x505756];return _0x52ca07;};'use strict';var _=require(_0xd92b('0x0'));var util=require(_0xd92b('0x1'));var moment=require(_0xd92b('0x2'));var BPromise=require(_0xd92b('0x3'));var rs=require(_0xd92b('0x4'));var fs=require('fs');var Redis=require(_0xd92b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd92b('0x6'));var logger=require(_0xd92b('0x7'))(_0xd92b('0x8'));var config=require(_0xd92b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd92b('0xa')]({'port':0x232a});config[_0xd92b('0xb')]=_[_0xd92b('0xc')](config['redis'],{'host':_0xd92b('0xd'),'port':0x18eb});var socket=require(_0xd92b('0xe'))(new Redis(config['redis']));require(_0xd92b('0xf'))[_0xd92b('0x10')](socket);function respondWithRpcPromise(_0x27cfc4,_0x3d6428,_0x1ade6e){return new BPromise(function(_0x54d075,_0x592c8c){return client[_0xd92b('0x11')](_0x27cfc4,_0x1ade6e)[_0xd92b('0x12')](function(_0x42a757){logger[_0xd92b('0x13')](_0xd92b('0x14'),_0x3d6428,'request\x20sent');logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3d6428,_0xd92b('0x15'),JSON[_0xd92b('0x16')](_0x42a757));if(_0x42a757['error']){if(_0x42a757[_0xd92b('0x17')][_0xd92b('0x18')]===0x1f4){logger[_0xd92b('0x17')](_0xd92b('0x14'),_0x3d6428,_0x42a757[_0xd92b('0x17')][_0xd92b('0x19')]);return _0x592c8c(_0x42a757[_0xd92b('0x17')][_0xd92b('0x19')]);}logger[_0xd92b('0x17')](_0xd92b('0x14'),_0x3d6428,_0x42a757[_0xd92b('0x17')]['message']);return _0x54d075(_0x42a757[_0xd92b('0x17')][_0xd92b('0x19')]);}else{logger[_0xd92b('0x13')](_0xd92b('0x14'),_0x3d6428,_0xd92b('0x15'));_0x54d075(_0x42a757['result'][_0xd92b('0x19')]);}})['catch'](function(_0x56b8e8){logger[_0xd92b('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x3d6428,_0x56b8e8);_0x592c8c(_0x56b8e8);});});}exports['GetWhatsappQueue']=function(_0x40ed96){var _0x5457f6=this;return new Promise(function(_0x1d211a,_0x17776a){return db[_0xd92b('0x1a')][_0xd92b('0x1b')]({'raw':_0x40ed96[_0xd92b('0x1c')]?_0x40ed96[_0xd92b('0x1c')][_0xd92b('0x1d')]===undefined?!![]:![]:!![],'where':_0x40ed96[_0xd92b('0x1c')]?_0x40ed96[_0xd92b('0x1c')][_0xd92b('0x1e')]||null:null,'attributes':_0x40ed96[_0xd92b('0x1c')]?_0x40ed96[_0xd92b('0x1c')][_0xd92b('0x1f')]||null:null,'limit':_0x40ed96[_0xd92b('0x1c')]?_0x40ed96[_0xd92b('0x1c')][_0xd92b('0x20')]||null:null,'include':_0x40ed96[_0xd92b('0x1c')]?_0x40ed96[_0xd92b('0x1c')]['include']?_[_0xd92b('0x21')](_0x40ed96[_0xd92b('0x1c')][_0xd92b('0x22')],function(_0x27089c){return{'model':db[_0x27089c[_0xd92b('0x23')]],'as':_0x27089c['as'],'attributes':_0x27089c[_0xd92b('0x1f')],'include':_0x27089c[_0xd92b('0x22')]?_[_0xd92b('0x21')](_0x27089c[_0xd92b('0x22')],function(_0x5de926){return{'model':db[_0x5de926[_0xd92b('0x23')]],'as':_0x5de926['as'],'attributes':_0x5de926[_0xd92b('0x1f')],'include':_0x5de926[_0xd92b('0x22')]?_[_0xd92b('0x21')](_0x5de926[_0xd92b('0x22')],function(_0x202d84){return{'model':db[_0x202d84[_0xd92b('0x23')]],'as':_0x202d84['as'],'attributes':_0x202d84[_0xd92b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd92b('0x12')](function(_0x4736b6){logger[_0xd92b('0x13')]('GetWhatsappQueue',_0x40ed96);logger[_0xd92b('0x24')](_0xd92b('0x25'),_0x40ed96,JSON[_0xd92b('0x16')](_0x4736b6));_0x1d211a(_0x4736b6);})[_0xd92b('0x26')](function(_0x3587e8){logger[_0xd92b('0x17')](_0xd92b('0x25'),_0x3587e8['message'],_0x40ed96);_0x17776a(_0x5457f6[_0xd92b('0x17')](0x1f4,_0x3587e8[_0xd92b('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x19e3d3){var _0x331ace=this;return new Promise(function(_0x4b429a,_0x2525cc){return db[_0xd92b('0x1a')][_0xd92b('0x27')]({'raw':_0x19e3d3[_0xd92b('0x1c')]?_0x19e3d3[_0xd92b('0x1c')][_0xd92b('0x1d')]===undefined?!![]:![]:!![],'where':_0x19e3d3[_0xd92b('0x1c')]?_0x19e3d3[_0xd92b('0x1c')][_0xd92b('0x1e')]||null:null,'attributes':_0x19e3d3[_0xd92b('0x1c')]?_0x19e3d3['options'][_0xd92b('0x1f')]||null:null,'include':_0x19e3d3[_0xd92b('0x1c')]?_0x19e3d3['options']['include']?_['map'](_0x19e3d3[_0xd92b('0x1c')][_0xd92b('0x22')],function(_0x447268){return{'model':db[_0x447268['model']],'as':_0x447268['as'],'attributes':_0x447268[_0xd92b('0x1f')],'include':_0x447268['include']?_[_0xd92b('0x21')](_0x447268[_0xd92b('0x22')],function(_0x4099be){return{'model':db[_0x4099be['model']],'as':_0x4099be['as'],'attributes':_0x4099be['attributes'],'include':_0x4099be['include']?_[_0xd92b('0x21')](_0x4099be['include'],function(_0x53a00e){return{'model':db[_0x53a00e[_0xd92b('0x23')]],'as':_0x53a00e['as'],'attributes':_0x53a00e[_0xd92b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd92b('0x12')](function(_0x1d69c3){logger[_0xd92b('0x13')]('ShowWhatsappQueue',_0x19e3d3);logger[_0xd92b('0x24')](_0xd92b('0x28'),_0x19e3d3,JSON['stringify'](_0x1d69c3));_0x4b429a(_0x1d69c3);})[_0xd92b('0x26')](function(_0x20fb61){logger[_0xd92b('0x17')]('ShowWhatsappQueue',_0x20fb61[_0xd92b('0x19')],_0x19e3d3);_0x2525cc(_0x331ace[_0xd92b('0x17')](0x1f4,_0x20fb61[_0xd92b('0x19')]));});});}; \ No newline at end of file +var _0x6626=['limit','include','model','map','GetWhatsappQueue','ShowWhatsappQueue','where','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','WhatsappQueue','findAll','options','raw','attributes'];(function(_0x12e3e3,_0x501eaf){var _0x26602e=function(_0x427882){while(--_0x427882){_0x12e3e3['push'](_0x12e3e3['shift']());}};_0x26602e(++_0x501eaf);}(_0x6626,0x1ca));var _0x6662=function(_0x2f9387,_0x353c54){_0x2f9387=_0x2f9387-0x0;var _0x5472e3=_0x6626[_0x2f9387];return _0x5472e3;};'use strict';var _=require(_0x6662('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6662('0x1'));var rs=require(_0x6662('0x2'));var fs=require('fs');var Redis=require(_0x6662('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6662('0x4'));var logger=require(_0x6662('0x5'))(_0x6662('0x6'));var config=require(_0x6662('0x7'));var jayson=require(_0x6662('0x8'));var client=jayson[_0x6662('0x9')][_0x6662('0xa')]({'port':0x232a});config[_0x6662('0xb')]=_[_0x6662('0xc')](config[_0x6662('0xb')],{'host':_0x6662('0xd'),'port':0x18eb});var socket=require(_0x6662('0xe'))(new Redis(config['redis']));require(_0x6662('0xf'))[_0x6662('0x10')](socket);function respondWithRpcPromise(_0x5aacf8,_0x1d1f05,_0x38055c){return new BPromise(function(_0x1dcfd3,_0x317701){return client[_0x6662('0x11')](_0x5aacf8,_0x38055c)[_0x6662('0x12')](function(_0x960bfa){logger[_0x6662('0x13')](_0x6662('0x14'),_0x1d1f05,_0x6662('0x15'));logger[_0x6662('0x16')](_0x6662('0x17'),_0x1d1f05,_0x6662('0x15'),JSON[_0x6662('0x18')](_0x960bfa));if(_0x960bfa[_0x6662('0x19')]){if(_0x960bfa[_0x6662('0x19')][_0x6662('0x1a')]===0x1f4){logger[_0x6662('0x19')](_0x6662('0x14'),_0x1d1f05,_0x960bfa['error'][_0x6662('0x1b')]);return _0x317701(_0x960bfa[_0x6662('0x19')][_0x6662('0x1b')]);}logger[_0x6662('0x19')](_0x6662('0x14'),_0x1d1f05,_0x960bfa[_0x6662('0x19')][_0x6662('0x1b')]);return _0x1dcfd3(_0x960bfa[_0x6662('0x19')][_0x6662('0x1b')]);}else{logger['info'](_0x6662('0x14'),_0x1d1f05,_0x6662('0x15'));_0x1dcfd3(_0x960bfa['result'][_0x6662('0x1b')]);}})[_0x6662('0x1c')](function(_0x5c34d2){logger[_0x6662('0x19')](_0x6662('0x14'),_0x1d1f05,_0x5c34d2);_0x317701(_0x5c34d2);});});}exports['GetWhatsappQueue']=function(_0x4a3cee){var _0x44ddf6=this;return new Promise(function(_0xbe8cd2,_0x202e66){return db[_0x6662('0x1d')][_0x6662('0x1e')]({'raw':_0x4a3cee[_0x6662('0x1f')]?_0x4a3cee[_0x6662('0x1f')][_0x6662('0x20')]===undefined?!![]:![]:!![],'where':_0x4a3cee['options']?_0x4a3cee[_0x6662('0x1f')]['where']||null:null,'attributes':_0x4a3cee[_0x6662('0x1f')]?_0x4a3cee[_0x6662('0x1f')][_0x6662('0x21')]||null:null,'limit':_0x4a3cee[_0x6662('0x1f')]?_0x4a3cee[_0x6662('0x1f')][_0x6662('0x22')]||null:null,'include':_0x4a3cee[_0x6662('0x1f')]?_0x4a3cee[_0x6662('0x1f')][_0x6662('0x23')]?_['map'](_0x4a3cee[_0x6662('0x1f')][_0x6662('0x23')],function(_0x185403){return{'model':db[_0x185403[_0x6662('0x24')]],'as':_0x185403['as'],'attributes':_0x185403[_0x6662('0x21')],'include':_0x185403[_0x6662('0x23')]?_[_0x6662('0x25')](_0x185403[_0x6662('0x23')],function(_0x166598){return{'model':db[_0x166598[_0x6662('0x24')]],'as':_0x166598['as'],'attributes':_0x166598[_0x6662('0x21')],'include':_0x166598['include']?_['map'](_0x166598[_0x6662('0x23')],function(_0x2e64b1){return{'model':db[_0x2e64b1[_0x6662('0x24')]],'as':_0x2e64b1['as'],'attributes':_0x2e64b1[_0x6662('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6662('0x12')](function(_0x372468){logger[_0x6662('0x13')](_0x6662('0x26'),_0x4a3cee);logger[_0x6662('0x16')](_0x6662('0x26'),_0x4a3cee,JSON[_0x6662('0x18')](_0x372468));_0xbe8cd2(_0x372468);})[_0x6662('0x1c')](function(_0x534119){logger[_0x6662('0x19')](_0x6662('0x26'),_0x534119['message'],_0x4a3cee);_0x202e66(_0x44ddf6['error'](0x1f4,_0x534119[_0x6662('0x1b')]));});});};exports[_0x6662('0x27')]=function(_0x28ce2b){var _0x19074a=this;return new Promise(function(_0x2a9aaa,_0x43d763){return db[_0x6662('0x1d')]['find']({'raw':_0x28ce2b[_0x6662('0x1f')]?_0x28ce2b['options'][_0x6662('0x20')]===undefined?!![]:![]:!![],'where':_0x28ce2b[_0x6662('0x1f')]?_0x28ce2b[_0x6662('0x1f')][_0x6662('0x28')]||null:null,'attributes':_0x28ce2b[_0x6662('0x1f')]?_0x28ce2b[_0x6662('0x1f')][_0x6662('0x21')]||null:null,'include':_0x28ce2b[_0x6662('0x1f')]?_0x28ce2b[_0x6662('0x1f')][_0x6662('0x23')]?_['map'](_0x28ce2b[_0x6662('0x1f')][_0x6662('0x23')],function(_0x41464d){return{'model':db[_0x41464d['model']],'as':_0x41464d['as'],'attributes':_0x41464d[_0x6662('0x21')],'include':_0x41464d['include']?_[_0x6662('0x25')](_0x41464d[_0x6662('0x23')],function(_0x5d7c7e){return{'model':db[_0x5d7c7e[_0x6662('0x24')]],'as':_0x5d7c7e['as'],'attributes':_0x5d7c7e['attributes'],'include':_0x5d7c7e[_0x6662('0x23')]?_[_0x6662('0x25')](_0x5d7c7e[_0x6662('0x23')],function(_0x2d1e88){return{'model':db[_0x2d1e88[_0x6662('0x24')]],'as':_0x2d1e88['as'],'attributes':_0x2d1e88[_0x6662('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6662('0x12')](function(_0x5dcf51){logger[_0x6662('0x13')](_0x6662('0x27'),_0x28ce2b);logger[_0x6662('0x16')]('ShowWhatsappQueue',_0x28ce2b,JSON['stringify'](_0x5dcf51));_0x2a9aaa(_0x5dcf51);})[_0x6662('0x1c')](function(_0x56df05){logger[_0x6662('0x19')](_0x6662('0x27'),_0x56df05[_0x6662('0x1b')],_0x28ce2b);_0x43d763(_0x19074a[_0x6662('0x19')](0x1f4,_0x56df05[_0x6662('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 3a39dff..77684f4 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 _0x6902=['length','whatsappQueue:','./whatsappQueue.events','remove','update','emit','removeListener','register'];(function(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x6902,0x13a));var _0x2690=function(_0x442933,_0x4ff906){_0x442933=_0x442933-0x0;var _0x2d954d=_0x6902[_0x442933];return _0x2d954d;};'use strict';var WhatsappQueueEvents=require(_0x2690('0x0'));var events=['save',_0x2690('0x1'),_0x2690('0x2')];function createListener(_0x59df1c,_0x560f7c){return function(_0x46444b){_0x560f7c[_0x2690('0x3')](_0x59df1c,_0x46444b);};}function removeListener(_0x4a996d,_0x4285a4){return function(){WhatsappQueueEvents[_0x2690('0x4')](_0x4a996d,_0x4285a4);};}exports[_0x2690('0x5')]=function(_0x539bca){for(var _0x3afaa2=0x0,_0x2805a0=events[_0x2690('0x6')];_0x3afaa2<_0x2805a0;_0x3afaa2++){var _0x290744=events[_0x3afaa2];var _0x3d3f5a=createListener(_0x2690('0x7')+_0x290744,_0x539bca);WhatsappQueueEvents['on'](_0x290744,_0x3d3f5a);}}; \ No newline at end of file +var _0x5a04=['save','remove','update','removeListener','length','whatsappQueue:','./whatsappQueue.events'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5a04,0xfb));var _0x45a0=function(_0x33c47a,_0x588e4f){_0x33c47a=_0x33c47a-0x0;var _0x172085=_0x5a04[_0x33c47a];return _0x172085;};'use strict';var WhatsappQueueEvents=require(_0x45a0('0x0'));var events=[_0x45a0('0x1'),_0x45a0('0x2'),_0x45a0('0x3')];function createListener(_0x3cf4d8,_0x2cc086){return function(_0x17d002){_0x2cc086['emit'](_0x3cf4d8,_0x17d002);};}function removeListener(_0x50b1ed,_0x47657d){return function(){WhatsappQueueEvents[_0x45a0('0x4')](_0x50b1ed,_0x47657d);};}exports['register']=function(_0x3e19b6){for(var _0x19b36d=0x0,_0x46c9c0=events[_0x45a0('0x5')];_0x19b36d<_0x46c9c0;_0x19b36d++){var _0x3a7c10=events[_0x19b36d];var _0x5efc48=createListener(_0x45a0('0x6')+_0x3a7c10,_0x3e19b6);WhatsappQueueEvents['on'](_0x3a7c10,_0x5efc48);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 00b243b..0a661e4 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 _0xf0b0=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','put','/:id','destroy','exports'];(function(_0x3dc94a,_0x12eb9c){var _0x4e508b=function(_0x2ad99a){while(--_0x2ad99a){_0x3dc94a['push'](_0x3dc94a['shift']());}};_0x4e508b(++_0x12eb9c);}(_0xf0b0,0xc8));var _0x0f0b=function(_0x5acebc,_0x12109b){_0x5acebc=_0x5acebc-0x0;var _0x3b6599=_0xf0b0[_0x5acebc];return _0x3b6599;};'use strict';var multer=require(_0x0f0b('0x0'));var util=require(_0x0f0b('0x1'));var path=require(_0x0f0b('0x2'));var timeout=require(_0x0f0b('0x3'));var express=require(_0x0f0b('0x4'));var router=express[_0x0f0b('0x5')]();var auth=require(_0x0f0b('0x6'));var interaction=require(_0x0f0b('0x7'));var config=require(_0x0f0b('0x8'));var controller=require('./whatsappQueueReport.controller');router[_0x0f0b('0x9')]('/',auth['isAuthenticated'](),controller[_0x0f0b('0xa')]);router[_0x0f0b('0x9')](_0x0f0b('0xb'),auth[_0x0f0b('0xc')](),controller[_0x0f0b('0xd')]);router[_0x0f0b('0x9')]('/:id',auth[_0x0f0b('0xc')](),controller[_0x0f0b('0xe')]);router[_0x0f0b('0xf')]('/',auth[_0x0f0b('0xc')](),controller['create']);router[_0x0f0b('0x10')](_0x0f0b('0x11'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0f0b('0x11'),auth['isAuthenticated'](),controller[_0x0f0b('0x12')]);module[_0x0f0b('0x13')]=router; \ No newline at end of file +var _0xca83=['update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','./whatsappQueueReport.controller','get','index','isAuthenticated','/:id','put'];(function(_0x34e5ef,_0x2df43f){var _0xa28403=function(_0x2afa83){while(--_0x2afa83){_0x34e5ef['push'](_0x34e5ef['shift']());}};_0xa28403(++_0x2df43f);}(_0xca83,0x99));var _0x3ca8=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xca83[_0x368fb9];return _0x4892fb;};'use strict';var multer=require(_0x3ca8('0x0'));var util=require('util');var path=require(_0x3ca8('0x1'));var timeout=require(_0x3ca8('0x2'));var express=require(_0x3ca8('0x3'));var router=express[_0x3ca8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x3ca8('0x5'));var config=require('../../config/environment');var controller=require(_0x3ca8('0x6'));router[_0x3ca8('0x7')]('/',auth['isAuthenticated'](),controller[_0x3ca8('0x8')]);router[_0x3ca8('0x7')]('/describe',auth[_0x3ca8('0x9')](),controller['describe']);router[_0x3ca8('0x7')](_0x3ca8('0xa'),auth[_0x3ca8('0x9')](),controller['show']);router['post']('/',auth[_0x3ca8('0x9')](),controller['create']);router[_0x3ca8('0xb')](_0x3ca8('0xa'),auth[_0x3ca8('0x9')](),controller[_0x3ca8('0xc')]);router[_0x3ca8('0xd')](_0x3ca8('0xa'),auth[_0x3ca8('0x9')](),controller[_0x3ca8('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index baffe6f..92df00e 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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4aa4c6,_0x2ce264){var _0x16c50c=function(_0x559a1e){while(--_0x559a1e){_0x4aa4c6['push'](_0x4aa4c6['shift']());}};_0x16c50c(++_0x2ce264);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x55ca=['DATE','STRING','sequelize','exports'];(function(_0x2a2706,_0x2596a0){var _0x328a93=function(_0xa92f26){while(--_0xa92f26){_0x2a2706['push'](_0x2a2706['shift']());}};_0x328a93(++_0x2596a0);}(_0x55ca,0x126));var _0xa55c=function(_0x514038,_0x450ef3){_0x514038=_0x514038-0x0;var _0x589720=_0x55ca[_0x514038];return _0x589720;};'use strict';var Sequelize=require(_0xa55c('0x0'));module[_0xa55c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xa55c('0x2')]},'acceptAt':{'type':Sequelize[_0xa55c('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa55c('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 3195607..59ed382 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 _0xdf0e=['zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','update','then','end','sendStatus','error','stack','name','send','index','map','WhatsappQueueReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','merge','VIRTUAL','filter','where','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','destroy','describe','html-pdf','eml-format','rimraf'];(function(_0x33128b,_0x5cea02){var _0x3adaac=function(_0x22dfe7){while(--_0x22dfe7){_0x33128b['push'](_0x33128b['shift']());}};_0x3adaac(++_0x5cea02);}(_0xdf0e,0xd5));var _0xedf0=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xdf0e[_0x3fe6df];return _0x372a0e;};'use strict';var pdf=require(_0xedf0('0x0'));var emlformat=require(_0xedf0('0x1'));var rimraf=require(_0xedf0('0x2'));var zipdir=require(_0xedf0('0x3'));var jsonpatch=require(_0xedf0('0x4'));var rp=require(_0xedf0('0x5'));var moment=require(_0xedf0('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xedf0('0x7'));var path=require(_0xedf0('0x8'));var sox=require('sox');var csv=require(_0xedf0('0x9'));var ejs=require(_0xedf0('0xa'));var fs=require('fs');var _=require(_0xedf0('0xb'));var squel=require('squel');var crypto=require(_0xedf0('0xc'));var jsforce=require(_0xedf0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xedf0('0xe'));var Papa=require(_0xedf0('0xf'));var Redis=require(_0xedf0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xedf0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xedf0('0x12'));var logger=require(_0xedf0('0x13'))(_0xedf0('0x14'));var utils=require(_0xedf0('0x15'));var config=require(_0xedf0('0x16'));var db=require(_0xedf0('0x17'))['db'];function respondWithStatusCode(_0x25c21a,_0x163c9b){_0x163c9b=_0x163c9b||0xcc;return function(_0x11d091){if(_0x11d091){return _0x25c21a['sendStatus'](_0x163c9b);}return _0x25c21a[_0xedf0('0x18')](_0x163c9b)['end']();};}function respondWithResult(_0x4c7321,_0xe20d34){_0xe20d34=_0xe20d34||0xc8;return function(_0x38e90a){if(_0x38e90a){return _0x4c7321['status'](_0xe20d34)[_0xedf0('0x19')](_0x38e90a);}};}function respondWithFilteredResult(_0x43a665,_0x27d053){return function(_0x1d0f88){if(_0x1d0f88){var _0xc0444e=_0x1d0f88[_0xedf0('0x1a')],_0x429c98=_0x27d053[_0xedf0('0x1b')],_0x95f879=_0x27d053[_0xedf0('0x1b')]+_0x27d053[_0xedf0('0x1c')],_0x4359d6;if(_0x95f879>=_0xc0444e){_0x95f879=_0xc0444e;_0x4359d6=0xc8;}else{_0x4359d6=0xce;}_0x43a665['status'](_0x4359d6);return _0x43a665[_0xedf0('0x1d')]('Content-Range',_0x429c98+'-'+_0x95f879+'/'+_0xc0444e)[_0xedf0('0x19')](_0x1d0f88);}return null;};}function patchUpdates(_0x5e678c){return function(_0x4bdcb4){try{jsonpatch[_0xedf0('0x1e')](_0x4bdcb4,_0x5e678c,!![]);}catch(_0xac2e6e){return BPromise['reject'](_0xac2e6e);}return _0x4bdcb4['save']();};}function saveUpdates(_0x218013,_0x3f0845){return function(_0x32a292){if(_0x32a292){return _0x32a292[_0xedf0('0x1f')](_0x218013)[_0xedf0('0x20')](function(_0x238d3e){return _0x238d3e;});}return null;};}function removeEntity(_0x5b8ec1,_0x585873){return function(_0x42fb7b){if(_0x42fb7b){return _0x42fb7b['destroy']()[_0xedf0('0x20')](function(){_0x5b8ec1[_0xedf0('0x18')](0xcc)[_0xedf0('0x21')]();});}};}function handleEntityNotFound(_0x346bd9,_0x586645){return function(_0x262024){if(!_0x262024){_0x346bd9[_0xedf0('0x22')](0x194);}return _0x262024;};}function handleError(_0x4fdedb,_0x36cee6){_0x36cee6=_0x36cee6||0x1f4;return function(_0x14aa14){logger[_0xedf0('0x23')](_0x14aa14[_0xedf0('0x24')]);if(_0x14aa14[_0xedf0('0x25')]){delete _0x14aa14[_0xedf0('0x25')];}_0x4fdedb[_0xedf0('0x18')](_0x36cee6)[_0xedf0('0x26')](_0x14aa14);};}exports[_0xedf0('0x27')]=function(_0x543767,_0x1b7067){var _0xebfcb7={},_0x5314a2={},_0xae9e0d={'count':0x0,'rows':[]};var _0x858bb=_[_0xedf0('0x28')](db[_0xedf0('0x29')]['rawAttributes'],function(_0x331aa5){return{'name':_0x331aa5['fieldName'],'type':_0x331aa5[_0xedf0('0x2a')][_0xedf0('0x2b')]};});_0x5314a2[_0xedf0('0x2c')]=_[_0xedf0('0x28')](_0x858bb,_0xedf0('0x25'));_0x5314a2[_0xedf0('0x2d')]=_[_0xedf0('0x2e')](_0x543767['query']);_0x5314a2[_0xedf0('0x2f')]=_[_0xedf0('0x30')](_0x5314a2[_0xedf0('0x2c')],_0x5314a2['query']);_0xebfcb7[_0xedf0('0x31')]=_[_0xedf0('0x30')](_0x5314a2[_0xedf0('0x2c')],qs[_0xedf0('0x32')](_0x543767['query'][_0xedf0('0x32')]));_0xebfcb7[_0xedf0('0x31')]=_0xebfcb7[_0xedf0('0x31')][_0xedf0('0x33')]?_0xebfcb7[_0xedf0('0x31')]:_0x5314a2['model'];if(!_0x543767[_0xedf0('0x2d')][_0xedf0('0x34')]('nolimit')){_0xebfcb7[_0xedf0('0x1c')]=qs[_0xedf0('0x1c')](_0x543767['query'][_0xedf0('0x1c')]);_0xebfcb7[_0xedf0('0x1b')]=qs[_0xedf0('0x1b')](_0x543767[_0xedf0('0x2d')][_0xedf0('0x1b')]);}_0xebfcb7['order']=qs[_0xedf0('0x35')](_0x543767[_0xedf0('0x2d')]['sort']);_0xebfcb7['where']=qs[_0xedf0('0x2f')](_[_0xedf0('0x36')](_0x543767[_0xedf0('0x2d')],_0x5314a2[_0xedf0('0x2f')]),_0x858bb);if(_0x543767['query']['filter']){_0xebfcb7['where']=_[_0xedf0('0x37')](_0xebfcb7['where'],{'$or':_[_0xedf0('0x28')](_0x858bb,function(_0x107e01){if(_0x107e01[_0xedf0('0x2a')]!==_0xedf0('0x38')){var _0x2b90b6={};_0x2b90b6[_0x107e01[_0xedf0('0x25')]]={'$like':'%'+_0x543767[_0xedf0('0x2d')][_0xedf0('0x39')]+'%'};return _0x2b90b6;}})});}_0xebfcb7=_[_0xedf0('0x37')]({},_0xebfcb7,_0x543767['options']);var _0x400e4b={'where':_0xebfcb7[_0xedf0('0x3a')]};return db[_0xedf0('0x29')]['count'](_0x400e4b)[_0xedf0('0x20')](function(_0x33e898){_0xae9e0d[_0xedf0('0x1a')]=_0x33e898;if(_0x543767[_0xedf0('0x2d')]['includeAll']){_0xebfcb7[_0xedf0('0x3b')]=[{'all':!![]}];}return db[_0xedf0('0x29')][_0xedf0('0x3c')](_0xebfcb7);})['then'](function(_0x56c921){_0xae9e0d[_0xedf0('0x3d')]=_0x56c921;return _0xae9e0d;})['then'](respondWithFilteredResult(_0x1b7067,_0xebfcb7))[_0xedf0('0x3e')](handleError(_0x1b7067,null));};exports[_0xedf0('0x3f')]=function(_0xc8dd4c,_0xbad4a){var _0xb897f={'raw':!![],'where':{'id':_0xc8dd4c[_0xedf0('0x40')]['id']}},_0x466e18={};_0x466e18[_0xedf0('0x2c')]=_[_0xedf0('0x2e')](db[_0xedf0('0x29')][_0xedf0('0x41')]);_0x466e18['query']=_['keys'](_0xc8dd4c[_0xedf0('0x2d')]);_0x466e18[_0xedf0('0x2f')]=_[_0xedf0('0x30')](_0x466e18[_0xedf0('0x2c')],_0x466e18[_0xedf0('0x2d')]);_0xb897f[_0xedf0('0x31')]=_['intersection'](_0x466e18[_0xedf0('0x2c')],qs[_0xedf0('0x32')](_0xc8dd4c[_0xedf0('0x2d')][_0xedf0('0x32')]));_0xb897f['attributes']=_0xb897f[_0xedf0('0x31')][_0xedf0('0x33')]?_0xb897f[_0xedf0('0x31')]:_0x466e18[_0xedf0('0x2c')];if(_0xc8dd4c[_0xedf0('0x2d')][_0xedf0('0x42')]){_0xb897f[_0xedf0('0x3b')]=[{'all':!![]}];}_0xb897f=_[_0xedf0('0x37')]({},_0xb897f,_0xc8dd4c['options']);return db['WhatsappQueueReport'][_0xedf0('0x43')](_0xb897f)['then'](handleEntityNotFound(_0xbad4a,null))['then'](respondWithResult(_0xbad4a,null))[_0xedf0('0x3e')](handleError(_0xbad4a,null));};exports[_0xedf0('0x44')]=function(_0x561ed2,_0x55900d){return db['WhatsappQueueReport'][_0xedf0('0x44')](_0x561ed2[_0xedf0('0x45')],{})['then'](respondWithResult(_0x55900d,0xc9))['catch'](handleError(_0x55900d,null));};exports['update']=function(_0x29618c,_0x788731){if(_0x29618c[_0xedf0('0x45')]['id']){delete _0x29618c[_0xedf0('0x45')]['id'];}return db[_0xedf0('0x29')]['find']({'where':{'id':_0x29618c[_0xedf0('0x40')]['id']}})[_0xedf0('0x20')](handleEntityNotFound(_0x788731,null))[_0xedf0('0x20')](saveUpdates(_0x29618c[_0xedf0('0x45')],null))[_0xedf0('0x20')](respondWithResult(_0x788731,null))[_0xedf0('0x3e')](handleError(_0x788731,null));};exports[_0xedf0('0x46')]=function(_0x444fb7,_0x499881){return db[_0xedf0('0x29')][_0xedf0('0x43')]({'where':{'id':_0x444fb7['params']['id']}})['then'](handleEntityNotFound(_0x499881,null))[_0xedf0('0x20')](removeEntity(_0x499881,null))[_0xedf0('0x3e')](handleError(_0x499881,null));};exports[_0xedf0('0x47')]=function(_0x1cef16,_0x19cfee){return db[_0xedf0('0x29')][_0xedf0('0x47')]()[_0xedf0('0x20')](respondWithResult(_0x19cfee,null))[_0xedf0('0x3e')](handleError(_0x19cfee,null));}; \ No newline at end of file +var _0xa30a=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','apply','update','then','destroy','error','stack','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','create','body','find','describe','html-pdf'];(function(_0x6f2ce5,_0x4231eb){var _0x28a54a=function(_0x1bc980){while(--_0x1bc980){_0x6f2ce5['push'](_0x6f2ce5['shift']());}};_0x28a54a(++_0x4231eb);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0xaa30('0x0'));var emlformat=require(_0xaa30('0x1'));var rimraf=require(_0xaa30('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa30('0x3'));var rp=require(_0xaa30('0x4'));var moment=require(_0xaa30('0x5'));var BPromise=require(_0xaa30('0x6'));var Mustache=require(_0xaa30('0x7'));var util=require(_0xaa30('0x8'));var path=require(_0xaa30('0x9'));var sox=require('sox');var csv=require(_0xaa30('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xa'));var querystring=require(_0xaa30('0xf'));var Papa=require(_0xaa30('0x10'));var Redis=require(_0xaa30('0x11'));var authService=require(_0xaa30('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x13'));var logger=require('../../config/logger')(_0xaa30('0x14'));var utils=require(_0xaa30('0x15'));var config=require(_0xaa30('0x16'));var db=require(_0xaa30('0x17'))['db'];function respondWithStatusCode(_0x589229,_0xec992f){_0xec992f=_0xec992f||0xcc;return function(_0x3de2d1){if(_0x3de2d1){return _0x589229[_0xaa30('0x18')](_0xec992f);}return _0x589229['status'](_0xec992f)[_0xaa30('0x19')]();};}function respondWithResult(_0xdea23a,_0x25c02e){_0x25c02e=_0x25c02e||0xc8;return function(_0x14de74){if(_0x14de74){return _0xdea23a[_0xaa30('0x1a')](_0x25c02e)[_0xaa30('0x1b')](_0x14de74);}};}function respondWithFilteredResult(_0x3240e9,_0x3b8095){return function(_0x2e37af){if(_0x2e37af){var _0xfae724=_0x2e37af['count'],_0x519518=_0x3b8095[_0xaa30('0x1c')],_0x91839d=_0x3b8095[_0xaa30('0x1c')]+_0x3b8095[_0xaa30('0x1d')],_0x591478;if(_0x91839d>=_0xfae724){_0x91839d=_0xfae724;_0x591478=0xc8;}else{_0x591478=0xce;}_0x3240e9['status'](_0x591478);return _0x3240e9['set']('Content-Range',_0x519518+'-'+_0x91839d+'/'+_0xfae724)[_0xaa30('0x1b')](_0x2e37af);}return null;};}function patchUpdates(_0x4acdfa){return function(_0xfb02ab){try{jsonpatch[_0xaa30('0x1e')](_0xfb02ab,_0x4acdfa,!![]);}catch(_0x48561d){return BPromise['reject'](_0x48561d);}return _0xfb02ab['save']();};}function saveUpdates(_0x3cbf92,_0x3e4f1d){return function(_0x61b85){if(_0x61b85){return _0x61b85[_0xaa30('0x1f')](_0x3cbf92)[_0xaa30('0x20')](function(_0x4aacfd){return _0x4aacfd;});}return null;};}function removeEntity(_0x3f6295,_0x24bb25){return function(_0x2e16e7){if(_0x2e16e7){return _0x2e16e7[_0xaa30('0x21')]()[_0xaa30('0x20')](function(){_0x3f6295['status'](0xcc)[_0xaa30('0x19')]();});}};}function handleEntityNotFound(_0x13128a,_0x2fecdd){return function(_0x326f84){if(!_0x326f84){_0x13128a['sendStatus'](0x194);}return _0x326f84;};}function handleError(_0x14d7fa,_0x1be54c){_0x1be54c=_0x1be54c||0x1f4;return function(_0x19ba52){logger[_0xaa30('0x22')](_0x19ba52[_0xaa30('0x23')]);if(_0x19ba52[_0xaa30('0x24')]){delete _0x19ba52['name'];}_0x14d7fa[_0xaa30('0x1a')](_0x1be54c)[_0xaa30('0x25')](_0x19ba52);};}exports['index']=function(_0xb043e4,_0x5b3efb){var _0x2da4da={},_0x33a0c9={},_0x2aabf8={'count':0x0,'rows':[]};var _0xd1eb3a=_[_0xaa30('0x26')](db[_0xaa30('0x27')][_0xaa30('0x28')],function(_0x39f708){return{'name':_0x39f708[_0xaa30('0x29')],'type':_0x39f708[_0xaa30('0x2a')][_0xaa30('0x2b')]};});_0x33a0c9[_0xaa30('0x2c')]=_[_0xaa30('0x26')](_0xd1eb3a,_0xaa30('0x24'));_0x33a0c9[_0xaa30('0x2d')]=_[_0xaa30('0x2e')](_0xb043e4[_0xaa30('0x2d')]);_0x33a0c9[_0xaa30('0x2f')]=_['intersection'](_0x33a0c9[_0xaa30('0x2c')],_0x33a0c9[_0xaa30('0x2d')]);_0x2da4da[_0xaa30('0x30')]=_[_0xaa30('0x31')](_0x33a0c9[_0xaa30('0x2c')],qs[_0xaa30('0x32')](_0xb043e4['query']['fields']));_0x2da4da['attributes']=_0x2da4da[_0xaa30('0x30')][_0xaa30('0x33')]?_0x2da4da[_0xaa30('0x30')]:_0x33a0c9[_0xaa30('0x2c')];if(!_0xb043e4[_0xaa30('0x2d')]['hasOwnProperty']('nolimit')){_0x2da4da[_0xaa30('0x1d')]=qs[_0xaa30('0x1d')](_0xb043e4['query'][_0xaa30('0x1d')]);_0x2da4da['offset']=qs[_0xaa30('0x1c')](_0xb043e4['query'][_0xaa30('0x1c')]);}_0x2da4da[_0xaa30('0x34')]=qs['sort'](_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x35')]);_0x2da4da[_0xaa30('0x36')]=qs[_0xaa30('0x2f')](_[_0xaa30('0x37')](_0xb043e4[_0xaa30('0x2d')],_0x33a0c9['filters']),_0xd1eb3a);if(_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x38')]){_0x2da4da['where']=_[_0xaa30('0x39')](_0x2da4da[_0xaa30('0x36')],{'$or':_[_0xaa30('0x26')](_0xd1eb3a,function(_0x557012){if(_0x557012['type']!==_0xaa30('0x3a')){var _0x21ffb0={};_0x21ffb0[_0x557012[_0xaa30('0x24')]]={'$like':'%'+_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x38')]+'%'};return _0x21ffb0;}})});}_0x2da4da=_[_0xaa30('0x39')]({},_0x2da4da,_0xb043e4['options']);var _0x5ca1b0={'where':_0x2da4da[_0xaa30('0x36')]};return db[_0xaa30('0x27')][_0xaa30('0x3b')](_0x5ca1b0)['then'](function(_0x244bca){_0x2aabf8[_0xaa30('0x3b')]=_0x244bca;if(_0xb043e4[_0xaa30('0x2d')][_0xaa30('0x3c')]){_0x2da4da['include']=[{'all':!![]}];}return db[_0xaa30('0x27')][_0xaa30('0x3d')](_0x2da4da);})[_0xaa30('0x20')](function(_0x480795){_0x2aabf8[_0xaa30('0x3e')]=_0x480795;return _0x2aabf8;})['then'](respondWithFilteredResult(_0x5b3efb,_0x2da4da))[_0xaa30('0x3f')](handleError(_0x5b3efb,null));};exports[_0xaa30('0x40')]=function(_0x22dfa5,_0x7b6a6b){var _0x13f08f={'raw':!![],'where':{'id':_0x22dfa5[_0xaa30('0x41')]['id']}},_0x4478cc={};_0x4478cc[_0xaa30('0x2c')]=_['keys'](db['WhatsappQueueReport'][_0xaa30('0x28')]);_0x4478cc['query']=_['keys'](_0x22dfa5['query']);_0x4478cc[_0xaa30('0x2f')]=_['intersection'](_0x4478cc[_0xaa30('0x2c')],_0x4478cc['query']);_0x13f08f[_0xaa30('0x30')]=_[_0xaa30('0x31')](_0x4478cc[_0xaa30('0x2c')],qs[_0xaa30('0x32')](_0x22dfa5[_0xaa30('0x2d')][_0xaa30('0x32')]));_0x13f08f[_0xaa30('0x30')]=_0x13f08f[_0xaa30('0x30')][_0xaa30('0x33')]?_0x13f08f[_0xaa30('0x30')]:_0x4478cc[_0xaa30('0x2c')];if(_0x22dfa5['query'][_0xaa30('0x3c')]){_0x13f08f[_0xaa30('0x42')]=[{'all':!![]}];}_0x13f08f=_[_0xaa30('0x39')]({},_0x13f08f,_0x22dfa5[_0xaa30('0x43')]);return db[_0xaa30('0x27')]['find'](_0x13f08f)['then'](handleEntityNotFound(_0x7b6a6b,null))[_0xaa30('0x20')](respondWithResult(_0x7b6a6b,null))['catch'](handleError(_0x7b6a6b,null));};exports[_0xaa30('0x44')]=function(_0xbf9edd,_0xef3564){return db[_0xaa30('0x27')][_0xaa30('0x44')](_0xbf9edd[_0xaa30('0x45')],{})[_0xaa30('0x20')](respondWithResult(_0xef3564,0xc9))['catch'](handleError(_0xef3564,null));};exports[_0xaa30('0x1f')]=function(_0x6c9da6,_0xfa14bf){if(_0x6c9da6['body']['id']){delete _0x6c9da6[_0xaa30('0x45')]['id'];}return db[_0xaa30('0x27')]['find']({'where':{'id':_0x6c9da6[_0xaa30('0x41')]['id']}})['then'](handleEntityNotFound(_0xfa14bf,null))[_0xaa30('0x20')](saveUpdates(_0x6c9da6['body'],null))['then'](respondWithResult(_0xfa14bf,null))[_0xaa30('0x3f')](handleError(_0xfa14bf,null));};exports['destroy']=function(_0x56389c,_0xf6a737){return db[_0xaa30('0x27')][_0xaa30('0x46')]({'where':{'id':_0x56389c[_0xaa30('0x41')]['id']}})[_0xaa30('0x20')](handleEntityNotFound(_0xf6a737,null))[_0xaa30('0x20')](removeEntity(_0xf6a737,null))['catch'](handleError(_0xf6a737,null));};exports[_0xaa30('0x47')]=function(_0x17868d,_0x4531b7){return db['WhatsappQueueReport']['describe']()['then'](respondWithResult(_0x4531b7,null))['catch'](handleError(_0x4531b7,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 2602cf8..794d586 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 _0x8cf2=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x8cf2,0x103));var _0x28cf=function(_0x227b44,_0x92c667){_0x227b44=_0x227b44-0x0;var _0x1fe89d=_0x8cf2[_0x227b44];return _0x1fe89d;};'use strict';var _=require(_0x28cf('0x0'));var util=require(_0x28cf('0x1'));var logger=require(_0x28cf('0x2'))(_0x28cf('0x3'));var moment=require(_0x28cf('0x4'));var BPromise=require(_0x28cf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x28cf('0x6'));var config=require(_0x28cf('0x7'));var attributes=require(_0x28cf('0x8'));module['exports']=function(_0x1d2d8d,_0x4b7ad9){return _0x1d2d8d[_0x28cf('0x9')](_0x28cf('0xa'),attributes,{'tableName':_0x28cf('0xb'),'paranoid':![],'indexes':[{'name':_0x28cf('0xc'),'fields':[_0x28cf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9877=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x30d558,_0x1982b5){var _0x2f0491=function(_0xf0ce3c){while(--_0xf0ce3c){_0x30d558['push'](_0x30d558['shift']());}};_0x2f0491(++_0x1982b5);}(_0x9877,0xcf));var _0x7987=function(_0x29022d,_0x1170d2){_0x29022d=_0x29022d-0x0;var _0x448906=_0x9877[_0x29022d];return _0x448906;};'use strict';var _=require(_0x7987('0x0'));var util=require(_0x7987('0x1'));var logger=require(_0x7987('0x2'))(_0x7987('0x3'));var moment=require(_0x7987('0x4'));var BPromise=require(_0x7987('0x5'));var rp=require(_0x7987('0x6'));var fs=require('fs');var path=require(_0x7987('0x7'));var rimraf=require(_0x7987('0x8'));var config=require(_0x7987('0x9'));var attributes=require(_0x7987('0xa'));module[_0x7987('0xb')]=function(_0x3d218f,_0xd263b5){return _0x3d218f[_0x7987('0xc')](_0x7987('0xd'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x7987('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index c43c450..d124726 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 _0x674b=['error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','update','body','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0x674b,0x10e));var _0xb674=function(_0xf20b6,_0x49ddbb){_0xf20b6=_0xf20b6-0x0;var _0x4ff567=_0x674b[_0xf20b6];return _0x4ff567;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb674('0x0'));var BPromise=require(_0xb674('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb674('0x2'));var db=require(_0xb674('0x3'))['db'];var utils=require(_0xb674('0x4'));var logger=require(_0xb674('0x5'))(_0xb674('0x6'));var config=require(_0xb674('0x7'));var jayson=require(_0xb674('0x8'));var client=jayson[_0xb674('0x9')][_0xb674('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b4f47,_0x27d5a7,_0x43a55c){return new BPromise(function(_0x343c9e,_0x1adab2){return client[_0xb674('0xb')](_0x4b4f47,_0x43a55c)[_0xb674('0xc')](function(_0x687df1){logger[_0xb674('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x27d5a7,_0xb674('0xe'));logger[_0xb674('0xf')](_0xb674('0x10'),_0x27d5a7,_0xb674('0xe'),JSON[_0xb674('0x11')](_0x687df1));if(_0x687df1[_0xb674('0x12')]){if(_0x687df1[_0xb674('0x12')][_0xb674('0x13')]===0x1f4){logger[_0xb674('0x12')](_0xb674('0x14'),_0x27d5a7,_0x687df1[_0xb674('0x12')][_0xb674('0x15')]);return _0x1adab2(_0x687df1['error']['message']);}logger[_0xb674('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x27d5a7,_0x687df1[_0xb674('0x12')]['message']);return _0x343c9e(_0x687df1[_0xb674('0x12')]['message']);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x27d5a7,'request\x20sent');_0x343c9e(_0x687df1[_0xb674('0x16')]['message']);}})[_0xb674('0x17')](function(_0xc640e5){logger[_0xb674('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x27d5a7,_0xc640e5);_0x1adab2(_0xc640e5);});});}exports[_0xb674('0x18')]=function(_0x3b79c8){var _0x44444b=this;return new Promise(function(_0x124499,_0x18be0b){return db[_0xb674('0x19')][_0xb674('0x1a')](_0x3b79c8['body'],{'raw':_0x3b79c8[_0xb674('0x1b')]?_0x3b79c8[_0xb674('0x1b')][_0xb674('0x1c')]===undefined?!![]:![]:!![]})[_0xb674('0xc')](function(_0x9bd0a5){logger['info']('CreateWhatsappQueueReport',_0x3b79c8);logger['debug']('CreateWhatsappQueueReport',_0x3b79c8,JSON[_0xb674('0x11')](_0x9bd0a5));_0x124499(_0x9bd0a5);})[_0xb674('0x17')](function(_0x5ad086){logger[_0xb674('0x12')]('CreateWhatsappQueueReport',_0x5ad086[_0xb674('0x15')],_0x3b79c8);_0x18be0b(_0x44444b[_0xb674('0x12')](0x1f4,_0x5ad086[_0xb674('0x15')]));});});};exports[_0xb674('0x1d')]=function(_0x17db59){var _0x1d0681=this;return new Promise(function(_0x440f41,_0x170b9d){return db[_0xb674('0x19')][_0xb674('0x1e')](_0x17db59[_0xb674('0x1f')],{'raw':_0x17db59[_0xb674('0x1b')]?_0x17db59[_0xb674('0x1b')][_0xb674('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17db59['options']?_0x17db59['options']['where']||null:null,'attributes':_0x17db59[_0xb674('0x1b')]?_0x17db59[_0xb674('0x1b')]['attributes']||null:null,'limit':_0x17db59[_0xb674('0x1b')]?_0x17db59['options']['limit']||null:null})[_0xb674('0xc')](function(_0x5eed50){logger[_0xb674('0xd')](_0xb674('0x1d'),_0x17db59);logger[_0xb674('0xf')](_0xb674('0x1d'),_0x17db59,JSON[_0xb674('0x11')](_0x5eed50));_0x440f41(_0x5eed50);})[_0xb674('0x17')](function(_0x2c0562){logger[_0xb674('0x12')](_0xb674('0x1d'),_0x2c0562[_0xb674('0x15')],_0x17db59);_0x170b9d(_0x1d0681[_0xb674('0x12')](0x1f4,_0x2c0562[_0xb674('0x15')]));});});}; \ No newline at end of file +var _0x6bdb=['CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x522071,_0x436117){var _0x187be3=function(_0x617cf4){while(--_0x617cf4){_0x522071['push'](_0x522071['shift']());}};_0x187be3(++_0x436117);}(_0x6bdb,0x88));var _0xb6bd=function(_0x4530cd,_0x118462){_0x4530cd=_0x4530cd-0x0;var _0x8b2222=_0x6bdb[_0x4530cd];return _0x8b2222;};'use strict';var _=require(_0xb6bd('0x0'));var util=require(_0xb6bd('0x1'));var moment=require(_0xb6bd('0x2'));var BPromise=require(_0xb6bd('0x3'));var rs=require(_0xb6bd('0x4'));var fs=require('fs');var Redis=require(_0xb6bd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb6bd('0x6'));var logger=require('../../config/logger')(_0xb6bd('0x7'));var config=require(_0xb6bd('0x8'));var jayson=require(_0xb6bd('0x9'));var client=jayson[_0xb6bd('0xa')][_0xb6bd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x986fcc,_0x1249fa,_0x206de7){return new BPromise(function(_0xea548e,_0x1715a5){return client['request'](_0x986fcc,_0x206de7)[_0xb6bd('0xc')](function(_0x293c54){logger[_0xb6bd('0xd')](_0xb6bd('0xe'),_0x1249fa,_0xb6bd('0xf'));logger[_0xb6bd('0x10')](_0xb6bd('0x11'),_0x1249fa,_0xb6bd('0xf'),JSON[_0xb6bd('0x12')](_0x293c54));if(_0x293c54[_0xb6bd('0x13')]){if(_0x293c54[_0xb6bd('0x13')][_0xb6bd('0x14')]===0x1f4){logger[_0xb6bd('0x13')](_0xb6bd('0xe'),_0x1249fa,_0x293c54[_0xb6bd('0x13')][_0xb6bd('0x15')]);return _0x1715a5(_0x293c54['error'][_0xb6bd('0x15')]);}logger[_0xb6bd('0x13')](_0xb6bd('0xe'),_0x1249fa,_0x293c54[_0xb6bd('0x13')][_0xb6bd('0x15')]);return _0xea548e(_0x293c54[_0xb6bd('0x13')][_0xb6bd('0x15')]);}else{logger[_0xb6bd('0xd')](_0xb6bd('0xe'),_0x1249fa,_0xb6bd('0xf'));_0xea548e(_0x293c54[_0xb6bd('0x16')][_0xb6bd('0x15')]);}})[_0xb6bd('0x17')](function(_0x16ed64){logger[_0xb6bd('0x13')](_0xb6bd('0xe'),_0x1249fa,_0x16ed64);_0x1715a5(_0x16ed64);});});}exports[_0xb6bd('0x18')]=function(_0x3599d1){var _0x2ca6d0=this;return new Promise(function(_0x5e392c,_0x492baf){return db[_0xb6bd('0x19')][_0xb6bd('0x1a')](_0x3599d1[_0xb6bd('0x1b')],{'raw':_0x3599d1[_0xb6bd('0x1c')]?_0x3599d1[_0xb6bd('0x1c')][_0xb6bd('0x1d')]===undefined?!![]:![]:!![]})[_0xb6bd('0xc')](function(_0x288dc9){logger['info'](_0xb6bd('0x18'),_0x3599d1);logger['debug'](_0xb6bd('0x18'),_0x3599d1,JSON['stringify'](_0x288dc9));_0x5e392c(_0x288dc9);})[_0xb6bd('0x17')](function(_0x15044a){logger[_0xb6bd('0x13')](_0xb6bd('0x18'),_0x15044a[_0xb6bd('0x15')],_0x3599d1);_0x492baf(_0x2ca6d0[_0xb6bd('0x13')](0x1f4,_0x15044a[_0xb6bd('0x15')]));});});};exports[_0xb6bd('0x1e')]=function(_0x3c23a7){var _0x15fbad=this;return new Promise(function(_0xccdce,_0x506eed){return db[_0xb6bd('0x19')]['update'](_0x3c23a7[_0xb6bd('0x1b')],{'raw':_0x3c23a7['options']?_0x3c23a7['options'][_0xb6bd('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c23a7[_0xb6bd('0x1c')]?_0x3c23a7[_0xb6bd('0x1c')]['where']||null:null,'attributes':_0x3c23a7['options']?_0x3c23a7['options'][_0xb6bd('0x1f')]||null:null,'limit':_0x3c23a7['options']?_0x3c23a7[_0xb6bd('0x1c')]['limit']||null:null})[_0xb6bd('0xc')](function(_0x220713){logger[_0xb6bd('0xd')](_0xb6bd('0x1e'),_0x3c23a7);logger[_0xb6bd('0x10')](_0xb6bd('0x1e'),_0x3c23a7,JSON[_0xb6bd('0x12')](_0x220713));_0xccdce(_0x220713);})[_0xb6bd('0x17')](function(_0x2519c4){logger['error'](_0xb6bd('0x1e'),_0x2519c4[_0xb6bd('0x15')],_0x3c23a7);_0x506eed(_0x15fbad[_0xb6bd('0x13')](0x1f4,_0x2519c4[_0xb6bd('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index bafd480..0304cbf 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 _0x3946=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','post'];(function(_0x5097a5,_0x5688dd){var _0xf5d41e=function(_0x3e73d1){while(--_0x3e73d1){_0x5097a5['push'](_0x5097a5['shift']());}};_0xf5d41e(++_0x5688dd);}(_0x3946,0x10e));var _0x6394=function(_0x1f48e5,_0x451e6e){_0x1f48e5=_0x1f48e5-0x0;var _0x342f42=_0x3946[_0x1f48e5];return _0x342f42;};'use strict';var multer=require(_0x6394('0x0'));var util=require(_0x6394('0x1'));var path=require(_0x6394('0x2'));var timeout=require(_0x6394('0x3'));var express=require(_0x6394('0x4'));var router=express[_0x6394('0x5')]();var auth=require(_0x6394('0x6'));var interaction=require(_0x6394('0x7'));var config=require(_0x6394('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x6394('0x9')]('/',auth['isAuthenticated'](),controller[_0x6394('0xa')]);router[_0x6394('0x9')]('/describe',auth[_0x6394('0xb')](),controller[_0x6394('0xc')]);router[_0x6394('0x9')](_0x6394('0xd'),auth[_0x6394('0xb')](),controller[_0x6394('0xe')]);router[_0x6394('0xf')]('/',auth[_0x6394('0xb')](),controller[_0x6394('0x10')]);router[_0x6394('0x11')](_0x6394('0xd'),auth['isAuthenticated'](),controller[_0x6394('0x12')]);router[_0x6394('0x13')]('/:id',auth[_0x6394('0xb')](),controller[_0x6394('0x14')]);module[_0x6394('0x15')]=router; \ No newline at end of file +var _0x8555=['isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get'];(function(_0x20db46,_0x516437){var _0x4457a9=function(_0x2b6a84){while(--_0x2b6a84){_0x20db46['push'](_0x20db46['shift']());}};_0x4457a9(++_0x516437);}(_0x8555,0x13c));var _0x5855=function(_0x1a4071,_0x32b6b2){_0x1a4071=_0x1a4071-0x0;var _0x51ff0d=_0x8555[_0x1a4071];return _0x51ff0d;};'use strict';var multer=require(_0x5855('0x0'));var util=require('util');var path=require(_0x5855('0x1'));var timeout=require(_0x5855('0x2'));var express=require('express');var router=express[_0x5855('0x3')]();var auth=require(_0x5855('0x4'));var interaction=require(_0x5855('0x5'));var config=require('../../config/environment');var controller=require(_0x5855('0x6'));router[_0x5855('0x7')]('/',auth[_0x5855('0x8')](),controller[_0x5855('0x9')]);router[_0x5855('0x7')](_0x5855('0xa'),auth[_0x5855('0x8')](),controller[_0x5855('0xb')]);router[_0x5855('0x7')](_0x5855('0xc'),auth[_0x5855('0x8')](),controller[_0x5855('0xd')]);router[_0x5855('0xe')]('/',auth[_0x5855('0x8')](),controller[_0x5855('0xf')]);router['put']('/:id',auth[_0x5855('0x8')](),controller['update']);router[_0x5855('0x10')](_0x5855('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x5855('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 377bf7e..32e64e8 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x0b0e,0x187));var _0xe0b0=function(_0x139b63,_0x389ca8){_0x139b63=_0x139b63-0x0;var _0x2493f2=_0x0b0e[_0x139b63];return _0x2493f2;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file +var _0x0b0e=['DATE','sequelize','STRING','account','agent','queue'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1b5080,_0x3e7cc9){_0x1b5080=_0x1b5080-0x0;var _0x195c87=_0x0b0e[_0x1b5080];return _0x195c87;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe0b0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xe0b0('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 8ce4d5f..c2863dc 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 _0x4417=['findAll','rows','catch','show','params','keys','include','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','json','count','offset','limit','apply','reject','save','update','destroy','then','error','name','send','index','map','rawAttributes','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','WhatsappTransferReport','includeAll'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4417,0x1bb));var _0x7441=function(_0x8e1031,_0x2882fb){_0x8e1031=_0x8e1031-0x0;var _0xd0002e=_0x4417[_0x8e1031];return _0xd0002e;};'use strict';var pdf=require(_0x7441('0x0'));var emlformat=require(_0x7441('0x1'));var rimraf=require(_0x7441('0x2'));var zipdir=require(_0x7441('0x3'));var jsonpatch=require(_0x7441('0x4'));var rp=require(_0x7441('0x5'));var moment=require('moment');var BPromise=require(_0x7441('0x6'));var Mustache=require(_0x7441('0x7'));var util=require(_0x7441('0x8'));var path=require(_0x7441('0x9'));var sox=require(_0x7441('0xa'));var csv=require('to-csv');var ejs=require(_0x7441('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7441('0xc'));var crypto=require(_0x7441('0xd'));var jsforce=require(_0x7441('0xe'));var deskjs=require(_0x7441('0xf'));var toCsv=require(_0x7441('0x10'));var querystring=require(_0x7441('0x11'));var Papa=require(_0x7441('0x12'));var Redis=require(_0x7441('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7441('0x14'));var as=require(_0x7441('0x15'));var hardwareService=require(_0x7441('0x16'));var logger=require('../../config/logger')(_0x7441('0x17'));var utils=require('../../config/utils');var config=require(_0x7441('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d9992,_0x5b6034){_0x5b6034=_0x5b6034||0xcc;return function(_0x3ee7cf){if(_0x3ee7cf){return _0x3d9992[_0x7441('0x19')](_0x5b6034);}return _0x3d9992[_0x7441('0x1a')](_0x5b6034)['end']();};}function respondWithResult(_0x1dadf7,_0x50d5fb){_0x50d5fb=_0x50d5fb||0xc8;return function(_0x1c417b){if(_0x1c417b){return _0x1dadf7[_0x7441('0x1a')](_0x50d5fb)[_0x7441('0x1b')](_0x1c417b);}};}function respondWithFilteredResult(_0x3ef0a5,_0x4ad0a7){return function(_0x3cc8e4){if(_0x3cc8e4){var _0x284b08=_0x3cc8e4[_0x7441('0x1c')],_0x3012e5=_0x4ad0a7['offset'],_0x44087d=_0x4ad0a7[_0x7441('0x1d')]+_0x4ad0a7[_0x7441('0x1e')],_0x27a251;if(_0x44087d>=_0x284b08){_0x44087d=_0x284b08;_0x27a251=0xc8;}else{_0x27a251=0xce;}_0x3ef0a5[_0x7441('0x1a')](_0x27a251);return _0x3ef0a5['set']('Content-Range',_0x3012e5+'-'+_0x44087d+'/'+_0x284b08)[_0x7441('0x1b')](_0x3cc8e4);}return null;};}function patchUpdates(_0x20c047){return function(_0x6e677c){try{jsonpatch[_0x7441('0x1f')](_0x6e677c,_0x20c047,!![]);}catch(_0x1637df){return BPromise[_0x7441('0x20')](_0x1637df);}return _0x6e677c[_0x7441('0x21')]();};}function saveUpdates(_0x145709,_0x56560f){return function(_0x59c773){if(_0x59c773){return _0x59c773[_0x7441('0x22')](_0x145709)['then'](function(_0x31f1de){return _0x31f1de;});}return null;};}function removeEntity(_0x185fc5,_0x5120c2){return function(_0x314f11){if(_0x314f11){return _0x314f11[_0x7441('0x23')]()[_0x7441('0x24')](function(){_0x185fc5[_0x7441('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd0c091,_0x1b892d){return function(_0x2f4e1f){if(!_0x2f4e1f){_0xd0c091[_0x7441('0x19')](0x194);}return _0x2f4e1f;};}function handleError(_0xc63fa2,_0x281838){_0x281838=_0x281838||0x1f4;return function(_0x3471be){logger[_0x7441('0x25')](_0x3471be['stack']);if(_0x3471be[_0x7441('0x26')]){delete _0x3471be[_0x7441('0x26')];}_0xc63fa2[_0x7441('0x1a')](_0x281838)[_0x7441('0x27')](_0x3471be);};}exports[_0x7441('0x28')]=function(_0x2d4c34,_0x2da2da){var _0x3e4dd3={},_0x51bf9b={},_0x333f14={'count':0x0,'rows':[]};var _0x331c6a=_[_0x7441('0x29')](db['WhatsappTransferReport'][_0x7441('0x2a')],function(_0x4f2d46){return{'name':_0x4f2d46['fieldName'],'type':_0x4f2d46['type']['key']};});_0x51bf9b[_0x7441('0x2b')]=_[_0x7441('0x29')](_0x331c6a,'name');_0x51bf9b[_0x7441('0x2c')]=_['keys'](_0x2d4c34['query']);_0x51bf9b[_0x7441('0x2d')]=_[_0x7441('0x2e')](_0x51bf9b['model'],_0x51bf9b[_0x7441('0x2c')]);_0x3e4dd3[_0x7441('0x2f')]=_[_0x7441('0x2e')](_0x51bf9b[_0x7441('0x2b')],qs[_0x7441('0x30')](_0x2d4c34[_0x7441('0x2c')][_0x7441('0x30')]));_0x3e4dd3[_0x7441('0x2f')]=_0x3e4dd3[_0x7441('0x2f')]['length']?_0x3e4dd3[_0x7441('0x2f')]:_0x51bf9b[_0x7441('0x2b')];if(!_0x2d4c34[_0x7441('0x2c')]['hasOwnProperty'](_0x7441('0x31'))){_0x3e4dd3[_0x7441('0x1e')]=qs[_0x7441('0x1e')](_0x2d4c34[_0x7441('0x2c')][_0x7441('0x1e')]);_0x3e4dd3[_0x7441('0x1d')]=qs[_0x7441('0x1d')](_0x2d4c34[_0x7441('0x2c')][_0x7441('0x1d')]);}_0x3e4dd3[_0x7441('0x32')]=qs[_0x7441('0x33')](_0x2d4c34[_0x7441('0x2c')][_0x7441('0x33')]);_0x3e4dd3[_0x7441('0x34')]=qs[_0x7441('0x2d')](_[_0x7441('0x35')](_0x2d4c34[_0x7441('0x2c')],_0x51bf9b[_0x7441('0x2d')]),_0x331c6a);if(_0x2d4c34['query'][_0x7441('0x36')]){_0x3e4dd3[_0x7441('0x34')]=_[_0x7441('0x37')](_0x3e4dd3[_0x7441('0x34')],{'$or':_[_0x7441('0x29')](_0x331c6a,function(_0x237279){if(_0x237279[_0x7441('0x38')]!==_0x7441('0x39')){var _0x1f11eb={};_0x1f11eb[_0x237279[_0x7441('0x26')]]={'$like':'%'+_0x2d4c34[_0x7441('0x2c')][_0x7441('0x36')]+'%'};return _0x1f11eb;}})});}_0x3e4dd3=_[_0x7441('0x37')]({},_0x3e4dd3,_0x2d4c34[_0x7441('0x3a')]);var _0x5816d3={'where':_0x3e4dd3[_0x7441('0x34')]};return db[_0x7441('0x3b')][_0x7441('0x1c')](_0x5816d3)['then'](function(_0x3dbe1c){_0x333f14[_0x7441('0x1c')]=_0x3dbe1c;if(_0x2d4c34[_0x7441('0x2c')][_0x7441('0x3c')]){_0x3e4dd3['include']=[{'all':!![]}];}return db[_0x7441('0x3b')][_0x7441('0x3d')](_0x3e4dd3);})[_0x7441('0x24')](function(_0x5b1ee9){_0x333f14[_0x7441('0x3e')]=_0x5b1ee9;return _0x333f14;})[_0x7441('0x24')](respondWithFilteredResult(_0x2da2da,_0x3e4dd3))[_0x7441('0x3f')](handleError(_0x2da2da,null));};exports[_0x7441('0x40')]=function(_0x17e706,_0x72d957){var _0x46d9cf={'raw':!![],'where':{'id':_0x17e706[_0x7441('0x41')]['id']}},_0x5b02b5={};_0x5b02b5[_0x7441('0x2b')]=_[_0x7441('0x42')](db[_0x7441('0x3b')][_0x7441('0x2a')]);_0x5b02b5[_0x7441('0x2c')]=_[_0x7441('0x42')](_0x17e706[_0x7441('0x2c')]);_0x5b02b5[_0x7441('0x2d')]=_[_0x7441('0x2e')](_0x5b02b5[_0x7441('0x2b')],_0x5b02b5['query']);_0x46d9cf[_0x7441('0x2f')]=_[_0x7441('0x2e')](_0x5b02b5['model'],qs[_0x7441('0x30')](_0x17e706[_0x7441('0x2c')]['fields']));_0x46d9cf['attributes']=_0x46d9cf['attributes']['length']?_0x46d9cf['attributes']:_0x5b02b5['model'];if(_0x17e706[_0x7441('0x2c')][_0x7441('0x3c')]){_0x46d9cf[_0x7441('0x43')]=[{'all':!![]}];}_0x46d9cf=_[_0x7441('0x37')]({},_0x46d9cf,_0x17e706['options']);return db[_0x7441('0x3b')][_0x7441('0x44')](_0x46d9cf)[_0x7441('0x24')](handleEntityNotFound(_0x72d957,null))[_0x7441('0x24')](respondWithResult(_0x72d957,null))[_0x7441('0x3f')](handleError(_0x72d957,null));};exports['create']=function(_0x268fc1,_0x531a45){return db['WhatsappTransferReport'][_0x7441('0x45')](_0x268fc1[_0x7441('0x46')],{})[_0x7441('0x24')](respondWithResult(_0x531a45,0xc9))[_0x7441('0x3f')](handleError(_0x531a45,null));};exports['update']=function(_0x343ee6,_0x51e657){if(_0x343ee6[_0x7441('0x46')]['id']){delete _0x343ee6['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x343ee6[_0x7441('0x41')]['id']}})[_0x7441('0x24')](handleEntityNotFound(_0x51e657,null))[_0x7441('0x24')](saveUpdates(_0x343ee6['body'],null))[_0x7441('0x24')](respondWithResult(_0x51e657,null))['catch'](handleError(_0x51e657,null));};exports['destroy']=function(_0x5150cd,_0x58ce18){return db[_0x7441('0x3b')][_0x7441('0x44')]({'where':{'id':_0x5150cd['params']['id']}})[_0x7441('0x24')](handleEntityNotFound(_0x58ce18,null))[_0x7441('0x24')](removeEntity(_0x58ce18,null))['catch'](handleError(_0x58ce18,null));};exports['describe']=function(_0x3582e8,_0x28dbf7){return db[_0x7441('0x3b')][_0x7441('0x47')]()[_0x7441('0x24')](respondWithResult(_0x28dbf7,null))['catch'](handleError(_0x28dbf7,null));}; \ No newline at end of file +var _0x1e50=['index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/utils','../../config/environment','../../mysqldb','status','offset','limit','Content-Range','reject','save','update','destroy','then','sendStatus','stack','name','send'];(function(_0x2619a1,_0x394c41){var _0x35ceeb=function(_0x17dc35){while(--_0x17dc35){_0x2619a1['push'](_0x2619a1['shift']());}};_0x35ceeb(++_0x394c41);}(_0x1e50,0x14f));var _0x01e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e50[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x01e5('0x0'));var emlformat=require(_0x01e5('0x1'));var rimraf=require(_0x01e5('0x2'));var zipdir=require(_0x01e5('0x3'));var jsonpatch=require(_0x01e5('0x4'));var rp=require(_0x01e5('0x5'));var moment=require('moment');var BPromise=require(_0x01e5('0x6'));var Mustache=require(_0x01e5('0x7'));var util=require(_0x01e5('0x8'));var path=require(_0x01e5('0x9'));var sox=require(_0x01e5('0xa'));var csv=require(_0x01e5('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x01e5('0xc'));var squel=require(_0x01e5('0xd'));var crypto=require(_0x01e5('0xe'));var jsforce=require(_0x01e5('0xf'));var deskjs=require(_0x01e5('0x10'));var toCsv=require(_0x01e5('0xb'));var querystring=require(_0x01e5('0x11'));var Papa=require('papaparse');var Redis=require(_0x01e5('0x12'));var authService=require(_0x01e5('0x13'));var qs=require(_0x01e5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x01e5('0x15'));var logger=require(_0x01e5('0x16'))(_0x01e5('0x17'));var utils=require(_0x01e5('0x18'));var config=require(_0x01e5('0x19'));var db=require(_0x01e5('0x1a'))['db'];function respondWithStatusCode(_0x3f33f9,_0x170f22){_0x170f22=_0x170f22||0xcc;return function(_0x131c9a){if(_0x131c9a){return _0x3f33f9['sendStatus'](_0x170f22);}return _0x3f33f9[_0x01e5('0x1b')](_0x170f22)['end']();};}function respondWithResult(_0x4befdb,_0x45aced){_0x45aced=_0x45aced||0xc8;return function(_0x4ac892){if(_0x4ac892){return _0x4befdb['status'](_0x45aced)['json'](_0x4ac892);}};}function respondWithFilteredResult(_0x25477f,_0x337cbb){return function(_0x1c9ece){if(_0x1c9ece){var _0x1a1095=_0x1c9ece['count'],_0x27da35=_0x337cbb[_0x01e5('0x1c')],_0x4638d2=_0x337cbb[_0x01e5('0x1c')]+_0x337cbb[_0x01e5('0x1d')],_0x39bcc9;if(_0x4638d2>=_0x1a1095){_0x4638d2=_0x1a1095;_0x39bcc9=0xc8;}else{_0x39bcc9=0xce;}_0x25477f[_0x01e5('0x1b')](_0x39bcc9);return _0x25477f['set'](_0x01e5('0x1e'),_0x27da35+'-'+_0x4638d2+'/'+_0x1a1095)['json'](_0x1c9ece);}return null;};}function patchUpdates(_0x3dfff9){return function(_0xd5ea8b){try{jsonpatch['apply'](_0xd5ea8b,_0x3dfff9,!![]);}catch(_0x32cb57){return BPromise[_0x01e5('0x1f')](_0x32cb57);}return _0xd5ea8b[_0x01e5('0x20')]();};}function saveUpdates(_0x5e868e,_0x289192){return function(_0x4145c5){if(_0x4145c5){return _0x4145c5[_0x01e5('0x21')](_0x5e868e)['then'](function(_0x37729a){return _0x37729a;});}return null;};}function removeEntity(_0x4e2adb,_0x5897ac){return function(_0x3928a4){if(_0x3928a4){return _0x3928a4[_0x01e5('0x22')]()[_0x01e5('0x23')](function(){_0x4e2adb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2339b1,_0x34d4de){return function(_0xb3ce1a){if(!_0xb3ce1a){_0x2339b1[_0x01e5('0x24')](0x194);}return _0xb3ce1a;};}function handleError(_0x444a8e,_0x1e2ed3){_0x1e2ed3=_0x1e2ed3||0x1f4;return function(_0x279190){logger['error'](_0x279190[_0x01e5('0x25')]);if(_0x279190[_0x01e5('0x26')]){delete _0x279190['name'];}_0x444a8e[_0x01e5('0x1b')](_0x1e2ed3)[_0x01e5('0x27')](_0x279190);};}exports[_0x01e5('0x28')]=function(_0x3fa759,_0xeb4249){var _0x1332ed={},_0x4c82e7={},_0x31fee0={'count':0x0,'rows':[]};var _0x191c44=_[_0x01e5('0x29')](db[_0x01e5('0x2a')]['rawAttributes'],function(_0x8afe88){return{'name':_0x8afe88[_0x01e5('0x2b')],'type':_0x8afe88[_0x01e5('0x2c')][_0x01e5('0x2d')]};});_0x4c82e7[_0x01e5('0x2e')]=_[_0x01e5('0x29')](_0x191c44,_0x01e5('0x26'));_0x4c82e7[_0x01e5('0x2f')]=_[_0x01e5('0x30')](_0x3fa759[_0x01e5('0x2f')]);_0x4c82e7[_0x01e5('0x31')]=_['intersection'](_0x4c82e7['model'],_0x4c82e7['query']);_0x1332ed[_0x01e5('0x32')]=_[_0x01e5('0x33')](_0x4c82e7['model'],qs[_0x01e5('0x34')](_0x3fa759['query']['fields']));_0x1332ed[_0x01e5('0x32')]=_0x1332ed[_0x01e5('0x32')][_0x01e5('0x35')]?_0x1332ed[_0x01e5('0x32')]:_0x4c82e7[_0x01e5('0x2e')];if(!_0x3fa759[_0x01e5('0x2f')][_0x01e5('0x36')](_0x01e5('0x37'))){_0x1332ed[_0x01e5('0x1d')]=qs[_0x01e5('0x1d')](_0x3fa759[_0x01e5('0x2f')][_0x01e5('0x1d')]);_0x1332ed[_0x01e5('0x1c')]=qs['offset'](_0x3fa759[_0x01e5('0x2f')][_0x01e5('0x1c')]);}_0x1332ed['order']=qs[_0x01e5('0x38')](_0x3fa759[_0x01e5('0x2f')][_0x01e5('0x38')]);_0x1332ed[_0x01e5('0x39')]=qs[_0x01e5('0x31')](_[_0x01e5('0x3a')](_0x3fa759[_0x01e5('0x2f')],_0x4c82e7[_0x01e5('0x31')]),_0x191c44);if(_0x3fa759[_0x01e5('0x2f')][_0x01e5('0x3b')]){_0x1332ed[_0x01e5('0x39')]=_[_0x01e5('0x3c')](_0x1332ed[_0x01e5('0x39')],{'$or':_[_0x01e5('0x29')](_0x191c44,function(_0x3e6349){if(_0x3e6349[_0x01e5('0x2c')]!==_0x01e5('0x3d')){var _0x569b3f={};_0x569b3f[_0x3e6349[_0x01e5('0x26')]]={'$like':'%'+_0x3fa759[_0x01e5('0x2f')][_0x01e5('0x3b')]+'%'};return _0x569b3f;}})});}_0x1332ed=_[_0x01e5('0x3c')]({},_0x1332ed,_0x3fa759[_0x01e5('0x3e')]);var _0x2c7b08={'where':_0x1332ed[_0x01e5('0x39')]};return db[_0x01e5('0x2a')]['count'](_0x2c7b08)[_0x01e5('0x23')](function(_0x1cbd54){_0x31fee0[_0x01e5('0x3f')]=_0x1cbd54;if(_0x3fa759['query']['includeAll']){_0x1332ed[_0x01e5('0x40')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x01e5('0x41')](_0x1332ed);})['then'](function(_0x30d9e1){_0x31fee0[_0x01e5('0x42')]=_0x30d9e1;return _0x31fee0;})['then'](respondWithFilteredResult(_0xeb4249,_0x1332ed))[_0x01e5('0x43')](handleError(_0xeb4249,null));};exports[_0x01e5('0x44')]=function(_0x8b9905,_0x3bcdad){var _0x1e39db={'raw':!![],'where':{'id':_0x8b9905[_0x01e5('0x45')]['id']}},_0x5a177b={};_0x5a177b[_0x01e5('0x2e')]=_[_0x01e5('0x30')](db['WhatsappTransferReport']['rawAttributes']);_0x5a177b[_0x01e5('0x2f')]=_['keys'](_0x8b9905[_0x01e5('0x2f')]);_0x5a177b[_0x01e5('0x31')]=_[_0x01e5('0x33')](_0x5a177b[_0x01e5('0x2e')],_0x5a177b['query']);_0x1e39db[_0x01e5('0x32')]=_['intersection'](_0x5a177b[_0x01e5('0x2e')],qs['fields'](_0x8b9905[_0x01e5('0x2f')][_0x01e5('0x34')]));_0x1e39db['attributes']=_0x1e39db[_0x01e5('0x32')][_0x01e5('0x35')]?_0x1e39db[_0x01e5('0x32')]:_0x5a177b[_0x01e5('0x2e')];if(_0x8b9905['query'][_0x01e5('0x46')]){_0x1e39db['include']=[{'all':!![]}];}_0x1e39db=_[_0x01e5('0x3c')]({},_0x1e39db,_0x8b9905['options']);return db[_0x01e5('0x2a')][_0x01e5('0x47')](_0x1e39db)[_0x01e5('0x23')](handleEntityNotFound(_0x3bcdad,null))[_0x01e5('0x23')](respondWithResult(_0x3bcdad,null))[_0x01e5('0x43')](handleError(_0x3bcdad,null));};exports['create']=function(_0x1f48d3,_0x413fb0){return db[_0x01e5('0x2a')][_0x01e5('0x48')](_0x1f48d3[_0x01e5('0x49')],{})[_0x01e5('0x23')](respondWithResult(_0x413fb0,0xc9))[_0x01e5('0x43')](handleError(_0x413fb0,null));};exports[_0x01e5('0x21')]=function(_0x3d75c5,_0x4e34f2){if(_0x3d75c5[_0x01e5('0x49')]['id']){delete _0x3d75c5[_0x01e5('0x49')]['id'];}return db[_0x01e5('0x2a')]['find']({'where':{'id':_0x3d75c5[_0x01e5('0x45')]['id']}})['then'](handleEntityNotFound(_0x4e34f2,null))[_0x01e5('0x23')](saveUpdates(_0x3d75c5['body'],null))['then'](respondWithResult(_0x4e34f2,null))[_0x01e5('0x43')](handleError(_0x4e34f2,null));};exports['destroy']=function(_0x2bb910,_0x954ee){return db[_0x01e5('0x2a')][_0x01e5('0x47')]({'where':{'id':_0x2bb910[_0x01e5('0x45')]['id']}})[_0x01e5('0x23')](handleEntityNotFound(_0x954ee,null))[_0x01e5('0x23')](removeEntity(_0x954ee,null))[_0x01e5('0x43')](handleError(_0x954ee,null));};exports[_0x01e5('0x4a')]=function(_0x59f777,_0x501941){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x501941,null))[_0x01e5('0x43')](handleError(_0x501941,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 3732982..797e561 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 _0x0348=['bluebird','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger'];(function(_0x487a38,_0x126142){var _0xc5197d=function(_0x53715d){while(--_0x53715d){_0x487a38['push'](_0x487a38['shift']());}};_0xc5197d(++_0x126142);}(_0x0348,0x172));var _0x8034=function(_0x38080e,_0x95512d){_0x38080e=_0x38080e-0x0;var _0x4e4c87=_0x0348[_0x38080e];return _0x4e4c87;};'use strict';var _=require('lodash');var util=require(_0x8034('0x0'));var logger=require(_0x8034('0x1'))('api');var moment=require('moment');var BPromise=require(_0x8034('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8034('0x3'));var rimraf=require(_0x8034('0x4'));var config=require(_0x8034('0x5'));var attributes=require(_0x8034('0x6'));module[_0x8034('0x7')]=function(_0x4f2bef,_0x11e9d8){return _0x4f2bef[_0x8034('0x8')](_0x8034('0x9'),attributes,{'tableName':_0x8034('0xa'),'paranoid':![],'indexes':[{'name':_0x8034('0xb'),'fields':[_0x8034('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a74=['../../config/environment','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x266bb6,_0x1bb886){var _0x328f95=function(_0xae983c){while(--_0xae983c){_0x266bb6['push'](_0x266bb6['shift']());}};_0x328f95(++_0x1bb886);}(_0x1a74,0x19c));var _0x41a7=function(_0x1393d0,_0xb2ac4){_0x1393d0=_0x1393d0-0x0;var _0x1b67b5=_0x1a74[_0x1393d0];return _0x1b67b5;};'use strict';var _=require(_0x41a7('0x0'));var util=require('util');var logger=require(_0x41a7('0x1'))(_0x41a7('0x2'));var moment=require(_0x41a7('0x3'));var BPromise=require(_0x41a7('0x4'));var rp=require(_0x41a7('0x5'));var fs=require('fs');var path=require(_0x41a7('0x6'));var rimraf=require(_0x41a7('0x7'));var config=require(_0x41a7('0x8'));var attributes=require(_0x41a7('0x9'));module[_0x41a7('0xa')]=function(_0x4658e3,_0x53b9b8){return _0x4658e3['define']('WhatsappTransferReport',attributes,{'tableName':_0x41a7('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 8a1544f..67c1e9a 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(_0x553dfe,_0x4253d6){var _0x106b5d=function(_0xeacc99){while(--_0xeacc99){_0x553dfe['push'](_0x553dfe['shift']());}};_0x106b5d(++_0x4253d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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(_0x58c95d,_0x3b28df){var _0xc12ea9=function(_0x4c7499){while(--_0x4c7499){_0x58c95d['push'](_0x58c95d['shift']());}};_0xc12ea9(++_0x3b28df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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 d283362..60f0f00 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1b1=['Online\x20apps:','map','filter','name','join','Offline\x20apps:','status','online','None','seedDB','./config/seedDB','default','./config/license','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','app','./config/pm2','./config/pm2/config','./config/schedule','sequelize','then','listen','info','start'];(function(_0x3b2e81,_0x16effb){var _0x15bdbf=function(_0x876e4a){while(--_0x876e4a){_0x3b2e81['push'](_0x3b2e81['shift']());}};_0x15bdbf(++_0x16effb);}(_0xf1b1,0x16f));var _0x1f1b=function(_0x54d5c8,_0x344ce5){_0x54d5c8=_0x54d5c8-0x0;var _0x525e2e=_0xf1b1[_0x54d5c8];return _0x525e2e;};'use strict';var _=require('lodash');var mysqldb=require(_0x1f1b('0x0'));var rpc=require(_0x1f1b('0x1'));var config=require('./config/environment');var logger=require('./config/logger')(_0x1f1b('0x2'));var pm2=require(_0x1f1b('0x3'));var pm2Config=require(_0x1f1b('0x4'));var schedule=require(_0x1f1b('0x5'));var chat=require('./config/schedule/chat');function main(){return mysqldb['db'][_0x1f1b('0x6')]['sync']()[_0x1f1b('0x7')](function(){return rpc[_0x1f1b('0x8')]();})[_0x1f1b('0x7')](function(_0xb81490){logger[_0x1f1b('0x9')](_0xb81490);return chat['start']();})['then'](function(){return schedule['start']();})[_0x1f1b('0x7')](function(_0x5cb0b0){logger[_0x1f1b('0x9')](_0x5cb0b0);return pm2[_0x1f1b('0xa')](pm2Config);})[_0x1f1b('0x7')](function(_0x27ab36){logger[_0x1f1b('0x9')](_0x1f1b('0xb'),_[_0x1f1b('0xc')](_[_0x1f1b('0xd')](_0x27ab36,{'status':'online'}),_0x1f1b('0xe'))[_0x1f1b('0xf')]());logger[_0x1f1b('0x9')](_0x1f1b('0x10'),_[_0x1f1b('0xc')](_['filter'](_0x27ab36,function(_0x506f4c){return _0x506f4c[_0x1f1b('0x11')]!==_0x1f1b('0x12');}),_0x1f1b('0xe'))['join']()||_0x1f1b('0x13'));config[_0x1f1b('0x14')]&&require(_0x1f1b('0x15'))[_0x1f1b('0x16')]();require(_0x1f1b('0x17'))[_0x1f1b('0x16')]();})[_0x1f1b('0x18')](function(_0x49898f){logger['error'](_0x1f1b('0x19'),_0x49898f);process[_0x1f1b('0x1a')](0x1);});}main(); \ No newline at end of file +var _0x1c26=['./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','then','listen','info','start','Online\x20apps:','filter','online','name','join','map','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c26,0x1a2));var _0x61c2=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1c26[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x61c2('0x0'));var mysqldb=require(_0x61c2('0x1'));var rpc=require(_0x61c2('0x2'));var config=require(_0x61c2('0x3'));var logger=require(_0x61c2('0x4'))('app');var pm2=require(_0x61c2('0x5'));var pm2Config=require(_0x61c2('0x6'));var schedule=require(_0x61c2('0x7'));var chat=require(_0x61c2('0x8'));function main(){return mysqldb['db'][_0x61c2('0x9')]['sync']()[_0x61c2('0xa')](function(){return rpc[_0x61c2('0xb')]();})[_0x61c2('0xa')](function(_0x1a9073){logger[_0x61c2('0xc')](_0x1a9073);return chat[_0x61c2('0xd')]();})[_0x61c2('0xa')](function(){return schedule[_0x61c2('0xd')]();})['then'](function(_0x3501d9){logger[_0x61c2('0xc')](_0x3501d9);return pm2[_0x61c2('0xd')](pm2Config);})[_0x61c2('0xa')](function(_0x3f3ec7){logger['info'](_0x61c2('0xe'),_['map'](_[_0x61c2('0xf')](_0x3f3ec7,{'status':_0x61c2('0x10')}),_0x61c2('0x11'))[_0x61c2('0x12')]());logger[_0x61c2('0xc')]('Offline\x20apps:',_[_0x61c2('0x13')](_[_0x61c2('0xf')](_0x3f3ec7,function(_0x232c80){return _0x232c80['status']!==_0x61c2('0x10');}),_0x61c2('0x11'))['join']()||_0x61c2('0x14'));config[_0x61c2('0x15')]&&require(_0x61c2('0x16'))[_0x61c2('0x17')]();require(_0x61c2('0x18'))[_0x61c2('0x17')]();})[_0x61c2('0x19')](function(_0x58e571){logger[_0x61c2('0x1a')](_0x61c2('0x1b'),_0x58e571);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 13c215d..37b40f9 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 _0x5f2f=['send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secret','payload','options','verify','toString','hex','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','secrets','session','role','fullname','name','internal','userpic','permissions','md5secret','chatPause','mailPause','faxPause','openchannelPause','lastLoginAt','lastPauseAt','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','Unmanaged.','catch','headers','authorization','startsWith','Basic','User','find','authenticate','pass','json','Wrong\x20credentials.','Bearer','status','apikey','getUuid','query','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','/dashboards/general'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2df939,_0x537d39){_0x2df939=_0x2df939-0x0;var _0x294c83=_0x5f2f[_0x2df939];return _0x294c83;};'use strict';var db=require(_0xf5f2('0x0'))['db'];var config=require(_0xf5f2('0x1'));var hardwareConf=require(_0xf5f2('0x2'));var _=require(_0xf5f2('0x3'));var jwt=require(_0xf5f2('0x4'));var expressJwt=require(_0xf5f2('0x5'));var compose=require(_0xf5f2('0x6'));var basicAuth=require(_0xf5f2('0x7'));var crypto=require('crypto');var BPromise=require('bluebird');var validateJwt=expressJwt({'secret':config[_0xf5f2('0x8')][_0xf5f2('0x9')]});var userAttributes=['id',_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'email',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'voicePause',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'smsPause',_0xf5f2('0x14'),'pauseType','showWebBar',_0xf5f2('0x15'),_0xf5f2('0x16'),'crudPermissions',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'phoneBarEnableDtmfTone',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21'),'hotdesk',_0xf5f2('0x22'),_0xf5f2('0x23')];exports[_0xf5f2('0x24')]=function(){return this[_0xf5f2('0x25')](!![])[_0xf5f2('0x26')](function(_0x3a9dbb,_0xdb61b3,_0x395a5a){if(_0x3a9dbb[_0xf5f2('0x27')]){_0x395a5a();}else{return db[_0xf5f2('0x28')][_0xf5f2('0x29')]({'where':{'id':_0x3a9dbb[_0xf5f2('0x2a')]['id']},'attributes':['id',_0xf5f2('0x2b'),_0xf5f2('0x2c')],'raw':!![]})[_0xf5f2('0x2d')](function(_0x626999){if(_0x626999&&_0x626999[_0xf5f2('0x2b')]){return _0xdb61b3['status'](_0x626999[_0xf5f2('0x2c')]===_0xf5f2('0x2e')?0x195:0x193)['json']({'message':_0x626999['disposition']===_0xf5f2('0x2e')?_0xf5f2('0x2f'):'Forbidden.'});}else{_0x395a5a();}})[_0xf5f2('0x30')](function(_0x170042){_0x395a5a(_0x170042);});}});};exports[_0xf5f2('0x25')]=function isAuthenticated(_0x39c024){return compose()[_0xf5f2('0x26')](function(_0x4c691a,_0x21cd91,_0x4669a6){if(_0x4c691a[_0xf5f2('0x31')][_0xf5f2('0x32')]){if(_[_0xf5f2('0x33')](_0x4c691a['headers']['authorization'],_0xf5f2('0x34'))){var _0x3f79d5=basicAuth(_0x4c691a);db[_0xf5f2('0x35')][_0xf5f2('0x36')]({'where':{'name':_0x3f79d5[_0xf5f2('0xc')]}})[_0xf5f2('0x2d')](function(_0x13a3be){if(!_0x13a3be||!_0x13a3be[_0xf5f2('0x37')](_0x3f79d5[_0xf5f2('0x38')])){return _0x21cd91['status'](0x191)[_0xf5f2('0x39')]({'message':_0xf5f2('0x3a')});}_0x4c691a[_0xf5f2('0x27')]={'id':_0x13a3be['id']};_0x4669a6();})[_0xf5f2('0x30')](function(_0x198c73){_0x4669a6(_0x198c73);});}else if(_[_0xf5f2('0x33')](_0x4c691a['headers']['authorization'],_0xf5f2('0x3b'))){validateJwt(_0x4c691a,_0x21cd91,_0x4669a6);}else{if(_0x39c024){_0x4669a6();}else{return _0x21cd91[_0xf5f2('0x3c')](0x193)[_0xf5f2('0x39')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x4c691a['query'][_0xf5f2('0x3d')]){try{var _0x50b8a2={'audience':hardwareConf[_0xf5f2('0x3e')](),'issuer':hardwareConf[_0xf5f2('0x3e')]()};verifyJwt(_0x4c691a[_0xf5f2('0x3f')]['apikey'],_0x50b8a2)['then'](function(_0x2f4778){return db['User'][_0xf5f2('0x36')]({'where':{'id':_0x2f4778['sub']}})[_0xf5f2('0x2d')](function(_0x31087c){if(!_0x31087c||!_[_0xf5f2('0x40')](_0x31087c[_0xf5f2('0x41')],_0x2f4778[_0xf5f2('0x42')])){return _0x21cd91[_0xf5f2('0x3c')](0x191)[_0xf5f2('0x39')]({'message':_0xf5f2('0x43')});}_0x4c691a['user']={'id':_0x31087c['id']};_0x4669a6();});})[_0xf5f2('0x30')](function(){return _0x21cd91[_0xf5f2('0x3c')](0x191)[_0xf5f2('0x39')]({'message':_0xf5f2('0x44')});});}catch(_0x1408b9){_0x4669a6(_0x1408b9);}}else if(_0x39c024){_0x4669a6();}else{return _0x21cd91[_0xf5f2('0x3c')](0x193)[_0xf5f2('0x39')]({'message':'Unknown\x20authorization\x20format'});}})[_0xf5f2('0x26')](function(_0xf503e8,_0x55989d,_0x3fc168){if(_0xf503e8['user']){db[_0xf5f2('0x35')][_0xf5f2('0x36')]({'where':{'id':_0xf503e8[_0xf5f2('0x27')]['id']},'attributes':userAttributes})[_0xf5f2('0x2d')](function(_0x59a6dd){if(!_0x59a6dd){return _0x55989d['status'](0x194)[_0xf5f2('0x39')]({'message':_0xf5f2('0x45')});}_0xf503e8[_0xf5f2('0x27')]=_0x59a6dd;_0x3fc168();})['catch'](function(_0x41447f){_0x3fc168(_0x41447f);});}else if(_0x39c024){_0x3fc168();}else{return _0x55989d['status'](0x194)[_0xf5f2('0x39')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xf5f2('0x46')]=function canUpdate(){return compose()[_0xf5f2('0x26')](function(_0x5337a6,_0x29694f,_0x46eb22){return require(_0xf5f2('0x47'))[_0xf5f2('0x48')]()['then'](function(_0x5d2d82){if(_0x5d2d82[_0xf5f2('0x49')]){_0x46eb22();}else{return _0x29694f[_0xf5f2('0x3c')](0x193)[_0xf5f2('0x39')]({'message':_0xf5f2('0x4a')});}})[_0xf5f2('0x30')](function(_0xe62b57){_0x46eb22(_0xe62b57);});});};exports[_0xf5f2('0x4b')]=function(_0x4c0ac7,_0x110fe5,_0x3b4ea6){_0x4c0ac7['isMiddleware']=!![];return _0x3b4ea6();};exports[_0xf5f2('0x4c')]=function signToken(_0x3f3895){return signJwt(_0x3f3895);};exports[_0xf5f2('0x4d')]=function(_0x85b6d0,_0xd10701){if(!_0x85b6d0[_0xf5f2('0x27')]){return _0xd10701[_0xf5f2('0x3c')](0x194)[_0xf5f2('0x39')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x31c3c={'payload':{'id':_0x85b6d0[_0xf5f2('0x27')]['id'],'role':_0x85b6d0[_0xf5f2('0x27')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x31c3c)['then'](function(_0x59eb00){_0xd10701[_0xf5f2('0x4e')](_0xf5f2('0x4f'),_0x59eb00);_0xd10701['redirect'](_0xf5f2('0x50'));})[_0xf5f2('0x30')](function(_0x28e33f){return _0xd10701[_0xf5f2('0x3c')](0x1f4)[_0xf5f2('0x51')](_0x28e33f);});};exports[_0xf5f2('0x52')]=function(_0x1a6ec1){if(_[_0xf5f2('0x53')](_0x1a6ec1[_0xf5f2('0x41')])||_[_0xf5f2('0x53')](_0x1a6ec1[_0xf5f2('0x54')])){return null;}else{return createJwt(_0x1a6ec1);}};exports[_0xf5f2('0x55')]=function(_0x4252a3){_0x4252a3[_0xf5f2('0x41')]=generateNonce();_0x4252a3['apiKeyIat']=generateIssuedAt();return createJwt(_0x4252a3);};exports[_0xf5f2('0x56')]=function(_0x578c93,_0x3d62c1){var _0xc04f44=_0x578c93[_0xf5f2('0x3f')][_0xf5f2('0x3d')];if(_0xc04f44){var _0x31bf0e={'nonce':_0x3d62c1[_0xf5f2('0x41')],'iat':_0x3d62c1['apiKeyIat'],'audience':hardwareConf[_0xf5f2('0x3e')](),'issuer':hardwareConf[_0xf5f2('0x3e')]()};return verifyJwt(_0xc04f44,_0x31bf0e)[_0xf5f2('0x2d')](function(){return generateApiKey(_0x3d62c1);});}else{throw{'message':_0xf5f2('0x57')};}};function signJwt(_0x12124d){var _0x10753a=BPromise[_0xf5f2('0x58')](jwt[_0xf5f2('0x59')],{'context':jwt});var _0x5e6071=_0x12124d[_0xf5f2('0x5a')]||config[_0xf5f2('0x8')][_0xf5f2('0x9')];return new BPromise(function(_0x492eea,_0x1177ba){_0x10753a(_0x12124d[_0xf5f2('0x5b')],_0x5e6071,_0x12124d[_0xf5f2('0x5c')])['then'](function(_0x57a7cb){_0x492eea(_0x57a7cb);})[_0xf5f2('0x30')](function(_0x27c472){_0x1177ba(_0x27c472);});});}function verifyJwt(_0x5db519,_0x14aa81,_0x533cca){var _0x740321=BPromise['promisify'](jwt[_0xf5f2('0x5d')],{'context':jwt});var _0x5d9120=_0x533cca||config[_0xf5f2('0x8')][_0xf5f2('0x9')];return new BPromise(function(_0xbb658c,_0x11a083){_0x740321(_0x5db519,_0x5d9120,_0x14aa81)['then'](function(_0x3154c1){_0xbb658c(_0x3154c1);})[_0xf5f2('0x30')](function(_0x4f6b01){_0x11a083(_0x4f6b01);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xf5f2('0x5e')](_0xf5f2('0x5f'));}function generateIssuedAt(){return Math['floor'](Date[_0xf5f2('0x60')]()/0x3e8)[_0xf5f2('0x5e')]();}function createJwt(_0x29c9b6){var _0x41b1c7={'payload':{'iat':_0x29c9b6['apiKeyIat'],'nonce':_0x29c9b6['apiKeyNonce']},'options':{'algorithm':_0xf5f2('0x61'),'subject':_0x29c9b6['id'][_0xf5f2('0x5e')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xf5f2('0x3e')]()}};return signJwt(_0x41b1c7)[_0xf5f2('0x2d')](function(_0x255125){return{'iat':_0x29c9b6[_0xf5f2('0x54')],'nonce':_0x29c9b6[_0xf5f2('0x41')],'token':_0x255125};});} \ No newline at end of file +var _0x1a85=['crypto','bluebird','session','fullname','internal','email','permissions','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','startsWith','authorization','Basic','User','find','name','pass','Wrong\x20credentials.','user','headers','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','../../config/license/util','getLicense','update','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','role','cookie','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','promisify','sign','secrets','payload','options','hex','now','toString','HS512','../../config/license/hardware','lodash','jsonwebtoken','basic-auth'];(function(_0x4d2cd0,_0x3ee716){var _0x4bc98e=function(_0x3aff06){while(--_0x3aff06){_0x4d2cd0['push'](_0x4d2cd0['shift']());}};_0x4bc98e(++_0x3ee716);}(_0x1a85,0x178));var _0x51a8=function(_0x1e73fc,_0x533750){_0x1e73fc=_0x1e73fc-0x0;var _0xeceac4=_0x1a85[_0x1e73fc];return _0xeceac4;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0x51a8('0x0'));var _=require(_0x51a8('0x1'));var jwt=require(_0x51a8('0x2'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0x51a8('0x3'));var crypto=require(_0x51a8('0x4'));var BPromise=require(_0x51a8('0x5'));var validateJwt=expressJwt({'secret':config['secrets'][_0x51a8('0x6')]});var userAttributes=['id','role',_0x51a8('0x7'),'name',_0x51a8('0x8'),_0x51a8('0x9'),'userpic',_0x51a8('0xa'),'md5secret','voicePause',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'phoneBarEnableSettings',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'phoneBarRemoteControlPort',_0x51a8('0x1f'),'interface',_0x51a8('0x20')];exports[_0x51a8('0x21')]=function(){return this[_0x51a8('0x22')](!![])[_0x51a8('0x23')](function(_0x3fbd02,_0x3e0603,_0x1f49ee){if(_0x3fbd02['user']){_0x1f49ee();}else{return db[_0x51a8('0x24')][_0x51a8('0x25')]({'where':{'id':_0x3fbd02[_0x51a8('0x26')]['id']},'attributes':['id',_0x51a8('0x27'),_0x51a8('0x28')],'raw':!![]})[_0x51a8('0x29')](function(_0x5f3acf){if(_0x5f3acf&&_0x5f3acf[_0x51a8('0x27')]){return _0x3e0603[_0x51a8('0x2a')](_0x5f3acf[_0x51a8('0x28')]===_0x51a8('0x2b')?0x195:0x193)[_0x51a8('0x2c')]({'message':_0x5f3acf[_0x51a8('0x28')]===_0x51a8('0x2b')?_0x51a8('0x2d'):'Forbidden.'});}else{_0x1f49ee();}})[_0x51a8('0x2e')](function(_0x53438c){_0x1f49ee(_0x53438c);});}});};exports[_0x51a8('0x22')]=function isAuthenticated(_0x12c029){return compose()[_0x51a8('0x23')](function(_0x3759d6,_0x51f737,_0xae3588){if(_0x3759d6['headers']['authorization']){if(_[_0x51a8('0x2f')](_0x3759d6['headers'][_0x51a8('0x30')],_0x51a8('0x31'))){var _0x20ef8b=basicAuth(_0x3759d6);db[_0x51a8('0x32')][_0x51a8('0x33')]({'where':{'name':_0x20ef8b[_0x51a8('0x34')]}})[_0x51a8('0x29')](function(_0x1326a2){if(!_0x1326a2||!_0x1326a2['authenticate'](_0x20ef8b[_0x51a8('0x35')])){return _0x51f737[_0x51a8('0x2a')](0x191)[_0x51a8('0x2c')]({'message':_0x51a8('0x36')});}_0x3759d6[_0x51a8('0x37')]={'id':_0x1326a2['id']};_0xae3588();})[_0x51a8('0x2e')](function(_0x1a886f){_0xae3588(_0x1a886f);});}else if(_[_0x51a8('0x2f')](_0x3759d6[_0x51a8('0x38')][_0x51a8('0x30')],_0x51a8('0x39'))){validateJwt(_0x3759d6,_0x51f737,_0xae3588);}else{if(_0x12c029){_0xae3588();}else{return _0x51f737[_0x51a8('0x2a')](0x193)['json']({'message':_0x51a8('0x3a')});}}}else if(_0x3759d6['query'][_0x51a8('0x3b')]){try{var _0x3bc19a={'audience':hardwareConf[_0x51a8('0x3c')](),'issuer':hardwareConf[_0x51a8('0x3c')]()};verifyJwt(_0x3759d6[_0x51a8('0x3d')]['apikey'],_0x3bc19a)[_0x51a8('0x29')](function(_0x4c67ff){return db[_0x51a8('0x32')][_0x51a8('0x33')]({'where':{'id':_0x4c67ff[_0x51a8('0x3e')]}})['then'](function(_0x2080a1){if(!_0x2080a1||!_['isEqual'](_0x2080a1[_0x51a8('0x3f')],_0x4c67ff[_0x51a8('0x40')])){return _0x51f737[_0x51a8('0x2a')](0x191)[_0x51a8('0x2c')]({'message':_0x51a8('0x41')});}_0x3759d6['user']={'id':_0x2080a1['id']};_0xae3588();});})[_0x51a8('0x2e')](function(){return _0x51f737['status'](0x191)[_0x51a8('0x2c')]({'message':_0x51a8('0x42')});});}catch(_0x41561a){_0xae3588(_0x41561a);}}else if(_0x12c029){_0xae3588();}else{return _0x51f737['status'](0x193)[_0x51a8('0x2c')]({'message':_0x51a8('0x3a')});}})[_0x51a8('0x23')](function(_0x2429f8,_0x41c020,_0x49ab37){if(_0x2429f8['user']){db['User'][_0x51a8('0x33')]({'where':{'id':_0x2429f8[_0x51a8('0x37')]['id']},'attributes':userAttributes})['then'](function(_0x35d7a1){if(!_0x35d7a1){return _0x41c020['status'](0x194)[_0x51a8('0x2c')]({'message':_0x51a8('0x43')});}_0x2429f8[_0x51a8('0x37')]=_0x35d7a1;_0x49ab37();})[_0x51a8('0x2e')](function(_0x256cda){_0x49ab37(_0x256cda);});}else if(_0x12c029){_0x49ab37();}else{return _0x41c020[_0x51a8('0x2a')](0x194)['json']({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x51a8('0x44')]=function canUpdate(){return compose()['use'](function(_0x5d7214,_0x5df144,_0x1d775e){return require(_0x51a8('0x45'))[_0x51a8('0x46')]()['then'](function(_0x728638){if(_0x728638[_0x51a8('0x47')]){_0x1d775e();}else{return _0x5df144[_0x51a8('0x2a')](0x193)[_0x51a8('0x2c')]({'message':'Forbidden'});}})[_0x51a8('0x2e')](function(_0xe6a86a){_0x1d775e(_0xe6a86a);});});};exports[_0x51a8('0x48')]=function(_0x4dcbfb,_0xb96200,_0x51d7bd){_0x4dcbfb[_0x51a8('0x48')]=!![];return _0x51d7bd();};exports[_0x51a8('0x49')]=function signToken(_0x2a98bd){return signJwt(_0x2a98bd);};exports[_0x51a8('0x4a')]=function(_0x5c44a9,_0x8e248){if(!_0x5c44a9[_0x51a8('0x37')]){return _0x8e248[_0x51a8('0x2a')](0x194)[_0x51a8('0x2c')]({'message':_0x51a8('0x4b')});}var _0x35c1c9={'payload':{'id':_0x5c44a9[_0x51a8('0x37')]['id'],'role':_0x5c44a9[_0x51a8('0x37')][_0x51a8('0x4c')]},'options':{'expiresIn':0x15180}};return signJwt(_0x35c1c9)['then'](function(_0x22e6e6){_0x8e248[_0x51a8('0x4d')]('motion.token',_0x22e6e6);_0x8e248['redirect'](_0x51a8('0x4e'));})[_0x51a8('0x2e')](function(_0x2b8af2){return _0x8e248[_0x51a8('0x2a')](0x1f4)[_0x51a8('0x4f')](_0x2b8af2);});};exports[_0x51a8('0x50')]=function(_0x28f5b3){if(_[_0x51a8('0x51')](_0x28f5b3[_0x51a8('0x3f')])||_[_0x51a8('0x51')](_0x28f5b3['apiKeyIat'])){return null;}else{return createJwt(_0x28f5b3);}};exports[_0x51a8('0x52')]=function(_0x218ae0){_0x218ae0[_0x51a8('0x3f')]=generateNonce();_0x218ae0[_0x51a8('0x53')]=generateIssuedAt();return createJwt(_0x218ae0);};exports[_0x51a8('0x54')]=function(_0x22ff0e,_0x579411){var _0x9104bf=_0x22ff0e['query'][_0x51a8('0x3b')];if(_0x9104bf){var _0x3a33f3={'nonce':_0x579411[_0x51a8('0x3f')],'iat':_0x579411[_0x51a8('0x53')],'audience':hardwareConf[_0x51a8('0x3c')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x9104bf,_0x3a33f3)['then'](function(){return generateApiKey(_0x579411);});}else{throw{'message':_0x51a8('0x55')};}};function signJwt(_0x3ce04e){var _0x41cfda=BPromise[_0x51a8('0x56')](jwt[_0x51a8('0x57')],{'context':jwt});var _0x570b11=_0x3ce04e['secret']||config[_0x51a8('0x58')][_0x51a8('0x6')];return new BPromise(function(_0x24b205,_0x419863){_0x41cfda(_0x3ce04e[_0x51a8('0x59')],_0x570b11,_0x3ce04e[_0x51a8('0x5a')])[_0x51a8('0x29')](function(_0x1103a3){_0x24b205(_0x1103a3);})[_0x51a8('0x2e')](function(_0x4d29ab){_0x419863(_0x4d29ab);});});}function verifyJwt(_0x5cb2cf,_0x5db030,_0x3e2d6c){var _0x279cb1=BPromise[_0x51a8('0x56')](jwt['verify'],{'context':jwt});var _0x3bd492=_0x3e2d6c||config[_0x51a8('0x58')]['session'];return new BPromise(function(_0x15cb42,_0x4fb93c){_0x279cb1(_0x5cb2cf,_0x3bd492,_0x5db030)['then'](function(_0xbf828b){_0x15cb42(_0xbf828b);})[_0x51a8('0x2e')](function(_0x41dd1f){_0x4fb93c(_0x41dd1f);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x51a8('0x5b'));}function generateIssuedAt(){return Math['floor'](Date[_0x51a8('0x5c')]()/0x3e8)[_0x51a8('0x5d')]();}function createJwt(_0x3623d4){var _0x1ace5b={'payload':{'iat':_0x3623d4[_0x51a8('0x53')],'nonce':_0x3623d4[_0x51a8('0x3f')]},'options':{'algorithm':_0x51a8('0x5e'),'subject':_0x3623d4['id'][_0x51a8('0x5d')](),'issuer':hardwareConf[_0x51a8('0x3c')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x1ace5b)[_0x51a8('0x29')](function(_0xe4518d){return{'iat':_0x3623d4[_0x51a8('0x53')],'nonce':_0x3623d4[_0x51a8('0x3f')],'token':_0xe4518d};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 90af82b..e718e3d 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 _0xa9e0=['update','close','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createCipher','algorithm','data','final','binary','write','end','unlink','decryptFile'];(function(_0x27a916,_0x19d785){var _0x1daf53=function(_0x292451){while(--_0x292451){_0x27a916['push'](_0x27a916['shift']());}};_0x1daf53(++_0x19d785);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var crypto=require(_0x0a9e('0x0'));var fs=require('fs');var BPromise=require(_0x0a9e('0x1'));var defaultOptions={'algorithm':_0x0a9e('0x2')};function combineOptions(_0x5dd881){var _0x550fbc={};for(var _0x18d5c9 in defaultOptions){if(defaultOptions['hasOwnProperty'](_0x18d5c9)){_0x550fbc[_0x18d5c9]=defaultOptions[_0x18d5c9];}}if(_0x5dd881){for(var _0x333808 in _0x5dd881){if(_0x5dd881[_0x0a9e('0x3')](_0x333808)){_0x550fbc[_0x333808]=_0x5dd881[_0x333808];}}}return _0x550fbc;}exports[_0x0a9e('0x4')]=function(_0x991246,_0x981158,_0x57b080,_0x219af0){return new BPromise(function(_0x441e3a,_0x2cc193){_0x219af0=combineOptions(_0x219af0);var _0x5f41ea=new Buffer(_0x57b080);var _0x503809=fs[_0x0a9e('0x5')](_0x991246);var _0x56465b=fs['createWriteStream'](_0x981158);var _0x39753a=crypto[_0x0a9e('0x6')](_0x219af0[_0x0a9e('0x7')],_0x5f41ea);_0x503809['on'](_0x0a9e('0x8'),function(_0xfeb75b){var _0xbd1168=new Buffer(_0x39753a['update'](_0xfeb75b),'binary');_0x56465b['write'](_0xbd1168);});_0x503809['on']('end',function(){try{var _0x273d4d=new Buffer(_0x39753a[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x56465b[_0x0a9e('0xb')](_0x273d4d);_0x56465b[_0x0a9e('0xc')]();_0x56465b['on']('close',function(){return _0x441e3a(_0x981158);});}catch(_0x4283ce){fs[_0x0a9e('0xd')](_0x981158);return _0x2cc193(_0x4283ce);}});});};exports[_0x0a9e('0xe')]=function(_0x281129,_0x44dcfd,_0x4d5611,_0x52a03d){return new BPromise(function(_0x22dccb,_0x5d0880){_0x52a03d=combineOptions(_0x52a03d);var _0x1985b6=new Buffer(_0x4d5611);var _0x519dfd=fs[_0x0a9e('0x5')](_0x281129);var _0x12066b=fs['createWriteStream'](_0x44dcfd);var _0x225616=crypto['createDecipher'](_0x52a03d[_0x0a9e('0x7')],_0x1985b6);_0x519dfd['on'](_0x0a9e('0x8'),function(_0x106033){var _0x205fd6=new Buffer(_0x225616[_0x0a9e('0xf')](_0x106033),_0x0a9e('0xa'));_0x12066b[_0x0a9e('0xb')](_0x205fd6);});_0x519dfd['on'](_0x0a9e('0xc'),function(){try{var _0x1314ae=new Buffer(_0x225616[_0x0a9e('0x9')](_0x0a9e('0xa')),_0x0a9e('0xa'));_0x12066b['write'](_0x1314ae);_0x12066b[_0x0a9e('0xc')]();_0x12066b['on'](_0x0a9e('0x10'),function(){return _0x22dccb(_0x44dcfd);});}catch(_0x53682f){fs[_0x0a9e('0xd')](_0x44dcfd);return _0x5d0880(_0x53682f);}});});}; \ No newline at end of file +var _0xe706=['unlink','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','end','final','binary','write','close','createDecipher'];(function(_0x726624,_0x21f598){var _0x14fb9f=function(_0x11b31a){while(--_0x11b31a){_0x726624['push'](_0x726624['shift']());}};_0x14fb9f(++_0x21f598);}(_0xe706,0xa3));var _0x6e70=function(_0x1f75a4,_0x220814){_0x1f75a4=_0x1f75a4-0x0;var _0x3e3309=_0xe706[_0x1f75a4];return _0x3e3309;};'use strict';var crypto=require(_0x6e70('0x0'));var fs=require('fs');var BPromise=require(_0x6e70('0x1'));var defaultOptions={'algorithm':_0x6e70('0x2')};function combineOptions(_0x5e8446){var _0x2cae77={};for(var _0x315629 in defaultOptions){if(defaultOptions[_0x6e70('0x3')](_0x315629)){_0x2cae77[_0x315629]=defaultOptions[_0x315629];}}if(_0x5e8446){for(var _0x7dfbc3 in _0x5e8446){if(_0x5e8446[_0x6e70('0x3')](_0x7dfbc3)){_0x2cae77[_0x7dfbc3]=_0x5e8446[_0x7dfbc3];}}}return _0x2cae77;}exports[_0x6e70('0x4')]=function(_0x376a8d,_0x506db9,_0x1b0389,_0x4381d1){return new BPromise(function(_0x36357b,_0x293ce7){_0x4381d1=combineOptions(_0x4381d1);var _0x45a2d4=new Buffer(_0x1b0389);var _0x188ed3=fs[_0x6e70('0x5')](_0x376a8d);var _0x449b48=fs[_0x6e70('0x6')](_0x506db9);var _0x25e61c=crypto[_0x6e70('0x7')](_0x4381d1[_0x6e70('0x8')],_0x45a2d4);_0x188ed3['on'](_0x6e70('0x9'),function(_0x3f474a){var _0x37b3e0=new Buffer(_0x25e61c[_0x6e70('0xa')](_0x3f474a),'binary');_0x449b48['write'](_0x37b3e0);});_0x188ed3['on'](_0x6e70('0xb'),function(){try{var _0x15a1a5=new Buffer(_0x25e61c[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x449b48[_0x6e70('0xe')](_0x15a1a5);_0x449b48[_0x6e70('0xb')]();_0x449b48['on'](_0x6e70('0xf'),function(){return _0x36357b(_0x506db9);});}catch(_0x5dfbaa){fs['unlink'](_0x506db9);return _0x293ce7(_0x5dfbaa);}});});};exports['decryptFile']=function(_0x257e81,_0x5a37a6,_0x53aed0,_0x304716){return new BPromise(function(_0x22c50c,_0x5d9263){_0x304716=combineOptions(_0x304716);var _0x24f3ac=new Buffer(_0x53aed0);var _0x5c3fe7=fs[_0x6e70('0x5')](_0x257e81);var _0x161f23=fs['createWriteStream'](_0x5a37a6);var _0x49029f=crypto[_0x6e70('0x10')](_0x304716['algorithm'],_0x24f3ac);_0x5c3fe7['on'](_0x6e70('0x9'),function(_0x173afe){var _0x53acdc=new Buffer(_0x49029f['update'](_0x173afe),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x53acdc);});_0x5c3fe7['on'](_0x6e70('0xb'),function(){try{var _0x3a9978=new Buffer(_0x49029f[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x3a9978);_0x161f23[_0x6e70('0xb')]();_0x161f23['on'](_0x6e70('0xf'),function(){return _0x22c50c(_0x5a37a6);});}catch(_0x4a0cfe){fs[_0x6e70('0x11')](_0x5a37a6);return _0x5d9263(_0x4a0cfe);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 40ef30b..91df5d9 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 _0xb4e6=['splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','length','existsSync','mkdirSync','join','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','CSV','inspect','Failed','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find'];(function(_0x556c13,_0x24a62a){var _0x341621=function(_0x36c278){while(--_0x36c278){_0x556c13['push'](_0x556c13['shift']());}};_0x341621(++_0x24a62a);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0xb4e6[_0x133277];return _0x5b4a22;};'use strict';var util=require(_0x6b4e('0x0'));var path=require('path');var _=require(_0x6b4e('0x1'));var csv=require(_0x6b4e('0x2'));var fs=require('fs');var BPromise=require(_0x6b4e('0x3'));var zipdir=require(_0x6b4e('0x4'));var rimraf=require(_0x6b4e('0x5'));var db=require(_0x6b4e('0x6'))['db'];var dbH=require(_0x6b4e('0x6'))['dbH'];var logger=require(_0x6b4e('0x7'))(_0x6b4e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x6b4e('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6b4e('0x9')][0x4];function analyticExtractedReport(_0x570346,_0x4f00be){var _0x2311d9={'status':_0x570346};var _0x48c870={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4f00be){_0x2311d9['savename']=_0x4f00be;}return db[_0x6b4e('0xa')][_0x6b4e('0xb')](_0x2311d9,_0x48c870);}function main(){var _0x1e3bf6=0x1388;var _0x39ed74;logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')](_0x6b4e('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x6b4e('0xf')][_0x6b4e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6b4e('0x11')]})[_0x6b4e('0x12')](function(_0x432399){if(_0x432399){_0x39ed74=_0x432399;_0x1e3bf6=_0x39ed74[_0x6b4e('0x11')]||0x1388;}})[_0x6b4e('0x12')](function(){return dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](util['format'](_0x6b4e('0x15'),QUERY),{'type':dbH[_0x6b4e('0x13')]['QueryTypes'][_0x6b4e('0x16')]});})['then'](function(_0x355f10){if(!_0x355f10[0x0][_0x6b4e('0x17')]){return analyticExtractedReport(_0x6b4e('0x18'));}var _0x42e265=[];var _0x28c3ba=0x0;var _0x135568=!![];if(_0x355f10&&_0x355f10['length']){var _0x5775f4=_0x355f10[0x0][_0x6b4e('0x17')]%(_0x28c3ba+_0x1e3bf6);if(_0x39ed74[_0x6b4e('0x19')]){for(;_0x135568;_0x28c3ba+=_0x1e3bf6,_0x5775f4=_0x355f10[0x0][_0x6b4e('0x17')]%(_0x28c3ba+_0x1e3bf6)){if(_0x5775f4==0x0||_0x5775f4==_0x355f10[0x0][_0x6b4e('0x17')]){_0x135568=![];}_0x42e265[_0x6b4e('0x1a')](dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](util[_0x6b4e('0xd')](_0x6b4e('0x1b'),QUERY,_0x1e3bf6,_0x28c3ba),{'type':dbH[_0x6b4e('0x13')][_0x6b4e('0x1c')]['SELECT']}));}}else{_0x42e265[_0x6b4e('0x1a')](dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](QUERY,{'type':dbH[_0x6b4e('0x13')]['QueryTypes'][_0x6b4e('0x16')]}));}}var _0x507703=path[_0x6b4e('0x1d')](PATH);var _0x163dea=path[_0x6b4e('0x1e')](PATH,_0x6b4e('0x1f'));var _0xa06ccd=_0x39ed74[_0x6b4e('0x19')]&&_0x42e265[_0x6b4e('0x20')]>0x1;var _0x5c33be=[];if(!fs[_0x6b4e('0x21')](path['join'](_0x507703,_0x163dea))&&_0xa06ccd){fs[_0x6b4e('0x22')](path[_0x6b4e('0x23')](_0x507703,_0x163dea));}return BPromise[_0x6b4e('0x24')](_0x42e265,function(_0xdba4fe){_0x5c33be['push'](_0xdba4fe);})[_0x6b4e('0x12')](function(){for(var _0x3f72d7=0x0;_0x3f72d7<_0x5c33be['length'];_0x3f72d7+=0x1){var _0x32102f;var _0x381ff0=_0x5c33be[_0x3f72d7];if(_0xa06ccd){_0x32102f=path[_0x6b4e('0x23')](_0x507703,_0x163dea,util[_0x6b4e('0xd')]('%s%d.%s',_0x163dea,_0x3f72d7,_0x6b4e('0x25')));}else{_0x32102f=path[_0x6b4e('0x23')](_0x507703,util['format'](_0x6b4e('0x26'),_0x163dea,_0x6b4e('0x25')));}fs[_0x6b4e('0x27')](_0x32102f,csv(_0x381ff0));}})[_0x6b4e('0x12')](function(){if(_0xa06ccd){zipdir(path['join'](_0x507703,_0x163dea),{'saveTo':path[_0x6b4e('0x23')](_0x507703,util[_0x6b4e('0xd')]('%s.%s',_0x163dea,_0x6b4e('0x28')))},function(_0x3f9868,_0x37b636){});rimraf(path['join'](_0x507703,_0x163dea),function(){});}})['then'](function(){logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')](_0x6b4e('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x6b4e('0x2a'),_0xa06ccd?util[_0x6b4e('0xd')](_0x6b4e('0x26'),_0x163dea,_0xa06ccd?'zip':'csv'):null);});})[_0x6b4e('0x2b')](function(_0x4952ef){logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6b4e('0x2c')),util[_0x6b4e('0x2d')](_0x4952ef,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6b4e('0x2e'));});}main(); \ No newline at end of file +var _0x5b02=['SELECT','length','num','push','dirname','.csv','existsSync','each','join','%s%d.%s','csv','writeFileSync','%s.%s','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5b02,0xe9));var _0x25b0=function(_0x275e7f,_0x1fe23d){_0x275e7f=_0x275e7f-0x0;var _0x4fe1f3=_0x5b02[_0x275e7f];return _0x4fe1f3;};'use strict';var util=require(_0x25b0('0x0'));var path=require(_0x25b0('0x1'));var _=require(_0x25b0('0x2'));var csv=require(_0x25b0('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x25b0('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x25b0('0x5'))[_0x25b0('0x6')];var logger=require(_0x25b0('0x7'))(_0x25b0('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x25b0('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x25b0('0x9')][0x4];function analyticExtractedReport(_0xd8276d,_0x49ef3a){var _0x412954={'status':_0xd8276d};var _0x4d3e71={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x49ef3a){_0x412954['savename']=_0x49ef3a;}return db[_0x25b0('0xa')][_0x25b0('0xb')](_0x412954,_0x4d3e71);}function main(){var _0x358af0=0x1388;var _0x575918;logger[_0x25b0('0xc')](util[_0x25b0('0xd')](_0x25b0('0xe'),EXTRACTED_REPORT_ID,_0x25b0('0xf')));return db[_0x25b0('0x10')][_0x25b0('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x25b0('0x12'),_0x25b0('0x13')]})[_0x25b0('0x14')](function(_0x1d3178){if(_0x1d3178){_0x575918=_0x1d3178;_0x358af0=_0x575918[_0x25b0('0x13')]||0x1388;}})[_0x25b0('0x14')](function(){return dbH[_0x25b0('0x15')][_0x25b0('0x16')](util[_0x25b0('0xd')](_0x25b0('0x17'),QUERY),{'type':dbH[_0x25b0('0x15')][_0x25b0('0x18')][_0x25b0('0x19')]});})[_0x25b0('0x14')](function(_0x40071c){if(!_0x40071c[0x0]['num']){return analyticExtractedReport('Empty');}var _0xfe1ea6=[];var _0x4b2357=0x0;var _0xa8280a=!![];if(_0x40071c&&_0x40071c[_0x25b0('0x1a')]){var _0x1c67a8=_0x40071c[0x0][_0x25b0('0x1b')]%(_0x4b2357+_0x358af0);if(_0x575918['split']){for(;_0xa8280a;_0x4b2357+=_0x358af0,_0x1c67a8=_0x40071c[0x0][_0x25b0('0x1b')]%(_0x4b2357+_0x358af0)){if(_0x1c67a8==0x0||_0x1c67a8==_0x40071c[0x0][_0x25b0('0x1b')]){_0xa8280a=![];}_0xfe1ea6[_0x25b0('0x1c')](dbH[_0x25b0('0x15')][_0x25b0('0x16')](util[_0x25b0('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x358af0,_0x4b2357),{'type':dbH[_0x25b0('0x15')][_0x25b0('0x18')][_0x25b0('0x19')]}));}}else{_0xfe1ea6[_0x25b0('0x1c')](dbH[_0x25b0('0x15')][_0x25b0('0x16')](QUERY,{'type':dbH[_0x25b0('0x15')][_0x25b0('0x18')][_0x25b0('0x19')]}));}}var _0x35939f=path[_0x25b0('0x1d')](PATH);var _0x3ce1da=path['basename'](PATH,_0x25b0('0x1e'));var _0x16623c=_0x575918['split']&&_0xfe1ea6[_0x25b0('0x1a')]>0x1;var _0x2023d8=[];if(!fs[_0x25b0('0x1f')](path['join'](_0x35939f,_0x3ce1da))&&_0x16623c){fs['mkdirSync'](path['join'](_0x35939f,_0x3ce1da));}return BPromise[_0x25b0('0x20')](_0xfe1ea6,function(_0x433085){_0x2023d8[_0x25b0('0x1c')](_0x433085);})[_0x25b0('0x14')](function(){for(var _0xdbb459=0x0;_0xdbb459<_0x2023d8[_0x25b0('0x1a')];_0xdbb459+=0x1){var _0x40268a;var _0x75ce7a=_0x2023d8[_0xdbb459];if(_0x16623c){_0x40268a=path[_0x25b0('0x21')](_0x35939f,_0x3ce1da,util['format'](_0x25b0('0x22'),_0x3ce1da,_0xdbb459,_0x25b0('0x23')));}else{_0x40268a=path['join'](_0x35939f,util['format']('%s.%s',_0x3ce1da,_0x25b0('0x23')));}fs[_0x25b0('0x24')](_0x40268a,csv(_0x75ce7a));}})[_0x25b0('0x14')](function(){if(_0x16623c){zipdir(path[_0x25b0('0x21')](_0x35939f,_0x3ce1da),{'saveTo':path[_0x25b0('0x21')](_0x35939f,util[_0x25b0('0xd')](_0x25b0('0x25'),_0x3ce1da,_0x25b0('0x26')))},function(_0x36b81d,_0x285a2b){});rimraf(path[_0x25b0('0x21')](_0x35939f,_0x3ce1da),function(){});}})[_0x25b0('0x14')](function(){logger[_0x25b0('0xc')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x25b0('0xf')));return analyticExtractedReport('Completed',_0x16623c?util['format'](_0x25b0('0x25'),_0x3ce1da,_0x16623c?_0x25b0('0x26'):_0x25b0('0x23')):null);});})[_0x25b0('0x27')](function(_0xb68653){logger['info'](util[_0x25b0('0xd')](_0x25b0('0x28'),EXTRACTED_REPORT_ID,'CSV'),util[_0x25b0('0x29')](_0xb68653,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x25b0('0x2a'));});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index e50f024..03efceb 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x5b2011,_0x53f15c){var _0x4c2f63=function(_0x3aebca){while(--_0x3aebca){_0x5b2011['push'](_0x5b2011['shift']());}};_0x4c2f63(++_0x53f15c);}(_0xb10b,0x12a));var _0xbb10=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0xb10b[_0x4bcf38];return _0x4a89be;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x49753b,_0x55f4b4){var _0x2025cf=function(_0x31a908){while(--_0x31a908){_0x49753b['push'](_0x49753b['shift']());}};_0x2025cf(++_0x55f4b4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2aaeac,_0x30bda5){_0x2aaeac=_0x2aaeac-0x0;var _0x757741=_0xb10b[_0x2aaeac];return _0x757741;};'use strict';var _=require(_0xbb10('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require(_0xbb10('0x1'));var path=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xbb10('0x4'));var rimraf=require(_0xbb10('0x5'));var db=require(_0xbb10('0x6'))['db'];var dbH=require(_0xbb10('0x6'))[_0xbb10('0x7')];var logger=require(_0xbb10('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbb10('0x9')][0x2]);var QUERY=process[_0xbb10('0x9')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0xbb10('0x9')][0x5];var FORMAT=_0xbb10('0xa');var _extractedReport;function analyticExtractedReport(_0x21370f,_0x1c3ee5){var _0x2353ef={'status':_0x21370f};var _0x1ce33e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1c3ee5){_0x2353ef[_0xbb10('0xb')]=_0x1c3ee5;}return db[_0xbb10('0xc')]['update'](_0x2353ef,_0x1ce33e);}function getHeader(_0x4e47f8){var _0x20bd61=[];for(var _0x118a74 in _0x4e47f8){if(_0x4e47f8[_0xbb10('0xd')](_0x118a74)){_0x20bd61['push']({'text':_0x118a74,'style':_0xbb10('0xe')});}}return _0x20bd61;}function extractReport(_0x5be7e0){var _0x44fb19=0x1388;var _0x916a32;if(!_0x5be7e0[0x0][_0xbb10('0xf')]){return analyticExtractedReport(_0xbb10('0x10'));}var _0x442548=[];var _0x147230=0x0;var _0x58a612=!![];var _0x26e021=path[_0xbb10('0x11')](PATH);var _0x45b9d6=path[_0xbb10('0x12')](PATH,_0xbb10('0x13'));var _0x2f2ebf=![];var _0x24a57b=[];return db[_0xbb10('0x14')][_0xbb10('0x15')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbb10('0x16'),'splitSizePdf']})[_0xbb10('0x17')](function(_0x1145f1){if(_0x1145f1){_0x916a32=_0x1145f1;_0x44fb19=_0x916a32[_0xbb10('0x18')]||0x3e8;}})[_0xbb10('0x17')](function(){if(_0x5be7e0&&_0x5be7e0[_0xbb10('0x19')]){var _0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19);if(_0x916a32[_0xbb10('0x16')]){for(;_0x58a612;_0x147230+=_0x44fb19,_0x1682a4=_0x5be7e0[0x0][_0xbb10('0xf')]%(_0x147230+_0x44fb19)){if(_0x1682a4==0x0||_0x1682a4==_0x5be7e0[0x0][_0xbb10('0xf')]){_0x58a612=![];}_0x442548['push'](dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util[_0xbb10('0x1c')](_0xbb10('0x1d'),QUERY,_0x44fb19,_0x147230),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')]['SELECT']}));}}else{_0x442548[_0xbb10('0x1f')](dbH[_0xbb10('0x1a')]['query'](QUERY,{'type':dbH['sequelize'][_0xbb10('0x1e')][_0xbb10('0x20')]}));}}_0x2f2ebf=_0x916a32[_0xbb10('0x16')]&&_0x442548[_0xbb10('0x19')]>0x1;if(!fs[_0xbb10('0x21')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6))&&_0x2f2ebf){fs[_0xbb10('0x23')](path[_0xbb10('0x22')](_0x26e021,_0x45b9d6));}return BPromise[_0xbb10('0x24')](_0x442548,function(_0x395404){_0x24a57b[_0xbb10('0x1f')](_0x395404);});})[_0xbb10('0x17')](function(){return BPromise['each'](_0x442548,function(_0x4fedac,_0x4fb5e0){var _0xc93a04;var _0x3c5ae7=util[_0xbb10('0x1c')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0xbb10('0x25')],moment(_extractedReport[_0xbb10('0x26')])[_0xbb10('0x1c')](FORMAT),moment(_extractedReport[_0xbb10('0x27')])[_0xbb10('0x1c')](FORMAT));var _0x20d946={'pageSize':'A4','pageOrientation':_0xbb10('0x28'),'content':[{'text':_0x3c5ae7,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbb10('0x29')}}};var _0x21ac54={'headerRows':0x1,'body':[]};_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](getHeader(_0x4fedac[0x0]));var _0x1d30aa;for(var _0x2ff4c1=0x0;_0x2ff4c1<_0x4fedac['length'];_0x2ff4c1+=0x1){_0x1d30aa=[];for(var _0x221624 in _0x4fedac[_0x2ff4c1]){if(_0x4fedac[_0x2ff4c1]['hasOwnProperty'](_0x221624)){_0x1d30aa[_0xbb10('0x1f')](_0x4fedac[_0x2ff4c1][_0x221624]?_['toString'](_0x4fedac[_0x2ff4c1][_0x221624]):'');}}_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x1f')](_0x1d30aa);}_0x20d946[_0xbb10('0x2b')]['push']({'table':_0x21ac54});return new BPromise(function(_0x518d47,_0x4c3744){var _0x34f65e=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0xbb10('0x2c'),'italics':__dirname+_0xbb10('0x2d'),'bolditalics':__dirname+_0xbb10('0x2e')}});var _0x1c0b57=_0x34f65e[_0xbb10('0x2f')](_0x20d946);if(_0x2f2ebf){_0xc93a04=path[_0xbb10('0x22')](_0x26e021,_0x45b9d6,util[_0xbb10('0x1c')]('%s%d.%s',_0x45b9d6,_0x4fb5e0,_0xbb10('0x30')));}else{_0xc93a04=path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x30')));}var _0x9de708=_0x1c0b57[_0xbb10('0x32')](fs[_0xbb10('0x33')](_0xc93a04));_0x9de708['on'](_0xbb10('0x34'),function(){_0x518d47();});_0x9de708['on']('error',function(_0x2b5352){console[_0xbb10('0x35')](_0xbb10('0x36'),_0x2b5352);_0x4c3744(_0x2b5352);});_0x1c0b57[_0xbb10('0x37')]();});});})['then'](function(){if(_0x2f2ebf){return new BPromise(function(_0x111762,_0x5de37b){zipdir(path['join'](_0x26e021,_0x45b9d6),{'saveTo':path[_0xbb10('0x22')](_0x26e021,util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0xbb10('0x38')))},function(_0x15d895){if(_0x15d895){_0x5de37b(_0x15d895);}else{_0x111762();}});});}})[_0xbb10('0x17')](function(){if(_0x2f2ebf){rimraf(path['join'](_0x26e021,_0x45b9d6),function(){});}})[_0xbb10('0x17')](function(){logger[_0xbb10('0x39')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbb10('0x3a'),_0x2f2ebf?util[_0xbb10('0x1c')](_0xbb10('0x31'),_0x45b9d6,_0x2f2ebf?'zip':_0xbb10('0x30')):null);});}function main(){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbb10('0x3b')));return db[_0xbb10('0xc')][_0xbb10('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbb10('0x17')](function(_0x4f1cdd){_extractedReport=_0x4f1cdd;return dbH[_0xbb10('0x1a')][_0xbb10('0x1b')](util['format'](_0xbb10('0x3d'),QUERY),{'type':dbH[_0xbb10('0x1a')][_0xbb10('0x1e')][_0xbb10('0x20')]});})[_0xbb10('0x17')](extractReport)[_0xbb10('0x3e')](function(_0x5f3d67){logger[_0xbb10('0x39')](util[_0xbb10('0x1c')](_0xbb10('0x3f'),EXTRACTED_REPORT_ID,_0xbb10('0x3b')),util['inspect'](_0x5f3d67,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xbb10('0x40'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index c1acf2f..ed442ac 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 _0xfe61=['.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','push','dirname','basename'];(function(_0x2dedf8,_0x4c3cc4){var _0x19e4e2=function(_0x1640f7){while(--_0x1640f7){_0x2dedf8['push'](_0x2dedf8['shift']());}};_0x19e4e2(++_0x4c3cc4);}(_0xfe61,0x1b4));var _0x1fe6=function(_0x59e0d1,_0x37adae){_0x59e0d1=_0x59e0d1-0x0;var _0x106a79=_0xfe61[_0x59e0d1];return _0x106a79;};'use strict';var util=require('util');var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x1fe6('0x0'));var zipdir=require(_0x1fe6('0x1'));var rimraf=require(_0x1fe6('0x2'));var db=require(_0x1fe6('0x3'))['db'];var dbH=require(_0x1fe6('0x3'))[_0x1fe6('0x4')];var logger=require('../../config/logger')(_0x1fe6('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0x1fe6('0x6')][0x2]);var QUERY=process[_0x1fe6('0x6')][0x3];var PATH=process[_0x1fe6('0x6')][0x4];function analyticExtractedReport(_0x482a35,_0x414a21){var _0xefa21={'status':_0x482a35};var _0x3591b4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x414a21){_0xefa21[_0x1fe6('0x7')]=_0x414a21;}return db[_0x1fe6('0x8')]['update'](_0xefa21,_0x3591b4);}function main(){var _0x40105d=0x1388;var _0x280c47;logger[_0x1fe6('0x9')](util[_0x1fe6('0xa')](_0x1fe6('0xb'),EXTRACTED_REPORT_ID,_0x1fe6('0xc')));return db[_0x1fe6('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1fe6('0xe'),'splitSizeXlsx']})[_0x1fe6('0xf')](function(_0x4c1e07){if(_0x4c1e07){_0x280c47=_0x4c1e07;_0x40105d=_0x280c47['splitSizeXlsx']||0x1388;}})[_0x1fe6('0xf')](function(){return dbH[_0x1fe6('0x10')][_0x1fe6('0x11')](util[_0x1fe6('0xa')](_0x1fe6('0x12'),QUERY),{'type':dbH[_0x1fe6('0x10')][_0x1fe6('0x13')][_0x1fe6('0x14')]});})[_0x1fe6('0xf')](function(_0x3983cd){if(!_0x3983cd[0x0][_0x1fe6('0x15')]){return analyticExtractedReport(_0x1fe6('0x16'));}var _0x3be6e7=[];var _0x5848e6=0x0;var _0x60e584=!![];if(_0x280c47[_0x1fe6('0xe')]){if(_0x3983cd&&_0x3983cd['length']){var _0x288217=_0x3983cd[0x0][_0x1fe6('0x15')]%(_0x5848e6+_0x40105d);for(;_0x60e584;_0x5848e6+=_0x40105d,_0x288217=_0x3983cd[0x0]['num']%(_0x5848e6+_0x40105d)){if(_0x288217==0x0||_0x288217==_0x3983cd[0x0][_0x1fe6('0x15')]){_0x60e584=![];}_0x3be6e7[_0x1fe6('0x17')](dbH[_0x1fe6('0x10')][_0x1fe6('0x11')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x40105d,_0x5848e6),{'type':dbH[_0x1fe6('0x10')][_0x1fe6('0x13')][_0x1fe6('0x14')]}));}}}else{_0x3be6e7[_0x1fe6('0x17')](dbH[_0x1fe6('0x10')][_0x1fe6('0x11')](QUERY,{'type':dbH[_0x1fe6('0x10')][_0x1fe6('0x13')][_0x1fe6('0x14')]}));}var _0x51b8d4=path[_0x1fe6('0x18')](PATH);var _0x55ab19=path[_0x1fe6('0x19')](PATH,_0x1fe6('0x1a'));var _0x82ee6f=_0x280c47[_0x1fe6('0xe')]&&_0x3be6e7[_0x1fe6('0x1b')]>0x1;var _0x1c0830=[];if(!fs[_0x1fe6('0x1c')](path[_0x1fe6('0x1d')](_0x51b8d4,_0x55ab19))&&_0x82ee6f){fs[_0x1fe6('0x1e')](path[_0x1fe6('0x1d')](_0x51b8d4,_0x55ab19));}return BPromise[_0x1fe6('0x1f')](_0x3be6e7,function(_0x139ab4){_0x1c0830[_0x1fe6('0x17')](_0x139ab4);})['then'](function(){for(var _0x39827e=0x0;_0x39827e<_0x1c0830[_0x1fe6('0x1b')];_0x39827e+=0x1){var _0x4008cb;var _0x587b0a=_0x1c0830[_0x39827e];if(_0x82ee6f){_0x4008cb=path['join'](_0x51b8d4,_0x55ab19,util[_0x1fe6('0xa')](_0x1fe6('0x20'),_0x55ab19,_0x39827e,_0x1fe6('0x21')));}else{_0x4008cb=path['join'](_0x51b8d4,util[_0x1fe6('0xa')](_0x1fe6('0x22'),_0x55ab19,_0x1fe6('0x21')));}fs[_0x1fe6('0x23')](_0x4008cb,json2xls(_0x587b0a),_0x1fe6('0x24'));}})['then'](function(){if(_0x82ee6f){zipdir(path[_0x1fe6('0x1d')](_0x51b8d4,_0x55ab19),{'saveTo':path['join'](_0x51b8d4,util[_0x1fe6('0xa')](_0x1fe6('0x22'),_0x55ab19,_0x1fe6('0x25')))},function(_0x24f97e,_0x17a1d2){});rimraf(path[_0x1fe6('0x1d')](_0x51b8d4,_0x55ab19),function(){});}})[_0x1fe6('0xf')](function(){logger[_0x1fe6('0x9')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1fe6('0xc')));return analyticExtractedReport(_0x1fe6('0x26'),_0x82ee6f?util[_0x1fe6('0xa')](_0x1fe6('0x22'),_0x55ab19,_0x82ee6f?_0x1fe6('0x25'):_0x1fe6('0x21')):null);});})[_0x1fe6('0x27')](function(_0x4b9ee8){logger[_0x1fe6('0x9')](util[_0x1fe6('0xa')](_0x1fe6('0x28'),EXTRACTED_REPORT_ID,_0x1fe6('0xc')),util['inspect'](_0x4b9ee8,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x1fe6('0x29'));});}main(); \ No newline at end of file +var _0x598a=['zip-dir','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','then','num','Empty','length','push','SELECT','QueryTypes','basename','.xlsx','existsSync','join','xlsx','%s.%s','writeFileSync','binary','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','Failed','util','path','lodash','json2xls','bluebird'];(function(_0x4285d0,_0x3b41e7){var _0x5bfa9c=function(_0x2f6b28){while(--_0x2f6b28){_0x4285d0['push'](_0x4285d0['shift']());}};_0x5bfa9c(++_0x3b41e7);}(_0x598a,0x1c9));var _0xa598=function(_0x28c06a,_0x37f542){_0x28c06a=_0x28c06a-0x0;var _0x4a7c5c=_0x598a[_0x28c06a];return _0x4a7c5c;};'use strict';var util=require(_0xa598('0x0'));var path=require(_0xa598('0x1'));var _=require(_0xa598('0x2'));var fs=require('fs');var json2xls=require(_0xa598('0x3'));var BPromise=require(_0xa598('0x4'));var zipdir=require(_0xa598('0x5'));var rimraf=require('rimraf');var db=require(_0xa598('0x6'))['db'];var dbH=require(_0xa598('0x6'))['dbH'];var logger=require(_0xa598('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xa598('0x8')][0x2]);var QUERY=process[_0xa598('0x8')][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x16e4a7,_0x35aa05){var _0x3ba3e7={'status':_0x16e4a7};var _0x1462cc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x35aa05){_0x3ba3e7[_0xa598('0x9')]=_0x35aa05;}return db[_0xa598('0xa')]['update'](_0x3ba3e7,_0x1462cc);}function main(){var _0x126e55=0x1388;var _0x21b817;logger[_0xa598('0xb')](util['format'](_0xa598('0xc'),EXTRACTED_REPORT_ID,_0xa598('0xd')));return db[_0xa598('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xa598('0xf'),'splitSizeXlsx']})['then'](function(_0x206e39){if(_0x206e39){_0x21b817=_0x206e39;_0x126e55=_0x21b817[_0xa598('0x10')]||0x1388;}})['then'](function(){return dbH[_0xa598('0x11')][_0xa598('0x12')](util[_0xa598('0x13')](_0xa598('0x14'),QUERY),{'type':dbH[_0xa598('0x11')]['QueryTypes']['SELECT']});})[_0xa598('0x15')](function(_0x58be3b){if(!_0x58be3b[0x0][_0xa598('0x16')]){return analyticExtractedReport(_0xa598('0x17'));}var _0x36e4d1=[];var _0x76368b=0x0;var _0x5f27f2=!![];if(_0x21b817[_0xa598('0xf')]){if(_0x58be3b&&_0x58be3b[_0xa598('0x18')]){var _0x455d02=_0x58be3b[0x0][_0xa598('0x16')]%(_0x76368b+_0x126e55);for(;_0x5f27f2;_0x76368b+=_0x126e55,_0x455d02=_0x58be3b[0x0]['num']%(_0x76368b+_0x126e55)){if(_0x455d02==0x0||_0x455d02==_0x58be3b[0x0]['num']){_0x5f27f2=![];}_0x36e4d1[_0xa598('0x19')](dbH[_0xa598('0x11')][_0xa598('0x12')](util[_0xa598('0x13')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x126e55,_0x76368b),{'type':dbH['sequelize']['QueryTypes'][_0xa598('0x1a')]}));}}}else{_0x36e4d1[_0xa598('0x19')](dbH[_0xa598('0x11')][_0xa598('0x12')](QUERY,{'type':dbH[_0xa598('0x11')][_0xa598('0x1b')][_0xa598('0x1a')]}));}var _0x23f731=path['dirname'](PATH);var _0x3ed0d8=path[_0xa598('0x1c')](PATH,_0xa598('0x1d'));var _0x138aa4=_0x21b817[_0xa598('0xf')]&&_0x36e4d1['length']>0x1;var _0x1a70fb=[];if(!fs[_0xa598('0x1e')](path['join'](_0x23f731,_0x3ed0d8))&&_0x138aa4){fs['mkdirSync'](path['join'](_0x23f731,_0x3ed0d8));}return BPromise['each'](_0x36e4d1,function(_0x31be8f){_0x1a70fb[_0xa598('0x19')](_0x31be8f);})[_0xa598('0x15')](function(){for(var _0x254792=0x0;_0x254792<_0x1a70fb[_0xa598('0x18')];_0x254792+=0x1){var _0x130fcd;var _0x15d26b=_0x1a70fb[_0x254792];if(_0x138aa4){_0x130fcd=path[_0xa598('0x1f')](_0x23f731,_0x3ed0d8,util['format']('%s%d.%s',_0x3ed0d8,_0x254792,_0xa598('0x20')));}else{_0x130fcd=path['join'](_0x23f731,util[_0xa598('0x13')](_0xa598('0x21'),_0x3ed0d8,_0xa598('0x20')));}fs[_0xa598('0x22')](_0x130fcd,json2xls(_0x15d26b),_0xa598('0x23'));}})[_0xa598('0x15')](function(){if(_0x138aa4){zipdir(path[_0xa598('0x1f')](_0x23f731,_0x3ed0d8),{'saveTo':path[_0xa598('0x1f')](_0x23f731,util['format'](_0xa598('0x21'),_0x3ed0d8,_0xa598('0x24')))},function(_0x1963ad,_0x124123){});rimraf(path['join'](_0x23f731,_0x3ed0d8),function(){});}})[_0xa598('0x15')](function(){logger['info'](util[_0xa598('0x13')](_0xa598('0x25'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xa598('0x26'),_0x138aa4?util[_0xa598('0x13')]('%s.%s',_0x3ed0d8,_0x138aa4?_0xa598('0x24'):'xlsx'):null);});})[_0xa598('0x27')](function(_0x41ffaf){logger['info'](util[_0xa598('0x13')](_0xa598('0x28'),EXTRACTED_REPORT_ID,_0xa598('0xd')),util['inspect'](_0x41ffaf,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xa598('0x29'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 0856a0e..8c2ee7b 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 _0x845b=['CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','push','type','Set','format','VoiceExtensionId','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','context','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','intervals','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','indexOf','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','IntervalId','VoiceExtension','uniq','map','exten'];(function(_0x515d39,_0x263b44){var _0x1bc318=function(_0x4c8c0e){while(--_0x4c8c0e){_0x515d39['push'](_0x515d39['shift']());}};_0x1bc318(++_0x263b44);}(_0x845b,0x1ab));var _0xb845=function(_0x55d70d,_0x32fa55){_0x55d70d=_0x55d70d-0x0;var _0x41dbc4=_0x845b[_0x55d70d];return _0x41dbc4;};'use strict';var _=require(_0xb845('0x0'));var util=require(_0xb845('0x1'));function rewrite(_0x441da2,_0x3a9ab2){var _0x4e2ae0=this;return _0x441da2[_0xb845('0x2')][_0xb845('0x3')][_0xb845('0x4')]({'raw':!![]})[_0xb845('0x5')](function(_0x2ffce9){_0x4e2ae0['intervals']=_0x2ffce9;return _0x441da2[_0xb845('0x2')]['VoiceExtension'][_0xb845('0x4')]({'where':{'IntervalId':_0x3a9ab2[_0xb845('0x6')]},'raw':!![]});})['then'](function(_0x5678dd){return _0x441da2['models'][_0xb845('0x7')][_0xb845('0x4')]({'where':{'exten':{'$in':_[_0xb845('0x8')](_[_0xb845('0x9')](_0x5678dd,_0xb845('0xa')))}},'order':[{'raw':_0xb845('0xb')}],'raw':!![]});})['then'](function(_0x2345fa){var _0xc2262e=_[_0xb845('0xc')](_0x2345fa,{'priority':'1'});var _0x592e79=_[_0xb845('0xc')](_0x2345fa,{'isApp':0x1});var _0xe0f0a3=_[_0xb845('0xd')](_0x592e79,_0xb845('0xa'));var _0x447111=[_0xb845('0xe'),_0xb845('0xf')];var _0x313f26=[];var _0x35c20b=[];for(var _0x1857c0 in _0xe0f0a3){if(_0xe0f0a3[_0xb845('0x10')](_0x1857c0)){_0x4e2ae0[_0xb845('0x11')]=0x2;_0x4e2ae0[_0xb845('0x12')]=[];_0x4e2ae0[_0xb845('0x13')]=_['find'](_0xc2262e,{'exten':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0xa')]});_0x4e2ae0[_0xb845('0x12')][_0xb845('0x14')]({'type':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x15')],'app':_0xb845('0x16'),'appdata':util[_0xb845('0x17')]('CDR(type)=%s',_0xe0f0a3[_0x1857c0][0x0]['type']),'context':_0xe0f0a3[_0x1857c0][0x0]['context'],'exten':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0xa')],'priority':_0x4e2ae0[_0xb845('0x11')]++,'VoiceExtensionId':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x18')]});if(_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x15')]===_0xb845('0x19')){if(_0x4e2ae0['extension']){_0x4e2ae0[_0xb845('0x12')][_0xb845('0x14')]({'type':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x15')],'app':'Set','appdata':_0xb845('0x1a')+(_0x4e2ae0[_0xb845('0x13')]['cutdigits']?_0xb845('0x1b')+_0x4e2ae0[_0xb845('0x13')][_0xb845('0x1c')]+'}':_0xb845('0x1d')),'context':_0xe0f0a3[_0x1857c0][0x0]['context'],'exten':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0xa')],'priority':_0x4e2ae0[_0xb845('0x11')]++,'VoiceExtensionId':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x18')]});}_0x4e2ae0[_0xb845('0x12')]['push']({'type':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x15')],'app':_0xb845('0x16'),'appdata':'CDR(routeid)='+_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x18')],'context':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x1e')],'exten':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0xa')],'priority':_0x4e2ae0[_0xb845('0x11')]++,'VoiceExtensionId':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x18')]});var _0x3f660f=_0x4e2ae0['priority']++;_0x4e2ae0[_0xb845('0x12')][_0xb845('0x14')]({'type':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x15')],'app':_0xb845('0x1f'),'appdata':_0xb845('0x20')+(_0x3f660f+0x2)+_0xb845('0x21')+(_0x3f660f+0x1)+')','context':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x1e')],'exten':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0xa')],'priority':_0x3f660f,'VoiceExtensionId':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x18')]});if(_0x4e2ae0['extension']){_0x4e2ae0[_0xb845('0x12')][_0xb845('0x14')]({'type':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x15')],'app':_0xb845('0x16'),'appdata':_0x4e2ae0[_0xb845('0x13')][_0xb845('0x1c')]?_0xb845('0x22')+_0x4e2ae0[_0xb845('0x13')][_0xb845('0x1c')]+'}':_0xb845('0x23'),'context':_0xe0f0a3[_0x1857c0][0x0]['context'],'exten':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0xa')],'priority':_0x4e2ae0[_0xb845('0x11')]++,'VoiceExtensionId':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x18')]});}_0x4e2ae0[_0xb845('0x12')]['push']({'type':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x15')],'app':'Set','appdata':_0xb845('0x24')+_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x18')],'context':_0xe0f0a3[_0x1857c0][0x0]['context'],'exten':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0xa')],'priority':_0x4e2ae0['priority']++,'VoiceExtensionId':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x18')]});if(_0x4e2ae0[_0xb845('0x13')]&&_0x4e2ae0[_0xb845('0x13')][_0xb845('0x10')]('recordingFormat')&&_0x4e2ae0[_0xb845('0x13')][_0xb845('0x25')]!=='none'){_0x4e2ae0[_0xb845('0x12')][_0xb845('0x14')]({'type':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x15')],'app':_0xb845('0x16'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x1e')],'exten':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0xa')],'priority':_0x4e2ae0[_0xb845('0x11')]++,'VoiceExtensionId':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x18')]});_0x4e2ae0[_0xb845('0x12')]['push']({'type':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x15')],'app':_0xb845('0x16'),'appdata':_0xb845('0x26')+_0x4e2ae0[_0xb845('0x13')][_0xb845('0x25')]||'wav','context':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x1e')],'exten':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0xa')],'priority':_0x4e2ae0[_0xb845('0x11')]++,'VoiceExtensionId':_0xe0f0a3[_0x1857c0][0x0]['VoiceExtensionId']});}}_0x4e2ae0[_0xb845('0x12')][_0xb845('0x14')]({'type':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x15')],'app':_0xb845('0x16'),'appdata':_0xb845('0x27'),'context':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x1e')],'exten':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0xa')],'priority':_0x4e2ae0['priority']++,'VoiceExtensionId':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x18')]});_0x4e2ae0[_0xb845('0x12')]['push']({'type':_0xe0f0a3[_0x1857c0][0x0]['type'],'app':_0xb845('0x16'),'appdata':_0xb845('0x28'),'context':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x1e')],'exten':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0xa')],'priority':_0x4e2ae0[_0xb845('0x11')]++,'VoiceExtensionId':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x18')]});_0x4e2ae0[_0xb845('0x12')][_0xb845('0x14')]({'type':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x15')],'app':'Set','appdata':_0xb845('0x29'),'context':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x1e')],'exten':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0xa')],'priority':_0x4e2ae0[_0xb845('0x11')]++,'VoiceExtensionId':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x18')]});for(var _0xa871d3=0x0,_0x1d42a1=0x0;_0xa871d3<_0xe0f0a3[_0x1857c0][_0xb845('0x2a')];_0xa871d3+=0x1,_0x1d42a1=0x0){var _0x6992e0=_0xe0f0a3[_0x1857c0][_0xa871d3];if(_0x6992e0[_0xb845('0x15')]){_0x6992e0[_0xb845('0x15')]=_0x6992e0[_0xb845('0x15')][_0xb845('0x2b')]();}var _0x22d3bb=[];var _0x3fb610=[];delete _0x6992e0['id'];delete _0x6992e0[_0xb845('0x2c')];delete _0x6992e0[_0xb845('0x2d')];var _0x4a926c=_0x6992e0[_0xb845('0x2e')]!==_0xb845('0x2f')?[_0x6992e0[_0xb845('0x2e')]]:_0x6992e0[_0xb845('0x6')]?_[_0xb845('0x9')](_[_0xb845('0xc')](_0x4e2ae0[_0xb845('0x30')],{'IntervalId':_0x6992e0[_0xb845('0x6')]}),_0xb845('0x2e')):[];if(_0x6992e0['hasOwnProperty'](_0xb845('0x31'))){if(_0x6992e0[_0xb845('0x31')]&&_0x6992e0[_0xb845('0x31')]!=='--'){_0x22d3bb[_0xb845('0x14')]({'type':_0x6992e0[_0xb845('0x15')],'app':'Set','appdata':'CDR(tag)='+_0x6992e0['tag'],'context':_0x6992e0[_0xb845('0x1e')],'exten':_0x6992e0['exten'],'priority':_0x4a926c[_0xb845('0x2a')]+_0x4e2ae0[_0xb845('0x11')]+_0x1d42a1++,'VoiceExtensionId':_0x6992e0[_0xb845('0x18')]});}}if(_0x6992e0[_0xb845('0x15')]===_0xb845('0x19')&&_0x6992e0[_0xb845('0x10')](_0xb845('0x32'))){if(_0x6992e0['callerID']){_0x22d3bb[_0xb845('0x14')]({'type':_0x6992e0[_0xb845('0x15')],'app':_0xb845('0x1f'),'appdata':_0xb845('0x33')+_0x6992e0[_0xb845('0x32')]+')','context':_0x6992e0[_0xb845('0x1e')],'exten':_0x6992e0[_0xb845('0xa')],'priority':_0x4a926c[_0xb845('0x2a')]+_0x4e2ae0[_0xb845('0x11')]+_0x1d42a1++,'VoiceExtensionId':_0x6992e0[_0xb845('0x18')]});}else{_0x22d3bb[_0xb845('0x14')]({'type':_0x6992e0[_0xb845('0x15')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x6992e0[_0xb845('0x1e')],'exten':_0x6992e0[_0xb845('0xa')],'priority':_0x4a926c[_0xb845('0x2a')]+_0x4e2ae0[_0xb845('0x11')]+_0x1d42a1++,'VoiceExtensionId':_0x6992e0[_0xb845('0x18')]});}}if(_0x6992e0['hasOwnProperty']('answer')){if(_0x447111[_0xb845('0x34')](_0x6992e0[_0xb845('0x35')][_0xb845('0x2b')]())>=0x0&&_0x6992e0['appType']!==_0xb845('0x36')){if(_0x6992e0[_0xb845('0x37')]){_0x22d3bb[_0xb845('0x14')]({'type':_0x6992e0[_0xb845('0x15')],'app':_0xb845('0x1f'),'appdata':_0xb845('0x38'),'context':_0x6992e0['context'],'exten':_0x6992e0[_0xb845('0xa')],'priority':_0x4a926c['length']+_0x4e2ae0[_0xb845('0x11')]+_0x1d42a1++,'VoiceExtensionId':_0x6992e0[_0xb845('0x18')]});_0x22d3bb[_0xb845('0x14')]({'type':_0x6992e0[_0xb845('0x15')],'app':'Set','appdata':_0xb845('0x39'),'context':_0x6992e0['context'],'exten':_0x6992e0[_0xb845('0xa')],'priority':_0x4a926c[_0xb845('0x2a')]+_0x4e2ae0['priority']+_0x1d42a1++,'VoiceExtensionId':_0x6992e0[_0xb845('0x18')]});}else{_0x22d3bb['push']({'type':_0x6992e0[_0xb845('0x15')],'app':_0xb845('0x1f'),'appdata':_0xb845('0x3a'),'context':_0x6992e0[_0xb845('0x1e')],'exten':_0x6992e0[_0xb845('0xa')],'priority':_0x4a926c['length']+_0x4e2ae0[_0xb845('0x11')]+_0x1d42a1++,'VoiceExtensionId':_0x6992e0[_0xb845('0x18')]});_0x22d3bb[_0xb845('0x14')]({'type':_0x6992e0[_0xb845('0x15')],'app':_0xb845('0x16'),'appdata':_0xb845('0x3b'),'context':_0x6992e0[_0xb845('0x1e')],'exten':_0x6992e0[_0xb845('0xa')],'priority':_0x4a926c[_0xb845('0x2a')]+_0x4e2ae0[_0xb845('0x11')]+_0x1d42a1++,'VoiceExtensionId':_0x6992e0[_0xb845('0x18')]});}}}for(var _0x150288=0x0;_0x150288<_0x4a926c['length'];_0x150288+=0x1){var _0x1f6df3=_0x4e2ae0[_0xb845('0x11')]+_0x4a926c[_0xb845('0x2a')];var _0x1fbd47=_0x150288===_0x4a926c[_0xb845('0x2a')]-0x1?_0x4e2ae0[_0xb845('0x11')]+_0x22d3bb['length']+_0x3fb610[_0xb845('0x2a')]+0x2:_0x4e2ae0[_0xb845('0x11')]+_0x150288+0x1;_0x22d3bb[_0xb845('0x3c')](_0x150288,0x0,{'type':_0x6992e0[_0xb845('0x15')],'app':_0xb845('0x3d'),'appdata':_0x4a926c[_0x150288]+'?'+_0x6992e0[_0xb845('0x1e')]+_0xb845('0x3e')+_0x1f6df3+':'+_0x6992e0[_0xb845('0x1e')]+',${EXTEN},'+_0x1fbd47,'exten':_0x6992e0[_0xb845('0xa')],'context':_0x6992e0[_0xb845('0x1e')],'priority':_0x4e2ae0[_0xb845('0x11')]+_0x150288,'VoiceExtensionId':_0xe0f0a3[_0x1857c0][0x0]['VoiceExtensionId']});}_0x6992e0[_0xb845('0x11')]=_0x22d3bb[_0xb845('0x2a')]?_['last'](_0x22d3bb)[_0xb845('0x11')]+0x1:_0x4e2ae0[_0xb845('0x11')];_0x4e2ae0['priority']=(_0x3fb610[_0xb845('0x2a')]?_[_0xb845('0x3f')](_0x3fb610)[_0xb845('0x11')]:_0x6992e0[_0xb845('0x11')])+0x1;_0x4e2ae0[_0xb845('0x12')]=_['concat'](_0x4e2ae0[_0xb845('0x12')],_0x22d3bb,[_0x6992e0],_0x3fb610);}_0x4e2ae0[_0xb845('0x12')][_0xb845('0x14')]({'type':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x15')],'app':_0xb845('0x40'),'exten':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0xa')],'context':_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x1e')],'priority':_0x4e2ae0[_0xb845('0x11')],'VoiceExtensionId':_0xe0f0a3[_0x1857c0][0x0]['VoiceExtensionId']});_0x313f26[_0xb845('0x14')](_0xe0f0a3[_0x1857c0][0x0][_0xb845('0x18')]);_0x35c20b=_[_0xb845('0x41')](_0x35c20b,_0x4e2ae0[_0xb845('0x12')]);}}return _0x441da2[_0xb845('0x42')](function(_0x586d90){return _0x441da2['models']['VoiceExtension'][_0xb845('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x313f26}},'transaction':_0x586d90})[_0xb845('0x5')](function(_0x2a4641){return _0x441da2[_0xb845('0x2')][_0xb845('0x7')][_0xb845('0x44')](_[_0xb845('0x45')](_0x35c20b,_0xb845('0x11')),{'transaction':_0x586d90});});});})[_0xb845('0x46')](function(_0x354ce3){console[_0xb845('0x47')](_0x354ce3);});}exports[_0xb845('0x48')]=rewrite; \ No newline at end of file +var _0x7990=['updatedAt','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','app','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','GotoIfTime',',${EXTEN},','last','concat','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','findAll','intervals','VoiceExtension','then','uniq','map','exten','filter','groupBy','queue','playback','extensions','find','push','type','Set','format','CDR(type)=%s','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','context','priority','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','extension','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt'];(function(_0x166554,_0x275afa){var _0x1f1e10=function(_0x1544c0){while(--_0x1544c0){_0x166554['push'](_0x166554['shift']());}};_0x1f1e10(++_0x275afa);}(_0x7990,0xe3));var _0x0799=function(_0x1b4daf,_0x313f68){_0x1b4daf=_0x1b4daf-0x0;var _0x26cd7f=_0x7990[_0x1b4daf];return _0x26cd7f;};'use strict';var _=require(_0x0799('0x0'));var util=require(_0x0799('0x1'));function rewrite(_0x3b9cf1,_0x205841){var _0x1386cf=this;return _0x3b9cf1[_0x0799('0x2')]['Interval'][_0x0799('0x3')]({'raw':!![]})['then'](function(_0x14005c){_0x1386cf[_0x0799('0x4')]=_0x14005c;return _0x3b9cf1['models'][_0x0799('0x5')][_0x0799('0x3')]({'where':{'IntervalId':_0x205841['IntervalId']},'raw':!![]});})[_0x0799('0x6')](function(_0x32ce07){return _0x3b9cf1['models'][_0x0799('0x5')][_0x0799('0x3')]({'where':{'exten':{'$in':_[_0x0799('0x7')](_[_0x0799('0x8')](_0x32ce07,_0x0799('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x0799('0x6')](function(_0x1d98cd){var _0x329685=_['filter'](_0x1d98cd,{'priority':'1'});var _0x82cf61=_[_0x0799('0xa')](_0x1d98cd,{'isApp':0x1});var _0x3b394c=_[_0x0799('0xb')](_0x82cf61,_0x0799('0x9'));var _0x4a6383=[_0x0799('0xc'),_0x0799('0xd')];var _0x489de0=[];var _0x4b91de=[];for(var _0x54de53 in _0x3b394c){if(_0x3b394c['hasOwnProperty'](_0x54de53)){_0x1386cf['priority']=0x2;_0x1386cf[_0x0799('0xe')]=[];_0x1386cf['extension']=_[_0x0799('0xf')](_0x329685,{'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')]});_0x1386cf['extensions'][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':_0x0799('0x12'),'appdata':util[_0x0799('0x13')](_0x0799('0x14'),_0x3b394c[_0x54de53][0x0][_0x0799('0x11')]),'context':_0x3b394c[_0x54de53][0x0]['context'],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf['priority']++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});if(_0x3b394c[_0x54de53][0x0][_0x0799('0x11')]===_0x0799('0x16')){if(_0x1386cf['extension']){_0x1386cf[_0x0799('0xe')][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':'Set','appdata':_0x0799('0x17')+(_0x1386cf['extension'][_0x0799('0x18')]?_0x0799('0x19')+_0x1386cf['extension'][_0x0799('0x18')]+'}':_0x0799('0x1a')),'context':_0x3b394c[_0x54de53][0x0][_0x0799('0x1b')],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});}_0x1386cf[_0x0799('0xe')]['push']({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':_0x0799('0x12'),'appdata':_0x0799('0x1d')+_0x3b394c[_0x54de53][0x0][_0x0799('0x15')],'context':_0x3b394c[_0x54de53][0x0][_0x0799('0x1b')],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf['priority']++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});var _0x3b03a9=_0x1386cf[_0x0799('0x1c')]++;_0x1386cf[_0x0799('0xe')][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':'ExecIf','appdata':_0x0799('0x1e')+(_0x3b03a9+0x2)+_0x0799('0x1f')+(_0x3b03a9+0x1)+')','context':_0x3b394c[_0x54de53][0x0]['context'],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x3b03a9,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});if(_0x1386cf['extension']){_0x1386cf[_0x0799('0xe')]['push']({'type':_0x3b394c[_0x54de53][0x0]['type'],'app':_0x0799('0x12'),'appdata':_0x1386cf['extension'][_0x0799('0x18')]?_0x0799('0x20')+_0x1386cf['extension'][_0x0799('0x18')]+'}':_0x0799('0x21'),'context':_0x3b394c[_0x54de53][0x0]['context'],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0]['VoiceExtensionId']});}_0x1386cf['extensions']['push']({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':_0x0799('0x12'),'appdata':'outboundrouteid='+_0x3b394c[_0x54de53][0x0][_0x0799('0x15')],'context':_0x3b394c[_0x54de53][0x0][_0x0799('0x1b')],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});if(_0x1386cf[_0x0799('0x22')]&&_0x1386cf[_0x0799('0x22')][_0x0799('0x23')](_0x0799('0x24'))&&_0x1386cf[_0x0799('0x22')]['recordingFormat']!==_0x0799('0x25')){_0x1386cf[_0x0799('0xe')][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0]['type'],'app':_0x0799('0x12'),'appdata':_0x0799('0x26'),'context':_0x3b394c[_0x54de53][0x0][_0x0799('0x1b')],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});_0x1386cf[_0x0799('0xe')][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':_0x0799('0x12'),'appdata':_0x0799('0x27')+_0x1386cf[_0x0799('0x22')][_0x0799('0x24')]||'wav','context':_0x3b394c[_0x54de53][0x0]['context'],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});}}_0x1386cf[_0x0799('0xe')][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':_0x0799('0x12'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x3b394c[_0x54de53][0x0]['context'],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf['priority']++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});_0x1386cf[_0x0799('0xe')]['push']({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':'Set','appdata':_0x0799('0x28'),'context':_0x3b394c[_0x54de53][0x0]['context'],'exten':_0x3b394c[_0x54de53][0x0]['exten'],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});_0x1386cf[_0x0799('0xe')]['push']({'type':_0x3b394c[_0x54de53][0x0]['type'],'app':_0x0799('0x12'),'appdata':_0x0799('0x29'),'context':_0x3b394c[_0x54de53][0x0][_0x0799('0x1b')],'exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'priority':_0x1386cf[_0x0799('0x1c')]++,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});for(var _0x1967c0=0x0,_0x4fe41c=0x0;_0x1967c0<_0x3b394c[_0x54de53][_0x0799('0x2a')];_0x1967c0+=0x1,_0x4fe41c=0x0){var _0x8ecd48=_0x3b394c[_0x54de53][_0x1967c0];if(_0x8ecd48[_0x0799('0x11')]){_0x8ecd48[_0x0799('0x11')]=_0x8ecd48[_0x0799('0x11')][_0x0799('0x2b')]();}var _0x2b7157=[];var _0x1ad0f4=[];delete _0x8ecd48['id'];delete _0x8ecd48[_0x0799('0x2c')];delete _0x8ecd48[_0x0799('0x2d')];var _0x298482=_0x8ecd48[_0x0799('0x2e')]!==_0x0799('0x2f')?[_0x8ecd48[_0x0799('0x2e')]]:_0x8ecd48[_0x0799('0x30')]?_[_0x0799('0x8')](_[_0x0799('0xa')](_0x1386cf[_0x0799('0x4')],{'IntervalId':_0x8ecd48[_0x0799('0x30')]}),_0x0799('0x2e')):[];if(_0x8ecd48[_0x0799('0x23')]('tag')){if(_0x8ecd48[_0x0799('0x31')]&&_0x8ecd48[_0x0799('0x31')]!=='--'){_0x2b7157['push']({'type':_0x8ecd48['type'],'app':_0x0799('0x12'),'appdata':_0x0799('0x32')+_0x8ecd48[_0x0799('0x31')],'context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48[_0x0799('0x9')],'priority':_0x298482[_0x0799('0x2a')]+_0x1386cf[_0x0799('0x1c')]+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48[_0x0799('0x15')]});}}if(_0x8ecd48[_0x0799('0x11')]==='outbound'&&_0x8ecd48['hasOwnProperty'](_0x0799('0x33'))){if(_0x8ecd48[_0x0799('0x33')]){_0x2b7157[_0x0799('0x10')]({'type':_0x8ecd48[_0x0799('0x11')],'app':_0x0799('0x34'),'appdata':_0x0799('0x35')+_0x8ecd48[_0x0799('0x33')]+')','context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48['exten'],'priority':_0x298482[_0x0799('0x2a')]+_0x1386cf['priority']+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48['VoiceExtensionId']});}else{_0x2b7157[_0x0799('0x10')]({'type':_0x8ecd48[_0x0799('0x11')],'app':_0x0799('0x34'),'appdata':_0x0799('0x36'),'context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48[_0x0799('0x9')],'priority':_0x298482[_0x0799('0x2a')]+_0x1386cf[_0x0799('0x1c')]+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48[_0x0799('0x15')]});}}if(_0x8ecd48[_0x0799('0x23')]('answer')){if(_0x4a6383['indexOf'](_0x8ecd48[_0x0799('0x37')][_0x0799('0x2b')]())>=0x0&&_0x8ecd48['appType']!=='custom'){if(_0x8ecd48[_0x0799('0x38')]){_0x2b7157[_0x0799('0x10')]({'type':_0x8ecd48[_0x0799('0x11')],'app':'ExecIf','appdata':_0x0799('0x39'),'context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48['exten'],'priority':_0x298482[_0x0799('0x2a')]+_0x1386cf[_0x0799('0x1c')]+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48[_0x0799('0x15')]});_0x2b7157[_0x0799('0x10')]({'type':_0x8ecd48['type'],'app':_0x0799('0x12'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48[_0x0799('0x9')],'priority':_0x298482[_0x0799('0x2a')]+_0x1386cf[_0x0799('0x1c')]+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48[_0x0799('0x15')]});}else{_0x2b7157['push']({'type':_0x8ecd48['type'],'app':_0x0799('0x34'),'appdata':_0x0799('0x3a'),'context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48['exten'],'priority':_0x298482['length']+_0x1386cf['priority']+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48[_0x0799('0x15')]});_0x2b7157[_0x0799('0x10')]({'type':_0x8ecd48['type'],'app':_0x0799('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x8ecd48[_0x0799('0x1b')],'exten':_0x8ecd48[_0x0799('0x9')],'priority':_0x298482[_0x0799('0x2a')]+_0x1386cf[_0x0799('0x1c')]+_0x4fe41c++,'VoiceExtensionId':_0x8ecd48[_0x0799('0x15')]});}}}for(var _0x52b053=0x0;_0x52b053<_0x298482[_0x0799('0x2a')];_0x52b053+=0x1){var _0x59cf5f=_0x1386cf[_0x0799('0x1c')]+_0x298482['length'];var _0x44889c=_0x52b053===_0x298482[_0x0799('0x2a')]-0x1?_0x1386cf[_0x0799('0x1c')]+_0x2b7157[_0x0799('0x2a')]+_0x1ad0f4[_0x0799('0x2a')]+0x2:_0x1386cf['priority']+_0x52b053+0x1;_0x2b7157['splice'](_0x52b053,0x0,{'type':_0x8ecd48[_0x0799('0x11')],'app':_0x0799('0x3b'),'appdata':_0x298482[_0x52b053]+'?'+_0x8ecd48[_0x0799('0x1b')]+_0x0799('0x3c')+_0x59cf5f+':'+_0x8ecd48[_0x0799('0x1b')]+_0x0799('0x3c')+_0x44889c,'exten':_0x8ecd48[_0x0799('0x9')],'context':_0x8ecd48[_0x0799('0x1b')],'priority':_0x1386cf['priority']+_0x52b053,'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});}_0x8ecd48['priority']=_0x2b7157[_0x0799('0x2a')]?_[_0x0799('0x3d')](_0x2b7157)[_0x0799('0x1c')]+0x1:_0x1386cf[_0x0799('0x1c')];_0x1386cf[_0x0799('0x1c')]=(_0x1ad0f4[_0x0799('0x2a')]?_['last'](_0x1ad0f4)['priority']:_0x8ecd48['priority'])+0x1;_0x1386cf[_0x0799('0xe')]=_[_0x0799('0x3e')](_0x1386cf[_0x0799('0xe')],_0x2b7157,[_0x8ecd48],_0x1ad0f4);}_0x1386cf['extensions'][_0x0799('0x10')]({'type':_0x3b394c[_0x54de53][0x0][_0x0799('0x11')],'app':'Hangup','exten':_0x3b394c[_0x54de53][0x0][_0x0799('0x9')],'context':_0x3b394c[_0x54de53][0x0][_0x0799('0x1b')],'priority':_0x1386cf[_0x0799('0x1c')],'VoiceExtensionId':_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]});_0x489de0['push'](_0x3b394c[_0x54de53][0x0][_0x0799('0x15')]);_0x4b91de=_['concat'](_0x4b91de,_0x1386cf[_0x0799('0xe')]);}}return _0x3b9cf1['transaction'](function(_0x599cee){return _0x3b9cf1['models'][_0x0799('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x489de0}},'transaction':_0x599cee})[_0x0799('0x6')](function(_0x460e54){return _0x3b9cf1[_0x0799('0x2')][_0x0799('0x5')][_0x0799('0x3f')](_[_0x0799('0x40')](_0x4b91de,'priority'),{'transaction':_0x599cee});});});})[_0x0799('0x41')](function(_0x404e5d){console[_0x0799('0x42')](_0x404e5d);});}exports[_0x0799('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 17e567a..c545047 100644 --- a/server/components/import/cm/csv.js +++ b/server/components/import/cm/csv.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['find','Duplicate\x20Contact','CmContact','keys','then','push','pick','catch','message','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','ListId','toString','NOW()','from','cm_contacts','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','insert','deletedAt\x20IS\x20NULL','str','cm_hopper_black','VoiceQueue','outbound','Lists','get','dialCheckDuplicateType','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','CmList','Campaign','findAll','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','duplicate','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','hasOwnProperty','data','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','CompanyId','length'];(function(_0x4cf10a,_0x160696){var _0x1d536e=function(_0x2d2171){while(--_0x2d2171){_0x4cf10a['push'](_0x4cf10a['shift']());}};_0x1d536e(++_0x160696);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var socket=require(_0x0d8b('0x9'))(new Redis(config['redis']));require(_0x0d8b('0xa'))[_0x0d8b('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x2]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0xf'));}var FILEPATH=process[_0x0d8b('0xc')][0x2];if(!process[_0x0d8b('0xc')][0x3]||process[_0x0d8b('0xc')][0x3]==='undefined'||process[_0x0d8b('0xc')][0x3]==='null'||!process[_0x0d8b('0xc')][0x4]||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x4]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x10'));}var FIELDS=_[_0x0d8b('0x11')](process[_0x0d8b('0xc')][0x3][_0x0d8b('0x12')](','),process[_0x0d8b('0xc')][0x4][_0x0d8b('0x12')](','));if(!process[_0x0d8b('0xc')][0x5]||process[_0x0d8b('0xc')][0x5]===_0x0d8b('0xd')||process['argv'][0x5]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x13'));}var LISTID=process[_0x0d8b('0xc')][0x5];var COMPANYID=process[_0x0d8b('0xc')][0x6]&&process[_0x0d8b('0xc')][0x6]!=='undefined'&&process[_0x0d8b('0xc')][0x6]!==_0x0d8b('0xe')?process[_0x0d8b('0xc')][0x6]:null;var DUPLICATES=process[_0x0d8b('0xc')][0x7]&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xd')&&process[_0x0d8b('0xc')][0x7]!==_0x0d8b('0xe')?process['argv'][0x7]:null;if(!process[_0x0d8b('0xc')][0x8]||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xd')||process[_0x0d8b('0xc')][0x8]===_0x0d8b('0xe')){throw new Error(_0x0d8b('0x14'));}var SOCKET_TIMESTAMP=process[_0x0d8b('0xc')][0x8];}catch(_0x352c17){logger['error'](_0x352c17);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4f0a1a,_0x33fb87,_0x54a9a7,_0x56c729){var _0x5527d8={'message':_0x33fb87};_0x5527d8[_0x4f0a1a]=!![];if(_0x54a9a7){_0x5527d8[_0x0d8b('0x15')]=_0x54a9a7;}if(_0x56c729){_0x5527d8[_0x0d8b('0x16')]=_0x56c729;}return _0x5527d8;}function isEmail(_0x214778){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0d8b('0x17')](_0x214778);}function checkRow(_0x221071,_0x2c64e2,_0x30980c){return new BPromise(function(_0x4562cb,_0x27b695){if(_['isNil'](_0x221071)){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x0d8b('0x19'),null,_0x30980c));}if(_0x221071['errors']&&_0x221071[_0x0d8b('0x1a')]['length']){var _0x3dd149=_[_0x0d8b('0x1b')](_0x221071[_0x0d8b('0x1a')],'message')['join'](';');return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),_0x3dd149,null,_0x30980c));}var _0x3ef745={};for(var _0x4c05ee in FIELDS){if(FIELDS[_0x0d8b('0x1c')](_0x4c05ee)&&FIELDS[_0x4c05ee]){_0x3ef745[_0x4c05ee]=_0x221071['data'][0x0][FIELDS[_0x4c05ee]]||_0x221071[_0x0d8b('0x1d')][0x0]['\ufeff'+FIELDS[_0x4c05ee]];}}if(!_0x3ef745['firstName']){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'firstName\x20not\x20specified!',null,_0x30980c));}if(!_0x3ef745[_0x0d8b('0x1e')]){return _0x27b695(handleCheckRowError('error',_0x0d8b('0x1f'),null,_0x30980c));}if(_0x3ef745['birthDate']){var _0x3c8887=moment(_0x3ef745[_0x0d8b('0x20')],_0x0d8b('0x21'));if(!_0x3c8887['isValid']()){return _0x27b695(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x30980c));}}if(_0x3ef745[_0x0d8b('0x22')]){if(!isEmail(_0x3ef745['email'])){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'email\x20format\x20is\x20not\x20valid!',null,_0x30980c));}}_0x3ef745['ListId']=LISTID;_0x3ef745[_0x0d8b('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x0d8b('0x24')]&&_0x2c64e2){var _0x109c14={};for(var _0xdeee5d=0x0,_0x183220=DUPLICATES[_0x0d8b('0x24')];_0xdeee5d<_0x183220;_0xdeee5d+=0x1){_0x109c14[DUPLICATES[_0xdeee5d]]=_0x3ef745[DUPLICATES[_0xdeee5d]];}var _0x4a99d3=_[_0x0d8b('0x25')](_0x2c64e2,_0x109c14);if(_0x4a99d3){return _0x27b695(handleCheckRowError('duplicate',_0x0d8b('0x26'),_0x4a99d3,_0x30980c));}}return db[_0x0d8b('0x27')]['create'](_0x3ef745,{'raw':!![],'hooks':![],'fields':_[_0x0d8b('0x28')](_0x3ef745)})[_0x0d8b('0x29')](function(_0x18a905){if(DUPLICATES&&DUPLICATES['length']&&_0x2c64e2){_0x2c64e2[_0x0d8b('0x2a')](_[_0x0d8b('0x2b')](_0x3ef745,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x18a905['id'];return _0x4562cb();})[_0x0d8b('0x2c')](function(_0x31ceba){return _0x27b695(handleCheckRowError(_0x0d8b('0x18'),'Error\x20while\x20creating\x20contact:\x20'+(_0x31ceba[_0x0d8b('0x2d')]||JSON[_0x0d8b('0x2e')](_0x31ceba)),null,_0x30980c));});});}function checkHopper(){function _0x5ad0fe(){return function(_0x1180ac){logger[_0x0d8b('0x18')](_0x0d8b('0x2f'),_0x0d8b('0x30'),util[_0x0d8b('0x31')](_0x1180ac,{'showHidden':![],'depth':null}));};}var _0x519088=function(_0x497a71,_0x41b4f9){var _0x5c2c04=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x33'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),'ListId',_0x41b4f9,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()[_0x0d8b('0x3a')](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID['toString'](),_0x0d8b('0x3b'))['field'](_0x497a71['id'][_0x0d8b('0x3c')](),_0x41b4f9)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID['toString']())['where'](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel['select']()['field'](_0x0d8b('0x1e'))[_0x0d8b('0x3e')](_0x0d8b('0x33'))['where'](_0x41b4f9+_0x0d8b('0x43'),_0x497a71['id'][_0x0d8b('0x3c')]())))['toString']();return _0x5c2c04;};var _0x4d7bb0=function(_0x372740,_0x495870){var _0x1e22e5=squel['insert']()['into'](_0x0d8b('0x33'))[_0x0d8b('0x34')](['phone','scheduledAt','ContactId','ListId',_0x495870,_0x0d8b('0x37'),_0x0d8b('0x38')],squel[_0x0d8b('0x39')]()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x372740['id'][_0x0d8b('0x3c')](),_0x495870)[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')]('cm_contacts')[_0x0d8b('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel['str'](hopperContacts))[_0x0d8b('0x40')](_0x0d8b('0x41'))[_0x0d8b('0x40')](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('calleridnum')['from']('cm_hopper_final')[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id']['toString']()))['where'](_0x0d8b('0x42'),squel[_0x0d8b('0x39')]()['field']('phone')[_0x0d8b('0x3e')](_0x0d8b('0x33'))[_0x0d8b('0x40')](_0x495870+_0x0d8b('0x43'),_0x372740['id'][_0x0d8b('0x3c')]())))['toString']();return _0x1e22e5;};function _0x2de903(_0x2afe34,_0x5481fc){var _0x580580=squel[_0x0d8b('0x46')]()[_0x0d8b('0x32')]('cm_hopper')['fromQuery']([_0x0d8b('0x1e'),_0x0d8b('0x35'),_0x0d8b('0x36'),_0x0d8b('0x3b'),_0x5481fc,'createdAt',_0x0d8b('0x38')],squel['select']()['field'](_0x0d8b('0x1e'),_0x0d8b('0x1e'))['field']('NOW()',_0x0d8b('0x35'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))[_0x0d8b('0x3a')](_0x2afe34['id'][_0x0d8b('0x3c')](),_0x5481fc)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),_0x0d8b('0x38'))[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))['where'](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where'](_0x0d8b('0x41')))[_0x0d8b('0x3c')]();return _0x580580;}function _0x181d49(_0x17a87f,_0x1d6cd4){var _0x59ada2=squel['insert']()[_0x0d8b('0x32')](_0x0d8b('0x49'))[_0x0d8b('0x34')]([_0x0d8b('0x1e'),'ContactId',_0x0d8b('0x3b'),_0x1d6cd4,_0x0d8b('0x37'),_0x0d8b('0x38')],squel['select']()[_0x0d8b('0x3a')]('phone',_0x0d8b('0x1e'))[_0x0d8b('0x3a')]('id',_0x0d8b('0x36'))[_0x0d8b('0x3a')](LISTID[_0x0d8b('0x3c')](),_0x0d8b('0x3b'))['field'](_0x17a87f['id'][_0x0d8b('0x3c')](),_0x1d6cd4)['field'](_0x0d8b('0x3d'),_0x0d8b('0x37'))[_0x0d8b('0x3a')](_0x0d8b('0x3d'),'updatedAt')[_0x0d8b('0x3e')](_0x0d8b('0x3f'))[_0x0d8b('0x40')](_0x0d8b('0x47'))[_0x0d8b('0x40')](_0x0d8b('0x44'),LISTID[_0x0d8b('0x3c')]())[_0x0d8b('0x40')](_0x0d8b('0x45'),squel[_0x0d8b('0x48')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x0d8b('0x3c')]();return _0x59ada2;}return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x4f4b4d){var _0x587128=[];if(_0x4f4b4d){var _0x1900e3;for(var _0x1c007b=0x0,_0x70e4b2;_0x1c007b<_0x4f4b4d[_0x0d8b('0x24')];_0x1c007b+=0x1){_0x70e4b2=_0x4f4b4d[_0x1c007b][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x70e4b2[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x4d7bb0(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;case _0x0d8b('0x52'):_0x587128['push'](db[_0x0d8b('0x50')]['query'](_0x519088(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x587128[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x70e4b2,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x587128;})[_0x0d8b('0x54')]()['then'](function(){return db[_0x0d8b('0x4a')]['findAll']({'where':{'type':_0x0d8b('0x4b')},'attributes':['id'],'include':[{'model':db[_0x0d8b('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x56e03c){var _0x10c318=[];if(_0x56e03c){var _0x445a00;for(var _0x24f75=0x0,_0x259ac9;_0x24f75<_0x56e03c[_0x0d8b('0x24')];_0x24f75+=0x1){_0x259ac9=_0x56e03c[_0x24f75][_0x0d8b('0x4d')]({'plain':!![]});_0x10c318[_0x0d8b('0x2a')](db[_0x0d8b('0x50')]['query'](_0x181d49(_0x259ac9,_0x0d8b('0x51')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));}}return _0x10c318;})[_0x0d8b('0x54')]();})[_0x0d8b('0x29')](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id',_0x0d8b('0x4e')],'include':[{'model':db[_0x0d8b('0x55')],'as':_0x0d8b('0x4c'),'where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x466082){var _0x5007c0=[];if(_0x466082){for(var _0xe35028=0x0,_0x16df83;_0xe35028<_0x466082['length'];_0xe35028+=0x1){_0x16df83=_0x466082[_0xe35028][_0x0d8b('0x4d')]({'plain':!![]});switch(_0x16df83[_0x0d8b('0x4e')]){case _0x0d8b('0x4f'):_0x5007c0['push'](db['sequelize'][_0x0d8b('0x53')](_0x4d7bb0(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})['catch'](_0x5ad0fe()));break;case'onlyIfOpen':_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x519088(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));break;default:_0x5007c0[_0x0d8b('0x2a')](db[_0x0d8b('0x50')][_0x0d8b('0x53')](_0x2de903(_0x16df83,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}}return _0x5007c0;})[_0x0d8b('0x54')]();})['then'](function(){return db[_0x0d8b('0x56')][_0x0d8b('0x57')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x0d8b('0x29')](function(_0x1dad9f){var _0x3573b4=[];if(_0x1dad9f){for(var _0x14b1b8=0x0,_0x23e2e0;_0x14b1b8<_0x1dad9f[_0x0d8b('0x24')];_0x14b1b8+=0x1){_0x23e2e0=_0x1dad9f[_0x14b1b8]['get']({'plain':!![]});_0x3573b4['push'](db['sequelize'][_0x0d8b('0x53')](_0x181d49(_0x23e2e0,_0x0d8b('0x58')))[_0x0d8b('0x29')](function(){})[_0x0d8b('0x2c')](_0x5ad0fe()));}}return _0x3573b4;})[_0x0d8b('0x54')]();})[_0x0d8b('0x2c')](function(_0x5ef461){logger[_0x0d8b('0x18')](_0x0d8b('0x59'),'generalCheckHopper',_0x5ef461[_0x0d8b('0x2d')]);});}var processPromises=function(_0x57e3c2){return BPromise[_0x0d8b('0x54')](promises)[_0x0d8b('0x29')](function(_0x9dfa5a){})[_0x0d8b('0x2c')](function(_0x10c7ab){logger[_0x0d8b('0x18')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x2e')](_0x10c7ab));})[_0x0d8b('0x5b')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x57e3c2){return _0x57e3c2[_0x0d8b('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0d8b('0x29')](function(){socket[_0x0d8b('0x5c')](_0x0d8b('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0d8b('0x5f')](FILEPATH);}catch(_0xf91ecd){logger[_0x0d8b('0x18')](_0x0d8b('0x60'),JSON['stringify'](_0xf91ecd));}finally{process[_0x0d8b('0x61')](0x0);}});};process['on']('SIGINT',function(){logger[_0x0d8b('0x62')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0x0d8b('0x29')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0d8b('0x12')](',');return db[_0x0d8b('0x27')][_0x0d8b('0x57')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x0d8b('0x29')](function(_0x2eece2){var _0x3c7b9b=fs[_0x0d8b('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0d8b('0x64')](_0x3c7b9b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x20a8b6,_0x3a6014){total+=0x1;var _0x180539=total;promises['push'](checkRow(_0x20a8b6,_0x2eece2,_0x180539)[_0x0d8b('0x29')](function(){success+=0x1;})[_0x0d8b('0x2c')](function(_0x8be77c){if(_0x8be77c['error']){errors+=0x1;delete _0x8be77c['error'];}else if(_0x8be77c[_0x0d8b('0x65')]){duplicates+=0x1;delete _0x8be77c[_0x0d8b('0x65')];}rows[_0x0d8b('0x2a')](_0x8be77c);}));if(total%0xc8===0x0){_0x3a6014[_0x0d8b('0x66')]();return processPromises(_0x3a6014);}},'complete':function(){return processPromises()[_0x0d8b('0x29')](function(){logger[_0x0d8b('0x62')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1a96ce,_0x3d6267){logger[_0x0d8b('0x62')](_0x0d8b('0x67'),JSON[_0x0d8b('0x2e')](_0x1a96ce));endCsv();}});})['catch'](function(_0x4dbcfc){logger[_0x0d8b('0x18')](_0x0d8b('0x68'),JSON[_0x0d8b('0x2e')](_0x4dbcfc));});}main(); \ No newline at end of file +var _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(_0x3b1702,_0x562e65){var _0x42f09b=function(_0x190e5b){while(--_0x190e5b){_0x3b1702['push'](_0x3b1702['shift']());}};_0x42f09b(++_0x562e65);}(_0x70e0,0x17b));var _0x070e=function(_0x3516a3,_0xb71901){_0x3516a3=_0x3516a3-0x0;var _0x639a6a=_0x70e0[_0x3516a3];return _0x639a6a;};'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 20df166..12864eb 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 _0x9b19=['redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','insert','cm_hopper_black','createdAt','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','errors','push','code','sequelize','main','stringify','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','writeFileSync','parse','createReadStream','length','rows','data','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','then','finish','affectedRows','emit','unlink','catch','exit','complete','argv','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','../../../mysqldb'];(function(_0x39314f,_0x3ae131){var _0x26771b=function(_0x32dafa){while(--_0x32dafa){_0x39314f['push'](_0x39314f['shift']());}};_0x26771b(++_0x3ae131);}(_0x9b19,0x77));var _0x99b1=function(_0x9861ff,_0x41fb17){_0x9861ff=_0x9861ff-0x0;var _0x48852b=_0x9b19[_0x9861ff];return _0x48852b;};'use strict';var fs=require('fs');var path=require(_0x99b1('0x0'));var _=require(_0x99b1('0x1'));var Papa=require(_0x99b1('0x2'));var util=require(_0x99b1('0x3'));var BPromise=require('bluebird');var moment=require(_0x99b1('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x99b1('0x5'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('import');config[_0x99b1('0x6')]=_['defaults'](config[_0x99b1('0x6')],{'host':_0x99b1('0x7'),'port':0x18eb});var socket=require(_0x99b1('0x8'))(new Redis(config[_0x99b1('0x6')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x99b1('0x9')](_0x99b1('0xa'));function isEmail(_0xf08008){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'](_0xf08008);}function selectNotIn(_0x14014d,_0x18324a,_0x5f4b63,_0x3b427a,_0x319b88){return squel['select']()[_0x99b1('0xb')]('phone')[_0x99b1('0xc')](_0x3b427a)[_0x99b1('0xd')](_0x18324a,null,_0x18324a+_0x99b1('0xe')+_0x3b427a+'.'+_0x5f4b63)[_0x99b1('0xf')](_0x3b427a+'.'+_0x5f4b63+_0x99b1('0x10')+_0x14014d+'.'+_0x5f4b63)['where'](_0x18324a+'.dialCheckDuplicateType\x20IN\x20('+_0x319b88[_0x99b1('0xd')]()+')');}function insertCmHopper(_0x9102cc,_0x42bb9f,_0x1be2fb,_0x104d3f,_0x44682e){var _0x10089e=[_0x99b1('0x11'),_0x99b1('0x12'),_0x99b1('0x13'),_0x99b1('0x14'),_0x42bb9f+'.'+_0x104d3f,_0x99b1('0x15'),_0x99b1('0x16'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x44682e+'\x22'];return squel['insert']()[_0x99b1('0x17')](_0x99b1('0x18'))[_0x99b1('0x19')]([_0x99b1('0x1a'),_0x99b1('0x1b'),_0x99b1('0x1c'),_0x99b1('0x1d'),_0x104d3f,'createdAt',_0x99b1('0x1e'),_0x99b1('0x1f'),_0x99b1('0x20'),_0x99b1('0x21')],squel[_0x99b1('0x22')]()[_0x99b1('0x23')](_0x10089e)['from'](_0x42bb9f)['join'](_0x99b1('0x24'),null,_0x99b1('0x25')+_0x42bb9f+_0x99b1('0x26'))['join'](_0x1be2fb,null,_0x1be2fb+'.id\x20=\x20'+_0x42bb9f+'.'+_0x104d3f)['where'](_0x42bb9f+_0x99b1('0x27'),_0x9102cc)['where'](_0x99b1('0x28'),NOW)['where'](_0x99b1('0x29'),selectNotIn(_0x42bb9f,_0x1be2fb,_0x104d3f,_0x99b1('0x18'),[_0x99b1('0x2a'),_0x99b1('0x2b')]))[_0x99b1('0xf')](_0x99b1('0x29'),selectNotIn(_0x42bb9f,_0x1be2fb,_0x104d3f,_0x99b1('0x18'),[_0x99b1('0x2a')])))['toString']();}function insertCmHopperBlack(_0x2355cc,_0x15a546,_0x5e06bc,_0x1056c9){var _0x4012be=[_0x99b1('0x11'),_0x99b1('0x13'),_0x99b1('0x14'),_0x15a546+'.'+_0x1056c9,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x99b1('0x2c')]()['into'](_0x99b1('0x2d'))['fromQuery']([_0x99b1('0x1a'),'ContactId',_0x99b1('0x1d'),_0x1056c9,_0x99b1('0x2e'),'updatedAt'],squel['select']()[_0x99b1('0x23')](_0x4012be)[_0x99b1('0xc')](_0x15a546)[_0x99b1('0xd')]('cm_contacts',null,_0x99b1('0x25')+_0x15a546+_0x99b1('0x26'))[_0x99b1('0xd')](_0x5e06bc,null,_0x5e06bc+'.id\x20=\x20'+_0x15a546+'.'+_0x1056c9)[_0x99b1('0xf')](_0x15a546+_0x99b1('0x27'),_0x2355cc)[_0x99b1('0xf')](_0x99b1('0x28'),NOW)[_0x99b1('0xf')](_0x99b1('0x29'),squel[_0x99b1('0x22')]()[_0x99b1('0xb')](_0x99b1('0x1a'))['from'](_0x99b1('0x2d'))[_0x99b1('0xf')](_0x99b1('0x2f'),_0x2355cc)['where'](_0x1056c9+_0x99b1('0x30'),_0x15a546+'.'+_0x1056c9)))['toString']();}function insertCmContact(_0xa17445,_0x52ab8b,_0x5a9906,_0x45eea8){var _0x4eeb31=_[_0x99b1('0x31')](_[_0x99b1('0x32')](_0x45eea8),[_0x99b1('0x1d'),_0x99b1('0x33'),_0x99b1('0x2e'),'updatedAt']);return squel[_0x99b1('0x2c')]()[_0x99b1('0x17')]('cm_contacts')[_0x99b1('0x19')](_0x4eeb31,squel[_0x99b1('0x22')]()[_0x99b1('0x23')](_0x4eeb31)[_0x99b1('0xc')](_0x52ab8b)[_0x99b1('0xf')]('('+_0x5a9906[_0x99b1('0xd')](',')+_0x99b1('0x34'),squel[_0x99b1('0x22')]()[_0x99b1('0x23')](_0x5a9906)[_0x99b1('0xc')](_0x99b1('0x24'))[_0x99b1('0xf')](_0x99b1('0x2f'),_0xa17445)['where'](_0x99b1('0x35')))[_0x99b1('0xf')](_0x99b1('0x36'),squel[_0x99b1('0x22')]()[_0x99b1('0xb')](_0x99b1('0x37'),_0x99b1('0x38'))[_0x99b1('0xc')](_0x52ab8b)[_0x99b1('0x39')](_0x5a9906[_0x99b1('0xd')](','))))['toString']();}function handleStop(){logger[_0x99b1('0x3a')](_0x99b1('0x3b'));stopped=!![];}function handleUncaughtException(_0x3d16d4){logger[_0x99b1('0x3c')](_0x3d16d4[_0x99b1('0x3d')]);process['exit'](0x1);}function handleError(_0x2b3840,_0x15f64e){stats[_0x99b1('0x3e')][_0x99b1('0x3f')]({'name':_0x15f64e[_0x99b1('0x40')],'message':_0x15f64e[_0x99b1('0x3d')],'row':_0x2b3840});}function handleQuery(_0x1108cb){logger[_0x99b1('0x3a')](_0x1108cb);return db[_0x99b1('0x41')]['query'](_0x1108cb)['spread'](function(_0x128a14){results[_0x99b1('0x3f')](_0x128a14);})['catch'](function(_0x24ab55){logger['error'](_0x24ab55[_0x99b1('0x3d')]);});}function main(_0x35480a,_0x295613,_0x34dd4a,_0x29d405){logger[_0x99b1('0x3a')](_0x99b1('0x42'),_0x35480a,JSON[_0x99b1('0x43')](_0x295613));process[_0x99b1('0x44')](_0x99b1('0x45'));var _0x1f3548=_0x295613[_0x99b1('0x46')];var _0x374c16=_0x295613[_0x99b1('0x47')];var _0x14d823=path[_0x99b1('0xd')](config[_0x99b1('0x48')],_0x99b1('0x49'),_0x374c16+_0x99b1('0x4a'));var _0x1e11e7=_[_0x99b1('0x32')](_0x1f3548)[_0x99b1('0xd')]();logger[_0x99b1('0x3a')]('header',_0x1e11e7);fs[_0x99b1('0x4b')](_0x14d823,_0x1e11e7+'\x0a');Papa[_0x99b1('0x4c')](fs[_0x99b1('0x4d')](_0x35480a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2596e1,_0x522e85){try{for(var _0x15d8af=0x0,_0xa6c448=[];_0x15d8af<_0x2596e1['data'][_0x99b1('0x4e')];_0x15d8af++){stats[_0x99b1('0x4f')]+=0x1;if(_0x2596e1[_0x99b1('0x3e')][_0x15d8af]){handleError(_0x2596e1[_0x99b1('0x50')][_0x15d8af],_0x2596e1['errors'][_0x15d8af]);}else{var _0x3f9c26=[];for(var _0x2dba86 in _0x1f3548){if(_0x1f3548['hasOwnProperty'](_0x2dba86)){if(_0x2596e1[_0x99b1('0x50')][_0x15d8af][_0x1f3548[_0x2dba86]]){var _0x95b804=_[_0x99b1('0x51')](_0x2596e1[_0x99b1('0x50')][_0x15d8af][_0x1f3548[_0x2dba86]]['replace'](/"/g,'\x27'));switch(_0x2dba86){case _0x99b1('0x1b'):var _0x3eb568=moment(_0x95b804,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3eb568[_0x99b1('0x52')]()){_0xa6c448[_0x99b1('0x3f')]('\x22'+_0x95b804+'\x22');}else{_0x3f9c26['push'](_0x99b1('0x53'));}break;case'priority':var _0x5dc7ee=parseInt(_0x95b804);_0x95b804=_['isNaN'](_0x5dc7ee)||_0x5dc7ee<0x0||_0x5dc7ee>0x4?_0x29d405?0x3:0x2:_0x5dc7ee;_0xa6c448[_0x99b1('0x3f')]('\x22'+_0x95b804+'\x22');break;case'UserId':var _0x5dc5c5=parseInt(_0x95b804);if(_[_0x99b1('0x54')](_0x5dc5c5)&&_['includes'](_0x34dd4a,_0x5dc5c5)){_0xa6c448[_0x99b1('0x3f')]('\x22'+_0x5dc5c5+'\x22');}else{_0x3f9c26[_0x99b1('0x3f')]('agent\x20not\x20exists');}break;case _0x99b1('0x55'):if(isEmail(_0x95b804)){_0xa6c448['push']('\x22'+_0x95b804+'\x22');}else{_0x3f9c26[_0x99b1('0x3f')](_0x99b1('0x56'));}break;case'dateOfBirth':var _0x5dabd2=moment(_0x95b804,_0x99b1('0x57'),!![]);if(_0x5dabd2[_0x99b1('0x52')]()){_0xa6c448[_0x99b1('0x3f')]('\x22'+_0x95b804+'\x22');}else{_0x3f9c26['push'](_0x99b1('0x58'));}break;default:_0xa6c448[_0x99b1('0x3f')]('\x22'+_0x95b804+'\x22');}}else{switch(_0x2dba86){case'firstName':case _0x99b1('0x1a'):_0x3f9c26[_0x99b1('0x3f')](_0x2dba86+_0x99b1('0x59'));break;default:_0xa6c448['push']('\x22\x22');}}}}if(_0x3f9c26[_0x99b1('0x4e')]){handleError(_0x2596e1[_0x99b1('0x50')][_0x15d8af],{'code':'SystemRow','message':_0x3f9c26['join']()});}else{fs['appendFileSync'](_0x14d823,_0xa6c448[_0x99b1('0xd')]()+'\x0a');}_0xa6c448=[];}if(!(stats['rows']%0xc8)){socket['emit']('contact:import:'+_0x374c16,stats);stats[_0x99b1('0x3e')]=[];}}if(stopped){logger[_0x99b1('0x3a')](_0x99b1('0x5a'));_0x522e85[_0x99b1('0x5b')]();}}catch(_0x407199){handleError(_0x2596e1[_0x99b1('0x50')][_0x15d8af],{'code':_0x99b1('0x5c'),'message':_0x407199[_0x99b1('0x3d')]});logger[_0x99b1('0x3c')](_0x99b1('0x5d'),_0x407199[_0x99b1('0x3d')]);}},'complete':function(){try{var _0x1f1818=[];var _0x47bc0b='cm_contacts';if(_0x295613[_0x99b1('0x5e')]&&_0x295613[_0x99b1('0x5e')][_0x99b1('0x4e')]){_0x47bc0b=_0x99b1('0x5f')+_0x374c16;_0x1f1818[_0x99b1('0x3f')]('CREATE\x20TABLE\x20'+_0x47bc0b+_0x99b1('0x60'));}var _0x14da1=util[_0x99b1('0x9')](_0x99b1('0x61'),_0x14d823,_0x47bc0b,_0x1e11e7,_0x295613['ListId'],_0x295613[_0x99b1('0x33')]||null,NOW,NOW);if(_['isNil'](_0x1f3548[_0x99b1('0x1b')])){_0x14da1+=',\x20scheduledAt\x20=\x20NOW()';}_0x1f1818['push'](_0x14da1);if(_0x295613[_0x99b1('0x5e')]&&_0x295613[_0x99b1('0x5e')]['length']){_0x1f1818[_0x99b1('0x3f')](insertCmContact(_0x295613[_0x99b1('0x1d')],_0x47bc0b,_0x295613['duplicates'],_0x1f3548));_0x1f1818[_0x99b1('0x3f')](_0x99b1('0x62')+_0x47bc0b+';');}_0x1f1818['push'](insertCmHopper(_0x295613['ListId'],_0x99b1('0x63'),_0x99b1('0x64'),'VoiceQueueId',_0x29d405));_0x1f1818[_0x99b1('0x3f')](insertCmHopperBlack(_0x295613[_0x99b1('0x1d')],'voice_queues_has_cm_blacklists',_0x99b1('0x64'),_0x99b1('0x65')));_0x1f1818[_0x99b1('0x3f')](insertCmHopper(_0x295613['ListId'],_0x99b1('0x66'),_0x99b1('0x67'),'CampaignId',_0x29d405));_0x1f1818['push'](insertCmHopperBlack(_0x295613[_0x99b1('0x1d')],_0x99b1('0x68'),_0x99b1('0x67'),_0x99b1('0x69')));BPromise['each'](_0x1f1818,handleQuery)[_0x99b1('0x6a')](function(_0x41a8d4){stats[_0x99b1('0x6b')]=!![];stats[_0x99b1('0x6c')]=_0x295613['duplicates']&&_0x295613[_0x99b1('0x5e')]['length']?results[0x2][_0x99b1('0x6c')]:results[0x0]['affectedRows'];socket[_0x99b1('0x6d')]('contact:import:'+_0x374c16,stats);fs[_0x99b1('0x6e')](_0x35480a);fs[_0x99b1('0x6e')](_0x14d823);process['exit'](0x0);})[_0x99b1('0x6f')](function(_0x2a732a){logger[_0x99b1('0x3c')](_0x2a732a[_0x99b1('0x3d')]);process[_0x99b1('0x70')](0x1);});}catch(_0x4d1888){logger[_0x99b1('0x3c')](_0x99b1('0x71'),_0x4d1888[_0x99b1('0x3d')]);process['exit'](0x1);}},'error':function(_0x2e8c64,_0x12b941,_0x215338,_0x9e9e44){throw new Error(_0x9e9e44);}});}function validate(){if(process[_0x99b1('0x72')]&&process[_0x99b1('0x72')][_0x99b1('0x4e')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x38ed97=path[_0x99b1('0xd')](config[_0x99b1('0x48')],_0x99b1('0x49'),process['argv'][0x2]);if(!fs[_0x99b1('0x73')](_0x38ed97)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x2c4f1a={};try{_0x2c4f1a=JSON[_0x99b1('0x4c')](process['argv'][0x3]);if(!_0x2c4f1a[_0x99b1('0x46')]){throw new Error(_0x99b1('0x74'));}if(!_0x2c4f1a[_0x99b1('0x46')][_0x99b1('0x1a')]){throw new Error(_0x99b1('0x75'));}if(!_0x2c4f1a['binding'][_0x99b1('0x76')]){throw new Error('firstName\x20is\x20mandatory');}var _0x5b19ea=0x0;if(_0x2c4f1a[_0x99b1('0x46')][_0x99b1('0x20')]){_0x5b19ea=0x1;}if(!_0x2c4f1a['ListId']){throw new Error(_0x99b1('0x77'));}}catch(_0x46222f){throw new Error(_0x99b1('0x78'));}var _0x14d38b=[];try{_0x14d38b=_[_0x99b1('0x79')](JSON['parse'](process[_0x99b1('0x72')][0x4]),'id');}catch(_0x5eec61){logger[_0x99b1('0x3a')](_0x99b1('0x7a'));}main(_0x38ed97,_0x2c4f1a,_0x14d38b,_0x5b19ea);}validate();process['on'](_0x99b1('0x7b'),handleStop);process['on'](_0x99b1('0x7c'),handleUncaughtException); \ No newline at end of file +var _0x1e14=['.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','into','cm_hopper_black','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','error','message','exit','push','code','sequelize','query','spread','send','start','binding','server/files/tmp','.csv','info','header','writeFileSync','parse','createReadStream','data','length','errors','hasOwnProperty','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','\x20not\x20specified','SystemRow','appendFileSync','rows','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','then','finish','affectedRows','emit','unlink','catch','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','ioredis','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','join','\x20=\x20','where','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','fields','from','cm_contacts','.CmListId'];(function(_0x444bd0,_0x283898){var _0x1f3fb7=function(_0x5cb609){while(--_0x5cb609){_0x444bd0['push'](_0x444bd0['shift']());}};_0x1f3fb7(++_0x283898);}(_0x1e14,0x1f0));var _0x41e1=function(_0x4d6133,_0x2460d1){_0x4d6133=_0x4d6133-0x0;var _0x5f21e9=_0x1e14[_0x4d6133];return _0x5f21e9;};'use strict';var fs=require('fs');var path=require(_0x41e1('0x0'));var _=require(_0x41e1('0x1'));var Papa=require(_0x41e1('0x2'));var util=require(_0x41e1('0x3'));var BPromise=require(_0x41e1('0x4'));var moment=require(_0x41e1('0x5'));var squel=require('squel');var Redis=require(_0x41e1('0x6'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x41e1('0x7'));config['redis']=_['defaults'](config[_0x41e1('0x8')],{'host':_0x41e1('0x9'),'port':0x18eb});var socket=require(_0x41e1('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x41e1('0xb')](_0x41e1('0xc'));function isEmail(_0x54bfa3){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))*$/[_0x41e1('0xd')](_0x54bfa3);}function selectNotIn(_0x232f8a,_0xffdd30,_0x524a09,_0x16663c,_0x1ce2fc){return squel[_0x41e1('0xe')]()[_0x41e1('0xf')](_0x41e1('0x10'))['from'](_0x16663c)[_0x41e1('0x11')](_0xffdd30,null,_0xffdd30+'.id\x20=\x20'+_0x16663c+'.'+_0x524a09)['where'](_0x16663c+'.'+_0x524a09+_0x41e1('0x12')+_0x232f8a+'.'+_0x524a09)[_0x41e1('0x13')](_0xffdd30+'.dialCheckDuplicateType\x20IN\x20('+_0x1ce2fc[_0x41e1('0x11')]()+')');}function insertCmHopper(_0x3a8469,_0x4e9f22,_0x156446,_0x2d3ed5,_0x18ca7f){var _0x32814e=[_0x41e1('0x14'),'cm_contacts.scheduledat',_0x41e1('0x15'),_0x41e1('0x16'),_0x4e9f22+'.'+_0x2d3ed5,_0x41e1('0x17'),_0x41e1('0x18'),_0x41e1('0x19'),_0x41e1('0x1a'),'\x22'+_0x18ca7f+'\x22'];return squel[_0x41e1('0x1b')]()['into'](_0x41e1('0x1c'))[_0x41e1('0x1d')]([_0x41e1('0x10'),_0x41e1('0x1e'),_0x41e1('0x1f'),_0x41e1('0x20'),_0x2d3ed5,_0x41e1('0x21'),_0x41e1('0x22'),'priority',_0x41e1('0x23'),'recallme'],squel['select']()[_0x41e1('0x24')](_0x32814e)[_0x41e1('0x25')](_0x4e9f22)[_0x41e1('0x11')](_0x41e1('0x26'),null,'cm_contacts.ListId\x20=\x20'+_0x4e9f22+_0x41e1('0x27'))['join'](_0x156446,null,_0x156446+_0x41e1('0x28')+_0x4e9f22+'.'+_0x2d3ed5)['where'](_0x4e9f22+_0x41e1('0x29'),_0x3a8469)[_0x41e1('0x13')](_0x41e1('0x2a'),NOW)[_0x41e1('0x13')](_0x41e1('0x2b'),selectNotIn(_0x4e9f22,_0x156446,_0x2d3ed5,'cm_hopper',['\x22always\x22',_0x41e1('0x2c')]))['where'](_0x41e1('0x2b'),selectNotIn(_0x4e9f22,_0x156446,_0x2d3ed5,_0x41e1('0x1c'),[_0x41e1('0x2d')])))[_0x41e1('0x2e')]();}function insertCmHopperBlack(_0x511002,_0xd72650,_0x5de5da,_0x4bf3f5){var _0x5390aa=['cm_contacts.phone',_0x41e1('0x15'),_0x41e1('0x16'),_0xd72650+'.'+_0x4bf3f5,_0x41e1('0x17'),'cm_contacts.updatedAt'];return squel[_0x41e1('0x1b')]()[_0x41e1('0x2f')](_0x41e1('0x30'))[_0x41e1('0x1d')]([_0x41e1('0x10'),_0x41e1('0x1f'),'ListId',_0x4bf3f5,_0x41e1('0x21'),_0x41e1('0x22')],squel[_0x41e1('0xe')]()[_0x41e1('0x24')](_0x5390aa)['from'](_0xd72650)[_0x41e1('0x11')](_0x41e1('0x26'),null,_0x41e1('0x31')+_0xd72650+_0x41e1('0x27'))[_0x41e1('0x11')](_0x5de5da,null,_0x5de5da+_0x41e1('0x28')+_0xd72650+'.'+_0x4bf3f5)[_0x41e1('0x13')](_0xd72650+_0x41e1('0x29'),_0x511002)[_0x41e1('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x41e1('0x13')](_0x41e1('0x2b'),squel[_0x41e1('0xe')]()['field'](_0x41e1('0x10'))[_0x41e1('0x25')](_0x41e1('0x30'))['where'](_0x41e1('0x32'),_0x511002)['where'](_0x4bf3f5+_0x41e1('0x33'),_0xd72650+'.'+_0x4bf3f5)))[_0x41e1('0x2e')]();}function insertCmContact(_0x347a5e,_0x51f573,_0x41959b,_0x5567e9){var _0x467fc2=_[_0x41e1('0x34')](_[_0x41e1('0x35')](_0x5567e9),[_0x41e1('0x20'),'CompanyId',_0x41e1('0x21'),_0x41e1('0x22')]);return squel[_0x41e1('0x1b')]()[_0x41e1('0x2f')](_0x41e1('0x26'))[_0x41e1('0x1d')](_0x467fc2,squel[_0x41e1('0xe')]()[_0x41e1('0x24')](_0x467fc2)['from'](_0x51f573)[_0x41e1('0x13')]('('+_0x41959b[_0x41e1('0x11')](',')+_0x41e1('0x36'),squel[_0x41e1('0xe')]()['fields'](_0x41959b)[_0x41e1('0x25')]('cm_contacts')['where'](_0x41e1('0x32'),_0x347a5e)[_0x41e1('0x13')](_0x41e1('0x37')))[_0x41e1('0x13')](_0x41e1('0x38'),squel[_0x41e1('0xe')]()[_0x41e1('0xf')](_0x41e1('0x39'),'min_id')[_0x41e1('0x25')](_0x51f573)[_0x41e1('0x3a')](_0x41959b[_0x41e1('0x11')](','))))[_0x41e1('0x2e')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2db7a6){logger[_0x41e1('0x3b')](_0x2db7a6[_0x41e1('0x3c')]);process[_0x41e1('0x3d')](0x1);}function handleError(_0x136940,_0x3b540c){stats['errors'][_0x41e1('0x3e')]({'name':_0x3b540c[_0x41e1('0x3f')],'message':_0x3b540c[_0x41e1('0x3c')],'row':_0x136940});}function handleQuery(_0xb31be4){logger['info'](_0xb31be4);return db[_0x41e1('0x40')][_0x41e1('0x41')](_0xb31be4)[_0x41e1('0x42')](function(_0x5876a1){results[_0x41e1('0x3e')](_0x5876a1);})['catch'](function(_0x2a1aa4){logger[_0x41e1('0x3b')](_0x2a1aa4[_0x41e1('0x3c')]);});}function main(_0x148841,_0x3418ab,_0x1ba3d2,_0xcaf33b){logger['info']('main',_0x148841,JSON['stringify'](_0x3418ab));process[_0x41e1('0x43')](_0x41e1('0x44'));var _0x31efbf=_0x3418ab[_0x41e1('0x45')];var _0x175732=_0x3418ab['socket_timestamp'];var _0x2d8fa1=path[_0x41e1('0x11')](config['root'],_0x41e1('0x46'),_0x175732+_0x41e1('0x47'));var _0x52d913=_[_0x41e1('0x35')](_0x31efbf)[_0x41e1('0x11')]();logger[_0x41e1('0x48')](_0x41e1('0x49'),_0x52d913);fs[_0x41e1('0x4a')](_0x2d8fa1,_0x52d913+'\x0a');Papa[_0x41e1('0x4b')](fs[_0x41e1('0x4c')](_0x148841),{'header':!![],'skipEmptyLines':!![],'step':function(_0x445e38,_0x24aa0d){try{for(var _0x60093e=0x0,_0x593542=[];_0x60093e<_0x445e38[_0x41e1('0x4d')][_0x41e1('0x4e')];_0x60093e++){stats['rows']+=0x1;if(_0x445e38[_0x41e1('0x4f')][_0x60093e]){handleError(_0x445e38[_0x41e1('0x4d')][_0x60093e],_0x445e38[_0x41e1('0x4f')][_0x60093e]);}else{var _0x280a8c=[];for(var _0x28aafe in _0x31efbf){if(_0x31efbf[_0x41e1('0x50')](_0x28aafe)){if(_0x445e38[_0x41e1('0x4d')][_0x60093e][_0x31efbf[_0x28aafe]]){var _0x2c7589=_[_0x41e1('0x51')](_0x445e38[_0x41e1('0x4d')][_0x60093e][_0x31efbf[_0x28aafe]]['replace'](/"/g,'\x27'));switch(_0x28aafe){case _0x41e1('0x1e'):var _0x3fd18a=moment(_0x2c7589,_0x41e1('0xc'),!![]);if(_0x3fd18a[_0x41e1('0x52')]()){_0x593542[_0x41e1('0x3e')]('\x22'+_0x2c7589+'\x22');}else{_0x280a8c['push'](_0x41e1('0x53'));}break;case _0x41e1('0x54'):var _0x31dbc5=parseInt(_0x2c7589);_0x2c7589=_['isNaN'](_0x31dbc5)||_0x31dbc5<0x0||_0x31dbc5>0x4?_0xcaf33b?0x3:0x2:_0x31dbc5;_0x593542['push']('\x22'+_0x2c7589+'\x22');break;case _0x41e1('0x23'):var _0x6e00d6=parseInt(_0x2c7589);if(_[_0x41e1('0x55')](_0x6e00d6)&&_[_0x41e1('0x56')](_0x1ba3d2,_0x6e00d6)){_0x593542[_0x41e1('0x3e')]('\x22'+_0x6e00d6+'\x22');}else{_0x280a8c[_0x41e1('0x3e')]('agent\x20not\x20exists');}break;case _0x41e1('0x57'):if(isEmail(_0x2c7589)){_0x593542[_0x41e1('0x3e')]('\x22'+_0x2c7589+'\x22');}else{_0x280a8c['push'](_0x41e1('0x58'));}break;case'dateOfBirth':var _0x389f6e=moment(_0x2c7589,_0x41e1('0x59'),!![]);if(_0x389f6e[_0x41e1('0x52')]()){_0x593542[_0x41e1('0x3e')]('\x22'+_0x2c7589+'\x22');}else{_0x280a8c['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x593542[_0x41e1('0x3e')]('\x22'+_0x2c7589+'\x22');}}else{switch(_0x28aafe){case'firstName':case _0x41e1('0x10'):_0x280a8c[_0x41e1('0x3e')](_0x28aafe+_0x41e1('0x5a'));break;default:_0x593542[_0x41e1('0x3e')]('\x22\x22');}}}}if(_0x280a8c['length']){handleError(_0x445e38['data'][_0x60093e],{'code':_0x41e1('0x5b'),'message':_0x280a8c[_0x41e1('0x11')]()});}else{fs[_0x41e1('0x5c')](_0x2d8fa1,_0x593542[_0x41e1('0x11')]()+'\x0a');}_0x593542=[];}if(!(stats[_0x41e1('0x5d')]%0xc8)){socket['emit'](_0x41e1('0x5e')+_0x175732,stats);stats[_0x41e1('0x4f')]=[];}}if(stopped){logger['info'](_0x41e1('0x5f'));_0x24aa0d[_0x41e1('0x60')]();}}catch(_0x4e304d){handleError(_0x445e38['data'][_0x60093e],{'code':_0x41e1('0x61'),'message':_0x4e304d[_0x41e1('0x3c')]});logger[_0x41e1('0x3b')](_0x41e1('0x62'),_0x4e304d[_0x41e1('0x3c')]);}},'complete':function(){try{var _0xcdf647=[];var _0x408775=_0x41e1('0x26');if(_0x3418ab[_0x41e1('0x63')]&&_0x3418ab[_0x41e1('0x63')]['length']){_0x408775=_0x41e1('0x64')+_0x175732;_0xcdf647[_0x41e1('0x3e')](_0x41e1('0x65')+_0x408775+_0x41e1('0x66'));}var _0x2c34c4=util[_0x41e1('0xb')](_0x41e1('0x67'),_0x2d8fa1,_0x408775,_0x52d913,_0x3418ab[_0x41e1('0x20')],_0x3418ab['CompanyId']||null,NOW,NOW);if(_[_0x41e1('0x68')](_0x31efbf[_0x41e1('0x1e')])){_0x2c34c4+=_0x41e1('0x69');}_0xcdf647[_0x41e1('0x3e')](_0x2c34c4);if(_0x3418ab[_0x41e1('0x63')]&&_0x3418ab[_0x41e1('0x63')]['length']){_0xcdf647[_0x41e1('0x3e')](insertCmContact(_0x3418ab[_0x41e1('0x20')],_0x408775,_0x3418ab[_0x41e1('0x63')],_0x31efbf));_0xcdf647[_0x41e1('0x3e')](_0x41e1('0x6a')+_0x408775+';');}_0xcdf647[_0x41e1('0x3e')](insertCmHopper(_0x3418ab[_0x41e1('0x20')],_0x41e1('0x6b'),_0x41e1('0x6c'),'VoiceQueueId',_0xcaf33b));_0xcdf647[_0x41e1('0x3e')](insertCmHopperBlack(_0x3418ab['ListId'],'voice_queues_has_cm_blacklists',_0x41e1('0x6c'),_0x41e1('0x6d')));_0xcdf647['push'](insertCmHopper(_0x3418ab['ListId'],_0x41e1('0x6e'),'campaigns',_0x41e1('0x6f'),_0xcaf33b));_0xcdf647[_0x41e1('0x3e')](insertCmHopperBlack(_0x3418ab['ListId'],_0x41e1('0x70'),_0x41e1('0x71'),_0x41e1('0x6f')));BPromise[_0x41e1('0x72')](_0xcdf647,handleQuery)[_0x41e1('0x73')](function(_0x36aaa8){stats[_0x41e1('0x74')]=!![];stats['affectedRows']=_0x3418ab['duplicates']&&_0x3418ab[_0x41e1('0x63')][_0x41e1('0x4e')]?results[0x2][_0x41e1('0x75')]:results[0x0][_0x41e1('0x75')];socket[_0x41e1('0x76')]('contact:import:'+_0x175732,stats);fs['unlink'](_0x148841);fs[_0x41e1('0x77')](_0x2d8fa1);process[_0x41e1('0x3d')](0x0);})[_0x41e1('0x78')](function(_0x5465e1){logger[_0x41e1('0x3b')](_0x5465e1[_0x41e1('0x3c')]);process[_0x41e1('0x3d')](0x1);});}catch(_0x3a9b2d){logger[_0x41e1('0x3b')]('complete',_0x3a9b2d[_0x41e1('0x3c')]);process[_0x41e1('0x3d')](0x1);}},'error':function(_0x52edba,_0x2f2f3a,_0x23f4d6,_0x12bf70){throw new Error(_0x12bf70);}});}function validate(){if(process[_0x41e1('0x79')]&&process['argv']['length']<0x4){throw new Error(_0x41e1('0x7a'));}var _0x12fa9e=path[_0x41e1('0x11')](config[_0x41e1('0x7b')],'server/files/tmp',process[_0x41e1('0x79')][0x2]);if(!fs[_0x41e1('0x7c')](_0x12fa9e)){throw new Error(_0x41e1('0x7d'));}var _0x5f1b64={};try{_0x5f1b64=JSON[_0x41e1('0x4b')](process[_0x41e1('0x79')][0x3]);if(!_0x5f1b64[_0x41e1('0x45')]){throw new Error(_0x41e1('0x7e'));}if(!_0x5f1b64[_0x41e1('0x45')][_0x41e1('0x10')]){throw new Error(_0x41e1('0x7f'));}if(!_0x5f1b64[_0x41e1('0x45')][_0x41e1('0x80')]){throw new Error('firstName\x20is\x20mandatory');}var _0xf15220=0x0;if(_0x5f1b64[_0x41e1('0x45')]['UserId']){_0xf15220=0x1;}if(!_0x5f1b64[_0x41e1('0x20')]){throw new Error(_0x41e1('0x81'));}}catch(_0x33de55){throw new Error(_0x41e1('0x82'));}var _0x107c6e=[];try{_0x107c6e=_[_0x41e1('0x83')](JSON[_0x41e1('0x4b')](process[_0x41e1('0x79')][0x4]),'id');}catch(_0x18f6af){logger['info'](_0x41e1('0x84'));}main(_0x12fa9e,_0x5f1b64,_0x107c6e,_0xf15220);}validate();process['on'](_0x41e1('0x85'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index cc1cfcf..62ed57f 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe5b5=['Complete\x20Time','endtime','Duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','destcalleridnum','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','Called\x20Number','Member\x20Name','membername','UniqueId','uniqueid','starttime'];(function(_0x4a1017,_0x1c9d4a){var _0x479609=function(_0x479fc4){while(--_0x479fc4){_0x4a1017['push'](_0x4a1017['shift']());}};_0x479609(++_0x1c9d4a);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0xe5b5[_0x134192];return _0x3cd080;};'use strict';exports[_0x5e5b('0x0')]=function(_0x3e363f,_0x418c87){var _0x3b3efd=[{'type':_0x5e5b('0x1'),'content':_0x5e5b('0x2'),'variableName':null}];switch(_0x3e363f[_0x5e5b('0x3')]()){case _0x5e5b('0x4'):switch(_0x418c87[_0x5e5b('0x3')]()){case _0x5e5b('0x5'):_0x3b3efd[_0x5e5b('0x6')]({'type':_0x5e5b('0x7'),'content':'','variableName':_0x5e5b('0x8')});_0x3b3efd[_0x5e5b('0x6')]({'type':_0x5e5b('0x7'),'content':'','variableName':_0x5e5b('0x9')});break;case _0x5e5b('0xa'):_0x3b3efd[_0x5e5b('0x6')]({'type':_0x5e5b('0x1'),'content':_0x5e5b('0xb'),'variableName':null});_0x3b3efd[_0x5e5b('0x6')]({'type':_0x5e5b('0x7'),'content':'','variableName':_0x5e5b('0xc')});break;}}return _0x3b3efd;};exports['getDescriptions']=function(_0x300890,_0x59112d){var _0x108c34=[];switch(_0x300890[_0x5e5b('0x3')]()){case _0x5e5b('0x4'):switch(_0x59112d[_0x5e5b('0x3')]()){case'inbound':_0x108c34=[{'type':'string','content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0xe'),'keyType':_0x5e5b('0x7'),'variableName':_0x5e5b('0x9')},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0xf'),'keyType':_0x5e5b('0x7'),'variableName':'calleridname'},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0x10'),'keyType':'variable','variableName':_0x5e5b('0x11')},{'type':'keyValue','content':'','key':'Queue','keyType':_0x5e5b('0x7'),'variableName':_0x5e5b('0x8')},{'type':_0x5e5b('0xd'),'content':'','key':'UniqueId','keyType':_0x5e5b('0x7'),'variableName':'uniqueid'},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0x12'),'keyType':'variable','variableName':_0x5e5b('0x13')},{'type':_0x5e5b('0x1'),'content':_0x5e5b('0x14'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x5e5b('0x15'),'keyType':_0x5e5b('0x7'),'variableName':'destcalleridname'},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0x16'),'keyType':_0x5e5b('0x7'),'variableName':_0x5e5b('0xc')},{'type':_0x5e5b('0x1'),'content':_0x5e5b('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0x18'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0x19'),'keyType':_0x5e5b('0x7'),'variableName':_0x5e5b('0x1a')},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0x1b'),'keyType':_0x5e5b('0x7'),'variableName':_0x5e5b('0x1c')},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0x1d'),'keyType':_0x5e5b('0x7'),'variableName':'holdtime'},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0x1e'),'keyType':_0x5e5b('0x7'),'variableName':'talktime'}];break;case _0x5e5b('0xa'):_0x108c34=[{'type':_0x5e5b('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0x1f'),'keyType':_0x5e5b('0x7'),'keyContent':'','variableName':_0x5e5b('0xc')},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0x20'),'keyType':_0x5e5b('0x7'),'keyContent':'','variableName':_0x5e5b('0x21')},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0x22'),'keyType':_0x5e5b('0x7'),'keyContent':'','variableName':_0x5e5b('0x23')},{'type':'keyValue','content':'','key':'Date','keyType':_0x5e5b('0x7'),'keyContent':'','variableName':_0x5e5b('0x24')},{'type':_0x5e5b('0x1'),'content':_0x5e5b('0x17')},{'type':_0x5e5b('0xd'),'content':'','key':'Answer\x20Time','keyType':_0x5e5b('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0x25'),'keyType':_0x5e5b('0x7'),'keyContent':'','variableName':_0x5e5b('0x26')},{'type':'keyValue','content':'','key':_0x5e5b('0x27'),'keyType':_0x5e5b('0x7'),'keyContent':'','variableName':'duration'},{'type':_0x5e5b('0xd'),'content':'','key':_0x5e5b('0x28'),'keyType':_0x5e5b('0x7'),'keyContent':'','variableName':_0x5e5b('0x29')}];break;}}return _0x108c34;}; \ No newline at end of file +var _0x9c00=['***\x20Time\x20Info\x20***','agentcalledAt','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','starttime','Answer\x20Time','endtime','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','calleridnum','outbound','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','destexten','UniqueId','uniqueid','Date','Agent\x20Name','Agent\x20Number'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9c00,0x1a0));var _0x09c0=function(_0x21c130,_0x225833){_0x21c130=_0x21c130-0x0;var _0x58f574=_0x9c00[_0x21c130];return _0x58f574;};'use strict';exports[_0x09c0('0x0')]=function(_0x170d8b,_0x4dff21){var _0x5e32e7=[{'type':_0x09c0('0x1'),'content':_0x09c0('0x2'),'variableName':null}];switch(_0x170d8b['toLowerCase']()){case _0x09c0('0x3'):switch(_0x4dff21[_0x09c0('0x4')]()){case _0x09c0('0x5'):_0x5e32e7[_0x09c0('0x6')]({'type':_0x09c0('0x7'),'content':'','variableName':'queue'});_0x5e32e7['push']({'type':_0x09c0('0x7'),'content':'','variableName':_0x09c0('0x8')});break;case _0x09c0('0x9'):_0x5e32e7[_0x09c0('0x6')]({'type':_0x09c0('0x1'),'content':'Outbound\x20Call','variableName':null});_0x5e32e7[_0x09c0('0x6')]({'type':_0x09c0('0x7'),'content':'','variableName':_0x09c0('0xa')});break;}}return _0x5e32e7;};exports[_0x09c0('0xb')]=function(_0x27a33c,_0x1e16f4){var _0x1fec4f=[];switch(_0x27a33c[_0x09c0('0x4')]()){case _0x09c0('0x3'):switch(_0x1e16f4[_0x09c0('0x4')]()){case _0x09c0('0x5'):_0x1fec4f=[{'type':_0x09c0('0x1'),'content':_0x09c0('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0xe'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x8')},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0xf'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x10')},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x11'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x12')},{'type':_0x09c0('0xd'),'content':'','key':'Queue','keyType':'variable','variableName':'queue'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x13'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x14')},{'type':'keyValue','content':'','key':_0x09c0('0x15'),'keyType':'variable','variableName':'agentcalledAt'},{'type':_0x09c0('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x16'),'keyType':_0x09c0('0x7'),'variableName':'destcalleridname'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x17'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0xa')},{'type':_0x09c0('0x1'),'content':_0x09c0('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x09c0('0xd'),'content':'','key':'Agent\x20Ring','keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x19')},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x1a'),'keyType':'variable','variableName':'agentconnectAt'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x1b'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x1c')},{'type':'keyValue','content':'','key':_0x09c0('0x1d'),'keyType':_0x09c0('0x7'),'variableName':'holdtime'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x1e'),'keyType':_0x09c0('0x7'),'variableName':_0x09c0('0x1f')}];break;case _0x09c0('0x9'):_0x1fec4f=[{'type':_0x09c0('0x1'),'content':_0x09c0('0xc'),'variableName':null},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x20'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0xa')},{'type':'keyValue','content':'','key':_0x09c0('0x21'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x09c0('0xd'),'content':'','key':'UniqueId','keyType':_0x09c0('0x7'),'keyContent':'','variableName':'uniqueid'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x15'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0x22')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x23'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0x09c0('0xd'),'content':'','key':'Complete\x20Time','keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0x24')},{'type':_0x09c0('0xd'),'content':'','key':'Duration','keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0x25')},{'type':_0x09c0('0xd'),'content':'','key':_0x09c0('0x26'),'keyType':_0x09c0('0x7'),'keyContent':'','variableName':_0x09c0('0x27')}];break;}}return _0x1fec4f;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 623070e..76192c1 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb4f=['sms-interactions','chat-interactions','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','upperFirst','Interaction','findOne','then','info','tracked','query','body','omit','html','phone','fax','mobile','../../mysqldb','../../config/logger','mail-interactions'];(function(_0x279436,_0x4a69da){var _0x32d6ca=function(_0x4ccb62){while(--_0x4ccb62){_0x279436['push'](_0x279436['shift']());}};_0x32d6ca(++_0x4a69da);}(_0xfb4f,0x135));var _0xffb4=function(_0x4b5f55,_0x37198c){_0x4b5f55=_0x4b5f55-0x0;var _0x2326bd=_0xfb4f[_0x4b5f55];return _0x2326bd;};'use strict';var _=require('lodash');var db=require(_0xffb4('0x0'))['db'];var loggers={'openchannel':require(_0xffb4('0x1'))('openchannel-interactions'),'mail':require(_0xffb4('0x1'))(_0xffb4('0x2')),'fax':require(_0xffb4('0x1'))('fax-interactions'),'sms':require(_0xffb4('0x1'))(_0xffb4('0x3')),'chat':require(_0xffb4('0x1'))(_0xffb4('0x4'))};function getInteractionId(_0x4031ad,_0x2b1bbf,_0x5b4975){if(_0x4031ad&&_0x4031ad[_['upperFirst'](_0x5b4975)+_0xffb4('0x5')]){return _0x4031ad[_['upperFirst'](_0x5b4975)+_0xffb4('0x5')];}else if(_0x4031ad&&_0x4031ad['id']){return _0x4031ad['id'];}else if(_0x2b1bbf&&_0x2b1bbf['id']){return _0x2b1bbf['id'];}else{return _0xffb4('0x6');}}function log(_0x2fe18d,_0x31ef6f,_0x2bc82c,_0x3ca00d,_0x414047,_0x45421d){loggers[_0x414047[_0xffb4('0x7')]()][_0x2fe18d](_0xffb4('0x8'),_0x45421d[_0xffb4('0x9')](),_0x31ef6f?_0x31ef6f['id']:null,_0x31ef6f?_0x31ef6f[_0xffb4('0xa')]:null,_0x31ef6f?_0x31ef6f[_0xffb4('0xb')]:null,getInteractionId(_0x2bc82c,_0x3ca00d,_0x414047),_0x2bc82c?JSON['stringify'](_0x2bc82c):_0xffb4('0xc'));}function updateUser(_0x1f3619,_0xb3abe5,_0x1acb3d,_0x28eec4,_0x16549d){db[_[_0xffb4('0xd')](_0x28eec4)+_0xffb4('0xe')][_0xffb4('0xf')]({'where':{'id':getInteractionId(_0xb3abe5,_0x1acb3d,_0x28eec4)}})[_0xffb4('0x10')](function(_0x1e1654){if(_0x1e1654){return _0x1e1654['update']({'UserId':_0x1f3619?_0x1f3619['id']:null});}})['then'](function(_0x5c5285){if(_0x5c5285){log(_0xffb4('0x11'),_0x1f3619,_0xb3abe5,_0x1acb3d,_0x28eec4,_0x16549d);}})['catch'](function(){log('error',_0x1f3619,_0xb3abe5,_0x1acb3d,_0x28eec4,_0x16549d);});}exports[_0xffb4('0x12')]=function(_0x7be524,_0x198b05){return function(_0xcfea9c,_0x5519cd,_0x1cc6c9){var _0x35c1d6=_0xcfea9c['user'];var _0x237d55={};var _0xcac1ff=_0xcfea9c[_0xffb4('0x13')];if(_0x237d55){_0x237d55=_['clone'](_0xcfea9c[_0xffb4('0x14')]);_0x237d55=_[_0xffb4('0x15')](_0x237d55,[_0xffb4('0x14'),_0xffb4('0x16'),_0xffb4('0x17'),_0xffb4('0x18'),_0xffb4('0x19')]);}updateUser(_0x35c1d6,_0x237d55,_0xcac1ff,_0x7be524,_0x198b05);_0x1cc6c9(null);};}; \ No newline at end of file +var _0xd129=['info','catch','tracked','user','query','omit','phone','lodash','../../mysqldb','../../config/logger','openchannel-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','null','findOne','then','update'];(function(_0x1112e7,_0x576cf6){var _0x5c0a21=function(_0xd98d3c){while(--_0xd98d3c){_0x1112e7['push'](_0x1112e7['shift']());}};_0x5c0a21(++_0x576cf6);}(_0xd129,0xb7));var _0x9d12=function(_0x54e283,_0x1dcb57){_0x54e283=_0x54e283-0x0;var _0x951e8c=_0xd129[_0x54e283];return _0x951e8c;};'use strict';var _=require(_0x9d12('0x0'));var db=require(_0x9d12('0x1'))['db'];var loggers={'openchannel':require(_0x9d12('0x2'))(_0x9d12('0x3')),'mail':require(_0x9d12('0x2'))('mail-interactions'),'fax':require(_0x9d12('0x2'))('fax-interactions'),'sms':require(_0x9d12('0x2'))('sms-interactions'),'chat':require(_0x9d12('0x2'))('chat-interactions')};function getInteractionId(_0x506427,_0x4f3089,_0x158ad3){if(_0x506427&&_0x506427[_[_0x9d12('0x4')](_0x158ad3)+'InteractionId']){return _0x506427[_['upperFirst'](_0x158ad3)+_0x9d12('0x5')];}else if(_0x506427&&_0x506427['id']){return _0x506427['id'];}else if(_0x4f3089&&_0x4f3089['id']){return _0x4f3089['id'];}else{return _0x9d12('0x6');}}function log(_0x45ec52,_0x18b496,_0x2321a7,_0x205b5f,_0x59ea5f,_0x461925){loggers[_0x59ea5f[_0x9d12('0x7')]()][_0x45ec52](_0x9d12('0x8'),_0x461925[_0x9d12('0x9')](),_0x18b496?_0x18b496['id']:null,_0x18b496?_0x18b496['name']:null,_0x18b496?_0x18b496[_0x9d12('0xa')]:null,getInteractionId(_0x2321a7,_0x205b5f,_0x59ea5f),_0x2321a7?JSON['stringify'](_0x2321a7):_0x9d12('0xb'));}function updateUser(_0x1aad19,_0x3eb452,_0x840af5,_0x4ec160,_0x48f91c){db[_[_0x9d12('0x4')](_0x4ec160)+'Interaction'][_0x9d12('0xc')]({'where':{'id':getInteractionId(_0x3eb452,_0x840af5,_0x4ec160)}})[_0x9d12('0xd')](function(_0x51d374){if(_0x51d374){return _0x51d374[_0x9d12('0xe')]({'UserId':_0x1aad19?_0x1aad19['id']:null});}})[_0x9d12('0xd')](function(_0x3f179c){if(_0x3f179c){log(_0x9d12('0xf'),_0x1aad19,_0x3eb452,_0x840af5,_0x4ec160,_0x48f91c);}})[_0x9d12('0x10')](function(){log('error',_0x1aad19,_0x3eb452,_0x840af5,_0x4ec160,_0x48f91c);});}exports[_0x9d12('0x11')]=function(_0x26a0ce,_0x52b4dd){return function(_0x314cc5,_0x437b2e,_0x282fea){var _0x4419d6=_0x314cc5[_0x9d12('0x12')];var _0x2f0f0a={};var _0x512f44=_0x314cc5[_0x9d12('0x13')];if(_0x2f0f0a){_0x2f0f0a=_['clone'](_0x314cc5['body']);_0x2f0f0a=_[_0x9d12('0x14')](_0x2f0f0a,['body','html',_0x9d12('0x15'),'fax','mobile']);}updateUser(_0x4419d6,_0x2f0f0a,_0x512f44,_0x26a0ce,_0x52b4dd);_0x282fea(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 3d8e982..e27a7af 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x622a=['then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','update','utf8','final','parse','hasOwnProperty','use','License','findOne'];(function(_0x99d0df,_0x1b52d7){var _0x19fab4=function(_0x5b1165){while(--_0x5b1165){_0x99d0df['push'](_0x99d0df['shift']());}};_0x19fab4(++_0x1b52d7);}(_0x622a,0x1aa));var _0xa622=function(_0x179fdf,_0x53b69d){_0x179fdf=_0x179fdf-0x0;var _0x13777c=_0x622a[_0x179fdf];return _0x13777c;};'use strict';var crypto=require(_0xa622('0x0'));var util=require('util');var compose=require('composable-middleware');var db=require(_0xa622('0x1'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x4733b5,_0xe293){if(_0x4733b5&&_0xe293){if(_0xe293[_0xa622('0x2')]&&_0xe293['license']){var _0x350246=_0xe293[_0xa622('0x2')];var _0x506e90=_0xe293[_0xa622('0x3')];var _0x278db9=_0x350246[_0xa622('0x4')]('-')[0x4];var _0x98edc6=_0x350246[_0xa622('0x4')]('-')[0x0];var _0x1157e9=crypto[_0xa622('0x5')](_0xa622('0x6'),util[_0xa622('0x7')]('%s:%s:%s',_0x278db9,_0x350246,_0x98edc6));var _0x3cb849=_0x1157e9[_0xa622('0x8')](_0x506e90,'base64',_0xa622('0x9'));_0x3cb849+=_0x1157e9[_0xa622('0xa')](_0xa622('0x9'));var _0x5f49ca=JSON[_0xa622('0xb')](_0x3cb849);return _0x5f49ca[_0xa622('0xc')](_0x4733b5)?_0x5f49ca[_0x4733b5]:null;}}return null;}function isLimit(_0x675f27,_0x12de39,_0xcc2372,_0x43b472){var _0x2de090=_0x12de39;return compose()[_0xa622('0xd')](function(_0x3e8300,_0x4a05b2,_0x3d28bd){return db[_0xa622('0xe')][_0xa622('0xf')]({'where':{'id':0x1},'raw':!![]})[_0xa622('0x10')](function(_0x3f789d){var _0x37bcdf=getValueFromLicense(_0x675f27,_0x3f789d);return _0x37bcdf?_0x37bcdf:_0x2de090;})[_0xa622('0x10')](function(_0x200ec1){_0x2de090=_0x200ec1;return _0xcc2372[_0xa622('0x11')](_0x43b472);})[_0xa622('0x10')](function(_0x3d6d16){if(_0x3d6d16>=_0x2de090){return _0x4a05b2['status'](0x193)[_0xa622('0x12')]({'message':util[_0xa622('0x7')](_0xa622('0x13'),_0x675f27)});}_0x3d28bd();})[_0xa622('0x14')](function(_0x3ad595){_0x3d28bd(_0x3ad595);});});}function isUserLimit(){return isLimit(_0xa622('0x15'),0x1,db[_0xa622('0x16')],{'where':{'$or':[{'role':_0xa622('0x17')},{'role':_0xa622('0x18')}]}});}exports[_0xa622('0x19')]=isUserLimit; \ No newline at end of file +var _0x84a0=['split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','License','findOne','count','then','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','crypto','composable-middleware','../../mysqldb','../../config/environment','license'];(function(_0x352c53,_0x21dfd3){var _0x3004a1=function(_0x1ecab7){while(--_0x1ecab7){_0x352c53['push'](_0x352c53['shift']());}};_0x3004a1(++_0x21dfd3);}(_0x84a0,0x8b));var _0x084a=function(_0x4b8515,_0x4225a7){_0x4b8515=_0x4b8515-0x0;var _0x33f4f3=_0x84a0[_0x4b8515];return _0x33f4f3;};'use strict';var crypto=require(_0x084a('0x0'));var util=require('util');var compose=require(_0x084a('0x1'));var db=require(_0x084a('0x2'))['db'];var config=require(_0x084a('0x3'));function getValueFromLicense(_0x18a3f2,_0x2bfa22){if(_0x18a3f2&&_0x2bfa22){if(_0x2bfa22['data1']&&_0x2bfa22[_0x084a('0x4')]){var _0x2b5e32=_0x2bfa22['data1'];var _0x1553a7=_0x2bfa22[_0x084a('0x4')];var _0x2f22eb=_0x2b5e32[_0x084a('0x5')]('-')[0x4];var _0x2ab85f=_0x2b5e32[_0x084a('0x5')]('-')[0x0];var _0x36a0ba=crypto[_0x084a('0x6')](_0x084a('0x7'),util[_0x084a('0x8')](_0x084a('0x9'),_0x2f22eb,_0x2b5e32,_0x2ab85f));var _0x3f2e7f=_0x36a0ba[_0x084a('0xa')](_0x1553a7,_0x084a('0xb'),_0x084a('0xc'));_0x3f2e7f+=_0x36a0ba[_0x084a('0xd')](_0x084a('0xc'));var _0x1ca87c=JSON[_0x084a('0xe')](_0x3f2e7f);return _0x1ca87c['hasOwnProperty'](_0x18a3f2)?_0x1ca87c[_0x18a3f2]:null;}}return null;}function isLimit(_0x534a34,_0x122971,_0x194b0d,_0x126c22){var _0x1e8322=_0x122971;return compose()['use'](function(_0x121516,_0x5d0000,_0x352f02){return db[_0x084a('0xf')][_0x084a('0x10')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1bbedc){var _0x13825d=getValueFromLicense(_0x534a34,_0x1bbedc);return _0x13825d?_0x13825d:_0x1e8322;})['then'](function(_0x585263){_0x1e8322=_0x585263;return _0x194b0d[_0x084a('0x11')](_0x126c22);})[_0x084a('0x12')](function(_0x28f674){if(_0x28f674>=_0x1e8322){return _0x5d0000['status'](0x193)['json']({'message':util[_0x084a('0x8')](_0x084a('0x13'),_0x534a34)});}_0x352f02();})[_0x084a('0x14')](function(_0x99d817){_0x352f02(_0x99d817);});});}function isUserLimit(){return isLimit(_0x084a('0x15'),0x1,db[_0x084a('0x16')],{'where':{'$or':[{'role':'admin'},{'role':_0x084a('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index ab6d271..bd6018e 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 _0xfe2c=['add','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','shift','map','push','DATE','operator','$eq','$between','value','includes','$gt','$lte','days','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','NOT\x20IN\x20?','<>\x20?','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','$substring','start','pop','utcOffset','format'];(function(_0x2c5c49,_0x8640df){var _0x3b047d=function(_0x4119d7){while(--_0x4119d7){_0x2c5c49['push'](_0x2c5c49['shift']());}};_0x3b047d(++_0x8640df);}(_0xfe2c,0x6c));var _0xcfe2=function(_0xaf5e1e,_0x292663){_0xaf5e1e=_0xaf5e1e-0x0;var _0x4fc45c=_0xfe2c[_0xaf5e1e];return _0x4fc45c;};'use strict';var _=require(_0xcfe2('0x0'));var moment=require(_0xcfe2('0x1'));exports['parseSearch']=function(_0x452f8){var _0x38110c={'conditions':[]};_0x38110c[_0xcfe2('0x2')]=_[_0xcfe2('0x3')](_0x452f8,_0xcfe2('0x4'))?'or':_0xcfe2('0x5');var _0x283e70=_0x452f8[_0xcfe2('0x6')](_0xcfe2('0x7'),'')['replace'](_0xcfe2('0x4'),'')[_0xcfe2('0x8')]('||');for(var _0x341cd2=0x0;_0x341cd2<_0x283e70[_0xcfe2('0x9')];_0x341cd2++){var _0x6bbbd1=_0x283e70[_0x341cd2][_0xcfe2('0x8')](':=');var _0x1edc93=_0x6bbbd1[0x0];var _0x3b17c6=_0x6bbbd1[_0xcfe2('0xa')](0x1);_0x3b17c6['forEach'](function(_0x3b3427){var _0x8041f7=_0x3b3427['split']('[')[_0xcfe2('0xb')]();var _0xe71bbc=_0x3b3427['match'](/\[(.*?)\]/g);_0xe71bbc['forEach'](function(_0xa2f0fb){var _0x307297=_0xa2f0fb[_0xcfe2('0x8')]('[')['filter'](function(_0x5629ff){return _0x5629ff['indexOf'](']')>-0x1;})[_0xcfe2('0xc')](function(_0x2cb5a6){return _0x2cb5a6[_0xcfe2('0x8')](']')[0x0];})[0x0];_0x38110c['conditions'][_0xcfe2('0xd')]({'field':_0x1edc93,'operator':_0x8041f7,'value':_0x307297});});});}return _0x38110c;};exports['buildExpression']=function(_0x4b0421,_0x369994,_0x4d9ada){var _0x5c0f1e={};if(_0x369994===_0xcfe2('0xe')){if(_0x4d9ada[_0xcfe2('0xf')]===_0xcfe2('0x10')){_0x4d9ada[_0xcfe2('0xf')]=_0xcfe2('0x11');_0x4d9ada['value']+=','+_0x4d9ada[_0xcfe2('0x12')];}else if(_[_0xcfe2('0x13')]([_0xcfe2('0x14'),_0xcfe2('0x15')],_0x4d9ada[_0xcfe2('0xf')])){_0x4d9ada['value']=moment(_0x4d9ada[_0xcfe2('0x12')])['add'](0x1,_0xcfe2('0x16'))['format']('YYYY-MM-DD');}}if(_0x4d9ada[_0xcfe2('0x17')]){_0x369994=_0x4d9ada[_0xcfe2('0x17')];_0x5c0f1e[_0xcfe2('0x18')]=_0xcfe2('0x19')+_0x4b0421+'.'+_0x4d9ada[_0xcfe2('0x1a')]+_0xcfe2('0x1b')+_0x4d9ada[_0xcfe2('0x17')]+')\x20'+parseOperator(_0x4d9ada[_0xcfe2('0xf')]);}else{_0x5c0f1e[_0xcfe2('0x18')]=_0x4b0421+'.'+_0x4d9ada[_0xcfe2('0x1a')]+'\x20'+parseOperator(_0x4d9ada[_0xcfe2('0xf')]);}if(_[_0xcfe2('0x13')]([_0xcfe2('0x1c'),_0xcfe2('0x1d')],_0x4d9ada['operator']))_0x5c0f1e[_0xcfe2('0x18')]='('+_0x5c0f1e['text']+_0xcfe2('0x1e')+_0x4b0421+'.'+_0x4d9ada['field']+_0xcfe2('0x1f');_0x5c0f1e['value']=parseValue(_0x369994,_0x4d9ada['operator'],_0x4d9ada[_0xcfe2('0x12')]);return _0x5c0f1e;};function parseOperator(_0x21a6e1){var _0x1b4801;switch(_0x21a6e1){case'$in':_0x1b4801='IN\x20?';break;case _0xcfe2('0x1d'):_0x1b4801=_0xcfe2('0x20');break;case _0xcfe2('0x10'):_0x1b4801='=\x20?';break;case _0xcfe2('0x1c'):_0x1b4801=_0xcfe2('0x21');break;case'$substring':case'$startsWith':case _0xcfe2('0x22'):_0x1b4801='LIKE\x20?';break;case _0xcfe2('0x23'):_0x1b4801=_0xcfe2('0x24');break;case _0xcfe2('0x14'):_0x1b4801=_0xcfe2('0x25');break;case _0xcfe2('0x15'):_0x1b4801=_0xcfe2('0x26');break;case _0xcfe2('0x27'):_0x1b4801=_0xcfe2('0x28');break;case _0xcfe2('0x11'):_0x1b4801=_0xcfe2('0x29');break;}return _0x1b4801;}function parseValue(_0x37a140,_0x6c9c85,_0xd40d62){var _0x576a1b={'start':undefined,'end':undefined};switch(_0x6c9c85){case _0xcfe2('0x2a'):case _0xcfe2('0x1d'):_0x576a1b['start']=_0xd40d62['split'](',');break;case _0xcfe2('0x2b'):_0x576a1b[_0xcfe2('0x2c')]='%'+_0xd40d62+'%';break;case'$startsWith':_0x576a1b['start']=_0xd40d62+'%';break;case _0xcfe2('0x22'):_0x576a1b[_0xcfe2('0x2c')]='%'+_0xd40d62;break;case _0xcfe2('0x11'):var _0x5d9c55=_0xd40d62[_0xcfe2('0x8')](',');var _0xd40d62=_0x5d9c55[_0xcfe2('0xb')]();var _0x8311d6=_0x5d9c55[_0xcfe2('0x2d')]();if(_0x37a140==='DATE'){_0xd40d62=moment(_0xd40d62)[_0xcfe2('0x2e')](0x0,!![])[_0xcfe2('0x2f')]();_0x8311d6=moment(_0x8311d6)[_0xcfe2('0x2e')](0x0,!![])[_0xcfe2('0x30')](0x17,_0xcfe2('0x31'))[_0xcfe2('0x30')](0x3b,_0xcfe2('0x32'))[_0xcfe2('0x30')](0x3b,_0xcfe2('0x33'))[_0xcfe2('0x2f')]();}_0x576a1b={'start':_0xd40d62,'end':_0x8311d6};break;default:_0x576a1b[_0xcfe2('0x2c')]=_0xd40d62;break;}return _0x576a1b;} \ No newline at end of file +var _0x8080=['replace','split','length','slice','shift','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','$lte','days','format','castTo','text','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','$in','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','utcOffset','add','hours','seconds','lodash','parseSearch','sqlOperator','[$or]','and','[$and]'];(function(_0x4461b4,_0x598aec){var _0x5be997=function(_0x3907d6){while(--_0x3907d6){_0x4461b4['push'](_0x4461b4['shift']());}};_0x5be997(++_0x598aec);}(_0x8080,0x138));var _0x0808=function(_0x111d8b,_0x3f356f){_0x111d8b=_0x111d8b-0x0;var _0x56656c=_0x8080[_0x111d8b];return _0x56656c;};'use strict';var _=require(_0x0808('0x0'));var moment=require('moment');exports[_0x0808('0x1')]=function(_0x27ece5){var _0x1863ae={'conditions':[]};_0x1863ae[_0x0808('0x2')]=_['startsWith'](_0x27ece5,_0x0808('0x3'))?'or':_0x0808('0x4');var _0x3eeb14=_0x27ece5['replace'](_0x0808('0x5'),'')[_0x0808('0x6')](_0x0808('0x3'),'')[_0x0808('0x7')]('||');for(var _0x5bbf90=0x0;_0x5bbf90<_0x3eeb14[_0x0808('0x8')];_0x5bbf90++){var _0x9f54df=_0x3eeb14[_0x5bbf90]['split'](':=');var _0x11f2ce=_0x9f54df[0x0];var _0x3f9e9e=_0x9f54df[_0x0808('0x9')](0x1);_0x3f9e9e['forEach'](function(_0x438660){var _0x19a061=_0x438660[_0x0808('0x7')]('[')[_0x0808('0xa')]();var _0x28fafe=_0x438660[_0x0808('0xb')](/\[(.*?)\]/g);_0x28fafe[_0x0808('0xc')](function(_0x25b4d5){var _0x4712bc=_0x25b4d5[_0x0808('0x7')]('[')[_0x0808('0xd')](function(_0x286bf3){return _0x286bf3[_0x0808('0xe')](']')>-0x1;})[_0x0808('0xf')](function(_0x233a06){return _0x233a06['split'](']')[0x0];})[0x0];_0x1863ae[_0x0808('0x10')][_0x0808('0x11')]({'field':_0x11f2ce,'operator':_0x19a061,'value':_0x4712bc});});});}return _0x1863ae;};exports[_0x0808('0x12')]=function(_0x1a1b6f,_0xa70fbc,_0x1218e6){var _0x53e034={};if(_0xa70fbc===_0x0808('0x13')){if(_0x1218e6[_0x0808('0x14')]==='$eq'){_0x1218e6[_0x0808('0x14')]=_0x0808('0x15');_0x1218e6[_0x0808('0x16')]+=','+_0x1218e6['value'];}else if(_['includes'](['$gt',_0x0808('0x17')],_0x1218e6[_0x0808('0x14')])){_0x1218e6[_0x0808('0x16')]=moment(_0x1218e6[_0x0808('0x16')])['add'](0x1,_0x0808('0x18'))[_0x0808('0x19')]('YYYY-MM-DD');}}if(_0x1218e6[_0x0808('0x1a')]){_0xa70fbc=_0x1218e6[_0x0808('0x1a')];_0x53e034[_0x0808('0x1b')]='CAST('+_0x1a1b6f+'.'+_0x1218e6[_0x0808('0x1c')]+_0x0808('0x1d')+_0x1218e6[_0x0808('0x1a')]+')\x20'+parseOperator(_0x1218e6[_0x0808('0x14')]);}else{_0x53e034[_0x0808('0x1b')]=_0x1a1b6f+'.'+_0x1218e6[_0x0808('0x1c')]+'\x20'+parseOperator(_0x1218e6['operator']);}if(_[_0x0808('0x1e')]([_0x0808('0x1f'),_0x0808('0x20')],_0x1218e6[_0x0808('0x14')]))_0x53e034[_0x0808('0x1b')]='('+_0x53e034[_0x0808('0x1b')]+_0x0808('0x21')+_0x1a1b6f+'.'+_0x1218e6[_0x0808('0x1c')]+'\x20IS\x20NULL)';_0x53e034['value']=parseValue(_0xa70fbc,_0x1218e6[_0x0808('0x14')],_0x1218e6[_0x0808('0x16')]);return _0x53e034;};function parseOperator(_0x348461){var _0x1e054e;switch(_0x348461){case _0x0808('0x22'):_0x1e054e='IN\x20?';break;case _0x0808('0x20'):_0x1e054e=_0x0808('0x23');break;case _0x0808('0x24'):_0x1e054e=_0x0808('0x25');break;case _0x0808('0x1f'):_0x1e054e=_0x0808('0x26');break;case _0x0808('0x27'):case _0x0808('0x28'):case _0x0808('0x29'):_0x1e054e=_0x0808('0x2a');break;case'$lt':_0x1e054e=_0x0808('0x2b');break;case'$gt':_0x1e054e=_0x0808('0x2c');break;case _0x0808('0x17'):_0x1e054e='<=\x20?';break;case _0x0808('0x2d'):_0x1e054e=_0x0808('0x2e');break;case _0x0808('0x15'):_0x1e054e=_0x0808('0x2f');break;}return _0x1e054e;}function parseValue(_0x53d363,_0x4b73de,_0x5b190f){var _0x2f9bd3={'start':undefined,'end':undefined};switch(_0x4b73de){case _0x0808('0x22'):case _0x0808('0x20'):_0x2f9bd3[_0x0808('0x30')]=_0x5b190f[_0x0808('0x7')](',');break;case _0x0808('0x27'):_0x2f9bd3[_0x0808('0x30')]='%'+_0x5b190f+'%';break;case _0x0808('0x28'):_0x2f9bd3['start']=_0x5b190f+'%';break;case _0x0808('0x29'):_0x2f9bd3[_0x0808('0x30')]='%'+_0x5b190f;break;case _0x0808('0x15'):var _0x278b8b=_0x5b190f[_0x0808('0x7')](',');var _0x5b190f=_0x278b8b[_0x0808('0xa')]();var _0x3bfd2e=_0x278b8b['pop']();if(_0x53d363===_0x0808('0x13')){_0x5b190f=moment(_0x5b190f)[_0x0808('0x31')](0x0,!![])['format']();_0x3bfd2e=moment(_0x3bfd2e)[_0x0808('0x31')](0x0,!![])[_0x0808('0x32')](0x17,_0x0808('0x33'))['add'](0x3b,'minutes')[_0x0808('0x32')](0x3b,_0x0808('0x34'))[_0x0808('0x19')]();}_0x2f9bd3={'start':_0x5b190f,'end':_0x3bfd2e};break;default:_0x2f9bd3[_0x0808('0x30')]=_0x5b190f;break;}return _0x2f9bd3;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c1be884..02fe045 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 _0x6c5d=['offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','hasOwnProperty','isNumeric','isEmail','getFullTextValue','forEach','push','toString','join','lodash','sequelize','split','filters','isEmpty','forOwn','isArray','parse','limit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6c5d,0x77));var _0xd6c5=function(_0x25ff42,_0x1dd28a){_0x25ff42=_0x25ff42-0x0;var _0x2b9f64=_0x6c5d[_0x25ff42];return _0x2b9f64;};'use strict';var _=require(_0xd6c5('0x0'));var sequelize=require(_0xd6c5('0x1'));var LIMIT_VALUE=0xfa;exports['fields']=function(_0x2943c1){var _0x53785d=null;if(_0x2943c1){_0x53785d=_0x2943c1[_0xd6c5('0x2')](',');}return _0x53785d;};exports[_0xd6c5('0x3')]=function(_0x5ae8a6){var _0x5b344b={};if(!_[_0xd6c5('0x4')](_0x5ae8a6)){_0x5b344b={};_[_0xd6c5('0x5')](_0x5ae8a6,function(_0x237ca6,_0x147557){try{_0x5b344b[_0x147557]=_[_0xd6c5('0x6')](_0x237ca6)?_0x237ca6:JSON[_0xd6c5('0x7')](_0x237ca6);}catch(_0x20c142){_0x5b344b[_0x147557]=_0x237ca6['split'](',');}});}return _0x5b344b;};exports[_0xd6c5('0x8')]=function(_0x41f3e){_0x41f3e=parseInt(_0x41f3e,0xa);if(!_0x41f3e||_0x41f3e<0x0){_0x41f3e=LIMIT_VALUE;}return _0x41f3e;};exports[_0xd6c5('0x9')]=function(_0x2e08d1){_0x2e08d1=parseInt(_0x2e08d1,0xa);if(!_0x2e08d1||_0x2e08d1<0x0){_0x2e08d1=0x0;}return _0x2e08d1;};exports[_0xd6c5('0xa')]=function(_0x2a9fcc){var _0x32134a,_0x42f425=null;if(_0x2a9fcc){_0x32134a=_0x2a9fcc[_0xd6c5('0x2')](',');_0x42f425=_[_0xd6c5('0xb')](_0x32134a,function(_0x153c2f){if(_0x153c2f[_0xd6c5('0xc')]('-')===0x0){return[_0x153c2f===_0xd6c5('0xd')?sequelize[_0xd6c5('0xe')](sequelize[_0xd6c5('0xf')](_0xd6c5('0xd')),_0xd6c5('0x10')):_0x153c2f[_0xd6c5('0x11')](0x1),_0xd6c5('0x12')];}else{return[_0x153c2f===_0xd6c5('0xd')?sequelize[_0xd6c5('0xe')](sequelize[_0xd6c5('0xf')](_0xd6c5('0xd')),_0xd6c5('0x10')):_0x153c2f,_0xd6c5('0x13')];}});}return _0x42f425;};exports[_0xd6c5('0x14')]=function(_0x609c59,_0x153e52){if(_[_0xd6c5('0x4')](_0x609c59)){return _0x609c59;}if(_[_0xd6c5('0x6')](_0x609c59)){for(var _0x42ac2d=0x0;_0x42ac2d<_0x609c59[_0xd6c5('0x15')];_0x42ac2d+=0x1){_0x609c59[_0x42ac2d]=this['omit'](_0x609c59[_0x42ac2d],_0x153e52);}return _0x609c59;}if(!_[_0xd6c5('0x16')](_0x609c59)){return _0x609c59;}if(_[_0xd6c5('0x17')](_0x153e52)){_0x153e52=[_0x153e52];}if(!_[_0xd6c5('0x6')](_0x153e52)){return _0x609c59;}for(var _0x2237d3=0x0;_0x2237d3<_0x153e52[_0xd6c5('0x15')];_0x2237d3+=0x1){_['unset'](_0x609c59,_0x153e52[_0x2237d3]);}for(var _0x23b50a in _0x609c59){if(_0x609c59[_0xd6c5('0x18')](_0x23b50a)){_0x609c59[_0x23b50a]=this[_0xd6c5('0x14')](_0x609c59[_0x23b50a],_0x153e52);}}return _0x609c59;};exports[_0xd6c5('0x19')]=function(_0x78f336){return _0x78f336['match'](RegExp('^[0-9]*$'))?!![]:![];};exports[_0xd6c5('0x1a')]=function(_0x175f9f){return _0x175f9f['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xd6c5('0x1b')]=function(_0x38dec6){var _0x21bc81=[];_0x38dec6['split']('\x20')[_0xd6c5('0x1c')](function(_0x4e9945){_0x21bc81[_0xd6c5('0x1d')]('+'+_0x4e9945[_0xd6c5('0x1e')]()+'*');});return _0x21bc81[_0xd6c5('0x1f')]('\x20');}; \ No newline at end of file +var _0x2e77=['^[0-9]*$','isEmail','getFullTextValue','forEach','push','join','lodash','sequelize','fields','filters','forOwn','isArray','parse','split','limit','sort','map','priority','cast','col','substr','unsigned','ASC','omit','isEmpty','unset','isNumeric'];(function(_0x247fd8,_0x16d85b){var _0x13c498=function(_0x50f3f1){while(--_0x50f3f1){_0x247fd8['push'](_0x247fd8['shift']());}};_0x13c498(++_0x16d85b);}(_0x2e77,0x12f));var _0x72e7=function(_0x3c5ed0,_0x1309c4){_0x3c5ed0=_0x3c5ed0-0x0;var _0xdb47e8=_0x2e77[_0x3c5ed0];return _0xdb47e8;};'use strict';var _=require(_0x72e7('0x0'));var sequelize=require(_0x72e7('0x1'));var LIMIT_VALUE=0xfa;exports[_0x72e7('0x2')]=function(_0x3078e0){var _0x35878e=null;if(_0x3078e0){_0x35878e=_0x3078e0['split'](',');}return _0x35878e;};exports[_0x72e7('0x3')]=function(_0x1c1eac){var _0x2439cf={};if(!_['isEmpty'](_0x1c1eac)){_0x2439cf={};_[_0x72e7('0x4')](_0x1c1eac,function(_0x51ec6b,_0x47c2e6){try{_0x2439cf[_0x47c2e6]=_[_0x72e7('0x5')](_0x51ec6b)?_0x51ec6b:JSON[_0x72e7('0x6')](_0x51ec6b);}catch(_0x1f8590){_0x2439cf[_0x47c2e6]=_0x51ec6b[_0x72e7('0x7')](',');}});}return _0x2439cf;};exports[_0x72e7('0x8')]=function(_0x3ac791){_0x3ac791=parseInt(_0x3ac791,0xa);if(!_0x3ac791||_0x3ac791<0x0){_0x3ac791=LIMIT_VALUE;}return _0x3ac791;};exports['offset']=function(_0x51e0fa){_0x51e0fa=parseInt(_0x51e0fa,0xa);if(!_0x51e0fa||_0x51e0fa<0x0){_0x51e0fa=0x0;}return _0x51e0fa;};exports[_0x72e7('0x9')]=function(_0x3729f2){var _0x16ed08,_0x2d83d3=null;if(_0x3729f2){_0x16ed08=_0x3729f2[_0x72e7('0x7')](',');_0x2d83d3=_[_0x72e7('0xa')](_0x16ed08,function(_0x429a53){if(_0x429a53['indexOf']('-')===0x0){return[_0x429a53===_0x72e7('0xb')?sequelize[_0x72e7('0xc')](sequelize[_0x72e7('0xd')](_0x72e7('0xb')),'unsigned'):_0x429a53[_0x72e7('0xe')](0x1),'DESC'];}else{return[_0x429a53==='priority'?sequelize['cast'](sequelize[_0x72e7('0xd')]('priority'),_0x72e7('0xf')):_0x429a53,_0x72e7('0x10')];}});}return _0x2d83d3;};exports[_0x72e7('0x11')]=function(_0x52dc57,_0x182bc4){if(_[_0x72e7('0x12')](_0x52dc57)){return _0x52dc57;}if(_[_0x72e7('0x5')](_0x52dc57)){for(var _0x5b1b50=0x0;_0x5b1b50<_0x52dc57['length'];_0x5b1b50+=0x1){_0x52dc57[_0x5b1b50]=this[_0x72e7('0x11')](_0x52dc57[_0x5b1b50],_0x182bc4);}return _0x52dc57;}if(!_['isObject'](_0x52dc57)){return _0x52dc57;}if(_['isString'](_0x182bc4)){_0x182bc4=[_0x182bc4];}if(!_[_0x72e7('0x5')](_0x182bc4)){return _0x52dc57;}for(var _0xcc1448=0x0;_0xcc1448<_0x182bc4['length'];_0xcc1448+=0x1){_[_0x72e7('0x13')](_0x52dc57,_0x182bc4[_0xcc1448]);}for(var _0x564873 in _0x52dc57){if(_0x52dc57['hasOwnProperty'](_0x564873)){_0x52dc57[_0x564873]=this[_0x72e7('0x11')](_0x52dc57[_0x564873],_0x182bc4);}}return _0x52dc57;};exports[_0x72e7('0x14')]=function(_0x14e56c){return _0x14e56c['match'](RegExp(_0x72e7('0x15')))?!![]:![];};exports[_0x72e7('0x16')]=function(_0x4b5798){return _0x4b5798['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x72e7('0x17')]=function(_0x185b46){var _0xaee07a=[];_0x185b46['split']('\x20')[_0x72e7('0x18')](function(_0x76d251){_0xaee07a[_0x72e7('0x19')]('+'+_0x76d251['toString']()+'*');});return _0xaee07a[_0x72e7('0x1a')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 7058b4b..6bce038 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf99e=['body-parser','method-override','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','set','appPath','join','public','test','root','use','json\x20replacer','toISOString','split','views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','express','serve-favicon'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0xf99e,0x130));var _0xef99=function(_0x559a80,_0x3d193d){_0x559a80=_0x559a80-0x0;var _0x42f555=_0xf99e[_0x559a80];return _0x42f555;};'use strict';var express=require(_0xef99('0x0'));var favicon=require(_0xef99('0x1'));var bodyParser=require(_0xef99('0x2'));var methodOverride=require(_0xef99('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xef99('0x4'));var path=require(_0xef99('0x5'));var passport=require(_0xef99('0x6'));var cors=require(_0xef99('0x7'));var moment=require(_0xef99('0x8'));var config=require(_0xef99('0x9'));var db=require(_0xef99('0xa'))['db'];exports[_0xef99('0xb')]=function(_0xcd4691){var _0x32f4b6=_0xcd4691[_0xef99('0xc')](_0xef99('0xd'));if(_0x32f4b6===_0xef99('0xe')){_0xcd4691[_0xef99('0xf')](_0xef99('0x10'),path[_0xef99('0x11')](config['root'],_0xef99('0x12')));}if(_0x32f4b6==='development'||_0x32f4b6===_0xef99('0x13')){_0xcd4691[_0xef99('0xf')]('appPath',path[_0xef99('0x11')](config[_0xef99('0x14')],'client'));_0xcd4691[_0xef99('0x15')](errorHandler());}_0xcd4691['set'](_0xef99('0x16'),function(_0x34f9ba,_0x53359f){if(this[_0x34f9ba]instanceof Date){_0x53359f=this[_0x34f9ba][_0xef99('0x17')]()[_0xef99('0x18')]('.')[0x0]+'Z';}return _0x53359f;});_0xcd4691[_0xef99('0x15')](express['static'](_0xcd4691[_0xef99('0xc')](_0xef99('0x10'))));_0xcd4691[_0xef99('0xf')](_0xef99('0x19'),config[_0xef99('0x14')]+'/server/views');_0xcd4691[_0xef99('0x1a')](_0xef99('0x1b'),require(_0xef99('0x1c'))[_0xef99('0x1d')]);_0xcd4691['set'](_0xef99('0x1e'),_0xef99('0x1b'));_0xcd4691[_0xef99('0x15')](bodyParser[_0xef99('0x1f')]({'limit':_0xef99('0x20'),'extended':!![]}));_0xcd4691[_0xef99('0x15')](bodyParser[_0xef99('0x21')]({'limit':_0xef99('0x20')}));_0xcd4691[_0xef99('0x15')](cors());_0xcd4691['use'](methodOverride());_0xcd4691[_0xef99('0x15')](cookieParser());_0xcd4691[_0xef99('0x15')](passport['initialize']());}; \ No newline at end of file +var _0xdc3c=['client','toISOString','split','use','views','/server/views','ejs','view\x20engine','html','50mb','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','appPath','public','development','test','set','join','root'];(function(_0x91ec40,_0xa1ec3b){var _0x428c7a=function(_0x196f25){while(--_0x196f25){_0x91ec40['push'](_0x91ec40['shift']());}};_0x428c7a(++_0xa1ec3b);}(_0xdc3c,0x1a3));var _0xcdc3=function(_0x23fd45,_0x173ba6){_0x23fd45=_0x23fd45-0x0;var _0x2dd24e=_0xdc3c[_0x23fd45];return _0x2dd24e;};'use strict';var express=require(_0xcdc3('0x0'));var favicon=require(_0xcdc3('0x1'));var bodyParser=require(_0xcdc3('0x2'));var methodOverride=require(_0xcdc3('0x3'));var cookieParser=require(_0xcdc3('0x4'));var errorHandler=require(_0xcdc3('0x5'));var path=require(_0xcdc3('0x6'));var passport=require(_0xcdc3('0x7'));var cors=require(_0xcdc3('0x8'));var moment=require(_0xcdc3('0x9'));var config=require(_0xcdc3('0xa'));var db=require(_0xcdc3('0xb'))['db'];exports[_0xcdc3('0xc')]=function(_0x5a21bb){var _0x19bb67=_0x5a21bb[_0xcdc3('0xd')](_0xcdc3('0xe'));if(_0x19bb67===_0xcdc3('0xf')){_0x5a21bb['set'](_0xcdc3('0x10'),path['join'](config['root'],_0xcdc3('0x11')));}if(_0x19bb67===_0xcdc3('0x12')||_0x19bb67===_0xcdc3('0x13')){_0x5a21bb[_0xcdc3('0x14')](_0xcdc3('0x10'),path[_0xcdc3('0x15')](config[_0xcdc3('0x16')],_0xcdc3('0x17')));_0x5a21bb['use'](errorHandler());}_0x5a21bb[_0xcdc3('0x14')]('json\x20replacer',function(_0xe6b15e,_0x4be425){if(this[_0xe6b15e]instanceof Date){_0x4be425=this[_0xe6b15e][_0xcdc3('0x18')]()[_0xcdc3('0x19')]('.')[0x0]+'Z';}return _0x4be425;});_0x5a21bb[_0xcdc3('0x1a')](express['static'](_0x5a21bb[_0xcdc3('0xd')](_0xcdc3('0x10'))));_0x5a21bb[_0xcdc3('0x14')](_0xcdc3('0x1b'),config[_0xcdc3('0x16')]+_0xcdc3('0x1c'));_0x5a21bb['engine']('html',require(_0xcdc3('0x1d'))['renderFile']);_0x5a21bb[_0xcdc3('0x14')](_0xcdc3('0x1e'),_0xcdc3('0x1f'));_0x5a21bb[_0xcdc3('0x1a')](bodyParser['urlencoded']({'limit':_0xcdc3('0x20'),'extended':!![]}));_0x5a21bb[_0xcdc3('0x1a')](bodyParser['json']({'limit':'50mb'}));_0x5a21bb['use'](cors());_0x5a21bb[_0xcdc3('0x1a')](methodOverride());_0x5a21bb['use'](cookieParser());_0x5a21bb[_0xcdc3('0x1a')](passport[_0xcdc3('0x21')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 331e79a..7a66e48 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 _0x7676=['bimedia-machine-uuid','execSync','networkInterfaces','orderBy','keys','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','update','digest','getUuid','platform','win32','dmidecode\x20--string\x20system-uuid','replace','hostname','ipAddress','substring','lodash','crypto'];(function(_0x4f1dd6,_0x21e91d){var _0xc773ca=function(_0x508f0a){while(--_0x508f0a){_0x4f1dd6['push'](_0x4f1dd6['shift']());}};_0xc773ca(++_0x21e91d);}(_0x7676,0xb8));var _0x6767=function(_0x10eb28,_0x2b773f){_0x10eb28=_0x10eb28-0x0;var _0x7940e1=_0x7676[_0x10eb28];return _0x7940e1;};'use strict';var _=require(_0x6767('0x0'));var os=require('os');var crypto=require(_0x6767('0x1'));var machine=require(_0x6767('0x2'));var exec=require('child_process')[_0x6767('0x3')];function getInterfaces(){var _0x478b23=[];var _0x51f099=os[_0x6767('0x4')]();var _0x4bd37b=_[_0x6767('0x5')](_[_0x6767('0x6')](_0x51f099));for(var _0x3e0c16=0x0;_0x3e0c16<_0x4bd37b['length'];_0x3e0c16++){var _0x24d747=_0x51f099[_0x4bd37b[_0x3e0c16]][_0x6767('0x7')](function(_0x211a93){return _0x211a93['family']===_0x6767('0x8')&&_0x211a93[_0x6767('0x9')]===![];});_0x478b23=_0x478b23[_0x6767('0xa')](_0x24d747);}return _0x478b23;}function getFirstInterface(){var _0x343933=_[_0x6767('0xb')](getInterfaces());return{'macAddress':_0x343933&&_0x343933[_0x6767('0xc')]?_0x343933[_0x6767('0xc')]:_0x6767('0xd'),'ipAddress':_0x343933&&_0x343933[_0x6767('0xe')]?_0x343933[_0x6767('0xe')]:_0x6767('0xf')};}exports[_0x6767('0x10')]=getFirstInterface;function getCPUhash(){var _0x47b7a4=_[_0x6767('0x5')](os[_0x6767('0x11')]()[_0x6767('0x12')](function(_0x4968aa){return _0x4968aa['model'];}))[_0x6767('0x13')](':');return crypto[_0x6767('0x14')]('md5')[_0x6767('0x15')](_0x47b7a4)[_0x6767('0x16')]('hex');}exports[_0x6767('0x17')]=function(){switch(os[_0x6767('0x18')]()){case _0x6767('0x19'):return exec(_0x6767('0x1a'),{'encoding':'utf8'})[_0x6767('0x1b')]('\x0d\x0a','');default:var _0x49b65f=getFirstInterface();var _0x6526b3=getCPUhash();var _0x1598e8=_0x6526b3+'|'+os[_0x6767('0x1c')]()+'|'+_0x49b65f['macAddress']+'|'+_0x49b65f[_0x6767('0x1d')];var _0x4d3499=crypto[_0x6767('0x14')]('md5')[_0x6767('0x15')](_0x1598e8)['digest']('hex');return _0x4d3499[_0x6767('0x1e')](0x0,0x8)+'-'+_0x4d3499[_0x6767('0x1e')](0x8,0xc)+'-'+_0x4d3499['substring'](0xc,0x10)+'-'+_0x4d3499[_0x6767('0x1e')](0x10,0x14)+'-'+_0x4d3499[_0x6767('0x1e')](0x14);}}; \ No newline at end of file +var _0x741c=['concat','head','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','orderBy','model','join','createHash','md5','update','hex','getUuid','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','keys','length','filter','family','internal'];(function(_0x5411cb,_0x1cd69d){var _0x32727a=function(_0x22a762){while(--_0x22a762){_0x5411cb['push'](_0x5411cb['shift']());}};_0x32727a(++_0x1cd69d);}(_0x741c,0x196));var _0xc741=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x741c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc741('0x0'));var os=require('os');var crypto=require(_0xc741('0x1'));var machine=require(_0xc741('0x2'));var exec=require(_0xc741('0x3'))[_0xc741('0x4')];function getInterfaces(){var _0x31de60=[];var _0x5c8d3b=os['networkInterfaces']();var _0x4089bf=_['orderBy'](_[_0xc741('0x5')](_0x5c8d3b));for(var _0x1935b4=0x0;_0x1935b4<_0x4089bf[_0xc741('0x6')];_0x1935b4++){var _0x133bc4=_0x5c8d3b[_0x4089bf[_0x1935b4]][_0xc741('0x7')](function(_0x216e60){return _0x216e60[_0xc741('0x8')]==='IPv4'&&_0x216e60[_0xc741('0x9')]===![];});_0x31de60=_0x31de60[_0xc741('0xa')](_0x133bc4);}return _0x31de60;}function getFirstInterface(){var _0x47e0c0=_[_0xc741('0xb')](getInterfaces());return{'macAddress':_0x47e0c0&&_0x47e0c0['mac']?_0x47e0c0['mac']:_0xc741('0xc'),'ipAddress':_0x47e0c0&&_0x47e0c0[_0xc741('0xd')]?_0x47e0c0[_0xc741('0xd')]:_0xc741('0xe')};}exports[_0xc741('0xf')]=getFirstInterface;function getCPUhash(){var _0x29920b=_[_0xc741('0x10')](os['cpus']()['map'](function(_0x51bc33){return _0x51bc33[_0xc741('0x11')];}))[_0xc741('0x12')](':');return crypto[_0xc741('0x13')](_0xc741('0x14'))[_0xc741('0x15')](_0x29920b)['digest'](_0xc741('0x16'));}exports[_0xc741('0x17')]=function(){switch(os['platform']()){case _0xc741('0x18'):return exec(_0xc741('0x19'),{'encoding':_0xc741('0x1a')})[_0xc741('0x1b')]('\x0d\x0a','');default:var _0x21514e=getFirstInterface();var _0x5bbe86=getCPUhash();var _0x4dcf16=_0x5bbe86+'|'+os[_0xc741('0x1c')]()+'|'+_0x21514e['macAddress']+'|'+_0x21514e[_0xc741('0x1d')];var _0x3903c6=crypto['createHash']('md5')[_0xc741('0x15')](_0x4dcf16)[_0xc741('0x1e')](_0xc741('0x16'));return _0x3903c6['substring'](0x0,0x8)+'-'+_0x3903c6[_0xc741('0x1f')](0x8,0xc)+'-'+_0x3903c6[_0xc741('0x1f')](0xc,0x10)+'-'+_0x3903c6[_0xc741('0x1f')](0x10,0x14)+'-'+_0x3903c6[_0xc741('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 991a4de..2cefafd 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 _0x2542=['then','createCipher','aes-256-ctr','secrets','update','base64','final','createDecipher','utf8','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','|reason|','|email|','email','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','days','DEMO\x20START\x20AT\x20%s','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','crypto','moment','request-promise','pkginfo','../../mysqldb','../environment','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET'];(function(_0x30ab42,_0x2f40fc){var _0x5cdf61=function(_0x4280b6){while(--_0x4280b6){_0x30ab42['push'](_0x30ab42['shift']());}};_0x5cdf61(++_0x2f40fc);}(_0x2542,0x169));var _0x2254=function(_0x2560ee,_0x546d61){_0x2560ee=_0x2560ee-0x0;var _0x27920d=_0x2542[_0x2560ee];return _0x27920d;};'use strict';var util=require(_0x2254('0x0'));var crypto=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var rp=require(_0x2254('0x3'));var BPromise=require('bluebird');var pkginfo=require(_0x2254('0x4'))(module,'version');var db=require(_0x2254('0x5'))['db'];var config=require(_0x2254('0x6'));var hardware=require(_0x2254('0x7'));var logger=require(_0x2254('0x8'))(_0x2254('0x9'));var jira=require('../../api/jira/jira.controller');var HOST=_0x2254('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0xe8ca50){return new BPromise(function(_0x2ee7ee,_0x3c45ec){var _0x1637ad=util[_0x2254('0xb')](_0x2254('0xc'),HOST,_0xe8ca50,module[_0x2254('0xd')][_0x2254('0xe')]);if(oldToken){_0x1637ad=util[_0x2254('0xb')](_0x2254('0xf'),HOST,_0xe8ca50,module['exports'][_0x2254('0xe')],oldToken);}var _0x2655ea={'uri':_0x1637ad,'method':_0x2254('0x10'),'timeout':0xea60,'json':!![]};return rp(_0x2655ea)[_0x2254('0x11')](function(_0x575d58){_0x2ee7ee(_0x575d58);})['catch'](function(_0xe4fc71){_0x3c45ec(_0xe4fc71);});});}function encryptDate(_0x3e4213){var _0x116b70=crypto[_0x2254('0x12')](_0x2254('0x13'),config[_0x2254('0x14')]['session']);var _0x439238=_0x116b70[_0x2254('0x15')](_0x3e4213,'utf8',_0x2254('0x16'));_0x439238+=_0x116b70[_0x2254('0x17')](_0x2254('0x16'));return _0x439238;}function decryptDate(_0x145272){var _0x26285a=crypto[_0x2254('0x18')]('aes-256-ctr',config[_0x2254('0x14')]['session']);var _0x327d6d=_0x26285a[_0x2254('0x15')](_0x145272,_0x2254('0x16'),_0x2254('0x19'));_0x327d6d+=_0x26285a[_0x2254('0x17')](_0x2254('0x19'));return _0x327d6d;}function sendJiraAlert(_0x497724,_0x51b395,_0x5ec98d){var _0xb05559=_0x2254('0x1a');return db[_0x2254('0x1b')][_0x2254('0x1c')]({'where':{'role':_0x2254('0x1d')},'attributes':[_0x2254('0x1e'),'email'],'raw':!![]})[_0x2254('0x11')](function(_0x16148d){ADMIN=_0x16148d;_0xb05559+=_0x2254('0x1f')+_0x5ec98d+'|\x0a';_0xb05559+='|uuid|'+_0x497724+'|\x0a';_0xb05559+='|machineUuid|'+_0x51b395+'|\x0a';_0xb05559+='|name|'+ADMIN[_0x2254('0x1e')]+'|\x0a';_0xb05559+=_0x2254('0x20')+ADMIN[_0x2254('0x21')]+'|\x0a';return _0xb05559;})['then'](function(_0x5713e4){var _0x4d8faf=hardware['getFirstInterface']()['ipAddress'];return jira['openIssue']({'key':_0x2254('0x22'),'summary':_0x2254('0x23'),'description':_0x5713e4,'issuetype':_0x2254('0x24'),'oldToken':_0x497724,'newToken':_0x51b395,'email':ADMIN[_0x2254('0x21')],'name':ADMIN[_0x2254('0x1e')],'reason':GRAY_PERIOD_REASON,'ip':_0x4d8faf});});}function manageLicense(_0x1349c9,_0x51b578){var _0x4a8274=_0x51b578[_0x2254('0x25')]({'plain':!![]});httpRequest(_0x1349c9)['then'](function(_0x35608a){if(oldToken){oldToken=undefined;}if(_0x35608a[_0x2254('0x26')]){if(!_0x4a8274[_0x2254('0x9')]&&_0x4a8274[_0x2254('0x9')]!=_0x35608a[_0x2254('0x9')]||_0x4a8274['license']&&_0x4a8274[_0x2254('0x27')]){logger[_0x2254('0x28')](_0x2254('0x29'));}if(_0x4a8274[_0x2254('0x9')]&&!_0x4a8274[_0x2254('0x27')]&&_0x4a8274[_0x2254('0x9')]!=_0x35608a[_0x2254('0x9')]){logger[_0x2254('0x28')](_0x2254('0x2a'));}if(_0x4a8274[_0x2254('0x9')]&&!_0x4a8274[_0x2254('0x27')]&&_0x4a8274[_0x2254('0x9')]==_0x35608a[_0x2254('0x9')]){return _0x51b578;}return _0x51b578[_0x2254('0x15')]({'data1':_0x1349c9,'data2':null,'license':_0x35608a[_0x2254('0x9')]});}else{if(_0x35608a[_0x2254('0x9')]||_0x4a8274[_0x2254('0x9')]){if(!_0x4a8274[_0x2254('0x27')]){if(_0x4a8274[_0x2254('0x2b')]==_0x1349c9){GRAY_PERIOD_REASON='Disabled';logger[_0x2254('0x28')](_0x2254('0x2c'));}else{GRAY_PERIOD_REASON=_0x2254('0x2d');oldToken=_0x4a8274[_0x2254('0x2b')];logger[_0x2254('0x28')](_0x2254('0x2e'),_0x4a8274[_0x2254('0x2b')],_0x1349c9);}sendJiraAlert(_0x4a8274[_0x2254('0x2b')],_0x35608a[_0x2254('0x2f')],GRAY_PERIOD_REASON);logger['info'](_0x2254('0x30'),GRAY_PERIOD_REASON[_0x2254('0x31')](),moment()['format'](_0x2254('0x32')));return _0x51b578[_0x2254('0x15')]({'data2':encryptDate(moment()[_0x2254('0xb')](_0x2254('0x32')))});}else{if(moment()['diff'](decryptDate(_0x4a8274['data2']),_0x2254('0x33'))>DAYS){logger['info'](_0x2254('0x34'),moment()[_0x2254('0xb')](_0x2254('0x32')));return _0x51b578[_0x2254('0x15')]({'data1':_0x1349c9,'data2':null,'license':null});}}}else{if(_0x4a8274[_0x2254('0x2b')]!=_0x1349c9){logger[_0x2254('0x28')](_0x2254('0x2e'),_0x4a8274['data1'],_0x1349c9);return _0x51b578[_0x2254('0x15')]({'data1':_0x1349c9,'data2':null,'license':null});}}}return _0x51b578;})[_0x2254('0x11')](function(_0x32d2ea){_0x51b578=_0x32d2ea;})[_0x2254('0x35')](function(_0x17dc49){logger[_0x2254('0x36')](_0x17dc49[_0x2254('0x37')]);})[_0x2254('0x38')](function(){setTimeout(function(){manageLicense(hardware[_0x2254('0x39')](),_0x51b578);},TIME);});}function defaultLicense(){var _0x34543d=hardware['getUuid']();if(_0x34543d){return db[_0x2254('0x3a')][_0x2254('0x3b')]({'where':{'id':0x1},'defaults':{'data1':_0x34543d}})[_0x2254('0x3c')](function(_0x26b9b7,_0x4c7cc3){logger[_0x2254('0x28')](_0x2254('0x3d'),_0x34543d);manageLicense(_0x34543d,_0x26b9b7);})[_0x2254('0x35')](function(_0x144ae1){logger[_0x2254('0x36')](_0x144ae1[_0x2254('0x37')]);});}}exports[_0x2254('0x3e')]=defaultLicense; \ No newline at end of file +var _0x5430=['toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','crypto','moment','request-promise','bluebird','pkginfo','../environment','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','version','GET','then','catch','createCipher','aes-256-ctr','secrets','session','utf8','base64','createDecipher','update','final','User','findOne','admin','email','|reason|','|machineUuid|','|name|','fullname','|email|','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0x5430,0x10c));var _0x0543=function(_0x4d79e0,_0x1a804d){_0x4d79e0=_0x4d79e0-0x0;var _0x19b8a2=_0x5430[_0x4d79e0];return _0x19b8a2;};'use strict';var util=require(_0x0543('0x0'));var crypto=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var rp=require(_0x0543('0x3'));var BPromise=require(_0x0543('0x4'));var pkginfo=require(_0x0543('0x5'))(module,'version');var db=require('../../mysqldb')['db'];var config=require(_0x0543('0x6'));var hardware=require('./hardware');var logger=require('../logger')(_0x0543('0x7'));var jira=require(_0x0543('0x8'));var HOST=_0x0543('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x319568){return new BPromise(function(_0x46bca7,_0x5ac352){var _0x372974=util[_0x0543('0xa')](_0x0543('0xb'),HOST,_0x319568,module[_0x0543('0xc')][_0x0543('0xd')]);if(oldToken){_0x372974=util[_0x0543('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x319568,module[_0x0543('0xc')][_0x0543('0xd')],oldToken);}var _0x52c9b7={'uri':_0x372974,'method':_0x0543('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x52c9b7)[_0x0543('0xf')](function(_0x2bb810){_0x46bca7(_0x2bb810);})[_0x0543('0x10')](function(_0x3f74f8){_0x5ac352(_0x3f74f8);});});}function encryptDate(_0x3ed28d){var _0x30c54e=crypto[_0x0543('0x11')](_0x0543('0x12'),config[_0x0543('0x13')][_0x0543('0x14')]);var _0x509afa=_0x30c54e['update'](_0x3ed28d,_0x0543('0x15'),_0x0543('0x16'));_0x509afa+=_0x30c54e['final']('base64');return _0x509afa;}function decryptDate(_0xcb09df){var _0x40fb03=crypto[_0x0543('0x17')](_0x0543('0x12'),config[_0x0543('0x13')]['session']);var _0xe69a3d=_0x40fb03[_0x0543('0x18')](_0xcb09df,_0x0543('0x16'),_0x0543('0x15'));_0xe69a3d+=_0x40fb03[_0x0543('0x19')](_0x0543('0x15'));return _0xe69a3d;}function sendJiraAlert(_0x577cf0,_0x5eb03e,_0x37b084){var _0x5362cb='||FIELD||VALUE||\x0a';return db[_0x0543('0x1a')][_0x0543('0x1b')]({'where':{'role':_0x0543('0x1c')},'attributes':['fullname',_0x0543('0x1d')],'raw':!![]})['then'](function(_0x401da5){ADMIN=_0x401da5;_0x5362cb+=_0x0543('0x1e')+_0x37b084+'|\x0a';_0x5362cb+='|uuid|'+_0x577cf0+'|\x0a';_0x5362cb+=_0x0543('0x1f')+_0x5eb03e+'|\x0a';_0x5362cb+=_0x0543('0x20')+ADMIN[_0x0543('0x21')]+'|\x0a';_0x5362cb+=_0x0543('0x22')+ADMIN[_0x0543('0x1d')]+'|\x0a';return _0x5362cb;})[_0x0543('0xf')](function(_0x4adba7){var _0x5979d2=hardware['getFirstInterface']()[_0x0543('0x23')];return jira[_0x0543('0x24')]({'key':_0x0543('0x25'),'summary':_0x0543('0x26'),'description':_0x4adba7,'issuetype':_0x0543('0x27'),'oldToken':_0x577cf0,'newToken':_0x5eb03e,'email':ADMIN[_0x0543('0x1d')],'name':ADMIN[_0x0543('0x21')],'reason':GRAY_PERIOD_REASON,'ip':_0x5979d2});});}function manageLicense(_0x17a3de,_0x1fca8a){var _0xf1eccf=_0x1fca8a[_0x0543('0x28')]({'plain':!![]});httpRequest(_0x17a3de)[_0x0543('0xf')](function(_0x547a88){if(oldToken){oldToken=undefined;}if(_0x547a88[_0x0543('0x29')]){if(!_0xf1eccf[_0x0543('0x7')]&&_0xf1eccf[_0x0543('0x7')]!=_0x547a88['license']||_0xf1eccf[_0x0543('0x7')]&&_0xf1eccf[_0x0543('0x2a')]){logger[_0x0543('0x2b')](_0x0543('0x2c'));}if(_0xf1eccf['license']&&!_0xf1eccf[_0x0543('0x2a')]&&_0xf1eccf[_0x0543('0x7')]!=_0x547a88['license']){logger['info'](_0x0543('0x2d'));}if(_0xf1eccf[_0x0543('0x7')]&&!_0xf1eccf['data2']&&_0xf1eccf[_0x0543('0x7')]==_0x547a88[_0x0543('0x7')]){return _0x1fca8a;}return _0x1fca8a[_0x0543('0x18')]({'data1':_0x17a3de,'data2':null,'license':_0x547a88[_0x0543('0x7')]});}else{if(_0x547a88[_0x0543('0x7')]||_0xf1eccf[_0x0543('0x7')]){if(!_0xf1eccf[_0x0543('0x2a')]){if(_0xf1eccf['data1']==_0x17a3de){GRAY_PERIOD_REASON=_0x0543('0x2e');logger['info'](_0x0543('0x2f'));}else{GRAY_PERIOD_REASON=_0x0543('0x30');oldToken=_0xf1eccf[_0x0543('0x31')];logger[_0x0543('0x2b')](_0x0543('0x32'),_0xf1eccf['data1'],_0x17a3de);}sendJiraAlert(_0xf1eccf[_0x0543('0x31')],_0x547a88['uuid'],GRAY_PERIOD_REASON);logger[_0x0543('0x2b')](_0x0543('0x33'),GRAY_PERIOD_REASON[_0x0543('0x34')](),moment()[_0x0543('0xa')]('YYYY-MM-DD\x20HH:mm'));return _0x1fca8a[_0x0543('0x18')]({'data2':encryptDate(moment()['format'](_0x0543('0x35')))});}else{if(moment()[_0x0543('0x36')](decryptDate(_0xf1eccf[_0x0543('0x2a')]),_0x0543('0x37'))>DAYS){logger[_0x0543('0x2b')](_0x0543('0x38'),moment()[_0x0543('0xa')](_0x0543('0x35')));return _0x1fca8a[_0x0543('0x18')]({'data1':_0x17a3de,'data2':null,'license':null});}}}else{if(_0xf1eccf[_0x0543('0x31')]!=_0x17a3de){logger['info'](_0x0543('0x32'),_0xf1eccf[_0x0543('0x31')],_0x17a3de);return _0x1fca8a['update']({'data1':_0x17a3de,'data2':null,'license':null});}}}return _0x1fca8a;})[_0x0543('0xf')](function(_0x4b9c1f){_0x1fca8a=_0x4b9c1f;})[_0x0543('0x10')](function(_0x2ce7b9){logger['error'](_0x2ce7b9['message']);})[_0x0543('0x39')](function(){setTimeout(function(){manageLicense(hardware[_0x0543('0x3a')](),_0x1fca8a);},TIME);});}function defaultLicense(){var _0x4ca572=hardware[_0x0543('0x3a')]();if(_0x4ca572){return db[_0x0543('0x3b')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x4ca572}})[_0x0543('0x3c')](function(_0x2896b9,_0x3ecd70){logger[_0x0543('0x2b')](_0x0543('0x3d'),_0x4ca572);manageLicense(_0x4ca572,_0x2896b9);})['catch'](function(_0x572dd7){logger['error'](_0x572dd7[_0x0543('0x3e')]);});}}exports[_0x0543('0x3f')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 4e703fa..f4e307b 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 _0x5449=['createDecipher','aes-256-ctr','format','update','final','utf8','parse','demo','machineUuid','getUuid','secrets','base64','gray','add','days','uuid','changed','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','License','find','then','checkLicense','lodash','moment','./hardware','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','split'];(function(_0x4cce93,_0xf52676){var _0x3d8d18=function(_0x4c041d){while(--_0x4c041d){_0x4cce93['push'](_0x4cce93['shift']());}};_0x3d8d18(++_0xf52676);}(_0x5449,0x15f));var _0x9544=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0x5449[_0x3207aa];return _0x51758f;};'use strict';var crypto=require('crypto');var util=require('util');var _=require(_0x9544('0x0'));var moment=require(_0x9544('0x1'));var hardware=require(_0x9544('0x2'));var config=require('../environment');var db=require(_0x9544('0x3'))['db'];function checkLicense(_0x5738c6,_0x386572){if(_0x5738c6){try{var _0x2de989=_0x386572||_0x5738c6[_0x9544('0x4')];if(_[_0x9544('0x5')](_0x2de989)){throw new Error(_0x9544('0x6'));}var _0x4c2b07=_0x5738c6[_0x9544('0x7')];var _0x4b6cc4=_0x5738c6['data2'];var _0x22cfee=_0x4c2b07[_0x9544('0x8')]('-')[0x4];var _0x5ad82a=_0x4c2b07[_0x9544('0x8')]('-')[0x0];var _0x5c6caf=crypto[_0x9544('0x9')](_0x9544('0xa'),util[_0x9544('0xb')]('%s:%s:%s',_0x22cfee,_0x4c2b07,_0x5ad82a));var _0x19281b=_0x5c6caf[_0x9544('0xc')](_0x2de989,'base64','utf8');_0x19281b+=_0x5c6caf[_0x9544('0xd')](_0x9544('0xe'));var _0x19f4b7=JSON[_0x9544('0xf')](_0x19281b);_0x19f4b7[_0x9544('0x10')]=![];_0x19f4b7['uuid']=_0x4c2b07;_0x19f4b7[_0x9544('0x11')]=hardware[_0x9544('0x12')]();if(_0x4b6cc4){var _0xbaef7b=crypto[_0x9544('0x9')]('aes-256-ctr',config[_0x9544('0x13')]['session']);var _0x16e090=_0xbaef7b[_0x9544('0xc')](_0x4b6cc4,_0x9544('0x14'),_0x9544('0xe'));_0x16e090+=_0xbaef7b[_0x9544('0xd')](_0x9544('0xe'));_0x19f4b7[_0x9544('0x15')]=_0x16e090;_0x19f4b7['deadline']=moment(_0x16e090)[_0x9544('0x16')](0x7,_0x9544('0x17'))[_0x9544('0xb')]();_0x19f4b7['grayReason']=_0x19f4b7[_0x9544('0x18')]!=_0x19f4b7[_0x9544('0x11')]?_0x9544('0x19'):_0x9544('0x1a');}return _0x19f4b7;}catch(_0x47b7e0){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9544('0x1b'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9544('0x1c'),'uuid':_0x5738c6[_0x9544('0x7')],'machineUuid':hardware[_0x9544('0x12')](),'message':_0x47b7e0[_0x9544('0x1d')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9544('0x1e'),'uuid':_0x5738c6[_0x9544('0x7')],'machineUuid':hardware[_0x9544('0x12')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0x9544('0x1f')]=function(_0x2f7202){return db[_0x9544('0x20')][_0x9544('0x21')](_['defaults'](_0x2f7202,{'raw':!![],'where':{'id':0x1}}))[_0x9544('0x22')](function(_0x53d15f){return checkLicense(_0x53d15f,null);});};exports[_0x9544('0x23')]=checkLicense; \ No newline at end of file +var _0xcbfd=['parse','uuid','machineUuid','getUuid','createDecipher','secrets','session','gray','deadline','add','days','format','grayReason','disabled','2027-01-01T00:00:00.000Z','Breaking\x20license','Demo\x20license','License','find','then','crypto','lodash','./hardware','../../mysqldb','license','isEmpty','License\x20key\x20value\x20not\x20found','data1','data2','split','aes-256-ctr','%s:%s:%s','update','base64','utf8','final'];(function(_0x9be9da,_0x13da6e){var _0x5b7bea=function(_0x24d8d5){while(--_0x24d8d5){_0x9be9da['push'](_0x9be9da['shift']());}};_0x5b7bea(++_0x13da6e);}(_0xcbfd,0x110));var _0xdcbf=function(_0x57167a,_0x3aec92){_0x57167a=_0x57167a-0x0;var _0x436eef=_0xcbfd[_0x57167a];return _0x436eef;};'use strict';var crypto=require(_0xdcbf('0x0'));var util=require('util');var _=require(_0xdcbf('0x1'));var moment=require('moment');var hardware=require(_0xdcbf('0x2'));var config=require('../environment');var db=require(_0xdcbf('0x3'))['db'];function checkLicense(_0xd79575,_0x2e719c){if(_0xd79575){try{var _0x783662=_0x2e719c||_0xd79575[_0xdcbf('0x4')];if(_[_0xdcbf('0x5')](_0x783662)){throw new Error(_0xdcbf('0x6'));}var _0x718c8d=_0xd79575[_0xdcbf('0x7')];var _0x1b715e=_0xd79575[_0xdcbf('0x8')];var _0x485a72=_0x718c8d[_0xdcbf('0x9')]('-')[0x4];var _0x2f48c4=_0x718c8d[_0xdcbf('0x9')]('-')[0x0];var _0x3c3a60=crypto['createDecipher'](_0xdcbf('0xa'),util['format'](_0xdcbf('0xb'),_0x485a72,_0x718c8d,_0x2f48c4));var _0x21a4df=_0x3c3a60[_0xdcbf('0xc')](_0x783662,_0xdcbf('0xd'),_0xdcbf('0xe'));_0x21a4df+=_0x3c3a60[_0xdcbf('0xf')](_0xdcbf('0xe'));var _0xc3e47=JSON[_0xdcbf('0x10')](_0x21a4df);_0xc3e47['demo']=![];_0xc3e47[_0xdcbf('0x11')]=_0x718c8d;_0xc3e47[_0xdcbf('0x12')]=hardware[_0xdcbf('0x13')]();if(_0x1b715e){var _0x5db851=crypto[_0xdcbf('0x14')](_0xdcbf('0xa'),config[_0xdcbf('0x15')][_0xdcbf('0x16')]);var _0x1319b8=_0x5db851[_0xdcbf('0xc')](_0x1b715e,_0xdcbf('0xd'),_0xdcbf('0xe'));_0x1319b8+=_0x5db851['final'](_0xdcbf('0xe'));_0xc3e47[_0xdcbf('0x17')]=_0x1319b8;_0xc3e47[_0xdcbf('0x18')]=moment(_0x1319b8)[_0xdcbf('0x19')](0x7,_0xdcbf('0x1a'))[_0xdcbf('0x1b')]();_0xc3e47[_0xdcbf('0x1c')]=_0xc3e47[_0xdcbf('0x11')]!=_0xc3e47[_0xdcbf('0x12')]?'changed':_0xdcbf('0x1d');}return _0xc3e47;}catch(_0x5ea080){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdcbf('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xdcbf('0x1f'),'uuid':_0xd79575[_0xdcbf('0x7')],'machineUuid':hardware[_0xdcbf('0x13')](),'message':_0x5ea080['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdcbf('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xdcbf('0x20'),'uuid':_0xd79575[_0xdcbf('0x7')],'machineUuid':hardware[_0xdcbf('0x13')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports['getLicense']=function(_0x186f90){return db[_0xdcbf('0x21')][_0xdcbf('0x22')](_['defaults'](_0x186f90,{'raw':!![],'where':{'id':0x1}}))[_0xdcbf('0x23')](function(_0x28958e){return checkLicense(_0x28958e,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 313e4fa..f996069 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 _0x1226=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x1b391d,_0x520bf6){var _0x2ab6aa=function(_0x837571){while(--_0x837571){_0x1b391d['push'](_0x1b391d['shift']());}};_0x2ab6aa(++_0x520bf6);}(_0x1226,0x1c1));var _0x6122=function(_0xba3d5a,_0x356a7b){_0xba3d5a=_0xba3d5a-0x0;var _0x4809d5=_0x1226[_0xba3d5a];return _0x4809d5;};'use strict';module[_0x6122('0x0')]={'DOMAIN':_0x6122('0x1'),'SESSION_SECRET':_0x6122('0x2'),'GOOGLE_ID':_0x6122('0x3'),'GOOGLE_SECRET':_0x6122('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xaa65=['http://localhost:9000','myappanuglar-secret','app-id','exports'];(function(_0x7baa76,_0x518ffc){var _0x8f5bc4=function(_0xb78f43){while(--_0xb78f43){_0x7baa76['push'](_0x7baa76['shift']());}};_0x8f5bc4(++_0x518ffc);}(_0xaa65,0x14b));var _0x5aa6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa65[_0x3dd15e];return _0x231fd0;};'use strict';module[_0x5aa6('0x0')]={'DOMAIN':_0x5aa6('0x1'),'SESSION_SECRET':_0x5aa6('0x2'),'GOOGLE_ID':_0x5aa6('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 6b9b3e3..624ebb5 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2821=['path','/var','log','xcally','%s-%s.log','format','level','toUpperCase','message','exports','Logger','%s-%s','error','File','info','transports','env','debugLevel','moment','util'];(function(_0x188f91,_0x279508){var _0x27ccd9=function(_0x3a1001){while(--_0x3a1001){_0x188f91['push'](_0x188f91['shift']());}};_0x27ccd9(++_0x279508);}(_0x2821,0x166));var _0x1282=function(_0x142da5,_0xcd1a46){_0x142da5=_0x142da5-0x0;var _0x727fb5=_0x2821[_0x142da5];return _0x727fb5;};'use strict';var moment=require(_0x1282('0x0'));var winston=require('winston');var util=require(_0x1282('0x1'));var path=require(_0x1282('0x2'));var debugLevel='INFO';function filename(_0x47c3bd,_0x1920db){return path['join'](_0x1282('0x3'),_0x1282('0x4'),_0x1282('0x5'),util['format'](_0x1282('0x6'),_0x47c3bd,_0x1920db));}function formatter(_0x14758d,_0x20175a){return util[_0x1282('0x7')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x1282('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),_0x20175a[_0x1282('0x8')][_0x1282('0x9')](),_0x14758d,_0x20175a[_0x1282('0xa')]);}module[_0x1282('0xb')]=function(_0x5d732a){return new winston[(_0x1282('0xc'))]({'transports':[new winston['transports']['File']({'name':util[_0x1282('0x7')](_0x1282('0xd'),_0x5d732a,_0x1282('0xe')),'filename':filename(_0x5d732a,_0x1282('0xe')),'level':_0x1282('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xa57916){return formatter(_0x5d732a,_0xa57916);}}),new winston['transports'][(_0x1282('0xf'))]({'name':util['format'](_0x1282('0xd'),_0x5d732a,_0x1282('0x10')),'filename':filename(_0x5d732a,_0x1282('0x10')),'level':_0x1282('0x10'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x113e50){return formatter(_0x5d732a,_0x113e50);}}),new winston[(_0x1282('0x11'))]['Console']({'level':process[_0x1282('0x12')][_0x1282('0x13')]||debugLevel,'json':![],'formatter':function(_0x6b38e4){return formatter(_0x5d732a,_0x6b38e4);}})]});}; \ No newline at end of file +var _0x432d=['info','env','debugLevel','moment','path','INFO','join','log','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','message','exports','Logger','transports','File','%s-%s','error'];(function(_0x24b245,_0x1b3508){var _0x56f828=function(_0x21752a){while(--_0x21752a){_0x24b245['push'](_0x24b245['shift']());}};_0x56f828(++_0x1b3508);}(_0x432d,0x96));var _0xd432=function(_0x19a11f,_0x6d8be7){_0x19a11f=_0x19a11f-0x0;var _0x51485f=_0x432d[_0x19a11f];return _0x51485f;};'use strict';var moment=require(_0xd432('0x0'));var winston=require('winston');var util=require('util');var path=require(_0xd432('0x1'));var debugLevel=_0xd432('0x2');function filename(_0x5177a9,_0x165800){return path[_0xd432('0x3')]('/var',_0xd432('0x4'),'xcally',util[_0xd432('0x5')](_0xd432('0x6'),_0x5177a9,_0x165800));}function formatter(_0x43a39e,_0x3891db){return util[_0xd432('0x5')](_0xd432('0x7'),moment()[_0xd432('0x5')](_0xd432('0x8')),_0x3891db[_0xd432('0x9')][_0xd432('0xa')](),_0x43a39e,_0x3891db[_0xd432('0xb')]);}module[_0xd432('0xc')]=function(_0x595629){return new winston[(_0xd432('0xd'))]({'transports':[new winston[(_0xd432('0xe'))][(_0xd432('0xf'))]({'name':util[_0xd432('0x5')](_0xd432('0x10'),_0x595629,_0xd432('0x11')),'filename':filename(_0x595629,_0xd432('0x11')),'level':_0xd432('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5567a5){return formatter(_0x595629,_0x5567a5);}}),new winston[(_0xd432('0xe'))][(_0xd432('0xf'))]({'name':util['format'](_0xd432('0x10'),_0x595629,_0xd432('0x12')),'filename':filename(_0x595629,_0xd432('0x12')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4fafb7){return formatter(_0x595629,_0x4fafb7);}}),new winston[(_0xd432('0xe'))]['Console']({'level':process[_0xd432('0x13')][_0xd432('0x14')]||debugLevel,'json':![],'formatter':function(_0x38cbb8){return formatter(_0x595629,_0x38cbb8);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 0d58cea..a94b1c7 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 _0xc94e=['../../services/express/index.js','ami','../../services/agi/index.js','../../services/email/index.js','routing','../../services/xdr/index.js','path','join'];(function(_0xec61e8,_0x30ea78){var _0x5c256b=function(_0x44ad65){while(--_0x44ad65){_0xec61e8['push'](_0xec61e8['shift']());}};_0x5c256b(++_0x30ea78);}(_0xc94e,0x76));var _0xec94=function(_0x7ced0c,_0x45a052){_0x7ced0c=_0x7ced0c-0x0;var _0x5217b6=_0xc94e[_0x7ced0c];return _0x5217b6;};'use strict';var path=require(_0xec94('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xec94('0x1')](__dirname,_0xec94('0x2'))},{'name':_0xec94('0x3'),'script':path['join'](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0xec94('0x1')](__dirname,_0xec94('0x4'))},{'name':'email','script':path[_0xec94('0x1')](__dirname,_0xec94('0x5'))},{'name':_0xec94('0x6'),'script':path['join'](__dirname,'../../services/routing/index.js')},{'name':'xdr','script':path[_0xec94('0x1')](__dirname,_0xec94('0x7'))}]};module['exports']=config; \ No newline at end of file +var _0x0a9f=['xdr','../../services/xdr/index.js','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js'];(function(_0x4cdd5a,_0x57e480){var _0x4133d9=function(_0x3c3f4b){while(--_0x3c3f4b){_0x4cdd5a['push'](_0x4cdd5a['shift']());}};_0x4133d9(++_0x57e480);}(_0x0a9f,0x1b5));var _0xf0a9=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x0a9f[_0x119d5a];return _0x15bff4;};'use strict';var path=require(_0xf0a9('0x0'));var os=require('os');var config={'apps':[{'name':_0xf0a9('0x1'),'script':path[_0xf0a9('0x2')](__dirname,_0xf0a9('0x3'))},{'name':_0xf0a9('0x4'),'script':path[_0xf0a9('0x2')](__dirname,_0xf0a9('0x5'))},{'name':_0xf0a9('0x6'),'script':path[_0xf0a9('0x2')](__dirname,_0xf0a9('0x7'))},{'name':_0xf0a9('0x8'),'script':path[_0xf0a9('0x2')](__dirname,'../../services/email/index.js')},{'name':_0xf0a9('0x9'),'script':path['join'](__dirname,_0xf0a9('0xa'))},{'name':_0xf0a9('0xb'),'script':path['join'](__dirname,_0xf0a9('0xc'))}]};module[_0xf0a9('0xd')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 97b0289..6d87437 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 _0x98a8=['restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','start','then','disconnect','stop'];(function(_0x215f20,_0x10e56d){var _0x22b34b=function(_0x280974){while(--_0x280974){_0x215f20['push'](_0x215f20['shift']());}};_0x22b34b(++_0x10e56d);}(_0x98a8,0x12c));var _0x898a=function(_0x4be29f,_0x2ab8d7){_0x4be29f=_0x4be29f-0x0;var _0x20e1ce=_0x98a8[_0x4be29f];return _0x20e1ce;};'use strict';var pm2=require(_0x898a('0x0'));var BPromise=require(_0x898a('0x1'));var config=require(_0x898a('0x2'));function connect(){return new BPromise(function(_0x4583d9,_0x213c5d){return pm2[_0x898a('0x3')](function(_0x69c61f){if(_0x69c61f){return _0x213c5d(_0x69c61f);}return _0x4583d9('connected');});});};exports[_0x898a('0x4')]=function(_0xf84a19){return connect()[_0x898a('0x5')](function(){return new BPromise(function(_0x101b7b,_0x3e7ddd){return pm2['start'](_0xf84a19,function(_0x3aadc2,_0x564583){if(_0x3aadc2){return _0x3e7ddd(_0x3aadc2);}pm2[_0x898a('0x6')]();return _0x101b7b(_0x564583);});});});};exports['stop']=function(_0x42021d){return connect()[_0x898a('0x5')](function(){return new BPromise(function(_0x2101b3,_0x96b636){return pm2[_0x898a('0x7')](_0x42021d,function(_0x388a47,_0x42faa4){if(_0x388a47){return _0x96b636(_0x388a47);}pm2[_0x898a('0x6')]();return _0x2101b3(_0x42faa4);});});});};exports[_0x898a('0x8')]=function(_0x5d2de4){return connect()[_0x898a('0x5')](function(){return new BPromise(function(_0x502e95,_0x30257f){return pm2['restart'](_0x5d2de4,function(_0x25d7f2,_0x2c76b7){if(_0x25d7f2){return _0x30257f(_0x25d7f2);}pm2[_0x898a('0x6')]();return _0x502e95(_0x2c76b7);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x5b5c9c,_0x373d53){return pm2[_0x898a('0x9')](function(_0xb24335,_0x116fbe){if(_0xb24335){return _0x373d53(_0xb24335);}pm2[_0x898a('0x6')]();return _0x5b5c9c(_0x116fbe);});});});};exports[_0x898a('0xa')]=function(_0x506023){return connect()[_0x898a('0x5')](function(){return new BPromise(function(_0x53a4b8,_0x3fec7a){return pm2['describe'](_0x506023,function(_0x303321,_0x4fb05b){if(_0x303321){return _0x3fec7a(_0x303321);}pm2[_0x898a('0x6')]();return _0x53a4b8(_0x4fb05b);});});});};exports['delete']=function(_0xee4408){return connect()[_0x898a('0x5')](function(){return new BPromise(function(_0x28cc63,_0x4ddd4d){return pm2[_0x898a('0xb')](_0xee4408,function(_0x5960e0,_0x54c8f3){if(_0x5960e0){return _0x4ddd4d(_0x5960e0);}pm2[_0x898a('0x6')]();return _0x28cc63(_0x54c8f3);});});});};exports[_0x898a('0xc')]=function(){return connect()['then'](function(){return new BPromise(function(_0x4d374b,_0x12bc0f){return pm2[_0x898a('0xc')](function(_0x38a8f0){if(_0x38a8f0){return _0x12bc0f(_0x38a8f0);}return _0x4d374b(_0x898a('0xd'));});});});}; \ No newline at end of file +var _0x548b=['./config','connect','start','then','disconnect','stop','restart','describe','delete','dump','saved','pm2'];(function(_0x2ede2a,_0x1cf3ab){var _0x515f70=function(_0x47d2f5){while(--_0x47d2f5){_0x2ede2a['push'](_0x2ede2a['shift']());}};_0x515f70(++_0x1cf3ab);}(_0x548b,0x14f));var _0xb548=function(_0x2f29a5,_0x3cd30b){_0x2f29a5=_0x2f29a5-0x0;var _0x5a6a35=_0x548b[_0x2f29a5];return _0x5a6a35;};'use strict';var pm2=require(_0xb548('0x0'));var BPromise=require('bluebird');var config=require(_0xb548('0x1'));function connect(){return new BPromise(function(_0x193dfe,_0x21f7f7){return pm2[_0xb548('0x2')](function(_0x49e50a){if(_0x49e50a){return _0x21f7f7(_0x49e50a);}return _0x193dfe('connected');});});};exports[_0xb548('0x3')]=function(_0x2cdbbc){return connect()[_0xb548('0x4')](function(){return new BPromise(function(_0x1efae4,_0x20a495){return pm2[_0xb548('0x3')](_0x2cdbbc,function(_0x19b4bd,_0x235ca8){if(_0x19b4bd){return _0x20a495(_0x19b4bd);}pm2[_0xb548('0x5')]();return _0x1efae4(_0x235ca8);});});});};exports[_0xb548('0x6')]=function(_0x3b0a54){return connect()['then'](function(){return new BPromise(function(_0x2a4648,_0x1e9a75){return pm2[_0xb548('0x6')](_0x3b0a54,function(_0x4afd2e,_0x29c118){if(_0x4afd2e){return _0x1e9a75(_0x4afd2e);}pm2[_0xb548('0x5')]();return _0x2a4648(_0x29c118);});});});};exports['restart']=function(_0x5a8acb){return connect()['then'](function(){return new BPromise(function(_0x260ecf,_0xc012da){return pm2[_0xb548('0x7')](_0x5a8acb,function(_0x5ca243,_0x2a4c31){if(_0x5ca243){return _0xc012da(_0x5ca243);}pm2[_0xb548('0x5')]();return _0x260ecf(_0x2a4c31);});});});};exports['list']=function(){return connect()[_0xb548('0x4')](function(){return new BPromise(function(_0x13ca51,_0x43d501){return pm2['list'](function(_0x291bf9,_0x5e1068){if(_0x291bf9){return _0x43d501(_0x291bf9);}pm2[_0xb548('0x5')]();return _0x13ca51(_0x5e1068);});});});};exports[_0xb548('0x8')]=function(_0x3ee052){return connect()['then'](function(){return new BPromise(function(_0x486dca,_0x291d97){return pm2['describe'](_0x3ee052,function(_0x4e428a,_0x48c6f4){if(_0x4e428a){return _0x291d97(_0x4e428a);}pm2[_0xb548('0x5')]();return _0x486dca(_0x48c6f4);});});});};exports['delete']=function(_0x2f1449){return connect()['then'](function(){return new BPromise(function(_0x2683e9,_0x29c552){return pm2[_0xb548('0x9')](_0x2f1449,function(_0x521a3c,_0xbf7c4c){if(_0x521a3c){return _0x29c552(_0x521a3c);}pm2[_0xb548('0x5')]();return _0x2683e9(_0xbf7c4c);});});});};exports[_0xb548('0xa')]=function(){return connect()[_0xb548('0x4')](function(){return new BPromise(function(_0x102953,_0x461011){return pm2['dump'](function(_0x178a79){if(_0x178a79){return _0x461011(_0x178a79);}return _0x102953(_0xb548('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 090c16e..cbeacea 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 _0x19b9=['lodash','moment','ioredis','../../mysqldb','../../config/environment','defaults','localhost','redis','Setting','chatTimeout','then','ChatInteraction','lastMsgAt','subtract','minutes','update','system','YYYY-MM-DD\x20HH:mm:ss','map','error','start'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x19b9,0x1a4));var _0x919b=function(_0x2ccca0,_0x30b9ac){_0x2ccca0=_0x2ccca0-0x0;var _0x24eac3=_0x19b9[_0x2ccca0];return _0x24eac3;};'use strict';var _=require(_0x919b('0x0'));var moment=require(_0x919b('0x1'));var Redis=require(_0x919b('0x2'));var db=require(_0x919b('0x3'))['db'];var config=require(_0x919b('0x4'));config['redis']=_[_0x919b('0x5')](config['redis'],{'host':_0x919b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x919b('0x7')]));function closeInteractions(){var _0x499e83=0x0;var _0x320c44=[];return db[_0x919b('0x8')]['find']({'raw':!![],'attributes':['id',_0x919b('0x9')],'where':{'id':0x1}})[_0x919b('0xa')](function(_0x2e1c9a){_0x499e83=_0x2e1c9a[_0x919b('0x9')];if(_0x499e83){return db[_0x919b('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x919b('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x919b('0xd')](_0x2e1c9a[_0x919b('0x9')],_0x919b('0xe'))}}});}else{return[];}})['then'](function(_0x59b589){_0x320c44=_0x59b589;if(_0x499e83){return db[_0x919b('0xb')][_0x919b('0xf')]({'closeReason':_0x919b('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x919b('0x11'))},{'where':{'id':_[_0x919b('0x12')](_0x320c44||[],'id')}});}})[_0x919b('0xa')](function(_0x333e51){for(var _0x39e05b=0x0;_0x39e05b<_0x320c44['length'];_0x39e05b++){io['emit']('chatInteraction:update',{'id':_0x320c44[_0x39e05b]['id'],'closed':!![]});}})['catch'](function(_0x6f816d){console[_0x919b('0x13')](_0x6f816d);});}exports[_0x919b('0x14')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9e00=['chatTimeout','ChatInteraction','lastMsgAt','subtract','minutes','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','chatInteraction:update','error','start','moment','../../config/environment','defaults','redis','Setting','then'];(function(_0x3b3200,_0xc9454c){var _0x3650c1=function(_0x2dc786){while(--_0x2dc786){_0x3b3200['push'](_0x3b3200['shift']());}};_0x3650c1(++_0xc9454c);}(_0x9e00,0x1c8));var _0x09e0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9e00[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var moment=require(_0x09e0('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var config=require(_0x09e0('0x1'));config['redis']=_[_0x09e0('0x2')](config[_0x09e0('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x09e0('0x3')]));function closeInteractions(){var _0xc1aeb6=0x0;var _0x1660f4=[];return db[_0x09e0('0x4')]['find']({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x09e0('0x5')](function(_0x59f912){_0xc1aeb6=_0x59f912[_0x09e0('0x6')];if(_0xc1aeb6){return db[_0x09e0('0x7')]['findAll']({'raw':!![],'attributes':['id',_0x09e0('0x8')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x09e0('0x9')](_0x59f912[_0x09e0('0x6')],_0x09e0('0xa'))}}});}else{return[];}})['then'](function(_0x8d579e){_0x1660f4=_0x8d579e;if(_0xc1aeb6){return db[_0x09e0('0x7')][_0x09e0('0xb')]({'closeReason':_0x09e0('0xc'),'disposition':_0x09e0('0xd'),'closed':!![],'closedAt':moment()['format'](_0x09e0('0xe'))},{'where':{'id':_[_0x09e0('0xf')](_0x1660f4||[],'id')}});}})['then'](function(_0x1b5a5a){for(var _0x55ac5c=0x0;_0x55ac5c<_0x1660f4[_0x09e0('0x10')];_0x55ac5c++){io[_0x09e0('0x11')](_0x09e0('0x12'),{'id':_0x1660f4[_0x55ac5c]['id'],'closed':!![]});}})['catch'](function(_0x5b0855){console[_0x09e0('0x13')](_0x5b0855);});}exports[_0x09e0('0x14')]=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 5ab80b4..d64bb03 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 _0x3d9d=['port','secure','authentication','auth','user','pass','\x22%s\x22\x20<%s>','name','format','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','basename','zip','existsSync','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','attachments','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','no\x20report\x20id','Schedule','findAll','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','toRun','index','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update','run','util','path','lodash','moment','cron-job-manager','jayson/promise','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host'];(function(_0x126d6e,_0x1d8f3a){var _0x1e7281=function(_0x14fcf0){while(--_0x14fcf0){_0x126d6e['push'](_0x126d6e['shift']());}};_0x1e7281(++_0x1d8f3a);}(_0x3d9d,0xa3));var _0xd3d9=function(_0x2f5fbb,_0x144c9d){_0x2f5fbb=_0x2f5fbb-0x0;var _0x23ead5=_0x3d9d[_0x2f5fbb];return _0x23ead5;};'use strict';var fs=require('fs');var util=require(_0xd3d9('0x0'));var path=require(_0xd3d9('0x1'));var _=require(_0xd3d9('0x2'));var moment=require(_0xd3d9('0x3'));var CronJobManager=require(_0xd3d9('0x4'));var jayson=require(_0xd3d9('0x5'));var BPromise=require('bluebird');var logger=require(_0xd3d9('0x6'))(_0xd3d9('0x7'));var db=require(_0xd3d9('0x8'))['db'];var analyticCustomReportController=require(_0xd3d9('0x9'));var analyticDefaultReportController=require(_0xd3d9('0xa'));var client=jayson['client'][_0xd3d9('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x17527e,_0x17efba){return function(){logger[_0xd3d9('0xc')](_0xd3d9('0xd'),_0x17527e[_0xd3d9('0xe')]);var _0x2a387d=!![];var _0x4ec041={'tls':{'rejectUnauthorized':![]}};if(_0x17527e[_0xd3d9('0xf')]['Smtp'][_0xd3d9('0x10')]){_0x4ec041[_0xd3d9('0x10')]=_0x17527e[_0xd3d9('0xf')][_0xd3d9('0x11')]['service'];}else{_0x4ec041[_0xd3d9('0x12')]=_0x17527e['MailAccount'][_0xd3d9('0x11')][_0xd3d9('0x12')];_0x4ec041[_0xd3d9('0x13')]=_0x17527e['MailAccount'][_0xd3d9('0x11')][_0xd3d9('0x13')];_0x4ec041[_0xd3d9('0x14')]=_0x17527e[_0xd3d9('0xf')][_0xd3d9('0x11')][_0xd3d9('0x14')];}if(_0x17527e[_0xd3d9('0xf')][_0xd3d9('0x11')][_0xd3d9('0x15')]){_0x4ec041[_0xd3d9('0x16')]={'user':_0x17527e[_0xd3d9('0xf')]['Smtp'][_0xd3d9('0x17')],'pass':_0x17527e['MailAccount'][_0xd3d9('0x11')][_0xd3d9('0x18')]};}var _0x1cf923={'account':_0x4ec041,'message':{'from':util['format'](_0xd3d9('0x19'),_0x17527e[_0xd3d9('0xf')][_0xd3d9('0x1a')],_0x17527e[_0xd3d9('0xf')][_0xd3d9('0xe')]||_0x17527e[_0xd3d9('0xf')]['Smtp']['user']),'to':_0x17527e[_0xd3d9('0xe')],'cc':_0x17527e['cc'],'bcc':_0x17527e['bcc'],'subject':util[_0xd3d9('0x1b')](_0xd3d9('0x1c'),_0x17efba['name'],_0x17527e[_0xd3d9('0x1d')],_0x17527e[_0xd3d9('0x1e')])}};var _0x408049=path[_0xd3d9('0x1f')](__dirname,'../../files/reports');var _0x4a3e8b=_0x17efba[_0xd3d9('0x20')];var _0x3b6718=util['format']('%s.%s',path[_0xd3d9('0x21')](_0x17efba[_0xd3d9('0x20')],path['extname'](_0x17efba['savename'])),_0xd3d9('0x22'));var _0x4cb61d=path[_0xd3d9('0x1f')](_0x408049,_0x4a3e8b);var _0x5c5afe=path[_0xd3d9('0x1f')](_0x408049,_0x3b6718);if(fs[_0xd3d9('0x23')](_0x4cb61d)){_0x17efba['status']='Sent';_0x1cf923['message']['attachments']=[{'filename':_0x4a3e8b,'path':_0x4cb61d}];_0x1cf923[_0xd3d9('0x24')][_0xd3d9('0x25')]=util[_0xd3d9('0x1b')](_0xd3d9('0x26'),JSON[_0xd3d9('0x27')](_0x17efba,null,0x2));}else if(fs['existsSync'](_0x5c5afe)){_0x17efba[_0xd3d9('0x28')]='Sent';_0x1cf923[_0xd3d9('0x24')][_0xd3d9('0x29')]=[{'filename':_0x3b6718,'path':_0x5c5afe}];}else{_0x1cf923[_0xd3d9('0x24')][_0xd3d9('0x25')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x17527e[_0xd3d9('0x2a')]){_0x2a387d=![];logger['info'](_0xd3d9('0x2b'));}}if(_0x2a387d){return client[_0xd3d9('0x2c')](_0xd3d9('0x2d'),_0x1cf923)[_0xd3d9('0x2e')](function(_0x28752a){if(_0x28752a[_0xd3d9('0x2f')]){return logger['error'](_0xd3d9('0x30'),JSON[_0xd3d9('0x27')](_0x28752a));}return logger['info'](_0xd3d9('0x31'));})['catch'](function(_0xa8d077){return logger[_0xd3d9('0x2f')](_0xd3d9('0x30'),JSON[_0xd3d9('0x27')](_0xa8d077));});}};}function handleError(){return function(_0x29cf79){return logger[_0xd3d9('0x2f')](JSON[_0xd3d9('0x27')](_0x29cf79));};}function handleResult(_0x50f941){return function(_0x3d86a4){logger[_0xd3d9('0xc')](_0xd3d9('0x32'),JSON['stringify'](_0x3d86a4));if(_0x50f941[_0xd3d9('0xf')]&&_0x50f941[_0xd3d9('0xf')][_0xd3d9('0x11')]&&!_[_0xd3d9('0x33')](_0x50f941[_0xd3d9('0xe')])){setTimeout(handleSendEmail(_0x50f941,_0x3d86a4),0x3c*0x3e8);}};}function handleJob(_0x1ab830){return function(){try{if(_[_0xd3d9('0x33')](_0x1ab830[_0xd3d9('0x1d')])){return logger[_0xd3d9('0xc')](_0xd3d9('0x34'));}if(_[_0xd3d9('0x33')](_0x1ab830[_0xd3d9('0x1e')])){return logger[_0xd3d9('0xc')](_0xd3d9('0x35'));}var _0x4fcc1c={'startDate':moment()[_0xd3d9('0x36')](_0x1ab830[_0xd3d9('0x1d')],_0x1ab830[_0xd3d9('0x1e')])[_0xd3d9('0x1b')](_0xd3d9('0x37')),'endDate':moment()[_0xd3d9('0x1b')](_0xd3d9('0x37')),'type':_0xd3d9('0x38'),'output':_0x1ab830['output'],'name':_0x1ab830[_0xd3d9('0x1a')]};if(!_[_0xd3d9('0x33')](_0x1ab830[_0xd3d9('0x39')])){logger[_0xd3d9('0xc')](_0xd3d9('0x3a'),_0x1ab830['DefaultReportId']);return analyticDefaultReportController[_0xd3d9('0x3b')]({'id':_0x1ab830[_0xd3d9('0x39')]},_0x4fcc1c)[_0xd3d9('0x2e')](handleResult(_0x1ab830))[_0xd3d9('0x3c')](handleError());}if(!_[_0xd3d9('0x33')](_0x1ab830[_0xd3d9('0x3d')])){logger[_0xd3d9('0xc')]('exec\x20custom\x20report\x20id:%s',_0x1ab830[_0xd3d9('0x3d')]);return analyticCustomReportController[_0xd3d9('0x3b')]({'id':_0x1ab830[_0xd3d9('0x3d')]},_0x4fcc1c)[_0xd3d9('0x2e')](handleResult(_0x1ab830))[_0xd3d9('0x3c')](handleError());}}catch(_0x10545e){logger[_0xd3d9('0x2f')](JSON[_0xd3d9('0x27')](_0x10545e));}return logger['info'](_0xd3d9('0x3e'));};}function getJobs(_0x47b406){var _0x6197c={};if(_0x47b406){_0x6197c['id']=_0x47b406;}return db[_0xd3d9('0x3f')][_0xd3d9('0x40')]({'where':_0x6197c,'include':[{'model':db['MailAccount'],'attributes':['id',_0xd3d9('0x1a'),'email'],'include':[{'model':db['MailServerOut'],'as':_0xd3d9('0x11')}]}]})[_0xd3d9('0x2e')](function(_0x301505){var _0xec17db=_[_0xd3d9('0x41')](manager[_0xd3d9('0x42')]);var _0x2e0997=_[_0xd3d9('0x43')](_0x301505,function(_0x51f454){return _0x51f454['id'][_0xd3d9('0x44')]();});var _0x540a03=_[_0xd3d9('0x45')](_0x301505,function(_0x5a1b93){return _0x5a1b93['id'][_0xd3d9('0x44')]();});var _0x2ec745=_0x47b406?_0x2e0997:_[_0xd3d9('0x46')](_0x2e0997,_0xec17db);var _0x2f5989=_[_0xd3d9('0x47')](_0x2e0997,_0xec17db);var _0x507616=_[_0xd3d9('0x46')](_0xec17db,_0x2e0997);var _0x13af28;var _0x518f66;for(_0x13af28=0x0;_0x13af28<_0x507616[_0xd3d9('0x48')]&&!_0x47b406;_0x13af28+=0x1){_0x518f66=_0x507616[_0x13af28]['toString']();if(manager[_0xd3d9('0x49')](_0x518f66)){manager[_0xd3d9('0x4a')](_0x518f66);manager[_0xd3d9('0x4b')](_0x518f66);logger[_0xd3d9('0xc')]('delete\x20cron',_0x518f66);}}logger[_0xd3d9('0xc')](_0xd3d9('0x4c'),JSON[_0xd3d9('0x27')](_0x2ec745));for(_0x13af28=0x0;_0x13af28<_0x2ec745[_0xd3d9('0x48')];_0x13af28+=0x1){_0x518f66=_0x2ec745[_0x13af28][_0xd3d9('0x44')]();logger['info'](_0xd3d9('0x4d'),_0x518f66);if(_0x47b406){logger[_0xd3d9('0xc')]('my\x20id',_0x47b406);logger['info'](JSON[_0xd3d9('0x27')](_0x540a03[_0x518f66]));BPromise[_0xd3d9('0x4e')]()[_0xd3d9('0x2e')](handleJob(_0x540a03[_0x518f66]));logger[_0xd3d9('0xc')](_0xd3d9('0x4f'),_0x540a03[_0x518f66][_0xd3d9('0x1a')],_0x540a03[_0x518f66][_0xd3d9('0x50')]);}else if(_0x540a03[_0x518f66][_0xd3d9('0x50')]&&_0x540a03[_0x518f66][_0xd3d9('0x51')]&&moment()[_0xd3d9('0x52')](_0x540a03[_0x518f66][_0xd3d9('0x53')],_0x540a03[_0x518f66][_0xd3d9('0x54')])){manager[_0xd3d9('0x55')](_0x518f66,_0x540a03[_0x518f66][_0xd3d9('0x50')],handleJob(_0x540a03[_0x518f66]));manager[_0xd3d9('0x56')](_0x518f66);logger[_0xd3d9('0xc')](_0xd3d9('0x57'),_0x540a03[_0x518f66][_0xd3d9('0x1a')],_0x540a03[_0x518f66][_0xd3d9('0x50')]);}else if(manager[_0xd3d9('0x49')](_0x518f66)){manager[_0xd3d9('0x4a')](_0x518f66);manager[_0xd3d9('0x4b')](_0x518f66);logger[_0xd3d9('0xc')](_0xd3d9('0x58'),_0x540a03[_0x518f66]['name'],_0x540a03[_0x518f66]['cron']);}}for(_0x13af28=0x0,_0x518f66;_0x13af28<_0x2f5989[_0xd3d9('0x48')]&&!_0x47b406;_0x13af28+=0x1){_0x518f66=_0x2f5989[_0x13af28][_0xd3d9('0x44')]();if(manager[_0xd3d9('0x49')](_0x518f66)){if(_0x540a03[_0x518f66][_0xd3d9('0x50')]&&_0x540a03[_0x518f66]['active']&&moment()['isBetween'](_0x540a03[_0x518f66][_0xd3d9('0x53')],_0x540a03[_0x518f66][_0xd3d9('0x54')])){manager[_0xd3d9('0x59')](_0x518f66,_0x540a03[_0x518f66]['cron'],handleJob(_0x540a03[_0x518f66]));logger[_0xd3d9('0xc')]('update\x20cron',_0x540a03[_0x518f66][_0xd3d9('0x1a')],_0x540a03[_0x518f66]['cron']);}else{manager[_0xd3d9('0x4a')](_0x518f66);manager['deleteJob'](_0x518f66);logger[_0xd3d9('0xc')](_0xd3d9('0x58'),_0x540a03[_0x518f66]['name'],_0x540a03[_0x518f66][_0xd3d9('0x50')]);}}}})[_0xd3d9('0x3c')](function(_0xb5b9e7){logger['error'](JSON[_0xd3d9('0x27')](_0xb5b9e7));});}exports[_0xd3d9('0x5a')]=function(_0x2c148e){return getJobs(_0x2c148e);};exports[_0xd3d9('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xb97c=['pass','format','name','bcc','subtractNumber','subtractUnit','../../files/reports','savename','basename','extname','zip','join','existsSync','status','Sent','message','text','stringify','attachments','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','data','isNil','email','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','difference','intersection','length','exists','stop','deleteJob','index','my\x20id','resolve','cron','active','isBetween','add','start','add\x20cron','stop\x20cron','startAt','endAt','update','update\x20cron','path','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','authentication','user'];(function(_0x50a182,_0x24220c){var _0x9b1058=function(_0x5f0d34){while(--_0x5f0d34){_0x50a182['push'](_0x50a182['shift']());}};_0x9b1058(++_0x24220c);}(_0xb97c,0x145));var _0xcb97=function(_0x59e63,_0x1ccf61){_0x59e63=_0x59e63-0x0;var _0x337a72=_0xb97c[_0x59e63];return _0x337a72;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xcb97('0x0'));var _=require('lodash');var moment=require(_0xcb97('0x1'));var CronJobManager=require(_0xcb97('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0xcb97('0x3'));var logger=require(_0xcb97('0x4'))(_0xcb97('0x5'));var db=require(_0xcb97('0x6'))['db'];var analyticCustomReportController=require(_0xcb97('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xcb97('0x8')][_0xcb97('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x226773,_0x39f8b8){return function(){logger[_0xcb97('0xa')](_0xcb97('0xb'),_0x226773['email']);var _0x5baecf=!![];var _0x259845={'tls':{'rejectUnauthorized':![]}};if(_0x226773[_0xcb97('0xc')][_0xcb97('0xd')][_0xcb97('0xe')]){_0x259845[_0xcb97('0xe')]=_0x226773['MailAccount'][_0xcb97('0xd')][_0xcb97('0xe')];}else{_0x259845[_0xcb97('0xf')]=_0x226773[_0xcb97('0xc')][_0xcb97('0xd')]['host'];_0x259845['port']=_0x226773[_0xcb97('0xc')]['Smtp'][_0xcb97('0x10')];_0x259845['secure']=_0x226773[_0xcb97('0xc')][_0xcb97('0xd')]['secure'];}if(_0x226773[_0xcb97('0xc')]['Smtp'][_0xcb97('0x11')]){_0x259845['auth']={'user':_0x226773['MailAccount'][_0xcb97('0xd')][_0xcb97('0x12')],'pass':_0x226773[_0xcb97('0xc')][_0xcb97('0xd')][_0xcb97('0x13')]};}var _0x11455b={'account':_0x259845,'message':{'from':util[_0xcb97('0x14')]('\x22%s\x22\x20<%s>',_0x226773[_0xcb97('0xc')][_0xcb97('0x15')],_0x226773[_0xcb97('0xc')]['email']||_0x226773['MailAccount'][_0xcb97('0xd')]['user']),'to':_0x226773['email'],'cc':_0x226773['cc'],'bcc':_0x226773[_0xcb97('0x16')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x39f8b8[_0xcb97('0x15')],_0x226773[_0xcb97('0x17')],_0x226773[_0xcb97('0x18')])}};var _0x26a6d1=path['join'](__dirname,_0xcb97('0x19'));var _0x30460d=_0x39f8b8[_0xcb97('0x1a')];var _0x37b40b=util[_0xcb97('0x14')]('%s.%s',path[_0xcb97('0x1b')](_0x39f8b8[_0xcb97('0x1a')],path[_0xcb97('0x1c')](_0x39f8b8[_0xcb97('0x1a')])),_0xcb97('0x1d'));var _0x566196=path[_0xcb97('0x1e')](_0x26a6d1,_0x30460d);var _0x3f07bb=path[_0xcb97('0x1e')](_0x26a6d1,_0x37b40b);if(fs[_0xcb97('0x1f')](_0x566196)){_0x39f8b8[_0xcb97('0x20')]=_0xcb97('0x21');_0x11455b[_0xcb97('0x22')]['attachments']=[{'filename':_0x30460d,'path':_0x566196}];_0x11455b[_0xcb97('0x22')][_0xcb97('0x23')]=util[_0xcb97('0x14')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0xcb97('0x24')](_0x39f8b8,null,0x2));}else if(fs[_0xcb97('0x1f')](_0x3f07bb)){_0x39f8b8[_0xcb97('0x20')]=_0xcb97('0x21');_0x11455b[_0xcb97('0x22')][_0xcb97('0x25')]=[{'filename':_0x37b40b,'path':_0x3f07bb}];}else{_0x11455b[_0xcb97('0x22')][_0xcb97('0x23')]=_0xcb97('0x26');if(!_0x226773[_0xcb97('0x27')]){_0x5baecf=![];logger['info'](_0xcb97('0x28'));}}if(_0x5baecf){return client[_0xcb97('0x29')](_0xcb97('0x2a'),_0x11455b)[_0xcb97('0x2b')](function(_0x20fe6f){if(_0x20fe6f[_0xcb97('0x2c')]){return logger[_0xcb97('0x2c')](_0xcb97('0x2d'),JSON[_0xcb97('0x24')](_0x20fe6f));}return logger[_0xcb97('0xa')]('email\x20sent');})['catch'](function(_0x1baef6){return logger[_0xcb97('0x2c')](_0xcb97('0x2d'),JSON[_0xcb97('0x24')](_0x1baef6));});}};}function handleError(){return function(_0x181301){return logger['error'](JSON['stringify'](_0x181301));};}function handleResult(_0x5559b8){return function(_0xe6b9b5){logger[_0xcb97('0xa')](_0xcb97('0x2e'),JSON[_0xcb97('0x24')](_0xe6b9b5));if(_0x5559b8[_0xcb97('0xc')]&&_0x5559b8[_0xcb97('0xc')][_0xcb97('0xd')]&&!_[_0xcb97('0x2f')](_0x5559b8[_0xcb97('0x30')])){setTimeout(handleSendEmail(_0x5559b8,_0xe6b9b5),0x3c*0x3e8);}};}function handleJob(_0x1c75a1){return function(){try{if(_[_0xcb97('0x2f')](_0x1c75a1[_0xcb97('0x17')])){return logger[_0xcb97('0xa')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x1c75a1['subtractUnit'])){return logger[_0xcb97('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x310fb7={'startDate':moment()[_0xcb97('0x31')](_0x1c75a1[_0xcb97('0x17')],_0x1c75a1[_0xcb97('0x18')])[_0xcb97('0x14')](_0xcb97('0x32')),'endDate':moment()[_0xcb97('0x14')](_0xcb97('0x32')),'type':_0xcb97('0x33'),'output':_0x1c75a1[_0xcb97('0x34')],'name':_0x1c75a1[_0xcb97('0x15')]};if(!_[_0xcb97('0x2f')](_0x1c75a1[_0xcb97('0x35')])){logger[_0xcb97('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x1c75a1['DefaultReportId']);return analyticDefaultReportController[_0xcb97('0x36')]({'id':_0x1c75a1[_0xcb97('0x35')]},_0x310fb7)[_0xcb97('0x2b')](handleResult(_0x1c75a1))[_0xcb97('0x37')](handleError());}if(!_['isNil'](_0x1c75a1[_0xcb97('0x38')])){logger[_0xcb97('0xa')](_0xcb97('0x39'),_0x1c75a1['CustomReportId']);return analyticCustomReportController[_0xcb97('0x36')]({'id':_0x1c75a1[_0xcb97('0x38')]},_0x310fb7)['then'](handleResult(_0x1c75a1))[_0xcb97('0x37')](handleError());}}catch(_0x1f7c99){logger[_0xcb97('0x2c')](JSON['stringify'](_0x1f7c99));}return logger['info'](_0xcb97('0x3a'));};}function getJobs(_0x52c959){var _0x5adad1={};if(_0x52c959){_0x5adad1['id']=_0x52c959;}return db[_0xcb97('0x3b')][_0xcb97('0x3c')]({'where':_0x5adad1,'include':[{'model':db[_0xcb97('0xc')],'attributes':['id',_0xcb97('0x15'),_0xcb97('0x30')],'include':[{'model':db[_0xcb97('0x3d')],'as':'Smtp'}]}]})['then'](function(_0x24eb81){var _0x38f055=_[_0xcb97('0x3e')](manager[_0xcb97('0x3f')]);var _0x5e3d3=_[_0xcb97('0x40')](_0x24eb81,function(_0x418b56){return _0x418b56['id'][_0xcb97('0x41')]();});var _0x4bbe3a=_['keyBy'](_0x24eb81,function(_0x28fa0e){return _0x28fa0e['id']['toString']();});var _0x50e538=_0x52c959?_0x5e3d3:_[_0xcb97('0x42')](_0x5e3d3,_0x38f055);var _0x5a2eaa=_[_0xcb97('0x43')](_0x5e3d3,_0x38f055);var _0x64d65d=_['difference'](_0x38f055,_0x5e3d3);var _0x88ca1e;var _0x2c143d;for(_0x88ca1e=0x0;_0x88ca1e<_0x64d65d[_0xcb97('0x44')]&&!_0x52c959;_0x88ca1e+=0x1){_0x2c143d=_0x64d65d[_0x88ca1e][_0xcb97('0x41')]();if(manager[_0xcb97('0x45')](_0x2c143d)){manager[_0xcb97('0x46')](_0x2c143d);manager[_0xcb97('0x47')](_0x2c143d);logger[_0xcb97('0xa')]('delete\x20cron',_0x2c143d);}}logger['info']('toRun',JSON[_0xcb97('0x24')](_0x50e538));for(_0x88ca1e=0x0;_0x88ca1e<_0x50e538[_0xcb97('0x44')];_0x88ca1e+=0x1){_0x2c143d=_0x50e538[_0x88ca1e]['toString']();logger['info'](_0xcb97('0x48'),_0x2c143d);if(_0x52c959){logger[_0xcb97('0xa')](_0xcb97('0x49'),_0x52c959);logger['info'](JSON[_0xcb97('0x24')](_0x4bbe3a[_0x2c143d]));BPromise[_0xcb97('0x4a')]()[_0xcb97('0x2b')](handleJob(_0x4bbe3a[_0x2c143d]));logger['info']('run\x20job',_0x4bbe3a[_0x2c143d]['name'],_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]);}else if(_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]&&_0x4bbe3a[_0x2c143d][_0xcb97('0x4c')]&&moment()[_0xcb97('0x4d')](_0x4bbe3a[_0x2c143d]['startAt'],_0x4bbe3a[_0x2c143d]['endAt'])){manager[_0xcb97('0x4e')](_0x2c143d,_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')],handleJob(_0x4bbe3a[_0x2c143d]));manager[_0xcb97('0x4f')](_0x2c143d);logger[_0xcb97('0xa')](_0xcb97('0x50'),_0x4bbe3a[_0x2c143d]['name'],_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]);}else if(manager['exists'](_0x2c143d)){manager['stop'](_0x2c143d);manager[_0xcb97('0x47')](_0x2c143d);logger[_0xcb97('0xa')](_0xcb97('0x51'),_0x4bbe3a[_0x2c143d][_0xcb97('0x15')],_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]);}}for(_0x88ca1e=0x0,_0x2c143d;_0x88ca1e<_0x5a2eaa['length']&&!_0x52c959;_0x88ca1e+=0x1){_0x2c143d=_0x5a2eaa[_0x88ca1e][_0xcb97('0x41')]();if(manager['exists'](_0x2c143d)){if(_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]&&_0x4bbe3a[_0x2c143d][_0xcb97('0x4c')]&&moment()['isBetween'](_0x4bbe3a[_0x2c143d][_0xcb97('0x52')],_0x4bbe3a[_0x2c143d][_0xcb97('0x53')])){manager[_0xcb97('0x54')](_0x2c143d,_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')],handleJob(_0x4bbe3a[_0x2c143d]));logger['info'](_0xcb97('0x55'),_0x4bbe3a[_0x2c143d]['name'],_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]);}else{manager[_0xcb97('0x46')](_0x2c143d);manager[_0xcb97('0x47')](_0x2c143d);logger[_0xcb97('0xa')](_0xcb97('0x51'),_0x4bbe3a[_0x2c143d][_0xcb97('0x15')],_0x4bbe3a[_0x2c143d][_0xcb97('0x4b')]);}}}})[_0xcb97('0x37')](function(_0x27d2a8){logger[_0xcb97('0x2c')](JSON[_0xcb97('0x24')](_0x27d2a8));});}exports['run']=function(_0x3f6f10){return getJobs(_0x3f6f10);};exports[_0xcb97('0x4f')]=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 b6ecdf1..6f8b7bc 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 _0x7fcd=['[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','info','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','language','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','ValidationError','data1','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','sentiment','bucket','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','catch','lodash','aws-sdk','request-promise','util','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x7fcd,0x11f));var _0xd7fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7fcd[_0x3dd15e];return _0x231fd0;};var _=require(_0xd7fc('0x0'));var AWS=require(_0xd7fc('0x1'));var rp=require(_0xd7fc('0x2'));var util=require(_0xd7fc('0x3'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xd7fc('0x4'));function getTranscriptionJob(_0x4663e4,_0x2446fa,_0x28d2f0,_0x4d0b02){return new Promise(function(_0x2a8600,_0x254026){var _0x2878e0=new AWS[(_0xd7fc('0x5'))]({'accessKeyId':_0x2446fa,'secretAccessKey':_0x4663e4,'region':_0x28d2f0});_0x2878e0[_0xd7fc('0x6')]({'TranscriptionJobName':_0x4d0b02},function(_0x406fe2,_0x3637e0){if(_0x406fe2){return _0x254026(_0x406fe2);}else{return _0x2a8600(_0x3637e0);}});});}function sentiment(_0xe77d95,_0x3c1337,_0x1dba44,_0x5e1913,_0xc331be){return new Promise(function(_0x1ffb22,_0x5d0a56){var _0x2f63fe=new AWS[(_0xd7fc('0x7'))]({'accessKeyId':_0x3c1337,'secretAccessKey':_0xe77d95,'region':_0x1dba44});_0x2f63fe[_0xd7fc('0x8')]({'Text':_0x5e1913,'LanguageCode':_0xc331be['substring'](0x0,0x2)},function(_0x1d5b17,_0x500105){if(_0x1d5b17){return _0x5d0a56(_0x1d5b17);}else{return _0x1ffb22(_0x500105);}});});}function checkTranscribeJob(_0x5ce35e,_0x221556,_0xdc1f45){var _0x5e2764;return new BPromise(function(_0x13edea,_0x2200d1){logger['info'](util['format'](_0xd7fc('0x9'),_0x5ce35e['id'],_0x5ce35e[_0xd7fc('0xa')]));return getTranscriptionJob(_0xdc1f45['data1'],_0xdc1f45[_0xd7fc('0xb')],_0x221556[_0xd7fc('0xc')],_0x5ce35e['transcribeName'])['then'](function(_0x5a432e){logger[_0xd7fc('0xd')](util[_0xd7fc('0xe')](_0xd7fc('0xf'),_0x5ce35e['id'],_0x5ce35e[_0xd7fc('0xa')],_0x5a432e[_0xd7fc('0x10')][_0xd7fc('0x11')]));if(!_0x5ce35e[_0xd7fc('0x12')]){switch(_0x5a432e[_0xd7fc('0x10')][_0xd7fc('0x11')]){case _0xd7fc('0x13'):var _0x97881b={'transcribeStatus':_0x5a432e['TranscriptionJob'][_0xd7fc('0x11')],'fileUri':_0x5a432e[_0xd7fc('0x10')][_0xd7fc('0x14')][_0xd7fc('0x15')]};logger['info'](util['format'](_0xd7fc('0x16'),_0x5ce35e['id']));return rp({'uri':_0x5a432e[_0xd7fc('0x10')]['Transcript'][_0xd7fc('0x15')],'json':!![]})[_0xd7fc('0x17')](function(_0x3fe139){logger[_0xd7fc('0xd')](util[_0xd7fc('0xe')](_0xd7fc('0x18'),_0x5ce35e['id']));if(_0x3fe139&&_0x3fe139[_0xd7fc('0x19')]&&_0x3fe139[_0xd7fc('0x19')][_0xd7fc('0x1a')]&&_0x3fe139[_0xd7fc('0x19')][_0xd7fc('0x1a')]['length']){_0x97881b[_0xd7fc('0x12')]='';for(var _0x205e02=0x0;_0x205e02<_0x3fe139[_0xd7fc('0x19')][_0xd7fc('0x1a')][_0xd7fc('0x1b')];_0x205e02++){_0x97881b[_0xd7fc('0x12')]+=_0x3fe139[_0xd7fc('0x19')][_0xd7fc('0x1a')][_0x205e02][_0xd7fc('0x1c')]+'';}}return _0x5ce35e[_0xd7fc('0x1d')](_0x97881b);})[_0xd7fc('0x17')](function(){logger[_0xd7fc('0xd')](util['format'](_0xd7fc('0x1e'),_0x5ce35e['id']));if(!_0x5ce35e[_0xd7fc('0x1f')]){throw new db['Sequelize']['ValidationError'](_0xd7fc('0x20'));}if(!_0x221556['sentiment']||!_0x221556['sentimentAccountId']||!_0x221556['sentimentRegion']||!_0x221556[_0xd7fc('0x21')]||!_0x221556['bucket']){throw new db[(_0xd7fc('0x22'))]['ValidationError'](_0xd7fc('0x23'));}if(!_0x97881b[_0xd7fc('0x12')]){throw new Error(_0xd7fc('0x24'));}if(_0x221556[_0xd7fc('0x25')]===_0xdc1f45['id']){return _0xdc1f45;}else{return db[_0xd7fc('0x26')][_0xd7fc('0x27')]({'where':{'id':_settings[_0xd7fc('0x25')]}});}})[_0xd7fc('0x17')](function(_0x29f65d){if(!_0x29f65d){throw new db[(_0xd7fc('0x22'))][(_0xd7fc('0x28'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x29f65d[_0xd7fc('0x29')]||!_0x29f65d[_0xd7fc('0xb')]){throw new db['Sequelize'][(_0xd7fc('0x28'))](_0xd7fc('0x2a'));}_0x5e2764=_0x29f65d;logger[_0xd7fc('0xd')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5ce35e['id']));return sentiment(_0x5e2764[_0xd7fc('0x29')],_0x5e2764[_0xd7fc('0xb')],_0x221556[_0xd7fc('0x2b')],_0x97881b['fileText'],_0x221556[_0xd7fc('0x21')]);})[_0xd7fc('0x17')](function(_0x2170cf){logger[_0xd7fc('0xd')](util['format'](_0xd7fc('0x2c'),_0x5ce35e['id']));return _0x5ce35e[_0xd7fc('0x1d')]({'sentiment':_0x2170cf[_0xd7fc('0x2d')],'sPositive':_0x2170cf[_0xd7fc('0x2e')][_0xd7fc('0x2f')],'sNegative':_0x2170cf['SentimentScore'][_0xd7fc('0x30')],'sMixed':_0x2170cf['SentimentScore'][_0xd7fc('0x31')],'sNeutral':_0x2170cf[_0xd7fc('0x2e')][_0xd7fc('0x32')]});})[_0xd7fc('0x17')](function(){logger[_0xd7fc('0xd')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5ce35e['id']));_0x13edea();});case _0xd7fc('0x33'):return _0x5ce35e[_0xd7fc('0x1d')]({'transcribeStatus':_0xd7fc('0x33'),'failureReason':_0x5a432e['TranscriptionJob'][_0xd7fc('0x34')]})[_0xd7fc('0x17')](function(){logger['info'](util[_0xd7fc('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5ce35e['id']));_0x13edea();});default:logger['info'](util[_0xd7fc('0xe')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x5ce35e['id']));break;}}else{return BPromise[_0xd7fc('0x35')]()[_0xd7fc('0x17')](function(){if(!_0x5ce35e[_0xd7fc('0x1f')]){throw new db[(_0xd7fc('0x22'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x221556[_0xd7fc('0x36')]||!_0x221556[_0xd7fc('0x25')]||!_0x221556[_0xd7fc('0x2b')]||!_0x221556[_0xd7fc('0x21')]||!_0x221556[_0xd7fc('0x37')]){throw new db['Sequelize'][(_0xd7fc('0x28'))](_0xd7fc('0x23'));}if(!_0x5ce35e[_0xd7fc('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x221556[_0xd7fc('0x25')]===_0xdc1f45['id']){return _0xdc1f45;}else{return db[_0xd7fc('0x26')][_0xd7fc('0x27')]({'where':{'id':_settings[_0xd7fc('0x25')]}});}})[_0xd7fc('0x17')](function(_0x45db78){if(!_0x45db78){throw new db[(_0xd7fc('0x22'))][(_0xd7fc('0x28'))](_0xd7fc('0x38'));}if(!_0x45db78[_0xd7fc('0x29')]||!_0x45db78['data2']){throw new db[(_0xd7fc('0x22'))][(_0xd7fc('0x28'))](_0xd7fc('0x2a'));}_0x5e2764=_0x45db78;logger[_0xd7fc('0xd')](util['format'](_0xd7fc('0x39'),_0x5ce35e['id']));return sentiment(_0x5e2764[_0xd7fc('0x29')],_0x5e2764[_0xd7fc('0xb')],_0x221556[_0xd7fc('0x2b')],_0x5ce35e[_0xd7fc('0x12')],_0x221556[_0xd7fc('0x21')]);})['then'](function(_0xa2f427){logger[_0xd7fc('0xd')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5ce35e['id']));return _0x5ce35e[_0xd7fc('0x1d')]({'sentiment':_0xa2f427[_0xd7fc('0x2d')],'sPositive':_0xa2f427[_0xd7fc('0x2e')][_0xd7fc('0x2f')],'sNegative':_0xa2f427[_0xd7fc('0x2e')][_0xd7fc('0x30')],'sMixed':_0xa2f427[_0xd7fc('0x2e')][_0xd7fc('0x31')],'sNeutral':_0xa2f427[_0xd7fc('0x2e')][_0xd7fc('0x32')],'transcribeStatus':_0xd7fc('0x13')});})[_0xd7fc('0x17')](function(){logger[_0xd7fc('0xd')](util[_0xd7fc('0xe')](_0xd7fc('0x1e'),_0x5ce35e['id']));_0x13edea();});}})['catch'](function(_0x4fc624){if(_0x4fc624){if(!_0x4fc624[_0xd7fc('0x3a')]||_0x4fc624[_0xd7fc('0x3a')]!==_0xd7fc('0x3b')){logger[_0xd7fc('0x3c')](util[_0xd7fc('0xe')](_0xd7fc('0x3d'),_0x5ce35e['id']),util[_0xd7fc('0x3e')](_0x4fc624,{'showHidden':![],'depth':null}));}}_0x13edea();});});}function checkTranscribe(){var _0x6658df;var _0x5317c0;var _0x15349f;return db[_0xd7fc('0x3f')][_0xd7fc('0x40')]({'where':{'transcribeStatus':_0xd7fc('0x41')}})['then'](function(_0x48f2ab){if(!_0x48f2ab||!_0x48f2ab[_0xd7fc('0x1b')]){throw new db[(_0xd7fc('0x22'))][(_0xd7fc('0x28'))](_0xd7fc('0x42'));}_0x6658df=_0x48f2ab;return db[_0xd7fc('0x43')][_0xd7fc('0x27')]({'where':{'id':0x1}});})['then'](function(_0x5c02ce){if(!_0x5c02ce){throw new db[(_0xd7fc('0x22'))]['ValidationError'](_0xd7fc('0x44'));}_0x5317c0=_0x5c02ce;if(!_0x5317c0['transcribe']||!_0x5317c0[_0xd7fc('0x45')]||!_0x5317c0['transcribeRegion']||!_0x5317c0[_0xd7fc('0x21')]||!_0x5317c0[_0xd7fc('0x37')]){throw new db['Sequelize'][(_0xd7fc('0x28'))](_0xd7fc('0x46'));}return db[_0xd7fc('0x26')][_0xd7fc('0x27')]({'where':{'id':_0x5317c0[_0xd7fc('0x45')]}});})['then'](function(_0x232595){if(!_0x232595){throw new db[(_0xd7fc('0x22'))]['ValidationError'](_0xd7fc('0x38'));}if(!_0x232595[_0xd7fc('0x29')]||!_0x232595['data2']){throw new db[(_0xd7fc('0x22'))][(_0xd7fc('0x28'))]('Cloud\x20Provider\x20not\x20configured');}_0x15349f=_0x232595;var _0x1a8c02=[];_0x6658df[_0xd7fc('0x47')](function(_0x51d8a0){_0x1a8c02['push'](checkTranscribeJob(_0x51d8a0,_0x5317c0,_0x15349f));});return BPromise[_0xd7fc('0x48')](_0x1a8c02);})[_0xd7fc('0x49')](function(_0x37ba54){if(_0x37ba54){if(!_0x37ba54[_0xd7fc('0x3a')]||_0x37ba54[_0xd7fc('0x3a')]!==_0xd7fc('0x3b')){logger[_0xd7fc('0x3c')](util['inspect'](_0x37ba54,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xdff3=['Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','resolve','tempSentiment','findOne','Sentiment','catch','name','SequelizeValidationError','error','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','inspect','start','aws-sdk','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','ValidationError'];(function(_0x7f3a9e,_0x4cf097){var _0x35a04b=function(_0x5c0970){while(--_0x5c0970){_0x7f3a9e['push'](_0x7f3a9e['shift']());}};_0x35a04b(++_0x4cf097);}(_0xdff3,0x69));var _0x3dff=function(_0x5ccf74,_0x564095){_0x5ccf74=_0x5ccf74-0x0;var _0x519b60=_0xdff3[_0x5ccf74];return _0x519b60;};var _=require('lodash');var AWS=require(_0x3dff('0x0'));var rp=require(_0x3dff('0x1'));var util=require('util');var BPromise=require(_0x3dff('0x2'));var db=require(_0x3dff('0x3'))['db'];var logger=require(_0x3dff('0x4'))(_0x3dff('0x5'));function getTranscriptionJob(_0xa191b8,_0x20dc71,_0x3aa1cf,_0x19e2f2){return new Promise(function(_0x26f291,_0x233ba2){var _0x505b31=new AWS['TranscribeService']({'accessKeyId':_0x20dc71,'secretAccessKey':_0xa191b8,'region':_0x3aa1cf});_0x505b31[_0x3dff('0x6')]({'TranscriptionJobName':_0x19e2f2},function(_0x2121b5,_0x117100){if(_0x2121b5){return _0x233ba2(_0x2121b5);}else{return _0x26f291(_0x117100);}});});}function sentiment(_0x1577c7,_0x3f7504,_0x3b491d,_0x366ca0,_0x21e5f4){return new Promise(function(_0x15fbad,_0x3fdb69){var _0x3b04ae=new AWS['Comprehend']({'accessKeyId':_0x3f7504,'secretAccessKey':_0x1577c7,'region':_0x3b491d});_0x3b04ae[_0x3dff('0x7')]({'Text':_0x366ca0,'LanguageCode':_0x21e5f4[_0x3dff('0x8')](0x0,0x2)},function(_0x3c317f,_0x21f9b2){if(_0x3c317f){return _0x3fdb69(_0x3c317f);}else{return _0x15fbad(_0x21f9b2);}});});}function checkTranscribeJob(_0x7638bc,_0x4ea1ef,_0x55e6a6){var _0x55572c;return new BPromise(function(_0x5bab84,_0x2ab59d){logger[_0x3dff('0x9')](util[_0x3dff('0xa')](_0x3dff('0xb'),_0x7638bc['id'],_0x7638bc[_0x3dff('0xc')]));return getTranscriptionJob(_0x55e6a6[_0x3dff('0xd')],_0x55e6a6[_0x3dff('0xe')],_0x4ea1ef[_0x3dff('0xf')],_0x7638bc['transcribeName'])[_0x3dff('0x10')](function(_0x58c76e){logger[_0x3dff('0x9')](util[_0x3dff('0xa')](_0x3dff('0x11'),_0x7638bc['id'],_0x7638bc[_0x3dff('0xc')],_0x58c76e[_0x3dff('0x12')]['TranscriptionJobStatus']));if(!_0x7638bc['fileText']){switch(_0x58c76e[_0x3dff('0x12')][_0x3dff('0x13')]){case'COMPLETED':var _0x139173={'transcribeStatus':_0x58c76e[_0x3dff('0x12')][_0x3dff('0x13')],'fileUri':_0x58c76e['TranscriptionJob']['Transcript'][_0x3dff('0x14')]};logger[_0x3dff('0x9')](util[_0x3dff('0xa')](_0x3dff('0x15'),_0x7638bc['id']));return rp({'uri':_0x58c76e[_0x3dff('0x12')][_0x3dff('0x16')][_0x3dff('0x14')],'json':!![]})[_0x3dff('0x10')](function(_0x56d856){logger['info'](util[_0x3dff('0xa')](_0x3dff('0x17'),_0x7638bc['id']));if(_0x56d856&&_0x56d856[_0x3dff('0x18')]&&_0x56d856[_0x3dff('0x18')][_0x3dff('0x19')]&&_0x56d856[_0x3dff('0x18')][_0x3dff('0x19')][_0x3dff('0x1a')]){_0x139173[_0x3dff('0x1b')]='';for(var _0x190139=0x0;_0x190139<_0x56d856[_0x3dff('0x18')]['transcripts'][_0x3dff('0x1a')];_0x190139++){_0x139173[_0x3dff('0x1b')]+=_0x56d856[_0x3dff('0x18')]['transcripts'][_0x190139][_0x3dff('0x1c')]+'';}}return _0x7638bc['update'](_0x139173);})[_0x3dff('0x10')](function(){logger[_0x3dff('0x9')](util['format'](_0x3dff('0x1d'),_0x7638bc['id']));if(!_0x7638bc['tempSentiment']){throw new db[(_0x3dff('0x1e'))]['ValidationError'](_0x3dff('0x1f'));}if(!_0x4ea1ef[_0x3dff('0x20')]||!_0x4ea1ef[_0x3dff('0x21')]||!_0x4ea1ef[_0x3dff('0x22')]||!_0x4ea1ef[_0x3dff('0x23')]||!_0x4ea1ef[_0x3dff('0x24')]){throw new db[(_0x3dff('0x1e'))]['ValidationError'](_0x3dff('0x25'));}if(!_0x139173['fileText']){throw new Error(_0x3dff('0x26'));}if(_0x4ea1ef['sentimentAccountId']===_0x55e6a6['id']){return _0x55e6a6;}else{return db[_0x3dff('0x27')]['findOne']({'where':{'id':_settings[_0x3dff('0x21')]}});}})[_0x3dff('0x10')](function(_0x55b7bf){if(!_0x55b7bf){throw new db[(_0x3dff('0x1e'))][(_0x3dff('0x28'))](_0x3dff('0x29'));}if(!_0x55b7bf[_0x3dff('0xd')]||!_0x55b7bf[_0x3dff('0xe')]){throw new db[(_0x3dff('0x1e'))]['ValidationError'](_0x3dff('0x2a'));}_0x55572c=_0x55b7bf;logger[_0x3dff('0x9')](util['format'](_0x3dff('0x2b'),_0x7638bc['id']));return sentiment(_0x55572c[_0x3dff('0xd')],_0x55572c[_0x3dff('0xe')],_0x4ea1ef[_0x3dff('0x22')],_0x139173[_0x3dff('0x1b')],_0x4ea1ef[_0x3dff('0x23')]);})[_0x3dff('0x10')](function(_0x3829c7){logger['info'](util[_0x3dff('0xa')](_0x3dff('0x2c'),_0x7638bc['id']));return _0x7638bc[_0x3dff('0x2d')]({'sentiment':_0x3829c7['Sentiment'],'sPositive':_0x3829c7[_0x3dff('0x2e')][_0x3dff('0x2f')],'sNegative':_0x3829c7[_0x3dff('0x2e')][_0x3dff('0x30')],'sMixed':_0x3829c7[_0x3dff('0x2e')][_0x3dff('0x31')],'sNeutral':_0x3829c7[_0x3dff('0x2e')][_0x3dff('0x32')]});})[_0x3dff('0x10')](function(){logger[_0x3dff('0x9')](util[_0x3dff('0xa')](_0x3dff('0x1d'),_0x7638bc['id']));_0x5bab84();});case _0x3dff('0x33'):return _0x7638bc[_0x3dff('0x2d')]({'transcribeStatus':_0x3dff('0x33'),'failureReason':_0x58c76e[_0x3dff('0x12')][_0x3dff('0x34')]})[_0x3dff('0x10')](function(){logger['info'](util[_0x3dff('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x7638bc['id']));_0x5bab84();});default:logger[_0x3dff('0x9')](util[_0x3dff('0xa')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x7638bc['id']));break;}}else{return BPromise[_0x3dff('0x35')]()[_0x3dff('0x10')](function(){if(!_0x7638bc[_0x3dff('0x36')]){throw new db[(_0x3dff('0x1e'))][(_0x3dff('0x28'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4ea1ef[_0x3dff('0x20')]||!_0x4ea1ef[_0x3dff('0x21')]||!_0x4ea1ef['sentimentRegion']||!_0x4ea1ef[_0x3dff('0x23')]||!_0x4ea1ef[_0x3dff('0x24')]){throw new db[(_0x3dff('0x1e'))]['ValidationError'](_0x3dff('0x25'));}if(!_0x7638bc[_0x3dff('0x1b')]){throw new Error(_0x3dff('0x26'));}if(_0x4ea1ef[_0x3dff('0x21')]===_0x55e6a6['id']){return _0x55e6a6;}else{return db[_0x3dff('0x27')][_0x3dff('0x37')]({'where':{'id':_settings[_0x3dff('0x21')]}});}})[_0x3dff('0x10')](function(_0x28aaa8){if(!_0x28aaa8){throw new db[(_0x3dff('0x1e'))]['ValidationError'](_0x3dff('0x29'));}if(!_0x28aaa8['data1']||!_0x28aaa8[_0x3dff('0xe')]){throw new db['Sequelize'][(_0x3dff('0x28'))](_0x3dff('0x2a'));}_0x55572c=_0x28aaa8;logger[_0x3dff('0x9')](util[_0x3dff('0xa')](_0x3dff('0x2b'),_0x7638bc['id']));return sentiment(_0x55572c[_0x3dff('0xd')],_0x55572c[_0x3dff('0xe')],_0x4ea1ef[_0x3dff('0x22')],_0x7638bc[_0x3dff('0x1b')],_0x4ea1ef[_0x3dff('0x23')]);})[_0x3dff('0x10')](function(_0x2c07b5){logger[_0x3dff('0x9')](util[_0x3dff('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x7638bc['id']));return _0x7638bc[_0x3dff('0x2d')]({'sentiment':_0x2c07b5[_0x3dff('0x38')],'sPositive':_0x2c07b5[_0x3dff('0x2e')]['Positive'],'sNegative':_0x2c07b5['SentimentScore'][_0x3dff('0x30')],'sMixed':_0x2c07b5[_0x3dff('0x2e')][_0x3dff('0x31')],'sNeutral':_0x2c07b5['SentimentScore']['Neutral'],'transcribeStatus':'COMPLETED'});})['then'](function(){logger['info'](util[_0x3dff('0xa')](_0x3dff('0x1d'),_0x7638bc['id']));_0x5bab84();});}})[_0x3dff('0x39')](function(_0x3666ef){if(_0x3666ef){if(!_0x3666ef[_0x3dff('0x3a')]||_0x3666ef[_0x3dff('0x3a')]!==_0x3dff('0x3b')){logger[_0x3dff('0x3c')](util[_0x3dff('0xa')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x7638bc['id']),util['inspect'](_0x3666ef,{'showHidden':![],'depth':null}));}}_0x5bab84();});});}function checkTranscribe(){var _0x3290f3;var _0x3db658;var _0x36f6a1;return db[_0x3dff('0x3d')][_0x3dff('0x3e')]({'where':{'transcribeStatus':_0x3dff('0x3f')}})['then'](function(_0x58ba5e){if(!_0x58ba5e||!_0x58ba5e[_0x3dff('0x1a')]){throw new db[(_0x3dff('0x1e'))][(_0x3dff('0x28'))](_0x3dff('0x40'));}_0x3290f3=_0x58ba5e;return db[_0x3dff('0x41')][_0x3dff('0x37')]({'where':{'id':0x1}});})['then'](function(_0x4680cb){if(!_0x4680cb){throw new db[(_0x3dff('0x1e'))][(_0x3dff('0x28'))](_0x3dff('0x42'));}_0x3db658=_0x4680cb;if(!_0x3db658[_0x3dff('0x5')]||!_0x3db658['transcribeAccountId']||!_0x3db658[_0x3dff('0xf')]||!_0x3db658[_0x3dff('0x23')]||!_0x3db658['bucket']){throw new db[(_0x3dff('0x1e'))][(_0x3dff('0x28'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x3dff('0x37')]({'where':{'id':_0x3db658[_0x3dff('0x43')]}});})[_0x3dff('0x10')](function(_0x543fd6){if(!_0x543fd6){throw new db[(_0x3dff('0x1e'))][(_0x3dff('0x28'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x543fd6[_0x3dff('0xd')]||!_0x543fd6[_0x3dff('0xe')]){throw new db['Sequelize'][(_0x3dff('0x28'))]('Cloud\x20Provider\x20not\x20configured');}_0x36f6a1=_0x543fd6;var _0x2b3d6c=[];_0x3290f3[_0x3dff('0x44')](function(_0x6660bb){_0x2b3d6c[_0x3dff('0x45')](checkTranscribeJob(_0x6660bb,_0x3db658,_0x36f6a1));});return BPromise[_0x3dff('0x46')](_0x2b3d6c);})[_0x3dff('0x39')](function(_0x4ddbb9){if(_0x4ddbb9){if(!_0x4ddbb9[_0x3dff('0x3a')]||_0x4ddbb9['name']!=='SequelizeValidationError'){logger['error'](util[_0x3dff('0x47')](_0x4ddbb9,{'showHidden':![],'depth':null}));}}});}exports[_0x3dff('0x48')]=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 d315c14..e38e00f 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb097=['Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo'];(function(_0x52ef79,_0x23f3f0){var _0x23f33f=function(_0x353634){while(--_0x353634){_0x52ef79['push'](_0x52ef79['shift']());}};_0x23f33f(++_0x23f3f0);}(_0xb097,0x178));var _0x7b09=function(_0x4fd149,_0x163b09){_0x4fd149=_0x4fd149-0x0;var _0x703385=_0xb097[_0x4fd149];return _0x703385;};'use strict';var util=require(_0x7b09('0x0'));var db=require(_0x7b09('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x7b09('0x2')]({'id':i,'firstName':_0x7b09('0x3')+i,'lastName':_0x7b09('0x4')+i,'phone':0xf879fb460+i,'email':_0x7b09('0x5')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x7b09('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7b09('0x6')](),'updatedAt':Date[_0x7b09('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x7b09('0x3')+i,'lastName':_0x7b09('0x4')+i,'phone':0xf879fb460+i,'email':_0x7b09('0x5')+i+_0x7b09('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x7b09('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x7b09('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x7b09('0x6')](),'updatedAt':Date[_0x7b09('0x6')]()});}db[_0x7b09('0x8')][_0x7b09('0x9')]({'where':{}})[_0x7b09('0xa')](function(){return db['CmContact'][_0x7b09('0xb')](contacts);})[_0x7b09('0xa')](function(){console[_0x7b09('0xc')](_0x7b09('0xd'),_0x7b09('0xe'));return db[_0x7b09('0xf')][_0x7b09('0x9')]({'where':{}});})[_0x7b09('0xa')](function(){return db[_0x7b09('0xf')]['bulkCreate'](hopper);})['then'](function(){console[_0x7b09('0xc')](_0x7b09('0xd'),_0x7b09('0x10'));return db['CmContact'][_0x7b09('0xb')](contacts2);})['then'](function(){console['log'](_0x7b09('0xd'),_0x7b09('0x11'));return db['CmHopper'][_0x7b09('0xb')](hopper2);})[_0x7b09('0xa')](function(){console[_0x7b09('0xc')]('finished\x20populating',_0x7b09('0x12'));})[_0x7b09('0x13')](function(_0x26c654){console[_0x7b09('0xc')](_0x26c654);}); \ No newline at end of file +var _0x713c=['util','push','Biondo','innocenzo.biondo','now','@xcally.com','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','contacts2','hopper2','catch'];(function(_0x52bd95,_0xdd96e6){var _0xae0ba=function(_0x56ba08){while(--_0x56ba08){_0x52bd95['push'](_0x52bd95['shift']());}};_0xae0ba(++_0xdd96e6);}(_0x713c,0x121));var _0xc713=function(_0x24dab5,_0x2d0ae0){_0x24dab5=_0x24dab5-0x0;var _0x325fce=_0x713c[_0x24dab5];return _0x325fce;};'use strict';var util=require(_0xc713('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xc713('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xc713('0x2')+i,'phone':0xf879fb460+i,'email':_0xc713('0x3')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xc713('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xc713('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xc713('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xc713('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xc713('0x2')+i,'phone':0xf879fb460+i,'email':_0xc713('0x3')+i+_0xc713('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xc713('0x1')]({'id':i,'active':![],'scheduledat':Date[_0xc713('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xc713('0x4')](),'updatedAt':Date[_0xc713('0x4')]()});}db[_0xc713('0x6')][_0xc713('0x7')]({'where':{}})[_0xc713('0x8')](function(){return db[_0xc713('0x6')]['bulkCreate'](contacts);})[_0xc713('0x8')](function(){console[_0xc713('0x9')](_0xc713('0xa'),_0xc713('0xb'));return db[_0xc713('0xc')][_0xc713('0x7')]({'where':{}});})[_0xc713('0x8')](function(){return db[_0xc713('0xc')][_0xc713('0xd')](hopper);})['then'](function(){console['log'](_0xc713('0xa'),'hopper1');return db[_0xc713('0x6')][_0xc713('0xd')](contacts2);})[_0xc713('0x8')](function(){console['log']('finished\x20populating',_0xc713('0xe'));return db[_0xc713('0xc')][_0xc713('0xd')](hopper2);})[_0xc713('0x8')](function(){console[_0xc713('0x9')](_0xc713('0xa'),_0xc713('0xf'));})[_0xc713('0x10')](function(_0x13c5cd){console[_0xc713('0x9')](_0x13c5cd);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index a32d0d5..1bc52a9 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1091=['push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','then','log','add\x20user','catch','util'];(function(_0x465dcb,_0x281765){var _0x4af0c8=function(_0x269144){while(--_0x269144){_0x465dcb['push'](_0x465dcb['shift']());}};_0x4af0c8(++_0x281765);}(_0x1091,0x12b));var _0x1109=function(_0x822bd8,_0x50e8d2){_0x822bd8=_0x822bd8-0x0;var _0x68a369=_0x1091[_0x822bd8];return _0x68a369;};'use strict';var util=require(_0x1109('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1109('0x1')]({'name':util[_0x1109('0x2')](_0x1109('0x3'),_0x1109('0x4'),i),'fullname':util['format'](_0x1109('0x3'),'agent',i),'email':util['format'](_0x1109('0x5'),'agent',i),'role':_0x1109('0x4'),'password':_0x1109('0x6'),'internal':0xfa0+i,'type':_0x1109('0x7'),'transport':[_0x1109('0x8'),'ws',_0x1109('0x9')],'disallow':['all'],'allow':[_0x1109('0xa')],'defaultuser':util['format'](_0x1109('0x3'),_0x1109('0x4'),i),'encryption':_0x1109('0xb'),'avpf':_0x1109('0xb'),'force_avp':_0x1109('0xb'),'icesupport':_0x1109('0xb'),'dtlsenable':_0x1109('0xb'),'dtlsverify':'no','dtlscertfile':_0x1109('0xc'),'dtlsprivatekey':_0x1109('0xd'),'dtlssetup':_0x1109('0xe'),'callerid':util[_0x1109('0x2')](_0x1109('0xf'),util['format'](_0x1109('0x3'),_0x1109('0x4'),i),0xfa0+i)});}db['User']['bulkCreate'](users)[_0x1109('0x10')](function(){console[_0x1109('0x11')](_0x1109('0x12'));})[_0x1109('0x13')](function(_0x5e939e){console[_0x1109('0x11')](_0x5e939e);}); \ No newline at end of file +var _0xf817=['bulkCreate','log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','password','friend','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','actpass','\x22%s\x22\x20<%s>','User'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0xf817,0xee));var _0x7f81=function(_0x379fb4,_0x154b16){_0x379fb4=_0x379fb4-0x0;var _0x3442f2=_0xf817[_0x379fb4];return _0x3442f2;};'use strict';var util=require('util');var db=require(_0x7f81('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7f81('0x1')]({'name':util[_0x7f81('0x2')](_0x7f81('0x3'),_0x7f81('0x4'),i),'fullname':util[_0x7f81('0x2')](_0x7f81('0x3'),'agent',i),'email':util['format']('%s%s@xcally.com',_0x7f81('0x4'),i),'role':_0x7f81('0x4'),'password':_0x7f81('0x5'),'internal':0xfa0+i,'type':_0x7f81('0x6'),'transport':['udp','ws','wss'],'disallow':[_0x7f81('0x7')],'allow':[_0x7f81('0x8')],'defaultuser':util[_0x7f81('0x2')](_0x7f81('0x3'),_0x7f81('0x4'),i),'encryption':_0x7f81('0x9'),'avpf':_0x7f81('0x9'),'force_avp':_0x7f81('0x9'),'icesupport':_0x7f81('0x9'),'dtlsenable':_0x7f81('0x9'),'dtlsverify':'no','dtlscertfile':_0x7f81('0xa'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x7f81('0xb'),'callerid':util['format'](_0x7f81('0xc'),util[_0x7f81('0x2')](_0x7f81('0x3'),'agent',i),0xfa0+i)});}db[_0x7f81('0xd')][_0x7f81('0xe')](users)['then'](function(){console[_0x7f81('0xf')](_0x7f81('0x10'));})[_0x7f81('0x11')](function(_0x4bd8d4){console['log'](_0x4bd8d4);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index f46d001..038353b 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b38=['FaxQueues','FaxQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','sms','openchannel','telephone:%s','trunk:%s','leave','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','log','default','connection','setMaxListeners','remoteAddress','request','remotePort','nsp','address','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','../mysqldb','./environment','Agents','User','role','agent','name','telephone','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','%s:queue:%s','length','format','user:%s','handshake','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','admin','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','OpenchannelQueue','user','voice:inbound','voice:outbound','ChatQueues'];(function(_0x39a270,_0xde30ec){var _0x3b3985=function(_0x48c5dc){while(--_0x48c5dc){_0x39a270['push'](_0x39a270['shift']());}};_0x3b3985(++_0xde30ec);}(_0x1b38,0xe5));var _0x81b3=function(_0x38ff5d,_0x1d13f3){_0x38ff5d=_0x38ff5d-0x0;var _0x4ddbf1=_0x1b38[_0x38ff5d];return _0x4ddbf1;};'use strict';var _=require(_0x81b3('0x0'));var util=require('util');var BPromise=require(_0x81b3('0x1'));var db=require(_0x81b3('0x2'))['db'];var config=require(_0x81b3('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x81b3('0x4'),'model':db[_0x81b3('0x5')],'attributes':['id','name',_0x81b3('0x6')],'raw':!![],'where':{'role':_0x81b3('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x81b3('0x8')],'where':{'role':_0x81b3('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x81b3('0x8')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x81b3('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x81b3('0x8'),_0x81b3('0xa')],'where':{'type':_0x81b3('0xb')}};function getAssociatedResources(_0xa96a16,_0x5b50c3,_0x4e0daa){return db[_0x81b3('0xc')][_0x81b3('0xd')]({'where':{'name':_0xa96a16,'userProfileId':_0x5b50c3},'raw':!![]})[_0x81b3('0xe')](function(_0x1cee68){if(_0x1cee68){if(_0x1cee68[_0x81b3('0xf')]){switch(_0xa96a16){case _0x81b3('0x10'):case'ChatQueues':case'FaxQueues':case _0x81b3('0x11'):case _0x81b3('0x12'):case _0x81b3('0x13'):return db[_0x4e0daa][_0x81b3('0x14')](queryQueues);case _0x81b3('0x15'):return db[_0x4e0daa]['findAll'](queryTelephones);case _0x81b3('0x16'):return db[_0x4e0daa][_0x81b3('0x14')](queryTrunks);case _0x81b3('0x17'):return db[_0x4e0daa][_0x81b3('0x14')](queryCampaigns);}}else{return db[_0x81b3('0x18')][_0x81b3('0x14')]({'attributes':[_0x81b3('0x19')],'where':{'sectionId':_0x1cee68['id']},'raw':!![]})[_0x81b3('0xe')](function(_0x48cfc4){if(_0x48cfc4){var _0x3deb9a={'where':{'id':_[_0x81b3('0x1a')](_0x48cfc4,'resourceId')},'raw':!![]};switch(_0x4e0daa){case'User':_0x3deb9a['where']['role']=_0x81b3('0x9');break;case'Campaign':_0x3deb9a['where'][_0x81b3('0xa')]=_0x81b3('0xb');break;}return db[_0x4e0daa]['findAll'](_0x3deb9a);}else{return[];}});}}else{return[];}})[_0x81b3('0xe')](function(_0x3a1931){return _0x3a1931;});}function joinOrLeaveQueues(_0x3827da,_0x1c651f,_0x597cb7,_0x27ab08){_0x3827da[_0x1c651f](util['format'](_0x81b3('0x1b'),_0x597cb7,_0x27ab08[_0x81b3('0x8')]));if(_0x27ab08['Agents']){for(var _0x5f4d18=0x0;_0x5f4d18<_0x27ab08[_0x81b3('0x4')][_0x81b3('0x1c')];_0x5f4d18+=0x1){_0x3827da[_0x1c651f](util[_0x81b3('0x1d')](_0x81b3('0x1e'),_0x27ab08['Agents'][_0x5f4d18][_0x81b3('0x8')]));}}}function joinOrLeave(_0x4c0725,_0x4465bc,_0x103629){var _0x1e133d;if(_0x4c0725[_0x81b3('0x1f')]['query']['id']){db[_0x81b3('0x5')]['find']({'attributes':['id',_0x81b3('0x8'),_0x81b3('0x6'),_0x81b3('0x20')],'where':{'id':_0x4c0725[_0x81b3('0x1f')][_0x81b3('0x21')]['id']},'include':[{'model':db[_0x81b3('0x22')],'as':_0x81b3('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x81b3('0x24')],'as':_0x81b3('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x81b3('0x26')],'as':_0x81b3('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x81b3('0x28')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x81b3('0x29')],'as':_0x81b3('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x81b3('0xe')](function(_0x263867){if(_0x263867){_0x1e133d=_0x263867;_0x4c0725[_0x4465bc](util[_0x81b3('0x1d')](_0x81b3('0x1e'),_0x263867[_0x81b3('0x8')]));var _0x5cbad2=[];switch(_0x263867['role']){case _0x81b3('0x2b'):_0x4c0725[_0x4465bc]('voice:inbound');_0x4c0725[_0x4465bc]('voice:outbound');if(queryQueues[_0x81b3('0x2c')](_0x81b3('0x2d'))){delete queryQueues[_0x81b3('0x2d')];}_0x5cbad2[_0x81b3('0x2e')](db[_0x81b3('0x2f')]['findAll'](queryQueues));_0x5cbad2[_0x81b3('0x2e')](db[_0x81b3('0x30')][_0x81b3('0x14')](queryQueues));_0x5cbad2[_0x81b3('0x2e')](db['FaxQueue'][_0x81b3('0x14')](queryQueues));_0x5cbad2['push'](db[_0x81b3('0x31')][_0x81b3('0x14')](queryQueues));_0x5cbad2[_0x81b3('0x2e')](db[_0x81b3('0x32')][_0x81b3('0x14')](queryQueues));_0x5cbad2[_0x81b3('0x2e')](db[_0x81b3('0x33')][_0x81b3('0x14')](queryQueues));_0x5cbad2[_0x81b3('0x2e')](db['User']['findAll'](queryTelephones));_0x5cbad2[_0x81b3('0x2e')](db['Trunk'][_0x81b3('0x14')](queryTrunks));_0x5cbad2[_0x81b3('0x2e')](db['Campaign'][_0x81b3('0x14')](queryCampaigns));_0x5cbad2[_0x81b3('0x2e')](db[_0x81b3('0x5')][_0x81b3('0x14')](queryAgents));break;case _0x81b3('0x34'):_0x4c0725[_0x4465bc](_0x81b3('0x35'));_0x4c0725[_0x4465bc](_0x81b3('0x36'));_0x5cbad2[_0x81b3('0x2e')](getAssociatedResources('VoiceQueues',_0x263867[_0x81b3('0x20')],'VoiceQueue'));_0x5cbad2['push'](getAssociatedResources(_0x81b3('0x37'),_0x263867[_0x81b3('0x20')],_0x81b3('0x30')));_0x5cbad2[_0x81b3('0x2e')](getAssociatedResources(_0x81b3('0x38'),_0x263867[_0x81b3('0x20')],_0x81b3('0x39')));_0x5cbad2['push'](getAssociatedResources(_0x81b3('0x11'),_0x263867['userProfileId'],_0x81b3('0x31')));_0x5cbad2['push'](getAssociatedResources(_0x81b3('0x12'),_0x263867[_0x81b3('0x20')],_0x81b3('0x32')));_0x5cbad2['push'](getAssociatedResources(_0x81b3('0x13'),_0x263867['userProfileId'],_0x81b3('0x33')));_0x5cbad2[_0x81b3('0x2e')](getAssociatedResources(_0x81b3('0x15'),_0x263867[_0x81b3('0x20')],'User'));_0x5cbad2[_0x81b3('0x2e')](getAssociatedResources('Trunks',_0x263867['userProfileId'],_0x81b3('0x3a')));_0x5cbad2[_0x81b3('0x2e')](getAssociatedResources(_0x81b3('0x17'),_0x263867[_0x81b3('0x20')],'Campaign'));_0x5cbad2[_0x81b3('0x2e')](db['User'][_0x81b3('0x14')](queryAgents));break;case _0x81b3('0x7'):_0x4c0725[_0x4465bc](_0x81b3('0x35'));_0x4c0725[_0x4465bc](_0x81b3('0x36'));_0x5cbad2[_0x81b3('0x2e')](_0x263867[_0x81b3('0x3b')]({'attributes':['id',_0x81b3('0x8')]}));_0x5cbad2[_0x81b3('0x2e')](_0x263867[_0x81b3('0x3c')]({'attributes':['id','name']}));_0x5cbad2[_0x81b3('0x2e')](_0x263867[_0x81b3('0x3d')]({'attributes':['id','name']}));_0x5cbad2[_0x81b3('0x2e')](_0x263867['getSmsQueues']({'attributes':['id',_0x81b3('0x8')]}));_0x5cbad2[_0x81b3('0x2e')](_0x263867[_0x81b3('0x3e')]({'attributes':['id',_0x81b3('0x8')]}));_0x5cbad2[_0x81b3('0x2e')](_0x263867[_0x81b3('0x3f')]({'attributes':['id',_0x81b3('0x8')]}));break;}return BPromise[_0x81b3('0x40')](_0x5cbad2);}})[_0x81b3('0xe')](function(_0x115c84){if(_0x115c84&&_0x115c84[_0x81b3('0x1c')]){for(var _0x43414f=0x0;_0x43414f<_0x115c84[_0x81b3('0x1c')];_0x43414f+=0x1){for(var _0xa5d3a1=0x0;_0xa5d3a1<_0x115c84[_0x43414f][_0x81b3('0x1c')];_0xa5d3a1+=0x1){switch(_0x43414f){case 0x0:joinOrLeaveQueues(_0x4c0725,_0x4465bc,_0x81b3('0x41'),_0x115c84[_0x43414f][_0xa5d3a1]);break;case 0x1:joinOrLeaveQueues(_0x4c0725,_0x4465bc,_0x81b3('0x42'),_0x115c84[_0x43414f][_0xa5d3a1]);break;case 0x2:joinOrLeaveQueues(_0x4c0725,_0x4465bc,_0x81b3('0x43'),_0x115c84[_0x43414f][_0xa5d3a1]);break;case 0x3:joinOrLeaveQueues(_0x4c0725,_0x4465bc,_0x81b3('0x44'),_0x115c84[_0x43414f][_0xa5d3a1]);break;case 0x4:joinOrLeaveQueues(_0x4c0725,_0x4465bc,'mail',_0x115c84[_0x43414f][_0xa5d3a1]);break;case 0x5:joinOrLeaveQueues(_0x4c0725,_0x4465bc,_0x81b3('0x45'),_0x115c84[_0x43414f][_0xa5d3a1]);break;case 0x6:_0x4c0725[_0x4465bc](util[_0x81b3('0x1d')](_0x81b3('0x46'),_0x115c84[_0x43414f][_0xa5d3a1][_0x81b3('0x8')]));break;case 0x7:_0x4c0725[_0x4465bc](util[_0x81b3('0x1d')](_0x81b3('0x47'),_0x115c84[_0x43414f][_0xa5d3a1][_0x81b3('0x8')]));break;case 0x8:_0x4c0725[_0x4465bc](util['format']('campaign:%s:%s',_0x115c84[_0x43414f][_0xa5d3a1][_0x81b3('0xa')],_0x115c84[_0x43414f][_0xa5d3a1][_0x81b3('0x8')]));break;case 0x9:_0x4c0725[_0x4465bc](util[_0x81b3('0x1d')]('user:%s',_0x115c84[_0x43414f][_0xa5d3a1][_0x81b3('0x8')]));break;}}}}})[_0x81b3('0xe')](function(){if(_0x4465bc===_0x81b3('0x48')){var _0x2566af=_[_0x81b3('0x1a')](_0x1e133d[_0x81b3('0x23')],'id');return _0x1e133d[_0x81b3('0x49')](_0x2566af)['then'](function(){for(var _0xeefbf3=0x0;_0xeefbf3<_0x2566af['length'];_0xeefbf3+=0x1){_0x103629['emit'](_0x81b3('0x4a'),{'ChatInteractionId':Number(_0x2566af[_0xeefbf3]),'UserId':Number(_0x1e133d['id'])});}});}})[_0x81b3('0xe')](function(){if(_0x4465bc===_0x81b3('0x48')){var _0x51fa24=_[_0x81b3('0x1a')](_0x1e133d['MailInteractions'],'id');return _0x1e133d[_0x81b3('0x4b')](_0x51fa24)['then'](function(){for(var _0x1d4a6a=0x0;_0x1d4a6a<_0x51fa24[_0x81b3('0x1c')];_0x1d4a6a+=0x1){_0x103629['emit'](_0x81b3('0x4c'),{'MailInteractionId':Number(_0x51fa24[_0x1d4a6a]),'UserId':Number(_0x1e133d['id'])});}});}})[_0x81b3('0xe')](function(){if(_0x4465bc===_0x81b3('0x48')){var _0x162247=_[_0x81b3('0x1a')](_0x1e133d[_0x81b3('0x27')],'id');return _0x1e133d[_0x81b3('0x4d')](_0x162247)[_0x81b3('0xe')](function(){for(var _0x5d5a32=0x0;_0x5d5a32<_0x162247[_0x81b3('0x1c')];_0x5d5a32+=0x1){_0x103629[_0x81b3('0x4e')](_0x81b3('0x4f'),{'FaxInteractionId':Number(_0x162247[_0x5d5a32]),'UserId':Number(_0x1e133d['id'])});}});}})[_0x81b3('0xe')](function(){if(_0x4465bc==='leave'){var _0x3fb30c=_[_0x81b3('0x1a')](_0x1e133d['SmsInteractions'],'id');return _0x1e133d[_0x81b3('0x50')](_0x3fb30c)[_0x81b3('0xe')](function(){for(var _0x32a68c=0x0;_0x32a68c<_0x3fb30c['length'];_0x32a68c+=0x1){_0x103629[_0x81b3('0x4e')](_0x81b3('0x51'),{'SmsInteractionId':Number(_0x3fb30c[_0x32a68c]),'UserId':Number(_0x1e133d['id'])});}});}})[_0x81b3('0xe')](function(){if(_0x4465bc===_0x81b3('0x48')){var _0x1e2bbe=_['map'](_0x1e133d[_0x81b3('0x2a')],'id');return _0x1e133d['removeOpenchannelInteractions'](_0x1e2bbe)[_0x81b3('0xe')](function(){for(var _0x5c3cec=0x0;_0x5c3cec<_0x1e2bbe[_0x81b3('0x1c')];_0x5c3cec+=0x1){_0x103629[_0x81b3('0x4e')](_0x81b3('0x52'),{'OpenchannelInteractionId':Number(_0x1e2bbe[_0x5c3cec]),'UserId':Number(_0x1e133d['id'])});}});}})['catch'](function(_0x48ccbf){_0x4c0725[_0x81b3('0x53')](_0x48ccbf);});}}function onDisconnect(_0x3e196b,_0x251943){joinOrLeave(_0x3e196b,'leave',_0x251943);}function onConnect(_0x3b1259){joinOrLeave(_0x3b1259,'join');}exports[_0x81b3('0x54')]=function(_0x10376a){_0x10376a['on'](_0x81b3('0x55'),function(_0x78c8b){_0x78c8b[_0x81b3('0x56')](0x0);_0x78c8b['address']=_0x78c8b['request'][_0x81b3('0x55')][_0x81b3('0x57')]+':'+_0x78c8b[_0x81b3('0x58')]['connection'][_0x81b3('0x59')];_0x78c8b['connectedAt']=new Date();_0x78c8b['log']=function(_0xf51a1e){console['log']('SocketIO\x20'+_0x78c8b[_0x81b3('0x5a')][_0x81b3('0x8')]+'['+_0x78c8b[_0x81b3('0x5b')]+']',_0xf51a1e);};_0x78c8b['on'](_0x81b3('0x5c'),function(){onDisconnect(_0x78c8b,_0x10376a);_0x78c8b['log'](_0x81b3('0x5d'));});onConnect(_0x78c8b);_0x78c8b[_0x81b3('0x53')](_0x81b3('0x5e'));});}; \ No newline at end of file +var _0x7109=['length','handshake','query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','user:%s','voice:inbound','voice:outbound','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','user','VoiceQueue','Campaign','getVoiceQueues','getChatQueues','getOpenchannelQueues','all','chat','fax','sms','mail','openchannel','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','FaxInteractions','removeFaxInteractions','emit','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','connectedAt','SocketIO\x20','nsp','CONNECTED','lodash','bluebird','../mysqldb','name','User','role','telephone','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','Telephones','findAll','Trunks','IvrCampaigns','resourceId','map','where','type','format','%s:queue:%s','Agents'];(function(_0x5d6d10,_0x3f3f77){var _0xcf88ce=function(_0x3818e3){while(--_0x3818e3){_0x5d6d10['push'](_0x5d6d10['shift']());}};_0xcf88ce(++_0x3f3f77);}(_0x7109,0x146));var _0x9710=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0x7109[_0x2678d6];return _0x475503;};'use strict';var _=require(_0x9710('0x0'));var util=require('util');var BPromise=require(_0x9710('0x1'));var db=require(_0x9710('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x9710('0x3')],'include':[{'as':'Agents','model':db[_0x9710('0x4')],'attributes':['id','name',_0x9710('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9710('0x3')],'where':{'role':_0x9710('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x9710('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x9710('0x3')],'where':{'role':_0x9710('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9710('0x3'),'type'],'where':{'type':_0x9710('0x8')}};function getAssociatedResources(_0x3f6114,_0x3d5692,_0x1a04a2){return db[_0x9710('0x9')][_0x9710('0xa')]({'where':{'name':_0x3f6114,'userProfileId':_0x3d5692},'raw':!![]})[_0x9710('0xb')](function(_0x1e9fd9){if(_0x1e9fd9){if(_0x1e9fd9[_0x9710('0xc')]){switch(_0x3f6114){case _0x9710('0xd'):case _0x9710('0xe'):case _0x9710('0xf'):case _0x9710('0x10'):case _0x9710('0x11'):case _0x9710('0x12'):return db[_0x1a04a2]['findAll'](queryQueues);case _0x9710('0x13'):return db[_0x1a04a2][_0x9710('0x14')](queryTelephones);case _0x9710('0x15'):return db[_0x1a04a2][_0x9710('0x14')](queryTrunks);case _0x9710('0x16'):return db[_0x1a04a2][_0x9710('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0x9710('0x14')]({'attributes':[_0x9710('0x17')],'where':{'sectionId':_0x1e9fd9['id']},'raw':!![]})[_0x9710('0xb')](function(_0x579633){if(_0x579633){var _0x828949={'where':{'id':_[_0x9710('0x18')](_0x579633,'resourceId')},'raw':!![]};switch(_0x1a04a2){case _0x9710('0x4'):_0x828949['where'][_0x9710('0x5')]=_0x9710('0x6');break;case'Campaign':_0x828949[_0x9710('0x19')][_0x9710('0x1a')]='ivr';break;}return db[_0x1a04a2]['findAll'](_0x828949);}else{return[];}});}}else{return[];}})[_0x9710('0xb')](function(_0x453d73){return _0x453d73;});}function joinOrLeaveQueues(_0x16edf3,_0x1912e4,_0x356a7c,_0x57e7b7){_0x16edf3[_0x1912e4](util[_0x9710('0x1b')](_0x9710('0x1c'),_0x356a7c,_0x57e7b7[_0x9710('0x3')]));if(_0x57e7b7[_0x9710('0x1d')]){for(var _0x1d355c=0x0;_0x1d355c<_0x57e7b7[_0x9710('0x1d')][_0x9710('0x1e')];_0x1d355c+=0x1){_0x16edf3[_0x1912e4](util[_0x9710('0x1b')]('user:%s',_0x57e7b7['Agents'][_0x1d355c][_0x9710('0x3')]));}}}function joinOrLeave(_0x408919,_0x41a23f,_0x1e224e){var _0x229e41;if(_0x408919[_0x9710('0x1f')][_0x9710('0x20')]['id']){db['User'][_0x9710('0x21')]({'attributes':['id',_0x9710('0x3'),_0x9710('0x5'),_0x9710('0x22')],'where':{'id':_0x408919['handshake']['query']['id']},'include':[{'model':db[_0x9710('0x23')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9710('0x24')],'as':_0x9710('0x25'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9710('0x26')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9710('0x27')],'as':_0x9710('0x28'),'attributes':['id'],'raw':!![]}]})[_0x9710('0xb')](function(_0x1291db){if(_0x1291db){_0x229e41=_0x1291db;_0x408919[_0x41a23f](util[_0x9710('0x1b')](_0x9710('0x29'),_0x1291db[_0x9710('0x3')]));var _0x5e47dc=[];switch(_0x1291db[_0x9710('0x5')]){case'admin':_0x408919[_0x41a23f](_0x9710('0x2a'));_0x408919[_0x41a23f](_0x9710('0x2b'));if(queryQueues['hasOwnProperty'](_0x9710('0x2c'))){delete queryQueues[_0x9710('0x2c')];}_0x5e47dc[_0x9710('0x2d')](db['VoiceQueue'][_0x9710('0x14')](queryQueues));_0x5e47dc[_0x9710('0x2d')](db[_0x9710('0x2e')][_0x9710('0x14')](queryQueues));_0x5e47dc['push'](db[_0x9710('0x2f')][_0x9710('0x14')](queryQueues));_0x5e47dc[_0x9710('0x2d')](db[_0x9710('0x30')][_0x9710('0x14')](queryQueues));_0x5e47dc[_0x9710('0x2d')](db[_0x9710('0x31')][_0x9710('0x14')](queryQueues));_0x5e47dc[_0x9710('0x2d')](db[_0x9710('0x32')][_0x9710('0x14')](queryQueues));_0x5e47dc[_0x9710('0x2d')](db[_0x9710('0x4')]['findAll'](queryTelephones));_0x5e47dc['push'](db[_0x9710('0x33')]['findAll'](queryTrunks));_0x5e47dc[_0x9710('0x2d')](db['Campaign'][_0x9710('0x14')](queryCampaigns));_0x5e47dc[_0x9710('0x2d')](db['User'][_0x9710('0x14')](queryAgents));break;case _0x9710('0x34'):_0x408919[_0x41a23f]('voice:inbound');_0x408919[_0x41a23f]('voice:outbound');_0x5e47dc['push'](getAssociatedResources('VoiceQueues',_0x1291db[_0x9710('0x22')],_0x9710('0x35')));_0x5e47dc['push'](getAssociatedResources(_0x9710('0xe'),_0x1291db['userProfileId'],_0x9710('0x2e')));_0x5e47dc[_0x9710('0x2d')](getAssociatedResources(_0x9710('0xf'),_0x1291db['userProfileId'],'FaxQueue'));_0x5e47dc[_0x9710('0x2d')](getAssociatedResources(_0x9710('0x10'),_0x1291db[_0x9710('0x22')],_0x9710('0x30')));_0x5e47dc[_0x9710('0x2d')](getAssociatedResources('MailQueues',_0x1291db[_0x9710('0x22')],_0x9710('0x31')));_0x5e47dc[_0x9710('0x2d')](getAssociatedResources(_0x9710('0x12'),_0x1291db['userProfileId'],_0x9710('0x32')));_0x5e47dc[_0x9710('0x2d')](getAssociatedResources(_0x9710('0x13'),_0x1291db[_0x9710('0x22')],'User'));_0x5e47dc[_0x9710('0x2d')](getAssociatedResources('Trunks',_0x1291db[_0x9710('0x22')],_0x9710('0x33')));_0x5e47dc['push'](getAssociatedResources(_0x9710('0x16'),_0x1291db[_0x9710('0x22')],_0x9710('0x36')));_0x5e47dc[_0x9710('0x2d')](db[_0x9710('0x4')][_0x9710('0x14')](queryAgents));break;case _0x9710('0x7'):_0x408919[_0x41a23f](_0x9710('0x2a'));_0x408919[_0x41a23f]('voice:outbound');_0x5e47dc[_0x9710('0x2d')](_0x1291db[_0x9710('0x37')]({'attributes':['id',_0x9710('0x3')]}));_0x5e47dc['push'](_0x1291db[_0x9710('0x38')]({'attributes':['id',_0x9710('0x3')]}));_0x5e47dc[_0x9710('0x2d')](_0x1291db['getFaxQueues']({'attributes':['id',_0x9710('0x3')]}));_0x5e47dc[_0x9710('0x2d')](_0x1291db['getSmsQueues']({'attributes':['id',_0x9710('0x3')]}));_0x5e47dc[_0x9710('0x2d')](_0x1291db['getMailQueues']({'attributes':['id',_0x9710('0x3')]}));_0x5e47dc[_0x9710('0x2d')](_0x1291db[_0x9710('0x39')]({'attributes':['id',_0x9710('0x3')]}));break;}return BPromise[_0x9710('0x3a')](_0x5e47dc);}})[_0x9710('0xb')](function(_0x4885f8){if(_0x4885f8&&_0x4885f8[_0x9710('0x1e')]){for(var _0x365e67=0x0;_0x365e67<_0x4885f8[_0x9710('0x1e')];_0x365e67+=0x1){for(var _0x18e800=0x0;_0x18e800<_0x4885f8[_0x365e67][_0x9710('0x1e')];_0x18e800+=0x1){switch(_0x365e67){case 0x0:joinOrLeaveQueues(_0x408919,_0x41a23f,'voice',_0x4885f8[_0x365e67][_0x18e800]);break;case 0x1:joinOrLeaveQueues(_0x408919,_0x41a23f,_0x9710('0x3b'),_0x4885f8[_0x365e67][_0x18e800]);break;case 0x2:joinOrLeaveQueues(_0x408919,_0x41a23f,_0x9710('0x3c'),_0x4885f8[_0x365e67][_0x18e800]);break;case 0x3:joinOrLeaveQueues(_0x408919,_0x41a23f,_0x9710('0x3d'),_0x4885f8[_0x365e67][_0x18e800]);break;case 0x4:joinOrLeaveQueues(_0x408919,_0x41a23f,_0x9710('0x3e'),_0x4885f8[_0x365e67][_0x18e800]);break;case 0x5:joinOrLeaveQueues(_0x408919,_0x41a23f,_0x9710('0x3f'),_0x4885f8[_0x365e67][_0x18e800]);break;case 0x6:_0x408919[_0x41a23f](util['format']('telephone:%s',_0x4885f8[_0x365e67][_0x18e800][_0x9710('0x3')]));break;case 0x7:_0x408919[_0x41a23f](util[_0x9710('0x1b')](_0x9710('0x40'),_0x4885f8[_0x365e67][_0x18e800]['name']));break;case 0x8:_0x408919[_0x41a23f](util[_0x9710('0x1b')](_0x9710('0x41'),_0x4885f8[_0x365e67][_0x18e800][_0x9710('0x1a')],_0x4885f8[_0x365e67][_0x18e800][_0x9710('0x3')]));break;case 0x9:_0x408919[_0x41a23f](util[_0x9710('0x1b')]('user:%s',_0x4885f8[_0x365e67][_0x18e800][_0x9710('0x3')]));break;}}}}})['then'](function(){if(_0x41a23f===_0x9710('0x42')){var _0x568d1b=_[_0x9710('0x18')](_0x229e41[_0x9710('0x43')],'id');return _0x229e41[_0x9710('0x44')](_0x568d1b)[_0x9710('0xb')](function(){for(var _0x362b82=0x0;_0x362b82<_0x568d1b[_0x9710('0x1e')];_0x362b82+=0x1){_0x1e224e['emit'](_0x9710('0x45'),{'ChatInteractionId':Number(_0x568d1b[_0x362b82]),'UserId':Number(_0x229e41['id'])});}});}})[_0x9710('0xb')](function(){if(_0x41a23f===_0x9710('0x42')){var _0x4a34fc=_[_0x9710('0x18')](_0x229e41[_0x9710('0x25')],'id');return _0x229e41['removeMailInteractions'](_0x4a34fc)['then'](function(){for(var _0x86b588=0x0;_0x86b588<_0x4a34fc['length'];_0x86b588+=0x1){_0x1e224e['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4a34fc[_0x86b588]),'UserId':Number(_0x229e41['id'])});}});}})['then'](function(){if(_0x41a23f===_0x9710('0x42')){var _0x4a09ae=_[_0x9710('0x18')](_0x229e41[_0x9710('0x46')],'id');return _0x229e41[_0x9710('0x47')](_0x4a09ae)[_0x9710('0xb')](function(){for(var _0x307d52=0x0;_0x307d52<_0x4a09ae[_0x9710('0x1e')];_0x307d52+=0x1){_0x1e224e[_0x9710('0x48')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x4a09ae[_0x307d52]),'UserId':Number(_0x229e41['id'])});}});}})[_0x9710('0xb')](function(){if(_0x41a23f==='leave'){var _0x4b2407=_[_0x9710('0x18')](_0x229e41[_0x9710('0x49')],'id');return _0x229e41[_0x9710('0x4a')](_0x4b2407)[_0x9710('0xb')](function(){for(var _0x3db7d9=0x0;_0x3db7d9<_0x4b2407[_0x9710('0x1e')];_0x3db7d9+=0x1){_0x1e224e['emit'](_0x9710('0x4b'),{'SmsInteractionId':Number(_0x4b2407[_0x3db7d9]),'UserId':Number(_0x229e41['id'])});}});}})[_0x9710('0xb')](function(){if(_0x41a23f===_0x9710('0x42')){var _0x5f4b7c=_[_0x9710('0x18')](_0x229e41['OpenchannelInteractions'],'id');return _0x229e41[_0x9710('0x4c')](_0x5f4b7c)[_0x9710('0xb')](function(){for(var _0x4f7e39=0x0;_0x4f7e39<_0x5f4b7c[_0x9710('0x1e')];_0x4f7e39+=0x1){_0x1e224e[_0x9710('0x48')](_0x9710('0x4d'),{'OpenchannelInteractionId':Number(_0x5f4b7c[_0x4f7e39]),'UserId':Number(_0x229e41['id'])});}});}})[_0x9710('0x4e')](function(_0x2a304d){_0x408919[_0x9710('0x4f')](_0x2a304d);});}}function onDisconnect(_0x474bbf,_0x1d4789){joinOrLeave(_0x474bbf,_0x9710('0x42'),_0x1d4789);}function onConnect(_0x827913){joinOrLeave(_0x827913,'join');}exports[_0x9710('0x50')]=function(_0x4cf8b5){_0x4cf8b5['on'](_0x9710('0x51'),function(_0x3a6ecf){_0x3a6ecf[_0x9710('0x52')](0x0);_0x3a6ecf[_0x9710('0x53')]=_0x3a6ecf[_0x9710('0x54')]['connection']['remoteAddress']+':'+_0x3a6ecf[_0x9710('0x54')][_0x9710('0x51')]['remotePort'];_0x3a6ecf[_0x9710('0x55')]=new Date();_0x3a6ecf[_0x9710('0x4f')]=function(_0x190fd1){console[_0x9710('0x4f')](_0x9710('0x56')+_0x3a6ecf[_0x9710('0x57')][_0x9710('0x3')]+'['+_0x3a6ecf['address']+']',_0x190fd1);};_0x3a6ecf['on']('disconnect',function(){onDisconnect(_0x3a6ecf,_0x4cf8b5);_0x3a6ecf[_0x9710('0x4f')]('DISCONNECTED');});onConnect(_0x3a6ecf);_0x3a6ecf[_0x9710('0x4f')](_0x9710('0x58'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 299c557..f0381ce 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 _0xcbb9=['jayson/promise','../logger','triggers','http','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','afterCreate','newmessage','Sms','SmsMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','catch','Trigger,\x20%s','channel','event','UserId','User','find','name','interface','SIP/%s','incomingmessage','opened','closed','default','hasOwnProperty','model','callback','toLowerCase','condition','../../mysqldb'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xcbb9,0x14f));var _0x9cbb=function(_0x576982,_0x533ea4){_0x576982=_0x576982-0x0;var _0x543821=_0xcbb9[_0x576982];return _0x543821;};'use strict';var util=require('util');var db=require(_0x9cbb('0x0'))['db'];var jayson=require(_0x9cbb('0x1'));var logger=require(_0x9cbb('0x2'))(_0x9cbb('0x3'));var client=jayson['client'][_0x9cbb('0x4')]({'port':0x232a});var triggers=[{'channel':_0x9cbb('0x5'),'model':_0x9cbb('0x6'),'event':'afterCreate','condition':_0x9cbb('0x7'),'callback':afterCreate},{'channel':_0x9cbb('0x5'),'model':'ChatInteraction','event':_0x9cbb('0x8'),'condition':_0x9cbb('0x9'),'callback':afterUpdate},{'channel':'Chat','model':'ChatMessage','event':_0x9cbb('0xa'),'condition':_0x9cbb('0xb'),'callback':afterCreateMessage},{'channel':_0x9cbb('0xc'),'model':'SmsInteraction','event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x9cbb('0xc'),'model':'SmsInteraction','event':'afterUpdate','condition':_0x9cbb('0x9'),'callback':afterUpdate},{'channel':_0x9cbb('0xc'),'model':_0x9cbb('0xd'),'event':'afterCreate','condition':_0x9cbb('0xb'),'callback':afterCreateMessage},{'channel':_0x9cbb('0xe'),'model':'FaxInteraction','event':_0x9cbb('0xa'),'condition':_0x9cbb('0x7'),'callback':afterCreate},{'channel':_0x9cbb('0xe'),'model':_0x9cbb('0xf'),'event':_0x9cbb('0x8'),'condition':_0x9cbb('0x9'),'callback':afterUpdate},{'channel':_0x9cbb('0xe'),'model':_0x9cbb('0x10'),'event':_0x9cbb('0xa'),'condition':_0x9cbb('0xb'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x9cbb('0x11'),'event':_0x9cbb('0xa'),'condition':_0x9cbb('0x7'),'callback':afterCreate},{'channel':_0x9cbb('0x12'),'model':_0x9cbb('0x11'),'event':_0x9cbb('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0x9cbb('0x13'),'event':_0x9cbb('0xa'),'condition':_0x9cbb('0xb'),'callback':afterCreateMessage},{'channel':_0x9cbb('0x14'),'model':_0x9cbb('0x15'),'event':_0x9cbb('0xa'),'condition':_0x9cbb('0x7'),'callback':afterCreate},{'channel':_0x9cbb('0x14'),'model':'OpenchannelInteraction','event':_0x9cbb('0x8'),'condition':_0x9cbb('0x9'),'callback':afterUpdate},{'channel':_0x9cbb('0x14'),'model':_0x9cbb('0x16'),'event':_0x9cbb('0xa'),'condition':_0x9cbb('0xb'),'callback':afterCreateMessage}];function request(_0x25636c){return client[_0x9cbb('0x17')](_0x9cbb('0x18'),_0x25636c)[_0x9cbb('0x19')](function(_0x23511d){logger[_0x9cbb('0x1a')]('Trigger,\x20%s','EventManager',_0x23511d);if(_0x23511d[_0x9cbb('0x1b')]){if(_0x23511d[_0x9cbb('0x1b')][_0x9cbb('0x1c')]===0x1f4){logger[_0x9cbb('0x1b')]('Trigger,\x20%s',_0x9cbb('0x18'),_0x23511d[_0x9cbb('0x1b')]);}}})[_0x9cbb('0x1d')](function(_0x566f8c){logger['error'](_0x9cbb('0x1e'),_0x9cbb('0x18'),_0x566f8c);});}function afterCreateMessage(_0x195c29,_0x2ae7e6){return function(_0x27eb9c,_0x3eb7d9){_0x27eb9c=_0x27eb9c['get']({'plain':!![]});_0x27eb9c[_0x9cbb('0x1f')]=_0x195c29;_0x27eb9c[_0x9cbb('0x20')]=_0x27eb9c['direction'];if(_0x27eb9c[_0x9cbb('0x21')]){return db[_0x9cbb('0x22')][_0x9cbb('0x23')]({'where':{'id':_0x27eb9c[_0x9cbb('0x21')]},'attributes':['id',_0x9cbb('0x24')],'raw':!![]})[_0x9cbb('0x19')](function(_0x12402f){_0x27eb9c[_0x9cbb('0x25')]=util['format'](_0x9cbb('0x26'),_0x12402f[_0x9cbb('0x24')]);_0x27eb9c[_0x9cbb('0x1f')]=_0x195c29;return request({'event':_0x9cbb('0x27'),'message':_0x27eb9c});})[_0x9cbb('0x1d')](function(_0x133b22){console[_0x9cbb('0x1b')](_0x133b22);});}else{return request({'event':'outgoingmessage','message':_0x27eb9c});}};}function afterCreate(_0xdfa085,_0x1e4b54){return function(_0x48b3de,_0x5efdaa){_0x48b3de=_0x48b3de['get']({'plain':!![]});_0x48b3de[_0x9cbb('0x1f')]=_0xdfa085;_0x48b3de[_0x9cbb('0x20')]=_0x9cbb('0x28');return request({'event':_0x1e4b54,'message':_0x48b3de});};}function afterUpdate(_0x4a92f4,_0x46e71d){return function(_0x45a4b1,_0x18e37c){if(_0x45a4b1['changed'](_0x9cbb('0x29'))&&_0x45a4b1['closed']){_0x45a4b1=_0x45a4b1['get']({'plain':!![]});_0x45a4b1['channel']=_0x4a92f4;_0x45a4b1['event']=_0x9cbb('0x29');if(_0x45a4b1['UserId']){return db[_0x9cbb('0x22')][_0x9cbb('0x23')]({'where':{'id':_0x45a4b1[_0x9cbb('0x21')]},'attributes':['id',_0x9cbb('0x24')],'raw':!![]})[_0x9cbb('0x19')](function(_0xfa8b63){_0x45a4b1[_0x9cbb('0x25')]=util['format']('SIP/%s',_0xfa8b63[_0x9cbb('0x24')]);return request({'event':_0x46e71d,'message':_0x45a4b1});})['catch'](function(_0x3d69aa){console['error'](_0x3d69aa);});}else{return request({'event':_0x46e71d,'message':_0x45a4b1});}}};}exports[_0x9cbb('0x2a')]=function(){for(var _0x4d5d7e=0x0;_0x4d5d7e=_0xb74632[_0x1bbc('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x4803f2(_0x5eccd3);})[_0x1bbc('0x14')](function(_0x4bf685){_0x2b8000(_0x4bf685);});});}; \ No newline at end of file +var _0x5cd5=['bluebird','../mysqldb','./license/util','voice','mail','chat','sms','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','role','agent','User','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x225b01,_0x2e58c9){var _0x5e0ba5=function(_0x25bcca){while(--_0x25bcca){_0x225b01['push'](_0x225b01['shift']());}};_0x5e0ba5(++_0x2e58c9);}(_0x5cd5,0xf2));var _0x55cd=function(_0x902d5f,_0x5cc760){_0x902d5f=_0x902d5f-0x0;var _0x285ae3=_0x5cd5[_0x902d5f];return _0x285ae3;};'use strict';var _=require('lodash');var BPromise=require(_0x55cd('0x0'));var db=require(_0x55cd('0x1'))['db'];var util=require(_0x55cd('0x2'));var channels=[_0x55cd('0x3'),_0x55cd('0x4'),_0x55cd('0x5'),'fax',_0x55cd('0x6'),'openchannel'];exports[_0x55cd('0x7')]=function(){return channels;};exports[_0x55cd('0x8')]=function(_0x35fc84){_0x35fc84=_0x35fc84[_0x55cd('0x9')]();return _[_0x55cd('0xa')](channels,_0x35fc84);};exports[_0x55cd('0xb')]=function(_0x231cef,_0x5d646a,_0xeb829d,_0x3b2cbf){var _0x4f7ebd={'loginAttempts':_0x5d646a,'blocked':_0xeb829d};if(!_[_0x55cd('0xc')](_0x3b2cbf)){_0x4f7ebd[_0x55cd('0xd')]=_0x3b2cbf;}return _0x231cef[_0x55cd('0xe')](_0x4f7ebd);};exports['getLicense']=function(_0x5ddc3c){return new BPromise(function(_0x54aaca,_0x42fd80){var _0x1f298d=0x0;if(_0x5ddc3c[_0x55cd('0xf')]!==_0x55cd('0x10')){_0x54aaca(_0x5ddc3c);}db[_0x55cd('0x11')]['count']({'where':{'role':_0x55cd('0x10'),'online':!![],'id':{'$ne':_0x5ddc3c['id']}}})[_0x55cd('0x12')](function(_0x3a9773){_0x1f298d=_0x3a9773;return util[_0x55cd('0x13')]();})['then'](function(_0x1fa208){if(_0x1fa208&&_0x1fa208[_0x55cd('0x14')]&&_0x1f298d>=_0x1fa208[_0x55cd('0x14')]){throw Error(_0x55cd('0x15'));}_0x54aaca(_0x5ddc3c);})['catch'](function(_0x33724d){_0x42fd80(_0x33724d);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 3eef527..3657f81 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c25=['render','json','send','404','status'];(function(_0x1922e5,_0x103563){var _0x49708b=function(_0x2afdf7){while(--_0x2afdf7){_0x1922e5['push'](_0x1922e5['shift']());}};_0x49708b(++_0x103563);}(_0x5c25,0x148));var _0x55c2=function(_0x338c81,_0x566dff){_0x338c81=_0x338c81-0x0;var _0x4b1fa0=_0x5c25[_0x338c81];return _0x4b1fa0;};'use strict';module['exports'][0x194]=function pageNotFound(_0xc71964,_0x17ec61){var _0x4eb494=_0x55c2('0x0');var _0x4ebfbe=0x194;var _0x74c909={'status':_0x4ebfbe};_0x17ec61[_0x55c2('0x1')](_0x74c909[_0x55c2('0x1')]);_0x17ec61[_0x55c2('0x2')](_0x4eb494,{},function(_0x58e950,_0x32361f){if(_0x58e950){return _0x17ec61[_0x55c2('0x1')](_0x74c909['status'])[_0x55c2('0x3')](_0x74c909);}_0x17ec61[_0x55c2('0x4')](_0x32361f);});}; \ No newline at end of file +var _0x6261=['status','render','json','send','exports','404'];(function(_0xc4887a,_0x40c534){var _0x58dd04=function(_0x304942){while(--_0x304942){_0xc4887a['push'](_0xc4887a['shift']());}};_0x58dd04(++_0x40c534);}(_0x6261,0x1c0));var _0x1626=function(_0x5553e3,_0x212b22){_0x5553e3=_0x5553e3-0x0;var _0x1819d6=_0x6261[_0x5553e3];return _0x1819d6;};'use strict';module[_0x1626('0x0')][0x194]=function pageNotFound(_0x2df2eb,_0x3e61d9){var _0x3abdd6=_0x1626('0x1');var _0x25c7e1=0x194;var _0xa8374d={'status':_0x25c7e1};_0x3e61d9[_0x1626('0x2')](_0xa8374d[_0x1626('0x2')]);_0x3e61d9[_0x1626('0x3')](_0x3abdd6,{},function(_0x20d92e,_0x31d5f3){if(_0x20d92e){return _0x3e61d9[_0x1626('0x2')](_0xa8374d[_0x1626('0x2')])[_0x1626('0x4')](_0xa8374d);}_0x3e61d9[_0x1626('0x5')](_0x31d5f3);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index f03f662..8348832 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeb77=['MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','Members','VoiceQueueId','HopperFinals','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','team_has_voice_queues','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','MailApplication','ListId','Agents','MailMessage','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','MailInteractionId','Attachments','Interaction','restrict','IntervalId','TagId','List','Disposition','FaxAccountId','Exntensions','FaxInteractionId','fax_interaction_has_tags','Users','Teams','FaxQueueReport','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','AttachmentId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CompanyId','Hoppers','HopperHistories','cm_user_has_contacts','Queue','Campaign','CampaignId','OwnerId','All','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','Intervals','MailApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','cm_contact_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Configurations','Subjects','SubjectId','DescriptionId','Fields','FieldId','AccountId','Subject','Description','VariableId','SugarcrmConfiguration','Descriptions','Field','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskAccount','FreshdeskConfiguration','VtigerConfiguration','ServicenowConfiguration','FreshsalesAccount','FreshsalesField','ChatInternalMessage','FromId','ToId','JscriptySessionReport','SessionId','ProjectId','user_has_square_projects','VoiceQueues','team_has_mail_queues','MailQueues','team_has_fax_queues','FaxQueues','SmsQueues','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','HopperHistory','Queues','UserProfileSections','Resources','exports','path','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xcall','mysql','utf8mb4','name','utf8','sequelizeHistory','127.0.0.1','utf8_general_ci','database','options','username','password','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/schedule/schedule.model','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','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoField','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','../api/license/license.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','hasOne','cascade','UserId','hasMany','VoiceQueuesRt','Extensions','CmHopperHistory','ChatInteractions','SmsInteractions','belongsTo','UserProfile','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','Lists','cm_user_has_lists','user_has_teams','MailInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','UserVoiceQueue','ChatQueues','FaxQueue','UserOpenchannelQueue','CmList','VoicePrefixes','user_has_voice_prefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts'];(function(_0x47ff34,_0x452468){var _0x116398=function(_0x3de726){while(--_0x3de726){_0x47ff34['push'](_0x47ff34['shift']());}};_0x116398(++_0x452468);}(_0xeb77,0xb4));var _0x7eb7=function(_0x2e6dbf,_0x57dd06){_0x2e6dbf=_0x2e6dbf-0x0;var _0x2680e5=_0xeb77[_0x2e6dbf];return _0x2680e5;};'use strict';var path=require(_0x7eb7('0x0'));var config=require('../config/environment');var Sequelize=require(_0x7eb7('0x1'));var _=require(_0x7eb7('0x2'));var jstz=require(_0x7eb7('0x3'));var timezone=jstz[_0x7eb7('0x4')]();config[_0x7eb7('0x1')]=_[_0x7eb7('0x5')](config[_0x7eb7('0x1')],{'database':_0x7eb7('0x6'),'username':_0x7eb7('0x7'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x7eb7('0x8'),'dialectOptions':{'charset':_0x7eb7('0x9')},'logging':![],'timezone':timezone[_0x7eb7('0xa')](),'define':{'charset':_0x7eb7('0xb'),'collate':'utf8_general_ci'}}});config[_0x7eb7('0xc')]=_[_0x7eb7('0x5')](config['sequelizeHistory'],{'database':'motion2','username':'xcall','password':'xC@LL1234','options':{'host':_0x7eb7('0xd'),'port':0xcea,'dialect':_0x7eb7('0x8'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x7eb7('0xa')](),'define':{'charset':_0x7eb7('0xb'),'collate':_0x7eb7('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x7eb7('0x1')][_0x7eb7('0xf')],config[_0x7eb7('0x1')]['username'],config[_0x7eb7('0x1')]['password'],config[_0x7eb7('0x1')][_0x7eb7('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x7eb7('0xf')],config[_0x7eb7('0xc')][_0x7eb7('0x11')],config[_0x7eb7('0xc')][_0x7eb7('0x12')],config[_0x7eb7('0xc')][_0x7eb7('0x10')])};db[_0x7eb7('0x13')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/user/user.model');db[_0x7eb7('0x15')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x16'));db[_0x7eb7('0x17')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0x18'));db[_0x7eb7('0x19')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x1a'));db[_0x7eb7('0x1b')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x1c'));db[_0x7eb7('0x1d')]=db[_0x7eb7('0x1')]['import'](_0x7eb7('0x1e'));db[_0x7eb7('0x1f')]=db[_0x7eb7('0x1')]['import'](_0x7eb7('0x20'));db[_0x7eb7('0x21')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x22'));db[_0x7eb7('0x23')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0x24'));db['VoiceMailMessage']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x25'));db[_0x7eb7('0x26')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x27'));db[_0x7eb7('0x28')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0x29'));db['VoiceAgentReport']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x2a'));db[_0x7eb7('0x2b')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x7eb7('0x2c')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/memberReport/memberReport.model');db[_0x7eb7('0x2d')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x2e'));db[_0x7eb7('0x2f')]=db['sequelize']['import'](_0x7eb7('0x30'));db[_0x7eb7('0x31')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0x32'));db['UserVoiceQueue']=db['sequelize']['import'](_0x7eb7('0x33'));db[_0x7eb7('0x34')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x35'));db[_0x7eb7('0x36')]=db['sequelize'][_0x7eb7('0x14')]('../api/userMailQueue/userMailQueue.model');db[_0x7eb7('0x37')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x38'));db[_0x7eb7('0x39')]=db[_0x7eb7('0x1')]['import']('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x7eb7('0x3a')]=db[_0x7eb7('0x1')]['import'](_0x7eb7('0x3b'));db[_0x7eb7('0x3c')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x3d'));db[_0x7eb7('0x3e')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/mailAccount/mailAccount.model');db[_0x7eb7('0x3f')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0x40'));db['MailSubstatus']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x41'));db[_0x7eb7('0x42')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x43'));db['MailMessage']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x44'));db['MailApplication']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x45'));db[_0x7eb7('0x46')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/mailQueueReport/mailQueueReport.model');db[_0x7eb7('0x47')]=db[_0x7eb7('0x1')]['import'](_0x7eb7('0x48'));db[_0x7eb7('0x49')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x4a'));db[_0x7eb7('0x4b')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0x4c'));db[_0x7eb7('0x4d')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x4e'));db[_0x7eb7('0x4f')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x50'));db[_0x7eb7('0x51')]=db['sequelize']['import'](_0x7eb7('0x52'));db['FaxQueue']=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/faxQueue/faxQueue.model');db['FaxQueueReport']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x53'));db[_0x7eb7('0x54')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x55'));db[_0x7eb7('0x56')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x57'));db[_0x7eb7('0x58')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/smsInteraction/smsInteraction.model');db[_0x7eb7('0x59')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x5a'));db[_0x7eb7('0x5b')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x5c'));db[_0x7eb7('0x5d')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x5e'));db[_0x7eb7('0x5f')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0x60'));db[_0x7eb7('0x61')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x7eb7('0x62')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/openchannelMessage/openchannelMessage.model');db[_0x7eb7('0x63')]=db[_0x7eb7('0x1')]['import'](_0x7eb7('0x64'));db['ChatWebsite']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x65'));db[_0x7eb7('0x66')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0x67'));db[_0x7eb7('0x68')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x69'));db[_0x7eb7('0x6a')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0x6b'));db[_0x7eb7('0x6c')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x6d'));db[_0x7eb7('0x6e')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x6f'));db[_0x7eb7('0x70')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x71'));db[_0x7eb7('0x72')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x73'));db[_0x7eb7('0x74')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x75'));db[_0x7eb7('0x76')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/cmCompany/cmCompany.model');db[_0x7eb7('0x77')]=db['sequelize']['import'](_0x7eb7('0x78'));db[_0x7eb7('0x79')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0x7a'));db[_0x7eb7('0x7b')]=db['sequelize']['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0x7eb7('0x7c')]=db[_0x7eb7('0x1')]['import'](_0x7eb7('0x7d'));db['CmHopperHistory']=db['sequelize']['import'](_0x7eb7('0x7e'));db[_0x7eb7('0x7f')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x80'));db['CmCustomField']=db[_0x7eb7('0x1')]['import'](_0x7eb7('0x81'));db[_0x7eb7('0x82')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x83'));db[_0x7eb7('0x84')]=db['sequelize'][_0x7eb7('0x14')]('../api/automation/automation.model');db[_0x7eb7('0x85')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x86'));db['Disposition']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x87'));db[_0x7eb7('0x88')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x89'));db['Interval']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x8a'));db[_0x7eb7('0x8b')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x8c'));db[_0x7eb7('0x8d')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0x8e'));db[_0x7eb7('0x8f')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db['Schedule']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x90'));db[_0x7eb7('0x91')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x92'));db[_0x7eb7('0x93')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x94'));db[_0x7eb7('0x95')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x96'));db[_0x7eb7('0x97')]=db['sequelize']['import'](_0x7eb7('0x98'));db[_0x7eb7('0x99')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x9a'));db['Integration']=db[_0x7eb7('0x1')]['import']('../api/integration/integration.model');db[_0x7eb7('0x9b')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x9c'));db[_0x7eb7('0x9d')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0x9e'));db[_0x7eb7('0x9f')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0xa0'));db['AnalyticExtractedReport']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xa1'));db[_0x7eb7('0xa2')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xa3'));db[_0x7eb7('0xa4')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0xa5'));db[_0x7eb7('0xa6')]=db[_0x7eb7('0x1')]['import'](_0x7eb7('0xa7'));db[_0x7eb7('0xa8')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0x7eb7('0xa9')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x7eb7('0xaa')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xab'));db[_0x7eb7('0xac')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0xad'));db['SugarcrmConfiguration']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xae'));db[_0x7eb7('0xaf')]=db[_0x7eb7('0x1')]['import'](_0x7eb7('0xb0'));db[_0x7eb7('0xb1')]=db[_0x7eb7('0x1')]['import'](_0x7eb7('0xb2'));db[_0x7eb7('0xb3')]=db['sequelize']['import'](_0x7eb7('0xb4'));db[_0x7eb7('0xb5')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xb6'));db[_0x7eb7('0xb7')]=db['sequelize'][_0x7eb7('0x14')]('../api/intZohoAccount/intZohoAccount.model');db['ZohoConfiguration']=db['sequelize'][_0x7eb7('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x7eb7('0xb8')]=db['sequelize'][_0x7eb7('0x14')]('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db['sequelize'][_0x7eb7('0x14')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x7eb7('0xb9')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xba'));db[_0x7eb7('0xbb')]=db[_0x7eb7('0x1')]['import'](_0x7eb7('0xbc'));db[_0x7eb7('0xbd')]=db['sequelize']['import'](_0x7eb7('0xbe'));db['FreshdeskConfiguration']=db[_0x7eb7('0x1')]['import'](_0x7eb7('0xbf'));db[_0x7eb7('0xc0')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x7eb7('0xc1')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xc2'));db['VtigerConfiguration']=db['sequelize'][_0x7eb7('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x7eb7('0xc3')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xc4'));db[_0x7eb7('0xc5')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0xc6'));db['ServicenowConfiguration']=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x7eb7('0xc7')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xc8'));db[_0x7eb7('0xc9')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xca'));db[_0x7eb7('0xcb')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0xcc'));db[_0x7eb7('0xcd')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xce'));db['FreshsalesAccount']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xcf'));db[_0x7eb7('0xd0')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0xd1'));db['FreshsalesField']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xd2'));db[_0x7eb7('0xd3')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0xd4'));db['Network']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xd5'));db[_0x7eb7('0xd6')]=db[_0x7eb7('0x1')]['import'](_0x7eb7('0xd7'));db['ChatInternalMessage']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xd8'));db[_0x7eb7('0xd9')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0xda'));db['JscriptyQuestionReport']=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xdb'));db[_0x7eb7('0xdc')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0xdd'));db[_0x7eb7('0xde')]=db['sequelize']['import'](_0x7eb7('0xdf'));db[_0x7eb7('0xe0')]=db[_0x7eb7('0x1')]['import']('../api/squareReportDetail/squareReportDetail.model');db[_0x7eb7('0xe1')]=db[_0x7eb7('0x1')]['import'](_0x7eb7('0xe2'));db['Setting']=db['sequelize']['import'](_0x7eb7('0xe3'));db[_0x7eb7('0xe4')]=db[_0x7eb7('0x1')]['import'](_0x7eb7('0xe5'));db[_0x7eb7('0xe6')]=db['sequelize'][_0x7eb7('0x14')](_0x7eb7('0xe7'));db[_0x7eb7('0xe8')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xe9'));db[_0x7eb7('0xea')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xeb'));db[_0x7eb7('0xec')]=db[_0x7eb7('0x1')]['import']('../api/team/team.model');db[_0x7eb7('0xed')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xee'));db['Campaign']=db['sequelize'][_0x7eb7('0x14')]('../api/campaign/campaign.model');db['Migration']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xef'));db[_0x7eb7('0xf0')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xf1'));db[_0x7eb7('0xf2')]=db['sequelize'][_0x7eb7('0x14')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xf3'));db[_0x7eb7('0xf4')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/faxTransferReport/faxTransferReport.model');db[_0x7eb7('0xf5')]=db[_0x7eb7('0x1')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xf6'));db[_0x7eb7('0xf7')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xf8'));db['UserProfile']=db[_0x7eb7('0x1')][_0x7eb7('0x14')]('../api/userProfile/userProfile.model');db[_0x7eb7('0xf9')]=db[_0x7eb7('0x1')][_0x7eb7('0x14')](_0x7eb7('0xfa'));db[_0x7eb7('0xfb')]=db['sequelize']['import']('../api/userProfileResource/userProfileResource.model');db['User'][_0x7eb7('0xfc')](db[_0x7eb7('0x23')],{'as':_0x7eb7('0x23'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0xfe')});db[_0x7eb7('0x13')][_0x7eb7('0xff')](db[_0x7eb7('0x1f')],{'as':'Recordings','foreignKey':_0x7eb7('0xfe')});db[_0x7eb7('0x13')][_0x7eb7('0xff')](db[_0x7eb7('0x31')],{'as':_0x7eb7('0x100'),'foreignKey':_0x7eb7('0xfe')});db[_0x7eb7('0x13')][_0x7eb7('0xff')](db['VoiceExtension'],{'as':_0x7eb7('0x101'),'onDelete':_0x7eb7('0xfd'),'hooks':!![]});db[_0x7eb7('0x13')][_0x7eb7('0xff')](db[_0x7eb7('0x7c')],{'as':'HopperFinals','foreignKey':_0x7eb7('0xfe')});db['User'][_0x7eb7('0xff')](db[_0x7eb7('0x102')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0x7eb7('0x13')]['hasMany'](db[_0x7eb7('0x7f')],{'as':'ReportAgentPreview','foreignKey':_0x7eb7('0xfe')});db[_0x7eb7('0x13')][_0x7eb7('0xff')](db[_0x7eb7('0x61')],{'as':'OpenchannelInteractions','foreignKey':_0x7eb7('0xfe')});db[_0x7eb7('0x13')][_0x7eb7('0xff')](db[_0x7eb7('0x6a')],{'as':_0x7eb7('0x103'),'foreignKey':'UserId'});db['User'][_0x7eb7('0xff')](db[_0x7eb7('0x58')],{'as':_0x7eb7('0x104'),'foreignKey':_0x7eb7('0xfe')});db[_0x7eb7('0x13')][_0x7eb7('0xff')](db[_0x7eb7('0x4f')],{'as':'FaxInteractions','foreignKey':_0x7eb7('0xfe')});db[_0x7eb7('0x13')][_0x7eb7('0xff')](db[_0x7eb7('0x42')],{'as':'MailInteractions','foreignKey':'UserId'});db['User'][_0x7eb7('0x105')](db[_0x7eb7('0x106')],{'as':_0x7eb7('0x106'),'foreignKey':_0x7eb7('0x107')});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db['ChatGroup'],{'as':_0x7eb7('0x109'),'through':_0x7eb7('0x10a')});db['User'][_0x7eb7('0x108')](db[_0x7eb7('0x77')],{'as':_0x7eb7('0x10b'),'through':'cm_user_has_contacts'});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db['CmList'],{'as':_0x7eb7('0x10c'),'through':_0x7eb7('0x10d')});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db[_0x7eb7('0xec')],{'through':_0x7eb7('0x10e')});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db[_0x7eb7('0x42')],{'as':_0x7eb7('0x10f'),'through':'user_has_mail_interactions'});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db['ChatInteraction'],{'as':_0x7eb7('0x103'),'through':_0x7eb7('0x110')});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db[_0x7eb7('0x4f')],{'as':_0x7eb7('0x111'),'through':_0x7eb7('0x112')});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db[_0x7eb7('0x58')],{'as':_0x7eb7('0x104'),'through':_0x7eb7('0x113')});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db[_0x7eb7('0x61')],{'as':_0x7eb7('0x114'),'through':_0x7eb7('0x115')});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db[_0x7eb7('0x1d')],{'as':'VoiceQueues','through':_0x7eb7('0x116'),'required':![]});db[_0x7eb7('0x13')]['belongsToMany'](db['MailQueue'],{'as':'MailQueues','through':_0x7eb7('0x36'),'required':![]});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db[_0x7eb7('0x70')],{'as':_0x7eb7('0x117'),'through':_0x7eb7('0x34'),'required':![],'hooks':!![]});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db[_0x7eb7('0x118')],{'as':'FaxQueues','through':_0x7eb7('0x37'),'required':![]});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db[_0x7eb7('0x5b')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x7eb7('0x119'),'required':![]});db['User'][_0x7eb7('0x108')](db[_0x7eb7('0x11a')],{'through':_0x7eb7('0x10d')});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db['VoicePrefix'],{'as':_0x7eb7('0x11b'),'through':_0x7eb7('0x11c'),'required':![]});db[_0x7eb7('0x13')]['belongsToMany'](db[_0x7eb7('0x11d')],{'as':_0x7eb7('0x11e'),'through':_0x7eb7('0x11f')});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db['FaxAccount'],{'as':_0x7eb7('0x120'),'through':_0x7eb7('0x121')});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db[_0x7eb7('0x3e')],{'as':_0x7eb7('0x122'),'through':_0x7eb7('0x123')});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db['OpenchannelAccount'],{'as':_0x7eb7('0x124'),'through':_0x7eb7('0x125')});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db['SmsAccount'],{'as':_0x7eb7('0x126'),'through':_0x7eb7('0x127')});db[_0x7eb7('0x13')][_0x7eb7('0x108')](db[_0x7eb7('0xe6')],{'as':_0x7eb7('0x128'),'through':'user_has_square_projects'});db[_0x7eb7('0x15')][_0x7eb7('0xff')](db[_0x7eb7('0x19')],{'as':_0x7eb7('0x129'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x12a')});db[_0x7eb7('0x17')][_0x7eb7('0xff')](db['VoiceExtension'],{'onDelete':_0x7eb7('0xfd')});db[_0x7eb7('0x19')][_0x7eb7('0xff')](db['VoiceExtension'],{'as':_0x7eb7('0x12b'),'onDelete':'cascade'});db[_0x7eb7('0x1b')][_0x7eb7('0x108')](db[_0x7eb7('0x91')],{'as':'Sounds','through':_0x7eb7('0x12c')});db[_0x7eb7('0x1d')][_0x7eb7('0xff')](db[_0x7eb7('0x31')],{'as':_0x7eb7('0x12d'),'foreignKey':_0x7eb7('0x12e')});db[_0x7eb7('0x1d')][_0x7eb7('0xff')](db[_0x7eb7('0x79')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x7eb7('0xff')](db[_0x7eb7('0x7c')],{'as':_0x7eb7('0x12f'),'foreignKey':_0x7eb7('0x12e')});db[_0x7eb7('0x1d')][_0x7eb7('0xff')](db[_0x7eb7('0x102')],{'as':'HopperHistories','foreignKey':_0x7eb7('0x12e')});db['VoiceQueue']['hasMany'](db[_0x7eb7('0x7f')],{'as':_0x7eb7('0x7f'),'foreignKey':_0x7eb7('0x12e')});db[_0x7eb7('0x1d')][_0x7eb7('0xff')](db[_0x7eb7('0x7b')],{'as':_0x7eb7('0x130'),'foreignKey':_0x7eb7('0x12e')});db[_0x7eb7('0x1d')][_0x7eb7('0xff')](db['JscriptySessionReport'],{'as':_0x7eb7('0x131'),'foreignKey':_0x7eb7('0x12e')});db['VoiceQueue'][_0x7eb7('0x105')](db[_0x7eb7('0x2d')],{'as':_0x7eb7('0x2d'),'foreignKey':_0x7eb7('0x132')});db[_0x7eb7('0x1d')]['belongsTo'](db[_0x7eb7('0x2d')],{'as':_0x7eb7('0x133'),'foreignKey':_0x7eb7('0x134')});db[_0x7eb7('0x1d')][_0x7eb7('0x105')](db[_0x7eb7('0x135')],{'as':_0x7eb7('0x135'),'foreignKey':'IntervalId'});db[_0x7eb7('0x1d')][_0x7eb7('0x105')](db[_0x7eb7('0x8b')],{'as':_0x7eb7('0x136'),'foreignKey':_0x7eb7('0x137')});db['VoiceQueue'][_0x7eb7('0x108')](db[_0x7eb7('0x11a')],{'as':'Lists','through':_0x7eb7('0x138')});db[_0x7eb7('0x1d')]['belongsToMany'](db[_0x7eb7('0x13')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x7eb7('0x1d')][_0x7eb7('0x108')](db['Team'],{'as':'Teams','through':_0x7eb7('0x139')});db['VoiceQueue'][_0x7eb7('0x108')](db[_0x7eb7('0x11a')],{'as':_0x7eb7('0x13a'),'through':_0x7eb7('0x13b')});db[_0x7eb7('0x1f')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x13'),'foreignKey':_0x7eb7('0xfe')});db[_0x7eb7('0x21')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x13'),'foreignKey':'UserId'});db[_0x7eb7('0x23')]['hasMany'](db['VoiceMailMessage'],{'as':_0x7eb7('0x13c'),'onDelete':'cascade','foreignKey':_0x7eb7('0x13d'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0x7eb7('0x105')](db[_0x7eb7('0x23')],{'foreignKey':'mailboxuser','targetKey':_0x7eb7('0x13e')});db[_0x7eb7('0x26')][_0x7eb7('0xff')](db[_0x7eb7('0x2b')],{'as':_0x7eb7('0x13f'),'foreignKey':_0x7eb7('0x140'),'constraints':![]});db[_0x7eb7('0x26')][_0x7eb7('0xff')](db[_0x7eb7('0x141')],{'as':_0x7eb7('0x142'),'foreignKey':_0x7eb7('0x140'),'constraints':![]});db[_0x7eb7('0x26')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'as':'User','foreignKey':_0x7eb7('0xfe')});db['VoiceCallReport'][_0x7eb7('0x105')](db[_0x7eb7('0x77')],{'as':_0x7eb7('0x143'),'foreignKey':_0x7eb7('0x144')});db[_0x7eb7('0x3a')][_0x7eb7('0x105')](db[_0x7eb7('0x3e')],{'as':_0x7eb7('0x3e'),'foreignKey':'MailAccountId'});db[_0x7eb7('0x3c')][_0x7eb7('0x105')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x7eb7('0x145')});db[_0x7eb7('0x3e')]['hasOne'](db[_0x7eb7('0x3a')],{'as':_0x7eb7('0x146'),'onDelete':'cascade'});db[_0x7eb7('0x3e')][_0x7eb7('0xfc')](db[_0x7eb7('0x3c')],{'as':_0x7eb7('0x147'),'onDelete':_0x7eb7('0xfd')});db[_0x7eb7('0x3e')]['hasMany'](db['Disposition'],{'as':_0x7eb7('0x148'),'foreignKey':_0x7eb7('0x145')});db['MailAccount']['hasMany'](db[_0x7eb7('0x85')],{'as':_0x7eb7('0x149'),'foreignKey':_0x7eb7('0x145')});db[_0x7eb7('0x3e')][_0x7eb7('0xff')](db['MailMessage'],{'as':'Messages','foreignKey':_0x7eb7('0x145')});db['MailAccount']['hasMany'](db['MailInteraction'],{'as':_0x7eb7('0x14a')});db[_0x7eb7('0x3e')][_0x7eb7('0xff')](db[_0x7eb7('0x14b')],{'as':_0x7eb7('0x12b')});db[_0x7eb7('0x3e')][_0x7eb7('0x105')](db[_0x7eb7('0x11a')],{'as':'List','foreignKey':_0x7eb7('0x14c')});db[_0x7eb7('0x3e')][_0x7eb7('0x105')](db[_0x7eb7('0x95')],{'as':'Template','foreignKey':'TemplateId'});db['MailAccount']['belongsTo'](db[_0x7eb7('0x8b')],{'as':_0x7eb7('0x136'),'foreignKey':_0x7eb7('0x137')});db[_0x7eb7('0x3e')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x7eb7('0x123')});db[_0x7eb7('0x3f')][_0x7eb7('0x108')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x14d'),'through':_0x7eb7('0x36')});db[_0x7eb7('0x3f')][_0x7eb7('0x108')](db[_0x7eb7('0xec')],{'through':'team_has_mail_queues','as':'Teams'});db[_0x7eb7('0x42')][_0x7eb7('0xff')](db[_0x7eb7('0x14e')],{'as':'Messages','onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0x7eb7('0x42')]['belongsTo'](db[_0x7eb7('0x3e')],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x145')});db['MailInteraction'][_0x7eb7('0x105')](db[_0x7eb7('0x77')],{'as':_0x7eb7('0x143'),'foreignKey':_0x7eb7('0x144')});db[_0x7eb7('0x42')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x150'),'foreignKey':'UserId'});db[_0x7eb7('0x42')]['belongsToMany'](db[_0x7eb7('0x93')],{'through':'mail_interaction_has_tags','as':_0x7eb7('0x151')});db['MailInteraction']['belongsToMany'](db[_0x7eb7('0x93')],{'through':_0x7eb7('0x152'),'as':_0x7eb7('0x153')});db[_0x7eb7('0x42')]['belongsToMany'](db[_0x7eb7('0x13')],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0x7eb7('0x154')});db[_0x7eb7('0x14e')][_0x7eb7('0xff')](db['Attachment'],{'as':_0x7eb7('0x155'),'onDelete':'cascade'});db[_0x7eb7('0x14e')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'as':'User'});db[_0x7eb7('0x14e')][_0x7eb7('0x105')](db['CmContact'],{'onDelete':_0x7eb7('0xfd'),'as':_0x7eb7('0x143')});db[_0x7eb7('0x14e')][_0x7eb7('0x105')](db[_0x7eb7('0x42')],{'as':_0x7eb7('0x156'),'foreignKey':_0x7eb7('0x154')});db[_0x7eb7('0x14e')][_0x7eb7('0x105')](db['MailAccount'],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x145')});db[_0x7eb7('0x14b')]['belongsTo'](db[_0x7eb7('0x13')],{'onDelete':_0x7eb7('0x157')});db['MailApplication'][_0x7eb7('0x105')](db[_0x7eb7('0x3f')],{'onDelete':'restrict'});db[_0x7eb7('0x14b')]['belongsTo'](db[_0x7eb7('0x3e')],{'onDelete':_0x7eb7('0x157')});db[_0x7eb7('0x14b')][_0x7eb7('0x105')](db[_0x7eb7('0x135')],{'onDelete':_0x7eb7('0x157'),'foreignKey':_0x7eb7('0x158')});db[_0x7eb7('0x14b')][_0x7eb7('0x105')](db[_0x7eb7('0x93')],{'onDelete':_0x7eb7('0x157'),'foreignKey':_0x7eb7('0x159')});db[_0x7eb7('0x46')][_0x7eb7('0x105')](db[_0x7eb7('0x3e')],{});db['MailQueueReport'][_0x7eb7('0x105')](db[_0x7eb7('0x11a')],{'as':_0x7eb7('0x15a'),'foreignKey':'ListId'});db[_0x7eb7('0x46')][_0x7eb7('0x105')](db[_0x7eb7('0x77')],{'as':_0x7eb7('0x143'),'foreignKey':_0x7eb7('0x144')});db[_0x7eb7('0x46')]['belongsTo'](db[_0x7eb7('0x42')],{});db[_0x7eb7('0x46')][_0x7eb7('0x105')](db[_0x7eb7('0x14e')],{});db['MailQueueReport'][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{});db['MailQueueReport'][_0x7eb7('0x105')](db[_0x7eb7('0x3f')],{});db[_0x7eb7('0x47')][_0x7eb7('0xff')](db[_0x7eb7('0x49')],{'as':'Items','onDelete':_0x7eb7('0xfd')});db['FaxAccount'][_0x7eb7('0xff')](db[_0x7eb7('0x15b')],{'as':'Dispositions','foreignKey':_0x7eb7('0x15c')});db[_0x7eb7('0x4b')][_0x7eb7('0xff')](db[_0x7eb7('0x85')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0x7eb7('0x4b')][_0x7eb7('0xff')](db[_0x7eb7('0x4f')],{'as':'Interactions'});db[_0x7eb7('0x4b')][_0x7eb7('0xff')](db[_0x7eb7('0x4d')],{'as':_0x7eb7('0x12b')});db['FaxAccount'][_0x7eb7('0xff')](db[_0x7eb7('0x19')],{'as':_0x7eb7('0x15d'),'onDelete':_0x7eb7('0xfd')});db['FaxAccount'][_0x7eb7('0xff')](db[_0x7eb7('0x51')],{'as':'Messages'});db[_0x7eb7('0x4b')][_0x7eb7('0x105')](db[_0x7eb7('0x2d')],{'as':_0x7eb7('0x2d')});db['FaxAccount'][_0x7eb7('0x105')](db[_0x7eb7('0x11a')],{'as':_0x7eb7('0x15a'),'foreignKey':'ListId'});db[_0x7eb7('0x4b')]['belongsTo'](db[_0x7eb7('0x8b')],{'as':_0x7eb7('0x136'),'foreignKey':_0x7eb7('0x137')});db['FaxAccount']['belongsToMany'](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x14d'),'through':_0x7eb7('0x121')});db[_0x7eb7('0x4d')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'onDelete':_0x7eb7('0x157')});db['FaxApplication'][_0x7eb7('0x105')](db[_0x7eb7('0x118')],{'onDelete':'restrict'});db[_0x7eb7('0x4d')][_0x7eb7('0x105')](db[_0x7eb7('0x4b')],{'onDelete':'restrict'});db[_0x7eb7('0x4d')][_0x7eb7('0x105')](db[_0x7eb7('0x93')],{'onDelete':_0x7eb7('0x157'),'foreignKey':_0x7eb7('0x159')});db['FaxInteraction']['hasMany'](db[_0x7eb7('0x51')],{'as':'Messages','onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x15e')});db['FaxInteraction'][_0x7eb7('0x105')](db['FaxAccount'],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x15c')});db['FaxInteraction'][_0x7eb7('0x105')](db[_0x7eb7('0x77')],{'as':_0x7eb7('0x143'),'foreignKey':_0x7eb7('0x144')});db['FaxInteraction'][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'as':'Owner','foreignKey':_0x7eb7('0xfe')});db['FaxInteraction'][_0x7eb7('0x108')](db['Tag'],{'through':_0x7eb7('0x15f'),'as':_0x7eb7('0x151')});db[_0x7eb7('0x4f')][_0x7eb7('0x108')](db[_0x7eb7('0x93')],{'through':_0x7eb7('0x15f'),'as':'ThroughTags'});db[_0x7eb7('0x4f')]['belongsToMany'](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x160'),'through':'user_has_fax_interactions','foreignKey':_0x7eb7('0x15e')});db[_0x7eb7('0x51')][_0x7eb7('0x105')](db['User'],{'onDelete':_0x7eb7('0xfd'),'as':_0x7eb7('0x13')});db[_0x7eb7('0x51')][_0x7eb7('0x105')](db[_0x7eb7('0x4f')],{'as':_0x7eb7('0x156'),'foreignKey':_0x7eb7('0x15e')});db[_0x7eb7('0x51')][_0x7eb7('0x105')](db['CmContact'],{'onDelete':_0x7eb7('0xfd'),'as':_0x7eb7('0x143')});db[_0x7eb7('0x51')][_0x7eb7('0x105')](db[_0x7eb7('0xf0')],{'as':_0x7eb7('0xf0'),'foreignKey':'AttachmentId'});db[_0x7eb7('0x51')][_0x7eb7('0x105')](db[_0x7eb7('0x4b')],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x15c')});db[_0x7eb7('0x118')][_0x7eb7('0x108')](db[_0x7eb7('0x13')],{'as':'Agents','through':_0x7eb7('0x37')});db[_0x7eb7('0x118')][_0x7eb7('0x108')](db['Team'],{'through':'team_has_fax_queues','as':_0x7eb7('0x161')});db['FaxQueueReport'][_0x7eb7('0x105')](db[_0x7eb7('0x4b')],{});db['FaxQueueReport']['belongsTo'](db[_0x7eb7('0x11a')],{'as':_0x7eb7('0x15a'),'foreignKey':_0x7eb7('0x14c')});db[_0x7eb7('0x162')]['belongsTo'](db['CmContact'],{'as':_0x7eb7('0x143'),'foreignKey':_0x7eb7('0x144')});db[_0x7eb7('0x162')][_0x7eb7('0x105')](db[_0x7eb7('0x4f')],{});db[_0x7eb7('0x162')][_0x7eb7('0x105')](db[_0x7eb7('0x51')],{});db[_0x7eb7('0x162')]['belongsTo'](db[_0x7eb7('0x13')],{});db['FaxQueueReport']['belongsTo'](db['FaxQueue'],{});db[_0x7eb7('0x54')][_0x7eb7('0xff')](db['Disposition'],{'as':_0x7eb7('0x148'),'foreignKey':_0x7eb7('0x163')});db[_0x7eb7('0x54')][_0x7eb7('0xff')](db[_0x7eb7('0x85')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0x7eb7('0x54')]['hasMany'](db['SmsMessage'],{'as':_0x7eb7('0x13c'),'foreignKey':_0x7eb7('0x163')});db[_0x7eb7('0x54')][_0x7eb7('0xff')](db[_0x7eb7('0x58')],{'as':'Interactions'});db[_0x7eb7('0x54')]['hasMany'](db[_0x7eb7('0x56')],{'as':'Applications'});db[_0x7eb7('0x54')][_0x7eb7('0x105')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x7eb7('0x54')]['belongsTo'](db[_0x7eb7('0x8b')],{'as':'mandatoryDispositionPause','foreignKey':_0x7eb7('0x137')});db['SmsAccount'][_0x7eb7('0x108')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x14d'),'through':_0x7eb7('0x127')});db['SmsApplication']['belongsTo'](db[_0x7eb7('0x13')],{'onDelete':_0x7eb7('0x157')});db[_0x7eb7('0x56')][_0x7eb7('0x105')](db[_0x7eb7('0x5b')],{'onDelete':_0x7eb7('0x157')});db['SmsApplication']['belongsTo'](db[_0x7eb7('0x54')],{'onDelete':'restrict'});db['SmsApplication'][_0x7eb7('0x105')](db[_0x7eb7('0x135')],{'onDelete':'restrict','foreignKey':_0x7eb7('0x158')});db[_0x7eb7('0x56')][_0x7eb7('0x105')](db[_0x7eb7('0x93')],{'onDelete':_0x7eb7('0x157'),'foreignKey':'TagId'});db[_0x7eb7('0x58')][_0x7eb7('0xff')](db[_0x7eb7('0x59')],{'as':_0x7eb7('0x13c'),'onDelete':'cascade','foreignKey':_0x7eb7('0x164')});db[_0x7eb7('0x58')][_0x7eb7('0x105')](db[_0x7eb7('0x54')],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x163')});db[_0x7eb7('0x58')]['belongsTo'](db['CmContact'],{'as':_0x7eb7('0x143'),'foreignKey':_0x7eb7('0x144')});db['SmsInteraction'][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x150'),'foreignKey':'UserId'});db[_0x7eb7('0x58')][_0x7eb7('0x108')](db[_0x7eb7('0x93')],{'through':'sms_interaction_has_tags','as':'Tags'});db['SmsInteraction'][_0x7eb7('0x108')](db[_0x7eb7('0x93')],{'through':_0x7eb7('0x165'),'as':'ThroughTags'});db[_0x7eb7('0x58')][_0x7eb7('0x108')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x160'),'through':_0x7eb7('0x113'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x13')});db[_0x7eb7('0x59')][_0x7eb7('0x105')](db['CmContact'],{'onDelete':_0x7eb7('0xfd'),'as':_0x7eb7('0x143')});db[_0x7eb7('0x59')][_0x7eb7('0x105')](db[_0x7eb7('0x58')],{'onDelete':_0x7eb7('0xfd'),'as':_0x7eb7('0x156'),'foreignKey':'SmsInteractionId'});db[_0x7eb7('0x59')][_0x7eb7('0x105')](db['SmsAccount'],{'as':'Account','foreignKey':_0x7eb7('0x163')});db[_0x7eb7('0x5b')][_0x7eb7('0x108')](db[_0x7eb7('0x13')],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0x7eb7('0x166')});db['SmsQueue'][_0x7eb7('0x108')](db[_0x7eb7('0xec')],{'through':_0x7eb7('0x167'),'as':'Teams'});db[_0x7eb7('0x5d')]['hasMany'](db['Disposition'],{'as':_0x7eb7('0x148'),'foreignKey':_0x7eb7('0x168')});db[_0x7eb7('0x5d')][_0x7eb7('0xff')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x7eb7('0x168')});db[_0x7eb7('0x5d')][_0x7eb7('0xff')](db[_0x7eb7('0x61')],{'as':_0x7eb7('0x14a'),'foreignKey':_0x7eb7('0x168')});db[_0x7eb7('0x5d')]['hasMany'](db[_0x7eb7('0x62')],{'as':'Messages','foreignKey':_0x7eb7('0x168')});db[_0x7eb7('0x5d')][_0x7eb7('0xff')](db['OpenchannelApplication'],{'as':_0x7eb7('0x12b'),'foreignKey':'OpenchannelAccountId'});db[_0x7eb7('0x5d')][_0x7eb7('0x105')](db['CmList'],{'as':_0x7eb7('0x15a'),'foreignKey':'ListId'});db[_0x7eb7('0x5d')][_0x7eb7('0x105')](db[_0x7eb7('0x8b')],{'as':_0x7eb7('0x136'),'foreignKey':_0x7eb7('0x137')});db[_0x7eb7('0x5d')][_0x7eb7('0x108')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x14d'),'through':_0x7eb7('0x125')});db['OpenchannelApplication']['belongsTo'](db[_0x7eb7('0x13')],{'onDelete':_0x7eb7('0x157')});db[_0x7eb7('0x5f')][_0x7eb7('0x105')](db[_0x7eb7('0x63')],{'onDelete':_0x7eb7('0x157'),'foreignKey':_0x7eb7('0x169')});db[_0x7eb7('0x5f')][_0x7eb7('0x105')](db['OpenchannelAccount'],{'onDelete':_0x7eb7('0x157'),'foreignKey':_0x7eb7('0x168')});db['OpenchannelApplication'][_0x7eb7('0x105')](db[_0x7eb7('0x135')],{'onDelete':_0x7eb7('0x157'),'foreignKey':_0x7eb7('0x158')});db[_0x7eb7('0x5f')][_0x7eb7('0x105')](db[_0x7eb7('0x93')],{'onDelete':_0x7eb7('0x157'),'foreignKey':_0x7eb7('0x159')});db[_0x7eb7('0x61')][_0x7eb7('0xff')](db[_0x7eb7('0x62')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x7eb7('0x16a')});db[_0x7eb7('0x61')][_0x7eb7('0x105')](db[_0x7eb7('0x5d')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x7eb7('0x105')](db['CmContact'],{'as':_0x7eb7('0x143'),'foreignKey':_0x7eb7('0x144')});db[_0x7eb7('0x61')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'as':'Owner','foreignKey':_0x7eb7('0xfe')});db['OpenchannelInteraction'][_0x7eb7('0x108')](db[_0x7eb7('0x93')],{'through':_0x7eb7('0x16b'),'as':_0x7eb7('0x151')});db[_0x7eb7('0x61')][_0x7eb7('0x108')](db[_0x7eb7('0x93')],{'through':_0x7eb7('0x16b'),'as':'ThroughTags'});db[_0x7eb7('0x61')]['belongsToMany'](db['User'],{'as':_0x7eb7('0x160'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x7eb7('0x62')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'onDelete':_0x7eb7('0xfd'),'as':'User'});db['OpenchannelMessage']['belongsTo'](db[_0x7eb7('0x77')],{'onDelete':_0x7eb7('0xfd'),'as':_0x7eb7('0x143')});db[_0x7eb7('0x62')]['belongsTo'](db[_0x7eb7('0x61')],{'onDelete':_0x7eb7('0xfd'),'as':_0x7eb7('0x156'),'foreignKey':_0x7eb7('0x16a')});db[_0x7eb7('0x62')][_0x7eb7('0x105')](db[_0x7eb7('0xf0')],{'as':'Attachment','foreignKey':_0x7eb7('0x16c')});db['OpenchannelMessage'][_0x7eb7('0x105')](db['OpenchannelAccount'],{'as':'Account','foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue'][_0x7eb7('0x108')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x14d'),'through':_0x7eb7('0x119'),'foreignKey':_0x7eb7('0x169')});db[_0x7eb7('0x63')][_0x7eb7('0x108')](db['Team'],{'through':_0x7eb7('0x16d'),'as':'Teams'});db[_0x7eb7('0x11d')][_0x7eb7('0xff')](db[_0x7eb7('0x15b')],{'as':_0x7eb7('0x148'),'foreignKey':_0x7eb7('0x16e')});db['ChatWebsite'][_0x7eb7('0xff')](db[_0x7eb7('0x85')],{'as':_0x7eb7('0x149'),'foreignKey':'ChatWebsiteId'});db[_0x7eb7('0x11d')][_0x7eb7('0xff')](db[_0x7eb7('0x74')],{'as':_0x7eb7('0x16f')});db[_0x7eb7('0x11d')][_0x7eb7('0xff')](db['ChatInteraction'],{'as':'Interactions'});db[_0x7eb7('0x11d')][_0x7eb7('0xff')](db[_0x7eb7('0x68')],{'as':'Applications'});db[_0x7eb7('0x11d')][_0x7eb7('0xff')](db['ChatMessage'],{'as':_0x7eb7('0x13c')});db[_0x7eb7('0x11d')][_0x7eb7('0x105')](db[_0x7eb7('0x11a')],{'as':_0x7eb7('0x15a'),'foreignKey':_0x7eb7('0x14c')});db[_0x7eb7('0x11d')][_0x7eb7('0x105')](db[_0x7eb7('0x135')],{'as':_0x7eb7('0x135'),'foreignKey':_0x7eb7('0x158')});db[_0x7eb7('0x11d')][_0x7eb7('0x105')](db['Pause'],{'as':_0x7eb7('0x136'),'foreignKey':_0x7eb7('0x137')});db[_0x7eb7('0x11d')][_0x7eb7('0x108')](db['User'],{'as':_0x7eb7('0x14d'),'through':_0x7eb7('0x11f')});db[_0x7eb7('0x66')][_0x7eb7('0x105')](db[_0x7eb7('0x5d')],{});db[_0x7eb7('0x66')][_0x7eb7('0x105')](db[_0x7eb7('0x11a')],{'as':_0x7eb7('0x15a'),'foreignKey':_0x7eb7('0x14c')});db[_0x7eb7('0x66')][_0x7eb7('0x105')](db['CmContact'],{'as':_0x7eb7('0x143'),'foreignKey':_0x7eb7('0x144')});db['OpenchannelQueueReport'][_0x7eb7('0x105')](db['OpenchannelInteraction'],{});db[_0x7eb7('0x66')][_0x7eb7('0x105')](db[_0x7eb7('0x62')],{});db[_0x7eb7('0x66')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{});db[_0x7eb7('0x66')][_0x7eb7('0x105')](db[_0x7eb7('0x63')],{});db[_0x7eb7('0x68')][_0x7eb7('0x105')](db['User'],{'as':_0x7eb7('0x170'),'foreignKey':_0x7eb7('0xfe'),'onDelete':'restrict'});db[_0x7eb7('0x68')][_0x7eb7('0x105')](db[_0x7eb7('0x70')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x7eb7('0x157')});db[_0x7eb7('0x68')][_0x7eb7('0x105')](db[_0x7eb7('0x11d')],{'as':'Website','foreignKey':_0x7eb7('0x16e'),'onDelete':'restrict'});db[_0x7eb7('0x68')][_0x7eb7('0x105')](db[_0x7eb7('0x93')],{'onDelete':'restrict','foreignKey':_0x7eb7('0x159')});db[_0x7eb7('0x6a')][_0x7eb7('0xff')](db['ChatMessage'],{'as':_0x7eb7('0x13c'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x171')});db[_0x7eb7('0x6a')][_0x7eb7('0x105')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x7eb7('0x6a')]['belongsTo'](db[_0x7eb7('0x77')],{'as':_0x7eb7('0x143'),'foreignKey':_0x7eb7('0x144')});db['ChatInteraction'][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x150'),'foreignKey':_0x7eb7('0xfe')});db[_0x7eb7('0x6a')]['belongsToMany'](db[_0x7eb7('0x93')],{'through':_0x7eb7('0x172'),'as':_0x7eb7('0x151')});db[_0x7eb7('0x6a')][_0x7eb7('0x108')](db[_0x7eb7('0x93')],{'through':_0x7eb7('0x172'),'as':_0x7eb7('0x153')});db[_0x7eb7('0x6a')][_0x7eb7('0x108')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x160'),'through':'user_has_chat_interactions','foreignKey':_0x7eb7('0x171')});db[_0x7eb7('0x6c')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'onDelete':_0x7eb7('0xfd'),'as':_0x7eb7('0x13')});db[_0x7eb7('0x6c')][_0x7eb7('0x105')](db[_0x7eb7('0x77')],{'onDelete':_0x7eb7('0xfd'),'as':_0x7eb7('0x143'),'foreignKey':'ContactId'});db['ChatMessage'][_0x7eb7('0x105')](db[_0x7eb7('0x6a')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x7eb7('0x171')});db[_0x7eb7('0x6c')][_0x7eb7('0x105')](db['Attachment'],{'as':_0x7eb7('0xf0'),'foreignKey':'AttachmentId'});db[_0x7eb7('0x6c')][_0x7eb7('0x105')](db[_0x7eb7('0x11d')],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x16e')});db['ChatOfflineMessage'][_0x7eb7('0x105')](db[_0x7eb7('0x77')],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0x7eb7('0x6e')][_0x7eb7('0x105')](db[_0x7eb7('0x11d')],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x16e')});db[_0x7eb7('0x70')][_0x7eb7('0x108')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x14d'),'through':_0x7eb7('0x34'),'hooks':!![]});db[_0x7eb7('0x70')][_0x7eb7('0x108')](db[_0x7eb7('0xec')],{'through':_0x7eb7('0x173'),'as':_0x7eb7('0x161')});db[_0x7eb7('0x72')][_0x7eb7('0xff')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0x7eb7('0x174'),'onDelete':_0x7eb7('0xfd')});db[_0x7eb7('0x72')][_0x7eb7('0x108')](db['User'],{'as':'Members','through':_0x7eb7('0x10a')});db['ChatProactiveAction']['belongsTo'](db[_0x7eb7('0x11d')],{'as':_0x7eb7('0x175'),'foreignKey':'ChatWebsiteId'});db['CmCompany']['hasMany'](db[_0x7eb7('0x77')],{'as':_0x7eb7('0x10b'),'foreignKey':_0x7eb7('0x176')});db[_0x7eb7('0x77')][_0x7eb7('0xff')](db['CmHopper'],{'as':_0x7eb7('0x177'),'foreignKey':'ContactId'});db[_0x7eb7('0x77')][_0x7eb7('0xff')](db[_0x7eb7('0x7c')],{'as':_0x7eb7('0x12f'),'foreignKey':'ContactId'});db[_0x7eb7('0x77')][_0x7eb7('0xff')](db[_0x7eb7('0x102')],{'as':_0x7eb7('0x178'),'foreignKey':_0x7eb7('0x144')});db[_0x7eb7('0x77')][_0x7eb7('0xff')](db['ReportAgentPreview'],{'as':_0x7eb7('0x7f'),'foreignKey':_0x7eb7('0x144')});db['CmContact'][_0x7eb7('0xff')](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':_0x7eb7('0x144')});db[_0x7eb7('0x77')][_0x7eb7('0xff')](db[_0x7eb7('0x61')],{'as':'OpenchannelInteractions','foreignKey':_0x7eb7('0x144'),'onDelete':_0x7eb7('0x157')});db['CmContact'][_0x7eb7('0xff')](db['ChatInteraction'],{'as':_0x7eb7('0x103'),'foreignKey':_0x7eb7('0x144'),'onDelete':_0x7eb7('0x157')});db[_0x7eb7('0x77')][_0x7eb7('0xff')](db[_0x7eb7('0x58')],{'as':_0x7eb7('0x104'),'foreignKey':_0x7eb7('0x144'),'onDelete':_0x7eb7('0x157')});db['CmContact']['hasMany'](db[_0x7eb7('0x4f')],{'as':_0x7eb7('0x111'),'foreignKey':_0x7eb7('0x144'),'onDelete':'restrict'});db['CmContact']['hasMany'](db[_0x7eb7('0x42')],{'as':_0x7eb7('0x10f'),'foreignKey':_0x7eb7('0x144'),'onDelete':_0x7eb7('0x157')});db[_0x7eb7('0x77')][_0x7eb7('0x105')](db[_0x7eb7('0x76')],{'as':'Company','foreignKey':_0x7eb7('0x176')});db[_0x7eb7('0x77')][_0x7eb7('0x105')](db[_0x7eb7('0x11a')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmContact']['belongsToMany'](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x160'),'through':_0x7eb7('0x179')});db[_0x7eb7('0x77')][_0x7eb7('0x108')](db['Tag'],{'as':_0x7eb7('0x151'),'through':'cm_contact_has_tags'});db[_0x7eb7('0x77')][_0x7eb7('0x108')](db[_0x7eb7('0x93')],{'through':'cm_contact_has_tags','as':_0x7eb7('0x153')});db[_0x7eb7('0x79')][_0x7eb7('0x105')](db[_0x7eb7('0x77')],{'as':_0x7eb7('0x143'),'foreignKey':_0x7eb7('0x144'),'onDelete':_0x7eb7('0xfd')});db[_0x7eb7('0x79')]['belongsTo'](db[_0x7eb7('0x11a')],{'as':'List','foreignKey':_0x7eb7('0x14c'),'onDelete':'cascade'});db['CmHopper']['belongsTo'](db[_0x7eb7('0x13')],{'as':'Agent','foreignKey':_0x7eb7('0xfe')});db[_0x7eb7('0x79')][_0x7eb7('0x105')](db[_0x7eb7('0x1d')],{'as':_0x7eb7('0x17a'),'foreignKey':'VoiceQueueId','onDelete':_0x7eb7('0xfd')});db[_0x7eb7('0x79')]['belongsTo'](db[_0x7eb7('0x17b')],{'as':'Campaign','foreignKey':_0x7eb7('0x17c'),'onDelete':_0x7eb7('0xfd')});db[_0x7eb7('0x79')]['belongsTo'](db['User'],{'as':_0x7eb7('0x150'),'foreignKey':_0x7eb7('0x17d')});db[_0x7eb7('0x7b')][_0x7eb7('0x105')](db[_0x7eb7('0x77')],{'as':_0x7eb7('0x143'),'foreignKey':_0x7eb7('0x144'),'onDelete':_0x7eb7('0xfd')});db[_0x7eb7('0x7b')][_0x7eb7('0x105')](db[_0x7eb7('0x11a')],{'as':_0x7eb7('0x15a'),'foreignKey':_0x7eb7('0x14c'),'onDelete':'cascade'});db[_0x7eb7('0x7b')][_0x7eb7('0x105')](db[_0x7eb7('0x1d')],{'as':_0x7eb7('0x17a'),'foreignKey':'VoiceQueueId','onDelete':_0x7eb7('0xfd')});db[_0x7eb7('0x7b')]['belongsTo'](db[_0x7eb7('0x17b')],{'as':_0x7eb7('0x17b'),'foreignKey':_0x7eb7('0x17c'),'onDelete':_0x7eb7('0xfd')});db[_0x7eb7('0x84')][_0x7eb7('0xff')](db[_0x7eb7('0x88')],{'as':{'plural':_0x7eb7('0x17e'),'singular':'OneAll'},'foreignKey':_0x7eb7('0x17f'),'onDelete':'cascade','hooks':!![]});db[_0x7eb7('0x84')][_0x7eb7('0xff')](db['Condition'],{'as':{'plural':_0x7eb7('0x180'),'singular':_0x7eb7('0x181')},'foreignKey':_0x7eb7('0x182'),'onDelete':_0x7eb7('0xfd'),'hooks':!![]});db[_0x7eb7('0x84')][_0x7eb7('0xff')](db[_0x7eb7('0x82')],{'as':_0x7eb7('0x183'),'foreignKey':'AutomationId','onDelete':_0x7eb7('0xfd'),'hooks':!![]});db[_0x7eb7('0x135')][_0x7eb7('0xff')](db[_0x7eb7('0x135')],{'as':_0x7eb7('0x184'),'foreignKey':_0x7eb7('0x158'),'onDelete':_0x7eb7('0xfd'),'hooks':!![],'required':![]});db['Interval'][_0x7eb7('0xff')](db[_0x7eb7('0x19')],{'as':_0x7eb7('0x101'),'foreignKey':_0x7eb7('0x158'),'onDelete':_0x7eb7('0x157')});db[_0x7eb7('0x135')][_0x7eb7('0xff')](db[_0x7eb7('0x14b')],{'as':_0x7eb7('0x185'),'foreignKey':'IntervalId'});db[_0x7eb7('0x135')][_0x7eb7('0xff')](db[_0x7eb7('0x68')],{'as':'ChatApplications','foreignKey':_0x7eb7('0x158')});db[_0x7eb7('0x135')][_0x7eb7('0xff')](db[_0x7eb7('0x4d')],{'as':'FaxApplications','foreignKey':_0x7eb7('0x158')});db['Interval'][_0x7eb7('0xff')](db[_0x7eb7('0x56')],{'as':_0x7eb7('0x186'),'foreignKey':_0x7eb7('0x158')});db['Schedule'][_0x7eb7('0x105')](db['MailAccount'],{});db[_0x7eb7('0x187')][_0x7eb7('0x105')](db['AnalyticDefaultReport'],{'foreignKey':_0x7eb7('0x188')});db[_0x7eb7('0x187')][_0x7eb7('0x105')](db['AnalyticCustomReport'],{'foreignKey':_0x7eb7('0x189')});db[_0x7eb7('0x91')]['belongsToMany'](db[_0x7eb7('0x1b')],{'as':_0x7eb7('0x18a'),'through':'moh_has_sounds','onDelete':_0x7eb7('0x157')});db[_0x7eb7('0x93')][_0x7eb7('0x108')](db[_0x7eb7('0x77')],{'through':_0x7eb7('0x18b')});db[_0x7eb7('0x93')][_0x7eb7('0x108')](db[_0x7eb7('0x6a')],{'through':_0x7eb7('0x172')});db[_0x7eb7('0x93')][_0x7eb7('0x108')](db[_0x7eb7('0x42')],{'through':_0x7eb7('0x152')});db[_0x7eb7('0x93')][_0x7eb7('0x108')](db[_0x7eb7('0x58')],{'through':_0x7eb7('0x165')});db['Tag'][_0x7eb7('0x108')](db[_0x7eb7('0x4f')],{'through':_0x7eb7('0x15f')});db[_0x7eb7('0x93')][_0x7eb7('0x108')](db['OpenchannelInteraction'],{'through':_0x7eb7('0x16b')});db[_0x7eb7('0x97')]['hasMany'](db[_0x7eb7('0x88')],{'as':{'plural':_0x7eb7('0x18c'),'singular':_0x7eb7('0x18d')},'foreignKey':_0x7eb7('0x18e'),'onDelete':_0x7eb7('0xfd'),'hooks':!![]});db['Trigger'][_0x7eb7('0xff')](db[_0x7eb7('0x88')],{'as':{'plural':_0x7eb7('0x18f'),'singular':_0x7eb7('0x190')},'foreignKey':_0x7eb7('0x191'),'onDelete':_0x7eb7('0xfd'),'hooks':!![]});db[_0x7eb7('0x97')][_0x7eb7('0xff')](db[_0x7eb7('0x82')],{'as':_0x7eb7('0x183'),'foreignKey':_0x7eb7('0x192'),'onDelete':_0x7eb7('0xfd'),'hooks':!![]});db[_0x7eb7('0x9d')][_0x7eb7('0xff')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x189'),'hooks':!![]});db[_0x7eb7('0x9f')][_0x7eb7('0xff')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x188')});db['AnalyticMetric'][_0x7eb7('0xff')](db[_0x7eb7('0xa4')],{'as':'Fields','onDelete':_0x7eb7('0xfd'),'foreignKey':'MetricId'});db[_0x7eb7('0xa4')][_0x7eb7('0x105')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db['SalesforceAccount']['hasMany'](db[_0x7eb7('0xa9')],{'as':_0x7eb7('0x193'),'onDelete':_0x7eb7('0xfd'),'foreignKey':'AccountId'});db[_0x7eb7('0xa9')][_0x7eb7('0xff')](db[_0x7eb7('0xaa')],{'as':_0x7eb7('0x194'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x195')});db[_0x7eb7('0xa9')][_0x7eb7('0xff')](db[_0x7eb7('0xaa')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x7eb7('0x196')});db[_0x7eb7('0xa9')][_0x7eb7('0xff')](db[_0x7eb7('0xaa')],{'as':_0x7eb7('0x197'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0xa9')][_0x7eb7('0x105')](db[_0x7eb7('0xa8')],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0xaa')]['hasMany'](db['SalesforceField'],{'as':_0x7eb7('0x19a'),'foreignKey':_0x7eb7('0x195')});db[_0x7eb7('0xaa')][_0x7eb7('0xff')](db[_0x7eb7('0xaa')],{'as':_0x7eb7('0x19b'),'foreignKey':_0x7eb7('0x196')});db[_0x7eb7('0xaa')][_0x7eb7('0xff')](db[_0x7eb7('0xaa')],{'as':'Field','foreignKey':'FieldId'});db[_0x7eb7('0xaa')][_0x7eb7('0x105')](db[_0x7eb7('0x99')],{'as':_0x7eb7('0x99'),'foreignKey':_0x7eb7('0x19c')});db[_0x7eb7('0xac')]['hasMany'](db[_0x7eb7('0x19d')],{'as':_0x7eb7('0x193'),'onDelete':_0x7eb7('0xfd'),'foreignKey':'AccountId'});db[_0x7eb7('0x19d')][_0x7eb7('0xff')](db[_0x7eb7('0xaf')],{'as':_0x7eb7('0x194'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x195')});db[_0x7eb7('0x19d')][_0x7eb7('0xff')](db['SugarcrmField'],{'as':_0x7eb7('0x19e'),'onDelete':'cascade','foreignKey':_0x7eb7('0x196')});db['SugarcrmConfiguration'][_0x7eb7('0xff')](db[_0x7eb7('0xaf')],{'as':_0x7eb7('0x197'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0x19d')][_0x7eb7('0x105')](db[_0x7eb7('0xac')],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0xaf')][_0x7eb7('0xff')](db[_0x7eb7('0xaf')],{'as':_0x7eb7('0x19a'),'foreignKey':_0x7eb7('0x195')});db[_0x7eb7('0xaf')][_0x7eb7('0xff')](db['SugarcrmField'],{'as':'Description','foreignKey':'DescriptionId'});db['SugarcrmField'][_0x7eb7('0xff')](db['SugarcrmField'],{'as':_0x7eb7('0x19f'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0xaf')]['belongsTo'](db[_0x7eb7('0x99')],{'as':_0x7eb7('0x99'),'foreignKey':_0x7eb7('0x19c')});db[_0x7eb7('0xb1')][_0x7eb7('0xff')](db[_0x7eb7('0xb3')],{'as':_0x7eb7('0x193'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x199')});db['DeskConfiguration'][_0x7eb7('0xff')](db[_0x7eb7('0xb5')],{'as':_0x7eb7('0x194'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x195')});db['DeskConfiguration'][_0x7eb7('0xff')](db[_0x7eb7('0xb5')],{'as':_0x7eb7('0x19e'),'onDelete':_0x7eb7('0xfd'),'foreignKey':'DescriptionId'});db[_0x7eb7('0xb3')]['hasMany'](db[_0x7eb7('0xb5')],{'as':_0x7eb7('0x197'),'onDelete':_0x7eb7('0xfd'),'foreignKey':'FieldId'});db[_0x7eb7('0xb3')][_0x7eb7('0x105')](db[_0x7eb7('0xb1')],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0xb3')]['belongsToMany'](db[_0x7eb7('0x93')],{'through':_0x7eb7('0x1a0')});db[_0x7eb7('0xb5')][_0x7eb7('0xff')](db['DeskField'],{'as':_0x7eb7('0x19a'),'foreignKey':_0x7eb7('0x195')});db[_0x7eb7('0xb5')]['hasMany'](db[_0x7eb7('0xb5')],{'as':_0x7eb7('0x19b'),'foreignKey':_0x7eb7('0x196')});db[_0x7eb7('0xb5')][_0x7eb7('0xff')](db[_0x7eb7('0xb5')],{'as':_0x7eb7('0x19f'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0xb5')][_0x7eb7('0x105')](db[_0x7eb7('0x99')],{'as':_0x7eb7('0x99'),'foreignKey':_0x7eb7('0x19c')});db[_0x7eb7('0xb7')]['hasMany'](db[_0x7eb7('0x1a1')],{'as':_0x7eb7('0x193'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0x1a1')][_0x7eb7('0xff')](db[_0x7eb7('0xb8')],{'as':_0x7eb7('0x194'),'onDelete':'cascade','foreignKey':_0x7eb7('0x195')});db[_0x7eb7('0x1a1')][_0x7eb7('0xff')](db['ZohoField'],{'as':_0x7eb7('0x19e'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x196')});db[_0x7eb7('0x1a1')][_0x7eb7('0xff')](db['ZohoField'],{'as':'Fields','onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0x1a1')][_0x7eb7('0x105')](db['ZohoAccount'],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0xb8')][_0x7eb7('0xff')](db[_0x7eb7('0xb8')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x7eb7('0xb8')][_0x7eb7('0xff')](db[_0x7eb7('0xb8')],{'as':_0x7eb7('0x19b'),'foreignKey':'DescriptionId'});db[_0x7eb7('0xb8')][_0x7eb7('0xff')](db['ZohoField'],{'as':_0x7eb7('0x19f'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0xb8')][_0x7eb7('0x105')](db[_0x7eb7('0x99')],{'as':'Variable','foreignKey':_0x7eb7('0x19c')});db[_0x7eb7('0x1a2')][_0x7eb7('0xff')](db[_0x7eb7('0xb9')],{'as':_0x7eb7('0x193'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0xb9')]['hasMany'](db['ZendeskField'],{'as':_0x7eb7('0x194'),'foreignKey':_0x7eb7('0x195')});db[_0x7eb7('0xb9')][_0x7eb7('0xff')](db['ZendeskField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x7eb7('0xff')](db['ZendeskField'],{'as':_0x7eb7('0x197'),'foreignKey':'FieldId'});db[_0x7eb7('0xb9')][_0x7eb7('0x105')](db[_0x7eb7('0x1a2')],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0xb9')][_0x7eb7('0x108')](db[_0x7eb7('0x93')],{'through':'int_zendesk_configuration_has_tags'});db[_0x7eb7('0xbb')][_0x7eb7('0xff')](db[_0x7eb7('0xbb')],{'as':_0x7eb7('0x19a'),'foreignKey':_0x7eb7('0x195')});db[_0x7eb7('0xbb')][_0x7eb7('0xff')](db['ZendeskField'],{'as':_0x7eb7('0x19b'),'foreignKey':_0x7eb7('0x196')});db[_0x7eb7('0xbb')][_0x7eb7('0xff')](db[_0x7eb7('0xbb')],{'as':_0x7eb7('0x19f'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0xbb')][_0x7eb7('0x105')](db[_0x7eb7('0x99')],{'as':_0x7eb7('0x99'),'foreignKey':_0x7eb7('0x19c')});db[_0x7eb7('0xbd')][_0x7eb7('0xff')](db[_0x7eb7('0x1a3')],{'as':_0x7eb7('0x193'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0x1a3')]['hasMany'](db[_0x7eb7('0xc0')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x7eb7('0x195')});db['FreshdeskConfiguration'][_0x7eb7('0xff')](db[_0x7eb7('0xc0')],{'as':_0x7eb7('0x19e'),'onDelete':'cascade','foreignKey':_0x7eb7('0x196')});db[_0x7eb7('0x1a3')][_0x7eb7('0xff')](db[_0x7eb7('0xc0')],{'as':_0x7eb7('0x197'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0x1a3')][_0x7eb7('0x105')](db['FreshdeskAccount'],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x199')});db['FreshdeskConfiguration'][_0x7eb7('0x108')](db[_0x7eb7('0x93')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0x7eb7('0xff')](db[_0x7eb7('0xc0')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x7eb7('0xc0')][_0x7eb7('0xff')](db[_0x7eb7('0xc0')],{'as':_0x7eb7('0x19b'),'foreignKey':'DescriptionId'});db['FreshdeskField']['hasMany'](db[_0x7eb7('0xc0')],{'as':_0x7eb7('0x19f'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0xc0')]['belongsTo'](db[_0x7eb7('0x99')],{'as':_0x7eb7('0x99'),'foreignKey':'VariableId'});db[_0x7eb7('0xc1')][_0x7eb7('0xff')](db[_0x7eb7('0x1a4')],{'as':_0x7eb7('0x193'),'onDelete':_0x7eb7('0xfd'),'foreignKey':'AccountId'});db[_0x7eb7('0x1a4')][_0x7eb7('0xff')](db[_0x7eb7('0xc3')],{'as':'Subjects','foreignKey':_0x7eb7('0x195')});db[_0x7eb7('0x1a4')]['hasMany'](db[_0x7eb7('0xc3')],{'as':_0x7eb7('0x19e'),'foreignKey':_0x7eb7('0x196')});db['VtigerConfiguration'][_0x7eb7('0xff')](db['VtigerField'],{'as':_0x7eb7('0x197'),'foreignKey':'FieldId'});db[_0x7eb7('0x1a4')][_0x7eb7('0x105')](db[_0x7eb7('0xc1')],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0xc3')][_0x7eb7('0xff')](db[_0x7eb7('0xc3')],{'as':_0x7eb7('0x19a'),'foreignKey':_0x7eb7('0x195')});db[_0x7eb7('0xc3')][_0x7eb7('0xff')](db[_0x7eb7('0xc3')],{'as':_0x7eb7('0x19b'),'foreignKey':_0x7eb7('0x196')});db[_0x7eb7('0xc3')][_0x7eb7('0xff')](db[_0x7eb7('0xc3')],{'as':_0x7eb7('0x19f'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0xc3')][_0x7eb7('0x105')](db[_0x7eb7('0x99')],{'as':_0x7eb7('0x99'),'foreignKey':_0x7eb7('0x19c')});db[_0x7eb7('0xc5')][_0x7eb7('0xff')](db[_0x7eb7('0x1a5')],{'as':'Configurations','onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0x1a5')][_0x7eb7('0xff')](db[_0x7eb7('0xc7')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x7eb7('0x1a5')][_0x7eb7('0xff')](db[_0x7eb7('0xc7')],{'as':_0x7eb7('0x19e'),'foreignKey':_0x7eb7('0x196')});db['ServicenowConfiguration'][_0x7eb7('0xff')](db[_0x7eb7('0xc7')],{'as':_0x7eb7('0x197'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0x1a5')][_0x7eb7('0x105')](db[_0x7eb7('0xc5')],{'as':'Account','foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0xc7')][_0x7eb7('0xff')](db[_0x7eb7('0xc7')],{'as':_0x7eb7('0x19a'),'foreignKey':'SubjectId'});db[_0x7eb7('0xc7')][_0x7eb7('0xff')](db[_0x7eb7('0xc7')],{'as':_0x7eb7('0x19b'),'foreignKey':'DescriptionId'});db[_0x7eb7('0xc7')][_0x7eb7('0xff')](db[_0x7eb7('0xc7')],{'as':_0x7eb7('0x19f'),'foreignKey':_0x7eb7('0x198')});db['ServicenowField']['belongsTo'](db['Variable'],{'as':_0x7eb7('0x99'),'foreignKey':_0x7eb7('0x19c')});db[_0x7eb7('0xc9')][_0x7eb7('0xff')](db[_0x7eb7('0xcb')],{'as':_0x7eb7('0x193'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x199')});db['Dynamics365Configuration'][_0x7eb7('0xff')](db[_0x7eb7('0xcd')],{'as':'Subjects','onDelete':_0x7eb7('0xfd'),'foreignKey':'SubjectId'});db[_0x7eb7('0xcb')][_0x7eb7('0xff')](db['Dynamics365Field'],{'as':_0x7eb7('0x19e'),'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x196')});db[_0x7eb7('0xcb')]['hasMany'](db['Dynamics365Field'],{'as':'Fields','onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0xcb')][_0x7eb7('0x105')](db[_0x7eb7('0xc9')],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0xcd')][_0x7eb7('0xff')](db[_0x7eb7('0xcd')],{'as':_0x7eb7('0x19a'),'foreignKey':'SubjectId'});db[_0x7eb7('0xcd')][_0x7eb7('0xff')](db[_0x7eb7('0xcd')],{'as':'Description','foreignKey':_0x7eb7('0x196')});db['Dynamics365Field']['hasMany'](db[_0x7eb7('0xcd')],{'as':_0x7eb7('0x19f'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0xcd')][_0x7eb7('0x105')](db[_0x7eb7('0x99')],{'as':_0x7eb7('0x99'),'foreignKey':_0x7eb7('0x19c')});db[_0x7eb7('0x1a6')][_0x7eb7('0xff')](db[_0x7eb7('0xd0')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0xd0')]['hasMany'](db[_0x7eb7('0x1a7')],{'as':'Subjects','foreignKey':'SubjectId'});db['FreshsalesConfiguration']['hasMany'](db[_0x7eb7('0x1a7')],{'as':_0x7eb7('0x19e'),'foreignKey':'DescriptionId'});db[_0x7eb7('0xd0')]['hasMany'](db[_0x7eb7('0x1a7')],{'as':_0x7eb7('0x197'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0xd0')][_0x7eb7('0x105')](db[_0x7eb7('0x1a6')],{'as':_0x7eb7('0x14f'),'foreignKey':_0x7eb7('0x199')});db[_0x7eb7('0x1a7')]['hasMany'](db[_0x7eb7('0x1a7')],{'as':_0x7eb7('0x19a'),'foreignKey':_0x7eb7('0x195')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':_0x7eb7('0x19b'),'foreignKey':_0x7eb7('0x196')});db['FreshsalesField']['hasMany'](db[_0x7eb7('0x1a7')],{'as':_0x7eb7('0x19f'),'foreignKey':_0x7eb7('0x198')});db[_0x7eb7('0x1a7')][_0x7eb7('0x105')](db[_0x7eb7('0x99')],{'as':'Variable','foreignKey':_0x7eb7('0x19c')});db[_0x7eb7('0xd6')][_0x7eb7('0x105')](db['ChatWebsite'],{});db['ChatQueueReport'][_0x7eb7('0x105')](db[_0x7eb7('0x11a')],{'as':_0x7eb7('0x15a'),'foreignKey':'ListId'});db['ChatQueueReport'][_0x7eb7('0x105')](db[_0x7eb7('0x77')],{'as':'Contact','foreignKey':_0x7eb7('0x144')});db[_0x7eb7('0xd6')][_0x7eb7('0x105')](db[_0x7eb7('0x6a')],{});db[_0x7eb7('0xd6')]['belongsTo'](db[_0x7eb7('0x6c')],{});db[_0x7eb7('0xd6')][_0x7eb7('0x105')](db['User'],{});db[_0x7eb7('0xd6')]['belongsTo'](db['ChatQueue'],{});db[_0x7eb7('0x1a8')][_0x7eb7('0x105')](db['User'],{'onDelete':_0x7eb7('0xfd'),'foreignKey':_0x7eb7('0x1a9')});db[_0x7eb7('0x1a8')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'onDelete':'cascade','foreignKey':_0x7eb7('0x1aa')});db[_0x7eb7('0x1ab')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0x7eb7('0x1ac'),'onDelete':_0x7eb7('0xfd')});db[_0x7eb7('0x1ab')][_0x7eb7('0xff')](db[_0x7eb7('0xd9')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x7eb7('0xdc')][_0x7eb7('0x105')](db[_0x7eb7('0x54')],{});db[_0x7eb7('0xdc')][_0x7eb7('0x105')](db[_0x7eb7('0x11a')],{'as':_0x7eb7('0x15a'),'foreignKey':'ListId'});db[_0x7eb7('0xdc')][_0x7eb7('0x105')](db['CmContact'],{'as':'Contact','foreignKey':_0x7eb7('0x144')});db['SmsQueueReport'][_0x7eb7('0x105')](db[_0x7eb7('0x58')],{});db[_0x7eb7('0xdc')][_0x7eb7('0x105')](db[_0x7eb7('0x59')],{});db[_0x7eb7('0xdc')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{});db[_0x7eb7('0xdc')][_0x7eb7('0x105')](db['SmsQueue'],{});db[_0x7eb7('0xe1')][_0x7eb7('0xff')](db[_0x7eb7('0x1ab')],{'foreignKey':_0x7eb7('0x1ad')});db[_0x7eb7('0xe1')][_0x7eb7('0xff')](db['JscriptyQuestionReport'],{'foreignKey':_0x7eb7('0x1ad')});db['JscriptyProject'][_0x7eb7('0xff')](db[_0x7eb7('0xd9')],{'foreignKey':_0x7eb7('0x1ad')});db['SquareProject']['belongsToMany'](db['User'],{'as':_0x7eb7('0x160'),'through':_0x7eb7('0x1ae')});db[_0x7eb7('0xec')][_0x7eb7('0x108')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x14d'),'through':_0x7eb7('0x10e')});db[_0x7eb7('0xec')][_0x7eb7('0x108')](db[_0x7eb7('0x1d')],{'through':'team_has_voice_queues','as':_0x7eb7('0x1af')});db['Team'][_0x7eb7('0x108')](db[_0x7eb7('0x3f')],{'through':_0x7eb7('0x1b0'),'as':_0x7eb7('0x1b1')});db[_0x7eb7('0xec')][_0x7eb7('0x108')](db[_0x7eb7('0x70')],{'through':_0x7eb7('0x173'),'as':_0x7eb7('0x117')});db[_0x7eb7('0xec')][_0x7eb7('0x108')](db['FaxQueue'],{'through':_0x7eb7('0x1b2'),'as':_0x7eb7('0x1b3')});db['Team'][_0x7eb7('0x108')](db[_0x7eb7('0x5b')],{'through':_0x7eb7('0x167'),'as':_0x7eb7('0x1b4')});db[_0x7eb7('0xec')][_0x7eb7('0x108')](db[_0x7eb7('0x63')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0x7eb7('0x17b')]['hasMany'](db[_0x7eb7('0x79')],{'as':_0x7eb7('0x177'),'foreignKey':_0x7eb7('0x17c')});db[_0x7eb7('0x17b')][_0x7eb7('0xff')](db[_0x7eb7('0x7c')],{'as':_0x7eb7('0x12f'),'foreignKey':'CampaignId'});db['Campaign'][_0x7eb7('0xff')](db[_0x7eb7('0x102')],{'as':_0x7eb7('0x178'),'foreignKey':_0x7eb7('0x17c')});db['Campaign'][_0x7eb7('0xff')](db[_0x7eb7('0x7b')],{'as':_0x7eb7('0x130'),'foreignKey':_0x7eb7('0x17c')});db['Campaign'][_0x7eb7('0x105')](db['Trunk'],{'as':_0x7eb7('0x2d'),'foreignKey':_0x7eb7('0x132')});db[_0x7eb7('0x17b')][_0x7eb7('0x105')](db['Trunk'],{'as':_0x7eb7('0x133'),'foreignKey':_0x7eb7('0x134')});db[_0x7eb7('0x17b')][_0x7eb7('0x105')](db[_0x7eb7('0x135')],{'as':_0x7eb7('0x135'),'foreignKey':_0x7eb7('0x158')});db[_0x7eb7('0x17b')][_0x7eb7('0x105')](db['SquareProject'],{'as':_0x7eb7('0xe6'),'foreignKey':'SquareProjectId'});db[_0x7eb7('0x17b')][_0x7eb7('0x108')](db['CmList'],{'as':_0x7eb7('0x10c'),'through':_0x7eb7('0x1b5')});db[_0x7eb7('0x17b')][_0x7eb7('0x108')](db[_0x7eb7('0x11a')],{'as':'BlackLists','through':_0x7eb7('0x1b6')});db[_0x7eb7('0x1b7')][_0x7eb7('0x105')](db['MailMessage'],{});db[_0x7eb7('0x1b7')][_0x7eb7('0x105')](db[_0x7eb7('0x42')],{});db[_0x7eb7('0x1b7')][_0x7eb7('0x105')](db[_0x7eb7('0x3e')],{'foreignKey':_0x7eb7('0x1b8'),'as':_0x7eb7('0x1b9')});db['MailTransferReport'][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'foreignKey':_0x7eb7('0x1ba'),'as':_0x7eb7('0x1bb')});db['MailTransferReport'][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'foreignKey':_0x7eb7('0x1bc'),'as':_0x7eb7('0x1bd')});db[_0x7eb7('0x1b7')][_0x7eb7('0x105')](db['MailQueue'],{'foreignKey':_0x7eb7('0x1be'),'as':_0x7eb7('0x1bf')});db[_0x7eb7('0x1b7')][_0x7eb7('0x105')](db[_0x7eb7('0x3e')],{'foreignKey':_0x7eb7('0x1c0'),'as':_0x7eb7('0x1c1')});db[_0x7eb7('0x1c2')][_0x7eb7('0x105')](db[_0x7eb7('0x6c')],{});db['ChatTransferReport'][_0x7eb7('0x105')](db[_0x7eb7('0x6a')],{});db[_0x7eb7('0x1c2')][_0x7eb7('0x105')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x7eb7('0x1c2')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'foreignKey':_0x7eb7('0x1ba'),'as':_0x7eb7('0x1bb')});db[_0x7eb7('0x1c2')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'foreignKey':_0x7eb7('0x1bc'),'as':_0x7eb7('0x1bd')});db[_0x7eb7('0x1c2')][_0x7eb7('0x105')](db[_0x7eb7('0x70')],{'foreignKey':_0x7eb7('0x1c3'),'as':_0x7eb7('0x1bf')});db[_0x7eb7('0x1c2')][_0x7eb7('0x105')](db[_0x7eb7('0x11d')],{'foreignKey':_0x7eb7('0x1c4'),'as':_0x7eb7('0x1c1')});db[_0x7eb7('0xf4')]['belongsTo'](db[_0x7eb7('0x51')],{});db[_0x7eb7('0xf4')]['belongsTo'](db['FaxInteraction'],{});db['FaxTransferReport']['belongsTo'](db[_0x7eb7('0x4b')],{'foreignKey':_0x7eb7('0x1c5'),'as':'FromAccount'});db[_0x7eb7('0xf4')][_0x7eb7('0x105')](db['User'],{'foreignKey':'FromUserId','as':_0x7eb7('0x1bb')});db[_0x7eb7('0xf4')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'foreignKey':'ToUserId','as':_0x7eb7('0x1bd')});db[_0x7eb7('0xf4')][_0x7eb7('0x105')](db[_0x7eb7('0x118')],{'foreignKey':_0x7eb7('0x1c6'),'as':_0x7eb7('0x1bf')});db['FaxTransferReport'][_0x7eb7('0x105')](db[_0x7eb7('0x4b')],{'foreignKey':_0x7eb7('0x1c7'),'as':_0x7eb7('0x1c1')});db[_0x7eb7('0xf5')][_0x7eb7('0x105')](db[_0x7eb7('0x62')],{});db[_0x7eb7('0xf5')][_0x7eb7('0x105')](db[_0x7eb7('0x61')],{});db[_0x7eb7('0xf5')][_0x7eb7('0x105')](db[_0x7eb7('0x5d')],{'foreignKey':_0x7eb7('0x1c8'),'as':'FromAccount'});db[_0x7eb7('0xf5')][_0x7eb7('0x105')](db['User'],{'foreignKey':'FromUserId','as':_0x7eb7('0x1bb')});db[_0x7eb7('0xf5')]['belongsTo'](db[_0x7eb7('0x13')],{'foreignKey':_0x7eb7('0x1bc'),'as':_0x7eb7('0x1bd')});db['OpenchannelTransferReport'][_0x7eb7('0x105')](db[_0x7eb7('0x63')],{'foreignKey':_0x7eb7('0x1c9'),'as':_0x7eb7('0x1bf')});db[_0x7eb7('0xf5')][_0x7eb7('0x105')](db['OpenchannelAccount'],{'foreignKey':_0x7eb7('0x1ca'),'as':'ToAccount'});db[_0x7eb7('0x1cb')]['belongsTo'](db[_0x7eb7('0x59')],{});db[_0x7eb7('0x1cb')][_0x7eb7('0x105')](db[_0x7eb7('0x58')],{});db[_0x7eb7('0x1cb')]['belongsTo'](db[_0x7eb7('0x54')],{'foreignKey':_0x7eb7('0x1cc'),'as':_0x7eb7('0x1b9')});db['SmsTransferReport'][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'foreignKey':_0x7eb7('0x1ba'),'as':_0x7eb7('0x1bb')});db[_0x7eb7('0x1cb')][_0x7eb7('0x105')](db[_0x7eb7('0x13')],{'foreignKey':_0x7eb7('0x1bc'),'as':_0x7eb7('0x1bd')});db[_0x7eb7('0x1cb')]['belongsTo'](db[_0x7eb7('0x5b')],{'foreignKey':_0x7eb7('0x1cd'),'as':_0x7eb7('0x1bf')});db['SmsTransferReport'][_0x7eb7('0x105')](db[_0x7eb7('0x54')],{'foreignKey':_0x7eb7('0x1ce'),'as':_0x7eb7('0x1c1')});db['CmList'][_0x7eb7('0xff')](db[_0x7eb7('0x15b')],{'as':_0x7eb7('0x148'),'foreignKey':_0x7eb7('0x14c')});db[_0x7eb7('0x11a')][_0x7eb7('0xff')](db[_0x7eb7('0x1cf')],{'as':_0x7eb7('0x1d0'),'foreignKey':_0x7eb7('0x14c')});db['CmList'][_0x7eb7('0xff')](db[_0x7eb7('0x77')],{'as':_0x7eb7('0x10b'),'onDelete':'cascade','foreignKey':_0x7eb7('0x14c')});db[_0x7eb7('0x11a')]['hasMany'](db[_0x7eb7('0x7c')],{'as':_0x7eb7('0x12f'),'foreignKey':_0x7eb7('0x14c')});db[_0x7eb7('0x11a')]['hasMany'](db['CmHopperHistory'],{'as':_0x7eb7('0x1d1'),'foreignKey':'ListId'});db[_0x7eb7('0x11a')]['hasMany'](db[_0x7eb7('0x7f')],{'as':_0x7eb7('0x7f'),'foreignKey':_0x7eb7('0x14c')});db['CmList'][_0x7eb7('0x108')](db['VoiceQueue'],{'as':_0x7eb7('0x1d2'),'through':'voice_queues_has_cm_lists'});db[_0x7eb7('0x11a')][_0x7eb7('0x108')](db['User'],{'as':_0x7eb7('0x14d'),'through':_0x7eb7('0x10d')});db[_0x7eb7('0xf7')][_0x7eb7('0xff')](db[_0x7eb7('0x19')],{'as':'Extensions','onDelete':_0x7eb7('0x157')});db[_0x7eb7('0xf7')][_0x7eb7('0x108')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x14d'),'through':'user_has_voice_prefixes'});db['UserProfile'][_0x7eb7('0xff')](db[_0x7eb7('0x13')],{'as':_0x7eb7('0x160'),'foreignKey':_0x7eb7('0x107')});db[_0x7eb7('0x106')][_0x7eb7('0xff')](db['UserProfileSection'],{'as':_0x7eb7('0x1d3'),'foreignKey':_0x7eb7('0x107'),'onDelete':'cascade'});db['UserProfileSection'][_0x7eb7('0xff')](db[_0x7eb7('0xfb')],{'as':_0x7eb7('0x1d4'),'foreignKey':'sectionId','onDelete':_0x7eb7('0xfd')});module[_0x7eb7('0x1d5')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xbe10=['OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/sound/sound.model','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','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','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','hasOne','cascade','hasMany','Recordings','UserId','VoiceExtension','Extensions','HopperFinals','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','belongsTo','UserProfile','userProfileId','Groups','chat_group_has_users','belongsToMany','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','MailInteraction','user_has_mail_interactions','user_has_chat_interactions','user_has_openchannel_interactions','UserVoiceQueue','MailQueues','ChatQueues','UserSmsQueue','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','SquareProjects','SpiedAgents','ChanSpyId','Applications','Sound','VoiceQueueId','CmHopper','HopperHistories','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','Interval','IntervalId','Pause','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','team_has_voice_queues','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','AgentReports','Imap','Smtp','Dispositions','MailAccountId','Answers','MailApplication','List','ListId','TemplateId','team_has_mail_queues','Teams','MailMessage','MailInteractionId','Account','Contact','Owner','Tag','mail_interaction_has_tags','Tags','Interaction','restrict','TagId','Items','FaxAccountId','Interactions','FaxApplication','Exntensions','FaxInteractionId','ContactId','ThroughTags','user_has_fax_interactions','AttachmentId','FaxQueueReport','SmsAccountId','SmsApplication','SmsMessage','SmsInteractionId','Users','user_has_sms_interactions','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ChatProactiveAction','ProactiveActions','ChatApplication','Agent','Queue','ChatQueueId','Website','ChatInteractionId','team_has_chat_queues','ChatGroupId','Members','Contacts','CompanyId','JscriptySessionReport','Company','cm_contact_has_tags','CampaignId','OwnerId','All','OneAll','AutomationAllId','OneAny','AutomationId','Intervals','MailApplications','AnalyticCustomReport','CustomReportId','Mohs','moh_has_sounds','sms_interaction_has_tags','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','DefaultReportId','MetricId','Subjects','SubjectId','DescriptionId','FieldId','AccountId','Subject','Description','Field','VariableId','Configurations','Descriptions','SugarcrmAccount','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowConfiguration','Dynamics365Account','Dynamics365Configuration','ChatQueueReport','ChatInternalMessage','FromId','ToId','SessionId','ProjectId','user_has_square_projects','VoiceQueues','FaxQueues','team_has_sms_queues','Hoppers','campaigns_has_cm_lists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','user_has_voice_prefixes','sectionId','path','lodash','jstz','determine','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','username','password','options','database','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserOpenchannelQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model'];(function(_0x3b0e0c,_0x5e4814){var _0x3efb86=function(_0x82a918){while(--_0x82a918){_0x3b0e0c['push'](_0x3b0e0c['shift']());}};_0x3efb86(++_0x5e4814);}(_0xbe10,0x174));var _0x0be1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbe10[_0x57b54c];return _0x59cc19;};'use strict';var path=require(_0x0be1('0x0'));var config=require('../config/environment');var Sequelize=require('sequelize');var _=require(_0x0be1('0x1'));var jstz=require(_0x0be1('0x2'));var timezone=jstz[_0x0be1('0x3')]();config[_0x0be1('0x4')]=_[_0x0be1('0x5')](config['sequelize'],{'database':_0x0be1('0x6'),'username':_0x0be1('0x7'),'password':_0x0be1('0x8'),'options':{'host':_0x0be1('0x9'),'port':0xcea,'dialect':_0x0be1('0xa'),'dialectOptions':{'charset':_0x0be1('0xb')},'logging':![],'timezone':timezone[_0x0be1('0xc')](),'define':{'charset':_0x0be1('0xd'),'collate':_0x0be1('0xe')}}});config['sequelizeHistory']=_[_0x0be1('0x5')](config[_0x0be1('0xf')],{'database':'motion2','username':_0x0be1('0x7'),'password':_0x0be1('0x8'),'options':{'host':_0x0be1('0x9'),'port':0xcea,'dialect':_0x0be1('0xa'),'dialectOptions':{'charset':_0x0be1('0xb')},'logging':![],'timezone':timezone[_0x0be1('0xc')](),'define':{'charset':_0x0be1('0xd'),'collate':_0x0be1('0xe')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0be1('0x4')][_0x0be1('0x10')],config['sequelize'][_0x0be1('0x11')],config['sequelize'][_0x0be1('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x0be1('0xf')][_0x0be1('0x13')],config[_0x0be1('0xf')]['username'],config[_0x0be1('0xf')]['password'],config['sequelizeHistory'][_0x0be1('0x12')])};db[_0x0be1('0x14')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x16'));db['VoiceChanSpy']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x17'));db[_0x0be1('0x18')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x19'));db['VoiceExtension']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/voiceExtension/voiceExtension.model');db[_0x0be1('0x1a')]=db['sequelize']['import'](_0x0be1('0x1b'));db[_0x0be1('0x1c')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x1d'));db[_0x0be1('0x1e')]=db['sequelize']['import']('../api/voiceRecording/voiceRecording.model');db[_0x0be1('0x1f')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x20'));db[_0x0be1('0x21')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/voiceMail/voiceMail.model');db[_0x0be1('0x22')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db['VoiceCallReport']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x23'));db[_0x0be1('0x24')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/voiceDialReport/voiceDialReport.model');db[_0x0be1('0x25')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x26'));db[_0x0be1('0x27')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x28'));db[_0x0be1('0x29')]=db[_0x0be1('0x4')]['import']('../api/memberReport/memberReport.model');db['Trunk']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x2a'));db['VoiceTransferReport']=db['sequelize']['import'](_0x0be1('0x2b'));db[_0x0be1('0x2c')]=db['sequelize'][_0x0be1('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db['UserVoiceQueue']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x0be1('0x2d')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x2e'));db[_0x0be1('0x2f')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x30'));db[_0x0be1('0x31')]=db['sequelize'][_0x0be1('0x15')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db[_0x0be1('0x4')]['import']('../api/userSmsQueue/userSmsQueue.model');db[_0x0be1('0x32')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x0be1('0x33')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x34'));db[_0x0be1('0x35')]=db['sequelize'][_0x0be1('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0x0be1('0x36')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/mailAccount/mailAccount.model');db[_0x0be1('0x37')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x38'));db[_0x0be1('0x39')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x3a'));db['MailInteraction']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x3b'));db['MailMessage']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x3c'));db['MailApplication']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x3d'));db[_0x0be1('0x3e')]=db['sequelize'][_0x0be1('0x15')]('../api/mailQueueReport/mailQueueReport.model');db[_0x0be1('0x3f')]=db['sequelize']['import'](_0x0be1('0x40'));db[_0x0be1('0x41')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x42'));db[_0x0be1('0x43')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x44'));db['FaxApplication']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x45'));db[_0x0be1('0x46')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/faxInteraction/faxInteraction.model');db[_0x0be1('0x47')]=db['sequelize'][_0x0be1('0x15')]('../api/faxMessage/faxMessage.model');db[_0x0be1('0x48')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x49'));db['FaxQueueReport']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x4a'));db[_0x0be1('0x4b')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x4c'));db['SmsApplication']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/smsApplication/smsApplication.model');db[_0x0be1('0x4d')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0x0be1('0x4')]['import'](_0x0be1('0x4e'));db[_0x0be1('0x4f')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x50'));db[_0x0be1('0x51')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x52'));db[_0x0be1('0x53')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x54'));db[_0x0be1('0x55')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x56'));db['OpenchannelMessage']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/openchannelMessage/openchannelMessage.model');db[_0x0be1('0x57')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/openchannelQueue/openchannelQueue.model');db[_0x0be1('0x58')]=db['sequelize']['import'](_0x0be1('0x59'));db[_0x0be1('0x5a')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x5b'));db['ChatApplication']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x5c'));db[_0x0be1('0x5d')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x5e'));db[_0x0be1('0x5f')]=db[_0x0be1('0x4')]['import']('../api/chatMessage/chatMessage.model');db[_0x0be1('0x60')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x61'));db[_0x0be1('0x62')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/chatQueue/chatQueue.model');db[_0x0be1('0x63')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x64'));db['ChatProactiveAction']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x0be1('0x65')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x66'));db[_0x0be1('0x67')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x68'));db['CmHopper']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x69'));db[_0x0be1('0x6a')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x6b'));db[_0x0be1('0x6c')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x6d'));db['CmHopperHistory']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x6e'));db['ReportAgentPreview']=db['sequelize']['import']('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x6f'));db[_0x0be1('0x70')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x71'));db[_0x0be1('0x72')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/automation/automation.model');db[_0x0be1('0x73')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x74'));db[_0x0be1('0x75')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x76'));db[_0x0be1('0x77')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x78'));db['Interval']=db[_0x0be1('0x4')]['import'](_0x0be1('0x79'));db['Pause']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x7a'));db[_0x0be1('0x7b')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x7c'));db[_0x0be1('0x7d')]=db['sequelize']['import'](_0x0be1('0x7e'));db[_0x0be1('0x7f')]=db[_0x0be1('0x4')]['import']('../api/schedule/schedule.model');db['Sound']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x80'));db['Tag']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x81'));db[_0x0be1('0x82')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x83'));db[_0x0be1('0x84')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x85'));db[_0x0be1('0x86')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x87'));db[_0x0be1('0x88')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/integration/integration.model');db[_0x0be1('0x89')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x8a'));db['AnalyticCustomReport']=db['sequelize'][_0x0be1('0x15')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x0be1('0x8b')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x0be1('0x8c')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x0be1('0x8d')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x8e'));db[_0x0be1('0x8f')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x90'));db[_0x0be1('0x91')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x92'));db[_0x0be1('0x93')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0x94'));db[_0x0be1('0x95')]=db['sequelize']['import'](_0x0be1('0x96'));db[_0x0be1('0x97')]=db['sequelize']['import'](_0x0be1('0x98'));db['SugarcrmAccount']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x99'));db[_0x0be1('0x9a')]=db[_0x0be1('0x4')]['import'](_0x0be1('0x9b'));db[_0x0be1('0x9c')]=db['sequelize']['import']('../api/intSugarcrmField/intSugarcrmField.model');db[_0x0be1('0x9d')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0x9e'));db['DeskConfiguration']=db[_0x0be1('0x4')]['import'](_0x0be1('0x9f'));db[_0x0be1('0xa0')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xa1'));db['ZohoAccount']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xa2'));db[_0x0be1('0xa3')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xa4'));db[_0x0be1('0xa5')]=db['sequelize']['import'](_0x0be1('0xa6'));db[_0x0be1('0xa7')]=db['sequelize'][_0x0be1('0x15')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0x0be1('0xa8')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xa9'));db[_0x0be1('0xaa')]=db['sequelize']['import'](_0x0be1('0xab'));db[_0x0be1('0xac')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xad'));db[_0x0be1('0xae')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xaf'));db[_0x0be1('0xb0')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xb1'));db['VtigerAccount']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x0be1('0xb2')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xb3'));db[_0x0be1('0xb4')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xb5'));db[_0x0be1('0xb6')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xb7'));db['ServicenowConfiguration']=db['sequelize']['import'](_0x0be1('0xb8'));db[_0x0be1('0xb9')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xba'));db['Dynamics365Account']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xbb'));db['Dynamics365Configuration']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xbc'));db[_0x0be1('0xbd')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x0be1('0xbe')]=db['sequelize'][_0x0be1('0x15')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x0be1('0xbf')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x0be1('0xc0')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xc1'));db[_0x0be1('0x88')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xc2'));db['Network']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xc3'));db['ChatQueueReport']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xc4'));db['ChatInternalMessage']=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xc5'));db[_0x0be1('0xc6')]=db['sequelize']['import'](_0x0be1('0xc7'));db[_0x0be1('0xc8')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xc9'));db['JscriptySessionReport']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x0be1('0xca')]=db['sequelize'][_0x0be1('0x15')]('../api/smsQueueReport/smsQueueReport.model');db[_0x0be1('0xcb')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xcc'));db['SquareDetailsReport']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xcd'));db[_0x0be1('0xce')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xcf'));db[_0x0be1('0xd0')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xd1'));db[_0x0be1('0xd2')]=db['sequelize']['import'](_0x0be1('0xd3'));db[_0x0be1('0xd4')]=db['sequelize']['import'](_0x0be1('0xd5'));db['SquareRecording']=db[_0x0be1('0x4')]['import'](_0x0be1('0xd6'));db[_0x0be1('0xd7')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xd8'));db[_0x0be1('0xd9')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/team/team.model');db[_0x0be1('0xda')]=db['sequelize']['import']('../api/license/license.model');db[_0x0be1('0xdb')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xdc'));db['Migration']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xdd'));db[_0x0be1('0xde')]=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/attachment/attachment.model');db[_0x0be1('0xdf')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xe0'));db[_0x0be1('0xe1')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xe2'));db[_0x0be1('0xe3')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xe4'));db[_0x0be1('0xe5')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xe6'));db[_0x0be1('0xe7')]=db['sequelize']['import'](_0x0be1('0xe8'));db[_0x0be1('0xe9')]=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xea'));db[_0x0be1('0xeb')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xec'));db[_0x0be1('0xed')]=db[_0x0be1('0x4')]['import'](_0x0be1('0xee'));db['UserProfile']=db[_0x0be1('0x4')][_0x0be1('0x15')](_0x0be1('0xef'));db['UserProfileSection']=db[_0x0be1('0x4')][_0x0be1('0x15')]('../api/userProfileSection/userProfileSection.model');db[_0x0be1('0xf0')]=db['sequelize'][_0x0be1('0x15')](_0x0be1('0xf1'));db[_0x0be1('0x14')][_0x0be1('0xf2')](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0x0be1('0xf3'),'foreignKey':'UserId'});db[_0x0be1('0x14')][_0x0be1('0xf4')](db['VoiceRecording'],{'as':_0x0be1('0xf5'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0x2c')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db[_0x0be1('0x14')]['hasMany'](db[_0x0be1('0xf7')],{'as':_0x0be1('0xf8'),'onDelete':'cascade','hooks':!![]});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0x6c')],{'as':_0x0be1('0xf9'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0xfa')],{'as':_0x0be1('0xfb'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0xfc')],{'as':_0x0be1('0xfc'),'foreignKey':_0x0be1('0xf6')});db['User'][_0x0be1('0xf4')](db['OpenchannelInteraction'],{'as':_0x0be1('0xfd'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0x5d')],{'as':'ChatInteractions','foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0x4d')],{'as':_0x0be1('0xfe'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db[_0x0be1('0x46')],{'as':_0x0be1('0xff'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0xf4')](db['MailInteraction'],{'as':_0x0be1('0x100'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x14')][_0x0be1('0x101')](db[_0x0be1('0x102')],{'as':'UserProfile','foreignKey':_0x0be1('0x103')});db[_0x0be1('0x14')]['belongsToMany'](db[_0x0be1('0x63')],{'as':_0x0be1('0x104'),'through':_0x0be1('0x105')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x67')],{'as':'Contacts','through':_0x0be1('0x107')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x108'),'through':_0x0be1('0x109')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0xd9')],{'through':_0x0be1('0x10a')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x10b')],{'as':_0x0be1('0x100'),'through':_0x0be1('0x10c')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x5d')],{'as':'ChatInteractions','through':_0x0be1('0x10d')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x46')],{'as':'FaxInteractions','through':'user_has_fax_interactions'});db['User'][_0x0be1('0x106')](db['SmsInteraction'],{'as':_0x0be1('0xfe'),'through':'user_has_sms_interactions'});db[_0x0be1('0x14')]['belongsToMany'](db[_0x0be1('0x55')],{'as':_0x0be1('0xfd'),'through':_0x0be1('0x10e')});db[_0x0be1('0x14')][_0x0be1('0x106')](db['VoiceQueue'],{'as':'VoiceQueues','through':_0x0be1('0x10f'),'required':![]});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x37')],{'as':_0x0be1('0x110'),'through':_0x0be1('0x2f'),'required':![]});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x62')],{'as':_0x0be1('0x111'),'through':_0x0be1('0x2d'),'required':![],'hooks':!![]});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x48')],{'as':'FaxQueues','through':_0x0be1('0x31'),'required':![]});db['User'][_0x0be1('0x106')](db[_0x0be1('0x4f')],{'as':'SmsQueues','through':_0x0be1('0x112'),'required':![]});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x57')],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0xeb')],{'through':_0x0be1('0x109')});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0xed')],{'as':'VoicePrefixes','through':'user_has_voice_prefixes','required':![]});db[_0x0be1('0x14')][_0x0be1('0x106')](db[_0x0be1('0x58')],{'as':'ChatWebsites','through':_0x0be1('0x113')});db['User'][_0x0be1('0x106')](db[_0x0be1('0x43')],{'as':_0x0be1('0x114'),'through':_0x0be1('0x115')});db['User']['belongsToMany'](db['MailAccount'],{'as':_0x0be1('0x116'),'through':_0x0be1('0x117')});db['User']['belongsToMany'](db[_0x0be1('0x51')],{'as':_0x0be1('0x118'),'through':_0x0be1('0x119')});db[_0x0be1('0x14')]['belongsToMany'](db[_0x0be1('0x4b')],{'as':_0x0be1('0x11a'),'through':'user_has_sms_accounts'});db[_0x0be1('0x14')][_0x0be1('0x106')](db['SquareProject'],{'as':_0x0be1('0x11b'),'through':'user_has_square_projects'});db['VoiceChanSpy'][_0x0be1('0xf4')](db['VoiceExtension'],{'as':_0x0be1('0x11c'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x11d')});db[_0x0be1('0x18')]['hasMany'](db[_0x0be1('0xf7')],{'onDelete':_0x0be1('0xf3')});db['VoiceExtension']['hasMany'](db[_0x0be1('0xf7')],{'as':_0x0be1('0x11e'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x1a')]['belongsToMany'](db[_0x0be1('0x11f')],{'as':'Sounds','through':'moh_has_sounds'});db['VoiceQueue']['hasMany'](db[_0x0be1('0x2c')],{'as':'Members','foreignKey':_0x0be1('0x120')});db[_0x0be1('0x1c')]['hasMany'](db[_0x0be1('0x121')],{'as':'Hoppers','foreignKey':_0x0be1('0x120')});db[_0x0be1('0x1c')]['hasMany'](db[_0x0be1('0x6c')],{'as':_0x0be1('0xf9'),'foreignKey':'VoiceQueueId'});db[_0x0be1('0x1c')][_0x0be1('0xf4')](db[_0x0be1('0xfa')],{'as':_0x0be1('0x122'),'foreignKey':_0x0be1('0x120')});db[_0x0be1('0x1c')][_0x0be1('0xf4')](db[_0x0be1('0xfc')],{'as':_0x0be1('0xfc'),'foreignKey':'VoiceQueueId'});db[_0x0be1('0x1c')]['hasMany'](db[_0x0be1('0x6a')],{'as':_0x0be1('0x123'),'foreignKey':_0x0be1('0x120')});db[_0x0be1('0x1c')][_0x0be1('0xf4')](db['JscriptySessionReport'],{'as':_0x0be1('0x124'),'foreignKey':_0x0be1('0x120')});db[_0x0be1('0x1c')]['belongsTo'](db[_0x0be1('0x125')],{'as':_0x0be1('0x125'),'foreignKey':_0x0be1('0x126')});db[_0x0be1('0x1c')][_0x0be1('0x101')](db[_0x0be1('0x125')],{'as':_0x0be1('0x127'),'foreignKey':_0x0be1('0x128')});db[_0x0be1('0x1c')][_0x0be1('0x101')](db[_0x0be1('0x129')],{'as':_0x0be1('0x129'),'foreignKey':_0x0be1('0x12a')});db['VoiceQueue'][_0x0be1('0x101')](db[_0x0be1('0x12b')],{'as':_0x0be1('0x12c'),'foreignKey':_0x0be1('0x12d')});db[_0x0be1('0x1c')][_0x0be1('0x106')](db['CmList'],{'as':_0x0be1('0x108'),'through':_0x0be1('0x12e')});db['VoiceQueue'][_0x0be1('0x106')](db['User'],{'as':_0x0be1('0x12f'),'through':'UserVoiceQueue'});db[_0x0be1('0x1c')][_0x0be1('0x106')](db[_0x0be1('0xd9')],{'as':'Teams','through':_0x0be1('0x130')});db['VoiceQueue'][_0x0be1('0x106')](db['CmList'],{'as':'BlackLists','through':_0x0be1('0x131')});db[_0x0be1('0x1e')][_0x0be1('0x101')](db['User'],{'as':_0x0be1('0x14'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x1f')][_0x0be1('0x101')](db['User'],{'as':_0x0be1('0x14'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x21')][_0x0be1('0xf4')](db['VoiceMailMessage'],{'as':_0x0be1('0x132'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x133'),'sourceKey':_0x0be1('0x134')});db[_0x0be1('0x22')][_0x0be1('0x101')](db[_0x0be1('0x21')],{'foreignKey':'mailboxuser','targetKey':_0x0be1('0x134')});db[_0x0be1('0x135')][_0x0be1('0xf4')](db[_0x0be1('0x27')],{'as':'QueueCalls','foreignKey':_0x0be1('0x136'),'constraints':![]});db[_0x0be1('0x135')][_0x0be1('0xf4')](db[_0x0be1('0x25')],{'as':_0x0be1('0x137'),'foreignKey':_0x0be1('0x136'),'constraints':![]});db[_0x0be1('0x135')]['belongsTo'](db[_0x0be1('0x14')],{'as':_0x0be1('0x14'),'foreignKey':'UserId'});db[_0x0be1('0x135')][_0x0be1('0x101')](db[_0x0be1('0x67')],{'as':'Contact','foreignKey':'ContactId'});db['MailServerIn'][_0x0be1('0x101')](db[_0x0be1('0x36')],{'as':'MailAccount','foreignKey':'MailAccountId'});db['MailServerOut'][_0x0be1('0x101')](db[_0x0be1('0x36')],{'as':_0x0be1('0x36'),'foreignKey':'MailAccountId'});db[_0x0be1('0x36')][_0x0be1('0xf2')](db['MailServerIn'],{'as':_0x0be1('0x138'),'onDelete':'cascade'});db[_0x0be1('0x36')][_0x0be1('0xf2')](db[_0x0be1('0x35')],{'as':_0x0be1('0x139'),'onDelete':_0x0be1('0xf3')});db['MailAccount'][_0x0be1('0xf4')](db[_0x0be1('0x75')],{'as':_0x0be1('0x13a'),'foreignKey':_0x0be1('0x13b')});db[_0x0be1('0x36')][_0x0be1('0xf4')](db[_0x0be1('0x73')],{'as':_0x0be1('0x13c'),'foreignKey':_0x0be1('0x13b')});db['MailAccount'][_0x0be1('0xf4')](db['MailMessage'],{'as':_0x0be1('0x132'),'foreignKey':_0x0be1('0x13b')});db[_0x0be1('0x36')][_0x0be1('0xf4')](db[_0x0be1('0x10b')],{'as':'Interactions'});db[_0x0be1('0x36')][_0x0be1('0xf4')](db[_0x0be1('0x13d')],{'as':'Applications'});db[_0x0be1('0x36')][_0x0be1('0x101')](db['CmList'],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db[_0x0be1('0x36')][_0x0be1('0x101')](db['Template'],{'as':_0x0be1('0x82'),'foreignKey':_0x0be1('0x140')});db[_0x0be1('0x36')]['belongsTo'](db[_0x0be1('0x12b')],{'as':_0x0be1('0x12c'),'foreignKey':_0x0be1('0x12d')});db['MailAccount'][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':_0x0be1('0x117')});db[_0x0be1('0x37')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':'UserMailQueue'});db['MailQueue'][_0x0be1('0x106')](db[_0x0be1('0xd9')],{'through':_0x0be1('0x141'),'as':_0x0be1('0x142')});db['MailInteraction'][_0x0be1('0xf4')](db[_0x0be1('0x143')],{'as':_0x0be1('0x132'),'onDelete':'cascade','foreignKey':_0x0be1('0x144')});db['MailInteraction'][_0x0be1('0x101')](db['MailAccount'],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x13b')});db[_0x0be1('0x10b')]['belongsTo'](db[_0x0be1('0x67')],{'as':_0x0be1('0x146'),'foreignKey':'ContactId'});db[_0x0be1('0x10b')][_0x0be1('0x101')](db['User'],{'as':_0x0be1('0x147'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x10b')][_0x0be1('0x106')](db[_0x0be1('0x148')],{'through':_0x0be1('0x149'),'as':_0x0be1('0x14a')});db[_0x0be1('0x10b')]['belongsToMany'](db[_0x0be1('0x148')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x0be1('0x10b')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':'Users','through':_0x0be1('0x10c'),'foreignKey':_0x0be1('0x144')});db[_0x0be1('0x143')][_0x0be1('0xf4')](db[_0x0be1('0xde')],{'as':'Attachments','onDelete':_0x0be1('0xf3')});db['MailMessage'][_0x0be1('0x101')](db[_0x0be1('0x14')],{'as':'User'});db[_0x0be1('0x143')][_0x0be1('0x101')](db[_0x0be1('0x67')],{'onDelete':_0x0be1('0xf3'),'as':'Contact'});db[_0x0be1('0x143')][_0x0be1('0x101')](db['MailInteraction'],{'as':_0x0be1('0x14b'),'foreignKey':_0x0be1('0x144')});db[_0x0be1('0x143')][_0x0be1('0x101')](db[_0x0be1('0x36')],{'as':'Account','foreignKey':_0x0be1('0x13b')});db[_0x0be1('0x13d')]['belongsTo'](db[_0x0be1('0x14')],{'onDelete':'restrict'});db[_0x0be1('0x13d')][_0x0be1('0x101')](db[_0x0be1('0x37')],{'onDelete':_0x0be1('0x14c')});db['MailApplication'][_0x0be1('0x101')](db['MailAccount'],{'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x13d')]['belongsTo'](db[_0x0be1('0x129')],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x12a')});db[_0x0be1('0x13d')]['belongsTo'](db['Tag'],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x14d')});db['MailQueueReport']['belongsTo'](db[_0x0be1('0x36')],{});db['MailQueueReport'][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db['MailQueueReport']['belongsTo'](db[_0x0be1('0x67')],{'as':_0x0be1('0x146'),'foreignKey':'ContactId'});db[_0x0be1('0x3e')]['belongsTo'](db['MailInteraction'],{});db[_0x0be1('0x3e')][_0x0be1('0x101')](db[_0x0be1('0x143')],{});db['MailQueueReport']['belongsTo'](db[_0x0be1('0x14')],{});db[_0x0be1('0x3e')]['belongsTo'](db['MailQueue'],{});db[_0x0be1('0x3f')][_0x0be1('0xf4')](db['DashboardItem'],{'as':_0x0be1('0x14e'),'onDelete':_0x0be1('0xf3')});db['FaxAccount'][_0x0be1('0xf4')](db[_0x0be1('0x75')],{'as':_0x0be1('0x13a'),'foreignKey':_0x0be1('0x14f')});db['FaxAccount'][_0x0be1('0xf4')](db[_0x0be1('0x73')],{'as':_0x0be1('0x13c'),'foreignKey':'FaxAccountId'});db[_0x0be1('0x43')][_0x0be1('0xf4')](db[_0x0be1('0x46')],{'as':_0x0be1('0x150')});db[_0x0be1('0x43')]['hasMany'](db[_0x0be1('0x151')],{'as':'Applications'});db[_0x0be1('0x43')]['hasMany'](db[_0x0be1('0xf7')],{'as':_0x0be1('0x152'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x43')]['hasMany'](db[_0x0be1('0x47')],{'as':_0x0be1('0x132')});db['FaxAccount']['belongsTo'](db[_0x0be1('0x125')],{'as':'Trunk'});db[_0x0be1('0x43')][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db[_0x0be1('0x43')]['belongsTo'](db[_0x0be1('0x12b')],{'as':_0x0be1('0x12c'),'foreignKey':_0x0be1('0x12d')});db[_0x0be1('0x43')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':'Agents','through':_0x0be1('0x115')});db[_0x0be1('0x151')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'onDelete':'restrict'});db['FaxApplication'][_0x0be1('0x101')](db['FaxQueue'],{'onDelete':'restrict'});db[_0x0be1('0x151')][_0x0be1('0x101')](db[_0x0be1('0x43')],{'onDelete':'restrict'});db[_0x0be1('0x151')][_0x0be1('0x101')](db[_0x0be1('0x148')],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x14d')});db[_0x0be1('0x46')][_0x0be1('0xf4')](db[_0x0be1('0x47')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0be1('0x153')});db[_0x0be1('0x46')][_0x0be1('0x101')](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x0be1('0x46')]['belongsTo'](db[_0x0be1('0x67')],{'as':'Contact','foreignKey':_0x0be1('0x154')});db[_0x0be1('0x46')][_0x0be1('0x101')](db['User'],{'as':_0x0be1('0x147'),'foreignKey':'UserId'});db['FaxInteraction'][_0x0be1('0x106')](db[_0x0be1('0x148')],{'through':'fax_interaction_has_tags','as':_0x0be1('0x14a')});db['FaxInteraction'][_0x0be1('0x106')](db[_0x0be1('0x148')],{'through':'fax_interaction_has_tags','as':_0x0be1('0x155')});db[_0x0be1('0x46')][_0x0be1('0x106')](db['User'],{'as':'Users','through':_0x0be1('0x156'),'foreignKey':_0x0be1('0x153')});db[_0x0be1('0x47')][_0x0be1('0x101')](db['User'],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x14')});db['FaxMessage']['belongsTo'](db[_0x0be1('0x46')],{'as':_0x0be1('0x14b'),'foreignKey':_0x0be1('0x153')});db[_0x0be1('0x47')][_0x0be1('0x101')](db['CmContact'],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x146')});db[_0x0be1('0x47')][_0x0be1('0x101')](db[_0x0be1('0xde')],{'as':'Attachment','foreignKey':_0x0be1('0x157')});db[_0x0be1('0x47')][_0x0be1('0x101')](db['FaxAccount'],{'as':_0x0be1('0x145'),'foreignKey':'FaxAccountId'});db[_0x0be1('0x48')]['belongsToMany'](db['User'],{'as':_0x0be1('0x12f'),'through':_0x0be1('0x31')});db[_0x0be1('0x48')]['belongsToMany'](db['Team'],{'through':'team_has_fax_queues','as':'Teams'});db[_0x0be1('0x158')][_0x0be1('0x101')](db[_0x0be1('0x43')],{});db[_0x0be1('0x158')][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db['FaxQueueReport']['belongsTo'](db[_0x0be1('0x67')],{'as':'Contact','foreignKey':_0x0be1('0x154')});db[_0x0be1('0x158')]['belongsTo'](db[_0x0be1('0x46')],{});db[_0x0be1('0x158')][_0x0be1('0x101')](db['FaxMessage'],{});db[_0x0be1('0x158')]['belongsTo'](db[_0x0be1('0x14')],{});db[_0x0be1('0x158')][_0x0be1('0x101')](db[_0x0be1('0x48')],{});db['SmsAccount'][_0x0be1('0xf4')](db[_0x0be1('0x75')],{'as':_0x0be1('0x13a'),'foreignKey':_0x0be1('0x159')});db[_0x0be1('0x4b')][_0x0be1('0xf4')](db[_0x0be1('0x73')],{'as':_0x0be1('0x13c'),'foreignKey':_0x0be1('0x159')});db['SmsAccount'][_0x0be1('0xf4')](db['SmsMessage'],{'as':_0x0be1('0x132'),'foreignKey':'SmsAccountId'});db[_0x0be1('0x4b')][_0x0be1('0xf4')](db[_0x0be1('0x4d')],{'as':_0x0be1('0x150')});db[_0x0be1('0x4b')][_0x0be1('0xf4')](db[_0x0be1('0x15a')],{'as':'Applications'});db[_0x0be1('0x4b')]['belongsTo'](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db[_0x0be1('0x4b')][_0x0be1('0x101')](db[_0x0be1('0x12b')],{'as':_0x0be1('0x12c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0be1('0x4b')]['belongsToMany'](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':'user_has_sms_accounts'});db[_0x0be1('0x15a')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x15a')]['belongsTo'](db['SmsQueue'],{'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x15a')][_0x0be1('0x101')](db[_0x0be1('0x4b')],{'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x15a')][_0x0be1('0x101')](db[_0x0be1('0x129')],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x12a')});db[_0x0be1('0x15a')][_0x0be1('0x101')](db['Tag'],{'onDelete':_0x0be1('0x14c'),'foreignKey':'TagId'});db[_0x0be1('0x4d')][_0x0be1('0xf4')](db[_0x0be1('0x15b')],{'as':_0x0be1('0x132'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x15c')});db['SmsInteraction'][_0x0be1('0x101')](db[_0x0be1('0x4b')],{'as':_0x0be1('0x145'),'foreignKey':'SmsAccountId'});db['SmsInteraction'][_0x0be1('0x101')](db[_0x0be1('0x67')],{'as':'Contact','foreignKey':_0x0be1('0x154')});db[_0x0be1('0x4d')][_0x0be1('0x101')](db['User'],{'as':_0x0be1('0x147'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x4d')][_0x0be1('0x106')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x0be1('0x14a')});db['SmsInteraction']['belongsToMany'](db[_0x0be1('0x148')],{'through':'sms_interaction_has_tags','as':_0x0be1('0x155')});db[_0x0be1('0x4d')][_0x0be1('0x106')](db['User'],{'as':_0x0be1('0x15d'),'through':_0x0be1('0x15e'),'foreignKey':_0x0be1('0x15c')});db[_0x0be1('0x15b')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'as':_0x0be1('0x14')});db[_0x0be1('0x15b')][_0x0be1('0x101')](db['CmContact'],{'onDelete':'cascade','as':_0x0be1('0x146')});db['SmsMessage'][_0x0be1('0x101')](db['SmsInteraction'],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x14b'),'foreignKey':_0x0be1('0x15c')});db[_0x0be1('0x15b')]['belongsTo'](db['SmsAccount'],{'as':'Account','foreignKey':_0x0be1('0x159')});db[_0x0be1('0x4f')]['belongsToMany'](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':'UserSmsQueue','foreignKey':_0x0be1('0x15f')});db[_0x0be1('0x4f')]['belongsToMany'](db['Team'],{'through':'team_has_sms_queues','as':_0x0be1('0x142')});db[_0x0be1('0x51')][_0x0be1('0xf4')](db[_0x0be1('0x75')],{'as':_0x0be1('0x13a'),'foreignKey':_0x0be1('0x160')});db[_0x0be1('0x51')][_0x0be1('0xf4')](db[_0x0be1('0x73')],{'as':_0x0be1('0x13c'),'foreignKey':_0x0be1('0x160')});db[_0x0be1('0x51')][_0x0be1('0xf4')](db[_0x0be1('0x55')],{'as':_0x0be1('0x150'),'foreignKey':_0x0be1('0x160')});db[_0x0be1('0x51')][_0x0be1('0xf4')](db[_0x0be1('0x161')],{'as':_0x0be1('0x132'),'foreignKey':'OpenchannelAccountId'});db[_0x0be1('0x51')][_0x0be1('0xf4')](db['OpenchannelApplication'],{'as':_0x0be1('0x11e'),'foreignKey':_0x0be1('0x160')});db[_0x0be1('0x51')]['belongsTo'](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db[_0x0be1('0x51')]['belongsTo'](db[_0x0be1('0x12b')],{'as':_0x0be1('0x12c'),'foreignKey':_0x0be1('0x12d')});db[_0x0be1('0x51')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':'user_has_openchannel_accounts'});db['OpenchannelApplication']['belongsTo'](db[_0x0be1('0x14')],{'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x53')][_0x0be1('0x101')](db['OpenchannelQueue'],{'onDelete':_0x0be1('0x14c'),'foreignKey':'OpenchannelQueueId'});db[_0x0be1('0x53')]['belongsTo'](db[_0x0be1('0x51')],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x160')});db['OpenchannelApplication'][_0x0be1('0x101')](db[_0x0be1('0x129')],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x12a')});db['OpenchannelApplication'][_0x0be1('0x101')](db['Tag'],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x14d')});db['OpenchannelInteraction'][_0x0be1('0xf4')](db[_0x0be1('0x161')],{'as':_0x0be1('0x132'),'onDelete':'cascade','foreignKey':_0x0be1('0x162')});db[_0x0be1('0x55')][_0x0be1('0x101')](db[_0x0be1('0x51')],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x160')});db[_0x0be1('0x55')]['belongsTo'](db[_0x0be1('0x67')],{'as':_0x0be1('0x146'),'foreignKey':'ContactId'});db['OpenchannelInteraction']['belongsTo'](db[_0x0be1('0x14')],{'as':_0x0be1('0x147'),'foreignKey':'UserId'});db[_0x0be1('0x55')]['belongsToMany'](db[_0x0be1('0x148')],{'through':_0x0be1('0x163'),'as':_0x0be1('0x14a')});db['OpenchannelInteraction'][_0x0be1('0x106')](db[_0x0be1('0x148')],{'through':_0x0be1('0x163'),'as':_0x0be1('0x155')});db[_0x0be1('0x55')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x15d'),'through':_0x0be1('0x10e'),'foreignKey':_0x0be1('0x162')});db[_0x0be1('0x161')]['belongsTo'](db[_0x0be1('0x14')],{'onDelete':_0x0be1('0xf3'),'as':'User'});db[_0x0be1('0x161')][_0x0be1('0x101')](db['CmContact'],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x146')});db[_0x0be1('0x161')][_0x0be1('0x101')](db['OpenchannelInteraction'],{'onDelete':'cascade','as':_0x0be1('0x14b'),'foreignKey':_0x0be1('0x162')});db[_0x0be1('0x161')][_0x0be1('0x101')](db[_0x0be1('0xde')],{'as':_0x0be1('0xde'),'foreignKey':_0x0be1('0x157')});db[_0x0be1('0x161')][_0x0be1('0x101')](db[_0x0be1('0x51')],{'as':'Account','foreignKey':'OpenchannelAccountId'});db[_0x0be1('0x57')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':_0x0be1('0x32'),'foreignKey':_0x0be1('0x164')});db[_0x0be1('0x57')][_0x0be1('0x106')](db[_0x0be1('0xd9')],{'through':_0x0be1('0x165'),'as':_0x0be1('0x142')});db['ChatWebsite'][_0x0be1('0xf4')](db[_0x0be1('0x75')],{'as':_0x0be1('0x13a'),'foreignKey':_0x0be1('0x166')});db[_0x0be1('0x58')][_0x0be1('0xf4')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x0be1('0x166')});db[_0x0be1('0x58')][_0x0be1('0xf4')](db[_0x0be1('0x167')],{'as':_0x0be1('0x168')});db[_0x0be1('0x58')]['hasMany'](db['ChatInteraction'],{'as':_0x0be1('0x150')});db[_0x0be1('0x58')][_0x0be1('0xf4')](db[_0x0be1('0x169')],{'as':_0x0be1('0x11e')});db[_0x0be1('0x58')][_0x0be1('0xf4')](db['ChatMessage'],{'as':_0x0be1('0x132')});db[_0x0be1('0x58')]['belongsTo'](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db['ChatWebsite'][_0x0be1('0x101')](db[_0x0be1('0x129')],{'as':_0x0be1('0x129'),'foreignKey':'IntervalId'});db[_0x0be1('0x58')][_0x0be1('0x101')](db['Pause'],{'as':_0x0be1('0x12c'),'foreignKey':_0x0be1('0x12d')});db['ChatWebsite']['belongsToMany'](db['User'],{'as':_0x0be1('0x12f'),'through':_0x0be1('0x113')});db[_0x0be1('0x5a')][_0x0be1('0x101')](db[_0x0be1('0x51')],{});db[_0x0be1('0x5a')][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':'ListId'});db[_0x0be1('0x5a')]['belongsTo'](db[_0x0be1('0x67')],{'as':_0x0be1('0x146'),'foreignKey':_0x0be1('0x154')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0be1('0x5a')][_0x0be1('0x101')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport'][_0x0be1('0x101')](db[_0x0be1('0x14')],{});db[_0x0be1('0x5a')]['belongsTo'](db[_0x0be1('0x57')],{});db[_0x0be1('0x169')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'as':_0x0be1('0x16a'),'foreignKey':_0x0be1('0xf6'),'onDelete':_0x0be1('0x14c')});db['ChatApplication'][_0x0be1('0x101')](db[_0x0be1('0x62')],{'as':_0x0be1('0x16b'),'foreignKey':_0x0be1('0x16c'),'onDelete':_0x0be1('0x14c')});db['ChatApplication'][_0x0be1('0x101')](db['ChatWebsite'],{'as':_0x0be1('0x16d'),'foreignKey':_0x0be1('0x166'),'onDelete':'restrict'});db[_0x0be1('0x169')]['belongsTo'](db[_0x0be1('0x148')],{'onDelete':_0x0be1('0x14c'),'foreignKey':_0x0be1('0x14d')});db[_0x0be1('0x5d')][_0x0be1('0xf4')](db[_0x0be1('0x5f')],{'as':_0x0be1('0x132'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x16e')});db[_0x0be1('0x5d')][_0x0be1('0x101')](db['ChatWebsite'],{'as':_0x0be1('0x145'),'foreignKey':'ChatWebsiteId'});db[_0x0be1('0x5d')]['belongsTo'](db[_0x0be1('0x67')],{'as':'Contact','foreignKey':_0x0be1('0x154')});db[_0x0be1('0x5d')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'as':_0x0be1('0x147'),'foreignKey':_0x0be1('0xf6')});db[_0x0be1('0x5d')][_0x0be1('0x106')](db[_0x0be1('0x148')],{'through':'chat_interaction_has_tags','as':_0x0be1('0x14a')});db[_0x0be1('0x5d')][_0x0be1('0x106')](db['Tag'],{'through':'chat_interaction_has_tags','as':_0x0be1('0x155')});db[_0x0be1('0x5d')][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x15d'),'through':'user_has_chat_interactions','foreignKey':_0x0be1('0x16e')});db[_0x0be1('0x5f')]['belongsTo'](db[_0x0be1('0x14')],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x14')});db[_0x0be1('0x5f')][_0x0be1('0x101')](db[_0x0be1('0x67')],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x146'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0x5f')][_0x0be1('0x101')](db['ChatInteraction'],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x14b'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x0be1('0x101')](db[_0x0be1('0xde')],{'as':'Attachment','foreignKey':_0x0be1('0x157')});db[_0x0be1('0x5f')][_0x0be1('0x101')](db['ChatWebsite'],{'as':'Account','foreignKey':_0x0be1('0x166')});db[_0x0be1('0x60')][_0x0be1('0x101')](db['CmContact'],{'onDelete':_0x0be1('0xf3'),'as':_0x0be1('0x146'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0x60')]['belongsTo'](db[_0x0be1('0x58')],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x166')});db[_0x0be1('0x62')]['belongsToMany'](db['User'],{'as':_0x0be1('0x12f'),'through':_0x0be1('0x2d'),'hooks':!![]});db[_0x0be1('0x62')][_0x0be1('0x106')](db[_0x0be1('0xd9')],{'through':_0x0be1('0x16f'),'as':'Teams'});db['ChatGroup'][_0x0be1('0xf4')](db['ChatInternalMessage'],{'as':_0x0be1('0x132'),'foreignKey':_0x0be1('0x170'),'onDelete':'cascade'});db[_0x0be1('0x63')][_0x0be1('0x106')](db['User'],{'as':_0x0be1('0x171'),'through':'chat_group_has_users'});db[_0x0be1('0x167')][_0x0be1('0x101')](db['ChatWebsite'],{'as':_0x0be1('0x16d'),'foreignKey':'ChatWebsiteId'});db['CmCompany']['hasMany'](db['CmContact'],{'as':_0x0be1('0x172'),'foreignKey':_0x0be1('0x173')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db[_0x0be1('0x67')][_0x0be1('0xf4')](db['CmHopperFinal'],{'as':_0x0be1('0xf9'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db['CmHopperHistory'],{'as':_0x0be1('0x122'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x0be1('0x154')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db[_0x0be1('0x174')],{'as':_0x0be1('0x124'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db[_0x0be1('0x55')],{'as':_0x0be1('0xfd'),'foreignKey':_0x0be1('0x154'),'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db[_0x0be1('0x5d')],{'as':'ChatInteractions','foreignKey':'ContactId','onDelete':_0x0be1('0x14c')});db[_0x0be1('0x67')]['hasMany'](db[_0x0be1('0x4d')],{'as':'SmsInteractions','foreignKey':'ContactId','onDelete':_0x0be1('0x14c')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db[_0x0be1('0x46')],{'as':_0x0be1('0xff'),'foreignKey':_0x0be1('0x154'),'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x67')][_0x0be1('0xf4')](db[_0x0be1('0x10b')],{'as':_0x0be1('0x100'),'foreignKey':'ContactId','onDelete':_0x0be1('0x14c')});db[_0x0be1('0x67')]['belongsTo'](db[_0x0be1('0x65')],{'as':_0x0be1('0x175'),'foreignKey':'CompanyId'});db['CmContact'][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x67')]['belongsToMany'](db['User'],{'as':_0x0be1('0x15d'),'through':_0x0be1('0x107')});db[_0x0be1('0x67')]['belongsToMany'](db['Tag'],{'as':'Tags','through':_0x0be1('0x176')});db['CmContact'][_0x0be1('0x106')](db['Tag'],{'through':_0x0be1('0x176'),'as':_0x0be1('0x155')});db[_0x0be1('0x121')][_0x0be1('0x101')](db['CmContact'],{'as':'Contact','foreignKey':_0x0be1('0x154'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x121')][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x121')]['belongsTo'](db[_0x0be1('0x14')],{'as':_0x0be1('0x16a'),'foreignKey':'UserId'});db[_0x0be1('0x121')][_0x0be1('0x101')](db[_0x0be1('0x1c')],{'as':_0x0be1('0x16b'),'foreignKey':'VoiceQueueId','onDelete':_0x0be1('0xf3')});db[_0x0be1('0x121')][_0x0be1('0x101')](db[_0x0be1('0xdb')],{'as':_0x0be1('0xdb'),'foreignKey':_0x0be1('0x177'),'onDelete':_0x0be1('0xf3')});db['CmHopper'][_0x0be1('0x101')](db[_0x0be1('0x14')],{'as':_0x0be1('0x147'),'foreignKey':_0x0be1('0x178')});db[_0x0be1('0x6a')][_0x0be1('0x101')](db['CmContact'],{'as':_0x0be1('0x146'),'foreignKey':_0x0be1('0x154'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x6a')]['belongsTo'](db[_0x0be1('0xeb')],{'as':'List','foreignKey':'ListId','onDelete':_0x0be1('0xf3')});db[_0x0be1('0x6a')]['belongsTo'](db[_0x0be1('0x1c')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x0be1('0xf3')});db[_0x0be1('0x6a')][_0x0be1('0x101')](db['Campaign'],{'as':_0x0be1('0xdb'),'foreignKey':_0x0be1('0x177'),'onDelete':_0x0be1('0xf3')});db[_0x0be1('0x72')]['hasMany'](db[_0x0be1('0x77')],{'as':{'plural':_0x0be1('0x179'),'singular':_0x0be1('0x17a')},'foreignKey':_0x0be1('0x17b'),'onDelete':_0x0be1('0xf3'),'hooks':!![]});db['Automation'][_0x0be1('0xf4')](db['Condition'],{'as':{'plural':'Any','singular':_0x0be1('0x17c')},'foreignKey':'AutomationAnyId','onDelete':_0x0be1('0xf3'),'hooks':!![]});db['Automation'][_0x0be1('0xf4')](db[_0x0be1('0x70')],{'as':'Actions','foreignKey':_0x0be1('0x17d'),'onDelete':_0x0be1('0xf3'),'hooks':!![]});db[_0x0be1('0x129')]['hasMany'](db[_0x0be1('0x129')],{'as':_0x0be1('0x17e'),'foreignKey':_0x0be1('0x12a'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x0be1('0x129')][_0x0be1('0xf4')](db['VoiceExtension'],{'as':_0x0be1('0xf8'),'foreignKey':_0x0be1('0x12a'),'onDelete':'restrict'});db[_0x0be1('0x129')][_0x0be1('0xf4')](db['MailApplication'],{'as':_0x0be1('0x17f'),'foreignKey':_0x0be1('0x12a')});db[_0x0be1('0x129')][_0x0be1('0xf4')](db[_0x0be1('0x169')],{'as':'ChatApplications','foreignKey':_0x0be1('0x12a')});db[_0x0be1('0x129')][_0x0be1('0xf4')](db[_0x0be1('0x151')],{'as':'FaxApplications','foreignKey':_0x0be1('0x12a')});db[_0x0be1('0x129')][_0x0be1('0xf4')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0x0be1('0x12a')});db[_0x0be1('0x7f')][_0x0be1('0x101')](db[_0x0be1('0x36')],{});db[_0x0be1('0x7f')][_0x0be1('0x101')](db[_0x0be1('0x8b')],{'foreignKey':'DefaultReportId'});db[_0x0be1('0x7f')][_0x0be1('0x101')](db[_0x0be1('0x180')],{'foreignKey':_0x0be1('0x181')});db[_0x0be1('0x11f')][_0x0be1('0x106')](db[_0x0be1('0x1a')],{'as':_0x0be1('0x182'),'through':_0x0be1('0x183'),'onDelete':_0x0be1('0x14c')});db[_0x0be1('0x148')][_0x0be1('0x106')](db[_0x0be1('0x67')],{'through':'cm_contact_has_tags'});db[_0x0be1('0x148')][_0x0be1('0x106')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0x0be1('0x148')]['belongsToMany'](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0x0be1('0x148')][_0x0be1('0x106')](db[_0x0be1('0x4d')],{'through':_0x0be1('0x184')});db[_0x0be1('0x148')]['belongsToMany'](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0x0be1('0x148')]['belongsToMany'](db[_0x0be1('0x55')],{'through':_0x0be1('0x163')});db[_0x0be1('0x84')][_0x0be1('0xf4')](db['Condition'],{'as':{'plural':'AllConditions','singular':'AllCondition'},'foreignKey':_0x0be1('0x185'),'onDelete':_0x0be1('0xf3'),'hooks':!![]});db[_0x0be1('0x84')]['hasMany'](db['Condition'],{'as':{'plural':_0x0be1('0x186'),'singular':_0x0be1('0x187')},'foreignKey':_0x0be1('0x188'),'onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0x0be1('0x70')],{'as':_0x0be1('0x189'),'foreignKey':_0x0be1('0x18a'),'onDelete':_0x0be1('0xf3'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0x0be1('0x8f')],{'as':_0x0be1('0x18b'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x181'),'hooks':!![]});db[_0x0be1('0x8b')][_0x0be1('0xf4')](db['AnalyticFieldReport'],{'as':_0x0be1('0x18b'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x18c')});db[_0x0be1('0x8d')][_0x0be1('0xf4')](db[_0x0be1('0x8f')],{'as':_0x0be1('0x18b'),'onDelete':'cascade','foreignKey':_0x0be1('0x18d')});db['AnalyticFieldReport']['belongsTo'](db['AnalyticMetric'],{'foreignKey':_0x0be1('0x18d')});db[_0x0be1('0x93')][_0x0be1('0xf4')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x0be1('0xf3'),'foreignKey':'AccountId'});db[_0x0be1('0x95')]['hasMany'](db[_0x0be1('0x97')],{'as':_0x0be1('0x18e'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x18f')});db['SalesforceConfiguration'][_0x0be1('0xf4')](db['SalesforceField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x0be1('0x190')});db['SalesforceConfiguration'][_0x0be1('0xf4')](db[_0x0be1('0x97')],{'as':_0x0be1('0x18b'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0x95')][_0x0be1('0x101')](db[_0x0be1('0x93')],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0x97')]['hasMany'](db[_0x0be1('0x97')],{'as':_0x0be1('0x193'),'foreignKey':'SubjectId'});db[_0x0be1('0x97')]['hasMany'](db[_0x0be1('0x97')],{'as':_0x0be1('0x194'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0x97')]['hasMany'](db[_0x0be1('0x97')],{'as':_0x0be1('0x195'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0x97')][_0x0be1('0x101')](db['Variable'],{'as':_0x0be1('0x86'),'foreignKey':_0x0be1('0x196')});db['SugarcrmAccount'][_0x0be1('0xf4')](db[_0x0be1('0x9a')],{'as':_0x0be1('0x197'),'onDelete':'cascade','foreignKey':_0x0be1('0x192')});db[_0x0be1('0x9a')][_0x0be1('0xf4')](db['SugarcrmField'],{'as':_0x0be1('0x18e'),'onDelete':_0x0be1('0xf3'),'foreignKey':'SubjectId'});db[_0x0be1('0x9a')][_0x0be1('0xf4')](db[_0x0be1('0x9c')],{'as':_0x0be1('0x198'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0x9a')][_0x0be1('0xf4')](db[_0x0be1('0x9c')],{'as':'Fields','onDelete':_0x0be1('0xf3'),'foreignKey':'FieldId'});db[_0x0be1('0x9a')][_0x0be1('0x101')](db[_0x0be1('0x199')],{'as':'Account','foreignKey':_0x0be1('0x192')});db[_0x0be1('0x9c')][_0x0be1('0xf4')](db[_0x0be1('0x9c')],{'as':'Subject','foreignKey':_0x0be1('0x18f')});db[_0x0be1('0x9c')][_0x0be1('0xf4')](db[_0x0be1('0x9c')],{'as':_0x0be1('0x194'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0x9c')][_0x0be1('0xf4')](db[_0x0be1('0x9c')],{'as':_0x0be1('0x195'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0x9c')][_0x0be1('0x101')](db[_0x0be1('0x86')],{'as':_0x0be1('0x86'),'foreignKey':'VariableId'});db[_0x0be1('0x9d')][_0x0be1('0xf4')](db[_0x0be1('0x19a')],{'as':_0x0be1('0x197'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x0be1('0x19a')][_0x0be1('0xf4')](db[_0x0be1('0xa0')],{'as':_0x0be1('0x18e'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x18f')});db['DeskConfiguration']['hasMany'](db[_0x0be1('0xa0')],{'as':_0x0be1('0x198'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0x19a')]['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0x19a')][_0x0be1('0x101')](db['DeskAccount'],{'as':'Account','foreignKey':_0x0be1('0x192')});db[_0x0be1('0x19a')][_0x0be1('0x106')](db[_0x0be1('0x148')],{'through':_0x0be1('0x19b')});db[_0x0be1('0xa0')][_0x0be1('0xf4')](db[_0x0be1('0xa0')],{'as':_0x0be1('0x193'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xa0')][_0x0be1('0xf4')](db[_0x0be1('0xa0')],{'as':_0x0be1('0x194'),'foreignKey':'DescriptionId'});db[_0x0be1('0xa0')][_0x0be1('0xf4')](db[_0x0be1('0xa0')],{'as':'Field','foreignKey':_0x0be1('0x191')});db['DeskField'][_0x0be1('0x101')](db['Variable'],{'as':_0x0be1('0x86'),'foreignKey':_0x0be1('0x196')});db[_0x0be1('0x19c')]['hasMany'](db['ZohoConfiguration'],{'as':_0x0be1('0x197'),'onDelete':_0x0be1('0xf3'),'foreignKey':'AccountId'});db[_0x0be1('0xa3')][_0x0be1('0xf4')](db[_0x0be1('0xa5')],{'as':_0x0be1('0x18e'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xa3')][_0x0be1('0xf4')](db[_0x0be1('0xa5')],{'as':'Descriptions','onDelete':_0x0be1('0xf3'),'foreignKey':'DescriptionId'});db[_0x0be1('0xa3')][_0x0be1('0xf4')](db[_0x0be1('0xa5')],{'as':_0x0be1('0x18b'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0xa3')][_0x0be1('0x101')](db['ZohoAccount'],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xa5')][_0x0be1('0xf4')](db[_0x0be1('0xa5')],{'as':_0x0be1('0x193'),'foreignKey':'SubjectId'});db[_0x0be1('0xa5')]['hasMany'](db[_0x0be1('0xa5')],{'as':_0x0be1('0x194'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0xa5')][_0x0be1('0xf4')](db[_0x0be1('0xa5')],{'as':_0x0be1('0x195'),'foreignKey':'FieldId'});db[_0x0be1('0xa5')][_0x0be1('0x101')](db[_0x0be1('0x86')],{'as':_0x0be1('0x86'),'foreignKey':_0x0be1('0x196')});db[_0x0be1('0xa7')][_0x0be1('0xf4')](db[_0x0be1('0xa8')],{'as':_0x0be1('0x197'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xa8')][_0x0be1('0xf4')](db['ZendeskField'],{'as':_0x0be1('0x18e'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xa8')][_0x0be1('0xf4')](db[_0x0be1('0xaa')],{'as':_0x0be1('0x198'),'foreignKey':'DescriptionId'});db[_0x0be1('0xa8')]['hasMany'](db['ZendeskField'],{'as':_0x0be1('0x18b'),'foreignKey':_0x0be1('0x191')});db['ZendeskConfiguration']['belongsTo'](db['ZendeskAccount'],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xa8')]['belongsToMany'](db[_0x0be1('0x148')],{'through':_0x0be1('0x19d')});db[_0x0be1('0xaa')][_0x0be1('0xf4')](db[_0x0be1('0xaa')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0be1('0xaa')][_0x0be1('0xf4')](db[_0x0be1('0xaa')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0be1('0xaa')]['hasMany'](db[_0x0be1('0xaa')],{'as':'Field','foreignKey':'FieldId'});db['ZendeskField']['belongsTo'](db[_0x0be1('0x86')],{'as':_0x0be1('0x86'),'foreignKey':'VariableId'});db[_0x0be1('0xac')][_0x0be1('0xf4')](db[_0x0be1('0xae')],{'as':_0x0be1('0x197'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xae')][_0x0be1('0xf4')](db[_0x0be1('0xb0')],{'as':_0x0be1('0x18e'),'onDelete':'cascade','foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xae')]['hasMany'](db[_0x0be1('0xb0')],{'as':_0x0be1('0x198'),'onDelete':'cascade','foreignKey':_0x0be1('0x190')});db[_0x0be1('0xae')][_0x0be1('0xf4')](db[_0x0be1('0xb0')],{'as':_0x0be1('0x18b'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0xae')]['belongsTo'](db[_0x0be1('0xac')],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xae')]['belongsToMany'](db[_0x0be1('0x148')],{'through':_0x0be1('0x19e')});db['FreshdeskField'][_0x0be1('0xf4')](db[_0x0be1('0xb0')],{'as':_0x0be1('0x193'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0x0be1('0xf4')](db['FreshdeskField'],{'as':_0x0be1('0x194'),'foreignKey':'DescriptionId'});db[_0x0be1('0xb0')]['hasMany'](db[_0x0be1('0xb0')],{'as':_0x0be1('0x195'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0xb0')][_0x0be1('0x101')](db[_0x0be1('0x86')],{'as':_0x0be1('0x86'),'foreignKey':_0x0be1('0x196')});db[_0x0be1('0x19f')][_0x0be1('0xf4')](db['VtigerConfiguration'],{'as':_0x0be1('0x197'),'onDelete':_0x0be1('0xf3'),'foreignKey':'AccountId'});db[_0x0be1('0xb2')][_0x0be1('0xf4')](db[_0x0be1('0xb4')],{'as':_0x0be1('0x18e'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xb2')][_0x0be1('0xf4')](db[_0x0be1('0xb4')],{'as':_0x0be1('0x198'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0xb2')][_0x0be1('0xf4')](db[_0x0be1('0xb4')],{'as':_0x0be1('0x18b'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0xb2')][_0x0be1('0x101')](db['VtigerAccount'],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xb4')][_0x0be1('0xf4')](db['VtigerField'],{'as':_0x0be1('0x193'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xb4')][_0x0be1('0xf4')](db[_0x0be1('0xb4')],{'as':_0x0be1('0x194'),'foreignKey':'DescriptionId'});db[_0x0be1('0xb4')][_0x0be1('0xf4')](db[_0x0be1('0xb4')],{'as':_0x0be1('0x195'),'foreignKey':_0x0be1('0x191')});db['VtigerField'][_0x0be1('0x101')](db['Variable'],{'as':_0x0be1('0x86'),'foreignKey':_0x0be1('0x196')});db[_0x0be1('0xb6')][_0x0be1('0xf4')](db[_0x0be1('0x1a0')],{'as':_0x0be1('0x197'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x192')});db['ServicenowConfiguration'][_0x0be1('0xf4')](db[_0x0be1('0xb9')],{'as':_0x0be1('0x18e'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0x1a0')]['hasMany'](db[_0x0be1('0xb9')],{'as':_0x0be1('0x198'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0x1a0')][_0x0be1('0xf4')](db['ServicenowField'],{'as':_0x0be1('0x18b'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0x1a0')]['belongsTo'](db[_0x0be1('0xb6')],{'as':'Account','foreignKey':_0x0be1('0x192')});db['ServicenowField'][_0x0be1('0xf4')](db['ServicenowField'],{'as':_0x0be1('0x193'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xb9')][_0x0be1('0xf4')](db[_0x0be1('0xb9')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0be1('0xb9')][_0x0be1('0xf4')](db[_0x0be1('0xb9')],{'as':_0x0be1('0x195'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0xb9')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x0be1('0x196')});db[_0x0be1('0x1a1')][_0x0be1('0xf4')](db[_0x0be1('0x1a2')],{'as':'Configurations','onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0x1a2')][_0x0be1('0xf4')](db[_0x0be1('0xbd')],{'as':_0x0be1('0x18e'),'onDelete':_0x0be1('0xf3'),'foreignKey':'SubjectId'});db[_0x0be1('0x1a2')][_0x0be1('0xf4')](db[_0x0be1('0xbd')],{'as':'Descriptions','onDelete':_0x0be1('0xf3'),'foreignKey':'DescriptionId'});db[_0x0be1('0x1a2')][_0x0be1('0xf4')](db[_0x0be1('0xbd')],{'as':_0x0be1('0x18b'),'onDelete':'cascade','foreignKey':_0x0be1('0x191')});db[_0x0be1('0x1a2')][_0x0be1('0x101')](db[_0x0be1('0x1a1')],{'as':_0x0be1('0x145'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xbd')][_0x0be1('0xf4')](db[_0x0be1('0xbd')],{'as':_0x0be1('0x193'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xbd')]['hasMany'](db[_0x0be1('0xbd')],{'as':_0x0be1('0x194'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0xbd')][_0x0be1('0xf4')](db['Dynamics365Field'],{'as':_0x0be1('0x195'),'foreignKey':'FieldId'});db[_0x0be1('0xbd')]['belongsTo'](db[_0x0be1('0x86')],{'as':'Variable','foreignKey':_0x0be1('0x196')});db[_0x0be1('0xbe')][_0x0be1('0xf4')](db[_0x0be1('0xbf')],{'as':_0x0be1('0x197'),'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x192')});db[_0x0be1('0xbf')][_0x0be1('0xf4')](db[_0x0be1('0xc0')],{'as':'Subjects','foreignKey':_0x0be1('0x18f')});db['FreshsalesConfiguration'][_0x0be1('0xf4')](db[_0x0be1('0xc0')],{'as':_0x0be1('0x198'),'foreignKey':_0x0be1('0x190')});db[_0x0be1('0xbf')][_0x0be1('0xf4')](db[_0x0be1('0xc0')],{'as':_0x0be1('0x18b'),'foreignKey':_0x0be1('0x191')});db['FreshsalesConfiguration'][_0x0be1('0x101')](db[_0x0be1('0xbe')],{'as':'Account','foreignKey':_0x0be1('0x192')});db[_0x0be1('0xc0')][_0x0be1('0xf4')](db[_0x0be1('0xc0')],{'as':_0x0be1('0x193'),'foreignKey':_0x0be1('0x18f')});db[_0x0be1('0xc0')]['hasMany'](db[_0x0be1('0xc0')],{'as':_0x0be1('0x194'),'foreignKey':_0x0be1('0x190')});db['FreshsalesField'][_0x0be1('0xf4')](db[_0x0be1('0xc0')],{'as':_0x0be1('0x195'),'foreignKey':_0x0be1('0x191')});db[_0x0be1('0xc0')][_0x0be1('0x101')](db[_0x0be1('0x86')],{'as':'Variable','foreignKey':_0x0be1('0x196')});db[_0x0be1('0x1a3')]['belongsTo'](db[_0x0be1('0x58')],{});db[_0x0be1('0x1a3')][_0x0be1('0x101')](db['CmList'],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db[_0x0be1('0x1a3')]['belongsTo'](db['CmContact'],{'as':_0x0be1('0x146'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0x1a3')][_0x0be1('0x101')](db[_0x0be1('0x5d')],{});db[_0x0be1('0x1a3')][_0x0be1('0x101')](db[_0x0be1('0x5f')],{});db[_0x0be1('0x1a3')][_0x0be1('0x101')](db[_0x0be1('0x14')],{});db[_0x0be1('0x1a3')][_0x0be1('0x101')](db[_0x0be1('0x62')],{});db[_0x0be1('0x1a4')][_0x0be1('0x101')](db['User'],{'onDelete':_0x0be1('0xf3'),'foreignKey':_0x0be1('0x1a5')});db[_0x0be1('0x1a4')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'onDelete':'cascade','foreignKey':_0x0be1('0x1a6')});db['JscriptySessionReport'][_0x0be1('0xf4')](db[_0x0be1('0xc8')],{'foreignKey':_0x0be1('0x1a7'),'onDelete':'cascade'});db[_0x0be1('0x174')][_0x0be1('0xf4')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x0be1('0xf3')});db[_0x0be1('0xca')][_0x0be1('0x101')](db[_0x0be1('0x4b')],{});db[_0x0be1('0xca')][_0x0be1('0x101')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x13e'),'foreignKey':_0x0be1('0x13f')});db['SmsQueueReport'][_0x0be1('0x101')](db[_0x0be1('0x67')],{'as':_0x0be1('0x146'),'foreignKey':_0x0be1('0x154')});db[_0x0be1('0xca')][_0x0be1('0x101')](db[_0x0be1('0x4d')],{});db[_0x0be1('0xca')][_0x0be1('0x101')](db[_0x0be1('0x15b')],{});db[_0x0be1('0xca')]['belongsTo'](db[_0x0be1('0x14')],{});db[_0x0be1('0xca')]['belongsTo'](db[_0x0be1('0x4f')],{});db['JscriptyProject']['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0x0be1('0x1a8')});db[_0x0be1('0xce')][_0x0be1('0xf4')](db['JscriptyQuestionReport'],{'foreignKey':_0x0be1('0x1a8')});db[_0x0be1('0xce')][_0x0be1('0xf4')](db[_0x0be1('0xc6')],{'foreignKey':_0x0be1('0x1a8')});db['SquareProject']['belongsToMany'](db[_0x0be1('0x14')],{'as':_0x0be1('0x15d'),'through':_0x0be1('0x1a9')});db['Team'][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':_0x0be1('0x12f'),'through':_0x0be1('0x10a')});db[_0x0be1('0xd9')][_0x0be1('0x106')](db[_0x0be1('0x1c')],{'through':'team_has_voice_queues','as':_0x0be1('0x1aa')});db[_0x0be1('0xd9')][_0x0be1('0x106')](db[_0x0be1('0x37')],{'through':_0x0be1('0x141'),'as':_0x0be1('0x110')});db['Team'][_0x0be1('0x106')](db['ChatQueue'],{'through':_0x0be1('0x16f'),'as':_0x0be1('0x111')});db[_0x0be1('0xd9')][_0x0be1('0x106')](db[_0x0be1('0x48')],{'through':'team_has_fax_queues','as':_0x0be1('0x1ab')});db[_0x0be1('0xd9')][_0x0be1('0x106')](db[_0x0be1('0x4f')],{'through':_0x0be1('0x1ac'),'as':'SmsQueues'});db['Team'][_0x0be1('0x106')](db[_0x0be1('0x57')],{'through':_0x0be1('0x165'),'as':'OpenchannelQueues'});db[_0x0be1('0xdb')][_0x0be1('0xf4')](db[_0x0be1('0x121')],{'as':_0x0be1('0x1ad'),'foreignKey':_0x0be1('0x177')});db[_0x0be1('0xdb')]['hasMany'](db[_0x0be1('0x6c')],{'as':_0x0be1('0xf9'),'foreignKey':_0x0be1('0x177')});db['Campaign']['hasMany'](db[_0x0be1('0xfa')],{'as':_0x0be1('0x122'),'foreignKey':'CampaignId'});db[_0x0be1('0xdb')][_0x0be1('0xf4')](db[_0x0be1('0x6a')],{'as':_0x0be1('0x123'),'foreignKey':_0x0be1('0x177')});db[_0x0be1('0xdb')]['belongsTo'](db[_0x0be1('0x125')],{'as':_0x0be1('0x125'),'foreignKey':_0x0be1('0x126')});db[_0x0be1('0xdb')][_0x0be1('0x101')](db['Trunk'],{'as':_0x0be1('0x127'),'foreignKey':_0x0be1('0x128')});db[_0x0be1('0xdb')][_0x0be1('0x101')](db[_0x0be1('0x129')],{'as':_0x0be1('0x129'),'foreignKey':_0x0be1('0x12a')});db[_0x0be1('0xdb')][_0x0be1('0x101')](db[_0x0be1('0xd4')],{'as':_0x0be1('0xd4'),'foreignKey':'SquareProjectId'});db['Campaign'][_0x0be1('0x106')](db[_0x0be1('0xeb')],{'as':_0x0be1('0x108'),'through':_0x0be1('0x1ae')});db[_0x0be1('0xdb')][_0x0be1('0x106')](db[_0x0be1('0xeb')],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db['MailTransferReport'][_0x0be1('0x101')](db['MailMessage'],{});db[_0x0be1('0xe1')]['belongsTo'](db[_0x0be1('0x10b')],{});db[_0x0be1('0xe1')][_0x0be1('0x101')](db[_0x0be1('0x36')],{'foreignKey':_0x0be1('0x1af'),'as':'FromAccount'});db[_0x0be1('0xe1')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b0'),'as':_0x0be1('0x1b1')});db['MailTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b2'),'as':_0x0be1('0x1b3')});db[_0x0be1('0xe1')][_0x0be1('0x101')](db[_0x0be1('0x37')],{'foreignKey':_0x0be1('0x1b4'),'as':_0x0be1('0x1b5')});db[_0x0be1('0xe1')][_0x0be1('0x101')](db['MailAccount'],{'foreignKey':_0x0be1('0x1b6'),'as':_0x0be1('0x1b7')});db[_0x0be1('0xe3')]['belongsTo'](db[_0x0be1('0x5f')],{});db[_0x0be1('0xe3')]['belongsTo'](db[_0x0be1('0x5d')],{});db[_0x0be1('0xe3')][_0x0be1('0x101')](db['ChatWebsite'],{'foreignKey':_0x0be1('0x1b8'),'as':_0x0be1('0x1b9')});db[_0x0be1('0xe3')]['belongsTo'](db['User'],{'foreignKey':_0x0be1('0x1b0'),'as':'FromAgent'});db[_0x0be1('0xe3')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b2'),'as':_0x0be1('0x1b3')});db['ChatTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x62')],{'foreignKey':_0x0be1('0x1ba'),'as':_0x0be1('0x1b5')});db['ChatTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x58')],{'foreignKey':_0x0be1('0x1bb'),'as':_0x0be1('0x1b7')});db[_0x0be1('0xe5')][_0x0be1('0x101')](db['FaxMessage'],{});db[_0x0be1('0xe5')][_0x0be1('0x101')](db[_0x0be1('0x46')],{});db[_0x0be1('0xe5')]['belongsTo'](db[_0x0be1('0x43')],{'foreignKey':_0x0be1('0x1bc'),'as':'FromAccount'});db[_0x0be1('0xe5')][_0x0be1('0x101')](db['User'],{'foreignKey':_0x0be1('0x1b0'),'as':'FromAgent'});db[_0x0be1('0xe5')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':'ToUserId','as':_0x0be1('0x1b3')});db[_0x0be1('0xe5')][_0x0be1('0x101')](db[_0x0be1('0x48')],{'foreignKey':_0x0be1('0x1bd'),'as':_0x0be1('0x1b5')});db[_0x0be1('0xe5')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0x0be1('0x1be'),'as':_0x0be1('0x1b7')});db[_0x0be1('0xe7')][_0x0be1('0x101')](db[_0x0be1('0x161')],{});db[_0x0be1('0xe7')]['belongsTo'](db['OpenchannelInteraction'],{});db['OpenchannelTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x51')],{'foreignKey':_0x0be1('0x1bf'),'as':_0x0be1('0x1b9')});db['OpenchannelTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b0'),'as':_0x0be1('0x1b1')});db['OpenchannelTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b2'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x0be1('0x101')](db[_0x0be1('0x57')],{'foreignKey':_0x0be1('0x1c0'),'as':_0x0be1('0x1b5')});db[_0x0be1('0xe7')][_0x0be1('0x101')](db[_0x0be1('0x51')],{'foreignKey':'ToOpenchannelAccountId','as':_0x0be1('0x1b7')});db[_0x0be1('0xe9')][_0x0be1('0x101')](db[_0x0be1('0x15b')],{});db[_0x0be1('0xe9')][_0x0be1('0x101')](db['SmsInteraction'],{});db[_0x0be1('0xe9')][_0x0be1('0x101')](db['SmsAccount'],{'foreignKey':_0x0be1('0x1c1'),'as':_0x0be1('0x1b9')});db[_0x0be1('0xe9')][_0x0be1('0x101')](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b0'),'as':'FromAgent'});db[_0x0be1('0xe9')]['belongsTo'](db[_0x0be1('0x14')],{'foreignKey':_0x0be1('0x1b2'),'as':'ToAgent'});db[_0x0be1('0xe9')][_0x0be1('0x101')](db[_0x0be1('0x4f')],{'foreignKey':_0x0be1('0x1c2'),'as':'ToQueue'});db['SmsTransferReport']['belongsTo'](db[_0x0be1('0x4b')],{'foreignKey':_0x0be1('0x1c3'),'as':_0x0be1('0x1b7')});db[_0x0be1('0xeb')][_0x0be1('0xf4')](db[_0x0be1('0x75')],{'as':_0x0be1('0x13a'),'foreignKey':'ListId'});db[_0x0be1('0xeb')][_0x0be1('0xf4')](db[_0x0be1('0x1c4')],{'as':_0x0be1('0x1c5'),'foreignKey':_0x0be1('0x13f')});db['CmList'][_0x0be1('0xf4')](db[_0x0be1('0x67')],{'as':_0x0be1('0x172'),'onDelete':'cascade','foreignKey':'ListId'});db['CmList'][_0x0be1('0xf4')](db[_0x0be1('0x6c')],{'as':_0x0be1('0xf9'),'foreignKey':'ListId'});db[_0x0be1('0xeb')][_0x0be1('0xf4')](db['CmHopperHistory'],{'as':_0x0be1('0xfb'),'foreignKey':'ListId'});db[_0x0be1('0xeb')][_0x0be1('0xf4')](db[_0x0be1('0xfc')],{'as':_0x0be1('0xfc'),'foreignKey':_0x0be1('0x13f')});db['CmList'][_0x0be1('0x106')](db['VoiceQueue'],{'as':_0x0be1('0x1c6'),'through':'voice_queues_has_cm_lists'});db[_0x0be1('0xeb')]['belongsToMany'](db[_0x0be1('0x14')],{'as':'Agents','through':_0x0be1('0x109')});db[_0x0be1('0xed')][_0x0be1('0xf4')](db[_0x0be1('0xf7')],{'as':'Extensions','onDelete':_0x0be1('0x14c')});db['VoicePrefix'][_0x0be1('0x106')](db[_0x0be1('0x14')],{'as':'Agents','through':_0x0be1('0x1c7')});db[_0x0be1('0x102')][_0x0be1('0xf4')](db[_0x0be1('0x14')],{'as':_0x0be1('0x15d'),'foreignKey':_0x0be1('0x103')});db['UserProfile'][_0x0be1('0xf4')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x0be1('0x103'),'onDelete':_0x0be1('0xf3')});db['UserProfileSection'][_0x0be1('0xf4')](db[_0x0be1('0xf0')],{'as':'Resources','foreignKey':_0x0be1('0x1c8'),'onDelete':_0x0be1('0xf3')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 8fb4372..5a02d97 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4cb=['./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/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/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/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/jscriptyProject','./api/squareOdbc','./api/squareProject','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/pm2','static','join','/apidoc','/www','/demo','/snippet','root','snippet','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','express','express-winston','util','./errors','./config/environment','./config/logger','api','default','use','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','remoteAddress','statusCode','responseTime','user','name','role','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','connection','url','other','agent_name','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/interactions','./api/faxInteraction','/api/fax/queues','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/cm/hopper_history','/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/schedule','/api/sounds','/api/tags','./api/tag','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0xb4cb,0x18b));var _0xbb4c=function(_0x3252c3,_0x30939b){_0x3252c3=_0x3252c3-0x0;var _0x11be4a=_0xb4cb[_0x3252c3];return _0x11be4a;};'use strict';var path=require('path');var express=require(_0xbb4c('0x0'));var ewinston=require(_0xbb4c('0x1'));var util=require(_0xbb4c('0x2'));var errors=require(_0xbb4c('0x3'));var config=require(_0xbb4c('0x4'));var logger=require(_0xbb4c('0x5'))(_0xbb4c('0x6'));var authLogger=require('./config/logger')('auth');exports[_0xbb4c('0x7')]=function(_0x5b3fdb){_0x5b3fdb[_0xbb4c('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x371f27,_0x32651e){return util[_0xbb4c('0x9')](_0xbb4c('0xa'),_0x371f27[_0xbb4c('0xb')],_0x371f27[_0xbb4c('0xc')][_0xbb4c('0xd')]?_0x371f27[_0xbb4c('0xc')][_0xbb4c('0xd')]:_0x371f27['connection'][_0xbb4c('0xe')]||_0x371f27['ip'],_0x371f27['url'],_0x32651e[_0xbb4c('0xf')],_0x32651e[_0xbb4c('0x10')],_0x371f27['user']?_0x371f27[_0xbb4c('0x11')]['id']:null,_0x371f27[_0xbb4c('0x11')]?_0x371f27[_0xbb4c('0x11')][_0xbb4c('0x12')]:null,_0x371f27[_0xbb4c('0x11')]?_0x371f27[_0xbb4c('0x11')][_0xbb4c('0x13')]:null);}}));_0x5b3fdb[_0xbb4c('0x8')](ewinston[_0xbb4c('0x14')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5c19ec,_0x1ee4d9){var _0x52e613=_0xbb4c('0x15');if(_0x5c19ec['body']&&_0x5c19ec[_0xbb4c('0x16')][_0xbb4c('0x17')]&&_0x5c19ec['body'][_0xbb4c('0x18')]){_0x52e613='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xbb4c('0x9')](_0x52e613,_0x5c19ec[_0xbb4c('0xb')],_0x5c19ec[_0xbb4c('0xc')][_0xbb4c('0xd')]?_0x5c19ec[_0xbb4c('0xc')][_0xbb4c('0xd')]:_0x5c19ec[_0xbb4c('0x19')][_0xbb4c('0xe')]||_0x5c19ec['ip'],_0x5c19ec[_0xbb4c('0x1a')],_0x1ee4d9['statusCode'],_0x1ee4d9[_0xbb4c('0x10')],_0x5c19ec[_0xbb4c('0x11')]?_0x5c19ec[_0xbb4c('0x11')]['id']:null,_0x5c19ec[_0xbb4c('0x11')]?_0x5c19ec['user']['name']:null,_0x5c19ec['user']?_0x5c19ec[_0xbb4c('0x11')][_0xbb4c('0x13')]:null,_0x5c19ec['body']&&_0x5c19ec[_0xbb4c('0x16')][_0xbb4c('0x17')]?_0x5c19ec[_0xbb4c('0x16')][_0xbb4c('0x17')]:_0xbb4c('0x1b'),_0x5c19ec['body']&&_0x5c19ec[_0xbb4c('0x16')][_0xbb4c('0x18')]?_0x5c19ec['body'][_0xbb4c('0x18')]:'',_0x5c19ec['body']&&_0x5c19ec[_0xbb4c('0x16')][_0xbb4c('0x1c')]?_0x5c19ec[_0xbb4c('0x16')]['agent_name']:'');},'ignoreRoute':function(_0x48a7b1){var _0x540d6b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x540d6b['test'](_0x48a7b1[_0xbb4c('0x1a')]);}}));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x1d'),require(_0xbb4c('0x1e')));_0x5b3fdb['use'](_0xbb4c('0x1f'),require(_0xbb4c('0x20')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x21'),require(_0xbb4c('0x22')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x23'),require(_0xbb4c('0x24')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x25'),require(_0xbb4c('0x26')));_0x5b3fdb['use'](_0xbb4c('0x27'),require(_0xbb4c('0x28')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x29'),require(_0xbb4c('0x2a')));_0x5b3fdb['use']('/api/screen/recordings',require(_0xbb4c('0x2b')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x2c'),require('./api/voiceMail'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x2d'),require(_0xbb4c('0x2e')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x2f'),require(_0xbb4c('0x30')));_0x5b3fdb['use'](_0xbb4c('0x31'),require(_0xbb4c('0x32')));_0x5b3fdb['use']('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x33'),require(_0xbb4c('0x34')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x35'),require('./api/memberReport'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x36'),require('./api/trunk'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x37'),require(_0xbb4c('0x38')));_0x5b3fdb['use']('/api/mail/out_servers',require('./api/mailServerOut'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x39'),require(_0xbb4c('0x3a')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x3b'),require(_0xbb4c('0x3c')));_0x5b3fdb['use'](_0xbb4c('0x3d'),require(_0xbb4c('0x3e')));_0x5b3fdb[_0xbb4c('0x8')]('/api/mail/interactions',require(_0xbb4c('0x3f')));_0x5b3fdb[_0xbb4c('0x8')]('/api/mail/messages',require(_0xbb4c('0x40')));_0x5b3fdb[_0xbb4c('0x8')]('/api/mail/applications',require(_0xbb4c('0x41')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x42'),require(_0xbb4c('0x43')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x44'),require(_0xbb4c('0x45')));_0x5b3fdb['use'](_0xbb4c('0x46'),require(_0xbb4c('0x47')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x48'),require(_0xbb4c('0x49')));_0x5b3fdb['use']('/api/fax/applications',require('./api/faxApplication'));_0x5b3fdb['use'](_0xbb4c('0x4a'),require(_0xbb4c('0x4b')));_0x5b3fdb[_0xbb4c('0x8')]('/api/fax/messages',require('./api/faxMessage'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x4c'),require('./api/faxQueue'));_0x5b3fdb[_0xbb4c('0x8')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x4d'),require('./api/smsAccount'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x4e'),require(_0xbb4c('0x4f')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x50'),require(_0xbb4c('0x51')));_0x5b3fdb['use'](_0xbb4c('0x52'),require(_0xbb4c('0x53')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x54'),require(_0xbb4c('0x55')));_0x5b3fdb[_0xbb4c('0x8')]('/api/openchannel/accounts',require(_0xbb4c('0x56')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x57'),require(_0xbb4c('0x58')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x59'),require('./api/openchannelInteraction'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x5a'),require(_0xbb4c('0x5b')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x5c'),require(_0xbb4c('0x5d')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x5e'),require(_0xbb4c('0x5f')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x60'),require(_0xbb4c('0x61')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x62'),require(_0xbb4c('0x63')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x64'),require(_0xbb4c('0x65')));_0x5b3fdb['use'](_0xbb4c('0x66'),require(_0xbb4c('0x67')));_0x5b3fdb['use'](_0xbb4c('0x68'),require(_0xbb4c('0x69')));_0x5b3fdb[_0xbb4c('0x8')]('/api/chat/queues',require('./api/chatQueue'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x6a'),require('./api/chatGroup'));_0x5b3fdb['use'](_0xbb4c('0x6b'),require(_0xbb4c('0x6c')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x6d'),require(_0xbb4c('0x6e')));_0x5b3fdb[_0xbb4c('0x8')]('/api/cm/contacts',require(_0xbb4c('0x6f')));_0x5b3fdb['use'](_0xbb4c('0x70'),require(_0xbb4c('0x71')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x72'),require('./api/cmHopperBlack'));_0x5b3fdb['use']('/api/cm/hopper_final',require(_0xbb4c('0x73')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x74'),require('./api/cmHopperHistory'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x75'),require(_0xbb4c('0x76')));_0x5b3fdb['use']('/api/actions',require(_0xbb4c('0x77')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x78'),require(_0xbb4c('0x79')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x7a'),require(_0xbb4c('0x7b')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x7c'),require(_0xbb4c('0x7d')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x7e'),require('./api/condition'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x7f'),require(_0xbb4c('0x80')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x81'),require(_0xbb4c('0x82')));_0x5b3fdb[_0xbb4c('0x8')]('/api/cdr',require(_0xbb4c('0x83')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x84'),require('./api/voiceQueuesLog'));_0x5b3fdb[_0xbb4c('0x8')]('/api/schedules',require(_0xbb4c('0x85')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x86'),require('./api/sound'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x87'),require(_0xbb4c('0x88')));_0x5b3fdb['use']('/api/templates',require(_0xbb4c('0x89')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x8a'),require(_0xbb4c('0x8b')));_0x5b3fdb[_0xbb4c('0x8')]('/api/variables',require(_0xbb4c('0x8c')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x8d'),require(_0xbb4c('0x8e')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x8f'),require(_0xbb4c('0x90')));_0x5b3fdb[_0xbb4c('0x8')]('/api/analytics/custom_reports',require(_0xbb4c('0x91')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x92'),require(_0xbb4c('0x93')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x94'),require(_0xbb4c('0x95')));_0x5b3fdb['use'](_0xbb4c('0x96'),require(_0xbb4c('0x97')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x98'),require(_0xbb4c('0x99')));_0x5b3fdb['use'](_0xbb4c('0x9a'),require(_0xbb4c('0x9b')));_0x5b3fdb['use'](_0xbb4c('0x9c'),require(_0xbb4c('0x9d')));_0x5b3fdb['use'](_0xbb4c('0x9e'),require(_0xbb4c('0x9f')));_0x5b3fdb['use'](_0xbb4c('0xa0'),require('./api/intSalesforceField'));_0x5b3fdb['use'](_0xbb4c('0xa1'),require(_0xbb4c('0xa2')));_0x5b3fdb[_0xbb4c('0x8')]('/api/integrations/sugarcrm/configurations',require(_0xbb4c('0xa3')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xa4'),require('./api/intSugarcrmField'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xa5'),require(_0xbb4c('0xa6')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xa7'),require(_0xbb4c('0xa8')));_0x5b3fdb[_0xbb4c('0x8')]('/api/integrations/desk/fields',require(_0xbb4c('0xa9')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xaa'),require(_0xbb4c('0xab')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xac'),require(_0xbb4c('0xad')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xae'),require('./api/intZohoField'));_0x5b3fdb['use'](_0xbb4c('0xaf'),require(_0xbb4c('0xb0')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xb1'),require(_0xbb4c('0xb2')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xb3'),require(_0xbb4c('0xb4')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xb5'),require(_0xbb4c('0xb6')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xb7'),require(_0xbb4c('0xb8')));_0x5b3fdb[_0xbb4c('0x8')]('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xb9'),require(_0xbb4c('0xba')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xbb'),require(_0xbb4c('0xbc')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xbd'),require(_0xbb4c('0xbe')));_0x5b3fdb[_0xbb4c('0x8')]('/api/integrations/servicenow/accounts',require(_0xbb4c('0xbf')));_0x5b3fdb[_0xbb4c('0x8')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x5b3fdb['use'](_0xbb4c('0xc0'),require('./api/intServicenowField'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xc1'),require(_0xbb4c('0xc2')));_0x5b3fdb[_0xbb4c('0x8')]('/api/integrations/dynamics365/configurations',require(_0xbb4c('0xc3')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xc4'),require(_0xbb4c('0xc5')));_0x5b3fdb['use'](_0xbb4c('0xc6'),require('./api/intFreshsalesAccount'));_0x5b3fdb['use'](_0xbb4c('0xc7'),require(_0xbb4c('0xc8')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xc9'),require(_0xbb4c('0xca')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xcb'),require(_0xbb4c('0xcc')));_0x5b3fdb['use'](_0xbb4c('0xcd'),require(_0xbb4c('0xce')));_0x5b3fdb['use'](_0xbb4c('0xcf'),require(_0xbb4c('0xd0')));_0x5b3fdb[_0xbb4c('0x8')]('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xd1'),require(_0xbb4c('0xd2')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xd3'),require('./api/jscriptySessionReport'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xd4'),require(_0xbb4c('0xd5')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xd6'),require(_0xbb4c('0xd7')));_0x5b3fdb[_0xbb4c('0x8')]('/api/square/details/reports',require(_0xbb4c('0xd8')));_0x5b3fdb['use'](_0xbb4c('0xd9'),require(_0xbb4c('0xda')));_0x5b3fdb['use']('/api/settings',require('./api/setting'));_0x5b3fdb[_0xbb4c('0x8')]('/api/square/odbc',require(_0xbb4c('0xdb')));_0x5b3fdb[_0xbb4c('0x8')]('/api/square/projects',require(_0xbb4c('0xdc')));_0x5b3fdb['use'](_0xbb4c('0xdd'),require('./api/squareRecording'));_0x5b3fdb['use'](_0xbb4c('0xde'),require(_0xbb4c('0xdf')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xe0'),require('./api/team'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xe1'),require(_0xbb4c('0xe2')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xe3'),require(_0xbb4c('0xe4')));_0x5b3fdb[_0xbb4c('0x8')]('/api/migrations',require(_0xbb4c('0xe5')));_0x5b3fdb[_0xbb4c('0x8')]('/api/attachments',require(_0xbb4c('0xe6')));_0x5b3fdb['use'](_0xbb4c('0xe7'),require(_0xbb4c('0xe8')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xe9'),require('./api/mailTransferReport'));_0x5b3fdb['use'](_0xbb4c('0xea'),require('./api/chatTransferReport'));_0x5b3fdb['use'](_0xbb4c('0xeb'),require(_0xbb4c('0xec')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xed'),require(_0xbb4c('0xee')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xef'),require(_0xbb4c('0xf0')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xf1'),require(_0xbb4c('0xf2')));_0x5b3fdb['use'](_0xbb4c('0xf3'),require(_0xbb4c('0xf4')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xf5'),require(_0xbb4c('0xf6')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xf7'),require(_0xbb4c('0xf8')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xf9'),require('./api/userProfileResource'));_0x5b3fdb['use'](_0xbb4c('0xfa'),require('./api/authLocal'));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xfb'),require(_0xbb4c('0xfc')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xfd'),require(_0xbb4c('0xfe')));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0xff'),require(_0xbb4c('0x100')));_0x5b3fdb['use'](_0xbb4c('0x101'),require(_0xbb4c('0x102')));_0x5b3fdb['use']('/api/system',require('./api/system'));_0x5b3fdb[_0xbb4c('0x8')]('/api/pm2',require(_0xbb4c('0x103')));_0x5b3fdb['use']('/apidoc',express[_0xbb4c('0x104')](path[_0xbb4c('0x105')](config['root'],_0xbb4c('0x106'))));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x107'),express[_0xbb4c('0x104')](path[_0xbb4c('0x105')](config['root'],_0xbb4c('0x107'))));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x108'),express[_0xbb4c('0x104')](path[_0xbb4c('0x105')](config['root'],_0xbb4c('0x108'))));_0x5b3fdb[_0xbb4c('0x8')](_0xbb4c('0x109'),express['static'](path[_0xbb4c('0x105')](config[_0xbb4c('0x10a')],_0xbb4c('0x10b'),'1.0.16')));_0x5b3fdb[_0xbb4c('0x8')]('/plugins',express['static'](path['join'](config['root'],'/server/files/plugins')));_0x5b3fdb[_0xbb4c('0x10c')](_0xbb4c('0x10d'))[_0xbb4c('0x10e')](errors[0x194]);_0x5b3fdb['route']('/*')[_0xbb4c('0x10e')](function(_0x405ebf,_0x4e750e){_0x4e750e[_0xbb4c('0x10f')](path[_0xbb4c('0x110')](_0x5b3fdb[_0xbb4c('0x10e')](_0xbb4c('0x111'))+'/index.html'));});}; \ No newline at end of file +var _0x4046=['./api/jscriptyAnswerReport','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','/apidoc','static','join','root','/www','/demo','/snippet','1.0.16','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express-winston','util','./errors','./config/environment','./config/logger','api','auth','use','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','user','name','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','role','other','agent_id','agent_name','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./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/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage'];(function(_0x3b1e3f,_0xf8826b){var _0x3b1cd3=function(_0x26ad44){while(--_0x26ad44){_0x3b1e3f['push'](_0x3b1e3f['shift']());}};_0x3b1cd3(++_0xf8826b);}(_0x4046,0x14e));var _0x6404=function(_0x2a922e,_0x521ac2){_0x2a922e=_0x2a922e-0x0;var _0x5b4d1b=_0x4046[_0x2a922e];return _0x5b4d1b;};'use strict';var path=require(_0x6404('0x0'));var express=require('express');var ewinston=require(_0x6404('0x1'));var util=require(_0x6404('0x2'));var errors=require(_0x6404('0x3'));var config=require(_0x6404('0x4'));var logger=require(_0x6404('0x5'))(_0x6404('0x6'));var authLogger=require(_0x6404('0x5'))(_0x6404('0x7'));exports['default']=function(_0x427ca4){_0x427ca4[_0x6404('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xd1f1e7,_0x2a41ad){return util[_0x6404('0x9')](_0x6404('0xa'),_0xd1f1e7[_0x6404('0xb')],_0xd1f1e7[_0x6404('0xc')][_0x6404('0xd')]?_0xd1f1e7['headers'][_0x6404('0xd')]:_0xd1f1e7[_0x6404('0xe')][_0x6404('0xf')]||_0xd1f1e7['ip'],_0xd1f1e7[_0x6404('0x10')],_0x2a41ad[_0x6404('0x11')],_0x2a41ad[_0x6404('0x12')],_0xd1f1e7[_0x6404('0x13')]?_0xd1f1e7['user']['id']:null,_0xd1f1e7['user']?_0xd1f1e7[_0x6404('0x13')][_0x6404('0x14')]:null,_0xd1f1e7[_0x6404('0x13')]?_0xd1f1e7['user']['role']:null);}}));_0x427ca4[_0x6404('0x8')](ewinston[_0x6404('0x15')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x34c8d1,_0x560bd6){var _0x3ac4ad=_0x6404('0x16');if(_0x34c8d1[_0x6404('0x17')]&&_0x34c8d1[_0x6404('0x17')][_0x6404('0x18')]&&_0x34c8d1[_0x6404('0x17')]['agent_id']){_0x3ac4ad='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x6404('0x9')](_0x3ac4ad,_0x34c8d1[_0x6404('0xb')],_0x34c8d1[_0x6404('0xc')][_0x6404('0xd')]?_0x34c8d1[_0x6404('0xc')][_0x6404('0xd')]:_0x34c8d1['connection'][_0x6404('0xf')]||_0x34c8d1['ip'],_0x34c8d1[_0x6404('0x10')],_0x560bd6[_0x6404('0x11')],_0x560bd6['responseTime'],_0x34c8d1['user']?_0x34c8d1['user']['id']:null,_0x34c8d1['user']?_0x34c8d1[_0x6404('0x13')][_0x6404('0x14')]:null,_0x34c8d1[_0x6404('0x13')]?_0x34c8d1[_0x6404('0x13')][_0x6404('0x19')]:null,_0x34c8d1[_0x6404('0x17')]&&_0x34c8d1['body']['device']?_0x34c8d1['body'][_0x6404('0x18')]:_0x6404('0x1a'),_0x34c8d1[_0x6404('0x17')]&&_0x34c8d1[_0x6404('0x17')][_0x6404('0x1b')]?_0x34c8d1[_0x6404('0x17')][_0x6404('0x1b')]:'',_0x34c8d1[_0x6404('0x17')]&&_0x34c8d1['body'][_0x6404('0x1c')]?_0x34c8d1[_0x6404('0x17')][_0x6404('0x1c')]:'');},'ignoreRoute':function(_0x46fbfb){var _0x1a725d=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1a725d['test'](_0x46fbfb[_0x6404('0x10')]);}}));_0x427ca4['use']('/api/users',require('./api/user'));_0x427ca4[_0x6404('0x8')](_0x6404('0x1d'),require(_0x6404('0x1e')));_0x427ca4[_0x6404('0x8')](_0x6404('0x1f'),require('./api/voiceContext'));_0x427ca4[_0x6404('0x8')]('/api/voice/extensions',require(_0x6404('0x20')));_0x427ca4[_0x6404('0x8')]('/api/voice/mohs',require(_0x6404('0x21')));_0x427ca4[_0x6404('0x8')]('/api/voice/queues',require(_0x6404('0x22')));_0x427ca4[_0x6404('0x8')](_0x6404('0x23'),require(_0x6404('0x24')));_0x427ca4[_0x6404('0x8')]('/api/screen/recordings',require(_0x6404('0x25')));_0x427ca4[_0x6404('0x8')](_0x6404('0x26'),require('./api/voiceMail'));_0x427ca4[_0x6404('0x8')](_0x6404('0x27'),require(_0x6404('0x28')));_0x427ca4['use'](_0x6404('0x29'),require(_0x6404('0x2a')));_0x427ca4[_0x6404('0x8')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x427ca4['use'](_0x6404('0x2b'),require(_0x6404('0x2c')));_0x427ca4[_0x6404('0x8')](_0x6404('0x2d'),require(_0x6404('0x2e')));_0x427ca4[_0x6404('0x8')](_0x6404('0x2f'),require('./api/memberReport'));_0x427ca4['use']('/api/trunks',require('./api/trunk'));_0x427ca4[_0x6404('0x8')](_0x6404('0x30'),require(_0x6404('0x31')));_0x427ca4['use'](_0x6404('0x32'),require(_0x6404('0x33')));_0x427ca4[_0x6404('0x8')](_0x6404('0x34'),require(_0x6404('0x35')));_0x427ca4[_0x6404('0x8')](_0x6404('0x36'),require(_0x6404('0x37')));_0x427ca4[_0x6404('0x8')](_0x6404('0x38'),require('./api/mailSubstatus'));_0x427ca4[_0x6404('0x8')]('/api/mail/interactions',require(_0x6404('0x39')));_0x427ca4[_0x6404('0x8')](_0x6404('0x3a'),require(_0x6404('0x3b')));_0x427ca4[_0x6404('0x8')](_0x6404('0x3c'),require('./api/mailApplication'));_0x427ca4[_0x6404('0x8')](_0x6404('0x3d'),require(_0x6404('0x3e')));_0x427ca4['use'](_0x6404('0x3f'),require(_0x6404('0x40')));_0x427ca4[_0x6404('0x8')](_0x6404('0x41'),require(_0x6404('0x42')));_0x427ca4[_0x6404('0x8')]('/api/fax/accounts',require(_0x6404('0x43')));_0x427ca4[_0x6404('0x8')](_0x6404('0x44'),require(_0x6404('0x45')));_0x427ca4[_0x6404('0x8')](_0x6404('0x46'),require(_0x6404('0x47')));_0x427ca4[_0x6404('0x8')](_0x6404('0x48'),require(_0x6404('0x49')));_0x427ca4['use'](_0x6404('0x4a'),require('./api/faxQueue'));_0x427ca4[_0x6404('0x8')](_0x6404('0x4b'),require(_0x6404('0x4c')));_0x427ca4[_0x6404('0x8')]('/api/sms/accounts',require('./api/smsAccount'));_0x427ca4[_0x6404('0x8')](_0x6404('0x4d'),require('./api/smsApplication'));_0x427ca4[_0x6404('0x8')]('/api/sms/interactions',require(_0x6404('0x4e')));_0x427ca4[_0x6404('0x8')](_0x6404('0x4f'),require(_0x6404('0x50')));_0x427ca4[_0x6404('0x8')](_0x6404('0x51'),require(_0x6404('0x52')));_0x427ca4['use'](_0x6404('0x53'),require('./api/openchannelAccount'));_0x427ca4[_0x6404('0x8')](_0x6404('0x54'),require(_0x6404('0x55')));_0x427ca4[_0x6404('0x8')](_0x6404('0x56'),require(_0x6404('0x57')));_0x427ca4[_0x6404('0x8')]('/api/openchannel/messages',require(_0x6404('0x58')));_0x427ca4[_0x6404('0x8')](_0x6404('0x59'),require(_0x6404('0x5a')));_0x427ca4[_0x6404('0x8')](_0x6404('0x5b'),require(_0x6404('0x5c')));_0x427ca4[_0x6404('0x8')](_0x6404('0x5d'),require(_0x6404('0x5e')));_0x427ca4[_0x6404('0x8')]('/api/chat/applications',require(_0x6404('0x5f')));_0x427ca4['use'](_0x6404('0x60'),require(_0x6404('0x61')));_0x427ca4[_0x6404('0x8')]('/api/chat/messages',require('./api/chatMessage'));_0x427ca4[_0x6404('0x8')]('/api/chat/offline_messages',require('./api/chatOfflineMessage'));_0x427ca4[_0x6404('0x8')]('/api/chat/queues',require(_0x6404('0x62')));_0x427ca4[_0x6404('0x8')]('/api/chat/groups',require(_0x6404('0x63')));_0x427ca4[_0x6404('0x8')](_0x6404('0x64'),require(_0x6404('0x65')));_0x427ca4[_0x6404('0x8')](_0x6404('0x66'),require(_0x6404('0x67')));_0x427ca4['use']('/api/cm/contacts',require(_0x6404('0x68')));_0x427ca4[_0x6404('0x8')](_0x6404('0x69'),require('./api/cmHopper'));_0x427ca4[_0x6404('0x8')](_0x6404('0x6a'),require('./api/cmHopperBlack'));_0x427ca4[_0x6404('0x8')](_0x6404('0x6b'),require(_0x6404('0x6c')));_0x427ca4[_0x6404('0x8')](_0x6404('0x6d'),require(_0x6404('0x6e')));_0x427ca4[_0x6404('0x8')](_0x6404('0x6f'),require('./api/cmCustomField'));_0x427ca4[_0x6404('0x8')]('/api/actions',require('./api/action'));_0x427ca4['use']('/api/automations',require('./api/automation'));_0x427ca4[_0x6404('0x8')](_0x6404('0x70'),require(_0x6404('0x71')));_0x427ca4[_0x6404('0x8')](_0x6404('0x72'),require('./api/disposition'));_0x427ca4[_0x6404('0x8')](_0x6404('0x73'),require(_0x6404('0x74')));_0x427ca4[_0x6404('0x8')](_0x6404('0x75'),require(_0x6404('0x76')));_0x427ca4['use']('/api/pauses',require(_0x6404('0x77')));_0x427ca4['use'](_0x6404('0x78'),require(_0x6404('0x79')));_0x427ca4[_0x6404('0x8')](_0x6404('0x7a'),require(_0x6404('0x7b')));_0x427ca4[_0x6404('0x8')](_0x6404('0x7c'),require('./api/schedule'));_0x427ca4[_0x6404('0x8')](_0x6404('0x7d'),require('./api/sound'));_0x427ca4[_0x6404('0x8')](_0x6404('0x7e'),require(_0x6404('0x7f')));_0x427ca4[_0x6404('0x8')](_0x6404('0x80'),require(_0x6404('0x81')));_0x427ca4[_0x6404('0x8')](_0x6404('0x82'),require(_0x6404('0x83')));_0x427ca4[_0x6404('0x8')](_0x6404('0x84'),require('./api/variable'));_0x427ca4['use'](_0x6404('0x85'),require(_0x6404('0x86')));_0x427ca4['use'](_0x6404('0x87'),require(_0x6404('0x88')));_0x427ca4[_0x6404('0x8')](_0x6404('0x89'),require(_0x6404('0x8a')));_0x427ca4[_0x6404('0x8')](_0x6404('0x8b'),require(_0x6404('0x8c')));_0x427ca4[_0x6404('0x8')]('/api/analytics/extracted_reports',require(_0x6404('0x8d')));_0x427ca4[_0x6404('0x8')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x427ca4[_0x6404('0x8')]('/api/analytics/field_reports',require(_0x6404('0x8e')));_0x427ca4['use'](_0x6404('0x8f'),require(_0x6404('0x90')));_0x427ca4[_0x6404('0x8')](_0x6404('0x91'),require(_0x6404('0x92')));_0x427ca4['use']('/api/integrations/salesforce/configurations',require(_0x6404('0x93')));_0x427ca4[_0x6404('0x8')](_0x6404('0x94'),require(_0x6404('0x95')));_0x427ca4[_0x6404('0x8')](_0x6404('0x96'),require(_0x6404('0x97')));_0x427ca4[_0x6404('0x8')](_0x6404('0x98'),require('./api/intSugarcrmConfiguration'));_0x427ca4['use']('/api/integrations/sugarcrm/fields',require(_0x6404('0x99')));_0x427ca4[_0x6404('0x8')](_0x6404('0x9a'),require(_0x6404('0x9b')));_0x427ca4[_0x6404('0x8')](_0x6404('0x9c'),require('./api/intDeskConfiguration'));_0x427ca4[_0x6404('0x8')](_0x6404('0x9d'),require(_0x6404('0x9e')));_0x427ca4[_0x6404('0x8')](_0x6404('0x9f'),require(_0x6404('0xa0')));_0x427ca4['use'](_0x6404('0xa1'),require('./api/intZohoConfiguration'));_0x427ca4['use'](_0x6404('0xa2'),require('./api/intZohoField'));_0x427ca4[_0x6404('0x8')](_0x6404('0xa3'),require(_0x6404('0xa4')));_0x427ca4[_0x6404('0x8')](_0x6404('0xa5'),require('./api/intZendeskConfiguration'));_0x427ca4['use'](_0x6404('0xa6'),require('./api/intZendeskField'));_0x427ca4[_0x6404('0x8')](_0x6404('0xa7'),require(_0x6404('0xa8')));_0x427ca4[_0x6404('0x8')](_0x6404('0xa9'),require(_0x6404('0xaa')));_0x427ca4['use'](_0x6404('0xab'),require('./api/intFreshdeskField'));_0x427ca4[_0x6404('0x8')](_0x6404('0xac'),require(_0x6404('0xad')));_0x427ca4[_0x6404('0x8')]('/api/integrations/vtiger/configurations',require(_0x6404('0xae')));_0x427ca4[_0x6404('0x8')](_0x6404('0xaf'),require(_0x6404('0xb0')));_0x427ca4[_0x6404('0x8')](_0x6404('0xb1'),require(_0x6404('0xb2')));_0x427ca4[_0x6404('0x8')](_0x6404('0xb3'),require(_0x6404('0xb4')));_0x427ca4[_0x6404('0x8')]('/api/integrations/servicenow/fields',require(_0x6404('0xb5')));_0x427ca4['use'](_0x6404('0xb6'),require(_0x6404('0xb7')));_0x427ca4[_0x6404('0x8')](_0x6404('0xb8'),require(_0x6404('0xb9')));_0x427ca4[_0x6404('0x8')](_0x6404('0xba'),require(_0x6404('0xbb')));_0x427ca4[_0x6404('0x8')](_0x6404('0xbc'),require(_0x6404('0xbd')));_0x427ca4[_0x6404('0x8')](_0x6404('0xbe'),require(_0x6404('0xbf')));_0x427ca4['use'](_0x6404('0xc0'),require(_0x6404('0xc1')));_0x427ca4[_0x6404('0x8')]('/api/networks',require(_0x6404('0xc2')));_0x427ca4['use'](_0x6404('0xc3'),require('./api/chatQueueReport'));_0x427ca4[_0x6404('0x8')](_0x6404('0xc4'),require(_0x6404('0xc5')));_0x427ca4['use']('/api/jscripty/answers/reports',require(_0x6404('0xc6')));_0x427ca4['use']('/api/jscripty/questions/reports',require(_0x6404('0xc7')));_0x427ca4[_0x6404('0x8')](_0x6404('0xc8'),require(_0x6404('0xc9')));_0x427ca4['use'](_0x6404('0xca'),require('./api/smsQueueReport'));_0x427ca4[_0x6404('0x8')](_0x6404('0xcb'),require(_0x6404('0xcc')));_0x427ca4[_0x6404('0x8')](_0x6404('0xcd'),require(_0x6404('0xce')));_0x427ca4['use'](_0x6404('0xcf'),require(_0x6404('0xd0')));_0x427ca4[_0x6404('0x8')](_0x6404('0xd1'),require(_0x6404('0xd2')));_0x427ca4[_0x6404('0x8')](_0x6404('0xd3'),require(_0x6404('0xd4')));_0x427ca4[_0x6404('0x8')](_0x6404('0xd5'),require(_0x6404('0xd6')));_0x427ca4['use'](_0x6404('0xd7'),require(_0x6404('0xd8')));_0x427ca4[_0x6404('0x8')](_0x6404('0xd9'),require(_0x6404('0xda')));_0x427ca4['use'](_0x6404('0xdb'),require('./api/team'));_0x427ca4['use'](_0x6404('0xdc'),require(_0x6404('0xdd')));_0x427ca4[_0x6404('0x8')](_0x6404('0xde'),require(_0x6404('0xdf')));_0x427ca4[_0x6404('0x8')](_0x6404('0xe0'),require(_0x6404('0xe1')));_0x427ca4[_0x6404('0x8')](_0x6404('0xe2'),require('./api/attachment'));_0x427ca4['use']('/api/plugins',require('./api/plugin'));_0x427ca4[_0x6404('0x8')](_0x6404('0xe3'),require(_0x6404('0xe4')));_0x427ca4[_0x6404('0x8')](_0x6404('0xe5'),require(_0x6404('0xe6')));_0x427ca4['use'](_0x6404('0xe7'),require(_0x6404('0xe8')));_0x427ca4['use'](_0x6404('0xe9'),require('./api/openchannelTransferReport'));_0x427ca4[_0x6404('0x8')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x427ca4[_0x6404('0x8')]('/api/cm/lists',require(_0x6404('0xea')));_0x427ca4[_0x6404('0x8')](_0x6404('0xeb'),require(_0x6404('0xec')));_0x427ca4['use'](_0x6404('0xed'),require(_0x6404('0xee')));_0x427ca4[_0x6404('0x8')](_0x6404('0xef'),require(_0x6404('0xf0')));_0x427ca4['use'](_0x6404('0xf1'),require('./api/userProfileResource'));_0x427ca4[_0x6404('0x8')](_0x6404('0xf2'),require(_0x6404('0xf3')));_0x427ca4[_0x6404('0x8')]('/api/auth/google',require(_0x6404('0xf4')));_0x427ca4[_0x6404('0x8')](_0x6404('0xf5'),require(_0x6404('0xf6')));_0x427ca4[_0x6404('0x8')](_0x6404('0xf7'),require('./api/rpc'));_0x427ca4[_0x6404('0x8')](_0x6404('0xf8'),require(_0x6404('0xf9')));_0x427ca4[_0x6404('0x8')](_0x6404('0xfa'),require('./api/system'));_0x427ca4[_0x6404('0x8')]('/api/pm2',require('./api/pm2'));_0x427ca4[_0x6404('0x8')](_0x6404('0xfb'),express[_0x6404('0xfc')](path[_0x6404('0xfd')](config[_0x6404('0xfe')],_0x6404('0xfb'))));_0x427ca4[_0x6404('0x8')](_0x6404('0xff'),express['static'](path[_0x6404('0xfd')](config['root'],_0x6404('0xff'))));_0x427ca4['use'](_0x6404('0x100'),express[_0x6404('0xfc')](path['join'](config[_0x6404('0xfe')],_0x6404('0x100'))));_0x427ca4[_0x6404('0x8')](_0x6404('0x101'),express['static'](path[_0x6404('0xfd')](config[_0x6404('0xfe')],'snippet',_0x6404('0x102'))));_0x427ca4['use']('/plugins',express[_0x6404('0xfc')](path['join'](config[_0x6404('0xfe')],_0x6404('0x103'))));_0x427ca4[_0x6404('0x104')](_0x6404('0x105'))[_0x6404('0x106')](errors[0x194]);_0x427ca4[_0x6404('0x104')]('/*')[_0x6404('0x106')](function(_0x5f3290,_0x37ada5){_0x37ada5[_0x6404('0x107')](path[_0x6404('0x108')](_0x427ca4[_0x6404('0x106')]('appPath')+_0x6404('0x109')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 5a9ba12..30670cf 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6668=['RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.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/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','server','http','rpc','port','localhost','../config/triggers'];(function(_0x408144,_0x211a81){var _0x151cfe=function(_0x2edc25){while(--_0x2edc25){_0x408144['push'](_0x408144['shift']());}};_0x151cfe(++_0x211a81);}(_0x6668,0xca));var _0x8666=function(_0xffd9e8,_0x165d2a){_0xffd9e8=_0xffd9e8-0x0;var _0x5d6c6e=_0x6668[_0xffd9e8];return _0x5d6c6e;};'use strict';var jayson=require(_0x8666('0x0'));var BPromise=require(_0x8666('0x1'));var _=require(_0x8666('0x2'));var config=require('../config/environment');exports[_0x8666('0x3')]=function(){return new BPromise(function(_0xd01727,_0x1811c9){var _0x1635aa={};_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x5')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x6')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x7')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/voiceRecording/voiceRecording.rpc'));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x8')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x9')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0xa')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0xb')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0xc')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0xd')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0xe')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0xf')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x10')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x11')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/mailInteraction/mailInteraction.rpc'));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x12')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x13')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x14')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x15')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x16')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x17')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x18')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x19')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x1a')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x1b')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/smsMessage/smsMessage.rpc'));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x1c')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x1d')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x1e')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x1f')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x20')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/chatInteraction/chatInteraction.rpc'));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x21')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x22')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x23')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x24')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x25')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x26')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x27')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x28')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x29')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x2a')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/trigger/trigger.rpc'));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x2b')));_0x1635aa=_['merge'](_0x1635aa,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x2c')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x2d')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x2e')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x2f')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x30')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x31')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x32')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x33')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x34')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x35')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/squareReport/squareReport.rpc'));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x36')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x37')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/squareProject/squareProject.rpc'));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x38')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require('../api/squareMessage/squareMessage.rpc'));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x39')));_0x1635aa=_['merge'](_0x1635aa,require(_0x8666('0x3a')));_0x1635aa=_[_0x8666('0x4')](_0x1635aa,require(_0x8666('0x3b')));var _0x198ab4=jayson[_0x8666('0x3c')](_0x1635aa)[_0x8666('0x3d')]();var _0x28230f=config[_0x8666('0x3e')][_0x8666('0x3f')]||config[_0x8666('0x3f')]+0x1;var _0x381d5f=config[_0x8666('0x3e')]['ip']||_0x8666('0x40');_0x198ab4['on']('error',function(_0x198987){return _0x1811c9(_0x198987);});_0x198ab4[_0x8666('0x3')](_0x28230f,_0x381d5f,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x381d5f,_0x28230f);require(_0x8666('0x41'))['default']();return _0xd01727(_0x8666('0x42')+_0x381d5f+':'+_0x28230f);});});}; \ No newline at end of file +var _0x5491=['../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/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/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','http','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc'];(function(_0x275bdf,_0x5170d6){var _0x3fb2d5=function(_0x3f6e60){while(--_0x3f6e60){_0x275bdf['push'](_0x275bdf['shift']());}};_0x3fb2d5(++_0x5170d6);}(_0x5491,0xd2));var _0x1549=function(_0x551941,_0x33f48a){_0x551941=_0x551941-0x0;var _0xa94322=_0x5491[_0x551941];return _0xa94322;};'use strict';var jayson=require(_0x1549('0x0'));var BPromise=require('bluebird');var _=require(_0x1549('0x1'));var config=require(_0x1549('0x2'));exports['listen']=function(){return new BPromise(function(_0x22de5e,_0x306e12){var _0x21f8ff={};_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x4')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/voiceExtension/voiceExtension.rpc'));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x5')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x6')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x7')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x8')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x9')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0xa')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0xb')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0xc')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0xd')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0xe')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0xf')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/mailInteraction/mailInteraction.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/mailMessage/mailMessage.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x10')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x11')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x12')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x13')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/faxInteraction/faxInteraction.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x14')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x15')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x16')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x17')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x18')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x19')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x1a')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x1b')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x1c')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x1d')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x1e')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/chatInteraction/chatInteraction.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x1f')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x20')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x21')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x22')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x23')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x24')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x25')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x26')));_0x21f8ff=_['merge'](_0x21f8ff,require('../api/interval/interval.rpc'));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x27')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x28')));_0x21f8ff=_['merge'](_0x21f8ff,require('../api/template/template.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x29')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x2a')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x2b')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x2c')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x2d')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x2e')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x2f')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x30')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x31')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x32')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x33')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x34')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x35')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/squareReport/squareReport.rpc'));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x36')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x37')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x38')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x39')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x3a')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require(_0x1549('0x3b')));_0x21f8ff=_['merge'](_0x21f8ff,require(_0x1549('0x3c')));_0x21f8ff=_[_0x1549('0x3')](_0x21f8ff,require('../api/plugin/plugin.rpc'));var _0x5e1ea7=jayson['server'](_0x21f8ff)[_0x1549('0x3d')]();var _0x3e91cc=config[_0x1549('0x3e')][_0x1549('0x3f')]||config[_0x1549('0x3f')]+0x1;var _0x365749=config[_0x1549('0x3e')]['ip']||_0x1549('0x40');_0x5e1ea7['on'](_0x1549('0x41'),function(_0x37dce3){return _0x306e12(_0x37dce3);});_0x5e1ea7[_0x1549('0x42')](_0x3e91cc,_0x365749,function(){console[_0x1549('0x43')](_0x1549('0x44'),_0x365749,_0x3e91cc);require(_0x1549('0x45'))[_0x1549('0x46')]();return _0x22de5e(_0x1549('0x47')+_0x365749+':'+_0x3e91cc);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index c9b766d..51b238d 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 _0x0713=['noop','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','result=','substr','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','inherits','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s'];(function(_0x778569,_0x172ed4){var _0x4eeb5c=function(_0x19302f){while(--_0x19302f){_0x778569['push'](_0x778569['shift']());}};_0x4eeb5c(++_0x172ed4);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x3071('0x0'))[_0x3071('0x1')];var AGIReply=require(_0x3071('0x2'));var AGIError=require(_0x3071('0x3'));function AGIChannel(_0x864539){var _0x52b5fb=this,_0x2c547f=new AGIReply(),_0x7b18a4=![],_0x33a70c={};EventEmitter[_0x3071('0x4')](_0x52b5fb);_0x864539[_0x3071('0x5')](_0x3071('0x6'));_0x864539[_0x3071('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2c547f[_0x3071('0x5')](_0x3071('0x6'));_0x2c547f['on'](_0x3071('0x8'),function(_0x3e9a5e){for(var _0x2fce7a in _0x3e9a5e){_0x52b5fb[_0x2fce7a]=_0x3e9a5e[_0x2fce7a];}_0x52b5fb[_0x3071('0x9')]('ready');});_0x2c547f['on'](_0x3071('0xa'),function(_0x2610b4){if(_0x2610b4[_0x3071('0xb')]()==_0x3071('0xc')){_0x52b5fb[_0x3071('0x9')]('hangup');return;}if(_0x2610b4[_0x3071('0xd')](0x0,0xb)==_0x3071('0xe')){_0x7b18a4=!![];}if(_0x7b18a4){_0x33a70c['rx']+=_0x2610b4+'\x0a';if(_0x2610b4[_0x3071('0xf')](_0x3071('0x10'))!=-0x1){_0x7b18a4=![];}}else{_0x33a70c['rx']=_0x2610b4;}if(_0x7b18a4){return;}if(typeof _0x33a70c['cb']==_0x3071('0x11')){var _0x4a8cc7=_0x33a70c['rx']['substring'](0x0,0x3),_0x5330a8=null,_0x1826ca=null;_0x4a8cc7=parseInt(_0x4a8cc7);if(isNaN(_0x4a8cc7)){_0x33a70c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x3071('0x12')});return;}if(_0x4a8cc7!=0xc8){_0x33a70c['cb'](null,{'code':_0x4a8cc7,'result':-0x1,'extra':'KO'});return;}_0x5330a8=_0x33a70c['rx'][_0x3071('0xd')](0x4)['replace'](_0x3071('0x13'),'');if(_0x5330a8['indexOf']('\x20')!=-0x1){_0x5330a8=_0x5330a8[_0x3071('0x14')](0x0,_0x5330a8[_0x3071('0x15')]('\x20'));}if(_[_0x3071('0x16')](_0x5330a8,'-1')){_0x5330a8=parseInt(_0x5330a8);}_0x1826ca=_0x33a70c['rx'][_0x3071('0x17')]('\x20');if(_0x1826ca[_0x3071('0x18')]==0x3){_0x1826ca=_0x1826ca[0x2][_0x3071('0xd')](0x1,_0x1826ca[0x2][_0x3071('0x18')]-0x1);}else if(_0x1826ca[_0x3071('0x18')]>0x3){var _0x21aad3=/\((.+)\)/;var _0x344ea6=_0x33a70c['rx']['match'](_0x21aad3);if(_0x344ea6){_0x1826ca=_0x344ea6[0x1];}else{_0x1826ca=null;}}else{_0x1826ca=null;}_0x33a70c['cb'](null,{'code':_0x4a8cc7,'result':_0x5330a8,'extra':_0x1826ca});}});_0x864539['on'](_0x3071('0x19'),function(_0x17dbda){_0x52b5fb[_0x3071('0x9')](_0x3071('0x19'),new AGIError(_0x3071('0x1a'),_0x17dbda[_0x3071('0x1b')]));});_0x864539['on'](_0x3071('0x1c'),function(){_0x52b5fb[_0x3071('0x9')]('close',new AGIError(_0x3071('0x1d')));});_0x864539['on'](_0x3071('0x1e'),function(){_0x52b5fb[_0x3071('0x9')]('timeout',new AGIError(_0x3071('0x1f')));_0x864539['destroy']();});_0x864539[_0x3071('0x20')](_0x2c547f);this[_0x3071('0x21')]=function(_0x3762d8,_0x457b57){var _0x3762d8=_0x3762d8||'',_0x457b57=typeof _0x457b57==_0x3071('0x11')?_0x457b57:new Function();_0x33a70c={'tx':_0x3762d8,'rx':'','cb':_0x457b57};_0x864539[_0x3071('0x22')](_0x3762d8+'\x0a');},this['close']=function(){_0x864539['destroy']();};}util[_0x3071('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x3071('0x24')][_0x3071('0x25')]=function(_0x13df9f){return this[_0x3071('0x21')][_0x3071('0x26')](this,_0x13df9f);};AGIChannel[_0x3071('0x24')][_0x3071('0x27')]=function(){return this[_0x3071('0x25')]('ANSWER');};AGIChannel[_0x3071('0x24')][_0x3071('0x28')]=function(_0x177138,_0x4d5c4b,_0x4fb1ca){_0x177138=_0x177138===undefined?_0x3071('0x29'):_0x177138;_0x4d5c4b=_0x4d5c4b===undefined?'5':_0x4d5c4b;_0x4fb1ca=_0x4fb1ca===undefined?'1':_0x4fb1ca;return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x2b'),_0x177138,_0x4d5c4b*0x3e8,_0x4fb1ca));};AGIChannel[_0x3071('0x24')][_0x3071('0x2c')]=function(_0x3921a1){_0x3921a1=_0x3921a1||_0x3071('0x2d');return this[_0x3071('0x25')](util[_0x3071('0x2a')]('VERBOSE\x20\x22%s\x22',_0x3921a1));};AGIChannel['prototype'][_0x3071('0x2e')]=function(_0x149e0d,_0x6ddf96){if(_[_0x3071('0x2f')](_0x6ddf96)){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x30'),_0x149e0d,_0x6ddf96[_0x3071('0x31')](',')));}return this['sendRequest'](util['format']('EXEC\x20%s\x20%s',_0x149e0d,_0x6ddf96));};AGIChannel[_0x3071('0x24')][_0x3071('0x32')]=function(_0x5b5bf1){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x33'),_0x5b5bf1));};AGIChannel[_0x3071('0x24')]['setExtension']=function(_0x218a82){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x34'),_0x218a82));};AGIChannel[_0x3071('0x24')][_0x3071('0x35')]=function(_0x3c55c){return this[_0x3071('0x25')](util['format'](_0x3071('0x36'),_0x3c55c));};AGIChannel['prototype']['hangup']=function(){return this[_0x3071('0x25')](_0x3071('0x37'));};AGIChannel['prototype'][_0x3071('0x38')]=function(_0x46e94e,_0x265d76){var _0x14ac42=_[_0x3071('0x39')](_0x265d76)||_[_0x3071('0x3a')](_0x265d76)?_0x265d76['toString']():_0x265d76;return this[_0x3071('0x25')](util[_0x3071('0x2a')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x46e94e,_0x14ac42?_0x14ac42[_0x3071('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x3071('0x24')][_0x3071('0x3c')]=function(_0x5733e9,_0x593c99){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x3d'),_0x5733e9,_0x593c99));};AGIChannel['prototype'][_0x3071('0x3e')]=function(_0x534a77,_0x1ac90a){return this['sendRequest'](util[_0x3071('0x2a')](_0x3071('0x3f'),_0x534a77,_0x1ac90a));};AGIChannel[_0x3071('0x24')][_0x3071('0x40')]=function(_0x30ab68,_0x593c9c){return this['sendRequest'](util[_0x3071('0x2a')](_0x3071('0x41'),_0x30ab68,_0x593c9c));};AGIChannel[_0x3071('0x24')][_0x3071('0x42')]=function(_0x525389,_0x3cfc05,_0x60549a){_0x3cfc05=_0x3cfc05||this[_0x3071('0x43')];_0x60549a=_0x60549a||0x1;this[_0x3071('0x32')](_0x525389);this[_0x3071('0x44')](_0x3cfc05);this[_0x3071('0x35')](_0x60549a);return this['noop'](util[_0x3071('0x2a')]('GOTO\x20%s\x20%s\x20%s',_0x525389,_0x3cfc05,_0x60549a));};AGIChannel['prototype']['getVariable']=function(_0x47ceaf){return this[_0x3071('0x25')](util[_0x3071('0x2a')](_0x3071('0x45'),_0x47ceaf));};AGIChannel[_0x3071('0x24')][_0x3071('0x46')]=function(_0x3a81e9,_0xa711b5,_0x2e6c70,_0x56589e,_0x1e8222,_0x1641d9){_0xa711b5=_0xa711b5||_0x3071('0x47');_0x2e6c70=_0x2e6c70||'';_0x56589e=_0x56589e===undefined?-0x1:_0x56589e==='-1'?-0x1:_0x56589e*0x3e8;_0x1e8222=_0x1e8222===undefined?'':'s='+_0x1e8222;_0x1641d9=_0x1641d9?_0x3071('0x48'):'';return this[_0x3071('0x25')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x3a81e9,_0xa711b5,_0x2e6c70,_0x56589e,_0x1641d9,_0x1e8222));};AGIChannel[_0x3071('0x24')][_0x3071('0x49')]=function(_0x1fe5e0,_0x5c5865){_0x5c5865=_0x5c5865||'';return this[_0x3071('0x25')](util['format'](_0x3071('0x4a'),_0x1fe5e0,_0x5c5865));};AGIChannel['prototype'][_0x3071('0x4b')]=function(_0x509178){return this['exec'](_0x3071('0x4c'),_0x509178);};AGIChannel['prototype'][_0x3071('0x4d')]=function(_0x5a0a69){return this[_0x3071('0x2e')](_0x3071('0x4e'),_0x5a0a69);};AGIChannel[_0x3071('0x24')][_0x3071('0x19')]=function(_0x554047,_0x2d70bf){this['noop'](util[_0x3071('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x554047['id'],_0x554047[_0x3071('0x4f')],_0x2d70bf));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x3071('0x50')]=AGIChannel; \ No newline at end of file +var _0x9c44=['no\x20code','replace','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setExtension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./reply','./error','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520\x20End\x20of\x20proper','function'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 6d7d450..c4da9b9 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 _0x33ed=['E_AGI_UNDEFINED','push','format','apply','name','exports','Undefined\x20error.','Server\x20closed.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x3611a7,_0x59563c){var _0x569692=function(_0x5bbdc7){while(--_0x5bbdc7){_0x3611a7['push'](_0x3611a7['shift']());}};_0x569692(++_0x59563c);}(_0x33ed,0x66));var _0xd33e=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0x33ed[_0x4536a4];return _0x4fd1c1;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0xd33e('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0xd33e('0x1'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xd33e('0x2'),'E_AGI_SOCKET_CLOSE':_0xd33e('0x3'),'E_AGI_SOCKET_TIMEOUT':_0xd33e('0x4'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xd33e('0x5')};function AGIError(_0x230ec8){var _0x230ec8=_0x230ec8||null,_0x8cc24b=_0x8cc24b||[],_0x32c230=0x1,_0x3baad9='';if(!error[_0x230ec8]){_0x230ec8=_0xd33e('0x6');}_0x8cc24b[_0xd33e('0x7')](error[_0x230ec8]);while(arguments[_0x32c230]){_0x8cc24b[_0xd33e('0x7')](arguments[_0x32c230]);_0x32c230++;}_0x3baad9=util[_0xd33e('0x8')][_0xd33e('0x9')](util,_0x8cc24b);this['message']=_0x3baad9;this[_0xd33e('0xa')]=_0x230ec8;}module[_0xd33e('0xb')]=AGIError; \ No newline at end of file +var _0x4fef=['Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','util'];(function(_0x59ee28,_0x3b230d){var _0x1ba1ac=function(_0x569148){while(--_0x569148){_0x59ee28['push'](_0x59ee28['shift']());}};_0x1ba1ac(++_0x3b230d);}(_0x4fef,0x10f));var _0xf4fe=function(_0x573e92,_0xb3de94){_0x573e92=_0x573e92-0x0;var _0xc7b95a=_0x4fef[_0x573e92];return _0xc7b95a;};'use strict';var util=require(_0xf4fe('0x0'));var error={'E_AGI_UNDEFINED':_0xf4fe('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xf4fe('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xf4fe('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0xf4fe('0x4'),'E_AGI_SOCKET_ERROR':_0xf4fe('0x5'),'E_AGI_SOCKET_CLOSE':_0xf4fe('0x6'),'E_AGI_SOCKET_TIMEOUT':_0xf4fe('0x7'),'E_AGI_COMMAND_EMPTY':_0xf4fe('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xf4fe('0x9'),'E_AGI_IVR_ENTRY':_0xf4fe('0xa')};function AGIError(_0x522427){var _0x522427=_0x522427||null,_0x3e844d=_0x3e844d||[],_0x4805b0=0x1,_0x23b761='';if(!error[_0x522427]){_0x522427=_0xf4fe('0xb');}_0x3e844d[_0xf4fe('0xc')](error[_0x522427]);while(arguments[_0x4805b0]){_0x3e844d[_0xf4fe('0xc')](arguments[_0x4805b0]);_0x4805b0++;}_0x23b761=util[_0xf4fe('0xd')][_0xf4fe('0xe')](util,_0x3e844d);this[_0xf4fe('0xf')]=_0x23b761;this[_0xf4fe('0x10')]=_0x522427;}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 b663097..4202eda 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 _0x6b20=['addEdge','numberOfEdges','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','menu','getsecretdigits','vertices','edges','prototype','addVertex'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x6b20,0xd1));var _0x06b2=function(_0x10ca04,_0x3ea10a){_0x10ca04=_0x10ca04-0x0;var _0x56e907=_0x6b20[_0x10ca04];return _0x56e907;};'use strict';var _=require(_0x06b2('0x0'));var logger=require(_0x06b2('0x1'))('agi');var verticesWithRetry=[_0x06b2('0x2'),'getdigits',_0x06b2('0x3')];var Graph=function(){this[_0x06b2('0x4')]={};this[_0x06b2('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0x06b2('0x6')][_0x06b2('0x7')]=function(_0x236287){this[_0x06b2('0x4')][_0x236287['id']]=_0x236287;this[_0x06b2('0x5')][_0x236287['id']]=[];};Graph[_0x06b2('0x6')][_0x06b2('0x8')]=function(_0x4e6d3b,_0x21cd31,_0x1828e4){this[_0x06b2('0x5')][_0x4e6d3b]['push']({'target':_0x21cd31,'condition':_0x1828e4});this[_0x06b2('0x9')]+=0x1;};Graph['prototype'][_0x06b2('0xa')]=function(){return _['size'](this['vertices']);};Graph[_0x06b2('0x6')][_0x06b2('0xb')]=function(){return this['numberOfEdges'];};Graph[_0x06b2('0x6')][_0x06b2('0xc')]=function(_0x3fa17b){return this[_0x06b2('0x4')][_0x3fa17b];};Graph[_0x06b2('0x6')][_0x06b2('0xd')]=function(_0x3039c9,_0x926bf6){if(!this[_0x06b2('0x4')][_0x3039c9]){return logger[_0x06b2('0xe')](_0x06b2('0xf'));}var _0x2822e9=_0x926bf6(this[_0x06b2('0x4')][_0x3039c9]);if(!_0x2822e9){return logger['info'](_0x06b2('0x10'));}if(this[_0x06b2('0x5')][_0x3039c9][_0x06b2('0x11')]===0x0){return logger[_0x06b2('0xe')](_0x06b2('0x12'));}for(var _0x45d5c5=0x0,_0x4b148c=[],_0x17e69b=![];_0x45d5c5\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','production','start','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','./vertices','defaults','127.0.0.1','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','[%s]\x20%s','message','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry'];(function(_0x47a802,_0x424bf1){var _0xb3badc=function(_0x5f44d3){while(--_0x5f44d3){_0x47a802['push'](_0x47a802['shift']());}};_0xb3badc(++_0x424bf1);}(_0x60c2,0x8f));var _0x260c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x60c2[_0x432682];return _0x463d05;};'use strict';var parser=require('xml2json');var _=require(_0x260c('0x0'));var syncho=require(_0x260c('0x1'));var util=require(_0x260c('0x2'));var moment=require(_0x260c('0x3'));var config=require(_0x260c('0x4'));var logger=require(_0x260c('0x5'))(_0x260c('0x6'));var utilLicense=require(_0x260c('0x7'));var rpc=require(_0x260c('0x8'));var mailRpc=require(_0x260c('0x9'));var Graph=require(_0x260c('0xa'));var Vertices=require(_0x260c('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0x260c('0xc')](config[_0x260c('0x6')],{'ip':_0x260c('0xd'),'port':0x11dd});function connectionHandler(_0xf22c37){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0xf22c37);agiHandler(_0xf22c37);}catch(_0xb36958){logger[_0x260c('0xe')](_0xb36958[_0x260c('0xf')]);}});});}function listeningHandler(){console[_0x260c('0x10')](_0x260c('0x11'),config[_0x260c('0x6')][_0x260c('0x12')]);logger['info'](util[_0x260c('0x13')](_0x260c('0x14'),config[_0x260c('0x6')]['ip'],config['agi'][_0x260c('0x12')]));}function errorHandler(_0x1d4f43){if(_0x1d4f43&&_0x1d4f43[_0x260c('0x15')]&&_0x1d4f43['message']){logger[_0x260c('0xe')](util[_0x260c('0x13')](_0x260c('0x16'),_0x1d4f43[_0x260c('0x15')],_0x1d4f43[_0x260c('0x17')]));}else{logger['error'](util[_0x260c('0x13')]('[ERROR]\x20%s',_0x1d4f43[_0x260c('0xf')]));}}function closeHandler(){logger[_0x260c('0x18')](util['format'](_0x260c('0x19'),this['arg_1'],this[_0x260c('0x1a')],this[_0x260c('0x1b')],this[_0x260c('0x1c')],this[_0x260c('0x1d')]));try{createSquareReport(this);}catch(_0x2bf3b8){logger[_0x260c('0xe')](_0x2bf3b8[_0x260c('0xf')]);}}function timeoutHandler(){logger[_0x260c('0x18')](util[_0x260c('0x13')](_0x260c('0x1e'),this[_0x260c('0x1f')],this['calleridname'],this[_0x260c('0x1b')],this['dnid'],this[_0x260c('0x1d')]));}function hangupHandler(){logger[_0x260c('0x18')](util['format'](_0x260c('0x20'),this[_0x260c('0x1f')],this[_0x260c('0x1a')],this[_0x260c('0x1b')],this[_0x260c('0x1c')],this[_0x260c('0x1d')]));this['evtHangup']=!![];}function getRoot(_0xd5b7d8){return parser[_0x260c('0x21')](_0xd5b7d8,{'object':!![]})[_0x260c('0x22')][_0x260c('0x23')];}function addVertex(_0x58688c,_0x3f299f,_0x304961){_0x3f299f[_0x260c('0x24')]=_0x304961;if(_0x3f299f[_0x260c('0x25')]('retry')){_0x3f299f[_0x260c('0x26')]=parseInt(_0x3f299f[_0x260c('0x27')],0xa);}_0x58688c[_0x260c('0x28')](_[_0x260c('0x29')](_0x3f299f,'mxCell'));}function initGraph(_0xc4280e,_0x2957e5){var _0x480179=new Graph();for(var _0x5def72 in _0xc4280e){if(_0xc4280e[_0x260c('0x25')](_0x5def72)){if(_[_0x260c('0x2a')](_0xc4280e[_0x5def72])){for(var _0x43a894=0x0;_0x43a894<_0xc4280e[_0x5def72][_0x260c('0x2b')];_0x43a894+=0x1){addVertex(_0x480179,_0xc4280e[_0x5def72][_0x43a894],_0x5def72);}}else{addVertex(_0x480179,_0xc4280e[_0x5def72],_0x5def72);}}}for(var _0x357790=0x0;_0x357790<_0x2957e5[_0x260c('0x2b')];_0x357790+=0x1){if(_0x2957e5[_0x357790]['source']&&_0x2957e5[_0x357790][_0x260c('0x2c')]){_0x480179[_0x260c('0x2d')](_0x2957e5[_0x357790][_0x260c('0x2e')],_0x2957e5[_0x357790][_0x260c('0x2c')],_0x2957e5[_0x357790]['value']);}}return _0x480179;}function getSquareProject(_0xc6868a,_0x3c33d6){rpc['getSquareProject'](_0xc6868a)[_0x260c('0x2f')](function(_0xcb8c28){_0x3c33d6(null,_0xcb8c28);})[_0x260c('0x30')](function(_0x157883){_0x3c33d6(null,_0x157883);});}function createSquareReport(_0x414580,_0x23d71a){rpc[_0x260c('0x31')](_0x414580)[_0x260c('0x2f')](function(_0x5e49c6){if(_0x23d71a){_0x23d71a(null,_0x5e49c6);}})[_0x260c('0x30')](function(_0x2dccb3){if(_0x23d71a){_0x23d71a(null,_0x2dccb3);}});}function setChannelVariables(_0x5ebf4c){for(var _0x18c952 in _0x5ebf4c){if(_0x5ebf4c['hasOwnProperty'](_0x18c952)){if(_0x18c952['indexOf']('agi_')===0x0){_0x5ebf4c[_0x18c952[_0x260c('0x32')](0x4)]=_0x5ebf4c[_0x18c952];delete _0x5ebf4c[_0x18c952];}}}}function getLogFromObject(_0x455b6c){return util['inspect'](_0x455b6c,{'showHidden':![],'depth':null});}function agiHandler(_0x329279){var _0x2b3cd9,_0x35e4a8,_0x2477b1,_0x46d3e0,_0x141bb2;logger['debug'](_0x260c('0x33'),JSON[_0x260c('0x34')](_0x329279,null,0x2));logger[_0x260c('0x18')](util[_0x260c('0x13')](_0x260c('0x35'),_0x329279[_0x260c('0x1f')],_0x329279[_0x260c('0x1a')],_0x329279[_0x260c('0x1b')],_0x329279[_0x260c('0x1c')],_0x329279['uniqueid']));_0x329279['on'](_0x260c('0xe'),errorHandler);_0x329279['on']('close',closeHandler);_0x329279['on']('timeout',timeoutHandler);_0x329279['evtHangup']=![];_0x329279['on']('hangup',hangupHandler);var _0x4e2c9f=getSquareProject['sync'](null,_0x329279['arg_1']);if(_0x4e2c9f){if(_0x4e2c9f[_0x260c('0x36')]){_0x2b3cd9=getRoot(_0x4e2c9f[_0x260c('0x36')]);if(_0x2b3cd9&&_0x2b3cd9[_0x260c('0x37')]){logger[_0x260c('0x38')]('root',JSON[_0x260c('0x34')](_0x2b3cd9,null,0x2));_0x329279[_0x260c('0x39')]=moment()['format'](_0x260c('0x3a'));_0x35e4a8=initGraph(_[_0x260c('0x29')](_0x2b3cd9,_0x260c('0x3b')),_0x2b3cd9[_0x260c('0x3b')]);_0x2477b1=new Vertices(_0x329279,rpc,mailRpc);logger[_0x260c('0x18')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x329279[_0x260c('0x1f')],_0x329279[_0x260c('0x1a')],_0x329279[_0x260c('0x1b')],_0x329279[_0x260c('0x1c')],_0x329279['uniqueid']));_0x35e4a8[_0x260c('0x3c')](_0x2b3cd9[_0x260c('0x37')]['id'],function(_0x265bd8){try{_0x265bd8=_0x2477b1[_0x260c('0x3d')](_0x265bd8);logger[_0x260c('0x38')](_0x260c('0x3e'),JSON[_0x260c('0x34')](_0x265bd8,null,0x2));if(_0x265bd8[_0x260c('0x24')]===_0x260c('0x3f')){logger[_0x260c('0x18')](_0x260c('0x40'));_0x329279[_0x260c('0x41')]=_0x265bd8[_0x260c('0x41')]||_0x329279['context'];_0x329279['extension']=_0x265bd8[_0x260c('0x42')];_0x329279[_0x260c('0x43')]=_0x265bd8[_0x260c('0x43')]?_0x265bd8['priority']-0x1:0x1;return null;}else if(_0x265bd8&&_0x2477b1[_0x265bd8[_0x260c('0x24')]]){_0x141bb2=_0x2477b1[_0x265bd8['agicommand']](_0x265bd8);logger['info'](_0x260c('0x44'),JSON['stringify'](_0x141bb2,null,0x2));if(_0x141bb2&&_0x141bb2[_0x260c('0x45')]===AGI_CODE_SUCCESS&&_0x141bb2[_0x260c('0x46')]!==AGI_RESULT_ERROR&&!_0x329279[_0x260c('0x47')]){logger[_0x260c('0x38')]('response',getLogFromObject(_0x141bb2));return _[_0x260c('0x48')](_0x141bb2[_0x260c('0x46')])?null:_0x141bb2['result'][_0x260c('0x49')]();}else{logger['error'](_0x260c('0x44'),getLogFromObject(_0x141bb2));return null;}}else{logger[_0x260c('0xe')](_0x260c('0x4a'));return null;}}catch(_0x5f40a7){logger[_0x260c('0xe')](_0x5f40a7[_0x260c('0xf')]);return null;}});if(_0x2b3cd9[_0x260c('0x4b')]){logger[_0x260c('0x18')](util[_0x260c('0x13')](_0x260c('0x4c'),_0x329279[_0x260c('0x1f')],_0x329279[_0x260c('0x1a')],_0x329279[_0x260c('0x1b')],_0x329279[_0x260c('0x1c')],_0x329279[_0x260c('0x1d')]));_0x35e4a8[_0x260c('0x3c')](_0x2b3cd9['finally']['id'],function(_0x558563){try{_0x558563=_0x2477b1[_0x260c('0x3d')](_0x558563);logger[_0x260c('0x38')](_0x260c('0x3e'),JSON[_0x260c('0x34')](_0x558563,null,0x2));if(_0x558563&&_0x2477b1[_0x558563['agicommand']]){_0x141bb2=_0x2477b1[_0x558563[_0x260c('0x24')]](_0x558563);if(_0x141bb2){logger[_0x260c('0x38')](_0x260c('0x44'),getLogFromObject(_0x141bb2));return _[_0x260c('0x48')](_0x141bb2[_0x260c('0x46')])?null:_0x141bb2[_0x260c('0x46')][_0x260c('0x49')]();}else{logger[_0x260c('0xe')](_0x260c('0x44'),getLogFromObject(_0x141bb2));return null;}}else{logger['error'](_0x260c('0x4a'));return null;}}catch(_0x9ef48e){logger['error'](_0x9ef48e[_0x260c('0xf')]);return null;}});}logger['info'](util[_0x260c('0x13')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x329279['arg_1'],_0x329279[_0x260c('0x1a')],_0x329279[_0x260c('0x1b')],_0x329279[_0x260c('0x1c')],_0x329279[_0x260c('0x1d')]));logger[_0x260c('0x18')](util[_0x260c('0x13')](_0x260c('0x4d'),_0x329279['context'],_0x329279[_0x260c('0x42')],parseInt(_0x329279['priority'],0xa)+0x1));_0x329279[_0x260c('0x4e')](_0x329279[_0x260c('0x41')],_0x329279[_0x260c('0x42')],parseInt(_0x329279[_0x260c('0x43')],0xa)+0x1);_0x329279[_0x260c('0x4f')]();}}else{logger[_0x260c('0xe')](util[_0x260c('0x13')](_0x260c('0x50'),_0x329279['arg_1']));_0x329279[_0x260c('0x4e')](_0x329279[_0x260c('0x41')],_0x329279[_0x260c('0x42')],parseInt(_0x329279[_0x260c('0x43')],0xa)+0x1);_0x329279['close']();}}else{logger[_0x260c('0xe')](util['format'](_0x260c('0x51'),_0x329279['arg_1']));_0x329279['continueAt'](_0x329279[_0x260c('0x41')],_0x329279['extension'],parseInt(_0x329279[_0x260c('0x43')],0xa)+0x1);_0x329279['close']();}}function main(){var _0xe22dbf;return utilLicense[_0x260c('0x52')]()[_0x260c('0x2f')](function(_0x1bed1f){if(_0x1bed1f){if(_0x1bed1f[_0x260c('0x53')]){if(_0x1bed1f[_0x260c('0x54')]&&_0x1bed1f[_0x260c('0x54')]>0x0){logger[_0x260c('0x18')](util[_0x260c('0x13')](_0x260c('0x55'),_0x1bed1f['callysquare']));_0xe22dbf=_0x1bed1f['callysquare'];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x260c('0x18')](_0x260c('0x56'));_0xe22dbf=-0x1;}}})[_0x260c('0x30')](function(_0x3d7e49){logger[_0x260c('0xe')](_0x260c('0x57'),_0x3d7e49[_0x260c('0xf')]);})['finally'](function(){var _0x2fff3f=require(_0x260c('0x58'))(config['agi'][_0x260c('0x12')],config[_0x260c('0x6')]['ip'],_0xe22dbf);_0x2fff3f['on'](_0x260c('0xe'),errorHandler);_0x2fff3f['on'](_0x260c('0x59'),listeningHandler);_0x2fff3f['on'](_0x260c('0x5a'),connectionHandler);_0x2fff3f['on'](_0x260c('0x4f'),closeHandler);});}main(); \ No newline at end of file +var _0x00bb=['response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','xml2json','lodash','syncho','moment','../../config/logger','agi','./rpc','./mailRpc','defaults','127.0.0.1','nextTick','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','error','format','[%s]\x20%s','[ERROR]\x20%s','stack','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','arg_1','calleridname','evtHangup','toJson','mxGraphModel','agicommand','hasOwnProperty','maxRetry','retry','addVertex','omit','isArray','length','source','target','value','then','catch','createSquareReport','indexOf','substring','inspect','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','start','debug','root','stringify','joinAt','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc','context','extension','priority'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x00bb,0x1d8));var _0xb00b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x00bb[_0x134c2e];return _0x2825db;};'use strict';var parser=require(_0xb00b('0x0'));var _=require(_0xb00b('0x1'));var syncho=require(_0xb00b('0x2'));var util=require('util');var moment=require(_0xb00b('0x3'));var config=require('../../config/environment');var logger=require(_0xb00b('0x4'))(_0xb00b('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0xb00b('0x6'));var mailRpc=require(_0xb00b('0x7'));var Graph=require('./graph');var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config['agi']=_[_0xb00b('0x8')](config[_0xb00b('0x5')],{'ip':_0xb00b('0x9'),'port':0x11dd});function connectionHandler(_0x37f07d){process[_0xb00b('0xa')](function(){syncho(function(){try{setChannelVariables(_0x37f07d);agiHandler(_0x37f07d);}catch(_0x3c36c5){logger['error'](_0x3c36c5['stack']);}});});}function listeningHandler(){console[_0xb00b('0xb')](_0xb00b('0xc'),config[_0xb00b('0x5')][_0xb00b('0xd')]);logger[_0xb00b('0xe')](util['format'](_0xb00b('0xf'),config['agi']['ip'],config['agi']['port']));}function errorHandler(_0x4ff792){if(_0x4ff792&&_0x4ff792[_0xb00b('0x10')]&&_0x4ff792[_0xb00b('0x11')]){logger[_0xb00b('0x12')](util[_0xb00b('0x13')](_0xb00b('0x14'),_0x4ff792['name'],_0x4ff792[_0xb00b('0x11')]));}else{logger[_0xb00b('0x12')](util['format'](_0xb00b('0x15'),_0x4ff792[_0xb00b('0x16')]));}}function closeHandler(){logger['info'](util['format'](_0xb00b('0x17'),this['arg_1'],this['calleridname'],this[_0xb00b('0x18')],this[_0xb00b('0x19')],this[_0xb00b('0x1a')]));try{createSquareReport(this);}catch(_0xbb72fc){logger['error'](_0xbb72fc[_0xb00b('0x16')]);}}function timeoutHandler(){logger['info'](util[_0xb00b('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xb00b('0x1b')],this['calleridname'],this[_0xb00b('0x18')],this[_0xb00b('0x19')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0xb00b('0x13')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xb00b('0x1b')],this[_0xb00b('0x1c')],this[_0xb00b('0x18')],this[_0xb00b('0x19')],this['uniqueid']));this[_0xb00b('0x1d')]=!![];}function getRoot(_0x4df284){return parser[_0xb00b('0x1e')](_0x4df284,{'object':!![]})[_0xb00b('0x1f')]['root'];}function addVertex(_0x231293,_0x2896d1,_0x520444){_0x2896d1[_0xb00b('0x20')]=_0x520444;if(_0x2896d1[_0xb00b('0x21')]('retry')){_0x2896d1[_0xb00b('0x22')]=parseInt(_0x2896d1[_0xb00b('0x23')],0xa);}_0x231293[_0xb00b('0x24')](_[_0xb00b('0x25')](_0x2896d1,'mxCell'));}function initGraph(_0x50be6c,_0x3785e9){var _0x490380=new Graph();for(var _0x550587 in _0x50be6c){if(_0x50be6c['hasOwnProperty'](_0x550587)){if(_[_0xb00b('0x26')](_0x50be6c[_0x550587])){for(var _0x73b6b0=0x0;_0x73b6b0<_0x50be6c[_0x550587][_0xb00b('0x27')];_0x73b6b0+=0x1){addVertex(_0x490380,_0x50be6c[_0x550587][_0x73b6b0],_0x550587);}}else{addVertex(_0x490380,_0x50be6c[_0x550587],_0x550587);}}}for(var _0x3825af=0x0;_0x3825af<_0x3785e9[_0xb00b('0x27')];_0x3825af+=0x1){if(_0x3785e9[_0x3825af][_0xb00b('0x28')]&&_0x3785e9[_0x3825af][_0xb00b('0x29')]){_0x490380['addEdge'](_0x3785e9[_0x3825af][_0xb00b('0x28')],_0x3785e9[_0x3825af]['target'],_0x3785e9[_0x3825af][_0xb00b('0x2a')]);}}return _0x490380;}function getSquareProject(_0x348165,_0x5424ca){rpc['getSquareProject'](_0x348165)[_0xb00b('0x2b')](function(_0x280ed3){_0x5424ca(null,_0x280ed3);})[_0xb00b('0x2c')](function(_0x183233){_0x5424ca(null,_0x183233);});}function createSquareReport(_0x303625,_0x2b9824){rpc[_0xb00b('0x2d')](_0x303625)[_0xb00b('0x2b')](function(_0x149c1a){if(_0x2b9824){_0x2b9824(null,_0x149c1a);}})['catch'](function(_0x2b5f41){if(_0x2b9824){_0x2b9824(null,_0x2b5f41);}});}function setChannelVariables(_0x44918d){for(var _0x49078d in _0x44918d){if(_0x44918d[_0xb00b('0x21')](_0x49078d)){if(_0x49078d[_0xb00b('0x2e')]('agi_')===0x0){_0x44918d[_0x49078d[_0xb00b('0x2f')](0x4)]=_0x44918d[_0x49078d];delete _0x44918d[_0x49078d];}}}}function getLogFromObject(_0x4d2ee5){return util[_0xb00b('0x30')](_0x4d2ee5,{'showHidden':![],'depth':null});}function agiHandler(_0x4117f2){var _0x322879,_0x1be4ba,_0x338864,_0x1436ad,_0x17f613;logger['debug']('variables',JSON['stringify'](_0x4117f2,null,0x2));logger[_0xb00b('0xe')](util[_0xb00b('0x13')](_0xb00b('0x31'),_0x4117f2[_0xb00b('0x1b')],_0x4117f2['calleridname'],_0x4117f2[_0xb00b('0x18')],_0x4117f2[_0xb00b('0x19')],_0x4117f2[_0xb00b('0x1a')]));_0x4117f2['on'](_0xb00b('0x12'),errorHandler);_0x4117f2['on'](_0xb00b('0x32'),closeHandler);_0x4117f2['on'](_0xb00b('0x33'),timeoutHandler);_0x4117f2[_0xb00b('0x1d')]=![];_0x4117f2['on'](_0xb00b('0x34'),hangupHandler);var _0x5efc18=getSquareProject['sync'](null,_0x4117f2[_0xb00b('0x1b')]);if(_0x5efc18){if(_0x5efc18['production']){_0x322879=getRoot(_0x5efc18[_0xb00b('0x35')]);if(_0x322879&&_0x322879[_0xb00b('0x36')]){logger[_0xb00b('0x37')](_0xb00b('0x38'),JSON[_0xb00b('0x39')](_0x322879,null,0x2));_0x4117f2[_0xb00b('0x3a')]=moment()[_0xb00b('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x1be4ba=initGraph(_[_0xb00b('0x25')](_0x322879,_0xb00b('0x3b')),_0x322879[_0xb00b('0x3b')]);_0x338864=new Vertices(_0x4117f2,rpc,mailRpc);logger[_0xb00b('0xe')](util[_0xb00b('0x13')](_0xb00b('0x3c'),_0x4117f2['arg_1'],_0x4117f2[_0xb00b('0x1c')],_0x4117f2[_0xb00b('0x18')],_0x4117f2['dnid'],_0x4117f2[_0xb00b('0x1a')]));_0x1be4ba[_0xb00b('0x3d')](_0x322879[_0xb00b('0x36')]['id'],function(_0x2d8620){try{_0x2d8620=_0x338864[_0xb00b('0x3e')](_0x2d8620);logger['debug'](_0xb00b('0x3f'),JSON[_0xb00b('0x39')](_0x2d8620,null,0x2));if(_0x2d8620[_0xb00b('0x20')]===_0xb00b('0x40')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x4117f2[_0xb00b('0x41')]=_0x2d8620[_0xb00b('0x41')]||_0x4117f2[_0xb00b('0x41')];_0x4117f2[_0xb00b('0x42')]=_0x2d8620[_0xb00b('0x42')];_0x4117f2[_0xb00b('0x43')]=_0x2d8620[_0xb00b('0x43')]?_0x2d8620['priority']-0x1:0x1;return null;}else if(_0x2d8620&&_0x338864[_0x2d8620[_0xb00b('0x20')]]){_0x17f613=_0x338864[_0x2d8620[_0xb00b('0x20')]](_0x2d8620);logger[_0xb00b('0xe')](_0xb00b('0x44'),JSON[_0xb00b('0x39')](_0x17f613,null,0x2));if(_0x17f613&&_0x17f613[_0xb00b('0x45')]===AGI_CODE_SUCCESS&&_0x17f613[_0xb00b('0x46')]!==AGI_RESULT_ERROR&&!_0x4117f2[_0xb00b('0x1d')]){logger[_0xb00b('0x37')](_0xb00b('0x44'),getLogFromObject(_0x17f613));return _[_0xb00b('0x47')](_0x17f613[_0xb00b('0x46')])?null:_0x17f613['result'][_0xb00b('0x48')]();}else{logger[_0xb00b('0x12')](_0xb00b('0x44'),getLogFromObject(_0x17f613));return null;}}else{logger[_0xb00b('0x12')](_0xb00b('0x49'));return null;}}catch(_0x2d9174){logger[_0xb00b('0x12')](_0x2d9174[_0xb00b('0x16')]);return null;}});if(_0x322879[_0xb00b('0x4a')]){logger[_0xb00b('0xe')](util[_0xb00b('0x13')](_0xb00b('0x4b'),_0x4117f2['arg_1'],_0x4117f2['calleridname'],_0x4117f2['callerid'],_0x4117f2[_0xb00b('0x19')],_0x4117f2[_0xb00b('0x1a')]));_0x1be4ba['traverseBFS'](_0x322879[_0xb00b('0x4a')]['id'],function(_0x3c0fa){try{_0x3c0fa=_0x338864[_0xb00b('0x3e')](_0x3c0fa);logger[_0xb00b('0x37')]('vertex',JSON['stringify'](_0x3c0fa,null,0x2));if(_0x3c0fa&&_0x338864[_0x3c0fa[_0xb00b('0x20')]]){_0x17f613=_0x338864[_0x3c0fa[_0xb00b('0x20')]](_0x3c0fa);if(_0x17f613){logger['debug']('response',getLogFromObject(_0x17f613));return _[_0xb00b('0x47')](_0x17f613[_0xb00b('0x46')])?null:_0x17f613['result'][_0xb00b('0x48')]();}else{logger['error']('response',getLogFromObject(_0x17f613));return null;}}else{logger['error'](_0xb00b('0x49'));return null;}}catch(_0x481515){logger[_0xb00b('0x12')](_0x481515[_0xb00b('0x16')]);return null;}});}logger[_0xb00b('0xe')](util[_0xb00b('0x13')](_0xb00b('0x4c'),_0x4117f2[_0xb00b('0x1b')],_0x4117f2['calleridname'],_0x4117f2['callerid'],_0x4117f2[_0xb00b('0x19')],_0x4117f2[_0xb00b('0x1a')]));logger['info'](util[_0xb00b('0x13')](_0xb00b('0x4d'),_0x4117f2['context'],_0x4117f2[_0xb00b('0x42')],parseInt(_0x4117f2[_0xb00b('0x43')],0xa)+0x1));_0x4117f2[_0xb00b('0x4e')](_0x4117f2['context'],_0x4117f2['extension'],parseInt(_0x4117f2[_0xb00b('0x43')],0xa)+0x1);_0x4117f2[_0xb00b('0x32')]();}}else{logger[_0xb00b('0x12')](util[_0xb00b('0x13')]('Project\x20%s\x20not\x20published',_0x4117f2[_0xb00b('0x1b')]));_0x4117f2[_0xb00b('0x4e')](_0x4117f2['context'],_0x4117f2['extension'],parseInt(_0x4117f2[_0xb00b('0x43')],0xa)+0x1);_0x4117f2['close']();}}else{logger[_0xb00b('0x12')](util[_0xb00b('0x13')](_0xb00b('0x4f'),_0x4117f2[_0xb00b('0x1b')]));_0x4117f2[_0xb00b('0x4e')](_0x4117f2[_0xb00b('0x41')],_0x4117f2['extension'],parseInt(_0x4117f2[_0xb00b('0x43')],0xa)+0x1);_0x4117f2['close']();}}function main(){var _0x37d4d2;return utilLicense[_0xb00b('0x50')]()[_0xb00b('0x2b')](function(_0x5ac79e){if(_0x5ac79e){if(_0x5ac79e[_0xb00b('0x51')]){if(_0x5ac79e[_0xb00b('0x52')]&&_0x5ac79e[_0xb00b('0x52')]>0x0){logger['info'](util[_0xb00b('0x13')](_0xb00b('0x53'),_0x5ac79e[_0xb00b('0x52')]));_0x37d4d2=_0x5ac79e[_0xb00b('0x52')];}else{logger[_0xb00b('0xe')](_0xb00b('0x54'));}}else{logger[_0xb00b('0xe')](_0xb00b('0x55'));_0x37d4d2=-0x1;}}})['catch'](function(_0x153551){logger[_0xb00b('0x12')](_0xb00b('0x56'),_0x153551['stack']);})[_0xb00b('0x4a')](function(){var _0x24a8a2=require(_0xb00b('0x57'))(config[_0xb00b('0x5')][_0xb00b('0xd')],config['agi']['ip'],_0x37d4d2);_0x24a8a2['on'](_0xb00b('0x12'),errorHandler);_0x24a8a2['on'](_0xb00b('0x58'),listeningHandler);_0x24a8a2['on'](_0xb00b('0x59'),connectionHandler);_0x24a8a2['on'](_0xb00b('0x32'),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 4ace8b1..e557337 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 _0x34e8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','then','error','message'];(function(_0x30a432,_0x161b44){var _0x548de3=function(_0x346d41){while(--_0x346d41){_0x30a432['push'](_0x30a432['shift']());}};_0x548de3(++_0x161b44);}(_0x34e8,0x12c));var _0x834e=function(_0x411b85,_0x294ed2){_0x411b85=_0x411b85-0x0;var _0x506696=_0x34e8[_0x411b85];return _0x506696;};'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 +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x351927,_0x2bc1ad){var _0x853ecb=function(_0x363bed){while(--_0x363bed){_0x351927['push'](_0x351927['shift']());}};_0x853ecb(++_0x2bc1ad);}(_0x814b,0x1a2));var _0xb814=function(_0x3a7455,_0x46b004){_0x3a7455=_0x3a7455-0x0;var _0x216c72=_0x814b[_0x3a7455];return _0x216c72;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index ce9f1be..9b22278 100644 --- a/server/services/agi/reply.js +++ b/server/services/agi/reply.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x52f4d6,_0x2f4818){var _0xaa4059=function(_0x1ecfb3){while(--_0x1ecfb3){_0x52f4d6['push'](_0x52f4d6['shift']());}};_0xaa4059(++_0x2f4818);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3bb403,_0x44ad62){_0x3bb403=_0x3bb403-0x0;var _0x3b45=_0x5f2f[_0x3bb403];return _0x3b45;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x127f71,_0x1e88d6){var _0x583dc4=function(_0xbb99e4){while(--_0xbb99e4){_0x127f71['push'](_0x127f71['shift']());}};_0x583dc4(++_0x1e88d6);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2b1222,_0xe66198){_0x2b1222=_0x2b1222-0x0;var _0x31b607=_0x5f2f[_0x2b1222];return _0x31b607;};'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 de7c466..24c5c1d 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 _0xd732=['LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','lodash','client','http','request','then','error','result','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowSquareOdbc','dsn','getUserById','ShowTrunk','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','CreateCmContact','ShowPause'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd732,0x18e));var _0x2d73=function(_0x197987,_0x480625){_0x197987=_0x197987-0x0;var _0x5bc8c5=_0xd732[_0x197987];return _0x5bc8c5;};'use strict';var BPromise=require(_0x2d73('0x0'));var moment=require('moment');var _=require(_0x2d73('0x1'));var util=require('util');var jayson=require('jayson/promise');var client=jayson[_0x2d73('0x2')][_0x2d73('0x3')]({'port':0x2329});function request(_0x58479e,_0x591de9){return new BPromise(function(_0x274113,_0x4b7d8b){return client[_0x2d73('0x4')](_0x58479e,_0x591de9)[_0x2d73('0x5')](function(_0x47d40d){if(_0x47d40d['error']){return _0x4b7d8b(_0x47d40d[_0x2d73('0x6')]['message']);}else{return _0x274113(_0x47d40d[_0x2d73('0x7')]);}})[_0x2d73('0x8')](function(_0x28ad42){return _0x4b7d8b(_0x28ad42);});});}exports[_0x2d73('0x9')]=function(_0x56f52d){return request(_0x2d73('0xa'),{'options':{'raw':![],'where':{'name':_0x56f52d},'attributes':[_0x2d73('0xb')]}});};exports[_0x2d73('0xc')]=function(_0x2655b1){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x2655b1},'include':[{'model':_0x2d73('0xd'),'as':_0x2d73('0xe')}],'attributes':['id',_0x2d73('0xf'),_0x2d73('0x10')]}});};exports[_0x2d73('0x11')]=function(_0x45008a){return request(_0x2d73('0xa'),{'options':{'where':{'id':_0x45008a},'attributes':[_0x2d73('0xf')]}});};exports[_0x2d73('0x12')]=function(_0x1e75fa){return request(_0x2d73('0x13'),{'options':{'where':{'id':_0x1e75fa},'attributes':[_0x2d73('0xf')]}});};exports['getVariableById']=function(_0x370fa5){return request('ShowVariable',{'options':{'where':{'id':_0x370fa5},'attributes':[_0x2d73('0xf')]}});};exports['getSquareOdbcById']=function(_0x1e9bc3){return request(_0x2d73('0x14'),{'options':{'where':{'id':_0x1e9bc3},'attributes':[_0x2d73('0x15')]}});};exports[_0x2d73('0x16')]=function(_0x1cb370){return request('ShowUser',{'options':{'where':{'id':_0x1cb370},'attributes':['name']}});};exports['getTrunkById']=function(_0x3cde1d){return request(_0x2d73('0x17'),{'options':{'where':{'id':_0x3cde1d},'attributes':[_0x2d73('0xf')]}});};exports['getSoundById']=function(_0x303dfe){return request(_0x2d73('0x18'),{'options':{'where':{'id':_0x303dfe},'attributes':[_0x2d73('0x19')]}});};exports[_0x2d73('0x1a')]=function(_0x5934e2){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x5934e2},'include':[{'model':_0x2d73('0x1b'),'as':_0x2d73('0x1c')}]}});};exports[_0x2d73('0x1d')]=function(_0x350d7d){return request(_0x2d73('0x1e'),{'options':{'where':{'id':_0x350d7d},'attributes':['id',_0x2d73('0xf')]}});};exports[_0x2d73('0x1f')]=function(_0xa14d31){return request('CreateSmsMessage',{'body':_0xa14d31});};exports[_0x2d73('0x20')]=function(_0x233f57){return request(_0x2d73('0x21'),{'body':_0x233f57});};exports[_0x2d73('0x22')]=function(_0x51030d){return request(_0x2d73('0x23'),{'body':_[_0x2d73('0x24')](_0x51030d,{'project_name':_0x51030d[_0x2d73('0x25')],'prev_project_name':_0x51030d[_0x2d73('0x26')]||'','is_subproject':_0x51030d[_0x2d73('0x26')]?!![]:![],'leaveAt':moment()[_0x2d73('0x27')](_0x2d73('0x28'))})});};exports[_0x2d73('0x29')]=function(_0x350848){return request(_0x2d73('0x2a'),{'body':_0x350848});};exports[_0x2d73('0x2b')]=function(_0x20b818){return request(_0x2d73('0x2c'),{'body':_0x20b818});};exports[_0x2d73('0x2d')]=function(_0x24aecc){return request(_0x2d73('0x2e'),{'options':{'raw':![],'where':{'phone':_0x24aecc[_0x2d73('0x2f')],'ListId':_0x24aecc['ListId']}}})[_0x2d73('0x5')](function(_0x59b4cf){if(_0x59b4cf){return _0x59b4cf;}return request(_0x2d73('0x30'),{'body':_0x24aecc});});};exports['getPauseById']=function(_0x59075b){return request(_0x2d73('0x31'),{'options':{'where':{'id':_0x59075b},'attributes':[_0x2d73('0xf')]}});};exports['agentLogin']=function(_0x5aa9ea,_0x1beaef){return request(_0x2d73('0x32'),{'body':{'interface':_0x1beaef},'options':{'where':_0x5aa9ea}});};exports[_0x2d73('0x33')]=function(_0x5955a8,_0x4a47d3,_0x425144){return request(_0x2d73('0x34'),{'body':{'type':_0x4a47d3,'uniqueid':_0x425144},'options':{'where':_0x5955a8}});};exports[_0x2d73('0x35')]=function(_0x4b22b6){return request('UnpauseUser',{'body':{},'options':{'where':_0x4b22b6}});};exports[_0x2d73('0x36')]=function(_0x5258d8){return request(_0x2d73('0x37'),{'body':{},'options':{'where':_0x5258d8}});}; \ No newline at end of file +var _0xa16d=['format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','CreateCmContact','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','util','jayson/promise','client','request','then','error','message','result','catch','getMailAccountById','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0xa16d,0xaa));var _0xda16=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xa16d[_0x599f41];return _0x2e4d58;};'use strict';var BPromise=require(_0xda16('0x0'));var moment=require(_0xda16('0x1'));var _=require('lodash');var util=require(_0xda16('0x2'));var jayson=require(_0xda16('0x3'));var client=jayson[_0xda16('0x4')]['http']({'port':0x2329});function request(_0x161c17,_0x1c8baa){return new BPromise(function(_0x25f885,_0x2df775){return client[_0xda16('0x5')](_0x161c17,_0x1c8baa)[_0xda16('0x6')](function(_0x2e8afd){if(_0x2e8afd[_0xda16('0x7')]){return _0x2df775(_0x2e8afd[_0xda16('0x7')][_0xda16('0x8')]);}else{return _0x25f885(_0x2e8afd[_0xda16('0x9')]);}})[_0xda16('0xa')](function(_0x25f4c8){return _0x2df775(_0x25f4c8);});});}exports['getSquareProject']=function(_0x3b13e9){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x3b13e9},'attributes':['production']}});};exports[_0xda16('0xb')]=function(_0x54cad1){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x54cad1},'include':[{'model':'MailServerOut','as':_0xda16('0xc')}],'attributes':['id',_0xda16('0xd'),_0xda16('0xe')]}});};exports[_0xda16('0xf')]=function(_0xae1a34){return request('ShowSquareProject',{'options':{'where':{'id':_0xae1a34},'attributes':[_0xda16('0xd')]}});};exports['getVoiceQueueById']=function(_0x15f20d){return request(_0xda16('0x10'),{'options':{'where':{'id':_0x15f20d},'attributes':['name']}});};exports['getVariableById']=function(_0xc2a30e){return request('ShowVariable',{'options':{'where':{'id':_0xc2a30e},'attributes':['name']}});};exports[_0xda16('0x11')]=function(_0x209d33){return request(_0xda16('0x12'),{'options':{'where':{'id':_0x209d33},'attributes':['dsn']}});};exports[_0xda16('0x13')]=function(_0x248ee9){return request(_0xda16('0x14'),{'options':{'where':{'id':_0x248ee9},'attributes':['name']}});};exports[_0xda16('0x15')]=function(_0x189bec){return request(_0xda16('0x16'),{'options':{'where':{'id':_0x189bec},'attributes':[_0xda16('0xd')]}});};exports[_0xda16('0x17')]=function(_0x1174eb){return request(_0xda16('0x18'),{'options':{'where':{'id':_0x1174eb},'attributes':[_0xda16('0x19')]}});};exports[_0xda16('0x1a')]=function(_0x52cab9){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x52cab9},'include':[{'model':'Interval','as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x2721c1){return request(_0xda16('0x1b'),{'options':{'where':{'id':_0x2721c1},'attributes':['id',_0xda16('0xd')]}});};exports['createSmsMessage']=function(_0x2ad82f){return request(_0xda16('0x1c'),{'body':_0x2ad82f});};exports['createSquareDetailsReport']=function(_0x90bb69){return request(_0xda16('0x1d'),{'body':_0x90bb69});};exports[_0xda16('0x1e')]=function(_0x840867){return request('CreateSquareReport',{'body':_[_0xda16('0x1f')](_0x840867,{'project_name':_0x840867[_0xda16('0x20')],'prev_project_name':_0x840867[_0xda16('0x21')]||'','is_subproject':_0x840867['arg_2']?!![]:![],'leaveAt':moment()[_0xda16('0x22')](_0xda16('0x23'))})});};exports[_0xda16('0x24')]=function(_0x439d95){return request(_0xda16('0x25'),{'body':_0x439d95});};exports[_0xda16('0x26')]=function(_0x38fb11){return request(_0xda16('0x27'),{'body':_0x38fb11});};exports[_0xda16('0x28')]=function(_0x52018d){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x52018d[_0xda16('0x29')],'ListId':_0x52018d[_0xda16('0x2a')]}}})[_0xda16('0x6')](function(_0x1d537f){if(_0x1d537f){return _0x1d537f;}return request(_0xda16('0x2b'),{'body':_0x52018d});});};exports['getPauseById']=function(_0x475351){return request('ShowPause',{'options':{'where':{'id':_0x475351},'attributes':[_0xda16('0xd')]}});};exports[_0xda16('0x2c')]=function(_0x4629cd,_0x1bff78){return request(_0xda16('0x2d'),{'body':{'interface':_0x1bff78},'options':{'where':_0x4629cd}});};exports[_0xda16('0x2e')]=function(_0x1e2e01,_0x291b4a,_0x5148f9){return request(_0xda16('0x2f'),{'body':{'type':_0x291b4a,'uniqueid':_0x5148f9},'options':{'where':_0x1e2e01}});};exports[_0xda16('0x30')]=function(_0x983222){return request('UnpauseUser',{'body':{},'options':{'where':_0x983222}});};exports[_0xda16('0x31')]=function(_0x5072c3){return request(_0xda16('0x32'),{'body':{},'options':{'where':_0x5072c3}});}; \ 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 aa0c88d..5eb10fc 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 _0x5178=['exports','./lex'];(function(_0x43db87,_0x2098a6){var _0x4e941e=function(_0x6aa543){while(--_0x6aa543){_0x43db87['push'](_0x43db87['shift']());}};_0x4e941e(++_0x2098a6);}(_0x5178,0x171));var _0x8517=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5178[_0x3bf83f];return _0x22c4a9;};var polly=require('./polly');var lex=require(_0x8517('0x0'));module[_0x8517('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x4b84=['./polly','./lex'];(function(_0x7ba1c3,_0x3dd545){var _0x82b393=function(_0x1550ce){while(--_0x1550ce){_0x7ba1c3['push'](_0x7ba1c3['shift']());}};_0x82b393(++_0x3dd545);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0x4b84[_0x1ebeea];return _0x576465;};var polly=require(_0x44b8('0x0'));var lex=require(_0x44b8('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 f0c499e..5ff2fc8 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 _0x2917=['./lib/api','exports'];(function(_0x1f0cd,_0x54c5cb){var _0x535f85=function(_0x3a278e){while(--_0x3a278e){_0x1f0cd['push'](_0x1f0cd['shift']());}};_0x535f85(++_0x54c5cb);}(_0x2917,0x142));var _0x7291=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x2917[_0x3e3bee];return _0x3ae14c;};'use strict';var lex=require(_0x7291('0x0'));module[_0x7291('0x1')]=function(_0x292b68,_0x105174,_0x37515c,_0x398f9f,_0x90e67,_0x535c15){return lex(_0x292b68,_0x105174,_0x37515c,_0x398f9f,_0x90e67,_0x535c15);}; \ No newline at end of file +var _0xa8a8=['./lib/api','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xa8a8,0xec));var _0x8a8a=function(_0x307e19,_0x4d90f){_0x307e19=_0x307e19-0x0;var _0x589721=_0xa8a8[_0x307e19];return _0x589721;};'use strict';var lex=require(_0x8a8a('0x0'));module[_0x8a8a('0x1')]=function(_0x1934ab,_0x2dd9b7,_0x5221bc,_0x2a2676,_0x3296a6,_0xf11a08){return lex(_0x1934ab,_0x2dd9b7,_0x5221bc,_0x2a2676,_0x3296a6,_0xf11a08);}; \ 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 659afc8..64ea7bc 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 _0x6ef6=['slots','slot_','exports','LexRuntime','$LATEST','bluebird','postText'];(function(_0x2e938d,_0x346e53){var _0x50d42d=function(_0x144326){while(--_0x144326){_0x2e938d['push'](_0x2e938d['shift']());}};_0x50d42d(++_0x346e53);}(_0x6ef6,0x14e));var _0x66ef=function(_0x419c4a,_0x5d525d){_0x419c4a=_0x419c4a-0x0;var _0x4dae37=_0x6ef6[_0x419c4a];return _0x4dae37;};'use strict';var BPromise=require(_0x66ef('0x0'));var AWS=require('aws-sdk');function lexResult(_0x2d1c2f,_0x4c1476){return new BPromise(function(_0x3561b5,_0x3c9002){_0x2d1c2f[_0x66ef('0x1')](_0x4c1476,function(_0x340bdb,_0x449923){if(_0x340bdb){_0x3c9002(_0x340bdb);}if(_0x449923[_0x66ef('0x2')]){for(const _0x29f243 in _0x449923[_0x66ef('0x2')]){if(_0x449923[_0x66ef('0x2')]['hasOwnProperty'](_0x29f243)){var _0xd9b9f4=_0x449923[_0x66ef('0x2')][_0x29f243];_0x449923[_0x66ef('0x3')+_0x29f243]=_0xd9b9f4;}}}_0x3561b5(_0x449923);});});}module[_0x66ef('0x4')]=function(_0x5b30a9,_0x13968b,_0x3acee2,_0x79dd85,_0xd3e348,_0x9fdf9){var _0x124040=new AWS[(_0x66ef('0x5'))]({'accessKeyId':_0x13968b,'secretAccessKey':_0x3acee2,'region':_0x79dd85});var _0x4bcdda={'botAlias':_0x66ef('0x6'),'botName':_0x9fdf9,'inputText':_0xd3e348,'userId':_0x5b30a9};return lexResult(_0x124040,_0x4bcdda);}; \ No newline at end of file +var _0x0894=['LexRuntime','$LATEST','bluebird','aws-sdk','postText','slots','slot_','exports'];(function(_0x1b4ccb,_0xb73298){var _0x15a0a7=function(_0x55b86a){while(--_0x55b86a){_0x1b4ccb['push'](_0x1b4ccb['shift']());}};_0x15a0a7(++_0xb73298);}(_0x0894,0x72));var _0x4089=function(_0x518161,_0x2e7baf){_0x518161=_0x518161-0x0;var _0x18169f=_0x0894[_0x518161];return _0x18169f;};'use strict';var BPromise=require(_0x4089('0x0'));var AWS=require(_0x4089('0x1'));function lexResult(_0x5f14a5,_0x2ab946){return new BPromise(function(_0x1ebb5d,_0x17ccbe){_0x5f14a5[_0x4089('0x2')](_0x2ab946,function(_0x333da0,_0x5454be){if(_0x333da0){_0x17ccbe(_0x333da0);}if(_0x5454be[_0x4089('0x3')]){for(const _0x2271bf in _0x5454be['slots']){if(_0x5454be[_0x4089('0x3')]['hasOwnProperty'](_0x2271bf)){var _0xc28746=_0x5454be['slots'][_0x2271bf];_0x5454be[_0x4089('0x4')+_0x2271bf]=_0xc28746;}}}_0x1ebb5d(_0x5454be);});});}module[_0x4089('0x5')]=function(_0x541a9c,_0x2f7c22,_0x25f533,_0x1b43de,_0x26dd7c,_0x3beb3c){var _0x1ede7d=new AWS[(_0x4089('0x6'))]({'accessKeyId':_0x2f7c22,'secretAccessKey':_0x25f533,'region':_0x1b43de});var _0x3c8a22={'botAlias':_0x4089('0x7'),'botName':_0x3beb3c,'inputText':_0x26dd7c,'userId':_0x541a9c};return lexResult(_0x1ede7d,_0x3c8a22);}; \ 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 99b92dd..5ac2e80 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 _0x61b9=['./lib/api','exports'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x61b9,0xe0));var _0x961b=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0x61b9[_0x2678d6];return _0x475503;};'use strict';var polly=require(_0x961b('0x0'));module[_0x961b('0x1')]=function(_0x34ce2d,_0x185f4d,_0x128249,_0x3c28c0,_0x365223,_0x50c4c9,_0x4f33e0){return polly(_0x34ce2d,_0x185f4d,_0x128249,_0x3c28c0,_0x365223,_0x50c4c9,_0x4f33e0);}; \ No newline at end of file +'use strict';var polly=require('./lib/api');module['exports']=function(_0x149e86,_0x3dfeef,_0xbbe852,_0x3673c7,_0x319eba,_0x4c603c,_0x37d8af){return polly(_0x149e86,_0x3dfeef,_0xbbe852,_0x3673c7,_0x319eba,_0x4c603c,_0x37d8af);}; \ 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 0131870..0ff2835 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 _0xa12c=['text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xa12c,0x84));var _0xca12=function(_0x1ef901,_0x3e39e3){_0x1ef901=_0x1ef901-0x0;var _0x333d2b=_0xa12c[_0x1ef901];return _0x333d2b;};'use strict';var fs=require('fs');var path=require(_0xca12('0x0'));var BPromise=require(_0xca12('0x1'));var rs=require(_0xca12('0x2'));var AWS=require(_0xca12('0x3'));function pollyResult(_0x2c0fc9,_0x524053,_0x5b5bd6){return new BPromise(function(_0x17c517,_0x1d371f){_0x2c0fc9[_0xca12('0x4')](_0x524053,function(_0x44e530,_0x287886){if(_0x44e530){_0x1d371f(_0x44e530);}else if(_0x287886){if(_0x287886[_0xca12('0x5')]instanceof Buffer){fs[_0xca12('0x6')](_0x5b5bd6,_0x287886[_0xca12('0x5')],function(_0x38b73d){if(_0x38b73d){_0x1d371f(_0x38b73d);}else{_0x17c517();}});}else{_0x1d371f(new Error(_0xca12('0x7')));}}else{_0x1d371f(new Error(_0xca12('0x8')));}});});}module[_0xca12('0x9')]=function(_0x129b77,_0x3f116b,_0x11d9ca,_0x5d5ea1,_0x3ed4b7,_0x41438a,_0x72122f){var _0x1435fc=new AWS[(_0xca12('0xa'))]({'accessKeyId':_0x129b77,'secretAccessKey':_0x3f116b,'region':_0x11d9ca});var _0x5ac9cb={'Text':_0x3ed4b7,'TextType':_0x41438a||_0xca12('0xb'),'OutputFormat':_0xca12('0xc'),'VoiceId':_0x5d5ea1};return pollyResult(_0x1435fc,_0x5ac9cb,_0x72122f);}; \ No newline at end of file +var _0x2202=['Polly','text','path','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x35cb03,_0x578e9d){var _0x696377=function(_0x318fa3){while(--_0x318fa3){_0x35cb03['push'](_0x35cb03['shift']());}};_0x696377(++_0x578e9d);}(_0x2202,0x1e2));var _0x2220=function(_0x506596,_0x4267e0){_0x506596=_0x506596-0x0;var _0xe29932=_0x2202[_0x506596];return _0xe29932;};'use strict';var fs=require('fs');var path=require(_0x2220('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x27c25a,_0x5cc4a8,_0x4584c1){return new BPromise(function(_0x46441f,_0x590bcb){_0x27c25a[_0x2220('0x1')](_0x5cc4a8,function(_0x417343,_0x48c1ab){if(_0x417343){_0x590bcb(_0x417343);}else if(_0x48c1ab){if(_0x48c1ab[_0x2220('0x2')]instanceof Buffer){fs[_0x2220('0x3')](_0x4584c1,_0x48c1ab['AudioStream'],function(_0x3d3d02){if(_0x3d3d02){_0x590bcb(_0x3d3d02);}else{_0x46441f();}});}else{_0x590bcb(new Error(_0x2220('0x4')));}}else{_0x590bcb(new Error(_0x2220('0x5')));}});});}module['exports']=function(_0x3db94b,_0x40e6bc,_0x4e1846,_0x13b41b,_0x355b71,_0x32e2b7,_0x215168){var _0x2183d0=new AWS[(_0x2220('0x6'))]({'accessKeyId':_0x3db94b,'secretAccessKey':_0x40e6bc,'region':_0x4e1846});var _0x247542={'Text':_0x355b71,'TextType':_0x32e2b7||_0x2220('0x7'),'OutputFormat':'mp3','VoiceId':_0x13b41b};return pollyResult(_0x2183d0,_0x247542,_0x215168);}; \ 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 9849f31..2a3e5a4 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 _0xd253=['./lib/api'];(function(_0x2136d5,_0x4b0479){var _0x3bee2e=function(_0x119e88){while(--_0x119e88){_0x2136d5['push'](_0x2136d5['shift']());}};_0x3bee2e(++_0x4b0479);}(_0xd253,0x125));var _0x3d25=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xd253[_0x1cfa0d];return _0xe33279;};'use strict';var asr=require(_0x3d25('0x0'));module['exports']=function(_0x3bff39,_0x37c7de,_0x2f1f66,_0x1b91e0){return asr(_0x3bff39,_0x37c7de,_0x2f1f66);}; \ No newline at end of file +var _0x2a38=['exports'];(function(_0x52c558,_0x47ce58){var _0x19c919=function(_0xc65fc4){while(--_0xc65fc4){_0x52c558['push'](_0x52c558['shift']());}};_0x19c919(++_0x47ce58);}(_0x2a38,0xe4));var _0x82a3=function(_0x44e855,_0x3c6402){_0x44e855=_0x44e855-0x0;var _0x48e240=_0x2a38[_0x44e855];return _0x48e240;};'use strict';var asr=require('./lib/api');module[_0x82a3('0x0')]=function(_0x31d888,_0x34fb1a,_0x477316,_0x32ef24){return asr(_0x31d888,_0x34fb1a,_0x477316);}; \ 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 dcca213..87eb27d 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 _0x7905=['base64','/v1/speech:recognize?key=','LINEAR16','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x594e99,_0x3ffa2e){var _0x5d1c27=function(_0x518766){while(--_0x518766){_0x594e99['push'](_0x594e99['shift']());}};_0x5d1c27(++_0x3ffa2e);}(_0x7905,0x1e4));var _0x5790=function(_0x5dad7b,_0x2e6b5d){_0x5dad7b=_0x5dad7b-0x0;var _0x52297c=_0x7905[_0x5dad7b];return _0x52297c;};'use strict';var url=require('url');var BPromise=require(_0x5790('0x0'));var fs=require('fs');var host=_0x5790('0x1');module[_0x5790('0x2')]=function(_0x532546,_0x22b643,_0x165d42){return new BPromise(function(_0x36cf95,_0x3bbfaa){var _0x2bad45;if(typeof _0x532546!==_0x5790('0x3')||_0x532546[_0x5790('0x4')]===0x0){return _0x3bbfaa(_0x5790('0x5'));}if(typeof _0x22b643!==_0x5790('0x3')||_0x22b643['length']===0x0){return _0x3bbfaa(_0x5790('0x6'));}if(typeof _0x165d42!==_0x5790('0x7')&&(typeof _0x165d42!==_0x5790('0x3')||_0x165d42[_0x5790('0x4')]===0x0)){return _0x3bbfaa(_0x5790('0x8'));}try{_0x2bad45=fs[_0x5790('0x9')](_0x532546)['toString'](_0x5790('0xa'));}catch(_0x5122a4){return _0x3bbfaa(_0x5122a4);}return _0x36cf95({'method':'POST','uri':host+_0x5790('0xb')+_0x22b643,'body':{'config':{'encoding':_0x5790('0xc'),'sampleRateHertz':'8000','languageCode':_0x165d42},'audio':{'content':_0x2bad45}},'json':!![]});});}; \ No newline at end of file +var _0xaf2e=['url','bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','length','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xaf2e,0x14a));var _0xeaf2=function(_0x13107a,_0x46ea09){_0x13107a=_0x13107a-0x0;var _0x13cc3e=_0xaf2e[_0x13107a];return _0x13cc3e;};'use strict';var url=require(_0xeaf2('0x0'));var BPromise=require(_0xeaf2('0x1'));var fs=require('fs');var host=_0xeaf2('0x2');module[_0xeaf2('0x3')]=function(_0x25645d,_0x45bc23,_0x1c4112){return new BPromise(function(_0x304c08,_0x45ef5e){var _0x5b62e7;if(typeof _0x25645d!==_0xeaf2('0x4')||_0x25645d['length']===0x0){return _0x45ef5e(_0xeaf2('0x5'));}if(typeof _0x45bc23!=='string'||_0x45bc23['length']===0x0){return _0x45ef5e('key\x20should\x20be\x20a\x20string');}if(typeof _0x1c4112!=='undefined'&&(typeof _0x1c4112!==_0xeaf2('0x4')||_0x1c4112[_0xeaf2('0x6')]===0x0)){return _0x45ef5e(_0xeaf2('0x7'));}try{_0x5b62e7=fs[_0xeaf2('0x8')](_0x25645d)[_0xeaf2('0x9')](_0xeaf2('0xa'));}catch(_0x2f20a6){return _0x45ef5e(_0x2f20a6);}return _0x304c08({'method':_0xeaf2('0xb'),'uri':host+_0xeaf2('0xc')+_0x45bc23,'body':{'config':{'encoding':_0xeaf2('0xd'),'sampleRateHertz':_0xeaf2('0xe'),'languageCode':_0x1c4112},'audio':{'content':_0x5b62e7}},'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 0f944e3..56ee3e4 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 _0x4991=['./asr'];(function(_0x1fe33c,_0x282321){var _0x383fa2=function(_0x1dafa9){while(--_0x1dafa9){_0x1fe33c['push'](_0x1fe33c['shift']());}};_0x383fa2(++_0x282321);}(_0x4991,0xf7));var _0x1499=function(_0xd80bdb,_0x4c0946){_0xd80bdb=_0xd80bdb-0x0;var _0x44a07b=_0x4991[_0xd80bdb];return _0x44a07b;};var asr=require(_0x1499('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x4458=['./asr','exports'];(function(_0x4797b0,_0x37ab30){var _0x257cf4=function(_0x3c9356){while(--_0x3c9356){_0x4797b0['push'](_0x4797b0['shift']());}};_0x257cf4(++_0x37ab30);}(_0x4458,0xe6));var _0x8445=function(_0x5541fa,_0x1ee96c){_0x5541fa=_0x5541fa-0x0;var _0x2c81d1=_0x4458[_0x5541fa];return _0x2c81d1;};var asr=require(_0x8445('0x0'));module[_0x8445('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 58dcbad..5949fbd 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 _0x27c9=['catch','[%s]\x20%s:%s','name','message','googleDialogflow','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','status','metadata','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','stringify','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','path','http','https','parse','bluebird','randomstring','sox','request-promise','util','querystring','google-tts-api','apiai-promise','./google','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','asr','map','alternatives','transcript','join','results','confidence','googleASR\x20confidence'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x27c9,0x1e7));var _0x927c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x27c9[_0x465028];return _0xb783d4;};'use strict';var fs=require('fs');var path=require(_0x927c('0x0'));var http=require(_0x927c('0x1'));var https=require(_0x927c('0x2'));var urlParse=require('url')[_0x927c('0x3')];var BPromise=require(_0x927c('0x4'));var rs=require(_0x927c('0x5'));var sox=require(_0x927c('0x6'));var rp=require(_0x927c('0x7'));var util=require(_0x927c('0x8'));var querystring=require(_0x927c('0x9'));var tts=require(_0x927c('0xa'));var apiai=require(_0x927c('0xb'));var md5=require('md5');var google=require(_0x927c('0xc'));var aws=require(_0x927c('0xd'));var tilde=require(_0x927c('0xe'));var sestek=require(_0x927c('0xf'));var logger=require(_0x927c('0x10'))(_0x927c('0x11'));var ISPEECH_API=_0x927c('0x12');function downloadFile(_0x53608a,_0x1bbf19){return new BPromise(function(_0x413876,_0x29839f){var _0x37be84=urlParse(_0x53608a);var _0x7a4fbd=_0x37be84[_0x927c('0x13')]===_0x927c('0x14')?https:http;var _0x24b575={'host':_0x37be84[_0x927c('0x15')],'path':_0x37be84[_0x927c('0x0')],'headers':{'user-agent':_0x927c('0x16')}};_0x7a4fbd[_0x927c('0x17')](_0x24b575,function(_0x2bb0ae){if(_0x2bb0ae[_0x927c('0x18')]!==0xc8){logger[_0x927c('0x19')](_0x927c('0x1a')+_0x53608a+_0x927c('0x1b')+_0x2bb0ae[_0x927c('0x18')]+'\x20('+_0x2bb0ae[_0x927c('0x1c')]+')');_0x29839f(new Error(_0x927c('0x1a')+_0x53608a+_0x927c('0x1b')+_0x2bb0ae[_0x927c('0x18')]+'\x20('+_0x2bb0ae['statusMessage']+')'));return;}var _0x4e60b6=fs[_0x927c('0x1d')](_0x1bbf19);_0x4e60b6['on'](_0x927c('0x1e'),function(){logger['info'](_0x927c('0x1f'));_0x4e60b6[_0x927c('0x20')](_0x413876);});_0x4e60b6['on'](_0x927c('0x19'),function(_0x2b9008){fs[_0x927c('0x21')](_0x1bbf19);logger[_0x927c('0x19')](_0x927c('0x22'),_0x2b9008);_0x29839f(_0x2b9008);});_0x2bb0ae[_0x927c('0x23')](_0x4e60b6);})['on'](_0x927c('0x19'),function(_0x5a46d4){logger[_0x927c('0x19')](_0x5a46d4);_0x29839f(_0x5a46d4);})[_0x927c('0x24')]();});}function uploadFile(_0x574405){return new BPromise(function(_0x450f0b,_0xeac4c9){var _0x57c762=urlParse(_0x574405);var _0x451f05=_0x57c762[_0x927c('0x13')]===_0x927c('0x14')?https:http;var _0x2e56a9={'host':_0x57c762['host'],'path':_0x57c762[_0x927c('0x0')],'headers':{'user-agent':_0x927c('0x16')}};_0x451f05[_0x927c('0x17')](_0x2e56a9,function(_0x13bdde){if(_0x13bdde[_0x927c('0x18')]!==0xc8){_0xeac4c9(new Error('request\x20to\x20'+_0x574405+_0x927c('0x1b')+_0x13bdde[_0x927c('0x18')]+'\x20('+_0x13bdde[_0x927c('0x1c')]+')'));return;}var _0x35f9ba='';_0x13bdde['on'](_0x927c('0x25'),function(_0xde7048){_0x35f9ba+=_0xde7048;});_0x13bdde['on'](_0x927c('0x24'),function(){_0x450f0b(_0x35f9ba);});})['on'](_0x927c('0x19'),function(_0x3e89a9){_0xeac4c9(_0x3e89a9);})['end']();});}function convertFile(_0x5dd7be,_0x32670f){return new BPromise(function(_0x10b11b,_0x5bb058){var _0x37eac7=sox['transcode'](_0x5dd7be,_0x32670f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x37eac7['on'](_0x927c('0x19'),function(_0x524a90){logger[_0x927c('0x19')](_0x927c('0x26'),_0x524a90);_0x5bb058(_0x524a90);});_0x37eac7['on']('end',function(){logger[_0x927c('0x27')](_0x927c('0x28'));_0x10b11b();});_0x37eac7[_0x927c('0x29')]();});}function base64Decode(_0x367d94,_0x15985b){var _0x1e4c13=path[_0x927c('0x2a')](__dirname,_0x927c('0x2b'),rs[_0x927c('0x2c')](0x4)+_0x927c('0x2d'));fs[_0x927c('0x2e')](_0x1e4c13,_0x367d94,_0x927c('0x2f'));return convertFile(_0x1e4c13,_0x15985b)[_0x927c('0x30')](function(){try{fs[_0x927c('0x21')](_0x1e4c13);fs[_0x927c('0x31')](_0x15985b,_0x927c('0x32'));}catch(_0x42b005){logger[_0x927c('0x19')](_0x42b005);}return _0x15985b[_0x927c('0x33')]('.')[0x0];});}function base64Encode(_0x38ae98){var _0x463d58=fs[_0x927c('0x34')](_0x38ae98);return new Buffer(_0x463d58)[_0x927c('0x35')](_0x927c('0x2f'));}exports['googleCloudTTS']=function(_0x17f0cb,_0x5cc176,_0x230d6d,_0x413d64,_0x408183,_0x49eb28){var _0x44510c,_0x253839;var _0x2c9bc9=_0x927c('0x36');var _0x47929=_0x927c('0x37')+_0x17f0cb;var _0x13b3a3={};if(_0x5cc176===_0x927c('0x38')){_0x13b3a3[_0x927c('0x39')]={'ssml':_0x230d6d};}else{_0x13b3a3[_0x927c('0x39')]={'text':_0x230d6d};};_0x13b3a3[_0x927c('0x3a')]={'languageCode':_0x413d64,'ssmlGender':_0x408183};_0x13b3a3[_0x927c('0x3b')]={'audioEncoding':_0x927c('0x3c'),'sampleRateHertz':0x1f40};var _0x3d9440={'url':_0x2c9bc9+'text:synthesize'+_0x47929,'method':_0x927c('0x3d'),'json':!![],'body':_0x13b3a3};return rp(_0x3d9440)[_0x927c('0x30')](function(_0x234cfc){return new BPromise(function(_0x3c5655,_0xbef4a3){_0x44510c=path[_0x927c('0x2a')](__dirname,_0x927c('0x2b'),rs[_0x927c('0x2c')](0x4)+_0x927c('0x3e'));var _0x36bf63=Buffer[_0x927c('0x3f')](_0x234cfc[_0x927c('0x40')],_0x927c('0x2f'));return fs[_0x927c('0x41')](_0x44510c,_0x36bf63,function(_0x4341fd){_0xbef4a3(_0x4341fd);},function(_0x2c36c6){fs[_0x927c('0x31')](_0x44510c,'777');_0x3c5655(_0x2c36c6);});});})[_0x927c('0x30')](function(_0x2014c6){_0x253839=path[_0x927c('0x2a')](__dirname,_0x927c('0x2b'),rs[_0x927c('0x2c')](0x4)+'.wav');return convertFile(_0x44510c,_0x253839);})['then'](function(){try{fs[_0x927c('0x21')](_0x44510c);fs['chmodSync'](_0x253839,'777');}catch(_0x179b8d){logger[_0x927c('0x19')](_0x179b8d);}logger['info'](_0x927c('0x42'),_0x253839[_0x927c('0x33')]('.')[0x0]);return _0x253839[_0x927c('0x33')]('.')[0x0];});};exports[_0x927c('0x43')]=function(_0x5c9c4b,_0x1e2e5f){var _0x5db3ed,_0xef7c01;return tts(_0x5c9c4b,_0x1e2e5f||'en',0x1)['then'](function(_0x3692d1){logger['info'](_0x3692d1);_0x5db3ed=path[_0x927c('0x2a')](__dirname,_0x927c('0x2b'),rs['generate'](0x4)+_0x927c('0x3e'));return downloadFile(_0x3692d1,_0x5db3ed);})[_0x927c('0x30')](function(){_0xef7c01=path['resolve'](__dirname,'tmp',rs[_0x927c('0x2c')](0x4)+_0x927c('0x2d'));return convertFile(_0x5db3ed,_0xef7c01);})[_0x927c('0x30')](function(){try{fs[_0x927c('0x21')](_0x5db3ed);fs[_0x927c('0x31')](_0xef7c01,_0x927c('0x32'));}catch(_0x37efbe){logger[_0x927c('0x19')](_0x37efbe);}logger[_0x927c('0x27')](_0x927c('0x44'),_0xef7c01[_0x927c('0x33')]('.')[0x0]);return _0xef7c01['split']('.')[0x0];});};exports[_0x927c('0x45')]=function(_0x38b0df,_0xd72e77,_0x14250b){return google[_0x927c('0x46')](_0x38b0df,_0xd72e77,_0x14250b)['then'](function(_0x49c89b){logger[_0x927c('0x27')](_0x49c89b['uri']);return rp(_0x49c89b);})[_0x927c('0x30')](function(_0x506def){var _0x33cd84='';var _0x972d81=0x0;try{fs[_0x927c('0x21')](_0x38b0df);}catch(_0x514af3){logger[_0x927c('0x19')](_0x514af3);}if(_0x506def&&_0x506def['results']){_0x33cd84=_0x506def['results'][_0x927c('0x47')](function(_0x1d2144){return _0x1d2144&&_0x1d2144['alternatives'][0x0]&&_0x1d2144[_0x927c('0x48')][0x0][_0x927c('0x49')]?_0x1d2144['alternatives'][0x0][_0x927c('0x49')]:'';})[_0x927c('0x4a')]('\x0a');_0x972d81=_0x506def[_0x927c('0x4b')][_0x927c('0x47')](function(_0xc40a0c){return _0xc40a0c&&_0xc40a0c[_0x927c('0x48')][0x0]&&_0xc40a0c['alternatives'][0x0][_0x927c('0x4c')]?_0xc40a0c[_0x927c('0x48')][0x0][_0x927c('0x4c')]:0x0;})[_0x927c('0x4a')]('\x0a');}logger[_0x927c('0x27')]('googleASR\x20transcription',_0x33cd84);logger[_0x927c('0x27')](_0x927c('0x4d'),_0x972d81);return{'transcript':_0x33cd84,'confidence':_0x972d81};})[_0x927c('0x4e')](function(_0x437b71){logger['error'](_0x927c('0x4f'),_0x437b71[_0x927c('0x18')],_0x437b71[_0x927c('0x50')],_0x437b71[_0x927c('0x51')]);});};exports[_0x927c('0x52')]=function(_0x45535a,_0x51471d,_0x2ddc07,_0x2621ba){var _0x22578e=apiai(_0x51471d,{'language':_0x2621ba||'en'});return _0x22578e['textRequest'](_0x2ddc07,{'sessionId':md5(_0x45535a)})[_0x927c('0x30')](function(_0x203893){logger[_0x927c('0x27')](JSON['stringify'](_0x203893));return{'source':_0x203893[_0x927c('0x53')][_0x927c('0x54')],'resolvedQuery':_0x203893['result'][_0x927c('0x55')],'action':_0x203893[_0x927c('0x53')][_0x927c('0x56')],'actionIncomplete':_0x203893['result'][_0x927c('0x57')],'speech':_0x203893[_0x927c('0x53')][_0x927c('0x58')][_0x927c('0x59')],'score':_0x203893[_0x927c('0x53')]['score'],'statusCode':_0x203893[_0x927c('0x5a')]['code'],'endConversation':_0x203893[_0x927c('0x53')][_0x927c('0x5b')][_0x927c('0x5c')]||![],'isFallbackIntent':_0x203893['result'][_0x927c('0x5b')][_0x927c('0x5d')]};});};exports[_0x927c('0x5e')]=function(_0x14bf54,_0x11bcde,_0xa82a9b,_0x306460){return tilde[_0x927c('0x46')](_0x14bf54,_0x11bcde,_0xa82a9b,_0x306460)[_0x927c('0x30')](function(_0x3fe387){try{fs[_0x927c('0x21')](_0x14bf54);}catch(_0x151c9f){logger['error'](_0x151c9f);}logger[_0x927c('0x27')](_0x927c('0x5f'),_0x3fe387[_0x927c('0x49')]);logger[_0x927c('0x27')](_0x927c('0x60'),_0x3fe387[_0x927c('0x4c')]);return _0x3fe387;});};exports[_0x927c('0x61')]=function(_0x50d51e,_0x15b3cb,_0x39226a,_0x3536ce,_0x40f464,_0x5eeea0){var _0xfb9399=path[_0x927c('0x2a')](__dirname,_0x927c('0x2b'),rs['generate'](0x4)+_0x927c('0x3e'));var _0x4a113d;return aws[_0x927c('0x62')](_0x50d51e,_0x15b3cb,_0x39226a,_0x3536ce,_0x40f464,_0x5eeea0,_0xfb9399)['then'](function(){_0x4a113d=path['resolve'](__dirname,'tmp',rs[_0x927c('0x2c')](0x4)+_0x927c('0x2d'));return convertFile(_0xfb9399,_0x4a113d);})[_0x927c('0x30')](function(){try{fs[_0x927c('0x21')](_0xfb9399);fs[_0x927c('0x31')](_0x4a113d,_0x927c('0x32'));}catch(_0x4a3b1c){logger[_0x927c('0x19')](_0x4a3b1c);}return _0x4a113d[_0x927c('0x33')]('.')[0x0];});};exports[_0x927c('0x63')]=function(_0xacf376,_0x5d080b,_0x53f052,_0x89590a,_0x26ec8b,_0x15c7b6){return aws['lex'](_0xacf376,_0x5d080b,_0x53f052,_0x89590a,_0x26ec8b,_0x15c7b6)[_0x927c('0x30')](function(_0x1eb11d){logger['info'](JSON[_0x927c('0x64')](_0x1eb11d));return _0x1eb11d;});};exports[_0x927c('0x65')]=function(_0x47cd8e,_0x5e8583,_0x5379a0,_0x3e1065){var _0x198ebd=util[_0x927c('0x66')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x47cd8e,encodeURIComponent(_0x5e8583),_0x5379a0,_0x3e1065);var _0xb150c=path[_0x927c('0x2a')](__dirname,_0x927c('0x2b'),rs['generate'](0x4)+_0x927c('0x3e'));var _0x11a6aa;return downloadFile(_0x198ebd,_0xb150c)['then'](function(){_0x11a6aa=path[_0x927c('0x2a')](__dirname,_0x927c('0x2b'),rs[_0x927c('0x2c')](0x4)+_0x927c('0x2d'));return convertFile(_0xb150c,_0x11a6aa);})[_0x927c('0x30')](function(){try{fs[_0x927c('0x21')](_0xb150c);fs[_0x927c('0x31')](_0x11a6aa,_0x927c('0x32'));}catch(_0x38d0da){logger[_0x927c('0x19')](_0x38d0da);}return _0x11a6aa[_0x927c('0x33')]('.')[0x0];});};exports[_0x927c('0x67')]=function(_0x260d79,_0x1cd07a,_0x5a12b3,_0x1f4c33){var _0x493269=util[_0x927c('0x66')](_0x927c('0x68'),ISPEECH_API,_0x1cd07a,_0x5a12b3,base64Encode(_0x260d79),_0x1f4c33?util['format'](_0x927c('0x69'),encodeURIComponent(_0x1f4c33)):_0x927c('0x6a'));return uploadFile(_0x493269)[_0x927c('0x30')](function(_0x3c3b8){return querystring['parse'](_0x3c3b8);});};exports['sestekNDA']=function(_0x42ffa6,_0x24e3cb){return sestek['nda'](_0x42ffa6,_0x24e3cb)[_0x927c('0x30')](function(_0x2beab6){logger['info'](JSON[_0x927c('0x64')](_0x2beab6));var _0x4665f8={'speech':_0x2beab6[_0x927c('0x6b')],'action':_0x2beab6[_0x927c('0x6c')]?_0x2beab6[_0x927c('0x6c')][_0x927c('0x6d')]:undefined,'actiondata':_0x2beab6[_0x927c('0x6c')]?_0x2beab6[_0x927c('0x6c')][_0x927c('0x6e')]:undefined};if(_0x2beab6[_0x927c('0x6c')]&&_0x2beab6[_0x927c('0x6c')][_0x927c('0x6f')]){return base64Decode(_0x2beab6['channelData'][_0x927c('0x6f')][_0x927c('0x70')],path[_0x927c('0x2a')](__dirname,_0x927c('0x2b'),rs[_0x927c('0x2c')](0x4)+_0x927c('0x2d')))[_0x927c('0x30')](function(_0x188f82){_0x4665f8['audiofile']=_0x188f82;return _0x4665f8;});}return _0x4665f8;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x633b=['chmodSync','777','split','readFileSync','?key=','ssml','input','audioConfig','text:synthesize','POST','then','.mp3','audioContent','info','googleCloudTTS\x20path','googleTTS','.wav','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20confidence','[%s]\x20%s:%s','message','googleDialogflow','stringify','source','resolvedQuery','result','action','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','path','http','https','url','parse','bluebird','randomstring','request-promise','util','querystring','md5','./google','./aws','./tilde','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','close','unlink','download\x20error','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','base64'];(function(_0x9206ca,_0x4db008){var _0x343e9b=function(_0x54e51d){while(--_0x54e51d){_0x9206ca['push'](_0x9206ca['shift']());}};_0x343e9b(++_0x4db008);}(_0x633b,0x175));var _0xb633=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x633b[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require(_0xb633('0x0'));var http=require(_0xb633('0x1'));var https=require(_0xb633('0x2'));var urlParse=require(_0xb633('0x3'))[_0xb633('0x4')];var BPromise=require(_0xb633('0x5'));var rs=require(_0xb633('0x6'));var sox=require('sox');var rp=require(_0xb633('0x7'));var util=require(_0xb633('0x8'));var querystring=require(_0xb633('0x9'));var tts=require('google-tts-api');var apiai=require('apiai-promise');var md5=require(_0xb633('0xa'));var google=require(_0xb633('0xb'));var aws=require(_0xb633('0xc'));var tilde=require(_0xb633('0xd'));var sestek=require(_0xb633('0xe'));var logger=require(_0xb633('0xf'))(_0xb633('0x10'));var ISPEECH_API=_0xb633('0x11');function downloadFile(_0x22468d,_0xc9503c){return new BPromise(function(_0x36b436,_0xac298a){var _0x2d7b8f=urlParse(_0x22468d);var _0x121d22=_0x2d7b8f[_0xb633('0x12')]===_0xb633('0x13')?https:http;var _0x2fc224={'host':_0x2d7b8f[_0xb633('0x14')],'path':_0x2d7b8f[_0xb633('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x121d22[_0xb633('0x15')](_0x2fc224,function(_0x1575fc){if(_0x1575fc[_0xb633('0x16')]!==0xc8){logger[_0xb633('0x17')](_0xb633('0x18')+_0x22468d+'\x20failed,\x20status\x20code\x20=\x20'+_0x1575fc['statusCode']+'\x20('+_0x1575fc['statusMessage']+')');_0xac298a(new Error('request\x20to\x20'+_0x22468d+_0xb633('0x19')+_0x1575fc[_0xb633('0x16')]+'\x20('+_0x1575fc[_0xb633('0x1a')]+')'));return;}var _0x5bd577=fs[_0xb633('0x1b')](_0xc9503c);_0x5bd577['on'](_0xb633('0x1c'),function(){logger['info']('finish\x20download\x20file');_0x5bd577[_0xb633('0x1d')](_0x36b436);});_0x5bd577['on'](_0xb633('0x17'),function(_0x26295a){fs[_0xb633('0x1e')](_0xc9503c);logger['error'](_0xb633('0x1f'),_0x26295a);_0xac298a(_0x26295a);});_0x1575fc['pipe'](_0x5bd577);})['on'](_0xb633('0x17'),function(_0x5e6ab8){logger[_0xb633('0x17')](_0x5e6ab8);_0xac298a(_0x5e6ab8);})[_0xb633('0x20')]();});}function uploadFile(_0x3b0f3c){return new BPromise(function(_0xbdbfdf,_0x30bafc){var _0x2a5085=urlParse(_0x3b0f3c);var _0x17f6df=_0x2a5085[_0xb633('0x12')]===_0xb633('0x13')?https:http;var _0x319930={'host':_0x2a5085[_0xb633('0x14')],'path':_0x2a5085[_0xb633('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x17f6df[_0xb633('0x15')](_0x319930,function(_0x18967b){if(_0x18967b[_0xb633('0x16')]!==0xc8){_0x30bafc(new Error(_0xb633('0x18')+_0x3b0f3c+_0xb633('0x19')+_0x18967b[_0xb633('0x16')]+'\x20('+_0x18967b[_0xb633('0x1a')]+')'));return;}var _0x4923c4='';_0x18967b['on'](_0xb633('0x21'),function(_0x24758f){_0x4923c4+=_0x24758f;});_0x18967b['on']('end',function(){_0xbdbfdf(_0x4923c4);});})['on'](_0xb633('0x17'),function(_0x45b6b1){_0x30bafc(_0x45b6b1);})['end']();});}function convertFile(_0x4c9c54,_0x33d7c8){return new BPromise(function(_0x234c03,_0x4ef367){var _0x1af1b6=sox[_0xb633('0x22')](_0x4c9c54,_0x33d7c8,{'sampleRate':0x1f40,'format':_0xb633('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1af1b6['on'](_0xb633('0x17'),function(_0x1f2e32){logger[_0xb633('0x17')](_0xb633('0x24'),_0x1f2e32);_0x4ef367(_0x1f2e32);});_0x1af1b6['on'](_0xb633('0x20'),function(){logger['info'](_0xb633('0x25'));_0x234c03();});_0x1af1b6[_0xb633('0x26')]();});}function base64Decode(_0x56b96b,_0x994a6a){var _0xf708f6=path[_0xb633('0x27')](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+'.wav');fs['writeFileSync'](_0xf708f6,_0x56b96b,_0xb633('0x2a'));return convertFile(_0xf708f6,_0x994a6a)['then'](function(){try{fs[_0xb633('0x1e')](_0xf708f6);fs[_0xb633('0x2b')](_0x994a6a,_0xb633('0x2c'));}catch(_0x5c324e){logger['error'](_0x5c324e);}return _0x994a6a[_0xb633('0x2d')]('.')[0x0];});}function base64Encode(_0x2495a6){var _0x277d00=fs[_0xb633('0x2e')](_0x2495a6);return new Buffer(_0x277d00)['toString'](_0xb633('0x2a'));}exports['googleCloudTTS']=function(_0x4aed5c,_0x5ca885,_0x5e3df7,_0xc7e424,_0x50af49,_0x2ea748){var _0x34293d,_0x5f0e2e;var _0x134a8b='https://texttospeech.googleapis.com/v1/';var _0x10aff4=_0xb633('0x2f')+_0x4aed5c;var _0x56a4d5={};if(_0x5ca885===_0xb633('0x30')){_0x56a4d5['input']={'ssml':_0x5e3df7};}else{_0x56a4d5[_0xb633('0x31')]={'text':_0x5e3df7};};_0x56a4d5['voice']={'languageCode':_0xc7e424,'ssmlGender':_0x50af49};_0x56a4d5[_0xb633('0x32')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x25e1af={'url':_0x134a8b+_0xb633('0x33')+_0x10aff4,'method':_0xb633('0x34'),'json':!![],'body':_0x56a4d5};return rp(_0x25e1af)[_0xb633('0x35')](function(_0x4456b4){return new BPromise(function(_0x1b7181,_0x284aff){_0x34293d=path['resolve'](__dirname,'tmp',rs[_0xb633('0x29')](0x4)+_0xb633('0x36'));var _0x94ddd9=Buffer['from'](_0x4456b4[_0xb633('0x37')],_0xb633('0x2a'));return fs['writeFile'](_0x34293d,_0x94ddd9,function(_0x46ea4d){_0x284aff(_0x46ea4d);},function(_0x54b4fd){fs[_0xb633('0x2b')](_0x34293d,_0xb633('0x2c'));_0x1b7181(_0x54b4fd);});});})[_0xb633('0x35')](function(_0x580503){_0x5f0e2e=path[_0xb633('0x27')](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+'.wav');return convertFile(_0x34293d,_0x5f0e2e);})['then'](function(){try{fs['unlink'](_0x34293d);fs[_0xb633('0x2b')](_0x5f0e2e,_0xb633('0x2c'));}catch(_0x91985b){logger['error'](_0x91985b);}logger[_0xb633('0x38')](_0xb633('0x39'),_0x5f0e2e[_0xb633('0x2d')]('.')[0x0]);return _0x5f0e2e[_0xb633('0x2d')]('.')[0x0];});};exports[_0xb633('0x3a')]=function(_0x310c3f,_0xf88915){var _0x33cafa,_0x34725f;return tts(_0x310c3f,_0xf88915||'en',0x1)[_0xb633('0x35')](function(_0x433240){logger['info'](_0x433240);_0x33cafa=path['resolve'](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+_0xb633('0x36'));return downloadFile(_0x433240,_0x33cafa);})['then'](function(){_0x34725f=path[_0xb633('0x27')](__dirname,_0xb633('0x28'),rs['generate'](0x4)+_0xb633('0x3b'));return convertFile(_0x33cafa,_0x34725f);})[_0xb633('0x35')](function(){try{fs[_0xb633('0x1e')](_0x33cafa);fs[_0xb633('0x2b')](_0x34725f,_0xb633('0x2c'));}catch(_0x116039){logger[_0xb633('0x17')](_0x116039);}logger[_0xb633('0x38')](_0xb633('0x3c'),_0x34725f[_0xb633('0x2d')]('.')[0x0]);return _0x34725f[_0xb633('0x2d')]('.')[0x0];});};exports[_0xb633('0x3d')]=function(_0xec5455,_0x12cfd5,_0x4f3dbb){return google[_0xb633('0x3e')](_0xec5455,_0x12cfd5,_0x4f3dbb)[_0xb633('0x35')](function(_0x41a94d){logger[_0xb633('0x38')](_0x41a94d[_0xb633('0x3f')]);return rp(_0x41a94d);})[_0xb633('0x35')](function(_0x4c5ce6){var _0x2dc60e='';var _0x59d271=0x0;try{fs[_0xb633('0x1e')](_0xec5455);}catch(_0x2748a4){logger[_0xb633('0x17')](_0x2748a4);}if(_0x4c5ce6&&_0x4c5ce6[_0xb633('0x40')]){_0x2dc60e=_0x4c5ce6[_0xb633('0x40')][_0xb633('0x41')](function(_0x8df60b){return _0x8df60b&&_0x8df60b[_0xb633('0x42')][0x0]&&_0x8df60b[_0xb633('0x42')][0x0][_0xb633('0x43')]?_0x8df60b[_0xb633('0x42')][0x0]['transcript']:'';})['join']('\x0a');_0x59d271=_0x4c5ce6[_0xb633('0x40')][_0xb633('0x41')](function(_0x4eda20){return _0x4eda20&&_0x4eda20['alternatives'][0x0]&&_0x4eda20[_0xb633('0x42')][0x0][_0xb633('0x44')]?_0x4eda20[_0xb633('0x42')][0x0]['confidence']:0x0;})[_0xb633('0x45')]('\x0a');}logger['info']('googleASR\x20transcription',_0x2dc60e);logger['info'](_0xb633('0x46'),_0x59d271);return{'transcript':_0x2dc60e,'confidence':_0x59d271};})['catch'](function(_0x1b4316){logger[_0xb633('0x17')](_0xb633('0x47'),_0x1b4316[_0xb633('0x16')],_0x1b4316['name'],_0x1b4316[_0xb633('0x48')]);});};exports[_0xb633('0x49')]=function(_0x3894b8,_0x580b56,_0x100e80,_0x50804e){var _0x77709a=apiai(_0x580b56,{'language':_0x50804e||'en'});return _0x77709a['textRequest'](_0x100e80,{'sessionId':md5(_0x3894b8)})['then'](function(_0x1a0350){logger[_0xb633('0x38')](JSON[_0xb633('0x4a')](_0x1a0350));return{'source':_0x1a0350['result'][_0xb633('0x4b')],'resolvedQuery':_0x1a0350['result'][_0xb633('0x4c')],'action':_0x1a0350[_0xb633('0x4d')][_0xb633('0x4e')],'actionIncomplete':_0x1a0350[_0xb633('0x4d')]['actionIncomplete'],'speech':_0x1a0350[_0xb633('0x4d')][_0xb633('0x4f')][_0xb633('0x50')],'score':_0x1a0350[_0xb633('0x4d')][_0xb633('0x51')],'statusCode':_0x1a0350['status'][_0xb633('0x52')],'endConversation':_0x1a0350['result'][_0xb633('0x53')][_0xb633('0x54')]||![],'isFallbackIntent':_0x1a0350[_0xb633('0x4d')][_0xb633('0x53')][_0xb633('0x55')]};});};exports['tildeASR']=function(_0x63a978,_0x1f635a,_0x3b2622,_0x2a7965){return tilde[_0xb633('0x3e')](_0x63a978,_0x1f635a,_0x3b2622,_0x2a7965)[_0xb633('0x35')](function(_0x22d9a3){try{fs[_0xb633('0x1e')](_0x63a978);}catch(_0x24a73d){logger[_0xb633('0x17')](_0x24a73d);}logger[_0xb633('0x38')](_0xb633('0x56'),_0x22d9a3['transcript']);logger['info']('Tilde\x20ASR\x20confidence',_0x22d9a3[_0xb633('0x44')]);return _0x22d9a3;});};exports[_0xb633('0x57')]=function(_0x40f1c2,_0x3fa3fa,_0x1fa1a8,_0x412c33,_0x33c3a4,_0x5a812a){var _0x1037a1=path[_0xb633('0x27')](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+'.mp3');var _0x2e3ecd;return aws[_0xb633('0x58')](_0x40f1c2,_0x3fa3fa,_0x1fa1a8,_0x412c33,_0x33c3a4,_0x5a812a,_0x1037a1)[_0xb633('0x35')](function(){_0x2e3ecd=path[_0xb633('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0xb633('0x3b'));return convertFile(_0x1037a1,_0x2e3ecd);})[_0xb633('0x35')](function(){try{fs[_0xb633('0x1e')](_0x1037a1);fs[_0xb633('0x2b')](_0x2e3ecd,_0xb633('0x2c'));}catch(_0x315e54){logger[_0xb633('0x17')](_0x315e54);}return _0x2e3ecd[_0xb633('0x2d')]('.')[0x0];});};exports[_0xb633('0x59')]=function(_0x3309b2,_0x995f46,_0x4b8a70,_0x31b02d,_0x3171a1,_0x5ee468){return aws[_0xb633('0x5a')](_0x3309b2,_0x995f46,_0x4b8a70,_0x31b02d,_0x3171a1,_0x5ee468)[_0xb633('0x35')](function(_0x2142c3){logger[_0xb633('0x38')](JSON[_0xb633('0x4a')](_0x2142c3));return _0x2142c3;});};exports['ispeechTTS']=function(_0xbd83e7,_0x4d50f8,_0x323397,_0x17fdb6){var _0x26761f=util[_0xb633('0x5b')](_0xb633('0x5c'),ISPEECH_API,_0xbd83e7,encodeURIComponent(_0x4d50f8),_0x323397,_0x17fdb6);var _0xc80eb0=path[_0xb633('0x27')](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+_0xb633('0x36'));var _0x31ebfe;return downloadFile(_0x26761f,_0xc80eb0)['then'](function(){_0x31ebfe=path[_0xb633('0x27')](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+_0xb633('0x3b'));return convertFile(_0xc80eb0,_0x31ebfe);})[_0xb633('0x35')](function(){try{fs[_0xb633('0x1e')](_0xc80eb0);fs[_0xb633('0x2b')](_0x31ebfe,'777');}catch(_0x4402cc){logger['error'](_0x4402cc);}return _0x31ebfe[_0xb633('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x2d002b,_0x8f1df9,_0x74e4db,_0x599ae8){var _0x3484df=util['format'](_0xb633('0x5d'),ISPEECH_API,_0x8f1df9,_0x74e4db,base64Encode(_0x2d002b),_0x599ae8?util[_0xb633('0x5b')](_0xb633('0x5e'),encodeURIComponent(_0x599ae8)):_0xb633('0x5f'));return uploadFile(_0x3484df)[_0xb633('0x35')](function(_0x2326e8){return querystring['parse'](_0x2326e8);});};exports[_0xb633('0x60')]=function(_0x2fe3e8,_0x32fc92){return sestek['nda'](_0x2fe3e8,_0x32fc92)[_0xb633('0x35')](function(_0x540d13){logger[_0xb633('0x38')](JSON[_0xb633('0x4a')](_0x540d13));var _0x44961c={'speech':_0x540d13[_0xb633('0x61')],'action':_0x540d13[_0xb633('0x62')]?_0x540d13['channelData'][_0xb633('0x63')]:undefined,'actiondata':_0x540d13[_0xb633('0x62')]?_0x540d13[_0xb633('0x62')]['CustomActionData']:undefined};if(_0x540d13[_0xb633('0x62')]&&_0x540d13[_0xb633('0x62')][_0xb633('0x64')]){return base64Decode(_0x540d13[_0xb633('0x62')][_0xb633('0x64')][_0xb633('0x65')],path['resolve'](__dirname,_0xb633('0x28'),rs[_0xb633('0x29')](0x4)+_0xb633('0x3b')))['then'](function(_0x9bb1fb){_0x44961c[_0xb633('0x66')]=_0x9bb1fb;return _0x44961c;});}return _0x44961c;});};exports[_0xb633('0x67')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index d22f4c2..3a6b5e0 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 _0x5eac=['./nda','exports'];(function(_0x5eb048,_0x5069ab){var _0x17f0c0=function(_0x484a2a){while(--_0x484a2a){_0x5eb048['push'](_0x5eb048['shift']());}};_0x17f0c0(++_0x5069ab);}(_0x5eac,0x76));var _0xc5ea=function(_0x382eb3,_0x411573){_0x382eb3=_0x382eb3-0x0;var _0x3a60b4=_0x5eac[_0x382eb3];return _0x3a60b4;};var nda=require(_0xc5ea('0x0'));module[_0xc5ea('0x1')]={'nda':nda}; \ No newline at end of file +var _0x8be7=['exports'];(function(_0x4a3cce,_0x3113ce){var _0x926687=function(_0x12464d){while(--_0x12464d){_0x4a3cce['push'](_0x4a3cce['shift']());}};_0x926687(++_0x3113ce);}(_0x8be7,0x98));var _0x78be=function(_0x587b4d,_0x10aded){_0x587b4d=_0x587b4d-0x0;var _0x1b48e=_0x8be7[_0x587b4d];return _0x1b48e;};var nda=require('./nda');module[_0x78be('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 72cb434..e482e53 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 _0xa9fd=['ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','username','password','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','dnid','extension','text','Bearer\x20','access_token','project','body','channelData'];(function(_0x29c112,_0x42b33d){var _0x4c8e98=function(_0x18f758){while(--_0x18f758){_0x29c112['push'](_0x29c112['shift']());}};_0x4c8e98(++_0x42b33d);}(_0xa9fd,0x13f));var _0xda9f=function(_0x120cdd,_0x58ae44){_0x120cdd=_0x120cdd-0x0;var _0x18c10f=_0xa9fd[_0x120cdd];return _0x18c10f;};'use strict';var rp=require(_0xda9f('0x0'));var url=require('url');var logger=require(_0xda9f('0x1'))(_0xda9f('0x2'));module[_0xda9f('0x3')]=function(_0x2cad10,_0x5a4da8){var _0x26dca3={'method':_0xda9f('0x4'),'uri':url[_0xda9f('0x5')](_0x5a4da8[_0xda9f('0x6')],'/token'),'form':{'grant_type':'password','username':_0x5a4da8[_0xda9f('0x7')],'password':_0x5a4da8[_0xda9f('0x8')]},'json':!![]};return rp(_0x26dca3)[_0xda9f('0x9')](function(_0x4901f8){var _0x2bba19={'method':_0xda9f('0x4'),'uri':url[_0xda9f('0x5')](_0x5a4da8['ndassistant_url'],_0xda9f('0xa')),'body':{'type':_0x5a4da8[_0xda9f('0xb')]||_0xda9f('0xc'),'channelId':_0xda9f('0xd'),'conversation':{'id':_0x2cad10['uniqueid']},'from':{'id':_0x2cad10['callerid'],'name':_0x2cad10['calleridname']},'recipient':{'id':_0x2cad10[_0xda9f('0xe')],'name':_0x2cad10[_0xda9f('0xf')]},'text':_0x5a4da8[_0xda9f('0x10')],'channelData':{}},'headers':{'Authorization':_0xda9f('0x11')+_0x4901f8[_0xda9f('0x12')]},'json':!![]};if(_0x5a4da8[_0xda9f('0x13')]){_0x2bba19[_0xda9f('0x14')][_0xda9f('0x15')]['ProjectName']=_0x5a4da8[_0xda9f('0x13')];}if(_0x5a4da8[_0xda9f('0x16')]=='1'){_0x2bba19[_0xda9f('0x14')][_0xda9f('0x15')][_0xda9f('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xda9f('0x18')};}if(_0x5a4da8[_0xda9f('0x19')]){_0x2bba19['body'][_0xda9f('0x15')][_0xda9f('0x1a')]=_0x5a4da8[_0xda9f('0x19')];if(_0x5a4da8['custom_action_data']){_0x2bba19[_0xda9f('0x14')][_0xda9f('0x15')][_0xda9f('0x1b')]=_0x5a4da8[_0xda9f('0x1c')];}}logger[_0xda9f('0x1d')](JSON[_0xda9f('0x1e')](_0x2bba19));return rp(_0x2bba19);});}; \ No newline at end of file +var _0x6936=['request-promise','../../../../../config/logger','agi','POST','resolve','ndauth_url','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','dnid','extension','text','access_token','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','custom_action_data'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x6936,0x90));var _0x6693=function(_0x1f273b,_0xa0556a){_0x1f273b=_0x1f273b-0x0;var _0x3e7b95=_0x6936[_0x1f273b];return _0x3e7b95;};'use strict';var rp=require(_0x6693('0x0'));var url=require('url');var logger=require(_0x6693('0x1'))(_0x6693('0x2'));module['exports']=function(_0x329a40,_0x446ab2){var _0x392db7={'method':_0x6693('0x3'),'uri':url[_0x6693('0x4')](_0x446ab2[_0x6693('0x5')],'/token'),'form':{'grant_type':_0x6693('0x6'),'username':_0x446ab2[_0x6693('0x7')],'password':_0x446ab2[_0x6693('0x6')]},'json':!![]};return rp(_0x392db7)['then'](function(_0x5cbe39){var _0x81e77d={'method':_0x6693('0x3'),'uri':url[_0x6693('0x4')](_0x446ab2['ndassistant_url'],_0x6693('0x8')),'body':{'type':_0x446ab2[_0x6693('0x9')]||'message','channelId':_0x6693('0xa'),'conversation':{'id':_0x329a40[_0x6693('0xb')]},'from':{'id':_0x329a40['callerid'],'name':_0x329a40['calleridname']},'recipient':{'id':_0x329a40[_0x6693('0xc')],'name':_0x329a40[_0x6693('0xd')]},'text':_0x446ab2[_0x6693('0xe')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x5cbe39[_0x6693('0xf')]},'json':!![]};if(_0x446ab2[_0x6693('0x10')]){_0x81e77d[_0x6693('0x11')][_0x6693('0x12')]['ProjectName']=_0x446ab2[_0x6693('0x10')];}if(_0x446ab2[_0x6693('0x13')]=='1'){_0x81e77d['body'][_0x6693('0x12')][_0x6693('0x14')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6693('0x15')};}if(_0x446ab2[_0x6693('0x16')]){_0x81e77d[_0x6693('0x11')][_0x6693('0x12')]['CustomAction']=_0x446ab2[_0x6693('0x16')];if(_0x446ab2[_0x6693('0x17')]){_0x81e77d[_0x6693('0x11')][_0x6693('0x12')]['CustomActionData']=_0x446ab2[_0x6693('0x17')];}}logger['info'](JSON['stringify'](_0x81e77d));return rp(_0x81e77d);});}; \ 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 2dc2ebd..e6cb810 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x326133,_0x73247c,_0x138f93,_0x3a9b38){return asr(_0x326133,_0x73247c,_0x138f93,_0x3a9b38);}; \ No newline at end of file +var _0x2bc9=['exports','./lib/api'];(function(_0x5420e6,_0x3dbe59){var _0x36b5a8=function(_0x196535){while(--_0x196535){_0x5420e6['push'](_0x5420e6['shift']());}};_0x36b5a8(++_0x3dbe59);}(_0x2bc9,0xb9));var _0x92bc=function(_0x33c8cb,_0x56cff2){_0x33c8cb=_0x33c8cb-0x0;var _0x2d28bb=_0x2bc9[_0x33c8cb];return _0x2d28bb;};'use strict';var asr=require(_0x92bc('0x0'));module[_0x92bc('0x1')]=function(_0x15e197,_0x34d37b,_0x1018e5,_0x3df9de){return asr(_0x15e197,_0x34d37b,_0x1018e5,_0x3df9de);}; \ 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 c1d2e25..35a36e4 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 _0xbf97=['stringify','createReadStream','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','likelihood','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','lodash','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','send'];(function(_0x55c355,_0x2cd263){var _0x2e2f75=function(_0x2cc805){while(--_0x2cc805){_0x55c355['push'](_0x55c355['shift']());}};_0x2e2f75(++_0x2cd263);}(_0xbf97,0x1d3));var _0x7bf9=function(_0x24cb69,_0x4395be){_0x24cb69=_0x24cb69-0x0;var _0xed5ecd=_0xbf97[_0x24cb69];return _0xed5ecd;};'use strict';var BPromise=require('bluebird');var _=require(_0x7bf9('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7bf9('0x1'));var crypto=require(_0x7bf9('0x2'));var logger=require(_0x7bf9('0x3'))('agi');module[_0x7bf9('0x4')]=function(_0x2e49ab,_0x4697d0,_0x150b30,_0x23b7e6){return new BPromise(function(_0x26e0cf,_0x4f81bc){logger[_0x7bf9('0x5')](_0x7bf9('0x6'),_0x23b7e6||_0x7bf9('0x7'));var _0x1fd1b9=new WebSocket(_0x23b7e6||_0x7bf9('0x7'),{'perMessageDeflate':![]});var _0x49ea63='';var _0x3f7c8a='0';var _0x2abc5f='1';var _0x42a247='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x552b95(_0x5bc675){var _0x5d2683=crypto[_0x7bf9('0x8')](_0x7bf9('0x9'));_0x5d2683[_0x7bf9('0xa')](_0x5bc675);return _0x5d2683['digest'](_0x7bf9('0xb'));}function _0x35cb39(){try{logger[_0x7bf9('0x5')](_0x7bf9('0xc'));var _0x5f4b6d=moment()['unix']();var _0x1a07e8=_0x552b95(_0x5f4b6d+_0x4697d0+_0x150b30);_0x1fd1b9[_0x7bf9('0xd')](JSON[_0x7bf9('0xe')]({'appID':_0x4697d0,'timestamp':_0x5f4b6d,'appKey':_0x1a07e8}));var _0x453301=fs[_0x7bf9('0xf')](_0x2e49ab);_0x453301['on']('data',function(_0x479ab9){_0x1fd1b9[_0x7bf9('0xd')](_0x479ab9);});_0x453301['on']('close',function(){_0x1fd1b9['send'](_0x7bf9('0x10'));});}catch(_0x49917c){logger[_0x7bf9('0x11')](_0x7bf9('0x12'),JSON[_0x7bf9('0xe')](_0x49917c));_0x1fd1b9[_0x7bf9('0x13')]();}}function _0x38e6df(_0x13fe6d){try{if(_0x13fe6d){var _0x558b85=JSON[_0x7bf9('0x14')](_0x13fe6d);switch(_0x558b85[_0x7bf9('0x15')]){case 0x0:if(_0x558b85[_0x7bf9('0x16')]){if(_0x558b85['result'][_0x7bf9('0x17')]){logger[_0x7bf9('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x7bf9('0xe')](_0x558b85[_0x7bf9('0x16')][_0x7bf9('0x18')]));_0x49ea63=_0x558b85['result'][_0x7bf9('0x18')][0x0][_0x7bf9('0x19')];_0x3f7c8a=_0x558b85['result'][_0x7bf9('0x18')][0x0][_0x7bf9('0x1a')];_0x2abc5f='0';_0x42a247='Success.';_0x1fd1b9[_0x7bf9('0x13')]();}}break;case 0x1:logger['info'](_0x7bf9('0x1b'));_0x2abc5f='1';_0x42a247=_0x7bf9('0x1b');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2abc5f='2';_0x42a247=_0x7bf9('0x1c');break;case 0x9:logger[_0x7bf9('0x5')](_0x7bf9('0x1d'));_0x2abc5f='9';_0x42a247=_0x7bf9('0x1d');break;case 0xa:logger[_0x7bf9('0x5')]('Authentication\x20failed.');_0x2abc5f='10';_0x42a247=_0x7bf9('0x1e');break;case 0xb:logger[_0x7bf9('0x5')](_0x7bf9('0x1f'));_0x2abc5f='11';_0x42a247='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x29309a){logger['error'](_0x7bf9('0x20'),JSON[_0x7bf9('0xe')](_0x29309a));_0x1fd1b9[_0x7bf9('0x13')]();}}function _0x4401f7(){logger['info'](_0x7bf9('0x21'));_0x26e0cf({'transcript':_0x49ea63,'confidence':_0x3f7c8a,'status':_0x2abc5f,'status_message':_0x42a247});}function _0x2e1296(_0x52bd63){logger['error'](_0x7bf9('0x22'));if(!_['isNil'](_0x52bd63)){logger['error'](_[_0x7bf9('0x23')](_0x52bd63)?JSON[_0x7bf9('0xe')](_0x52bd63):_0x52bd63);}}_0x1fd1b9['on']('open',_0x35cb39);_0x1fd1b9['on'](_0x7bf9('0x24'),_0x38e6df);_0x1fd1b9['on']('close',_0x4401f7);_0x1fd1b9['on'](_0x7bf9('0x11'),_0x2e1296);});}; \ No newline at end of file +var _0x3f4a=['status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse'];(function(_0x3f073e,_0x237f97){var _0x492e8a=function(_0xb4bba4){while(--_0xb4bba4){_0x3f073e['push'](_0x3f073e['shift']());}};_0x492e8a(++_0x237f97);}(_0x3f4a,0x195));var _0xa3f4=function(_0xc2304f,_0x485977){_0xc2304f=_0xc2304f-0x0;var _0x4b805b=_0x3f4a[_0xc2304f];return _0x4b805b;};'use strict';var BPromise=require(_0xa3f4('0x0'));var _=require(_0xa3f4('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xa3f4('0x2'));var crypto=require(_0xa3f4('0x3'));var logger=require(_0xa3f4('0x4'))('agi');module['exports']=function(_0x1c2989,_0x7682ae,_0x5a6932,_0x5b78d8){return new BPromise(function(_0x351ad5,_0x5f5472){logger[_0xa3f4('0x5')](_0xa3f4('0x6'),_0x5b78d8||_0xa3f4('0x7'));var _0x1f3a65=new WebSocket(_0x5b78d8||_0xa3f4('0x7'),{'perMessageDeflate':![]});var _0x3ffa10='';var _0x1e4eff='0';var _0x2d1385='1';var _0x18ecd8=_0xa3f4('0x8');function _0x2eed66(_0x43761a){var _0x323d63=crypto[_0xa3f4('0x9')](_0xa3f4('0xa'));_0x323d63['update'](_0x43761a);return _0x323d63[_0xa3f4('0xb')](_0xa3f4('0xc'));}function _0x45be37(){try{logger[_0xa3f4('0x5')](_0xa3f4('0xd'));var _0x22f77d=moment()[_0xa3f4('0xe')]();var _0x20cea1=_0x2eed66(_0x22f77d+_0x7682ae+_0x5a6932);_0x1f3a65[_0xa3f4('0xf')](JSON[_0xa3f4('0x10')]({'appID':_0x7682ae,'timestamp':_0x22f77d,'appKey':_0x20cea1}));var _0x566fd6=fs[_0xa3f4('0x11')](_0x1c2989);_0x566fd6['on'](_0xa3f4('0x12'),function(_0x4517df){_0x1f3a65[_0xa3f4('0xf')](_0x4517df);});_0x566fd6['on'](_0xa3f4('0x13'),function(){_0x1f3a65[_0xa3f4('0xf')]('EOS');});}catch(_0x55c416){logger[_0xa3f4('0x14')](_0xa3f4('0x15'),JSON[_0xa3f4('0x10')](_0x55c416));_0x1f3a65[_0xa3f4('0x16')]();}}function _0x4b2f5a(_0x25db68){try{if(_0x25db68){var _0x38b478=JSON[_0xa3f4('0x17')](_0x25db68);switch(_0x38b478[_0xa3f4('0x18')]){case 0x0:if(_0x38b478[_0xa3f4('0x19')]){if(_0x38b478[_0xa3f4('0x19')][_0xa3f4('0x1a')]){logger[_0xa3f4('0x5')](_0xa3f4('0x1b'),JSON[_0xa3f4('0x10')](_0x38b478['result'][_0xa3f4('0x1c')]));_0x3ffa10=_0x38b478[_0xa3f4('0x19')][_0xa3f4('0x1c')][0x0][_0xa3f4('0x1d')];_0x1e4eff=_0x38b478[_0xa3f4('0x19')][_0xa3f4('0x1c')][0x0]['likelihood'];_0x2d1385='0';_0x18ecd8=_0xa3f4('0x1e');_0x1f3a65[_0xa3f4('0x16')]();}}break;case 0x1:logger['info'](_0xa3f4('0x8'));_0x2d1385='1';_0x18ecd8=_0xa3f4('0x8');break;case 0x2:logger[_0xa3f4('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2d1385='2';_0x18ecd8=_0xa3f4('0x1f');break;case 0x9:logger[_0xa3f4('0x5')](_0xa3f4('0x20'));_0x2d1385='9';_0x18ecd8=_0xa3f4('0x20');break;case 0xa:logger['info'](_0xa3f4('0x21'));_0x2d1385='10';_0x18ecd8='Authentication\x20failed.';break;case 0xb:logger[_0xa3f4('0x5')](_0xa3f4('0x22'));_0x2d1385='11';_0x18ecd8=_0xa3f4('0x22');}}}catch(_0x3301ee){logger[_0xa3f4('0x14')](_0xa3f4('0x23'),JSON[_0xa3f4('0x10')](_0x3301ee));_0x1f3a65['terminate']();}}function _0x46f5e3(){logger[_0xa3f4('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x351ad5({'transcript':_0x3ffa10,'confidence':_0x1e4eff,'status':_0x2d1385,'status_message':_0x18ecd8});}function _0x678e37(_0x5ddbbd){logger[_0xa3f4('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x5ddbbd)){logger['error'](_[_0xa3f4('0x24')](_0x5ddbbd)?JSON[_0xa3f4('0x10')](_0x5ddbbd):_0x5ddbbd);}}_0x1f3a65['on'](_0xa3f4('0x25'),_0x45be37);_0x1f3a65['on'](_0xa3f4('0x26'),_0x4b2f5a);_0x1f3a65['on'](_0xa3f4('0x13'),_0x46f5e3);_0x1f3a65['on'](_0xa3f4('0x14'),_0x678e37);});}; \ 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 2025cc9..a31396c 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 _0xda90=['./asr','exports'];(function(_0x42c445,_0x41cf5b){var _0x4f9158=function(_0x3ad169){while(--_0x3ad169){_0x42c445['push'](_0x42c445['shift']());}};_0x4f9158(++_0x41cf5b);}(_0xda90,0x152));var _0x0da9=function(_0x105575,_0x21416b){_0x105575=_0x105575-0x0;var _0xac03b2=_0xda90[_0x105575];return _0xac03b2;};var asr=require(_0x0da9('0x0'));module[_0x0da9('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5780=['exports'];(function(_0x2c60de,_0x565bf9){var _0x277399=function(_0x546af2){while(--_0x546af2){_0x2c60de['push'](_0x2c60de['shift']());}};_0x277399(++_0x565bf9);}(_0x5780,0xed));var _0x0578=function(_0x5c6cb9,_0x5289f5){_0x5c6cb9=_0x5c6cb9-0x0;var _0x171aff=_0x5780[_0x5c6cb9];return _0x171aff;};var asr=require('./asr');module[_0x0578('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 5f43a5f..06b7c65 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 _0xc7b4=['error','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','events','EventEmitter','./channel','127.0.0.1','call','emit','listen','listening','connection'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xc7b4,0x15e));var _0x4c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b4[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x4c7b('0x0'));var net=require('net');var EventEmitter=require(_0x4c7b('0x1'))[_0x4c7b('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x4c7b('0x3'));var AGIServer=function(_0x9305d5,_0x279c21,_0x2a8b1d){var _0x109687=this,_0x9305d5=_0x9305d5||0x11dd,_0x279c21=_0x279c21||_0x4c7b('0x4'),_0x2272e8=null,_0x46532e=0x0;EventEmitter[_0x4c7b('0x5')](_0x109687);function _0x2c005a(){if(!_0x9305d5){_0x109687[_0x4c7b('0x6')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x2272e8=net['createServer']();_0x2272e8[_0x4c7b('0x7')](_0x9305d5,_0x279c21);_0x2272e8['on'](_0x4c7b('0x8'),function(){_0x109687[_0x4c7b('0x6')](_0x4c7b('0x8'));});_0x2272e8['on'](_0x4c7b('0x9'),function(_0x22441d){_0x2272e8['getConnections'](function(_0x1dc629,_0x3da36){if(_0x1dc629){_0x109687[_0x4c7b('0x6')](_0x4c7b('0xa'),new AGIError('E_AGI_SERVER_ERROR',_0x1dc629));}else if(_0x2a8b1d&&_0x2a8b1d<0x0){_0x109687['emit'](_0x4c7b('0xa'),new AGIError(_0x4c7b('0xb')));_0x22441d[_0x4c7b('0xc')]();}else if(_0x2a8b1d&&_0x2a8b1d>0x0&&_0x2a8b1d<_0x3da36){_0x46532e+=0x1;_0x109687[_0x4c7b('0x6')](_0x4c7b('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x46532e));_0x22441d['destroy']();}else{var _0x4ad52f=new AGIChannel(_0x22441d);_0x4ad52f['on'](_0x4c7b('0xd'),function(){_0x109687['emit'](_0x4c7b('0x9'),_0x4ad52f);});}});});_0x2272e8['on'](_0x4c7b('0xa'),function(_0x450cb8){_0x109687[_0x4c7b('0x6')](_0x4c7b('0xa'),new AGIError(_0x4c7b('0xe'),_0x450cb8['code']));});_0x2272e8['on']('close',function(){_0x109687['emit'](_0x4c7b('0xf'),new AGIError(_0x4c7b('0x10')));});}process[_0x4c7b('0x11')](function(){_0x2c005a();});};util[_0x4c7b('0x12')](AGIServer,EventEmitter);module[_0x4c7b('0x13')]=function(_0x49d3a0,_0x30d481,_0x407bed){return new AGIServer(_0x49d3a0,_0x30d481,_0x407bed);}; \ No newline at end of file +var _0x1c42=['connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events','EventEmitter','./channel','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x144867,_0x44c871){var _0x517f7b=function(_0xbc0c01){while(--_0xbc0c01){_0x144867['push'](_0x144867['shift']());}};_0x517f7b(++_0x44c871);}(_0x1c42,0x13a));var _0x21c4=function(_0x5a4161,_0x4061e0){_0x5a4161=_0x5a4161-0x0;var _0x1354da=_0x1c42[_0x5a4161];return _0x1354da;};'use strict';var util=require('util');var net=require(_0x21c4('0x0'));var EventEmitter=require(_0x21c4('0x1'))[_0x21c4('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x21c4('0x3'));var AGIServer=function(_0x40bc3e,_0x1512d2,_0xd7340){var _0x435179=this,_0x40bc3e=_0x40bc3e||0x11dd,_0x1512d2=_0x1512d2||_0x21c4('0x4'),_0x8d4312=null,_0x4fc4da=0x0;EventEmitter[_0x21c4('0x5')](_0x435179);function _0x54b2ea(){if(!_0x40bc3e){_0x435179[_0x21c4('0x6')]('error',new AGIError(_0x21c4('0x7')));return![];}_0x8d4312=net[_0x21c4('0x8')]();_0x8d4312[_0x21c4('0x9')](_0x40bc3e,_0x1512d2);_0x8d4312['on'](_0x21c4('0xa'),function(){_0x435179[_0x21c4('0x6')](_0x21c4('0xa'));});_0x8d4312['on'](_0x21c4('0xb'),function(_0x3d147a){_0x8d4312[_0x21c4('0xc')](function(_0x50fc66,_0xa58fa5){if(_0x50fc66){_0x435179['emit'](_0x21c4('0xd'),new AGIError('E_AGI_SERVER_ERROR',_0x50fc66));}else if(_0xd7340&&_0xd7340<0x0){_0x435179[_0x21c4('0x6')](_0x21c4('0xd'),new AGIError(_0x21c4('0xe')));_0x3d147a[_0x21c4('0xf')]();}else if(_0xd7340&&_0xd7340>0x0&&_0xd7340<_0xa58fa5){_0x4fc4da+=0x1;_0x435179[_0x21c4('0x6')](_0x21c4('0xd'),new AGIError(_0x21c4('0x10'),_0x4fc4da));_0x3d147a[_0x21c4('0xf')]();}else{var _0xade6a9=new AGIChannel(_0x3d147a);_0xade6a9['on'](_0x21c4('0x11'),function(){_0x435179[_0x21c4('0x6')](_0x21c4('0xb'),_0xade6a9);});}});});_0x8d4312['on'](_0x21c4('0xd'),function(_0x5ab3a1){_0x435179['emit'](_0x21c4('0xd'),new AGIError(_0x21c4('0x12'),_0x5ab3a1[_0x21c4('0x13')]));});_0x8d4312['on'](_0x21c4('0x14'),function(){_0x435179[_0x21c4('0x6')](_0x21c4('0x14'),new AGIError(_0x21c4('0x15')));});}process[_0x21c4('0x16')](function(){_0x54b2ea();});};util[_0x21c4('0x17')](AGIServer,EventEmitter);module[_0x21c4('0x18')]=function(_0x373e83,_0x122cf3,_0x2b627a){return new AGIServer(_0x373e83,_0x122cf3,_0x2b627a);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 3e498b2..7485532 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 _0x6545=['Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','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','googleCloudTTS','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','dsn','getUser','getUserById','getSound','getSoundById','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','Intervals','getSoundPath','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','callerid','createSquareRecording','calleridname','context','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','replace','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','includes','POST','PUT','body','parse','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','statusCode','statusMessage','message','options','googleDialogflow','dialogflow_language','sestekNDA','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','awsLex','aws_secret_access_key','aws_lex_region','googleASR','google_asr_language','tildeASR','appsecret','clear','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isPlainObject','saveRestApiResult','isArray','length','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','label','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','exec','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','grammar','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','RECOG_CONFIDENCE()','SESTEK_ASR_TRANSCRIPT','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','sip_id','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','toUpperCase','speech','out','Dialogflow\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','intKey','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','NOBEEP','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20MATH\x20(%s)\x20block','operation','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','getData','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','sendMail\x20message','account_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','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','subproject'];(function(_0x28868d,_0xd3a4b0){var _0x4aeb1d=function(_0x3a1ed7){while(--_0x3a1ed7){_0x28868d['push'](_0x28868d['shift']());}};_0x4aeb1d(++_0xd3a4b0);}(_0x6545,0x1d5));var _0x5654=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6545[_0x14add3];return _0x4a174f;};'use strict';var fs=require('fs');var path=require(_0x5654('0x0'));var util=require('util');var _=require('lodash');var sh=require(_0x5654('0x1'));var odbc=require(_0x5654('0x2'))();var rs=require(_0x5654('0x3'));var moment=require(_0x5654('0x4'));var Mustache=require(_0x5654('0x5'));var rp=require('request-promise');var logger=require(_0x5654('0x6'))(_0x5654('0x7'));var config=require(_0x5654('0x8'));var scripts=require(_0x5654('0x9'));var FILES_PATH=_0x5654('0xa');var recursiveMapAttributes=[_0x5654('0xb'),'rawBody'];var verticesWithRetry=['menu',_0x5654('0xc'),_0x5654('0xd')];var AGIVertices=function(_0x2ff1c7,_0x3b3784,_0x1e16ea){this[_0x5654('0xe')]=_0x2ff1c7;this[_0x5654('0xf')]=_0x3b3784;this['mailRpc']=_0x1e16ea;};AGIVertices[_0x5654('0x10')][_0x5654('0x11')]=function(_0x570b03,_0x3b386b){this[_0x5654('0xf')][_0x5654('0x12')](_0x570b03)[_0x5654('0x13')](function(_0x21b657){_0x3b386b(null,_0x21b657?_0x21b657[_0x5654('0x14')]:![]);})[_0x5654('0x15')](function(_0x486d9b){_0x3b386b(_0x486d9b);});};AGIVertices[_0x5654('0x10')][_0x5654('0x16')]=function(_0xa0a5cc,_0x4eb861){this[_0x5654('0xf')]['getVoiceQueueById'](_0xa0a5cc)[_0x5654('0x13')](function(_0xbecefe){_0x4eb861(null,_0xbecefe?_0xbecefe[_0x5654('0x14')]:![]);})['catch'](function(_0x2a746c){_0x4eb861(_0x2a746c);});};AGIVertices[_0x5654('0x10')][_0x5654('0x17')]=function(_0x215208,_0x237dcc){this[_0x5654('0xf')][_0x5654('0x18')](_0x215208)[_0x5654('0x13')](function(_0x436690){_0x237dcc(null,_0x436690?_0x436690['name']:![]);})[_0x5654('0x15')](function(_0x1a4ae5){_0x237dcc(_0x1a4ae5);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x49887f,_0x7d5709){this['rpc']['getSquareOdbcById'](_0x49887f)[_0x5654('0x13')](function(_0x120170){_0x7d5709(null,_0x120170?_0x120170[_0x5654('0x19')]:![]);})[_0x5654('0x15')](function(_0x49ad48){_0x7d5709(_0x49ad48);});};AGIVertices['prototype'][_0x5654('0x1a')]=function(_0x2dcc69,_0x382e61){this[_0x5654('0xf')][_0x5654('0x1b')](_0x2dcc69)[_0x5654('0x13')](function(_0x60c174){_0x382e61(null,_0x60c174?_0x60c174['name']:![]);})[_0x5654('0x15')](function(_0x1a1357){_0x382e61(_0x1a1357);});};AGIVertices[_0x5654('0x10')]['getTrunk']=function(_0x168553,_0x1099de){this[_0x5654('0xf')]['getTrunkById'](_0x168553)[_0x5654('0x13')](function(_0x401c28){_0x1099de(null,_0x401c28?_0x401c28[_0x5654('0x14')]:![]);})[_0x5654('0x15')](function(_0x20a67a){_0x1099de(_0x20a67a);});};AGIVertices[_0x5654('0x10')][_0x5654('0x1c')]=function(_0x25831a,_0x1da47c){var _0x1fb353=this;this[_0x5654('0xf')][_0x5654('0x1d')](_0x25831a)[_0x5654('0x13')](function(_0x5e2291){_0x1da47c(null,_0x5e2291?_0x1fb353['getSoundPath'](_0x5e2291[_0x5654('0x1e')]):![]);})[_0x5654('0x15')](function(_0xbba9cb){_0x1da47c(_0xbba9cb);});};AGIVertices[_0x5654('0x10')]['getMailAccount']=function(_0x17cf3c,_0x536e34){this[_0x5654('0xf')][_0x5654('0x1f')](_0x17cf3c)[_0x5654('0x13')](function(_0xd75e8b){_0x536e34(null,_0xd75e8b?_0xd75e8b:![]);})[_0x5654('0x15')](function(_0x37f42e){_0x536e34(_0x37f42e);});};AGIVertices[_0x5654('0x10')][_0x5654('0x20')]=function(_0x4e2605,_0x47bdae,_0x5f4cd9){this['mailRpc']['sendMailMessage'](_0x4e2605,_0x47bdae)[_0x5654('0x13')](function(){_0x5f4cd9(null);})[_0x5654('0x15')](function(_0xa3e510){_0x5f4cd9(_0xa3e510);});};AGIVertices[_0x5654('0x10')][_0x5654('0x21')]=function(_0x2614c5,_0x5d3859){this[_0x5654('0xf')][_0x5654('0x22')](_0x2614c5)['then'](function(_0x2cbaec){if(_0x2cbaec){if(_0x2cbaec[_0x5654('0x23')]){_0x5d3859(null,[_0x2cbaec['interval']]);}else{_0x5d3859(null,_['map'](_0x2cbaec[_0x5654('0x24')],'interval'));}}else{_0x5d3859(null,![]);}})[_0x5654('0x15')](function(_0x2eb954){_0x5d3859(_0x2eb954);});};AGIVertices[_0x5654('0x10')][_0x5654('0x25')]=function(_0x22c70a){return util['format'](_0x5654('0x26'),FILES_PATH,_0x22c70a);};AGIVertices[_0x5654('0x10')][_0x5654('0x27')]=function(_0x2bd45e,_0x44874a,_0xad83f0){odbc[_0x5654('0x28')](_0x2bd45e,function(_0xc3e6c1){if(_0xc3e6c1){logger[_0x5654('0x29')](_0x5654('0x2a'),_0xc3e6c1);_0xad83f0(_0xc3e6c1);}else{logger[_0x5654('0x2b')]('ODBC\x20connection\x20successfully');odbc['query'](_0x44874a,function(_0xeb7eb9,_0x270cde){if(_0xeb7eb9){logger[_0x5654('0x2b')](_0x5654('0x2c'),_0x44874a);_0xad83f0(_0xeb7eb9);}else{logger[_0x5654('0x2b')](_0x5654('0x2d'),_0x44874a);odbc['close'](function(_0x1013f0){if(_0x1013f0){logger['error'](_0x5654('0x2e'),_0x1013f0);}_0xad83f0(null,_0x270cde);});}});}});};AGIVertices[_0x5654('0x10')][_0x5654('0x2f')]=function(_0x854fcd,_0x5c9c6e){this[_0x5654('0xf')][_0x5654('0x30')](_0x854fcd)['then'](function(_0xf52228){_0x5c9c6e(null,_0xf52228?_0xf52228:![]);})['catch'](function(_0x5c4384){_0x5c9c6e(_0x5c4384);});};AGIVertices['prototype']['createSmsMessage']=function(_0x223ee9,_0x1e8007){this[_0x5654('0xf')][_0x5654('0x31')](_0x223ee9)[_0x5654('0x13')](function(_0x4ab180){_0x1e8007(null,_0x4ab180);})['catch'](function(_0x2ae705){_0x1e8007(_0x2ae705);});};AGIVertices[_0x5654('0x10')][_0x5654('0x32')]=function(_0x1ad822,_0x13131c,_0x25528a){this['rpc']['createSquareDetailsReport']({'uniqueid':this[_0x5654('0xe')][_0x5654('0x33')],'node':_0x1ad822['label'],'application':_0x1ad822[_0x5654('0x34')],'data':_0x13131c||null,'project_name':this[_0x5654('0xe')]['arg_1'],'callerid':this[_0x5654('0xe')][_0x5654('0x35')]})[_0x5654('0x13')](function(_0x45386d){if(_0x25528a){_0x25528a(null,_0x45386d);}})[_0x5654('0x15')](function(_0x52b9d8){if(_0x25528a){_0x25528a(_0x52b9d8);}});};AGIVertices[_0x5654('0x10')]['createSquareRecording']=function(_0x3ab4d9,_0x146829,_0x1b2018,_0x1375d9){this['rpc'][_0x5654('0x36')]({'uniqueid':this[_0x5654('0xe')][_0x5654('0x33')],'callerid':this['channel'][_0x5654('0x35')],'calleridname':this[_0x5654('0xe')][_0x5654('0x37')],'context':this['channel'][_0x5654('0x38')],'extension':this[_0x5654('0xe')]['extension'],'priority':this[_0x5654('0xe')][_0x5654('0x39')],'accountcode':this[_0x5654('0xe')][_0x5654('0x3a')],'dnid':this[_0x5654('0xe')]['dnid'],'projectName':this['channel'][_0x5654('0x3b')],'saveName':_0x146829,'filename':_0x3ab4d9[_0x5654('0x3c')]||_0x146829,'savePath':_0x1b2018})[_0x5654('0x13')](function(_0x2f18f8){_0x1375d9(null,_0x2f18f8);})[_0x5654('0x15')](function(_0x351a6f){_0x1375d9(_0x351a6f);});};AGIVertices[_0x5654('0x10')][_0x5654('0x3d')]=function(_0x945da0,_0x54471c,_0x3136ad){this[_0x5654('0xf')]['createSquareMessage']({'uniqueid':this['channel'][_0x5654('0x33')],'body':_0x945da0,'direction':_0x54471c})[_0x5654('0x13')](function(_0x436789){if(_0x3136ad){_0x3136ad(null,_0x436789);}})[_0x5654('0x15')](function(_0x56923f){if(_0x3136ad){_0x3136ad(_0x56923f);}});};AGIVertices[_0x5654('0x10')][_0x5654('0x3e')]=function(_0x38ce51,_0x509b0a){this['rpc'][_0x5654('0x3e')]({'firstName':_[_0x5654('0x3f')](_0x38ce51[_0x5654('0x14')])||_[_0x5654('0x40')](_0x38ce51[_0x5654('0x14')])?'callback_'+Math[_0x5654('0x41')]():_0x38ce51[_0x5654('0x14')],'lastName':_[_0x5654('0x3f')](_0x38ce51['lastName'])||_[_0x5654('0x40')](_0x38ce51[_0x5654('0x42')])?null:_0x38ce51[_0x5654('0x42')],'phone':_0x38ce51[_0x5654('0x43')],'ListId':_0x38ce51[_0x5654('0x44')],'scheduledat':_0x38ce51[_0x5654('0x45')],'callbackUniqueid':this[_0x5654('0xe')][_0x5654('0x33')],'tags':_0x5654('0x46'),'description':'Callback\x20scheduled\x20at\x20'+_0x38ce51[_0x5654('0x45')][_0x5654('0x47')](),'priority':_0x38ce51[_0x5654('0x48')]})['then'](function(_0x38023b){_0x509b0a(null,_0x38023b);})[_0x5654('0x15')](function(_0x40f7fe){_0x509b0a(_0x40f7fe);});};AGIVertices[_0x5654('0x10')][_0x5654('0x49')]=function(_0x133fc6,_0x4b251f){this['rpc'][_0x5654('0x4a')](_0x133fc6)[_0x5654('0x13')](function(_0x90b3ca){_0x4b251f(null,_0x90b3ca?_0x90b3ca[_0x5654('0x14')]:![]);})['catch'](function(_0x3041db){_0x4b251f(_0x3041db);});};AGIVertices[_0x5654('0x10')]['agentPause']=function(_0x3a4d77,_0x11232c,_0x3c5300){var _0x137779={'role':_0x5654('0x4b')};_0x137779[_0x3a4d77]=this['channel'][_0x5654('0x35')];this['rpc'][_0x5654('0x4c')](_0x137779,_0x11232c,this[_0x5654('0xe')][_0x5654('0x33')])[_0x5654('0x13')](function(_0x17af46){_0x3c5300(null,_[_0x5654('0x40')](_0x17af46)?![]:!![]);})['catch'](function(_0x198ac4){logger['error'](_0x198ac4);_0x3c5300(null,![]);});};AGIVertices[_0x5654('0x10')][_0x5654('0x4d')]=function(_0x5a7493,_0x1455d4){var _0x3c495f={'role':'agent'};_0x3c495f[_0x5a7493]=this[_0x5654('0xe')]['callerid'];this['rpc'][_0x5654('0x4d')](_0x3c495f)['then'](function(_0x47a535){_0x1455d4(null,_[_0x5654('0x40')](_0x47a535)?![]:!![]);})[_0x5654('0x15')](function(_0x214906){logger[_0x5654('0x29')](_0x214906);_0x1455d4(null,![]);});};AGIVertices[_0x5654('0x10')][_0x5654('0x4e')]=function(_0xf20d67,_0x1dfe4e){var _0x38238f={'role':_0x5654('0x4b')};_0x38238f[_0xf20d67]=this[_0x5654('0xe')]['callerid'];this[_0x5654('0xf')][_0x5654('0x4e')](_0x38238f)[_0x5654('0x13')](function(_0x3549de){_0x1dfe4e(null,_[_0x5654('0x40')](_0x3549de)?![]:!![]);})[_0x5654('0x15')](function(_0x2a74a3){logger[_0x5654('0x29')](_0x2a74a3);_0x1dfe4e(null,![]);});};AGIVertices[_0x5654('0x10')][_0x5654('0x4f')]=function(_0x347315,_0x12a508){var _0x2bd790={'role':_0x5654('0x4b')};_0x2bd790[_0x347315]=this['channel'][_0x5654('0x35')];var _0x578e8f=_0x347315!=_0x5654('0x50')?util[_0x5654('0x51')]('%s/%s@from-sip/n',_0x5654('0x52'),this[_0x5654('0xe')]['callerid']):undefined;this['rpc'][_0x5654('0x4f')](_0x2bd790,_0x578e8f)[_0x5654('0x13')](function(_0x1261d9){_0x12a508(null,_[_0x5654('0x40')](_0x1261d9)?![]:!![]);})[_0x5654('0x15')](function(_0x14c670){logger[_0x5654('0x29')](_0x14c670);_0x12a508(null,![]);});};AGIVertices[_0x5654('0x10')]['shellCommand']=function(_0x403c0a,_0x28a1d0){sh['exec'](_['trim'](_0x403c0a),function(_0x1359d7,_0x4a1338){var _0x323293=_0x4a1338[_0x5654('0x53')](/(\r\n|\n|\r)/gm,'');_0x28a1d0(null,_0x323293);});};AGIVertices[_0x5654('0x10')]['googleCloudTTS']=function(_0x493e5f,_0x221e58){scripts['googleCloudTTS'](_0x493e5f[_0x5654('0x54')],_0x493e5f[_0x5654('0x55')]||_0x5654('0x56'),_0x493e5f[_0x5654('0x56')],_0x493e5f[_0x5654('0x57')]||_0x5654('0x58'),_0x493e5f[_0x5654('0x59')]||_0x5654('0x5a'),_0x493e5f[_0x5654('0x5b')]||_0x5654('0x5c'))[_0x5654('0x13')](function(_0x55a29c){_0x221e58(null,_0x55a29c);})[_0x5654('0x15')](function(_0x1a05df){_0x221e58(_0x1a05df);});};AGIVertices[_0x5654('0x10')][_0x5654('0x5d')]=function(_0x21a237,_0x189565){scripts[_0x5654('0x5d')](_0x21a237['text'],_0x21a237[_0x5654('0x5e')]||'en',0x1)['then'](function(_0x3f1177){_0x189565(null,_0x3f1177);})[_0x5654('0x15')](function(_0x3b037c){_0x189565(_0x3b037c);});};AGIVertices[_0x5654('0x10')][_0x5654('0x5f')]=function(_0x1f2960,_0x1a4c8d){var _0x14fc24={'uri':_0x1f2960[_0x5654('0x60')],'method':_0x1f2960[_0x5654('0x61')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1f2960[_0x5654('0x62')])==='number'&&parseInt(_0x1f2960[_0x5654('0x62')])>=0x1?parseInt(_0x1f2960[_0x5654('0x62')])*0x3e8:0x5*0x3e8};if(_[_0x5654('0x63')]([_0x5654('0x64'),_0x5654('0x65')],_0x14fc24[_0x5654('0x61')]['toUpperCase']())){try{_0x14fc24[_0x5654('0x66')]=_0x1f2960['rawBody']?JSON[_0x5654('0x67')](_0x1f2960[_0x5654('0x68')]):{};}catch(_0x221c34){logger[_0x5654('0x29')](_0x5654('0x69'),_0x221c34);}}try{_0x14fc24[_0x5654('0x6a')]=_0x1f2960[_0x5654('0xb')]?JSON[_0x5654('0x67')](_0x1f2960['rawHeaders']):{};}catch(_0x1f05cb){logger['error'](_0x5654('0x6b'),_0x1f05cb);}if(_0x1f2960['computedVariables']){try{var _0x43998b=require(_0x1f2960[_0x5654('0x6c')])[_0x5654('0x6d')](this,_0x14fc24);_0x14fc24[_0x5654('0x6e')]=Mustache['render'](_0x1f2960['url'],_0x43998b,{},['$$','$$']);if(_0x14fc24[_0x5654('0x6a')]){_0x14fc24[_0x5654('0x6a')]=JSON[_0x5654('0x67')](Mustache[_0x5654('0x6f')](JSON[_0x5654('0x70')](_0x14fc24[_0x5654('0x6a')]),_0x43998b,{},['$$','$$']));}if(_0x14fc24[_0x5654('0x66')]){_0x14fc24[_0x5654('0x66')]=JSON[_0x5654('0x67')](Mustache[_0x5654('0x6f')](JSON[_0x5654('0x70')](_0x14fc24[_0x5654('0x66')]),_0x43998b,{},['$$','$$']));}}catch(_0x540d2b){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x540d2b);}}rp(_0x14fc24)[_0x5654('0x13')](function(_0x1ff504){var _0x3e8dc3={'statusCode':_0x1ff504[_0x5654('0x71')]||0xc8,'statusMessage':_0x1ff504[_0x5654('0x72')]||'OK','headers':_0x1ff504['headers']||{},'body':_0x1ff504[_0x5654('0x66')]||{}};_0x1a4c8d(null,_0x3e8dc3);})['catch'](function(_0x22b218){var _0x57bf2b={'statusCode':_0x22b218['statusCode']||0x1f4,'statusMessage':_0x22b218[_0x5654('0x73')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x22b218[_0x5654('0x74')][_0x5654('0x6a')]||{},'body':_0x22b218[_0x5654('0x74')]['body']||{}};_0x1a4c8d(null,_0x57bf2b);});};AGIVertices[_0x5654('0x10')][_0x5654('0x75')]=function(_0x347e79,_0x3e2a93){scripts[_0x5654('0x75')](this[_0x5654('0xe')]['uniqueid'],_0x347e79['key'],_0x347e79[_0x5654('0x56')],_0x347e79[_0x5654('0x76')]||'en')[_0x5654('0x13')](function(_0x4d0429){_0x3e2a93(null,_0x4d0429);})['catch'](function(_0x471ae8){_0x3e2a93(_0x471ae8);});};AGIVertices[_0x5654('0x10')]['sestekNDA']=function(_0x3f8da6,_0x16cdd0){scripts[_0x5654('0x77')](this[_0x5654('0xe')],_0x3f8da6)[_0x5654('0x13')](function(_0x52b417){_0x16cdd0(null,_0x52b417);})[_0x5654('0x15')](function(_0x5c80ed){_0x16cdd0(_0x5c80ed);});};AGIVertices[_0x5654('0x10')]['ispeechTTS']=function(_0x52f58e,_0x3bac00){scripts['ispeechTTS'](_0x52f58e[_0x5654('0x78')],_0x52f58e[_0x5654('0x56')],_0x52f58e[_0x5654('0x79')]||'en-US',_0x52f58e[_0x5654('0x7a')])[_0x5654('0x13')](function(_0x2ca41e){_0x3bac00(null,_0x2ca41e);})['catch'](function(_0x2fc004){_0x3bac00(_0x2fc004);});};AGIVertices[_0x5654('0x10')][_0x5654('0x7b')]=function(_0x1dd7e5,_0x5a961d,_0x79e304){scripts[_0x5654('0x7b')](_0x5a961d,_0x1dd7e5[_0x5654('0x78')],_0x1dd7e5[_0x5654('0x7c')]||'en-US',this[_0x5654('0x7d')](_0x1dd7e5[_0x5654('0x7e')])?_0x1dd7e5[_0x5654('0x7e')]:undefined)[_0x5654('0x13')](function(_0x32552e){_0x79e304(null,_0x32552e);})[_0x5654('0x15')](function(_0x53b622){_0x79e304(_0x53b622);});};AGIVertices['prototype']['awsPolly']=function(_0x5f1327,_0x35e544){scripts[_0x5654('0x7f')](_0x5f1327[_0x5654('0x80')],_0x5f1327['aws_secret_access_key'],_0x5f1327[_0x5654('0x81')],_0x5f1327[_0x5654('0x82')]||_0x5654('0x83'),_0x5f1327['text'],_0x5f1327['aws_text_type']||_0x5654('0x56'))[_0x5654('0x13')](function(_0xf8fb74){_0x35e544(null,_0xf8fb74);})[_0x5654('0x15')](function(_0x14d0b3){_0x35e544(_0x14d0b3);});};AGIVertices[_0x5654('0x10')]['awsLex']=function(_0x2f983b,_0x3402a5){scripts[_0x5654('0x84')](this['channel']['uniqueid'],_0x2f983b['aws_access_key_id'],_0x2f983b[_0x5654('0x85')],_0x2f983b[_0x5654('0x86')],_0x2f983b[_0x5654('0x56')],_0x2f983b['aws_bot_name'])[_0x5654('0x13')](function(_0x455278){_0x3402a5(null,_0x455278);})['catch'](function(_0x2b99a8){_0x3402a5(_0x2b99a8);});};AGIVertices[_0x5654('0x10')][_0x5654('0x87')]=function(_0x4ea3a8,_0xe618d0,_0x3e6876){scripts[_0x5654('0x87')](_0xe618d0,_0x4ea3a8[_0x5654('0x78')],_0x4ea3a8[_0x5654('0x88')]||_0x5654('0x58'))[_0x5654('0x13')](function(_0x564e63){_0x3e6876(null,_0x564e63);})['catch'](function(_0x2daa20){_0x3e6876(_0x2daa20);});};AGIVertices[_0x5654('0x10')][_0x5654('0x89')]=function(_0x497e42,_0x304932,_0x3cab6d){scripts['tildeASR'](_0x304932,_0x497e42['appid'],_0x497e42[_0x5654('0x8a')],_0x497e42[_0x5654('0x6e')])[_0x5654('0x13')](function(_0x3d96aa){_0x3cab6d(null,_0x3d96aa);})[_0x5654('0x15')](function(_0x43b8e7){_0x3cab6d(_0x43b8e7);});};AGIVertices['prototype'][_0x5654('0x8b')]=function(_0x3855da){var _0x50a8fc=_['includes'](verticesWithRetry,_0x3855da[_0x5654('0x34')])?_0x3855da:_['clone'](_0x3855da);for(var _0x84ec5c in _0x50a8fc){if(_0x50a8fc[_0x5654('0x8c')](_0x84ec5c)){if(_0x50a8fc[_0x84ec5c]&&_[_0x5654('0x8d')](_0x50a8fc[_0x84ec5c])){if(_[_0x5654('0x63')](recursiveMapAttributes,_0x84ec5c)){_0x50a8fc[_0x84ec5c]=this['replaceObjectAllVariables'](_0x50a8fc[_0x84ec5c]);}else{_0x50a8fc[_0x84ec5c]=this[_0x5654('0x8e')](_0x50a8fc[_0x84ec5c]);}}}}return _0x50a8fc;};AGIVertices['prototype'][_0x5654('0x8f')]=function(_0x2c2d84){for(var _0x527ac3 in _0x2c2d84){if(_0x2c2d84[_0x5654('0x8c')](_0x527ac3)){if(_[_0x5654('0x90')](_0x2c2d84[_0x527ac3])){this[_0x5654('0x8f')](_0x2c2d84[_0x527ac3]);}else if(_['isArray'](_0x2c2d84[_0x527ac3])){for(var _0x3202e0=0x0;_0x3202e0<_0x2c2d84[_0x527ac3]['length'];_0x3202e0++){this[_0x5654('0x8f')](_0x2c2d84[_0x527ac3][_0x3202e0]);}}else if(_[_0x5654('0x8d')](_0x2c2d84[_0x527ac3])){_0x2c2d84[_0x527ac3]=this[_0x5654('0x8e')](_0x2c2d84[_0x527ac3]);}}}};AGIVertices[_0x5654('0x10')][_0x5654('0x91')]=function(_0x3d5cae,_0x203a8b){for(var _0x2fbaa6 in _0x3d5cae){if(_0x3d5cae[_0x5654('0x8c')](_0x2fbaa6)){if(_[_0x5654('0x90')](_0x3d5cae[_0x2fbaa6])){if(!_[_0x5654('0x3f')](_0x3d5cae[_0x2fbaa6])){this['saveRestApiResult'](_0x3d5cae[_0x2fbaa6],util[_0x5654('0x51')]('%s.%s',_0x203a8b,_0x2fbaa6));}}else if(_[_0x5654('0x92')](_0x3d5cae[_0x2fbaa6])){for(var _0x361910=0x0;_0x361910<_0x3d5cae[_0x2fbaa6][_0x5654('0x93')];_0x361910++){this[_0x5654('0x91')](_0x3d5cae[_0x2fbaa6][_0x361910],util[_0x5654('0x51')](_0x5654('0x94'),_0x203a8b,_0x2fbaa6+'['+_0x361910+']'));}}else{if(!_['isNil'](_0x3d5cae[_0x2fbaa6])){this[_0x5654('0xe')][_0x5654('0x95')](util[_0x5654('0x51')](_0x5654('0x94'),_0x203a8b,_0x2fbaa6),_0x3d5cae[_0x2fbaa6]);}}}}};AGIVertices[_0x5654('0x10')]['replaceObjectAllVariables']=function(_0xb904e2){try{var _0x77529a=JSON[_0x5654('0x67')](_0xb904e2);this[_0x5654('0x8f')](_0x77529a);return JSON[_0x5654('0x70')](_0x77529a);}catch(_0x1c78f9){return this[_0x5654('0x8e')](_0xb904e2);}};AGIVertices[_0x5654('0x10')]['replaceAllVariables']=function(_0x3831d2){var _0x863334=_0x3831d2[_0x5654('0x96')]('{');for(var _0x4b1b4f=0x1;_0x4b1b4f<_0x863334['length'];_0x4b1b4f+=0x1){var _0x3ad36c=_0x863334[_0x4b1b4f][_0x5654('0x96')]('}');if(_0x3ad36c[_0x5654('0x93')]>0x1){_0x3831d2=_0x3831d2[_0x5654('0x97')]('{'+_0x3ad36c[0x0]+'}',this[_0x5654('0xe')][_0x5654('0x11')](_0x3ad36c[0x0])[_0x5654('0x98')]||_0x3ad36c[0x0]);}}if(_0x863334[_0x5654('0x93')]===0x1){return _0x3831d2[_0x5654('0x47')]();}return this[_0x5654('0x8e')](_0x3831d2);};AGIVertices[_0x5654('0x10')][_0x5654('0x99')]=function(_0x52f99c,_0x2acfa9){var _0x55c2fc=this[_0x5654('0xe')][_0x5654('0x11')](_0x52f99c);if(_0x55c2fc[_0x5654('0x9a')]===-0x1){return _0x55c2fc;}logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x9b'),_0x2acfa9,_0x55c2fc['extra']));return this[_0x5654('0xe')][_0x5654('0x95')](_0x2acfa9,_0x55c2fc['extra']);};AGIVertices[_0x5654('0x10')][_0x5654('0x7d')]=function(_0x1ac89b){return _0x1ac89b&&_0x1ac89b!=='0'&&_0x1ac89b!=='-1'&&_0x1ac89b!=='';};AGIVertices[_0x5654('0x10')]['maxRetry']=function(_0xfdc5f9){this[_0x5654('0x32')][_0x5654('0x6d')](this,_0xfdc5f9,'-');_0xfdc5f9[_0x5654('0x9c')]=_0xfdc5f9[_0x5654('0x9d')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x5654('0x10')]['agi']=function(_0x34b087){logger[_0x5654('0x2b')](util[_0x5654('0x51')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x34b087[_0x5654('0x9e')]));return this[_0x5654('0xe')]['agi']([_0x34b087[_0x5654('0x9f')],_0x34b087['args']]);};AGIVertices[_0x5654('0x10')][_0x5654('0xa0')]=function(_0x46badc){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0xa1'),_0x46badc[_0x5654('0x9e')]));if(this[_0x5654('0x7d')](_0x46badc[_0x5654('0x62')])){logger['info'](util[_0x5654('0x51')](_0x5654('0xa2'),_0x46badc[_0x5654('0x62')]));var _0x17678f=this[_0x5654('0xe')][_0x5654('0xa3')](_0x46badc[_0x5654('0x62')]);if(_0x17678f[_0x5654('0x9a')]===-0x1){return _0x17678f;}}return this[_0x5654('0xe')][_0x5654('0xa0')]();};AGIVertices['prototype']['callback']=function(_0x111baa){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0xa4'),_0x111baa[_0x5654('0x9e')]));if(!this['isConfigured'](_0x111baa[_0x5654('0x44')])){return this[_0x5654('0xe')][_0x5654('0x29')](_0x111baa,_0x5654('0xa5'));}_0x111baa[_0x5654('0x45')]=moment();if(this['isConfigured'](_0x111baa[_0x5654('0xa6')])){_0x111baa[_0x5654('0x45')]=moment()[_0x5654('0xa7')](_0x111baa[_0x5654('0xa6')],_0x5654('0xa8'));}if(!this['isConfigured'](_0x111baa[_0x5654('0x48')])){_0x111baa['callback_priority']=0x2;}this['createCmContact'][_0x5654('0x6d')](this,_0x111baa);return this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xaa'),_0x111baa['phone'],_0x111baa[_0x5654('0x44')],_0x111baa[_0x5654('0x45')]));};AGIVertices[_0x5654('0x10')]['custom_app']=function(_0x1464e9){logger[_0x5654('0x2b')](util['format'](_0x5654('0xab'),_0x1464e9['label']));var _0x31e01b=this['channel'][_0x5654('0xac')](_0x1464e9[_0x5654('0xad')],_0x1464e9[_0x5654('0x74')]);if(_0x31e01b[_0x5654('0x9a')]===-0x1){return _0x31e01b;}return this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xae'),_0x1464e9[_0x5654('0xad')],_0x1464e9[_0x5654('0x74')]));};AGIVertices[_0x5654('0x10')][_0x5654('0xaf')]=function(_0x47494b){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0xb0'),_0x47494b[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0x47494b[_0x5654('0x56')])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0xb1'));}var _0x2e6fc4='\x22'+_0x47494b['text']+'\x22';if(this['isConfigured'](_0x47494b[_0x5654('0x74')])){_0x2e6fc4+=','+_0x47494b[_0x5654('0x74')];}var _0x441ebf=this[_0x5654('0xe')][_0x5654('0xac')](_0x5654('0xb2'),_0x2e6fc4);if(_0x441ebf[_0x5654('0x9a')]===-0x1){return _0x441ebf;}return this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xb3'),_0x2e6fc4));};AGIVertices[_0x5654('0x10')][_0x5654('0xb4')]=function(_0x32e8be){logger['info'](util[_0x5654('0x51')](_0x5654('0xb5'),_0x32e8be[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0x32e8be[_0x5654('0x56')])){return this[_0x5654('0xe')][_0x5654('0xa9')]('no\x20text\x20configured');}var _0x115356='\x22'+_0x32e8be[_0x5654('0x56')]+'\x22';if(this['isConfigured'](_0x32e8be[_0x5654('0x74')])){_0x115356+=','+_0x32e8be[_0x5654('0x74')];}var _0x560d30=this[_0x5654('0xe')][_0x5654('0xac')]('MRCPSynth',_0x115356);if(_0x560d30['result']===-0x1){return _0x560d30;}return this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xb3'),_0x115356));};AGIVertices['prototype'][_0x5654('0xb6')]=function(_0x712d54){logger[_0x5654('0x2b')](util[_0x5654('0x51')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x712d54[_0x5654('0x9e')]));if(!this['isConfigured'](_0x712d54[_0x5654('0xb7')])){return this[_0x5654('0xe')]['noop'](_0x5654('0xb8'));}var _0x235709=_0x712d54[_0x5654('0xb7')];if(this[_0x5654('0x7d')](_0x712d54[_0x5654('0x74')])){_0x235709+=','+_0x712d54['options'];}var _0x1b8de7=this[_0x5654('0xe')][_0x5654('0xac')]('MRCPRecog',_0x235709);if(_0x1b8de7['result']===-0x1){return _0x1b8de7;}var _0x23e371=this[_0x5654('0x99')]('RECOG_CONFIDENCE()',_0x5654('0xb9'));if(_0x23e371[_0x5654('0x9a')]===-0x1){return _0x23e371;}var _0x1a7ec7=this[_0x5654('0x99')](_0x5654('0xba'),_0x5654('0xbb'));if(_0x1a7ec7[_0x5654('0x9a')]===-0x1){return _0x1a7ec7;}var _0x3ebc9d=this[_0x5654('0x99')]('RECOG_INSTANCE()',_0x5654('0xbc'));if(_0x3ebc9d[_0x5654('0x9a')]===-0x1){return _0x3ebc9d;}return this['channel'][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xbd'),_0x235709));};AGIVertices[_0x5654('0x10')][_0x5654('0xbe')]=function(_0x519c5f){logger['info'](util[_0x5654('0x51')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x519c5f['label']));if(!this[_0x5654('0x7d')](_0x519c5f[_0x5654('0xb7')])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0xb8'));}var _0x301348=_0x519c5f[_0x5654('0xb7')];if(this[_0x5654('0x7d')](_0x519c5f[_0x5654('0x74')])){_0x301348+=','+_0x519c5f[_0x5654('0x74')];}var _0x2f1a98=this['channel']['exec']('MRCPRecog',_0x301348);if(_0x2f1a98[_0x5654('0x9a')]===-0x1){return _0x2f1a98;}var _0x2612ac=this[_0x5654('0x99')](_0x5654('0xbf'),'SESTEK_ASR_CONFIDENCE');if(_0x2612ac[_0x5654('0x9a')]===-0x1){return _0x2612ac;}var _0x2f6448=this[_0x5654('0x99')]('RECOG_INPUT()',_0x5654('0xc0'));if(_0x2f6448[_0x5654('0x9a')]===-0x1){return _0x2f6448;}var _0x8acec1=this['getAndSetVariable'](_0x5654('0xc1'),_0x5654('0xc2'));if(_0x8acec1[_0x5654('0x9a')]===-0x1){return _0x8acec1;}return this[_0x5654('0xe')]['noop'](util['format'](_0x5654('0xbd'),_0x301348));};AGIVertices[_0x5654('0x10')][_0x5654('0xc3')]=function(_0x5a47fe){logger[_0x5654('0x2b')](util['format'](_0x5654('0xc4'),_0x5a47fe[_0x5654('0x9e')]));if(!this['isConfigured'](_0x5a47fe[_0x5654('0xc5')])){return this[_0x5654('0xe')][_0x5654('0x29')](_0x5a47fe,_0x5654('0xc6'));}var _0x2313d9=this[_0x5654('0xc7')][_0x5654('0x6d')](this,_0x5a47fe['odbc_id']);if(!_0x2313d9){return this[_0x5654('0xe')]['error'](_0x5a47fe,_0x5654('0xc8'));}if(!this[_0x5654('0x7d')](_0x5a47fe[_0x5654('0xc9')])){return this[_0x5654('0xe')]['error'](_0x5a47fe,_0x5654('0xca'));}var _0x3a83dc=_0x5a47fe['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xcb'),_0x3a83dc));var _0x48375b=this[_0x5654('0x27')][_0x5654('0x6d')](this,_0x2313d9,_0x3a83dc);this['createSquareDetailsReport'][_0x5654('0x6d')](this,_0x5a47fe,_0x3a83dc);if(!this[_0x5654('0x7d')](_0x5a47fe[_0x5654('0xcc')])){return this['channel'][_0x5654('0xa9')](_0x5654('0xcd'));}var _0xf9f444=this[_0x5654('0x11')][_0x5654('0x6d')](this,_0x5a47fe['variable_id']);if(!_0xf9f444){return this['channel']['error'](_0x5a47fe,_0x5654('0xce'));}var _0x1e2a9a=this;_0x48375b[_0x5654('0xcf')](function(_0x5bda88,_0x465085){Object['keys'](_0x5bda88)[_0x5654('0xcf')](function(_0x3b4aa9){_0x1e2a9a[_0x5654('0xe')]['setVariable'](util['format'](_0x5654('0xd0'),_0xf9f444,_0x465085,_0x3b4aa9),_0x5bda88[_0x3b4aa9]);});});this[_0x5654('0xe')][_0x5654('0x95')](util[_0x5654('0x51')](_0x5654('0xd1'),_0xf9f444),_0x48375b[_0x5654('0x93')]);return this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xd2'),_0xf9f444));};AGIVertices[_0x5654('0x10')]['dial']=function(_0x384f49){logger[_0x5654('0xd3')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x384f49[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0x384f49[_0x5654('0xd4')])){return this['channel'][_0x5654('0x29')](_0x384f49,'no\x20user\x20selected');}var _0x1ebe58=this[_0x5654('0x1a')][_0x5654('0x6d')](this,_0x384f49['sip_id']);if(!_0x1ebe58){return this[_0x5654('0xe')][_0x5654('0x29')](_0x384f49,'no\x20user\x20found');}var _0x407d74=this[_0x5654('0xe')]['exec'](_0x5654('0xd5'),[util['format']('SIP/%s',_0x1ebe58),_0x384f49[_0x5654('0x62')],_0x384f49[_0x5654('0xd6')],_0x384f49[_0x5654('0x60')]]);if(_0x407d74['result']===-0x1){return _0x407d74;}return this[_0x5654('0xe')]['noop'](util[_0x5654('0x51')](_0x5654('0xd7'),_0x5654('0xd5')));};AGIVertices['prototype'][_0x5654('0xd8')]=function(_0x4348d2){logger[_0x5654('0x2b')](util['format'](_0x5654('0xd9'),_0x4348d2[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0x4348d2[_0x5654('0x78')])){return this[_0x5654('0xe')]['noop'](_0x5654('0xda'));}if(!this[_0x5654('0x7d')](_0x4348d2['text'])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0xb1'));}this['channel'][_0x5654('0xdb')]=!![];this[_0x5654('0x32')](_0x4348d2);this[_0x5654('0x3d')](_0x4348d2[_0x5654('0x56')],'in');this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xdc'),_0x4348d2['text']));var _0x14cd46=this['googleDialogflow']['sync'](this,_0x4348d2);if(_0x14cd46){for(var _0x259d2e in _0x14cd46){if(_0x14cd46[_0x5654('0x8c')](_0x259d2e)){this['channel']['setVariable'](util[_0x5654('0x51')](_0x5654('0xdd'),_0x259d2e[_0x5654('0xde')]()),_0x14cd46[_0x259d2e]);}}this['createSquareMessage'](_0x14cd46[_0x5654('0xdf')],_0x5654('0xe0'));return this[_0x5654('0xe')][_0x5654('0xa9')](util['format'](_0x5654('0xe1'),_0x14cd46[_0x5654('0xdf')]));}return this[_0x5654('0xe')][_0x5654('0x29')](_0x4348d2,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x5654('0x10')][_0x5654('0xe2')]=function(_0x2cc7af){logger['info'](util[_0x5654('0x51')](_0x5654('0xe3'),_0x2cc7af[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0x2cc7af[_0x5654('0xe4')])){return this['channel'][_0x5654('0xa9')](_0x5654('0xe5'));}if(!this[_0x5654('0x7d')](_0x2cc7af[_0x5654('0xe6')])){return this['channel']['noop'](_0x5654('0xe7'));}if(!this[_0x5654('0x7d')](_0x2cc7af[_0x5654('0xe8')])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0xe9'));}if(!this[_0x5654('0x7d')](_0x2cc7af['ndassistant_url'])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0xb1'));}this[_0x5654('0xe')][_0x5654('0xdb')]=!![];this[_0x5654('0x32')](_0x2cc7af);this[_0x5654('0x3d')](_0x2cc7af['text'],'in');this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xea'),_0x2cc7af[_0x5654('0x56')]));var _0x19732f=this['sestekNDA'][_0x5654('0x6d')](this,_0x2cc7af);if(_0x19732f){for(var _0x3482fd in _0x19732f){if(_0x19732f[_0x5654('0x8c')](_0x3482fd)){this['channel'][_0x5654('0x95')](util[_0x5654('0x51')](_0x5654('0xeb'),_0x3482fd[_0x5654('0xde')]()),_0x19732f[_0x3482fd]);}}this[_0x5654('0x3d')](_0x19732f[_0x5654('0xdf')],_0x5654('0xe0'));if(_0x19732f['audiofile']){this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x19732f[_0x5654('0xec')]));var _0x182862=this[_0x5654('0xe')][_0x5654('0xed')](_0x19732f['audiofile']);try{fs[_0x5654('0xee')](_0x19732f['audiofile']+'.wav');}catch(_0x3b9db3){logger[_0x5654('0x29')](_0x3b9db3);}return _0x182862;}else{return this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xef'),_0x19732f[_0x5654('0xdf')]));}}return this[_0x5654('0xe')][_0x5654('0x29')](_0x2cc7af,_0x5654('0xf0'));};AGIVertices['prototype'][_0x5654('0xf1')]=function(_0x1f8175){logger[_0x5654('0x2b')](util['format'](_0x5654('0xf2'),_0x1f8175['label']));return this['channel'][_0x5654('0xa9')](_0x5654('0xf1'));};AGIVertices[_0x5654('0x10')][_0x5654('0xf3')]=function(_0x5e6472){logger['info'](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x5e6472['label']));var _0x549fa2='';if(_0x5e6472[_0x5654('0xf4')]){if(!this[_0x5654('0x7d')](_0x5e6472[_0x5654('0xf4')])){return this[_0x5654('0xe')][_0x5654('0x29')](_0x5e6472,_0x5654('0xf5'));}else{var _0x458490=parseInt(_0x5e6472[_0x5654('0xf4')],0xa);if(isNaN(_0x458490)){_0x549fa2=_0x5e6472[_0x5654('0xf4')];}else{_0x549fa2=this[_0x5654('0xf6')]['sync'](this,_0x5e6472[_0x5654('0xf4')]);if(!_0x549fa2){return this['channel'][_0x5654('0x29')](_0x5e6472,_0x5654('0xf7'));}}}}else if(_0x5e6472['trunk_name']){_0x549fa2=_0x5e6472[_0x5654('0xf8')];}else{return this[_0x5654('0xe')]['error'](_0x5e6472,_0x5654('0xf5'));}var _0x4a381a=this[_0x5654('0xe')][_0x5654('0xac')](_0x5654('0xd5'),[util[_0x5654('0x51')](_0x5654('0xf9'),_0x549fa2,_0x5e6472[_0x5654('0x43')]),_0x5e6472[_0x5654('0x62')],_0x5e6472[_0x5654('0xd6')],_0x5e6472[_0x5654('0x60')]]);if(_0x4a381a[_0x5654('0x9a')]===-0x1){return _0x4a381a;}return this['channel'][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xd7'),_0x5654('0xd5')));};AGIVertices[_0x5654('0x10')]['finally']=function(_0x112d85){logger[_0x5654('0x2b')](util['format'](_0x5654('0xfa'),_0x112d85['label']));return this[_0x5654('0xe')][_0x5654('0xa9')]('finally');};AGIVertices['prototype'][_0x5654('0xc')]=function(_0x352f70){logger[_0x5654('0x2b')](util[_0x5654('0x51')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x352f70[_0x5654('0x9e')]));if(_0x352f70[_0x5654('0x9c')]===0x0){return this['maxRetry'](_0x352f70);}_0x352f70['retry']-=0x1;if(!this[_0x5654('0x7d')](_0x352f70['file_id'])){return this[_0x5654('0xe')][_0x5654('0x29')](_0x352f70,'no\x20file\x20audio\x20selected');}var _0x19e179=this['getSound']['sync'](this,_0x352f70[_0x5654('0xfb')]);if(!_0x19e179){return this[_0x5654('0xe')][_0x5654('0x29')](_0x352f70,_0x5654('0xfc'));}if(!this['isConfigured'](_0x352f70[_0x5654('0xcc')])){return this['channel']['error'](_0x5654('0xcd'));}var _0x268ab8=this[_0x5654('0xe')]['getData'](_0x19e179,_0x352f70['response'],_0x352f70[_0x5654('0xfd')]);var _0xcf87dc=_0x268ab8[_0x5654('0x9a')]?_0x268ab8[_0x5654('0x9a')]['toString']():'';logger[_0x5654('0x2b')](_0x5654('0xfe'),JSON[_0x5654('0x70')](_0x268ab8));if(_0x268ab8[_0x5654('0x9a')]===-0x1){this[_0x5654('0x32')]['sync'](this,_0x352f70,_0xcf87dc);return _0x268ab8;}else if(_0x268ab8[_0x5654('0x98')]==='timeout'){_0x268ab8[_0x5654('0x9a')]=_0xcf87dc[_0x5654('0x93')]>=parseInt(_0x352f70[_0x5654('0xff')])?'x':'i';}else{_0x268ab8[_0x5654('0x9a')]=_0xcf87dc['length']>=parseInt(_0x352f70[_0x5654('0xff')])&&_0xcf87dc['length']<=parseInt(_0x352f70[_0x5654('0xfd')])?'x':'i';}var _0x57233c=this[_0x5654('0x11')][_0x5654('0x6d')](this,_0x352f70[_0x5654('0xcc')]);if(!_0x57233c){return this[_0x5654('0xe')][_0x5654('0x29')](_0x352f70,_0x5654('0xce'));}this[_0x5654('0xe')][_0x5654('0x95')](_0x57233c,_0xcf87dc);if(this[_0x5654('0x7d')](_0x352f70[_0x5654('0x100')])){var _0x19f005=parseInt(_0x352f70[_0x5654('0x100')],0xa);var _0x4d4297=rs[_0x5654('0x101')]({'charset':'*','length':_0x19f005});var _0x135e46=_0xcf87dc['length'];if(_0x135e46>0x0){if(_0x135e46>_0x19f005){this[_0x5654('0x32')][_0x5654('0x6d')](this,_0x352f70,_0x352f70[_0x5654('0x102')]===_0x5654('0x103')?_0x4d4297+_0xcf87dc['substr'](_0x19f005):_0xcf87dc[_0x5654('0x104')](0x0,_0x135e46-_0x19f005)+_0x4d4297);}else{this['createSquareDetailsReport'][_0x5654('0x6d')](this,_0x352f70,rs['generate']({'charset':'*','length':_0x135e46}));}}else{this[_0x5654('0x32')][_0x5654('0x6d')](this,_0x352f70,'');}}else{this['createSquareDetailsReport'][_0x5654('0x6d')](this,_0x352f70,_0xcf87dc);}return _0x268ab8;};AGIVertices[_0x5654('0x10')][_0x5654('0xd')]=function(_0x3d4a97){logger[_0x5654('0x2b')](util[_0x5654('0x51')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x3d4a97[_0x5654('0x9e')]));return this[_0x5654('0xc')](_0x3d4a97);};AGIVertices[_0x5654('0x10')][_0x5654('0x105')]=function(_0x4b4830){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x106'),_0x4b4830['label']));this[_0x5654('0x32')][_0x5654('0x6d')](this,_0x4b4830,_0x4b4830['goalname']);return this['channel'][_0x5654('0xa9')](util['format'](_0x5654('0x107'),_0x4b4830[_0x5654('0x108')]));};AGIVertices[_0x5654('0x10')]['awspolly']=function(_0x139702){logger[_0x5654('0x2b')](util['format'](_0x5654('0x109'),_0x139702['label']));if(!this[_0x5654('0x7d')](_0x139702['aws_access_key_id'])||!this[_0x5654('0x7d')](_0x139702['aws_secret_access_key'])){return this[_0x5654('0xe')][_0x5654('0xa9')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x5654('0x7d')](_0x139702['text'])){return this[_0x5654('0xe')]['noop']('no\x20text\x20configured');}this[_0x5654('0xe')][_0x5654('0xa9')](util['format'](_0x5654('0x10a'),_0x139702[_0x5654('0x56')]));var _0x54a9cd=this[_0x5654('0x7f')][_0x5654('0x6d')](this,_0x139702);if(_0x54a9cd){this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0x10b'),_0x54a9cd));var _0x4beb2b=this[_0x5654('0xe')][_0x5654('0xed')](_0x54a9cd);try{fs[_0x5654('0xee')](_0x54a9cd+_0x5654('0x10c'));}catch(_0x6ebef8){logger[_0x5654('0x29')](_0x6ebef8);}return _0x4beb2b;}return this[_0x5654('0xe')]['error'](_0x139702,_0x5654('0x10d'));};AGIVertices[_0x5654('0x10')][_0x5654('0x10e')]=function(_0x11daa6){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x10f'),_0x11daa6['label']));if(!this[_0x5654('0x7d')](_0x11daa6[_0x5654('0x80')])||!this[_0x5654('0x7d')](_0x11daa6[_0x5654('0x85')])){return this['channel'][_0x5654('0xa9')](_0x5654('0x110'));}if(!this[_0x5654('0x7d')](_0x11daa6['aws_bot_name'])){return this[_0x5654('0xe')]['noop'](_0x5654('0x111'));}if(!this[_0x5654('0x7d')](_0x11daa6['text'])){return this['channel'][_0x5654('0xa9')](_0x5654('0xb1'));}this[_0x5654('0xe')][_0x5654('0xdb')]=!![];this[_0x5654('0x32')](_0x11daa6);this[_0x5654('0x3d')](_0x11daa6[_0x5654('0x56')],'in');this['channel']['noop'](util[_0x5654('0x51')]('Trying\x20Amazon\x20Lex:\x20%s',_0x11daa6[_0x5654('0x56')]));var _0x34931a=this[_0x5654('0x84')][_0x5654('0x6d')](this,_0x11daa6);if(_0x34931a){for(var _0x32bb4c in _0x34931a){if(_0x34931a['hasOwnProperty'](_0x32bb4c)&&_['isString'](_0x34931a[_0x32bb4c])){this[_0x5654('0xe')][_0x5654('0x95')](util[_0x5654('0x51')]('AWS_LEX_%s',_0x32bb4c[_0x5654('0xde')]()),_0x34931a[_0x32bb4c]);}}if(_['isNil'](_0x34931a[_0x5654('0x73')])){return this['channel'][_0x5654('0xa9')](_0x5654('0x112'));}else{this[_0x5654('0x3d')](_0x34931a[_0x5654('0x73')],_0x5654('0xe0'));return this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0x113'),_0x34931a[_0x5654('0x73')]));}}return this[_0x5654('0xe')][_0x5654('0x29')](_0x11daa6,_0x5654('0x114'));};AGIVertices[_0x5654('0x10')][_0x5654('0x115')]=function(_0x4111bc){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x116'),_0x4111bc[_0x5654('0x9e')],_0x4111bc['timeout']));if(!this[_0x5654('0x7d')](_0x4111bc[_0x5654('0x78')])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0xda'));}var _0x58cdc0=_0x5654('0x117');var _0x35809f=util[_0x5654('0x51')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x5ab830=util['format'](_0x5654('0x94'),_0x35809f,_0x58cdc0);var _0x46f2ca=!![];if(_0x4111bc[_0x5654('0x118')]==='NOBEEP'){_0x46f2ca=![];}var _0x4151fe=this[_0x5654('0xe')]['recordFile'](_0x35809f,_0x58cdc0,_0x4111bc[_0x5654('0x119')],_0x4111bc[_0x5654('0x62')],undefined,_0x46f2ca);if(_0x4151fe[_0x5654('0x9a')]!==-0x1){this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')]('google\x20%s\x20file\x20created',_0x5ab830));var _0x5b1a38=this[_0x5654('0x87')][_0x5654('0x6d')](this,_0x4111bc,_0x5ab830);if(_0x5b1a38){for(var _0x56a581 in _0x5b1a38){if(_0x5b1a38[_0x5654('0x8c')](_0x56a581)){this[_0x5654('0xe')][_0x5654('0x95')](util[_0x5654('0x51')](_0x5654('0x11a'),_0x56a581['toUpperCase']()),_0x5b1a38[_0x56a581]);}}return this['channel']['noop'](util[_0x5654('0x51')]('GoogleASR\x20Result\x20%s',JSON[_0x5654('0x70')](_0x5b1a38)));}}return _0x4151fe;};AGIVertices[_0x5654('0x10')]['tildeasr']=function(_0xb6725c){logger[_0x5654('0x2b')](util['format'](_0x5654('0x11b'),_0xb6725c[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0xb6725c[_0x5654('0x11c')])){return this['channel'][_0x5654('0xa9')](_0x5654('0x11d'));}if(!this[_0x5654('0x7d')](_0xb6725c['appsecret'])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0x11e'));}var _0x255da1='wav';var _0xa05577=util[_0x5654('0x51')](_0x5654('0x11f'),FILES_PATH,rs[_0x5654('0x101')](0x4));var _0x3f291f=util[_0x5654('0x51')](_0x5654('0x94'),_0xa05577,_0x255da1);var _0x2e289e=!![];if(_0xb6725c[_0x5654('0x118')]===_0x5654('0x120')){_0x2e289e=![];}var _0x139425=this[_0x5654('0xe')][_0x5654('0x121')](_0xa05577,_0x255da1,_0xb6725c['intKey'],_0xb6725c[_0x5654('0x62')],undefined,_0x2e289e);if(_0x139425[_0x5654('0x9a')]!==-0x1){this['channel']['noop'](util['format'](_0x5654('0x122'),_0x3f291f));var _0xbaf0a1=this[_0x5654('0x89')][_0x5654('0x6d')](this,_0xb6725c,_0x3f291f);if(_0xbaf0a1){for(var _0x4880d8 in _0xbaf0a1){if(_0xbaf0a1[_0x5654('0x8c')](_0x4880d8)){this['channel'][_0x5654('0x95')](util['format'](_0x5654('0x123'),_0x4880d8[_0x5654('0xde')]()),_0xbaf0a1[_0x4880d8]);}}return this['channel'][_0x5654('0xa9')](util['format'](_0x5654('0x124'),JSON[_0x5654('0x70')](_0xbaf0a1)));}}return _0x139425;};AGIVertices[_0x5654('0x10')][_0x5654('0x125')]=function(_0x279d58){logger[_0x5654('0x2b')](util[_0x5654('0x51')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x279d58[_0x5654('0x9e')]));return this['channel']['continueAt'](_0x279d58[_0x5654('0x38')],_0x279d58[_0x5654('0x126')],_0x279d58['priority']);};AGIVertices[_0x5654('0x10')]['gotoif']=function(_0xd78e23){logger['info'](util['format'](_0x5654('0x127'),_0xd78e23[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0xd78e23['condition'])){return this[_0x5654('0xe')]['error'](_0xd78e23,'no\x20condition\x20configured');}try{var _0x56fb98=eval(_0xd78e23[_0x5654('0x128')])?'true':_0x5654('0x129');this['channel'][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0x12a'),_0xd78e23[_0x5654('0x128')],_0x56fb98));return{'code':0xc8,'result':_0x56fb98};}catch(_0x1e5ca0){return{'code':0xc8,'result':_0x5654('0x129')};}};AGIVertices[_0x5654('0x10')][_0x5654('0x12b')]=function(_0x59f0b9){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x12c'),_0x59f0b9[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0x59f0b9['interval_id'])){return this[_0x5654('0xe')]['error'](_0x59f0b9,_0x5654('0x12d'));}var _0x45a774=this[_0x5654('0x21')]['sync'](this,_0x59f0b9[_0x5654('0x12e')]);if(!_0x45a774){return this['channel'][_0x5654('0x29')](_0x59f0b9,_0x5654('0x12f'));}for(var _0x2cba73=0x0;_0x2cba73<_0x45a774[_0x5654('0x93')];_0x2cba73+=0x1){var _0x1bcc4e=this[_0x5654('0xe')]['getVariable'](util[_0x5654('0x51')](_0x5654('0x130'),_0x45a774[_0x2cba73]));if(_0x1bcc4e[_0x5654('0x9a')]===-0x1){return _0x1bcc4e;}logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x131'),_0x45a774[_0x2cba73],_0x1bcc4e[_0x5654('0x98')]));if(_0x1bcc4e[_0x5654('0x98')]===_0x5654('0x132')){logger[_0x5654('0x2b')](util['format'](_0x5654('0x131'),_0x45a774[_0x2cba73],_0x5654('0x132')));this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0x131'),_0x45a774[_0x2cba73],_0x5654('0x132')));return{'code':0xc8,'result':_0x5654('0x132')};}else{logger['info'](util[_0x5654('0x51')]('IFTIME\x20%s\x20%s',_0x45a774[_0x2cba73],'false'));this[_0x5654('0xe')]['noop'](util[_0x5654('0x51')](_0x5654('0x131'),_0x45a774[_0x2cba73],_0x5654('0x129')));}}return{'code':0xc8,'result':_0x5654('0x129')};};AGIVertices[_0x5654('0x10')][_0x5654('0x133')]=function(_0x116cd7){logger['info'](util[_0x5654('0x51')](_0x5654('0x134'),_0x116cd7[_0x5654('0x9e')]));return this[_0x5654('0xe')][_0x5654('0x133')]();};AGIVertices['prototype'][_0x5654('0x135')]=function(_0x4e4a00){logger[_0x5654('0x2b')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x4e4a00['label']));if(!this[_0x5654('0x7d')](_0x4e4a00[_0x5654('0x78')])){return this['channel'][_0x5654('0xa9')](_0x5654('0xda'));}var _0x4f2538='wav';var _0x57826c=util[_0x5654('0x51')](_0x5654('0x11f'),FILES_PATH,rs[_0x5654('0x101')](0x4));var _0x2bc3d4=util[_0x5654('0x51')](_0x5654('0x94'),_0x57826c,_0x4f2538);var _0x7b2b34=!![];if(_0x4e4a00[_0x5654('0x118')]==='NOBEEP'){_0x7b2b34=![];}var _0x41aeb7=this[_0x5654('0xe')]['recordFile'](_0x57826c,_0x4f2538,_0x4e4a00[_0x5654('0x119')],_0x4e4a00['timeout'],undefined,_0x7b2b34);if(_0x41aeb7[_0x5654('0x9a')]!==-0x1){this[_0x5654('0xe')]['noop'](util['format'](_0x5654('0x136'),_0x2bc3d4));var _0x167fc4=this[_0x5654('0x7b')][_0x5654('0x6d')](this,_0x4e4a00,_0x2bc3d4);if(_0x167fc4){for(var _0x2b2876 in _0x167fc4){if(_0x167fc4[_0x5654('0x8c')](_0x2b2876)){this[_0x5654('0xe')][_0x5654('0x95')](util[_0x5654('0x51')](_0x5654('0x137'),_0x2b2876[_0x5654('0xde')]()),_0x167fc4[_0x2b2876]);}}return this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0x138'),JSON[_0x5654('0x70')](_0x167fc4)));}}return _0x41aeb7;};AGIVertices[_0x5654('0x10')][_0x5654('0x139')]=function(_0x332ecb){logger[_0x5654('0x2b')](util[_0x5654('0x51')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x332ecb[_0x5654('0x9e')]));if(!this['isConfigured'](_0x332ecb['key'])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0xda'));}if(!this[_0x5654('0x7d')](_0x332ecb['text'])){return this['channel'][_0x5654('0xa9')](_0x5654('0xb1'));}this[_0x5654('0xe')][_0x5654('0xa9')](util['format'](_0x5654('0x13a'),_0x332ecb[_0x5654('0x56')]));var _0x4f8d79=this['ispeechTTS'][_0x5654('0x6d')](this,_0x332ecb);if(_0x4f8d79){this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0x136'),_0x4f8d79));var _0x205069=this['channel'][_0x5654('0xed')](_0x4f8d79,_0x332ecb[_0x5654('0x119')]);try{fs[_0x5654('0xee')](_0x4f8d79+_0x5654('0x10c'));}catch(_0x3b9306){logger['error'](_0x3b9306);}return _0x205069;}return this[_0x5654('0xe')][_0x5654('0x29')](_0x332ecb,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x5654('0x10')][_0x5654('0x13b')]=function(_0x4f6e65){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x13c'),_0x4f6e65[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0x4f6e65['findBy'])){return this[_0x5654('0xe')][_0x5654('0x29')](_0x4f6e65,_0x5654('0x13d'));}logger[_0x5654('0x2b')](util[_0x5654('0x51')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x5654('0xe')]['callerid'],_0x4f6e65[_0x5654('0x13e')]));var _0x3f0200=this['agentLogin'][_0x5654('0x6d')](this,_0x4f6e65[_0x5654('0x13e')]);if(_0x3f0200){logger[_0x5654('0x2b')](util['format'](_0x5654('0x13f'),this[_0x5654('0xe')][_0x5654('0x35')],_0x4f6e65[_0x5654('0x13e')]));this[_0x5654('0xe')]['noop'](util[_0x5654('0x51')](_0x5654('0x13f'),this[_0x5654('0xe')][_0x5654('0x35')],_0x4f6e65[_0x5654('0x13e')]));return{'code':0xc8,'result':_0x5654('0x140')};}else{logger[_0x5654('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5654('0xe')][_0x5654('0x35')],_0x4f6e65[_0x5654('0x13e')]));this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x5654('0xe')][_0x5654('0x35')],_0x4f6e65[_0x5654('0x13e')]));return{'code':0xc8,'result':_0x5654('0x141')};}};AGIVertices[_0x5654('0x10')]['logout']=function(_0x4919f5){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x142'),_0x4919f5['label']));if(!this['isConfigured'](_0x4919f5[_0x5654('0x13e')])){return this['channel'][_0x5654('0x29')](_0x4919f5,_0x5654('0x13d'));}logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x143'),this['channel'][_0x5654('0x35')],_0x4919f5['findBy']));var _0x134023=this['agentLogout'][_0x5654('0x6d')](this,_0x4919f5[_0x5654('0x13e')]);if(_0x134023){logger[_0x5654('0x2b')](util['format'](_0x5654('0x13f'),this['channel'][_0x5654('0x35')],_0x4919f5[_0x5654('0x13e')]));this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0x13f'),this[_0x5654('0xe')][_0x5654('0x35')],_0x4919f5[_0x5654('0x13e')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x5654('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x5654('0x35')],_0x4919f5['findBy']));this[_0x5654('0xe')]['noop'](util[_0x5654('0x51')](_0x5654('0x144'),this['channel'][_0x5654('0x35')],_0x4919f5[_0x5654('0x13e')]));return{'code':0xc8,'result':_0x5654('0x141')};}};AGIVertices[_0x5654('0x10')]['math']=function(_0x370687){logger['info'](util[_0x5654('0x51')](_0x5654('0x145'),_0x370687['label']));if(!this[_0x5654('0x7d')](_0x370687[_0x5654('0x146')])){return this[_0x5654('0xe')][_0x5654('0x29')](_0x370687,'no\x20operation\x20configured');}this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')]('math\x20%s',_0x370687[_0x5654('0x146')]));var _0xb768fa=eval(_0x370687[_0x5654('0x146')]);if(!this['isConfigured'](_0x370687[_0x5654('0xcc')])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0xcd'));}var _0xa59f0f=this[_0x5654('0x11')][_0x5654('0x6d')](this,_0x370687[_0x5654('0xcc')]);if(!_0xa59f0f){return this[_0x5654('0xe')][_0x5654('0x29')](_0x370687,_0x5654('0xce'));}if(_[_0x5654('0x92')](_0xb768fa)){var _0xf88841=this;_0xb768fa['forEach'](function(_0x55776e,_0x3c9177){_0xf88841[_0x5654('0xe')][_0x5654('0x95')](util['format'](_0x5654('0x147'),_0xa59f0f,_0x3c9177),_0x55776e);});return this[_0x5654('0xe')]['noop'](util[_0x5654('0x51')]('variable\x20%s[key]\x20set',_0xa59f0f));}else{return this[_0x5654('0xe')]['setVariable'](_0xa59f0f,_0xb768fa);}};AGIVertices['prototype'][_0x5654('0x148')]=function(_0x369a05){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x149'),_0x369a05[_0x5654('0x9e')]));if(_0x369a05[_0x5654('0x9c')]===0x0){return this[_0x5654('0x9d')](_0x369a05);}_0x369a05[_0x5654('0x9c')]-=0x1;if(!this[_0x5654('0x7d')](_0x369a05[_0x5654('0xfb')])){return this['channel'][_0x5654('0x29')](_0x369a05,_0x5654('0x14a'));}var _0x4a774f=this[_0x5654('0x1c')][_0x5654('0x6d')](this,_0x369a05[_0x5654('0xfb')]);if(!_0x4a774f){return this[_0x5654('0xe')][_0x5654('0x29')](_0x369a05,_0x5654('0xfc'));}var _0x2d3524=this[_0x5654('0xe')][_0x5654('0x14b')](_0x4a774f,_0x369a05[_0x5654('0x14c')],_0x369a05[_0x5654('0x14d')]);var _0xfc5c01=_0x2d3524[_0x5654('0x9a')];if(_0x2d3524[_0x5654('0x9a')]===-0x1){this[_0x5654('0x32')][_0x5654('0x6d')](this,_0x369a05,'-1');return _0x2d3524;}else if(_0x2d3524[_0x5654('0x98')]==='timeout'){_0x2d3524[_0x5654('0x9a')]=_0x2d3524['result'][_0x5654('0x93')]>0x0?_0x2d3524[_0x5654('0x9a')]:'t';}else if(_['isEmpty'](_0x2d3524[_0x5654('0x9a')])){_0x2d3524[_0x5654('0x9a')]='#';_0xfc5c01='#';}if(!this[_0x5654('0x7d')](_0x369a05[_0x5654('0xcc')])){this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0xcd'));}else{var _0x370b5b=this['getVariable'][_0x5654('0x6d')](this,_0x369a05[_0x5654('0xcc')]);if(!_0x370b5b){return this[_0x5654('0xe')]['error'](_0x369a05,_0x5654('0xce'));}this['channel'][_0x5654('0x95')](_0x370b5b,_0xfc5c01);}this[_0x5654('0x32')][_0x5654('0x6d')](this,_0x369a05,_0xfc5c01);return _0x2d3524;};AGIVertices[_0x5654('0x10')][_0x5654('0xa9')]=function(_0x52a95c){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x14e'),_0x52a95c[_0x5654('0x9e')]));return this[_0x5654('0xe')][_0x5654('0xa9')](_0x52a95c[_0x5654('0x14f')]||_0x52a95c[_0x5654('0x9e')]);};AGIVertices[_0x5654('0x10')][_0x5654('0x150')]=function(_0x430802){logger['info'](util[_0x5654('0x51')](_0x5654('0x151'),_0x430802['label']));if(!this[_0x5654('0x7d')](_0x430802[_0x5654('0x13e')])){return this['channel']['error'](_0x430802,_0x5654('0x13d'));}logger['info'](util[_0x5654('0x51')](_0x5654('0x143'),this[_0x5654('0xe')][_0x5654('0x35')],_0x430802['findBy']));var _0x1cae43=this[_0x5654('0x49')][_0x5654('0x6d')](this,_0x430802['pause_id']);var _0x3dc69f=this[_0x5654('0x4c')][_0x5654('0x6d')](this,_0x430802[_0x5654('0x13e')],_0x1cae43);if(_0x3dc69f){logger[_0x5654('0x2b')](util[_0x5654('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5654('0xe')]['callerid'],_0x430802[_0x5654('0x13e')]));this['channel'][_0x5654('0xa9')](util[_0x5654('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x5654('0xe')][_0x5654('0x35')],_0x430802[_0x5654('0x13e')]));return{'code':0xc8,'result':_0x5654('0x140')};}else{logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x144'),this[_0x5654('0xe')][_0x5654('0x35')],_0x430802['findBy']));this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0x13f'),this[_0x5654('0xe')][_0x5654('0x35')],_0x430802[_0x5654('0x13e')]));return{'code':0xc8,'result':_0x5654('0x141')};}};AGIVertices[_0x5654('0x10')][_0x5654('0x152')]=function(_0x56acb2){logger[_0x5654('0x2b')](util[_0x5654('0x51')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x56acb2['label']));if(!this['isConfigured'](_0x56acb2[_0x5654('0xfb')])){return this[_0x5654('0xe')][_0x5654('0x29')](_0x56acb2,_0x5654('0x14a'));}var _0x4a701f=this[_0x5654('0x1c')][_0x5654('0x6d')](this,_0x56acb2[_0x5654('0xfb')]);if(!_0x4a701f){return this[_0x5654('0xe')][_0x5654('0x29')](_0x56acb2,_0x5654('0xfc'));}var _0x6df6=this[_0x5654('0xe')]['exec']('PLAYBACK',[_0x4a701f,_0x56acb2[_0x5654('0xd6')]]);if(_0x6df6[_0x5654('0x9a')]===-0x1){return _0x6df6;}return this[_0x5654('0xe')][_0x5654('0xa9')](util['format'](_0x5654('0xae'),_0x5654('0x153'),_0x4a701f));};AGIVertices[_0x5654('0x10')][_0x5654('0x154')]=function(_0x49c417){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x155'),_0x49c417[_0x5654('0x9e')]));if(!this['isConfigured'](_0x49c417[_0x5654('0x156')])){return this[_0x5654('0xe')][_0x5654('0x29')](_0x49c417,'no\x20queue\x20selected');}var _0x89ff11='';var _0x1c3999=parseInt(_0x49c417[_0x5654('0x156')],0xa);if(isNaN(_0x1c3999)){_0x89ff11=_0x49c417[_0x5654('0x156')];}else{_0x89ff11=this[_0x5654('0x16')][_0x5654('0x6d')](this,_0x49c417['queue_id']);if(!_0x89ff11){return this[_0x5654('0xe')]['error'](_0x49c417,'no\x20queue\x20found');}}var _0x320c87='';if(this[_0x5654('0x7d')](_0x49c417['file_id'])){var _0x450892=this[_0x5654('0x1c')]['sync'](this,_0x49c417[_0x5654('0xfb')]);if(_0x450892){_0x320c87=_0x450892;}}this[_0x5654('0x32')][_0x5654('0x6d')](this,_0x49c417,_0x89ff11);if(_0x49c417['opts']['indexOf']('x')<0x0){_0x49c417[_0x5654('0xd6')]+='x';}if(_0x49c417[_0x5654('0xd6')][_0x5654('0x157')]('X')<0x0){_0x49c417[_0x5654('0xd6')]+='X';}this['channel'][_0x5654('0x95')](_0x5654('0x158'),_0x89ff11?_0x89ff11[_0x5654('0x159')]():'');var _0x4786e5=this[_0x5654('0xe')][_0x5654('0xac')]('QUEUE',[_0x89ff11,_0x49c417[_0x5654('0xd6')],_0x49c417[_0x5654('0x60')],_0x320c87,_0x49c417['timeout'],_0x49c417[_0x5654('0x7')],_0x49c417[_0x5654('0x15a')],_0x49c417[_0x5654('0x15b')],'',_0x49c417[_0x5654('0x15c')]]);if(_0x4786e5[_0x5654('0x9a')]===-0x1){return _0x4786e5;}return this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xae'),_0x5654('0x15d'),_0x89ff11));};AGIVertices[_0x5654('0x10')]['record']=function(_0x4582e6){logger[_0x5654('0x2b')](util['format'](_0x5654('0x15e'),_0x4582e6[_0x5654('0x9e')]));var _0xe363a3=_0x4582e6[_0x5654('0x15f')]||_0x5654('0x117');var _0xc07dec=util['format'](_0x5654('0x160'),this[_0x5654('0xe')][_0x5654('0x33')],rs[_0x5654('0x101')](0x5));var _0x2f42df=util[_0x5654('0x51')](_0x5654('0x161'),FILES_PATH,_0xc07dec,_0xe363a3);var _0xdf3ec0=util['format'](_0x5654('0x11f'),FILES_PATH,_0xc07dec);this[_0x5654('0x36')][_0x5654('0x6d')](this,_0x4582e6,_0xc07dec,_0x2f42df);this['channel'][_0x5654('0x95')](_0x5654('0x162'),_0xc07dec);logger[_0x5654('0x2b')](_0x5654('0x163'),_0xdf3ec0,_0xe363a3,_0x4582e6[_0x5654('0x164')],_0x4582e6[_0x5654('0x62')]);return this['channel'][_0x5654('0x121')](_0xdf3ec0,_0xe363a3,_0x4582e6[_0x5654('0x164')],_0x4582e6[_0x5654('0x62')],undefined,!![]);};AGIVertices[_0x5654('0x10')][_0x5654('0x165')]=function(_0x58e67c){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x166'),_0x58e67c[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0x58e67c['url'])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0x167'));}var _0x546dce=this[_0x5654('0x5f')][_0x5654('0x6d')](this,_0x58e67c);logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x168'),util['inspect'](_0x546dce,{'showHidden':![],'depth':null})));if(!this[_0x5654('0x7d')](_0x58e67c[_0x5654('0xcc')])){return this['channel'][_0x5654('0xa9')](_0x5654('0x169'));}var _0xdf44df=this[_0x5654('0x11')][_0x5654('0x6d')](this,_0x58e67c[_0x5654('0xcc')]);if(!_0xdf44df){return this[_0x5654('0xe')][_0x5654('0x29')](_0x58e67c,'no\x20variable\x20found');}this[_0x5654('0xe')][_0x5654('0x95')](util[_0x5654('0x51')](_0x5654('0x16a'),_0xdf44df),_0x546dce[_0x5654('0x71')]?_0x546dce[_0x5654('0x71')]:'200');this[_0x5654('0xe')][_0x5654('0x95')](util[_0x5654('0x51')]('%s_STATUS_MESSAGE',_0xdf44df),_0x546dce[_0x5654('0x72')]?_0x546dce['statusMessage']:'OK');if(_0x546dce[_0x5654('0x66')]){try{this[_0x5654('0x91')](_0x546dce['body'],_0xdf44df);}catch(_0x43237a){logger[_0x5654('0x29')](util[_0x5654('0x51')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0xdf44df));}}return this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xd2'),_0xdf44df));};AGIVertices[_0x5654('0x10')][_0x5654('0x16b')]=function(_0x42d139){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x16c'),_0x42d139['label']));return this['channel'][_0x5654('0x16d')](_0x42d139[_0x5654('0x16e')][_0x5654('0x53')](/\s+/g,''),_0x42d139['escape_digits']);};AGIVertices[_0x5654('0x10')]['saynumber']=function(_0x3c5cfb){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x16f'),_0x3c5cfb[_0x5654('0x9e')]));return this[_0x5654('0xe')][_0x5654('0x170')](_0x3c5cfb[_0x5654('0x171')]['replace'](/\s+/g,''),_0x3c5cfb['escape_digits']);};AGIVertices['prototype'][_0x5654('0x172')]=function(_0x5f233b){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x173'),_0x5f233b[_0x5654('0x9e')]));return this[_0x5654('0xe')]['sayPhonetic'](_0x5f233b['text'],_0x5f233b['escape_digits']);};AGIVertices[_0x5654('0x10')][_0x5654('0x174')]=function(_0x374633){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x175'),_0x374633[_0x5654('0x9e')]));if(!this['isConfigured'](_0x374633['account_id'])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0x176'));}var _0x4894ba=this[_0x5654('0x177')][_0x5654('0x6d')](this,_0x374633['account_id']);if(!_0x4894ba||!_0x4894ba[_0x5654('0x178')]){return this['channel'][_0x5654('0x29')](_0x374633,'no\x20mail\x20account\x20found');}var _0x1b603e={'from':util[_0x5654('0x51')](_0x5654('0x179'),_0x4894ba[_0x5654('0x14')],_0x4894ba[_0x5654('0x17a')]||_0x4894ba[_0x5654('0x178')][_0x5654('0x17b')]),'to':_0x374633['to']||'','cc':_0x374633['cc']||'','bcc':_0x374633[_0x5654('0x17c')]||'','subject':_0x374633[_0x5654('0x17d')],'html':_0x374633[_0x5654('0x56')],'text':_0x374633[_0x5654('0x56')]};var _0x37a6f4={'tls':{'rejectUnauthorized':![]}};if(_0x4894ba[_0x5654('0x178')]['service']){_0x37a6f4[_0x5654('0x17e')]=_0x4894ba[_0x5654('0x178')][_0x5654('0x17e')];}else{_0x37a6f4['host']=_0x4894ba['Smtp'][_0x5654('0x17f')];_0x37a6f4[_0x5654('0x180')]=_0x4894ba[_0x5654('0x178')][_0x5654('0x180')];_0x37a6f4[_0x5654('0x181')]=_0x4894ba[_0x5654('0x178')][_0x5654('0x181')];}if(_0x4894ba[_0x5654('0x178')][_0x5654('0x182')]){_0x37a6f4[_0x5654('0x183')]={'user':_0x4894ba[_0x5654('0x178')][_0x5654('0x17b')],'pass':_0x4894ba[_0x5654('0x178')]['pass']};}if(this['isConfigured'](_0x374633['template_id'])){}logger['debug'](_0x5654('0x184'),JSON['stringify'](_0x1b603e));this[_0x5654('0x32')]['sync'](this,_0x374633,_0x374633[_0x5654('0x185')]);this['channel'][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0x186'),_0x4894ba[_0x5654('0x14')]));this[_0x5654('0x20')]['sync'](this,_0x37a6f4,_0x1b603e);return this['channel'][_0x5654('0xa9')](_0x5654('0x187'));};AGIVertices['prototype']['sendFax']=function(_0x145a6d){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x188'),_0x145a6d['label']));return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0x189'));};AGIVertices['prototype']['sendSMS']=function(_0x125d11){logger[_0x5654('0x2b')](util['format'](_0x5654('0x18a'),_0x125d11[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0x125d11['sms_account_id'])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0x18b'));}var _0x292676=this[_0x5654('0x2f')]['sync'](this,_0x125d11[_0x5654('0x18c')]);if(!_0x292676){return this[_0x5654('0xe')]['error'](_0x125d11,_0x5654('0x18d'));}var _0x5ac3a2={'body':_0x125d11[_0x5654('0x18e')],'phone':_0x125d11['to']||'','SmsAccountId':_0x292676['id']};logger[_0x5654('0xd3')](_0x5654('0x18f'),JSON[_0x5654('0x70')](_0x5ac3a2));this[_0x5654('0x32')][_0x5654('0x6d')](this,_0x125d11,_0x125d11[_0x5654('0x18c')]);this['channel'][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0x190'),_0x292676[_0x5654('0x14')]));this[_0x5654('0x31')]['sync'](this,_0x5ac3a2);return this[_0x5654('0xe')]['noop'](_0x5654('0x191'));};AGIVertices[_0x5654('0x10')][_0x5654('0x192')]=function(_0x41bb35){logger[_0x5654('0x2b')](util['format'](_0x5654('0x193'),_0x41bb35['label']));if(!this[_0x5654('0x7d')](_0x41bb35[_0x5654('0xcc')])){return this[_0x5654('0xe')][_0x5654('0x29')](_0x41bb35,_0x5654('0x194'));}var _0x1b4d86=this[_0x5654('0x11')][_0x5654('0x6d')](this,_0x41bb35[_0x5654('0xcc')]);if(!_0x1b4d86){return this['channel'][_0x5654('0x29')](_0x41bb35,_0x5654('0xce'));}return this[_0x5654('0xe')][_0x5654('0x95')](_0x1b4d86,_0x41bb35[_0x5654('0x195')]);};AGIVertices[_0x5654('0x10')][_0x5654('0x196')]=function(_0x8cd8a0){logger['info'](util[_0x5654('0x51')](_0x5654('0x197'),_0x8cd8a0[_0x5654('0x9e')]));this[_0x5654('0xe')][_0x5654('0xa9')]('START\x20CALLY\x20SQUARE');if(_0x8cd8a0['answer']===_0x5654('0x198')){this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0x199'));return this[_0x5654('0xe')][_0x5654('0xa0')]();}return this['channel'][_0x5654('0xa9')]('Skipped\x20Answer');};AGIVertices[_0x5654('0x10')][_0x5654('0x19a')]=function(_0x1b6f4f){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x19b'),_0x1b6f4f[_0x5654('0x9e')]));if(!this['isConfigured'](_0x1b6f4f[_0x5654('0x19c')])){return this[_0x5654('0xe')]['error'](_0x1b6f4f,'no\x20subproject\x20selected');}var _0x44baa1=this['getSquareProject'][_0x5654('0x6d')](this,_0x1b6f4f[_0x5654('0x19c')]);if(!this[_0x5654('0x7d')](_0x44baa1)){return this['channel'][_0x5654('0x29')](_0x1b6f4f,util[_0x5654('0x51')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x1b6f4f[_0x5654('0x19c')]));}if(_0x44baa1===this[_0x5654('0xe')][_0x5654('0x3b')]){return this[_0x5654('0xe')][_0x5654('0x29')](_0x1b6f4f,_0x5654('0x19d'));}this[_0x5654('0x32')][_0x5654('0x6d')](this,_0x1b6f4f,_0x44baa1);var _0x4a6218=this[_0x5654('0xe')][_0x5654('0xac')](_0x5654('0x19e'),util[_0x5654('0x51')](_0x5654('0x19f'),config['agi']['host']||_0x5654('0x1a0'),_0x44baa1,this[_0x5654('0xe')][_0x5654('0x3b')]));if(_0x4a6218[_0x5654('0x9a')]===-0x1){return _0x4a6218;}return this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0xae'),_0x5654('0x19e'),_0x44baa1));};AGIVertices[_0x5654('0x10')][_0x5654('0x1a1')]=function(_0x11a48a){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x1a2'),_0x11a48a[_0x5654('0x9e')]));var _0x124eb8=this[_0x5654('0x1a3')][_0x5654('0x6d')](this,_0x11a48a[_0x5654('0x9f')]);this[_0x5654('0x32')][_0x5654('0x6d')](this,_0x11a48a,_0x11a48a[_0x5654('0x9f')]);if(this[_0x5654('0x7d')](_0x11a48a[_0x5654('0xcc')])){var _0x1db790=this['getVariable'][_0x5654('0x6d')](this,_0x11a48a[_0x5654('0xcc')]);if(_0x1db790){this[_0x5654('0xe')]['setVariable'](_0x1db790,_0x124eb8);return this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0x1a4'),_0x11a48a[_0x5654('0x9f')],_0x1db790));}}return this[_0x5654('0xe')][_0x5654('0xa9')](util['format'](_0x5654('0x1a5'),_0x11a48a[_0x5654('0x9f')]));};AGIVertices[_0x5654('0x10')][_0x5654('0x1a6')]=function(_0xaabfa8){logger['info'](util[_0x5654('0x51')](_0x5654('0x1a7'),_0xaabfa8[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0xaabfa8['apiKey'])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0x1a8'));}if(!this[_0x5654('0x7d')](_0xaabfa8[_0x5654('0x56')])){return this[_0x5654('0xe')][_0x5654('0xa9')](_0x5654('0xb1'));}this[_0x5654('0xe')][_0x5654('0xa9')](util[_0x5654('0x51')](_0x5654('0x1a9'),_0xaabfa8[_0x5654('0x56')]));var _0x4f88b4=this[_0x5654('0x1aa')]['sync'](this,_0xaabfa8);if(_0x4f88b4){this[_0x5654('0xe')]['noop'](util['format'](_0x5654('0x1ab'),_0x4f88b4));var _0xe84040=this[_0x5654('0xe')][_0x5654('0xed')](_0x4f88b4);try{fs[_0x5654('0xee')](_0x4f88b4+_0x5654('0x10c'));}catch(_0x43edff){logger[_0x5654('0x29')](_0x43edff);}return _0xe84040;}return this[_0x5654('0xe')][_0x5654('0x29')](_0xaabfa8,_0x5654('0x1ac'));};AGIVertices[_0x5654('0x10')][_0x5654('0x1ad')]=function(_0x8c4bdf){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x1ae'),_0x8c4bdf[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0x8c4bdf[_0x5654('0x56')])){return this[_0x5654('0xe')]['noop'](_0x5654('0xb1'));}this[_0x5654('0xe')]['noop'](util[_0x5654('0x51')](_0x5654('0x1af'),_0x8c4bdf[_0x5654('0x56')]));var _0x2abf83=this[_0x5654('0x5d')][_0x5654('0x6d')](this,_0x8c4bdf);if(_0x2abf83){this[_0x5654('0xe')]['noop'](util[_0x5654('0x51')]('Google\x20TTS\x20%s\x20file\x20created',_0x2abf83));var _0x1b4745=this[_0x5654('0xe')][_0x5654('0xed')](_0x2abf83);try{fs['unlink'](_0x2abf83+'.wav');}catch(_0x4a4078){logger[_0x5654('0x29')](_0x4a4078);}return _0x1b4745;}return this['channel'][_0x5654('0x29')](_0x8c4bdf,_0x5654('0x1b0'));};AGIVertices[_0x5654('0x10')][_0x5654('0x1b1')]=function(_0x2e8c7a){logger[_0x5654('0x2b')](util[_0x5654('0x51')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x2e8c7a[_0x5654('0x9e')]));if(!this['isConfigured'](_0x2e8c7a[_0x5654('0x13e')])){return this[_0x5654('0xe')][_0x5654('0x29')](_0x2e8c7a,'no\x20find\x20by\x20configured');}logger[_0x5654('0x2b')](util['format'](_0x5654('0x143'),this[_0x5654('0xe')][_0x5654('0x35')],_0x2e8c7a[_0x5654('0x13e')]));var _0xd851a3=this[_0x5654('0x4d')][_0x5654('0x6d')](this,_0x2e8c7a[_0x5654('0x13e')]);if(_0xd851a3){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x13f'),this[_0x5654('0xe')][_0x5654('0x35')],_0x2e8c7a['findBy']));this[_0x5654('0xe')][_0x5654('0xa9')](util['format'](_0x5654('0x13f'),this['channel'][_0x5654('0x35')],_0x2e8c7a['findBy']));return{'code':0xc8,'result':_0x5654('0x140')};}else{logger[_0x5654('0x2b')](util['format'](_0x5654('0x144'),this[_0x5654('0xe')][_0x5654('0x35')],_0x2e8c7a[_0x5654('0x13e')]));this[_0x5654('0xe')][_0x5654('0xa9')](util['format'](_0x5654('0x144'),this[_0x5654('0xe')][_0x5654('0x35')],_0x2e8c7a[_0x5654('0x13e')]));return{'code':0xc8,'result':_0x5654('0x141')};}};AGIVertices[_0x5654('0x10')]['voicemail']=function(_0x3047ec){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x1b2'),_0x3047ec[_0x5654('0x9e')]));var _0x3e6875=this['channel'][_0x5654('0xac')](_0x5654('0x1b3'),[_0x3047ec[_0x5654('0x1b4')],_0x3047ec[_0x5654('0x74')]]);if(_0x3e6875[_0x5654('0x9a')]===-0x1){return _0x3e6875;}return this['channel']['noop'](util['format'](_0x5654('0xae'),_0x5654('0x1b3'),_0x3047ec[_0x5654('0x1b4')]));};AGIVertices[_0x5654('0x10')][_0x5654('0x1b5')]=function(_0x2a5058){logger[_0x5654('0x2b')](util[_0x5654('0x51')](_0x5654('0x1b6'),_0x2a5058[_0x5654('0x9e')]));if(!this[_0x5654('0x7d')](_0x2a5058['variable_id'])){return this[_0x5654('0xe')][_0x5654('0x29')](_0x2a5058,_0x5654('0x194'));}var _0x368c40=this[_0x5654('0x11')][_0x5654('0x6d')](this,_0x2a5058[_0x5654('0xcc')]);if(!_0x368c40){return this['channel'][_0x5654('0x29')](_0x2a5058,'no\x20variable\x20found');}var _0x969502=this[_0x5654('0xe')]['getVariable'](_0x368c40);return{'code':0xc8,'result':_0x969502[_0x5654('0x98')]?_0x969502[_0x5654('0x98')]:'-'};};String[_0x5654('0x10')]['replaceAll']=function(_0x5c2fdf,_0x2f2c33){return this[_0x5654('0x96')](_0x5c2fdf)['join'](_0x2f2c33);};module[_0x5654('0x1b7')]=AGIVertices; \ No newline at end of file +var _0xe07d=['pause_id','playback','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','toLowerCase','QUEUE','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','digits','escape_digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','getMailAccount','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','bcc','subject','service','host','port','secure','authentication','auth','user','pass','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','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','answer','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','odbc','randomstring','moment','mustache','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','Intervals','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid','createSquareRecording','uniqueid','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','isString','replaceAllVariables','saveRestApiResult','%s.%s','length','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','retry','maxRetry','agi','Enter\x20in\x20AGI\x20(%s)\x20block','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','minutes','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','exec','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','no\x20text\x20configured','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','SESTEK_ASR_CONFIDENCE','RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','sip_id','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','no\x20key\x20configured','Trying\x20Dialogflow:\x20%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','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','test','mindigit','getVariable','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','bot','Trying\x20Amazon\x20Lex:\x20%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','wav','recordFile','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','continueAt','context','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','login','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','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','response','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured'];(function(_0x4dd1b3,_0x2a748b){var _0x533717=function(_0x19625a){while(--_0x19625a){_0x4dd1b3['push'](_0x4dd1b3['shift']());}};_0x533717(++_0x2a748b);}(_0xe07d,0x6c));var _0xde07=function(_0x466247,_0x5d69e3){_0x466247=_0x466247-0x0;var _0x4b352e=_0xe07d[_0x466247];return _0x4b352e;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0xde07('0x0'));var _=require(_0xde07('0x1'));var sh=require('shelljs');var odbc=require(_0xde07('0x2'))();var rs=require(_0xde07('0x3'));var moment=require(_0xde07('0x4'));var Mustache=require(_0xde07('0x5'));var rp=require('request-promise');var logger=require(_0xde07('0x6'))('agi');var config=require('../../config/environment');var scripts=require(_0xde07('0x7'));var FILES_PATH=_0xde07('0x8');var recursiveMapAttributes=[_0xde07('0x9'),_0xde07('0xa')];var verticesWithRetry=[_0xde07('0xb'),_0xde07('0xc'),_0xde07('0xd')];var AGIVertices=function(_0x5b7d76,_0x1f8aad,_0x419129){this[_0xde07('0xe')]=_0x5b7d76;this[_0xde07('0xf')]=_0x1f8aad;this[_0xde07('0x10')]=_0x419129;};AGIVertices['prototype']['getVariable']=function(_0x13434b,_0x1999a1){this['rpc']['getVariableById'](_0x13434b)[_0xde07('0x11')](function(_0x4ba978){_0x1999a1(null,_0x4ba978?_0x4ba978[_0xde07('0x12')]:![]);})[_0xde07('0x13')](function(_0x12e050){_0x1999a1(_0x12e050);});};AGIVertices[_0xde07('0x14')][_0xde07('0x15')]=function(_0x2284fb,_0x5998f3){this['rpc'][_0xde07('0x16')](_0x2284fb)[_0xde07('0x11')](function(_0x25c65a){_0x5998f3(null,_0x25c65a?_0x25c65a[_0xde07('0x12')]:![]);})[_0xde07('0x13')](function(_0x26f05c){_0x5998f3(_0x26f05c);});};AGIVertices[_0xde07('0x14')][_0xde07('0x17')]=function(_0x3a5f08,_0x5dc37e){this[_0xde07('0xf')]['getSquareProjectById'](_0x3a5f08)['then'](function(_0x573b25){_0x5dc37e(null,_0x573b25?_0x573b25[_0xde07('0x12')]:![]);})[_0xde07('0x13')](function(_0x14ff36){_0x5dc37e(_0x14ff36);});};AGIVertices[_0xde07('0x14')]['getSquareOdbc']=function(_0x5d00bb,_0x3221b3){this[_0xde07('0xf')][_0xde07('0x18')](_0x5d00bb)[_0xde07('0x11')](function(_0x16ee9f){_0x3221b3(null,_0x16ee9f?_0x16ee9f[_0xde07('0x19')]:![]);})[_0xde07('0x13')](function(_0x9480a3){_0x3221b3(_0x9480a3);});};AGIVertices['prototype']['getUser']=function(_0x3f3b10,_0x16280a){this['rpc'][_0xde07('0x1a')](_0x3f3b10)[_0xde07('0x11')](function(_0x529ec2){_0x16280a(null,_0x529ec2?_0x529ec2[_0xde07('0x12')]:![]);})['catch'](function(_0x5b17dd){_0x16280a(_0x5b17dd);});};AGIVertices[_0xde07('0x14')][_0xde07('0x1b')]=function(_0x429070,_0x609bcb){this[_0xde07('0xf')][_0xde07('0x1c')](_0x429070)['then'](function(_0x3a20e2){_0x609bcb(null,_0x3a20e2?_0x3a20e2[_0xde07('0x12')]:![]);})[_0xde07('0x13')](function(_0x18becf){_0x609bcb(_0x18becf);});};AGIVertices[_0xde07('0x14')]['getSound']=function(_0xf0f608,_0x521000){var _0x2f4848=this;this[_0xde07('0xf')][_0xde07('0x1d')](_0xf0f608)[_0xde07('0x11')](function(_0x2ccddf){_0x521000(null,_0x2ccddf?_0x2f4848[_0xde07('0x1e')](_0x2ccddf[_0xde07('0x1f')]):![]);})[_0xde07('0x13')](function(_0x43fa24){_0x521000(_0x43fa24);});};AGIVertices['prototype']['getMailAccount']=function(_0x8a32f0,_0x59a875){this[_0xde07('0xf')][_0xde07('0x20')](_0x8a32f0)[_0xde07('0x11')](function(_0x2fd415){_0x59a875(null,_0x2fd415?_0x2fd415:![]);})[_0xde07('0x13')](function(_0x11f180){_0x59a875(_0x11f180);});};AGIVertices[_0xde07('0x14')][_0xde07('0x21')]=function(_0x1316b5,_0x3762b4,_0x3ff3be){this[_0xde07('0x10')][_0xde07('0x21')](_0x1316b5,_0x3762b4)['then'](function(){_0x3ff3be(null);})[_0xde07('0x13')](function(_0x147362){_0x3ff3be(_0x147362);});};AGIVertices[_0xde07('0x14')][_0xde07('0x22')]=function(_0x5a41c7,_0x5dc6f6){this[_0xde07('0xf')][_0xde07('0x23')](_0x5a41c7)[_0xde07('0x11')](function(_0x2de24f){if(_0x2de24f){if(_0x2de24f[_0xde07('0x24')]){_0x5dc6f6(null,[_0x2de24f['interval']]);}else{_0x5dc6f6(null,_['map'](_0x2de24f[_0xde07('0x25')],_0xde07('0x26')));}}else{_0x5dc6f6(null,![]);}})[_0xde07('0x13')](function(_0x1959d3){_0x5dc6f6(_0x1959d3);});};AGIVertices[_0xde07('0x14')][_0xde07('0x1e')]=function(_0x2ec90b){return util[_0xde07('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x2ec90b);};AGIVertices[_0xde07('0x14')][_0xde07('0x28')]=function(_0x2f2bec,_0x11e9b,_0x467961){odbc[_0xde07('0x29')](_0x2f2bec,function(_0x24ecde){if(_0x24ecde){logger[_0xde07('0x2a')](_0xde07('0x2b'),_0x24ecde);_0x467961(_0x24ecde);}else{logger[_0xde07('0x2c')](_0xde07('0x2d'));odbc['query'](_0x11e9b,function(_0x401f7d,_0x543e96){if(_0x401f7d){logger[_0xde07('0x2c')](_0xde07('0x2e'),_0x11e9b);_0x467961(_0x401f7d);}else{logger[_0xde07('0x2c')](_0xde07('0x2f'),_0x11e9b);odbc[_0xde07('0x30')](function(_0x2e8745){if(_0x2e8745){logger[_0xde07('0x2a')](_0xde07('0x31'),_0x2e8745);}_0x467961(null,_0x543e96);});}});}});};AGIVertices['prototype'][_0xde07('0x32')]=function(_0x2f9a3a,_0x3f5203){this[_0xde07('0xf')][_0xde07('0x33')](_0x2f9a3a)[_0xde07('0x11')](function(_0x32bdac){_0x3f5203(null,_0x32bdac?_0x32bdac:![]);})['catch'](function(_0x4a83b8){_0x3f5203(_0x4a83b8);});};AGIVertices[_0xde07('0x14')][_0xde07('0x34')]=function(_0x5b00fb,_0x2b163d){this['rpc'][_0xde07('0x34')](_0x5b00fb)[_0xde07('0x11')](function(_0x4775e2){_0x2b163d(null,_0x4775e2);})['catch'](function(_0xdae90){_0x2b163d(_0xdae90);});};AGIVertices[_0xde07('0x14')][_0xde07('0x35')]=function(_0x40b97d,_0x1b1ccc,_0x542608){this[_0xde07('0xf')][_0xde07('0x35')]({'uniqueid':this['channel']['uniqueid'],'node':_0x40b97d[_0xde07('0x36')],'application':_0x40b97d[_0xde07('0x37')],'data':_0x1b1ccc||null,'project_name':this['channel'][_0xde07('0x38')],'callerid':this[_0xde07('0xe')][_0xde07('0x39')]})['then'](function(_0x4fdcb2){if(_0x542608){_0x542608(null,_0x4fdcb2);}})['catch'](function(_0x32fd83){if(_0x542608){_0x542608(_0x32fd83);}});};AGIVertices[_0xde07('0x14')][_0xde07('0x3a')]=function(_0x532817,_0x5e878b,_0x1104bf,_0x200bc7){this[_0xde07('0xf')][_0xde07('0x3a')]({'uniqueid':this[_0xde07('0xe')][_0xde07('0x3b')],'callerid':this[_0xde07('0xe')][_0xde07('0x39')],'calleridname':this[_0xde07('0xe')]['calleridname'],'context':this[_0xde07('0xe')]['context'],'extension':this[_0xde07('0xe')][_0xde07('0x3c')],'priority':this[_0xde07('0xe')][_0xde07('0x3d')],'accountcode':this[_0xde07('0xe')][_0xde07('0x3e')],'dnid':this[_0xde07('0xe')][_0xde07('0x3f')],'projectName':this[_0xde07('0xe')]['arg_1'],'saveName':_0x5e878b,'filename':_0x532817[_0xde07('0x40')]||_0x5e878b,'savePath':_0x1104bf})[_0xde07('0x11')](function(_0x435517){_0x200bc7(null,_0x435517);})[_0xde07('0x13')](function(_0x50ee0e){_0x200bc7(_0x50ee0e);});};AGIVertices['prototype'][_0xde07('0x41')]=function(_0xf55011,_0x129072,_0x38e418){this[_0xde07('0xf')][_0xde07('0x41')]({'uniqueid':this['channel'][_0xde07('0x3b')],'body':_0xf55011,'direction':_0x129072})[_0xde07('0x11')](function(_0x2f8dc4){if(_0x38e418){_0x38e418(null,_0x2f8dc4);}})[_0xde07('0x13')](function(_0x3639ad){if(_0x38e418){_0x38e418(_0x3639ad);}});};AGIVertices[_0xde07('0x14')][_0xde07('0x42')]=function(_0x247a8b,_0x5d2c77){this[_0xde07('0xf')][_0xde07('0x42')]({'firstName':_[_0xde07('0x43')](_0x247a8b['name'])||_[_0xde07('0x44')](_0x247a8b[_0xde07('0x12')])?_0xde07('0x45')+Math['random']():_0x247a8b[_0xde07('0x12')],'lastName':_[_0xde07('0x43')](_0x247a8b[_0xde07('0x46')])||_[_0xde07('0x44')](_0x247a8b[_0xde07('0x46')])?null:_0x247a8b[_0xde07('0x46')],'phone':_0x247a8b[_0xde07('0x47')],'ListId':_0x247a8b[_0xde07('0x48')],'scheduledat':_0x247a8b[_0xde07('0x49')],'callbackUniqueid':this[_0xde07('0xe')][_0xde07('0x3b')],'tags':_0xde07('0x4a'),'description':_0xde07('0x4b')+_0x247a8b['scheduledAt']['toString'](),'priority':_0x247a8b['callback_priority']})[_0xde07('0x11')](function(_0x5c1e7a){_0x5d2c77(null,_0x5c1e7a);})['catch'](function(_0x56c8b3){_0x5d2c77(_0x56c8b3);});};AGIVertices[_0xde07('0x14')][_0xde07('0x4c')]=function(_0x12864a,_0x3b32dd){this[_0xde07('0xf')][_0xde07('0x4d')](_0x12864a)[_0xde07('0x11')](function(_0x18efa6){_0x3b32dd(null,_0x18efa6?_0x18efa6[_0xde07('0x12')]:![]);})[_0xde07('0x13')](function(_0x3545ea){_0x3b32dd(_0x3545ea);});};AGIVertices[_0xde07('0x14')][_0xde07('0x4e')]=function(_0x3116b4,_0x550bb8,_0x287024){var _0x2c3973={'role':_0xde07('0x4f')};_0x2c3973[_0x3116b4]=this[_0xde07('0xe')][_0xde07('0x39')];this[_0xde07('0xf')][_0xde07('0x4e')](_0x2c3973,_0x550bb8,this[_0xde07('0xe')]['uniqueid'])[_0xde07('0x11')](function(_0x5bba5e){_0x287024(null,_[_0xde07('0x44')](_0x5bba5e)?![]:!![]);})[_0xde07('0x13')](function(_0x47e4d0){logger[_0xde07('0x2a')](_0x47e4d0);_0x287024(null,![]);});};AGIVertices[_0xde07('0x14')][_0xde07('0x50')]=function(_0x2e1581,_0x2ce6d2){var _0x320a4c={'role':_0xde07('0x4f')};_0x320a4c[_0x2e1581]=this['channel'][_0xde07('0x39')];this[_0xde07('0xf')][_0xde07('0x50')](_0x320a4c)[_0xde07('0x11')](function(_0x48e255){_0x2ce6d2(null,_['isNil'](_0x48e255)?![]:!![]);})[_0xde07('0x13')](function(_0x2d676a){logger['error'](_0x2d676a);_0x2ce6d2(null,![]);});};AGIVertices['prototype'][_0xde07('0x51')]=function(_0x4ea0f7,_0x18cce4){var _0x3b8fce={'role':'agent'};_0x3b8fce[_0x4ea0f7]=this[_0xde07('0xe')][_0xde07('0x39')];this['rpc'][_0xde07('0x51')](_0x3b8fce)[_0xde07('0x11')](function(_0x59dc04){_0x18cce4(null,_[_0xde07('0x44')](_0x59dc04)?![]:!![]);})[_0xde07('0x13')](function(_0x58daa7){logger[_0xde07('0x2a')](_0x58daa7);_0x18cce4(null,![]);});};AGIVertices[_0xde07('0x14')][_0xde07('0x52')]=function(_0xf19348,_0x37af6c){var _0x2ea055={'role':_0xde07('0x4f')};_0x2ea055[_0xf19348]=this[_0xde07('0xe')][_0xde07('0x39')];var _0x3a7371=_0xf19348!=_0xde07('0x53')?util['format'](_0xde07('0x54'),_0xde07('0x55'),this[_0xde07('0xe')][_0xde07('0x39')]):undefined;this[_0xde07('0xf')]['agentLogin'](_0x2ea055,_0x3a7371)[_0xde07('0x11')](function(_0x37da5a){_0x37af6c(null,_[_0xde07('0x44')](_0x37da5a)?![]:!![]);})[_0xde07('0x13')](function(_0xc9e423){logger[_0xde07('0x2a')](_0xc9e423);_0x37af6c(null,![]);});};AGIVertices[_0xde07('0x14')][_0xde07('0x56')]=function(_0x39c229,_0x156ebe){sh['exec'](_[_0xde07('0x57')](_0x39c229),function(_0xc92969,_0x1b906a){var _0x2d1dfc=_0x1b906a[_0xde07('0x58')](/(\r\n|\n|\r)/gm,'');_0x156ebe(null,_0x2d1dfc);});};AGIVertices[_0xde07('0x14')][_0xde07('0x59')]=function(_0x1c01b8,_0x530397){scripts[_0xde07('0x59')](_0x1c01b8[_0xde07('0x5a')],_0x1c01b8[_0xde07('0x5b')]||_0xde07('0x5c'),_0x1c01b8[_0xde07('0x5c')],_0x1c01b8[_0xde07('0x5d')]||_0xde07('0x5e'),_0x1c01b8[_0xde07('0x5f')]||_0xde07('0x60'),_0x1c01b8[_0xde07('0x61')]||_0xde07('0x62'))['then'](function(_0x5266dd){_0x530397(null,_0x5266dd);})[_0xde07('0x13')](function(_0x25709a){_0x530397(_0x25709a);});};AGIVertices['prototype'][_0xde07('0x63')]=function(_0x4642a6,_0x3cb26b){scripts['googleTTS'](_0x4642a6['text'],_0x4642a6['google_tts_language']||'en',0x1)['then'](function(_0x8456b4){_0x3cb26b(null,_0x8456b4);})[_0xde07('0x13')](function(_0x27febf){_0x3cb26b(_0x27febf);});};AGIVertices['prototype'][_0xde07('0x64')]=function(_0x468c3b,_0x33e5d5){var _0x226c9a={'uri':_0x468c3b[_0xde07('0x65')],'method':_0x468c3b[_0xde07('0x66')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x468c3b[_0xde07('0x67')])===_0xde07('0x68')&&parseInt(_0x468c3b[_0xde07('0x67')])>=0x1?parseInt(_0x468c3b[_0xde07('0x67')])*0x3e8:0x5*0x3e8};if(_[_0xde07('0x69')]([_0xde07('0x6a'),_0xde07('0x6b')],_0x226c9a[_0xde07('0x66')][_0xde07('0x6c')]())){try{_0x226c9a[_0xde07('0x6d')]=_0x468c3b[_0xde07('0xa')]?JSON[_0xde07('0x6e')](_0x468c3b['rawBody']):{};}catch(_0x36400f){logger[_0xde07('0x2a')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x36400f);}}try{_0x226c9a['headers']=_0x468c3b['rawHeaders']?JSON[_0xde07('0x6e')](_0x468c3b[_0xde07('0x9')]):{};}catch(_0x198743){logger[_0xde07('0x2a')](_0xde07('0x6f'),_0x198743);}if(_0x468c3b[_0xde07('0x70')]){try{var _0x8ea4d5=require(_0x468c3b[_0xde07('0x70')])[_0xde07('0x71')](this,_0x226c9a);_0x226c9a[_0xde07('0x72')]=Mustache[_0xde07('0x73')](_0x468c3b[_0xde07('0x65')],_0x8ea4d5,{},['$$','$$']);if(_0x226c9a[_0xde07('0x74')]){_0x226c9a[_0xde07('0x74')]=JSON['parse'](Mustache[_0xde07('0x73')](JSON[_0xde07('0x75')](_0x226c9a[_0xde07('0x74')]),_0x8ea4d5,{},['$$','$$']));}if(_0x226c9a['body']){_0x226c9a[_0xde07('0x6d')]=JSON[_0xde07('0x6e')](Mustache[_0xde07('0x73')](JSON[_0xde07('0x75')](_0x226c9a[_0xde07('0x6d')]),_0x8ea4d5,{},['$$','$$']));}}catch(_0x44177e){logger[_0xde07('0x2a')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x44177e);}}rp(_0x226c9a)[_0xde07('0x11')](function(_0x35acff){var _0xf20551={'statusCode':_0x35acff[_0xde07('0x76')]||0xc8,'statusMessage':_0x35acff[_0xde07('0x77')]||'OK','headers':_0x35acff['headers']||{},'body':_0x35acff[_0xde07('0x6d')]||{}};_0x33e5d5(null,_0xf20551);})[_0xde07('0x13')](function(_0x1ae9d9){var _0x172255={'statusCode':_0x1ae9d9[_0xde07('0x76')]||0x1f4,'statusMessage':_0x1ae9d9['message']||_0xde07('0x78'),'headers':_0x1ae9d9[_0xde07('0x79')][_0xde07('0x74')]||{},'body':_0x1ae9d9[_0xde07('0x79')]['body']||{}};_0x33e5d5(null,_0x172255);});};AGIVertices[_0xde07('0x14')][_0xde07('0x7a')]=function(_0x38576d,_0x4a568d){scripts['googleDialogflow'](this['channel'][_0xde07('0x3b')],_0x38576d[_0xde07('0x7b')],_0x38576d[_0xde07('0x5c')],_0x38576d[_0xde07('0x7c')]||'en')[_0xde07('0x11')](function(_0x4f72e6){_0x4a568d(null,_0x4f72e6);})['catch'](function(_0x2f1c91){_0x4a568d(_0x2f1c91);});};AGIVertices[_0xde07('0x14')][_0xde07('0x7d')]=function(_0xcf0619,_0xa4591d){scripts['sestekNDA'](this['channel'],_0xcf0619)[_0xde07('0x11')](function(_0x1ced6b){_0xa4591d(null,_0x1ced6b);})[_0xde07('0x13')](function(_0x11a284){_0xa4591d(_0x11a284);});};AGIVertices[_0xde07('0x14')][_0xde07('0x7e')]=function(_0x19b107,_0x43d0df){scripts[_0xde07('0x7e')](_0x19b107[_0xde07('0x7b')],_0x19b107[_0xde07('0x5c')],_0x19b107[_0xde07('0x7f')]||_0xde07('0x5e'),_0x19b107[_0xde07('0x80')])[_0xde07('0x11')](function(_0x445480){_0x43d0df(null,_0x445480);})[_0xde07('0x13')](function(_0x43237d){_0x43d0df(_0x43237d);});};AGIVertices['prototype'][_0xde07('0x81')]=function(_0x3881ce,_0x1bc11a,_0x58011e){scripts[_0xde07('0x81')](_0x1bc11a,_0x3881ce[_0xde07('0x7b')],_0x3881ce[_0xde07('0x82')]||_0xde07('0x5e'),this[_0xde07('0x83')](_0x3881ce[_0xde07('0x84')])?_0x3881ce[_0xde07('0x84')]:undefined)[_0xde07('0x11')](function(_0x16de9a){_0x58011e(null,_0x16de9a);})[_0xde07('0x13')](function(_0x1b54a0){_0x58011e(_0x1b54a0);});};AGIVertices[_0xde07('0x14')]['awsPolly']=function(_0x1bab95,_0xbc5938){scripts[_0xde07('0x85')](_0x1bab95['aws_access_key_id'],_0x1bab95[_0xde07('0x86')],_0x1bab95[_0xde07('0x87')],_0x1bab95[_0xde07('0x88')]||_0xde07('0x89'),_0x1bab95[_0xde07('0x5c')],_0x1bab95[_0xde07('0x8a')]||_0xde07('0x5c'))[_0xde07('0x11')](function(_0x26e2a7){_0xbc5938(null,_0x26e2a7);})[_0xde07('0x13')](function(_0x1a79ce){_0xbc5938(_0x1a79ce);});};AGIVertices[_0xde07('0x14')][_0xde07('0x8b')]=function(_0x2292c2,_0x230f86){scripts[_0xde07('0x8b')](this[_0xde07('0xe')][_0xde07('0x3b')],_0x2292c2[_0xde07('0x8c')],_0x2292c2[_0xde07('0x86')],_0x2292c2[_0xde07('0x8d')],_0x2292c2['text'],_0x2292c2[_0xde07('0x8e')])[_0xde07('0x11')](function(_0x528000){_0x230f86(null,_0x528000);})[_0xde07('0x13')](function(_0x4d1775){_0x230f86(_0x4d1775);});};AGIVertices[_0xde07('0x14')][_0xde07('0x8f')]=function(_0x55c178,_0x13bee9,_0x5ee85c){scripts[_0xde07('0x8f')](_0x13bee9,_0x55c178[_0xde07('0x7b')],_0x55c178[_0xde07('0x90')]||'en-US')[_0xde07('0x11')](function(_0xdeecb5){_0x5ee85c(null,_0xdeecb5);})[_0xde07('0x13')](function(_0x59aa4){_0x5ee85c(_0x59aa4);});};AGIVertices[_0xde07('0x14')]['tildeASR']=function(_0x3016c4,_0x45eaa3,_0x9faceb){scripts[_0xde07('0x91')](_0x45eaa3,_0x3016c4[_0xde07('0x92')],_0x3016c4[_0xde07('0x93')],_0x3016c4[_0xde07('0x72')])[_0xde07('0x11')](function(_0x198840){_0x9faceb(null,_0x198840);})[_0xde07('0x13')](function(_0x450a92){_0x9faceb(_0x450a92);});};AGIVertices['prototype'][_0xde07('0x94')]=function(_0xf10ca){var _0xd45809=_[_0xde07('0x69')](verticesWithRetry,_0xf10ca[_0xde07('0x37')])?_0xf10ca:_[_0xde07('0x95')](_0xf10ca);for(var _0x1049e9 in _0xd45809){if(_0xd45809['hasOwnProperty'](_0x1049e9)){if(_0xd45809[_0x1049e9]&&_['isString'](_0xd45809[_0x1049e9])){if(_[_0xde07('0x69')](recursiveMapAttributes,_0x1049e9)){_0xd45809[_0x1049e9]=this[_0xde07('0x96')](_0xd45809[_0x1049e9]);}else{_0xd45809[_0x1049e9]=this['replaceAllVariables'](_0xd45809[_0x1049e9]);}}}}return _0xd45809;};AGIVertices[_0xde07('0x14')][_0xde07('0x97')]=function(_0x2ae0ce){for(var _0x2266c7 in _0x2ae0ce){if(_0x2ae0ce[_0xde07('0x98')](_0x2266c7)){if(_[_0xde07('0x99')](_0x2ae0ce[_0x2266c7])){this[_0xde07('0x97')](_0x2ae0ce[_0x2266c7]);}else if(_[_0xde07('0x9a')](_0x2ae0ce[_0x2266c7])){for(var _0x58be62=0x0;_0x58be62<_0x2ae0ce[_0x2266c7]['length'];_0x58be62++){this[_0xde07('0x97')](_0x2ae0ce[_0x2266c7][_0x58be62]);}}else if(_[_0xde07('0x9b')](_0x2ae0ce[_0x2266c7])){_0x2ae0ce[_0x2266c7]=this[_0xde07('0x9c')](_0x2ae0ce[_0x2266c7]);}}}};AGIVertices[_0xde07('0x14')][_0xde07('0x9d')]=function(_0x234423,_0x32143d){for(var _0x4c3f46 in _0x234423){if(_0x234423[_0xde07('0x98')](_0x4c3f46)){if(_['isPlainObject'](_0x234423[_0x4c3f46])){if(!_[_0xde07('0x43')](_0x234423[_0x4c3f46])){this[_0xde07('0x9d')](_0x234423[_0x4c3f46],util[_0xde07('0x27')](_0xde07('0x9e'),_0x32143d,_0x4c3f46));}}else if(_['isArray'](_0x234423[_0x4c3f46])){for(var _0x1f8e5f=0x0;_0x1f8e5f<_0x234423[_0x4c3f46][_0xde07('0x9f')];_0x1f8e5f++){this[_0xde07('0x9d')](_0x234423[_0x4c3f46][_0x1f8e5f],util[_0xde07('0x27')]('%s.%s',_0x32143d,_0x4c3f46+'['+_0x1f8e5f+']'));}}else{if(!_['isNil'](_0x234423[_0x4c3f46])){this[_0xde07('0xe')]['setVariable'](util['format']('%s.%s',_0x32143d,_0x4c3f46),_0x234423[_0x4c3f46]);}}}}};AGIVertices['prototype'][_0xde07('0x96')]=function(_0x13c4f2){try{var _0x3256bf=JSON[_0xde07('0x6e')](_0x13c4f2);this[_0xde07('0x97')](_0x3256bf);return JSON['stringify'](_0x3256bf);}catch(_0x2cf3cc){return this[_0xde07('0x9c')](_0x13c4f2);}};AGIVertices[_0xde07('0x14')][_0xde07('0x9c')]=function(_0x42b0e7){var _0x36817e=_0x42b0e7[_0xde07('0xa0')]('{');for(var _0x3d78ce=0x1;_0x3d78ce<_0x36817e[_0xde07('0x9f')];_0x3d78ce+=0x1){var _0x90197e=_0x36817e[_0x3d78ce][_0xde07('0xa0')]('}');if(_0x90197e[_0xde07('0x9f')]>0x1){_0x42b0e7=_0x42b0e7[_0xde07('0xa1')]('{'+_0x90197e[0x0]+'}',this[_0xde07('0xe')]['getVariable'](_0x90197e[0x0])[_0xde07('0xa2')]||_0x90197e[0x0]);}}if(_0x36817e[_0xde07('0x9f')]===0x1){return _0x42b0e7['toString']();}return this[_0xde07('0x9c')](_0x42b0e7);};AGIVertices['prototype'][_0xde07('0xa3')]=function(_0x31dd00,_0x1b15ea){var _0x7e28dc=this[_0xde07('0xe')]['getVariable'](_0x31dd00);if(_0x7e28dc[_0xde07('0xa4')]===-0x1){return _0x7e28dc;}logger[_0xde07('0x2c')](util['format'](_0xde07('0xa5'),_0x1b15ea,_0x7e28dc[_0xde07('0xa2')]));return this['channel'][_0xde07('0xa6')](_0x1b15ea,_0x7e28dc['extra']);};AGIVertices[_0xde07('0x14')][_0xde07('0x83')]=function(_0x5b2d78){return _0x5b2d78&&_0x5b2d78!=='0'&&_0x5b2d78!=='-1'&&_0x5b2d78!=='';};AGIVertices[_0xde07('0x14')]['maxRetry']=function(_0x3f32dc){this[_0xde07('0x35')]['sync'](this,_0x3f32dc,'-');_0x3f32dc[_0xde07('0xa7')]=_0x3f32dc[_0xde07('0xa8')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xde07('0xa9')]=function(_0x17ba1b){logger['info'](util[_0xde07('0x27')](_0xde07('0xaa'),_0x17ba1b[_0xde07('0x36')]));return this['channel'][_0xde07('0xa9')]([_0x17ba1b['command'],_0x17ba1b['args']]);};AGIVertices[_0xde07('0x14')]['answer']=function(_0x395051){logger['info'](util[_0xde07('0x27')](_0xde07('0xab'),_0x395051['label']));if(this[_0xde07('0x83')](_0x395051[_0xde07('0x67')])){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xac'),_0x395051[_0xde07('0x67')]));var _0xab21f=this['channel'][_0xde07('0xad')](_0x395051['timeout']);if(_0xab21f['result']===-0x1){return _0xab21f;}}return this[_0xde07('0xe')]['answer']();};AGIVertices[_0xde07('0x14')][_0xde07('0x4a')]=function(_0x5f101c){logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x5f101c[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x5f101c['list_id'])){return this[_0xde07('0xe')]['error'](_0x5f101c,_0xde07('0xae'));}_0x5f101c[_0xde07('0x49')]=moment();if(this[_0xde07('0x83')](_0x5f101c[_0xde07('0xaf')])){_0x5f101c[_0xde07('0x49')]=moment()['add'](_0x5f101c['delay'],_0xde07('0xb0'));}if(!this[_0xde07('0x83')](_0x5f101c['callback_priority'])){_0x5f101c['callback_priority']=0x2;}this[_0xde07('0x42')][_0xde07('0x71')](this,_0x5f101c);return this['channel'][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0xb2'),_0x5f101c[_0xde07('0x47')],_0x5f101c[_0xde07('0x48')],_0x5f101c['scheduledAt']));};AGIVertices[_0xde07('0x14')][_0xde07('0xb3')]=function(_0x340fb1){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xb4'),_0x340fb1[_0xde07('0x36')]));var _0x53190b=this[_0xde07('0xe')][_0xde07('0xb5')](_0x340fb1[_0xde07('0xb6')],_0x340fb1[_0xde07('0x79')]);if(_0x53190b[_0xde07('0xa4')]===-0x1){return _0x53190b;}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0xb7'),_0x340fb1[_0xde07('0xb6')],_0x340fb1[_0xde07('0x79')]));};AGIVertices[_0xde07('0x14')][_0xde07('0xb8')]=function(_0x334360){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xb9'),_0x334360['label']));if(!this[_0xde07('0x83')](_0x334360[_0xde07('0x5c')])){return this['channel'][_0xde07('0xb1')]('no\x20text\x20configured');}var _0x1632ed='\x22'+_0x334360[_0xde07('0x5c')]+'\x22';if(this[_0xde07('0x83')](_0x334360[_0xde07('0x79')])){_0x1632ed+=','+_0x334360[_0xde07('0x79')];}var _0x4f350d=this[_0xde07('0xe')]['exec'](_0xde07('0xba'),_0x1632ed);if(_0x4f350d[_0xde07('0xa4')]===-0x1){return _0x4f350d;}return this[_0xde07('0xe')][_0xde07('0xb1')](util['format'](_0xde07('0xbb'),_0x1632ed));};AGIVertices[_0xde07('0x14')][_0xde07('0xbc')]=function(_0x1da968){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xbd'),_0x1da968['label']));if(!this[_0xde07('0x83')](_0x1da968[_0xde07('0x5c')])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xbe'));}var _0x291ccf='\x22'+_0x1da968[_0xde07('0x5c')]+'\x22';if(this[_0xde07('0x83')](_0x1da968[_0xde07('0x79')])){_0x291ccf+=','+_0x1da968[_0xde07('0x79')];}var _0x5c594b=this[_0xde07('0xe')][_0xde07('0xb5')](_0xde07('0xba'),_0x291ccf);if(_0x5c594b['result']===-0x1){return _0x5c594b;}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0xbb'),_0x291ccf));};AGIVertices[_0xde07('0x14')][_0xde07('0xbf')]=function(_0x4aa123){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xc0'),_0x4aa123[_0xde07('0x36')]));if(!this['isConfigured'](_0x4aa123[_0xde07('0xc1')])){return this['channel'][_0xde07('0xb1')](_0xde07('0xc2'));}var _0x2cec41=_0x4aa123[_0xde07('0xc1')];if(this[_0xde07('0x83')](_0x4aa123[_0xde07('0x79')])){_0x2cec41+=','+_0x4aa123[_0xde07('0x79')];}var _0x38ab46=this[_0xde07('0xe')][_0xde07('0xb5')]('MRCPRecog',_0x2cec41);if(_0x38ab46['result']===-0x1){return _0x38ab46;}var _0x484663=this[_0xde07('0xa3')](_0xde07('0xc3'),'LUMENVOX_ASR_CONFIDENCE');if(_0x484663['result']===-0x1){return _0x484663;}var _0x473b35=this[_0xde07('0xa3')]('RECOG_INPUT()',_0xde07('0xc4'));if(_0x473b35['result']===-0x1){return _0x473b35;}var _0x3aa221=this[_0xde07('0xa3')](_0xde07('0xc5'),'LUMENVOX_ASR_INSTANCE');if(_0x3aa221[_0xde07('0xa4')]===-0x1){return _0x3aa221;}return this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')](_0xde07('0xc6'),_0x2cec41));};AGIVertices[_0xde07('0x14')][_0xde07('0xc7')]=function(_0x2cfe57){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xc8'),_0x2cfe57[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x2cfe57[_0xde07('0xc1')])){return this[_0xde07('0xe')]['noop'](_0xde07('0xc2'));}var _0x3d1a02=_0x2cfe57[_0xde07('0xc1')];if(this[_0xde07('0x83')](_0x2cfe57[_0xde07('0x79')])){_0x3d1a02+=','+_0x2cfe57['options'];}var _0xa6c106=this[_0xde07('0xe')]['exec'](_0xde07('0xc9'),_0x3d1a02);if(_0xa6c106[_0xde07('0xa4')]===-0x1){return _0xa6c106;}var _0x1fb684=this[_0xde07('0xa3')](_0xde07('0xc3'),_0xde07('0xca'));if(_0x1fb684['result']===-0x1){return _0x1fb684;}var _0x1db3a3=this[_0xde07('0xa3')](_0xde07('0xcb'),_0xde07('0xcc'));if(_0x1db3a3[_0xde07('0xa4')]===-0x1){return _0x1db3a3;}var _0xb98f65=this[_0xde07('0xa3')](_0xde07('0xc5'),'SESTEK_ASR_INSTANCE');if(_0xb98f65['result']===-0x1){return _0xb98f65;}return this['channel'][_0xde07('0xb1')](util['format'](_0xde07('0xc6'),_0x3d1a02));};AGIVertices['prototype'][_0xde07('0xcd')]=function(_0x52ca65){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xce'),_0x52ca65['label']));if(!this['isConfigured'](_0x52ca65[_0xde07('0xcf')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x52ca65,_0xde07('0xd0'));}var _0x2a115f=this['getSquareOdbc'][_0xde07('0x71')](this,_0x52ca65[_0xde07('0xcf')]);if(!_0x2a115f){return this['channel'][_0xde07('0x2a')](_0x52ca65,_0xde07('0xd1'));}if(!this[_0xde07('0x83')](_0x52ca65[_0xde07('0xd2')])){return this['channel']['error'](_0x52ca65,_0xde07('0xd3'));}var _0x1b893d=_0x52ca65[_0xde07('0xd2')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0xde07('0x27')](_0xde07('0xd4'),_0x1b893d));var _0x43ce2f=this[_0xde07('0x28')]['sync'](this,_0x2a115f,_0x1b893d);this[_0xde07('0x35')][_0xde07('0x71')](this,_0x52ca65,_0x1b893d);if(!this[_0xde07('0x83')](_0x52ca65['variable_id'])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xd5'));}var _0x494bd7=this['getVariable']['sync'](this,_0x52ca65[_0xde07('0xd6')]);if(!_0x494bd7){return this[_0xde07('0xe')]['error'](_0x52ca65,_0xde07('0xd7'));}var _0x7c3c90=this;_0x43ce2f['forEach'](function(_0x13c7ab,_0x14bd1b){Object['keys'](_0x13c7ab)[_0xde07('0xd8')](function(_0x449962){_0x7c3c90[_0xde07('0xe')][_0xde07('0xa6')](util['format'](_0xde07('0xd9'),_0x494bd7,_0x14bd1b,_0x449962),_0x13c7ab[_0x449962]);});});this[_0xde07('0xe')]['setVariable'](util[_0xde07('0x27')](_0xde07('0xda'),_0x494bd7),_0x43ce2f[_0xde07('0x9f')]);return this['channel'][_0xde07('0xb1')](util[_0xde07('0x27')]('variable\x20%s\x20set',_0x494bd7));};AGIVertices[_0xde07('0x14')]['dial']=function(_0xa96ae6){logger['debug'](util[_0xde07('0x27')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xa96ae6['label']));if(!this[_0xde07('0x83')](_0xa96ae6[_0xde07('0xdb')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0xa96ae6,'no\x20user\x20selected');}var _0x223c1b=this[_0xde07('0xdc')][_0xde07('0x71')](this,_0xa96ae6[_0xde07('0xdb')]);if(!_0x223c1b){return this[_0xde07('0xe')][_0xde07('0x2a')](_0xa96ae6,_0xde07('0xdd'));}var _0x26ca8f=this['channel'][_0xde07('0xb5')](_0xde07('0xde'),[util[_0xde07('0x27')](_0xde07('0xdf'),_0x223c1b),_0xa96ae6['timeout'],_0xa96ae6[_0xde07('0xe0')],_0xa96ae6[_0xde07('0x65')]]);if(_0x26ca8f['result']===-0x1){return _0x26ca8f;}return this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0xe6ff57){logger[_0xde07('0x2c')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0xe6ff57[_0xde07('0x36')]));if(!this['isConfigured'](_0xe6ff57['key'])){return this['channel'][_0xde07('0xb1')](_0xde07('0xe1'));}if(!this[_0xde07('0x83')](_0xe6ff57[_0xde07('0x5c')])){return this[_0xde07('0xe')]['noop'](_0xde07('0xbe'));}this[_0xde07('0xe')]['bot']=!![];this[_0xde07('0x35')](_0xe6ff57);this['createSquareMessage'](_0xe6ff57[_0xde07('0x5c')],'in');this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')](_0xde07('0xe2'),_0xe6ff57[_0xde07('0x5c')]));var _0x1d3c5d=this['googleDialogflow'][_0xde07('0x71')](this,_0xe6ff57);if(_0x1d3c5d){for(var _0x5ee681 in _0x1d3c5d){if(_0x1d3c5d[_0xde07('0x98')](_0x5ee681)){this[_0xde07('0xe')][_0xde07('0xa6')](util[_0xde07('0x27')]('DIALOGFLOW_%s',_0x5ee681['toUpperCase']()),_0x1d3c5d[_0x5ee681]);}}this[_0xde07('0x41')](_0x1d3c5d[_0xde07('0xe3')],_0xde07('0xe4'));return this['channel'][_0xde07('0xb1')](util['format'](_0xde07('0xe5'),_0x1d3c5d[_0xde07('0xe3')]));}return this[_0xde07('0xe')][_0xde07('0x2a')](_0xe6ff57,_0xde07('0xe6'));};AGIVertices['prototype'][_0xde07('0xe7')]=function(_0x5a5740){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0xe8'),_0x5a5740[_0xde07('0x36')]));if(!this['isConfigured'](_0x5a5740[_0xde07('0xe9')])){return this['channel'][_0xde07('0xb1')](_0xde07('0xea'));}if(!this['isConfigured'](_0x5a5740[_0xde07('0xeb')])){return this[_0xde07('0xe')]['noop'](_0xde07('0xec'));}if(!this[_0xde07('0x83')](_0x5a5740['password'])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xed'));}if(!this['isConfigured'](_0x5a5740[_0xde07('0xee')])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xbe'));}this[_0xde07('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x5a5740);this[_0xde07('0x41')](_0x5a5740[_0xde07('0x5c')],'in');this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0xef'),_0x5a5740[_0xde07('0x5c')]));var _0x5d76e6=this['sestekNDA'][_0xde07('0x71')](this,_0x5a5740);if(_0x5d76e6){for(var _0x1aa65c in _0x5d76e6){if(_0x5d76e6['hasOwnProperty'](_0x1aa65c)){this[_0xde07('0xe')][_0xde07('0xa6')](util['format'](_0xde07('0xf0'),_0x1aa65c['toUpperCase']()),_0x5d76e6[_0x1aa65c]);}}this['createSquareMessage'](_0x5d76e6[_0xde07('0xe3')],_0xde07('0xe4'));if(_0x5d76e6[_0xde07('0xf1')]){this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5d76e6[_0xde07('0xf1')]));var _0x1eb492=this['channel'][_0xde07('0xf2')](_0x5d76e6[_0xde07('0xf1')]);try{fs[_0xde07('0xf3')](_0x5d76e6[_0xde07('0xf1')]+_0xde07('0xf4'));}catch(_0xeb6f4e){logger[_0xde07('0x2a')](_0xeb6f4e);}return _0x1eb492;}else{return this['channel'][_0xde07('0xb1')](util[_0xde07('0x27')]('SestekNDA\x20Result\x20%s',_0x5d76e6[_0xde07('0xe3')]));}}return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5a5740,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xde07('0x14')][_0xde07('0xf5')]=function(_0x18ed43){logger[_0xde07('0x2c')](util['format'](_0xde07('0xf6'),_0x18ed43[_0xde07('0x36')]));return this['channel'][_0xde07('0xb1')](_0xde07('0xf5'));};AGIVertices[_0xde07('0x14')][_0xde07('0xf7')]=function(_0x2534b1){logger['info'](util['format'](_0xde07('0xf8'),_0x2534b1['label']));var _0x301b93='';if(_0x2534b1[_0xde07('0xf9')]){if(!this[_0xde07('0x83')](_0x2534b1[_0xde07('0xf9')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x2534b1,'no\x20trunk\x20selected');}else{var _0x685996=parseInt(_0x2534b1['trunk_id'],0xa);if(isNaN(_0x685996)){_0x301b93=_0x2534b1[_0xde07('0xf9')];}else{_0x301b93=this[_0xde07('0x1b')][_0xde07('0x71')](this,_0x2534b1[_0xde07('0xf9')]);if(!_0x301b93){return this[_0xde07('0xe')]['error'](_0x2534b1,_0xde07('0xfa'));}}}}else if(_0x2534b1[_0xde07('0xfb')]){_0x301b93=_0x2534b1[_0xde07('0xfb')];}else{return this[_0xde07('0xe')][_0xde07('0x2a')](_0x2534b1,_0xde07('0xfc'));}var _0x9d31bd=this[_0xde07('0xe')][_0xde07('0xb5')](_0xde07('0xde'),[util['format'](_0xde07('0xfd'),_0x301b93,_0x2534b1[_0xde07('0x47')]),_0x2534b1['timeout'],_0x2534b1['opts'],_0x2534b1['url']]);if(_0x9d31bd[_0xde07('0xa4')]===-0x1){return _0x9d31bd;}return this[_0xde07('0xe')][_0xde07('0xb1')](util['format'](_0xde07('0xfe'),'DIAL'));};AGIVertices[_0xde07('0x14')][_0xde07('0xff')]=function(_0x3f412f){logger['info'](util[_0xde07('0x27')](_0xde07('0x100'),_0x3f412f[_0xde07('0x36')]));return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xff'));};AGIVertices[_0xde07('0x14')][_0xde07('0xc')]=function(_0x406c8f){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x101'),_0x406c8f[_0xde07('0x36')]));if(_0x406c8f[_0xde07('0xa7')]===0x0){return this[_0xde07('0xa8')](_0x406c8f);}_0x406c8f[_0xde07('0xa7')]-=0x1;if(!this[_0xde07('0x83')](_0x406c8f[_0xde07('0x102')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x406c8f,_0xde07('0x103'));}var _0x179c75=this[_0xde07('0x104')][_0xde07('0x71')](this,_0x406c8f[_0xde07('0x102')]);if(!_0x179c75){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x406c8f,_0xde07('0x105'));}if(!this[_0xde07('0x83')](_0x406c8f[_0xde07('0xd6')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0xde07('0xd5'));}var _0x4ea4f4=this[_0xde07('0xe')][_0xde07('0x106')](_0x179c75,_0x406c8f['response'],_0x406c8f['maxdigit']);var _0x24fdc9=_0x4ea4f4[_0xde07('0xa4')]?_0x4ea4f4['result']['toString']():'';logger['info'](_0xde07('0x107'),JSON[_0xde07('0x75')](_0x4ea4f4));if(_0x4ea4f4['result']===-0x1){this[_0xde07('0x35')][_0xde07('0x71')](this,_0x406c8f,_0x24fdc9);return _0x4ea4f4;}else if(_0x4ea4f4[_0xde07('0xa2')]===_0xde07('0x67')){_0x4ea4f4[_0xde07('0xa4')]=_0x24fdc9[_0xde07('0x9f')]>=parseInt(_0x406c8f[_0xde07('0x108')])?'x':'i';}else{_0x4ea4f4['result']=_0x24fdc9[_0xde07('0x9f')]>=parseInt(_0x406c8f['mindigit'])&&_0x24fdc9[_0xde07('0x9f')]<=parseInt(_0x406c8f['maxdigit'])?'x':'i';}var _0x19d517=this[_0xde07('0x109')]['sync'](this,_0x406c8f[_0xde07('0xd6')]);if(!_0x19d517){return this['channel'][_0xde07('0x2a')](_0x406c8f,_0xde07('0xd7'));}this[_0xde07('0xe')][_0xde07('0xa6')](_0x19d517,_0x24fdc9);if(this[_0xde07('0x83')](_0x406c8f[_0xde07('0x10a')])){var _0x424d20=parseInt(_0x406c8f[_0xde07('0x10a')],0xa);var _0x407e8e=rs['generate']({'charset':'*','length':_0x424d20});var _0x253314=_0x24fdc9[_0xde07('0x9f')];if(_0x253314>0x0){if(_0x253314>_0x424d20){this[_0xde07('0x35')][_0xde07('0x71')](this,_0x406c8f,_0x406c8f[_0xde07('0x10b')]===_0xde07('0x10c')?_0x407e8e+_0x24fdc9[_0xde07('0x10d')](_0x424d20):_0x24fdc9['substr'](0x0,_0x253314-_0x424d20)+_0x407e8e);}else{this[_0xde07('0x35')][_0xde07('0x71')](this,_0x406c8f,rs[_0xde07('0x10e')]({'charset':'*','length':_0x253314}));}}else{this[_0xde07('0x35')][_0xde07('0x71')](this,_0x406c8f,'');}}else{this['createSquareDetailsReport'][_0xde07('0x71')](this,_0x406c8f,_0x24fdc9);}return _0x4ea4f4;};AGIVertices[_0xde07('0x14')]['getsecretdigits']=function(_0x56085e){logger['info'](util[_0xde07('0x27')](_0xde07('0x10f'),_0x56085e['label']));return this[_0xde07('0xc')](_0x56085e);};AGIVertices['prototype'][_0xde07('0x110')]=function(_0xd3c279){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x111'),_0xd3c279[_0xde07('0x36')]));this[_0xde07('0x35')][_0xde07('0x71')](this,_0xd3c279,_0xd3c279[_0xde07('0x112')]);return this['channel'][_0xde07('0xb1')](util['format']('GOAL\x20%s',_0xd3c279[_0xde07('0x112')]));};AGIVertices[_0xde07('0x14')][_0xde07('0x113')]=function(_0x5506e4){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x114'),_0x5506e4[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x5506e4[_0xde07('0x8c')])||!this[_0xde07('0x83')](_0x5506e4[_0xde07('0x86')])){return this[_0xde07('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this[_0xde07('0x83')](_0x5506e4['text'])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xbe'));}this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')]('Trying\x20aws\x20Polly\x20%s',_0x5506e4[_0xde07('0x5c')]));var _0x5c33fe=this[_0xde07('0x85')][_0xde07('0x71')](this,_0x5506e4);if(_0x5c33fe){this[_0xde07('0xe')][_0xde07('0xb1')](util['format'](_0xde07('0x115'),_0x5c33fe));var _0x264b31=this[_0xde07('0xe')][_0xde07('0xf2')](_0x5c33fe);try{fs[_0xde07('0xf3')](_0x5c33fe+_0xde07('0xf4'));}catch(_0x32a2b0){logger['error'](_0x32a2b0);}return _0x264b31;}return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5506e4,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xde07('0x14')][_0xde07('0x116')]=function(_0x59855c){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x117'),_0x59855c['label']));if(!this[_0xde07('0x83')](_0x59855c[_0xde07('0x8c')])||!this['isConfigured'](_0x59855c[_0xde07('0x86')])){return this[_0xde07('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x59855c['aws_bot_name'])){return this['channel']['noop'](_0xde07('0x118'));}if(!this[_0xde07('0x83')](_0x59855c[_0xde07('0x5c')])){return this[_0xde07('0xe')][_0xde07('0xb1')]('no\x20text\x20configured');}this[_0xde07('0xe')][_0xde07('0x119')]=!![];this[_0xde07('0x35')](_0x59855c);this[_0xde07('0x41')](_0x59855c[_0xde07('0x5c')],'in');this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x11a'),_0x59855c[_0xde07('0x5c')]));var _0x15c935=this[_0xde07('0x8b')][_0xde07('0x71')](this,_0x59855c);if(_0x15c935){for(var _0x3c195a in _0x15c935){if(_0x15c935[_0xde07('0x98')](_0x3c195a)&&_[_0xde07('0x9b')](_0x15c935[_0x3c195a])){this[_0xde07('0xe')]['setVariable'](util[_0xde07('0x27')]('AWS_LEX_%s',_0x3c195a[_0xde07('0x6c')]()),_0x15c935[_0x3c195a]);}}if(_[_0xde07('0x44')](_0x15c935[_0xde07('0x11b')])){return this[_0xde07('0xe')]['noop'](_0xde07('0x11c'));}else{this['createSquareMessage'](_0x15c935[_0xde07('0x11b')],'out');return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x11d'),_0x15c935['message']));}}return this[_0xde07('0xe')]['error'](_0x59855c,_0xde07('0x11e'));};AGIVertices['prototype'][_0xde07('0x11f')]=function(_0x22506e){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x120'),_0x22506e[_0xde07('0x36')],_0x22506e['timeout']));if(!this['isConfigured'](_0x22506e['key'])){return this[_0xde07('0xe')][_0xde07('0xb1')]('no\x20key\x20configured');}var _0x55812a='wav';var _0xf1f6be=util[_0xde07('0x27')](_0xde07('0x121'),FILES_PATH,rs['generate'](0x4));var _0x180524=util['format']('%s.%s',_0xf1f6be,_0x55812a);var _0x359ed9=!![];if(_0x22506e[_0xde07('0x122')]==='NOBEEP'){_0x359ed9=![];}var _0x36ffc3=this['channel']['recordFile'](_0xf1f6be,_0x55812a,_0x22506e[_0xde07('0x123')],_0x22506e['timeout'],undefined,_0x359ed9);if(_0x36ffc3[_0xde07('0xa4')]!==-0x1){this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x124'),_0x180524));var _0x33ca16=this[_0xde07('0x8f')][_0xde07('0x71')](this,_0x22506e,_0x180524);if(_0x33ca16){for(var _0x467f7c in _0x33ca16){if(_0x33ca16[_0xde07('0x98')](_0x467f7c)){this[_0xde07('0xe')]['setVariable'](util[_0xde07('0x27')](_0xde07('0x125'),_0x467f7c[_0xde07('0x6c')]()),_0x33ca16[_0x467f7c]);}}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x126'),JSON[_0xde07('0x75')](_0x33ca16)));}}return _0x36ffc3;};AGIVertices[_0xde07('0x14')]['tildeasr']=function(_0x42ff29){logger[_0xde07('0x2c')](util['format'](_0xde07('0x127'),_0x42ff29[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x42ff29[_0xde07('0x92')])){return this['channel'][_0xde07('0xb1')]('no\x20appid\x20configured');}if(!this[_0xde07('0x83')](_0x42ff29['appsecret'])){return this[_0xde07('0xe')][_0xde07('0xb1')]('no\x20appsecret\x20configured');}var _0x486c08=_0xde07('0x128');var _0x48b60f=util[_0xde07('0x27')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0xdd0851=util['format'](_0xde07('0x9e'),_0x48b60f,_0x486c08);var _0x51a438=!![];if(_0x42ff29[_0xde07('0x122')]==='NOBEEP'){_0x51a438=![];}var _0x4126d=this[_0xde07('0xe')][_0xde07('0x129')](_0x48b60f,_0x486c08,_0x42ff29[_0xde07('0x123')],_0x42ff29['timeout'],undefined,_0x51a438);if(_0x4126d[_0xde07('0xa4')]!==-0x1){this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')](_0xde07('0x12a'),_0xdd0851));var _0x922e60=this[_0xde07('0x91')][_0xde07('0x71')](this,_0x42ff29,_0xdd0851);if(_0x922e60){for(var _0x6d1e91 in _0x922e60){if(_0x922e60['hasOwnProperty'](_0x6d1e91)){this[_0xde07('0xe')][_0xde07('0xa6')](util[_0xde07('0x27')]('TILDE_ASR_%s',_0x6d1e91['toUpperCase']()),_0x922e60[_0x6d1e91]);}}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x12b'),JSON['stringify'](_0x922e60)));}}return _0x4126d;};AGIVertices[_0xde07('0x14')]['gotoc']=function(_0x367650){logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x367650[_0xde07('0x36')]));return this[_0xde07('0xe')][_0xde07('0x12c')](_0x367650[_0xde07('0x12d')],_0x367650['extension'],_0x367650[_0xde07('0x3d')]);};AGIVertices[_0xde07('0x14')]['gotoif']=function(_0x43281f){logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x43281f['label']));if(!this[_0xde07('0x83')](_0x43281f[_0xde07('0x12e')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x43281f,_0xde07('0x12f'));}try{var _0x123323=eval(_0x43281f['condition'])?_0xde07('0x130'):_0xde07('0x131');this['channel']['noop'](util['format'](_0xde07('0x132'),_0x43281f[_0xde07('0x12e')],_0x123323));return{'code':0xc8,'result':_0x123323};}catch(_0x43b51a){return{'code':0xc8,'result':'false'};}};AGIVertices[_0xde07('0x14')][_0xde07('0x133')]=function(_0x5d238b){logger[_0xde07('0x2c')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5d238b[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x5d238b[_0xde07('0x134')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5d238b,_0xde07('0x135'));}var _0x486152=this[_0xde07('0x22')][_0xde07('0x71')](this,_0x5d238b[_0xde07('0x134')]);if(!_0x486152){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5d238b,_0xde07('0x136'));}for(var _0x1fc4a1=0x0;_0x1fc4a1<_0x486152['length'];_0x1fc4a1+=0x1){var _0x53ef7f=this[_0xde07('0xe')][_0xde07('0x109')](util[_0xde07('0x27')](_0xde07('0x137'),_0x486152[_0x1fc4a1]));if(_0x53ef7f[_0xde07('0xa4')]===-0x1){return _0x53ef7f;}logger[_0xde07('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0x486152[_0x1fc4a1],_0x53ef7f[_0xde07('0xa2')]));if(_0x53ef7f[_0xde07('0xa2')]===_0xde07('0x130')){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x138'),_0x486152[_0x1fc4a1],'true'));this[_0xde07('0xe')][_0xde07('0xb1')](util['format'](_0xde07('0x138'),_0x486152[_0x1fc4a1],_0xde07('0x130')));return{'code':0xc8,'result':'true'};}else{logger[_0xde07('0x2c')](util['format']('IFTIME\x20%s\x20%s',_0x486152[_0x1fc4a1],_0xde07('0x131')));this[_0xde07('0xe')][_0xde07('0xb1')](util['format']('IFTIME\x20%s\x20%s',_0x486152[_0x1fc4a1],_0xde07('0x131')));}}return{'code':0xc8,'result':_0xde07('0x131')};};AGIVertices['prototype'][_0xde07('0x139')]=function(_0x532c47){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x532c47[_0xde07('0x36')]));return this[_0xde07('0xe')]['hangup']();};AGIVertices[_0xde07('0x14')][_0xde07('0x13a')]=function(_0x5e5688){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x13b'),_0x5e5688[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x5e5688[_0xde07('0x7b')])){return this['channel'][_0xde07('0xb1')](_0xde07('0xe1'));}var _0x5a771b=_0xde07('0x128');var _0x78b8ad=util[_0xde07('0x27')](_0xde07('0x121'),FILES_PATH,rs['generate'](0x4));var _0x2b9a16=util[_0xde07('0x27')](_0xde07('0x9e'),_0x78b8ad,_0x5a771b);var _0x57eb1d=!![];if(_0x5e5688[_0xde07('0x122')]===_0xde07('0x13c')){_0x57eb1d=![];}var _0x304f92=this[_0xde07('0xe')]['recordFile'](_0x78b8ad,_0x5a771b,_0x5e5688[_0xde07('0x123')],_0x5e5688[_0xde07('0x67')],undefined,_0x57eb1d);if(_0x304f92[_0xde07('0xa4')]!==-0x1){this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x13d'),_0x2b9a16));var _0xc51f9b=this[_0xde07('0x81')]['sync'](this,_0x5e5688,_0x2b9a16);if(_0xc51f9b){for(var _0x33a470 in _0xc51f9b){if(_0xc51f9b[_0xde07('0x98')](_0x33a470)){this[_0xde07('0xe')]['setVariable'](util['format']('ISPEECH_ASR_%s',_0x33a470[_0xde07('0x6c')]()),_0xc51f9b[_0x33a470]);}}return this['channel'][_0xde07('0xb1')](util[_0xde07('0x27')]('IspeechASR\x20Result\x20%s',JSON[_0xde07('0x75')](_0xc51f9b)));}}return _0x304f92;};AGIVertices[_0xde07('0x14')][_0xde07('0x13e')]=function(_0x1d43a5){logger['info'](util[_0xde07('0x27')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x1d43a5[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x1d43a5['key'])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0xe1'));}if(!this[_0xde07('0x83')](_0x1d43a5[_0xde07('0x5c')])){return this[_0xde07('0xe')][_0xde07('0xb1')]('no\x20text\x20configured');}this[_0xde07('0xe')][_0xde07('0xb1')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x1d43a5[_0xde07('0x5c')]));var _0x3d6f7f=this[_0xde07('0x7e')]['sync'](this,_0x1d43a5);if(_0x3d6f7f){this[_0xde07('0xe')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x3d6f7f));var _0x20df0a=this[_0xde07('0xe')][_0xde07('0xf2')](_0x3d6f7f,_0x1d43a5[_0xde07('0x123')]);try{fs[_0xde07('0xf3')](_0x3d6f7f+_0xde07('0xf4'));}catch(_0x2a5ad3){logger[_0xde07('0x2a')](_0x2a5ad3);}return _0x20df0a;}return this[_0xde07('0xe')][_0xde07('0x2a')](_0x1d43a5,_0xde07('0x13f'));};AGIVertices[_0xde07('0x14')][_0xde07('0x140')]=function(_0x1e7f5c){logger['info'](util[_0xde07('0x27')](_0xde07('0x141'),_0x1e7f5c[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x1e7f5c[_0xde07('0x142')])){return this['channel'][_0xde07('0x2a')](_0x1e7f5c,'no\x20find\x20by\x20configured');}logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x143'),this[_0xde07('0xe')][_0xde07('0x39')],_0x1e7f5c['findBy']));var _0x57de7c=this[_0xde07('0x52')]['sync'](this,_0x1e7f5c[_0xde07('0x142')]);if(_0x57de7c){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x144'),this[_0xde07('0xe')][_0xde07('0x39')],_0x1e7f5c[_0xde07('0x142')]));this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')](_0xde07('0x144'),this[_0xde07('0xe')]['callerid'],_0x1e7f5c['findBy']));return{'code':0xc8,'result':_0xde07('0x145')};}else{logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x146'),this[_0xde07('0xe')]['callerid'],_0x1e7f5c['findBy']));this[_0xde07('0xe')][_0xde07('0xb1')](util['format'](_0xde07('0x146'),this[_0xde07('0xe')][_0xde07('0x39')],_0x1e7f5c[_0xde07('0x142')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xde07('0x14')]['logout']=function(_0x43a239){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x147'),_0x43a239[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x43a239[_0xde07('0x142')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x43a239,'no\x20find\x20by\x20configured');}logger[_0xde07('0x2c')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xde07('0xe')]['callerid'],_0x43a239[_0xde07('0x142')]));var _0x591ce8=this[_0xde07('0x51')][_0xde07('0x71')](this,_0x43a239[_0xde07('0x142')]);if(_0x591ce8){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x144'),this[_0xde07('0xe')][_0xde07('0x39')],_0x43a239['findBy']));this['channel'][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x144'),this['channel'][_0xde07('0x39')],_0x43a239[_0xde07('0x142')]));return{'code':0xc8,'result':_0xde07('0x145')};}else{logger[_0xde07('0x2c')](util[_0xde07('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xde07('0xe')][_0xde07('0x39')],_0x43a239[_0xde07('0x142')]));this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xde07('0xe')][_0xde07('0x39')],_0x43a239[_0xde07('0x142')]));return{'code':0xc8,'result':_0xde07('0x148')};}};AGIVertices[_0xde07('0x14')]['math']=function(_0x275545){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x149'),_0x275545['label']));if(!this['isConfigured'](_0x275545[_0xde07('0x14a')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x275545,_0xde07('0x14b'));}this['channel'][_0xde07('0xb1')](util['format'](_0xde07('0x14c'),_0x275545['operation']));var _0x4456ed=eval(_0x275545[_0xde07('0x14a')]);if(!this['isConfigured'](_0x275545['variable_id'])){return this['channel'][_0xde07('0xb1')](_0xde07('0xd5'));}var _0x4d9990=this[_0xde07('0x109')][_0xde07('0x71')](this,_0x275545['variable_id']);if(!_0x4d9990){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x275545,_0xde07('0xd7'));}if(_[_0xde07('0x9a')](_0x4456ed)){var _0x1f5474=this;_0x4456ed['forEach'](function(_0x330097,_0x3b1792){_0x1f5474[_0xde07('0xe')][_0xde07('0xa6')](util[_0xde07('0x27')](_0xde07('0x14d'),_0x4d9990,_0x3b1792),_0x330097);});return this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')](_0xde07('0x14e'),_0x4d9990));}else{return this[_0xde07('0xe')][_0xde07('0xa6')](_0x4d9990,_0x4456ed);}};AGIVertices['prototype'][_0xde07('0xb')]=function(_0x5ec8e2){logger['info'](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x5ec8e2[_0xde07('0x36')]));if(_0x5ec8e2['retry']===0x0){return this['maxRetry'](_0x5ec8e2);}_0x5ec8e2['retry']-=0x1;if(!this[_0xde07('0x83')](_0x5ec8e2['file_id'])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5ec8e2,'no\x20file\x20audio\x20selected');}var _0x3c1710=this[_0xde07('0x104')][_0xde07('0x71')](this,_0x5ec8e2[_0xde07('0x102')]);if(!_0x3c1710){return this[_0xde07('0xe')]['error'](_0x5ec8e2,_0xde07('0x105'));}var _0x2cc277=this[_0xde07('0xe')][_0xde07('0x106')](_0x3c1710,_0x5ec8e2[_0xde07('0x14f')],_0x5ec8e2[_0xde07('0x150')]);var _0x53adba=_0x2cc277[_0xde07('0xa4')];if(_0x2cc277['result']===-0x1){this[_0xde07('0x35')][_0xde07('0x71')](this,_0x5ec8e2,'-1');return _0x2cc277;}else if(_0x2cc277[_0xde07('0xa2')]==='timeout'){_0x2cc277[_0xde07('0xa4')]=_0x2cc277[_0xde07('0xa4')][_0xde07('0x9f')]>0x0?_0x2cc277[_0xde07('0xa4')]:'t';}else if(_[_0xde07('0x43')](_0x2cc277[_0xde07('0xa4')])){_0x2cc277[_0xde07('0xa4')]='#';_0x53adba='#';}if(!this[_0xde07('0x83')](_0x5ec8e2[_0xde07('0xd6')])){this[_0xde07('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x175961=this[_0xde07('0x109')][_0xde07('0x71')](this,_0x5ec8e2['variable_id']);if(!_0x175961){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5ec8e2,_0xde07('0xd7'));}this[_0xde07('0xe')]['setVariable'](_0x175961,_0x53adba);}this['createSquareDetailsReport']['sync'](this,_0x5ec8e2,_0x53adba);return _0x2cc277;};AGIVertices[_0xde07('0x14')][_0xde07('0xb1')]=function(_0x30c59a){logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x30c59a['label']));return this[_0xde07('0xe')][_0xde07('0xb1')](_0x30c59a[_0xde07('0x151')]||_0x30c59a[_0xde07('0x36')]);};AGIVertices[_0xde07('0x14')][_0xde07('0x152')]=function(_0x4690ce){logger['info'](util['format'](_0xde07('0x153'),_0x4690ce['label']));if(!this[_0xde07('0x83')](_0x4690ce[_0xde07('0x142')])){return this['channel'][_0xde07('0x2a')](_0x4690ce,_0xde07('0x154'));}logger['info'](util[_0xde07('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xde07('0x39')],_0x4690ce[_0xde07('0x142')]));var _0x736bad=this[_0xde07('0x4c')][_0xde07('0x71')](this,_0x4690ce[_0xde07('0x155')]);var _0x128dce=this[_0xde07('0x4e')][_0xde07('0x71')](this,_0x4690ce[_0xde07('0x142')],_0x736bad);if(_0x128dce){logger[_0xde07('0x2c')](util['format'](_0xde07('0x144'),this[_0xde07('0xe')][_0xde07('0x39')],_0x4690ce[_0xde07('0x142')]));this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x144'),this[_0xde07('0xe')][_0xde07('0x39')],_0x4690ce[_0xde07('0x142')]));return{'code':0xc8,'result':'success'};}else{logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x146'),this[_0xde07('0xe')][_0xde07('0x39')],_0x4690ce[_0xde07('0x142')]));this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x144'),this[_0xde07('0xe')][_0xde07('0x39')],_0x4690ce['findBy']));return{'code':0xc8,'result':_0xde07('0x148')};}};AGIVertices[_0xde07('0x14')][_0xde07('0x156')]=function(_0x3f0fb7){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x157'),_0x3f0fb7[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x3f0fb7[_0xde07('0x102')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x3f0fb7,_0xde07('0x103'));}var _0x342b6c=this[_0xde07('0x104')][_0xde07('0x71')](this,_0x3f0fb7['file_id']);if(!_0x342b6c){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x3f0fb7,_0xde07('0x105'));}var _0x4fa6af=this[_0xde07('0xe')][_0xde07('0xb5')](_0xde07('0x158'),[_0x342b6c,_0x3f0fb7['opts']]);if(_0x4fa6af['result']===-0x1){return _0x4fa6af;}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')]('Executed\x20command\x20%s\x20%s',_0xde07('0x158'),_0x342b6c));};AGIVertices['prototype'][_0xde07('0x159')]=function(_0x5af528){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x15a'),_0x5af528[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x5af528['queue_id'])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5af528,_0xde07('0x15b'));}var _0x8a45d5='';var _0x213b34=parseInt(_0x5af528['queue_id'],0xa);if(isNaN(_0x213b34)){_0x8a45d5=_0x5af528[_0xde07('0x15c')];}else{_0x8a45d5=this['getVoiceQueue'][_0xde07('0x71')](this,_0x5af528['queue_id']);if(!_0x8a45d5){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x5af528,_0xde07('0x15d'));}}var _0x372eba='';if(this['isConfigured'](_0x5af528[_0xde07('0x102')])){var _0x10d5ff=this[_0xde07('0x104')][_0xde07('0x71')](this,_0x5af528['file_id']);if(_0x10d5ff){_0x372eba=_0x10d5ff;}}this[_0xde07('0x35')][_0xde07('0x71')](this,_0x5af528,_0x8a45d5);if(_0x5af528[_0xde07('0xe0')][_0xde07('0x15e')]('x')<0x0){_0x5af528[_0xde07('0xe0')]+='x';}if(_0x5af528[_0xde07('0xe0')][_0xde07('0x15e')]('X')<0x0){_0x5af528['opts']+='X';}this[_0xde07('0xe')][_0xde07('0xa6')](_0xde07('0x15f'),_0x8a45d5?_0x8a45d5[_0xde07('0x160')]():'');var _0x103565=this[_0xde07('0xe')][_0xde07('0xb5')](_0xde07('0x161'),[_0x8a45d5,_0x5af528[_0xde07('0xe0')],_0x5af528['url'],_0x372eba,_0x5af528['timeout'],_0x5af528[_0xde07('0xa9')],_0x5af528[_0xde07('0x162')],_0x5af528[_0xde07('0x163')],'',_0x5af528['position']]);if(_0x103565[_0xde07('0xa4')]===-0x1){return _0x103565;}return this['channel']['noop'](util['format'](_0xde07('0xb7'),_0xde07('0x161'),_0x8a45d5));};AGIVertices['prototype'][_0xde07('0x164')]=function(_0xe2ca52){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x165'),_0xe2ca52[_0xde07('0x36')]));var _0x37f083=_0xe2ca52[_0xde07('0x166')]||_0xde07('0x128');var _0xc5a0e9=util[_0xde07('0x27')](_0xde07('0x167'),this[_0xde07('0xe')][_0xde07('0x3b')],rs[_0xde07('0x10e')](0x5));var _0x5d6c73=util[_0xde07('0x27')]('%s/recordings/%s.%s',FILES_PATH,_0xc5a0e9,_0x37f083);var _0x27770f=util[_0xde07('0x27')](_0xde07('0x121'),FILES_PATH,_0xc5a0e9);this['createSquareRecording'][_0xde07('0x71')](this,_0xe2ca52,_0xc5a0e9,_0x5d6c73);this[_0xde07('0xe')]['setVariable'](_0xde07('0x168'),_0xc5a0e9);logger['info'](_0xde07('0x169'),_0x27770f,_0x37f083,_0xe2ca52['escape_digits'],_0xe2ca52[_0xde07('0x67')]);return this[_0xde07('0xe')]['recordFile'](_0x27770f,_0x37f083,_0xe2ca52['escape_digits'],_0xe2ca52[_0xde07('0x67')],undefined,!![]);};AGIVertices[_0xde07('0x14')]['restapi']=function(_0x188776){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x16a'),_0x188776[_0xde07('0x36')]));if(!this['isConfigured'](_0x188776[_0xde07('0x65')])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0x16b'));}var _0x4612a0=this[_0xde07('0x64')]['sync'](this,_0x188776);logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Response:',util['inspect'](_0x4612a0,{'showHidden':![],'depth':null})));if(!this[_0xde07('0x83')](_0x188776['variable_id'])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0x16c'));}var _0x1f8eac=this[_0xde07('0x109')][_0xde07('0x71')](this,_0x188776[_0xde07('0xd6')]);if(!_0x1f8eac){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x188776,_0xde07('0xd7'));}this['channel']['setVariable'](util[_0xde07('0x27')](_0xde07('0x16d'),_0x1f8eac),_0x4612a0[_0xde07('0x76')]?_0x4612a0['statusCode']:_0xde07('0x16e'));this[_0xde07('0xe')][_0xde07('0xa6')](util[_0xde07('0x27')](_0xde07('0x16f'),_0x1f8eac),_0x4612a0[_0xde07('0x77')]?_0x4612a0['statusMessage']:'OK');if(_0x4612a0[_0xde07('0x6d')]){try{this['saveRestApiResult'](_0x4612a0['body'],_0x1f8eac);}catch(_0x4837d1){logger['error'](util[_0xde07('0x27')](_0xde07('0x170'),_0x1f8eac));}}return this['channel'][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x171'),_0x1f8eac));};AGIVertices['prototype']['saydigits']=function(_0x54bc5e){logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x54bc5e[_0xde07('0x36')]));return this[_0xde07('0xe')]['sayDigits'](_0x54bc5e[_0xde07('0x172')]['replace'](/\s+/g,''),_0x54bc5e[_0xde07('0x173')]);};AGIVertices[_0xde07('0x14')][_0xde07('0x174')]=function(_0x391d78){logger['info'](util['format'](_0xde07('0x175'),_0x391d78[_0xde07('0x36')]));return this[_0xde07('0xe')][_0xde07('0x176')](_0x391d78[_0xde07('0x68')][_0xde07('0x58')](/\s+/g,''),_0x391d78[_0xde07('0x173')]);};AGIVertices[_0xde07('0x14')][_0xde07('0x177')]=function(_0x1a05ae){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x178'),_0x1a05ae[_0xde07('0x36')]));return this[_0xde07('0xe')][_0xde07('0x179')](_0x1a05ae['text'],_0x1a05ae[_0xde07('0x173')]);};AGIVertices['prototype']['sendMail']=function(_0x23afc3){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x17a'),_0x23afc3['label']));if(!this['isConfigured'](_0x23afc3['account_id'])){return this[_0xde07('0xe')]['noop']('no\x20mail\x20account\x20configured');}var _0x42a045=this[_0xde07('0x17b')][_0xde07('0x71')](this,_0x23afc3[_0xde07('0x17c')]);if(!_0x42a045||!_0x42a045['Smtp']){return this['channel'][_0xde07('0x2a')](_0x23afc3,_0xde07('0x17d'));}var _0x2b517b={'from':util['format'](_0xde07('0x17e'),_0x42a045['name'],_0x42a045[_0xde07('0x17f')]||_0x42a045[_0xde07('0x180')]['user']),'to':_0x23afc3['to']||'','cc':_0x23afc3['cc']||'','bcc':_0x23afc3[_0xde07('0x181')]||'','subject':_0x23afc3[_0xde07('0x182')],'html':_0x23afc3[_0xde07('0x5c')],'text':_0x23afc3[_0xde07('0x5c')]};var _0x42f7f5={'tls':{'rejectUnauthorized':![]}};if(_0x42a045[_0xde07('0x180')]['service']){_0x42f7f5['service']=_0x42a045[_0xde07('0x180')][_0xde07('0x183')];}else{_0x42f7f5['host']=_0x42a045['Smtp'][_0xde07('0x184')];_0x42f7f5[_0xde07('0x185')]=_0x42a045[_0xde07('0x180')]['port'];_0x42f7f5[_0xde07('0x186')]=_0x42a045['Smtp']['secure'];}if(_0x42a045[_0xde07('0x180')][_0xde07('0x187')]){_0x42f7f5[_0xde07('0x188')]={'user':_0x42a045[_0xde07('0x180')][_0xde07('0x189')],'pass':_0x42a045[_0xde07('0x180')][_0xde07('0x18a')]};}if(this[_0xde07('0x83')](_0x23afc3['template_id'])){}logger[_0xde07('0x18b')](_0xde07('0x18c'),JSON[_0xde07('0x75')](_0x2b517b));this[_0xde07('0x35')][_0xde07('0x71')](this,_0x23afc3,_0x23afc3[_0xde07('0x17c')]);this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x18d'),_0x42a045['name']));this[_0xde07('0x21')][_0xde07('0x71')](this,_0x42f7f5,_0x2b517b);return this[_0xde07('0xe')]['noop'](_0xde07('0x18e'));};AGIVertices[_0xde07('0x14')][_0xde07('0x18f')]=function(_0x3703fd){logger[_0xde07('0x2c')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x3703fd['label']));return this[_0xde07('0xe')]['noop'](_0xde07('0x190'));};AGIVertices[_0xde07('0x14')][_0xde07('0x191')]=function(_0x3e8cc4){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x192'),_0x3e8cc4[_0xde07('0x36')]));if(!this['isConfigured'](_0x3e8cc4[_0xde07('0x193')])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0x194'));}var _0x3cffd4=this['getSmsAccount'][_0xde07('0x71')](this,_0x3e8cc4[_0xde07('0x193')]);if(!_0x3cffd4){return this['channel']['error'](_0x3e8cc4,_0xde07('0x195'));}var _0x1a3415={'body':_0x3e8cc4[_0xde07('0x196')],'phone':_0x3e8cc4['to']||'','SmsAccountId':_0x3cffd4['id']};logger['debug']('sendSMS\x20message',JSON[_0xde07('0x75')](_0x1a3415));this[_0xde07('0x35')][_0xde07('0x71')](this,_0x3e8cc4,_0x3e8cc4[_0xde07('0x193')]);this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x197'),_0x3cffd4[_0xde07('0x12')]));this[_0xde07('0x34')][_0xde07('0x71')](this,_0x1a3415);return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0x198'));};AGIVertices['prototype'][_0xde07('0x199')]=function(_0x269a28){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x19a'),_0x269a28[_0xde07('0x36')]));if(!this['isConfigured'](_0x269a28[_0xde07('0xd6')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x269a28,_0xde07('0x19b'));}var _0x56ca39=this['getVariable']['sync'](this,_0x269a28['variable_id']);if(!_0x56ca39){return this['channel'][_0xde07('0x2a')](_0x269a28,_0xde07('0xd7'));}return this[_0xde07('0xe')][_0xde07('0xa6')](_0x56ca39,_0x269a28[_0xde07('0x19c')]);};AGIVertices[_0xde07('0x14')][_0xde07('0x19d')]=function(_0x51d2b0){logger[_0xde07('0x2c')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x51d2b0[_0xde07('0x36')]));this[_0xde07('0xe')]['noop']('START\x20CALLY\x20SQUARE');if(_0x51d2b0[_0xde07('0x19e')]===_0xde07('0x19f')){this['channel'][_0xde07('0xb1')](_0xde07('0x1a0'));return this['channel'][_0xde07('0x19e')]();}return this['channel'][_0xde07('0xb1')](_0xde07('0x1a1'));};AGIVertices[_0xde07('0x14')][_0xde07('0x1a2')]=function(_0x27c13c){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x1a3'),_0x27c13c['label']));if(!this[_0xde07('0x83')](_0x27c13c[_0xde07('0x1a4')])){return this[_0xde07('0xe')]['error'](_0x27c13c,_0xde07('0x1a5'));}var _0x31f9a3=this['getSquareProject'][_0xde07('0x71')](this,_0x27c13c[_0xde07('0x1a4')]);if(!this[_0xde07('0x83')](_0x31f9a3)){return this['channel'][_0xde07('0x2a')](_0x27c13c,util['format'](_0xde07('0x1a6'),_0x27c13c[_0xde07('0x1a4')]));}if(_0x31f9a3===this[_0xde07('0xe')][_0xde07('0x38')]){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x27c13c,_0xde07('0x1a7'));}this[_0xde07('0x35')][_0xde07('0x71')](this,_0x27c13c,_0x31f9a3);var _0x327d37=this[_0xde07('0xe')][_0xde07('0xb5')](_0xde07('0x1a8'),util[_0xde07('0x27')](_0xde07('0x1a9'),config[_0xde07('0xa9')][_0xde07('0x184')]||_0xde07('0x1aa'),_0x31f9a3,this[_0xde07('0xe')]['arg_1']));if(_0x327d37['result']===-0x1){return _0x327d37;}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0xb7'),_0xde07('0x1a8'),_0x31f9a3));};AGIVertices[_0xde07('0x14')][_0xde07('0x1ab')]=function(_0x1b68ec){logger[_0xde07('0x2c')](util['format'](_0xde07('0x1ac'),_0x1b68ec[_0xde07('0x36')]));var _0x2b2fa6=this[_0xde07('0x56')][_0xde07('0x71')](this,_0x1b68ec[_0xde07('0x1ad')]);this['createSquareDetailsReport']['sync'](this,_0x1b68ec,_0x1b68ec[_0xde07('0x1ad')]);if(this[_0xde07('0x83')](_0x1b68ec[_0xde07('0xd6')])){var _0x1cdf65=this[_0xde07('0x109')]['sync'](this,_0x1b68ec[_0xde07('0xd6')]);if(_0x1cdf65){this[_0xde07('0xe')][_0xde07('0xa6')](_0x1cdf65,_0x2b2fa6);return this[_0xde07('0xe')]['noop'](util[_0xde07('0x27')](_0xde07('0x1ae'),_0x1b68ec[_0xde07('0x1ad')],_0x1cdf65));}}return this['channel']['noop'](util['format'](_0xde07('0x1af'),_0x1b68ec['command']));};AGIVertices[_0xde07('0x14')][_0xde07('0x1b0')]=function(_0xcba458){logger[_0xde07('0x2c')](util[_0xde07('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0xcba458[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0xcba458[_0xde07('0x5a')])){return this[_0xde07('0xe')][_0xde07('0xb1')](_0xde07('0x1b1'));}if(!this['isConfigured'](_0xcba458[_0xde07('0x5c')])){return this[_0xde07('0xe')]['noop']('no\x20text\x20configured');}this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0xcba458[_0xde07('0x5c')]));var _0x1c32a7=this[_0xde07('0x59')][_0xde07('0x71')](this,_0xcba458);if(_0x1c32a7){this['channel']['noop'](util['format'](_0xde07('0x1b2'),_0x1c32a7));var _0x4f6e13=this[_0xde07('0xe')][_0xde07('0xf2')](_0x1c32a7);try{fs[_0xde07('0xf3')](_0x1c32a7+_0xde07('0xf4'));}catch(_0x39a454){logger[_0xde07('0x2a')](_0x39a454);}return _0x4f6e13;}return this[_0xde07('0xe')][_0xde07('0x2a')](_0xcba458,_0xde07('0x1b3'));};AGIVertices['prototype'][_0xde07('0x1b4')]=function(_0x2c4dfe){logger['info'](util[_0xde07('0x27')](_0xde07('0x1b5'),_0x2c4dfe[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x2c4dfe[_0xde07('0x5c')])){return this[_0xde07('0xe')][_0xde07('0xb1')]('no\x20text\x20configured');}this[_0xde07('0xe')][_0xde07('0xb1')](util['format'](_0xde07('0x1b6'),_0x2c4dfe[_0xde07('0x5c')]));var _0x3b8d9d=this['googleTTS'][_0xde07('0x71')](this,_0x2c4dfe);if(_0x3b8d9d){this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x1b7'),_0x3b8d9d));var _0x229d6d=this['channel'][_0xde07('0xf2')](_0x3b8d9d);try{fs[_0xde07('0xf3')](_0x3b8d9d+_0xde07('0xf4'));}catch(_0x5e3fe9){logger['error'](_0x5e3fe9);}return _0x229d6d;}return this[_0xde07('0xe')]['error'](_0x2c4dfe,_0xde07('0x1b8'));};AGIVertices[_0xde07('0x14')]['unpause']=function(_0x368d27){logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x1b9'),_0x368d27[_0xde07('0x36')]));if(!this[_0xde07('0x83')](_0x368d27[_0xde07('0x142')])){return this[_0xde07('0xe')][_0xde07('0x2a')](_0x368d27,_0xde07('0x154'));}logger[_0xde07('0x2c')](util[_0xde07('0x27')](_0xde07('0x143'),this[_0xde07('0xe')][_0xde07('0x39')],_0x368d27['findBy']));var _0x18f8e9=this[_0xde07('0x50')]['sync'](this,_0x368d27['findBy']);if(_0x18f8e9){logger[_0xde07('0x2c')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xde07('0xe')][_0xde07('0x39')],_0x368d27[_0xde07('0x142')]));this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x144'),this[_0xde07('0xe')][_0xde07('0x39')],_0x368d27[_0xde07('0x142')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0xde07('0x146'),this['channel'][_0xde07('0x39')],_0x368d27['findBy']));this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0x146'),this[_0xde07('0xe')][_0xde07('0x39')],_0x368d27['findBy']));return{'code':0xc8,'result':_0xde07('0x148')};}};AGIVertices['prototype'][_0xde07('0x1ba')]=function(_0x3e283b){logger[_0xde07('0x2c')](util['format'](_0xde07('0x1bb'),_0x3e283b[_0xde07('0x36')]));var _0x2fceef=this[_0xde07('0xe')]['exec']('VOICEMAIL',[_0x3e283b[_0xde07('0x1bc')],_0x3e283b[_0xde07('0x79')]]);if(_0x2fceef[_0xde07('0xa4')]===-0x1){return _0x2fceef;}return this[_0xde07('0xe')][_0xde07('0xb1')](util[_0xde07('0x27')](_0xde07('0xb7'),_0xde07('0x1bd'),_0x3e283b[_0xde07('0x1bc')]));};AGIVertices[_0xde07('0x14')][_0xde07('0x1be')]=function(_0x8ea44a){logger[_0xde07('0x2c')](util['format'](_0xde07('0x1bf'),_0x8ea44a[_0xde07('0x36')]));if(!this['isConfigured'](_0x8ea44a[_0xde07('0xd6')])){return this[_0xde07('0xe')]['error'](_0x8ea44a,_0xde07('0x19b'));}var _0x188378=this[_0xde07('0x109')][_0xde07('0x71')](this,_0x8ea44a[_0xde07('0xd6')]);if(!_0x188378){return this[_0xde07('0xe')]['error'](_0x8ea44a,_0xde07('0xd7'));}var _0x1a8fb3=this[_0xde07('0xe')][_0xde07('0x109')](_0x188378);return{'code':0xc8,'result':_0x1a8fb3[_0xde07('0xa2')]?_0x1a8fb3[_0xde07('0xa2')]:'-'};};String[_0xde07('0x14')]['replaceAll']=function(_0x588428,_0x2a1b17){return this[_0xde07('0xa0')](_0x588428)[_0xde07('0x1c0')](_0x2a1b17);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 0d7fcd0..29393af 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 _0x425d=['syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','name','mandatoryDispositionPause','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','uniqueid','catch','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','error','message','[TIMER][STOP][AGENT:%s]','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','util','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview'];(function(_0x35d8af,_0x14fd75){var _0x1d08b0=function(_0x36b437){while(--_0x36b437){_0x35d8af['push'](_0x35d8af['shift']());}};_0x1d08b0(++_0x14fd75);}(_0x425d,0x1e0));var _0xd425=function(_0x272638,_0x53c9ea){_0x272638=_0x272638-0x0;var _0x5a5739=_0x425d[_0x272638];return _0x5a5739;};'use strict';var util=require(_0xd425('0x0'));var _=require('lodash');var moment=require(_0xd425('0x1'));var ami=require(_0xd425('0x2'));var logger=require(_0xd425('0x3'))(_0xd425('0x4'));var RpcUser=require(_0xd425('0x5'));var RpcVoiceAgentReport=require(_0xd425('0x6'));function Acw(_0x47043f){this['voiceQueues']=_0x47043f[_0xd425('0x7')];this[_0xd425('0x8')]=_0x47043f[_0xd425('0x8')];this[_0xd425('0x9')]=_0x47043f[_0xd425('0x9')];this[_0xd425('0xa')]={};ami['on']('agentconnect',this[_0xd425('0xb')][_0xd425('0xc')](this));ami['on'](_0xd425('0xd'),this[_0xd425('0xe')][_0xd425('0xc')](this));ami['on'](_0xd425('0xf'),this[_0xd425('0x10')][_0xd425('0xc')](this));ami['on'](_0xd425('0x11'),this[_0xd425('0x12')][_0xd425('0xc')](this));ami['on'](_0xd425('0x13'),this[_0xd425('0x14')][_0xd425('0xc')](this));ami['on'](_0xd425('0x15'),this[_0xd425('0x16')][_0xd425('0xc')](this));ami['on'](_0xd425('0x17'),this[_0xd425('0x18')][_0xd425('0xc')](this));}function getDiff(_0x51263f){var _0x27318c=moment()[_0xd425('0x19')](0x0);var _0x336dc3=moment(_0x51263f)['milliseconds'](0x0);return _0x27318c[_0xd425('0x1a')](_0x336dc3,_0xd425('0x1b'));}Acw[_0xd425('0x1c')][_0xd425('0x1d')]=function(_0x1fc822){try{var _0x538a0a=this;var _0x278626=this[_0xd425('0xa')][_0x1fc822][_0xd425('0x1e')];var _0x5dda0c=this['channels'][_0x1fc822][_0xd425('0x1f')];var _0x434d97=this[_0xd425('0x7')][_0x5dda0c];var _0x1155bc=![];var _0x4e88fa='ACW';if(_0x434d97['mandatoryDisposition']){if(_0x434d97['mandatoryDispositionPause'][_0xd425('0x20')]){_0x1155bc=!![];_0x4e88fa=_0x434d97[_0xd425('0x21')][_0xd425('0x20')];}}ami['Action']({'action':_0xd425('0x22'),'interface':_0x278626,'paused':!![],'reason':_0x4e88fa})[_0xd425('0x23')](function(_0x5f1e7e){if(_0x538a0a[_0xd425('0x8')][_0x278626]){return RpcUser[_0xd425('0x24')](_0x538a0a[_0xd425('0x8')][_0x278626]['id'])[_0xd425('0x23')](function(_0x3e93db){if(_0x3e93db&&!_0x3e93db[_0xd425('0x25')]){logger[_0xd425('0x26')](_0xd425('0x27'),_0x1fc822,_0x278626,_0x5dda0c);var _0x314201=_0x538a0a[_0xd425('0xa')][_0x1fc822][_0xd425('0x28')]&&_0x538a0a[_0xd425('0xa')][_0x1fc822]['destlinkedid']?_0x538a0a[_0xd425('0xa')][_0x1fc822][_0xd425('0x29')]:_0x1fc822;return RpcUser[_0xd425('0x2a')](_0x538a0a[_0xd425('0x8')][_0x278626],_0x4e88fa,_0x314201)[_0xd425('0x23')](function(_0x400dd7){if(!_0x1155bc){_0x538a0a[_0xd425('0x9')][_0x278626]={};logger['info'](_0xd425('0x2b'),_0x1fc822,_0x538a0a[_0xd425('0x7')][_0x5dda0c][_0xd425('0x2c')],_0x278626,_0x5dda0c);_0x538a0a['timers'][_0x278626][_0xd425('0x2d')]=setTimeout(_0x538a0a[_0xd425('0x2e')][_0xd425('0xc')](_0x538a0a,_0x278626),_0x538a0a[_0xd425('0x7')][_0x5dda0c][_0xd425('0x2c')]*0x3e8);_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x2f')]=moment()[_0xd425('0x30')](_0xd425('0x31'));_0x538a0a[_0xd425('0x9')][_0x278626]['uniqueid']=_0x1fc822;_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x1f')]=_0x5dda0c;_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x32')]=function(){var _0x3275b1=getDiff(_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x2f')]);clearTimeout(_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x2d')]);_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x2d')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x3275b1},_0x538a0a[_0xd425('0x9')][_0x278626][_0xd425('0x33')],_0x278626)[_0xd425('0x23')](function(_0x21e0bd){logger[_0xd425('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x1fc822,_0x3275b1,_0x21e0bd);})[_0xd425('0x34')](function(_0x3badcc){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x1fc822,_0x3badcc);});delete _0x538a0a['timers'][_0x278626];};}});}else{logger[_0xd425('0x26')](_0xd425('0x35'),_0x1fc822,_0x278626,_0x5dda0c);}});}})[_0xd425('0x34')](function(_0x2d586f){logger['error'](_0xd425('0x2b'),_0x1fc822,_0x538a0a[_0xd425('0x7')][_0x5dda0c][_0xd425('0x2c')],_0x278626,_0x5dda0c);})[_0xd425('0x36')](function(){delete _0x538a0a[_0xd425('0xa')][_0x1fc822];});}catch(_0x1e12f2){logger[_0xd425('0x37')]('[ACW][START]\x20%s',_0x1e12f2[_0xd425('0x38')]);}};Acw['prototype'][_0xd425('0x2e')]=function(_0x29cca9){try{var _0x36c8da=this;if(_0x36c8da['timers'][_0x29cca9]){_0x36c8da[_0xd425('0x9')][_0x29cca9][_0xd425('0x2d')]=![];var _0xbbb05f=_0x36c8da[_0xd425('0x9')][_0x29cca9]['uniqueid'];var _0x1d38fa=_0x36c8da[_0xd425('0x9')][_0x29cca9]['queue'];var _0x5d310e=_0x36c8da['voiceQueues'][_0x1d38fa][_0xd425('0x2c')];logger[_0xd425('0x26')](_0xd425('0x39'),_0x29cca9);RpcUser['saveUnpause'](this['agents'][_0x29cca9]);RpcVoiceAgentReport['update']({'acwtime':_0x5d310e,'agentacw':!![]},_0xbbb05f,_0x29cca9)[_0xd425('0x23')](function(_0x3f9090){logger[_0xd425('0x26')](_0xd425('0x3a'),_0xbbb05f,_0x5d310e,_0x3f9090);})[_0xd425('0x34')](function(_0x14f3be){logger[_0xd425('0x37')]('[%s][UPDATE][ERRORS:%s]',_0xbbb05f,_0x14f3be);});}else{logger[_0xd425('0x37')](_0xd425('0x3b'),_0x29cca9);if(_0x36c8da[_0xd425('0x9')]){logger['info'](_0xd425('0x3c'),JSON[_0xd425('0x3d')](_0x36c8da[_0xd425('0x9')]));}}}catch(_0x5dc4c4){logger[_0xd425('0x37')](_0xd425('0x3e'),_0x5dc4c4[_0xd425('0x38')]);}};Acw[_0xd425('0x1c')]['syncAgentConnect']=function(_0x1e9be2){try{if(this[_0xd425('0x7')][_0x1e9be2[_0xd425('0x1f')]]&&(this[_0xd425('0x7')][_0x1e9be2[_0xd425('0x1f')]][_0xd425('0x4')]||this[_0xd425('0x7')][_0x1e9be2['queue']][_0xd425('0x3f')])){if(this[_0xd425('0x8')][_0x1e9be2['interface']]){this[_0xd425('0xa')][_0x1e9be2['uniqueid']]={'queue':_0x1e9be2['queue'],'interface':_0x1e9be2[_0xd425('0x1e')],'destlinkedid':_0x1e9be2['destlinkedid']};}}}catch(_0x1be60a){logger['error'](_0xd425('0x40'),_0x1be60a[_0xd425('0x38')]);}};Acw[_0xd425('0x1c')][_0xd425('0x18')]=function(_0x4420d2){try{if(this['voiceQueues'][_0x4420d2[_0xd425('0x1f')]]&&(this['voiceQueues'][_0x4420d2[_0xd425('0x1f')]]['acw']||this[_0xd425('0x7')][_0x4420d2[_0xd425('0x1f')]][_0xd425('0x3f')])){if(this[_0xd425('0x8')][_0x4420d2[_0xd425('0x1e')]]){this['channels'][_0x4420d2[_0xd425('0x33')]]={'queue':_0x4420d2[_0xd425('0x1f')],'interface':_0x4420d2[_0xd425('0x1e')]};}}}catch(_0x4091a7){logger[_0xd425('0x37')]('[ACW][syncAgentConnectPreview]\x20%s',_0x4091a7[_0xd425('0x38')]);}};Acw[_0xd425('0x1c')][_0xd425('0xe')]=function(_0x2a2ab4){try{if(this[_0xd425('0xa')][_0x2a2ab4[_0xd425('0x33')]]&&_['isUndefined'](this[_0xd425('0xa')][_0x2a2ab4[_0xd425('0x33')]]['attended'])){logger[_0xd425('0x26')](_0xd425('0x41'),_0x2a2ab4[_0xd425('0x33')]);this[_0xd425('0x1d')](_0x2a2ab4['uniqueid']);}else if(this[_0xd425('0xa')][_0x2a2ab4[_0xd425('0x42')]]&&_[_0xd425('0x43')](this[_0xd425('0xa')][_0x2a2ab4[_0xd425('0x42')]]['attended'])){logger['info'](_0xd425('0x44'),_0x2a2ab4['linkedid']);this[_0xd425('0x1d')](_0x2a2ab4[_0xd425('0x42')]);}}catch(_0x5594f9){logger[_0xd425('0x37')]('[ACW][syncHangupRequest]\x20%s',_0x5594f9['message']);}};Acw[_0xd425('0x1c')][_0xd425('0x10')]=function(_0xe6451f){try{if(this[_0xd425('0xa')][_0xe6451f[_0xd425('0x33')]]&&this[_0xd425('0xa')][_0xe6451f[_0xd425('0x33')]][_0xd425('0x28')]){logger['info'](_0xd425('0x45'),_0xe6451f[_0xd425('0x33')]);this[_0xd425('0x1d')](_0xe6451f[_0xd425('0x33')]);}else if(this[_0xd425('0xa')][_0xe6451f[_0xd425('0x42')]]&&this[_0xd425('0xa')][_0xe6451f[_0xd425('0x42')]]['attended']){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xe6451f[_0xd425('0x42')]);this[_0xd425('0x1d')](_0xe6451f[_0xd425('0x42')]);}}catch(_0x3c6b49){logger['error']('[ACW][syncHangup]\x20%s',_0x3c6b49['message']);}};Acw['prototype'][_0xd425('0x14')]=function(_0x44c5e4){try{if(!_['isNil'](this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x46')]])){this[_0xd425('0x1d')](_0x44c5e4['transfereeuniqueid']);if(this['channels'][_0x44c5e4[_0xd425('0x47')]]){this['channels'][_0x44c5e4['secondtransfereruniqueid']]['attended']=!![];this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x48')]]=this[_0xd425('0xa')][_0x44c5e4['secondtransfereruniqueid']];delete this[_0xd425('0xa')][_0x44c5e4['secondtransfereruniqueid']];}}else if(!_[_0xd425('0x49')](this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x48')]])){this[_0xd425('0x1d')](_0x44c5e4[_0xd425('0x48')]);if(this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x4a')]]){this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x4a')]]['attended']=!![];this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x46')]]=this[_0xd425('0xa')][_0x44c5e4[_0xd425('0x4a')]];delete this['channels'][_0x44c5e4['origtransfereruniqueid']];}}}catch(_0x307e9a){logger[_0xd425('0x37')](_0xd425('0x4b'),_0x307e9a[_0xd425('0x38')]);}};Acw[_0xd425('0x1c')][_0xd425('0x16')]=function(_0x28d1ec){try{if(this[_0xd425('0xa')][_0x28d1ec[_0xd425('0x4c')]]){logger[_0xd425('0x26')](_0xd425('0x4d'),JSON[_0xd425('0x3d')](_0x28d1ec[_0xd425('0x4c')]));this[_0xd425('0x1d')](_0x28d1ec['transfereruniqueid']);}else if(this[_0xd425('0xa')][_0x28d1ec[_0xd425('0x4e')]]){logger[_0xd425('0x26')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x28d1ec['transfererlinkedid']));this[_0xd425('0x1d')](_0x28d1ec[_0xd425('0x4e')]);}}catch(_0x27c60e){logger['error'](_0xd425('0x4f'),_0x27c60e['message']);}};Acw[_0xd425('0x1c')][_0xd425('0x12')]=function(_0x21d26e){try{if(this['voiceQueues'][_0x21d26e[_0xd425('0x1f')]]&&this[_0xd425('0x7')][_0x21d26e[_0xd425('0x1f')]][_0xd425('0x50')]===_0xd425('0x51')){if(this[_0xd425('0x8')][_0x21d26e[_0xd425('0x1e')]]){logger[_0xd425('0x26')](_0xd425('0x52'),_0x21d26e[_0xd425('0x33')],_0x21d26e[_0xd425('0x1e')],_0x21d26e[_0xd425('0x1f')]);return RpcUser[_0xd425('0x2a')](this[_0xd425('0x8')][_0x21d26e[_0xd425('0x1e')]],_0xd425('0x53'),_0x21d26e[_0xd425('0x33')]);}}}catch(_0x25cae6){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x25cae6[_0xd425('0x38')]);}};module['exports']=Acw; \ No newline at end of file +var _0xa630=['transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','util','lodash','../../../config/logger','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','timer','update','then','[%s][UPDATE][ACWTIME:%s]','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid'];(function(_0x1e691f,_0x215f5f){var _0x5b37cb=function(_0x1ffe30){while(--_0x1ffe30){_0x1e691f['push'](_0x1e691f['shift']());}};_0x5b37cb(++_0x215f5f);}(_0xa630,0xbe));var _0x0a63=function(_0x50d761,_0x1efb95){_0x50d761=_0x50d761-0x0;var _0x41105d=_0xa630[_0x50d761];return _0x41105d;};'use strict';var util=require(_0x0a63('0x0'));var _=require(_0x0a63('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x0a63('0x2'))('acw');var RpcUser=require(_0x0a63('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x91a747){this[_0x0a63('0x4')]=_0x91a747[_0x0a63('0x4')];this[_0x0a63('0x5')]=_0x91a747[_0x0a63('0x5')];this['timers']=_0x91a747[_0x0a63('0x6')];this[_0x0a63('0x7')]={};ami['on'](_0x0a63('0x8'),this[_0x0a63('0x9')][_0x0a63('0xa')](this));ami['on'](_0x0a63('0xb'),this['syncHangupRequest'][_0x0a63('0xa')](this));ami['on'](_0x0a63('0xc'),this[_0x0a63('0xd')][_0x0a63('0xa')](this));ami['on'](_0x0a63('0xe'),this[_0x0a63('0xf')][_0x0a63('0xa')](this));ami['on'](_0x0a63('0x10'),this[_0x0a63('0x11')][_0x0a63('0xa')](this));ami['on']('blindtransfer',this[_0x0a63('0x12')][_0x0a63('0xa')](this));ami['on'](_0x0a63('0x13'),this[_0x0a63('0x14')]['bind'](this));}function getDiff(_0x23f655){var _0x4d68c0=moment()[_0x0a63('0x15')](0x0);var _0x19e922=moment(_0x23f655)[_0x0a63('0x15')](0x0);return _0x4d68c0[_0x0a63('0x16')](_0x19e922,_0x0a63('0x17'));}Acw[_0x0a63('0x18')][_0x0a63('0x19')]=function(_0x1e3251){try{var _0x524a98=this;var _0x47788e=this['channels'][_0x1e3251][_0x0a63('0x1a')];var _0x292170=this[_0x0a63('0x7')][_0x1e3251][_0x0a63('0x1b')];var _0x1f7481=this[_0x0a63('0x4')][_0x292170];var _0x30f292=![];var _0x374c52=_0x0a63('0x1c');if(_0x1f7481[_0x0a63('0x1d')]){if(_0x1f7481[_0x0a63('0x1e')]['name']){_0x30f292=!![];_0x374c52=_0x1f7481['mandatoryDispositionPause'][_0x0a63('0x1f')];}}ami['Action']({'action':_0x0a63('0x20'),'interface':_0x47788e,'paused':!![],'reason':_0x374c52})['then'](function(_0x58513d){if(_0x524a98[_0x0a63('0x5')][_0x47788e]){return RpcUser[_0x0a63('0x21')](_0x524a98[_0x0a63('0x5')][_0x47788e]['id'])['then'](function(_0x398a16){if(_0x398a16&&!_0x398a16['voicePause']){logger[_0x0a63('0x22')](_0x0a63('0x23'),_0x1e3251,_0x47788e,_0x292170);var _0x1bf64a=_0x524a98[_0x0a63('0x7')][_0x1e3251][_0x0a63('0x24')]&&_0x524a98[_0x0a63('0x7')][_0x1e3251][_0x0a63('0x25')]?_0x524a98[_0x0a63('0x7')][_0x1e3251]['destlinkedid']:_0x1e3251;return RpcUser['savePause'](_0x524a98['agents'][_0x47788e],_0x374c52,_0x1bf64a)['then'](function(_0xeacfc9){if(!_0x30f292){_0x524a98['timers'][_0x47788e]={};logger['info'](_0x0a63('0x26'),_0x1e3251,_0x524a98[_0x0a63('0x4')][_0x292170][_0x0a63('0x27')],_0x47788e,_0x292170);_0x524a98[_0x0a63('0x6')][_0x47788e]['timer']=setTimeout(_0x524a98[_0x0a63('0x28')][_0x0a63('0xa')](_0x524a98,_0x47788e),_0x524a98[_0x0a63('0x4')][_0x292170]['acwTimeout']*0x3e8);_0x524a98[_0x0a63('0x6')][_0x47788e][_0x0a63('0x29')]=moment()[_0x0a63('0x2a')](_0x0a63('0x2b'));_0x524a98[_0x0a63('0x6')][_0x47788e][_0x0a63('0x2c')]=_0x1e3251;_0x524a98[_0x0a63('0x6')][_0x47788e][_0x0a63('0x1b')]=_0x292170;_0x524a98['timers'][_0x47788e][_0x0a63('0x2d')]=function(){var _0x574c06=getDiff(_0x524a98[_0x0a63('0x6')][_0x47788e][_0x0a63('0x29')]);clearTimeout(_0x524a98[_0x0a63('0x6')][_0x47788e][_0x0a63('0x2e')]);_0x524a98[_0x0a63('0x6')][_0x47788e]['timer']=![];RpcVoiceAgentReport[_0x0a63('0x2f')]({'acwtime':_0x574c06},_0x524a98[_0x0a63('0x6')][_0x47788e][_0x0a63('0x2c')],_0x47788e)[_0x0a63('0x30')](function(_0x59d06c){logger[_0x0a63('0x22')](_0x0a63('0x31'),_0x1e3251,_0x574c06,_0x59d06c);})['catch'](function(_0x4a7145){logger[_0x0a63('0x32')]('[%s][UPDATE][ERRORS:%s]',_0x1e3251,_0x4a7145);});delete _0x524a98['timers'][_0x47788e];};}});}else{logger[_0x0a63('0x22')](_0x0a63('0x33'),_0x1e3251,_0x47788e,_0x292170);}});}})['catch'](function(_0xfd1e09){logger[_0x0a63('0x32')](_0x0a63('0x26'),_0x1e3251,_0x524a98[_0x0a63('0x4')][_0x292170][_0x0a63('0x27')],_0x47788e,_0x292170);})['finally'](function(){delete _0x524a98['channels'][_0x1e3251];});}catch(_0x22993d){logger[_0x0a63('0x32')](_0x0a63('0x34'),_0x22993d[_0x0a63('0x35')]);}};Acw[_0x0a63('0x18')][_0x0a63('0x28')]=function(_0x59912d){try{var _0x307fe2=this;if(_0x307fe2[_0x0a63('0x6')][_0x59912d]){_0x307fe2['timers'][_0x59912d][_0x0a63('0x2e')]=![];var _0x5b62b7=_0x307fe2['timers'][_0x59912d][_0x0a63('0x2c')];var _0x232388=_0x307fe2[_0x0a63('0x6')][_0x59912d]['queue'];var _0x209447=_0x307fe2[_0x0a63('0x4')][_0x232388][_0x0a63('0x27')];logger[_0x0a63('0x22')](_0x0a63('0x36'),_0x59912d);RpcUser[_0x0a63('0x37')](this[_0x0a63('0x5')][_0x59912d]);RpcVoiceAgentReport['update']({'acwtime':_0x209447,'agentacw':!![]},_0x5b62b7,_0x59912d)[_0x0a63('0x30')](function(_0x1c7e67){logger[_0x0a63('0x22')]('[%s][UPDATE][ACWTIME:%s]',_0x5b62b7,_0x209447,_0x1c7e67);})['catch'](function(_0x28f904){logger['error'](_0x0a63('0x38'),_0x5b62b7,_0x28f904);});}else{logger[_0x0a63('0x32')](_0x0a63('0x39'),_0x59912d);if(_0x307fe2['timers']){logger[_0x0a63('0x22')](_0x0a63('0x3a'),JSON[_0x0a63('0x3b')](_0x307fe2[_0x0a63('0x6')]));}}}catch(_0x5d94e2){logger[_0x0a63('0x32')](_0x0a63('0x3c'),_0x5d94e2[_0x0a63('0x35')]);}};Acw[_0x0a63('0x18')][_0x0a63('0x9')]=function(_0x38cfe4){try{if(this['voiceQueues'][_0x38cfe4[_0x0a63('0x1b')]]&&(this[_0x0a63('0x4')][_0x38cfe4[_0x0a63('0x1b')]][_0x0a63('0x3d')]||this[_0x0a63('0x4')][_0x38cfe4[_0x0a63('0x1b')]][_0x0a63('0x1d')])){if(this[_0x0a63('0x5')][_0x38cfe4[_0x0a63('0x1a')]]){this[_0x0a63('0x7')][_0x38cfe4[_0x0a63('0x2c')]]={'queue':_0x38cfe4[_0x0a63('0x1b')],'interface':_0x38cfe4[_0x0a63('0x1a')],'destlinkedid':_0x38cfe4[_0x0a63('0x25')]};}}}catch(_0x364a89){logger[_0x0a63('0x32')](_0x0a63('0x3e'),_0x364a89[_0x0a63('0x35')]);}};Acw['prototype'][_0x0a63('0x14')]=function(_0x5ef4e9){try{if(this['voiceQueues'][_0x5ef4e9[_0x0a63('0x1b')]]&&(this[_0x0a63('0x4')][_0x5ef4e9[_0x0a63('0x1b')]][_0x0a63('0x3d')]||this[_0x0a63('0x4')][_0x5ef4e9[_0x0a63('0x1b')]][_0x0a63('0x1d')])){if(this[_0x0a63('0x5')][_0x5ef4e9[_0x0a63('0x1a')]]){this[_0x0a63('0x7')][_0x5ef4e9[_0x0a63('0x2c')]]={'queue':_0x5ef4e9[_0x0a63('0x1b')],'interface':_0x5ef4e9[_0x0a63('0x1a')]};}}}catch(_0x27de0c){logger[_0x0a63('0x32')](_0x0a63('0x3f'),_0x27de0c[_0x0a63('0x35')]);}};Acw[_0x0a63('0x18')][_0x0a63('0x40')]=function(_0x148e0a){try{if(this['channels'][_0x148e0a[_0x0a63('0x2c')]]&&_[_0x0a63('0x41')](this['channels'][_0x148e0a['uniqueid']]['attended'])){logger['info'](_0x0a63('0x42'),_0x148e0a[_0x0a63('0x2c')]);this['startAcw'](_0x148e0a[_0x0a63('0x2c')]);}else if(this['channels'][_0x148e0a[_0x0a63('0x43')]]&&_[_0x0a63('0x41')](this['channels'][_0x148e0a['linkedid']]['attended'])){logger[_0x0a63('0x22')](_0x0a63('0x44'),_0x148e0a[_0x0a63('0x43')]);this[_0x0a63('0x19')](_0x148e0a[_0x0a63('0x43')]);}}catch(_0x4be904){logger[_0x0a63('0x32')](_0x0a63('0x45'),_0x4be904[_0x0a63('0x35')]);}};Acw[_0x0a63('0x18')][_0x0a63('0xd')]=function(_0x4a5b6e){try{if(this[_0x0a63('0x7')][_0x4a5b6e[_0x0a63('0x2c')]]&&this[_0x0a63('0x7')][_0x4a5b6e[_0x0a63('0x2c')]]['attended']){logger[_0x0a63('0x22')](_0x0a63('0x46'),_0x4a5b6e[_0x0a63('0x2c')]);this[_0x0a63('0x19')](_0x4a5b6e[_0x0a63('0x2c')]);}else if(this[_0x0a63('0x7')][_0x4a5b6e['linkedid']]&&this[_0x0a63('0x7')][_0x4a5b6e[_0x0a63('0x43')]][_0x0a63('0x24')]){logger[_0x0a63('0x22')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x4a5b6e['linkedid']);this[_0x0a63('0x19')](_0x4a5b6e[_0x0a63('0x43')]);}}catch(_0x42514e){logger[_0x0a63('0x32')](_0x0a63('0x47'),_0x42514e['message']);}};Acw['prototype']['syncAttendedTransfer']=function(_0x42c1bb){try{if(!_['isNil'](this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x48')]])){this[_0x0a63('0x19')](_0x42c1bb['transfereeuniqueid']);if(this['channels'][_0x42c1bb[_0x0a63('0x49')]]){this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x49')]][_0x0a63('0x24')]=!![];this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x4a')]]=this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x49')]];delete this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x49')]];}}else if(!_[_0x0a63('0x4b')](this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x4a')]])){this[_0x0a63('0x19')](_0x42c1bb['transfertargetuniqueid']);if(this['channels'][_0x42c1bb[_0x0a63('0x4c')]]){this[_0x0a63('0x7')][_0x42c1bb['origtransfereruniqueid']][_0x0a63('0x24')]=!![];this[_0x0a63('0x7')][_0x42c1bb['transfereeuniqueid']]=this[_0x0a63('0x7')][_0x42c1bb[_0x0a63('0x4c')]];delete this['channels'][_0x42c1bb['origtransfereruniqueid']];}}}catch(_0x3b395a){logger[_0x0a63('0x32')](_0x0a63('0x4d'),_0x3b395a['message']);}};Acw[_0x0a63('0x18')][_0x0a63('0x12')]=function(_0x27141e){try{if(this[_0x0a63('0x7')][_0x27141e[_0x0a63('0x4e')]]){logger['info'](_0x0a63('0x4f'),JSON[_0x0a63('0x3b')](_0x27141e[_0x0a63('0x4e')]));this[_0x0a63('0x19')](_0x27141e[_0x0a63('0x4e')]);}else if(this[_0x0a63('0x7')][_0x27141e[_0x0a63('0x50')]]){logger['info'](_0x0a63('0x51'),JSON[_0x0a63('0x3b')](_0x27141e[_0x0a63('0x50')]));this[_0x0a63('0x19')](_0x27141e[_0x0a63('0x50')]);}}catch(_0xf814c7){logger[_0x0a63('0x32')](_0x0a63('0x52'),_0xf814c7['message']);}};Acw['prototype'][_0x0a63('0xf')]=function(_0x30e5f0){try{if(this[_0x0a63('0x4')][_0x30e5f0[_0x0a63('0x1b')]]&&this[_0x0a63('0x4')][_0x30e5f0['queue']][_0x0a63('0x53')]===_0x0a63('0x54')){if(this[_0x0a63('0x5')][_0x30e5f0[_0x0a63('0x1a')]]){logger[_0x0a63('0x22')](_0x0a63('0x55'),_0x30e5f0[_0x0a63('0x2c')],_0x30e5f0[_0x0a63('0x1a')],_0x30e5f0[_0x0a63('0x1b')]);return RpcUser[_0x0a63('0x56')](this[_0x0a63('0x5')][_0x30e5f0['interface']],_0x0a63('0x57'),_0x30e5f0['uniqueid']);}}}catch(_0xfa80c2){logger[_0x0a63('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0xfa80c2['message']);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 64168aa..9c39563 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 _0x684e=['Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionQueueSummary','catch','log','exports','asterisk-manager','bluebird','moment','util','lodash','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry'];(function(_0x35a8ad,_0x3b03f8){var _0x10ef61=function(_0xa8a94d){while(--_0xa8a94d){_0x35a8ad['push'](_0x35a8ad['shift']());}};_0x10ef61(++_0x3b03f8);}(_0x684e,0x1a6));var _0xe684=function(_0x4f98bd,_0x223ff3){_0x4f98bd=_0x4f98bd-0x0;var _0x54fcdb=_0x684e[_0x4f98bd];return _0x54fcdb;};'use strict';var Manager=require(_0xe684('0x0'));var BPromise=require(_0xe684('0x1'));var moment=require(_0xe684('0x2'));var util=require(_0xe684('0x3'));var _=require(_0xe684('0x4'));var logger=require(_0xe684('0x5'))('ami');var config=require(_0xe684('0x6'));var ami=new Manager(config[_0xe684('0x7')][_0xe684('0x8')],config[_0xe684('0x7')]['ip'],config['asterisk'][_0xe684('0x9')],config[_0xe684('0x7')][_0xe684('0xa')],!![]);ami[_0xe684('0xb')]();ami['Action']=BPromise['promisify'](ami['action']);function error(_0x42212a){logger[_0xe684('0xc')](util[_0xe684('0xd')](_0xe684('0xe'),config[_0xe684('0x7')][_0xe684('0x9')],config[_0xe684('0x7')]['ip'],config['asterisk'][_0xe684('0x8')],util[_0xe684('0xf')](_0x42212a,![],null)));}function close(){logger[_0xe684('0xc')](util[_0xe684('0xd')](_0xe684('0x10'),config['asterisk']['username'],config[_0xe684('0x7')]['ip'],config[_0xe684('0x7')][_0xe684('0x8')]));}ami[_0xe684('0x11')]=function(){return function(){return ami[_0xe684('0x12')]({'action':_0xe684('0x13')});};};ami[_0xe684('0x14')]=function(){return function(){return ami['Action']({'action':_0xe684('0x15')});};};ami[_0xe684('0x16')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0xe684('0x17')});};};ami[_0xe684('0x18')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(_0x24b14e){logger[_0xe684('0x19')](util[_0xe684('0xd')](_0xe684('0x1a'),config[_0xe684('0x7')][_0xe684('0x9')],config[_0xe684('0x7')]['ip'],config['asterisk'][_0xe684('0x8')]));ami[_0xe684('0x1b')]('error',error);ami['once'](_0xe684('0x1c'),close);}ami['on'](_0xe684('0x1d'),connect);ami['on'](_0xe684('0x1e'),function(_0x5cd83a){logger['info'](util['format'](_0xe684('0x1f'),config[_0xe684('0x7')][_0xe684('0x9')],config[_0xe684('0x7')]['ip'],config[_0xe684('0x7')][_0xe684('0x8')],util[_0xe684('0xf')](_0x5cd83a,![],null)));});ami['on'](_0xe684('0x20'),function(_0x1399ec){logger['info'](util[_0xe684('0xd')](_0xe684('0x21'),config[_0xe684('0x7')][_0xe684('0x9')],config['asterisk']['ip'],config[_0xe684('0x7')][_0xe684('0x8')]));return BPromise[_0xe684('0x22')]()['then'](ami['actionSipShowRegistry']())[_0xe684('0x23')](ami['actionDeviceStateList']())[_0xe684('0x23')](ami[_0xe684('0x16')]())[_0xe684('0x23')](ami[_0xe684('0x24')]())[_0xe684('0x23')](ami['actionCoreShowChannels']())[_0xe684('0x25')](function(_0x3e19ed){console[_0xe684('0x26')](_0x3e19ed);});});ami[_0xe684('0x1b')]('error',error);ami[_0xe684('0x1b')](_0xe684('0x1c'),close);module[_0xe684('0x27')]=ami; \ No newline at end of file +var _0x8555=['actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','inspect','then','log','asterisk-manager','bluebird','moment','util','lodash','ami','../../config/environment','asterisk','port','keepConnected','promisify','action','error','format','username','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x8555,0x12d));var _0x5855=function(_0x28e308,_0x2ecc1d){_0x28e308=_0x28e308-0x0;var _0x4614b9=_0x8555[_0x28e308];return _0x4614b9;};'use strict';var Manager=require(_0x5855('0x0'));var BPromise=require(_0x5855('0x1'));var moment=require(_0x5855('0x2'));var util=require(_0x5855('0x3'));var _=require(_0x5855('0x4'));var logger=require('../../config/logger')(_0x5855('0x5'));var config=require(_0x5855('0x6'));var ami=new Manager(config[_0x5855('0x7')][_0x5855('0x8')],config[_0x5855('0x7')]['ip'],config['asterisk']['username'],config[_0x5855('0x7')]['password'],!![]);ami[_0x5855('0x9')]();ami['Action']=BPromise[_0x5855('0xa')](ami[_0x5855('0xb')]);function error(_0x485366){logger[_0x5855('0xc')](util[_0x5855('0xd')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x5855('0x7')][_0x5855('0xe')],config['asterisk']['ip'],config['asterisk']['port'],util['inspect'](_0x485366,![],null)));}function close(){logger[_0x5855('0xc')](util[_0x5855('0xd')](_0x5855('0xf'),config[_0x5855('0x7')][_0x5855('0xe')],config[_0x5855('0x7')]['ip'],config[_0x5855('0x7')][_0x5855('0x8')]));}ami[_0x5855('0x10')]=function(){return function(){return ami[_0x5855('0x11')]({'action':_0x5855('0x12')});};};ami[_0x5855('0x13')]=function(){return function(){return ami['Action']({'action':_0x5855('0x14')});};};ami[_0x5855('0x15')]=function(){return function(){return ami['Action']({'action':_0x5855('0x16')});};};ami[_0x5855('0x17')]=function(){return function(){return ami['Action']({'action':_0x5855('0x18')});};};ami[_0x5855('0x19')]=function(){return function(){return ami[_0x5855('0x11')]({'action':_0x5855('0x1a')});};};function connect(_0x423e29){logger[_0x5855('0x1b')](util[_0x5855('0xd')](_0x5855('0x1c'),config[_0x5855('0x7')][_0x5855('0xe')],config[_0x5855('0x7')]['ip'],config['asterisk'][_0x5855('0x8')]));ami[_0x5855('0x1d')](_0x5855('0xc'),error);ami[_0x5855('0x1d')](_0x5855('0x1e'),close);}ami['on'](_0x5855('0x1f'),connect);ami['on'](_0x5855('0x20'),function(_0x29699a){logger['info'](util[_0x5855('0xd')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x5855('0xe')],config[_0x5855('0x7')]['ip'],config[_0x5855('0x7')][_0x5855('0x8')],util[_0x5855('0x21')](_0x29699a,![],null)));});ami['on']('fullybooted',function(_0x251181){logger[_0x5855('0x1b')](util[_0x5855('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config['asterisk']['username'],config[_0x5855('0x7')]['ip'],config[_0x5855('0x7')][_0x5855('0x8')]));return BPromise['resolve']()[_0x5855('0x22')](ami['actionSipShowRegistry']())[_0x5855('0x22')](ami[_0x5855('0x13')]())['then'](ami[_0x5855('0x15')]())[_0x5855('0x22')](ami[_0x5855('0x17')]())[_0x5855('0x22')](ami['actionCoreShowChannels']())['catch'](function(_0x57f8fb){console[_0x5855('0x23')](_0x57f8fb);});});ami[_0x5855('0x1d')](_0x5855('0xc'),error);ami[_0x5855('0x1d')](_0x5855('0x1e'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index a00a987..481a1b2 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 _0xf135=['jayson/promise','bluebird','../../config/logger','ami','client','Request','request','then','debug','rpc','memberReport','error','message','exports'];(function(_0x1fe138,_0x1c33d4){var _0x2ef18c=function(_0x333764){while(--_0x333764){_0x1fe138['push'](_0x1fe138['shift']());}};_0x2ef18c(++_0x1c33d4);}(_0xf135,0x17a));var _0x5f13=function(_0x2e90ce,_0x3bcb4c){_0x2e90ce=_0x2e90ce-0x0;var _0x5cd2db=_0xf135[_0x2e90ce];return _0x5cd2db;};'use strict';var jayson=require(_0x5f13('0x0'));var BPromise=require(_0x5f13('0x1'));var logger=require(_0x5f13('0x2'))(_0x5f13('0x3'));var client=jayson[_0x5f13('0x4')]['http']({'port':0x2329});client[_0x5f13('0x5')]=function(_0x542d6e,_0x4dfd94){return new BPromise(function(_0xc4677c,_0x386185){return client[_0x5f13('0x6')](_0x542d6e,_0x4dfd94)[_0x5f13('0x7')](function(_0x38c87b){logger[_0x5f13('0x8')](_0x5f13('0x9'),_0x5f13('0xa'),_0x542d6e,_0x4dfd94,_0x38c87b);if(_0x38c87b[_0x5f13('0xb')]){logger['error'](_0x5f13('0x9'),_0x5f13('0xa'),_0x542d6e,_0x38c87b[_0x5f13('0xb')]['message'],_0x4dfd94);return _0x386185(_0x38c87b['error'][_0x5f13('0xc')]);}else{return _0xc4677c(_0x38c87b['result']);}})['catch'](function(_0x9fda85){logger[_0x5f13('0xb')](_0x5f13('0x9'),_0x5f13('0xa'),_0x542d6e,_0x9fda85,_0x4dfd94);return _0x386185(_0x9fda85);});});};module[_0x5f13('0xd')]=client; \ No newline at end of file +var _0xa683=['message','exports','bluebird','../../config/logger','ami','client','http','Request','request','then','debug','memberReport','error','rpc'];(function(_0x498381,_0x122bfc){var _0x7e0ae8=function(_0x5b3414){while(--_0x5b3414){_0x498381['push'](_0x498381['shift']());}};_0x7e0ae8(++_0x122bfc);}(_0xa683,0x1a6));var _0x3a68=function(_0x53fbf1,_0x209ca1){_0x53fbf1=_0x53fbf1-0x0;var _0x269c6e=_0xa683[_0x53fbf1];return _0x269c6e;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x3a68('0x0'));var logger=require(_0x3a68('0x1'))(_0x3a68('0x2'));var client=jayson[_0x3a68('0x3')][_0x3a68('0x4')]({'port':0x2329});client[_0x3a68('0x5')]=function(_0x5f2e76,_0x2df154){return new BPromise(function(_0x5763d7,_0x1c32ab){return client[_0x3a68('0x6')](_0x5f2e76,_0x2df154)[_0x3a68('0x7')](function(_0x4d22b8){logger[_0x3a68('0x8')]('rpc',_0x3a68('0x9'),_0x5f2e76,_0x2df154,_0x4d22b8);if(_0x4d22b8[_0x3a68('0xa')]){logger[_0x3a68('0xa')](_0x3a68('0xb'),_0x3a68('0x9'),_0x5f2e76,_0x4d22b8[_0x3a68('0xa')]['message'],_0x2df154);return _0x1c32ab(_0x4d22b8[_0x3a68('0xa')][_0x3a68('0xc')]);}else{return _0x5763d7(_0x4d22b8['result']);}})['catch'](function(_0xb1e8f5){logger[_0x3a68('0xa')](_0x3a68('0xb'),_0x3a68('0x9'),_0x5f2e76,_0xb1e8f5,_0x2df154);return _0x1c32ab(_0xb1e8f5);});});};module[_0x3a68('0xd')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 9f3eefb..1a3f930 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 _0x6b24=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','getQueue','exports','lodash','moment','string','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x1c72b8,_0x104b7e){var _0x191114=function(_0x5d76da){while(--_0x5d76da){_0x1c72b8['push'](_0x1c72b8['shift']());}};_0x191114(++_0x104b7e);}(_0x6b24,0x1ce));var _0x46b2=function(_0x22e47a,_0x4ea10c){_0x22e47a=_0x22e47a-0x0;var _0x15a12a=_0x6b24[_0x22e47a];return _0x15a12a;};'use strict';var util=require('util');var _=require(_0x46b2('0x0'));var moment=require(_0x46b2('0x1'));function checkNameSurname(_0x87e10b,_0x3eeaae,_0x4afaba){var _0x529a0c='';if(!_['isNil'](_0x3eeaae)&&_0x46b2('0x2')===typeof _0x3eeaae){_0x529a0c+=_0x3eeaae;}if(!_['isNil'](_0x4afaba)&&_0x46b2('0x2')===typeof _0x4afaba){_0x529a0c+='\x20'+_0x4afaba;}if(_0x529a0c!==''){return _0x529a0c;}return _0x87e10b;}function Action(_0x49d2b5,_0x2e5227,_0x5598df){this['voiceQueue']=_0x49d2b5;this[_0x46b2('0x3')]=_0x5598df||undefined;this[_0x46b2('0x4')]=checkNameSurname(_0x2e5227[_0x46b2('0x5')][_0x46b2('0x6')],_0x2e5227[_0x46b2('0x5')][_0x46b2('0x7')],_0x2e5227[_0x46b2('0x5')][_0x46b2('0x8')]);this[_0x46b2('0x9')]=_0x2e5227['Contact']['phone'];this[_0x46b2('0xa')]=_0x49d2b5[_0x46b2('0x4')];this[_0x46b2('0xb')]=_0x2e5227['active']||![];this[_0x46b2('0xc')]=_0x49d2b5[_0x46b2('0xc')];this[_0x46b2('0xd')]=_0x49d2b5['dialQueueTimeout']||0x3;this[_0x46b2('0xe')]=_0x2e5227[_0x46b2('0xe')];this[_0x46b2('0xf')]=_0x2e5227[_0x46b2('0xf')];this[_0x46b2('0x10')]=_0x2e5227[_0x46b2('0x10')];this[_0x46b2('0x11')]=_0x2e5227[_0x46b2('0x11')];this[_0x46b2('0x12')]=_0x2e5227[_0x46b2('0x12')];this['countdropretry']=_0x2e5227[_0x46b2('0x13')];this[_0x46b2('0x14')]=_0x2e5227['countabandonedretry'];this[_0x46b2('0x15')]=_0x2e5227[_0x46b2('0x15')];this[_0x46b2('0x16')]=_0x2e5227[_0x46b2('0x16')];this[_0x46b2('0x17')]=_0x2e5227[_0x46b2('0x17')];this[_0x46b2('0x18')]=_0x2e5227['ListId'];this[_0x46b2('0x19')]=_0x2e5227['UserId'];this[_0x46b2('0x1a')]=_0x2e5227[_0x46b2('0x1a')];this[_0x46b2('0x1b')]=_0x2e5227['CampaignId'];this[_0x46b2('0x1c')]=_0x2e5227['id'];this[_0x46b2('0x1d')]=_0x2e5227[_0x46b2('0x5')][_0x46b2('0x7')]||'';this[_0x46b2('0x1e')]=moment()[_0x46b2('0x1f')](_0x46b2('0x20'));this[_0x46b2('0x21')]=_0x2e5227[_0x46b2('0x21')];this[_0x46b2('0x22')]=_0x2e5227[_0x46b2('0x22')];this[_0x46b2('0x23')]=_0x2e5227[_0x46b2('0x23')];this[_0x46b2('0x24')]=_0x2e5227[_0x46b2('0x24')];this['originatecalleridnum']='';this[_0x46b2('0x25')]='';}Action['prototype']['getCaller']=function(){return util[_0x46b2('0x1f')](_0x46b2('0x26'),this[_0x46b2('0x4')],this[_0x46b2('0x27')][_0x46b2('0x28')]>0x0?this['number'][_0x46b2('0x29')](this[_0x46b2('0x27')]['dialCutDigit']):this[_0x46b2('0x9')]);};Action['prototype'][_0x46b2('0x2a')]=function(){return this[_0x46b2('0xa')];};module[_0x46b2('0x2b')]=Action; \ No newline at end of file +var _0x7a28=['getQueue','lodash','moment','isNil','string','uniqueid','name','Contact','firstName','lastName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','substring','dialCutDigit'];(function(_0x13c32a,_0x473548){var _0x270ccd=function(_0xce9962){while(--_0xce9962){_0x13c32a['push'](_0x13c32a['shift']());}};_0x270ccd(++_0x473548);}(_0x7a28,0x1cd));var _0x87a2=function(_0x19cc3c,_0x2e721c){_0x19cc3c=_0x19cc3c-0x0;var _0x117a0f=_0x7a28[_0x19cc3c];return _0x117a0f;};'use strict';var util=require('util');var _=require(_0x87a2('0x0'));var moment=require(_0x87a2('0x1'));function checkNameSurname(_0x12c8da,_0x4c210f,_0x1a4ae1){var _0x123842='';if(!_[_0x87a2('0x2')](_0x4c210f)&&'string'===typeof _0x4c210f){_0x123842+=_0x4c210f;}if(!_[_0x87a2('0x2')](_0x1a4ae1)&&_0x87a2('0x3')===typeof _0x1a4ae1){_0x123842+='\x20'+_0x1a4ae1;}if(_0x123842!==''){return _0x123842;}return _0x12c8da;}function Action(_0x234b0f,_0x12b55a,_0x4c513b){this['voiceQueue']=_0x234b0f;this[_0x87a2('0x4')]=_0x4c513b||undefined;this[_0x87a2('0x5')]=checkNameSurname(_0x12b55a[_0x87a2('0x6')]['phone'],_0x12b55a[_0x87a2('0x6')][_0x87a2('0x7')],_0x12b55a[_0x87a2('0x6')][_0x87a2('0x8')]);this[_0x87a2('0x9')]=_0x12b55a['Contact'][_0x87a2('0xa')];this[_0x87a2('0xb')]=_0x234b0f[_0x87a2('0x5')];this['active']=_0x12b55a[_0x87a2('0xc')]||![];this[_0x87a2('0xd')]=_0x234b0f[_0x87a2('0xd')];this[_0x87a2('0xe')]=_0x234b0f['dialQueueTimeout']||0x3;this[_0x87a2('0xf')]=_0x12b55a[_0x87a2('0xf')];this[_0x87a2('0x10')]=_0x12b55a[_0x87a2('0x10')];this[_0x87a2('0x11')]=_0x12b55a[_0x87a2('0x11')];this['countnoanswerretry']=_0x12b55a[_0x87a2('0x12')];this[_0x87a2('0x13')]=_0x12b55a[_0x87a2('0x13')];this[_0x87a2('0x14')]=_0x12b55a[_0x87a2('0x14')];this['countabandonedretry']=_0x12b55a[_0x87a2('0x15')];this[_0x87a2('0x16')]=_0x12b55a['countmachineretry'];this['countagentrejectretry']=_0x12b55a[_0x87a2('0x17')];this[_0x87a2('0x18')]=_0x12b55a['ContactId'];this['ListId']=_0x12b55a[_0x87a2('0x19')];this[_0x87a2('0x1a')]=_0x12b55a[_0x87a2('0x1a')];this[_0x87a2('0x1b')]=_0x12b55a[_0x87a2('0x1b')];this[_0x87a2('0x1c')]=_0x12b55a[_0x87a2('0x1c')];this[_0x87a2('0x1d')]=_0x12b55a['id'];this[_0x87a2('0x1e')]=_0x12b55a[_0x87a2('0x6')][_0x87a2('0x7')]||'';this[_0x87a2('0x1f')]=moment()[_0x87a2('0x20')](_0x87a2('0x21'));this[_0x87a2('0x22')]=_0x12b55a[_0x87a2('0x22')];this[_0x87a2('0x23')]=_0x12b55a['callbackuniqueid'];this['callbackat']=_0x12b55a['callbackat'];this[_0x87a2('0x24')]=_0x12b55a['recallme'];this[_0x87a2('0x25')]='';this[_0x87a2('0x26')]='';}Action[_0x87a2('0x27')][_0x87a2('0x28')]=function(){return util['format'](_0x87a2('0x29'),this['name'],this[_0x87a2('0x2a')]['dialCutDigit']>0x0?this[_0x87a2('0x9')][_0x87a2('0x2b')](this[_0x87a2('0x2a')][_0x87a2('0x2c')]):this['number']);};Action['prototype'][_0x87a2('0x2d')]=function(){return this[_0x87a2('0xb')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 4e4cd61..1bd7766 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 _0x0fd4=['Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','ringtime','starttime','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc'];(function(_0x4d4223,_0x325b3b){var _0x2f5cd7=function(_0x1c7ec2){while(--_0x1c7ec2){_0x4d4223['push'](_0x4d4223['shift']());}};_0x2f5cd7(++_0x325b3b);}(_0x0fd4,0x148));var _0x40fd=function(_0x416cdc,_0x213b87){_0x416cdc=_0x416cdc-0x0;var _0x1931ce=_0x0fd4[_0x416cdc];return _0x1931ce;};'use strict';var util=require(_0x40fd('0x0'));var _=require(_0x40fd('0x1'));var moment=require(_0x40fd('0x2'));function getSeconds(_0x1387aa,_0x4184db){var _0x3e0e84=moment(_0x1387aa)[_0x40fd('0x3')](0x0);var _0x4801a9=moment(_0x4184db)[_0x40fd('0x3')](0x0);return _0x3e0e84[_0x40fd('0x4')](_0x4801a9,_0x40fd('0x5'));}function AgentComplete(_0x2f0309,_0x137ff8){this[_0x40fd('0x6')]=0x4;this[_0x40fd('0x7')]=_0x40fd('0x8');this[_0x40fd('0x9')]=_0x2f0309[_0x40fd('0x9')];this['type']=_0x2f0309[_0x40fd('0xa')];this[_0x40fd('0xb')]=_0x2f0309[_0x40fd('0xa')]===_0x40fd('0xc')?_0x40fd('0xd'):_0x2f0309['type'];this[_0x40fd('0xe')]=_0x2f0309[_0x40fd('0xe')];this['countcongestionretry']=_0x2f0309[_0x40fd('0xf')];this[_0x40fd('0x10')]=_0x2f0309['countnoanswerretry'];this[_0x40fd('0x11')]=_0x2f0309[_0x40fd('0xe')]+_0x2f0309[_0x40fd('0xf')]+_0x2f0309[_0x40fd('0x10')]+_0x2f0309[_0x40fd('0x12')]+_0x2f0309[_0x40fd('0x13')]+_0x2f0309[_0x40fd('0x14')]+_0x2f0309[_0x40fd('0x15')]+_0x2f0309[_0x40fd('0x16')];this[_0x40fd('0x12')]=_0x2f0309[_0x40fd('0x12')];this[_0x40fd('0x13')]=_0x2f0309[_0x40fd('0x13')];this[_0x40fd('0x14')]=_0x2f0309[_0x40fd('0x14')];this[_0x40fd('0x15')]=_0x2f0309[_0x40fd('0x15')];this['countagentrejectretry']=_0x2f0309[_0x40fd('0x16')];this[_0x40fd('0x17')]=_0x137ff8[_0x40fd('0x17')];this[_0x40fd('0x18')]=_0x2f0309[_0x40fd('0x19')];this[_0x40fd('0x1a')]=_0x2f0309[_0x40fd('0x1b')];this['starttime']=_0x2f0309['starttime'];this['responsetime']=_0x2f0309[_0x40fd('0x1c')];this['answertime']=_0x2f0309[_0x40fd('0x1d')];this['endtime']=moment()['format'](_0x40fd('0x1e'));this[_0x40fd('0x1f')]=getSeconds(_0x2f0309[_0x40fd('0x1c')],_0x2f0309[_0x40fd('0x20')]);this[_0x40fd('0x21')]=getSeconds(_0x2f0309[_0x40fd('0x1d')],_0x2f0309[_0x40fd('0x1c')]);this['talktime']=getSeconds(this['endtime'],_0x2f0309[_0x40fd('0x1d')]);this[_0x40fd('0xd')]=_0x137ff8[_0x40fd('0xd')];this['membername']=_0x137ff8[_0x40fd('0x22')];this[_0x40fd('0x23')]=_0x137ff8[_0x40fd('0x23')];this[_0x40fd('0x24')]=_0x2f0309[_0x40fd('0x24')];this[_0x40fd('0x25')]=_0x2f0309[_0x40fd('0x25')];this[_0x40fd('0x26')]=_0x2f0309[_0x40fd('0x26')];this[_0x40fd('0x27')]=_0x2f0309['recallme'];this['ContactId']=_0x2f0309[_0x40fd('0x28')];this[_0x40fd('0x29')]=_0x2f0309[_0x40fd('0x29')];this[_0x40fd('0x2a')]=_0x2f0309['UserId'];this['VoiceQueueId']=_0x2f0309[_0x40fd('0x2b')];this[_0x40fd('0x2c')]=_0x2f0309['CampaignId'];this['originatecalleridnum']=_0x2f0309[_0x40fd('0x2d')]||'';this[_0x40fd('0x2e')]=_0x2f0309['originatecalleridname']||'';}module[_0x40fd('0x2f')]=AgentComplete; \ No newline at end of file +var _0x39af=['countnosuchnumberretry','uniqueid','calleridname','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','answertime','endtime','membername','reason','callbackuniqueid','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x373b7e,_0x19a151){var _0x409f9e=function(_0x45ebfb){while(--_0x45ebfb){_0x373b7e['push'](_0x373b7e['shift']());}};_0x409f9e(++_0x19a151);}(_0x39af,0xdf));var _0xf39a=function(_0x4490fd,_0x44b20a){_0x4490fd=_0x4490fd-0x0;var _0x5002d6=_0x39af[_0x4490fd];return _0x5002d6;};'use strict';var util=require('util');var _=require(_0xf39a('0x0'));var moment=require('moment');function getSeconds(_0x115abb,_0x2fcd10){var _0x52ab2c=moment(_0x115abb)[_0xf39a('0x1')](0x0);var _0x45abc5=moment(_0x2fcd10)[_0xf39a('0x1')](0x0);return _0x52ab2c[_0xf39a('0x2')](_0x45abc5,'seconds');}function AgentComplete(_0x179e07,_0x378159){this[_0xf39a('0x3')]=0x4;this[_0xf39a('0x4')]=_0xf39a('0x5');this['scheduledat']=_0x179e07[_0xf39a('0x6')];this['type']=_0x179e07[_0xf39a('0x7')];this['campaigntype']=_0x179e07['type']===_0xf39a('0x8')?_0xf39a('0x9'):_0x179e07[_0xf39a('0x7')];this['countbusyretry']=_0x179e07[_0xf39a('0xa')];this[_0xf39a('0xb')]=_0x179e07[_0xf39a('0xb')];this[_0xf39a('0xc')]=_0x179e07[_0xf39a('0xc')];this['countglobal']=_0x179e07[_0xf39a('0xa')]+_0x179e07[_0xf39a('0xb')]+_0x179e07[_0xf39a('0xc')]+_0x179e07['countnosuchnumberretry']+_0x179e07[_0xf39a('0xd')]+_0x179e07[_0xf39a('0xe')]+_0x179e07[_0xf39a('0xf')]+_0x179e07[_0xf39a('0x10')];this[_0xf39a('0x11')]=_0x179e07[_0xf39a('0x11')];this[_0xf39a('0xd')]=_0x179e07[_0xf39a('0xd')];this[_0xf39a('0xe')]=_0x179e07[_0xf39a('0xe')];this[_0xf39a('0xf')]=_0x179e07[_0xf39a('0xf')];this['countagentrejectretry']=_0x179e07[_0xf39a('0x10')];this[_0xf39a('0x12')]=_0x378159[_0xf39a('0x12')];this[_0xf39a('0x13')]=_0x179e07['name'];this['calleridnum']=_0x179e07[_0xf39a('0x14')];this[_0xf39a('0x15')]=_0x179e07[_0xf39a('0x15')];this[_0xf39a('0x16')]=_0x179e07['responsetime'];this['answertime']=_0x179e07['answertime'];this['endtime']=moment()[_0xf39a('0x17')](_0xf39a('0x18'));this[_0xf39a('0x19')]=getSeconds(_0x179e07[_0xf39a('0x16')],_0x179e07[_0xf39a('0x15')]);this[_0xf39a('0x1a')]=getSeconds(_0x179e07[_0xf39a('0x1b')],_0x179e07['responsetime']);this['talktime']=getSeconds(this[_0xf39a('0x1c')],_0x179e07[_0xf39a('0x1b')]);this[_0xf39a('0x9')]=_0x378159['queue'];this[_0xf39a('0x1d')]=_0x378159['membername'];this[_0xf39a('0x1e')]=_0x378159[_0xf39a('0x1e')];this['callback']=_0x179e07['callback'];this[_0xf39a('0x1f')]=_0x179e07[_0xf39a('0x1f')];this['callbackat']=_0x179e07['callbackat'];this[_0xf39a('0x20')]=_0x179e07[_0xf39a('0x20')];this[_0xf39a('0x21')]=_0x179e07['ContactId'];this['ListId']=_0x179e07['ListId'];this['UserId']=_0x179e07[_0xf39a('0x22')];this[_0xf39a('0x23')]=_0x179e07[_0xf39a('0x23')];this[_0xf39a('0x24')]=_0x179e07[_0xf39a('0x24')];this[_0xf39a('0x25')]=_0x179e07[_0xf39a('0x25')]||'';this[_0xf39a('0x26')]=_0x179e07[_0xf39a('0x26')]||'';}module[_0xf39a('0x27')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index d45f38b..54b0121 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 _0xc023=['originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridnum','starttime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0xc023,0x13e));var _0x3c02=function(_0xb12603,_0x142505){_0xb12603=_0xb12603-0x0;var _0x2bdc24=_0xc023[_0xb12603];return _0x2bdc24;};'use strict';var util=require('util');var _=require(_0x3c02('0x0'));var moment=require('moment');function getSeconds(_0x308af5,_0x225667){var _0xebb611=moment(_0x308af5)[_0x3c02('0x1')](0x0);var _0x15099e=moment(_0x225667)[_0x3c02('0x1')](0x0);return _0xebb611['diff'](_0x15099e,_0x3c02('0x2'));}function Final(_0x4a7dd3){this[_0x3c02('0x3')]=_0x4a7dd3['uniqueid'];this[_0x3c02('0x4')]=_0x4a7dd3[_0x3c02('0x4')];this['type']=_0x4a7dd3[_0x3c02('0x5')];this[_0x3c02('0x6')]=_0x4a7dd3['type']==='outbound'?_0x3c02('0x7'):_0x4a7dd3[_0x3c02('0x5')];this[_0x3c02('0x8')]=_0x4a7dd3[_0x3c02('0x8')];this[_0x3c02('0x9')]=_0x4a7dd3[_0x3c02('0x9')];this[_0x3c02('0xa')]=_0x4a7dd3['countnoanswerretry'];this[_0x3c02('0xb')]=_0x4a7dd3['countbusyretry']+_0x4a7dd3['countcongestionretry']+_0x4a7dd3[_0x3c02('0xa')]+_0x4a7dd3[_0x3c02('0xc')]+_0x4a7dd3[_0x3c02('0xd')]+_0x4a7dd3[_0x3c02('0xe')]+_0x4a7dd3[_0x3c02('0xf')]+_0x4a7dd3['countagentrejectretry'];this['countnosuchnumberretry']=_0x4a7dd3[_0x3c02('0xc')];this[_0x3c02('0xd')]=_0x4a7dd3[_0x3c02('0xd')];this[_0x3c02('0xe')]=_0x4a7dd3['countabandonedretry'];this['countmachineretry']=_0x4a7dd3[_0x3c02('0xf')];this[_0x3c02('0x10')]=_0x4a7dd3[_0x3c02('0x10')];this[_0x3c02('0x7')]=_0x4a7dd3['queue'];this['calleridname']=_0x4a7dd3['calleridname'];this['calleridnum']=_0x4a7dd3[_0x3c02('0x11')];this[_0x3c02('0x12')]=_0x4a7dd3['starttime'];this['responsetime']=_0x4a7dd3['responsetime'];this[_0x3c02('0x13')]=_0x4a7dd3['responsetime'];this[_0x3c02('0x14')]=_0x4a7dd3[_0x3c02('0x14')]||0x0;this[_0x3c02('0x15')]=_0x4a7dd3[_0x3c02('0x15')]||0x0;this[_0x3c02('0x16')]=_0x4a7dd3[_0x3c02('0x16')]||0x0;this[_0x3c02('0x17')]=_0x4a7dd3[_0x3c02('0x17')];this[_0x3c02('0x18')]=_0x4a7dd3[_0x3c02('0x18')];this[_0x3c02('0x19')]=_0x4a7dd3['callbackat'];this['recallme']=_0x4a7dd3[_0x3c02('0x1a')];this[_0x3c02('0x1b')]=_0x4a7dd3[_0x3c02('0x1b')];this[_0x3c02('0x1c')]=_0x4a7dd3['ListId'];this[_0x3c02('0x1d')]=_0x4a7dd3[_0x3c02('0x1d')];this[_0x3c02('0x1e')]=_0x4a7dd3[_0x3c02('0x1e')];this[_0x3c02('0x1f')]=_0x4a7dd3[_0x3c02('0x1f')];this['originatecalleridnum']=_0x4a7dd3[_0x3c02('0x20')]||'';this[_0x3c02('0x21')]=_0x4a7dd3[_0x3c02('0x21')]||'';}module[_0x3c02('0x22')]=Final; \ No newline at end of file +var _0x4b8f=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme'];(function(_0x46667b,_0x350031){var _0x331eee=function(_0x26f1f2){while(--_0x26f1f2){_0x46667b['push'](_0x46667b['shift']());}};_0x331eee(++_0x350031);}(_0x4b8f,0x150));var _0xf4b8=function(_0x1ccd1e,_0x4abc12){_0x1ccd1e=_0x1ccd1e-0x0;var _0x307b96=_0x4b8f[_0x1ccd1e];return _0x307b96;};'use strict';var util=require(_0xf4b8('0x0'));var _=require(_0xf4b8('0x1'));var moment=require(_0xf4b8('0x2'));function getSeconds(_0x3f6708,_0x53be8c){var _0x191118=moment(_0x3f6708)[_0xf4b8('0x3')](0x0);var _0x12ac99=moment(_0x53be8c)[_0xf4b8('0x3')](0x0);return _0x191118[_0xf4b8('0x4')](_0x12ac99,_0xf4b8('0x5'));}function Final(_0x191665){this[_0xf4b8('0x6')]=_0x191665[_0xf4b8('0x6')];this['scheduledat']=_0x191665[_0xf4b8('0x7')];this['type']=_0x191665[_0xf4b8('0x8')];this[_0xf4b8('0x9')]=_0x191665[_0xf4b8('0x8')]===_0xf4b8('0xa')?_0xf4b8('0xb'):_0x191665[_0xf4b8('0x8')];this['countbusyretry']=_0x191665['countbusyretry'];this['countcongestionretry']=_0x191665[_0xf4b8('0xc')];this[_0xf4b8('0xd')]=_0x191665[_0xf4b8('0xd')];this[_0xf4b8('0xe')]=_0x191665[_0xf4b8('0xf')]+_0x191665[_0xf4b8('0xc')]+_0x191665[_0xf4b8('0xd')]+_0x191665['countnosuchnumberretry']+_0x191665[_0xf4b8('0x10')]+_0x191665[_0xf4b8('0x11')]+_0x191665['countmachineretry']+_0x191665[_0xf4b8('0x12')];this[_0xf4b8('0x13')]=_0x191665[_0xf4b8('0x13')];this[_0xf4b8('0x10')]=_0x191665[_0xf4b8('0x10')];this[_0xf4b8('0x11')]=_0x191665[_0xf4b8('0x11')];this[_0xf4b8('0x14')]=_0x191665[_0xf4b8('0x14')];this[_0xf4b8('0x12')]=_0x191665[_0xf4b8('0x12')];this['queue']=_0x191665['queue'];this[_0xf4b8('0x15')]=_0x191665[_0xf4b8('0x15')];this[_0xf4b8('0x16')]=_0x191665['calleridnum'];this[_0xf4b8('0x17')]=_0x191665['starttime'];this['responsetime']=_0x191665[_0xf4b8('0x18')];this[_0xf4b8('0x19')]=_0x191665[_0xf4b8('0x18')];this[_0xf4b8('0x1a')]=_0x191665[_0xf4b8('0x1a')]||0x0;this[_0xf4b8('0x1b')]=_0x191665[_0xf4b8('0x1b')]||0x0;this[_0xf4b8('0x1c')]=_0x191665[_0xf4b8('0x1c')]||0x0;this[_0xf4b8('0x1d')]=_0x191665[_0xf4b8('0x1d')];this[_0xf4b8('0x1e')]=_0x191665[_0xf4b8('0x1e')];this[_0xf4b8('0x1f')]=_0x191665[_0xf4b8('0x1f')];this[_0xf4b8('0x20')]=_0x191665[_0xf4b8('0x20')];this[_0xf4b8('0x21')]=_0x191665[_0xf4b8('0x21')];this[_0xf4b8('0x22')]=_0x191665['ListId'];this[_0xf4b8('0x23')]=_0x191665['UserId'];this[_0xf4b8('0x24')]=_0x191665['VoiceQueueId'];this[_0xf4b8('0x25')]=_0x191665[_0xf4b8('0x25')];this['originatecalleridnum']=_0x191665[_0xf4b8('0x26')]||'';this['originatecalleridname']=_0x191665[_0xf4b8('0x27')]||'';}module[_0xf4b8('0x28')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index e78ebdc..74ccf99 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 _0xacf8=['IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','seconds','state','scheduledat','campaigntype','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','queue','membername'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xacf8,0x186));var _0x8acf=function(_0x77c2b3,_0x3fd965){_0x77c2b3=_0x77c2b3-0x0;var _0x3744de=_0xacf8[_0x77c2b3];return _0x3744de;};'use strict';var util=require('util');var _=require(_0x8acf('0x0'));var moment=require(_0x8acf('0x1'));function getSeconds(_0x1ba3d0,_0x4211da){var _0x1e4f56=moment(_0x1ba3d0)[_0x8acf('0x2')](0x0);var _0x4289b6=moment(_0x4211da)[_0x8acf('0x2')](0x0);return _0x1e4f56[_0x8acf('0x3')](_0x4289b6,_0x8acf('0x4'));}function Hangup(_0x4fbc6d,_0x13d829){this[_0x8acf('0x5')]=0x4;this['statedesc']='Answer';this[_0x8acf('0x6')]=_0x4fbc6d[_0x8acf('0x6')];this['type']=_0x4fbc6d['type'];this[_0x8acf('0x7')]=_0x4fbc6d['type']==='outbound'?'queue':_0x4fbc6d[_0x8acf('0x8')];this[_0x8acf('0x9')]=_0x4fbc6d[_0x8acf('0x9')];this[_0x8acf('0xa')]=_0x4fbc6d[_0x8acf('0xa')];this[_0x8acf('0xb')]=_0x4fbc6d[_0x8acf('0xb')];this[_0x8acf('0xc')]=_0x4fbc6d[_0x8acf('0x9')]+_0x4fbc6d['countcongestionretry']+_0x4fbc6d['countnoanswerretry']+_0x4fbc6d[_0x8acf('0xd')]+_0x4fbc6d[_0x8acf('0xe')]+_0x4fbc6d[_0x8acf('0xf')]+_0x4fbc6d['countmachineretry']+_0x4fbc6d[_0x8acf('0x10')];this[_0x8acf('0xd')]=_0x4fbc6d['countnosuchnumberretry'];this[_0x8acf('0xe')]=_0x4fbc6d[_0x8acf('0xe')];this[_0x8acf('0xf')]=_0x4fbc6d[_0x8acf('0xf')];this[_0x8acf('0x11')]=_0x4fbc6d[_0x8acf('0x11')];this[_0x8acf('0x10')]=_0x4fbc6d[_0x8acf('0x10')];this[_0x8acf('0x12')]=_0x13d829[_0x8acf('0x12')];this[_0x8acf('0x13')]=_0x4fbc6d[_0x8acf('0x14')];this[_0x8acf('0x15')]=_0x4fbc6d[_0x8acf('0x16')];this[_0x8acf('0x17')]=_0x4fbc6d[_0x8acf('0x17')];this['responsetime']=_0x4fbc6d[_0x8acf('0x18')];this['endtime']=moment()[_0x8acf('0x19')](_0x8acf('0x1a'));this['ringtime']=getSeconds(_0x4fbc6d[_0x8acf('0x18')],_0x4fbc6d[_0x8acf('0x17')]);this['holdtime']=0x0;this[_0x8acf('0x1b')]=getSeconds(this['endtime'],_0x4fbc6d[_0x8acf('0x18')]);this['queue']=_0x4fbc6d[_0x8acf('0x1c')];this[_0x8acf('0x1d')]=_0x8acf('0x1e');this[_0x8acf('0x1f')]=_0x13d829[_0x8acf('0x20')];this[_0x8acf('0x21')]=_0x4fbc6d[_0x8acf('0x21')];this[_0x8acf('0x22')]=_0x4fbc6d[_0x8acf('0x22')];this[_0x8acf('0x23')]=_0x4fbc6d[_0x8acf('0x23')];this['recallme']=_0x4fbc6d['recallme'];this[_0x8acf('0x24')]=_0x4fbc6d[_0x8acf('0x24')];this[_0x8acf('0x25')]=_0x4fbc6d[_0x8acf('0x25')];this[_0x8acf('0x26')]=_0x4fbc6d[_0x8acf('0x26')];this[_0x8acf('0x27')]=_0x4fbc6d['VoiceQueueId'];this[_0x8acf('0x28')]=_0x4fbc6d[_0x8acf('0x28')];}module[_0x8acf('0x29')]=Hangup; \ No newline at end of file +var _0x6f26=['number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','queue','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name'];(function(_0x9e1d73,_0xcf6479){var _0x1ba603=function(_0x689c74){while(--_0x689c74){_0x9e1d73['push'](_0x9e1d73['shift']());}};_0x1ba603(++_0xcf6479);}(_0x6f26,0x1e3));var _0x66f2=function(_0x2a9eb1,_0x4b8bd7){_0x2a9eb1=_0x2a9eb1-0x0;var _0xed26a5=_0x6f26[_0x2a9eb1];return _0xed26a5;};'use strict';var util=require(_0x66f2('0x0'));var _=require(_0x66f2('0x1'));var moment=require(_0x66f2('0x2'));function getSeconds(_0x5f07d5,_0x127569){var _0x5e0ae3=moment(_0x5f07d5)[_0x66f2('0x3')](0x0);var _0x30f5a9=moment(_0x127569)['milliseconds'](0x0);return _0x5e0ae3[_0x66f2('0x4')](_0x30f5a9,_0x66f2('0x5'));}function Hangup(_0xabcac8,_0x24d77b){this['state']=0x4;this[_0x66f2('0x6')]='Answer';this[_0x66f2('0x7')]=_0xabcac8[_0x66f2('0x7')];this[_0x66f2('0x8')]=_0xabcac8[_0x66f2('0x8')];this[_0x66f2('0x9')]=_0xabcac8['type']===_0x66f2('0xa')?'queue':_0xabcac8[_0x66f2('0x8')];this['countbusyretry']=_0xabcac8[_0x66f2('0xb')];this[_0x66f2('0xc')]=_0xabcac8[_0x66f2('0xc')];this[_0x66f2('0xd')]=_0xabcac8[_0x66f2('0xd')];this['countglobal']=_0xabcac8['countbusyretry']+_0xabcac8[_0x66f2('0xc')]+_0xabcac8[_0x66f2('0xd')]+_0xabcac8[_0x66f2('0xe')]+_0xabcac8['countdropretry']+_0xabcac8[_0x66f2('0xf')]+_0xabcac8[_0x66f2('0x10')]+_0xabcac8[_0x66f2('0x11')];this[_0x66f2('0xe')]=_0xabcac8['countnosuchnumberretry'];this[_0x66f2('0x12')]=_0xabcac8[_0x66f2('0x12')];this[_0x66f2('0xf')]=_0xabcac8[_0x66f2('0xf')];this[_0x66f2('0x10')]=_0xabcac8[_0x66f2('0x10')];this[_0x66f2('0x11')]=_0xabcac8['countagentrejectretry'];this[_0x66f2('0x13')]=_0x24d77b[_0x66f2('0x13')];this['calleridname']=_0xabcac8[_0x66f2('0x14')];this['calleridnum']=_0xabcac8[_0x66f2('0x15')];this[_0x66f2('0x16')]=_0xabcac8[_0x66f2('0x16')];this[_0x66f2('0x17')]=_0xabcac8['responsetime'];this[_0x66f2('0x18')]=moment()[_0x66f2('0x19')](_0x66f2('0x1a'));this['ringtime']=getSeconds(_0xabcac8[_0x66f2('0x17')],_0xabcac8[_0x66f2('0x16')]);this[_0x66f2('0x1b')]=0x0;this['talktime']=getSeconds(this['endtime'],_0xabcac8[_0x66f2('0x17')]);this[_0x66f2('0x1c')]=_0xabcac8[_0x66f2('0x1c')];this[_0x66f2('0x1d')]=_0x66f2('0x1e');this['reason']=_0x24d77b[_0x66f2('0x1f')];this['callback']=_0xabcac8[_0x66f2('0x20')];this[_0x66f2('0x21')]=_0xabcac8[_0x66f2('0x21')];this[_0x66f2('0x22')]=_0xabcac8[_0x66f2('0x22')];this[_0x66f2('0x23')]=_0xabcac8[_0x66f2('0x23')];this[_0x66f2('0x24')]=_0xabcac8[_0x66f2('0x24')];this[_0x66f2('0x25')]=_0xabcac8[_0x66f2('0x25')];this[_0x66f2('0x26')]=_0xabcac8['UserId'];this['VoiceQueueId']=_0xabcac8[_0x66f2('0x27')];this[_0x66f2('0x28')]=_0xabcac8[_0x66f2('0x28')];}module[_0x66f2('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index c6319a9..27ad540 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 _0x0590=['lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','queue','calleridname','name','starttime','endtime','responsetime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x53b7d2,_0x334640){var _0x38d64a=function(_0x22db72){while(--_0x22db72){_0x53b7d2['push'](_0x53b7d2['shift']());}};_0x38d64a(++_0x334640);}(_0x0590,0x1d3));var _0x0059=function(_0x1a3326,_0x26c35a){_0x1a3326=_0x1a3326-0x0;var _0x1895a3=_0x0590[_0x1a3326];return _0x1895a3;};'use strict';var util=require(_0x0059('0x0'));var _=require(_0x0059('0x1'));var moment=require('moment');function getSeconds(_0x2fbd91,_0x909e1f){var _0x63464d=moment(_0x2fbd91)[_0x0059('0x2')](0x0);var _0x5b1297=moment(_0x909e1f)['milliseconds'](0x0);return _0x63464d['diff'](_0x5b1297,_0x0059('0x3'));}function History(_0x3ca87d){this[_0x0059('0x4')]=_0x3ca87d['uniqueid'];this[_0x0059('0x5')]=_0x3ca87d[_0x0059('0x5')]||undefined;this[_0x0059('0x6')]=_0x3ca87d[_0x0059('0x6')];this[_0x0059('0x7')]=_0x3ca87d[_0x0059('0x6')]==='outbound'?'queue':_0x3ca87d[_0x0059('0x6')];this[_0x0059('0x8')]=_0x3ca87d['countbusyretry'];this[_0x0059('0x9')]=_0x3ca87d[_0x0059('0x9')];this[_0x0059('0xa')]=_0x3ca87d[_0x0059('0xa')];this[_0x0059('0xb')]=_0x3ca87d['countbusyretry']+_0x3ca87d['countcongestionretry']+_0x3ca87d[_0x0059('0xa')]+_0x3ca87d['countnosuchnumberretry']+_0x3ca87d[_0x0059('0xc')]+_0x3ca87d[_0x0059('0xd')]+_0x3ca87d[_0x0059('0xe')]+_0x3ca87d['countagentrejectretry'];this['countnosuchnumberretry']=_0x3ca87d[_0x0059('0xf')];this[_0x0059('0xc')]=_0x3ca87d[_0x0059('0xc')];this['countabandonedretry']=_0x3ca87d[_0x0059('0xd')];this[_0x0059('0xe')]=_0x3ca87d[_0x0059('0xe')];this[_0x0059('0x10')]=_0x3ca87d[_0x0059('0x10')];this[_0x0059('0x11')]=_0x3ca87d[_0x0059('0x11')];this[_0x0059('0x12')]=_0x3ca87d[_0x0059('0x13')];this['calleridnum']=_0x3ca87d['number'];this[_0x0059('0x14')]=_0x3ca87d[_0x0059('0x14')];this['responsetime']=_0x3ca87d['responsetime'];this[_0x0059('0x15')]=_0x3ca87d[_0x0059('0x16')];this['ringtime']=getSeconds(_0x3ca87d[_0x0059('0x16')],_0x3ca87d[_0x0059('0x14')]);this['holdtime']=0x0;this[_0x0059('0x17')]=0x0;this[_0x0059('0x18')]=_0x3ca87d[_0x0059('0x18')];this['callbackuniqueid']=_0x3ca87d[_0x0059('0x19')];this['callbackat']=_0x3ca87d[_0x0059('0x1a')];this[_0x0059('0x1b')]=_0x3ca87d[_0x0059('0x1b')];this[_0x0059('0x1c')]=_0x3ca87d['ContactId'];this[_0x0059('0x1d')]=_0x3ca87d[_0x0059('0x1d')];this[_0x0059('0x1e')]=_0x3ca87d['UserId'];this[_0x0059('0x1f')]=_0x3ca87d[_0x0059('0x1f')];this[_0x0059('0x20')]=_0x3ca87d['CampaignId'];this[_0x0059('0x21')]=_0x3ca87d[_0x0059('0x21')]||'';this['originatecalleridname']=_0x3ca87d[_0x0059('0x22')]||'';}module[_0x0059('0x23')]=History; \ No newline at end of file +var _0x824b=['calleridname','calleridnum','number','starttime','responsetime','endtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x824b,0x10e));var _0xb824=function(_0x33e2e7,_0x24e1b3){_0x33e2e7=_0x33e2e7-0x0;var _0x50f7c6=_0x824b[_0x33e2e7];return _0x50f7c6;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xb824('0x0'));function getSeconds(_0xa34dab,_0x2446f2){var _0x568bc=moment(_0xa34dab)[_0xb824('0x1')](0x0);var _0x165904=moment(_0x2446f2)[_0xb824('0x1')](0x0);return _0x568bc[_0xb824('0x2')](_0x165904,_0xb824('0x3'));}function History(_0x5c547b){this[_0xb824('0x4')]=_0x5c547b[_0xb824('0x4')];this['scheduledat']=_0x5c547b[_0xb824('0x5')]||undefined;this[_0xb824('0x6')]=_0x5c547b[_0xb824('0x6')];this['campaigntype']=_0x5c547b['type']===_0xb824('0x7')?_0xb824('0x8'):_0x5c547b[_0xb824('0x6')];this['countbusyretry']=_0x5c547b[_0xb824('0x9')];this[_0xb824('0xa')]=_0x5c547b['countcongestionretry'];this[_0xb824('0xb')]=_0x5c547b[_0xb824('0xb')];this[_0xb824('0xc')]=_0x5c547b[_0xb824('0x9')]+_0x5c547b['countcongestionretry']+_0x5c547b[_0xb824('0xb')]+_0x5c547b[_0xb824('0xd')]+_0x5c547b['countdropretry']+_0x5c547b[_0xb824('0xe')]+_0x5c547b[_0xb824('0xf')]+_0x5c547b[_0xb824('0x10')];this[_0xb824('0xd')]=_0x5c547b[_0xb824('0xd')];this[_0xb824('0x11')]=_0x5c547b['countdropretry'];this['countabandonedretry']=_0x5c547b[_0xb824('0xe')];this[_0xb824('0xf')]=_0x5c547b[_0xb824('0xf')];this['countagentrejectretry']=_0x5c547b[_0xb824('0x10')];this[_0xb824('0x8')]=_0x5c547b[_0xb824('0x8')];this[_0xb824('0x12')]=_0x5c547b['name'];this[_0xb824('0x13')]=_0x5c547b[_0xb824('0x14')];this[_0xb824('0x15')]=_0x5c547b[_0xb824('0x15')];this[_0xb824('0x16')]=_0x5c547b[_0xb824('0x16')];this[_0xb824('0x17')]=_0x5c547b[_0xb824('0x16')];this['ringtime']=getSeconds(_0x5c547b[_0xb824('0x16')],_0x5c547b[_0xb824('0x15')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x5c547b[_0xb824('0x18')];this[_0xb824('0x19')]=_0x5c547b[_0xb824('0x19')];this[_0xb824('0x1a')]=_0x5c547b[_0xb824('0x1a')];this['recallme']=_0x5c547b[_0xb824('0x1b')];this[_0xb824('0x1c')]=_0x5c547b[_0xb824('0x1c')];this[_0xb824('0x1d')]=_0x5c547b['ListId'];this[_0xb824('0x1e')]=_0x5c547b[_0xb824('0x1e')];this[_0xb824('0x1f')]=_0x5c547b[_0xb824('0x1f')];this['CampaignId']=_0x5c547b[_0xb824('0x20')];this[_0xb824('0x21')]=_0x5c547b['originatecalleridnum']||'';this[_0xb824('0x22')]=_0x5c547b[_0xb824('0x22')]||'';}module[_0xb824('0x23')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 143929e..26fcebb 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 _0xa9e0=['[syncMachineIvr]','[syncHangupIvr][createHistory]','dialQueueProject','AGI','[syncHangupIvr]','cause-txt','Unknow','reason','agent','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','Drop','TIMEOUT','dialDropMaxRetry','countdropretry','dialDropRetryFrequency','minutes','[rescheduleContact][Drop]','calleridname','calleridnum','CRIS\x20evt\x2010.1','CRIS\x20queueCallerAbandon\x2010.1','log','CRIS\x20createHistory\x2010.1','[syncAgentComplete][createHistory][10]','Abandoned','dropreason','CALLEREXIT','countabandonedretry','add','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','endtime','CRIS\x20createHistory\x2011','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','locked','paused','stateinterface','push','merge','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','preview','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','timezones','content','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','power','handlePower','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','syncQueueSummary','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-CAMPAIGNID','tags','createdAt','updatedAt','XMD-','toUpper','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','countcongestionretry','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberRetryFrequency','dialMachineRetryFrequency','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','countglobal','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','stateGlobal','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dropRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','[CatchErlangB]','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','Agent','voicePause','Contact\x20updated','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','limitCalls','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[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','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]','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','md5','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperFinal','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','queueBooked','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','Error','stringify','diff','seconds','emit','type','strategy','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','format','voice:queue:%s','voice_queue:save','ivr','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','outbound','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','originated','[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\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','is\x20disactive','state','statedesc','starttime','[uniqueid]','clearZombieChannels','hasOwnProperty','isNil','catch','No\x20such\x20channel','[Dialer][checkChannel]','queue','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','status','unmonitored','uniqueid','variable','exten','dialAMDActive','value','HANGUP','membername','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','amd','[syncMachine][createHistory]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncMachineIvr][createHistory]'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0x0a9e('0x3'));var Redis=require('ioredis');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var loggerBooked=require(_0x0a9e('0x5'))(_0x0a9e('0x7'));var loggerPredictive=require('../../../config/logger')(_0x0a9e('0x8'));var loggerPredictiveCalls=require(_0x0a9e('0x5'))(_0x0a9e('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0x0a9e('0xa'));config['redis']=_['defaults'](config[_0x0a9e('0xb')],{'host':_0x0a9e('0xc'),'port':0x18eb});var io=require(_0x0a9e('0xd'))(new Redis(config[_0x0a9e('0xb')]));var cmHopper=require(_0x0a9e('0xe'));var cmHopperFinal=require(_0x0a9e('0xf'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require(_0x0a9e('0x10'));var Final=require(_0x0a9e('0x11'));var AgentComplete=require(_0x0a9e('0x12'));var QueueCallerAbandon=require(_0x0a9e('0x13'));var Hangup=require(_0x0a9e('0x14'));var ipAgi=process[_0x0a9e('0x15')]['XCALLY_IP_AGI']||_0x0a9e('0x16');var strategy={'rrmemory':_0x0a9e('0x17'),'roundrobin':_0x0a9e('0x18')};var Sequence=function(){};Sequence[_0x0a9e('0x19')][_0x0a9e('0x1a')]=function(_0x4d5611){this['tail']=this[_0x0a9e('0x1b')]?this['tail'][_0x0a9e('0x1c')](_0x4d5611):_0x4d5611();};function Dialer(_0x519dfd,_0x16033c){this[_0x0a9e('0x1d')]=new Sequence();this['preview']=_0x16033c;this[_0x0a9e('0x1e')]=_0x519dfd['voiceQueues'];this[_0x0a9e('0x1f')]=_0x519dfd[_0x0a9e('0x1f')];this[_0x0a9e('0x20')]=_0x519dfd[_0x0a9e('0x20')];this[_0x0a9e('0x21')]=_0x519dfd[_0x0a9e('0x21')];this[_0x0a9e('0x22')]=config[_0x0a9e('0x22')]||0x2;this[_0x0a9e('0x23')]={};this[_0x0a9e('0x24')]={};this[_0x0a9e('0x25')]={};this[_0x0a9e('0x26')]={};this['optionPredictive']={};this[_0x0a9e('0x27')]={};this[_0x0a9e('0x28')]={};this['ivrOriginated']={};this[_0x0a9e('0x29')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0x0a9e('0x2a')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x2c'),this[_0x0a9e('0x2d')]['bind'](this));ami['on'](_0x0a9e('0x2e'),this[_0x0a9e('0x2f')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x30'),this[_0x0a9e('0x31')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x32'),this['syncQueueSummary']['bind'](this));ami['on'](_0x0a9e('0x33'),this[_0x0a9e('0x34')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x35'),this['syncNewExten'][_0x0a9e('0x2b')](this));ami['on']('varset',this[_0x0a9e('0x36')]['bind'](this));ami['on'](_0x0a9e('0x37'),this[_0x0a9e('0x38')][_0x0a9e('0x2b')](this));ami['on'](_0x0a9e('0x39'),this[_0x0a9e('0x3a')][_0x0a9e('0x2b')](this));this[_0x0a9e('0x3b')]();this[_0x0a9e('0x3c')]();}function isNotNull(_0x5a101a){return _0x5a101a!==null&&!_[_0x0a9e('0x3d')](_0x5a101a);}function checkIsLoggedIn(_0x468813,_0x2b1f27){return function(){if(_0x2b1f27<=0x0){_0x468813[_0x0a9e('0x3e')]='AGENTS_NOT_LOGGED';throw _0x468813[_0x0a9e('0x3f')]+_0x0a9e('0x40');}};}function isActive(_0x1843b2){return _0x1843b2;}function checkIsActive(_0x824a4f,_0x58b06f){return function(){if(!isActive(_0x58b06f)){_0x824a4f[_0x0a9e('0x3e')]=_0x0a9e('0x41');throw _0x824a4f[_0x0a9e('0x3f')]+_0x0a9e('0x42');}};}function checkInterval(_0x540530){return function(){if(!isNotNull(_0x540530[_0x0a9e('0x43')])){_0x540530['message']=_0x0a9e('0x44');throw _0x540530[_0x0a9e('0x3f')]+_0x0a9e('0x45');}if(!isNotNull(_0x540530[_0x0a9e('0x43')][_0x0a9e('0x46')])){_0x540530['message']=_0x0a9e('0x44');throw _0x540530[_0x0a9e('0x3f')]+_0x0a9e('0x45');}if(!isNotNull(_[_0x0a9e('0x47')](_0x540530[_0x0a9e('0x43')][_0x0a9e('0x46')]))){_0x540530[_0x0a9e('0x3e')]=_0x0a9e('0x44');throw _0x540530['name']+_0x0a9e('0x45');}};}function msgResponse(_0x5e7238,_0x2cc7a0,_0x14b13f){return{'action':_0x5e7238,'response':_0x2cc7a0,'message':_0x14b13f,'stack':_0x14b13f};}function myreject(_0x2b7e7f){return function(_0x3f3d41){return _0x2b7e7f(msgResponse('[ifTime][Action]',_0x0a9e('0x48'),JSON[_0x0a9e('0x49')](_0x3f3d41)));};}function getSeconds(_0x1fa90d,_0x15de0e){var _0x4853b1=moment(_0x1fa90d)['milliseconds'](0x0);var _0x1e8694=moment(_0x15de0e)['milliseconds'](0x0);return _0x4853b1[_0x0a9e('0x4a')](_0x1e8694,_0x0a9e('0x4b'));}function emit(_0x381c37,_0x1ef87a,_0x4f41ae){io['to'](_0x381c37)[_0x0a9e('0x4c')](_0x1ef87a,_0x4f41ae);}function emitVoiceQueueSummary(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x4d')]==='outbound'){var _0x1dbf74={'id':_0x3bfce8['id'],'name':_0x3bfce8[_0x0a9e('0x3f')],'strategy':_0x3bfce8[_0x0a9e('0x4e')],'answered':_0x3bfce8['answered'],'available':_0x3bfce8['available'],'loggedIn':_0x3bfce8[_0x0a9e('0x4f')],'pTalking':_0x3bfce8[_0x0a9e('0x50')],'sumBillable':_0x3bfce8['sumBillable'],'sumDuration':_0x3bfce8[_0x0a9e('0x51')],'sumHoldTime':_0x3bfce8[_0x0a9e('0x52')]||0x0,'talking':_0x3bfce8[_0x0a9e('0x53')],'total':_0x3bfce8[_0x0a9e('0x54')],'type':_0x3bfce8['type'],'unmanaged':_0x3bfce8['unmanaged'],'abandoned':_0x3bfce8[_0x0a9e('0x55')],'waiting':_0x3bfce8[_0x0a9e('0x56')],'loggedInDb':_0x3bfce8['loggedInDb'],'dialActive':_0x3bfce8[_0x0a9e('0x57')],'dialMethod':_0x3bfce8[_0x0a9e('0x58')],'dialOriginateCallerIdName':_0x3bfce8[_0x0a9e('0x59')],'dialOriginateCallerIdNumber':_0x3bfce8['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x3bfce8[_0x0a9e('0x5a')],'dialPrefix':_0x3bfce8[_0x0a9e('0x5b')],'outboundAnswerAgiCallsDay':_0x3bfce8[_0x0a9e('0x5c')],'outboundAnswerCallsDay':_0x3bfce8[_0x0a9e('0x5d')],'outboundBlacklistCallsDay':_0x3bfce8[_0x0a9e('0x5e')],'outboundBusyCallsDay':_0x3bfce8[_0x0a9e('0x5f')],'outboundCongestionCallsDay':_0x3bfce8[_0x0a9e('0x60')],'outboundDropCallsDayACS':_0x3bfce8[_0x0a9e('0x61')],'outboundDropCallsDayCallersExit':_0x3bfce8[_0x0a9e('0x62')],'outboundDropCallsDayTimeout':_0x3bfce8[_0x0a9e('0x63')],'outboundNoAnswerCallsDay':_0x3bfce8[_0x0a9e('0x64')],'outboundNoSuchCallsDay':_0x3bfce8[_0x0a9e('0x65')],'outboundOriginateFailureCallsDay':_0x3bfce8[_0x0a9e('0x66')],'outboundReCallsDay':_0x3bfce8[_0x0a9e('0x67')],'outboundRejectCallsDay':_0x3bfce8[_0x0a9e('0x68')],'outboundUnknownCallsDay':_0x3bfce8['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x3bfce8['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x3bfce8[_0x0a9e('0x69')],'predictiveIntervalAvgTalktime':_0x3bfce8[_0x0a9e('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x3bfce8[_0x0a9e('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x3bfce8[_0x0a9e('0x6c')],'predictiveIntervalErlangCalls':_0x3bfce8[_0x0a9e('0x6d')],'predictiveIntervalErlangCallsDroppedCalls':_0x3bfce8[_0x0a9e('0x6e')],'predictiveIntervalHitRate':_0x3bfce8[_0x0a9e('0x6f')],'predictiveIntervalMultiplicativeFactor':_0x3bfce8[_0x0a9e('0x70')],'predictiveIntervalPauses':_0x3bfce8[_0x0a9e('0x71')],'predictiveIntervalAvailable':_0x3bfce8[_0x0a9e('0x72')],'predictiveIntervalTotalCalls':_0x3bfce8[_0x0a9e('0x73')],'message':_0x3bfce8[_0x0a9e('0x3e')],'originated':_0x3bfce8['originated'],'erlangCalls':_0x3bfce8[_0x0a9e('0x74')],'erlangCallToSecond':_0x3bfce8[_0x0a9e('0x75')],'erlangAbandonmentRate':_0x3bfce8[_0x0a9e('0x76')],'erlangBusyFactor':_0x3bfce8[_0x0a9e('0x77')],'startPredictive':_0x3bfce8[_0x0a9e('0x27')],'startProgressive':_0x3bfce8[_0x0a9e('0x28')]};if(_0x3bfce8[_0x0a9e('0x78')]){_0x1dbf74[_0x0a9e('0x78')]={'id':_0x3bfce8['Trunk']['id'],'name':_0x3bfce8[_0x0a9e('0x78')]['name'],'active':_0x3bfce8[_0x0a9e('0x78')][_0x0a9e('0x79')],'callerid':_0x3bfce8[_0x0a9e('0x78')]['callerid']};}if(_0x3bfce8[_0x0a9e('0x43')]){_0x1dbf74[_0x0a9e('0x43')]={'id':_0x3bfce8[_0x0a9e('0x43')]['id'],'name':_0x3bfce8[_0x0a9e('0x43')][_0x0a9e('0x3f')]};}var _0x37be73=md5(JSON[_0x0a9e('0x49')](_0x1dbf74));if(_0x3bfce8['md5']!==_0x37be73){_0x3bfce8[_0x0a9e('0x3')]=_0x37be73;emit(util[_0x0a9e('0x7a')](_0x0a9e('0x7b'),_0x1dbf74[_0x0a9e('0x3f')]),_0x0a9e('0x7c'),_0x1dbf74);}}}function emitCampaignSummary(_0x992c77){if(_0x992c77[_0x0a9e('0x4d')]===_0x0a9e('0x7d')){emit(util[_0x0a9e('0x7a')]('campaign:ivr:%s',_0x992c77[_0x0a9e('0x3f')]),_0x0a9e('0x7e'),_0x992c77);}}function checkGetDataPredictive(_0x4f7240){if(isNotNull(_0x4f7240)){if(!_['isEmpty'](_0x4f7240)){loggerPredictive['info'](_0x0a9e('0x7f'));loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x81'),_0x4f7240[_0x0a9e('0x73')]);loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x82'),_0x4f7240[_0x0a9e('0x83')]);loggerPredictive[_0x0a9e('0x80')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4f7240['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0x0a9e('0x84'),_0x4f7240[_0x0a9e('0x6b')]);loggerPredictive[_0x0a9e('0x80')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4f7240[_0x0a9e('0x69')]);loggerPredictive[_0x0a9e('0x80')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4f7240['predictiveIntervalAvgTalktime']);loggerPredictive[_0x0a9e('0x80')]('---------------------------');if(_0x4f7240[_0x0a9e('0x73')]>0x0){if(!_['isUndefined'](_0x4f7240[_0x0a9e('0x6a')])&&_0x4f7240[_0x0a9e('0x6a')]>0x0){return!![];}else{loggerPredictive[_0x0a9e('0x80')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0x0a9e('0x3d')](_0x4f7240[_0x0a9e('0x69')])&&_0x4f7240['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive['info'](_0x0a9e('0x85'));}}else{loggerPredictive[_0x0a9e('0x80')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x0a9e('0x80')]('History\x20information\x20are\x20empty');}}else{loggerPredictive[_0x0a9e('0x80')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xe22ccc){return function(_0x4a6deb){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x0a9e('0x80')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4a6deb[_0x0a9e('0x74')]);loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x86'),_0x4a6deb[_0x0a9e('0x75')]);loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x87'),_0x4a6deb[_0x0a9e('0x76')]);loggerPredictive[_0x0a9e('0x80')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4a6deb[_0x0a9e('0x77')]);loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x87'),_0x4a6deb[_0x0a9e('0x76')]);loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x88'));_['merge'](_0xe22ccc,_0x4a6deb);};}function getDiff(_0x956fbe){var _0x26bc80=moment()['milliseconds'](0x0);var _0x3649cc=moment(_0x956fbe)['milliseconds'](0x0);return _0x26bc80[_0x0a9e('0x4a')](_0x3649cc,'seconds');}function ifInterval(_0x4b3c1a,_0x5674ee){if(_[_0x0a9e('0x3d')](_0x5674ee)){return![];}if(getDiff(_0x5674ee)<_0x4b3c1a*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x49d231){if(isNotNull(_0x49d231)){if(!_[_0x0a9e('0x3d')](_0x49d231[_0x0a9e('0x28')])){_0x49d231[_0x0a9e('0x28')]=undefined;loggerPredictive[_0x0a9e('0x80')](_0x49d231[_0x0a9e('0x3f')],_0x0a9e('0x89'));}if(!_['isUndefined'](_0x49d231[_0x0a9e('0x27')])){_0x49d231['startPredictive']=undefined;loggerPredictive[_0x0a9e('0x80')](_0x49d231[_0x0a9e('0x3f')],_0x0a9e('0x8a'));}if(!_['isUndefined'](_0x49d231[_0x0a9e('0x8b')])){clearInterval(_0x49d231[_0x0a9e('0x8b')]);_0x49d231[_0x0a9e('0x8b')]=undefined;loggerPredictive[_0x0a9e('0x80')](_0x49d231['name'],_0x0a9e('0x8c'));}}}function erlangb(_0xe05a5a,_0x54327c){if(_0x54327c===0x0){return 0x0;}var _0x797b45=0x1;for(var _0x17e88c=0x1;_0x17e88c<=_0x54327c;_0x17e88c+=0x1){_0x797b45=0x1+_0x797b45*_0x17e88c/_0xe05a5a;}return 0x1/_0x797b45;}function isVoiceQueueOutbound(_0x88dcbf){return _0x88dcbf===_0x0a9e('0x8d');}function isNotPreview(_0x401837){return _0x401837!=='preview';}function isCampaignIvr(_0x176840){return _0x176840===_0x0a9e('0x7d');}function getCallerId(_0x281c7d,_0x47bb43,_0x3528b7){if(!_['isUndefined'](_0x3528b7)&&'string'===typeof _0x3528b7&&!_[_0x0a9e('0x47')](_0x3528b7)){if(!_[_0x0a9e('0x3d')](_0x47bb43)&&_0x0a9e('0x8e')===typeof _0x47bb43&&!_[_0x0a9e('0x47')](_0x47bb43)){return util[_0x0a9e('0x7a')](_0x0a9e('0x8f'),_0x47bb43,_0x3528b7);}return util[_0x0a9e('0x7a')](_0x0a9e('0x8f'),_0x3528b7,_0x3528b7);}if(!_[_0x0a9e('0x3d')](_0x281c7d)&&_0x0a9e('0x8e')===typeof _0x281c7d&&!_[_0x0a9e('0x47')](_0x281c7d)){return _0x281c7d;}return _0x0a9e('0x90');}function loggerCatchQueueSummary(_0x2bbb86,_0x2b8192){return function(_0x320898){freeVariablesPredictive(_0x2b8192);emitVoiceQueueSummary(_0x2b8192);emitCampaignSummary(_0x2b8192);loggerSyncQueueSummary[_0x0a9e('0x91')](_0x2bbb86,util[_0x0a9e('0x92')](_0x320898,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4257c9,_0x5150a4){return function(_0x1b0b98){loggerPredictive[_0x0a9e('0x91')](_0x5150a4[_0x0a9e('0x3f')],_0x4257c9);loggerPredictive['error'](_0x1b0b98[_0x0a9e('0x93')]);freeVariablesPredictive(_0x5150a4);};}function loggerCatch(_0x30944e){return function(_0x4b341d){logger[_0x0a9e('0x91')](_0x30944e,util[_0x0a9e('0x92')](_0x4b341d,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3ef315){return _0x3ef315&&!_[_0x0a9e('0x3d')](_0x3ef315)&&_0x3ef315[_0x0a9e('0x94')]>0x0;}function decremetOriginate(_0x4a43a8){if(!_['isUndefined'](_0x4a43a8)&&_0x4a43a8!==null){if(_0x4a43a8['hasOwnProperty'](_0x0a9e('0x95'))){if(_0x4a43a8[_0x0a9e('0x95')]>0x0){_0x4a43a8[_0x0a9e('0x95')]-=0x1;}else{logger[_0x0a9e('0x91')](_0x0a9e('0x96'));}}}else{logger[_0x0a9e('0x91')](_0x0a9e('0x97'));}}function checkContactLowerLimitOriginate(_0x1a0677,_0x5512d1,_0x235f8f){if(_0x5512d1>_0x235f8f){for(var _0xcbc8b2=0x0;_0xcbc8b2<_0x5512d1-_0x235f8f;_0xcbc8b2+=0x1){decremetOriginate(_0x1a0677);}}}function loggerGetContactDialer(_0x12ccdb,_0x4a4fc7,_0x2bdc44){return function(_0x583b2e){checkContactLowerLimitOriginate(_0x4a4fc7,_0x2bdc44,0x0);logger[_0x0a9e('0x91')](_0x12ccdb,util[_0x0a9e('0x92')](_0x583b2e,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4c46c1){return function(_0x2ed01e){if(isNotNull(_0x2ed01e)&&isNotNull(_0x2ed01e[0x0])){if(_0x2ed01e[0x0][_0x0a9e('0x98')]>0x0){_0x4c46c1[_0x0a9e('0x3e')]=_0x0a9e('0x99');logger['info'](_0x0a9e('0x9a')+_0x4c46c1[_0x0a9e('0x3f')],_0x2ed01e[0x0][_0x0a9e('0x98')],_0x0a9e('0x9b'));}else{_0x4c46c1['message']=_0x0a9e('0x9c');logger[_0x0a9e('0x80')](_0x0a9e('0x9d')+_0x4c46c1[_0x0a9e('0x3f')]);}}};}function notSendMessagesQueue(_0x4abc8f){if(_0x4abc8f[_0x0a9e('0x9e')]){freeVariablesPredictive(_0x4abc8f);if(_0x4abc8f[_0x0a9e('0x95')]===0x0&&_0x4abc8f[_0x0a9e('0x53')]===0x0&&_0x4abc8f[_0x0a9e('0x56')]===0x0&&(_0x4abc8f[_0x0a9e('0x50')]||0x0)===0x0){_0x4abc8f[_0x0a9e('0x9e')]=![];_0x4abc8f[_0x0a9e('0x9f')]=0x0;_0x4abc8f[_0x0a9e('0x3e')]=_0x0a9e('0x41');loggerSyncQueueSummary[_0x0a9e('0x91')](_0x0a9e('0xa0'),_0x4abc8f[_0x0a9e('0x3f')],_0x0a9e('0xa1'));}else{_0x4abc8f[_0x0a9e('0x3e')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x0a9e('0x91')](_0x0a9e('0xa0'),_0x4abc8f[_0x0a9e('0x3f')],'is\x20disactive');}emitVoiceQueueSummary(_0x4abc8f);}}function notSendMessagesCampaign(_0x3736e0){if(_0x3736e0[_0x0a9e('0x9e')]){if(_0x3736e0[_0x0a9e('0x95')]===0x0){_0x3736e0[_0x0a9e('0x9e')]=![];_0x3736e0['message']='NOT_ACTIVE';loggerSyncQueueSummary[_0x0a9e('0x91')](_0x0a9e('0xa2'),_0x3736e0['name'],_0x0a9e('0xa1'));}else{_0x3736e0['message']=_0x0a9e('0xa3');loggerSyncQueueSummary[_0x0a9e('0x91')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3736e0[_0x0a9e('0x3f')],_0x0a9e('0xa4'));}emitCampaignSummary(_0x3736e0);}}function createObjHistory(_0x2d2286,_0x42b959,_0x3755fe,_0x1f42a0,_0x444f1f){_0x2d2286['message']=_0x3755fe;var _0x2973d3=new Action(_0x2d2286,_0x42b959);var _0x3ca9b9=new History(_0x2973d3);_0x3ca9b9[_0x0a9e('0xa5')]=_0x1f42a0;_0x3ca9b9[_0x0a9e('0xa6')]=_0x444f1f;_0x3ca9b9['endtime']=_0x2973d3[_0x0a9e('0xa7')];return _0x3ca9b9;}Dialer[_0x0a9e('0x19')]['loopClearZombieChannels']=function(){var _0x1d6834=this;setInterval(function(){_0x1d6834['clearZombieChannels'](_0x1d6834[_0x0a9e('0x26')],_0x0a9e('0xa8'));_0x1d6834[_0x0a9e('0xa9')](_0x1d6834[_0x0a9e('0x24')],'[actions]');},0x32c8);};Dialer['prototype'][_0x0a9e('0xa9')]=function(_0x2b9c01,_0x94dcf5){var _0x5ac73d=this;for(var _0x3b4a9f in _0x2b9c01){if(_0x2b9c01[_0x0a9e('0xaa')](_0x3b4a9f)){this['sequence']['enqueue'](function(){if(!_[_0x0a9e('0xab')](_0x2b9c01[_0x3b4a9f])){return ami['Action']({'action':'status','channel':_0x2b9c01[_0x3b4a9f]['channel']})[_0x0a9e('0xac')](function(_0xf3601c){if(_0xf3601c[_0x0a9e('0x3e')]===_0x0a9e('0xad')){setTimeout(function(){if(_0x2b9c01[_0x3b4a9f]&&_0x2b9c01[_0x3b4a9f][_0x0a9e('0x4d')]!==_0x0a9e('0x7d')){_0x5ac73d['updateOriginated'](_0x5ac73d[_0x0a9e('0x1e')][_0x2b9c01[_0x3b4a9f]['queue']]);logger[_0x0a9e('0x91')](_0x0a9e('0xae'),_0x94dcf5,_0x3b4a9f,_0x2b9c01[_0x3b4a9f][_0x0a9e('0xaf')]);delete _0x2b9c01[_0x3b4a9f];}if(_0x2b9c01[_0x3b4a9f]&&_0x2b9c01[_0x3b4a9f][_0x0a9e('0x4d')]==='ivr'){_0x5ac73d[_0x0a9e('0xb0')](_0x5ac73d[_0x0a9e('0x1f')][_0x2b9c01[_0x3b4a9f][_0x0a9e('0xaf')]]);logger['error'](_0x0a9e('0xb1'),_0x94dcf5,_0x3b4a9f,_0x2b9c01[_0x3b4a9f][_0x0a9e('0xaf')]);delete _0x2b9c01[_0x3b4a9f];}},0x2328);}});}});}}};Dialer[_0x0a9e('0x19')][_0x0a9e('0xb2')]=function(_0x255e49){return BPromise[_0x0a9e('0xb3')]()[_0x0a9e('0xb4')](cmHopper[_0x0a9e('0xb2')](_0x255e49))['catch'](loggerCatch(_0x0a9e('0xb5')));};Dialer[_0x0a9e('0x19')]['checkIsBlackList']=function(_0x40e0f0){return BPromise[_0x0a9e('0xb3')]()[_0x0a9e('0xb4')](cmHopperBlack['checkIsBlackList'](_0x40e0f0))[_0x0a9e('0xac')](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x0a9e('0x19')][_0x0a9e('0xb6')]=function(_0x558a87){return BPromise[_0x0a9e('0xb3')]()[_0x0a9e('0xb4')](cmHopperBlack[_0x0a9e('0xb6')](_0x558a87))[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0xb7')));};Dialer['prototype'][_0x0a9e('0xb8')]=function(_0x31d25a){return BPromise[_0x0a9e('0xb3')]()[_0x0a9e('0xb4')](cmHopperHistory[_0x0a9e('0xb9')](_0x31d25a))[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0xba')));};Dialer[_0x0a9e('0x19')][_0x0a9e('0xbb')]=function(_0x31af8c){return BPromise[_0x0a9e('0xb3')]()[_0x0a9e('0xb4')](cmHopper[_0x0a9e('0xbb')](_0x31af8c))['catch'](loggerCatch(_0x0a9e('0xbc')));};Dialer[_0x0a9e('0x19')][_0x0a9e('0xbd')]=function(_0x2ed526,_0xb0599a,_0x5d9ddb){return BPromise[_0x0a9e('0xb3')]()[_0x0a9e('0xb4')](cmHopper['unlockContact'](_0x2ed526,_0xb0599a,_0x5d9ddb))[_0x0a9e('0xac')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x0a9e('0x19')][_0x0a9e('0xbe')]=function(_0x1d93b1,_0xf8c6c4,_0x4f4d2d,_0x3ceba6){return BPromise['resolve']()[_0x0a9e('0xb4')](cmHopper[_0x0a9e('0xbe')](_0x1d93b1,_0xf8c6c4,_0x4f4d2d,_0x3ceba6))['catch'](loggerCatch(_0x0a9e('0xbf')));};Dialer[_0x0a9e('0x19')][_0x0a9e('0xc0')]=function(_0x4ab276,_0x4c788f,_0x1b82b7){return BPromise[_0x0a9e('0xb3')]()[_0x0a9e('0xb4')](cmHopper[_0x0a9e('0xc0')](_0x4ab276,_0x4c788f,_0x1b82b7))[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0xbf')));};Dialer[_0x0a9e('0x19')][_0x0a9e('0xc1')]=function(_0x3f8124){return BPromise['resolve']()[_0x0a9e('0xb4')](voiceQueueRt['getVoiceQueueRtPauses'](_0x3f8124))[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0xc2')));};Dialer[_0x0a9e('0x19')][_0x0a9e('0xc3')]=function(_0x1b61d5){return BPromise['resolve']()[_0x0a9e('0xb4')](cmHopper[_0x0a9e('0xc3')](_0x1b61d5))[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0xc4')));};Dialer[_0x0a9e('0x19')]['createHistory']=function(_0x4f074c){return BPromise[_0x0a9e('0xb3')]()['then'](cmHopperHistory[_0x0a9e('0xc5')](_0x4f074c))[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0xc6')));};Dialer[_0x0a9e('0x19')][_0x0a9e('0xb0')]=function(_0x213e5d){if(!_['isUndefined'](_0x213e5d)&&_0x213e5d!==null){if(_0x213e5d['hasOwnProperty'](_0x0a9e('0x95'))){if(_0x213e5d['originated']>0x0){_0x213e5d[_0x0a9e('0x95')]-=0x1;}else{logger['error'](_0x0a9e('0xc7'));}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x0a9e('0x19')][_0x0a9e('0xc8')]=function(_0x5e9b0b,_0x170af6){var _0x17cb30=this;return function(_0x15c6b9){_0x17cb30[_0x0a9e('0xb0')](_0x170af6);logger[_0x0a9e('0x91')](_0x5e9b0b,util['inspect'](_0x15c6b9,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x0a9e('0xc9')]=function(_0x22286c,_0x41c8cd,_0x24beb6){var _0x59303b={'state':0x19,'statedesc':'notFound'};this[_0x0a9e('0xb0')](_0x41c8cd);this[_0x0a9e('0xca')](_['merge'](_0x59303b,_[_0x0a9e('0xcb')](_0x24beb6,[_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0')])),_0x0a9e('0xd1'),_0x0a9e('0xd2'));logger[_0x0a9e('0x91')](_0x22286c);};Dialer[_0x0a9e('0x19')]['isSuccess']=function(_0x1065a7){return _0x1065a7===_0x0a9e('0xd3');};Dialer[_0x0a9e('0x19')][_0x0a9e('0xd4')]=function(_0x1d0b02){return!_['isUndefined'](_0x1d0b02)&&_0x1d0b02&&!_['isUndefined'](_0x1d0b02[_0x0a9e('0x3f')])&&!_[_0x0a9e('0x3d')](_0x1d0b02[_0x0a9e('0x79')])&&_0x1d0b02[_0x0a9e('0x79')]&&(this[_0x0a9e('0x21')][util['format'](_0x0a9e('0xd5'),_0x1d0b02[_0x0a9e('0x3f')])][_0x0a9e('0xd6')]==='reachable'||this[_0x0a9e('0x21')][util['format'](_0x0a9e('0xd5'),_0x1d0b02['name'])][_0x0a9e('0xd6')]===_0x0a9e('0xd7'));};Dialer[_0x0a9e('0x19')]['saveInDb']=function(_0xc9529d,_0x5ed560,_0x4383da){this[_0x0a9e('0xc5')](_0xc9529d)[_0x0a9e('0xac')](loggerCatch(_0x5ed560));this[_0x0a9e('0xc3')](_0xc9529d)[_0x0a9e('0xac')](loggerCatch(_0x4383da));};Dialer[_0x0a9e('0x19')][_0x0a9e('0x36')]=function(_0xe89aaa){var _0x2aaf07=this[_0x0a9e('0x26')][_0xe89aaa[_0x0a9e('0xd8')]];var _0xc876d4;if(!_[_0x0a9e('0xab')](_0xe89aaa)&&!_[_0x0a9e('0xab')](_0xe89aaa[_0x0a9e('0xd9')])&&!_[_0x0a9e('0xab')](_0xe89aaa['variable']['amdstatus'])&&_0xe89aaa[_0x0a9e('0xda')]==='xcally-motion-dialer'&&_0x2aaf07){if(_0x2aaf07[_0x0a9e('0x4d')]!==_0x0a9e('0x7d')&&this['voiceQueues'][_0x2aaf07[_0x0a9e('0xaf')]][_0x0a9e('0xdb')]&&_0xe89aaa[_0x0a9e('0xdc')]===_0x0a9e('0xdd')){delete this['uniqueId'][_0xe89aaa[_0x0a9e('0xd8')]];this[_0x0a9e('0xb0')](this[_0x0a9e('0x1e')][_0x2aaf07[_0x0a9e('0xaf')]]);this['voiceQueues'][_0x2aaf07[_0x0a9e('0xaf')]][_0x0a9e('0x5d')]+=0x1;this[_0x0a9e('0x1e')][_0x2aaf07['queue']][_0x0a9e('0x5c')]+=0x1;_0xc876d4=new Hangup(_0x2aaf07,_0xe89aaa);_0xc876d4[_0x0a9e('0xa5')]=0x12;_0xc876d4[_0x0a9e('0xa6')]='HangupInAMD';_0xc876d4[_0x0a9e('0xde')]=_0x0a9e('0xdf');this[_0x0a9e('0xca')](_0xc876d4,_0x0a9e('0xe0'),_0x0a9e('0xe1'));}if(_0x2aaf07['type']!==_0x0a9e('0x7d')&&this[_0x0a9e('0x1e')][_0x2aaf07['queue']][_0x0a9e('0xdb')]&&_0xe89aaa[_0x0a9e('0xdc')]===_0x0a9e('0xe2')){delete this['uniqueId'][_0xe89aaa['uniqueid']];this['updateOriginated'](this[_0x0a9e('0x1e')][_0x2aaf07[_0x0a9e('0xaf')]]);this['voiceQueues'][_0x2aaf07[_0x0a9e('0xaf')]][_0x0a9e('0x5d')]+=0x1;this[_0x0a9e('0x1e')][_0x2aaf07['queue']][_0x0a9e('0x5c')]+=0x1;_0xc876d4=new Hangup(_0x2aaf07,_0xe89aaa);_0xc876d4[_0x0a9e('0xa5')]=0x13;_0xc876d4[_0x0a9e('0xa6')]=_0x0a9e('0xe3');_0xc876d4[_0x0a9e('0xde')]=_0x0a9e('0xdf');_0xc876d4[_0x0a9e('0xe4')]=!![];this[_0x0a9e('0xca')](_0xc876d4,_0x0a9e('0xe5'),'[syncMachine]');}if(_0x2aaf07[_0x0a9e('0x4d')]==='ivr'&&this[_0x0a9e('0x1f')][_0x2aaf07[_0x0a9e('0xaf')]][_0x0a9e('0xdb')]&&_0xe89aaa[_0x0a9e('0xdc')]===_0x0a9e('0xdd')){delete this[_0x0a9e('0x26')][_0xe89aaa['uniqueid']];this[_0x0a9e('0xb0')](this[_0x0a9e('0x1f')][_0x2aaf07[_0x0a9e('0xaf')]]);_0xc876d4=new Hangup(_0x2aaf07,_0xe89aaa);_0xc876d4[_0x0a9e('0xa5')]=0x12;_0xc876d4['statedesc']=_0x0a9e('0xe6');_0xc876d4[_0x0a9e('0xde')]=_0x0a9e('0xdf');this[_0x0a9e('0xca')](_0xc876d4,_0x0a9e('0xe7'),_0x0a9e('0xe8'));}if(_0x2aaf07[_0x0a9e('0x4d')]===_0x0a9e('0x7d')&&this[_0x0a9e('0x1f')][_0x2aaf07[_0x0a9e('0xaf')]]['dialAMDActive']&&_0xe89aaa[_0x0a9e('0xdc')]===_0x0a9e('0xe2')){delete this[_0x0a9e('0x26')][_0xe89aaa[_0x0a9e('0xd8')]];this[_0x0a9e('0xb0')](this[_0x0a9e('0x1f')][_0x2aaf07[_0x0a9e('0xaf')]]);_0xc876d4=new Hangup(_0x2aaf07,_0xe89aaa);_0xc876d4[_0x0a9e('0xa5')]=0x13;_0xc876d4['statedesc']=_0x0a9e('0xe3');_0xc876d4[_0x0a9e('0xde')]=_0x0a9e('0xdf');_0xc876d4['amd']=!![];this[_0x0a9e('0xca')](_0xc876d4,_0x0a9e('0xe9'),_0x0a9e('0xea'));}}};Dialer[_0x0a9e('0x19')][_0x0a9e('0x34')]=function(_0x1ba457){var _0x424f1b=this[_0x0a9e('0x26')][_0x1ba457[_0x0a9e('0xd8')]];var _0x451010=this;var _0x5a7dad;if(_0x424f1b&&_0x424f1b[_0x0a9e('0x4d')]===_0x0a9e('0x7d')){delete this[_0x0a9e('0x26')][_0x1ba457[_0x0a9e('0xd8')]];this[_0x0a9e('0xb0')](this[_0x0a9e('0x1f')][_0x424f1b['queue']]);this[_0x0a9e('0x1f')][_0x424f1b['queue']]['ivrAnswerCallsDay']+=0x1;_0x5a7dad=new Hangup(_0x424f1b,_0x1ba457);this['createHistory'](_0x5a7dad)[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0xeb')));this[_0x0a9e('0xc3')](_0x5a7dad)[_0x0a9e('0xac')](loggerCatch('[syncHangupIvr]'));}if(_0x424f1b&&_0x424f1b[_0x0a9e('0x4d')]!==_0x0a9e('0x7d')&&isNotNull(this[_0x0a9e('0x1e')][_0x424f1b[_0x0a9e('0xaf')]][_0x0a9e('0xec')])){delete this['uniqueId'][_0x1ba457['uniqueid']];this[_0x0a9e('0xb0')](this[_0x0a9e('0x1e')][_0x424f1b[_0x0a9e('0xaf')]]);this['voiceQueues'][_0x424f1b[_0x0a9e('0xaf')]][_0x0a9e('0x5d')]+=0x1;this[_0x0a9e('0x1e')][_0x424f1b['queue']][_0x0a9e('0x5c')]+=0x1;_0x5a7dad=new Hangup(_0x424f1b,_0x1ba457);_0x5a7dad[_0x0a9e('0xa5')]=0x10;_0x5a7dad[_0x0a9e('0xa6')]='AnswerAGI';_0x5a7dad[_0x0a9e('0xde')]=_0x0a9e('0xed');this[_0x0a9e('0xc5')](_0x5a7dad)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x5a7dad)[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0xee')));}if(_0x424f1b&&_0x424f1b[_0x0a9e('0x4d')]!==_0x0a9e('0x7d')&&!isNotNull(this['voiceQueues'][_0x424f1b[_0x0a9e('0xaf')]]['dialQueueProject'])){delete this[_0x0a9e('0x26')][_0x1ba457[_0x0a9e('0xd8')]];this[_0x0a9e('0xb0')](this['voiceQueues'][_0x424f1b[_0x0a9e('0xaf')]]);this[_0x0a9e('0x1e')][_0x424f1b[_0x0a9e('0xaf')]]['outboundUnknownCallsDay']+=0x1;_0x5a7dad=new Hangup(_0x424f1b,_0x1ba457);_0x5a7dad[_0x0a9e('0xa5')]=0xc;_0x5a7dad['statedesc']=_0x1ba457[_0x0a9e('0xef')];_0x5a7dad['membername']=_0x0a9e('0xf0');this['createHistory'](_0x5a7dad)[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0xeb')));this[_0x0a9e('0xc3')](_0x5a7dad)[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0xee')));}};Dialer[_0x0a9e('0x19')][_0x0a9e('0x31')]=function(_0x5acdc9){var _0x35ace3=this[_0x0a9e('0x26')][_0x5acdc9['uniqueid']];var _0xf4fb77=this;if(this[_0x0a9e('0x1e')][_0x5acdc9['queue']]){if(_0x35ace3&&_0x35ace3[_0x0a9e('0x4d')]!==_0x0a9e('0x7d')){delete this[_0x0a9e('0x26')][_0x5acdc9['uniqueid']];this[_0x0a9e('0x1e')][_0x5acdc9[_0x0a9e('0xaf')]][_0x0a9e('0x5d')]+=0x1;var _0x3f0d64=new AgentComplete(_0x35ace3,_0x5acdc9);if(_0x5acdc9[_0x0a9e('0xf1')]===_0x0a9e('0xf2')){_0x3f0d64[_0x0a9e('0xf3')]=this[_0x0a9e('0x1e')][_0x5acdc9[_0x0a9e('0xaf')]][_0x0a9e('0xf4')]&&this['voiceQueues'][_0x5acdc9[_0x0a9e('0xaf')]]['dialAgiAfterHangupAgent']?moment()[_0x0a9e('0x7a')](_0x0a9e('0xf5')):undefined;}this[_0x0a9e('0xc5')](_0x3f0d64)[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0xf6')));this[_0x0a9e('0xc3')](_0x3f0d64)['catch'](loggerCatch(_0x0a9e('0xf7')));}}};Dialer[_0x0a9e('0x19')][_0x0a9e('0x2a')]=function(_0x55a599){if(this[_0x0a9e('0x1e')][_0x55a599[_0x0a9e('0xaf')]]){if(this[_0x0a9e('0x26')][_0x55a599[_0x0a9e('0xd8')]]&&this[_0x0a9e('0x26')][_0x55a599[_0x0a9e('0xd8')]][_0x0a9e('0x4d')]!=='ivr'){this[_0x0a9e('0xb0')](this[_0x0a9e('0x1e')][_0x55a599[_0x0a9e('0xaf')]]);this[_0x0a9e('0x26')][_0x55a599[_0x0a9e('0xd8')]][_0x0a9e('0xf8')]=moment()[_0x0a9e('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0x0a9e('0xf9')]=function(_0x3f507c){this[_0x0a9e('0xc5')](_0x3f507c)[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0xf6')));this[_0x0a9e('0xc3')](_0x3f507c)[_0x0a9e('0xac')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x0a9e('0x19')][_0x0a9e('0x2d')]=function(_0x2d8e91){var _0x2675a5=this[_0x0a9e('0x26')][_0x2d8e91[_0x0a9e('0xd8')]];var _0x16be7e=this;if(this['voiceQueues'][_0x2d8e91[_0x0a9e('0xaf')]]){if(_0x2675a5&&_0x2675a5[_0x0a9e('0x4d')]!==_0x0a9e('0x7d')){delete this['uniqueId'][_0x2d8e91[_0x0a9e('0xd8')]];this[_0x0a9e('0xb0')](this[_0x0a9e('0x1e')][_0x2d8e91[_0x0a9e('0xaf')]]);_0x2675a5['droptime']=moment()[_0x0a9e('0x7a')](_0x0a9e('0xf5'));var _0x21d082=new QueueCallerAbandon(_0x2675a5,_0x2d8e91);if(getSeconds(_0x2675a5[_0x0a9e('0xfa')],_0x2675a5[_0x0a9e('0xfb')])>=_0x2675a5[_0x0a9e('0xfc')]){this[_0x0a9e('0x1e')][_0x2d8e91[_0x0a9e('0xaf')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x0a9e('0x1e')][_0x2d8e91[_0x0a9e('0xaf')]][_0x0a9e('0x63')]+=0x1;this[_0x0a9e('0x1e')][_0x2d8e91['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x21d082[_0x0a9e('0xa5')]=0xa;_0x21d082[_0x0a9e('0xa6')]=_0x0a9e('0xfd');_0x21d082['dropreason']=_0x0a9e('0xfe');_0x21d082[_0x0a9e('0xf3')]=this['voiceQueues'][_0x2d8e91[_0x0a9e('0xaf')]]['dialQueueProject2']?moment()[_0x0a9e('0x7a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x21d082['countdropretry']+=0x1;if(_0x21d082['countdropretry']>=this[_0x0a9e('0x1e')][_0x2d8e91[_0x0a9e('0xaf')]][_0x0a9e('0xff')]){this[_0x0a9e('0xf9')](_0x21d082);}else{this[_0x0a9e('0xbb')]({'active':![],'countdropretry':_0x21d082[_0x0a9e('0x100')],'scheduledat':moment()['add'](this[_0x0a9e('0x1e')][_0x2d8e91[_0x0a9e('0xaf')]][_0x0a9e('0x101')],_0x0a9e('0x102'))[_0x0a9e('0x7a')](_0x0a9e('0xf5')),'ContactId':_0x2675a5[_0x0a9e('0xcc')],'ListId':_0x2675a5['ListId'],'VoiceQueueId':_0x2675a5['VoiceQueueId']||undefined,'CampaignId':_0x2675a5[_0x0a9e('0xd0')]||undefined})['catch'](loggerCatch(_0x0a9e('0x103')));var _0x19e024=new History(_0x21d082);_0x19e024[_0x0a9e('0xa5')]=0xa;_0x19e024[_0x0a9e('0xa6')]=_0x0a9e('0xfd');_0x19e024[_0x0a9e('0xa7')]=moment()['format'](_0x0a9e('0xf5'));_0x19e024['endtime']=_0x19e024['starttime'];_0x19e024[_0x0a9e('0x104')]=_0x21d082['calleridname'];_0x19e024[_0x0a9e('0x105')]=_0x21d082['calleridnum'];console['log'](_0x0a9e('0x106'),_0x2d8e91);console['log'](_0x0a9e('0x107'),_0x21d082);console[_0x0a9e('0x108')](_0x0a9e('0x109'),_0x19e024);this['createHistory'](_0x19e024)[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0x10a')));}}else{this[_0x0a9e('0x1e')][_0x2d8e91['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x0a9e('0x1e')][_0x2d8e91[_0x0a9e('0xaf')]][_0x0a9e('0x62')]+=0x1;_0x21d082[_0x0a9e('0xa5')]=0xb;_0x21d082[_0x0a9e('0xa6')]=_0x0a9e('0x10b');_0x21d082[_0x0a9e('0x10c')]=_0x0a9e('0x10d');_0x21d082[_0x0a9e('0x10e')]+=0x1;if(_0x21d082[_0x0a9e('0x10e')]>=this['voiceQueues'][_0x2d8e91['queue']]['dialAbandonedMaxRetry']){this[_0x0a9e('0xf9')](_0x21d082);}else{this[_0x0a9e('0xbb')]({'active':![],'countabandonedretry':_0x21d082[_0x0a9e('0x10e')],'scheduledat':moment()[_0x0a9e('0x10f')](this[_0x0a9e('0x1e')][_0x2d8e91[_0x0a9e('0xaf')]][_0x0a9e('0x110')],_0x0a9e('0x102'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2675a5[_0x0a9e('0xcc')],'ListId':_0x2675a5[_0x0a9e('0xcd')],'VoiceQueueId':_0x2675a5['VoiceQueueId']||undefined,'CampaignId':_0x2675a5[_0x0a9e('0xd0')]||undefined})[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0x111')));var _0x19e024=new History(_0x21d082);_0x19e024[_0x0a9e('0xa5')]=0xb;_0x19e024[_0x0a9e('0xa6')]=_0x0a9e('0x10b');_0x19e024[_0x0a9e('0xa7')]=moment()[_0x0a9e('0x7a')](_0x0a9e('0xf5'));_0x19e024[_0x0a9e('0x112')]=_0x19e024[_0x0a9e('0xa7')];console['log'](_0x0a9e('0x113'),_0x19e024);this[_0x0a9e('0xc5')](_0x19e024)[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0x114')));}}}}};Dialer[_0x0a9e('0x19')][_0x0a9e('0x115')]=function(_0x292e67){if(this[_0x0a9e('0x24')][_0x292e67[_0x0a9e('0xd8')]]){this[_0x0a9e('0x24')][_0x292e67[_0x0a9e('0xd8')]][_0x0a9e('0x116')]=_0x292e67['channel'];}if(this['uniqueId'][_0x292e67[_0x0a9e('0xd8')]]){this[_0x0a9e('0x26')][_0x292e67[_0x0a9e('0xd8')]][_0x0a9e('0x116')]=_0x292e67[_0x0a9e('0x116')];}};Dialer[_0x0a9e('0x19')][_0x0a9e('0x38')]=function(_0x4f7907){if(strategy[this[_0x0a9e('0x1e')][this['actions'][_0x4f7907[_0x0a9e('0x117')]][_0x0a9e('0xaf')]][_0x0a9e('0x4e')]]===_0x0a9e('0x18')){if(this[_0x0a9e('0x24')][_0x4f7907[_0x0a9e('0x117')]]&&_[_0x0a9e('0xab')](this[_0x0a9e('0x24')][_0x4f7907[_0x0a9e('0x117')]][_0x0a9e('0x118')])&&_0x4f7907[_0x0a9e('0xd6')]==='1'&&_0x4f7907[_0x0a9e('0x119')]==='0'){if(this[_0x0a9e('0x20')][_0x4f7907[_0x0a9e('0x11a')]]){if(!this[_0x0a9e('0x20')][_0x4f7907[_0x0a9e('0x11a')]]['locked']){this['agents'][_0x4f7907[_0x0a9e('0x11a')]][_0x0a9e('0x118')]=!![];this['actions'][_0x4f7907['actionid']][_0x0a9e('0x118')]=!![];this[_0x0a9e('0x24')][_0x4f7907[_0x0a9e('0x117')]]['stateinterface']=_0x4f7907[_0x0a9e('0x11a')];}}}}else if((strategy[this['voiceQueues'][this[_0x0a9e('0x24')][_0x4f7907['actionid']][_0x0a9e('0xaf')]]['strategy']]||_0x0a9e('0x17'))===_0x0a9e('0x17')){if(this[_0x0a9e('0x24')][_0x4f7907['actionid']]){if(this[_0x0a9e('0x20')][_0x4f7907['stateinterface']]){this['actions'][_0x4f7907[_0x0a9e('0x117')]][_0x0a9e('0x11a')]=_0x4f7907[_0x0a9e('0x11a')];if(_[_0x0a9e('0xab')](this[_0x0a9e('0x29')][this[_0x0a9e('0x24')][_0x4f7907[_0x0a9e('0x117')]][_0x0a9e('0xaf')]])){this[_0x0a9e('0x29')][this[_0x0a9e('0x24')][_0x4f7907[_0x0a9e('0x117')]][_0x0a9e('0xaf')]]=[];}this[_0x0a9e('0x29')][this[_0x0a9e('0x24')][_0x4f7907[_0x0a9e('0x117')]][_0x0a9e('0xaf')]][_0x0a9e('0x11b')](_[_0x0a9e('0x11c')](_[_0x0a9e('0xcb')](this['actions'][_0x4f7907[_0x0a9e('0x117')]],[_0x0a9e('0x11d'),_0x0a9e('0x11a')]),{'status':_0x4f7907[_0x0a9e('0xd6')],'paused':_0x4f7907['paused']}));}}}};function unlockQueueStatus(_0x49c3be,_0x54658d){setTimeout(function(){if(_[_0x0a9e('0x3d')](_0x49c3be['queueStatusComplete'])){loggerBooked[_0x0a9e('0x91')](_0x0a9e('0x11e'),_0x54658d);}_0x49c3be[_0x0a9e('0x11f')]=!![];loggerBooked[_0x0a9e('0x80')](_0x0a9e('0x120'),_0x54658d,JSON[_0x0a9e('0x49')](_[_0x0a9e('0xcb')](_0x49c3be,[_0x0a9e('0x3f'),_0x0a9e('0x11f')])));},0x1f3);}Dialer[_0x0a9e('0x19')]['syncQueueStatusComplete']=function(_0x283c59){var _0x47a018=this;var _0x2509f3=_0x47a018['voiceQueues'][_0x47a018[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]][_0x0a9e('0xaf')]];if(strategy[this['voiceQueues'][this[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]]['queue']]['strategy']]===_0x0a9e('0x18')){if(this[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]]&&this['actions'][_0x283c59['actionid']]['stateinterface']){this[_0x0a9e('0x121')][_0x0a9e('0x122')](this[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]][_0x0a9e('0x11d')],this[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]][_0x0a9e('0x11a')])[_0x0a9e('0xac')](function(_0x18e38b){logger[_0x0a9e('0x91')](_0x0a9e('0x123'),util[_0x0a9e('0x92')](_0x18e38b,{'showHidden':![],'depth':null}));})[_0x0a9e('0x1c')](function(){_0x47a018[_0x0a9e('0xb0')](_0x47a018[_0x0a9e('0x1e')][_0x47a018[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]]['queue']]);_0x47a018[_0x0a9e('0x20')][_0x47a018[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]][_0x0a9e('0x11a')]][_0x0a9e('0x118')]=![];delete _0x47a018[_0x0a9e('0x24')][_0x283c59['actionid']];unlockQueueStatus(_0x2509f3);});}else{this[_0x0a9e('0xb0')](this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]][_0x0a9e('0xaf')]]);this[_0x0a9e('0xbb')]({'active':![],'ContactId':this[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]][_0x0a9e('0xcc')],'ListId':this['actions'][_0x283c59['actionid']][_0x0a9e('0xcd')],'VoiceQueueId':this[_0x0a9e('0x24')][_0x283c59['actionid']][_0x0a9e('0xcf')]||undefined,'CampaignId':this[_0x0a9e('0x24')][_0x283c59['actionid']][_0x0a9e('0xd0')]||undefined})['catch'](loggerCatch(_0x0a9e('0x124')));delete this[_0x0a9e('0x24')][_0x283c59['actionid']];unlockQueueStatus(_0x2509f3);}}else if((strategy[this[_0x0a9e('0x1e')][this[_0x0a9e('0x24')][_0x283c59['actionid']][_0x0a9e('0xaf')]][_0x0a9e('0x4e')]]||'rrmemory')===_0x0a9e('0x17')){var _0x237994;if(this[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]]&&!_[_0x0a9e('0x47')](this[_0x0a9e('0x29')][this['actions'][_0x283c59[_0x0a9e('0x117')]][_0x0a9e('0xaf')]])){if(this['queueBookedRR'][_0x47a018[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]][_0x0a9e('0xaf')]]){this[_0x0a9e('0x125')][_0x47a018[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]][_0x0a9e('0xaf')]]=this['queueBookedRR'][this['actions'][_0x283c59['actionid']]['queue']]?this['queueBookedRR'][this[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]]['queue']]:this['queueBooked'][this[_0x0a9e('0x24')][_0x283c59['actionid']][_0x0a9e('0xaf')]]?this[_0x0a9e('0x29')][this[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]][_0x0a9e('0xaf')]][_0x0a9e('0x126')]||0x0:0x0;}this['queueBooked'][this[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]]['queue']][_0x0a9e('0x126')]=this[_0x0a9e('0x125')][this[_0x0a9e('0x24')][_0x283c59[_0x0a9e('0x117')]][_0x0a9e('0xaf')]];for(var _0x2f1cc0=0x0;_0x2f1cc0=0x0?!![]:![];})[_0x0a9e('0xac')](myreject(_0x1ba7b2)));}}else{_0x45630b[_0x0a9e('0x11b')](ami['Action']({'action':'command','command':util[_0x0a9e('0x7a')](_0x0a9e('0x13e'),_0x1c738f,!_[_0x0a9e('0x3d')](config[_0x0a9e('0x140')][_0x57425c])?_0x57425c:'')})[_0x0a9e('0xb4')](function(_0x5ac14c){return _0x5ac14c[_0x0a9e('0x141')]['indexOf'](_0x0a9e('0x142'))>=0x0?!![]:![];})['catch'](myreject(_0x1ba7b2)));}BPromise[_0x0a9e('0x143')](_0x45630b)[_0x0a9e('0xb4')](function(_0x595a5e){var _0x1fe77c=_[_0x0a9e('0x144')](_0x595a5e);if(_0x1fe77c){return _0x121aa2(_0x1fe77c);}else{_0x45c980[_0x0a9e('0x3e')]=_0x465b51?_0x0a9e('0x145'):_0x0a9e('0x146');return _0x1ba7b2(msgResponse(_0x0a9e('0x147'),'Failure',_0x0a9e('0x148')+_0x465b51+'\x20'+_0x5d4935+_0x0a9e('0x149')+util[_0x0a9e('0x92')](_0x1c738f,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x57425c));}})[_0x0a9e('0xac')](function(_0x934f69){return _0x1ba7b2(msgResponse(_0x0a9e('0x135'),'Failure',JSON[_0x0a9e('0x49')](_0x934f69)));});});};Dialer[_0x0a9e('0x19')][_0x0a9e('0x14a')]=function(_0x2317e7){var _0x1d39bd=this;return function(){switch(_0x2317e7[_0x0a9e('0x58')]){case'progressive':freeVariablesPredictive(_0x2317e7);_0x1d39bd['handlePower'](_0x2317e7,0x1);break;case _0x0a9e('0x14b'):freeVariablesPredictive(_0x2317e7);_0x1d39bd[_0x0a9e('0x14c')](_0x2317e7,_0x2317e7['dialPowerLevel']);break;case _0x0a9e('0x8'):_0x1d39bd[_0x0a9e('0x8')](_0x2317e7);break;case _0x0a9e('0x7'):freeVariablesPredictive(_0x2317e7);_0x1d39bd[_0x0a9e('0x14c')](_0x2317e7,0x1);break;default:freeVariablesPredictive(_0x2317e7);logger[_0x0a9e('0x91')](_0x0a9e('0x14d'),_0x2317e7['name'],_0x0a9e('0x14e'));}};};Dialer[_0x0a9e('0x19')][_0x0a9e('0x14f')]=function(_0x4edb79){var _0x45c6ce=this;return function(){_0x45c6ce[_0x0a9e('0x150')](_0x4edb79);};};Dialer[_0x0a9e('0x19')][_0x0a9e('0x151')]=function(_0x5beea6){var _0x49bb4f=this;if(isNotPreview(_0x5beea6[_0x0a9e('0x58')])){if(isVoiceQueueOutbound(_0x5beea6[_0x0a9e('0x4d')])&&isActive(_0x5beea6[_0x0a9e('0x57')])){_0x5beea6['sendMessageOneNotActive']=!![];BPromise[_0x0a9e('0xb3')]()[_0x0a9e('0xb4')](checkIsLoggedIn(_0x5beea6,_0x5beea6[_0x0a9e('0x4f')]))[_0x0a9e('0xb4')](checkIsActive(_0x5beea6,_0x5beea6[_0x0a9e('0x57')]))[_0x0a9e('0xb4')](checkInterval(_0x5beea6))[_0x0a9e('0xb4')](_0x49bb4f[_0x0a9e('0x130')](_0x5beea6))['then'](_0x49bb4f['checkIfTime'](_0x5beea6[_0x0a9e('0x152')],_0x5beea6[_0x0a9e('0x153')],_0x5beea6['name'],_0x5beea6))[_0x0a9e('0xb4')](_0x49bb4f['checkIfTimeIntervals'](_0x5beea6[_0x0a9e('0x43')],_0x5beea6[_0x0a9e('0x153')],_0x5beea6['name'],_0x5beea6))[_0x0a9e('0xb4')](_0x49bb4f[_0x0a9e('0x14a')](_0x5beea6))['catch'](loggerCatchQueueSummary(_0x0a9e('0x154'),_0x5beea6));}else{notSendMessagesQueue(_0x5beea6);}}else{freeVariablesPredictive(_0x5beea6);}};Dialer[_0x0a9e('0x19')][_0x0a9e('0x12f')]=function(){var _0x17259c=this;var _0x434df7;for(var _0x45b8ed in this[_0x0a9e('0x1f')]){if(this['campaigns'][_0x0a9e('0xaa')](_0x45b8ed)){_0x434df7=this[_0x0a9e('0x1f')][_0x45b8ed];if(isCampaignIvr(_0x434df7[_0x0a9e('0x4d')])&&isActive(_0x434df7[_0x0a9e('0x79')])){_0x434df7[_0x0a9e('0x9e')]=!![];BPromise[_0x0a9e('0xb3')]()[_0x0a9e('0xb4')](checkIsActive(_0x434df7,_0x434df7['active']))['then'](checkInterval(_0x434df7))[_0x0a9e('0xb4')](_0x17259c[_0x0a9e('0x130')](_0x434df7))[_0x0a9e('0xb4')](_0x17259c['checkIfTime'](_0x434df7['dialGlobalInterval'],_0x434df7[_0x0a9e('0x153')],_0x434df7['name'],_0x434df7))[_0x0a9e('0xb4')](_0x17259c[_0x0a9e('0x136')](_0x434df7[_0x0a9e('0x43')],_0x434df7[_0x0a9e('0x153')],_0x434df7[_0x0a9e('0x3f')],_0x434df7))[_0x0a9e('0xb4')](_0x17259c[_0x0a9e('0x14f')](_0x434df7))[_0x0a9e('0xac')](loggerCatchQueueSummary(_0x0a9e('0x155'),_0x434df7));}else{notSendMessagesCampaign(_0x434df7);}}}};function getCallerIdRandom(_0x47e61e,_0x516859){var _0x399cf4,_0x54d34e,_0x2f4540;if(_0x516859<=0x0){_0x516859=0x1;}_0x399cf4=new RegExp(_0x0a9e('0x156')+_0x516859+'}$');_0x54d34e=Math[_0x0a9e('0x157')](0xa,_0x516859-0x1);_0x2f4540=Math[_0x0a9e('0x157')](0xa,_0x516859)-0x1;return util['format']('%s',_[_0x0a9e('0x158')](_0x47e61e,_0x399cf4,_[_0x0a9e('0x159')](_0x54d34e,_0x2f4540)));}function extractCalleridName(_0x2bc6a3){var _0x5174c5=_0x2bc6a3[_0x0a9e('0x15a')](/"(.*?)"/);return _0x5174c5?_0x5174c5[0x1]:_0x2bc6a3;}function extractCalleridNumber(_0xcdd954){var _0x1e30bc=_0xcdd954['match'](/<(.*?)>/);return _0x1e30bc?_0x1e30bc[0x1]:_0xcdd954;}Dialer[_0x0a9e('0x19')][_0x0a9e('0x15b')]=function(_0x459ab7,_0x6e8a19){var _0x69b4d6=this;var _0x1ab878=uuid['v4']();this['actions'][_0x1ab878]=new Action(_0x459ab7,_0x6e8a19,_0x1ab878);return new BPromise(function(_0x5613e3,_0x46146f){if(_[_0x0a9e('0x3d')](_0x459ab7)&&_0x0a9e('0x15c')!==typeof _0x459ab7){return _0x46146f(msgResponse('originate','Failure',_0x0a9e('0x15d')));}if(_[_0x0a9e('0x3d')](_0x6e8a19[_0x0a9e('0x15e')]['phone'])||_0x6e8a19['Contact'][_0x0a9e('0x15f')]===null){return _0x46146f(msgResponse(_0x0a9e('0x160'),_0x0a9e('0x139'),_0x0a9e('0x161')));}var _0x1bafdd={'XMD-CALLERID':_0x69b4d6['actions'][_0x1ab878][_0x0a9e('0x162')](),'XMD-AGI':_0x459ab7['dialQueueProject']?util[_0x0a9e('0x7a')](_0x0a9e('0x163'),ipAgi,_0x459ab7['dialQueueProject']):_0x0a9e('0x164'),'XMD-AGIAFTER':_0x459ab7['dialQueueProject2']?util[_0x0a9e('0x7a')](_0x0a9e('0x163'),ipAgi,_0x459ab7[_0x0a9e('0xf4')]):_0x0a9e('0x164'),'XMD-QUEUE':_0x459ab7[_0x0a9e('0x4d')]==='outbound'?util[_0x0a9e('0x7a')](_0x0a9e('0x165'),_0x459ab7[_0x0a9e('0x3f')],_0x459ab7['dialQueueOptions']||'',_0x459ab7[_0x0a9e('0x166')]?'c':'',_0x459ab7['dialQueueTimeout']||0x3):_0x0a9e('0x164'),'XMD-CONTACTID':_0x6e8a19[_0x0a9e('0xcc')],'XMD-CDRTYPE':_0x0a9e('0x6'),'CALLERID(all)':_0x69b4d6['actions'][_0x1ab878][_0x0a9e('0x162')](),'XMD-AMD':_0x459ab7[_0x0a9e('0xdb')]?_0x0a9e('0x167'):_0x0a9e('0x164'),'XMD-DESTINATION':_0x0a9e('0x168')};if(_0x459ab7[_0x0a9e('0xdb')]){_0x1bafdd['XMD-AMDINITIALSILENCE']=_0x459ab7[_0x0a9e('0x169')]||0x9c4;_0x1bafdd[_0x0a9e('0x16a')]=_0x459ab7[_0x0a9e('0x16b')]||0x5dc;_0x1bafdd[_0x0a9e('0x16c')]=_0x459ab7[_0x0a9e('0x16d')]||0x320;_0x1bafdd[_0x0a9e('0x16e')]=_0x459ab7[_0x0a9e('0x16f')]||0x1388;_0x1bafdd[_0x0a9e('0x170')]=_0x459ab7['dialAMDMinWordLength']||0x64;_0x1bafdd[_0x0a9e('0x171')]=_0x459ab7[_0x0a9e('0x172')]||0x32;_0x1bafdd[_0x0a9e('0x173')]=_0x459ab7[_0x0a9e('0x174')]||0x3;_0x1bafdd['XMD-AMDSILENCETHRESHOLD']=_0x459ab7[_0x0a9e('0x175')]||0x100;_0x1bafdd['XMD-AMDMAXIMUMWORDLENGTH']=_0x459ab7[_0x0a9e('0x176')]||0x1388;}if(_0x459ab7[_0x0a9e('0x4d')]===_0x0a9e('0x8d')){_0x1bafdd['XMD-VOICEQUEUEID']=_0x6e8a19[_0x0a9e('0xcf')];}else{_0x1bafdd[_0x0a9e('0x177')]=_0x6e8a19[_0x0a9e('0xd0')];}for(var _0x36c0f4 in _0x6e8a19['Contact']){if(_0x6e8a19[_0x0a9e('0x15e')][_0x0a9e('0xaa')](_0x36c0f4)){if(isNotNull(_0x6e8a19[_0x0a9e('0x15e')][_0x36c0f4])&&_0x36c0f4!=='id'&&_0x36c0f4!==_0x0a9e('0x178')&&_0x36c0f4!==_0x0a9e('0x179')&&_0x36c0f4!==_0x0a9e('0x17a')){_0x1bafdd[util[_0x0a9e('0x7a')]('%s%s',_0x0a9e('0x17b'),_[_0x0a9e('0x17c')](_0x36c0f4))]=_0x6e8a19[_0x0a9e('0x15e')][_0x36c0f4];}}}var _0xa42055=_0x69b4d6['isTrunkReachable'](_0x459ab7[_0x0a9e('0x78')])?getCallerId(_0x459ab7['Trunk'][_0x0a9e('0x17d')],_0x459ab7[_0x0a9e('0x59')],_0x459ab7[_0x0a9e('0x17e')]>0x0?getCallerIdRandom(_0x459ab7[_0x0a9e('0x17f')],_0x459ab7[_0x0a9e('0x17e')]):_0x459ab7[_0x0a9e('0x17f')]):getCallerId(_[_0x0a9e('0xab')](_0x459ab7['TrunkBackup'])?_0x459ab7[_0x0a9e('0x78')]['callerid']:_0x459ab7[_0x0a9e('0x131')][_0x0a9e('0x17d')],_0x459ab7['dialOriginateCallerIdName'],_0x459ab7[_0x0a9e('0x17e')]>0x0?getCallerIdRandom(_0x459ab7[_0x0a9e('0x17f')],_0x459ab7[_0x0a9e('0x17e')]):_0x459ab7[_0x0a9e('0x17f')]);if(_0xa42055){_0x1bafdd['XMD-ORIGINATECALLERIDNAME']=_0x69b4d6[_0x0a9e('0x24')][_0x1ab878][_0x0a9e('0x180')]=extractCalleridName(_0xa42055);_0x1bafdd['XMD-ORIGINATECALLERIDNUM']=_0x69b4d6[_0x0a9e('0x24')][_0x1ab878]['originatecalleridnum']=extractCalleridNumber(_0xa42055);}return ami['Action']({'actionid':_0x1ab878,'action':'originate','channel':_0x69b4d6[_0x0a9e('0xd4')](_0x459ab7[_0x0a9e('0x78')])?util['format'](_0x0a9e('0x181'),_0x459ab7[_0x0a9e('0x78')]['name'],isNotNull(_0x459ab7[_0x0a9e('0x5b')])?_0x459ab7[_0x0a9e('0x5b')][_0x0a9e('0x182')]()||'':'',_0x459ab7[_0x0a9e('0x183')]>0x0?_0x6e8a19[_0x0a9e('0x15e')][_0x0a9e('0x15f')][_0x0a9e('0x184')](_0x459ab7['dialCutDigit']):_0x6e8a19[_0x0a9e('0x15e')]['phone']):util[_0x0a9e('0x7a')](_0x0a9e('0x181'),_[_0x0a9e('0xab')](_0x459ab7[_0x0a9e('0x131')])?_0x459ab7[_0x0a9e('0x78')][_0x0a9e('0x3f')]:_0x459ab7['TrunkBackup'][_0x0a9e('0x3f')],isNotNull(_0x459ab7[_0x0a9e('0x5b')])?_0x459ab7[_0x0a9e('0x5b')]['trim']()||'':'',_0x459ab7[_0x0a9e('0x183')]>0x0?_0x6e8a19[_0x0a9e('0x15e')][_0x0a9e('0x15f')][_0x0a9e('0x184')](_0x459ab7[_0x0a9e('0x183')]):_0x6e8a19[_0x0a9e('0x15e')][_0x0a9e('0x15f')]),'callerid':_0xa42055,'Exten':_0x0a9e('0x168'),'Context':_0x0a9e('0x185'),'Priority':'1','variable':_0x1bafdd,'timeout':(_0x459ab7[_0x0a9e('0x5a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1ab878})[_0x0a9e('0xb4')](function(_0x19732c){return _0x5613e3(_0x19732c);})[_0x0a9e('0xac')](function(_0x130947){_0x459ab7[_0x0a9e('0x66')]+=0x1;var _0x2efc65=new History(_0x69b4d6['actions'][_0x1ab878]);logger[_0x0a9e('0x91')](util[_0x0a9e('0x7a')](_0x0a9e('0x186'),JSON['stringify'](_0x130947)));_0x2efc65[_0x0a9e('0xa5')]=0xe;_0x2efc65[_0x0a9e('0xa6')]=_0x0a9e('0x187');_0x2efc65[_0x0a9e('0xa7')]=moment()['format'](_0x0a9e('0xf5'));_0x2efc65[_0x0a9e('0x112')]=_0x2efc65[_0x0a9e('0xa7')];_0x69b4d6[_0x0a9e('0xc5')](_0x2efc65)['catch'](loggerCatch(_0x0a9e('0x188')));_0x69b4d6[_0x0a9e('0xc3')](_0x2efc65)[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0x188')))['finally'](function(){delete _0x69b4d6['actions'][_0x1ab878];return _0x46146f(msgResponse(_0x0a9e('0x160'),_0x0a9e('0x48'),_0x0a9e('0x189')));});});});};Dialer[_0x0a9e('0x19')][_0x0a9e('0x2f')]=function(_0x433b5d){var _0x15df71=this[_0x0a9e('0x24')][_0x433b5d[_0x0a9e('0x117')]];var _0x84117=this;if(_0x15df71){delete this[_0x0a9e('0x24')][_0x433b5d[_0x0a9e('0x117')]];_0x15df71[_0x0a9e('0xfb')]=moment()[_0x0a9e('0x7a')]('YYYY-MM-DD\x20HH:mm:ss');var _0x7f3b59=_0x15df71[_0x0a9e('0x4d')]===_0x0a9e('0x7d')?this['campaigns'][_0x15df71['queue']]:this[_0x0a9e('0x1e')][_0x15df71['getQueue']()];if(!this[_0x0a9e('0x18a')](_0x433b5d[_0x0a9e('0x18b')])){this[_0x0a9e('0xb0')](_0x7f3b59);return this[_0x0a9e('0x18c')](_0x15df71,_0x7f3b59,_0x433b5d)['then'](function(_0x59ce14){})[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0x18d')));}else{this[_0x0a9e('0x26')][_0x433b5d[_0x0a9e('0xd8')]]=_0x15df71;}}};Dialer['prototype'][_0x0a9e('0x18e')]=function(_0xc1811b,_0xa64f55,_0x25f5fa){var _0x193ef7=new History(_0xa64f55);if(_0x193ef7['countbusyretry']+_0x193ef7['countcongestionretry']+_0x193ef7[_0x0a9e('0x18f')]+_0x193ef7[_0x0a9e('0x190')]+_0x193ef7[_0x0a9e('0x100')]+_0x193ef7[_0x0a9e('0x10e')]+_0x193ef7[_0x0a9e('0x191')]+_0x193ef7[_0x0a9e('0x192')]>=_0x25f5fa[_0x0a9e('0x193')]-0x1){return!![];}switch(_0xc1811b){case 0x3:if(_0x193ef7['countnoanswerretry']>=_0x25f5fa[_0x0a9e('0x194')]-0x1){return!![];}else{this[_0x0a9e('0xbb')]({'active':![],'countnoanswerretry':_0x193ef7[_0x0a9e('0x18f')]+=0x1,'scheduledat':moment()['add'](_0x25f5fa['dialNoAnswerRetryFrequency'],'minutes')[_0x0a9e('0x7a')](_0x0a9e('0xf5')),'ContactId':_0x193ef7['ContactId'],'ListId':_0x193ef7[_0x0a9e('0xcd')],'VoiceQueueId':_0x193ef7[_0x0a9e('0xcf')]||undefined,'CampaignId':_0x193ef7[_0x0a9e('0xd0')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x193ef7[_0x0a9e('0x195')]>=_0x25f5fa[_0x0a9e('0x196')]-0x1){return!![];}else{this[_0x0a9e('0xbb')]({'active':![],'countbusyretry':_0x193ef7[_0x0a9e('0x195')]+=0x1,'scheduledat':moment()['add'](_0x25f5fa[_0x0a9e('0x197')],'minutes')['format'](_0x0a9e('0xf5')),'ContactId':_0x193ef7['ContactId'],'ListId':_0x193ef7[_0x0a9e('0xcd')],'VoiceQueueId':_0x193ef7[_0x0a9e('0xcf')]||undefined,'CampaignId':_0x193ef7[_0x0a9e('0xd0')]||undefined})['catch'](loggerCatch(_0x0a9e('0x198')));}break;case 0x8:if(_0x193ef7[_0x0a9e('0x199')]>=_0x25f5fa[_0x0a9e('0x19a')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countcongestionretry':_0x193ef7['countcongestionretry']+=0x1,'scheduledat':moment()[_0x0a9e('0x10f')](_0x25f5fa[_0x0a9e('0x19b')],_0x0a9e('0x102'))[_0x0a9e('0x7a')](_0x0a9e('0xf5')),'ContactId':_0x193ef7[_0x0a9e('0xcc')],'ListId':_0x193ef7['ListId'],'VoiceQueueId':_0x193ef7['VoiceQueueId']||undefined,'CampaignId':_0x193ef7[_0x0a9e('0xd0')]||undefined})[_0x0a9e('0xac')](loggerCatch('[rescheduleContact]\x20[Congestion]'));}break;case 0x0:if(_0x193ef7['countnosuchnumberretry']>=_0x25f5fa['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x193ef7['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x25f5fa[_0x0a9e('0x19c')],'minutes')[_0x0a9e('0x7a')](_0x0a9e('0xf5')),'ContactId':_0x193ef7[_0x0a9e('0xcc')],'ListId':_0x193ef7[_0x0a9e('0xcd')],'VoiceQueueId':_0x193ef7[_0x0a9e('0xcf')]||undefined,'CampaignId':_0x193ef7[_0x0a9e('0xd0')]||undefined})[_0x0a9e('0xac')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x193ef7[_0x0a9e('0x100')]>=_0x25f5fa[_0x0a9e('0xff')]-0x1){return!![];}else{this[_0x0a9e('0xbb')]({'active':![],'countdropretry':_0x193ef7[_0x0a9e('0x100')]+=0x1,'scheduledat':moment()[_0x0a9e('0x10f')](_0x25f5fa[_0x0a9e('0x101')],_0x0a9e('0x102'))[_0x0a9e('0x7a')](_0x0a9e('0xf5')),'ContactId':_0x193ef7[_0x0a9e('0xcc')],'ListId':_0x193ef7[_0x0a9e('0xcd')],'VoiceQueueId':_0x193ef7['VoiceQueueId']||undefined,'CampaignId':_0x193ef7[_0x0a9e('0xd0')]||undefined})[_0x0a9e('0xac')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x193ef7[_0x0a9e('0x10e')]>=_0x25f5fa['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0x0a9e('0xbb')]({'active':![],'countabandonedretry':_0x193ef7[_0x0a9e('0x10e')]+=0x1,'scheduledat':moment()['add'](_0x25f5fa['dialAbandonedRetryFrequency'],_0x0a9e('0x102'))['format'](_0x0a9e('0xf5')),'ContactId':_0x193ef7[_0x0a9e('0xcc')],'ListId':_0x193ef7[_0x0a9e('0xcd')],'VoiceQueueId':_0x193ef7[_0x0a9e('0xcf')]||undefined,'CampaignId':_0x193ef7[_0x0a9e('0xd0')]||undefined})['catch'](loggerCatch(_0x0a9e('0x111')));}break;case 0x13:if(_0x193ef7['countmachineretry']>=_0x25f5fa['dialMachineMaxRetry']-0x1){return!![];}else{this[_0x0a9e('0xbb')]({'active':![],'countmachineretry':_0x193ef7[_0x0a9e('0x191')]+=0x1,'scheduledat':moment()[_0x0a9e('0x10f')](_0x25f5fa[_0x0a9e('0x19d')],_0x0a9e('0x102'))['format'](_0x0a9e('0xf5')),'ContactId':_0x193ef7[_0x0a9e('0xcc')],'ListId':_0x193ef7[_0x0a9e('0xcd')],'VoiceQueueId':_0x193ef7[_0x0a9e('0xcf')]||undefined,'CampaignId':_0x193ef7['CampaignId']||undefined})[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0x19e')));}break;case 0x14:if(_0x193ef7['countagentrejectretry']>=_0x25f5fa[_0x0a9e('0x19f')]-0x1){return!![];}else{this[_0x0a9e('0xbb')]({'active':![],'countagentrejectretry':_0x193ef7[_0x0a9e('0x192')]+=0x1,'scheduledat':moment()[_0x0a9e('0x10f')](_0x25f5fa['dialAgentRejectRetryFrequency'],_0x0a9e('0x102'))[_0x0a9e('0x7a')](_0x0a9e('0xf5')),'ContactId':_0x193ef7[_0x0a9e('0xcc')],'ListId':_0x193ef7[_0x0a9e('0xcd')],'VoiceQueueId':_0x193ef7['VoiceQueueId']||undefined,'CampaignId':_0x193ef7[_0x0a9e('0xd0')]||undefined})[_0x0a9e('0xac')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0x0a9e('0x19')]['callProgressDetecting']=function(_0x151abc,_0x2f5bfc,_0x41354f){var _0x1f2eaa=this;var _0x9c7523=new History(_0x151abc);return new BPromise(function(_0x115092,_0x25de7c){if(_[_0x0a9e('0x3d')](_0x2f5bfc)&&_0x0a9e('0x15c')!==typeof _0x2f5bfc){return _0x25de7c(msgResponse(_0x0a9e('0x1a0'),_0x0a9e('0x139'),_0x0a9e('0x1a1')));}if(_[_0x0a9e('0x3d')](_0x41354f)&&_0x0a9e('0x15c')!==typeof _0x41354f){return _0x25de7c(msgResponse(_0x0a9e('0x1a0'),'Failure',_0x0a9e('0x1a2')));}switch(_0x41354f[_0x0a9e('0xf1')]){case'0':_0x2f5bfc[_0x0a9e('0x65')]+=0x1;_0x9c7523[_0x0a9e('0xa5')]=0x0;_0x9c7523[_0x0a9e('0xa6')]=_0x0a9e('0x1a3');_0x9c7523[_0x0a9e('0x190')]+=0x1;_0x9c7523[_0x0a9e('0x1a4')]+=0x1;_0x1f2eaa['createHistory'](_0x9c7523)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1f2eaa['checkRetriveMax'](0x0,_0x151abc,_0x2f5bfc)){if(_0x9c7523[_0x0a9e('0x195')]+_0x9c7523['countcongestionretry']+_0x9c7523['countnoanswerretry']+_0x9c7523['countnosuchnumberretry']+_0x9c7523[_0x0a9e('0x100')]+_0x9c7523[_0x0a9e('0x10e')]+_0x9c7523[_0x0a9e('0x191')]+_0x9c7523[_0x0a9e('0x192')]>=_0x2f5bfc['dialGlobalMaxRetry']){_0x1f2eaa['stateGlobal'](_0x9c7523,_0x115092,_0x25de7c,_0x0a9e('0x1a5'));}else{_0x1f2eaa[_0x0a9e('0x1a6')](_0x9c7523,_0x115092,_0x25de7c,_0x0a9e('0x1a5'));}}break;case'3':_0x2f5bfc[_0x0a9e('0x64')]+=0x1;_0x9c7523['state']=0x3;_0x9c7523[_0x0a9e('0xa6')]=_0x0a9e('0x1a7');_0x9c7523[_0x0a9e('0x18f')]+=0x1;_0x9c7523[_0x0a9e('0x1a4')]+=0x1;_0x1f2eaa[_0x0a9e('0xc5')](_0x9c7523)[_0x0a9e('0xac')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1f2eaa[_0x0a9e('0x18e')](0x3,_0x151abc,_0x2f5bfc)){if(_0x9c7523['countnoanswerretry']>=_0x2f5bfc['dialNoAnswerMaxRetry']){_0x1f2eaa[_0x0a9e('0x1a6')](_0x9c7523,_0x115092,_0x25de7c,'reason\x203\x20ringing\x20no\x20answer');}else{_0x1f2eaa[_0x0a9e('0x1a8')](_0x9c7523,_0x115092,_0x25de7c,_0x0a9e('0x1a9'));}}break;case'5':_0x2f5bfc[_0x0a9e('0x5f')]+=0x1;_0x9c7523[_0x0a9e('0xa5')]=0x5;_0x9c7523[_0x0a9e('0xa6')]=_0x0a9e('0x1aa');_0x9c7523[_0x0a9e('0x195')]+=0x1;_0x9c7523[_0x0a9e('0x1a4')]+=0x1;_0x1f2eaa[_0x0a9e('0xc5')](_0x9c7523)['catch'](loggerCatch(_0x0a9e('0x1ab')));if(_0x1f2eaa[_0x0a9e('0x18e')](0x5,_0x151abc,_0x2f5bfc)){if(_0x9c7523['countbusyretry']>=_0x2f5bfc[_0x0a9e('0x196')]){_0x1f2eaa[_0x0a9e('0x1a6')](_0x9c7523,_0x115092,_0x25de7c,_0x0a9e('0x1ac'));}else{_0x1f2eaa[_0x0a9e('0x1a8')](_0x9c7523,_0x115092,_0x25de7c,'reason\x205\x20busy');}}break;case'8':_0x2f5bfc[_0x0a9e('0x60')]+=0x1;_0x9c7523[_0x0a9e('0xa5')]=0x8;_0x9c7523[_0x0a9e('0xa6')]=_0x0a9e('0x1ad');_0x9c7523[_0x0a9e('0x199')]+=0x1;_0x9c7523['countglobal']+=0x1;_0x1f2eaa['createHistory'](_0x9c7523)[_0x0a9e('0xac')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x1f2eaa[_0x0a9e('0x18e')](0x8,_0x151abc,_0x2f5bfc)){if(_0x9c7523['countcongestionretry']>=_0x2f5bfc[_0x0a9e('0x19a')]){_0x1f2eaa['createStateFinal'](_0x9c7523,_0x115092,_0x25de7c,_0x0a9e('0x1ae'));}else{_0x1f2eaa['stateGlobal'](_0x9c7523,_0x115092,_0x25de7c,_0x0a9e('0x1ae'));}}break;case'11':_0x2f5bfc[_0x0a9e('0x1af')]+=0x1;_0x9c7523[_0x0a9e('0xa5')]=0xb;_0x9c7523['statedesc']='Abandoned';_0x9c7523[_0x0a9e('0x10e')]+=0x1;_0x9c7523['countglobal']+=0x1;_0x1f2eaa[_0x0a9e('0xc5')](_0x9c7523)['catch'](loggerCatch(_0x0a9e('0x114')));if(_0x1f2eaa['checkRetriveMax'](0xb,_0x151abc,_0x2f5bfc)){if(_0x9c7523[_0x0a9e('0x10e')]>=_0x2f5bfc[_0x0a9e('0x1b0')]){_0x1f2eaa['createStateFinal'](_0x9c7523,_0x115092,_0x25de7c,_0x0a9e('0x1b1'));}else{_0x1f2eaa[_0x0a9e('0x1a8')](_0x9c7523,_0x115092,_0x25de7c,_0x0a9e('0x1b1'));}}break;case'20':_0x2f5bfc[_0x0a9e('0x68')]+=0x1;_0x9c7523[_0x0a9e('0xa5')]=0x14;_0x9c7523[_0x0a9e('0xa6')]=_0x0a9e('0x1b2');_0x9c7523[_0x0a9e('0x192')]+=0x1;_0x9c7523[_0x0a9e('0x1a4')]+=0x1;_0x1f2eaa['createHistory'](_0x9c7523)[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0x1b3')));if(_0x1f2eaa[_0x0a9e('0x18e')](0x14,_0x151abc,_0x2f5bfc)){if(_0x9c7523[_0x0a9e('0x192')]>=_0x2f5bfc[_0x0a9e('0x19f')]){_0x1f2eaa['createStateFinal'](_0x9c7523,_0x115092,_0x25de7c,'reason\x2020\x20agentreject');}else{_0x1f2eaa[_0x0a9e('0x1a8')](_0x9c7523,_0x115092,_0x25de7c,'reason\x2020\x20agentreject');}}break;default:_0x2f5bfc[_0x0a9e('0x1b4')]+=0x1;_0x9c7523['state']=0xc;_0x9c7523[_0x0a9e('0xa6')]=_0x41354f[_0x0a9e('0xf1')];_0x1f2eaa[_0x0a9e('0xc5')](_0x9c7523)[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0x1b5')));if(_0x1f2eaa[_0x0a9e('0x18e')](_0x41354f[_0x0a9e('0xf1')],_0x151abc,_0x2f5bfc)){if(_0x9c7523['countbusyretry']+_0x9c7523['countcongestionretry']+_0x9c7523[_0x0a9e('0x18f')]+_0x9c7523[_0x0a9e('0x190')]+_0x9c7523['countdropretry']+_0x9c7523[_0x0a9e('0x10e')]+_0x9c7523[_0x0a9e('0x191')]+_0x9c7523[_0x0a9e('0x192')]>=_0x2f5bfc['dialGlobalMaxRetry']){_0x1f2eaa['stateGlobal'](_0x9c7523,_0x115092,_0x25de7c,_0x41354f['reason']);}else{_0x1f2eaa[_0x0a9e('0x1a6')](_0x9c7523,_0x115092,_0x25de7c,_0x41354f[_0x0a9e('0xf1')]);}}}});};Dialer[_0x0a9e('0x19')][_0x0a9e('0x1a8')]=function(_0x4ab36f,_0x2fec22,_0x5d0eb5,_0x103402){var _0x547a2a=new Final(_0x4ab36f);_0x547a2a[_0x0a9e('0xa5')]=0xf;_0x547a2a['statedesc']='Global';this[_0x0a9e('0x1a6')](_0x547a2a,_0x2fec22,_0x5d0eb5,_0x103402);};Dialer[_0x0a9e('0x19')]['createStateFinal']=function(_0x5dbf0b,_0x31114d,_0x5dacb3,_0x1352c){this['moveContactManagedDialer'](_0x5dbf0b)[_0x0a9e('0xb4')](function(_0xb5209d){return _0x31114d(msgResponse(_0x0a9e('0x1a0'),'Success',_0x1352c));})['catch'](function(_0x1754c8){return _0x5dacb3(msgResponse(_0x0a9e('0x1b6'),_0x0a9e('0x139'),_0x0a9e('0x1b7')));});};Dialer['prototype'][_0x0a9e('0x8')]=function(_0x136d28){var _0x539ad9=this;var _0x360306=_0x136d28[_0x0a9e('0x1b8')]/0x64;var _0x11ba87=_0x136d28['outboundDropCallsDayTimeout']/(_0x136d28[_0x0a9e('0x63')]+_0x136d28[_0x0a9e('0x5d')]);var _0xb1fd37=Math[_0x0a9e('0x1b9')](_0x136d28[_0x0a9e('0x72')]*(_0x136d28[_0x0a9e('0x1ba')]/0x64));var _0x7412c=Math[_0x0a9e('0x1b9')](_0x136d28[_0x0a9e('0x72')]*(_0x136d28[_0x0a9e('0x1bb')]/0x64));var _0x3f5891=_0x136d28[_0x0a9e('0x9f')]+_0x136d28[_0x0a9e('0x53')];var _0x34ff77=Math[_0x0a9e('0x1bc')](_0x136d28[_0x0a9e('0x74')]*_0x136d28[_0x0a9e('0x76')]*_0x136d28[_0x0a9e('0x6f')]*_0x136d28[_0x0a9e('0x70')]);if(_[_0x0a9e('0x3d')](_0x136d28[_0x0a9e('0x28')])){if(!_[_0x0a9e('0x3d')](_0x136d28['startPredictive'])){_0x136d28[_0x0a9e('0x27')]=undefined;loggerPredictive[_0x0a9e('0x91')](_0x0a9e('0x1bd'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x0a9e('0x3d')](_0x136d28[_0x0a9e('0x8b')])){loggerPredictive[_0x0a9e('0x91')](_0x0a9e('0x1bd'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x136d28[_0x0a9e('0x8b')]);_0x136d28[_0x0a9e('0x8b')]=undefined;}_0x136d28['startProgressive']=moment()[_0x0a9e('0x7a')](_0x0a9e('0xf5'));loggerPredictive[_0x0a9e('0x80')](_0x136d28['name'],'collection\x20data\x20in\x20progressive\x20at',_0x136d28[_0x0a9e('0x28')]);this[_0x0a9e('0x14c')](_0x136d28,0x1);}else if(ifInterval(_0x136d28[_0x0a9e('0x1be')],_0x136d28['startProgressive'])){this['handlePower'](_0x136d28,0x1);loggerPredictiveCalls[_0x0a9e('0x80')](_0x0a9e('0x1bf'),_0x136d28[_0x0a9e('0x28')],_0x136d28[_0x0a9e('0x3f')]);_0x136d28['erlangCalls']=0x0;_0x136d28[_0x0a9e('0x6e')]=0x0;}else if(_0x360306<_0x11ba87&&_0x136d28['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x136d28);loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x1c0'),_0x0a9e('0x1c1'),_0x11ba87,'startProgressive',_0x136d28[_0x0a9e('0x3f')]);}else if(_0x34ff77<_0x136d28[_0x0a9e('0x6e')]&&_0x136d28[_0x0a9e('0x1c2')]==='dropRate'){freeVariablesPredictive(_0x136d28);loggerPredictive['info'](_0x0a9e('0x1c3'),_0x0a9e('0x1c4'),_0x34ff77,_0x0a9e('0x1c5'),_0x136d28['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x136d28[_0x0a9e('0x3f')]);}else if(!ifInterval(_0x136d28['dialPredictiveInterval'],_0x136d28['startProgressive'])&&_['isUndefined'](_0x136d28[_0x0a9e('0x27')])&&!_[_0x0a9e('0x3d')](_0x136d28[_0x0a9e('0x28')])){_0x136d28['startPredictive']=moment()[_0x0a9e('0x7a')](_0x0a9e('0xf5'));loggerPredictive['info'](_0x136d28[_0x0a9e('0x3f')],'started\x20in\x20predictive\x20at',_0x136d28[_0x0a9e('0x27')]);this[_0x0a9e('0xb8')](_0x136d28['dialPredictiveInterval'])[_0x0a9e('0xb4')](this[_0x0a9e('0x1c6')](_0x136d28))[_0x0a9e('0xb4')](mergeDataErlangB(_0x136d28))['then'](this[_0x0a9e('0x1c7')](_0x136d28))[_0x0a9e('0xac')](loggerCatchPredictive(_0x0a9e('0x1c8'),_0x136d28));}else if(!ifInterval(_0x136d28['dialPredictiveInterval'],_0x136d28[_0x0a9e('0x27')])){_0x136d28[_0x0a9e('0x6e')]=0x0;_0x136d28[_0x0a9e('0x27')]=moment()['format'](_0x0a9e('0xf5'));loggerPredictive[_0x0a9e('0x80')](_0x136d28[_0x0a9e('0x3f')],_0x0a9e('0x1c9'),_0x136d28[_0x0a9e('0x27')]);clearInterval(_0x136d28[_0x0a9e('0x8b')]);_0x136d28[_0x0a9e('0x8b')]=undefined;this[_0x0a9e('0xb8')](_0x136d28['dialPredictiveInterval'])[_0x0a9e('0xb4')](this[_0x0a9e('0x1c6')](_0x136d28))[_0x0a9e('0xb4')](mergeDataErlangB(_0x136d28))[_0x0a9e('0xb4')](this['startMethodPredictive'](_0x136d28))[_0x0a9e('0xac')](loggerCatchPredictive(_0x0a9e('0x1ca'),_0x136d28));}else if(_0x136d28['predictiveIntervalAvailable']&&_0x3f5891<_0x136d28[_0x0a9e('0x72')]-_0x7412c){freeVariablesPredictive(_0x136d28);loggerPredictive[_0x0a9e('0x80')](_0x136d28[_0x0a9e('0x3f')],_0x0a9e('0x1cb'),_0x3f5891,_0x0a9e('0x1cc'),_0x136d28[_0x0a9e('0x72')],'-',_0x7412c,'=',_0x136d28[_0x0a9e('0x72')]-_0x7412c,')');}else if(_0x136d28[_0x0a9e('0x72')]&&_0x3f5891>_0x136d28['predictiveIntervalAvailable']+_0xb1fd37){freeVariablesPredictive(_0x136d28);loggerPredictive[_0x0a9e('0x80')](_0x136d28['name'],_0x0a9e('0x1cb'),_0x3f5891,_0x0a9e('0x1cd'),_0x136d28['predictiveIntervalAvailable'],'+',_0xb1fd37,'=',_0x136d28[_0x0a9e('0x72')]+_0xb1fd37,')');}};Dialer[_0x0a9e('0x19')]['getDataPredictive']=function(_0x1b4341){var _0x3eff33=this;return function(_0x5b6054){return new BPromise(function(_0xe89e7c,_0x4e8b2a){_['merge'](_0x1b4341,_0x5b6054[0x0]);if(checkGetDataPredictive(_0x5b6054[0x0])){var _0x57d6ff=_0x1b4341[_0x0a9e('0x72')]=_0x1b4341[_0x0a9e('0x53')]+_0x1b4341['available'];var _0x41a8f0=_0x1b4341[_0x0a9e('0x1be')]*0x3c;var _0x5d26c8=_0x5b6054[0x0][_0x0a9e('0x6a')]+_0x5b6054[0x0][_0x0a9e('0x69')];var _0x4bdcd3=(_0x5b6054[0x0][_0x0a9e('0x83')]+_0x5b6054[0x0][_0x0a9e('0x6c')]+_0x5b6054[0x0][_0x0a9e('0x6b')])/_0x5b6054[0x0]['predictiveIntervalTotalCalls'];_0x1b4341[_0x0a9e('0x6f')]=_0x4bdcd3>0x0?_0x4bdcd3:0x1;switch(_0x1b4341[_0x0a9e('0x1c2')]){case _0x0a9e('0x1ce'):var _0x956255=_0x1b4341[_0x0a9e('0x1b8')]/0x64;return _0x3eff33['abandonmentRate'](_0x57d6ff,_0x41a8f0,_0x5d26c8,_0x4bdcd3,_0x956255)[_0x0a9e('0xb4')](function(_0x495ac6){return _0xe89e7c(_0x495ac6);});case _0x0a9e('0x1cf'):var _0x43e45a=_0x1b4341[_0x0a9e('0x1b8')]/0x64;return _0x3eff33[_0x0a9e('0x1d0')](_0x57d6ff,_0x41a8f0,_0x5d26c8,_0x4bdcd3,_0x43e45a)[_0x0a9e('0xb4')](function(_0x25cae1){return _0xe89e7c(_0x25cae1);});default:return _0x4e8b2a(msgResponse(_0x0a9e('0x1d1'),_0x0a9e('0x139'),_0x0a9e('0x1d2')));}}else{return _0x4e8b2a(msgResponse('[getDataPredictive]',_0x0a9e('0x139'),_0x0a9e('0x1d3')));}});};};Dialer[_0x0a9e('0x19')]['getDataPredictiveOld']=function(_0x48782d){var _0x5c2e1b=this;return function(_0x4b99fb){return new BPromise(function(_0x49e349,_0x347d13){_['merge'](_0x48782d,_0x4b99fb[0x0]);if(checkGetDataPredictive(_0x4b99fb[0x0])){loggerPredictive[_0x0a9e('0x80')](JSON[_0x0a9e('0x49')](_0x4b99fb[0x0]));if(_0x48782d[_0x0a9e('0x1c2')]===_0x0a9e('0x1ce')){return _0x5c2e1b[_0x0a9e('0xc1')](_0x48782d['id'])[_0x0a9e('0xb4')](function(_0x5dd837){var _0x20a1c0=_0x48782d['loggedIn']-_0x5dd837[0x0]['outboundQueuePauses'];var _0x139b02=_0x48782d['dialPredictiveInterval']*0x3c;var _0x2885c8=_0x4b99fb[0x0]['predictiveIntervalAvgTalktime']+_0x4b99fb[0x0][_0x0a9e('0x69')];var _0x638297=(_0x4b99fb[0x0][_0x0a9e('0x83')]+_0x4b99fb[0x0][_0x0a9e('0x6c')]+_0x4b99fb[0x0][_0x0a9e('0x6b')])/_0x4b99fb[0x0]['predictiveIntervalTotalCalls'];var _0x1ee915=_0x48782d[_0x0a9e('0x1b8')]/0x64;_0x48782d['predictiveIntervalPauses']=_0x5dd837[0x0][_0x0a9e('0x1d4')]||0x0;_0x48782d[_0x0a9e('0x6f')]=_0x638297>0x0?_0x638297:0x1;return _0x5c2e1b['abandonmentRate'](_0x20a1c0,_0x139b02,_0x2885c8,_0x638297,_0x1ee915);})[_0x0a9e('0xb4')](function(_0x26320a){return _0x49e349(_0x26320a);})[_0x0a9e('0xac')](function(_0x3f8171){return _0x347d13(msgResponse(_0x0a9e('0x1d5'),_0x0a9e('0x139'),JSON[_0x0a9e('0x49')](_0x3f8171)));});}if(_0x48782d['dialPredictiveOptimization']===_0x0a9e('0x1cf')){return _0x5c2e1b[_0x0a9e('0xc1')](_0x48782d['id'])[_0x0a9e('0xb4')](function(_0x16a8c4){var _0x587f68=_0x48782d[_0x0a9e('0x4f')]-_0x16a8c4[0x0][_0x0a9e('0x1d4')];var _0x189e15=_0x48782d[_0x0a9e('0x1be')]*0x3c;var _0x32c53e=_0x4b99fb[0x0][_0x0a9e('0x6a')]+_0x4b99fb[0x0][_0x0a9e('0x69')];var _0x8095d6=(_0x4b99fb[0x0]['predictiveIntervalAnsweredCalls']+_0x4b99fb[0x0][_0x0a9e('0x6c')]+_0x4b99fb[0x0][_0x0a9e('0x6b')])/_0x4b99fb[0x0][_0x0a9e('0x73')];var _0x4a80a0=_0x48782d[_0x0a9e('0x1b8')]/0x64;_0x48782d[_0x0a9e('0x71')]=_0x16a8c4[0x0][_0x0a9e('0x1d4')]||0x0;_0x48782d[_0x0a9e('0x6f')]=_0x8095d6>0x0?_0x8095d6:0x1;return _0x5c2e1b[_0x0a9e('0x1d0')](_0x587f68,_0x189e15,_0x32c53e,_0x8095d6,_0x4a80a0);})[_0x0a9e('0xb4')](function(_0x13f18){return _0x49e349(_0x13f18);})[_0x0a9e('0xac')](function(_0x16b449){return _0x347d13(msgResponse(_0x0a9e('0x1d5'),'Failure',JSON[_0x0a9e('0x49')](_0x16b449)));});}}else{return _0x347d13(msgResponse(_0x0a9e('0x1d1'),_0x0a9e('0x139'),'check\x20failure'));}});};};Dialer['prototype'][_0x0a9e('0x1c7')]=function(_0x37165a){var _0x395034=this;return function(){var _0x73014f=0x0;var _0x2cbfa3=Math[_0x0a9e('0x1bc')](_0x37165a[_0x0a9e('0x75')]*0x3e8);if(_0x2cbfa3>0x0){_0x2cbfa3=_0x2cbfa3<0x64?0x64:_0x2cbfa3;loggerPredictive[_0x0a9e('0x80')](_0x37165a[_0x0a9e('0x3f')],'one\x20call\x20every:',_0x2cbfa3,_0x0a9e('0x1d6'));_0x37165a[_0x0a9e('0x8b')]=setInterval(function(){_0x395034['handlePredictive'](_0x37165a);loggerPredictiveCalls[_0x0a9e('0x80')](_0x0a9e('0x1d7'),_0x73014f+=0x1);},_0x2cbfa3);}else{loggerPredictive['info'](_0x37165a['name'],_0x0a9e('0x1d8'));}};};Dialer[_0x0a9e('0x19')][_0x0a9e('0x1d9')]=function(_0x31f9fe,_0x33d28f){var _0x548204=this;return function(_0x468a11){if(_['isEmpty'](_0x468a11)){if(_['isNil'](_0x33d28f['UserId'])||!_0x33d28f[_0x0a9e('0x1da')]){if(_0x31f9fe['dialMethod']==='booked'){_0x31f9fe['queueStatusComplete']=_[_0x0a9e('0x3d')](_0x31f9fe[_0x0a9e('0x11f')])?!![]:_0x31f9fe[_0x0a9e('0x11f')];var _0x45520d=uuid['v4']();_0x548204['actions'][_0x45520d]=new Action(_0x31f9fe,_0x33d28f,_0x45520d);loggerBooked[_0x0a9e('0x80')]('[booked][checkContactBlack]',_0x45520d,'queueStatusComplete:\x20',JSON[_0x0a9e('0x49')](_0x31f9fe[_0x0a9e('0x11f')]),_0x0a9e('0x1db'),_0x31f9fe['name']);if(_0x31f9fe['queueStatusComplete']){_0x31f9fe['queueStatusComplete']=![];_0x548204[_0x0a9e('0x29')][_0x548204[_0x0a9e('0x24')][_0x45520d][_0x0a9e('0xaf')]]=[];ami[_0x0a9e('0x13c')]({'actionid':_0x45520d,'action':_0x0a9e('0x1dc'),'queue':_0x31f9fe['name']})[_0x0a9e('0xac')](function(_0x1036d4){_0x548204[_0x0a9e('0xb0')](_0x31f9fe);_0x548204[_0x0a9e('0xbb')]({'active':![],'ContactId':_0x548204[_0x0a9e('0x24')][_0x45520d][_0x0a9e('0xcc')],'ListId':_0x548204['actions'][_0x45520d][_0x0a9e('0xcd')],'VoiceQueueId':_0x548204[_0x0a9e('0x24')][_0x45520d][_0x0a9e('0xcf')]||undefined,'CampaignId':_0x548204[_0x0a9e('0x24')][_0x45520d][_0x0a9e('0xd0')]||undefined})[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0x1dd')));delete _0x548204[_0x0a9e('0x24')][_0x45520d];});}else{loggerBooked[_0x0a9e('0x80')](_0x0a9e('0x1de'),JSON[_0x0a9e('0x49')](_0x31f9fe[_0x0a9e('0x11f')]),_0x0a9e('0x1db'),_0x31f9fe[_0x0a9e('0x3f')]);_0x548204[_0x0a9e('0xb0')](_0x31f9fe);_0x548204[_0x0a9e('0xbb')]({'active':![],'ContactId':_0x548204[_0x0a9e('0x24')][_0x45520d][_0x0a9e('0xcc')],'ListId':_0x548204['actions'][_0x45520d][_0x0a9e('0xcd')],'VoiceQueueId':_0x548204[_0x0a9e('0x24')][_0x45520d]['VoiceQueueId']||undefined,'CampaignId':_0x548204['actions'][_0x45520d]['CampaignId']||undefined})[_0x0a9e('0xac')](loggerCatch(_0x0a9e('0x1dd')));delete _0x548204['actions'][_0x45520d];}}else{return _0x548204[_0x0a9e('0x15b')](_0x31f9fe,_0x33d28f);}}else{if(getDiff(_0x33d28f[_0x0a9e('0x1df')])<_0x31f9fe['dialRecallMeTimeout']*0x3c){if(_0x33d28f[_0x0a9e('0x1e0')]&&!_0x33d28f['Agent'][_0x0a9e('0x1e1')]){_0x548204['preview'][_0x0a9e('0x122')](_0x33d28f['id'])[_0x0a9e('0x1c')](function(){_0x548204[_0x0a9e('0xb0')](_0x31f9fe);});}else{_0x548204[_0x0a9e('0xbd')]({'active':![]},_0x33d28f['id'],0x1)['finally'](function(){console[_0x0a9e('0x108')](_0x0a9e('0x1e2'));_0x548204[_0x0a9e('0xb0')](_0x31f9fe);});}}else{_0x31f9fe['outboundReCallsDay']+=0x1;_0x548204['updateOriginated'](_0x31f9fe);if(_0x31f9fe['dialRecallInQueue']){_0x548204['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x33d28f[_0x0a9e('0xcc')],'ListId':_0x33d28f[_0x0a9e('0xcd')],'VoiceQueueId':_0x33d28f[_0x0a9e('0xcf')]||undefined,'CampaignId':_0x33d28f[_0x0a9e('0xd0')]||undefined})[_0x0a9e('0xac')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x548204[_0x0a9e('0xc5')](createObjHistory(_0x31f9fe,_0x33d28f,_0x0a9e('0x1e3'),0x17,_0x0a9e('0x1e4')))[_0x0a9e('0xac')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x548204[_0x0a9e('0xca')](createObjHistory(_0x31f9fe,_0x33d28f,_0x0a9e('0x1e5'),0x16,_0x0a9e('0x1e6')),_0x0a9e('0x1e7'),_0x0a9e('0x1e8'));}}}}else{_0x31f9fe['outboundBlacklistCallsDay']+=0x1;_0x548204[_0x0a9e('0xca')](createObjHistory(_0x31f9fe,_0x33d28f,_0x0a9e('0x1e9'),0xd,_0x0a9e('0x1ea')),'[Originate][historyBlacklist]',_0x0a9e('0x1eb'));throw'inBlackList';}};};Dialer[_0x0a9e('0x19')][_0x0a9e('0x150')]=function(_0x126fa7){var _0xda737b=this;var _0x415fce=[];var _0x59f11d=_0x126fa7[_0x0a9e('0x1ec')]-_0x126fa7[_0x0a9e('0x95')]-_0x126fa7[_0x0a9e('0x1ed')];emitCampaignSummary(_0x126fa7);if(_0x59f11d>0x0){if(_0x59f11d>this[_0x0a9e('0x22')]){_0x59f11d=this[_0x0a9e('0x22')];}_0x126fa7['temp']+=_0x59f11d;this[_0x0a9e('0xc0')](_0x126fa7['id'],_0x59f11d,_0x126fa7[_0x0a9e('0x1ee')])[_0x0a9e('0xb4')](function(_0x5bba8b){_0x126fa7[_0x0a9e('0x1ed')]-=_0x59f11d;_0x126fa7['temp']=_0x126fa7['temp']>0x0?_0x126fa7[_0x0a9e('0x1ed')]:0x0;if(!checkContactEmpty(_0x5bba8b)){_0x126fa7['message']=_0x0a9e('0x9c');logger[_0x0a9e('0x80')](_0x0a9e('0x1ef')+_0x126fa7['name']);}else{_0x126fa7[_0x0a9e('0x95')]+=_0x5bba8b[_0x0a9e('0x94')];_0x126fa7[_0x0a9e('0x3e')]=_0x0a9e('0x1f0');for(var _0x3bd4da=0x0;_0x3bd4da<_0x5bba8b[_0x0a9e('0x94')];_0x3bd4da+=0x1){_0x126fa7[_0x0a9e('0x1f1')]+=0x1;if(_[_0x0a9e('0xab')](_0x5bba8b[_0x3bd4da])||_['isNil'](_0x5bba8b[_0x3bd4da][_0x0a9e('0x15e')])||_[_0x0a9e('0xab')](_0x5bba8b[_0x3bd4da][_0x0a9e('0x15e')][_0x0a9e('0x15f')])){_0xda737b[_0x0a9e('0xc9')]('[actionOriginate]\x20',_0x126fa7,_0x5bba8b[_0x3bd4da]);}else{_0xda737b['checkIsBlackListIvr'](_[_0x0a9e('0xcb')](_0x5bba8b[_0x3bd4da],['CampaignId',_0x0a9e('0x1f2')]))[_0x0a9e('0xb4')](_0xda737b['checkContactBlack'](_0x126fa7,_0x5bba8b[_0x3bd4da]))[_0x0a9e('0xac')](_0xda737b[_0x0a9e('0xc8')](_0x0a9e('0x1f3'),_0x126fa7));}}}})['catch'](loggerGetContactDialer(_0x0a9e('0x1f4'),_0x126fa7,_0x59f11d));}};Dialer[_0x0a9e('0x19')][_0x0a9e('0x14c')]=function(_0x14cf4c,_0x1b2cf5){var _0x1d7537=this;var _0x9ecf57=[];var _0x305a4b=_0x1b2cf5>=0x1?_0x1b2cf5:0x1;var _0x5695b6=[];if(_0x14cf4c[_0x0a9e('0x58')]===_0x0a9e('0x7')){_0x305a4b=0x1;}var _0x459efc=Math[_0x0a9e('0x1bc')](_0x14cf4c[_0x0a9e('0x9f')]*_0x305a4b)-_0x14cf4c['originated']-_0x14cf4c[_0x0a9e('0x1ed')];emitVoiceQueueSummary(_0x14cf4c);if(_0x14cf4c['dialLimitQueue']>0x0){var _0x36ff91=_0x14cf4c[_0x0a9e('0x1f5')]-_0x14cf4c[_0x0a9e('0x95')]-_0x14cf4c['talking']-_0x14cf4c[_0x0a9e('0x1ed')]-_0x14cf4c['pTalking'];if(_0x459efc>_0x36ff91){_0x459efc=_0x36ff91;}}if(_0x459efc>0x0){if(_0x14cf4c[_0x0a9e('0x58')]===_0x0a9e('0x7')){_0x459efc=0x1;}if(_0x459efc>this[_0x0a9e('0x22')]){_0x459efc=this[_0x0a9e('0x22')];}_0x14cf4c['temp']+=_0x459efc;for(var _0x323936 in this['agents']){if(this[_0x0a9e('0x20')][_0x0a9e('0xaa')](_0x323936)){if(this['agents'][_0x323936][_0x0a9e('0xa5')]===_0x0a9e('0x1f6')&&this[_0x0a9e('0x20')][_0x323936]['status']===_0x0a9e('0x1f7')){_0x9ecf57['push'](this[_0x0a9e('0x20')][_0x323936]['id']);}}}this[_0x0a9e('0xbe')](_0x14cf4c['id'],_0x9ecf57,_0x459efc,_0x14cf4c['dialOrderByScheduledAt'])['then'](function(_0x4b3f95){_0x14cf4c['temp']-=_0x459efc;_0x14cf4c[_0x0a9e('0x1ed')]=_0x14cf4c[_0x0a9e('0x1ed')]>0x0?_0x14cf4c[_0x0a9e('0x1ed')]:0x0;if(!checkContactEmpty(_0x4b3f95)){_0x1d7537[_0x0a9e('0xb2')](_0x14cf4c)['then'](sendMessageReschedule(_0x14cf4c))[_0x0a9e('0xac')](loggerCatch('[countReScheduled]\x20'));}else{_0x14cf4c[_0x0a9e('0x95')]+=_0x4b3f95[_0x0a9e('0x94')];_0x14cf4c['message']=_0x14cf4c[_0x0a9e('0x58')]===_0x0a9e('0x7')?_0x0a9e('0x167'):_0x0a9e('0x1f0');for(var _0x37c272=0x0;_0x37c272<_0x4b3f95[_0x0a9e('0x94')];_0x37c272+=0x1){if(_[_0x0a9e('0xab')](_0x4b3f95[_0x37c272])||_['isNil'](_0x4b3f95[_0x37c272][_0x0a9e('0x15e')])||_[_0x0a9e('0xab')](_0x4b3f95[_0x37c272][_0x0a9e('0x15e')][_0x0a9e('0x15f')])){_0x1d7537[_0x0a9e('0xc9')](_0x0a9e('0x1f8'),_0x14cf4c,_0x4b3f95[_0x37c272]);}else{_0x1d7537[_0x0a9e('0x1f9')](_[_0x0a9e('0xcb')](_0x4b3f95[_0x37c272],[_0x0a9e('0xcf'),_0x0a9e('0x1f2')]))[_0x0a9e('0xb4')](_0x1d7537['checkContactBlack'](_0x14cf4c,_0x4b3f95[_0x37c272]))[_0x0a9e('0xac')](_0x1d7537[_0x0a9e('0xc8')](_0x0a9e('0x1f8'),_0x14cf4c));}}}})[_0x0a9e('0xac')](loggerGetContactDialer(_0x0a9e('0x1fa'),_0x14cf4c,_0x459efc));}};Dialer[_0x0a9e('0x19')][_0x0a9e('0x8b')]=function(_0x5b393b){var _0x2c2a3e=this;if(_0x5b393b[_0x0a9e('0x1f5')]>0x0){var _0x1d504a=_0x5b393b['dialLimitQueue']-_0x5b393b[_0x0a9e('0x95')]-_0x5b393b[_0x0a9e('0x53')];if(_0x1d504a>0x0){this[_0x0a9e('0x1fb')](_0x5b393b);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x0a9e('0x1fb')](_0x5b393b);}};Dialer[_0x0a9e('0x19')][_0x0a9e('0x1fb')]=function(_0x4061b2){var _0x241492=this;var _0x5e29c1=[];_0x4061b2[_0x0a9e('0x95')]+=0x1;for(var _0x584f70 in this[_0x0a9e('0x20')]){if(this[_0x0a9e('0x20')]['hasOwnProperty'](_0x584f70)){if(this[_0x0a9e('0x20')][_0x584f70]['state']===_0x0a9e('0x1f6')&&this[_0x0a9e('0x20')][_0x584f70]['status']===_0x0a9e('0x1f7')){_0x5e29c1[_0x0a9e('0x11b')](this[_0x0a9e('0x20')][_0x584f70]['id']);}}}this['getContactDialer'](_0x4061b2['id'],_0x5e29c1,0x1,_0x4061b2[_0x0a9e('0x1ee')])[_0x0a9e('0xb4')](function(_0x15b9f7){if(!checkContactEmpty(_0x15b9f7)){checkContactLowerLimitOriginate(_0x4061b2,0x1,0x0);_0x241492[_0x0a9e('0xb2')](_0x4061b2)[_0x0a9e('0xb4')](sendMessageReschedule(_0x4061b2))[_0x0a9e('0xac')](loggerCatch('[countReScheduled]\x20'));}else{_0x4061b2[_0x0a9e('0x3e')]=_0x0a9e('0x1f0');if(_[_0x0a9e('0xab')](_0x15b9f7[0x0])||_[_0x0a9e('0xab')](_0x15b9f7[0x0]['Contact'])||_['isNil'](_0x15b9f7[0x0][_0x0a9e('0x15e')][_0x0a9e('0x15f')])){_0x241492[_0x0a9e('0xc9')]('[actionOriginate]\x20',_0x4061b2,_0x15b9f7[0x0]);}else{_0x241492['checkIsBlackList'](_[_0x0a9e('0xcb')](_0x15b9f7[0x0],['VoiceQueueId','Contact.phone']))[_0x0a9e('0xb4')](_0x241492[_0x0a9e('0x1d9')](_0x4061b2,_0x15b9f7[0x0]))['catch'](_0x241492[_0x0a9e('0xc8')](_0x0a9e('0x1fc'),_0x4061b2));}}})[_0x0a9e('0xac')](loggerGetContactDialer(_0x0a9e('0x1fd'),_0x4061b2,0x1));emitVoiceQueueSummary(_0x4061b2);};Dialer[_0x0a9e('0x19')]['abandonmentRate']=function(_0x395897,_0x1db07,_0x499e86,_0x12c434,_0x27668b,_0x1b6408){loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x1fe'));loggerPredictive['info'](_0x0a9e('0x1ff'),_0x395897);loggerPredictive[_0x0a9e('0x80')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1db07);loggerPredictive['info'](_0x0a9e('0x200'),_0x499e86);loggerPredictive[_0x0a9e('0x80')]('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',_0x12c434);loggerPredictive['info'](_0x0a9e('0x201'),_0x27668b);loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x88'));return new BPromise(function(_0x46ba2c,_0xb6d223){if(_0x395897<=0x0||isNaN(_0x395897)){return _0xb6d223(msgResponse('[abandonmentRate]',_0x0a9e('0x48'),'m\x20=\x20'+_0x395897));}if(_0x499e86<=0x0||isNaN(_0x499e86)){return _0xb6d223(msgResponse('[abandonmentRate]',_0x0a9e('0x48'),'Ts\x20=\x20'+_0x499e86));}if(_0x12c434<=0x0||isNaN(_0x12c434)){return _0xb6d223(msgResponse(_0x0a9e('0x202'),'Error',_0x0a9e('0x203')+_0x12c434));}if(_0x1db07<=0x0||isNaN(_0x1db07)){return _0xb6d223(msgResponse('[abandonmentRate]','Error',_0x0a9e('0x204')+_0x1db07));}if(_0x27668b<=0x0||isNaN(_0x27668b)){return _0xb6d223(msgResponse(_0x0a9e('0x202'),_0x0a9e('0x48'),'Amax\x20=\x20'+_0x27668b));}_0x1b6408=_0x1b6408||0x0;var _0x58c6a8=0x1/_0x499e86;var _0x537da0=0x0;var _0x4239b8=0x0;var _0x70ca91=0x0;var _0x4a3895=0x0;for(var _0x2ed3ba=0x0;_0x70ca91<_0x27668b;_0x2ed3ba+=0x1){_0x4239b8=_0x2ed3ba/_0x1db07;_0x537da0=(_0x12c434*_0x4239b8+_0x1b6408)/_0x58c6a8;_0x70ca91=erlangb(_0x537da0,_0x395897);_0x4a3895=_0x537da0/_0x395897*(0x1-erlangb(_0x537da0,_0x395897));}return _0x46ba2c({'erlangCalls':_0x2ed3ba,'erlangCallToSecond':_0x1db07/_0x2ed3ba,'erlangAbandonmentRate':_0x70ca91,'erlangBusyFactor':_0x4a3895});});};Dialer['prototype'][_0x0a9e('0x1d0')]=function(_0x4e8586,_0x4665ea,_0x247806,_0x56736e,_0x5925f7,_0x4c4874){loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x205'));loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x1ff'),_0x4e8586);loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x206'),_0x4665ea);loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x200'),_0x247806);loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x207'),_0x56736e);loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x208'),_0x5925f7);loggerPredictive[_0x0a9e('0x80')](_0x0a9e('0x88'));return new BPromise(function(_0x2e8669,_0x5242e9){if(_0x4e8586<=0x0||isNaN(_0x4e8586)){return _0x5242e9(msgResponse('[busyFactor]',_0x0a9e('0x48'),_0x0a9e('0x209')+_0x4e8586));}if(_0x247806<=0x0||isNaN(_0x247806)){return _0x5242e9(msgResponse(_0x0a9e('0x20a'),_0x0a9e('0x48'),'Ts\x20=\x20'+_0x247806));}if(_0x56736e<=0x0||isNaN(_0x56736e)){return _0x5242e9(msgResponse(_0x0a9e('0x20a'),'Error',_0x0a9e('0x203')+_0x56736e));}if(_0x4665ea<=0x0||isNaN(_0x4665ea)){return _0x5242e9(msgResponse('[busyFactor]',_0x0a9e('0x48'),'interval\x20=\x20'+_0x4665ea));}if(_0x5925f7<=0x0||isNaN(_0x5925f7)){return _0x5242e9(msgResponse('[busyFactor]',_0x0a9e('0x48'),_0x0a9e('0x20b')+_0x5925f7));}_0x4c4874=_0x4c4874||0x0;var _0xc2ae55=0x1/_0x247806;var _0x164ba4=0x0;var _0x502bd9=0x0;var _0x48b8e7=0x0;var _0x5b53aa=0x0;for(var _0x5d54fb=0x0;_0x5b53aa<_0x5925f7;_0x5d54fb+=0x1){_0x502bd9=_0x5d54fb/_0x4665ea;_0x164ba4=(_0x56736e*_0x502bd9+_0x4c4874)/_0xc2ae55;_0x48b8e7=erlangb(_0x164ba4,_0x4e8586);_0x5b53aa=_0x164ba4/_0x4e8586*(0x1-erlangb(_0x164ba4,_0x4e8586));}return _0x2e8669({'erlangCalls':_0x5d54fb,'erlangCallToSecond':_0x4665ea/_0x5d54fb,'erlangAbandonmentRate':_0x48b8e7,'erlangBusyFactor':_0x5b53aa});});};module[_0x0a9e('0x20c')]=Dialer; \ No newline at end of file +var _0x8163=['ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','erlangCalls','erlangBusyFactor','Trunk','active','format','voice_queue:save','campaign:save','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','info','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','clearing\x20variable\x20start\x20progressive','handlePredictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','talking','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','endtime','prototype','clearZombieChannels','[uniqueid]','actions','isNil','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','saveInDb','merge','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','syncVarSet','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','statedesc','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','membername','amd','[syncMachine][createHistory]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','[syncHangupIvr][createHistory]','cause-txt','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','YYYY-MM-DD\x20HH:mm:ss','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','countdropretry','countglobal','add','dialDropRetryFrequency','minutes','ListId','[rescheduleContact][Drop]','starttime','calleridnum','log','CRIS\x20evt\x2010.2','CRIS\x20queueCallerAbandon\x2010.2','[syncAgentComplete][createHistory][10]','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','calleridname','CRIS\x20createHistory\x2011','actionid','locked','stateinterface','push','pick','queueStatusComplete','[booked][unlockQueueStatus]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','paused','unlockRR','contactAgent-idHopper:\x20','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','Queue','method\x20not\x20recognized','launchHandleIvr','syncQueueSummary','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','dialQueueOptions','NONE','dialer','ACTIVE','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-CAMPAIGNID','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','countmachineretry','countnoanswerretry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','countnosuchnumberretry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','countagentrejectretry','dialAgentRejectMaxRetry','callProgressDetecting','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','dialGlobalMaxRetry','stateGlobal','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','predictiveIntervalAvailable','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','predictiveIntervalTotalCalls','outboundQueuePauses','[CatchErlangB]','check\x20failure','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','booked','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','Agent','Contact\x20updated','[rescheduleContact][dialRecallInQueue]','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','temp','maxNumberOriginate','dialOrderByScheduledAt','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkContactBlack','[getContactCampaign2]','dialLimitQueue','not_inuse','Contact.phone','tryOriginatePredictive','RUNNING','[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','---------------------------','m\x20=\x20','[abandonmentRate]','Amax\x20=\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','../../../config/environment/','../../../config/logger','predictive','predictiveCalls','../ami','defaults','redis','localhost','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./final','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','channels','uniqueId','optionPredictive','startPredictive','startProgressive'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x8163,0x1d8));var _0x3816=function(_0x2fb704,_0x1be4fd){_0x2fb704=_0x2fb704-0x0;var _0x44c35e=_0x8163[_0x2fb704];return _0x44c35e;};'use strict';var util=require(_0x3816('0x0'));var _=require(_0x3816('0x1'));var BPromise=require(_0x3816('0x2'));var uuid=require(_0x3816('0x3'));var moment=require(_0x3816('0x4'));var rr=require('rr');var md5=require(_0x3816('0x5'));var Redis=require('ioredis');var config=require(_0x3816('0x6'));var logger=require(_0x3816('0x7'))('dialer');var loggerBooked=require(_0x3816('0x7'))('booked');var loggerPredictive=require(_0x3816('0x7'))(_0x3816('0x8'));var loggerPredictiveCalls=require(_0x3816('0x7'))(_0x3816('0x9'));var loggerSyncQueueSummary=require(_0x3816('0x7'))('syncQueueSummary');var ami=require(_0x3816('0xa'));config['redis']=_[_0x3816('0xb')](config[_0x3816('0xc')],{'host':_0x3816('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3816('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x3816('0xe'));var cmHopperHistory=require(_0x3816('0xf'));var cmHopperBlack=require(_0x3816('0x10'));var voiceQueueRt=require(_0x3816('0x11'));var Action=require('./action');var History=require('./history');var Final=require(_0x3816('0x12'));var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0x3816('0x13'));var Hangup=require(_0x3816('0x14'));var ipAgi=process['env'][_0x3816('0x15')]||_0x3816('0x16');var strategy={'rrmemory':_0x3816('0x17'),'roundrobin':_0x3816('0x18')};var Sequence=function(){};Sequence['prototype'][_0x3816('0x19')]=function(_0x232b5b){this[_0x3816('0x1a')]=this[_0x3816('0x1a')]?this[_0x3816('0x1a')]['finally'](_0x232b5b):_0x232b5b();};function Dialer(_0x427b32,_0x4a5588){this[_0x3816('0x1b')]=new Sequence();this[_0x3816('0x1c')]=_0x4a5588;this[_0x3816('0x1d')]=_0x427b32['voiceQueues'];this[_0x3816('0x1e')]=_0x427b32[_0x3816('0x1e')];this[_0x3816('0x1f')]=_0x427b32[_0x3816('0x1f')];this[_0x3816('0x20')]=_0x427b32[_0x3816('0x20')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this[_0x3816('0x21')]={};this['actions']={};this['contactsId']={};this[_0x3816('0x22')]={};this[_0x3816('0x23')]={};this[_0x3816('0x24')]={};this[_0x3816('0x25')]={};this[_0x3816('0x26')]={};this[_0x3816('0x27')]={};this['queueBookedRR']={};ami['on'](_0x3816('0x28'),this[_0x3816('0x29')][_0x3816('0x2a')](this));ami['on'](_0x3816('0x2b'),this[_0x3816('0x2c')][_0x3816('0x2a')](this));ami['on'](_0x3816('0x2d'),this['syncOriginateResponse'][_0x3816('0x2a')](this));ami['on'](_0x3816('0x2e'),this[_0x3816('0x2f')]['bind'](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x3816('0x2a')](this));ami['on']('hangup',this['syncHangup'][_0x3816('0x2a')](this));ami['on']('newexten',this[_0x3816('0x30')][_0x3816('0x2a')](this));ami['on'](_0x3816('0x31'),this['syncVarSet'][_0x3816('0x2a')](this));ami['on'](_0x3816('0x32'),this[_0x3816('0x33')][_0x3816('0x2a')](this));ami['on'](_0x3816('0x34'),this[_0x3816('0x35')]['bind'](this));this['loopCampaigns']();this[_0x3816('0x36')]();}function isNotNull(_0x46b7d6){return _0x46b7d6!==null&&!_[_0x3816('0x37')](_0x46b7d6);}function checkIsLoggedIn(_0x57f8f6,_0x29af50){return function(){if(_0x29af50<=0x0){_0x57f8f6[_0x3816('0x38')]=_0x3816('0x39');throw _0x57f8f6[_0x3816('0x3a')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x4aa45a){return _0x4aa45a;}function checkIsActive(_0x3c6c9f,_0x123030){return function(){if(!isActive(_0x123030)){_0x3c6c9f[_0x3816('0x38')]=_0x3816('0x3b');throw _0x3c6c9f[_0x3816('0x3a')]+'\x20NOT\x20Active';}};}function checkInterval(_0xcf67bd){return function(){if(!isNotNull(_0xcf67bd[_0x3816('0x3c')])){_0xcf67bd[_0x3816('0x38')]='INTERVAL_IS_NULL';throw _0xcf67bd['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0xcf67bd['Interval']['Intervals'])){_0xcf67bd['message']=_0x3816('0x3d');throw _0xcf67bd[_0x3816('0x3a')]+_0x3816('0x3e');}if(!isNotNull(_[_0x3816('0x3f')](_0xcf67bd[_0x3816('0x3c')][_0x3816('0x40')]))){_0xcf67bd[_0x3816('0x38')]=_0x3816('0x3d');throw _0xcf67bd[_0x3816('0x3a')]+_0x3816('0x3e');}};}function msgResponse(_0x979bfd,_0x21e892,_0x373c74){return{'action':_0x979bfd,'response':_0x21e892,'message':_0x373c74,'stack':_0x373c74};}function myreject(_0x41b94d){return function(_0x1f1fd3){return _0x41b94d(msgResponse(_0x3816('0x41'),_0x3816('0x42'),JSON[_0x3816('0x43')](_0x1f1fd3)));};}function getSeconds(_0x4ef95f,_0x2b5cf6){var _0x4a0c9d=moment(_0x4ef95f)[_0x3816('0x44')](0x0);var _0x32ecbe=moment(_0x2b5cf6)[_0x3816('0x44')](0x0);return _0x4a0c9d[_0x3816('0x45')](_0x32ecbe,_0x3816('0x46'));}function emit(_0x3a5b45,_0x29e2e1,_0x4d503c){io['to'](_0x3a5b45)[_0x3816('0x47')](_0x29e2e1,_0x4d503c);}function emitVoiceQueueSummary(_0x477944){if(_0x477944[_0x3816('0x48')]===_0x3816('0x49')){var _0x30b268={'id':_0x477944['id'],'name':_0x477944[_0x3816('0x3a')],'strategy':_0x477944[_0x3816('0x4a')],'answered':_0x477944['answered'],'available':_0x477944[_0x3816('0x4b')],'loggedIn':_0x477944[_0x3816('0x4c')],'pTalking':_0x477944[_0x3816('0x4d')],'sumBillable':_0x477944[_0x3816('0x4e')],'sumDuration':_0x477944['sumDuration'],'sumHoldTime':_0x477944[_0x3816('0x4f')]||0x0,'talking':_0x477944['talking'],'total':_0x477944[_0x3816('0x50')],'type':_0x477944['type'],'unmanaged':_0x477944['unmanaged'],'abandoned':_0x477944[_0x3816('0x51')],'waiting':_0x477944[_0x3816('0x52')],'loggedInDb':_0x477944[_0x3816('0x53')],'dialActive':_0x477944[_0x3816('0x54')],'dialMethod':_0x477944[_0x3816('0x55')],'dialOriginateCallerIdName':_0x477944[_0x3816('0x56')],'dialOriginateCallerIdNumber':_0x477944[_0x3816('0x57')],'dialOriginateTimeout':_0x477944[_0x3816('0x58')],'dialPrefix':_0x477944[_0x3816('0x59')],'outboundAnswerAgiCallsDay':_0x477944['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x477944[_0x3816('0x5a')],'outboundBlacklistCallsDay':_0x477944[_0x3816('0x5b')],'outboundBusyCallsDay':_0x477944[_0x3816('0x5c')],'outboundCongestionCallsDay':_0x477944[_0x3816('0x5d')],'outboundDropCallsDayACS':_0x477944['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x477944['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x477944[_0x3816('0x5e')],'outboundNoAnswerCallsDay':_0x477944[_0x3816('0x5f')],'outboundNoSuchCallsDay':_0x477944[_0x3816('0x60')],'outboundOriginateFailureCallsDay':_0x477944['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x477944[_0x3816('0x61')],'outboundRejectCallsDay':_0x477944[_0x3816('0x62')],'outboundUnknownCallsDay':_0x477944[_0x3816('0x63')],'predictiveIntervalAnsweredCalls':_0x477944[_0x3816('0x64')],'predictiveIntervalAvgHoldtime':_0x477944[_0x3816('0x65')],'predictiveIntervalAvgTalktime':_0x477944[_0x3816('0x66')],'predictiveIntervalDroppedCallsCallersExit':_0x477944[_0x3816('0x67')],'predictiveIntervalDroppedCallsTimeout':_0x477944[_0x3816('0x68')],'predictiveIntervalErlangCalls':_0x477944[_0x3816('0x69')],'predictiveIntervalErlangCallsDroppedCalls':_0x477944[_0x3816('0x6a')],'predictiveIntervalHitRate':_0x477944[_0x3816('0x6b')],'predictiveIntervalMultiplicativeFactor':_0x477944[_0x3816('0x6c')],'predictiveIntervalPauses':_0x477944[_0x3816('0x6d')],'predictiveIntervalAvailable':_0x477944['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x477944['predictiveIntervalTotalCalls'],'message':_0x477944[_0x3816('0x38')],'originated':_0x477944[_0x3816('0x6e')],'erlangCalls':_0x477944[_0x3816('0x6f')],'erlangCallToSecond':_0x477944['erlangCallToSecond'],'erlangAbandonmentRate':_0x477944['erlangAbandonmentRate'],'erlangBusyFactor':_0x477944[_0x3816('0x70')],'startPredictive':_0x477944[_0x3816('0x24')],'startProgressive':_0x477944[_0x3816('0x25')]};if(_0x477944[_0x3816('0x71')]){_0x30b268[_0x3816('0x71')]={'id':_0x477944[_0x3816('0x71')]['id'],'name':_0x477944[_0x3816('0x71')][_0x3816('0x3a')],'active':_0x477944[_0x3816('0x71')][_0x3816('0x72')],'callerid':_0x477944[_0x3816('0x71')]['callerid']};}if(_0x477944['Interval']){_0x30b268[_0x3816('0x3c')]={'id':_0x477944['Interval']['id'],'name':_0x477944[_0x3816('0x3c')][_0x3816('0x3a')]};}var _0x414ff7=md5(JSON[_0x3816('0x43')](_0x30b268));if(_0x477944[_0x3816('0x5')]!==_0x414ff7){_0x477944['md5']=_0x414ff7;emit(util[_0x3816('0x73')]('voice:queue:%s',_0x30b268[_0x3816('0x3a')]),_0x3816('0x74'),_0x30b268);}}}function emitCampaignSummary(_0x4ea558){if(_0x4ea558['type']==='ivr'){emit(util['format']('campaign:ivr:%s',_0x4ea558[_0x3816('0x3a')]),_0x3816('0x75'),_0x4ea558);}}function checkGetDataPredictive(_0x35588d){if(isNotNull(_0x35588d)){if(!_['isEmpty'](_0x35588d)){loggerPredictive['info'](_0x3816('0x76'));loggerPredictive['info'](_0x3816('0x77'),_0x35588d['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35588d[_0x3816('0x64')]);loggerPredictive[_0x3816('0x78')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35588d[_0x3816('0x68')]);loggerPredictive[_0x3816('0x78')](_0x3816('0x79'),_0x35588d[_0x3816('0x67')]);loggerPredictive[_0x3816('0x78')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x35588d['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x3816('0x78')](_0x3816('0x7a'),_0x35588d['predictiveIntervalAvgTalktime']);loggerPredictive[_0x3816('0x78')]('---------------------------');if(_0x35588d['predictiveIntervalTotalCalls']>0x0){if(!_[_0x3816('0x37')](_0x35588d[_0x3816('0x66')])&&_0x35588d[_0x3816('0x66')]>0x0){return!![];}else{loggerPredictive[_0x3816('0x78')](_0x3816('0x7b'));}if(!_[_0x3816('0x37')](_0x35588d[_0x3816('0x65')])&&_0x35588d['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x3816('0x78')](_0x3816('0x7c'));}}else{loggerPredictive[_0x3816('0x78')](_0x3816('0x7d'));}}else{loggerPredictive[_0x3816('0x78')](_0x3816('0x7e'));}}else{loggerPredictive['info'](_0x3816('0x7e'));}return![];}function mergeDataErlangB(_0x8ffc43){return function(_0x5301c9){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x3816('0x78')](_0x3816('0x7f'),_0x5301c9['erlangCalls']);loggerPredictive[_0x3816('0x78')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5301c9[_0x3816('0x80')]);loggerPredictive[_0x3816('0x78')](_0x3816('0x81'),_0x5301c9['erlangAbandonmentRate']);loggerPredictive['info'](_0x3816('0x82'),_0x5301c9['erlangBusyFactor']);loggerPredictive[_0x3816('0x78')](_0x3816('0x81'),_0x5301c9[_0x3816('0x83')]);loggerPredictive[_0x3816('0x78')]('---------------------------');_['merge'](_0x8ffc43,_0x5301c9);};}function getDiff(_0xea78f0){var _0x26d789=moment()[_0x3816('0x44')](0x0);var _0x203c5d=moment(_0xea78f0)[_0x3816('0x44')](0x0);return _0x26d789[_0x3816('0x45')](_0x203c5d,_0x3816('0x46'));}function ifInterval(_0x43a6cb,_0x148c78){if(_[_0x3816('0x37')](_0x148c78)){return![];}if(getDiff(_0x148c78)<_0x43a6cb*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3f3370){if(isNotNull(_0x3f3370)){if(!_['isUndefined'](_0x3f3370[_0x3816('0x25')])){_0x3f3370[_0x3816('0x25')]=undefined;loggerPredictive[_0x3816('0x78')](_0x3f3370['name'],_0x3816('0x84'));}if(!_['isUndefined'](_0x3f3370[_0x3816('0x24')])){_0x3f3370['startPredictive']=undefined;loggerPredictive[_0x3816('0x78')](_0x3f3370[_0x3816('0x3a')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x3816('0x37')](_0x3f3370[_0x3816('0x85')])){clearInterval(_0x3f3370[_0x3816('0x85')]);_0x3f3370[_0x3816('0x85')]=undefined;loggerPredictive[_0x3816('0x78')](_0x3f3370[_0x3816('0x3a')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x4c41c2,_0x3eef30){if(_0x3eef30===0x0){return 0x0;}var _0x37495a=0x1;for(var _0x42c0c2=0x1;_0x42c0c2<=_0x3eef30;_0x42c0c2+=0x1){_0x37495a=0x1+_0x37495a*_0x42c0c2/_0x4c41c2;}return 0x1/_0x37495a;}function isVoiceQueueOutbound(_0x4077d8){return _0x4077d8===_0x3816('0x49');}function isNotPreview(_0x3a75b0){return _0x3a75b0!==_0x3816('0x1c');}function isCampaignIvr(_0x50bf05){return _0x50bf05===_0x3816('0x86');}function getCallerId(_0x3ad040,_0x545185,_0x49c300){if(!_[_0x3816('0x37')](_0x49c300)&&_0x3816('0x87')===typeof _0x49c300&&!_[_0x3816('0x3f')](_0x49c300)){if(!_[_0x3816('0x37')](_0x545185)&&'string'===typeof _0x545185&&!_['isEmpty'](_0x545185)){return util['format'](_0x3816('0x88'),_0x545185,_0x49c300);}return util['format'](_0x3816('0x88'),_0x49c300,_0x49c300);}if(!_['isUndefined'](_0x3ad040)&&_0x3816('0x87')===typeof _0x3ad040&&!_['isEmpty'](_0x3ad040)){return _0x3ad040;}return _0x3816('0x89');}function loggerCatchQueueSummary(_0xdc8da9,_0x2febf6){return function(_0x495126){freeVariablesPredictive(_0x2febf6);emitVoiceQueueSummary(_0x2febf6);emitCampaignSummary(_0x2febf6);loggerSyncQueueSummary[_0x3816('0x8a')](_0xdc8da9,util[_0x3816('0x8b')](_0x495126,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x9acbb0,_0x351155){return function(_0x2460f4){loggerPredictive[_0x3816('0x8a')](_0x351155[_0x3816('0x3a')],_0x9acbb0);loggerPredictive[_0x3816('0x8a')](_0x2460f4[_0x3816('0x8c')]);freeVariablesPredictive(_0x351155);};}function loggerCatch(_0x388352){return function(_0x59c083){logger[_0x3816('0x8a')](_0x388352,util[_0x3816('0x8b')](_0x59c083,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x3485ce){return _0x3485ce&&!_[_0x3816('0x37')](_0x3485ce)&&_0x3485ce[_0x3816('0x8d')]>0x0;}function decremetOriginate(_0x3e05d6){if(!_[_0x3816('0x37')](_0x3e05d6)&&_0x3e05d6!==null){if(_0x3e05d6[_0x3816('0x8e')](_0x3816('0x6e'))){if(_0x3e05d6['originated']>0x0){_0x3e05d6[_0x3816('0x6e')]-=0x1;}else{logger['error'](_0x3816('0x8f'));}}}else{logger[_0x3816('0x8a')](_0x3816('0x90'));}}function checkContactLowerLimitOriginate(_0x60ba8e,_0x2ac293,_0x45b9a9){if(_0x2ac293>_0x45b9a9){for(var _0x54755b=0x0;_0x54755b<_0x2ac293-_0x45b9a9;_0x54755b+=0x1){decremetOriginate(_0x60ba8e);}}}function loggerGetContactDialer(_0x29f31a,_0x3274af,_0x5f2749){return function(_0x27f4b2){checkContactLowerLimitOriginate(_0x3274af,_0x5f2749,0x0);logger[_0x3816('0x8a')](_0x29f31a,util['inspect'](_0x27f4b2,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5cef66){return function(_0x495743){if(isNotNull(_0x495743)&&isNotNull(_0x495743[0x0])){if(_0x495743[0x0]['contactsRescheduled']>0x0){_0x5cef66[_0x3816('0x38')]='RESCHEDULED_CONTACTS';logger[_0x3816('0x78')](_0x3816('0x91')+_0x5cef66[_0x3816('0x3a')],_0x495743[0x0][_0x3816('0x92')],_0x3816('0x93'));}else{_0x5cef66[_0x3816('0x38')]=_0x3816('0x94');logger[_0x3816('0x78')]('[getContactDialer2][Empty]'+_0x5cef66[_0x3816('0x3a')]);}}};}function notSendMessagesQueue(_0x403558){if(_0x403558['sendMessageOneNotActive']){freeVariablesPredictive(_0x403558);if(_0x403558[_0x3816('0x6e')]===0x0&&_0x403558[_0x3816('0x95')]===0x0&&_0x403558[_0x3816('0x52')]===0x0&&(_0x403558['pTalking']||0x0)===0x0){_0x403558[_0x3816('0x96')]=![];_0x403558[_0x3816('0x4b')]=0x0;_0x403558['message']=_0x3816('0x3b');loggerSyncQueueSummary['error'](_0x3816('0x97'),_0x403558[_0x3816('0x3a')],_0x3816('0x98'));}else{_0x403558[_0x3816('0x38')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x3816('0x8a')](_0x3816('0x97'),_0x403558[_0x3816('0x3a')],'is\x20disactive');}emitVoiceQueueSummary(_0x403558);}}function notSendMessagesCampaign(_0x519566){if(_0x519566['sendMessageOneNotActive']){if(_0x519566['originated']===0x0){_0x519566[_0x3816('0x96')]=![];_0x519566[_0x3816('0x38')]='NOT_ACTIVE';loggerSyncQueueSummary['error'](_0x3816('0x99'),_0x519566[_0x3816('0x3a')],'is\x20not\x20active');}else{_0x519566['message']='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0x3816('0x99'),_0x519566[_0x3816('0x3a')],_0x3816('0x9a'));}emitCampaignSummary(_0x519566);}}function createObjHistory(_0x86d5c6,_0x29d301,_0x3c29a1,_0x281564,_0x209477){_0x86d5c6[_0x3816('0x38')]=_0x3c29a1;var _0x51c0cd=new Action(_0x86d5c6,_0x29d301);var _0x1ab420=new History(_0x51c0cd);_0x1ab420[_0x3816('0x9b')]=_0x281564;_0x1ab420['statedesc']=_0x209477;_0x1ab420[_0x3816('0x9c')]=_0x51c0cd['starttime'];return _0x1ab420;}Dialer[_0x3816('0x9d')][_0x3816('0x36')]=function(){var _0x6f27ea=this;setInterval(function(){_0x6f27ea[_0x3816('0x9e')](_0x6f27ea[_0x3816('0x22')],_0x3816('0x9f'));_0x6f27ea['clearZombieChannels'](_0x6f27ea[_0x3816('0xa0')],'[actions]');},0x32c8);};Dialer['prototype'][_0x3816('0x9e')]=function(_0x5978ee,_0x1eeb42){var _0x4aca56=this;for(var _0x3f7747 in _0x5978ee){if(_0x5978ee['hasOwnProperty'](_0x3f7747)){this[_0x3816('0x1b')][_0x3816('0x19')](function(){if(!_[_0x3816('0xa1')](_0x5978ee[_0x3f7747])){return ami['Action']({'action':_0x3816('0xa2'),'channel':_0x5978ee[_0x3f7747][_0x3816('0xa3')]})[_0x3816('0xa4')](function(_0x56cd1c){if(_0x56cd1c[_0x3816('0x38')]===_0x3816('0xa5')){setTimeout(function(){if(_0x5978ee[_0x3f7747]&&_0x5978ee[_0x3f7747][_0x3816('0x48')]!==_0x3816('0x86')){_0x4aca56['updateOriginated'](_0x4aca56['voiceQueues'][_0x5978ee[_0x3f7747][_0x3816('0xa6')]]);logger[_0x3816('0x8a')](_0x3816('0xa7'),_0x1eeb42,_0x3f7747,_0x5978ee[_0x3f7747]['queue']);delete _0x5978ee[_0x3f7747];}if(_0x5978ee[_0x3f7747]&&_0x5978ee[_0x3f7747]['type']==='ivr'){_0x4aca56[_0x3816('0xa8')](_0x4aca56[_0x3816('0x1e')][_0x5978ee[_0x3f7747][_0x3816('0xa6')]]);logger['error'](_0x3816('0xa9'),_0x1eeb42,_0x3f7747,_0x5978ee[_0x3f7747][_0x3816('0xa6')]);delete _0x5978ee[_0x3f7747];}},0x2328);}});}});}}};Dialer[_0x3816('0x9d')][_0x3816('0xaa')]=function(_0x7b2bc0){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopper[_0x3816('0xaa')](_0x7b2bc0))[_0x3816('0xa4')](loggerCatch(_0x3816('0xad')));};Dialer[_0x3816('0x9d')][_0x3816('0xae')]=function(_0x5b066b){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopperBlack[_0x3816('0xae')](_0x5b066b))[_0x3816('0xa4')](loggerCatch(_0x3816('0xaf')));};Dialer[_0x3816('0x9d')]['checkIsBlackListIvr']=function(_0xab473a){return BPromise['resolve']()[_0x3816('0xac')](cmHopperBlack[_0x3816('0xb0')](_0xab473a))[_0x3816('0xa4')](loggerCatch(_0x3816('0xb1')));};Dialer[_0x3816('0x9d')][_0x3816('0xb2')]=function(_0x1a1a49){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopperHistory[_0x3816('0xb3')](_0x1a1a49))['catch'](loggerCatch(_0x3816('0xb4')));};Dialer[_0x3816('0x9d')][_0x3816('0xb5')]=function(_0x2dea29){return BPromise['resolve']()['then'](cmHopper[_0x3816('0xb5')](_0x2dea29))['catch'](loggerCatch(_0x3816('0xb6')));};Dialer['prototype'][_0x3816('0xb7')]=function(_0x231ffc,_0x3bd8d5,_0x6a87f7){return BPromise['resolve']()[_0x3816('0xac')](cmHopper[_0x3816('0xb7')](_0x231ffc,_0x3bd8d5,_0x6a87f7))[_0x3816('0xa4')](loggerCatch('[unlockContact]\x20'));};Dialer[_0x3816('0x9d')]['getContactDialer']=function(_0x45fc16,_0x420032,_0x40c833,_0x11ba79){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopper[_0x3816('0xb8')](_0x45fc16,_0x420032,_0x40c833,_0x11ba79))[_0x3816('0xa4')](loggerCatch(_0x3816('0xb9')));};Dialer['prototype'][_0x3816('0xba')]=function(_0x4cf5d6,_0x4360ee,_0x51f1b8){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopper[_0x3816('0xba')](_0x4cf5d6,_0x4360ee,_0x51f1b8))[_0x3816('0xa4')](loggerCatch(_0x3816('0xb9')));};Dialer[_0x3816('0x9d')]['getVoiceQueueRtPauses']=function(_0x4a3d81){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](voiceQueueRt[_0x3816('0xbb')](_0x4a3d81))[_0x3816('0xa4')](loggerCatch(_0x3816('0xbc')));};Dialer[_0x3816('0x9d')][_0x3816('0xbd')]=function(_0x52e68c){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopper[_0x3816('0xbd')](_0x52e68c))[_0x3816('0xa4')](loggerCatch(_0x3816('0xbe')));};Dialer[_0x3816('0x9d')][_0x3816('0xbf')]=function(_0x2dca57){return BPromise[_0x3816('0xab')]()[_0x3816('0xac')](cmHopperHistory['createHistory'](_0x2dca57))[_0x3816('0xa4')](loggerCatch('[createHistory]\x20'));};Dialer[_0x3816('0x9d')][_0x3816('0xa8')]=function(_0x59ca85){if(!_[_0x3816('0x37')](_0x59ca85)&&_0x59ca85!==null){if(_0x59ca85['hasOwnProperty'](_0x3816('0x6e'))){if(_0x59ca85['originated']>0x0){_0x59ca85['originated']-=0x1;}else{logger[_0x3816('0x8a')](_0x3816('0xc0'));}}}else{logger[_0x3816('0x8a')](_0x3816('0xc1'));}};Dialer['prototype'][_0x3816('0xc2')]=function(_0x1b1199,_0x38229d){var _0x157751=this;return function(_0x53a54b){_0x157751[_0x3816('0xa8')](_0x38229d);logger[_0x3816('0x8a')](_0x1b1199,util[_0x3816('0x8b')](_0x53a54b,{'showHidden':![],'depth':null}));};};Dialer[_0x3816('0x9d')]['emptyContact']=function(_0xe3c445,_0xaff41,_0xe283fd){var _0x3a7623={'state':0x19,'statedesc':'notFound'};this[_0x3816('0xa8')](_0xaff41);this[_0x3816('0xc3')](_[_0x3816('0xc4')](_0x3a7623,_['pick'](_0xe283fd,[_0x3816('0xc5'),'ListId',_0x3816('0xc6'),_0x3816('0xc7'),_0x3816('0xc8')])),_0x3816('0xc9'),_0x3816('0xca'));logger['error'](_0xe3c445);};Dialer[_0x3816('0x9d')][_0x3816('0xcb')]=function(_0xb1ba56){return _0xb1ba56===_0x3816('0xcc');};Dialer[_0x3816('0x9d')][_0x3816('0xcd')]=function(_0x5f36a5){return!_[_0x3816('0x37')](_0x5f36a5)&&_0x5f36a5&&!_[_0x3816('0x37')](_0x5f36a5[_0x3816('0x3a')])&&!_[_0x3816('0x37')](_0x5f36a5[_0x3816('0x72')])&&_0x5f36a5[_0x3816('0x72')]&&(this[_0x3816('0x20')][util[_0x3816('0x73')](_0x3816('0xce'),_0x5f36a5[_0x3816('0x3a')])][_0x3816('0xa2')]===_0x3816('0xcf')||this[_0x3816('0x20')][util['format']('SIP/%s',_0x5f36a5[_0x3816('0x3a')])][_0x3816('0xa2')]===_0x3816('0xd0'));};Dialer[_0x3816('0x9d')][_0x3816('0xc3')]=function(_0x41858d,_0x2d4c0f,_0x343bad){this[_0x3816('0xbf')](_0x41858d)['catch'](loggerCatch(_0x2d4c0f));this[_0x3816('0xbd')](_0x41858d)['catch'](loggerCatch(_0x343bad));};Dialer[_0x3816('0x9d')][_0x3816('0xd1')]=function(_0x527a48){var _0xb71d9e=this[_0x3816('0x22')][_0x527a48[_0x3816('0xd2')]];var _0x2ce84f;if(!_[_0x3816('0xa1')](_0x527a48)&&!_[_0x3816('0xa1')](_0x527a48['variable'])&&!_[_0x3816('0xa1')](_0x527a48[_0x3816('0xd3')][_0x3816('0xd4')])&&_0x527a48[_0x3816('0xd5')]===_0x3816('0xd6')&&_0xb71d9e){if(_0xb71d9e['type']!==_0x3816('0x86')&&this[_0x3816('0x1d')][_0xb71d9e['queue']][_0x3816('0xd7')]&&_0x527a48[_0x3816('0xd8')]===_0x3816('0xd9')){delete this[_0x3816('0x22')][_0x527a48[_0x3816('0xd2')]];this[_0x3816('0xa8')](this['voiceQueues'][_0xb71d9e[_0x3816('0xa6')]]);this[_0x3816('0x1d')][_0xb71d9e[_0x3816('0xa6')]][_0x3816('0x5a')]+=0x1;this[_0x3816('0x1d')][_0xb71d9e[_0x3816('0xa6')]][_0x3816('0xda')]+=0x1;_0x2ce84f=new Hangup(_0xb71d9e,_0x527a48);_0x2ce84f[_0x3816('0x9b')]=0x12;_0x2ce84f[_0x3816('0xdb')]=_0x3816('0xdc');_0x2ce84f['membername']=_0x3816('0xdd');this['saveInDb'](_0x2ce84f,_0x3816('0xde'),_0x3816('0xdf'));}if(_0xb71d9e[_0x3816('0x48')]!==_0x3816('0x86')&&this['voiceQueues'][_0xb71d9e[_0x3816('0xa6')]]['dialAMDActive']&&_0x527a48[_0x3816('0xd8')]===_0x3816('0xe0')){delete this[_0x3816('0x22')][_0x527a48[_0x3816('0xd2')]];this[_0x3816('0xa8')](this[_0x3816('0x1d')][_0xb71d9e[_0x3816('0xa6')]]);this['voiceQueues'][_0xb71d9e[_0x3816('0xa6')]][_0x3816('0x5a')]+=0x1;this[_0x3816('0x1d')][_0xb71d9e[_0x3816('0xa6')]][_0x3816('0xda')]+=0x1;_0x2ce84f=new Hangup(_0xb71d9e,_0x527a48);_0x2ce84f[_0x3816('0x9b')]=0x13;_0x2ce84f[_0x3816('0xdb')]='Machine';_0x2ce84f[_0x3816('0xe1')]='AMD';_0x2ce84f[_0x3816('0xe2')]=!![];this['saveInDb'](_0x2ce84f,_0x3816('0xe3'),'[syncMachine]');}if(_0xb71d9e[_0x3816('0x48')]===_0x3816('0x86')&&this[_0x3816('0x1e')][_0xb71d9e[_0x3816('0xa6')]][_0x3816('0xd7')]&&_0x527a48[_0x3816('0xd8')]==='HANGUP'){delete this[_0x3816('0x22')][_0x527a48[_0x3816('0xd2')]];this[_0x3816('0xa8')](this['campaigns'][_0xb71d9e[_0x3816('0xa6')]]);_0x2ce84f=new Hangup(_0xb71d9e,_0x527a48);_0x2ce84f[_0x3816('0x9b')]=0x12;_0x2ce84f[_0x3816('0xdb')]='HangupInAMD';_0x2ce84f[_0x3816('0xe1')]=_0x3816('0xdd');this[_0x3816('0xc3')](_0x2ce84f,_0x3816('0xe4'),_0x3816('0xe5'));}if(_0xb71d9e[_0x3816('0x48')]===_0x3816('0x86')&&this['campaigns'][_0xb71d9e[_0x3816('0xa6')]]['dialAMDActive']&&_0x527a48['value']==='MACHINE'){delete this[_0x3816('0x22')][_0x527a48[_0x3816('0xd2')]];this[_0x3816('0xa8')](this[_0x3816('0x1e')][_0xb71d9e[_0x3816('0xa6')]]);_0x2ce84f=new Hangup(_0xb71d9e,_0x527a48);_0x2ce84f[_0x3816('0x9b')]=0x13;_0x2ce84f[_0x3816('0xdb')]='Machine';_0x2ce84f[_0x3816('0xe1')]=_0x3816('0xdd');_0x2ce84f[_0x3816('0xe2')]=!![];this[_0x3816('0xc3')](_0x2ce84f,'[syncMachineIvr][createHistory]','[syncMachineIvr]');}}};Dialer[_0x3816('0x9d')]['syncHangup']=function(_0x4a5155){var _0x2e9abd=this[_0x3816('0x22')][_0x4a5155[_0x3816('0xd2')]];var _0x2f3c82=this;var _0x162ef4;if(_0x2e9abd&&_0x2e9abd[_0x3816('0x48')]===_0x3816('0x86')){delete this[_0x3816('0x22')][_0x4a5155['uniqueid']];this[_0x3816('0xa8')](this[_0x3816('0x1e')][_0x2e9abd[_0x3816('0xa6')]]);this[_0x3816('0x1e')][_0x2e9abd[_0x3816('0xa6')]][_0x3816('0xe6')]+=0x1;_0x162ef4=new Hangup(_0x2e9abd,_0x4a5155);this[_0x3816('0xbf')](_0x162ef4)[_0x3816('0xa4')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3816('0xbd')](_0x162ef4)[_0x3816('0xa4')](loggerCatch(_0x3816('0xe7')));}if(_0x2e9abd&&_0x2e9abd[_0x3816('0x48')]!==_0x3816('0x86')&&isNotNull(this[_0x3816('0x1d')][_0x2e9abd[_0x3816('0xa6')]][_0x3816('0xe8')])){delete this[_0x3816('0x22')][_0x4a5155[_0x3816('0xd2')]];this[_0x3816('0xa8')](this['voiceQueues'][_0x2e9abd[_0x3816('0xa6')]]);this[_0x3816('0x1d')][_0x2e9abd[_0x3816('0xa6')]][_0x3816('0x5a')]+=0x1;this['voiceQueues'][_0x2e9abd[_0x3816('0xa6')]][_0x3816('0xda')]+=0x1;_0x162ef4=new Hangup(_0x2e9abd,_0x4a5155);_0x162ef4[_0x3816('0x9b')]=0x10;_0x162ef4['statedesc']=_0x3816('0xe9');_0x162ef4[_0x3816('0xe1')]='AGI';this[_0x3816('0xbf')](_0x162ef4)['catch'](loggerCatch(_0x3816('0xea')));this[_0x3816('0xbd')](_0x162ef4)['catch'](loggerCatch(_0x3816('0xe7')));}if(_0x2e9abd&&_0x2e9abd[_0x3816('0x48')]!==_0x3816('0x86')&&!isNotNull(this[_0x3816('0x1d')][_0x2e9abd[_0x3816('0xa6')]][_0x3816('0xe8')])){delete this[_0x3816('0x22')][_0x4a5155[_0x3816('0xd2')]];this['updateOriginated'](this['voiceQueues'][_0x2e9abd[_0x3816('0xa6')]]);this[_0x3816('0x1d')][_0x2e9abd['queue']][_0x3816('0x63')]+=0x1;_0x162ef4=new Hangup(_0x2e9abd,_0x4a5155);_0x162ef4[_0x3816('0x9b')]=0xc;_0x162ef4[_0x3816('0xdb')]=_0x4a5155[_0x3816('0xeb')];_0x162ef4[_0x3816('0xe1')]='Unknow';this[_0x3816('0xbf')](_0x162ef4)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x162ef4)[_0x3816('0xa4')](loggerCatch(_0x3816('0xe7')));}};Dialer[_0x3816('0x9d')][_0x3816('0x2f')]=function(_0x494df7){var _0x8c5c9d=this['uniqueId'][_0x494df7[_0x3816('0xd2')]];var _0x3a01e5=this;if(this[_0x3816('0x1d')][_0x494df7['queue']]){if(_0x8c5c9d&&_0x8c5c9d[_0x3816('0x48')]!=='ivr'){delete this[_0x3816('0x22')][_0x494df7[_0x3816('0xd2')]];this['voiceQueues'][_0x494df7[_0x3816('0xa6')]]['outboundAnswerCallsDay']+=0x1;var _0xe756c5=new AgentComplete(_0x8c5c9d,_0x494df7);if(_0x494df7[_0x3816('0xec')]===_0x3816('0xed')){_0xe756c5[_0x3816('0xee')]=this[_0x3816('0x1d')][_0x494df7[_0x3816('0xa6')]][_0x3816('0xef')]&&this[_0x3816('0x1d')][_0x494df7[_0x3816('0xa6')]][_0x3816('0xf0')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x3816('0xbf')](_0xe756c5)['catch'](loggerCatch(_0x3816('0xf1')));this[_0x3816('0xbd')](_0xe756c5)[_0x3816('0xa4')](loggerCatch(_0x3816('0xf2')));}}};Dialer[_0x3816('0x9d')][_0x3816('0x29')]=function(_0x5e891f){if(this['voiceQueues'][_0x5e891f['queue']]){if(this[_0x3816('0x22')][_0x5e891f[_0x3816('0xd2')]]&&this[_0x3816('0x22')][_0x5e891f[_0x3816('0xd2')]][_0x3816('0x48')]!=='ivr'){this[_0x3816('0xa8')](this['voiceQueues'][_0x5e891f[_0x3816('0xa6')]]);this[_0x3816('0x22')][_0x5e891f[_0x3816('0xd2')]][_0x3816('0xf3')]=moment()[_0x3816('0x73')](_0x3816('0xf4'));}}};Dialer['prototype'][_0x3816('0xf5')]=function(_0x4a894d){this[_0x3816('0xbf')](_0x4a894d)['catch'](loggerCatch(_0x3816('0xf1')));this[_0x3816('0xbd')](_0x4a894d)['catch'](loggerCatch(_0x3816('0xf6')));};Dialer[_0x3816('0x9d')][_0x3816('0x2c')]=function(_0x498286){var _0xcc439f=this[_0x3816('0x22')][_0x498286['uniqueid']];var _0x46be61=this;if(this[_0x3816('0x1d')][_0x498286['queue']]){if(_0xcc439f&&_0xcc439f[_0x3816('0x48')]!==_0x3816('0x86')){delete this[_0x3816('0x22')][_0x498286[_0x3816('0xd2')]];this['updateOriginated'](this[_0x3816('0x1d')][_0x498286['queue']]);_0xcc439f[_0x3816('0xf7')]=moment()[_0x3816('0x73')](_0x3816('0xf4'));var _0x5b59a1=new QueueCallerAbandon(_0xcc439f,_0x498286);if(getSeconds(_0xcc439f[_0x3816('0xf7')],_0xcc439f[_0x3816('0xf8')])>=_0xcc439f[_0x3816('0xf9')]){this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0x68')]+=0x1;this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0x5e')]+=0x1;this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0x6a')]+=0x1;_0x5b59a1[_0x3816('0x9b')]=0xa;_0x5b59a1[_0x3816('0xdb')]=_0x3816('0xfa');_0x5b59a1[_0x3816('0xfb')]=_0x3816('0xfc');_0x5b59a1[_0x3816('0xee')]=this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0xef')]?moment()[_0x3816('0x73')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x5b59a1[_0x3816('0xfd')]+=0x1;_0x5b59a1[_0x3816('0xfe')]+=0x1;if(_0x5b59a1[_0x3816('0xfd')]>=this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]]['dialDropMaxRetry']){this[_0x3816('0xf5')](_0x5b59a1);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x5b59a1[_0x3816('0xfd')],'scheduledat':moment()[_0x3816('0xff')](this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0x100')],_0x3816('0x101'))[_0x3816('0x73')](_0x3816('0xf4')),'ContactId':_0xcc439f['ContactId'],'ListId':_0xcc439f[_0x3816('0x102')],'VoiceQueueId':_0xcc439f[_0x3816('0xc7')]||undefined,'CampaignId':_0xcc439f[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch(_0x3816('0x103')));var _0x5c7595=new History(_0x5b59a1);_0x5c7595[_0x3816('0x9b')]=0xa;_0x5c7595[_0x3816('0xdb')]=_0x3816('0xfa');_0x5c7595['starttime']=moment()[_0x3816('0x73')]('YYYY-MM-DD\x20HH:mm:ss');_0x5c7595[_0x3816('0x9c')]=_0x5c7595[_0x3816('0x104')];_0x5c7595['calleridname']=_0x5b59a1['calleridname'];_0x5c7595[_0x3816('0x105')]=_0x5b59a1[_0x3816('0x105')];console[_0x3816('0x106')](_0x3816('0x107'),_0x498286);console[_0x3816('0x106')](_0x3816('0x108'),_0x5b59a1);console[_0x3816('0x106')]('CRIS\x20createHistory\x2010.2\x20',_0x5c7595);this[_0x3816('0xbf')](_0x5c7595)['catch'](loggerCatch(_0x3816('0x109')));}}else{this['voiceQueues'][_0x498286[_0x3816('0xa6')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5b59a1['state']=0xb;_0x5b59a1['statedesc']='Abandoned';_0x5b59a1[_0x3816('0xfb')]=_0x3816('0x10a');_0x5b59a1[_0x3816('0x10b')]+=0x1;_0x5b59a1[_0x3816('0xfe')]+=0x1;if(_0x5b59a1[_0x3816('0x10b')]>=this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0x10c')]){this[_0x3816('0xf5')](_0x5b59a1);}else{this[_0x3816('0xb5')]({'active':![],'countabandonedretry':_0x5b59a1[_0x3816('0x10b')],'scheduledat':moment()[_0x3816('0xff')](this[_0x3816('0x1d')][_0x498286[_0x3816('0xa6')]][_0x3816('0x10d')],'minutes')[_0x3816('0x73')](_0x3816('0xf4')),'ContactId':_0xcc439f[_0x3816('0xc5')],'ListId':_0xcc439f[_0x3816('0x102')],'VoiceQueueId':_0xcc439f[_0x3816('0xc7')]||undefined,'CampaignId':_0xcc439f[_0x3816('0xc8')]||undefined})['catch'](loggerCatch(_0x3816('0x10e')));var _0x5c7595=new History(_0x5b59a1);_0x5c7595[_0x3816('0x9b')]=0xb;_0x5c7595[_0x3816('0xdb')]='Abandoned';_0x5c7595[_0x3816('0x104')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5c7595[_0x3816('0x9c')]=_0x5c7595['starttime'];_0x5c7595[_0x3816('0x10f')]=_0x5b59a1['calleridname'];_0x5c7595[_0x3816('0x105')]=_0x5b59a1[_0x3816('0x105')];console['log'](_0x3816('0x110'),_0x5c7595);this[_0x3816('0xbf')](_0x5c7595)[_0x3816('0xa4')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x3816('0x9d')][_0x3816('0x30')]=function(_0x3606b2){if(this[_0x3816('0xa0')][_0x3606b2[_0x3816('0xd2')]]){this['actions'][_0x3606b2[_0x3816('0xd2')]][_0x3816('0xa3')]=_0x3606b2['channel'];}if(this[_0x3816('0x22')][_0x3606b2[_0x3816('0xd2')]]){this[_0x3816('0x22')][_0x3606b2['uniqueid']][_0x3816('0xa3')]=_0x3606b2[_0x3816('0xa3')];}};Dialer[_0x3816('0x9d')][_0x3816('0x33')]=function(_0x4f243f){if(strategy[this[_0x3816('0x1d')][this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]][_0x3816('0xa6')]][_0x3816('0x4a')]]===_0x3816('0x18')){if(this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]]&&_[_0x3816('0xa1')](this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]][_0x3816('0x112')])&&_0x4f243f[_0x3816('0xa2')]==='1'&&_0x4f243f['paused']==='0'){if(this[_0x3816('0x1f')][_0x4f243f[_0x3816('0x113')]]){if(!this['agents'][_0x4f243f[_0x3816('0x113')]][_0x3816('0x112')]){this[_0x3816('0x1f')][_0x4f243f[_0x3816('0x113')]][_0x3816('0x112')]=!![];this['actions'][_0x4f243f[_0x3816('0x111')]]['locked']=!![];this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]]['stateinterface']=_0x4f243f[_0x3816('0x113')];}}}}else if((strategy[this[_0x3816('0x1d')][this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]][_0x3816('0xa6')]][_0x3816('0x4a')]]||_0x3816('0x17'))==='rrmemory'){if(this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]]){if(this[_0x3816('0x1f')][_0x4f243f[_0x3816('0x113')]]){this['actions'][_0x4f243f['actionid']][_0x3816('0x113')]=_0x4f243f[_0x3816('0x113')];if(_[_0x3816('0xa1')](this[_0x3816('0x27')][this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]][_0x3816('0xa6')]])){this[_0x3816('0x27')][this['actions'][_0x4f243f[_0x3816('0x111')]][_0x3816('0xa6')]]=[];}this['queueBooked'][this[_0x3816('0xa0')][_0x4f243f[_0x3816('0x111')]][_0x3816('0xa6')]][_0x3816('0x114')](_['merge'](_[_0x3816('0x115')](this[_0x3816('0xa0')][_0x4f243f['actionid']],['idHopper','stateinterface']),{'status':_0x4f243f[_0x3816('0xa2')],'paused':_0x4f243f['paused']}));}}}};function unlockQueueStatus(_0x3f07bd,_0x58a5b0){setTimeout(function(){if(_[_0x3816('0x37')](_0x3f07bd[_0x3816('0x116')])){loggerBooked[_0x3816('0x8a')]('[unlockQueueStatus][undefined]',_0x58a5b0);}_0x3f07bd[_0x3816('0x116')]=!![];loggerBooked[_0x3816('0x78')](_0x3816('0x117'),_0x58a5b0,JSON[_0x3816('0x43')](_['pick'](_0x3f07bd,['name','queueStatusComplete'])));},0x1f3);}Dialer[_0x3816('0x9d')]['syncQueueStatusComplete']=function(_0x5cb42b){var _0x3b46bf=this;var _0x2099ba=_0x3b46bf[_0x3816('0x1d')][_0x3b46bf['actions'][_0x5cb42b[_0x3816('0x111')]]['queue']];if(strategy[this['voiceQueues'][this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]]['strategy']]===_0x3816('0x18')){if(this[_0x3816('0xa0')][_0x5cb42b['actionid']]&&this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0x113')]){this[_0x3816('0x1c')][_0x3816('0x118')](this['actions'][_0x5cb42b[_0x3816('0x111')]][_0x3816('0x119')],this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]]['stateinterface'])[_0x3816('0xa4')](function(_0x8d29a1){logger[_0x3816('0x8a')](_0x3816('0x11a'),util[_0x3816('0x8b')](_0x8d29a1,{'showHidden':![],'depth':null}));})[_0x3816('0x11b')](function(){_0x3b46bf[_0x3816('0xa8')](_0x3b46bf[_0x3816('0x1d')][_0x3b46bf[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]]);_0x3b46bf[_0x3816('0x1f')][_0x3b46bf[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0x113')]][_0x3816('0x112')]=![];delete _0x3b46bf[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]];unlockQueueStatus(_0x2099ba);});}else{this[_0x3816('0xa8')](this[_0x3816('0x1d')][this[_0x3816('0xa0')][_0x5cb42b['actionid']][_0x3816('0xa6')]]);this[_0x3816('0xb5')]({'active':![],'ContactId':this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xc5')],'ListId':this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0x102')],'VoiceQueueId':this['actions'][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xc7')]||undefined,'CampaignId':this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xc8')]||undefined})['catch'](loggerCatch(_0x3816('0x11c')));delete this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]];unlockQueueStatus(_0x2099ba);}}else if((strategy[this['voiceQueues'][this[_0x3816('0xa0')][_0x5cb42b['actionid']]['queue']]['strategy']]||_0x3816('0x17'))===_0x3816('0x17')){var _0x3e234b;if(this[_0x3816('0xa0')][_0x5cb42b['actionid']]&&!_[_0x3816('0x3f')](this['queueBooked'][this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]])){if(this[_0x3816('0x11d')][_0x3b46bf[_0x3816('0xa0')][_0x5cb42b['actionid']]['queue']]){this[_0x3816('0x11d')][_0x3b46bf[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]]=this[_0x3816('0x11d')][this[_0x3816('0xa0')][_0x5cb42b['actionid']]['queue']]?this[_0x3816('0x11d')][this['actions'][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]]:this['queueBooked'][this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]]?this[_0x3816('0x27')][this[_0x3816('0xa0')][_0x5cb42b[_0x3816('0x111')]][_0x3816('0xa6')]][_0x3816('0x11e')]||0x0:0x0;}this[_0x3816('0x27')][this['actions'][_0x5cb42b['actionid']][_0x3816('0xa6')]][_0x3816('0x11e')]=this['queueBookedRR'][this['actions'][_0x5cb42b[_0x3816('0x111')]]['queue']];for(var _0x28c513=0x0;_0x28c513=0x0?!![]:![];})[_0x3816('0xa4')](myreject(_0x39b81e)));}}else{_0x4bbc1b[_0x3816('0x114')](ami[_0x3816('0x136')]({'action':_0x3816('0x137'),'command':util[_0x3816('0x73')](_0x3816('0x138'),_0x5ed2b7,!_[_0x3816('0x37')](config[_0x3816('0x132')][_0x5f1d18])?_0x5f1d18:'')})['then'](function(_0x377a9d){return _0x377a9d[_0x3816('0x13a')][_0x3816('0x13b')]('true')>=0x0?!![]:![];})['catch'](myreject(_0x39b81e)));}BPromise[_0x3816('0x13d')](_0x4bbc1b)[_0x3816('0xac')](function(_0x2a6b79){var _0x109db5=_[_0x3816('0x13e')](_0x2a6b79);if(_0x109db5){return _0x356577(_0x109db5);}else{_0x5996d1[_0x3816('0x38')]=_0x43219e?_0x3816('0x13f'):_0x3816('0x140');return _0x39b81e(msgResponse(_0x3816('0x141'),_0x3816('0x130'),_0x3816('0x142')+_0x43219e+'\x20'+_0x2ba114+_0x3816('0x143')+util[_0x3816('0x8b')](_0x5ed2b7,{'showHidden':![],'depth':null})+_0x3816('0x144')+_0x5f1d18));}})['catch'](function(_0x40c47f){return _0x39b81e(msgResponse('ifTime',_0x3816('0x130'),JSON['stringify'](_0x40c47f)));});});};Dialer['prototype'][_0x3816('0x145')]=function(_0x579e1c){var _0x17d3af=this;return function(){switch(_0x579e1c['dialMethod']){case _0x3816('0x146'):freeVariablesPredictive(_0x579e1c);_0x17d3af[_0x3816('0x147')](_0x579e1c,0x1);break;case _0x3816('0x148'):freeVariablesPredictive(_0x579e1c);_0x17d3af[_0x3816('0x147')](_0x579e1c,_0x579e1c['dialPowerLevel']);break;case'predictive':_0x17d3af[_0x3816('0x8')](_0x579e1c);break;case'booked':freeVariablesPredictive(_0x579e1c);_0x17d3af[_0x3816('0x147')](_0x579e1c,0x1);break;default:freeVariablesPredictive(_0x579e1c);logger[_0x3816('0x8a')](_0x3816('0x149'),_0x579e1c[_0x3816('0x3a')],_0x3816('0x14a'));}};};Dialer[_0x3816('0x9d')][_0x3816('0x14b')]=function(_0x5e1b34){var _0x50db87=this;return function(){_0x50db87['handleIvr'](_0x5e1b34);};};Dialer[_0x3816('0x9d')][_0x3816('0x14c')]=function(_0x24adb6){var _0x29ff28=this;if(isNotPreview(_0x24adb6[_0x3816('0x55')])){if(isVoiceQueueOutbound(_0x24adb6['type'])&&isActive(_0x24adb6[_0x3816('0x54')])){_0x24adb6['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x3816('0xac')](checkIsLoggedIn(_0x24adb6,_0x24adb6[_0x3816('0x4c')]))[_0x3816('0xac')](checkIsActive(_0x24adb6,_0x24adb6[_0x3816('0x54')]))['then'](checkInterval(_0x24adb6))[_0x3816('0xac')](_0x29ff28[_0x3816('0x129')](_0x24adb6))[_0x3816('0xac')](_0x29ff28[_0x3816('0x12d')](_0x24adb6[_0x3816('0x14d')],_0x24adb6[_0x3816('0x14e')],_0x24adb6[_0x3816('0x3a')],_0x24adb6))[_0x3816('0xac')](_0x29ff28[_0x3816('0x12f')](_0x24adb6[_0x3816('0x3c')],_0x24adb6[_0x3816('0x14e')],_0x24adb6[_0x3816('0x3a')],_0x24adb6))[_0x3816('0xac')](_0x29ff28[_0x3816('0x145')](_0x24adb6))[_0x3816('0xa4')](loggerCatchQueueSummary(_0x3816('0x14f'),_0x24adb6));}else{notSendMessagesQueue(_0x24adb6);}}else{freeVariablesPredictive(_0x24adb6);}};Dialer[_0x3816('0x9d')][_0x3816('0x128')]=function(){var _0x535174=this;var _0x108a44;for(var _0xc07e05 in this[_0x3816('0x1e')]){if(this['campaigns']['hasOwnProperty'](_0xc07e05)){_0x108a44=this[_0x3816('0x1e')][_0xc07e05];if(isCampaignIvr(_0x108a44['type'])&&isActive(_0x108a44[_0x3816('0x72')])){_0x108a44[_0x3816('0x96')]=!![];BPromise['resolve']()[_0x3816('0xac')](checkIsActive(_0x108a44,_0x108a44['active']))[_0x3816('0xac')](checkInterval(_0x108a44))['then'](_0x535174[_0x3816('0x129')](_0x108a44))[_0x3816('0xac')](_0x535174['checkIfTime'](_0x108a44[_0x3816('0x14d')],_0x108a44[_0x3816('0x14e')],_0x108a44[_0x3816('0x3a')],_0x108a44))[_0x3816('0xac')](_0x535174['checkIfTimeIntervals'](_0x108a44[_0x3816('0x3c')],_0x108a44[_0x3816('0x14e')],_0x108a44[_0x3816('0x3a')],_0x108a44))['then'](_0x535174[_0x3816('0x14b')](_0x108a44))[_0x3816('0xa4')](loggerCatchQueueSummary(_0x3816('0x150'),_0x108a44));}else{notSendMessagesCampaign(_0x108a44);}}}};function getCallerIdRandom(_0x1592ee,_0x43501b){var _0x4d9635,_0x16f799,_0x3585ee;if(_0x43501b<=0x0){_0x43501b=0x1;}_0x4d9635=new RegExp(_0x3816('0x151')+_0x43501b+'}$');_0x16f799=Math[_0x3816('0x152')](0xa,_0x43501b-0x1);_0x3585ee=Math[_0x3816('0x152')](0xa,_0x43501b)-0x1;return util[_0x3816('0x73')]('%s',_[_0x3816('0x153')](_0x1592ee,_0x4d9635,_['random'](_0x16f799,_0x3585ee)));}function extractCalleridName(_0x110246){var _0x24f0f4=_0x110246[_0x3816('0x154')](/"(.*?)"/);return _0x24f0f4?_0x24f0f4[0x1]:_0x110246;}function extractCalleridNumber(_0x25a1a3){var _0x37bfa6=_0x25a1a3[_0x3816('0x154')](/<(.*?)>/);return _0x37bfa6?_0x37bfa6[0x1]:_0x25a1a3;}Dialer[_0x3816('0x9d')][_0x3816('0x155')]=function(_0x5d8669,_0x472d19){var _0x119cf7=this;var _0x5d9e0d=uuid['v4']();this[_0x3816('0xa0')][_0x5d9e0d]=new Action(_0x5d8669,_0x472d19,_0x5d9e0d);return new BPromise(function(_0x3c0596,_0x49cc58){if(_[_0x3816('0x37')](_0x5d8669)&&_0x3816('0x156')!==typeof _0x5d8669){return _0x49cc58(msgResponse('originate',_0x3816('0x130'),_0x3816('0x157')));}if(_['isUndefined'](_0x472d19[_0x3816('0x158')][_0x3816('0x159')])||_0x472d19['Contact'][_0x3816('0x159')]===null){return _0x49cc58(msgResponse(_0x3816('0x15a'),_0x3816('0x130'),_0x3816('0x15b')));}var _0x33eb49={'XMD-CALLERID':_0x119cf7[_0x3816('0xa0')][_0x5d9e0d]['getCaller'](),'XMD-AGI':_0x5d8669[_0x3816('0xe8')]?util['format'](_0x3816('0x15c'),ipAgi,_0x5d8669[_0x3816('0xe8')]):'NONE','XMD-AGIAFTER':_0x5d8669[_0x3816('0xef')]?util[_0x3816('0x73')](_0x3816('0x15c'),ipAgi,_0x5d8669[_0x3816('0xef')]):'NONE','XMD-QUEUE':_0x5d8669[_0x3816('0x48')]==='outbound'?util[_0x3816('0x73')]('\x22%s,%s%s,,,%s\x22',_0x5d8669['name'],_0x5d8669[_0x3816('0x15d')]||'',_0x5d8669[_0x3816('0xf0')]?'c':'',_0x5d8669['dialQueueTimeout']||0x3):_0x3816('0x15e'),'XMD-CONTACTID':_0x472d19[_0x3816('0xc5')],'XMD-CDRTYPE':_0x3816('0x15f'),'CALLERID(all)':_0x119cf7[_0x3816('0xa0')][_0x5d9e0d]['getCaller'](),'XMD-AMD':_0x5d8669[_0x3816('0xd7')]?_0x3816('0x160'):_0x3816('0x15e'),'XMD-DESTINATION':_0x3816('0xd6')};if(_0x5d8669[_0x3816('0xd7')]){_0x33eb49[_0x3816('0x161')]=_0x5d8669['dialAMDInitialSilence']||0x9c4;_0x33eb49[_0x3816('0x162')]=_0x5d8669[_0x3816('0x163')]||0x5dc;_0x33eb49[_0x3816('0x164')]=_0x5d8669['dialAMDAfterGreetingSilence']||0x320;_0x33eb49['XMD-AMDTOTALANALYSISTIME']=_0x5d8669['dialAMDTotalAnalysisTime']||0x1388;_0x33eb49['XMD-AMDMINWORDLENGTH']=_0x5d8669[_0x3816('0x165')]||0x64;_0x33eb49[_0x3816('0x166')]=_0x5d8669['dialAMDBetweenWordsSilence']||0x32;_0x33eb49[_0x3816('0x167')]=_0x5d8669[_0x3816('0x168')]||0x3;_0x33eb49['XMD-AMDSILENCETHRESHOLD']=_0x5d8669[_0x3816('0x169')]||0x100;_0x33eb49[_0x3816('0x16a')]=_0x5d8669[_0x3816('0x16b')]||0x1388;}if(_0x5d8669[_0x3816('0x48')]===_0x3816('0x49')){_0x33eb49['XMD-VOICEQUEUEID']=_0x472d19[_0x3816('0xc7')];}else{_0x33eb49[_0x3816('0x16c')]=_0x472d19[_0x3816('0xc8')];}for(var _0x4669a1 in _0x472d19[_0x3816('0x158')]){if(_0x472d19[_0x3816('0x158')]['hasOwnProperty'](_0x4669a1)){if(isNotNull(_0x472d19[_0x3816('0x158')][_0x4669a1])&&_0x4669a1!=='id'&&_0x4669a1!=='tags'&&_0x4669a1!=='createdAt'&&_0x4669a1!==_0x3816('0x16d')){_0x33eb49[util[_0x3816('0x73')](_0x3816('0x16e'),_0x3816('0x16f'),_['toUpper'](_0x4669a1))]=_0x472d19[_0x3816('0x158')][_0x4669a1];}}}var _0x1cef4f=_0x119cf7[_0x3816('0xcd')](_0x5d8669[_0x3816('0x71')])?getCallerId(_0x5d8669[_0x3816('0x71')]['callerid'],_0x5d8669[_0x3816('0x56')],_0x5d8669['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x5d8669['dialOriginateCallerIdNumber'],_0x5d8669[_0x3816('0x170')]):_0x5d8669['dialOriginateCallerIdNumber']):getCallerId(_[_0x3816('0xa1')](_0x5d8669['TrunkBackup'])?_0x5d8669[_0x3816('0x71')][_0x3816('0x171')]:_0x5d8669[_0x3816('0x12a')]['callerid'],_0x5d8669[_0x3816('0x56')],_0x5d8669[_0x3816('0x170')]>0x0?getCallerIdRandom(_0x5d8669[_0x3816('0x57')],_0x5d8669[_0x3816('0x170')]):_0x5d8669[_0x3816('0x57')]);if(_0x1cef4f){_0x33eb49[_0x3816('0x172')]=_0x119cf7['actions'][_0x5d9e0d][_0x3816('0x173')]=extractCalleridName(_0x1cef4f);_0x33eb49[_0x3816('0x174')]=_0x119cf7['actions'][_0x5d9e0d][_0x3816('0x175')]=extractCalleridNumber(_0x1cef4f);}return ami[_0x3816('0x136')]({'actionid':_0x5d9e0d,'action':_0x3816('0x15a'),'channel':_0x119cf7['isTrunkReachable'](_0x5d8669[_0x3816('0x71')])?util['format'](_0x3816('0x176'),_0x5d8669[_0x3816('0x71')][_0x3816('0x3a')],isNotNull(_0x5d8669[_0x3816('0x59')])?_0x5d8669[_0x3816('0x59')][_0x3816('0x177')]()||'':'',_0x5d8669[_0x3816('0x178')]>0x0?_0x472d19[_0x3816('0x158')]['phone'][_0x3816('0x179')](_0x5d8669[_0x3816('0x178')]):_0x472d19[_0x3816('0x158')][_0x3816('0x159')]):util[_0x3816('0x73')](_0x3816('0x176'),_[_0x3816('0xa1')](_0x5d8669[_0x3816('0x12a')])?_0x5d8669[_0x3816('0x71')][_0x3816('0x3a')]:_0x5d8669[_0x3816('0x12a')][_0x3816('0x3a')],isNotNull(_0x5d8669[_0x3816('0x59')])?_0x5d8669[_0x3816('0x59')][_0x3816('0x177')]()||'':'',_0x5d8669[_0x3816('0x178')]>0x0?_0x472d19[_0x3816('0x158')][_0x3816('0x159')][_0x3816('0x179')](_0x5d8669['dialCutDigit']):_0x472d19[_0x3816('0x158')]['phone']),'callerid':_0x1cef4f,'Exten':'xcally-motion-dialer','Context':_0x3816('0x17a'),'Priority':'1','variable':_0x33eb49,'timeout':(_0x5d8669['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5d9e0d})[_0x3816('0xac')](function(_0x2ad350){return _0x3c0596(_0x2ad350);})[_0x3816('0xa4')](function(_0x2fcaf6){_0x5d8669[_0x3816('0x17b')]+=0x1;var _0x2a8fef=new History(_0x119cf7[_0x3816('0xa0')][_0x5d9e0d]);logger[_0x3816('0x8a')](util[_0x3816('0x73')](_0x3816('0x17c'),JSON['stringify'](_0x2fcaf6)));_0x2a8fef['state']=0xe;_0x2a8fef[_0x3816('0xdb')]=_0x3816('0x17d');_0x2a8fef[_0x3816('0x104')]=moment()[_0x3816('0x73')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a8fef[_0x3816('0x9c')]=_0x2a8fef['starttime'];_0x119cf7[_0x3816('0xbf')](_0x2a8fef)['catch'](loggerCatch(_0x3816('0x17e')));_0x119cf7['moveContactManagedDialer'](_0x2a8fef)[_0x3816('0xa4')](loggerCatch(_0x3816('0x17e')))[_0x3816('0x11b')](function(){delete _0x119cf7[_0x3816('0xa0')][_0x5d9e0d];return _0x49cc58(msgResponse('originate','Error',_0x3816('0x17f')));});});});};Dialer[_0x3816('0x9d')]['syncOriginateResponse']=function(_0x449a67){var _0x28e6fe=this[_0x3816('0xa0')][_0x449a67['actionid']];var _0x284b5e=this;if(_0x28e6fe){delete this[_0x3816('0xa0')][_0x449a67[_0x3816('0x111')]];_0x28e6fe['responsetime']=moment()[_0x3816('0x73')](_0x3816('0xf4'));var _0x2c078b=_0x28e6fe['type']===_0x3816('0x86')?this[_0x3816('0x1e')][_0x28e6fe[_0x3816('0xa6')]]:this[_0x3816('0x1d')][_0x28e6fe['getQueue']()];if(!this[_0x3816('0xcb')](_0x449a67['response'])){this[_0x3816('0xa8')](_0x2c078b);return this['callProgressDetecting'](_0x28e6fe,_0x2c078b,_0x449a67)[_0x3816('0xac')](function(_0x5cfd6b){})[_0x3816('0xa4')](loggerCatch(_0x3816('0x180')));}else{this[_0x3816('0x22')][_0x449a67[_0x3816('0xd2')]]=_0x28e6fe;}}};Dialer[_0x3816('0x9d')][_0x3816('0x181')]=function(_0x19a53f,_0x462fcb,_0x1c98d2){var _0x659e55=new History(_0x462fcb);if(_0x659e55[_0x3816('0x182')]+_0x659e55[_0x3816('0x183')]+_0x659e55['countnoanswerretry']+_0x659e55['countnosuchnumberretry']+_0x659e55[_0x3816('0xfd')]+_0x659e55[_0x3816('0x10b')]+_0x659e55[_0x3816('0x184')]+_0x659e55['countagentrejectretry']>=_0x1c98d2['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x19a53f){case 0x3:if(_0x659e55[_0x3816('0x185')]>=_0x1c98d2[_0x3816('0x186')]-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countnoanswerretry':_0x659e55['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2['dialNoAnswerRetryFrequency'],'minutes')['format'](_0x3816('0xf4')),'ContactId':_0x659e55[_0x3816('0xc5')],'ListId':_0x659e55['ListId'],'VoiceQueueId':_0x659e55['VoiceQueueId']||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})['catch'](loggerCatch(_0x3816('0x187')));}break;case 0x5:if(_0x659e55[_0x3816('0x182')]>=_0x1c98d2['dialBusyMaxRetry']-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countbusyretry':_0x659e55[_0x3816('0x182')]+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2[_0x3816('0x188')],_0x3816('0x101'))[_0x3816('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x659e55['ContactId'],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55[_0x3816('0xc7')]||undefined,'CampaignId':_0x659e55['CampaignId']||undefined})['catch'](loggerCatch(_0x3816('0x189')));}break;case 0x8:if(_0x659e55['countcongestionretry']>=_0x1c98d2[_0x3816('0x18a')]-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countcongestionretry':_0x659e55['countcongestionretry']+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2[_0x3816('0x18b')],_0x3816('0x101'))[_0x3816('0x73')](_0x3816('0xf4')),'ContactId':_0x659e55[_0x3816('0xc5')],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55['VoiceQueueId']||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})['catch'](loggerCatch(_0x3816('0x18c')));}break;case 0x0:if(_0x659e55['countnosuchnumberretry']>=_0x1c98d2[_0x3816('0x18d')]-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countnosuchnumberretry':_0x659e55[_0x3816('0x18e')]+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2[_0x3816('0x18f')],_0x3816('0x101'))[_0x3816('0x73')](_0x3816('0xf4')),'ContactId':_0x659e55[_0x3816('0xc5')],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55[_0x3816('0xc7')]||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch(_0x3816('0x190')));}break;case 0xa:if(_0x659e55['countdropretry']>=_0x1c98d2[_0x3816('0x191')]-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countdropretry':_0x659e55[_0x3816('0xfd')]+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2[_0x3816('0x100')],_0x3816('0x101'))['format'](_0x3816('0xf4')),'ContactId':_0x659e55['ContactId'],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55[_0x3816('0xc7')]||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch(_0x3816('0x103')));}break;case 0xb:if(_0x659e55[_0x3816('0x10b')]>=_0x1c98d2['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countabandonedretry':_0x659e55[_0x3816('0x10b')]+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2[_0x3816('0x10d')],_0x3816('0x101'))['format'](_0x3816('0xf4')),'ContactId':_0x659e55[_0x3816('0xc5')],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55[_0x3816('0xc7')]||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x659e55['countmachineretry']>=_0x1c98d2[_0x3816('0x192')]-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countmachineretry':_0x659e55[_0x3816('0x184')]+=0x1,'scheduledat':moment()[_0x3816('0xff')](_0x1c98d2[_0x3816('0x193')],_0x3816('0x101'))['format'](_0x3816('0xf4')),'ContactId':_0x659e55[_0x3816('0xc5')],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55['VoiceQueueId']||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch('[rescheduleContact][Machine]'));}break;case 0x14:if(_0x659e55[_0x3816('0x194')]>=_0x1c98d2[_0x3816('0x195')]-0x1){return!![];}else{this[_0x3816('0xb5')]({'active':![],'countagentrejectretry':_0x659e55[_0x3816('0x194')]+=0x1,'scheduledat':moment()['add'](_0x1c98d2['dialAgentRejectRetryFrequency'],_0x3816('0x101'))['format'](_0x3816('0xf4')),'ContactId':_0x659e55[_0x3816('0xc5')],'ListId':_0x659e55[_0x3816('0x102')],'VoiceQueueId':_0x659e55[_0x3816('0xc7')]||undefined,'CampaignId':_0x659e55[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch('[rescheduleContact][AgentReject]'));}break;default:return!![];}};Dialer[_0x3816('0x9d')][_0x3816('0x196')]=function(_0x1b93de,_0x457924,_0x1c0a5f){var _0x73024=this;var _0x1ad2bc=new History(_0x1b93de);return new BPromise(function(_0x1a70c6,_0x2287b1){if(_['isUndefined'](_0x457924)&&_0x3816('0x156')!==typeof _0x457924){return _0x2287b1(msgResponse(_0x3816('0x197'),'Failure',_0x3816('0x198')));}if(_[_0x3816('0x37')](_0x1c0a5f)&&_0x3816('0x156')!==typeof _0x1c0a5f){return _0x2287b1(msgResponse('[callProgressDetecting]','Failure',_0x3816('0x199')));}switch(_0x1c0a5f[_0x3816('0xec')]){case'0':_0x457924[_0x3816('0x60')]+=0x1;_0x1ad2bc[_0x3816('0x9b')]=0x0;_0x1ad2bc[_0x3816('0xdb')]=_0x3816('0x19a');_0x1ad2bc[_0x3816('0x18e')]+=0x1;_0x1ad2bc['countglobal']+=0x1;_0x73024[_0x3816('0xbf')](_0x1ad2bc)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x73024[_0x3816('0x181')](0x0,_0x1b93de,_0x457924)){if(_0x1ad2bc['countbusyretry']+_0x1ad2bc[_0x3816('0x183')]+_0x1ad2bc['countnoanswerretry']+_0x1ad2bc[_0x3816('0x18e')]+_0x1ad2bc[_0x3816('0xfd')]+_0x1ad2bc['countabandonedretry']+_0x1ad2bc[_0x3816('0x184')]+_0x1ad2bc[_0x3816('0x194')]>=_0x457924[_0x3816('0x19b')]){_0x73024[_0x3816('0x19c')](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x19d'));}else{_0x73024[_0x3816('0x19e')](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x19d'));}}break;case'3':_0x457924[_0x3816('0x5f')]+=0x1;_0x1ad2bc['state']=0x3;_0x1ad2bc[_0x3816('0xdb')]=_0x3816('0x19f');_0x1ad2bc['countnoanswerretry']+=0x1;_0x1ad2bc[_0x3816('0xfe')]+=0x1;_0x73024['createHistory'](_0x1ad2bc)['catch'](loggerCatch(_0x3816('0x1a0')));if(_0x73024[_0x3816('0x181')](0x3,_0x1b93de,_0x457924)){if(_0x1ad2bc[_0x3816('0x185')]>=_0x457924[_0x3816('0x186')]){_0x73024['createStateFinal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,'reason\x203\x20ringing\x20no\x20answer');}else{_0x73024['stateGlobal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x1a1'));}}break;case'5':_0x457924['outboundBusyCallsDay']+=0x1;_0x1ad2bc[_0x3816('0x9b')]=0x5;_0x1ad2bc['statedesc']=_0x3816('0x1a2');_0x1ad2bc['countbusyretry']+=0x1;_0x1ad2bc['countglobal']+=0x1;_0x73024[_0x3816('0xbf')](_0x1ad2bc)[_0x3816('0xa4')](loggerCatch(_0x3816('0x1a3')));if(_0x73024[_0x3816('0x181')](0x5,_0x1b93de,_0x457924)){if(_0x1ad2bc['countbusyretry']>=_0x457924[_0x3816('0x1a4')]){_0x73024['createStateFinal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,'reason\x205\x20busy');}else{_0x73024[_0x3816('0x19c')](_0x1ad2bc,_0x1a70c6,_0x2287b1,'reason\x205\x20busy');}}break;case'8':_0x457924[_0x3816('0x5d')]+=0x1;_0x1ad2bc['state']=0x8;_0x1ad2bc[_0x3816('0xdb')]=_0x3816('0x1a5');_0x1ad2bc['countcongestionretry']+=0x1;_0x1ad2bc[_0x3816('0xfe')]+=0x1;_0x73024[_0x3816('0xbf')](_0x1ad2bc)[_0x3816('0xa4')](loggerCatch(_0x3816('0x1a6')));if(_0x73024[_0x3816('0x181')](0x8,_0x1b93de,_0x457924)){if(_0x1ad2bc[_0x3816('0x183')]>=_0x457924[_0x3816('0x18a')]){_0x73024[_0x3816('0x19e')](_0x1ad2bc,_0x1a70c6,_0x2287b1,'reason\x208\x20congestion');}else{_0x73024[_0x3816('0x19c')](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x1a7'));}}break;case'11':_0x457924['outboundAbandonedCallsDay']+=0x1;_0x1ad2bc[_0x3816('0x9b')]=0xb;_0x1ad2bc[_0x3816('0xdb')]='Abandoned';_0x1ad2bc['countabandonedretry']+=0x1;_0x1ad2bc['countglobal']+=0x1;_0x73024[_0x3816('0xbf')](_0x1ad2bc)['catch'](loggerCatch(_0x3816('0x1a8')));if(_0x73024['checkRetriveMax'](0xb,_0x1b93de,_0x457924)){if(_0x1ad2bc['countabandonedretry']>=_0x457924['dialAbandonedMaxRetry']){_0x73024['createStateFinal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x1a9'));}else{_0x73024[_0x3816('0x19c')](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x1a9'));}}break;case'20':_0x457924['outboundRejectCallsDay']+=0x1;_0x1ad2bc[_0x3816('0x9b')]=0x14;_0x1ad2bc[_0x3816('0xdb')]=_0x3816('0x1aa');_0x1ad2bc['countagentrejectretry']+=0x1;_0x1ad2bc['countglobal']+=0x1;_0x73024['createHistory'](_0x1ad2bc)[_0x3816('0xa4')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x73024[_0x3816('0x181')](0x14,_0x1b93de,_0x457924)){if(_0x1ad2bc['countagentrejectretry']>=_0x457924[_0x3816('0x195')]){_0x73024['createStateFinal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,'reason\x2020\x20agentreject');}else{_0x73024['stateGlobal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x3816('0x1ab'));}}break;default:_0x457924['outboundUnknownCallsDay']+=0x1;_0x1ad2bc[_0x3816('0x9b')]=0xc;_0x1ad2bc[_0x3816('0xdb')]=_0x1c0a5f[_0x3816('0xec')];_0x73024[_0x3816('0xbf')](_0x1ad2bc)['catch'](loggerCatch(_0x3816('0x1ac')));if(_0x73024[_0x3816('0x181')](_0x1c0a5f[_0x3816('0xec')],_0x1b93de,_0x457924)){if(_0x1ad2bc[_0x3816('0x182')]+_0x1ad2bc[_0x3816('0x183')]+_0x1ad2bc['countnoanswerretry']+_0x1ad2bc[_0x3816('0x18e')]+_0x1ad2bc[_0x3816('0xfd')]+_0x1ad2bc[_0x3816('0x10b')]+_0x1ad2bc[_0x3816('0x184')]+_0x1ad2bc[_0x3816('0x194')]>=_0x457924[_0x3816('0x19b')]){_0x73024[_0x3816('0x19c')](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x1c0a5f[_0x3816('0xec')]);}else{_0x73024['createStateFinal'](_0x1ad2bc,_0x1a70c6,_0x2287b1,_0x1c0a5f[_0x3816('0xec')]);}}}});};Dialer['prototype'][_0x3816('0x19c')]=function(_0x35ef26,_0x47603d,_0x538041,_0x3ff5a8){var _0x565c85=new Final(_0x35ef26);_0x565c85[_0x3816('0x9b')]=0xf;_0x565c85[_0x3816('0xdb')]='Global';this['createStateFinal'](_0x565c85,_0x47603d,_0x538041,_0x3ff5a8);};Dialer[_0x3816('0x9d')][_0x3816('0x19e')]=function(_0x56bb2c,_0x56fbb0,_0x26425d,_0x4f8775){this[_0x3816('0xbd')](_0x56bb2c)[_0x3816('0xac')](function(_0x420f72){return _0x56fbb0(msgResponse(_0x3816('0x197'),'Success',_0x4f8775));})[_0x3816('0xa4')](function(_0x17f0e1){return _0x26425d(msgResponse(_0x3816('0x1ad'),'Failure','contact\x20not\x20moved'));});};Dialer['prototype'][_0x3816('0x8')]=function(_0x3f6026){var _0x148aab=this;var _0x39ffbd=_0x3f6026['dialPredictiveOptimizationPercentage']/0x64;var _0x4fee25=_0x3f6026[_0x3816('0x5e')]/(_0x3f6026[_0x3816('0x5e')]+_0x3f6026[_0x3816('0x5a')]);var _0x139ec3=Math['round'](_0x3f6026[_0x3816('0x1ae')]*(_0x3f6026['predictiveIntervalMaxThreshold']/0x64));var _0x2e85b6=Math[_0x3816('0x1af')](_0x3f6026[_0x3816('0x1ae')]*(_0x3f6026[_0x3816('0x1b0')]/0x64));var _0x18192b=_0x3f6026['available']+_0x3f6026[_0x3816('0x95')];var _0x110427=Math[_0x3816('0x1b1')](_0x3f6026[_0x3816('0x6f')]*_0x3f6026[_0x3816('0x83')]*_0x3f6026['predictiveIntervalHitRate']*_0x3f6026['predictiveIntervalMultiplicativeFactor']);if(_[_0x3816('0x37')](_0x3f6026[_0x3816('0x25')])){if(!_[_0x3816('0x37')](_0x3f6026[_0x3816('0x24')])){_0x3f6026[_0x3816('0x24')]=undefined;loggerPredictive[_0x3816('0x8a')](_0x3816('0x1b2'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x3f6026[_0x3816('0x85')])){loggerPredictive[_0x3816('0x8a')](_0x3816('0x1b2'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x3f6026['handlePredictive']);_0x3f6026['handlePredictive']=undefined;}_0x3f6026[_0x3816('0x25')]=moment()[_0x3816('0x73')](_0x3816('0xf4'));loggerPredictive[_0x3816('0x78')](_0x3f6026[_0x3816('0x3a')],_0x3816('0x1b3'),_0x3f6026[_0x3816('0x25')]);this[_0x3816('0x147')](_0x3f6026,0x1);}else if(ifInterval(_0x3f6026[_0x3816('0x1b4')],_0x3f6026['startProgressive'])){this[_0x3816('0x147')](_0x3f6026,0x1);loggerPredictiveCalls[_0x3816('0x78')](_0x3816('0x1b5'),_0x3f6026[_0x3816('0x25')],_0x3f6026[_0x3816('0x3a')]);_0x3f6026['erlangCalls']=0x0;_0x3f6026[_0x3816('0x6a')]=0x0;}else if(_0x39ffbd<_0x4fee25&&_0x3f6026[_0x3816('0x1b6')]===_0x3816('0x1b7')){freeVariablesPredictive(_0x3f6026);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x3816('0x1b8'),_0x4fee25,_0x3816('0x25'),_0x3f6026[_0x3816('0x3a')]);}else if(_0x110427<_0x3f6026[_0x3816('0x6a')]&&_0x3f6026[_0x3816('0x1b6')]===_0x3816('0x1b7')){freeVariablesPredictive(_0x3f6026);loggerPredictive[_0x3816('0x78')](_0x3816('0x1b9'),'Max\x20Drop\x20',_0x110427,'Drop\x20in\x20this\x20interval',_0x3f6026[_0x3816('0x6a')],'startProgressive',_0x3f6026[_0x3816('0x3a')]);}else if(!ifInterval(_0x3f6026[_0x3816('0x1b4')],_0x3f6026[_0x3816('0x25')])&&_[_0x3816('0x37')](_0x3f6026[_0x3816('0x24')])&&!_['isUndefined'](_0x3f6026[_0x3816('0x25')])){_0x3f6026[_0x3816('0x24')]=moment()[_0x3816('0x73')](_0x3816('0xf4'));loggerPredictive[_0x3816('0x78')](_0x3f6026['name'],_0x3816('0x1ba'),_0x3f6026['startPredictive']);this[_0x3816('0xb2')](_0x3f6026[_0x3816('0x1b4')])[_0x3816('0xac')](this[_0x3816('0x1bb')](_0x3f6026))[_0x3816('0xac')](mergeDataErlangB(_0x3f6026))[_0x3816('0xac')](this[_0x3816('0x1bc')](_0x3f6026))[_0x3816('0xa4')](loggerCatchPredictive(_0x3816('0x1bd'),_0x3f6026));}else if(!ifInterval(_0x3f6026[_0x3816('0x1b4')],_0x3f6026[_0x3816('0x24')])){_0x3f6026[_0x3816('0x6a')]=0x0;_0x3f6026[_0x3816('0x24')]=moment()['format'](_0x3816('0xf4'));loggerPredictive['info'](_0x3f6026[_0x3816('0x3a')],'recalculate\x20predictive\x20at',_0x3f6026[_0x3816('0x24')]);clearInterval(_0x3f6026[_0x3816('0x85')]);_0x3f6026[_0x3816('0x85')]=undefined;this[_0x3816('0xb2')](_0x3f6026[_0x3816('0x1b4')])[_0x3816('0xac')](this[_0x3816('0x1bb')](_0x3f6026))[_0x3816('0xac')](mergeDataErlangB(_0x3f6026))['then'](this[_0x3816('0x1bc')](_0x3f6026))['catch'](loggerCatchPredictive(_0x3816('0x1be'),_0x3f6026));}else if(_0x3f6026[_0x3816('0x1ae')]&&_0x18192b<_0x3f6026[_0x3816('0x1ae')]-_0x2e85b6){freeVariablesPredictive(_0x3f6026);loggerPredictive['info'](_0x3f6026[_0x3816('0x3a')],_0x3816('0x1bf'),_0x18192b,')\x20are\x20less\x20than\x20threshold\x20(',_0x3f6026[_0x3816('0x1ae')],'-',_0x2e85b6,'=',_0x3f6026['predictiveIntervalAvailable']-_0x2e85b6,')');}else if(_0x3f6026[_0x3816('0x1ae')]&&_0x18192b>_0x3f6026[_0x3816('0x1ae')]+_0x139ec3){freeVariablesPredictive(_0x3f6026);loggerPredictive['info'](_0x3f6026[_0x3816('0x3a')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x18192b,_0x3816('0x1c0'),_0x3f6026['predictiveIntervalAvailable'],'+',_0x139ec3,'=',_0x3f6026[_0x3816('0x1ae')]+_0x139ec3,')');}};Dialer[_0x3816('0x9d')][_0x3816('0x1bb')]=function(_0x48419e){var _0x212fad=this;return function(_0x499f8c){return new BPromise(function(_0x2a75b5,_0x1de788){_[_0x3816('0xc4')](_0x48419e,_0x499f8c[0x0]);if(checkGetDataPredictive(_0x499f8c[0x0])){var _0x4368d3=_0x48419e[_0x3816('0x1ae')]=_0x48419e['talking']+_0x48419e[_0x3816('0x4b')];var _0x2ede0c=_0x48419e['dialPredictiveInterval']*0x3c;var _0x189fe3=_0x499f8c[0x0][_0x3816('0x66')]+_0x499f8c[0x0][_0x3816('0x65')];var _0x572634=(_0x499f8c[0x0][_0x3816('0x64')]+_0x499f8c[0x0][_0x3816('0x68')]+_0x499f8c[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x499f8c[0x0]['predictiveIntervalTotalCalls'];_0x48419e[_0x3816('0x6b')]=_0x572634>0x0?_0x572634:0x1;switch(_0x48419e['dialPredictiveOptimization']){case _0x3816('0x1b7'):var _0x779eef=_0x48419e[_0x3816('0x1c1')]/0x64;return _0x212fad[_0x3816('0x1c2')](_0x4368d3,_0x2ede0c,_0x189fe3,_0x572634,_0x779eef)[_0x3816('0xac')](function(_0x1a6584){return _0x2a75b5(_0x1a6584);});case _0x3816('0x1c3'):var _0x2bf6ca=_0x48419e[_0x3816('0x1c1')]/0x64;return _0x212fad[_0x3816('0x1c4')](_0x4368d3,_0x2ede0c,_0x189fe3,_0x572634,_0x2bf6ca)['then'](function(_0x1b987c){return _0x2a75b5(_0x1b987c);});default:return _0x1de788(msgResponse('[getDataPredictive]',_0x3816('0x130'),_0x3816('0x1c5')));}}else{return _0x1de788(msgResponse(_0x3816('0x1c6'),'Failure','check\x20failure'));}});};};Dialer[_0x3816('0x9d')]['getDataPredictiveOld']=function(_0x548997){var _0x3a8a83=this;return function(_0x36e618){return new BPromise(function(_0x350656,_0x2059e2){_[_0x3816('0xc4')](_0x548997,_0x36e618[0x0]);if(checkGetDataPredictive(_0x36e618[0x0])){loggerPredictive[_0x3816('0x78')](JSON[_0x3816('0x43')](_0x36e618[0x0]));if(_0x548997[_0x3816('0x1b6')]===_0x3816('0x1b7')){return _0x3a8a83[_0x3816('0xbb')](_0x548997['id'])[_0x3816('0xac')](function(_0x21463c){var _0x5469bf=_0x548997[_0x3816('0x4c')]-_0x21463c[0x0]['outboundQueuePauses'];var _0xe2dbe7=_0x548997[_0x3816('0x1b4')]*0x3c;var _0x5cd424=_0x36e618[0x0][_0x3816('0x66')]+_0x36e618[0x0][_0x3816('0x65')];var _0x140cee=(_0x36e618[0x0][_0x3816('0x64')]+_0x36e618[0x0][_0x3816('0x68')]+_0x36e618[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x36e618[0x0][_0x3816('0x1c7')];var _0x1eba61=_0x548997[_0x3816('0x1c1')]/0x64;_0x548997[_0x3816('0x6d')]=_0x21463c[0x0][_0x3816('0x1c8')]||0x0;_0x548997[_0x3816('0x6b')]=_0x140cee>0x0?_0x140cee:0x1;return _0x3a8a83[_0x3816('0x1c2')](_0x5469bf,_0xe2dbe7,_0x5cd424,_0x140cee,_0x1eba61);})['then'](function(_0x47094f){return _0x350656(_0x47094f);})[_0x3816('0xa4')](function(_0x397ed1){return _0x2059e2(msgResponse('[CatchErlangB]',_0x3816('0x130'),JSON['stringify'](_0x397ed1)));});}if(_0x548997['dialPredictiveOptimization']===_0x3816('0x1c3')){return _0x3a8a83[_0x3816('0xbb')](_0x548997['id'])[_0x3816('0xac')](function(_0x280991){var _0x4137d2=_0x548997[_0x3816('0x4c')]-_0x280991[0x0][_0x3816('0x1c8')];var _0x2310c7=_0x548997[_0x3816('0x1b4')]*0x3c;var _0x5510f6=_0x36e618[0x0][_0x3816('0x66')]+_0x36e618[0x0]['predictiveIntervalAvgHoldtime'];var _0x5a6a31=(_0x36e618[0x0][_0x3816('0x64')]+_0x36e618[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x36e618[0x0][_0x3816('0x67')])/_0x36e618[0x0][_0x3816('0x1c7')];var _0x3a9d37=_0x548997[_0x3816('0x1c1')]/0x64;_0x548997[_0x3816('0x6d')]=_0x280991[0x0][_0x3816('0x1c8')]||0x0;_0x548997['predictiveIntervalHitRate']=_0x5a6a31>0x0?_0x5a6a31:0x1;return _0x3a8a83[_0x3816('0x1c4')](_0x4137d2,_0x2310c7,_0x5510f6,_0x5a6a31,_0x3a9d37);})[_0x3816('0xac')](function(_0x474734){return _0x350656(_0x474734);})[_0x3816('0xa4')](function(_0x5275a9){return _0x2059e2(msgResponse(_0x3816('0x1c9'),_0x3816('0x130'),JSON[_0x3816('0x43')](_0x5275a9)));});}}else{return _0x2059e2(msgResponse(_0x3816('0x1c6'),_0x3816('0x130'),_0x3816('0x1ca')));}});};};Dialer['prototype'][_0x3816('0x1bc')]=function(_0x46e63f){var _0x5876ca=this;return function(){var _0x11dc87=0x0;var _0x544577=Math['floor'](_0x46e63f[_0x3816('0x80')]*0x3e8);if(_0x544577>0x0){_0x544577=_0x544577<0x64?0x64:_0x544577;loggerPredictive['info'](_0x46e63f[_0x3816('0x3a')],_0x3816('0x1cb'),_0x544577,_0x3816('0x44'));_0x46e63f['handlePredictive']=setInterval(function(){_0x5876ca[_0x3816('0x85')](_0x46e63f);loggerPredictiveCalls[_0x3816('0x78')]('[handlePredictive]',_0x11dc87+=0x1);},_0x544577);}else{loggerPredictive['info'](_0x46e63f['name'],_0x3816('0x1cc'));}};};Dialer[_0x3816('0x9d')]['checkContactBlack']=function(_0x37418f,_0xc61de0){var _0xd90aab=this;return function(_0x4cbaf9){if(_[_0x3816('0x3f')](_0x4cbaf9)){if(_[_0x3816('0xa1')](_0xc61de0[_0x3816('0xc6')])||!_0xc61de0['recallme']){if(_0x37418f[_0x3816('0x55')]===_0x3816('0x1cd')){_0x37418f['queueStatusComplete']=_[_0x3816('0x37')](_0x37418f[_0x3816('0x116')])?!![]:_0x37418f[_0x3816('0x116')];var _0x2c000a=uuid['v4']();_0xd90aab[_0x3816('0xa0')][_0x2c000a]=new Action(_0x37418f,_0xc61de0,_0x2c000a);loggerBooked[_0x3816('0x78')](_0x3816('0x1ce'),_0x2c000a,_0x3816('0x1cf'),JSON[_0x3816('0x43')](_0x37418f['queueStatusComplete']),_0x3816('0x1d0'),_0x37418f[_0x3816('0x3a')]);if(_0x37418f['queueStatusComplete']){_0x37418f['queueStatusComplete']=![];_0xd90aab[_0x3816('0x27')][_0xd90aab[_0x3816('0xa0')][_0x2c000a][_0x3816('0xa6')]]=[];ami[_0x3816('0x136')]({'actionid':_0x2c000a,'action':'queuestatus','queue':_0x37418f['name']})[_0x3816('0xa4')](function(_0x15acdf){_0xd90aab[_0x3816('0xa8')](_0x37418f);_0xd90aab[_0x3816('0xb5')]({'active':![],'ContactId':_0xd90aab[_0x3816('0xa0')][_0x2c000a]['ContactId'],'ListId':_0xd90aab['actions'][_0x2c000a][_0x3816('0x102')],'VoiceQueueId':_0xd90aab[_0x3816('0xa0')][_0x2c000a][_0x3816('0xc7')]||undefined,'CampaignId':_0xd90aab[_0x3816('0xa0')][_0x2c000a][_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch(_0x3816('0x1d1')));delete _0xd90aab[_0x3816('0xa0')][_0x2c000a];});}else{loggerBooked[_0x3816('0x78')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x37418f['queueStatusComplete']),'Queue:\x20',_0x37418f[_0x3816('0x3a')]);_0xd90aab['updateOriginated'](_0x37418f);_0xd90aab[_0x3816('0xb5')]({'active':![],'ContactId':_0xd90aab['actions'][_0x2c000a][_0x3816('0xc5')],'ListId':_0xd90aab[_0x3816('0xa0')][_0x2c000a][_0x3816('0x102')],'VoiceQueueId':_0xd90aab['actions'][_0x2c000a]['VoiceQueueId']||undefined,'CampaignId':_0xd90aab[_0x3816('0xa0')][_0x2c000a]['CampaignId']||undefined})[_0x3816('0xa4')](loggerCatch(_0x3816('0x1d1')));delete _0xd90aab[_0x3816('0xa0')][_0x2c000a];}}else{return _0xd90aab['actionOriginate'](_0x37418f,_0xc61de0);}}else{if(getDiff(_0xc61de0[_0x3816('0x1d2')])<_0x37418f[_0x3816('0x1d3')]*0x3c){if(_0xc61de0[_0x3816('0x1d4')]&&!_0xc61de0[_0x3816('0x1d4')]['voicePause']){_0xd90aab[_0x3816('0x1c')][_0x3816('0x118')](_0xc61de0['id'])['finally'](function(){_0xd90aab[_0x3816('0xa8')](_0x37418f);});}else{_0xd90aab['unlockContact']({'active':![]},_0xc61de0['id'],0x1)[_0x3816('0x11b')](function(){console[_0x3816('0x106')](_0x3816('0x1d5'));_0xd90aab[_0x3816('0xa8')](_0x37418f);});}}else{_0x37418f['outboundReCallsDay']+=0x1;_0xd90aab[_0x3816('0xa8')](_0x37418f);if(_0x37418f['dialRecallInQueue']){_0xd90aab[_0x3816('0xb5')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xc61de0[_0x3816('0xc5')],'ListId':_0xc61de0[_0x3816('0x102')],'VoiceQueueId':_0xc61de0[_0x3816('0xc7')]||undefined,'CampaignId':_0xc61de0[_0x3816('0xc8')]||undefined})[_0x3816('0xa4')](loggerCatch(_0x3816('0x1d6')));_0xd90aab[_0x3816('0xbf')](createObjHistory(_0x37418f,_0xc61de0,'RECALLINQUEUE',0x17,_0x3816('0x1d7')))[_0x3816('0xa4')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0xd90aab[_0x3816('0xc3')](createObjHistory(_0x37418f,_0xc61de0,_0x3816('0x1d8'),0x16,_0x3816('0x1d9')),_0x3816('0x1da'),_0x3816('0x1db'));}}}}else{_0x37418f[_0x3816('0x5b')]+=0x1;_0xd90aab[_0x3816('0xc3')](createObjHistory(_0x37418f,_0xc61de0,_0x3816('0x1dc'),0xd,_0x3816('0x1dd')),_0x3816('0x1de'),_0x3816('0x1df'));throw _0x3816('0x1e0');}};};Dialer[_0x3816('0x9d')]['handleIvr']=function(_0x3bd90c){var _0x1e817f=this;var _0x55900d=[];var _0x45943f=_0x3bd90c['limitCalls']-_0x3bd90c['originated']-_0x3bd90c[_0x3816('0x1e1')];emitCampaignSummary(_0x3bd90c);if(_0x45943f>0x0){if(_0x45943f>this[_0x3816('0x1e2')]){_0x45943f=this['maxNumberOriginate'];}_0x3bd90c[_0x3816('0x1e1')]+=_0x45943f;this['getContactDialerIvr'](_0x3bd90c['id'],_0x45943f,_0x3bd90c[_0x3816('0x1e3')])['then'](function(_0x46e800){_0x3bd90c[_0x3816('0x1e1')]-=_0x45943f;_0x3bd90c[_0x3816('0x1e1')]=_0x3bd90c[_0x3816('0x1e1')]>0x0?_0x3bd90c[_0x3816('0x1e1')]:0x0;if(!checkContactEmpty(_0x46e800)){_0x3bd90c[_0x3816('0x38')]=_0x3816('0x94');logger[_0x3816('0x78')]('[getContactCampaign2][Empty]'+_0x3bd90c[_0x3816('0x3a')]);}else{_0x3bd90c[_0x3816('0x6e')]+=_0x46e800['length'];_0x3bd90c[_0x3816('0x38')]='RUNNING';for(var _0x5d6735=0x0;_0x5d6735<_0x46e800[_0x3816('0x8d')];_0x5d6735+=0x1){_0x3bd90c[_0x3816('0x1e4')]+=0x1;if(_[_0x3816('0xa1')](_0x46e800[_0x5d6735])||_[_0x3816('0xa1')](_0x46e800[_0x5d6735][_0x3816('0x158')])||_[_0x3816('0xa1')](_0x46e800[_0x5d6735][_0x3816('0x158')][_0x3816('0x159')])){_0x1e817f[_0x3816('0x1e5')](_0x3816('0x1e6'),_0x3bd90c,_0x46e800[_0x5d6735]);}else{_0x1e817f[_0x3816('0xb0')](_[_0x3816('0x115')](_0x46e800[_0x5d6735],[_0x3816('0xc8'),'Contact.phone']))[_0x3816('0xac')](_0x1e817f[_0x3816('0x1e7')](_0x3bd90c,_0x46e800[_0x5d6735]))[_0x3816('0xa4')](_0x1e817f[_0x3816('0xc2')]('[actionOriginateIvr]\x20',_0x3bd90c));}}}})[_0x3816('0xa4')](loggerGetContactDialer(_0x3816('0x1e8'),_0x3bd90c,_0x45943f));}};Dialer[_0x3816('0x9d')][_0x3816('0x147')]=function(_0xa839,_0xad6f66){var _0x49482f=this;var _0x1ef7c2=[];var _0x1cb200=_0xad6f66>=0x1?_0xad6f66:0x1;var _0x15ca14=[];if(_0xa839[_0x3816('0x55')]===_0x3816('0x1cd')){_0x1cb200=0x1;}var _0x33a439=Math['floor'](_0xa839['available']*_0x1cb200)-_0xa839[_0x3816('0x6e')]-_0xa839[_0x3816('0x1e1')];emitVoiceQueueSummary(_0xa839);if(_0xa839[_0x3816('0x1e9')]>0x0){var _0x5d7055=_0xa839[_0x3816('0x1e9')]-_0xa839[_0x3816('0x6e')]-_0xa839[_0x3816('0x95')]-_0xa839[_0x3816('0x1e1')]-_0xa839[_0x3816('0x4d')];if(_0x33a439>_0x5d7055){_0x33a439=_0x5d7055;}}if(_0x33a439>0x0){if(_0xa839[_0x3816('0x55')]===_0x3816('0x1cd')){_0x33a439=0x1;}if(_0x33a439>this[_0x3816('0x1e2')]){_0x33a439=this['maxNumberOriginate'];}_0xa839[_0x3816('0x1e1')]+=_0x33a439;for(var _0x531401 in this[_0x3816('0x1f')]){if(this[_0x3816('0x1f')]['hasOwnProperty'](_0x531401)){if(this[_0x3816('0x1f')][_0x531401][_0x3816('0x9b')]===_0x3816('0x1ea')&&this[_0x3816('0x1f')][_0x531401]['status']===_0x3816('0xcf')){_0x1ef7c2['push'](this['agents'][_0x531401]['id']);}}}this[_0x3816('0xb8')](_0xa839['id'],_0x1ef7c2,_0x33a439,_0xa839[_0x3816('0x1e3')])[_0x3816('0xac')](function(_0x5ebbb3){_0xa839[_0x3816('0x1e1')]-=_0x33a439;_0xa839[_0x3816('0x1e1')]=_0xa839[_0x3816('0x1e1')]>0x0?_0xa839[_0x3816('0x1e1')]:0x0;if(!checkContactEmpty(_0x5ebbb3)){_0x49482f[_0x3816('0xaa')](_0xa839)['then'](sendMessageReschedule(_0xa839))[_0x3816('0xa4')](loggerCatch(_0x3816('0xad')));}else{_0xa839[_0x3816('0x6e')]+=_0x5ebbb3[_0x3816('0x8d')];_0xa839['message']=_0xa839[_0x3816('0x55')]===_0x3816('0x1cd')?'ACTIVE':'RUNNING';for(var _0x22f628=0x0;_0x22f628<_0x5ebbb3[_0x3816('0x8d')];_0x22f628+=0x1){if(_['isNil'](_0x5ebbb3[_0x22f628])||_['isNil'](_0x5ebbb3[_0x22f628]['Contact'])||_[_0x3816('0xa1')](_0x5ebbb3[_0x22f628][_0x3816('0x158')]['phone'])){_0x49482f[_0x3816('0x1e5')](_0x3816('0x1e6'),_0xa839,_0x5ebbb3[_0x22f628]);}else{_0x49482f[_0x3816('0xae')](_[_0x3816('0x115')](_0x5ebbb3[_0x22f628],[_0x3816('0xc7'),_0x3816('0x1eb')]))['then'](_0x49482f['checkContactBlack'](_0xa839,_0x5ebbb3[_0x22f628]))[_0x3816('0xa4')](_0x49482f['loggerHandler'](_0x3816('0x1e6'),_0xa839));}}}})[_0x3816('0xa4')](loggerGetContactDialer('[getContactDialer2]',_0xa839,_0x33a439));}};Dialer['prototype'][_0x3816('0x85')]=function(_0x6caa03){var _0x4e1a7d=this;if(_0x6caa03[_0x3816('0x1e9')]>0x0){var _0x20c6f3=_0x6caa03[_0x3816('0x1e9')]-_0x6caa03['originated']-_0x6caa03[_0x3816('0x95')];if(_0x20c6f3>0x0){this[_0x3816('0x1ec')](_0x6caa03);}else{loggerPredictiveCalls[_0x3816('0x78')]('[handlePredictive][limitChannel]');}}else{this[_0x3816('0x1ec')](_0x6caa03);}};Dialer['prototype'][_0x3816('0x1ec')]=function(_0x54b6ab){var _0x49f406=this;var _0x57edb9=[];_0x54b6ab[_0x3816('0x6e')]+=0x1;for(var _0x4b5788 in this['agents']){if(this[_0x3816('0x1f')]['hasOwnProperty'](_0x4b5788)){if(this[_0x3816('0x1f')][_0x4b5788][_0x3816('0x9b')]===_0x3816('0x1ea')&&this[_0x3816('0x1f')][_0x4b5788][_0x3816('0xa2')]===_0x3816('0xcf')){_0x57edb9[_0x3816('0x114')](this[_0x3816('0x1f')][_0x4b5788]['id']);}}}this[_0x3816('0xb8')](_0x54b6ab['id'],_0x57edb9,0x1,_0x54b6ab[_0x3816('0x1e3')])['then'](function(_0x1cba35){if(!checkContactEmpty(_0x1cba35)){checkContactLowerLimitOriginate(_0x54b6ab,0x1,0x0);_0x49f406[_0x3816('0xaa')](_0x54b6ab)[_0x3816('0xac')](sendMessageReschedule(_0x54b6ab))['catch'](loggerCatch(_0x3816('0xad')));}else{_0x54b6ab['message']=_0x3816('0x1ed');if(_[_0x3816('0xa1')](_0x1cba35[0x0])||_[_0x3816('0xa1')](_0x1cba35[0x0][_0x3816('0x158')])||_[_0x3816('0xa1')](_0x1cba35[0x0][_0x3816('0x158')]['phone'])){_0x49f406[_0x3816('0x1e5')](_0x3816('0x1e6'),_0x54b6ab,_0x1cba35[0x0]);}else{_0x49f406['checkIsBlackList'](_[_0x3816('0x115')](_0x1cba35[0x0],[_0x3816('0xc7'),_0x3816('0x1eb')]))['then'](_0x49f406[_0x3816('0x1e7')](_0x54b6ab,_0x1cba35[0x0]))[_0x3816('0xa4')](_0x49f406[_0x3816('0xc2')](_0x3816('0x1ee'),_0x54b6ab));}}})[_0x3816('0xa4')](loggerGetContactDialer(_0x3816('0x1ef'),_0x54b6ab,0x1));emitVoiceQueueSummary(_0x54b6ab);};Dialer[_0x3816('0x9d')][_0x3816('0x1c2')]=function(_0x1c4cd7,_0x4d68d1,_0x4cca45,_0x24778d,_0x34b12a,_0x265e1e){loggerPredictive['info'](_0x3816('0x1f0'));loggerPredictive['info'](_0x3816('0x1f1'),_0x1c4cd7);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f2'),_0x4d68d1);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f3'),_0x4cca45);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f4'),_0x24778d);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f5'),_0x34b12a);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f6'));return new BPromise(function(_0x41e3c5,_0x4874be){if(_0x1c4cd7<=0x0||isNaN(_0x1c4cd7)){return _0x4874be(msgResponse('[abandonmentRate]',_0x3816('0x42'),_0x3816('0x1f7')+_0x1c4cd7));}if(_0x4cca45<=0x0||isNaN(_0x4cca45)){return _0x4874be(msgResponse(_0x3816('0x1f8'),_0x3816('0x42'),'Ts\x20=\x20'+_0x4cca45));}if(_0x24778d<=0x0||isNaN(_0x24778d)){return _0x4874be(msgResponse('[abandonmentRate]',_0x3816('0x42'),'p\x20=\x20'+_0x24778d));}if(_0x4d68d1<=0x0||isNaN(_0x4d68d1)){return _0x4874be(msgResponse(_0x3816('0x1f8'),_0x3816('0x42'),'interval\x20=\x20'+_0x4d68d1));}if(_0x34b12a<=0x0||isNaN(_0x34b12a)){return _0x4874be(msgResponse('[abandonmentRate]',_0x3816('0x42'),_0x3816('0x1f9')+_0x34b12a));}_0x265e1e=_0x265e1e||0x0;var _0x22f665=0x1/_0x4cca45;var _0x3b289a=0x0;var _0x3e8849=0x0;var _0x8b7989=0x0;var _0x43a1e8=0x0;for(var _0xd60cf1=0x0;_0x8b7989<_0x34b12a;_0xd60cf1+=0x1){_0x3e8849=_0xd60cf1/_0x4d68d1;_0x3b289a=(_0x24778d*_0x3e8849+_0x265e1e)/_0x22f665;_0x8b7989=erlangb(_0x3b289a,_0x1c4cd7);_0x43a1e8=_0x3b289a/_0x1c4cd7*(0x1-erlangb(_0x3b289a,_0x1c4cd7));}return _0x41e3c5({'erlangCalls':_0xd60cf1,'erlangCallToSecond':_0x4d68d1/_0xd60cf1,'erlangAbandonmentRate':_0x8b7989,'erlangBusyFactor':_0x43a1e8});});};Dialer[_0x3816('0x9d')][_0x3816('0x1c4')]=function(_0x3e5179,_0x1219b7,_0x369799,_0x521301,_0x41c7bb,_0x114738){loggerPredictive[_0x3816('0x78')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x3816('0x78')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e5179);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f2'),_0x1219b7);loggerPredictive[_0x3816('0x78')](_0x3816('0x1f3'),_0x369799);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',_0x521301);loggerPredictive['info'](_0x3816('0x1fa'),_0x41c7bb);loggerPredictive[_0x3816('0x78')]('---------------------------');return new BPromise(function(_0x473295,_0x570bbf){if(_0x3e5179<=0x0||isNaN(_0x3e5179)){return _0x570bbf(msgResponse(_0x3816('0x1fb'),'Error',_0x3816('0x1f7')+_0x3e5179));}if(_0x369799<=0x0||isNaN(_0x369799)){return _0x570bbf(msgResponse(_0x3816('0x1fb'),_0x3816('0x42'),'Ts\x20=\x20'+_0x369799));}if(_0x521301<=0x0||isNaN(_0x521301)){return _0x570bbf(msgResponse(_0x3816('0x1fb'),'Error','p\x20=\x20'+_0x521301));}if(_0x1219b7<=0x0||isNaN(_0x1219b7)){return _0x570bbf(msgResponse('[busyFactor]',_0x3816('0x42'),_0x3816('0x1fc')+_0x1219b7));}if(_0x41c7bb<=0x0||isNaN(_0x41c7bb)){return _0x570bbf(msgResponse(_0x3816('0x1fb'),'Error','Umin\x20=\x20'+_0x41c7bb));}_0x114738=_0x114738||0x0;var _0x3f3ae9=0x1/_0x369799;var _0x5ae1ff=0x0;var _0x381e31=0x0;var _0x17abef=0x0;var _0x4f3bf2=0x0;for(var _0x4f001b=0x0;_0x4f3bf2<_0x41c7bb;_0x4f001b+=0x1){_0x381e31=_0x4f001b/_0x1219b7;_0x5ae1ff=(_0x521301*_0x381e31+_0x114738)/_0x3f3ae9;_0x17abef=erlangb(_0x5ae1ff,_0x3e5179);_0x4f3bf2=_0x5ae1ff/_0x3e5179*(0x1-erlangb(_0x5ae1ff,_0x3e5179));}return _0x473295({'erlangCalls':_0x4f001b,'erlangCallToSecond':_0x1219b7/_0x4f001b,'erlangAbandonmentRate':_0x17abef,'erlangBusyFactor':_0x4f3bf2});});};module[_0x3816('0x1fd')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 94b82ab..eb9d059 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 _0x9b0d=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x1ba842,_0x225c51){var _0x5db13e=function(_0x4ef692){while(--_0x4ef692){_0x1ba842['push'](_0x1ba842['shift']());}};_0x5db13e(++_0x225c51);}(_0x9b0d,0x1d5));var _0xd9b0=function(_0x324dae,_0x22b0da){_0x324dae=_0x324dae-0x0;var _0x4aaf58=_0x9b0d[_0x324dae];return _0x4aaf58;};'use strict';var util=require(_0xd9b0('0x0'));var _=require(_0xd9b0('0x1'));var moment=require(_0xd9b0('0x2'));function getSeconds(_0x1a5a79,_0x3b8ad9){var _0x643b20=moment(_0x1a5a79)['milliseconds'](0x0);var _0x1edb81=moment(_0x3b8ad9)[_0xd9b0('0x3')](0x0);return _0x643b20[_0xd9b0('0x4')](_0x1edb81,_0xd9b0('0x5'));}function QueueCallerAbandon(_0x58e37d,_0xf809c2){this[_0xd9b0('0x6')]=_0x58e37d['scheduledat'];this[_0xd9b0('0x7')]=_0x58e37d[_0xd9b0('0x7')];this['campaigntype']=_0x58e37d[_0xd9b0('0x7')]===_0xd9b0('0x8')?_0xd9b0('0x9'):_0x58e37d['type'];this[_0xd9b0('0xa')]=_0x58e37d[_0xd9b0('0xa')];this[_0xd9b0('0xb')]=_0x58e37d[_0xd9b0('0xb')];this[_0xd9b0('0xc')]=_0x58e37d[_0xd9b0('0xc')];this['countglobal']=_0x58e37d['countbusyretry']+_0x58e37d['countcongestionretry']+_0x58e37d['countnoanswerretry']+_0x58e37d[_0xd9b0('0xd')]+_0x58e37d[_0xd9b0('0xe')]+_0x58e37d[_0xd9b0('0xf')]+_0x58e37d[_0xd9b0('0x10')]+_0x58e37d['countagentrejectretry'];this[_0xd9b0('0xd')]=_0x58e37d[_0xd9b0('0xd')];this[_0xd9b0('0xe')]=_0x58e37d[_0xd9b0('0xe')];this['countabandonedretry']=_0x58e37d[_0xd9b0('0xf')];this[_0xd9b0('0x10')]=_0x58e37d[_0xd9b0('0x10')];this['countagentrejectretry']=_0x58e37d['countagentrejectretry'];this[_0xd9b0('0x11')]=_0xf809c2[_0xd9b0('0x11')];this[_0xd9b0('0x12')]=_0x58e37d[_0xd9b0('0x13')];this['calleridnum']=_0x58e37d[_0xd9b0('0x14')];this[_0xd9b0('0x15')]=_0x58e37d[_0xd9b0('0x15')];this[_0xd9b0('0x16')]=_0x58e37d[_0xd9b0('0x16')];this[_0xd9b0('0x17')]=_0x58e37d[_0xd9b0('0x17')];this[_0xd9b0('0x18')]=this[_0xd9b0('0x17')];this[_0xd9b0('0x19')]=getSeconds(_0x58e37d[_0xd9b0('0x16')],_0x58e37d[_0xd9b0('0x15')]);this[_0xd9b0('0x1a')]=getSeconds(this['droptime'],_0x58e37d[_0xd9b0('0x16')]);this[_0xd9b0('0x1b')]=0x0;this[_0xd9b0('0x9')]=_0xf809c2[_0xd9b0('0x9')];this['membername']=_0xf809c2[_0xd9b0('0x1c')];this[_0xd9b0('0x1d')]=_0xf809c2[_0xd9b0('0x1d')];this['callback']=_0x58e37d[_0xd9b0('0x1e')];this[_0xd9b0('0x1f')]=_0x58e37d[_0xd9b0('0x1f')];this[_0xd9b0('0x20')]=_0x58e37d[_0xd9b0('0x20')];this['recallme']=_0x58e37d[_0xd9b0('0x21')];this[_0xd9b0('0x22')]=_0x58e37d[_0xd9b0('0x22')];this[_0xd9b0('0x23')]=_0x58e37d['ListId'];this[_0xd9b0('0x24')]=_0x58e37d[_0xd9b0('0x24')];this[_0xd9b0('0x25')]=_0x58e37d[_0xd9b0('0x25')];this[_0xd9b0('0x26')]=_0x58e37d['CampaignId'];this[_0xd9b0('0x27')]=_0x58e37d[_0xd9b0('0x27')]||'';this['originatecalleridname']=_0x58e37d[_0xd9b0('0x28')]||'';}module[_0xd9b0('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0xd150=['holdtime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','starttime','responsetime','droptime','ringtime'];(function(_0x400c0e,_0x2bc6e9){var _0x543713=function(_0x1cc766){while(--_0x1cc766){_0x400c0e['push'](_0x400c0e['shift']());}};_0x543713(++_0x2bc6e9);}(_0xd150,0x1ef));var _0x0d15=function(_0x3c72ec,_0x37b9a1){_0x3c72ec=_0x3c72ec-0x0;var _0x2396a6=_0xd150[_0x3c72ec];return _0x2396a6;};'use strict';var util=require(_0x0d15('0x0'));var _=require(_0x0d15('0x1'));var moment=require(_0x0d15('0x2'));function getSeconds(_0x130b05,_0x515769){var _0x3ef3bd=moment(_0x130b05)[_0x0d15('0x3')](0x0);var _0x2e0c6c=moment(_0x515769)[_0x0d15('0x3')](0x0);return _0x3ef3bd[_0x0d15('0x4')](_0x2e0c6c,_0x0d15('0x5'));}function QueueCallerAbandon(_0x3abd00,_0x50ec5c){this['scheduledat']=_0x3abd00[_0x0d15('0x6')];this[_0x0d15('0x7')]=_0x3abd00[_0x0d15('0x7')];this[_0x0d15('0x8')]=_0x3abd00[_0x0d15('0x7')]==='outbound'?_0x0d15('0x9'):_0x3abd00[_0x0d15('0x7')];this[_0x0d15('0xa')]=_0x3abd00[_0x0d15('0xa')];this[_0x0d15('0xb')]=_0x3abd00[_0x0d15('0xb')];this[_0x0d15('0xc')]=_0x3abd00[_0x0d15('0xc')];this['countglobal']=_0x3abd00[_0x0d15('0xa')]+_0x3abd00['countcongestionretry']+_0x3abd00[_0x0d15('0xc')]+_0x3abd00[_0x0d15('0xd')]+_0x3abd00[_0x0d15('0xe')]+_0x3abd00[_0x0d15('0xf')]+_0x3abd00[_0x0d15('0x10')]+_0x3abd00[_0x0d15('0x11')];this[_0x0d15('0xd')]=_0x3abd00['countnosuchnumberretry'];this[_0x0d15('0xe')]=_0x3abd00['countdropretry'];this[_0x0d15('0xf')]=_0x3abd00[_0x0d15('0xf')];this[_0x0d15('0x10')]=_0x3abd00[_0x0d15('0x10')];this['countagentrejectretry']=_0x3abd00['countagentrejectretry'];this[_0x0d15('0x12')]=_0x50ec5c[_0x0d15('0x12')];this['calleridname']=_0x3abd00['name'];this['calleridnum']=_0x3abd00['number'];this[_0x0d15('0x13')]=_0x3abd00[_0x0d15('0x13')];this[_0x0d15('0x14')]=_0x3abd00[_0x0d15('0x14')];this[_0x0d15('0x15')]=_0x3abd00[_0x0d15('0x15')];this['endtime']=this['droptime'];this[_0x0d15('0x16')]=getSeconds(_0x3abd00['responsetime'],_0x3abd00['starttime']);this[_0x0d15('0x17')]=getSeconds(this[_0x0d15('0x15')],_0x3abd00[_0x0d15('0x14')]);this['talktime']=0x0;this[_0x0d15('0x9')]=_0x50ec5c[_0x0d15('0x9')];this['membername']=_0x50ec5c[_0x0d15('0x18')];this[_0x0d15('0x19')]=_0x50ec5c['reason'];this[_0x0d15('0x1a')]=_0x3abd00[_0x0d15('0x1a')];this['callbackuniqueid']=_0x3abd00[_0x0d15('0x1b')];this['callbackat']=_0x3abd00[_0x0d15('0x1c')];this[_0x0d15('0x1d')]=_0x3abd00[_0x0d15('0x1d')];this[_0x0d15('0x1e')]=_0x3abd00[_0x0d15('0x1e')];this['ListId']=_0x3abd00[_0x0d15('0x1f')];this[_0x0d15('0x20')]=_0x3abd00[_0x0d15('0x20')];this[_0x0d15('0x21')]=_0x3abd00[_0x0d15('0x21')];this['CampaignId']=_0x3abd00['CampaignId'];this['originatecalleridnum']=_0x3abd00[_0x0d15('0x22')]||'';this[_0x0d15('0x23')]=_0x3abd00['originatecalleridname']||'';}module[_0x0d15('0x24')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 3a351d0..793a9ec 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 _0x733b=['exports','moment','channel','format','%s/%s/%s','tech','fax','localstationid','headerinfo','path','AttachmentId'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x733b,0xa6));var _0xb733=function(_0x2b9bed,_0x18e9b1){_0x2b9bed=_0x2b9bed-0x0;var _0x3ffcc7=_0x733b[_0x2b9bed];return _0x3ffcc7;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xb733('0x0'));function Action(_0x2a5dbe,_0x372a22,_0x15849b){this['uniqueid']=_0x2a5dbe||undefined;this[_0xb733('0x1')]=util[_0xb733('0x2')](_0xb733('0x3'),_0x372a22[_0xb733('0x4')],_0x372a22['Trunk']['name'],_0x15849b[_0xb733('0x5')]);this[_0xb733('0x6')]=_0x372a22['localstationid'];this[_0xb733('0x7')]=_0x372a22[_0xb733('0x7')];this[_0xb733('0x8')]=_0x15849b['path'];this[_0xb733('0x9')]=_0x15849b['AttachmentId'];}module[_0xb733('0xa')]=Action; \ No newline at end of file +var _0x60e2=['path','AttachmentId','exports','lodash','channel','format','%s/%s/%s','tech','Trunk','name','localstationid'];(function(_0x54143f,_0x1800f2){var _0x1a3282=function(_0x48931e){while(--_0x48931e){_0x54143f['push'](_0x54143f['shift']());}};_0x1a3282(++_0x1800f2);}(_0x60e2,0x158));var _0x260e=function(_0x331431,_0xf02106){_0x331431=_0x331431-0x0;var _0x22d6e2=_0x60e2[_0x331431];return _0x22d6e2;};'use strict';var util=require('util');var _=require(_0x260e('0x0'));var moment=require('moment');function Action(_0x2eaf1d,_0x134c18,_0x4d4ab1){this['uniqueid']=_0x2eaf1d||undefined;this[_0x260e('0x1')]=util[_0x260e('0x2')](_0x260e('0x3'),_0x134c18[_0x260e('0x4')],_0x134c18[_0x260e('0x5')][_0x260e('0x6')],_0x4d4ab1['fax']);this[_0x260e('0x7')]=_0x134c18['localstationid'];this['headerinfo']=_0x134c18['headerinfo'];this[_0x260e('0x8')]=_0x4d4ab1['path'];this[_0x260e('0x9')]=_0x4d4ab1['AttachmentId'];}module[_0x260e('0xa')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 0a55d3f..a6d5051 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 _0x5caa=['path','tiff2pdf','./util/gs','../../../config/logger','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','newchannel','varset','bind','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','actions','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','calleridnum','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','send','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','isValid','Trunk\x20Reachable','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','format','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','variablesAction','Action','execOriginate','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','bluebird','uuid','moment'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x5caa,0x72));var _0xa5ca=function(_0x54fe1c,_0x5d208c){_0x54fe1c=_0x54fe1c-0x0;var _0x460aaa=_0x5caa[_0x54fe1c];return _0x460aaa;};'use strict';var util=require(_0xa5ca('0x0'));var _=require('lodash');var BPromise=require(_0xa5ca('0x1'));var uuid=require(_0xa5ca('0x2'));var moment=require(_0xa5ca('0x3'));var path=require(_0xa5ca('0x4'));var tiff2pdf=require(_0xa5ca('0x5'));var gs=require(_0xa5ca('0x6'));var logger=require(_0xa5ca('0x7'))('fax');var ami=require(_0xa5ca('0x8'));var rpcDb=require(_0xa5ca('0x9'));var Channel=require(_0xa5ca('0xa'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0xa5ca('0xb'));var attachment=require(_0xa5ca('0xc'));var faxMessage=require(_0xa5ca('0xd'));function Fax(_0xcb0945){this['channels']={};this['faxAccounts']=_0xcb0945[_0xa5ca('0xe')];this[_0xa5ca('0xf')]=_0xcb0945[_0xa5ca('0xf')];this['actions']={};ami['on'](_0xa5ca('0x10'),this['syncNewchannel']['bind'](this));ami['on'](_0xa5ca('0x11'),this['syncVarSet'][_0xa5ca('0x12')](this));ami['on'](_0xa5ca('0x13'),this[_0xa5ca('0x14')][_0xa5ca('0x12')](this));ami['on'](_0xa5ca('0x15'),this['syncNewExten'][_0xa5ca('0x12')](this));ami['on'](_0xa5ca('0x16'),this[_0xa5ca('0x17')][_0xa5ca('0x12')](this));ami['on']('receivefax',this[_0xa5ca('0x18')][_0xa5ca('0x12')](this));ami['on']('hangup',this[_0xa5ca('0x19')][_0xa5ca('0x12')](this));ami['on'](_0xa5ca('0x1a'),this[_0xa5ca('0x1b')]['bind'](this));}Fax[_0xa5ca('0x1c')][_0xa5ca('0x1d')]=function(_0x301f1c){if(_0x301f1c[_0xa5ca('0x1e')]==='from-voip-provider'){for(var _0xc5c161 in this[_0xa5ca('0xe')]){if(this[_0xa5ca('0xe')][_0xa5ca('0x1f')](_0xc5c161)){if(_0x301f1c[_0xa5ca('0x20')]===this['faxAccounts'][_0xc5c161][_0xa5ca('0x21')]){this[_0xa5ca('0x22')][_0x301f1c[_0xa5ca('0x23')]]={};this[_0xa5ca('0x22')][_0x301f1c[_0xa5ca('0x23')]]['channel']=_0x301f1c[_0xa5ca('0x24')];this[_0xa5ca('0x22')][_0x301f1c[_0xa5ca('0x23')]]['id']=this[_0xa5ca('0xe')][_0xc5c161]['id'];this[_0xa5ca('0x22')][_0x301f1c[_0xa5ca('0x23')]][_0xa5ca('0x25')]=this['faxAccounts'][_0xc5c161][_0xa5ca('0x25')];logger[_0xa5ca('0x26')](_0x301f1c[_0xa5ca('0x23')],'\x20syncNewchannel\x20');}}}}if(this[_0xa5ca('0x27')][_0x301f1c['uniqueid']]){this[_0xa5ca('0x22')][_0x301f1c[_0xa5ca('0x23')]]={};this[_0xa5ca('0x22')][_0x301f1c['uniqueid']][_0xa5ca('0x24')]=_0x301f1c[_0xa5ca('0x24')];logger[_0xa5ca('0x26')](_0x301f1c[_0xa5ca('0x23')],'\x20syncNewchannel\x20');}};Fax[_0xa5ca('0x1c')][_0xa5ca('0x28')]=function(_0x16a598){if(this[_0xa5ca('0x22')][_0x16a598[_0xa5ca('0x23')]]){for(var _0x47a92b in _0x16a598[_0xa5ca('0x29')]){if(_0x16a598[_0xa5ca('0x29')]['hasOwnProperty'](_0x47a92b)){this['channels'][_0x16a598[_0xa5ca('0x23')]][_0x47a92b]=_0x16a598[_0xa5ca('0x2a')];}}}};Fax[_0xa5ca('0x1c')][_0xa5ca('0x14')]=function(_0xdb1f0d){if(this[_0xa5ca('0x22')][_0xdb1f0d['uniqueid']]){this['channels'][_0xdb1f0d['uniqueid']]['channelstate']=_0xdb1f0d[_0xa5ca('0x2b')];this[_0xa5ca('0x22')][_0xdb1f0d['uniqueid']][_0xa5ca('0x2c')]=_0xdb1f0d[_0xa5ca('0x2c')];}};Fax['prototype']['syncNewExten']=function(_0x4396f9){if(this['channels'][_0x4396f9['uniqueid']]){for(var _0x391c3d in _0x4396f9['variable']){if(_0x4396f9[_0xa5ca('0x29')]['hasOwnProperty'](_0x391c3d)){this[_0xa5ca('0x22')][_0x4396f9[_0xa5ca('0x23')]][_0x391c3d]=_0x4396f9[_0xa5ca('0x2a')];}}}};Fax[_0xa5ca('0x1c')][_0xa5ca('0x17')]=function(_0x103d83){if(this['channels'][_0x103d83[_0xa5ca('0x23')]]){this[_0xa5ca('0x22')][_0x103d83[_0xa5ca('0x23')]][_0xa5ca('0x2d')]=_0x103d83['operation'];this[_0xa5ca('0x22')][_0x103d83[_0xa5ca('0x23')]]['status']=_0x103d83[_0xa5ca('0x2e')];this[_0xa5ca('0x22')][_0x103d83[_0xa5ca('0x23')]][_0xa5ca('0x21')]=_0x103d83[_0xa5ca('0x21')];this[_0xa5ca('0x22')][_0x103d83['uniqueid']]['filename']=_0x103d83[_0xa5ca('0x2f')];logger['info'](_0x103d83[_0xa5ca('0x23')],_0xa5ca('0x30'));}};Fax[_0xa5ca('0x1c')][_0xa5ca('0x18')]=function(_0x331acd){var _0x5bb01b=this;if(this[_0xa5ca('0x22')][_0x331acd[_0xa5ca('0x23')]]){var _0x4c62f8=this[_0xa5ca('0x22')][_0x331acd[_0xa5ca('0x23')]]['id'];this[_0xa5ca('0x22')][_0x331acd[_0xa5ca('0x23')]][_0xa5ca('0x31')]=_0x331acd[_0xa5ca('0x31')];this[_0xa5ca('0x22')][_0x331acd['uniqueid']][_0xa5ca('0x32')]=_0x331acd['pagestransferred'];this[_0xa5ca('0x22')][_0x331acd['uniqueid']][_0xa5ca('0x21')]=_0x331acd[_0xa5ca('0x21')];this[_0xa5ca('0x22')][_0x331acd[_0xa5ca('0x23')]][_0xa5ca('0x33')]=_0x331acd[_0xa5ca('0x33')];this[_0xa5ca('0x22')][_0x331acd['uniqueid']][_0xa5ca('0x34')]=_0x331acd['transferrate'];this[_0xa5ca('0x22')][_0x331acd[_0xa5ca('0x23')]][_0xa5ca('0x2f')]=_0x331acd[_0xa5ca('0x2f')];this[_0xa5ca('0x22')][_0x331acd[_0xa5ca('0x23')]]['calleridnum']=_0x331acd['calleridnum'];if(this[_0xa5ca('0x22')][_0x331acd[_0xa5ca('0x23')]]['pagestransferred']>0x0){tiff2pdf(_0x331acd[_0xa5ca('0x2f')],_0xa5ca('0x35'),function(_0x265ece){logger['info'](_0x331acd[_0xa5ca('0x23')],_0xa5ca('0x36'),_0x265ece[_0xa5ca('0x37')]);attachment[_0xa5ca('0x38')]({'name':path[_0xa5ca('0x39')](_0x331acd[_0xa5ca('0x2f')])[_0xa5ca('0x25')],'basename':path[_0xa5ca('0x39')](_0x331acd[_0xa5ca('0x2f')])[_0xa5ca('0x25')]+_0xa5ca('0x3a'),'type':_0xa5ca('0x3b')})['then'](function(_0x4ab7f7){faxAccount[_0xa5ca('0x3c')](_0x4c62f8,{'from':_0x331acd[_0xa5ca('0x3d')],'mapKey':_0xa5ca('0x3e'),'body':path[_0xa5ca('0x39')](_0x331acd[_0xa5ca('0x2f')])[_0xa5ca('0x25')]+_0xa5ca('0x3a'),'AttachmentId':_0x4ab7f7['id']})[_0xa5ca('0x3f')](function(_0x5263b4){logger[_0xa5ca('0x40')](_0x331acd[_0xa5ca('0x23')],_0xa5ca('0x41'),JSON[_0xa5ca('0x42')](_0x5263b4));});})[_0xa5ca('0x3f')](function(_0x2780b2){logger[_0xa5ca('0x40')](_0x331acd['uniqueid'],_0xa5ca('0x43'),JSON[_0xa5ca('0x42')](_0x2780b2));});});}logger[_0xa5ca('0x26')](_0x331acd['uniqueid'],_0xa5ca('0x43'));}};Fax[_0xa5ca('0x1c')][_0xa5ca('0x1b')]=function(_0x3c3205){if(this[_0xa5ca('0x27')][_0x3c3205['uniqueid']]){_[_0xa5ca('0x44')](this[_0xa5ca('0x22')][_0x3c3205[_0xa5ca('0x23')]],_[_0xa5ca('0x45')](_0x3c3205,[_0xa5ca('0x46'),_0xa5ca('0x47')]));}};function updateStatus(_0x4d77b8){if(_0x4d77b8[_0xa5ca('0x48')]){faxMessage['update'](_0x4d77b8[_0xa5ca('0x48')],{'failMessage':'SENDING\x20FAILED\x20'})[_0xa5ca('0x49')](function(_0x14d879){ut['logger'](_0xa5ca('0x4a'),_0x14d879);})[_0xa5ca('0x3f')](function(_0xb98786){ut[_0xa5ca('0x4b')]('[Fax][Message][Error][NoUpdate1]',_0xb98786);});}else{ut[_0xa5ca('0x4b')](_0xa5ca('0x4c'));}}Fax[_0xa5ca('0x1c')][_0xa5ca('0x4d')]=function(_0x5ce6aa,_0x14e7cd,_0x3e3128){var _0x2d999a=this;var _0x504a50={};if(_0x14e7cd){_0x504a50={'read':_0x14e7cd};}else{_0x504a50={'failMessage':_0x3e3128};}if(this[_0xa5ca('0x27')][_0x5ce6aa][_0xa5ca('0x48')]){faxMessage[_0xa5ca('0x4e')](this[_0xa5ca('0x27')][_0x5ce6aa][_0xa5ca('0x48')],_0x504a50)[_0xa5ca('0x49')](function(_0x960a4b){ut[_0xa5ca('0x4b')](_0xa5ca('0x4f'),_0x960a4b);})[_0xa5ca('0x3f')](function(_0x28c64f){ut['logger'](_0xa5ca('0x50'),_0x28c64f);})[_0xa5ca('0x51')](function(){delete _0x2d999a['channels'][_0x5ce6aa];delete _0x2d999a[_0xa5ca('0x27')][_0x5ce6aa];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this['channels'][_0x5ce6aa];delete this[_0xa5ca('0x27')][_0x5ce6aa];}};Fax[_0xa5ca('0x1c')][_0xa5ca('0x19')]=function(_0x45b2de){var _0x248a61=this;if(this[_0xa5ca('0x22')][_0x45b2de[_0xa5ca('0x23')]]){if(this['actions'][_0x45b2de[_0xa5ca('0x23')]]){this[_0xa5ca('0x22')][_0x45b2de[_0xa5ca('0x23')]]['id']=this['actions'][_0x45b2de[_0xa5ca('0x23')]]['id'];this[_0xa5ca('0x22')][_0x45b2de[_0xa5ca('0x23')]][_0xa5ca('0x25')]=this[_0xa5ca('0x27')][_0x45b2de[_0xa5ca('0x23')]][_0xa5ca('0x25')];}logger[_0xa5ca('0x26')](_0x45b2de[_0xa5ca('0x23')],this[_0xa5ca('0x27')][_0x45b2de[_0xa5ca('0x23')]]?_0xa5ca('0x52'):_0xa5ca('0x53'),JSON[_0xa5ca('0x42')](this['channels'][_0x45b2de[_0xa5ca('0x23')]]));if(this[_0xa5ca('0x27')][_0x45b2de[_0xa5ca('0x23')]]){if(this[_0xa5ca('0x22')][_0x45b2de['uniqueid']][_0xa5ca('0x54')]>0x0&&this[_0xa5ca('0x22')][_0x45b2de['uniqueid']][_0xa5ca('0x16')]==='SUCCESS'){this[_0xa5ca('0x4d')](_0x45b2de[_0xa5ca('0x23')],!![]);}else{this[_0xa5ca('0x4d')](_0x45b2de[_0xa5ca('0x23')],![],this[_0xa5ca('0x22')][_0x45b2de[_0xa5ca('0x23')]][_0xa5ca('0x55')]?_0xa5ca('0x56')+this[_0xa5ca('0x22')][_0x45b2de['uniqueid']][_0xa5ca('0x55')]:'SENDING\x20FAILED');}}}};Fax[_0xa5ca('0x1c')][_0xa5ca('0x57')]=function(_0x145df8){var _0x4e4fb3=this;return new BPromise(function(_0x27f5fe,_0x404c5c){_0x4e4fb3['execOriginate'](_0x145df8,_0x4e4fb3[_0xa5ca('0xe')][_0x145df8[_0xa5ca('0x58')]])[_0xa5ca('0x49')](function(_0x12e626){ut[_0xa5ca('0x4b')](_0xa5ca('0x59'),_0x12e626);_0x27f5fe(ut[_0xa5ca('0x37')]('Fax\x20received'));})[_0xa5ca('0x3f')](function(_0x2ce975){ut[_0xa5ca('0x4b')](_0xa5ca('0x5a'),_0x2ce975);updateStatus(_0x145df8);_0x404c5c(ut[_0xa5ca('0x37')]('Fax\x20failed'));});});};Fax[_0xa5ca('0x1c')][_0xa5ca('0x5b')]=function(_0x4a8599){var _0x142be9=this;return new BPromise(function(_0x36b696,_0x5a7804){var _0x44e29a=_0x142be9[_0xa5ca('0x5c')](_0x142be9[_0xa5ca('0xe')][_0x4a8599[_0xa5ca('0x58')]]['Trunk'],_0x4a8599);if(_0x44e29a[_0xa5ca('0x5d')]){_0x36b696(ut['message'](_0xa5ca('0x5e')));}else{_0x5a7804(ut[_0xa5ca('0x37')](_0x44e29a['message']));}});};function originate(_0x10f146,_0x33b443,_0x5b897f){return new BPromise(function(_0x72b364,_0x4ff82d){if(_0x5b897f){var _0x5426e7=util['format'](_0xa5ca('0x5f'),path[_0xa5ca('0x39')](_0x10f146['path'])[_0xa5ca('0x25')],_0x10f146[_0xa5ca('0x4')]);gs[_0xa5ca('0x60')](_0x5426e7)[_0xa5ca('0x49')](function(){_0x10f146[_0xa5ca('0x4')]=util[_0xa5ca('0x61')](_0xa5ca('0x62'),path[_0xa5ca('0x39')](_0x10f146[_0xa5ca('0x4')])[_0xa5ca('0x63')],path[_0xa5ca('0x39')](_0x10f146[_0xa5ca('0x4')])['name']);_0x33b443['XMF-PATH']=_0x10f146['path'];ut[_0xa5ca('0x4b')](_0xa5ca('0x64'),'');ami['Action'](ut[_0xa5ca('0x65')](_0x10f146,_0x33b443))[_0xa5ca('0x49')](function(_0x341e6b){_0x72b364(_0x341e6b);})['catch'](function(_0x18a618){_0x4ff82d(_0x18a618);});})[_0xa5ca('0x3f')](function(_0x27a06d){_0x4ff82d(_0x27a06d);});}else{ami[_0xa5ca('0x66')](ut['variablesAction'](_0x10f146,_0x33b443))[_0xa5ca('0x49')](function(_0x41bcaf){_0x72b364(_0x41bcaf);})[_0xa5ca('0x3f')](function(_0x3f4567){_0x4ff82d(_0x3f4567);});}});}Fax[_0xa5ca('0x1c')][_0xa5ca('0x67')]=function(_0x320733,_0x644b8f){var _0x4a60b0=this;return new BPromise(function(_0x13d8b0,_0x167f57){var _0xd6e93e=uuid['v4']();var _0x575ce9=ut['addVariables'](_0x320733,_0x644b8f);_0x4a60b0[_0xa5ca('0x27')][_0xd6e93e]=new Action(_0xd6e93e,_0x644b8f,_0x320733);var _0xf2c1dd=_0x4a60b0[_0xa5ca('0x27')][_0xd6e93e];if(path[_0xa5ca('0x39')](_0x320733['path'])['ext']==='.pdf'){originate(_0xf2c1dd,_0x575ce9,!![])[_0xa5ca('0x49')](function(_0x2f2eb6){_0x13d8b0(_0x2f2eb6);})[_0xa5ca('0x3f')](function(_0x13a199){_0x167f57(_0x13a199);});}else{originate(_0xf2c1dd,_0x575ce9,![])[_0xa5ca('0x49')](function(_0x34cd27){_0x13d8b0(_0x34cd27);})[_0xa5ca('0x3f')](function(_0x5eb742){_0x167f57(_0x5eb742);});}});};Fax[_0xa5ca('0x1c')][_0xa5ca('0x68')]=function(_0x13a295){return!_[_0xa5ca('0x69')](_0x13a295)&&!_['isNil'](_0x13a295[_0xa5ca('0x25')])&&!_[_0xa5ca('0x69')](_0x13a295['active'])&&_0x13a295[_0xa5ca('0x6a')]&&!_[_0xa5ca('0x69')](this['trunks'][util['format']('SIP/%s',_0x13a295['name'])])&&!_[_0xa5ca('0x69')](this[_0xa5ca('0xf')][util[_0xa5ca('0x61')](_0xa5ca('0x6b'),_0x13a295['name'])][_0xa5ca('0x2e')])&&(this[_0xa5ca('0xf')][util[_0xa5ca('0x61')](_0xa5ca('0x6b'),_0x13a295[_0xa5ca('0x25')])][_0xa5ca('0x2e')]===_0xa5ca('0x6c')||this[_0xa5ca('0xf')][util[_0xa5ca('0x61')](_0xa5ca('0x6b'),_0x13a295[_0xa5ca('0x25')])]['status']===_0xa5ca('0x6d'));};Fax[_0xa5ca('0x1c')][_0xa5ca('0x5c')]=function(_0x42387e,_0x3d4149){if(!this['isTrunkReachable'](_0x42387e)){ut[_0xa5ca('0x4b')](_0xa5ca('0x6e'),_['isNil'](_0x42387e)?'':_0x42387e[_0xa5ca('0x25')]+_0xa5ca('0x6f'));return{'isValid':![],'message':_0xa5ca('0x70')};}if(_[_0xa5ca('0x69')](_0x3d4149[_0xa5ca('0x3e')])){ut[_0xa5ca('0x4b')](_0xa5ca('0x71'),JSON[_0xa5ca('0x42')](_0x3d4149));return{'isValid':![],'message':_0xa5ca('0x72')};}if(_['isNil'](_0x3d4149[_0xa5ca('0x4')])){ut[_0xa5ca('0x4b')](_0xa5ca('0x73'),JSON['stringify'](_0x3d4149));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xa5ca('0x74')};};module[_0xa5ca('0x75')]=Fax; \ No newline at end of file +var _0x6e59=['format','execute','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','status','reachable','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','moment','path','tiff2pdf','fax','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','syncNewExten','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','checkAfterSend','FaxAccountId','Trunk','Trunk\x20Reachable'];(function(_0x2ec207,_0x412398){var _0x4a9b2a=function(_0x4528ea){while(--_0x4528ea){_0x2ec207['push'](_0x2ec207['shift']());}};_0x4a9b2a(++_0x412398);}(_0x6e59,0x15d));var _0x96e5=function(_0x420d70,_0x3a9318){_0x420d70=_0x420d70-0x0;var _0x2d4dfb=_0x6e59[_0x420d70];return _0x2d4dfb;};'use strict';var util=require(_0x96e5('0x0'));var _=require('lodash');var BPromise=require(_0x96e5('0x1'));var uuid=require(_0x96e5('0x2'));var moment=require(_0x96e5('0x3'));var path=require(_0x96e5('0x4'));var tiff2pdf=require(_0x96e5('0x5'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x96e5('0x6'));var ami=require(_0x96e5('0x7'));var rpcDb=require(_0x96e5('0x8'));var Channel=require(_0x96e5('0x9'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x96e5('0xa'));var attachment=require(_0x96e5('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x42b4c5){this['channels']={};this['faxAccounts']=_0x42b4c5[_0x96e5('0xc')];this[_0x96e5('0xd')]=_0x42b4c5[_0x96e5('0xd')];this[_0x96e5('0xe')]={};ami['on']('newchannel',this[_0x96e5('0xf')][_0x96e5('0x10')](this));ami['on'](_0x96e5('0x11'),this[_0x96e5('0x12')]['bind'](this));ami['on']('newstate',this['syncNewState'][_0x96e5('0x10')](this));ami['on']('newexten',this[_0x96e5('0x13')]['bind'](this));ami['on']('faxstatus',this[_0x96e5('0x14')][_0x96e5('0x10')](this));ami['on'](_0x96e5('0x15'),this['syncReceiveFax'][_0x96e5('0x10')](this));ami['on'](_0x96e5('0x16'),this[_0x96e5('0x17')][_0x96e5('0x10')](this));ami['on'](_0x96e5('0x18'),this['syncOriginateResponse'][_0x96e5('0x10')](this));}Fax[_0x96e5('0x19')][_0x96e5('0xf')]=function(_0x2df775){if(_0x2df775[_0x96e5('0x1a')]===_0x96e5('0x1b')){for(var _0x44d26a in this[_0x96e5('0xc')]){if(this['faxAccounts'][_0x96e5('0x1c')](_0x44d26a)){if(_0x2df775[_0x96e5('0x1d')]===this[_0x96e5('0xc')][_0x44d26a][_0x96e5('0x1e')]){this[_0x96e5('0x1f')][_0x2df775[_0x96e5('0x20')]]={};this[_0x96e5('0x1f')][_0x2df775['uniqueid']][_0x96e5('0x21')]=_0x2df775['channel'];this[_0x96e5('0x1f')][_0x2df775[_0x96e5('0x20')]]['id']=this[_0x96e5('0xc')][_0x44d26a]['id'];this[_0x96e5('0x1f')][_0x2df775[_0x96e5('0x20')]][_0x96e5('0x22')]=this['faxAccounts'][_0x44d26a][_0x96e5('0x22')];logger[_0x96e5('0x23')](_0x2df775[_0x96e5('0x20')],_0x96e5('0x24'));}}}}if(this['actions'][_0x2df775['uniqueid']]){this[_0x96e5('0x1f')][_0x2df775[_0x96e5('0x20')]]={};this[_0x96e5('0x1f')][_0x2df775[_0x96e5('0x20')]]['channel']=_0x2df775[_0x96e5('0x21')];logger[_0x96e5('0x23')](_0x2df775[_0x96e5('0x20')],_0x96e5('0x24'));}};Fax['prototype'][_0x96e5('0x12')]=function(_0x484748){if(this[_0x96e5('0x1f')][_0x484748[_0x96e5('0x20')]]){for(var _0x220e6d in _0x484748['variable']){if(_0x484748[_0x96e5('0x25')][_0x96e5('0x1c')](_0x220e6d)){this[_0x96e5('0x1f')][_0x484748[_0x96e5('0x20')]][_0x220e6d]=_0x484748[_0x96e5('0x26')];}}}};Fax[_0x96e5('0x19')]['syncNewState']=function(_0x441d9c){if(this[_0x96e5('0x1f')][_0x441d9c[_0x96e5('0x20')]]){this['channels'][_0x441d9c[_0x96e5('0x20')]][_0x96e5('0x27')]=_0x441d9c[_0x96e5('0x27')];this[_0x96e5('0x1f')][_0x441d9c['uniqueid']][_0x96e5('0x28')]=_0x441d9c['channelstatedesc'];}};Fax[_0x96e5('0x19')][_0x96e5('0x13')]=function(_0x7f0765){if(this[_0x96e5('0x1f')][_0x7f0765[_0x96e5('0x20')]]){for(var _0x35b9da in _0x7f0765[_0x96e5('0x25')]){if(_0x7f0765[_0x96e5('0x25')][_0x96e5('0x1c')](_0x35b9da)){this['channels'][_0x7f0765[_0x96e5('0x20')]][_0x35b9da]=_0x7f0765[_0x96e5('0x26')];}}}};Fax[_0x96e5('0x19')][_0x96e5('0x14')]=function(_0x20323c){if(this[_0x96e5('0x1f')][_0x20323c['uniqueid']]){this[_0x96e5('0x1f')][_0x20323c[_0x96e5('0x20')]][_0x96e5('0x29')]=_0x20323c[_0x96e5('0x29')];this[_0x96e5('0x1f')][_0x20323c[_0x96e5('0x20')]]['status']=_0x20323c['status'];this['channels'][_0x20323c[_0x96e5('0x20')]][_0x96e5('0x1e')]=_0x20323c[_0x96e5('0x1e')];this[_0x96e5('0x1f')][_0x20323c[_0x96e5('0x20')]][_0x96e5('0x2a')]=_0x20323c[_0x96e5('0x2a')];logger[_0x96e5('0x23')](_0x20323c['uniqueid'],_0x96e5('0x2b'));}};Fax[_0x96e5('0x19')]['syncReceiveFax']=function(_0x47d207){var _0x4f6c78=this;if(this[_0x96e5('0x1f')][_0x47d207[_0x96e5('0x20')]]){var _0x434dc0=this[_0x96e5('0x1f')][_0x47d207[_0x96e5('0x20')]]['id'];this[_0x96e5('0x1f')][_0x47d207['uniqueid']]['remotestationid']=_0x47d207[_0x96e5('0x2c')];this[_0x96e5('0x1f')][_0x47d207[_0x96e5('0x20')]][_0x96e5('0x2d')]=_0x47d207[_0x96e5('0x2d')];this[_0x96e5('0x1f')][_0x47d207[_0x96e5('0x20')]][_0x96e5('0x1e')]=_0x47d207[_0x96e5('0x1e')];this['channels'][_0x47d207['uniqueid']][_0x96e5('0x2e')]=_0x47d207['resolution'];this[_0x96e5('0x1f')][_0x47d207['uniqueid']][_0x96e5('0x2f')]=_0x47d207['transferrate'];this[_0x96e5('0x1f')][_0x47d207[_0x96e5('0x20')]][_0x96e5('0x2a')]=_0x47d207['filename'];this[_0x96e5('0x1f')][_0x47d207['uniqueid']][_0x96e5('0x30')]=_0x47d207[_0x96e5('0x30')];if(this[_0x96e5('0x1f')][_0x47d207[_0x96e5('0x20')]][_0x96e5('0x2d')]>0x0){tiff2pdf(_0x47d207[_0x96e5('0x2a')],'/var/opt/motion2/server/files/attachments/',function(_0x5efed6){logger[_0x96e5('0x23')](_0x47d207[_0x96e5('0x20')],_0x96e5('0x31'),_0x5efed6[_0x96e5('0x32')]);attachment['create']({'name':path[_0x96e5('0x33')](_0x47d207['filename'])[_0x96e5('0x22')],'basename':path[_0x96e5('0x33')](_0x47d207[_0x96e5('0x2a')])[_0x96e5('0x22')]+_0x96e5('0x34'),'type':_0x96e5('0x35')})[_0x96e5('0x36')](function(_0x1cfbee){faxAccount[_0x96e5('0x37')](_0x434dc0,{'from':_0x47d207['calleridnum'],'mapKey':_0x96e5('0x6'),'body':path[_0x96e5('0x33')](_0x47d207['filename'])[_0x96e5('0x22')]+_0x96e5('0x34'),'AttachmentId':_0x1cfbee['id']})['catch'](function(_0x5d7fa0){logger[_0x96e5('0x38')](_0x47d207[_0x96e5('0x20')],_0x96e5('0x39'),JSON[_0x96e5('0x3a')](_0x5d7fa0));});})[_0x96e5('0x3b')](function(_0x244953){logger[_0x96e5('0x38')](_0x47d207[_0x96e5('0x20')],_0x96e5('0x3c'),JSON['stringify'](_0x244953));});});}logger[_0x96e5('0x23')](_0x47d207[_0x96e5('0x20')],'\x20receiveFax\x20');}};Fax[_0x96e5('0x19')][_0x96e5('0x3d')]=function(_0x1566d6){if(this['actions'][_0x1566d6['uniqueid']]){_[_0x96e5('0x3e')](this[_0x96e5('0x1f')][_0x1566d6[_0x96e5('0x20')]],_[_0x96e5('0x3f')](_0x1566d6,[_0x96e5('0x40'),'reason']));}};function updateStatus(_0x54d800){if(_0x54d800[_0x96e5('0x41')]){faxMessage[_0x96e5('0x42')](_0x54d800[_0x96e5('0x41')],{'failMessage':_0x96e5('0x43')})[_0x96e5('0x36')](function(_0x5096b2){ut['logger'](_0x96e5('0x44'),_0x5096b2);})[_0x96e5('0x3b')](function(_0x263d47){ut[_0x96e5('0x45')](_0x96e5('0x46'),_0x263d47);});}else{ut[_0x96e5('0x45')](_0x96e5('0x47'));}}Fax[_0x96e5('0x19')][_0x96e5('0x48')]=function(_0xfd0378,_0x39412,_0x639051){var _0x513c9e=this;var _0x258e28={};if(_0x39412){_0x258e28={'read':_0x39412};}else{_0x258e28={'failMessage':_0x639051};}if(this[_0x96e5('0xe')][_0xfd0378]['AttachmentId']){faxMessage[_0x96e5('0x42')](this[_0x96e5('0xe')][_0xfd0378]['AttachmentId'],_0x258e28)[_0x96e5('0x36')](function(_0x9dff00){ut[_0x96e5('0x45')](_0x96e5('0x49'),_0x9dff00);})[_0x96e5('0x3b')](function(_0x50f59e){ut[_0x96e5('0x45')](_0x96e5('0x4a'),_0x50f59e);})['finally'](function(){delete _0x513c9e[_0x96e5('0x1f')][_0xfd0378];delete _0x513c9e[_0x96e5('0xe')][_0xfd0378];});}else{ut['logger'](_0x96e5('0x4b'));delete this['channels'][_0xfd0378];delete this[_0x96e5('0xe')][_0xfd0378];}};Fax['prototype'][_0x96e5('0x17')]=function(_0x5aa2b6){var _0x53f4fd=this;if(this['channels'][_0x5aa2b6[_0x96e5('0x20')]]){if(this['actions'][_0x5aa2b6['uniqueid']]){this[_0x96e5('0x1f')][_0x5aa2b6[_0x96e5('0x20')]]['id']=this[_0x96e5('0xe')][_0x5aa2b6[_0x96e5('0x20')]]['id'];this['channels'][_0x5aa2b6['uniqueid']]['name']=this[_0x96e5('0xe')][_0x5aa2b6[_0x96e5('0x20')]][_0x96e5('0x22')];}logger['info'](_0x5aa2b6[_0x96e5('0x20')],this[_0x96e5('0xe')][_0x5aa2b6['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x96e5('0x4c'),JSON[_0x96e5('0x3a')](this[_0x96e5('0x1f')][_0x5aa2b6[_0x96e5('0x20')]]));if(this['actions'][_0x5aa2b6[_0x96e5('0x20')]]){if(this[_0x96e5('0x1f')][_0x5aa2b6['uniqueid']]['faxpages']>0x0&&this[_0x96e5('0x1f')][_0x5aa2b6[_0x96e5('0x20')]]['faxstatus']===_0x96e5('0x4d')){this[_0x96e5('0x48')](_0x5aa2b6[_0x96e5('0x20')],!![]);}else{this[_0x96e5('0x48')](_0x5aa2b6['uniqueid'],![],this[_0x96e5('0x1f')][_0x5aa2b6[_0x96e5('0x20')]][_0x96e5('0x4e')]?_0x96e5('0x4f')+this[_0x96e5('0x1f')][_0x5aa2b6['uniqueid']][_0x96e5('0x4e')]:'SENDING\x20FAILED');}}}};Fax[_0x96e5('0x19')]['send']=function(_0x2f312d){var _0x38e4aa=this;return new BPromise(function(_0x1434c4,_0x53f68f){_0x38e4aa[_0x96e5('0x50')](_0x2f312d,_0x38e4aa[_0x96e5('0xc')][_0x2f312d['FaxAccountId']])['then'](function(_0xbb465c){ut[_0x96e5('0x45')](_0x96e5('0x51'),_0xbb465c);_0x1434c4(ut['message']('Fax\x20received'));})['catch'](function(_0x468c43){ut[_0x96e5('0x45')](_0x96e5('0x52'),_0x468c43);updateStatus(_0x2f312d);_0x53f68f(ut[_0x96e5('0x32')]('Fax\x20failed'));});});};Fax['prototype'][_0x96e5('0x53')]=function(_0x4b65c1){var _0x2f5961=this;return new BPromise(function(_0x4058fd,_0x56fb1b){var _0x1d428d=_0x2f5961['checkTrunk'](_0x2f5961[_0x96e5('0xc')][_0x4b65c1[_0x96e5('0x54')]][_0x96e5('0x55')],_0x4b65c1);if(_0x1d428d['isValid']){_0x4058fd(ut[_0x96e5('0x32')](_0x96e5('0x56')));}else{_0x56fb1b(ut[_0x96e5('0x32')](_0x1d428d['message']));}});};function originate(_0x5504d9,_0x4df3d5,_0x3ce586){return new BPromise(function(_0x113c10,_0x2f1d62){if(_0x3ce586){var _0x1ffc57=util[_0x96e5('0x57')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x96e5('0x33')](_0x5504d9[_0x96e5('0x4')])[_0x96e5('0x22')],_0x5504d9['path']);gs[_0x96e5('0x58')](_0x1ffc57)['then'](function(){_0x5504d9[_0x96e5('0x4')]=util[_0x96e5('0x57')]('%s/%s.tif',path[_0x96e5('0x33')](_0x5504d9['path'])[_0x96e5('0x59')],path[_0x96e5('0x33')](_0x5504d9[_0x96e5('0x4')])[_0x96e5('0x22')]);_0x4df3d5[_0x96e5('0x5a')]=_0x5504d9['path'];ut[_0x96e5('0x45')](_0x96e5('0x5b'),'');ami[_0x96e5('0x5c')](ut[_0x96e5('0x5d')](_0x5504d9,_0x4df3d5))[_0x96e5('0x36')](function(_0x15212e){_0x113c10(_0x15212e);})[_0x96e5('0x3b')](function(_0x5a9bf9){_0x2f1d62(_0x5a9bf9);});})['catch'](function(_0xcf63fa){_0x2f1d62(_0xcf63fa);});}else{ami[_0x96e5('0x5c')](ut[_0x96e5('0x5d')](_0x5504d9,_0x4df3d5))[_0x96e5('0x36')](function(_0x4c9d4e){_0x113c10(_0x4c9d4e);})['catch'](function(_0x189ac6){_0x2f1d62(_0x189ac6);});}});}Fax['prototype'][_0x96e5('0x50')]=function(_0x429f78,_0x6fc8d0){var _0x3fd211=this;return new BPromise(function(_0x124fbe,_0x246b19){var _0x192301=uuid['v4']();var _0x1ccbab=ut['addVariables'](_0x429f78,_0x6fc8d0);_0x3fd211[_0x96e5('0xe')][_0x192301]=new Action(_0x192301,_0x6fc8d0,_0x429f78);var _0x3678ed=_0x3fd211['actions'][_0x192301];if(path[_0x96e5('0x33')](_0x429f78[_0x96e5('0x4')])[_0x96e5('0x5e')]==='.pdf'){originate(_0x3678ed,_0x1ccbab,!![])[_0x96e5('0x36')](function(_0x2ae45c){_0x124fbe(_0x2ae45c);})[_0x96e5('0x3b')](function(_0x1adc1c){_0x246b19(_0x1adc1c);});}else{originate(_0x3678ed,_0x1ccbab,![])[_0x96e5('0x36')](function(_0x48e9fe){_0x124fbe(_0x48e9fe);})['catch'](function(_0x12d940){_0x246b19(_0x12d940);});}});};Fax[_0x96e5('0x19')][_0x96e5('0x5f')]=function(_0x2b5d62){return!_[_0x96e5('0x60')](_0x2b5d62)&&!_[_0x96e5('0x60')](_0x2b5d62[_0x96e5('0x22')])&&!_[_0x96e5('0x60')](_0x2b5d62[_0x96e5('0x61')])&&_0x2b5d62['active']&&!_[_0x96e5('0x60')](this[_0x96e5('0xd')][util[_0x96e5('0x57')](_0x96e5('0x62'),_0x2b5d62[_0x96e5('0x22')])])&&!_[_0x96e5('0x60')](this[_0x96e5('0xd')][util['format']('SIP/%s',_0x2b5d62[_0x96e5('0x22')])]['status'])&&(this[_0x96e5('0xd')][util['format']('SIP/%s',_0x2b5d62[_0x96e5('0x22')])][_0x96e5('0x63')]===_0x96e5('0x64')||this[_0x96e5('0xd')][util[_0x96e5('0x57')](_0x96e5('0x62'),_0x2b5d62['name'])][_0x96e5('0x63')]===_0x96e5('0x65'));};Fax[_0x96e5('0x19')][_0x96e5('0x66')]=function(_0x21ddc8,_0x275517){if(!this[_0x96e5('0x5f')](_0x21ddc8)){ut[_0x96e5('0x45')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_['isNil'](_0x21ddc8)?'':_0x21ddc8[_0x96e5('0x22')]+_0x96e5('0x67'));return{'isValid':![],'message':_0x96e5('0x68')};}if(_[_0x96e5('0x60')](_0x275517[_0x96e5('0x6')])){ut['logger']('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x96e5('0x3a')](_0x275517));return{'isValid':![],'message':_0x96e5('0x69')};}if(_['isNil'](_0x275517['path'])){ut[_0x96e5('0x45')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x96e5('0x3a')](_0x275517));return{'isValid':![],'message':_0x96e5('0x6a')};}return{'isValid':!![],'message':_0x96e5('0x6b')};};module[_0x96e5('0x6c')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 9a94366..ebb8a00 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 _0xfd0f=['../rpc/faxAccount','error','notify','then','catch','[Notify]\x20','../../../config/logger','preview'];(function(_0x3a72c5,_0x44dfa9){var _0x2ff06f=function(_0x40fcf4){while(--_0x40fcf4){_0x3a72c5['push'](_0x3a72c5['shift']());}};_0x2ff06f(++_0x44dfa9);}(_0xfd0f,0xf6));var _0xffd0=function(_0x38fb25,_0x2b69b2){_0x38fb25=_0x38fb25-0x0;var _0xfa0fea=_0xfd0f[_0x38fb25];return _0xfa0fea;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xffd0('0x0'))(_0xffd0('0x1'));var _=require('lodash');var faxAccount=require(_0xffd0('0x2'));function loggerCatch(_0x56a6b2){return function(_0x3e194e){logger[_0xffd0('0x3')](_0x56a6b2,util['inspect'](_0x3e194e,{'showHidden':![],'depth':null}));};}exports[_0xffd0('0x4')]=function(_0x5f4401,_0x4658bb){return BPromise['resolve']()[_0xffd0('0x5')](faxAccount[_0xffd0('0x4')](_0x5f4401,_0x4658bb))[_0xffd0('0x6')](loggerCatch(_0xffd0('0x7')));}; \ No newline at end of file +var _0xd567=['then','catch','[Notify]\x20','util','preview','lodash','error','inspect','notify','resolve'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xd567,0x193));var _0x7d56=function(_0x1a66f6,_0xbdf8e1){_0x1a66f6=_0x1a66f6-0x0;var _0x2972ed=_0xd567[_0x1a66f6];return _0x2972ed;};'use strict';var util=require(_0x7d56('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x7d56('0x1'));var _=require(_0x7d56('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x3f3176){return function(_0x389df8){logger[_0x7d56('0x3')](_0x3f3176,util[_0x7d56('0x4')](_0x389df8,{'showHidden':![],'depth':null}));};}exports[_0x7d56('0x5')]=function(_0xc21f5e,_0x194ce4){return BPromise[_0x7d56('0x6')]()[_0x7d56('0x7')](faxAccount[_0x7d56('0x5')](_0xc21f5e,_0x194ce4))[_0x7d56('0x8')](loggerCatch(_0x7d56('0x9')));}; \ 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 68dbfce..5d0cc51 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 _0x7865=['util','../../../../config/logger','fax','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x7865,0x10e));var _0x5786=function(_0x131c3b,_0x2ee862){_0x131c3b=_0x131c3b-0x0;var _0x3af0a9=_0x7865[_0x131c3b];return _0x3af0a9;};'use strict';var util=require(_0x5786('0x0'));var logger=require(_0x5786('0x1'))(_0x5786('0x2'));var BPromise=require('bluebird');var exec=require(_0x5786('0x3'))[_0x5786('0x4')];exports[_0x5786('0x5')]=function(_0x24397c){return new BPromise(function(_0x10f42c,_0x11fe33){exec(_0x24397c,function(_0x56ff1d,_0x48174c,_0x8c6fb7){logger[_0x5786('0x6')]('Exec\x20gs',_0x48174c);if(_0x56ff1d){logger[_0x5786('0x6')](_0x5786('0x7'),_0x5786('0x8'),util[_0x5786('0x9')](_0x56ff1d,{'showHidden':![],'depth':null}),_0x48174c,_0x8c6fb7);_0x11fe33(_0x56ff1d);}_0x10f42c(_0x48174c);});});}; \ No newline at end of file +var _0x94bb=['exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','bluebird'];(function(_0x4a67ff,_0x4aec58){var _0x1c19e8=function(_0x4d0aab){while(--_0x4d0aab){_0x4a67ff['push'](_0x4a67ff['shift']());}};_0x1c19e8(++_0x4aec58);}(_0x94bb,0x180));var _0xb94b=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0x94bb[_0x55c485];return _0x6bb521;};'use strict';var util=require(_0xb94b('0x0'));var logger=require(_0xb94b('0x1'))('fax');var BPromise=require(_0xb94b('0x2'));var exec=require('child_process')[_0xb94b('0x3')];exports[_0xb94b('0x4')]=function(_0x464304){return new BPromise(function(_0x360f96,_0x55f8f0){exec(_0x464304,function(_0x23bf24,_0x29e0ab,_0xfca70c){logger[_0xb94b('0x5')](_0xb94b('0x6'),_0x29e0ab);if(_0x23bf24){logger[_0xb94b('0x5')](_0xb94b('0x6'),_0xb94b('0x7'),util[_0xb94b('0x8')](_0x23bf24,{'showHidden':![],'depth':null}),_0x29e0ab,_0xfca70c);_0x55f8f0(_0x23bf24);}_0x360f96(_0x29e0ab);});});}; \ 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 d9dee11..fc01747 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 _0xd2ea=['variablesAction','uniqueid','originate','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','logger','info','inspect','addVariables','ecm','minrate','maxrate','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid'];(function(_0x5eb70f,_0x15e9ee){var _0x14090c=function(_0x353739){while(--_0x353739){_0x5eb70f['push'](_0x5eb70f['shift']());}};_0x14090c(++_0x15e9ee);}(_0xd2ea,0x15f));var _0xad2e=function(_0x1f8ac5,_0xd07676){_0x1f8ac5=_0x1f8ac5-0x0;var _0x312c32=_0xd2ea[_0x1f8ac5];return _0x312c32;};'use strict';var util=require(_0xad2e('0x0'));var _=require(_0xad2e('0x1'));var moment=require(_0xad2e('0x2'));var logger=require(_0xad2e('0x3'))(_0xad2e('0x4'));exports['message']=function(_0x3a9d11){return{'message':_0x3a9d11};};exports[_0xad2e('0x5')]=function(_0xcba7cb,_0x3e0741){logger[_0xad2e('0x6')](_0xcba7cb,util[_0xad2e('0x7')](_0x3e0741,{'showHidden':![],'depth':null}));};exports[_0xad2e('0x8')]=function(_0x592e8b,_0x3b5170){var _0x3e3d1f={'XMF-ECM':_0x3b5170[_0xad2e('0x9')],'XMF-HEADERINFO':_0x3b5170['headerinfo'],'XMF-MINRATE':_0x3b5170[_0xad2e('0xa')],'XMF-MAXRATE':_0x3b5170[_0xad2e('0xb')],'XMF-MODEM':util['format'](_0xad2e('0xc'),_0x3b5170['modem']),'XMF-GATEWAY':_0x3b5170[_0xad2e('0xd')],'XMF-FAXDETECT':_0x3b5170[_0xad2e('0xe')],'XMF-T38TIMEOUT':_0x3b5170[_0xad2e('0xf')],'XMF-LOCALSTATIONID':_0x3b5170[_0xad2e('0x10')],'XMF-PATH':_0x592e8b['path']};return _0x3e3d1f;};exports[_0xad2e('0x11')]=function(_0x5707a5,_0x42d2ac){return{'actionid':_0x5707a5[_0xad2e('0x12')],'action':_0xad2e('0x13'),'channel':_0x5707a5[_0xad2e('0x14')],'Exten':'xcally-motion-fax','Context':_0xad2e('0x15'),'Priority':'1','callerid':util['format'](_0xad2e('0x16'),_0x5707a5['headerinfo']?_0x5707a5['headerinfo']:'',_0x5707a5['localstationid']),'variable':_0x42d2ac,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5707a5['uniqueid']};}; \ No newline at end of file +var _0xb43b=['ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','from-sip','util','lodash','../../../../config/logger','fax','message','logger','info'];(function(_0x21e0af,_0x154d11){var _0x4421d8=function(_0x1cb2da){while(--_0x1cb2da){_0x21e0af['push'](_0x21e0af['shift']());}};_0x4421d8(++_0x154d11);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4d592e,_0x5eab2b){_0x4d592e=_0x4d592e-0x0;var _0x43b95f=_0xb43b[_0x4d592e];return _0x43b95f;};'use strict';var util=require(_0xbb43('0x0'));var _=require(_0xbb43('0x1'));var moment=require('moment');var logger=require(_0xbb43('0x2'))(_0xbb43('0x3'));exports[_0xbb43('0x4')]=function(_0x4cf605){return{'message':_0x4cf605};};exports[_0xbb43('0x5')]=function(_0x41aff6,_0x351254){logger[_0xbb43('0x6')](_0x41aff6,util['inspect'](_0x351254,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x378df5,_0x553520){var _0x80fe61={'XMF-ECM':_0x553520[_0xbb43('0x7')],'XMF-HEADERINFO':_0x553520[_0xbb43('0x8')],'XMF-MINRATE':_0x553520[_0xbb43('0x9')],'XMF-MAXRATE':_0x553520[_0xbb43('0xa')],'XMF-MODEM':util['format'](_0xbb43('0xb'),_0x553520[_0xbb43('0xc')]),'XMF-GATEWAY':_0x553520['gateway'],'XMF-FAXDETECT':_0x553520[_0xbb43('0xd')],'XMF-T38TIMEOUT':_0x553520[_0xbb43('0xe')],'XMF-LOCALSTATIONID':_0x553520[_0xbb43('0xf')],'XMF-PATH':_0x378df5[_0xbb43('0x10')]};return _0x80fe61;};exports[_0xbb43('0x11')]=function(_0x2bef86,_0x480cc2){return{'actionid':_0x2bef86[_0xbb43('0x12')],'action':_0xbb43('0x13'),'channel':_0x2bef86['channel'],'Exten':'xcally-motion-fax','Context':_0xbb43('0x14'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x2bef86[_0xbb43('0x8')]?_0x2bef86['headerinfo']:'',_0x2bef86[_0xbb43('0xf')]),'variable':_0x480cc2,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2bef86[_0xbb43('0x12')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 27916a8..3423ac0 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 _0xb973=['getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./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/dynamics365','hour','get','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts'];(function(_0x15ad6e,_0x1d118c){var _0x7eccad=function(_0x13c5e4){while(--_0x13c5e4){_0x15ad6e['push'](_0x15ad6e['shift']());}};_0x7eccad(++_0x1d118c);}(_0xb973,0x127));var _0x3b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb973[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require(_0x3b97('0x0'));var moment=require(_0x3b97('0x1'));var server=require('./server');var Realtime=require(_0x3b97('0x2'));var Report=require(_0x3b97('0x3'));var Acw=require(_0x3b97('0x4'));var Trigger=require(_0x3b97('0x5'));var Dialer=require(_0x3b97('0x6'));var Preview=require(_0x3b97('0x7'));var Fax=require(_0x3b97('0x8'));var user=require('./rpc/user');var voiceQueue=require(_0x3b97('0x9'));var voiceQueueReport=require(_0x3b97('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x3b97('0xb'));var trigger=require(_0x3b97('0xc'));var template=require(_0x3b97('0xd'));var cmHopperHistory=require(_0x3b97('0xe'));var campaign=require(_0x3b97('0xf'));var voiceExtension=require(_0x3b97('0x10'));var faxAccount=require(_0x3b97('0x11'));var zendesk=require(_0x3b97('0x12'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x3b97('0x13'));var freshdesk=require(_0x3b97('0x14'));var desk=require(_0x3b97('0x15'));var zoho=require(_0x3b97('0x16'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x3b97('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x3b97('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x3b97('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x3b97('0x1a')](_0x3b97('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0x3b97('0x1b')]()[_0x3b97('0x1c')](user['getAgents']())[_0x3b97('0x1c')](realtime[_0x3b97('0x1d')]())[_0x3b97('0x1c')](user[_0x3b97('0x1e')]())[_0x3b97('0x1c')](realtime[_0x3b97('0x1f')]())[_0x3b97('0x1c')](trunk[_0x3b97('0x20')]())[_0x3b97('0x1c')](realtime['initTrunks']())['then'](voiceQueue[_0x3b97('0x21')]())[_0x3b97('0x1c')](realtime[_0x3b97('0x22')]())[_0x3b97('0x1c')](trigger[_0x3b97('0x23')]())[_0x3b97('0x1c')](realtime['initTriggers']())[_0x3b97('0x1c')](template[_0x3b97('0x24')]())[_0x3b97('0x1c')](realtime[_0x3b97('0x25')]())[_0x3b97('0x1c')](zendesk[_0x3b97('0x26')]())[_0x3b97('0x1c')](realtime[_0x3b97('0x27')]())['then'](salesforce['getSalesforceAccounts']())['then'](realtime['initSalesforceAccounts']())[_0x3b97('0x1c')](sugarcrm[_0x3b97('0x28')]())[_0x3b97('0x1c')](realtime[_0x3b97('0x29')]())[_0x3b97('0x1c')](freshdesk['getFreshdeskAccounts']())[_0x3b97('0x1c')](realtime[_0x3b97('0x2a')]())['then'](desk[_0x3b97('0x2b')]())['then'](realtime[_0x3b97('0x2c')]())['then'](zoho[_0x3b97('0x2d')]())[_0x3b97('0x1c')](realtime['initZohoAccounts']())['then'](vtiger[_0x3b97('0x2e')]())[_0x3b97('0x1c')](realtime[_0x3b97('0x2f')]())[_0x3b97('0x1c')](freshsales[_0x3b97('0x30')]())[_0x3b97('0x1c')](realtime[_0x3b97('0x31')]())['then'](servicenow['getServicenowAccounts']())[_0x3b97('0x1c')](realtime[_0x3b97('0x32')]())[_0x3b97('0x1c')](dynamics365['getDynamics365Accounts']())[_0x3b97('0x1c')](realtime['initDynamics365Accounts']())[_0x3b97('0x1c')](campaign[_0x3b97('0x33')]())[_0x3b97('0x1c')](realtime['initCampaigns']())[_0x3b97('0x1c')](voiceExtension[_0x3b97('0x34')]())[_0x3b97('0x1c')](realtime[_0x3b97('0x35')]())[_0x3b97('0x1c')](faxAccount[_0x3b97('0x36')]())['then'](realtime[_0x3b97('0x37')]())[_0x3b97('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0x3b97('0x1b')]()[_0x3b97('0x1c')](voiceQueueReport[_0x3b97('0x38')]())[_0x3b97('0x1c')](realtime[_0x3b97('0x39')]())[_0x3b97('0x1c')](cmHopperHistory[_0x3b97('0x3a')]())[_0x3b97('0x1c')](realtime[_0x3b97('0x3b')]())[_0x3b97('0x1c')](cmHopperHistory[_0x3b97('0x3c')]())[_0x3b97('0x1c')](realtime[_0x3b97('0x3d')]())[_0x3b97('0x1c')](voiceCallReport[_0x3b97('0x3e')]())['then'](realtime[_0x3b97('0x3f')]())[_0x3b97('0x1c')](function(_0x3bf646){})[_0x3b97('0x40')](function(_0x16ff51){console[_0x3b97('0x41')](_0x16ff51);});}function main(){return server[_0x3b97('0x42')](realtime,preview,fax)[_0x3b97('0x1c')](function(_0xfc9b3f){return initRealtime();})['then'](function(){return initParams();})[_0x3b97('0x1c')](function(){report[_0x3b97('0x43')]();setInterval(initRealtime,0x1388);})[_0x3b97('0x40')](function(_0x2fa324){console[_0x3b97('0x41')](_0x2fa324);});}main(); \ No newline at end of file +var _0x413c=['getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts'];(function(_0x30e1c7,_0x52ca83){var _0xea9655=function(_0x4b2613){while(--_0x4b2613){_0x30e1c7['push'](_0x30e1c7['shift']());}};_0xea9655(++_0x52ca83);}(_0x413c,0x138));var _0xc413=function(_0x37c37d,_0x327f73){_0x37c37d=_0x37c37d-0x0;var _0x119783=_0x413c[_0x37c37d];return _0x119783;};'use strict';var BPromise=require(_0xc413('0x0'));var util=require(_0xc413('0x1'));var moment=require(_0xc413('0x2'));var server=require(_0xc413('0x3'));var Realtime=require(_0xc413('0x4'));var Report=require(_0xc413('0x5'));var Acw=require(_0xc413('0x6'));var Trigger=require(_0xc413('0x7'));var Dialer=require(_0xc413('0x8'));var Preview=require(_0xc413('0x9'));var Fax=require(_0xc413('0xa'));var user=require('./rpc/user');var voiceQueue=require(_0xc413('0xb'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xc413('0xc'));var trunk=require(_0xc413('0xd'));var trigger=require(_0xc413('0xe'));var template=require(_0xc413('0xf'));var cmHopperHistory=require(_0xc413('0x10'));var campaign=require(_0xc413('0x11'));var voiceExtension=require(_0xc413('0x12'));var faxAccount=require(_0xc413('0x13'));var zendesk=require(_0xc413('0x14'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xc413('0x15'));var zoho=require(_0xc413('0x16'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xc413('0x17'));var servicenow=require(_0xc413('0x18'));var dynamics365=require(_0xc413('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xc413('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xc413('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xc413('0x1b')]()[_0xc413('0x1c')](user[_0xc413('0x1d')]())[_0xc413('0x1c')](realtime[_0xc413('0x1e')]())[_0xc413('0x1c')](user[_0xc413('0x1f')]())[_0xc413('0x1c')](realtime[_0xc413('0x20')]())['then'](trunk[_0xc413('0x21')]())[_0xc413('0x1c')](realtime[_0xc413('0x22')]())['then'](voiceQueue[_0xc413('0x23')]())['then'](realtime['initVoiceQueues']())[_0xc413('0x1c')](trigger[_0xc413('0x24')]())[_0xc413('0x1c')](realtime['initTriggers']())[_0xc413('0x1c')](template[_0xc413('0x25')]())[_0xc413('0x1c')](realtime[_0xc413('0x26')]())[_0xc413('0x1c')](zendesk[_0xc413('0x27')]())[_0xc413('0x1c')](realtime[_0xc413('0x28')]())['then'](salesforce[_0xc413('0x29')]())[_0xc413('0x1c')](realtime[_0xc413('0x2a')]())[_0xc413('0x1c')](sugarcrm['getSugarcrmAccounts']())[_0xc413('0x1c')](realtime['initSugarcrmAccounts']())[_0xc413('0x1c')](freshdesk[_0xc413('0x2b')]())[_0xc413('0x1c')](realtime['initFreshdeskAccounts']())[_0xc413('0x1c')](desk[_0xc413('0x2c')]())['then'](realtime[_0xc413('0x2d')]())[_0xc413('0x1c')](zoho[_0xc413('0x2e')]())[_0xc413('0x1c')](realtime[_0xc413('0x2f')]())[_0xc413('0x1c')](vtiger[_0xc413('0x30')]())[_0xc413('0x1c')](realtime[_0xc413('0x31')]())[_0xc413('0x1c')](freshsales[_0xc413('0x32')]())[_0xc413('0x1c')](realtime[_0xc413('0x33')]())[_0xc413('0x1c')](servicenow[_0xc413('0x34')]())[_0xc413('0x1c')](realtime[_0xc413('0x35')]())['then'](dynamics365[_0xc413('0x36')]())[_0xc413('0x1c')](realtime[_0xc413('0x37')]())['then'](campaign[_0xc413('0x38')]())[_0xc413('0x1c')](realtime[_0xc413('0x39')]())[_0xc413('0x1c')](voiceExtension[_0xc413('0x3a')]())[_0xc413('0x1c')](realtime[_0xc413('0x3b')]())[_0xc413('0x1c')](faxAccount[_0xc413('0x3c')]())['then'](realtime[_0xc413('0x3d')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xc413('0x1b')]()[_0xc413('0x1c')](voiceQueueReport['getVoiceQueueReports']())[_0xc413('0x1c')](realtime[_0xc413('0x3e')]())[_0xc413('0x1c')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xc413('0x1c')](realtime['initVoiceQueueHopperHistory']())[_0xc413('0x1c')](cmHopperHistory[_0xc413('0x3f')]())[_0xc413('0x1c')](realtime[_0xc413('0x40')]())[_0xc413('0x1c')](voiceCallReport[_0xc413('0x41')]())[_0xc413('0x1c')](realtime[_0xc413('0x42')]())[_0xc413('0x1c')](function(_0x28e60c){})[_0xc413('0x43')](function(_0x4be970){console[_0xc413('0x44')](_0x4be970);});}function main(){return server[_0xc413('0x45')](realtime,preview,fax)['then'](function(_0x2bee16){return initRealtime();})[_0xc413('0x1c')](function(){return initParams();})[_0xc413('0x1c')](function(){report[_0xc413('0x46')]();setInterval(initRealtime,0x1388);})[_0xc413('0x43')](function(_0x17ab0d){console[_0xc413('0x44')](_0x17ab0d);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index fd0ab35..c8752f8 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 _0x96d8=['status','address','phone','mobile','interface','online','voiceStatus','voiceStatusQueue','local','md5','prototype','toLowerCase','not_inuse','idle','inuse','talking','voiceStatusTime','toNumber','format','name','email','stateTime','voiceStatusCallerIdNumber','onhold','stringify','user:save','lodash','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','accountcode','fullname','state','unknown'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x96d8,0x1ca));var _0x896d=function(_0x4d17e9,_0x37b067){_0x4d17e9=_0x4d17e9-0x0;var _0x81868=_0x96d8[_0x4d17e9];return _0x81868;};'use strict';var _=require(_0x896d('0x0'));var util=require('util');var moment=require('moment');var md5=require('md5');var Redis=require(_0x896d('0x1'));var config=require(_0x896d('0x2'));config[_0x896d('0x3')]=_['defaults'](config['redis'],{'host':_0x896d('0x4'),'port':0x18eb});var io=require(_0x896d('0x5'))(new Redis(config['redis']));function Agent(_0x4232fa){this['id']=_0x4232fa['id']||0x0;this['name']=_0x4232fa['name']||'';this['email']=_0x4232fa['email']||'';this['accountcode']=_0x4232fa[_0x896d('0x6')]||'';this['fullname']=_0x4232fa[_0x896d('0x7')]||'';this[_0x896d('0x8')]=_0x896d('0x9');this['stateTime']=0x0;this[_0x896d('0xa')]=_0x896d('0x9');this[_0x896d('0xb')]='';this[_0x896d('0xc')]='';this[_0x896d('0xd')]='';this[_0x896d('0xe')]='';this['online']=_0x4232fa[_0x896d('0xf')]||![];this[_0x896d('0x10')]=_0x896d('0x9');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x896d('0x11')]='';this['onhold']=![];this[_0x896d('0x12')]=![];this[_0x896d('0x13')]='';}Agent[_0x896d('0x14')]['updateStatusRealtime']=function(_0x3271a9){var _0x46f967;if(_0x3271a9&&_0x3271a9[_0x896d('0x8')]){_0x46f967=_0x3271a9['state'][_0x896d('0x15')]();switch(_0x46f967){case _0x896d('0x16'):_0x46f967=_0x896d('0x17');break;case _0x896d('0x18'):_0x46f967=_0x896d('0x19');break;}}if(_0x46f967&&this[_0x896d('0x10')]!==_0x46f967||_0x3271a9['statePause']){this[_0x896d('0x1a')]=_[_0x896d('0x1b')](moment()[_0x896d('0x1c')]('x'));}if(_0x46f967){this['voiceStatus']=_0x46f967;}var _0x4def9c={'id':this['id'],'name':this[_0x896d('0x1d')],'email':this[_0x896d('0x1e')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x896d('0x8')],'stateTime':this[_0x896d('0x1f')],'status':this['status'],'address':this['address'],'online':this[_0x896d('0xf')],'voiceStatus':this[_0x896d('0x10')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x896d('0x20')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x896d('0xe')],'onhold':this[_0x896d('0x21')]};var _0x3af182=md5(JSON[_0x896d('0x22')](_0x4def9c));if(this['md5']!==_0x3af182){this[_0x896d('0x13')]=_0x3af182;io['to'](util[_0x896d('0x1c')]('user:%s',_0x4def9c['name']))['emit'](_0x896d('0x23'),_0x4def9c);}};module['exports']=Agent; \ No newline at end of file +var _0x9af1=['toNumber','format','accountcode','status','voiceStatusTime','stringify','user:%s','emit','user:save','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','fullname','state','address','mobile','interface','online','unknown','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9af1,0x1d8));var _0x19af=function(_0x5c43bf,_0xfcc422){_0x5c43bf=_0x5c43bf-0x0;var _0x1cba67=_0x9af1[_0x5c43bf];return _0x1cba67;};'use strict';var _=require(_0x19af('0x0'));var util=require(_0x19af('0x1'));var moment=require(_0x19af('0x2'));var md5=require(_0x19af('0x3'));var Redis=require(_0x19af('0x4'));var config=require(_0x19af('0x5'));config[_0x19af('0x6')]=_[_0x19af('0x7')](config[_0x19af('0x6')],{'host':_0x19af('0x8'),'port':0x18eb});var io=require(_0x19af('0x9'))(new Redis(config['redis']));function Agent(_0xd685dc){this['id']=_0xd685dc['id']||0x0;this[_0x19af('0xa')]=_0xd685dc['name']||'';this[_0x19af('0xb')]=_0xd685dc['email']||'';this['accountcode']=_0xd685dc['accountcode']||'';this[_0x19af('0xc')]=_0xd685dc[_0x19af('0xc')]||'';this[_0x19af('0xd')]='unknown';this['stateTime']=0x0;this['status']='unknown';this[_0x19af('0xe')]='';this['phone']='';this[_0x19af('0xf')]='';this[_0x19af('0x10')]='';this[_0x19af('0x11')]=_0xd685dc['online']||![];this['voiceStatus']=_0x19af('0x12');this['voiceStatusTime']=0x0;this[_0x19af('0x13')]='';this[_0x19af('0x14')]='';this[_0x19af('0x15')]=![];this[_0x19af('0x16')]=![];this[_0x19af('0x3')]='';}Agent[_0x19af('0x17')][_0x19af('0x18')]=function(_0x578096){var _0x13b9ae;if(_0x578096&&_0x578096[_0x19af('0xd')]){_0x13b9ae=_0x578096[_0x19af('0xd')][_0x19af('0x19')]();switch(_0x13b9ae){case _0x19af('0x1a'):_0x13b9ae=_0x19af('0x1b');break;case _0x19af('0x1c'):_0x13b9ae=_0x19af('0x1d');break;}}if(_0x13b9ae&&this[_0x19af('0x1e')]!==_0x13b9ae||_0x578096[_0x19af('0x1f')]){this['voiceStatusTime']=_[_0x19af('0x20')](moment()[_0x19af('0x21')]('x'));}if(_0x13b9ae){this['voiceStatus']=_0x13b9ae;}var _0x1df4df={'id':this['id'],'name':this[_0x19af('0xa')],'email':this[_0x19af('0xb')],'accountcode':this[_0x19af('0x22')],'fullname':this['fullname'],'state':this[_0x19af('0xd')],'stateTime':this['stateTime'],'status':this[_0x19af('0x23')],'address':this[_0x19af('0xe')],'online':this[_0x19af('0x11')],'voiceStatus':this[_0x19af('0x1e')],'voiceStatusTime':this[_0x19af('0x24')],'voiceStatusCallerIdNumber':this[_0x19af('0x13')],'voiceStatusQueue':this[_0x19af('0x14')],'interface':this[_0x19af('0x10')],'onhold':this[_0x19af('0x15')]};var _0x5c0c81=md5(JSON[_0x19af('0x25')](_0x1df4df));if(this[_0x19af('0x3')]!==_0x5c0c81){this[_0x19af('0x3')]=_0x5c0c81;io['to'](util[_0x19af('0x21')](_0x19af('0x26'),_0x1df4df[_0x19af('0xa')]))[_0x19af('0x27')](_0x19af('0x28'),_0x1df4df);}};module[_0x19af('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 0ac545b..07139ea 100644 --- a/server/services/ami/model/campaign.js +++ b/server/services/ami/model/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency'];(function(_0x5a7e3c,_0xdc9219){var _0x59252b=function(_0x29655c){while(--_0x29655c){_0x5a7e3c['push'](_0x5a7e3c['shift']());}};_0x59252b(++_0xdc9219);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';function Campaign(_0x5d04de){this['id']=_0x5d04de['id']||0x0;this[_0x0d8b('0x0')]=_0x5d04de['name']||'';this['type']=_0x5d04de['type']||_0x0d8b('0x1');this[_0x0d8b('0x2')]=0x0;this[_0x0d8b('0x3')]=0x0;this[_0x0d8b('0x4')]=0x0;this[_0x0d8b('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x0d8b('0x6')]=_0x5d04de[_0x0d8b('0x6')];this[_0x0d8b('0x7')]=_0x5d04de['limitCalls'];this[_0x0d8b('0x8')]=_0x5d04de[_0x0d8b('0x8')]||null;this['dialGlobalInterval']=_0x5d04de[_0x0d8b('0x9')]?_0x5d04de[_0x0d8b('0x9')]:null;this[_0x0d8b('0xa')]=_0x5d04de[_0x0d8b('0xa')];this[_0x0d8b('0xb')]=_0x5d04de[_0x0d8b('0xb')];this[_0x0d8b('0xc')]=_0x5d04de[_0x0d8b('0xc')]||0x1e;this['dialCongestionMaxRetry']=_0x5d04de[_0x0d8b('0xd')];this['dialCongestionRetryFrequency']=_0x5d04de[_0x0d8b('0xe')];this[_0x0d8b('0xf')]=_0x5d04de[_0x0d8b('0xf')];this[_0x0d8b('0x10')]=_0x5d04de[_0x0d8b('0x10')];this[_0x0d8b('0x11')]=_0x5d04de[_0x0d8b('0x11')];this[_0x0d8b('0x12')]=_0x5d04de[_0x0d8b('0x12')];this[_0x0d8b('0x13')]=_0x5d04de[_0x0d8b('0x13')];this[_0x0d8b('0x14')]=_0x5d04de[_0x0d8b('0x14')]||_0x0d8b('0x15');this['dialPrefix']=_0x5d04de[_0x0d8b('0x16')]||undefined;this[_0x0d8b('0x17')]=_0x5d04de[_0x0d8b('0x17')]||undefined;this[_0x0d8b('0x18')]=_0x5d04de[_0x0d8b('0x18')]||undefined;this['TrunkBackup']=_0x5d04de[_0x0d8b('0x19')]?_0x5d04de[_0x0d8b('0x19')]:undefined;this[_0x0d8b('0x1a')]=_0x5d04de[_0x0d8b('0x1a')]?_0x5d04de[_0x0d8b('0x1a')]:undefined;this[_0x0d8b('0x1b')]=_0x5d04de[_0x0d8b('0x1b')]?_0x5d04de[_0x0d8b('0x1b')]:undefined;this['SquareProject']=_0x5d04de[_0x0d8b('0x1c')]?_0x5d04de[_0x0d8b('0x1c')]:undefined;this[_0x0d8b('0x1d')]=_0x5d04de[_0x0d8b('0x1c')]?_0x5d04de[_0x0d8b('0x1c')][_0x0d8b('0x0')]:undefined;this[_0x0d8b('0x1e')]=_0x5d04de[_0x0d8b('0x1e')]||![];this['dialAMDInitialSilence']=_0x5d04de['dialAMDInitialSilence'];this[_0x0d8b('0x1f')]=_0x5d04de['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x5d04de['dialAMDAfterGreetingSilence'];this[_0x0d8b('0x20')]=_0x5d04de[_0x0d8b('0x20')];this[_0x0d8b('0x21')]=_0x5d04de[_0x0d8b('0x21')];this[_0x0d8b('0x22')]=_0x5d04de[_0x0d8b('0x22')];this[_0x0d8b('0x23')]=_0x5d04de[_0x0d8b('0x23')];this[_0x0d8b('0x24')]=_0x5d04de['dialAMDSilenceThreshold'];this[_0x0d8b('0x25')]=_0x5d04de[_0x0d8b('0x25')];}module['exports']=Campaign; \ No newline at end of file +var _0x2032=['ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','ivrAnswerCallsDay'];(function(_0x458b9d,_0x4982f1){var _0x2842b5=function(_0x5b19f3){while(--_0x5b19f3){_0x458b9d['push'](_0x458b9d['shift']());}};_0x2842b5(++_0x4982f1);}(_0x2032,0xd9));var _0x2203=function(_0x10e91b,_0x437f6){_0x10e91b=_0x10e91b-0x0;var _0x18744c=_0x2032[_0x10e91b];return _0x18744c;};'use strict';function Campaign(_0x4d6c97){this['id']=_0x4d6c97['id']||0x0;this[_0x2203('0x0')]=_0x4d6c97[_0x2203('0x0')]||'';this[_0x2203('0x1')]=_0x4d6c97['type']||_0x2203('0x2');this[_0x2203('0x3')]=0x0;this['temp']=0x0;this[_0x2203('0x4')]=0x0;this[_0x2203('0x5')]=0x0;this[_0x2203('0x6')]='';this[_0x2203('0x7')]=!![];this[_0x2203('0x8')]=_0x4d6c97[_0x2203('0x8')];this[_0x2203('0x9')]=_0x4d6c97[_0x2203('0x9')];this[_0x2203('0xa')]=_0x4d6c97[_0x2203('0xa')]||null;this[_0x2203('0xb')]=_0x4d6c97['dialGlobalInterval']?_0x4d6c97['dialGlobalInterval']:null;this[_0x2203('0xc')]=_0x4d6c97['dialOriginateCallerIdName'];this[_0x2203('0xd')]=_0x4d6c97[_0x2203('0xd')];this[_0x2203('0xe')]=_0x4d6c97['dialOriginateTimeout']||0x1e;this[_0x2203('0xf')]=_0x4d6c97['dialCongestionMaxRetry'];this[_0x2203('0x10')]=_0x4d6c97['dialCongestionRetryFrequency'];this[_0x2203('0x11')]=_0x4d6c97[_0x2203('0x11')];this['dialBusyRetryFrequency']=_0x4d6c97['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x4d6c97['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x4d6c97[_0x2203('0x12')];this['dialGlobalMaxRetry']=_0x4d6c97['dialGlobalMaxRetry'];this[_0x2203('0x13')]=_0x4d6c97[_0x2203('0x13')]||_0x2203('0x14');this[_0x2203('0x15')]=_0x4d6c97[_0x2203('0x15')]||undefined;this[_0x2203('0x16')]=_0x4d6c97[_0x2203('0x16')]||undefined;this[_0x2203('0x17')]=_0x4d6c97[_0x2203('0x17')]||undefined;this[_0x2203('0x18')]=_0x4d6c97['TrunkBackup']?_0x4d6c97[_0x2203('0x18')]:undefined;this[_0x2203('0x19')]=_0x4d6c97['Trunk']?_0x4d6c97[_0x2203('0x19')]:undefined;this[_0x2203('0x1a')]=_0x4d6c97['Interval']?_0x4d6c97[_0x2203('0x1a')]:undefined;this['SquareProject']=_0x4d6c97[_0x2203('0x1b')]?_0x4d6c97[_0x2203('0x1b')]:undefined;this[_0x2203('0x1c')]=_0x4d6c97[_0x2203('0x1b')]?_0x4d6c97[_0x2203('0x1b')][_0x2203('0x0')]:undefined;this['dialAMDActive']=_0x4d6c97[_0x2203('0x1d')]||![];this['dialAMDInitialSilence']=_0x4d6c97['dialAMDInitialSilence'];this[_0x2203('0x1e')]=_0x4d6c97['dialAMDGreeting'];this[_0x2203('0x1f')]=_0x4d6c97[_0x2203('0x1f')];this['dialAMDTotalAnalysisTime']=_0x4d6c97[_0x2203('0x20')];this['dialAMDMinWordLength']=_0x4d6c97['dialAMDMinWordLength'];this[_0x2203('0x21')]=_0x4d6c97[_0x2203('0x21')];this[_0x2203('0x22')]=_0x4d6c97[_0x2203('0x22')];this[_0x2203('0x23')]=_0x4d6c97[_0x2203('0x23')];this[_0x2203('0x24')]=_0x4d6c97[_0x2203('0x24')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index c570602..dd34330 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 _0x1867=['linkedid','exten','answered','answertime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid'];(function(_0xc09ab7,_0x13a21c){var _0x425def=function(_0x3a16d7){while(--_0x3a16d7){_0xc09ab7['push'](_0xc09ab7['shift']());}};_0x425def(++_0x13a21c);}(_0x1867,0xb5));var _0x7186=function(_0x191879,_0x29729a){_0x191879=_0x191879-0x0;var _0x2b0998=_0x1867[_0x191879];return _0x2b0998;};'use strict';function Channel(){this[_0x7186('0x0')]=null;this[_0x7186('0x1')]='';this['destinationchannel']='';this[_0x7186('0x2')]=0x0;this['calleridname']='';this[_0x7186('0x3')]=undefined;this[_0x7186('0x4')]=undefined;this[_0x7186('0x5')]=0x0;this[_0x7186('0x6')]='';this[_0x7186('0x7')]=0x0;this[_0x7186('0x8')]=0x0;this[_0x7186('0x9')]=0x0;this[_0x7186('0xa')]=![];this[_0x7186('0xb')]=null;this['endtime']=null;this[_0x7186('0xc')]=![];this[_0x7186('0xd')]=![];this['lastapplication']='';this[_0x7186('0xe')]='';this[_0x7186('0xf')]=0x0;this[_0x7186('0x10')]=0x0;this[_0x7186('0x11')]=0x0;this['type']=null;this[_0x7186('0x12')]=null;this[_0x7186('0x13')]=null;this[_0x7186('0x14')]=![];this[_0x7186('0x15')]=null;this[_0x7186('0x16')]=null;this['monitors']=[];this[_0x7186('0x17')]=undefined;this[_0x7186('0x18')]=undefined;this[_0x7186('0x19')]=0x0;}module[_0x7186('0x1a')]=Channel; \ No newline at end of file +var _0x6f75=['disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','endtime','unmanaged','lastapplication','billableseconds','holdtime','type','tag'];(function(_0x10c4f9,_0x100fb4){var _0x522b09=function(_0x3325e4){while(--_0x3325e4){_0x10c4f9['push'](_0x10c4f9['shift']());}};_0x522b09(++_0x100fb4);}(_0x6f75,0x71));var _0x56f7=function(_0x26d42b,_0x58bdd6){_0x26d42b=_0x26d42b-0x0;var _0x54c088=_0x6f75[_0x26d42b];return _0x54c088;};'use strict';function Channel(){this[_0x56f7('0x0')]=null;this[_0x56f7('0x1')]='';this[_0x56f7('0x2')]='';this[_0x56f7('0x3')]=0x0;this[_0x56f7('0x4')]='';this[_0x56f7('0x5')]=undefined;this[_0x56f7('0x6')]=undefined;this['accountcode']=0x0;this[_0x56f7('0x7')]='';this[_0x56f7('0x8')]=0x0;this[_0x56f7('0x9')]=0x0;this['exten']=0x0;this['answered']=![];this['answertime']=null;this[_0x56f7('0xa')]=null;this[_0x56f7('0xb')]=![];this['abandoned']=![];this[_0x56f7('0xc')]='';this['lastdata']='';this['duration']=0x0;this[_0x56f7('0xd')]=0x0;this[_0x56f7('0xe')]=0x0;this[_0x56f7('0xf')]=null;this[_0x56f7('0x10')]=null;this[_0x56f7('0x11')]=null;this[_0x56f7('0x12')]=![];this[_0x56f7('0x13')]=null;this[_0x56f7('0x14')]=null;this[_0x56f7('0x15')]=[];this[_0x56f7('0x16')]=undefined;this[_0x56f7('0x17')]=undefined;this[_0x56f7('0x18')]=0x0;}module[_0x56f7('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 0047c85..9c872b2 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 _0x4403=['serverUrl','Configurations','exports','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x4403,0x179));var _0x3440=function(_0x10734e,_0x51cadb){_0x10734e=_0x10734e-0x0;var _0x2a059c=_0x4403[_0x10734e];return _0x2a059c;};'use strict';function DeskAccount(_0x5e2430){this['id']=_0x5e2430['id']||0x0;this['name']=_0x5e2430['name']||'';this[_0x3440('0x0')]=_0x5e2430['username']||'';this[_0x3440('0x1')]=_0x5e2430[_0x3440('0x1')]||'';this[_0x3440('0x2')]=_0x5e2430[_0x3440('0x2')]||'';this['password']=_0x5e2430[_0x3440('0x3')]||'';this['consumerKey']=_0x5e2430['consumerKey']||'';this[_0x3440('0x4')]=_0x5e2430[_0x3440('0x4')]||'';this[_0x3440('0x5')]=_0x5e2430['token']||'';this[_0x3440('0x6')]=_0x5e2430['tokenSecret']||'';this[_0x3440('0x7')]=_0x5e2430[_0x3440('0x7')]||'';this[_0x3440('0x8')]=_0x5e2430['serverUrl']||'';this[_0x3440('0x9')]=_0x5e2430[_0x3440('0x9')]||{};}module[_0x3440('0xa')]=DeskAccount; \ No newline at end of file +var _0x6c7b=['type','serverUrl','Configurations','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x3711d9,_0x1b36b6){var _0x395e6d=function(_0x299170){while(--_0x299170){_0x3711d9['push'](_0x3711d9['shift']());}};_0x395e6d(++_0x1b36b6);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x46e44f,_0x483584){_0x46e44f=_0x46e44f-0x0;var _0x267af1=_0x6c7b[_0x46e44f];return _0x267af1;};'use strict';function DeskAccount(_0x44a00a){this['id']=_0x44a00a['id']||0x0;this['name']=_0x44a00a['name']||'';this['username']=_0x44a00a[_0xb6c7('0x0')]||'';this['remoteUri']=_0x44a00a[_0xb6c7('0x1')]||'';this[_0xb6c7('0x2')]=_0x44a00a[_0xb6c7('0x2')]||'';this['password']=_0x44a00a[_0xb6c7('0x3')]||'';this[_0xb6c7('0x4')]=_0x44a00a[_0xb6c7('0x4')]||'';this[_0xb6c7('0x5')]=_0x44a00a[_0xb6c7('0x5')]||'';this['token']=_0x44a00a[_0xb6c7('0x6')]||'';this[_0xb6c7('0x7')]=_0x44a00a[_0xb6c7('0x7')]||'';this[_0xb6c7('0x8')]=_0x44a00a[_0xb6c7('0x8')]||'';this[_0xb6c7('0x9')]=_0x44a00a[_0xb6c7('0x9')]||'';this[_0xb6c7('0xa')]=_0x44a00a['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 2bfaa88..f14676b 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 _0x86a8=['clientSecret','serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId'];(function(_0x210e3e,_0x1dae2c){var _0x4603fe=function(_0x2e4e31){while(--_0x2e4e31){_0x210e3e['push'](_0x210e3e['shift']());}};_0x4603fe(++_0x1dae2c);}(_0x86a8,0x19e));var _0x886a=function(_0x272a7c,_0x51aa28){_0x272a7c=_0x272a7c-0x0;var _0x5e24ca=_0x86a8[_0x272a7c];return _0x5e24ca;};'use strict';function Dynamics365Account(_0x1cd09c){this['id']=_0x1cd09c['id']||0x0;this[_0x886a('0x0')]=_0x1cd09c['name']||'';this[_0x886a('0x1')]=_0x1cd09c['username']||'';this[_0x886a('0x2')]=_0x1cd09c[_0x886a('0x2')]||'';this['remoteUri']=_0x1cd09c[_0x886a('0x3')]||'';this[_0x886a('0x4')]=_0x1cd09c[_0x886a('0x4')]||'';this[_0x886a('0x5')]=_0x1cd09c[_0x886a('0x5')]||'';this[_0x886a('0x6')]=_0x1cd09c[_0x886a('0x6')]||{};this['serverUrl']=_0x1cd09c[_0x886a('0x7')]||'';this[_0x886a('0x8')]=_0x1cd09c[_0x886a('0x8')]||{};}module[_0x886a('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xfc73=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x5a1cc9,_0x28f54d){var _0x471761=function(_0xda51c0){while(--_0xda51c0){_0x5a1cc9['push'](_0x5a1cc9['shift']());}};_0x471761(++_0x28f54d);}(_0xfc73,0x1d9));var _0x3fc7=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xfc73[_0x4a9fb1];return _0x348672;};'use strict';function Dynamics365Account(_0x4d3c80){this['id']=_0x4d3c80['id']||0x0;this['name']=_0x4d3c80[_0x3fc7('0x0')]||'';this['username']=_0x4d3c80[_0x3fc7('0x1')]||'';this[_0x3fc7('0x2')]=_0x4d3c80[_0x3fc7('0x2')]||'';this[_0x3fc7('0x3')]=_0x4d3c80[_0x3fc7('0x3')]||'';this[_0x3fc7('0x4')]=_0x4d3c80[_0x3fc7('0x4')]||'';this['clientId']=_0x4d3c80[_0x3fc7('0x5')]||'';this[_0x3fc7('0x6')]=_0x4d3c80[_0x3fc7('0x6')]||{};this[_0x3fc7('0x7')]=_0x4d3c80[_0x3fc7('0x7')]||'';this[_0x3fc7('0x8')]=_0x4d3c80[_0x3fc7('0x8')]||{};}module[_0x3fc7('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 9c2292c..2c3c85d 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 _0x5e05=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','Trunk','ListId','key','description','ecm'];(function(_0x3f0b2a,_0x52f963){var _0x23bd63=function(_0x238936){while(--_0x238936){_0x3f0b2a['push'](_0x3f0b2a['shift']());}};_0x23bd63(++_0x52f963);}(_0x5e05,0x8a));var _0x55e0=function(_0x2d7b7d,_0x1110dc){_0x2d7b7d=_0x2d7b7d-0x0;var _0x552e03=_0x5e05[_0x2d7b7d];return _0x552e03;};'use strict';function FaxAccount(_0x50bbf7){this['id']=_0x50bbf7['id']||0x0;this['name']=_0x50bbf7['name']||'';this[_0x55e0('0x0')]=_0x50bbf7[_0x55e0('0x0')];this[_0x55e0('0x1')]=_0x50bbf7[_0x55e0('0x1')];this[_0x55e0('0x2')]=_0x50bbf7[_0x55e0('0x2')];this['localstationid']=_0x50bbf7[_0x55e0('0x3')];this[_0x55e0('0x4')]=_0x50bbf7[_0x55e0('0x4')]||0x960;this[_0x55e0('0x5')]=_0x50bbf7[_0x55e0('0x5')]||0x3840;this[_0x55e0('0x6')]=_0x50bbf7['modem']||_0x55e0('0x7');this[_0x55e0('0x8')]=_0x50bbf7[_0x55e0('0x8')]||'no';this[_0x55e0('0x9')]=_0x50bbf7['faxdetect']||'no';this[_0x55e0('0xa')]=_0x50bbf7[_0x55e0('0xa')]||0x1388;this['tech']=_0x50bbf7['tech']||'SIP';this['Trunk']=_0x50bbf7[_0x55e0('0xb')]?_0x50bbf7[_0x55e0('0xb')]:undefined;this[_0x55e0('0xc')]=_0x50bbf7[_0x55e0('0xc')];this[_0x55e0('0xd')]=_0x50bbf7['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x529d=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x181c4,_0x2c89ac){var _0xfcae1a=function(_0x5a339e){while(--_0x5a339e){_0x181c4['push'](_0x181c4['shift']());}};_0xfcae1a(++_0x2c89ac);}(_0x529d,0x177));var _0xd529=function(_0x4ef483,_0x87ad36){_0x4ef483=_0x4ef483-0x0;var _0x1e334b=_0x529d[_0x4ef483];return _0x1e334b;};'use strict';function FaxAccount(_0x211e80){this['id']=_0x211e80['id']||0x0;this[_0xd529('0x0')]=_0x211e80['name']||'';this[_0xd529('0x1')]=_0x211e80[_0xd529('0x1')];this[_0xd529('0x2')]=_0x211e80[_0xd529('0x2')];this[_0xd529('0x3')]=_0x211e80[_0xd529('0x3')];this['localstationid']=_0x211e80[_0xd529('0x4')];this[_0xd529('0x5')]=_0x211e80[_0xd529('0x5')]||0x960;this['maxrate']=_0x211e80[_0xd529('0x6')]||0x3840;this[_0xd529('0x7')]=_0x211e80[_0xd529('0x7')]||_0xd529('0x8');this[_0xd529('0x9')]=_0x211e80[_0xd529('0x9')]||'no';this[_0xd529('0xa')]=_0x211e80[_0xd529('0xa')]||'no';this[_0xd529('0xb')]=_0x211e80[_0xd529('0xb')]||0x1388;this[_0xd529('0xc')]=_0x211e80['tech']||_0xd529('0xd');this[_0xd529('0xe')]=_0x211e80[_0xd529('0xe')]?_0x211e80[_0xd529('0xe')]:undefined;this[_0xd529('0xf')]=_0x211e80[_0xd529('0xf')];this[_0xd529('0x10')]=_0x211e80[_0xd529('0x10')];}module[_0xd529('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 0c6acc1..844a4a7 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 _0xd230=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x3ff972,_0x47f092){var _0x195e2a=function(_0x1f15a8){while(--_0x1f15a8){_0x3ff972['push'](_0x3ff972['shift']());}};_0x195e2a(++_0x47f092);}(_0xd230,0x16f));var _0x0d23=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xd230[_0x387777];return _0x3f84c0;};'use strict';function FreshdeskAccount(_0x1db698){this['id']=_0x1db698['id']||0x0;this[_0x0d23('0x0')]=_0x1db698[_0x0d23('0x0')]||'';this['username']=_0x1db698[_0x0d23('0x1')]||'';this['apiKey']=_0x1db698[_0x0d23('0x2')]||'';this['remoteUri']=_0x1db698[_0x0d23('0x3')]||'';this[_0x0d23('0x4')]=_0x1db698[_0x0d23('0x4')]||'';this[_0x0d23('0x5')]=_0x1db698['Configurations']||{};}module[_0x0d23('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x941d=['username','apiKey','token','serverUrl','Configurations','exports','name'];(function(_0x57bfb7,_0x4af626){var _0x147a93=function(_0x124b35){while(--_0x124b35){_0x57bfb7['push'](_0x57bfb7['shift']());}};_0x147a93(++_0x4af626);}(_0x941d,0x1b8));var _0xd941=function(_0x256c49,_0x53f00a){_0x256c49=_0x256c49-0x0;var _0x280282=_0x941d[_0x256c49];return _0x280282;};'use strict';function FreshdeskAccount(_0x9c41d5){this['id']=_0x9c41d5['id']||0x0;this[_0xd941('0x0')]=_0x9c41d5[_0xd941('0x0')]||'';this[_0xd941('0x1')]=_0x9c41d5[_0xd941('0x1')]||'';this[_0xd941('0x2')]=_0x9c41d5[_0xd941('0x3')]||'';this['remoteUri']=_0x9c41d5['remoteUri']||'';this[_0xd941('0x4')]=_0x9c41d5[_0xd941('0x4')]||'';this['Configurations']=_0x9c41d5[_0xd941('0x5')]||{};}module[_0xd941('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 7b4bb4e..6984877 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 _0x678b=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x678b,0x7e));var _0xb678=function(_0x10b2d5,_0x5a7743){_0x10b2d5=_0x10b2d5-0x0;var _0x14b8d1=_0x678b[_0x10b2d5];return _0x14b8d1;};'use strict';function FreshsalesAccount(_0x30e56f){this['id']=_0x30e56f['id']||0x0;this['name']=_0x30e56f[_0xb678('0x0')]||'';this[_0xb678('0x1')]=_0x30e56f[_0xb678('0x1')]||'';this[_0xb678('0x2')]=_0x30e56f[_0xb678('0x3')]||'';this['remoteUri']=_0x30e56f[_0xb678('0x4')]||'';this[_0xb678('0x5')]=_0x30e56f[_0xb678('0x5')]||'';this['Configurations']=_0x30e56f[_0xb678('0x6')]||{};}module[_0xb678('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xc6c4=['name','username','apiKey','remoteUri','Configurations','exports'];(function(_0x151c38,_0x3d5723){var _0x18a987=function(_0x32eb6a){while(--_0x32eb6a){_0x151c38['push'](_0x151c38['shift']());}};_0x18a987(++_0x3d5723);}(_0xc6c4,0x126));var _0x4c6c=function(_0xd5f1d3,_0x1f8db3){_0xd5f1d3=_0xd5f1d3-0x0;var _0xfbe719=_0xc6c4[_0xd5f1d3];return _0xfbe719;};'use strict';function FreshsalesAccount(_0x4080cc){this['id']=_0x4080cc['id']||0x0;this[_0x4c6c('0x0')]=_0x4080cc[_0x4c6c('0x0')]||'';this[_0x4c6c('0x1')]=_0x4080cc['username']||'';this[_0x4c6c('0x2')]=_0x4080cc['token']||'';this[_0x4c6c('0x3')]=_0x4080cc[_0x4c6c('0x3')]||'';this['serverUrl']=_0x4080cc['serverUrl']||'';this[_0x4c6c('0x4')]=_0x4080cc[_0x4c6c('0x4')]||{};}module[_0x4c6c('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 e802767..2de33ef 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 _0x2e3c=['queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinename','accountcode','context','exten','priority','assigned','lastAssignedTo','variables','exports','type','inbound','uniqueid','calleridnum'];(function(_0x28762c,_0x2625e7){var _0x441a0b=function(_0x298b03){while(--_0x298b03){_0x28762c['push'](_0x28762c['shift']());}};_0x441a0b(++_0x2625e7);}(_0x2e3c,0x1b1));var _0xc2e3=function(_0x38ab01,_0x4a377b){_0x38ab01=_0x38ab01-0x0;var _0x34d70b=_0x2e3c[_0x38ab01];return _0x34d70b;};'use strict';function QueueReport(){this[_0xc2e3('0x0')]=_0xc2e3('0x1');this[_0xc2e3('0x2')]='';this[_0xc2e3('0x3')]='';this['calleridname']='';this['queue']='';this[_0xc2e3('0x4')]=null;this[_0xc2e3('0x5')]=null;this[_0xc2e3('0x6')]=0x1;this[_0xc2e3('0x7')]=0x1;this[_0xc2e3('0x8')]=![];this['queuecallerabandonAt']=null;this[_0xc2e3('0x9')]=![];this[_0xc2e3('0xa')]=null;this[_0xc2e3('0xb')]=![];this[_0xc2e3('0xc')]=null;this['originalposition']=0x1;this[_0xc2e3('0xd')]='';this['connectedlinenum']='';this[_0xc2e3('0xe')]='';this[_0xc2e3('0xf')]='';this[_0xc2e3('0x10')]='';this[_0xc2e3('0x11')]='';this[_0xc2e3('0x12')]='';this['holdtime']=0x0;this[_0xc2e3('0x13')]=![];this[_0xc2e3('0x14')]='';this['mohtime']=0x0;this[_0xc2e3('0x15')]={};}module[_0xc2e3('0x16')]=QueueReport; \ No newline at end of file +var _0x54fb=['accountcode','context','exten','lastAssignedTo','variables','exports','type','inbound','calleridnum','queue','position','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0x4b65fc,_0x194119){var _0x2263cf=function(_0x49c125){while(--_0x49c125){_0x4b65fc['push'](_0x4b65fc['shift']());}};_0x2263cf(++_0x194119);}(_0x54fb,0xe2));var _0xb54f=function(_0x59b4a9,_0xf4624d){_0x59b4a9=_0x59b4a9-0x0;var _0x471944=_0x54fb[_0x59b4a9];return _0x471944;};'use strict';function QueueReport(){this[_0xb54f('0x0')]=_0xb54f('0x1');this['uniqueid']='';this[_0xb54f('0x2')]='';this['calleridname']='';this[_0xb54f('0x3')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xb54f('0x4')]=0x1;this['count']=0x1;this[_0xb54f('0x5')]=![];this[_0xb54f('0x6')]=null;this[_0xb54f('0x7')]=![];this[_0xb54f('0x8')]=null;this['queuecallerexit']=![];this[_0xb54f('0x9')]=null;this[_0xb54f('0xa')]=0x1;this[_0xb54f('0xb')]='';this[_0xb54f('0xc')]='';this[_0xb54f('0xd')]='';this[_0xb54f('0xe')]='';this[_0xb54f('0xf')]='';this[_0xb54f('0x10')]='';this['priority']='';this['holdtime']=0x0;this['assigned']=![];this[_0xb54f('0x11')]='';this['mohtime']=0x0;this[_0xb54f('0x12')]={};}module[_0xb54f('0x13')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 68cab24..369010b 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 _0x41ea=['integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientSecret','securityToken','type'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x41ea,0x138));var _0xa41e=function(_0xae5e48,_0x330fce){_0xae5e48=_0xae5e48-0x0;var _0x47d3bf=_0x41ea[_0xae5e48];return _0x47d3bf;};'use strict';function SalesforceAccount(_0x21b7e0){this['id']=_0x21b7e0['id']||0x0;this[_0xa41e('0x0')]=_0x21b7e0[_0xa41e('0x0')]||'';this[_0xa41e('0x1')]=_0x21b7e0[_0xa41e('0x1')]||'';this['remoteUri']=_0x21b7e0[_0xa41e('0x2')]||'';this[_0xa41e('0x3')]=_0x21b7e0[_0xa41e('0x3')]||'';this['clientId']=_0x21b7e0['clientId']||'';this['clientSecret']=_0x21b7e0[_0xa41e('0x4')]||'';this[_0xa41e('0x5')]=_0x21b7e0[_0xa41e('0x5')]||'';this[_0xa41e('0x6')]=_0x21b7e0[_0xa41e('0x6')]||_0xa41e('0x7');this[_0xa41e('0x8')]=_0x21b7e0[_0xa41e('0x8')]||'';this['Configurations']=_0x21b7e0[_0xa41e('0x9')]||{};}module[_0xa41e('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x8669=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x70fd53,_0x2a95a6){var _0x4b71c5=function(_0x4b349d){while(--_0x4b349d){_0x70fd53['push'](_0x70fd53['shift']());}};_0x4b71c5(++_0x2a95a6);}(_0x8669,0x16f));var _0x9866=function(_0x2fd288,_0x27dc31){_0x2fd288=_0x2fd288-0x0;var _0x1be7a9=_0x8669[_0x2fd288];return _0x1be7a9;};'use strict';function SalesforceAccount(_0x5b5514){this['id']=_0x5b5514['id']||0x0;this['name']=_0x5b5514[_0x9866('0x0')]||'';this[_0x9866('0x1')]=_0x5b5514[_0x9866('0x1')]||'';this[_0x9866('0x2')]=_0x5b5514[_0x9866('0x2')]||'';this[_0x9866('0x3')]=_0x5b5514[_0x9866('0x3')]||'';this['clientId']=_0x5b5514[_0x9866('0x4')]||'';this[_0x9866('0x5')]=_0x5b5514[_0x9866('0x5')]||'';this[_0x9866('0x6')]=_0x5b5514[_0x9866('0x6')]||'';this[_0x9866('0x7')]=_0x5b5514['type']||_0x9866('0x8');this['serverUrl']=_0x5b5514[_0x9866('0x9')]||'';this['Configurations']=_0x5b5514[_0x9866('0xa')]||{};}module[_0x9866('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 5502b04..72b0820 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 _0xebdc=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x2ac04f,_0x509ce0){var _0x127e3d=function(_0x38cd44){while(--_0x38cd44){_0x2ac04f['push'](_0x2ac04f['shift']());}};_0x127e3d(++_0x509ce0);}(_0xebdc,0x1b6));var _0xcebd=function(_0x45b841,_0x2c08ca){_0x45b841=_0x45b841-0x0;var _0x2e4de7=_0xebdc[_0x45b841];return _0x2e4de7;};'use strict';function ServicenowAccount(_0xc2c47e){this['id']=_0xc2c47e['id']||0x0;this['name']=_0xc2c47e[_0xcebd('0x0')]||'';this[_0xcebd('0x1')]=_0xc2c47e['username']||'';this['password']=_0xc2c47e[_0xcebd('0x2')]||'';this[_0xcebd('0x3')]=_0xc2c47e[_0xcebd('0x3')]||'';this['serverUrl']=_0xc2c47e[_0xcebd('0x4')]||'';this[_0xcebd('0x5')]=_0xc2c47e[_0xcebd('0x5')]||{};}module[_0xcebd('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xdf57=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x29d9ae,_0x1c7bcc){var _0x4c48d1=function(_0x501f5e){while(--_0x501f5e){_0x29d9ae['push'](_0x29d9ae['shift']());}};_0x4c48d1(++_0x1c7bcc);}(_0xdf57,0xc1));var _0x7df5=function(_0x2ace72,_0x814809){_0x2ace72=_0x2ace72-0x0;var _0x33d102=_0xdf57[_0x2ace72];return _0x33d102;};'use strict';function ServicenowAccount(_0x3a58ed){this['id']=_0x3a58ed['id']||0x0;this['name']=_0x3a58ed[_0x7df5('0x0')]||'';this[_0x7df5('0x1')]=_0x3a58ed['username']||'';this[_0x7df5('0x2')]=_0x3a58ed['password']||'';this[_0x7df5('0x3')]=_0x3a58ed[_0x7df5('0x3')]||'';this[_0x7df5('0x4')]=_0x3a58ed[_0x7df5('0x4')]||'';this[_0x7df5('0x5')]=_0x3a58ed[_0x7df5('0x5')]||{};}module[_0x7df5('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 016ff64..dac76d5 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 _0xcdaf=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xcdaf,0xd8));var _0xfcda=function(_0x564c9c,_0x30b3dc){_0x564c9c=_0x564c9c-0x0;var _0x82635e=_0xcdaf[_0x564c9c];return _0x82635e;};'use strict';function SugarcrmAccount(_0x4b6215){this['id']=_0x4b6215['id']||0x0;this[_0xfcda('0x0')]=_0x4b6215[_0xfcda('0x0')]||'';this[_0xfcda('0x1')]=_0x4b6215[_0xfcda('0x1')]||'';this[_0xfcda('0x2')]=_0x4b6215[_0xfcda('0x2')]||'';this[_0xfcda('0x3')]=_0x4b6215[_0xfcda('0x3')]||'';this[_0xfcda('0x4')]=_0x4b6215['serverUrl']||'';this[_0xfcda('0x5')]=_0x4b6215[_0xfcda('0x5')]||{};}module[_0xfcda('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xb1ca=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x8b4966,_0x1f4ec3){var _0x4e3470=function(_0x3edd92){while(--_0x3edd92){_0x8b4966['push'](_0x8b4966['shift']());}};_0x4e3470(++_0x1f4ec3);}(_0xb1ca,0xcb));var _0xab1c=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xb1ca[_0x4e676e];return _0x336a3c;};'use strict';function SugarcrmAccount(_0x578017){this['id']=_0x578017['id']||0x0;this[_0xab1c('0x0')]=_0x578017['name']||'';this[_0xab1c('0x1')]=_0x578017['username']||'';this['password']=_0x578017[_0xab1c('0x2')]||'';this[_0xab1c('0x3')]=_0x578017[_0xab1c('0x3')]||'';this[_0xab1c('0x4')]=_0x578017['serverUrl']||'';this[_0xab1c('0x5')]=_0x578017[_0xab1c('0x5')]||{};}module[_0xab1c('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index ae70773..f76b481 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 _0xb8ce=['exports','accountcode','state','unknown','status'];(function(_0x35c7cc,_0x20a644){var _0x19dc86=function(_0x2bbf46){while(--_0x2bbf46){_0x35c7cc['push'](_0x35c7cc['shift']());}};_0x19dc86(++_0x20a644);}(_0xb8ce,0x1aa));var _0xeb8c=function(_0x5da641,_0x2de7b5){_0x5da641=_0x5da641-0x0;var _0x4ec934=_0xb8ce[_0x5da641];return _0x4ec934;};'use strict';function Telephone(_0xf4547c){this['id']=_0xf4547c['id']||0x0;this['name']=_0xf4547c['name']||'';this[_0xeb8c('0x0')]=_0xf4547c[_0xeb8c('0x0')]||'';this[_0xeb8c('0x1')]=_0xeb8c('0x2');this['stateTime']=0x0;this[_0xeb8c('0x3')]=_0xeb8c('0x2');this['address']='';}module[_0xeb8c('0x4')]=Telephone; \ No newline at end of file +var _0x7bac=['address','name','accountcode','state','unknown','stateTime','status'];(function(_0x4249d0,_0x460973){var _0x5021cd=function(_0x20f03a){while(--_0x20f03a){_0x4249d0['push'](_0x4249d0['shift']());}};_0x5021cd(++_0x460973);}(_0x7bac,0x1e4));var _0xc7ba=function(_0x4f431d,_0xd51a3b){_0x4f431d=_0x4f431d-0x0;var _0x4f31e1=_0x7bac[_0x4f431d];return _0x4f31e1;};'use strict';function Telephone(_0xd3ad8f){this['id']=_0xd3ad8f['id']||0x0;this[_0xc7ba('0x0')]=_0xd3ad8f[_0xc7ba('0x0')]||'';this[_0xc7ba('0x1')]=_0xd3ad8f[_0xc7ba('0x1')]||'';this[_0xc7ba('0x2')]=_0xc7ba('0x3');this[_0xc7ba('0x4')]=0x0;this[_0xc7ba('0x5')]=_0xc7ba('0x3');this[_0xc7ba('0x6')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 144fa31..93b6683 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 _0x1aca=['exports','name','html'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x1aca,0x19f));var _0xa1ac=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0x1aca[_0x43b487];return _0x2f707a;};'use strict';function template(_0x430c48){this['id']=_0x430c48['id']||0x0;this[_0xa1ac('0x0')]=_0x430c48[_0xa1ac('0x0')]||'';this[_0xa1ac('0x1')]=_0x430c48[_0xa1ac('0x1')]||'';}module[_0xa1ac('0x2')]=template; \ No newline at end of file +var _0x6125=['name','exports'];(function(_0x1d8cd1,_0x5fa35e){var _0x5e7caa=function(_0x4ae460){while(--_0x4ae460){_0x1d8cd1['push'](_0x1d8cd1['shift']());}};_0x5e7caa(++_0x5fa35e);}(_0x6125,0x162));var _0x5612=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6125[_0x3dd15e];return _0x231fd0;};'use strict';function template(_0x2849a9){this['id']=_0x2849a9['id']||0x0;this[_0x5612('0x0')]=_0x2849a9[_0x5612('0x0')]||'';this['html']=_0x2849a9['html']||'';}module[_0x5612('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index cdc4f67..7252c89 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 _0x008c=['name','channel','status','AllConditions','AnyConditions','Actions','exports'];(function(_0x305d8c,_0x153576){var _0x1e6143=function(_0x30913b){while(--_0x30913b){_0x305d8c['push'](_0x305d8c['shift']());}};_0x1e6143(++_0x153576);}(_0x008c,0x188));var _0xc008=function(_0x42184d,_0x264f92){_0x42184d=_0x42184d-0x0;var _0x144722=_0x008c[_0x42184d];return _0x144722;};'use strict';function Trigger(_0x2be4ba){this['id']=_0x2be4ba['id']||0x0;this[_0xc008('0x0')]=_0x2be4ba[_0xc008('0x0')]||'';this[_0xc008('0x1')]=_0x2be4ba[_0xc008('0x1')]||'voice';this[_0xc008('0x2')]=_0x2be4ba[_0xc008('0x2')]||![];this[_0xc008('0x3')]=_0x2be4ba[_0xc008('0x3')]||[];this[_0xc008('0x4')]=_0x2be4ba[_0xc008('0x4')]||[];this[_0xc008('0x5')]=_0x2be4ba[_0xc008('0x5')]||[];}module[_0xc008('0x6')]=Trigger; \ No newline at end of file +var _0xedd9=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x45c9cd,_0x282763){var _0xd815ce=function(_0x293983){while(--_0x293983){_0x45c9cd['push'](_0x45c9cd['shift']());}};_0xd815ce(++_0x282763);}(_0xedd9,0xfc));var _0x9edd=function(_0x41b1e5,_0x4fdbc0){_0x41b1e5=_0x41b1e5-0x0;var _0x5ca5a2=_0xedd9[_0x41b1e5];return _0x5ca5a2;};'use strict';function Trigger(_0x265eb8){this['id']=_0x265eb8['id']||0x0;this[_0x9edd('0x0')]=_0x265eb8[_0x9edd('0x0')]||'';this[_0x9edd('0x1')]=_0x265eb8[_0x9edd('0x1')]||_0x9edd('0x2');this[_0x9edd('0x3')]=_0x265eb8[_0x9edd('0x3')]||![];this[_0x9edd('0x4')]=_0x265eb8['AllConditions']||[];this[_0x9edd('0x5')]=_0x265eb8[_0x9edd('0x5')]||[];this[_0x9edd('0x6')]=_0x265eb8[_0x9edd('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index f16cc4d..9026ae0 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 _0xcf82=['domainport','refresh','stateRegistry','address','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','port','domain'];(function(_0x37b67e,_0x2c3ceb){var _0x2072bf=function(_0x4f2d2b){while(--_0x4f2d2b){_0x37b67e['push'](_0x37b67e['shift']());}};_0x2072bf(++_0x2c3ceb);}(_0xcf82,0x165));var _0x2cf8=function(_0x42977e,_0x4e7963){_0x42977e=_0x42977e-0x0;var _0x29eca9=_0xcf82[_0x42977e];return _0x29eca9;};'use strict';function Trunk(_0xad4697){this['id']=_0xad4697['id']||0x0;this[_0x2cf8('0x0')]=_0xad4697[_0x2cf8('0x0')]||![];this[_0x2cf8('0x1')]=_0xad4697['name']||'';this[_0x2cf8('0x2')]=_0x2cf8('0x3');this[_0x2cf8('0x4')]=0x0;this[_0x2cf8('0x5')]=_0x2cf8('0x3');this[_0x2cf8('0x6')]=_0xad4697[_0x2cf8('0x6')]&&_0xad4697[_0x2cf8('0x6')][_0x2cf8('0x7')](':')?_0xad4697[_0x2cf8('0x6')][_0x2cf8('0x8')](':')[0x0]:'';this['host']='';this[_0x2cf8('0x9')]='';this[_0x2cf8('0xa')]='';this[_0x2cf8('0xb')]='';this[_0x2cf8('0xc')]='';this[_0x2cf8('0xd')]=_0x2cf8('0x3');this['registrationtime']='';this[_0x2cf8('0xe')]='';}module[_0x2cf8('0xf')]=Trunk; \ No newline at end of file +var _0x6ae8=['split','host','port','domain','domainport','stateRegistry','address','exports','name','unknown','stateTime','status','registry','indexOf'];(function(_0x23fd1b,_0x469cab){var _0x304e83=function(_0x5c0d6a){while(--_0x5c0d6a){_0x23fd1b['push'](_0x23fd1b['shift']());}};_0x304e83(++_0x469cab);}(_0x6ae8,0x190));var _0x86ae=function(_0x12954a,_0x304691){_0x12954a=_0x12954a-0x0;var _0x5ccde2=_0x6ae8[_0x12954a];return _0x5ccde2;};'use strict';function Trunk(_0x4dfbc1){this['id']=_0x4dfbc1['id']||0x0;this['active']=_0x4dfbc1['active']||![];this[_0x86ae('0x0')]=_0x4dfbc1[_0x86ae('0x0')]||'';this['state']=_0x86ae('0x1');this[_0x86ae('0x2')]=0x0;this[_0x86ae('0x3')]=_0x86ae('0x1');this[_0x86ae('0x4')]=_0x4dfbc1[_0x86ae('0x4')]&&_0x4dfbc1[_0x86ae('0x4')][_0x86ae('0x5')](':')?_0x4dfbc1['registry'][_0x86ae('0x6')](':')[0x0]:'';this[_0x86ae('0x7')]='';this[_0x86ae('0x8')]='';this[_0x86ae('0x9')]='';this[_0x86ae('0xa')]='';this['refresh']='';this[_0x86ae('0xb')]=_0x86ae('0x1');this['registrationtime']='';this[_0x86ae('0xc')]='';}module[_0x86ae('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 8c7982c..eabdae7 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 _0x8946=['mandatoryDisposition','exten','recordingFormat','none'];(function(_0x46db2c,_0x1da848){var _0xaafba4=function(_0x12123b){while(--_0x12123b){_0x46db2c['push'](_0x46db2c['shift']());}};_0xaafba4(++_0x1da848);}(_0x8946,0x195));var _0x6894=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x8946[_0x413feb];return _0x40ee88;};'use strict';function voiceExtension(_0x5adec4){this['id']=_0x5adec4['id']||0x0;this[_0x6894('0x0')]=_0x5adec4[_0x6894('0x0')]||'';this[_0x6894('0x1')]=_0x5adec4[_0x6894('0x1')]||_0x6894('0x2');this['mandatoryDisposition']=_0x5adec4[_0x6894('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xd70b=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x209bbf,_0x2e2375){var _0x592d4b=function(_0x419947){while(--_0x419947){_0x209bbf['push'](_0x209bbf['shift']());}};_0x592d4b(++_0x2e2375);}(_0xd70b,0xb1));var _0xbd70=function(_0x58b6a8,_0x307021){_0x58b6a8=_0x58b6a8-0x0;var _0xc566dc=_0xd70b[_0x58b6a8];return _0xc566dc;};'use strict';function voiceExtension(_0x438969){this['id']=_0x438969['id']||0x0;this[_0xbd70('0x0')]=_0x438969['exten']||'';this[_0xbd70('0x1')]=_0x438969['recordingFormat']||_0xbd70('0x2');this['mandatoryDisposition']=_0x438969[_0xbd70('0x3')]||![];}module[_0xbd70('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 8922ae0..62cecaa 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 _0x3eb4=['outboundBusyCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','busy','invalid','ringinuse','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x3eb4,0x1dc));var _0x43eb=function(_0x415d90,_0x55544a){_0x415d90=_0x415d90-0x0;var _0x40a1d7=_0x3eb4[_0x415d90];return _0x40a1d7;};'use strict';var statusDesc=[_0x43eb('0x0'),_0x43eb('0x1'),'inuse',_0x43eb('0x2'),_0x43eb('0x3'),'unavailable','ringing',_0x43eb('0x4'),'onhold'];var monitorFormat={'wav':'wav','wav49':'wav49','gsm':_0x43eb('0x5')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x43eb('0x6')};function VoiceQueue(_0x132f56){this['id']=_0x132f56['id']||0x0;this['name']=_0x132f56[_0x43eb('0x7')]||'';this[_0x43eb('0x8')]=_0x132f56[_0x43eb('0x8')]||'';this[_0x43eb('0x9')]=_0x132f56['type']||_0x43eb('0xa');this[_0x43eb('0xb')]=0x0;this[_0x43eb('0xc')]=0x0;this[_0x43eb('0xd')]=0x0;this[_0x43eb('0xe')]=0x0;this[_0x43eb('0xf')]=0x0;this[_0x43eb('0x10')]=0x0;this['sumBillable']=0x0;this[_0x43eb('0x11')]=0x0;this[_0x43eb('0x12')]=0x0;this[_0x43eb('0x13')]=0x0;this[_0x43eb('0x14')]=0x0;this[_0x43eb('0x15')]=_0x132f56[_0x43eb('0x15')]||![];this[_0x43eb('0x16')]=_0x132f56[_0x43eb('0x16')]||0xa;this[_0x43eb('0x17')]=_0x132f56[_0x43eb('0x17')]||'no';this[_0x43eb('0x18')]=!![];this['message']='';this[_0x43eb('0x19')]=0x0;this[_0x43eb('0x1a')]=0x0;this['dialTimezone']=_0x132f56[_0x43eb('0x1b')]||null;this[_0x43eb('0x1c')]=_0x132f56[_0x43eb('0x1c')]?_0x132f56[_0x43eb('0x1c')]:null;this[_0x43eb('0x1d')]=_0x132f56[_0x43eb('0x1d')];this['dialMethod']=_0x132f56[_0x43eb('0x1e')]||'progressive';this[_0x43eb('0x1f')]=_0x132f56[_0x43eb('0x1f')]||0x0;this['dialLimitQueue']=_0x132f56[_0x43eb('0x20')]||0x0;this['dialPowerLevel']=_0x132f56[_0x43eb('0x21')]||0x1;this[_0x43eb('0x22')]=_0x132f56[_0x43eb('0x22')]||_0x43eb('0x23');this[_0x43eb('0x24')]=_0x132f56[_0x43eb('0x24')]||0.03;this[_0x43eb('0x25')]=_0x132f56['dialPredictiveInterval']||0x258;this[_0x43eb('0x26')]=_0x132f56['dialOriginateCallerIdName']||_0x43eb('0x27');this[_0x43eb('0x28')]=_0x132f56[_0x43eb('0x28')]||'anonymous';this[_0x43eb('0x29')]=_0x132f56['dialOriginateTimeout']||0x1e;this[_0x43eb('0x2a')]=_0x132f56[_0x43eb('0x2a')]||_0x43eb('0x2b');this[_0x43eb('0x2c')]=_0x132f56['dialQueueTimeout']||0x3;this[_0x43eb('0x2d')]=_0x132f56[_0x43eb('0x2d')]||undefined;this[_0x43eb('0x2e')]=_0x132f56[_0x43eb('0x2e')]||0x3;this[_0x43eb('0x2f')]=_0x132f56[_0x43eb('0x2f')]||0x96;this['dialBusyMaxRetry']=_0x132f56['dialBusyMaxRetry']||0x3;this[_0x43eb('0x30')]=_0x132f56[_0x43eb('0x30')]||0x96;this[_0x43eb('0x31')]=_0x132f56['dialNoAnswerMaxRetry']||0x3;this[_0x43eb('0x32')]=_0x132f56[_0x43eb('0x32')]||0x96;this[_0x43eb('0x33')]=_0x132f56[_0x43eb('0x33')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x132f56[_0x43eb('0x34')]||0x96;this[_0x43eb('0x35')]=_0x132f56['dialDropMaxRetry']||0x3;this[_0x43eb('0x36')]=_0x132f56[_0x43eb('0x36')]||0x96;this[_0x43eb('0x37')]=_0x132f56[_0x43eb('0x37')]||0x3;this['dialAbandonedRetryFrequency']=_0x132f56['dialAbandonedRetryFrequency']||0x96;this[_0x43eb('0x38')]=_0x132f56['dialMachineMaxRetry']||0x3;this[_0x43eb('0x39')]=_0x132f56[_0x43eb('0x39')]||0x96;this[_0x43eb('0x3a')]=_0x132f56[_0x43eb('0x3a')]||0x3;this['dialAgentRejectRetryFrequency']=_0x132f56['dialAgentRejectRetryFrequency']||0x96;this[_0x43eb('0x3b')]=_0x132f56['dialGlobalMaxRetry']||0x4;this[_0x43eb('0x3c')]=_0x132f56[_0x43eb('0x3c')]?_0x132f56[_0x43eb('0x3c')]:undefined;this[_0x43eb('0x3d')]=_0x132f56[_0x43eb('0x3d')]?_0x132f56[_0x43eb('0x3d')]:undefined;this['dialPrefix']=_0x132f56['dialPrefix']||undefined;this['Interval']=_0x132f56[_0x43eb('0x3e')]?_0x132f56['Interval']:undefined;this[_0x43eb('0x3f')]=_0x132f56[_0x43eb('0x3f')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x132f56[_0x43eb('0x40')]||undefined;this[_0x43eb('0x41')]=_0x132f56['dialCutDigit']||undefined;this[_0x43eb('0x42')]=strategy[_0x132f56['strategy']]||_0x43eb('0x43');this[_0x43eb('0x44')]=!![];this['dialAMDActive']=_0x132f56[_0x43eb('0x45')]||![];this[_0x43eb('0x46')]=_0x132f56[_0x43eb('0x46')];this['dialAMDGreeting']=_0x132f56[_0x43eb('0x47')];this['dialAMDAfterGreetingSilence']=_0x132f56[_0x43eb('0x48')];this[_0x43eb('0x49')]=_0x132f56[_0x43eb('0x49')];this[_0x43eb('0x4a')]=_0x132f56['dialAMDMinWordLength'];this[_0x43eb('0x4b')]=_0x132f56[_0x43eb('0x4b')];this['dialAMDMaximumNumberOfWords']=_0x132f56[_0x43eb('0x4c')];this[_0x43eb('0x4d')]=_0x132f56[_0x43eb('0x4d')];this['dialAMDMaximumWordLength']=_0x132f56[_0x43eb('0x4e')];this['outboundRejectCallsDay']=0x0;this[_0x43eb('0x4f')]=0x0;this[_0x43eb('0x50')]=_0x132f56[_0x43eb('0x50')];this[_0x43eb('0x51')]=0x0;this[_0x43eb('0x52')]=0x0;this[_0x43eb('0x53')]=0x0;this[_0x43eb('0x54')]=0x0;this['outboundCongestionCallsDay']=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x43eb('0x55')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x43eb('0x56')]=0x0;this[_0x43eb('0x57')]=0x0;this[_0x43eb('0x58')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x43eb('0x59')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x43eb('0x5a')]=undefined;this['startPredictive']=undefined;this[_0x43eb('0x5b')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x43eb('0x5c')]=0x0;this[_0x43eb('0x5d')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x43eb('0x5e')]=0x0;this[_0x43eb('0x5f')]=0x0;this[_0x43eb('0x60')]=0x0;this[_0x43eb('0x61')]=0x0;this[_0x43eb('0x62')]=_0x132f56[_0x43eb('0x63')]||0x14;this[_0x43eb('0x64')]=_0x132f56[_0x43eb('0x63')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x43eb('0x65')]=0x0;this[_0x43eb('0x66')]=0x1;this['erlangCalls']=0x0;this[_0x43eb('0x67')]=0x0;this[_0x43eb('0x68')]=0x0;this['erlangBusyFactor']=0x0;this[_0x43eb('0x69')]=_0x132f56[_0x43eb('0x69')]||0x1e;this[_0x43eb('0x6a')]=_0x132f56[_0x43eb('0x6a')]||![];this[_0x43eb('0x6b')]=_0x132f56['dialQueueProject2']||undefined;this['dialAgiAfterHangupClient']=_0x132f56['dialAgiAfterHangupClient']||![];this[_0x43eb('0x6c')]=_0x132f56['dialAgiAfterHangupAgent']||![];this[_0x43eb('0x8')]=monitorFormat[_0x132f56['monitor_format']]?monitorFormat[_0x132f56[_0x43eb('0x8')]]:undefined;this[_0x43eb('0x6d')]=_0x132f56[_0x43eb('0x6d')]||![];this[_0x43eb('0x6e')]=_0x132f56['mandatoryDispositionPause']?_0x132f56[_0x43eb('0x6e')]:undefined;}module[_0x43eb('0x6f')]=VoiceQueue; \ No newline at end of file +var _0xeeee=['dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry'];(function(_0x563ab1,_0x36b8df){var _0x22eb45=function(_0x5ae5ca){while(--_0x5ae5ca){_0x563ab1['push'](_0x563ab1['shift']());}};_0x22eb45(++_0x36b8df);}(_0xeeee,0xc2));var _0xeeee=function(_0x2e8d01,_0x12fe7a){_0x2e8d01=_0x2e8d01-0x0;var _0x92efe5=_0xeeee[_0x2e8d01];return _0x92efe5;};'use strict';var statusDesc=[_0xeeee('0x0'),_0xeeee('0x1'),_0xeeee('0x2'),_0xeeee('0x3'),'invalid',_0xeeee('0x4'),'ringing',_0xeeee('0x5'),_0xeeee('0x6')];var monitorFormat={'wav':_0xeeee('0x7'),'wav49':_0xeeee('0x8'),'gsm':_0xeeee('0x9')};var strategy={'rrmemory':_0xeeee('0xa'),'roundrobin':_0xeeee('0xb')};function VoiceQueue(_0x582833){this['id']=_0x582833['id']||0x0;this['name']=_0x582833['name']||'';this['monitor_format']=_0x582833[_0xeeee('0xc')]||'';this[_0xeeee('0xd')]=_0x582833['type']||_0xeeee('0xe');this[_0xeeee('0xf')]=0x0;this[_0xeeee('0x10')]=0x0;this[_0xeeee('0x11')]=0x0;this[_0xeeee('0x12')]=0x0;this[_0xeeee('0x13')]=0x0;this[_0xeeee('0x14')]=0x0;this[_0xeeee('0x15')]=0x0;this[_0xeeee('0x16')]=0x0;this[_0xeeee('0x17')]=0x0;this[_0xeeee('0x18')]=0x0;this[_0xeeee('0x19')]=0x0;this[_0xeeee('0x1a')]=_0x582833[_0xeeee('0x1a')]||![];this[_0xeeee('0x1b')]=_0x582833['acwTimeout']||0xa;this[_0xeeee('0x1c')]=_0x582833['autopause']||'no';this[_0xeeee('0x1d')]=!![];this[_0xeeee('0x1e')]='';this[_0xeeee('0x1f')]=0x0;this[_0xeeee('0x20')]=0x0;this[_0xeeee('0x21')]=_0x582833[_0xeeee('0x21')]||null;this[_0xeeee('0x22')]=_0x582833[_0xeeee('0x22')]?_0x582833[_0xeeee('0x22')]:null;this[_0xeeee('0x23')]=_0x582833[_0xeeee('0x23')];this[_0xeeee('0x24')]=_0x582833[_0xeeee('0x24')]||_0xeeee('0x25');this[_0xeeee('0x26')]=_0x582833[_0xeeee('0x26')]||0x0;this['dialLimitQueue']=_0x582833[_0xeeee('0x27')]||0x0;this['dialPowerLevel']=_0x582833['dialPowerLevel']||0x1;this[_0xeeee('0x28')]=_0x582833[_0xeeee('0x28')]||'dropRate';this[_0xeeee('0x29')]=_0x582833[_0xeeee('0x29')]||0.03;this[_0xeeee('0x2a')]=_0x582833[_0xeeee('0x2a')]||0x258;this[_0xeeee('0x2b')]=_0x582833[_0xeeee('0x2b')]||_0xeeee('0x2c');this[_0xeeee('0x2d')]=_0x582833[_0xeeee('0x2d')]||_0xeeee('0x2c');this[_0xeeee('0x2e')]=_0x582833[_0xeeee('0x2e')]||0x1e;this['dialQueueOptions']=_0x582833[_0xeeee('0x2f')]||_0xeeee('0x30');this[_0xeeee('0x31')]=_0x582833[_0xeeee('0x31')]||0x3;this[_0xeeee('0x32')]=_0x582833[_0xeeee('0x32')]||undefined;this[_0xeeee('0x33')]=_0x582833[_0xeeee('0x33')]||0x3;this[_0xeeee('0x34')]=_0x582833[_0xeeee('0x34')]||0x96;this['dialBusyMaxRetry']=_0x582833['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x582833[_0xeeee('0x35')]||0x96;this[_0xeeee('0x36')]=_0x582833['dialNoAnswerMaxRetry']||0x3;this[_0xeeee('0x37')]=_0x582833['dialNoAnswerRetryFrequency']||0x96;this[_0xeeee('0x38')]=_0x582833[_0xeeee('0x38')]||0x3;this[_0xeeee('0x39')]=_0x582833[_0xeeee('0x39')]||0x96;this['dialDropMaxRetry']=_0x582833['dialDropMaxRetry']||0x3;this[_0xeeee('0x3a')]=_0x582833[_0xeeee('0x3a')]||0x96;this[_0xeeee('0x3b')]=_0x582833[_0xeeee('0x3b')]||0x3;this['dialAbandonedRetryFrequency']=_0x582833[_0xeeee('0x3c')]||0x96;this[_0xeeee('0x3d')]=_0x582833['dialMachineMaxRetry']||0x3;this[_0xeeee('0x3e')]=_0x582833[_0xeeee('0x3e')]||0x96;this[_0xeeee('0x3f')]=_0x582833[_0xeeee('0x3f')]||0x3;this[_0xeeee('0x40')]=_0x582833[_0xeeee('0x40')]||0x96;this[_0xeeee('0x41')]=_0x582833[_0xeeee('0x41')]||0x4;this[_0xeeee('0x42')]=_0x582833[_0xeeee('0x42')]?_0x582833[_0xeeee('0x42')]:undefined;this[_0xeeee('0x43')]=_0x582833['TrunkBackup']?_0x582833['TrunkBackup']:undefined;this['dialPrefix']=_0x582833[_0xeeee('0x44')]||undefined;this[_0xeeee('0x45')]=_0x582833['Interval']?_0x582833[_0xeeee('0x45')]:undefined;this['dialOrderByScheduledAt']=_0x582833[_0xeeee('0x46')]||_0xeeee('0x47');this[_0xeeee('0x48')]=_0x582833['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xeeee('0x49')]=_0x582833['dialCutDigit']||undefined;this[_0xeeee('0x4a')]=strategy[_0x582833[_0xeeee('0x4a')]]||_0xeeee('0xa');this[_0xeeee('0x4b')]=!![];this['dialAMDActive']=_0x582833[_0xeeee('0x4c')]||![];this[_0xeeee('0x4d')]=_0x582833['dialAMDInitialSilence'];this[_0xeeee('0x4e')]=_0x582833[_0xeeee('0x4e')];this['dialAMDAfterGreetingSilence']=_0x582833['dialAMDAfterGreetingSilence'];this[_0xeeee('0x4f')]=_0x582833[_0xeeee('0x4f')];this[_0xeeee('0x50')]=_0x582833[_0xeeee('0x50')];this[_0xeeee('0x51')]=_0x582833[_0xeeee('0x51')];this['dialAMDMaximumNumberOfWords']=_0x582833['dialAMDMaximumNumberOfWords'];this[_0xeeee('0x52')]=_0x582833['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x582833[_0xeeee('0x53')];this['outboundRejectCallsDay']=0x0;this[_0xeeee('0x54')]=0x0;this['timeout']=_0x582833[_0xeeee('0x55')];this[_0xeeee('0x56')]=0x0;this[_0xeeee('0x57')]=0x0;this[_0xeeee('0x58')]=0x0;this[_0xeeee('0x59')]=0x0;this[_0xeeee('0x5a')]=0x0;this[_0xeeee('0x5b')]=0x0;this[_0xeeee('0x5c')]=0x0;this[_0xeeee('0x5d')]=0x0;this[_0xeeee('0x5e')]=0x0;this[_0xeeee('0x5f')]=0x0;this[_0xeeee('0x60')]=0x0;this[_0xeeee('0x61')]=0x0;this[_0xeeee('0x62')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0xeeee('0x63')]=undefined;this[_0xeeee('0x64')]=1.05;this[_0xeeee('0x65')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xeeee('0x66')]=0x0;this[_0xeeee('0x67')]=0x0;this[_0xeeee('0x68')]=0x0;this[_0xeeee('0x69')]=0x0;this[_0xeeee('0x6a')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xeeee('0x6b')]=_0x582833[_0xeeee('0x6c')]||0x14;this[_0xeeee('0x6d')]=_0x582833[_0xeeee('0x6c')]||0xa;this[_0xeeee('0x6e')]=0x0;this[_0xeeee('0x6f')]=0x0;this[_0xeeee('0x70')]=0x1;this[_0xeeee('0x71')]=0x0;this[_0xeeee('0x72')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0xeeee('0x73')]=_0x582833[_0xeeee('0x73')]||0x1e;this[_0xeeee('0x74')]=_0x582833[_0xeeee('0x74')]||![];this[_0xeeee('0x75')]=_0x582833['dialQueueProject2']||undefined;this[_0xeeee('0x76')]=_0x582833[_0xeeee('0x76')]||![];this[_0xeeee('0x77')]=_0x582833[_0xeeee('0x77')]||![];this['monitor_format']=monitorFormat[_0x582833[_0xeeee('0xc')]]?monitorFormat[_0x582833['monitor_format']]:undefined;this['mandatoryDisposition']=_0x582833[_0xeeee('0x78')]||![];this[_0xeeee('0x79')]=_0x582833[_0xeeee('0x79')]?_0x582833[_0xeeee('0x79')]:undefined;}module[_0xeeee('0x7a')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index b6e902d..d1b5aaa 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 _0xa871=['exports','name','username','remoteUri','serverUrl','Configurations'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xa871,0xaf));var _0x1a87=function(_0x15d18f,_0x126b0e){_0x15d18f=_0x15d18f-0x0;var _0xd12bf7=_0xa871[_0x15d18f];return _0xd12bf7;};'use strict';function VtigerAccount(_0x16e20c){this['id']=_0x16e20c['id']||0x0;this[_0x1a87('0x0')]=_0x16e20c[_0x1a87('0x0')]||'';this['username']=_0x16e20c[_0x1a87('0x1')]||'';this['accessKey']=_0x16e20c['accessKey']||'';this[_0x1a87('0x2')]=_0x16e20c[_0x1a87('0x2')]||'';this[_0x1a87('0x3')]=_0x16e20c['serverUrl']||'';this[_0x1a87('0x4')]=_0x16e20c[_0x1a87('0x4')]||{};}module[_0x1a87('0x5')]=VtigerAccount; \ No newline at end of file +var _0xf722=['serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x29a91c,_0x5ac2c5){var _0x2ab4ff=function(_0x47fee7){while(--_0x47fee7){_0x29a91c['push'](_0x29a91c['shift']());}};_0x2ab4ff(++_0x5ac2c5);}(_0xf722,0xb1));var _0x2f72=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf722[_0x501510];return _0x1e6ee5;};'use strict';function VtigerAccount(_0x31651c){this['id']=_0x31651c['id']||0x0;this[_0x2f72('0x0')]=_0x31651c[_0x2f72('0x0')]||'';this[_0x2f72('0x1')]=_0x31651c['username']||'';this['accessKey']=_0x31651c[_0x2f72('0x2')]||'';this['remoteUri']=_0x31651c['remoteUri']||'';this[_0x2f72('0x3')]=_0x31651c['serverUrl']||'';this[_0x2f72('0x4')]=_0x31651c['Configurations']||{};}module[_0x2f72('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 0300a1e..0131933 100644 --- a/server/services/ami/model/zendeskAccount.js +++ b/server/services/ami/model/zendeskAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadb5,0xad));var _0x5adb=function(_0x187f3b,_0x1a3955){_0x187f3b=_0x187f3b-0x0;var _0x31e96b=_0xadb5[_0x187f3b];return _0x31e96b;};'use strict';function ZendeskAccount(_0x1f969c){this['id']=_0x1f969c['id']||0x0;this[_0x5adb('0x0')]=_0x1f969c['name']||'';this[_0x5adb('0x1')]=_0x1f969c[_0x5adb('0x1')]||'';this[_0x5adb('0x2')]=_0x1f969c['password']||'';this[_0x5adb('0x3')]=_0x1f969c[_0x5adb('0x3')]||'';this[_0x5adb('0x4')]=_0x1f969c['remoteUri']||'';this[_0x5adb('0x5')]=_0x1f969c[_0x5adb('0x5')]||'';this[_0x5adb('0x6')]=_0x1f969c[_0x5adb('0x6')]||_0x5adb('0x7');this[_0x5adb('0x8')]=_0x1f969c[_0x5adb('0x8')]||'';this[_0x5adb('0x9')]=_0x1f969c[_0x5adb('0x9')]||{};}module[_0x5adb('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xdb28=['Configurations','exports','name','username','password','token','remoteUri','authType','integrationTab','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x50d332,_0x1ade8d){_0x50d332=_0x50d332-0x0;var _0x12db01=_0xdb28[_0x50d332];return _0x12db01;};'use strict';function ZendeskAccount(_0x2f1285){this['id']=_0x2f1285['id']||0x0;this[_0x8db2('0x0')]=_0x2f1285[_0x8db2('0x0')]||'';this[_0x8db2('0x1')]=_0x2f1285['username']||'';this[_0x8db2('0x2')]=_0x2f1285[_0x8db2('0x2')]||'';this[_0x8db2('0x3')]=_0x2f1285[_0x8db2('0x3')]||'';this[_0x8db2('0x4')]=_0x2f1285['remoteUri']||'';this[_0x8db2('0x5')]=_0x2f1285[_0x8db2('0x5')]||'';this['type']=_0x2f1285['type']||_0x8db2('0x6');this[_0x8db2('0x7')]=_0x2f1285[_0x8db2('0x7')]||'';this[_0x8db2('0x8')]=_0x2f1285[_0x8db2('0x8')]||{};}module[_0x8db2('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index c7899cd..84fa2c6 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 _0x9c9b=['code','refreshToken','Configurations','exports','name','description','host','zone','clientSecret','serverUrl'];(function(_0x3fe6b5,_0x356359){var _0x10c32d=function(_0x12dcd0){while(--_0x12dcd0){_0x3fe6b5['push'](_0x3fe6b5['shift']());}};_0x10c32d(++_0x356359);}(_0x9c9b,0x194));var _0xb9c9=function(_0x37e1f1,_0x4c2b49){_0x37e1f1=_0x37e1f1-0x0;var _0x445373=_0x9c9b[_0x37e1f1];return _0x445373;};'use strict';function ZohoAccount(_0x1592f2){this['id']=_0x1592f2['id']||0x0;this[_0xb9c9('0x0')]=_0x1592f2[_0xb9c9('0x0')]||'';this[_0xb9c9('0x1')]=_0x1592f2[_0xb9c9('0x1')]||'';this[_0xb9c9('0x2')]=_0x1592f2['host']||'';this[_0xb9c9('0x3')]=_0x1592f2[_0xb9c9('0x3')]||'';this['clientId']=_0x1592f2['clientId']||'';this['clientSecret']=_0x1592f2[_0xb9c9('0x4')]||'';this[_0xb9c9('0x5')]=_0x1592f2[_0xb9c9('0x5')]||'';this[_0xb9c9('0x6')]=_0x1592f2[_0xb9c9('0x6')]||'';this[_0xb9c9('0x7')]=_0x1592f2[_0xb9c9('0x7')]||'';this[_0xb9c9('0x8')]=_0x1592f2[_0xb9c9('0x8')]||{};}module[_0xb9c9('0x9')]=ZohoAccount; \ No newline at end of file +var _0xedf1=['host','zone','clientId','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0xedf1,0xb2));var _0x1edf=function(_0x15b395,_0x389bf4){_0x15b395=_0x15b395-0x0;var _0x4b650a=_0xedf1[_0x15b395];return _0x4b650a;};'use strict';function ZohoAccount(_0x2597ba){this['id']=_0x2597ba['id']||0x0;this[_0x1edf('0x0')]=_0x2597ba['name']||'';this['description']=_0x2597ba[_0x1edf('0x1')]||'';this[_0x1edf('0x2')]=_0x2597ba[_0x1edf('0x2')]||'';this['zone']=_0x2597ba[_0x1edf('0x3')]||'';this[_0x1edf('0x4')]=_0x2597ba[_0x1edf('0x4')]||'';this['clientSecret']=_0x2597ba['clientSecret']||'';this[_0x1edf('0x5')]=_0x2597ba[_0x1edf('0x5')]||'';this[_0x1edf('0x6')]=_0x2597ba[_0x1edf('0x6')]||'';this[_0x1edf('0x7')]=_0x2597ba[_0x1edf('0x7')]||'';this[_0x1edf('0x8')]=_0x2597ba[_0x1edf('0x8')]||{};}module[_0x1edf('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 c3bf47e..00c9598 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 _0x930a=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','exports','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','SIP/%s','calleridname','Contact','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0xf83277,_0x55487e){var _0x361e0e=function(_0xa2b602){while(--_0xa2b602){_0xf83277['push'](_0xf83277['shift']());}};_0x361e0e(++_0x55487e);}(_0x930a,0x1c0));var _0xa930=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x930a[_0x599f41];return _0x2e4d58;};'use strict';var util=require('util');var _=require(_0xa930('0x0'));var moment=require(_0xa930('0x1'));function checkNameSurname(_0x32250d,_0x1c251f,_0xbb3c9b){var _0x4efc59='';if(!_[_0xa930('0x2')](_0x1c251f)&&_0xa930('0x3')===typeof _0x1c251f){_0x4efc59+=_0x1c251f;}if(!_[_0xa930('0x2')](_0xbb3c9b)&&_0xa930('0x3')===typeof _0xbb3c9b){_0x4efc59+='\x20'+_0xbb3c9b;}if(_0x4efc59!==''){return _0x4efc59;}return _0x32250d;}function Action(_0x17605c,_0x1ad783,_0x422cf5,_0xb31099,_0x3dd042){this[_0xa930('0x4')]=_0x422cf5||undefined;this[_0xa930('0x5')]=_0x17605c['id'];this[_0xa930('0x6')]=_0x1ad783[_0xa930('0x7')];this[_0xa930('0x8')]=_0x1ad783[_0xa930('0x8')];this[_0xa930('0x9')]=_0xa930('0x6');this[_0xa930('0xa')]=![];this[_0xa930('0xb')]=_[_0xa930('0x2')](_0x17605c[_0xa930('0xc')])?undefined:_0x17605c[_0xa930('0xc')]['name'];this[_0xa930('0xd')]=this['membername']?util['format'](_0xa930('0xe'),this['membername']):_0xb31099||undefined;this[_0xa930('0xf')]=checkNameSurname(_0x17605c['Contact']['phone'],_0x17605c[_0xa930('0x10')]['firstName'],_0x17605c['Contact']['lastName']);this[_0xa930('0x11')]=_0x17605c[_0xa930('0x11')]||![];this[_0xa930('0x12')]=_0x17605c['Contact'][_0xa930('0x13')];this[_0xa930('0x14')]=_0x17605c['scheduledat'];this[_0xa930('0x15')]=_0x17605c['countbusyretry']||0x0;this[_0xa930('0x16')]=_0x17605c[_0xa930('0x16')]||0x0;this[_0xa930('0x17')]=_0x17605c[_0xa930('0x17')]||0x0;this['countglobal']=(_0x17605c[_0xa930('0x15')]||0x0)+(_0x17605c[_0xa930('0x16')]||0x0)+(_0x17605c['countnoanswerretry']||0x0);this[_0xa930('0x18')]=_0x17605c[_0xa930('0x18')]||0x0;this[_0xa930('0x19')]=_0x17605c[_0xa930('0x19')]||0x0;this[_0xa930('0x1a')]=_0x17605c[_0xa930('0x1a')]||0x0;this['countmachineretry']=_0x17605c[_0xa930('0x1b')]||0x0;this['countagentrejectretry']=_0x17605c[_0xa930('0x1c')]||0x0;this[_0xa930('0x1d')]=_0x17605c[_0xa930('0x1d')];this[_0xa930('0x1e')]=_0x17605c['callbackuniqueid'];this[_0xa930('0x1f')]=_0x17605c[_0xa930('0x1f')];this['recallme']=_0x17605c[_0xa930('0x20')];this[_0xa930('0x21')]=_0x17605c[_0xa930('0x21')];this['ListId']=_0x17605c[_0xa930('0x22')];this['UserId']=_[_0xa930('0x2')](_0x17605c['Agent'])?_0x17605c[_0xa930('0x23')]:_0x17605c[_0xa930('0xc')]['id'];this[_0xa930('0x24')]=_0x17605c[_0xa930('0x24')];this[_0xa930('0x25')]='';this[_0xa930('0x26')]='';}Action['prototype'][_0xa930('0x27')]=function(){return util[_0xa930('0x28')](_0xa930('0x29'),this['calleridname'],this['number']);};module[_0xa930('0x2a')]=Action; \ No newline at end of file +var _0x0019=['queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0019,0x176));var _0x9001=function(_0x3a7a9c,_0x24f7d6){_0x3a7a9c=_0x3a7a9c-0x0;var _0x59156e=_0x0019[_0x3a7a9c];return _0x59156e;};'use strict';var util=require(_0x9001('0x0'));var _=require(_0x9001('0x1'));var moment=require(_0x9001('0x2'));function checkNameSurname(_0x13bfa2,_0x9a32a2,_0x2ed14b){var _0x3a948a='';if(!_[_0x9001('0x3')](_0x9a32a2)&&'string'===typeof _0x9a32a2){_0x3a948a+=_0x9a32a2;}if(!_['isNil'](_0x2ed14b)&&'string'===typeof _0x2ed14b){_0x3a948a+='\x20'+_0x2ed14b;}if(_0x3a948a!==''){return _0x3a948a;}return _0x13bfa2;}function Action(_0x12b359,_0x560e6c,_0x1d415a,_0x121644,_0x379d32){this['uniqueid']=_0x1d415a||undefined;this['idContact']=_0x12b359['id'];this[_0x9001('0x4')]=_0x560e6c[_0x9001('0x5')];this[_0x9001('0x6')]=_0x560e6c[_0x9001('0x6')];this[_0x9001('0x7')]=_0x9001('0x4');this[_0x9001('0x8')]=![];this[_0x9001('0x9')]=_[_0x9001('0x3')](_0x12b359[_0x9001('0xa')])?undefined:_0x12b359[_0x9001('0xa')][_0x9001('0x5')];this[_0x9001('0xb')]=this['membername']?util[_0x9001('0xc')](_0x9001('0xd'),this[_0x9001('0x9')]):_0x121644||undefined;this['calleridname']=checkNameSurname(_0x12b359[_0x9001('0xe')][_0x9001('0xf')],_0x12b359[_0x9001('0xe')][_0x9001('0x10')],_0x12b359[_0x9001('0xe')][_0x9001('0x11')]);this[_0x9001('0x12')]=_0x12b359[_0x9001('0x12')]||![];this['calleridnum']=_0x12b359[_0x9001('0xe')][_0x9001('0xf')];this[_0x9001('0x13')]=_0x12b359[_0x9001('0x13')];this[_0x9001('0x14')]=_0x12b359[_0x9001('0x14')]||0x0;this[_0x9001('0x15')]=_0x12b359[_0x9001('0x15')]||0x0;this[_0x9001('0x16')]=_0x12b359[_0x9001('0x16')]||0x0;this[_0x9001('0x17')]=(_0x12b359[_0x9001('0x14')]||0x0)+(_0x12b359[_0x9001('0x15')]||0x0)+(_0x12b359['countnoanswerretry']||0x0);this['countnosuchnumberretry']=_0x12b359['countnosuchnumberretry']||0x0;this['countdropretry']=_0x12b359[_0x9001('0x18')]||0x0;this[_0x9001('0x19')]=_0x12b359[_0x9001('0x19')]||0x0;this[_0x9001('0x1a')]=_0x12b359['countmachineretry']||0x0;this[_0x9001('0x1b')]=_0x12b359[_0x9001('0x1b')]||0x0;this[_0x9001('0x1c')]=_0x12b359[_0x9001('0x1c')];this[_0x9001('0x1d')]=_0x12b359[_0x9001('0x1d')];this[_0x9001('0x1e')]=_0x12b359[_0x9001('0x1e')];this[_0x9001('0x1f')]=_0x12b359[_0x9001('0x1f')];this[_0x9001('0x20')]=_0x12b359['ContactId'];this['ListId']=_0x12b359[_0x9001('0x21')];this[_0x9001('0x22')]=_[_0x9001('0x3')](_0x12b359[_0x9001('0xa')])?_0x12b359[_0x9001('0x22')]:_0x12b359['Agent']['id'];this['VoiceQueueId']=_0x12b359[_0x9001('0x23')];this[_0x9001('0x24')]='';this['originatecalleridname']='';}Action[_0x9001('0x25')][_0x9001('0x26')]=function(){return util[_0x9001('0xc')](_0x9001('0x27'),this['calleridname'],this[_0x9001('0x28')]);};module[_0x9001('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 8fe2aec..c3dc51d 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 _0xaf21=['[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','scheduledAt','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','[callProgressDetectingCustomer][logNoAnswer]','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','linkedid','updateOriginated','[callProgressDetectingCustomer]','originated:\x20','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','then','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','SIP/%s','status','unmonitored','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','variablesAction','[originateFailure][logOriginateFailure]','syncNewExten','actionid','clone','isFailure','response','idContact','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','util','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','syncDialEnd','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','type','strategy','answered','available','sumBillable','sumDuration','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','Interval','stringify','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE','\x20is\x20not\x20active','IS_DISACTIVED','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','hasOwnProperty','dialMethod','booked','outbound','clearZombieChannels','setMessage','clearZombieChannel','sequence','isNil','actions','info','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','channel','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','recallMe','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','Agent','voicePause','run','logger2','disableContact','starttime','outboundReCallsDay','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','[HistoryRecallClose]','catch','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','logCustomer','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','emit','buildObj','connect','acw','custom:agentcomplete','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','outboundBusyCallsDay','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]'];(function(_0x348c0f,_0x196872){var _0x462ede=function(_0x22bfde){while(--_0x22bfde){_0x348c0f['push'](_0x348c0f['shift']());}};_0x462ede(++_0x196872);}(_0xaf21,0x83));var _0x1af2=function(_0x587273,_0x34ee16){_0x587273=_0x587273-0x0;var _0xfdb78d=_0xaf21[_0x587273];return _0xfdb78d;};'use strict';var util=require(_0x1af2('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x1af2('0x1'));var moment=require(_0x1af2('0x2'));var md5=require(_0x1af2('0x3'));var Redis=require(_0x1af2('0x4'));var config=require(_0x1af2('0x5'));var logger=require(_0x1af2('0x6'))(_0x1af2('0x7'));var loggerAction=require(_0x1af2('0x6'))(_0x1af2('0x8'));var ami=require(_0x1af2('0x9'));var rpcDb=require('./rpcDb');var Action=require(_0x1af2('0xa'));var ut=require('./util/util');config[_0x1af2('0xb')]=_[_0x1af2('0xc')](config[_0x1af2('0xb')],{'host':_0x1af2('0xd'),'port':0x18eb});var io=require(_0x1af2('0xe'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x1af2('0xf')][_0x1af2('0x10')]=function(_0x531403){this[_0x1af2('0x11')]=this['tail']?this[_0x1af2('0x11')]['finally'](_0x531403):_0x531403();};function Preview(_0xae7d77){this['sequence']=new Sequence();this[_0x1af2('0x12')]=_0xae7d77[_0x1af2('0x13')];this[_0x1af2('0x14')]=_0xae7d77[_0x1af2('0x14')];this['actions']={};this[_0x1af2('0x15')]=_0xae7d77[_0x1af2('0x15')];this[_0x1af2('0x16')]=0x0;ami['on'](_0x1af2('0x17'),this[_0x1af2('0x18')][_0x1af2('0x19')](this));ami['on']('hangup',this[_0x1af2('0x1a')]['bind'](this));ami['on'](_0x1af2('0x1b'),this['syncHangupRequest']['bind'](this));ami['on']('dialend',this[_0x1af2('0x1c')][_0x1af2('0x19')](this));ami['on']('newexten',this['syncNewExten'][_0x1af2('0x19')](this));ami['on'](_0x1af2('0x1d'),this[_0x1af2('0x1e')][_0x1af2('0x19')](this));ami['on'](_0x1af2('0x1f'),this[_0x1af2('0x20')][_0x1af2('0x19')](this));ami['on'](_0x1af2('0x21'),this[_0x1af2('0x22')][_0x1af2('0x19')](this));this['loopCampaigns'](this[_0x1af2('0x12')]);}function emit(_0x394bf2,_0x39913a,_0x58d230){io['to'](_0x394bf2)['emit'](_0x39913a,_0x58d230);}function emitCampaignPreview(_0x42318c){if(_0x42318c[_0x1af2('0x23')]==='outbound'){var _0x442234={'id':_0x42318c['id'],'name':_0x42318c['name'],'strategy':_0x42318c[_0x1af2('0x24')],'answered':_0x42318c[_0x1af2('0x25')],'available':_0x42318c[_0x1af2('0x26')],'loggedIn':_0x42318c['loggedIn'],'pTalking':_0x42318c['pTalking'],'sumBillable':_0x42318c[_0x1af2('0x27')],'sumDuration':_0x42318c[_0x1af2('0x28')],'sumHoldTime':_0x42318c['sumHoldTime']||0x0,'talking':_0x42318c[_0x1af2('0x29')],'total':_0x42318c[_0x1af2('0x2a')],'type':_0x42318c['type'],'unmanaged':_0x42318c[_0x1af2('0x2b')],'abandoned':_0x42318c[_0x1af2('0x2c')],'waiting':_0x42318c[_0x1af2('0x2d')],'loggedInDb':_0x42318c[_0x1af2('0x2e')],'dialActive':_0x42318c[_0x1af2('0x2f')],'dialMethod':_0x42318c['dialMethod'],'dialOriginateCallerIdName':_0x42318c[_0x1af2('0x30')],'dialOriginateCallerIdNumber':_0x42318c['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x42318c[_0x1af2('0x31')],'dialPrefix':_0x42318c[_0x1af2('0x32')],'outboundAnswerAgiCallsDay':_0x42318c[_0x1af2('0x33')],'outboundAnswerCallsDay':_0x42318c[_0x1af2('0x34')],'outboundBlacklistCallsDay':_0x42318c[_0x1af2('0x35')],'outboundBusyCallsDay':_0x42318c['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x42318c[_0x1af2('0x36')],'outboundDropCallsDayACS':_0x42318c[_0x1af2('0x37')],'outboundDropCallsDayCallersExit':_0x42318c[_0x1af2('0x38')],'outboundDropCallsDayTimeout':_0x42318c[_0x1af2('0x39')],'outboundNoAnswerCallsDay':_0x42318c[_0x1af2('0x3a')],'outboundNoSuchCallsDay':_0x42318c[_0x1af2('0x3b')],'outboundOriginateFailureCallsDay':_0x42318c[_0x1af2('0x3c')],'outboundReCallsDay':_0x42318c['outboundReCallsDay'],'outboundRejectCallsDay':_0x42318c[_0x1af2('0x3d')],'outboundUnknownCallsDay':_0x42318c[_0x1af2('0x3e')],'outboundAbandonedCallsDay':_0x42318c[_0x1af2('0x3f')],'predictiveIntervalAnsweredCalls':_0x42318c[_0x1af2('0x40')],'predictiveIntervalAvgHoldtime':_0x42318c[_0x1af2('0x41')],'predictiveIntervalAvgTalktime':_0x42318c[_0x1af2('0x42')],'predictiveIntervalDroppedCallsCallersExit':_0x42318c[_0x1af2('0x43')],'predictiveIntervalDroppedCallsTimeout':_0x42318c[_0x1af2('0x44')],'predictiveIntervalErlangCalls':_0x42318c[_0x1af2('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x42318c['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x42318c['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x42318c[_0x1af2('0x46')],'predictiveIntervalPauses':_0x42318c[_0x1af2('0x47')],'predictiveIntervalAvailable':_0x42318c['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x42318c['predictiveIntervalTotalCalls'],'message':_0x42318c[_0x1af2('0x48')],'originated':_0x42318c[_0x1af2('0x49')],'erlangCalls':_0x42318c[_0x1af2('0x4a')],'erlangCallToSecond':_0x42318c['erlangCallToSecond'],'erlangAbandonmentRate':_0x42318c[_0x1af2('0x4b')],'erlangBusyFactor':_0x42318c[_0x1af2('0x4c')],'startPredictive':_0x42318c[_0x1af2('0x4d')],'startProgressive':_0x42318c[_0x1af2('0x4e')]};if(_0x42318c[_0x1af2('0x4f')]){_0x442234[_0x1af2('0x4f')]={'id':_0x42318c[_0x1af2('0x4f')]['id'],'name':_0x42318c[_0x1af2('0x4f')][_0x1af2('0x50')],'active':_0x42318c[_0x1af2('0x4f')][_0x1af2('0x51')],'callerid':_0x42318c['Trunk']['callerid']};}if(_0x42318c[_0x1af2('0x52')]){_0x442234[_0x1af2('0x52')]={'id':_0x42318c[_0x1af2('0x52')]['id'],'name':_0x42318c['Interval'][_0x1af2('0x50')]};}var _0x37110e=md5(JSON[_0x1af2('0x53')](_0x442234));if(_0x42318c[_0x1af2('0x3')]!==_0x37110e){_0x42318c[_0x1af2('0x3')]=_0x37110e;emit(util['format']('voice:queue:%s',_0x442234[_0x1af2('0x50')]),'voice_queue:save',_0x442234);}}}function emitVoiceQueueChannelRemove(_0x38545f){logger['info'](_0x1af2('0x54'),JSON[_0x1af2('0x53')](_0x38545f));emit(util[_0x1af2('0x55')](_0x1af2('0x56'),_0x38545f[_0x1af2('0x50')]),_0x1af2('0x57'),_0x38545f);}function notSendMessagesQueue(_0x29e419){if(_0x29e419[_0x1af2('0x58')]){if(_0x29e419[_0x1af2('0x49')]===0x0&&_0x29e419[_0x1af2('0x59')]===0x0){_0x29e419[_0x1af2('0x58')]=![];_0x29e419[_0x1af2('0x26')]=0x0;_0x29e419[_0x1af2('0x5a')]=0x0;_0x29e419[_0x1af2('0x48')]=_0x1af2('0x5b');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x29e419['name']+_0x1af2('0x5c'));}else{_0x29e419[_0x1af2('0x48')]=_0x1af2('0x5d');ut[_0x1af2('0x5e')](_0x1af2('0x5f'),_0x29e419['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x29e419);}}Preview[_0x1af2('0xf')]['loopCampaigns']=function(){var _0x13446d=this;setInterval(function(){_0x13446d[_0x1af2('0x60')]();},0x7cf);};Preview[_0x1af2('0xf')][_0x1af2('0x60')]=function(){var _0x17cf46=this[_0x1af2('0x12')];this[_0x1af2('0x16')]+=0x1;for(var _0x113169 in _0x17cf46){if(_0x17cf46[_0x1af2('0x61')](_0x113169)&&(_0x17cf46[_0x113169][_0x1af2('0x62')]===_0x1af2('0x7')||_0x17cf46[_0x113169]['dialMethod']===_0x1af2('0x63'))&&_0x17cf46[_0x113169]['type']===_0x1af2('0x64')){if(this[_0x1af2('0x16')]>0x7){this[_0x1af2('0x16')]=0x0;this[_0x1af2('0x65')]();}}if(_0x17cf46[_0x1af2('0x61')](_0x113169)&&_0x17cf46[_0x113169][_0x1af2('0x62')]===_0x1af2('0x7')&&_0x17cf46[_0x113169][_0x1af2('0x23')]===_0x1af2('0x64')){if(_0x17cf46[_0x113169][_0x1af2('0x2f')]){this[_0x1af2('0x66')](_0x17cf46[_0x113169]);this['recallMe'](_0x17cf46[_0x113169]);}else{notSendMessagesQueue(_0x17cf46[_0x113169]);}}}};Preview[_0x1af2('0xf')][_0x1af2('0x67')]=function(_0x918207){var _0x30313d=this;this[_0x1af2('0x68')][_0x1af2('0x10')](function(){if(!_[_0x1af2('0x69')](_0x30313d[_0x1af2('0x6a')][_0x918207])){loggerAction[_0x1af2('0x6b')]('[clearZombieChannels][talking]',_0x918207,_0x1af2('0x6c'),_0x30313d[_0x1af2('0x6a')][_0x918207][_0x1af2('0x6d')],'originated:\x20',JSON[_0x1af2('0x53')](_0x30313d['campaignsPreview'][_0x30313d[_0x1af2('0x6a')][_0x918207][_0x1af2('0x6d')]][_0x1af2('0x49')]),_0x1af2('0x6e'),JSON[_0x1af2('0x53')](_0x30313d[_0x1af2('0x12')][_0x30313d[_0x1af2('0x6a')][_0x918207][_0x1af2('0x6d')]]['pTalking']),JSON[_0x1af2('0x53')](_0x30313d[_0x1af2('0x6a')][_0x918207][_0x1af2('0x6f')]),JSON[_0x1af2('0x53')](_[_0x1af2('0x70')](_0x30313d[_0x1af2('0x6a')][_0x918207],[_0x1af2('0x71'),'UserId',_0x1af2('0x72'),_0x1af2('0x73')])));return ami[_0x1af2('0x74')]({'action':'status','channel':_0x30313d[_0x1af2('0x6a')][_0x918207][_0x1af2('0x75')]})['catch'](function(_0x321c49){if(_0x321c49[_0x1af2('0x48')]===_0x1af2('0x76')){setTimeout(function(){if(_0x30313d[_0x1af2('0x6a')][_0x918207]){ut['updateOriginated'](_0x30313d[_0x1af2('0x12')][_0x30313d[_0x1af2('0x6a')][_0x918207]['queue']],_0x1af2('0x77'));if(_0x30313d[_0x1af2('0x6a')][_0x918207]['dialAnswer']===!![]){ut[_0x1af2('0x78')](_0x30313d['campaignsPreview'][_0x30313d[_0x1af2('0x6a')][_0x918207][_0x1af2('0x6d')]],_0x1af2('0x77'));ut[_0x1af2('0x79')](_0x1af2('0x7a')+_0x918207,_0x30313d[_0x1af2('0x6a')][_0x918207][_0x1af2('0x6d')]);}ut[_0x1af2('0x79')](_0x1af2('0x7b')+_0x918207,_0x30313d[_0x1af2('0x6a')][_0x918207][_0x1af2('0x6d')]);delete _0x30313d['actions'][_0x918207];}},0x2328);}});}});};Preview['prototype'][_0x1af2('0x65')]=function(){var _0x507d82=this;loggerAction[_0x1af2('0x6b')]('[action]',_[_0x1af2('0x7c')](this[_0x1af2('0x6a')]));for(var _0x2fa950 in this['actions']){if(_0x507d82[_0x1af2('0x6a')][_0x1af2('0x61')](_0x2fa950)){_0x507d82[_0x1af2('0x67')](_0x2fa950);}}};Preview[_0x1af2('0xf')][_0x1af2('0x7d')]=function(_0x11bf47){var _0x4014f3=this;rpcDb[_0x1af2('0x7e')](_0x11bf47['id'],ut[_0x1af2('0x7f')](this['agents']))['then'](function(_0x27b2ac){if(!_[_0x1af2('0x69')](_0x27b2ac)){for(var _0x441f87=0x0;_0x441f87<_0x27b2ac[_0x1af2('0x80')];_0x441f87+=0x1){if(ut[_0x1af2('0x81')](_0x27b2ac[_0x441f87][_0x1af2('0x82')])<_0x11bf47['dialRecallMeTimeout']*0x3c){if(_0x27b2ac[_0x441f87][_0x1af2('0x83')]&&!_0x27b2ac[_0x441f87][_0x1af2('0x83')][_0x1af2('0x84')]){_0x4014f3[_0x1af2('0x85')](_0x27b2ac[_0x441f87]['id'])['then'](ut['logger2']('[RecallMe]'))['catch'](ut[_0x1af2('0x86')]('[RecallMe]'));}else{rpcDb[_0x1af2('0x87')](_0x27b2ac[_0x441f87]['id']);}}else{var _0x512fc4=new Action(_0x27b2ac[_0x441f87],_0x11bf47);_0x512fc4[_0x1af2('0x88')]=moment()[_0x1af2('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x11bf47[_0x1af2('0x89')]+=0x1;ut['logCustomer'](_0x512fc4,0x17,_0x1af2('0x8a'));if(_0x11bf47[_0x1af2('0x8b')]){rpcDb[_0x1af2('0x8c')](ut[_0x1af2('0x8d')](_0x27b2ac[_0x441f87]));rpcDb[_0x1af2('0x8e')](_0x512fc4,_0x1af2('0x8f'));}else{ut['logCustomer'](_0x512fc4,0x16,_0x1af2('0x90'));rpcDb[_0x1af2('0x8e')](_0x512fc4,'[HistoryRecallClose]');rpcDb[_0x1af2('0x91')](_0x512fc4,_0x1af2('0x92'));}}}}})[_0x1af2('0x93')](ut[_0x1af2('0x86')]('[getContactRecallMe]'));};Preview[_0x1af2('0xf')][_0x1af2('0x66')]=function(_0x169298){_0x169298[_0x1af2('0x58')]=!![];if(ut[_0x1af2('0x94')](_0x169298[_0x1af2('0x95')])){_0x169298[_0x1af2('0x48')]=_0x1af2('0x96');}else if(!ut[_0x1af2('0x97')](_0x169298[_0x1af2('0x2f')])){_0x169298[_0x1af2('0x48')]=_0x1af2('0x5b');}else if(!this[_0x1af2('0x98')](_0x169298['Trunk'])){if(!this[_0x1af2('0x98')](_0x169298[_0x1af2('0x99')])){_0x169298[_0x1af2('0x48')]='TRUNK_IS_NOT_REACHABLE';}else{_0x169298[_0x1af2('0x48')]=_0x1af2('0x9a');}}else{_0x169298['message']='ACTIVE';}emitCampaignPreview(_0x169298);};Preview[_0x1af2('0xf')][_0x1af2('0x9b')]=function(_0x8c9957,_0xb41dd3,_0x2aff98){var _0xd23d96=this;var _0x51cbc6=this[_0x1af2('0x6a')][_0xb41dd3];var _0x3e9353=this[_0x1af2('0x12')][_0x51cbc6[_0x1af2('0x6d')]];var _0x1f50f6;if(_0x3e9353){switch(_0x2aff98){case'1':_0x3e9353[_0x1af2('0x3b')]+=0x1;_0x51cbc6[_0x1af2('0x9c')]+=0x1;_0x51cbc6[_0x1af2('0x9d')]=ut[_0x1af2('0x9e')](_0x51cbc6);ut[_0x1af2('0x9f')](_0x51cbc6,0x0,_0x1af2('0xa0'));rpcDb[_0x1af2('0x8e')](_0x51cbc6,_0x1af2('0xa1'));if(ut[_0x1af2('0x9e')](_0x51cbc6)>=_0x3e9353[_0x1af2('0xa2')]){_0x1f50f6=ut[_0x1af2('0xa3')](_0x51cbc6,0xf,'Global');rpcDb[_0x1af2('0x91')](_0x1f50f6,_0x1af2('0xa4'));}else{if(_0x51cbc6[_0x1af2('0x9c')]>=_0x3e9353[_0x1af2('0xa5')]){rpcDb[_0x1af2('0x91')](_0x51cbc6,_0x1af2('0xa4'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x51cbc6,_0x1af2('0x9c'),_0x3e9353[_0x1af2('0xa6')]),_0x51cbc6[_0x1af2('0xa7')],_0x51cbc6[_0x1af2('0xa8')]);}}delete this[_0x1af2('0x6a')][_0x8c9957['linkedid']];break;case _0x1af2('0xa9'):var _0x2ac64e=moment()[_0x1af2('0x55')](_0x1af2('0xaa'));_0x51cbc6[_0x1af2('0xab')]=_0x2ac64e;_0x51cbc6[_0x1af2('0xac')]=_0x2ac64e;_0x51cbc6['dialAnswer']=!![];_0x3e9353[_0x1af2('0x59')]+=0x1;logger[_0x1af2('0x6b')](_0x1af2('0xad'),_0x51cbc6[_0x1af2('0xae')],_0x1af2('0xaf'),_0x3e9353[_0x1af2('0x50')],_0x1af2('0x6e'),_0x3e9353[_0x1af2('0x59')]);ami[_0x1af2('0xb0')]('custom:agentconnect',ut[_0x1af2('0xb1')](_0x51cbc6,_0x1af2('0xb2')));if(_0x3e9353[_0x1af2('0xb3')]){ami[_0x1af2('0xb0')]('custom:agentConnectPreview',ut['buildAcw'](_0x51cbc6));}break;case'16':ami[_0x1af2('0xb0')](_0x1af2('0xb4'),ut[_0x1af2('0xb1')](_0x51cbc6,_0x1af2('0xb5')));emitVoiceQueueChannelRemove(ut[_0x1af2('0xb1')](_0x51cbc6,_0x1af2('0xb5')));_0x3e9353[_0x1af2('0x34')]+=0x1;_0x3e9353['total']+=0x1;_0x3e9353['answered']+=0x1;ut['decrementTalkink'](_0x3e9353,_0x1af2('0xb6'));_0x51cbc6[_0x1af2('0x9d')]=ut['totalGlobal'](_0x51cbc6);ut[_0x1af2('0x9f')](_0x51cbc6,0x4,_0x1af2('0xb7'));rpcDb[_0x1af2('0x8e')](_0x51cbc6,_0x1af2('0xb8'));rpcDb[_0x1af2('0x91')](_0x51cbc6,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x1af2('0xb9')](_0x51cbc6);_0x3e9353[_0x1af2('0x28')]+=_0x51cbc6[_0x1af2('0xba')];_0x3e9353[_0x1af2('0x27')]+=_0x51cbc6[_0x1af2('0xba')];logger[_0x1af2('0x6b')]('[syncHangup][talking][decrement]',_0x51cbc6[_0x1af2('0xae')],_0x1af2('0xaf'),_0x3e9353['name'],'pTalking:\x20',_0x3e9353[_0x1af2('0x59')]);delete this['actions'][_0x8c9957['linkedid']];break;case'BUSY':_0x3e9353[_0x1af2('0xbb')]+=0x1;_0x51cbc6[_0x1af2('0xbc')]+=0x1;_0x51cbc6[_0x1af2('0x9d')]=ut[_0x1af2('0x9e')](_0x51cbc6);ut[_0x1af2('0x9f')](_0x51cbc6,0x5,_0x1af2('0xbd'));rpcDb[_0x1af2('0x8e')](_0x51cbc6,_0x1af2('0xbe'));if(ut[_0x1af2('0x9e')](_0x51cbc6)>=_0x3e9353[_0x1af2('0xa2')]){_0x1f50f6=ut['cloneAction'](_0x51cbc6,0xf,'Global');rpcDb[_0x1af2('0x91')](_0x1f50f6,_0x1af2('0xbf'));}else{if(_0x51cbc6[_0x1af2('0xbc')]>=_0x3e9353[_0x1af2('0xc0')]){rpcDb[_0x1af2('0x91')](_0x51cbc6,_0x1af2('0xbe'));}else{rpcDb[_0x1af2('0xc1')](ut[_0x1af2('0xc2')](_0x51cbc6,_0x1af2('0xbc'),_0x3e9353[_0x1af2('0xc3')]),_0x51cbc6['unlockAgent'],_0x51cbc6[_0x1af2('0xa8')]);}}break;case _0x1af2('0xc4'):_0x3e9353[_0x1af2('0x3a')]+=0x1;_0x51cbc6[_0x1af2('0xc5')]+=0x1;_0x51cbc6[_0x1af2('0x9d')]=ut[_0x1af2('0x9e')](_0x51cbc6);ut[_0x1af2('0x9f')](_0x51cbc6,0x3,'NoAnswer');rpcDb['createCustomerHistory'](_0x51cbc6,_0x1af2('0xc6'));if(ut[_0x1af2('0x9e')](_0x51cbc6)>=_0x3e9353[_0x1af2('0xa2')]){_0x1f50f6=ut[_0x1af2('0xa3')](_0x51cbc6,0xf,_0x1af2('0xc7'));rpcDb[_0x1af2('0x91')](_0x1f50f6,_0x1af2('0xc8'));}else{if(_0x51cbc6[_0x1af2('0xc5')]>=_0x3e9353[_0x1af2('0xc9')]){rpcDb['createCustomerFinal'](_0x51cbc6,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x1af2('0xc1')](ut[_0x1af2('0xc2')](_0x51cbc6,_0x1af2('0xc5'),_0x3e9353[_0x1af2('0xca')]),_0x51cbc6['unlockAgent'],_0x51cbc6[_0x1af2('0xa8')]);}}break;case'CONGESTION':_0x3e9353[_0x1af2('0x36')]+=0x1;_0x51cbc6[_0x1af2('0xcb')]+=0x1;_0x51cbc6['countglobal']=ut[_0x1af2('0x9e')](_0x51cbc6);ut['logCustomer'](_0x51cbc6,0x8,_0x1af2('0xcc'));rpcDb[_0x1af2('0x8e')](_0x51cbc6,_0x1af2('0xcd'));if(ut[_0x1af2('0x9e')](_0x51cbc6)>=_0x3e9353[_0x1af2('0xa2')]){_0x1f50f6=ut['cloneAction'](_0x51cbc6,0xf,_0x1af2('0xc7'));rpcDb['createCustomerFinal'](_0x1f50f6,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x51cbc6[_0x1af2('0xcb')]>=_0x3e9353[_0x1af2('0xce')]){rpcDb[_0x1af2('0x91')](_0x51cbc6,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x1af2('0xc2')](_0x51cbc6,_0x1af2('0xcb'),_0x3e9353[_0x1af2('0xc3')]),_0x51cbc6['unlockAgent'],_0x51cbc6['activeContact']);}}break;case _0x1af2('0xcf'):_0x3e9353[_0x1af2('0x3d')]+=0x1;_0x51cbc6[_0x1af2('0xd0')]+=0x1;_0x51cbc6[_0x1af2('0x9d')]=ut[_0x1af2('0x9e')](_0x51cbc6);ut['logCustomer'](_0x51cbc6,0x14,'AgentReject');rpcDb['createCustomerHistory'](_0x51cbc6,_0x1af2('0xd1'));if(ut['totalGlobal'](_0x51cbc6)>=_0x3e9353['dialGlobalMaxRetry']){_0x1f50f6=ut[_0x1af2('0xa3')](_0x51cbc6,0x14,_0x1af2('0xd2'));rpcDb[_0x1af2('0x91')](_0x1f50f6,_0x1af2('0xd3'));}else{if(_0x51cbc6['countagentrejectretry']>=_0x3e9353[_0x1af2('0xd4')]){rpcDb[_0x1af2('0x91')](_0x51cbc6,_0x1af2('0xd3'));}else{rpcDb[_0x1af2('0xc1')](ut[_0x1af2('0xc2')](_0x51cbc6,_0x1af2('0xd0'),_0x3e9353['dialAgentRejectRetryFrequency']),_0x51cbc6['unlockAgent'],_0x51cbc6['activeContact']);}}break;case _0x1af2('0xd5'):_0x3e9353['outboundAbandonedCallsDay']+=0x1;_0x51cbc6['countabandonedretry']+=0x1;_0x51cbc6[_0x1af2('0x9d')]=ut['totalGlobal'](_0x51cbc6);ut['logCustomer'](_0x51cbc6,0xb,_0x1af2('0xd6'));rpcDb[_0x1af2('0x8e')](_0x51cbc6,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x51cbc6)>=_0x3e9353['dialGlobalMaxRetry']){_0x1f50f6=ut[_0x1af2('0xa3')](_0x51cbc6,0xf,_0x1af2('0xc7'));rpcDb[_0x1af2('0x91')](_0x1f50f6,_0x1af2('0xd7'));}else{if(_0x51cbc6[_0x1af2('0xd8')]>=_0x3e9353[_0x1af2('0xd9')]){rpcDb[_0x1af2('0x91')](_0x51cbc6,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x1af2('0xc1')](ut[_0x1af2('0xc2')](_0x51cbc6,_0x1af2('0xda'),_0x3e9353['dialAbandonedRetryFrequency']),_0x51cbc6[_0x1af2('0xa7')],_0x51cbc6[_0x1af2('0xa8')]);}}break;default:if(_0x51cbc6[_0x1af2('0x6f')]){ut[_0x1af2('0x78')](_0x3e9353,'[default]');ut[_0x1af2('0x79')](_0x1af2('0xdb')+_0x3e9353['name'],_0x8c9957);}_0x3e9353['outboundUnknownCallsDay']+=0x1;_0x51cbc6[_0x1af2('0x9d')]=ut[_0x1af2('0x9e')](_0x51cbc6);ut[_0x1af2('0x9f')](_0x51cbc6,0xc,_0x8c9957[_0x1af2('0xdc')]||_0x8c9957[_0x1af2('0xdd')]);rpcDb['createCustomerHistory'](_0x51cbc6,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x51cbc6)>=_0x3e9353[_0x1af2('0xa2')]){_0x1f50f6=ut['cloneAction'](_0x51cbc6,0xf,_0x1af2('0xc7'));rpcDb[_0x1af2('0x91')](_0x1f50f6,_0x1af2('0xde'));}else{rpcDb['createCustomerFinal'](_0x51cbc6,_0x1af2('0xde'));}delete this[_0x1af2('0x6a')][_0x8c9957[_0x1af2('0xdf')]];}if(!(_0x51cbc6[_0x1af2('0x6f')]&&_0x2aff98==='16')){ut[_0x1af2('0xe0')](_0x3e9353,_0x1af2('0xe1'));logger[_0x1af2('0x6b')]('[originated][decrement][callProgressDetectingCustomer]',_0x51cbc6[_0x1af2('0xae')],'\x20Queue',_0x3e9353[_0x1af2('0x50')],_0x1af2('0xe2'),_0x3e9353[_0x1af2('0x49')]);}if(_0x2aff98!==_0x1af2('0xa9')){delete this[_0x1af2('0x6a')][_0x8c9957[_0x1af2('0xdf')]];delete this[_0x1af2('0x6a')][_0x8c9957[_0x1af2('0xe3')]];}}};Preview[_0x1af2('0xf')][_0x1af2('0xe4')]=function(_0xbb8b83,_0x227e6,_0xab7dd9){if(_[_0x1af2('0xe5')](_0x227e6)&&_0x1af2('0xe6')!==typeof _0x227e6){return;}if(_['isUndefined'](_0xab7dd9)&&_0x1af2('0xe6')!==typeof _0xab7dd9){return;}switch(_0xab7dd9[_0x1af2('0xe7')]){case'0':ut[_0x1af2('0xe8')](_0xbb8b83,0x0,_0x1af2('0xa0'));rpcDb[_0x1af2('0xe9')](_0xbb8b83,_0x1af2('0xea'));break;case'3':ut[_0x1af2('0xe8')](_0xbb8b83,0x3,_0x1af2('0xeb'));rpcDb[_0x1af2('0xe9')](_0xbb8b83,_0x1af2('0xec'));break;case'5':ut[_0x1af2('0xe8')](_0xbb8b83,0x5,_0x1af2('0xbd'));rpcDb[_0x1af2('0xe9')](_0xbb8b83,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x1af2('0xe8')](_0xbb8b83,0x8,'Congestion');rpcDb[_0x1af2('0xe9')](_0xbb8b83,_0x1af2('0xed'));break;case'22':ut[_0x1af2('0xe8')](_0xbb8b83,0x16,_0x1af2('0xee'));rpcDb[_0x1af2('0xe9')](_0xbb8b83,_0x1af2('0xef'));break;default:ut[_0x1af2('0xe8')](_0xbb8b83,0xc,_0xab7dd9['reason']);rpcDb[_0x1af2('0xe9')](_0xbb8b83,'[callProgressDetectingAgent][logCongestion]');}ut[_0x1af2('0xe0')](_0x227e6,'[callProgressDetectingAgent]');logger[_0x1af2('0x6b')](_0x1af2('0xf0'),_0xbb8b83[_0x1af2('0xae')],_0x1af2('0xaf'),_0x227e6['name'],_0x1af2('0xe2'),_0x227e6[_0x1af2('0x49')]);delete this['actions'][_0xbb8b83[_0x1af2('0xae')]];};Preview[_0x1af2('0xf')][_0x1af2('0xf1')]=function(_0x440267,_0x50e40c,_0x1e9098,_0x5d612b,_0xb2670d){var _0x2b985=this;return new BPromise(function(_0x2674fe,_0x229cdd){if(_[_0x1af2('0x69')](_0x50e40c)||_['isNil'](_0x50e40c[_0x1af2('0xf2')])||_['isNil'](_0x50e40c[_0x1af2('0xf2')][_0x1af2('0xf3')])||_[_0x1af2('0x69')](_0x50e40c[_0x1af2('0x72')])){_0x229cdd(ut[_0x1af2('0x48')](_0x1af2('0xf4'),_0x5d612b,_0xb2670d));return;}var _0x16aab1=uuid['v4']();var _0x1e5255=_0x2b985['campaignsPreview'][_0x50e40c[_0x1af2('0x6c')][_0x1af2('0x50')]];var _0x4cb39b=_0x1e9098?_0x2b985['agents'][_0x1e9098]['id']:undefined;_0x2b985['actions'][_0x16aab1]=new Action(_0x50e40c,_0x1e5255,_0x16aab1,_0x1e9098,_0x4cb39b);var _0x136054=_0x2b985[_0x1af2('0x6a')][_0x16aab1];_0x136054[_0x1af2('0xa7')]=_0x5d612b;_0x136054[_0x1af2('0xa8')]=_0xb2670d;_0x136054[_0x1af2('0xf5')]=_0x1e9098;if(_[_0x1af2('0xf6')](_0x440267)){_0x2b985[_0x1af2('0xf7')](_0x136054,_0x1e5255,_0x50e40c,_0x1e9098)[_0x1af2('0xf8')](function(_0x274411){logger[_0x1af2('0x6b')](_0x1af2('0xf9'),_0x1af2('0xfa')+_0x136054[_0x1af2('0x6d')]+_0x1af2('0xfb')+_0x136054['idContact'],JSON['stringify'](_0x274411));ami['emit'](_0x1af2('0xfc'),ut[_0x1af2('0xb1')](_0x136054,'called'));_0x2674fe(ut['message'](_0x1af2('0xfd')));})['catch'](function(_0x502385){ut['logger'](_0x1af2('0xfe'),_0x502385);_0x229cdd(ut[_0x1af2('0x48')](_0x1af2('0xff'),_0x5d612b,_0xb2670d));});}else{_0x1e5255[_0x1af2('0x35')]+=0x1;ut[_0x1af2('0x100')](_0x136054);rpcDb[_0x1af2('0x101')](_0x136054,_0x1af2('0x102'));delete _0x2b985[_0x1af2('0x6a')][_0x16aab1];_0x229cdd(ut[_0x1af2('0x48')]('Contact\x20in\x20black\x20List',_0x5d612b,_0xb2670d));}});};Preview[_0x1af2('0xf')][_0x1af2('0x98')]=function(_0x396cd6){return!_[_0x1af2('0x69')](_0x396cd6)&&!_[_0x1af2('0x69')](_0x396cd6[_0x1af2('0x50')])&&!_[_0x1af2('0x69')](_0x396cd6[_0x1af2('0x51')])&&_0x396cd6[_0x1af2('0x51')]&&!_[_0x1af2('0x69')](this[_0x1af2('0x14')][util[_0x1af2('0x55')](_0x1af2('0x103'),_0x396cd6[_0x1af2('0x50')])])&&!_[_0x1af2('0x69')](this[_0x1af2('0x14')][util[_0x1af2('0x55')](_0x1af2('0x103'),_0x396cd6[_0x1af2('0x50')])][_0x1af2('0x104')])&&(this[_0x1af2('0x14')][util[_0x1af2('0x55')](_0x1af2('0x103'),_0x396cd6[_0x1af2('0x50')])][_0x1af2('0x104')]==='reachable'||this[_0x1af2('0x14')][util['format'](_0x1af2('0x103'),_0x396cd6['name'])][_0x1af2('0x104')]===_0x1af2('0x105'));};Preview[_0x1af2('0xf')][_0x1af2('0x85')]=function(_0x70b36c,_0x44de66){var _0x54a093=this;return new BPromise(function(_0x3d2157,_0x4cd2e9){_0x54a093['execRun'](_0x70b36c,_0x44de66)[_0x1af2('0xf8')](function(_0x4194bf){_0x3d2157(_[_0x1af2('0x70')](_0x4194bf,[_0x1af2('0x48')]));})[_0x1af2('0x93')](function(_0x4d3e64){if(_0x4d3e64[_0x1af2('0x106')]){rpcDb[_0x1af2('0x107')](_0x70b36c);}if(_0x4d3e64['active']){rpcDb[_0x1af2('0x87')](_0x70b36c);}_0x4cd2e9(_[_0x1af2('0x70')](_0x4d3e64,[_0x1af2('0x48')]));});});};Preview[_0x1af2('0xf')]['execRun']=function(_0x1b4ef0,_0x1429fd){var _0x410c4a=this;return new BPromise(function(_0x13bac7,_0x292ad2){var _0x5b726e,_0x3684eb;rpcDb[_0x1af2('0x108')](_0x1b4ef0)['then'](function(_0x568522){if(!_[_0x1af2('0x69')](_0x568522[0x0])){_0x3684eb=_0x568522[0x0][_0x1af2('0x109')]?![]:!![];_0x5b726e=_0x568522[0x0][_0x1af2('0x109')]?!![]:![];_0x5b726e=_0x1429fd?!![]:_0x5b726e;}var _0x4828c3=_0x410c4a[_0x1af2('0x10a')](_0x568522);if(_0x4828c3[_0x1af2('0x10b')]){rpcDb[_0x1af2('0x10c')](_[_0x1af2('0x70')](_0x568522[0x0],[_0x1af2('0x72'),'Contact.phone']))[_0x1af2('0xf8')](function(_0x323e84){_0x410c4a[_0x1af2('0xf1')](_0x323e84,_0x568522[0x0],_0x1429fd,_0x3684eb,_0x5b726e)[_0x1af2('0xf8')](function(_0x52e1ff){_0x13bac7(_0x52e1ff);})['catch'](function(_0x374dbc){_0x292ad2(_0x374dbc);});})['catch'](function(_0x22f238){ut[_0x1af2('0x5e')]('[Preview][checkIsBlackList]',_0x22f238);_0x292ad2(ut[_0x1af2('0x48')](_0x1af2('0x10d'),_0x3684eb,_0x5b726e));});}else{_0x292ad2(ut['message'](_0x4828c3[_0x1af2('0x48')],_0x3684eb,_0x5b726e));}})[_0x1af2('0x93')](function(_0x32efe7){ut['logger'](_0x1af2('0x10e'),_0x32efe7);_0x292ad2(ut['message'](_0x1af2('0x10d'),![],!![]));});});};Preview[_0x1af2('0xf')][_0x1af2('0x10a')]=function(_0x44a785){if(_[_0x1af2('0x69')](_0x44a785)||_[_0x1af2('0xf6')](_0x44a785)||!_[_0x1af2('0x69')](_0x44a785[0x0]['Agent'])&&_[_0x1af2('0x69')](_0x44a785[0x0][_0x1af2('0x83')][_0x1af2('0x50')])){ut[_0x1af2('0x5e')](_0x1af2('0x10f'),_0x44a785);return{'isValid':![],'message':_0x1af2('0x110')};}var _0x474760=this[_0x1af2('0x12')][_0x44a785[0x0][_0x1af2('0x6c')][_0x1af2('0x50')]];_0x474760[_0x1af2('0x48')]=_0x1af2('0x9a');if(_[_0x1af2('0x69')](_0x474760)){ut[_0x1af2('0x5e')](_0x1af2('0x111'),_0x474760);return{'isValid':![],'message':_0x1af2('0x112')};}if(!this[_0x1af2('0x98')](_0x474760[_0x1af2('0x4f')])){ut[_0x1af2('0x5e')](_0x1af2('0x113'),_0x1af2('0x114')+_0x474760[_0x1af2('0x50')]+_0x1af2('0x115'));if(!this[_0x1af2('0x98')](_0x474760['TrunkBackup'])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x474760[_0x1af2('0x50')]+_0x1af2('0x116'));return{'isValid':![],'message':_0x1af2('0x117')};}}if(!ut['isActive'](_0x474760[_0x1af2('0x2f')])){ut[_0x1af2('0x5e')](_0x1af2('0x118'),_0x474760[_0x1af2('0x50')]+_0x1af2('0x119'));return{'isValid':![],'message':_0x1af2('0x114')+_0x474760['name']+_0x1af2('0x119')};}return{'isValid':!![],'message':_0x1af2('0x11a')};};Preview[_0x1af2('0xf')]['execCall']=function(_0x31f978,_0x404962,_0x58d84d,_0x4b81af){var _0x903c51=this;return new BPromise(function(_0x1ae4af,_0x2df057){var _0x3a4ae1=_0x31f978[_0x1af2('0xae')];var _0x15fdc3=_0x903c51['isTrunkReachable'](_0x404962[_0x1af2('0x4f')])?util['format'](_0x1af2('0x11b'),_0x404962[_0x1af2('0x4f')][_0x1af2('0x50')],_[_0x1af2('0x69')](_0x404962[_0x1af2('0x32')])?'':_0x404962['dialPrefix'][_0x1af2('0x11c')]()||'',_0x404962[_0x1af2('0x11d')]>0x0?_0x58d84d[_0x1af2('0xf2')][_0x1af2('0xf3')]['substring'](_0x404962[_0x1af2('0x11d')]):_0x58d84d[_0x1af2('0xf2')][_0x1af2('0xf3')]):util[_0x1af2('0x55')]('SIP/%s/%s%s',_[_0x1af2('0x69')](_0x404962[_0x1af2('0x99')])?_0x404962[_0x1af2('0x4f')][_0x1af2('0x50')]:_0x404962[_0x1af2('0x99')][_0x1af2('0x50')],_[_0x1af2('0x69')](_0x404962[_0x1af2('0x32')])?'':_0x404962[_0x1af2('0x32')]['trim']()||'',_0x404962[_0x1af2('0x11d')]>0x0?_0x58d84d[_0x1af2('0xf2')][_0x1af2('0xf3')]['substring'](_0x404962[_0x1af2('0x11d')]):_0x58d84d['Contact'][_0x1af2('0xf3')]);var _0x1da7aa=_0x903c51['isTrunkReachable'](_0x404962[_0x1af2('0x4f')])?ut[_0x1af2('0x11e')](_0x404962[_0x1af2('0x4f')][_0x1af2('0x11f')],_0x404962[_0x1af2('0x30')],_0x404962[_0x1af2('0x120')]>0x0?ut[_0x1af2('0x121')](_0x404962['dialOriginateCallerIdNumber'],_0x404962[_0x1af2('0x120')]):_0x404962[_0x1af2('0x122')]):ut['getCallerId'](_[_0x1af2('0x69')](_0x404962[_0x1af2('0x99')])?_0x404962['Trunk'][_0x1af2('0x11f')]:_0x404962['TrunkBackup']['callerid'],_0x404962[_0x1af2('0x30')],_0x404962[_0x1af2('0x120')]>0x0?ut[_0x1af2('0x121')](_0x404962[_0x1af2('0x122')],_0x404962['dialRandomLastDigitCallerIdNumber']):_0x404962[_0x1af2('0x122')]);if(_0x1da7aa){_0x31f978[_0x1af2('0x123')]=ut[_0x1af2('0x124')](_0x1da7aa);_0x31f978[_0x1af2('0x125')]=ut['extractCalleridNumber'](_0x1da7aa);}var _0x4296f5=ut['addVariables'](_0x404962,_0x58d84d,_0x15fdc3,_0x1da7aa,_0x3a4ae1,_0x31f978);_['merge'](_0x31f978,ut['toLowerVariables'](_0x4296f5));_0x31f978[_0x1af2('0x88')]=moment()[_0x1af2('0x55')](_0x1af2('0xaa'));ami[_0x1af2('0x74')](ut[_0x1af2('0x126')](_0x31f978,_0x404962,_0x4296f5,_0x31f978[_0x1af2('0xa8')],_0x4b81af))[_0x1af2('0xf8')](function(_0x4cc1f1){_0x404962[_0x1af2('0x49')]+=0x1;logger[_0x1af2('0x6b')]('[originated][increment]',_0x3a4ae1,_0x1af2('0xaf'),_0x404962[_0x1af2('0x50')],_0x1af2('0xe2'),_0x404962[_0x1af2('0x49')]);_0x1ae4af(_0x4cc1f1);})['catch'](function(_0x10628e){ut['logAgent'](_0x31f978,0xe,'OriginateError');rpcDb[_0x1af2('0xe9')](_0x31f978,_0x1af2('0x127'));_0x2df057(_0x10628e);});});};Preview[_0x1af2('0xf')][_0x1af2('0x128')]=function(_0x36e266){if(this['actions'][_0x36e266['linkedid']]){this['actions'][_0x36e266[_0x1af2('0xdf')]][_0x1af2('0x75')]=_0x36e266[_0x1af2('0x75')];}};Preview[_0x1af2('0xf')]['syncOriginateResponse']=function(_0x112929){var _0x156b83=this;var _0x521057=this[_0x1af2('0x6a')][_0x112929[_0x1af2('0x129')]];if(_0x521057){if(_0x521057[_0x1af2('0xf5')]&&this[_0x1af2('0x15')][_0x521057[_0x1af2('0xf5')]]){ut['logLookAgent'](_0x521057,this[_0x1af2('0x15')][_0x521057[_0x1af2('0xf5')]]['name'],this[_0x1af2('0x15')][_0x521057['lookAgent']]['id']);}var _0x4f0c04=_[_0x1af2('0x12a')](_0x521057);_0x4f0c04[_0x1af2('0xab')]=moment()['format'](_0x1af2('0xaa'));var _0x4a83c8=_0x156b83['campaignsPreview'][_0x521057['queue']];if(ut[_0x1af2('0x12b')](_0x112929[_0x1af2('0x12c')])){if(_0x521057[_0x1af2('0xa7')]){rpcDb['unlockContact'](_0x521057['idContact']);}if(_0x521057[_0x1af2('0xa8')]){rpcDb[_0x1af2('0x87')](_0x521057[_0x1af2('0x12d')]);}ami['emit']('custom:agentringnoanswer',ut[_0x1af2('0xb1')](_0x521057,'rejected'));this[_0x1af2('0xe4')](_0x4f0c04,_0x4a83c8,_0x112929);}else{_0x521057[_0x1af2('0x88')]=moment()[_0x1af2('0x55')](_0x1af2('0xaa'));ut[_0x1af2('0xe8')](_0x4f0c04,0x4,_0x1af2('0xb7'));rpcDb['createAgentHistory'](_0x4f0c04,_0x1af2('0x12e'));}}};Preview[_0x1af2('0xf')][_0x1af2('0x1a')]=function(_0x10699b){var _0x3df905=this;var _0x27b1c8=this['actions'][_0x10699b[_0x1af2('0xdf')]];var _0xf96857;if(_0x27b1c8){_0xf96857=this[_0x1af2('0x12')][_0x27b1c8[_0x1af2('0x6d')]];logger['info'](_0x1af2('0x12f'),_0x10699b[_0x1af2('0xdf')],_0x1af2('0xaf'),_0xf96857['name'],_0x1af2('0x6e'),_0xf96857['pTalking']);}if(this[_0x1af2('0x6a')][_0x10699b['linkedid']]&&_0x10699b[_0x1af2('0xdf')]!==_0x10699b[_0x1af2('0xae')]){if(_0x10699b[_0x1af2('0x130')]==='16'&&this['actions'][_0x10699b['linkedid']][_0x1af2('0x6f')]){this[_0x1af2('0x9b')](_0x10699b,_0x10699b['linkedid'],_0x10699b[_0x1af2('0x130')]);}else if(this[_0x1af2('0x6a')][_0x10699b[_0x1af2('0xdf')]]['dialAnswer']){logger[_0x1af2('0x6b')](_0x1af2('0x131'),_0x10699b[_0x1af2('0xdf')],_0x10699b[_0x1af2('0x130')],_0x1af2('0xaf'),_0xf96857[_0x1af2('0x50')],_0x1af2('0x6e'),_0xf96857[_0x1af2('0x59')]);this['callProgressDetectingCustomer'](_0x10699b,_0x10699b['linkedid'],_0x10699b[_0x1af2('0x130')]);}}else if(_0x27b1c8&&_[_0x1af2('0x69')](_0x27b1c8['statedesc'])&&_0xf96857[_0x1af2('0x132')]&&_0x10699b[_0x1af2('0xdf')]===_0x10699b[_0x1af2('0xae')]&&_[_0x1af2('0x69')](_0x10699b['reason'])&&_0x10699b[_0x1af2('0x130')]==='16'&&_0x10699b[_0x1af2('0x133')]==='6'&&_['isUndefined'](_0x27b1c8[_0x1af2('0x134')])){if(_0x27b1c8[_0x1af2('0xa7')]){rpcDb[_0x1af2('0x107')](_0x27b1c8[_0x1af2('0x12d')]);}if(_0x27b1c8[_0x1af2('0xa8')]){rpcDb['disableContact'](_0x27b1c8[_0x1af2('0x12d')]);}_0x10699b['reason']='22';this['callProgressDetectingAgent'](_0x27b1c8,_0xf96857,_0x10699b);}else if(_0x27b1c8&&_0x27b1c8[_0x1af2('0x134')]){if(_0x10699b[_0x1af2('0x130')]==='16'&&this[_0x1af2('0x6a')][_0x10699b[_0x1af2('0xdf')]]['dialAnswer']){logger[_0x1af2('0x6b')](_0x1af2('0x135'),_0x10699b[_0x1af2('0xdf')],_0x10699b[_0x1af2('0x130')],_0x1af2('0xaf'),_0xf96857[_0x1af2('0x50')],'pTalking:\x20',_0xf96857[_0x1af2('0x59')]);this['callProgressDetectingCustomer'](_0x10699b,_0x10699b[_0x1af2('0xdf')],_0x10699b[_0x1af2('0x130')]);}else if(this[_0x1af2('0x6a')][_0x10699b[_0x1af2('0xdf')]][_0x1af2('0x6f')]){logger[_0x1af2('0x6b')](_0x1af2('0x131'),_0x10699b['linkedid'],_0x10699b['cause'],_0x1af2('0xaf'),_0xf96857[_0x1af2('0x50')],'pTalking:\x20',_0xf96857['pTalking']);this['callProgressDetectingCustomer'](_0x10699b,_0x10699b[_0x1af2('0xdf')],_0x10699b[_0x1af2('0x130')]);}}};Preview[_0x1af2('0xf')][_0x1af2('0x1c')]=function(_0x31c80f){if(this['actions'][_0x31c80f[_0x1af2('0xe3')]]&&_0x31c80f[_0x1af2('0xe3')]!==_0x31c80f[_0x1af2('0x136')]){this[_0x1af2('0x9b')](_0x31c80f,_0x31c80f['destlinkedid'],_0x31c80f[_0x1af2('0xdd')]);}};Preview[_0x1af2('0xf')][_0x1af2('0x137')]=function(_0x56d109){if(this['actions'][_0x56d109[_0x1af2('0xdf')]]&&_0x56d109[_0x1af2('0xdf')]!==_0x56d109[_0x1af2('0xae')]&&!this[_0x1af2('0x6a')][_0x56d109[_0x1af2('0xdf')]][_0x1af2('0x6f')]){if(_0x56d109['cause']==='1'){this[_0x1af2('0x9b')](_0x56d109,_0x56d109['linkedid'],_0x56d109[_0x1af2('0x130')]);}}};Preview[_0x1af2('0xf')][_0x1af2('0x138')]=function(_0x3e7465,_0x2b05bb,_0xe843ee){if(this[_0x1af2('0x6a')][_0x3e7465]){if(_[_0x1af2('0x69')](this[_0x1af2('0x6a')][_0x3e7465][_0x1af2('0x139')])){this[_0x1af2('0x6a')][_0x3e7465][_0x1af2('0x139')]={};}this[_0x1af2('0x6a')][_0x3e7465][_0x1af2('0x139')][_0x2b05bb]=_0xe843ee;}};Preview['prototype'][_0x1af2('0x1e')]=function(_0x209834){try{if(!_[_0x1af2('0x69')](_0x209834)){if(ut[_0x1af2('0x13a')](_[_0x1af2('0x13b')](_0x209834[_0x1af2('0x13c')])[0x0])){this['addVariable'](_0x209834[_0x1af2('0xae')],_[_0x1af2('0x13b')](_0x209834[_0x1af2('0x13c')])[0x0],_0x209834[_0x1af2('0x13d')]);}}}catch(_0xd2d508){logger[_0x1af2('0x13e')]('[syncVarSet][Preview]',util[_0x1af2('0x13f')](_0xd2d508,{'showHidden':![],'depth':null}));}};Preview[_0x1af2('0xf')]['syncAttendedTransfer']=function(_0x5a9843){if(_0x5a9843){if(this[_0x1af2('0x6a')][_0x5a9843['transfertargetlinkedid']]){this[_0x1af2('0x6a')][_0x5a9843[_0x1af2('0x140')]][_0x1af2('0x134')]=!![];}}};Preview[_0x1af2('0xf')][_0x1af2('0x22')]=function(_0x354f8c){if(_0x354f8c){if(this[_0x1af2('0x6a')][_0x354f8c[_0x1af2('0x141')]]){this[_0x1af2('0x6a')][_0x354f8c['transfererlinkedid']]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x2e91=['acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','countagentrejectretry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','phone','VoiceQueueId','Contact\x20is\x20undefined','isEmpty','execCall','then','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','unlockContact','disableContact','getContactPreview','recallme','validateContact','isValid','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','Contact','substring','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','isFailure','response','custom:agentringnoanswer','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','statedesc','dialQueueProject','transfer','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','syncHangup','syncHangupRequest','dialend','bind','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','format','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','voice_queue_channel:remove','sendMessageOneNotActive','originated','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','booked','clearZombieChannels','hasOwnProperty','dialActive','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pick','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','size','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','dialAnswer','uniqueid','\x20Queue','custom:agentconnect','buildObj','connect'];(function(_0xd6e7f,_0x4e4c15){var _0x22ecaf=function(_0x1243dc){while(--_0x1243dc){_0xd6e7f['push'](_0xd6e7f['shift']());}};_0x22ecaf(++_0x4e4c15);}(_0x2e91,0x1c1));var _0x12e9=function(_0x19ac80,_0x4033f9){_0x19ac80=_0x19ac80-0x0;var _0x162659=_0x2e91[_0x19ac80];return _0x162659;};'use strict';var util=require(_0x12e9('0x0'));var _=require(_0x12e9('0x1'));var BPromise=require(_0x12e9('0x2'));var uuid=require(_0x12e9('0x3'));var moment=require(_0x12e9('0x4'));var md5=require(_0x12e9('0x5'));var Redis=require(_0x12e9('0x6'));var config=require(_0x12e9('0x7'));var logger=require(_0x12e9('0x8'))(_0x12e9('0x9'));var loggerAction=require('../../../config/logger')(_0x12e9('0xa'));var ami=require(_0x12e9('0xb'));var rpcDb=require(_0x12e9('0xc'));var Action=require(_0x12e9('0xd'));var ut=require('./util/util');config[_0x12e9('0xe')]=_[_0x12e9('0xf')](config[_0x12e9('0xe')],{'host':_0x12e9('0x10'),'port':0x18eb});var io=require(_0x12e9('0x11'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x12e9('0x12')][_0x12e9('0x13')]=function(_0x3ae63d){this[_0x12e9('0x14')]=this[_0x12e9('0x14')]?this[_0x12e9('0x14')][_0x12e9('0x15')](_0x3ae63d):_0x3ae63d();};function Preview(_0x1309a7){this['sequence']=new Sequence();this[_0x12e9('0x16')]=_0x1309a7[_0x12e9('0x17')];this[_0x12e9('0x18')]=_0x1309a7[_0x12e9('0x18')];this[_0x12e9('0x19')]={};this[_0x12e9('0x1a')]=_0x1309a7[_0x12e9('0x1a')];this['clockClearZombieChannels']=0x0;ami['on'](_0x12e9('0x1b'),this[_0x12e9('0x1c')]['bind'](this));ami['on']('hangup',this[_0x12e9('0x1d')]['bind'](this));ami['on']('hanguprequest',this[_0x12e9('0x1e')]['bind'](this));ami['on'](_0x12e9('0x1f'),this['syncDialEnd'][_0x12e9('0x20')](this));ami['on'](_0x12e9('0x21'),this[_0x12e9('0x22')][_0x12e9('0x20')](this));ami['on'](_0x12e9('0x23'),this[_0x12e9('0x24')][_0x12e9('0x20')](this));ami['on'](_0x12e9('0x25'),this[_0x12e9('0x26')][_0x12e9('0x20')](this));ami['on']('blindtransfer',this[_0x12e9('0x27')][_0x12e9('0x20')](this));this[_0x12e9('0x28')](this['campaignsPreview']);}function emit(_0x51c3e6,_0x362654,_0x351262){io['to'](_0x51c3e6)[_0x12e9('0x29')](_0x362654,_0x351262);}function emitCampaignPreview(_0x393ce6){if(_0x393ce6[_0x12e9('0x2a')]===_0x12e9('0x2b')){var _0x2cb75a={'id':_0x393ce6['id'],'name':_0x393ce6['name'],'strategy':_0x393ce6['strategy'],'answered':_0x393ce6[_0x12e9('0x2c')],'available':_0x393ce6[_0x12e9('0x2d')],'loggedIn':_0x393ce6[_0x12e9('0x2e')],'pTalking':_0x393ce6[_0x12e9('0x2f')],'sumBillable':_0x393ce6[_0x12e9('0x30')],'sumDuration':_0x393ce6[_0x12e9('0x31')],'sumHoldTime':_0x393ce6[_0x12e9('0x32')]||0x0,'talking':_0x393ce6[_0x12e9('0x33')],'total':_0x393ce6[_0x12e9('0x34')],'type':_0x393ce6['type'],'unmanaged':_0x393ce6[_0x12e9('0x35')],'abandoned':_0x393ce6['abandoned'],'waiting':_0x393ce6[_0x12e9('0x36')],'loggedInDb':_0x393ce6[_0x12e9('0x37')],'dialActive':_0x393ce6['dialActive'],'dialMethod':_0x393ce6[_0x12e9('0x38')],'dialOriginateCallerIdName':_0x393ce6[_0x12e9('0x39')],'dialOriginateCallerIdNumber':_0x393ce6[_0x12e9('0x3a')],'dialOriginateTimeout':_0x393ce6['dialOriginateTimeout'],'dialPrefix':_0x393ce6[_0x12e9('0x3b')],'outboundAnswerAgiCallsDay':_0x393ce6[_0x12e9('0x3c')],'outboundAnswerCallsDay':_0x393ce6[_0x12e9('0x3d')],'outboundBlacklistCallsDay':_0x393ce6[_0x12e9('0x3e')],'outboundBusyCallsDay':_0x393ce6['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x393ce6[_0x12e9('0x3f')],'outboundDropCallsDayACS':_0x393ce6['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x393ce6[_0x12e9('0x40')],'outboundDropCallsDayTimeout':_0x393ce6[_0x12e9('0x41')],'outboundNoAnswerCallsDay':_0x393ce6['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x393ce6[_0x12e9('0x42')],'outboundOriginateFailureCallsDay':_0x393ce6[_0x12e9('0x43')],'outboundReCallsDay':_0x393ce6['outboundReCallsDay'],'outboundRejectCallsDay':_0x393ce6[_0x12e9('0x44')],'outboundUnknownCallsDay':_0x393ce6[_0x12e9('0x45')],'outboundAbandonedCallsDay':_0x393ce6[_0x12e9('0x46')],'predictiveIntervalAnsweredCalls':_0x393ce6['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x393ce6[_0x12e9('0x47')],'predictiveIntervalAvgTalktime':_0x393ce6['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x393ce6[_0x12e9('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x393ce6[_0x12e9('0x49')],'predictiveIntervalErlangCalls':_0x393ce6[_0x12e9('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0x393ce6['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x393ce6[_0x12e9('0x4b')],'predictiveIntervalMultiplicativeFactor':_0x393ce6[_0x12e9('0x4c')],'predictiveIntervalPauses':_0x393ce6[_0x12e9('0x4d')],'predictiveIntervalAvailable':_0x393ce6['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x393ce6[_0x12e9('0x4e')],'message':_0x393ce6[_0x12e9('0x4f')],'originated':_0x393ce6['originated'],'erlangCalls':_0x393ce6[_0x12e9('0x50')],'erlangCallToSecond':_0x393ce6['erlangCallToSecond'],'erlangAbandonmentRate':_0x393ce6['erlangAbandonmentRate'],'erlangBusyFactor':_0x393ce6[_0x12e9('0x51')],'startPredictive':_0x393ce6[_0x12e9('0x52')],'startProgressive':_0x393ce6[_0x12e9('0x53')]};if(_0x393ce6[_0x12e9('0x54')]){_0x2cb75a[_0x12e9('0x54')]={'id':_0x393ce6[_0x12e9('0x54')]['id'],'name':_0x393ce6['Trunk'][_0x12e9('0x55')],'active':_0x393ce6[_0x12e9('0x54')][_0x12e9('0x56')],'callerid':_0x393ce6['Trunk'][_0x12e9('0x57')]};}if(_0x393ce6[_0x12e9('0x58')]){_0x2cb75a[_0x12e9('0x58')]={'id':_0x393ce6[_0x12e9('0x58')]['id'],'name':_0x393ce6[_0x12e9('0x58')][_0x12e9('0x55')]};}var _0x53d40b=md5(JSON['stringify'](_0x2cb75a));if(_0x393ce6[_0x12e9('0x5')]!==_0x53d40b){_0x393ce6[_0x12e9('0x5')]=_0x53d40b;emit(util[_0x12e9('0x59')]('voice:queue:%s',_0x2cb75a['name']),_0x12e9('0x5a'),_0x2cb75a);}}}function emitVoiceQueueChannelRemove(_0x415db1){logger[_0x12e9('0x5b')](_0x12e9('0x5c'),JSON[_0x12e9('0x5d')](_0x415db1));emit(util['format'](_0x12e9('0x5e'),_0x415db1[_0x12e9('0x55')]),_0x12e9('0x5f'),_0x415db1);}function notSendMessagesQueue(_0x374faf){if(_0x374faf[_0x12e9('0x60')]){if(_0x374faf[_0x12e9('0x61')]===0x0&&_0x374faf[_0x12e9('0x2f')]===0x0){_0x374faf['sendMessageOneNotActive']=![];_0x374faf[_0x12e9('0x2d')]=0x0;_0x374faf[_0x12e9('0x62')]=0x0;_0x374faf[_0x12e9('0x4f')]=_0x12e9('0x63');ut[_0x12e9('0x64')](_0x12e9('0x65'),_0x374faf[_0x12e9('0x55')]+'\x20is\x20not\x20active');}else{_0x374faf[_0x12e9('0x4f')]='IS_DISACTIVED';ut[_0x12e9('0x64')](_0x12e9('0x65'),_0x374faf[_0x12e9('0x55')]+_0x12e9('0x66'));}emitCampaignPreview(_0x374faf);}}Preview['prototype'][_0x12e9('0x28')]=function(){var _0x31434f=this;setInterval(function(){_0x31434f['syncCampaigns']();},0x7cf);};Preview[_0x12e9('0x12')][_0x12e9('0x67')]=function(){var _0x17fb56=this[_0x12e9('0x16')];this[_0x12e9('0x68')]+=0x1;for(var _0x453496 in _0x17fb56){if(_0x17fb56['hasOwnProperty'](_0x453496)&&(_0x17fb56[_0x453496][_0x12e9('0x38')]===_0x12e9('0x9')||_0x17fb56[_0x453496][_0x12e9('0x38')]===_0x12e9('0x69'))&&_0x17fb56[_0x453496][_0x12e9('0x2a')]===_0x12e9('0x2b')){if(this['clockClearZombieChannels']>0x7){this[_0x12e9('0x68')]=0x0;this[_0x12e9('0x6a')]();}}if(_0x17fb56[_0x12e9('0x6b')](_0x453496)&&_0x17fb56[_0x453496]['dialMethod']===_0x12e9('0x9')&&_0x17fb56[_0x453496][_0x12e9('0x2a')]===_0x12e9('0x2b')){if(_0x17fb56[_0x453496][_0x12e9('0x6c')]){this[_0x12e9('0x6d')](_0x17fb56[_0x453496]);this[_0x12e9('0x6e')](_0x17fb56[_0x453496]);}else{notSendMessagesQueue(_0x17fb56[_0x453496]);}}}};Preview[_0x12e9('0x12')][_0x12e9('0x6f')]=function(_0x4c291b){var _0xc22487=this;this['sequence']['enqueue'](function(){if(!_[_0x12e9('0x70')](_0xc22487[_0x12e9('0x19')][_0x4c291b])){loggerAction[_0x12e9('0x5b')](_0x12e9('0x71'),_0x4c291b,_0x12e9('0x72'),_0xc22487['actions'][_0x4c291b][_0x12e9('0x73')],_0x12e9('0x74'),JSON[_0x12e9('0x5d')](_0xc22487[_0x12e9('0x16')][_0xc22487['actions'][_0x4c291b][_0x12e9('0x73')]][_0x12e9('0x61')]),_0x12e9('0x75'),JSON[_0x12e9('0x5d')](_0xc22487[_0x12e9('0x16')][_0xc22487[_0x12e9('0x19')][_0x4c291b]['queue']][_0x12e9('0x2f')]),JSON[_0x12e9('0x5d')](_0xc22487[_0x12e9('0x19')][_0x4c291b]['dialAnswer']),JSON['stringify'](_[_0x12e9('0x76')](_0xc22487[_0x12e9('0x19')][_0x4c291b],['contactId','UserId','VoiceQueueId',_0x12e9('0x77')])));return ami[_0x12e9('0x78')]({'action':_0x12e9('0x79'),'channel':_0xc22487[_0x12e9('0x19')][_0x4c291b][_0x12e9('0x7a')]})[_0x12e9('0x7b')](function(_0x448cb6){if(_0x448cb6[_0x12e9('0x4f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0xc22487['actions'][_0x4c291b]){ut[_0x12e9('0x7c')](_0xc22487[_0x12e9('0x16')][_0xc22487[_0x12e9('0x19')][_0x4c291b][_0x12e9('0x73')]],_0x12e9('0x7d'));if(_0xc22487[_0x12e9('0x19')][_0x4c291b]['dialAnswer']===!![]){ut[_0x12e9('0x7e')](_0xc22487['campaignsPreview'][_0xc22487[_0x12e9('0x19')][_0x4c291b][_0x12e9('0x73')]],_0x12e9('0x7d'));ut[_0x12e9('0x7f')](_0x12e9('0x80')+_0x4c291b,_0xc22487[_0x12e9('0x19')][_0x4c291b][_0x12e9('0x73')]);}ut[_0x12e9('0x7f')]('[Dialer][checkChannel][Preview]'+_0x4c291b,_0xc22487[_0x12e9('0x19')][_0x4c291b][_0x12e9('0x73')]);delete _0xc22487[_0x12e9('0x19')][_0x4c291b];}},0x2328);}});}});};Preview['prototype'][_0x12e9('0x6a')]=function(){var _0x37eca9=this;loggerAction[_0x12e9('0x5b')]('[action]',_[_0x12e9('0x81')](this[_0x12e9('0x19')]));for(var _0x3d5380 in this['actions']){if(_0x37eca9[_0x12e9('0x19')]['hasOwnProperty'](_0x3d5380)){_0x37eca9[_0x12e9('0x6f')](_0x3d5380);}}};Preview[_0x12e9('0x12')]['recallMe']=function(_0x2cdcef){var _0x483d41=this;rpcDb[_0x12e9('0x82')](_0x2cdcef['id'],ut[_0x12e9('0x83')](this[_0x12e9('0x1a')]))['then'](function(_0x56355e){if(!_['isNil'](_0x56355e)){for(var _0xf0e915=0x0;_0xf0e915<_0x56355e[_0x12e9('0x84')];_0xf0e915+=0x1){if(ut[_0x12e9('0x85')](_0x56355e[_0xf0e915][_0x12e9('0x86')])<_0x2cdcef[_0x12e9('0x87')]*0x3c){if(_0x56355e[_0xf0e915][_0x12e9('0x88')]&&!_0x56355e[_0xf0e915][_0x12e9('0x88')][_0x12e9('0x89')]){_0x483d41[_0x12e9('0x8a')](_0x56355e[_0xf0e915]['id'])['then'](ut[_0x12e9('0x8b')](_0x12e9('0x8c')))[_0x12e9('0x7b')](ut['logger2']('[RecallMe]'));}else{rpcDb['disableContact'](_0x56355e[_0xf0e915]['id']);}}else{var _0x38fe58=new Action(_0x56355e[_0xf0e915],_0x2cdcef);_0x38fe58[_0x12e9('0x8d')]=moment()[_0x12e9('0x59')](_0x12e9('0x8e'));_0x2cdcef['outboundReCallsDay']+=0x1;ut[_0x12e9('0x8f')](_0x38fe58,0x17,_0x12e9('0x90'));if(_0x2cdcef[_0x12e9('0x91')]){rpcDb[_0x12e9('0x92')](ut['createBody'](_0x56355e[_0xf0e915]));rpcDb[_0x12e9('0x93')](_0x38fe58,_0x12e9('0x94'));}else{ut[_0x12e9('0x8f')](_0x38fe58,0x16,_0x12e9('0x95'));rpcDb[_0x12e9('0x93')](_0x38fe58,_0x12e9('0x96'));rpcDb[_0x12e9('0x97')](_0x38fe58,_0x12e9('0x96'));}}}}})[_0x12e9('0x7b')](ut['logger2'](_0x12e9('0x98')));};Preview['prototype'][_0x12e9('0x6d')]=function(_0x1fbb1f){_0x1fbb1f['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x1fbb1f['loggedIn'])){_0x1fbb1f['message']=_0x12e9('0x99');}else if(!ut[_0x12e9('0x9a')](_0x1fbb1f[_0x12e9('0x6c')])){_0x1fbb1f['message']=_0x12e9('0x63');}else if(!this[_0x12e9('0x9b')](_0x1fbb1f[_0x12e9('0x54')])){if(!this[_0x12e9('0x9b')](_0x1fbb1f[_0x12e9('0x9c')])){_0x1fbb1f[_0x12e9('0x4f')]=_0x12e9('0x9d');}else{_0x1fbb1f['message']=_0x12e9('0x9e');}}else{_0x1fbb1f['message']=_0x12e9('0x9e');}emitCampaignPreview(_0x1fbb1f);};Preview[_0x12e9('0x12')][_0x12e9('0x9f')]=function(_0x213597,_0x5d1d71,_0x27911f){var _0x5a8590=this;var _0x1b23fd=this[_0x12e9('0x19')][_0x5d1d71];var _0x5d9fbf=this[_0x12e9('0x16')][_0x1b23fd[_0x12e9('0x73')]];var _0x2dcf17;if(_0x5d9fbf){switch(_0x27911f){case'1':_0x5d9fbf['outboundNoSuchCallsDay']+=0x1;_0x1b23fd[_0x12e9('0xa0')]+=0x1;_0x1b23fd[_0x12e9('0xa1')]=ut[_0x12e9('0xa2')](_0x1b23fd);ut[_0x12e9('0x8f')](_0x1b23fd,0x0,_0x12e9('0xa3'));rpcDb[_0x12e9('0x93')](_0x1b23fd,_0x12e9('0xa4'));if(ut['totalGlobal'](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut[_0x12e9('0xa6')](_0x1b23fd,0xf,_0x12e9('0xa7'));rpcDb['createCustomerFinal'](_0x2dcf17,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x1b23fd[_0x12e9('0xa0')]>=_0x5d9fbf['dialNoSuchNumberMaxRetry']){rpcDb['createCustomerFinal'](_0x1b23fd,_0x12e9('0xa8'));}else{rpcDb[_0x12e9('0xa9')](ut['scheduledAt'](_0x1b23fd,'countnosuchnumberretry',_0x5d9fbf[_0x12e9('0xaa')]),_0x1b23fd[_0x12e9('0xab')],_0x1b23fd[_0x12e9('0xac')]);}}delete this[_0x12e9('0x19')][_0x213597['linkedid']];break;case'ANSWER':var _0x34386e=moment()[_0x12e9('0x59')](_0x12e9('0x8e'));_0x1b23fd['responsetime']=_0x34386e;_0x1b23fd['answertime']=_0x34386e;_0x1b23fd[_0x12e9('0xad')]=!![];_0x5d9fbf['pTalking']+=0x1;logger[_0x12e9('0x5b')]('[syncHangup][talking][increment]',_0x1b23fd[_0x12e9('0xae')],_0x12e9('0xaf'),_0x5d9fbf['name'],_0x12e9('0x75'),_0x5d9fbf[_0x12e9('0x2f')]);ami[_0x12e9('0x29')](_0x12e9('0xb0'),ut[_0x12e9('0xb1')](_0x1b23fd,_0x12e9('0xb2')));if(_0x5d9fbf[_0x12e9('0xb3')]){ami[_0x12e9('0x29')](_0x12e9('0xb4'),ut[_0x12e9('0xb5')](_0x1b23fd));}break;case'16':ami['emit'](_0x12e9('0xb6'),ut[_0x12e9('0xb1')](_0x1b23fd,_0x12e9('0xb7')));emitVoiceQueueChannelRemove(ut[_0x12e9('0xb1')](_0x1b23fd,'complete'));_0x5d9fbf['outboundAnswerCallsDay']+=0x1;_0x5d9fbf[_0x12e9('0x34')]+=0x1;_0x5d9fbf[_0x12e9('0x2c')]+=0x1;ut['decrementTalkink'](_0x5d9fbf,'[16]');_0x1b23fd[_0x12e9('0xa1')]=ut['totalGlobal'](_0x1b23fd);ut[_0x12e9('0x8f')](_0x1b23fd,0x4,_0x12e9('0xb8'));rpcDb[_0x12e9('0x93')](_0x1b23fd,_0x12e9('0xb9'));rpcDb[_0x12e9('0x97')](_0x1b23fd,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x12e9('0xba')](_0x1b23fd);_0x5d9fbf[_0x12e9('0x31')]+=_0x1b23fd[_0x12e9('0xbb')];_0x5d9fbf[_0x12e9('0x30')]+=_0x1b23fd[_0x12e9('0xbb')];logger[_0x12e9('0x5b')](_0x12e9('0xbc'),_0x1b23fd[_0x12e9('0xae')],'\x20Queue',_0x5d9fbf['name'],'pTalking:\x20',_0x5d9fbf[_0x12e9('0x2f')]);delete this[_0x12e9('0x19')][_0x213597[_0x12e9('0xbd')]];break;case _0x12e9('0xbe'):_0x5d9fbf[_0x12e9('0xbf')]+=0x1;_0x1b23fd[_0x12e9('0xc0')]+=0x1;_0x1b23fd['countglobal']=ut[_0x12e9('0xa2')](_0x1b23fd);ut[_0x12e9('0x8f')](_0x1b23fd,0x5,'Busy');rpcDb[_0x12e9('0x93')](_0x1b23fd,_0x12e9('0xc1'));if(ut[_0x12e9('0xa2')](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut[_0x12e9('0xa6')](_0x1b23fd,0xf,_0x12e9('0xa7'));rpcDb[_0x12e9('0x97')](_0x2dcf17,_0x12e9('0xc2'));}else{if(_0x1b23fd[_0x12e9('0xc0')]>=_0x5d9fbf[_0x12e9('0xc3')]){rpcDb['createCustomerFinal'](_0x1b23fd,_0x12e9('0xc1'));}else{rpcDb[_0x12e9('0xa9')](ut[_0x12e9('0xc4')](_0x1b23fd,'countbusyretry',_0x5d9fbf[_0x12e9('0xc5')]),_0x1b23fd['unlockAgent'],_0x1b23fd[_0x12e9('0xac')]);}}break;case _0x12e9('0xc6'):_0x5d9fbf[_0x12e9('0xc7')]+=0x1;_0x1b23fd[_0x12e9('0xc8')]+=0x1;_0x1b23fd[_0x12e9('0xa1')]=ut['totalGlobal'](_0x1b23fd);ut['logCustomer'](_0x1b23fd,0x3,_0x12e9('0xc9'));rpcDb[_0x12e9('0x93')](_0x1b23fd,_0x12e9('0xca'));if(ut[_0x12e9('0xa2')](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut[_0x12e9('0xa6')](_0x1b23fd,0xf,'Global');rpcDb[_0x12e9('0x97')](_0x2dcf17,_0x12e9('0xcb'));}else{if(_0x1b23fd[_0x12e9('0xc8')]>=_0x5d9fbf['dialNoAnswerMaxRetry']){rpcDb[_0x12e9('0x97')](_0x1b23fd,_0x12e9('0xca'));}else{rpcDb['rescheduleContact'](ut[_0x12e9('0xc4')](_0x1b23fd,'countnoanswerretry',_0x5d9fbf[_0x12e9('0xcc')]),_0x1b23fd[_0x12e9('0xab')],_0x1b23fd[_0x12e9('0xac')]);}}break;case _0x12e9('0xcd'):_0x5d9fbf[_0x12e9('0x3f')]+=0x1;_0x1b23fd[_0x12e9('0xce')]+=0x1;_0x1b23fd[_0x12e9('0xa1')]=ut[_0x12e9('0xa2')](_0x1b23fd);ut['logCustomer'](_0x1b23fd,0x8,_0x12e9('0xcf'));rpcDb[_0x12e9('0x93')](_0x1b23fd,_0x12e9('0xd0'));if(ut[_0x12e9('0xa2')](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut[_0x12e9('0xa6')](_0x1b23fd,0xf,_0x12e9('0xa7'));rpcDb[_0x12e9('0x97')](_0x2dcf17,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x1b23fd[_0x12e9('0xce')]>=_0x5d9fbf[_0x12e9('0xd1')]){rpcDb['createCustomerFinal'](_0x1b23fd,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x12e9('0xa9')](ut[_0x12e9('0xc4')](_0x1b23fd,_0x12e9('0xce'),_0x5d9fbf['dialBusyRetryFrequency']),_0x1b23fd[_0x12e9('0xab')],_0x1b23fd['activeContact']);}}break;case'CANCEL':_0x5d9fbf[_0x12e9('0x44')]+=0x1;_0x1b23fd[_0x12e9('0xd2')]+=0x1;_0x1b23fd['countglobal']=ut[_0x12e9('0xa2')](_0x1b23fd);ut['logCustomer'](_0x1b23fd,0x14,'AgentReject');rpcDb[_0x12e9('0x93')](_0x1b23fd,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut['cloneAction'](_0x1b23fd,0x14,'AgentReject');rpcDb[_0x12e9('0x97')](_0x2dcf17,_0x12e9('0xd3'));}else{if(_0x1b23fd[_0x12e9('0xd2')]>=_0x5d9fbf[_0x12e9('0xd4')]){rpcDb[_0x12e9('0x97')](_0x1b23fd,_0x12e9('0xd3'));}else{rpcDb[_0x12e9('0xa9')](ut['scheduledAt'](_0x1b23fd,_0x12e9('0xd2'),_0x5d9fbf[_0x12e9('0xd5')]),_0x1b23fd[_0x12e9('0xab')],_0x1b23fd['activeContact']);}}break;case _0x12e9('0xd6'):_0x5d9fbf[_0x12e9('0x46')]+=0x1;_0x1b23fd[_0x12e9('0xd7')]+=0x1;_0x1b23fd[_0x12e9('0xa1')]=ut[_0x12e9('0xa2')](_0x1b23fd);ut[_0x12e9('0x8f')](_0x1b23fd,0xb,_0x12e9('0xd8'));rpcDb['createCustomerHistory'](_0x1b23fd,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x12e9('0xa2')](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut['cloneAction'](_0x1b23fd,0xf,_0x12e9('0xa7'));rpcDb[_0x12e9('0x97')](_0x2dcf17,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x1b23fd[_0x12e9('0xd9')]>=_0x5d9fbf[_0x12e9('0xda')]){rpcDb[_0x12e9('0x97')](_0x1b23fd,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x12e9('0xa9')](ut['scheduledAt'](_0x1b23fd,_0x12e9('0xd7'),_0x5d9fbf[_0x12e9('0xdb')]),_0x1b23fd[_0x12e9('0xab')],_0x1b23fd['activeContact']);}}break;default:if(_0x1b23fd[_0x12e9('0xad')]){ut[_0x12e9('0x7e')](_0x5d9fbf,'[default]');ut[_0x12e9('0x7f')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x5d9fbf[_0x12e9('0x55')],_0x213597);}_0x5d9fbf[_0x12e9('0x45')]+=0x1;_0x1b23fd[_0x12e9('0xa1')]=ut[_0x12e9('0xa2')](_0x1b23fd);ut[_0x12e9('0x8f')](_0x1b23fd,0xc,_0x213597[_0x12e9('0xdc')]||_0x213597[_0x12e9('0xdd')]);rpcDb[_0x12e9('0x93')](_0x1b23fd,'[callProgressDetectingCustomer][logUnknown]');if(ut['totalGlobal'](_0x1b23fd)>=_0x5d9fbf[_0x12e9('0xa5')]){_0x2dcf17=ut['cloneAction'](_0x1b23fd,0xf,_0x12e9('0xa7'));rpcDb['createCustomerFinal'](_0x2dcf17,_0x12e9('0xde'));}else{rpcDb[_0x12e9('0x97')](_0x1b23fd,_0x12e9('0xde'));}delete this[_0x12e9('0x19')][_0x213597[_0x12e9('0xbd')]];}if(!(_0x1b23fd[_0x12e9('0xad')]&&_0x27911f==='16')){ut[_0x12e9('0x7c')](_0x5d9fbf,_0x12e9('0xdf'));logger['info'](_0x12e9('0xe0'),_0x1b23fd[_0x12e9('0xae')],_0x12e9('0xaf'),_0x5d9fbf[_0x12e9('0x55')],'originated:\x20',_0x5d9fbf[_0x12e9('0x61')]);}if(_0x27911f!=='ANSWER'){delete this[_0x12e9('0x19')][_0x213597[_0x12e9('0xbd')]];delete this[_0x12e9('0x19')][_0x213597[_0x12e9('0xe1')]];}}};Preview[_0x12e9('0x12')]['callProgressDetectingAgent']=function(_0xc3ce96,_0x558f00,_0x34e225){if(_['isUndefined'](_0x558f00)&&'object'!==typeof _0x558f00){return;}if(_[_0x12e9('0xe2')](_0x34e225)&&_0x12e9('0xe3')!==typeof _0x34e225){return;}switch(_0x34e225[_0x12e9('0xe4')]){case'0':ut[_0x12e9('0xe5')](_0xc3ce96,0x0,_0x12e9('0xa3'));rpcDb[_0x12e9('0xe6')](_0xc3ce96,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut['logAgent'](_0xc3ce96,0x3,_0x12e9('0xc9'));rpcDb[_0x12e9('0xe6')](_0xc3ce96,_0x12e9('0xe7'));break;case'5':ut[_0x12e9('0xe5')](_0xc3ce96,0x5,'Busy');rpcDb[_0x12e9('0xe6')](_0xc3ce96,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x12e9('0xe5')](_0xc3ce96,0x8,'Congestion');rpcDb['createAgentHistory'](_0xc3ce96,_0x12e9('0xe8'));break;case'22':ut[_0x12e9('0xe5')](_0xc3ce96,0x16,'AnswerAGI');rpcDb[_0x12e9('0xe6')](_0xc3ce96,_0x12e9('0xe9'));break;default:ut[_0x12e9('0xe5')](_0xc3ce96,0xc,_0x34e225[_0x12e9('0xe4')]);rpcDb[_0x12e9('0xe6')](_0xc3ce96,'[callProgressDetectingAgent][logCongestion]');}ut['updateOriginated'](_0x558f00,_0x12e9('0xea'));logger['info'](_0x12e9('0xeb'),_0xc3ce96[_0x12e9('0xae')],_0x12e9('0xaf'),_0x558f00[_0x12e9('0x55')],_0x12e9('0x74'),_0x558f00[_0x12e9('0x61')]);delete this[_0x12e9('0x19')][_0xc3ce96[_0x12e9('0xae')]];};Preview[_0x12e9('0x12')][_0x12e9('0xec')]=function(_0x99224d,_0x12e31a,_0x1b8262,_0x36ba18,_0xa7248f){var _0x3f5f75=this;return new BPromise(function(_0x185aec,_0xa65547){if(_['isNil'](_0x12e31a)||_[_0x12e9('0x70')](_0x12e31a['Contact'])||_[_0x12e9('0x70')](_0x12e31a['Contact'][_0x12e9('0xed')])||_[_0x12e9('0x70')](_0x12e31a[_0x12e9('0xee')])){_0xa65547(ut[_0x12e9('0x4f')](_0x12e9('0xef'),_0x36ba18,_0xa7248f));return;}var _0x1df2b6=uuid['v4']();var _0x34bd52=_0x3f5f75[_0x12e9('0x16')][_0x12e31a[_0x12e9('0x72')]['name']];var _0x5b3d32=_0x1b8262?_0x3f5f75[_0x12e9('0x1a')][_0x1b8262]['id']:undefined;_0x3f5f75['actions'][_0x1df2b6]=new Action(_0x12e31a,_0x34bd52,_0x1df2b6,_0x1b8262,_0x5b3d32);var _0x134269=_0x3f5f75[_0x12e9('0x19')][_0x1df2b6];_0x134269[_0x12e9('0xab')]=_0x36ba18;_0x134269[_0x12e9('0xac')]=_0xa7248f;_0x134269['lookAgent']=_0x1b8262;if(_[_0x12e9('0xf0')](_0x99224d)){_0x3f5f75[_0x12e9('0xf1')](_0x134269,_0x34bd52,_0x12e31a,_0x1b8262)[_0x12e9('0xf2')](function(_0x56bef2){logger['info']('[Preview][execCall][success]',_0x12e9('0xf3')+_0x134269[_0x12e9('0x73')]+_0x12e9('0xf4')+_0x134269[_0x12e9('0xf5')],JSON['stringify'](_0x56bef2));ami[_0x12e9('0x29')](_0x12e9('0xf6'),ut[_0x12e9('0xb1')](_0x134269,_0x12e9('0xf7')));_0x185aec(ut[_0x12e9('0x4f')](_0x12e9('0xf8')));})[_0x12e9('0x7b')](function(_0x4650ff){ut[_0x12e9('0x64')](_0x12e9('0xf9'),_0x4650ff);_0xa65547(ut['message']('Call\x20failed',_0x36ba18,_0xa7248f));});}else{_0x34bd52[_0x12e9('0x3e')]+=0x1;ut[_0x12e9('0xfa')](_0x134269);rpcDb[_0x12e9('0xfb')](_0x134269,'[Blacklist][error]');delete _0x3f5f75[_0x12e9('0x19')][_0x1df2b6];_0xa65547(ut['message'](_0x12e9('0xfc'),_0x36ba18,_0xa7248f));}});};Preview[_0x12e9('0x12')][_0x12e9('0x9b')]=function(_0x2a4d1a){return!_[_0x12e9('0x70')](_0x2a4d1a)&&!_[_0x12e9('0x70')](_0x2a4d1a[_0x12e9('0x55')])&&!_['isNil'](_0x2a4d1a[_0x12e9('0x56')])&&_0x2a4d1a[_0x12e9('0x56')]&&!_['isNil'](this[_0x12e9('0x18')][util['format'](_0x12e9('0xfd'),_0x2a4d1a[_0x12e9('0x55')])])&&!_[_0x12e9('0x70')](this['trunks'][util[_0x12e9('0x59')]('SIP/%s',_0x2a4d1a[_0x12e9('0x55')])]['status'])&&(this[_0x12e9('0x18')][util[_0x12e9('0x59')](_0x12e9('0xfd'),_0x2a4d1a['name'])][_0x12e9('0x79')]==='reachable'||this[_0x12e9('0x18')][util[_0x12e9('0x59')](_0x12e9('0xfd'),_0x2a4d1a[_0x12e9('0x55')])][_0x12e9('0x79')]===_0x12e9('0xfe'));};Preview[_0x12e9('0x12')]['run']=function(_0x1357f7,_0x20a846){var _0xae93d9=this;return new BPromise(function(_0x1b6e70,_0x2fbf24){_0xae93d9[_0x12e9('0xff')](_0x1357f7,_0x20a846)[_0x12e9('0xf2')](function(_0x12337b){_0x1b6e70(_[_0x12e9('0x76')](_0x12337b,[_0x12e9('0x4f')]));})[_0x12e9('0x7b')](function(_0x449a9e){if(_0x449a9e['unlock']){rpcDb[_0x12e9('0x100')](_0x1357f7);}if(_0x449a9e[_0x12e9('0x56')]){rpcDb[_0x12e9('0x101')](_0x1357f7);}_0x2fbf24(_[_0x12e9('0x76')](_0x449a9e,[_0x12e9('0x4f')]));});});};Preview['prototype'][_0x12e9('0xff')]=function(_0x4eb0be,_0x1d321a){var _0x1c97dd=this;return new BPromise(function(_0x27bcdf,_0xd197e0){var _0x512789,_0x954682;rpcDb[_0x12e9('0x102')](_0x4eb0be)[_0x12e9('0xf2')](function(_0x5b4d53){if(!_[_0x12e9('0x70')](_0x5b4d53[0x0])){_0x954682=_0x5b4d53[0x0][_0x12e9('0x103')]?![]:!![];_0x512789=_0x5b4d53[0x0]['recallme']?!![]:![];_0x512789=_0x1d321a?!![]:_0x512789;}var _0x30c2fb=_0x1c97dd[_0x12e9('0x104')](_0x5b4d53);if(_0x30c2fb[_0x12e9('0x105')]){rpcDb['checkIsBlackList'](_[_0x12e9('0x76')](_0x5b4d53[0x0],[_0x12e9('0xee'),_0x12e9('0x106')]))['then'](function(_0x51576c){_0x1c97dd['checkInBlack'](_0x51576c,_0x5b4d53[0x0],_0x1d321a,_0x954682,_0x512789)[_0x12e9('0xf2')](function(_0x44e7d5){_0x27bcdf(_0x44e7d5);})[_0x12e9('0x7b')](function(_0x3c23f9){_0xd197e0(_0x3c23f9);});})[_0x12e9('0x7b')](function(_0x793e1c){ut[_0x12e9('0x64')](_0x12e9('0x107'),_0x793e1c);_0xd197e0(ut[_0x12e9('0x4f')](_0x12e9('0x108'),_0x954682,_0x512789));});}else{_0xd197e0(ut[_0x12e9('0x4f')](_0x30c2fb['message'],_0x954682,_0x512789));}})[_0x12e9('0x7b')](function(_0x55cf6e){ut[_0x12e9('0x64')](_0x12e9('0x109'),_0x55cf6e);_0xd197e0(ut[_0x12e9('0x4f')](_0x12e9('0x108'),![],!![]));});});};Preview[_0x12e9('0x12')][_0x12e9('0x104')]=function(_0x1b4ac4){if(_[_0x12e9('0x70')](_0x1b4ac4)||_[_0x12e9('0xf0')](_0x1b4ac4)||!_[_0x12e9('0x70')](_0x1b4ac4[0x0][_0x12e9('0x88')])&&_[_0x12e9('0x70')](_0x1b4ac4[0x0][_0x12e9('0x88')][_0x12e9('0x55')])){ut['logger']('[Preview][validateContact][Empty\x20Contact]',_0x1b4ac4);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2e545b=this['campaignsPreview'][_0x1b4ac4[0x0][_0x12e9('0x72')]['name']];_0x2e545b['message']=_0x12e9('0x9e');if(_[_0x12e9('0x70')](_0x2e545b)){ut[_0x12e9('0x64')]('[Preview][validateContact][Empty\x20Campaign]',_0x2e545b);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x2e545b['Trunk'])){ut['logger'](_0x12e9('0x10a'),_0x12e9('0x10b')+_0x2e545b[_0x12e9('0x55')]+_0x12e9('0x10c'));if(!this['isTrunkReachable'](_0x2e545b[_0x12e9('0x9c')])){ut['logger'](_0x12e9('0x10a'),_0x2e545b['name']+_0x12e9('0x10d'));return{'isValid':![],'message':_0x12e9('0x10e')};}}if(!ut[_0x12e9('0x9a')](_0x2e545b[_0x12e9('0x6c')])){ut[_0x12e9('0x64')]('[Preview][validateContact][Campaign\x20Active]',_0x2e545b[_0x12e9('0x55')]+_0x12e9('0x10f'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x2e545b[_0x12e9('0x55')]+_0x12e9('0x10f')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x12e9('0x12')][_0x12e9('0xf1')]=function(_0x18aaff,_0x1f79fa,_0x703d87,_0x264863){var _0x3ec9cf=this;return new BPromise(function(_0x1e922a,_0x1aebb4){var _0xfd4f8b=_0x18aaff[_0x12e9('0xae')];var _0x269420=_0x3ec9cf[_0x12e9('0x9b')](_0x1f79fa['Trunk'])?util[_0x12e9('0x59')](_0x12e9('0x110'),_0x1f79fa['Trunk'][_0x12e9('0x55')],_[_0x12e9('0x70')](_0x1f79fa['dialPrefix'])?'':_0x1f79fa['dialPrefix'][_0x12e9('0x111')]()||'',_0x1f79fa[_0x12e9('0x112')]>0x0?_0x703d87[_0x12e9('0x113')][_0x12e9('0xed')][_0x12e9('0x114')](_0x1f79fa[_0x12e9('0x112')]):_0x703d87[_0x12e9('0x113')][_0x12e9('0xed')]):util[_0x12e9('0x59')](_0x12e9('0x110'),_[_0x12e9('0x70')](_0x1f79fa['TrunkBackup'])?_0x1f79fa['Trunk'][_0x12e9('0x55')]:_0x1f79fa[_0x12e9('0x9c')][_0x12e9('0x55')],_[_0x12e9('0x70')](_0x1f79fa[_0x12e9('0x3b')])?'':_0x1f79fa[_0x12e9('0x3b')][_0x12e9('0x111')]()||'',_0x1f79fa[_0x12e9('0x112')]>0x0?_0x703d87['Contact'][_0x12e9('0xed')]['substring'](_0x1f79fa[_0x12e9('0x112')]):_0x703d87[_0x12e9('0x113')][_0x12e9('0xed')]);var _0x3cc2db=_0x3ec9cf[_0x12e9('0x9b')](_0x1f79fa[_0x12e9('0x54')])?ut['getCallerId'](_0x1f79fa[_0x12e9('0x54')]['callerid'],_0x1f79fa[_0x12e9('0x39')],_0x1f79fa['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x12e9('0x115')](_0x1f79fa[_0x12e9('0x3a')],_0x1f79fa[_0x12e9('0x116')]):_0x1f79fa['dialOriginateCallerIdNumber']):ut[_0x12e9('0x117')](_['isNil'](_0x1f79fa[_0x12e9('0x9c')])?_0x1f79fa[_0x12e9('0x54')][_0x12e9('0x57')]:_0x1f79fa[_0x12e9('0x9c')][_0x12e9('0x57')],_0x1f79fa[_0x12e9('0x39')],_0x1f79fa[_0x12e9('0x116')]>0x0?ut[_0x12e9('0x115')](_0x1f79fa['dialOriginateCallerIdNumber'],_0x1f79fa[_0x12e9('0x116')]):_0x1f79fa[_0x12e9('0x3a')]);if(_0x3cc2db){_0x18aaff[_0x12e9('0x118')]=ut[_0x12e9('0x119')](_0x3cc2db);_0x18aaff[_0x12e9('0x11a')]=ut[_0x12e9('0x11b')](_0x3cc2db);}var _0x23912f=ut[_0x12e9('0x11c')](_0x1f79fa,_0x703d87,_0x269420,_0x3cc2db,_0xfd4f8b,_0x18aaff);_[_0x12e9('0x11d')](_0x18aaff,ut[_0x12e9('0x11e')](_0x23912f));_0x18aaff[_0x12e9('0x8d')]=moment()[_0x12e9('0x59')](_0x12e9('0x8e'));ami[_0x12e9('0x78')](ut[_0x12e9('0x11f')](_0x18aaff,_0x1f79fa,_0x23912f,_0x18aaff[_0x12e9('0xac')],_0x264863))[_0x12e9('0xf2')](function(_0xc631d){_0x1f79fa['originated']+=0x1;logger[_0x12e9('0x5b')](_0x12e9('0x120'),_0xfd4f8b,_0x12e9('0xaf'),_0x1f79fa[_0x12e9('0x55')],_0x12e9('0x74'),_0x1f79fa[_0x12e9('0x61')]);_0x1e922a(_0xc631d);})[_0x12e9('0x7b')](function(_0x5234a1){ut[_0x12e9('0xe5')](_0x18aaff,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x18aaff,_0x12e9('0x121'));_0x1aebb4(_0x5234a1);});});};Preview['prototype'][_0x12e9('0x22')]=function(_0x100080){if(this[_0x12e9('0x19')][_0x100080[_0x12e9('0xbd')]]){this[_0x12e9('0x19')][_0x100080['linkedid']][_0x12e9('0x7a')]=_0x100080['channel'];}};Preview['prototype'][_0x12e9('0x1c')]=function(_0x1f295c){var _0x342c90=this;var _0xf1f0ce=this[_0x12e9('0x19')][_0x1f295c[_0x12e9('0x122')]];if(_0xf1f0ce){if(_0xf1f0ce[_0x12e9('0x123')]&&this[_0x12e9('0x1a')][_0xf1f0ce[_0x12e9('0x123')]]){ut[_0x12e9('0x124')](_0xf1f0ce,this[_0x12e9('0x1a')][_0xf1f0ce[_0x12e9('0x123')]]['name'],this[_0x12e9('0x1a')][_0xf1f0ce[_0x12e9('0x123')]]['id']);}var _0xecba07=_['clone'](_0xf1f0ce);_0xecba07['responsetime']=moment()[_0x12e9('0x59')](_0x12e9('0x8e'));var _0x549fcc=_0x342c90[_0x12e9('0x16')][_0xf1f0ce[_0x12e9('0x73')]];if(ut[_0x12e9('0x125')](_0x1f295c[_0x12e9('0x126')])){if(_0xf1f0ce[_0x12e9('0xab')]){rpcDb[_0x12e9('0x100')](_0xf1f0ce[_0x12e9('0xf5')]);}if(_0xf1f0ce['activeContact']){rpcDb[_0x12e9('0x101')](_0xf1f0ce['idContact']);}ami[_0x12e9('0x29')](_0x12e9('0x127'),ut[_0x12e9('0xb1')](_0xf1f0ce,'rejected'));this[_0x12e9('0x128')](_0xecba07,_0x549fcc,_0x1f295c);}else{_0xf1f0ce['starttime']=moment()['format'](_0x12e9('0x8e'));ut[_0x12e9('0xe5')](_0xecba07,0x4,_0x12e9('0xb8'));rpcDb[_0x12e9('0xe6')](_0xecba07,_0x12e9('0x129'));}}};Preview[_0x12e9('0x12')][_0x12e9('0x1d')]=function(_0x3258e4){var _0x1aaa9e=this;var _0x4d441e=this[_0x12e9('0x19')][_0x3258e4['linkedid']];var _0x4e75e1;if(_0x4d441e){_0x4e75e1=this[_0x12e9('0x16')][_0x4d441e['queue']];logger[_0x12e9('0x5b')](_0x12e9('0x12a'),_0x3258e4[_0x12e9('0xbd')],_0x12e9('0xaf'),_0x4e75e1[_0x12e9('0x55')],_0x12e9('0x75'),_0x4e75e1[_0x12e9('0x2f')]);}if(this['actions'][_0x3258e4[_0x12e9('0xbd')]]&&_0x3258e4[_0x12e9('0xbd')]!==_0x3258e4[_0x12e9('0xae')]){if(_0x3258e4[_0x12e9('0x12b')]==='16'&&this[_0x12e9('0x19')][_0x3258e4[_0x12e9('0xbd')]][_0x12e9('0xad')]){this['callProgressDetectingCustomer'](_0x3258e4,_0x3258e4[_0x12e9('0xbd')],_0x3258e4['cause']);}else if(this['actions'][_0x3258e4['linkedid']][_0x12e9('0xad')]){logger['info']('[syncHangup][talking][cause]',_0x3258e4[_0x12e9('0xbd')],_0x3258e4[_0x12e9('0x12b')],_0x12e9('0xaf'),_0x4e75e1[_0x12e9('0x55')],_0x12e9('0x75'),_0x4e75e1['pTalking']);this[_0x12e9('0x9f')](_0x3258e4,_0x3258e4['linkedid'],_0x3258e4['cause']);}}else if(_0x4d441e&&_['isNil'](_0x4d441e[_0x12e9('0x12c')])&&_0x4e75e1[_0x12e9('0x12d')]&&_0x3258e4['linkedid']===_0x3258e4[_0x12e9('0xae')]&&_[_0x12e9('0x70')](_0x3258e4[_0x12e9('0xe4')])&&_0x3258e4[_0x12e9('0x12b')]==='16'&&_0x3258e4['channelstate']==='6'&&_[_0x12e9('0xe2')](_0x4d441e[_0x12e9('0x12e')])){if(_0x4d441e[_0x12e9('0xab')]){rpcDb[_0x12e9('0x100')](_0x4d441e['idContact']);}if(_0x4d441e[_0x12e9('0xac')]){rpcDb['disableContact'](_0x4d441e['idContact']);}_0x3258e4[_0x12e9('0xe4')]='22';this[_0x12e9('0x128')](_0x4d441e,_0x4e75e1,_0x3258e4);}else if(_0x4d441e&&_0x4d441e[_0x12e9('0x12e')]){if(_0x3258e4['cause']==='16'&&this[_0x12e9('0x19')][_0x3258e4['linkedid']]['dialAnswer']){logger['info']('[syncHangup][talking][transfer]',_0x3258e4[_0x12e9('0xbd')],_0x3258e4[_0x12e9('0x12b')],_0x12e9('0xaf'),_0x4e75e1[_0x12e9('0x55')],'pTalking:\x20',_0x4e75e1[_0x12e9('0x2f')]);this[_0x12e9('0x9f')](_0x3258e4,_0x3258e4[_0x12e9('0xbd')],_0x3258e4['cause']);}else if(this[_0x12e9('0x19')][_0x3258e4[_0x12e9('0xbd')]][_0x12e9('0xad')]){logger[_0x12e9('0x5b')]('[syncHangup][talking][cause]',_0x3258e4[_0x12e9('0xbd')],_0x3258e4[_0x12e9('0x12b')],'\x20Queue',_0x4e75e1[_0x12e9('0x55')],'pTalking:\x20',_0x4e75e1[_0x12e9('0x2f')]);this[_0x12e9('0x9f')](_0x3258e4,_0x3258e4[_0x12e9('0xbd')],_0x3258e4['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x252ea8){if(this['actions'][_0x252ea8['destlinkedid']]&&_0x252ea8['destlinkedid']!==_0x252ea8['destuniqueid']){this['callProgressDetectingCustomer'](_0x252ea8,_0x252ea8[_0x12e9('0xe1')],_0x252ea8[_0x12e9('0xdd')]);}};Preview[_0x12e9('0x12')][_0x12e9('0x1e')]=function(_0x40c4d5){if(this[_0x12e9('0x19')][_0x40c4d5['linkedid']]&&_0x40c4d5[_0x12e9('0xbd')]!==_0x40c4d5[_0x12e9('0xae')]&&!this[_0x12e9('0x19')][_0x40c4d5[_0x12e9('0xbd')]][_0x12e9('0xad')]){if(_0x40c4d5[_0x12e9('0x12b')]==='1'){this[_0x12e9('0x9f')](_0x40c4d5,_0x40c4d5[_0x12e9('0xbd')],_0x40c4d5[_0x12e9('0x12b')]);}}};Preview[_0x12e9('0x12')][_0x12e9('0x12f')]=function(_0x1b190c,_0x400571,_0x502617){if(this[_0x12e9('0x19')][_0x1b190c]){if(_['isNil'](this[_0x12e9('0x19')][_0x1b190c][_0x12e9('0x130')])){this['actions'][_0x1b190c][_0x12e9('0x130')]={};}this[_0x12e9('0x19')][_0x1b190c]['variables'][_0x400571]=_0x502617;}};Preview[_0x12e9('0x12')][_0x12e9('0x24')]=function(_0x43e176){try{if(!_['isNil'](_0x43e176)){if(ut[_0x12e9('0x131')](_[_0x12e9('0x132')](_0x43e176[_0x12e9('0x133')])[0x0])){this[_0x12e9('0x12f')](_0x43e176[_0x12e9('0xae')],_['keys'](_0x43e176[_0x12e9('0x133')])[0x0],_0x43e176[_0x12e9('0x134')]);}}}catch(_0x229368){logger[_0x12e9('0x135')](_0x12e9('0x136'),util[_0x12e9('0x137')](_0x229368,{'showHidden':![],'depth':null}));}};Preview[_0x12e9('0x12')][_0x12e9('0x26')]=function(_0x593d56){if(_0x593d56){if(this['actions'][_0x593d56['transfertargetlinkedid']]){this[_0x12e9('0x19')][_0x593d56[_0x12e9('0x138')]]['transfer']=!![];}}};Preview[_0x12e9('0x12')][_0x12e9('0x27')]=function(_0x4aa92e){if(_0x4aa92e){if(this['actions'][_0x4aa92e['transfererlinkedid']]){this[_0x12e9('0x19')][_0x4aa92e[_0x12e9('0x139')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index ee88db5..fa6472f 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 _0x0e85=['countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerHistory','rescheduleContact','active'];(function(_0xba5f89,_0x3116c0){var _0x3b6958=function(_0x21e526){while(--_0x21e526){_0xba5f89['push'](_0xba5f89['shift']());}};_0x3b6958(++_0x3116c0);}(_0x0e85,0x7c));var _0x50e8=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x0e85[_0x56916d];return _0x2b7f1f;};'use strict';var util=require(_0x50e8('0x0'));var BPromise=require(_0x50e8('0x1'));var logger=require('../../../config/logger')(_0x50e8('0x2'));var _=require(_0x50e8('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x50e8('0x4'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x50e8('0x5'));var voiceQueueReport=require(_0x50e8('0x6'));function loggerCatch(_0xe3151e){return function(_0xfde42){logger['error'](_0xe3151e,util[_0x50e8('0x7')](_0xfde42,{'showHidden':![],'depth':null}));};}function create(_0x108edc){return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](cmHopperHistory[_0x50e8('0xa')](_0x108edc))[_0x50e8('0xb')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x11717c){return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](agentReportPreview[_0x50e8('0xa')](_0x11717c))[_0x50e8('0xb')](loggerCatch(_0x50e8('0xc')));}function moveContact(_0x45dc6f){return BPromise[_0x50e8('0x8')]()['then'](cmHopper['moveContactManagedDialer'](_0x45dc6f,!![]))[_0x50e8('0xb')](loggerCatch(_0x50e8('0xd')));}exports['checkIsBlackList']=function(_0x49e02f){return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](cmHopperBlack[_0x50e8('0xe')](_0x49e02f))[_0x50e8('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x50e8('0xf')]=function(_0x3149d4){return BPromise[_0x50e8('0x8')]()['then'](cmHopper['getContactPreview'](_0x3149d4))[_0x50e8('0xb')](loggerCatch(_0x50e8('0x10')));};exports[_0x50e8('0xa')]=function(_0x291fb7,_0x211731){create(_0x291fb7)[_0x50e8('0xb')](loggerCatch(_0x211731));moveContact(_0x291fb7)['catch'](loggerCatch(_0x211731));};exports['createAgentHistory']=function(_0x441f25,_0xc97063){createAgent(_0x441f25)[_0x50e8('0xb')](loggerCatch(_0xc97063));};exports[_0x50e8('0x11')]=function(_0x5dae4e,_0x90c54c){create(_0x5dae4e)[_0x50e8('0xb')](loggerCatch(_0x90c54c));};exports['createCustomerFinal']=function(_0x415596,_0x55997c){moveContact(_0x415596)[_0x50e8('0xb')](loggerCatch(_0x55997c));};exports[_0x50e8('0x12')]=function(_0xd263d,_0x20f835,_0x46af8e){if(_0x20f835){_0xd263d['UserId']=null;}if(_0x46af8e){_0xd263d[_0x50e8('0x13')]=![];}return BPromise[_0x50e8('0x8')]()['then'](cmHopper[_0x50e8('0x12')](_0xd263d))[_0x50e8('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x50e8('0x14')]=function(_0xe7e56c){return BPromise['resolve']()['then'](cmHopper['countReScheduled'](_0xe7e56c))[_0x50e8('0xb')](loggerCatch(_0x50e8('0x15')));};exports[_0x50e8('0x16')]=function(_0x371a1f){return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](cmHopper['unlockContact']({'UserId':null},_0x371a1f,0x1))[_0x50e8('0xb')](loggerCatch(_0x50e8('0x17')));};exports['disableContact']=function(_0x177201){return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](cmHopper[_0x50e8('0x16')]({'active':![]},_0x177201,0x1))['catch'](loggerCatch(_0x50e8('0x18')));};exports['crateCustomerReportQueue']=function(_0x30fedf){var _0x39c0c6={};_0x39c0c6[_0x50e8('0x19')]=_0x30fedf['type'];_0x39c0c6[_0x50e8('0x1a')]=_0x30fedf[_0x50e8('0x1a')];_0x39c0c6[_0x50e8('0x1b')]=_0x30fedf[_0x50e8('0x1b')];_0x39c0c6[_0x50e8('0x1c')]=_0x30fedf[_0x50e8('0x1c')];_0x39c0c6[_0x50e8('0x1d')]=_0x30fedf['queue'];_0x39c0c6[_0x50e8('0x1e')]=_0x30fedf[_0x50e8('0x1f')];_0x39c0c6['queuecallerleaveAt']=_0x30fedf['answertime'];_0x39c0c6[_0x50e8('0x20')]=0x1;_0x39c0c6[_0x50e8('0x21')]=_0x30fedf[_0x50e8('0x22')];_0x39c0c6['connectedlinename']=_0x30fedf['membername'];_0x39c0c6[_0x50e8('0x23')]=_0x50e8('0x24');_0x39c0c6['exten']=_0x50e8('0x25');_0x39c0c6[_0x50e8('0x26')]=0x0;_0x39c0c6[_0x50e8('0x27')]=0x1;_0x39c0c6[_0x50e8('0x28')]=_0x30fedf['membername'];_0x39c0c6[_0x50e8('0x29')]='COMPLETED';return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](voiceQueueReport[_0x50e8('0x2a')](_0x39c0c6))['catch'](loggerCatch(_0x50e8('0x2b')));};exports[_0x50e8('0x2c')]=function(_0x548f3c,_0x245b45){return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](cmHopper[_0x50e8('0x2c')](_0x548f3c,_0x245b45))['catch'](loggerCatch(_0x50e8('0x2d')));};exports[_0x50e8('0x2e')]=function(_0x24d3ea){return BPromise[_0x50e8('0x8')]()['then'](cmHopper[_0x50e8('0x12')](_0x24d3ea,!![],!![]))[_0x50e8('0xb')](loggerCatch(_0x50e8('0x2f')));}; \ No newline at end of file +var _0xeff8=['preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird'];(function(_0x59cda2,_0x52a700){var _0x3d1007=function(_0x20f37e){while(--_0x20f37e){_0x59cda2['push'](_0x59cda2['shift']());}};_0x3d1007(++_0x52a700);}(_0xeff8,0x186));var _0x8eff=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xeff8[_0x13ea00];return _0x1f7347;};'use strict';var util=require(_0x8eff('0x0'));var BPromise=require(_0x8eff('0x1'));var logger=require('../../../config/logger')(_0x8eff('0x2'));var _=require(_0x8eff('0x3'));var cmHopper=require(_0x8eff('0x4'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x8eff('0x5'));var cmHopperBlack=require(_0x8eff('0x6'));var voiceQueueRt=require(_0x8eff('0x7'));var agentReportPreview=require(_0x8eff('0x8'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x469641){return function(_0xb54063){logger[_0x8eff('0x9')](_0x469641,util[_0x8eff('0xa')](_0xb54063,{'showHidden':![],'depth':null}));};}function create(_0x491f01){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](cmHopperHistory[_0x8eff('0xd')](_0x491f01))[_0x8eff('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x56f120){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](agentReportPreview[_0x8eff('0xd')](_0x56f120))['catch'](loggerCatch(_0x8eff('0xf')));}function moveContact(_0x369b5d){return BPromise['resolve']()[_0x8eff('0xc')](cmHopper[_0x8eff('0x10')](_0x369b5d,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x8eff('0x11')]=function(_0x43c914){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](cmHopperBlack[_0x8eff('0x11')](_0x43c914))['catch'](loggerCatch(_0x8eff('0x12')));};exports[_0x8eff('0x13')]=function(_0x372ee8){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](cmHopper[_0x8eff('0x13')](_0x372ee8))[_0x8eff('0xe')](loggerCatch(_0x8eff('0x14')));};exports[_0x8eff('0xd')]=function(_0x427902,_0x137344){create(_0x427902)['catch'](loggerCatch(_0x137344));moveContact(_0x427902)[_0x8eff('0xe')](loggerCatch(_0x137344));};exports[_0x8eff('0x15')]=function(_0x3cd1dc,_0x20ec2a){createAgent(_0x3cd1dc)[_0x8eff('0xe')](loggerCatch(_0x20ec2a));};exports[_0x8eff('0x16')]=function(_0x38f5ee,_0x399d96){create(_0x38f5ee)[_0x8eff('0xe')](loggerCatch(_0x399d96));};exports[_0x8eff('0x17')]=function(_0x453c7a,_0x1b65f9){moveContact(_0x453c7a)[_0x8eff('0xe')](loggerCatch(_0x1b65f9));};exports[_0x8eff('0x18')]=function(_0xdbb7b5,_0x183a53,_0x5e157c){if(_0x183a53){_0xdbb7b5[_0x8eff('0x19')]=null;}if(_0x5e157c){_0xdbb7b5[_0x8eff('0x1a')]=![];}return BPromise['resolve']()[_0x8eff('0xc')](cmHopper['rescheduleContact'](_0xdbb7b5))[_0x8eff('0xe')](loggerCatch(_0x8eff('0x1b')));};exports[_0x8eff('0x1c')]=function(_0x59cc32){return BPromise[_0x8eff('0xb')]()['then'](cmHopper[_0x8eff('0x1c')](_0x59cc32))[_0x8eff('0xe')](loggerCatch('[countReScheduled]\x20'));};exports[_0x8eff('0x1d')]=function(_0x5ec3d7){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](cmHopper[_0x8eff('0x1d')]({'UserId':null},_0x5ec3d7,0x1))[_0x8eff('0xe')](loggerCatch(_0x8eff('0x1e')));};exports[_0x8eff('0x1f')]=function(_0x516173){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](cmHopper[_0x8eff('0x1d')]({'active':![]},_0x516173,0x1))[_0x8eff('0xe')](loggerCatch(_0x8eff('0x20')));};exports[_0x8eff('0x21')]=function(_0x4cc146){var _0x4ed3b8={};_0x4ed3b8[_0x8eff('0x22')]=_0x4cc146[_0x8eff('0x22')];_0x4ed3b8[_0x8eff('0x23')]=_0x4cc146['uniqueid'];_0x4ed3b8[_0x8eff('0x24')]=_0x4cc146[_0x8eff('0x24')];_0x4ed3b8[_0x8eff('0x25')]=_0x4cc146[_0x8eff('0x25')];_0x4ed3b8[_0x8eff('0x26')]=_0x4cc146[_0x8eff('0x26')];_0x4ed3b8[_0x8eff('0x27')]=_0x4cc146[_0x8eff('0x28')];_0x4ed3b8[_0x8eff('0x29')]=_0x4cc146[_0x8eff('0x28')];_0x4ed3b8[_0x8eff('0x2a')]=0x1;_0x4ed3b8[_0x8eff('0x2b')]=_0x4cc146['endtime'];_0x4ed3b8[_0x8eff('0x2c')]=_0x4cc146[_0x8eff('0x2d')];_0x4ed3b8[_0x8eff('0x2e')]=_0x8eff('0x2f');_0x4ed3b8['exten']=_0x8eff('0x30');_0x4ed3b8[_0x8eff('0x31')]=0x0;_0x4ed3b8['assigned']=0x1;_0x4ed3b8['lastAssignedTo']=_0x4cc146[_0x8eff('0x2d')];_0x4ed3b8[_0x8eff('0x32')]='COMPLETED';return BPromise['resolve']()['then'](voiceQueueReport[_0x8eff('0x33')](_0x4ed3b8))['catch'](loggerCatch(_0x8eff('0x34')));};exports['getContactRecallMe']=function(_0x2bb00f,_0x3f7002){return BPromise[_0x8eff('0xb')]()[_0x8eff('0xc')](cmHopper[_0x8eff('0x35')](_0x2bb00f,_0x3f7002))[_0x8eff('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x8eff('0x36')]=function(_0x5907e0){return BPromise[_0x8eff('0xb')]()['then'](cmHopper[_0x8eff('0x18')](_0x5907e0,!![],!![]))[_0x8eff('0xe')](loggerCatch(_0x8eff('0x37')));}; \ 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 62b7c50..722ba9f 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 _0xb19f=['env','XCALLY_IP_AGI','milliseconds','seconds','error','logger','info','inspect','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logLookAgent','membername','UserId','ringtime','answertime','isFailure','variablesAction','RECALL','uniqueid','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','Global','scheduledAt','active','scheduledat','add','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','agentReadyId','not_inuse','status','reachable','getDiff','createBody','CampaignId','filterKey','idContact','type','campaigntype','calleridnum','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','pow','replace','random','match','extractCalleridNumber','util','lodash','preview'];(function(_0x3a4057,_0x4df9cb){var _0x427d46=function(_0x43fc4d){while(--_0x43fc4d){_0x3a4057['push'](_0x3a4057['shift']());}};_0x427d46(++_0x4df9cb);}(_0xb19f,0x7d));var _0xfb19=function(_0x24d8db,_0x2392c6){_0x24d8db=_0x24d8db-0x0;var _0x13d20d=_0xb19f[_0x24d8db];return _0x13d20d;};'use strict';var util=require(_0xfb19('0x0'));var _=require(_0xfb19('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xfb19('0x2'));var ipAgi=process[_0xfb19('0x3')][_0xfb19('0x4')]||'127.0.0.1';function getSeconds(_0xe1c6f9,_0x585ed2){var _0x520a16=moment(_0xe1c6f9)['milliseconds'](0x0);var _0x364587=moment(_0x585ed2)[_0xfb19('0x5')](0x0);return _0x520a16['diff'](_0x364587,_0xfb19('0x6'));}exports['loggerCatch']=function(_0x23a6ca){return function(_0x47da2b){logger[_0xfb19('0x7')](_0x23a6ca,util['inspect'](_0x47da2b,{'showHidden':![],'depth':null}));};};exports[_0xfb19('0x8')]=function(_0x588d35,_0x21544c){logger[_0xfb19('0x9')](_0x588d35,util[_0xfb19('0xa')](_0x21544c,{'showHidden':![],'depth':null}));};exports[_0xfb19('0xb')]=function(_0x29a561,_0x36c02d){logger[_0xfb19('0x7')](_0x29a561,util[_0xfb19('0xa')](_0x36c02d,{'showHidden':![],'depth':null}));};exports[_0xfb19('0xc')]=function(_0x1e562f){return function(_0x2b9a50){logger[_0xfb19('0x9')](_0x1e562f,util[_0xfb19('0xa')](_0x2b9a50,{'showHidden':![],'depth':null}));};};exports[_0xfb19('0xd')]=function(_0x50921f,_0x2c999e,_0x3bb302){return{'message':_0x50921f,'unlock':_0x2c999e,'active':_0x3bb302};};exports['getCallerId']=function(_0x2dfcbc,_0x4b61cc,_0x2408b0){if(!_[_0xfb19('0xe')](_0x2408b0)&&_0xfb19('0xf')===typeof _0x2408b0&&!_['isEmpty'](_0x2408b0)){if(!_[_0xfb19('0xe')](_0x4b61cc)&&_0xfb19('0xf')===typeof _0x4b61cc&&!_[_0xfb19('0x10')](_0x4b61cc)){return util[_0xfb19('0x11')]('\x22%s\x22\x20<%s>',_0x4b61cc,_0x2408b0);}return util[_0xfb19('0x11')](_0xfb19('0x12'),_0x2408b0,_0x2408b0);}if(!_[_0xfb19('0xe')](_0x2dfcbc)&&_0xfb19('0xf')===typeof _0x2dfcbc&&!_['isEmpty'](_0x2dfcbc)){return _0x2dfcbc;}return _0xfb19('0x13');};exports[_0xfb19('0x14')]=function(_0x6303a4){if(_[_0xfb19('0x15')](_0x6303a4)){return![];}return _0x6303a4;};exports['addVariables']=function(_0x519914,_0x3fbdd1,_0x2b4b80,_0x44c91c,_0x64f37c,_0x40c57f){var _0x57cc4b={'XMD-QUEUE':_0x3fbdd1[_0xfb19('0x16')]?_0x3fbdd1['Queue'][_0xfb19('0x17')]:'','XMD-CALLERID':_0x44c91c,'XMD-CALLERID-PREVIEW':_0x40c57f?util[_0xfb19('0x11')]('\x22%s\x22\x20<%s>',_0x40c57f[_0xfb19('0x18')],_0x40c57f['calleridnum']):_0x44c91c,'XMD-DIALID':_0x64f37c,'XMD-CONTACTID':_0x3fbdd1[_0xfb19('0x19')],'XMD-CDRTYPE':_0xfb19('0x1a'),'CALLERID(all)':_0x44c91c,'XMD-VOICEQUEUEID':_0x3fbdd1[_0xfb19('0x1b')],'XMD-DIALCHANNEL':_0x2b4b80,'XMD-DIALTIMEOUT':_0x519914[_0xfb19('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xfb19('0x11')](_0xfb19('0x1d'),_0x519914[_0xfb19('0x1e')]?'g':'',_['isEmpty'](_0x519914[_0xfb19('0x1f')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x519914[_0xfb19('0x20')]||'','XMD-AGI':_0x519914[_0xfb19('0x21')]?util[_0xfb19('0x11')](_0xfb19('0x22'),ipAgi,_0x519914['dialQueueProject']):_0xfb19('0x23'),'XMD-AGIAFTER':_0x519914['dialQueueProject2']?util['format'](_0xfb19('0x22'),ipAgi,_0x519914[_0xfb19('0x1e')]):_0xfb19('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x40c57f?_0x40c57f[_0xfb19('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x40c57f?_0x40c57f['originatecalleridname']:'','XMD-DESTINATION':_0xfb19('0x25')};if(!_[_0xfb19('0x10')](_0x519914[_0xfb19('0x1f')])){_0x57cc4b[util[_0xfb19('0x11')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x519914[_0xfb19('0x1f')];_0x57cc4b[util[_0xfb19('0x11')]('%s',_0xfb19('0x26'))]=_0x64f37c;}if(_0x3fbdd1&&_0x3fbdd1[_0xfb19('0x27')]){for(var _0x46384a in _0x3fbdd1[_0xfb19('0x27')]){if(_0x3fbdd1[_0xfb19('0x27')][_0xfb19('0x28')](_0x46384a)){if(!_[_0xfb19('0x15')](_0x3fbdd1[_0xfb19('0x27')][_0x46384a])&&_0x46384a!=='id'&&_0x46384a!==_0xfb19('0x29')&&_0x46384a!==_0xfb19('0x2a')&&_0x46384a!==_0xfb19('0x2b')){_0x57cc4b[util[_0xfb19('0x11')](_0xfb19('0x2c'),_0xfb19('0x2d'),_['toUpper'](_0x46384a))]=_0x3fbdd1[_0xfb19('0x27')][_0x46384a];}}}}return _0x57cc4b;};exports[_0xfb19('0x2e')]=function(_0x4673ae){var _0xd434e7={};for(var _0xbac46b in _0x4673ae){if(_0x4673ae[_0xfb19('0x28')](_0xbac46b)){_0xd434e7[util[_0xfb19('0x11')]('%s',_[_0xfb19('0x2f')](_0xbac46b))]=_0x4673ae[_0xbac46b];}}return{'variables':_0xd434e7};};exports[_0xfb19('0x30')]=function(_0x233518,_0xbd5d45){if(!_['isNil'](_0x233518)){if(_0x233518['hasOwnProperty'](_0xfb19('0x31'))){if(_0x233518['originated']>0x0){_0x233518[_0xfb19('0x31')]-=0x1;}else{logger[_0xfb19('0x7')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0xbd5d45);}}}else{logger[_0xfb19('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0xbd5d45);}};exports['logBlacklist']=function(_0x1b7bbb){var _0xdc3417=moment()[_0xfb19('0x11')](_0xfb19('0x32'));_0x1b7bbb[_0xfb19('0x33')]=0xd;_0x1b7bbb[_0xfb19('0x34')]='Blacklist';_0x1b7bbb[_0xfb19('0x35')]=_0xdc3417;_0x1b7bbb[_0xfb19('0x36')]=_0xdc3417;_0x1b7bbb[_0xfb19('0x37')]=_0xdc3417;};exports['logAgent']=function(_0x26c5f9,_0x48a949,_0x483d1c){var _0x80fbbb=moment()['format'](_0xfb19('0x32'));_0x26c5f9['state']=_0x48a949;_0x26c5f9[_0xfb19('0x34')]=_0x483d1c;_0x26c5f9['responsetime']=_0x80fbbb;_0x26c5f9['ringtime']=getSeconds(_0x26c5f9[_0xfb19('0x36')],_0x26c5f9['starttime']);};exports[_0xfb19('0x38')]=function(_0x1da2f8,_0x597014,_0x13b7a5){_0x1da2f8[_0xfb19('0x39')]=_0x597014;_0x1da2f8[_0xfb19('0x3a')]=_0x13b7a5;};exports['logCustomer']=function(_0x4a221a,_0x1b94f4,_0x3f17d8){var _0x2fc670=moment()[_0xfb19('0x11')](_0xfb19('0x32'));_0x4a221a['state']=_0x1b94f4;_0x4a221a[_0xfb19('0x34')]=_0x3f17d8;_0x4a221a[_0xfb19('0x36')]=_0x4a221a['responsetime']?_0x4a221a[_0xfb19('0x36')]:_0x2fc670;_0x4a221a['endtime']=_0x4a221a[_0xfb19('0x37')]?_0x4a221a[_0xfb19('0x37')]:_0x2fc670;_0x4a221a[_0xfb19('0x3b')]=getSeconds(_0x4a221a['responsetime']||0x0,_0x4a221a['starttime']||0x0);_0x4a221a['talktime']=_0x4a221a['answertime']?getSeconds(_0x4a221a[_0xfb19('0x37')],_0x4a221a[_0xfb19('0x3c')]):0x0;};exports[_0xfb19('0x3d')]=function(_0x8b72c1){return _0x8b72c1==='Failure';};exports[_0xfb19('0x3e')]=function(_0x517bf7,_0x7aeab4,_0x3ca58c,_0x40ee9a,_0x45cc1c){var _0x40d0a7=_0x40ee9a?_0xfb19('0x3f'):_0x517bf7['calleridname'];_0x40d0a7=_0x45cc1c?'BOOKED':_0x40d0a7;return{'actionid':_0x517bf7[_0xfb19('0x40')],'action':_0xfb19('0x41'),'channel':_0x517bf7[_0xfb19('0x42')],'callerid':util['format'](_0xfb19('0x12'),_0x40d0a7,_0x517bf7['calleridnum']),'Exten':_0xfb19('0x25'),'Context':_0xfb19('0x43'),'Priority':'1','variable':_0x3ca58c,'timeout':(_0x7aeab4['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x517bf7[_0xfb19('0x40')]};};exports[_0xfb19('0x44')]=function(_0x3d1bf4){return _0x3d1bf4[_0xfb19('0x45')]+_0x3d1bf4[_0xfb19('0x46')]+_0x3d1bf4[_0xfb19('0x47')];};exports[_0xfb19('0x48')]=function(_0x537ddd){var _0x24d046=_['clone'](_0x537ddd);_0x24d046[_0xfb19('0x33')]=0xf;_0x24d046['statedesc']=_0xfb19('0x49');return _0x24d046;};exports[_0xfb19('0x4a')]=function(_0x2570aa,_0x428f9c,_0x1d3a1f){var _0x59c8c3={};_0x59c8c3[_0x428f9c]=_0x2570aa[_0x428f9c];_0x59c8c3[_0xfb19('0x4b')]=![];_0x59c8c3[_0xfb19('0x4c')]=moment()[_0xfb19('0x4d')](_0x1d3a1f,'minutes')['format'](_0xfb19('0x32'));_0x59c8c3[_0xfb19('0x19')]=_0x2570aa[_0xfb19('0x19')];_0x59c8c3['ListId']=_0x2570aa['ListId'];_0x59c8c3[_0xfb19('0x1b')]=_0x2570aa['VoiceQueueId']||undefined;return _0x59c8c3;};exports[_0xfb19('0x4e')]=function(_0x28f085,_0x589fdd){if(!_['isNil'](_0x28f085)){if(_0x28f085[_0xfb19('0x4f')]>0x0){_0x28f085[_0xfb19('0x4f')]-=0x1;}else{logger[_0xfb19('0x7')](_0x589fdd,_0xfb19('0x50'));}}else{logger[_0xfb19('0x7')](_0x589fdd,_0xfb19('0x51'));}};exports[_0xfb19('0x52')]=function(_0x5716d0){if(_0x5716d0<=0x0){return!![];}return![];};exports[_0xfb19('0x53')]=function(_0x1e2daa,_0x5a47d4){_0x1e2daa[_0xfb19('0x54')]=_0x5a47d4;_0x1e2daa[_0xfb19('0x17')]=_0x1e2daa[_0xfb19('0x55')];_0x1e2daa[_0xfb19('0x56')]=_0x1e2daa['channelAgent'];return _0x1e2daa;};exports['buildAcw']=function(_0x2483d8){var _0x438c1b={};_0x438c1b[_0xfb19('0x55')]=_0x2483d8[_0xfb19('0x55')];_0x438c1b[_0xfb19('0x56')]=_0x2483d8[_0xfb19('0x42')];_0x438c1b['uniqueid']=_0x2483d8['uniqueid'];return _0x438c1b;};exports[_0xfb19('0x57')]=function(_0x1b9844){var _0x394731=[];for(var _0x129001 in _0x1b9844){if(_0x1b9844[_0xfb19('0x28')](_0x129001)){if(!_[_0xfb19('0x15')](_0x1b9844[_0x129001])&&_0x1b9844[_0x129001][_0xfb19('0x33')]===_0xfb19('0x58')&&_0x1b9844[_0x129001][_0xfb19('0x59')]===_0xfb19('0x5a')){_0x394731['push'](_0x1b9844[_0x129001]['id']);}}}return _0x394731;};exports[_0xfb19('0x5b')]=function(_0x52d787){var _0xba5149=moment()[_0xfb19('0x5')](0x0);var _0x16650b=moment(_0x52d787)[_0xfb19('0x5')](0x0);return _0xba5149['diff'](_0x16650b,_0xfb19('0x6'));};exports[_0xfb19('0x5c')]=function(_0x577734){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x577734['ContactId'],'ListId':_0x577734['ListId'],'VoiceQueueId':_0x577734[_0xfb19('0x1b')]||undefined,'CampaignId':_0x577734[_0xfb19('0x5d')]||undefined};};exports[_0xfb19('0x5e')]=function(_0x5a4099){if(_0x5a4099===_0xfb19('0x40')||_0x5a4099===_0xfb19('0x5f')||_0x5a4099==='queue'||_0x5a4099===_0xfb19('0x60')||_0x5a4099===_0xfb19('0x61')||_0x5a4099==='dialAnswer'||_0x5a4099===_0xfb19('0x39')||_0x5a4099==='channelAgent'||_0x5a4099===_0xfb19('0x18')||_0x5a4099===_0xfb19('0x4b')||_0x5a4099===_0xfb19('0x62')||_0x5a4099===_0xfb19('0x4c')||_0x5a4099===_0xfb19('0x45')||_0x5a4099===_0xfb19('0x46')||_0x5a4099===_0xfb19('0x47')||_0x5a4099===_0xfb19('0x63')||_0x5a4099===_0xfb19('0x64')||_0x5a4099===_0xfb19('0x65')||_0x5a4099==='callbackat'||_0x5a4099===_0xfb19('0x66')||_0x5a4099==='ContactId'||_0x5a4099==='ListId'||_0x5a4099===_0xfb19('0x3a')||_0x5a4099===_0xfb19('0x1b')||_0x5a4099===_0xfb19('0x67')||_0x5a4099===_0xfb19('0x68')||_0x5a4099===_0xfb19('0x69')||_0x5a4099===_0xfb19('0x6a')||_0x5a4099===_0xfb19('0x6b')||_0x5a4099===_0xfb19('0x6c')||_0x5a4099===_0xfb19('0x6d')||_0x5a4099===_0xfb19('0x6e')||_0x5a4099===_0xfb19('0x6f')||_0x5a4099==='xmd-dialchannel'||_0x5a4099===_0xfb19('0x70')||_0x5a4099===_0xfb19('0x71')||_0x5a4099===_0xfb19('0x72')||_0x5a4099===_0xfb19('0x73')||_0x5a4099==='xmd-agi'||_0x5a4099==='rtpaudioqos'||_0x5a4099===_0xfb19('0x74')||_0x5a4099===_0xfb19('0x75')||_0x5a4099==='rtpaudioqosjitterbridged'||_0x5a4099===_0xfb19('0x76')||_0x5a4099==='rtpaudioqoslossbridged'||_0x5a4099==='rtpaudioqosrtt'||_0x5a4099==='rtpaudioqosrttbridged'||_0x5a4099===_0xfb19('0x77')||_0x5a4099===_0xfb19('0x74')||_0x5a4099===_0xfb19('0x75')||_0x5a4099===_0xfb19('0x78')||_0x5a4099===_0xfb19('0x76')||_0x5a4099===_0xfb19('0x79')||_0x5a4099===_0xfb19('0x7a')||_0x5a4099==='rtpaudioqosrttbridged'||_0x5a4099==='bridgepeer'||_0x5a4099==='bridgepvtcallid'||_0x5a4099===_0xfb19('0x33')||_0x5a4099==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x482ae1,_0x38c768){var _0x238835,_0x4b28c3,_0x3d701c;if(_0x38c768<=0x0){_0x38c768=0x1;}_0x238835=new RegExp('\x5cw{0,'+_0x38c768+'}$');_0x4b28c3=Math[_0xfb19('0x7b')](0xa,_0x38c768-0x1);_0x3d701c=Math[_0xfb19('0x7b')](0xa,_0x38c768)-0x1;return util[_0xfb19('0x11')]('%s',_[_0xfb19('0x7c')](_0x482ae1,_0x238835,_[_0xfb19('0x7d')](_0x4b28c3,_0x3d701c)));};exports['extractCalleridName']=function(_0x5b834a){var _0x3e7449=_0x5b834a[_0xfb19('0x7e')](/"(.*?)"/);return _0x3e7449?_0x3e7449[0x1]:_0x5b834a;};exports[_0xfb19('0x7f')]=function(_0x414e86){var _0x27cbbc=_0x414e86[_0xfb19('0x7e')](/<(.*?)>/);return _0x27cbbc?_0x27cbbc[0x1]:_0x414e86;}; \ No newline at end of file +var _0x6fc3=['env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','logAgent','starttime','logLookAgent','UserId','logCustomer','endtime','ringtime','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','timeout','countbusyretry','countnoanswerretry','cloneAction','clone','Global','active','add','minutes','ContactId','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','channelAgent','interface','not_inuse','status','push','CampaignId','filterKey','idContact','type','campaigntype','membername','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview'];(function(_0x3e23c1,_0xb0c332){var _0x393fea=function(_0x2dbe0c){while(--_0x2dbe0c){_0x3e23c1['push'](_0x3e23c1['shift']());}};_0x393fea(++_0xb0c332);}(_0x6fc3,0x117));var _0x36fc=function(_0x1c9863,_0x30d176){_0x1c9863=_0x1c9863-0x0;var _0x2f810c=_0x6fc3[_0x1c9863];return _0x2f810c;};'use strict';var util=require(_0x36fc('0x0'));var _=require(_0x36fc('0x1'));var moment=require(_0x36fc('0x2'));var logger=require(_0x36fc('0x3'))(_0x36fc('0x4'));var ipAgi=process[_0x36fc('0x5')][_0x36fc('0x6')]||_0x36fc('0x7');function getSeconds(_0x4394e0,_0x4c9289){var _0x5416f1=moment(_0x4394e0)[_0x36fc('0x8')](0x0);var _0x1fb46a=moment(_0x4c9289)[_0x36fc('0x8')](0x0);return _0x5416f1[_0x36fc('0x9')](_0x1fb46a,_0x36fc('0xa'));}exports[_0x36fc('0xb')]=function(_0x4ce22c){return function(_0x1ce5db){logger[_0x36fc('0xc')](_0x4ce22c,util['inspect'](_0x1ce5db,{'showHidden':![],'depth':null}));};};exports[_0x36fc('0xd')]=function(_0x81f8e1,_0x1a4bea){logger[_0x36fc('0xe')](_0x81f8e1,util[_0x36fc('0xf')](_0x1a4bea,{'showHidden':![],'depth':null}));};exports[_0x36fc('0x10')]=function(_0x3ff634,_0x53e526){logger[_0x36fc('0xc')](_0x3ff634,util[_0x36fc('0xf')](_0x53e526,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x1cfd00){return function(_0x5a4653){logger[_0x36fc('0xe')](_0x1cfd00,util[_0x36fc('0xf')](_0x5a4653,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x4a8f6a,_0x407ca1,_0x292ce4){return{'message':_0x4a8f6a,'unlock':_0x407ca1,'active':_0x292ce4};};exports[_0x36fc('0x11')]=function(_0x75abcd,_0x14fc70,_0x273078){if(!_[_0x36fc('0x12')](_0x273078)&&_0x36fc('0x13')===typeof _0x273078&&!_[_0x36fc('0x14')](_0x273078)){if(!_[_0x36fc('0x12')](_0x14fc70)&&'string'===typeof _0x14fc70&&!_[_0x36fc('0x14')](_0x14fc70)){return util[_0x36fc('0x15')](_0x36fc('0x16'),_0x14fc70,_0x273078);}return util['format'](_0x36fc('0x16'),_0x273078,_0x273078);}if(!_['isUndefined'](_0x75abcd)&&'string'===typeof _0x75abcd&&!_['isEmpty'](_0x75abcd)){return _0x75abcd;}return _0x36fc('0x17');};exports[_0x36fc('0x18')]=function(_0x1d7d85){if(_[_0x36fc('0x19')](_0x1d7d85)){return![];}return _0x1d7d85;};exports[_0x36fc('0x1a')]=function(_0xa6f550,_0x42991e,_0x35dc72,_0x62db5e,_0x311176,_0x2ac1cd){var _0x402a10={'XMD-QUEUE':_0x42991e[_0x36fc('0x1b')]?_0x42991e[_0x36fc('0x1b')][_0x36fc('0x1c')]:'','XMD-CALLERID':_0x62db5e,'XMD-CALLERID-PREVIEW':_0x2ac1cd?util[_0x36fc('0x15')](_0x36fc('0x16'),_0x2ac1cd[_0x36fc('0x1d')],_0x2ac1cd[_0x36fc('0x1e')]):_0x62db5e,'XMD-DIALID':_0x311176,'XMD-CONTACTID':_0x42991e['ContactId'],'XMD-CDRTYPE':_0x36fc('0x1f'),'CALLERID(all)':_0x62db5e,'XMD-VOICEQUEUEID':_0x42991e['VoiceQueueId'],'XMD-DIALCHANNEL':_0x35dc72,'XMD-DIALTIMEOUT':_0xa6f550[_0x36fc('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0x36fc('0x15')](_0x36fc('0x21'),_0xa6f550[_0x36fc('0x22')]?'g':'',_['isEmpty'](_0xa6f550[_0x36fc('0x23')])?'':_0x36fc('0x24')),'XMD-DIALURL':_0xa6f550[_0x36fc('0x25')]||'','XMD-AGI':_0xa6f550[_0x36fc('0x26')]?util[_0x36fc('0x15')](_0x36fc('0x27'),ipAgi,_0xa6f550['dialQueueProject']):_0x36fc('0x28'),'XMD-AGIAFTER':_0xa6f550[_0x36fc('0x22')]?util[_0x36fc('0x15')](_0x36fc('0x27'),ipAgi,_0xa6f550[_0x36fc('0x22')]):_0x36fc('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x2ac1cd?_0x2ac1cd[_0x36fc('0x29')]:'','XMD-ORIGINATECALLERIDNAME':_0x2ac1cd?_0x2ac1cd[_0x36fc('0x2a')]:'','XMD-DESTINATION':_0x36fc('0x2b')};if(!_[_0x36fc('0x14')](_0xa6f550[_0x36fc('0x23')])){_0x402a10[util[_0x36fc('0x15')]('%s',_0x36fc('0x2c'))]=_0xa6f550[_0x36fc('0x23')];_0x402a10[util[_0x36fc('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x311176;}if(_0x42991e&&_0x42991e[_0x36fc('0x2d')]){for(var _0xcfc665 in _0x42991e[_0x36fc('0x2d')]){if(_0x42991e[_0x36fc('0x2d')][_0x36fc('0x2e')](_0xcfc665)){if(!_['isNil'](_0x42991e[_0x36fc('0x2d')][_0xcfc665])&&_0xcfc665!=='id'&&_0xcfc665!==_0x36fc('0x2f')&&_0xcfc665!==_0x36fc('0x30')&&_0xcfc665!=='updatedAt'){_0x402a10[util[_0x36fc('0x15')](_0x36fc('0x31'),_0x36fc('0x32'),_[_0x36fc('0x33')](_0xcfc665))]=_0x42991e[_0x36fc('0x2d')][_0xcfc665];}}}}return _0x402a10;};exports[_0x36fc('0x34')]=function(_0xeac05b){var _0x106f39={};for(var _0x59e7ee in _0xeac05b){if(_0xeac05b['hasOwnProperty'](_0x59e7ee)){_0x106f39[util[_0x36fc('0x15')]('%s',_[_0x36fc('0x35')](_0x59e7ee))]=_0xeac05b[_0x59e7ee];}}return{'variables':_0x106f39};};exports[_0x36fc('0x36')]=function(_0x240e9c,_0x3091db){if(!_[_0x36fc('0x19')](_0x240e9c)){if(_0x240e9c['hasOwnProperty']('originated')){if(_0x240e9c['originated']>0x0){_0x240e9c[_0x36fc('0x37')]-=0x1;}else{logger[_0x36fc('0xc')](_0x36fc('0x38'),_0x3091db);}}}else{logger['error'](_0x36fc('0x39'),_0x3091db);}};exports['logBlacklist']=function(_0x4b15e0){var _0x6698ae=moment()[_0x36fc('0x15')](_0x36fc('0x3a'));_0x4b15e0[_0x36fc('0x3b')]=0xd;_0x4b15e0[_0x36fc('0x3c')]=_0x36fc('0x3d');_0x4b15e0['starttime']=_0x6698ae;_0x4b15e0[_0x36fc('0x3e')]=_0x6698ae;_0x4b15e0['endtime']=_0x6698ae;};exports[_0x36fc('0x3f')]=function(_0x2a91b2,_0x11819e,_0x215482){var _0x5ea398=moment()[_0x36fc('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a91b2[_0x36fc('0x3b')]=_0x11819e;_0x2a91b2['statedesc']=_0x215482;_0x2a91b2['responsetime']=_0x5ea398;_0x2a91b2['ringtime']=getSeconds(_0x2a91b2['responsetime'],_0x2a91b2[_0x36fc('0x40')]);};exports[_0x36fc('0x41')]=function(_0x3fabe2,_0x4e22b2,_0x33f294){_0x3fabe2['membername']=_0x4e22b2;_0x3fabe2[_0x36fc('0x42')]=_0x33f294;};exports[_0x36fc('0x43')]=function(_0x591c5d,_0x6001dd,_0x48ec26){var _0x54f133=moment()['format'](_0x36fc('0x3a'));_0x591c5d[_0x36fc('0x3b')]=_0x6001dd;_0x591c5d['statedesc']=_0x48ec26;_0x591c5d[_0x36fc('0x3e')]=_0x591c5d[_0x36fc('0x3e')]?_0x591c5d[_0x36fc('0x3e')]:_0x54f133;_0x591c5d[_0x36fc('0x44')]=_0x591c5d[_0x36fc('0x44')]?_0x591c5d['endtime']:_0x54f133;_0x591c5d[_0x36fc('0x45')]=getSeconds(_0x591c5d[_0x36fc('0x3e')]||0x0,_0x591c5d[_0x36fc('0x40')]||0x0);_0x591c5d[_0x36fc('0x46')]=_0x591c5d[_0x36fc('0x47')]?getSeconds(_0x591c5d[_0x36fc('0x44')],_0x591c5d[_0x36fc('0x47')]):0x0;};exports[_0x36fc('0x48')]=function(_0x23d989){return _0x23d989==='Failure';};exports[_0x36fc('0x49')]=function(_0x5e7e6c,_0x8cec41,_0x56a8a1,_0x34cc11,_0x209d48){var _0x5d00f8=_0x34cc11?_0x36fc('0x4a'):_0x5e7e6c[_0x36fc('0x1d')];_0x5d00f8=_0x209d48?_0x36fc('0x4b'):_0x5d00f8;return{'actionid':_0x5e7e6c[_0x36fc('0x4c')],'action':_0x36fc('0x4d'),'channel':_0x5e7e6c['channelAgent'],'callerid':util[_0x36fc('0x15')]('\x22%s\x22\x20<%s>',_0x5d00f8,_0x5e7e6c[_0x36fc('0x1e')]),'Exten':_0x36fc('0x2b'),'Context':'from-sip','Priority':'1','variable':_0x56a8a1,'timeout':(_0x8cec41[_0x36fc('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5e7e6c[_0x36fc('0x4c')]};};exports['totalGlobal']=function(_0x22f9d4){return _0x22f9d4[_0x36fc('0x4f')]+_0x22f9d4['countcongestionretry']+_0x22f9d4[_0x36fc('0x50')];};exports[_0x36fc('0x51')]=function(_0x3ecc47){var _0x5dfc6c=_[_0x36fc('0x52')](_0x3ecc47);_0x5dfc6c[_0x36fc('0x3b')]=0xf;_0x5dfc6c[_0x36fc('0x3c')]=_0x36fc('0x53');return _0x5dfc6c;};exports['scheduledAt']=function(_0x3bbefa,_0x40f937,_0x1617dc){var _0x57bd76={};_0x57bd76[_0x40f937]=_0x3bbefa[_0x40f937];_0x57bd76[_0x36fc('0x54')]=![];_0x57bd76['scheduledat']=moment()[_0x36fc('0x55')](_0x1617dc,_0x36fc('0x56'))[_0x36fc('0x15')](_0x36fc('0x3a'));_0x57bd76[_0x36fc('0x57')]=_0x3bbefa[_0x36fc('0x57')];_0x57bd76['ListId']=_0x3bbefa[_0x36fc('0x58')];_0x57bd76[_0x36fc('0x59')]=_0x3bbefa[_0x36fc('0x59')]||undefined;return _0x57bd76;};exports[_0x36fc('0x5a')]=function(_0x291730,_0x1c06d1){if(!_[_0x36fc('0x19')](_0x291730)){if(_0x291730['pTalking']>0x0){_0x291730[_0x36fc('0x5b')]-=0x1;}else{logger[_0x36fc('0xc')](_0x1c06d1,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x36fc('0xc')](_0x1c06d1,_0x36fc('0x5c'));}};exports[_0x36fc('0x5d')]=function(_0x5099f2){if(_0x5099f2<=0x0){return!![];}return![];};exports[_0x36fc('0x5e')]=function(_0x3407c2,_0x48fefb){_0x3407c2[_0x36fc('0x5f')]=_0x48fefb;_0x3407c2[_0x36fc('0x1c')]=_0x3407c2[_0x36fc('0x60')];_0x3407c2['interface']=_0x3407c2[_0x36fc('0x61')];return _0x3407c2;};exports['buildAcw']=function(_0x454916){var _0x1bf182={};_0x1bf182['queue']=_0x454916[_0x36fc('0x60')];_0x1bf182[_0x36fc('0x62')]=_0x454916['channelAgent'];_0x1bf182[_0x36fc('0x4c')]=_0x454916[_0x36fc('0x4c')];return _0x1bf182;};exports['agentReadyId']=function(_0x5d222f){var _0x31d5ba=[];for(var _0x5da683 in _0x5d222f){if(_0x5d222f[_0x36fc('0x2e')](_0x5da683)){if(!_['isNil'](_0x5d222f[_0x5da683])&&_0x5d222f[_0x5da683][_0x36fc('0x3b')]===_0x36fc('0x63')&&_0x5d222f[_0x5da683][_0x36fc('0x64')]==='reachable'){_0x31d5ba[_0x36fc('0x65')](_0x5d222f[_0x5da683]['id']);}}}return _0x31d5ba;};exports['getDiff']=function(_0xa23d52){var _0x1d1648=moment()[_0x36fc('0x8')](0x0);var _0xd188ed=moment(_0xa23d52)[_0x36fc('0x8')](0x0);return _0x1d1648['diff'](_0xd188ed,_0x36fc('0xa'));};exports['createBody']=function(_0x5186e3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5186e3[_0x36fc('0x57')],'ListId':_0x5186e3[_0x36fc('0x58')],'VoiceQueueId':_0x5186e3[_0x36fc('0x59')]||undefined,'CampaignId':_0x5186e3[_0x36fc('0x66')]||undefined};};exports[_0x36fc('0x67')]=function(_0x4e7de4){if(_0x4e7de4==='uniqueid'||_0x4e7de4===_0x36fc('0x68')||_0x4e7de4===_0x36fc('0x60')||_0x4e7de4===_0x36fc('0x69')||_0x4e7de4===_0x36fc('0x6a')||_0x4e7de4==='dialAnswer'||_0x4e7de4===_0x36fc('0x6b')||_0x4e7de4===_0x36fc('0x61')||_0x4e7de4===_0x36fc('0x1d')||_0x4e7de4===_0x36fc('0x54')||_0x4e7de4===_0x36fc('0x1e')||_0x4e7de4==='scheduledat'||_0x4e7de4===_0x36fc('0x4f')||_0x4e7de4===_0x36fc('0x6c')||_0x4e7de4===_0x36fc('0x50')||_0x4e7de4===_0x36fc('0x6d')||_0x4e7de4===_0x36fc('0x6e')||_0x4e7de4===_0x36fc('0x6f')||_0x4e7de4===_0x36fc('0x70')||_0x4e7de4===_0x36fc('0x71')||_0x4e7de4===_0x36fc('0x57')||_0x4e7de4==='ListId'||_0x4e7de4==='UserId'||_0x4e7de4===_0x36fc('0x59')||_0x4e7de4===_0x36fc('0x72')||_0x4e7de4===_0x36fc('0x73')||_0x4e7de4===_0x36fc('0x74')||_0x4e7de4===_0x36fc('0x75')||_0x4e7de4==='xmd-listid'||_0x4e7de4===_0x36fc('0x76')||_0x4e7de4===_0x36fc('0x77')||_0x4e7de4===_0x36fc('0x78')||_0x4e7de4===_0x36fc('0x79')||_0x4e7de4===_0x36fc('0x7a')||_0x4e7de4===_0x36fc('0x7b')||_0x4e7de4===_0x36fc('0x7c')||_0x4e7de4==='xmd-callerid'||_0x4e7de4==='xmd-agiafter'||_0x4e7de4===_0x36fc('0x7d')||_0x4e7de4===_0x36fc('0x7e')||_0x4e7de4==='rtpaudioqosbridged'||_0x4e7de4===_0x36fc('0x7f')||_0x4e7de4==='rtpaudioqosjitterbridged'||_0x4e7de4===_0x36fc('0x80')||_0x4e7de4==='rtpaudioqoslossbridged'||_0x4e7de4===_0x36fc('0x81')||_0x4e7de4==='rtpaudioqosrttbridged'||_0x4e7de4===_0x36fc('0x7e')||_0x4e7de4===_0x36fc('0x82')||_0x4e7de4===_0x36fc('0x7f')||_0x4e7de4==='rtpaudioqosjitterbridged'||_0x4e7de4==='rtpaudioqosloss'||_0x4e7de4===_0x36fc('0x83')||_0x4e7de4===_0x36fc('0x81')||_0x4e7de4===_0x36fc('0x84')||_0x4e7de4===_0x36fc('0x85')||_0x4e7de4==='bridgepvtcallid'||_0x4e7de4==='state'||_0x4e7de4===_0x36fc('0x3c')){return![];}return!![];};exports[_0x36fc('0x86')]=function(_0x17d6ec,_0x263fb2){var _0x1245e0,_0x5332cf,_0x54a0e1;if(_0x263fb2<=0x0){_0x263fb2=0x1;}_0x1245e0=new RegExp(_0x36fc('0x87')+_0x263fb2+'}$');_0x5332cf=Math[_0x36fc('0x88')](0xa,_0x263fb2-0x1);_0x54a0e1=Math[_0x36fc('0x88')](0xa,_0x263fb2)-0x1;return util['format']('%s',_[_0x36fc('0x89')](_0x17d6ec,_0x1245e0,_[_0x36fc('0x8a')](_0x5332cf,_0x54a0e1)));};exports[_0x36fc('0x8b')]=function(_0x4aee0e){var _0x4625dc=_0x4aee0e[_0x36fc('0x8c')](/"(.*?)"/);return _0x4625dc?_0x4625dc[0x1]:_0x4aee0e;};exports[_0x36fc('0x8d')]=function(_0x3733f4){var _0x39a813=_0x3733f4['match'](/<(.*?)>/);return _0x39a813?_0x39a813[0x1]:_0x3733f4;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 49d84dc..a30b4ba 100644 --- a/server/services/ami/properties.js +++ b/server/services/ami/properties.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload','voicechannel'];(function(_0x49fac0,_0x39a9c3){var _0x387b0b=function(_0x35f7e7){while(--_0x35f7e7){_0x49fac0['push'](_0x49fac0['shift']());}};_0x387b0b(++_0x39a9c3);}(_0xb10b,0x12a));var _0xbb10=function(_0x9fb085,_0x2251a3){_0x9fb085=_0x9fb085-0x0;var _0x400c75=_0xb10b[_0x9fb085];return _0x400c75;};'use strict';exports[_0xbb10('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]},'membername':{'type':_0xbb10('0x1'),'required':!![]},'penalty':{'type':_0xbb10('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xbb10('0x3')]={'queue':{'type':_0xbb10('0x1'),'required':!![]},'interface':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x4')]={'interface':{'type':_0xbb10('0x1'),'required':!![]},'paused':{'type':_0xbb10('0x5')},'reason':{'type':'string','required':![]}};exports[_0xbb10('0x6')]={'module':{'type':_0xbb10('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports[_0xbb10('0x7')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]},'filename':{'type':_0xbb10('0x1')},'format':{'type':_0xbb10('0x1')},'mixmonitorid':{'type':_0xbb10('0x1')}};exports[_0xbb10('0x8')]={'uniqueid':{'type':_0xbb10('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xbb10('0x1'),'required':!![]},'context':{'type':_0xbb10('0x1')}}; \ No newline at end of file +var _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x2c003b,_0x4b0db4){var _0x36f476=function(_0x1a41ae){while(--_0x1a41ae){_0x2c003b['push'](_0x2c003b['shift']());}};_0x36f476(++_0x4b0db4);}(_0x7a54,0x106));var _0x47a5=function(_0x6cdf08,_0x3080a8){_0x6cdf08=_0x6cdf08-0x0;var _0x6f823c=_0x7a54[_0x6cdf08];return _0x6f823c;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index f18e4b4..c14288f 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 _0x2cf4=['outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','format','isUndefined','initTelephones','length','mergeFromDatabase','trunks','initVoiceQueues','initTriggers','triggers','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','merge','faxAccounts','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/template','../model/campaign','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','campaigns','templates','voiceExtensions','channels','outboundChannels','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','hasOwnProperty','mapKeys','name','isNil','interface','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit'];(function(_0x384412,_0x6ad830){var _0x4c3e4f=function(_0x4bc660){while(--_0x4bc660){_0x384412['push'](_0x384412['shift']());}};_0x4c3e4f(++_0x6ad830);}(_0x2cf4,0x9b));var _0x42cf=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0x2cf4[_0xdeac17];return _0x33aabd;};'use strict';var BPromise=require(_0x42cf('0x0'));var util=require(_0x42cf('0x1'));var _=require(_0x42cf('0x2'));var moment=require(_0x42cf('0x3'));var Agent=require(_0x42cf('0x4'));var Telephone=require(_0x42cf('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x42cf('0x6'));var Trigger=require('../model/trigger');var Template=require(_0x42cf('0x7'));var Campaign=require(_0x42cf('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x42cf('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x42cf('0xa'));var SugarcrmAccount=require(_0x42cf('0xb'));var ZohoAccount=require(_0x42cf('0xc'));var DeskAccount=require(_0x42cf('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x42cf('0xe'));var Dynamics365Account=require(_0x42cf('0xf'));var FreshsalesAccount=require(_0x42cf('0x10'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x42cf('0x11')]={};this[_0x42cf('0x12')]={};this['trunks']={};this[_0x42cf('0x13')]={};this['triggers']={};this[_0x42cf('0x14')]={};this[_0x42cf('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x42cf('0x16')]={};this[_0x42cf('0x17')]={};this['queueChannels']={};this[_0x42cf('0x18')]={};this['timers']={};this['zendeskAccounts']={};this[_0x42cf('0x19')]={};this[_0x42cf('0x1a')]={};this['freshdeskAccounts']={};this[_0x42cf('0x1b')]={};this[_0x42cf('0x1c')]={};this[_0x42cf('0x1d')]={};this[_0x42cf('0x1e')]={};this[_0x42cf('0x1f')]={};this[_0x42cf('0x20')]={};this['faxAccounts']={};};function freeIsNotKey(_0x4707c1,_0x161b68,_0x5de23f){var _0x6252af=_['mapKeys'](_0x4707c1,function(_0x48c538,_0x41b43d){return _0x48c538[_0x5de23f];});for(var _0x8e134f in _0x161b68){if(_0x161b68[_0x42cf('0x21')](_0x8e134f)){if(!_0x6252af[_0x8e134f]){delete _0x161b68[_0x8e134f];}}}}function freeIsNotKeySip(_0x1f9374,_0x1cf205){var _0x5163dd=_[_0x42cf('0x22')](_0x1f9374,function(_0x765da7,_0x2c4a5d){return util['format']('SIP/%s',_0x765da7[_0x42cf('0x23')]);});for(var _0x542b5a in _0x1cf205){if(_0x1cf205[_0x42cf('0x21')](_0x542b5a)){if(!_0x5163dd[_0x542b5a]){delete _0x1cf205[_0x542b5a];}}}}function freeIsNotKeyAgent(_0x171411,_0x19f46b){var _0x151fa1=_[_0x42cf('0x22')](_0x171411,function(_0x2ce85f,_0x866ad4){var _0x5a519b=_[_0x42cf('0x24')](_0x2ce85f[_0x42cf('0x25')])?util['format'](_0x42cf('0x26'),_0x2ce85f['name']):_0x2ce85f[_0x42cf('0x25')];return _0x5a519b;});for(var _0xd39dd9 in _0x19f46b){if(_0x19f46b['hasOwnProperty'](_0xd39dd9)){if(!_0x151fa1[_0xd39dd9]){delete _0x19f46b[_0xd39dd9];}}}}function clearVoiceCallReports(_0x16930b){_0x16930b[_0x42cf('0x27')]=0x0;_0x16930b[_0x42cf('0x28')]=0x0;_0x16930b[_0x42cf('0x29')]=0x0;_0x16930b[_0x42cf('0x2a')]=0x0;_0x16930b['sumBillable']=0x0;}function clearCampaigns(_0x442efa){if(!_[_0x42cf('0x2b')](_0x442efa)){for(var _0x1e49d7 in _0x442efa){if(_0x442efa[_0x42cf('0x21')](_0x1e49d7)){_0x442efa[_0x1e49d7][_0x42cf('0x2c')]=0x0;_0x442efa[_0x1e49d7][_0x42cf('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x58c66a){if(!_[_0x42cf('0x2b')](_0x58c66a)){for(var _0x3d8843 in _0x58c66a){if(_0x58c66a[_0x42cf('0x21')](_0x3d8843)){_0x58c66a[_0x3d8843]['total']=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x28')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x2e')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x2f')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x29')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x2a')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x30')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x31')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x32')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x33')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x34')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x35')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x36')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x37')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x38')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x39')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x3a')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x3b')]=0x0;_0x58c66a[_0x3d8843]['outboundReCallsDay']=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x31')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x3c')]=0x0;_0x58c66a[_0x3d8843][_0x42cf('0x3d')]=!![];}}}}Realtime[_0x42cf('0x3e')]['mergeFromDatabase']=function(_0x1e8f66,_0x317c6f){for(var _0x567068 in _0x317c6f){if(_0x1e8f66[_0x42cf('0x21')](_0x567068)){_0x1e8f66[_0x567068]=_0x317c6f[_0x567068];}}};Realtime[_0x42cf('0x3e')][_0x42cf('0x3f')]=function(){var _0xaf479e=this;return function(_0x10c6ae){if(_0x10c6ae){freeIsNotKeyAgent(_0x10c6ae,_0xaf479e['agents']);for(var _0x5d1dbf=0x0,_0x9b2d86={},_0x352a8e={};_0x5d1dbf<_0x10c6ae['length'];_0x5d1dbf+=0x1){_0x9b2d86=_0x10c6ae[_0x5d1dbf];var _0x2283ad=_[_0x42cf('0x24')](_0x9b2d86[_0x42cf('0x25')])?util[_0x42cf('0x40')](_0x42cf('0x26'),_0x9b2d86[_0x42cf('0x23')]):_0x9b2d86[_0x42cf('0x25')];if(_[_0x42cf('0x41')](_0xaf479e['agents'][_0x2283ad])){_0xaf479e[_0x42cf('0x11')][_0x2283ad]=new Agent(_0x9b2d86);}else{_0xaf479e['mergeFromDatabase'](_0xaf479e['agents'][_0x2283ad],_0x9b2d86);}}}return _0xaf479e[_0x42cf('0x11')];};};Realtime[_0x42cf('0x3e')][_0x42cf('0x42')]=function(){var _0x552749=this;return function(_0x2238e8){if(_0x2238e8){freeIsNotKeySip(_0x2238e8,_0x552749[_0x42cf('0x12')]);for(var _0xb45d8f=0x0,_0x27c723={},_0x3af3fa={};_0xb45d8f<_0x2238e8[_0x42cf('0x43')];_0xb45d8f+=0x1){_0x27c723=_0x2238e8[_0xb45d8f];if(_[_0x42cf('0x41')](_0x552749[_0x42cf('0x12')][util[_0x42cf('0x40')](_0x42cf('0x26'),_0x27c723[_0x42cf('0x23')])])){_0x552749[_0x42cf('0x12')][util['format'](_0x42cf('0x26'),_0x27c723[_0x42cf('0x23')])]=new Telephone(_0x27c723);}else{_0x552749[_0x42cf('0x44')](_0x552749[_0x42cf('0x12')][util[_0x42cf('0x40')]('SIP/%s',_0x27c723['name'])],_0x27c723);}}}return _0x552749[_0x42cf('0x12')];};};Realtime[_0x42cf('0x3e')]['initTrunks']=function(){var _0x4c6183=this;return function(_0x4d1874){if(_0x4d1874){freeIsNotKeySip(_0x4d1874,_0x4c6183[_0x42cf('0x45')]);for(var _0x300d20=0x0,_0x135424={},_0x2477a1={};_0x300d20<_0x4d1874[_0x42cf('0x43')];_0x300d20+=0x1){_0x135424=_0x4d1874[_0x300d20];if(_[_0x42cf('0x41')](_0x4c6183[_0x42cf('0x45')][util[_0x42cf('0x40')]('SIP/%s',_0x135424[_0x42cf('0x23')])])){_0x4c6183[_0x42cf('0x45')][util[_0x42cf('0x40')](_0x42cf('0x26'),_0x135424['name'])]=new Trunk(_0x135424);}else{_0x4c6183[_0x42cf('0x44')](_0x4c6183[_0x42cf('0x45')][util[_0x42cf('0x40')](_0x42cf('0x26'),_0x135424[_0x42cf('0x23')])],_0x135424);}}}return _0x4c6183['trunks'];};};Realtime[_0x42cf('0x3e')][_0x42cf('0x46')]=function(){var _0x309ca9=this;return function(_0x181c2e){if(_0x181c2e){freeIsNotKey(_0x181c2e,_0x309ca9[_0x42cf('0x13')],_0x42cf('0x23'));for(var _0x24e141=0x0,_0xbbdd0c={},_0x10d5bf={};_0x24e141<_0x181c2e[_0x42cf('0x43')];_0x24e141+=0x1){_0xbbdd0c=_0x181c2e[_0x24e141];if(_['isUndefined'](_0x309ca9[_0x42cf('0x13')][_0xbbdd0c[_0x42cf('0x23')]])){_0x309ca9[_0x42cf('0x13')][_0xbbdd0c['name']]=new VoiceQueue(_0xbbdd0c);}else{_0x309ca9[_0x42cf('0x44')](_0x309ca9['voiceQueues'][_0xbbdd0c[_0x42cf('0x23')]],_0xbbdd0c);}}}return _0x309ca9[_0x42cf('0x13')];};};Realtime['prototype'][_0x42cf('0x47')]=function(){var _0xb5dd9a=this;return function(_0x576f37){if(_0x576f37){freeIsNotKey(_0x576f37,_0xb5dd9a[_0x42cf('0x48')],'id');for(var _0x4ce72f=0x0,_0x2c06cf={},_0x3df92d={};_0x4ce72f<_0x576f37['length'];_0x4ce72f+=0x1){_0x2c06cf=_0x576f37[_0x4ce72f];if(_['isUndefined'](_0xb5dd9a[_0x42cf('0x48')][_0x2c06cf['id']])){_0xb5dd9a[_0x42cf('0x48')][_0x2c06cf['id']]=new Trigger(_0x2c06cf);}else{_0xb5dd9a[_0x42cf('0x44')](_0xb5dd9a[_0x42cf('0x48')][_0x2c06cf['id']],_0x2c06cf);}}}return _0xb5dd9a[_0x42cf('0x48')];};};Realtime[_0x42cf('0x3e')]['initTemplates']=function(){var _0xacbfcb=this;return function(_0x128a13){if(_0x128a13){freeIsNotKey(_0x128a13,_0xacbfcb[_0x42cf('0x15')],'id');for(var _0xef9a37=0x0,_0x91fe89={},_0x104c02={};_0xef9a37<_0x128a13[_0x42cf('0x43')];_0xef9a37+=0x1){_0x91fe89=_0x128a13[_0xef9a37];if(_[_0x42cf('0x41')](_0xacbfcb[_0x42cf('0x15')][_0x91fe89['id']])){_0xacbfcb[_0x42cf('0x15')][_0x91fe89['id']]=new Template(_0x91fe89);}else{_0xacbfcb[_0x42cf('0x44')](_0xacbfcb[_0x42cf('0x15')][_0x91fe89['id']],_0x91fe89);}}}return _0xacbfcb[_0x42cf('0x15')];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x5bcf61=this;return function(_0x37db47){if(_0x37db47){freeIsNotKey(_0x37db47,_0x5bcf61[_0x42cf('0x49')],'id');for(var _0x5bf394=0x0,_0x33ecec={},_0x35a6e2={};_0x5bf394<_0x37db47[_0x42cf('0x43')];_0x5bf394+=0x1){_0x33ecec=_0x37db47[_0x5bf394];if(_[_0x42cf('0x41')](_0x5bcf61['zendeskAccounts'][_0x33ecec['id']])){_0x5bcf61[_0x42cf('0x49')][_0x33ecec['id']]=new ZendeskAccount(_0x33ecec);}else{_0x5bcf61[_0x42cf('0x44')](_0x5bcf61[_0x42cf('0x49')][_0x33ecec['id']],_0x33ecec);}}}return _0x5bcf61[_0x42cf('0x49')];};};Realtime['prototype'][_0x42cf('0x4a')]=function(){var _0x33ec7f=this;return function(_0xdb6b1e){if(_0xdb6b1e){freeIsNotKey(_0xdb6b1e,_0x33ec7f[_0x42cf('0x19')],'id');for(var _0x2c239e=0x0,_0x3489c6={},_0x873f5c={};_0x2c239e<_0xdb6b1e['length'];_0x2c239e+=0x1){_0x3489c6=_0xdb6b1e[_0x2c239e];if(_[_0x42cf('0x41')](_0x33ec7f['salesforceAccounts'][_0x3489c6['id']])){_0x33ec7f[_0x42cf('0x19')][_0x3489c6['id']]=new SalesforceAccount(_0x3489c6);}else{_0x33ec7f['mergeFromDatabase'](_0x33ec7f[_0x42cf('0x19')][_0x3489c6['id']],_0x3489c6);}}}return _0x33ec7f[_0x42cf('0x19')];};};Realtime[_0x42cf('0x3e')][_0x42cf('0x4b')]=function(){var _0x546df3=this;return function(_0x560143){if(_0x560143){freeIsNotKey(_0x560143,_0x546df3[_0x42cf('0x4c')],'id');for(var _0xdba955=0x0,_0x2d280d={},_0x5ddf98={};_0xdba955<_0x560143[_0x42cf('0x43')];_0xdba955+=0x1){_0x2d280d=_0x560143[_0xdba955];if(_[_0x42cf('0x41')](_0x546df3[_0x42cf('0x4c')][_0x2d280d['id']])){_0x546df3[_0x42cf('0x4c')][_0x2d280d['id']]=new FreshdeskAccount(_0x2d280d);}else{_0x546df3[_0x42cf('0x44')](_0x546df3[_0x42cf('0x4c')][_0x2d280d['id']],_0x2d280d);}}}return _0x546df3[_0x42cf('0x4c')];};};Realtime[_0x42cf('0x3e')][_0x42cf('0x4d')]=function(){var _0x32f6c6=this;return function(_0x3dcddd){if(_0x3dcddd){freeIsNotKey(_0x3dcddd,_0x32f6c6['zohoAccounts'],'id');for(var _0x50b6ef=0x0,_0x4fa72a={},_0x518e1b={};_0x50b6ef<_0x3dcddd[_0x42cf('0x43')];_0x50b6ef+=0x1){_0x4fa72a=_0x3dcddd[_0x50b6ef];if(_[_0x42cf('0x41')](_0x32f6c6['zohoAccounts'][_0x4fa72a['id']])){_0x32f6c6[_0x42cf('0x1b')][_0x4fa72a['id']]=new ZohoAccount(_0x4fa72a);}else{_0x32f6c6['mergeFromDatabase'](_0x32f6c6[_0x42cf('0x1b')][_0x4fa72a['id']],_0x4fa72a);}}}return _0x32f6c6[_0x42cf('0x1b')];};};Realtime[_0x42cf('0x3e')]['initDeskAccounts']=function(){var _0x64cd4d=this;return function(_0x3d962a){if(_0x3d962a){freeIsNotKey(_0x3d962a,_0x64cd4d[_0x42cf('0x1c')],'id');for(var _0x22d7b4=0x0,_0xa3d74c={},_0x5dae76={};_0x22d7b4<_0x3d962a['length'];_0x22d7b4+=0x1){_0xa3d74c=_0x3d962a[_0x22d7b4];if(_['isUndefined'](_0x64cd4d[_0x42cf('0x1c')][_0xa3d74c['id']])){_0x64cd4d[_0x42cf('0x1c')][_0xa3d74c['id']]=new DeskAccount(_0xa3d74c);}else{_0x64cd4d['mergeFromDatabase'](_0x64cd4d[_0x42cf('0x1c')][_0xa3d74c['id']],_0xa3d74c);}}}return _0x64cd4d[_0x42cf('0x1c')];};};Realtime[_0x42cf('0x3e')][_0x42cf('0x4e')]=function(){var _0xbd43cf=this;return function(_0x1849cf){if(_0x1849cf){freeIsNotKey(_0x1849cf,_0xbd43cf[_0x42cf('0x1a')],'id');for(var _0x1be863=0x0,_0x42a905={},_0x56fde8={};_0x1be863<_0x1849cf[_0x42cf('0x43')];_0x1be863+=0x1){_0x42a905=_0x1849cf[_0x1be863];if(_[_0x42cf('0x41')](_0xbd43cf['sugarcrmAccounts'][_0x42a905['id']])){_0xbd43cf[_0x42cf('0x1a')][_0x42a905['id']]=new SugarcrmAccount(_0x42a905);}else{_0xbd43cf[_0x42cf('0x44')](_0xbd43cf[_0x42cf('0x1a')][_0x42a905['id']],_0x42a905);}}}return _0xbd43cf['sugarcrmAccounts'];};};Realtime['prototype']['initVtigerAccounts']=function(){var _0x48fa16=this;return function(_0x377f02){if(_0x377f02){freeIsNotKey(_0x377f02,_0x48fa16[_0x42cf('0x1d')],'id');for(var _0x4ffff6=0x0,_0x29cc8b={},_0x33fff8={};_0x4ffff6<_0x377f02['length'];_0x4ffff6+=0x1){_0x29cc8b=_0x377f02[_0x4ffff6];if(_['isUndefined'](_0x48fa16[_0x42cf('0x1d')][_0x29cc8b['id']])){_0x48fa16['vtigerAccounts'][_0x29cc8b['id']]=new VtigerAccount(_0x29cc8b);}else{_0x48fa16[_0x42cf('0x44')](_0x48fa16[_0x42cf('0x1d')][_0x29cc8b['id']],_0x29cc8b);}}}return _0x48fa16[_0x42cf('0x1d')];};};Realtime['prototype'][_0x42cf('0x4f')]=function(){var _0x42ab25=this;return function(_0x3ebc20){if(_0x3ebc20){freeIsNotKey(_0x3ebc20,_0x42ab25[_0x42cf('0x1e')],'id');for(var _0x38de53=0x0,_0x435d87={},_0x2e4d7c={};_0x38de53<_0x3ebc20[_0x42cf('0x43')];_0x38de53+=0x1){_0x435d87=_0x3ebc20[_0x38de53];if(_[_0x42cf('0x41')](_0x42ab25['servicenowAccounts'][_0x435d87['id']])){_0x42ab25[_0x42cf('0x1e')][_0x435d87['id']]=new ServicenowAccount(_0x435d87);}else{_0x42ab25[_0x42cf('0x44')](_0x42ab25['servicenowAccounts'][_0x435d87['id']],_0x435d87);}}}return _0x42ab25[_0x42cf('0x1e')];};};Realtime[_0x42cf('0x3e')][_0x42cf('0x50')]=function(){var _0x425b1a=this;return function(_0x5f1b44){if(_0x5f1b44){freeIsNotKey(_0x5f1b44,_0x425b1a[_0x42cf('0x1f')],'id');for(var _0x330b77=0x0,_0x32b8d2={},_0x3edbc5={};_0x330b77<_0x5f1b44['length'];_0x330b77+=0x1){_0x32b8d2=_0x5f1b44[_0x330b77];if(_[_0x42cf('0x41')](_0x425b1a[_0x42cf('0x1f')][_0x32b8d2['id']])){_0x425b1a[_0x42cf('0x1f')][_0x32b8d2['id']]=new Dynamics365Account(_0x32b8d2);}else{_0x425b1a[_0x42cf('0x44')](_0x425b1a[_0x42cf('0x1f')][_0x32b8d2['id']],_0x32b8d2);}}}return _0x425b1a[_0x42cf('0x1f')];};};Realtime[_0x42cf('0x3e')][_0x42cf('0x51')]=function(){var _0x6886bb=this;return function(_0x5b76e8){if(_0x5b76e8){freeIsNotKey(_0x5b76e8,_0x6886bb[_0x42cf('0x20')],'id');for(var _0x7574b2=0x0,_0x1668c1={},_0x4ed4f4={};_0x7574b2<_0x5b76e8[_0x42cf('0x43')];_0x7574b2+=0x1){_0x1668c1=_0x5b76e8[_0x7574b2];if(_[_0x42cf('0x41')](_0x6886bb[_0x42cf('0x20')][_0x1668c1['id']])){_0x6886bb[_0x42cf('0x20')][_0x1668c1['id']]=new FreshsalesAccount(_0x1668c1);}else{_0x6886bb[_0x42cf('0x44')](_0x6886bb[_0x42cf('0x20')][_0x1668c1['id']],_0x1668c1);}}}return _0x6886bb[_0x42cf('0x20')];};};Realtime[_0x42cf('0x3e')][_0x42cf('0x52')]=function(){var _0x54f8e5=this;return function(_0x21a66e){for(var _0x25095c=0x0;_0x25095c<_0x21a66e['length'];_0x25095c+=0x1){_['merge'](_0x54f8e5[_0x42cf('0x13')][_0x21a66e[_0x25095c]['name']],_0x21a66e[_0x25095c]);}return _0x54f8e5['voiceQueues'];};};Realtime[_0x42cf('0x3e')][_0x42cf('0x53')]=function(){var _0x51a751=this;return function(_0xbd61e1){clearVoiceQueues(_0x51a751[_0x42cf('0x13')]);if(_0xbd61e1){_0xbd61e1=_[_0x42cf('0x54')](_0xbd61e1,_0x42cf('0x55'));for(var _0x14f7ce in _0xbd61e1){if(_0xbd61e1[_0x42cf('0x21')](_0x14f7ce)){var _0x18c2f3={};for(var _0x525a45=0x0;_0x525a45<_0xbd61e1[_0x14f7ce][_0x42cf('0x43')];_0x525a45+=0x1){var _0x12a95a=_0xbd61e1[_0x14f7ce][_0x525a45][_0x42cf('0x56')];if(_0x51a751[_0x42cf('0x13')][_0x12a95a]){if(_0xbd61e1[_0x14f7ce][_0x525a45][_0x42cf('0x57')]){_0x51a751[_0x42cf('0x13')][_0x12a95a][_0x42cf('0x2e')]+=0x1;}if(_0xbd61e1[_0x14f7ce][_0x525a45][_0x42cf('0x58')]){_0x51a751[_0x42cf('0x13')][_0x12a95a]['abandoned']+=0x1;}_0x51a751[_0x42cf('0x13')][_0x12a95a][_0x42cf('0x29')]+=moment(_0xbd61e1[_0x14f7ce][_0x525a45][_0x42cf('0x59')])[_0x42cf('0x5a')](moment(_0xbd61e1[_0x14f7ce][_0x525a45][_0x42cf('0x5b')]),_0x42cf('0x5c'))||0x0;if(_0x525a45===_0xbd61e1[_0x14f7ce][_0x42cf('0x43')]-0x1){_0x51a751[_0x42cf('0x13')][_0x12a95a][_0x42cf('0x2a')]+=moment(_0xbd61e1[_0x14f7ce][_0x525a45][_0x42cf('0x5d')]||_0xbd61e1[_0x14f7ce][_0x525a45][_0x42cf('0x5e')]||_0xbd61e1[_0x14f7ce][_0x525a45][_0x42cf('0x5f')])[_0x42cf('0x5a')](moment(_0xbd61e1[_0x14f7ce][_0x525a45][_0x42cf('0x5b')]),_0x42cf('0x5c'))||0x0;_0x51a751[_0x42cf('0x13')][_0x12a95a][_0x42cf('0x27')]+=0x1;if(_0xbd61e1[_0x14f7ce][_0x525a45][_0x42cf('0x60')]){_0x51a751[_0x42cf('0x13')][_0x12a95a]['answered']+=0x1;_0x51a751[_0x42cf('0x13')][_0x12a95a][_0x42cf('0x30')]+=moment(_0xbd61e1[_0x14f7ce][_0x525a45]['queuecallercompleteAt'])[_0x42cf('0x5a')](moment(_0xbd61e1[_0x14f7ce][_0x525a45]['queuecallerleaveAt']),_0x42cf('0x5c'))||0x0;}}else{_0x51a751[_0x42cf('0x13')][_0x12a95a][_0x42cf('0x2a')]+=_0x51a751[_0x42cf('0x13')][_0x12a95a]['sumHoldTime']||0x0;}}}}}}return _0x51a751[_0x42cf('0x13')];};};Realtime[_0x42cf('0x3e')][_0x42cf('0x61')]=function(){var _0x58b9d0=this;return function(_0x3f0f62){clearVoiceCallReports(_0x58b9d0[_0x42cf('0x62')]);if(_0x3f0f62){for(var _0x1facd2=0x0;_0x1facd2<_0x3f0f62[_0x42cf('0x43')];_0x1facd2+=0x1){_0x58b9d0[_0x42cf('0x62')][_0x42cf('0x27')]+=0x1;_0x58b9d0[_0x42cf('0x62')][_0x42cf('0x2a')]+=_0x3f0f62[_0x1facd2][_0x42cf('0x63')];if(_0x3f0f62[_0x1facd2][_0x42cf('0x64')]===_0x42cf('0x65')){_0x58b9d0[_0x42cf('0x62')][_0x42cf('0x28')]+=0x1;_0x58b9d0[_0x42cf('0x62')][_0x42cf('0x29')]+=_0x3f0f62[_0x1facd2][_0x42cf('0x63')]-_0x3f0f62[_0x1facd2][_0x42cf('0x66')]||0x0;_0x58b9d0['outbound']['sumBillable']+=_0x3f0f62[_0x1facd2][_0x42cf('0x66')];}}}return _0x58b9d0['outbound'];};};Realtime[_0x42cf('0x3e')][_0x42cf('0x67')]=function(){var _0xb38a42=this;return function(_0x5b28d2){if(_0x5b28d2){freeIsNotKey(_0x5b28d2,_0xb38a42[_0x42cf('0x14')],_0x42cf('0x23'));for(var _0x314864=0x0,_0xbd93a9={};_0x314864<_0x5b28d2[_0x42cf('0x43')];_0x314864+=0x1){_0xbd93a9=_0x5b28d2[_0x314864];if(_[_0x42cf('0x41')](_0xb38a42[_0x42cf('0x14')][_0xbd93a9[_0x42cf('0x23')]])){_0xb38a42[_0x42cf('0x14')][_0xbd93a9['name']]=new Campaign(_0xbd93a9);}else{_0xb38a42['mergeFromDatabase'](_0xb38a42[_0x42cf('0x14')][_0xbd93a9['name']],_0xbd93a9);}}}return _0xb38a42[_0x42cf('0x14')];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x901876=this;return function(_0x4999b3){if(_0x4999b3){freeIsNotKey(_0x4999b3,_0x901876[_0x42cf('0x16')],'id');for(var _0x3a2ae9=0x0,_0x5e58eb={};_0x3a2ae9<_0x4999b3[_0x42cf('0x43')];_0x3a2ae9+=0x1){_0x5e58eb=_0x4999b3[_0x3a2ae9];if(_['isUndefined'](_0x901876['voiceExtensions'][_0x5e58eb['id']])){_0x901876[_0x42cf('0x16')][_0x5e58eb['id']]=new VoiceExtension(_0x5e58eb);}else{_0x901876[_0x42cf('0x44')](_0x901876[_0x42cf('0x16')][_0x5e58eb['id']],_0x5e58eb);}}}return _0x901876[_0x42cf('0x16')];};};Realtime[_0x42cf('0x3e')]['initCampaignHopperHistory']=function(){var _0x22f09f=this;return function(_0x31de56){clearCampaigns(_0x22f09f[_0x42cf('0x14')]);for(var _0x2c7ff4=0x0;_0x2c7ff4<_0x31de56[_0x42cf('0x43')];_0x2c7ff4+=0x1){_[_0x42cf('0x68')](_0x22f09f[_0x42cf('0x14')][_0x31de56[_0x2c7ff4]['name']],_0x31de56[_0x2c7ff4]);}return _0x22f09f[_0x42cf('0x14')];};};Realtime[_0x42cf('0x3e')]['initFaxAccounts']=function(){var _0xc7ffd9=this;return function(_0x30aaa6){if(_0x30aaa6){freeIsNotKey(_0x30aaa6,_0xc7ffd9[_0x42cf('0x69')],'id');for(var _0x472571=0x0,_0x35f456={},_0x4c77b9={};_0x472571<_0x30aaa6[_0x42cf('0x43')];_0x472571+=0x1){_0x35f456=_0x30aaa6[_0x472571];if(_[_0x42cf('0x41')](_0xc7ffd9[_0x42cf('0x69')][_0x35f456['id']])){_0xc7ffd9[_0x42cf('0x69')][_0x35f456['id']]=new FaxAccount(_0x35f456);}else{_0xc7ffd9[_0x42cf('0x44')](_0xc7ffd9[_0x42cf('0x69')][_0x35f456['id']],_0x35f456);}}}return _0xc7ffd9[_0x42cf('0x69')];};};module['exports']=Realtime; \ No newline at end of file +var _0x07d0=['dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','isNil','interface','format','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','name','isUndefined','initTelephones','length','mergeFromDatabase','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','initVoiceQueueReports','groupBy','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','queuecallerexitAt','diff','queuecallercomplete','seconds','initVoiceCallReports','outbound','duration','disposition','billableseconds','initCampaigns','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','bluebird','util','lodash','../model/agent','../model/telephone','../model/voiceQueue','../model/template','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','voiceExtensions','channels','outboundChannels','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts'];(function(_0x2ecd91,_0x1f21e8){var _0x3bf737=function(_0x1563d7){while(--_0x1563d7){_0x2ecd91['push'](_0x2ecd91['shift']());}};_0x3bf737(++_0x1f21e8);}(_0x07d0,0x1ce));var _0x007d=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x07d0[_0x1b6186];return _0x186121;};'use strict';var BPromise=require(_0x007d('0x0'));var util=require(_0x007d('0x1'));var _=require(_0x007d('0x2'));var moment=require('moment');var Agent=require(_0x007d('0x3'));var Telephone=require(_0x007d('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x007d('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x007d('0x6'));var Campaign=require('../model/campaign');var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x007d('0x7'));var FreshdeskAccount=require(_0x007d('0x8'));var SugarcrmAccount=require(_0x007d('0x9'));var ZohoAccount=require(_0x007d('0xa'));var DeskAccount=require(_0x007d('0xb'));var VtigerAccount=require(_0x007d('0xc'));var ServicenowAccount=require(_0x007d('0xd'));var Dynamics365Account=require(_0x007d('0xe'));var FreshsalesAccount=require(_0x007d('0xf'));var FaxAccount=require(_0x007d('0x10'));var Realtime=function(){this[_0x007d('0x11')]={};this[_0x007d('0x12')]={};this[_0x007d('0x13')]={};this['voiceQueues']={};this[_0x007d('0x14')]={};this[_0x007d('0x15')]={};this[_0x007d('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x007d('0x17')]={};this[_0x007d('0x18')]={};this['queueChannels']={};this[_0x007d('0x19')]={};this['timers']={};this['zendeskAccounts']={};this[_0x007d('0x1a')]={};this[_0x007d('0x1b')]={};this[_0x007d('0x1c')]={};this[_0x007d('0x1d')]={};this[_0x007d('0x1e')]={};this[_0x007d('0x1f')]={};this[_0x007d('0x20')]={};this[_0x007d('0x21')]={};this[_0x007d('0x22')]={};this[_0x007d('0x23')]={};};function freeIsNotKey(_0x314341,_0x13b02f,_0x58dc3f){var _0x3a2b03=_[_0x007d('0x24')](_0x314341,function(_0x2866be,_0x2adc7a){return _0x2866be[_0x58dc3f];});for(var _0x541506 in _0x13b02f){if(_0x13b02f[_0x007d('0x25')](_0x541506)){if(!_0x3a2b03[_0x541506]){delete _0x13b02f[_0x541506];}}}}function freeIsNotKeySip(_0x264bac,_0x400403){var _0x11e4cc=_[_0x007d('0x24')](_0x264bac,function(_0x4f55c5,_0x22537d){return util['format'](_0x007d('0x26'),_0x4f55c5['name']);});for(var _0x126b86 in _0x400403){if(_0x400403['hasOwnProperty'](_0x126b86)){if(!_0x11e4cc[_0x126b86]){delete _0x400403[_0x126b86];}}}}function freeIsNotKeyAgent(_0x5503b5,_0x22df36){var _0x588e74=_[_0x007d('0x24')](_0x5503b5,function(_0x4403ab,_0x1753e5){var _0x594e6a=_[_0x007d('0x27')](_0x4403ab[_0x007d('0x28')])?util[_0x007d('0x29')](_0x007d('0x26'),_0x4403ab['name']):_0x4403ab['interface'];return _0x594e6a;});for(var _0x4e82f2 in _0x22df36){if(_0x22df36[_0x007d('0x25')](_0x4e82f2)){if(!_0x588e74[_0x4e82f2]){delete _0x22df36[_0x4e82f2];}}}}function clearVoiceCallReports(_0x186b3b){_0x186b3b['total']=0x0;_0x186b3b[_0x007d('0x2a')]=0x0;_0x186b3b[_0x007d('0x2b')]=0x0;_0x186b3b[_0x007d('0x2c')]=0x0;_0x186b3b[_0x007d('0x2d')]=0x0;}function clearCampaigns(_0x46f422){if(!_[_0x007d('0x2e')](_0x46f422)){for(var _0xa8192e in _0x46f422){if(_0x46f422[_0x007d('0x25')](_0xa8192e)){_0x46f422[_0xa8192e]['ivrTotalCallsDays']=0x0;_0x46f422[_0xa8192e][_0x007d('0x2f')]=0x0;}}}}function clearVoiceQueues(_0xd2e715){if(!_[_0x007d('0x2e')](_0xd2e715)){for(var _0x4efa61 in _0xd2e715){if(_0xd2e715[_0x007d('0x25')](_0x4efa61)){_0xd2e715[_0x4efa61][_0x007d('0x30')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x2a')]=0x0;_0xd2e715[_0x4efa61]['unmanaged']=0x0;_0xd2e715[_0x4efa61][_0x007d('0x31')]=0x0;_0xd2e715[_0x4efa61]['sumHoldTime']=0x0;_0xd2e715[_0x4efa61]['sumDuration']=0x0;_0xd2e715[_0x4efa61]['sumBillable']=0x0;_0xd2e715[_0x4efa61][_0x007d('0x32')]=0x0;_0xd2e715[_0x4efa61]['outboundNoAnswerCallsDay']=0x0;_0xd2e715[_0x4efa61][_0x007d('0x33')]=0x0;_0xd2e715[_0x4efa61]['outboundCongestionCallsDay']=0x0;_0xd2e715[_0x4efa61][_0x007d('0x34')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x35')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x36')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x37')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x38')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x39')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x3a')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x3b')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x32')]=0x0;_0xd2e715[_0x4efa61][_0x007d('0x3c')]=0x0;_0xd2e715[_0x4efa61]['queueStatusComplete']=!![];}}}}Realtime[_0x007d('0x3d')]['mergeFromDatabase']=function(_0x1a0261,_0x193d83){for(var _0x4f6a64 in _0x193d83){if(_0x1a0261[_0x007d('0x25')](_0x4f6a64)){_0x1a0261[_0x4f6a64]=_0x193d83[_0x4f6a64];}}};Realtime[_0x007d('0x3d')]['initAgents']=function(){var _0x106d79=this;return function(_0x26c91a){if(_0x26c91a){freeIsNotKeyAgent(_0x26c91a,_0x106d79[_0x007d('0x11')]);for(var _0x247908=0x0,_0x439e63={},_0x20871f={};_0x247908<_0x26c91a['length'];_0x247908+=0x1){_0x439e63=_0x26c91a[_0x247908];var _0xecd774=_['isNil'](_0x439e63[_0x007d('0x28')])?util[_0x007d('0x29')](_0x007d('0x26'),_0x439e63[_0x007d('0x3e')]):_0x439e63[_0x007d('0x28')];if(_[_0x007d('0x3f')](_0x106d79[_0x007d('0x11')][_0xecd774])){_0x106d79[_0x007d('0x11')][_0xecd774]=new Agent(_0x439e63);}else{_0x106d79['mergeFromDatabase'](_0x106d79[_0x007d('0x11')][_0xecd774],_0x439e63);}}}return _0x106d79[_0x007d('0x11')];};};Realtime[_0x007d('0x3d')][_0x007d('0x40')]=function(){var _0x30be5a=this;return function(_0x2e0bc5){if(_0x2e0bc5){freeIsNotKeySip(_0x2e0bc5,_0x30be5a['telephones']);for(var _0x302cba=0x0,_0x296db5={},_0x4dadbf={};_0x302cba<_0x2e0bc5[_0x007d('0x41')];_0x302cba+=0x1){_0x296db5=_0x2e0bc5[_0x302cba];if(_[_0x007d('0x3f')](_0x30be5a[_0x007d('0x12')][util[_0x007d('0x29')](_0x007d('0x26'),_0x296db5[_0x007d('0x3e')])])){_0x30be5a[_0x007d('0x12')][util[_0x007d('0x29')]('SIP/%s',_0x296db5[_0x007d('0x3e')])]=new Telephone(_0x296db5);}else{_0x30be5a[_0x007d('0x42')](_0x30be5a[_0x007d('0x12')][util[_0x007d('0x29')](_0x007d('0x26'),_0x296db5[_0x007d('0x3e')])],_0x296db5);}}}return _0x30be5a[_0x007d('0x12')];};};Realtime['prototype'][_0x007d('0x43')]=function(){var _0x17412e=this;return function(_0x2427dc){if(_0x2427dc){freeIsNotKeySip(_0x2427dc,_0x17412e['trunks']);for(var _0x5f5763=0x0,_0x2345e6={},_0xde89f3={};_0x5f5763<_0x2427dc[_0x007d('0x41')];_0x5f5763+=0x1){_0x2345e6=_0x2427dc[_0x5f5763];if(_[_0x007d('0x3f')](_0x17412e['trunks'][util[_0x007d('0x29')](_0x007d('0x26'),_0x2345e6['name'])])){_0x17412e[_0x007d('0x13')][util[_0x007d('0x29')](_0x007d('0x26'),_0x2345e6['name'])]=new Trunk(_0x2345e6);}else{_0x17412e[_0x007d('0x42')](_0x17412e[_0x007d('0x13')][util[_0x007d('0x29')]('SIP/%s',_0x2345e6[_0x007d('0x3e')])],_0x2345e6);}}}return _0x17412e['trunks'];};};Realtime[_0x007d('0x3d')][_0x007d('0x44')]=function(){var _0x463920=this;return function(_0x1b937a){if(_0x1b937a){freeIsNotKey(_0x1b937a,_0x463920[_0x007d('0x45')],_0x007d('0x3e'));for(var _0xb2872d=0x0,_0x542de7={},_0x3a755e={};_0xb2872d<_0x1b937a[_0x007d('0x41')];_0xb2872d+=0x1){_0x542de7=_0x1b937a[_0xb2872d];if(_['isUndefined'](_0x463920[_0x007d('0x45')][_0x542de7['name']])){_0x463920[_0x007d('0x45')][_0x542de7['name']]=new VoiceQueue(_0x542de7);}else{_0x463920[_0x007d('0x42')](_0x463920[_0x007d('0x45')][_0x542de7[_0x007d('0x3e')]],_0x542de7);}}}return _0x463920[_0x007d('0x45')];};};Realtime[_0x007d('0x3d')][_0x007d('0x46')]=function(){var _0x2fa851=this;return function(_0x55e7ca){if(_0x55e7ca){freeIsNotKey(_0x55e7ca,_0x2fa851['triggers'],'id');for(var _0x2dee52=0x0,_0x10420a={},_0x629d0={};_0x2dee52<_0x55e7ca[_0x007d('0x41')];_0x2dee52+=0x1){_0x10420a=_0x55e7ca[_0x2dee52];if(_[_0x007d('0x3f')](_0x2fa851[_0x007d('0x14')][_0x10420a['id']])){_0x2fa851[_0x007d('0x14')][_0x10420a['id']]=new Trigger(_0x10420a);}else{_0x2fa851['mergeFromDatabase'](_0x2fa851['triggers'][_0x10420a['id']],_0x10420a);}}}return _0x2fa851['triggers'];};};Realtime[_0x007d('0x3d')]['initTemplates']=function(){var _0x492f91=this;return function(_0x34c44c){if(_0x34c44c){freeIsNotKey(_0x34c44c,_0x492f91[_0x007d('0x16')],'id');for(var _0x6189ed=0x0,_0x1247d0={},_0x10065e={};_0x6189ed<_0x34c44c[_0x007d('0x41')];_0x6189ed+=0x1){_0x1247d0=_0x34c44c[_0x6189ed];if(_[_0x007d('0x3f')](_0x492f91[_0x007d('0x16')][_0x1247d0['id']])){_0x492f91[_0x007d('0x16')][_0x1247d0['id']]=new Template(_0x1247d0);}else{_0x492f91['mergeFromDatabase'](_0x492f91['templates'][_0x1247d0['id']],_0x1247d0);}}}return _0x492f91[_0x007d('0x16')];};};Realtime['prototype'][_0x007d('0x47')]=function(){var _0x3bd785=this;return function(_0x172b5a){if(_0x172b5a){freeIsNotKey(_0x172b5a,_0x3bd785[_0x007d('0x48')],'id');for(var _0x496d4f=0x0,_0x3ef663={},_0x21be59={};_0x496d4f<_0x172b5a[_0x007d('0x41')];_0x496d4f+=0x1){_0x3ef663=_0x172b5a[_0x496d4f];if(_[_0x007d('0x3f')](_0x3bd785[_0x007d('0x48')][_0x3ef663['id']])){_0x3bd785[_0x007d('0x48')][_0x3ef663['id']]=new ZendeskAccount(_0x3ef663);}else{_0x3bd785[_0x007d('0x42')](_0x3bd785[_0x007d('0x48')][_0x3ef663['id']],_0x3ef663);}}}return _0x3bd785[_0x007d('0x48')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x5e36e9=this;return function(_0x244d6a){if(_0x244d6a){freeIsNotKey(_0x244d6a,_0x5e36e9[_0x007d('0x1a')],'id');for(var _0x47fe61=0x0,_0x5efcb0={},_0x17efc0={};_0x47fe61<_0x244d6a[_0x007d('0x41')];_0x47fe61+=0x1){_0x5efcb0=_0x244d6a[_0x47fe61];if(_['isUndefined'](_0x5e36e9['salesforceAccounts'][_0x5efcb0['id']])){_0x5e36e9['salesforceAccounts'][_0x5efcb0['id']]=new SalesforceAccount(_0x5efcb0);}else{_0x5e36e9['mergeFromDatabase'](_0x5e36e9['salesforceAccounts'][_0x5efcb0['id']],_0x5efcb0);}}}return _0x5e36e9[_0x007d('0x1a')];};};Realtime[_0x007d('0x3d')][_0x007d('0x49')]=function(){var _0x1eb0b3=this;return function(_0x4684a5){if(_0x4684a5){freeIsNotKey(_0x4684a5,_0x1eb0b3[_0x007d('0x1c')],'id');for(var _0x56003a=0x0,_0x3450de={},_0x10be15={};_0x56003a<_0x4684a5['length'];_0x56003a+=0x1){_0x3450de=_0x4684a5[_0x56003a];if(_[_0x007d('0x3f')](_0x1eb0b3['freshdeskAccounts'][_0x3450de['id']])){_0x1eb0b3['freshdeskAccounts'][_0x3450de['id']]=new FreshdeskAccount(_0x3450de);}else{_0x1eb0b3[_0x007d('0x42')](_0x1eb0b3[_0x007d('0x1c')][_0x3450de['id']],_0x3450de);}}}return _0x1eb0b3['freshdeskAccounts'];};};Realtime[_0x007d('0x3d')]['initZohoAccounts']=function(){var _0x383b65=this;return function(_0x4d7e2e){if(_0x4d7e2e){freeIsNotKey(_0x4d7e2e,_0x383b65[_0x007d('0x1d')],'id');for(var _0x408e13=0x0,_0x5d01cb={},_0x3c8d5e={};_0x408e13<_0x4d7e2e[_0x007d('0x41')];_0x408e13+=0x1){_0x5d01cb=_0x4d7e2e[_0x408e13];if(_[_0x007d('0x3f')](_0x383b65[_0x007d('0x1d')][_0x5d01cb['id']])){_0x383b65[_0x007d('0x1d')][_0x5d01cb['id']]=new ZohoAccount(_0x5d01cb);}else{_0x383b65['mergeFromDatabase'](_0x383b65[_0x007d('0x1d')][_0x5d01cb['id']],_0x5d01cb);}}}return _0x383b65[_0x007d('0x1d')];};};Realtime[_0x007d('0x3d')]['initDeskAccounts']=function(){var _0x5ba5e5=this;return function(_0x143dc6){if(_0x143dc6){freeIsNotKey(_0x143dc6,_0x5ba5e5[_0x007d('0x1e')],'id');for(var _0x1cb679=0x0,_0x3f4ead={},_0x5a34e4={};_0x1cb679<_0x143dc6[_0x007d('0x41')];_0x1cb679+=0x1){_0x3f4ead=_0x143dc6[_0x1cb679];if(_[_0x007d('0x3f')](_0x5ba5e5[_0x007d('0x1e')][_0x3f4ead['id']])){_0x5ba5e5['deskAccounts'][_0x3f4ead['id']]=new DeskAccount(_0x3f4ead);}else{_0x5ba5e5[_0x007d('0x42')](_0x5ba5e5['deskAccounts'][_0x3f4ead['id']],_0x3f4ead);}}}return _0x5ba5e5[_0x007d('0x1e')];};};Realtime['prototype'][_0x007d('0x4a')]=function(){var _0x262d75=this;return function(_0x459722){if(_0x459722){freeIsNotKey(_0x459722,_0x262d75[_0x007d('0x1b')],'id');for(var _0x44c846=0x0,_0x56b5f1={},_0x521d52={};_0x44c846<_0x459722[_0x007d('0x41')];_0x44c846+=0x1){_0x56b5f1=_0x459722[_0x44c846];if(_[_0x007d('0x3f')](_0x262d75[_0x007d('0x1b')][_0x56b5f1['id']])){_0x262d75[_0x007d('0x1b')][_0x56b5f1['id']]=new SugarcrmAccount(_0x56b5f1);}else{_0x262d75['mergeFromDatabase'](_0x262d75[_0x007d('0x1b')][_0x56b5f1['id']],_0x56b5f1);}}}return _0x262d75['sugarcrmAccounts'];};};Realtime[_0x007d('0x3d')][_0x007d('0x4b')]=function(){var _0x4b1c00=this;return function(_0x156fe5){if(_0x156fe5){freeIsNotKey(_0x156fe5,_0x4b1c00[_0x007d('0x1f')],'id');for(var _0x241ac2=0x0,_0x5058aa={},_0x3d4e5c={};_0x241ac2<_0x156fe5[_0x007d('0x41')];_0x241ac2+=0x1){_0x5058aa=_0x156fe5[_0x241ac2];if(_['isUndefined'](_0x4b1c00[_0x007d('0x1f')][_0x5058aa['id']])){_0x4b1c00[_0x007d('0x1f')][_0x5058aa['id']]=new VtigerAccount(_0x5058aa);}else{_0x4b1c00[_0x007d('0x42')](_0x4b1c00[_0x007d('0x1f')][_0x5058aa['id']],_0x5058aa);}}}return _0x4b1c00[_0x007d('0x1f')];};};Realtime[_0x007d('0x3d')]['initServicenowAccounts']=function(){var _0xb93742=this;return function(_0x1698c3){if(_0x1698c3){freeIsNotKey(_0x1698c3,_0xb93742[_0x007d('0x20')],'id');for(var _0x58ec41=0x0,_0x577cf6={},_0x47e026={};_0x58ec41<_0x1698c3[_0x007d('0x41')];_0x58ec41+=0x1){_0x577cf6=_0x1698c3[_0x58ec41];if(_[_0x007d('0x3f')](_0xb93742[_0x007d('0x20')][_0x577cf6['id']])){_0xb93742[_0x007d('0x20')][_0x577cf6['id']]=new ServicenowAccount(_0x577cf6);}else{_0xb93742[_0x007d('0x42')](_0xb93742[_0x007d('0x20')][_0x577cf6['id']],_0x577cf6);}}}return _0xb93742[_0x007d('0x20')];};};Realtime[_0x007d('0x3d')][_0x007d('0x4c')]=function(){var _0x28c070=this;return function(_0x5b316f){if(_0x5b316f){freeIsNotKey(_0x5b316f,_0x28c070[_0x007d('0x21')],'id');for(var _0x1f2f56=0x0,_0x296ac9={},_0x401b39={};_0x1f2f56<_0x5b316f[_0x007d('0x41')];_0x1f2f56+=0x1){_0x296ac9=_0x5b316f[_0x1f2f56];if(_[_0x007d('0x3f')](_0x28c070['dynamics365Accounts'][_0x296ac9['id']])){_0x28c070[_0x007d('0x21')][_0x296ac9['id']]=new Dynamics365Account(_0x296ac9);}else{_0x28c070[_0x007d('0x42')](_0x28c070['dynamics365Accounts'][_0x296ac9['id']],_0x296ac9);}}}return _0x28c070[_0x007d('0x21')];};};Realtime[_0x007d('0x3d')]['initFreshsalesAccounts']=function(){var _0x4d6603=this;return function(_0x408d0a){if(_0x408d0a){freeIsNotKey(_0x408d0a,_0x4d6603['freshsalesAccounts'],'id');for(var _0x1424d3=0x0,_0xe4e7af={},_0x4c221d={};_0x1424d3<_0x408d0a[_0x007d('0x41')];_0x1424d3+=0x1){_0xe4e7af=_0x408d0a[_0x1424d3];if(_['isUndefined'](_0x4d6603[_0x007d('0x22')][_0xe4e7af['id']])){_0x4d6603[_0x007d('0x22')][_0xe4e7af['id']]=new FreshsalesAccount(_0xe4e7af);}else{_0x4d6603[_0x007d('0x42')](_0x4d6603[_0x007d('0x22')][_0xe4e7af['id']],_0xe4e7af);}}}return _0x4d6603[_0x007d('0x22')];};};Realtime['prototype']['initVoiceQueueHopperHistory']=function(){var _0x5abfc0=this;return function(_0xb8ab2e){for(var _0x29a768=0x0;_0x29a768<_0xb8ab2e[_0x007d('0x41')];_0x29a768+=0x1){_['merge'](_0x5abfc0['voiceQueues'][_0xb8ab2e[_0x29a768][_0x007d('0x3e')]],_0xb8ab2e[_0x29a768]);}return _0x5abfc0[_0x007d('0x45')];};};Realtime[_0x007d('0x3d')][_0x007d('0x4d')]=function(){var _0x2d714a=this;return function(_0x25bb02){clearVoiceQueues(_0x2d714a[_0x007d('0x45')]);if(_0x25bb02){_0x25bb02=_[_0x007d('0x4e')](_0x25bb02,'uniqueid');for(var _0x4587ac in _0x25bb02){if(_0x25bb02[_0x007d('0x25')](_0x4587ac)){var _0x44aac6={};for(var _0x3ed53e=0x0;_0x3ed53e<_0x25bb02[_0x4587ac][_0x007d('0x41')];_0x3ed53e+=0x1){var _0xe9ce91=_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x4f')];if(_0x2d714a['voiceQueues'][_0xe9ce91]){if(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x50')]){_0x2d714a[_0x007d('0x45')][_0xe9ce91]['unmanaged']+=0x1;}if(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x51')]){_0x2d714a['voiceQueues'][_0xe9ce91]['abandoned']+=0x1;}_0x2d714a['voiceQueues'][_0xe9ce91][_0x007d('0x2b')]+=moment(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x52')])['diff'](moment(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x53')]),'seconds')||0x0;if(_0x3ed53e===_0x25bb02[_0x4587ac][_0x007d('0x41')]-0x1){_0x2d714a[_0x007d('0x45')][_0xe9ce91][_0x007d('0x2c')]+=moment(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x54')]||_0x25bb02[_0x4587ac][_0x3ed53e]['queuecallerabandonAt']||_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x55')])[_0x007d('0x56')](moment(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x53')]),'seconds')||0x0;_0x2d714a[_0x007d('0x45')][_0xe9ce91][_0x007d('0x30')]+=0x1;if(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x57')]){_0x2d714a[_0x007d('0x45')][_0xe9ce91]['answered']+=0x1;_0x2d714a[_0x007d('0x45')][_0xe9ce91][_0x007d('0x2d')]+=moment(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x54')])['diff'](moment(_0x25bb02[_0x4587ac][_0x3ed53e][_0x007d('0x52')]),_0x007d('0x58'))||0x0;}}else{_0x2d714a[_0x007d('0x45')][_0xe9ce91][_0x007d('0x2c')]+=_0x2d714a[_0x007d('0x45')][_0xe9ce91][_0x007d('0x2b')]||0x0;}}}}}}return _0x2d714a[_0x007d('0x45')];};};Realtime['prototype'][_0x007d('0x59')]=function(){var _0x2fb0c0=this;return function(_0x38a297){clearVoiceCallReports(_0x2fb0c0[_0x007d('0x5a')]);if(_0x38a297){for(var _0x4871c9=0x0;_0x4871c9<_0x38a297['length'];_0x4871c9+=0x1){_0x2fb0c0[_0x007d('0x5a')][_0x007d('0x30')]+=0x1;_0x2fb0c0['outbound']['sumDuration']+=_0x38a297[_0x4871c9][_0x007d('0x5b')];if(_0x38a297[_0x4871c9][_0x007d('0x5c')]==='ANSWERED'){_0x2fb0c0[_0x007d('0x5a')][_0x007d('0x2a')]+=0x1;_0x2fb0c0[_0x007d('0x5a')]['sumHoldTime']+=_0x38a297[_0x4871c9][_0x007d('0x5b')]-_0x38a297[_0x4871c9][_0x007d('0x5d')]||0x0;_0x2fb0c0['outbound']['sumBillable']+=_0x38a297[_0x4871c9]['billableseconds'];}}}return _0x2fb0c0['outbound'];};};Realtime['prototype'][_0x007d('0x5e')]=function(){var _0x1d1f3a=this;return function(_0x115fa1){if(_0x115fa1){freeIsNotKey(_0x115fa1,_0x1d1f3a['campaigns'],_0x007d('0x3e'));for(var _0x2b04eb=0x0,_0x5c94c7={};_0x2b04eb<_0x115fa1[_0x007d('0x41')];_0x2b04eb+=0x1){_0x5c94c7=_0x115fa1[_0x2b04eb];if(_[_0x007d('0x3f')](_0x1d1f3a['campaigns'][_0x5c94c7[_0x007d('0x3e')]])){_0x1d1f3a[_0x007d('0x15')][_0x5c94c7['name']]=new Campaign(_0x5c94c7);}else{_0x1d1f3a[_0x007d('0x42')](_0x1d1f3a['campaigns'][_0x5c94c7[_0x007d('0x3e')]],_0x5c94c7);}}}return _0x1d1f3a[_0x007d('0x15')];};};Realtime[_0x007d('0x3d')][_0x007d('0x5f')]=function(){var _0x3995a6=this;return function(_0x52926e){if(_0x52926e){freeIsNotKey(_0x52926e,_0x3995a6[_0x007d('0x17')],'id');for(var _0xae1f41=0x0,_0x2698c3={};_0xae1f41<_0x52926e[_0x007d('0x41')];_0xae1f41+=0x1){_0x2698c3=_0x52926e[_0xae1f41];if(_[_0x007d('0x3f')](_0x3995a6['voiceExtensions'][_0x2698c3['id']])){_0x3995a6['voiceExtensions'][_0x2698c3['id']]=new VoiceExtension(_0x2698c3);}else{_0x3995a6[_0x007d('0x42')](_0x3995a6['voiceExtensions'][_0x2698c3['id']],_0x2698c3);}}}return _0x3995a6[_0x007d('0x17')];};};Realtime['prototype'][_0x007d('0x60')]=function(){var _0x4c8ff7=this;return function(_0x3ede9c){clearCampaigns(_0x4c8ff7[_0x007d('0x15')]);for(var _0x47826f=0x0;_0x47826f<_0x3ede9c[_0x007d('0x41')];_0x47826f+=0x1){_[_0x007d('0x61')](_0x4c8ff7[_0x007d('0x15')][_0x3ede9c[_0x47826f][_0x007d('0x3e')]],_0x3ede9c[_0x47826f]);}return _0x4c8ff7[_0x007d('0x15')];};};Realtime[_0x007d('0x3d')][_0x007d('0x62')]=function(){var _0x8e5ab4=this;return function(_0x1f4083){if(_0x1f4083){freeIsNotKey(_0x1f4083,_0x8e5ab4[_0x007d('0x23')],'id');for(var _0x16e4e5=0x0,_0x586cb4={},_0x17334d={};_0x16e4e5<_0x1f4083[_0x007d('0x41')];_0x16e4e5+=0x1){_0x586cb4=_0x1f4083[_0x16e4e5];if(_[_0x007d('0x3f')](_0x8e5ab4[_0x007d('0x23')][_0x586cb4['id']])){_0x8e5ab4[_0x007d('0x23')][_0x586cb4['id']]=new FaxAccount(_0x586cb4);}else{_0x8e5ab4[_0x007d('0x42')](_0x8e5ab4[_0x007d('0x23')][_0x586cb4['id']],_0x586cb4);}}}return _0x8e5ab4[_0x007d('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 69b7c8c..6e2ee22 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 _0xf7b9=['realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','custom:voiceAgentReport','voiceAgentReport','bind','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','assigned','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','callerid','xcally-motion-preview','calleridpreview','calleridnum','channel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitorFilename','monitors','filename','createdAt','connectedlinenum','connectedlinename','membername','isArray','forEach','startsWith','Local','substring','indexOf','phone','lastIndexOf','blindTransfer','exports','bluebird','lodash','moment','util','../../../config/environment','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xf7b9,0xa0));var _0x9f7b=function(_0x34e157,_0x57744d){_0x34e157=_0x34e157-0x0;var _0xab8ee9=_0xf7b9[_0x34e157];return _0xab8ee9;};'use strict';var BPromise=require(_0x9f7b('0x0'));var _=require(_0x9f7b('0x1'));var moment=require(_0x9f7b('0x2'));var util=require(_0x9f7b('0x3'));var config=require(_0x9f7b('0x4'));var logger=require('../../../config/logger')(_0x9f7b('0x5'));var ami=require(_0x9f7b('0x6'));var RpcVoiceAgentReport=require(_0x9f7b('0x7'));var RpcVoiceCallReport=require(_0x9f7b('0x8'));var RpcVoiceDialReport=require(_0x9f7b('0x9'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0x9f7b('0xa'));var RpcVoiceRecording=require(_0x9f7b('0xb'));var RpcVoiceTransferReport=require(_0x9f7b('0xc'));var VoiceQueueReport=require(_0x9f7b('0xd'));var VoiceCallReport=require(_0x9f7b('0xe'));var VoiceAgentReport=require(_0x9f7b('0xf'));var VoiceDialReport=require(_0x9f7b('0x10'));var UserReport=require(_0x9f7b('0x11'));function Report(_0xe469bb){this[_0x9f7b('0x12')]=_0xe469bb;this[_0x9f7b('0x13')]=_0xe469bb['agents'];this[_0x9f7b('0x14')]=_0xe469bb['telephones'];}Report[_0x9f7b('0x15')][_0x9f7b('0x16')]=function(_0x50525a){var _0x202437=new VoiceQueueReport(this[_0x9f7b('0x12')]);var _0x96efb3=new VoiceAgentReport(this[_0x9f7b('0x12')]);var _0x3647aa=new VoiceDialReport(this[_0x9f7b('0x12')]);var _0x24b4ec=new VoiceCallReport(this[_0x9f7b('0x12')]);var _0x476f85=new UserReport(this[_0x9f7b('0x12')]);if(config[_0x9f7b('0x17')]&&config[_0x9f7b('0x17')][_0x9f7b('0x18')]){ami['on'](_0x9f7b('0x19'),this[_0x9f7b('0x1a')]['bind'](this));ami['on'](_0x9f7b('0x1b'),this['voiceCallReport']['bind'](this));ami['on'](_0x9f7b('0x1c'),this[_0x9f7b('0x1d')][_0x9f7b('0x1e')](this));ami['on'](_0x9f7b('0x1f'),this[_0x9f7b('0x20')][_0x9f7b('0x1e')](this));ami['on'](_0x9f7b('0x21'),this['blindTransfer'][_0x9f7b('0x1e')](this));ami['on']('attendedtransfer',this[_0x9f7b('0x22')][_0x9f7b('0x1e')](this));}};Report[_0x9f7b('0x15')][_0x9f7b('0x23')]=function(_0x332ada){var _0x3d2d11=undefined;_0x3d2d11=_[_0x9f7b('0x24')](this[_0x9f7b('0x13')],function(_0x4c5699){return _0x4c5699[_0x9f7b('0x25')]==_0x332ada||_0x4c5699[_0x9f7b('0x26')]==_0x332ada;});if(_[_0x9f7b('0x27')](_0x3d2d11)){var _0x547d25=_[_0x9f7b('0x24')](this['telephones'],function(_0x1dc2ac){return _0x1dc2ac['accountcode']==_0x332ada||_0x1dc2ac['name']==_0x332ada;});if(_0x547d25){_0x3d2d11=_['find'](this[_0x9f7b('0x13')],function(_0x2d8afb){return _0x2d8afb[_0x9f7b('0x28')]==util[_0x9f7b('0x29')](_0x9f7b('0x2a'),_0x547d25[_0x9f7b('0x26')]);});}}return _0x3d2d11;};Report[_0x9f7b('0x15')][_0x9f7b('0x1a')]=function(_0x4f0842){for(var _0x189aac=0x0;_0x189aac<_0x4f0842[_0x9f7b('0x2b')];_0x189aac+=0x1){var _0x94277a=this[_0x9f7b('0x23')](_0x4f0842[_0x189aac]['connectedlinenum']);if(_0x94277a){_0x4f0842[_0x189aac][_0x9f7b('0x25')]=_0x94277a[_0x9f7b('0x25')];_0x4f0842[_0x189aac][_0x9f7b('0x2c')]=!![];_0x4f0842[_0x189aac]['lastAssignedTo']=_0x94277a[_0x9f7b('0x26')];_0x4f0842[_0x189aac][_0x9f7b('0x28')]=_['isNil'](_0x94277a[_0x9f7b('0x28')])?util[_0x9f7b('0x29')]('SIP/%s',_0x94277a['name']):_0x94277a[_0x9f7b('0x28')];if(_0x4f0842[_0x189aac][_0x9f7b('0x2d')]){_0x4f0842[_0x189aac][_0x9f7b('0x2e')]=moment()[_0x9f7b('0x29')](_0x9f7b('0x2f'));}if(_0x4f0842[_0x189aac][_0x9f7b('0x30')]){_0x4f0842[_0x189aac][_0x9f7b('0x31')]=moment()[_0x9f7b('0x29')](_0x9f7b('0x2f'));}RpcMemberReport[_0x9f7b('0x1a')](_0x4f0842[_0x189aac]);}RpcVoiceQueueReport[_0x9f7b('0x32')](_0x4f0842[_0x189aac]);}};function extractCalleridNumber(_0x2c9ce8){var _0x25e637=_0x2c9ce8[_0x9f7b('0x33')](/<(.*?)>/);return _0x25e637?_0x25e637[0x1]:_0x2c9ce8;}Report[_0x9f7b('0x15')][_0x9f7b('0x34')]=function(_0x48eeb5){_0x48eeb5[_0x9f7b('0x35')]=_0x48eeb5['destination']||_0x48eeb5[_0x9f7b('0x36')];if(_0x48eeb5[_0x9f7b('0x37')]==_0x9f7b('0x38')){_0x48eeb5[_0x9f7b('0x39')]=_0x9f7b('0x3a');_0x48eeb5[_0x9f7b('0x3b')]=_0x48eeb5[_0x9f7b('0x3a')];if(_0x48eeb5[_0x9f7b('0x3c')]=='from-voip-provider'){_0x48eeb5[_0x9f7b('0x25')]='';_0x48eeb5['destination']=extractCalleridNumber(_0x48eeb5[_0x9f7b('0x3d')]);}else if(_0x48eeb5[_0x9f7b('0x3c')]=='from-sip'){if(_0x48eeb5['destination']==_0x9f7b('0x3e')){_0x48eeb5[_0x9f7b('0x35')]=extractCalleridNumber(_0x48eeb5[_0x9f7b('0x3f')]);_0x48eeb5[_0x9f7b('0x40')]=_0x48eeb5['originatecalleridnum'];_0x48eeb5['destinationchannel']=[_0x48eeb5[_0x9f7b('0x41')],_0x48eeb5[_0x9f7b('0x41')]=_0x48eeb5['destinationchannel']][0x0];_0x48eeb5[_0x9f7b('0x3d')]=_0x48eeb5['calleridpreview'];}else{_0x48eeb5['destination']=_0x48eeb5[_0x9f7b('0x40')];_0x48eeb5[_0x9f7b('0x40')]=_0x48eeb5[_0x9f7b('0x42')];if(_0x48eeb5[_0x9f7b('0x43')]==_0x9f7b('0x44')){_0x48eeb5[_0x9f7b('0x25')]=_0x48eeb5['connectedlinenum'];}else{_0x48eeb5[_0x9f7b('0x25')]='';}}}}else{_0x48eeb5[_0x9f7b('0x3d')]=util[_0x9f7b('0x29')](_0x9f7b('0x45'),_0x48eeb5[_0x9f7b('0x46')],_0x48eeb5[_0x9f7b('0x40')]);}RpcVoiceCallReport[_0x9f7b('0x32')](_0x48eeb5);if(_0x48eeb5[_0x9f7b('0x47')]){for(var _0x50eaea=0x0;_0x50eaea<_0x48eeb5['monitors'][_0x9f7b('0x2b')];_0x50eaea+=0x1){_0x48eeb5[_0x9f7b('0x48')]=_0x48eeb5[_0x9f7b('0x49')][_0x50eaea][_0x9f7b('0x4a')];_0x48eeb5[_0x9f7b('0x4b')]=_0x48eeb5[_0x9f7b('0x49')][_0x50eaea][_0x9f7b('0x4b')];if(_0x48eeb5['exten']=='xcally-motion-preview'){_0x48eeb5['calleridnum']=_0x48eeb5[_0x9f7b('0x4c')];_0x48eeb5[_0x9f7b('0x46')]=_0x48eeb5['connectedlinename'];_0x48eeb5[_0x9f7b('0x4c')]=_0x48eeb5['accountcode'];_0x48eeb5[_0x9f7b('0x4d')]=_0x48eeb5[_0x9f7b('0x4e')];_0x48eeb5[_0x9f7b('0x36')]=_0x48eeb5[_0x9f7b('0x42')];}else if(_0x48eeb5[_0x9f7b('0x36')]=='xcally-motion-dialer'){_0x48eeb5[_0x9f7b('0x40')]=_0x48eeb5[_0x9f7b('0x35')];_0x48eeb5[_0x9f7b('0x36')]=_0x48eeb5['originatecalleridnum'];}RpcVoiceRecording['create'](_0x48eeb5);}}};Report[_0x9f7b('0x15')]['voiceAgentReport']=function(_0x35b73b){if(_[_0x9f7b('0x4f')](_0x35b73b)){_0x35b73b[_0x9f7b('0x50')](function(_0x49bd8c){RpcVoiceAgentReport['create'](_0x49bd8c);});}else{RpcVoiceAgentReport['create'](_0x35b73b);}};Report[_0x9f7b('0x15')][_0x9f7b('0x20')]=function(_0x735345){RpcVoiceDialReport[_0x9f7b('0x32')](_0x735345);var _0x3b0682=undefined;var _0x15ca3b=_0x735345[_0x9f7b('0x41')];if(_[_0x9f7b('0x51')](_0x15ca3b,_0x9f7b('0x52'))){var _0x202f75=_0x15ca3b[_0x9f7b('0x53')](_0x15ca3b[_0x9f7b('0x54')]('/')+0x1,_0x15ca3b[_0x9f7b('0x54')]('@'));_0x3b0682=_[_0x9f7b('0x24')](this['agents'],function(_0x20dab6){return _0x20dab6['mobile']==_0x202f75||_0x20dab6[_0x9f7b('0x55')]==_0x202f75||_0x20dab6[_0x9f7b('0x25')]==_0x202f75;});}else{var _0x202f75=_0x15ca3b[_0x9f7b('0x53')](_0x15ca3b[_0x9f7b('0x54')]('/')+0x1,_0x15ca3b[_0x9f7b('0x56')]('-'));_0x3b0682=this['findAgent'](_0x202f75);}if(_0x3b0682){_0x735345[_0x9f7b('0x28')]=_[_0x9f7b('0x27')](_0x3b0682[_0x9f7b('0x28')])?util[_0x9f7b('0x29')](_0x9f7b('0x2a'),_0x3b0682['name']):_0x3b0682[_0x9f7b('0x28')];_0x735345[_0x9f7b('0x4e')]=_0x3b0682['name'];_0x735345[_0x9f7b('0x25')]=_0x3b0682['accountcode'];RpcMemberReport['voiceDialReport'](_0x735345);}};Report[_0x9f7b('0x15')][_0x9f7b('0x57')]=function(_0x2e06ad){RpcVoiceTransferReport[_0x9f7b('0x57')](_0x2e06ad);};Report[_0x9f7b('0x15')][_0x9f7b('0x22')]=function(_0x3565ca){RpcVoiceTransferReport[_0x9f7b('0x22')](_0x3565ca);};module[_0x9f7b('0x58')]=Report; \ No newline at end of file +var _0xd28b=['destination','exten','type','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','destinationchannel','channel','calleridname','create','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','forEach','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','membername','exports','bluebird','lodash','moment','../../../config/environment','../../../config/logger','ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','name','isNil','accountcode','interface','format','length','findAgent','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','match'];(function(_0x206f64,_0x43e3d1){var _0xfb2f91=function(_0x241ab5){while(--_0x241ab5){_0x206f64['push'](_0x206f64['shift']());}};_0xfb2f91(++_0x43e3d1);}(_0xd28b,0x182));var _0xbd28=function(_0x2089b3,_0x31fbde){_0x2089b3=_0x2089b3-0x0;var _0x181087=_0xd28b[_0x2089b3];return _0x181087;};'use strict';var BPromise=require(_0xbd28('0x0'));var _=require(_0xbd28('0x1'));var moment=require(_0xbd28('0x2'));var util=require('util');var config=require(_0xbd28('0x3'));var logger=require(_0xbd28('0x4'))(_0xbd28('0x5'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xbd28('0x6'));var RpcVoiceCallReport=require(_0xbd28('0x7'));var RpcVoiceDialReport=require(_0xbd28('0x8'));var RpcMemberReport=require(_0xbd28('0x9'));var RpcVoiceQueueReport=require(_0xbd28('0xa'));var RpcVoiceRecording=require(_0xbd28('0xb'));var RpcVoiceTransferReport=require(_0xbd28('0xc'));var VoiceQueueReport=require(_0xbd28('0xd'));var VoiceCallReport=require(_0xbd28('0xe'));var VoiceAgentReport=require(_0xbd28('0xf'));var VoiceDialReport=require(_0xbd28('0x10'));var UserReport=require(_0xbd28('0x11'));function Report(_0x196c57){this['realtime']=_0x196c57;this[_0xbd28('0x12')]=_0x196c57[_0xbd28('0x12')];this[_0xbd28('0x13')]=_0x196c57['telephones'];}Report[_0xbd28('0x14')]['sync']=function(_0x1425c4){var _0x17cd28=new VoiceQueueReport(this[_0xbd28('0x15')]);var _0xdf4bab=new VoiceAgentReport(this[_0xbd28('0x15')]);var _0x40291b=new VoiceDialReport(this['realtime']);var _0x2d69af=new VoiceCallReport(this[_0xbd28('0x15')]);var _0x174b81=new UserReport(this[_0xbd28('0x15')]);if(config[_0xbd28('0x16')]&&config['xdr'][_0xbd28('0x17')]){ami['on'](_0xbd28('0x18'),this[_0xbd28('0x19')][_0xbd28('0x1a')](this));ami['on'](_0xbd28('0x1b'),this[_0xbd28('0x1c')][_0xbd28('0x1a')](this));ami['on'](_0xbd28('0x1d'),this[_0xbd28('0x1e')][_0xbd28('0x1a')](this));ami['on'](_0xbd28('0x1f'),this[_0xbd28('0x20')][_0xbd28('0x1a')](this));ami['on'](_0xbd28('0x21'),this[_0xbd28('0x22')]['bind'](this));ami['on'](_0xbd28('0x23'),this[_0xbd28('0x24')]['bind'](this));}};Report[_0xbd28('0x14')]['findAgent']=function(_0x2a49d1){var _0x48f13a=undefined;_0x48f13a=_[_0xbd28('0x25')](this[_0xbd28('0x12')],function(_0x57ec8b){return _0x57ec8b['accountcode']==_0x2a49d1||_0x57ec8b[_0xbd28('0x26')]==_0x2a49d1;});if(_[_0xbd28('0x27')](_0x48f13a)){var _0x165523=_[_0xbd28('0x25')](this[_0xbd28('0x13')],function(_0x5344b9){return _0x5344b9[_0xbd28('0x28')]==_0x2a49d1||_0x5344b9[_0xbd28('0x26')]==_0x2a49d1;});if(_0x165523){_0x48f13a=_[_0xbd28('0x25')](this[_0xbd28('0x12')],function(_0xedd4bb){return _0xedd4bb[_0xbd28('0x29')]==util[_0xbd28('0x2a')]('SIP/%s',_0x165523['name']);});}}return _0x48f13a;};Report[_0xbd28('0x14')][_0xbd28('0x19')]=function(_0x2d3d67){for(var _0x55146f=0x0;_0x55146f<_0x2d3d67[_0xbd28('0x2b')];_0x55146f+=0x1){var _0x3bfb72=this[_0xbd28('0x2c')](_0x2d3d67[_0x55146f][_0xbd28('0x2d')]);if(_0x3bfb72){_0x2d3d67[_0x55146f][_0xbd28('0x28')]=_0x3bfb72[_0xbd28('0x28')];_0x2d3d67[_0x55146f][_0xbd28('0x2e')]=!![];_0x2d3d67[_0x55146f][_0xbd28('0x2f')]=_0x3bfb72['name'];_0x2d3d67[_0x55146f][_0xbd28('0x29')]=_[_0xbd28('0x27')](_0x3bfb72[_0xbd28('0x29')])?util[_0xbd28('0x2a')](_0xbd28('0x30'),_0x3bfb72['name']):_0x3bfb72['interface'];if(_0x2d3d67[_0x55146f][_0xbd28('0x31')]){_0x2d3d67[_0x55146f][_0xbd28('0x32')]=moment()[_0xbd28('0x2a')](_0xbd28('0x33'));}if(_0x2d3d67[_0x55146f][_0xbd28('0x34')]){_0x2d3d67[_0x55146f]['queuecallerexitAt']=moment()['format'](_0xbd28('0x33'));}RpcMemberReport['voiceQueueReport'](_0x2d3d67[_0x55146f]);}RpcVoiceQueueReport['create'](_0x2d3d67[_0x55146f]);}};function extractCalleridNumber(_0x23aefc){var _0x521d06=_0x23aefc[_0xbd28('0x35')](/<(.*?)>/);return _0x521d06?_0x521d06[0x1]:_0x23aefc;}Report[_0xbd28('0x14')][_0xbd28('0x1c')]=function(_0x5e0fbe){_0x5e0fbe[_0xbd28('0x36')]=_0x5e0fbe['destination']||_0x5e0fbe[_0xbd28('0x37')];if(_0x5e0fbe[_0xbd28('0x38')]=='dialer'){_0x5e0fbe[_0xbd28('0x39')]=_0xbd28('0x3a');_0x5e0fbe[_0xbd28('0x3b')]=_0x5e0fbe[_0xbd28('0x3a')];if(_0x5e0fbe[_0xbd28('0x3c')]==_0xbd28('0x3d')){_0x5e0fbe['accountcode']='';_0x5e0fbe['destination']=extractCalleridNumber(_0x5e0fbe[_0xbd28('0x3e')]);}else if(_0x5e0fbe['context']==_0xbd28('0x3f')){if(_0x5e0fbe['destination']==_0xbd28('0x40')){_0x5e0fbe[_0xbd28('0x36')]=extractCalleridNumber(_0x5e0fbe[_0xbd28('0x41')]);_0x5e0fbe[_0xbd28('0x42')]=_0x5e0fbe['originatecalleridnum'];_0x5e0fbe[_0xbd28('0x43')]=[_0x5e0fbe[_0xbd28('0x44')],_0x5e0fbe[_0xbd28('0x44')]=_0x5e0fbe['destinationchannel']][0x0];_0x5e0fbe[_0xbd28('0x3e')]=_0x5e0fbe[_0xbd28('0x41')];}else{_0x5e0fbe[_0xbd28('0x36')]=_0x5e0fbe[_0xbd28('0x42')];_0x5e0fbe['calleridnum']=_0x5e0fbe['originatecalleridnum'];if(_0x5e0fbe['disposition']=='ANSWERED'){_0x5e0fbe[_0xbd28('0x28')]=_0x5e0fbe[_0xbd28('0x2d')];}else{_0x5e0fbe[_0xbd28('0x28')]='';}}}}else{_0x5e0fbe[_0xbd28('0x3e')]=util['format']('\x22%s\x22\x20<%s>',_0x5e0fbe[_0xbd28('0x45')],_0x5e0fbe[_0xbd28('0x42')]);}RpcVoiceCallReport[_0xbd28('0x46')](_0x5e0fbe);if(_0x5e0fbe[_0xbd28('0x47')]){for(var _0x5545b6=0x0;_0x5545b6<_0x5e0fbe[_0xbd28('0x48')][_0xbd28('0x2b')];_0x5545b6+=0x1){_0x5e0fbe[_0xbd28('0x49')]=_0x5e0fbe[_0xbd28('0x48')][_0x5545b6][_0xbd28('0x4a')];_0x5e0fbe[_0xbd28('0x4b')]=_0x5e0fbe[_0xbd28('0x48')][_0x5545b6][_0xbd28('0x4b')];if(_0x5e0fbe[_0xbd28('0x37')]==_0xbd28('0x40')){_0x5e0fbe[_0xbd28('0x42')]=_0x5e0fbe[_0xbd28('0x2d')];_0x5e0fbe[_0xbd28('0x45')]=_0x5e0fbe[_0xbd28('0x4c')];_0x5e0fbe['connectedlinenum']=_0x5e0fbe[_0xbd28('0x28')];_0x5e0fbe['connectedlinename']=_0x5e0fbe['membername'];_0x5e0fbe['exten']=_0x5e0fbe['originatecalleridnum'];}else if(_0x5e0fbe[_0xbd28('0x37')]==_0xbd28('0x4d')){_0x5e0fbe[_0xbd28('0x42')]=_0x5e0fbe[_0xbd28('0x36')];_0x5e0fbe[_0xbd28('0x37')]=_0x5e0fbe['originatecalleridnum'];}RpcVoiceRecording[_0xbd28('0x46')](_0x5e0fbe);}}};Report[_0xbd28('0x14')][_0xbd28('0x1e')]=function(_0x52e7ac){if(_['isArray'](_0x52e7ac)){_0x52e7ac[_0xbd28('0x4e')](function(_0x1d764e){RpcVoiceAgentReport[_0xbd28('0x46')](_0x1d764e);});}else{RpcVoiceAgentReport[_0xbd28('0x46')](_0x52e7ac);}};Report[_0xbd28('0x14')][_0xbd28('0x20')]=function(_0x2e7b6a){RpcVoiceDialReport[_0xbd28('0x46')](_0x2e7b6a);var _0x17841d=undefined;var _0x4a3327=_0x2e7b6a['channel'];if(_[_0xbd28('0x4f')](_0x4a3327,_0xbd28('0x50'))){var _0x20f9bf=_0x4a3327[_0xbd28('0x51')](_0x4a3327[_0xbd28('0x52')]('/')+0x1,_0x4a3327[_0xbd28('0x52')]('@'));_0x17841d=_[_0xbd28('0x25')](this[_0xbd28('0x12')],function(_0x314491){return _0x314491[_0xbd28('0x53')]==_0x20f9bf||_0x314491[_0xbd28('0x54')]==_0x20f9bf||_0x314491[_0xbd28('0x28')]==_0x20f9bf;});}else{var _0x20f9bf=_0x4a3327[_0xbd28('0x51')](_0x4a3327[_0xbd28('0x52')]('/')+0x1,_0x4a3327[_0xbd28('0x55')]('-'));_0x17841d=this[_0xbd28('0x2c')](_0x20f9bf);}if(_0x17841d){_0x2e7b6a['interface']=_[_0xbd28('0x27')](_0x17841d[_0xbd28('0x29')])?util[_0xbd28('0x2a')](_0xbd28('0x30'),_0x17841d['name']):_0x17841d[_0xbd28('0x29')];_0x2e7b6a[_0xbd28('0x56')]=_0x17841d[_0xbd28('0x26')];_0x2e7b6a[_0xbd28('0x28')]=_0x17841d[_0xbd28('0x28')];RpcMemberReport['voiceDialReport'](_0x2e7b6a);}};Report[_0xbd28('0x14')]['blindTransfer']=function(_0x176edb){RpcVoiceTransferReport[_0xbd28('0x22')](_0x176edb);};Report[_0xbd28('0x14')]['attendedTransfer']=function(_0x5ca625){RpcVoiceTransferReport[_0xbd28('0x24')](_0x5ca625);};module[_0xbd28('0x57')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 8271cc7..82b90cb 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 _0x5c10=['telephone:save','trunks','startsWith','Queue','Local','substring','mobile','phone','[syncDeviceState][UserReport]','peer','status','address','telephone:%s','[syncPeerStatus][UserReport]','lodash','moment','bluebird','util','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','agents','telephones','registryentry','syncRegistry','devicestatechange','syncDeviceState','bind','peerstatus','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionDeviceStateList','actionSipPeerStatus','[loopSyncRealTimeShow]','error','inspect','prototype','catch','isUndefined','emit','stateRegistry','state','omit','event','actionid','format','trunk:%s','trunk:save','[syncRegistry][UserReport]','isNotNull','device','local','inuse','stateTime','toNumber','toLowerCase','updateStatusRealtime','name'];(function(_0x6e51f1,_0x11371a){var _0x141b4c=function(_0x2e85e7){while(--_0x2e85e7){_0x6e51f1['push'](_0x6e51f1['shift']());}};_0x141b4c(++_0x11371a);}(_0x5c10,0x18e));var _0x05c1=function(_0x1cbaeb,_0x300003){_0x1cbaeb=_0x1cbaeb-0x0;var _0x3e7d2e=_0x5c10[_0x1cbaeb];return _0x3e7d2e;};'use strict';var _=require(_0x05c1('0x0'));var moment=require(_0x05c1('0x1'));var BPromise=require(_0x05c1('0x2'));var util=require(_0x05c1('0x3'));var Redis=require('ioredis');var config=require(_0x05c1('0x4'));var logger=require(_0x05c1('0x5'))(_0x05c1('0x6'));var ami=require(_0x05c1('0x7'));config['redis']=_['defaults'](config[_0x05c1('0x8')],{'host':_0x05c1('0x9'),'port':0x18eb});var io=require(_0x05c1('0xa'))(new Redis(config[_0x05c1('0x8')]));function UserReport(_0x5aba64){this['trunks']=_0x5aba64['trunks'];this['agents']=_0x5aba64[_0x05c1('0xb')];this[_0x05c1('0xc')]=_0x5aba64[_0x05c1('0xc')];ami['on'](_0x05c1('0xd'),this[_0x05c1('0xe')]['bind'](this));ami['on']('registry',this[_0x05c1('0xe')]['bind'](this));ami['on'](_0x05c1('0xf'),this[_0x05c1('0x10')][_0x05c1('0x11')](this));ami['on'](_0x05c1('0x12'),this[_0x05c1('0x13')][_0x05c1('0x11')](this));this[_0x05c1('0x14')]();return BPromise[_0x05c1('0x15')]()[_0x05c1('0x16')](ami['actionSipShowRegistry']())[_0x05c1('0x16')](ami[_0x05c1('0x17')]())[_0x05c1('0x16')](ami[_0x05c1('0x18')]())['catch'](loggerCatch(_0x05c1('0x19')));}function loggerCatch(_0x242230){return function(_0x29e1a7){logger[_0x05c1('0x1a')](_0x242230,util[_0x05c1('0x1b')](_0x29e1a7,{'showHidden':![],'depth':null}));};}UserReport[_0x05c1('0x1c')][_0x05c1('0x14')]=function(){setInterval(function(){BPromise[_0x05c1('0x15')]()['then'](ami['actionSipShowRegistry']())[_0x05c1('0x16')](ami['actionDeviceStateList']())['then'](ami[_0x05c1('0x18')]())[_0x05c1('0x1d')](loggerCatch(_0x05c1('0x19')));},0x32c8);};UserReport[_0x05c1('0x1c')]['isNotNull']=function(_0x3da95f){return _0x3da95f!==null&&!_[_0x05c1('0x1e')](_0x3da95f);};UserReport[_0x05c1('0x1c')][_0x05c1('0x1f')]=function(_0x2e0447,_0x8bada,_0x2d39d3){io['to'](_0x2e0447)[_0x05c1('0x1f')](_0x8bada,_0x2d39d3);};UserReport[_0x05c1('0x1c')][_0x05c1('0xe')]=function(_0x3b89e6){try{if(this['isNotNull'](_0x3b89e6)){var _0x1c3dfe=_['find'](this['trunks'],{'registry':_0x3b89e6['username']});if(_0x1c3dfe){_0x3b89e6[_0x05c1('0x20')]=_0x3b89e6[_0x05c1('0x21')];_['merge'](_0x1c3dfe,_[_0x05c1('0x22')](_0x3b89e6,[_0x05c1('0x23'),_0x05c1('0x24'),'username',_0x05c1('0x21')]));this['emit'](util[_0x05c1('0x25')](_0x05c1('0x26'),_0x1c3dfe['name']),_0x05c1('0x27'),_0x1c3dfe);}}}catch(_0x2c383c){logger['error'](_0x05c1('0x28'),util[_0x05c1('0x1b')](_0x2c383c,{'showHidden':![],'depth':null}));}};UserReport[_0x05c1('0x1c')][_0x05c1('0x10')]=function(_0x481304){try{if(this[_0x05c1('0x29')](_0x481304)){if(this[_0x05c1('0xb')][_0x481304[_0x05c1('0x2a')]]){if(!this[_0x05c1('0xb')][_0x481304[_0x05c1('0x2a')]][_0x05c1('0x2b')]||_0x481304[_0x05c1('0x21')]['toLowerCase']()==_0x05c1('0x2c')){this[_0x05c1('0xb')][_0x481304['device']][_0x05c1('0x2b')]=![];if(this[_0x05c1('0xb')][_0x481304[_0x05c1('0x2a')]][_0x05c1('0x21')]!==_0x481304['state']['toLowerCase']()){this[_0x05c1('0xb')][_0x481304[_0x05c1('0x2a')]][_0x05c1('0x2d')]=_[_0x05c1('0x2e')](moment()['format']('x'));}this[_0x05c1('0xb')][_0x481304[_0x05c1('0x2a')]][_0x05c1('0x21')]=_0x481304['state'][_0x05c1('0x2f')]();this[_0x05c1('0xb')][_0x481304[_0x05c1('0x2a')]][_0x05c1('0x30')](_0x481304);}}else if(this[_0x05c1('0xc')][_0x481304[_0x05c1('0x2a')]]){if(this[_0x05c1('0xc')][_0x481304[_0x05c1('0x2a')]]['state']!==_0x481304[_0x05c1('0x21')][_0x05c1('0x2f')]()){this[_0x05c1('0xc')][_0x481304[_0x05c1('0x2a')]][_0x05c1('0x2d')]=_[_0x05c1('0x2e')](moment()[_0x05c1('0x25')]('x'));}this[_0x05c1('0xc')][_0x481304[_0x05c1('0x2a')]][_0x05c1('0x21')]=_0x481304[_0x05c1('0x21')]['toLowerCase']();this[_0x05c1('0x1f')](util['format']('telephone:%s',this[_0x05c1('0xc')][_0x481304[_0x05c1('0x2a')]][_0x05c1('0x31')]),_0x05c1('0x32'),this['telephones'][_0x481304[_0x05c1('0x2a')]]);}else if(this[_0x05c1('0x33')][_0x481304[_0x05c1('0x2a')]]){if(this[_0x05c1('0x33')][_0x481304[_0x05c1('0x2a')]]['state']!==_0x481304[_0x05c1('0x21')][_0x05c1('0x2f')]()){this[_0x05c1('0x33')][_0x481304[_0x05c1('0x2a')]]['stateTime']=_[_0x05c1('0x2e')](moment()['format']('x'));}this[_0x05c1('0x33')][_0x481304[_0x05c1('0x2a')]][_0x05c1('0x21')]=_0x481304[_0x05c1('0x21')][_0x05c1('0x2f')]();this[_0x05c1('0x1f')](util[_0x05c1('0x25')]('trunk:%s',this['trunks'][_0x481304[_0x05c1('0x2a')]][_0x05c1('0x31')]),_0x05c1('0x27'),this[_0x05c1('0x33')][_0x481304[_0x05c1('0x2a')]]);}else if(_[_0x05c1('0x34')](_0x481304['device'],_0x05c1('0x35'))){}else if(_['startsWith'](_0x481304['device'],_0x05c1('0x36'))){var _0x5e42f1=_0x481304[_0x05c1('0x2a')];var _0x4abdcb=_0x5e42f1[_0x05c1('0x37')](_0x5e42f1['indexOf']('/')+0x1,_0x5e42f1['indexOf']('@'));var _0x392c2c=_['find'](this[_0x05c1('0xb')],function(_0x1c1ffa){return _0x1c1ffa[_0x05c1('0x38')]==_0x4abdcb||_0x1c1ffa[_0x05c1('0x39')]==_0x4abdcb||_0x1c1ffa['accountcode']==_0x4abdcb;});if(_0x392c2c){if(_0x392c2c[_0x05c1('0x21')]!==_0x481304[_0x05c1('0x21')][_0x05c1('0x2f')]()){_0x392c2c[_0x05c1('0x2d')]=_[_0x05c1('0x2e')](moment()[_0x05c1('0x25')]('x'));}_0x392c2c[_0x05c1('0x21')]=_0x481304[_0x05c1('0x21')]['toLowerCase']();_0x392c2c['local']=!![];_0x392c2c[_0x05c1('0x30')](_0x481304);}}else{}}}catch(_0x2e2b65){logger['error'](_0x05c1('0x3a'),util[_0x05c1('0x1b')](_0x2e2b65,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0xe67e9a){try{if(this[_0x05c1('0x29')](_0xe67e9a)&&this['isNotNull'](_0xe67e9a['peerstatus'])){if(this['agents'][_0xe67e9a[_0x05c1('0x3b')]]){if(!this[_0x05c1('0xb')][_0xe67e9a['peer']][_0x05c1('0x2b')]||_0xe67e9a['peerstatus']['toLowerCase']()=='registered'){this[_0x05c1('0xb')][_0xe67e9a[_0x05c1('0x3b')]][_0x05c1('0x2b')]=![];this[_0x05c1('0xb')][_0xe67e9a['peer']][_0x05c1('0x3c')]=_0xe67e9a[_0x05c1('0x12')]['toLowerCase']();this[_0x05c1('0xb')][_0xe67e9a['peer']][_0x05c1('0x3d')]=_0xe67e9a[_0x05c1('0x3d')];this[_0x05c1('0xb')][_0xe67e9a[_0x05c1('0x3b')]][_0x05c1('0x30')](_0xe67e9a);}}else if(this[_0x05c1('0xc')][_0xe67e9a[_0x05c1('0x3b')]]){this[_0x05c1('0xc')][_0xe67e9a[_0x05c1('0x3b')]][_0x05c1('0x3c')]=_0xe67e9a[_0x05c1('0x12')]['toLowerCase']();this[_0x05c1('0xc')][_0xe67e9a['peer']][_0x05c1('0x3d')]=_0xe67e9a[_0x05c1('0x3d')];this[_0x05c1('0x1f')](util[_0x05c1('0x25')](_0x05c1('0x3e'),this[_0x05c1('0xc')][_0xe67e9a[_0x05c1('0x3b')]][_0x05c1('0x31')]),_0x05c1('0x32'),this[_0x05c1('0xc')][_0xe67e9a[_0x05c1('0x3b')]]);}else if(this[_0x05c1('0x33')][_0xe67e9a[_0x05c1('0x3b')]]){this[_0x05c1('0x33')][_0xe67e9a['peer']][_0x05c1('0x3c')]=_0xe67e9a[_0x05c1('0x12')][_0x05c1('0x2f')]();this[_0x05c1('0x33')][_0xe67e9a['peer']][_0x05c1('0x3d')]=_0xe67e9a[_0x05c1('0x3d')];this[_0x05c1('0x1f')](util[_0x05c1('0x25')]('trunk:%s',this[_0x05c1('0x33')][_0xe67e9a[_0x05c1('0x3b')]]['name']),'trunk:save',this[_0x05c1('0x33')][_0xe67e9a['peer']]);}else{}}}catch(_0x1d2d62){logger['error'](_0x05c1('0x3f'),util[_0x05c1('0x1b')](_0x1d2d62,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0xd838=['exports','bluebird','util','ioredis','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','catch','inspect','[loopSyncRealTimeShow]','isNotNull','isUndefined','prototype','emit','username','stateRegistry','state','omit','actionid','format','name','trunk:save','error','device','toLowerCase','local','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','trunk:%s','startsWith','Queue','Local','substring','find','mobile','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','[syncPeerStatus][UserReport]'];(function(_0x3449ea,_0x2d5c1a){var _0x281cb3=function(_0x3e931d){while(--_0x3e931d){_0x3449ea['push'](_0x3449ea['shift']());}};_0x281cb3(++_0x2d5c1a);}(_0xd838,0x101));var _0x8d83=function(_0x381e5c,_0x1e25fa){_0x381e5c=_0x381e5c-0x0;var _0x56dc88=_0xd838[_0x381e5c];return _0x56dc88;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x8d83('0x0'));var util=require(_0x8d83('0x1'));var Redis=require(_0x8d83('0x2'));var config=require('../../../config/environment');var logger=require(_0x8d83('0x3'))(_0x8d83('0x4'));var ami=require(_0x8d83('0x5'));config[_0x8d83('0x6')]=_[_0x8d83('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8d83('0x8'))(new Redis(config[_0x8d83('0x6')]));function UserReport(_0x7ab5c7){this[_0x8d83('0x9')]=_0x7ab5c7[_0x8d83('0x9')];this[_0x8d83('0xa')]=_0x7ab5c7[_0x8d83('0xa')];this[_0x8d83('0xb')]=_0x7ab5c7['telephones'];ami['on'](_0x8d83('0xc'),this[_0x8d83('0xd')][_0x8d83('0xe')](this));ami['on'](_0x8d83('0xf'),this['syncRegistry'][_0x8d83('0xe')](this));ami['on']('devicestatechange',this[_0x8d83('0x10')][_0x8d83('0xe')](this));ami['on'](_0x8d83('0x11'),this['syncPeerStatus'][_0x8d83('0xe')](this));this[_0x8d83('0x12')]();return BPromise[_0x8d83('0x13')]()[_0x8d83('0x14')](ami[_0x8d83('0x15')]())[_0x8d83('0x14')](ami[_0x8d83('0x16')]())['then'](ami[_0x8d83('0x17')]())[_0x8d83('0x18')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x3a18b7){return function(_0x6b8baa){logger['error'](_0x3a18b7,util[_0x8d83('0x19')](_0x6b8baa,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0x8d83('0x12')]=function(){setInterval(function(){BPromise['resolve']()[_0x8d83('0x14')](ami[_0x8d83('0x15')]())[_0x8d83('0x14')](ami[_0x8d83('0x16')]())[_0x8d83('0x14')](ami[_0x8d83('0x17')]())[_0x8d83('0x18')](loggerCatch(_0x8d83('0x1a')));},0x32c8);};UserReport['prototype'][_0x8d83('0x1b')]=function(_0x7f5e21){return _0x7f5e21!==null&&!_[_0x8d83('0x1c')](_0x7f5e21);};UserReport[_0x8d83('0x1d')][_0x8d83('0x1e')]=function(_0x518366,_0x40abf7,_0x15461a){io['to'](_0x518366)['emit'](_0x40abf7,_0x15461a);};UserReport[_0x8d83('0x1d')][_0x8d83('0xd')]=function(_0x57fe3c){try{if(this['isNotNull'](_0x57fe3c)){var _0x360a01=_['find'](this[_0x8d83('0x9')],{'registry':_0x57fe3c[_0x8d83('0x1f')]});if(_0x360a01){_0x57fe3c[_0x8d83('0x20')]=_0x57fe3c[_0x8d83('0x21')];_['merge'](_0x360a01,_[_0x8d83('0x22')](_0x57fe3c,['event',_0x8d83('0x23'),_0x8d83('0x1f'),_0x8d83('0x21')]));this[_0x8d83('0x1e')](util[_0x8d83('0x24')]('trunk:%s',_0x360a01[_0x8d83('0x25')]),_0x8d83('0x26'),_0x360a01);}}}catch(_0x97995f){logger[_0x8d83('0x27')]('[syncRegistry][UserReport]',util[_0x8d83('0x19')](_0x97995f,{'showHidden':![],'depth':null}));}};UserReport[_0x8d83('0x1d')][_0x8d83('0x10')]=function(_0x5d6416){try{if(this[_0x8d83('0x1b')](_0x5d6416)){if(this[_0x8d83('0xa')][_0x5d6416[_0x8d83('0x28')]]){if(!this[_0x8d83('0xa')][_0x5d6416[_0x8d83('0x28')]]['local']||_0x5d6416[_0x8d83('0x21')][_0x8d83('0x29')]()=='inuse'){this[_0x8d83('0xa')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x2a')]=![];if(this['agents'][_0x5d6416[_0x8d83('0x28')]]['state']!==_0x5d6416[_0x8d83('0x21')]['toLowerCase']()){this['agents'][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x2b')]=_[_0x8d83('0x2c')](moment()[_0x8d83('0x24')]('x'));}this[_0x8d83('0xa')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x21')]=_0x5d6416[_0x8d83('0x21')]['toLowerCase']();this[_0x8d83('0xa')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x2d')](_0x5d6416);}}else if(this[_0x8d83('0xb')][_0x5d6416[_0x8d83('0x28')]]){if(this['telephones'][_0x5d6416[_0x8d83('0x28')]]['state']!==_0x5d6416[_0x8d83('0x21')]['toLowerCase']()){this[_0x8d83('0xb')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x2b')]=_[_0x8d83('0x2c')](moment()[_0x8d83('0x24')]('x'));}this['telephones'][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x21')]=_0x5d6416[_0x8d83('0x21')]['toLowerCase']();this[_0x8d83('0x1e')](util['format'](_0x8d83('0x2e'),this[_0x8d83('0xb')][_0x5d6416['device']][_0x8d83('0x25')]),_0x8d83('0x2f'),this['telephones'][_0x5d6416[_0x8d83('0x28')]]);}else if(this[_0x8d83('0x9')][_0x5d6416[_0x8d83('0x28')]]){if(this[_0x8d83('0x9')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x21')]!==_0x5d6416[_0x8d83('0x21')][_0x8d83('0x29')]()){this[_0x8d83('0x9')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x2b')]=_['toNumber'](moment()[_0x8d83('0x24')]('x'));}this[_0x8d83('0x9')][_0x5d6416[_0x8d83('0x28')]][_0x8d83('0x21')]=_0x5d6416[_0x8d83('0x21')][_0x8d83('0x29')]();this[_0x8d83('0x1e')](util[_0x8d83('0x24')](_0x8d83('0x30'),this['trunks'][_0x5d6416[_0x8d83('0x28')]]['name']),_0x8d83('0x26'),this[_0x8d83('0x9')][_0x5d6416[_0x8d83('0x28')]]);}else if(_[_0x8d83('0x31')](_0x5d6416[_0x8d83('0x28')],_0x8d83('0x32'))){}else if(_[_0x8d83('0x31')](_0x5d6416[_0x8d83('0x28')],_0x8d83('0x33'))){var _0x4256ac=_0x5d6416[_0x8d83('0x28')];var _0x9c13e7=_0x4256ac[_0x8d83('0x34')](_0x4256ac['indexOf']('/')+0x1,_0x4256ac['indexOf']('@'));var _0x525531=_[_0x8d83('0x35')](this[_0x8d83('0xa')],function(_0x49ed67){return _0x49ed67[_0x8d83('0x36')]==_0x9c13e7||_0x49ed67[_0x8d83('0x37')]==_0x9c13e7||_0x49ed67[_0x8d83('0x38')]==_0x9c13e7;});if(_0x525531){if(_0x525531[_0x8d83('0x21')]!==_0x5d6416['state'][_0x8d83('0x29')]()){_0x525531[_0x8d83('0x2b')]=_[_0x8d83('0x2c')](moment()[_0x8d83('0x24')]('x'));}_0x525531[_0x8d83('0x21')]=_0x5d6416[_0x8d83('0x21')][_0x8d83('0x29')]();_0x525531[_0x8d83('0x2a')]=!![];_0x525531[_0x8d83('0x2d')](_0x5d6416);}}else{}}}catch(_0x57ed7e){logger['error'](_0x8d83('0x39'),util['inspect'](_0x57ed7e,{'showHidden':![],'depth':null}));}};UserReport[_0x8d83('0x1d')]['syncPeerStatus']=function(_0x404e90){try{if(this[_0x8d83('0x1b')](_0x404e90)&&this['isNotNull'](_0x404e90[_0x8d83('0x11')])){if(this['agents'][_0x404e90[_0x8d83('0x3a')]]){if(!this[_0x8d83('0xa')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x2a')]||_0x404e90[_0x8d83('0x11')]['toLowerCase']()==_0x8d83('0x3b')){this[_0x8d83('0xa')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x2a')]=![];this[_0x8d83('0xa')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x3c')]=_0x404e90['peerstatus'][_0x8d83('0x29')]();this[_0x8d83('0xa')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x3d')]=_0x404e90['address'];this[_0x8d83('0xa')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x2d')](_0x404e90);}}else if(this[_0x8d83('0xb')][_0x404e90[_0x8d83('0x3a')]]){this['telephones'][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x3c')]=_0x404e90[_0x8d83('0x11')][_0x8d83('0x29')]();this[_0x8d83('0xb')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x3d')]=_0x404e90['address'];this[_0x8d83('0x1e')](util[_0x8d83('0x24')](_0x8d83('0x2e'),this[_0x8d83('0xb')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x25')]),_0x8d83('0x2f'),this[_0x8d83('0xb')][_0x404e90[_0x8d83('0x3a')]]);}else if(this['trunks'][_0x404e90['peer']]){this[_0x8d83('0x9')][_0x404e90['peer']][_0x8d83('0x3c')]=_0x404e90[_0x8d83('0x11')][_0x8d83('0x29')]();this[_0x8d83('0x9')][_0x404e90['peer']][_0x8d83('0x3d')]=_0x404e90[_0x8d83('0x3d')];this[_0x8d83('0x1e')](util[_0x8d83('0x24')](_0x8d83('0x30'),this[_0x8d83('0x9')][_0x404e90[_0x8d83('0x3a')]][_0x8d83('0x25')]),_0x8d83('0x26'),this['trunks'][_0x404e90['peer']]);}else{}}}catch(_0x1f5ecb){logger['error'](_0x8d83('0x3e'),util[_0x8d83('0x19')](_0x1f5ecb,{'showHidden':![],'depth':null}));}};module[_0x8d83('0x3f')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 162fae1..dc7876e 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 _0x9fcd=['localhost','socket.io-emitter','channels','voiceQueues','agents','agentcalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','syncAgentCalled','uniqueid','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','variables','queue','type','inbound','merge','event','privilege','custom:agentcalled','format','user:%s','membername','user:called','[syncAgentCalled][VoiceAgentReport]','inspect','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','destconnectedlinenum','custom:agentconnect','agentringnoanswer','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','custom:agentansweredelsewhere','error','isNotNull','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','hasOwnProperty','abandoned','[syncQueueCallerAbandon][VoiceAgentReport]','agentcompleteAt','complete','talktime','transfer','agent','acw','acwTimeout','omit','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','[syncHangup][VoiceAgentReport]','transfereeuniqueid','diff','seconds','secondtransfereruniqueid','transfereruniqueid','syncMusicOnHoldStart','channel','substring','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','syncMusicOnHoldStop','lastIndexOf','[syncMusicOnHoldStop][VoiceAgentReport]','lodash','moment','util','../../../config/environment','../../../config/logger','ami','redis'];(function(_0x4970d6,_0x2e6b07){var _0x2857f3=function(_0x447128){while(--_0x447128){_0x4970d6['push'](_0x4970d6['shift']());}};_0x2857f3(++_0x2e6b07);}(_0x9fcd,0x170));var _0xd9fc=function(_0x22f36d,_0xb0e4a7){_0x22f36d=_0x22f36d-0x0;var _0x2878af=_0x9fcd[_0x22f36d];return _0x2878af;};'use strict';var _=require(_0xd9fc('0x0'));var moment=require(_0xd9fc('0x1'));var util=require(_0xd9fc('0x2'));var Redis=require('ioredis');var config=require(_0xd9fc('0x3'));var logger=require(_0xd9fc('0x4'))(_0xd9fc('0x5'));var ami=require('../ami');config[_0xd9fc('0x6')]=_['defaults'](config[_0xd9fc('0x6')],{'host':_0xd9fc('0x7'),'port':0x18eb});var io=require(_0xd9fc('0x8'))(new Redis(config[_0xd9fc('0x6')]));function VoiceAgentReport(_0x44a4fe){this[_0xd9fc('0x9')]={};this[_0xd9fc('0xa')]=_0x44a4fe['voiceQueues'];this[_0xd9fc('0xb')]=_0x44a4fe[_0xd9fc('0xb')];this['variables']={};ami['on'](_0xd9fc('0xc'),this['syncAgentCalled'][_0xd9fc('0xd')](this));ami['on'](_0xd9fc('0xe'),this[_0xd9fc('0xf')][_0xd9fc('0xd')](this));ami['on']('agentringnoanswer',this[_0xd9fc('0x10')]['bind'](this));ami['on'](_0xd9fc('0x11'),this[_0xd9fc('0x12')][_0xd9fc('0xd')](this));ami['on'](_0xd9fc('0x13'),this[_0xd9fc('0x14')][_0xd9fc('0xd')](this));ami['on'](_0xd9fc('0x15'),this[_0xd9fc('0x16')]['bind'](this));ami['on'](_0xd9fc('0x17'),this[_0xd9fc('0x18')][_0xd9fc('0xd')](this));ami['on'](_0xd9fc('0x19'),this['syncMusicOnHoldStart']['bind'](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xd9fc('0xd')](this));ami['on'](_0xd9fc('0x1a'),this[_0xd9fc('0x1b')]['bind'](this));ami['on'](_0xd9fc('0x1c'),this[_0xd9fc('0x1d')][_0xd9fc('0xd')](this));}VoiceAgentReport[_0xd9fc('0x1e')][_0xd9fc('0x1f')]=function(_0x1a4ab0,_0x58c66e,_0x3c1f1e){io['to'](_0x1a4ab0)[_0xd9fc('0x1f')](_0x58c66e,_0x3c1f1e);};VoiceAgentReport['prototype']['isNotNull']=function(_0x5af4aa){return _0x5af4aa!==null&&!_[_0xd9fc('0x20')](_0x5af4aa);};VoiceAgentReport[_0xd9fc('0x1e')][_0xd9fc('0x21')]=function(_0x432bde){try{if(this['isNotNull'](_0x432bde)){if(_[_0xd9fc('0x20')](this['channels'][_0x432bde[_0xd9fc('0x22')]])){this['channels'][_0x432bde[_0xd9fc('0x22')]]={};}if(_[_0xd9fc('0x20')](this[_0xd9fc('0x9')][_0x432bde[_0xd9fc('0x22')]][_0x432bde[_0xd9fc('0x23')]])){this['channels'][_0x432bde[_0xd9fc('0x22')]][_0x432bde[_0xd9fc('0x23')]]={'agentcalledAt':moment()['format'](_0xd9fc('0x24')),'lastevent':_0xd9fc('0x25'),'variables':this[_0xd9fc('0x26')][_0x432bde[_0xd9fc('0x22')]],'type':this[_0xd9fc('0xa')][_0x432bde[_0xd9fc('0x27')]]?this[_0xd9fc('0xa')][_0x432bde['queue']][_0xd9fc('0x28')]||_0xd9fc('0x29'):_0xd9fc('0x29')};}_[_0xd9fc('0x2a')](this[_0xd9fc('0x9')][_0x432bde[_0xd9fc('0x22')]][_0x432bde[_0xd9fc('0x23')]],_['omit'](_0x432bde,[_0xd9fc('0x2b'),_0xd9fc('0x2c')]));ami[_0xd9fc('0x1f')](_0xd9fc('0x2d'),this[_0xd9fc('0x9')][_0x432bde['uniqueid']][_0x432bde[_0xd9fc('0x23')]]);this['emit'](util[_0xd9fc('0x2e')](_0xd9fc('0x2f'),_0x432bde[_0xd9fc('0x30')]),_0xd9fc('0x31'),this['channels'][_0x432bde[_0xd9fc('0x22')]][_0x432bde[_0xd9fc('0x23')]]);}}catch(_0x185f47){logger['error'](_0xd9fc('0x32'),util[_0xd9fc('0x33')](_0x185f47,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd9fc('0x1e')]['syncAgentConnect']=function(_0x866722){try{if(this['isNotNull'](_0x866722)){if(this[_0xd9fc('0x9')][_0x866722[_0xd9fc('0x22')]]){for(var _0x287e7d in this[_0xd9fc('0x9')][_0x866722[_0xd9fc('0x22')]]){if(this['channels'][_0x866722[_0xd9fc('0x22')]]['hasOwnProperty'](_0x287e7d)){if(_0x866722[_0xd9fc('0x23')]===_0x287e7d){this[_0xd9fc('0x9')][_0x866722[_0xd9fc('0x22')]][_0x287e7d][_0xd9fc('0x34')]=moment()[_0xd9fc('0x2e')](_0xd9fc('0x24'));this[_0xd9fc('0x9')][_0x866722['uniqueid']][_0x287e7d][_0xd9fc('0x35')]=_0xd9fc('0x36');this[_0xd9fc('0x9')][_0x866722['uniqueid']][_0x287e7d][_0xd9fc('0x37')]=_0x866722['holdtime'];this[_0xd9fc('0x9')][_0x866722[_0xd9fc('0x22')]][_0x287e7d][_0xd9fc('0x38')]=_0x866722['connectedlinenum'];this[_0xd9fc('0x9')][_0x866722['uniqueid']][_0x287e7d][_0xd9fc('0x39')]=_0x866722[_0xd9fc('0x39')];this[_0xd9fc('0x9')][_0x866722[_0xd9fc('0x22')]][_0x287e7d][_0xd9fc('0x3a')]=_0x866722['destchannelstate'];this[_0xd9fc('0x9')][_0x866722[_0xd9fc('0x22')]][_0x287e7d]['destchannelstatedesc']=_0x866722[_0xd9fc('0x3b')];_['merge'](this[_0xd9fc('0xb')][_0x866722[_0xd9fc('0x3c')]],_['pick'](_0x866722,['queue',_0xd9fc('0x3d')]));this[_0xd9fc('0x1f')](util[_0xd9fc('0x2e')](_0xd9fc('0x2f'),_0x866722[_0xd9fc('0x30')]),'user:agentconnect',this[_0xd9fc('0x9')][_0x866722[_0xd9fc('0x22')]][_0x866722[_0xd9fc('0x23')]]);ami[_0xd9fc('0x1f')](_0xd9fc('0x3e'),this[_0xd9fc('0x9')][_0x866722['uniqueid']][_0x287e7d]);}else if(!this[_0xd9fc('0x9')][_0x866722[_0xd9fc('0x22')]][_0x287e7d][_0xd9fc('0x3f')]&&!this[_0xd9fc('0x9')][_0x866722[_0xd9fc('0x22')]][_0x287e7d]['agentcomplete']){this['channels'][_0x866722[_0xd9fc('0x22')]][_0x287e7d][_0xd9fc('0x3f')]=!![];this[_0xd9fc('0x9')][_0x866722[_0xd9fc('0x22')]][_0x287e7d][_0xd9fc('0x40')]=moment()[_0xd9fc('0x2e')](_0xd9fc('0x24'));this[_0xd9fc('0x9')][_0x866722['uniqueid']][_0x287e7d][_0xd9fc('0x41')]=_0xd9fc('0x42');this['channels'][_0x866722[_0xd9fc('0x22')]][_0x287e7d]['lastevent']=_0xd9fc('0x42');this[_0xd9fc('0x9')][_0x866722[_0xd9fc('0x22')]][_0x287e7d][_0xd9fc('0x43')]=_0x866722[_0xd9fc('0x23')];this[_0xd9fc('0x9')][_0x866722[_0xd9fc('0x22')]][_0x287e7d][_0xd9fc('0x44')]=_0x866722['membername'];ami[_0xd9fc('0x1f')](_0xd9fc('0x45'),this['channels'][_0x866722['uniqueid']][_0x287e7d]);}}}}}}catch(_0x4c799f){logger[_0xd9fc('0x46')]('[syncAgentConnect][VoiceAgentReport]',util[_0xd9fc('0x33')](_0x4c799f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd9fc('0x1e')][_0xd9fc('0x10')]=function(_0x590c25){try{if(this[_0xd9fc('0x47')](_0x590c25)){if(this[_0xd9fc('0x9')][_0x590c25[_0xd9fc('0x22')]]&&this[_0xd9fc('0x9')][_0x590c25['uniqueid']][_0x590c25['destuniqueid']]){this[_0xd9fc('0x9')][_0x590c25['uniqueid']][_0x590c25[_0xd9fc('0x23')]][_0xd9fc('0x3f')]=!![];this[_0xd9fc('0x9')][_0x590c25['uniqueid']][_0x590c25[_0xd9fc('0x23')]]['agentringnoanswerAt']=moment()[_0xd9fc('0x2e')](_0xd9fc('0x24'));this[_0xd9fc('0x9')][_0x590c25[_0xd9fc('0x22')]][_0x590c25[_0xd9fc('0x23')]][_0xd9fc('0x41')]='rejected';this['channels'][_0x590c25[_0xd9fc('0x22')]][_0x590c25[_0xd9fc('0x23')]][_0xd9fc('0x35')]=_0xd9fc('0x48');ami[_0xd9fc('0x1f')](_0xd9fc('0x49'),this[_0xd9fc('0x9')][_0x590c25[_0xd9fc('0x22')]][_0x590c25[_0xd9fc('0x23')]]);}}}catch(_0x5ad2bf){logger[_0xd9fc('0x46')](_0xd9fc('0x4a'),util[_0xd9fc('0x33')](_0x5ad2bf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd9fc('0x1e')]['syncQueueCallerAbandon']=function(_0x487633){try{if(this[_0xd9fc('0x47')](_0x487633)){if(this[_0xd9fc('0x9')][_0x487633['uniqueid']]){for(var _0x107646 in this[_0xd9fc('0x9')][_0x487633[_0xd9fc('0x22')]]){if(this[_0xd9fc('0x9')][_0x487633['uniqueid']][_0xd9fc('0x4b')](_0x107646)&&!this[_0xd9fc('0x9')][_0x487633['uniqueid']][_0x107646]['agentringnoanswer']&&!this[_0xd9fc('0x9')][_0x487633[_0xd9fc('0x22')]][_0x107646][_0xd9fc('0x13')]){this['channels'][_0x487633[_0xd9fc('0x22')]][_0x107646][_0xd9fc('0x3f')]=!![];this['channels'][_0x487633[_0xd9fc('0x22')]][_0x107646][_0xd9fc('0x40')]=moment()[_0xd9fc('0x2e')](_0xd9fc('0x24'));this[_0xd9fc('0x9')][_0x487633[_0xd9fc('0x22')]][_0x107646][_0xd9fc('0x41')]=_0xd9fc('0x4c');this[_0xd9fc('0x9')][_0x487633['uniqueid']][_0x107646][_0xd9fc('0x35')]=_0xd9fc('0x4c');ami[_0xd9fc('0x1f')]('custom:agentqueuecallerabandon',this['channels'][_0x487633[_0xd9fc('0x22')]][_0x107646]);}}}}}catch(_0x5a618b){logger[_0xd9fc('0x46')](_0xd9fc('0x4d'),util[_0xd9fc('0x33')](_0x5a618b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd9fc('0x1e')][_0xd9fc('0x14')]=function(_0x1785b4){try{if(this['isNotNull'](_0x1785b4)){if(this[_0xd9fc('0x9')][_0x1785b4[_0xd9fc('0x22')]]){for(var _0x441b93 in this['channels'][_0x1785b4[_0xd9fc('0x22')]]){if(this[_0xd9fc('0x9')][_0x1785b4['uniqueid']]['hasOwnProperty'](_0x441b93)){if(this[_0xd9fc('0x9')][_0x1785b4['uniqueid']][_0x441b93]['agentconnectAt']&&!this[_0xd9fc('0x9')][_0x1785b4[_0xd9fc('0x22')]][_0x441b93][_0xd9fc('0x13')]){this[_0xd9fc('0x9')][_0x1785b4[_0xd9fc('0x22')]][_0x441b93][_0xd9fc('0x13')]=!![];this[_0xd9fc('0x9')][_0x1785b4[_0xd9fc('0x22')]][_0x441b93][_0xd9fc('0x4e')]=moment()['format'](_0xd9fc('0x24'));this[_0xd9fc('0x9')][_0x1785b4[_0xd9fc('0x22')]][_0x441b93][_0xd9fc('0x35')]=_0xd9fc('0x4f');this['channels'][_0x1785b4[_0xd9fc('0x22')]][_0x441b93][_0xd9fc('0x50')]=_0x1785b4[_0xd9fc('0x50')];this[_0xd9fc('0x9')][_0x1785b4[_0xd9fc('0x22')]][_0x441b93][_0xd9fc('0x41')]=_0x1785b4[_0xd9fc('0x41')]==_0xd9fc('0x51')?_0xd9fc('0x52'):_0x1785b4[_0xd9fc('0x41')];if(this[_0xd9fc('0xa')][_0x1785b4['queue']]&&this[_0xd9fc('0xa')][_0x1785b4['queue']][_0xd9fc('0x53')]){this[_0xd9fc('0x9')][_0x1785b4[_0xd9fc('0x22')]][_0x441b93]['agentacw']=!![];this['channels'][_0x1785b4['uniqueid']][_0x441b93]['acwtime']=this[_0xd9fc('0xa')][_0x1785b4['queue']][_0xd9fc('0x54')];}this['agents'][_0x1785b4[_0xd9fc('0x3c')]]=_[_0xd9fc('0x55')](this[_0xd9fc('0xb')][_0x1785b4[_0xd9fc('0x3c')]],[_0xd9fc('0x27'),_0xd9fc('0x3d')]);this[_0xd9fc('0x1f')](util[_0xd9fc('0x2e')](_0xd9fc('0x2f'),_0x1785b4[_0xd9fc('0x30')]),_0xd9fc('0x56'),this[_0xd9fc('0x9')][_0x1785b4[_0xd9fc('0x22')]][_0x441b93]);ami[_0xd9fc('0x1f')](_0xd9fc('0x57'),this[_0xd9fc('0x9')][_0x1785b4['uniqueid']][_0x441b93]);}}}}}}catch(_0x4e5c36){logger[_0xd9fc('0x46')](_0xd9fc('0x58'),util[_0xd9fc('0x33')](_0x4e5c36,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd9fc('0x1e')][_0xd9fc('0x16')]=function(_0x5ef8e8){try{if(this['isNotNull'](_0x5ef8e8)){this[_0xd9fc('0x59')](_0x5ef8e8[_0xd9fc('0x22')],_[_0xd9fc('0x5a')](_0x5ef8e8[_0xd9fc('0x5b')])[0x0],_0x5ef8e8[_0xd9fc('0x5c')]);if(this[_0xd9fc('0x9')][_0x5ef8e8[_0xd9fc('0x22')]]){for(var _0x495219 in this[_0xd9fc('0x9')][_0x5ef8e8[_0xd9fc('0x22')]]){if(this[_0xd9fc('0x9')][_0x5ef8e8[_0xd9fc('0x22')]][_0xd9fc('0x4b')](_0x495219)){if(_[_0xd9fc('0x20')](this[_0xd9fc('0x9')][_0x5ef8e8['uniqueid']][_0x495219][_0xd9fc('0x26')])){this[_0xd9fc('0x9')][_0x5ef8e8[_0xd9fc('0x22')]][_0x495219]['variables']={};}this['channels'][_0x5ef8e8['uniqueid']][_0x495219][_0xd9fc('0x26')]=this['variables'][_0x5ef8e8['uniqueid']];}}}}}catch(_0x3e5a08){logger[_0xd9fc('0x46')](_0xd9fc('0x5d'),util[_0xd9fc('0x33')](_0x3e5a08,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd9fc('0x1e')]['addVariable']=function(_0xf13523,_0x2dac79,_0x2b8edc){var _0x5b5d2d=[_0xd9fc('0x5e'),_0xd9fc('0x5f'),_0xd9fc('0x60'),_0xd9fc('0x61'),_0xd9fc('0x62'),_0xd9fc('0x63'),_0xd9fc('0x64'),'rtpaudioqosrttbridged',_0xd9fc('0x65'),_0xd9fc('0x66'),_0xd9fc('0x67'),'bridgepvtcallid',_0xd9fc('0x68'),_0xd9fc('0x69'),_0xd9fc('0x6a'),_0xd9fc('0x6b'),_0xd9fc('0x30'),'memberpenalty',_0xd9fc('0x6c')];if(!_[_0xd9fc('0x6d')](_0x2dac79)&&!_[_0xd9fc('0x6e')](_0x5b5d2d,_0x2dac79)){if(_[_0xd9fc('0x20')](this[_0xd9fc('0x26')][_0xf13523])){this[_0xd9fc('0x26')][_0xf13523]={};}this['variables'][_0xf13523][_0x2dac79]=_0x2b8edc;}};VoiceAgentReport[_0xd9fc('0x1e')][_0xd9fc('0x18')]=function(_0xe326d1){try{if(this[_0xd9fc('0x47')](_0xe326d1)){if(this[_0xd9fc('0x9')][_0xe326d1[_0xd9fc('0x22')]]){for(var _0x3e2c97 in this[_0xd9fc('0x9')][_0xe326d1[_0xd9fc('0x22')]]){if(this[_0xd9fc('0x9')][_0xe326d1[_0xd9fc('0x22')]][_0xd9fc('0x4b')](_0x3e2c97)){if(this[_0xd9fc('0x9')][_0xe326d1[_0xd9fc('0x22')]][_0x3e2c97][_0xd9fc('0x41')]=='transfer'&&this[_0xd9fc('0x9')][_0xe326d1[_0xd9fc('0x22')]][_0x3e2c97]['agentcomplete']){this[_0xd9fc('0x9')][_0xe326d1[_0xd9fc('0x22')]][_0x3e2c97][_0xd9fc('0x4e')]=moment()[_0xd9fc('0x2e')](_0xd9fc('0x24'));}}}ami[_0xd9fc('0x1f')]('custom:voiceAgentReport',_['values'](this[_0xd9fc('0x9')][_0xe326d1[_0xd9fc('0x22')]]));delete this[_0xd9fc('0x9')][_0xe326d1['uniqueid']];}if(this[_0xd9fc('0x26')][_0xe326d1['uniqueid']]){delete this[_0xd9fc('0x26')][_0xe326d1[_0xd9fc('0x22')]];}}}catch(_0x3687be){logger[_0xd9fc('0x46')](_0xd9fc('0x6f'),util['inspect'](_0x3687be,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xd9fc('0x1b')]=function(_0x2c19fd){try{if(this['isNotNull'](_0x2c19fd)){if(this[_0xd9fc('0x9')][_0x2c19fd[_0xd9fc('0x70')]]){for(var _0x55352d in this['channels'][_0x2c19fd[_0xd9fc('0x70')]]){if(this[_0xd9fc('0x9')][_0x2c19fd[_0xd9fc('0x70')]][_0xd9fc('0x4b')](_0x55352d)){if(_0x2c19fd['origtransfereruniqueid']===_0x55352d){var _0x9b491d=moment();this[_0xd9fc('0x9')][_0x2c19fd['transfereeuniqueid']][_0x55352d][_0xd9fc('0x13')]=!![];this['channels'][_0x2c19fd[_0xd9fc('0x70')]][_0x55352d][_0xd9fc('0x4e')]=moment()['format'](_0xd9fc('0x24'));this['channels'][_0x2c19fd[_0xd9fc('0x70')]][_0x55352d]['reason']=_0xd9fc('0x51');this['channels'][_0x2c19fd['transfereeuniqueid']][_0x55352d][_0xd9fc('0x35')]=_0xd9fc('0x4f');this[_0xd9fc('0x9')][_0x2c19fd[_0xd9fc('0x70')]][_0x55352d][_0xd9fc('0x50')]=_0x9b491d[_0xd9fc('0x71')](this[_0xd9fc('0x9')][_0x2c19fd['transfereeuniqueid']][_0x55352d][_0xd9fc('0x34')],_0xd9fc('0x72'));}}}}if(this[_0xd9fc('0x9')][_0x2c19fd[_0xd9fc('0x73')]]){var _0x324c18=this[_0xd9fc('0x9')][_0x2c19fd[_0xd9fc('0x73')]];this[_0xd9fc('0x9')][_0x2c19fd[_0xd9fc('0x73')]]=this[_0xd9fc('0x9')][_0x2c19fd[_0xd9fc('0x70')]];this[_0xd9fc('0x9')][_0x2c19fd[_0xd9fc('0x70')]]=_0x324c18;}}}catch(_0x45eb47){logger[_0xd9fc('0x46')]('[syncAttendedTransfer][VoiceAgentReport]',util[_0xd9fc('0x33')](_0x45eb47,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd9fc('0x1e')][_0xd9fc('0x1d')]=function(_0x1c1b4b){try{if(this[_0xd9fc('0x47')](_0x1c1b4b)){if(this[_0xd9fc('0x9')][_0x1c1b4b['transfereeuniqueid']]){for(var _0x17c867 in this[_0xd9fc('0x9')][_0x1c1b4b[_0xd9fc('0x70')]]){if(this[_0xd9fc('0x9')][_0x1c1b4b[_0xd9fc('0x70')]][_0xd9fc('0x4b')](_0x17c867)){if(_0x1c1b4b[_0xd9fc('0x74')]===_0x17c867){var _0x1c5d78=moment();this[_0xd9fc('0x9')][_0x1c1b4b[_0xd9fc('0x70')]][_0x17c867][_0xd9fc('0x13')]=!![];this[_0xd9fc('0x9')][_0x1c1b4b[_0xd9fc('0x70')]][_0x17c867][_0xd9fc('0x4e')]=_0x1c5d78;this[_0xd9fc('0x9')][_0x1c1b4b['transfereeuniqueid']][_0x17c867][_0xd9fc('0x41')]=_0xd9fc('0x51');this[_0xd9fc('0x9')][_0x1c1b4b['transfereeuniqueid']][_0x17c867][_0xd9fc('0x35')]=_0xd9fc('0x4f');this[_0xd9fc('0x9')][_0x1c1b4b[_0xd9fc('0x70')]][_0x17c867][_0xd9fc('0x50')]=_0x1c5d78[_0xd9fc('0x71')](this['channels'][_0x1c1b4b[_0xd9fc('0x70')]][_0x17c867][_0xd9fc('0x34')],_0xd9fc('0x72'));}}}}}}catch(_0x42876a){logger[_0xd9fc('0x46')]('[syncBlindTransfer][VoiceAgentReport]',util[_0xd9fc('0x33')](_0x42876a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd9fc('0x1e')][_0xd9fc('0x75')]=function(_0x11df3b){var _0x388265='';try{if(this[_0xd9fc('0x47')](_0x11df3b)){if(_0x11df3b[_0xd9fc('0x76')]){_0x388265=_0x11df3b[_0xd9fc('0x76')][_0xd9fc('0x77')](0x0,_0x11df3b[_0xd9fc('0x76')]['lastIndexOf']('-'));if(this[_0xd9fc('0xb')][_0x388265]){this[_0xd9fc('0xb')][_0x388265][_0xd9fc('0x78')]=!![];}}}}catch(_0x274ae8){logger[_0xd9fc('0x46')](_0xd9fc('0x79'),util[_0xd9fc('0x33')](_0x274ae8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xd9fc('0x1e')][_0xd9fc('0x7a')]=function(_0x4f40f8){var _0x3fa0d1='';try{if(this[_0xd9fc('0x47')](_0x4f40f8)){if(_0x4f40f8[_0xd9fc('0x76')]){_0x3fa0d1=_0x4f40f8[_0xd9fc('0x76')][_0xd9fc('0x77')](0x0,_0x4f40f8[_0xd9fc('0x76')][_0xd9fc('0x7b')]('-'));if(this[_0xd9fc('0xb')][_0x3fa0d1]){this[_0xd9fc('0xb')][_0x3fa0d1][_0xd9fc('0x78')]=![];}}}}catch(_0x4495db){logger[_0xd9fc('0x46')](_0xd9fc('0x7c'),util['inspect'](_0x4495db,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x6943=['membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','includes','custom:voiceAgentReport','values','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','syncBlindTransfer','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','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','merge','omit','event','privilege','custom:agentcalled','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','hasOwnProperty','agentconnectAt','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','pick','destconnectedlinenum','user:%s','user:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheremembername','custom:agentansweredelsewhere','rejected','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','agentcompleteAt','complete','talktime','transfer','acw','acwtime','interface','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6943,0x95));var _0x3694=function(_0x56a616,_0x5a3c7c){_0x56a616=_0x56a616-0x0;var _0xe94844=_0x6943[_0x56a616];return _0xe94844;};'use strict';var _=require(_0x3694('0x0'));var moment=require('moment');var util=require(_0x3694('0x1'));var Redis=require(_0x3694('0x2'));var config=require(_0x3694('0x3'));var logger=require(_0x3694('0x4'))(_0x3694('0x5'));var ami=require('../ami');config[_0x3694('0x6')]=_[_0x3694('0x7')](config['redis'],{'host':_0x3694('0x8'),'port':0x18eb});var io=require(_0x3694('0x9'))(new Redis(config['redis']));function VoiceAgentReport(_0x2b6562){this[_0x3694('0xa')]={};this[_0x3694('0xb')]=_0x2b6562[_0x3694('0xb')];this[_0x3694('0xc')]=_0x2b6562[_0x3694('0xc')];this[_0x3694('0xd')]={};ami['on'](_0x3694('0xe'),this[_0x3694('0xf')][_0x3694('0x10')](this));ami['on'](_0x3694('0x11'),this[_0x3694('0x12')][_0x3694('0x10')](this));ami['on'](_0x3694('0x13'),this[_0x3694('0x14')]['bind'](this));ami['on'](_0x3694('0x15'),this[_0x3694('0x16')][_0x3694('0x10')](this));ami['on'](_0x3694('0x17'),this[_0x3694('0x18')][_0x3694('0x10')](this));ami['on'](_0x3694('0x19'),this[_0x3694('0x1a')]['bind'](this));ami['on'](_0x3694('0x1b'),this[_0x3694('0x1c')]['bind'](this));ami['on'](_0x3694('0x1d'),this[_0x3694('0x1e')][_0x3694('0x10')](this));ami['on']('musiconholdstop',this[_0x3694('0x1f')][_0x3694('0x10')](this));ami['on'](_0x3694('0x20'),this[_0x3694('0x21')][_0x3694('0x10')](this));ami['on'](_0x3694('0x22'),this['syncBlindTransfer']['bind'](this));}VoiceAgentReport['prototype'][_0x3694('0x23')]=function(_0x5a93f1,_0x171db2,_0x4a9bb3){io['to'](_0x5a93f1)[_0x3694('0x23')](_0x171db2,_0x4a9bb3);};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x25')]=function(_0x16b9de){return _0x16b9de!==null&&!_[_0x3694('0x26')](_0x16b9de);};VoiceAgentReport[_0x3694('0x24')][_0x3694('0xf')]=function(_0x52801b){try{if(this[_0x3694('0x25')](_0x52801b)){if(_[_0x3694('0x26')](this[_0x3694('0xa')][_0x52801b[_0x3694('0x27')]])){this[_0x3694('0xa')][_0x52801b[_0x3694('0x27')]]={};}if(_[_0x3694('0x26')](this[_0x3694('0xa')][_0x52801b[_0x3694('0x27')]][_0x52801b['destuniqueid']])){this[_0x3694('0xa')][_0x52801b['uniqueid']][_0x52801b[_0x3694('0x28')]]={'agentcalledAt':moment()[_0x3694('0x29')](_0x3694('0x2a')),'lastevent':_0x3694('0x2b'),'variables':this['variables'][_0x52801b[_0x3694('0x27')]],'type':this[_0x3694('0xb')][_0x52801b[_0x3694('0x2c')]]?this[_0x3694('0xb')][_0x52801b[_0x3694('0x2c')]][_0x3694('0x2d')]||_0x3694('0x2e'):_0x3694('0x2e')};}_[_0x3694('0x2f')](this[_0x3694('0xa')][_0x52801b[_0x3694('0x27')]][_0x52801b['destuniqueid']],_[_0x3694('0x30')](_0x52801b,[_0x3694('0x31'),_0x3694('0x32')]));ami[_0x3694('0x23')](_0x3694('0x33'),this[_0x3694('0xa')][_0x52801b[_0x3694('0x27')]][_0x52801b['destuniqueid']]);this[_0x3694('0x23')](util[_0x3694('0x29')]('user:%s',_0x52801b[_0x3694('0x34')]),_0x3694('0x35'),this[_0x3694('0xa')][_0x52801b[_0x3694('0x27')]][_0x52801b['destuniqueid']]);}}catch(_0x2e3d51){logger[_0x3694('0x36')](_0x3694('0x37'),util[_0x3694('0x38')](_0x2e3d51,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x12')]=function(_0x2a5393){try{if(this[_0x3694('0x25')](_0x2a5393)){if(this[_0x3694('0xa')][_0x2a5393['uniqueid']]){for(var _0x1af25c in this[_0x3694('0xa')][_0x2a5393['uniqueid']]){if(this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x3694('0x39')](_0x1af25c)){if(_0x2a5393[_0x3694('0x28')]===_0x1af25c){this[_0x3694('0xa')][_0x2a5393['uniqueid']][_0x1af25c][_0x3694('0x3a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x3b')]=_0x3694('0x3c');this[_0x3694('0xa')][_0x2a5393['uniqueid']][_0x1af25c][_0x3694('0x3d')]=_0x2a5393[_0x3694('0x3d')];this['channels'][_0x2a5393['uniqueid']][_0x1af25c][_0x3694('0x3e')]=_0x2a5393[_0x3694('0x3e')];this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x3f')]=_0x2a5393[_0x3694('0x3f')];this[_0x3694('0xa')][_0x2a5393['uniqueid']][_0x1af25c]['destchannelstate']=_0x2a5393[_0x3694('0x40')];this['channels'][_0x2a5393[_0x3694('0x27')]][_0x1af25c]['destchannelstatedesc']=_0x2a5393[_0x3694('0x41')];_[_0x3694('0x2f')](this[_0x3694('0xc')][_0x2a5393['interface']],_[_0x3694('0x42')](_0x2a5393,['queue',_0x3694('0x43')]));this['emit'](util['format'](_0x3694('0x44'),_0x2a5393[_0x3694('0x34')]),_0x3694('0x45'),this[_0x3694('0xa')][_0x2a5393['uniqueid']][_0x2a5393[_0x3694('0x28')]]);ami['emit']('custom:agentconnect',this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c]);}else if(!this['channels'][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x13')]&&!this[_0x3694('0xa')][_0x2a5393['uniqueid']][_0x1af25c]['agentcomplete']){this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x13')]=!![];this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x46')]=moment()['format'](_0x3694('0x2a'));this['channels'][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x47')]=_0x3694('0x48');this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x3b')]=_0x3694('0x48');this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c]['answeredelsewheredestinationuniqueid']=_0x2a5393[_0x3694('0x28')];this[_0x3694('0xa')][_0x2a5393[_0x3694('0x27')]][_0x1af25c][_0x3694('0x49')]=_0x2a5393[_0x3694('0x34')];ami[_0x3694('0x23')](_0x3694('0x4a'),this['channels'][_0x2a5393[_0x3694('0x27')]][_0x1af25c]);}}}}}}catch(_0x59ba4e){logger[_0x3694('0x36')]('[syncAgentConnect][VoiceAgentReport]',util['inspect'](_0x59ba4e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3694('0x14')]=function(_0x22c15d){try{if(this[_0x3694('0x25')](_0x22c15d)){if(this[_0x3694('0xa')][_0x22c15d['uniqueid']]&&this['channels'][_0x22c15d['uniqueid']][_0x22c15d[_0x3694('0x28')]]){this[_0x3694('0xa')][_0x22c15d['uniqueid']][_0x22c15d[_0x3694('0x28')]]['agentringnoanswer']=!![];this[_0x3694('0xa')][_0x22c15d[_0x3694('0x27')]][_0x22c15d[_0x3694('0x28')]]['agentringnoanswerAt']=moment()[_0x3694('0x29')](_0x3694('0x2a'));this['channels'][_0x22c15d[_0x3694('0x27')]][_0x22c15d[_0x3694('0x28')]][_0x3694('0x47')]=_0x3694('0x4b');this[_0x3694('0xa')][_0x22c15d[_0x3694('0x27')]][_0x22c15d[_0x3694('0x28')]][_0x3694('0x3b')]=_0x3694('0x4b');ami[_0x3694('0x23')]('custom:agentringnoanswer',this[_0x3694('0xa')][_0x22c15d[_0x3694('0x27')]][_0x22c15d[_0x3694('0x28')]]);}}}catch(_0x540479){logger['error'](_0x3694('0x4c'),util['inspect'](_0x540479,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x16')]=function(_0x42448a){try{if(this['isNotNull'](_0x42448a)){if(this[_0x3694('0xa')][_0x42448a['uniqueid']]){for(var _0x4a22dc in this[_0x3694('0xa')][_0x42448a[_0x3694('0x27')]]){if(this[_0x3694('0xa')][_0x42448a['uniqueid']][_0x3694('0x39')](_0x4a22dc)&&!this['channels'][_0x42448a[_0x3694('0x27')]][_0x4a22dc][_0x3694('0x13')]&&!this[_0x3694('0xa')][_0x42448a[_0x3694('0x27')]][_0x4a22dc]['agentcomplete']){this[_0x3694('0xa')][_0x42448a[_0x3694('0x27')]][_0x4a22dc]['agentringnoanswer']=!![];this['channels'][_0x42448a['uniqueid']][_0x4a22dc][_0x3694('0x46')]=moment()[_0x3694('0x29')](_0x3694('0x2a'));this[_0x3694('0xa')][_0x42448a[_0x3694('0x27')]][_0x4a22dc]['reason']=_0x3694('0x4d');this[_0x3694('0xa')][_0x42448a[_0x3694('0x27')]][_0x4a22dc][_0x3694('0x3b')]=_0x3694('0x4d');ami['emit'](_0x3694('0x4e'),this[_0x3694('0xa')][_0x42448a[_0x3694('0x27')]][_0x4a22dc]);}}}}}catch(_0x3ca639){logger[_0x3694('0x36')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x3694('0x38')](_0x3ca639,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x18')]=function(_0x2977d3){try{if(this['isNotNull'](_0x2977d3)){if(this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]]){for(var _0x39a6aa in this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]]){if(this['channels'][_0x2977d3['uniqueid']][_0x3694('0x39')](_0x39a6aa)){if(this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]][_0x39a6aa][_0x3694('0x3a')]&&!this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]][_0x39a6aa][_0x3694('0x17')]){this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]][_0x39a6aa][_0x3694('0x17')]=!![];this[_0x3694('0xa')][_0x2977d3['uniqueid']][_0x39a6aa][_0x3694('0x4f')]=moment()[_0x3694('0x29')](_0x3694('0x2a'));this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]][_0x39a6aa][_0x3694('0x3b')]=_0x3694('0x50');this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]][_0x39a6aa][_0x3694('0x51')]=_0x2977d3[_0x3694('0x51')];this[_0x3694('0xa')][_0x2977d3['uniqueid']][_0x39a6aa][_0x3694('0x47')]=_0x2977d3[_0x3694('0x47')]==_0x3694('0x52')?'agent':_0x2977d3[_0x3694('0x47')];if(this['voiceQueues'][_0x2977d3[_0x3694('0x2c')]]&&this[_0x3694('0xb')][_0x2977d3['queue']][_0x3694('0x53')]){this[_0x3694('0xa')][_0x2977d3[_0x3694('0x27')]][_0x39a6aa]['agentacw']=!![];this[_0x3694('0xa')][_0x2977d3['uniqueid']][_0x39a6aa][_0x3694('0x54')]=this[_0x3694('0xb')][_0x2977d3[_0x3694('0x2c')]]['acwTimeout'];}this[_0x3694('0xc')][_0x2977d3[_0x3694('0x55')]]=_['omit'](this['agents'][_0x2977d3[_0x3694('0x55')]],[_0x3694('0x2c'),_0x3694('0x43')]);this['emit'](util[_0x3694('0x29')]('user:%s',_0x2977d3[_0x3694('0x34')]),_0x3694('0x56'),this[_0x3694('0xa')][_0x2977d3['uniqueid']][_0x39a6aa]);ami[_0x3694('0x23')]('custom:agentcomplete',this['channels'][_0x2977d3['uniqueid']][_0x39a6aa]);}}}}}}catch(_0x5b7d61){logger[_0x3694('0x36')](_0x3694('0x57'),util[_0x3694('0x38')](_0x5b7d61,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x1a')]=function(_0x315310){try{if(this[_0x3694('0x25')](_0x315310)){this[_0x3694('0x58')](_0x315310['uniqueid'],_[_0x3694('0x59')](_0x315310[_0x3694('0x5a')])[0x0],_0x315310['value']);if(this[_0x3694('0xa')][_0x315310['uniqueid']]){for(var _0xc523c in this[_0x3694('0xa')][_0x315310[_0x3694('0x27')]]){if(this[_0x3694('0xa')][_0x315310[_0x3694('0x27')]][_0x3694('0x39')](_0xc523c)){if(_[_0x3694('0x26')](this[_0x3694('0xa')][_0x315310[_0x3694('0x27')]][_0xc523c][_0x3694('0xd')])){this[_0x3694('0xa')][_0x315310[_0x3694('0x27')]][_0xc523c][_0x3694('0xd')]={};}this[_0x3694('0xa')][_0x315310[_0x3694('0x27')]][_0xc523c][_0x3694('0xd')]=this[_0x3694('0xd')][_0x315310[_0x3694('0x27')]];}}}}}catch(_0x8040f9){logger['error'](_0x3694('0x5b'),util['inspect'](_0x8040f9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x58')]=function(_0x4a72d9,_0x1fda9e,_0x480885){var _0x48caf8=[_0x3694('0x5c'),_0x3694('0x5d'),_0x3694('0x5e'),_0x3694('0x5f'),_0x3694('0x60'),_0x3694('0x61'),_0x3694('0x62'),'rtpaudioqosrttbridged',_0x3694('0x63'),_0x3694('0x64'),_0x3694('0x65'),_0x3694('0x66'),_0x3694('0x67'),_0x3694('0x68'),'memberinterface',_0x3694('0x69'),_0x3694('0x34'),_0x3694('0x6a'),_0x3694('0x6b')];if(!_['isNil'](_0x1fda9e)&&!_[_0x3694('0x6c')](_0x48caf8,_0x1fda9e)){if(_[_0x3694('0x26')](this[_0x3694('0xd')][_0x4a72d9])){this[_0x3694('0xd')][_0x4a72d9]={};}this[_0x3694('0xd')][_0x4a72d9][_0x1fda9e]=_0x480885;}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x1c')]=function(_0x26353e){try{if(this['isNotNull'](_0x26353e)){if(this[_0x3694('0xa')][_0x26353e[_0x3694('0x27')]]){for(var _0x3064d7 in this[_0x3694('0xa')][_0x26353e[_0x3694('0x27')]]){if(this[_0x3694('0xa')][_0x26353e['uniqueid']][_0x3694('0x39')](_0x3064d7)){if(this[_0x3694('0xa')][_0x26353e[_0x3694('0x27')]][_0x3064d7][_0x3694('0x47')]==_0x3694('0x52')&&this[_0x3694('0xa')][_0x26353e[_0x3694('0x27')]][_0x3064d7][_0x3694('0x17')]){this['channels'][_0x26353e['uniqueid']][_0x3064d7][_0x3694('0x4f')]=moment()[_0x3694('0x29')](_0x3694('0x2a'));}}}ami[_0x3694('0x23')](_0x3694('0x6d'),_[_0x3694('0x6e')](this[_0x3694('0xa')][_0x26353e[_0x3694('0x27')]]));delete this['channels'][_0x26353e['uniqueid']];}if(this['variables'][_0x26353e[_0x3694('0x27')]]){delete this[_0x3694('0xd')][_0x26353e[_0x3694('0x27')]];}}}catch(_0x1ac03e){logger[_0x3694('0x36')]('[syncHangup][VoiceAgentReport]',util[_0x3694('0x38')](_0x1ac03e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAttendedTransfer']=function(_0x1c4af0){try{if(this['isNotNull'](_0x1c4af0)){if(this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]]){for(var _0x447dd5 in this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]]){if(this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]]['hasOwnProperty'](_0x447dd5)){if(_0x1c4af0[_0x3694('0x70')]===_0x447dd5){var _0x596726=moment();this['channels'][_0x1c4af0[_0x3694('0x6f')]][_0x447dd5][_0x3694('0x17')]=!![];this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]][_0x447dd5][_0x3694('0x4f')]=moment()[_0x3694('0x29')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]][_0x447dd5][_0x3694('0x47')]=_0x3694('0x52');this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]][_0x447dd5][_0x3694('0x3b')]=_0x3694('0x50');this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]][_0x447dd5][_0x3694('0x51')]=_0x596726[_0x3694('0x71')](this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]][_0x447dd5]['agentconnectAt'],_0x3694('0x72'));}}}}if(this[_0x3694('0xa')][_0x1c4af0['secondtransfereruniqueid']]){var _0x160c58=this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x73')]];this[_0x3694('0xa')][_0x1c4af0['secondtransfereruniqueid']]=this[_0x3694('0xa')][_0x1c4af0['transfereeuniqueid']];this[_0x3694('0xa')][_0x1c4af0[_0x3694('0x6f')]]=_0x160c58;}}}catch(_0x59d91b){logger[_0x3694('0x36')](_0x3694('0x74'),util[_0x3694('0x38')](_0x59d91b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')][_0x3694('0x75')]=function(_0x423459){try{if(this['isNotNull'](_0x423459)){if(this[_0x3694('0xa')][_0x423459[_0x3694('0x6f')]]){for(var _0x5d9617 in this[_0x3694('0xa')][_0x423459['transfereeuniqueid']]){if(this[_0x3694('0xa')][_0x423459[_0x3694('0x6f')]][_0x3694('0x39')](_0x5d9617)){if(_0x423459[_0x3694('0x76')]===_0x5d9617){var _0xc9765f=moment();this[_0x3694('0xa')][_0x423459['transfereeuniqueid']][_0x5d9617]['agentcomplete']=!![];this[_0x3694('0xa')][_0x423459[_0x3694('0x6f')]][_0x5d9617][_0x3694('0x4f')]=_0xc9765f;this[_0x3694('0xa')][_0x423459[_0x3694('0x6f')]][_0x5d9617][_0x3694('0x47')]=_0x3694('0x52');this['channels'][_0x423459['transfereeuniqueid']][_0x5d9617]['lastevent']='complete';this[_0x3694('0xa')][_0x423459[_0x3694('0x6f')]][_0x5d9617][_0x3694('0x51')]=_0xc9765f[_0x3694('0x71')](this['channels'][_0x423459[_0x3694('0x6f')]][_0x5d9617][_0x3694('0x3a')],_0x3694('0x72'));}}}}}}catch(_0xc3e461){logger['error'](_0x3694('0x77'),util[_0x3694('0x38')](_0xc3e461,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x3694('0x24')]['syncMusicOnHoldStart']=function(_0x202dab){var _0x1a635b='';try{if(this[_0x3694('0x25')](_0x202dab)){if(_0x202dab[_0x3694('0x78')]){_0x1a635b=_0x202dab[_0x3694('0x78')][_0x3694('0x79')](0x0,_0x202dab[_0x3694('0x78')][_0x3694('0x7a')]('-'));if(this[_0x3694('0xc')][_0x1a635b]){this[_0x3694('0xc')][_0x1a635b][_0x3694('0x7b')]=!![];}}}}catch(_0x3a5d63){logger['error'](_0x3694('0x7c'),util['inspect'](_0x3a5d63,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x3694('0x1f')]=function(_0x59ec83){var _0x56db11='';try{if(this[_0x3694('0x25')](_0x59ec83)){if(_0x59ec83['channel']){_0x56db11=_0x59ec83[_0x3694('0x78')]['substring'](0x0,_0x59ec83[_0x3694('0x78')][_0x3694('0x7a')]('-'));if(this[_0x3694('0xc')][_0x56db11]){this[_0x3694('0xc')][_0x56db11][_0x3694('0x7b')]=![];}}}}catch(_0x225bb4){logger[_0x3694('0x36')](_0x3694('0x7d'),util[_0x3694('0x38')](_0x225bb4,{'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 615a046..9d2e623 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 _0x6317=['syncNewChannel','newstate','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','log','prototype','isUndefined','emit','isNotNull','linkedid','channels','uniqueid','merge','pick','keys','error','inspect','channel','OutgoingSpoolFailed','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','context','from-sip','split','destconnectedlinenum','exten','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','toLowerCase','applicationdata','appdata','starttime','subtract','duration','seconds','includes','application','lastapplication','lastdata','cdr(','match','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','calleridnum','xcally-motion-preview','calleridname','destinationchannel','membername','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','.wav49','replace','find','monitors','isNil','push','rec','variable','mixmonitor_filename','xmd-phone','value','xmd-callerid','callerid','xmd-cdrtype','xmd-queue','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','billableseconds','omit','user:%s','user:agentcomplete','[syncHangup][VoiceCallReport]','transfereeuniqueid','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','BUSY','redis','defaults','localhost','socket.io-emitter','agents','coreshowchannel','syncNewExten','newexten','bind'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6317,0x11a));var _0x7631=function(_0x2a4d97,_0x343dd5){_0x2a4d97=_0x2a4d97-0x0;var _0x4945be=_0x6317[_0x2a4d97];return _0x4945be;};'use strict';var BPromise=require(_0x7631('0x0'));var _=require(_0x7631('0x1'));var moment=require(_0x7631('0x2'));var util=require(_0x7631('0x3'));var path=require(_0x7631('0x4'));var Redis=require(_0x7631('0x5'));var config=require(_0x7631('0x6'));var logger=require(_0x7631('0x7'))(_0x7631('0x8'));var ami=require(_0x7631('0x9'));var Channel=require(_0x7631('0xa'));var statusDesc=[_0x7631('0xb'),'not_inuse',_0x7631('0xc'),_0x7631('0xd'),_0x7631('0xe'),_0x7631('0xf'),_0x7631('0x10'),_0x7631('0x11'),_0x7631('0x12')];var applications=[_0x7631('0x13'),_0x7631('0x14'),_0x7631('0x15'),_0x7631('0x16'),_0x7631('0x17'),_0x7631('0x18')];var dispositions=['NO\x20ANSWER','FAILED',_0x7631('0x19'),_0x7631('0x1a'),_0x7631('0x1a'),'NO\x20ANSWER',_0x7631('0x1b'),_0x7631('0x1c'),_0x7631('0x19'),'FAILED',_0x7631('0x19')];var actions={};config[_0x7631('0x1d')]=_[_0x7631('0x1e')](config['redis'],{'host':_0x7631('0x1f'),'port':0x18eb});var io=require(_0x7631('0x20'))(new Redis(config['redis']));function VoiceCallReport(_0x12a88c){this['channels']=_0x12a88c['channels'];this[_0x7631('0x21')]=_0x12a88c['agents'];ami['on'](_0x7631('0x22'),this[_0x7631('0x23')]['bind'](this));ami['on'](_0x7631('0x24'),this[_0x7631('0x23')][_0x7631('0x25')](this));ami['on']('newchannel',this[_0x7631('0x26')][_0x7631('0x25')](this));ami['on'](_0x7631('0x27'),this['syncNewState'][_0x7631('0x25')](this));ami['on'](_0x7631('0x28'),this[_0x7631('0x29')][_0x7631('0x25')](this));ami['on']('hangup',this[_0x7631('0x2a')][_0x7631('0x25')](this));ami['on'](_0x7631('0x2b'),this[_0x7631('0x2c')][_0x7631('0x25')](this));ami['on'](_0x7631('0x2d'),this[_0x7631('0x2e')][_0x7631('0x25')](this));ami['on'](_0x7631('0x2f'),this[_0x7631('0x30')][_0x7631('0x25')](this));ami['on'](_0x7631('0x31'),this[_0x7631('0x32')][_0x7631('0x25')](this));ami['on'](_0x7631('0x33'),this[_0x7631('0x34')]['bind'](this));return BPromise[_0x7631('0x35')]()[_0x7631('0x36')](ami[_0x7631('0x37')]())['catch'](function(_0x568944){console[_0x7631('0x38')](_0x568944);});}VoiceCallReport[_0x7631('0x39')]['isNotNull']=function(_0x32581c){return _0x32581c!==null&&!_[_0x7631('0x3a')](_0x32581c);};VoiceCallReport['prototype'][_0x7631('0x3b')]=function(_0x19c397,_0x5deec9,_0x5f4021){io['to'](_0x19c397)['emit'](_0x5deec9,_0x5f4021);};VoiceCallReport['prototype']['syncNewCallerId']=function(_0x46352c){try{if(this[_0x7631('0x3c')](_0x46352c)){if(_0x46352c['uniqueid']===_0x46352c[_0x7631('0x3d')]){if(!_[_0x7631('0x3a')](this[_0x7631('0x3e')][_0x46352c[_0x7631('0x3f')]])){_[_0x7631('0x40')](this[_0x7631('0x3e')][_0x46352c[_0x7631('0x3f')]],_[_0x7631('0x41')](_0x46352c,_[_0x7631('0x42')](this[_0x7631('0x3e')][_0x46352c[_0x7631('0x3f')]])));}}}}catch(_0x470c5a){logger[_0x7631('0x43')]('[syncNewCallerId][VoiceCallReport]',util[_0x7631('0x44')](_0x470c5a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7631('0x39')][_0x7631('0x26')]=function(_0x163ab0){try{if(this['isNotNull'](_0x163ab0)){if(_0x163ab0['uniqueid']===_0x163ab0[_0x7631('0x3d')]&&_0x163ab0[_0x7631('0x45')]!=_0x7631('0x46')){if(_[_0x7631('0x3a')](this[_0x7631('0x3e')][_0x163ab0['uniqueid']])){this[_0x7631('0x3e')][_0x163ab0[_0x7631('0x3f')]]=new Channel();this[_0x7631('0x3e')][_0x163ab0['uniqueid']]['starttime']=moment()[_0x7631('0x47')](_0x7631('0x48'));this[_0x7631('0x3e')][_0x163ab0[_0x7631('0x3f')]][_0x7631('0x49')]=dispositions[_[_0x7631('0x4a')](_0x163ab0[_0x7631('0x4b')])];_[_0x7631('0x40')](this['channels'][_0x163ab0[_0x7631('0x3f')]],_[_0x7631('0x41')](_0x163ab0,_[_0x7631('0x42')](this[_0x7631('0x3e')][_0x163ab0[_0x7631('0x3f')]])));if(_0x163ab0[_0x7631('0x4c')]===_0x7631('0x4d')){if(this[_0x7631('0x21')][_0x163ab0[_0x7631('0x45')][_0x7631('0x4e')]('-')[0x0]]){this[_0x7631('0x21')][_0x163ab0[_0x7631('0x45')]['split']('-')[0x0]][_0x7631('0x4f')]=_0x163ab0[_0x7631('0x50')];this[_0x7631('0x3b')](util[_0x7631('0x47')]('user:%s',this['agents'][_0x163ab0[_0x7631('0x45')]['split']('-')[0x0]][_0x7631('0x51')]),_0x7631('0x52'),{'destaccountcode':this[_0x7631('0x21')][_0x163ab0[_0x7631('0x45')][_0x7631('0x4e')]('-')[0x0]][_0x7631('0x53')],'destconnectedlinenum':_0x163ab0[_0x7631('0x50')]});}}}}}}catch(_0x183eae){logger[_0x7631('0x43')](_0x7631('0x54'),util['inspect'](_0x183eae,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7631('0x39')][_0x7631('0x23')]=function(_0xc1a2de){try{if(this[_0x7631('0x3c')](_0xc1a2de)){if(_0xc1a2de['uniqueid']===_0xc1a2de['linkedid']&&_0xc1a2de[_0x7631('0x50')]!='h'&&_0xc1a2de['channel']!=_0x7631('0x46')){_0xc1a2de['application']=_0xc1a2de['application'][_0x7631('0x55')]();_0xc1a2de[_0x7631('0x56')]=(_0xc1a2de[_0x7631('0x57')]||_0xc1a2de[_0x7631('0x56')])['toLowerCase']();if(_[_0x7631('0x3a')](this[_0x7631('0x3e')][_0xc1a2de[_0x7631('0x3f')]])){this['channels'][_0xc1a2de[_0x7631('0x3f')]]=new Channel();this[_0x7631('0x3e')][_0xc1a2de[_0x7631('0x3f')]][_0x7631('0x58')]=_0xc1a2de['duration']?moment()[_0x7631('0x59')](moment[_0x7631('0x5a')](_0xc1a2de[_0x7631('0x5a')])[_0x7631('0x5b')](),_0x7631('0x5b'))[_0x7631('0x47')](_0x7631('0x48')):moment()[_0x7631('0x47')](_0x7631('0x48'));this['channels'][_0xc1a2de[_0x7631('0x3f')]][_0x7631('0x49')]=_0x7631('0x1a');}_[_0x7631('0x40')](this[_0x7631('0x3e')][_0xc1a2de[_0x7631('0x3f')]],_[_0x7631('0x41')](_0xc1a2de,_[_0x7631('0x42')](this['channels'][_0xc1a2de[_0x7631('0x3f')]])));if(_[_0x7631('0x5c')](applications,_0xc1a2de[_0x7631('0x5d')])){this[_0x7631('0x3e')][_0xc1a2de[_0x7631('0x3f')]][_0x7631('0x5e')]=_0xc1a2de[_0x7631('0x5d')];this[_0x7631('0x3e')][_0xc1a2de[_0x7631('0x3f')]][_0x7631('0x5f')]=_0xc1a2de[_0x7631('0x56')];if(_0xc1a2de[_0x7631('0x5d')]===_0x7631('0x13')&&_['startsWith'](_0xc1a2de[_0x7631('0x56')],_0x7631('0x60'))){var _0x3c0c13=_0xc1a2de['applicationdata']['split']('=');var _0x1c62b8=_0x3c0c13[0x0][_0x7631('0x61')](/cdr\((.*)\)/);if(_0x1c62b8){this[_0x7631('0x3e')][_0xc1a2de[_0x7631('0x3f')]][_0x1c62b8[0x1]]=_0x3c0c13[0x1];}}else if(_0xc1a2de[_0x7631('0x5d')]===_0x7631('0x14')){this[_0x7631('0x3e')][_0xc1a2de['uniqueid']][_0x7631('0x14')]=_0xc1a2de['applicationdata']['split'](',')[0x0];}}}}}catch(_0x4db4ac){logger['error'](_0x7631('0x62'),util[_0x7631('0x44')](_0x4db4ac,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7631('0x39')]['syncNewState']=function(_0x45f813){try{if(this[_0x7631('0x3c')](_0x45f813)){if(_0x45f813[_0x7631('0x3f')]!==_0x45f813[_0x7631('0x3d')]){if(this[_0x7631('0x3e')][_0x45f813[_0x7631('0x3d')]]){if(_0x45f813[_0x7631('0x4b')]==='6'){if(!this[_0x7631('0x3e')][_0x45f813[_0x7631('0x3d')]][_0x7631('0x63')]){var _0x5204e2=moment();this[_0x7631('0x3e')][_0x45f813[_0x7631('0x3d')]][_0x7631('0x63')]=!![];this['channels'][_0x45f813[_0x7631('0x3d')]][_0x7631('0x64')]=_0x5204e2[_0x7631('0x47')](_0x7631('0x48'));if(this[_0x7631('0x3e')][_0x45f813['linkedid']]['starttime']){this['channels'][_0x45f813[_0x7631('0x3d')]][_0x7631('0x65')]=_0x5204e2[_0x7631('0x66')](this[_0x7631('0x3e')][_0x45f813['linkedid']][_0x7631('0x58')],_0x7631('0x5b'));}}this['channels'][_0x45f813['linkedid']]['linkedid']=_0x45f813[_0x7631('0x3f')];if(_0x45f813[_0x7631('0x67')]!==_0x7631('0x68')){this[_0x7631('0x3e')][_0x45f813['linkedid']]['connectedlinenum']=_0x45f813['calleridnum'];}this[_0x7631('0x3e')][_0x45f813[_0x7631('0x3d')]]['connectedlinename']=_0x45f813[_0x7631('0x69')];this[_0x7631('0x3e')][_0x45f813[_0x7631('0x3d')]][_0x7631('0x6a')]=_0x45f813[_0x7631('0x45')];this[_0x7631('0x3e')][_0x45f813[_0x7631('0x3d')]]['disposition']=dispositions[_[_0x7631('0x4a')](_0x45f813[_0x7631('0x4b')])];if(this[_0x7631('0x21')][_0x45f813['channel']['split']('-')[0x0]]){this[_0x7631('0x3e')][_0x45f813['linkedid']]['UserId']=this['agents'][_0x45f813[_0x7631('0x45')][_0x7631('0x4e')]('-')[0x0]]['id'];this[_0x7631('0x3e')][_0x45f813[_0x7631('0x3d')]][_0x7631('0x6b')]=this[_0x7631('0x21')][_0x45f813[_0x7631('0x45')][_0x7631('0x4e')]('-')[0x0]]['name'];}}}}else{if(this['channels'][_0x45f813[_0x7631('0x3f')]]){if(_0x45f813[_0x7631('0x4b')]==='6'){if(this[_0x7631('0x21')][_0x45f813[_0x7631('0x45')][_0x7631('0x4e')]('-')[0x0]]){this['channels'][_0x45f813[_0x7631('0x3f')]][_0x7631('0x6c')]=this[_0x7631('0x21')][_0x45f813['channel'][_0x7631('0x4e')]('-')[0x0]]['id'];this[_0x7631('0x3e')][_0x45f813[_0x7631('0x3f')]][_0x7631('0x6b')]=this[_0x7631('0x21')][_0x45f813['channel'][_0x7631('0x4e')]('-')[0x0]][_0x7631('0x51')];}}}}}}catch(_0x3d530c){logger[_0x7631('0x43')](_0x7631('0x6d'),util['inspect'](_0x3d530c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7631('0x39')][_0x7631('0x6e')]=function(_0x3783cd,_0x39bf90){if(this[_0x7631('0x3e')][_0x3783cd]){this[_0x7631('0x3e')][_0x3783cd]['monitor']=!![];if(_['endsWith'](_0x39bf90,_0x7631('0x6f'))){_0x39bf90=_0x39bf90[_0x7631('0x70')](_0x7631('0x6f'),'.WAV');}this['channels'][_0x3783cd]['monitorFilename']=_0x39bf90;var _0x530360=_[_0x7631('0x71')](this[_0x7631('0x3e')][_0x3783cd][_0x7631('0x72')],{'filename':_0x39bf90});if(_[_0x7631('0x73')](_0x530360)){this['channels'][_0x3783cd][_0x7631('0x72')][_0x7631('0x74')]({'filename':_0x39bf90,'createdAt':moment()['format'](_0x7631('0x48')),'mixmonitorid':'','status':_0x7631('0x75')});}}};VoiceCallReport[_0x7631('0x39')][_0x7631('0x29')]=function(_0x267857){try{if(this[_0x7631('0x3c')](_0x267857)){if(this['channels'][_0x267857['uniqueid']]&&_0x267857[_0x7631('0x45')]!=_0x7631('0x46')){if(this['isNotNull'](_0x267857[_0x7631('0x76')])){if(this[_0x7631('0x3c')](_0x267857[_0x7631('0x76')][_0x7631('0x77')])){this[_0x7631('0x6e')](_0x267857['uniqueid'],_0x267857['value']);}else if(this[_0x7631('0x3c')](_0x267857[_0x7631('0x76')][_0x7631('0x78')])){this[_0x7631('0x3e')][_0x267857[_0x7631('0x3f')]][_0x7631('0x67')]=_0x267857[_0x7631('0x79')];}else if(this['isNotNull'](_0x267857[_0x7631('0x76')][_0x7631('0x7a')])){this[_0x7631('0x3e')][_0x267857['uniqueid']][_0x7631('0x7b')]=_0x267857[_0x7631('0x79')];}else if(this[_0x7631('0x3c')](_0x267857['variable'][_0x7631('0x7c')])){this[_0x7631('0x3e')][_0x267857[_0x7631('0x3f')]]['type']=_0x267857[_0x7631('0x79')];}else if(this[_0x7631('0x3c')](_0x267857[_0x7631('0x76')][_0x7631('0x7d')])){this['channels'][_0x267857['uniqueid']]['queue']=_0x267857['value'][_0x7631('0x4e')](',')[0x0];}else if(this[_0x7631('0x3c')](_0x267857[_0x7631('0x76')]['xmd-originatecalleridnum'])){this[_0x7631('0x3e')][_0x267857['uniqueid']][_0x7631('0x7e')]=_0x267857[_0x7631('0x79')];}else if(this[_0x7631('0x3c')](_0x267857[_0x7631('0x76')][_0x7631('0x7f')])){this['channels'][_0x267857[_0x7631('0x3f')]][_0x7631('0x80')]=_0x267857['value'];}else if(this[_0x7631('0x3c')](_0x267857[_0x7631('0x76')][_0x7631('0x81')])){this[_0x7631('0x3e')][_0x267857[_0x7631('0x3f')]][_0x7631('0x82')]=_0x267857[_0x7631('0x79')];}else if(this[_0x7631('0x3c')](_0x267857['variable'][_0x7631('0x83')])){this[_0x7631('0x3e')][_0x267857[_0x7631('0x3f')]][_0x7631('0x14')]=_0x267857['value'];}else if(this['isNotNull'](_0x267857['variable'][_0x7631('0x84')])){this['channels'][_0x267857[_0x7631('0x3f')]][_0x7631('0x85')]=_0x267857[_0x7631('0x79')];}}}else if(this['isNotNull'](_0x267857[_0x7631('0x76')]['mixmonitor_filename'])){if(_0x267857[_0x7631('0x79')]){var _0x1c674b=path['parse'](_0x267857[_0x7631('0x79')])[_0x7631('0x51')];this[_0x7631('0x6e')](_0x1c674b,_0x267857['value']);}}else if(this[_0x7631('0x3e')][_0x267857[_0x7631('0x3d')]]){if(this[_0x7631('0x3c')](_0x267857['variable'])){if(this[_0x7631('0x3c')](_0x267857[_0x7631('0x76')]['sipcallid'])){this[_0x7631('0x3e')][_0x267857[_0x7631('0x3d')]][_0x7631('0x86')]=_0x267857[_0x7631('0x79')];}}}}}catch(_0x3ad385){logger[_0x7631('0x43')](_0x7631('0x87'),util[_0x7631('0x44')](_0x3ad385,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7631('0x2a')]=function(_0x39669a){try{if(this['isNotNull'](_0x39669a)){if(this[_0x7631('0x3e')][_0x39669a[_0x7631('0x3f')]]){var _0x47c484=moment();this[_0x7631('0x3e')][_0x39669a['uniqueid']]['endtime']=_0x47c484[_0x7631('0x47')](_0x7631('0x48'));this['channels'][_0x39669a[_0x7631('0x3f')]][_0x7631('0x5a')]=_0x47c484['diff'](this[_0x7631('0x3e')][_0x39669a[_0x7631('0x3f')]][_0x7631('0x58')],_0x7631('0x5b'));if(this['channels'][_0x39669a[_0x7631('0x3f')]][_0x7631('0x63')]){this[_0x7631('0x3e')][_0x39669a['uniqueid']][_0x7631('0x88')]=_0x47c484['diff'](this['channels'][_0x39669a['uniqueid']][_0x7631('0x64')],_0x7631('0x5b'));this['channels'][_0x39669a['uniqueid']][_0x7631('0x65')]=this[_0x7631('0x3e')][_0x39669a[_0x7631('0x3f')]][_0x7631('0x5a')]-this[_0x7631('0x3e')][_0x39669a[_0x7631('0x3f')]]['billableseconds'];}if(_0x39669a['context']==='from-sip'){if(this[_0x7631('0x21')][_0x39669a['channel']['split']('-')[0x0]]){this[_0x7631('0x21')][_0x39669a[_0x7631('0x45')][_0x7631('0x4e')]('-')[0x0]]=_[_0x7631('0x89')](this[_0x7631('0x21')][_0x39669a[_0x7631('0x45')]['split']('-')[0x0]],[_0x7631('0x4f')]);this[_0x7631('0x3b')](util[_0x7631('0x47')](_0x7631('0x8a'),this[_0x7631('0x21')][_0x39669a[_0x7631('0x45')][_0x7631('0x4e')]('-')[0x0]][_0x7631('0x51')]),_0x7631('0x8b'),{'destaccountcode':this[_0x7631('0x21')][_0x39669a['channel'][_0x7631('0x4e')]('-')[0x0]][_0x7631('0x53')]});}}ami[_0x7631('0x3b')]('custom:voiceCallReport',this[_0x7631('0x3e')][_0x39669a['uniqueid']]);delete this[_0x7631('0x3e')][_0x39669a['uniqueid']];}}}catch(_0x239e5d){logger['error'](_0x7631('0x8c'),util[_0x7631('0x44')](_0x239e5d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncAttendedTransfer']=function(_0x77b239){try{if(this['isNotNull'](_0x77b239)){if(this['channels'][_0x77b239[_0x7631('0x8d')]]){this[_0x7631('0x3e')][_0x77b239[_0x7631('0x8d')]]['transfercalleridnum']=_0x77b239[_0x7631('0x8e')];this[_0x7631('0x3e')][_0x77b239[_0x7631('0x8d')]][_0x7631('0x8f')]=_0x77b239[_0x7631('0x90')];if(this[_0x7631('0x3e')][_0x77b239['secondtransfereruniqueid']]){var _0x33e5f3=this[_0x7631('0x3e')][_0x77b239[_0x7631('0x91')]];this[_0x7631('0x3e')][_0x77b239[_0x7631('0x91')]]=this[_0x7631('0x3e')][_0x77b239[_0x7631('0x8d')]];this[_0x7631('0x3e')][_0x77b239[_0x7631('0x8d')]]=_0x33e5f3;}}else if(this[_0x7631('0x3e')][_0x77b239['transfertargetuniqueid']]){this[_0x7631('0x3e')][_0x77b239[_0x7631('0x92')]][_0x7631('0x93')]=_0x77b239[_0x7631('0x8e')];this[_0x7631('0x3e')][_0x77b239[_0x7631('0x92')]][_0x7631('0x8f')]=_0x77b239[_0x7631('0x90')];if(this['channels'][_0x77b239[_0x7631('0x94')]]){var _0x33e5f3=this['channels'][_0x77b239['origtransfereruniqueid']];this[_0x7631('0x3e')][_0x77b239['origtransfereruniqueid']]=this[_0x7631('0x3e')][_0x77b239[_0x7631('0x92')]];this[_0x7631('0x3e')][_0x77b239[_0x7631('0x92')]]=_0x33e5f3;}}}}catch(_0x503efa){logger[_0x7631('0x43')](_0x7631('0x95'),util[_0x7631('0x44')](_0x503efa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7631('0x39')][_0x7631('0x30')]=function(_0x174db9){try{if(this[_0x7631('0x3c')](_0x174db9)){if(this[_0x7631('0x3e')][_0x174db9['transfereeuniqueid']]){this['channels'][_0x174db9[_0x7631('0x8d')]][_0x7631('0x93')]=_0x174db9[_0x7631('0x96')];this['channels'][_0x174db9[_0x7631('0x8d')]][_0x7631('0x8f')]=_0x174db9[_0x7631('0x97')];this[_0x7631('0x2a')]({'event':_0x7631('0x98'),'uniqueid':_0x174db9[_0x7631('0x8d')],'context':_0x174db9[_0x7631('0x4c')],'channel':_0x174db9[_0x7631('0x99')]});}}}catch(_0x403480){logger[_0x7631('0x43')](_0x7631('0x9a'),util[_0x7631('0x44')](_0x403480,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7631('0x39')][_0x7631('0x32')]=function(_0x4ef6fc){try{if(this[_0x7631('0x3c')](_0x4ef6fc)){if(this[_0x7631('0x3e')][_0x4ef6fc[_0x7631('0x3f')]]){if(!_[_0x7631('0x73')](this['channels'][_0x4ef6fc['uniqueid']][_0x7631('0x64')])){this['channels'][_0x4ef6fc[_0x7631('0x3f')]]['mohstarttime']=moment()[_0x7631('0x47')]('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x18bc69){logger[_0x7631('0x43')]('[syncMusicOnHoldStart][VoiceCallReport]',util[_0x7631('0x44')](_0x18bc69,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x7631('0x34')]=function(_0xf2875d){try{if(this[_0x7631('0x3c')](_0xf2875d)){if(this[_0x7631('0x3e')][_0xf2875d['uniqueid']]){if(!_['isNil'](this[_0x7631('0x3e')][_0xf2875d['uniqueid']][_0x7631('0x9b')])){this[_0x7631('0x3e')][_0xf2875d[_0x7631('0x3f')]][_0x7631('0x9c')]+=moment()[_0x7631('0x9d')](0x0)['diff'](this[_0x7631('0x3e')][_0xf2875d[_0x7631('0x3f')]][_0x7631('0x9b')],'seconds');delete this[_0x7631('0x3e')][_0xf2875d['uniqueid']][_0x7631('0x9b')];}}}}catch(_0x4b873b){logger[_0x7631('0x43')](_0x7631('0x9e'),util[_0x7631('0x44')](_0x4b873b,{'showHidden':![],'depth':null}));}};module[_0x7631('0x9f')]=VoiceCallReport; \ No newline at end of file +var _0xcb66=['blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','prototype','isNotNull','isUndefined','emit','uniqueid','merge','channels','pick','keys','error','[syncNewCallerId][VoiceCallReport]','linkedid','channel','OutgoingSpoolFailed','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','context','agents','split','destconnectedlinenum','user:%s','user:agentconnect','accountcode','exten','[syncNewChannel][VoiceCallReport]','toLowerCase','applicationdata','subtract','duration','seconds','includes','application','lastapplication','lastdata','cdr(','match','syncNewState','answered','answertime','holdtime','calleridnum','xcally-motion-preview','connectedlinenum','connectedlinename','disposition','membername','UserId','name','inspect','syncMixMonitorFilename','monitor','.wav49','.WAV','find','isNil','monitors','rec','syncVarSet','variable','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','sipcallid','mixmonitor_filename','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','diff','billableseconds','from-sip','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','milliseconds','lodash','moment','util','path','ioredis','../../../config/logger','ami','../ami','../model/channel','unknown','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','localhost','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','hangup','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer'];(function(_0x4b3337,_0x31d955){var _0x3195f1=function(_0x4d526f){while(--_0x4d526f){_0x4b3337['push'](_0x4b3337['shift']());}};_0x3195f1(++_0x31d955);}(_0xcb66,0x19f));var _0x6cb6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xcb66[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require('bluebird');var _=require(_0x6cb6('0x0'));var moment=require(_0x6cb6('0x1'));var util=require(_0x6cb6('0x2'));var path=require(_0x6cb6('0x3'));var Redis=require(_0x6cb6('0x4'));var config=require('../../../config/environment');var logger=require(_0x6cb6('0x5'))(_0x6cb6('0x6'));var ami=require(_0x6cb6('0x7'));var Channel=require(_0x6cb6('0x8'));var statusDesc=[_0x6cb6('0x9'),'not_inuse','inuse',_0x6cb6('0xa'),_0x6cb6('0xb'),_0x6cb6('0xc'),_0x6cb6('0xd'),_0x6cb6('0xe'),_0x6cb6('0xf')];var applications=[_0x6cb6('0x10'),_0x6cb6('0x11'),_0x6cb6('0x12'),_0x6cb6('0x13'),_0x6cb6('0x14'),_0x6cb6('0x15')];var dispositions=[_0x6cb6('0x16'),'FAILED','FAILED','NO\x20ANSWER','NO\x20ANSWER',_0x6cb6('0x16'),_0x6cb6('0x17'),_0x6cb6('0x18'),_0x6cb6('0x19'),'FAILED',_0x6cb6('0x19')];var actions={};config[_0x6cb6('0x1a')]=_['defaults'](config[_0x6cb6('0x1a')],{'host':_0x6cb6('0x1b'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6cb6('0x1a')]));function VoiceCallReport(_0x26b46b){this['channels']=_0x26b46b['channels'];this['agents']=_0x26b46b['agents'];ami['on'](_0x6cb6('0x1c'),this[_0x6cb6('0x1d')][_0x6cb6('0x1e')](this));ami['on'](_0x6cb6('0x1f'),this[_0x6cb6('0x1d')][_0x6cb6('0x1e')](this));ami['on']('newchannel',this[_0x6cb6('0x20')][_0x6cb6('0x1e')](this));ami['on']('newstate',this['syncNewState']['bind'](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x6cb6('0x21'),this[_0x6cb6('0x22')][_0x6cb6('0x1e')](this));ami['on'](_0x6cb6('0x23'),this[_0x6cb6('0x24')]['bind'](this));ami['on']('attendedtransfer',this[_0x6cb6('0x25')][_0x6cb6('0x1e')](this));ami['on'](_0x6cb6('0x26'),this[_0x6cb6('0x27')]['bind'](this));ami['on'](_0x6cb6('0x28'),this[_0x6cb6('0x29')]['bind'](this));ami['on']('musiconholdstop',this[_0x6cb6('0x2a')]['bind'](this));return BPromise[_0x6cb6('0x2b')]()[_0x6cb6('0x2c')](ami[_0x6cb6('0x2d')]())[_0x6cb6('0x2e')](function(_0x299830){console[_0x6cb6('0x2f')](_0x299830);});}VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x31')]=function(_0x1cc1ed){return _0x1cc1ed!==null&&!_[_0x6cb6('0x32')](_0x1cc1ed);};VoiceCallReport['prototype']['emit']=function(_0x4ea573,_0x2dc6c9,_0x462dbf){io['to'](_0x4ea573)[_0x6cb6('0x33')](_0x2dc6c9,_0x462dbf);};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x24')]=function(_0x3b62e6){try{if(this['isNotNull'](_0x3b62e6)){if(_0x3b62e6[_0x6cb6('0x34')]===_0x3b62e6['linkedid']){if(!_[_0x6cb6('0x32')](this['channels'][_0x3b62e6[_0x6cb6('0x34')]])){_[_0x6cb6('0x35')](this[_0x6cb6('0x36')][_0x3b62e6['uniqueid']],_[_0x6cb6('0x37')](_0x3b62e6,_[_0x6cb6('0x38')](this[_0x6cb6('0x36')][_0x3b62e6['uniqueid']])));}}}}catch(_0x1c4942){logger[_0x6cb6('0x39')](_0x6cb6('0x3a'),util['inspect'](_0x1c4942,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x20')]=function(_0x4e94a3){try{if(this[_0x6cb6('0x31')](_0x4e94a3)){if(_0x4e94a3[_0x6cb6('0x34')]===_0x4e94a3[_0x6cb6('0x3b')]&&_0x4e94a3[_0x6cb6('0x3c')]!=_0x6cb6('0x3d')){if(_[_0x6cb6('0x32')](this[_0x6cb6('0x36')][_0x4e94a3[_0x6cb6('0x34')]])){this[_0x6cb6('0x36')][_0x4e94a3[_0x6cb6('0x34')]]=new Channel();this['channels'][_0x4e94a3[_0x6cb6('0x34')]][_0x6cb6('0x3e')]=moment()[_0x6cb6('0x3f')](_0x6cb6('0x40'));this['channels'][_0x4e94a3['uniqueid']]['disposition']=dispositions[_[_0x6cb6('0x41')](_0x4e94a3[_0x6cb6('0x42')])];_[_0x6cb6('0x35')](this[_0x6cb6('0x36')][_0x4e94a3[_0x6cb6('0x34')]],_[_0x6cb6('0x37')](_0x4e94a3,_[_0x6cb6('0x38')](this[_0x6cb6('0x36')][_0x4e94a3['uniqueid']])));if(_0x4e94a3[_0x6cb6('0x43')]==='from-sip'){if(this[_0x6cb6('0x44')][_0x4e94a3[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]]){this[_0x6cb6('0x44')][_0x4e94a3[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]][_0x6cb6('0x46')]=_0x4e94a3['exten'];this[_0x6cb6('0x33')](util['format'](_0x6cb6('0x47'),this[_0x6cb6('0x44')][_0x4e94a3[_0x6cb6('0x3c')]['split']('-')[0x0]]['name']),_0x6cb6('0x48'),{'destaccountcode':this['agents'][_0x4e94a3[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]][_0x6cb6('0x49')],'destconnectedlinenum':_0x4e94a3[_0x6cb6('0x4a')]});}}}}}}catch(_0x267c95){logger[_0x6cb6('0x39')](_0x6cb6('0x4b'),util['inspect'](_0x267c95,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x1d')]=function(_0x4d380e){try{if(this[_0x6cb6('0x31')](_0x4d380e)){if(_0x4d380e[_0x6cb6('0x34')]===_0x4d380e[_0x6cb6('0x3b')]&&_0x4d380e[_0x6cb6('0x4a')]!='h'&&_0x4d380e[_0x6cb6('0x3c')]!=_0x6cb6('0x3d')){_0x4d380e['application']=_0x4d380e['application'][_0x6cb6('0x4c')]();_0x4d380e['applicationdata']=(_0x4d380e['appdata']||_0x4d380e[_0x6cb6('0x4d')])['toLowerCase']();if(_[_0x6cb6('0x32')](this[_0x6cb6('0x36')][_0x4d380e['uniqueid']])){this['channels'][_0x4d380e[_0x6cb6('0x34')]]=new Channel();this['channels'][_0x4d380e[_0x6cb6('0x34')]][_0x6cb6('0x3e')]=_0x4d380e['duration']?moment()[_0x6cb6('0x4e')](moment[_0x6cb6('0x4f')](_0x4d380e['duration'])[_0x6cb6('0x50')](),'seconds')[_0x6cb6('0x3f')](_0x6cb6('0x40')):moment()['format'](_0x6cb6('0x40'));this[_0x6cb6('0x36')][_0x4d380e['uniqueid']]['disposition']=_0x6cb6('0x16');}_[_0x6cb6('0x35')](this[_0x6cb6('0x36')][_0x4d380e['uniqueid']],_[_0x6cb6('0x37')](_0x4d380e,_[_0x6cb6('0x38')](this['channels'][_0x4d380e[_0x6cb6('0x34')]])));if(_[_0x6cb6('0x51')](applications,_0x4d380e[_0x6cb6('0x52')])){this['channels'][_0x4d380e[_0x6cb6('0x34')]][_0x6cb6('0x53')]=_0x4d380e[_0x6cb6('0x52')];this[_0x6cb6('0x36')][_0x4d380e[_0x6cb6('0x34')]][_0x6cb6('0x54')]=_0x4d380e['applicationdata'];if(_0x4d380e[_0x6cb6('0x52')]==='set'&&_['startsWith'](_0x4d380e[_0x6cb6('0x4d')],_0x6cb6('0x55'))){var _0x4b4137=_0x4d380e[_0x6cb6('0x4d')]['split']('=');var _0x17b229=_0x4b4137[0x0][_0x6cb6('0x56')](/cdr\((.*)\)/);if(_0x17b229){this[_0x6cb6('0x36')][_0x4d380e['uniqueid']][_0x17b229[0x1]]=_0x4b4137[0x1];}}else if(_0x4d380e[_0x6cb6('0x52')]===_0x6cb6('0x11')){this[_0x6cb6('0x36')][_0x4d380e['uniqueid']][_0x6cb6('0x11')]=_0x4d380e['applicationdata'][_0x6cb6('0x45')](',')[0x0];}}}}}catch(_0x2684bb){logger[_0x6cb6('0x39')]('[syncNewExten][VoiceCallReport]',util['inspect'](_0x2684bb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x57')]=function(_0x1d12da){try{if(this['isNotNull'](_0x1d12da)){if(_0x1d12da[_0x6cb6('0x34')]!==_0x1d12da[_0x6cb6('0x3b')]){if(this[_0x6cb6('0x36')][_0x1d12da['linkedid']]){if(_0x1d12da[_0x6cb6('0x42')]==='6'){if(!this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]]['answered']){var _0x3f011f=moment();this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x58')]=!![];this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x59')]=_0x3f011f[_0x6cb6('0x3f')](_0x6cb6('0x40'));if(this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x3e')]){this['channels'][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x5a')]=_0x3f011f['diff'](this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]]['starttime'],_0x6cb6('0x50'));}}this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]]['linkedid']=_0x1d12da[_0x6cb6('0x34')];if(_0x1d12da[_0x6cb6('0x5b')]!==_0x6cb6('0x5c')){this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x5d')]=_0x1d12da[_0x6cb6('0x5b')];}this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x5e')]=_0x1d12da['calleridname'];this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]]['destinationchannel']=_0x1d12da[_0x6cb6('0x3c')];this['channels'][_0x1d12da['linkedid']][_0x6cb6('0x5f')]=dispositions[_[_0x6cb6('0x41')](_0x1d12da[_0x6cb6('0x42')])];if(this[_0x6cb6('0x44')][_0x1d12da[_0x6cb6('0x3c')]['split']('-')[0x0]]){this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x3b')]]['UserId']=this[_0x6cb6('0x44')][_0x1d12da[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]]['id'];this['channels'][_0x1d12da[_0x6cb6('0x3b')]][_0x6cb6('0x60')]=this[_0x6cb6('0x44')][_0x1d12da[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]]['name'];}}}}else{if(this[_0x6cb6('0x36')][_0x1d12da['uniqueid']]){if(_0x1d12da[_0x6cb6('0x42')]==='6'){if(this['agents'][_0x1d12da[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]]){this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x34')]][_0x6cb6('0x61')]=this['agents'][_0x1d12da[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]]['id'];this[_0x6cb6('0x36')][_0x1d12da[_0x6cb6('0x34')]][_0x6cb6('0x60')]=this[_0x6cb6('0x44')][_0x1d12da['channel']['split']('-')[0x0]][_0x6cb6('0x62')];}}}}}}catch(_0x1aec61){logger[_0x6cb6('0x39')]('[syncNewState][VoiceCallReport]',util[_0x6cb6('0x63')](_0x1aec61,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x64')]=function(_0x51d1bd,_0x558e39){if(this[_0x6cb6('0x36')][_0x51d1bd]){this[_0x6cb6('0x36')][_0x51d1bd][_0x6cb6('0x65')]=!![];if(_['endsWith'](_0x558e39,_0x6cb6('0x66'))){_0x558e39=_0x558e39['replace'](_0x6cb6('0x66'),_0x6cb6('0x67'));}this[_0x6cb6('0x36')][_0x51d1bd]['monitorFilename']=_0x558e39;var _0x4d9517=_[_0x6cb6('0x68')](this[_0x6cb6('0x36')][_0x51d1bd]['monitors'],{'filename':_0x558e39});if(_[_0x6cb6('0x69')](_0x4d9517)){this['channels'][_0x51d1bd][_0x6cb6('0x6a')]['push']({'filename':_0x558e39,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x6cb6('0x6b')});}}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x6c')]=function(_0x3556da){try{if(this['isNotNull'](_0x3556da)){if(this['channels'][_0x3556da[_0x6cb6('0x34')]]&&_0x3556da['channel']!='OutgoingSpoolFailed'){if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')])){if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')]['mixmonitor_filename'])){this[_0x6cb6('0x64')](_0x3556da[_0x6cb6('0x34')],_0x3556da[_0x6cb6('0x6e')]);}else if(this['isNotNull'](_0x3556da['variable'][_0x6cb6('0x6f')])){this['channels'][_0x3556da[_0x6cb6('0x34')]]['calleridnum']=_0x3556da['value'];}else if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')][_0x6cb6('0x70')])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x34')]][_0x6cb6('0x71')]=_0x3556da[_0x6cb6('0x6e')];}else if(this[_0x6cb6('0x31')](_0x3556da['variable'][_0x6cb6('0x72')])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x34')]][_0x6cb6('0x73')]=_0x3556da[_0x6cb6('0x6e')];}else if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')][_0x6cb6('0x74')])){this[_0x6cb6('0x36')][_0x3556da['uniqueid']]['queue']=_0x3556da['value']['split'](',')[0x0];}else if(this[_0x6cb6('0x31')](_0x3556da['variable'][_0x6cb6('0x75')])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x34')]][_0x6cb6('0x76')]=_0x3556da[_0x6cb6('0x6e')];}else if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')][_0x6cb6('0x77')])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x34')]][_0x6cb6('0x78')]=_0x3556da['value'];}else if(this['isNotNull'](_0x3556da[_0x6cb6('0x6d')][_0x6cb6('0x79')])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x34')]][_0x6cb6('0x7a')]=_0x3556da[_0x6cb6('0x6e')];}else if(this['isNotNull'](_0x3556da[_0x6cb6('0x6d')]['xmcs-queue'])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x34')]][_0x6cb6('0x11')]=_0x3556da[_0x6cb6('0x6e')];}else if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')][_0x6cb6('0x7b')])){this['channels'][_0x3556da['uniqueid']]['sipcalluniqueid']=_0x3556da[_0x6cb6('0x6e')];}}}else if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')][_0x6cb6('0x7c')])){if(_0x3556da[_0x6cb6('0x6e')]){var _0x1e8c05=path[_0x6cb6('0x7d')](_0x3556da[_0x6cb6('0x6e')])[_0x6cb6('0x62')];this['syncMixMonitorFilename'](_0x1e8c05,_0x3556da[_0x6cb6('0x6e')]);}}else if(this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x3b')]]){if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')])){if(this[_0x6cb6('0x31')](_0x3556da[_0x6cb6('0x6d')]['sipcallid'])){this[_0x6cb6('0x36')][_0x3556da[_0x6cb6('0x3b')]][_0x6cb6('0x7e')]=_0x3556da[_0x6cb6('0x6e')];}}}}}catch(_0x23f39d){logger['error'](_0x6cb6('0x7f'),util[_0x6cb6('0x63')](_0x23f39d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x22')]=function(_0x208f7b){try{if(this['isNotNull'](_0x208f7b)){if(this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]]){var _0x266be9=moment();this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]][_0x6cb6('0x80')]=_0x266be9[_0x6cb6('0x3f')](_0x6cb6('0x40'));this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]][_0x6cb6('0x4f')]=_0x266be9[_0x6cb6('0x81')](this['channels'][_0x208f7b[_0x6cb6('0x34')]]['starttime'],'seconds');if(this['channels'][_0x208f7b[_0x6cb6('0x34')]]['answered']){this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]][_0x6cb6('0x82')]=_0x266be9[_0x6cb6('0x81')](this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]][_0x6cb6('0x59')],_0x6cb6('0x50'));this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]]['holdtime']=this[_0x6cb6('0x36')][_0x208f7b[_0x6cb6('0x34')]]['duration']-this[_0x6cb6('0x36')][_0x208f7b['uniqueid']][_0x6cb6('0x82')];}if(_0x208f7b[_0x6cb6('0x43')]===_0x6cb6('0x83')){if(this[_0x6cb6('0x44')][_0x208f7b[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]]){this[_0x6cb6('0x44')][_0x208f7b['channel'][_0x6cb6('0x45')]('-')[0x0]]=_[_0x6cb6('0x84')](this['agents'][_0x208f7b[_0x6cb6('0x3c')]['split']('-')[0x0]],[_0x6cb6('0x46')]);this[_0x6cb6('0x33')](util['format'](_0x6cb6('0x47'),this[_0x6cb6('0x44')][_0x208f7b[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]][_0x6cb6('0x62')]),_0x6cb6('0x85'),{'destaccountcode':this['agents'][_0x208f7b[_0x6cb6('0x3c')][_0x6cb6('0x45')]('-')[0x0]][_0x6cb6('0x49')]});}}ami[_0x6cb6('0x33')](_0x6cb6('0x86'),this[_0x6cb6('0x36')][_0x208f7b['uniqueid']]);delete this[_0x6cb6('0x36')][_0x208f7b['uniqueid']];}}}catch(_0x5a5446){logger[_0x6cb6('0x39')](_0x6cb6('0x87'),util['inspect'](_0x5a5446,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x25')]=function(_0x4d9702){try{if(this[_0x6cb6('0x31')](_0x4d9702)){if(this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x88')]]){this['channels'][_0x4d9702['transfereeuniqueid']][_0x6cb6('0x89')]=_0x4d9702[_0x6cb6('0x8a')];this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x88')]][_0x6cb6('0x8b')]=_0x4d9702[_0x6cb6('0x8c')];if(this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8d')]]){var _0x3ae477=this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8d')]];this['channels'][_0x4d9702[_0x6cb6('0x8d')]]=this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x88')]];this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x88')]]=_0x3ae477;}}else if(this[_0x6cb6('0x36')][_0x4d9702['transfertargetuniqueid']]){this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8e')]][_0x6cb6('0x89')]=_0x4d9702['origtransferercalleridnum'];this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8e')]]['transferconnectedlinenum']=_0x4d9702['transfertargetcalleridnum'];if(this[_0x6cb6('0x36')][_0x4d9702['origtransfereruniqueid']]){var _0x3ae477=this[_0x6cb6('0x36')][_0x4d9702['origtransfereruniqueid']];this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8f')]]=this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8e')]];this[_0x6cb6('0x36')][_0x4d9702[_0x6cb6('0x8e')]]=_0x3ae477;}}}}catch(_0x40130a){logger[_0x6cb6('0x39')](_0x6cb6('0x90'),util[_0x6cb6('0x63')](_0x40130a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6cb6('0x27')]=function(_0x10b2f4){try{if(this[_0x6cb6('0x31')](_0x10b2f4)){if(this[_0x6cb6('0x36')][_0x10b2f4[_0x6cb6('0x88')]]){this['channels'][_0x10b2f4['transfereeuniqueid']]['transfercalleridnum']=_0x10b2f4[_0x6cb6('0x91')];this[_0x6cb6('0x36')][_0x10b2f4[_0x6cb6('0x88')]][_0x6cb6('0x8b')]=_0x10b2f4['extension'];this[_0x6cb6('0x22')]({'event':_0x6cb6('0x92'),'uniqueid':_0x10b2f4[_0x6cb6('0x88')],'context':_0x10b2f4[_0x6cb6('0x43')],'channel':_0x10b2f4[_0x6cb6('0x93')]});}}}catch(_0x49e78f){logger[_0x6cb6('0x39')](_0x6cb6('0x94'),util[_0x6cb6('0x63')](_0x49e78f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6cb6('0x30')][_0x6cb6('0x29')]=function(_0x1c6ac8){try{if(this[_0x6cb6('0x31')](_0x1c6ac8)){if(this[_0x6cb6('0x36')][_0x1c6ac8[_0x6cb6('0x34')]]){if(!_[_0x6cb6('0x69')](this[_0x6cb6('0x36')][_0x1c6ac8[_0x6cb6('0x34')]][_0x6cb6('0x59')])){this['channels'][_0x1c6ac8[_0x6cb6('0x34')]][_0x6cb6('0x95')]=moment()[_0x6cb6('0x3f')](_0x6cb6('0x40'));}}}}catch(_0xf5437){logger[_0x6cb6('0x39')]('[syncMusicOnHoldStart][VoiceCallReport]',util[_0x6cb6('0x63')](_0xf5437,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x6cb6('0x2a')]=function(_0x76cca1){try{if(this[_0x6cb6('0x31')](_0x76cca1)){if(this[_0x6cb6('0x36')][_0x76cca1[_0x6cb6('0x34')]]){if(!_[_0x6cb6('0x69')](this[_0x6cb6('0x36')][_0x76cca1['uniqueid']]['mohstarttime'])){this[_0x6cb6('0x36')][_0x76cca1[_0x6cb6('0x34')]]['mohtime']+=moment()[_0x6cb6('0x96')](0x0)[_0x6cb6('0x81')](this['channels'][_0x76cca1['uniqueid']]['mohstarttime'],_0x6cb6('0x50'));delete this[_0x6cb6('0x36')][_0x76cca1['uniqueid']][_0x6cb6('0x95')];}}}}catch(_0x32906c){logger[_0x6cb6('0x39')]('[syncMusicOnHoldStop][VoiceCallReport]',util[_0x6cb6('0x63')](_0x32906c,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 88b1be6..77abad2 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 _0x88d5=['rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','syncHangup','endtime','duration','diff','starttime','seconds','total','answertime','answered','sumBillable','billableseconds','sumDuration','custom:dialend','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','defaults','redis','localhost','socket.io-emitter','outbound','variables','dialbegin','bind','syncDialEnd','syncVarSet','hangup','prototype','isUndefined','emit','syncDialBegin','channels','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege','voice:outbound','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','isNotNull','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','custom:dialconnect','voice_outbound_channel:save','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged'];(function(_0x239904,_0x4b11e2){var _0x259609=function(_0x41d52a){while(--_0x41d52a){_0x239904['push'](_0x239904['shift']());}};_0x259609(++_0x4b11e2);}(_0x88d5,0x76));var _0x588d=function(_0x3440a4,_0x116b99){_0x3440a4=_0x3440a4-0x0;var _0xef09f2=_0x88d5[_0x3440a4];return _0xef09f2;};'use strict';var _=require(_0x588d('0x0'));var moment=require(_0x588d('0x1'));var util=require(_0x588d('0x2'));var Redis=require(_0x588d('0x3'));var config=require(_0x588d('0x4'));var logger=require('../../../config/logger')(_0x588d('0x5'));var ami=require(_0x588d('0x6'));config['redis']=_[_0x588d('0x7')](config[_0x588d('0x8')],{'host':_0x588d('0x9'),'port':0x18eb});var io=require(_0x588d('0xa'))(new Redis(config[_0x588d('0x8')]));function VoiceDialReport(_0x413748){this['channels']=_0x413748['outboundChannels'];this[_0x588d('0xb')]=_0x413748[_0x588d('0xb')];this[_0x588d('0xc')]={};ami['on'](_0x588d('0xd'),this['syncDialBegin'][_0x588d('0xe')](this));ami['on']('dialend',this[_0x588d('0xf')][_0x588d('0xe')](this));ami['on']('varset',this[_0x588d('0x10')][_0x588d('0xe')](this));ami['on'](_0x588d('0x11'),this['syncHangup'][_0x588d('0xe')](this));}VoiceDialReport[_0x588d('0x12')]['isNotNull']=function(_0x317528){return _0x317528!==null&&!_[_0x588d('0x13')](_0x317528);};VoiceDialReport[_0x588d('0x12')][_0x588d('0x14')]=function(_0x396af0,_0x5652cf,_0x4e741f){io['to'](_0x396af0)[_0x588d('0x14')](_0x5652cf,_0x4e741f);};VoiceDialReport[_0x588d('0x12')][_0x588d('0x15')]=function(_0x4ed8b2){try{if(this['isNotNull'](_0x4ed8b2)){if(this[_0x588d('0x16')][_0x4ed8b2[_0x588d('0x17')]]){_['merge'](this[_0x588d('0x16')][_0x4ed8b2[_0x588d('0x17')]],{'starttime':moment()[_0x588d('0x18')](_0x588d('0x19')),'lastevent':'called','interface':_0x4ed8b2[_0x588d('0x1a')][_0x588d('0x1b')](0x0,_0x4ed8b2['channel'][_0x588d('0x1c')]('-')),'membername':_0x4ed8b2[_0x588d('0x1a')]['substring'](_0x4ed8b2['channel'][_0x588d('0x1c')]('/')+0x1,_0x4ed8b2[_0x588d('0x1a')]['lastIndexOf']('-'))},_[_0x588d('0x1d')](_0x4ed8b2,[_0x588d('0x1e'),_0x588d('0x1f')]));this['emit'](_0x588d('0x20'),'voice_outbound_channel:save',this['channels'][_0x4ed8b2['uniqueid']]);ami['emit'](_0x588d('0x21'),this[_0x588d('0x16')][_0x4ed8b2[_0x588d('0x17')]]);}}}catch(_0x49bd5f){logger[_0x588d('0x22')](_0x588d('0x23'),util[_0x588d('0x24')](_0x49bd5f,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x588d('0x12')][_0x588d('0xf')]=function(_0x430863){try{if(this[_0x588d('0x25')](_0x430863)){if(this[_0x588d('0x16')][_0x430863['uniqueid']]){this[_0x588d('0x16')][_0x430863[_0x588d('0x17')]]['dialstatus']=_0x430863[_0x588d('0x26')];if(_0x430863['dialstatus']===_0x588d('0x27')){this[_0x588d('0x16')][_0x430863[_0x588d('0x17')]][_0x588d('0x28')]=_0x430863['connectedlinenum'];this[_0x588d('0x16')][_0x430863[_0x588d('0x17')]]['connectedlinename']=_0x430863[_0x588d('0x29')];this['channels'][_0x430863[_0x588d('0x17')]]['answertime']=moment()[_0x588d('0x18')](_0x588d('0x19'));this['channels'][_0x430863[_0x588d('0x17')]][_0x588d('0x2a')]=_0x588d('0x2b');ami[_0x588d('0x14')](_0x588d('0x2c'),this[_0x588d('0x16')][_0x430863[_0x588d('0x17')]]);}this[_0x588d('0x14')](_0x588d('0x20'),_0x588d('0x2d'),this['channels'][_0x430863['uniqueid']]);}}}catch(_0x4088c2){logger[_0x588d('0x22')](_0x588d('0x2e'),util[_0x588d('0x24')](_0x4088c2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x588d('0x12')]['syncVarSet']=function(_0xd96e62){try{if(this['isNotNull'](_0xd96e62)){this[_0x588d('0x2f')](_0xd96e62[_0x588d('0x17')],_[_0x588d('0x30')](_0xd96e62[_0x588d('0x31')])[0x0],_0xd96e62[_0x588d('0x32')]);if(this[_0x588d('0x25')](_0xd96e62['variable'])&&this[_0x588d('0x25')](_0xd96e62['variable'][_0x588d('0x33')])){if(_[_0x588d('0x13')](this[_0x588d('0x16')][_0xd96e62['uniqueid']])){this[_0x588d('0x16')][_0xd96e62['uniqueid']]={'routeId':_0xd96e62['value'],'variables':this['variables'][_0xd96e62[_0x588d('0x17')]]};this['emit'](_0x588d('0x20'),_0x588d('0x2d'),this['channels'][_0xd96e62[_0x588d('0x17')]]);}}}}catch(_0x15d6d7){logger[_0x588d('0x22')](_0x588d('0x34'),util[_0x588d('0x24')](_0x15d6d7,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x588d('0x12')]['addVariable']=function(_0x262b4e,_0x232310,_0x5cb680){var _0x43f540=[_0x588d('0x35'),'rtpaudioqosbridged',_0x588d('0x36'),_0x588d('0x37'),'rtpaudioqosloss',_0x588d('0x38'),_0x588d('0x39'),_0x588d('0x3a'),'sipcallid',_0x588d('0x3b'),'bridgepeer',_0x588d('0x3c'),_0x588d('0x3d'),_0x588d('0x3e'),_0x588d('0x3f'),_0x588d('0x40'),'membername','memberpenalty',_0x588d('0x41')];if(!_[_0x588d('0x42')](_0x232310)&&!_[_0x588d('0x43')](_0x43f540,_0x232310)){if(_[_0x588d('0x13')](this['variables'][_0x262b4e])){this['variables'][_0x262b4e]={};}this[_0x588d('0xc')][_0x262b4e][_0x232310]=_0x5cb680;}};VoiceDialReport['prototype'][_0x588d('0x44')]=function(_0x58b0d7){try{if(this[_0x588d('0x25')](_0x58b0d7)){if(this[_0x588d('0x16')][_0x58b0d7['uniqueid']]){this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]][_0x588d('0x45')]=moment()[_0x588d('0x18')](_0x588d('0x19'));this['channels'][_0x58b0d7[_0x588d('0x17')]][_0x588d('0x46')]=moment(this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]][_0x588d('0x45')])[_0x588d('0x47')](this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]][_0x588d('0x48')],_0x588d('0x49'));this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]]['lastevent']='complete';this[_0x588d('0xb')][_0x588d('0x4a')]+=0x1;if(this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]][_0x588d('0x4b')]){this[_0x588d('0xb')][_0x588d('0x4c')]+=0x1;this[_0x588d('0x16')][_0x58b0d7['uniqueid']]['holdtime']=moment(this[_0x588d('0x16')][_0x58b0d7['uniqueid']][_0x588d('0x4b')])['diff'](this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]]['starttime'],_0x588d('0x49'));this['channels'][_0x58b0d7[_0x588d('0x17')]]['billableseconds']=moment(this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]][_0x588d('0x45')])[_0x588d('0x47')](this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]][_0x588d('0x4b')],_0x588d('0x49'));this['outbound']['sumHoldTime']+=this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]]['holdtime']||0x0;this['outbound'][_0x588d('0x4d')]+=this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]][_0x588d('0x4e')];}this[_0x588d('0xb')][_0x588d('0x4f')]+=this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]][_0x588d('0x46')];ami[_0x588d('0x14')]('custom:voiceDialReport',this['channels'][_0x58b0d7[_0x588d('0x17')]]);ami['emit'](_0x588d('0x50'),this[_0x588d('0x16')][_0x58b0d7['uniqueid']]);this[_0x588d('0x14')]('voice:outbound','voice_outbound:save',this['outbound']);logger[_0x588d('0x51')](_0x588d('0x52'),JSON[_0x588d('0x53')](this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]]));this['emit'](_0x588d('0x20'),_0x588d('0x54'),this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]]);delete this[_0x588d('0x16')][_0x58b0d7[_0x588d('0x17')]];}if(this['variables'][_0x58b0d7[_0x588d('0x17')]]){delete this[_0x588d('0xc')][_0x58b0d7[_0x588d('0x17')]];}}}catch(_0x1c1bd6){logger['error'](_0x588d('0x55'),util[_0x588d('0x24')](_0x1c1bd6,{'showHidden':![],'depth':null}));}};module[_0x588d('0x56')]=VoiceDialReport; \ No newline at end of file +var _0x5dd1=['isNotNull','isUndefined','emit','merge','uniqueid','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','event','privilege','custom:dialbegin','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','connectedlinenum','connectedlinename','answertime','lastevent','custom:dialconnect','voice:outbound','error','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','value','outboundrouteid','voice_outbound_channel:save','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','variables','syncHangup','endtime','duration','diff','starttime','seconds','complete','answered','billableseconds','holdtime','sumDuration','custom:voiceDialReport','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outbound','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','prototype'];(function(_0x57db49,_0x288094){var _0xd0636f=function(_0x227787){while(--_0x227787){_0x57db49['push'](_0x57db49['shift']());}};_0xd0636f(++_0x288094);}(_0x5dd1,0xed));var _0x15dd=function(_0x738e24,_0x1e5e92){_0x738e24=_0x738e24-0x0;var _0x24a00a=_0x5dd1[_0x738e24];return _0x24a00a;};'use strict';var _=require(_0x15dd('0x0'));var moment=require(_0x15dd('0x1'));var util=require('util');var Redis=require(_0x15dd('0x2'));var config=require(_0x15dd('0x3'));var logger=require(_0x15dd('0x4'))(_0x15dd('0x5'));var ami=require(_0x15dd('0x6'));config[_0x15dd('0x7')]=_[_0x15dd('0x8')](config[_0x15dd('0x7')],{'host':_0x15dd('0x9'),'port':0x18eb});var io=require(_0x15dd('0xa'))(new Redis(config[_0x15dd('0x7')]));function VoiceDialReport(_0x339baf){this[_0x15dd('0xb')]=_0x339baf['outboundChannels'];this[_0x15dd('0xc')]=_0x339baf[_0x15dd('0xc')];this['variables']={};ami['on']('dialbegin',this[_0x15dd('0xd')][_0x15dd('0xe')](this));ami['on'](_0x15dd('0xf'),this[_0x15dd('0x10')][_0x15dd('0xe')](this));ami['on'](_0x15dd('0x11'),this[_0x15dd('0x12')]['bind'](this));ami['on'](_0x15dd('0x13'),this['syncHangup']['bind'](this));}VoiceDialReport[_0x15dd('0x14')][_0x15dd('0x15')]=function(_0x1ef43d){return _0x1ef43d!==null&&!_[_0x15dd('0x16')](_0x1ef43d);};VoiceDialReport['prototype'][_0x15dd('0x17')]=function(_0xdd7284,_0x28b9be,_0x26541a){io['to'](_0xdd7284)['emit'](_0x28b9be,_0x26541a);};VoiceDialReport['prototype'][_0x15dd('0xd')]=function(_0x26e0e8){try{if(this['isNotNull'](_0x26e0e8)){if(this[_0x15dd('0xb')][_0x26e0e8['uniqueid']]){_[_0x15dd('0x18')](this[_0x15dd('0xb')][_0x26e0e8[_0x15dd('0x19')]],{'starttime':moment()[_0x15dd('0x1a')](_0x15dd('0x1b')),'lastevent':'called','interface':_0x26e0e8[_0x15dd('0x1c')]['substring'](0x0,_0x26e0e8[_0x15dd('0x1c')][_0x15dd('0x1d')]('-')),'membername':_0x26e0e8[_0x15dd('0x1c')]['substring'](_0x26e0e8[_0x15dd('0x1c')]['lastIndexOf']('/')+0x1,_0x26e0e8[_0x15dd('0x1c')][_0x15dd('0x1d')]('-'))},_['omit'](_0x26e0e8,[_0x15dd('0x1e'),_0x15dd('0x1f')]));this[_0x15dd('0x17')]('voice:outbound','voice_outbound_channel:save',this[_0x15dd('0xb')][_0x26e0e8[_0x15dd('0x19')]]);ami[_0x15dd('0x17')](_0x15dd('0x20'),this[_0x15dd('0xb')][_0x26e0e8['uniqueid']]);}}}catch(_0x3dc7d8){logger['error'](_0x15dd('0x21'),util[_0x15dd('0x22')](_0x3dc7d8,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncDialEnd']=function(_0x394aca){try{if(this[_0x15dd('0x15')](_0x394aca)){if(this[_0x15dd('0xb')][_0x394aca['uniqueid']]){this[_0x15dd('0xb')][_0x394aca[_0x15dd('0x19')]][_0x15dd('0x23')]=_0x394aca[_0x15dd('0x23')];if(_0x394aca[_0x15dd('0x23')]==='ANSWER'){this['channels'][_0x394aca['uniqueid']][_0x15dd('0x24')]=_0x394aca[_0x15dd('0x24')];this['channels'][_0x394aca['uniqueid']][_0x15dd('0x25')]=_0x394aca[_0x15dd('0x25')];this['channels'][_0x394aca[_0x15dd('0x19')]][_0x15dd('0x26')]=moment()[_0x15dd('0x1a')](_0x15dd('0x1b'));this[_0x15dd('0xb')][_0x394aca[_0x15dd('0x19')]][_0x15dd('0x27')]='connect';ami[_0x15dd('0x17')](_0x15dd('0x28'),this['channels'][_0x394aca[_0x15dd('0x19')]]);}this['emit'](_0x15dd('0x29'),'voice_outbound_channel:save',this['channels'][_0x394aca[_0x15dd('0x19')]]);}}}catch(_0x147140){logger[_0x15dd('0x2a')](_0x15dd('0x2b'),util[_0x15dd('0x22')](_0x147140,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x15dd('0x14')][_0x15dd('0x12')]=function(_0xad760e){try{if(this[_0x15dd('0x15')](_0xad760e)){this[_0x15dd('0x2c')](_0xad760e[_0x15dd('0x19')],_[_0x15dd('0x2d')](_0xad760e[_0x15dd('0x2e')])[0x0],_0xad760e[_0x15dd('0x2f')]);if(this[_0x15dd('0x15')](_0xad760e[_0x15dd('0x2e')])&&this[_0x15dd('0x15')](_0xad760e['variable'][_0x15dd('0x30')])){if(_[_0x15dd('0x16')](this['channels'][_0xad760e['uniqueid']])){this[_0x15dd('0xb')][_0xad760e[_0x15dd('0x19')]]={'routeId':_0xad760e['value'],'variables':this['variables'][_0xad760e[_0x15dd('0x19')]]};this[_0x15dd('0x17')]('voice:outbound',_0x15dd('0x31'),this[_0x15dd('0xb')][_0xad760e[_0x15dd('0x19')]]);}}}}catch(_0x186160){logger[_0x15dd('0x2a')](_0x15dd('0x32'),util[_0x15dd('0x22')](_0x186160,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x15dd('0x14')][_0x15dd('0x2c')]=function(_0x52b4fa,_0x3592cc,_0x47aaab){var _0x276043=[_0x15dd('0x33'),_0x15dd('0x34'),'rtpaudioqosjitter',_0x15dd('0x35'),_0x15dd('0x36'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x15dd('0x37'),_0x15dd('0x38'),_0x15dd('0x39'),_0x15dd('0x3a'),_0x15dd('0x3b'),_0x15dd('0x3c'),_0x15dd('0x3d'),_0x15dd('0x3e'),_0x15dd('0x3f'),'membername',_0x15dd('0x40'),_0x15dd('0x41')];if(!_[_0x15dd('0x42')](_0x3592cc)&&!_['includes'](_0x276043,_0x3592cc)){if(_[_0x15dd('0x16')](this[_0x15dd('0x43')][_0x52b4fa])){this[_0x15dd('0x43')][_0x52b4fa]={};}this[_0x15dd('0x43')][_0x52b4fa][_0x3592cc]=_0x47aaab;}};VoiceDialReport[_0x15dd('0x14')][_0x15dd('0x44')]=function(_0x107ef0){try{if(this[_0x15dd('0x15')](_0x107ef0)){if(this[_0x15dd('0xb')][_0x107ef0['uniqueid']]){this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x45')]=moment()['format'](_0x15dd('0x1b'));this[_0x15dd('0xb')][_0x107ef0['uniqueid']][_0x15dd('0x46')]=moment(this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]]['endtime'])[_0x15dd('0x47')](this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x48')],_0x15dd('0x49'));this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]]['lastevent']=_0x15dd('0x4a');this['outbound']['total']+=0x1;if(this['channels'][_0x107ef0['uniqueid']]['answertime']){this['outbound'][_0x15dd('0x4b')]+=0x1;this['channels'][_0x107ef0[_0x15dd('0x19')]]['holdtime']=moment(this['channels'][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x26')])[_0x15dd('0x47')](this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x48')],'seconds');this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x4c')]=moment(this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x45')])['diff'](this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x26')],'seconds');this[_0x15dd('0xc')]['sumHoldTime']+=this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x4d')]||0x0;this[_0x15dd('0xc')]['sumBillable']+=this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]]['billableseconds'];}this['outbound'][_0x15dd('0x4e')]+=this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]][_0x15dd('0x46')];ami[_0x15dd('0x17')](_0x15dd('0x4f'),this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]]);ami['emit']('custom:dialend',this['channels'][_0x107ef0[_0x15dd('0x19')]]);this[_0x15dd('0x17')](_0x15dd('0x29'),_0x15dd('0x50'),this[_0x15dd('0xc')]);logger['info'](_0x15dd('0x51'),JSON[_0x15dd('0x52')](this['channels'][_0x107ef0[_0x15dd('0x19')]]));this[_0x15dd('0x17')]('voice:outbound',_0x15dd('0x53'),this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]]);delete this[_0x15dd('0xb')][_0x107ef0[_0x15dd('0x19')]];}if(this['variables'][_0x107ef0[_0x15dd('0x19')]]){delete this[_0x15dd('0x43')][_0x107ef0[_0x15dd('0x19')]];}}}catch(_0x56c348){logger[_0x15dd('0x2a')](_0x15dd('0x54'),util[_0x15dd('0x22')](_0x56c348,{'showHidden':![],'depth':null}));}};module[_0x15dd('0x55')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index fd9b622..7cd83d2 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 _0x003c=['diff','length','milliseconds','answered','lastevent','sumDuration','custom:voiceQueueReport','syncAttendedTransfer','transfereeuniqueid','transferexten','secondtransfererexten','ATTENDEDTRANSFER','transfertype','ATTENDED','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','BLINDTRANSFER','extension','BlindTransfer','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','syncMusicOnHoldStart','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','[syncMusicOnHoldStop][VoiceQueueReport]','exports','moment','bluebird','util','md5','ioredis','../../../config/environment','../../../config/logger','../ami','../model/queueReport','redis','defaults','prototype','enqueue','tail','finally','queueReports','agents','queueChannels','voiceQueues','flagQueueSummary','campaigns','queuesummary','syncQueueSummary','syncQueueSummaryComplete','syncQueueCallerJoin','bind','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','waiting','queueStatusComplete','clearZombieChannels','channels','switch','sequence','isNil','Action','status','catch','message','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','[voiceQueueReport][checkQueueReport]','variables','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','inspect','emit','emitVoiceQueueChannelSave','format','voice:queue:%s','name','info','stringify','emitVoiceQueueSummary','type','inbound','strategy','available','loggedIn','pTalking','total','Trunk','active','callerid','Interval','voice_queue:save','isNotNull','isUndefined','queues','[queues]','then','[queuesummary]','queue','countBy','toNumber','callers','loggedin','talking','custom:queuesummary','[syncQueueSummary][VoiceQueueReport]','syncNewExten','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','pick','push','[syncQueueCallerJoin][VoiceQueueReport]','last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[syncQueueCallerAbandon][VoiceQueueReport]','connectedlinenum','[syncQueueCallerLeave][VoiceQueueReport]','syncAgentConnect','COMPLETEDBYAGENT','assigned','queuecallerexit','transfer','reason','startsWith','channel','local/','linkedid','queuecallerexitAt','add','seconds','FORWARDTRANSFER','FORWARD','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','addVariable','keys','variable','value','queuestatus','queuecallerleaveAt','queueposition','[syncVarSet][VoiceQueueReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','includes','unmanaged','abandoned'];(function(_0x479272,_0x35c41f){var _0x27b317=function(_0x488d62){while(--_0x488d62){_0x479272['push'](_0x479272['shift']());}};_0x27b317(++_0x35c41f);}(_0x003c,0x1ab));var _0xc003=function(_0xa6d12c,_0x4678f8){_0xa6d12c=_0xa6d12c-0x0;var _0x225102=_0x003c[_0xa6d12c];return _0x225102;};'use strict';var _=require('lodash');var moment=require(_0xc003('0x0'));var BPromise=require(_0xc003('0x1'));var util=require(_0xc003('0x2'));var md5=require(_0xc003('0x3'));var Redis=require(_0xc003('0x4'));var config=require(_0xc003('0x5'));var logger=require(_0xc003('0x6'))('ami');var ami=require(_0xc003('0x7'));var QueueReport=require(_0xc003('0x8'));config[_0xc003('0x9')]=_[_0xc003('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xc003('0xb')][_0xc003('0xc')]=function(_0x2944a5){this[_0xc003('0xd')]=this[_0xc003('0xd')]?this['tail'][_0xc003('0xe')](_0x2944a5):_0x2944a5();};function VoiceQueueReport(_0x295265){this['sequence']=new Sequence();this[_0xc003('0xf')]={};this[_0xc003('0x10')]=_0x295265[_0xc003('0x10')];this['channels']=_0x295265[_0xc003('0x11')];this[_0xc003('0x12')]=_0x295265['voiceQueues'];this[_0xc003('0x13')]=!![];this[_0xc003('0x14')]=_0x295265[_0xc003('0x14')];this['variables']={};ami['on'](_0xc003('0x15'),this[_0xc003('0x16')]['bind'](this));ami['on']('queuesummarycomplete',this[_0xc003('0x17')]['bind'](this));ami['on']('queuecallerjoin',this[_0xc003('0x18')][_0xc003('0x19')](this));ami['on'](_0xc003('0x1a'),this[_0xc003('0x1b')][_0xc003('0x19')](this));ami['on']('queuecallerleave',this[_0xc003('0x1c')][_0xc003('0x19')](this));ami['on'](_0xc003('0x1d'),this[_0xc003('0x1e')][_0xc003('0x19')](this));ami['on'](_0xc003('0x1f'),this['syncAgentConnect'][_0xc003('0x19')](this));ami['on'](_0xc003('0x20'),this[_0xc003('0x21')][_0xc003('0x19')](this));ami['on'](_0xc003('0x22'),this[_0xc003('0x23')][_0xc003('0x19')](this));ami['on'](_0xc003('0x24'),this[_0xc003('0x25')]['bind'](this));ami['on'](_0xc003('0x26'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xc003('0x27'),this[_0xc003('0x28')][_0xc003('0x19')](this));ami['on'](_0xc003('0x29'),this['syncAttendedTransfer'][_0xc003('0x19')](this));ami['on'](_0xc003('0x2a'),this['syncBlindTransfer']['bind'](this));this[_0xc003('0x2b')]();this[_0xc003('0x2c')]();}function isNotNull(_0x436f22){return _0x436f22!==null&&!_['isUndefined'](_0x436f22);}function clearChannels(_0x2e6cc6){if(!_[_0xc003('0x2d')](_0x2e6cc6)){for(var _0x34178e in _0x2e6cc6){if(_0x2e6cc6['hasOwnProperty'](_0x34178e)){delete _0x2e6cc6[_0x34178e];}}}}function clearCampaigns(_0x1292e8){if(!_[_0xc003('0x2d')](_0x1292e8)){for(var _0x2dacba in _0x1292e8){if(_0x1292e8[_0xc003('0x2e')](_0x2dacba)){_0x1292e8[_0x2dacba][_0xc003('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x207dd6){if(!_[_0xc003('0x2d')](_0x207dd6)){for(var _0x4d2bd0 in _0x207dd6){if(_0x207dd6[_0xc003('0x2e')](_0x4d2bd0)){_0x207dd6[_0x4d2bd0][_0xc003('0x2f')]=0x0;_0x207dd6[_0x4d2bd0]['talking']=0x0;_0x207dd6[_0x4d2bd0]['pTalking']=0x0;_0x207dd6[_0x4d2bd0][_0xc003('0x30')]=0x0;_0x207dd6[_0x4d2bd0][_0xc003('0x31')]=!![];}}}}function clearAgentBooked(_0x2cca0f){if(!_[_0xc003('0x2d')](_0x2cca0f)){for(var _0x423b60 in _0x2cca0f){if(_0x2cca0f[_0xc003('0x2e')](_0x423b60)){_0x2cca0f[_0x423b60]['unlockRR']=!![];}}}}VoiceQueueReport['prototype'][_0xc003('0x32')]=function(){var _0x33c936=this;for(var _0x2cee04 in this[_0xc003('0x33')]){if(this[_0xc003('0x33')][_0xc003('0x2e')](_0x2cee04)&&!this[_0xc003('0x33')][_0x2cee04][_0xc003('0x34')]){this[_0xc003('0x35')]['enqueue'](function(){if(!_[_0xc003('0x36')](_0x33c936[_0xc003('0x33')][_0x2cee04])){return ami[_0xc003('0x37')]({'action':_0xc003('0x38'),'channel':_0x33c936[_0xc003('0x33')][_0x2cee04]['channel']})[_0xc003('0x39')](function(_0x34a06a){if(_0x34a06a[_0xc003('0x3a')]===_0xc003('0x3b')){setTimeout(function(){if(_0x33c936[_0xc003('0x33')][_0x2cee04]){delete _0x33c936[_0xc003('0x33')][_0x2cee04];logger[_0xc003('0x3c')](_0xc003('0x3d'),_0x2cee04);}if(_0x33c936[_0xc003('0xf')][_0x2cee04]){delete _0x33c936[_0xc003('0xf')][_0x2cee04];logger[_0xc003('0x3c')](_0xc003('0x3e'),_0x2cee04);}if(_0x33c936[_0xc003('0x3f')][_0x2cee04]){delete _0x33c936[_0xc003('0x3f')][_0x2cee04];logger[_0xc003('0x3c')](_0xc003('0x40'),_0x2cee04);}},0x1f40);}});}});}}};VoiceQueueReport[_0xc003('0xb')][_0xc003('0x25')]=function(){logger[_0xc003('0x3c')](_0xc003('0x41'));clearChannels(this['channels']);this[_0xc003('0x42')](this['queueReports']);clearAgentBooked(this[_0xc003('0x10')]);clearVoiceQueues(this[_0xc003('0x12')]);clearCampaigns(this[_0xc003('0x14')]);};VoiceQueueReport[_0xc003('0xb')][_0xc003('0x42')]=function(_0x64acf3){var _0x18e06c=this;if(!_['isEmpty'](_0x64acf3)){for(var _0x260d1b in _0x64acf3){if(_0x64acf3['hasOwnProperty'](_0x260d1b)){_0x18e06c[_0xc003('0x43')](_0x64acf3[_0x260d1b]);delete _0x64acf3[_0x260d1b];}}}};function loggerCatch(_0x2f6dfe){return function(_0x578719){logger['error'](_0x2f6dfe,util[_0xc003('0x44')](_0x578719,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0xc003('0xb')][_0xc003('0x45')]=function(_0x27891f,_0x267464,_0x620113){io['to'](_0x27891f)[_0xc003('0x45')](_0x267464,_0x620113);};VoiceQueueReport['prototype'][_0xc003('0x46')]=function(_0x5ad3e4){this[_0xc003('0x45')](util[_0xc003('0x47')](_0xc003('0x48'),_0x5ad3e4[_0xc003('0x49')]),'voice_queue_channel:save',_0x5ad3e4);};VoiceQueueReport['prototype']['emitVoiceQueueChannelRemove']=function(_0x4a0f5b){logger[_0xc003('0x4a')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xc003('0x4b')](_0x4a0f5b));this[_0xc003('0x45')](util[_0xc003('0x47')](_0xc003('0x48'),_0x4a0f5b['name']),'voice_queue_channel:remove',_0x4a0f5b);};VoiceQueueReport[_0xc003('0xb')][_0xc003('0x4c')]=function(_0x2df77a){if(_0x2df77a[_0xc003('0x4d')]===_0xc003('0x4e')){var _0x1339bd={'id':_0x2df77a['id'],'name':_0x2df77a['name'],'strategy':_0x2df77a[_0xc003('0x4f')],'answered':_0x2df77a['answered'],'available':_0x2df77a[_0xc003('0x50')],'loggedIn':_0x2df77a[_0xc003('0x51')],'pTalking':_0x2df77a[_0xc003('0x52')],'sumBillable':_0x2df77a['sumBillable'],'sumDuration':_0x2df77a['sumDuration'],'sumHoldTime':_0x2df77a['sumHoldTime']||0x0,'talking':_0x2df77a['talking'],'total':_0x2df77a[_0xc003('0x53')],'type':_0x2df77a[_0xc003('0x4d')],'unmanaged':_0x2df77a['unmanaged'],'abandoned':_0x2df77a['abandoned'],'waiting':_0x2df77a[_0xc003('0x30')]};if(_0x2df77a[_0xc003('0x54')]){_0x1339bd[_0xc003('0x54')]={'id':_0x2df77a[_0xc003('0x54')]['id'],'name':_0x2df77a['Trunk'][_0xc003('0x49')],'active':_0x2df77a[_0xc003('0x54')][_0xc003('0x55')],'callerid':_0x2df77a['Trunk'][_0xc003('0x56')]};}if(_0x2df77a[_0xc003('0x57')]){_0x1339bd['Interval']={'id':_0x2df77a['Interval']['id'],'name':_0x2df77a['Interval'][_0xc003('0x49')]};}var _0x1b5745=md5(JSON[_0xc003('0x4b')](_0x1339bd));if(_0x2df77a['md5']!==_0x1b5745){_0x2df77a['md5']=_0x1b5745;this['emit'](util['format'](_0xc003('0x48'),_0x1339bd['name']),_0xc003('0x58'),_0x1339bd);}}};VoiceQueueReport[_0xc003('0xb')][_0xc003('0x59')]=function(_0x14d358){return _0x14d358!==null&&!_[_0xc003('0x5a')](_0x14d358);};VoiceQueueReport[_0xc003('0xb')][_0xc003('0x2c')]=function(){var _0x54e77a=this;setInterval(function(){_0x54e77a[_0xc003('0x32')]();ami['Action']({'action':_0xc003('0x5b')})[_0xc003('0x39')](loggerCatch(_0xc003('0x5c')));},0x2710);};VoiceQueueReport[_0xc003('0xb')][_0xc003('0x2b')]=function(){var _0x1265ee=this;setInterval(function(){if(_0x1265ee['flagQueueSummary']){return ami['Action']({'action':'queuesummary'})[_0xc003('0x5d')](function(_0x2c79d3){_0x1265ee['flagQueueSummary']=![];})[_0xc003('0x39')](loggerCatch(_0xc003('0x5e')));}},0x3e8);};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x5c7efa){try{if(this[_0xc003('0x59')](_0x5c7efa)&&this['isNotNull'](_0x5c7efa[_0xc003('0x5f')])){if(this[_0xc003('0x12')][_0x5c7efa['queue']]){var _0x19f4b9=_[_0xc003('0x60')](this[_0xc003('0x33')],_0xc003('0x5f'))[_0x5c7efa[_0xc003('0x5f')]]||0x0;var _0x5c5da2=_0x19f4b9-_0x5c7efa['callers'];if(this[_0xc003('0x12')][_0x5c7efa[_0xc003('0x5f')]][_0xc003('0x30')]!==_[_0xc003('0x61')](_0x5c7efa[_0xc003('0x62')])||this[_0xc003('0x12')][_0x5c7efa[_0xc003('0x5f')]][_0xc003('0x51')]!==_[_0xc003('0x61')](_0x5c7efa[_0xc003('0x63')])||this['voiceQueues'][_0x5c7efa[_0xc003('0x5f')]][_0xc003('0x50')]!==_[_0xc003('0x61')](_0x5c7efa[_0xc003('0x50')])||this['voiceQueues'][_0x5c7efa[_0xc003('0x5f')]][_0xc003('0x64')]!==_0x5c5da2){this['voiceQueues'][_0x5c7efa[_0xc003('0x5f')]][_0xc003('0x30')]=_[_0xc003('0x61')](_0x5c7efa['callers']);this[_0xc003('0x12')][_0x5c7efa[_0xc003('0x5f')]][_0xc003('0x51')]=_[_0xc003('0x61')](_0x5c7efa[_0xc003('0x63')]);this[_0xc003('0x12')][_0x5c7efa['queue']]['available']=_[_0xc003('0x61')](_0x5c7efa[_0xc003('0x50')]);this[_0xc003('0x12')][_0x5c7efa[_0xc003('0x5f')]]['talking']=_0x5c5da2>0x0?_0x5c5da2:0x0;this['voiceQueues'][_0x5c7efa[_0xc003('0x5f')]]['talking']=this[_0xc003('0x12')][_0x5c7efa[_0xc003('0x5f')]][_0xc003('0x64')]>_[_0xc003('0x61')](_0x5c7efa[_0xc003('0x63')])?_[_0xc003('0x61')](_0x5c7efa[_0xc003('0x63')]):this[_0xc003('0x12')][_0x5c7efa[_0xc003('0x5f')]][_0xc003('0x64')];this[_0xc003('0x4c')](this[_0xc003('0x12')][_0x5c7efa[_0xc003('0x5f')]]);}ami[_0xc003('0x45')](_0xc003('0x65'),this['voiceQueues'][_0x5c7efa['queue']]);}}}catch(_0x5a86a8){logger[_0xc003('0x3c')](_0xc003('0x66'),util[_0xc003('0x44')](_0x5a86a8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc003('0xb')][_0xc003('0x17')]=function(_0x58e04f){this[_0xc003('0x13')]=!![];};VoiceQueueReport[_0xc003('0xb')][_0xc003('0x67')]=function(_0x500154){};VoiceQueueReport['prototype']['syncQueueCallerJoin']=function(_0x2b7819){try{if(this[_0xc003('0x59')](_0x2b7819)){if(_['isUndefined'](this['queueReports'][_0x2b7819[_0xc003('0x68')]])){this[_0xc003('0xf')][_0x2b7819['uniqueid']]=[];this[_0xc003('0x33')][_0x2b7819[_0xc003('0x68')]]={};}var _0x38fde2=new QueueReport();_0x38fde2[_0xc003('0x49')]=_0x2b7819[_0xc003('0x5f')];_0x38fde2[_0xc003('0x4d')]=this['voiceQueues'][_0x38fde2[_0xc003('0x49')]]&&this[_0xc003('0x12')][_0x38fde2[_0xc003('0x49')]]['type']?this[_0xc003('0x12')][_0x38fde2[_0xc003('0x49')]][_0xc003('0x4d')]||'inbound':_0xc003('0x4e');_0x38fde2['queue']=_0x2b7819[_0xc003('0x5f')];_0x38fde2[_0xc003('0x69')]=moment()[_0xc003('0x47')](_0xc003('0x6a'));_0x38fde2[_0xc003('0x6b')]=_0x2b7819['position'];_0x38fde2[_0xc003('0x6c')]=_0x2b7819[_0xc003('0x6c')];_['merge'](_0x38fde2,_[_0xc003('0x6d')](_0x2b7819,_['keys'](_0x38fde2)));this[_0xc003('0xf')][_0x2b7819[_0xc003('0x68')]][_0xc003('0x6e')](_0x38fde2);this[_0xc003('0x33')][_0x2b7819[_0xc003('0x68')]]=_0x38fde2;this[_0xc003('0x46')](_0x38fde2);}}catch(_0x3049d9){logger['error'](_0xc003('0x6f'),util[_0xc003('0x44')](_0x3049d9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc003('0xb')][_0xc003('0x1b')]=function(_0x18b970){try{if(this['isNotNull'](_0x18b970)){if(this[_0xc003('0xf')][_0x18b970[_0xc003('0x68')]]){var _0x180dba=_[_0xc003('0x70')](this['queueReports'][_0x18b970[_0xc003('0x68')]]);_0x180dba[_0xc003('0x71')]=![];_0x180dba[_0xc003('0x72')]=null;_0x180dba[_0xc003('0x73')]=_0x18b970[_0xc003('0x73')];_0x180dba[_0xc003('0x74')]=_0x18b970['originalposition'];_0x180dba[_0xc003('0x1a')]=!![];_0x180dba[_0xc003('0x75')]=moment()[_0xc003('0x47')](_0xc003('0x6a'));_0x180dba[_0xc003('0x76')]=_0xc003('0x77');_0x180dba['lastAssignedTo']=null;this['channels'][_0x18b970['uniqueid']]=_0x180dba;this[_0xc003('0x43')](_0x180dba);}}}catch(_0x4b214e){logger['error'](_0xc003('0x78'),util[_0xc003('0x44')](_0x4b214e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x5a6704){try{if(this[_0xc003('0x59')](_0x5a6704)){if(this['queueReports'][_0x5a6704[_0xc003('0x68')]]){var _0x57a57b=_[_0xc003('0x70')](this['queueReports'][_0x5a6704['uniqueid']]);_0x57a57b['queuecallerleaveAt']=moment()[_0xc003('0x47')](_0xc003('0x6a'));_0x57a57b[_0xc003('0x79')]=_0x5a6704[_0xc003('0x79')];_0x57a57b['connectedlinename']=_0x5a6704['connectedlinename'];this[_0xc003('0x33')][_0x5a6704[_0xc003('0x68')]]=_0x57a57b;this[_0xc003('0x46')](_0x57a57b);}}}catch(_0x171882){logger[_0xc003('0x3c')](_0xc003('0x7a'),util[_0xc003('0x44')](_0x171882,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc003('0xb')][_0xc003('0x7b')]=function(_0x285cf8){try{if(this['isNotNull'](_0x285cf8)){if(this[_0xc003('0xf')][_0x285cf8[_0xc003('0x68')]]){var _0x39a236=_[_0xc003('0x70')](this[_0xc003('0xf')][_0x285cf8[_0xc003('0x68')]]);_0x39a236[_0xc003('0x71')]=!![];_0x39a236[_0xc003('0x76')]=_0xc003('0x7c');}}}catch(_0x43d8d3){logger['error']('[syncAgentConnect][VoiceQueueReport]',util[_0xc003('0x44')](_0x43d8d3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xc003('0xb')][_0xc003('0x1e')]=function(_0x32a9a6){try{if(this[_0xc003('0x59')](_0x32a9a6)){if(this[_0xc003('0xf')][_0x32a9a6['uniqueid']]){var _0x122c49=_[_0xc003('0x70')](this['queueReports'][_0x32a9a6['uniqueid']]);_0x122c49['queuecallerabandon']=![];_0x122c49[_0xc003('0x75')]=null;_0x122c49[_0xc003('0x7d')]=!![];_0x122c49['lastAssignedTo']=_0x32a9a6['membername'];_0x122c49['holdtime']=_0x32a9a6['holdtime'];_0x122c49[_0xc003('0x71')]=!![];_0x122c49[_0xc003('0x7e')]=![];_0x122c49['queuecallerexitAt']=null;if(!_0x122c49[_0xc003('0x7f')]){if(_0x32a9a6[_0xc003('0x80')]=='transfer'){_0x122c49[_0xc003('0x76')]='COMPLETED';}else{if(_[_0xc003('0x81')](_0x32a9a6[_0xc003('0x82')]['toLowerCase'](),_0xc003('0x83'))){if(this[_0xc003('0xf')][_0x32a9a6['linkedid']]){var _0x5551e4=_[_0xc003('0x70')](this[_0xc003('0xf')][_0x32a9a6[_0xc003('0x84')]]);_0x5551e4['queuecallercomplete']=![];_0x5551e4[_0xc003('0x7e')]=!![];_0x5551e4[_0xc003('0x85')]=moment(_0x122c49[_0xc003('0x69')])[_0xc003('0x86')](_0x32a9a6['holdtime'],_0xc003('0x87'))[_0xc003('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x5551e4[_0xc003('0x76')]=_0xc003('0x88');_0x5551e4[_0xc003('0x7f')]=!![];_0x5551e4['transfertype']=_0xc003('0x89');_0x5551e4['transferexten']=_0x32a9a6[_0xc003('0x8a')];_0x5551e4[_0xc003('0x8b')]=_0x32a9a6[_0xc003('0x68')];var _0x492c89=this[_0xc003('0xf')][_0x32a9a6['linkedid']];this['queueReports'][_0x32a9a6[_0xc003('0x84')]]=this[_0xc003('0xf')][_0x32a9a6[_0xc003('0x68')]];this['queueReports'][_0x32a9a6[_0xc003('0x68')]]=_0x492c89;}}else{_0x122c49['queuecallerexitreason']=_0xc003('0x8c')+_0x32a9a6[_0xc003('0x80')][_0xc003('0x8d')]();}}}this[_0xc003('0x33')][_0x32a9a6[_0xc003('0x68')]]=_0x122c49;this['emitVoiceQueueChannelRemove'](_0x122c49);}}}catch(_0x5ab937){logger[_0xc003('0x3c')](_0xc003('0x8e'),util[_0xc003('0x44')](_0x5ab937,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc003('0x21')]=function(_0x703036){try{if(this[_0xc003('0x59')](_0x703036)){this[_0xc003('0x8f')](_0x703036['uniqueid'],_[_0xc003('0x90')](_0x703036[_0xc003('0x91')])[0x0],_0x703036[_0xc003('0x92')]);if(this[_0xc003('0xf')][_0x703036[_0xc003('0x68')]]){var _0x30f8bc=_[_0xc003('0x70')](this[_0xc003('0xf')][_0x703036[_0xc003('0x68')]]);if(_0x30f8bc){if(this[_0xc003('0x59')](_0x703036[_0xc003('0x91')])&&this[_0xc003('0x59')](_0x703036[_0xc003('0x91')][_0xc003('0x93')])){switch(_0x703036['value']){case'CONTINUE':_0x30f8bc[_0xc003('0x7e')]=![];_0x30f8bc[_0xc003('0x85')]=null;break;default:_0x30f8bc[_0xc003('0x7e')]=!![];_0x30f8bc[_0xc003('0x85')]=moment()['format'](_0xc003('0x6a'));_0x30f8bc[_0xc003('0x94')]=moment()[_0xc003('0x47')]('YYYY-MM-DD\x20HH:mm:ss');}_0x30f8bc[_0xc003('0x1a')]=![];_0x30f8bc[_0xc003('0x75')]=null;_0x30f8bc[_0xc003('0x76')]=_0x703036[_0xc003('0x92')];this[_0xc003('0x33')][_0x703036[_0xc003('0x68')]]=_0x30f8bc;this[_0xc003('0x43')](_0x30f8bc);}else if(this[_0xc003('0x59')](_0x703036[_0xc003('0x91')])&&this[_0xc003('0x59')](_0x703036[_0xc003('0x91')][_0xc003('0x95')])){if(!_0x30f8bc[_0xc003('0x1a')]){_0x30f8bc[_0xc003('0x7e')]=!![];_0x30f8bc['queuecallerexitAt']=moment()['format'](_0xc003('0x6a'));_0x30f8bc[_0xc003('0x76')]='EXITWITHKEY';_0x30f8bc[_0xc003('0x94')]=moment()[_0xc003('0x47')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x703036[_0xc003('0x68')]]=_0x30f8bc;}}_0x30f8bc[_0xc003('0x3f')]=this[_0xc003('0x3f')][_0x703036[_0xc003('0x68')]];}}}}catch(_0x1b1d7d){logger['error'](_0xc003('0x96'),util[_0xc003('0x44')](_0x1b1d7d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xc003('0x8f')]=function(_0x31acde,_0x498f7e,_0x3d505d){var _0x27c079=['rtpaudioqos',_0xc003('0x97'),_0xc003('0x98'),_0xc003('0x99'),_0xc003('0x9a'),_0xc003('0x9b'),_0xc003('0x9c'),_0xc003('0x9d'),'sipcallid','sipuri',_0xc003('0x9e'),_0xc003('0x9f'),_0xc003('0xa0'),_0xc003('0xa1'),_0xc003('0xa2'),_0xc003('0xa3'),_0xc003('0xa4'),_0xc003('0xa5'),_0xc003('0xa6')];if(!_[_0xc003('0x36')](_0x498f7e)&&!_[_0xc003('0xa7')](_0x27c079,_0x498f7e)){if(_[_0xc003('0x5a')](this['variables'][_0x31acde])){this['variables'][_0x31acde]={};}this['variables'][_0x31acde][_0x498f7e]=_0x3d505d;}};VoiceQueueReport[_0xc003('0xb')][_0xc003('0x23')]=function(_0x76a74a){try{if(this[_0xc003('0x59')](_0x76a74a)){if(this[_0xc003('0xf')][_0x76a74a[_0xc003('0x68')]]){for(var _0x1275df=0x0,_0x2be040={};_0x1275df0x0?_0x22538f:0x0;this[_0xf983('0x14')][_0x35e633[_0xf983('0x5e')]][_0xf983('0x2f')]=this[_0xf983('0x14')][_0x35e633[_0xf983('0x5e')]][_0xf983('0x2f')]>_[_0xf983('0x61')](_0x35e633[_0xf983('0x62')])?_[_0xf983('0x61')](_0x35e633[_0xf983('0x62')]):this['voiceQueues'][_0x35e633['queue']][_0xf983('0x2f')];this['emitVoiceQueueSummary'](this['voiceQueues'][_0x35e633['queue']]);}ami[_0xf983('0x43')](_0xf983('0x63'),this['voiceQueues'][_0x35e633['queue']]);}}}catch(_0x21aaea){logger[_0xf983('0x3c')]('[syncQueueSummary][VoiceQueueReport]',util['inspect'](_0x21aaea,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x18')]=function(_0x5958cc){this[_0xf983('0x5c')]=!![];};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x64')]=function(_0x23493f){};VoiceQueueReport['prototype'][_0xf983('0x19')]=function(_0x9390bb){try{if(this[_0xf983('0x5a')](_0x9390bb)){if(_[_0xf983('0x2b')](this[_0xf983('0x10')][_0x9390bb[_0xf983('0x65')]])){this['queueReports'][_0x9390bb[_0xf983('0x65')]]=[];this['channels'][_0x9390bb[_0xf983('0x65')]]={};}var _0x2c33e8=new QueueReport();_0x2c33e8['name']=_0x9390bb[_0xf983('0x5e')];_0x2c33e8[_0xf983('0x53')]=this[_0xf983('0x14')][_0x2c33e8['name']]&&this[_0xf983('0x14')][_0x2c33e8[_0xf983('0x4b')]]['type']?this['voiceQueues'][_0x2c33e8['name']]['type']||_0xf983('0x66'):_0xf983('0x66');_0x2c33e8[_0xf983('0x5e')]=_0x9390bb[_0xf983('0x5e')];_0x2c33e8[_0xf983('0x67')]=moment()[_0xf983('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c33e8[_0xf983('0x68')]=_0x9390bb[_0xf983('0x68')];_0x2c33e8[_0xf983('0x69')]=_0x9390bb[_0xf983('0x69')];_['merge'](_0x2c33e8,_['pick'](_0x9390bb,_['keys'](_0x2c33e8)));this[_0xf983('0x10')][_0x9390bb[_0xf983('0x65')]][_0xf983('0x6a')](_0x2c33e8);this['channels'][_0x9390bb[_0xf983('0x65')]]=_0x2c33e8;this[_0xf983('0x6b')](_0x2c33e8);}}catch(_0xaa1d04){logger[_0xf983('0x3c')](_0xf983('0x6c'),util[_0xf983('0x6d')](_0xaa1d04,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x1b')]=function(_0x327848){try{if(this[_0xf983('0x5a')](_0x327848)){if(this[_0xf983('0x10')][_0x327848['uniqueid']]){var _0x12564f=_[_0xf983('0x6e')](this[_0xf983('0x10')][_0x327848[_0xf983('0x65')]]);_0x12564f['queuecallercomplete']=![];_0x12564f[_0xf983('0x6f')]=null;_0x12564f[_0xf983('0x70')]=_0x327848[_0xf983('0x70')];_0x12564f[_0xf983('0x71')]=_0x327848['originalposition'];_0x12564f[_0xf983('0x1a')]=!![];_0x12564f[_0xf983('0x72')]=moment()[_0xf983('0x44')](_0xf983('0x73'));_0x12564f[_0xf983('0x74')]=_0xf983('0x75');_0x12564f[_0xf983('0x76')]=null;this[_0xf983('0x12')][_0x327848[_0xf983('0x65')]]=_0x12564f;this[_0xf983('0x42')](_0x12564f);}}}catch(_0x3d93c7){logger['error'](_0xf983('0x77'),util[_0xf983('0x6d')](_0x3d93c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x1c')]=function(_0x462408){try{if(this[_0xf983('0x5a')](_0x462408)){if(this['queueReports'][_0x462408[_0xf983('0x65')]]){var _0x7ee92e=_['last'](this[_0xf983('0x10')][_0x462408[_0xf983('0x65')]]);_0x7ee92e[_0xf983('0x78')]=moment()[_0xf983('0x44')](_0xf983('0x73'));_0x7ee92e['connectedlinenum']=_0x462408[_0xf983('0x79')];_0x7ee92e[_0xf983('0x7a')]=_0x462408[_0xf983('0x7a')];this[_0xf983('0x12')][_0x462408[_0xf983('0x65')]]=_0x7ee92e;this[_0xf983('0x6b')](_0x7ee92e);}}}catch(_0x3ce511){logger[_0xf983('0x3c')](_0xf983('0x7b'),util[_0xf983('0x6d')](_0x3ce511,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x1e')]=function(_0x20c67d){try{if(this[_0xf983('0x5a')](_0x20c67d)){if(this[_0xf983('0x10')][_0x20c67d['uniqueid']]){var _0x327a9a=_[_0xf983('0x6e')](this[_0xf983('0x10')][_0x20c67d[_0xf983('0x65')]]);_0x327a9a['queuecallercomplete']=!![];_0x327a9a[_0xf983('0x74')]=_0xf983('0x7c');}}}catch(_0x34c32a){logger[_0xf983('0x3c')](_0xf983('0x7d'),util[_0xf983('0x6d')](_0x34c32a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x1d')]=function(_0x2bf5b1){try{if(this[_0xf983('0x5a')](_0x2bf5b1)){if(this[_0xf983('0x10')][_0x2bf5b1[_0xf983('0x65')]]){var _0x1e3353=_[_0xf983('0x6e')](this[_0xf983('0x10')][_0x2bf5b1[_0xf983('0x65')]]);_0x1e3353[_0xf983('0x1a')]=![];_0x1e3353['queuecallerabandonAt']=null;_0x1e3353[_0xf983('0x7e')]=!![];_0x1e3353['lastAssignedTo']=_0x2bf5b1[_0xf983('0x7f')];_0x1e3353[_0xf983('0x70')]=_0x2bf5b1['holdtime'];_0x1e3353[_0xf983('0x80')]=!![];_0x1e3353[_0xf983('0x81')]=![];_0x1e3353[_0xf983('0x82')]=null;if(!_0x1e3353[_0xf983('0x83')]){if(_0x2bf5b1[_0xf983('0x84')]==_0xf983('0x83')){_0x1e3353[_0xf983('0x74')]=_0xf983('0x85');}else{if(_[_0xf983('0x86')](_0x2bf5b1[_0xf983('0x38')]['toLowerCase'](),_0xf983('0x87'))){if(this[_0xf983('0x10')][_0x2bf5b1[_0xf983('0x88')]]){var _0x1adae8=_['last'](this['queueReports'][_0x2bf5b1[_0xf983('0x88')]]);_0x1adae8[_0xf983('0x80')]=![];_0x1adae8['queuecallerexit']=!![];_0x1adae8[_0xf983('0x82')]=moment(_0x1e3353[_0xf983('0x67')])[_0xf983('0x89')](_0x2bf5b1[_0xf983('0x70')],_0xf983('0x8a'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1adae8['queuecallerexitreason']='FORWARDTRANSFER';_0x1adae8[_0xf983('0x83')]=!![];_0x1adae8['transfertype']=_0xf983('0x8b');_0x1adae8['transferexten']=_0x2bf5b1[_0xf983('0x8c')];_0x1adae8[_0xf983('0x8d')]=_0x2bf5b1[_0xf983('0x65')];var _0xc1ff5f=this['queueReports'][_0x2bf5b1[_0xf983('0x88')]];this[_0xf983('0x10')][_0x2bf5b1[_0xf983('0x88')]]=this[_0xf983('0x10')][_0x2bf5b1[_0xf983('0x65')]];this[_0xf983('0x10')][_0x2bf5b1[_0xf983('0x65')]]=_0xc1ff5f;}}else{_0x1e3353[_0xf983('0x74')]='COMPLETEDBY'+_0x2bf5b1[_0xf983('0x84')][_0xf983('0x8e')]();}}}this[_0xf983('0x12')][_0x2bf5b1[_0xf983('0x65')]]=_0x1e3353;this[_0xf983('0x42')](_0x1e3353);}}}catch(_0x39833c){logger[_0xf983('0x3c')](_0xf983('0x8f'),util[_0xf983('0x6d')](_0x39833c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')][_0xf983('0x20')]=function(_0x1941c6){try{if(this[_0xf983('0x5a')](_0x1941c6)){this[_0xf983('0x90')](_0x1941c6[_0xf983('0x65')],_[_0xf983('0x91')](_0x1941c6[_0xf983('0x92')])[0x0],_0x1941c6[_0xf983('0x93')]);if(this[_0xf983('0x10')][_0x1941c6[_0xf983('0x65')]]){var _0x5104b=_[_0xf983('0x6e')](this[_0xf983('0x10')][_0x1941c6[_0xf983('0x65')]]);if(_0x5104b){if(this[_0xf983('0x5a')](_0x1941c6[_0xf983('0x92')])&&this[_0xf983('0x5a')](_0x1941c6['variable']['queuestatus'])){switch(_0x1941c6[_0xf983('0x93')]){case'CONTINUE':_0x5104b['queuecallerexit']=![];_0x5104b['queuecallerexitAt']=null;break;default:_0x5104b[_0xf983('0x81')]=!![];_0x5104b['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5104b[_0xf983('0x78')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5104b[_0xf983('0x1a')]=![];_0x5104b[_0xf983('0x72')]=null;_0x5104b['queuecallerexitreason']=_0x1941c6[_0xf983('0x93')];this[_0xf983('0x12')][_0x1941c6[_0xf983('0x65')]]=_0x5104b;this[_0xf983('0x42')](_0x5104b);}else if(this['isNotNull'](_0x1941c6[_0xf983('0x92')])&&this[_0xf983('0x5a')](_0x1941c6[_0xf983('0x92')][_0xf983('0x94')])){if(!_0x5104b['queuecallerabandon']){_0x5104b[_0xf983('0x81')]=!![];_0x5104b[_0xf983('0x82')]=moment()[_0xf983('0x44')](_0xf983('0x73'));_0x5104b[_0xf983('0x74')]=_0xf983('0x95');_0x5104b[_0xf983('0x78')]=moment()['format'](_0xf983('0x73'));this[_0xf983('0x12')][_0x1941c6[_0xf983('0x65')]]=_0x5104b;}}_0x5104b[_0xf983('0x3e')]=this[_0xf983('0x3e')][_0x1941c6[_0xf983('0x65')]];}}}}catch(_0x3d0d46){logger[_0xf983('0x3c')](_0xf983('0x96'),util['inspect'](_0x3d0d46,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xf983('0x3f')]['addVariable']=function(_0x834d6b,_0x2fe3ca,_0x3a12db){var _0x392a3f=[_0xf983('0x97'),_0xf983('0x98'),_0xf983('0x99'),_0xf983('0x9a'),_0xf983('0x9b'),_0xf983('0x9c'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0xf983('0x9d'),_0xf983('0x9e'),_0xf983('0x9f'),'bridgepvtcallid',_0xf983('0xa0'),_0xf983('0xa1'),'memberinterface','memberlastcall','membername','memberpenalty',_0xf983('0xa2')];if(!_[_0xf983('0x36')](_0x2fe3ca)&&!_[_0xf983('0xa3')](_0x392a3f,_0x2fe3ca)){if(_[_0xf983('0x2b')](this[_0xf983('0x3e')][_0x834d6b])){this[_0xf983('0x3e')][_0x834d6b]={};}this[_0xf983('0x3e')][_0x834d6b][_0x2fe3ca]=_0x3a12db;}};VoiceQueueReport[_0xf983('0x3f')]['syncHangup']=function(_0x50aadf){try{if(this[_0xf983('0x5a')](_0x50aadf)){if(this['queueReports'][_0x50aadf['uniqueid']]){for(var _0x29964b=0x0,_0x2ec0e2={};_0x29964b=0x0?moment(_0x3c4f21[_0x137e('0x17')])[_0x137e('0x18')](_0x3c4f21[_0x137e('0x16')],_0x137e('0xd')):null,'data1':_0x137e('0x19'),'data2':_0x3c4f21[_0x137e('0x11')],'data3':_0x3c4f21[_0x137e('0x1a')],'data4':_0x3c4f21[_0x137e('0x1b')]||null,'role':'agent','internal':_0x3c4f21[_0x137e('0x11')]?_[_0x137e('0x12')](_0x3c4f21[_0x137e('0x11')]):undefined,'uniqueid':_0x3c4f21['uniqueid']},'log':_0x137e('0x5')});}; \ No newline at end of file +var _0xcd64=['queuecallerleaveAt','inbound','exten','agent','accountcode','toNumber','uniqueid','voiceDialReport','Request','CreateMemberReport','membername','starttime','seconds','dialstring','moment','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt','voice','lastAssignedTo','isNil','interface','SIP/%s','TALKING','diff'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0xcd64,0x1be));var _0x4cd6=function(_0x20f3d7,_0x3d4eae){_0x20f3d7=_0x20f3d7-0x0;var _0x1ccaf4=_0xcd64[_0x20f3d7];return _0x1ccaf4;};'use strict';var moment=require(_0x4cd6('0x0'));var _=require(_0x4cd6('0x1'));var util=require(_0x4cd6('0x2'));var client=require(_0x4cd6('0x3'));exports['voiceQueueReport']=function(_0x583a66){var _0x2e3ad3=_0x583a66[_0x4cd6('0x4')]||_0x583a66[_0x4cd6('0x5')];return client['Request']('CreateMemberReport',{'body':{'channel':_0x4cd6('0x6'),'membername':_0x583a66[_0x4cd6('0x7')],'interface':_[_0x4cd6('0x8')](_0x583a66[_0x4cd6('0x9')])?util['format'](_0x4cd6('0xa'),_0x583a66['lastAssignedTo']):_0x583a66['interface'],'type':_0x4cd6('0xb'),'enterAt':_0x583a66['queuecallerleaveAt'],'exitAt':_0x2e3ad3,'duration':moment(_0x2e3ad3)[_0x4cd6('0xc')](_0x583a66[_0x4cd6('0xd')],'seconds'),'data1':_0x4cd6('0xe'),'data2':_0x583a66['calleridnum'],'data3':_0x583a66[_0x4cd6('0xf')],'data4':null,'data5':_0x583a66['queue'],'role':_0x4cd6('0x10'),'internal':_0x583a66[_0x4cd6('0x11')]?_[_0x4cd6('0x12')](_0x583a66[_0x4cd6('0x11')]):undefined,'uniqueid':_0x583a66[_0x4cd6('0x13')]},'log':'CreateMemberReport'});};exports[_0x4cd6('0x14')]=function(_0x5728ef){return client[_0x4cd6('0x15')](_0x4cd6('0x16'),{'body':{'channel':_0x4cd6('0x6'),'membername':_0x5728ef[_0x4cd6('0x17')],'interface':_0x5728ef['interface'],'type':_0x4cd6('0xb'),'enterAt':_0x5728ef[_0x4cd6('0x18')],'exitAt':_0x5728ef['endtime'],'duration':moment(_0x5728ef['endtime'])['diff'](_0x5728ef[_0x4cd6('0x18')],'seconds')>=0x0?moment(_0x5728ef['endtime'])[_0x4cd6('0xc')](_0x5728ef[_0x4cd6('0x18')],_0x4cd6('0x19')):null,'data1':'outbound','data2':_0x5728ef[_0x4cd6('0x11')],'data3':_0x5728ef['exten'],'data4':_0x5728ef[_0x4cd6('0x1a')]||null,'role':_0x4cd6('0x10'),'internal':_0x5728ef[_0x4cd6('0x11')]?_[_0x4cd6('0x12')](_0x5728ef[_0x4cd6('0x11')]):undefined,'uniqueid':_0x5728ef[_0x4cd6('0x13')]},'log':_0x4cd6('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 842adce..2495d87 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 _0x7d98=['Request','GetTemplate','html','../client'];(function(_0x4adebe,_0x8b39c0){var _0x4e4b7e=function(_0x3e7d5b){while(--_0x3e7d5b){_0x4adebe['push'](_0x4adebe['shift']());}};_0x4e4b7e(++_0x8b39c0);}(_0x7d98,0xe7));var _0x87d9=function(_0x2db667,_0x193cf5){_0x2db667=_0x2db667-0x0;var _0x83ff9=_0x7d98[_0x2db667];return _0x83ff9;};'use strict';var client=require(_0x87d9('0x0'));exports['getTemplates']=function(_0x450298){return function(_0x11bc33){return client[_0x87d9('0x1')](_0x87d9('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x87d9('0x3')]},'log':_0x87d9('0x2')});};}; \ No newline at end of file +var _0x6b20=['getTemplates','GetTemplate','name','html','../client'];(function(_0x4022a4,_0x6600e4){var _0x297d12=function(_0x4cb8a1){while(--_0x4cb8a1){_0x4022a4['push'](_0x4022a4['shift']());}};_0x297d12(++_0x6600e4);}(_0x6b20,0xd1));var _0x06b2=function(_0x1c5bdd,_0x88e54f){_0x1c5bdd=_0x1c5bdd-0x0;var _0x5af61b=_0x6b20[_0x1c5bdd];return _0x5af61b;};'use strict';var client=require(_0x06b2('0x0'));exports[_0x06b2('0x1')]=function(_0x52753b){return function(_0x2d5e24){return client['Request'](_0x06b2('0x2'),{'options':{'raw':!![],'attributes':['id',_0x06b2('0x3'),_0x06b2('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index d91ad7d..4d2b4fc 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 _0x6d33=['data1','data2','data4','data6','data7','../client','getTriggers','Request','GetTrigger','status','AllConditions','operator','value','Condition','Action','Actions','action'];(function(_0x59a156,_0x225efd){var _0x71b27=function(_0x4544fc){while(--_0x4544fc){_0x59a156['push'](_0x59a156['shift']());}};_0x71b27(++_0x225efd);}(_0x6d33,0x1bf));var _0x36d3=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0x6d33[_0x631a3c];return _0x2bdfa3;};'use strict';var client=require(_0x36d3('0x0'));exports[_0x36d3('0x1')]=function(_0x2c6077){return function(_0x3ed980){return client[_0x36d3('0x2')](_0x36d3('0x3'),{'options':{'raw':![],'attributes':['id','name','channel',_0x36d3('0x4')],'include':[{'model':'Condition','as':_0x36d3('0x5'),'attributes':['id','field',_0x36d3('0x6'),_0x36d3('0x7')]},{'model':_0x36d3('0x8'),'as':'AnyConditions','attributes':['id','field',_0x36d3('0x6'),_0x36d3('0x7')]},{'model':_0x36d3('0x9'),'as':_0x36d3('0xa'),'attributes':['id',_0x36d3('0xb'),_0x36d3('0xc'),_0x36d3('0xd'),'data3',_0x36d3('0xe'),'data5',_0x36d3('0xf'),_0x36d3('0x10')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x5bbc=['../client','Request','GetTrigger','name','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','data1','data2','data4','data5','data6'];(function(_0x2b94f7,_0x347a9b){var _0x4930a9=function(_0x2e1a9a){while(--_0x2e1a9a){_0x2b94f7['push'](_0x2b94f7['shift']());}};_0x4930a9(++_0x347a9b);}(_0x5bbc,0x1d4));var _0xc5bb=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5bbc[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0xc5bb('0x0'));exports['getTriggers']=function(_0x5ad028){return function(_0x28bdad){return client[_0xc5bb('0x1')](_0xc5bb('0x2'),{'options':{'raw':![],'attributes':['id',_0xc5bb('0x3'),'channel',_0xc5bb('0x4')],'include':[{'model':_0xc5bb('0x5'),'as':_0xc5bb('0x6'),'attributes':['id',_0xc5bb('0x7'),_0xc5bb('0x8'),_0xc5bb('0x9')]},{'model':_0xc5bb('0x5'),'as':_0xc5bb('0xa'),'attributes':['id',_0xc5bb('0x7'),'operator',_0xc5bb('0x9')]},{'model':_0xc5bb('0xb'),'as':_0xc5bb('0xc'),'attributes':['id','action',_0xc5bb('0xd'),_0xc5bb('0xe'),'data3',_0xc5bb('0xf'),_0xc5bb('0x10'),_0xc5bb('0x11'),'data7']}]},'log':_0xc5bb('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index ec40801..94edc54 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 _0xa65e=['getTrunks','Request','GetTrunk','registry','../client'];(function(_0x5386e5,_0x15d8f1){var _0x123e7f=function(_0x47a8b4){while(--_0x47a8b4){_0x5386e5['push'](_0x5386e5['shift']());}};_0x123e7f(++_0x15d8f1);}(_0xa65e,0x11c));var _0xea65=function(_0x53758c,_0x5664af){_0x53758c=_0x53758c-0x0;var _0x425eff=_0xa65e[_0x53758c];return _0x425eff;};'use strict';var client=require(_0xea65('0x0'));exports[_0xea65('0x1')]=function(_0x53664e){return function(_0x29a03f){return client[_0xea65('0x2')](_0xea65('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xea65('0x4')]},'log':_0xea65('0x3')});};}; \ No newline at end of file +var _0x8c40=['GetTrunk','name','registry','../client','getTrunks','Request'];(function(_0x213e4a,_0x1aa010){var _0x51edce=function(_0x2830c2){while(--_0x2830c2){_0x213e4a['push'](_0x213e4a['shift']());}};_0x51edce(++_0x1aa010);}(_0x8c40,0x171));var _0x08c4=function(_0x46ec71,_0x31a856){_0x46ec71=_0x46ec71-0x0;var _0xbfd10=_0x8c40[_0x46ec71];return _0xbfd10;};'use strict';var client=require(_0x08c4('0x0'));exports[_0x08c4('0x1')]=function(_0x115f78){return function(_0x10ad91){return client[_0x08c4('0x2')](_0x08c4('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x08c4('0x4'),_0x08c4('0x5')]},'log':_0x08c4('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index a07d45b..f0b540a 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 _0x1284=['lastPauseAt','voicePause','mobile','interface','getTelephones','Request','GetUser','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','getAgents','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType'];(function(_0x22b39b,_0x2b7d63){var _0x280e1d=function(_0xc74635){while(--_0xc74635){_0x22b39b['push'](_0x22b39b['shift']());}};_0x280e1d(++_0x2b7d63);}(_0x1284,0x147));var _0x4128=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x1284[_0x15ea09];return _0x3e9c78;};'use strict';var client=require('../client');exports[_0x4128('0x0')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':_0x4128('0x1')},'attributes':['id',_0x4128('0x2'),_0x4128('0x3'),_0x4128('0x4'),_0x4128('0x5'),_0x4128('0x6'),_0x4128('0x7'),_0x4128('0x8'),_0x4128('0x9'),_0x4128('0xa'),'phone',_0x4128('0xb'),_0x4128('0xc')]},'log':_0x4128('0x0')});};};exports[_0x4128('0xd')]=function(){return function(){return client[_0x4128('0xe')](_0x4128('0xf'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x4128('0x2'),_0x4128('0x4'),'internal']},'log':_0x4128('0xd')});};};exports[_0x4128('0x10')]=function(_0x118dfe,_0x1372a9,_0x2b1ce3){return client[_0x4128('0xe')]('PauseUser',{'body':{'type':_0x1372a9,'uniqueid':_0x2b1ce3},'options':{'where':{'id':_0x118dfe['id']}},'log':_0x4128('0x10')});};exports[_0x4128('0x11')]=function(_0x4793d6){return client['Request'](_0x4128('0x12'),{'body':{},'options':{'where':{'id':_0x4793d6['id']}},'log':_0x4128('0x10')});};exports[_0x4128('0x13')]=function(_0x4ab873){return client[_0x4128('0xe')](_0x4128('0x14'),{'options':{'raw':![],'where':{'role':_0x4128('0x1'),'id':_0x4ab873},'attributes':['id',_0x4128('0x2'),_0x4128('0x3'),_0x4128('0x4'),_0x4128('0x5'),'online',_0x4128('0x7'),'pauseType',_0x4128('0x9'),'voicePause',_0x4128('0xc')]},'log':_0x4128('0x13')});}; \ No newline at end of file +var _0x32de=['online','lastLoginAt','pauseType','voicePause','phone','mobile','getAgents','name','accountcode','savePause','PauseUser','saveUnpause','getAgent','ShowUser','agent','interface','../client','Request','GetUser','email','fullname'];(function(_0x2306df,_0x168598){var _0x5c433a=function(_0x43cd4d){while(--_0x43cd4d){_0x2306df['push'](_0x2306df['shift']());}};_0x5c433a(++_0x168598);}(_0x32de,0x1f3));var _0xe32d=function(_0x1f2f61,_0x586f2f){_0x1f2f61=_0x1f2f61-0x0;var _0x10dabc=_0x32de[_0x1f2f61];return _0x10dabc;};'use strict';var client=require(_0xe32d('0x0'));exports['getAgents']=function(){return function(){return client[_0xe32d('0x1')](_0xe32d('0x2'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id','name',_0xe32d('0x3'),'accountcode',_0xe32d('0x4'),_0xe32d('0x5'),_0xe32d('0x6'),_0xe32d('0x7'),'lastPauseAt',_0xe32d('0x8'),_0xe32d('0x9'),_0xe32d('0xa'),'interface']},'log':_0xe32d('0xb')});};};exports['getTelephones']=function(){return function(){return client['Request'](_0xe32d('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0xe32d('0xc'),_0xe32d('0xd'),'internal']},'log':'getTelephones'});};};exports[_0xe32d('0xe')]=function(_0x3354e4,_0x1a04da,_0xc581bc){return client['Request'](_0xe32d('0xf'),{'body':{'type':_0x1a04da,'uniqueid':_0xc581bc},'options':{'where':{'id':_0x3354e4['id']}},'log':_0xe32d('0xe')});};exports[_0xe32d('0x10')]=function(_0xc3f5b7){return client[_0xe32d('0x1')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0xc3f5b7['id']}},'log':_0xe32d('0xe')});};exports[_0xe32d('0x11')]=function(_0x1d96d9){return client[_0xe32d('0x1')](_0xe32d('0x12'),{'options':{'raw':![],'where':{'role':_0xe32d('0x13'),'id':_0x1d96d9},'attributes':['id',_0xe32d('0xc'),_0xe32d('0x3'),_0xe32d('0xd'),_0xe32d('0x4'),'online',_0xe32d('0x6'),'pauseType','lastPauseAt',_0xe32d('0x8'),_0xe32d('0x14')]},'log':_0xe32d('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index c7cd980..3eb9580 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 _0x1b73=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','create'];(function(_0x45b7a0,_0x3f2eb8){var _0x19f679=function(_0x13305d){while(--_0x13305d){_0x45b7a0['push'](_0x45b7a0['shift']());}};_0x19f679(++_0x3f2eb8);}(_0x1b73,0x1d5));var _0x31b7=function(_0x499b3c,_0x277688){_0x499b3c=_0x499b3c-0x0;var _0x3f00c4=_0x1b73[_0x499b3c];return _0x3f00c4;};'use strict';var client=require('../client');exports[_0x31b7('0x0')]=function(_0x25ee36){return client[_0x31b7('0x1')](_0x31b7('0x2'),{'body':_0x25ee36,'log':'CreateVoiceAgentReport'});};exports[_0x31b7('0x3')]=function(_0x59e606,_0x40fef2,_0x3682cc){return client['Request'](_0x31b7('0x4'),{'body':_0x59e606,'options':{'where':{'uniqueid':_0x40fef2,'interface':_0x3682cc,'agentcomplete':!![]}},'log':_0x31b7('0x4')});}; \ No newline at end of file +var _0x32d3=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x4dbdda,_0x11f07c){var _0x1acbf1=function(_0x1a9fc8){while(--_0x1a9fc8){_0x4dbdda['push'](_0x4dbdda['shift']());}};_0x1acbf1(++_0x11f07c);}(_0x32d3,0xbf));var _0x332d=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x32d3[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x332d('0x0'));exports[_0x332d('0x1')]=function(_0x5c1330){return client[_0x332d('0x2')](_0x332d('0x3'),{'body':_0x5c1330,'log':_0x332d('0x3')});};exports[_0x332d('0x4')]=function(_0x2cd22b,_0x395ac6,_0x323ac0){return client[_0x332d('0x2')](_0x332d('0x5'),{'body':_0x2cd22b,'options':{'where':{'uniqueid':_0x395ac6,'interface':_0x323ac0,'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 4d43349..ca04265 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 _0xa566=['outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','format','type','duration','billableseconds','GetVoiceCallReports','moment','util','create','Request','CreateVoiceCallReport','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport'];(function(_0x1cf745,_0x526146){var _0xeedd5f=function(_0x5afa45){while(--_0x5afa45){_0x1cf745['push'](_0x1cf745['shift']());}};_0xeedd5f(++_0x526146);}(_0xa566,0x1bf));var _0x6a56=function(_0x8b3257,_0x59ce3a){_0x8b3257=_0x8b3257-0x0;var _0x1ead89=_0xa566[_0x8b3257];return _0x1ead89;};'use strict';var moment=require(_0x6a56('0x0'));var util=require(_0x6a56('0x1'));var _=require('lodash');var client=require('../client');exports[_0x6a56('0x2')]=function(_0x427fa3){return client[_0x6a56('0x3')](_0x6a56('0x4'),{'body':_['merge'](_0x427fa3,{'source':_0x427fa3['calleridnum'],'destinationcontext':_0x427fa3['context'],'callerid':_0x427fa3[_0x6a56('0x5')],'amaflags':_0x6a56('0x6')}),'log':_0x6a56('0x4')});};exports[_0x6a56('0x7')]=function(){return function(){return client[_0x6a56('0x3')](_0x6a56('0x8'),{'options':{'where':{'type':[_0x6a56('0x9')],'createdAt':{'$between':[moment()[_0x6a56('0xa')](_0x6a56('0xb'))['format'](_0x6a56('0xc')),moment()[_0x6a56('0xd')]('day')[_0x6a56('0xe')](_0x6a56('0xc'))]}},'attributes':[_0x6a56('0xf'),'disposition',_0x6a56('0x10'),_0x6a56('0x11')]},'log':_0x6a56('0x12')});};}; \ No newline at end of file +var _0xad25=['GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request'];(function(_0x3f83ca,_0x387f48){var _0x3efad9=function(_0x53f5ab){while(--_0x53f5ab){_0x3f83ca['push'](_0x3f83ca['shift']());}};_0x3efad9(++_0x387f48);}(_0xad25,0x6e));var _0x5ad2=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xad25[_0x4c12ec];return _0x3ae42c;};'use strict';var moment=require(_0x5ad2('0x0'));var util=require(_0x5ad2('0x1'));var _=require(_0x5ad2('0x2'));var client=require('../client');exports['create']=function(_0x246487){return client['Request'](_0x5ad2('0x3'),{'body':_['merge'](_0x246487,{'source':_0x246487[_0x5ad2('0x4')],'destinationcontext':_0x246487[_0x5ad2('0x5')],'callerid':_0x246487[_0x5ad2('0x6')],'amaflags':_0x5ad2('0x7')}),'log':_0x5ad2('0x3')});};exports[_0x5ad2('0x8')]=function(){return function(){return client[_0x5ad2('0x9')](_0x5ad2('0xa'),{'options':{'where':{'type':[_0x5ad2('0xb')],'createdAt':{'$between':[moment()[_0x5ad2('0xc')](_0x5ad2('0xd'))[_0x5ad2('0xe')](_0x5ad2('0xf')),moment()['endOf'](_0x5ad2('0xd'))[_0x5ad2('0xe')](_0x5ad2('0xf'))]}},'attributes':[_0x5ad2('0x10'),_0x5ad2('0x11'),_0x5ad2('0x12'),'billableseconds']},'log':_0x5ad2('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index c0f6072..293b3b5 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 _0xd404=['create','Request','CreateVoiceDialReport'];(function(_0x510ccb,_0x1705c7){var _0x3dae2b=function(_0x34443e){while(--_0x34443e){_0x510ccb['push'](_0x510ccb['shift']());}};_0x3dae2b(++_0x1705c7);}(_0xd404,0x1ec));var _0x4d40=function(_0x43bd62,_0x107420){_0x43bd62=_0x43bd62-0x0;var _0x22321c=_0xd404[_0x43bd62];return _0x22321c;};'use strict';var client=require('../client');exports[_0x4d40('0x0')]=function(_0x28eb88){return client[_0x4d40('0x1')](_0x4d40('0x2'),{'body':_0x28eb88,'log':_0x4d40('0x2')});}; \ No newline at end of file +var _0xf876=['create','Request','CreateVoiceDialReport','../client'];(function(_0x46bdee,_0x3c3738){var _0x5a3fae=function(_0x255ed8){while(--_0x255ed8){_0x46bdee['push'](_0x46bdee['shift']());}};_0x5a3fae(++_0x3c3738);}(_0xf876,0x15b));var _0x6f87=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xf876[_0x36dfbd];return _0x4ecad9;};'use strict';var client=require(_0x6f87('0x0'));exports[_0x6f87('0x1')]=function(_0x47758e){return client[_0x6f87('0x2')](_0x6f87('0x3'),{'body':_0x47758e,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index e4837c1..a40bd53 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 _0xeb3f=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xeb3f,0xa8));var _0xfeb3=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xeb3f[_0x432682];return _0x463d05;};'use strict';var client=require(_0xfeb3('0x0'));exports[_0xfeb3('0x1')]=function(){return function(){return client[_0xfeb3('0x2')](_0xfeb3('0x3'),{'options':{'raw':!![],'attributes':['id',_0xfeb3('0x4'),_0xfeb3('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xfeb3('0x1')});};}; \ No newline at end of file +var _0x6268=['exten','recordingFormat','getVoiceExtensions','../client','Request'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x6268,0x193));var _0x8626=function(_0x504f1b,_0xa7c15f){_0x504f1b=_0x504f1b-0x0;var _0x49ce80=_0x6268[_0x504f1b];return _0x49ce80;};'use strict';var client=require(_0x8626('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x8626('0x1')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x8626('0x2'),_0x8626('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x8626('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 8d84ba7..b10d7df 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 _0x7c80=['Pause','mandatoryDispositionPause','callerid','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','Trunk','active'];(function(_0xd93b26,_0x12bbf2){var _0x25f668=function(_0x133ff7){while(--_0x133ff7){_0xd93b26['push'](_0xd93b26['shift']());}};_0x25f668(++_0x12bbf2);}(_0x7c80,0x142));var _0x07c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c80[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x07c8('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x07c8('0x1')](_0x07c8('0x2'),{'options':{'raw':![],'attributes':['id',_0x07c8('0x3'),_0x07c8('0x4'),_0x07c8('0x5'),'autopause','monitor_format',_0x07c8('0x6'),_0x07c8('0x7'),_0x07c8('0x8'),_0x07c8('0x9'),_0x07c8('0xa'),_0x07c8('0xb'),_0x07c8('0xc'),_0x07c8('0xd'),_0x07c8('0xe'),_0x07c8('0xf'),_0x07c8('0x10'),'dialOriginateTimeout',_0x07c8('0x11'),_0x07c8('0x12'),_0x07c8('0x13'),_0x07c8('0x14'),'dialCongestionRetryFrequency',_0x07c8('0x15'),_0x07c8('0x16'),_0x07c8('0x17'),_0x07c8('0x18'),_0x07c8('0x19'),_0x07c8('0x1a'),_0x07c8('0x1b'),_0x07c8('0x1c'),_0x07c8('0x1d'),'dialAMDActive',_0x07c8('0x1e'),_0x07c8('0x1f'),_0x07c8('0x20'),_0x07c8('0x21'),'dialAMDMinWordLength',_0x07c8('0x22'),_0x07c8('0x23'),'dialAMDSilenceThreshold',_0x07c8('0x24'),_0x07c8('0x25'),_0x07c8('0x26'),'dialRecallInQueue','dialOrderByScheduledAt',_0x07c8('0x27'),'dialAgiAfterHangupClient',_0x07c8('0x28'),_0x07c8('0x29'),_0x07c8('0x2a'),_0x07c8('0x2b'),'dialCutDigit',_0x07c8('0x2c'),_0x07c8('0x2d'),_0x07c8('0x2e'),_0x07c8('0x2f'),_0x07c8('0x30'),_0x07c8('0x31'),_0x07c8('0x32'),'dialMachineRetryFrequency',_0x07c8('0x33'),_0x07c8('0x34'),_0x07c8('0x35'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x07c8('0x36'),'as':_0x07c8('0x36'),'attributes':['id',_0x07c8('0x3'),'callerid',_0x07c8('0x37')]},{'model':_0x07c8('0x38'),'as':_0x07c8('0x39'),'attributes':['id',_0x07c8('0x3')]},{'model':_0x07c8('0x36'),'as':'TrunkBackup','attributes':['id',_0x07c8('0x3'),_0x07c8('0x3a'),_0x07c8('0x37')]},{'model':_0x07c8('0x3b'),'as':'Interval','attributes':['id',_0x07c8('0x3')],'include':[{'model':'Interval','as':_0x07c8('0x3c'),'attributes':['id','name',_0x07c8('0x3d')]}]}]},'log':_0x07c8('0x3e')});};}; \ No newline at end of file +var _0x99c6=['dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout'];(function(_0x283104,_0x378ece){var _0x1f5844=function(_0x24e91a){while(--_0x24e91a){_0x283104['push'](_0x283104['shift']());}};_0x1f5844(++_0x378ece);}(_0x99c6,0x109));var _0x699c=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x99c6[_0x2d2c16];return _0x53f2fb;};'use strict';var client=require(_0x699c('0x0'));exports[_0x699c('0x1')]=function(){return function(){return client[_0x699c('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x699c('0x3'),_0x699c('0x4'),_0x699c('0x5'),_0x699c('0x6'),_0x699c('0x7'),_0x699c('0x8'),_0x699c('0x9'),_0x699c('0xa'),'dialLimitChannel',_0x699c('0xb'),_0x699c('0xc'),_0x699c('0xd'),_0x699c('0xe'),_0x699c('0xf'),_0x699c('0x10'),_0x699c('0x11'),_0x699c('0x12'),_0x699c('0x13'),'dialQueueTimeout',_0x699c('0x14'),_0x699c('0x15'),_0x699c('0x16'),_0x699c('0x17'),_0x699c('0x18'),_0x699c('0x19'),_0x699c('0x1a'),_0x699c('0x1b'),_0x699c('0x1c'),_0x699c('0x1d'),_0x699c('0x1e'),_0x699c('0x1f'),'dialAMDActive',_0x699c('0x20'),_0x699c('0x21'),_0x699c('0x22'),_0x699c('0x23'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x699c('0x24'),_0x699c('0x25'),_0x699c('0x26'),_0x699c('0x27'),_0x699c('0x28'),_0x699c('0x29'),'dialOrderByScheduledAt',_0x699c('0x2a'),'dialAgiAfterHangupClient',_0x699c('0x2b'),'monitor_format','strategy',_0x699c('0x2c'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0x699c('0x2d'),_0x699c('0x2e'),_0x699c('0x2f'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency',_0x699c('0x30'),_0x699c('0x31'),_0x699c('0x32'),_0x699c('0x33'),_0x699c('0x34')],'include':[{'model':_0x699c('0x35'),'as':'Trunk','attributes':['id','name',_0x699c('0x36'),_0x699c('0x37')]},{'model':_0x699c('0x38'),'as':_0x699c('0x39'),'attributes':['id',_0x699c('0x3')]},{'model':_0x699c('0x35'),'as':_0x699c('0x3a'),'attributes':['id',_0x699c('0x3'),'callerid',_0x699c('0x37')]},{'model':_0x699c('0x3b'),'as':_0x699c('0x3b'),'attributes':['id','name'],'include':[{'model':_0x699c('0x3b'),'as':'Intervals','attributes':['id',_0x699c('0x3'),_0x699c('0x3c')]}]}]},'log':_0x699c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index e03d941..f8dc3b8 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 _0x1117=['Request','CreateVoiceQueueReport','getVoiceQueueReports','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','uniqueid','queue','queuecallerjoinAt','queuecallerexit','queuecallerabandonAt','GetVoiceQueueReports','moment','../client'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1117,0x18e));var _0x7111=function(_0xec9322,_0x2d5b87){_0xec9322=_0xec9322-0x0;var _0x39d576=_0x1117[_0xec9322];return _0x39d576;};'use strict';var moment=require(_0x7111('0x0'));var _=require('lodash');var client=require(_0x7111('0x1'));exports['create']=function(_0x664f95){return client[_0x7111('0x2')](_0x7111('0x3'),{'body':_0x664f95,'log':_0x7111('0x3')});};exports[_0x7111('0x4')]=function(){return function(){return client[_0x7111('0x2')]('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()[_0x7111('0x5')](_0x7111('0x6'))[_0x7111('0x7')](_0x7111('0x8')),moment()[_0x7111('0x9')](_0x7111('0x6'))['format'](_0x7111('0x8'))]}},'attributes':[_0x7111('0xa'),_0x7111('0xb'),_0x7111('0xc'),'queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt',_0x7111('0xd'),'queuecallerexitAt','queuecallerabandon',_0x7111('0xe')]},'log':_0x7111('0xf')});};}; \ No newline at end of file +var _0x9b49=['queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','queue'];(function(_0xfaccef,_0x147839){var _0x2dcc8a=function(_0x52248d){while(--_0x52248d){_0xfaccef['push'](_0xfaccef['shift']());}};_0x2dcc8a(++_0x147839);}(_0x9b49,0x16d));var _0x99b4=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x9b49[_0x5f0089];return _0x193892;};'use strict';var moment=require(_0x99b4('0x0'));var _=require(_0x99b4('0x1'));var client=require('../client');exports[_0x99b4('0x2')]=function(_0x2c0502){return client[_0x99b4('0x3')](_0x99b4('0x4'),{'body':_0x2c0502,'log':_0x99b4('0x4')});};exports[_0x99b4('0x5')]=function(){return function(){return client[_0x99b4('0x3')](_0x99b4('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x99b4('0x7')]('day')[_0x99b4('0x8')](_0x99b4('0x9')),moment()[_0x99b4('0xa')](_0x99b4('0xb'))[_0x99b4('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['uniqueid',_0x99b4('0xc'),_0x99b4('0xd'),_0x99b4('0xe'),'queuecallercomplete',_0x99b4('0xf'),_0x99b4('0x10'),_0x99b4('0x11'),_0x99b4('0x12'),_0x99b4('0x13')]},'log':_0x99b4('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 548376f..722dfcc 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 _0x4b7e=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x5e60b3,_0x21b8a0){var _0x2649ae=function(_0x43b0c5){while(--_0x43b0c5){_0x5e60b3['push'](_0x5e60b3['shift']());}};_0x2649ae(++_0x21b8a0);}(_0x4b7e,0x83));var _0xe4b7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4b7e[_0x21a9d9];return _0x46adce;};'use strict';var client=require(_0xe4b7('0x0'));exports[_0xe4b7('0x1')]=function(_0x5747ed){return function(){return client[_0xe4b7('0x2')](_0xe4b7('0x3'),{'options':{'where':{'VoiceQueueId':_0x5747ed,'paused':!![]},'raw':!![]},'log':_0xe4b7('0x1')});};}; \ No newline at end of file +var _0x5903=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x4782f5,_0x55fefc){var _0x2bd07c=function(_0x5ba886){while(--_0x5ba886){_0x4782f5['push'](_0x4782f5['shift']());}};_0x2bd07c(++_0x55fefc);}(_0x5903,0x1f2));var _0x3590=function(_0x3ccac1,_0x5cc7ea){_0x3ccac1=_0x3ccac1-0x0;var _0x10b20b=_0x5903[_0x3ccac1];return _0x10b20b;};'use strict';var client=require(_0x3590('0x0'));exports[_0x3590('0x1')]=function(_0x213d5d){return function(){return client['Request'](_0x3590('0x2'),{'options':{'where':{'VoiceQueueId':_0x213d5d,'paused':!![]},'raw':!![]},'log':_0x3590('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 034ed45..e94ceed 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 _0x8e0a=['../client','create','CreateVoiceRecording','merge','monitorFilename'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x8e0a,0xa5));var _0xa8e0=function(_0x34c51c,_0x41eb8e){_0x34c51c=_0x34c51c-0x0;var _0x58f488=_0x8e0a[_0x34c51c];return _0x58f488;};'use strict';var _=require('lodash');var client=require(_0xa8e0('0x0'));exports[_0xa8e0('0x1')]=function(_0x4335d){return client['Request'](_0xa8e0('0x2'),{'body':_[_0xa8e0('0x3')](_0x4335d,{'value':_0x4335d[_0xa8e0('0x4')]}),'log':_0xa8e0('0x2')});}; \ No newline at end of file +var _0x8fd6=['../client','Request','CreateVoiceRecording','merge'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x8fd6,0xdc));var _0x68fd=function(_0x25da9f,_0x47d72c){_0x25da9f=_0x25da9f-0x0;var _0x447588=_0x8fd6[_0x25da9f];return _0x447588;};'use strict';var _=require('lodash');var client=require(_0x68fd('0x0'));exports['create']=function(_0x2476dc){return client[_0x68fd('0x1')](_0x68fd('0x2'),{'body':_[_0x68fd('0x3')](_0x2476dc,{'value':_0x2476dc['monitorFilename']}),'log':_0x68fd('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index b830d77..b0aed11 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 _0xf29e=['transfereeconnectedlinenum','transfereeconnectedlinename','transfereeexten','transfereelinkedid','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','../client','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfereecalleridnum','transfereecalleridname'];(function(_0x582d0b,_0x28f609){var _0x2e93e1=function(_0xb6a81c){while(--_0xb6a81c){_0x582d0b['push'](_0x582d0b['shift']());}};_0x2e93e1(++_0x28f609);}(_0xf29e,0x197));var _0xef29=function(_0x5194da,_0x122948){_0x5194da=_0x5194da-0x0;var _0x21b842=_0xf29e[_0x5194da];return _0x21b842;};'use strict';var client=require(_0xef29('0x0'));exports[_0xef29('0x1')]=function(_0x58ee9c){return client[_0xef29('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x58ee9c[_0xef29('0x3')],'transfererchannel':_0x58ee9c[_0xef29('0x4')],'transferercalleridnum':_0x58ee9c[_0xef29('0x5')],'transferercalleridname':_0x58ee9c[_0xef29('0x6')],'transfererconnectedlinenum':_0x58ee9c[_0xef29('0x7')],'transfererconnectedlinename':_0x58ee9c[_0xef29('0x8')],'transfereraccountcode':_0x58ee9c['transfereraccountcode'],'transferercontext':_0x58ee9c[_0xef29('0x9')],'transfererexten':_0x58ee9c[_0xef29('0xa')],'transfererlinkedid':_0x58ee9c['transfererlinkedid'],'transfereechannel':_0x58ee9c['transfereechannel'],'transfereecalleridnum':_0x58ee9c[_0xef29('0xb')],'transfereecalleridname':_0x58ee9c[_0xef29('0xc')],'transfereeconnectedlinenum':_0x58ee9c[_0xef29('0xd')],'transfereeconnectedlinename':_0x58ee9c[_0xef29('0xe')],'transfereeaccountcode':_0x58ee9c['transfereeaccountcode'],'transfereecontext':_0x58ee9c['transfereecontext'],'transfereeexten':_0x58ee9c[_0xef29('0xf')],'transfereelinkedid':_0x58ee9c[_0xef29('0x10')],'isexternal':_0x58ee9c['isexternal'],'context':_0x58ee9c['context'],'extension':_0x58ee9c[_0xef29('0x11')],'type':_0xef29('0x12')},'log':_0xef29('0x13')});};exports[_0xef29('0x14')]=function(_0x46c515){return client[_0xef29('0x2')](_0xef29('0x13'),{'body':{'result':_0x46c515[_0xef29('0x3')],'transfererchannel':_0x46c515[_0xef29('0x15')],'transferercalleridnum':_0x46c515['origtransferercalleridnum'],'transferercalleridname':_0x46c515['origtransferercalleridname'],'transfererconnectedlinenum':_0x46c515['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x46c515[_0xef29('0x16')],'transfereraccountcode':_0x46c515[_0xef29('0x17')],'transferercontext':_0x46c515['secondtransferercontext'],'transfererexten':_0x46c515['secondtransfererexten'],'transfererlinkedid':_0x46c515[_0xef29('0x18')],'transfereechannel':_0x46c515[_0xef29('0x19')],'transfereecalleridnum':_0x46c515[_0xef29('0x1a')],'transfereecalleridname':_0x46c515[_0xef29('0x1b')],'transfereeconnectedlinenum':_0x46c515[_0xef29('0x1c')],'transfereeconnectedlinename':_0x46c515['transfertargetconnectedlinename'],'transfereeaccountcode':_0x46c515[_0xef29('0x1d')],'transfereecontext':_0x46c515[_0xef29('0x1e')],'transfereeexten':_0x46c515[_0xef29('0x1f')],'transfereelinkedid':_0x46c515[_0xef29('0x20')],'isexternal':_0x46c515[_0xef29('0x21')],'context':_0x46c515[_0xef29('0x22')],'extension':_0x46c515['origtransfererexten'],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x4d94=['transfererconnectedlinename','transfereraccountcode','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname'];(function(_0x55ca14,_0x286592){var _0x413c30=function(_0x51a502){while(--_0x51a502){_0x55ca14['push'](_0x55ca14['shift']());}};_0x413c30(++_0x286592);}(_0x4d94,0xdd));var _0x44d9=function(_0x49068b,_0xef08dd){_0x49068b=_0x49068b-0x0;var _0x3af9f1=_0x4d94[_0x49068b];return _0x3af9f1;};'use strict';var client=require('../client');exports[_0x44d9('0x0')]=function(_0x2f72c2){return client[_0x44d9('0x1')](_0x44d9('0x2'),{'body':{'result':_0x2f72c2[_0x44d9('0x3')],'transfererchannel':_0x2f72c2[_0x44d9('0x4')],'transferercalleridnum':_0x2f72c2[_0x44d9('0x5')],'transferercalleridname':_0x2f72c2[_0x44d9('0x6')],'transfererconnectedlinenum':_0x2f72c2['transfererconnectedlinenum'],'transfererconnectedlinename':_0x2f72c2[_0x44d9('0x7')],'transfereraccountcode':_0x2f72c2[_0x44d9('0x8')],'transferercontext':_0x2f72c2['transferercontext'],'transfererexten':_0x2f72c2['transfererexten'],'transfererlinkedid':_0x2f72c2['transfererlinkedid'],'transfereechannel':_0x2f72c2[_0x44d9('0x9')],'transfereecalleridnum':_0x2f72c2[_0x44d9('0xa')],'transfereecalleridname':_0x2f72c2[_0x44d9('0xb')],'transfereeconnectedlinenum':_0x2f72c2[_0x44d9('0xc')],'transfereeconnectedlinename':_0x2f72c2[_0x44d9('0xd')],'transfereeaccountcode':_0x2f72c2[_0x44d9('0xe')],'transfereecontext':_0x2f72c2[_0x44d9('0xf')],'transfereeexten':_0x2f72c2[_0x44d9('0x10')],'transfereelinkedid':_0x2f72c2[_0x44d9('0x11')],'isexternal':_0x2f72c2[_0x44d9('0x12')],'context':_0x2f72c2[_0x44d9('0x13')],'extension':_0x2f72c2[_0x44d9('0x14')],'type':_0x44d9('0x15')},'log':_0x44d9('0x2')});};exports['attendedTransfer']=function(_0x147c79){return client[_0x44d9('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x147c79['result'],'transfererchannel':_0x147c79[_0x44d9('0x16')],'transferercalleridnum':_0x147c79['origtransferercalleridnum'],'transferercalleridname':_0x147c79[_0x44d9('0x17')],'transfererconnectedlinenum':_0x147c79[_0x44d9('0x18')],'transfererconnectedlinename':_0x147c79[_0x44d9('0x19')],'transfereraccountcode':_0x147c79[_0x44d9('0x1a')],'transferercontext':_0x147c79['secondtransferercontext'],'transfererexten':_0x147c79[_0x44d9('0x1b')],'transfererlinkedid':_0x147c79[_0x44d9('0x1c')],'transfereechannel':_0x147c79[_0x44d9('0x1d')],'transfereecalleridnum':_0x147c79[_0x44d9('0x1e')],'transfereecalleridname':_0x147c79['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x147c79[_0x44d9('0x1f')],'transfereeconnectedlinename':_0x147c79[_0x44d9('0x20')],'transfereeaccountcode':_0x147c79['transfertargetaccountcode'],'transfereecontext':_0x147c79[_0x44d9('0x21')],'transfereeexten':_0x147c79['transfertargetexten'],'transfereelinkedid':_0x147c79[_0x44d9('0x22')],'isexternal':_0x147c79[_0x44d9('0x12')],'context':_0x147c79[_0x44d9('0x23')],'extension':_0x147c79[_0x44d9('0x24')],'type':_0x44d9('0x25')},'log':_0x44d9('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index e816ef0..709a62f 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 _0xaf02=['127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','../properties','../ami','%s/%s','SIP','timers','timer','agents','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','module','Action','then','message','pick','command','action','Command','content','catch','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','type','outbound','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','voicechannel','map','find','channels','uniqueid','channel','format','wav','MixMonitor','/var/spool/asterisk/monitor/','toLowerCase','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','status','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','exten','context','telephones','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','server','http','listen'];(function(_0xd37e3d,_0x5c9573){var _0xff1ac0=function(_0x32edb7){while(--_0x32edb7){_0xd37e3d['push'](_0xd37e3d['shift']());}};_0xff1ac0(++_0x5c9573);}(_0xaf02,0x10f));var _0x2af0=function(_0x22570f,_0x611899){_0x22570f=_0x22570f-0x0;var _0x3d6f25=_0xaf02[_0x22570f];return _0x3d6f25;};'use strict';var _=require(_0x2af0('0x0'));var util=require(_0x2af0('0x1'));var jayson=require(_0x2af0('0x2'));var schema=require(_0x2af0('0x3'));var BPromise=require(_0x2af0('0x4'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0x2af0('0x5'));var ami=require(_0x2af0('0x6'));exports['listen']=function(_0x5b487e,_0x3932b4,_0x444e6c){return new BPromise(function(_0x500b17,_0x31d67e){var _0x3854f4={'QueuePause':function(_0x3048da){return new Promise(function(_0xc7945,_0x3fc860){var _0x5de753=util['format'](_0x2af0('0x7'),_0x2af0('0x8'),_0x3048da['name']);if(_0x5b487e['timers']&&_0x5b487e[_0x2af0('0x9')][_0x5de753]&&_0x5b487e[_0x2af0('0x9')][_0x5de753][_0x2af0('0xa')]){_0x5b487e[_0x2af0('0x9')][_0x5de753]['updateAcw']();}if(_0x5b487e[_0x2af0('0xb')][_0x5de753]){_0x5b487e[_0x2af0('0xb')][_0x5de753]['updateStatusRealtime']({'statePause':_0x3048da[_0x2af0('0xc')]?!![]:![]});}_0xc7945({'code':0xc8,'message':_0x2af0('0xd')});});},'Reload':function(_0x4f4017){var _0x369ac9=this;return new Promise(function(_0x152b30,_0x315d90){if(ami[_0x2af0('0xe')]()==![]){return _0x315d90(_0x369ac9[_0x2af0('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x2af0('0x10')][_0x2af0('0x11')],_0x2af0('0x12')][_0x2af0('0x13')]('\x20')));}_0x4f4017=_['pick'](_0x4f4017,_[_0x2af0('0x14')](properties[_0x2af0('0x15')]));_0x4f4017['action']='Reload';return ami[_0x2af0('0x16')](_0x4f4017)[_0x2af0('0x17')](function(_0x483bc3){_0x152b30({'code':0xc8,'message':_0x483bc3[_0x2af0('0x18')]});})['catch'](function(_0x20e1b1){_0x315d90(_0x369ac9[_0x2af0('0xf')](0x1f5,_0x20e1b1[_0x2af0('0x18')]));});});},'Command':function(_0x3aeed8){var _0x241e6e=this;return new Promise(function(_0x88bf5e,_0x3f75b8){if(ami[_0x2af0('0xe')]()==![]){return _0x3f75b8(_0x241e6e[_0x2af0('0xf')](0x1f4,[config[_0x2af0('0x10')]['ip'],config[_0x2af0('0x10')][_0x2af0('0x11')],_0x2af0('0x12')]['join']('\x20')));}_0x3aeed8=_[_0x2af0('0x19')](_0x3aeed8,_0x2af0('0x1a'));_0x3aeed8[_0x2af0('0x1b')]=_0x2af0('0x1c');return ami[_0x2af0('0x16')](_0x3aeed8)[_0x2af0('0x17')](function(_0x311ac7){_0x88bf5e({'code':0xc8,'message':_0x311ac7[_0x2af0('0x1d')]});})[_0x2af0('0x1e')](function(_0x460fed){_0x3f75b8(_0x241e6e[_0x2af0('0xf')](0x1f5,_0x460fed[_0x2af0('0x18')]));});});},'VoiceQueues':function(_0x442a1c){return new Promise(function(_0x574580,_0x526a55){var _0x47eb8a=[];for(var _0x3876c5 in _0x5b487e[_0x2af0('0x1f')]){if(_0x5b487e[_0x2af0('0x1f')][_0x2af0('0x20')](_0x3876c5)){var _0x142fbf=_0x5b487e[_0x2af0('0x1f')][_0x3876c5];var _0x263c8c={'id':_0x142fbf['id'],'name':_0x142fbf[_0x2af0('0x21')],'strategy':_0x142fbf[_0x2af0('0x22')],'answered':_0x142fbf[_0x2af0('0x23')],'available':_0x142fbf[_0x2af0('0x24')],'loggedIn':_0x142fbf[_0x2af0('0x25')],'pTalking':_0x142fbf['pTalking'],'sumBillable':_0x142fbf['sumBillable'],'sumDuration':_0x142fbf[_0x2af0('0x26')],'sumHoldTime':_0x142fbf[_0x2af0('0x27')]||0x0,'talking':_0x142fbf[_0x2af0('0x28')],'total':_0x142fbf[_0x2af0('0x29')],'type':_0x142fbf['type'],'unmanaged':_0x142fbf[_0x2af0('0x2a')],'abandoned':_0x142fbf[_0x2af0('0x2b')],'waiting':_0x142fbf[_0x2af0('0x2c')],'loggedInDb':_0x142fbf['loggedInDb']};if(_0x142fbf[_0x2af0('0x2d')]===_0x2af0('0x2e')){_0x263c8c['dialActive']=_0x142fbf[_0x2af0('0x2f')];_0x263c8c['dialMethod']=_0x142fbf['dialMethod'];_0x263c8c[_0x2af0('0x30')]=_0x142fbf[_0x2af0('0x30')];_0x263c8c[_0x2af0('0x31')]=_0x142fbf[_0x2af0('0x31')];_0x263c8c[_0x2af0('0x32')]=_0x142fbf['dialOriginateTimeout'];_0x263c8c[_0x2af0('0x33')]=_0x142fbf[_0x2af0('0x33')];_0x263c8c[_0x2af0('0x34')]=_0x142fbf[_0x2af0('0x34')];_0x263c8c[_0x2af0('0x35')]=_0x142fbf[_0x2af0('0x35')];_0x263c8c[_0x2af0('0x36')]=_0x142fbf[_0x2af0('0x36')];_0x263c8c['outboundBusyCallsDay']=_0x142fbf[_0x2af0('0x37')];_0x263c8c['outboundCongestionCallsDay']=_0x142fbf['outboundCongestionCallsDay'];_0x263c8c[_0x2af0('0x38')]=_0x142fbf['outboundDropCallsDayACS'];_0x263c8c[_0x2af0('0x39')]=_0x142fbf[_0x2af0('0x39')];_0x263c8c[_0x2af0('0x3a')]=_0x142fbf[_0x2af0('0x3a')];_0x263c8c[_0x2af0('0x3b')]=_0x142fbf['outboundNoAnswerCallsDay'];_0x263c8c['outboundNoSuchCallsDay']=_0x142fbf[_0x2af0('0x3c')];_0x263c8c['outboundOriginateFailureCallsDay']=_0x142fbf[_0x2af0('0x3d')];_0x263c8c[_0x2af0('0x3e')]=_0x142fbf[_0x2af0('0x3e')];_0x263c8c[_0x2af0('0x3f')]=_0x142fbf[_0x2af0('0x3f')];_0x263c8c[_0x2af0('0x40')]=_0x142fbf[_0x2af0('0x40')];_0x263c8c[_0x2af0('0x41')]=_0x142fbf[_0x2af0('0x41')];_0x263c8c['predictiveIntervalAvgHoldtime']=_0x142fbf['predictiveIntervalAvgHoldtime'];_0x263c8c['predictiveIntervalAvgTalktime']=_0x142fbf[_0x2af0('0x42')];_0x263c8c[_0x2af0('0x43')]=_0x142fbf['predictiveIntervalDroppedCallsCallersExit'];_0x263c8c[_0x2af0('0x44')]=_0x142fbf[_0x2af0('0x44')];_0x263c8c[_0x2af0('0x45')]=_0x142fbf[_0x2af0('0x45')];_0x263c8c['predictiveIntervalErlangCallsDroppedCalls']=_0x142fbf[_0x2af0('0x46')];_0x263c8c['predictiveIntervalHitRate']=_0x142fbf['predictiveIntervalHitRate'];_0x263c8c[_0x2af0('0x47')]=_0x142fbf['predictiveIntervalMultiplicativeFactor'];_0x263c8c['predictiveIntervalPauses']=_0x142fbf[_0x2af0('0x48')];_0x263c8c[_0x2af0('0x49')]=_0x142fbf['predictiveIntervalAvailable'];_0x263c8c[_0x2af0('0x4a')]=_0x142fbf['predictiveIntervalTotalCalls'];_0x263c8c[_0x2af0('0x18')]=_0x142fbf[_0x2af0('0x18')];_0x263c8c[_0x2af0('0x4b')]=_0x142fbf[_0x2af0('0x4b')];_0x263c8c[_0x2af0('0x4c')]=_0x142fbf[_0x2af0('0x4c')];_0x263c8c['erlangCallToSecond']=_0x142fbf[_0x2af0('0x4d')];_0x263c8c['erlangAbandonmentRate']=_0x142fbf[_0x2af0('0x4e')];_0x263c8c['erlangBusyFactor']=_0x142fbf[_0x2af0('0x4f')];_0x263c8c[_0x2af0('0x50')]=_0x142fbf[_0x2af0('0x50')];_0x263c8c[_0x2af0('0x51')]=_0x142fbf[_0x2af0('0x51')];}if(_0x142fbf['Trunk']){_0x263c8c[_0x2af0('0x52')]={'id':_0x142fbf[_0x2af0('0x52')]['id'],'name':_0x142fbf[_0x2af0('0x52')][_0x2af0('0x21')],'active':_0x142fbf['Trunk'][_0x2af0('0x53')],'callerid':_0x142fbf['Trunk'][_0x2af0('0x54')]};}if(_0x142fbf['Interval']){_0x263c8c['Interval']={'id':_0x142fbf[_0x2af0('0x55')]['id'],'name':_0x142fbf[_0x2af0('0x55')][_0x2af0('0x21')]};}_0x47eb8a[_0x2af0('0x56')](_0x263c8c);}}_0x574580({'count':_0x47eb8a[_0x2af0('0x57')],'rows':_0x47eb8a});});},'VoiceChannels':function(_0x58c3fe){return new Promise(function(_0x5da089,_0x4e1e02){var _0x14a0f9=_[_0x2af0('0x58')](_0x5b487e['channels']);_0x5da089({'count':_0x14a0f9[_0x2af0('0x57')],'rows':_0x14a0f9});});},'VoiceChannelMixMonitor':function(_0x1ebbb4){var _0x5959db=this;return new Promise(function(_0x424c95,_0x4c14df){if(ami[_0x2af0('0xe')]()==![]){return _0x4c14df(_0x5959db[_0x2af0('0xf')](0x1f4,[config[_0x2af0('0x10')]['ip'],config[_0x2af0('0x10')]['username'],_0x2af0('0x12')]['join']('\x20')));}var _0x3b35d0=schema(properties[_0x2af0('0x59')])[_0x2af0('0x3')](_0x1ebbb4);if(_0x3b35d0['length']>0x0){return _0x4c14df(_0x5959db[_0x2af0('0xf')](0x1f4,_[_0x2af0('0x5a')](_0x3b35d0,_0x2af0('0x18'))[_0x2af0('0x13')](',\x20')));}var _0x5e6a0b=_[_0x2af0('0x5b')](_0x5b487e[_0x2af0('0x5c')],{'uniqueid':_0x1ebbb4[_0x2af0('0x5d')]});if(_0x5e6a0b&&_0x5e6a0b[_0x2af0('0x5e')]){var _0x44a478=util[_0x2af0('0x5f')]('%s.%s',_0x1ebbb4['filename']||_0x1ebbb4[_0x2af0('0x5d')],_0x1ebbb4[_0x2af0('0x5f')]||_0x2af0('0x60'));return ami[_0x2af0('0x16')]({'action':_0x2af0('0x61'),'channel':_0x5e6a0b['channel'],'file':_0x44a478,'options':'ai(mixmonitorid)'})[_0x2af0('0x17')](function(_0x2e8c18){var _0x437fa2=_[_0x2af0('0x5b')](_0x5e6a0b['monitors'],{'filename':_0x2af0('0x62')+_0x44a478[_0x2af0('0x63')]()});if(_['isNil'](_0x437fa2)){_0x5e6a0b[_0x2af0('0x64')][_0x2af0('0x56')]({'filename':'/var/spool/asterisk/monitor/'+_0x44a478[_0x2af0('0x63')](),'createdAt':moment()['format'](_0x2af0('0x65')),'mixmonitorid':_0x2e8c18[_0x2af0('0x66')],'status':_0x2af0('0x67')});}else{_0x437fa2[_0x2af0('0x66')]=_0x2e8c18[_0x2af0('0x66')];_0x437fa2['status']=_0x2af0('0x67');}_0x424c95({'code':0xc8,'message':[_0x1ebbb4[_0x2af0('0x5d')],_0x2af0('0x68'),_0x2e8c18['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x2e8c18[_0x2af0('0x66')]});})['catch'](function(_0x3a510e){_0x4c14df(_0x5959db[_0x2af0('0xf')](0x1f5,[_0x1ebbb4[_0x2af0('0x5d')],_0x3a510e[_0x2af0('0x18')][_0x2af0('0x63')]()][_0x2af0('0x13')]('\x20')));});}else{return _0x4c14df(_0x5959db[_0x2af0('0xf')](0x1f5,_0x2af0('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x44067f){var _0x2a5508=this;return new Promise(function(_0x40f80b,_0x414031){if(ami['isConnected']()==![]){return _0x414031(_0x2a5508[_0x2af0('0xf')](0x1f4,[config[_0x2af0('0x10')]['ip'],config[_0x2af0('0x10')][_0x2af0('0x11')],_0x2af0('0x12')]['join']('\x20')));}var _0x2b7584=schema(properties[_0x2af0('0x59')])['validate'](_0x44067f);if(_0x2b7584[_0x2af0('0x57')]>0x0){return _0x414031(_0x2a5508[_0x2af0('0xf')](0x1f4,_[_0x2af0('0x5a')](_0x2b7584,_0x2af0('0x18'))['join'](',\x20')));}var _0x3aef2e=_[_0x2af0('0x5b')](_0x5b487e[_0x2af0('0x5c')],{'uniqueid':_0x44067f[_0x2af0('0x5d')]});if(_0x3aef2e){return BPromise[_0x2af0('0x6a')]()['then'](function(){if(_0x3aef2e['channel']){return ami['Action']({'action':_0x2af0('0x6b'),'channel':_0x3aef2e[_0x2af0('0x5e')],'mixmonitorid':_0x44067f[_0x2af0('0x66')]})['catch'](function(_0x3e0274){});}})['then'](function(){if(_0x3aef2e[_0x2af0('0x6c')]){return ami[_0x2af0('0x16')]({'action':_0x2af0('0x6b'),'channel':_0x3aef2e['destinationchannel'],'mixmonitorid':_0x44067f[_0x2af0('0x66')]})[_0x2af0('0x1e')](function(_0x562d30){});}})['then'](function(_0x14603d){var _0x44dc2a=_[_0x2af0('0x5b')](_0x3aef2e[_0x2af0('0x64')],{'mixmonitorid':_0x44067f['mixmonitorid']});if(_0x44dc2a){_0x44dc2a[_0x2af0('0x6d')]=_0x2af0('0x6e');}})['then'](function(){var _0x55bfd6=util['format'](_0x2af0('0x6f'),_0x44067f['filename']||_0x44067f[_0x2af0('0x5d')],_0x44067f[_0x2af0('0x5f')]||_0x2af0('0x60'));var _0x343cef=_['find'](_0x3aef2e[_0x2af0('0x64')],{'filename':'/var/spool/asterisk/monitor/'+_0x55bfd6[_0x2af0('0x63')]()});if(_0x343cef){_0x343cef['status']=_0x2af0('0x6e');}})[_0x2af0('0x17')](function(){_0x40f80b({'code':0xc8,'message':[_0x44067f['uniqueid'],_0x2af0('0x70')][_0x2af0('0x13')]('\x20')});})['catch'](function(_0x244597){_0x414031(_0x2a5508[_0x2af0('0xf')](0x1f5,[_0x44067f[_0x2af0('0x5d')],_0x244597[_0x2af0('0x18')][_0x2af0('0x63')]()]['join']('\x20')));});}else{return _0x414031(_0x2a5508[_0x2af0('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x205d30){return new Promise(function(_0x2eb5cc,_0x1a9148){var _0x1ba984=_[_0x2af0('0x58')](_0x5b487e[_0x2af0('0x71')]);_0x2eb5cc({'count':_0x1ba984[_0x2af0('0x57')],'rows':_0x1ba984});});},'VoiceQueuesChannel':function(_0xc5705f){var _0x307a15=this;return new Promise(function(_0x32036f,_0x3d12c6){var _0x496e40=schema(properties[_0x2af0('0x72')])[_0x2af0('0x3')](_0xc5705f);if(_0x496e40[_0x2af0('0x57')]>0x0){return _0x3d12c6(_0x307a15[_0x2af0('0xf')](0x1f4,_[_0x2af0('0x5a')](_0x496e40,_0x2af0('0x18'))['join'](',\x20')));}var _0x28027c=_[_0x2af0('0x5b')](_0x5b487e[_0x2af0('0x71')],{'uniqueid':_0xc5705f['uniqueid']});if(_0x28027c){_0x32036f(_0x28027c);}else{return _0x3d12c6(_0x307a15[_0x2af0('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x3a3718){var _0x16a27f=this;return new Promise(function(_0xd5462e,_0x390928){if(ami[_0x2af0('0xe')]()==![]){return _0x390928(_0x16a27f[_0x2af0('0xf')](0x1f4,[config[_0x2af0('0x10')]['ip'],config[_0x2af0('0x10')][_0x2af0('0x11')],_0x2af0('0x12')][_0x2af0('0x13')]('\x20')));}var _0x28d838=schema(properties[_0x2af0('0x73')])[_0x2af0('0x3')](_0x3a3718);if(_0x28d838[_0x2af0('0x57')]>0x0){return _0x390928(_0x16a27f['error'](0x1f4,_[_0x2af0('0x5a')](_0x28d838,_0x2af0('0x18'))[_0x2af0('0x13')](',\x20')));}var _0x1313ee=_[_0x2af0('0x5b')](_0x5b487e[_0x2af0('0x71')],{'uniqueid':_0x3a3718[_0x2af0('0x5d')]});if(_0x1313ee&&_0x1313ee[_0x2af0('0x5e')]){return ami[_0x2af0('0x16')]({'action':_0x2af0('0x74'),'channel':_0x1313ee[_0x2af0('0x5e')]})[_0x2af0('0x17')](function(_0x3f9979){_0xd5462e({'code':0xc8,'message':[_0x3a3718[_0x2af0('0x5d')],_0x3f9979['message'][_0x2af0('0x63')]()][_0x2af0('0x13')]('\x20')});})[_0x2af0('0x1e')](function(_0x5d106b){_0x390928(_0x16a27f[_0x2af0('0xf')](0x1f5,[_0x3a3718['uniqueid'],_0x5d106b[_0x2af0('0x18')][_0x2af0('0x63')]()][_0x2af0('0x13')]('\x20')));});}else{return _0x390928(_0x16a27f[_0x2af0('0xf')](0x1f5,_0x2af0('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x3aaabf){var _0x478b48=this;return new Promise(function(_0x31e6fc,_0x2378e7){if(ami[_0x2af0('0xe')]()==![]){return _0x2378e7(_0x478b48['error'](0x1f4,[config[_0x2af0('0x10')]['ip'],config[_0x2af0('0x10')][_0x2af0('0x11')],_0x2af0('0x12')][_0x2af0('0x13')]('\x20')));}var _0x2e04a2=schema(properties[_0x2af0('0x75')])[_0x2af0('0x3')](_0x3aaabf);if(_0x2e04a2[_0x2af0('0x57')]>0x0){return _0x2378e7(_0x478b48['error'](0x1f4,_[_0x2af0('0x5a')](_0x2e04a2,_0x2af0('0x18'))[_0x2af0('0x13')](',\x20')));}var _0x9a4bd5=_['find'](_0x5b487e[_0x2af0('0x71')],{'uniqueid':_0x3aaabf[_0x2af0('0x5d')]});if(_0x9a4bd5&&_0x9a4bd5[_0x2af0('0x5e')]){return ami[_0x2af0('0x16')]({'action':'Redirect','channel':_0x9a4bd5[_0x2af0('0x5e')],'exten':_0x3aaabf[_0x2af0('0x76')],'context':_0x3aaabf[_0x2af0('0x77')]||_0x9a4bd5[_0x2af0('0x77')],'priority':0x1})[_0x2af0('0x17')](function(_0x3dd1a4){_0x31e6fc({'code':0xc8,'message':[_0x3aaabf[_0x2af0('0x5d')],_0x3dd1a4[_0x2af0('0x18')]['toLowerCase']()]['join']('\x20')});})[_0x2af0('0x1e')](function(_0x3d61cd){_0x2378e7(_0x478b48[_0x2af0('0xf')](0x1f5,[_0x3aaabf[_0x2af0('0x5d')],_0x3d61cd['message']['toLowerCase']()][_0x2af0('0x13')]('\x20')));});}else{return _0x2378e7(_0x478b48[_0x2af0('0xf')](0x1f5,_0x2af0('0x69')));}});},'Agents':function(_0x5cc232){return new Promise(function(_0x5c167e,_0x37513d){var _0x1966ed=_[_0x2af0('0x58')](_0x5b487e[_0x2af0('0xb')]);_0x5c167e({'count':_0x1966ed['length'],'rows':_0x1966ed});});},'Telephones':function(_0x3a104f){return new Promise(function(_0x3ec7d9,_0x44b913){var _0x599ff0=_['values'](_0x5b487e[_0x2af0('0x78')]);_0x3ec7d9({'count':_0x599ff0[_0x2af0('0x57')],'rows':_0x599ff0});});},'Trunks':function(_0x51d390){return new Promise(function(_0x256ca8,_0x27e2d8){var _0x47a2fd=_[_0x2af0('0x58')](_0x5b487e['trunks']);_0x256ca8({'count':_0x47a2fd[_0x2af0('0x57')],'rows':_0x47a2fd});});},'OutboundChannels':function(_0x34be2d){return new Promise(function(_0x14b965,_0xb87a43){var _0x28f4b0=_[_0x2af0('0x58')](_0x5b487e['outboundChannels']);_0x14b965({'count':_0x28f4b0[_0x2af0('0x57')],'rows':_0x28f4b0});});},'Outbound':function(_0x338bca){return new Promise(function(_0x3651b4,_0x280b48){_0x3651b4(_0x5b487e[_0x2af0('0x2e')]);});},'Campaigns':function(_0x2acb6f){return new Promise(function(_0x22e954,_0x4355f0){var _0xba6c44=_[_0x2af0('0x58')](_0x5b487e['campaigns']);_0x22e954({'count':_0xba6c44[_0x2af0('0x57')],'rows':_0xba6c44});});},'VoiceQueuesPreview':function(_0x1ac90f){var _0x2bef9e=this;return new Promise(function(_0x3fed09,_0x2f5178){_0x3932b4[_0x2af0('0x79')](_0x1ac90f['id'])[_0x2af0('0x17')](function(_0x4905a8){_0x3fed09({'code':0xc8,'message':_0x4905a8[_0x2af0('0x18')]});})[_0x2af0('0x1e')](function(_0x11242c){_0x2f5178(_0x2bef9e[_0x2af0('0xf')](0x1f4,_0x11242c[_0x2af0('0x18')]));});});},'EventManager':function(_0x5569e3){var _0x1d5ad5=this;return new Promise(function(_0x303f7d,_0x5a9707){if(!_0x5569e3[_0x2af0('0x7a')]){return _0x5a9707(_0x1d5ad5[_0x2af0('0xf')](0x1f4,_0x2af0('0x7b')));}ami[_0x2af0('0x7c')](_0x2af0('0x7d')+_0x5569e3[_0x2af0('0x7a')],_0x5569e3[_0x2af0('0x18')]);_0x303f7d({'code':0xc8,'message':_0x5569e3});});},'FaxAccounts':function(_0x31c35b){return new Promise(function(_0x9090c,_0x11b8c3){var _0x30a8aa=_[_0x2af0('0x58')](_0x5b487e[_0x2af0('0x7e')]);_0x9090c({'count':_0x30a8aa[_0x2af0('0x57')],'rows':_0x30a8aa});});},'SendFax':function(_0x2ac8cf){var _0x248898=this;return new Promise(function(_0x193fd1,_0x3115e6){_0x444e6c[_0x2af0('0x7f')](_0x2ac8cf)['then'](function(_0x4f7e0f){_0x193fd1({'code':0xc8,'message':_0x4f7e0f[_0x2af0('0x18')]});})[_0x2af0('0x1e')](function(_0x5b70d4){_0x3115e6(_0x248898[_0x2af0('0xf')](0x1f4,_0x5b70d4[_0x2af0('0x18')]));});});},'CheckAfterSend':function(_0x277dc8){var _0x127ea1=this;return new Promise(function(_0x442ea3,_0x59ea14){_0x444e6c['checkAfterSend'](_0x277dc8)[_0x2af0('0x17')](function(_0x58fc60){_0x442ea3({'code':0xc8,'message':_0x58fc60[_0x2af0('0x18')]});})[_0x2af0('0x1e')](function(_0x306ea6){_0x59ea14(_0x127ea1[_0x2af0('0xf')](0x1f4,_0x306ea6['message']));});});}};var _0x19088c=jayson[_0x2af0('0x80')](_0x3854f4)[_0x2af0('0x81')]();_0x19088c['on'](_0x2af0('0xf'),function(_0x4202e9){return _0x31d67e(_0x4202e9);});_0x19088c[_0x2af0('0x82')](0x232a,_0x2af0('0x83'),function(){console[_0x2af0('0x84')](_0x2af0('0x85'),0x232a);return _0x500b17('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x0052=['faxAccounts','send','checkAfterSend','server','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','listen','format','%s/%s','name','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','error','asterisk','join','pick','keys','module','action','Reload','then','message','username','ami\x20disconnected','command','Action','catch','voiceQueues','answered','available','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','length','values','channels','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','isNil','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','map','find','resolve','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','event','Event\x20name\x20mandatory','emit'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x0052,0x114));var _0x2005=function(_0x261e73,_0x7768f3){_0x261e73=_0x261e73-0x0;var _0x5a1e03=_0x0052[_0x261e73];return _0x5a1e03;};'use strict';var _=require(_0x2005('0x0'));var util=require(_0x2005('0x1'));var jayson=require(_0x2005('0x2'));var schema=require(_0x2005('0x3'));var BPromise=require(_0x2005('0x4'));var moment=require(_0x2005('0x5'));var config=require(_0x2005('0x6'));var properties=require(_0x2005('0x7'));var ami=require('../ami');exports[_0x2005('0x8')]=function(_0x18ebf1,_0x5ee8f2,_0x3ff44c){return new BPromise(function(_0x124914,_0x280b95){var _0x44d06b={'QueuePause':function(_0x505108){return new Promise(function(_0x12b7d2,_0x2a4045){var _0x3f3168=util[_0x2005('0x9')](_0x2005('0xa'),'SIP',_0x505108[_0x2005('0xb')]);if(_0x18ebf1[_0x2005('0xc')]&&_0x18ebf1[_0x2005('0xc')][_0x3f3168]&&_0x18ebf1[_0x2005('0xc')][_0x3f3168][_0x2005('0xd')]){_0x18ebf1[_0x2005('0xc')][_0x3f3168][_0x2005('0xe')]();}if(_0x18ebf1[_0x2005('0xf')][_0x3f3168]){_0x18ebf1[_0x2005('0xf')][_0x3f3168]['updateStatusRealtime']({'statePause':_0x505108[_0x2005('0x10')]?!![]:![]});}_0x12b7d2({'code':0xc8,'message':_0x2005('0x11')});});},'Reload':function(_0x559643){var _0x4c1223=this;return new Promise(function(_0x54f79c,_0x52599b){if(ami[_0x2005('0x12')]()==![]){return _0x52599b(_0x4c1223[_0x2005('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x2005('0x14')]['username'],'ami\x20disconnected'][_0x2005('0x15')]('\x20')));}_0x559643=_[_0x2005('0x16')](_0x559643,_[_0x2005('0x17')](properties[_0x2005('0x18')]));_0x559643[_0x2005('0x19')]=_0x2005('0x1a');return ami['Action'](_0x559643)[_0x2005('0x1b')](function(_0x382a57){_0x54f79c({'code':0xc8,'message':_0x382a57['message']});})['catch'](function(_0x3c1944){_0x52599b(_0x4c1223[_0x2005('0x13')](0x1f5,_0x3c1944[_0x2005('0x1c')]));});});},'Command':function(_0x2a2fb7){var _0x2eb54a=this;return new Promise(function(_0x2dd6f3,_0x52d7db){if(ami[_0x2005('0x12')]()==![]){return _0x52d7db(_0x2eb54a[_0x2005('0x13')](0x1f4,[config[_0x2005('0x14')]['ip'],config[_0x2005('0x14')][_0x2005('0x1d')],_0x2005('0x1e')][_0x2005('0x15')]('\x20')));}_0x2a2fb7=_[_0x2005('0x16')](_0x2a2fb7,_0x2005('0x1f'));_0x2a2fb7['action']='Command';return ami[_0x2005('0x20')](_0x2a2fb7)[_0x2005('0x1b')](function(_0x4b28e9){_0x2dd6f3({'code':0xc8,'message':_0x4b28e9['content']});})[_0x2005('0x21')](function(_0x371fbe){_0x52d7db(_0x2eb54a[_0x2005('0x13')](0x1f5,_0x371fbe['message']));});});},'VoiceQueues':function(_0x32075a){return new Promise(function(_0x469202,_0x360292){var _0x5544ff=[];for(var _0x25ea61 in _0x18ebf1[_0x2005('0x22')]){if(_0x18ebf1[_0x2005('0x22')]['hasOwnProperty'](_0x25ea61)){var _0x49a5ab=_0x18ebf1[_0x2005('0x22')][_0x25ea61];var _0x35568e={'id':_0x49a5ab['id'],'name':_0x49a5ab['name'],'strategy':_0x49a5ab['strategy'],'answered':_0x49a5ab[_0x2005('0x23')],'available':_0x49a5ab[_0x2005('0x24')],'loggedIn':_0x49a5ab['loggedIn'],'pTalking':_0x49a5ab[_0x2005('0x25')],'sumBillable':_0x49a5ab[_0x2005('0x26')],'sumDuration':_0x49a5ab[_0x2005('0x27')],'sumHoldTime':_0x49a5ab[_0x2005('0x28')]||0x0,'talking':_0x49a5ab[_0x2005('0x29')],'total':_0x49a5ab[_0x2005('0x2a')],'type':_0x49a5ab[_0x2005('0x2b')],'unmanaged':_0x49a5ab[_0x2005('0x2c')],'abandoned':_0x49a5ab[_0x2005('0x2d')],'waiting':_0x49a5ab['waiting'],'loggedInDb':_0x49a5ab[_0x2005('0x2e')]};if(_0x49a5ab[_0x2005('0x2b')]===_0x2005('0x2f')){_0x35568e[_0x2005('0x30')]=_0x49a5ab[_0x2005('0x30')];_0x35568e['dialMethod']=_0x49a5ab[_0x2005('0x31')];_0x35568e[_0x2005('0x32')]=_0x49a5ab[_0x2005('0x32')];_0x35568e[_0x2005('0x33')]=_0x49a5ab['dialOriginateCallerIdNumber'];_0x35568e[_0x2005('0x34')]=_0x49a5ab[_0x2005('0x34')];_0x35568e[_0x2005('0x35')]=_0x49a5ab['dialPrefix'];_0x35568e['outboundAnswerAgiCallsDay']=_0x49a5ab[_0x2005('0x36')];_0x35568e['outboundAnswerCallsDay']=_0x49a5ab[_0x2005('0x37')];_0x35568e[_0x2005('0x38')]=_0x49a5ab[_0x2005('0x38')];_0x35568e[_0x2005('0x39')]=_0x49a5ab[_0x2005('0x39')];_0x35568e['outboundCongestionCallsDay']=_0x49a5ab['outboundCongestionCallsDay'];_0x35568e['outboundDropCallsDayACS']=_0x49a5ab[_0x2005('0x3a')];_0x35568e[_0x2005('0x3b')]=_0x49a5ab[_0x2005('0x3b')];_0x35568e['outboundDropCallsDayTimeout']=_0x49a5ab['outboundDropCallsDayTimeout'];_0x35568e['outboundNoAnswerCallsDay']=_0x49a5ab[_0x2005('0x3c')];_0x35568e[_0x2005('0x3d')]=_0x49a5ab['outboundNoSuchCallsDay'];_0x35568e[_0x2005('0x3e')]=_0x49a5ab['outboundOriginateFailureCallsDay'];_0x35568e['outboundReCallsDay']=_0x49a5ab[_0x2005('0x3f')];_0x35568e[_0x2005('0x40')]=_0x49a5ab[_0x2005('0x40')];_0x35568e[_0x2005('0x41')]=_0x49a5ab[_0x2005('0x41')];_0x35568e[_0x2005('0x42')]=_0x49a5ab['predictiveIntervalAnsweredCalls'];_0x35568e['predictiveIntervalAvgHoldtime']=_0x49a5ab[_0x2005('0x43')];_0x35568e[_0x2005('0x44')]=_0x49a5ab[_0x2005('0x44')];_0x35568e[_0x2005('0x45')]=_0x49a5ab[_0x2005('0x45')];_0x35568e['predictiveIntervalDroppedCallsTimeout']=_0x49a5ab['predictiveIntervalDroppedCallsTimeout'];_0x35568e[_0x2005('0x46')]=_0x49a5ab[_0x2005('0x46')];_0x35568e[_0x2005('0x47')]=_0x49a5ab[_0x2005('0x47')];_0x35568e[_0x2005('0x48')]=_0x49a5ab[_0x2005('0x48')];_0x35568e[_0x2005('0x49')]=_0x49a5ab['predictiveIntervalMultiplicativeFactor'];_0x35568e['predictiveIntervalPauses']=_0x49a5ab[_0x2005('0x4a')];_0x35568e[_0x2005('0x4b')]=_0x49a5ab[_0x2005('0x4b')];_0x35568e[_0x2005('0x4c')]=_0x49a5ab['predictiveIntervalTotalCalls'];_0x35568e[_0x2005('0x1c')]=_0x49a5ab[_0x2005('0x1c')];_0x35568e['originated']=_0x49a5ab[_0x2005('0x4d')];_0x35568e[_0x2005('0x4e')]=_0x49a5ab[_0x2005('0x4e')];_0x35568e['erlangCallToSecond']=_0x49a5ab[_0x2005('0x4f')];_0x35568e['erlangAbandonmentRate']=_0x49a5ab['erlangAbandonmentRate'];_0x35568e[_0x2005('0x50')]=_0x49a5ab['erlangBusyFactor'];_0x35568e[_0x2005('0x51')]=_0x49a5ab[_0x2005('0x51')];_0x35568e[_0x2005('0x52')]=_0x49a5ab[_0x2005('0x52')];}if(_0x49a5ab[_0x2005('0x53')]){_0x35568e[_0x2005('0x53')]={'id':_0x49a5ab[_0x2005('0x53')]['id'],'name':_0x49a5ab[_0x2005('0x53')]['name'],'active':_0x49a5ab[_0x2005('0x53')][_0x2005('0x54')],'callerid':_0x49a5ab[_0x2005('0x53')]['callerid']};}if(_0x49a5ab[_0x2005('0x55')]){_0x35568e['Interval']={'id':_0x49a5ab[_0x2005('0x55')]['id'],'name':_0x49a5ab['Interval'][_0x2005('0xb')]};}_0x5544ff['push'](_0x35568e);}}_0x469202({'count':_0x5544ff[_0x2005('0x56')],'rows':_0x5544ff});});},'VoiceChannels':function(_0x80ca6b){return new Promise(function(_0x2e2a89,_0x36f1eb){var _0x4bd4aa=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0x58')]);_0x2e2a89({'count':_0x4bd4aa[_0x2005('0x56')],'rows':_0x4bd4aa});});},'VoiceChannelMixMonitor':function(_0x449a89){var _0x11147f=this;return new Promise(function(_0x501c72,_0x416c79){if(ami[_0x2005('0x12')]()==![]){return _0x416c79(_0x11147f[_0x2005('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x2005('0x14')][_0x2005('0x1d')],'ami\x20disconnected'][_0x2005('0x15')]('\x20')));}var _0xecff5=schema(properties['voicechannel'])[_0x2005('0x3')](_0x449a89);if(_0xecff5['length']>0x0){return _0x416c79(_0x11147f[_0x2005('0x13')](0x1f4,_['map'](_0xecff5,'message')[_0x2005('0x15')](',\x20')));}var _0x20f577=_['find'](_0x18ebf1[_0x2005('0x58')],{'uniqueid':_0x449a89[_0x2005('0x59')]});if(_0x20f577&&_0x20f577[_0x2005('0x5a')]){var _0x2ffbe7=util['format']('%s.%s',_0x449a89[_0x2005('0x5b')]||_0x449a89['uniqueid'],_0x449a89['format']||_0x2005('0x5c'));return ami[_0x2005('0x20')]({'action':_0x2005('0x5d'),'channel':_0x20f577[_0x2005('0x5a')],'file':_0x2ffbe7,'options':_0x2005('0x5e')})[_0x2005('0x1b')](function(_0xfa1a75){var _0x441696=_['find'](_0x20f577[_0x2005('0x5f')],{'filename':'/var/spool/asterisk/monitor/'+_0x2ffbe7['toLowerCase']()});if(_[_0x2005('0x60')](_0x441696)){_0x20f577[_0x2005('0x5f')]['push']({'filename':_0x2005('0x61')+_0x2ffbe7[_0x2005('0x62')](),'createdAt':moment()[_0x2005('0x9')](_0x2005('0x63')),'mixmonitorid':_0xfa1a75[_0x2005('0x64')],'status':_0x2005('0x65')});}else{_0x441696['mixmonitorid']=_0xfa1a75[_0x2005('0x64')];_0x441696[_0x2005('0x66')]=_0x2005('0x65');}_0x501c72({'code':0xc8,'message':[_0x449a89['uniqueid'],_0x2005('0x67'),_0xfa1a75[_0x2005('0x64')]][_0x2005('0x15')]('\x20'),'mixmonitorid':_0xfa1a75[_0x2005('0x64')]});})[_0x2005('0x21')](function(_0xb6849f){_0x416c79(_0x11147f[_0x2005('0x13')](0x1f5,[_0x449a89['uniqueid'],_0xb6849f['message'][_0x2005('0x62')]()][_0x2005('0x15')]('\x20')));});}else{return _0x416c79(_0x11147f[_0x2005('0x13')](0x1f5,_0x2005('0x68')));}});},'VoiceChannelStopMixMonitor':function(_0x1ff707){var _0x2e076c=this;return new Promise(function(_0x27c3ad,_0x13a3a0){if(ami['isConnected']()==![]){return _0x13a3a0(_0x2e076c[_0x2005('0x13')](0x1f4,[config[_0x2005('0x14')]['ip'],config[_0x2005('0x14')][_0x2005('0x1d')],_0x2005('0x1e')][_0x2005('0x15')]('\x20')));}var _0x225285=schema(properties[_0x2005('0x69')])[_0x2005('0x3')](_0x1ff707);if(_0x225285[_0x2005('0x56')]>0x0){return _0x13a3a0(_0x2e076c[_0x2005('0x13')](0x1f4,_[_0x2005('0x6a')](_0x225285,_0x2005('0x1c'))[_0x2005('0x15')](',\x20')));}var _0x3bb346=_[_0x2005('0x6b')](_0x18ebf1[_0x2005('0x58')],{'uniqueid':_0x1ff707['uniqueid']});if(_0x3bb346){return BPromise[_0x2005('0x6c')]()[_0x2005('0x1b')](function(){if(_0x3bb346[_0x2005('0x5a')]){return ami[_0x2005('0x20')]({'action':'StopMixMonitor','channel':_0x3bb346[_0x2005('0x5a')],'mixmonitorid':_0x1ff707[_0x2005('0x64')]})[_0x2005('0x21')](function(_0x2d4cdd){});}})['then'](function(){if(_0x3bb346[_0x2005('0x6d')]){return ami[_0x2005('0x20')]({'action':_0x2005('0x6e'),'channel':_0x3bb346[_0x2005('0x6d')],'mixmonitorid':_0x1ff707[_0x2005('0x64')]})[_0x2005('0x21')](function(_0x3c9cec){});}})[_0x2005('0x1b')](function(_0x5da58f){var _0x2923f2=_[_0x2005('0x6b')](_0x3bb346[_0x2005('0x5f')],{'mixmonitorid':_0x1ff707['mixmonitorid']});if(_0x2923f2){_0x2923f2[_0x2005('0x66')]=_0x2005('0x6f');}})[_0x2005('0x1b')](function(){var _0x2c4ba8=util[_0x2005('0x9')]('%s.%s',_0x1ff707['filename']||_0x1ff707[_0x2005('0x59')],_0x1ff707[_0x2005('0x9')]||_0x2005('0x5c'));var _0x4704a5=_[_0x2005('0x6b')](_0x3bb346[_0x2005('0x5f')],{'filename':_0x2005('0x61')+_0x2c4ba8['toLowerCase']()});if(_0x4704a5){_0x4704a5[_0x2005('0x66')]='stop';}})[_0x2005('0x1b')](function(){_0x27c3ad({'code':0xc8,'message':[_0x1ff707[_0x2005('0x59')],_0x2005('0x70')][_0x2005('0x15')]('\x20')});})['catch'](function(_0x1e9bd4){_0x13a3a0(_0x2e076c[_0x2005('0x13')](0x1f5,[_0x1ff707[_0x2005('0x59')],_0x1e9bd4[_0x2005('0x1c')][_0x2005('0x62')]()][_0x2005('0x15')]('\x20')));});}else{return _0x13a3a0(_0x2e076c['error'](0x1f5,_0x2005('0x68')));}});},'VoiceQueuesChannels':function(_0x793593){return new Promise(function(_0x3954c2,_0x5c9132){var _0x122bc7=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0x71')]);_0x3954c2({'count':_0x122bc7['length'],'rows':_0x122bc7});});},'VoiceQueuesChannel':function(_0x332eaa){var _0x135958=this;return new Promise(function(_0x139a6f,_0x29faca){var _0x2efca2=schema(properties[_0x2005('0x72')])[_0x2005('0x3')](_0x332eaa);if(_0x2efca2['length']>0x0){return _0x29faca(_0x135958[_0x2005('0x13')](0x1f4,_[_0x2005('0x6a')](_0x2efca2,_0x2005('0x1c'))[_0x2005('0x15')](',\x20')));}var _0x2e4fab=_['find'](_0x18ebf1[_0x2005('0x71')],{'uniqueid':_0x332eaa['uniqueid']});if(_0x2e4fab){_0x139a6f(_0x2e4fab);}else{return _0x29faca(_0x135958['error'](0x1f5,_0x2005('0x68')));}});},'VoiceQueuesChannelHangup':function(_0x14ec2b){var _0x5609f0=this;return new Promise(function(_0x515e69,_0x62720e){if(ami[_0x2005('0x12')]()==![]){return _0x62720e(_0x5609f0[_0x2005('0x13')](0x1f4,[config[_0x2005('0x14')]['ip'],config[_0x2005('0x14')]['username'],_0x2005('0x1e')]['join']('\x20')));}var _0x4dd6d4=schema(properties[_0x2005('0x73')])['validate'](_0x14ec2b);if(_0x4dd6d4['length']>0x0){return _0x62720e(_0x5609f0[_0x2005('0x13')](0x1f4,_[_0x2005('0x6a')](_0x4dd6d4,_0x2005('0x1c'))[_0x2005('0x15')](',\x20')));}var _0x3ca1ab=_[_0x2005('0x6b')](_0x18ebf1['queueChannels'],{'uniqueid':_0x14ec2b[_0x2005('0x59')]});if(_0x3ca1ab&&_0x3ca1ab[_0x2005('0x5a')]){return ami['Action']({'action':_0x2005('0x74'),'channel':_0x3ca1ab[_0x2005('0x5a')]})[_0x2005('0x1b')](function(_0x354c47){_0x515e69({'code':0xc8,'message':[_0x14ec2b[_0x2005('0x59')],_0x354c47[_0x2005('0x1c')]['toLowerCase']()][_0x2005('0x15')]('\x20')});})[_0x2005('0x21')](function(_0x40558b){_0x62720e(_0x5609f0['error'](0x1f5,[_0x14ec2b[_0x2005('0x59')],_0x40558b[_0x2005('0x1c')][_0x2005('0x62')]()][_0x2005('0x15')]('\x20')));});}else{return _0x62720e(_0x5609f0[_0x2005('0x13')](0x1f5,_0x2005('0x68')));}});},'VoiceQueuesChannelRedirect':function(_0x45da8c){var _0x5f376b=this;return new Promise(function(_0x451322,_0x549f73){if(ami[_0x2005('0x12')]()==![]){return _0x549f73(_0x5f376b[_0x2005('0x13')](0x1f4,[config['asterisk']['ip'],config[_0x2005('0x14')][_0x2005('0x1d')],_0x2005('0x1e')]['join']('\x20')));}var _0x3c4f7a=schema(properties['voicequeuechannelredirect'])[_0x2005('0x3')](_0x45da8c);if(_0x3c4f7a['length']>0x0){return _0x549f73(_0x5f376b[_0x2005('0x13')](0x1f4,_['map'](_0x3c4f7a,_0x2005('0x1c'))[_0x2005('0x15')](',\x20')));}var _0x505039=_[_0x2005('0x6b')](_0x18ebf1[_0x2005('0x71')],{'uniqueid':_0x45da8c['uniqueid']});if(_0x505039&&_0x505039[_0x2005('0x5a')]){return ami[_0x2005('0x20')]({'action':_0x2005('0x75'),'channel':_0x505039['channel'],'exten':_0x45da8c[_0x2005('0x76')],'context':_0x45da8c[_0x2005('0x77')]||_0x505039[_0x2005('0x77')],'priority':0x1})[_0x2005('0x1b')](function(_0x1b779c){_0x451322({'code':0xc8,'message':[_0x45da8c[_0x2005('0x59')],_0x1b779c[_0x2005('0x1c')][_0x2005('0x62')]()]['join']('\x20')});})[_0x2005('0x21')](function(_0x28c76d){_0x549f73(_0x5f376b[_0x2005('0x13')](0x1f5,[_0x45da8c[_0x2005('0x59')],_0x28c76d[_0x2005('0x1c')][_0x2005('0x62')]()]['join']('\x20')));});}else{return _0x549f73(_0x5f376b['error'](0x1f5,_0x2005('0x68')));}});},'Agents':function(_0x43ea0f){return new Promise(function(_0x44bb43,_0x4bb0ec){var _0x40a433=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0xf')]);_0x44bb43({'count':_0x40a433[_0x2005('0x56')],'rows':_0x40a433});});},'Telephones':function(_0x550dd8){return new Promise(function(_0x489242,_0xafdf07){var _0x32a4c0=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0x78')]);_0x489242({'count':_0x32a4c0['length'],'rows':_0x32a4c0});});},'Trunks':function(_0x460d7d){return new Promise(function(_0xb35494,_0x48ae5f){var _0xb2fe59=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0x79')]);_0xb35494({'count':_0xb2fe59[_0x2005('0x56')],'rows':_0xb2fe59});});},'OutboundChannels':function(_0x15cd65){return new Promise(function(_0x37290f,_0x2b939b){var _0x10c7a9=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0x7a')]);_0x37290f({'count':_0x10c7a9[_0x2005('0x56')],'rows':_0x10c7a9});});},'Outbound':function(_0x36448b){return new Promise(function(_0x5a91ba,_0x15684b){_0x5a91ba(_0x18ebf1['outbound']);});},'Campaigns':function(_0x2fbdfb){return new Promise(function(_0x1eeddf,_0x466f18){var _0x2055e0=_[_0x2005('0x57')](_0x18ebf1['campaigns']);_0x1eeddf({'count':_0x2055e0[_0x2005('0x56')],'rows':_0x2055e0});});},'VoiceQueuesPreview':function(_0x23f1c1){var _0x275c45=this;return new Promise(function(_0x28c698,_0x137c28){_0x5ee8f2['run'](_0x23f1c1['id'])[_0x2005('0x1b')](function(_0x57087a){_0x28c698({'code':0xc8,'message':_0x57087a[_0x2005('0x1c')]});})[_0x2005('0x21')](function(_0x30fcad){_0x137c28(_0x275c45[_0x2005('0x13')](0x1f4,_0x30fcad[_0x2005('0x1c')]));});});},'EventManager':function(_0x704c02){var _0xcce9d0=this;return new Promise(function(_0x2248d,_0x4150e4){if(!_0x704c02[_0x2005('0x7b')]){return _0x4150e4(_0xcce9d0[_0x2005('0x13')](0x1f4,_0x2005('0x7c')));}ami[_0x2005('0x7d')]('custom:'+_0x704c02[_0x2005('0x7b')],_0x704c02['message']);_0x2248d({'code':0xc8,'message':_0x704c02});});},'FaxAccounts':function(_0x52a869){return new Promise(function(_0x15973d,_0x183332){var _0x178a98=_[_0x2005('0x57')](_0x18ebf1[_0x2005('0x7e')]);_0x15973d({'count':_0x178a98[_0x2005('0x56')],'rows':_0x178a98});});},'SendFax':function(_0x849f67){var _0x26e4b4=this;return new Promise(function(_0x148c2f,_0x5bd69f){_0x3ff44c[_0x2005('0x7f')](_0x849f67)[_0x2005('0x1b')](function(_0x20a480){_0x148c2f({'code':0xc8,'message':_0x20a480[_0x2005('0x1c')]});})[_0x2005('0x21')](function(_0x1f022c){_0x5bd69f(_0x26e4b4[_0x2005('0x13')](0x1f4,_0x1f022c[_0x2005('0x1c')]));});});},'CheckAfterSend':function(_0x128c84){var _0x24be54=this;return new Promise(function(_0xa3077e,_0x59c1b0){_0x3ff44c[_0x2005('0x80')](_0x128c84)[_0x2005('0x1b')](function(_0x3d3fcb){_0xa3077e({'code':0xc8,'message':_0x3d3fcb[_0x2005('0x1c')]});})[_0x2005('0x21')](function(_0x502407){_0x59c1b0(_0x24be54[_0x2005('0x13')](0x1f4,_0x502407[_0x2005('0x1c')]));});});}};var _0x415c57=jayson[_0x2005('0x81')](_0x44d06b)['http']();_0x415c57['on'](_0x2005('0x13'),function(_0xa9ce2e){return _0x280b95(_0xa9ce2e);});_0x415c57[_0x2005('0x8')](0x232a,_0x2005('0x82'),function(){console[_0x2005('0x83')](_0x2005('0x84'),0x232a);return _0x124914(_0x2005('0x85')+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 9e2d809..369cde3 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 _0x6efe=['name','trigger:%s','action','toLowerCase','createContact','merge','catch','error','bluebird','util','lodash','ioredis','../../../../config/environment','../../rpc/cmContact','redis','defaults','localhost','stringify','emit','exec','autoCreate','data2','data1','calleridnum','isNil','routeId','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','resolve','omit','then','xmd-contactid2','format','user:%s'];(function(_0x39cf43,_0x3a5b9c){var _0x5d6580=function(_0x47d372){while(--_0x47d372){_0x39cf43['push'](_0x39cf43['shift']());}};_0x5d6580(++_0x3a5b9c);}(_0x6efe,0xc6));var _0xe6ef=function(_0x1d0636,_0x21a5e6){_0x1d0636=_0x1d0636-0x0;var _0xa7adc0=_0x6efe[_0x1d0636];return _0xa7adc0;};'use strict';var BPromise=require(_0xe6ef('0x0'));var util=require(_0xe6ef('0x1'));var _=require(_0xe6ef('0x2'));var Redis=require(_0xe6ef('0x3'));var config=require(_0xe6ef('0x4'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0xe6ef('0x5'));config[_0xe6ef('0x6')]=_[_0xe6ef('0x7')](config[_0xe6ef('0x6')],{'host':_0xe6ef('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe6ef('0x6')]));function emit(_0x422e13,_0x599b6c,_0x4a4bb9){logger['info'](_0x422e13,_0x599b6c,JSON[_0xe6ef('0x9')](_0x4a4bb9));io['to'](_0x422e13)[_0xe6ef('0xa')](_0x599b6c,_0x4a4bb9);}exports[_0xe6ef('0xb')]=function(_0x4fca2f,_0x283da2,_0x55a13c){_0x55a13c[_0xe6ef('0xc')]=0x0;if(_0x283da2[_0xe6ef('0xd')]&&parseInt(_0x283da2[_0xe6ef('0xd')],0xa)){var _0x142f4c={'ListId':parseInt(_0x283da2[_0xe6ef('0xe')],0xa),'phone':_0x55a13c[_0xe6ef('0xf')]};if(_[_0xe6ef('0x10')](_0x55a13c[_0xe6ef('0x11')])){_0x142f4c['firstName']=_0x55a13c[_0xe6ef('0x12')]&&_0x55a13c[_0xe6ef('0x12')]!==_0xe6ef('0x13')?_0x55a13c[_0xe6ef('0x12')]:_0x55a13c['calleridnum']||_0x55a13c[_0xe6ef('0x14')];}else{_0x142f4c['firstName']=_0x55a13c[_0xe6ef('0x15')]&&_0x55a13c[_0xe6ef('0x15')]!==_0xe6ef('0x13')?_0x55a13c[_0xe6ef('0x15')]:_0x55a13c[_0xe6ef('0x16')]||_0x55a13c[_0xe6ef('0x14')];_0x142f4c[_0xe6ef('0x17')]=_0x55a13c[_0xe6ef('0x15')]&&_0x55a13c[_0xe6ef('0x15')]!==_0xe6ef('0x13')?_0x55a13c[_0xe6ef('0x15')]:_0x55a13c[_0xe6ef('0x16')]||_0x55a13c[_0xe6ef('0x14')];}BPromise[_0xe6ef('0x18')]()['then'](cmContactRpc['showContact']({'where':_[_0xe6ef('0x19')](_0x142f4c,['firstName'])}))[_0xe6ef('0x1a')](function(_0x592176){if(_0x592176){_0x55a13c[_0xe6ef('0x1b')]=_0x592176['id'];emit(util[_0xe6ef('0x1c')](_0xe6ef('0x1d'),_0x4fca2f[_0xe6ef('0x1e')]),util[_0xe6ef('0x1c')](_0xe6ef('0x1f'),_0x283da2[_0xe6ef('0x20')][_0xe6ef('0x21')]()),_['merge'](_0x55a13c,{'ListId':parseInt(_0x283da2[_0xe6ef('0xe')],0xa)}));return;}else{return BPromise[_0xe6ef('0x18')]()['then'](cmContactRpc[_0xe6ef('0x22')](_0x142f4c));}})[_0xe6ef('0x1a')](function(_0x1d5d55){if(_0x1d5d55){_0x55a13c[_0xe6ef('0x1b')]=_0x1d5d55['id'];emit(util[_0xe6ef('0x1c')]('user:%s',_0x4fca2f[_0xe6ef('0x1e')]),util[_0xe6ef('0x1c')](_0xe6ef('0x1f'),_0x283da2['action'][_0xe6ef('0x21')]()),_[_0xe6ef('0x23')](_0x55a13c,{'ListId':parseInt(_0x283da2['data1'],0xa)}));}})[_0xe6ef('0x24')](function(_0xb9c909){logger[_0xe6ef('0x25')]('Error\x20creating\x20contact',JSON[_0xe6ef('0x9')](_0xb9c909));});}else{if(_0x4fca2f){emit(util[_0xe6ef('0x1c')]('user:%s',_0x4fca2f[_0xe6ef('0x1e')]),util[_0xe6ef('0x1c')](_0xe6ef('0x1f'),_0x283da2[_0xe6ef('0x20')][_0xe6ef('0x21')]()),_['merge']({'ListId':parseInt(_0x283da2[_0xe6ef('0xe')],0xa)},_0x55a13c));}}}; \ No newline at end of file +var _0xac41=['toLowerCase','createContact','trigger:%s','error','Error\x20creating\x20contact','merge','bluebird','util','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','stringify','emit','exec','autoCreate','data2','data1','calleridnum','routeId','firstName','calleridname','uniqueid','destcalleridname','','phone','destcalleridnum','resolve','then','showContact','omit','xmd-contactid2','format','user:%s','name','action'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xac41,0xdd));var _0x1ac4=function(_0x242a9d,_0x145834){_0x242a9d=_0x242a9d-0x0;var _0x344ba7=_0xac41[_0x242a9d];return _0x344ba7;};'use strict';var BPromise=require(_0x1ac4('0x0'));var util=require(_0x1ac4('0x1'));var _=require(_0x1ac4('0x2'));var Redis=require(_0x1ac4('0x3'));var config=require(_0x1ac4('0x4'));var logger=require(_0x1ac4('0x5'))(_0x1ac4('0x6'));var cmContactRpc=require(_0x1ac4('0x7'));config['redis']=_[_0x1ac4('0x8')](config[_0x1ac4('0x9')],{'host':_0x1ac4('0xa'),'port':0x18eb});var io=require(_0x1ac4('0xb'))(new Redis(config[_0x1ac4('0x9')]));function emit(_0x2ad173,_0x18703d,_0x1c9bed){logger[_0x1ac4('0xc')](_0x2ad173,_0x18703d,JSON[_0x1ac4('0xd')](_0x1c9bed));io['to'](_0x2ad173)[_0x1ac4('0xe')](_0x18703d,_0x1c9bed);}exports[_0x1ac4('0xf')]=function(_0x454972,_0x4590a1,_0x3a8514){_0x3a8514[_0x1ac4('0x10')]=0x0;if(_0x4590a1['data2']&&parseInt(_0x4590a1[_0x1ac4('0x11')],0xa)){var _0x550dc0={'ListId':parseInt(_0x4590a1[_0x1ac4('0x12')],0xa),'phone':_0x3a8514[_0x1ac4('0x13')]};if(_['isNil'](_0x3a8514[_0x1ac4('0x14')])){_0x550dc0[_0x1ac4('0x15')]=_0x3a8514['calleridname']&&_0x3a8514[_0x1ac4('0x16')]!==''?_0x3a8514['calleridname']:_0x3a8514['calleridnum']||_0x3a8514[_0x1ac4('0x17')];}else{_0x550dc0[_0x1ac4('0x15')]=_0x3a8514[_0x1ac4('0x18')]&&_0x3a8514[_0x1ac4('0x18')]!==_0x1ac4('0x19')?_0x3a8514[_0x1ac4('0x18')]:_0x3a8514['destcalleridnum']||_0x3a8514['uniqueid'];_0x550dc0[_0x1ac4('0x1a')]=_0x3a8514[_0x1ac4('0x18')]&&_0x3a8514[_0x1ac4('0x18')]!==''?_0x3a8514[_0x1ac4('0x18')]:_0x3a8514[_0x1ac4('0x1b')]||_0x3a8514[_0x1ac4('0x17')];}BPromise[_0x1ac4('0x1c')]()[_0x1ac4('0x1d')](cmContactRpc[_0x1ac4('0x1e')]({'where':_[_0x1ac4('0x1f')](_0x550dc0,['firstName'])}))['then'](function(_0x9c8678){if(_0x9c8678){_0x3a8514[_0x1ac4('0x20')]=_0x9c8678['id'];emit(util[_0x1ac4('0x21')](_0x1ac4('0x22'),_0x454972[_0x1ac4('0x23')]),util['format']('trigger:%s',_0x4590a1[_0x1ac4('0x24')][_0x1ac4('0x25')]()),_['merge'](_0x3a8514,{'ListId':parseInt(_0x4590a1[_0x1ac4('0x12')],0xa)}));return;}else{return BPromise[_0x1ac4('0x1c')]()[_0x1ac4('0x1d')](cmContactRpc[_0x1ac4('0x26')](_0x550dc0));}})['then'](function(_0x2f1f67){if(_0x2f1f67){_0x3a8514[_0x1ac4('0x20')]=_0x2f1f67['id'];emit(util['format'](_0x1ac4('0x22'),_0x454972['name']),util[_0x1ac4('0x21')](_0x1ac4('0x27'),_0x4590a1[_0x1ac4('0x24')][_0x1ac4('0x25')]()),_['merge'](_0x3a8514,{'ListId':parseInt(_0x4590a1[_0x1ac4('0x12')],0xa)}));}})['catch'](function(_0x289579){logger[_0x1ac4('0x28')](_0x1ac4('0x29'),JSON[_0x1ac4('0xd')](_0x289579));});}else{if(_0x454972){emit(util[_0x1ac4('0x21')](_0x1ac4('0x22'),_0x454972[_0x1ac4('0x23')]),util[_0x1ac4('0x21')](_0x1ac4('0x27'),_0x4590a1[_0x1ac4('0x24')][_0x1ac4('0x25')]()),_[_0x1ac4('0x2a')]({'ListId':parseInt(_0x4590a1[_0x1ac4('0x12')],0xa)},_0x3a8514));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 046d75b..3d5aa1d 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 _0x5ea4=['zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','salesforceAccounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentcomplete','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','interface','checkTriggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','templates','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6','600','winApplication','winArguments','format','name','trigger:%s:%s','jscripty','user:%s','trigger:%s','integration','exec','voiceQueues','urlforward','parse','search','replace','AllConditions','every','checkConditions','channel','AnyConditions','some','field','account','chat','ChatWebsiteId','value','AccountId','operator','upperFirst','event','queue','agent','membername','lastevent','routeId','exports','util','lodash','url','mustache','./urlforward','./integration','./cmContact','./script','../rpc/cmContact','../../../config/environment','trigger','../ami','redis','localhost','socket.io-emitter','popup','winapp','triggers','agents','voiceExtensions'];(function(_0x25df1d,_0x320488){var _0x3fb9ec=function(_0x90c8b4){while(--_0x90c8b4){_0x25df1d['push'](_0x25df1d['shift']());}};_0x3fb9ec(++_0x320488);}(_0x5ea4,0xdc));var _0x45ea=function(_0x3dcf75,_0x10ce1e){_0x3dcf75=_0x3dcf75-0x0;var _0x2f1363=_0x5ea4[_0x3dcf75];return _0x2f1363;};'use strict';var util=require(_0x45ea('0x0'));var _=require(_0x45ea('0x1'));var url=require(_0x45ea('0x2'));var Mustache=require(_0x45ea('0x3'));var Redis=require('ioredis');var urlforward=require(_0x45ea('0x4'));var integration=require(_0x45ea('0x5'));var cmContact=require(_0x45ea('0x6'));var script=require(_0x45ea('0x7'));var cmContactRpc=require(_0x45ea('0x8'));var config=require(_0x45ea('0x9'));var logger=require('../../../config/logger')(_0x45ea('0xa'));var ami=require(_0x45ea('0xb'));config[_0x45ea('0xc')]=_['defaults'](config[_0x45ea('0xc')],{'host':_0x45ea('0xd'),'port':0x18eb});var io=require(_0x45ea('0xe'))(new Redis(config[_0x45ea('0xc')]));var operators={'equals':function(_0x1981cc,_0x80057b){return _0x1981cc==_0x80057b;},'not_equals':function(_0x20dce7,_0x5d6c54){return _0x20dce7!=_0x5d6c54;}};var barAndWebActions=[_0x45ea('0xf'),'url',_0x45ea('0x10')];function Trigger(_0xf826fe){this[_0x45ea('0x11')]=_0xf826fe['triggers'];this[_0x45ea('0x12')]=_0xf826fe[_0x45ea('0x12')];this['voiceQueues']=_0xf826fe['voiceQueues'];this['templates']=_0xf826fe['templates'];this[_0x45ea('0x13')]=_0xf826fe[_0x45ea('0x13')];this[_0x45ea('0x14')]=_0xf826fe['zendeskAccounts'];this[_0x45ea('0x15')]=_0xf826fe[_0x45ea('0x15')];this['salesforceAccounts']=_0xf826fe['salesforceAccounts'];this[_0x45ea('0x16')]=_0xf826fe[_0x45ea('0x16')];this[_0x45ea('0x17')]=_0xf826fe[_0x45ea('0x17')];this[_0x45ea('0x18')]=_0xf826fe[_0x45ea('0x18')];this[_0x45ea('0x19')]=_0xf826fe[_0x45ea('0x19')];this[_0x45ea('0x1a')]=_0xf826fe['servicenowAccounts'];this[_0x45ea('0x1b')]=_0xf826fe['dynamics365Accounts'];this[_0x45ea('0x1c')]=_0xf826fe[_0x45ea('0x1c')];this[_0x45ea('0x1d')]={'zendesk':this[_0x45ea('0x14')],'salesforce':this[_0x45ea('0x1e')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x45ea('0x16')],'zoho':this[_0x45ea('0x17')],'desk':this[_0x45ea('0x18')],'vtiger':this[_0x45ea('0x19')],'dynamics365':this[_0x45ea('0x1b')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x45ea('0x1a')]};ami['on'](_0x45ea('0x1f'),this[_0x45ea('0x20')]['bind'](this));ami['on'](_0x45ea('0x21'),this[_0x45ea('0x20')][_0x45ea('0x22')](this));ami['on']('custom:agentringnoanswer',this[_0x45ea('0x20')]['bind'](this));ami['on'](_0x45ea('0x23'),this[_0x45ea('0x20')]['bind'](this));ami['on'](_0x45ea('0x24'),this['syncCustomEvent'][_0x45ea('0x22')](this));ami['on'](_0x45ea('0x25'),this['syncAgentDial'][_0x45ea('0x22')](this));ami['on']('custom:dialconnect',this[_0x45ea('0x26')]['bind'](this));ami['on'](_0x45ea('0x27'),this[_0x45ea('0x26')][_0x45ea('0x22')](this));ami['on'](_0x45ea('0x28'),this[_0x45ea('0x20')]['bind'](this));ami['on'](_0x45ea('0x29'),this[_0x45ea('0x20')][_0x45ea('0x22')](this));ami['on'](_0x45ea('0x2a'),this[_0x45ea('0x20')][_0x45ea('0x22')](this));ami['on'](_0x45ea('0x2b'),this[_0x45ea('0x20')][_0x45ea('0x22')](this));ami['on']('custom:acceptmessage',this[_0x45ea('0x20')][_0x45ea('0x22')](this));ami['on'](_0x45ea('0x2c'),this['syncCustomEvent'][_0x45ea('0x22')](this));}Trigger[_0x45ea('0x2d')][_0x45ea('0x2e')]=function(_0x14d549,_0x4bbdaa,_0x50dcb8){logger[_0x45ea('0x2f')](_0x14d549,_0x4bbdaa,JSON[_0x45ea('0x30')](_0x50dcb8));io['to'](_0x14d549)[_0x45ea('0x2e')](_0x4bbdaa,_0x50dcb8);};Trigger[_0x45ea('0x2d')]['syncCustomEvent']=function(_0x173f74){var _0x4d61ee=_[_0x45ea('0x31')](_0x173f74);this['checkTriggers'](_0x4d61ee);};Trigger[_0x45ea('0x2d')][_0x45ea('0x26')]=function(_0x302217){if(this['agents'][_0x302217[_0x45ea('0x32')]]){this['syncCustomEvent'](_0x302217);}};Trigger['prototype'][_0x45ea('0x33')]=function(_0x1fae3f){var _0x26cb44;for(var _0x5691bc in this['triggers']){if(this[_0x45ea('0x11')][_0x45ea('0x34')](_0x5691bc)){if(this['triggers'][_0x5691bc][_0x45ea('0x35')]){_0x26cb44=this[_0x45ea('0x36')](this[_0x45ea('0x11')][_0x5691bc],_0x1fae3f);if(_0x26cb44){_[_0x45ea('0x37')](_0x1fae3f,_0x1fae3f[_0x45ea('0x38')]);for(var _0x443b7d=0x0,_0x5d395f,_0x3fed6b,_0x571050;_0x443b7d0x0){_0x584594=_[_0x6cf6('0x2b')](_0x1f5a88,_0x5c9236);}return _0x584594;}function getCustomFields(_0x57099f,_0x5869e9){var _0x5ccc8f=[];var _0x2afc06={'custom_fields':{}};if(_0x57099f['length']>0x0){_['forEach'](_0x57099f,function(_0x519a70){if(_0x519a70[_0x6cf6('0x2c')]===_0x6cf6('0x2d')&&_0x519a70[_0x6cf6('0x2e')]&&!_0x519a70[_0x6cf6('0x2f')]){_0x2afc06[_0x519a70[_0x6cf6('0x2e')]['toLowerCase']()]=_0x519a70[_0x6cf6('0x30')][_0x6cf6('0x23')]();}else if(_0x519a70[_0x6cf6('0x2c')]==='string'&&_0x519a70[_0x6cf6('0x31')]&&_0x519a70[_0x6cf6('0x2f')]){_0x2afc06[_0x6cf6('0x32')][_0x519a70[_0x6cf6('0x31')]]=_0x519a70[_0x6cf6('0x30')][_0x6cf6('0x23')]();}else if(_0x519a70[_0x6cf6('0x2c')]===_0x6cf6('0x33')&&_0x519a70[_0x6cf6('0x34')]&&_0x519a70[_0x6cf6('0x31')]&&_0x519a70[_0x6cf6('0x2f')]){_0x5869e9[_0x519a70[_0x6cf6('0x34')]]&&(_0x2afc06[_0x6cf6('0x32')][_0x519a70[_0x6cf6('0x31')]]=_0x5869e9[_0x519a70[_0x6cf6('0x34')]][_0x6cf6('0x23')]());}else if(_0x519a70[_0x6cf6('0x2c')]===_0x6cf6('0x35')&&_0x519a70['Variable']&&_0x519a70[_0x6cf6('0x36')][_0x6cf6('0x37')]&&_0x519a70[_0x6cf6('0x31')]&&_0x519a70[_0x6cf6('0x2f')]){_0x5869e9[_0x519a70[_0x6cf6('0x36')][_0x6cf6('0x37')][_0x6cf6('0x38')]()]&&(_0x2afc06[_0x6cf6('0x32')][_0x519a70[_0x6cf6('0x31')]]=_0x5869e9[_0x519a70[_0x6cf6('0x36')][_0x6cf6('0x37')]['toLowerCase']()][_0x6cf6('0x23')]());}});}if(_0x2afc06[_0x6cf6('0x39')]){_0x2afc06[_0x6cf6('0x39')]=Number(_0x2afc06[_0x6cf6('0x39')]);}return _0x2afc06;}function getTicket(_0x31c822,_0xe329e3,_0x2f0120,_0x42d9e9,_0x3a962a){logger['info'](_0x6cf6('0x3a'));var _0x46423f=_[_0x6cf6('0x3b')]({'subject':intUtil[_0x6cf6('0x3c')](_0x42d9e9[_0x6cf6('0x3d')],_0x3a962a,'\x20'),'type':_0x6cf6('0x3e'),'status':_0x6cf6('0x3f'),'labels':[_0x6cf6('0x40'),_0x6cf6('0x41'),'CTI'][_0x6cf6('0x42')](getTags(_0x42d9e9['Tags'],_0x6cf6('0x37'))),'description':intUtil[_0x6cf6('0x3c')](_0x42d9e9[_0x6cf6('0x43')],_0x3a962a,'\x0a'),'_links':{'assigned_user':{'href':util[_0x6cf6('0xc')](_0x6cf6('0x44'),_0xe329e3['id']),'class':_0x6cf6('0x45')}},'message':{'direction':'in','body':intUtil[_0x6cf6('0x3c')](_0x42d9e9[_0x6cf6('0x43')],_0x3a962a,'\x0a')}},getCustomFields(_0x42d9e9['Fields'],_0x3a962a));return request({'uri':util[_0x6cf6('0xc')](_0x6cf6('0x46'),_0x31c822['remoteUri'],_0x2f0120['id']),'method':_0x6cf6('0x28'),'body':_0x46423f});}exports[_0x6cf6('0x47')]=function(_0x13d654,_0x4874c0,_0x10bb9b,_0x128f7a,_0x51d915,_0x3f1084){var _0x1d9aef,_0x372d36;_0x3f1084[_0x6cf6('0xe')]=intUtil[_0x6cf6('0x48')](_0x3f1084[_0x6cf6('0xe')]);_0x3f1084[_0x6cf6('0x49')]=intUtil['stripTrailingSlash'](_0x3f1084[_0x6cf6('0x49')]);if(_0x51d915&&_0x51d915['monitor_format']){logger[_0x6cf6('0xb')](_0x6cf6('0x4a'),'Recording\x20is\x20enabled!');_0x4874c0[_0x6cf6('0x4b')]=util[_0x6cf6('0xc')](_0x6cf6('0x4c'),_0x3f1084[_0x6cf6('0x49')],_0x4874c0[_0x6cf6('0x4d')],md5(_0x4874c0['uniqueid']));}else{_0x4874c0[_0x6cf6('0x4b')]='';}headers[_0x6cf6('0x4e')]=getAuth(_0x3f1084);return getUser(_0x3f1084,_0x128f7a[_0x6cf6('0x4f')])['then'](function(_0x10168f){_0x1d9aef=_0x10168f;logger[_0x6cf6('0xb')](_0x6cf6('0x50'),_0x1d9aef['id']);return getEndUser(_0x3f1084,_0x4874c0['calleridname'],_0x4874c0[_0x6cf6('0x51')]);})['then'](function(_0x586e8d){_0x372d36=_0x586e8d;logger[_0x6cf6('0xb')](_0x6cf6('0x52'),_0x372d36['id']);return getTicket(_0x3f1084,_0x1d9aef,_0x372d36,_0x10bb9b,_0x4874c0);})[_0x6cf6('0xf')](function(_0xf123fb){if(_0xf123fb){logger[_0x6cf6('0xb')](_0x6cf6('0x53'));logger[_0x6cf6('0xb')](_0x6cf6('0x54'),_0xf123fb['id']);switch(_0x3f1084[_0x6cf6('0x2c')]){case _0x6cf6('0x55'):logger[_0x6cf6('0xb')](_0x6cf6('0x4a'),_0x6cf6('0x56'));emit(util['format'](_0x6cf6('0x57'),_0x128f7a[_0x6cf6('0x37')]),'trigger:desk:display',{'recordId':_0xf123fb['id']});break;case'newTab':logger[_0x6cf6('0xb')](_0x6cf6('0x4a'),_0x6cf6('0x58'));emit(util[_0x6cf6('0xc')](_0x6cf6('0x57'),_0x128f7a[_0x6cf6('0x37')]),'trigger:browser:url',{'uri':util[_0x6cf6('0xc')](_0x6cf6('0x59'),_0xf123fb['id'])});break;default:logger[_0x6cf6('0x5a')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})[_0x6cf6('0x5b')](function(_0x2b51e7){console[_0x6cf6('0x5a')](_0x2b51e7);logger[_0x6cf6('0x5a')](_0x6cf6('0x4a'),JSON[_0x6cf6('0x18')](_0x2b51e7));});};exports[_0x6cf6('0x5c')]=function(_0x3e8aee,_0x3800fe,_0x10df16,_0x4bb37e,_0x217072,_0x2fc115,_0x34165c){var _0x131ea6,_0x2fdf83;_0x2fc115[_0x6cf6('0xe')]=intUtil[_0x6cf6('0x48')](_0x2fc115[_0x6cf6('0xe')]);_0x2fc115[_0x6cf6('0x49')]=intUtil[_0x6cf6('0x48')](_0x2fc115[_0x6cf6('0x49')]);if(_0x34165c&&_0x34165c['recordingFormat']&&_0x34165c[_0x6cf6('0x5d')]!=='none'){logger[_0x6cf6('0xb')](_0x6cf6('0x5e'),'Recording\x20is\x20enabled!');_0x3800fe[_0x6cf6('0x4b')]=util[_0x6cf6('0xc')](_0x6cf6('0x4c'),_0x2fc115[_0x6cf6('0x49')],_0x3800fe[_0x6cf6('0x4d')],md5(_0x3800fe[_0x6cf6('0x4d')]));}headers['Authorization']=getAuth(_0x2fc115);return getUser(_0x2fc115,_0x4bb37e[_0x6cf6('0x4f')])[_0x6cf6('0xf')](function(_0x160c7f){_0x131ea6=_0x160c7f;logger['info']('The\x20User\x20ID\x20is:',_0x131ea6['id']);return getEndUser(_0x2fc115,_0x3800fe[_0x6cf6('0x5f')],_0x3800fe[_0x6cf6('0x60')]);})['then'](function(_0x2748e9){_0x2fdf83=_0x2748e9;logger[_0x6cf6('0xb')](_0x6cf6('0x52'),_0x2fdf83['id']);return getTicket(_0x2fc115,_0x131ea6,_0x2fdf83,_0x10df16,_0x3800fe);})[_0x6cf6('0xf')](function(_0x2e460a){if(_0x2e460a){logger['info'](_0x6cf6('0x53'));logger[_0x6cf6('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2e460a['id']);switch(_0x2fc115['type']){case _0x6cf6('0x55'):logger[_0x6cf6('0xb')](_0x6cf6('0x4a'),_0x6cf6('0x56'));emit(util[_0x6cf6('0xc')]('user:%s',_0x4bb37e['name']),_0x6cf6('0x61'),{'recordId':_0x2e460a['id']});break;case _0x6cf6('0x62'):logger[_0x6cf6('0xb')](_0x6cf6('0x4a'),_0x6cf6('0x58'));emit(util['format']('user:%s',_0x4bb37e['name']),_0x6cf6('0x63'),{'uri':util[_0x6cf6('0xc')](_0x6cf6('0x64'),_0x2fc115[_0x6cf6('0xe')],_0x2e460a['id'])});break;default:logger['error'](_0x6cf6('0x5e'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x6cf6('0x5b')](function(_0x54ef08){logger[_0x6cf6('0x5a')](_0x6cf6('0x5e'),JSON[_0x6cf6('0x18')](_0x54ef08));});};exports[_0x6cf6('0x65')]=function(_0x38ebcc,_0x54a3b9,_0x21ea76,_0x5bc1cb,_0x4498cd,_0x5e1f79){var _0x4363f7,_0x549c0b;_0x5e1f79[_0x6cf6('0xe')]=intUtil[_0x6cf6('0x48')](_0x5e1f79['remoteUri']);_0x5e1f79[_0x6cf6('0x49')]=intUtil[_0x6cf6('0x48')](_0x5e1f79[_0x6cf6('0x49')]);if(_0x4498cd&&_0x4498cd[_0x6cf6('0x66')]){logger[_0x6cf6('0xb')](_0x6cf6('0x67'),_0x6cf6('0x68'));_0x54a3b9['recordingURL']=util['format'](_0x6cf6('0x4c'),_0x5e1f79[_0x6cf6('0x49')],_0x54a3b9['uniqueid'],md5(_0x54a3b9[_0x6cf6('0x4d')]));}else{_0x54a3b9['recordingURL']='';}headers['Authorization']=getAuth(_0x5e1f79);return getUser(_0x5e1f79)[_0x6cf6('0xf')](function(_0x4d1275){_0x4363f7=_0x4d1275;logger['info'](_0x6cf6('0x50'),_0x4363f7['id']);return getEndUser(_0x5e1f79,_0x54a3b9[_0x6cf6('0x69')],_0x54a3b9[_0x6cf6('0x51')]);})['then'](function(_0x18b60c){_0x549c0b=_0x18b60c;logger['info'](_0x6cf6('0x52'),_0x549c0b['id']);return getTicket(_0x5e1f79,_0x4363f7,_0x549c0b,_0x21ea76,_0x54a3b9);})[_0x6cf6('0xf')](function(_0x585435){if(_0x585435){logger[_0x6cf6('0xb')](_0x6cf6('0x53'));logger[_0x6cf6('0xb')](_0x6cf6('0x54'),_0x585435['id']);}})[_0x6cf6('0x5b')](function(_0x40ea5e){logger['error'](_0x6cf6('0x67'),JSON[_0x6cf6('0x18')](_0x40ea5e));});}; \ No newline at end of file +var _0x3f8c=['string','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','getString','Subjects','phone','new','Motion','CTI','concat','Tags','/api/v2/users/%d','user','Descriptions','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','trigger:desk:display','newTab','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','stringify','outbound','recordingFormat','Authorization','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','[OUTBOUND]','abandoned','[ABANDONED]','md5','util','ioredis','./util','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','format','%s/users','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','debug','defaults','GET','basic','username','authType','token','Basic\x20%s','toString','base64','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','forEach','nameField','customField','toLowerCase','content','type'];(function(_0x1ab38c,_0x88fc9b){var _0x1277f2=function(_0x2f22d5){while(--_0x2f22d5){_0x1ab38c['push'](_0x1ab38c['shift']());}};_0x1277f2(++_0x88fc9b);}(_0x3f8c,0x104));var _0xc3f8=function(_0x49e047,_0x4add52){_0x49e047=_0x49e047-0x0;var _0x10bd26=_0x3f8c[_0x49e047];return _0x10bd26;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xc3f8('0x0'));var util=require(_0xc3f8('0x1'));var Redis=require(_0xc3f8('0x2'));var intUtil=require(_0xc3f8('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('desk');config['redis']=_['defaults'](config[_0xc3f8('0x4')],{'host':_0xc3f8('0x5'),'port':0x18eb});var io=require(_0xc3f8('0x6'))(new Redis(config[_0xc3f8('0x4')]));function emit(_0x2bbaa5,_0x15512a,_0x51093a){io['to'](_0x2bbaa5)[_0xc3f8('0x7')](_0x15512a,_0x51093a);}var headers={'Content-Type':_0xc3f8('0x8'),'Accept':_0xc3f8('0x8')};function getUser(_0x3c340c,_0x148e6f){if(intUtil[_0xc3f8('0x9')](_0x148e6f)===!![]){logger[_0xc3f8('0xa')]('Getting\x20agent\x20with\x20email',_0x148e6f);return request({'uri':util[_0xc3f8('0xb')](_0xc3f8('0xc'),_0x3c340c[_0xc3f8('0xd')])})[_0xc3f8('0xe')](function(_0x58118f){if(_0x58118f[_0xc3f8('0xf')]){return _[_0xc3f8('0x10')](_0x58118f[_0xc3f8('0x11')][_0xc3f8('0x12')],{'email':_0x148e6f});}})['then'](function(_0x84f489){if(_0x84f489){logger[_0xc3f8('0xa')](_0xc3f8('0x13'));return _0x84f489;}else{logger[_0xc3f8('0xa')](_0xc3f8('0x14'));return request({'uri':util[_0xc3f8('0xb')](_0xc3f8('0x15'),_0x3c340c[_0xc3f8('0xd')])});}});}else{logger[_0xc3f8('0xa')](_0xc3f8('0x16'));return request({'uri':util[_0xc3f8('0xb')](_0xc3f8('0x15'),_0x3c340c[_0xc3f8('0xd')])});}}function request(_0x58f636){logger[_0xc3f8('0x17')]('[HTTP]',JSON['stringify'](_0x58f636));return rp(_[_0xc3f8('0x18')](_0x58f636,{'method':_0xc3f8('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x35500f){var _0xb4ab67;if(_0x35500f['authType']===_0xc3f8('0x1a')){_0xb4ab67=util[_0xc3f8('0xb')]('%s:%s',_0x35500f[_0xc3f8('0x1b')],_0x35500f['password']);}else if(_0x35500f[_0xc3f8('0x1c')]===_0xc3f8('0x1d')){_0xb4ab67=util[_0xc3f8('0xb')]('%s/token:%s',_0x35500f['username'],_0x35500f[_0xc3f8('0x1d')]);}return util[_0xc3f8('0xb')](_0xc3f8('0x1e'),new Buffer(_0xb4ab67)[_0xc3f8('0x1f')](_0xc3f8('0x20')));}function getEndUser(_0x251bf7,_0x43b2b4,_0x42a155){logger['info']('Searching\x20enduser\x20with\x20phone',_0x42a155);return request({'uri':util['format'](_0xc3f8('0x21'),_0x251bf7['remoteUri']),'qs':{'phone':_0x42a155}})[_0xc3f8('0xe')](function(_0x3f196d){if(_0x3f196d['total_entries']){logger[_0xc3f8('0xa')](_0xc3f8('0x22'));return _0x3f196d[_0xc3f8('0x11')][_0xc3f8('0x12')][0x0];}else{logger[_0xc3f8('0xa')](_0xc3f8('0x23'));return request({'uri':util[_0xc3f8('0xb')](_0xc3f8('0x24'),_0x251bf7[_0xc3f8('0xd')]),'method':_0xc3f8('0x25'),'body':{'first_name':_0x43b2b4,'title':_0x43b2b4,'phone_numbers':[{'type':_0xc3f8('0x26'),'value':_0x42a155}]}});}});}function getTags(_0x394629,_0x238ff5){var _0x429fd8=[];if(_0x394629&&_0x394629['length']>0x0){_0x429fd8=_[_0xc3f8('0x27')](_0x394629,_0x238ff5);}return _0x429fd8;}function getCustomFields(_0x2909f8,_0x218029){var _0x5bf6e2=[];var _0x151bba={'custom_fields':{}};if(_0x2909f8['length']>0x0){_[_0xc3f8('0x28')](_0x2909f8,function(_0x32343e){if(_0x32343e['type']==='string'&&_0x32343e[_0xc3f8('0x29')]&&!_0x32343e[_0xc3f8('0x2a')]){_0x151bba[_0x32343e[_0xc3f8('0x29')][_0xc3f8('0x2b')]()]=_0x32343e[_0xc3f8('0x2c')][_0xc3f8('0x1f')]();}else if(_0x32343e[_0xc3f8('0x2d')]===_0xc3f8('0x2e')&&_0x32343e[_0xc3f8('0x2f')]&&_0x32343e[_0xc3f8('0x2a')]){_0x151bba['custom_fields'][_0x32343e[_0xc3f8('0x2f')]]=_0x32343e[_0xc3f8('0x2c')][_0xc3f8('0x1f')]();}else if(_0x32343e[_0xc3f8('0x2d')]===_0xc3f8('0x30')&&_0x32343e['variableName']&&_0x32343e['idField']&&_0x32343e[_0xc3f8('0x2a')]){_0x218029[_0x32343e[_0xc3f8('0x31')]]&&(_0x151bba[_0xc3f8('0x32')][_0x32343e[_0xc3f8('0x2f')]]=_0x218029[_0x32343e[_0xc3f8('0x31')]]['toString']());}else if(_0x32343e[_0xc3f8('0x2d')]===_0xc3f8('0x33')&&_0x32343e[_0xc3f8('0x34')]&&_0x32343e['Variable'][_0xc3f8('0x35')]&&_0x32343e[_0xc3f8('0x2f')]&&_0x32343e[_0xc3f8('0x2a')]){_0x218029[_0x32343e['Variable'][_0xc3f8('0x35')][_0xc3f8('0x2b')]()]&&(_0x151bba['custom_fields'][_0x32343e[_0xc3f8('0x2f')]]=_0x218029[_0x32343e[_0xc3f8('0x34')][_0xc3f8('0x35')][_0xc3f8('0x2b')]()][_0xc3f8('0x1f')]());}});}if(_0x151bba[_0xc3f8('0x36')]){_0x151bba['priority']=Number(_0x151bba[_0xc3f8('0x36')]);}return _0x151bba;}function getTicket(_0x2e4880,_0x2d3129,_0x2f589d,_0x17aff0,_0x502293){logger[_0xc3f8('0xa')](_0xc3f8('0x37'));var _0xaa4c98=_['merge']({'subject':intUtil[_0xc3f8('0x38')](_0x17aff0[_0xc3f8('0x39')],_0x502293,'\x20'),'type':_0xc3f8('0x3a'),'status':_0xc3f8('0x3b'),'labels':['xCALLY',_0xc3f8('0x3c'),_0xc3f8('0x3d')][_0xc3f8('0x3e')](getTags(_0x17aff0[_0xc3f8('0x3f')],'name')),'description':intUtil[_0xc3f8('0x38')](_0x17aff0['Descriptions'],_0x502293,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xc3f8('0x40'),_0x2d3129['id']),'class':_0xc3f8('0x41')}},'message':{'direction':'in','body':intUtil[_0xc3f8('0x38')](_0x17aff0[_0xc3f8('0x42')],_0x502293,'\x0a')}},getCustomFields(_0x17aff0['Fields'],_0x502293));return request({'uri':util['format'](_0xc3f8('0x43'),_0x2e4880[_0xc3f8('0xd')],_0x2f589d['id']),'method':_0xc3f8('0x25'),'body':_0xaa4c98});}exports[_0xc3f8('0x44')]=function(_0x3e98b2,_0x465547,_0x3113b4,_0x45e6ea,_0x13d8dc,_0x34bccd){var _0x51dd7f,_0x5f4809;_0x34bccd[_0xc3f8('0xd')]=intUtil[_0xc3f8('0x45')](_0x34bccd['remoteUri']);_0x34bccd[_0xc3f8('0x46')]=intUtil[_0xc3f8('0x45')](_0x34bccd['serverUrl']);if(_0x13d8dc&&_0x13d8dc[_0xc3f8('0x47')]){logger[_0xc3f8('0xa')](_0xc3f8('0x48'),_0xc3f8('0x49'));_0x465547[_0xc3f8('0x4a')]=util[_0xc3f8('0xb')](_0xc3f8('0x4b'),_0x34bccd[_0xc3f8('0x46')],_0x465547[_0xc3f8('0x4c')],md5(_0x465547[_0xc3f8('0x4c')]));}else{_0x465547[_0xc3f8('0x4a')]='';}headers['Authorization']=getAuth(_0x34bccd);return getUser(_0x34bccd,_0x45e6ea[_0xc3f8('0x4d')])[_0xc3f8('0xe')](function(_0x589bb5){_0x51dd7f=_0x589bb5;logger[_0xc3f8('0xa')](_0xc3f8('0x4e'),_0x51dd7f['id']);return getEndUser(_0x34bccd,_0x465547[_0xc3f8('0x4f')],_0x465547[_0xc3f8('0x50')]);})['then'](function(_0x4d80e4){_0x5f4809=_0x4d80e4;logger[_0xc3f8('0xa')](_0xc3f8('0x51'),_0x5f4809['id']);return getTicket(_0x34bccd,_0x51dd7f,_0x5f4809,_0x3113b4,_0x465547);})[_0xc3f8('0xe')](function(_0x5c08a9){if(_0x5c08a9){logger[_0xc3f8('0xa')](_0xc3f8('0x52'));logger[_0xc3f8('0xa')](_0xc3f8('0x53'),_0x5c08a9['id']);switch(_0x34bccd[_0xc3f8('0x2d')]){case'integrationTab':logger[_0xc3f8('0xa')](_0xc3f8('0x48'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xc3f8('0xb')](_0xc3f8('0x54'),_0x45e6ea[_0xc3f8('0x35')]),_0xc3f8('0x55'),{'recordId':_0x5c08a9['id']});break;case _0xc3f8('0x56'):logger[_0xc3f8('0xa')](_0xc3f8('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc3f8('0xb')](_0xc3f8('0x54'),_0x45e6ea['name']),_0xc3f8('0x57'),{'uri':util[_0xc3f8('0xb')](_0xc3f8('0x58'),_0x5c08a9['id'])});break;default:logger[_0xc3f8('0x59')](_0xc3f8('0x48'),_0xc3f8('0x5a'));}}})[_0xc3f8('0x5b')](function(_0x4d58b2){console[_0xc3f8('0x59')](_0x4d58b2);logger[_0xc3f8('0x59')](_0xc3f8('0x48'),JSON[_0xc3f8('0x5c')](_0x4d58b2));});};exports[_0xc3f8('0x5d')]=function(_0x3d752a,_0x97a88e,_0x920f4b,_0x4fc02c,_0x51249a,_0x30cec2,_0x206a57){var _0x47fa71,_0x544947;_0x30cec2[_0xc3f8('0xd')]=intUtil['stripTrailingSlash'](_0x30cec2[_0xc3f8('0xd')]);_0x30cec2[_0xc3f8('0x46')]=intUtil[_0xc3f8('0x45')](_0x30cec2['serverUrl']);if(_0x206a57&&_0x206a57[_0xc3f8('0x5e')]&&_0x206a57['recordingFormat']!=='none'){logger[_0xc3f8('0xa')]('[OUTBOUND]',_0xc3f8('0x49'));_0x97a88e[_0xc3f8('0x4a')]=util[_0xc3f8('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30cec2[_0xc3f8('0x46')],_0x97a88e[_0xc3f8('0x4c')],md5(_0x97a88e[_0xc3f8('0x4c')]));}headers[_0xc3f8('0x5f')]=getAuth(_0x30cec2);return getUser(_0x30cec2,_0x4fc02c[_0xc3f8('0x4d')])['then'](function(_0x5ced29){_0x47fa71=_0x5ced29;logger[_0xc3f8('0xa')](_0xc3f8('0x4e'),_0x47fa71['id']);return getEndUser(_0x30cec2,_0x97a88e[_0xc3f8('0x60')],_0x97a88e[_0xc3f8('0x61')]);})[_0xc3f8('0xe')](function(_0x5ef0f1){_0x544947=_0x5ef0f1;logger[_0xc3f8('0xa')]('The\x20Enduser\x20ID\x20is:',_0x544947['id']);return getTicket(_0x30cec2,_0x47fa71,_0x544947,_0x920f4b,_0x97a88e);})[_0xc3f8('0xe')](function(_0x337029){if(_0x337029){logger[_0xc3f8('0xa')](_0xc3f8('0x52'));logger['info'](_0xc3f8('0x53'),_0x337029['id']);switch(_0x30cec2['type']){case'integrationTab':logger['info']('[QUEUE]',_0xc3f8('0x62'));emit(util[_0xc3f8('0xb')](_0xc3f8('0x54'),_0x4fc02c[_0xc3f8('0x35')]),_0xc3f8('0x55'),{'recordId':_0x337029['id']});break;case _0xc3f8('0x56'):logger[_0xc3f8('0xa')](_0xc3f8('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc3f8('0xb')](_0xc3f8('0x54'),_0x4fc02c[_0xc3f8('0x35')]),_0xc3f8('0x57'),{'uri':util[_0xc3f8('0xb')]('%s/agent/tickets/%s',_0x30cec2[_0xc3f8('0xd')],_0x337029['id'])});break;default:logger[_0xc3f8('0x59')](_0xc3f8('0x63'),_0xc3f8('0x5a'));}}})[_0xc3f8('0x5b')](function(_0x55ed7a){logger[_0xc3f8('0x59')](_0xc3f8('0x63'),JSON[_0xc3f8('0x5c')](_0x55ed7a));});};exports[_0xc3f8('0x64')]=function(_0x3a7702,_0x284216,_0x56fd61,_0x2f199d,_0x4ca426,_0x9c7956){var _0x5e3f96,_0x20cebe;_0x9c7956[_0xc3f8('0xd')]=intUtil['stripTrailingSlash'](_0x9c7956['remoteUri']);_0x9c7956[_0xc3f8('0x46')]=intUtil[_0xc3f8('0x45')](_0x9c7956['serverUrl']);if(_0x4ca426&&_0x4ca426[_0xc3f8('0x47')]){logger[_0xc3f8('0xa')](_0xc3f8('0x65'),_0xc3f8('0x49'));_0x284216[_0xc3f8('0x4a')]=util[_0xc3f8('0xb')](_0xc3f8('0x4b'),_0x9c7956[_0xc3f8('0x46')],_0x284216['uniqueid'],md5(_0x284216['uniqueid']));}else{_0x284216[_0xc3f8('0x4a')]='';}headers['Authorization']=getAuth(_0x9c7956);return getUser(_0x9c7956)['then'](function(_0x4a8a41){_0x5e3f96=_0x4a8a41;logger['info']('The\x20User\x20ID\x20is:',_0x5e3f96['id']);return getEndUser(_0x9c7956,_0x284216[_0xc3f8('0x4f')],_0x284216[_0xc3f8('0x50')]);})[_0xc3f8('0xe')](function(_0x1a34fd){_0x20cebe=_0x1a34fd;logger['info'](_0xc3f8('0x51'),_0x20cebe['id']);return getTicket(_0x9c7956,_0x5e3f96,_0x20cebe,_0x56fd61,_0x284216);})[_0xc3f8('0xe')](function(_0x5d6208){if(_0x5d6208){logger[_0xc3f8('0xa')](_0xc3f8('0x52'));logger[_0xc3f8('0xa')]('The\x20Ticket\x20ID\x20is:',_0x5d6208['id']);}})[_0xc3f8('0x5b')](function(_0x5e3125){logger['error']('[ABANDONED]',JSON[_0xc3f8('0x5c')](_0x5e3125));});}; \ 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 d3403e7..a76a104 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 _0xb6c3=['md5','ioredis','../../../../config/environment','socket.io-emitter','redis','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','catch','message','destcalleridnum','calleridnum','contacts','/systemusers(','headers','odata-entityid','substring','enduserId','contacts?$select=telephone1','outbound','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','type','customField','toLowerCase','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','callDirection','queue','lastIndexOf','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','abandoned','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util'];(function(_0x540c20,_0x196525){var _0x304213=function(_0x172b5e){while(--_0x172b5e){_0x540c20['push'](_0x540c20['shift']());}};_0x304213(++_0x196525);}(_0xb6c3,0x187));var _0x3b6c=function(_0x35a765,_0x493f14){_0x35a765=_0x35a765-0x0;var _0x1e4cec=_0xb6c3[_0x35a765];return _0x1e4cec;};'use strict';var _=require(_0x3b6c('0x0'));var BPromise=require(_0x3b6c('0x1'));var rp=require(_0x3b6c('0x2'));var util=require(_0x3b6c('0x3'));var intUtil=require(_0x3b6c('0x4'));var md5=require(_0x3b6c('0x5'));var Redis=require(_0x3b6c('0x6'));var logger=require('../../../../config/logger')('dynamics365');var config=require(_0x3b6c('0x7'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3b6c('0x8'))(new Redis(config[_0x3b6c('0x9')]));function getAuthToken(_0x241abd,_0x5307e2,_0x193b3e){var _0x21a771={'method':_0x3b6c('0xa'),'uri':_0x5307e2,'form':{'client_id':_0x241abd[_0x3b6c('0xb')],'resource':_0x241abd[_0x3b6c('0xc')],'username':_0x241abd[_0x3b6c('0xd')],'password':_0x241abd['password'],'grant_type':_0x3b6c('0xe'),'client_secret':_0x241abd[_0x3b6c('0xf')]},'json':!![]};return rp(_0x21a771)[_0x3b6c('0x10')](function(_0x1e1184){return _0x1e1184[_0x3b6c('0x11')];})['catch'](function(_0x2c0c0a){logger[_0x3b6c('0x12')]('['+[_0x193b3e[_0x3b6c('0x13')]()]+_0x3b6c('0x14'));return _0x2c0c0a['message'];});}function getUser(_0xe92a8e,_0x994f03,_0x34ef8d,_0x27781c,_0x1bbcb9,_0x40675c){return new BPromise(function(_0x28688a,_0x5a39ea){return getAuthToken(_0x994f03,_0x27781c,_0x40675c)[_0x3b6c('0x10')](function(_0x35abc7){var _0x339c50={'method':_0x3b6c('0x15'),'uri':_0x1bbcb9+_0x3b6c('0x16'),'headers':{'Authorization':_0x3b6c('0x17')+_0x35abc7,'OData-Version':_0x3b6c('0x18')},'json':!![]};return rp(_0x339c50);})[_0x3b6c('0x10')](function(_0x4eadcc){var _0x40d59f=_0x4eadcc[_0x3b6c('0x19')];var _0x21cc72=![];var _0x174ad2=null;if(!_[_0x3b6c('0x1a')](_0x34ef8d)){if(intUtil[_0x3b6c('0x1b')](_0x34ef8d[_0x3b6c('0x1c')])){_0xe92a8e[_0x3b6c('0x1d')]=_0x34ef8d[_0x3b6c('0x1c')];for(_0x174ad2=0x0;_0x174ad2<_0x40d59f[_0x3b6c('0x1e')];_0x174ad2++){if(_0x40d59f[_0x174ad2][_0x3b6c('0x1f')]===_0x34ef8d[_0x3b6c('0x1c')]&&!_0x40d59f[_0x174ad2][_0x3b6c('0x20')]){_0x21cc72=!![];logger[_0x3b6c('0x21')]('['+[_0x40675c['toUpperCase']()]+_0x3b6c('0x22')+_0x40d59f[_0x174ad2][_0x3b6c('0x23')]+'!');_0xe92a8e[_0x3b6c('0x24')]=_0x40d59f[_0x174ad2][_0x3b6c('0x23')];}}}}if(!_0x21cc72){logger[_0x3b6c('0x21')]('['+[_0x40675c[_0x3b6c('0x13')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0xe92a8e[_0x3b6c('0x1d')]=_0x994f03[_0x3b6c('0xd')];for(_0x174ad2=0x0;_0x174ad2<_0x40d59f[_0x3b6c('0x1e')];_0x174ad2++){if(_0x40d59f[_0x174ad2][_0x3b6c('0x1f')]===_0x994f03[_0x3b6c('0xd')]){_0xe92a8e[_0x3b6c('0x24')]=_0x40d59f[_0x174ad2][_0x3b6c('0x23')];}}}_0x28688a(_0xe92a8e);})[_0x3b6c('0x25')](function(_0x3ae7d6){_0x5a39ea(_0x3ae7d6[_0x3b6c('0x26')]);});});}function createEndUser(_0x45c225,_0x4072a4,_0x4e2416,_0x47407c,_0x5c3f7e,_0x57aade){return new BPromise(function(_0x509142,_0x114be8){return getAuthToken(_0x4072a4,_0x4e2416,_0x57aade)['then'](function(_0x4ea133){var _0x2e22aa=_0x57aade['toLowerCase']()==='outbound'?_0x5c3f7e[_0x3b6c('0x27')]:_0x5c3f7e[_0x3b6c('0x28')];var _0x3383bf={'method':_0x3b6c('0xa'),'uri':_0x47407c+_0x3b6c('0x29'),'body':{'telephone1':_0x2e22aa,'fullname':_0x2e22aa,'firstname':_0x2e22aa,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x3b6c('0x2a')+_0x45c225[_0x3b6c('0x24')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4ea133,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3383bf);})[_0x3b6c('0x10')](function(_0x9b1c5d){var _0x59c20c=_0x9b1c5d[_0x3b6c('0x2b')][_0x3b6c('0x2c')];var _0x1f49e8=_0x59c20c[_0x3b6c('0x2d')](_0x59c20c['lastIndexOf']('(')+0x1,_0x59c20c['lastIndexOf'](')'));_0x45c225[_0x3b6c('0x2e')]=_0x1f49e8;_0x509142(_0x45c225);})['catch'](function(_0x1ab0ba){_0x114be8(_0x1ab0ba[_0x3b6c('0x26')]);});});}function getEndUser(_0x19f699,_0x12c7fa,_0x2fd9f7,_0x43d9b1,_0x110f85,_0x552c59){return new BPromise(function(_0x10f32a,_0x37d2d6){return getAuthToken(_0x12c7fa,_0x2fd9f7,_0x552c59)[_0x3b6c('0x10')](function(_0x86c22d){var _0x53148c={'method':_0x3b6c('0x15'),'uri':_0x43d9b1+_0x3b6c('0x2f'),'headers':{'Authorization':_0x3b6c('0x17')+_0x86c22d,'If-None-Match':null,'OData-Version':_0x3b6c('0x18')},'json':!![]};return rp(_0x53148c);})[_0x3b6c('0x10')](function(_0x45e02d){var _0x112771=null;if(_0x45e02d){var _0x485008=_0x45e02d['value'];var _0x48e936=![];for(_0x112771=0x0;_0x112771<_0x485008['length'];_0x112771++){var _0x28c537=_0x552c59['toLowerCase']()===_0x3b6c('0x30')?_0x110f85['destcalleridnum']:_0x110f85[_0x3b6c('0x28')];if(_0x485008[_0x112771][_0x3b6c('0x31')]===_0x28c537){_0x48e936=!![];_0x19f699[_0x3b6c('0x2e')]=_0x485008[_0x112771][_0x3b6c('0x32')];}}if(_0x48e936){_0x10f32a(_0x19f699);}else{return createEndUser(_0x19f699,_0x12c7fa,_0x2fd9f7,_0x43d9b1,_0x110f85,_0x552c59)[_0x3b6c('0x10')](function(_0x486e20){logger['info']('['+[_0x552c59[_0x3b6c('0x13')]()]+_0x3b6c('0x33'),_0x486e20[_0x3b6c('0x2e')]);_0x10f32a(_0x486e20);});}}else{return createEndUser(_0x19f699,_0x12c7fa,_0x2fd9f7,_0x43d9b1,_0x110f85,_0x552c59)[_0x3b6c('0x10')](function(_0x5c296a){logger['info']('['+[_0x552c59['toUpperCase']()]+_0x3b6c('0x34'),_0x5c296a[_0x3b6c('0x2e')]);_0x10f32a(_0x5c296a);});}});});}function getCustomFields(_0x106068,_0x76f422,_0x5e1888){var _0xcb34b3={};if(_0x106068[_0x3b6c('0x1e')]>0x0){_['forEach'](_0x106068,function(_0x33dff4){if(_0x33dff4[_0x3b6c('0x35')]==='string'&&_0x33dff4['nameField']&&!_0x33dff4[_0x3b6c('0x36')]){var _0x427f85=_0x33dff4['idField'][_0x3b6c('0x37')]();var _0x3787a7=_0x427f85[_0x3b6c('0x2d')](0x0,_0x427f85[_0x3b6c('0x38')]('_'));var _0x2b32a4=_0x427f85[_0x3b6c('0x2d')](_0x427f85[_0x3b6c('0x38')]('_')+0x1);if(_0x3787a7===_0x5e1888){_0xcb34b3[_0x2b32a4]=_0x33dff4[_0x3b6c('0x39')];}}});}return _0xcb34b3;}function getTicket(_0x1748d6,_0x1f2334,_0xacc7f,_0xd70203,_0x3d7f1f,_0x4c9ef7,_0x3cdaae){return new BPromise(function(_0xe0e60c,_0x440e43){var _0x4730c9;return getAuthToken(_0x1f2334,_0xacc7f,_0x3cdaae)[_0x3b6c('0x10')](function(_0x5975b1){if(_0x4c9ef7[_0x3b6c('0x3a')]===_0x3b6c('0x3b')){_0x4730c9={'method':_0x3b6c('0xa'),'uri':_0xd70203+_0x3b6c('0x3c'),'body':Object[_0x3b6c('0x3d')]({},{'title':intUtil[_0x3b6c('0x3e')](_0x4c9ef7[_0x3b6c('0x3f')],_0x3d7f1f,'\x20'),'description':intUtil['getString'](_0x4c9ef7[_0x3b6c('0x40')],_0x3d7f1f,'\x0a'),'customerid_contact@odata.bind':_0x3b6c('0x41')+_0x1748d6[_0x3b6c('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x1748d6['userId']+')','caseorigincode':'1'},getCustomFields(_0x4c9ef7[_0x3b6c('0x42')],_0x3d7f1f,_0x4c9ef7[_0x3b6c('0x3a')])),'headers':{'Authorization':_0x3b6c('0x17')+_0x5975b1,'OData-Version':_0x3b6c('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4c9ef7['ticketType']===_0x3b6c('0x43')){_0x4730c9={'method':_0x3b6c('0xa'),'uri':_0xd70203+'phonecalls','body':Object['assign']({},{'subject':intUtil['getString'](_0x4c9ef7[_0x3b6c('0x3f')],_0x3d7f1f,'\x20'),'phonenumber':String(_0x3d7f1f[_0x3b6c('0x28')]),'description':intUtil[_0x3b6c('0x3e')](_0x4c9ef7[_0x3b6c('0x40')],_0x3d7f1f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3b6c('0x41')+_0x1748d6[_0x3b6c('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x1748d6[_0x3b6c('0x24')]+')','directioncode':_0x1748d6[_0x3b6c('0x44')]===_0x3b6c('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x3b6c('0x2a')+_0x1748d6[_0x3b6c('0x24')]+')','participationtypemask':_0x1748d6['callDirection']===_0x3b6c('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0x3b6c('0x41')+_0x1748d6['enduserId']+')','participationtypemask':_0x1748d6[_0x3b6c('0x44')]==='queue'?0x1:0x2}]},getCustomFields(_0x4c9ef7['Fields'],_0x3d7f1f,_0x4c9ef7[_0x3b6c('0x3a')])),'headers':{'Authorization':_0x3b6c('0x17')+_0x5975b1,'OData-Version':_0x3b6c('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4730c9);})[_0x3b6c('0x10')](function(_0x419cbb){var _0xd87822=_0x419cbb[_0x3b6c('0x2b')][_0x3b6c('0x2c')];var _0x21dbba=_0xd87822['substring'](_0xd87822[_0x3b6c('0x46')]('(')+0x1,_0xd87822[_0x3b6c('0x46')](')'));_0x1748d6['ticketId']=_0x21dbba;_0xe0e60c(_0x1748d6);})[_0x3b6c('0x25')](function(_0x4e7eb9){_0x440e43(_0x4e7eb9[_0x3b6c('0x26')]);});});}function emit(_0x4ab9b9,_0x1d7d9d,_0x692082,_0x1acb51){var _0x975e27={'uri':util[_0x3b6c('0x47')](_0x3b6c('0x48'),_0x4ab9b9,_0x692082,_0x1acb51)};io['to'](util['format'](_0x3b6c('0x49'),_0x1d7d9d))[_0x3b6c('0x4a')]('trigger:browser:url',_0x975e27);}exports['cs']=function(_0x283fa5,_0x38a332,_0x103219,_0x4c36f4,_0x4ae00a,_0xfc0071,_0x4b400e,_0x254e3b){var _0x5ec310={};_0xfc0071['remoteUri']=intUtil[_0x3b6c('0x4b')](_0xfc0071['remoteUri']);_0xfc0071['serverUrl']=intUtil[_0x3b6c('0x4b')](_0xfc0071[_0x3b6c('0x4c')]);_0x5ec310['callDirection']=_0x254e3b==='queue'||_0x254e3b==='abandoned'?_0x3b6c('0x45'):_0x3b6c('0x30');var _0x2f4c94=util['format'](_0x3b6c('0x4d'),_0xfc0071[_0x3b6c('0xc')]);var _0x3e94af=util[_0x3b6c('0x47')](_0x3b6c('0x4e'),_0xfc0071[_0x3b6c('0x4f')]);var _0x4f0f1f=util[_0x3b6c('0x47')](_0x3b6c('0x50'),_0xfc0071[_0x3b6c('0x4c')],_0x38a332[_0x3b6c('0x51')],md5(_0x38a332[_0x3b6c('0x51')]));if(_0x4ae00a&&_0x4ae00a[_0x3b6c('0x52')]){logger[_0x3b6c('0x21')](_0x3b6c('0x53'),_0x3b6c('0x54'));_0x38a332[_0x3b6c('0x55')]=_0x4f0f1f;}else if(_0x4b400e&&_0x4b400e[_0x3b6c('0x56')]&&_0x4b400e[_0x3b6c('0x56')]!=='none'){logger[_0x3b6c('0x21')](_0x3b6c('0x57'),_0x3b6c('0x54'));_0x38a332[_0x3b6c('0x55')]=_0x4f0f1f;}else{_0x38a332[_0x3b6c('0x55')]='';}return getUser(_0x5ec310,_0xfc0071,_0x4c36f4,_0x3e94af,_0x2f4c94,_0x254e3b)[_0x3b6c('0x10')](function(_0x340cf6){logger[_0x3b6c('0x21')]('['+_0x254e3b[_0x3b6c('0x13')]()+_0x3b6c('0x58'),_0x340cf6[_0x3b6c('0x24')]);logger[_0x3b6c('0x21')]('['+_0x254e3b[_0x3b6c('0x13')]()+_0x3b6c('0x59'),_0x340cf6[_0x3b6c('0x1d')]);return getEndUser(_0x340cf6,_0xfc0071,_0x3e94af,_0x2f4c94,_0x38a332,_0x254e3b);})[_0x3b6c('0x10')](function(_0x284cf4){logger[_0x3b6c('0x21')]('['+_0x254e3b[_0x3b6c('0x13')]()+_0x3b6c('0x5a'),_0x284cf4[_0x3b6c('0x2e')]);logger[_0x3b6c('0x21')]('['+_0x254e3b['toUpperCase']()+_0x3b6c('0x5b'),_0x38a332[_0x3b6c('0x28')]);return getTicket(_0x284cf4,_0xfc0071,_0x3e94af,_0x2f4c94,_0x38a332,_0x103219,_0x254e3b);})[_0x3b6c('0x10')](function(_0x41af19){logger['info'](util['format']('['+_0x254e3b['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x103219[_0x3b6c('0x3a')],_0x41af19['ticketId']));logger['info'](util[_0x3b6c('0x47')]('['+_0x254e3b[_0x3b6c('0x13')]()+_0x3b6c('0x5c'),_0x254e3b));if(_0x254e3b!==_0x3b6c('0x5d')){logger[_0x3b6c('0x21')]('['+_0x254e3b['toUpperCase']()+']',_0x3b6c('0x5e'));emit(_0xfc0071[_0x3b6c('0xc')],_0x4c36f4[_0x3b6c('0x5f')],_0x103219['ticketType'],_0x41af19[_0x3b6c('0x60')]);}})[_0x3b6c('0x25')](function(_0x99a893){logger[_0x3b6c('0x12')]('['+_0x254e3b[_0x3b6c('0x13')]()+_0x3b6c('0x61'),util[_0x3b6c('0x62')](_0x99a893,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xafa2=['length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','destcalleridnum','calleridnum','contacts','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','toLowerCase','contactid',']\x20Enduser\x20Created!','forEach','type','string','customField','idField','indexOf','ticketType','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','/systemusers(','callDirection','queue','headers','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','abandoned','format','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','name','lodash','request-promise','util','./util','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail'];(function(_0x386f75,_0x3037ff){var _0x1d6561=function(_0x320eaa){while(--_0x320eaa){_0x386f75['push'](_0x386f75['shift']());}};_0x1d6561(++_0x3037ff);}(_0xafa2,0xfb));var _0x2afa=function(_0x2d7a10,_0x3af428){_0x2d7a10=_0x2d7a10-0x0;var _0x469308=_0xafa2[_0x2d7a10];return _0x469308;};'use strict';var _=require(_0x2afa('0x0'));var BPromise=require('bluebird');var rp=require(_0x2afa('0x1'));var util=require(_0x2afa('0x2'));var intUtil=require(_0x2afa('0x3'));var md5=require('md5');var Redis=require(_0x2afa('0x4'));var logger=require(_0x2afa('0x5'))('dynamics365');var config=require(_0x2afa('0x6'));config[_0x2afa('0x7')]=_[_0x2afa('0x8')](config[_0x2afa('0x7')],{'host':_0x2afa('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2afa('0x7')]));function getAuthToken(_0x46c546,_0x3d467c,_0x11e70c){var _0x3c12b2={'method':_0x2afa('0xa'),'uri':_0x3d467c,'form':{'client_id':_0x46c546[_0x2afa('0xb')],'resource':_0x46c546['remoteUri'],'username':_0x46c546[_0x2afa('0xc')],'password':_0x46c546[_0x2afa('0xd')],'grant_type':'password','client_secret':_0x46c546[_0x2afa('0xe')]},'json':!![]};return rp(_0x3c12b2)[_0x2afa('0xf')](function(_0x58bb03){return _0x58bb03[_0x2afa('0x10')];})[_0x2afa('0x11')](function(_0x467bcc){logger[_0x2afa('0x12')]('['+[_0x11e70c[_0x2afa('0x13')]()]+_0x2afa('0x14'));return _0x467bcc[_0x2afa('0x15')];});}function getUser(_0xc8c402,_0x25a645,_0x52d3cf,_0x4cafb4,_0x51d93a,_0x1193fc){return new BPromise(function(_0x2a549a,_0x1e38e7){return getAuthToken(_0x25a645,_0x4cafb4,_0x1193fc)[_0x2afa('0xf')](function(_0x6cc9ee){var _0x52d3c3={'method':_0x2afa('0x16'),'uri':_0x51d93a+_0x2afa('0x17'),'headers':{'Authorization':_0x2afa('0x18')+_0x6cc9ee,'OData-Version':_0x2afa('0x19')},'json':!![]};return rp(_0x52d3c3);})[_0x2afa('0xf')](function(_0x3f99dc){var _0x10c682=_0x3f99dc[_0x2afa('0x1a')];var _0x7a5d9=![];var _0x2d317e=null;if(!_[_0x2afa('0x1b')](_0x52d3cf)){if(intUtil[_0x2afa('0x1c')](_0x52d3cf[_0x2afa('0x1d')])){_0xc8c402[_0x2afa('0x1e')]=_0x52d3cf[_0x2afa('0x1d')];for(_0x2d317e=0x0;_0x2d317e<_0x10c682[_0x2afa('0x1f')];_0x2d317e++){if(_0x10c682[_0x2d317e][_0x2afa('0x20')]===_0x52d3cf[_0x2afa('0x1d')]&&!_0x10c682[_0x2d317e][_0x2afa('0x21')]){_0x7a5d9=!![];logger[_0x2afa('0x22')]('['+[_0x1193fc['toUpperCase']()]+_0x2afa('0x23')+_0x10c682[_0x2d317e][_0x2afa('0x24')]+'!');_0xc8c402[_0x2afa('0x25')]=_0x10c682[_0x2d317e][_0x2afa('0x24')];}}}}if(!_0x7a5d9){logger[_0x2afa('0x22')]('['+[_0x1193fc[_0x2afa('0x13')]()]+_0x2afa('0x26'));_0xc8c402[_0x2afa('0x1e')]=_0x25a645['username'];for(_0x2d317e=0x0;_0x2d317e<_0x10c682[_0x2afa('0x1f')];_0x2d317e++){if(_0x10c682[_0x2d317e][_0x2afa('0x20')]===_0x25a645['username']){_0xc8c402['userId']=_0x10c682[_0x2d317e][_0x2afa('0x24')];}}}_0x2a549a(_0xc8c402);})['catch'](function(_0x50a0a4){_0x1e38e7(_0x50a0a4['message']);});});}function createEndUser(_0x29b66a,_0x3e7a9a,_0x3c0b27,_0x19de16,_0x4bb529,_0x5c14fa){return new BPromise(function(_0x287ade,_0x13a8c2){return getAuthToken(_0x3e7a9a,_0x3c0b27,_0x5c14fa)[_0x2afa('0xf')](function(_0xb15a46){var _0x1f3f56=_0x5c14fa['toLowerCase']()===_0x2afa('0x27')?_0x4bb529[_0x2afa('0x28')]:_0x4bb529[_0x2afa('0x29')];var _0x53343e={'method':'POST','uri':_0x19de16+_0x2afa('0x2a'),'body':{'telephone1':_0x1f3f56,'fullname':_0x1f3f56,'firstname':_0x1f3f56,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x29b66a[_0x2afa('0x25')]+')'},'headers':{'Authorization':_0x2afa('0x18')+_0xb15a46,'OData-Version':_0x2afa('0x19')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x53343e);})[_0x2afa('0xf')](function(_0x4b2363){var _0x5b6263=_0x4b2363['headers'][_0x2afa('0x2b')];var _0x873831=_0x5b6263[_0x2afa('0x2c')](_0x5b6263[_0x2afa('0x2d')]('(')+0x1,_0x5b6263[_0x2afa('0x2d')](')'));_0x29b66a[_0x2afa('0x2e')]=_0x873831;_0x287ade(_0x29b66a);})['catch'](function(_0x1e1ea5){_0x13a8c2(_0x1e1ea5[_0x2afa('0x15')]);});});}function getEndUser(_0x2c24bd,_0x1ca864,_0xb5b56b,_0x1dc66f,_0x12924b,_0x1ee618){return new BPromise(function(_0x4ec60d,_0x313892){return getAuthToken(_0x1ca864,_0xb5b56b,_0x1ee618)[_0x2afa('0xf')](function(_0x1a3b77){var _0x227f46={'method':_0x2afa('0x16'),'uri':_0x1dc66f+_0x2afa('0x2f'),'headers':{'Authorization':'Bearer\x20'+_0x1a3b77,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x227f46);})[_0x2afa('0xf')](function(_0x23d860){var _0x49d843=null;if(_0x23d860){var _0x4bf0f4=_0x23d860[_0x2afa('0x1a')];var _0x142fa1=![];for(_0x49d843=0x0;_0x49d843<_0x4bf0f4[_0x2afa('0x1f')];_0x49d843++){var _0x35ecdd=_0x1ee618[_0x2afa('0x30')]()===_0x2afa('0x27')?_0x12924b[_0x2afa('0x28')]:_0x12924b[_0x2afa('0x29')];if(_0x4bf0f4[_0x49d843]['telephone1']===_0x35ecdd){_0x142fa1=!![];_0x2c24bd[_0x2afa('0x2e')]=_0x4bf0f4[_0x49d843][_0x2afa('0x31')];}}if(_0x142fa1){_0x4ec60d(_0x2c24bd);}else{return createEndUser(_0x2c24bd,_0x1ca864,_0xb5b56b,_0x1dc66f,_0x12924b,_0x1ee618)['then'](function(_0x29c0bd){logger['info']('['+[_0x1ee618['toUpperCase']()]+']\x20Enduser\x20created!',_0x29c0bd[_0x2afa('0x2e')]);_0x4ec60d(_0x29c0bd);});}}else{return createEndUser(_0x2c24bd,_0x1ca864,_0xb5b56b,_0x1dc66f,_0x12924b,_0x1ee618)['then'](function(_0x34bbdd){logger[_0x2afa('0x22')]('['+[_0x1ee618[_0x2afa('0x13')]()]+_0x2afa('0x32'),_0x34bbdd[_0x2afa('0x2e')]);_0x4ec60d(_0x34bbdd);});}});});}function getCustomFields(_0xbb8844,_0x2cc934,_0x45d6f4){var _0x1805d9={};if(_0xbb8844[_0x2afa('0x1f')]>0x0){_[_0x2afa('0x33')](_0xbb8844,function(_0xfd6ff0){if(_0xfd6ff0[_0x2afa('0x34')]===_0x2afa('0x35')&&_0xfd6ff0['nameField']&&!_0xfd6ff0[_0x2afa('0x36')]){var _0x28326d=_0xfd6ff0[_0x2afa('0x37')][_0x2afa('0x30')]();var _0x3b7f63=_0x28326d['substring'](0x0,_0x28326d['indexOf']('_'));var _0x783792=_0x28326d[_0x2afa('0x2c')](_0x28326d[_0x2afa('0x38')]('_')+0x1);if(_0x3b7f63===_0x45d6f4){_0x1805d9[_0x783792]=_0xfd6ff0['content'];}}});}return _0x1805d9;}function getTicket(_0x108fef,_0x55190d,_0x5597bc,_0xfd730,_0x208850,_0x37eb08,_0x422e11){return new BPromise(function(_0x4bec4a,_0x2763a){var _0x258299;return getAuthToken(_0x55190d,_0x5597bc,_0x422e11)[_0x2afa('0xf')](function(_0x266f5b){if(_0x37eb08[_0x2afa('0x39')]==='incident'){_0x258299={'method':_0x2afa('0xa'),'uri':_0xfd730+_0x2afa('0x3a'),'body':Object[_0x2afa('0x3b')]({},{'title':intUtil[_0x2afa('0x3c')](_0x37eb08[_0x2afa('0x3d')],_0x208850,'\x20'),'description':intUtil[_0x2afa('0x3c')](_0x37eb08[_0x2afa('0x3e')],_0x208850,'\x0a'),'customerid_contact@odata.bind':_0x2afa('0x3f')+_0x108fef[_0x2afa('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x108fef[_0x2afa('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x37eb08[_0x2afa('0x40')],_0x208850,_0x37eb08[_0x2afa('0x39')])),'headers':{'Authorization':'Bearer\x20'+_0x266f5b,'OData-Version':_0x2afa('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x37eb08[_0x2afa('0x39')]===_0x2afa('0x41')){_0x258299={'method':_0x2afa('0xa'),'uri':_0xfd730+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x2afa('0x3c')](_0x37eb08[_0x2afa('0x3d')],_0x208850,'\x20'),'phonenumber':String(_0x208850['calleridnum']),'description':intUtil[_0x2afa('0x3c')](_0x37eb08[_0x2afa('0x3e')],_0x208850,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2afa('0x3f')+_0x108fef[_0x2afa('0x2e')]+')','ownerid@odata.bind':_0x2afa('0x42')+_0x108fef[_0x2afa('0x25')]+')','directioncode':_0x108fef[_0x2afa('0x43')]===_0x2afa('0x44')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x108fef[_0x2afa('0x25')]+')','participationtypemask':_0x108fef[_0x2afa('0x43')]===_0x2afa('0x44')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x108fef['enduserId']+')','participationtypemask':_0x108fef[_0x2afa('0x43')]===_0x2afa('0x44')?0x1:0x2}]},getCustomFields(_0x37eb08[_0x2afa('0x40')],_0x208850,_0x37eb08[_0x2afa('0x39')])),'headers':{'Authorization':_0x2afa('0x18')+_0x266f5b,'OData-Version':_0x2afa('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x258299);})[_0x2afa('0xf')](function(_0x545362){var _0x94f995=_0x545362[_0x2afa('0x45')]['odata-entityid'];var _0x2c9f8b=_0x94f995['substring'](_0x94f995[_0x2afa('0x2d')]('(')+0x1,_0x94f995['lastIndexOf'](')'));_0x108fef['ticketId']=_0x2c9f8b;_0x4bec4a(_0x108fef);})[_0x2afa('0x11')](function(_0x2384cc){_0x2763a(_0x2384cc[_0x2afa('0x15')]);});});}function emit(_0x289839,_0x413a30,_0x32eb9e,_0x51d0e4){var _0x589bcd={'uri':util['format'](_0x2afa('0x46'),_0x289839,_0x32eb9e,_0x51d0e4)};io['to'](util['format'](_0x2afa('0x47'),_0x413a30))[_0x2afa('0x48')](_0x2afa('0x49'),_0x589bcd);}exports['cs']=function(_0x3f6dab,_0x3b95fd,_0x46edf3,_0x2411df,_0x391058,_0x3084f9,_0x4f2691,_0x290572){var _0x21f656={};_0x3084f9[_0x2afa('0x4a')]=intUtil[_0x2afa('0x4b')](_0x3084f9[_0x2afa('0x4a')]);_0x3084f9[_0x2afa('0x4c')]=intUtil[_0x2afa('0x4b')](_0x3084f9['serverUrl']);_0x21f656[_0x2afa('0x43')]=_0x290572===_0x2afa('0x44')||_0x290572===_0x2afa('0x4d')?'queue':'outbound';var _0x3c7c64=util[_0x2afa('0x4e')]('%s/api/data/v9.0/',_0x3084f9[_0x2afa('0x4a')]);var _0x31bebe=util[_0x2afa('0x4e')](_0x2afa('0x4f'),_0x3084f9['tenantId']);var _0x6f1b21=util['format'](_0x2afa('0x50'),_0x3084f9[_0x2afa('0x4c')],_0x3b95fd[_0x2afa('0x51')],md5(_0x3b95fd[_0x2afa('0x51')]));if(_0x391058&&_0x391058[_0x2afa('0x52')]){logger[_0x2afa('0x22')](_0x2afa('0x53'),_0x2afa('0x54'));_0x3b95fd[_0x2afa('0x55')]=_0x6f1b21;}else if(_0x4f2691&&_0x4f2691[_0x2afa('0x56')]&&_0x4f2691[_0x2afa('0x56')]!==_0x2afa('0x57')){logger[_0x2afa('0x22')](_0x2afa('0x58'),_0x2afa('0x54'));_0x3b95fd['recordingURL']=_0x6f1b21;}else{_0x3b95fd[_0x2afa('0x55')]='';}return getUser(_0x21f656,_0x3084f9,_0x2411df,_0x31bebe,_0x3c7c64,_0x290572)[_0x2afa('0xf')](function(_0x2dab84){logger[_0x2afa('0x22')]('['+_0x290572[_0x2afa('0x13')]()+']\x20The\x20User\x20ID\x20is:',_0x2dab84['userId']);logger[_0x2afa('0x22')]('['+_0x290572[_0x2afa('0x13')]()+_0x2afa('0x59'),_0x2dab84[_0x2afa('0x1e')]);return getEndUser(_0x2dab84,_0x3084f9,_0x31bebe,_0x3c7c64,_0x3b95fd,_0x290572);})[_0x2afa('0xf')](function(_0xd0d464){logger[_0x2afa('0x22')]('['+_0x290572[_0x2afa('0x13')]()+_0x2afa('0x5a'),_0xd0d464[_0x2afa('0x2e')]);logger[_0x2afa('0x22')]('['+_0x290572[_0x2afa('0x13')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x3b95fd[_0x2afa('0x29')]);return getTicket(_0xd0d464,_0x3084f9,_0x31bebe,_0x3c7c64,_0x3b95fd,_0x46edf3,_0x290572);})[_0x2afa('0xf')](function(_0x32f9ae){logger[_0x2afa('0x22')](util['format']('['+_0x290572[_0x2afa('0x13')]()+_0x2afa('0x5b'),_0x46edf3[_0x2afa('0x39')],_0x32f9ae[_0x2afa('0x5c')]));logger['info'](util[_0x2afa('0x4e')]('['+_0x290572['toUpperCase']()+']\x20Call\x20direction:\x20%s',_0x290572));if(_0x290572!==_0x2afa('0x4d')){logger[_0x2afa('0x22')]('['+_0x290572[_0x2afa('0x13')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3084f9[_0x2afa('0x4a')],_0x2411df[_0x2afa('0x5d')],_0x46edf3[_0x2afa('0x39')],_0x32f9ae[_0x2afa('0x5c')]);}})['catch'](function(_0x47e5d6){logger['error']('['+_0x290572[_0x2afa('0x13')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x47e5d6,{'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 bd6ceab..bbfb3d8 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 _0x482b=['./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','Fields','custom_fields','mapValues','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','GET','map','forEach','type','string','nameField','toString','push','idField','variableName','customField','customVariable','Variable','name','toLowerCase','stripTrailingSlash','serverUrl','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','abandoned','[ABANDONED]','request-promise','md5','util','ioredis'];(function(_0x3c5163,_0xac9816){var _0x2943c=function(_0x5daca7){while(--_0x5daca7){_0x3c5163['push'](_0x3c5163['shift']());}};_0x2943c(++_0xac9816);}(_0x482b,0xac));var _0xb482=function(_0x23f55b,_0x18f6d8){_0x23f55b=_0x23f55b-0x0;var _0x3c9a5a=_0x482b[_0x23f55b];return _0x3c9a5a;};'use strict';var _=require('lodash');var rp=require(_0xb482('0x0'));var md5=require(_0xb482('0x1'));var util=require(_0xb482('0x2'));var Redis=require(_0xb482('0x3'));var intUtil=require(_0xb482('0x4'));var config=require(_0xb482('0x5'));var logger=require(_0xb482('0x6'))(_0xb482('0x7'));config[_0xb482('0x8')]=_[_0xb482('0x9')](config[_0xb482('0x8')],{'host':_0xb482('0xa'),'port':0x18eb});var io=require(_0xb482('0xb'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0xb482('0xc')};function emit(_0x189c53,_0x34ad62,_0x357acd){io['to'](_0x189c53)[_0xb482('0xd')](_0x34ad62,_0x357acd);}function getTicket(_0x483dd4,_0x298fba,_0x3c37f0,_0x3aa878,_0x3ece8c){logger[_0xb482('0xe')]('Creating\x20new\x20ticket...');var _0x123fa0=_[_0xb482('0xf')]({'responder_id':_0x298fba['id'],'requester_id':_0x3c37f0['id'],'name':util[_0xb482('0x10')](_0xb482('0x11'),_0x3ece8c[_0xb482('0x12')]),'phone':_0x3ece8c[_0xb482('0x13')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x3aa878['Subjects'],_0x3ece8c,'\x20'),'description':intUtil[_0xb482('0x14')](_0x3aa878[_0xb482('0x15')],_0x3ece8c,_0xb482('0x16')),'tags':getTags(_0x3aa878[_0xb482('0x17')],'name')},getCustomFields(_0x3aa878[_0xb482('0x18')],_0x3ece8c));_0x123fa0[_0xb482('0x19')]=_[_0xb482('0x1a')](_['keyBy'](_0x123fa0['custom_fields'],'id'),'value');return request({'uri':util[_0xb482('0x10')](_0xb482('0x1b'),_0x483dd4[_0xb482('0x1c')]),'method':_0xb482('0x1d'),'body':_0x123fa0})[_0xb482('0x1e')](function(_0x5b4571){logger[_0xb482('0xe')](_0xb482('0x1f'));return _0x5b4571;});}function getUser(_0xe6fedb,_0xa963b6){if(intUtil[_0xb482('0x20')](_0xa963b6)){return request({'uri':util[_0xb482('0x10')]('%s/api/v2/agents',_0xe6fedb[_0xb482('0x1c')]),'qs':{'email':_0xa963b6}})[_0xb482('0x1e')](function(_0x5a10ef){if(_0x5a10ef[_0xb482('0x21')]){logger['info'](_0xb482('0x22'));return _[_0xb482('0x23')](_0x5a10ef,function(_0x1c470f){return _0x1c470f[_0xb482('0x24')][_0xb482('0x25')]===_0xa963b6;});}else{logger[_0xb482('0xe')](_0xb482('0x26'));return request({'uri':util[_0xb482('0x10')]('%s/api/v2/agents/me',_0xe6fedb[_0xb482('0x1c')])})['then'](function(_0x5bd283){logger[_0xb482('0xe')](_0xb482('0x27'));return _0x5bd283;});}});}else{logger[_0xb482('0xe')](_0xb482('0x28'));return request({'uri':util['format']('%s/api/v2/agents/me',_0xe6fedb[_0xb482('0x1c')])})[_0xb482('0x1e')](function(_0x486790){logger['info'](_0xb482('0x27'));return _0x486790;});}}function getEndUser(_0x28c243,_0x33f287,_0x55c49a){logger[_0xb482('0xe')](_0xb482('0x29'),_0x55c49a);return request({'uri':util['format'](_0xb482('0x2a'),_0x28c243[_0xb482('0x1c')]),'qs':{'phone':_0x55c49a}})[_0xb482('0x1e')](function(_0x133147){if(_0x133147[_0xb482('0x21')]){logger[_0xb482('0xe')](_0xb482('0x2b'));return _[_0xb482('0x23')](_0x133147,{'phone':_0x55c49a});}else{logger[_0xb482('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xb482('0x10')](_0xb482('0x2a'),_0x28c243[_0xb482('0x1c')]),'method':_0xb482('0x1d'),'body':{'name':_0x33f287,'phone':_0x55c49a}})[_0xb482('0x1e')](function(_0x4aff3b){logger[_0xb482('0xe')]('Enduser\x20created.');return _0x4aff3b;});}});}function getAuth(_0xa2d676){return util[_0xb482('0x10')](_0xb482('0x2c'),new Buffer(_0xa2d676[_0xb482('0x2d')]+':X')['toString'](_0xb482('0x2e')));}function request(_0x5962db){logger[_0xb482('0x2f')](_0xb482('0x30'),JSON[_0xb482('0x31')](_0x5962db));return rp(_[_0xb482('0x9')](_0x5962db,{'method':_0xb482('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x1de8f1,_0x9f70af){var _0x2e72e6=[];if(_0x1de8f1&&_0x1de8f1['length']>0x0){_0x2e72e6=_[_0xb482('0x33')](_0x1de8f1,_0x9f70af);}return _0x2e72e6;}function getCustomFields(_0x4ec597,_0x303ee9){var _0x3c81f6=[];var _0x1c9f9a={'custom_fields':[]};if(_0x4ec597[_0xb482('0x21')]>0x0){_[_0xb482('0x34')](_0x4ec597,function(_0x579ce0){if(_0x579ce0[_0xb482('0x35')]===_0xb482('0x36')&&_0x579ce0[_0xb482('0x37')]&&!_0x579ce0['customField']){_0x1c9f9a[_0x579ce0['nameField']['toLowerCase']()]=_0x579ce0['content'][_0xb482('0x38')]();}else if(_0x579ce0[_0xb482('0x35')]===_0xb482('0x36')&&_0x579ce0['idField']&&_0x579ce0['customField']){_0x1c9f9a[_0xb482('0x19')][_0xb482('0x39')]({'id':_0x579ce0[_0xb482('0x3a')],'value':_0x579ce0['content']['toString']()});}else if(_0x579ce0[_0xb482('0x35')]==='variable'&&_0x579ce0[_0xb482('0x3b')]&&_0x579ce0[_0xb482('0x3a')]&&_0x579ce0[_0xb482('0x3c')]){_0x303ee9[_0x579ce0['variableName']]&&_0x1c9f9a[_0xb482('0x19')]['push']({'id':_0x579ce0[_0xb482('0x3a')],'value':_0x303ee9[_0x579ce0[_0xb482('0x3b')]][_0xb482('0x38')]()});}else if(_0x579ce0[_0xb482('0x35')]===_0xb482('0x3d')&&_0x579ce0[_0xb482('0x3e')]&&_0x579ce0['Variable'][_0xb482('0x3f')]&&_0x579ce0[_0xb482('0x3a')]&&_0x579ce0[_0xb482('0x3c')]){_0x303ee9[_0x579ce0['Variable'][_0xb482('0x3f')][_0xb482('0x40')]()]&&_0x1c9f9a[_0xb482('0x19')][_0xb482('0x39')]({'id':_0x579ce0[_0xb482('0x3a')],'value':_0x303ee9[_0x579ce0['Variable'][_0xb482('0x3f')][_0xb482('0x40')]()]['toString']()});}});}return _0x1c9f9a;}exports['queue']=function(_0x289218,_0x3b17b0,_0x2e1bc3,_0x39b339,_0x2bc17a,_0x10e1c8){var _0xb7245e,_0x5da482;_0x10e1c8['remoteUri']=intUtil[_0xb482('0x41')](_0x10e1c8[_0xb482('0x1c')]);_0x10e1c8[_0xb482('0x42')]=intUtil['stripTrailingSlash'](_0x10e1c8['serverUrl']);if(_0x2bc17a&&_0x2bc17a['monitor_format']){logger[_0xb482('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b17b0[_0xb482('0x43')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10e1c8[_0xb482('0x42')],_0x3b17b0[_0xb482('0x44')],md5(_0x3b17b0['uniqueid']));}else{_0x3b17b0[_0xb482('0x43')]='';}headers[_0xb482('0x45')]=getAuth(_0x10e1c8);return getUser(_0x10e1c8,_0x39b339['email'])[_0xb482('0x1e')](function(_0x5da154){_0xb7245e=_0x5da154;logger['info'](_0xb482('0x46'),_0xb7245e['id']);return getEndUser(_0x10e1c8,_0x3b17b0[_0xb482('0x12')],_0x3b17b0['calleridnum']);})[_0xb482('0x1e')](function(_0x439b52){_0x5da482=_0x439b52;logger[_0xb482('0xe')](_0xb482('0x47'),_0x5da482['id']);return getTicket(_0x10e1c8,_0xb7245e,_0x5da482,_0x2e1bc3,_0x3b17b0);})[_0xb482('0x1e')](function(_0x37a490){if(_0x37a490&&_0x37a490['id']){logger[_0xb482('0xe')](_0xb482('0x1f'));logger['info'](_0xb482('0x48'),_0x37a490['id']);logger[_0xb482('0xe')](_0xb482('0x49'),_0xb482('0x4a'));emit(util[_0xb482('0x10')](_0xb482('0x4b'),_0x39b339['name']),_0xb482('0x4c'),{'uri':util['format'](_0xb482('0x4d'),_0x10e1c8[_0xb482('0x1c')],_0x37a490['id'])});}})[_0xb482('0x4e')](function(_0x47a127){logger[_0xb482('0x4f')](_0xb482('0x49'),JSON[_0xb482('0x31')](_0x47a127));});};exports[_0xb482('0x50')]=function(_0x253263,_0x46307d,_0x23d14e,_0x44ec77,_0x5668d0,_0x3faf62,_0x58fc9d){var _0x13dff9,_0x5cf863;_0x3faf62[_0xb482('0x1c')]=intUtil[_0xb482('0x41')](_0x3faf62['remoteUri']);_0x3faf62[_0xb482('0x42')]=intUtil[_0xb482('0x41')](_0x3faf62[_0xb482('0x42')]);if(_0x58fc9d&&_0x58fc9d[_0xb482('0x51')]&&_0x58fc9d['recordingFormat']!==_0xb482('0x52')){logger['info'](_0xb482('0x53'),_0xb482('0x54'));_0x46307d[_0xb482('0x43')]=util[_0xb482('0x10')](_0xb482('0x55'),_0x3faf62[_0xb482('0x42')],_0x46307d[_0xb482('0x44')],md5(_0x46307d['uniqueid']));}headers[_0xb482('0x45')]=getAuth(_0x3faf62);return getUser(_0x3faf62,_0x44ec77[_0xb482('0x25')])[_0xb482('0x1e')](function(_0x172031){_0x13dff9=_0x172031;logger[_0xb482('0xe')]('The\x20User\x20ID\x20is:',_0x13dff9['id']);return getEndUser(_0x3faf62,_0x46307d['destcalleridname'],_0x46307d['destcalleridnum']);})[_0xb482('0x1e')](function(_0x33a72a){_0x5cf863=_0x33a72a;logger[_0xb482('0xe')](_0xb482('0x47'),_0x5cf863['id']);return getTicket(_0x3faf62,_0x13dff9,_0x5cf863,_0x23d14e,_0x46307d);})[_0xb482('0x1e')](function(_0x3bc849){if(_0x3bc849&&_0x3bc849['id']){logger[_0xb482('0xe')](_0xb482('0x1f'));logger['info'](_0xb482('0x48'),_0x3bc849['id']);logger['info']('[OUTBOUND]',_0xb482('0x4a'));emit(util[_0xb482('0x10')](_0xb482('0x4b'),_0x44ec77[_0xb482('0x3f')]),_0xb482('0x4c'),{'uri':util[_0xb482('0x10')](_0xb482('0x4d'),_0x3faf62[_0xb482('0x1c')],_0x3bc849['id'])});}})['catch'](function(_0x383c80){logger['error']('[OUTBOUND]',JSON['stringify'](_0x383c80));});};exports[_0xb482('0x56')]=function(_0x2db398,_0x3b832e,_0x54e592,_0xe6a1b6,_0x5c779f,_0x36de36){var _0x46b8a6,_0x3aafbf;_0x36de36[_0xb482('0x1c')]=intUtil['stripTrailingSlash'](_0x36de36['remoteUri']);_0x36de36[_0xb482('0x42')]=intUtil['stripTrailingSlash'](_0x36de36[_0xb482('0x42')]);if(_0x5c779f&&_0x5c779f['monitor_format']){logger[_0xb482('0xe')](_0xb482('0x57'),'Recording\x20is\x20enabled!');_0x3b832e[_0xb482('0x43')]=util[_0xb482('0x10')](_0xb482('0x55'),_0x36de36[_0xb482('0x42')],_0x3b832e['uniqueid'],md5(_0x3b832e[_0xb482('0x44')]));}else{_0x3b832e[_0xb482('0x43')]='';}headers['Authorization']=getAuth(_0x36de36);return getUser(_0x36de36,'')[_0xb482('0x1e')](function(_0x5889f0){_0x46b8a6=_0x5889f0;logger[_0xb482('0xe')](_0xb482('0x46'),_0x46b8a6['id']);return getEndUser(_0x36de36,_0x3b832e['calleridname'],_0x3b832e['calleridnum']);})[_0xb482('0x1e')](function(_0x22db2a){_0x3aafbf=_0x22db2a;logger[_0xb482('0xe')](_0xb482('0x47'),_0x3aafbf['id']);return getTicket(_0x36de36,_0x46b8a6,_0x3aafbf,_0x54e592,_0x3b832e);})['then'](function(_0x11450a){if(_0x11450a){logger[_0xb482('0xe')](_0xb482('0x1f'));logger[_0xb482('0xe')](_0xb482('0x48'),_0x11450a['id']);}})[_0xb482('0x4e')](function(_0x15ee39){logger['error'](_0xb482('0x57'),JSON[_0xb482('0x31')](_0x15ee39));});}; \ No newline at end of file +var _0xb9a9=['error','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','trigger:browser:url','catch','stringify','abandoned','[ABANDONED]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','request-promise','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','value','format','%s/api/v2/tickets','remoteUri','POST','then','info','validateEmail','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','base64','debug','length','forEach','nameField','customField','toLowerCase','content','type','idField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/helpdesk/tickets/%d'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xb9a9,0x118));var _0x9b9a=function(_0x1d5f21,_0x22e120){_0x1d5f21=_0x1d5f21-0x0;var _0x1b73ca=_0xb9a9[_0x1d5f21];return _0x1b73ca;};'use strict';var _=require(_0x9b9a('0x0'));var rp=require(_0x9b9a('0x1'));var md5=require('md5');var util=require(_0x9b9a('0x2'));var Redis=require(_0x9b9a('0x3'));var intUtil=require(_0x9b9a('0x4'));var config=require('../../../../config/environment');var logger=require(_0x9b9a('0x5'))(_0x9b9a('0x6'));config[_0x9b9a('0x7')]=_[_0x9b9a('0x8')](config[_0x9b9a('0x7')],{'host':_0x9b9a('0x9'),'port':0x18eb});var io=require(_0x9b9a('0xa'))(new Redis(config['redis']));var headers={'Content-Type':_0x9b9a('0xb'),'Accept':_0x9b9a('0xb')};function emit(_0x103020,_0x383346,_0xdee1e0){io['to'](_0x103020)[_0x9b9a('0xc')](_0x383346,_0xdee1e0);}function getTicket(_0xff3e36,_0x184468,_0x4f4412,_0x1a2f62,_0x36679d){logger['info']('Creating\x20new\x20ticket...');var _0x3a5791=_[_0x9b9a('0xd')]({'responder_id':_0x184468['id'],'requester_id':_0x4f4412['id'],'name':util['format'](_0x9b9a('0xe'),_0x36679d[_0x9b9a('0xf')]),'phone':_0x36679d[_0x9b9a('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x9b9a('0x11')](_0x1a2f62[_0x9b9a('0x12')],_0x36679d,'\x20'),'description':intUtil['getString'](_0x1a2f62[_0x9b9a('0x13')],_0x36679d,_0x9b9a('0x14')),'tags':getTags(_0x1a2f62[_0x9b9a('0x15')],_0x9b9a('0x16'))},getCustomFields(_0x1a2f62[_0x9b9a('0x17')],_0x36679d));_0x3a5791[_0x9b9a('0x18')]=_[_0x9b9a('0x19')](_['keyBy'](_0x3a5791[_0x9b9a('0x18')],'id'),_0x9b9a('0x1a'));return request({'uri':util[_0x9b9a('0x1b')](_0x9b9a('0x1c'),_0xff3e36[_0x9b9a('0x1d')]),'method':_0x9b9a('0x1e'),'body':_0x3a5791})[_0x9b9a('0x1f')](function(_0x12c9d6){logger[_0x9b9a('0x20')]('Ticket\x20created!');return _0x12c9d6;});}function getUser(_0xc30d97,_0x8fa7ed){if(intUtil[_0x9b9a('0x21')](_0x8fa7ed)){return request({'uri':util[_0x9b9a('0x1b')]('%s/api/v2/agents',_0xc30d97[_0x9b9a('0x1d')]),'qs':{'email':_0x8fa7ed}})['then'](function(_0x23007b){if(_0x23007b['length']){logger[_0x9b9a('0x20')](_0x9b9a('0x22'));return _['find'](_0x23007b,function(_0x1ec829){return _0x1ec829[_0x9b9a('0x23')][_0x9b9a('0x24')]===_0x8fa7ed;});}else{logger[_0x9b9a('0x20')](_0x9b9a('0x25'));return request({'uri':util[_0x9b9a('0x1b')](_0x9b9a('0x26'),_0xc30d97[_0x9b9a('0x1d')])})[_0x9b9a('0x1f')](function(_0x1ddd71){logger['info'](_0x9b9a('0x27'));return _0x1ddd71;});}});}else{logger[_0x9b9a('0x20')](_0x9b9a('0x28'));return request({'uri':util[_0x9b9a('0x1b')](_0x9b9a('0x26'),_0xc30d97[_0x9b9a('0x1d')])})[_0x9b9a('0x1f')](function(_0x58a611){logger[_0x9b9a('0x20')](_0x9b9a('0x27'));return _0x58a611;});}}function getEndUser(_0x3aa6cc,_0x20468b,_0x3cdc32){logger[_0x9b9a('0x20')](_0x9b9a('0x29'),_0x3cdc32);return request({'uri':util['format']('%s/api/v2/contacts',_0x3aa6cc['remoteUri']),'qs':{'phone':_0x3cdc32}})[_0x9b9a('0x1f')](function(_0x3474f4){if(_0x3474f4['length']){logger[_0x9b9a('0x20')]('Enduser\x20found!');return _[_0x9b9a('0x2a')](_0x3474f4,{'phone':_0x3cdc32});}else{logger[_0x9b9a('0x20')](_0x9b9a('0x2b'));return request({'uri':util[_0x9b9a('0x1b')]('%s/api/v2/contacts',_0x3aa6cc[_0x9b9a('0x1d')]),'method':_0x9b9a('0x1e'),'body':{'name':_0x20468b,'phone':_0x3cdc32}})[_0x9b9a('0x1f')](function(_0x40a0dc){logger[_0x9b9a('0x20')](_0x9b9a('0x2c'));return _0x40a0dc;});}});}function getAuth(_0x98aebb){return util['format']('Basic\x20%s',new Buffer(_0x98aebb[_0x9b9a('0x2d')]+':X')[_0x9b9a('0x2e')](_0x9b9a('0x2f')));}function request(_0x4689e0){logger[_0x9b9a('0x30')]('[HTTP]',JSON['stringify'](_0x4689e0));return rp(_[_0x9b9a('0x8')](_0x4689e0,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x272d1d,_0x5291a7){var _0x10e012=[];if(_0x272d1d&&_0x272d1d['length']>0x0){_0x10e012=_['map'](_0x272d1d,_0x5291a7);}return _0x10e012;}function getCustomFields(_0x31fa77,_0x1b4e43){var _0x32a59d=[];var _0xc16a6b={'custom_fields':[]};if(_0x31fa77[_0x9b9a('0x31')]>0x0){_[_0x9b9a('0x32')](_0x31fa77,function(_0x56273e){if(_0x56273e['type']==='string'&&_0x56273e[_0x9b9a('0x33')]&&!_0x56273e[_0x9b9a('0x34')]){_0xc16a6b[_0x56273e['nameField'][_0x9b9a('0x35')]()]=_0x56273e[_0x9b9a('0x36')][_0x9b9a('0x2e')]();}else if(_0x56273e[_0x9b9a('0x37')]==='string'&&_0x56273e[_0x9b9a('0x38')]&&_0x56273e[_0x9b9a('0x34')]){_0xc16a6b[_0x9b9a('0x18')][_0x9b9a('0x39')]({'id':_0x56273e[_0x9b9a('0x38')],'value':_0x56273e['content'][_0x9b9a('0x2e')]()});}else if(_0x56273e[_0x9b9a('0x37')]===_0x9b9a('0x3a')&&_0x56273e[_0x9b9a('0x3b')]&&_0x56273e[_0x9b9a('0x38')]&&_0x56273e['customField']){_0x1b4e43[_0x56273e[_0x9b9a('0x3b')]]&&_0xc16a6b['custom_fields']['push']({'id':_0x56273e[_0x9b9a('0x38')],'value':_0x1b4e43[_0x56273e[_0x9b9a('0x3b')]]['toString']()});}else if(_0x56273e['type']==='customVariable'&&_0x56273e[_0x9b9a('0x3c')]&&_0x56273e[_0x9b9a('0x3c')][_0x9b9a('0x16')]&&_0x56273e['idField']&&_0x56273e[_0x9b9a('0x34')]){_0x1b4e43[_0x56273e['Variable'][_0x9b9a('0x16')][_0x9b9a('0x35')]()]&&_0xc16a6b[_0x9b9a('0x18')][_0x9b9a('0x39')]({'id':_0x56273e[_0x9b9a('0x38')],'value':_0x1b4e43[_0x56273e[_0x9b9a('0x3c')][_0x9b9a('0x16')]['toLowerCase']()][_0x9b9a('0x2e')]()});}});}return _0xc16a6b;}exports[_0x9b9a('0x3d')]=function(_0x3095d2,_0x21e716,_0x226f0b,_0x48f118,_0x1579b,_0x3836a2){var _0x52d163,_0x4330d7;_0x3836a2['remoteUri']=intUtil[_0x9b9a('0x3e')](_0x3836a2['remoteUri']);_0x3836a2[_0x9b9a('0x3f')]=intUtil[_0x9b9a('0x3e')](_0x3836a2['serverUrl']);if(_0x1579b&&_0x1579b[_0x9b9a('0x40')]){logger['info'](_0x9b9a('0x41'),_0x9b9a('0x42'));_0x21e716[_0x9b9a('0x43')]=util[_0x9b9a('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3836a2['serverUrl'],_0x21e716['uniqueid'],md5(_0x21e716['uniqueid']));}else{_0x21e716['recordingURL']='';}headers[_0x9b9a('0x44')]=getAuth(_0x3836a2);return getUser(_0x3836a2,_0x48f118[_0x9b9a('0x24')])[_0x9b9a('0x1f')](function(_0x158fbb){_0x52d163=_0x158fbb;logger[_0x9b9a('0x20')](_0x9b9a('0x45'),_0x52d163['id']);return getEndUser(_0x3836a2,_0x21e716[_0x9b9a('0xf')],_0x21e716[_0x9b9a('0x10')]);})['then'](function(_0x27c757){_0x4330d7=_0x27c757;logger[_0x9b9a('0x20')](_0x9b9a('0x46'),_0x4330d7['id']);return getTicket(_0x3836a2,_0x52d163,_0x4330d7,_0x226f0b,_0x21e716);})[_0x9b9a('0x1f')](function(_0x4acbe8){if(_0x4acbe8&&_0x4acbe8['id']){logger[_0x9b9a('0x20')](_0x9b9a('0x47'));logger[_0x9b9a('0x20')](_0x9b9a('0x48'),_0x4acbe8['id']);logger['info'](_0x9b9a('0x41'),_0x9b9a('0x49'));emit(util[_0x9b9a('0x1b')](_0x9b9a('0x4a'),_0x48f118[_0x9b9a('0x16')]),'trigger:browser:url',{'uri':util[_0x9b9a('0x1b')](_0x9b9a('0x4b'),_0x3836a2[_0x9b9a('0x1d')],_0x4acbe8['id'])});}})['catch'](function(_0x2724f9){logger[_0x9b9a('0x4c')](_0x9b9a('0x41'),JSON['stringify'](_0x2724f9));});};exports[_0x9b9a('0x4d')]=function(_0x1427c4,_0x271be0,_0x191e1c,_0x4642d4,_0x1e268c,_0x31673f,_0xdf5c0f){var _0x4c2d41,_0x268eea;_0x31673f[_0x9b9a('0x1d')]=intUtil[_0x9b9a('0x3e')](_0x31673f[_0x9b9a('0x1d')]);_0x31673f[_0x9b9a('0x3f')]=intUtil['stripTrailingSlash'](_0x31673f['serverUrl']);if(_0xdf5c0f&&_0xdf5c0f[_0x9b9a('0x4e')]&&_0xdf5c0f[_0x9b9a('0x4e')]!==_0x9b9a('0x4f')){logger[_0x9b9a('0x20')](_0x9b9a('0x50'),'Recording\x20is\x20enabled!');_0x271be0[_0x9b9a('0x43')]=util[_0x9b9a('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x31673f[_0x9b9a('0x3f')],_0x271be0[_0x9b9a('0x51')],md5(_0x271be0[_0x9b9a('0x51')]));}headers[_0x9b9a('0x44')]=getAuth(_0x31673f);return getUser(_0x31673f,_0x4642d4[_0x9b9a('0x24')])['then'](function(_0x3bd7e0){_0x4c2d41=_0x3bd7e0;logger[_0x9b9a('0x20')]('The\x20User\x20ID\x20is:',_0x4c2d41['id']);return getEndUser(_0x31673f,_0x271be0[_0x9b9a('0x52')],_0x271be0['destcalleridnum']);})['then'](function(_0x5cb5b0){_0x268eea=_0x5cb5b0;logger[_0x9b9a('0x20')](_0x9b9a('0x46'),_0x268eea['id']);return getTicket(_0x31673f,_0x4c2d41,_0x268eea,_0x191e1c,_0x271be0);})[_0x9b9a('0x1f')](function(_0x1b5107){if(_0x1b5107&&_0x1b5107['id']){logger[_0x9b9a('0x20')](_0x9b9a('0x47'));logger[_0x9b9a('0x20')](_0x9b9a('0x48'),_0x1b5107['id']);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x9b9a('0x4a'),_0x4642d4['name']),_0x9b9a('0x53'),{'uri':util[_0x9b9a('0x1b')]('%s/helpdesk/tickets/%d',_0x31673f['remoteUri'],_0x1b5107['id'])});}})[_0x9b9a('0x54')](function(_0x1a50be){logger['error'](_0x9b9a('0x50'),JSON[_0x9b9a('0x55')](_0x1a50be));});};exports[_0x9b9a('0x56')]=function(_0x475abe,_0xf22ba,_0x495e62,_0xb67ef5,_0x2512dd,_0x276ebc){var _0x442381,_0x5cb7d4;_0x276ebc[_0x9b9a('0x1d')]=intUtil[_0x9b9a('0x3e')](_0x276ebc[_0x9b9a('0x1d')]);_0x276ebc['serverUrl']=intUtil[_0x9b9a('0x3e')](_0x276ebc[_0x9b9a('0x3f')]);if(_0x2512dd&&_0x2512dd['monitor_format']){logger[_0x9b9a('0x20')](_0x9b9a('0x57'),_0x9b9a('0x42'));_0xf22ba[_0x9b9a('0x43')]=util['format'](_0x9b9a('0x58'),_0x276ebc['serverUrl'],_0xf22ba[_0x9b9a('0x51')],md5(_0xf22ba['uniqueid']));}else{_0xf22ba[_0x9b9a('0x43')]='';}headers['Authorization']=getAuth(_0x276ebc);return getUser(_0x276ebc,'')[_0x9b9a('0x1f')](function(_0x376492){_0x442381=_0x376492;logger[_0x9b9a('0x20')]('The\x20User\x20ID\x20is:',_0x442381['id']);return getEndUser(_0x276ebc,_0xf22ba[_0x9b9a('0xf')],_0xf22ba[_0x9b9a('0x10')]);})[_0x9b9a('0x1f')](function(_0x499c91){_0x5cb7d4=_0x499c91;logger[_0x9b9a('0x20')](_0x9b9a('0x46'),_0x5cb7d4['id']);return getTicket(_0x276ebc,_0x442381,_0x5cb7d4,_0x495e62,_0xf22ba);})[_0x9b9a('0x1f')](function(_0x19463e){if(_0x19463e){logger[_0x9b9a('0x20')](_0x9b9a('0x47'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x19463e['id']);}})[_0x9b9a('0x54')](function(_0x32c588){logger[_0x9b9a('0x4c')](_0x9b9a('0x57'),JSON['stringify'](_0x32c588));});}; \ 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 d74cdee..3df1243 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 _0x1849=['stripTrailingSlash','serverUrl','toLowerCase','outbound','calleridnum','callDirection','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','../../../../config/environment','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Admin\x20selected','GET','/api/contacts/filters','Getting\x20contacts\x20filter','then','filters','forEach','name','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','work_number','Contact\x20found:','endUserId','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','/api/tasks','Subjects','getString','Descriptions','Contact','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','remoteUri'];(function(_0x8c9abd,_0x5f5143){var _0x45b78c=function(_0x580474){while(--_0x580474){_0x8c9abd['push'](_0x8c9abd['shift']());}};_0x45b78c(++_0x5f5143);}(_0x1849,0xb8));var _0x9184=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1849[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var rp=require(_0x9184('0x0'));var md5=require(_0x9184('0x1'));var util=require(_0x9184('0x2'));var moment=require(_0x9184('0x3'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x9184('0x4'));var logger=require('../../../../config/logger')(_0x9184('0x5'));config[_0x9184('0x6')]=_[_0x9184('0x7')](config['redis'],{'host':_0x9184('0x8'),'port':0x18eb});var io=require(_0x9184('0x9'))(new Redis(config['redis']));function getAdminId(_0x305a34,_0x532710,_0x5ca39b,_0x16e5f1){return new Promise(function(_0x20cb8f,_0x18531f){var _0x163565=![];var _0x1388bb={'method':'GET','uri':_0x16e5f1+_0x9184('0xa'),'json':!![]};_0x1388bb[_0x9184('0xb')]=_0x5ca39b;logger[_0x9184('0xc')](_0x9184('0xd'));return rp(_0x1388bb)['then'](function(_0xe6b641){if(_0xe6b641){var _0x3b8983=_0xe6b641['users'];var _0x201f10=null;for(_0x201f10=0x0;_0x201f10<_0x3b8983[_0x9184('0xe')];_0x201f10++){if(_0x3b8983[_0x201f10][_0x9184('0xf')]===_0x305a34[_0x9184('0x10')]){_0x305a34[_0x9184('0x11')]=_0x3b8983[_0x201f10]['id'];_0x163565=!![];}}if(_0x163565){logger['info']('Admin\x20found:',_0x305a34[_0x9184('0x11')]);_0x20cb8f(_0x305a34);}else{_0x18531f({'statusCode':0x194,'message':_0x9184('0x12')});}}else{_0x18531f({'statusCode':0x194,'message':_0x9184('0x12')});}})[_0x9184('0x13')](function(_0x14dbca){logger[_0x9184('0x14')]('['+[_0x532710[_0x9184('0x15')]()]+']',_0x14dbca[_0x9184('0x16')]);_0x18531f(_0x14dbca);});});}function getUser(_0x4f18fb,_0x511ba5,_0x299d68){return function(_0x44e719){return new Promise(function(_0x6520dd,_0xd69919){var _0x2a5ff8={'method':'GET','uri':_0x299d68+_0x9184('0xa'),'json':!![]};_0x2a5ff8[_0x9184('0xb')]=_0x511ba5;logger[_0x9184('0xc')](_0x9184('0x17'));return rp(_0x2a5ff8)['then'](function(_0x435b58){if(_0x435b58){var _0x4f7d78=_0x435b58['users'];var _0x30e0ae=![];var _0x13def8=null;if(_0x44e719[_0x9184('0x18')]!==null){logger[_0x9184('0xc')](_0x9184('0x19'),_0x44e719['agentEmail']);_0x44e719[_0x9184('0x1a')]=_0x44e719[_0x9184('0x18')];for(_0x13def8=0x0;_0x13def8<_0x4f7d78['length'];_0x13def8++){if(_0x4f7d78[_0x13def8][_0x9184('0xf')]===_0x44e719['agentEmail']){_0x30e0ae=!![];_0x44e719['userId']=_0x4f7d78[_0x13def8]['id'];logger[_0x9184('0xc')](_0x9184('0x1b'),_0x44e719[_0x9184('0x1c')]);}}}if(!_0x30e0ae){logger[_0x9184('0xc')](_0x9184('0x1d'));_0x44e719['userEmail']=_0x44e719[_0x9184('0x10')];_0x44e719[_0x9184('0x1c')]=_0x44e719[_0x9184('0x11')];_0x30e0ae=!![];}if(_0x30e0ae){_0x6520dd(_0x44e719);}else{_0xd69919({'statusCode':0x194,'message':_0x9184('0x12')});}}else{_0xd69919({'statusCode':0x194,'message':_0x9184('0x12')});}})['catch'](function(_0xa72849){logger[_0x9184('0x14')]('['+[_0x4f18fb[_0x9184('0x15')]()]+']',_0xa72849[_0x9184('0x16')]);_0xd69919(_0xa72849);});});};}function getEndUser(_0x3ac7c6,_0x356141,_0x49dfdf){return function(_0x369908){return new Promise(function(_0x42d286,_0xc845e9){var _0x414a80=0x0;var _0x5797f1={'method':_0x9184('0x1e'),'uri':_0x49dfdf+_0x9184('0x1f'),'json':!![]};_0x5797f1[_0x9184('0xb')]=_0x356141;logger[_0x9184('0xc')](_0x9184('0x20'));return rp(_0x5797f1)[_0x9184('0x21')](function(_0x27acde){_0x27acde[_0x9184('0x22')][_0x9184('0x23')](function(_0x2da7f5){if(_0x2da7f5[_0x9184('0x24')]==='All\x20Contacts'){_0x414a80=_0x2da7f5['id'];}});})[_0x9184('0x21')](function(){logger[_0x9184('0xc')]('Getting\x20contact\x20list');var _0x42453b={'method':_0x9184('0x1e'),'uri':_0x49dfdf+_0x9184('0x25')+_0x414a80,'json':!![]};_0x42453b[_0x9184('0xb')]=_0x356141;return rp(_0x42453b);})[_0x9184('0x21')](function(_0x1348e3){logger[_0x9184('0xc')](_0x9184('0x26'),_0x369908[_0x9184('0x27')]);if(_0x1348e3[_0x9184('0x28')]['length']>0x0){var _0x54cbf3=_[_0x9184('0x29')](_0x1348e3['contacts'],function(_0x4b6c0a){if(_0x4b6c0a[_0x9184('0x2a')]===_0x369908[_0x9184('0x27')]||_0x4b6c0a['mobile_number']===_0x369908[_0x9184('0x27')]){return _0x4b6c0a;}});if(_0x54cbf3){_0x369908['endUserId']=_0x54cbf3['id'];logger[_0x9184('0xc')](_0x9184('0x2b'),_0x369908[_0x9184('0x2c')]);_0x42d286(_0x369908);}else{return createEndUser(_0x369908,_0x3ac7c6,_0x356141,_0x49dfdf)['then'](function(_0x2265b3){logger['info'](_0x9184('0x2d'),_0x369908[_0x9184('0x2c')]);_0x42d286(_0x2265b3);});}}else{return createEndUser(_0x369908,_0x3ac7c6,_0x356141,_0x49dfdf)['then'](function(_0x15b77e){logger[_0x9184('0xc')](_0x9184('0x2d'),_0x369908[_0x9184('0x2c')]);_0x42d286(_0x15b77e);});}})[_0x9184('0x13')](function(_0x4f7557){throw new Error(_0x4f7557['message']);});});};}function createEndUser(_0x4ece1d,_0x7bc320,_0x292297,_0x38627e){return new Promise(function(_0x2b40a4,_0x5f3b74){var _0x28b741=moment();var _0x5d4501={'method':'POST','uri':_0x38627e+_0x9184('0x2e'),'body':{'contact':{'last_name':_0x4ece1d[_0x9184('0x27')],'work_number':_0x4ece1d[_0x9184('0x27')],'mobile_number':_0x4ece1d[_0x9184('0x27')],'owner_id':_0x4ece1d[_0x9184('0x1c')],'created_at':_0x28b741[_0x9184('0x2f')](_0x9184('0x30'))}},'json':!![]};_0x5d4501[_0x9184('0xb')]=_0x292297;logger[_0x9184('0xc')](_0x9184('0x31'));return rp(_0x5d4501)[_0x9184('0x21')](function(_0x2e1779){_0x4ece1d['endUserId']=_0x2e1779[_0x9184('0x32')]['id'];_0x2b40a4(_0x4ece1d);})[_0x9184('0x13')](function(_0xa7b660){logger[_0x9184('0x14')]('['+[_0x7bc320[_0x9184('0x15')]()]+']',_0xa7b660['message']);_0x5f3b74(_0xa7b660[_0x9184('0x16')]);});});}function getTicket(_0x54e418,_0x2e07ad,_0x55f502,_0x502f70,_0x12ae6e){return function(_0x377863){logger[_0x9184('0xc')]('Creating\x20new\x20task');return new Promise(function(_0x3ed5da,_0x2df2c9){var _0x315f34=moment();var _0x171ea8={'method':_0x9184('0x33'),'uri':_0x55f502+_0x9184('0x34'),'body':{'title':intUtil['getString'](_0x502f70[_0x9184('0x35')],_0x12ae6e,'\x20'),'description':intUtil[_0x9184('0x36')](_0x502f70[_0x9184('0x37')],_0x12ae6e,'\x0a'),'owner_id':_0x377863[_0x9184('0x1c')],'creater_id':_0x377863['adminId'],'targetable_id':_0x377863[_0x9184('0x2c')],'targetable_type':_0x9184('0x38'),'created_at':_0x315f34['format'](_0x9184('0x30')),'due_date':_0x315f34['add'](0x1e,'m')[_0x9184('0x2f')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x171ea8[_0x9184('0xb')]=_0x2e07ad;return rp(_0x171ea8)[_0x9184('0x21')](function(_0x7f5cf7){_0x377863[_0x9184('0x39')]=_0x7f5cf7[_0x9184('0x3a')]['id'];logger[_0x9184('0xc')](_0x9184('0x3b'),_0x377863[_0x9184('0x39')]);_0x3ed5da(_0x377863);})['catch'](function(_0x5d9747){logger['error']('['+[_0x54e418['toUpperCase']()]+']',_0x5d9747[_0x9184('0x16')]);_0x2df2c9(_0x5d9747[_0x9184('0x16')]);});});};}function emit(_0x5409b5,_0x1faa76,_0x4c4971){var _0x5a48c1={'uri':_0x5409b5+_0x9184('0x3c')+_0x4c4971};io['to'](util['format'](_0x9184('0x3d'),_0x1faa76))['emit'](_0x9184('0x3e'),_0x5a48c1);}exports['cs']=function(_0x31f8d7,_0x424e3b,_0x4aa9a2,_0xfd467c,_0x293961,_0x51efa5,_0x8394c4,_0x2fbf57){var _0x5646e2={};var _0x34fb68={'Authorization':_0x9184('0x3f')+_0x51efa5['apiKey']};_0x51efa5[_0x9184('0x40')]=intUtil[_0x9184('0x41')](_0x51efa5['remoteUri']);_0x51efa5[_0x9184('0x42')]=intUtil[_0x9184('0x41')](_0x51efa5[_0x9184('0x42')]);var _0x3a4111=_0x51efa5[_0x9184('0x40')];_0x5646e2['adminEmail']=_0x51efa5['username'];_0x5646e2[_0x9184('0x27')]=_0x2fbf57[_0x9184('0x43')]()===_0x9184('0x44')?_0x424e3b['destcalleridnum']:_0x424e3b[_0x9184('0x45')];_0x5646e2[_0x9184('0x46')]=_0x2fbf57===_0x9184('0x47')||_0x2fbf57===_0x9184('0x48')?'queue':'outbound';if(_0xfd467c){_0x5646e2[_0x9184('0x18')]=_0xfd467c['email'];}var _0x35f458=util[_0x9184('0x2f')](_0x9184('0x49'),_0x51efa5[_0x9184('0x42')],_0x424e3b['uniqueid'],md5(_0x424e3b['uniqueid']));if(_0x293961&&_0x293961['monitor_format']){logger[_0x9184('0xc')](_0x9184('0x4a'),_0x9184('0x4b'));_0x424e3b['recordingURL']=_0x35f458;}else if(_0x8394c4&&_0x8394c4[_0x9184('0x4c')]&&_0x8394c4[_0x9184('0x4c')]!==_0x9184('0x4d')){logger[_0x9184('0xc')](_0x9184('0x4e'),_0x9184('0x4b'));_0x424e3b[_0x9184('0x4f')]=_0x35f458;}else{_0x424e3b[_0x9184('0x4f')]='';}return getAdminId(_0x5646e2,_0x2fbf57,_0x34fb68,_0x3a4111)[_0x9184('0x21')](getUser(_0x2fbf57,_0x34fb68,_0x3a4111))[_0x9184('0x21')](getEndUser(_0x2fbf57,_0x34fb68,_0x3a4111))['then'](getTicket(_0x2fbf57,_0x34fb68,_0x3a4111,_0x4aa9a2,_0x424e3b))[_0x9184('0x21')](function(_0x550e92){logger['info'](util['format'](_0x9184('0x50'),_0x550e92[_0x9184('0x39')]));if(_0x2fbf57!==_0x9184('0x48')){logger[_0x9184('0xc')]('['+[_0x2fbf57[_0x9184('0x15')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x3a4111,_0xfd467c[_0x9184('0x24')],_0x550e92[_0x9184('0x2c')]);}})['catch'](function(_0xe5d9bb){logger[_0x9184('0x14')]('['+[_0x2fbf57['toUpperCase']()]+_0x9184('0x51'),util[_0x9184('0x52')](_0xe5d9bb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xab7c=['lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','/api/selector/owners','headers','then','users','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','message','GET','info','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','email','userId','User\x20found:','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contacts','find','work_number','contactNumber','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','catch','POST','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','error','Creating\x20new\x20task','/api/tasks','getString','Subjects','Contact','task','Task\x20created:','ticketId','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','calleridnum','abandoned','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect'];(function(_0x1b9a20,_0x38575a){var _0x491922=function(_0x329122){while(--_0x329122){_0x1b9a20['push'](_0x1b9a20['shift']());}};_0x491922(++_0x38575a);}(_0xab7c,0x15c));var _0xcab7=function(_0x8ce7d8,_0x67e33b){_0x8ce7d8=_0x8ce7d8-0x0;var _0x337ce2=_0xab7c[_0x8ce7d8];return _0x337ce2;};'use strict';var _=require(_0xcab7('0x0'));var rp=require(_0xcab7('0x1'));var md5=require(_0xcab7('0x2'));var util=require('util');var moment=require(_0xcab7('0x3'));var Promise=require(_0xcab7('0x4'));var Redis=require(_0xcab7('0x5'));var intUtil=require(_0xcab7('0x6'));var config=require('../../../../config/environment');var logger=require(_0xcab7('0x7'))(_0xcab7('0x8'));config[_0xcab7('0x9')]=_[_0xcab7('0xa')](config[_0xcab7('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xcab7('0xb'))(new Redis(config[_0xcab7('0x9')]));function getAdminId(_0x44f0eb,_0x22c07c,_0x34d07d,_0x565783){return new Promise(function(_0x1014ef,_0x4ffe36){var _0x246e6d=![];var _0x548f0c={'method':'GET','uri':_0x565783+_0xcab7('0xc'),'json':!![]};_0x548f0c[_0xcab7('0xd')]=_0x34d07d;logger['info']('Getting\x20admin\x20information');return rp(_0x548f0c)[_0xcab7('0xe')](function(_0x164f37){if(_0x164f37){var _0x346155=_0x164f37[_0xcab7('0xf')];var _0x311fee=null;for(_0x311fee=0x0;_0x311fee<_0x346155['length'];_0x311fee++){if(_0x346155[_0x311fee]['email']===_0x44f0eb[_0xcab7('0x10')]){_0x44f0eb[_0xcab7('0x11')]=_0x346155[_0x311fee]['id'];_0x246e6d=!![];}}if(_0x246e6d){logger['info'](_0xcab7('0x12'),_0x44f0eb['adminId']);_0x1014ef(_0x44f0eb);}else{_0x4ffe36({'statusCode':0x194,'message':_0xcab7('0x13')});}}else{_0x4ffe36({'statusCode':0x194,'message':_0xcab7('0x13')});}})['catch'](function(_0x32e2d3){logger['error']('['+[_0x22c07c[_0xcab7('0x14')]()]+']',_0x32e2d3[_0xcab7('0x15')]);_0x4ffe36(_0x32e2d3);});});}function getUser(_0x5d7c7e,_0x39197b,_0x1efdb9){return function(_0x3919f7){return new Promise(function(_0xacbb8f,_0x45928c){var _0x586a89={'method':_0xcab7('0x16'),'uri':_0x1efdb9+_0xcab7('0xc'),'json':!![]};_0x586a89[_0xcab7('0xd')]=_0x39197b;logger[_0xcab7('0x17')](_0xcab7('0x18'));return rp(_0x586a89)['then'](function(_0x3710ea){if(_0x3710ea){var _0x1bf622=_0x3710ea[_0xcab7('0xf')];var _0x8e91d5=![];var _0x347df2=null;if(_0x3919f7[_0xcab7('0x19')]!==null){logger[_0xcab7('0x17')](_0xcab7('0x1a'),_0x3919f7[_0xcab7('0x19')]);_0x3919f7[_0xcab7('0x1b')]=_0x3919f7['agentEmail'];for(_0x347df2=0x0;_0x347df2<_0x1bf622[_0xcab7('0x1c')];_0x347df2++){if(_0x1bf622[_0x347df2][_0xcab7('0x1d')]===_0x3919f7[_0xcab7('0x19')]){_0x8e91d5=!![];_0x3919f7[_0xcab7('0x1e')]=_0x1bf622[_0x347df2]['id'];logger[_0xcab7('0x17')](_0xcab7('0x1f'),_0x3919f7[_0xcab7('0x1e')]);}}}if(!_0x8e91d5){logger[_0xcab7('0x17')]('Admin\x20selected');_0x3919f7[_0xcab7('0x1b')]=_0x3919f7[_0xcab7('0x10')];_0x3919f7[_0xcab7('0x1e')]=_0x3919f7[_0xcab7('0x11')];_0x8e91d5=!![];}if(_0x8e91d5){_0xacbb8f(_0x3919f7);}else{_0x45928c({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x45928c({'statusCode':0x194,'message':_0xcab7('0x13')});}})['catch'](function(_0x4e2800){logger['error']('['+[_0x5d7c7e[_0xcab7('0x14')]()]+']',_0x4e2800[_0xcab7('0x15')]);_0x45928c(_0x4e2800);});});};}function getEndUser(_0x111a1c,_0x1c9f20,_0x59be7d){return function(_0x1dc6bd){return new Promise(function(_0x4a2890,_0x56a735){var _0x461e10=0x0;var _0x333f6a={'method':_0xcab7('0x16'),'uri':_0x59be7d+'/api/contacts/filters','json':!![]};_0x333f6a['headers']=_0x1c9f20;logger['info'](_0xcab7('0x20'));return rp(_0x333f6a)[_0xcab7('0xe')](function(_0x241230){_0x241230[_0xcab7('0x21')][_0xcab7('0x22')](function(_0xee0a4){if(_0xee0a4[_0xcab7('0x23')]===_0xcab7('0x24')){_0x461e10=_0xee0a4['id'];}});})[_0xcab7('0xe')](function(){logger[_0xcab7('0x17')]('Getting\x20contact\x20list');var _0xbafdc2={'method':'GET','uri':_0x59be7d+_0xcab7('0x25')+_0x461e10,'json':!![]};_0xbafdc2[_0xcab7('0xd')]=_0x1c9f20;return rp(_0xbafdc2);})['then'](function(_0x707362){logger[_0xcab7('0x17')](_0xcab7('0x26'),_0x1dc6bd['contactNumber']);if(_0x707362[_0xcab7('0x27')]['length']>0x0){var _0x179394=_[_0xcab7('0x28')](_0x707362[_0xcab7('0x27')],function(_0x4b8717){if(_0x4b8717[_0xcab7('0x29')]===_0x1dc6bd[_0xcab7('0x2a')]||_0x4b8717[_0xcab7('0x2b')]===_0x1dc6bd['contactNumber']){return _0x4b8717;}});if(_0x179394){_0x1dc6bd[_0xcab7('0x2c')]=_0x179394['id'];logger[_0xcab7('0x17')](_0xcab7('0x2d'),_0x1dc6bd[_0xcab7('0x2c')]);_0x4a2890(_0x1dc6bd);}else{return createEndUser(_0x1dc6bd,_0x111a1c,_0x1c9f20,_0x59be7d)['then'](function(_0x12ab64){logger[_0xcab7('0x17')](_0xcab7('0x2e'),_0x1dc6bd[_0xcab7('0x2c')]);_0x4a2890(_0x12ab64);});}}else{return createEndUser(_0x1dc6bd,_0x111a1c,_0x1c9f20,_0x59be7d)[_0xcab7('0xe')](function(_0x44a138){logger[_0xcab7('0x17')]('Contact\x20created:',_0x1dc6bd[_0xcab7('0x2c')]);_0x4a2890(_0x44a138);});}})[_0xcab7('0x2f')](function(_0x1e92f1){throw new Error(_0x1e92f1[_0xcab7('0x15')]);});});};}function createEndUser(_0x51d24a,_0x1cdc63,_0x515f6c,_0x5dc40e){return new Promise(function(_0x240907,_0x2f1ac6){var _0x146164=moment();var _0x538451={'method':_0xcab7('0x30'),'uri':_0x5dc40e+'/api/contacts','body':{'contact':{'last_name':_0x51d24a[_0xcab7('0x2a')],'work_number':_0x51d24a[_0xcab7('0x2a')],'mobile_number':_0x51d24a['contactNumber'],'owner_id':_0x51d24a[_0xcab7('0x1e')],'created_at':_0x146164[_0xcab7('0x31')](_0xcab7('0x32'))}},'json':!![]};_0x538451[_0xcab7('0xd')]=_0x515f6c;logger['info'](_0xcab7('0x33'));return rp(_0x538451)[_0xcab7('0xe')](function(_0x2d9b7c){_0x51d24a['endUserId']=_0x2d9b7c['contact']['id'];_0x240907(_0x51d24a);})[_0xcab7('0x2f')](function(_0x2425d6){logger[_0xcab7('0x34')]('['+[_0x1cdc63['toUpperCase']()]+']',_0x2425d6['message']);_0x2f1ac6(_0x2425d6['message']);});});}function getTicket(_0x500b35,_0x126638,_0x2ae758,_0x4b4e66,_0x2472bb){return function(_0x13d36e){logger[_0xcab7('0x17')](_0xcab7('0x35'));return new Promise(function(_0xfc6ac7,_0x52dd3a){var _0x4d39fc=moment();var _0x3dfa4e={'method':_0xcab7('0x30'),'uri':_0x2ae758+_0xcab7('0x36'),'body':{'title':intUtil[_0xcab7('0x37')](_0x4b4e66[_0xcab7('0x38')],_0x2472bb,'\x20'),'description':intUtil['getString'](_0x4b4e66['Descriptions'],_0x2472bb,'\x0a'),'owner_id':_0x13d36e[_0xcab7('0x1e')],'creater_id':_0x13d36e[_0xcab7('0x11')],'targetable_id':_0x13d36e['endUserId'],'targetable_type':_0xcab7('0x39'),'created_at':_0x4d39fc[_0xcab7('0x31')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x4d39fc['add'](0x1e,'m')[_0xcab7('0x31')](_0xcab7('0x32'))},'json':!![]};_0x3dfa4e[_0xcab7('0xd')]=_0x126638;return rp(_0x3dfa4e)['then'](function(_0x3e52ab){_0x13d36e['ticketId']=_0x3e52ab[_0xcab7('0x3a')]['id'];logger[_0xcab7('0x17')](_0xcab7('0x3b'),_0x13d36e[_0xcab7('0x3c')]);_0xfc6ac7(_0x13d36e);})['catch'](function(_0x5eb208){logger['error']('['+[_0x500b35['toUpperCase']()]+']',_0x5eb208['message']);_0x52dd3a(_0x5eb208[_0xcab7('0x15')]);});});};}function emit(_0x1b1779,_0x18bae1,_0x1d51df){var _0x25f8ad={'uri':_0x1b1779+_0xcab7('0x3d')+_0x1d51df};io['to'](util[_0xcab7('0x31')](_0xcab7('0x3e'),_0x18bae1))[_0xcab7('0x3f')]('trigger:browser:url',_0x25f8ad);}exports['cs']=function(_0x5d8bb0,_0x20043f,_0x23c1a5,_0x38f454,_0x3a8503,_0x1e2d43,_0x5dc720,_0x2dfa1d){var _0x4cae20={};var _0x4a96e3={'Authorization':_0xcab7('0x40')+_0x1e2d43[_0xcab7('0x41')]};_0x1e2d43[_0xcab7('0x42')]=intUtil[_0xcab7('0x43')](_0x1e2d43[_0xcab7('0x42')]);_0x1e2d43[_0xcab7('0x44')]=intUtil['stripTrailingSlash'](_0x1e2d43['serverUrl']);var _0x4984b9=_0x1e2d43[_0xcab7('0x42')];_0x4cae20[_0xcab7('0x10')]=_0x1e2d43[_0xcab7('0x45')];_0x4cae20[_0xcab7('0x2a')]=_0x2dfa1d[_0xcab7('0x46')]()==='outbound'?_0x20043f[_0xcab7('0x47')]:_0x20043f[_0xcab7('0x48')];_0x4cae20['callDirection']=_0x2dfa1d==='queue'||_0x2dfa1d===_0xcab7('0x49')?_0xcab7('0x4a'):_0xcab7('0x4b');if(_0x38f454){_0x4cae20[_0xcab7('0x19')]=_0x38f454[_0xcab7('0x1d')];}var _0x581c70=util['format'](_0xcab7('0x4c'),_0x1e2d43[_0xcab7('0x44')],_0x20043f[_0xcab7('0x4d')],md5(_0x20043f[_0xcab7('0x4d')]));if(_0x3a8503&&_0x3a8503[_0xcab7('0x4e')]){logger[_0xcab7('0x17')](_0xcab7('0x4f'),_0xcab7('0x50'));_0x20043f[_0xcab7('0x51')]=_0x581c70;}else if(_0x5dc720&&_0x5dc720[_0xcab7('0x52')]&&_0x5dc720[_0xcab7('0x52')]!==_0xcab7('0x53')){logger[_0xcab7('0x17')]('[OUTBOUND]',_0xcab7('0x50'));_0x20043f[_0xcab7('0x51')]=_0x581c70;}else{_0x20043f[_0xcab7('0x51')]='';}return getAdminId(_0x4cae20,_0x2dfa1d,_0x4a96e3,_0x4984b9)['then'](getUser(_0x2dfa1d,_0x4a96e3,_0x4984b9))[_0xcab7('0xe')](getEndUser(_0x2dfa1d,_0x4a96e3,_0x4984b9))[_0xcab7('0xe')](getTicket(_0x2dfa1d,_0x4a96e3,_0x4984b9,_0x23c1a5,_0x20043f))[_0xcab7('0xe')](function(_0x1fc35a){logger['info'](util[_0xcab7('0x31')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1fc35a[_0xcab7('0x3c')]));if(_0x2dfa1d!==_0xcab7('0x49')){logger['info']('['+[_0x2dfa1d[_0xcab7('0x14')]()]+']',_0xcab7('0x54'));emit(_0x4984b9,_0x38f454[_0xcab7('0x23')],_0x1fc35a['endUserId']);}})[_0xcab7('0x2f')](function(_0x5502b6){logger[_0xcab7('0x34')]('['+[_0x2dfa1d[_0xcab7('0x14')]()]+_0xcab7('0x55'),util[_0xcab7('0x56')](_0x5502b6,{'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 a3fca0b..9474352 100644 --- a/server/services/ami/trigger/integration/index.js +++ b/server/services/ami/trigger/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','vtiger','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','log','abandoned','zendesk','zoho','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./desk'];(function(_0x2353b2,_0x1d83a0){var _0x8a6718=function(_0x1502fc){while(--_0x1502fc){_0x2353b2['push'](_0x2353b2['shift']());}};_0x8a6718(++_0x1d83a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var zendesk=require(_0x0a9e('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0a9e('0x3'));var zoho=require('./zoho');var desk=require(_0x0a9e('0x4'));var vtiger=require(_0x0a9e('0x5'));var servicenow=require(_0x0a9e('0x6'));var dynamics365=require(_0x0a9e('0x7'));var freshsales=require(_0x0a9e('0x8'));var integrations=['zendesk',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'zoho','desk',_0x0a9e('0xc'),'dynamics365','freshsales',_0x0a9e('0xd')];exports[_0x0a9e('0xe')]=function(_0x307b3e,_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2){if(_0xfeb75b){if(_['includes'](integrations,_0x307b3e['data1'][_0x0a9e('0xf')]())){try{var _0x36471c=null;var _0xd5b662='';var _0x26d672=_0xfeb75b[_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]()];if(_0x26d672){var _0x5db4b0=_0x26d672[_0x307b3e[_0x0a9e('0x11')]];if(_0x5db4b0){var _0x239b12=_[_0x0a9e('0x12')](_0x5db4b0[_0x0a9e('0x13')],{'id':parseInt(_0x307b3e[_0x0a9e('0x14')],0xa)});if(_0x239b12){if(_0xbd1168){if(_0x4a4c56&&_0x3ab53f[_0x0a9e('0x15')]){_0xd5b662='queue';}else if(_0x3ab53f[_0x0a9e('0x16')]){_0xd5b662='outbound';}else{console[_0x0a9e('0x17')]('EVENT\x20UNKNOWN',_0x3ab53f);}}else{_0xd5b662=_0x0a9e('0x18');}switch(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']()){case _0x0a9e('0x19'):zendesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case'salesforce':salesforce[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xa'):sugarcrm[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xb'):freshdesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1a'):zoho[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1b'):desk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xc'):vtiger[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1c'):freshsales['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);case _0x0a9e('0xd'):servicenow['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;case _0x0a9e('0x1d'):dynamics365['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;default:console[_0x0a9e('0x17')](_0x0a9e('0x1e'));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']());_0x36471c[_0x0a9e('0x20')](_0x0a9e('0x21'),util['format'](_0x0a9e('0x22'),_0x307b3e['data1']['toLowerCase'](),_0x307b3e[_0x0a9e('0x14')]));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]());_0x36471c['error'](_0x0a9e('0x21'),util[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')](),_0x307b3e[_0x0a9e('0x11')]));}}else{}}catch(_0x16b1ca){console['error'](_0x16b1ca);}}}}; \ No newline at end of file +var _0xa9e0=['./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','vtiger','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','log','abandoned','zendesk','zoho','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./desk'];(function(_0x314a3f,_0x1a6f01){var _0x9295c=function(_0x344715){while(--_0x344715){_0x314a3f['push'](_0x314a3f['shift']());}};_0x9295c(++_0x1a6f01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var zendesk=require(_0x0a9e('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0a9e('0x3'));var zoho=require('./zoho');var desk=require(_0x0a9e('0x4'));var vtiger=require(_0x0a9e('0x5'));var servicenow=require(_0x0a9e('0x6'));var dynamics365=require(_0x0a9e('0x7'));var freshsales=require(_0x0a9e('0x8'));var integrations=['zendesk',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'zoho','desk',_0x0a9e('0xc'),'dynamics365','freshsales',_0x0a9e('0xd')];exports[_0x0a9e('0xe')]=function(_0x307b3e,_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2){if(_0xfeb75b){if(_['includes'](integrations,_0x307b3e['data1'][_0x0a9e('0xf')]())){try{var _0x36471c=null;var _0xd5b662='';var _0x26d672=_0xfeb75b[_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]()];if(_0x26d672){var _0x5db4b0=_0x26d672[_0x307b3e[_0x0a9e('0x11')]];if(_0x5db4b0){var _0x239b12=_[_0x0a9e('0x12')](_0x5db4b0[_0x0a9e('0x13')],{'id':parseInt(_0x307b3e[_0x0a9e('0x14')],0xa)});if(_0x239b12){if(_0xbd1168){if(_0x4a4c56&&_0x3ab53f[_0x0a9e('0x15')]){_0xd5b662='queue';}else if(_0x3ab53f[_0x0a9e('0x16')]){_0xd5b662='outbound';}else{console[_0x0a9e('0x17')]('EVENT\x20UNKNOWN',_0x3ab53f);}}else{_0xd5b662=_0x0a9e('0x18');}switch(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']()){case _0x0a9e('0x19'):zendesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case'salesforce':salesforce[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xa'):sugarcrm[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xb'):freshdesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1a'):zoho[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1b'):desk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xc'):vtiger[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1c'):freshsales['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);case _0x0a9e('0xd'):servicenow['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;case _0x0a9e('0x1d'):dynamics365['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;default:console[_0x0a9e('0x17')](_0x0a9e('0x1e'));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']());_0x36471c[_0x0a9e('0x20')](_0x0a9e('0x21'),util['format'](_0x0a9e('0x22'),_0x307b3e['data1']['toLowerCase'](),_0x307b3e[_0x0a9e('0x14')]));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]());_0x36471c['error'](_0x0a9e('0x21'),util[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')](),_0x307b3e[_0x0a9e('0x11')]));}}else{}}catch(_0x16b1ca){console['error'](_0x16b1ca);}}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/salesforce.js b/server/services/ami/trigger/integration/salesforce.js index d321370..3ade36d 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 _0xc93e=['Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','uniqueid','email','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','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','none','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','stringify','[ABANDONED]','calleridname','Fields','[ABANDONED]\x20Ticket\x20%s\x20created.','lodash','md5','jsforce','util','ioredis','./util','salesforce','redis','defaults','socket.io-emitter','emit','ticketType','Task','assign','utc','getString','Descriptions','WhoId','Case','Subjects','ContactId','sobject','create','isNil','validateEmail','find','then','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','moduleSearch','contact_lead','Contact','execute','length','contact','lead','Lead','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','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','string','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','clientId','clientSecret','login','username'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc93e,0x96));var _0xec93=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0xc93e[_0x28c939];return _0x527fe9;};'use strict';var _=require(_0xec93('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xec93('0x1'));var jsforce=require(_0xec93('0x2'));var util=require(_0xec93('0x3'));var Redis=require(_0xec93('0x4'));var intUtil=require(_0xec93('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xec93('0x6'));config[_0xec93('0x7')]=_[_0xec93('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xec93('0x9'))(new Redis(config['redis']));function emit(_0x13d9f2,_0x1ceb1b,_0x4010c1){io['to'](_0x13d9f2)[_0xec93('0xa')](_0x1ceb1b,_0x4010c1);}function getTicket(_0x4ca703,_0x459e09,_0x1437b9,_0x1c9eea,_0x3db296,_0x588f47,_0x46125e,_0x119232){var _0x2d8bc1={};if(_0x1c9eea[_0xec93('0xb')]===_0xec93('0xc')){_0x2d8bc1=Object[_0xec93('0xd')]({},{'OwnerId':_0x459e09['id'],'ActivityDate':moment[_0xec93('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xec93('0xf')](_0x1c9eea['Subjects'],_0x3db296,'\x20'),'Description':intUtil['getString'](_0x1c9eea[_0xec93('0x10')],_0x3db296,'\x0a')},getCustomFields(_0x588f47,_0x3db296));if(_0x1437b9){_0x2d8bc1[_0xec93('0x11')]=_0x1437b9['id'];}}else if(_0x1c9eea[_0xec93('0xb')]===_0xec93('0x12')){_0x2d8bc1=Object[_0xec93('0xd')]({},{'OwnerId':_0x459e09['id'],'Subject':intUtil[_0xec93('0xf')](_0x1c9eea[_0xec93('0x13')],_0x3db296,'\x20'),'Description':intUtil[_0xec93('0xf')](_0x1c9eea['Descriptions'],_0x3db296,'\x0a')},getCustomFields(_0x588f47,_0x3db296));if(_0x1437b9){_0x2d8bc1[_0xec93('0x14')]=_0x1437b9['id'];}}return _0x46125e[_0xec93('0x15')](_0x1c9eea[_0xec93('0xb')])[_0xec93('0x16')](_0x2d8bc1);}function getUser(_0x8d6e6f,_0x2fcd26,_0x22798f){if(!_[_0xec93('0x17')](_0x2fcd26)&&intUtil[_0xec93('0x18')](_0x2fcd26)){var _0x4797e7={'Email':_0x2fcd26};var _0x5cb86a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x22798f[_0xec93('0x15')]('User')[_0xec93('0x19')](_0x4797e7,_0x5cb86a)['execute']()[_0xec93('0x1a')](function(_0x4e761f){if(_0x4e761f['length']){var _0x1f6912=_[_0xec93('0x19')](_0x4e761f,function(_0x5dca7b){return _0x5dca7b[_0xec93('0x1b')]===_0x2fcd26;});if(_0x1f6912){logger[_0xec93('0x1c')](_0xec93('0x1d'),_0x2fcd26);return BPromise[_0xec93('0x1e')]({'id':_0x1f6912['Id'],'name':_0x1f6912[_0xec93('0x1f')]});}}else{logger[_0xec93('0x1c')](_0xec93('0x20'),_0x2fcd26);return _0x22798f[_0xec93('0x21')]()['then'](function(_0x2f8c91){return BPromise[_0xec93('0x1e')]({'id':_0x2f8c91[_0xec93('0x22')],'name':_0x2f8c91[_0xec93('0x23')]});});}});}else{logger[_0xec93('0x1c')](_0xec93('0x20'),_0x2fcd26);return _0x22798f[_0xec93('0x21')]()['then'](function(_0x3af788){return BPromise[_0xec93('0x1e')]({'id':_0x3af788['user_id'],'name':_0x3af788['display_name']});});}}function getEndUser(_0x50d361,_0x60a0f8,_0x1840c6,_0x5a3682,_0x5a19df){var _0x5cdf53={'Phone':_0x5a3682};var _0x171827={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xec93('0x1e')]()[_0xec93('0x1a')](function(){if(_0x60a0f8['ticketType']===_0xec93('0xc')){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5a3682,_0x60a0f8[_0xec93('0x24')]);switch(_0x60a0f8[_0xec93('0x24')]){case _0xec93('0x25'):return _0x5a19df[_0xec93('0x15')](_0xec93('0x26'))[_0xec93('0x19')](_0x5cdf53,_0x171827)[_0xec93('0x27')]()['then'](function(_0x1a3daf){if(_0x1a3daf&&_0x1a3daf[_0xec93('0x28')]){return _0x1a3daf;}else{return _0x5a19df[_0xec93('0x15')]('Lead')['find'](_0x5cdf53,_0x171827);}});case _0xec93('0x29'):return _0x5a19df[_0xec93('0x15')](_0xec93('0x26'))['find'](_0x5cdf53,_0x171827)[_0xec93('0x27')]();case _0xec93('0x2a'):return _0x5a19df[_0xec93('0x15')](_0xec93('0x2b'))['find'](_0x5cdf53,_0x171827);default:return null;}}else if(_0x60a0f8['ticketType']===_0xec93('0x12')){logger[_0xec93('0x1c')](_0xec93('0x2c'),_0x5a3682,'contact');return _0x5a19df['sobject']('Contact')[_0xec93('0x19')](_0x5cdf53,_0x171827)[_0xec93('0x27')]();}})[_0xec93('0x1a')](function(_0x3a7a7a){if(_0x3a7a7a&&_0x3a7a7a['length']){var _0xc72016=_[_0xec93('0x19')](_0x3a7a7a,function(_0x16115a){return _0x16115a[_0xec93('0x2d')]===_0x5a3682;});if(_0xc72016){return BPromise['resolve']({'id':_0xc72016['Id'],'name':_0xc72016['Name'],'phone':_0xc72016['Phone']});}}})[_0xec93('0x1a')](function(_0x78688c){if(_0x78688c){logger[_0xec93('0x1c')](_0xec93('0x2e'),_0x5a3682);return BPromise[_0xec93('0x1e')](_0x78688c);}else{logger['info'](_0xec93('0x2f'),_0x5a3682);var _0x5335b2={'LastName':_0x1840c6!==_0xec93('0x30')?_0x1840c6:util[_0xec93('0x31')](_0xec93('0x32'),_0x5a3682),'Phone':_0x5a3682};if(_0x60a0f8[_0xec93('0x33')]){if(_0x60a0f8['moduleCreate']===_0xec93('0x29')){logger[_0xec93('0x1c')](_0xec93('0x34'),_0x5a3682,_0x60a0f8[_0xec93('0x33')]);}else if(_0x60a0f8[_0xec93('0x33')]===_0xec93('0x2a')&&_0x60a0f8[_0xec93('0xb')]===_0xec93('0xc')){logger[_0xec93('0x1c')](_0xec93('0x34'),_0x5a3682,_0x60a0f8[_0xec93('0x33')]);_0x5335b2[_0xec93('0x35')]=_0xec93('0x36');}else{return null;}}return _0x5a19df[_0xec93('0x15')](_[_0xec93('0x37')](_0x60a0f8[_0xec93('0x33')]))['create'](_0x5335b2);}});}function getCustomFields(_0x3d6b13,_0xaceebd){var _0x55c4ec={};if(_0x3d6b13[_0xec93('0x28')]>0x0){_[_0xec93('0x38')](_0x3d6b13,function(_0x58dac7){if(_0x58dac7[_0xec93('0x39')]===_0xec93('0x3a')&&_0x58dac7[_0xec93('0x3b')]){_0x55c4ec[_0x58dac7[_0xec93('0x3b')]]=_0x58dac7[_0xec93('0x3c')]['toString']();}else if(_0x58dac7[_0xec93('0x39')]===_0xec93('0x3d')&&_0x58dac7[_0xec93('0x3e')]&&_0x58dac7[_0xec93('0x3b')]){_0xaceebd[_0x58dac7[_0xec93('0x3e')]]&&(_0x55c4ec[_0x58dac7['idField']]=_0xaceebd[_0x58dac7[_0xec93('0x3e')]][_0xec93('0x3f')]());}else if(_0x58dac7[_0xec93('0x39')]===_0xec93('0x40')&&_0x58dac7[_0xec93('0x41')]&&_0x58dac7['Variable'][_0xec93('0x42')]&&_0x58dac7[_0xec93('0x3b')]){_0xaceebd[_0x58dac7['Variable']['name']['toLowerCase']()]&&(_0x55c4ec[_0x58dac7[_0xec93('0x3b')]]=_0xaceebd[_0x58dac7['Variable'][_0xec93('0x42')][_0xec93('0x43')]()][_0xec93('0x3f')]());}});}return _0x55c4ec;}function getConnection(_0x10e506){var _0x59dca1=_0x10e506[_0xec93('0x44')][_0xec93('0x45')](_0x10e506['securityToken']);var _0x5028d4=new jsforce[(_0xec93('0x46'))]({'oauth2':{'loginUrl':_0x10e506[_0xec93('0x47')]||'https://login.salesforce.com','clientId':_0x10e506[_0xec93('0x48')],'clientSecret':_0x10e506[_0xec93('0x49')]}});return _0x5028d4[_0xec93('0x4a')](_0x10e506[_0xec93('0x4b')],_0x59dca1)[_0xec93('0x1a')](function(){logger[_0xec93('0x1c')](_0xec93('0x4c'));return _0x5028d4;});}exports['queue']=function(_0x22a398,_0x5dc5ca,_0x256801,_0x3f0974,_0x4fe59a,_0x24406d){var _0x4b9618,_0x1d928a,_0xe82a95,_0x1f1ef5;_0x24406d[_0xec93('0x4d')]=intUtil[_0xec93('0x4e')](_0x24406d[_0xec93('0x4d')]);_0x24406d[_0xec93('0x47')]=intUtil[_0xec93('0x4e')](_0x24406d[_0xec93('0x47')]);if(_0x4fe59a&&_0x4fe59a[_0xec93('0x4f')]){logger['info'](_0xec93('0x50'),'Recording\x20is\x20enabled!');_0x5dc5ca[_0xec93('0x51')]=util[_0xec93('0x31')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x24406d[_0xec93('0x4d')],_0x5dc5ca[_0xec93('0x52')],md5(_0x5dc5ca[_0xec93('0x52')]));}else{_0x5dc5ca[_0xec93('0x51')]='';}return getConnection(_0x24406d)[_0xec93('0x1a')](function(_0x365add){_0x1f1ef5=_0x365add;return getUser(_0x24406d,_0x3f0974[_0xec93('0x53')],_0x1f1ef5);})[_0xec93('0x1a')](function(_0x58ccde){_0x4b9618=_0x58ccde;return getEndUser(_0x24406d,_0x256801,_0x5dc5ca['calleridname'],_0x5dc5ca[_0xec93('0x54')],_0x1f1ef5);})[_0xec93('0x1a')](function(_0x4b798a){_0x1d928a=_0x4b798a;return getTicket(_0x24406d,_0x4b9618,_0x1d928a,_0x256801,_0x5dc5ca,_0x256801['Fields'],_0x1f1ef5,'queue');})[_0xec93('0x1a')](function(_0x4e4721){_0xe82a95=_0x4e4721;logger[_0xec93('0x1c')](_0xec93('0x55'),_0xe82a95['id']);logger['info'](_0xec93('0x56'),_0xe82a95['id'],_0x3f0974[_0xec93('0x42')],_0x24406d['type']);switch(_0x24406d[_0xec93('0x39')]){case _0xec93('0x57'):emit(util['format'](_0xec93('0x58'),_0x3f0974['name']),_0xec93('0x59'),{'recordId':_0xe82a95['id']});break;case _0xec93('0x5a'):emit(util['format']('user:%s',_0x3f0974[_0xec93('0x42')]),_0xec93('0x5b'),{'uri':util[_0xec93('0x31')]('%s/%s/e',_0x1f1ef5[_0xec93('0x5c')],_0xe82a95['id'])});break;default:logger[_0xec93('0x5d')](_0xec93('0x5e'));}})['catch'](function(_0x4cd1c5){logger['error'](_0xec93('0x50'),JSON['stringify'](_0x4cd1c5));});};exports[_0xec93('0x5f')]=function(_0x2864f2,_0x14afd3,_0x40d991,_0x536c50,_0x4121a9,_0x3aedc2,_0x574f59){var _0x250471,_0x536860,_0x5166f7,_0x4c88b9;_0x3aedc2[_0xec93('0x4d')]=intUtil[_0xec93('0x4e')](_0x3aedc2['serverUrl']);_0x3aedc2[_0xec93('0x47')]=intUtil[_0xec93('0x4e')](_0x3aedc2[_0xec93('0x47')]);if(_0x574f59&&_0x574f59[_0xec93('0x60')]&&_0x574f59[_0xec93('0x60')]!==_0xec93('0x61')){logger[_0xec93('0x1c')]('[OUTBOUND]',_0xec93('0x62'));_0x14afd3[_0xec93('0x51')]=util[_0xec93('0x31')](_0xec93('0x63'),_0x3aedc2['serverUrl'],_0x14afd3['uniqueid'],md5(_0x14afd3['uniqueid']));}return getConnection(_0x3aedc2)[_0xec93('0x1a')](function(_0x508a46){_0x4c88b9=_0x508a46;return getUser(_0x3aedc2,_0x536c50[_0xec93('0x53')],_0x4c88b9);})[_0xec93('0x1a')](function(_0xf3659c){_0x250471=_0xf3659c;return getEndUser(_0x3aedc2,_0x40d991,_0x14afd3[_0xec93('0x64')],_0x14afd3[_0xec93('0x65')],_0x4c88b9);})[_0xec93('0x1a')](function(_0x12b50f){_0x536860=_0x12b50f;return getTicket(_0x3aedc2,_0x250471,_0x536860,_0x40d991,_0x14afd3,_0x40d991['Fields'],_0x4c88b9,_0xec93('0x5f'));})['then'](function(_0x12e2a7){_0x5166f7=_0x12e2a7;logger[_0xec93('0x1c')](_0xec93('0x66'),_0x5166f7['id']);logger['info'](_0xec93('0x67'),_0x5166f7['id'],_0x536c50[_0xec93('0x42')],_0x3aedc2['type']);switch(_0x3aedc2[_0xec93('0x39')]){case _0xec93('0x57'):emit(util[_0xec93('0x31')](_0xec93('0x58'),_0x536c50[_0xec93('0x42')]),'trigger:salesforce:display',{'recordId':_0x5166f7['id']});break;case _0xec93('0x5a'):emit(util[_0xec93('0x31')](_0xec93('0x58'),_0x536c50['name']),'trigger:browser:url',{'uri':util[_0xec93('0x31')](_0xec93('0x68'),_0x4c88b9[_0xec93('0x5c')],_0x5166f7['id'])});break;default:logger[_0xec93('0x5d')](_0xec93('0x69'),_0xec93('0x6a'));}})[_0xec93('0x6b')](function(_0x979d90){logger[_0xec93('0x5d')]('[OUTBOUND]',JSON[_0xec93('0x6c')](_0x979d90));});};exports['abandoned']=function(_0x3cd821,_0x515325,_0x2ec5f6,_0x587ecb,_0x44839e,_0xd3d7b4){var _0x16cc5b,_0x4f0d79,_0x2b96a2,_0xa4b6dc;_0xd3d7b4[_0xec93('0x4d')]=intUtil['stripTrailingSlash'](_0xd3d7b4[_0xec93('0x4d')]);_0xd3d7b4[_0xec93('0x47')]=intUtil[_0xec93('0x4e')](_0xd3d7b4[_0xec93('0x47')]);if(_0x44839e&&_0x44839e[_0xec93('0x4f')]){logger[_0xec93('0x1c')](_0xec93('0x6d'),_0xec93('0x62'));_0x515325[_0xec93('0x51')]=util[_0xec93('0x31')](_0xec93('0x63'),_0xd3d7b4['serverUrl'],_0x515325[_0xec93('0x52')],md5(_0x515325[_0xec93('0x52')]));}else{_0x515325[_0xec93('0x51')]='';}return getConnection(_0xd3d7b4)[_0xec93('0x1a')](function(_0x4b639c){_0xa4b6dc=_0x4b639c;if(!_['isNil'](_0x587ecb)){return getUser(_0xd3d7b4,_0x587ecb['name'],_0xa4b6dc);}else{return getUser(_0xd3d7b4,null,_0xa4b6dc);}})[_0xec93('0x1a')](function(_0x5ea575){_0x16cc5b=_0x5ea575;return getEndUser(_0xd3d7b4,_0x2ec5f6,_0x515325[_0xec93('0x6e')],_0x515325['calleridnum'],_0xa4b6dc);})[_0xec93('0x1a')](function(_0x270712){_0x4f0d79=_0x270712;return getTicket(_0xd3d7b4,_0x16cc5b,_0x4f0d79,_0x2ec5f6,_0x515325,_0x2ec5f6[_0xec93('0x6f')],_0xa4b6dc);})[_0xec93('0x1a')](function(_0x591ac6){_0x2b96a2=_0x591ac6;logger[_0xec93('0x1c')](_0xec93('0x70'),_0x2b96a2['id']);logger[_0xec93('0x1c')]('[ABANDONED]\x20Integration\x20account\x20type\x20%s.',_0xd3d7b4[_0xec93('0x39')]);})[_0xec93('0x6b')](function(_0x4278e0){logger[_0xec93('0x5d')](_0xec93('0x6d'),JSON[_0xec93('0x6c')](_0x4278e0));});}; \ No newline at end of file +var _0x0483=['[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','emit','ticketType','Task','assign','getString','Subjects','Descriptions','WhoId','ContactId','sobject','isNil','validateEmail','User','execute','length','find','Email','Agent\x20%s\x20found.','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','Lead','contact','lead','Case','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','create','forEach','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','user:%s','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','stringify','outbound','stripTrailingSlash','recordingFormat','Recording\x20is\x20enabled!','uniqueid','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','integrationTab','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','catch','abandoned','[ABANDONED]','recordingURL','calleridnum'];(function(_0x207203,_0x368c97){var _0x250337=function(_0x4559ab){while(--_0x4559ab){_0x207203['push'](_0x207203['shift']());}};_0x250337(++_0x368c97);}(_0x0483,0xda));var _0x3048=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0x0483[_0x4a3898];return _0x25ceb0;};'use strict';var _=require(_0x3048('0x0'));var rp=require(_0x3048('0x1'));var moment=require('moment');var BPromise=require(_0x3048('0x2'));var md5=require(_0x3048('0x3'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0x3048('0x4'));var intUtil=require(_0x3048('0x5'));var config=require(_0x3048('0x6'));var logger=require(_0x3048('0x7'))(_0x3048('0x8'));config[_0x3048('0x9')]=_['defaults'](config[_0x3048('0x9')],{'host':_0x3048('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x3956fd,_0x4f6cf6,_0x121f3a){io['to'](_0x3956fd)[_0x3048('0xb')](_0x4f6cf6,_0x121f3a);}function getTicket(_0xb2e9ef,_0x23dec7,_0x214356,_0x32b0d0,_0x5d7000,_0x2fb96b,_0x546999,_0x398657){var _0x3caae1={};if(_0x32b0d0[_0x3048('0xc')]===_0x3048('0xd')){_0x3caae1=Object[_0x3048('0xe')]({},{'OwnerId':_0x23dec7['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x3048('0xf')](_0x32b0d0[_0x3048('0x10')],_0x5d7000,'\x20'),'Description':intUtil[_0x3048('0xf')](_0x32b0d0[_0x3048('0x11')],_0x5d7000,'\x0a')},getCustomFields(_0x2fb96b,_0x5d7000));if(_0x214356){_0x3caae1[_0x3048('0x12')]=_0x214356['id'];}}else if(_0x32b0d0['ticketType']==='Case'){_0x3caae1=Object[_0x3048('0xe')]({},{'OwnerId':_0x23dec7['id'],'Subject':intUtil['getString'](_0x32b0d0['Subjects'],_0x5d7000,'\x20'),'Description':intUtil[_0x3048('0xf')](_0x32b0d0[_0x3048('0x11')],_0x5d7000,'\x0a')},getCustomFields(_0x2fb96b,_0x5d7000));if(_0x214356){_0x3caae1[_0x3048('0x13')]=_0x214356['id'];}}return _0x546999[_0x3048('0x14')](_0x32b0d0['ticketType'])['create'](_0x3caae1);}function getUser(_0x59b824,_0x1779b4,_0x264f17){if(!_[_0x3048('0x15')](_0x1779b4)&&intUtil[_0x3048('0x16')](_0x1779b4)){var _0x33508d={'Email':_0x1779b4};var _0x2d4e58={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x264f17['sobject'](_0x3048('0x17'))['find'](_0x33508d,_0x2d4e58)[_0x3048('0x18')]()['then'](function(_0x4b69cd){if(_0x4b69cd[_0x3048('0x19')]){var _0x260ab5=_[_0x3048('0x1a')](_0x4b69cd,function(_0x1bde99){return _0x1bde99[_0x3048('0x1b')]===_0x1779b4;});if(_0x260ab5){logger['info'](_0x3048('0x1c'),_0x1779b4);return BPromise[_0x3048('0x1d')]({'id':_0x260ab5['Id'],'name':_0x260ab5[_0x3048('0x1e')]});}}else{logger[_0x3048('0x1f')](_0x3048('0x20'),_0x1779b4);return _0x264f17['identity']()[_0x3048('0x21')](function(_0x107909){return BPromise[_0x3048('0x1d')]({'id':_0x107909[_0x3048('0x22')],'name':_0x107909['display_name']});});}});}else{logger[_0x3048('0x1f')](_0x3048('0x20'),_0x1779b4);return _0x264f17[_0x3048('0x23')]()[_0x3048('0x21')](function(_0xa449ac){return BPromise[_0x3048('0x1d')]({'id':_0xa449ac[_0x3048('0x22')],'name':_0xa449ac['display_name']});});}}function getEndUser(_0x53d634,_0x1ea96f,_0x5155f9,_0x164525,_0x135a74){var _0xba10e={'Phone':_0x164525};var _0x5191f7={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3048('0x1d')]()[_0x3048('0x21')](function(){if(_0x1ea96f[_0x3048('0xc')]===_0x3048('0xd')){logger[_0x3048('0x1f')](_0x3048('0x24'),_0x164525,_0x1ea96f[_0x3048('0x25')]);switch(_0x1ea96f['moduleSearch']){case'contact_lead':return _0x135a74[_0x3048('0x14')](_0x3048('0x26'))[_0x3048('0x1a')](_0xba10e,_0x5191f7)[_0x3048('0x18')]()[_0x3048('0x21')](function(_0x1de7a0){if(_0x1de7a0&&_0x1de7a0[_0x3048('0x19')]){return _0x1de7a0;}else{return _0x135a74[_0x3048('0x14')](_0x3048('0x27'))[_0x3048('0x1a')](_0xba10e,_0x5191f7);}});case _0x3048('0x28'):return _0x135a74['sobject'](_0x3048('0x26'))[_0x3048('0x1a')](_0xba10e,_0x5191f7)[_0x3048('0x18')]();case _0x3048('0x29'):return _0x135a74[_0x3048('0x14')](_0x3048('0x27'))[_0x3048('0x1a')](_0xba10e,_0x5191f7);default:return null;}}else if(_0x1ea96f[_0x3048('0xc')]===_0x3048('0x2a')){logger[_0x3048('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x164525,_0x3048('0x28'));return _0x135a74[_0x3048('0x14')]('Contact')[_0x3048('0x1a')](_0xba10e,_0x5191f7)['execute']();}})[_0x3048('0x21')](function(_0x9ec5f4){if(_0x9ec5f4&&_0x9ec5f4[_0x3048('0x19')]){var _0x5f3f74=_[_0x3048('0x1a')](_0x9ec5f4,function(_0x4976fd){return _0x4976fd[_0x3048('0x2b')]===_0x164525;});if(_0x5f3f74){return BPromise[_0x3048('0x1d')]({'id':_0x5f3f74['Id'],'name':_0x5f3f74[_0x3048('0x1e')],'phone':_0x5f3f74['Phone']});}}})[_0x3048('0x21')](function(_0x660441){if(_0x660441){logger[_0x3048('0x1f')](_0x3048('0x2c'),_0x164525);return BPromise[_0x3048('0x1d')](_0x660441);}else{logger[_0x3048('0x1f')](_0x3048('0x2d'),_0x164525);var _0x262ed6={'LastName':_0x5155f9!==''?_0x5155f9:util[_0x3048('0x2e')]('Caller\x20-\x20%s',_0x164525),'Phone':_0x164525};if(_0x1ea96f[_0x3048('0x2f')]){if(_0x1ea96f[_0x3048('0x2f')]===_0x3048('0x28')){logger['info'](_0x3048('0x30'),_0x164525,_0x1ea96f['moduleCreate']);}else if(_0x1ea96f[_0x3048('0x2f')]===_0x3048('0x29')&&_0x1ea96f[_0x3048('0xc')]===_0x3048('0xd')){logger[_0x3048('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x164525,_0x1ea96f[_0x3048('0x2f')]);_0x262ed6[_0x3048('0x31')]=_0x3048('0x32');}else{return null;}}return _0x135a74[_0x3048('0x14')](_['upperFirst'](_0x1ea96f[_0x3048('0x2f')]))[_0x3048('0x33')](_0x262ed6);}});}function getCustomFields(_0x56da85,_0xc0c00d){var _0x546e96={};if(_0x56da85[_0x3048('0x19')]>0x0){_[_0x3048('0x34')](_0x56da85,function(_0x4117fc){if(_0x4117fc[_0x3048('0x35')]===_0x3048('0x36')&&_0x4117fc[_0x3048('0x37')]){_0x546e96[_0x4117fc[_0x3048('0x37')]]=_0x4117fc[_0x3048('0x38')][_0x3048('0x39')]();}else if(_0x4117fc[_0x3048('0x35')]===_0x3048('0x3a')&&_0x4117fc[_0x3048('0x3b')]&&_0x4117fc[_0x3048('0x37')]){_0xc0c00d[_0x4117fc[_0x3048('0x3b')]]&&(_0x546e96[_0x4117fc[_0x3048('0x37')]]=_0xc0c00d[_0x4117fc[_0x3048('0x3b')]]['toString']());}else if(_0x4117fc[_0x3048('0x35')]===_0x3048('0x3c')&&_0x4117fc[_0x3048('0x3d')]&&_0x4117fc[_0x3048('0x3d')][_0x3048('0x3e')]&&_0x4117fc[_0x3048('0x37')]){_0xc0c00d[_0x4117fc[_0x3048('0x3d')][_0x3048('0x3e')][_0x3048('0x3f')]()]&&(_0x546e96[_0x4117fc[_0x3048('0x37')]]=_0xc0c00d[_0x4117fc['Variable']['name']['toLowerCase']()][_0x3048('0x39')]());}});}return _0x546e96;}function getConnection(_0x230ed1){var _0x1fcd58=_0x230ed1[_0x3048('0x40')][_0x3048('0x41')](_0x230ed1['securityToken']);var _0x485d85=new jsforce[(_0x3048('0x42'))]({'oauth2':{'loginUrl':_0x230ed1[_0x3048('0x43')]||_0x3048('0x44'),'clientId':_0x230ed1[_0x3048('0x45')],'clientSecret':_0x230ed1[_0x3048('0x46')]}});return _0x485d85['login'](_0x230ed1[_0x3048('0x47')],_0x1fcd58)[_0x3048('0x21')](function(){logger['info'](_0x3048('0x48'));return _0x485d85;});}exports[_0x3048('0x49')]=function(_0x42c0e9,_0xfd12ae,_0x958485,_0x2cc8ca,_0x5aabd6,_0x169151){var _0x3e114c,_0x5667fc,_0x17795b,_0x8a749;_0x169151[_0x3048('0x4a')]=intUtil['stripTrailingSlash'](_0x169151[_0x3048('0x4a')]);_0x169151[_0x3048('0x43')]=intUtil['stripTrailingSlash'](_0x169151[_0x3048('0x43')]);if(_0x5aabd6&&_0x5aabd6[_0x3048('0x4b')]){logger[_0x3048('0x1f')]('[QUEUE]','Recording\x20is\x20enabled!');_0xfd12ae['recordingURL']=util[_0x3048('0x2e')](_0x3048('0x4c'),_0x169151[_0x3048('0x4a')],_0xfd12ae['uniqueid'],md5(_0xfd12ae['uniqueid']));}else{_0xfd12ae['recordingURL']='';}return getConnection(_0x169151)[_0x3048('0x21')](function(_0x38f54c){_0x8a749=_0x38f54c;return getUser(_0x169151,_0x2cc8ca[_0x3048('0x4d')],_0x8a749);})[_0x3048('0x21')](function(_0xbeecc){_0x3e114c=_0xbeecc;return getEndUser(_0x169151,_0x958485,_0xfd12ae[_0x3048('0x4e')],_0xfd12ae['calleridnum'],_0x8a749);})[_0x3048('0x21')](function(_0x23f345){_0x5667fc=_0x23f345;return getTicket(_0x169151,_0x3e114c,_0x5667fc,_0x958485,_0xfd12ae,_0x958485[_0x3048('0x4f')],_0x8a749,_0x3048('0x49'));})[_0x3048('0x21')](function(_0x3077ca){_0x17795b=_0x3077ca;logger[_0x3048('0x1f')](_0x3048('0x50'),_0x17795b['id']);logger['info'](_0x3048('0x51'),_0x17795b['id'],_0x2cc8ca[_0x3048('0x3e')],_0x169151[_0x3048('0x35')]);switch(_0x169151[_0x3048('0x35')]){case'integrationTab':emit(util['format']('user:%s',_0x2cc8ca[_0x3048('0x3e')]),_0x3048('0x52'),{'recordId':_0x17795b['id']});break;case _0x3048('0x53'):emit(util['format'](_0x3048('0x54'),_0x2cc8ca[_0x3048('0x3e')]),'trigger:browser:url',{'uri':util[_0x3048('0x2e')](_0x3048('0x55'),_0x8a749[_0x3048('0x56')],_0x17795b['id'])});break;default:logger[_0x3048('0x57')](_0x3048('0x58'));}})['catch'](function(_0x18e2b7){logger[_0x3048('0x57')](_0x3048('0x59'),JSON[_0x3048('0x5a')](_0x18e2b7));});};exports[_0x3048('0x5b')]=function(_0x49aa9a,_0x31070d,_0x23ba07,_0x9aacc1,_0x4aaadf,_0x12dc52,_0x127912){var _0x54b555,_0x43f76c,_0x3a91cb,_0x406761;_0x12dc52['serverUrl']=intUtil[_0x3048('0x5c')](_0x12dc52[_0x3048('0x4a')]);_0x12dc52[_0x3048('0x43')]=intUtil['stripTrailingSlash'](_0x12dc52['remoteUri']);if(_0x127912&&_0x127912[_0x3048('0x5d')]&&_0x127912[_0x3048('0x5d')]!=='none'){logger[_0x3048('0x1f')]('[OUTBOUND]',_0x3048('0x5e'));_0x31070d['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x12dc52[_0x3048('0x4a')],_0x31070d[_0x3048('0x5f')],md5(_0x31070d[_0x3048('0x5f')]));}return getConnection(_0x12dc52)['then'](function(_0x1c355b){_0x406761=_0x1c355b;return getUser(_0x12dc52,_0x9aacc1['email'],_0x406761);})[_0x3048('0x21')](function(_0x381461){_0x54b555=_0x381461;return getEndUser(_0x12dc52,_0x23ba07,_0x31070d[_0x3048('0x60')],_0x31070d['destcalleridnum'],_0x406761);})['then'](function(_0x4d2c34){_0x43f76c=_0x4d2c34;return getTicket(_0x12dc52,_0x54b555,_0x43f76c,_0x23ba07,_0x31070d,_0x23ba07[_0x3048('0x4f')],_0x406761,'outbound');})[_0x3048('0x21')](function(_0x48fa34){_0x3a91cb=_0x48fa34;logger[_0x3048('0x1f')](_0x3048('0x61'),_0x3a91cb['id']);logger['info']('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3a91cb['id'],_0x9aacc1['name'],_0x12dc52[_0x3048('0x35')]);switch(_0x12dc52['type']){case _0x3048('0x62'):emit(util[_0x3048('0x2e')](_0x3048('0x54'),_0x9aacc1[_0x3048('0x3e')]),_0x3048('0x52'),{'recordId':_0x3a91cb['id']});break;case'newTab':emit(util[_0x3048('0x2e')]('user:%s',_0x9aacc1['name']),'trigger:browser:url',{'uri':util[_0x3048('0x2e')]('%s/%s/e',_0x406761[_0x3048('0x56')],_0x3a91cb['id'])});break;default:logger[_0x3048('0x57')](_0x3048('0x63'),_0x3048('0x64'));}})[_0x3048('0x65')](function(_0x2bc425){logger[_0x3048('0x57')](_0x3048('0x63'),JSON[_0x3048('0x5a')](_0x2bc425));});};exports[_0x3048('0x66')]=function(_0xc61e27,_0x26263f,_0x2a2775,_0x2624d8,_0xdb51bc,_0x51d848){var _0x5a3209,_0x440cc8,_0x421178,_0x13d4af;_0x51d848[_0x3048('0x4a')]=intUtil['stripTrailingSlash'](_0x51d848[_0x3048('0x4a')]);_0x51d848['remoteUri']=intUtil[_0x3048('0x5c')](_0x51d848['remoteUri']);if(_0xdb51bc&&_0xdb51bc[_0x3048('0x4b')]){logger[_0x3048('0x1f')](_0x3048('0x67'),_0x3048('0x5e'));_0x26263f['recordingURL']=util[_0x3048('0x2e')](_0x3048('0x4c'),_0x51d848['serverUrl'],_0x26263f[_0x3048('0x5f')],md5(_0x26263f[_0x3048('0x5f')]));}else{_0x26263f[_0x3048('0x68')]='';}return getConnection(_0x51d848)[_0x3048('0x21')](function(_0x27c481){_0x13d4af=_0x27c481;if(!_[_0x3048('0x15')](_0x2624d8)){return getUser(_0x51d848,_0x2624d8['name'],_0x13d4af);}else{return getUser(_0x51d848,null,_0x13d4af);}})[_0x3048('0x21')](function(_0x7057c0){_0x5a3209=_0x7057c0;return getEndUser(_0x51d848,_0x2a2775,_0x26263f['calleridname'],_0x26263f[_0x3048('0x69')],_0x13d4af);})[_0x3048('0x21')](function(_0x4ee71d){_0x440cc8=_0x4ee71d;return getTicket(_0x51d848,_0x5a3209,_0x440cc8,_0x2a2775,_0x26263f,_0x2a2775[_0x3048('0x4f')],_0x13d4af);})[_0x3048('0x21')](function(_0x5bf4af){_0x421178=_0x5bf4af;logger[_0x3048('0x1f')](_0x3048('0x6a'),_0x421178['id']);logger[_0x3048('0x1f')](_0x3048('0x6b'),_0x51d848[_0x3048('0x35')]);})['catch'](function(_0x471fd2){logger[_0x3048('0x57')]('[ABANDONED]',JSON[_0x3048('0x5a')](_0x471fd2));});}; \ 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 63c3b0b..d1307dc 100644 --- a/server/services/ami/trigger/integration/servicenow.js +++ b/server/services/ami/trigger/integration/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/sugarcrm.js b/server/services/ami/trigger/integration/sugarcrm.js index 4d5aaf4..aa545f8 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 _0x1f19=['toLowerCase','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','recordingURL','catch','abandoned','%s/service/v4_1/rest.php','[ABANDONED]','isNil','lodash','request-promise','bluebird','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','localhost','socket.io-emitter','redis','POST','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','set_entry','Calls','format','Basic\x20%s','apiKey','JSON','stringify','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','customField','content','toString','idField','custom_fields','push','variable','customVariable','Variable'];(function(_0x300669,_0x52e15c){var _0x331026=function(_0x557277){while(--_0x557277){_0x300669['push'](_0x300669['shift']());}};_0x331026(++_0x52e15c);}(_0x1f19,0xa2));var _0x91f1=function(_0x381fe5,_0x1827a1){_0x381fe5=_0x381fe5-0x0;var _0x7f76cc=_0x1f19[_0x381fe5];return _0x7f76cc;};'use strict';var _=require(_0x91f1('0x0'));var rp=require(_0x91f1('0x1'));var BPromise=require(_0x91f1('0x2'));var md5=require('md5');var util=require(_0x91f1('0x3'));var Redis=require(_0x91f1('0x4'));var intUtil=require('./util');var config=require(_0x91f1('0x5'));var logger=require(_0x91f1('0x6'))(_0x91f1('0x7'));config['redis']=_[_0x91f1('0x8')](config['redis'],{'host':_0x91f1('0x9'),'port':0x18eb});var io=require(_0x91f1('0xa'))(new Redis(config[_0x91f1('0xb')]));var def={'method':_0x91f1('0xc'),'json':!![]};function emit(_0x2150ef,_0x4f974a,_0x1817cd){io['to'](_0x2150ef)[_0x91f1('0xd')](_0x4f974a,_0x1817cd);}function getTicket(_0x30a7e7,_0x5f4633,_0x10d509,_0x8dbb9c,_0x50a70f,_0x21cdf0,_0x586baf,_0x182aa8){logger[_0x91f1('0xe')]('Creating\x20new\x20ticket...');var _0x3b3481=new Date();var _0x30f60d=[{'name':_0x91f1('0xf'),'value':intUtil[_0x91f1('0x10')](_0x8dbb9c[_0x91f1('0x11')],_0x50a70f,'\x20')},{'name':_0x91f1('0x12'),'value':_0x5f4633['id']},{'name':_0x91f1('0x13'),'value':_0x5f4633['id']},{'name':_0x91f1('0x14'),'value':intUtil['getString'](_0x8dbb9c[_0x91f1('0x15')],_0x50a70f,'\x0a')},{'name':'date_start','value':_0x3b3481['toISOString']()[_0x91f1('0x16')](0x0,0x13)[_0x91f1('0x17')]('T','\x20')},{'name':_0x91f1('0x18'),'value':'0'},{'name':_0x91f1('0x19'),'value':'15'},{'name':_0x91f1('0x1a'),'value':_0x10d509['id']},{'name':_0x91f1('0x1b'),'value':_0x91f1('0x1c')},{'name':_0x91f1('0x1d'),'value':_0x10d509[_0x91f1('0xf')]},{'name':_0x91f1('0x1e'),'value':_0x182aa8}];if(_0x21cdf0[_0x91f1('0x1f')]){_[_0x91f1('0x20')](_0x21cdf0,function(_0x4ada06){if(_0x50a70f[_0x4ada06['variableName']]){_0x30f60d['push']({'name':_0x4ada06['idField'],'value':_0x50a70f[_0x4ada06['variableName']]});}});}return request({'form':{'method':_0x91f1('0x21'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x586baf['id'],'module_name':_0x91f1('0x22'),'name_value_list':_0x30f60d})}});}function getAuth(_0x7e492e){return util[_0x91f1('0x23')](_0x91f1('0x24'),new Buffer(_0x7e492e[_0x91f1('0x25')]+':X')['toString']('base64'));}function getServerInfo(_0x564c20){return request({'form':{'method':'get_server_info','input_type':_0x91f1('0x26'),'response_type':_0x91f1('0x26'),'rest_data':JSON[_0x91f1('0x27')]({'session':_0x564c20['id']})}});}function getUser(_0x16b27f,_0x25d113,_0x141fda){if(!_['isNil'](_0x25d113)){logger[_0x91f1('0xe')]('Getting\x20agent\x20with\x20name',_0x25d113);return request({'form':{'method':_0x91f1('0x28'),'input_type':_0x91f1('0x26'),'response_type':_0x91f1('0x26'),'rest_data':JSON['stringify']({'session':_0x141fda['id'],'module_name':_0x91f1('0x29'),'query':util[_0x91f1('0x23')](_0x91f1('0x2a'),_0x25d113),'order_by':'','offset':'0','select_fields':['id',_0x91f1('0xf'),_0x91f1('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x2c1a0a){if(_0x2c1a0a[_0x91f1('0x2c')][_0x91f1('0x1f')]){var _0x559c11=_[_0x91f1('0x2d')](_0x2c1a0a[_0x91f1('0x2c')],function(_0x4a0e5e){return _0x4a0e5e[_0x91f1('0x2e')][_0x91f1('0x2b')][_0x91f1('0x2f')]===_0x25d113;});if(_0x559c11){logger['info'](_0x91f1('0x30'));return BPromise[_0x91f1('0x31')]({'id':_0x559c11['name_value_list']['id'][_0x91f1('0x2f')],'name':_0x559c11[_0x91f1('0x2e')][_0x91f1('0xf')][_0x91f1('0x2f')]});}}logger['info'](_0x91f1('0x32'));return BPromise['resolve']({'id':_0x141fda[_0x91f1('0x2e')][_0x91f1('0x33')]['value'],'name':_0x141fda['name_value_list'][_0x91f1('0x2b')]['value']});});}else{logger[_0x91f1('0xe')](_0x91f1('0x34'));return BPromise[_0x91f1('0x31')]({'id':_0x141fda[_0x91f1('0x2e')]['user_id']['value'],'name':_0x141fda[_0x91f1('0x2e')][_0x91f1('0x2b')][_0x91f1('0x2f')]});}}function getEndUser(_0xeeb37c,_0x248d51,_0x531894,_0x40c86e){logger[_0x91f1('0xe')](_0x91f1('0x35'),_0x531894);return request({'form':{'method':_0x91f1('0x28'),'input_type':_0x91f1('0x26'),'response_type':_0x91f1('0x26'),'rest_data':JSON['stringify']({'session':_0x40c86e['id'],'module_name':_0x91f1('0x1c'),'query':util[_0x91f1('0x23')](_0x91f1('0x36'),_0x531894),'order_by':'','offset':'0','select_fields':['id',_0x91f1('0xf'),_0x91f1('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x91f1('0x38')](function(_0x51e13f){if(_0x51e13f['entry_list'][_0x91f1('0x1f')]){var _0x3f2dce=_[_0x91f1('0x2d')](_0x51e13f['entry_list'],function(_0x3fb168){return _0x3fb168[_0x91f1('0x2e')][_0x91f1('0x37')][_0x91f1('0x2f')]===_0x531894;});if(_0x3f2dce){logger[_0x91f1('0xe')](_0x91f1('0x39'));return BPromise[_0x91f1('0x31')]({'id':_0x3f2dce[_0x91f1('0x2e')]['id'][_0x91f1('0x2f')],'name':_0x3f2dce[_0x91f1('0x2e')]['name'][_0x91f1('0x2f')],'phone':_0x3f2dce[_0x91f1('0x2e')][_0x91f1('0x37')]['value']});}}else{logger[_0x91f1('0xe')](_0x91f1('0x3a'));return request({'form':{'method':'set_entry','input_type':_0x91f1('0x26'),'response_type':_0x91f1('0x26'),'rest_data':JSON[_0x91f1('0x27')]({'session':_0x40c86e['id'],'module_name':_0x91f1('0x1c'),'name_value_list':[{'name':_0x91f1('0x3b'),'value':_0x248d51!==''?_0x248d51:util[_0x91f1('0x23')](_0x91f1('0x3c'),_0x531894)},{'name':_0x91f1('0x37'),'value':_0x531894}]})}})[_0x91f1('0x38')](function(_0x34268c){logger['info'](_0x91f1('0x3d'));return BPromise[_0x91f1('0x31')]({'id':_0x34268c['id'],'name':_0x34268c[_0x91f1('0x2c')][_0x91f1('0x3b')]['value'],'phone':_0x34268c[_0x91f1('0x2c')][_0x91f1('0x37')][_0x91f1('0x2f')]});});}});}function request(_0x1c5e0d){logger[_0x91f1('0x3e')](_0x91f1('0x3f'),JSON[_0x91f1('0x27')](_0x1c5e0d));return rp(_[_0x91f1('0x40')](def,_0x1c5e0d));}function getTags(_0x3bd6b1,_0x176dea){var _0x3ac793=[];if(_0x3bd6b1&&_0x3bd6b1[_0x91f1('0x1f')]>0x0){_0x3ac793=_[_0x91f1('0x41')](_0x3bd6b1,_0x176dea);}return _0x3ac793;}function getCustomFields(_0x577359,_0x9d3e7b){var _0x2ab141=[];var _0x4704e1={'custom_fields':[]};if(_0x577359[_0x91f1('0x1f')]>0x0){_[_0x91f1('0x20')](_0x577359,function(_0xaa9ebd){if(_0xaa9ebd[_0x91f1('0x42')]===_0x91f1('0x43')&&_0xaa9ebd[_0x91f1('0x44')]&&!_0xaa9ebd[_0x91f1('0x45')]){_0x4704e1[_0xaa9ebd[_0x91f1('0x44')]['toLowerCase']()]=_0xaa9ebd[_0x91f1('0x46')][_0x91f1('0x47')]();}else if(_0xaa9ebd[_0x91f1('0x42')]==='string'&&_0xaa9ebd[_0x91f1('0x48')]&&_0xaa9ebd[_0x91f1('0x45')]){_0x4704e1[_0x91f1('0x49')][_0x91f1('0x4a')]({'id':_0xaa9ebd[_0x91f1('0x48')],'value':_0xaa9ebd['content'][_0x91f1('0x47')]()});}else if(_0xaa9ebd[_0x91f1('0x42')]===_0x91f1('0x4b')&&_0xaa9ebd['variableName']&&_0xaa9ebd['idField']&&_0xaa9ebd['customField']){_0x9d3e7b[_0xaa9ebd['variableName']]&&_0x4704e1[_0x91f1('0x49')][_0x91f1('0x4a')]({'id':_0xaa9ebd[_0x91f1('0x48')],'value':_0x9d3e7b[_0xaa9ebd['variableName']]['toString']()});}else if(_0xaa9ebd[_0x91f1('0x42')]===_0x91f1('0x4c')&&_0xaa9ebd[_0x91f1('0x4d')]&&_0xaa9ebd[_0x91f1('0x4d')]['name']&&_0xaa9ebd[_0x91f1('0x48')]&&_0xaa9ebd[_0x91f1('0x45')]){_0x9d3e7b[_0xaa9ebd[_0x91f1('0x4d')][_0x91f1('0xf')][_0x91f1('0x4e')]()]&&_0x4704e1[_0x91f1('0x49')][_0x91f1('0x4a')]({'id':_0xaa9ebd[_0x91f1('0x48')],'value':_0x9d3e7b[_0xaa9ebd[_0x91f1('0x4d')]['name'][_0x91f1('0x4e')]()]['toString']()});}});}return _0x4704e1;}function getConnection(_0x379371){return request({'method':_0x91f1('0xc'),'form':{'method':'login','input_type':'JSON','response_type':_0x91f1('0x26'),'rest_data':JSON[_0x91f1('0x27')]({'user_auth':{'user_name':_0x379371[_0x91f1('0x4f')],'password':_0x379371[_0x91f1('0x50')],'encryption':_0x91f1('0x51')},'application':_0x91f1('0x52')})}})[_0x91f1('0x38')](function(_0x3c08b7){var _0x2419e5=_0x3c08b7;if(_0x2419e5['id']){def[_0x91f1('0x53')]=_0x2419e5['id'];return BPromise[_0x91f1('0x31')](_0x2419e5);}else{throw new Error(util['format'](_0x91f1('0x54'),_0x379371['id']));}});}function setRelationship(_0x157e03,_0x31fd9e,_0xfeb487,_0x2d8ba7){return request({'form':{'method':_0x91f1('0x55'),'input_type':'JSON','response_type':_0x91f1('0x26'),'rest_data':JSON['stringify']({'session':_0x157e03['id'],'module_name':_0x91f1('0x22'),'module_id':_0xfeb487['id'],'link_field_name':_0x2d8ba7,'related_ids':[_0x31fd9e['id']]})}});}exports[_0x91f1('0x56')]=function(_0x4134bd,_0x305160,_0x4209fa,_0x636897,_0x22335d,_0x3b0b4c){var _0xfe3d89,_0x37770b,_0x244bf3,_0x38b879;_0x3b0b4c[_0x91f1('0x57')]=intUtil[_0x91f1('0x58')](_0x3b0b4c[_0x91f1('0x57')]);_0x3b0b4c[_0x91f1('0x59')]=intUtil[_0x91f1('0x58')](_0x3b0b4c['serverUrl']);def['uri']=util[_0x91f1('0x23')]('%s/service/v4_1/rest.php',_0x3b0b4c['remoteUri']);if(_0x22335d&&_0x22335d[_0x91f1('0x5a')]){logger[_0x91f1('0xe')](_0x91f1('0x5b'),_0x91f1('0x5c'));_0x305160['recordingURL']=util['format'](_0x91f1('0x5d'),_0x3b0b4c['serverUrl'],_0x305160[_0x91f1('0x5e')],md5(_0x305160[_0x91f1('0x5e')]));}else{_0x305160['recordingURL']='';}return getConnection(_0x3b0b4c)[_0x91f1('0x38')](function(_0x506d39){_0x38b879=_0x506d39;return getUser(_0x3b0b4c,_0x636897['name'],_0x38b879);})[_0x91f1('0x38')](function(_0x55c249){_0xfe3d89=_0x55c249;logger['info'](_0x91f1('0x5f'),_0xfe3d89['id']);return getEndUser(_0x3b0b4c,_0x305160[_0x91f1('0x60')],_0x305160[_0x91f1('0x61')],_0x38b879);})[_0x91f1('0x38')](function(_0x575a0e){_0x37770b=_0x575a0e;logger[_0x91f1('0xe')]('The\x20Enduser\x20ID\x20is:',_0x37770b['id']);return getTicket(_0x3b0b4c,_0xfe3d89,_0x37770b,_0x4209fa,_0x305160,_0x4209fa[_0x91f1('0x62')],_0x38b879,_0x91f1('0x63'));})[_0x91f1('0x38')](function(_0x331b01){_0x244bf3=_0x331b01;logger['info'](_0x91f1('0x64'));logger[_0x91f1('0xe')]('The\x20Ticket\x20ID\x20is:',_0x244bf3['id']);return setRelationship(_0x38b879,_0xfe3d89,_0x244bf3,_0x91f1('0x65'));})[_0x91f1('0x38')](function(){return setRelationship(_0x38b879,_0x37770b,_0x244bf3,_0x91f1('0x66'));})[_0x91f1('0x38')](function(){return getServerInfo(_0x38b879);})[_0x91f1('0x38')](function(_0x57a408){var _0x54de9f=parseInt(_0x57a408[_0x91f1('0x67')][_0x91f1('0x68')](0x0));var _0x1607df=util[_0x91f1('0x23')](_0x91f1('0x69'),_0x3b0b4c[_0x91f1('0x57')],_0x244bf3['id']);if(_0x54de9f>0x6){_0x1607df=util[_0x91f1('0x23')](_0x91f1('0x6a'),_0x3b0b4c[_0x91f1('0x57')],_0x244bf3['id']);}logger[_0x91f1('0xe')](_0x91f1('0x5b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x91f1('0x23')](_0x91f1('0x6b'),_0x636897[_0x91f1('0xf')]),_0x91f1('0x6c'),{'uri':_0x1607df});})['catch'](function(_0x2ad2c4){logger[_0x91f1('0x6d')]('[QUEUE]',JSON[_0x91f1('0x27')](_0x2ad2c4));});};exports[_0x91f1('0x6e')]=function(_0x13f635,_0x38b6e3,_0x40639b,_0xe20bff,_0x183781,_0x34b435,_0x263a36){var _0x26e427,_0x2849d7,_0x4171ef,_0x5f1431;_0x34b435[_0x91f1('0x57')]=intUtil['stripTrailingSlash'](_0x34b435[_0x91f1('0x57')]);_0x34b435[_0x91f1('0x59')]=intUtil[_0x91f1('0x58')](_0x34b435[_0x91f1('0x59')]);def['uri']=util[_0x91f1('0x23')]('%s/service/v4_1/rest.php',_0x34b435[_0x91f1('0x57')]);if(_0x263a36&&_0x263a36[_0x91f1('0x6f')]&&_0x263a36[_0x91f1('0x6f')]!==_0x91f1('0x70')){logger['info'](_0x91f1('0x71'),_0x91f1('0x5c'));_0x38b6e3[_0x91f1('0x72')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x34b435[_0x91f1('0x59')],_0x38b6e3[_0x91f1('0x5e')],md5(_0x38b6e3[_0x91f1('0x5e')]));}return getConnection(_0x34b435)['then'](function(_0x526d16){_0x5f1431=_0x526d16;return getUser(_0x34b435,_0xe20bff[_0x91f1('0xf')],_0x5f1431);})[_0x91f1('0x38')](function(_0x3f3368){_0x26e427=_0x3f3368;logger[_0x91f1('0xe')](_0x91f1('0x5f'),_0x26e427['id']);return getEndUser(_0x34b435,_0x38b6e3['destcalleridname'],_0x38b6e3['destcalleridnum'],_0x5f1431);})[_0x91f1('0x38')](function(_0x5753c9){_0x2849d7=_0x5753c9;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2849d7['id']);return getTicket(_0x34b435,_0x26e427,_0x2849d7,_0x40639b,_0x38b6e3,_0x40639b[_0x91f1('0x62')],_0x5f1431,'Outbound');})[_0x91f1('0x38')](function(_0x56923e){_0x4171ef=_0x56923e;logger[_0x91f1('0xe')](_0x91f1('0x64'));logger[_0x91f1('0xe')]('The\x20Ticket\x20ID\x20is:',_0x4171ef['id']);return setRelationship(_0x5f1431,_0x26e427,_0x4171ef,_0x91f1('0x65'));})[_0x91f1('0x38')](function(){return setRelationship(_0x5f1431,_0x2849d7,_0x4171ef,_0x91f1('0x66'));})[_0x91f1('0x38')](function(){return getServerInfo(_0x5f1431);})[_0x91f1('0x38')](function(_0x462a64){var _0x5ecee4=parseInt(_0x462a64[_0x91f1('0x67')]['charAt'](0x0));var _0x3d70b0=util[_0x91f1('0x23')](_0x91f1('0x69'),_0x34b435[_0x91f1('0x57')],_0x4171ef['id']);if(_0x5ecee4>0x6){_0x3d70b0=util[_0x91f1('0x23')](_0x91f1('0x6a'),_0x34b435[_0x91f1('0x57')],_0x4171ef['id']);}logger[_0x91f1('0xe')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x91f1('0x6b'),_0xe20bff['name']),_0x91f1('0x6c'),{'uri':_0x3d70b0});})[_0x91f1('0x73')](function(_0x535917){logger[_0x91f1('0x6d')](_0x91f1('0x71'),JSON[_0x91f1('0x27')](_0x535917));});};exports[_0x91f1('0x74')]=function(_0xb001ef,_0xc47c70,_0x51b8f7,_0x552bf5,_0x4d4022,_0x1e4854){var _0x249984,_0x112564,_0x2e2657,_0x295132;_0x1e4854[_0x91f1('0x57')]=intUtil[_0x91f1('0x58')](_0x1e4854[_0x91f1('0x57')]);_0x1e4854[_0x91f1('0x59')]=intUtil[_0x91f1('0x58')](_0x1e4854['serverUrl']);def['uri']=util[_0x91f1('0x23')](_0x91f1('0x75'),_0x1e4854['remoteUri']);if(_0x4d4022&&_0x4d4022['monitor_format']){logger[_0x91f1('0xe')](_0x91f1('0x76'),'Recording\x20is\x20enabled!');_0xc47c70[_0x91f1('0x72')]=util[_0x91f1('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1e4854[_0x91f1('0x59')],_0xc47c70[_0x91f1('0x5e')],md5(_0xc47c70[_0x91f1('0x5e')]));}else{_0xc47c70['recordingURL']='';}return getConnection(_0x1e4854)[_0x91f1('0x38')](function(_0x27246e){_0x295132=_0x27246e;if(!_[_0x91f1('0x77')](_0x552bf5)){return getUser(_0x1e4854,_0x552bf5[_0x91f1('0xf')],_0x295132);}else{return getUser(_0x1e4854,null,_0x295132);}})[_0x91f1('0x38')](function(_0x171768){_0x249984=_0x171768;logger[_0x91f1('0xe')]('The\x20User\x20ID\x20is:',_0x249984['id']);return getEndUser(_0x1e4854,_0xc47c70['calleridname'],_0xc47c70[_0x91f1('0x61')],_0x295132);})[_0x91f1('0x38')](function(_0x1fc29e){_0x112564=_0x1fc29e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x112564['id']);return getTicket(_0x1e4854,_0x249984,_0x112564,_0x51b8f7,_0xc47c70,_0x51b8f7['Fields'],_0x295132,'Inbound');})[_0x91f1('0x38')](function(_0x566bb0){_0x2e2657=_0x566bb0;logger[_0x91f1('0xe')](_0x91f1('0x64'));logger[_0x91f1('0xe')]('The\x20Ticket\x20ID\x20is:',_0x2e2657['id']);return setRelationship(_0x295132,_0x249984,_0x2e2657,_0x91f1('0x65'));})[_0x91f1('0x38')](function(){return setRelationship(_0x295132,_0x112564,_0x2e2657,_0x91f1('0x66'));})[_0x91f1('0x38')](function(){return getServerInfo(_0x295132);})[_0x91f1('0x73')](function(_0x4eb9fa){logger[_0x91f1('0x6d')]('[ABANDONED]',JSON['stringify'](_0x4eb9fa));});}; \ No newline at end of file +var _0x131d=['Recording\x20is\x20enabled!','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','error','abandoned','[ABANDONED]','recordingURL','calleridname','Fields','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','Descriptions','date_start','toISOString','slice','duration_minutes','parent_id','parent_type','parent_name','direction','length','forEach','push','variableName','set_entry','JSON','Calls','apiKey','base64','stringify','isNil','info','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','name_value_list','user_name','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','then','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','merge','type','string','nameField','customField','toLowerCase','toString','idField','variable','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]'];(function(_0x22ed05,_0x36b420){var _0x597a3b=function(_0x2e4984){while(--_0x2e4984){_0x22ed05['push'](_0x22ed05['shift']());}};_0x597a3b(++_0x36b420);}(_0x131d,0x10a));var _0xd131=function(_0x5c8966,_0x7d7480){_0x5c8966=_0x5c8966-0x0;var _0x5675b0=_0x131d[_0x5c8966];return _0x5675b0;};'use strict';var _=require(_0xd131('0x0'));var rp=require(_0xd131('0x1'));var BPromise=require('bluebird');var md5=require(_0xd131('0x2'));var util=require(_0xd131('0x3'));var Redis=require(_0xd131('0x4'));var intUtil=require('./util');var config=require(_0xd131('0x5'));var logger=require(_0xd131('0x6'))('sugarcrm');config[_0xd131('0x7')]=_[_0xd131('0x8')](config[_0xd131('0x7')],{'host':_0xd131('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var def={'method':_0xd131('0xa'),'json':!![]};function emit(_0x2f277a,_0x13f9a2,_0x25cad2){io['to'](_0x2f277a)[_0xd131('0xb')](_0x13f9a2,_0x25cad2);}function getTicket(_0x4efd84,_0x5c9dbe,_0x1bdbd7,_0x5038fa,_0x2fc51a,_0x1104df,_0x495905,_0x56dad4){logger['info'](_0xd131('0xc'));var _0x278107=new Date();var _0x21823e=[{'name':_0xd131('0xd'),'value':intUtil[_0xd131('0xe')](_0x5038fa[_0xd131('0xf')],_0x2fc51a,'\x20')},{'name':'assigned_user_id','value':_0x5c9dbe['id']},{'name':'created_by','value':_0x5c9dbe['id']},{'name':'description','value':intUtil[_0xd131('0xe')](_0x5038fa[_0xd131('0x10')],_0x2fc51a,'\x0a')},{'name':_0xd131('0x11'),'value':_0x278107[_0xd131('0x12')]()[_0xd131('0x13')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xd131('0x14'),'value':'15'},{'name':_0xd131('0x15'),'value':_0x1bdbd7['id']},{'name':_0xd131('0x16'),'value':'Contacts'},{'name':_0xd131('0x17'),'value':_0x1bdbd7[_0xd131('0xd')]},{'name':_0xd131('0x18'),'value':_0x56dad4}];if(_0x1104df[_0xd131('0x19')]){_[_0xd131('0x1a')](_0x1104df,function(_0x1897a7){if(_0x2fc51a[_0x1897a7['variableName']]){_0x21823e[_0xd131('0x1b')]({'name':_0x1897a7['idField'],'value':_0x2fc51a[_0x1897a7[_0xd131('0x1c')]]});}});}return request({'form':{'method':_0xd131('0x1d'),'input_type':'JSON','response_type':_0xd131('0x1e'),'rest_data':JSON['stringify']({'session':_0x495905['id'],'module_name':_0xd131('0x1f'),'name_value_list':_0x21823e})}});}function getAuth(_0x33ba90){return util['format']('Basic\x20%s',new Buffer(_0x33ba90[_0xd131('0x20')]+':X')['toString'](_0xd131('0x21')));}function getServerInfo(_0x4c002c){return request({'form':{'method':'get_server_info','input_type':_0xd131('0x1e'),'response_type':_0xd131('0x1e'),'rest_data':JSON[_0xd131('0x22')]({'session':_0x4c002c['id']})}});}function getUser(_0x24a5ed,_0x50aa87,_0x3f5a0f){if(!_[_0xd131('0x23')](_0x50aa87)){logger[_0xd131('0x24')]('Getting\x20agent\x20with\x20name',_0x50aa87);return request({'form':{'method':'get_entry_list','input_type':_0xd131('0x1e'),'response_type':'JSON','rest_data':JSON[_0xd131('0x22')]({'session':_0x3f5a0f['id'],'module_name':_0xd131('0x25'),'query':util[_0xd131('0x26')](_0xd131('0x27'),_0x50aa87),'order_by':'','offset':'0','select_fields':['id',_0xd131('0xd'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x3b85bb){if(_0x3b85bb['entry_list']['length']){var _0x2dd650=_['find'](_0x3b85bb[_0xd131('0x28')],function(_0x27612f){return _0x27612f[_0xd131('0x29')][_0xd131('0x2a')]['value']===_0x50aa87;});if(_0x2dd650){logger[_0xd131('0x24')](_0xd131('0x2b'));return BPromise[_0xd131('0x2c')]({'id':_0x2dd650[_0xd131('0x29')]['id'][_0xd131('0x2d')],'name':_0x2dd650[_0xd131('0x29')][_0xd131('0xd')]['value']});}}logger[_0xd131('0x24')](_0xd131('0x2e'));return BPromise['resolve']({'id':_0x3f5a0f[_0xd131('0x29')]['user_id'][_0xd131('0x2d')],'name':_0x3f5a0f[_0xd131('0x29')]['user_name'][_0xd131('0x2d')]});});}else{logger[_0xd131('0x24')](_0xd131('0x2f'));return BPromise['resolve']({'id':_0x3f5a0f[_0xd131('0x29')][_0xd131('0x30')][_0xd131('0x2d')],'name':_0x3f5a0f[_0xd131('0x29')]['user_name'][_0xd131('0x2d')]});}}function getEndUser(_0x1f6ba,_0xcf1d3,_0x91cd2e,_0x1b69f3){logger[_0xd131('0x24')](_0xd131('0x31'),_0x91cd2e);return request({'form':{'method':_0xd131('0x32'),'input_type':_0xd131('0x1e'),'response_type':_0xd131('0x1e'),'rest_data':JSON[_0xd131('0x22')]({'session':_0x1b69f3['id'],'module_name':_0xd131('0x33'),'query':util['format'](_0xd131('0x34'),_0x91cd2e),'order_by':'','offset':'0','select_fields':['id',_0xd131('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xd131('0x35')](function(_0x4d9d47){if(_0x4d9d47[_0xd131('0x28')][_0xd131('0x19')]){var _0x5a46aa=_['find'](_0x4d9d47[_0xd131('0x28')],function(_0x16f055){return _0x16f055[_0xd131('0x29')][_0xd131('0x36')]['value']===_0x91cd2e;});if(_0x5a46aa){logger[_0xd131('0x24')](_0xd131('0x37'));return BPromise[_0xd131('0x2c')]({'id':_0x5a46aa[_0xd131('0x29')]['id']['value'],'name':_0x5a46aa[_0xd131('0x29')]['name'][_0xd131('0x2d')],'phone':_0x5a46aa[_0xd131('0x29')][_0xd131('0x36')][_0xd131('0x2d')]});}}else{logger[_0xd131('0x24')](_0xd131('0x38'));return request({'form':{'method':_0xd131('0x1d'),'input_type':_0xd131('0x1e'),'response_type':'JSON','rest_data':JSON[_0xd131('0x22')]({'session':_0x1b69f3['id'],'module_name':_0xd131('0x33'),'name_value_list':[{'name':_0xd131('0x39'),'value':_0xcf1d3!==''?_0xcf1d3:util['format'](_0xd131('0x3a'),_0x91cd2e)},{'name':_0xd131('0x36'),'value':_0x91cd2e}]})}})[_0xd131('0x35')](function(_0x56b933){logger[_0xd131('0x24')](_0xd131('0x3b'));return BPromise[_0xd131('0x2c')]({'id':_0x56b933['id'],'name':_0x56b933[_0xd131('0x28')][_0xd131('0x39')][_0xd131('0x2d')],'phone':_0x56b933[_0xd131('0x28')]['phone_home'][_0xd131('0x2d')]});});}});}function request(_0xa2459b){logger['debug']('[HTTP]',JSON['stringify'](_0xa2459b));return rp(_[_0xd131('0x3c')](def,_0xa2459b));}function getTags(_0x4ebd8c,_0x1f3881){var _0x1d6a90=[];if(_0x4ebd8c&&_0x4ebd8c[_0xd131('0x19')]>0x0){_0x1d6a90=_['map'](_0x4ebd8c,_0x1f3881);}return _0x1d6a90;}function getCustomFields(_0x5f4e77,_0x36ac56){var _0x3af650=[];var _0x369dee={'custom_fields':[]};if(_0x5f4e77[_0xd131('0x19')]>0x0){_['forEach'](_0x5f4e77,function(_0x327e8b){if(_0x327e8b[_0xd131('0x3d')]===_0xd131('0x3e')&&_0x327e8b[_0xd131('0x3f')]&&!_0x327e8b[_0xd131('0x40')]){_0x369dee[_0x327e8b[_0xd131('0x3f')][_0xd131('0x41')]()]=_0x327e8b['content'][_0xd131('0x42')]();}else if(_0x327e8b[_0xd131('0x3d')]===_0xd131('0x3e')&&_0x327e8b[_0xd131('0x43')]&&_0x327e8b[_0xd131('0x40')]){_0x369dee['custom_fields'][_0xd131('0x1b')]({'id':_0x327e8b[_0xd131('0x43')],'value':_0x327e8b['content'][_0xd131('0x42')]()});}else if(_0x327e8b[_0xd131('0x3d')]===_0xd131('0x44')&&_0x327e8b[_0xd131('0x1c')]&&_0x327e8b[_0xd131('0x43')]&&_0x327e8b[_0xd131('0x40')]){_0x36ac56[_0x327e8b[_0xd131('0x1c')]]&&_0x369dee[_0xd131('0x45')][_0xd131('0x1b')]({'id':_0x327e8b[_0xd131('0x43')],'value':_0x36ac56[_0x327e8b['variableName']][_0xd131('0x42')]()});}else if(_0x327e8b[_0xd131('0x3d')]===_0xd131('0x46')&&_0x327e8b[_0xd131('0x47')]&&_0x327e8b[_0xd131('0x47')][_0xd131('0xd')]&&_0x327e8b[_0xd131('0x43')]&&_0x327e8b[_0xd131('0x40')]){_0x36ac56[_0x327e8b[_0xd131('0x47')][_0xd131('0xd')][_0xd131('0x41')]()]&&_0x369dee[_0xd131('0x45')][_0xd131('0x1b')]({'id':_0x327e8b['idField'],'value':_0x36ac56[_0x327e8b[_0xd131('0x47')]['name']['toLowerCase']()]['toString']()});}});}return _0x369dee;}function getConnection(_0x3947f8){return request({'method':_0xd131('0xa'),'form':{'method':_0xd131('0x48'),'input_type':_0xd131('0x1e'),'response_type':_0xd131('0x1e'),'rest_data':JSON[_0xd131('0x22')]({'user_auth':{'user_name':_0x3947f8[_0xd131('0x49')],'password':_0x3947f8[_0xd131('0x4a')],'encryption':_0xd131('0x4b')},'application':_0xd131('0x4c')})}})[_0xd131('0x35')](function(_0x13c19a){var _0x397a00=_0x13c19a;if(_0x397a00['id']){def['sessionID']=_0x397a00['id'];return BPromise[_0xd131('0x2c')](_0x397a00);}else{throw new Error(util[_0xd131('0x26')](_0xd131('0x4d'),_0x3947f8['id']));}});}function setRelationship(_0x5395aa,_0x43cdbc,_0x2aafdd,_0x2abcc6){return request({'form':{'method':'set_relationship','input_type':_0xd131('0x1e'),'response_type':'JSON','rest_data':JSON[_0xd131('0x22')]({'session':_0x5395aa['id'],'module_name':'Calls','module_id':_0x2aafdd['id'],'link_field_name':_0x2abcc6,'related_ids':[_0x43cdbc['id']]})}});}exports[_0xd131('0x4e')]=function(_0x314efe,_0x17fb16,_0x37b209,_0x5987e5,_0x1a845f,_0xeacd4){var _0x8afe14,_0x320f15,_0x25021e,_0xa3271d;_0xeacd4[_0xd131('0x4f')]=intUtil['stripTrailingSlash'](_0xeacd4[_0xd131('0x4f')]);_0xeacd4['serverUrl']=intUtil[_0xd131('0x50')](_0xeacd4[_0xd131('0x51')]);def[_0xd131('0x52')]=util[_0xd131('0x26')]('%s/service/v4_1/rest.php',_0xeacd4['remoteUri']);if(_0x1a845f&&_0x1a845f[_0xd131('0x53')]){logger['info'](_0xd131('0x54'),_0xd131('0x55'));_0x17fb16['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xeacd4['serverUrl'],_0x17fb16[_0xd131('0x56')],md5(_0x17fb16[_0xd131('0x56')]));}else{_0x17fb16['recordingURL']='';}return getConnection(_0xeacd4)[_0xd131('0x35')](function(_0x50b0df){_0xa3271d=_0x50b0df;return getUser(_0xeacd4,_0x5987e5['name'],_0xa3271d);})[_0xd131('0x35')](function(_0x1dbe65){_0x8afe14=_0x1dbe65;logger['info'](_0xd131('0x57'),_0x8afe14['id']);return getEndUser(_0xeacd4,_0x17fb16['calleridname'],_0x17fb16[_0xd131('0x58')],_0xa3271d);})[_0xd131('0x35')](function(_0x39677e){_0x320f15=_0x39677e;logger[_0xd131('0x24')](_0xd131('0x59'),_0x320f15['id']);return getTicket(_0xeacd4,_0x8afe14,_0x320f15,_0x37b209,_0x17fb16,_0x37b209['Fields'],_0xa3271d,_0xd131('0x5a'));})[_0xd131('0x35')](function(_0x4e17fe){_0x25021e=_0x4e17fe;logger['info'](_0xd131('0x5b'));logger[_0xd131('0x24')](_0xd131('0x5c'),_0x25021e['id']);return setRelationship(_0xa3271d,_0x8afe14,_0x25021e,_0xd131('0x5d'));})[_0xd131('0x35')](function(){return setRelationship(_0xa3271d,_0x320f15,_0x25021e,_0xd131('0x5e'));})[_0xd131('0x35')](function(){return getServerInfo(_0xa3271d);})[_0xd131('0x35')](function(_0x4a69b7){var _0xea5b41=parseInt(_0x4a69b7[_0xd131('0x5f')][_0xd131('0x60')](0x0));var _0x5db51a=util[_0xd131('0x26')](_0xd131('0x61'),_0xeacd4['remoteUri'],_0x25021e['id']);if(_0xea5b41>0x6){_0x5db51a=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xeacd4[_0xd131('0x4f')],_0x25021e['id']);}logger[_0xd131('0x24')]('[QUEUE]',_0xd131('0x62'));emit(util[_0xd131('0x26')](_0xd131('0x63'),_0x5987e5[_0xd131('0xd')]),'trigger:browser:url',{'uri':_0x5db51a});})[_0xd131('0x64')](function(_0x2c50d4){logger['error']('[QUEUE]',JSON[_0xd131('0x22')](_0x2c50d4));});};exports[_0xd131('0x65')]=function(_0x228728,_0x2b9a42,_0x4bc541,_0xc7cb11,_0xb184ef,_0x2e32b2,_0x9dff18){var _0x207337,_0x546922,_0xd02ca8,_0xddd024;_0x2e32b2[_0xd131('0x4f')]=intUtil[_0xd131('0x50')](_0x2e32b2[_0xd131('0x4f')]);_0x2e32b2[_0xd131('0x51')]=intUtil[_0xd131('0x50')](_0x2e32b2[_0xd131('0x51')]);def[_0xd131('0x52')]=util[_0xd131('0x26')](_0xd131('0x66'),_0x2e32b2[_0xd131('0x4f')]);if(_0x9dff18&&_0x9dff18[_0xd131('0x67')]&&_0x9dff18['recordingFormat']!==_0xd131('0x68')){logger[_0xd131('0x24')](_0xd131('0x69'),_0xd131('0x55'));_0x2b9a42['recordingURL']=util[_0xd131('0x26')](_0xd131('0x6a'),_0x2e32b2[_0xd131('0x51')],_0x2b9a42[_0xd131('0x56')],md5(_0x2b9a42[_0xd131('0x56')]));}return getConnection(_0x2e32b2)[_0xd131('0x35')](function(_0x3fe469){_0xddd024=_0x3fe469;return getUser(_0x2e32b2,_0xc7cb11[_0xd131('0xd')],_0xddd024);})[_0xd131('0x35')](function(_0x17dbde){_0x207337=_0x17dbde;logger[_0xd131('0x24')](_0xd131('0x57'),_0x207337['id']);return getEndUser(_0x2e32b2,_0x2b9a42[_0xd131('0x6b')],_0x2b9a42[_0xd131('0x6c')],_0xddd024);})['then'](function(_0x4f0108){_0x546922=_0x4f0108;logger[_0xd131('0x24')](_0xd131('0x59'),_0x546922['id']);return getTicket(_0x2e32b2,_0x207337,_0x546922,_0x4bc541,_0x2b9a42,_0x4bc541['Fields'],_0xddd024,'Outbound');})[_0xd131('0x35')](function(_0x38cc89){_0xd02ca8=_0x38cc89;logger[_0xd131('0x24')]('Ticket\x20created!');logger['info'](_0xd131('0x5c'),_0xd02ca8['id']);return setRelationship(_0xddd024,_0x207337,_0xd02ca8,_0xd131('0x5d'));})['then'](function(){return setRelationship(_0xddd024,_0x546922,_0xd02ca8,_0xd131('0x5e'));})[_0xd131('0x35')](function(){return getServerInfo(_0xddd024);})[_0xd131('0x35')](function(_0x4fa41f){var _0x1dfa26=parseInt(_0x4fa41f[_0xd131('0x5f')][_0xd131('0x60')](0x0));var _0x43c0d1=util['format'](_0xd131('0x61'),_0x2e32b2[_0xd131('0x4f')],_0xd02ca8['id']);if(_0x1dfa26>0x6){_0x43c0d1=util['format'](_0xd131('0x6d'),_0x2e32b2['remoteUri'],_0xd02ca8['id']);}logger[_0xd131('0x24')](_0xd131('0x69'),_0xd131('0x62'));emit(util['format']('user:%s',_0xc7cb11[_0xd131('0xd')]),_0xd131('0x6e'),{'uri':_0x43c0d1});})[_0xd131('0x64')](function(_0x1697b8){logger[_0xd131('0x6f')](_0xd131('0x69'),JSON[_0xd131('0x22')](_0x1697b8));});};exports[_0xd131('0x70')]=function(_0x1b5c04,_0x3084b3,_0x3d9f2f,_0x45aebe,_0x4689d8,_0x7abdb8){var _0x53d6da,_0x21de73,_0x5321e4,_0x30b4e2;_0x7abdb8[_0xd131('0x4f')]=intUtil['stripTrailingSlash'](_0x7abdb8['remoteUri']);_0x7abdb8[_0xd131('0x51')]=intUtil[_0xd131('0x50')](_0x7abdb8[_0xd131('0x51')]);def[_0xd131('0x52')]=util[_0xd131('0x26')](_0xd131('0x66'),_0x7abdb8['remoteUri']);if(_0x4689d8&&_0x4689d8[_0xd131('0x53')]){logger[_0xd131('0x24')](_0xd131('0x71'),'Recording\x20is\x20enabled!');_0x3084b3[_0xd131('0x72')]=util[_0xd131('0x26')](_0xd131('0x6a'),_0x7abdb8[_0xd131('0x51')],_0x3084b3[_0xd131('0x56')],md5(_0x3084b3[_0xd131('0x56')]));}else{_0x3084b3['recordingURL']='';}return getConnection(_0x7abdb8)[_0xd131('0x35')](function(_0x59b6f2){_0x30b4e2=_0x59b6f2;if(!_[_0xd131('0x23')](_0x45aebe)){return getUser(_0x7abdb8,_0x45aebe[_0xd131('0xd')],_0x30b4e2);}else{return getUser(_0x7abdb8,null,_0x30b4e2);}})[_0xd131('0x35')](function(_0x2bdf47){_0x53d6da=_0x2bdf47;logger['info']('The\x20User\x20ID\x20is:',_0x53d6da['id']);return getEndUser(_0x7abdb8,_0x3084b3[_0xd131('0x73')],_0x3084b3[_0xd131('0x58')],_0x30b4e2);})['then'](function(_0x1e5d4c){_0x21de73=_0x1e5d4c;logger[_0xd131('0x24')](_0xd131('0x59'),_0x21de73['id']);return getTicket(_0x7abdb8,_0x53d6da,_0x21de73,_0x3d9f2f,_0x3084b3,_0x3d9f2f[_0xd131('0x74')],_0x30b4e2,_0xd131('0x5a'));})[_0xd131('0x35')](function(_0x19d9c9){_0x5321e4=_0x19d9c9;logger[_0xd131('0x24')]('Ticket\x20created!');logger[_0xd131('0x24')]('The\x20Ticket\x20ID\x20is:',_0x5321e4['id']);return setRelationship(_0x30b4e2,_0x53d6da,_0x5321e4,_0xd131('0x5d'));})[_0xd131('0x35')](function(){return setRelationship(_0x30b4e2,_0x21de73,_0x5321e4,_0xd131('0x5e'));})[_0xd131('0x35')](function(){return getServerInfo(_0x30b4e2);})['catch'](function(_0x5d9371){logger[_0xd131('0x6f')]('[ABANDONED]',JSON['stringify'](_0x5d9371));});}; \ 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 101e3a6..3efadab 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 _0xf23e=['string','push','content','variableName','toString','customVariable','Variable','name','keyValue','keyType','key','keyContent','format','%s:\x20%s','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','toLowerCase','lodash','util','getString','type'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf23e,0x11a));var _0xef23=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xf23e[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0xef23('0x0'));var util=require(_0xef23('0x1'));exports[_0xef23('0x2')]=function(_0xf5b614,_0x3ba49f,_0x899e2f){var _0x1416fb=[];if(_0xf5b614['length']>0x0){var _0x2b33ed=_['sortBy'](_0xf5b614,['id']);for(var _0xecc67f=0x0;_0xecc67f<_0x2b33ed['length'];_0xecc67f++){var _0x95ae1a=_0x2b33ed[_0xecc67f];if(_0x95ae1a[_0xef23('0x3')]===_0xef23('0x4')){_0x1416fb[_0xef23('0x5')](_0x95ae1a[_0xef23('0x6')]);}else if(_0x95ae1a[_0xef23('0x3')]==='variable'&&_0x95ae1a[_0xef23('0x7')]){_0x3ba49f[_0x95ae1a[_0xef23('0x7')]]&&_0x1416fb['push'](_0x3ba49f[_0x95ae1a[_0xef23('0x7')]][_0xef23('0x8')]());}else if(_0x95ae1a[_0xef23('0x3')]===_0xef23('0x9')&&_0x95ae1a['Variable']&&_0x95ae1a[_0xef23('0xa')][_0xef23('0xb')]){_0x3ba49f[_0x95ae1a['Variable'][_0xef23('0xb')]['toLowerCase']()]&&_0x1416fb['push'](_0x3ba49f[_0x95ae1a['Variable']['name']['toLowerCase']()][_0xef23('0x8')]());}else if(_0x95ae1a[_0xef23('0x3')]===_0xef23('0xc')){if(_0x95ae1a[_0xef23('0xd')]===_0xef23('0x4')&&_0x95ae1a[_0xef23('0xe')]){_0x1416fb[_0xef23('0x5')](util['format']('%s:\x20%s',_0x95ae1a[_0xef23('0xe')],_0x95ae1a[_0xef23('0xf')]));}else if(_0x95ae1a['keyType']==='variable'&&_0x95ae1a[_0xef23('0x7')]&&_0x95ae1a[_0xef23('0xe')]){_0x3ba49f[_0x95ae1a['variableName']]&&_0x1416fb[_0xef23('0x5')](util[_0xef23('0x10')]('%s:\x20%s',_0x95ae1a[_0xef23('0xe')],_0x3ba49f[_0x95ae1a['variableName']]));}else if(_0x95ae1a[_0xef23('0xd')]===_0xef23('0x9')&&_0x95ae1a[_0xef23('0xa')]&&_0x95ae1a['Variable']['name']&&_0x95ae1a[_0xef23('0xe')]){_0x3ba49f[_0x95ae1a[_0xef23('0xa')][_0xef23('0xb')]['toLowerCase']()]&&_0x1416fb[_0xef23('0x5')](util[_0xef23('0x10')](_0xef23('0x11'),_0x95ae1a[_0xef23('0xe')],_0x3ba49f[_0x95ae1a['Variable'][_0xef23('0xb')]['toLowerCase']()]));}}}}return _0x1416fb['join'](_0x899e2f);};exports[_0xef23('0x12')]=function(_0x3463d8){var _0xa3a2ae=_0x3463d8[_0xef23('0x13')](-0x1);if(_0xa3a2ae==='/'){_0x3463d8=_0x3463d8[_0xef23('0x14')](0x0,_0x3463d8[_0xef23('0x15')](_0xa3a2ae));}return _0x3463d8;};exports[_0xef23('0x16')]=function(_0x3f46bd){if(!_[_0xef23('0x17')](_0x3f46bd)&&_0x3f46bd!==''){var _0x225a63=/^(([^<>()\[\]\\.,;:\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 _0x225a63[_0xef23('0x18')](String(_0x3f46bd)[_0xef23('0x19')]());}else{return![];}}; \ No newline at end of file +var _0xab05=['keyContent','variableName','format','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','string','type','variable','push','toString','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s'];(function(_0x397c49,_0xfeec11){var _0x1369a5=function(_0x2489d6){while(--_0x2489d6){_0x397c49['push'](_0x397c49['shift']());}};_0x1369a5(++_0xfeec11);}(_0xab05,0x1a2));var _0x5ab0=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xab05[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x5ab0('0x0'));var util=require(_0x5ab0('0x1'));exports[_0x5ab0('0x2')]=function(_0x56fdc8,_0x1df098,_0x467ad2){var _0x192bcd=[];if(_0x56fdc8[_0x5ab0('0x3')]>0x0){var _0x4de3f8=_[_0x5ab0('0x4')](_0x56fdc8,['id']);for(var _0x3ba3e9=0x0;_0x3ba3e9<_0x4de3f8['length'];_0x3ba3e9++){var _0x4cb5b9=_0x4de3f8[_0x3ba3e9];if(_0x4cb5b9['type']===_0x5ab0('0x5')){_0x192bcd['push'](_0x4cb5b9['content']);}else if(_0x4cb5b9[_0x5ab0('0x6')]===_0x5ab0('0x7')&&_0x4cb5b9['variableName']){_0x1df098[_0x4cb5b9['variableName']]&&_0x192bcd[_0x5ab0('0x8')](_0x1df098[_0x4cb5b9['variableName']][_0x5ab0('0x9')]());}else if(_0x4cb5b9[_0x5ab0('0x6')]==='customVariable'&&_0x4cb5b9[_0x5ab0('0xa')]&&_0x4cb5b9['Variable'][_0x5ab0('0xb')]){_0x1df098[_0x4cb5b9['Variable']['name']['toLowerCase']()]&&_0x192bcd['push'](_0x1df098[_0x4cb5b9['Variable'][_0x5ab0('0xb')][_0x5ab0('0xc')]()][_0x5ab0('0x9')]());}else if(_0x4cb5b9[_0x5ab0('0x6')]===_0x5ab0('0xd')){if(_0x4cb5b9[_0x5ab0('0xe')]===_0x5ab0('0x5')&&_0x4cb5b9[_0x5ab0('0xf')]){_0x192bcd[_0x5ab0('0x8')](util['format'](_0x5ab0('0x10'),_0x4cb5b9[_0x5ab0('0xf')],_0x4cb5b9[_0x5ab0('0x11')]));}else if(_0x4cb5b9[_0x5ab0('0xe')]===_0x5ab0('0x7')&&_0x4cb5b9[_0x5ab0('0x12')]&&_0x4cb5b9[_0x5ab0('0xf')]){_0x1df098[_0x4cb5b9[_0x5ab0('0x12')]]&&_0x192bcd[_0x5ab0('0x8')](util[_0x5ab0('0x13')](_0x5ab0('0x10'),_0x4cb5b9['key'],_0x1df098[_0x4cb5b9[_0x5ab0('0x12')]]));}else if(_0x4cb5b9['keyType']===_0x5ab0('0x14')&&_0x4cb5b9[_0x5ab0('0xa')]&&_0x4cb5b9[_0x5ab0('0xa')][_0x5ab0('0xb')]&&_0x4cb5b9['key']){_0x1df098[_0x4cb5b9[_0x5ab0('0xa')]['name'][_0x5ab0('0xc')]()]&&_0x192bcd['push'](util[_0x5ab0('0x13')](_0x5ab0('0x10'),_0x4cb5b9[_0x5ab0('0xf')],_0x1df098[_0x4cb5b9[_0x5ab0('0xa')][_0x5ab0('0xb')][_0x5ab0('0xc')]()]));}}}}return _0x192bcd[_0x5ab0('0x15')](_0x467ad2);};exports[_0x5ab0('0x16')]=function(_0x4133bd){var _0x1d7601=_0x4133bd[_0x5ab0('0x17')](-0x1);if(_0x1d7601==='/'){_0x4133bd=_0x4133bd[_0x5ab0('0x18')](0x0,_0x4133bd[_0x5ab0('0x19')](_0x1d7601));}return _0x4133bd;};exports[_0x5ab0('0x1a')]=function(_0x1df3dd){if(!_[_0x5ab0('0x1b')](_0x1df3dd)&&_0x1df3dd!==''){var _0x1c9433=/^(([^<>()\[\]\\.,;:\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 _0x1c9433[_0x5ab0('0x1c')](String(_0x1df3dd)['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 ddeff3b..5982ff8 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 _0x008c=['util','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','type','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','merge','Descriptions','POST','format','%s/webservice.php','remoteUri','username','stringify','then','success','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','createTicket','validateEmail','info','Getting\x20agent\x20with\x20email','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','length','Agent\x20found!','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','firstname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','create','Contacts','Enduser\x20created.','lastname','phone','getEndUser','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','split','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Fields','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','abandoned','[ABANDONED]','lodash','request-promise','bluebird','md5'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x008c,0x188));var _0xc008=function(_0x4ea571,_0x524bc2){_0x4ea571=_0x4ea571-0x0;var _0x122eba=_0x008c[_0x4ea571];return _0x122eba;};'use strict';var _=require(_0xc008('0x0'));var rp=require(_0xc008('0x1'));var BPromise=require(_0xc008('0x2'));var md5=require(_0xc008('0x3'));var util=require(_0xc008('0x4'));var Redis=require('ioredis');var intUtil=require(_0xc008('0x5'));var config=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));function emit(_0x428fa9,_0x5aa09b,_0x30be38){io['to'](_0x428fa9)['emit'](_0x5aa09b,_0x30be38);}function getCustomFields(_0x52041f,_0x27830d){var _0x7231b4={};if(_0x52041f['length']>0x0){_['forEach'](_0x52041f,function(_0x543eb8){if(_0x543eb8[_0xc008('0xd')]===_0xc008('0xe')&&_0x543eb8['idField']){_0x7231b4[_0x543eb8[_0xc008('0xf')]]=_0x543eb8[_0xc008('0x10')][_0xc008('0x11')]();}else if(_0x543eb8[_0xc008('0xd')]===_0xc008('0x12')&&_0x543eb8[_0xc008('0x13')]&&_0x543eb8[_0xc008('0xf')]&&_0x27830d[_0x543eb8['variableName']]){_0x7231b4[_0x543eb8['idField']]=_0x27830d[_0x543eb8[_0xc008('0x13')]]['toString']();}else if(_0x543eb8[_0xc008('0xd')]===_0xc008('0x14')&&_0x543eb8[_0xc008('0x15')]&&_0x543eb8[_0xc008('0x15')][_0xc008('0x16')]&&_0x543eb8['idField']&&_0x27830d[_0x543eb8['Variable']['name'][_0xc008('0x17')]()]){_0x7231b4[_0x543eb8[_0xc008('0xf')]]=_0x27830d[_0x543eb8[_0xc008('0x15')][_0xc008('0x16')]['toLowerCase']()]['toString']();}});}return _0x7231b4;}function createTicket(_0x540e45,_0x5c2668,_0x46042b,_0x462af5,_0x501137,_0x813397,_0x5906e6){logger['info']('Creating\x20new\x20ticket...');var _0x50261c=_[_0xc008('0x18')]({'parent_id':'','assigned_user_id':_0x5c2668['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil['getString'](_0x462af5['Subjects'],_0x501137,'\x20'),'description':intUtil['getString'](_0x462af5[_0xc008('0x19')],_0x501137,'\x0a'),'contact_id':_0x46042b['id']},getCustomFields(_0x813397,_0x501137));var _0x4777a6={'method':_0xc008('0x1a'),'uri':util[_0xc008('0x1b')](_0xc008('0x1c'),_0x540e45[_0xc008('0x1d')]),'form':{'operation':'create','username':_0x540e45[_0xc008('0x1e')],'sessionName':_0x5906e6['sessionName'],'elementType':'HelpDesk','element':JSON[_0xc008('0x1f')](_0x50261c)},'json':!![]};return request(_0x4777a6)[_0xc008('0x20')](function(_0x2e3cfb){if(_0x2e3cfb[_0xc008('0x21')]){return BPromise['resolve']({'id':_0x2e3cfb['result']['id']});}else{throw new Error(util['format'](_0xc008('0x22'),JSON[_0xc008('0x1f')](_0x2e3cfb[_0xc008('0x23')])));}})[_0xc008('0x24')](function(_0x5bebd9){var _0x5e2aca=_0x5bebd9['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0xc008('0x25'),_0x5e2aca,JSON[_0xc008('0x1f')](_0x5bebd9));});}function getUser(_0x25eae4,_0x529961,_0x24c14c){if(intUtil[_0xc008('0x26')](_0x529961)){logger[_0xc008('0x27')](_0xc008('0x28'),_0x529961);return request({'method':'GET','uri':util[_0xc008('0x1b')](_0xc008('0x1c'),_0x25eae4['remoteUri']),'qs':{'operation':'query','username':_0x25eae4['username'],'sessionName':_0x24c14c[_0xc008('0x29')],'query':util[_0xc008('0x1b')](_0xc008('0x2a'),_0x529961)},'json':!![]})[_0xc008('0x20')](function(_0x1de04b){if(_0x1de04b[_0xc008('0x21')]&&_0x1de04b[_0xc008('0x2b')][_0xc008('0x2c')]){logger[_0xc008('0x27')](_0xc008('0x2d'));return BPromise[_0xc008('0x2e')]({'id':_0x1de04b[_0xc008('0x2b')][0x0]['id'],'email':_0x1de04b['result'][0x0][_0xc008('0x2f')],'name':_0x1de04b[_0xc008('0x2b')][0x0]['first_name']+'\x20'+_0x1de04b[_0xc008('0x2b')][_0xc008('0x30')]});}else{logger[_0xc008('0x27')](_0xc008('0x31'));return BPromise[_0xc008('0x2e')]({'id':_0x24c14c[_0xc008('0x32')],'email':_0x25eae4[_0xc008('0x1e')],'name':_0xc008('0x33')});}})[_0xc008('0x24')](function(_0x4f14d2){var _0x415b87=_0x4f14d2[_0xc008('0x34')]||0x1f4;logger[_0xc008('0x23')](_0xc008('0x35'),_0xc008('0x36'),_0x415b87,JSON[_0xc008('0x1f')](_0x4f14d2));});}else{logger[_0xc008('0x27')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xc008('0x2e')]({'id':_0x24c14c[_0xc008('0x32')],'email':_0x25eae4['username'],'name':_0xc008('0x33')})[_0xc008('0x24')](function(_0x5e38d5){var _0x263473=_0x5e38d5[_0xc008('0x34')]||0x1f4;logger[_0xc008('0x23')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x263473,JSON['stringify'](_0x5e38d5));});}}function getEndUser(_0x234f2a,_0x518024,_0x3dd0ac,_0x3884dd){logger[_0xc008('0x27')](_0xc008('0x37'),_0x3dd0ac);return request({'method':_0xc008('0x38'),'uri':util[_0xc008('0x1b')](_0xc008('0x1c'),_0x234f2a[_0xc008('0x1d')]),'qs':{'operation':_0xc008('0x39'),'username':_0x234f2a[_0xc008('0x1e')],'sessionName':_0x3884dd[_0xc008('0x29')],'query':util[_0xc008('0x1b')](_0xc008('0x3a'),_0x3dd0ac,_0x3dd0ac,_0x3dd0ac,_0x3dd0ac,_0x3dd0ac)},'json':!![]})[_0xc008('0x20')](function(_0x4cace5){if(_0x4cace5[_0xc008('0x21')]&&_0x4cace5[_0xc008('0x2b')][_0xc008('0x2c')]){logger[_0xc008('0x27')]('Enduser\x20found!');return BPromise[_0xc008('0x2e')]({'id':_0x4cace5[_0xc008('0x2b')][0x0]['id'],'name':_0x4cace5[_0xc008('0x2b')][0x0][_0xc008('0x3b')]+'\x20'+_0x4cace5[_0xc008('0x2b')][0x0]['lastname'],'phone':_0x3dd0ac});}else{logger[_0xc008('0x27')](_0xc008('0x3c'));return request({'method':_0xc008('0x1a'),'uri':util[_0xc008('0x1b')](_0xc008('0x1c'),_0x234f2a['remoteUri']),'form':{'operation':_0xc008('0x3d'),'sessionName':_0x3884dd[_0xc008('0x29')],'elementType':_0xc008('0x3e'),'element':JSON[_0xc008('0x1f')]({'lastname':_0x518024,'phone':_0x3dd0ac,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x26cd05){logger[_0xc008('0x27')](_0xc008('0x3f'));return BPromise['resolve']({'id':_0x26cd05[_0xc008('0x2b')]['id'],'name':_0x26cd05['result'][_0xc008('0x40')],'phone':_0x26cd05['result'][_0xc008('0x41')]});})[_0xc008('0x24')](function(_0x5a5d85){var _0x31007c=_0x5a5d85[_0xc008('0x34')]||0x1f4;logger[_0xc008('0x23')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xc008('0x42'),_0x31007c,JSON[_0xc008('0x1f')](_0x5a5d85));});}});}function getConnection(_0x200469){var _0x44fc5d=_0x200469[_0xc008('0x1e')];var _0x372305=_0x200469['accessKey'];return request({'method':'GET','uri':util['format'](_0xc008('0x1c'),_0x200469[_0xc008('0x1d')]),'qs':{'operation':_0xc008('0x43'),'username':_0x44fc5d},'json':!![]})[_0xc008('0x20')](function(_0x25289f){if(_0x25289f[_0xc008('0x21')]){return request({'method':_0xc008('0x1a'),'uri':util[_0xc008('0x1b')]('%s/webservice.php',_0x200469['remoteUri']),'form':{'operation':'login','username':_0x44fc5d,'accessKey':md5(_0x25289f[_0xc008('0x2b')][_0xc008('0x44')]+_0x372305)},'json':!![]});}})[_0xc008('0x20')](function(_0x511383){if(_0x511383[_0xc008('0x21')]){return BPromise[_0xc008('0x2e')](_0x511383[_0xc008('0x2b')]);}else{throw new Error(util[_0xc008('0x1b')](_0xc008('0x45'),_0x200469['id']));}})[_0xc008('0x24')](function(_0x17ec90){var _0x405e87=_0x17ec90[_0xc008('0x34')]||0x1f4;logger[_0xc008('0x23')]('[vTiger],\x20%s,\x20%s,\x20%s','getConnection',_0x405e87,JSON[_0xc008('0x1f')](_0x17ec90));});}function request(_0x51cb14){logger[_0xc008('0x27')](_0xc008('0x46'),JSON[_0xc008('0x1f')](_0x51cb14));return rp(_0x51cb14);}exports['queue']=function(_0x144ab2,_0x32b435,_0xee64,_0x8b9775,_0x750cc9,_0x51105f){var _0x3a7b3b,_0x27b022,_0x4b4c6d,_0x24f775;_0x51105f[_0xc008('0x1d')]=intUtil['stripTrailingSlash'](_0x51105f['remoteUri']);if(_0x750cc9&&_0x750cc9[_0xc008('0x47')]){logger[_0xc008('0x27')](_0xc008('0x48'),_0xc008('0x49'));_0x32b435[_0xc008('0x4a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x51105f[_0xc008('0x4b')],_0x32b435['uniqueid'],md5(_0x32b435[_0xc008('0x4c')]));}else{_0x32b435[_0xc008('0x4a')]='';}return getConnection(_0x51105f)[_0xc008('0x20')](function(_0x2f1105){_0x24f775=_0x2f1105;return getUser(_0x51105f,_0x8b9775[_0xc008('0x4d')],_0x24f775);})[_0xc008('0x20')](function(_0x49d8b0){_0x3a7b3b=_0x49d8b0;logger[_0xc008('0x27')](_0xc008('0x4e'),_0x3a7b3b['id']);return getEndUser(_0x51105f,_0x32b435[_0xc008('0x4f')],_0x32b435[_0xc008('0x50')],_0x24f775);})[_0xc008('0x20')](function(_0x5aa385){_0x27b022=_0x5aa385;logger[_0xc008('0x27')]('The\x20Enduser\x20ID\x20is:',_0x27b022['id']);return createTicket(_0x51105f,_0x3a7b3b,_0x27b022,_0xee64,_0x32b435,_0xee64['Fields'],_0x24f775);})['then'](function(_0x89bb20){_0x4b4c6d=_0x89bb20;logger[_0xc008('0x27')](_0xc008('0x51'));logger['info'](_0xc008('0x52'),_0x4b4c6d['id']);var _0x2d8361=util[_0xc008('0x1b')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x51105f[_0xc008('0x1d')],_[_0xc008('0x53')](_0x4b4c6d['id'],'x')[0x1]);logger[_0xc008('0x27')](_0xc008('0x48'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc008('0x1b')]('user:%s',_0x8b9775[_0xc008('0x16')]),_0xc008('0x54'),{'uri':_0x2d8361});})[_0xc008('0x24')](function(_0x943c91){logger[_0xc008('0x23')](_0xc008('0x48'),JSON['stringify'](_0x943c91));});};exports[_0xc008('0x55')]=function(_0x570001,_0x5bf4a9,_0x37ce5e,_0x30aa1e,_0x56e755,_0xb1befa,_0xb8ba7){var _0x3e373e,_0x4517c0,_0x21ee6d,_0x31a339;_0xb1befa[_0xc008('0x1d')]=intUtil['stripTrailingSlash'](_0xb1befa[_0xc008('0x1d')]);_0xb1befa[_0xc008('0x4b')]=intUtil[_0xc008('0x56')](_0xb1befa[_0xc008('0x4b')]);if(_0xb8ba7&&_0xb8ba7[_0xc008('0x57')]&&_0xb8ba7[_0xc008('0x57')]!==_0xc008('0x58')){logger[_0xc008('0x27')](_0xc008('0x59'),_0xc008('0x49'));_0x5bf4a9[_0xc008('0x4a')]=util[_0xc008('0x1b')](_0xc008('0x5a'),_0xb1befa[_0xc008('0x4b')],_0x5bf4a9['uniqueid'],md5(_0x5bf4a9[_0xc008('0x4c')]));}return getConnection(_0xb1befa)[_0xc008('0x20')](function(_0x3d3a7e){_0x31a339=_0x3d3a7e;return getUser(_0xb1befa,_0x30aa1e['email'],_0x31a339);})[_0xc008('0x20')](function(_0x3214df){_0x3e373e=_0x3214df;logger['info']('The\x20User\x20ID\x20is:',_0x3e373e['id']);return getEndUser(_0xb1befa,_0x5bf4a9[_0xc008('0x5b')],_0x5bf4a9[_0xc008('0x5c')],_0x31a339);})[_0xc008('0x20')](function(_0x39083c){_0x4517c0=_0x39083c;logger[_0xc008('0x27')](_0xc008('0x5d'),_0x4517c0['id']);return createTicket(_0xb1befa,_0x3e373e,_0x4517c0,_0x37ce5e,_0x5bf4a9,_0x37ce5e[_0xc008('0x5e')],_0x31a339);})[_0xc008('0x20')](function(_0x39e219){_0x21ee6d=_0x39e219;logger[_0xc008('0x27')](_0xc008('0x51'));logger['info'](_0xc008('0x52'),_0x21ee6d['id']);var _0x25a52b=util[_0xc008('0x1b')](_0xc008('0x5f'),_0xb1befa['remoteUri'],_[_0xc008('0x53')](_0x21ee6d['id'],'x')[0x1]);logger['info'](_0xc008('0x59'),_0xc008('0x60'));emit(util[_0xc008('0x1b')]('user:%s',_0x30aa1e[_0xc008('0x16')]),_0xc008('0x54'),{'uri':_0x25a52b});})[_0xc008('0x24')](function(_0x553f5c){logger[_0xc008('0x23')]('[OUTBOUND]',JSON[_0xc008('0x1f')](_0x553f5c));});};exports[_0xc008('0x61')]=function(_0x23012c,_0x6fe732,_0x295ec7,_0x4ca4a6,_0x3c30db,_0x3f2342){var _0x49493b,_0x3efb77,_0x5233bb,_0x278cbe;_0x3f2342['remoteUri']=intUtil[_0xc008('0x56')](_0x3f2342['remoteUri']);_0x3f2342[_0xc008('0x4b')]=intUtil[_0xc008('0x56')](_0x3f2342[_0xc008('0x4b')]);if(_0x3c30db&&_0x3c30db[_0xc008('0x47')]){logger['info'](_0xc008('0x62'),_0xc008('0x49'));_0x6fe732[_0xc008('0x4a')]=util[_0xc008('0x1b')](_0xc008('0x5a'),_0x3f2342[_0xc008('0x4b')],_0x6fe732[_0xc008('0x4c')],md5(_0x6fe732[_0xc008('0x4c')]));}else{_0x6fe732['recordingURL']='';}return getConnection(_0x3f2342)[_0xc008('0x20')](function(_0x530c2f){_0x278cbe=_0x530c2f;return getUser(_0x3f2342,'',_0x278cbe);})['then'](function(_0x4c84da){_0x49493b=_0x4c84da;logger[_0xc008('0x27')](_0xc008('0x4e'),_0x49493b['id']);return getEndUser(_0x3f2342,_0x6fe732[_0xc008('0x4f')],_0x6fe732[_0xc008('0x50')],_0x278cbe);})[_0xc008('0x20')](function(_0x2e9646){_0x3efb77=_0x2e9646;logger[_0xc008('0x27')](_0xc008('0x5d'),_0x3efb77['id']);return createTicket(_0x3f2342,_0x49493b,_0x3efb77,_0x295ec7,_0x6fe732,_0x295ec7[_0xc008('0x5e')],_0x278cbe);})['then'](function(_0x38b603){_0x5233bb=_0x38b603;logger[_0xc008('0x27')](_0xc008('0x51'));logger[_0xc008('0x27')](_0xc008('0x52'),_0x5233bb['id']);})[_0xc008('0x24')](function(_0x23d4ff){logger[_0xc008('0x23')](_0xc008('0x62'),JSON[_0xc008('0x1f')](_0x23d4ff));});}; \ No newline at end of file +var _0x55ca=['email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','abandoned','[ABANDONED]','lodash','request-promise','ioredis','./util','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','type','string','idField','content','toString','customVariable','Variable','name','toLowerCase','info','merge','Normal','Open','Subjects','getString','POST','format','%s/webservice.php','remoteUri','username','then','success','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','Agent\x20found!','email1','last_name','userId','admin','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','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!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','lastname','phone','getEndUser','accessKey','getConnection','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','[QUEUE]','outbound','serverUrl','recordingFormat','none','[OUTBOUND]'];(function(_0x321e3,_0x5128b1){var _0x5c9d58=function(_0x3f2c9c){while(--_0x3f2c9c){_0x321e3['push'](_0x321e3['shift']());}};_0x5c9d58(++_0x5128b1);}(_0x55ca,0x126));var _0xa55c=function(_0x4eab61,_0x1a6e6d){_0x4eab61=_0x4eab61-0x0;var _0x342426=_0x55ca[_0x4eab61];return _0x342426;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0xa55c('0x2'));var intUtil=require(_0xa55c('0x3'));var config=require('../../../../config/environment');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));config[_0xa55c('0x6')]=_[_0xa55c('0x7')](config[_0xa55c('0x6')],{'host':_0xa55c('0x8'),'port':0x18eb});var io=require(_0xa55c('0x9'))(new Redis(config['redis']));function emit(_0x2121fd,_0x2537f0,_0x57e069){io['to'](_0x2121fd)[_0xa55c('0xa')](_0x2537f0,_0x57e069);}function getCustomFields(_0x290d28,_0x52a3bc){var _0x5849ad={};if(_0x290d28[_0xa55c('0xb')]>0x0){_[_0xa55c('0xc')](_0x290d28,function(_0x381d07){if(_0x381d07[_0xa55c('0xd')]===_0xa55c('0xe')&&_0x381d07[_0xa55c('0xf')]){_0x5849ad[_0x381d07[_0xa55c('0xf')]]=_0x381d07[_0xa55c('0x10')][_0xa55c('0x11')]();}else if(_0x381d07[_0xa55c('0xd')]==='variable'&&_0x381d07['variableName']&&_0x381d07[_0xa55c('0xf')]&&_0x52a3bc[_0x381d07['variableName']]){_0x5849ad[_0x381d07['idField']]=_0x52a3bc[_0x381d07['variableName']][_0xa55c('0x11')]();}else if(_0x381d07[_0xa55c('0xd')]===_0xa55c('0x12')&&_0x381d07[_0xa55c('0x13')]&&_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')]&&_0x381d07['idField']&&_0x52a3bc[_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')][_0xa55c('0x15')]()]){_0x5849ad[_0x381d07[_0xa55c('0xf')]]=_0x52a3bc[_0x381d07[_0xa55c('0x13')][_0xa55c('0x14')][_0xa55c('0x15')]()][_0xa55c('0x11')]();}});}return _0x5849ad;}function createTicket(_0x24783b,_0x4cee3c,_0x3d4c9e,_0x104a99,_0x461284,_0x358b61,_0x23a1ae){logger[_0xa55c('0x16')]('Creating\x20new\x20ticket...');var _0x5f5158=_[_0xa55c('0x17')]({'parent_id':'','assigned_user_id':_0x4cee3c['id'],'ticketpriorities':_0xa55c('0x18'),'ticketstatus':_0xa55c('0x19'),'ticket_title':intUtil['getString'](_0x104a99[_0xa55c('0x1a')],_0x461284,'\x20'),'description':intUtil[_0xa55c('0x1b')](_0x104a99['Descriptions'],_0x461284,'\x0a'),'contact_id':_0x3d4c9e['id']},getCustomFields(_0x358b61,_0x461284));var _0x187a87={'method':_0xa55c('0x1c'),'uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x24783b[_0xa55c('0x1f')]),'form':{'operation':'create','username':_0x24783b[_0xa55c('0x20')],'sessionName':_0x23a1ae['sessionName'],'elementType':'HelpDesk','element':JSON['stringify'](_0x5f5158)},'json':!![]};return request(_0x187a87)[_0xa55c('0x21')](function(_0x54b038){if(_0x54b038[_0xa55c('0x22')]){return BPromise[_0xa55c('0x23')]({'id':_0x54b038[_0xa55c('0x24')]['id']});}else{throw new Error(util[_0xa55c('0x1d')](_0xa55c('0x25'),JSON[_0xa55c('0x26')](_0x54b038[_0xa55c('0x27')])));}})[_0xa55c('0x28')](function(_0x192df2){var _0x3cd152=_0x192df2[_0xa55c('0x29')]||0x1f4;logger['error'](_0xa55c('0x2a'),_0xa55c('0x2b'),_0x3cd152,JSON[_0xa55c('0x26')](_0x192df2));});}function getUser(_0x906caa,_0x5d940d,_0x1377b0){if(intUtil[_0xa55c('0x2c')](_0x5d940d)){logger[_0xa55c('0x16')](_0xa55c('0x2d'),_0x5d940d);return request({'method':_0xa55c('0x2e'),'uri':util[_0xa55c('0x1d')]('%s/webservice.php',_0x906caa[_0xa55c('0x1f')]),'qs':{'operation':'query','username':_0x906caa[_0xa55c('0x20')],'sessionName':_0x1377b0[_0xa55c('0x2f')],'query':util[_0xa55c('0x1d')](_0xa55c('0x30'),_0x5d940d)},'json':!![]})['then'](function(_0x3d28fb){if(_0x3d28fb[_0xa55c('0x22')]&&_0x3d28fb[_0xa55c('0x24')][_0xa55c('0xb')]){logger[_0xa55c('0x16')](_0xa55c('0x31'));return BPromise[_0xa55c('0x23')]({'id':_0x3d28fb[_0xa55c('0x24')][0x0]['id'],'email':_0x3d28fb[_0xa55c('0x24')][0x0][_0xa55c('0x32')],'name':_0x3d28fb[_0xa55c('0x24')][0x0]['first_name']+'\x20'+_0x3d28fb['result'][_0xa55c('0x33')]});}else{logger[_0xa55c('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xa55c('0x23')]({'id':_0x1377b0[_0xa55c('0x34')],'email':_0x906caa[_0xa55c('0x20')],'name':_0xa55c('0x35')});}})[_0xa55c('0x28')](function(_0x38ff96){var _0x3ce1b3=_0x38ff96[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x3ce1b3,JSON['stringify'](_0x38ff96));});}else{logger[_0xa55c('0x16')](_0xa55c('0x36'));return BPromise[_0xa55c('0x23')]({'id':_0x1377b0['userId'],'email':_0x906caa[_0xa55c('0x20')],'name':'admin'})[_0xa55c('0x28')](function(_0x4ad813){var _0x18c6f1=_0x4ad813[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa55c('0x37'),_0x18c6f1,JSON[_0xa55c('0x26')](_0x4ad813));});}}function getEndUser(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083){logger['info'](_0xa55c('0x38'),_0x194e78);return request({'method':'GET','uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x47e93c['remoteUri']),'qs':{'operation':'query','username':_0x47e93c['username'],'sessionName':_0x4d9083['sessionName'],'query':util[_0xa55c('0x1d')](_0xa55c('0x39'),_0x194e78,_0x194e78,_0x194e78,_0x194e78,_0x194e78)},'json':!![]})[_0xa55c('0x21')](function(_0x99c4f8){if(_0x99c4f8[_0xa55c('0x22')]&&_0x99c4f8['result'][_0xa55c('0xb')]){logger[_0xa55c('0x16')](_0xa55c('0x3a'));return BPromise[_0xa55c('0x23')]({'id':_0x99c4f8[_0xa55c('0x24')][0x0]['id'],'name':_0x99c4f8[_0xa55c('0x24')][0x0]['firstname']+'\x20'+_0x99c4f8[_0xa55c('0x24')][0x0]['lastname'],'phone':_0x194e78});}else{logger['info'](_0xa55c('0x3b'));return request({'method':_0xa55c('0x1c'),'uri':util['format'](_0xa55c('0x1e'),_0x47e93c['remoteUri']),'form':{'operation':'create','sessionName':_0x4d9083[_0xa55c('0x2f')],'elementType':_0xa55c('0x3c'),'element':JSON[_0xa55c('0x26')]({'lastname':_0x6f9c4c,'phone':_0x194e78,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x1b2708){logger[_0xa55c('0x16')]('Enduser\x20created.');return BPromise[_0xa55c('0x23')]({'id':_0x1b2708['result']['id'],'name':_0x1b2708[_0xa55c('0x24')][_0xa55c('0x3d')],'phone':_0x1b2708['result'][_0xa55c('0x3e')]});})[_0xa55c('0x28')](function(_0x5d834d){var _0x40c352=_0x5d834d[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa55c('0x3f'),_0x40c352,JSON['stringify'](_0x5d834d));});}});}function getConnection(_0x2f9717){var _0x3a8af4=_0x2f9717[_0xa55c('0x20')];var _0x51d663=_0x2f9717[_0xa55c('0x40')];return request({'method':_0xa55c('0x2e'),'uri':util['format'](_0xa55c('0x1e'),_0x2f9717[_0xa55c('0x1f')]),'qs':{'operation':'getchallenge','username':_0x3a8af4},'json':!![]})[_0xa55c('0x21')](function(_0xd3fe78){if(_0xd3fe78['success']){return request({'method':_0xa55c('0x1c'),'uri':util[_0xa55c('0x1d')](_0xa55c('0x1e'),_0x2f9717[_0xa55c('0x1f')]),'form':{'operation':'login','username':_0x3a8af4,'accessKey':md5(_0xd3fe78[_0xa55c('0x24')]['token']+_0x51d663)},'json':!![]});}})[_0xa55c('0x21')](function(_0x213100){if(_0x213100[_0xa55c('0x22')]){return BPromise['resolve'](_0x213100[_0xa55c('0x24')]);}else{throw new Error(util[_0xa55c('0x1d')]('Account\x20%d\x20is\x20not\x20valid',_0x2f9717['id']));}})[_0xa55c('0x28')](function(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x29')]||0x1f4;logger[_0xa55c('0x27')](_0xa55c('0x2a'),_0xa55c('0x41'),_0x3822b7,JSON[_0xa55c('0x26')](_0x34de95));});}function request(_0x3c147b){logger[_0xa55c('0x16')]('[HTTP]',JSON[_0xa55c('0x26')](_0x3c147b));return rp(_0x3c147b);}exports[_0xa55c('0x42')]=function(_0x216de8,_0x4f73b6,_0x4c3095,_0x35bf0a,_0x4f5ecd,_0x21b760){var _0x4fa412,_0x2b6a0e,_0x228df4,_0x181802;_0x21b760[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x21b760['remoteUri']);if(_0x4f5ecd&&_0x4f5ecd[_0xa55c('0x44')]){logger[_0xa55c('0x16')]('[QUEUE]',_0xa55c('0x45'));_0x4f73b6[_0xa55c('0x46')]=util[_0xa55c('0x1d')](_0xa55c('0x47'),_0x21b760['serverUrl'],_0x4f73b6['uniqueid'],md5(_0x4f73b6[_0xa55c('0x48')]));}else{_0x4f73b6[_0xa55c('0x46')]='';}return getConnection(_0x21b760)[_0xa55c('0x21')](function(_0x44ac57){_0x181802=_0x44ac57;return getUser(_0x21b760,_0x35bf0a['email'],_0x181802);})[_0xa55c('0x21')](function(_0x5ce463){_0x4fa412=_0x5ce463;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x4fa412['id']);return getEndUser(_0x21b760,_0x4f73b6[_0xa55c('0x4a')],_0x4f73b6[_0xa55c('0x4b')],_0x181802);})[_0xa55c('0x21')](function(_0x53b2f7){_0x2b6a0e=_0x53b2f7;logger[_0xa55c('0x16')]('The\x20Enduser\x20ID\x20is:',_0x2b6a0e['id']);return createTicket(_0x21b760,_0x4fa412,_0x2b6a0e,_0x4c3095,_0x4f73b6,_0x4c3095[_0xa55c('0x4c')],_0x181802);})[_0xa55c('0x21')](function(_0x2cfe08){_0x228df4=_0x2cfe08;logger[_0xa55c('0x16')](_0xa55c('0x4d'));logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x228df4['id']);var _0x53e2be=util[_0xa55c('0x1d')](_0xa55c('0x4f'),_0x21b760[_0xa55c('0x1f')],_[_0xa55c('0x50')](_0x228df4['id'],'x')[0x1]);logger[_0xa55c('0x16')]('[QUEUE]',_0xa55c('0x51'));emit(util[_0xa55c('0x1d')](_0xa55c('0x52'),_0x35bf0a[_0xa55c('0x14')]),_0xa55c('0x53'),{'uri':_0x53e2be});})['catch'](function(_0xdd92c1){logger[_0xa55c('0x27')](_0xa55c('0x54'),JSON[_0xa55c('0x26')](_0xdd92c1));});};exports[_0xa55c('0x55')]=function(_0x480dfc,_0x419fc3,_0x4d94fc,_0x2e482a,_0x5e3a28,_0x3495a7,_0x5a8897){var _0x34edc5,_0x1333da,_0x21d6b4,_0x2f811e;_0x3495a7[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x1f')]);_0x3495a7[_0xa55c('0x56')]=intUtil[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x56')]);if(_0x5a8897&&_0x5a8897['recordingFormat']&&_0x5a8897[_0xa55c('0x57')]!==_0xa55c('0x58')){logger['info'](_0xa55c('0x59'),_0xa55c('0x45'));_0x419fc3[_0xa55c('0x46')]=util[_0xa55c('0x1d')](_0xa55c('0x47'),_0x3495a7[_0xa55c('0x56')],_0x419fc3[_0xa55c('0x48')],md5(_0x419fc3[_0xa55c('0x48')]));}return getConnection(_0x3495a7)['then'](function(_0x1dfaf7){_0x2f811e=_0x1dfaf7;return getUser(_0x3495a7,_0x2e482a[_0xa55c('0x5a')],_0x2f811e);})[_0xa55c('0x21')](function(_0xd309a9){_0x34edc5=_0xd309a9;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x34edc5['id']);return getEndUser(_0x3495a7,_0x419fc3[_0xa55c('0x5b')],_0x419fc3[_0xa55c('0x5c')],_0x2f811e);})[_0xa55c('0x21')](function(_0x4a08ca){_0x1333da=_0x4a08ca;logger[_0xa55c('0x16')](_0xa55c('0x5d'),_0x1333da['id']);return createTicket(_0x3495a7,_0x34edc5,_0x1333da,_0x4d94fc,_0x419fc3,_0x4d94fc[_0xa55c('0x4c')],_0x2f811e);})[_0xa55c('0x21')](function(_0x3a269d){_0x21d6b4=_0x3a269d;logger[_0xa55c('0x16')](_0xa55c('0x4d'));logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x21d6b4['id']);var _0x3178a6=util[_0xa55c('0x1d')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3495a7[_0xa55c('0x1f')],_['split'](_0x21d6b4['id'],'x')[0x1]);logger[_0xa55c('0x16')](_0xa55c('0x59'),_0xa55c('0x51'));emit(util['format']('user:%s',_0x2e482a[_0xa55c('0x14')]),_0xa55c('0x53'),{'uri':_0x3178a6});})[_0xa55c('0x28')](function(_0x42529f){logger['error'](_0xa55c('0x59'),JSON[_0xa55c('0x26')](_0x42529f));});};exports[_0xa55c('0x5e')]=function(_0x3a9910,_0x21fc9b,_0x500968,_0x4b090c,_0x3f7fca,_0x38689e){var _0x3f9d0a,_0x36ee32,_0x1af9d5,_0x4b2032;_0x38689e[_0xa55c('0x1f')]=intUtil[_0xa55c('0x43')](_0x38689e['remoteUri']);_0x38689e[_0xa55c('0x56')]=intUtil[_0xa55c('0x43')](_0x38689e[_0xa55c('0x56')]);if(_0x3f7fca&&_0x3f7fca['monitor_format']){logger[_0xa55c('0x16')](_0xa55c('0x5f'),_0xa55c('0x45'));_0x21fc9b[_0xa55c('0x46')]=util[_0xa55c('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x38689e[_0xa55c('0x56')],_0x21fc9b[_0xa55c('0x48')],md5(_0x21fc9b['uniqueid']));}else{_0x21fc9b['recordingURL']='';}return getConnection(_0x38689e)[_0xa55c('0x21')](function(_0x4e1cbd){_0x4b2032=_0x4e1cbd;return getUser(_0x38689e,'',_0x4b2032);})[_0xa55c('0x21')](function(_0x5ca0bc){_0x3f9d0a=_0x5ca0bc;logger[_0xa55c('0x16')](_0xa55c('0x49'),_0x3f9d0a['id']);return getEndUser(_0x38689e,_0x21fc9b[_0xa55c('0x4a')],_0x21fc9b[_0xa55c('0x4b')],_0x4b2032);})[_0xa55c('0x21')](function(_0xff7b1c){_0x36ee32=_0xff7b1c;logger[_0xa55c('0x16')]('The\x20Enduser\x20ID\x20is:',_0x36ee32['id']);return createTicket(_0x38689e,_0x3f9d0a,_0x36ee32,_0x500968,_0x21fc9b,_0x500968[_0xa55c('0x4c')],_0x4b2032);})[_0xa55c('0x21')](function(_0x21de68){_0x1af9d5=_0x21de68;logger[_0xa55c('0x16')]('Ticket\x20created!');logger[_0xa55c('0x16')](_0xa55c('0x4e'),_0x1af9d5['id']);})[_0xa55c('0x28')](function(_0x2298ac){logger['error']('[ABANDONED]',JSON[_0xa55c('0x26')](_0x2298ac));});}; \ 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 bd66e8a..072e7e9 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 _0xeec6=['../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','forEach','type','string','customField','nameField','idField','push','variable','variableName','custom_fields','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','user:%s','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','monitor_format','[ABANDONED]','Recording\x20is\x20enabled!','The\x20Ticket\x20ID\x20is:','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0xeec6,0x1c2));var _0x6eec=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xeec6[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x6eec('0x0'));var rp=require(_0x6eec('0x1'));var md5=require(_0x6eec('0x2'));var util=require(_0x6eec('0x3'));var Redis=require('ioredis');var intUtil=require(_0x6eec('0x4'));var config=require(_0x6eec('0x5'));var logger=require(_0x6eec('0x6'))(_0x6eec('0x7'));config[_0x6eec('0x8')]=_[_0x6eec('0x9')](config['redis'],{'host':_0x6eec('0xa'),'port':0x18eb});var io=require(_0x6eec('0xb'))(new Redis(config['redis']));function emit(_0x5a5e47,_0x1c810e,_0x3443c2){io['to'](_0x5a5e47)[_0x6eec('0xc')](_0x1c810e,_0x3443c2);}var headers={'Content-Type':'application/json','Accept':_0x6eec('0xd')};function getTicket(_0x3aca38,_0x1c774d,_0x49ad4c,_0x595dd4,_0x5e8aba){logger[_0x6eec('0xe')](_0x6eec('0xf'));return request({'uri':util['format']('%s/tickets.json',_0x3aca38[_0x6eec('0x10')]),'method':'POST','body':{'ticket':_[_0x6eec('0x11')]({'requester_id':_0x49ad4c['id'],'submitter_id':_0x1c774d?_0x1c774d['id']:undefined,'assignee_id':_0x1c774d?_0x1c774d['id']:undefined,'tags':getTags(_0x595dd4[_0x6eec('0x12')],_0x6eec('0x13')),'subject':intUtil[_0x6eec('0x14')](_0x595dd4[_0x6eec('0x15')],_0x5e8aba,'\x20'),'description':intUtil['getString'](_0x595dd4[_0x6eec('0x16')],_0x5e8aba,'\x0a'),'comment':{'public':![],'body':intUtil[_0x6eec('0x14')](_0x595dd4[_0x6eec('0x16')],_0x5e8aba,'\x0a')}},getCustomFields(_0x595dd4[_0x6eec('0x17')],_0x5e8aba))}})[_0x6eec('0x18')](function(_0x2b35d6){logger[_0x6eec('0xe')](_0x6eec('0x19'));return _0x2b35d6[_0x6eec('0x1a')];});}function getUser(_0x2ac797,_0x5e2a9b){if(intUtil[_0x6eec('0x1b')](_0x5e2a9b)){logger['info'](_0x6eec('0x1c'),_0x5e2a9b);return request({'uri':util[_0x6eec('0x1d')]('%s/search.json',_0x2ac797[_0x6eec('0x10')]),'qs':{'query':util[_0x6eec('0x1d')](_0x6eec('0x1e'),_0x5e2a9b)}})['then'](function(_0x87f3be){if(_0x87f3be[_0x6eec('0x1f')]){logger[_0x6eec('0xe')](_0x6eec('0x20'));return _[_0x6eec('0x21')](_0x87f3be[_0x6eec('0x22')],{'email':_0x5e2a9b,'role':'agent'});}else{logger[_0x6eec('0xe')](_0x6eec('0x23'));return request({'uri':util[_0x6eec('0x1d')](_0x6eec('0x24'),_0x2ac797[_0x6eec('0x10')])})[_0x6eec('0x18')](function(_0x52f941){logger[_0x6eec('0xe')](_0x6eec('0x25'));return _0x52f941[_0x6eec('0x26')];});}});}else{logger[_0x6eec('0xe')](_0x6eec('0x23'));return request({'uri':util[_0x6eec('0x1d')]('%s/users/me.json',_0x2ac797[_0x6eec('0x10')])})[_0x6eec('0x18')](function(_0xd664f5){logger[_0x6eec('0xe')](_0x6eec('0x25'));return _0xd664f5[_0x6eec('0x26')];});}}function getEndUser(_0x29879c,_0x20bed3,_0x316317){logger['info'](_0x6eec('0x27'),_0x316317);return request({'uri':util[_0x6eec('0x1d')](_0x6eec('0x28'),_0x29879c[_0x6eec('0x10')]),'qs':{'query':util['format'](_0x6eec('0x29'),_0x316317)}})[_0x6eec('0x18')](function(_0x518ba5){var _0x54b446;if(_0x518ba5[_0x6eec('0x22')]['length']){_0x518ba5[_0x6eec('0x22')]=_[_0x6eec('0x2a')](_0x518ba5[_0x6eec('0x22')],{'suspended':![],'role':_0x6eec('0x2b')});if(_0x518ba5[_0x6eec('0x22')][_0x6eec('0x2c')]){_0x54b446=_[_0x6eec('0x2d')](_0x518ba5[_0x6eec('0x22')]);}}if(_0x54b446){logger[_0x6eec('0xe')](_0x6eec('0x2e'));return _0x54b446;}else{logger['info'](_0x6eec('0x2f'));return request({'uri':util['format'](_0x6eec('0x30'),_0x29879c[_0x6eec('0x10')]),'method':_0x6eec('0x31'),'body':{'user':{'role':'end-user','name':util['format']('Caller\x20-\x20%s',_0x20bed3||_0x316317),'phone':_0x316317}}})[_0x6eec('0x18')](function(_0x26b0da){logger[_0x6eec('0xe')](_0x6eec('0x32'));return _0x26b0da[_0x6eec('0x26')];});}});}function getAuth(_0x23547d){var _0x22e0cb;if(_0x23547d[_0x6eec('0x33')]===_0x6eec('0x34')){_0x22e0cb=util[_0x6eec('0x1d')](_0x6eec('0x35'),_0x23547d[_0x6eec('0x36')],_0x23547d['password']);}else if(_0x23547d[_0x6eec('0x33')]===_0x6eec('0x37')){_0x22e0cb=util[_0x6eec('0x1d')]('%s/token:%s',_0x23547d[_0x6eec('0x36')],_0x23547d[_0x6eec('0x37')]);}return util[_0x6eec('0x1d')](_0x6eec('0x38'),new Buffer(_0x22e0cb)[_0x6eec('0x39')](_0x6eec('0x3a')));}function request(_0x4a7699){logger[_0x6eec('0x3b')](_0x6eec('0x3c'),JSON[_0x6eec('0x3d')](_0x4a7699));return rp(_['defaults'](_0x4a7699,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x28e5fa,_0x297f53){var _0x10960b=[];if(_0x28e5fa&&_0x28e5fa[_0x6eec('0x2c')]>0x0){_0x10960b=_[_0x6eec('0x3e')](_0x28e5fa,_0x297f53);}return _0x10960b;}function getCustomFields(_0x563b99,_0x223dfa){var _0x2c3b14=[];var _0x44118c={'custom_fields':[]};if(_0x563b99[_0x6eec('0x2c')]>0x0){_[_0x6eec('0x3f')](_0x563b99,function(_0x2be999){if(_0x2be999[_0x6eec('0x40')]===_0x6eec('0x41')&&_0x2be999['nameField']&&!_0x2be999[_0x6eec('0x42')]){_0x44118c[_0x2be999[_0x6eec('0x43')]['toLowerCase']()]=_0x2be999['content'][_0x6eec('0x39')]();}else if(_0x2be999[_0x6eec('0x40')]===_0x6eec('0x41')&&_0x2be999[_0x6eec('0x44')]&&_0x2be999['customField']){_0x44118c['custom_fields'][_0x6eec('0x45')]({'id':_0x2be999['idField'],'value':_0x2be999['content'][_0x6eec('0x39')]()});}else if(_0x2be999[_0x6eec('0x40')]===_0x6eec('0x46')&&_0x2be999[_0x6eec('0x47')]&&_0x2be999[_0x6eec('0x44')]&&_0x2be999['customField']){_0x223dfa[_0x2be999[_0x6eec('0x47')]]&&_0x44118c[_0x6eec('0x48')]['push']({'id':_0x2be999[_0x6eec('0x44')],'value':_0x223dfa[_0x2be999[_0x6eec('0x47')]]['toString']()});}else if(_0x2be999[_0x6eec('0x40')]===_0x6eec('0x49')&&_0x2be999['Variable']&&_0x2be999[_0x6eec('0x4a')][_0x6eec('0x13')]&&_0x2be999[_0x6eec('0x44')]&&_0x2be999[_0x6eec('0x42')]){_0x223dfa[_0x2be999['Variable'][_0x6eec('0x13')][_0x6eec('0x4b')]()]&&_0x44118c[_0x6eec('0x48')][_0x6eec('0x45')]({'id':_0x2be999[_0x6eec('0x44')],'value':_0x223dfa[_0x2be999['Variable']['name'][_0x6eec('0x4b')]()][_0x6eec('0x39')]()});}});}return _0x44118c;}exports[_0x6eec('0x4c')]=function(_0x18bcc5,_0x44c7b8,_0x59d7a7,_0x194f2e,_0x545f9d,_0x20524a){var _0x408295,_0x2d7c04;_0x20524a['remoteUri']=intUtil[_0x6eec('0x4d')](_0x20524a[_0x6eec('0x10')]);_0x20524a[_0x6eec('0x4e')]=intUtil[_0x6eec('0x4d')](_0x20524a[_0x6eec('0x4e')]);if(_0x545f9d&&_0x545f9d['monitor_format']){logger[_0x6eec('0xe')]('[QUEUE]','Recording\x20is\x20enabled!');_0x44c7b8[_0x6eec('0x4f')]=util['format'](_0x6eec('0x50'),_0x20524a[_0x6eec('0x4e')],_0x44c7b8[_0x6eec('0x51')],md5(_0x44c7b8['uniqueid']));}else{_0x44c7b8['recordingURL']='';}headers[_0x6eec('0x52')]=getAuth(_0x20524a);return getUser(_0x20524a,_0x194f2e[_0x6eec('0x53')])[_0x6eec('0x18')](function(_0x2d0fc0){_0x408295=_0x2d0fc0;logger[_0x6eec('0xe')](_0x6eec('0x54'),_0x408295['id']);return getEndUser(_0x20524a,_0x44c7b8[_0x6eec('0x55')],_0x44c7b8[_0x6eec('0x56')]);})[_0x6eec('0x18')](function(_0x2a1545){_0x2d7c04=_0x2a1545;logger['info']('The\x20Enduser\x20ID\x20is:',_0x2d7c04['id']);return getTicket(_0x20524a,_0x408295,_0x2d7c04,_0x59d7a7,_0x44c7b8);})[_0x6eec('0x18')](function(_0x2270ce){if(_0x2270ce){logger[_0x6eec('0xe')]('The\x20Ticket\x20ID\x20is:',_0x2270ce['id']);switch(_0x20524a[_0x6eec('0x40')]){case _0x6eec('0x57'):logger[_0x6eec('0xe')](_0x6eec('0x58'),_0x6eec('0x59'));return request({'uri':util[_0x6eec('0x1d')](_0x6eec('0x5a'),_0x20524a[_0x6eec('0x10')],_0x408295['id'],_0x2270ce['id']),'method':'POST'});case _0x6eec('0x5b'):logger[_0x6eec('0xe')](_0x6eec('0x58'),_0x6eec('0x5c'));emit(util['format']('user:%s',_0x194f2e['name']),_0x6eec('0x5d'),{'uri':util[_0x6eec('0x1d')](_0x6eec('0x5e'),_0x20524a[_0x6eec('0x10')],_0x2270ce['id'])});break;default:logger['error']('[QUEUE]',_0x6eec('0x5f'));}}})[_0x6eec('0x60')](function(_0x455241){logger['error'](_0x6eec('0x61'),util[_0x6eec('0x62')](_0x455241,{'showHidden':!![],'depth':null}));});};exports[_0x6eec('0x63')]=function(_0xf957c1,_0x15f1de,_0x4624eb,_0xb72d83,_0x19fe55,_0x45fed3,_0x4e921a){var _0x22cf6c,_0x5e51c9;_0x45fed3[_0x6eec('0x10')]=intUtil[_0x6eec('0x4d')](_0x45fed3[_0x6eec('0x10')]);_0x45fed3[_0x6eec('0x4e')]=intUtil[_0x6eec('0x4d')](_0x45fed3[_0x6eec('0x4e')]);if(_0x4e921a&&_0x4e921a[_0x6eec('0x64')]&&_0x4e921a['recordingFormat']!==_0x6eec('0x65')){logger['info'](_0x6eec('0x66'),'Recording\x20is\x20enabled!');_0x15f1de[_0x6eec('0x4f')]=util[_0x6eec('0x1d')](_0x6eec('0x50'),_0x45fed3[_0x6eec('0x4e')],_0x15f1de[_0x6eec('0x51')],md5(_0x15f1de[_0x6eec('0x51')]));}headers[_0x6eec('0x52')]=getAuth(_0x45fed3);return getUser(_0x45fed3,_0xb72d83[_0x6eec('0x53')])[_0x6eec('0x18')](function(_0x4114d1){_0x22cf6c=_0x4114d1;logger['info']('The\x20User\x20ID\x20is:',_0x22cf6c['id']);return getEndUser(_0x45fed3,_0x15f1de[_0x6eec('0x67')],_0x15f1de[_0x6eec('0x68')]);})[_0x6eec('0x18')](function(_0x2c0644){_0x5e51c9=_0x2c0644;logger[_0x6eec('0xe')]('The\x20Enduser\x20ID\x20is:',_0x5e51c9['id']);return getTicket(_0x45fed3,_0x22cf6c,_0x5e51c9,_0x4624eb,_0x15f1de);})[_0x6eec('0x18')](function(_0x20973e){if(_0x20973e){logger['info']('The\x20Ticket\x20ID\x20is:',_0x20973e['id']);switch(_0x45fed3['type']){case _0x6eec('0x57'):logger[_0x6eec('0xe')]('[OUTBOUND]',_0x6eec('0x59'));return request({'uri':util[_0x6eec('0x1d')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x45fed3[_0x6eec('0x10')],_0x22cf6c['id'],_0x20973e['id']),'method':_0x6eec('0x31')});case _0x6eec('0x5b'):logger[_0x6eec('0xe')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6eec('0x1d')](_0x6eec('0x69'),_0xb72d83[_0x6eec('0x13')]),_0x6eec('0x5d'),{'uri':util[_0x6eec('0x1d')](_0x6eec('0x5e'),_0x45fed3[_0x6eec('0x10')],_0x20973e['id'])});break;default:logger[_0x6eec('0x6a')](_0x6eec('0x66'),_0x6eec('0x5f'));}}})[_0x6eec('0x60')](function(_0x9819f6){logger[_0x6eec('0x6a')](_0x6eec('0x6b'),util[_0x6eec('0x62')](_0x9819f6,{'showHidden':!![],'depth':null}));});};exports[_0x6eec('0x6c')]=function(_0x1af7e3,_0x4dac02,_0x2ef374,_0x2236f7,_0x48bb52,_0x2658c4){var _0x464984,_0x5bdb67;_0x2658c4[_0x6eec('0x10')]=intUtil[_0x6eec('0x4d')](_0x2658c4[_0x6eec('0x10')]);_0x2658c4[_0x6eec('0x4e')]=intUtil['stripTrailingSlash'](_0x2658c4[_0x6eec('0x4e')]);if(_0x48bb52&&_0x48bb52[_0x6eec('0x6d')]){logger[_0x6eec('0xe')](_0x6eec('0x6e'),_0x6eec('0x6f'));_0x4dac02[_0x6eec('0x4f')]=util['format'](_0x6eec('0x50'),_0x2658c4['serverUrl'],_0x4dac02[_0x6eec('0x51')],md5(_0x4dac02[_0x6eec('0x51')]));}else{_0x4dac02[_0x6eec('0x4f')]='';}headers[_0x6eec('0x52')]=getAuth(_0x2658c4);return getUser(_0x2658c4)[_0x6eec('0x18')](function(_0x1b3705){_0x464984=_0x1b3705;logger[_0x6eec('0xe')](_0x6eec('0x54'),_0x464984['id']);return getEndUser(_0x2658c4,_0x4dac02[_0x6eec('0x55')],_0x4dac02['calleridnum']);})[_0x6eec('0x18')](function(_0x12bb71){_0x5bdb67=_0x12bb71;logger[_0x6eec('0xe')]('The\x20Enduser\x20ID\x20is:',_0x5bdb67['id']);return getTicket(_0x2658c4,_0x464984,_0x5bdb67,_0x2ef374,_0x4dac02);})[_0x6eec('0x18')](function(_0x2920dc){if(_0x2920dc){logger['info'](_0x6eec('0x70'),_0x2920dc['id']);}})[_0x6eec('0x60')](function(_0x1b1ae9){logger[_0x6eec('0x6a')](_0x6eec('0x71'),util['inspect'](_0x1b1ae9,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x81bd=['Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','[ABANDONED]','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','getString','Subjects','Descriptions','Fields','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','%s/users/me.json','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Enduser\x20created.','authType','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','stringify','GET','map','forEach','type','nameField','customField','toLowerCase','content','idField','custom_fields','variable','variableName','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error'];(function(_0x1e5f05,_0x593a33){var _0x404385=function(_0x465da3){while(--_0x465da3){_0x1e5f05['push'](_0x1e5f05['shift']());}};_0x404385(++_0x593a33);}(_0x81bd,0x7c));var _0xd81b=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0x81bd[_0x360739];return _0x3e23a1;};'use strict';var _=require(_0xd81b('0x0'));var rp=require(_0xd81b('0x1'));var md5=require(_0xd81b('0x2'));var util=require(_0xd81b('0x3'));var Redis=require(_0xd81b('0x4'));var intUtil=require(_0xd81b('0x5'));var config=require(_0xd81b('0x6'));var logger=require('../../../../config/logger')(_0xd81b('0x7'));config[_0xd81b('0x8')]=_[_0xd81b('0x9')](config['redis'],{'host':_0xd81b('0xa'),'port':0x18eb});var io=require(_0xd81b('0xb'))(new Redis(config[_0xd81b('0x8')]));function emit(_0x562084,_0x5e14e8,_0xa4cf97){io['to'](_0x562084)['emit'](_0x5e14e8,_0xa4cf97);}var headers={'Content-Type':_0xd81b('0xc'),'Accept':_0xd81b('0xc')};function getTicket(_0x3420a7,_0x86dab6,_0x17fba4,_0x1ff60f,_0x4391be){logger[_0xd81b('0xd')](_0xd81b('0xe'));return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x10'),_0x3420a7[_0xd81b('0x11')]),'method':_0xd81b('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x17fba4['id'],'submitter_id':_0x86dab6?_0x86dab6['id']:undefined,'assignee_id':_0x86dab6?_0x86dab6['id']:undefined,'tags':getTags(_0x1ff60f[_0xd81b('0x13')],'name'),'subject':intUtil[_0xd81b('0x14')](_0x1ff60f[_0xd81b('0x15')],_0x4391be,'\x20'),'description':intUtil['getString'](_0x1ff60f[_0xd81b('0x16')],_0x4391be,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x1ff60f[_0xd81b('0x16')],_0x4391be,'\x0a')}},getCustomFields(_0x1ff60f[_0xd81b('0x17')],_0x4391be))}})[_0xd81b('0x18')](function(_0x35cfc1){logger[_0xd81b('0xd')]('Ticket\x20created!');return _0x35cfc1[_0xd81b('0x19')];});}function getUser(_0x27b7a0,_0x5c2863){if(intUtil[_0xd81b('0x1a')](_0x5c2863)){logger[_0xd81b('0xd')](_0xd81b('0x1b'),_0x5c2863);return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x1c'),_0x27b7a0[_0xd81b('0x11')]),'qs':{'query':util[_0xd81b('0xf')](_0xd81b('0x1d'),_0x5c2863)}})[_0xd81b('0x18')](function(_0x285164){if(_0x285164[_0xd81b('0x1e')]){logger[_0xd81b('0xd')](_0xd81b('0x1f'));return _[_0xd81b('0x20')](_0x285164[_0xd81b('0x21')],{'email':_0x5c2863,'role':_0xd81b('0x22')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x23'),_0x27b7a0[_0xd81b('0x11')])})['then'](function(_0x19ed0e){logger[_0xd81b('0xd')]('Admin\x20account\x20selected.');return _0x19ed0e[_0xd81b('0x24')];});}});}else{logger[_0xd81b('0xd')](_0xd81b('0x25'));return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x23'),_0x27b7a0[_0xd81b('0x11')])})[_0xd81b('0x18')](function(_0x5ecba9){logger[_0xd81b('0xd')](_0xd81b('0x26'));return _0x5ecba9[_0xd81b('0x24')];});}}function getEndUser(_0x1bf351,_0x596389,_0x28768f){logger[_0xd81b('0xd')](_0xd81b('0x27'),_0x28768f);return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x1c'),_0x1bf351[_0xd81b('0x11')]),'qs':{'query':util[_0xd81b('0xf')](_0xd81b('0x28'),_0x28768f)}})[_0xd81b('0x18')](function(_0x483a3d){var _0x469cc4;if(_0x483a3d['results']['length']){_0x483a3d[_0xd81b('0x21')]=_[_0xd81b('0x29')](_0x483a3d['results'],{'suspended':![],'role':'end-user'});if(_0x483a3d[_0xd81b('0x21')][_0xd81b('0x2a')]){_0x469cc4=_[_0xd81b('0x2b')](_0x483a3d[_0xd81b('0x21')]);}}if(_0x469cc4){logger[_0xd81b('0xd')](_0xd81b('0x2c'));return _0x469cc4;}else{logger['info'](_0xd81b('0x2d'));return request({'uri':util[_0xd81b('0xf')]('%s/users.json',_0x1bf351['remoteUri']),'method':_0xd81b('0x12'),'body':{'user':{'role':_0xd81b('0x2e'),'name':util['format']('Caller\x20-\x20%s',_0x596389||_0x28768f),'phone':_0x28768f}}})['then'](function(_0x322991){logger[_0xd81b('0xd')](_0xd81b('0x2f'));return _0x322991[_0xd81b('0x24')];});}});}function getAuth(_0xa56339){var _0x12ee8f;if(_0xa56339[_0xd81b('0x30')]==='password'){_0x12ee8f=util[_0xd81b('0xf')]('%s:%s',_0xa56339[_0xd81b('0x31')],_0xa56339[_0xd81b('0x32')]);}else if(_0xa56339[_0xd81b('0x30')]===_0xd81b('0x33')){_0x12ee8f=util[_0xd81b('0xf')](_0xd81b('0x34'),_0xa56339[_0xd81b('0x31')],_0xa56339[_0xd81b('0x33')]);}return util[_0xd81b('0xf')](_0xd81b('0x35'),new Buffer(_0x12ee8f)[_0xd81b('0x36')](_0xd81b('0x37')));}function request(_0x346038){logger['debug']('[HTTP]',JSON[_0xd81b('0x38')](_0x346038));return rp(_[_0xd81b('0x9')](_0x346038,{'method':_0xd81b('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x59c066,_0x362ebc){var _0x37ba34=[];if(_0x59c066&&_0x59c066['length']>0x0){_0x37ba34=_[_0xd81b('0x3a')](_0x59c066,_0x362ebc);}return _0x37ba34;}function getCustomFields(_0xaa9e97,_0x512e39){var _0xed5272=[];var _0x5a48e8={'custom_fields':[]};if(_0xaa9e97[_0xd81b('0x2a')]>0x0){_[_0xd81b('0x3b')](_0xaa9e97,function(_0x203365){if(_0x203365[_0xd81b('0x3c')]==='string'&&_0x203365[_0xd81b('0x3d')]&&!_0x203365[_0xd81b('0x3e')]){_0x5a48e8[_0x203365[_0xd81b('0x3d')][_0xd81b('0x3f')]()]=_0x203365[_0xd81b('0x40')][_0xd81b('0x36')]();}else if(_0x203365[_0xd81b('0x3c')]==='string'&&_0x203365[_0xd81b('0x41')]&&_0x203365[_0xd81b('0x3e')]){_0x5a48e8[_0xd81b('0x42')]['push']({'id':_0x203365[_0xd81b('0x41')],'value':_0x203365[_0xd81b('0x40')][_0xd81b('0x36')]()});}else if(_0x203365[_0xd81b('0x3c')]===_0xd81b('0x43')&&_0x203365['variableName']&&_0x203365[_0xd81b('0x41')]&&_0x203365[_0xd81b('0x3e')]){_0x512e39[_0x203365[_0xd81b('0x44')]]&&_0x5a48e8[_0xd81b('0x42')][_0xd81b('0x45')]({'id':_0x203365[_0xd81b('0x41')],'value':_0x512e39[_0x203365[_0xd81b('0x44')]][_0xd81b('0x36')]()});}else if(_0x203365[_0xd81b('0x3c')]===_0xd81b('0x46')&&_0x203365[_0xd81b('0x47')]&&_0x203365['Variable'][_0xd81b('0x48')]&&_0x203365[_0xd81b('0x41')]&&_0x203365[_0xd81b('0x3e')]){_0x512e39[_0x203365[_0xd81b('0x47')][_0xd81b('0x48')][_0xd81b('0x3f')]()]&&_0x5a48e8[_0xd81b('0x42')][_0xd81b('0x45')]({'id':_0x203365['idField'],'value':_0x512e39[_0x203365['Variable'][_0xd81b('0x48')][_0xd81b('0x3f')]()][_0xd81b('0x36')]()});}});}return _0x5a48e8;}exports[_0xd81b('0x49')]=function(_0x1f5d84,_0x37031b,_0x334bd0,_0x2e44f3,_0x2fa588,_0xcfbbc2){var _0x41e2e6,_0x38e436;_0xcfbbc2['remoteUri']=intUtil[_0xd81b('0x4a')](_0xcfbbc2[_0xd81b('0x11')]);_0xcfbbc2[_0xd81b('0x4b')]=intUtil[_0xd81b('0x4a')](_0xcfbbc2[_0xd81b('0x4b')]);if(_0x2fa588&&_0x2fa588[_0xd81b('0x4c')]){logger[_0xd81b('0xd')](_0xd81b('0x4d'),_0xd81b('0x4e'));_0x37031b['recordingURL']=util[_0xd81b('0xf')](_0xd81b('0x4f'),_0xcfbbc2[_0xd81b('0x4b')],_0x37031b[_0xd81b('0x50')],md5(_0x37031b['uniqueid']));}else{_0x37031b[_0xd81b('0x51')]='';}headers[_0xd81b('0x52')]=getAuth(_0xcfbbc2);return getUser(_0xcfbbc2,_0x2e44f3[_0xd81b('0x53')])[_0xd81b('0x18')](function(_0x2699e6){_0x41e2e6=_0x2699e6;logger[_0xd81b('0xd')](_0xd81b('0x54'),_0x41e2e6['id']);return getEndUser(_0xcfbbc2,_0x37031b[_0xd81b('0x55')],_0x37031b[_0xd81b('0x56')]);})['then'](function(_0x534d10){_0x38e436=_0x534d10;logger[_0xd81b('0xd')](_0xd81b('0x57'),_0x38e436['id']);return getTicket(_0xcfbbc2,_0x41e2e6,_0x38e436,_0x334bd0,_0x37031b);})[_0xd81b('0x18')](function(_0x4da281){if(_0x4da281){logger[_0xd81b('0xd')](_0xd81b('0x58'),_0x4da281['id']);switch(_0xcfbbc2[_0xd81b('0x3c')]){case _0xd81b('0x59'):logger['info'](_0xd81b('0x4d'),_0xd81b('0x5a'));return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x5b'),_0xcfbbc2[_0xd81b('0x11')],_0x41e2e6['id'],_0x4da281['id']),'method':'POST'});case _0xd81b('0x5c'):logger[_0xd81b('0xd')]('[QUEUE]',_0xd81b('0x5d'));emit(util[_0xd81b('0xf')](_0xd81b('0x5e'),_0x2e44f3[_0xd81b('0x48')]),_0xd81b('0x5f'),{'uri':util[_0xd81b('0xf')](_0xd81b('0x60'),_0xcfbbc2[_0xd81b('0x11')],_0x4da281['id'])});break;default:logger[_0xd81b('0x61')](_0xd81b('0x4d'),_0xd81b('0x62'));}}})['catch'](function(_0x285e82){logger['error'](_0xd81b('0x63'),util[_0xd81b('0x64')](_0x285e82,{'showHidden':!![],'depth':null}));});};exports[_0xd81b('0x65')]=function(_0x3c2a9f,_0x34d2a2,_0x1e9f73,_0x5c196a,_0x2d978d,_0xe0c9c6,_0x51f5a1){var _0x492f5f,_0x470d40;_0xe0c9c6['remoteUri']=intUtil[_0xd81b('0x4a')](_0xe0c9c6['remoteUri']);_0xe0c9c6[_0xd81b('0x4b')]=intUtil[_0xd81b('0x4a')](_0xe0c9c6[_0xd81b('0x4b')]);if(_0x51f5a1&&_0x51f5a1['recordingFormat']&&_0x51f5a1[_0xd81b('0x66')]!==_0xd81b('0x67')){logger['info'](_0xd81b('0x68'),_0xd81b('0x4e'));_0x34d2a2['recordingURL']=util[_0xd81b('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe0c9c6[_0xd81b('0x4b')],_0x34d2a2[_0xd81b('0x50')],md5(_0x34d2a2[_0xd81b('0x50')]));}headers[_0xd81b('0x52')]=getAuth(_0xe0c9c6);return getUser(_0xe0c9c6,_0x5c196a[_0xd81b('0x53')])[_0xd81b('0x18')](function(_0x2f2afe){_0x492f5f=_0x2f2afe;logger[_0xd81b('0xd')](_0xd81b('0x54'),_0x492f5f['id']);return getEndUser(_0xe0c9c6,_0x34d2a2[_0xd81b('0x69')],_0x34d2a2['destcalleridnum']);})[_0xd81b('0x18')](function(_0x434434){_0x470d40=_0x434434;logger[_0xd81b('0xd')](_0xd81b('0x57'),_0x470d40['id']);return getTicket(_0xe0c9c6,_0x492f5f,_0x470d40,_0x1e9f73,_0x34d2a2);})[_0xd81b('0x18')](function(_0x15416a){if(_0x15416a){logger[_0xd81b('0xd')]('The\x20Ticket\x20ID\x20is:',_0x15416a['id']);switch(_0xe0c9c6['type']){case'integrationTab':logger[_0xd81b('0xd')](_0xd81b('0x68'),_0xd81b('0x5a'));return request({'uri':util[_0xd81b('0xf')](_0xd81b('0x5b'),_0xe0c9c6[_0xd81b('0x11')],_0x492f5f['id'],_0x15416a['id']),'method':_0xd81b('0x12')});case'newTab':logger[_0xd81b('0xd')](_0xd81b('0x68'),_0xd81b('0x5d'));emit(util[_0xd81b('0xf')](_0xd81b('0x5e'),_0x5c196a[_0xd81b('0x48')]),_0xd81b('0x5f'),{'uri':util['format'](_0xd81b('0x60'),_0xe0c9c6[_0xd81b('0x11')],_0x15416a['id'])});break;default:logger[_0xd81b('0x61')](_0xd81b('0x68'),_0xd81b('0x62'));}}})[_0xd81b('0x6a')](function(_0x1be43d){logger[_0xd81b('0x61')](_0xd81b('0x6b'),util[_0xd81b('0x64')](_0x1be43d,{'showHidden':!![],'depth':null}));});};exports[_0xd81b('0x6c')]=function(_0x43d40d,_0x5ea906,_0xc45841,_0x5358a6,_0x2e7141,_0x6fa974){var _0x414f40,_0xc3c117;_0x6fa974[_0xd81b('0x11')]=intUtil[_0xd81b('0x4a')](_0x6fa974[_0xd81b('0x11')]);_0x6fa974[_0xd81b('0x4b')]=intUtil[_0xd81b('0x4a')](_0x6fa974[_0xd81b('0x4b')]);if(_0x2e7141&&_0x2e7141['monitor_format']){logger[_0xd81b('0xd')](_0xd81b('0x6d'),_0xd81b('0x4e'));_0x5ea906[_0xd81b('0x51')]=util[_0xd81b('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6fa974['serverUrl'],_0x5ea906[_0xd81b('0x50')],md5(_0x5ea906[_0xd81b('0x50')]));}else{_0x5ea906[_0xd81b('0x51')]='';}headers[_0xd81b('0x52')]=getAuth(_0x6fa974);return getUser(_0x6fa974)[_0xd81b('0x18')](function(_0x1a95d5){_0x414f40=_0x1a95d5;logger[_0xd81b('0xd')]('The\x20User\x20ID\x20is:',_0x414f40['id']);return getEndUser(_0x6fa974,_0x5ea906[_0xd81b('0x55')],_0x5ea906[_0xd81b('0x56')]);})[_0xd81b('0x18')](function(_0x1c6ec8){_0xc3c117=_0x1c6ec8;logger[_0xd81b('0xd')](_0xd81b('0x57'),_0xc3c117['id']);return getTicket(_0x6fa974,_0x414f40,_0xc3c117,_0xc45841,_0x5ea906);})[_0xd81b('0x18')](function(_0x185f28){if(_0x185f28){logger[_0xd81b('0xd')]('The\x20Ticket\x20ID\x20is:',_0x185f28['id']);}})[_0xd81b('0x6a')](function(_0x34d6dc){logger[_0xd81b('0x61')](_0xd81b('0x6e'),util[_0xd81b('0x64')](_0x34d6dc,{'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 7d571ac..70ff800 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 _0xd33b=['[HTTP]','stringify','string','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','then','add','expires_in','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','data','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','diff','starttime','lastevent','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','Fields','err','queue','host','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridnum','Outbound','trigger:browser:url','monitor_format','[ABANDONED]','request-promise','md5','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','debug'];(function(_0x4ece2f,_0xe15b55){var _0x5b662f=function(_0x110f8c){while(--_0x110f8c){_0x4ece2f['push'](_0x4ece2f['shift']());}};_0x5b662f(++_0xe15b55);}(_0xd33b,0x123));var _0xbd33=function(_0x23bbac,_0x5eef01){_0x23bbac=_0x23bbac-0x0;var _0x1cc160=_0xd33b[_0x23bbac];return _0x1cc160;};'use strict';var _=require('lodash');var rp=require(_0xbd33('0x0'));var md5=require(_0xbd33('0x1'));var util=require('util');var intUtil=require('./util');var moment=require(_0xbd33('0x2'));var Redis=require(_0xbd33('0x3'));var BPromise=require(_0xbd33('0x4'));var config=require(_0xbd33('0x5'));var logger=require(_0xbd33('0x6'))(_0xbd33('0x7'));config[_0xbd33('0x8')]=_[_0xbd33('0x9')](config[_0xbd33('0x8')],{'host':_0xbd33('0xa'),'port':0x18eb});var io=require(_0xbd33('0xb'))(new Redis(config[_0xbd33('0x8')]));function emit(_0x24e01e,_0x1799de,_0xbfbdc5){io['to'](_0x24e01e)['emit'](_0x1799de,_0xbfbdc5);}function request(_0x11e57e){logger[_0xbd33('0xc')](_0xbd33('0xd'),JSON[_0xbd33('0xe')](_0x11e57e));return rp(_0x11e57e);}function getCustomFields(_0x4efb26,_0x5716f5){var _0x594bb5={};if(_0x4efb26['length']>0x0){_['forEach'](_0x4efb26,function(_0x470694){if(_0x470694['type']===_0xbd33('0xf')&&_0x470694['idField']){_0x594bb5[_0x470694[_0xbd33('0x10')]]=_0x470694[_0xbd33('0x11')][_0xbd33('0x12')]();}else if(_0x470694[_0xbd33('0x13')]===_0xbd33('0x14')&&_0x470694[_0xbd33('0x15')]&&_0x470694[_0xbd33('0x10')]&&_0x5716f5[_0x470694[_0xbd33('0x15')]]){_0x594bb5[_0x470694[_0xbd33('0x10')]]=_0x5716f5[_0x470694[_0xbd33('0x15')]][_0xbd33('0x12')]();}else if(_0x470694['type']===_0xbd33('0x16')&&_0x470694[_0xbd33('0x17')]&&_0x470694[_0xbd33('0x17')][_0xbd33('0x18')]&&_0x470694[_0xbd33('0x10')]&&_0x5716f5[_0x470694[_0xbd33('0x17')][_0xbd33('0x18')][_0xbd33('0x19')]()]){_0x594bb5[_0x470694[_0xbd33('0x10')]]=_0x5716f5[_0x470694[_0xbd33('0x17')][_0xbd33('0x18')][_0xbd33('0x19')]()][_0xbd33('0x12')]();}});}return _0x594bb5;}function getName(_0x37f1d1){if(_0x37f1d1['indexOf']('\x20')>0x0){var _0x2cc598=_0x37f1d1[_0xbd33('0x1a')](/ (.+)/);if(_0x2cc598[0x1]){return _0x2cc598;}}return[_0x37f1d1,_0x37f1d1];}var accountsTokens={};function getAccessToken(_0x13dc7d){return new Promise(function(_0x278b03,_0x22a734){if(!_[_0xbd33('0x1b')](accountsTokens[_0x13dc7d['id']])&&!_[_0xbd33('0x1b')](accountsTokens[_0x13dc7d['id']][_0xbd33('0x1c')])){if(moment()[_0xbd33('0x1d')](accountsTokens[_0x13dc7d['id']]['expires_in'])){_0x278b03(accountsTokens[_0x13dc7d['id']][_0xbd33('0x1c')]);}}var _0x377018;switch(_0x13dc7d[_0xbd33('0x1e')]){case'US':_0x377018=_0xbd33('0x1f');break;case'AU':_0x377018=_0xbd33('0x20');break;case'EU':_0x377018=_0xbd33('0x21');break;case'IN':_0x377018=_0xbd33('0x22');break;case'CN':_0x377018=_0xbd33('0x23');break;default:_0x377018=_0xbd33('0x21');break;}var _0xe8315a={'method':_0xbd33('0x24'),'uri':_0x377018+_0xbd33('0x25'),'qs':{'refresh_token':_0x13dc7d['refreshToken'],'client_id':_0x13dc7d[_0xbd33('0x26')],'client_secret':_0x13dc7d[_0xbd33('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0xe8315a)[_0xbd33('0x28')](function(_0x2dd99e){accountsTokens[_0x13dc7d['id']]={'access_token':_0x2dd99e[_0xbd33('0x1c')],'expires_in':moment()[_0xbd33('0x29')](_0x2dd99e[_0xbd33('0x2a')],_0xbd33('0x2b'))};_0x278b03(_0x2dd99e[_0xbd33('0x1c')]);})[_0xbd33('0x2c')](function(_0x5de660){logger[_0xbd33('0x2d')](_0xbd33('0x2e'),_0x5de660[_0xbd33('0x2f')]);_0x22a734(_0x5de660);});});}function getUser(_0x5ba3d9,_0x2e7424,_0x248500,_0x3f530d){logger[_0xbd33('0x30')](_0xbd33('0x31'));return request({'method':_0xbd33('0x32'),'uri':util[_0xbd33('0x33')](_0xbd33('0x34'),_0x2e7424),'qs':{'type':_0xbd33('0x35')},'headers':{'Authorization':_0xbd33('0x36')+_0x5ba3d9},'json':!![]})[_0xbd33('0x28')](function(_0x25ea49){if(_0x25ea49[_0xbd33('0x37')]){var _0x500cde=-0x1;if(_[_0xbd33('0x38')](_0x25ea49[_0xbd33('0x37')])){if(!_['isNil'](_0x3f530d)){_0x500cde=_[_0xbd33('0x39')](_0x25ea49[_0xbd33('0x37')],function(_0x2694a5){return _0x2694a5[_0xbd33('0x3a')]===_0x3f530d;});}if(_0x500cde>=0x0){logger[_0xbd33('0x30')](_0xbd33('0x3b'));}else{logger[_0xbd33('0x30')]('Using\x20the\x20admin\x20account!');_0x500cde=_[_0xbd33('0x39')](_0x25ea49[_0xbd33('0x37')],function(_0x481f73){return _0x481f73[_0xbd33('0x3c')]['name']===_0xbd33('0x3d');});}return _0x25ea49[_0xbd33('0x37')][_0x500cde];}else{if(_0x25ea49[_0xbd33('0x3e')][_0xbd33('0x3c')]['name']==='Administrator'){logger[_0xbd33('0x30')]('Using\x20the\x20admin\x20account!');user=_0x25ea49['user'];return user;}else{logger['error'](_0xbd33('0x3f'),JSON[_0xbd33('0xe')](_0x25ea49));throw new Error(_0xbd33('0x40')+JSON[_0xbd33('0xe')](_0x25ea49));}}}else{logger[_0xbd33('0x2d')](_0xbd33('0x3f'),JSON[_0xbd33('0xe')](_0x25ea49));throw new Error(_0xbd33('0x40')+JSON[_0xbd33('0xe')](_0x25ea49));}})[_0xbd33('0x2c')](function(_0x196313){console['error'](_0x196313);});}function getZohoUser(_0x23e0af,_0x5cae10){return new BPromise(function(_0x279b99,_0x189136){request(_0x23e0af)[_0xbd33('0x28')](function(_0x1d2f98){var _0xdaacc7=null;if(_0x1d2f98){_0xdaacc7=_0x1d2f98['data'][0x0];_0xdaacc7[_0xbd33('0x41')]=_0x5cae10;}_0x279b99(_0xdaacc7);})[_0xbd33('0x2c')](function(_0x32e594){_0x189136(_0x32e594);});});}function createEndUser(_0x46eec5,_0x2b2117,_0x4a37a6,_0x365bd9,_0xc2dbcf,_0x5f4662){var _0x4a37a6=getName(_0x4a37a6);return request({'method':_0xbd33('0x24'),'uri':_0xbd33('0x42')+_0x2b2117+_0xbd33('0x43')+_[_0xbd33('0x44')](_0x5f4662[_0xbd33('0x45')])+'s','body':{'data':[{'Last_Name':_0x4a37a6[0x1],'First_Name':_0x4a37a6[0x0],'Phone':_0x365bd9,'Owner':{'name':!_[_0xbd33('0x1b')](_0xc2dbcf[_0xbd33('0x46')][_0xbd33('0x18')])?_0xc2dbcf[_0xbd33('0x46')][_0xbd33('0x18')]:!_[_0xbd33('0x1b')](_0xc2dbcf[_0xbd33('0x47')])?_0xc2dbcf['first_name']+'\x20'+_0xc2dbcf[_0xbd33('0x48')]:_0xc2dbcf[_0xbd33('0x48')],'id':_0xc2dbcf['id']}}]},'headers':{'Authorization':_0xbd33('0x36')+_0x46eec5},'json':!![]})['then'](function(_0x499a83){if(_0x499a83&&_0x499a83['data'][0x0][_0xbd33('0x49')]===_0xbd33('0x4a')){var _0x20353a=_0x499a83[_0xbd33('0x4b')][0x0][_0xbd33('0x4c')];_0x20353a[_0xbd33('0x41')]=_[_0xbd33('0x44')](_0x5f4662[_0xbd33('0x45')])+'s';return _0x20353a;}logger['error'](_0xbd33('0x3f'),JSON['stringify'](data));throw new Error(_0xbd33('0x4d')+JSON[_0xbd33('0xe')](data));})['catch'](function(_0x3f0221){console[_0xbd33('0x4e')](_0xbd33('0x4f'),_0x3f0221);});}function getEndUser(_0x13945c,_0x41f1f4,_0x5951b8,_0x52d6c5,_0x7c465a,_0x51932c,_0x222567){var _0x1cb452={'method':_0xbd33('0x32'),'uri':'','headers':{'Authorization':_0xbd33('0x36')+_0x13945c},'json':!![]};switch(_0x222567[_0xbd33('0x50')]){case _0xbd33('0x51'):_0x1cb452[_0xbd33('0x52')]=_0xbd33('0x42')+_0x41f1f4+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x7c465a+'))';return getZohoUser(_0x1cb452,'Contacts')[_0xbd33('0x28')](function(_0x1eb713){if(_0x1eb713)return _0x1eb713;_0x1cb452[_0xbd33('0x52')]='https://www.zohoapis.'+_0x41f1f4+_0xbd33('0x53')+_0x7c465a+'))';return getZohoUser(_0x1cb452,'Leads')['then'](function(_0x46ba05){if(_0x46ba05)return _0x46ba05;if(_0x222567['moduleCreate']!=_0xbd33('0x54')){return createEndUser(_0x13945c,_0x41f1f4,_0x52d6c5,_0x7c465a,_0x51932c,_0x222567);}else{return{};}});});break;case _0xbd33('0x55'):_0x1cb452[_0xbd33('0x52')]=_0xbd33('0x42')+_0x41f1f4+_0xbd33('0x56')+_0x7c465a+'))';return getZohoUser(_0x1cb452,_0xbd33('0x57'))['then'](function(_0x462b7d){if(_0x462b7d)return _0x462b7d;if(_0x222567[_0xbd33('0x45')]!='nothing'){return createEndUser(_0x13945c,_0x41f1f4,_0x52d6c5,_0x7c465a,_0x51932c,_0x222567);}else{return{};}});break;case'lead':_0x1cb452[_0xbd33('0x52')]=_0xbd33('0x42')+_0x41f1f4+_0xbd33('0x53')+_0x7c465a+'))';return getZohoUser(_0x1cb452,_0xbd33('0x58'))['then'](function(_0x56fa6c){if(_0x56fa6c)return _0x56fa6c;if(_0x222567[_0xbd33('0x45')]!=_0xbd33('0x54')){return createEndUser(_0x13945c,_0x41f1f4,_0x52d6c5,_0x7c465a,_0x51932c,_0x222567);}else{return{};}});break;}}function getCall(_0x55b9ea,_0x351f36,_0x337ec5,_0x35976e,_0x145e87,_0x3e5aed,_0x50c51d,_0x45438d){logger['info'](_0xbd33('0x59'));var _0x4a561d={};_0x4a561d[_0xbd33('0x5a')]={'name':!_['isNil'](_0x35976e['role'][_0xbd33('0x18')])&&!_[_0xbd33('0x1b')](_0x35976e[_0xbd33('0x3c')]['name'])&&_0x35976e[_0xbd33('0x3c')]['name']===_0xbd33('0x5b')?_0x35976e[_0xbd33('0x46')]['name']:!_[_0xbd33('0x1b')](_0x35976e[_0xbd33('0x47')])?_0x35976e[_0xbd33('0x47')]+'\x20'+_0x35976e[_0xbd33('0x48')]:_0x35976e[_0xbd33('0x48')],'id':_0x35976e['id']};_0x4a561d[_0xbd33('0x5c')]=intUtil[_0xbd33('0x5d')](_0x3e5aed[_0xbd33('0x5e')],_0x50c51d,'\x20');_0x4a561d['Description']=intUtil[_0xbd33('0x5d')](_0x3e5aed['Descriptions'],_0x50c51d,'\x0a');if(_0x145e87['enduserType']==='Contacts'){_0x4a561d[_0xbd33('0x5f')]={'name':!_[_0xbd33('0x1b')](_0x145e87[_0xbd33('0x60')])?_0x145e87[_0xbd33('0x60')]:!_[_0xbd33('0x1b')](_0x145e87[_0xbd33('0x61')])?_0x145e87[_0xbd33('0x61')]+'\x20'+_0x145e87[_0xbd33('0x62')]:_0x145e87[_0xbd33('0x62')],'id':_0x145e87['id']};}if(_0x145e87[_0xbd33('0x41')]===_0xbd33('0x58')){_0x4a561d['What_Id']={'name':!_['isNil'](_0x145e87[_0xbd33('0x60')])?_0x145e87['Full_Name']:!_[_0xbd33('0x1b')](_0x145e87[_0xbd33('0x61')])?_0x145e87['First_Name']+'\x20'+_0x145e87[_0xbd33('0x62')]:_0x145e87[_0xbd33('0x62')],'id':_0x145e87['id']};_0x4a561d[_0xbd33('0x63')]=_[_0xbd33('0x44')](_0x145e87[_0xbd33('0x41')]);}if(_0x50c51d[_0xbd33('0x64')]){_0x4a561d['Call_Duration']=moment[_0xbd33('0x65')](parseInt(_0x50c51d[_0xbd33('0x64')])*0x3e8)[_0xbd33('0x33')](_0xbd33('0x66'));}else if(_0x50c51d[_0xbd33('0x67')]&&_0x50c51d[_0xbd33('0x68')]){_0x4a561d[_0xbd33('0x69')]=moment['utc'](moment(_0x50c51d['endtime'],'YYYY-MM-DDTHH:mm:ss')[_0xbd33('0x6a')](moment(_0x50c51d[_0xbd33('0x6b')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0xbd33('0x66'));}switch(_0x50c51d[_0xbd33('0x6c')]){case'called':_0x4a561d[_0xbd33('0x6d')]=_0xbd33('0x6e');break;case _0xbd33('0x6f'):case _0xbd33('0x70'):_0x4a561d[_0xbd33('0x6d')]=_0xbd33('0x71');break;case _0xbd33('0x72'):_0x4a561d[_0xbd33('0x6d')]='Rejected';break;case _0xbd33('0x73'):_0x4a561d['Call_Result']='Abandoned';break;default:}_0x4a561d[_0xbd33('0x74')]=(_0x45438d===_0xbd33('0x75')?moment(_0x50c51d[_0xbd33('0x6b')])['format'](_0xbd33('0x76')):moment(_0x50c51d[_0xbd33('0x77')])[_0xbd33('0x33')](_0xbd33('0x76')))||moment()[_0xbd33('0x33')]('YYYY-MM-DDTHH:mm:ss');_0x4a561d[_0xbd33('0x78')]=_0x45438d||_0xbd33('0x79');_0x4a561d=_['merge'](_0x4a561d,getCustomFields(_0x3e5aed[_0xbd33('0x7a')],_0x50c51d));return request({'method':_0xbd33('0x24'),'uri':_0xbd33('0x42')+_0x351f36+'/crm/v2/Calls','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x55b9ea},'body':{'data':[_0x4a561d]},'json':!![]})[_0xbd33('0x28')](function(_0x5471ea){if(_0x5471ea&&_0x5471ea['data'][0x0][_0xbd33('0x49')]===_0xbd33('0x4a')){logger[_0xbd33('0x30')]('Call\x20created!');return{'id':_0x5471ea['data'][0x0]['details']['id']};}})[_0xbd33('0x2c')](function(_0x3bed18){logger[_0xbd33('0x30')](_0xbd33('0x7b'),_0x3bed18[_0xbd33('0x2f')]);console[_0xbd33('0x4e')](_0xbd33('0x7b'),_0x3bed18);});}exports[_0xbd33('0x7c')]=function(_0x404a7e,_0x3ff06f,_0x28219f,_0xc1d0d2,_0x44c7f5,_0x1bfdfe){var _0x4399ba,_0x107485,_0x5b6736;_0x1bfdfe['host']=intUtil['stripTrailingSlash'](_0x1bfdfe[_0xbd33('0x7d')]);_0x1bfdfe[_0xbd33('0x7e')]=intUtil[_0xbd33('0x7f')](_0x1bfdfe[_0xbd33('0x7e')]);if(_0x44c7f5&&_0x44c7f5['monitor_format']){logger[_0xbd33('0x30')](_0xbd33('0x80'),_0xbd33('0x81'));_0x3ff06f['recordingURL']=_0x1bfdfe[_0xbd33('0x7e')]+_0xbd33('0x82')+_0x3ff06f[_0xbd33('0x83')]+_0xbd33('0x84')+md5(_0x3ff06f[_0xbd33('0x83')]);}else{_0x3ff06f[_0xbd33('0x85')]='';}var _0x8feb63=_0x1bfdfe[_0xbd33('0x7d')]===_0xbd33('0x86')?'eu':_0xbd33('0x87');return getAccessToken(_0x1bfdfe)[_0xbd33('0x28')](function(_0x20a608){_0x5b6736=_0x20a608;return getUser(_0x5b6736,_0x8feb63,_0x1bfdfe,_0xc1d0d2[_0xbd33('0x3a')]);})['then'](function(_0x361290){_0x4399ba=_0x361290;logger[_0xbd33('0x30')](_0xbd33('0x88'),_0x4399ba['id']);return getEndUser(_0x5b6736,_0x8feb63,_0x1bfdfe,_0x3ff06f[_0xbd33('0x89')],_0x3ff06f[_0xbd33('0x8a')],_0x4399ba,_0x28219f);})[_0xbd33('0x28')](function(_0x30242a){_0x107485=_0x30242a;return getCall(_0x5b6736,_0x8feb63,_0x1bfdfe,_0x4399ba,_0x107485,_0x28219f,_0x3ff06f,_0xbd33('0x79'));})['then'](function(_0x334289){if(_0x334289){logger[_0xbd33('0x30')](_0xbd33('0x8b'),_0x334289['id']);logger['info'](_0xbd33('0x80'),_0xbd33('0x8c'));emit(util['format'](_0xbd33('0x8d'),_0xc1d0d2['name']),'trigger:browser:url',{'uri':_0xbd33('0x8e')+_0x1bfdfe[_0xbd33('0x7d')]+_0xbd33('0x8f')+_0x334289['id']});}})[_0xbd33('0x2c')](function(_0x8a0629){logger[_0xbd33('0x2d')](_0xbd33('0x80'),JSON[_0xbd33('0xe')](_0x8a0629));});};exports[_0xbd33('0x75')]=function(_0x1a9d08,_0x4475b,_0x3abd3c,_0x255b78,_0x541b27,_0x4b9401,_0x186424){var _0x458b27,_0x59ccf3,_0x50f9e6;_0x4b9401['host']=intUtil[_0xbd33('0x7f')](_0x4b9401['host']);_0x4b9401[_0xbd33('0x7e')]=intUtil[_0xbd33('0x7f')](_0x4b9401[_0xbd33('0x7e')]);if(_0x186424&&_0x186424[_0xbd33('0x90')]&&_0x186424[_0xbd33('0x90')]!==_0xbd33('0x91')){logger[_0xbd33('0x30')](_0xbd33('0x92'),'Recording\x20is\x20enabled!');_0x4475b[_0xbd33('0x85')]=_0x4b9401[_0xbd33('0x7e')]+_0xbd33('0x82')+_0x4475b[_0xbd33('0x83')]+_0xbd33('0x84')+md5(_0x4475b[_0xbd33('0x83')]);}var _0x491bdc=_0x4b9401[_0xbd33('0x7d')]==='zoho.eu'?'eu':_0xbd33('0x87');return getAccessToken(_0x4b9401)['then'](function(_0x21661a){_0x50f9e6=_0x21661a;return getUser(_0x50f9e6,_0x491bdc,_0x4b9401,_0x255b78[_0xbd33('0x3a')]);})[_0xbd33('0x28')](function(_0x5e9075){_0x458b27=_0x5e9075;logger['info'](_0xbd33('0x88'),_0x458b27['id']);return getEndUser(_0x50f9e6,_0x491bdc,_0x4b9401,_0x4475b['destcalleridname'],_0x4475b[_0xbd33('0x93')],_0x458b27,_0x3abd3c);})['then'](function(_0x516d5c){_0x59ccf3=_0x516d5c;return getCall(_0x50f9e6,_0x491bdc,_0x4b9401,_0x458b27,_0x59ccf3,_0x3abd3c,_0x4475b,_0xbd33('0x94'));})[_0xbd33('0x28')](function(_0x1a849c){if(_0x1a849c){logger['info'](_0xbd33('0x8b'),_0x1a849c['id']);logger[_0xbd33('0x30')](_0xbd33('0x92'),_0xbd33('0x8c'));emit(util[_0xbd33('0x33')](_0xbd33('0x8d'),_0x255b78['name']),_0xbd33('0x95'),{'uri':_0xbd33('0x8e')+_0x4b9401[_0xbd33('0x7d')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1a849c['id']});}})['catch'](function(_0x3315ba){logger[_0xbd33('0x2d')](_0xbd33('0x92'),JSON[_0xbd33('0xe')](_0x3315ba));});};exports['abandoned']=function(_0x414087,_0x56dcc8,_0x202101,_0x344811,_0x4395c8,_0x4e88d0){var _0x153636,_0x199451,_0x17a9ea;_0x4e88d0[_0xbd33('0x7d')]=intUtil[_0xbd33('0x7f')](_0x4e88d0[_0xbd33('0x7d')]);_0x4e88d0[_0xbd33('0x7e')]=intUtil[_0xbd33('0x7f')](_0x4e88d0[_0xbd33('0x7e')]);if(_0x4395c8&&_0x4395c8[_0xbd33('0x96')]){logger[_0xbd33('0x30')](_0xbd33('0x97'),_0xbd33('0x81'));_0x56dcc8[_0xbd33('0x85')]=_0x4e88d0[_0xbd33('0x7e')]+_0xbd33('0x82')+_0x56dcc8[_0xbd33('0x83')]+_0xbd33('0x84')+md5(_0x56dcc8[_0xbd33('0x83')]);}else{_0x56dcc8[_0xbd33('0x85')]='';}var _0x5406ff=_0x4e88d0['host']==='zoho.eu'?'eu':_0xbd33('0x87');return getAccessToken(_0x4e88d0)[_0xbd33('0x28')](function(_0x540aff){_0x17a9ea=_0x540aff;return getUser(_0x17a9ea,_0x5406ff,_0x4e88d0);})[_0xbd33('0x28')](function(_0x8d47fa){_0x153636=_0x8d47fa;logger[_0xbd33('0x30')]('The\x20User\x20ID\x20is:',_0x153636['id']);return getEndUser(_0x17a9ea,_0x5406ff,_0x4e88d0,_0x56dcc8[_0xbd33('0x89')],_0x56dcc8[_0xbd33('0x8a')],_0x153636,_0x202101);})[_0xbd33('0x28')](function(_0xb64633){_0x199451=_0xb64633;return getCall(_0x17a9ea,_0x5406ff,_0x4e88d0,_0x153636,_0x199451,_0x202101,_0x56dcc8,_0xbd33('0x79'));})[_0xbd33('0x28')](function(_0x45dc6b){if(_0x45dc6b){logger[_0xbd33('0x30')](_0xbd33('0x8b'),_0x45dc6b['id']);}})[_0xbd33('0x2c')](function(_0x276af9){logger[_0xbd33('0x2d')](_0xbd33('0x97'),JSON[_0xbd33('0xe')](_0x276af9));});}; \ No newline at end of file +var _0x836d=['host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','lodash','request-promise','md5','util','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','debug','length','forEach','type','string','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','refresh_token','then','add','seconds','catch','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','error','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','POST','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','code','details','enduserType','moduleCreate','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','lead','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','Last_Name','What_Id','First_Name','$se_module','talktime','Call_Duration','utc','format','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','outbound','starttime','Inbound','merge','Fields','/crm/v2/Calls','SUCCESS','Call\x20created!','err','queue'];(function(_0x1a07aa,_0x2edf38){var _0x22872c=function(_0x2fd13a){while(--_0x2fd13a){_0x1a07aa['push'](_0x1a07aa['shift']());}};_0x22872c(++_0x2edf38);}(_0x836d,0x147));var _0xd836=function(_0x313a2c,_0x43ecc7){_0x313a2c=_0x313a2c-0x0;var _0x3832ee=_0x836d[_0x313a2c];return _0x3832ee;};'use strict';var _=require(_0xd836('0x0'));var rp=require(_0xd836('0x1'));var md5=require(_0xd836('0x2'));var util=require(_0xd836('0x3'));var intUtil=require('./util');var moment=require(_0xd836('0x4'));var Redis=require(_0xd836('0x5'));var BPromise=require('bluebird');var config=require(_0xd836('0x6'));var logger=require(_0xd836('0x7'))('zoho');config[_0xd836('0x8')]=_[_0xd836('0x9')](config[_0xd836('0x8')],{'host':_0xd836('0xa'),'port':0x18eb});var io=require(_0xd836('0xb'))(new Redis(config[_0xd836('0x8')]));function emit(_0x17a4d4,_0x502c2f,_0x2a2621){io['to'](_0x17a4d4)[_0xd836('0xc')](_0x502c2f,_0x2a2621);}function request(_0x10c52d){logger[_0xd836('0xd')]('[HTTP]',JSON['stringify'](_0x10c52d));return rp(_0x10c52d);}function getCustomFields(_0x37ac9f,_0x23b28c){var _0x29b600={};if(_0x37ac9f[_0xd836('0xe')]>0x0){_[_0xd836('0xf')](_0x37ac9f,function(_0x11898b){if(_0x11898b[_0xd836('0x10')]===_0xd836('0x11')&&_0x11898b[_0xd836('0x12')]){_0x29b600[_0x11898b[_0xd836('0x12')]]=_0x11898b['content'][_0xd836('0x13')]();}else if(_0x11898b[_0xd836('0x10')]===_0xd836('0x14')&&_0x11898b[_0xd836('0x15')]&&_0x11898b[_0xd836('0x12')]&&_0x23b28c[_0x11898b[_0xd836('0x15')]]){_0x29b600[_0x11898b[_0xd836('0x12')]]=_0x23b28c[_0x11898b['variableName']][_0xd836('0x13')]();}else if(_0x11898b[_0xd836('0x10')]===_0xd836('0x16')&&_0x11898b[_0xd836('0x17')]&&_0x11898b[_0xd836('0x17')][_0xd836('0x18')]&&_0x11898b['idField']&&_0x23b28c[_0x11898b[_0xd836('0x17')][_0xd836('0x18')][_0xd836('0x19')]()]){_0x29b600[_0x11898b[_0xd836('0x12')]]=_0x23b28c[_0x11898b[_0xd836('0x17')][_0xd836('0x18')]['toLowerCase']()][_0xd836('0x13')]();}});}return _0x29b600;}function getName(_0x533bfc){if(_0x533bfc['indexOf']('\x20')>0x0){var _0x526fc5=_0x533bfc[_0xd836('0x1a')](/ (.+)/);if(_0x526fc5[0x1]){return _0x526fc5;}}return[_0x533bfc,_0x533bfc];}var accountsTokens={};function getAccessToken(_0x14a68d){return new Promise(function(_0xa9311f,_0x4a35fd){if(!_[_0xd836('0x1b')](accountsTokens[_0x14a68d['id']])&&!_['isNil'](accountsTokens[_0x14a68d['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x14a68d['id']][_0xd836('0x1c')])){_0xa9311f(accountsTokens[_0x14a68d['id']][_0xd836('0x1d')]);}}var _0x189c16;switch(_0x14a68d[_0xd836('0x1e')]){case'US':_0x189c16='https://accounts.zoho.com';break;case'AU':_0x189c16=_0xd836('0x1f');break;case'EU':_0x189c16=_0xd836('0x20');break;case'IN':_0x189c16=_0xd836('0x21');break;case'CN':_0x189c16=_0xd836('0x22');break;default:_0x189c16=_0xd836('0x20');break;}var _0x616d0f={'method':'POST','uri':_0x189c16+_0xd836('0x23'),'qs':{'refresh_token':_0x14a68d[_0xd836('0x24')],'client_id':_0x14a68d['clientId'],'client_secret':_0x14a68d['clientSecret'],'grant_type':_0xd836('0x25')},'json':!![]};return rp(_0x616d0f)[_0xd836('0x26')](function(_0x1ee720){accountsTokens[_0x14a68d['id']]={'access_token':_0x1ee720[_0xd836('0x1d')],'expires_in':moment()[_0xd836('0x27')](_0x1ee720[_0xd836('0x1c')],_0xd836('0x28'))};_0xa9311f(_0x1ee720['access_token']);})[_0xd836('0x29')](function(_0x72097b){logger['error']('Failing\x20creating\x20the\x20access_token',_0x72097b[_0xd836('0x2a')]);_0x4a35fd(_0x72097b);});});}function getUser(_0x4b8b3c,_0xc19357,_0x2c2754,_0x151f5c){logger[_0xd836('0x2b')](_0xd836('0x2c'));return request({'method':_0xd836('0x2d'),'uri':util['format'](_0xd836('0x2e'),_0xc19357),'qs':{'type':_0xd836('0x2f')},'headers':{'Authorization':_0xd836('0x30')+_0x4b8b3c},'json':!![]})[_0xd836('0x26')](function(_0x1b2621){if(_0x1b2621[_0xd836('0x31')]){var _0x4c436b=-0x1;if(_['isArrayLikeObject'](_0x1b2621[_0xd836('0x31')])){if(!_[_0xd836('0x1b')](_0x151f5c)){_0x4c436b=_['findIndex'](_0x1b2621['users'],function(_0x5e560b){return _0x5e560b[_0xd836('0x32')]===_0x151f5c;});}if(_0x4c436b>=0x0){logger['info'](_0xd836('0x33'));}else{logger['info'](_0xd836('0x34'));_0x4c436b=_[_0xd836('0x35')](_0x1b2621[_0xd836('0x31')],function(_0x3db856){return _0x3db856[_0xd836('0x36')][_0xd836('0x18')]==='Administrator';});}return _0x1b2621['users'][_0x4c436b];}else{if(_0x1b2621['user'][_0xd836('0x36')][_0xd836('0x18')]===_0xd836('0x37')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x1b2621[_0xd836('0x38')];return user;}else{logger[_0xd836('0x39')](_0xd836('0x3a'),JSON[_0xd836('0x3b')](_0x1b2621));throw new Error(_0xd836('0x3c')+JSON['stringify'](_0x1b2621));}}}else{logger[_0xd836('0x39')]('The\x20failing\x20result\x20is',JSON[_0xd836('0x3b')](_0x1b2621));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xd836('0x3b')](_0x1b2621));}})['catch'](function(_0x1956e0){console[_0xd836('0x39')](_0x1956e0);});}function getZohoUser(_0x236cf9,_0x5e7bfa){return new BPromise(function(_0x335c2b,_0x53eb2e){request(_0x236cf9)[_0xd836('0x26')](function(_0x23c5e0){var _0x4c2b3c=null;if(_0x23c5e0){_0x4c2b3c=_0x23c5e0[_0xd836('0x3d')][0x0];_0x4c2b3c['enduserType']=_0x5e7bfa;}_0x335c2b(_0x4c2b3c);})[_0xd836('0x29')](function(_0x3f2f94){_0x53eb2e(_0x3f2f94);});});}function createEndUser(_0x19535e,_0x3a87b8,_0x5cb70e,_0x1981aa,_0x3e538f,_0x57309f){var _0x5cb70e=getName(_0x5cb70e);return request({'method':_0xd836('0x3e'),'uri':_0xd836('0x3f')+_0x3a87b8+_0xd836('0x40')+_[_0xd836('0x41')](_0x57309f['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x5cb70e[0x1],'First_Name':_0x5cb70e[0x0],'Phone':_0x1981aa,'Owner':{'name':!_[_0xd836('0x1b')](_0x3e538f[_0xd836('0x42')][_0xd836('0x18')])?_0x3e538f['role'][_0xd836('0x18')]:!_[_0xd836('0x1b')](_0x3e538f[_0xd836('0x43')])?_0x3e538f['first_name']+'\x20'+_0x3e538f[_0xd836('0x44')]:_0x3e538f[_0xd836('0x44')],'id':_0x3e538f['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x19535e},'json':!![]})[_0xd836('0x26')](function(_0x325eed){if(_0x325eed&&_0x325eed[_0xd836('0x3d')][0x0][_0xd836('0x45')]==='SUCCESS'){var _0x2d047d=_0x325eed[_0xd836('0x3d')][0x0][_0xd836('0x46')];_0x2d047d[_0xd836('0x47')]=_[_0xd836('0x41')](_0x57309f[_0xd836('0x48')])+'s';return _0x2d047d;}logger['error'](_0xd836('0x3a'),JSON[_0xd836('0x3b')](data));throw new Error(_0xd836('0x49')+JSON[_0xd836('0x3b')](data));})['catch'](function(_0x182dcc){console[_0xd836('0x4a')](_0xd836('0x4b'),_0x182dcc);});}function getEndUser(_0x5294c6,_0x36b52b,_0x784ade,_0x16dc7c,_0x246706,_0x368f2f,_0x3698e5){var _0x27f1a1={'method':_0xd836('0x2d'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5294c6},'json':!![]};switch(_0x3698e5[_0xd836('0x4c')]){case _0xd836('0x4d'):_0x27f1a1[_0xd836('0x4e')]='https://www.zohoapis.'+_0x36b52b+_0xd836('0x4f')+_0x246706+'))';return getZohoUser(_0x27f1a1,_0xd836('0x50'))[_0xd836('0x26')](function(_0x74dac3){if(_0x74dac3)return _0x74dac3;_0x27f1a1[_0xd836('0x4e')]=_0xd836('0x3f')+_0x36b52b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x246706+'))';return getZohoUser(_0x27f1a1,_0xd836('0x51'))[_0xd836('0x26')](function(_0x115104){if(_0x115104)return _0x115104;if(_0x3698e5['moduleCreate']!=_0xd836('0x52')){return createEndUser(_0x5294c6,_0x36b52b,_0x16dc7c,_0x246706,_0x368f2f,_0x3698e5);}else{return{};}});});break;case _0xd836('0x53'):_0x27f1a1[_0xd836('0x4e')]=_0xd836('0x3f')+_0x36b52b+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x246706+'))';return getZohoUser(_0x27f1a1,_0xd836('0x50'))['then'](function(_0x3f7740){if(_0x3f7740)return _0x3f7740;if(_0x3698e5['moduleCreate']!=_0xd836('0x52')){return createEndUser(_0x5294c6,_0x36b52b,_0x16dc7c,_0x246706,_0x368f2f,_0x3698e5);}else{return{};}});break;case _0xd836('0x54'):_0x27f1a1['uri']='https://www.zohoapis.'+_0x36b52b+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x246706+'))';return getZohoUser(_0x27f1a1,'Leads')['then'](function(_0x442aef){if(_0x442aef)return _0x442aef;if(_0x3698e5['moduleCreate']!=_0xd836('0x52')){return createEndUser(_0x5294c6,_0x36b52b,_0x16dc7c,_0x246706,_0x368f2f,_0x3698e5);}else{return{};}});break;}}function getCall(_0x2224e5,_0x1db6a1,_0x5a06ab,_0x334c81,_0x3f7a78,_0x5f29b3,_0x5e3ce6,_0x42ed0c){logger[_0xd836('0x2b')](_0xd836('0x55'));var _0x28c87f={};_0x28c87f['Owner']={'name':!_[_0xd836('0x1b')](_0x334c81[_0xd836('0x42')][_0xd836('0x18')])&&!_[_0xd836('0x1b')](_0x334c81[_0xd836('0x36')][_0xd836('0x18')])&&_0x334c81[_0xd836('0x36')][_0xd836('0x18')]===_0xd836('0x56')?_0x334c81[_0xd836('0x42')][_0xd836('0x18')]:!_[_0xd836('0x1b')](_0x334c81['first_name'])?_0x334c81[_0xd836('0x43')]+'\x20'+_0x334c81[_0xd836('0x44')]:_0x334c81[_0xd836('0x44')],'id':_0x334c81['id']};_0x28c87f[_0xd836('0x57')]=intUtil[_0xd836('0x58')](_0x5f29b3[_0xd836('0x59')],_0x5e3ce6,'\x20');_0x28c87f[_0xd836('0x5a')]=intUtil[_0xd836('0x58')](_0x5f29b3[_0xd836('0x5b')],_0x5e3ce6,'\x0a');if(_0x3f7a78['enduserType']===_0xd836('0x50')){_0x28c87f[_0xd836('0x5c')]={'name':!_['isNil'](_0x3f7a78[_0xd836('0x5d')])?_0x3f7a78[_0xd836('0x5d')]:!_[_0xd836('0x1b')](_0x3f7a78['First_Name'])?_0x3f7a78['First_Name']+'\x20'+_0x3f7a78['Last_Name']:_0x3f7a78[_0xd836('0x5e')],'id':_0x3f7a78['id']};}if(_0x3f7a78[_0xd836('0x47')]===_0xd836('0x51')){_0x28c87f[_0xd836('0x5f')]={'name':!_[_0xd836('0x1b')](_0x3f7a78[_0xd836('0x5d')])?_0x3f7a78[_0xd836('0x5d')]:!_['isNil'](_0x3f7a78[_0xd836('0x60')])?_0x3f7a78[_0xd836('0x60')]+'\x20'+_0x3f7a78[_0xd836('0x5e')]:_0x3f7a78['Last_Name'],'id':_0x3f7a78['id']};_0x28c87f[_0xd836('0x61')]=_['startCase'](_0x3f7a78[_0xd836('0x47')]);}if(_0x5e3ce6[_0xd836('0x62')]){_0x28c87f[_0xd836('0x63')]=moment[_0xd836('0x64')](parseInt(_0x5e3ce6[_0xd836('0x62')])*0x3e8)[_0xd836('0x65')](_0xd836('0x66'));}else if(_0x5e3ce6['answertime']&&_0x5e3ce6[_0xd836('0x67')]){_0x28c87f[_0xd836('0x63')]=moment[_0xd836('0x64')](moment(_0x5e3ce6['endtime'],_0xd836('0x68'))[_0xd836('0x69')](moment(_0x5e3ce6['starttime'],_0xd836('0x68'))))[_0xd836('0x65')](_0xd836('0x66'));}switch(_0x5e3ce6[_0xd836('0x6a')]){case _0xd836('0x6b'):_0x28c87f[_0xd836('0x6c')]=_0xd836('0x6d');break;case _0xd836('0x6e'):case _0xd836('0x6f'):_0x28c87f[_0xd836('0x6c')]=_0xd836('0x70');break;case _0xd836('0x71'):_0x28c87f['Call_Result']=_0xd836('0x72');break;case _0xd836('0x73'):_0x28c87f[_0xd836('0x6c')]='Abandoned';break;default:}_0x28c87f['Call_Start_Time']=(_0x42ed0c===_0xd836('0x74')?moment(_0x5e3ce6[_0xd836('0x75')])[_0xd836('0x65')](_0xd836('0x68')):moment(_0x5e3ce6['agentcalledAt'])[_0xd836('0x65')](_0xd836('0x68')))||moment()[_0xd836('0x65')](_0xd836('0x68'));_0x28c87f['Call_Type']=_0x42ed0c||_0xd836('0x76');_0x28c87f=_[_0xd836('0x77')](_0x28c87f,getCustomFields(_0x5f29b3[_0xd836('0x78')],_0x5e3ce6));return request({'method':_0xd836('0x3e'),'uri':_0xd836('0x3f')+_0x1db6a1+_0xd836('0x79'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2224e5},'body':{'data':[_0x28c87f]},'json':!![]})[_0xd836('0x26')](function(_0x418aad){if(_0x418aad&&_0x418aad[_0xd836('0x3d')][0x0]['code']===_0xd836('0x7a')){logger[_0xd836('0x2b')](_0xd836('0x7b'));return{'id':_0x418aad[_0xd836('0x3d')][0x0][_0xd836('0x46')]['id']};}})['catch'](function(_0x36a8ff){logger[_0xd836('0x2b')](_0xd836('0x7c'),_0x36a8ff['stack']);console['log']('err',_0x36a8ff);});}exports[_0xd836('0x7d')]=function(_0x2525d5,_0x16620a,_0x5a5be5,_0x434669,_0x2fa66c,_0x2f60e4){var _0x35d631,_0x4e7097,_0x4e4e83;_0x2f60e4[_0xd836('0x7e')]=intUtil[_0xd836('0x7f')](_0x2f60e4['host']);_0x2f60e4[_0xd836('0x80')]=intUtil['stripTrailingSlash'](_0x2f60e4[_0xd836('0x80')]);if(_0x2fa66c&&_0x2fa66c[_0xd836('0x81')]){logger[_0xd836('0x2b')](_0xd836('0x82'),_0xd836('0x83'));_0x16620a[_0xd836('0x84')]=_0x2f60e4[_0xd836('0x80')]+_0xd836('0x85')+_0x16620a[_0xd836('0x86')]+_0xd836('0x87')+md5(_0x16620a[_0xd836('0x86')]);}else{_0x16620a[_0xd836('0x84')]='';}var _0x409f88=_0x2f60e4[_0xd836('0x7e')]===_0xd836('0x88')?'eu':_0xd836('0x89');return getAccessToken(_0x2f60e4)[_0xd836('0x26')](function(_0x5c4044){_0x4e4e83=_0x5c4044;return getUser(_0x4e4e83,_0x409f88,_0x2f60e4,_0x434669[_0xd836('0x32')]);})[_0xd836('0x26')](function(_0xfb44d9){_0x35d631=_0xfb44d9;logger[_0xd836('0x2b')](_0xd836('0x8a'),_0x35d631['id']);return getEndUser(_0x4e4e83,_0x409f88,_0x2f60e4,_0x16620a[_0xd836('0x8b')],_0x16620a[_0xd836('0x8c')],_0x35d631,_0x5a5be5);})[_0xd836('0x26')](function(_0x305e9c){_0x4e7097=_0x305e9c;return getCall(_0x4e4e83,_0x409f88,_0x2f60e4,_0x35d631,_0x4e7097,_0x5a5be5,_0x16620a,'Inbound');})[_0xd836('0x26')](function(_0x392e91){if(_0x392e91){logger[_0xd836('0x2b')](_0xd836('0x8d'),_0x392e91['id']);logger[_0xd836('0x2b')](_0xd836('0x82'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd836('0x65')](_0xd836('0x8e'),_0x434669[_0xd836('0x18')]),_0xd836('0x8f'),{'uri':_0xd836('0x90')+_0x2f60e4[_0xd836('0x7e')]+_0xd836('0x91')+_0x392e91['id']});}})[_0xd836('0x29')](function(_0x42de8d){logger['error'](_0xd836('0x82'),JSON[_0xd836('0x3b')](_0x42de8d));});};exports[_0xd836('0x74')]=function(_0x37c736,_0x4876e6,_0x508313,_0x446a9d,_0x318694,_0x1b17c5,_0x32aaa4){var _0x1dd271,_0xb5f623,_0x28f970;_0x1b17c5['host']=intUtil[_0xd836('0x7f')](_0x1b17c5['host']);_0x1b17c5[_0xd836('0x80')]=intUtil['stripTrailingSlash'](_0x1b17c5[_0xd836('0x80')]);if(_0x32aaa4&&_0x32aaa4['recordingFormat']&&_0x32aaa4[_0xd836('0x92')]!==_0xd836('0x93')){logger['info'](_0xd836('0x94'),_0xd836('0x83'));_0x4876e6[_0xd836('0x84')]=_0x1b17c5['serverUrl']+'/api/voice/recordings/'+_0x4876e6[_0xd836('0x86')]+_0xd836('0x87')+md5(_0x4876e6[_0xd836('0x86')]);}var _0x561ea9=_0x1b17c5[_0xd836('0x7e')]===_0xd836('0x88')?'eu':_0xd836('0x89');return getAccessToken(_0x1b17c5)[_0xd836('0x26')](function(_0x2e9c88){_0x28f970=_0x2e9c88;return getUser(_0x28f970,_0x561ea9,_0x1b17c5,_0x446a9d[_0xd836('0x32')]);})[_0xd836('0x26')](function(_0x2d392a){_0x1dd271=_0x2d392a;logger[_0xd836('0x2b')](_0xd836('0x8a'),_0x1dd271['id']);return getEndUser(_0x28f970,_0x561ea9,_0x1b17c5,_0x4876e6['destcalleridname'],_0x4876e6[_0xd836('0x95')],_0x1dd271,_0x508313);})[_0xd836('0x26')](function(_0x5e0041){_0xb5f623=_0x5e0041;return getCall(_0x28f970,_0x561ea9,_0x1b17c5,_0x1dd271,_0xb5f623,_0x508313,_0x4876e6,'Outbound');})[_0xd836('0x26')](function(_0x5d4557){if(_0x5d4557){logger[_0xd836('0x2b')](_0xd836('0x8d'),_0x5d4557['id']);logger['info'](_0xd836('0x94'),_0xd836('0x96'));emit(util[_0xd836('0x65')](_0xd836('0x8e'),_0x446a9d[_0xd836('0x18')]),_0xd836('0x8f'),{'uri':'https://crm.'+_0x1b17c5[_0xd836('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x5d4557['id']});}})['catch'](function(_0x4ba8f1){logger[_0xd836('0x39')](_0xd836('0x94'),JSON[_0xd836('0x3b')](_0x4ba8f1));});};exports[_0xd836('0x73')]=function(_0x32ec75,_0x276b8b,_0x437021,_0x14bded,_0x3833d2,_0x261eb1){var _0x527b6d,_0x35b5ca,_0x446908;_0x261eb1[_0xd836('0x7e')]=intUtil['stripTrailingSlash'](_0x261eb1[_0xd836('0x7e')]);_0x261eb1[_0xd836('0x80')]=intUtil['stripTrailingSlash'](_0x261eb1[_0xd836('0x80')]);if(_0x3833d2&&_0x3833d2[_0xd836('0x81')]){logger[_0xd836('0x2b')]('[ABANDONED]',_0xd836('0x83'));_0x276b8b[_0xd836('0x84')]=_0x261eb1[_0xd836('0x80')]+'/api/voice/recordings/'+_0x276b8b[_0xd836('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x276b8b[_0xd836('0x86')]);}else{_0x276b8b[_0xd836('0x84')]='';}var _0x2e33e2=_0x261eb1[_0xd836('0x7e')]===_0xd836('0x88')?'eu':_0xd836('0x89');return getAccessToken(_0x261eb1)[_0xd836('0x26')](function(_0x315906){_0x446908=_0x315906;return getUser(_0x446908,_0x2e33e2,_0x261eb1);})[_0xd836('0x26')](function(_0x46a89f){_0x527b6d=_0x46a89f;logger[_0xd836('0x2b')](_0xd836('0x8a'),_0x527b6d['id']);return getEndUser(_0x446908,_0x2e33e2,_0x261eb1,_0x276b8b[_0xd836('0x8b')],_0x276b8b[_0xd836('0x8c')],_0x527b6d,_0x437021);})['then'](function(_0x2689e4){_0x35b5ca=_0x2689e4;return getCall(_0x446908,_0x2e33e2,_0x261eb1,_0x527b6d,_0x35b5ca,_0x437021,_0x276b8b,'Inbound');})['then'](function(_0x2b8fc2){if(_0x2b8fc2){logger[_0xd836('0x2b')](_0xd836('0x8d'),_0x2b8fc2['id']);}})['catch'](function(_0x152a73){logger[_0xd836('0x39')]('[ABANDONED]',JSON[_0xd836('0x3b')](_0x152a73));});}; \ 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 300c6b8..4555d7e 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(_0x4d702d,_0x3e6f18){var _0x1b6756=function(_0x587203){while(--_0x587203){_0x4d702d['push'](_0x4d702d['shift']());}};_0x1b6756(++_0x3e6f18);}(_0x7a54,0x106));var _0x47a5=function(_0x4923d8,_0x2d8d1d){_0x4923d8=_0x4923d8-0x0;var _0x2529ed=_0x7a54[_0x4923d8];return _0x2529ed;};'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(_0x189f04,_0x35bd3d){var _0x3dbf9d=function(_0x5c2dbe){while(--_0x5c2dbe){_0x189f04['push'](_0x189f04['shift']());}};_0x3dbf9d(++_0x35bd3d);}(_0x7a54,0x106));var _0x47a5=function(_0x234e35,_0xf5680e){_0x234e35=_0x234e35-0x0;var _0x170c0c=_0x7a54[_0x234e35];return _0x170c0c;};'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 d1313f5..dfb1710 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x58fba0,_0x370b56){var _0x1aac87=function(_0xe3ceed){while(--_0xe3ceed){_0x58fba0['push'](_0x58fba0['shift']());}};_0x1aac87(++_0x370b56);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5aea8e,_0x1d497b){_0x5aea8e=_0x5aea8e-0x0;var _0x56dd57=_0x5f2f[_0x5aea8e];return _0x56dd57;};'use strict';var rp=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var Mustache=require(_0xf5f2('0x3'));var logger=require(_0xf5f2('0x4'))(_0xf5f2('0x5'));exports[_0xf5f2('0x6')]=function(_0x107cf,_0x501fbd){var _0x4854b6,_0x1665c7;var _0x192215={'method':_0x107cf[_0xf5f2('0x7')][_0xf5f2('0x8')](),'uri':Mustache[_0xf5f2('0x9')](_0x107cf[_0xf5f2('0xa')],_0x501fbd),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x107cf['data5'])===_0xf5f2('0xb')&&parseInt(_0x107cf[_0xf5f2('0xc')])>=0x1&&parseInt(_0x107cf[_0xf5f2('0xc')])<=0xa?parseInt(_0x107cf['data5'])*0x3e8:0x5*0x3e8};try{_0x192215[_0xf5f2('0xd')]=_0x107cf[_0xf5f2('0xe')]?JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0xe')],_0x501fbd)):{};}catch(_0x4ebbbe){logger['error'](_0x4ebbbe[_0xf5f2('0x10')]);}switch(_0x107cf[_0xf5f2('0x7')]['toUpperCase']()){case _0xf5f2('0x11'):case _0xf5f2('0x12'):_0x4854b6=null;_0x192215['qs']=_0x501fbd;break;case _0xf5f2('0x13'):case _0xf5f2('0x14'):if(_0x107cf[_0xf5f2('0x15')]){try{_0x4854b6=JSON[_0xf5f2('0xf')](Mustache['render'](_0x107cf[_0xf5f2('0x15')],_0x501fbd));_0x192215[_0xf5f2('0x16')]=_0x4854b6;}catch(_0x269909){logger[_0xf5f2('0x17')](_0x269909[_0xf5f2('0x10')]);logger['error'](_0xf5f2('0x18'));}}else{_0x4854b6=_0x501fbd;_0x192215[_0xf5f2('0x16')]=_0x4854b6;}break;}logger[_0xf5f2('0x19')](util[_0xf5f2('0x1a')](_0xf5f2('0x1b'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],JSON[_0xf5f2('0x1c')](_0x192215)));rp(_0x192215)[_0xf5f2('0x1d')](function(_0x228ace){_0x4854b6=!_[_0xf5f2('0x1e')](_0x4854b6)?_0xf5f2('0x1f')+_0x4854b6:'';_0x1665c7=typeof _0x228ace[_0xf5f2('0x16')]===_0xf5f2('0x20')?JSON[_0xf5f2('0x1c')](_0x228ace[_0xf5f2('0x16')]):_0x228ace[_0xf5f2('0x16')];logger['info'](util[_0xf5f2('0x1a')](_0xf5f2('0x21'),_0x107cf['data1'],_0x107cf['data2'],_0x228ace[_0xf5f2('0x22')],_0x1665c7));})[_0xf5f2('0x23')](function(_0x4ae323){logger[_0xf5f2('0x17')](util[_0xf5f2('0x1a')](_0xf5f2('0x24'),_0x107cf[_0xf5f2('0x7')],_0x107cf[_0xf5f2('0xa')],_0x4ae323['statusCode'],_0x4ae323[_0xf5f2('0x25')],_0x4ae323[_0xf5f2('0x26')]));});}; \ No newline at end of file +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x290adf,_0xf515ff){var _0x574426=function(_0x46a542){while(--_0x46a542){_0x290adf['push'](_0x290adf['shift']());}};_0x574426(++_0xf515ff);}(_0xb10b,0x12a));var _0xbb10=function(_0x13610a,_0x4f866c){_0x13610a=_0x13610a-0x0;var _0x150ecc=_0xb10b[_0x13610a];return _0x150ecc;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index fd402b3..00bae50 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 _0x8f7d=['error','message','result','catch','exports','jayson/promise','bluebird','routing','Request','request','debug','rpc'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x8f7d,0xf5));var _0xd8f7=function(_0x25fc4f,_0xe432bb){_0x25fc4f=_0x25fc4f-0x0;var _0x33ceb6=_0x8f7d[_0x25fc4f];return _0x33ceb6;};'use strict';var jayson=require(_0xd8f7('0x0'));var BPromise=require(_0xd8f7('0x1'));var logger=require('../../config/logger')(_0xd8f7('0x2'));var client=jayson['client']['http']({'port':0x2329});client[_0xd8f7('0x3')]=function(_0x530e1b,_0x9558b6){return new BPromise(function(_0x338be3,_0x1b9964){return client[_0xd8f7('0x4')](_0x530e1b,_0x9558b6)['then'](function(_0x4090c9){logger[_0xd8f7('0x5')](_0xd8f7('0x6'),_0xd8f7('0x2'),_0x530e1b,_0x9558b6,_0x4090c9);if(_0x4090c9[_0xd8f7('0x7')]){logger[_0xd8f7('0x7')](_0xd8f7('0x6'),_0xd8f7('0x2'),_0x530e1b,_0x4090c9['error'][_0xd8f7('0x8')],_0x9558b6);return _0x1b9964(_0x4090c9['error'][_0xd8f7('0x8')]);}else{return _0x338be3(_0x4090c9[_0xd8f7('0x9')]);}})[_0xd8f7('0xa')](function(_0x25e4d3){logger[_0xd8f7('0x7')](_0xd8f7('0x6'),_0xd8f7('0x2'),_0x530e1b,_0x25e4d3,_0x9558b6);return _0x1b9964(_0x25e4d3);});});};module[_0xd8f7('0xb')]=client; \ No newline at end of file +var _0x9ade=['message','result','catch','jayson/promise','bluebird','client','Request','request','then','debug','rpc','routing','error'];(function(_0x1a7b96,_0x3dff24){var _0x396926=function(_0x3546b1){while(--_0x3546b1){_0x1a7b96['push'](_0x1a7b96['shift']());}};_0x396926(++_0x3dff24);}(_0x9ade,0x107));var _0xe9ad=function(_0x5d1d9f,_0x1ef696){_0x5d1d9f=_0x5d1d9f-0x0;var _0x2faa8e=_0x9ade[_0x5d1d9f];return _0x2faa8e;};'use strict';var jayson=require(_0xe9ad('0x0'));var BPromise=require(_0xe9ad('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0xe9ad('0x2')]['http']({'port':0x2329});client[_0xe9ad('0x3')]=function(_0x38d722,_0x4d4ee0){return new BPromise(function(_0x52984f,_0x36e151){return client[_0xe9ad('0x4')](_0x38d722,_0x4d4ee0)[_0xe9ad('0x5')](function(_0x3e4092){logger[_0xe9ad('0x6')](_0xe9ad('0x7'),_0xe9ad('0x8'),_0x38d722,_0x4d4ee0,_0x3e4092);if(_0x3e4092[_0xe9ad('0x9')]){logger['error'](_0xe9ad('0x7'),_0xe9ad('0x8'),_0x38d722,_0x3e4092[_0xe9ad('0x9')][_0xe9ad('0xa')],_0x4d4ee0);return _0x36e151(_0x3e4092[_0xe9ad('0x9')][_0xe9ad('0xa')]);}else{return _0x52984f(_0x3e4092[_0xe9ad('0xb')]);}})[_0xe9ad('0xc')](function(_0x2d1ed2){logger[_0xe9ad('0x9')](_0xe9ad('0x7'),_0xe9ad('0x8'),_0x38d722,_0x2d1ed2,_0x4d4ee0);return _0x36e151(_0x2d1ed2);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f72a16b..d36069d 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 _0x2b83=['./realtime','./rpc/mailAccount','../../mysqldb','resolve','then','initMailAccounts','refresh','listen','Setting','findOne','catch','log','./server'];(function(_0x28fd66,_0x280ec9){var _0xf66f12=function(_0x304952){while(--_0x304952){_0x28fd66['push'](_0x28fd66['shift']());}};_0xf66f12(++_0x280ec9);}(_0x2b83,0x1d3));var _0x32b8=function(_0x4d6679,_0x3ea59a){_0x4d6679=_0x4d6679-0x0;var _0x50fc8b=_0x2b83[_0x4d6679];return _0x50fc8b;};'use strict';var BPromise=require('bluebird');var server=require(_0x32b8('0x0'));var Realtime=require(_0x32b8('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x32b8('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x32b8('0x3'))['db'];function initRealtime(){return BPromise[_0x32b8('0x4')]()['then'](mailAccount['getMailAccounts']())[_0x32b8('0x5')](realtime[_0x32b8('0x6')]())['then'](function(){email[_0x32b8('0x7')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x32b8('0x8')](realtime,email)[_0x32b8('0x5')](function(_0x36bde3){return initRealtime();})[_0x32b8('0x5')](function(_0x5cc6b2){return db[_0x32b8('0x9')][_0x32b8('0xa')]({'attributes':['id','loginMailFrequency'],'raw':!![]});})['then'](function(_0x3f58a5){return setInterval(initRealtime,_0x3f58a5['loginMailFrequency']*0x3e8);})[_0x32b8('0xb')](function(_0x31b795){console[_0x32b8('0xc')](_0x31b795);});}main(); \ No newline at end of file +var _0xfc76=['Setting','findOne','loginMailFrequency','catch','log','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen'];(function(_0x7b4397,_0x50ab04){var _0x16de0b=function(_0x26a130){while(--_0x26a130){_0x7b4397['push'](_0x7b4397['shift']());}};_0x16de0b(++_0x50ab04);}(_0xfc76,0xb5));var _0x6fc7=function(_0x5de99d,_0x5f5180){_0x5de99d=_0x5de99d-0x0;var _0x2b36bd=_0xfc76[_0x5de99d];return _0x2b36bd;};'use strict';var BPromise=require('bluebird');var server=require(_0x6fc7('0x0'));var Realtime=require(_0x6fc7('0x1'));var EmailChannel=require(_0x6fc7('0x2'));var mailAccount=require(_0x6fc7('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x6fc7('0x4'))['db'];function initRealtime(){return BPromise['resolve']()[_0x6fc7('0x5')](mailAccount[_0x6fc7('0x6')]())['then'](realtime[_0x6fc7('0x7')]())['then'](function(){email[_0x6fc7('0x8')](realtime[_0x6fc7('0x9')]);return realtime;});}function main(){return server[_0x6fc7('0xa')](realtime,email)['then'](function(_0x21a64d){return initRealtime();})[_0x6fc7('0x5')](function(_0x347c00){return db[_0x6fc7('0xb')][_0x6fc7('0xc')]({'attributes':['id',_0x6fc7('0xd')],'raw':!![]});})['then'](function(_0xdddc47){return setInterval(initRealtime,_0xdddc47[_0x6fc7('0xd')]*0x3e8);})[_0x6fc7('0xe')](function(_0x20d043){console[_0x6fc7('0xf')](_0x20d043);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index d57ed00..386d4e8 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 _0x0987=['lastSync','sendMail','verifySmtp','Smtp','smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','defaults','redis','localhost','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','box','handleImapEmail','handleImapEnd','bind','error','handleImapError','handleImapBox','connected','name','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x0987,0x1e5));var _0x7098=function(_0x3c680d,_0x134f87){_0x3c680d=_0x3c680d-0x0;var _0x4d1db9=_0x0987[_0x3c680d];return _0x4d1db9;};'use strict';var _=require(_0x7098('0x0'));var moment=require(_0x7098('0x1'));var BPromise=require(_0x7098('0x2'));var md5=require(_0x7098('0x3'));var Redis=require(_0x7098('0x4'));var config=require(_0x7098('0x5'));var logger=require('../../../config/logger')(_0x7098('0x6'));config['redis']=_[_0x7098('0x7')](config[_0x7098('0x8')],{'host':_0x7098('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7098('0x8')]));var EmailImap=require(_0x7098('0xa'));var EmailSmtp=require(_0x7098('0xb'));var mailAccount=require(_0x7098('0xc'));var md5Accounts={};function EmailChannel(_0x2ac8ce){logger['info'](_0x7098('0xd'));this[_0x7098('0xe')]=_0x2ac8ce['mailAccounts'];this[_0x7098('0xf')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x7098('0x10')][_0x7098('0x11')]=function(_0x1266f4){var _0x4da61b=this['mailAccounts'][_0x1266f4];var _0x2959fb={'id':_0x4da61b['id'],'name':_0x4da61b['name'],'key':_0x4da61b[_0x7098('0x12')],'active':_0x4da61b[_0x7098('0x13')],'Imap':{'status':_0x4da61b[_0x7098('0x14')][_0x7098('0x15')],'messageStatus':_0x4da61b[_0x7098('0x14')][_0x7098('0x16')],'total':_0x4da61b[_0x7098('0x14')][_0x7098('0x17')]}};if(_[_0x7098('0x18')](md5Accounts[_0x1266f4])){md5Accounts[_0x1266f4]={};}var _0x1348bd=md5(JSON[_0x7098('0x19')](_0x2959fb));if(md5Accounts[_0x1266f4][_0x7098('0x3')]!==_0x1348bd){md5Accounts[_0x1266f4][_0x7098('0x3')]=_0x1348bd;io[_0x7098('0x11')](_0x7098('0x1a'),_0x2959fb);}};EmailChannel[_0x7098('0x10')]['refresh']=function(_0x567805){for(var _0x4982a1 in _0x567805){if(_0x567805['hasOwnProperty'](_0x4982a1)){if(_0x567805[_0x4982a1][_0x7098('0x14')]&&_0x567805[_0x4982a1][_0x7098('0x13')]){var _0x19e078=_0x567805[_0x4982a1][_0x7098('0x14')];if(!this['imapAccounts']['hasOwnProperty'](_0x19e078['id'])){this[_0x7098('0xf')][_0x19e078['id']]=new EmailImap(_0x19e078,_0x567805[_0x4982a1]['email']);this[_0x7098('0xf')][_0x19e078['id']]['on'](_0x7098('0x1b'),this['handleImapBox']['bind'](this,_0x4982a1));this[_0x7098('0xf')][_0x19e078['id']]['on'](_0x7098('0x6'),this[_0x7098('0x1c')]['bind'](this,_0x4982a1));this[_0x7098('0xf')][_0x19e078['id']]['on']('end',this[_0x7098('0x1d')][_0x7098('0x1e')](this,_0x4982a1));this[_0x7098('0xf')][_0x19e078['id']]['on'](_0x7098('0x1f'),this[_0x7098('0x20')]['bind'](this,_0x4982a1));}}else{if(_[_0x7098('0x18')](this['mailAccounts'][_0x4982a1][_0x7098('0x14')])){this['mailAccounts'][_0x4982a1][_0x7098('0x14')]={};}this[_0x7098('0xe')][_0x4982a1][_0x7098('0x14')][_0x7098('0x15')]='disabled';this[_0x7098('0xe')][_0x4982a1]['Imap'][_0x7098('0x16')]='';this[_0x7098('0x11')](_0x4982a1);}}}};EmailChannel[_0x7098('0x10')][_0x7098('0x21')]=function(_0x3828f6,_0x517566){if(this[_0x7098('0xe')][_0x3828f6]){this['mailAccounts'][_0x3828f6]['Imap'][_0x7098('0x15')]=_0x7098('0x22');this[_0x7098('0xe')][_0x3828f6]['Imap']['messageStatus']=_0x517566[_0x7098('0x23')];if(_0x517566['messages']){this[_0x7098('0xe')][_0x3828f6][_0x7098('0x14')][_0x7098('0x17')]=_0x517566[_0x7098('0x24')][_0x7098('0x17')];}return this[_0x7098('0x11')](_0x3828f6);}};EmailChannel[_0x7098('0x10')]['handleImapEmail']=function(_0x325c3f,_0x4c2568){logger[_0x7098('0x25')](_0x7098('0x26'),_0x4c2568[_0x7098('0x27')],_0x4c2568[_0x7098('0x28')],_0x4c2568[_0x7098('0x29')],_0x325c3f);if(this[_0x7098('0xe')][_0x325c3f]){return mailAccount['notify'](_0x325c3f,_0x4c2568)[_0x7098('0x2a')](function(_0xa93e44){if(_0xa93e44){logger[_0x7098('0x25')](_0x7098('0x2b'));}})[_0x7098('0x2c')](function(_0x59f254){logger[_0x7098('0x1f')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x7098('0x19')](_0x59f254));});}};EmailChannel[_0x7098('0x10')][_0x7098('0x1d')]=function(_0x97aab6){if(this[_0x7098('0xe')][_0x97aab6]&&this[_0x7098('0xe')][_0x97aab6]['Imap']){if(this[_0x7098('0xf')][this[_0x7098('0xe')][_0x97aab6][_0x7098('0x14')]['id']]){delete this[_0x7098('0xf')][this[_0x7098('0xe')][_0x97aab6][_0x7098('0x14')]['id']];}this[_0x7098('0xe')][_0x97aab6][_0x7098('0x14')][_0x7098('0x2d')]=moment();this[_0x7098('0x11')](_0x97aab6);}};EmailChannel['prototype']['handleImapError']=function(_0x2f2f04,_0x17adb2){if(this[_0x7098('0xe')][_0x2f2f04]){this[_0x7098('0xe')][_0x2f2f04][_0x7098('0x14')]['status']=_0x7098('0x1f');this[_0x7098('0xe')][_0x2f2f04][_0x7098('0x14')][_0x7098('0x16')]=_0x17adb2;return this[_0x7098('0x11')](_0x2f2f04);}};EmailChannel[_0x7098('0x10')][_0x7098('0x2e')]=function(_0x26d5fb,_0x4a2c84){return this['smtp']['send'](_0x26d5fb,_0x4a2c84);};EmailChannel[_0x7098('0x10')][_0x7098('0x2f')]=function(_0xace0d4){var _0x571c80=this;if(this['mailAccounts'][_0xace0d4['id']]){if(_[_0x7098('0x18')](this['mailAccounts'][_0xace0d4['id']][_0x7098('0x30')])){this[_0x7098('0xe')][_0xace0d4['id']][_0x7098('0x30')]={};}this[_0x7098('0xe')][_0xace0d4['id']][_0x7098('0x30')][_0x7098('0x2d')]=moment();return new BPromise(function(_0x2de79d,_0x14e4c5){return _0x571c80[_0x7098('0x31')][_0x7098('0x32')](_0xace0d4)[_0x7098('0x2a')](function(_0x85ab7d){_0x571c80[_0x7098('0xe')][_0xace0d4['id']][_0x7098('0x30')][_0x7098('0x15')]=_0x7098('0x33');_0x571c80['mailAccounts'][_0xace0d4['id']][_0x7098('0x30')][_0x7098('0x16')]='';_0x571c80[_0x7098('0x11')](_0xace0d4['id']);_0x2de79d(_0x85ab7d);})[_0x7098('0x2c')](function(_0x566c9d){_0x571c80['mailAccounts'][_0xace0d4['id']][_0x7098('0x30')][_0x7098('0x15')]=_0x7098('0x1f');_0x571c80[_0x7098('0xe')][_0xace0d4['id']][_0x7098('0x30')][_0x7098('0x16')]=_0x566c9d;_0x571c80['emit'](_0xace0d4['id']);_0x14e4c5(_0x566c9d);});});}return this[_0x7098('0x31')][_0x7098('0x32')](_0xace0d4);};module[_0x7098('0x34')]=EmailChannel; \ No newline at end of file +var _0xf586=['handleImapBox','handleImapEmail','bind','handleImapEnd','error','handleImapError','isNil','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','catch','exports','moment','bluebird','md5','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','Imap','status','messageStatus','total','stringify','hasOwnProperty','active','box'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0xf586,0x15d));var _0x6f58=function(_0x55c8e3,_0x4addd4){_0x55c8e3=_0x55c8e3-0x0;var _0x7e6c2c=_0xf586[_0x55c8e3];return _0x7e6c2c;};'use strict';var _=require('lodash');var moment=require(_0x6f58('0x0'));var BPromise=require(_0x6f58('0x1'));var md5=require(_0x6f58('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x6f58('0x3'))(_0x6f58('0x4'));config[_0x6f58('0x5')]=_[_0x6f58('0x6')](config[_0x6f58('0x5')],{'host':_0x6f58('0x7'),'port':0x18eb});var io=require(_0x6f58('0x8'))(new Redis(config[_0x6f58('0x5')]));var EmailImap=require(_0x6f58('0x9'));var EmailSmtp=require(_0x6f58('0xa'));var mailAccount=require(_0x6f58('0xb'));var md5Accounts={};function EmailChannel(_0x59b6f3){logger[_0x6f58('0xc')](_0x6f58('0xd'));this[_0x6f58('0xe')]=_0x59b6f3[_0x6f58('0xe')];this[_0x6f58('0xf')]={};this[_0x6f58('0x10')]=new EmailSmtp();}EmailChannel[_0x6f58('0x11')][_0x6f58('0x12')]=function(_0x244879){var _0x30dce9=this[_0x6f58('0xe')][_0x244879];var _0x3c19a6={'id':_0x30dce9['id'],'name':_0x30dce9[_0x6f58('0x13')],'key':_0x30dce9[_0x6f58('0x14')],'active':_0x30dce9['active'],'Imap':{'status':_0x30dce9[_0x6f58('0x15')][_0x6f58('0x16')],'messageStatus':_0x30dce9['Imap'][_0x6f58('0x17')],'total':_0x30dce9[_0x6f58('0x15')][_0x6f58('0x18')]}};if(_['isNil'](md5Accounts[_0x244879])){md5Accounts[_0x244879]={};}var _0x4b26bd=md5(JSON[_0x6f58('0x19')](_0x3c19a6));if(md5Accounts[_0x244879]['md5']!==_0x4b26bd){md5Accounts[_0x244879]['md5']=_0x4b26bd;io[_0x6f58('0x12')]('mailAccount:update',_0x3c19a6);}};EmailChannel[_0x6f58('0x11')]['refresh']=function(_0x4e21a2){for(var _0x254fde in _0x4e21a2){if(_0x4e21a2[_0x6f58('0x1a')](_0x254fde)){if(_0x4e21a2[_0x254fde][_0x6f58('0x15')]&&_0x4e21a2[_0x254fde][_0x6f58('0x1b')]){var _0x2c980f=_0x4e21a2[_0x254fde]['Imap'];if(!this[_0x6f58('0xf')]['hasOwnProperty'](_0x2c980f['id'])){this[_0x6f58('0xf')][_0x2c980f['id']]=new EmailImap(_0x2c980f,_0x4e21a2[_0x254fde]['email']);this[_0x6f58('0xf')][_0x2c980f['id']]['on'](_0x6f58('0x1c'),this[_0x6f58('0x1d')]['bind'](this,_0x254fde));this[_0x6f58('0xf')][_0x2c980f['id']]['on'](_0x6f58('0x4'),this[_0x6f58('0x1e')][_0x6f58('0x1f')](this,_0x254fde));this['imapAccounts'][_0x2c980f['id']]['on']('end',this[_0x6f58('0x20')]['bind'](this,_0x254fde));this[_0x6f58('0xf')][_0x2c980f['id']]['on'](_0x6f58('0x21'),this[_0x6f58('0x22')][_0x6f58('0x1f')](this,_0x254fde));}}else{if(_[_0x6f58('0x23')](this[_0x6f58('0xe')][_0x254fde]['Imap'])){this['mailAccounts'][_0x254fde][_0x6f58('0x15')]={};}this[_0x6f58('0xe')][_0x254fde][_0x6f58('0x15')][_0x6f58('0x16')]=_0x6f58('0x24');this[_0x6f58('0xe')][_0x254fde][_0x6f58('0x15')]['messageStatus']='';this['emit'](_0x254fde);}}}};EmailChannel[_0x6f58('0x11')]['handleImapBox']=function(_0x36aca0,_0x4f6c9d){if(this[_0x6f58('0xe')][_0x36aca0]){this['mailAccounts'][_0x36aca0][_0x6f58('0x15')][_0x6f58('0x16')]='connected';this[_0x6f58('0xe')][_0x36aca0][_0x6f58('0x15')][_0x6f58('0x17')]=_0x4f6c9d[_0x6f58('0x13')];if(_0x4f6c9d[_0x6f58('0x25')]){this['mailAccounts'][_0x36aca0]['Imap']['total']=_0x4f6c9d['messages'][_0x6f58('0x18')];}return this[_0x6f58('0x12')](_0x36aca0);}};EmailChannel[_0x6f58('0x11')][_0x6f58('0x1e')]=function(_0x7f1b1a,_0x28af39){logger[_0x6f58('0xc')](_0x6f58('0x26'),_0x28af39[_0x6f58('0x27')],_0x28af39[_0x6f58('0x28')],_0x28af39['from'],_0x7f1b1a);if(this[_0x6f58('0xe')][_0x7f1b1a]){return mailAccount[_0x6f58('0x29')](_0x7f1b1a,_0x28af39)[_0x6f58('0x2a')](function(_0x372904){if(_0x372904){logger['info'](_0x6f58('0x2b'));}})['catch'](function(_0x4f03ac){logger[_0x6f58('0x21')](_0x6f58('0x2c'),JSON[_0x6f58('0x19')](_0x4f03ac));});}};EmailChannel['prototype'][_0x6f58('0x20')]=function(_0x11f8f5){if(this['mailAccounts'][_0x11f8f5]&&this[_0x6f58('0xe')][_0x11f8f5][_0x6f58('0x15')]){if(this[_0x6f58('0xf')][this[_0x6f58('0xe')][_0x11f8f5][_0x6f58('0x15')]['id']]){delete this[_0x6f58('0xf')][this['mailAccounts'][_0x11f8f5]['Imap']['id']];}this['mailAccounts'][_0x11f8f5]['Imap'][_0x6f58('0x2d')]=moment();this['emit'](_0x11f8f5);}};EmailChannel['prototype']['handleImapError']=function(_0x55b652,_0x5011f6){if(this[_0x6f58('0xe')][_0x55b652]){this[_0x6f58('0xe')][_0x55b652][_0x6f58('0x15')][_0x6f58('0x16')]='error';this[_0x6f58('0xe')][_0x55b652]['Imap'][_0x6f58('0x17')]=_0x5011f6;return this[_0x6f58('0x12')](_0x55b652);}};EmailChannel[_0x6f58('0x11')][_0x6f58('0x2e')]=function(_0x135923,_0x3e0491){return this[_0x6f58('0x10')][_0x6f58('0x2f')](_0x135923,_0x3e0491);};EmailChannel['prototype'][_0x6f58('0x30')]=function(_0x3b0e06){var _0x2e055e=this;if(this[_0x6f58('0xe')][_0x3b0e06['id']]){if(_[_0x6f58('0x23')](this['mailAccounts'][_0x3b0e06['id']][_0x6f58('0x31')])){this[_0x6f58('0xe')][_0x3b0e06['id']][_0x6f58('0x31')]={};}this[_0x6f58('0xe')][_0x3b0e06['id']][_0x6f58('0x31')][_0x6f58('0x2d')]=moment();return new BPromise(function(_0x1f5952,_0x8f3647){return _0x2e055e[_0x6f58('0x10')][_0x6f58('0x32')](_0x3b0e06)[_0x6f58('0x2a')](function(_0x4fb3c2){_0x2e055e[_0x6f58('0xe')][_0x3b0e06['id']][_0x6f58('0x31')]['status']=_0x6f58('0x33');_0x2e055e[_0x6f58('0xe')][_0x3b0e06['id']]['Smtp'][_0x6f58('0x17')]='';_0x2e055e[_0x6f58('0x12')](_0x3b0e06['id']);_0x1f5952(_0x4fb3c2);})[_0x6f58('0x34')](function(_0x188ec0){_0x2e055e[_0x6f58('0xe')][_0x3b0e06['id']]['Smtp'][_0x6f58('0x16')]=_0x6f58('0x21');_0x2e055e[_0x6f58('0xe')][_0x3b0e06['id']]['Smtp'][_0x6f58('0x17')]=_0x188ec0;_0x2e055e[_0x6f58('0x12')](_0x3b0e06['id']);_0x8f3647(_0x188ec0);});});}return this[_0x6f58('0x10')][_0x6f58('0x32')](_0x3b0e06);};module[_0x6f58('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 91572d1..74f863c 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 _0xeaa4=['required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','handleFetchMessage','body','handleMessageBody','attributes','handleMessageEnd','handleSimpleParser','handleMessageAttributes','closeBox','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','lodash','randomstring','mailparser','simpleParser','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','account','handleReady','bind','once','end','error','handleError','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls'];(function(_0x41f15f,_0x1a39ef){var _0x269a71=function(_0x52c50e){while(--_0x52c50e){_0x41f15f['push'](_0x41f15f['shift']());}};_0x269a71(++_0x1a39ef);}(_0xeaa4,0xa1));var _0x4eaa=function(_0x27489f,_0x1414df){_0x27489f=_0x27489f-0x0;var _0x1f7159=_0xeaa4[_0x27489f];return _0x1f7159;};'use strict';var fs=require('fs');var path=require(_0x4eaa('0x0'));var util=require(_0x4eaa('0x1'));var Imap=require(_0x4eaa('0x2'));var _=require(_0x4eaa('0x3'));var rs=require(_0x4eaa('0x4'));var simpleParser=require(_0x4eaa('0x5'))[_0x4eaa('0x6')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require('events')[_0x4eaa('0x7')];var utils=require(_0x4eaa('0x8'));var logger=require(_0x4eaa('0x9'))(_0x4eaa('0xa'));function EmailImap(_0x1dc4b5,_0x4e87d1){this[_0x4eaa('0xb')]=_0x4eaa('0xc');this[_0x4eaa('0xd')]=this['getAccount'](_0x1dc4b5,_0x4e87d1);this[_0x4eaa('0x2')]=new Imap(this[_0x4eaa('0xd')]);this['imap']['once']('ready',this[_0x4eaa('0xe')][_0x4eaa('0xf')](this));this['imap'][_0x4eaa('0x10')](_0x4eaa('0x11'),this['handleEnd'][_0x4eaa('0xf')](this));this['imap']['on'](_0x4eaa('0x12'),this[_0x4eaa('0x13')][_0x4eaa('0xf')](this));this[_0x4eaa('0x2')]['connect']();}util[_0x4eaa('0x14')](EmailImap,EventEmitter);EmailImap[_0x4eaa('0x15')][_0x4eaa('0x16')]=function(_0x4d427b,_0xf7761){var _0x1be4dd={'connTimeout':_0x4d427b['connTimeout']?_0x4d427b[_0x4eaa('0x17')]*0x3e8:0x2710,'authTimeout':_0x4d427b[_0x4eaa('0x18')]?_0x4d427b[_0x4eaa('0x18')]*0x3e8:0x1388};if(_[_0x4eaa('0x19')](_0x4d427b[_0x4eaa('0x1a')])){if(_0x4d427b[_0x4eaa('0x1b')]){_0x1be4dd[_0x4eaa('0x1c')]=_0x4d427b[_0x4eaa('0x1c')];_0x1be4dd[_0x4eaa('0x1d')]=_0x4d427b['password'];}_0x1be4dd[_0x4eaa('0x1e')]=_0x4d427b['host'];_0x1be4dd[_0x4eaa('0x1f')]=_0x4d427b[_0x4eaa('0x1f')]||0x3e1;if(_0x4d427b[_0x4eaa('0x20')]){_0x1be4dd[_0x4eaa('0x20')]=!![];}else{_0x1be4dd[_0x4eaa('0x20')]=![];_0x1be4dd[_0x4eaa('0x21')]=_0x4eaa('0x22');}}else{_0x1be4dd[_0x4eaa('0x1c')]=_0x4d427b[_0x4eaa('0x1c')];_0x1be4dd[_0x4eaa('0x1d')]=_0x4d427b[_0x4eaa('0x1d')];_0x1be4dd[_0x4eaa('0x1e')]=utils[_0x4eaa('0x23')](_0x4d427b['service']);_0x1be4dd['port']=0x3e1;_0x1be4dd['tls']=!![];}_0x1be4dd[_0x4eaa('0xa')]=_0xf7761||_0x4d427b['user']||_0x4eaa('0x24');return _0x1be4dd;};EmailImap['prototype']['handleReady']=function(){this[_0x4eaa('0x2')][_0x4eaa('0x25')](this[_0x4eaa('0xb')],![],this[_0x4eaa('0x26')][_0x4eaa('0xf')](this));};EmailImap[_0x4eaa('0x15')][_0x4eaa('0x26')]=function(_0x3aa6cc,_0x34cf83){if(_0x3aa6cc){this[_0x4eaa('0x13')](_0x3aa6cc,!![]);}else{this[_0x4eaa('0x27')](_0x4eaa('0x28'),_0x34cf83);this[_0x4eaa('0x29')]();}};EmailImap[_0x4eaa('0x15')][_0x4eaa('0x2a')]=function(_0x5f5356){if(_0x5f5356){this['handleError'](_0x5f5356,!![]);}else{this[_0x4eaa('0x2')][_0x4eaa('0x11')]();}};EmailImap[_0x4eaa('0x15')][_0x4eaa('0x29')]=function(){this[_0x4eaa('0x2')][_0x4eaa('0x2b')]([_0x4eaa('0x2c')],this['handleReadUnseen'][_0x4eaa('0xf')](this));};EmailImap[_0x4eaa('0x15')][_0x4eaa('0x2d')]=function(_0x47d561,_0x580ca8){if(_0x47d561){this['handleError'](_0x47d561,!![]);}else{if(_0x580ca8[_0x4eaa('0x2e')]){try{var _0x18175a=this['imap'][_0x4eaa('0x2f')](_0x580ca8,{'bodies':'','markSeen':!![]});_0x18175a['on'](_0x4eaa('0x30'),this['handleFetchMessage']['bind'](this));_0x18175a[_0x4eaa('0x10')](_0x4eaa('0x12'),this[_0x4eaa('0x31')]['bind'](this));_0x18175a['once'](_0x4eaa('0x11'),this[_0x4eaa('0x32')][_0x4eaa('0xf')](this));}catch(_0x3ed970){logger[_0x4eaa('0x12')](_0x3ed970);}}else{this[_0x4eaa('0x2')]['closeBox'](!![],this[_0x4eaa('0x2a')][_0x4eaa('0xf')](this));}}};EmailImap[_0x4eaa('0x15')][_0x4eaa('0x33')]=function(_0x40f36f,_0xeba08e){_0x40f36f['on'](_0x4eaa('0x34'),this[_0x4eaa('0x35')]['bind'](this));_0x40f36f['once'](_0x4eaa('0x36'),this['handleMessageAttributes'][_0x4eaa('0xf')](this));_0x40f36f['once'](_0x4eaa('0x11'),this[_0x4eaa('0x37')][_0x4eaa('0xf')](this));};EmailImap[_0x4eaa('0x15')][_0x4eaa('0x35')]=function(_0x224c6e,_0x20b4e5){simpleParser(_0x224c6e,{'Iconv':Iconv},this[_0x4eaa('0x38')][_0x4eaa('0xf')](this));};EmailImap[_0x4eaa('0x15')][_0x4eaa('0x39')]=function(_0x4bc12d){};EmailImap[_0x4eaa('0x15')]['handleMessageEnd']=function(){};EmailImap[_0x4eaa('0x15')][_0x4eaa('0x38')]=function(_0x242acc,_0x85bcc1){if(_0x242acc){logger[_0x4eaa('0x12')](_0x242acc);}else{var _0x322d60=this;utils['parser'](this[_0x4eaa('0xd')],_0x85bcc1,function(_0x3acb67){_0x322d60[_0x4eaa('0x27')]('email',_0x3acb67);});}};EmailImap[_0x4eaa('0x15')][_0x4eaa('0x32')]=function(){this[_0x4eaa('0x2')][_0x4eaa('0x3a')](!![],this['handleCloseBox'][_0x4eaa('0xf')](this));};EmailImap[_0x4eaa('0x15')]['handleFetchError']=function(_0x177bd0){this[_0x4eaa('0x13')](_0x177bd0);this[_0x4eaa('0x2')][_0x4eaa('0x3a')](!![],this[_0x4eaa('0x2a')][_0x4eaa('0xf')](this));};EmailImap[_0x4eaa('0x15')][_0x4eaa('0x3b')]=function(){this[_0x4eaa('0x27')](_0x4eaa('0x11'));};EmailImap['prototype']['handleError']=function(_0x531d96,_0x2236cd){logger[_0x4eaa('0x12')]('handleError',this[_0x4eaa('0xd')][_0x4eaa('0xa')],JSON[_0x4eaa('0x3c')](_0x531d96));var _0x368489='';if(_0x531d96){if(_0x531d96['textCode']){_0x368489=_0x531d96[_0x4eaa('0x3d')];}else{for(var _0x253e0d in _0x531d96){if(_0x531d96[_0x4eaa('0x3e')](_0x253e0d)){_0x368489+=_[_0x4eaa('0x3f')](_0x253e0d)+':\x20'+_0x531d96[_0x253e0d]+'\x0a';}}}}if(_0x2236cd){this[_0x4eaa('0x2')][_0x4eaa('0x11')]();}else{this[_0x4eaa('0x27')](_0x4eaa('0x12'),_0x368489);this['emit']('end');}};module[_0x4eaa('0x40')]=EmailImap; \ No newline at end of file +var _0x34b3=['account','once','ready','handleReady','bind','handleError','connect','connTimeout','authTimeout','user','password','host','port','tls','getHost','anonymous@xcally.com','prototype','openBox','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','handleReadUnseen','message','error','end','closeBox','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchEnd','handleFetchError','handleEnd','stringify','exports','path','util','imap','lodash','mailparser','simpleParser','iconv','events','./utils','../../../config/logger','email','mailbox','INBOX','getAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34b3,0xce));var _0x334b=function(_0x199b10,_0x3d0fb9){_0x199b10=_0x199b10-0x0;var _0x58b35b=_0x34b3[_0x199b10];return _0x58b35b;};'use strict';var fs=require('fs');var path=require(_0x334b('0x0'));var util=require(_0x334b('0x1'));var Imap=require(_0x334b('0x2'));var _=require(_0x334b('0x3'));var rs=require('randomstring');var simpleParser=require(_0x334b('0x4'))[_0x334b('0x5')];var Iconv=require(_0x334b('0x6'))['Iconv'];var EventEmitter=require(_0x334b('0x7'))['EventEmitter'];var utils=require(_0x334b('0x8'));var logger=require(_0x334b('0x9'))(_0x334b('0xa'));function EmailImap(_0x82fd36,_0x4fed9a){this[_0x334b('0xb')]=_0x334b('0xc');this['account']=this[_0x334b('0xd')](_0x82fd36,_0x4fed9a);this[_0x334b('0x2')]=new Imap(this[_0x334b('0xe')]);this[_0x334b('0x2')][_0x334b('0xf')](_0x334b('0x10'),this[_0x334b('0x11')]['bind'](this));this[_0x334b('0x2')][_0x334b('0xf')]('end',this['handleEnd'][_0x334b('0x12')](this));this[_0x334b('0x2')]['on']('error',this[_0x334b('0x13')]['bind'](this));this[_0x334b('0x2')][_0x334b('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0x334b('0xd')]=function(_0x20c799,_0x55b39e){var _0x30d9eb={'connTimeout':_0x20c799[_0x334b('0x15')]?_0x20c799['connTimeout']*0x3e8:0x2710,'authTimeout':_0x20c799[_0x334b('0x16')]?_0x20c799[_0x334b('0x16')]*0x3e8:0x1388};if(_['isNil'](_0x20c799['service'])){if(_0x20c799['authentication']){_0x30d9eb[_0x334b('0x17')]=_0x20c799[_0x334b('0x17')];_0x30d9eb[_0x334b('0x18')]=_0x20c799['password'];}_0x30d9eb[_0x334b('0x19')]=_0x20c799[_0x334b('0x19')];_0x30d9eb[_0x334b('0x1a')]=_0x20c799[_0x334b('0x1a')]||0x3e1;if(_0x20c799[_0x334b('0x1b')]){_0x30d9eb['tls']=!![];}else{_0x30d9eb[_0x334b('0x1b')]=![];_0x30d9eb['autotls']='required';}}else{_0x30d9eb[_0x334b('0x17')]=_0x20c799[_0x334b('0x17')];_0x30d9eb[_0x334b('0x18')]=_0x20c799[_0x334b('0x18')];_0x30d9eb[_0x334b('0x19')]=utils[_0x334b('0x1c')](_0x20c799['service']);_0x30d9eb[_0x334b('0x1a')]=0x3e1;_0x30d9eb[_0x334b('0x1b')]=!![];}_0x30d9eb[_0x334b('0xa')]=_0x55b39e||_0x20c799[_0x334b('0x17')]||_0x334b('0x1d');return _0x30d9eb;};EmailImap[_0x334b('0x1e')][_0x334b('0x11')]=function(){this[_0x334b('0x2')][_0x334b('0x1f')](this[_0x334b('0xb')],![],this[_0x334b('0x20')]['bind'](this));};EmailImap[_0x334b('0x1e')][_0x334b('0x20')]=function(_0x45decc,_0x4536fc){if(_0x45decc){this[_0x334b('0x13')](_0x45decc,!![]);}else{this[_0x334b('0x21')](_0x334b('0x22'),_0x4536fc);this[_0x334b('0x23')]();}};EmailImap[_0x334b('0x1e')][_0x334b('0x24')]=function(_0x479d0e){if(_0x479d0e){this[_0x334b('0x13')](_0x479d0e,!![]);}else{this[_0x334b('0x2')]['end']();}};EmailImap['prototype'][_0x334b('0x23')]=function(){this[_0x334b('0x2')][_0x334b('0x25')](['UNSEEN'],this[_0x334b('0x26')]['bind'](this));};EmailImap[_0x334b('0x1e')]['handleReadUnseen']=function(_0x4ee465,_0x3c476f){if(_0x4ee465){this[_0x334b('0x13')](_0x4ee465,!![]);}else{if(_0x3c476f['length']){try{var _0x2559ab=this[_0x334b('0x2')]['fetch'](_0x3c476f,{'bodies':'','markSeen':!![]});_0x2559ab['on'](_0x334b('0x27'),this['handleFetchMessage'][_0x334b('0x12')](this));_0x2559ab['once'](_0x334b('0x28'),this['handleFetchError']['bind'](this));_0x2559ab[_0x334b('0xf')](_0x334b('0x29'),this['handleFetchEnd'][_0x334b('0x12')](this));}catch(_0x4bf214){logger['error'](_0x4bf214);}}else{this[_0x334b('0x2')][_0x334b('0x2a')](!![],this[_0x334b('0x24')][_0x334b('0x12')](this));}}};EmailImap[_0x334b('0x1e')][_0x334b('0x2b')]=function(_0x47e7d7,_0x4a2166){_0x47e7d7['on'](_0x334b('0x2c'),this['handleMessageBody'][_0x334b('0x12')](this));_0x47e7d7['once'](_0x334b('0x2d'),this[_0x334b('0x2e')][_0x334b('0x12')](this));_0x47e7d7[_0x334b('0xf')]('end',this[_0x334b('0x2f')]['bind'](this));};EmailImap[_0x334b('0x1e')]['handleMessageBody']=function(_0x31a661,_0xed8e35){simpleParser(_0x31a661,{'Iconv':Iconv},this[_0x334b('0x30')][_0x334b('0x12')](this));};EmailImap[_0x334b('0x1e')][_0x334b('0x2e')]=function(_0xe58d37){};EmailImap['prototype'][_0x334b('0x2f')]=function(){};EmailImap['prototype'][_0x334b('0x30')]=function(_0x2832cb,_0x4ad702){if(_0x2832cb){logger['error'](_0x2832cb);}else{var _0x4efcfe=this;utils[_0x334b('0x31')](this[_0x334b('0xe')],_0x4ad702,function(_0x388811){_0x4efcfe['emit']('email',_0x388811);});}};EmailImap[_0x334b('0x1e')][_0x334b('0x32')]=function(){this[_0x334b('0x2')]['closeBox'](!![],this[_0x334b('0x24')][_0x334b('0x12')](this));};EmailImap[_0x334b('0x1e')][_0x334b('0x33')]=function(_0x4cc481){this['handleError'](_0x4cc481);this[_0x334b('0x2')][_0x334b('0x2a')](!![],this[_0x334b('0x24')][_0x334b('0x12')](this));};EmailImap[_0x334b('0x1e')][_0x334b('0x34')]=function(){this[_0x334b('0x21')]('end');};EmailImap[_0x334b('0x1e')]['handleError']=function(_0x1acf58,_0xd9544c){logger[_0x334b('0x28')]('handleError',this[_0x334b('0xe')]['email'],JSON[_0x334b('0x35')](_0x1acf58));var _0x5bf242='';if(_0x1acf58){if(_0x1acf58['textCode']){_0x5bf242=_0x1acf58['textCode'];}else{for(var _0x30574b in _0x1acf58){if(_0x1acf58['hasOwnProperty'](_0x30574b)){_0x5bf242+=_['upperFirst'](_0x30574b)+':\x20'+_0x1acf58[_0x30574b]+'\x0a';}}}}if(_0xd9544c){this[_0x334b('0x2')][_0x334b('0x29')]();}else{this[_0x334b('0x21')](_0x334b('0x28'),_0x5bf242);this['emit'](_0x334b('0x29'));}};module[_0x334b('0x36')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index e3c078e..604e136 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 _0x29d4=['exports','nodemailer-plugin-inline-base64','prototype','use','compile','sendMail','toString','createTransport'];(function(_0x32f683,_0x15c1a0){var _0x36497a=function(_0x464f69){while(--_0x464f69){_0x32f683['push'](_0x32f683['shift']());}};_0x36497a(++_0x15c1a0);}(_0x29d4,0x89));var _0x429d=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x29d4[_0x6c993a];return _0x27f547;};'use strict';var nodemailer=require('nodemailer');var BPromise=require('bluebird');var inlineBase64=require(_0x429d('0x0'));function EmailSmtp(){}EmailSmtp[_0x429d('0x1')]['send']=function(_0x2ec7b5,_0x1d4174){return new BPromise(function(_0x29789b,_0x4cae45){var _0x3cbf5a=nodemailer['createTransport'](_0x2ec7b5);_0x3cbf5a[_0x429d('0x2')](_0x429d('0x3'),inlineBase64());_0x3cbf5a[_0x429d('0x4')](_0x1d4174,function(_0x1f43e2,_0x42cefc){if(_0x1f43e2){_0x4cae45(_0x1f43e2[_0x429d('0x5')]());}else{_0x29789b(_0x42cefc);}});});};EmailSmtp[_0x429d('0x1')]['verify']=function(_0x1e55bf){return new BPromise(function(_0x26ed39,_0x42e350){var _0x416b27=nodemailer[_0x429d('0x6')](_0x1e55bf);_0x416b27['verify'](function(_0x57968e,_0x563ef9){if(_0x57968e){_0x42e350(_0x57968e[_0x429d('0x5')]());}else{if(_0x563ef9){_0x26ed39(_0x563ef9);}else{_0x42e350('Not\x20verifired');}}});});};module[_0x429d('0x7')]=EmailSmtp; \ No newline at end of file +var _0xf62e=['toString','verify','createTransport','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','use','compile'];(function(_0x2ae5c3,_0x52bd75){var _0x266d17=function(_0x5c9dc8){while(--_0x5c9dc8){_0x2ae5c3['push'](_0x2ae5c3['shift']());}};_0x266d17(++_0x52bd75);}(_0xf62e,0xe9));var _0xef62=function(_0x172f90,_0xa044a){_0x172f90=_0x172f90-0x0;var _0x216005=_0xf62e[_0x172f90];return _0x216005;};'use strict';var nodemailer=require(_0xef62('0x0'));var BPromise=require(_0xef62('0x1'));var inlineBase64=require(_0xef62('0x2'));function EmailSmtp(){}EmailSmtp[_0xef62('0x3')][_0xef62('0x4')]=function(_0x2e15ff,_0x14ce9a){return new BPromise(function(_0x1dda3e,_0x207d14){var _0x57a4e6=nodemailer['createTransport'](_0x2e15ff);_0x57a4e6[_0xef62('0x5')](_0xef62('0x6'),inlineBase64());_0x57a4e6['sendMail'](_0x14ce9a,function(_0x478203,_0x13dc76){if(_0x478203){_0x207d14(_0x478203[_0xef62('0x7')]());}else{_0x1dda3e(_0x13dc76);}});});};EmailSmtp[_0xef62('0x3')][_0xef62('0x8')]=function(_0x4ce37c){return new BPromise(function(_0x4657f1,_0x52ac70){var _0x328fde=nodemailer[_0xef62('0x9')](_0x4ce37c);_0x328fde['verify'](function(_0x2bbb38,_0x47ec1b){if(_0x2bbb38){_0x52ac70(_0x2bbb38[_0xef62('0x7')]());}else{if(_0x47ec1b){_0x4657f1(_0x47ec1b);}else{_0x52ac70(_0xef62('0xa'));}}});});};module[_0xef62('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 9af8bd4..63a02e1 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 _0x600a=['moment','randomstring','path','node-tnef','../../../config/logger','value','anonymous','generate','@xcally.com','name','split','length','slice','join','Anonymous','head','isEmpty','address','test','html','replace','body','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','127.0.0.1','lodash'];(function(_0x4e3bf4,_0x79b5ec){var _0x258f66=function(_0xd660ea){while(--_0xd660ea){_0x4e3bf4['push'](_0x4e3bf4['shift']());}};_0x258f66(++_0x79b5ec);}(_0x600a,0x89));var _0xa600=function(_0x441f7a,_0x576321){_0x441f7a=_0x441f7a-0x0;var _0x4821da=_0x600a[_0x441f7a];return _0x4821da;};'use strict';var _=require(_0xa600('0x0'));var moment=require(_0xa600('0x1'));var random=require(_0xa600('0x2'));var fs=require('fs');var path=require(_0xa600('0x3'));var util=require('util');var tnef=require(_0xa600('0x4'));var logger=require(_0xa600('0x5'))('email');var config=require('../../../config/environment');function getAddress(_0x2dd509){var _0x18689a=_['head'](_0x2dd509[_0xa600('0x6')]);return _0x18689a&&_0x18689a['address']?_0x18689a['address']:_0xa600('0x7')+random[_0xa600('0x8')](0x6)+_0xa600('0x9');}function getFirstName(_0x3d917b){var _0x15a4eb=_['head'](_0x3d917b[_0xa600('0x6')]);if(_0x15a4eb&&_0x15a4eb[_0xa600('0xa')]){var _0x16b073=_0x15a4eb[_0xa600('0xa')][_0xa600('0xb')](/\s+/);return _0x16b073[_0xa600('0xc')]?_0x16b073[_0xa600('0xd')](0x0,-0x1)[_0xa600('0xe')]('\x20'):_0x15a4eb[_0xa600('0xa')];}return _0xa600('0xf');}function getLastName(_0x55e072){var _0x2164d1=_[_0xa600('0x10')](_0x55e072[_0xa600('0x6')]);if(_0x2164d1&&_0x2164d1[_0xa600('0xa')]){var _0x4b9576=_0x2164d1[_0xa600('0xa')]['split'](/\s+/);return _0x4b9576[_0xa600('0xc')]>0x1?_0x4b9576['pop']():'';}return'';}function getMails(_0x1afc86,_0x292a6e){var _0x23b72e='';for(var _0x2c12bd=0x0;_0x2c12bd<_0x292a6e[_0xa600('0x6')][_0xa600('0xc')];_0x2c12bd+=0x1){if(_0x292a6e['value'][_0x2c12bd]['address']!==_0x1afc86){if(!_[_0xa600('0x11')](_0x23b72e)){_0x23b72e+=',';}_0x23b72e+=_0x292a6e[_0xa600('0x6')][_0x2c12bd]['name']||_0x292a6e[_0xa600('0x6')][_0x2c12bd]['address']||'';_0x23b72e+='\x20<';_0x23b72e+=_0x292a6e['value'][_0x2c12bd][_0xa600('0x12')]?_0x292a6e[_0xa600('0x6')][_0x2c12bd][_0xa600('0x12')]:_0xa600('0x7')+random['generate'](0x6)+_0xa600('0x9');_0x23b72e+='>';}}return _0x23b72e;}function parseEmail(_0xe108c8,_0x15d494,_0x1779e3){if(_0x15d494['html']){var _0x51cb38=/)<[^<]*)*<\/script>/gi;while(_0x51cb38[_0xa600('0x13')](_0x15d494[_0xa600('0x14')])){_0x15d494[_0xa600('0x14')]=_0x15d494[_0xa600('0x14')][_0xa600('0x15')](_0x51cb38,'');}_0x1779e3[_0xa600('0x16')]=_0x15d494[_0xa600('0x14')];}else{_0x1779e3[_0xa600('0x16')]=_0x15d494['textAsHtml'];}if(_0x1779e3[_0xa600('0x16')]){_0x1779e3[_0xa600('0x16')]=_0x1779e3[_0xa600('0x16')][_0xa600('0x15')](/0x1?_0x154275[_0x7c0a('0x13')]():'';}return'';}function getMails(_0x13bd77,_0x44a3d7){var _0x37bfda='';for(var _0xb9895a=0x0;_0xb9895a<_0x44a3d7[_0x7c0a('0x9')][_0x7c0a('0xf')];_0xb9895a+=0x1){if(_0x44a3d7[_0x7c0a('0x9')][_0xb9895a][_0x7c0a('0xa')]!==_0x13bd77){if(!_[_0x7c0a('0x14')](_0x37bfda)){_0x37bfda+=',';}_0x37bfda+=_0x44a3d7[_0x7c0a('0x9')][_0xb9895a][_0x7c0a('0xd')]||_0x44a3d7[_0x7c0a('0x9')][_0xb9895a][_0x7c0a('0xa')]||'';_0x37bfda+='\x20<';_0x37bfda+=_0x44a3d7[_0x7c0a('0x9')][_0xb9895a]['address']?_0x44a3d7[_0x7c0a('0x9')][_0xb9895a][_0x7c0a('0xa')]:'anonymous'+random[_0x7c0a('0xb')](0x6)+_0x7c0a('0xc');_0x37bfda+='>';}}return _0x37bfda;}function parseEmail(_0x142218,_0x3f9fb5,_0x55a8e3){if(_0x3f9fb5[_0x7c0a('0x15')]){var _0x455bc6=/)<[^<]*)*<\/script>/gi;while(_0x455bc6[_0x7c0a('0x16')](_0x3f9fb5[_0x7c0a('0x15')])){_0x3f9fb5[_0x7c0a('0x15')]=_0x3f9fb5['html'][_0x7c0a('0x17')](_0x455bc6,'');}_0x55a8e3[_0x7c0a('0x18')]=_0x3f9fb5[_0x7c0a('0x15')];}else{_0x55a8e3[_0x7c0a('0x18')]=_0x3f9fb5[_0x7c0a('0x19')];}if(_0x55a8e3[_0x7c0a('0x18')]){_0x55a8e3[_0x7c0a('0x18')]=_0x55a8e3[_0x7c0a('0x18')][_0x7c0a('0x17')](/Empty\x20message

';if(_0x4129c9['Attachments']){for(var _0x85ae1a=0x0;_0x85ae1a<_0x4129c9[_0x7c0a('0x37')][_0x7c0a('0xf')];_0x85ae1a++){var _0x247054=_0x4129c9[_0x7c0a('0x37')][_0x85ae1a];_0x15351b[_0x7c0a('0x1c')][_0x7c0a('0x20')][_0x7c0a('0x29')]({'filename':_0x247054[_0x7c0a('0x38')],'content':new Buffer(_0x247054['Data'])});}}}_0x577791(parseEmail(_0x3e5f29,_0x4f3b71,_0x15351b));});}else{_0x4f3b71[_0x7c0a('0x15')]='

Empty\x20message

';_0x577791(parseEmail(_0x3e5f29,_0x4f3b71,_0x15351b));}}else{_0x577791(parseEmail(_0x3e5f29,_0x4f3b71,_0x15351b));}};exports['getHost']=function(_0x2adcff){switch(_0x2adcff){case _0x7c0a('0x39'):return'imap.gmail.com';case _0x7c0a('0x3a'):return _0x7c0a('0x3b');case _0x7c0a('0x3c'):return _0x7c0a('0x3d');case'outlook365':return _0x7c0a('0x3e');}return _0x7c0a('0x3f');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 0e62db0..a580753 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 _0xbdbf=['SERV','active','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x461695,_0x2fc2ec){var _0x4334fa=function(_0x5e09a2){while(--_0x5e09a2){_0x461695['push'](_0x461695['shift']());}};_0x4334fa(++_0x2fc2ec);}(_0xbdbf,0x1b5));var _0xfbdb=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0xbdbf[_0x367e5b];return _0x4b909e;};'use strict';var _=require(_0xfbdb('0x0'));function MailAccount(_0x10348c){this['id']=_0x10348c['id']||0x0;this[_0xfbdb('0x1')]=_0x10348c[_0xfbdb('0x1')]||_0xfbdb('0x2');this[_0xfbdb('0x3')]=_0x10348c[_0xfbdb('0x3')]||_0xfbdb('0x4');this[_0xfbdb('0x5')]=_0x10348c['active']||![];this[_0xfbdb('0x6')]=_0x10348c[_0xfbdb('0x6')]||[];this[_0xfbdb('0x7')]=_0x10348c[_0xfbdb('0x7')]||[];}module[_0xfbdb('0x8')]=MailAccount; \ No newline at end of file +var _0x6410=['Imap','Smtp','exports','lodash','name','Service','key','SERV','active'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0x6410,0x1ce));var _0x0641=function(_0x3ed95e,_0x2d2d13){_0x3ed95e=_0x3ed95e-0x0;var _0x4ab531=_0x6410[_0x3ed95e];return _0x4ab531;};'use strict';var _=require(_0x0641('0x0'));function MailAccount(_0x5d3144){this['id']=_0x5d3144['id']||0x0;this[_0x0641('0x1')]=_0x5d3144[_0x0641('0x1')]||_0x0641('0x2');this['key']=_0x5d3144[_0x0641('0x3')]||_0x0641('0x4');this[_0x0641('0x5')]=_0x5d3144[_0x0641('0x5')]||![];this[_0x0641('0x6')]=_0x5d3144['Imap']||[];this['Smtp']=_0x5d3144[_0x0641('0x7')]||[];}module[_0x0641('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index bdec20d..db4e6b7 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 _0xb8c4=['exports','lodash','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','mailAccounts','merge'];(function(_0x7d5c2,_0x4b09ab){var _0x12c8c3=function(_0x28bd2b){while(--_0x28bd2b){_0x7d5c2['push'](_0x7d5c2['shift']());}};_0x12c8c3(++_0x4b09ab);}(_0xb8c4,0x18d));var _0x4b8c=function(_0x59f3c8,_0x269e43){_0x59f3c8=_0x59f3c8-0x0;var _0x320c2f=_0xb8c4[_0x59f3c8];return _0x320c2f;};'use strict';var _=require(_0x4b8c('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2e222b,_0x439b41,_0xf485cc){var _0x20f7a1=_[_0x4b8c('0x1')](_0x2e222b,function(_0x10d01a,_0x4de856){return _0x10d01a[_0xf485cc];});for(var _0x2ccbca in _0x439b41){if(_0x439b41[_0x4b8c('0x2')](_0x2ccbca)){if(!_0x20f7a1[_0x2ccbca]){delete _0x439b41[_0x2ccbca];}}}}Realtime[_0x4b8c('0x3')][_0x4b8c('0x4')]=function(_0x428b8f,_0x3f0adc){for(var _0x435669 in _0x3f0adc){if(_0x428b8f[_0x4b8c('0x2')](_0x435669)){_0x428b8f[_0x435669]=_0x3f0adc[_0x435669];}}};Realtime[_0x4b8c('0x3')][_0x4b8c('0x5')]=function(){var _0x2c7fc2=this;return function(_0x56bcc4){if(_0x56bcc4){freeIsNotKey(_0x56bcc4,_0x2c7fc2['mailAccounts'],'id');for(var _0x91f4ac=0x0,_0x4b57bc={},_0x2aae20={};_0x91f4ac<_0x56bcc4[_0x4b8c('0x6')];_0x91f4ac+=0x1){_0x4b57bc=_0x56bcc4[_0x91f4ac];if(_[_0x4b8c('0x7')](_0x2c7fc2[_0x4b8c('0x8')][_0x4b57bc['id']])){_0x2c7fc2[_0x4b8c('0x8')][_0x4b57bc['id']]=new MailAccount(_0x4b57bc);}else{_[_0x4b8c('0x9')](_0x2c7fc2[_0x4b8c('0x8')][_0x4b57bc['id']],_0x4b57bc);}}}return _0x2c7fc2[_0x4b8c('0x8')];};};module[_0x4b8c('0xa')]=Realtime; \ No newline at end of file +var _0x20ee=['mailAccounts','length','isUndefined','exports','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase'];(function(_0x2a2cdf,_0x3f2801){var _0x5e8e12=function(_0x3cc5ef){while(--_0x3cc5ef){_0x2a2cdf['push'](_0x2a2cdf['shift']());}};_0x5e8e12(++_0x3f2801);}(_0x20ee,0x12d));var _0xe20e=function(_0xab3f9f,_0x19f868){_0xab3f9f=_0xab3f9f-0x0;var _0x25671d=_0x20ee[_0xab3f9f];return _0x25671d;};'use strict';var _=require('lodash');var MailAccount=require(_0xe20e('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x3e7197,_0x16da9d,_0x5c223a){var _0x580764=_[_0xe20e('0x1')](_0x3e7197,function(_0x1823e2,_0xa2269c){return _0x1823e2[_0x5c223a];});for(var _0x20ca61 in _0x16da9d){if(_0x16da9d[_0xe20e('0x2')](_0x20ca61)){if(!_0x580764[_0x20ca61]){delete _0x16da9d[_0x20ca61];}}}}Realtime[_0xe20e('0x3')][_0xe20e('0x4')]=function(_0x59d061,_0x472d8e){for(var _0x4a6bc0 in _0x472d8e){if(_0x59d061[_0xe20e('0x2')](_0x4a6bc0)){_0x59d061[_0x4a6bc0]=_0x472d8e[_0x4a6bc0];}}};Realtime[_0xe20e('0x3')]['initMailAccounts']=function(){var _0x183d27=this;return function(_0x5416cc){if(_0x5416cc){freeIsNotKey(_0x5416cc,_0x183d27[_0xe20e('0x5')],'id');for(var _0x167907=0x0,_0x22e784={},_0x14d96f={};_0x167907<_0x5416cc[_0xe20e('0x6')];_0x167907+=0x1){_0x22e784=_0x5416cc[_0x167907];if(_[_0xe20e('0x7')](_0x183d27[_0xe20e('0x5')][_0x22e784['id']])){_0x183d27[_0xe20e('0x5')][_0x22e784['id']]=new MailAccount(_0x22e784);}else{_['merge'](_0x183d27['mailAccounts'][_0x22e784['id']],_0x22e784);}}}return _0x183d27['mailAccounts'];};};module[_0xe20e('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 93326af..a571fa9 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 _0xb0df=['key','ListId','MailServerIn','Imap','getMailAccount','notify','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','name','service','email','active'];(function(_0x4eab4d,_0x1fbd49){var _0x3bffce=function(_0x1e4c66){while(--_0x1e4c66){_0x4eab4d['push'](_0x4eab4d['shift']());}};_0x3bffce(++_0x1fbd49);}(_0xb0df,0x85));var _0xfb0d=function(_0xb24fad,_0xd58756){_0xb24fad=_0xb24fad-0x0;var _0x173226=_0xb0df[_0xb24fad];return _0x173226;};'use strict';var client=require('../client');exports[_0xfb0d('0x0')]=function(){return function(){return client[_0xfb0d('0x1')](_0xfb0d('0x2'),{'options':{'attributes':['id',_0xfb0d('0x3'),_0xfb0d('0x4'),_0xfb0d('0x5'),_0xfb0d('0x6'),_0xfb0d('0x7'),_0xfb0d('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0xfb0d('0x9'),'as':_0xfb0d('0xa')},{'model':'MailServerOut','as':'Smtp'}]},'log':_0xfb0d('0xb')});};};exports[_0xfb0d('0xc')]=function(_0x5cf723,_0x57ab8c){return client[_0xfb0d('0x1')](_0xfb0d('0xd'),{'account':{'id':_0x5cf723},'body':_0x57ab8c,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xafb9=['../client','getMailAccounts','Request','GetMailAccount','name','service','email','active','key','MailServerIn','MailServerOut','notify','NotifyMailAccount'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xafb9,0x68));var _0x9afb=function(_0x8d14b0,_0x3fb5de){_0x8d14b0=_0x8d14b0-0x0;var _0xe5676c=_0xafb9[_0x8d14b0];return _0xe5676c;};'use strict';var client=require(_0x9afb('0x0'));exports[_0x9afb('0x1')]=function(){return function(){return client[_0x9afb('0x2')](_0x9afb('0x3'),{'options':{'attributes':['id',_0x9afb('0x4'),_0x9afb('0x5'),_0x9afb('0x6'),_0x9afb('0x7'),_0x9afb('0x8'),'ListId','TemplateId'],'raw':![],'include':[{'model':_0x9afb('0x9'),'as':'Imap'},{'model':_0x9afb('0xa'),'as':'Smtp'}]},'log':'getMailAccount'});};};exports[_0x9afb('0xb')]=function(_0x1edf77,_0x20b8c1){return client['Request'](_0x9afb('0xc'),{'account':{'id':_0x1edf77},'body':_0x20b8c1,'log':_0x9afb('0xc')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index bf0d802..0d3a407 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 _0x54c9=['Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','../../../config/logger','email','sendMail','account','message','then','catch','error','verifySmtp','Verified','mailAccounts','length','Imap','password','Smtp','pass','127.0.0.1','log'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x54c9,0xd4));var _0x954c=function(_0x1fe273,_0x31ed83){_0x1fe273=_0x1fe273-0x0;var _0x22b78a=_0x54c9[_0x1fe273];return _0x22b78a;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var _=require(_0x954c('0x0'));var logger=require(_0x954c('0x1'))(_0x954c('0x2'));exports['listen']=function(_0x108faf,_0x128f01){return new BPromise(function(_0x939799,_0x3f3f87){var _0x48e973={'SendMail':function(_0x4e0e7f){var _0x291602=this;return new Promise(function(_0x2c0cfd,_0x1a97f6){_0x128f01[_0x954c('0x3')](_0x4e0e7f[_0x954c('0x4')],_0x4e0e7f[_0x954c('0x5')])[_0x954c('0x6')](function(_0x269998){_0x2c0cfd({'code':0xc8,'message':_0x269998});})[_0x954c('0x7')](function(_0x561a18){_0x1a97f6(_0x291602[_0x954c('0x8')](0x1f4,_0x561a18));});});},'VerifySmtp':function(_0xe2c8d0){var _0x11249b=this;return new Promise(function(_0xe46f4c,_0x1e7518){_0x128f01[_0x954c('0x9')](_0xe2c8d0[_0x954c('0x4')])['then'](function(_0x30cecd){_0xe46f4c({'code':0xc8,'message':_0x954c('0xa')});})[_0x954c('0x7')](function(_0x4178a2){_0x1e7518(_0x11249b[_0x954c('0x8')](0x1f4,_0x4178a2));});});},'MailAccounts':function(_0x423b1a){return new Promise(function(_0x55361b,_0x47ec32){var _0x5a0bbf=_['values'](_0x108faf[_0x954c('0xb')]);for(var _0x1c1c48=0x0;_0x1c1c48<_0x5a0bbf[_0x954c('0xc')];_0x1c1c48+=0x1){if(_0x5a0bbf[_0x1c1c48][_0x954c('0xd')]&&_0x5a0bbf[_0x1c1c48][_0x954c('0xd')]['password']){delete _0x5a0bbf[_0x1c1c48][_0x954c('0xd')][_0x954c('0xe')];}if(_0x5a0bbf[_0x1c1c48][_0x954c('0xf')]&&_0x5a0bbf[_0x1c1c48][_0x954c('0xf')][_0x954c('0x10')]){delete _0x5a0bbf[_0x1c1c48][_0x954c('0xf')]['pass'];}}_0x55361b({'count':_0x5a0bbf[_0x954c('0xc')],'rows':_0x5a0bbf});});}};var _0x1cc40e=jayson['server'](_0x48e973)['http']();_0x1cc40e['on']('error',function(_0x33e462){logger[_0x954c('0x8')](JSON['stringify'](_0x33e462));return _0x3f3f87(_0x33e462);});_0x1cc40e['listen'](0x232b,_0x954c('0x11'),function(){console[_0x954c('0x12')](_0x954c('0x13'),0x232b);return _0x939799(_0x954c('0x14')+0x232b);});});}; \ No newline at end of file +var _0x33d9=['error','stringify','127.0.0.1','RPC\x20listening\x20on\x20port:','jayson/promise','lodash','../../../config/logger','email','listen','sendMail','account','catch','verifySmtp','then','Verified','values','length','Imap','password','Smtp','pass','http'];(function(_0x56e1ac,_0x9a4e75){var _0x37263a=function(_0x1380a3){while(--_0x1380a3){_0x56e1ac['push'](_0x56e1ac['shift']());}};_0x37263a(++_0x9a4e75);}(_0x33d9,0x122));var _0x933d=function(_0x24073c,_0x54c619){_0x24073c=_0x24073c-0x0;var _0x5878b1=_0x33d9[_0x24073c];return _0x5878b1;};'use strict';var jayson=require(_0x933d('0x0'));var BPromise=require('bluebird');var _=require(_0x933d('0x1'));var logger=require(_0x933d('0x2'))(_0x933d('0x3'));exports[_0x933d('0x4')]=function(_0x5c8da0,_0x482fc1){return new BPromise(function(_0x5124ca,_0x108de1){var _0x2bb296={'SendMail':function(_0x5aa9e4){var _0x2b0458=this;return new Promise(function(_0x39e9d5,_0x176037){_0x482fc1[_0x933d('0x5')](_0x5aa9e4[_0x933d('0x6')],_0x5aa9e4['message'])['then'](function(_0x310315){_0x39e9d5({'code':0xc8,'message':_0x310315});})[_0x933d('0x7')](function(_0x3d7aaa){_0x176037(_0x2b0458['error'](0x1f4,_0x3d7aaa));});});},'VerifySmtp':function(_0x1295e3){var _0x14c9a3=this;return new Promise(function(_0x39bb41,_0x30ed7e){_0x482fc1[_0x933d('0x8')](_0x1295e3[_0x933d('0x6')])[_0x933d('0x9')](function(_0x3c5307){_0x39bb41({'code':0xc8,'message':_0x933d('0xa')});})[_0x933d('0x7')](function(_0x448824){_0x30ed7e(_0x14c9a3['error'](0x1f4,_0x448824));});});},'MailAccounts':function(_0x1f0a73){return new Promise(function(_0x45eb82,_0x5e5eb1){var _0x39b46f=_[_0x933d('0xb')](_0x5c8da0['mailAccounts']);for(var _0x57d023=0x0;_0x57d023<_0x39b46f[_0x933d('0xc')];_0x57d023+=0x1){if(_0x39b46f[_0x57d023][_0x933d('0xd')]&&_0x39b46f[_0x57d023][_0x933d('0xd')][_0x933d('0xe')]){delete _0x39b46f[_0x57d023][_0x933d('0xd')][_0x933d('0xe')];}if(_0x39b46f[_0x57d023][_0x933d('0xf')]&&_0x39b46f[_0x57d023]['Smtp'][_0x933d('0x10')]){delete _0x39b46f[_0x57d023]['Smtp']['pass'];}}_0x45eb82({'count':_0x39b46f[_0x933d('0xc')],'rows':_0x39b46f});});}};var _0x5cac20=jayson['server'](_0x2bb296)[_0x933d('0x11')]();_0x5cac20['on'](_0x933d('0x12'),function(_0x24591a){logger[_0x933d('0x12')](JSON[_0x933d('0x13')](_0x24591a));return _0x108de1(_0x24591a);});_0x5cac20[_0x933d('0x4')](0x232b,_0x933d('0x14'),function(){console['log']('Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232b);return _0x5124ca(_0x933d('0x15')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index fd32500..071f033 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 _0xe028=['Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','express','sticky-session','ioredis','createServer','timeout','listen','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening'];(function(_0x4937fb,_0x193d0e){var _0x427454=function(_0x2a3cd0){while(--_0x2a3cd0){_0x4937fb['push'](_0x4937fb['shift']());}};_0x427454(++_0x193d0e);}(_0xe028,0xb9));var _0x8e02=function(_0x132523,_0x2dc55b){_0x132523=_0x132523-0x0;var _0x424ff0=_0xe028[_0x132523];return _0x424ff0;};'use strict';var _=require(_0x8e02('0x0'));var http=require(_0x8e02('0x1'));var express=require(_0x8e02('0x2'));var sticky=require(_0x8e02('0x3'));var Redis=require(_0x8e02('0x4'));var config=require('../../config/environment');var app=express();var server=http[_0x8e02('0x5')](app);server[_0x8e02('0x6')]=0xdbba0;if(sticky[_0x8e02('0x7')](server,config['port'])){var socketio=require(_0x8e02('0x8'))(server,{'transports':[_0x8e02('0x9'),_0x8e02('0xa')]});config[_0x8e02('0xb')]=_[_0x8e02('0xc')](config[_0x8e02('0xb')],{'host':_0x8e02('0xd'),'port':0x18eb});socketio[_0x8e02('0xe')](require(_0x8e02('0xf'))({'pubClient':new Redis(config[_0x8e02('0xb')]),'subClient':new Redis(config[_0x8e02('0xb')])}));require(_0x8e02('0x10'))[_0x8e02('0x11')]();require(_0x8e02('0x12'))[_0x8e02('0x11')](socketio);require(_0x8e02('0x13'))[_0x8e02('0x11')](app);require(_0x8e02('0x14'))[_0x8e02('0x11')](app);}else{server[_0x8e02('0x15')](_0x8e02('0x16'),function(){console['log'](_0x8e02('0x17'),config[_0x8e02('0x18')]);});}exports=module[_0x8e02('0x19')]=app; \ No newline at end of file +var _0x8548=['once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','sticky-session','ioredis','timeout','listen','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes'];(function(_0x128ed7,_0x5536a4){var _0x1fa198=function(_0x4210f6){while(--_0x4210f6){_0x128ed7['push'](_0x128ed7['shift']());}};_0x1fa198(++_0x5536a4);}(_0x8548,0x1e9));var _0x8854=function(_0x178a8d,_0x5a5bf9){_0x178a8d=_0x178a8d-0x0;var _0x4055b5=_0x8548[_0x178a8d];return _0x4055b5;};'use strict';var _=require('lodash');var http=require('http');var express=require('express');var sticky=require(_0x8854('0x0'));var Redis=require(_0x8854('0x1'));var config=require('../../config/environment');var app=express();var server=http['createServer'](app);server[_0x8854('0x2')]=0xdbba0;if(sticky[_0x8854('0x3')](server,config['port'])){var socketio=require(_0x8854('0x4'))(server,{'transports':[_0x8854('0x5'),_0x8854('0x6')]});config[_0x8854('0x7')]=_[_0x8854('0x8')](config[_0x8854('0x7')],{'host':_0x8854('0x9'),'port':0x18eb});socketio[_0x8854('0xa')](require(_0x8854('0xb'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x8854('0x7')])}));require(_0x8854('0xc'))[_0x8854('0xd')]();require(_0x8854('0xe'))[_0x8854('0xd')](socketio);require(_0x8854('0xf'))[_0x8854('0xd')](app);require(_0x8854('0x10'))['default'](app);}else{server[_0x8854('0x11')]('listening',function(){console[_0x8854('0x12')](_0x8854('0x13'),config[_0x8854('0x14')]);});}exports=module[_0x8854('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index edd5f6b..1d80f71 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 _0x2159=['debug','error','rpc','message','result','exports','jayson/promise','bluebird','../../config/logger','routing','http','request','then'];(function(_0x2de54b,_0x7cfc8f){var _0x593ab3=function(_0x310a15){while(--_0x310a15){_0x2de54b['push'](_0x2de54b['shift']());}};_0x593ab3(++_0x7cfc8f);}(_0x2159,0x17f));var _0x9215=function(_0x9ea926,_0x32b1b2){_0x9ea926=_0x9ea926-0x0;var _0x129b2a=_0x2159[_0x9ea926];return _0x129b2a;};'use strict';var jayson=require(_0x9215('0x0'));var BPromise=require(_0x9215('0x1'));var logger=require(_0x9215('0x2'))(_0x9215('0x3'));var client=jayson['client'][_0x9215('0x4')]({'port':0x2329});client['Request']=function(_0x40501b,_0x3128f9){return new BPromise(function(_0x202c8d,_0x7933e9){return client[_0x9215('0x5')](_0x40501b,_0x3128f9)[_0x9215('0x6')](function(_0x3be70d){logger[_0x9215('0x7')]('rpc',_0x9215('0x3'),_0x40501b,_0x3128f9,_0x3be70d);if(_0x3be70d[_0x9215('0x8')]){logger[_0x9215('0x8')](_0x9215('0x9'),_0x9215('0x3'),_0x40501b,_0x3be70d['error'][_0x9215('0xa')],_0x3128f9);return _0x7933e9(_0x3be70d[_0x9215('0x8')][_0x9215('0xa')]);}else{return _0x202c8d(_0x3be70d[_0x9215('0xb')]);}})['catch'](function(_0x36b9aa){logger[_0x9215('0x8')]('rpc',_0x9215('0x3'),_0x40501b,_0x36b9aa,_0x3128f9);return _0x7933e9(_0x36b9aa);});});};module[_0x9215('0xc')]=client; \ No newline at end of file +var _0xf50b=['error','message','result','exports','jayson/promise','bluebird','routing','client','http','Request','request','then','debug','rpc'];(function(_0x53ece1,_0x284ef0){var _0x22196c=function(_0x2e039d){while(--_0x2e039d){_0x53ece1['push'](_0x53ece1['shift']());}};_0x22196c(++_0x284ef0);}(_0xf50b,0xc8));var _0xbf50=function(_0x4d3897,_0x11b8bc){_0x4d3897=_0x4d3897-0x0;var _0x430997=_0xf50b[_0x4d3897];return _0x430997;};'use strict';var jayson=require(_0xbf50('0x0'));var BPromise=require(_0xbf50('0x1'));var logger=require('../../config/logger')(_0xbf50('0x2'));var client=jayson[_0xbf50('0x3')][_0xbf50('0x4')]({'port':0x2329});client[_0xbf50('0x5')]=function(_0x5f0c1a,_0x32217d){return new BPromise(function(_0x4f5ba8,_0x36e4d6){return client[_0xbf50('0x6')](_0x5f0c1a,_0x32217d)[_0xbf50('0x7')](function(_0x117cc8){logger[_0xbf50('0x8')](_0xbf50('0x9'),_0xbf50('0x2'),_0x5f0c1a,_0x32217d,_0x117cc8);if(_0x117cc8['error']){logger[_0xbf50('0xa')](_0xbf50('0x9'),_0xbf50('0x2'),_0x5f0c1a,_0x117cc8['error']['message'],_0x32217d);return _0x36e4d6(_0x117cc8[_0xbf50('0xa')][_0xbf50('0xb')]);}else{return _0x4f5ba8(_0x117cc8[_0xbf50('0xc')]);}})['catch'](function(_0x39f9f4){logger[_0xbf50('0xa')](_0xbf50('0x9'),_0xbf50('0x2'),_0x5f0c1a,_0x39f9f4,_0x32217d);return _0x36e4d6(_0x39f9f4);});});};module[_0xbf50('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index be0db59..c8d8a9b 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 _0x60dc=['initChatQueues','getSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/faxQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues'];(function(_0x37c4aa,_0x3ed803){var _0x235df8=function(_0x1a806b){while(--_0x1a806b){_0x37c4aa['push'](_0x37c4aa['shift']());}};_0x235df8(++_0x3ed803);}(_0x60dc,0x80));var _0xc60d=function(_0x555582,_0x481a08){_0x555582=_0x555582-0x0;var _0x15e2cc=_0x60dc[_0x555582];return _0x15e2cc;};'use strict';var BPromise=require(_0xc60d('0x0'));var server=require(_0xc60d('0x1'));var Realtime=require(_0xc60d('0x2'));var user=require(_0xc60d('0x3'));var interval=require(_0xc60d('0x4'));var openchannelQueue=require(_0xc60d('0x5'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xc60d('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xc60d('0x7')]()[_0xc60d('0x8')](user[_0xc60d('0x9')]())[_0xc60d('0x8')](realtime[_0xc60d('0xa')]())[_0xc60d('0x8')](interval[_0xc60d('0xb')]())[_0xc60d('0x8')](realtime[_0xc60d('0xc')]())[_0xc60d('0x8')](openchannelQueue[_0xc60d('0xd')]())[_0xc60d('0x8')](realtime[_0xc60d('0xe')]())[_0xc60d('0x8')](chatQueue[_0xc60d('0xf')]())['then'](realtime[_0xc60d('0x10')]())['then'](smsQueue[_0xc60d('0x11')]())[_0xc60d('0x8')](realtime['initSmsQueues']())['then'](mailQueue['getMailQueues']())[_0xc60d('0x8')](realtime[_0xc60d('0x12')]())[_0xc60d('0x8')](faxQueue[_0xc60d('0x13')]())[_0xc60d('0x8')](realtime[_0xc60d('0x14')]())[_0xc60d('0x8')](function(){return realtime;});}function main(){return server[_0xc60d('0x15')](realtime)[_0xc60d('0x8')](function(_0x16e14c){return initRealtime();})[_0xc60d('0x8')](function(_0x2be31f){return setInterval(initRealtime,0x1388);})[_0xc60d('0x16')](function(_0x127231){console[_0xc60d('0x17')](_0x127231);});}main(); \ No newline at end of file +var _0x9aa4=['initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','listen','catch','log','bluebird','./rpc/user','./rpc/openchannelQueue','./rpc/smsQueue','resolve','then','getAgents','initAgents'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9aa4,0x1ad));var _0x49aa=function(_0xdd1c50,_0x2c9586){_0xdd1c50=_0xdd1c50-0x0;var _0x54c37f=_0x9aa4[_0xdd1c50];return _0x54c37f;};'use strict';var BPromise=require(_0x49aa('0x0'));var server=require('./server');var Realtime=require('./realtime');var user=require(_0x49aa('0x1'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x49aa('0x2'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x49aa('0x3'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x49aa('0x4')]()[_0x49aa('0x5')](user[_0x49aa('0x6')]())['then'](realtime[_0x49aa('0x7')]())['then'](interval['getIntervals']())[_0x49aa('0x5')](realtime[_0x49aa('0x8')]())[_0x49aa('0x5')](openchannelQueue[_0x49aa('0x9')]())[_0x49aa('0x5')](realtime[_0x49aa('0xa')]())[_0x49aa('0x5')](chatQueue[_0x49aa('0xb')]())[_0x49aa('0x5')](realtime[_0x49aa('0xc')]())['then'](smsQueue[_0x49aa('0xd')]())['then'](realtime[_0x49aa('0xe')]())[_0x49aa('0x5')](mailQueue['getMailQueues']())[_0x49aa('0x5')](realtime[_0x49aa('0xf')]())[_0x49aa('0x5')](faxQueue['getFaxQueues']())[_0x49aa('0x5')](realtime['initFaxQueues']())[_0x49aa('0x5')](function(){return realtime;});}function main(){return server[_0x49aa('0x10')](realtime)[_0x49aa('0x5')](function(_0x59ff12){return initRealtime();})['then'](function(_0x3963b1){return setInterval(initRealtime,0x1388);})[_0x49aa('0x11')](function(_0x4d1295){console[_0x49aa('0x12')](_0x4d1295);});}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 24e0ff8..d2caaa1 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 _0x0abc=['lodash','util','isNil','register','ignoreFactChanges','inherits','prototype','init','rules','activeRules','concat','isObject','push','sync','filter','orderBy','asc','execute','result','clone','name','index_','nextTick','ruleRef','isEqual','restart','condition','matchPath','noop','findRules','turn','length','prioritize','priority','toJSON','map','toString','consequence','isString','object','exports'];(function(_0x3ac0fd,_0x2dfb0c){var _0x2670a9=function(_0x1bc374){while(--_0x1bc374){_0x3ac0fd['push'](_0x3ac0fd['shift']());}};_0x2670a9(++_0x2dfb0c);}(_0x0abc,0xf6));var _0xc0ab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0abc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc0ab('0x0'));var util=require(_0xc0ab('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x1844d3,_0x18b15c){this['init']();if(!_[_0xc0ab('0x2')](_0x1844d3)){this[_0xc0ab('0x3')](_0x1844d3);}if(_0x18b15c){this[_0xc0ab('0x4')]=_0x18b15c['ignoreFactChanges'];}return this;}util[_0xc0ab('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xc0ab('0x6')][_0xc0ab('0x7')]=function(_0x42735e){this[_0xc0ab('0x8')]=[];this[_0xc0ab('0x9')]=[];};RuleEngine[_0xc0ab('0x6')][_0xc0ab('0x3')]=function(_0x2a9aed){if(Array['isArray'](_0x2a9aed)){this[_0xc0ab('0x8')]=this[_0xc0ab('0x8')][_0xc0ab('0xa')](_0x2a9aed);}else if(_0x2a9aed!==null&&_[_0xc0ab('0xb')](_0x2a9aed)){this[_0xc0ab('0x8')][_0xc0ab('0xc')](_0x2a9aed);}this[_0xc0ab('0xd')]();};RuleEngine['prototype'][_0xc0ab('0xd')]=function(){this[_0xc0ab('0x9')]=this['rules'][_0xc0ab('0xe')](function(_0x3ced26){if(_['isNil'](_0x3ced26['on'])){_0x3ced26['on']=!![];}if(_0x3ced26['on']===!![]){return _0x3ced26;}});this[_0xc0ab('0x9')]=_[_0xc0ab('0xf')](this[_0xc0ab('0x9')],['p'],[_0xc0ab('0x10')]);};RuleEngine[_0xc0ab('0x6')][_0xc0ab('0x11')]=function(_0xc36852,_0x3615be){var _0x115966=![];_0xc36852[_0xc0ab('0x12')]=!![];var _0x38bc6e=_[_0xc0ab('0x13')](_0xc36852);var _0x35b0c1=_['clone'](_0xc36852);var _0x3d7063=this[_0xc0ab('0x9')];var _0x1574b7=[];var _0x3a2044=this[_0xc0ab('0x4')];(function FnRuleLoop(_0x5410e4){var _0x100c3c={'rules':function(){return _0x3d7063;},'rule':function(){return _0x3d7063[_0x5410e4];},'when':function(_0x170e98){if(_0x170e98){var _0x6130dd=_0x3d7063[_0x5410e4]['consequence'];_0x6130dd['ruleRef']=_0x3d7063[_0x5410e4]['id']||_0x3d7063[_0x5410e4][_0xc0ab('0x14')]||_0xc0ab('0x15')+_0x5410e4;process[_0xc0ab('0x16')](function(){_0x1574b7[_0xc0ab('0xc')](_0x6130dd[_0xc0ab('0x17')]);_0x6130dd['call'](_0x38bc6e,_0x100c3c);});}else{process[_0xc0ab('0x16')](function(){_0x100c3c['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x115966=!![];return FnRuleLoop(0x0);},'next':function(_0xf2ba57){if(!_0x3a2044&&!_[_0xc0ab('0x18')](_0x35b0c1,_0x38bc6e)){_0x35b0c1=_[_0xc0ab('0x13')](_0x38bc6e);process[_0xc0ab('0x16')](function(){_0x100c3c[_0xc0ab('0x19')]();});}else{process['nextTick'](function(){if(_['isNil'](_0xf2ba57)){return FnRuleLoop(_0x5410e4+0x1);}else{return FnRuleLoop(_0xf2ba57);}});}}};if(_0x5410e4<_0x3d7063['length']&&_0x115966===![]){var _0xbc4fa4=_0x3d7063[_0x5410e4][_0xc0ab('0x1a')];_0xbc4fa4['call'](_0x38bc6e,_0x100c3c);}else{process[_0xc0ab('0x16')](function(){_0x38bc6e[_0xc0ab('0x1b')]=_0x1574b7;return _0x3615be?_0x3615be(_0x38bc6e):_[_0xc0ab('0x1c')]();});}}(0x0));};RuleEngine[_0xc0ab('0x6')][_0xc0ab('0x1d')]=function(_0x5a4aa3){if(_[_0xc0ab('0x2')](_0x5a4aa3)){return this[_0xc0ab('0x8')];}else{var _0x545db0=_['matches'](_0x5a4aa3);return _[_0xc0ab('0xe')](this['rules'],_0x545db0);}};RuleEngine[_0xc0ab('0x6')][_0xc0ab('0x1e')]=function(_0x365b2e,_0x468367){var _0x6042e3=_0x365b2e==='on'||_0x365b2e==='ON'?!![]:![];var _0x43d8aa=this[_0xc0ab('0x1d')](_0x468367);for(var _0x358a05=0x0,_0x17cff2=_0x43d8aa[_0xc0ab('0x1f')];_0x358a05<_0x17cff2;_0x358a05+=0x1){_0x43d8aa[_0x358a05]['on']=_0x6042e3;}this[_0xc0ab('0xd')]();};RuleEngine[_0xc0ab('0x6')][_0xc0ab('0x20')]=function(_0x539b61,_0x2dd4ee){_0x539b61=parseInt(_0x539b61,0xa);var _0x3c5118=this[_0xc0ab('0x1d')](_0x2dd4ee);for(var _0x33a141=0x0,_0x36b3bb=_0x3c5118['length'];_0x33a141<_0x36b3bb;_0x33a141+=0x1){_0x3c5118[_0x33a141][_0xc0ab('0x21')]=_0x539b61;}this[_0xc0ab('0xd')]();};RuleEngine['prototype'][_0xc0ab('0x22')]=function(){var _0x205f2e=this[_0xc0ab('0x8')];if(_0x205f2e instanceof Array){_0x205f2e=_0x205f2e[_0xc0ab('0x23')](function(_0x15aed8){_0x15aed8[_0xc0ab('0x1a')]=_0x15aed8['condition'][_0xc0ab('0x24')]();_0x15aed8[_0xc0ab('0x25')]=_0x15aed8[_0xc0ab('0x25')][_0xc0ab('0x24')]();return _0x15aed8;});}else if(!_[_0xc0ab('0x2')](_0x205f2e)){_0x205f2e[_0xc0ab('0x1a')]=_0x205f2e[_0xc0ab('0x1a')][_0xc0ab('0x24')]();_0x205f2e[_0xc0ab('0x25')]=_0x205f2e[_0xc0ab('0x25')][_0xc0ab('0x24')]();}return _0x205f2e;};RuleEngine[_0xc0ab('0x6')]['fromJSON']=function(_0x2a3e62){this[_0xc0ab('0x7')]();if(_[_0xc0ab('0x26')](_0x2a3e62)){_0x2a3e62=JSON['parse'](_0x2a3e62);}if(_0x2a3e62 instanceof Array){_0x2a3e62=_0x2a3e62[_0xc0ab('0x23')](function(_0xf7d0d3){_0xf7d0d3[_0xc0ab('0x1a')]=eval('('+_0xf7d0d3['condition']+')');_0xf7d0d3['consequence']=eval('('+_0xf7d0d3[_0xc0ab('0x25')]+')');return _0xf7d0d3;});}else if(_0x2a3e62!==null&&typeof _0x2a3e62==_0xc0ab('0x27')){_0x2a3e62[_0xc0ab('0x1a')]=eval('('+_0x2a3e62[_0xc0ab('0x1a')]+')');_0x2a3e62['consequence']=eval('('+_0x2a3e62[_0xc0ab('0x25')]+')');}this[_0xc0ab('0x3')](_0x2a3e62);};module[_0xc0ab('0x28')]=RuleEngine; \ No newline at end of file +var _0xda4a=['priority','toJSON','map','toString','isString','parse','object','exports','lodash','util','events','EventEmitter','init','ignoreFactChanges','prototype','rules','register','isArray','isObject','push','sync','activeRules','filter','isNil','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','call','next','isEqual','restart','length','condition','matchPath','findRules','matches','turn','prioritize'];(function(_0x3d9ab2,_0x2099c8){var _0x315dc2=function(_0x23747d){while(--_0x23747d){_0x3d9ab2['push'](_0x3d9ab2['shift']());}};_0x315dc2(++_0x2099c8);}(_0xda4a,0x168));var _0xada4=function(_0x57c1d5,_0x1b6c7d){_0x57c1d5=_0x57c1d5-0x0;var _0x2c836c=_0xda4a[_0x57c1d5];return _0x2c836c;};'use strict';var _=require(_0xada4('0x0'));var util=require(_0xada4('0x1'));var EventEmitter=require(_0xada4('0x2'))[_0xada4('0x3')];function RuleEngine(_0x300a53,_0x332103){this[_0xada4('0x4')]();if(!_['isNil'](_0x300a53)){this['register'](_0x300a53);}if(_0x332103){this[_0xada4('0x5')]=_0x332103[_0xada4('0x5')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine[_0xada4('0x6')]['init']=function(_0x49cce8){this[_0xada4('0x7')]=[];this['activeRules']=[];};RuleEngine[_0xada4('0x6')][_0xada4('0x8')]=function(_0x597ba8){if(Array[_0xada4('0x9')](_0x597ba8)){this[_0xada4('0x7')]=this[_0xada4('0x7')]['concat'](_0x597ba8);}else if(_0x597ba8!==null&&_[_0xada4('0xa')](_0x597ba8)){this[_0xada4('0x7')][_0xada4('0xb')](_0x597ba8);}this['sync']();};RuleEngine[_0xada4('0x6')][_0xada4('0xc')]=function(){this[_0xada4('0xd')]=this[_0xada4('0x7')][_0xada4('0xe')](function(_0x7797a6){if(_[_0xada4('0xf')](_0x7797a6['on'])){_0x7797a6['on']=!![];}if(_0x7797a6['on']===!![]){return _0x7797a6;}});this[_0xada4('0xd')]=_[_0xada4('0x10')](this[_0xada4('0xd')],['p'],[_0xada4('0x11')]);};RuleEngine['prototype'][_0xada4('0x12')]=function(_0x4b678d,_0x201374){var _0x2bd5f1=![];_0x4b678d['result']=!![];var _0x13ca30=_[_0xada4('0x13')](_0x4b678d);var _0x425f95=_[_0xada4('0x13')](_0x4b678d);var _0x5070ea=this[_0xada4('0xd')];var _0x5409d9=[];var _0x5d4e1d=this[_0xada4('0x5')];(function FnRuleLoop(_0x278a87){var _0xa62285={'rules':function(){return _0x5070ea;},'rule':function(){return _0x5070ea[_0x278a87];},'when':function(_0x2175f1){if(_0x2175f1){var _0x58355a=_0x5070ea[_0x278a87][_0xada4('0x14')];_0x58355a[_0xada4('0x15')]=_0x5070ea[_0x278a87]['id']||_0x5070ea[_0x278a87][_0xada4('0x16')]||_0xada4('0x17')+_0x278a87;process[_0xada4('0x18')](function(){_0x5409d9[_0xada4('0xb')](_0x58355a[_0xada4('0x15')]);_0x58355a[_0xada4('0x19')](_0x13ca30,_0xa62285);});}else{process[_0xada4('0x18')](function(){_0xa62285[_0xada4('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x2bd5f1=!![];return FnRuleLoop(0x0);},'next':function(_0x3475fe){if(!_0x5d4e1d&&!_[_0xada4('0x1b')](_0x425f95,_0x13ca30)){_0x425f95=_[_0xada4('0x13')](_0x13ca30);process[_0xada4('0x18')](function(){_0xa62285[_0xada4('0x1c')]();});}else{process[_0xada4('0x18')](function(){if(_[_0xada4('0xf')](_0x3475fe)){return FnRuleLoop(_0x278a87+0x1);}else{return FnRuleLoop(_0x3475fe);}});}}};if(_0x278a87<_0x5070ea[_0xada4('0x1d')]&&_0x2bd5f1===![]){var _0x53486b=_0x5070ea[_0x278a87][_0xada4('0x1e')];_0x53486b[_0xada4('0x19')](_0x13ca30,_0xa62285);}else{process[_0xada4('0x18')](function(){_0x13ca30[_0xada4('0x1f')]=_0x5409d9;return _0x201374?_0x201374(_0x13ca30):_['noop']();});}}(0x0));};RuleEngine[_0xada4('0x6')][_0xada4('0x20')]=function(_0x170c8b){if(_['isNil'](_0x170c8b)){return this[_0xada4('0x7')];}else{var _0x4dfe42=_[_0xada4('0x21')](_0x170c8b);return _[_0xada4('0xe')](this['rules'],_0x4dfe42);}};RuleEngine[_0xada4('0x6')][_0xada4('0x22')]=function(_0x582634,_0x33ae59){var _0x1a632d=_0x582634==='on'||_0x582634==='ON'?!![]:![];var _0x241b5b=this[_0xada4('0x20')](_0x33ae59);for(var _0x4ffedd=0x0,_0x49a2e6=_0x241b5b[_0xada4('0x1d')];_0x4ffedd<_0x49a2e6;_0x4ffedd+=0x1){_0x241b5b[_0x4ffedd]['on']=_0x1a632d;}this[_0xada4('0xc')]();};RuleEngine[_0xada4('0x6')][_0xada4('0x23')]=function(_0x5381e6,_0x29eefe){_0x5381e6=parseInt(_0x5381e6,0xa);var _0x28feb8=this[_0xada4('0x20')](_0x29eefe);for(var _0x3c48bb=0x0,_0x476192=_0x28feb8['length'];_0x3c48bb<_0x476192;_0x3c48bb+=0x1){_0x28feb8[_0x3c48bb][_0xada4('0x24')]=_0x5381e6;}this['sync']();};RuleEngine['prototype'][_0xada4('0x25')]=function(){var _0x9ea0a2=this[_0xada4('0x7')];if(_0x9ea0a2 instanceof Array){_0x9ea0a2=_0x9ea0a2[_0xada4('0x26')](function(_0x4f79f4){_0x4f79f4[_0xada4('0x1e')]=_0x4f79f4['condition'][_0xada4('0x27')]();_0x4f79f4[_0xada4('0x14')]=_0x4f79f4[_0xada4('0x14')][_0xada4('0x27')]();return _0x4f79f4;});}else if(!_[_0xada4('0xf')](_0x9ea0a2)){_0x9ea0a2[_0xada4('0x1e')]=_0x9ea0a2[_0xada4('0x1e')][_0xada4('0x27')]();_0x9ea0a2['consequence']=_0x9ea0a2[_0xada4('0x14')]['toString']();}return _0x9ea0a2;};RuleEngine[_0xada4('0x6')]['fromJSON']=function(_0xf51642){this[_0xada4('0x4')]();if(_[_0xada4('0x28')](_0xf51642)){_0xf51642=JSON[_0xada4('0x29')](_0xf51642);}if(_0xf51642 instanceof Array){_0xf51642=_0xf51642['map'](function(_0x12cdfd){_0x12cdfd[_0xada4('0x1e')]=eval('('+_0x12cdfd[_0xada4('0x1e')]+')');_0x12cdfd[_0xada4('0x14')]=eval('('+_0x12cdfd[_0xada4('0x14')]+')');return _0x12cdfd;});}else if(_0xf51642!==null&&typeof _0xf51642==_0xada4('0x2a')){_0xf51642['condition']=eval('('+_0xf51642[_0xada4('0x1e')]+')');_0xf51642[_0xada4('0x14')]=eval('('+_0xf51642[_0xada4('0x14')]+')');}this['register'](_0xf51642);};module[_0xada4('0x2b')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 588c2c5..1232c5c 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(_0x471896,_0x4814aa){var _0x10f06a=function(_0x3f50a0){while(--_0x3f50a0){_0x471896['push'](_0x471896['shift']());}};_0x10f06a(++_0x4814aa);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file +var _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x4d548e,_0x386919){var _0x236737=function(_0x10c1db){while(--_0x10c1db){_0x4d548e['push'](_0x4d548e['shift']());}};_0x236737(++_0x386919);}(_0x814b,0x1a2));var _0xb814=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0x814b[_0x1ee5be];return _0x177140;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index c4dac3d..a79f79d 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 _0xe5b5=['chatCapacity','faxStatus','faxCurrentCapacity','smsStatus','openchannelStatus','busyQueue','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','chat','openchannel','fax','sms','length','StatusTime','toNumber','format','chatStatusTime'];(function(_0x538896,_0x2c894c){var _0xaea97=function(_0x10ef5e){while(--_0x10ef5e){_0x538896['push'](_0x538896['shift']());}};_0xaea97(++_0x2c894c);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0xe5b5[_0x414655];return _0x237884;};'use strict';var _=require(_0x5e5b('0x0'));var moment=require(_0x5e5b('0x1'));var md5=require(_0x5e5b('0x2'));var Redis=require(_0x5e5b('0x3'));var config=require(_0x5e5b('0x4'));config[_0x5e5b('0x5')]=_[_0x5e5b('0x6')](config[_0x5e5b('0x5')],{'host':_0x5e5b('0x7'),'port':0x18eb});var io=require(_0x5e5b('0x8'))(new Redis(config[_0x5e5b('0x5')]));function Agent(_0x40bc5b){this['id']=_0x40bc5b['id']||0x0;this[_0x5e5b('0x9')]=_0x40bc5b[_0x5e5b('0x9')]||'';this[_0x5e5b('0xa')]=_0x40bc5b[_0x5e5b('0xa')]||!![];this[_0x5e5b('0xb')]=_0x40bc5b[_0x5e5b('0xb')]||![];this[_0x5e5b('0xc')]=_0x40bc5b[_0x5e5b('0xc')]||![];this[_0x5e5b('0xd')]=_0x40bc5b[_0x5e5b('0xd')]||![];this[_0x5e5b('0xe')]=_0x40bc5b['faxPause']||![];this[_0x5e5b('0xf')]=_0x40bc5b['smsPause']||![];this[_0x5e5b('0x10')]=_0x40bc5b[_0x5e5b('0x10')]||![];this[_0x5e5b('0x11')]=_0x5e5b('0x12');this['chatStatusTime']=0x0;this['chatCapacity']=_0x40bc5b['chatCapacity']||0x0;this[_0x5e5b('0x13')]=0x0;this[_0x5e5b('0x14')]=_0x5e5b('0x12');this[_0x5e5b('0x15')]=0x0;this[_0x5e5b('0x16')]=_0x40bc5b[_0x5e5b('0x16')]||0x0;this[_0x5e5b('0x17')]=0x0;this['faxStatus']=_0x5e5b('0x12');this[_0x5e5b('0x18')]=0x0;this['faxCapacity']=_0x40bc5b[_0x5e5b('0x19')]||0x0;this['faxCurrentCapacity']=0x0;this['smsStatus']=_0x5e5b('0x12');this[_0x5e5b('0x1a')]=0x0;this[_0x5e5b('0x1b')]=_0x40bc5b['smsCapacity']||0x0;this[_0x5e5b('0x1c')]=0x0;this['openchannelStatus']=_0x5e5b('0x12');this[_0x5e5b('0x1d')]=0x0;this['openchannelCapacity']=_0x40bc5b[_0x5e5b('0x1e')]||0x0;this[_0x5e5b('0x1f')]=0x0;this[_0x5e5b('0x20')]=![];this['busyQueue']=undefined;this[_0x5e5b('0x2')]='';this[_0x5e5b('0x21')]();}Agent['prototype'][_0x5e5b('0x22')]=function(_0x1aa0c2){if(this[_0x1aa0c2+_0x5e5b('0x23')]>0x0){if(this[_0x1aa0c2+_0x5e5b('0x24')]>0x0&&this[_0x1aa0c2+_0x5e5b('0x23')]>=this[_0x1aa0c2+_0x5e5b('0x24')]){return _0x5e5b('0x25');}else{return _0x5e5b('0x26');}}else{return'idle';}};Agent['prototype'][_0x5e5b('0x21')]=function(){var _0x3326fb=[_0x5e5b('0x27'),_0x5e5b('0x28'),_0x5e5b('0x29'),_0x5e5b('0x2a'),_0x5e5b('0x2b')];for(var _0x18903e=0x0;_0x18903e<_0x3326fb[_0x5e5b('0x2c')];_0x18903e+=0x1){var _0x26bc02=this[_0x5e5b('0x22')](_0x3326fb[_0x18903e]);if(this[_0x3326fb[_0x18903e]+'Status']!==_0x26bc02){this[_0x3326fb[_0x18903e]+_0x5e5b('0x2d')]=_[_0x5e5b('0x2e')](moment()[_0x5e5b('0x2f')]('x'));}this[_0x3326fb[_0x18903e]+'Status']=_0x26bc02;}var _0x988e5d={'id':this['id'],'name':this[_0x5e5b('0x9')],'online':this['online'],'voicePause':this[_0x5e5b('0xb')],'chatPause':this[_0x5e5b('0xc')],'mailPause':this[_0x5e5b('0xd')],'smsPause':this[_0x5e5b('0xf')],'faxPause':this[_0x5e5b('0xe')],'openchannelPause':this[_0x5e5b('0x10')],'chatStatus':this[_0x5e5b('0x11')],'chatStatusTime':this[_0x5e5b('0x30')],'chatCapacity':this[_0x5e5b('0x31')],'chatCurrentCapacity':this[_0x5e5b('0x13')],'mailStatus':this[_0x5e5b('0x14')],'mailStatusTime':this[_0x5e5b('0x15')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x5e5b('0x32')],'faxStatusTime':this[_0x5e5b('0x18')],'faxCapacity':this[_0x5e5b('0x19')],'faxCurrentCapacity':this[_0x5e5b('0x33')],'smsStatus':this[_0x5e5b('0x34')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x5e5b('0x1b')],'smsCurrentCapacity':this['smsCurrentCapacity'],'openchannelStatus':this[_0x5e5b('0x35')],'openchannelStatusTime':this[_0x5e5b('0x1d')],'openchannelCapacity':this[_0x5e5b('0x1e')],'openchannelCurrentCapacity':this[_0x5e5b('0x1f')],'busy':this['busy'],'busyQueue':this[_0x5e5b('0x36')]};var _0x1bc636=md5(JSON['stringify'](_0x988e5d));if(this[_0x5e5b('0x2')]!==_0x1bc636){this[_0x5e5b('0x2')]=_0x1bc636;io[_0x5e5b('0x37')](_0x5e5b('0x38'),_0x988e5d);}};module[_0x5e5b('0x39')]=Agent; \ No newline at end of file +var _0xa902=['openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','openchannel','fax','length','Status','StatusTime','toNumber','format','chatCurrentCapacity','faxStatus','openchannelStatusTime','busy','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','../../../config/environment','defaults','socket.io-emitter','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','unknown','smsStatusTime','smsCapacity','smsCurrentCapacity'];(function(_0x4b688f,_0x4c60e6){var _0x5cfad2=function(_0x582e2b){while(--_0x582e2b){_0x4b688f['push'](_0x4b688f['shift']());}};_0x5cfad2(++_0x4c60e6);}(_0xa902,0x8d));var _0x2a90=function(_0x1fe0f6,_0x51a999){_0x1fe0f6=_0x1fe0f6-0x0;var _0x4ffa1e=_0xa902[_0x1fe0f6];return _0x4ffa1e;};'use strict';var _=require(_0x2a90('0x0'));var moment=require(_0x2a90('0x1'));var md5=require(_0x2a90('0x2'));var Redis=require(_0x2a90('0x3'));var config=require(_0x2a90('0x4'));config['redis']=_[_0x2a90('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2a90('0x6'))(new Redis(config[_0x2a90('0x7')]));function Agent(_0x203ecf){this['id']=_0x203ecf['id']||0x0;this[_0x2a90('0x8')]=_0x203ecf[_0x2a90('0x8')]||'';this[_0x2a90('0x9')]=_0x203ecf['online']||!![];this[_0x2a90('0xa')]=_0x203ecf['voicePause']||![];this['chatPause']=_0x203ecf[_0x2a90('0xb')]||![];this[_0x2a90('0xc')]=_0x203ecf[_0x2a90('0xc')]||![];this[_0x2a90('0xd')]=_0x203ecf[_0x2a90('0xd')]||![];this['smsPause']=_0x203ecf[_0x2a90('0xe')]||![];this[_0x2a90('0xf')]=_0x203ecf[_0x2a90('0xf')]||![];this[_0x2a90('0x10')]='unknown';this[_0x2a90('0x11')]=0x0;this['chatCapacity']=_0x203ecf[_0x2a90('0x12')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x2a90('0x13')]='unknown';this[_0x2a90('0x14')]=0x0;this[_0x2a90('0x15')]=_0x203ecf[_0x2a90('0x15')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']='unknown';this[_0x2a90('0x16')]=0x0;this[_0x2a90('0x17')]=_0x203ecf['faxCapacity']||0x0;this[_0x2a90('0x18')]=0x0;this[_0x2a90('0x19')]=_0x2a90('0x1a');this[_0x2a90('0x1b')]=0x0;this[_0x2a90('0x1c')]=_0x203ecf[_0x2a90('0x1c')]||0x0;this[_0x2a90('0x1d')]=0x0;this[_0x2a90('0x1e')]=_0x2a90('0x1a');this['openchannelStatusTime']=0x0;this[_0x2a90('0x1f')]=_0x203ecf[_0x2a90('0x1f')]||0x0;this[_0x2a90('0x20')]=0x0;this['busy']=![];this[_0x2a90('0x21')]=undefined;this[_0x2a90('0x2')]='';this[_0x2a90('0x22')]();}Agent[_0x2a90('0x23')][_0x2a90('0x24')]=function(_0x23d227){if(this[_0x23d227+_0x2a90('0x25')]>0x0){if(this[_0x23d227+_0x2a90('0x26')]>0x0&&this[_0x23d227+_0x2a90('0x25')]>=this[_0x23d227+_0x2a90('0x26')]){return _0x2a90('0x27');}else{return _0x2a90('0x28');}}else{return'idle';}};Agent[_0x2a90('0x23')][_0x2a90('0x22')]=function(){var _0x2955a9=[_0x2a90('0x29'),'chat',_0x2a90('0x2a'),_0x2a90('0x2b'),'sms'];for(var _0x1bcfd7=0x0;_0x1bcfd7<_0x2955a9[_0x2a90('0x2c')];_0x1bcfd7+=0x1){var _0x10a6dd=this[_0x2a90('0x24')](_0x2955a9[_0x1bcfd7]);if(this[_0x2955a9[_0x1bcfd7]+_0x2a90('0x2d')]!==_0x10a6dd){this[_0x2955a9[_0x1bcfd7]+_0x2a90('0x2e')]=_[_0x2a90('0x2f')](moment()[_0x2a90('0x30')]('x'));}this[_0x2955a9[_0x1bcfd7]+'Status']=_0x10a6dd;}var _0x27f883={'id':this['id'],'name':this[_0x2a90('0x8')],'online':this[_0x2a90('0x9')],'voicePause':this[_0x2a90('0xa')],'chatPause':this[_0x2a90('0xb')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x2a90('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x2a90('0x12')],'chatCurrentCapacity':this[_0x2a90('0x31')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x2a90('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x2a90('0x32')],'faxStatusTime':this[_0x2a90('0x16')],'faxCapacity':this[_0x2a90('0x17')],'faxCurrentCapacity':this[_0x2a90('0x18')],'smsStatus':this[_0x2a90('0x19')],'smsStatusTime':this[_0x2a90('0x1b')],'smsCapacity':this[_0x2a90('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'openchannelStatus':this[_0x2a90('0x1e')],'openchannelStatusTime':this[_0x2a90('0x33')],'openchannelCapacity':this[_0x2a90('0x1f')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x2a90('0x34')],'busyQueue':this[_0x2a90('0x21')]};var _0xfbb545=md5(JSON[_0x2a90('0x35')](_0x27f883));if(this['md5']!==_0xfbb545){this[_0x2a90('0x2')]=_0xfbb545;io[_0x2a90('0x36')](_0x2a90('0x37'),_0x27f883);}};module[_0x2a90('0x38')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 020499d..7099736 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 _0x64b8=['../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','available','stringify','md5','format','emit','chat_queue:save','lodash','util'];(function(_0x52b3f7,_0x525fb9){var _0x26cc67=function(_0x38036e){while(--_0x38036e){_0x52b3f7['push'](_0x52b3f7['shift']());}};_0x26cc67(++_0x525fb9);}(_0x64b8,0xdf));var _0x864b=function(_0x384b6e,_0x48d32e){_0x384b6e=_0x384b6e-0x0;var _0x4bc090=_0x64b8[_0x384b6e];return _0x4bc090;};'use strict';var _=require(_0x864b('0x0'));var md5=require('md5');var util=require(_0x864b('0x1'));var Redis=require('ioredis');var config=require(_0x864b('0x2'));config['redis']=_['defaults'](config[_0x864b('0x3')],{'host':_0x864b('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x864b('0x3')]));function ChatQueue(_0x15c4ce){this['id']=_0x15c4ce['id']||0x0;this[_0x864b('0x5')]=_0x15c4ce[_0x864b('0x5')]||'';this[_0x864b('0x6')]=_0x15c4ce[_0x864b('0x6')]||0xa;this['strategy']=_0x15c4ce[_0x864b('0x7')]||_0x864b('0x8');this['Agents']=_0x15c4ce[_0x864b('0x9')];this[_0x864b('0xa')]={};this[_0x864b('0xb')]=0x0;this['md5']='';this[_0x864b('0xc')]();this[_0x864b('0xd')]();}ChatQueue[_0x864b('0xe')][_0x864b('0xc')]=function(){var _0xdd8002=this['mapAgentsId'][_0x864b('0xf')];this[_0x864b('0xa')]=_[_0x864b('0x10')](this[_0x864b('0x9')],'id');this[_0x864b('0xa')]['_rr']=_0xdd8002;};ChatQueue[_0x864b('0xe')][_0x864b('0xd')]=function(){this[_0x864b('0x11')]=0x0;this[_0x864b('0x12')]=0x0;for(var _0x49003e=0x0;_0x49003e=0x0?this[_0x864b('0x13')]:0x0;var _0x2f92bc={'id':this['id'],'available':this['available'],'loggedIn':this[_0x864b('0x11')],'name':this['name'],'paused':this[_0x864b('0x12')],'waiting':this[_0x864b('0xb')]};var _0x19b760=md5(JSON[_0x864b('0x14')](_0x2f92bc));if(this[_0x864b('0x15')]!==_0x19b760){this[_0x864b('0x15')]=_0x19b760;io['to'](util[_0x864b('0x16')]('chat:queue:%s',_0x2f92bc[_0x864b('0x5')]))[_0x864b('0x17')](_0x864b('0x18'),_0x2f92bc);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x9f70=['beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','updateRealtime','loggedIn','length','online','chatPause','available','paused','format','emit','chat_queue:save','exports','md5','../../../config/environment','defaults','redis','localhost','name','timeout','strategy'];(function(_0x16e009,_0x2f3265){var _0x4aee81=function(_0x4dd271){while(--_0x4dd271){_0x16e009['push'](_0x16e009['shift']());}};_0x4aee81(++_0x2f3265);}(_0x9f70,0x7a));var _0x09f7=function(_0x311d03,_0x346bf1){_0x311d03=_0x311d03-0x0;var _0x2c932b=_0x9f70[_0x311d03];return _0x2c932b;};'use strict';var _=require('lodash');var md5=require(_0x09f7('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0x09f7('0x1'));config['redis']=_[_0x09f7('0x2')](config[_0x09f7('0x3')],{'host':_0x09f7('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x09f7('0x3')]));function ChatQueue(_0x1f0bd1){this['id']=_0x1f0bd1['id']||0x0;this[_0x09f7('0x5')]=_0x1f0bd1[_0x09f7('0x5')]||'';this['timeout']=_0x1f0bd1[_0x09f7('0x6')]||0xa;this['strategy']=_0x1f0bd1[_0x09f7('0x7')]||_0x09f7('0x8');this[_0x09f7('0x9')]=_0x1f0bd1[_0x09f7('0x9')];this[_0x09f7('0xa')]={};this[_0x09f7('0xb')]=0x0;this[_0x09f7('0x0')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0x09f7('0xc')][_0x09f7('0xd')]=function(){var _0x26983e=this['mapAgentsId'][_0x09f7('0xe')];this[_0x09f7('0xa')]=_['map'](this[_0x09f7('0x9')],'id');this[_0x09f7('0xa')][_0x09f7('0xe')]=_0x26983e;};ChatQueue[_0x09f7('0xc')][_0x09f7('0xf')]=function(){this[_0x09f7('0x10')]=0x0;this['paused']=0x0;for(var _0x14841a=0x0;_0x14841a=0x0?this[_0x09f7('0x14')]:0x0;var _0x48bdd6={'id':this['id'],'available':this[_0x09f7('0x14')],'loggedIn':this[_0x09f7('0x10')],'name':this[_0x09f7('0x5')],'paused':this[_0x09f7('0x15')],'waiting':this[_0x09f7('0xb')]};var _0x2be969=md5(JSON['stringify'](_0x48bdd6));if(this[_0x09f7('0x0')]!==_0x2be969){this[_0x09f7('0x0')]=_0x2be969;io['to'](util[_0x09f7('0x16')]('chat:queue:%s',_0x48bdd6[_0x09f7('0x5')]))[_0x09f7('0x17')](_0x09f7('0x18'),_0x48bdd6);}};module[_0x09f7('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 3058c9b..b5fbf15 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(_0xcd1de6,_0x3b5a86){var _0x58d88f=function(_0x4f3900){while(--_0x4f3900){_0xcd1de6['push'](_0xcd1de6['shift']());}};_0x58d88f(++_0x3b5a86);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x51fb56,_0x1323c3){var _0x56677d=function(_0x3973be){while(--_0x3973be){_0x51fb56['push'](_0x51fb56['shift']());}};_0x56677d(++_0x1323c3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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 d491c52..e7ada00 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 _0xe5ee=['name','Intervals','exports'];(function(_0x416b52,_0xb58e1){var _0x4f1333=function(_0x3bcc45){while(--_0x3bcc45){_0x416b52['push'](_0x416b52['shift']());}};_0x4f1333(++_0xb58e1);}(_0xe5ee,0xd8));var _0xee5e=function(_0x3dda99,_0x32849e){_0x3dda99=_0x3dda99-0x0;var _0x15b290=_0xe5ee[_0x3dda99];return _0x15b290;};'use strict';function Interval(_0x1a6b55){this['id']=_0x1a6b55['id']||0x0;this[_0xee5e('0x0')]=_0x1a6b55['name']||'';this['Intervals']=_0x1a6b55[_0xee5e('0x1')]||{};}module[_0xee5e('0x2')]=Interval; \ No newline at end of file +var _0xe24a=['Intervals','name'];(function(_0x2cde93,_0x2e61cf){var _0x3c50a0=function(_0x3c38cb){while(--_0x3c38cb){_0x2cde93['push'](_0x2cde93['shift']());}};_0x3c50a0(++_0x2e61cf);}(_0xe24a,0x151));var _0xae24=function(_0x44bb3c,_0x3bfb4b){_0x44bb3c=_0x44bb3c-0x0;var _0x541354=_0xe24a[_0x44bb3c];return _0x541354;};'use strict';function Interval(_0x57aff8){this['id']=_0x57aff8['id']||0x0;this[_0xae24('0x0')]=_0x57aff8[_0xae24('0x0')]||'';this[_0xae24('0x1')]=_0x57aff8['Intervals']||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index a661960..de03de6 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 _0xf064=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','online','mailPause','available','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','localhost'];(function(_0x99829d,_0x56a963){var _0x4fa089=function(_0x3f34f5){while(--_0x3f34f5){_0x99829d['push'](_0x99829d['shift']());}};_0x4fa089(++_0x56a963);}(_0xf064,0xcc));var _0x4f06=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0xf064[_0x3e182f];return _0x23edc9;};'use strict';var _=require(_0x4f06('0x0'));var md5=require(_0x4f06('0x1'));var util=require(_0x4f06('0x2'));var Redis=require('ioredis');var config=require(_0x4f06('0x3'));config[_0x4f06('0x4')]=_['defaults'](config['redis'],{'host':_0x4f06('0x5'),'port':0x18eb});var io=require(_0x4f06('0x6'))(new Redis(config['redis']));function MailQueue(_0x25fb96){this['id']=_0x25fb96['id']||0x0;this[_0x4f06('0x7')]=_0x25fb96[_0x4f06('0x7')]||'';this[_0x4f06('0x8')]=_0x25fb96[_0x4f06('0x8')]||0xa;this['strategy']=_0x25fb96[_0x4f06('0x9')]||_0x4f06('0xa');this[_0x4f06('0xb')]=_0x25fb96[_0x4f06('0xb')];this[_0x4f06('0xc')]={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x4f06('0xd')]();}MailQueue[_0x4f06('0xe')][_0x4f06('0xf')]=function(){var _0xbccaa2=this[_0x4f06('0xc')][_0x4f06('0x10')];this[_0x4f06('0xc')]=_[_0x4f06('0x11')](this['Agents'],'id');this[_0x4f06('0xc')]['_rr']=_0xbccaa2;};MailQueue['prototype'][_0x4f06('0xd')]=function(){this[_0x4f06('0x12')]=0x0;this[_0x4f06('0x13')]=0x0;for(var _0x22cccc=0x0;_0x22cccc=0x0?this[_0x4f06('0x16')]:0x0;var _0x4ecca7={'id':this['id'],'available':this[_0x4f06('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x4f06('0x7')],'paused':this[_0x4f06('0x13')],'waiting':this[_0x4f06('0x17')]};var _0x499471=md5(JSON[_0x4f06('0x18')](_0x4ecca7));if(this['md5']!==_0x499471){this[_0x4f06('0x1')]=_0x499471;io['to'](util[_0x4f06('0x19')](_0x4f06('0x1a'),_0x4ecca7[_0x4f06('0x7')]))[_0x4f06('0x1b')](_0x4f06('0x1c'),_0x4ecca7);}};module[_0x4f06('0x1d')]=MailQueue; \ No newline at end of file +var _0xdd10=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','mailPause','paused','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5'];(function(_0x38d57a,_0xb3a46c){var _0x2eb3c5=function(_0x2e5e81){while(--_0x2e5e81){_0x38d57a['push'](_0x38d57a['shift']());}};_0x2eb3c5(++_0xb3a46c);}(_0xdd10,0x7e));var _0x0dd1=function(_0x54517f,_0x587e0c){_0x54517f=_0x54517f-0x0;var _0x72d745=_0xdd10[_0x54517f];return _0x72d745;};'use strict';var _=require(_0x0dd1('0x0'));var md5=require(_0x0dd1('0x1'));var util=require(_0x0dd1('0x2'));var Redis=require(_0x0dd1('0x3'));var config=require(_0x0dd1('0x4'));config[_0x0dd1('0x5')]=_[_0x0dd1('0x6')](config[_0x0dd1('0x5')],{'host':_0x0dd1('0x7'),'port':0x18eb});var io=require(_0x0dd1('0x8'))(new Redis(config[_0x0dd1('0x5')]));function MailQueue(_0x5e4c7e){this['id']=_0x5e4c7e['id']||0x0;this[_0x0dd1('0x9')]=_0x5e4c7e[_0x0dd1('0x9')]||'';this['timeout']=_0x5e4c7e[_0x0dd1('0xa')]||0xa;this[_0x0dd1('0xb')]=_0x5e4c7e[_0x0dd1('0xb')]||_0x0dd1('0xc');this['Agents']=_0x5e4c7e[_0x0dd1('0xd')];this[_0x0dd1('0xe')]={};this[_0x0dd1('0xf')]=0x0;this[_0x0dd1('0x1')]='';this[_0x0dd1('0x10')]();this[_0x0dd1('0x11')]();}MailQueue[_0x0dd1('0x12')][_0x0dd1('0x10')]=function(){var _0x1412ec=this[_0x0dd1('0xe')][_0x0dd1('0x13')];this[_0x0dd1('0xe')]=_[_0x0dd1('0x14')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x1412ec;};MailQueue['prototype'][_0x0dd1('0x11')]=function(){this[_0x0dd1('0x15')]=0x0;this['paused']=0x0;for(var _0x3c3b81=0x0;_0x3c3b81=0x0?this['available']:0x0;var _0x14f1ec={'id':this['id'],'available':this[_0x0dd1('0x1a')],'loggedIn':this['loggedIn'],'name':this[_0x0dd1('0x9')],'paused':this[_0x0dd1('0x19')],'waiting':this[_0x0dd1('0xf')]};var _0x419ed5=md5(JSON['stringify'](_0x14f1ec));if(this[_0x0dd1('0x1')]!==_0x419ed5){this[_0x0dd1('0x1')]=_0x419ed5;io['to'](util[_0x0dd1('0x1b')](_0x0dd1('0x1c'),_0x14f1ec[_0x0dd1('0x9')]))[_0x0dd1('0x1d')](_0x0dd1('0x1e'),_0x14f1ec);}};module[_0x0dd1('0x1f')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index d61249c..a152287 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 _0x8fc1=['updateRealtime','_rr','map','prototype','paused','length','online','openchannelPause','available','loggedIn','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x288cf4,_0x2dad12){var _0x38f2d1=function(_0x1d53bd){while(--_0x1d53bd){_0x288cf4['push'](_0x288cf4['shift']());}};_0x38f2d1(++_0x2dad12);}(_0x8fc1,0xef));var _0x18fc=function(_0x3160fd,_0x1249f1){_0x3160fd=_0x3160fd-0x0;var _0x381ffe=_0x8fc1[_0x3160fd];return _0x381ffe;};'use strict';var _=require(_0x18fc('0x0'));var md5=require(_0x18fc('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x18fc('0x2'));config[_0x18fc('0x3')]=_['defaults'](config[_0x18fc('0x3')],{'host':_0x18fc('0x4'),'port':0x18eb});var io=require(_0x18fc('0x5'))(new Redis(config[_0x18fc('0x3')]));function OpenchannelQueue(_0x32bd09){this['id']=_0x32bd09['id']||0x0;this[_0x18fc('0x6')]=_0x32bd09['name']||'';this[_0x18fc('0x7')]=_0x32bd09[_0x18fc('0x7')]||0xa;this[_0x18fc('0x8')]=_0x32bd09[_0x18fc('0x8')]||_0x18fc('0x9');this['Agents']=_0x32bd09[_0x18fc('0xa')];this[_0x18fc('0xb')]={};this[_0x18fc('0xc')]=0x0;this[_0x18fc('0x1')]='';this['updateRouting']();this[_0x18fc('0xd')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0x8bafef=this[_0x18fc('0xb')][_0x18fc('0xe')];this[_0x18fc('0xb')]=_[_0x18fc('0xf')](this[_0x18fc('0xa')],'id');this[_0x18fc('0xb')][_0x18fc('0xe')]=_0x8bafef;};OpenchannelQueue[_0x18fc('0x10')][_0x18fc('0xd')]=function(){this['loggedIn']=0x0;this[_0x18fc('0x11')]=0x0;for(var _0x4548ba=0x0;_0x4548ba=0x0?this[_0x18fc('0x15')]:0x0;var _0x442415={'id':this['id'],'available':this[_0x18fc('0x15')],'loggedIn':this[_0x18fc('0x16')],'name':this[_0x18fc('0x6')],'paused':this[_0x18fc('0x11')],'waiting':this[_0x18fc('0xc')]};var _0xc30a2a=md5(JSON[_0x18fc('0x17')](_0x442415));if(this['md5']!==_0xc30a2a){this[_0x18fc('0x1')]=_0xc30a2a;io['to'](util[_0x18fc('0x18')](_0x18fc('0x19'),_0x442415[_0x18fc('0x6')]))[_0x18fc('0x1a')](_0x18fc('0x1b'),_0x442415);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0xc15c=['openchannel_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','paused','length','online','loggedIn','openchannelPause','available','waiting','openchannel:queue:%s','emit'];(function(_0x4ac39c,_0x423047){var _0x20154e=function(_0x49e390){while(--_0x49e390){_0x4ac39c['push'](_0x4ac39c['shift']());}};_0x20154e(++_0x423047);}(_0xc15c,0xb0));var _0xcc15=function(_0x1bf281,_0x25e967){_0x1bf281=_0x1bf281-0x0;var _0x249f63=_0xc15c[_0x1bf281];return _0x249f63;};'use strict';var _=require(_0xcc15('0x0'));var md5=require(_0xcc15('0x1'));var util=require(_0xcc15('0x2'));var Redis=require('ioredis');var config=require(_0xcc15('0x3'));config[_0xcc15('0x4')]=_[_0xcc15('0x5')](config[_0xcc15('0x4')],{'host':_0xcc15('0x6'),'port':0x18eb});var io=require(_0xcc15('0x7'))(new Redis(config[_0xcc15('0x4')]));function OpenchannelQueue(_0x2950f7){this['id']=_0x2950f7['id']||0x0;this[_0xcc15('0x8')]=_0x2950f7[_0xcc15('0x8')]||'';this[_0xcc15('0x9')]=_0x2950f7[_0xcc15('0x9')]||0xa;this[_0xcc15('0xa')]=_0x2950f7[_0xcc15('0xa')]||_0xcc15('0xb');this[_0xcc15('0xc')]=_0x2950f7[_0xcc15('0xc')];this[_0xcc15('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0xcc15('0xe')]();this[_0xcc15('0xf')]();}OpenchannelQueue['prototype'][_0xcc15('0xe')]=function(){var _0x1e1e76=this['mapAgentsId']['_rr'];this[_0xcc15('0xd')]=_[_0xcc15('0x10')](this[_0xcc15('0xc')],'id');this['mapAgentsId'][_0xcc15('0x11')]=_0x1e1e76;};OpenchannelQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xcc15('0x12')]=0x0;for(var _0x81bef3=0x0;_0x81bef3=0x0?this[_0xcc15('0x17')]:0x0;var _0x1bfa39={'id':this['id'],'available':this[_0xcc15('0x17')],'loggedIn':this[_0xcc15('0x15')],'name':this[_0xcc15('0x8')],'paused':this['paused'],'waiting':this[_0xcc15('0x18')]};var _0x2b92e3=md5(JSON['stringify'](_0x1bfa39));if(this['md5']!==_0x2b92e3){this[_0xcc15('0x1')]=_0x2b92e3;io['to'](util['format'](_0xcc15('0x19'),_0x1bfa39[_0xcc15('0x8')]))[_0xcc15('0x1a')](_0xcc15('0x1b'),_0x1bfa39);}};module[_0xcc15('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 79884f4..05d84c0 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 _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x4b0211,_0x17f347){var _0x1906fc=function(_0x9e2459){while(--_0x9e2459){_0x4b0211['push'](_0x4b0211['shift']());}};_0x1906fc(++_0x17f347);}(_0xe706,0xa3));var _0x6e70=function(_0x49fa98,_0x11accf){_0x49fa98=_0x49fa98-0x0;var _0x1698f1=_0xe706[_0x49fa98];return _0x1698f1;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file +var _0xe706=['prototype','_rr','map','online','loggedIn','smsPause','available','paused','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x465e1c,_0xdff365){var _0xb35dda=function(_0x496535){while(--_0x496535){_0x465e1c['push'](_0x465e1c['shift']());}};_0xb35dda(++_0xdff365);}(_0xe706,0xa3));var _0x6e70=function(_0x12b830,_0xd66540){_0x12b830=_0x12b830-0x0;var _0x261dc4=_0xe706[_0x12b830];return _0x261dc4;};'use strict';var _=require(_0x6e70('0x0'));var md5=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var Redis=require('ioredis');var config=require(_0x6e70('0x3'));config[_0x6e70('0x4')]=_[_0x6e70('0x5')](config[_0x6e70('0x4')],{'host':_0x6e70('0x6'),'port':0x18eb});var io=require(_0x6e70('0x7'))(new Redis(config[_0x6e70('0x4')]));function SmsQueue(_0x506db9){this['id']=_0x506db9['id']||0x0;this[_0x6e70('0x8')]=_0x506db9[_0x6e70('0x8')]||'';this[_0x6e70('0x9')]=_0x506db9[_0x6e70('0x9')]||0xa;this[_0x6e70('0xa')]=_0x506db9[_0x6e70('0xa')]||_0x6e70('0xb');this[_0x6e70('0xc')]=_0x506db9[_0x6e70('0xc')];this[_0x6e70('0xd')]={};this[_0x6e70('0xe')]=0x0;this[_0x6e70('0x1')]='';this[_0x6e70('0xf')]();this[_0x6e70('0x10')]();}SmsQueue[_0x6e70('0x11')][_0x6e70('0xf')]=function(){var _0x5b3d07=this['mapAgentsId'][_0x6e70('0x12')];this[_0x6e70('0xd')]=_[_0x6e70('0x13')](this[_0x6e70('0xc')],'id');this[_0x6e70('0xd')][_0x6e70('0x12')]=_0x5b3d07;};SmsQueue[_0x6e70('0x11')][_0x6e70('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x48bc72=0x0;_0x48bc72=0x0?this['available']:0x0;var _0x28a21f={'id':this['id'],'available':this[_0x6e70('0x17')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x6e70('0x18')],'waiting':this[_0x6e70('0xe')]};var _0x2368eb=md5(JSON[_0x6e70('0x19')](_0x28a21f));if(this[_0x6e70('0x1')]!==_0x2368eb){this[_0x6e70('0x1')]=_0x2368eb;io['to'](util[_0x6e70('0x1a')](_0x6e70('0x1b'),_0x28a21f[_0x6e70('0x8')]))[_0x6e70('0x1c')]('sms_queue:save',_0x28a21f);}};module[_0x6e70('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 8fa0e5e..d5f0c79 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 _0x360a=['loggedIn','waiting','stringify','format','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','md5','updateRouting','updateRealtime','mapAgentsId','_rr','prototype','paused','online','available'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x360a,0x6d));var _0xa360=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x360a[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xa360('0x0'));var md5=require('md5');var util=require(_0xa360('0x1'));var Redis=require(_0xa360('0x2'));var config=require('../../../config/environment');config[_0xa360('0x3')]=_[_0xa360('0x4')](config['redis'],{'host':_0xa360('0x5'),'port':0x18eb});var io=require(_0xa360('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0x5a418e){this['id']=_0x5a418e['id']||0x0;this[_0xa360('0x7')]=_0x5a418e[_0xa360('0x7')]||'';this[_0xa360('0x8')]=_0x5a418e[_0xa360('0x8')]||0xa;this[_0xa360('0x9')]=_0x5a418e[_0xa360('0x9')]||_0xa360('0xa');this[_0xa360('0xb')]=_0x5a418e[_0xa360('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xa360('0xc')]='';this[_0xa360('0xd')]();this[_0xa360('0xe')]();}WhatsappQueue['prototype'][_0xa360('0xd')]=function(){var _0x3fd56c=this[_0xa360('0xf')]['_rr'];this[_0xa360('0xf')]=_['map'](this[_0xa360('0xb')],'id');this[_0xa360('0xf')][_0xa360('0x10')]=_0x3fd56c;};WhatsappQueue[_0xa360('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0xa360('0x12')]=0x0;for(var _0x40f15f=0x0;_0x40f15f=0x0?this['available']:0x0;var _0x259725={'id':this['id'],'available':this['available'],'loggedIn':this[_0xa360('0x15')],'name':this['name'],'paused':this[_0xa360('0x12')],'waiting':this[_0xa360('0x16')]};var _0x31fa99=md5(JSON[_0xa360('0x17')](_0x259725));if(this[_0xa360('0xc')]!==_0x31fa99){this['md5']=_0x31fa99;io['to'](util[_0xa360('0x18')]('whatsapp:queue:%s',_0x259725[_0xa360('0x7')]))['emit']('whatsapp_queue:save',_0x259725);}};module[_0xa360('0x19')]=WhatsappQueue; \ No newline at end of file +var _0x3576=['exports','md5','util','ioredis','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save'];(function(_0x5a42c2,_0x1b39f4){var _0x54ff4f=function(_0x3f9657){while(--_0x3f9657){_0x5a42c2['push'](_0x5a42c2['shift']());}};_0x54ff4f(++_0x1b39f4);}(_0x3576,0xe9));var _0x6357=function(_0x12d283,_0x4166aa){_0x12d283=_0x12d283-0x0;var _0x3b4321=_0x3576[_0x12d283];return _0x3b4321;};'use strict';var _=require('lodash');var md5=require(_0x6357('0x0'));var util=require(_0x6357('0x1'));var Redis=require(_0x6357('0x2'));var config=require(_0x6357('0x3'));config['redis']=_[_0x6357('0x4')](config[_0x6357('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x6357('0x6'))(new Redis(config['redis']));function WhatsappQueue(_0xeafaa7){this['id']=_0xeafaa7['id']||0x0;this[_0x6357('0x7')]=_0xeafaa7[_0x6357('0x7')]||'';this[_0x6357('0x8')]=_0xeafaa7[_0x6357('0x8')]||0xa;this[_0x6357('0x9')]=_0xeafaa7[_0x6357('0x9')]||'beepall';this['Agents']=_0xeafaa7[_0x6357('0xa')];this[_0x6357('0xb')]={};this[_0x6357('0xc')]=0x0;this[_0x6357('0x0')]='';this['updateRouting']();this[_0x6357('0xd')]();}WhatsappQueue[_0x6357('0xe')][_0x6357('0xf')]=function(){var _0x1b115d=this[_0x6357('0xb')][_0x6357('0x10')];this[_0x6357('0xb')]=_[_0x6357('0x11')](this[_0x6357('0xa')],'id');this['mapAgentsId'][_0x6357('0x10')]=_0x1b115d;};WhatsappQueue['prototype'][_0x6357('0xd')]=function(){this[_0x6357('0x12')]=0x0;this[_0x6357('0x13')]=0x0;for(var _0x579321=0x0;_0x579321=0x0?this[_0x6357('0x16')]:0x0;var _0x53f5df={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x6357('0x7')],'paused':this[_0x6357('0x13')],'waiting':this[_0x6357('0xc')]};var _0x21c248=md5(JSON[_0x6357('0x17')](_0x53f5df));if(this[_0x6357('0x0')]!==_0x21c248){this[_0x6357('0x0')]=_0x21c248;io['to'](util[_0x6357('0x18')](_0x6357('0x19'),_0x53f5df[_0x6357('0x7')]))[_0x6357('0x1a')](_0x6357('0x1b'),_0x53f5df);}};module[_0x6357('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 19c0347..40413a0 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 _0x1e3f=['initSmsQueues','smsQueues','initMailQueues','initFaxQueues','exports','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues'];(function(_0x59f0e9,_0x5d57f2){var _0x2554bc=function(_0x2237b9){while(--_0x2237b9){_0x59f0e9['push'](_0x59f0e9['shift']());}};_0x2554bc(++_0x5d57f2);}(_0x1e3f,0x1e5));var _0xf1e3=function(_0x4d45c1,_0x2beda1){_0x4d45c1=_0x4d45c1-0x0;var _0x244478=_0x1e3f[_0x4d45c1];return _0x244478;};'use strict';var BPromise=require(_0xf1e3('0x0'));var util=require('util');var _=require(_0xf1e3('0x1'));var moment=require(_0xf1e3('0x2'));var Agent=require(_0xf1e3('0x3'));var Interval=require(_0xf1e3('0x4'));var OpenchannelQueue=require(_0xf1e3('0x5'));var ChatQueue=require(_0xf1e3('0x6'));var SmsQueue=require(_0xf1e3('0x7'));var MailQueue=require('../model/mailQueue');var FaxQueue=require('../model/faxQueue');var Realtime=function(){this['agents']={};this[_0xf1e3('0x8')]={};this[_0xf1e3('0x9')]={};this[_0xf1e3('0xa')]={};this['smsQueues']={};this[_0xf1e3('0xb')]={};this[_0xf1e3('0xc')]={};this[_0xf1e3('0xd')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this['smsQueuesWaitingInteractions']={};this['faxQueuesWaitingInteractions']={};};function freeIsNotKey(_0xd999f4,_0x1b049e,_0x274ac7){var _0x50f559=_[_0xf1e3('0xe')](_0xd999f4,function(_0x159172,_0x58e4f1){return _0x159172[_0x274ac7];});for(var _0x2828fb in _0x1b049e){if(_0x1b049e[_0xf1e3('0xf')](_0x2828fb)){if(!_0x50f559[_0x2828fb]){delete _0x1b049e[_0x2828fb];}}}}Realtime[_0xf1e3('0x10')][_0xf1e3('0x11')]=function(_0x132eae,_0x5195ad){for(var _0x29d655 in _0x5195ad){if(_0x132eae[_0xf1e3('0xf')](_0x29d655)){_0x132eae[_0x29d655]=_0x5195ad[_0x29d655];}}};Realtime[_0xf1e3('0x10')][_0xf1e3('0x12')]=function(){var _0x99b1ab=this;return function(_0x4862b7){if(_0x4862b7){freeIsNotKey(_0x4862b7,_0x99b1ab[_0xf1e3('0x13')],'id');for(var _0x1f03f7=0x0,_0x23f3c5={},_0x39ef3a={};_0x1f03f7<_0x4862b7[_0xf1e3('0x14')];_0x1f03f7+=0x1){_0x23f3c5=_0x4862b7[_0x1f03f7];if(_[_0xf1e3('0x15')](_0x99b1ab[_0xf1e3('0x13')][_0x23f3c5['id']])){_0x99b1ab[_0xf1e3('0x13')][_0x23f3c5['id']]=new Agent(_0x23f3c5);}else{_0x99b1ab[_0xf1e3('0x11')](_0x99b1ab[_0xf1e3('0x13')][_0x23f3c5['id']],_0x23f3c5);}}}return _0x99b1ab[_0xf1e3('0x13')];};};Realtime[_0xf1e3('0x10')][_0xf1e3('0x16')]=function(){var _0x49dc5a=this;return function(_0x5b44dd){if(_0x5b44dd){freeIsNotKey(_0x5b44dd,_0x49dc5a['intervals'],'id');for(var _0x8b89c9=0x0,_0x107362={},_0x116315={};_0x8b89c9<_0x5b44dd['length'];_0x8b89c9+=0x1){_0x107362=_0x5b44dd[_0x8b89c9];if(_[_0xf1e3('0x15')](_0x49dc5a[_0xf1e3('0x8')][_0x107362['id']])){_0x49dc5a[_0xf1e3('0x8')][_0x107362['id']]=new Interval(_0x107362);}else{_0x49dc5a[_0xf1e3('0x11')](_0x49dc5a['intervals'][_0x107362['id']],_0x107362);}}}return _0x49dc5a['intervals'];};};Realtime[_0xf1e3('0x10')][_0xf1e3('0x17')]=function(){var _0x317c8a=this;return function(_0x3529a5){if(_0x3529a5){freeIsNotKey(_0x3529a5,_0x317c8a[_0xf1e3('0x9')],'id');for(var _0x587cf5=0x0,_0x7bef03={},_0x2f15d7={};_0x587cf5<_0x3529a5[_0xf1e3('0x14')];_0x587cf5+=0x1){_0x7bef03=_0x3529a5[_0x587cf5];if(_[_0xf1e3('0x15')](_0x317c8a[_0xf1e3('0x9')][_0x7bef03['id']])){_0x317c8a[_0xf1e3('0x9')][_0x7bef03['id']]=new OpenchannelQueue(_0x7bef03);}else{_0x317c8a[_0xf1e3('0x11')](_0x317c8a['openchannelQueues'][_0x7bef03['id']],_0x7bef03);}_0x317c8a[_0xf1e3('0x9')][_0x7bef03['id']][_0xf1e3('0x18')]();_0x317c8a[_0xf1e3('0x9')][_0x7bef03['id']][_0xf1e3('0x19')]();}}return _0x317c8a[_0xf1e3('0x9')];};};Realtime['prototype'][_0xf1e3('0x1a')]=function(){var _0x5b886c=this;return function(_0x23a583){if(_0x23a583){freeIsNotKey(_0x23a583,_0x5b886c[_0xf1e3('0xa')],'id');for(var _0x2be5ff=0x0,_0x3aca07={},_0x5a9baf={};_0x2be5ff<_0x23a583[_0xf1e3('0x14')];_0x2be5ff+=0x1){_0x3aca07=_0x23a583[_0x2be5ff];if(_['isUndefined'](_0x5b886c[_0xf1e3('0xa')][_0x3aca07['id']])){_0x5b886c[_0xf1e3('0xa')][_0x3aca07['id']]=new ChatQueue(_0x3aca07);}else{_0x5b886c[_0xf1e3('0x11')](_0x5b886c[_0xf1e3('0xa')][_0x3aca07['id']],_0x3aca07);}_0x5b886c[_0xf1e3('0xa')][_0x3aca07['id']]['updateRouting']();_0x5b886c[_0xf1e3('0xa')][_0x3aca07['id']][_0xf1e3('0x19')]();}}return _0x5b886c['chatQueues'];};};Realtime[_0xf1e3('0x10')][_0xf1e3('0x1b')]=function(){var _0x4eb875=this;return function(_0x2d7ed0){if(_0x2d7ed0){freeIsNotKey(_0x2d7ed0,_0x4eb875[_0xf1e3('0x1c')],'id');for(var _0x290a49=0x0,_0x245a05={},_0x5b05be={};_0x290a49<_0x2d7ed0[_0xf1e3('0x14')];_0x290a49+=0x1){_0x245a05=_0x2d7ed0[_0x290a49];if(_['isUndefined'](_0x4eb875['smsQueues'][_0x245a05['id']])){_0x4eb875[_0xf1e3('0x1c')][_0x245a05['id']]=new SmsQueue(_0x245a05);}else{_0x4eb875['mergeFromDatabase'](_0x4eb875[_0xf1e3('0x1c')][_0x245a05['id']],_0x245a05);}_0x4eb875[_0xf1e3('0x1c')][_0x245a05['id']][_0xf1e3('0x18')]();_0x4eb875[_0xf1e3('0x1c')][_0x245a05['id']][_0xf1e3('0x19')]();}}return _0x4eb875[_0xf1e3('0x1c')];};};Realtime[_0xf1e3('0x10')][_0xf1e3('0x1d')]=function(){var _0x21d185=this;return function(_0x5d45da){if(_0x5d45da){freeIsNotKey(_0x5d45da,_0x21d185[_0xf1e3('0xb')],'id');for(var _0x51bc4b=0x0,_0x1e8a7c={},_0x1ed8ca={};_0x51bc4b<_0x5d45da['length'];_0x51bc4b+=0x1){_0x1e8a7c=_0x5d45da[_0x51bc4b];if(_['isUndefined'](_0x21d185[_0xf1e3('0xb')][_0x1e8a7c['id']])){_0x21d185['mailQueues'][_0x1e8a7c['id']]=new MailQueue(_0x1e8a7c);}else{_0x21d185[_0xf1e3('0x11')](_0x21d185[_0xf1e3('0xb')][_0x1e8a7c['id']],_0x1e8a7c);}_0x21d185[_0xf1e3('0xb')][_0x1e8a7c['id']][_0xf1e3('0x18')]();_0x21d185['mailQueues'][_0x1e8a7c['id']][_0xf1e3('0x19')]();}}return _0x21d185['mailQueues'];};};Realtime['prototype'][_0xf1e3('0x1e')]=function(){var _0x448724=this;return function(_0x207c04){if(_0x207c04){freeIsNotKey(_0x207c04,_0x448724[_0xf1e3('0xc')],'id');for(var _0x434a90=0x0,_0x431677={},_0x25bf0c={};_0x434a90<_0x207c04[_0xf1e3('0x14')];_0x434a90+=0x1){_0x431677=_0x207c04[_0x434a90];if(_[_0xf1e3('0x15')](_0x448724[_0xf1e3('0xc')][_0x431677['id']])){_0x448724[_0xf1e3('0xc')][_0x431677['id']]=new FaxQueue(_0x431677);}else{_0x448724[_0xf1e3('0x11')](_0x448724[_0xf1e3('0xc')][_0x431677['id']],_0x431677);}_0x448724['faxQueues'][_0x431677['id']][_0xf1e3('0x18')]();_0x448724[_0xf1e3('0xc')][_0x431677['id']][_0xf1e3('0x19')]();}}return _0x448724[_0xf1e3('0xc')];};};module[_0xf1e3('0x1f')]=Realtime; \ No newline at end of file +var _0xafba=['../model/agent','../model/interval','../model/openchannelQueue','../model/smsQueue','../model/mailQueue','agents','openchannelQueues','smsQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','prototype','hasOwnProperty','length','isUndefined','initIntervals','intervals','mergeFromDatabase','initOpenchannelQueues','updateRouting','initChatQueues','chatQueues','updateRealtime','initSmsQueues','initFaxQueues','exports','util','lodash'];(function(_0x3453b3,_0x51c26d){var _0x15a7b3=function(_0x593bbc){while(--_0x593bbc){_0x3453b3['push'](_0x3453b3['shift']());}};_0x15a7b3(++_0x51c26d);}(_0xafba,0x17e));var _0xaafb=function(_0x163303,_0xa6b8f2){_0x163303=_0x163303-0x0;var _0x2cd29d=_0xafba[_0x163303];return _0x2cd29d;};'use strict';var BPromise=require('bluebird');var util=require(_0xaafb('0x0'));var _=require(_0xaafb('0x1'));var moment=require('moment');var Agent=require(_0xaafb('0x2'));var Interval=require(_0xaafb('0x3'));var OpenchannelQueue=require(_0xaafb('0x4'));var ChatQueue=require('../model/chatQueue');var SmsQueue=require(_0xaafb('0x5'));var MailQueue=require(_0xaafb('0x6'));var FaxQueue=require('../model/faxQueue');var Realtime=function(){this[_0xaafb('0x7')]={};this['intervals']={};this[_0xaafb('0x8')]={};this['chatQueues']={};this[_0xaafb('0x9')]={};this[_0xaafb('0xa')]={};this[_0xaafb('0xb')]={};this[_0xaafb('0xc')]={};this['mailQueuesWaitingInteractions']={};this[_0xaafb('0xd')]={};this[_0xaafb('0xe')]={};this[_0xaafb('0xf')]={};};function freeIsNotKey(_0x2ac987,_0x2e4e30,_0x3365d6){var _0x30ef22=_[_0xaafb('0x10')](_0x2ac987,function(_0x571ac4,_0x3f5460){return _0x571ac4[_0x3365d6];});for(var _0x58a5fd in _0x2e4e30){if(_0x2e4e30['hasOwnProperty'](_0x58a5fd)){if(!_0x30ef22[_0x58a5fd]){delete _0x2e4e30[_0x58a5fd];}}}}Realtime[_0xaafb('0x11')]['mergeFromDatabase']=function(_0x829860,_0x3ff4d3){for(var _0x2d013a in _0x3ff4d3){if(_0x829860[_0xaafb('0x12')](_0x2d013a)){_0x829860[_0x2d013a]=_0x3ff4d3[_0x2d013a];}}};Realtime[_0xaafb('0x11')]['initAgents']=function(){var _0x2b7949=this;return function(_0x10da67){if(_0x10da67){freeIsNotKey(_0x10da67,_0x2b7949[_0xaafb('0x7')],'id');for(var _0x1e27be=0x0,_0x342b13={},_0x160de5={};_0x1e27be<_0x10da67[_0xaafb('0x13')];_0x1e27be+=0x1){_0x342b13=_0x10da67[_0x1e27be];if(_[_0xaafb('0x14')](_0x2b7949[_0xaafb('0x7')][_0x342b13['id']])){_0x2b7949['agents'][_0x342b13['id']]=new Agent(_0x342b13);}else{_0x2b7949['mergeFromDatabase'](_0x2b7949['agents'][_0x342b13['id']],_0x342b13);}}}return _0x2b7949[_0xaafb('0x7')];};};Realtime[_0xaafb('0x11')][_0xaafb('0x15')]=function(){var _0x4d2f68=this;return function(_0x45f700){if(_0x45f700){freeIsNotKey(_0x45f700,_0x4d2f68['intervals'],'id');for(var _0x403d99=0x0,_0x318723={},_0x470b37={};_0x403d99<_0x45f700[_0xaafb('0x13')];_0x403d99+=0x1){_0x318723=_0x45f700[_0x403d99];if(_['isUndefined'](_0x4d2f68[_0xaafb('0x16')][_0x318723['id']])){_0x4d2f68[_0xaafb('0x16')][_0x318723['id']]=new Interval(_0x318723);}else{_0x4d2f68[_0xaafb('0x17')](_0x4d2f68['intervals'][_0x318723['id']],_0x318723);}}}return _0x4d2f68[_0xaafb('0x16')];};};Realtime[_0xaafb('0x11')][_0xaafb('0x18')]=function(){var _0x55abba=this;return function(_0x386725){if(_0x386725){freeIsNotKey(_0x386725,_0x55abba['openchannelQueues'],'id');for(var _0x469600=0x0,_0x4941f9={},_0x150066={};_0x469600<_0x386725[_0xaafb('0x13')];_0x469600+=0x1){_0x4941f9=_0x386725[_0x469600];if(_[_0xaafb('0x14')](_0x55abba[_0xaafb('0x8')][_0x4941f9['id']])){_0x55abba[_0xaafb('0x8')][_0x4941f9['id']]=new OpenchannelQueue(_0x4941f9);}else{_0x55abba[_0xaafb('0x17')](_0x55abba[_0xaafb('0x8')][_0x4941f9['id']],_0x4941f9);}_0x55abba[_0xaafb('0x8')][_0x4941f9['id']][_0xaafb('0x19')]();_0x55abba[_0xaafb('0x8')][_0x4941f9['id']]['updateRealtime']();}}return _0x55abba[_0xaafb('0x8')];};};Realtime[_0xaafb('0x11')][_0xaafb('0x1a')]=function(){var _0x3d4745=this;return function(_0x43f7a6){if(_0x43f7a6){freeIsNotKey(_0x43f7a6,_0x3d4745['chatQueues'],'id');for(var _0x4792f0=0x0,_0x439230={},_0x2c5c18={};_0x4792f0<_0x43f7a6[_0xaafb('0x13')];_0x4792f0+=0x1){_0x439230=_0x43f7a6[_0x4792f0];if(_[_0xaafb('0x14')](_0x3d4745[_0xaafb('0x1b')][_0x439230['id']])){_0x3d4745[_0xaafb('0x1b')][_0x439230['id']]=new ChatQueue(_0x439230);}else{_0x3d4745[_0xaafb('0x17')](_0x3d4745[_0xaafb('0x1b')][_0x439230['id']],_0x439230);}_0x3d4745[_0xaafb('0x1b')][_0x439230['id']]['updateRouting']();_0x3d4745['chatQueues'][_0x439230['id']][_0xaafb('0x1c')]();}}return _0x3d4745['chatQueues'];};};Realtime[_0xaafb('0x11')][_0xaafb('0x1d')]=function(){var _0x466b81=this;return function(_0x1e9820){if(_0x1e9820){freeIsNotKey(_0x1e9820,_0x466b81['smsQueues'],'id');for(var _0x8612d7=0x0,_0xe4da85={},_0xec1b1f={};_0x8612d7<_0x1e9820[_0xaafb('0x13')];_0x8612d7+=0x1){_0xe4da85=_0x1e9820[_0x8612d7];if(_[_0xaafb('0x14')](_0x466b81['smsQueues'][_0xe4da85['id']])){_0x466b81[_0xaafb('0x9')][_0xe4da85['id']]=new SmsQueue(_0xe4da85);}else{_0x466b81['mergeFromDatabase'](_0x466b81['smsQueues'][_0xe4da85['id']],_0xe4da85);}_0x466b81[_0xaafb('0x9')][_0xe4da85['id']][_0xaafb('0x19')]();_0x466b81[_0xaafb('0x9')][_0xe4da85['id']][_0xaafb('0x1c')]();}}return _0x466b81['smsQueues'];};};Realtime[_0xaafb('0x11')]['initMailQueues']=function(){var _0x54f6f1=this;return function(_0x4dcd08){if(_0x4dcd08){freeIsNotKey(_0x4dcd08,_0x54f6f1['mailQueues'],'id');for(var _0x5eb373=0x0,_0x23eb67={},_0x3948ef={};_0x5eb373<_0x4dcd08['length'];_0x5eb373+=0x1){_0x23eb67=_0x4dcd08[_0x5eb373];if(_[_0xaafb('0x14')](_0x54f6f1[_0xaafb('0xa')][_0x23eb67['id']])){_0x54f6f1[_0xaafb('0xa')][_0x23eb67['id']]=new MailQueue(_0x23eb67);}else{_0x54f6f1[_0xaafb('0x17')](_0x54f6f1['mailQueues'][_0x23eb67['id']],_0x23eb67);}_0x54f6f1[_0xaafb('0xa')][_0x23eb67['id']][_0xaafb('0x19')]();_0x54f6f1[_0xaafb('0xa')][_0x23eb67['id']][_0xaafb('0x1c')]();}}return _0x54f6f1[_0xaafb('0xa')];};};Realtime[_0xaafb('0x11')][_0xaafb('0x1e')]=function(){var _0x17eb6b=this;return function(_0x4be6f1){if(_0x4be6f1){freeIsNotKey(_0x4be6f1,_0x17eb6b['faxQueues'],'id');for(var _0x1f9879=0x0,_0x191ff6={},_0x18280f={};_0x1f9879<_0x4be6f1[_0xaafb('0x13')];_0x1f9879+=0x1){_0x191ff6=_0x4be6f1[_0x1f9879];if(_[_0xaafb('0x14')](_0x17eb6b[_0xaafb('0xb')][_0x191ff6['id']])){_0x17eb6b[_0xaafb('0xb')][_0x191ff6['id']]=new FaxQueue(_0x191ff6);}else{_0x17eb6b['mergeFromDatabase'](_0x17eb6b[_0xaafb('0xb')][_0x191ff6['id']],_0x191ff6);}_0x17eb6b[_0xaafb('0xb')][_0x191ff6['id']][_0xaafb('0x19')]();_0x17eb6b[_0xaafb('0xb')][_0x191ff6['id']]['updateRealtime']();}}return _0x17eb6b[_0xaafb('0xb')];};};module[_0xaafb('0x1f')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 8929013..9b0048a 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 _0x9be2=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x9be2,0x1e3));var _0x29be=function(_0x159bb2,_0x20b8a5){_0x159bb2=_0x159bb2-0x0;var _0x3faf31=_0x9be2[_0x159bb2];return _0x3faf31;};'use strict';var client=require('../client');exports[_0x29be('0x0')]=function(_0x40b741,_0x2f5c2e){return client[_0x29be('0x1')](_0x29be('0x2'),{'body':_0x2f5c2e,'options':{'where':{'id':_0x40b741}},'log':_0x29be('0x3')});};exports[_0x29be('0x4')]=function(_0x5cbfbb,_0x3dba1d){return client[_0x29be('0x1')](_0x29be('0x5'),{'body':_0x3dba1d,'options':{'where':{'id':_0x5cbfbb}},'log':_0x29be('0x6')});}; \ No newline at end of file +var _0x85b8=['addTags','AddTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x1b68c1,_0x4d9611){var _0x24b0af=function(_0x1c1589){while(--_0x1c1589){_0x1b68c1['push'](_0x1b68c1['shift']());}};_0x24b0af(++_0x4d9611);}(_0x85b8,0x9c));var _0x885b=function(_0x227e24,_0x573dd6){_0x227e24=_0x227e24-0x0;var _0x2ccc99=_0x85b8[_0x227e24];return _0x2ccc99;};'use strict';var client=require(_0x885b('0x0'));exports[_0x885b('0x1')]=function(_0x17235a,_0x258d4e){return client[_0x885b('0x2')](_0x885b('0x3'),{'body':_0x258d4e,'options':{'where':{'id':_0x17235a}},'log':_0x885b('0x4')});};exports[_0x885b('0x5')]=function(_0x2425f4,_0x5c92f9){return client[_0x885b('0x2')](_0x885b('0x6'),{'body':_0x5c92f9,'options':{'where':{'id':_0x2425f4}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 7289236..023e15b 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 _0x9b8c=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x13117b,_0x3449eb){var _0x418124=function(_0x412bf5){while(--_0x412bf5){_0x13117b['push'](_0x13117b['shift']());}};_0x418124(++_0x3449eb);}(_0x9b8c,0x14b));var _0xc9b8=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0x9b8c[_0x361d3f];return _0x320229;};'use strict';var client=require(_0xc9b8('0x0'));exports[_0xc9b8('0x1')]=function(_0x12b63a){return client[_0xc9b8('0x2')](_0xc9b8('0x3'),{'body':_0x12b63a,'log':_0xc9b8('0x4')});}; \ No newline at end of file +var _0xd1fd=['create','Request','createChatMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1fd,0xe7));var _0xdd1f=function(_0x3233c3,_0x15e5fa){_0x3233c3=_0x3233c3-0x0;var _0x36029b=_0xd1fd[_0x3233c3];return _0x36029b;};'use strict';var client=require(_0xdd1f('0x0'));exports[_0xdd1f('0x1')]=function(_0xe027dd){return client[_0xdd1f('0x2')]('CreateChatMessage',{'body':_0xe027dd,'log':_0xdd1f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 5a286e7..8cfadb2 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 _0xb75e=['timeout','strategy','Agents','online','chatPause','../client','getChatQueues','name'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb75e,0x11d));var _0xeb75=function(_0x91dc4a,_0xa8cb00){_0x91dc4a=_0x91dc4a-0x0;var _0x5495d6=_0xb75e[_0x91dc4a];return _0x5495d6;};'use strict';var client=require(_0xeb75('0x0'));exports[_0xeb75('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xeb75('0x2'),_0xeb75('0x3'),_0xeb75('0x4')],'include':[{'model':'User','as':_0xeb75('0x5'),'attributes':['id',_0xeb75('0x2'),_0xeb75('0x6'),_0xeb75('0x7')]}]},'log':_0xeb75('0x1')});};}; \ No newline at end of file +var _0x61b2=['chatPause','../client','getChatQueues','GetChatQueue','strategy','online'];(function(_0x5afb61,_0xc2d4dd){var _0x4b2209=function(_0x27b24b){while(--_0x27b24b){_0x5afb61['push'](_0x5afb61['shift']());}};_0x4b2209(++_0xc2d4dd);}(_0x61b2,0x1bd));var _0x261b=function(_0x35e9d6,_0x35dffc){_0x35e9d6=_0x35e9d6-0x0;var _0x2f658f=_0x61b2[_0x35e9d6];return _0x2f658f;};'use strict';var client=require(_0x261b('0x0'));exports[_0x261b('0x1')]=function(){return function(){return client['Request'](_0x261b('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x261b('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id','name',_0x261b('0x4'),_0x261b('0x5')]}]},'log':_0x261b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 5a7a390..c04cccb 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 _0x9b67=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0x9b67,0xf6));var _0x79b6=function(_0x40dc8f,_0x58e16e){_0x40dc8f=_0x40dc8f-0x0;var _0x5cbb64=_0x9b67[_0x40dc8f];return _0x5cbb64;};'use strict';var client=require(_0x79b6('0x0'));exports[_0x79b6('0x1')]=function(_0xfb9138){return client[_0x79b6('0x2')](_0x79b6('0x3'),{'body':_0xfb9138,'log':'CreateChatQueueReport'});};exports[_0x79b6('0x4')]=function(_0x1aeb24,_0x5297d0){return client['Request'](_0x79b6('0x5'),{'body':_0x5297d0,'options':{'where':{'uniqueid':_0x1aeb24},'order':[['id',_0x79b6('0x6')]],'limit':0x1},'log':_0x79b6('0x5')});}; \ No newline at end of file +var _0xd691=['create','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC','../client'];(function(_0x513d18,_0x1843b7){var _0xef6d21=function(_0x3b39c5){while(--_0x3b39c5){_0x513d18['push'](_0x513d18['shift']());}};_0xef6d21(++_0x1843b7);}(_0xd691,0xe6));var _0x1d69=function(_0x51308d,_0x42cf02){_0x51308d=_0x51308d-0x0;var _0x37cde8=_0xd691[_0x51308d];return _0x37cde8;};'use strict';var client=require(_0x1d69('0x0'));exports[_0x1d69('0x1')]=function(_0x4738f2){return client['Request'](_0x1d69('0x2'),{'body':_0x4738f2,'log':_0x1d69('0x2')});};exports[_0x1d69('0x3')]=function(_0x3dc1c9,_0x1fbb5e){return client[_0x1d69('0x4')](_0x1d69('0x5'),{'body':_0x1fbb5e,'options':{'where':{'uniqueid':_0x3dc1c9},'order':[['id',_0x1d69('0x6')]],'limit':0x1},'log':_0x1d69('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index e7c5ea2..84b909f 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 _0x9c5e=['update','Request','UpdateFaxInteraction','updateFaxInteraction','AddTagsToFaxInteraction'];(function(_0x3586f8,_0x556c6d){var _0x31dc18=function(_0x50819c){while(--_0x50819c){_0x3586f8['push'](_0x3586f8['shift']());}};_0x31dc18(++_0x556c6d);}(_0x9c5e,0x1db));var _0xe9c5=function(_0x4393f8,_0x3b47c5){_0x4393f8=_0x4393f8-0x0;var _0x554e75=_0x9c5e[_0x4393f8];return _0x554e75;};'use strict';var client=require('../client');exports[_0xe9c5('0x0')]=function(_0x8672a6,_0x4a1da7){return client[_0xe9c5('0x1')](_0xe9c5('0x2'),{'body':_0x4a1da7,'options':{'where':{'id':_0x8672a6}},'log':_0xe9c5('0x3')});};exports['addTags']=function(_0x356fa2,_0x1d6230){return client['Request'](_0xe9c5('0x4'),{'body':_0x1d6230,'options':{'where':{'id':_0x356fa2}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x1e3e=['UpdateFaxInteraction','updateFaxInteraction','addTagsToFaxInteraction','../client','update','Request'];(function(_0x50e40b,_0x338d17){var _0x2608b7=function(_0x4ded5e){while(--_0x4ded5e){_0x50e40b['push'](_0x50e40b['shift']());}};_0x2608b7(++_0x338d17);}(_0x1e3e,0x15f));var _0xe1e3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1e3e[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xe1e3('0x0'));exports[_0xe1e3('0x1')]=function(_0x5cc255,_0x436a6b){return client[_0xe1e3('0x2')](_0xe1e3('0x3'),{'body':_0x436a6b,'options':{'where':{'id':_0x5cc255}},'log':_0xe1e3('0x4')});};exports['addTags']=function(_0x524da1,_0x18ea86){return client[_0xe1e3('0x2')]('AddTagsToFaxInteraction',{'body':_0x18ea86,'options':{'where':{'id':_0x524da1}},'log':_0xe1e3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 7702be8..78a2b06 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 _0x3478=['create','CreateFaxMessage'];(function(_0x2615b1,_0x3a35a2){var _0x3a2651=function(_0x23c397){while(--_0x23c397){_0x2615b1['push'](_0x2615b1['shift']());}};_0x3a2651(++_0x3a35a2);}(_0x3478,0x158));var _0x8347=function(_0x23d45e,_0x159a89){_0x23d45e=_0x23d45e-0x0;var _0x2b3511=_0x3478[_0x23d45e];return _0x2b3511;};'use strict';var client=require('../client');exports[_0x8347('0x0')]=function(_0x59a325){return client['Request'](_0x8347('0x1'),{'body':_0x59a325,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x4ed2=['CreateFaxMessage','createFaxMessage'];(function(_0x50df1b,_0x1f697c){var _0x35b890=function(_0x58b2cd){while(--_0x58b2cd){_0x50df1b['push'](_0x50df1b['shift']());}};_0x35b890(++_0x1f697c);}(_0x4ed2,0xfa));var _0x24ed=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4ed2[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['create']=function(_0x2a4929){return client['Request'](_0x24ed('0x0'),{'body':_0x2a4929,'log':_0x24ed('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 10f6a74..6ada832 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 _0xdfcd=['Agents','online','getFaxQueues','Request','GetFaxQueue','name','timeout','User'];(function(_0x618644,_0x24242b){var _0x401623=function(_0x58dcce){while(--_0x58dcce){_0x618644['push'](_0x618644['shift']());}};_0x401623(++_0x24242b);}(_0xdfcd,0xc2));var _0xddfc=function(_0x8ad18e,_0x292d3d){_0x8ad18e=_0x8ad18e-0x0;var _0x979081=_0xdfcd[_0x8ad18e];return _0x979081;};'use strict';var client=require('../client');exports[_0xddfc('0x0')]=function(){return function(){return client[_0xddfc('0x1')](_0xddfc('0x2'),{'options':{'raw':![],'attributes':['id',_0xddfc('0x3'),_0xddfc('0x4'),'strategy'],'include':[{'model':_0xddfc('0x5'),'as':_0xddfc('0x6'),'attributes':['id','name',_0xddfc('0x7'),'faxPause']}]},'log':_0xddfc('0x0')});};}; \ No newline at end of file +var _0xbde8=['online','Request','name','timeout','strategy','Agents'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0xbde8,0xd9));var _0x8bde=function(_0x3598bb,_0x24befa){_0x3598bb=_0x3598bb-0x0;var _0x13c837=_0xbde8[_0x3598bb];return _0x13c837;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x8bde('0x0')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x8bde('0x1'),_0x8bde('0x2'),_0x8bde('0x3')],'include':[{'model':'User','as':_0x8bde('0x4'),'attributes':['id',_0x8bde('0x1'),_0x8bde('0x5'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 22b333b..2a2920f 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 _0xc164=['UpdateFaxQueueReport','DESC','create','Request','CreateFaxQueueReport','update'];(function(_0x5d42f1,_0x1269e6){var _0x4cb6b0=function(_0x19141f){while(--_0x19141f){_0x5d42f1['push'](_0x5d42f1['shift']());}};_0x4cb6b0(++_0x1269e6);}(_0xc164,0x18e));var _0x4c16=function(_0x37bb43,_0x269e80){_0x37bb43=_0x37bb43-0x0;var _0x4dc751=_0xc164[_0x37bb43];return _0x4dc751;};'use strict';var client=require('../client');exports[_0x4c16('0x0')]=function(_0x261b98){return client[_0x4c16('0x1')](_0x4c16('0x2'),{'body':_0x261b98,'log':_0x4c16('0x2')});};exports[_0x4c16('0x3')]=function(_0x22bb3b,_0x3c12e5){return client['Request'](_0x4c16('0x4'),{'body':_0x3c12e5,'options':{'where':{'uniqueid':_0x22bb3b},'order':[['id',_0x4c16('0x5')]],'limit':0x1},'log':_0x4c16('0x4')});}; \ No newline at end of file +var _0x29a3=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','create','Request'];(function(_0x4eeee0,_0x5eaafb){var _0x20ad83=function(_0x1c7ffc){while(--_0x1c7ffc){_0x4eeee0['push'](_0x4eeee0['shift']());}};_0x20ad83(++_0x5eaafb);}(_0x29a3,0x141));var _0x329a=function(_0x381ddb,_0x414363){_0x381ddb=_0x381ddb-0x0;var _0x3d4ad3=_0x29a3[_0x381ddb];return _0x3d4ad3;};'use strict';var client=require(_0x329a('0x0'));exports[_0x329a('0x1')]=function(_0x58eedd){return client[_0x329a('0x2')](_0x329a('0x3'),{'body':_0x58eedd,'log':_0x329a('0x3')});};exports['update']=function(_0xde7233,_0x10a59c){return client[_0x329a('0x2')](_0x329a('0x4'),{'body':_0x10a59c,'options':{'where':{'uniqueid':_0xde7233},'order':[['id',_0x329a('0x5')]],'limit':0x1},'log':_0x329a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 0ad10ad..bb132e7 100644 --- a/server/services/routing/rpc/interval.js +++ b/server/services/routing/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7d1=['Interval','Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x4e5111,_0x410c36){var _0x375529=function(_0x318c08){while(--_0x318c08){_0x4e5111['push'](_0x4e5111['shift']());}};_0x375529(++_0x410c36);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x3129aa,_0x5ef35d){_0x3129aa=_0x3129aa-0x0;var _0x4f6a50=_0xd7d1[_0x3129aa];return _0x4f6a50;};'use strict';var client=require(_0x1d7d('0x0'));exports[_0x1d7d('0x1')]=function(){return function(){return client[_0x1d7d('0x2')](_0x1d7d('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x1d7d('0x4')],'include':[{'model':_0x1d7d('0x5'),'as':_0x1d7d('0x6'),'attributes':['id',_0x1d7d('0x4'),_0x1d7d('0x7')]}]},'log':_0x1d7d('0x1')});};}; \ No newline at end of file +var _0xaa5e=['name','Interval','Intervals','../client','getIntervals','GetInterval'];(function(_0x1c5a9e,_0x62bbe4){var _0x455dc3=function(_0x1dc9f9){while(--_0x1dc9f9){_0x1c5a9e['push'](_0x1c5a9e['shift']());}};_0x455dc3(++_0x62bbe4);}(_0xaa5e,0xa5));var _0xeaa5=function(_0x1deee7,_0x2ca553){_0x1deee7=_0x1deee7-0x0;var _0x1171e1=_0xaa5e[_0x1deee7];return _0x1171e1;};'use strict';var client=require(_0xeaa5('0x0'));exports[_0xeaa5('0x1')]=function(){return function(){return client['Request'](_0xeaa5('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xeaa5('0x3')],'include':[{'model':_0xeaa5('0x4'),'as':_0xeaa5('0x5'),'attributes':['id',_0xeaa5('0x3'),'interval']}]},'log':_0xeaa5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 0774258..96749a0 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 _0x270e=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x4e638d,_0x5a3f18){var _0x2ed622=function(_0x30b8ee){while(--_0x30b8ee){_0x4e638d['push'](_0x4e638d['shift']());}};_0x2ed622(++_0x5a3f18);}(_0x270e,0xe9));var _0xe270=function(_0x19b2d2,_0x2485b2){_0x19b2d2=_0x19b2d2-0x0;var _0x183e8e=_0x270e[_0x19b2d2];return _0x183e8e;};'use strict';var client=require(_0xe270('0x0'));exports['update']=function(_0x3111a4,_0x57ad00){return client['Request'](_0xe270('0x1'),{'body':_0x57ad00,'options':{'where':{'id':_0x3111a4}},'log':_0xe270('0x2')});};exports[_0xe270('0x3')]=function(_0x5179ea,_0x9c2181){return client[_0xe270('0x4')](_0xe270('0x5'),{'body':_0x9c2181,'options':{'where':{'id':_0x5179ea}},'log':_0xe270('0x6')});}; \ No newline at end of file +var _0x41a5=['Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update'];(function(_0x28678c,_0x2f1384){var _0x19a747=function(_0x1114c4){while(--_0x1114c4){_0x28678c['push'](_0x28678c['shift']());}};_0x19a747(++_0x2f1384);}(_0x41a5,0x1de));var _0x541a=function(_0x2cb09b,_0x42eb12){_0x2cb09b=_0x2cb09b-0x0;var _0x21c8cb=_0x41a5[_0x2cb09b];return _0x21c8cb;};'use strict';var client=require(_0x541a('0x0'));exports[_0x541a('0x1')]=function(_0x569f4e,_0x3a267f){return client[_0x541a('0x2')](_0x541a('0x3'),{'body':_0x3a267f,'options':{'where':{'id':_0x569f4e}},'log':_0x541a('0x4')});};exports[_0x541a('0x5')]=function(_0x88cdaf,_0x18bdc0){return client[_0x541a('0x2')](_0x541a('0x6'),{'body':_0x18bdc0,'options':{'where':{'id':_0x88cdaf}},'log':_0x541a('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 247e4c4..9564e8a 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 _0xd295=['CreateMailMessage','createMailMessage','../client','create'];(function(_0x4495d8,_0x4e9c31){var _0x32abc0=function(_0x1944dc){while(--_0x1944dc){_0x4495d8['push'](_0x4495d8['shift']());}};_0x32abc0(++_0x4e9c31);}(_0xd295,0x7e));var _0x5d29=function(_0x4ec67e,_0x49cc70){_0x4ec67e=_0x4ec67e-0x0;var _0x1be59f=_0xd295[_0x4ec67e];return _0x1be59f;};'use strict';var client=require(_0x5d29('0x0'));exports[_0x5d29('0x1')]=function(_0x28cacc){return client['Request'](_0x5d29('0x2'),{'body':_0x28cacc,'log':_0x5d29('0x3')});}; \ No newline at end of file +var _0x643a=['CreateMailMessage','createMailMessage','Request'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x643a,0xb9));var _0xa643=function(_0x12663e,_0x2e8f3a){_0x12663e=_0x12663e-0x0;var _0x88f979=_0x643a[_0x12663e];return _0x88f979;};'use strict';var client=require('../client');exports['create']=function(_0x21785f){return client[_0xa643('0x0')](_0xa643('0x1'),{'body':_0x21785f,'log':_0xa643('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index dff4637..a911f26 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 _0xe60a=['Agents','online','../client','getMailQueues','GetMailQueue','name','strategy','User'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0xe60a,0x82));var _0xae60=function(_0x2c9c88,_0xc52cad){_0x2c9c88=_0x2c9c88-0x0;var _0xe4afcf=_0xe60a[_0x2c9c88];return _0xe4afcf;};'use strict';var client=require(_0xae60('0x0'));exports[_0xae60('0x1')]=function(){return function(){return client['Request'](_0xae60('0x2'),{'options':{'raw':![],'attributes':['id',_0xae60('0x3'),'timeout',_0xae60('0x4')],'include':[{'model':_0xae60('0x5'),'as':_0xae60('0x6'),'attributes':['id','name',_0xae60('0x7'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xd80c=['User','Agents','online','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy'];(function(_0x2886ac,_0x4b3fd1){var _0x419a99=function(_0x4c8301){while(--_0x4c8301){_0x2886ac['push'](_0x2886ac['shift']());}};_0x419a99(++_0x4b3fd1);}(_0xd80c,0x107));var _0xcd80=function(_0x3af418,_0x473792){_0x3af418=_0x3af418-0x0;var _0x48a045=_0xd80c[_0x3af418];return _0x48a045;};'use strict';var client=require(_0xcd80('0x0'));exports[_0xcd80('0x1')]=function(){return function(){return client[_0xcd80('0x2')](_0xcd80('0x3'),{'options':{'raw':![],'attributes':['id',_0xcd80('0x4'),_0xcd80('0x5'),_0xcd80('0x6')],'include':[{'model':_0xcd80('0x7'),'as':_0xcd80('0x8'),'attributes':['id',_0xcd80('0x4'),_0xcd80('0x9'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7c73a98..41b54b5 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 _0x4493=['Request','CreateMailQueueReport','update','DESC','../client','create'];(function(_0x347a9d,_0x1c70eb){var _0x2621d5=function(_0x19b4b7){while(--_0x19b4b7){_0x347a9d['push'](_0x347a9d['shift']());}};_0x2621d5(++_0x1c70eb);}(_0x4493,0xac));var _0x3449=function(_0x260802,_0x205fdf){_0x260802=_0x260802-0x0;var _0x2dda26=_0x4493[_0x260802];return _0x2dda26;};'use strict';var client=require(_0x3449('0x0'));exports[_0x3449('0x1')]=function(_0x5de113){return client[_0x3449('0x2')](_0x3449('0x3'),{'body':_0x5de113,'log':_0x3449('0x3')});};exports[_0x3449('0x4')]=function(_0x271841,_0x18573a){return client[_0x3449('0x2')]('UpdateMailQueueReport',{'body':_0x18573a,'options':{'where':{'uniqueid':_0x271841},'order':[['id',_0x3449('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x616b=['DESC','create','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0xb2f445,_0x10a2ca){var _0x19da8c=function(_0x23c343){while(--_0x23c343){_0xb2f445['push'](_0xb2f445['shift']());}};_0x19da8c(++_0x10a2ca);}(_0x616b,0x18c));var _0xb616=function(_0x1b4002,_0x5b4094){_0x1b4002=_0x1b4002-0x0;var _0x1716f3=_0x616b[_0x1b4002];return _0x1716f3;};'use strict';var client=require('../client');exports[_0xb616('0x0')]=function(_0x1d3792){return client[_0xb616('0x1')](_0xb616('0x2'),{'body':_0x1d3792,'log':_0xb616('0x2')});};exports['update']=function(_0x12808f,_0x18e2b1){return client[_0xb616('0x1')](_0xb616('0x3'),{'body':_0x18e2b1,'options':{'where':{'uniqueid':_0x12808f},'order':[['id',_0xb616('0x4')]],'limit':0x1},'log':_0xb616('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e4f8716..6539173 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 _0x104f=['Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x104f,0x1e9));var _0xf104=function(_0x3d573f,_0x34f85c){_0x3d573f=_0x3d573f-0x0;var _0x1f09f8=_0x104f[_0x3d573f];return _0x1f09f8;};'use strict';var client=require(_0xf104('0x0'));exports['update']=function(_0x387515,_0x357389){return client[_0xf104('0x1')](_0xf104('0x2'),{'body':_0x357389,'options':{'where':{'id':_0x387515}},'log':'updateOpenchannelInteraction'});};exports[_0xf104('0x3')]=function(_0x3cae83,_0x192eb8){return client['Request'](_0xf104('0x4'),{'body':_0x192eb8,'options':{'where':{'id':_0x3cae83}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xfae7=['update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','Request','addTagsToChatInteraction'];(function(_0x1bbc08,_0x444008){var _0x5d825b=function(_0x522920){while(--_0x522920){_0x1bbc08['push'](_0x1bbc08['shift']());}};_0x5d825b(++_0x444008);}(_0xfae7,0x91));var _0x7fae=function(_0x18fbfc,_0x57a9ca){_0x18fbfc=_0x18fbfc-0x0;var _0x9b4223=_0xfae7[_0x18fbfc];return _0x9b4223;};'use strict';var client=require('../client');exports[_0x7fae('0x0')]=function(_0x22c851,_0x3a51f6){return client['Request'](_0x7fae('0x1'),{'body':_0x3a51f6,'options':{'where':{'id':_0x22c851}},'log':_0x7fae('0x2')});};exports['addTags']=function(_0x30f32b,_0x4adc12){return client[_0x7fae('0x3')]('AddTagsToOpenchannelInteraction',{'body':_0x4adc12,'options':{'where':{'id':_0x30f32b}},'log':_0x7fae('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 8af7f2d..37f3883 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 _0xf4eb=['../client','createOpenchannelMessage'];(function(_0x3fb33a,_0x3f9600){var _0x21b3e1=function(_0x7d14b){while(--_0x7d14b){_0x3fb33a['push'](_0x3fb33a['shift']());}};_0x21b3e1(++_0x3f9600);}(_0xf4eb,0xec));var _0xbf4e=function(_0x114272,_0x2110d7){_0x114272=_0x114272-0x0;var _0x126666=_0xf4eb[_0x114272];return _0x126666;};'use strict';var client=require(_0xbf4e('0x0'));exports['create']=function(_0x50f2fc){return client['Request']('CreateOpenchannelMessage',{'body':_0x50f2fc,'log':_0xbf4e('0x1')});}; \ No newline at end of file +var _0xdace=['Request','CreateOpenchannelMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdace,0xc5));var _0xedac=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0xdace[_0x4017b0];return _0x5ed4f7;};'use strict';var client=require(_0xedac('0x0'));exports['create']=function(_0x1c76b2){return client[_0xedac('0x1')](_0xedac('0x2'),{'body':_0x1c76b2,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 168e5ab..4aedfb5 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 _0xbf04=['strategy','User','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x32e7ec,_0x3cc7ab){var _0x3ce874=function(_0x12ed3d){while(--_0x12ed3d){_0x32e7ec['push'](_0x32e7ec['shift']());}};_0x3ce874(++_0x3cc7ab);}(_0xbf04,0x18a));var _0x4bf0=function(_0x5e3342,_0x5ceda0){_0x5e3342=_0x5e3342-0x0;var _0x572836=_0xbf04[_0x5e3342];return _0x572836;};'use strict';var client=require(_0x4bf0('0x0'));exports[_0x4bf0('0x1')]=function(){return function(){return client[_0x4bf0('0x2')](_0x4bf0('0x3'),{'options':{'raw':![],'attributes':['id',_0x4bf0('0x4'),_0x4bf0('0x5'),_0x4bf0('0x6')],'include':[{'model':_0x4bf0('0x7'),'as':'Agents','attributes':['id',_0x4bf0('0x4'),_0x4bf0('0x8'),_0x4bf0('0x9')]}]},'log':_0x4bf0('0x1')});};}; \ No newline at end of file +var _0xd1f3=['strategy','User','Agents','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x57b2ed,_0x5e9e07){var _0x49e09e=function(_0x44241b){while(--_0x44241b){_0x57b2ed['push'](_0x57b2ed['shift']());}};_0x49e09e(++_0x5e9e07);}(_0xd1f3,0x1bd));var _0x3d1f=function(_0x1e1d61,_0x4cb554){_0x1e1d61=_0x1e1d61-0x0;var _0x2e7a25=_0xd1f3[_0x1e1d61];return _0x2e7a25;};'use strict';var client=require('../client');exports[_0x3d1f('0x0')]=function(){return function(){return client[_0x3d1f('0x1')](_0x3d1f('0x2'),{'options':{'raw':![],'attributes':['id',_0x3d1f('0x3'),_0x3d1f('0x4'),_0x3d1f('0x5')],'include':[{'model':_0x3d1f('0x6'),'as':_0x3d1f('0x7'),'attributes':['id',_0x3d1f('0x3'),'online',_0x3d1f('0x8')]}]},'log':_0x3d1f('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 971e603..374b20f 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 _0x096b=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client'];(function(_0x305a1d,_0x566a0e){var _0x41cc57=function(_0x259e7c){while(--_0x259e7c){_0x305a1d['push'](_0x305a1d['shift']());}};_0x41cc57(++_0x566a0e);}(_0x096b,0x149));var _0xb096=function(_0x31cb3f,_0x1154af){_0x31cb3f=_0x31cb3f-0x0;var _0x53d1e2=_0x096b[_0x31cb3f];return _0x53d1e2;};'use strict';var client=require(_0xb096('0x0'));exports[_0xb096('0x1')]=function(_0x322666){return client[_0xb096('0x2')](_0xb096('0x3'),{'body':_0x322666,'log':_0xb096('0x3')});};exports[_0xb096('0x4')]=function(_0x344e0a,_0x589b94){return client[_0xb096('0x2')](_0xb096('0x5'),{'body':_0x589b94,'options':{'where':{'uniqueid':_0x344e0a},'order':[['id','DESC']],'limit':0x1},'log':_0xb096('0x5')});}; \ No newline at end of file +var _0x3c65=['Request','CreateOpenchannelQueueReport','DESC','UpdateOpenchannelQueueReport','../client','create'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x3c65,0xe8));var _0x53c6=function(_0x4cd21c,_0x35fa45){_0x4cd21c=_0x4cd21c-0x0;var _0x5d8e5e=_0x3c65[_0x4cd21c];return _0x5d8e5e;};'use strict';var client=require(_0x53c6('0x0'));exports[_0x53c6('0x1')]=function(_0xd36d18){return client[_0x53c6('0x2')]('CreateOpenchannelQueueReport',{'body':_0xd36d18,'log':_0x53c6('0x3')});};exports['update']=function(_0x5d4f9e,_0x37ea1f){return client[_0x53c6('0x2')]('UpdateOpenchannelQueueReport',{'body':_0x37ea1f,'options':{'where':{'uniqueid':_0x5d4f9e},'order':[['id',_0x53c6('0x4')]],'limit':0x1},'log':_0x53c6('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 21e9977..e7c4b0b 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 _0x6385=['Request','UpdateSmsInteraction','addTags','addTagsToSmsInteraction','../client'];(function(_0x531c1f,_0x2e6954){var _0x4e53cb=function(_0x5ee1a6){while(--_0x5ee1a6){_0x531c1f['push'](_0x531c1f['shift']());}};_0x4e53cb(++_0x2e6954);}(_0x6385,0xf9));var _0x5638=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x6385[_0x450689];return _0x46ffb0;};'use strict';var client=require(_0x5638('0x0'));exports['update']=function(_0x4e0d9e,_0xdb9793){return client[_0x5638('0x1')](_0x5638('0x2'),{'body':_0xdb9793,'options':{'where':{'id':_0x4e0d9e}},'log':'updateSmsInteraction'});};exports[_0x5638('0x3')]=function(_0x10a1d2,_0x206d27){return client[_0x5638('0x1')]('AddTagsToSmsInteraction',{'body':_0x206d27,'options':{'where':{'id':_0x10a1d2}},'log':_0x5638('0x4')});}; \ No newline at end of file +var _0x441d=['UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x441d,0x17e));var _0xd441=function(_0x3ea4c1,_0x190dfc){_0x3ea4c1=_0x3ea4c1-0x0;var _0x2f0442=_0x441d[_0x3ea4c1];return _0x2f0442;};'use strict';var client=require(_0xd441('0x0'));exports[_0xd441('0x1')]=function(_0x5b2df6,_0x40e11d){return client[_0xd441('0x2')](_0xd441('0x3'),{'body':_0x40e11d,'options':{'where':{'id':_0x5b2df6}},'log':'updateSmsInteraction'});};exports[_0xd441('0x4')]=function(_0x4824af,_0x41e1de){return client['Request'](_0xd441('0x5'),{'body':_0x41e1de,'options':{'where':{'id':_0x4824af}},'log':_0xd441('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 2b63483..db82461 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 _0xb922=['createSmsMessage','../client','create'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0xb922,0x12d));var _0x2b92=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb922[_0x4b2863];return _0x567d67;};'use strict';var client=require(_0x2b92('0x0'));exports[_0x2b92('0x1')]=function(_0x10f934){return client['Request']('CreateSmsMessage',{'body':_0x10f934,'log':_0x2b92('0x2')});}; \ No newline at end of file +var _0x541f=['create','Request','CreateSmsMessage'];(function(_0x2b8026,_0x58e34e){var _0x2bb21f=function(_0x14f055){while(--_0x14f055){_0x2b8026['push'](_0x2b8026['shift']());}};_0x2bb21f(++_0x58e34e);}(_0x541f,0x1f2));var _0xf541=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x541f[_0x44b3bd];return _0x1efc4a;};'use strict';var client=require('../client');exports[_0xf541('0x0')]=function(_0x4fccdc){return client[_0xf541('0x1')](_0xf541('0x2'),{'body':_0x4fccdc,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 47ea13f..181ca23 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 _0x99b2=['timeout','strategy','User','Agents','online','../client','getSmsQueues','GetSmsQueue','name'];(function(_0x15cecd,_0x20f090){var _0x16bc45=function(_0x124511){while(--_0x124511){_0x15cecd['push'](_0x15cecd['shift']());}};_0x16bc45(++_0x20f090);}(_0x99b2,0x12e));var _0x299b=function(_0x4ef85b,_0x39fec3){_0x4ef85b=_0x4ef85b-0x0;var _0x209b54=_0x99b2[_0x4ef85b];return _0x209b54;};'use strict';var client=require(_0x299b('0x0'));exports[_0x299b('0x1')]=function(){return function(){return client['Request'](_0x299b('0x2'),{'options':{'raw':![],'attributes':['id',_0x299b('0x3'),_0x299b('0x4'),_0x299b('0x5')],'include':[{'model':_0x299b('0x6'),'as':_0x299b('0x7'),'attributes':['id',_0x299b('0x3'),_0x299b('0x8'),'smsPause']}]},'log':_0x299b('0x1')});};}; \ No newline at end of file +var _0x6aa1=['name','strategy','User','Agents','smsPause','getSmsQueues','Request'];(function(_0x1cb950,_0xc06e73){var _0x1bef44=function(_0x3a7760){while(--_0x3a7760){_0x1cb950['push'](_0x1cb950['shift']());}};_0x1bef44(++_0xc06e73);}(_0x6aa1,0x1da));var _0x16aa=function(_0x512955,_0x2fc85a){_0x512955=_0x512955-0x0;var _0x5f7a51=_0x6aa1[_0x512955];return _0x5f7a51;};'use strict';var client=require('../client');exports[_0x16aa('0x0')]=function(){return function(){return client[_0x16aa('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x16aa('0x2'),'timeout',_0x16aa('0x3')],'include':[{'model':_0x16aa('0x4'),'as':_0x16aa('0x5'),'attributes':['id','name','online',_0x16aa('0x6')]}]},'log':_0x16aa('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 8272b59..3d93bd7 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 _0xfb9c=['update','Request','UpdateSmsQueueReport','DESC','create','CreateSmsQueueReport'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xfb9c,0xb2));var _0xcfb9=function(_0xd547cd,_0x3ad91f){_0xd547cd=_0xd547cd-0x0;var _0x1e3cff=_0xfb9c[_0xd547cd];return _0x1e3cff;};'use strict';var client=require('../client');exports[_0xcfb9('0x0')]=function(_0x551147){return client['Request'](_0xcfb9('0x1'),{'body':_0x551147,'log':_0xcfb9('0x1')});};exports[_0xcfb9('0x2')]=function(_0x42ada0,_0x2ace15){return client[_0xcfb9('0x3')](_0xcfb9('0x4'),{'body':_0x2ace15,'options':{'where':{'uniqueid':_0x42ada0},'order':[['id',_0xcfb9('0x5')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0xf264=['UpdateSmsQueueReport','../client','create','Request','CreateSmsQueueReport','DESC'];(function(_0xc9d6ef,_0x8bf100){var _0x4792bc=function(_0x93c8cc){while(--_0x93c8cc){_0xc9d6ef['push'](_0xc9d6ef['shift']());}};_0x4792bc(++_0x8bf100);}(_0xf264,0xfd));var _0x4f26=function(_0x509bf1,_0x2333a6){_0x509bf1=_0x509bf1-0x0;var _0x3f9372=_0xf264[_0x509bf1];return _0x3f9372;};'use strict';var client=require(_0x4f26('0x0'));exports[_0x4f26('0x1')]=function(_0x130ae2){return client[_0x4f26('0x2')]('CreateSmsQueueReport',{'body':_0x130ae2,'log':_0x4f26('0x3')});};exports['update']=function(_0x752d4d,_0x4ef9bd){return client[_0x4f26('0x2')]('UpdateSmsQueueReport',{'body':_0x4ef9bd,'options':{'where':{'uniqueid':_0x752d4d},'order':[['id',_0x4f26('0x4')]],'limit':0x1},'log':_0x4f26('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6522e0b..2594fa2 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 _0xb3ec=['online','pauseType','lastPauseAt','voicePause','mailPause','smsPause','openchannelPause','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','agent','name'];(function(_0x4fbc57,_0x316a95){var _0x596efa=function(_0x27b66c){while(--_0x27b66c){_0x4fbc57['push'](_0x4fbc57['shift']());}};_0x596efa(++_0x316a95);}(_0xb3ec,0x19b));var _0xcb3e=function(_0x57ce3f,_0x1ebacd){_0x57ce3f=_0x57ce3f-0x0;var _0x231033=_0xb3ec[_0x57ce3f];return _0x231033;};'use strict';var client=require(_0xcb3e('0x0'));exports[_0xcb3e('0x1')]=function(){return function(){return client[_0xcb3e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0xcb3e('0x3')},'attributes':['id',_0xcb3e('0x4'),_0xcb3e('0x5'),_0xcb3e('0x6'),_0xcb3e('0x7'),_0xcb3e('0x8'),'chatPause',_0xcb3e('0x9'),'faxPause',_0xcb3e('0xa'),_0xcb3e('0xb'),'chatCapacity',_0xcb3e('0xc'),_0xcb3e('0xd'),_0xcb3e('0xe'),_0xcb3e('0xf')]},'log':'getAgents'});};}; \ No newline at end of file +var _0x66e4=['online','pauseType','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','getAgents','../client','Request','GetUser','agent','name'];(function(_0x5df4c6,_0x3962cc){var _0x1e2fda=function(_0x3cbaf5){while(--_0x3cbaf5){_0x5df4c6['push'](_0x5df4c6['shift']());}};_0x1e2fda(++_0x3962cc);}(_0x66e4,0x79));var _0x466e=function(_0x340423,_0xf6b930){_0x340423=_0x340423-0x0;var _0x5867f7=_0x66e4[_0x340423];return _0x5867f7;};'use strict';var client=require(_0x466e('0x0'));exports['getAgents']=function(){return function(){return client[_0x466e('0x1')](_0x466e('0x2'),{'options':{'raw':!![],'where':{'role':_0x466e('0x3')},'attributes':['id',_0x466e('0x4'),_0x466e('0x5'),_0x466e('0x6'),'lastPauseAt','voicePause',_0x466e('0x7'),_0x466e('0x8'),_0x466e('0x9'),_0x466e('0xa'),_0x466e('0xb'),_0x466e('0xc'),_0x466e('0xd'),_0x466e('0xe'),_0x466e('0xf'),_0x466e('0x10')]},'log':_0x466e('0x11')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index eec5ab3..e707ee7 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 _0x615a=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client'];(function(_0x5518fe,_0xb5813d){var _0x5e7e22=function(_0xc66f00){while(--_0xc66f00){_0x5518fe['push'](_0x5518fe['shift']());}};_0x5e7e22(++_0xb5813d);}(_0x615a,0x119));var _0xa615=function(_0x5947f8,_0x305779){_0x5947f8=_0x5947f8-0x0;var _0x43888e=_0x615a[_0x5947f8];return _0x43888e;};'use strict';var client=require(_0xa615('0x0'));exports['update']=function(_0x21ebaf,_0x5b0d82){return client[_0xa615('0x1')](_0xa615('0x2'),{'body':_0x5b0d82,'options':{'where':{'id':_0x21ebaf}},'log':_0xa615('0x3')});};exports[_0xa615('0x4')]=function(_0x52ae35,_0x1d9a38){return client[_0xa615('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x1d9a38,'options':{'where':{'id':_0x52ae35}},'log':_0xa615('0x5')});}; \ No newline at end of file +var _0x639d=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','addTags'];(function(_0x2fcf18,_0x10009a){var _0x4c68cc=function(_0x444002){while(--_0x444002){_0x2fcf18['push'](_0x2fcf18['shift']());}};_0x4c68cc(++_0x10009a);}(_0x639d,0xbb));var _0xd639=function(_0x14fdea,_0x25baf1){_0x14fdea=_0x14fdea-0x0;var _0x3c1b5c=_0x639d[_0x14fdea];return _0x3c1b5c;};'use strict';var client=require(_0xd639('0x0'));exports[_0xd639('0x1')]=function(_0xd1f88b,_0x4987ad){return client[_0xd639('0x2')](_0xd639('0x3'),{'body':_0x4987ad,'options':{'where':{'id':_0xd1f88b}},'log':'updateWhatsappInteraction'});};exports[_0xd639('0x4')]=function(_0x588a30,_0x19b990){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x19b990,'options':{'where':{'id':_0x588a30}},'log':_0xd639('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index f398d93..a1ccd65 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 _0x99bf=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x5deb11,_0x1081ed){var _0xf608cf=function(_0x5105b2){while(--_0x5105b2){_0x5deb11['push'](_0x5deb11['shift']());}};_0xf608cf(++_0x1081ed);}(_0x99bf,0x16a));var _0xf99b=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0x99bf[_0x20cf8a];return _0x54e165;};'use strict';var client=require(_0xf99b('0x0'));exports[_0xf99b('0x1')]=function(_0x513369){return client[_0xf99b('0x2')](_0xf99b('0x3'),{'body':_0x513369,'log':_0xf99b('0x4')});}; \ No newline at end of file +var _0x33d6=['../client','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x18a7d4,_0xd93dea){var _0x55457a=function(_0x16df4a){while(--_0x16df4a){_0x18a7d4['push'](_0x18a7d4['shift']());}};_0x55457a(++_0xd93dea);}(_0x33d6,0x1da));var _0x633d=function(_0x344073,_0x443928){_0x344073=_0x344073-0x0;var _0x22aa0d=_0x33d6[_0x344073];return _0x22aa0d;};'use strict';var client=require(_0x633d('0x0'));exports['create']=function(_0x492941){return client['Request'](_0x633d('0x1'),{'body':_0x492941,'log':_0x633d('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 931bec7..652bc3b 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 _0x3423=['whatsappPause','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online'];(function(_0x408145,_0xdb34f){var _0x4fb97d=function(_0x166483){while(--_0x166483){_0x408145['push'](_0x408145['shift']());}};_0x4fb97d(++_0xdb34f);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x3342('0x0')](_0x3342('0x1'),{'options':{'raw':![],'attributes':['id',_0x3342('0x2'),_0x3342('0x3'),_0x3342('0x4')],'include':[{'model':_0x3342('0x5'),'as':_0x3342('0x6'),'attributes':['id',_0x3342('0x2'),_0x3342('0x7'),_0x3342('0x8')]}]},'log':_0x3342('0x9')});};}; \ No newline at end of file +var _0x9d9b=['name','strategy','User','Agents','online','getWhatsappQueues','Request'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0xfe3aed,_0x1558b2){_0xfe3aed=_0xfe3aed-0x0;var _0x8cbbc2=_0x9d9b[_0xfe3aed];return _0x8cbbc2;};'use strict';var client=require('../client');exports[_0xb9d9('0x0')]=function(){return function(){return client[_0xb9d9('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xb9d9('0x2'),'timeout',_0xb9d9('0x3')],'include':[{'model':_0xb9d9('0x4'),'as':_0xb9d9('0x5'),'attributes':['id','name',_0xb9d9('0x6'),'whatsappPause']}]},'log':_0xb9d9('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index df95ce8..3e61f6d 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 _0x0250=['update','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x4d4a59,_0x21ab68){var _0x59167c=function(_0x2cb679){while(--_0x2cb679){_0x4d4a59['push'](_0x4d4a59['shift']());}};_0x59167c(++_0x21ab68);}(_0x0250,0xf8));var _0x0025=function(_0x6e6f4c,_0x4586dd){_0x6e6f4c=_0x6e6f4c-0x0;var _0x5bfa67=_0x0250[_0x6e6f4c];return _0x5bfa67;};'use strict';var client=require(_0x0025('0x0'));exports[_0x0025('0x1')]=function(_0x23c3ff){return client[_0x0025('0x2')](_0x0025('0x3'),{'body':_0x23c3ff,'log':_0x0025('0x3')});};exports[_0x0025('0x4')]=function(_0x4a4061,_0x5545bf){return client[_0x0025('0x2')](_0x0025('0x5'),{'body':_0x5545bf,'options':{'where':{'uniqueid':_0x4a4061},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xb382=['Request','DESC','UpdateWhatsappQueueReport','create'];(function(_0x45e7ae,_0x14f90b){var _0x54aa5a=function(_0xe92e06){while(--_0xe92e06){_0x45e7ae['push'](_0x45e7ae['shift']());}};_0x54aa5a(++_0x14f90b);}(_0xb382,0x12f));var _0x2b38=function(_0x1addfc,_0x39af95){_0x1addfc=_0x1addfc-0x0;var _0x3611a0=_0xb382[_0x1addfc];return _0x3611a0;};'use strict';var client=require('../client');exports[_0x2b38('0x0')]=function(_0x3066ef){return client['Request']('CreateWhatsappQueueReport',{'body':_0x3066ef,'log':'CreateWhatsappQueueReport'});};exports['update']=function(_0x32b7dc,_0x447bef){return client[_0x2b38('0x1')]('UpdateWhatsappQueueReport',{'body':_0x447bef,'options':{'where':{'uniqueid':_0x32b7dc},'order':[['id',_0x2b38('0x2')]],'limit':0x1},'log':_0x2b38('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 525a591..9942b38 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 _0x81c2=['length','[%s][AGENT]\x20%s','map','join','stop','find','agents','timeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence'];(function(_0x62ae03,_0xe5a1d2){var _0x335278=function(_0x373cc3){while(--_0x373cc3){_0x62ae03['push'](_0x62ae03['shift']());}};_0x335278(++_0xe5a1d2);}(_0x81c2,0xee));var _0x281c=function(_0x3ca29d,_0x5a8d31){_0x3ca29d=_0x3ca29d-0x0;var _0x5c5d2e=_0x81c2[_0x3ca29d];return _0x5c5d2e;};'use strict';var schema=require(_0x281c('0x0'));var _=require('lodash');var util=require('util');var seqqueue=require(_0x281c('0x1'));var logger=require(_0x281c('0x2'))(_0x281c('0x3'));var strategy=require(_0x281c('0x4'));var queue=schema({'name':{'type':_0x281c('0x5'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x281c('0x6'),'message':_0x281c('0x7')}});function writeLog(_0x1b5147,_0x39ae60,_0x1bc2cd){return logger[_0x281c('0x8')](util[_0x281c('0x9')](_0x281c('0xa'),_0x1b5147,_0x39ae60[_0x281c('0xb')],_0x1bc2cd));}function handleFindAgent(_0x10d919){return function(_0x292824){return _0x292824[_0x281c('0xb')][_0x281c('0xc')]()===_0x10d919['toLowerCase']();};}exports[_0x281c('0xd')]=function(_0x313b57,_0x182aac,_0x1a2a3e,_0x35d28e){return function(_0x484241){try{var _0x2faa18={'name':_0x182aac[0x0],'timeout':_0x182aac[0x1]};var _0xe6a1a4=queue[_0x281c('0x0')](_0x2faa18,{'typecast':!![]});if(_0xe6a1a4[_0x281c('0xe')]){logger['error'](_0x281c('0xf'),_0x313b57,_[_0x281c('0x10')](_0xe6a1a4,'message')[_0x281c('0x11')](',\x20'));_0x484241[_0x281c('0x12')]();}else{var _0x26f1ff=_[_0x281c('0x13')](_0x1a2a3e[_0x281c('0x14')],handleFindAgent(_0x2faa18[_0x281c('0xb')]));if(_0x26f1ff){var _0x24f4db=(_0x2faa18[_0x281c('0x15')]||0xa)*0x3e8;var _0x176ee4,_0x5ecc71;var _0x218da6=seqqueue['createQueue'](_0x24f4db);_0x218da6['id']=_0x313b57;_0x218da6['atimeout']=_0x24f4db;_0x218da6['channel']=_0x35d28e[_0x281c('0x16')];writeLog(_0x313b57,_0x26f1ff,util[_0x281c('0x9')]('START:%s',_0x24f4db));_0x1a2a3e[_0x281c('0x17')][_0x313b57]['on'](_0x281c('0x18'),function(){logger[_0x281c('0x8')](_0x281c('0x19'),_0x313b57);clearTimeout(_0x5ecc71);_0x5ecc71=undefined;_0x218da6[_0x281c('0x1a')]();if(_0x1a2a3e['rules'][_0x313b57]){delete _0x1a2a3e[_0x281c('0x17')][_0x313b57];}_0x484241[_0x281c('0x12')]();});_0x1a2a3e['rules'][_0x313b57]['on'](_0x281c('0x1b'),function(){if(_0x1a2a3e[_0x281c('0x17')][_0x313b57]){delete _0x1a2a3e['rules'][_0x313b57];}});_0x5ecc71=setTimeout(function(){logger[_0x281c('0x8')](_0x281c('0x1c'),_0x313b57);clearTimeout(_0x5ecc71);_0x218da6[_0x281c('0x1a')]();_0x484241[_0x281c('0x1d')]();},_0x24f4db);strategy[_0x281c('0x1e')](_0x218da6,_0x26f1ff,_0x1a2a3e,_0x35d28e);}else{logger[_0x281c('0x1f')](_0x281c('0x20'),_0x313b57,_0x2faa18['name']);_0x484241['stop']();}}}catch(_0x24e67c){console[_0x281c('0x21')](_0x24e67c);logger['error'](_0x281c('0x22'),_0x313b57,_0x24e67c[_0x281c('0x23')]);_0x484241[_0x281c('0x12')]();}};}; \ No newline at end of file +var _0x7744=['stack','lodash','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','join','stop','find','agents','timeout','createQueue','atimeout','channel','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x4379bf,_0x19ac36){var _0x25d903=function(_0x26d363){while(--_0x26d363){_0x4379bf['push'](_0x4379bf['shift']());}};_0x25d903(++_0x19ac36);}(_0x7744,0x182));var _0x4774=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x7744[_0x39e84d];return _0x1991bc;};'use strict';var schema=require('validate');var _=require(_0x4774('0x0'));var util=require('util');var seqqueue=require(_0x4774('0x1'));var logger=require('../../../../config/logger')(_0x4774('0x2'));var strategy=require(_0x4774('0x3'));var queue=schema({'name':{'type':_0x4774('0x4'),'required':!![],'message':_0x4774('0x5')},'timeout':{'type':_0x4774('0x6'),'message':_0x4774('0x7')}});function writeLog(_0x52a176,_0x1371d5,_0x34f01a){return logger['info'](util[_0x4774('0x8')](_0x4774('0x9'),_0x52a176,_0x1371d5[_0x4774('0xa')],_0x34f01a));}function handleFindAgent(_0x1472c3){return function(_0x1b26ad){return _0x1b26ad[_0x4774('0xa')][_0x4774('0xb')]()===_0x1472c3[_0x4774('0xb')]();};}exports[_0x4774('0xc')]=function(_0x466866,_0x2fe1e1,_0x2e0ddc,_0x56b99f){return function(_0x13de35){try{var _0x250da5={'name':_0x2fe1e1[0x0],'timeout':_0x2fe1e1[0x1]};var _0x4f358d=queue['validate'](_0x250da5,{'typecast':!![]});if(_0x4f358d[_0x4774('0xd')]){logger[_0x4774('0xe')]('[%s][AGENT]\x20%s',_0x466866,_[_0x4774('0xf')](_0x4f358d,'message')[_0x4774('0x10')](',\x20'));_0x13de35[_0x4774('0x11')]();}else{var _0x4712e5=_[_0x4774('0x12')](_0x2e0ddc[_0x4774('0x13')],handleFindAgent(_0x250da5['name']));if(_0x4712e5){var _0x33a204=(_0x250da5[_0x4774('0x14')]||0xa)*0x3e8;var _0x52e34b,_0x1c545a;var _0x169771=seqqueue[_0x4774('0x15')](_0x33a204);_0x169771['id']=_0x466866;_0x169771[_0x4774('0x16')]=_0x33a204;_0x169771[_0x4774('0x17')]=_0x56b99f[_0x4774('0x17')];writeLog(_0x466866,_0x4712e5,util['format']('START:%s',_0x33a204));_0x2e0ddc['rules'][_0x466866]['on'](_0x4774('0x18'),function(){logger[_0x4774('0x19')](_0x4774('0x1a'),_0x466866);clearTimeout(_0x1c545a);_0x1c545a=undefined;_0x169771[_0x4774('0x1b')]();if(_0x2e0ddc[_0x4774('0x1c')][_0x466866]){delete _0x2e0ddc[_0x4774('0x1c')][_0x466866];}_0x13de35[_0x4774('0x11')]();});_0x2e0ddc[_0x4774('0x1c')][_0x466866]['on'](_0x4774('0x1d'),function(){if(_0x2e0ddc[_0x4774('0x1c')][_0x466866]){delete _0x2e0ddc[_0x4774('0x1c')][_0x466866];}});_0x1c545a=setTimeout(function(){logger[_0x4774('0x19')](_0x4774('0x1e'),_0x466866);clearTimeout(_0x1c545a);_0x169771[_0x4774('0x1b')]();_0x13de35[_0x4774('0x1f')]();},_0x33a204);strategy[_0x4774('0x20')](_0x169771,_0x4712e5,_0x2e0ddc,_0x56b99f);}else{logger['error'](_0x4774('0x21'),_0x466866,_0x250da5[_0x4774('0xa')]);_0x13de35[_0x4774('0x11')]();}}}catch(_0x4773c9){console['log'](_0x4773c9);logger[_0x4774('0xe')]('[%s][QUEUE]\x20%s',_0x466866,_0x4773c9[_0x4774('0x22')]);_0x13de35[_0x4774('0x11')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 9521b23..7f5feef 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 _0xb350=['InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','info','catch','error','stringify','finally','stop','LexRuntime','$LATEST','message','postText','amazonlex','create','then','Failed','moment','aws-sdk','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x131a70,_0x5f53b2){var _0x212967=function(_0x2a43ac){while(--_0x2a43ac){_0x131a70['push'](_0x131a70['shift']());}};_0x212967(++_0x5f53b2);}(_0xb350,0x134));var _0x0b35=function(_0x5b0fc0,_0x25d5a5){_0x5b0fc0=_0x5b0fc0-0x0;var _0x1f5a47=_0xb350[_0x5b0fc0];return _0x1f5a47;};'use strict';var _=require('lodash');var moment=require(_0x0b35('0x0'));var AWS=require(_0x0b35('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x0b35('0x2'));var rpc={'chatMessage':require(_0x0b35('0x3')),'openchannelMessage':require(_0x0b35('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x0b35('0x5')),'faxMessage':require(_0x0b35('0x6'))};exports[_0x0b35('0x7')]=function(_0x178c9c,_0x5d0802){return function(_0x140651){try{if(!_[_0x0b35('0x8')](this['interaction'][_0x0b35('0x9')])){logger['info'](_0x0b35('0xa'),_0x178c9c,_0x0b35('0xb'));return _0x140651[_0x0b35('0xc')]();}var _0x2555ab={'ContactId':this[_0x0b35('0xd')]['id'],'sentAt':moment()['format'](_0x0b35('0xe')),'direction':_0x0b35('0xf')};var _0x34b597=this['channel'];if(_0x34b597==='chat'){_0x2555ab[_0x0b35('0x10')]=this[_0x0b35('0x11')]['id'];}else{_0x2555ab[_[_0x0b35('0x12')](_0x34b597)+_0x0b35('0x13')]=this['account']['id'];}_0x2555ab[_[_0x0b35('0x12')](_0x34b597)+_0x0b35('0x14')]=this[_0x0b35('0x15')]['id'];if(this['interaction'][_0x0b35('0x16')]){var _0x126243=_0x5d0802[0x4];if(!_[_0x0b35('0x17')](_0x126243)){_0x2555ab[_0x0b35('0x18')]=utils[_0x0b35('0x19')](_0x126243,this);return rpc[_0x34b597+_0x0b35('0x1a')]['create'](_0x2555ab)['then'](function(_0x4b10b5){logger[_0x0b35('0x1b')](_0x0b35('0xa'),_0x178c9c,_0x2555ab['body']);})[_0x0b35('0x1c')](function(_0x577f48){logger[_0x0b35('0x1d')](_0x0b35('0xa'),_0x178c9c,JSON[_0x0b35('0x1e')](_0x577f48));})[_0x0b35('0x1f')](function(){logger[_0x0b35('0x1b')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x178c9c);_0x140651[_0x0b35('0x20')]();});}else{logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x178c9c);_0x140651[_0x0b35('0x20')]();}}else{var _0x449726=this;var _0x4729fb=new AWS[(_0x0b35('0x21'))]({'accessKeyId':_0x5d0802[0x0],'secretAccessKey':_0x5d0802[0x1],'region':_0x5d0802[0x2]});var _0x6df0de={'botAlias':_0x0b35('0x22'),'botName':_0x5d0802[0x3],'inputText':this[_0x0b35('0x23')][_0x0b35('0x18')],'userId':this[_0x0b35('0x15')]['id']['toString']()};_0x4729fb[_0x0b35('0x24')](_0x6df0de,function(_0x5de5f3,_0x525967){if(_0x5de5f3){logger[_0x0b35('0x1d')](_0x0b35('0xa'),_0x178c9c,_0x5de5f3[_0x0b35('0x23')]);_0x140651[_0x0b35('0xc')]();}else if(_0x525967&&_0x525967[_0x0b35('0x23')]){_0x449726[_0x0b35('0x18')][_0x0b35('0x25')]=_0x525967;_0x2555ab['body']=_0x525967[_0x0b35('0x23')];return rpc[_0x34b597+_0x0b35('0x1a')][_0x0b35('0x26')](_0x2555ab)[_0x0b35('0x27')](function(_0x4a395e){logger[_0x0b35('0x1b')](_0x0b35('0xa'),_0x178c9c,_0x2555ab['body']);if(_0x525967['dialogState']==_0x0b35('0x28')){_0x140651[_0x0b35('0xc')]();}else{_0x140651[_0x0b35('0x20')]();}})[_0x0b35('0x1c')](function(_0x17b338){logger[_0x0b35('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x178c9c,JSON[_0x0b35('0x1e')](_0x17b338));_0x140651[_0x0b35('0xc')]();});}else{_0x140651[_0x0b35('0xc')]();}});}}catch(_0x3dbc7e){logger['error']('[%s][AMAZONLEX]\x20%s',_0x178c9c,JSON[_0x0b35('0x1e')](_0x3dbc7e));_0x140651[_0x0b35('0x20')]();}};}; \ No newline at end of file +var _0x4318=['contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','catch','error','[%s][AMAZONLEX]\x20%s','stringify','finally','stop','LexRuntime','$LATEST','message','postText','amazonlex','dialogState','Failed','next','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x4318,0x7b));var _0x8431=function(_0x126052,_0x2f5a69){_0x126052=_0x126052-0x0;var _0x49bf1a=_0x4318[_0x126052];return _0x49bf1a;};'use strict';var _=require(_0x8431('0x0'));var moment=require(_0x8431('0x1'));var AWS=require(_0x8431('0x2'));var utils=require(_0x8431('0x3'));var logger=require(_0x8431('0x4'))(_0x8431('0x5'));var rpc={'chatMessage':require(_0x8431('0x6')),'openchannelMessage':require(_0x8431('0x7')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x8431('0x8')),'faxMessage':require(_0x8431('0x9'))};exports['consequence']=function(_0x2b30ba,_0x4d60e2){return function(_0x3dcff7){try{if(!_[_0x8431('0xa')](this[_0x8431('0xb')][_0x8431('0xc')])){logger[_0x8431('0xd')]('[%s][AMAZONLEX]\x20%s',_0x2b30ba,_0x8431('0xe'));return _0x3dcff7['next']();}var _0x51e397={'ContactId':this[_0x8431('0xf')]['id'],'sentAt':moment()[_0x8431('0x10')](_0x8431('0x11')),'direction':_0x8431('0x12')};var _0x2c00b7=this[_0x8431('0x13')];if(_0x2c00b7===_0x8431('0x14')){_0x51e397[_0x8431('0x15')]=this['account']['id'];}else{_0x51e397[_[_0x8431('0x16')](_0x2c00b7)+_0x8431('0x17')]=this[_0x8431('0x18')]['id'];}_0x51e397[_[_0x8431('0x16')](_0x2c00b7)+_0x8431('0x19')]=this[_0x8431('0xb')]['id'];if(this[_0x8431('0xb')]['created']){var _0x8d9b2c=_0x4d60e2[0x4];if(!_[_0x8431('0x1a')](_0x8d9b2c)){_0x51e397[_0x8431('0x1b')]=utils[_0x8431('0x1c')](_0x8d9b2c,this);return rpc[_0x2c00b7+_0x8431('0x1d')][_0x8431('0x1e')](_0x51e397)[_0x8431('0x1f')](function(_0x4eb8f5){logger[_0x8431('0xd')]('[%s][AMAZONLEX]\x20%s',_0x2b30ba,_0x51e397[_0x8431('0x1b')]);})[_0x8431('0x20')](function(_0xcb4a27){logger[_0x8431('0x21')](_0x8431('0x22'),_0x2b30ba,JSON[_0x8431('0x23')](_0xcb4a27));})[_0x8431('0x24')](function(){logger[_0x8431('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2b30ba);_0x3dcff7['stop']();});}else{logger[_0x8431('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x2b30ba);_0x3dcff7[_0x8431('0x25')]();}}else{var _0x501128=this;var _0x1a0068=new AWS[(_0x8431('0x26'))]({'accessKeyId':_0x4d60e2[0x0],'secretAccessKey':_0x4d60e2[0x1],'region':_0x4d60e2[0x2]});var _0x268774={'botAlias':_0x8431('0x27'),'botName':_0x4d60e2[0x3],'inputText':this[_0x8431('0x28')]['body'],'userId':this['interaction']['id']['toString']()};_0x1a0068[_0x8431('0x29')](_0x268774,function(_0x33f79d,_0x5c06f7){if(_0x33f79d){logger[_0x8431('0x21')](_0x8431('0x22'),_0x2b30ba,_0x33f79d['message']);_0x3dcff7['next']();}else if(_0x5c06f7&&_0x5c06f7['message']){_0x501128[_0x8431('0x1b')][_0x8431('0x2a')]=_0x5c06f7;_0x51e397[_0x8431('0x1b')]=_0x5c06f7[_0x8431('0x28')];return rpc[_0x2c00b7+_0x8431('0x1d')]['create'](_0x51e397)[_0x8431('0x1f')](function(_0x39ad41){logger[_0x8431('0xd')](_0x8431('0x22'),_0x2b30ba,_0x51e397[_0x8431('0x1b')]);if(_0x5c06f7[_0x8431('0x2b')]==_0x8431('0x2c')){_0x3dcff7['next']();}else{_0x3dcff7[_0x8431('0x25')]();}})['catch'](function(_0x5880ab){logger['error'](_0x8431('0x22'),_0x2b30ba,JSON[_0x8431('0x23')](_0x5880ab));_0x3dcff7[_0x8431('0x2d')]();});}else{_0x3dcff7['next']();}});}}catch(_0x2c400c){logger['error'](_0x8431('0x22'),_0x2b30ba,JSON[_0x8431('0x23')](_0x2c400c));_0x3dcff7[_0x8431('0x25')]();}};}; \ 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 a0f22f9..9b73fb8 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 _0xe706=['next','channel','getMustacheRender','YYYY-MM-DD\x20HH:mm:ss','out','message','from','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','messageId','html','','replace','body','';return mailRpc[_0x6e70('0x33')](_0x228350,_0x37b3e0)['then'](function(_0x259486){logger['info'](_0x6e70('0x34'),_0x1b0389);_0x37b3e0[_0x6e70('0x2c')]=_0x259486[_0x6e70('0x16')]['messageId'];return rpc[_0x743eb5+_0x6e70('0x22')][_0x6e70('0x35')](_0x37b3e0);})['then'](function(_0x13d673){logger[_0x6e70('0xe')]('[%s][AUTOREPLY]\x20%s',_0x1b0389,JSON[_0x6e70('0x36')](_0x13d673));})[_0x6e70('0x37')](function(_0x2d52bd){logger[_0x6e70('0x38')](_0x6e70('0x39'),_0x1b0389,JSON[_0x6e70('0x36')](_0x2d52bd));})[_0x6e70('0x3a')](function(){_0x36357b[_0x6e70('0x11')]();});}else{return rpc[this[_0x6e70('0x12')]+_0x6e70('0x22')]['create'](_0x37b3e0)[_0x6e70('0x3b')](function(_0x4795a0){logger[_0x6e70('0xe')](_0x6e70('0xf'),_0x1b0389,_0x37b3e0[_0x6e70('0x30')]);})[_0x6e70('0x37')](function(_0x233a83){logger[_0x6e70('0x38')](_0x6e70('0xf'),_0x1b0389,JSON[_0x6e70('0x36')](_0x233a83));})[_0x6e70('0x3a')](function(){_0x36357b[_0x6e70('0x11')]();});}}}catch(_0x2a5444){logger[_0x6e70('0x38')](_0x6e70('0xf'),_0x1b0389,JSON['stringify'](_0x2a5444));_0x36357b['stop']();}};}; \ No newline at end of file +var _0xd8b0=['upperFirst','AccountId','InteractionId','Message','service','Smtp','host','port','secure','pass','html','replace','','messageId','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','lodash','moment','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','YYYY-MM-DD\x20HH:mm:ss','out','message','from','phone','read','subject','startsWith','Re:','chat','ChatWebsiteId','account'];(function(_0xf01be4,_0x5848b7){var _0x33a958=function(_0x57dd2b){while(--_0x57dd2b){_0xf01be4['push'](_0xf01be4['shift']());}};_0x33a958(++_0x5848b7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x0d8b('0x2')),'openchannelMessage':require(_0x0d8b('0x3')),'mailMessage':require(_0x0d8b('0x4')),'smsMessage':require(_0x0d8b('0x5')),'faxMessage':require(_0x0d8b('0x6'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x3f8b6f,_0x227c63){return function(_0x39f43a){try{if(_0x227c63[0x0]==='1'&&(_['isNil'](this[_0x0d8b('0x7')][_0x0d8b('0x8')])||!this['interaction'][_0x0d8b('0x8')])){logger[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x3f8b6f,_0x0d8b('0xb'));return _0x39f43a[_0x0d8b('0xc')]();}var _0x1cac62=this[_0x0d8b('0xd')];var _0x28f87c={'body':utils['getMustacheRender'](_0x227c63[0x1],this),'ContactId':this[_0x0d8b('0xe')]['id'],'sentAt':moment()['format'](_0x0d8b('0xf')),'direction':_0x0d8b('0x10')};if(this[_0x0d8b('0x11')]){_0x28f87c['to']=this[_0x0d8b('0x11')][_0x0d8b('0x12')]||'';_0x28f87c['cc']=this[_0x0d8b('0x11')]['cc']||'';_0x28f87c[_0x0d8b('0x12')]=this[_0x0d8b('0x11')]['to']||'';_0x28f87c[_0x0d8b('0x13')]=this[_0x0d8b('0x11')][_0x0d8b('0x13')]||'';_0x28f87c[_0x0d8b('0x14')]=!![];if(this[_0x0d8b('0x11')][_0x0d8b('0x15')]){_0x28f87c['subject']='';_0x28f87c[_0x0d8b('0x15')]+=_[_0x0d8b('0x16')](this[_0x0d8b('0x11')][_0x0d8b('0x15')],_0x0d8b('0x17'))?'':'Re:\x20';_0x28f87c[_0x0d8b('0x15')]+=this[_0x0d8b('0x11')][_0x0d8b('0x15')];}}if(this[_0x0d8b('0xd')]===_0x0d8b('0x18')){_0x28f87c[_0x0d8b('0x19')]=this[_0x0d8b('0x1a')]['id'];}else{_0x28f87c[_[_0x0d8b('0x1b')](this['channel'])+_0x0d8b('0x1c')]=this[_0x0d8b('0x1a')]['id'];}_0x28f87c[_[_0x0d8b('0x1b')](this[_0x0d8b('0xd')])+_0x0d8b('0x1d')]=this[_0x0d8b('0x7')]['id'];if(rpc[this[_0x0d8b('0xd')]+_0x0d8b('0x1e')]){if(this['channel']==='mail'){var _0x33fb87={'tls':{'rejectUnauthorized':![]}};if(this['account']['Smtp']['service']){_0x33fb87[_0x0d8b('0x1f')]=this[_0x0d8b('0x1a')][_0x0d8b('0x20')][_0x0d8b('0x1f')];}else{_0x33fb87[_0x0d8b('0x21')]=this[_0x0d8b('0x1a')][_0x0d8b('0x20')][_0x0d8b('0x21')];_0x33fb87[_0x0d8b('0x22')]=this['account'][_0x0d8b('0x20')][_0x0d8b('0x22')];_0x33fb87['secure']=this[_0x0d8b('0x1a')]['Smtp'][_0x0d8b('0x23')];}if(this[_0x0d8b('0x1a')][_0x0d8b('0x20')]['authentication']){_0x33fb87['auth']={'user':this[_0x0d8b('0x1a')][_0x0d8b('0x20')]['user'],'pass':this[_0x0d8b('0x1a')]['Smtp'][_0x0d8b('0x24')]};}_0x28f87c['inReplyTo']=this[_0x0d8b('0x11')]['messageId'];_0x28f87c[_0x0d8b('0x25')]=''+_[_0x0d8b('0x26')](_0x28f87c['body'],_0x0d8b('0x27'),_0x0d8b('0x28'))+_0x0d8b('0x29');return mailRpc['sendMailMessage'](_0x33fb87,_0x28f87c)['then'](function(_0x51cf32){logger[_0x0d8b('0x9')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x3f8b6f);_0x28f87c[_0x0d8b('0x2a')]=_0x51cf32['message']['messageId'];return rpc[_0x1cac62+_0x0d8b('0x1e')][_0x0d8b('0x2b')](_0x28f87c);})[_0x0d8b('0x2c')](function(_0xdeee5d){logger[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x3f8b6f,JSON[_0x0d8b('0x2d')](_0xdeee5d));})[_0x0d8b('0x2e')](function(_0x553e03){logger[_0x0d8b('0x2f')](_0x0d8b('0x30'),_0x3f8b6f,JSON['stringify'](_0x553e03));})[_0x0d8b('0x31')](function(){_0x39f43a[_0x0d8b('0xc')]();});}else{return rpc[this[_0x0d8b('0xd')]+'Message'][_0x0d8b('0x2b')](_0x28f87c)[_0x0d8b('0x2c')](function(_0x206157){logger[_0x0d8b('0x9')](_0x0d8b('0xa'),_0x3f8b6f,_0x28f87c['body']);})[_0x0d8b('0x2e')](function(_0x1649fc){logger['error'](_0x0d8b('0xa'),_0x3f8b6f,JSON[_0x0d8b('0x2d')](_0x1649fc));})[_0x0d8b('0x31')](function(){_0x39f43a[_0x0d8b('0xc')]();});}}}catch(_0x373544){logger['error']('[%s][AUTOREPLY]\x20%s',_0x3f8b6f,JSON[_0x0d8b('0x2d')](_0x373544));_0x39f43a['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index db732e4..81a98a2 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 _0xa9e1=['channel','then','catch','error','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system'];(function(_0x46eb1a,_0x3089d6){var _0x172f2b=function(_0x539fa5){while(--_0x539fa5){_0x46eb1a['push'](_0x46eb1a['shift']());}};_0x172f2b(++_0x3089d6);}(_0xa9e1,0x7a));var _0x1a9e=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0xa9e1[_0x109371];return _0x4fd858;};'use strict';var moment=require(_0x1a9e('0x0'));var logger=require(_0x1a9e('0x1'))('routing');var rpc={'chatInteraction':require(_0x1a9e('0x2')),'openchannelInteraction':require(_0x1a9e('0x3')),'smsInteraction':require(_0x1a9e('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1a9e('0x5'))};exports['consequence']=function(_0x41dd4f,_0x4db6c5,_0x203050,_0x40c9b0){return function(_0x1bdcd9){try{logger[_0x1a9e('0x6')](_0x1a9e('0x7'),_0x41dd4f,_0x4db6c5[0x0]);var _0x91b2c3={'closed':0x1,'closedAt':moment()[_0x1a9e('0x8')](_0x1a9e('0x9')),'closeReason':_0x1a9e('0xa'),'disposition':_0x4db6c5[0x0]};if(rpc[_0x40c9b0[_0x1a9e('0xb')]+'Interaction']){rpc[_0x40c9b0[_0x1a9e('0xb')]+'Interaction']['update'](_0x40c9b0['interaction']['id'],_0x91b2c3)[_0x1a9e('0xc')](function(_0x56b523){logger[_0x1a9e('0x6')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x41dd4f,_0x40c9b0['interaction']['id']);})[_0x1a9e('0xd')](function(_0x5159a4){logger[_0x1a9e('0xe')]('[%s][CLOSE]\x20%s',_0x41dd4f,JSON[_0x1a9e('0xf')](_0x5159a4));})[_0x1a9e('0x10')](function(){_0x1bdcd9[_0x1a9e('0x11')]();});}}catch(_0x31ac0b){logger[_0x1a9e('0xe')](_0x1a9e('0x12'),_0x41dd4f,JSON[_0x1a9e('0xf')](_0x31ac0b));_0x1bdcd9[_0x1a9e('0x11')]();}};}; \ No newline at end of file +var _0x4fc2=['then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction'];(function(_0xafd9c1,_0x219695){var _0x213e09=function(_0x12569c){while(--_0x12569c){_0xafd9c1['push'](_0xafd9c1['shift']());}};_0x213e09(++_0x219695);}(_0x4fc2,0x111));var _0x24fc=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0x4fc2[_0x57d13b];return _0x467696;};'use strict';var moment=require(_0x24fc('0x0'));var logger=require(_0x24fc('0x1'))(_0x24fc('0x2'));var rpc={'chatInteraction':require(_0x24fc('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x24fc('0x4')),'mailInteraction':require(_0x24fc('0x5')),'faxInteraction':require(_0x24fc('0x6'))};exports['consequence']=function(_0x126d90,_0x3772eb,_0x58dafc,_0x26fcc6){return function(_0x12d602){try{logger['info'](_0x24fc('0x7'),_0x126d90,_0x3772eb[0x0]);var _0x22a0c8={'closed':0x1,'closedAt':moment()[_0x24fc('0x8')](_0x24fc('0x9')),'closeReason':_0x24fc('0xa'),'disposition':_0x3772eb[0x0]};if(rpc[_0x26fcc6[_0x24fc('0xb')]+'Interaction']){rpc[_0x26fcc6[_0x24fc('0xb')]+_0x24fc('0xc')][_0x24fc('0xd')](_0x26fcc6[_0x24fc('0xe')]['id'],_0x22a0c8)[_0x24fc('0xf')](function(_0x2de64d){logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x126d90,_0x26fcc6['interaction']['id']);})[_0x24fc('0x12')](function(_0x1cde5d){logger['error'](_0x24fc('0x13'),_0x126d90,JSON[_0x24fc('0x14')](_0x1cde5d));})[_0x24fc('0x15')](function(){_0x12d602[_0x24fc('0x16')]();});}}catch(_0x30f19b){logger[_0x24fc('0x17')]('[%s][CLOSE]\x20%s',_0x126d90,JSON[_0x24fc('0x14')](_0x30f19b));_0x12d602[_0x24fc('0x16')]();}};}; \ 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 a57612e..bf4e203 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 _0xdf4c=['error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','dialogflow','result','fulfillment','create','endConversation','catch','next','lodash','moment','md5','../../rpc/mailMessage','../../rpc/smsMessage','consequence','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','then','[%s][DIALOGFLOW]\x20%s'];(function(_0x44c5c8,_0x41d77b){var _0x22aeee=function(_0x1fd86e){while(--_0x1fd86e){_0x44c5c8['push'](_0x44c5c8['shift']());}};_0x22aeee(++_0x41d77b);}(_0xdf4c,0xf0));var _0xcdf4=function(_0x2a24b2,_0x171540){_0x2a24b2=_0x2a24b2-0x0;var _0x2ed7d3=_0xdf4c[_0x2a24b2];return _0x2ed7d3;};'use strict';var _=require(_0xcdf4('0x0'));var moment=require(_0xcdf4('0x1'));var apiai=require('apiai-promise');var md5=require(_0xcdf4('0x2'));var utils=require('./utils');var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xcdf4('0x3')),'smsMessage':require(_0xcdf4('0x4')),'faxMessage':require('../../rpc/faxMessage')};exports[_0xcdf4('0x5')]=function(_0x533c95,_0x296c79){return function(_0x208131){try{if(!_['isNil'](this['interaction'][_0xcdf4('0x6')])){logger[_0xcdf4('0x7')]('[%s][DIALOGFLOW]\x20%s',_0x533c95,_0xcdf4('0x8'));return _0x208131['next']();}var _0x2ec3f0={'ContactId':this[_0xcdf4('0x9')]['id'],'sentAt':moment()['format'](_0xcdf4('0xa')),'direction':'out'};var _0x12a521=this[_0xcdf4('0xb')];if(_0x12a521===_0xcdf4('0xc')){_0x2ec3f0[_0xcdf4('0xd')]=this[_0xcdf4('0xe')]['id'];}else{_0x2ec3f0[_['upperFirst'](_0x12a521)+_0xcdf4('0xf')]=this[_0xcdf4('0xe')]['id'];}_0x2ec3f0[_[_0xcdf4('0x10')](_0x12a521)+_0xcdf4('0x11')]=this['interaction']['id'];if(this[_0xcdf4('0x12')][_0xcdf4('0x13')]){var _0x3c649e=_0x296c79[0x2];if(!_[_0xcdf4('0x14')](_0x3c649e)){_0x2ec3f0[_0xcdf4('0x15')]=utils[_0xcdf4('0x16')](_0x3c649e,this);return rpc[_0x12a521+_0xcdf4('0x17')]['create'](_0x2ec3f0)[_0xcdf4('0x18')](function(_0x40004f){logger[_0xcdf4('0x7')](_0xcdf4('0x19'),_0x533c95,_0x2ec3f0['body']);})['catch'](function(_0x4f8b8a){logger[_0xcdf4('0x1a')]('[%s][DIALOGFLOW]\x20%s',_0x533c95,JSON[_0xcdf4('0x1b')](_0x4f8b8a));})['finally'](function(){logger[_0xcdf4('0x7')](_0xcdf4('0x1c'),_0x533c95);_0x208131[_0xcdf4('0x1d')]();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x533c95);_0x208131[_0xcdf4('0x1d')]();}}else{var _0x2e108e=this;var _0x57ed65=apiai(_0x296c79[0x0],{'language':_0x296c79[0x1]||'en'});return _0x57ed65[_0xcdf4('0x1e')](this['message']['body'],{'sessionId':md5(this[_0xcdf4('0x12')]['id'])})[_0xcdf4('0x18')](function(_0x5ecc27){_0x2e108e[_0xcdf4('0x15')][_0xcdf4('0x1f')]=_0x5ecc27;_0x2ec3f0[_0xcdf4('0x15')]=_0x5ecc27[_0xcdf4('0x20')][_0xcdf4('0x21')]['speech'];return rpc[_0x12a521+'Message'][_0xcdf4('0x22')](_0x2ec3f0)[_0xcdf4('0x18')](function(_0xd6ddab){logger[_0xcdf4('0x7')]('[%s][DIALOGFLOW]\x20%s',_0x533c95,_0x2ec3f0['body']);if(_0x5ecc27[_0xcdf4('0x20')]['metadata'][_0xcdf4('0x23')]){_0x208131['next']();}else{_0x208131[_0xcdf4('0x1d')]();}})[_0xcdf4('0x24')](function(_0x19e508){logger['error'](_0xcdf4('0x19'),_0x533c95,JSON['stringify'](_0x19e508));_0x208131['next']();});})[_0xcdf4('0x24')](function(_0x1c7df9){logger[_0xcdf4('0x1a')](_0xcdf4('0x19'),_0x533c95,_0x1c7df9['message']);_0x208131[_0xcdf4('0x25')]();});}}catch(_0x3c2828){logger[_0xcdf4('0x1a')](_0xcdf4('0x19'),_0x533c95,JSON['stringify'](_0x3c2828));_0x208131[_0xcdf4('0x1d')]();}};}; \ No newline at end of file +var _0x23ce=['next','contact','format','out','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','create','then','info','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!','message','dialogflow','result','fulfillment','speech','Message','metadata','error','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x4f1d02,_0x4a4694){var _0x52fda1=function(_0x4091fe){while(--_0x4091fe){_0x4f1d02['push'](_0x4f1d02['shift']());}};_0x52fda1(++_0x4a4694);}(_0x23ce,0x14c));var _0xe23c=function(_0x59c82d,_0x4b6440){_0x59c82d=_0x59c82d-0x0;var _0x53f0f0=_0x23ce[_0x59c82d];return _0x53f0f0;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0xe23c('0x0'));var utils=require(_0xe23c('0x1'));var logger=require(_0xe23c('0x2'))('routing');var rpc={'chatMessage':require(_0xe23c('0x3')),'openchannelMessage':require(_0xe23c('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xe23c('0x5'))};exports[_0xe23c('0x6')]=function(_0x20ddb8,_0x15ef74){return function(_0x24e748){try{if(!_[_0xe23c('0x7')](this[_0xe23c('0x8')][_0xe23c('0x9')])){logger['info'](_0xe23c('0xa'),_0x20ddb8,_0xe23c('0xb'));return _0x24e748[_0xe23c('0xc')]();}var _0x21d75c={'ContactId':this[_0xe23c('0xd')]['id'],'sentAt':moment()[_0xe23c('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xe23c('0xf')};var _0x29ddc7=this['channel'];if(_0x29ddc7===_0xe23c('0x10')){_0x21d75c[_0xe23c('0x11')]=this['account']['id'];}else{_0x21d75c[_['upperFirst'](_0x29ddc7)+_0xe23c('0x12')]=this[_0xe23c('0x13')]['id'];}_0x21d75c[_[_0xe23c('0x14')](_0x29ddc7)+_0xe23c('0x15')]=this[_0xe23c('0x8')]['id'];if(this[_0xe23c('0x8')][_0xe23c('0x16')]){var _0x5162ff=_0x15ef74[0x2];if(!_[_0xe23c('0x17')](_0x5162ff)){_0x21d75c[_0xe23c('0x18')]=utils[_0xe23c('0x19')](_0x5162ff,this);return rpc[_0x29ddc7+'Message'][_0xe23c('0x1a')](_0x21d75c)[_0xe23c('0x1b')](function(_0x3f37a0){logger[_0xe23c('0x1c')](_0xe23c('0xa'),_0x20ddb8,_0x21d75c[_0xe23c('0x18')]);})[_0xe23c('0x1d')](function(_0x316a77){logger['error'](_0xe23c('0xa'),_0x20ddb8,JSON[_0xe23c('0x1e')](_0x316a77));})[_0xe23c('0x1f')](function(){logger['info'](_0xe23c('0x20'),_0x20ddb8);_0x24e748[_0xe23c('0x21')]();});}else{logger[_0xe23c('0x1c')](_0xe23c('0x22'),_0x20ddb8);_0x24e748['stop']();}}else{var _0x449723=this;var _0x4e9200=apiai(_0x15ef74[0x0],{'language':_0x15ef74[0x1]||'en'});return _0x4e9200['textRequest'](this[_0xe23c('0x23')][_0xe23c('0x18')],{'sessionId':md5(this['interaction']['id'])})[_0xe23c('0x1b')](function(_0x3e2b68){_0x449723[_0xe23c('0x18')][_0xe23c('0x24')]=_0x3e2b68;_0x21d75c[_0xe23c('0x18')]=_0x3e2b68[_0xe23c('0x25')][_0xe23c('0x26')][_0xe23c('0x27')];return rpc[_0x29ddc7+_0xe23c('0x28')][_0xe23c('0x1a')](_0x21d75c)[_0xe23c('0x1b')](function(_0xa49f12){logger[_0xe23c('0x1c')]('[%s][DIALOGFLOW]\x20%s',_0x20ddb8,_0x21d75c[_0xe23c('0x18')]);if(_0x3e2b68[_0xe23c('0x25')][_0xe23c('0x29')]['endConversation']){_0x24e748[_0xe23c('0xc')]();}else{_0x24e748[_0xe23c('0x21')]();}})[_0xe23c('0x1d')](function(_0x3509c3){logger[_0xe23c('0x2a')](_0xe23c('0xa'),_0x20ddb8,JSON[_0xe23c('0x1e')](_0x3509c3));_0x24e748[_0xe23c('0xc')]();});})[_0xe23c('0x1d')](function(_0x5557d5){logger['error'](_0xe23c('0xa'),_0x20ddb8,_0x5557d5[_0xe23c('0x23')]);_0x24e748[_0xe23c('0xc')]();});}}catch(_0x45b098){logger[_0xe23c('0x2a')]('[%s][DIALOGFLOW]\x20%s',_0x20ddb8,JSON[_0xe23c('0x1e')](_0x45b098));_0x24e748['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 8fdad94..811f2ee 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 _0x64ce=['string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','stop','lodash','html-to-text','./utils','../../../../config/logger','routing'];(function(_0xf076da,_0x28fe87){var _0x4a0c00=function(_0x73563d){while(--_0x73563d){_0xf076da['push'](_0xf076da['shift']());}};_0x4a0c00(++_0x28fe87);}(_0x64ce,0x18e));var _0xe64c=function(_0x4716b6,_0x2d0ce2){_0x4716b6=_0x4716b6-0x0;var _0x459ebd=_0x64ce[_0x4716b6];return _0x459ebd;};'use strict';var schema=require('validate');var _=require(_0xe64c('0x0'));var htmlToText=require(_0xe64c('0x1'));var utils=require(_0xe64c('0x2'));var logger=require(_0xe64c('0x3'))(_0xe64c('0x4'));var gotoif=schema({'condition':{'type':_0xe64c('0x5'),'required':!![],'message':_0xe64c('0x6')},'priorityTrue':{'type':_0xe64c('0x7'),'message':_0xe64c('0x8')},'priorityFalse':{'type':'number','message':_0xe64c('0x9')}});exports[_0xe64c('0xa')]=function(_0x38f5c6,_0x611954){return function(_0x17824e){try{var _0x1a7f0f={'condition':htmlToText[_0xe64c('0xb')](utils[_0xe64c('0xc')](_0x611954[0x0],this),{'wordwrap':![]})[_0xe64c('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x611954[0x1],'priorityFalse':_0x611954[0x2]};var _0x56f208=gotoif[_0xe64c('0xe')](_0x1a7f0f,{'typecast':!![]});if(_0x56f208[_0xe64c('0xf')]){logger[_0xe64c('0x10')](_0xe64c('0x11'),_0x38f5c6,_[_0xe64c('0x12')](_0x56f208,'message')['join'](',\x20'));_0x17824e['stop']();}else{try{var _0x304eaf=eval('('+_0x1a7f0f[_0xe64c('0x13')]+')');var _0x1aeeb9=_0x304eaf?_0x1a7f0f[_0xe64c('0x14')]:_0x1a7f0f[_0xe64c('0x15')];logger['info'](_0xe64c('0x16'),_0x38f5c6,_0x1a7f0f['condition'],_0x304eaf,_0x1aeeb9||_0xe64c('0x17'));if(_0x1aeeb9){var _0x34998e=_[_0xe64c('0x18')](_0x17824e[_0xe64c('0x19')](),{'p':_0x1aeeb9});if(_0x34998e>=0x0){logger[_0xe64c('0x1a')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x38f5c6,_0x1aeeb9||_0xe64c('0x17'),_0x34998e);_0x17824e['next'](_0x34998e);}else{logger[_0xe64c('0x1a')](_0xe64c('0x1b'),_0x38f5c6,_0x1aeeb9||_0xe64c('0x17'));_0x17824e['stop']();}}else{_0x17824e[_0xe64c('0x17')]();}}catch(_0x3cddc7){logger[_0xe64c('0x10')](_0xe64c('0x1c'),_0x38f5c6,_0x3cddc7['message']);_0x17824e['stop']();}}}catch(_0x74b620){logger['error'](_0xe64c('0x11'),_0x38f5c6,JSON[_0xe64c('0x1d')](_0x74b620));_0x17824e[_0xe64c('0x1e')]();}};}; \ No newline at end of file +var _0x1340=['number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','validate','length','[%s][GOTOIF]\x20%s','map','message','join','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','error','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x1340,0x8b));var _0x0134=function(_0x57e41e,_0x4350b8){_0x57e41e=_0x57e41e-0x0;var _0xf0f7f=_0x1340[_0x57e41e];return _0xf0f7f;};'use strict';var schema=require('validate');var _=require(_0x0134('0x0'));var htmlToText=require(_0x0134('0x1'));var utils=require(_0x0134('0x2'));var logger=require(_0x0134('0x3'))(_0x0134('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x0134('0x5')},'priorityTrue':{'type':_0x0134('0x6'),'message':_0x0134('0x7')},'priorityFalse':{'type':'number','message':_0x0134('0x8')}});exports[_0x0134('0x9')]=function(_0x1661a2,_0x446f32){return function(_0x479aa5){try{var _0xf4ce68={'condition':htmlToText[_0x0134('0xa')](utils[_0x0134('0xb')](_0x446f32[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x446f32[0x1],'priorityFalse':_0x446f32[0x2]};var _0x57b5b9=gotoif[_0x0134('0xc')](_0xf4ce68,{'typecast':!![]});if(_0x57b5b9[_0x0134('0xd')]){logger['error'](_0x0134('0xe'),_0x1661a2,_[_0x0134('0xf')](_0x57b5b9,_0x0134('0x10'))[_0x0134('0x11')](',\x20'));_0x479aa5['stop']();}else{try{var _0xa48f2d=eval('('+_0xf4ce68['condition']+')');var _0x4f52f8=_0xa48f2d?_0xf4ce68['priorityTrue']:_0xf4ce68[_0x0134('0x12')];logger[_0x0134('0x13')](_0x0134('0x14'),_0x1661a2,_0xf4ce68[_0x0134('0x15')],_0xa48f2d,_0x4f52f8||_0x0134('0x16'));if(_0x4f52f8){var _0x16c801=_[_0x0134('0x17')](_0x479aa5[_0x0134('0x18')](),{'p':_0x4f52f8});if(_0x16c801>=0x0){logger[_0x0134('0x13')](_0x0134('0x19'),_0x1661a2,_0x4f52f8||_0x0134('0x16'),_0x16c801);_0x479aa5[_0x0134('0x16')](_0x16c801);}else{logger[_0x0134('0x13')](_0x0134('0x1a'),_0x1661a2,_0x4f52f8||_0x0134('0x16'));_0x479aa5[_0x0134('0x1b')]();}}else{_0x479aa5[_0x0134('0x16')]();}}catch(_0x1987df){logger[_0x0134('0x1c')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x1661a2,_0x1987df[_0x0134('0x10')]);_0x479aa5[_0x0134('0x1b')]();}}}catch(_0x31f083){logger[_0x0134('0x1c')](_0x0134('0xe'),_0x1661a2,JSON['stringify'](_0x31f083));_0x479aa5[_0x0134('0x1b')]();}};}; \ 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 e3fbdc4..35538eb 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 _0x09d5=['join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message'];(function(_0x466d7d,_0x2eeff1){var _0x4dcf1d=function(_0x15d92f){while(--_0x15d92f){_0x466d7d['push'](_0x466d7d['shift']());}};_0x4dcf1d(++_0x2eeff1);}(_0x09d5,0x15a));var _0x509d=function(_0x9f5356,_0x2d812d){_0x9f5356=_0x9f5356-0x0;var _0x403cd2=_0x09d5[_0x9f5356];return _0x403cd2;};'use strict';var schema=require(_0x509d('0x0'));var _=require(_0x509d('0x1'));var logger=require(_0x509d('0x2'))(_0x509d('0x3'));var gotop=schema({'priority':{'type':_0x509d('0x4'),'required':!![],'message':_0x509d('0x5')}});exports[_0x509d('0x6')]=function(_0x50e782,_0x5872cd){return function(_0x19d456){try{var _0x3560b6={'priority':_0x5872cd[0x0]};var _0x480c2d=gotop[_0x509d('0x0')](_0x3560b6,{'typecast':!![]});if(_0x480c2d[_0x509d('0x7')]){logger[_0x509d('0x8')](_0x509d('0x9'),_0x50e782,_['map'](_0x480c2d,_0x509d('0xa'))[_0x509d('0xb')](',\x20'));_0x19d456[_0x509d('0xc')]();}else{logger[_0x509d('0xd')](_0x509d('0xe'),_0x50e782,_0x3560b6[_0x509d('0xf')]);if(_0x3560b6[_0x509d('0xf')]){var _0x224bcb=_[_0x509d('0x10')](_0x19d456[_0x509d('0x11')](),{'p':_0x3560b6[_0x509d('0xf')]});if(_0x224bcb>=0x0){logger[_0x509d('0xd')](_0x509d('0x12'),_0x50e782,_0x3560b6[_0x509d('0xf')]||'next',_0x224bcb);_0x19d456[_0x509d('0x13')](_0x224bcb);}else{logger[_0x509d('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x50e782,_0x3560b6[_0x509d('0xf')]||_0x509d('0x13'));_0x19d456[_0x509d('0xc')]();}}else{_0x19d456['next']();}}}catch(_0x4b7507){logger['error'](_0x509d('0x9'),_0x50e782,JSON[_0x509d('0x14')](_0x4b7507));_0x19d456[_0x509d('0xc')]();}};}; \ No newline at end of file +var _0x7cfe=['rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x7cfe,0xf6));var _0xe7cf=function(_0x1e3dff,_0x5ae87e){_0x1e3dff=_0x1e3dff-0x0;var _0x5c0953=_0x7cfe[_0x1e3dff];return _0x5c0953;};'use strict';var schema=require(_0xe7cf('0x0'));var _=require(_0xe7cf('0x1'));var logger=require(_0xe7cf('0x2'))(_0xe7cf('0x3'));var gotop=schema({'priority':{'type':_0xe7cf('0x4'),'required':!![],'message':_0xe7cf('0x5')}});exports[_0xe7cf('0x6')]=function(_0x26d922,_0x2956a8){return function(_0x54cc39){try{var _0x1ffdb6={'priority':_0x2956a8[0x0]};var _0x2bfdac=gotop[_0xe7cf('0x0')](_0x1ffdb6,{'typecast':!![]});if(_0x2bfdac['length']){logger[_0xe7cf('0x7')]('[%s][GOTOP]\x20%s',_0x26d922,_[_0xe7cf('0x8')](_0x2bfdac,'message')[_0xe7cf('0x9')](',\x20'));_0x54cc39[_0xe7cf('0xa')]();}else{logger[_0xe7cf('0xb')](_0xe7cf('0xc'),_0x26d922,_0x1ffdb6['priority']);if(_0x1ffdb6[_0xe7cf('0xd')]){var _0x43fa00=_['findIndex'](_0x54cc39[_0xe7cf('0xe')](),{'p':_0x1ffdb6[_0xe7cf('0xd')]});if(_0x43fa00>=0x0){logger['info'](_0xe7cf('0xf'),_0x26d922,_0x1ffdb6[_0xe7cf('0xd')]||_0xe7cf('0x10'),_0x43fa00);_0x54cc39[_0xe7cf('0x10')](_0x43fa00);}else{logger['info'](_0xe7cf('0x11'),_0x26d922,_0x1ffdb6[_0xe7cf('0xd')]||_0xe7cf('0x10'));_0x54cc39[_0xe7cf('0xa')]();}}else{_0x54cc39[_0xe7cf('0x10')]();}}}catch(_0x567d70){logger['error'](_0xe7cf('0x12'),_0x26d922,JSON[_0xe7cf('0x13')](_0x567d70));_0x54cc39[_0xe7cf('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 1fc15d1..92f871e 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 _0x4d97=['AccountId','account','InteractionId','interaction','Message','then','next','catch','[%s][MESSAGE]\x20%s','stringify','stop','error','../../../../config/logger','routing','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','channel','ChatWebsiteId'];(function(_0x4ff1a2,_0x16f118){var _0x588010=function(_0x4a2766){while(--_0x4a2766){_0x4ff1a2['push'](_0x4ff1a2['shift']());}};_0x588010(++_0x16f118);}(_0x4d97,0xe8));var _0x74d9=function(_0x3ceffb,_0x1604d1){_0x3ceffb=_0x3ceffb-0x0;var _0xe0f5f4=_0x4d97[_0x3ceffb];return _0xe0f5f4;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x74d9('0x0'))(_0x74d9('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x74d9('0x2')),'faxMessage':require(_0x74d9('0x3'))};exports[_0x74d9('0x4')]=function(_0x194205,_0x152ff9){return function(_0x21dfd8){try{var _0x35df81={'body':utils[_0x74d9('0x5')](_0x152ff9[0x0],this),'ContactId':this['contact']['id']};if(this[_0x74d9('0x6')]==='chat'){_0x35df81[_0x74d9('0x7')]=this['account']['id'];}else{_0x35df81[_['upperFirst'](this[_0x74d9('0x6')])+_0x74d9('0x8')]=this[_0x74d9('0x9')]['id'];}_0x35df81[_['upperFirst'](this[_0x74d9('0x6')])+_0x74d9('0xa')]=this[_0x74d9('0xb')]['id'];if(rpc[this[_0x74d9('0x6')]+_0x74d9('0xc')]){return rpc[this[_0x74d9('0x6')]+_0x74d9('0xc')]['create'](_0x35df81)[_0x74d9('0xd')](function(_0x5ea344){logger['info']('[%s][MESSAGE]\x20%s',_0x194205,_0x35df81['body']);_0x21dfd8[_0x74d9('0xe')]();})[_0x74d9('0xf')](function(_0x137522){logger['error'](_0x74d9('0x10'),_0x194205,JSON[_0x74d9('0x11')](_0x137522));_0x21dfd8[_0x74d9('0x12')]();});}}catch(_0x47bba7){logger[_0x74d9('0x13')](_0x74d9('0x10'),_0x194205,JSON[_0x74d9('0x11')](_0x47bba7));_0x21dfd8[_0x74d9('0x12')]();}};}; \ No newline at end of file +var _0xe14a=['upperFirst','channel','InteractionId','interaction','Message','create','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','ChatWebsiteId','account'];(function(_0x23b3e0,_0x802d57){var _0x122558=function(_0x30e430){while(--_0x30e430){_0x23b3e0['push'](_0x23b3e0['shift']());}};_0x122558(++_0x802d57);}(_0xe14a,0x1f4));var _0xae14=function(_0x360bac,_0x4a1e91){_0x360bac=_0x360bac-0x0;var _0x56acef=_0xe14a[_0x360bac];return _0x56acef;};'use strict';var _=require(_0xae14('0x0'));var utils=require(_0xae14('0x1'));var logger=require(_0xae14('0x2'))(_0xae14('0x3'));var rpc={'chatMessage':require(_0xae14('0x4')),'openchannelMessage':require(_0xae14('0x5')),'mailMessage':require(_0xae14('0x6')),'smsMessage':require(_0xae14('0x7')),'faxMessage':require('../../rpc/faxMessage')};exports[_0xae14('0x8')]=function(_0x91e580,_0x1d3482){return function(_0x4718b4){try{var _0x31437f={'body':utils[_0xae14('0x9')](_0x1d3482[0x0],this),'ContactId':this[_0xae14('0xa')]['id']};if(this['channel']==='chat'){_0x31437f[_0xae14('0xb')]=this[_0xae14('0xc')]['id'];}else{_0x31437f[_[_0xae14('0xd')](this[_0xae14('0xe')])+'AccountId']=this[_0xae14('0xc')]['id'];}_0x31437f[_[_0xae14('0xd')](this['channel'])+_0xae14('0xf')]=this[_0xae14('0x10')]['id'];if(rpc[this['channel']+_0xae14('0x11')]){return rpc[this[_0xae14('0xe')]+_0xae14('0x11')][_0xae14('0x12')](_0x31437f)['then'](function(_0x822899){logger[_0xae14('0x13')]('[%s][MESSAGE]\x20%s',_0x91e580,_0x31437f[_0xae14('0x14')]);_0x4718b4[_0xae14('0x15')]();})[_0xae14('0x16')](function(_0x2c1948){logger[_0xae14('0x17')](_0xae14('0x18'),_0x91e580,JSON['stringify'](_0x2c1948));_0x4718b4[_0xae14('0x19')]();});}}catch(_0xaca8f4){logger[_0xae14('0x17')](_0xae14('0x18'),_0x91e580,JSON[_0xae14('0x1a')](_0xaca8f4));_0x4718b4[_0xae14('0x19')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index d53d876..7264947 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 _0x51bd=['[%s][NOOP]\x20%s','stringify','../../../../config/logger','consequence','info','getMustacheRender','next','error'];(function(_0x1db794,_0x13bc92){var _0x1940fc=function(_0x121631){while(--_0x121631){_0x1db794['push'](_0x1db794['shift']());}};_0x1940fc(++_0x13bc92);}(_0x51bd,0x122));var _0xd51b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x51bd[_0x4a9fb1];return _0x348672;};'use strict';var utils=require('./utils');var logger=require(_0xd51b('0x0'))('routing');exports[_0xd51b('0x1')]=function(_0x2f5862,_0x2f69a4){return function(_0x4009b6){try{logger[_0xd51b('0x2')]('[%s][NOOP]\x20%s',_0x2f5862,utils[_0xd51b('0x3')](_0x2f69a4[0x0],this));_0x4009b6[_0xd51b('0x4')]();}catch(_0x474a00){logger[_0xd51b('0x5')](_0xd51b('0x6'),_0x2f5862,JSON[_0xd51b('0x7')](_0x474a00));_0x4009b6['stop']();}};}; \ No newline at end of file +var _0xe332=['[%s][NOOP]\x20%s','stringify','stop','./utils','routing','consequence','info','getMustacheRender','next','error'];(function(_0xa5a920,_0x2d8772){var _0x596618=function(_0x5eab42){while(--_0x5eab42){_0xa5a920['push'](_0xa5a920['shift']());}};_0x596618(++_0x2d8772);}(_0xe332,0x161));var _0x2e33=function(_0x380a86,_0xef3cd4){_0x380a86=_0x380a86-0x0;var _0x4d472a=_0xe332[_0x380a86];return _0x4d472a;};'use strict';var utils=require(_0x2e33('0x0'));var logger=require('../../../../config/logger')(_0x2e33('0x1'));exports[_0x2e33('0x2')]=function(_0x175d84,_0x8f1dc6){return function(_0x519e80){try{logger[_0x2e33('0x3')]('[%s][NOOP]\x20%s',_0x175d84,utils[_0x2e33('0x4')](_0x8f1dc6[0x0],this));_0x519e80[_0x2e33('0x5')]();}catch(_0x5d892f){logger[_0x2e33('0x6')](_0x2e33('0x7'),_0x175d84,JSON[_0x2e33('0x8')](_0x5d892f));_0x519e80[_0x2e33('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 458853f..cae5d1e 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 _0xe706=['message','chat','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','update','catch','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','length','stop','find','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','format','%s:queue:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','contact','list','upperFirst','channel','QueueId'];(function(_0x4d7e79,_0x5272e4){var _0x106e2f=function(_0x1b80f4){while(--_0x1b80f4){_0x4d7e79['push'](_0x4d7e79['shift']());}};_0x106e2f(++_0x5272e4);}(_0xe706,0xa3));var _0x6e70=function(_0x20c893,_0xbef2b4){_0x20c893=_0x20c893-0x0;var _0xc705e8=_0xe706[_0x20c893];return _0xc705e8;};'use strict';var schema=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));var util=require(_0x6e70('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var config=require(_0x6e70('0x5'));var logger=require(_0x6e70('0x6'))(_0x6e70('0x7'));var strategy=require(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));var attributes=['id',_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf'),_0x6e70('0x10'),_0x6e70('0x11')];function emit(_0x25e61c,_0x100eb7,_0x463853){io['to'](_0x25e61c)[_0x6e70('0x12')](_0x100eb7,_0x463853);}function emitChannelQueueInteraction(_0x3f474a,_0x37b3e0,_0x4600f9,_0x5b3d07,_0x47f6b2,_0x3594c1,_0x15a1a5,_0x18cf27){var _0x27dd9b=_[_0x6e70('0x13')](_0x4600f9);_0x27dd9b[_0x6e70('0xd')]=_0x18cf27;_0x27dd9b[_0x6e70('0xf')]=_0x37b3e0;_0x27dd9b[_0x6e70('0xe')]=_0x5b3d07;_0x27dd9b['id']=_0x47f6b2;if(_0x3594c1){_0x15a1a5[util['format']('%sQueuesWaitingInteractions',_0x3f474a)][_0x47f6b2]=_['pick'](_0x27dd9b,attributes);}else{delete _0x15a1a5[util[_0x6e70('0x14')]('%sQueuesWaitingInteractions',_0x3f474a)][_0x47f6b2];}emit(util['format'](_0x6e70('0x15'),_0x3f474a,_0x37b3e0),util[_0x6e70('0x14')]('%s_queue_waiting_interaction:%s',_0x3f474a,_0x3594c1?_0x6e70('0x16'):'remove'),_[_0x6e70('0x17')](_0x27dd9b,attributes));}var rpc={'openchannelQueueReport':require(_0x6e70('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x6e70('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport')};var queue=schema({'name':{'type':_0x6e70('0x1a'),'required':!![],'message':_0x6e70('0x1b')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){if(_0xc238ba&&_0x208e21&&_0x2368eb){_0x208e21[_0x6e70('0x1c')]+=0x1;var _0xcdf9f2={'uniqueid':_0xc238ba,'from':_0x2368eb[_0x6e70('0x1d')]?_0x2368eb[_0x6e70('0x1d')][_0x6e70('0x10')]:'','joinAt':moment()[_0x6e70('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2368eb[_0x6e70('0x1e')]?_0x2368eb[_0x6e70('0x1e')]['id']:null,'ListId':_0x2368eb[_0x6e70('0x1f')]?_0x2368eb['list']['id']:null};_0xcdf9f2[_[_0x6e70('0x20')](_0x2368eb[_0x6e70('0x21')])+_0x6e70('0x22')]=_0x208e21['id']||null;_0xcdf9f2[_['upperFirst'](_0x2368eb[_0x6e70('0x21')])+'InteractionId']=_0x2368eb['interaction']?_0x2368eb['interaction']['id']:null;_0xcdf9f2[_[_0x6e70('0x20')](_0x2368eb[_0x6e70('0x21')])+'MessageId']=_0x2368eb[_0x6e70('0x23')]?_0x2368eb[_0x6e70('0x23')]['id']:null;_0xcdf9f2[_['upperFirst'](_0x2368eb[_0x6e70('0x21')])+(_0x2368eb[_0x6e70('0x21')]!==_0x6e70('0x24')?'AccountId':'WebsiteId')]=_0x2368eb[_0x6e70('0xe')]?_0x2368eb[_0x6e70('0xe')]['id']:null;logger[_0x6e70('0x25')](util[_0x6e70('0x14')](_0x6e70('0x26'),_0xc238ba,_0x208e21['name']));emitChannelQueueInteraction(_0x2368eb[_0x6e70('0x21')],_0x208e21[_0x6e70('0x27')],_0xcdf9f2,_0x2368eb[_0x6e70('0xe')][_0x6e70('0x27')],_0x2368eb[_0x6e70('0x23')]['id'],!![],_0x3a9978,_0x208e21['id']);if(rpc[_0x2368eb[_0x6e70('0x21')]+_0x6e70('0x28')]){return rpc[_0x2368eb[_0x6e70('0x21')]+_0x6e70('0x28')][_0x6e70('0x29')](_0xcdf9f2)['catch'](function(_0x1b27d8){logger['error'](_0x6e70('0x2a'));});}}}function stopRouting(_0x5a7a2a,_0xdd7cc1,_0x2722e8,_0x30fa0b){if(_0x5a7a2a&&_0xdd7cc1){_0xdd7cc1['waiting']-=0x1;var _0x38c40d={'leaveAt':moment()[_0x6e70('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x6e70('0x14')](_0x6e70('0x2b')),'reason':'accepted'};logger[_0x6e70('0x25')](util[_0x6e70('0x14')](_0x6e70('0x2c'),_0x5a7a2a,_0xdd7cc1[_0x6e70('0x27')]));emitChannelQueueInteraction(_0x2722e8[_0x6e70('0x21')],_0xdd7cc1[_0x6e70('0x27')],_0x2722e8[_0x6e70('0x1d')],_0x2722e8[_0x6e70('0xe')][_0x6e70('0x27')],_0x2722e8[_0x6e70('0x23')]['id'],![],_0x30fa0b,_0xdd7cc1['id']);if(rpc[_0x2722e8['channel']+_0x6e70('0x28')]){return rpc[_0x2722e8['channel']+_0x6e70('0x28')][_0x6e70('0x2d')](_0x5a7a2a,_0x38c40d)[_0x6e70('0x2e')](function(_0x32d12d){logger[_0x6e70('0x2f')](_0x6e70('0x30'));});}}}function endRouting(_0x2440be,_0xdd0bee,_0x80bebb,_0x198dd1){if(_0x2440be&&_0xdd0bee){_0xdd0bee[_0x6e70('0x1c')]-=0x1;var _0x23d5e2={'leaveAt':moment()[_0x6e70('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x6e70('0x31')};logger[_0x6e70('0x25')](util[_0x6e70('0x14')](_0x6e70('0x32'),_0x2440be,_0xdd0bee[_0x6e70('0x27')]));emitChannelQueueInteraction(_0x80bebb[_0x6e70('0x21')],_0xdd0bee['name'],_0x80bebb[_0x6e70('0x1d')],_0x80bebb[_0x6e70('0xe')][_0x6e70('0x27')],_0x80bebb[_0x6e70('0x23')]['id'],![],_0x198dd1);if(rpc[_0x80bebb[_0x6e70('0x21')]+_0x6e70('0x28')]){return rpc[_0x80bebb[_0x6e70('0x21')]+_0x6e70('0x28')]['update'](_0x2440be,_0x23d5e2)[_0x6e70('0x2e')](function(_0x23e893){logger[_0x6e70('0x2f')](_0x6e70('0x30'));});}}}function handleFindQueue(_0x201da9){return function(_0x1de947){return _0x1de947[_0x6e70('0x27')]['toLowerCase']()===_0x201da9['toLowerCase']();};}exports['consequence']=function(_0x154e0c,_0x2b63cc,_0x83847b,_0x64ff8e){return function(_0x45c83a){try{var _0x49e068={'name':_0x2b63cc[0x0],'timeout':_0x2b63cc[0x1]};var _0x225d44=queue[_0x6e70('0x0')](_0x49e068,{'typecast':!![]});if(_0x225d44[_0x6e70('0x33')]){logger['error']('[%s][QUEUE]\x20%s',_0x154e0c,_['map'](_0x225d44,_0x6e70('0x23'))['join'](',\x20'));_0x45c83a[_0x6e70('0x34')]();}else{var _0x39913a=_[_0x6e70('0x35')](_0x83847b[_0x64ff8e[_0x6e70('0x21')]+'Queues'],handleFindQueue(_0x49e068[_0x6e70('0x27')]));if(_0x39913a){startRouting(_0x154e0c,_0x39913a,_0x64ff8e,_0x83847b);var _0x4d1243=(_0x39913a[_0x6e70('0x31')]||0xa)*0x3e8;var _0x1e9b06=(_0x49e068[_0x6e70('0x31')]||0x14)*0x3e8;var _0x3478e2,_0x5bbc3a;if(_0x4d1243>_0x1e9b06){_0x1e9b06=_0x4d1243;}var _0x291de6=seqqueue[_0x6e70('0x36')](_0x4d1243);_0x291de6['id']=_0x154e0c;_0x291de6[_0x6e70('0x37')]=_0x4d1243;_0x291de6[_0x6e70('0x38')]=_0x1e9b06;_0x291de6[_0x6e70('0x21')]=_0x64ff8e[_0x6e70('0x21')];_0x83847b[_0x6e70('0x39')][_0x154e0c]['on']('end',function(){logger[_0x6e70('0x25')](_0x6e70('0x3a'),_0x154e0c);stopRouting(_0x154e0c,_0x39913a,_0x64ff8e,_0x83847b);clearTimeout(_0x3478e2);_0x3478e2=undefined;_0x291de6[_0x6e70('0x3b')](!![]);if(_0x83847b[_0x6e70('0x39')][_0x154e0c]){delete _0x83847b[_0x6e70('0x39')][_0x154e0c];}_0x45c83a[_0x6e70('0x34')]();});_0x83847b[_0x6e70('0x39')][_0x154e0c]['on']('complete',function(){if(_0x83847b[_0x6e70('0x39')][_0x154e0c]){delete _0x83847b['rules'][_0x154e0c];}});_0x3478e2=setTimeout(function(){logger[_0x6e70('0x25')](_0x6e70('0x3c'),_0x154e0c);endRouting(_0x154e0c,_0x39913a,_0x64ff8e,_0x83847b);clearTimeout(_0x3478e2);_0x291de6['close'](!![]);_0x45c83a['next']();},_0x1e9b06);switch(_0x39913a[_0x6e70('0x3d')]){case _0x6e70('0x3e'):strategy[_0x6e70('0x3e')](_0x291de6,_0x39913a,_0x83847b,_0x64ff8e);break;default:strategy['beepall'](_0x291de6,_0x39913a,_0x83847b,_0x64ff8e);}}else{logger['error'](_0x6e70('0x3f'),_0x154e0c,_0x49e068[_0x6e70('0x27')]);_0x45c83a[_0x6e70('0x34')]();}}}catch(_0x79653){console[_0x6e70('0x40')](_0x79653);logger[_0x6e70('0x2f')]('[%s][QUEUE]\x20%s',_0x154e0c,_0x79653[_0x6e70('0x41')]);_0x45c83a[_0x6e70('0x34')]();}};}; \ No newline at end of file +var _0x9bde=['lodash','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','log','stack'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4e7920,_0x38951b){_0x4e7920=_0x4e7920-0x0;var _0x3382f3=_0x9bde[_0x4e7920];return _0x3382f3;};'use strict';var schema=require('validate');var _=require(_0xe9bd('0x0'));var util=require('util');var seqqueue=require(_0xe9bd('0x1'));var moment=require('moment');var Redis=require(_0xe9bd('0x2'));var config=require(_0xe9bd('0x3'));var logger=require(_0xe9bd('0x4'))(_0xe9bd('0x5'));var strategy=require(_0xe9bd('0x6'));config[_0xe9bd('0x7')]=_[_0xe9bd('0x8')](config['redis'],{'host':_0xe9bd('0x9'),'port':0x18eb});var io=require(_0xe9bd('0xa'))(new Redis(config[_0xe9bd('0x7')]));var attributes=['id',_0xe9bd('0xb'),_0xe9bd('0xc'),_0xe9bd('0xd'),_0xe9bd('0xe'),_0xe9bd('0xf')];function emit(_0x439abc,_0x45c7ba,_0x581602){io['to'](_0x439abc)['emit'](_0x45c7ba,_0x581602);}function emitChannelQueueInteraction(_0x3c8e95,_0x145521,_0x2601ac,_0x581ab9,_0x12c96e,_0x9eca50,_0x3339f9,_0x141587){var _0x5e022a=_[_0xe9bd('0x10')](_0x2601ac);_0x5e022a['queue_id']=_0x141587;_0x5e022a[_0xe9bd('0xd')]=_0x145521;_0x5e022a[_0xe9bd('0xc')]=_0x581ab9;_0x5e022a['id']=_0x12c96e;if(_0x9eca50){_0x3339f9[util[_0xe9bd('0x11')]('%sQueuesWaitingInteractions',_0x3c8e95)][_0x12c96e]=_['pick'](_0x5e022a,attributes);}else{delete _0x3339f9[util[_0xe9bd('0x11')](_0xe9bd('0x12'),_0x3c8e95)][_0x12c96e];}emit(util[_0xe9bd('0x11')](_0xe9bd('0x13'),_0x3c8e95,_0x145521),util[_0xe9bd('0x11')](_0xe9bd('0x14'),_0x3c8e95,_0x9eca50?_0xe9bd('0x15'):'remove'),_[_0xe9bd('0x16')](_0x5e022a,attributes));}var rpc={'openchannelQueueReport':require(_0xe9bd('0x17')),'mailQueueReport':require(_0xe9bd('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xe9bd('0x19')),'faxQueueReport':require(_0xe9bd('0x1a'))};var queue=schema({'name':{'type':_0xe9bd('0x1b'),'required':!![],'message':_0xe9bd('0x1c')},'timeout':{'type':'number','message':_0xe9bd('0x1d')}});function startRouting(_0x50a5e8,_0xc6b661,_0x55b869,_0x26aa4a){if(_0x50a5e8&&_0xc6b661&&_0x55b869){_0xc6b661[_0xe9bd('0x1e')]+=0x1;var _0x134c4e={'uniqueid':_0x50a5e8,'from':_0x55b869[_0xe9bd('0x1f')]?_0x55b869[_0xe9bd('0x1f')][_0xe9bd('0xe')]:'','joinAt':moment()[_0xe9bd('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55b869[_0xe9bd('0x20')]?_0x55b869[_0xe9bd('0x20')]['id']:null,'ListId':_0x55b869['list']?_0x55b869[_0xe9bd('0x21')]['id']:null};_0x134c4e[_['upperFirst'](_0x55b869[_0xe9bd('0x22')])+_0xe9bd('0x23')]=_0xc6b661['id']||null;_0x134c4e[_[_0xe9bd('0x24')](_0x55b869[_0xe9bd('0x22')])+'InteractionId']=_0x55b869[_0xe9bd('0x25')]?_0x55b869[_0xe9bd('0x25')]['id']:null;_0x134c4e[_[_0xe9bd('0x24')](_0x55b869[_0xe9bd('0x22')])+_0xe9bd('0x26')]=_0x55b869[_0xe9bd('0x27')]?_0x55b869[_0xe9bd('0x27')]['id']:null;_0x134c4e[_[_0xe9bd('0x24')](_0x55b869[_0xe9bd('0x22')])+(_0x55b869['channel']!==_0xe9bd('0x28')?_0xe9bd('0x29'):'WebsiteId')]=_0x55b869[_0xe9bd('0xc')]?_0x55b869[_0xe9bd('0xc')]['id']:null;logger[_0xe9bd('0x2a')](util[_0xe9bd('0x11')](_0xe9bd('0x2b'),_0x50a5e8,_0xc6b661[_0xe9bd('0x2c')]));emitChannelQueueInteraction(_0x55b869['channel'],_0xc6b661['name'],_0x134c4e,_0x55b869[_0xe9bd('0xc')]['name'],_0x55b869[_0xe9bd('0x27')]['id'],!![],_0x26aa4a,_0xc6b661['id']);if(rpc[_0x55b869[_0xe9bd('0x22')]+_0xe9bd('0x2d')]){return rpc[_0x55b869[_0xe9bd('0x22')]+_0xe9bd('0x2d')]['create'](_0x134c4e)['catch'](function(_0x7f2c5){logger[_0xe9bd('0x2e')](_0xe9bd('0x2f'));});}}}function stopRouting(_0x3081f3,_0xe2436,_0x1f0f9e,_0x3c31ee){if(_0x3081f3&&_0xe2436){_0xe2436[_0xe9bd('0x1e')]-=0x1;var _0x45703e={'leaveAt':moment()['format'](_0xe9bd('0x30')),'acceptAt':moment()[_0xe9bd('0x11')](_0xe9bd('0x30')),'reason':'accepted'};logger['info'](util[_0xe9bd('0x11')](_0xe9bd('0x31'),_0x3081f3,_0xe2436[_0xe9bd('0x2c')]));emitChannelQueueInteraction(_0x1f0f9e[_0xe9bd('0x22')],_0xe2436[_0xe9bd('0x2c')],_0x1f0f9e[_0xe9bd('0x1f')],_0x1f0f9e[_0xe9bd('0xc')][_0xe9bd('0x2c')],_0x1f0f9e[_0xe9bd('0x27')]['id'],![],_0x3c31ee,_0xe2436['id']);if(rpc[_0x1f0f9e[_0xe9bd('0x22')]+_0xe9bd('0x2d')]){return rpc[_0x1f0f9e[_0xe9bd('0x22')]+_0xe9bd('0x2d')][_0xe9bd('0x32')](_0x3081f3,_0x45703e)[_0xe9bd('0x33')](function(_0x8ff624){logger[_0xe9bd('0x2e')](_0xe9bd('0x34'));});}}}function endRouting(_0x4c689d,_0x3f3cf5,_0x32e764,_0x56b4a5){if(_0x4c689d&&_0x3f3cf5){_0x3f3cf5[_0xe9bd('0x1e')]-=0x1;var _0x264c87={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xe9bd('0x11')](_0xe9bd('0x30')),'reason':'timeout'};logger[_0xe9bd('0x2a')](util[_0xe9bd('0x11')](_0xe9bd('0x35'),_0x4c689d,_0x3f3cf5['name']));emitChannelQueueInteraction(_0x32e764[_0xe9bd('0x22')],_0x3f3cf5['name'],_0x32e764[_0xe9bd('0x1f')],_0x32e764[_0xe9bd('0xc')][_0xe9bd('0x2c')],_0x32e764[_0xe9bd('0x27')]['id'],![],_0x56b4a5);if(rpc[_0x32e764['channel']+_0xe9bd('0x2d')]){return rpc[_0x32e764[_0xe9bd('0x22')]+_0xe9bd('0x2d')][_0xe9bd('0x32')](_0x4c689d,_0x264c87)[_0xe9bd('0x33')](function(_0x1e061d){logger[_0xe9bd('0x2e')](_0xe9bd('0x34'));});}}}function handleFindQueue(_0x2b5a71){return function(_0x1d5d93){return _0x1d5d93['name']['toLowerCase']()===_0x2b5a71[_0xe9bd('0x36')]();};}exports['consequence']=function(_0x4608a0,_0x340819,_0x41881a,_0x480797){return function(_0x1ba613){try{var _0x2923cf={'name':_0x340819[0x0],'timeout':_0x340819[0x1]};var _0x1a2d94=queue['validate'](_0x2923cf,{'typecast':!![]});if(_0x1a2d94[_0xe9bd('0x37')]){logger[_0xe9bd('0x2e')](_0xe9bd('0x38'),_0x4608a0,_[_0xe9bd('0x39')](_0x1a2d94,_0xe9bd('0x27'))[_0xe9bd('0x3a')](',\x20'));_0x1ba613[_0xe9bd('0x3b')]();}else{var _0x3c4482=_[_0xe9bd('0x3c')](_0x41881a[_0x480797[_0xe9bd('0x22')]+_0xe9bd('0x3d')],handleFindQueue(_0x2923cf[_0xe9bd('0x2c')]));if(_0x3c4482){startRouting(_0x4608a0,_0x3c4482,_0x480797,_0x41881a);var _0x2d4e62=(_0x3c4482[_0xe9bd('0x3e')]||0xa)*0x3e8;var _0x41da6e=(_0x2923cf['timeout']||0x14)*0x3e8;var _0x5a86fd,_0x283e67;if(_0x2d4e62>_0x41da6e){_0x41da6e=_0x2d4e62;}var _0x2ced7c=seqqueue[_0xe9bd('0x3f')](_0x2d4e62);_0x2ced7c['id']=_0x4608a0;_0x2ced7c['atimeout']=_0x2d4e62;_0x2ced7c['qtimeout']=_0x41da6e;_0x2ced7c[_0xe9bd('0x22')]=_0x480797[_0xe9bd('0x22')];_0x41881a[_0xe9bd('0x40')][_0x4608a0]['on'](_0xe9bd('0x41'),function(){logger[_0xe9bd('0x2a')](_0xe9bd('0x42'),_0x4608a0);stopRouting(_0x4608a0,_0x3c4482,_0x480797,_0x41881a);clearTimeout(_0x5a86fd);_0x5a86fd=undefined;_0x2ced7c[_0xe9bd('0x43')](!![]);if(_0x41881a['rules'][_0x4608a0]){delete _0x41881a[_0xe9bd('0x40')][_0x4608a0];}_0x1ba613['stop']();});_0x41881a[_0xe9bd('0x40')][_0x4608a0]['on'](_0xe9bd('0x44'),function(){if(_0x41881a[_0xe9bd('0x40')][_0x4608a0]){delete _0x41881a[_0xe9bd('0x40')][_0x4608a0];}});_0x5a86fd=setTimeout(function(){logger[_0xe9bd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4608a0);endRouting(_0x4608a0,_0x3c4482,_0x480797,_0x41881a);clearTimeout(_0x5a86fd);_0x2ced7c[_0xe9bd('0x43')](!![]);_0x1ba613[_0xe9bd('0x45')]();},_0x41da6e);switch(_0x3c4482[_0xe9bd('0x46')]){case'rrmemory':strategy[_0xe9bd('0x47')](_0x2ced7c,_0x3c4482,_0x41881a,_0x480797);break;default:strategy[_0xe9bd('0x48')](_0x2ced7c,_0x3c4482,_0x41881a,_0x480797);}}else{logger[_0xe9bd('0x2e')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4608a0,_0x2923cf[_0xe9bd('0x2c')]);_0x1ba613[_0xe9bd('0x3b')]();}}}catch(_0x2e634d){console[_0xe9bd('0x49')](_0x2e634d);logger[_0xe9bd('0x2e')]('[%s][QUEUE]\x20%s',_0x4608a0,_0x2e634d[_0xe9bd('0x4a')]);_0x1ba613['stop']();}};}; \ 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 52972d7..1427897 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 _0x302c=['handleTimeout','timeout','drained','handleDrained','prototype','info','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','exports','lodash','uuid','../../../../../config/logger','routing','agent','realtime','squeue','push','handleRun','bind'];(function(_0x1ae56c,_0x412080){var _0x1d5f02=function(_0x45b698){while(--_0x45b698){_0x1ae56c['push'](_0x1ae56c['shift']());}};_0x1d5f02(++_0x412080);}(_0x302c,0x140));var _0xc302=function(_0x315a7b,_0x4a0c39){_0x315a7b=_0x315a7b-0x0;var _0xe88cbe=_0x302c[_0x315a7b];return _0xe88cbe;};'use strict';var _=require(_0xc302('0x0'));var uuid=require(_0xc302('0x1'));var util=require('./util');var logger=require(_0xc302('0x2'))(_0xc302('0x3'));var Agent=function(_0x2b1a44,_0x57b490,_0x386bda,_0x1296a0){this['notificationId']=uuid['v4']();this['squeue']=_0x2b1a44;this[_0xc302('0x4')]=_0x57b490;this[_0xc302('0x5')]=_0x386bda;this[_0xc302('0x3')]=_0x1296a0;this[_0xc302('0x6')][_0xc302('0x7')](this[_0xc302('0x8')][_0xc302('0x9')](this),this[_0xc302('0xa')][_0xc302('0x9')](this));this[_0xc302('0x6')]['on'](_0xc302('0xb'),this['handleTimeout'][_0xc302('0x9')](this));this[_0xc302('0x6')]['on'](_0xc302('0xc'),this[_0xc302('0xd')][_0xc302('0x9')](this));};Agent[_0xc302('0xe')][_0xc302('0x7')]=function(){this[_0xc302('0x6')]['push'](this['handleRun'][_0xc302('0x9')](this),this['handleTimeout'][_0xc302('0x9')](this));};Agent['prototype'][_0xc302('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0xc302('0xe')][_0xc302('0x8')]=function(_0x3152b5){logger[_0xc302('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xc302('0x6')]['id'],this[_0xc302('0x4')]['id']);if(_['isNil'](this[_0xc302('0x5')]['agents'][this[_0xc302('0x4')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xc302('0x6')]['id'],this[_0xc302('0x4')]['id']);setTimeout(this[_0xc302('0x7')]['bind'](this),0x3e8);}else{if(this[_0xc302('0x3')][_0xc302('0x10')]||util[_0xc302('0x11')](this['squeue']['id'],this[_0xc302('0x5')][_0xc302('0x12')][this[_0xc302('0x4')]['id']],this['squeue']['channel'],![])){this['realtime']['agents'][this[_0xc302('0x4')]['id']][_0xc302('0x13')]=!![];this[_0xc302('0x5')]['agents'][this[_0xc302('0x4')]['id']][_0xc302('0x14')]=undefined;util['showNotification'](this[_0xc302('0x15')],this['squeue']['id'],this[_0xc302('0x5')]['agents'][this[_0xc302('0x4')]['id']],null,this['routing']);util[_0xc302('0x16')](this[_0xc302('0x6')]['id'],this[_0xc302('0x5')][_0xc302('0x12')][this[_0xc302('0x4')]['id']],_0xc302('0x17')+(this[_0xc302('0x3')]['forcedOwnership']?_0xc302('0x18'):''));}else{logger[_0xc302('0xf')](_0xc302('0x19'),this[_0xc302('0x6')]['id'],this[_0xc302('0x4')]['id']);setTimeout(this[_0xc302('0x7')][_0xc302('0x9')](this),0x3e8);}}};Agent['prototype'][_0xc302('0xa')]=function(_0x2856cc){if(_['isNil'](this['realtime'][_0xc302('0x12')][this[_0xc302('0x4')]['id']])){return logger[_0xc302('0xf')](_0xc302('0x1a'),this[_0xc302('0x6')]['id'],this[_0xc302('0x4')]['id']);}else{logger[_0xc302('0xf')](_0xc302('0x1b'),this[_0xc302('0x6')]['id'],this[_0xc302('0x4')]['id']);util['hideNotification'](this['notificationId'],this[_0xc302('0x6')]['id'],this[_0xc302('0x5')][_0xc302('0x12')][this['agent']['id']],null,this['routing']);this[_0xc302('0x5')][_0xc302('0x12')][this[_0xc302('0x4')]['id']][_0xc302('0x13')]=![];this[_0xc302('0x5')][_0xc302('0x12')][this[_0xc302('0x4')]['id']][_0xc302('0x14')]=undefined;util['writeLog'](this['squeue']['id'],this[_0xc302('0x5')][_0xc302('0x12')][this['agent']['id']],_0x2856cc?_0xc302('0x1c'):'TIMEOUT');}if(!_0x2856cc){setTimeout(this['push'][_0xc302('0x9')](this),0x3e8);}};function agent(_0x3c25dc,_0x576faa,_0x3751b5,_0x5863e6){return new Agent(_0x3c25dc,_0x576faa,_0x3751b5,_0x5863e6);}module[_0xc302('0x1d')]=agent; \ No newline at end of file +var _0xc66a=['drained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','busy','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind','handleTimeout','timeout'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xc66a,0x197));var _0xac66=function(_0x4725e1,_0x1a1442){_0x4725e1=_0x4725e1-0x0;var _0x1a717b=_0xc66a[_0x4725e1];return _0x1a717b;};'use strict';var _=require(_0xac66('0x0'));var uuid=require(_0xac66('0x1'));var util=require(_0xac66('0x2'));var logger=require(_0xac66('0x3'))(_0xac66('0x4'));var Agent=function(_0x18fbe8,_0x4c1699,_0x5cdce8,_0xfbd33e){this[_0xac66('0x5')]=uuid['v4']();this[_0xac66('0x6')]=_0x18fbe8;this[_0xac66('0x7')]=_0x4c1699;this[_0xac66('0x8')]=_0x5cdce8;this[_0xac66('0x4')]=_0xfbd33e;this[_0xac66('0x6')][_0xac66('0x9')](this['handleRun'][_0xac66('0xa')](this),this[_0xac66('0xb')]['bind'](this));this[_0xac66('0x6')]['on'](_0xac66('0xc'),this[_0xac66('0xb')][_0xac66('0xa')](this));this[_0xac66('0x6')]['on'](_0xac66('0xd'),this['handleDrained'][_0xac66('0xa')](this));};Agent[_0xac66('0xe')][_0xac66('0x9')]=function(){this[_0xac66('0x6')][_0xac66('0x9')](this[_0xac66('0xf')]['bind'](this),this[_0xac66('0xb')]['bind'](this));};Agent[_0xac66('0xe')]['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0xac66('0xe')][_0xac66('0xf')]=function(_0x21b5ed){logger[_0xac66('0x10')](_0xac66('0x11'),this['squeue']['id'],this[_0xac66('0x7')]['id']);if(_['isNil'](this['realtime'][_0xac66('0x12')][this[_0xac66('0x7')]['id']])){logger[_0xac66('0x10')](_0xac66('0x13'),this[_0xac66('0x6')]['id'],this[_0xac66('0x7')]['id']);setTimeout(this['push'][_0xac66('0xa')](this),0x3e8);}else{if(this[_0xac66('0x4')][_0xac66('0x14')]||util[_0xac66('0x15')](this[_0xac66('0x6')]['id'],this['realtime'][_0xac66('0x12')][this['agent']['id']],this[_0xac66('0x6')][_0xac66('0x16')],![])){this[_0xac66('0x8')][_0xac66('0x12')][this[_0xac66('0x7')]['id']]['busy']=!![];this['realtime'][_0xac66('0x12')][this['agent']['id']][_0xac66('0x17')]=undefined;util[_0xac66('0x18')](this[_0xac66('0x5')],this[_0xac66('0x6')]['id'],this[_0xac66('0x8')]['agents'][this[_0xac66('0x7')]['id']],null,this[_0xac66('0x4')]);util[_0xac66('0x19')](this[_0xac66('0x6')]['id'],this[_0xac66('0x8')][_0xac66('0x12')][this[_0xac66('0x7')]['id']],_0xac66('0x1a')+(this[_0xac66('0x4')][_0xac66('0x14')]?_0xac66('0x1b'):''));}else{logger[_0xac66('0x10')](_0xac66('0x1c'),this[_0xac66('0x6')]['id'],this[_0xac66('0x7')]['id']);setTimeout(this[_0xac66('0x9')][_0xac66('0xa')](this),0x3e8);}}};Agent[_0xac66('0xe')][_0xac66('0xb')]=function(_0x4bd94f){if(_[_0xac66('0x1d')](this[_0xac66('0x8')]['agents'][this[_0xac66('0x7')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xac66('0x6')]['id'],this[_0xac66('0x7')]['id']);}else{logger['info'](_0xac66('0x1e'),this['squeue']['id'],this['agent']['id']);util['hideNotification'](this['notificationId'],this[_0xac66('0x6')]['id'],this['realtime'][_0xac66('0x12')][this['agent']['id']],null,this[_0xac66('0x4')]);this[_0xac66('0x8')][_0xac66('0x12')][this[_0xac66('0x7')]['id']][_0xac66('0x1f')]=![];this[_0xac66('0x8')]['agents'][this[_0xac66('0x7')]['id']][_0xac66('0x17')]=undefined;util[_0xac66('0x19')](this['squeue']['id'],this['realtime'][_0xac66('0x12')][this[_0xac66('0x7')]['id']],_0x4bd94f?_0xac66('0x20'):_0xac66('0x21'));}if(!_0x4bd94f){setTimeout(this[_0xac66('0x9')]['bind'](this),0x3e8);}};function agent(_0x2dbbc9,_0x1226e8,_0x2e6b4c,_0x3d4f59){return new Agent(_0x2dbbc9,_0x1226e8,_0x2e6b4c,_0x3d4f59);}module[_0xac66('0x22')]=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 e9bd0f4..e8ab9b4 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 _0xb4b5=['Agents','length','isAgentAvailable','agents','channel','writeLog','RINGING','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','info','STOP','TIMEOUT','exports','uuid','notificationId','squeue','queue','realtime','routing','bind','timeout','handleTimeout','drained','handleDrained','push','handleRun','prototype','isNil'];(function(_0x45e40d,_0x3f6d6d){var _0x5f81f3=function(_0x4b3648){while(--_0x4b3648){_0x45e40d['push'](_0x45e40d['shift']());}};_0x5f81f3(++_0x3f6d6d);}(_0xb4b5,0x184));var _0x5b4b=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0xb4b5[_0x27ddf5];return _0x26e74a;};'use strict';var _=require('lodash');var uuid=require(_0x5b4b('0x0'));var util=require('./util');var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x306c42,_0x2aef3f,_0x2462cd,_0x438508){this[_0x5b4b('0x1')]=uuid['v4']();this[_0x5b4b('0x2')]=_0x306c42;this[_0x5b4b('0x3')]=_0x2aef3f;this[_0x5b4b('0x4')]=_0x2462cd;this[_0x5b4b('0x5')]=_0x438508;this[_0x5b4b('0x2')]['push'](this['handleRun'][_0x5b4b('0x6')](this),this['handleTimeout'][_0x5b4b('0x6')](this));this['squeue']['on'](_0x5b4b('0x7'),this[_0x5b4b('0x8')]['bind'](this));this[_0x5b4b('0x2')]['on'](_0x5b4b('0x9'),this[_0x5b4b('0xa')][_0x5b4b('0x6')](this));};Beepall['prototype'][_0x5b4b('0xb')]=function(){this[_0x5b4b('0x2')]['push'](this[_0x5b4b('0xc')]['bind'](this),this[_0x5b4b('0x8')]['bind'](this));};Beepall[_0x5b4b('0xd')][_0x5b4b('0xa')]=function(_0x1192a2){this[_0x5b4b('0x8')](!![]);};Beepall[_0x5b4b('0xd')][_0x5b4b('0xc')]=function(_0x4cb511){var _0x17d2d9=!![];if(!_[_0x5b4b('0xe')](this[_0x5b4b('0x3')])&&!_[_0x5b4b('0xe')](this[_0x5b4b('0x3')][_0x5b4b('0xf')])&&this[_0x5b4b('0x3')]['Agents'][_0x5b4b('0x10')]>0x0){for(var _0x26d77a=0x0,_0xe3c043;_0x26d77a0x0){for(var _0x32353a=0x0,_0x55be61;_0x32353a0x0&&_0x481c98[_0x2f153c+_0x6327('0x27')]>=_0x481c98[_0x2f153c+'Capacity']){writeLog(_0x32e7a0,_0x481c98,_0x2f153c[_0x6327('0x28')]()+_0x6327('0x29'));return![];}}return!![];};exports['showNotification']=function(_0x44caac,_0xb02b41,_0x14b41b,_0x2540bf,_0x894157){return sendNotification(!![],_0x44caac,_0xb02b41,_0x14b41b,_0x2540bf,_0x894157);};exports[_0x6327('0x2a')]=function(_0x42b225,_0x2c4ca5,_0x58b590,_0x2ebc01,_0x3a96a2){return sendNotification(![],_0x42b225,_0x2c4ca5,_0x58b590,_0x2ebc01,_0x3a96a2);};exports['writeLog']=writeLog; \ No newline at end of file +var _0x99e8=['toUpperCase','\x20MAXCAPACITY','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','localhost','socket.io-emitter','emit','split','name','account','notificationSound','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','notification:%s','save','info','isAgentAvailable','busy','BUSY','online','OFFLINE','hasOwnProperty','Capacity','CurrentCapacity'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x99e8,0x11b));var _0x899e=function(_0x3a8689,_0x54c105){_0x3a8689=_0x3a8689-0x0;var _0x2b858d=_0x99e8[_0x3a8689];return _0x2b858d;};'use strict';var _=require(_0x899e('0x0'));var util=require(_0x899e('0x1'));var utils=require(_0x899e('0x2'));var Mustache=require(_0x899e('0x3'));var Redis=require(_0x899e('0x4'));var config=require(_0x899e('0x5'));var logger=require(_0x899e('0x6'))(_0x899e('0x7'));config['redis']=_[_0x899e('0x8')](config[_0x899e('0x9')],{'host':_0x899e('0xa'),'port':0x18eb});var io=require(_0x899e('0xb'))(new Redis(config[_0x899e('0x9')]));function emit(_0x348112,_0x3cc04e,_0x2f37cb){io['to'](_0x348112)[_0x899e('0xc')](_0x3cc04e,_0x2f37cb);}function sendNotification(_0x196ba9,_0x326b37,_0x87126a,_0x2d2dd3,_0x1e0bf3,_0x5bc53a){io['to'](util['format']('user:%s',_0x2d2dd3['name']))['emit']('user:save',_0x2d2dd3);var _0x4e1caa=_0x5bc53a||{};var _0x4df359=_0x87126a[_0x899e('0xd')]('.');var _0x2cf2b7={'uniqueid':_0x326b37,'channel':_0x4df359[0x0],'id':_0x4df359[0x1],'title':_0x4df359[0x0]+'\x20interaction','interactionId':_0x4df359[0x2],'queue':_0x1e0bf3?_0x1e0bf3[_0x899e('0xe')]:null,'sound':_0x4e1caa[_0x899e('0xf')][_0x899e('0x10')],'shake':_0x4e1caa[_0x899e('0xf')][_0x899e('0x11')]};try{if(!_0x4e1caa[_0x899e('0x12')]){_0x4e1caa[_0x899e('0x12')]={};}if(_0x1e0bf3){_0x4e1caa['body'][_0x899e('0x13')]=_0x1e0bf3;}else if(_0x4e1caa['body'][_0x899e('0x13')]){delete _0x4e1caa['body'][_0x899e('0x13')];}_0x2cf2b7[_0x899e('0x14')]=utils['getMustacheRender'](_0x4e1caa[_0x899e('0xf')][_0x899e('0x15')],_0x4e1caa);}catch(_0x1f96db){_0x2cf2b7[_0x899e('0x14')]=_0x899e('0x16');logger[_0x899e('0x17')](util[_0x899e('0x18')](_0x899e('0x19'),_0x326b37,_0x1f96db['message']));}io['to'](util[_0x899e('0x18')]('user:%s',_0x2d2dd3[_0x899e('0xe')]))['emit'](util[_0x899e('0x18')](_0x899e('0x1a'),_0x196ba9?_0x899e('0x1b'):'remove'),_0x2cf2b7);}function writeLog(_0x549574,_0x5acc4e,_0xb28f92){return logger[_0x899e('0x1c')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x549574,_0x5acc4e[_0x899e('0xe')],_0xb28f92));}exports[_0x899e('0x1d')]=function(_0x2466a3,_0x1f0530,_0x1dc6ec,_0x25a67d){if(_0x1f0530[_0x899e('0x1e')]){writeLog(_0x2466a3,_0x1f0530,_0x899e('0x1f'));return![];}if(!_0x1f0530[_0x899e('0x20')]){writeLog(_0x2466a3,_0x1f0530,_0x899e('0x21'));return![];}if(_0x1f0530[_0x1dc6ec+'Pause']){writeLog(_0x2466a3,_0x1f0530,'PAUSE');return![];}if(_0x25a67d&&_0x1f0530[_0x899e('0x22')](_0x1dc6ec+_0x899e('0x23'))&&_0x1f0530[_0x899e('0x22')](_0x1dc6ec+'CurrentCapacity')){if(_0x1f0530[_0x1dc6ec+_0x899e('0x23')]>0x0&&_0x1f0530[_0x1dc6ec+_0x899e('0x24')]>=_0x1f0530[_0x1dc6ec+'Capacity']){writeLog(_0x2466a3,_0x1f0530,_0x1dc6ec[_0x899e('0x25')]()+_0x899e('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x4123cb,_0x44fada,_0x119c46,_0x155717,_0x3ee4a9){return sendNotification(!![],_0x4123cb,_0x44fada,_0x119c46,_0x155717,_0x3ee4a9);};exports['hideNotification']=function(_0x394ed2,_0xa21f65,_0x274d01,_0x219dab,_0x39d3ff){return sendNotification(![],_0x394ed2,_0xa21f65,_0x274d01,_0x219dab,_0x39d3ff);};exports[_0x899e('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 56fdab1..9664128 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 _0xe927=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','validate','shelljs','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0xe927,0x70));var _0x7e92=function(_0x95eba8,_0x128c50){_0x95eba8=_0x95eba8-0x0;var _0x54f606=_0xe927[_0x95eba8];return _0x54f606;};'use strict';var schema=require(_0x7e92('0x0'));var sh=require(_0x7e92('0x1'));var _=require('lodash');var utils=require(_0x7e92('0x2'));var logger=require(_0x7e92('0x3'))('routing');var system=schema({'command':{'type':_0x7e92('0x4'),'required':!![],'message':_0x7e92('0x5')}});exports[_0x7e92('0x6')]=function(_0x21ad7d,_0x12f12b){return function(_0x470ac1){try{var _0x21b1a5={'command':_0x12f12b[0x0]};var _0x2ca86e=system[_0x7e92('0x0')](_0x21b1a5,{'typecast':!![]});if(_0x2ca86e[_0x7e92('0x7')]){logger[_0x7e92('0x8')](_0x7e92('0x9'),_0x21ad7d,_[_0x7e92('0xa')](_0x2ca86e,_0x7e92('0xb'))[_0x7e92('0xc')](',\x20'));logger['info'](_0x7e92('0xd'),_0x21ad7d);_0x470ac1[_0x7e92('0xe')]();}else{var _0x357892=this;var _0x41b8fa=utils[_0x7e92('0xf')](_0x12f12b[0x0],this);logger[_0x7e92('0x10')](_0x7e92('0x11'),_0x21ad7d,_0x41b8fa);sh['exec'](_[_0x7e92('0x12')](_0x41b8fa),function(_0x2aab3a,_0x3fbb29){logger[_0x7e92('0x10')](_0x7e92('0x13'),_0x21ad7d,_0x2aab3a);if(_0x2aab3a==0x0){var _0x567fa5=_0x3fbb29[_0x7e92('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x7e92('0x15')](_0x12f12b[0x1])||_['isEmpty'](_0x12f12b[0x1])){logger['info'](_0x7e92('0x16'),_0x21ad7d);_0x357892[_0x7e92('0x17')][_0x12f12b[0x1]]=_0x567fa5;}else{logger[_0x7e92('0x10')](_0x7e92('0x18'),_0x21ad7d,_0x12f12b[0x1],_0x567fa5);_0x357892[_0x7e92('0x17')][_0x12f12b[0x1]]=_0x567fa5;}}_0x470ac1[_0x7e92('0xe')]();});}}catch(_0x31989f){logger[_0x7e92('0x8')](_0x7e92('0x9'),_0x21ad7d,_['isObject'](_0x31989f)?JSON[_0x7e92('0x19')](_0x31989f):_0x31989f);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x21ad7d);_0x470ac1[_0x7e92('0xe')]();}};}; \ No newline at end of file +var _0x05ff=['[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','consequence','length','error','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x05ff,0x123));var _0xf05f=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x05ff[_0x6c993a];return _0x27f547;};'use strict';var schema=require(_0xf05f('0x0'));var sh=require(_0xf05f('0x1'));var _=require(_0xf05f('0x2'));var utils=require(_0xf05f('0x3'));var logger=require(_0xf05f('0x4'))(_0xf05f('0x5'));var system=schema({'command':{'type':_0xf05f('0x6'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xf05f('0x7')]=function(_0x28bfd0,_0x3cda21){return function(_0x1e2bfc){try{var _0x353ca8={'command':_0x3cda21[0x0]};var _0x4b7464=system['validate'](_0x353ca8,{'typecast':!![]});if(_0x4b7464[_0xf05f('0x8')]){logger[_0xf05f('0x9')]('[%s][SYSTEM]\x20%s',_0x28bfd0,_[_0xf05f('0xa')](_0x4b7464,'message')[_0xf05f('0xb')](',\x20'));logger[_0xf05f('0xc')](_0xf05f('0xd'),_0x28bfd0);_0x1e2bfc['next']();}else{var _0x2c59ff=this;var _0x2eb0f2=utils['getMustacheRender'](_0x3cda21[0x0],this);logger[_0xf05f('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x28bfd0,_0x2eb0f2);sh[_0xf05f('0xe')](_['trim'](_0x2eb0f2),function(_0x1e247a,_0x4be7eb){logger[_0xf05f('0xc')](_0xf05f('0xf'),_0x28bfd0,_0x1e247a);if(_0x1e247a==0x0){var _0x5ad24a=_0x4be7eb['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xf05f('0x10')](_0x3cda21[0x1])||_['isEmpty'](_0x3cda21[0x1])){logger[_0xf05f('0xc')](_0xf05f('0x11'),_0x28bfd0);_0x2c59ff[_0xf05f('0x12')][_0x3cda21[0x1]]=_0x5ad24a;}else{logger[_0xf05f('0xc')](_0xf05f('0x13'),_0x28bfd0,_0x3cda21[0x1],_0x5ad24a);_0x2c59ff['body'][_0x3cda21[0x1]]=_0x5ad24a;}}_0x1e2bfc[_0xf05f('0x14')]();});}}catch(_0x3e7af4){logger[_0xf05f('0x9')](_0xf05f('0x15'),_0x28bfd0,_[_0xf05f('0x16')](_0x3e7af4)?JSON[_0xf05f('0x17')](_0x3e7af4):_0x3e7af4);logger[_0xf05f('0xc')](_0xf05f('0xd'),_0x28bfd0);_0x1e2bfc[_0xf05f('0x14')]();}};}; \ 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 ae73547..4244dd7 100644 --- a/server/services/routing/server/applications/tag.js +++ b/server/services/routing/server/applications/tag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x2d1e66,_0x133a43){var _0x12f9b0=function(_0x5deb8f){while(--_0x5deb8f){_0x2d1e66['push'](_0x2d1e66['shift']());}};_0x12f9b0(++_0x133a43);}(_0x7a54,0x106));var _0x47a5=function(_0x170cec,_0x3db5f8){_0x170cec=_0x170cec-0x0;var _0xe19d4e=_0x7a54[_0x170cec];return _0xe19d4e;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ No newline at end of file +var _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x386df8,_0x4cb4b7){var _0x4da795=function(_0x437715){while(--_0x437715){_0x386df8['push'](_0x386df8['shift']());}};_0x4da795(++_0x4cb4b7);}(_0x7a54,0x106));var _0x47a5=function(_0x201299,_0x39f354){_0x201299=_0x201299-0x0;var _0x5f3fed=_0x7a54[_0x201299];return _0x5f3fed;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index ccc415b..86c8682 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 _0x225c=['list','mustache','lodash','merge','body','contact','message','account','interaction'];(function(_0x2c5f86,_0x4e1bd3){var _0x43bb5f=function(_0x2a1bad){while(--_0x2a1bad){_0x2c5f86['push'](_0x2c5f86['shift']());}};_0x43bb5f(++_0x4e1bd3);}(_0x225c,0x106));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0xc225('0x0'));var _=require(_0xc225('0x1'));module['exports']={'getMustacheRender':function(_0x487293,_0x258ead){return Mustache['render'](_0x487293,_[_0xc225('0x2')](_0x258ead[_0xc225('0x3')],{'contact':_0x258ead[_0xc225('0x4')],'message':_0x258ead[_0xc225('0x5')],'account':_0x258ead[_0xc225('0x6')],'interaction':_0x258ead[_0xc225('0x7')],'list':_0x258ead[_0xc225('0x8')]}))||'';}}; \ No newline at end of file +var _0x7a59=['account','interaction','mustache','render','merge','body','message'];(function(_0xd0825d,_0x3d707b){var _0x300b58=function(_0x211ce3){while(--_0x211ce3){_0xd0825d['push'](_0xd0825d['shift']());}};_0x300b58(++_0x3d707b);}(_0x7a59,0x16e));var _0x97a5=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x7a59[_0x589aee];return _0x2f5ed4;};'use strict';var Mustache=require(_0x97a5('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x1f74cd,_0xe6f28a){return Mustache[_0x97a5('0x1')](_0x1f74cd,_[_0x97a5('0x2')](_0xe6f28a[_0x97a5('0x3')],{'contact':_0xe6f28a['contact'],'message':_0xe6f28a[_0x97a5('0x4')],'account':_0xe6f28a[_0x97a5('0x5')],'interaction':_0xe6f28a[_0x97a5('0x6')],'list':_0xe6f28a['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 981e4c8..c7da55e 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 _0x9bdc=['name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','Intervals','map','interval','listen','message','interaction','applications','isArray','length','join','app','.js','autoreply','appdata','split','push','slice','dialogflow','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','rules','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','channel','end','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn'];(function(_0x211e64,_0x5f5746){var _0x188457=function(_0x24f2f4){while(--_0x24f2f4){_0x211e64['push'](_0x211e64['shift']());}};_0x188457(++_0x5f5746);}(_0x9bdc,0x1e0));var _0xc9bd=function(_0x4b6e00,_0x1074b5){_0x4b6e00=_0x4b6e00-0x0;var _0x4f1366=_0x9bdc[_0x4b6e00];return _0x4f1366;};'use strict';var _=require(_0xc9bd('0x0'));var util=require(_0xc9bd('0x1'));var path=require(_0xc9bd('0x2'));var fs=require('fs');var jayson=require(_0xc9bd('0x3'));var BPromise=require(_0xc9bd('0x4'));var uuid=require(_0xc9bd('0x5'));var config=require(_0xc9bd('0x6'));var logger=require(_0xc9bd('0x7'))(_0xc9bd('0x8'));var rpc={'openchannelQueueReport':require(_0xc9bd('0x9'))};var rpc={'openchannelQueueReport':require(_0xc9bd('0x9')),'mailQueueReport':require(_0xc9bd('0xa')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xc9bd('0xb')),'faxQueueReport':require(_0xc9bd('0xc'))};var RuleEngine=require(_0xc9bd('0xd'));function getId(_0x50d4c1,_0x4f77f3,_0x3e9c27){return util[_0xc9bd('0xe')](_0xc9bd('0xf'),_0x50d4c1,_0x4f77f3||0x0,_0x3e9c27||0x0);}function getIntervals(_0x2eb7a1,_0x4cdedb){var _0x52f6b3=[];if(!_['isNil'](_0x4cdedb[_0xc9bd('0x10')])&&!_[_0xc9bd('0x11')](_0x2eb7a1[_0x4cdedb[_0xc9bd('0x10')]])&&!_['isNil'](_0x2eb7a1[_0x4cdedb[_0xc9bd('0x10')]][_0xc9bd('0x12')])){_0x52f6b3=_[_0xc9bd('0x13')](_0x2eb7a1[_0x4cdedb['IntervalId']][_0xc9bd('0x12')],_0xc9bd('0x14'));}else if(!_['isNil'](_0x4cdedb[_0xc9bd('0x14')])){_0x52f6b3=[_0x4cdedb[_0xc9bd('0x14')]];}return _0x52f6b3;}exports[_0xc9bd('0x15')]=function(_0x4b7882){_0x4b7882['rules']={};return new BPromise(function(_0x10a723,_0x18295b){var _0xb25f8={'Start':function(_0x3af809){var _0x2d80e4=this;return new Promise(function(_0x147667,_0x569b86){if(_0x3af809){try{var _0x176100=[];var _0xcb8c73=getId(_0x3af809['channel'],_0x3af809[_0xc9bd('0x16')]?_0x3af809[_0xc9bd('0x16')]['id']:0x0,_0x3af809[_0xc9bd('0x17')]?_0x3af809[_0xc9bd('0x17')]['id']:0x0);if(_0x3af809[_0xc9bd('0x18')]&&_[_0xc9bd('0x19')](_0x3af809[_0xc9bd('0x18')])&&_0x3af809['applications']['length']){for(var _0xacc733=0x0;_0xacc733<_0x3af809[_0xc9bd('0x18')][_0xc9bd('0x1a')];_0xacc733+=0x1){var _0x934062=_0x3af809['applications'][_0xacc733];if(fs['existsSync'](path[_0xc9bd('0x1b')](__dirname,_0xc9bd('0x18'),_0x934062[_0xc9bd('0x1c')]+_0xc9bd('0x1d')))){var _0x35b924=[];switch(_0x934062[_0xc9bd('0x1c')]['toLowerCase']()){case _0xc9bd('0x1e'):var _0x1ee1b9=_0x934062[_0xc9bd('0x1f')][_0xc9bd('0x20')](',');_0x35b924[_0xc9bd('0x21')](_0x1ee1b9[0x0]);_0x35b924['push'](_0x1ee1b9[_0xc9bd('0x22')](0x1,_0x1ee1b9[_0xc9bd('0x1a')])[_0xc9bd('0x1b')](','));break;case _0xc9bd('0x23'):var _0x209648=_0x934062[_0xc9bd('0x1f')][_0xc9bd('0x20')](',');_0x35b924[_0xc9bd('0x21')](_0x209648[0x0]);_0x35b924[_0xc9bd('0x21')](_0x209648[0x1]);_0x35b924[_0xc9bd('0x21')](_0x209648[_0xc9bd('0x22')](0x2,_0x209648[_0xc9bd('0x1a')])['join'](','));break;case _0xc9bd('0x24'):var _0x5070d5=_0x934062[_0xc9bd('0x1f')][_0xc9bd('0x20')](',');_0x35b924[_0xc9bd('0x21')](_0x5070d5[0x0]);_0x35b924[_0xc9bd('0x21')](_0x5070d5[0x1]);_0x35b924[_0xc9bd('0x21')](_0x5070d5[0x2]);_0x35b924[_0xc9bd('0x21')](_0x5070d5[0x3]);_0x35b924[_0xc9bd('0x21')](_0x5070d5['slice'](0x4,_0x5070d5[_0xc9bd('0x1a')])[_0xc9bd('0x1b')](','));break;case _0xc9bd('0x16'):_0x35b924['push'](_0x934062[_0xc9bd('0x1f')]);break;case _0xc9bd('0x25'):_0x35b924[_0xc9bd('0x21')](_0x934062[_0xc9bd('0x26')]);_0x35b924['push'](_0x934062[_0xc9bd('0x1f')]);break;default:_0x35b924=_[_0xc9bd('0x11')](_0x934062[_0xc9bd('0x1f')])?[]:_0x934062[_0xc9bd('0x1f')][_0xc9bd('0x20')](',');}var _0x51ebb4={'id':util['format'](_0xc9bd('0x27'),_0xcb8c73,_0x934062['id'],_0x934062[_0xc9bd('0x1c')]),'condition':require(_0xc9bd('0x28'))[_0xc9bd('0x29')](_0xcb8c73,getIntervals(_0x4b7882['intervals'],_0x934062),_0x4b7882),'consequence':require(_0xc9bd('0x2a')+_0x934062[_0xc9bd('0x1c')])['consequence'](_0xcb8c73,_0x35b924,_0x4b7882,_0x3af809),'p':_0x934062[_0xc9bd('0x2b')]||0x0};logger[_0xc9bd('0x2c')](_0xc9bd('0x2d'),_0x51ebb4['id'],_0xc9bd('0x2e'),getIntervals(_0x4b7882[_0xc9bd('0x2f')],_0x934062)[_0xc9bd('0x1b')](_0xc9bd('0x30')));_0x176100[_0xc9bd('0x21')](_0x51ebb4);}else{logger[_0xc9bd('0x31')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xc9bd('0x1b')](__dirname,'applications',_0x934062[_0xc9bd('0x1c')]+_0xc9bd('0x1d')));}}_0x4b7882[_0xc9bd('0x32')][_0xcb8c73]=new RuleEngine(_0x176100);_0x4b7882[_0xc9bd('0x32')][_0xcb8c73][_0xc9bd('0x33')](_0x3af809,function(_0x2896b2){logger['info'](_0xc9bd('0x34'),JSON[_0xc9bd('0x35')](_0x2896b2[_0xc9bd('0x36')]));if(_0x4b7882[_0xc9bd('0x32')][_0xcb8c73]){_0x4b7882[_0xc9bd('0x32')][_0xcb8c73][_0xc9bd('0x37')]('complete');}});return _0x147667({'code':0xc8,'message':_0x3af809});}else{logger[_0xc9bd('0x2c')](_0xc9bd('0x38'));return _0x147667({'code':0xc8,'message':_0x3af809});}}catch(_0x4d2707){logger[_0xc9bd('0x31')](_0x4d2707[_0xc9bd('0x39')]);return _0x569b86(_0x2d80e4[_0xc9bd('0x31')](0x1f4,_0x4d2707));}}return _0x569b86(_0xc9bd('0x3a'));});},'AcceptMessage':function(_0x44e622){var _0x1ff3a0=this;return new Promise(function(_0x1dff56,_0xab8df3){if(_0x44e622['message']&&_0x44e622[_0xc9bd('0x16')]['id']){try{var _0x59976a=getId(_0x44e622[_0xc9bd('0x3b')],_0x44e622[_0xc9bd('0x16')]?_0x44e622[_0xc9bd('0x16')]['id']:0x0,_0x44e622[_0xc9bd('0x17')]?_0x44e622[_0xc9bd('0x17')]['id']:0x0);if(_0x4b7882[_0xc9bd('0x32')][_0x59976a]){_0x4b7882[_0xc9bd('0x32')][_0x59976a][_0xc9bd('0x37')](_0xc9bd('0x3c'));if(rpc[_0x44e622[_0xc9bd('0x3b')]+'QueueReport']){rpc[_0x44e622[_0xc9bd('0x3b')]+'QueueReport'][_0xc9bd('0x3d')](_0x59976a,{'UserId':_0x44e622[_0xc9bd('0x16')][_0xc9bd('0x3e')]})['catch'](function(_0x2f8eab){logger[_0xc9bd('0x31')](_0xc9bd('0x3f'));});}}return _0x1dff56({'code':0xc8,'message':_0x44e622});}catch(_0x43ec1d){logger[_0xc9bd('0x31')](_0x43ec1d[_0xc9bd('0x39')]);return _0xab8df3(_0x1ff3a0[_0xc9bd('0x31')](0x1f4,_0x43ec1d));}}logger[_0xc9bd('0x31')]('message\x20is\x20empty');return _0xab8df3(_0x1ff3a0[_0xc9bd('0x31')](0x1f4,_0xc9bd('0x40')));});},'RejectMessage':function(_0x304ec5){var _0x8df1fd=this;return new Promise(function(_0x3747af,_0x46ecf4){if(_0x304ec5[_0xc9bd('0x41')]&&_0x304ec5['agent']['id']){try{if(_0x4b7882[_0xc9bd('0x42')][_0x304ec5['agent']['id']]){_0x4b7882[_0xc9bd('0x42')][_0x304ec5[_0xc9bd('0x41')]['id']][_0xc9bd('0x43')]=![];_0x4b7882[_0xc9bd('0x42')][_0x304ec5[_0xc9bd('0x41')]['id']][_0xc9bd('0x44')]=undefined;}return _0x3747af({'code':0xc8,'message':_0x304ec5});}catch(_0x3a605c){logger[_0xc9bd('0x31')](_0x3a605c[_0xc9bd('0x39')]);return _0x46ecf4(_0x8df1fd[_0xc9bd('0x31')](0x1f4,_0x3a605c));}}logger[_0xc9bd('0x31')](_0xc9bd('0x40'));return _0x46ecf4(_0x8df1fd[_0xc9bd('0x31')](0x1f4,_0xc9bd('0x40')));});},'AbandonInteraction':function(_0x2b2c84){var _0x506268=this;return new Promise(function(_0xcd16fa,_0x4017b9){if(_0x2b2c84[_0xc9bd('0x3b')]&&_0x2b2c84[_0xc9bd('0x17')]&&_0x2b2c84[_0xc9bd('0x17')]['id']){try{var _0x257f9e=getId(_0x2b2c84[_0xc9bd('0x3b')],_0x2b2c84[_0xc9bd('0x16')]?_0x2b2c84['message']['id']:0x0,_0x2b2c84[_0xc9bd('0x17')]?_0x2b2c84[_0xc9bd('0x17')]['id']:0x0);if(_0x4b7882['rules'][_0x257f9e]){_0x4b7882[_0xc9bd('0x32')][_0x257f9e][_0xc9bd('0x37')](_0xc9bd('0x3c'));}return _0xcd16fa({'code':0xc8,'message':_0x2b2c84});}catch(_0x546813){logger['error'](_0x546813[_0xc9bd('0x39')]);return _0x4017b9(_0x506268['error'](0x1f4,_0x546813));}}logger[_0xc9bd('0x31')]('message\x20is\x20empty');return _0x4017b9(_0x506268[_0xc9bd('0x31')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x47e169){var _0x3f2266=this;return new Promise(function(_0x491887,_0xe30aa2){if(_0x4b7882['agents'][_0xc9bd('0x45')](_0x47e169['id'])){for(var _0x246166 in _0x47e169[_0xc9bd('0x46')]){if(_0x47e169['capacity'][_0xc9bd('0x45')](_0x246166)){if(_0x4b7882['agents'][_0x47e169['id']][_0xc9bd('0x45')](_0x246166+_0xc9bd('0x47'))){_0x4b7882[_0xc9bd('0x42')][_0x47e169['id']][_0x246166+_0xc9bd('0x47')]=parseInt(_0x47e169[_0xc9bd('0x46')][_0x246166],0xa);}}}_0x4b7882[_0xc9bd('0x42')][_0x47e169['id']][_0xc9bd('0x48')]();return _0x491887({'code':0xc8,'message':_0x4b7882['agents'][_0x47e169['id']]});}else{return _0xe30aa2(_0x3f2266[_0xc9bd('0x31')](0x1f4,_0xc9bd('0x49')));}});},'Agents':function(_0x1cc803){return new Promise(function(_0xd58902,_0x2fbcf0){var _0x9bcb68=_[_0xc9bd('0x4a')](_0x4b7882[_0xc9bd('0x42')]);_0xd58902({'count':_0x9bcb68[_0xc9bd('0x1a')],'rows':_0x9bcb68});});},'ChatQueues':function(_0x37b19e){return new Promise(function(_0x546c23,_0x39c6ef){var _0x58ce44=[];for(var _0x5739f4 in _0x4b7882['chatQueues']){if(_0x4b7882[_0xc9bd('0x4b')][_0xc9bd('0x45')](_0x5739f4)){var _0x27e059=_0x4b7882['chatQueues'][_0x5739f4];var _0x1dceb8={'id':_0x27e059['id'],'available':_0x27e059[_0xc9bd('0x4c')],'loggedIn':_0x27e059[_0xc9bd('0x4d')],'name':_0x27e059[_0xc9bd('0x4e')],'paused':_0x27e059[_0xc9bd('0x4f')],'waiting':_0x27e059[_0xc9bd('0x50')]};_0x58ce44[_0xc9bd('0x21')](_0x1dceb8);}}_0x546c23({'count':_0x58ce44[_0xc9bd('0x1a')],'rows':_0x58ce44});});},'MailQueues':function(_0x1b4ca9){return new Promise(function(_0x1caf4e,_0x25904f){var _0x12516d=[];for(var _0x4528e5 in _0x4b7882[_0xc9bd('0x51')]){if(_0x4b7882['mailQueues']['hasOwnProperty'](_0x4528e5)){var _0x58ddbd=_0x4b7882[_0xc9bd('0x51')][_0x4528e5];var _0x2df164={'id':_0x58ddbd['id'],'available':_0x58ddbd['available'],'loggedIn':_0x58ddbd[_0xc9bd('0x4d')],'name':_0x58ddbd['name'],'paused':_0x58ddbd[_0xc9bd('0x4f')],'waiting':_0x58ddbd[_0xc9bd('0x50')]};_0x12516d[_0xc9bd('0x21')](_0x2df164);}}_0x1caf4e({'count':_0x12516d[_0xc9bd('0x1a')],'rows':_0x12516d});});},'OpenchannelQueues':function(_0x3a8112){return new Promise(function(_0x475ae1,_0x36c6ea){var _0x2cce99=[];for(var _0x275713 in _0x4b7882[_0xc9bd('0x52')]){if(_0x4b7882[_0xc9bd('0x52')][_0xc9bd('0x45')](_0x275713)){var _0x2ca857=_0x4b7882[_0xc9bd('0x52')][_0x275713];var _0x16851f={'id':_0x2ca857['id'],'available':_0x2ca857[_0xc9bd('0x4c')],'loggedIn':_0x2ca857[_0xc9bd('0x4d')],'name':_0x2ca857['name'],'paused':_0x2ca857['paused'],'waiting':_0x2ca857[_0xc9bd('0x50')]};_0x2cce99[_0xc9bd('0x21')](_0x16851f);}}_0x475ae1({'count':_0x2cce99[_0xc9bd('0x1a')],'rows':_0x2cce99});});},'SmsQueues':function(_0x3d8441){return new Promise(function(_0x1fcc1d,_0x311f29){var _0x4d384a=[];for(var _0x5ee0a7 in _0x4b7882[_0xc9bd('0x53')]){if(_0x4b7882[_0xc9bd('0x53')][_0xc9bd('0x45')](_0x5ee0a7)){var _0x3e6f51=_0x4b7882[_0xc9bd('0x53')][_0x5ee0a7];var _0x1ddb1d={'id':_0x3e6f51['id'],'available':_0x3e6f51[_0xc9bd('0x4c')],'loggedIn':_0x3e6f51[_0xc9bd('0x4d')],'name':_0x3e6f51[_0xc9bd('0x4e')],'paused':_0x3e6f51[_0xc9bd('0x4f')],'waiting':_0x3e6f51[_0xc9bd('0x50')]};_0x4d384a[_0xc9bd('0x21')](_0x1ddb1d);}}_0x1fcc1d({'count':_0x4d384a[_0xc9bd('0x1a')],'rows':_0x4d384a});});},'FaxQueues':function(_0x318442){return new Promise(function(_0xf645ec,_0x51a1d9){var _0x30c328=[];for(var _0x157c59 in _0x4b7882[_0xc9bd('0x54')]){if(_0x4b7882[_0xc9bd('0x54')][_0xc9bd('0x45')](_0x157c59)){var _0x3e74cf=_0x4b7882[_0xc9bd('0x54')][_0x157c59];var _0x44a065={'id':_0x3e74cf['id'],'available':_0x3e74cf[_0xc9bd('0x4c')],'loggedIn':_0x3e74cf['loggedIn'],'name':_0x3e74cf[_0xc9bd('0x4e')],'paused':_0x3e74cf[_0xc9bd('0x4f')],'waiting':_0x3e74cf[_0xc9bd('0x50')]};_0x30c328[_0xc9bd('0x21')](_0x44a065);}}_0xf645ec({'count':_0x30c328[_0xc9bd('0x1a')],'rows':_0x30c328});});},'ChatQueuesWaitingInteractions':function(_0x5166c3){return new Promise(function(_0x51854c,_0xd86a2b){var _0x996acb=_['values'](_0x4b7882['chatQueuesWaitingInteractions']);_0x51854c({'count':_0x996acb[_0xc9bd('0x1a')],'rows':_0x996acb});});},'MailQueuesWaitingInteractions':function(_0x528be3){return new Promise(function(_0x1c50d6,_0x1d7dd8){var _0x4b9e42=_['values'](_0x4b7882[_0xc9bd('0x55')]);_0x1c50d6({'count':_0x4b9e42['length'],'rows':_0x4b9e42});});},'OpenchannelQueuesWaitingInteractions':function(_0x54955a){return new Promise(function(_0x2c5b13,_0x592f55){var _0x616c38=_[_0xc9bd('0x4a')](_0x4b7882[_0xc9bd('0x56')]);_0x2c5b13({'count':_0x616c38[_0xc9bd('0x1a')],'rows':_0x616c38});});},'SmsQueuesWaitingInteractions':function(_0x5b6bfd){return new Promise(function(_0x19bd48,_0xab536c){var _0x17b943=_['values'](_0x4b7882[_0xc9bd('0x57')]);_0x19bd48({'count':_0x17b943[_0xc9bd('0x1a')],'rows':_0x17b943});});},'FaxQueuesWaitingInteractions':function(_0x5f4266){return new Promise(function(_0x32bbcb,_0x36d86d){var _0x4841a0=_[_0xc9bd('0x4a')](_0x4b7882[_0xc9bd('0x58')]);_0x32bbcb({'count':_0x4841a0[_0xc9bd('0x1a')],'rows':_0x4841a0});});}};var _0x2c9a4d=jayson['server'](_0xb25f8)[_0xc9bd('0x59')]();_0x2c9a4d['on'](_0xc9bd('0x31'),function(_0x1de1cd){logger[_0xc9bd('0x31')](JSON[_0xc9bd('0x35')](_0x1de1cd));return _0x18295b(_0x1de1cd);});_0x2c9a4d[_0xc9bd('0x15')](0x232c,'127.0.0.1',function(){console[_0xc9bd('0x5a')](_0xc9bd('0x5b'),0x232c);return _0x10a723(_0xc9bd('0x5c')+0x232c);});});}; \ No newline at end of file +var _0xc1c8=['Intervals','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','autoreply','split','push','slice','dialogflow','appdata','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','info','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','log','lodash','util','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','IntervalId','isNil'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xc1c8,0x160));var _0x8c1c=function(_0x502bcf,_0x2abf07){_0x502bcf=_0x502bcf-0x0;var _0x286c0f=_0xc1c8[_0x502bcf];return _0x286c0f;};'use strict';var _=require(_0x8c1c('0x0'));var util=require(_0x8c1c('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x8c1c('0x2'));var BPromise=require(_0x8c1c('0x3'));var uuid=require(_0x8c1c('0x4'));var config=require(_0x8c1c('0x5'));var logger=require(_0x8c1c('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0x8c1c('0x7'))};var rpc={'openchannelQueueReport':require(_0x8c1c('0x7')),'mailQueueReport':require(_0x8c1c('0x8')),'chatQueueReport':require(_0x8c1c('0x9')),'smsQueueReport':require(_0x8c1c('0xa')),'faxQueueReport':require(_0x8c1c('0xb'))};var RuleEngine=require(_0x8c1c('0xc'));function getId(_0x557c9a,_0x34f958,_0x3e384f){return util[_0x8c1c('0xd')]('%s.%s.%s',_0x557c9a,_0x34f958||0x0,_0x3e384f||0x0);}function getIntervals(_0x2170e6,_0x4521b9){var _0x53e332=[];if(!_['isNil'](_0x4521b9['IntervalId'])&&!_['isNil'](_0x2170e6[_0x4521b9[_0x8c1c('0xe')]])&&!_[_0x8c1c('0xf')](_0x2170e6[_0x4521b9['IntervalId']][_0x8c1c('0x10')])){_0x53e332=_['map'](_0x2170e6[_0x4521b9[_0x8c1c('0xe')]][_0x8c1c('0x10')],_0x8c1c('0x11'));}else if(!_[_0x8c1c('0xf')](_0x4521b9['interval'])){_0x53e332=[_0x4521b9[_0x8c1c('0x11')]];}return _0x53e332;}exports[_0x8c1c('0x12')]=function(_0x15a029){_0x15a029[_0x8c1c('0x13')]={};return new BPromise(function(_0xe687ac,_0x1e3d95){var _0x497b3e={'Start':function(_0x12efe8){var _0x9fc675=this;return new Promise(function(_0x16d9b3,_0x12252e){if(_0x12efe8){try{var _0x3f7b92=[];var _0x46cb0a=getId(_0x12efe8[_0x8c1c('0x14')],_0x12efe8[_0x8c1c('0x15')]?_0x12efe8[_0x8c1c('0x15')]['id']:0x0,_0x12efe8[_0x8c1c('0x16')]?_0x12efe8['interaction']['id']:0x0);if(_0x12efe8[_0x8c1c('0x17')]&&_[_0x8c1c('0x18')](_0x12efe8[_0x8c1c('0x17')])&&_0x12efe8[_0x8c1c('0x17')][_0x8c1c('0x19')]){for(var _0x3a35b1=0x0;_0x3a35b1<_0x12efe8[_0x8c1c('0x17')][_0x8c1c('0x19')];_0x3a35b1+=0x1){var _0x75d4d=_0x12efe8[_0x8c1c('0x17')][_0x3a35b1];if(fs[_0x8c1c('0x1a')](path[_0x8c1c('0x1b')](__dirname,_0x8c1c('0x17'),_0x75d4d['app']+'.js'))){var _0x1e71a9=[];switch(_0x75d4d[_0x8c1c('0x1c')]['toLowerCase']()){case _0x8c1c('0x1d'):var _0x5b71b8=_0x75d4d['appdata'][_0x8c1c('0x1e')](',');_0x1e71a9[_0x8c1c('0x1f')](_0x5b71b8[0x0]);_0x1e71a9[_0x8c1c('0x1f')](_0x5b71b8[_0x8c1c('0x20')](0x1,_0x5b71b8[_0x8c1c('0x19')])['join'](','));break;case _0x8c1c('0x21'):var _0x262b03=_0x75d4d[_0x8c1c('0x22')]['split'](',');_0x1e71a9[_0x8c1c('0x1f')](_0x262b03[0x0]);_0x1e71a9['push'](_0x262b03[0x1]);_0x1e71a9['push'](_0x262b03[_0x8c1c('0x20')](0x2,_0x262b03[_0x8c1c('0x19')])[_0x8c1c('0x1b')](','));break;case _0x8c1c('0x23'):var _0x3dbe2e=_0x75d4d[_0x8c1c('0x22')][_0x8c1c('0x1e')](',');_0x1e71a9[_0x8c1c('0x1f')](_0x3dbe2e[0x0]);_0x1e71a9[_0x8c1c('0x1f')](_0x3dbe2e[0x1]);_0x1e71a9[_0x8c1c('0x1f')](_0x3dbe2e[0x2]);_0x1e71a9[_0x8c1c('0x1f')](_0x3dbe2e[0x3]);_0x1e71a9[_0x8c1c('0x1f')](_0x3dbe2e[_0x8c1c('0x20')](0x4,_0x3dbe2e['length'])[_0x8c1c('0x1b')](','));break;case _0x8c1c('0x15'):_0x1e71a9[_0x8c1c('0x1f')](_0x75d4d[_0x8c1c('0x22')]);break;case _0x8c1c('0x24'):_0x1e71a9[_0x8c1c('0x1f')](_0x75d4d[_0x8c1c('0x25')]);_0x1e71a9['push'](_0x75d4d['appdata']);break;default:_0x1e71a9=_['isNil'](_0x75d4d[_0x8c1c('0x22')])?[]:_0x75d4d['appdata']['split'](',');}var _0x592e73={'id':util[_0x8c1c('0xd')](_0x8c1c('0x26'),_0x46cb0a,_0x75d4d['id'],_0x75d4d[_0x8c1c('0x1c')]),'condition':require(_0x8c1c('0x27'))[_0x8c1c('0x28')](_0x46cb0a,getIntervals(_0x15a029['intervals'],_0x75d4d),_0x15a029),'consequence':require(_0x8c1c('0x29')+_0x75d4d[_0x8c1c('0x1c')])[_0x8c1c('0x2a')](_0x46cb0a,_0x1e71a9,_0x15a029,_0x12efe8),'p':_0x75d4d[_0x8c1c('0x2b')]||0x0};logger['info'](_0x8c1c('0x2c'),_0x592e73['id'],_0x8c1c('0x2d'),getIntervals(_0x15a029[_0x8c1c('0x2e')],_0x75d4d)[_0x8c1c('0x1b')](_0x8c1c('0x2f')));_0x3f7b92[_0x8c1c('0x1f')](_0x592e73);}else{logger[_0x8c1c('0x30')](_0x8c1c('0x31'),path[_0x8c1c('0x1b')](__dirname,_0x8c1c('0x17'),_0x75d4d[_0x8c1c('0x1c')]+_0x8c1c('0x32')));}}_0x15a029['rules'][_0x46cb0a]=new RuleEngine(_0x3f7b92);_0x15a029[_0x8c1c('0x13')][_0x46cb0a][_0x8c1c('0x33')](_0x12efe8,function(_0x7e189d){logger[_0x8c1c('0x34')](_0x8c1c('0x35'),JSON[_0x8c1c('0x36')](_0x7e189d[_0x8c1c('0x37')]));if(_0x15a029[_0x8c1c('0x13')][_0x46cb0a]){_0x15a029[_0x8c1c('0x13')][_0x46cb0a][_0x8c1c('0x38')](_0x8c1c('0x39'));}});return _0x16d9b3({'code':0xc8,'message':_0x12efe8});}else{logger['info'](_0x8c1c('0x3a'));return _0x16d9b3({'code':0xc8,'message':_0x12efe8});}}catch(_0x9d371f){logger[_0x8c1c('0x30')](_0x9d371f[_0x8c1c('0x3b')]);return _0x12252e(_0x9fc675['error'](0x1f4,_0x9d371f));}}return _0x12252e('routing\x20is\x20empty');});},'AcceptMessage':function(_0x4356fc){var _0x522230=this;return new Promise(function(_0x2e83ef,_0x12ef2a){if(_0x4356fc[_0x8c1c('0x15')]&&_0x4356fc['message']['id']){try{var _0x3177b6=getId(_0x4356fc['channel'],_0x4356fc[_0x8c1c('0x15')]?_0x4356fc['message']['id']:0x0,_0x4356fc['interaction']?_0x4356fc[_0x8c1c('0x16')]['id']:0x0);if(_0x15a029['rules'][_0x3177b6]){_0x15a029['rules'][_0x3177b6][_0x8c1c('0x38')](_0x8c1c('0x3c'));if(rpc[_0x4356fc[_0x8c1c('0x14')]+'QueueReport']){rpc[_0x4356fc[_0x8c1c('0x14')]+_0x8c1c('0x3d')][_0x8c1c('0x3e')](_0x3177b6,{'UserId':_0x4356fc['message'][_0x8c1c('0x3f')]})[_0x8c1c('0x40')](function(_0x29f7d6){logger['error'](_0x8c1c('0x41'));});}}return _0x2e83ef({'code':0xc8,'message':_0x4356fc});}catch(_0xd608ce){logger['error'](_0xd608ce['stack']);return _0x12ef2a(_0x522230[_0x8c1c('0x30')](0x1f4,_0xd608ce));}}logger[_0x8c1c('0x30')]('message\x20is\x20empty');return _0x12ef2a(_0x522230[_0x8c1c('0x30')](0x1f4,_0x8c1c('0x42')));});},'RejectMessage':function(_0x4b74ed){var _0x414c6f=this;return new Promise(function(_0x27055f,_0x1c9fff){if(_0x4b74ed[_0x8c1c('0x43')]&&_0x4b74ed[_0x8c1c('0x43')]['id']){try{if(_0x15a029[_0x8c1c('0x44')][_0x4b74ed[_0x8c1c('0x43')]['id']]){_0x15a029['agents'][_0x4b74ed[_0x8c1c('0x43')]['id']][_0x8c1c('0x45')]=![];_0x15a029[_0x8c1c('0x44')][_0x4b74ed[_0x8c1c('0x43')]['id']][_0x8c1c('0x46')]=undefined;}return _0x27055f({'code':0xc8,'message':_0x4b74ed});}catch(_0x3b5777){logger[_0x8c1c('0x30')](_0x3b5777[_0x8c1c('0x3b')]);return _0x1c9fff(_0x414c6f[_0x8c1c('0x30')](0x1f4,_0x3b5777));}}logger[_0x8c1c('0x30')](_0x8c1c('0x42'));return _0x1c9fff(_0x414c6f['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1912de){var _0x5b0736=this;return new Promise(function(_0x106b3b,_0x1583b3){if(_0x1912de['channel']&&_0x1912de[_0x8c1c('0x16')]&&_0x1912de[_0x8c1c('0x16')]['id']){try{var _0xf6f2d2=getId(_0x1912de[_0x8c1c('0x14')],_0x1912de[_0x8c1c('0x15')]?_0x1912de[_0x8c1c('0x15')]['id']:0x0,_0x1912de[_0x8c1c('0x16')]?_0x1912de[_0x8c1c('0x16')]['id']:0x0);if(_0x15a029[_0x8c1c('0x13')][_0xf6f2d2]){_0x15a029['rules'][_0xf6f2d2][_0x8c1c('0x38')]('end');}return _0x106b3b({'code':0xc8,'message':_0x1912de});}catch(_0x4223b6){logger['error'](_0x4223b6[_0x8c1c('0x3b')]);return _0x1583b3(_0x5b0736[_0x8c1c('0x30')](0x1f4,_0x4223b6));}}logger['error'](_0x8c1c('0x42'));return _0x1583b3(_0x5b0736[_0x8c1c('0x30')](0x1f4,_0x8c1c('0x42')));});},'AgentCapacity':function(_0x1b3e0){var _0x5ceec1=this;return new Promise(function(_0x1f3ef8,_0x50de09){if(_0x15a029[_0x8c1c('0x44')][_0x8c1c('0x47')](_0x1b3e0['id'])){for(var _0x558579 in _0x1b3e0[_0x8c1c('0x48')]){if(_0x1b3e0['capacity'][_0x8c1c('0x47')](_0x558579)){if(_0x15a029[_0x8c1c('0x44')][_0x1b3e0['id']][_0x8c1c('0x47')](_0x558579+'CurrentCapacity')){_0x15a029[_0x8c1c('0x44')][_0x1b3e0['id']][_0x558579+_0x8c1c('0x49')]=parseInt(_0x1b3e0['capacity'][_0x558579],0xa);}}}_0x15a029[_0x8c1c('0x44')][_0x1b3e0['id']]['updateRealtime']();return _0x1f3ef8({'code':0xc8,'message':_0x15a029[_0x8c1c('0x44')][_0x1b3e0['id']]});}else{return _0x50de09(_0x5ceec1[_0x8c1c('0x30')](0x1f4,_0x8c1c('0x4a')));}});},'Agents':function(_0x3664c8){return new Promise(function(_0x85cee7,_0x45233b){var _0x3764a4=_[_0x8c1c('0x4b')](_0x15a029['agents']);_0x85cee7({'count':_0x3764a4['length'],'rows':_0x3764a4});});},'ChatQueues':function(_0x5397f0){return new Promise(function(_0x45fadd,_0x5811b8){var _0x1608c8=[];for(var _0x114b5b in _0x15a029[_0x8c1c('0x4c')]){if(_0x15a029[_0x8c1c('0x4c')][_0x8c1c('0x47')](_0x114b5b)){var _0x2cb75d=_0x15a029[_0x8c1c('0x4c')][_0x114b5b];var _0x46411b={'id':_0x2cb75d['id'],'available':_0x2cb75d[_0x8c1c('0x4d')],'loggedIn':_0x2cb75d[_0x8c1c('0x4e')],'name':_0x2cb75d['name'],'paused':_0x2cb75d[_0x8c1c('0x4f')],'waiting':_0x2cb75d[_0x8c1c('0x50')]};_0x1608c8[_0x8c1c('0x1f')](_0x46411b);}}_0x45fadd({'count':_0x1608c8[_0x8c1c('0x19')],'rows':_0x1608c8});});},'MailQueues':function(_0x4db53c){return new Promise(function(_0x14186c,_0x5bbcdc){var _0x5b8cf4=[];for(var _0x5915da in _0x15a029[_0x8c1c('0x51')]){if(_0x15a029[_0x8c1c('0x51')][_0x8c1c('0x47')](_0x5915da)){var _0x90fca8=_0x15a029[_0x8c1c('0x51')][_0x5915da];var _0xf3871f={'id':_0x90fca8['id'],'available':_0x90fca8[_0x8c1c('0x4d')],'loggedIn':_0x90fca8[_0x8c1c('0x4e')],'name':_0x90fca8[_0x8c1c('0x52')],'paused':_0x90fca8[_0x8c1c('0x4f')],'waiting':_0x90fca8['waiting']};_0x5b8cf4[_0x8c1c('0x1f')](_0xf3871f);}}_0x14186c({'count':_0x5b8cf4[_0x8c1c('0x19')],'rows':_0x5b8cf4});});},'OpenchannelQueues':function(_0x22d6a2){return new Promise(function(_0x2bbdba,_0x304ac8){var _0x58aaca=[];for(var _0x368d9e in _0x15a029[_0x8c1c('0x53')]){if(_0x15a029['openchannelQueues'][_0x8c1c('0x47')](_0x368d9e)){var _0x4fab3f=_0x15a029[_0x8c1c('0x53')][_0x368d9e];var _0x1289a0={'id':_0x4fab3f['id'],'available':_0x4fab3f[_0x8c1c('0x4d')],'loggedIn':_0x4fab3f[_0x8c1c('0x4e')],'name':_0x4fab3f[_0x8c1c('0x52')],'paused':_0x4fab3f['paused'],'waiting':_0x4fab3f[_0x8c1c('0x50')]};_0x58aaca[_0x8c1c('0x1f')](_0x1289a0);}}_0x2bbdba({'count':_0x58aaca[_0x8c1c('0x19')],'rows':_0x58aaca});});},'SmsQueues':function(_0x1b7608){return new Promise(function(_0xc52ec3,_0x2afa74){var _0x4feb10=[];for(var _0x319ed0 in _0x15a029[_0x8c1c('0x54')]){if(_0x15a029[_0x8c1c('0x54')]['hasOwnProperty'](_0x319ed0)){var _0x258595=_0x15a029[_0x8c1c('0x54')][_0x319ed0];var _0x3e68ee={'id':_0x258595['id'],'available':_0x258595[_0x8c1c('0x4d')],'loggedIn':_0x258595[_0x8c1c('0x4e')],'name':_0x258595[_0x8c1c('0x52')],'paused':_0x258595[_0x8c1c('0x4f')],'waiting':_0x258595[_0x8c1c('0x50')]};_0x4feb10[_0x8c1c('0x1f')](_0x3e68ee);}}_0xc52ec3({'count':_0x4feb10['length'],'rows':_0x4feb10});});},'FaxQueues':function(_0x27d95e){return new Promise(function(_0x11d9d1,_0xa24a5c){var _0x5e7ae9=[];for(var _0x1f28a4 in _0x15a029[_0x8c1c('0x55')]){if(_0x15a029[_0x8c1c('0x55')]['hasOwnProperty'](_0x1f28a4)){var _0xfa8ae5=_0x15a029[_0x8c1c('0x55')][_0x1f28a4];var _0xdca786={'id':_0xfa8ae5['id'],'available':_0xfa8ae5[_0x8c1c('0x4d')],'loggedIn':_0xfa8ae5[_0x8c1c('0x4e')],'name':_0xfa8ae5[_0x8c1c('0x52')],'paused':_0xfa8ae5[_0x8c1c('0x4f')],'waiting':_0xfa8ae5[_0x8c1c('0x50')]};_0x5e7ae9[_0x8c1c('0x1f')](_0xdca786);}}_0x11d9d1({'count':_0x5e7ae9[_0x8c1c('0x19')],'rows':_0x5e7ae9});});},'ChatQueuesWaitingInteractions':function(_0x1b4f36){return new Promise(function(_0x2bb0fc,_0x3da72f){var _0x4a4135=_[_0x8c1c('0x4b')](_0x15a029[_0x8c1c('0x56')]);_0x2bb0fc({'count':_0x4a4135['length'],'rows':_0x4a4135});});},'MailQueuesWaitingInteractions':function(_0x3009c4){return new Promise(function(_0x21c1b4,_0x32494f){var _0x52b37f=_[_0x8c1c('0x4b')](_0x15a029['mailQueuesWaitingInteractions']);_0x21c1b4({'count':_0x52b37f[_0x8c1c('0x19')],'rows':_0x52b37f});});},'OpenchannelQueuesWaitingInteractions':function(_0x1d5410){return new Promise(function(_0x246250,_0x23f3df){var _0x3d6d39=_[_0x8c1c('0x4b')](_0x15a029[_0x8c1c('0x57')]);_0x246250({'count':_0x3d6d39[_0x8c1c('0x19')],'rows':_0x3d6d39});});},'SmsQueuesWaitingInteractions':function(_0x564423){return new Promise(function(_0x5271a5,_0x480194){var _0x137081=_['values'](_0x15a029[_0x8c1c('0x58')]);_0x5271a5({'count':_0x137081['length'],'rows':_0x137081});});},'FaxQueuesWaitingInteractions':function(_0x30d1e8){return new Promise(function(_0x582fa7,_0x53d897){var _0xbfc8dc=_['values'](_0x15a029['faxQueuesWaitingInteractions']);_0x582fa7({'count':_0xbfc8dc[_0x8c1c('0x19')],'rows':_0xbfc8dc});});}};var _0x134d6c=jayson[_0x8c1c('0x59')](_0x497b3e)[_0x8c1c('0x5a')]();_0x134d6c['on'](_0x8c1c('0x30'),function(_0x5b90c4){logger['error'](JSON[_0x8c1c('0x36')](_0x5b90c4));return _0x1e3d95(_0x5b90c4);});_0x134d6c['listen'](0x232c,'127.0.0.1',function(){console[_0x8c1c('0x5b')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0xe687ac('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 9de2d44..7e5382a 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 _0xb863=['bluebird','jayson/promise','lodash','routing','client','request','then','error','condition','rules','info','stop','length','push','format','iftime\x20%s','message','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','util'];(function(_0x2e51f9,_0x320019){var _0xb560e3=function(_0x112881){while(--_0x112881){_0x2e51f9['push'](_0x2e51f9['shift']());}};_0xb560e3(++_0x320019);}(_0xb863,0x104));var _0x3b86=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xb863[_0x209941];return _0x1e8729;};'use strict';var util=require(_0x3b86('0x0'));var BPromise=require(_0x3b86('0x1'));var jayson=require(_0x3b86('0x2'));var _=require(_0x3b86('0x3'));var logger=require('../../../config/logger')(_0x3b86('0x4'));var client=jayson[_0x3b86('0x5')]['http']({'port':0x232a});function request(_0x6aabb8,_0x37471a){return new BPromise(function(_0x2895b3,_0x15512){return client[_0x3b86('0x6')](_0x6aabb8,_0x37471a)[_0x3b86('0x7')](function(_0xc23ae9){if(_0xc23ae9[_0x3b86('0x8')]){return _0x15512(_0xc23ae9[_0x3b86('0x8')]['message']);}else{return _0x2895b3(_0xc23ae9['result']);}})['catch'](function(_0x4e0ed8){return _0x15512(_0x4e0ed8);});});}exports[_0x3b86('0x9')]=function(_0x533b43,_0x5a646b,_0x5700d3){return function(_0x458d8d){if(_0x5700d3[_0x3b86('0xa')]&&!_0x5700d3[_0x3b86('0xa')][_0x533b43]){logger[_0x3b86('0xb')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x533b43);return _0x458d8d[_0x3b86('0xc')]();}var _0x78d0e3=[];for(var _0x3e05a6=0x0;_0x3e05a6<_0x5a646b[_0x3b86('0xd')];_0x3e05a6+=0x1){_0x78d0e3[_0x3b86('0xe')](request('Command',{'command':util[_0x3b86('0xf')](_0x3b86('0x10'),_0x5a646b[_0x3e05a6])})[_0x3b86('0x7')](function(_0xbd255a){return _0xbd255a&&_0xbd255a['message']&&_0xbd255a[_0x3b86('0x11')][_0x3b86('0x12')](_0x3b86('0x13'))>=0x0?!![]:![];})['catch'](function(_0x48e20f){logger[_0x3b86('0x8')](_0x3b86('0x14'),_0x533b43,_0x5a646b[_0x3e05a6]);}));}BPromise[_0x3b86('0x15')](_0x78d0e3)[_0x3b86('0x7')](function(_0x830843){var _0x2a8a87=_[_0x3b86('0x16')](_0x830843);logger[_0x3b86('0xb')](_0x3b86('0x17'),_0x533b43,_0x5a646b[_0x3b86('0x18')](_0x3b86('0x19')),_0x2a8a87);_0x458d8d[_0x3b86('0x1a')](_0x2a8a87);})['catch'](function(_0x395cf5){console[_0x3b86('0x1b')](_0x395cf5);logger[_0x3b86('0x8')](_0x3b86('0x17'),_0x533b43,_0x5a646b[_0x3b86('0x18')](_0x3b86('0x19')),_0x395cf5[_0x3b86('0x1c')]);_0x458d8d['stop']();});};}; \ No newline at end of file +var _0xbc02=['catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','format','indexOf','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','log','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error','message','result'];(function(_0x36cff7,_0x5cb048){var _0x21c697=function(_0x1aab10){while(--_0x1aab10){_0x36cff7['push'](_0x36cff7['shift']());}};_0x21c697(++_0x5cb048);}(_0xbc02,0x73));var _0x2bc0=function(_0x293e7a,_0x1792a2){_0x293e7a=_0x293e7a-0x0;var _0xb78342=_0xbc02[_0x293e7a];return _0xb78342;};'use strict';var util=require(_0x2bc0('0x0'));var BPromise=require(_0x2bc0('0x1'));var jayson=require(_0x2bc0('0x2'));var _=require(_0x2bc0('0x3'));var logger=require(_0x2bc0('0x4'))(_0x2bc0('0x5'));var client=jayson[_0x2bc0('0x6')][_0x2bc0('0x7')]({'port':0x232a});function request(_0x3d79ce,_0x3689ed){return new BPromise(function(_0x1441ea,_0x2425bd){return client[_0x2bc0('0x8')](_0x3d79ce,_0x3689ed)[_0x2bc0('0x9')](function(_0x235f61){if(_0x235f61[_0x2bc0('0xa')]){return _0x2425bd(_0x235f61[_0x2bc0('0xa')][_0x2bc0('0xb')]);}else{return _0x1441ea(_0x235f61[_0x2bc0('0xc')]);}})[_0x2bc0('0xd')](function(_0x228a0e){return _0x2425bd(_0x228a0e);});});}exports[_0x2bc0('0xe')]=function(_0x103d3e,_0x211365,_0x48a8dd){return function(_0x10b333){if(_0x48a8dd['rules']&&!_0x48a8dd[_0x2bc0('0xf')][_0x103d3e]){logger[_0x2bc0('0x10')](_0x2bc0('0x11'),_0x103d3e);return _0x10b333[_0x2bc0('0x12')]();}var _0x1c6343=[];for(var _0x357402=0x0;_0x357402<_0x211365[_0x2bc0('0x13')];_0x357402+=0x1){_0x1c6343['push'](request(_0x2bc0('0x14'),{'command':util[_0x2bc0('0x15')]('iftime\x20%s',_0x211365[_0x357402])})['then'](function(_0x512cef){return _0x512cef&&_0x512cef['message']&&_0x512cef[_0x2bc0('0xb')][_0x2bc0('0x16')](_0x2bc0('0x17'))>=0x0?!![]:![];})[_0x2bc0('0xd')](function(_0x9398ce){logger[_0x2bc0('0xa')](_0x2bc0('0x18'),_0x103d3e,_0x211365[_0x357402]);}));}BPromise[_0x2bc0('0x19')](_0x1c6343)['then'](function(_0x5839ad){var _0x3e91aa=_[_0x2bc0('0x1a')](_0x5839ad);logger['info'](_0x2bc0('0x1b'),_0x103d3e,_0x211365[_0x2bc0('0x1c')]('\x20|\x20'),_0x3e91aa);_0x10b333['when'](_0x3e91aa);})[_0x2bc0('0xd')](function(_0x1745f3){console[_0x2bc0('0x1d')](_0x1745f3);logger[_0x2bc0('0xa')](_0x2bc0('0x1b'),_0x103d3e,_0x211365[_0x2bc0('0x1c')](_0x2bc0('0x1e')),_0x1745f3[_0x2bc0('0x1f')]);_0x10b333[_0x2bc0('0x12')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c676e0d..c10e218 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 _0x8ff4=['transferuniqueid','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','origtransfereruniqueid','transfertargetuniqueid','hangup','diffTime','agent','lodash','format','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','agentacw','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','agentcalledAt','now','called','error','stack','isNil','agentringnoanswer','agentringnoanswerAt','timeout','ringtime','talktime','forIn','abandoned','reason','holdtime','agentconnect','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcompleteAt','complete','blindtransfer','transfereruniqueid','transfer','blind','transferexten','extension','attendedtransfer','origtransfererlinkedid','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten'];(function(_0x761b6d,_0x7c7fa8){var _0x3a1639=function(_0x33b90a){while(--_0x33b90a){_0x761b6d['push'](_0x761b6d['shift']());}};_0x3a1639(++_0x7c7fa8);}(_0x8ff4,0x11f));var _0x48ff=function(_0x5499ab,_0x4c1128){_0x5499ab=_0x5499ab-0x0;var _0x344478=_0x8ff4[_0x5499ab];return _0x344478;};'use strict';var _=require(_0x48ff('0x0'));var util=require('util');var utils=require('./utils');var agents={};var transfers={};function writeDB(_0x26956f,_0x174b04){utils['info'](util[_0x48ff('0x1')](_0x48ff('0x2'),_0x26956f[_0x48ff('0x3')],_0x26956f[_0x48ff('0x4')],_0x26956f[_0x48ff('0x5')],_0x26956f[_0x48ff('0x6')],_0x26956f[_0x48ff('0x7')],_0x26956f[_0x48ff('0x8')],_0x26956f[_0x48ff('0x9')],_0x26956f[_0x48ff('0xa')]));if(_0x26956f[_0x48ff('0x5')]){utils[_0x48ff('0xb')](_0x26956f[_0x48ff('0x5')])[_0x48ff('0xc')](function(_0x5687e7){if(_0x5687e7){_0x26956f[_0x48ff('0xd')]=_0x5687e7[_0x48ff('0xd')];_0x26956f['agentacw']=_0x26956f[_0x48ff('0xe')]?_0x5687e7[_0x48ff('0xf')]:![];_0x26956f['acwtime']=_0x26956f[_0x48ff('0x10')]?_0x5687e7[_0x48ff('0x11')]:0x0;}utils['request'](_0x48ff('0x12'),_0x26956f);});}else{utils[_0x48ff('0x13')](_0x48ff('0x12'),_0x26956f);}if(_0x174b04){delete transfers[_0x26956f[_0x48ff('0x3')]];}else{delete agents[_0x26956f[_0x48ff('0x14')]];}}exports[_0x48ff('0x15')]=function(_0x1cf9b5){try{agents[_0x1cf9b5[_0x48ff('0x14')]]=_0x1cf9b5;agents[_0x1cf9b5[_0x48ff('0x14')]][_0x48ff('0x16')]=utils[_0x48ff('0x17')]();agents[_0x1cf9b5[_0x48ff('0x14')]][_0x48ff('0xa')]=_0x48ff('0x18');agents[_0x1cf9b5['destuniqueid']][_0x48ff('0x9')]=null;agents[_0x1cf9b5[_0x48ff('0x14')]]['connectedlinename']=null;}catch(_0x265e6e){utils[_0x48ff('0x19')](_0x265e6e[_0x48ff('0x1a')]);}};exports['agentringnoanswer']=function(_0x99d4d6){try{if(!_[_0x48ff('0x1b')](agents[_0x99d4d6['destuniqueid']])){agents[_0x99d4d6[_0x48ff('0x14')]][_0x48ff('0x1c')]=!![];agents[_0x99d4d6['destuniqueid']][_0x48ff('0x1d')]=utils[_0x48ff('0x17')]();agents[_0x99d4d6['destuniqueid']][_0x48ff('0xa')]=_0x48ff('0x1e');agents[_0x99d4d6[_0x48ff('0x14')]]['reason']='timeout';agents[_0x99d4d6[_0x48ff('0x14')]]['holdtime']=_0x99d4d6[_0x48ff('0x1f')]?parseInt(_0x99d4d6[_0x48ff('0x1f')])/0x3e8:0x0;agents[_0x99d4d6[_0x48ff('0x14')]][_0x48ff('0x20')]=0x0;writeDB(agents[_0x99d4d6[_0x48ff('0x14')]]);}}catch(_0x18343a){utils[_0x48ff('0x19')](_0x18343a[_0x48ff('0x1a')]);}};exports['queuecallerabandon']=function(_0x3e702f){try{_[_0x48ff('0x21')](agents,function(_0x5166ee,_0x421c11){if(_0x5166ee[_0x48ff('0x3')]==_0x3e702f[_0x48ff('0x3')]){_0x5166ee[_0x48ff('0x1c')]=!![];_0x5166ee[_0x48ff('0x1d')]=utils[_0x48ff('0x17')]();_0x5166ee['lastevent']=_0x48ff('0x22');_0x5166ee[_0x48ff('0x23')]='abandoned';_0x5166ee[_0x48ff('0x24')]=_0x3e702f[_0x48ff('0x24')];_0x5166ee[_0x48ff('0x20')]=0x0;writeDB(_0x5166ee);}});}catch(_0xb3da23){utils[_0x48ff('0x19')](_0xb3da23[_0x48ff('0x1a')]);}};exports[_0x48ff('0x25')]=function(_0x1899de){try{if(agents[_0x1899de[_0x48ff('0x14')]]){agents[_0x1899de[_0x48ff('0x14')]][_0x48ff('0x26')]=utils['now']();agents[_0x1899de[_0x48ff('0x14')]][_0x48ff('0x9')]=_0x1899de[_0x48ff('0x9')];agents[_0x1899de[_0x48ff('0x14')]]['connectedlinename']=_0x1899de[_0x48ff('0x27')];agents[_0x1899de['destuniqueid']][_0x48ff('0x24')]=_0x1899de['ringtime'];agents[_0x1899de[_0x48ff('0x14')]][_0x48ff('0xa')]=_0x48ff('0x28');_[_0x48ff('0x21')](agents,function(_0x28763b,_0x182289){if(_0x28763b['destuniqueid']!=_0x1899de[_0x48ff('0x14')]&&_0x28763b[_0x48ff('0x3')]==_0x1899de[_0x48ff('0x3')]){_0x28763b[_0x48ff('0x20')]=0x0;_0x28763b[_0x48ff('0x24')]=_0x1899de[_0x48ff('0x1f')];_0x28763b[_0x48ff('0x1c')]=!![];_0x28763b['agentringnoanswerAt']=utils[_0x48ff('0x17')]();_0x28763b[_0x48ff('0xa')]='answered_elsewhere';_0x28763b[_0x48ff('0x23')]=_0x48ff('0x29');_0x28763b[_0x48ff('0x2a')]=_0x1899de[_0x48ff('0x14')];_0x28763b[_0x48ff('0x2b')]=_0x1899de[_0x48ff('0x6')];writeDB(_0x28763b);}});}}catch(_0x20f685){utils[_0x48ff('0x19')](_0x20f685[_0x48ff('0x1a')]);}};exports[_0x48ff('0xe')]=function(_0x393820){try{if(!_[_0x48ff('0x1b')](agents[_0x393820[_0x48ff('0x14')]])){agents[_0x393820[_0x48ff('0x14')]]['agentcomplete']=!![];agents[_0x393820[_0x48ff('0x14')]][_0x48ff('0x2c')]=utils[_0x48ff('0x17')]();agents[_0x393820[_0x48ff('0x14')]]['talktime']=utils['diffTime'](agents[_0x393820[_0x48ff('0x14')]]['agentcompleteAt'],agents[_0x393820['destuniqueid']][_0x48ff('0x26')]);agents[_0x393820[_0x48ff('0x14')]][_0x48ff('0x23')]=_0x393820[_0x48ff('0x23')];agents[_0x393820['destuniqueid']][_0x48ff('0xa')]=_0x48ff('0x2d');writeDB(agents[_0x393820['destuniqueid']]);}}catch(_0x1c47c8){utils[_0x48ff('0x19')](_0x1c47c8['stack']);}};exports[_0x48ff('0x2e')]=function(_0x589f65){try{if(!_[_0x48ff('0x1b')](agents[_0x589f65[_0x48ff('0x2f')]])){agents[_0x589f65[_0x48ff('0x2f')]][_0x48ff('0x30')]=!![];agents[_0x589f65[_0x48ff('0x2f')]]['transfertype']=_0x48ff('0x31');agents[_0x589f65['transfereruniqueid']][_0x48ff('0x32')]=_0x589f65[_0x48ff('0x33')];agents[_0x589f65['transfereruniqueid']]['transferuniqueid']=agents[_0x589f65[_0x48ff('0x2f')]]['uniqueid'];}}catch(_0x13cd88){utils[_0x48ff('0x19')](_0x13cd88[_0x48ff('0x1a')]);}};exports[_0x48ff('0x34')]=function(_0x53a8a9){try{if(_0x53a8a9['origtransfereruniqueid']==_0x53a8a9[_0x48ff('0x35')]){if(!_[_0x48ff('0x1b')](agents[_0x53a8a9['secondtransfereruniqueid']])){agents[_0x53a8a9[_0x48ff('0x36')]][_0x48ff('0x30')]=!![];agents[_0x53a8a9[_0x48ff('0x36')]][_0x48ff('0x37')]=_0x48ff('0x38');agents[_0x53a8a9[_0x48ff('0x36')]]['transferexten']=_0x53a8a9[_0x48ff('0x39')];agents[_0x53a8a9[_0x48ff('0x36')]][_0x48ff('0x3a')]=_0x53a8a9['origtransfereruniqueid'];}if(_0x53a8a9[_0x48ff('0x3b')]&&agents[_0x53a8a9[_0x48ff('0x3b')]]){agents[_0x53a8a9[_0x48ff('0x3b')]]['agententerreason']=0x1;transfers[_0x53a8a9[_0x48ff('0x3b')]]=_[_0x48ff('0x3c')](agents[_0x53a8a9[_0x48ff('0x3b')]]);transfers[_0x53a8a9[_0x48ff('0x3b')]][_0x48ff('0x8')]=agents[_0x53a8a9[_0x48ff('0x36')]]['calleridnum'];transfers[_0x53a8a9['transfereeuniqueid']][_0x48ff('0x3d')]=agents[_0x53a8a9[_0x48ff('0x36')]]['calleridname'];transfers[_0x53a8a9['transfereeuniqueid']][_0x48ff('0x16')]=utils[_0x48ff('0x17')]();transfers[_0x53a8a9[_0x48ff('0x3b')]]['agentconnectAt']=utils[_0x48ff('0x17')]();transfers[_0x53a8a9['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x53a8a9[_0x48ff('0x3b')]][_0x48ff('0x3e')]=0x2;}}else if(_0x53a8a9[_0x48ff('0x36')]==_0x53a8a9[_0x48ff('0x3f')]){if(!_[_0x48ff('0x1b')](agents[_0x53a8a9[_0x48ff('0x40')]])){agents[_0x53a8a9[_0x48ff('0x40')]][_0x48ff('0x30')]=!![];agents[_0x53a8a9['origtransfereruniqueid']][_0x48ff('0x37')]=_0x48ff('0x38');agents[_0x53a8a9[_0x48ff('0x40')]][_0x48ff('0x32')]=_0x53a8a9['secondtransfererexten'];agents[_0x53a8a9['origtransfereruniqueid']][_0x48ff('0x3a')]=_0x53a8a9[_0x48ff('0x36')];}if(_0x53a8a9[_0x48ff('0x41')]&&agents[_0x53a8a9[_0x48ff('0x41')]]){agents[_0x53a8a9['transfertargetuniqueid']][_0x48ff('0x3e')]=0x1;transfers[_0x53a8a9[_0x48ff('0x41')]]=_[_0x48ff('0x3c')](agents[_0x53a8a9[_0x48ff('0x41')]]);transfers[_0x53a8a9[_0x48ff('0x41')]][_0x48ff('0x8')]=agents[_0x53a8a9[_0x48ff('0x40')]][_0x48ff('0x8')];transfers[_0x53a8a9[_0x48ff('0x41')]][_0x48ff('0x3d')]=agents[_0x53a8a9['origtransfereruniqueid']]['calleridname'];transfers[_0x53a8a9[_0x48ff('0x41')]]['agentcalledAt']=utils[_0x48ff('0x17')]();transfers[_0x53a8a9['transfertargetuniqueid']][_0x48ff('0x26')]=utils['now']();transfers[_0x53a8a9[_0x48ff('0x41')]][_0x48ff('0x24')]=0x0;transfers[_0x53a8a9['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x553640){utils[_0x48ff('0x19')](_0x553640[_0x48ff('0x1a')]);}};exports[_0x48ff('0x42')]=function(_0x2a1fe3){try{if(transfers[_0x2a1fe3[_0x48ff('0x3')]]){transfers[_0x2a1fe3[_0x48ff('0x3')]][_0x48ff('0xe')]=!![];transfers[_0x2a1fe3[_0x48ff('0x3')]]['agentcompleteAt']=utils[_0x48ff('0x17')]();transfers[_0x2a1fe3[_0x48ff('0x3')]][_0x48ff('0x20')]=utils[_0x48ff('0x43')](transfers[_0x2a1fe3[_0x48ff('0x3')]][_0x48ff('0x2c')],transfers[_0x2a1fe3[_0x48ff('0x3')]][_0x48ff('0x26')]);transfers[_0x2a1fe3['uniqueid']]['reason']=_0x48ff('0x44');transfers[_0x2a1fe3[_0x48ff('0x3')]][_0x48ff('0xa')]=_0x48ff('0x2d');writeDB(transfers[_0x2a1fe3[_0x48ff('0x3')]],!![]);}if(agents[_0x2a1fe3['uniqueid']]&&agents[_0x2a1fe3[_0x48ff('0x3')]]['agentconnectAt']){agents[_0x2a1fe3[_0x48ff('0x3')]][_0x48ff('0xe')]=!![];agents[_0x2a1fe3[_0x48ff('0x3')]][_0x48ff('0x2c')]=utils[_0x48ff('0x17')]();agents[_0x2a1fe3[_0x48ff('0x3')]]['talktime']=utils[_0x48ff('0x43')](agents[_0x2a1fe3['uniqueid']][_0x48ff('0x2c')],agents[_0x2a1fe3['uniqueid']][_0x48ff('0x26')]);agents[_0x2a1fe3[_0x48ff('0x3')]]['reason']=agents[_0x2a1fe3['uniqueid']][_0x48ff('0x30')]?_0x48ff('0x30'):'agent';agents[_0x2a1fe3['uniqueid']][_0x48ff('0xa')]=_0x48ff('0x2d');writeDB(agents[_0x2a1fe3['uniqueid']]);}}catch(_0x1d6cee){utils[_0x48ff('0x19')](_0x1d6cee['stack']);}}; \ No newline at end of file +var _0x45d8=['connectedlinenum','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','membername','agentcomplete','agentcompleteAt','agentconnectAt','complete','blindtransfer','transfer','transfereruniqueid','transfertype','blind','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','agententerreason','transfereeuniqueid','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','diffTime','agent','lodash','util','./utils','info','AGENT|%s|%s|%s|%s|%s|%s|%s|%s','channel','queue','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','agentcalledAt','now','connectedlinename','error','stack','isNil','agentringnoanswer','timeout','holdtime','ringtime','queuecallerabandon','forIn','agentringnoanswerAt','reason','abandoned','talktime'];(function(_0xbc1a4b,_0x4dfbe4){var _0x108b87=function(_0x409062){while(--_0x409062){_0xbc1a4b['push'](_0xbc1a4b['shift']());}};_0x108b87(++_0x4dfbe4);}(_0x45d8,0x174));var _0x845d=function(_0x198d2a,_0x510eb7){_0x198d2a=_0x198d2a-0x0;var _0xfda34d=_0x45d8[_0x198d2a];return _0xfda34d;};'use strict';var _=require(_0x845d('0x0'));var util=require(_0x845d('0x1'));var utils=require(_0x845d('0x2'));var agents={};var transfers={};function writeDB(_0x257454,_0x2d79c4){utils[_0x845d('0x3')](util['format'](_0x845d('0x4'),_0x257454['uniqueid'],_0x257454[_0x845d('0x5')],_0x257454[_0x845d('0x6')],_0x257454['membername'],_0x257454['interface'],_0x257454[_0x845d('0x7')],_0x257454['connectedlinenum'],_0x257454[_0x845d('0x8')]));if(_0x257454[_0x845d('0x6')]){utils[_0x845d('0x9')](_0x257454[_0x845d('0x6')])[_0x845d('0xa')](function(_0x474281){if(_0x474281){_0x257454['type']=_0x474281[_0x845d('0xb')];_0x257454[_0x845d('0xc')]=_0x257454['agentcomplete']?_0x474281['acw']:![];_0x257454[_0x845d('0xd')]=_0x257454[_0x845d('0xc')]?_0x474281[_0x845d('0xe')]:0x0;}utils[_0x845d('0xf')](_0x845d('0x10'),_0x257454);});}else{utils['request'](_0x845d('0x10'),_0x257454);}if(_0x2d79c4){delete transfers[_0x257454[_0x845d('0x11')]];}else{delete agents[_0x257454[_0x845d('0x12')]];}}exports[_0x845d('0x13')]=function(_0x5dbb1a){try{agents[_0x5dbb1a['destuniqueid']]=_0x5dbb1a;agents[_0x5dbb1a[_0x845d('0x12')]][_0x845d('0x14')]=utils[_0x845d('0x15')]();agents[_0x5dbb1a['destuniqueid']][_0x845d('0x8')]='called';agents[_0x5dbb1a[_0x845d('0x12')]]['connectedlinenum']=null;agents[_0x5dbb1a[_0x845d('0x12')]][_0x845d('0x16')]=null;}catch(_0xbf78ce){utils[_0x845d('0x17')](_0xbf78ce[_0x845d('0x18')]);}};exports['agentringnoanswer']=function(_0x4ed4d7){try{if(!_[_0x845d('0x19')](agents[_0x4ed4d7[_0x845d('0x12')]])){agents[_0x4ed4d7[_0x845d('0x12')]][_0x845d('0x1a')]=!![];agents[_0x4ed4d7[_0x845d('0x12')]]['agentringnoanswerAt']=utils[_0x845d('0x15')]();agents[_0x4ed4d7[_0x845d('0x12')]][_0x845d('0x8')]=_0x845d('0x1b');agents[_0x4ed4d7[_0x845d('0x12')]]['reason']=_0x845d('0x1b');agents[_0x4ed4d7[_0x845d('0x12')]][_0x845d('0x1c')]=_0x4ed4d7[_0x845d('0x1d')]?parseInt(_0x4ed4d7[_0x845d('0x1d')])/0x3e8:0x0;agents[_0x4ed4d7[_0x845d('0x12')]]['talktime']=0x0;writeDB(agents[_0x4ed4d7[_0x845d('0x12')]]);}}catch(_0x2feec0){utils[_0x845d('0x17')](_0x2feec0['stack']);}};exports[_0x845d('0x1e')]=function(_0x7daf52){try{_[_0x845d('0x1f')](agents,function(_0x332e59,_0x358429){if(_0x332e59['uniqueid']==_0x7daf52[_0x845d('0x11')]){_0x332e59['agentringnoanswer']=!![];_0x332e59[_0x845d('0x20')]=utils[_0x845d('0x15')]();_0x332e59['lastevent']='abandoned';_0x332e59[_0x845d('0x21')]=_0x845d('0x22');_0x332e59[_0x845d('0x1c')]=_0x7daf52[_0x845d('0x1c')];_0x332e59[_0x845d('0x23')]=0x0;writeDB(_0x332e59);}});}catch(_0x5a1adb){utils[_0x845d('0x17')](_0x5a1adb[_0x845d('0x18')]);}};exports['agentconnect']=function(_0x48d4cd){try{if(agents[_0x48d4cd['destuniqueid']]){agents[_0x48d4cd[_0x845d('0x12')]]['agentconnectAt']=utils['now']();agents[_0x48d4cd[_0x845d('0x12')]][_0x845d('0x24')]=_0x48d4cd[_0x845d('0x24')];agents[_0x48d4cd['destuniqueid']][_0x845d('0x16')]=_0x48d4cd[_0x845d('0x16')];agents[_0x48d4cd[_0x845d('0x12')]]['holdtime']=_0x48d4cd[_0x845d('0x1d')];agents[_0x48d4cd['destuniqueid']][_0x845d('0x8')]=_0x845d('0x25');_[_0x845d('0x1f')](agents,function(_0x14c503,_0x142c0f){if(_0x14c503['destuniqueid']!=_0x48d4cd['destuniqueid']&&_0x14c503[_0x845d('0x11')]==_0x48d4cd[_0x845d('0x11')]){_0x14c503[_0x845d('0x23')]=0x0;_0x14c503[_0x845d('0x1c')]=_0x48d4cd['ringtime'];_0x14c503['agentringnoanswer']=!![];_0x14c503[_0x845d('0x20')]=utils['now']();_0x14c503[_0x845d('0x8')]='answered_elsewhere';_0x14c503[_0x845d('0x21')]=_0x845d('0x26');_0x14c503[_0x845d('0x27')]=_0x48d4cd['destuniqueid'];_0x14c503[_0x845d('0x28')]=_0x48d4cd[_0x845d('0x29')];writeDB(_0x14c503);}});}}catch(_0x4ade0d){utils[_0x845d('0x17')](_0x4ade0d[_0x845d('0x18')]);}};exports[_0x845d('0x2a')]=function(_0x22d62a){try{if(!_[_0x845d('0x19')](agents[_0x22d62a[_0x845d('0x12')]])){agents[_0x22d62a['destuniqueid']][_0x845d('0x2a')]=!![];agents[_0x22d62a['destuniqueid']][_0x845d('0x2b')]=utils[_0x845d('0x15')]();agents[_0x22d62a[_0x845d('0x12')]][_0x845d('0x23')]=utils['diffTime'](agents[_0x22d62a[_0x845d('0x12')]][_0x845d('0x2b')],agents[_0x22d62a[_0x845d('0x12')]][_0x845d('0x2c')]);agents[_0x22d62a[_0x845d('0x12')]][_0x845d('0x21')]=_0x22d62a[_0x845d('0x21')];agents[_0x22d62a['destuniqueid']]['lastevent']=_0x845d('0x2d');writeDB(agents[_0x22d62a['destuniqueid']]);}}catch(_0x53096d){utils[_0x845d('0x17')](_0x53096d[_0x845d('0x18')]);}};exports[_0x845d('0x2e')]=function(_0x2553ff){try{if(!_[_0x845d('0x19')](agents[_0x2553ff['transfereruniqueid']])){agents[_0x2553ff['transfereruniqueid']][_0x845d('0x2f')]=!![];agents[_0x2553ff[_0x845d('0x30')]][_0x845d('0x31')]=_0x845d('0x32');agents[_0x2553ff[_0x845d('0x30')]]['transferexten']=_0x2553ff['extension'];agents[_0x2553ff[_0x845d('0x30')]][_0x845d('0x33')]=agents[_0x2553ff[_0x845d('0x30')]][_0x845d('0x11')];}}catch(_0x34213b){utils[_0x845d('0x17')](_0x34213b[_0x845d('0x18')]);}};exports[_0x845d('0x34')]=function(_0x2d335c){try{if(_0x2d335c[_0x845d('0x35')]==_0x2d335c[_0x845d('0x36')]){if(!_[_0x845d('0x19')](agents[_0x2d335c[_0x845d('0x37')]])){agents[_0x2d335c[_0x845d('0x37')]]['transfer']=!![];agents[_0x2d335c[_0x845d('0x37')]][_0x845d('0x31')]=_0x845d('0x38');agents[_0x2d335c[_0x845d('0x37')]][_0x845d('0x39')]=_0x2d335c['origtransfererexten'];agents[_0x2d335c[_0x845d('0x37')]][_0x845d('0x33')]=_0x2d335c[_0x845d('0x35')];}if(_0x2d335c['transfereeuniqueid']&&agents[_0x2d335c['transfereeuniqueid']]){agents[_0x2d335c['transfereeuniqueid']][_0x845d('0x3a')]=0x1;transfers[_0x2d335c[_0x845d('0x3b')]]=_[_0x845d('0x3c')](agents[_0x2d335c[_0x845d('0x3b')]]);transfers[_0x2d335c[_0x845d('0x3b')]]['calleridnum']=agents[_0x2d335c[_0x845d('0x37')]][_0x845d('0x7')];transfers[_0x2d335c[_0x845d('0x3b')]][_0x845d('0x3d')]=agents[_0x2d335c[_0x845d('0x37')]]['calleridname'];transfers[_0x2d335c['transfereeuniqueid']]['agentcalledAt']=utils['now']();transfers[_0x2d335c[_0x845d('0x3b')]]['agentconnectAt']=utils['now']();transfers[_0x2d335c[_0x845d('0x3b')]]['holdtime']=0x0;transfers[_0x2d335c[_0x845d('0x3b')]][_0x845d('0x3a')]=0x2;}}else if(_0x2d335c['secondtransfereruniqueid']==_0x2d335c[_0x845d('0x3e')]){if(!_[_0x845d('0x19')](agents[_0x2d335c[_0x845d('0x35')]])){agents[_0x2d335c['origtransfereruniqueid']][_0x845d('0x2f')]=!![];agents[_0x2d335c[_0x845d('0x35')]]['transfertype']=_0x845d('0x38');agents[_0x2d335c[_0x845d('0x35')]]['transferexten']=_0x2d335c[_0x845d('0x3f')];agents[_0x2d335c[_0x845d('0x35')]][_0x845d('0x33')]=_0x2d335c[_0x845d('0x37')];}if(_0x2d335c[_0x845d('0x40')]&&agents[_0x2d335c[_0x845d('0x40')]]){agents[_0x2d335c[_0x845d('0x40')]][_0x845d('0x3a')]=0x1;transfers[_0x2d335c[_0x845d('0x40')]]=_['clone'](agents[_0x2d335c['transfertargetuniqueid']]);transfers[_0x2d335c[_0x845d('0x40')]][_0x845d('0x7')]=agents[_0x2d335c[_0x845d('0x35')]]['calleridnum'];transfers[_0x2d335c[_0x845d('0x40')]][_0x845d('0x3d')]=agents[_0x2d335c[_0x845d('0x35')]][_0x845d('0x3d')];transfers[_0x2d335c[_0x845d('0x40')]]['agentcalledAt']=utils[_0x845d('0x15')]();transfers[_0x2d335c['transfertargetuniqueid']][_0x845d('0x2c')]=utils[_0x845d('0x15')]();transfers[_0x2d335c[_0x845d('0x40')]][_0x845d('0x1c')]=0x0;transfers[_0x2d335c[_0x845d('0x40')]][_0x845d('0x3a')]=0x2;}}}catch(_0x30d52e){utils['error'](_0x30d52e[_0x845d('0x18')]);}};exports[_0x845d('0x41')]=function(_0x5ae159){try{if(transfers[_0x5ae159['uniqueid']]){transfers[_0x5ae159[_0x845d('0x11')]]['agentcomplete']=!![];transfers[_0x5ae159[_0x845d('0x11')]]['agentcompleteAt']=utils['now']();transfers[_0x5ae159[_0x845d('0x11')]][_0x845d('0x23')]=utils[_0x845d('0x42')](transfers[_0x5ae159[_0x845d('0x11')]][_0x845d('0x2b')],transfers[_0x5ae159[_0x845d('0x11')]][_0x845d('0x2c')]);transfers[_0x5ae159[_0x845d('0x11')]][_0x845d('0x21')]=_0x845d('0x43');transfers[_0x5ae159[_0x845d('0x11')]][_0x845d('0x8')]=_0x845d('0x2d');writeDB(transfers[_0x5ae159['uniqueid']],!![]);}if(agents[_0x5ae159[_0x845d('0x11')]]&&agents[_0x5ae159[_0x845d('0x11')]][_0x845d('0x2c')]){agents[_0x5ae159[_0x845d('0x11')]]['agentcomplete']=!![];agents[_0x5ae159[_0x845d('0x11')]]['agentcompleteAt']=utils['now']();agents[_0x5ae159[_0x845d('0x11')]][_0x845d('0x23')]=utils[_0x845d('0x42')](agents[_0x5ae159[_0x845d('0x11')]][_0x845d('0x2b')],agents[_0x5ae159[_0x845d('0x11')]][_0x845d('0x2c')]);agents[_0x5ae159[_0x845d('0x11')]][_0x845d('0x21')]=agents[_0x5ae159[_0x845d('0x11')]][_0x845d('0x2f')]?_0x845d('0x2f'):_0x845d('0x43');agents[_0x5ae159[_0x845d('0x11')]]['lastevent']='complete';writeDB(agents[_0x5ae159[_0x845d('0x11')]]);}}catch(_0x427f60){utils[_0x845d('0x17')](_0x427f60[_0x845d('0x18')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 4596cf1..d5b6885 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 _0x6f85=['lastIndexOf','includes','execif','application','lastdata','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','type','accountcode','source','destination','callerid','disposition','getUserByInternal','then','UserId','request','CreateVoiceCallReport','linkedid','OutgoingSpoolFailed','calleridnum','exten','context','now','error','newstate','isNil','channelstate','systemanswertime','destinationchannel','answertime','toNumber','stack','hangup','calleridname','endtime','duration','diffTime','starttime','attendedtransfer','localtwolinkedid','transfereechannel','secondtransfererchannel','transfertargetchannel','_attended','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','value','variable','xmd-phone','\x22\x20<','xmd-callerid-preview','xmcs-queue','lastapplication','Queue','xmd-contactid','xmd-cdrtype','routeid','newexten','set','startsWith','appdata','toLowerCase','split'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x6f85,0xe9));var _0x56f8=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0x6f85[_0x30d87a];return _0x48f64b;};'use strict';var _=require(_0x56f8('0x0'));var util=require(_0x56f8('0x1'));var utils=require(_0x56f8('0x2'));var dispositions=[_0x56f8('0x3'),'FAILED',_0x56f8('0x4'),'NO\x20ANSWER',_0x56f8('0x3'),_0x56f8('0x3'),_0x56f8('0x5'),_0x56f8('0x6'),'FAILED',_0x56f8('0x4'),_0x56f8('0x4')];var channels={};function writeDB(_0x49bbab){utils[_0x56f8('0x7')](util[_0x56f8('0x8')](_0x56f8('0x9'),_0x49bbab[_0x56f8('0xa')],_0x49bbab[_0x56f8('0xb')],_0x49bbab[_0x56f8('0xc')],_0x49bbab[_0x56f8('0xd')],_0x49bbab[_0x56f8('0xe')],_0x49bbab[_0x56f8('0xf')],_0x49bbab[_0x56f8('0x10')],_0x49bbab[_0x56f8('0x11')]));if(_0x49bbab[_0x56f8('0xd')]){utils[_0x56f8('0x12')](_0x49bbab['accountcode'])[_0x56f8('0x13')](function(_0x56f524){if(_0x56f524){_0x49bbab[_0x56f8('0x14')]=_0x56f524['id'];}utils[_0x56f8('0x15')](_0x56f8('0x16'),_0x49bbab);});}else{utils[_0x56f8('0x15')](_0x56f8('0x16'),_0x49bbab);}if(channels[_0x49bbab[_0x56f8('0xa')]]){delete channels[_0x49bbab[_0x56f8('0xa')]];}}exports['newchannel']=function(_0xd38a60){try{if(_0xd38a60[_0x56f8('0xa')]==_0xd38a60[_0x56f8('0x17')]&&_0xd38a60[_0x56f8('0xb')]!=_0x56f8('0x18')){channels[_0xd38a60[_0x56f8('0xa')]]={'uniqueid':_0xd38a60[_0x56f8('0xa')],'accountcode':_0xd38a60[_0x56f8('0xd')],'source':_0xd38a60[_0x56f8('0x19')],'destination':_0xd38a60[_0x56f8('0x1a')],'destinationcontext':_0xd38a60[_0x56f8('0x1b')],'channel':_0xd38a60[_0x56f8('0xb')],'starttime':utils[_0x56f8('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0xa9dc2){utils[_0x56f8('0x1d')](_0xa9dc2['stack']);}};exports[_0x56f8('0x1e')]=function(_0x39690f){try{if(!_[_0x56f8('0x1f')](channels[_0x39690f[_0x56f8('0xa')]])&&_0x39690f[_0x56f8('0x20')]==0x6){if(_[_0x56f8('0x1f')](channels[_0x39690f['uniqueid']][_0x56f8('0x21')])){channels[_0x39690f['uniqueid']]['systemanswertime']=utils['now']();}}else if(!_[_0x56f8('0x1f')](channels[_0x39690f[_0x56f8('0x17')]])&&_0x39690f[_0x56f8('0x20')]==0x6&&_0x39690f[_0x56f8('0x1b')]!='transfer'){channels[_0x39690f[_0x56f8('0x17')]][_0x56f8('0xd')]=_0x39690f[_0x56f8('0xd')];channels[_0x39690f[_0x56f8('0x17')]][_0x56f8('0x22')]=_0x39690f[_0x56f8('0xb')];if(_[_0x56f8('0x1f')](channels[_0x39690f['linkedid']][_0x56f8('0x23')])){channels[_0x39690f[_0x56f8('0x17')]][_0x56f8('0x23')]=utils[_0x56f8('0x1c')]();}channels[_0x39690f[_0x56f8('0x17')]][_0x56f8('0x11')]=dispositions[_[_0x56f8('0x24')](_0x39690f['channelstate'])]||_0x56f8('0x5');}}catch(_0x4b73c0){utils[_0x56f8('0x1d')](_0x4b73c0[_0x56f8('0x25')]);}};exports[_0x56f8('0x26')]=function(_0x1c51b3){try{if(!_[_0x56f8('0x1f')](channels[_0x1c51b3['uniqueid']])){if(_['isNil'](channels[_0x1c51b3[_0x56f8('0xa')]][_0x56f8('0x10')])){channels[_0x1c51b3['uniqueid']]['callerid']=_0x1c51b3[_0x56f8('0x27')]+'\x20<'+_0x1c51b3[_0x56f8('0x19')]+'>';}channels[_0x1c51b3['uniqueid']][_0x56f8('0x28')]=utils[_0x56f8('0x1c')]();channels[_0x1c51b3[_0x56f8('0xa')]][_0x56f8('0x29')]=utils[_0x56f8('0x2a')](channels[_0x1c51b3[_0x56f8('0xa')]][_0x56f8('0x28')],channels[_0x1c51b3[_0x56f8('0xa')]][_0x56f8('0x2b')]);channels[_0x1c51b3[_0x56f8('0xa')]]['billableseconds']=channels[_0x1c51b3[_0x56f8('0xa')]][_0x56f8('0x23')]?utils[_0x56f8('0x2a')](channels[_0x1c51b3['uniqueid']][_0x56f8('0x28')],channels[_0x1c51b3[_0x56f8('0xa')]][_0x56f8('0x23')]):0x0;writeDB(channels[_0x1c51b3['uniqueid']]);}}catch(_0x2d5b3c){utils['error'](_0x2d5b3c['stack']);}};exports[_0x56f8('0x2c')]=function(_0x40a973){try{if(!_['isNil'](channels[_0x40a973[_0x56f8('0x2d')]])){if(channels[_0x40a973[_0x56f8('0x2d')]]['channel']==_0x40a973[_0x56f8('0x2e')]){channels[_0x40a973['localtwolinkedid']]['destinationchannel']=_0x40a973[_0x56f8('0x2f')];channels[_0x40a973['localtwolinkedid']]['userfield']='_attended';}else if(channels[_0x40a973['localtwolinkedid']][_0x56f8('0xb')]=_0x40a973[_0x56f8('0x30')]){channels[_0x40a973['localtwolinkedid']][_0x56f8('0x22')]=_0x40a973['origtransfererchannel'];channels[_0x40a973['localtwolinkedid']]['userfield']=_0x56f8('0x31');}}}catch(_0x24390f){utils['error'](_0x24390f['stack']);}};exports[_0x56f8('0x32')]=function(_0x566f2c){try{if(!_[_0x56f8('0x1f')](channels[_0x566f2c[_0x56f8('0xa')]])){channels[_0x566f2c[_0x56f8('0xa')]][_0x56f8('0x33')]=utils[_0x56f8('0x1c')]();}}catch(_0x521db2){utils[_0x56f8('0x1d')](_0x521db2[_0x56f8('0x25')]);}};exports[_0x56f8('0x34')]=function(_0x3504b5){try{if(!_[_0x56f8('0x1f')](channels[_0x3504b5[_0x56f8('0xa')]])){if(!_[_0x56f8('0x1f')](channels[_0x3504b5['uniqueid']][_0x56f8('0x33')])){channels[_0x3504b5['uniqueid']][_0x56f8('0x35')]+=utils['diffTime'](utils[_0x56f8('0x1c')](),channels[_0x3504b5[_0x56f8('0xa')]][_0x56f8('0x33')]);delete channels[_0x3504b5[_0x56f8('0xa')]][_0x56f8('0x33')];}}}catch(_0x12f521){utils['error'](_0x12f521[_0x56f8('0x25')]);}};exports['varset']=function(_0x50b438){try{if(!_[_0x56f8('0x1f')](channels[_0x50b438['uniqueid']])){if(!_['isNil'](_0x50b438['variable']['xmd-originatecalleridnum'])){channels[_0x50b438[_0x56f8('0xa')]][_0x56f8('0xe')]=_0x50b438[_0x56f8('0x36')];}if(!_['isNil'](_0x50b438[_0x56f8('0x37')][_0x56f8('0x38')])){channels[_0x50b438[_0x56f8('0xa')]][_0x56f8('0xf')]=_0x50b438[_0x56f8('0x36')];channels[_0x50b438[_0x56f8('0xa')]]['callerid']='\x22'+_0x50b438[_0x56f8('0x36')]+_0x56f8('0x39')+_0x50b438[_0x56f8('0x36')]+'>';}if(!_[_0x56f8('0x1f')](_0x50b438[_0x56f8('0x37')][_0x56f8('0x3a')])||!_[_0x56f8('0x1f')](_0x50b438['variable']['xmd-callerid'])){channels[_0x50b438[_0x56f8('0xa')]][_0x56f8('0x10')]=_0x50b438[_0x56f8('0x36')];}if(!_['isNil'](_0x50b438[_0x56f8('0x37')]['xmd-queue'])||!_[_0x56f8('0x1f')](_0x50b438[_0x56f8('0x37')][_0x56f8('0x3b')])){channels[_0x50b438['uniqueid']][_0x56f8('0x3c')]=_0x56f8('0x3d');channels[_0x50b438[_0x56f8('0xa')]]['lastdata']=_0x50b438[_0x56f8('0x36')];channels[_0x50b438['uniqueid']]['queue']=!![];}if(!_[_0x56f8('0x1f')](_0x50b438[_0x56f8('0x37')][_0x56f8('0x3e')])){channels[_0x50b438[_0x56f8('0xa')]]['ContactId']=_0x50b438[_0x56f8('0x36')];}if(!_[_0x56f8('0x1f')](_0x50b438[_0x56f8('0x37')][_0x56f8('0x3f')])){channels[_0x50b438['uniqueid']]['type']=_0x50b438[_0x56f8('0x36')];}if(!_[_0x56f8('0x1f')](_0x50b438['variable']['outboundrouteid'])){channels[_0x50b438[_0x56f8('0xa')]][_0x56f8('0x40')]=_0x50b438[_0x56f8('0x36')];}if(!_[_0x56f8('0x1f')](_0x50b438[_0x56f8('0x37')]['sipcallid'])){channels[_0x50b438[_0x56f8('0xa')]]['sipcallid']=_0x50b438[_0x56f8('0x36')];}}}catch(_0x5c8d94){utils[_0x56f8('0x1d')](_0x5c8d94[_0x56f8('0x25')]);}};exports[_0x56f8('0x41')]=function(_0x297b7f){try{if(!_[_0x56f8('0x1f')](channels[_0x297b7f['uniqueid']])){if(_0x297b7f['application']['toLowerCase']()==_0x56f8('0x42')&&_[_0x56f8('0x43')](_0x297b7f[_0x56f8('0x44')][_0x56f8('0x45')](),'cdr')){var _0x36df96=_0x297b7f[_0x56f8('0x44')][_0x56f8('0x46')]('=');var _0x59983b=_0x36df96[0x0]['substring'](_0x36df96[0x0]['lastIndexOf']('(')+0x1,_0x36df96[0x0][_0x56f8('0x47')](')'));var _0x319648=_0x36df96[0x1];channels[_0x297b7f[_0x56f8('0xa')]][_0x59983b]=_0x319648;}if(!_[_0x56f8('0x48')]([_0x56f8('0x26'),'noop',_0x56f8('0x49'),'set','gotoif'],_0x297b7f[_0x56f8('0x4a')]['toLowerCase']())){channels[_0x297b7f['uniqueid']][_0x56f8('0x3c')]=_0x297b7f[_0x56f8('0x4a')];channels[_0x297b7f[_0x56f8('0xa')]][_0x56f8('0x4b')]=_0x297b7f[_0x56f8('0x44')];}}}catch(_0x2bb480){utils[_0x56f8('0x1d')](_0x2bb480['stack']);}}; \ No newline at end of file +var _0xbe49=['info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','accountcode','source','destination','callerid','getUserByInternal','then','request','newchannel','linkedid','OutgoingSpoolFailed','context','now','DOCUMENTATION','error','newstate','isNil','channelstate','systemanswertime','transfer','destinationchannel','answertime','toNumber','calleridname','calleridnum','duration','diffTime','endtime','starttime','billableseconds','stack','attendedtransfer','localtwolinkedid','transfereechannel','userfield','_attended','transfertargetchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','varset','variable','xmd-originatecalleridnum','value','xmd-phone','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','lastdata','queue','xmd-contactid','xmd-cdrtype','type','outboundrouteid','sipcallid','newexten','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','includes','hangup','noop','execif','application','lodash','util','FAILED','NO\x20ANSWER','ANSWERED','BUSY'];(function(_0x54c14d,_0x15affb){var _0x24dc77=function(_0x5001d8){while(--_0x5001d8){_0x54c14d['push'](_0x54c14d['shift']());}};_0x24dc77(++_0x15affb);}(_0xbe49,0x194));var _0x9be4=function(_0x59307e,_0x5c688a){_0x59307e=_0x59307e-0x0;var _0x570179=_0xbe49[_0x59307e];return _0x570179;};'use strict';var _=require(_0x9be4('0x0'));var util=require(_0x9be4('0x1'));var utils=require('./utils');var dispositions=['NO\x20ANSWER',_0x9be4('0x2'),_0x9be4('0x2'),_0x9be4('0x3'),_0x9be4('0x3'),'NO\x20ANSWER',_0x9be4('0x4'),_0x9be4('0x5'),_0x9be4('0x2'),_0x9be4('0x2'),_0x9be4('0x2')];var channels={};function writeDB(_0xee7ca0){utils[_0x9be4('0x6')](util[_0x9be4('0x7')](_0x9be4('0x8'),_0xee7ca0[_0x9be4('0x9')],_0xee7ca0[_0x9be4('0xa')],_0xee7ca0['type'],_0xee7ca0[_0x9be4('0xb')],_0xee7ca0[_0x9be4('0xc')],_0xee7ca0[_0x9be4('0xd')],_0xee7ca0[_0x9be4('0xe')],_0xee7ca0['disposition']));if(_0xee7ca0[_0x9be4('0xb')]){utils[_0x9be4('0xf')](_0xee7ca0['accountcode'])[_0x9be4('0x10')](function(_0x14b64c){if(_0x14b64c){_0xee7ca0['UserId']=_0x14b64c['id'];}utils[_0x9be4('0x11')]('CreateVoiceCallReport',_0xee7ca0);});}else{utils[_0x9be4('0x11')]('CreateVoiceCallReport',_0xee7ca0);}if(channels[_0xee7ca0['uniqueid']]){delete channels[_0xee7ca0[_0x9be4('0x9')]];}}exports[_0x9be4('0x12')]=function(_0x5816a0){try{if(_0x5816a0['uniqueid']==_0x5816a0[_0x9be4('0x13')]&&_0x5816a0[_0x9be4('0xa')]!=_0x9be4('0x14')){channels[_0x5816a0['uniqueid']]={'uniqueid':_0x5816a0['uniqueid'],'accountcode':_0x5816a0[_0x9be4('0xb')],'source':_0x5816a0['calleridnum'],'destination':_0x5816a0['exten'],'destinationcontext':_0x5816a0[_0x9be4('0x15')],'channel':_0x5816a0[_0x9be4('0xa')],'starttime':utils[_0x9be4('0x16')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x9be4('0x3'),'amaflags':_0x9be4('0x17')};}}catch(_0xcfe784){utils[_0x9be4('0x18')](_0xcfe784['stack']);}};exports[_0x9be4('0x19')]=function(_0x5a004){try{if(!_[_0x9be4('0x1a')](channels[_0x5a004[_0x9be4('0x9')]])&&_0x5a004[_0x9be4('0x1b')]==0x6){if(_[_0x9be4('0x1a')](channels[_0x5a004[_0x9be4('0x9')]][_0x9be4('0x1c')])){channels[_0x5a004[_0x9be4('0x9')]]['systemanswertime']=utils[_0x9be4('0x16')]();}}else if(!_['isNil'](channels[_0x5a004[_0x9be4('0x13')]])&&_0x5a004[_0x9be4('0x1b')]==0x6&&_0x5a004[_0x9be4('0x15')]!=_0x9be4('0x1d')){channels[_0x5a004[_0x9be4('0x13')]]['accountcode']=_0x5a004[_0x9be4('0xb')];channels[_0x5a004[_0x9be4('0x13')]][_0x9be4('0x1e')]=_0x5a004['channel'];if(_[_0x9be4('0x1a')](channels[_0x5a004[_0x9be4('0x13')]][_0x9be4('0x1f')])){channels[_0x5a004['linkedid']][_0x9be4('0x1f')]=utils['now']();}channels[_0x5a004[_0x9be4('0x13')]]['disposition']=dispositions[_[_0x9be4('0x20')](_0x5a004['channelstate'])]||'ANSWERED';}}catch(_0x4f8952){utils['error'](_0x4f8952['stack']);}};exports['hangup']=function(_0xfc7932){try{if(!_[_0x9be4('0x1a')](channels[_0xfc7932[_0x9be4('0x9')]])){if(_[_0x9be4('0x1a')](channels[_0xfc7932['uniqueid']]['callerid'])){channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0xe')]=_0xfc7932[_0x9be4('0x21')]+'\x20<'+_0xfc7932[_0x9be4('0x22')]+'>';}channels[_0xfc7932[_0x9be4('0x9')]]['endtime']=utils[_0x9be4('0x16')]();channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0x23')]=utils[_0x9be4('0x24')](channels[_0xfc7932['uniqueid']][_0x9be4('0x25')],channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0x26')]);channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0x27')]=channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0x1f')]?utils[_0x9be4('0x24')](channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0x25')],channels[_0xfc7932[_0x9be4('0x9')]][_0x9be4('0x1f')]):0x0;writeDB(channels[_0xfc7932['uniqueid']]);}}catch(_0x30c783){utils[_0x9be4('0x18')](_0x30c783[_0x9be4('0x28')]);}};exports[_0x9be4('0x29')]=function(_0x4574af){try{if(!_['isNil'](channels[_0x4574af[_0x9be4('0x2a')]])){if(channels[_0x4574af['localtwolinkedid']][_0x9be4('0xa')]==_0x4574af[_0x9be4('0x2b')]){channels[_0x4574af[_0x9be4('0x2a')]]['destinationchannel']=_0x4574af['secondtransfererchannel'];channels[_0x4574af[_0x9be4('0x2a')]][_0x9be4('0x2c')]=_0x9be4('0x2d');}else if(channels[_0x4574af[_0x9be4('0x2a')]][_0x9be4('0xa')]=_0x4574af[_0x9be4('0x2e')]){channels[_0x4574af[_0x9be4('0x2a')]][_0x9be4('0x1e')]=_0x4574af['origtransfererchannel'];channels[_0x4574af[_0x9be4('0x2a')]][_0x9be4('0x2c')]='_attended';}}}catch(_0xd6b0aa){utils[_0x9be4('0x18')](_0xd6b0aa[_0x9be4('0x28')]);}};exports[_0x9be4('0x2f')]=function(_0x5d09a9){try{if(!_[_0x9be4('0x1a')](channels[_0x5d09a9[_0x9be4('0x9')]])){channels[_0x5d09a9[_0x9be4('0x9')]][_0x9be4('0x30')]=utils['now']();}}catch(_0x4a4a7f){utils[_0x9be4('0x18')](_0x4a4a7f[_0x9be4('0x28')]);}};exports[_0x9be4('0x31')]=function(_0x33411e){try{if(!_[_0x9be4('0x1a')](channels[_0x33411e[_0x9be4('0x9')]])){if(!_[_0x9be4('0x1a')](channels[_0x33411e[_0x9be4('0x9')]][_0x9be4('0x30')])){channels[_0x33411e['uniqueid']]['mohtime']+=utils['diffTime'](utils[_0x9be4('0x16')](),channels[_0x33411e[_0x9be4('0x9')]][_0x9be4('0x30')]);delete channels[_0x33411e[_0x9be4('0x9')]][_0x9be4('0x30')];}}}catch(_0x53807a){utils[_0x9be4('0x18')](_0x53807a[_0x9be4('0x28')]);}};exports[_0x9be4('0x32')]=function(_0x22da1f){try{if(!_[_0x9be4('0x1a')](channels[_0x22da1f[_0x9be4('0x9')]])){if(!_['isNil'](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x34')])){channels[_0x22da1f[_0x9be4('0x9')]][_0x9be4('0xc')]=_0x22da1f[_0x9be4('0x35')];}if(!_[_0x9be4('0x1a')](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x36')])){channels[_0x22da1f['uniqueid']][_0x9be4('0xd')]=_0x22da1f[_0x9be4('0x35')];channels[_0x22da1f[_0x9be4('0x9')]][_0x9be4('0xe')]='\x22'+_0x22da1f[_0x9be4('0x35')]+_0x9be4('0x37')+_0x22da1f[_0x9be4('0x35')]+'>';}if(!_['isNil'](_0x22da1f['variable'][_0x9be4('0x38')])||!_['isNil'](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x39')])){channels[_0x22da1f['uniqueid']][_0x9be4('0xe')]=_0x22da1f[_0x9be4('0x35')];}if(!_[_0x9be4('0x1a')](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x3a')])||!_['isNil'](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x3b')])){channels[_0x22da1f['uniqueid']][_0x9be4('0x3c')]='Queue';channels[_0x22da1f[_0x9be4('0x9')]][_0x9be4('0x3d')]=_0x22da1f[_0x9be4('0x35')];channels[_0x22da1f[_0x9be4('0x9')]][_0x9be4('0x3e')]=!![];}if(!_[_0x9be4('0x1a')](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x3f')])){channels[_0x22da1f['uniqueid']]['ContactId']=_0x22da1f[_0x9be4('0x35')];}if(!_[_0x9be4('0x1a')](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x40')])){channels[_0x22da1f[_0x9be4('0x9')]][_0x9be4('0x41')]=_0x22da1f[_0x9be4('0x35')];}if(!_[_0x9be4('0x1a')](_0x22da1f[_0x9be4('0x33')][_0x9be4('0x42')])){channels[_0x22da1f[_0x9be4('0x9')]]['routeid']=_0x22da1f[_0x9be4('0x35')];}if(!_[_0x9be4('0x1a')](_0x22da1f[_0x9be4('0x33')]['sipcallid'])){channels[_0x22da1f[_0x9be4('0x9')]][_0x9be4('0x43')]=_0x22da1f[_0x9be4('0x35')];}}}catch(_0x2013f7){utils[_0x9be4('0x18')](_0x2013f7[_0x9be4('0x28')]);}};exports[_0x9be4('0x44')]=function(_0x531db5){try{if(!_['isNil'](channels[_0x531db5[_0x9be4('0x9')]])){if(_0x531db5['application'][_0x9be4('0x45')]()==_0x9be4('0x46')&&_[_0x9be4('0x47')](_0x531db5[_0x9be4('0x48')][_0x9be4('0x45')](),_0x9be4('0x49'))){var _0x4bfc8e=_0x531db5[_0x9be4('0x48')][_0x9be4('0x4a')]('=');var _0x867da8=_0x4bfc8e[0x0][_0x9be4('0x4b')](_0x4bfc8e[0x0][_0x9be4('0x4c')]('(')+0x1,_0x4bfc8e[0x0]['lastIndexOf'](')'));var _0x4b57ad=_0x4bfc8e[0x1];channels[_0x531db5[_0x9be4('0x9')]][_0x867da8]=_0x4b57ad;}if(!_[_0x9be4('0x4d')]([_0x9be4('0x4e'),_0x9be4('0x4f'),_0x9be4('0x50'),'set','gotoif'],_0x531db5[_0x9be4('0x51')][_0x9be4('0x45')]())){channels[_0x531db5[_0x9be4('0x9')]][_0x9be4('0x3c')]=_0x531db5[_0x9be4('0x51')];channels[_0x531db5[_0x9be4('0x9')]][_0x9be4('0x3d')]=_0x531db5[_0x9be4('0x48')];}}}catch(_0x1885ad){utils[_0x9be4('0x18')](_0x1885ad['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index ed4f3ad..13be5db 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 _0x1cb9=['FULLYBOOTED','error','close','managerevent','./utils','connect','info','CONNECTED','shutdown','SHUTDOWN','fullybooted'];(function(_0x22e47a,_0x4ea10c){var _0x15a12a=function(_0x4a097f){while(--_0x4a097f){_0x22e47a['push'](_0x22e47a['shift']());}};_0x15a12a(++_0x4ea10c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x57f52f,_0x3745ef){_0x57f52f=_0x57f52f-0x0;var _0x3a7f05=_0x1cb9[_0x57f52f];return _0x3a7f05;};'use strict';var utils=require(_0x91cb('0x0'));var _=require('lodash');exports[_0x91cb('0x1')]=function(){utils[_0x91cb('0x2')](_0x91cb('0x3'));};exports[_0x91cb('0x4')]=function(){utils['info'](_0x91cb('0x5'));};exports[_0x91cb('0x6')]=function(){utils['info'](_0x91cb('0x7'));};exports[_0x91cb('0x8')]=function(_0x186dc3){utils[_0x91cb('0x8')](_0x186dc3);};exports[_0x91cb('0x9')]=function(){utils[_0x91cb('0x2')]('CLOSE');};exports[_0x91cb('0xa')]=function(_0x5bda2f){}; \ No newline at end of file +var _0x3baf=['SHUTDOWN','fullybooted','FULLYBOOTED','error','close','./utils','lodash','connect','info','CONNECTED','shutdown'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x3baf,0xf7));var _0xf3ba=function(_0x5f25f7,_0x5ae75f){_0x5f25f7=_0x5f25f7-0x0;var _0x30b621=_0x3baf[_0x5f25f7];return _0x30b621;};'use strict';var utils=require(_0xf3ba('0x0'));var _=require(_0xf3ba('0x1'));exports[_0xf3ba('0x2')]=function(){utils[_0xf3ba('0x3')](_0xf3ba('0x4'));};exports[_0xf3ba('0x5')]=function(){utils[_0xf3ba('0x3')](_0xf3ba('0x6'));};exports[_0xf3ba('0x7')]=function(){utils[_0xf3ba('0x3')](_0xf3ba('0x8'));};exports[_0xf3ba('0x9')]=function(_0x475268){utils[_0xf3ba('0x9')](_0x475268);};exports[_0xf3ba('0xa')]=function(){utils['info']('CLOSE');};exports['managerevent']=function(_0x32f810){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index fba299d..91602c6 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 _0x3715=['connectedlinenum','request','CreateVoiceDialReport','newexten','application','set','toLowerCase','cdr(routeid)','split','stack','varset','isNil','outboundrouteid','value','dialbegin','assign','starttime','now','lastevent','called','dialend','dialstatus','ANSWER','connect','error','hangup','duration','diffTime','endtime','answertime','billableseconds','lodash','util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum'];(function(_0xe906a5,_0x3bfd31){var _0x4fb701=function(_0x18c9f1){while(--_0x18c9f1){_0xe906a5['push'](_0xe906a5['shift']());}};_0x4fb701(++_0x3bfd31);}(_0x3715,0xc3));var _0x5371=function(_0x49a2ce,_0x1f8fc6){_0x49a2ce=_0x49a2ce-0x0;var _0x3f420b=_0x3715[_0x49a2ce];return _0x3f420b;};'use strict';var _=require(_0x5371('0x0'));var util=require(_0x5371('0x1'));var utils=require(_0x5371('0x2'));var dials={};function writeDB(_0x17bbf9){utils[_0x5371('0x3')](util[_0x5371('0x4')](_0x5371('0x5'),_0x17bbf9[_0x5371('0x6')],_0x17bbf9[_0x5371('0x7')],_0x17bbf9[_0x5371('0x8')],_0x17bbf9[_0x5371('0x9')],_0x17bbf9[_0x5371('0xa')],_0x17bbf9['dialstatus']));utils[_0x5371('0xb')](_0x5371('0xc'),_0x17bbf9);delete dials[_0x17bbf9['uniqueid']];}exports[_0x5371('0xd')]=function(_0x16c64a){try{if(_0x16c64a[_0x5371('0xe')]['toLowerCase']()==_0x5371('0xf')&&_['startsWith'](_0x16c64a['appdata'][_0x5371('0x10')](),_0x5371('0x11'))){var _0x6b17f8=_0x16c64a['appdata'][_0x5371('0x12')]('=');dials[_0x16c64a[_0x5371('0x6')]]={'routeId':_0x6b17f8[0x1]};}}catch(_0x203905){utils['error'](_0x203905[_0x5371('0x13')]);}};exports[_0x5371('0x14')]=function(_0x1faac2){try{if(!_[_0x5371('0x15')](_0x1faac2['variable'][_0x5371('0x16')])){dials[_0x1faac2['uniqueid']]={'routeId':_0x1faac2[_0x5371('0x17')]};}}catch(_0x777eaf){utils['error'](_0x777eaf[_0x5371('0x13')]);}};exports[_0x5371('0x18')]=function(_0x321a6c){try{if(!_[_0x5371('0x15')](dials[_0x321a6c[_0x5371('0x6')]])){dials[_0x321a6c[_0x5371('0x6')]]=_[_0x5371('0x19')](dials[_0x321a6c['uniqueid']],_0x321a6c);dials[_0x321a6c[_0x5371('0x6')]][_0x5371('0x1a')]=utils[_0x5371('0x1b')]();dials[_0x321a6c[_0x5371('0x6')]][_0x5371('0x1c')]=_0x5371('0x1d');}}catch(_0x21af6c){utils['error'](_0x21af6c['stack']);}};exports[_0x5371('0x1e')]=function(_0x50d68f){try{if(!_[_0x5371('0x15')](dials[_0x50d68f['uniqueid']])){dials[_0x50d68f[_0x5371('0x6')]][_0x5371('0x1f')]=_0x50d68f['dialstatus'];if(_0x50d68f[_0x5371('0x1f')]==_0x5371('0x20')){dials[_0x50d68f['uniqueid']]=_[_0x5371('0x19')](dials[_0x50d68f[_0x5371('0x6')]],_0x50d68f);dials[_0x50d68f[_0x5371('0x6')]]['answertime']=utils['now']();dials[_0x50d68f['uniqueid']][_0x5371('0x1c')]=_0x5371('0x21');}}}catch(_0x2a897e){utils[_0x5371('0x22')](_0x2a897e[_0x5371('0x13')]);}};exports[_0x5371('0x23')]=function(_0x5d0298){try{if(!_[_0x5371('0x15')](dials[_0x5d0298['uniqueid']])){dials[_0x5d0298[_0x5371('0x6')]]=_['assign'](dials[_0x5d0298[_0x5371('0x6')]],{'endtime':utils[_0x5371('0x1b')](),'lastevent':'complete'});dials[_0x5d0298[_0x5371('0x6')]][_0x5371('0x24')]=utils[_0x5371('0x25')](dials[_0x5d0298[_0x5371('0x6')]][_0x5371('0x26')],dials[_0x5d0298['uniqueid']]['starttime']);dials[_0x5d0298[_0x5371('0x6')]]['holdtime']=utils['diffTime'](dials[_0x5d0298[_0x5371('0x6')]][_0x5371('0x27')]||dials[_0x5d0298['uniqueid']][_0x5371('0x26')],dials[_0x5d0298[_0x5371('0x6')]][_0x5371('0x1a')]);dials[_0x5d0298[_0x5371('0x6')]][_0x5371('0x28')]=dials[_0x5d0298[_0x5371('0x6')]][_0x5371('0x27')]?utils[_0x5371('0x25')](dials[_0x5d0298[_0x5371('0x6')]][_0x5371('0x26')],dials[_0x5d0298['uniqueid']][_0x5371('0x27')]):0x0;writeDB(dials[_0x5d0298['uniqueid']]);}}catch(_0x2f24b1){utils['error'](_0x2f24b1['stack']);}}; \ No newline at end of file +var _0x30fc=['assign','starttime','now','lastevent','called','error','dialend','isNil','answertime','connect','hangup','complete','duration','diffTime','endtime','billableseconds','lodash','util','info','DIAL|%s|%s|%s|%s|%s|%s','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','application','set','startsWith','appdata','toLowerCase','cdr(routeid)','split','varset','variable','outboundrouteid','stack'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x30fc,0xfa));var _0xc30f=function(_0x26dd05,_0x135f80){_0x26dd05=_0x26dd05-0x0;var _0x5da547=_0x30fc[_0x26dd05];return _0x5da547;};'use strict';var _=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x343657){utils[_0xc30f('0x2')](util['format'](_0xc30f('0x3'),_0x343657['uniqueid'],_0x343657['channel'],_0x343657[_0xc30f('0x4')],_0x343657[_0xc30f('0x5')],_0x343657[_0xc30f('0x6')],_0x343657[_0xc30f('0x7')]));utils[_0xc30f('0x8')](_0xc30f('0x9'),_0x343657);delete dials[_0x343657[_0xc30f('0xa')]];}exports[_0xc30f('0xb')]=function(_0x541b6c){try{if(_0x541b6c[_0xc30f('0xc')]['toLowerCase']()==_0xc30f('0xd')&&_[_0xc30f('0xe')](_0x541b6c[_0xc30f('0xf')][_0xc30f('0x10')](),_0xc30f('0x11'))){var _0xc3d1ad=_0x541b6c[_0xc30f('0xf')][_0xc30f('0x12')]('=');dials[_0x541b6c[_0xc30f('0xa')]]={'routeId':_0xc3d1ad[0x1]};}}catch(_0x5db6de){utils['error'](_0x5db6de['stack']);}};exports[_0xc30f('0x13')]=function(_0x368ddf){try{if(!_['isNil'](_0x368ddf[_0xc30f('0x14')][_0xc30f('0x15')])){dials[_0x368ddf['uniqueid']]={'routeId':_0x368ddf['value']};}}catch(_0x214c1f){utils['error'](_0x214c1f[_0xc30f('0x16')]);}};exports['dialbegin']=function(_0x2d2675){try{if(!_['isNil'](dials[_0x2d2675[_0xc30f('0xa')]])){dials[_0x2d2675[_0xc30f('0xa')]]=_[_0xc30f('0x17')](dials[_0x2d2675[_0xc30f('0xa')]],_0x2d2675);dials[_0x2d2675[_0xc30f('0xa')]][_0xc30f('0x18')]=utils[_0xc30f('0x19')]();dials[_0x2d2675[_0xc30f('0xa')]][_0xc30f('0x1a')]=_0xc30f('0x1b');}}catch(_0x43f13c){utils[_0xc30f('0x1c')](_0x43f13c[_0xc30f('0x16')]);}};exports[_0xc30f('0x1d')]=function(_0x3f9c4f){try{if(!_[_0xc30f('0x1e')](dials[_0x3f9c4f[_0xc30f('0xa')]])){dials[_0x3f9c4f[_0xc30f('0xa')]][_0xc30f('0x7')]=_0x3f9c4f['dialstatus'];if(_0x3f9c4f['dialstatus']=='ANSWER'){dials[_0x3f9c4f[_0xc30f('0xa')]]=_['assign'](dials[_0x3f9c4f[_0xc30f('0xa')]],_0x3f9c4f);dials[_0x3f9c4f[_0xc30f('0xa')]][_0xc30f('0x1f')]=utils['now']();dials[_0x3f9c4f[_0xc30f('0xa')]][_0xc30f('0x1a')]=_0xc30f('0x20');}}}catch(_0xd0830e){utils[_0xc30f('0x1c')](_0xd0830e[_0xc30f('0x16')]);}};exports[_0xc30f('0x21')]=function(_0x36a027){try{if(!_['isNil'](dials[_0x36a027['uniqueid']])){dials[_0x36a027['uniqueid']]=_[_0xc30f('0x17')](dials[_0x36a027[_0xc30f('0xa')]],{'endtime':utils[_0xc30f('0x19')](),'lastevent':_0xc30f('0x22')});dials[_0x36a027['uniqueid']][_0xc30f('0x23')]=utils[_0xc30f('0x24')](dials[_0x36a027[_0xc30f('0xa')]][_0xc30f('0x25')],dials[_0x36a027[_0xc30f('0xa')]]['starttime']);dials[_0x36a027['uniqueid']]['holdtime']=utils[_0xc30f('0x24')](dials[_0x36a027['uniqueid']][_0xc30f('0x1f')]||dials[_0x36a027['uniqueid']][_0xc30f('0x25')],dials[_0x36a027[_0xc30f('0xa')]]['starttime']);dials[_0x36a027[_0xc30f('0xa')]][_0xc30f('0x26')]=dials[_0x36a027[_0xc30f('0xa')]]['answertime']?utils['diffTime'](dials[_0x36a027[_0xc30f('0xa')]][_0xc30f('0x25')],dials[_0x36a027[_0xc30f('0xa')]][_0xc30f('0x1f')]):0x0;writeDB(dials[_0x36a027[_0xc30f('0xa')]]);}}catch(_0x2884ae){utils['error'](_0x2884ae[_0xc30f('0x16')]);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 773d8d6..937488b 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 _0xdf39=['username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','port','asterisk'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf39,0x12f));var _0x9df3=function(_0x4aa6b2,_0x54395a){_0x4aa6b2=_0x4aa6b2-0x0;var _0x50005c=_0xdf39[_0x4aa6b2];return _0x50005c;};var AsteriskManager=require(_0x9df3('0x0'));var config=require(_0x9df3('0x1'));var utils=require(_0x9df3('0x2'));var ami=new AsteriskManager(config['asterisk'][_0x9df3('0x3')],config[_0x9df3('0x4')]['ip'],config[_0x9df3('0x4')][_0x9df3('0x5')],config[_0x9df3('0x4')][_0x9df3('0x6')],!![]);ami[_0x9df3('0x7')]();if(config[_0x9df3('0x8')]&&config[_0x9df3('0x8')][_0x9df3('0x9')]){utils[_0x9df3('0xa')](_0x9df3('0xb'));}else{var agents=require('./agents.controller');var calls=require(_0x9df3('0xc'));var queues=require('./queues.controller');var recordings=require(_0x9df3('0xd'));var members=require(_0x9df3('0xe'));var dials=require(_0x9df3('0xf'));var transfers=require(_0x9df3('0x10'));var core=require(_0x9df3('0x11'));ami['on'](_0x9df3('0x12'),core[_0x9df3('0x12')]);ami['on'](_0x9df3('0x13'),core['shutdown']);ami['on'](_0x9df3('0x14'),core[_0x9df3('0x14')]);ami['on'](_0x9df3('0x15'),core[_0x9df3('0x15')]);ami['on'](_0x9df3('0x16'),core[_0x9df3('0x16')]);ami['on']('managerevent',core[_0x9df3('0x17')]);ami['on'](_0x9df3('0x18'),function(_0x5e7578){try{members['devicestatechange'](_0x5e7578);}catch(_0x13bdf6){utils[_0x9df3('0x15')](_0x13bdf6);}});ami['on']('agentcalled',function(_0x89c480){try{agents[_0x9df3('0x19')](_0x89c480);}catch(_0xd515a0){utils['error'](_0xd515a0);}});ami['on'](_0x9df3('0x1a'),function(_0x1c0841){try{agents[_0x9df3('0x1a')](_0x1c0841);}catch(_0x47d281){utils[_0x9df3('0x15')](_0x47d281);}});ami['on']('agentconnect',function(_0xf4b987){try{agents['agentconnect'](_0xf4b987);queues[_0x9df3('0x1b')](_0xf4b987);}catch(_0x11fe59){utils['error'](_0x11fe59);}});ami['on']('agentcomplete',function(_0x1f6174){try{agents[_0x9df3('0x1c')](_0x1f6174);queues[_0x9df3('0x1c')](_0x1f6174);members[_0x9df3('0x1c')](_0x1f6174);}catch(_0x286c98){utils[_0x9df3('0x15')](_0x286c98);}});ami['on']('queuecallerabandon',function(_0x425308){try{agents[_0x9df3('0x1d')](_0x425308);queues[_0x9df3('0x1d')](_0x425308);}catch(_0x23a29e){utils['error'](_0x23a29e);}});ami['on'](_0x9df3('0x1e'),function(_0x496348){try{queues[_0x9df3('0x1e')](_0x496348);recordings['queuecallerjoin'](_0x496348);}catch(_0x35509b){utils['error'](_0x35509b);}});ami['on'](_0x9df3('0x1f'),function(_0x3dfa6c){try{queues['queuecallerleave'](_0x3dfa6c);}catch(_0x18c54f){utils['error'](_0x18c54f);}});ami['on'](_0x9df3('0x20'),function(_0x1110be){try{queues[_0x9df3('0x20')](_0x1110be);calls['musiconholdstart'](_0x1110be);}catch(_0xe03cbb){utils[_0x9df3('0x15')](_0xe03cbb);}});ami['on'](_0x9df3('0x21'),function(_0x2ea1a2){try{queues[_0x9df3('0x21')](_0x2ea1a2);calls[_0x9df3('0x21')](_0x2ea1a2);}catch(_0x46aeda){utils['error'](_0x46aeda);}});ami['on'](_0x9df3('0x22'),function(_0x46f9ad){try{calls['newstate'](_0x46f9ad);recordings['newstate'](_0x46f9ad);}catch(_0x325875){utils[_0x9df3('0x15')](_0x325875);}});ami['on']('hangup',function(_0x469aeb){try{calls['hangup'](_0x469aeb);recordings[_0x9df3('0x23')](_0x469aeb);dials[_0x9df3('0x23')](_0x469aeb);agents['hangup'](_0x469aeb);queues[_0x9df3('0x23')](_0x469aeb);}catch(_0x318b94){utils[_0x9df3('0x15')](_0x318b94);}});ami['on'](_0x9df3('0x24'),function(_0x1778b3){try{members['cdr'](_0x1778b3);}catch(_0x810c9f){utils[_0x9df3('0x15')](_0x810c9f);}});ami['on']('blindtransfer',function(_0x2a2e66){try{queues[_0x9df3('0x25')](_0x2a2e66);agents['blindtransfer'](_0x2a2e66);transfers[_0x9df3('0x25')](_0x2a2e66);}catch(_0x460b37){utils[_0x9df3('0x15')](_0x460b37);}});ami['on'](_0x9df3('0x26'),function(_0x45200c){try{queues[_0x9df3('0x26')](_0x45200c);transfers['attendedtransfer'](_0x45200c);agents[_0x9df3('0x26')](_0x45200c);calls[_0x9df3('0x26')](_0x45200c);}catch(_0x26a978){utils[_0x9df3('0x15')](_0x26a978);}});ami['on'](_0x9df3('0x27'),function(_0x322620){try{queues['varset'](_0x322620);recordings['varset'](_0x322620);calls[_0x9df3('0x27')](_0x322620);dials[_0x9df3('0x27')](_0x322620);}catch(_0x333332){utils[_0x9df3('0x15')](_0x333332);}});ami['on'](_0x9df3('0x28'),function(_0x680b80){try{calls[_0x9df3('0x28')](_0x680b80);recordings[_0x9df3('0x28')](_0x680b80);dials[_0x9df3('0x28')](_0x680b80);}catch(_0x5c6b30){utils[_0x9df3('0x15')](_0x5c6b30);}});ami['on'](_0x9df3('0x29'),function(_0x2c70a8){try{calls[_0x9df3('0x29')](_0x2c70a8);recordings[_0x9df3('0x29')](_0x2c70a8);}catch(_0x4d5375){utils[_0x9df3('0x15')](_0x4d5375);}});ami['on'](_0x9df3('0x2a'),function(_0x332d86){try{dials[_0x9df3('0x2a')](_0x332d86);}catch(_0x4ccbbe){utils['error'](_0x4ccbbe);}});ami['on']('dialend',function(_0x45e8a7){try{dials[_0x9df3('0x2b')](_0x45e8a7);}catch(_0x57d549){utils[_0x9df3('0x15')](_0x57d549);}});} \ No newline at end of file +var _0x6106=['disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstop','newstate','hangup','cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','./utils','asterisk','username','password','keepConnected','xdr'];(function(_0x47e8c9,_0x2e6edc){var _0x31ea20=function(_0x501ba0){while(--_0x501ba0){_0x47e8c9['push'](_0x47e8c9['shift']());}};_0x31ea20(++_0x2e6edc);}(_0x6106,0x11e));var _0x6610=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x6106[_0x5f0089];return _0x193892;};var AsteriskManager=require(_0x6610('0x0'));var config=require(_0x6610('0x1'));var utils=require(_0x6610('0x2'));var ami=new AsteriskManager(config[_0x6610('0x3')]['port'],config[_0x6610('0x3')]['ip'],config[_0x6610('0x3')][_0x6610('0x4')],config[_0x6610('0x3')][_0x6610('0x5')],!![]);ami[_0x6610('0x6')]();if(config[_0x6610('0x7')]&&config['xdr'][_0x6610('0x8')]){utils[_0x6610('0x9')](_0x6610('0xa'));}else{var agents=require(_0x6610('0xb'));var calls=require(_0x6610('0xc'));var queues=require(_0x6610('0xd'));var recordings=require(_0x6610('0xe'));var members=require('./members.controller');var dials=require(_0x6610('0xf'));var transfers=require(_0x6610('0x10'));var core=require(_0x6610('0x11'));ami['on'](_0x6610('0x12'),core[_0x6610('0x12')]);ami['on']('shutdown',core[_0x6610('0x13')]);ami['on']('fullybooted',core[_0x6610('0x14')]);ami['on'](_0x6610('0x15'),core[_0x6610('0x15')]);ami['on']('close',core[_0x6610('0x16')]);ami['on'](_0x6610('0x17'),core[_0x6610('0x17')]);ami['on']('devicestatechange',function(_0x43452c){try{members['devicestatechange'](_0x43452c);}catch(_0x63d399){utils[_0x6610('0x15')](_0x63d399);}});ami['on'](_0x6610('0x18'),function(_0x1c236b){try{agents[_0x6610('0x18')](_0x1c236b);}catch(_0x208f09){utils[_0x6610('0x15')](_0x208f09);}});ami['on'](_0x6610('0x19'),function(_0x576fd7){try{agents[_0x6610('0x19')](_0x576fd7);}catch(_0x305fe9){utils[_0x6610('0x15')](_0x305fe9);}});ami['on'](_0x6610('0x1a'),function(_0x5d45e2){try{agents[_0x6610('0x1a')](_0x5d45e2);queues[_0x6610('0x1a')](_0x5d45e2);}catch(_0x3617af){utils[_0x6610('0x15')](_0x3617af);}});ami['on'](_0x6610('0x1b'),function(_0x30f32a){try{agents[_0x6610('0x1b')](_0x30f32a);queues[_0x6610('0x1b')](_0x30f32a);members[_0x6610('0x1b')](_0x30f32a);}catch(_0x3ad125){utils[_0x6610('0x15')](_0x3ad125);}});ami['on'](_0x6610('0x1c'),function(_0x505ca7){try{agents[_0x6610('0x1c')](_0x505ca7);queues['queuecallerabandon'](_0x505ca7);}catch(_0x2cdc26){utils[_0x6610('0x15')](_0x2cdc26);}});ami['on'](_0x6610('0x1d'),function(_0x1b45ba){try{queues[_0x6610('0x1d')](_0x1b45ba);recordings[_0x6610('0x1d')](_0x1b45ba);}catch(_0x5f1fb1){utils[_0x6610('0x15')](_0x5f1fb1);}});ami['on']('queuecallerleave',function(_0x145647){try{queues[_0x6610('0x1e')](_0x145647);}catch(_0x73751a){utils[_0x6610('0x15')](_0x73751a);}});ami['on']('musiconholdstart',function(_0x3ec367){try{queues['musiconholdstart'](_0x3ec367);calls['musiconholdstart'](_0x3ec367);}catch(_0x5dd2e8){utils[_0x6610('0x15')](_0x5dd2e8);}});ami['on']('musiconholdstop',function(_0x820578){try{queues[_0x6610('0x1f')](_0x820578);calls[_0x6610('0x1f')](_0x820578);}catch(_0x3c2093){utils[_0x6610('0x15')](_0x3c2093);}});ami['on'](_0x6610('0x20'),function(_0x4e1d4e){try{calls[_0x6610('0x20')](_0x4e1d4e);recordings['newstate'](_0x4e1d4e);}catch(_0x5b0c22){utils[_0x6610('0x15')](_0x5b0c22);}});ami['on'](_0x6610('0x21'),function(_0x515e39){try{calls[_0x6610('0x21')](_0x515e39);recordings[_0x6610('0x21')](_0x515e39);dials[_0x6610('0x21')](_0x515e39);agents[_0x6610('0x21')](_0x515e39);queues['hangup'](_0x515e39);}catch(_0x3de3cc){utils[_0x6610('0x15')](_0x3de3cc);}});ami['on'](_0x6610('0x22'),function(_0x33cee9){try{members[_0x6610('0x22')](_0x33cee9);}catch(_0x348d24){utils[_0x6610('0x15')](_0x348d24);}});ami['on']('blindtransfer',function(_0x33e1cb){try{queues['blindtransfer'](_0x33e1cb);agents[_0x6610('0x23')](_0x33e1cb);transfers[_0x6610('0x23')](_0x33e1cb);}catch(_0xd91093){utils[_0x6610('0x15')](_0xd91093);}});ami['on']('attendedtransfer',function(_0x20260a){try{queues[_0x6610('0x24')](_0x20260a);transfers[_0x6610('0x24')](_0x20260a);agents[_0x6610('0x24')](_0x20260a);calls[_0x6610('0x24')](_0x20260a);}catch(_0x5149a8){utils['error'](_0x5149a8);}});ami['on'](_0x6610('0x25'),function(_0x5f5532){try{queues[_0x6610('0x25')](_0x5f5532);recordings['varset'](_0x5f5532);calls[_0x6610('0x25')](_0x5f5532);dials[_0x6610('0x25')](_0x5f5532);}catch(_0x1d6651){utils[_0x6610('0x15')](_0x1d6651);}});ami['on']('newexten',function(_0x452fd7){try{calls['newexten'](_0x452fd7);recordings[_0x6610('0x26')](_0x452fd7);dials[_0x6610('0x26')](_0x452fd7);}catch(_0x1dac99){utils[_0x6610('0x15')](_0x1dac99);}});ami['on'](_0x6610('0x27'),function(_0x5de026){try{calls['newchannel'](_0x5de026);recordings[_0x6610('0x27')](_0x5de026);}catch(_0x47688f){utils[_0x6610('0x15')](_0x47688f);}});ami['on'](_0x6610('0x28'),function(_0x2be399){try{dials[_0x6610('0x28')](_0x2be399);}catch(_0x3a2c2f){utils[_0x6610('0x15')](_0x3a2c2f);}});ami['on'](_0x6610('0x29'),function(_0x504031){try{dials[_0x6610('0x29')](_0x504031);}catch(_0x207da2){utils[_0x6610('0x15')](_0x207da2);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 2c66de0..cf70c60 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 _0x2601=['type','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','membername','name','catch','error','some','devicestatechange','state','INUSE','device','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','exitAt','enterAt','uniqueid','assign','queue','cdr','data1','source','destination','destinationchannel','split','lodash','util','Local/_attended@transfer','Queue:','info','format','interface','channel','data2'];(function(_0x12f32a,_0x23a304){var _0x4423e2=function(_0x4845c6){while(--_0x4845c6){_0x12f32a['push'](_0x12f32a['shift']());}};_0x4423e2(++_0x23a304);}(_0x2601,0xce));var _0x1260=function(_0x530a60,_0x140862){_0x530a60=_0x530a60-0x0;var _0x520727=_0x2601[_0x530a60];return _0x520727;};'use strict';var _=require(_0x1260('0x0'));var util=require(_0x1260('0x1'));var utils=require('./utils');var members={};var exclude=[_0x1260('0x2'),_0x1260('0x3')];function writeDB(_0x3ca29b){utils[_0x1260('0x4')](util[_0x1260('0x5')]('MEMBER|%s|%s|%s|%s|%s|%s',_0x3ca29b['uniqueid'],_0x3ca29b[_0x1260('0x6')],_0x3ca29b[_0x1260('0x7')],_0x3ca29b[_0x1260('0x8')],_0x3ca29b['membername'],_0x3ca29b[_0x1260('0x9')]));if(_0x3ca29b['interface']){utils[_0x1260('0xa')](_0x3ca29b[_0x1260('0x6')])[_0x1260('0xb')](function(_0x36b248){if(_0x36b248){_0x3ca29b['membername']=_0x36b248['name'];_0x3ca29b[_0x1260('0xc')]=_0x36b248[_0x1260('0xc')];utils[_0x1260('0xd')](_0x1260('0xe'),_0x3ca29b);}else{utils[_0x1260('0xf')](_0x3ca29b[_0x1260('0x6')]['split']('/')[0x1])[_0x1260('0xb')](function(_0x5835f3){if(_0x5835f3){_0x3ca29b[_0x1260('0x10')]=_0x5835f3[_0x1260('0x11')];_0x3ca29b[_0x1260('0xc')]=_0x5835f3[_0x1260('0xc')];utils[_0x1260('0xd')](_0x1260('0xe'),_0x3ca29b);}});}})[_0x1260('0x12')](function(_0x57a836){utils[_0x1260('0x13')](_0x57a836);});}delete members[_0x3ca29b[_0x1260('0x6')]];}function startsWith(_0x505ad8,_0x1474f3){return _[_0x1260('0x14')](_0x505ad8,function(_0x542ab0){return _['startsWith'](_0x1474f3,_0x542ab0);});}exports[_0x1260('0x15')]=function(_0x17d9aa){switch(_0x17d9aa[_0x1260('0x16')]){case _0x1260('0x17'):case'BUSY':if(!startsWith(exclude,_0x17d9aa[_0x1260('0x18')])){members[_0x17d9aa[_0x1260('0x18')]]={'channel':_0x1260('0x19'),'interface':_0x17d9aa[_0x1260('0x18')],'type':_0x1260('0x1a'),'enterAt':utils[_0x1260('0x1b')](),'role':_0x1260('0x1c')};}break;case _0x1260('0x1d'):if(!_[_0x1260('0x1e')](members[_0x17d9aa[_0x1260('0x18')]])){members[_0x17d9aa[_0x1260('0x18')]]['exitAt']=utils[_0x1260('0x1b')]();members[_0x17d9aa[_0x1260('0x18')]][_0x1260('0x1f')]=utils['diffTime'](members[_0x17d9aa[_0x1260('0x18')]][_0x1260('0x20')],members[_0x17d9aa['device']][_0x1260('0x21')]);if(members[_0x17d9aa['device']][_0x1260('0x22')]){writeDB(members[_0x17d9aa[_0x1260('0x18')]]);}}default:break;}};exports['agentcomplete']=function(_0x21e87c){if(!_[_0x1260('0x1e')](members[_0x21e87c[_0x1260('0x6')]])){members[_0x21e87c[_0x1260('0x6')]]=_[_0x1260('0x23')](members[_0x21e87c[_0x1260('0x6')]],{'data4':_0x21e87c[_0x1260('0x24')],'uniqueid':_0x21e87c[_0x1260('0x22')]});}};exports[_0x1260('0x25')]=function(_0xdf664d){if(_0xdf664d[_0x1260('0x7')]){var _0x43e198=_0xdf664d['channel']['split']('-')[0x0];if(!_['isNil'](members[_0x43e198])){members[_0x43e198]=_['assign'](members[_0x43e198],{'data1':members[_0x43e198][_0x1260('0x26')]||_0xdf664d[_0x1260('0x9')],'data2':members[_0x43e198][_0x1260('0x8')]||_0xdf664d[_0x1260('0x27')],'data3':members[_0x43e198]['data3']||_0xdf664d[_0x1260('0x28')],'uniqueid':members[_0x43e198][_0x1260('0x22')]||_0xdf664d['uniqueid']});if(members[_0x43e198][_0x1260('0x20')]){writeDB(members[_0x43e198]);}}}if(_0xdf664d[_0x1260('0x29')]){var _0x47a458=_0xdf664d['destinationchannel'][_0x1260('0x2a')]('-')[0x0];if(!_[_0x1260('0x1e')](members[_0x47a458])){members[_0x47a458]=_[_0x1260('0x23')](members[_0x47a458],{'data1':members[_0x47a458][_0x1260('0x26')]||_0xdf664d[_0x1260('0x9')],'data2':members[_0x47a458][_0x1260('0x8')]||_0xdf664d[_0x1260('0x27')],'data3':members[_0x47a458]['data3']||_0xdf664d[_0x1260('0x28')],'uniqueid':members[_0x47a458][_0x1260('0x22')]||_0xdf664d[_0x1260('0x22')]});if(members[_0x47a458][_0x1260('0x20')]){writeDB(members[_0x47a458]);}}}}; \ No newline at end of file +var _0x5001=['type','data3','uniqueid','destinationchannel','source','destination','util','./utils','Queue:','info','MEMBER|%s|%s|%s|%s|%s|%s','interface','channel','data2','membername','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','some','startsWith','devicestatechange','state','INUSE','BUSY','device','voice','TALKING','now','agent','exitAt','duration','diffTime','enterAt','assign','queue','cdr','isNil','data1'];(function(_0x4099af,_0x1578bf){var _0x46e189=function(_0x5a7a18){while(--_0x5a7a18){_0x4099af['push'](_0x4099af['shift']());}};_0x46e189(++_0x1578bf);}(_0x5001,0xdd));var _0x1500=function(_0x2e3e07,_0x5ebda4){_0x2e3e07=_0x2e3e07-0x0;var _0x1d71b4=_0x5001[_0x2e3e07];return _0x1d71b4;};'use strict';var _=require('lodash');var util=require(_0x1500('0x0'));var utils=require(_0x1500('0x1'));var members={};var exclude=['Local/_attended@transfer',_0x1500('0x2')];function writeDB(_0x3be279){utils[_0x1500('0x3')](util['format'](_0x1500('0x4'),_0x3be279['uniqueid'],_0x3be279[_0x1500('0x5')],_0x3be279[_0x1500('0x6')],_0x3be279[_0x1500('0x7')],_0x3be279[_0x1500('0x8')],_0x3be279['type']));if(_0x3be279[_0x1500('0x5')]){utils['getUserByInterface'](_0x3be279['interface'])[_0x1500('0x9')](function(_0xfcb20c){if(_0xfcb20c){_0x3be279[_0x1500('0x8')]=_0xfcb20c[_0x1500('0xa')];_0x3be279[_0x1500('0xb')]=_0xfcb20c[_0x1500('0xb')];utils[_0x1500('0xc')](_0x1500('0xd'),_0x3be279);}else{utils[_0x1500('0xe')](_0x3be279['interface'][_0x1500('0xf')]('/')[0x1])['then'](function(_0x22913c){if(_0x22913c){_0x3be279[_0x1500('0x8')]=_0x22913c[_0x1500('0xa')];_0x3be279['internal']=_0x22913c[_0x1500('0xb')];utils[_0x1500('0xc')](_0x1500('0xd'),_0x3be279);}});}})[_0x1500('0x10')](function(_0x3ecc04){utils['error'](_0x3ecc04);});}delete members[_0x3be279['interface']];}function startsWith(_0x3032e8,_0xaaddc7){return _[_0x1500('0x11')](_0x3032e8,function(_0x5ba916){return _[_0x1500('0x12')](_0xaaddc7,_0x5ba916);});}exports[_0x1500('0x13')]=function(_0x408fdc){switch(_0x408fdc[_0x1500('0x14')]){case _0x1500('0x15'):case _0x1500('0x16'):if(!startsWith(exclude,_0x408fdc[_0x1500('0x17')])){members[_0x408fdc[_0x1500('0x17')]]={'channel':_0x1500('0x18'),'interface':_0x408fdc[_0x1500('0x17')],'type':_0x1500('0x19'),'enterAt':utils[_0x1500('0x1a')](),'role':_0x1500('0x1b')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x408fdc[_0x1500('0x17')]])){members[_0x408fdc['device']][_0x1500('0x1c')]=utils['now']();members[_0x408fdc[_0x1500('0x17')]][_0x1500('0x1d')]=utils[_0x1500('0x1e')](members[_0x408fdc[_0x1500('0x17')]][_0x1500('0x1c')],members[_0x408fdc[_0x1500('0x17')]][_0x1500('0x1f')]);if(members[_0x408fdc[_0x1500('0x17')]]['uniqueid']){writeDB(members[_0x408fdc[_0x1500('0x17')]]);}}default:break;}};exports['agentcomplete']=function(_0x2d2fdc){if(!_['isNil'](members[_0x2d2fdc[_0x1500('0x5')]])){members[_0x2d2fdc['interface']]=_[_0x1500('0x20')](members[_0x2d2fdc[_0x1500('0x5')]],{'data4':_0x2d2fdc[_0x1500('0x21')],'uniqueid':_0x2d2fdc['uniqueid']});}};exports[_0x1500('0x22')]=function(_0x5efb05){if(_0x5efb05[_0x1500('0x6')]){var _0x584b58=_0x5efb05[_0x1500('0x6')][_0x1500('0xf')]('-')[0x0];if(!_[_0x1500('0x23')](members[_0x584b58])){members[_0x584b58]=_[_0x1500('0x20')](members[_0x584b58],{'data1':members[_0x584b58][_0x1500('0x24')]||_0x5efb05[_0x1500('0x25')],'data2':members[_0x584b58][_0x1500('0x7')]||_0x5efb05['source'],'data3':members[_0x584b58][_0x1500('0x26')]||_0x5efb05['destination'],'uniqueid':members[_0x584b58][_0x1500('0x27')]||_0x5efb05[_0x1500('0x27')]});if(members[_0x584b58][_0x1500('0x1c')]){writeDB(members[_0x584b58]);}}}if(_0x5efb05[_0x1500('0x28')]){var _0x33b284=_0x5efb05['destinationchannel']['split']('-')[0x0];if(!_[_0x1500('0x23')](members[_0x33b284])){members[_0x33b284]=_[_0x1500('0x20')](members[_0x33b284],{'data1':members[_0x33b284][_0x1500('0x24')]||_0x5efb05[_0x1500('0x25')],'data2':members[_0x33b284][_0x1500('0x7')]||_0x5efb05[_0x1500('0x29')],'data3':members[_0x33b284][_0x1500('0x26')]||_0x5efb05[_0x1500('0x2a')],'uniqueid':members[_0x33b284]['uniqueid']||_0x5efb05[_0x1500('0x27')]});if(members[_0x33b284][_0x1500('0x1c')]){writeDB(members[_0x33b284]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 1beb910..4be18be 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 _0x2159=['CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','queueposition','EXITWITHKEY','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','agentconnect','assigned','destaccountcode','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','ATTENDED','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','calleridname','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','mohtime','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','util','info','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','isNil','queuecallerabandon','queuecallercompleteAt','now','COMPLETEDBYAGENT','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase'];(function(_0x33abeb,_0x1ccdc5){var _0x40ad7f=function(_0x134f35){while(--_0x134f35){_0x33abeb['push'](_0x33abeb['shift']());}};_0x40ad7f(++_0x1ccdc5);}(_0x2159,0x7f));var _0x9215=function(_0x2866f6,_0x572c3a){_0x2866f6=_0x2866f6-0x0;var _0x5311f3=_0x2159[_0x2866f6];return _0x5311f3;};'use strict';var _=require('lodash');var util=require(_0x9215('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x1e65c9){utils[_0x9215('0x1')](util['format']('QUEUE|%s|%s|%s|%s|%s|%s|%s',_0x1e65c9[_0x9215('0x2')],_0x1e65c9[_0x9215('0x3')],_0x1e65c9[_0x9215('0x4')],_0x1e65c9[_0x9215('0x5')],_0x1e65c9[_0x9215('0x6')],_0x1e65c9[_0x9215('0x7')],_0x1e65c9[_0x9215('0x8')]));if(_0x1e65c9[_0x9215('0x4')]){utils[_0x9215('0x9')](_0x1e65c9[_0x9215('0x4')])['then'](function(_0x311394){if(_0x311394){_0x1e65c9[_0x9215('0xa')]=_0x311394[_0x9215('0xa')];}utils[_0x9215('0xb')](_0x9215('0xc'),_0x1e65c9);});}else{utils[_0x9215('0xb')](_0x9215('0xc'),_0x1e65c9);}if(_0x1e65c9[_0x9215('0xd')]){delete queues[_0x1e65c9[_0x9215('0xd')]];}else{delete queues[_0x1e65c9[_0x9215('0x2')]];}}exports[_0x9215('0xe')]=function(_0x11ed06){queues[_0x11ed06[_0x9215('0x2')]]=_[_0x9215('0xf')](_0x11ed06,{'originalposition':_0x11ed06['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports['hangup']=function(_0x39a80e){if(!_[_0x9215('0x10')](queues[_0x39a80e[_0x9215('0x2')]])){if(queues[_0x39a80e['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x39a80e[_0x9215('0x2')]][_0x9215('0x11')]&&!queues[_0x39a80e['uniqueid']]['queuecallerexit']){queues[_0x39a80e[_0x9215('0x2')]]['queuecallercomplete']=!![];queues[_0x39a80e[_0x9215('0x2')]][_0x9215('0x12')]=utils[_0x9215('0x13')]();queues[_0x39a80e[_0x9215('0x2')]]['queuecallerexitreason']=_0x9215('0x14');}writeDB(queues[_0x39a80e[_0x9215('0x2')]]);}else{if(queues[_0x39a80e[_0x9215('0x2')]][_0x9215('0xd')]){queues[queues[_0x39a80e[_0x9215('0x2')]]['transfereduniqueid']]=queues[_0x39a80e[_0x9215('0x2')]];queues[queues[_0x39a80e[_0x9215('0x2')]][_0x9215('0xd')]][_0x9215('0x15')]=0x2;delete queues[_0x39a80e[_0x9215('0x2')]];}}}};exports[_0x9215('0x16')]=function(_0x1cc2cf){if(!_[_0x9215('0x10')](_0x1cc2cf[_0x9215('0x17')][_0x9215('0x18')])&&_0x1cc2cf[_0x9215('0x19')][_0x9215('0x1a')]()!==_0x9215('0x1b')){if(!_[_0x9215('0x10')](queues[_0x1cc2cf['uniqueid']])){queues[_0x1cc2cf[_0x9215('0x2')]][_0x9215('0x11')]=![];queues[_0x1cc2cf[_0x9215('0x2')]][_0x9215('0x1c')]=null;queues[_0x1cc2cf[_0x9215('0x2')]][_0x9215('0x1d')]=!![];queues[_0x1cc2cf[_0x9215('0x2')]][_0x9215('0x1e')]=utils[_0x9215('0x13')]();queues[_0x1cc2cf['uniqueid']][_0x9215('0x8')]=_0x1cc2cf[_0x9215('0x19')][_0x9215('0x1a')]();writeDB(queues[_0x1cc2cf[_0x9215('0x2')]]);}}else if(!_[_0x9215('0x10')](_0x1cc2cf[_0x9215('0x17')][_0x9215('0x1f')])){if(!_[_0x9215('0x10')](queues[_0x1cc2cf[_0x9215('0x2')]])&&!queues[_0x1cc2cf['uniqueid']][_0x9215('0x11')]){queues[_0x1cc2cf[_0x9215('0x2')]]['queuecallerabandon']=![];queues[_0x1cc2cf[_0x9215('0x2')]][_0x9215('0x1c')]=null;queues[_0x1cc2cf[_0x9215('0x2')]][_0x9215('0x1d')]=!![];queues[_0x1cc2cf['uniqueid']]['queuecallerexitAt']=utils['now']();queues[_0x1cc2cf['uniqueid']][_0x9215('0x8')]=_0x9215('0x20');}}};exports[_0x9215('0x11')]=function(_0xee2259){if(!_['isNil'](queues[_0xee2259[_0x9215('0x2')]])){queues[_0xee2259[_0x9215('0x2')]]['queuecallerexit']=![];queues[_0xee2259[_0x9215('0x2')]][_0x9215('0x1e')]=null;queues[_0xee2259[_0x9215('0x2')]][_0x9215('0x11')]=!![];queues[_0xee2259['uniqueid']][_0x9215('0x1c')]=utils[_0x9215('0x13')]();queues[_0xee2259[_0x9215('0x2')]]['queuecallerexitreason']=_0x9215('0x21');}};exports[_0x9215('0x22')]=function(_0x5a6526){if(!_[_0x9215('0x10')](queues[_0x5a6526[_0x9215('0x2')]])){queues[_0x5a6526['uniqueid']]['queuecallerleave']=!![];queues[_0x5a6526[_0x9215('0x2')]][_0x9215('0x23')]=utils['now']();queues[_0x5a6526[_0x9215('0x2')]][_0x9215('0x24')]=utils[_0x9215('0x25')](queues[_0x5a6526[_0x9215('0x2')]][_0x9215('0x23')],queues[_0x5a6526[_0x9215('0x2')]][_0x9215('0x26')]);queues[_0x5a6526[_0x9215('0x2')]][_0x9215('0x27')]=_0x5a6526['position'];queues[_0x5a6526[_0x9215('0x2')]][_0x9215('0x28')]=_0x5a6526[_0x9215('0x28')];queues[_0x5a6526[_0x9215('0x2')]]['connectedlinenum']=_0x5a6526[_0x9215('0x29')];queues[_0x5a6526[_0x9215('0x2')]]['connectedlinename']=_0x5a6526[_0x9215('0x2a')];}};exports[_0x9215('0x2b')]=function(_0x59631b){if(!_[_0x9215('0x10')](queues[_0x59631b['uniqueid']])){queues[_0x59631b[_0x9215('0x2')]][_0x9215('0x11')]=![];queues[_0x59631b[_0x9215('0x2')]][_0x9215('0x11')]=![];queues[_0x59631b[_0x9215('0x2')]][_0x9215('0x1c')]=null;queues[_0x59631b[_0x9215('0x2')]][_0x9215('0x1d')]=![];queues[_0x59631b[_0x9215('0x2')]]['queuecallerexitreason']=null;queues[_0x59631b['uniqueid']][_0x9215('0x1e')]=null;queues[_0x59631b[_0x9215('0x2')]][_0x9215('0x2c')]=!![];queues[_0x59631b[_0x9215('0x2')]][_0x9215('0x7')]=_0x59631b[_0x9215('0x2d')];queues[_0x59631b[_0x9215('0x2')]][_0x9215('0x5')]=_0x59631b['membername'];}};exports['agentcomplete']=function(_0x534e0e){if(!_[_0x9215('0x10')](queues[_0x534e0e[_0x9215('0x2')]])){if(queues[_0x534e0e['uniqueid']][_0x9215('0x23')]){queues[_0x534e0e[_0x9215('0x2')]][_0x9215('0x11')]=![];queues[_0x534e0e[_0x9215('0x2')]][_0x9215('0x11')]=![];queues[_0x534e0e['uniqueid']][_0x9215('0x1c')]=null;queues[_0x534e0e[_0x9215('0x2')]][_0x9215('0x1d')]=![];queues[_0x534e0e[_0x9215('0x2')]][_0x9215('0x1e')]=null;queues[_0x534e0e['uniqueid']]['assigned']=!![];queues[_0x534e0e[_0x9215('0x2')]][_0x9215('0x5')]=_0x534e0e['membername'];queues[_0x534e0e['uniqueid']][_0x9215('0x2e')]=!![];queues[_0x534e0e['uniqueid']][_0x9215('0x12')]=utils[_0x9215('0x13')]();if(_0x534e0e[_0x9215('0x2f')]==_0x9215('0x30')){if(!queues[_0x534e0e[_0x9215('0x2')]][_0x9215('0x30')]){queues[_0x534e0e[_0x9215('0x2')]][_0x9215('0x8')]=_0x9215('0x31');}}else{queues[_0x534e0e[_0x9215('0x2')]]['queuecallerexitreason']=_0x9215('0x32')+_0x534e0e[_0x9215('0x2f')][_0x9215('0x1a')]();}writeDB(queues[_0x534e0e[_0x9215('0x2')]]);}}};exports[_0x9215('0x33')]=function(_0x36e21a){if(!_[_0x9215('0x10')](queues[_0x36e21a[_0x9215('0x34')]])){queues[_0x36e21a[_0x9215('0x34')]]['transfer']=!![];queues[_0x36e21a['transfereeuniqueid']][_0x9215('0x35')]='BLIND';queues[_0x36e21a['transfereeuniqueid']][_0x9215('0x36')]=_0x36e21a[_0x9215('0x37')];queues[_0x36e21a['transfereeuniqueid']]['transferuniqueid']=_0x36e21a['transfereeuniqueid'];queues[_0x36e21a['transfereeuniqueid']][_0x9215('0x8')]='BLINDTRANSFER';}};exports[_0x9215('0x38')]=function(_0x727d08){try{if(_0x727d08[_0x9215('0x39')]==_0x727d08['origtransfererlinkedid']){if(!_[_0x9215('0x10')](queues[_0x727d08[_0x9215('0x3a')]])){queues[_0x727d08[_0x9215('0x3a')]]['transfer']=!![];queues[_0x727d08[_0x9215('0x3a')]][_0x9215('0x35')]=_0x9215('0x3b');queues[_0x727d08[_0x9215('0x3a')]][_0x9215('0x36')]=_0x727d08[_0x9215('0x3c')];queues[_0x727d08[_0x9215('0x3a')]][_0x9215('0x3d')]=_0x727d08['origtransfereruniqueid'];queues[_0x727d08[_0x9215('0x3a')]]['queuecallerexitreason']=_0x9215('0x3e');}if(!_[_0x9215('0x10')](queues[_0x727d08[_0x9215('0x3f')]])){if(_0x727d08['transfereelinkedid']&&queues[_0x727d08[_0x9215('0x40')]]){queues[_0x727d08[_0x9215('0x40')]]['queuecallerenterreason']=0x1;queues[_0x727d08['transfereeuniqueid']]=_[_0x9215('0x41')](queues[_0x727d08[_0x9215('0x40')]]);queues[_0x727d08[_0x9215('0x34')]][_0x9215('0xd')]=_0x727d08['transfertargetuniqueid'];queues[_0x727d08[_0x9215('0x34')]]['queuecallerenterreason']=0x2;queues[_0x727d08[_0x9215('0x34')]][_0x9215('0x6')]=queues[_0x727d08[_0x9215('0x3a')]]['calleridnum'];queues[_0x727d08[_0x9215('0x34')]][_0x9215('0x42')]=queues[_0x727d08['secondtransfererlinkedid']][_0x9215('0x42')];queues[_0x727d08['transfereeuniqueid']][_0x9215('0x26')]=utils[_0x9215('0x13')]();queues[_0x727d08[_0x9215('0x34')]][_0x9215('0x23')]=utils[_0x9215('0x13')]();queues[_0x727d08[_0x9215('0x34')]][_0x9215('0x24')]=0x0;queues[_0x727d08['transfereeuniqueid']]['mohtime']=0x0;}else{queues[_0x727d08[_0x9215('0x3f')]][_0x9215('0xd')]=_0x727d08[_0x9215('0x3a')];}}}else if(_0x727d08[_0x9215('0x43')]==_0x727d08[_0x9215('0x3a')]){if(!_[_0x9215('0x10')](queues[_0x727d08['origtransfererlinkedid']])){queues[_0x727d08[_0x9215('0x3f')]][_0x9215('0x30')]=!![];queues[_0x727d08['origtransfererlinkedid']][_0x9215('0x35')]=_0x9215('0x3b');queues[_0x727d08[_0x9215('0x3f')]][_0x9215('0x36')]=_0x727d08[_0x9215('0x44')];queues[_0x727d08[_0x9215('0x3f')]][_0x9215('0x3d')]=_0x727d08[_0x9215('0x43')];queues[_0x727d08[_0x9215('0x3f')]]['queuecallerexitreason']=_0x9215('0x3e');}if(!_['isNil'](queues[_0x727d08[_0x9215('0x3a')]])){if(_0x727d08[_0x9215('0x45')]&&queues[_0x727d08[_0x9215('0x45')]]){queues[_0x727d08[_0x9215('0x45')]]['queuecallerenterreason']=0x1;queues[_0x727d08[_0x9215('0x46')]]=_[_0x9215('0x41')](queues[_0x727d08[_0x9215('0x45')]]);queues[_0x727d08[_0x9215('0x46')]][_0x9215('0xd')]=_0x727d08[_0x9215('0x46')];queues[_0x727d08[_0x9215('0x46')]]['queuecallerenterreason']=0x2;queues[_0x727d08[_0x9215('0x46')]][_0x9215('0x6')]=queues[_0x727d08[_0x9215('0x3f')]]['calleridnum'];queues[_0x727d08[_0x9215('0x46')]][_0x9215('0x42')]=queues[_0x727d08[_0x9215('0x3f')]][_0x9215('0x42')];queues[_0x727d08[_0x9215('0x46')]][_0x9215('0x26')]=utils[_0x9215('0x13')]();queues[_0x727d08[_0x9215('0x46')]][_0x9215('0x23')]=utils[_0x9215('0x13')]();queues[_0x727d08[_0x9215('0x46')]]['holdtime']=0x0;queues[_0x727d08[_0x9215('0x46')]][_0x9215('0x47')]=0x0;}else{queues[_0x727d08[_0x9215('0x3a')]][_0x9215('0xd')]=_0x727d08[_0x9215('0x3f')];}}}}catch(_0xd074df){utils[_0x9215('0x48')](_0xd074df[_0x9215('0x49')]);}};exports[_0x9215('0x4a')]=function(_0x1a86a6){if(!_['isNil'](queues[_0x1a86a6[_0x9215('0x2')]])){queues[_0x1a86a6['uniqueid']][_0x9215('0x4b')]=utils['now']();}};exports[_0x9215('0x4c')]=function(_0x40e8c8){if(!_[_0x9215('0x10')](queues[_0x40e8c8[_0x9215('0x2')]])){if(!_[_0x9215('0x10')](queues[_0x40e8c8[_0x9215('0x2')]][_0x9215('0x4b')])){queues[_0x40e8c8[_0x9215('0x2')]][_0x9215('0x47')]+=utils['diffTime'](utils['now'](),queues[_0x40e8c8[_0x9215('0x2')]][_0x9215('0x4b')]);delete queues[_0x40e8c8[_0x9215('0x2')]]['musiconholdstartAt'];}}}; \ No newline at end of file +var _0x5692=['origtransfererlinkedid','ATTENDED','secondtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','mohtime','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertargetlinkedid','clone','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','util','./utils','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','accountcode','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','assign','position','hangup','isNil','queuecallerabandon','queuecallerexit','queuecallercompleteAt','now','queuecallerexitreason','COMPLETEDBYAGENT','queuecallerenterreason','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','queueposition','ABANDONED','queuecallerleave','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','connectedlinenum','connectedlinename','agentconnect','assigned','membername','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid'];(function(_0x4e310b,_0x3d9fa2){var _0x2c3bc4=function(_0x14c59f){while(--_0x14c59f){_0x4e310b['push'](_0x4e310b['shift']());}};_0x2c3bc4(++_0x3d9fa2);}(_0x5692,0x19d));var _0x2569=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5692[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x2569('0x0'));var util=require(_0x2569('0x1'));var utils=require(_0x2569('0x2'));var queues={};function writeDB(_0x506f8d){utils['info'](util[_0x2569('0x3')](_0x2569('0x4'),_0x506f8d[_0x2569('0x5')],_0x506f8d[_0x2569('0x6')],_0x506f8d[_0x2569('0x7')],_0x506f8d[_0x2569('0x8')],_0x506f8d['calleridnum'],_0x506f8d[_0x2569('0x9')],_0x506f8d['queuecallerexitreason']));if(_0x506f8d[_0x2569('0x7')]){utils['getVoiceQueueByName'](_0x506f8d[_0x2569('0x7')])[_0x2569('0xa')](function(_0x27930a){if(_0x27930a){_0x506f8d[_0x2569('0xb')]=_0x27930a['type'];}utils[_0x2569('0xc')](_0x2569('0xd'),_0x506f8d);});}else{utils['request'](_0x2569('0xd'),_0x506f8d);}if(_0x506f8d[_0x2569('0xe')]){delete queues[_0x506f8d[_0x2569('0xe')]];}else{delete queues[_0x506f8d[_0x2569('0x5')]];}}exports[_0x2569('0xf')]=function(_0x4207d9){queues[_0x4207d9[_0x2569('0x5')]]=_[_0x2569('0x10')](_0x4207d9,{'originalposition':_0x4207d9[_0x2569('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0x2569('0x12')]=function(_0x2be40a){if(!_[_0x2569('0x13')](queues[_0x2be40a[_0x2569('0x5')]])){if(queues[_0x2be40a[_0x2569('0x5')]]['queuecallerleaveAt']){if(!queues[_0x2be40a[_0x2569('0x5')]][_0x2569('0x14')]&&!queues[_0x2be40a[_0x2569('0x5')]][_0x2569('0x15')]){queues[_0x2be40a['uniqueid']]['queuecallercomplete']=!![];queues[_0x2be40a[_0x2569('0x5')]][_0x2569('0x16')]=utils[_0x2569('0x17')]();queues[_0x2be40a[_0x2569('0x5')]][_0x2569('0x18')]=_0x2569('0x19');}writeDB(queues[_0x2be40a['uniqueid']]);}else{if(queues[_0x2be40a[_0x2569('0x5')]]['transfereduniqueid']){queues[queues[_0x2be40a[_0x2569('0x5')]][_0x2569('0xe')]]=queues[_0x2be40a[_0x2569('0x5')]];queues[queues[_0x2be40a[_0x2569('0x5')]]['transfereduniqueid']][_0x2569('0x1a')]=0x2;delete queues[_0x2be40a['uniqueid']];}}}};exports['varset']=function(_0x35e993){if(!_[_0x2569('0x13')](_0x35e993[_0x2569('0x1b')][_0x2569('0x1c')])&&_0x35e993[_0x2569('0x1d')][_0x2569('0x1e')]()!==_0x2569('0x1f')){if(!_[_0x2569('0x13')](queues[_0x35e993[_0x2569('0x5')]])){queues[_0x35e993[_0x2569('0x5')]][_0x2569('0x14')]=![];queues[_0x35e993['uniqueid']][_0x2569('0x20')]=null;queues[_0x35e993[_0x2569('0x5')]][_0x2569('0x15')]=!![];queues[_0x35e993[_0x2569('0x5')]][_0x2569('0x21')]=utils['now']();queues[_0x35e993['uniqueid']][_0x2569('0x18')]=_0x35e993['value'][_0x2569('0x1e')]();writeDB(queues[_0x35e993[_0x2569('0x5')]]);}}else if(!_[_0x2569('0x13')](_0x35e993[_0x2569('0x1b')][_0x2569('0x22')])){if(!_['isNil'](queues[_0x35e993[_0x2569('0x5')]])&&!queues[_0x35e993[_0x2569('0x5')]][_0x2569('0x14')]){queues[_0x35e993['uniqueid']]['queuecallerabandon']=![];queues[_0x35e993['uniqueid']]['queuecallerabandonAt']=null;queues[_0x35e993[_0x2569('0x5')]]['queuecallerexit']=!![];queues[_0x35e993['uniqueid']][_0x2569('0x21')]=utils[_0x2569('0x17')]();queues[_0x35e993[_0x2569('0x5')]][_0x2569('0x18')]='EXITWITHKEY';}}};exports['queuecallerabandon']=function(_0x3e1c6b){if(!_['isNil'](queues[_0x3e1c6b[_0x2569('0x5')]])){queues[_0x3e1c6b[_0x2569('0x5')]][_0x2569('0x15')]=![];queues[_0x3e1c6b['uniqueid']][_0x2569('0x21')]=null;queues[_0x3e1c6b[_0x2569('0x5')]]['queuecallerabandon']=!![];queues[_0x3e1c6b[_0x2569('0x5')]][_0x2569('0x20')]=utils[_0x2569('0x17')]();queues[_0x3e1c6b[_0x2569('0x5')]][_0x2569('0x18')]=_0x2569('0x23');}};exports[_0x2569('0x24')]=function(_0x35562b){if(!_[_0x2569('0x13')](queues[_0x35562b[_0x2569('0x5')]])){queues[_0x35562b[_0x2569('0x5')]]['queuecallerleave']=!![];queues[_0x35562b[_0x2569('0x5')]][_0x2569('0x25')]=utils[_0x2569('0x17')]();queues[_0x35562b[_0x2569('0x5')]][_0x2569('0x26')]=utils[_0x2569('0x27')](queues[_0x35562b['uniqueid']][_0x2569('0x25')],queues[_0x35562b[_0x2569('0x5')]][_0x2569('0x28')]);queues[_0x35562b[_0x2569('0x5')]][_0x2569('0x11')]=_0x35562b[_0x2569('0x11')];queues[_0x35562b['uniqueid']]['count']=_0x35562b['count'];queues[_0x35562b[_0x2569('0x5')]][_0x2569('0x29')]=_0x35562b[_0x2569('0x29')];queues[_0x35562b[_0x2569('0x5')]][_0x2569('0x2a')]=_0x35562b['connectedlinename'];}};exports[_0x2569('0x2b')]=function(_0xc956a6){if(!_[_0x2569('0x13')](queues[_0xc956a6['uniqueid']])){queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x14')]=![];queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x14')]=![];queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x20')]=null;queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x15')]=![];queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x18')]=null;queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x21')]=null;queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x2c')]=!![];queues[_0xc956a6[_0x2569('0x5')]]['accountcode']=_0xc956a6['destaccountcode'];queues[_0xc956a6[_0x2569('0x5')]][_0x2569('0x8')]=_0xc956a6[_0x2569('0x2d')];}};exports['agentcomplete']=function(_0x128e32){if(!_[_0x2569('0x13')](queues[_0x128e32[_0x2569('0x5')]])){if(queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x25')]){queues[_0x128e32[_0x2569('0x5')]]['queuecallerabandon']=![];queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x14')]=![];queues[_0x128e32['uniqueid']]['queuecallerabandonAt']=null;queues[_0x128e32['uniqueid']][_0x2569('0x15')]=![];queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x21')]=null;queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x2c')]=!![];queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x8')]=_0x128e32[_0x2569('0x2d')];queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x2e')]=!![];queues[_0x128e32[_0x2569('0x5')]][_0x2569('0x16')]=utils['now']();if(_0x128e32[_0x2569('0x2f')]==_0x2569('0x30')){if(!queues[_0x128e32['uniqueid']]['transfer']){queues[_0x128e32['uniqueid']][_0x2569('0x18')]=_0x2569('0x31');}}else{queues[_0x128e32[_0x2569('0x5')]]['queuecallerexitreason']=_0x2569('0x32')+_0x128e32['reason']['toUpperCase']();}writeDB(queues[_0x128e32[_0x2569('0x5')]]);}}};exports[_0x2569('0x33')]=function(_0xb2ff83){if(!_['isNil'](queues[_0xb2ff83['transfereeuniqueid']])){queues[_0xb2ff83[_0x2569('0x34')]][_0x2569('0x30')]=!![];queues[_0xb2ff83['transfereeuniqueid']][_0x2569('0x35')]=_0x2569('0x36');queues[_0xb2ff83[_0x2569('0x34')]][_0x2569('0x37')]=_0xb2ff83[_0x2569('0x38')];queues[_0xb2ff83[_0x2569('0x34')]][_0x2569('0x39')]=_0xb2ff83[_0x2569('0x34')];queues[_0xb2ff83[_0x2569('0x34')]][_0x2569('0x18')]=_0x2569('0x3a');}};exports[_0x2569('0x3b')]=function(_0x268bee){try{if(_0x268bee[_0x2569('0x3c')]==_0x268bee[_0x2569('0x3d')]){if(!_[_0x2569('0x13')](queues[_0x268bee['secondtransfererlinkedid']])){queues[_0x268bee['secondtransfererlinkedid']]['transfer']=!![];queues[_0x268bee['secondtransfererlinkedid']][_0x2569('0x35')]=_0x2569('0x3e');queues[_0x268bee[_0x2569('0x3f')]][_0x2569('0x37')]=_0x268bee['origtransfererexten'];queues[_0x268bee[_0x2569('0x3f')]][_0x2569('0x39')]=_0x268bee[_0x2569('0x3c')];queues[_0x268bee[_0x2569('0x3f')]][_0x2569('0x18')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x268bee[_0x2569('0x3d')]])){if(_0x268bee[_0x2569('0x40')]&&queues[_0x268bee[_0x2569('0x40')]]){queues[_0x268bee[_0x2569('0x40')]][_0x2569('0x1a')]=0x1;queues[_0x268bee[_0x2569('0x34')]]=_['clone'](queues[_0x268bee[_0x2569('0x40')]]);queues[_0x268bee[_0x2569('0x34')]][_0x2569('0xe')]=_0x268bee[_0x2569('0x41')];queues[_0x268bee[_0x2569('0x34')]][_0x2569('0x1a')]=0x2;queues[_0x268bee[_0x2569('0x34')]][_0x2569('0x42')]=queues[_0x268bee[_0x2569('0x3f')]]['calleridnum'];queues[_0x268bee[_0x2569('0x34')]][_0x2569('0x43')]=queues[_0x268bee['secondtransfererlinkedid']]['calleridname'];queues[_0x268bee[_0x2569('0x34')]][_0x2569('0x28')]=utils[_0x2569('0x17')]();queues[_0x268bee[_0x2569('0x34')]]['queuecallerleaveAt']=utils['now']();queues[_0x268bee['transfereeuniqueid']][_0x2569('0x26')]=0x0;queues[_0x268bee['transfereeuniqueid']][_0x2569('0x44')]=0x0;}else{queues[_0x268bee[_0x2569('0x3d')]][_0x2569('0xe')]=_0x268bee[_0x2569('0x3f')];}}}else if(_0x268bee['secondtransfereruniqueid']==_0x268bee[_0x2569('0x3f')]){if(!_[_0x2569('0x13')](queues[_0x268bee['origtransfererlinkedid']])){queues[_0x268bee['origtransfererlinkedid']][_0x2569('0x30')]=!![];queues[_0x268bee[_0x2569('0x3d')]]['transfertype']='ATTENDED';queues[_0x268bee[_0x2569('0x3d')]][_0x2569('0x37')]=_0x268bee[_0x2569('0x45')];queues[_0x268bee[_0x2569('0x3d')]][_0x2569('0x39')]=_0x268bee[_0x2569('0x46')];queues[_0x268bee[_0x2569('0x3d')]][_0x2569('0x18')]=_0x2569('0x47');}if(!_[_0x2569('0x13')](queues[_0x268bee['secondtransfererlinkedid']])){if(_0x268bee[_0x2569('0x48')]&&queues[_0x268bee[_0x2569('0x48')]]){queues[_0x268bee['transfertargetlinkedid']][_0x2569('0x1a')]=0x1;queues[_0x268bee[_0x2569('0x41')]]=_[_0x2569('0x49')](queues[_0x268bee[_0x2569('0x48')]]);queues[_0x268bee[_0x2569('0x41')]][_0x2569('0xe')]=_0x268bee[_0x2569('0x41')];queues[_0x268bee[_0x2569('0x41')]][_0x2569('0x1a')]=0x2;queues[_0x268bee[_0x2569('0x41')]][_0x2569('0x42')]=queues[_0x268bee[_0x2569('0x3d')]][_0x2569('0x42')];queues[_0x268bee[_0x2569('0x41')]]['calleridname']=queues[_0x268bee['origtransfererlinkedid']][_0x2569('0x43')];queues[_0x268bee['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x2569('0x17')]();queues[_0x268bee['transfertargetuniqueid']][_0x2569('0x25')]=utils['now']();queues[_0x268bee['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x268bee[_0x2569('0x41')]][_0x2569('0x44')]=0x0;}else{queues[_0x268bee['secondtransfererlinkedid']][_0x2569('0xe')]=_0x268bee[_0x2569('0x3d')];}}}}catch(_0x240803){utils[_0x2569('0x4a')](_0x240803[_0x2569('0x4b')]);}};exports[_0x2569('0x4c')]=function(_0x2eed66){if(!_[_0x2569('0x13')](queues[_0x2eed66['uniqueid']])){queues[_0x2eed66[_0x2569('0x5')]][_0x2569('0x4d')]=utils['now']();}};exports[_0x2569('0x4e')]=function(_0x56da34){if(!_[_0x2569('0x13')](queues[_0x56da34['uniqueid']])){if(!_[_0x2569('0x13')](queues[_0x56da34[_0x2569('0x5')]][_0x2569('0x4d')])){queues[_0x56da34[_0x2569('0x5')]][_0x2569('0x44')]+=utils['diffTime'](utils[_0x2569('0x17')](),queues[_0x56da34[_0x2569('0x5')]]['musiconholdstartAt']);delete queues[_0x56da34[_0x2569('0x5')]][_0x2569('0x4d')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 07b1356..6bbf273 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['getUserByInternal','then','name','request','CreateVoiceRecording','newchannel','uniqueid','linkedid','context','channel','error','stack','isNil','transfer','variable','endsWith','value','replace','.wav49','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','toLowerCase','set','startsWith','appdata','split','substring','lastIndexOf','queuecallerjoin','queue','debug','accountcode'];(function(_0x993144,_0x16e9af){var _0x334ba6=function(_0x16f582){while(--_0x16f582){_0x993144['push'](_0x993144['shift']());}};_0x334ba6(++_0x16e9af);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var _=require('lodash');var utils=require('./utils');var recordings={};function writeDB(_0x1ffbbf){utils[_0x49c4('0x0')](_0x1ffbbf);if(_0x1ffbbf[_0x49c4('0x1')]){utils[_0x49c4('0x2')](_0x1ffbbf[_0x49c4('0x1')])[_0x49c4('0x3')](function(_0x4e0313){if(_0x4e0313){_0x1ffbbf['membername']=_0x4e0313[_0x49c4('0x4')];_0x1ffbbf['UserId']=_0x4e0313['id'];}utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);});}else{utils[_0x49c4('0x5')](_0x49c4('0x6'),_0x1ffbbf);}}exports[_0x49c4('0x7')]=function(_0x511d53){try{if(_0x511d53[_0x49c4('0x8')]==_0x511d53[_0x49c4('0x9')]){recordings[_0x511d53[_0x49c4('0x8')]]={'uniqueid':_0x511d53[_0x49c4('0x8')],'accountcode':_0x511d53['accountcode'],'exten':_0x511d53['exten'],'context':_0x511d53[_0x49c4('0xa')],'channel':_0x511d53[_0x49c4('0xb')],'monitors':[]};}}catch(_0x58cad7){utils[_0x49c4('0xc')](_0x58cad7[_0x49c4('0xd')]);}};exports['newstate']=function(_0x536d42){try{if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x8')]])&&_0x536d42['channelstate']==0x6){}else if(!_[_0x49c4('0xe')](recordings[_0x536d42[_0x49c4('0x9')]])&&_0x536d42['channelstate']==0x6&&_0x536d42[_0x49c4('0xa')]!=_0x49c4('0xf')){recordings[_0x536d42[_0x49c4('0x9')]][_0x49c4('0x1')]=_0x536d42[_0x49c4('0x1')];}}catch(_0x18211c){utils[_0x49c4('0xc')](_0x18211c[_0x49c4('0xd')]);}};exports['varset']=function(_0x3acd06){try{if(!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')])&&!_[_0x49c4('0xe')](_0x3acd06[_0x49c4('0x10')]['mixmonitor_filename'])){if(_[_0x49c4('0x11')](_0x3acd06[_0x49c4('0x12')],'.wav49')){_0x3acd06['value']=_0x3acd06[_0x49c4('0x12')][_0x49c4('0x13')](_0x49c4('0x14'),'.WAV');}if(recordings[_0x3acd06[_0x49c4('0x9')]]){var _0x50b151=_[_0x49c4('0x15')](recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')],{'value':_0x3acd06[_0x49c4('0x12')]});if(_[_0x49c4('0xe')](_0x50b151)){recordings[_0x3acd06[_0x49c4('0x9')]][_0x49c4('0x16')][_0x49c4('0x17')]({'value':_0x3acd06[_0x49c4('0x12')]});}}}}catch(_0x578447){utils['error'](_0x578447['stack']);}};exports[_0x49c4('0x18')]=function(_0x4f0b62){try{if(!_['isNil'](recordings[_0x4f0b62[_0x49c4('0x8')]])){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x19')]=_0x4f0b62[_0x49c4('0x19')];recordings[_0x4f0b62['uniqueid']]['calleridname']=_0x4f0b62[_0x49c4('0x1a')];recordings[_0x4f0b62[_0x49c4('0x8')]]['connectedlinenum']=_0x4f0b62[_0x49c4('0x1b')];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]=_0x4f0b62[_0x49c4('0x1c')];if(recordings[_0x4f0b62['uniqueid']]['type']==_0x49c4('0x1d')&&recordings[_0x4f0b62['uniqueid']][_0x49c4('0x1')]){recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1b')]=recordings[_0x4f0b62[_0x49c4('0x8')]]['accountcode'];recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x1c')]='';}recordings[_0x4f0b62[_0x49c4('0x8')]][_0x49c4('0x16')][_0x49c4('0x1e')](_0x29f835=>{var _0x26ba17=_[_0x49c4('0x1f')](recordings[_0x4f0b62[_0x49c4('0x8')]]);_0x26ba17[_0x49c4('0x12')]=_0x29f835[_0x49c4('0x12')];writeDB(_0x26ba17);});delete recordings[_0x4f0b62['uniqueid']];}}catch(_0x4f4495){utils['error'](_0x4f4495[_0x49c4('0xd')]);}};exports[_0x49c4('0x20')]=function(_0x1eb035){try{if(!_[_0x49c4('0xe')](recordings[_0x1eb035[_0x49c4('0x8')]])){if(_0x1eb035['application'][_0x49c4('0x21')]()==_0x49c4('0x22')&&_[_0x49c4('0x23')](_0x1eb035[_0x49c4('0x24')]['toLowerCase'](),'cdr')){var _0xce57ef=_0x1eb035[_0x49c4('0x24')][_0x49c4('0x25')]('=');var _0x13b3b4=_0xce57ef[0x0][_0x49c4('0x26')](_0xce57ef[0x0]['lastIndexOf']('(')+0x1,_0xce57ef[0x0][_0x49c4('0x27')](')'));var _0x84c621=_0xce57ef[0x1];recordings[_0x1eb035[_0x49c4('0x8')]][_0x13b3b4]=_0x84c621;}}}catch(_0x512d02){utils['error'](_0x512d02[_0x49c4('0xd')]);}};exports[_0x49c4('0x28')]=function(_0x3bec0a){try{if(!_[_0x49c4('0xe')](recordings[_0x3bec0a[_0x49c4('0x8')]])){recordings[_0x3bec0a[_0x49c4('0x8')]][_0x49c4('0x29')]=_0x3bec0a[_0x49c4('0x29')];}}catch(_0x3209cd){utils['error'](_0x3209cd[_0x49c4('0xd')]);}}; \ No newline at end of file +var _0x34e8=['membername','name','UserId','CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','stack','newstate','isNil','channelstate','transfer','variable','mixmonitor_filename','value','.wav49','replace','.WAV','find','monitors','push','hangup','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','application','toLowerCase','set','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','debug','getUserByInternal','accountcode','then'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x34e8,0x12c));var _0x834e=function(_0x56f47a,_0x443728){_0x56f47a=_0x56f47a-0x0;var _0x5b222e=_0x34e8[_0x56f47a];return _0x5b222e;};'use strict';var _=require(_0x834e('0x0'));var utils=require(_0x834e('0x1'));var recordings={};function writeDB(_0x8b339){utils[_0x834e('0x2')](_0x8b339);if(_0x8b339['accountcode']){utils[_0x834e('0x3')](_0x8b339[_0x834e('0x4')])[_0x834e('0x5')](function(_0x31bf20){if(_0x31bf20){_0x8b339[_0x834e('0x6')]=_0x31bf20[_0x834e('0x7')];_0x8b339[_0x834e('0x8')]=_0x31bf20['id'];}utils['request'](_0x834e('0x9'),_0x8b339);});}else{utils['request'](_0x834e('0x9'),_0x8b339);}}exports[_0x834e('0xa')]=function(_0x3a3ef6){try{if(_0x3a3ef6[_0x834e('0xb')]==_0x3a3ef6[_0x834e('0xc')]){recordings[_0x3a3ef6[_0x834e('0xb')]]={'uniqueid':_0x3a3ef6[_0x834e('0xb')],'accountcode':_0x3a3ef6[_0x834e('0x4')],'exten':_0x3a3ef6[_0x834e('0xd')],'context':_0x3a3ef6[_0x834e('0xe')],'channel':_0x3a3ef6[_0x834e('0xf')],'monitors':[]};}}catch(_0x36e124){utils[_0x834e('0x10')](_0x36e124[_0x834e('0x11')]);}};exports[_0x834e('0x12')]=function(_0x1e00de){try{if(!_[_0x834e('0x13')](recordings[_0x1e00de['uniqueid']])&&_0x1e00de[_0x834e('0x14')]==0x6){}else if(!_[_0x834e('0x13')](recordings[_0x1e00de['linkedid']])&&_0x1e00de[_0x834e('0x14')]==0x6&&_0x1e00de[_0x834e('0xe')]!=_0x834e('0x15')){recordings[_0x1e00de[_0x834e('0xc')]]['accountcode']=_0x1e00de[_0x834e('0x4')];}}catch(_0x302cbd){utils['error'](_0x302cbd[_0x834e('0x11')]);}};exports['varset']=function(_0x38a8cd){try{if(!_[_0x834e('0x13')](_0x38a8cd['variable'])&&!_[_0x834e('0x13')](_0x38a8cd[_0x834e('0x16')][_0x834e('0x17')])){if(_['endsWith'](_0x38a8cd[_0x834e('0x18')],_0x834e('0x19'))){_0x38a8cd[_0x834e('0x18')]=_0x38a8cd[_0x834e('0x18')][_0x834e('0x1a')](_0x834e('0x19'),_0x834e('0x1b'));}if(recordings[_0x38a8cd['linkedid']]){var _0x2545b4=_[_0x834e('0x1c')](recordings[_0x38a8cd[_0x834e('0xc')]][_0x834e('0x1d')],{'value':_0x38a8cd['value']});if(_[_0x834e('0x13')](_0x2545b4)){recordings[_0x38a8cd[_0x834e('0xc')]]['monitors'][_0x834e('0x1e')]({'value':_0x38a8cd[_0x834e('0x18')]});}}}}catch(_0x8d406e){utils['error'](_0x8d406e['stack']);}};exports[_0x834e('0x1f')]=function(_0x34563b){try{if(!_['isNil'](recordings[_0x34563b[_0x834e('0xb')]])){recordings[_0x34563b[_0x834e('0xb')]]['calleridnum']=_0x34563b[_0x834e('0x20')];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x21')]=_0x34563b['calleridname'];recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x22')]=_0x34563b['connectedlinenum'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]=_0x34563b['connectedlinename'];if(recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x24')]==_0x834e('0x25')&&recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x4')]){recordings[_0x34563b[_0x834e('0xb')]]['connectedlinenum']=recordings[_0x34563b['uniqueid']]['accountcode'];recordings[_0x34563b['uniqueid']][_0x834e('0x23')]='';}recordings[_0x34563b[_0x834e('0xb')]][_0x834e('0x1d')]['forEach'](_0xb5bc06=>{var _0x11f1ce=_[_0x834e('0x26')](recordings[_0x34563b[_0x834e('0xb')]]);_0x11f1ce[_0x834e('0x18')]=_0xb5bc06[_0x834e('0x18')];writeDB(_0x11f1ce);});delete recordings[_0x34563b[_0x834e('0xb')]];}}catch(_0xfaf716){utils[_0x834e('0x10')](_0xfaf716['stack']);}};exports[_0x834e('0x27')]=function(_0x5cad11){try{if(!_[_0x834e('0x13')](recordings[_0x5cad11[_0x834e('0xb')]])){if(_0x5cad11[_0x834e('0x28')][_0x834e('0x29')]()==_0x834e('0x2a')&&_[_0x834e('0x2b')](_0x5cad11[_0x834e('0x2c')][_0x834e('0x29')](),_0x834e('0x2d'))){var _0x12b2bc=_0x5cad11['appdata'][_0x834e('0x2e')]('=');var _0x2f408a=_0x12b2bc[0x0][_0x834e('0x2f')](_0x12b2bc[0x0][_0x834e('0x30')]('(')+0x1,_0x12b2bc[0x0]['lastIndexOf'](')'));var _0x3f88ad=_0x12b2bc[0x1];recordings[_0x5cad11[_0x834e('0xb')]][_0x2f408a]=_0x3f88ad;}}}catch(_0x4b12f5){utils['error'](_0x4b12f5['stack']);}};exports[_0x834e('0x31')]=function(_0x41bf4d){try{if(!_[_0x834e('0x13')](recordings[_0x41bf4d[_0x834e('0xb')]])){recordings[_0x41bf4d[_0x834e('0xb')]][_0x834e('0x32')]=_0x41bf4d['queue'];}}catch(_0x2c2d94){utils['error'](_0x2c2d94[_0x834e('0x11')]);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 41d026c..fb35cea 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 _0x07b9=['secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format','type','request','CreateVoiceTransferReport','blindtransfer','blind','error','stack','attendedtransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext'];(function(_0x27d824,_0x37f5ec){var _0x1e2615=function(_0x20dee8){while(--_0x20dee8){_0x27d824['push'](_0x27d824['shift']());}};_0x1e2615(++_0x37f5ec);}(_0x07b9,0x143));var _0x907b=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x07b9[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x907b('0x0'));var util=require(_0x907b('0x1'));var utils=require(_0x907b('0x2'));function writeDB(_0x35a19f){utils['info'](util[_0x907b('0x3')]('TRANSFER|%s',_0x35a19f[_0x907b('0x4')]));utils[_0x907b('0x5')](_0x907b('0x6'),_0x35a19f);}exports[_0x907b('0x7')]=function(_0x46d254){try{_0x46d254[_0x907b('0x4')]=_0x907b('0x8');writeDB(_0x46d254);}catch(_0x5c124a){utils[_0x907b('0x9')](_0x5c124a[_0x907b('0xa')]);}};exports[_0x907b('0xb')]=function(_0x1ff1ca){try{_0x1ff1ca=_['assign'](_0x1ff1ca,{'transfererchannel':_0x1ff1ca['origtransfererchannel'],'transferercalleridnum':_0x1ff1ca[_0x907b('0xc')],'transferercalleridname':_0x1ff1ca[_0x907b('0xd')],'transfererconnectedlinenum':_0x1ff1ca[_0x907b('0xe')],'transfererconnectedlinename':_0x1ff1ca[_0x907b('0xf')],'transfereraccountcode':_0x1ff1ca[_0x907b('0x10')],'transferercontext':_0x1ff1ca[_0x907b('0x11')],'transfererexten':_0x1ff1ca[_0x907b('0x12')],'transfererlinkedid':_0x1ff1ca[_0x907b('0x13')],'context':_0x1ff1ca[_0x907b('0x14')],'extension':_0x1ff1ca[_0x907b('0x15')],'type':'attended'});if(_[_0x907b('0x16')](_0x1ff1ca['transfereechannel'])){_0x1ff1ca=_['assign'](_0x1ff1ca,{'transfereechannel':_0x1ff1ca[_0x907b('0x17')],'transfereecalleridnum':_0x1ff1ca[_0x907b('0x18')],'transfereecalleridname':_0x1ff1ca[_0x907b('0x19')],'transfereeconnectedlinenum':_0x1ff1ca[_0x907b('0x1a')],'transfereeconnectedlinename':_0x1ff1ca[_0x907b('0x1b')],'transfereeaccountcode':_0x1ff1ca[_0x907b('0x1c')],'transfereecontext':_0x1ff1ca['transfertargetcontext'],'transfereeexten':_0x1ff1ca[_0x907b('0x1d')],'transfereelinkedid':_0x1ff1ca[_0x907b('0x1e')]});}writeDB(_0x1ff1ca);}catch(_0x530369){utils['error'](_0x530369[_0x907b('0xa')]);}}; \ No newline at end of file +var _0xb56f=['type','request','blindtransfer','blind','error','assign','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfererlinkedid','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','stack','lodash','util','./utils','info','format'];(function(_0x555b84,_0x52c991){var _0x131644=function(_0x123b69){while(--_0x123b69){_0x555b84['push'](_0x555b84['shift']());}};_0x131644(++_0x52c991);}(_0xb56f,0x113));var _0xfb56=function(_0x4fd3a7,_0xd0992e){_0x4fd3a7=_0x4fd3a7-0x0;var _0x1da1fc=_0xb56f[_0x4fd3a7];return _0x1da1fc;};'use strict';var _=require(_0xfb56('0x0'));var util=require(_0xfb56('0x1'));var utils=require(_0xfb56('0x2'));function writeDB(_0x57c96b){utils[_0xfb56('0x3')](util[_0xfb56('0x4')]('TRANSFER|%s',_0x57c96b[_0xfb56('0x5')]));utils[_0xfb56('0x6')]('CreateVoiceTransferReport',_0x57c96b);}exports[_0xfb56('0x7')]=function(_0x5ebbb1){try{_0x5ebbb1[_0xfb56('0x5')]=_0xfb56('0x8');writeDB(_0x5ebbb1);}catch(_0x226095){utils[_0xfb56('0x9')](_0x226095['stack']);}};exports['attendedtransfer']=function(_0xbcbe76){try{_0xbcbe76=_[_0xfb56('0xa')](_0xbcbe76,{'transfererchannel':_0xbcbe76[_0xfb56('0xb')],'transferercalleridnum':_0xbcbe76[_0xfb56('0xc')],'transferercalleridname':_0xbcbe76[_0xfb56('0xd')],'transfererconnectedlinenum':_0xbcbe76[_0xfb56('0xe')],'transfererconnectedlinename':_0xbcbe76[_0xfb56('0xf')],'transfereraccountcode':_0xbcbe76['origtransfereraccountcode'],'transferercontext':_0xbcbe76['secondtransferercontext'],'transfererexten':_0xbcbe76['secondtransfererexten'],'transfererlinkedid':_0xbcbe76[_0xfb56('0x10')],'context':_0xbcbe76['origtransferercontext'],'extension':_0xbcbe76[_0xfb56('0x11')],'type':_0xfb56('0x12')});if(_[_0xfb56('0x13')](_0xbcbe76[_0xfb56('0x14')])){_0xbcbe76=_['assign'](_0xbcbe76,{'transfereechannel':_0xbcbe76[_0xfb56('0x15')],'transfereecalleridnum':_0xbcbe76[_0xfb56('0x16')],'transfereecalleridname':_0xbcbe76[_0xfb56('0x17')],'transfereeconnectedlinenum':_0xbcbe76['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xbcbe76[_0xfb56('0x18')],'transfereeaccountcode':_0xbcbe76['transfertargetaccountcode'],'transfereecontext':_0xbcbe76['transfertargetcontext'],'transfereeexten':_0xbcbe76[_0xfb56('0x19')],'transfereelinkedid':_0xbcbe76[_0xfb56('0x1a')]});}writeDB(_0xbcbe76);}catch(_0xc1e894){utils[_0xfb56('0x9')](_0xc1e894[_0xfb56('0x1b')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 7db50c0..7257dfb 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 _0xfd15=['subtractTime','subtract','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','now','isAfter','jayson/promise','moment','client','http','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','catch','internal','name','interface','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','GETVOICEQUEUEBYNAME|','addTime'];(function(_0x19e3f5,_0x34a97f){var _0x59e913=function(_0x4b9fac){while(--_0x4b9fac){_0x19e3f5['push'](_0x19e3f5['shift']());}};_0x59e913(++_0x34a97f);}(_0xfd15,0x171));var _0x5fd1=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xfd15[_0x484e36];return _0xafc85d;};'use strict';var jayson=require(_0x5fd1('0x0'));var moment=require(_0x5fd1('0x1'));var BPromise=require('bluebird');var client=jayson[_0x5fd1('0x2')][_0x5fd1('0x3')]({'port':0x2329});var logger=require(_0x5fd1('0x4'))(_0x5fd1('0x5'));exports[_0x5fd1('0x6')]=function(_0x4d9220){logger[_0x5fd1('0x6')](_0x4d9220);};exports['debug']=function(_0xf9d8f5){logger[_0x5fd1('0x7')](JSON[_0x5fd1('0x8')](_0xf9d8f5));};exports[_0x5fd1('0x9')]=function(_0x205cea){logger[_0x5fd1('0x9')](_0x205cea[_0x5fd1('0xa')]);};exports[_0x5fd1('0xb')]=function(_0x52523d,_0x40a173){return client[_0x5fd1('0xb')](_0x52523d,{'body':_0x40a173})[_0x5fd1('0xc')](function(_0x544fa5){logger['debug'](JSON[_0x5fd1('0x8')](_0x544fa5));})[_0x5fd1('0xd')](function(_0x209f9e){logger[_0x5fd1('0x9')](_0x209f9e[_0x5fd1('0xa')]);});};function getUser(_0x1ee339){return client[_0x5fd1('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x5fd1('0xe'),_0x5fd1('0xf'),_0x5fd1('0x10')],'where':_0x1ee339,'limit':0x1}})[_0x5fd1('0xc')](function(_0x417d3f){logger['info'](_0x5fd1('0x11')+JSON[_0x5fd1('0x8')](_0x1ee339)+'|'+(_0x417d3f[_0x5fd1('0x12')][_0x5fd1('0x13')]?_0x5fd1('0x14'):_0x5fd1('0x15')));return _0x417d3f[_0x5fd1('0x12')]['length']?_0x417d3f[_0x5fd1('0x12')][0x0]:null;});}exports[_0x5fd1('0x16')]=function(_0x19060d){return new BPromise(function(_0x5b0cf9,_0x471303){if(_0x19060d){return getUser({'internal':_0x19060d})[_0x5fd1('0xc')](function(_0x4593f5){return _0x5b0cf9(_0x4593f5);})[_0x5fd1('0xd')](function(_0x2a7cee){logger['error'](_0x2a7cee['stack']);return _0x5b0cf9(null);});}else{return _0x5b0cf9(null);}});};exports[_0x5fd1('0x17')]=function(_0x281d76){return new BPromise(function(_0x576810,_0x355ed9){if(_0x281d76){return getUser({'interface':_0x281d76})['then'](function(_0x4c54b2){return _0x576810(_0x4c54b2);})[_0x5fd1('0xd')](function(_0x43cd2d){logger[_0x5fd1('0x9')](_0x43cd2d['stack']);return _0x576810(null);});}else{return _0x576810(null);}});};exports[_0x5fd1('0x18')]=function(_0x2902e7){return new BPromise(function(_0x1149cf,_0x224842){if(_0x2902e7){return getUser({'name':_0x2902e7})[_0x5fd1('0xc')](function(_0x180e59){return _0x1149cf(_0x180e59);})[_0x5fd1('0xd')](function(_0x11bb92){logger[_0x5fd1('0x9')](_0x11bb92[_0x5fd1('0xa')]);return _0x1149cf(null);});}else{return _0x1149cf(null);}});};exports[_0x5fd1('0x19')]=function(_0x324f50){return new BPromise(function(_0xc275ee,_0x41d9b6){if(_0x324f50){return client[_0x5fd1('0xb')](_0x5fd1('0x1a'),{'options':{'raw':!![],'attributes':['id','name',_0x5fd1('0x1b'),'acw',_0x5fd1('0x1c')],'where':{'name':_0x324f50},'limit':0x1}})[_0x5fd1('0xc')](function(_0x51597b){logger[_0x5fd1('0x6')](_0x5fd1('0x1d')+_0x324f50+'|'+(_0x51597b[_0x5fd1('0x12')][_0x5fd1('0x13')]?'FOUND':_0x5fd1('0x15')));return _0xc275ee(_0x51597b[_0x5fd1('0x12')][_0x5fd1('0x13')]?_0x51597b['result'][0x0]:null);})['catch'](function(_0x11e199){logger['error'](_0x11e199[_0x5fd1('0xa')]);return _0xc275ee(null);});}else{return _0xc275ee(null);}});};exports[_0x5fd1('0x1e')]=function(_0xfe5a6f,_0x38760e){return moment(_0xfe5a6f)['add'](_0x38760e,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5fd1('0x1f')]=function(_0x5971a,_0x517cf4){return moment(_0x5971a)[_0x5fd1('0x20')](_0x517cf4,_0x5fd1('0x21'))[_0x5fd1('0x22')](_0x5fd1('0x23'));};exports[_0x5fd1('0x24')]=function(_0x5b5f0a,_0x2586ac){return moment(_0x5b5f0a)['diff'](moment(_0x2586ac),_0x5fd1('0x21'));};exports[_0x5fd1('0x25')]=function(_0x12e426,_0x291e63){return parseInt(_0x12e426,0xa)+parseInt(_0x291e63,0xa);};exports[_0x5fd1('0x26')]=function(){return moment()[_0x5fd1('0x22')](_0x5fd1('0x23'));};exports['isAfter']=function(_0x814167,_0x42149e){if(_0x42149e){return moment(_0x814167)[_0x5fd1('0x27')](_0x42149e);}else{return!![];}};exports['isBefore']=function(_0x2b8367,_0x29de45){if(_0x29de45){return moment(_0x2b8367)['isBefore'](_0x29de45);}else if(_0x2b8367){return!![];}else{return![];}}; \ No newline at end of file +var _0x98ea=['GETVOICEQUEUEBYNAME|','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','format','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','bluebird','http','../../config/logger','xdr','info','debug','stringify','error','stack','request','then','catch','GetUser','name','interface','result','length','FOUND','getUserByInternal','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout'];(function(_0x958cdf,_0x57a848){var _0x231543=function(_0x351bda){while(--_0x351bda){_0x958cdf['push'](_0x958cdf['shift']());}};_0x231543(++_0x57a848);}(_0x98ea,0x103));var _0xa98e=function(_0x542607,_0x27c30e){_0x542607=_0x542607-0x0;var _0x111384=_0x98ea[_0x542607];return _0x111384;};'use strict';var jayson=require(_0xa98e('0x0'));var moment=require(_0xa98e('0x1'));var BPromise=require(_0xa98e('0x2'));var client=jayson['client'][_0xa98e('0x3')]({'port':0x2329});var logger=require(_0xa98e('0x4'))(_0xa98e('0x5'));exports[_0xa98e('0x6')]=function(_0x533983){logger['info'](_0x533983);};exports[_0xa98e('0x7')]=function(_0x2efc4c){logger[_0xa98e('0x7')](JSON[_0xa98e('0x8')](_0x2efc4c));};exports[_0xa98e('0x9')]=function(_0x52ccdc){logger[_0xa98e('0x9')](_0x52ccdc[_0xa98e('0xa')]);};exports[_0xa98e('0xb')]=function(_0x10d4ba,_0x3a6d57){return client['request'](_0x10d4ba,{'body':_0x3a6d57})[_0xa98e('0xc')](function(_0x3f640e){logger[_0xa98e('0x7')](JSON['stringify'](_0x3f640e));})[_0xa98e('0xd')](function(_0x23faba){logger[_0xa98e('0x9')](_0x23faba[_0xa98e('0xa')]);});};function getUser(_0x1243cc){return client[_0xa98e('0xb')](_0xa98e('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0xa98e('0xf'),_0xa98e('0x10')],'where':_0x1243cc,'limit':0x1}})['then'](function(_0x3fc5c7){logger[_0xa98e('0x6')]('GETUSER|'+JSON[_0xa98e('0x8')](_0x1243cc)+'|'+(_0x3fc5c7[_0xa98e('0x11')][_0xa98e('0x12')]?_0xa98e('0x13'):'NOTFOUND'));return _0x3fc5c7[_0xa98e('0x11')]['length']?_0x3fc5c7[_0xa98e('0x11')][0x0]:null;});}exports[_0xa98e('0x14')]=function(_0x36930b){return new BPromise(function(_0x42dc2e,_0x97c793){if(_0x36930b){return getUser({'internal':_0x36930b})[_0xa98e('0xc')](function(_0x12dcd4){return _0x42dc2e(_0x12dcd4);})[_0xa98e('0xd')](function(_0x59157f){logger[_0xa98e('0x9')](_0x59157f['stack']);return _0x42dc2e(null);});}else{return _0x42dc2e(null);}});};exports[_0xa98e('0x15')]=function(_0x391d32){return new BPromise(function(_0x24021a,_0x540bd7){if(_0x391d32){return getUser({'interface':_0x391d32})[_0xa98e('0xc')](function(_0x540a34){return _0x24021a(_0x540a34);})[_0xa98e('0xd')](function(_0x309c7f){logger[_0xa98e('0x9')](_0x309c7f[_0xa98e('0xa')]);return _0x24021a(null);});}else{return _0x24021a(null);}});};exports[_0xa98e('0x16')]=function(_0xd4c179){return new BPromise(function(_0x3838ff,_0x29009f){if(_0xd4c179){return getUser({'name':_0xd4c179})[_0xa98e('0xc')](function(_0x3277b0){return _0x3838ff(_0x3277b0);})[_0xa98e('0xd')](function(_0x1083bd){logger[_0xa98e('0x9')](_0x1083bd['stack']);return _0x3838ff(null);});}else{return _0x3838ff(null);}});};exports[_0xa98e('0x17')]=function(_0x447c6b){return new BPromise(function(_0x427108,_0x118ebd){if(_0x447c6b){return client[_0xa98e('0xb')](_0xa98e('0x18'),{'options':{'raw':!![],'attributes':['id',_0xa98e('0xf'),_0xa98e('0x19'),_0xa98e('0x1a'),_0xa98e('0x1b')],'where':{'name':_0x447c6b},'limit':0x1}})[_0xa98e('0xc')](function(_0x55ad69){logger[_0xa98e('0x6')](_0xa98e('0x1c')+_0x447c6b+'|'+(_0x55ad69['result']['length']?_0xa98e('0x13'):'NOTFOUND'));return _0x427108(_0x55ad69[_0xa98e('0x11')]['length']?_0x55ad69[_0xa98e('0x11')][0x0]:null);})[_0xa98e('0xd')](function(_0x4202bd){logger[_0xa98e('0x9')](_0x4202bd[_0xa98e('0xa')]);return _0x427108(null);});}else{return _0x427108(null);}});};exports[_0xa98e('0x1d')]=function(_0x2b67f1,_0x9728fb){return moment(_0x2b67f1)[_0xa98e('0x1e')](_0x9728fb,'seconds')['format'](_0xa98e('0x1f'));};exports[_0xa98e('0x20')]=function(_0x16e975,_0x575e92){return moment(_0x16e975)[_0xa98e('0x21')](_0x575e92,_0xa98e('0x22'))[_0xa98e('0x23')](_0xa98e('0x1f'));};exports['diffTime']=function(_0x32a1aa,_0x95ed1a){return moment(_0x32a1aa)[_0xa98e('0x24')](moment(_0x95ed1a),_0xa98e('0x22'));};exports[_0xa98e('0x25')]=function(_0x395448,_0x982dcc){return parseInt(_0x395448,0xa)+parseInt(_0x982dcc,0xa);};exports[_0xa98e('0x26')]=function(){return moment()['format'](_0xa98e('0x1f'));};exports[_0xa98e('0x27')]=function(_0x1f185f,_0x511b14){if(_0x511b14){return moment(_0x1f185f)['isAfter'](_0x511b14);}else{return!![];}};exports[_0xa98e('0x28')]=function(_0x3cf446,_0x488638){if(_0x488638){return moment(_0x3cf446)[_0xa98e('0x28')](_0x488638);}else if(_0x3cf446){return!![];}else{return![];}}; \ No newline at end of file